Branch oldpackages for 14.07
authorcyrus <cyrus@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 20 Aug 2014 08:44:13 +0000 (08:44 +0000)
committercyrus <cyrus@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 20 Aug 2014 08:44:13 +0000 (08:44 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_14.07@42224 3c298f89-4303-0410-b956-a3cf2f4a3e73

2335 files changed:
.gitignore [new file with mode: 0644]
admin/facter/Makefile [new file with mode: 0644]
admin/gkrellmd/Makefile [new file with mode: 0644]
admin/gkrellmd/files/gkrellmd.init [new file with mode: 0644]
admin/gkrellmd/patches/100-conf.patch [new file with mode: 0644]
admin/nagios-plugins/Makefile [new file with mode: 0644]
admin/nagios-plugins/patches/002-plugins.patch [new file with mode: 0644]
admin/nagios-plugins/patches/003-pgsl-header-fix.patch [new file with mode: 0644]
admin/nagios/Makefile [new file with mode: 0644]
admin/nrpe/Makefile [new file with mode: 0644]
admin/nrpe/files/nrpe.cfg [new file with mode: 0644]
admin/nrpe/files/nrpe.init [new file with mode: 0644]
admin/nrpe/patches/100-openssl-dh.patch [new file with mode: 0644]
admin/nsca/Makefile [new file with mode: 0644]
admin/osiris/Makefile [new file with mode: 0644]
admin/osiris/files/osirisd.init [new file with mode: 0644]
admin/osiris/patches/001-configure-cross.patch [new file with mode: 0644]
admin/osiris/patches/002-osirisd-pidfile.patch [new file with mode: 0644]
admin/osiris/patches/003-openssl-0.9.8+.patch [new file with mode: 0644]
admin/osiris/patches/004-no_openssl_ripe.patch [new file with mode: 0644]
admin/osiris/patches/006-mod_nvram.patch [new file with mode: 0644]
admin/osiris/patches/007-mod_uptime.patch [new file with mode: 0644]
admin/osiris/patches/010-dont-add-host-include-paths.patch [new file with mode: 0644]
admin/ostiary/Makefile [new file with mode: 0644]
admin/ostiary/files/ostiaryd.init [new file with mode: 0644]
admin/ostiary/files/ssh_disable [new file with mode: 0644]
admin/ostiary/files/ssh_enable [new file with mode: 0644]
admin/pmacct/Makefile [new file with mode: 0644]
admin/pmacct/files/nfacctd.conf [new file with mode: 0644]
admin/pmacct/files/nfacctd.default [new file with mode: 0644]
admin/pmacct/files/nfacctd.init [new file with mode: 0644]
admin/pmacct/files/pmacctd.conf [new file with mode: 0644]
admin/pmacct/files/pmacctd.default [new file with mode: 0644]
admin/pmacct/files/pmacctd.init [new file with mode: 0644]
admin/pmacct/files/sfacctd.conf [new file with mode: 0644]
admin/pmacct/files/sfacctd.default [new file with mode: 0644]
admin/pmacct/files/sfacctd.init [new file with mode: 0644]
admin/pmacct/files/uacctd.conf [new file with mode: 0644]
admin/pmacct/files/uacctd.default [new file with mode: 0644]
admin/pmacct/files/uacctd.init [new file with mode: 0644]
admin/sudo/Makefile [new file with mode: 0644]
admin/sudo/files/sudo.init [new file with mode: 0755]
admin/syslog-ng/Makefile [new file with mode: 0644]
admin/syslog-ng/files/syslog-ng.conf [new file with mode: 0644]
admin/syslog-ng/files/syslog-ng.init [new file with mode: 0644]
admin/syslog-ng/patches/001-no_lfl.patch [new file with mode: 0644]
admin/syslog-ng3/Makefile [new file with mode: 0644]
admin/syslog-ng3/files/syslog-ng.conf [new file with mode: 0644]
admin/syslog-ng3/files/syslog-ng.init [new file with mode: 0644]
devel/build-essential/Makefile [new file with mode: 0644]
devel/build-essential/files/usr/src/hello/hello.c [new file with mode: 0644]
devel/cppunit/Makefile [new file with mode: 0644]
devel/diffutils/Makefile [new file with mode: 0644]
devel/dmalloc/Makefile [new file with mode: 0644]
devel/dmalloc/patches/100-configure_pagesize.patch [new file with mode: 0644]
devel/dmalloc/patches/110-configure_cxx.patch [new file with mode: 0644]
devel/dmalloc/patches/120-makefile_shared.patch [new file with mode: 0644]
devel/dmalloc/patches/130-makefile_destdir.patch [new file with mode: 0644]
devel/dmalloc/patches/200-fix_return_address.patch [new file with mode: 0644]
devel/dmalloc/patches/210-fix_threads.patch [new file with mode: 0644]
devel/dmalloc/patches/300-fix_summarize_script.patch [new file with mode: 0644]
devel/dmalloc/patches/400-undef-strndup.patch [new file with mode: 0644]
devel/electric-fence/Makefile [new file with mode: 0644]
devel/gcc/Makefile [new file with mode: 0644]
devel/ksymoops/Makefile [new file with mode: 0644]
devel/lttng-tools/Makefile [new file with mode: 0644]
devel/lttng-tools/patches/001-uclibc_sync_file_ranges.patch [new file with mode: 0644]
devel/make/Makefile [new file with mode: 0644]
devel/perf/Makefile [new file with mode: 0644]
devel/sysprof/Makefile [new file with mode: 0644]
devel/sysprof/patches/define-NT_GNU_BUILD_ID.patch [new file with mode: 0644]
devel/sysprof/patches/rmb-arm.patch [new file with mode: 0644]
devel/sysprof/patches/rmb-mips.patch [new file with mode: 0644]
ipv6/6tunnel/Makefile [new file with mode: 0644]
ipv6/6tunnel/patches/100-arm-fix-optc-initialization.patch [new file with mode: 0644]
ipv6/dhcp6/Makefile [new file with mode: 0644]
ipv6/dhcp6/patches/001-opt_flags.patch [new file with mode: 0644]
ipv6/dhcp6/patches/002-gcc_lvalue.patch [new file with mode: 0644]
ipv6/dhcp6/patches/003-debug.patch [new file with mode: 0644]
ipv6/dibbler/Makefile [new file with mode: 0644]
ipv6/dibbler/files/dibbler-client.init [new file with mode: 0644]
ipv6/dibbler/files/dibbler-relay.init [new file with mode: 0644]
ipv6/dibbler/files/dibbler-server.init [new file with mode: 0644]
ipv6/gw6c/Makefile [new file with mode: 0644]
ipv6/gw6c/files/gw6c.config [new file with mode: 0644]
ipv6/gw6c/files/gw6c.init [new file with mode: 0755]
ipv6/gw6c/files/openwrt.sh [new file with mode: 0755]
ipv6/gw6c/patches/001-sed-separator.patch [new file with mode: 0644]
ipv6/ipv6calc/Makefile [new file with mode: 0644]
ipv6/miredo/Makefile [new file with mode: 0644]
ipv6/miredo/files/client-hook [new file with mode: 0644]
ipv6/miredo/files/miredo-server.init [new file with mode: 0644]
ipv6/miredo/files/miredo.init [new file with mode: 0644]
ipv6/miredo/patches/100-uclibc.patch [new file with mode: 0644]
ipv6/miredo/patches/110-fix_compile_error.patch [new file with mode: 0644]
ipv6/miredo/patches/120-automake-compat.patch [new file with mode: 0644]
ipv6/ndisc/Makefile [new file with mode: 0644]
ipv6/ndisc/patches/100-favor_bsd.patch [new file with mode: 0644]
ipv6/ndisc/patches/110-strverscmp.patch [new file with mode: 0644]
ipv6/ptrtd/Makefile [new file with mode: 0644]
ipv6/ptrtd/files/ptrtd.init [new file with mode: 0644]
ipv6/ptrtd/patches/100-ptrtd-0.5.2-openwrt.patch [new file with mode: 0644]
ipv6/radvd/Makefile [new file with mode: 0644]
ipv6/radvd/files/radvd.config [new file with mode: 0644]
ipv6/radvd/files/radvd.init [new file with mode: 0644]
ipv6/radvd/patches/100-silent-netlink-config-reload.patch [new file with mode: 0644]
ipv6/send/Makefile [new file with mode: 0644]
ipv6/send/patches/001-libnetfilter_queue_update.patch [new file with mode: 0644]
ipv6/send/patches/002-handle_max_bits_conf.patch [new file with mode: 0644]
ipv6/send/patches/003-keysig_8bytes_alignment.patch [new file with mode: 0644]
ipv6/send/patches/004-always_link_with_ncurses.patch [new file with mode: 0644]
ipv6/send/patches/005-use-bundled-libconfig.patch [new file with mode: 0644]
ipv6/send/patches/006-openssl-1.0.0-compat.patch [new file with mode: 0644]
ipv6/send/patches/007-use-flex.patch [new file with mode: 0644]
ipv6/shorewall6-lite/Makefile [new file with mode: 0644]
ipv6/shorewall6-lite/files/hostname [new file with mode: 0644]
ipv6/shorewall6-lite/files/hotplug_iface [new file with mode: 0644]
ipv6/shorewall6-lite/files/shorewall-lite.init [new file with mode: 0644]
ipv6/shorewall6-lite/files/vardir [new file with mode: 0644]
ipv6/shorewall6-lite/patches/110-MODULESDIR.patch [new file with mode: 0644]
ipv6/shorewall6-lite/patches/120-LOGFILE.patch [new file with mode: 0644]
ipv6/totd/Makefile [new file with mode: 0644]
ipv6/totd/files/totd.conf [new file with mode: 0644]
ipv6/totd/files/totd.init [new file with mode: 0644]
ipv6/totd/patches/001-no_warning_as_errors.patch [new file with mode: 0644]
ipv6/tspc/Makefile [new file with mode: 0644]
ipv6/tspc/patches/001-debian_patches.patch [new file with mode: 0644]
ipv6/tunslip6/Makefile [new file with mode: 0644]
ipv6/wide-dhcpv6/Makefile [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6c-dnsmasq.hotplug [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6c-radvd.hotplug [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6c-state [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6c.config [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6c.hotplug [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6c.init [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6s.config [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6s.hotplug [new file with mode: 0644]
ipv6/wide-dhcpv6/files/dhcp6s.init [new file with mode: 0644]
ipv6/wide-dhcpv6/patches/000-cftoken-noyywrap.patch [new file with mode: 0644]
ipv6/wide-dhcpv6/patches/001-linux_old_compat.patch [new file with mode: 0644]
ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch [new file with mode: 0644]
lang/4th/Makefile [new file with mode: 0644]
lang/arm/Makefile [new file with mode: 0644]
lang/cython/Makefile [new file with mode: 0644]
lang/distribute/Makefile [new file with mode: 0644]
lang/egenix-mx/Makefile [new file with mode: 0644]
lang/eggdrop/Makefile [new file with mode: 0644]
lang/eggdrop/patches/001-makefile_in.patch [new file with mode: 0644]
lang/eggdrop/patches/002-eggdrop_h.patch [new file with mode: 0644]
lang/eggdrop/patches/003-language_c.patch [new file with mode: 0644]
lang/eggdrop/patches/004-main_c.patch [new file with mode: 0644]
lang/erlang/Makefile [new file with mode: 0644]
lang/erlang/patches/101-emulator_includes.patch [new file with mode: 0644]
lang/erlang/patches/103-disable_emacs.patch [new file with mode: 0644]
lang/gst-python/Makefile [new file with mode: 0644]
lang/ipython/Makefile [new file with mode: 0644]
lang/jamvm/Makefile [new file with mode: 0644]
lang/jsonpath/Makefile [new file with mode: 0644]
lang/kid/Makefile [new file with mode: 0644]
lang/kid/patches/000-setup.patch [new file with mode: 0644]
lang/logilab-astng/Makefile [new file with mode: 0644]
lang/logilab-common/Makefile [new file with mode: 0644]
lang/lsqlite3/Makefile [new file with mode: 0644]
lang/luacurl/Makefile [new file with mode: 0644]
lang/luaprofiler/Makefile [new file with mode: 0644]
lang/luaprofiler/patches/100-link.patch [new file with mode: 0644]
lang/luasoap/Makefile [new file with mode: 0644]
lang/luasql/Makefile [new file with mode: 0644]
lang/luavstruct/Makefile [new file with mode: 0644]
lang/mako/Makefile [new file with mode: 0644]
lang/numpy/Makefile [new file with mode: 0644]
lang/numpy/patches/100-compile.patch [new file with mode: 0644]
lang/php-pear-db/Makefile [new file with mode: 0644]
lang/php-pear-db/patches/100-php5-deprecation-fixes.patch [new file with mode: 0644]
lang/php-pear-xmlrpc/Makefile [new file with mode: 0644]
lang/php-pear/Makefile [new file with mode: 0644]
lang/php-pear/patches/000-remove_deprecation_messages.patch [new file with mode: 0644]
lang/php5-pecl-apc/Makefile [new file with mode: 0644]
lang/php5-pecl-bcompiler/Makefile [new file with mode: 0644]
lang/php5-pecl-dio/Makefile [new file with mode: 0644]
lang/php5-pecl-dio/patches/010-additional-baudrates.patch [new file with mode: 0644]
lang/php5-pecl-http/Makefile [new file with mode: 0644]
lang/php5-pecl-libevent/Makefile [new file with mode: 0644]
lang/php5/Makefile [new file with mode: 0644]
lang/php5/files/php.ini [new file with mode: 0644]
lang/php5/files/php5-fastcgi.config [new file with mode: 0644]
lang/php5/files/php5-fastcgi.init [new file with mode: 0644]
lang/php5/patches/090-restore-sqlite2.patch [new file with mode: 0644]
lang/php5/patches/091-fix-sqlite2.patch [new file with mode: 0644]
lang/php5/patches/101-fix_membar_producer_link_error_gcc3x.patch [new file with mode: 0644]
lang/php5/patches/102-debian_patches_use_embedded_timezonedb.patch [new file with mode: 0644]
lang/php5/patches/103-debian_patches_use_embedded_timezonedb.patch [new file with mode: 0644]
lang/php5/patches/950-Fix-dl-cross-compiling-issue.patch [new file with mode: 0644]
lang/php5/pecl.mk [new file with mode: 0644]
lang/psycopg/Makefile [new file with mode: 0644]
lang/pybluez/Makefile [new file with mode: 0644]
lang/pyclips/Makefile [new file with mode: 0644]
lang/pyevent/Makefile [new file with mode: 0644]
lang/pyevent/patches/000-libenevt_path_from_env.patch [new file with mode: 0644]
lang/pyevent/patches/001-event-pyx-python25.patch [new file with mode: 0644]
lang/pygobject/Makefile [new file with mode: 0644]
lang/pymysql/Makefile [new file with mode: 0644]
lang/pymysql/patches/000-setup.patch [new file with mode: 0644]
lang/pymysql/patches/010-threadsafe.patch [new file with mode: 0644]
lang/pyopenssl/Makefile [new file with mode: 0644]
lang/pypcap/Makefile [new file with mode: 0644]
lang/pypcap/patches/000-no_cpickle.patch [new file with mode: 0644]
lang/pypcap/patches/001-python2_5.patch [new file with mode: 0644]
lang/pyrrd/Makefile [new file with mode: 0644]
lang/pyrrd/patches/101-cross.patch [new file with mode: 0644]
lang/pyrrd/patches/200-fetch.patch [new file with mode: 0644]
lang/pyserial/Makefile [new file with mode: 0644]
lang/pysqlite/Makefile [new file with mode: 0644]
lang/pysqlite/files/setup.cfg.in [new file with mode: 0644]
lang/python-cjson/Makefile [new file with mode: 0644]
lang/python-cjson/patches/001-unicode-buffer-overflow.patch [new file with mode: 0644]
lang/python-crypto/Makefile [new file with mode: 0644]
lang/python-crypto/patches/001-no-host-paths.patch [new file with mode: 0644]
lang/python-curl/Makefile [new file with mode: 0644]
lang/python-curl/patches/001-no_static.patch [new file with mode: 0644]
lang/python-dbus/Makefile [new file with mode: 0644]
lang/python-django/Makefile [new file with mode: 0644]
lang/python-eeml/Makefile [new file with mode: 0644]
lang/python-eeml/patches/101-cross.patch [new file with mode: 0644]
lang/python-flup/Makefile [new file with mode: 0644]
lang/python-ifconfig/Makefile [new file with mode: 0644]
lang/python-ifconfig/patches/001-errorcheck.patch [new file with mode: 0644]
lang/python-ifconfig/patches/002-checkflags-up.patch [new file with mode: 0644]
lang/python-imaging-library/Makefile [new file with mode: 0644]
lang/python-imaging-library/patches/101-cross_compile.patch [new file with mode: 0644]
lang/python-json/Makefile [new file with mode: 0644]
lang/python-mimms/Makefile [new file with mode: 0644]
lang/python-pydaemon/Makefile [new file with mode: 0644]
lang/python-pyosc/Makefile [new file with mode: 0644]
lang/python-rsfile/Makefile [new file with mode: 0644]
lang/python-sip/Makefile [new file with mode: 0644]
lang/python-sip/files/python-sip-package.mk [new file with mode: 0644]
lang/python-sip/files/sipconfig.macros.template [new file with mode: 0644]
lang/python-sip/patches/100-cross-compile.patch [new file with mode: 0644]
lang/python-webpy/Makefile [new file with mode: 0644]
lang/python/Makefile [new file with mode: 0644]
lang/python/files/python-package.mk [new file with mode: 0644]
lang/python/patches/000-cross-compile.patch [new file with mode: 0644]
lang/python/patches/020-dont-compile-python-files.patch [new file with mode: 0644]
lang/python/patches/030-fixup-include-dirs.patch [new file with mode: 0644]
lang/python/patches/040-dont-import-cross-compiled-modules.patch [new file with mode: 0644]
lang/python/patches/070-dont-clean-ipkg-install.patch [new file with mode: 0644]
lang/python/patches/080-distutils-dont_adjust_files.patch [new file with mode: 0644]
lang/python/patches/110-enable-zlib.patch [new file with mode: 0644]
lang/python/patches/120-force-internal-modules-for-hashlib.patch [new file with mode: 0644]
lang/python/patches/130-readline-setup.patch [new file with mode: 0644]
lang/python/patches/140-verbose-sharedmods.patch [new file with mode: 0644]
lang/python/patches/150-no-sqlite-rpath.patch [new file with mode: 0644]
lang/python2-chardet/Makefile [new file with mode: 0644]
lang/pyusb/Makefile [new file with mode: 0644]
lang/pyxdg/Makefile [new file with mode: 0644]
lang/pyyaml/Makefile [new file with mode: 0644]
lang/ruby/Makefile [new file with mode: 0644]
lang/ruby/patches/001-ignore_wide_getaddrinfo_while_crosscompiling.patch [new file with mode: 0644]
lang/sigscheme/Makefile [new file with mode: 0644]
lang/simplejson/Makefile [new file with mode: 0644]
lang/sqlite3-ruby/Makefile [new file with mode: 0644]
lang/tcl/Makefile [new file with mode: 0644]
lang/tcl/patches/100-disable_tzdata_and_msgs_install.patch [new file with mode: 0644]
lang/tcl/patches/200-fix_mips_build.patch [new file with mode: 0644]
lang/telepathy-python/Makefile [new file with mode: 0644]
lang/twisted/Makefile [new file with mode: 0644]
lang/twisted/patches/000-select_submodules.patch [new file with mode: 0644]
lang/twisted/patches/001-dont_use_zope.patch [new file with mode: 0644]
lang/urbi/Makefile [new file with mode: 0644]
lang/urbi/patches/001-no_examples.patch [new file with mode: 0644]
lang/urbi/patches/005-fix-gcc_4_3-compile.patch [new file with mode: 0644]
lang/vala/Makefile [new file with mode: 0644]
lang/xapian-bindings/Makefile [new file with mode: 0644]
lang/yapsnmp/Makefile [new file with mode: 0644]
lang/yapsnmp/patches/000-compile_fix.patch [new file with mode: 0644]
lang/yapsnmp/patches/001-automake-compat.patch [new file with mode: 0644]
libs/aalib/Makefile [new file with mode: 0644]
libs/aalib/patches/001-destdir.patch [new file with mode: 0644]
libs/aalib/patches/002-configure.patch [new file with mode: 0644]
libs/argtable/Makefile [new file with mode: 0644]
libs/axtls/Makefile [new file with mode: 0644]
libs/axtls/files/config [new file with mode: 0644]
libs/axtls/patches/001-opt_flags.patch [new file with mode: 0644]
libs/axtls/patches/002-axhttpd_install.patch [new file with mode: 0644]
libs/bluez-libs/Makefile [new file with mode: 0644]
libs/bluez-libs/patches/010-dont-override-libdir.patch [new file with mode: 0644]
libs/boost/Makefile [new file with mode: 0644]
libs/boost/patches/100-do-not-use-librt.patch [new file with mode: 0644]
libs/boost/patches/200-cstdint_missing_include.patch [new file with mode: 0644]
libs/cgilib/Makefile [new file with mode: 0644]
libs/cgilib/patches/200-cgitest_bugfix.patch [new file with mode: 0644]
libs/cgilib/patches/300-cpp_bugfix.patch [new file with mode: 0644]
libs/check/Makefile [new file with mode: 0644]
libs/classpath/Makefile [new file with mode: 0644]
libs/classpath/patches/000-fix_include.patch [new file with mode: 0644]
libs/clearsilver/Config.in [new file with mode: 0644]
libs/clearsilver/Makefile [new file with mode: 0644]
libs/clearsilver/patches/001-gcc-vs-dollar-cc.patch [new file with mode: 0644]
libs/clearsilver/patches/002-make-install-depends.patch [new file with mode: 0644]
libs/clearsilver/patches/003-disable-tests.patch [new file with mode: 0644]
libs/clearsilver/patches/100-remove_warnings.patch [new file with mode: 0644]
libs/clearsilver/patches/101-fix_content_type_ff3.patch [new file with mode: 0644]
libs/clearsilver/patches/102-add_x_requested_http_headers.patch [new file with mode: 0644]
libs/clinkc/Makefile [new file with mode: 0644]
libs/confuse/Makefile [new file with mode: 0644]
libs/confuse/patches/001-no_werror.patch [new file with mode: 0644]
libs/credis/Makefile [new file with mode: 0644]
libs/credis/patches/200-Makefile.patch [new file with mode: 0644]
libs/cyrus-sasl/Makefile [new file with mode: 0644]
libs/cyrus-sasl/patches/001-automake-compat.patch [new file with mode: 0644]
libs/cyrus-sasl/patches/200-fix_avr32_compile.patch [new file with mode: 0644]
libs/dbus-glib/Makefile [new file with mode: 0644]
libs/dbus-glib/patches/001-cross.patch [new file with mode: 0644]
libs/dbus-glib/patches/003-disable-tests-docs-examples.patch [new file with mode: 0644]
libs/elfutils/Makefile [new file with mode: 0644]
libs/elfutils/patches/001-elfutils-portability.patch [new file with mode: 0644]
libs/elfutils/patches/002-no_tests.patch [new file with mode: 0644]
libs/elfutils/patches/004-memcpy_def.patch [new file with mode: 0644]
libs/elfutils/patches/005-only_libdw_libelf.patch [new file with mode: 0644]
libs/elfutils/patches/006-libdw_LIBS.patch [new file with mode: 0644]
libs/elfutils/patches/007-no_textrel_checks.patch [new file with mode: 0644]
libs/eventlog/Makefile [new file with mode: 0644]
libs/ezxml/Makefile [new file with mode: 0644]
libs/ezxml/patches/100-cross_compile.patch [new file with mode: 0644]
libs/ezxml/patches/101-build_shared.patch [new file with mode: 0644]
libs/ezxml/patches/200-ezxml_parse_str.patch [new file with mode: 0644]
libs/ezxml/patches/201-ezxml_int.patch [new file with mode: 0644]
libs/ezxml/patches/202-ezxml_child.patch [new file with mode: 0644]
libs/ezxml/patches/203-ezxml_cut.patch [new file with mode: 0644]
libs/fftw3/Makefile [new file with mode: 0644]
libs/fftw3/patches/001-makefile.patch [new file with mode: 0644]
libs/file/Makefile [new file with mode: 0644]
libs/freetype/Makefile [new file with mode: 0644]
libs/fribidi/Makefile [new file with mode: 0644]
libs/ftplib/Makefile [new file with mode: 0644]
libs/ftplib/patches/001-fix_ascii_read_without_eol.patch [new file with mode: 0644]
libs/ftplib/patches/002-check_getserv_by_name.patch [new file with mode: 0644]
libs/giflib/Makefile [new file with mode: 0644]
libs/glib/Makefile [new file with mode: 0644]
libs/glib/patches/001-automake-compat.patch [new file with mode: 0644]
libs/glib/patches/002-glibconfig-sysdefs.h.patch [new file with mode: 0644]
libs/glib/patches/003-gcc-3.4-compat.patch [new file with mode: 0644]
libs/glib/patches/004-underquoted-glib.m4.patch [new file with mode: 0644]
libs/glibmm/Makefile [new file with mode: 0644]
libs/glibmm/patches/100-disable-examples-tests-doc-tools-scripts.patch [new file with mode: 0644]
libs/google-authenticator/Makefile [new file with mode: 0644]
libs/google-authenticator/patches/000-ld.patch [new file with mode: 0644]
libs/gperf/Makefile [new file with mode: 0644]
libs/gpgme/Makefile [new file with mode: 0644]
libs/gsl/Makefile [new file with mode: 0644]
libs/gsm/Makefile [new file with mode: 0644]
libs/gsm/patches/001-debian-libsgm-1.0.10-13.patch [new file with mode: 0644]
libs/gssdp/Makefile [new file with mode: 0644]
libs/gupnp-av/Makefile [new file with mode: 0644]
libs/gupnp-dlna/Makefile [new file with mode: 0644]
libs/gupnp-vala/Makefile [new file with mode: 0644]
libs/gupnp-vala/patches/010-no-tests.patch [new file with mode: 0644]
libs/gupnp/Makefile [new file with mode: 0644]
libs/howl/Makefile [new file with mode: 0644]
libs/howl/files/autoipd.init [new file with mode: 0644]
libs/howl/files/mDNSResponder.conf [new file with mode: 0644]
libs/howl/files/mDNSResponder.init [new file with mode: 0644]
libs/howl/files/nifd.init [new file with mode: 0644]
libs/howl/patches/001-config.patch [new file with mode: 0644]
libs/howl/patches/002-debug_log.patch [new file with mode: 0644]
libs/howl/patches/003-proto_fix.patch [new file with mode: 0644]
libs/howl/patches/004-linux_types.patch [new file with mode: 0644]
libs/id3lib/Makefile [new file with mode: 0644]
libs/id3lib/patches/100-missing_include.patch [new file with mode: 0644]
libs/id3lib/patches/120-fix-configure-remove-check-for-iomanip_h.patch [new file with mode: 0644]
libs/id3lib/patches/130-fix-includes.patch [new file with mode: 0644]
libs/id3lib/patches/140-dont-build-examples.patch [new file with mode: 0644]
libs/iksemel/Makefile [new file with mode: 0644]
libs/iksemel/patches/001-missing-macros.patch [new file with mode: 0644]
libs/jansson/Makefile [new file with mode: 0644]
libs/jansson/patches/01-jansson-add-jason_object_deep_update.patch [new file with mode: 0644]
libs/jansson/patches/100-add-jason_object_deep_update.patch [new file with mode: 0644]
libs/keynote/Makefile [new file with mode: 0644]
libs/keynote/patches/001-build.patch [new file with mode: 0644]
libs/keynote/patches/002-cross_compile.patch [new file with mode: 0644]
libs/ldns/Makefile [new file with mode: 0644]
libs/leptonica/Makefile [new file with mode: 0644]
libs/libIDL2/Makefile [new file with mode: 0644]
libs/libamsel/Makefile [new file with mode: 0644]
libs/libao/Makefile [new file with mode: 0644]
libs/libart/Makefile [new file with mode: 0644]
libs/libassuan/Makefile [new file with mode: 0644]
libs/libatomicops/Makefile [new file with mode: 0644]
libs/libcelt/Makefile [new file with mode: 0644]
libs/libcli/Makefile [new file with mode: 0644]
libs/libcroco/Makefile [new file with mode: 0644]
libs/libcroco/patches/001-automake-compat.patch [new file with mode: 0644]
libs/libcrypto++/Makefile [new file with mode: 0644]
libs/libcrypto++/patches/001-strict_gcc43_include.patch [new file with mode: 0644]
libs/libcrypto++/patches/002-cryptest_data_files_location.patch [new file with mode: 0644]
libs/libcrypto++/patches/003-autoconf_files.patch [new file with mode: 0644]
libs/libcrypto++/patches/004-gcc4.7.0.patch [new file with mode: 0644]
libs/libcunit/Makefile [new file with mode: 0644]
libs/libdaq/Makefile [new file with mode: 0644]
libs/libdaq/patches/001-cross-compile-test.patch [new file with mode: 0644]
libs/libdbi-drivers/Makefile [new file with mode: 0644]
libs/libdbi-drivers/patches/001_libsqlite3_fix.patch [new file with mode: 0644]
libs/libdbi/Makefile [new file with mode: 0644]
libs/libdirectfb/Makefile [new file with mode: 0644]
libs/libdirectfb/patches/001-disable-asm.patch [new file with mode: 0644]
libs/libdirectfb/patches/002-use-volatile-keyword.patch [new file with mode: 0644]
libs/libdlna/Makefile [new file with mode: 0644]
libs/libdlna/patches/010-configure-crosscompile.patch [new file with mode: 0644]
libs/libdlna/patches/200-parallel-build.patch [new file with mode: 0644]
libs/libdlna/patches/300-ffmpeg_compat.patch [new file with mode: 0644]
libs/libdmapsharing/Makefile [new file with mode: 0644]
libs/libdmapsharing/patches/001-diable_pixbuf.patch [new file with mode: 0644]
libs/libdnet/Makefile [new file with mode: 0644]
libs/libdnet/patches/001-dnet_config.patch [new file with mode: 0644]
libs/libdnet/patches/002-fix_avr32_compile.patch [new file with mode: 0644]
libs/libdnet/patches/010-gcc4.patch [new file with mode: 0644]
libs/libdvbpsi/Makefile [new file with mode: 0644]
libs/libdvbpsi/patches/001-no_doc_examples.patch [new file with mode: 0644]
libs/libdvdread/Makefile [new file with mode: 0644]
libs/libfreefare/Makefile [new file with mode: 0644]
libs/libfreenect/Makefile [new file with mode: 0644]
libs/libfreenect/patches/001-cflags_override.patch [new file with mode: 0644]
libs/libgee/Makefile [new file with mode: 0644]
libs/libgphoto2/Makefile [new file with mode: 0644]
libs/libgphoto2/patches/001-automake-compat.patch [new file with mode: 0644]
libs/libgphoto2/patches/002-no-tests-docs-examples-translations.patch [new file with mode: 0644]
libs/libgssapi/Makefile [new file with mode: 0644]
libs/libimobiledevice/Makefile [new file with mode: 0644]
libs/libinklevel/Makefile [new file with mode: 0644]
libs/libinklevel/patches/001-configure.patch [new file with mode: 0644]
libs/libinklevel/patches/002-disable_parport.patch [new file with mode: 0644]
libs/libinklevel/patches/003-fix_usb_device_location.patch [new file with mode: 0644]
libs/libipfix/Makefile [new file with mode: 0644]
libs/libipfix/extra/append-wprobe-ie.pl [new file with mode: 0644]
libs/libipfix/extra/wprobe-ie.txt [new file with mode: 0644]
libs/libipfix/patches/100-openimp_sync.patch [new file with mode: 0644]
libs/libipfix/patches/110-wprobe_ie.patch [new file with mode: 0644]
libs/libipfix/patches/120-ipfixmisc.patch [new file with mode: 0644]
libs/libipfix/patches/130-fix-string-problems.patch [new file with mode: 0644]
libs/liblo/Makefile [new file with mode: 0644]
libs/libmbus/Makefile [new file with mode: 0644]
libs/libmcrypt/Makefile [new file with mode: 0644]
libs/libmicrohttpd/Makefile [new file with mode: 0644]
libs/libmicroxml/Makefile [new file with mode: 0644]
libs/libmikmod/Makefile [new file with mode: 0644]
libs/libmikmod/patches/001-disable-doc.patch [new file with mode: 0644]
libs/libmikmod/patches/003-automake-compat.patch [new file with mode: 0644]
libs/libmpcdec/Makefile [new file with mode: 0644]
libs/libmpcdec/patches/001-automake-compat.patch [new file with mode: 0644]
libs/libmpcdec/patches/100-fixed_point.patch [new file with mode: 0644]
libs/libmpd/Makefile [new file with mode: 0644]
libs/libnatpmp/Makefile [new file with mode: 0644]
libs/libnatpmp/patches/001-cross_compile.patch [new file with mode: 0644]
libs/libnet-1.0.x/Makefile [new file with mode: 0644]
libs/libnet-1.0.x/patches/100-debian_subset.patch.gz [new file with mode: 0644]
libs/libnet-1.0.x/patches/150-portability.patch [new file with mode: 0644]
libs/libnet-1.0.x/patches/200-no_cflags_ovveride.patch [new file with mode: 0644]
libs/libnet-1.1.x/Makefile [new file with mode: 0644]
libs/libnet-1.1.x/patches/100-debian-subset.patch [new file with mode: 0644]
libs/libnet-1.1.x/patches/150-portability.patch [new file with mode: 0644]
libs/libnet-1.1.x/patches/160-endian_cache.patch [new file with mode: 0644]
libs/libnetfilter-log/Makefile [new file with mode: 0644]
libs/libnetfilter-queue/Makefile [new file with mode: 0644]
libs/libnfc/Makefile [new file with mode: 0644]
libs/libnfsidmap/Makefile [new file with mode: 0644]
libs/libnfsidmap/patches/000-no-getgrouplist.patch [new file with mode: 0644]
libs/libnids/Makefile [new file with mode: 0644]
libs/libnids/patches/001-no_asm_for_i386.patch [new file with mode: 0644]
libs/libnids/patches/002-configure.patch [new file with mode: 0644]
libs/libol/Makefile [new file with mode: 0644]
libs/libotr/Makefile [new file with mode: 0644]
libs/libotr/patches/001-no-host-paths.patch [new file with mode: 0644]
libs/libpar2/Makefile [new file with mode: 0644]
libs/libpar2/patches/100-par2cmdline-0.4-packed.patch [new file with mode: 0644]
libs/libpfm/Makefile [new file with mode: 0644]
libs/libplist/Makefile [new file with mode: 0644]
libs/libpthread-stubs/Makefile [new file with mode: 0644]
libs/libptmalloc3/Makefile [new file with mode: 0644]
libs/libptmalloc3/patches/100-nothreads.patch [new file with mode: 0644]
libs/libqmi/Makefile [new file with mode: 0644]
libs/librpcsecgss/Makefile [new file with mode: 0644]
libs/librsync/Makefile [new file with mode: 0644]
libs/librsync/patches/001-4gb_files.patch [new file with mode: 0644]
libs/libsamplerate/Makefile [new file with mode: 0644]
libs/libsamplerate/patches/001-fix-m4-loop.patch [new file with mode: 0644]
libs/libsdl/Makefile [new file with mode: 0644]
libs/libsdl/patches/001-automake-compat.patch [new file with mode: 0644]
libs/libsdl_mixer/Makefile [new file with mode: 0644]
libs/libsdl_mixer/files/sdl-config [new file with mode: 0755]
libs/libsdl_mixer/patches/001-automake-compat.patch [new file with mode: 0644]
libs/libsdl_mixer/patches/002-fix-linking.patch [new file with mode: 0644]
libs/libsdl_sound/Makefile [new file with mode: 0644]
libs/libshout/Makefile [new file with mode: 0644]
libs/libshout/patches/120-vorbis-c.patch [new file with mode: 0644]
libs/libshout/patches/140-no_example_doc_win32.patch [new file with mode: 0644]
libs/libsml/Makefile [new file with mode: 0644]
libs/libsml/patches/010-no-examples-tests.patch [new file with mode: 0644]
libs/libsml/patches/020-ldflags.patch [new file with mode: 0644]
libs/libsml/patches/030-cross_compile.patch [new file with mode: 0644]
libs/libsocketcan/Makefile [new file with mode: 0644]
libs/libsoup/Makefile [new file with mode: 0644]
libs/libspe2/Makefile [new file with mode: 0644]
libs/libspe2/patches/001-remove_tls_requirement.patch [new file with mode: 0644]
libs/libsynce/Makefile [new file with mode: 0644]
libs/libtorrent/Makefile [new file with mode: 0644]
libs/libtorrent/patches/100-fix_cross_compile.patch [new file with mode: 0644]
libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch [new file with mode: 0644]
libs/libtwin/Makefile [new file with mode: 0644]
libs/libtwin/patches/100-compile_fix.patch [new file with mode: 0644]
libs/libugpio/Makefile [new file with mode: 0644]
libs/libusbmuxd/Makefile [new file with mode: 0644]
libs/libvncserver/Makefile [new file with mode: 0644]
libs/libvncserver/patches/001-automake-compat.patch [new file with mode: 0644]
libs/libvncserver/patches/100-noexamples.patch [new file with mode: 0644]
libs/libxapian/Makefile [new file with mode: 0644]
libs/libxapian/patches/001-missing_includes.patch [new file with mode: 0644]
libs/libxapian/patches/002-xapian_config_no_ltlibs.patch [new file with mode: 0644]
libs/libyaml/Makefile [new file with mode: 0644]
libs/libzip/Makefile [new file with mode: 0644]
libs/libzstream/Makefile [new file with mode: 0644]
libs/loudmouth/Makefile [new file with mode: 0644]
libs/lttng-ust/Makefile [new file with mode: 0644]
libs/lttng-ust/patches/001.no_docs_tests.patch [new file with mode: 0644]
libs/matrixssl/Makefile [new file with mode: 0644]
libs/matrixssl/patches/100-matrixssl_1.2.4.patch [new file with mode: 0644]
libs/matrixssl/patches/200-compile-fixes.patch [new file with mode: 0644]
libs/mxml/Makefile [new file with mode: 0644]
libs/mxml/patches/001-targets.patch [new file with mode: 0644]
libs/mysql/Makefile [new file with mode: 0644]
libs/mysql/conf/my.cnf [new file with mode: 0644]
libs/mysql/files/mysqld.init [new file with mode: 0644]
libs/mysql/patches/100-fix_hostname.patch [new file with mode: 0644]
libs/mysql/patches/110-cross_compile.patch [new file with mode: 0644]
libs/neon/Makefile [new file with mode: 0644]
libs/neon/patches/001-automake-compat.patch [new file with mode: 0644]
libs/newt/Makefile [new file with mode: 0644]
libs/newt/patches/100-compile-fix-broken-makefile.patch [new file with mode: 0644]
libs/newt/patches/110-disable-snackmodule-python.patch [new file with mode: 0644]
libs/nmeap/Makefile [new file with mode: 0644]
libs/nmeap/patches/100-no_test.patch [new file with mode: 0644]
libs/opencdk/Makefile [new file with mode: 0644]
libs/opencdk/patches/100-fix-tests-build [new file with mode: 0644]
libs/opencdk/patches/200-verify-clearsigned.patch [new file with mode: 0644]
libs/openldap/Makefile [new file with mode: 0644]
libs/openldap/files/ldap.init [new file with mode: 0644]
libs/openldap/patches/001-automake-compat.patch [new file with mode: 0644]
libs/openldap/patches/020-autofs-schema.patch [new file with mode: 0644]
libs/openldap/patches/750-no-strip.patch [new file with mode: 0644]
libs/orbit2/Makefile [new file with mode: 0644]
libs/orbit2/patches/010-dont-run-testprograms.patch [new file with mode: 0644]
libs/orbit2/patches/020-build-fix.patch [new file with mode: 0644]
libs/ortp/Makefile [new file with mode: 0644]
libs/ortp/patches/001-memset_fix.patch [new file with mode: 0644]
libs/ossp-js/Makefile [new file with mode: 0644]
libs/phidget21/Makefile [new file with mode: 0644]
libs/poco/Makefile [new file with mode: 0644]
libs/poco/patches/100-sharedmemory.patch [new file with mode: 0644]
libs/pthsem/Makefile [new file with mode: 0644]
libs/qrencode/Makefile [new file with mode: 0644]
libs/radiusclient-ng/Makefile [new file with mode: 0644]
libs/radiusclient-ng/patches/001-cross_compile.patch [new file with mode: 0644]
libs/radlib/Makefile [new file with mode: 0644]
libs/radlib/patches/001-cross_compile_link_bug.patch [new file with mode: 0644]
libs/rblibtorrent/Makefile [new file with mode: 0644]
libs/rblibtorrent/patches/enable-shared-linking.patch [new file with mode: 0644]
libs/sctp/Makefile [new file with mode: 0644]
libs/serdisplib/Makefile [new file with mode: 0644]
libs/slang2/Makefile [new file with mode: 0644]
libs/slang2/files/ncurses5-config [new file with mode: 0755]
libs/sqlite2/Makefile [new file with mode: 0644]
libs/st2205tool/Makefile [new file with mode: 0644]
libs/st2205tool/patches/100-base-makefile.patch [new file with mode: 0644]
libs/st2205tool/patches/110-libst-makefile.patch [new file with mode: 0644]
libs/st2205tool/patches/120-setpic-makefile.patch [new file with mode: 0644]
libs/taglib/Makefile [new file with mode: 0644]
libs/taglib/patches/100-uclibc++-compat.patch [new file with mode: 0644]
libs/tiff/Makefile [new file with mode: 0644]
libs/tiff/patches/001-autoconf-compat.patch [new file with mode: 0644]
libs/tokyocabinet/Makefile [new file with mode: 0644]
libs/tokyocabinet/patches/100-remove_extra_paths_from_configure.patch [new file with mode: 0644]
libs/tokyocabinet/patches/200-uclibc_0.9.30_compat.patch [new file with mode: 0644]
libs/ucl/Makefile [new file with mode: 0644]
libs/ucl/patches/001-autoconf-compat.patch [new file with mode: 0644]
libs/uclibc++/patches/001-do-not-set-make.patch [new file with mode: 0644]
libs/ustl/Makefile [new file with mode: 0644]
libs/ustl/files/Common.mk [new file with mode: 0644]
libs/ustl/files/config.h [new file with mode: 0644]
libs/ustl/patches/001-install-DESTDIR.patch [new file with mode: 0644]
libs/ustl/patches/002-install_path.patch [new file with mode: 0644]
libs/ustl/patches/003-fix_stream_bounds_check_dep.patch [new file with mode: 0644]
libs/vips/Makefile [new file with mode: 0644]
libs/vips/patches/001-no_cpp.patch [new file with mode: 0644]
libs/wt/Makefile [new file with mode: 0644]
libs/wt/patches/100-fix_random_dev.patch [new file with mode: 0644]
libs/wt/patches/200-fix_boost_1_50_build.patch [new file with mode: 0644]
libs/wxbase/Makefile [new file with mode: 0644]
libs/xmlrpc-c/Makefile [new file with mode: 0644]
libs/xmlrpc-c/patches/001-config.mk.in.patch [new file with mode: 0644]
libs/xmlrpc-c/patches/002-automake-compat.patch [new file with mode: 0644]
libs/xmpp4r/Makefile [new file with mode: 0644]
mail/alpine/Makefile [new file with mode: 0644]
mail/fetchmail/Makefile [new file with mode: 0644]
mail/imapfilter/Makefile [new file with mode: 0644]
mail/imapfilter/patches/010-pathnames.patch [new file with mode: 0644]
mail/mini_sendmail/Makefile [new file with mode: 0644]
mail/mini_sendmail/patches/200-fullname.patch [new file with mode: 0644]
mail/mini_sendmail/patches/500-flags.patch [new file with mode: 0644]
mail/msmtp/Makefile [new file with mode: 0644]
mail/mutt/Makefile [new file with mode: 0644]
mail/mutt/patches/001-no_po_and_docs.patch [new file with mode: 0644]
mail/nullmailer/Makefile [new file with mode: 0644]
mail/procmail/Makefile [new file with mode: 0644]
mail/procmail/patches/001-procmail_openwrt.patch [new file with mode: 0644]
mail/procmail/patches/100-rename_getline.patch [new file with mode: 0644]
mail/ssmtp/Makefile [new file with mode: 0644]
mail/xmail/Makefile [new file with mode: 0644]
mail/xmail/files/xmail.config [new file with mode: 0644]
mail/xmail/files/xmail.init [new file with mode: 0644]
mail/xmail/patches/010-Makefile.common.patch [new file with mode: 0644]
mail/xmail/patches/020-Makefile.lnx.patch [new file with mode: 0644]
mail/xmail/patches/030-sysmachine.patch [new file with mode: 0644]
mail/xmail/patches/040-honour_opt_flags.patch [new file with mode: 0644]
mail/xmail/patches/050-ctrlclnt_add_ipv6_support.patch [new file with mode: 0644]
multimedia/darkice/Makefile [new file with mode: 0644]
multimedia/darkice/patches/001-upstream_svn_r494.patch [new file with mode: 0644]
multimedia/fswebcam/Makefile [new file with mode: 0644]
multimedia/ftpd-topfield/Makefile [new file with mode: 0644]
multimedia/ftpd-topfield/files/ftpd-topfield.config [new file with mode: 0644]
multimedia/ftpd-topfield/files/ftpd-topfield.init [new file with mode: 0644]
multimedia/ftpd-topfield/patches/001-kernel_header_rename.patch [new file with mode: 0644]
multimedia/gmediaserver/Makefile [new file with mode: 0644]
multimedia/gmediaserver/files/gmediaserver.config [new file with mode: 0644]
multimedia/gmediaserver/files/gmediaserver.init [new file with mode: 0644]
multimedia/gmediaserver/patches/010-compile-fixes.patch [new file with mode: 0644]
multimedia/gphoto2/Makefile [new file with mode: 0644]
multimedia/gphoto2/patches/001-automake-compat.patch [new file with mode: 0644]
multimedia/gphoto2/patches/002-disable-docs-translations.patch [new file with mode: 0644]
multimedia/gphoto2/patches/100-gpdebug.patch [new file with mode: 0644]
multimedia/graphicsmagick/Makefile [new file with mode: 0644]
multimedia/gst-ffmpeg/Config.in [new file with mode: 0644]
multimedia/gst-ffmpeg/Makefile [new file with mode: 0644]
multimedia/gst-plugins-bad/Makefile [new file with mode: 0644]
multimedia/gst-plugins-bad/patches/000-gettext.patch [new file with mode: 0644]
multimedia/gst-plugins-base/Makefile [new file with mode: 0644]
multimedia/gst-plugins-base/patches/001-no_docs.patch [new file with mode: 0644]
multimedia/gst-plugins-base/patches/002-no_tests.patch [new file with mode: 0644]
multimedia/gst-plugins-base/patches/003-no_translations.patch [new file with mode: 0644]
multimedia/gst-plugins-base/patches/004-vorbisdec-support_modern_Tremor_versions.patch [new file with mode: 0644]
multimedia/gst-plugins-good/Makefile [new file with mode: 0644]
multimedia/gst-plugins-good/patches/001-no_docs.patch [new file with mode: 0644]
multimedia/gst-plugins-good/patches/002-no_tests.patch [new file with mode: 0644]
multimedia/gst-plugins-good/patches/003-no_translations.patch [new file with mode: 0644]
multimedia/gst-plugins-ugly/Makefile [new file with mode: 0644]
multimedia/gst-plugins-ugly/patches/001-no_docs.patch [new file with mode: 0644]
multimedia/gst-plugins-ugly/patches/002-no_tests.patch [new file with mode: 0644]
multimedia/gst-plugins-ugly/patches/003-no_translations.patch [new file with mode: 0644]
multimedia/gstreamer/Makefile [new file with mode: 0644]
multimedia/gstreamer/patches/001-no_docs.patch [new file with mode: 0644]
multimedia/gstreamer/patches/002-no_tests.patch [new file with mode: 0644]
multimedia/gstreamer/patches/003-no_translations.patch [new file with mode: 0644]
multimedia/gstreamer/patches/004-add_gst_debug_log2_debug_symbol.patch [new file with mode: 0644]
multimedia/gstreamer/patches/005-YYLEX_PARAM_to_lex-param.patch [new file with mode: 0644]
multimedia/hasciicam/Makefile [new file with mode: 0644]
multimedia/imagemagick/Makefile [new file with mode: 0644]
multimedia/kissdx/Makefile [new file with mode: 0644]
multimedia/kissdx/files/kissdx.config [new file with mode: 0644]
multimedia/kissdx/files/kissdx.init [new file with mode: 0755]
multimedia/peercast/Makefile [new file with mode: 0644]
multimedia/peercast/files/peercast.ini [new file with mode: 0644]
multimedia/peercast/files/peercast.init [new file with mode: 0644]
multimedia/puppy/Makefile [new file with mode: 0644]
multimedia/rygel/Makefile [new file with mode: 0644]
multimedia/rygel/files/etc/config/rygel [new file with mode: 0644]
multimedia/rygel/files/etc/init.d/rygel [new file with mode: 0755]
multimedia/rygel/files/etc/rygel.conf [new file with mode: 0644]
multimedia/rygel/patches/010-conftest-honor-cc.patch [new file with mode: 0644]
multimedia/rygel/patches/010-identify-libs-by-suffix.patch [new file with mode: 0644]
multimedia/rygel/patches/010-vapidirs-from-pkg-config.patch [new file with mode: 0644]
multimedia/rygel/patches/020-playbin-mime-types.patch [new file with mode: 0644]
multimedia/rygel/patches/030-output-to-syslog.patch [new file with mode: 0644]
multimedia/tvheadend/Config.in [new file with mode: 0644]
multimedia/tvheadend/Makefile [new file with mode: 0644]
multimedia/tvheadend/files/tvheadend.init [new file with mode: 0644]
multimedia/tvheadend/files/tvheadend.upgrade [new file with mode: 0644]
multimedia/tvheadend/patches/001-fix_Makefile_VFP_CFLAGS.patch [new file with mode: 0644]
multimedia/ushare/Makefile [new file with mode: 0644]
multimedia/ushare/files/ushare.config [new file with mode: 0644]
multimedia/ushare/files/ushare.init [new file with mode: 0644]
multimedia/ushare/patches/100-configure_grep_fix.patch [new file with mode: 0644]
multimedia/ushare/patches/200-compile-fixes.patch [new file with mode: 0644]
net/aircrack-ng/Makefile [new file with mode: 0644]
net/aircrack-ng/patches/100-add-ignore-channel-negative-1.patch [new file with mode: 0644]
net/aircrack-ptw/Makefile [new file with mode: 0644]
net/aircrack-ptw/patches/001-smaller.patch [new file with mode: 0644]
net/airpwn/Makefile [new file with mode: 0644]
net/amule/Makefile [new file with mode: 0644]
net/amule/patches/001-gcc-fix.patch [new file with mode: 0644]
net/amule/patches/001-no_backtrace.patch [new file with mode: 0644]
net/amwall/Makefile [new file with mode: 0644]
net/amwall/patches/010-compile_fix.patch [new file with mode: 0644]
net/aodv-uu/Makefile [new file with mode: 0644]
net/aodv-uu/files/aodv-uu.modules [new file with mode: 0644]
net/aodv-uu/patches/001-normalize.patch [new file with mode: 0644]
net/aodv-uu/patches/002-linux_2.6.19_ip_route_me_harder_change.patch [new file with mode: 0644]
net/aodv-uu/patches/003-linux_2.6.19_security_netlink_recv_change.patch [new file with mode: 0644]
net/aodv-uu/patches/004-linux_2.6.19_includes.patch [new file with mode: 0644]
net/aodv-uu/patches/005-linux_2.6.22_skbuff.patch [new file with mode: 0644]
net/aoetools/Makefile [new file with mode: 0644]
net/apcupsd/Makefile [new file with mode: 0644]
net/apcupsd/files/apccontrol [new file with mode: 0644]
net/apcupsd/files/apcupsd.conf [new file with mode: 0644]
net/apcupsd/files/apcupsd.init [new file with mode: 0644]
net/apcupsd/files/apcupsd_mail.conf [new file with mode: 0644]
net/apcupsd/files/changeme [new file with mode: 0644]
net/apcupsd/files/commfailure [new file with mode: 0644]
net/apcupsd/files/commok [new file with mode: 0644]
net/apcupsd/files/offbattery [new file with mode: 0644]
net/apcupsd/files/onbattery [new file with mode: 0644]
net/apcupsd/patches/010-fix-include-paths.patch [new file with mode: 0644]
net/apf/Makefile [new file with mode: 0644]
net/apf/patches/001-cflags_override.patch [new file with mode: 0644]
net/appweb/Makefile [new file with mode: 0644]
net/appweb/patches/001-add-ipv6-in-configure.patch [new file with mode: 0644]
net/aprx/Makefile [new file with mode: 0644]
net/aprx/files/aprx.init [new file with mode: 0644]
net/aprx/patches/100-Makefile_in.patch [new file with mode: 0644]
net/arpd/Makefile [new file with mode: 0644]
net/arpd/patches/001-configure_no_bpf.patch [new file with mode: 0644]
net/arpd/patches/002-function_string.patch [new file with mode: 0644]
net/arpd/patches/003-pcap_and_arg.patch [new file with mode: 0644]
net/arpd/patches/004-no_dnet_config_check.patch [new file with mode: 0644]
net/arpd/patches/005-remove-dropped-libevent-features.patch [new file with mode: 0644]
net/arpwatch/Makefile [new file with mode: 0644]
net/arpwatch/files/arpwatch.init [new file with mode: 0644]
net/atftp/Makefile [new file with mode: 0644]
net/atftp/patches/100-mconfig.patch [new file with mode: 0644]
net/atftp/patches/110-services.patch [new file with mode: 0644]
net/atftp/patches/120-retry_setting.patch [new file with mode: 0644]
net/atftp/patches/130-missing_include.patch [new file with mode: 0644]
net/autossh/Makefile [new file with mode: 0644]
net/autossh/files/autossh.config [new file with mode: 0644]
net/autossh/files/autossh.hotplug [new file with mode: 0644]
net/autossh/files/autossh.init [new file with mode: 0644]
net/axel/Makefile [new file with mode: 0644]
net/bahamut/Makefile [new file with mode: 0644]
net/bahamut/patches/001-cross_compile.patch [new file with mode: 0644]
net/bahamut/patches/002-glibc_fix.patch [new file with mode: 0644]
net/bahamut/patches/010-dont-use-host-zlib.patch [new file with mode: 0644]
net/bind/Makefile [new file with mode: 0644]
net/bind/files/bind/db.0 [new file with mode: 0644]
net/bind/files/bind/db.127 [new file with mode: 0644]
net/bind/files/bind/db.255 [new file with mode: 0644]
net/bind/files/bind/db.local [new file with mode: 0644]
net/bind/files/bind/db.root [new file with mode: 0644]
net/bind/files/bind/named.conf.example [new file with mode: 0644]
net/bind/files/named.init [new file with mode: 0644]
net/bind/patches/001-no-tests.patch [new file with mode: 0644]
net/bing/Makefile [new file with mode: 0644]
net/bitchx/Makefile [new file with mode: 0644]
net/bitchx/files/bitchxrc [new file with mode: 0644]
net/bitchx/files/bitchxrc.init [new file with mode: 0644]
net/bitchx/patches/001-fix_declarations.patch [new file with mode: 0644]
net/bitchx/patches/002-tparm.patch [new file with mode: 0644]
net/bitlbee/Makefile [new file with mode: 0644]
net/bitlbee/files/bitlbee.init [new file with mode: 0644]
net/bitlbee/patches/100-cross_compile_configure_fix [new file with mode: 0644]
net/bmon/Makefile [new file with mode: 0644]
net/bmon/patches/001-bugfixes.patch [new file with mode: 0644]
net/bridge-utils/Makefile [new file with mode: 0644]
net/bridge-utils/patches/001-libbridge_cflags.patch [new file with mode: 0644]
net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch [new file with mode: 0644]
net/btpd/Makefile [new file with mode: 0644]
net/btpd/files/btpd.config [new file with mode: 0644]
net/btpd/files/btpd.init [new file with mode: 0644]
net/btpd/patches/000-sha1.diff [new file with mode: 0644]
net/btpd/patches/001-gettime.patch [new file with mode: 0644]
net/btpd/patches/002-config.h.patch [new file with mode: 0644]
net/btpd/patches/100-clock.diff [new file with mode: 0644]
net/bwm/Makefile [new file with mode: 0644]
net/bwm/patches/001-debian.patch [new file with mode: 0644]
net/bwping/Makefile [new file with mode: 0644]
net/cbtt/Makefile [new file with mode: 0644]
net/cbtt/patches/100-compile.patch [new file with mode: 0644]
net/cdp/Makefile [new file with mode: 0644]
net/cdp/patches/001-compile_fixes.patch [new file with mode: 0644]
net/chaosvpn/Makefile [new file with mode: 0644]
net/chaosvpn/files/chaosvpn.hotplug [new file with mode: 0644]
net/chaosvpn/files/chaosvpn.init [new file with mode: 0644]
net/chaosvpn/files/chaosvpn_config.sh [new file with mode: 0644]
net/chaosvpn/patches/001-dist-makefile.patch [new file with mode: 0644]
net/chillispot/Makefile [new file with mode: 0644]
net/chillispot/files/chillispot.init [new file with mode: 0644]
net/chillispot/patches/001-endian_fix.patch [new file with mode: 0644]
net/chillispot/patches/102-less_memory-footprint.patch [new file with mode: 0644]
net/chillispot/patches/110-macallowed_fix.patch [new file with mode: 0644]
net/chillispot/patches/120-fix_bufferoverflow.patch [new file with mode: 0644]
net/chillispot/patches/150-chillispot-rmtctrl.patch [new file with mode: 0644]
net/chillispot/patches/200-gcc_fix.patch [new file with mode: 0644]
net/chrony/Makefile [new file with mode: 0644]
net/chrony/files/chrony.conf [new file with mode: 0644]
net/chrony/files/chrony.keys [new file with mode: 0644]
net/chrony/files/ntpd.config [new file with mode: 0644]
net/chrony/files/ntpd.hotplug [new file with mode: 0644]
net/chrony/files/ntpd.init [new file with mode: 0644]
net/chrony/patches/001-crosscompile.patch [new file with mode: 0644]
net/chrony/patches/002-ipv6_disabled_fixes.patch [new file with mode: 0644]
net/cifs-utils/Makefile [new file with mode: 0644]
net/click/Makefile [new file with mode: 0644]
net/click/files/roofnet.init [new file with mode: 0644]
net/click/patches/100-compile_fix.patch [new file with mode: 0644]
net/click/patches/110-multithread_fix.patch [new file with mode: 0644]
net/cmdftp/Makefile [new file with mode: 0644]
net/coova-chilli/Config.in [new file with mode: 0644]
net/coova-chilli/Makefile [new file with mode: 0644]
net/coova-chilli/files/chilli.hotplug [new file with mode: 0644]
net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch [new file with mode: 0644]
net/corkscrew/Makefile [new file with mode: 0644]
net/crda/Makefile [new file with mode: 0644]
net/crda/files/hotplug.rule [new file with mode: 0644]
net/crda/patches/101-make_crypto_use_optional.patch [new file with mode: 0644]
net/crowdcontrol/Makefile [new file with mode: 0644]
net/cups-bjnp/Makefile [new file with mode: 0644]
net/cups/Makefile [new file with mode: 0644]
net/cups/files/cupsd.init [new file with mode: 0644]
net/cups/files/etc/cups/classes.conf [new file with mode: 0644]
net/cups/files/etc/cups/client.conf [new file with mode: 0644]
net/cups/files/etc/cups/cupsd.conf [new file with mode: 0644]
net/cups/files/etc/cups/printers.conf [new file with mode: 0644]
net/cups/patches/100-components.patch [new file with mode: 0644]
net/cups/patches/140-uname.patch [new file with mode: 0644]
net/cups/patches/150-64bit_host_fix.patch [new file with mode: 0644]
net/cups/patches/160-ppdc.patch [new file with mode: 0644]
net/cups/patches/200-str4181.patch [new file with mode: 0644]
net/cups/patches/210-str4194.patch [new file with mode: 0644]
net/curlftpfs/Makefile [new file with mode: 0644]
net/curlftpfs/patches/001-uclibc_mod.patch [new file with mode: 0644]
net/cutter/Makefile [new file with mode: 0644]
net/cutter/patches/001-nf_conntrack.patch [new file with mode: 0644]
net/daemonlogger/Makefile [new file with mode: 0644]
net/dansguardian/Makefile [new file with mode: 0644]
net/dansguardian/patches/001-include_dir.patch [new file with mode: 0644]
net/darkstat/Makefile [new file with mode: 0644]
net/darkstat/files/darkstat.config [new file with mode: 0644]
net/darkstat/files/darkstat.init [new file with mode: 0644]
net/darkstat/patches/100-do-not-use-NI_IDN.patch [new file with mode: 0644]
net/deluge/Makefile [new file with mode: 0644]
net/deluge/files/deluge.config [new file with mode: 0644]
net/deluge/files/deluge.init [new file with mode: 0644]
net/dhcp-forwarder/Makefile [new file with mode: 0644]
net/dhcp-forwarder/files/dhcp-fwd.init [new file with mode: 0644]
net/dhcpcd/Makefile [new file with mode: 0644]
net/dhcpcd/patches/001-configure_add_cflags_to_getifaddrs_test.patch [new file with mode: 0644]
net/dircproxy/Makefile [new file with mode: 0644]
net/ditg/Makefile [new file with mode: 0644]
net/djbdns/Changelog [new file with mode: 0644]
net/djbdns/Makefile [new file with mode: 0644]
net/djbdns/README [new file with mode: 0644]
net/djbdns/files/axfrdns.init [new file with mode: 0644]
net/djbdns/files/axfrdns/tcp [new file with mode: 0644]
net/djbdns/files/djbdns.conf [new file with mode: 0644]
net/djbdns/files/dnscache.init [new file with mode: 0644]
net/djbdns/files/dnscache/dnsroots.global [new file with mode: 0644]
net/djbdns/files/dnscache/ignoreip-update [new file with mode: 0644]
net/djbdns/files/dnscache/servers/@ [new file with mode: 0644]
net/djbdns/files/dnsqrx [new file with mode: 0644]
net/djbdns/files/dnsroots-update [new file with mode: 0644]
net/djbdns/files/rbldns.init [new file with mode: 0644]
net/djbdns/files/rbldns/data [new file with mode: 0644]
net/djbdns/files/tinydns.init [new file with mode: 0644]
net/djbdns/files/tinydns/add-alias [new file with mode: 0644]
net/djbdns/files/tinydns/add-childns [new file with mode: 0644]
net/djbdns/files/tinydns/add-host [new file with mode: 0644]
net/djbdns/files/tinydns/add-mx [new file with mode: 0644]
net/djbdns/files/tinydns/add-ns [new file with mode: 0644]
net/djbdns/files/tinydns/data [new file with mode: 0644]
net/djbdns/files/walldns.init [new file with mode: 0644]
net/djbdns/patches/010-crosscompile.patch [new file with mode: 0644]
net/djbdns/patches/020-dnsroots-update.patch [new file with mode: 0644]
net/djbdns/patches/030-srv-records-and-axfrget.patch [new file with mode: 0644]
net/djbdns/patches/040-dnscache-less-chatty-log.patch [new file with mode: 0644]
net/djbdns/patches/050-tinydns-mmap-leak.patch [new file with mode: 0644]
net/djbdns/patches/060-dnscache-big-udp-packets.patch [new file with mode: 0644]
net/djbdns/patches/070-dnscache-dpos-tcp-servfail.patch [new file with mode: 0644]
net/djbdns/patches/080-dnscache-cache-negatives.patch [new file with mode: 0644]
net/djbdns/patches/090-tinydns-one-second.patch [new file with mode: 0644]
net/djbdns/patches/110-dnscache-cachestats.patch [new file with mode: 0644]
net/djbdns/patches/120-compiler-temporary-filename.patch [new file with mode: 0644]
net/djbdns/patches/140-dnsnamex-extra-command.patch [new file with mode: 0644]
net/djbdns/patches/200-dnscache-cname-handling.patch [new file with mode: 0644]
net/djbdns/patches/210-dnscache-strict-forwardonly.patch [new file with mode: 0644]
net/djbdns/patches/220-dnscacheip-space-separator.patch [new file with mode: 0644]
net/djbdns/patches/230-tinydns-data-semantic-error.patch [new file with mode: 0644]
net/djbdns/patches/240-tinydns-alias-chain-truncation.patch [new file with mode: 0644]
net/djbdns/patches/250-dnscache-slogging.patch [new file with mode: 0644]
net/djbdns/patches/260-dnsfilter-replace.patch [new file with mode: 0644]
net/djbdns/patches/270-dnscache-sigpipe-fix.patch [new file with mode: 0644]
net/djbdns/patches/280-dnscache-ignoreip2.patch [new file with mode: 0644]
net/djbdns/patches/300-bugfix-dnscache-dempsky-poison.patch [new file with mode: 0644]
net/djbdns/patches/310-bugfix-dnscache-merge-outgoing-requests.patch [new file with mode: 0644]
net/djbdns/patches/320-bugfix-dnscache-cache-soa-records.patch [new file with mode: 0644]
net/dmapd/Makefile [new file with mode: 0644]
net/dmapd/files/dmapd.init [new file with mode: 0644]
net/dmapd/patches/001-dmapd_conf.patch [new file with mode: 0644]
net/dns2tcp/Makefile [new file with mode: 0644]
net/dsniff/Makefile [new file with mode: 0644]
net/dsniff/patches/001-arpspoof_fix.patch [new file with mode: 0644]
net/dsniff/patches/001-decode_pop.patch [new file with mode: 0644]
net/dsniff/patches/001-dns.patch [new file with mode: 0644]
net/dsniff/patches/003-gdbm.patch [new file with mode: 0644]
net/dsniff/patches/004-no_yp.patch [new file with mode: 0644]
net/dsniff/patches/005-openssl_fix.patch [new file with mode: 0644]
net/dsniff/patches/006-pcap_header.patch [new file with mode: 0644]
net/dsniff/patches/007-time_h.patch [new file with mode: 0644]
net/dsniff/patches/008-md5_include.patch [new file with mode: 0644]
net/dsniff/patches/010-clk-tck-fix.patch [new file with mode: 0644]
net/dsniff/patches/011-noint32.patch [new file with mode: 0644]
net/dudders/Makefile [new file with mode: 0644]
net/dudders/files/dudders.config [new file with mode: 0644]
net/dudders/files/dudders.hotplug [new file with mode: 0644]
net/e169-stats/Makefile [new file with mode: 0644]
net/e169-stats/patches/01-make.patch [new file with mode: 0644]
net/ekg/Makefile [new file with mode: 0644]
net/ekg/patches/100-compile-fixes.patch [new file with mode: 0644]
net/elinks/Makefile [new file with mode: 0644]
net/elinks/patches/002-fix_avr32_compile [new file with mode: 0644]
net/etherpuppet/Makefile [new file with mode: 0644]
net/ettercap/Makefile [new file with mode: 0644]
net/ettercap/patches/001-cross_compiling.patch [new file with mode: 0644]
net/ettercap/patches/002-libnet_check_honor_ldflags.patch [new file with mode: 0644]
net/ettercap/patches/003-automake-compat.patch [new file with mode: 0644]
net/ez-ipupdate/Makefile [new file with mode: 0644]
net/ez-ipupdate/files/ez-ipupdate.config [new file with mode: 0644]
net/ez-ipupdate/files/ez-ipupdate.hotplug [new file with mode: 0644]
net/ez-ipupdate/files/ez-ipupdate.init [new file with mode: 0644]
net/ez-ipupdate/patches/001-debian_subset.patch [new file with mode: 0644]
net/ez-ipupdate/patches/002-ez_ipupdate_everydns.patch [new file with mode: 0644]
net/ez-ipupdate/patches/003-dnsexit.patch [new file with mode: 0644]
net/ez-ipupdate/patches/004-zoneedit.patch [new file with mode: 0644]
net/ez-ipupdate/patches/005-endian-detection.patch [new file with mode: 0644]
net/faifa/Makefile [new file with mode: 0644]
net/fakeidentd/Makefile [new file with mode: 0644]
net/fakeidentd/files/fakeidentd.init [new file with mode: 0644]
net/flow-tools/Makefile [new file with mode: 0644]
net/flow-tools/patches/001-cross_compile_configure_fix.patch [new file with mode: 0644]
net/flow-tools/patches/002-flex_lib.patch [new file with mode: 0644]
net/flow-tools/patches/010-python_script_location_fix.patch [new file with mode: 0644]
net/flow-tools/patches/020-invalid_lvalue_in_assignment.patch [new file with mode: 0644]
net/flow-tools/patches/030-avoid_external_debug_var.patch [new file with mode: 0644]
net/flow-tools/patches/050-fix-64bit_temp_time_t.patch [new file with mode: 0644]
net/flow-tools/patches/060-fix_uninitialized_var_in_flow_send.patch [new file with mode: 0644]
net/flow-tools/patches/070-extra_ftpdu_verify_debugging.patch [new file with mode: 0644]
net/flow-tools/patches/080-fix_uninitialized_var_in_flow_export.patch [new file with mode: 0644]
net/flow-tools/patches/090-configure_cflags_override.patch [new file with mode: 0644]
net/fping/Makefile [new file with mode: 0644]
net/fping/patches/001-debian.patch [new file with mode: 0644]
net/fprobe-ulog/Makefile [new file with mode: 0644]
net/fprobe/Makefile [new file with mode: 0644]
net/freepops/Makefile [new file with mode: 0644]
net/frickin/Makefile [new file with mode: 0644]
net/frickin/files/frickin.config [new file with mode: 0644]
net/frickin/files/frickin.init [new file with mode: 0644]
net/gatling/Makefile [new file with mode: 0644]
net/gatling/patches/001-fix_ld_libs.patch [new file with mode: 0644]
net/gatling/patches/002-fix_flags.patch [new file with mode: 0644]
net/gatling/patches/010-add_semicolon.patch [new file with mode: 0644]
net/gesftpserver/Makefile [new file with mode: 0644]
net/gpsd/Makefile [new file with mode: 0644]
net/gpsd/files/gpsd.config [new file with mode: 0644]
net/gpsd/files/gpsd.hotplug [new file with mode: 0644]
net/gpsd/files/gpsd.init [new file with mode: 0644]
net/hiawatha/Makefile [new file with mode: 0644]
net/horst/Makefile [new file with mode: 0644]
net/horst/patches/100-compile-fixes.patch [new file with mode: 0644]
net/hping3/Makefile [new file with mode: 0644]
net/hping3/patches/100-makefile.patch [new file with mode: 0644]
net/hping3/patches/101-endianness.patch [new file with mode: 0644]
net/hping3/patches/102-lib_rename.patch [new file with mode: 0644]
net/hsflowd/Makefile [new file with mode: 0644]
net/hsflowd/files/hsflowd.config [new file with mode: 0644]
net/hsflowd/files/hsflowd.init [new file with mode: 0644]
net/hsflowd/files/sflowovsd.init [new file with mode: 0644]
net/hsflowd/patches/100-crosscompile.patch [new file with mode: 0644]
net/hsflowd/patches/200-uclibc-compat.patch [new file with mode: 0644]
net/hsflowd/patches/300-config_files_path.patch [new file with mode: 0644]
net/hsflowd/patches/400-sflowovsd_assert.patch [new file with mode: 0644]
net/htpdate/Makefile [new file with mode: 0644]
net/htpdate/files/htpdate.default [new file with mode: 0644]
net/htpdate/files/htpdate.init [new file with mode: 0644]
net/htpdate/patches/100-adjtimex.patch [new file with mode: 0644]
net/httping/Makefile [new file with mode: 0644]
net/httping/patches/001-no_strip.patch [new file with mode: 0644]
net/httptunnel/Makefile [new file with mode: 0644]
net/httptunnel/files/httptunnel.config [new file with mode: 0644]
net/httptunnel/files/httptunnel.init [new file with mode: 0644]
net/icmptx/Makefile [new file with mode: 0644]
net/icmptx/patches/001-cross_compile.patch [new file with mode: 0644]
net/ifstat/Makefile [new file with mode: 0644]
net/ifstat/patches/001-configure_cross.patch [new file with mode: 0644]
net/imsnif/Makefile [new file with mode: 0644]
net/imsnif/files/imsnif [new file with mode: 0755]
net/imsnif/patches/001-openwrt_paths.patch [new file with mode: 0644]
net/imspector/Makefile [new file with mode: 0644]
net/imspector/files/imspector.config [new file with mode: 0644]
net/imspector/files/imspector.init [new file with mode: 0644]
net/imspector/patches/010-openssl-1.0.0-compat.patch [new file with mode: 0644]
net/ipcad/Makefile [new file with mode: 0644]
net/ipcad/patches/001-honor_cppflags.patch [new file with mode: 0644]
net/ipcad/patches/010-no-host-includes.patch [new file with mode: 0644]
net/ipkungfu/Makefile [new file with mode: 0644]
net/ipkungfu/patches/001-replace-modprobe-with-insmod.patch [new file with mode: 0644]
net/ipsec-tools/Makefile [new file with mode: 0644]
net/ipsec-tools/files/racoon.init [new file with mode: 0644]
net/ipsec-tools/patches/001-ipsec-tools-def-psk.patch [new file with mode: 0644]
net/ipsec-tools/patches/001-no_libfl.patch [new file with mode: 0644]
net/ipsec-tools/patches/002-patch8-utmp.patch [new file with mode: 0644]
net/ipsec-tools/patches/003-microsoft-fqdn-in-main.patch [new file with mode: 0644]
net/ipsec-tools/patches/005-isakmp-fix.patch [new file with mode: 0644]
net/ipsec-tools/patches/006-linux-3.7-compat.patch [new file with mode: 0644]
net/iptables-snmp/Makefile [new file with mode: 0644]
net/iptables-snmp/patches/001-use_libiptc.patch [new file with mode: 0644]
net/iptraf/Makefile [new file with mode: 0644]
net/iptraf/patches/001-cross_compile.patch [new file with mode: 0644]
net/iptraf/patches/002-ifaces.patch [new file with mode: 0644]
net/iptraf/patches/003-exit_menu.patch [new file with mode: 0644]
net/iptraf/patches/004-includes_fix.patch [new file with mode: 0644]
net/iptraf/patches/005-atheros.patch [new file with mode: 0644]
net/iptraf/patches/005-no_size_cmd.patch [new file with mode: 0644]
net/ipupdate/Makefile [new file with mode: 0644]
net/ipupdate/patches/100-name_conflict.patch [new file with mode: 0644]
net/ipupdate/patches/200-byteorder.patch [new file with mode: 0644]
net/isakmpd/Makefile [new file with mode: 0644]
net/isakmpd/patches/010-debian_3.patch [new file with mode: 0644]
net/isakmpd/patches/020-standardize.patch [new file with mode: 0644]
net/isakmpd/patches/030-openssl_hashes.patch [new file with mode: 0644]
net/isakmpd/patches/040-security_fix.patch [new file with mode: 0644]
net/isakmpd/patches/050-ar_cross.patch [new file with mode: 0644]
net/isc-dhcp/Makefile [new file with mode: 0644]
net/isc-dhcp/files/dhclient-script [new file with mode: 0644]
net/isc-dhcp/files/dhclient.init [new file with mode: 0644]
net/isc-dhcp/files/dhclient6.conf [new file with mode: 0644]
net/isc-dhcp/files/dhclient6.init [new file with mode: 0644]
net/isc-dhcp/files/dhcpd.conf [new file with mode: 0644]
net/isc-dhcp/files/dhcpd.init [new file with mode: 0644]
net/isc-dhcp/files/dhcpd6.conf [new file with mode: 0644]
net/isc-dhcp/files/dhcpd6.init [new file with mode: 0644]
net/isc-dhcp/files/dhcrelay4.init [new file with mode: 0644]
net/isc-dhcp/files/dhcrelay6.init [new file with mode: 0644]
net/isc-dhcp/files/etc/config/dhcrelay [new file with mode: 0644]
net/isc-dhcp/patches/000-compile.patch [new file with mode: 0644]
net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch [new file with mode: 0644]
net/jtg/Makefile [new file with mode: 0644]
net/jtg/patches/001-Makefile_honor_CFLAGS_for_VFP.patch [new file with mode: 0644]
net/karma/Makefile [new file with mode: 0644]
net/keepalived/Makefile [new file with mode: 0644]
net/keepalived/files/keepalived.init [new file with mode: 0644]
net/kismet/Makefile [new file with mode: 0644]
net/kismet/files/ap_manuf [new file with mode: 0644]
net/kismet/files/client_manuf [new file with mode: 0644]
net/kismet/files/kismet.conf [new file with mode: 0644]
net/kismet/files/kismet_drone.conf [new file with mode: 0644]
net/kismet/files/kismet_ui.conf [new file with mode: 0644]
net/kismet/patches/010-dont-add-host-include-paths.patch [new file with mode: 0644]
net/knock/Makefile [new file with mode: 0644]
net/knock/patches/010_eglibc_define_PATH_MAX.patch [new file with mode: 0644]
net/l2tpd/Makefile [new file with mode: 0644]
net/l2tpd/files/l2tpd.conf [new file with mode: 0644]
net/l2tpd/files/l2tpd.init [new file with mode: 0644]
net/l2tpd/files/options.l2tpd [new file with mode: 0644]
net/l2tpd/patches/001-debian-2.patch [new file with mode: 0644]
net/l2tpd/patches/002-debian-2-pty-rev.patch [new file with mode: 0644]
net/l2tpd/patches/003-jacco-pty.patch [new file with mode: 0644]
net/l2tpd/patches/004-gcc4.patch [new file with mode: 0644]
net/l2tpd/patches/004-nonblock.patch [new file with mode: 0644]
net/l2tpd/patches/005-df-disable.patch [new file with mode: 0644]
net/l2tpns/Makefile [new file with mode: 0644]
net/l2tpns/patches/001-honor_includes_no_fifo_scheduler.patch [new file with mode: 0644]
net/l2tpv3tun/Makefile [new file with mode: 0644]
net/l2tpv3tun/files/l2tp.sh [new file with mode: 0644]
net/l2tpv3tun/patches/010-custom_ifname.patch [new file with mode: 0644]
net/l2tpv3tun/patches/100-nl_handle_alloc.patch [new file with mode: 0644]
net/l7-protocols/Makefile [new file with mode: 0644]
net/l7-protocols/patches/100-testing_crosscompile.patch [new file with mode: 0644]
net/l7-protocols/patches/101-testing-timeit.patch [new file with mode: 0644]
net/l7-protocols/patches/102-testing-doallspeeds.patch [new file with mode: 0644]
net/leafnode/Makefile [new file with mode: 0644]
net/leafnode/files/leafnode.init [new file with mode: 0644]
net/leafnode/files/news [new file with mode: 0644]
net/leafnode/files/nntp [new file with mode: 0644]
net/lft/Makefile [new file with mode: 0644]
net/lft/patches/001-no_strip.patch [new file with mode: 0644]
net/lftp/Makefile [new file with mode: 0644]
net/lftp/patches/001-libintl.patch [new file with mode: 0644]
net/linuxigd/Makefile [new file with mode: 0644]
net/linuxigd/files/upnpd.conf [new file with mode: 0644]
net/linuxigd/files/upnpd.init [new file with mode: 0644]
net/linuxigd/patches/001-iptables_defs.patch [new file with mode: 0644]
net/linuxigd/patches/002-netfilter_nat_headers.patch [new file with mode: 0644]
net/linuxigd/patches/003-Makefile-fix.patch [new file with mode: 0644]
net/linuxigd/patches/004-iptables-1.4.3.2-compat.patch [new file with mode: 0644]
net/linuxigd/patches/005-includes.patch [new file with mode: 0644]
net/lispmob/Makefile [new file with mode: 0644]
net/live/Makefile [new file with mode: 0644]
net/live/patches/101-openwrt.patch [new file with mode: 0644]
net/lsm/Makefile [new file with mode: 0644]
net/lsm/files/connections.conf [new file with mode: 0644]
net/lsm/files/lsm.conf [new file with mode: 0644]
net/lsm/files/lsm.init [new file with mode: 0644]
net/lsm/files/lsm_script [new file with mode: 0644]
net/mac-to-devinfo/Makefile [new file with mode: 0644]
net/mac-to-devinfo/files/clean-devinfo [new file with mode: 0644]
net/mac-to-devinfo/files/devinfo-functions.sh [new file with mode: 0644]
net/mac-to-devinfo/files/ip-to-devinfo [new file with mode: 0644]
net/mac-to-devinfo/files/mac-to-devinfo [new file with mode: 0644]
net/mac-to-devinfo/files/macdevdb [new file with mode: 0644]
net/mac-to-devinfo/files/mactodevinfo [new file with mode: 0644]
net/mac-to-devinfo/files/netdiscover-to-devinfo [new file with mode: 0644]
net/mac-to-devinfo/files/netsmap-to-devinfo [new file with mode: 0644]
net/mac-to-devinfo/files/prep-devinfo [new file with mode: 0644]
net/mac-to-devinfo/files/smap-to-devinfo [new file with mode: 0644]
net/madwifi/Config.in [new file with mode: 0644]
net/madwifi/Makefile [new file with mode: 0644]
net/madwifi/files/etc/hotplug.d/net/10-madwifi [new file with mode: 0644]
net/madwifi/files/lib/wifi/madwifi.sh [new file with mode: 0755]
net/madwifi/files/lib/wifi/madwifi_countrycodes.txt [new file with mode: 0644]
net/madwifi/patches/102-multicall_binary.patch [new file with mode: 0644]
net/madwifi/patches/104-autocreate_none.patch [new file with mode: 0644]
net/madwifi/patches/105-ratectl_attach.patch [new file with mode: 0644]
net/madwifi/patches/106-get_arch.patch [new file with mode: 0644]
net/madwifi/patches/111-minstrel_crash.patch [new file with mode: 0644]
net/madwifi/patches/113-no_ibss_pwrsave.patch [new file with mode: 0644]
net/madwifi/patches/122-replayfail_workaround.patch [new file with mode: 0644]
net/madwifi/patches/123-ccmp_checks.patch [new file with mode: 0644]
net/madwifi/patches/124-linux24_compat.patch [new file with mode: 0644]
net/madwifi/patches/126-rxerr_frames.patch [new file with mode: 0644]
net/madwifi/patches/200-no_debug.patch [new file with mode: 0644]
net/madwifi/patches/201-debug_fix.patch [new file with mode: 0644]
net/madwifi/patches/202-debug_variables.patch [new file with mode: 0644]
net/madwifi/patches/300-napi_polling.patch [new file with mode: 0644]
net/madwifi/patches/305-pureg_fix.patch [new file with mode: 0644]
net/madwifi/patches/309-micfail_detect.patch [new file with mode: 0644]
net/madwifi/patches/310-noise_get.patch [new file with mode: 0644]
net/madwifi/patches/311-bssid_alloc.patch [new file with mode: 0644]
net/madwifi/patches/312-erpupdate.patch [new file with mode: 0644]
net/madwifi/patches/317-bmask.patch [new file with mode: 0644]
net/madwifi/patches/323-dfs_optional.patch [new file with mode: 0644]
net/madwifi/patches/324-alignment.patch [new file with mode: 0644]
net/madwifi/patches/325-channel_spam.patch [new file with mode: 0644]
net/madwifi/patches/327-queue.patch [new file with mode: 0644]
net/madwifi/patches/330-beaconcal.patch [new file with mode: 0644]
net/madwifi/patches/331-memory_alloc.patch [new file with mode: 0644]
net/madwifi/patches/332-reset_beacons.patch [new file with mode: 0644]
net/madwifi/patches/333-apscan_mode.patch [new file with mode: 0644]
net/madwifi/patches/334-input.patch [new file with mode: 0644]
net/madwifi/patches/340-maxrate.patch [new file with mode: 0644]
net/madwifi/patches/341-minrate.patch [new file with mode: 0644]
net/madwifi/patches/342-performance.patch [new file with mode: 0644]
net/madwifi/patches/343-txqueue_races.patch [new file with mode: 0644]
net/madwifi/patches/344-minstrel_failcnt.patch [new file with mode: 0644]
net/madwifi/patches/345-minstrel_sampling.patch [new file with mode: 0644]
net/madwifi/patches/346-protmode_trig.patch [new file with mode: 0644]
net/madwifi/patches/347-tuning.patch [new file with mode: 0644]
net/madwifi/patches/348-ackcts.patch [new file with mode: 0644]
net/madwifi/patches/349-reset.patch [new file with mode: 0644]
net/madwifi/patches/350-wisoc_softled.patch [new file with mode: 0644]
net/madwifi/patches/351-scanlist.patch [new file with mode: 0644]
net/madwifi/patches/352-ani_fix.patch [new file with mode: 0644]
net/madwifi/patches/353-devid.patch [new file with mode: 0644]
net/madwifi/patches/354-lantiq_eeprom.patch [new file with mode: 0644]
net/madwifi/patches/355-eap_auth_disassoc.patch [new file with mode: 0644]
net/madwifi/patches/356-hidden_ssid.patch [new file with mode: 0644]
net/madwifi/patches/357-bgscan_thresh.patch [new file with mode: 0644]
net/madwifi/patches/358-ignore_broken_bssid.patch [new file with mode: 0644]
net/madwifi/patches/359-disable_reassoc.patch [new file with mode: 0644]
net/madwifi/patches/360-sta_nodes.patch [new file with mode: 0644]
net/madwifi/patches/361-bmiss_handling.patch [new file with mode: 0644]
net/madwifi/patches/362-rssithr.patch [new file with mode: 0644]
net/madwifi/patches/363-fix_turbo.patch [new file with mode: 0644]
net/madwifi/patches/364-memory_alloc.patch [new file with mode: 0644]
net/madwifi/patches/365-turbo_channelsearch.patch [new file with mode: 0644]
net/madwifi/patches/366-bstuck_thresh.patch [new file with mode: 0644]
net/madwifi/patches/367-roaming.patch [new file with mode: 0644]
net/madwifi/patches/368-sta_ie_preserve.patch [new file with mode: 0644]
net/madwifi/patches/369-mlme_assoc.patch [new file with mode: 0644]
net/madwifi/patches/370-wdsvap.patch [new file with mode: 0644]
net/madwifi/patches/372-queue_vif.patch [new file with mode: 0644]
net/madwifi/patches/373-sanity_check.patch [new file with mode: 0644]
net/madwifi/patches/374-nbtt_fix.patch [new file with mode: 0644]
net/madwifi/patches/375-atim_tsf_update.patch [new file with mode: 0644]
net/madwifi/patches/377-disable_vlan_code.patch [new file with mode: 0644]
net/madwifi/patches/378-adhoc_crash_fix.patch [new file with mode: 0644]
net/madwifi/patches/379-invalid_rate_fix.patch [new file with mode: 0644]
net/madwifi/patches/380-noderef_hack.patch [new file with mode: 0644]
net/madwifi/patches/381-ibss_modes.patch [new file with mode: 0644]
net/madwifi/patches/382-relax_bintval.patch [new file with mode: 0644]
net/madwifi/patches/383-ibss_hostap.patch [new file with mode: 0644]
net/madwifi/patches/384-hwdetect.patch [new file with mode: 0644]
net/madwifi/patches/385-antenna_fix.patch [new file with mode: 0644]
net/madwifi/patches/386-acl_crashfix.patch [new file with mode: 0644]
net/madwifi/patches/387-maxassoc.patch [new file with mode: 0644]
net/madwifi/patches/388-apsta_fix.patch [new file with mode: 0644]
net/madwifi/patches/389-autochannel.patch [new file with mode: 0644]
net/madwifi/patches/390-frame_type.patch [new file with mode: 0644]
net/madwifi/patches/391-vap_auth.patch [new file with mode: 0644]
net/madwifi/patches/392-remove_wds_nodetracking.patch [new file with mode: 0644]
net/madwifi/patches/393-mbss_vap_auth.patch [new file with mode: 0644]
net/madwifi/patches/394-probereq.patch [new file with mode: 0644]
net/madwifi/patches/395-ath_ff_unmap.patch [new file with mode: 0644]
net/madwifi/patches/396-napi_ff_fix.patch [new file with mode: 0644]
net/madwifi/patches/400-new_hal.patch [new file with mode: 0644]
net/madwifi/patches/401-changeset_r3602.patch [new file with mode: 0644]
net/madwifi/patches/402-changeset_r3603.patch [new file with mode: 0644]
net/madwifi/patches/403-changeset_r3605.patch [new file with mode: 0644]
net/madwifi/patches/404-linux24_fix.patch [new file with mode: 0644]
net/madwifi/patches/405-retransmit_check.patch [new file with mode: 0644]
net/madwifi/patches/406-monitor_r3711.patch [new file with mode: 0644]
net/madwifi/patches/407-new_athinfo.patch [new file with mode: 0644]
net/madwifi/patches/408-changeset_r3337.patch [new file with mode: 0644]
net/madwifi/patches/409-wext_compat.patch [new file with mode: 0644]
net/madwifi/patches/410-ar231x_2.6.28.patch [new file with mode: 0644]
net/madwifi/patches/411-autochannel_multi.patch [new file with mode: 0644]
net/madwifi/patches/412-fragmentation_fix.patch [new file with mode: 0644]
net/madwifi/patches/413-rxorn.patch [new file with mode: 0644]
net/madwifi/patches/414-txpower.patch [new file with mode: 0644]
net/madwifi/patches/415-chan_switch.patch [new file with mode: 0644]
net/madwifi/patches/416-wprobe.patch [new file with mode: 0644]
net/madwifi/patches/417-beacon_txpower.patch [new file with mode: 0644]
net/madwifi/patches/419-skb_unmap_crash.patch [new file with mode: 0644]
net/madwifi/patches/420-diversity_fix.patch [new file with mode: 0644]
net/madwifi/patches/421-channel_handling.patch [new file with mode: 0644]
net/madwifi/patches/422-confchange_reset.patch [new file with mode: 0644]
net/madwifi/patches/423-phyerr_handling.patch [new file with mode: 0644]
net/madwifi/patches/424-timing.patch [new file with mode: 0644]
net/madwifi/patches/425-rc_rexmit.patch [new file with mode: 0644]
net/madwifi/patches/426-header_len.patch [new file with mode: 0644]
net/madwifi/patches/427-ignore_eeprom_ff.patch [new file with mode: 0644]
net/madwifi/patches/430-use_netdev_priv.patch [new file with mode: 0644]
net/madwifi/patches/431-compile_fixes.patch [new file with mode: 0644]
net/madwifi/patches/432-netdev_ops.patch [new file with mode: 0644]
net/madwifi/patches/433-backport_remove_irq_none.patch [new file with mode: 0644]
net/madwifi/patches/434-name-alloc-fix.patch [new file with mode: 0644]
net/madwifi/patches/435-ibss_neighbor_fix.patch [new file with mode: 0644]
net/madwifi/patches/436-injection_checks.patch [new file with mode: 0644]
net/madwifi/patches/437-sysctl_cleanup.patch [new file with mode: 0644]
net/madwifi/patches/438-poweroffset_sysctl.patch [new file with mode: 0644]
net/madwifi/patches/439-wlanconfig_stack_usage.patch [new file with mode: 0644]
net/madwifi/patches/440-wme_cleanup.patch [new file with mode: 0644]
net/madwifi/patches/441-fix_ibss_node_handling.patch [new file with mode: 0644]
net/madwifi/patches/442-ibss_rx_filter.patch [new file with mode: 0644]
net/madwifi/patches/443-tx_drop_counter.patch [new file with mode: 0644]
net/madwifi/patches/444-beacon_update_war.patch [new file with mode: 0644]
net/madwifi/patches/445-fix_ps_sta_count.patch [new file with mode: 0644]
net/madwifi/patches/446-single_module.patch [new file with mode: 0644]
net/madwifi/patches/447-sta_reconnect.patch [new file with mode: 0644]
net/madwifi/patches/448-beacon_handling_fixes.patch [new file with mode: 0644]
net/madwifi/patches/449-fix_txbuf_leak.patch [new file with mode: 0644]
net/madwifi/patches/450-calibration.patch [new file with mode: 0644]
net/madwifi/patches/451-ibss_race_fix.patch [new file with mode: 0644]
net/madwifi/patches/452-minstrel_no_timer.patch [new file with mode: 0644]
net/madwifi/patches/453-procps.patch [new file with mode: 0644]
net/madwifi/patches/454-cca.patch [new file with mode: 0644]
net/madwifi/patches/455-beacon_watchdog.patch [new file with mode: 0644]
net/madwifi/patches/456-rfsilent.patch [new file with mode: 0644]
net/madwifi/patches/457-idletime.patch [new file with mode: 0644]
net/madwifi/patches/458-ibss_wpa_none.patch [new file with mode: 0644]
net/madwifi/patches/459-2.6.33_compile.patch [new file with mode: 0644]
net/madwifi/patches/460-pci_softled_disable.patch [new file with mode: 0644]
net/madwifi/patches/461-rx_stats_count_fix.patch [new file with mode: 0644]
net/madwifi/patches/462-fix_ap_scan.patch [new file with mode: 0644]
net/madwifi/patches/463-fix_txrate_display.patch [new file with mode: 0644]
net/madwifi/patches/464-0dbm_txpower_fix.patch [new file with mode: 0644]
net/madwifi/patches/465-mc_list-2.6.35.patch [new file with mode: 0644]
net/madwifi/patches/466-2.6.38_compile.patch [new file with mode: 0644]
net/madwifi/patches/470-mac_addresss_from_ath5k_platform_data.patch [new file with mode: 0644]
net/madwifi/patches/471-netdev_ops_mac_mtu.patch [new file with mode: 0644]
net/madwifi/patches/472-remove_11n_devids.patch [new file with mode: 0644]
net/madwifi/patches/473-mutex_fix.patch [new file with mode: 0644]
net/madwifi/patches/474_fix_ssid_scan_length.patch [new file with mode: 0644]
net/madwifi/patches/475-2.6.39-compile.patch [new file with mode: 0644]
net/madwifi/patches/476-3.0_detection_fix.patch [new file with mode: 0644]
net/madwifi/patches/477-3.2_fixes.patch [new file with mode: 0644]
net/madwifi/patches/478-remove_vlan_code.patch [new file with mode: 0644]
net/madwifi/patches/479-deprecate-devinitdata.patch [new file with mode: 0644]
net/madwifi/patches/480-remove_get-signal.patch [new file with mode: 0644]
net/madwifi/patches/481-fix_proc.patch [new file with mode: 0644]
net/madwifi/patches/482-fix_enum-compare.patch [new file with mode: 0644]
net/madwifi/patches/483-fix_frame-larger-than.patch [new file with mode: 0644]
net/madwimax/Makefile [new file with mode: 0644]
net/madwimax/files/20-madwimax [new file with mode: 0644]
net/madwimax/files/event.sh [new file with mode: 0644]
net/madwimax/files/madwimax.init [new file with mode: 0755]
net/madwimax/patches/001-fix_detection_on_be.patch [new file with mode: 0644]
net/maradns/Makefile [new file with mode: 0644]
net/maradns/files/maradns.init [new file with mode: 0644]
net/maradns/files/mararc [new file with mode: 0644]
net/maradns/patches/001-cross_compile_fix.patch [new file with mode: 0644]
net/matrixtunnel/Makefile [new file with mode: 0644]
net/mcabber/Makefile [new file with mode: 0644]
net/mdk3/Makefile [new file with mode: 0644]
net/mdk3/patches/001-radiotap_needs_types_h.patch [new file with mode: 0644]
net/mdk3/patches/010-fix-dependencies.patch [new file with mode: 0644]
net/mdk3/patches/020-Makefile_honour_CFLAGS_for_VFP.patch [new file with mode: 0644]
net/memcached/Makefile [new file with mode: 0644]
net/memcached/files/memcached.config [new file with mode: 0644]
net/memcached/files/memcached.init [new file with mode: 0644]
net/memcached/patches/100-fix_iov_max.patch [new file with mode: 0644]
net/mercurial/Makefile [new file with mode: 0644]
net/mercurial/patches/001-no_bzip2.patch [new file with mode: 0644]
net/mgen/Makefile [new file with mode: 0644]
net/mgen/patches/100-ipv6.patch [new file with mode: 0644]
net/mgen/patches/200-cflags_override.patch [new file with mode: 0644]
net/miau/Makefile [new file with mode: 0644]
net/miau/files/miau.init [new file with mode: 0644]
net/mii-tool/Makefile [new file with mode: 0644]
net/mini_httpd/Makefile [new file with mode: 0644]
net/mini_httpd/files/matrixssl_helper.c [new file with mode: 0644]
net/mini_httpd/files/matrixssl_helper.h [new file with mode: 0644]
net/mini_httpd/files/mini_httpd-ssl.conf [new file with mode: 0644]
net/mini_httpd/files/mini_httpd.conf [new file with mode: 0644]
net/mini_httpd/files/mini_httpd.default [new file with mode: 0644]
net/mini_httpd/files/mini_httpd.init [new file with mode: 0644]
net/mini_httpd/files/mini_httpd.pem [new file with mode: 0644]
net/mini_httpd/patches/001-cgi_path.patch [new file with mode: 0644]
net/mini_httpd/patches/500-matrixssl.patch [new file with mode: 0644]
net/mini_snmpd/Makefile [new file with mode: 0644]
net/mini_snmpd/files/mini_snmpd.config [new file with mode: 0644]
net/mini_snmpd/files/mini_snmpd.init [new file with mode: 0644]
net/mini_snmpd/patches/100-dualstack.patch [new file with mode: 0644]
net/mini_snmpd/patches/101-opt_flags.patch [new file with mode: 0644]
net/mini_snmpd/patches/102-mib_fix_uninitialized_memory.patch [new file with mode: 0644]
net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch [new file with mode: 0644]
net/mini_snmpd/patches/104-memset_fix.patch [new file with mode: 0644]
net/mosh/Makefile [new file with mode: 0644]
net/mosh/patches/disable-utf8-check.patch [new file with mode: 0644]
net/mrtg/Makefile [new file with mode: 0644]
net/mrtg/patches/001-rm-printf-longlong-fmt-test.patch [new file with mode: 0644]
net/mtr/Makefile [new file with mode: 0644]
net/mtr/patches/501-dns.patch [new file with mode: 0644]
net/mtr/patches/502-fix-res_ninit.patch [new file with mode: 0644]
net/mtr/patches/520-libresolv_fix.patch [new file with mode: 0644]
net/mtr/patches/521-gtk_fix.patch [new file with mode: 0644]
net/multiwan/Makefile [new file with mode: 0644]
net/multiwan/files/etc/config/multiwan [new file with mode: 0644]
net/multiwan/files/etc/init.d/multiwan [new file with mode: 0755]
net/multiwan/files/usr/bin/multiwan [new file with mode: 0755]
net/mutella/Makefile [new file with mode: 0644]
net/mutella/patches/001-no_backtrace.patch [new file with mode: 0644]
net/mutella/patches/002-gcc4_fixes.patch [new file with mode: 0644]
net/mutella/patches/003-gcc4_3_fixes.patch [new file with mode: 0644]
net/mutella/patches/004-no-host-paths.patch [new file with mode: 0644]
net/mvprelay/Makefile [new file with mode: 0644]
net/n2n/Makefile [new file with mode: 0644]
net/n2n/files/n2n.config [new file with mode: 0644]
net/n2n/files/n2n.init [new file with mode: 0644]
net/natpmp/Makefile [new file with mode: 0644]
net/natpmp/files/natpmp.config [new file with mode: 0644]
net/natpmp/files/natpmp.init [new file with mode: 0644]
net/nbd/Makefile [new file with mode: 0644]
net/nbtscan/Makefile [new file with mode: 0644]
net/ncftp/Makefile [new file with mode: 0644]
net/ndyndns/Makefile [new file with mode: 0644]
net/ndyndns/files/ndyndns.conf.sample [new file with mode: 0644]
net/ndyndns/files/ndyndns.init [new file with mode: 0644]
net/ndyndns/patches/010-dont-add-host-includes.patch [new file with mode: 0644]
net/ndyndns/patches/020-ndyndns.patch [new file with mode: 0644]
net/net-tools/Makefile [new file with mode: 0644]
net/net-tools/patches/001-config.patch [new file with mode: 0644]
net/net-tools/patches/002-compile-fixes.patch [new file with mode: 0644]
net/netatalk/Makefile [new file with mode: 0644]
net/netatalk/files/AppleVolumes.default [new file with mode: 0644]
net/netatalk/files/afpd.conf [new file with mode: 0644]
net/netatalk/files/afpd.init [new file with mode: 0644]
net/netatalk/patches/001-automake-compat.patch [new file with mode: 0644]
net/netcat/Makefile [new file with mode: 0644]
net/netcat/patches/001-netcat_flag_count.patch [new file with mode: 0644]
net/netdiscover/Makefile [new file with mode: 0644]
net/netdiscover/patches/00-add-machine-ouput.patch [new file with mode: 0644]
net/netdiscover/patches/01-initfix+end-fix.patch [new file with mode: 0644]
net/netio/Config.in [new file with mode: 0644]
net/netio/Makefile [new file with mode: 0644]
net/netio/patches/001-Makefile.patch [new file with mode: 0644]
net/netperf/Makefile [new file with mode: 0644]
net/netperf/files/netserver.init [new file with mode: 0644]
net/netpipe/Makefile [new file with mode: 0644]
net/netpipe/patches/001-Makefile_honor_CFLAGS_for_VFP.patch [new file with mode: 0644]
net/netstat-nat/Makefile [new file with mode: 0644]
net/nfs-server/Makefile [new file with mode: 0644]
net/nfs-server/files/nfsd.exports [new file with mode: 0644]
net/nfs-server/files/nfsd.init [new file with mode: 0644]
net/nfs-server/patches/001-build_config.patch [new file with mode: 0644]
net/nfs-server/patches/002-cross_compile_fix.patch [new file with mode: 0644]
net/nfs-server/patches/003-debian_subset.patch [new file with mode: 0644]
net/nfs-server/patches/004-gcc34_fix.patch [new file with mode: 0644]
net/nfs-server/patches/005-remove_warning.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/ngrep/Makefile [new file with mode: 0644]
net/ngrep/patches/001-makefile_in.patch [new file with mode: 0644]
net/ngrep/patches/001-ngrep.patch [new file with mode: 0644]
net/nmap/Makefile [new file with mode: 0644]
net/nocatauth/Makefile [new file with mode: 0644]
net/nocatauth/files/nocatauth-gateway [new file with mode: 0755]
net/nocatauth/patches/001-ptp-local.patch [new file with mode: 0644]
net/nocatauth/patches/002-openwrt.patch [new file with mode: 0644]
net/nocatauth/patches/003-fix-module-loading [new file with mode: 0644]
net/nocatauth/patches/004-fw_detect.patch [new file with mode: 0644]
net/nocatsplash/Makefile [new file with mode: 0644]
net/nocatsplash/patches/001-openwrt_firewall.patch [new file with mode: 0644]
net/nprobe/Makefile [new file with mode: 0644]
net/nprobe/patches/001-automake-compat.patch [new file with mode: 0644]
net/nprobe/patches/002-path_to_pcap.patch [new file with mode: 0644]
net/nprobe/patches/003-ipv6_fix.patch [new file with mode: 0644]
net/nstx/Makefile [new file with mode: 0644]
net/nstx/patches/001-debian_changes.patch [new file with mode: 0644]
net/ntpclient/Makefile [new file with mode: 0644]
net/ntpclient/files/ntpclient.config [new file with mode: 0644]
net/ntpclient/files/ntpclient.hotplug [new file with mode: 0644]
net/ntpclient/patches/100-daemon.patch [new file with mode: 0644]
net/ntripcaster/Makefile [new file with mode: 0644]
net/ntripclient/Makefile [new file with mode: 0644]
net/ntripserver/Makefile [new file with mode: 0644]
net/nufw/Makefile [new file with mode: 0644]
net/nufw/patches/001-no_doc_tests.patch [new file with mode: 0644]
net/nufw/patches/002-debian_fixes.patch [new file with mode: 0644]
net/nuttcp/Makefile [new file with mode: 0644]
net/nzbget/Makefile [new file with mode: 0644]
net/nzbget/patches/001-openssl-1.0.0-compat.patch [new file with mode: 0644]
net/nzbgetweb/Makefile [new file with mode: 0644]
net/nzbgetweb/files/httpd.conf [new file with mode: 0644]
net/nzbgetweb/files/lib/xmlrpc.inc [new file with mode: 0644]
net/nzbgetweb/files/lib/xmlrpc_wrappers.inc [new file with mode: 0644]
net/nzbgetweb/files/lib/xmlrpcs.inc [new file with mode: 0644]
net/obfsproxy/Makefile [new file with mode: 0644]
net/obfsproxy/patches/001-no-werror.patch [new file with mode: 0644]
net/obfsproxy/patches/002-no-build-hardening.patch [new file with mode: 0644]
net/oidentd/Makefile [new file with mode: 0644]
net/oidentd/files/oidentd.init [new file with mode: 0644]
net/opendchub/Makefile [new file with mode: 0644]
net/openl2tp/Makefile [new file with mode: 0644]
net/openl2tp/patches/001-makefile.patch [new file with mode: 0644]
net/openl2tp/patches/002-no_libfl.patch [new file with mode: 0644]
net/openl2tp/patches/010-ppp_unix.patch [new file with mode: 0644]
net/openl2tp/src/l2tp_rpc.h [new file with mode: 0644]
net/openl2tp/src/l2tp_rpc_client.c [new file with mode: 0644]
net/openl2tp/src/l2tp_rpc_server.c [new file with mode: 0644]
net/openl2tp/src/l2tp_rpc_xdr.c [new file with mode: 0644]
net/opennhrp/Makefile [new file with mode: 0644]
net/opennhrp/files/opennhrp.init [new file with mode: 0755]
net/openntpd/Makefile [new file with mode: 0644]
net/openntpd/files/ntpd.conf [new file with mode: 0644]
net/openntpd/files/ntpd.config [new file with mode: 0644]
net/openntpd/files/ntpd.hotplug [new file with mode: 0644]
net/openntpd/files/ntpd.init [new file with mode: 0644]
net/openntpd/patches/001-adjtimex_linux.patch [new file with mode: 0644]
net/openntpd/patches/002-save_freq_drift.patch [new file with mode: 0644]
net/openntpd/patches/003-no_permission_check.patch [new file with mode: 0644]
net/openrrcp/Makefile [new file with mode: 0644]
net/openrrcp/patches/001-Makefile_honor_CFLAGS_for_VFP.patch [new file with mode: 0644]
net/openslp/Makefile [new file with mode: 0644]
net/openslp/files/etc/init.d/slpd [new file with mode: 0644]
net/openslp/files/etc/slp.conf [new file with mode: 0644]
net/openslp/files/etc/slp.reg [new file with mode: 0644]
net/openslp/files/etc/slp.spi [new file with mode: 0644]
net/openswan/Makefile [new file with mode: 0644]
net/openswan/files/ipsec.conf [new file with mode: 0644]
net/openswan/files/ipsec.config [new file with mode: 0644]
net/openswan/files/ipsec.init [new file with mode: 0755]
net/openswan/files/ipsec.secrets [new file with mode: 0644]
net/openswan/files/ipsec.upgrade [new file with mode: 0644]
net/openswan/patches/100-cross_compile.patch [new file with mode: 0644]
net/openswan/patches/120-no_manpages.patch [new file with mode: 0644]
net/p910nd/Makefile [new file with mode: 0644]
net/p910nd/files/p910nd.config [new file with mode: 0644]
net/p910nd/files/p910nd.init [new file with mode: 0644]
net/paris-traceroute/Makefile [new file with mode: 0644]
net/parprouted/Makefile [new file with mode: 0644]
net/parprouted/files/parprouted.config [new file with mode: 0755]
net/parprouted/files/parprouted.init [new file with mode: 0644]
net/parprouted/patches/001-parprouted.patch [new file with mode: 0644]
net/pdnsd/Makefile [new file with mode: 0644]
net/pdnsd/files/pdnsd.init [new file with mode: 0644]
net/peerguardian/Makefile [new file with mode: 0644]
net/peerguardian/files/peerguardian.init [new file with mode: 0644]
net/peervpn/Makefile [new file with mode: 0644]
net/pen/Makefile [new file with mode: 0644]
net/pepperspot/Makefile [new file with mode: 0644]
net/pepperspot/files/pepperspot.init [new file with mode: 0644]
net/pepperspot/patches/101-cflags.patch [new file with mode: 0644]
net/pepperspot/patches/102-no_warnings.patch [new file with mode: 0644]
net/pepperspot/patches/110-fix-compile.patch [new file with mode: 0644]
net/pepsal/Makefile [new file with mode: 0644]
net/portsentry/Makefile [new file with mode: 0644]
net/portsentry/files/portsentry.init [new file with mode: 0644]
net/portsentry/patches/100-conf_location.patch [new file with mode: 0644]
net/portsentry/patches/101-postsentry_c.patch [new file with mode: 0644]
net/pptpd/Makefile [new file with mode: 0644]
net/pptpd/files/options.pptpd [new file with mode: 0644]
net/pptpd/files/pptpd.conf [new file with mode: 0644]
net/pptpd/files/pptpd.config [new file with mode: 0644]
net/pptpd/files/pptpd.init [new file with mode: 0644]
net/pptpd/patches/001-bad_pqueue_debug.patch [new file with mode: 0644]
net/pptpd/patches/002-makefile_fix.patch [new file with mode: 0644]
net/pptpd/patches/003-opt_flags.patch [new file with mode: 0644]
net/privoxy/Makefile [new file with mode: 0644]
net/privoxy/files/privoxy.config [new file with mode: 0644]
net/privoxy/files/privoxy.init [new file with mode: 0644]
net/proftpd/Makefile [new file with mode: 0644]
net/proftpd/files/proftpd.init [new file with mode: 0644]
net/proftpd/patches/001-automake-compat.patch [new file with mode: 0644]
net/proftpd/patches/002-mempcpy_def.patch [new file with mode: 0644]
net/psybnc/Makefile [new file with mode: 0644]
net/psybnc/patches/001-makefile.patch [new file with mode: 0644]
net/psybnc/patches/002-conf.patch [new file with mode: 0644]
net/psybnc/patches/003-psybnc.patch [new file with mode: 0644]
net/psybnc/patches/004-start_script.patch [new file with mode: 0644]
net/psybnc/patches/005-fix_endianess_detection.patch [new file with mode: 0644]
net/ptpd/Makefile [new file with mode: 0644]
net/ptpd/files/ptpd.init [new file with mode: 0644]
net/ptunnel/Makefile [new file with mode: 0644]
net/ptunnel/files/ptunnel.config [new file with mode: 0644]
net/ptunnel/files/ptunnel.init [new file with mode: 0644]
net/ptunnel/patches/001-prefix.patch [new file with mode: 0644]
net/ptunnel/patches/002-no_selinux.patch [new file with mode: 0644]
net/pure-ftpd/Makefile [new file with mode: 0644]
net/pure-ftpd/files/pure-ftpd.config [new file with mode: 0644]
net/pure-ftpd/files/pure-ftpd.init [new file with mode: 0644]
net/pure-ftpd/patches/010-dont-add-host-paths.patch [new file with mode: 0644]
net/pyload/Makefile [new file with mode: 0644]
net/pyload/files/pyload.init [new file with mode: 0644]
net/pyrit/Makefile [new file with mode: 0644]
net/qolyester/Makefile [new file with mode: 0644]
net/quicktun/Makefile [new file with mode: 0644]
net/quicktun/files/quicktun.config [new file with mode: 0644]
net/quicktun/files/quicktun.init [new file with mode: 0644]
net/raddump/Makefile [new file with mode: 0644]
net/radsecproxy/Makefile [new file with mode: 0644]
net/radsecproxy/files/radsecproxy.init [new file with mode: 0644]
net/radsecproxy/patches/100-missing-return.patch [new file with mode: 0644]
net/radsecproxy/patches/200-logdest-on-foreground.patch [new file with mode: 0644]
net/rarpd/Makefile [new file with mode: 0644]
net/rarpd/files/rarpd.config [new file with mode: 0644]
net/rarpd/files/rarpd.init [new file with mode: 0644]
net/reaim/Makefile [new file with mode: 0644]
net/reaim/files/reaim.init [new file with mode: 0644]
net/reaim/patches/501-cross_compile-install.patch [new file with mode: 0644]
net/reaver/Makefile [new file with mode: 0644]
net/reaver/patches/0001-wpscrack-big-endian-fixes.patch [new file with mode: 0644]
net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch [new file with mode: 0644]
net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch [new file with mode: 0644]
net/redir/Makefile [new file with mode: 0644]
net/redir/patches/00_honor_copts.patch [new file with mode: 0644]
net/redir/patches/01_fix_max_bandwidth_docs.patch [new file with mode: 0644]
net/redir/patches/02_use_ntohs.patch [new file with mode: 0644]
net/redir/patches/03_fix_tcp_wrappers.patch [new file with mode: 0644]
net/redir/patches/04_fix_timeouts.patch [new file with mode: 0644]
net/redir/patches/06_fix_shaper_buffer.patch [new file with mode: 0644]
net/redsocks/Makefile [new file with mode: 0644]
net/redsocks/files/redsocks.init [new file with mode: 0644]
net/redsocks/patches/010-fix-undeclared.diff [new file with mode: 0644]
net/remotefs/Makefile [new file with mode: 0644]
net/remotefs/files/rfsd [new file with mode: 0755]
net/remserial/Makefile [new file with mode: 0644]
net/rinetd/Makefile [new file with mode: 0755]
net/rinetd/files/rinetd.config [new file with mode: 0644]
net/rinetd/files/rinetd.init [new file with mode: 0755]
net/rinetd/patches/001-crosscompile.patch [new file with mode: 0644]
net/rp-l2tp/Makefile [new file with mode: 0644]
net/rp-l2tp/files/rp-l2tpd.init [new file with mode: 0644]
net/rp-l2tp/patches/001-cross.patch [new file with mode: 0644]
net/rp-pppoe/Makefile [new file with mode: 0644]
net/rp-pppoe/files/pppoe-client.init [new file with mode: 0644]
net/rp-pppoe/files/pppoe-relay.default [new file with mode: 0644]
net/rp-pppoe/files/pppoe-relay.init [new file with mode: 0644]
net/rp-pppoe/files/pppoe-server.default [new file with mode: 0644]
net/rp-pppoe/files/pppoe-server.init [new file with mode: 0644]
net/rp-pppoe/patches/100-configure.patch [new file with mode: 0644]
net/rp-pppoe/patches/110-Makefile.patch [new file with mode: 0644]
net/rrs/Makefile [new file with mode: 0644]
net/rrs/patches/001-shell.patch [new file with mode: 0644]
net/rrs/patches/002-no_sslv2.patch [new file with mode: 0644]
net/rrs/patches/003-honour_copts.patch [new file with mode: 0644]
net/rssh/Makefile [new file with mode: 0644]
net/rssh/patches/001-destdir.patch [new file with mode: 0644]
net/scanlogd/Makefile [new file with mode: 0644]
net/scanlogd/files/scanlogd.init [new file with mode: 0644]
net/scdp/Makefile [new file with mode: 0644]
net/seeks/Makefile [new file with mode: 0644]
net/seeks/files/seeks.init [new file with mode: 0644]
net/seeks/patches/050-better_icu_detection.patch [new file with mode: 0644]
net/seeks/patches/100-no_tests-and-add-iconv-link.patch [new file with mode: 0644]
net/seeks/patches/200-add_pcre_headers_to_plugins.patch [new file with mode: 0644]
net/ser2net/Makefile [new file with mode: 0644]
net/serialoverip/Makefile [new file with mode: 0644]
net/serialoverip/patches/001-compile-fixes.patch [new file with mode: 0644]
net/shat/Makefile [new file with mode: 0644]
net/shorewall-core/Makefile [new file with mode: 0644]
net/shorewall-core/patches/100-shorewallrc.default.patch [new file with mode: 0644]
net/shorewall-core/patches/110-lib.common.patch [new file with mode: 0644]
net/shorewall-lite/Makefile [new file with mode: 0644]
net/shorewall-lite/files/hostname [new file with mode: 0644]
net/shorewall-lite/files/hotplug_iface [new file with mode: 0644]
net/shorewall-lite/files/lsm_script [new file with mode: 0644]
net/shorewall-lite/files/shorewall-lite.init [new file with mode: 0644]
net/shorewall-lite/files/vardir [new file with mode: 0644]
net/shorewall-lite/patches/100-shorewallrc.default.patch [new file with mode: 0644]
net/shorewall-lite/patches/120-LOGFILE.patch [new file with mode: 0644]
net/siit/Makefile [new file with mode: 0644]
net/siit/src/Makefile [new file with mode: 0644]
net/siit/src/siit.c [new file with mode: 0644]
net/siit/src/siit.h [new file with mode: 0644]
net/slurm/Makefile [new file with mode: 0644]
net/slurm/patches/001-no_host_curses.patch [new file with mode: 0644]
net/smcroute/Makefile [new file with mode: 0644]
net/smcroute/files/smcroute.init [new file with mode: 0644]
net/smcroute/patches/001-socket_path.patch [new file with mode: 0644]
net/smcroute/patches/002-optimize_size.patch [new file with mode: 0644]
net/smtptrapd/Makefile [new file with mode: 0644]
net/smtptrapd/files/smtptrapd.init [new file with mode: 0644]
net/smtptrapd/patches/200-missing_opt.patch [new file with mode: 0644]
net/snort-wireless/Makefile [new file with mode: 0644]
net/snort-wireless/files/snort-wireless.default [new file with mode: 0644]
net/snort-wireless/files/snort-wireless.init [new file with mode: 0644]
net/snort-wireless/patches/500-no-config-search.patch [new file with mode: 0644]
net/snort-wireless/patches/750-lightweight-config.patch [new file with mode: 0644]
net/snort/Makefile [new file with mode: 0644]
net/snort/files/snort.bin [new file with mode: 0644]
net/snort/files/snort.default [new file with mode: 0644]
net/snort/files/snort.init [new file with mode: 0644]
net/snort/files/snort.local.rules [new file with mode: 0644]
net/snort/patches/001-automake-compat.patch [new file with mode: 0644]
net/snort/patches/100-INADDR_NONE.patch [new file with mode: 0644]
net/snort/patches/101-PCAP.patch [new file with mode: 0644]
net/snort/patches/150-config-preprocessors-disable.patch [new file with mode: 0644]
net/snort/patches/160-mysql_cross_compiling_checks.patch [new file with mode: 0644]
net/snort/patches/200-snortsam.patch [new file with mode: 0644]
net/snortsam/Makefile [new file with mode: 0644]
net/snortsam/files/snortsam.init [new file with mode: 0644]
net/snortsam/patches/100-iptables-path-fix.patch [new file with mode: 0644]
net/socat/Makefile [new file with mode: 0644]
net/socat/patches/501-honor_ldflags.patch [new file with mode: 0644]
net/spawn-fcgi/Makefile [new file with mode: 0644]
net/speedtouch-usb-firmware/Makefile [new file with mode: 0644]
net/squid/Makefile [new file with mode: 0644]
net/squid/patches/001-cross_compile.patch [new file with mode: 0644]
net/squid/patches/002-no_sslv2.patch [new file with mode: 0644]
net/squid/patches/003-configure.patch [new file with mode: 0644]
net/squid/patches/004-include-autoconf.patch [new file with mode: 0644]
net/squid/patches/005-lib-makefile.patch [new file with mode: 0644]
net/srelay/Makefile [new file with mode: 0644]
net/srelay/files/srelay.conf [new file with mode: 0644]
net/srelay/files/srelay.init [new file with mode: 0644]
net/sscep/Makefile [new file with mode: 0644]
net/sscep/patches/001-certnanny.patch [new file with mode: 0644]
net/sshfs/Makefile [new file with mode: 0644]
net/sshtunnel/Makefile [new file with mode: 0644]
net/sshtunnel/files/sshtunnel.init [new file with mode: 0644]
net/sshtunnel/files/sshtunnel.sh [new file with mode: 0644]
net/sshtunnel/files/uci_sshtunnel [new file with mode: 0644]
net/sslcat/Makefile [new file with mode: 0644]
net/sslsniff/Makefile [new file with mode: 0644]
net/sslsniff/patches/01-cross-compile.patch [new file with mode: 0644]
net/sslstrip/Makefile [new file with mode: 0644]
net/ssltunnel/Makefile [new file with mode: 0644]
net/strongswan/Config.in [new file with mode: 0644]
net/strongswan/Makefile [new file with mode: 0644]
net/strongswan/files/ipsec.init [new file with mode: 0644]
net/strongswan/files/ipsec.secrets [new file with mode: 0644]
net/strongswan/files/ipsec.user [new file with mode: 0644]
net/strongswan/patches/100-method_name_fix.patch [new file with mode: 0644]
net/strongswan/patches/201-kmodloader.patch [new file with mode: 0644]
net/strongswan/patches/203-uci.patch [new file with mode: 0644]
net/strongswan/patches/300-include-ipsec-user-script.patch [new file with mode: 0644]
net/stun/Makefile [new file with mode: 0644]
net/stun/files/stund.config [new file with mode: 0644]
net/stun/files/stund.init [new file with mode: 0644]
net/stun/patches/001-fix_non_i386.patch [new file with mode: 0644]
net/stun/patches/002-linking_order.patch [new file with mode: 0644]
net/stunnel/Makefile [new file with mode: 0644]
net/stunnel/files/stunnel.init [new file with mode: 0644]
net/stunnel/patches/100-cross-compile.patch [new file with mode: 0644]
net/stunnel/patches/101-no-comp.patch [new file with mode: 0644]
net/stunnel/patches/102-no-ssl2.patch [new file with mode: 0644]
net/stunnel/patches/103-no-zlib-link.patch [new file with mode: 0644]
net/stunnel/patches/104-fix-paths.patch [new file with mode: 0644]
net/stunnel/patches/105-stunnel-conf.patch [new file with mode: 0644]
net/stunnel/patches/106-stunnel-xforwardedfor.patch [new file with mode: 0644]
net/subversion/Makefile [new file with mode: 0644]
net/subversion/files/subversion.config [new file with mode: 0644]
net/subversion/files/subversion.init [new file with mode: 0644]
net/synce-dccm/Makefile [new file with mode: 0644]
net/tcptraceroute/Makefile [new file with mode: 0644]
net/tcptraceroute/patches/001-configure_cross_compile.patch [new file with mode: 0644]
net/tctool/Makefile [new file with mode: 0644]
net/tctool/patches/001_Makefile_fix.diff [new file with mode: 0644]
net/tctool/patches/005-fix-gcc_4_3-compile.patch [new file with mode: 0644]
net/tctool/patches/006-fix_close_declaration.patch [new file with mode: 0644]
net/tftp-hpa/Makefile [new file with mode: 0644]
net/tftp-hpa/files/tftpd-hpa.init [new file with mode: 0644]
net/tig/Makefile [new file with mode: 0644]
net/tinc/Makefile [new file with mode: 0644]
net/tinc/files/tinc.config [new file with mode: 0644]
net/tinc/files/tinc.init [new file with mode: 0644]
net/tinc/files/tinc.upgrade [new file with mode: 0644]
net/tmsnc/Makefile [new file with mode: 0644]
net/tor-alpha/Makefile [new file with mode: 0644]
net/tor-alpha/files/tor.init [new file with mode: 0644]
net/tor-alpha/patches/001-torrc.patch [new file with mode: 0644]
net/tor/Makefile [new file with mode: 0644]
net/tor/files/tor.init [new file with mode: 0644]
net/tor/patches/001-torrc.patch [new file with mode: 0644]
net/transocks/Makefile [new file with mode: 0644]
net/tsocks/Makefile [new file with mode: 0644]
net/tsocks/patches/100-no_static.patch [new file with mode: 0644]
net/tstat/Makefile [new file with mode: 0644]
net/ttcp/Makefile [new file with mode: 0644]
net/ttcp/ttcp.c [new file with mode: 0644]
net/uanytun/Makefile [new file with mode: 0644]
net/uanytun/files/uanytun-nocrypt.config [new file with mode: 0644]
net/uanytun/files/uanytun.config [new file with mode: 0644]
net/uanytun/files/uanytun.init [new file with mode: 0644]
net/ucarp/Makefile [new file with mode: 0644]
net/ucarp/files/ucarp.conf [new file with mode: 0644]
net/ucarp/files/ucarp.init [new file with mode: 0644]
net/ucarp/patches/100-configure-cross-compilation.patch [new file with mode: 0644]
net/ucspi-tcp/Makefile [new file with mode: 0644]
net/ucspi-tcp/patches/100-cross_compile.patch [new file with mode: 0644]
net/udp-broadcast-relay/Makefile [new file with mode: 0644]
net/udpcast/Makefile [new file with mode: 0644]
net/uftp/Makefile [new file with mode: 0644]
net/uhub/Makefile [new file with mode: 0644]
net/uhub/patches/100-user_struct.patch [new file with mode: 0644]
net/ulogd/Makefile [new file with mode: 0644]
net/ulogd/files/ulogd.default [new file with mode: 0644]
net/ulogd/files/ulogd.init [new file with mode: 0644]
net/ulogd/patches/001-pcap_flags.patch [new file with mode: 0644]
net/ulogd/patches/002-inc.patch [new file with mode: 0644]
net/ulogd/patches/003-fix-bad-rpath.patch [new file with mode: 0644]
net/umurmur/Makefile [new file with mode: 0644]
net/unbound/Makefile [new file with mode: 0644]
net/unbound/files/named.cache [new file with mode: 0644]
net/unbound/files/root.key [new file with mode: 0644]
net/unbound/files/unbound.init [new file with mode: 0755]
net/unbound/patches/001-conf.patch [new file with mode: 0644]
net/unfs3/Makefile [new file with mode: 0644]
net/unfs3/files/unfs3.exports [new file with mode: 0644]
net/unfs3/files/unfs3.init [new file with mode: 0644]
net/unfs3/patches/100-no_lfl.patch [new file with mode: 0644]
net/uob-nomad/Makefile [new file with mode: 0644]
net/uob-nomad/patches/001-inet_sr.patch [new file with mode: 0644]
net/uob-nomad/patches/002-hostname.patch [new file with mode: 0644]
net/uob-nomad/patches/003-conf.patch [new file with mode: 0644]
net/uob-nomad/patches/004-linux26_header_fix.patch [new file with mode: 0644]
net/uob-nomad/patches/005-linux_if_strip_fix.patch [new file with mode: 0644]
net/uob-nomad/patches/006-linux_if_tr_fix.patch [new file with mode: 0644]
net/updatedd/Makefile [new file with mode: 0644]
net/updatedd/files/updatedd.config [new file with mode: 0644]
net/updatedd/files/updatedd.hotplug [new file with mode: 0644]
net/updatedd/files/updatedd.init [new file with mode: 0644]
net/updatedd/patches/001-service_libname.patch [new file with mode: 0644]
net/updatedd/patches/002-ovh-dyndnshost.patch [new file with mode: 0644]
net/updatedd/patches/003-zoneedit-url-fix.patch [new file with mode: 0644]
net/updatedd/patches/004-fix_liberty_dep.patch [new file with mode: 0644]
net/usbip/Makefile [new file with mode: 0644]
net/usbip/patches/001-upstream_svn_r99.diff [new file with mode: 0644]
net/usbip/patches/002-upstream_svn_r152.patch [new file with mode: 0644]
net/uucp/Makefile [new file with mode: 0644]
net/vblade/Makefile [new file with mode: 0644]
net/vblade/files/vblade.config [new file with mode: 0644]
net/vblade/files/vblade.init [new file with mode: 0644]
net/veth/Makefile [new file with mode: 0644]
net/veth/patches/100-veth-makefile-cflags.patch [new file with mode: 0644]
net/veth/patches/200-drop-multicast.patch [new file with mode: 0644]
net/vgp/Makefile [new file with mode: 0644]
net/vnc-reflector/Makefile [new file with mode: 0644]
net/vnc-reflector/patches/001-honor_include_lib_path.patch [new file with mode: 0644]
net/vncrepeater/Makefile [new file with mode: 0644]
net/vncrepeater/patches/001-uclibcxx_linking.patch [new file with mode: 0644]
net/vpnc-scripts/Makefile [new file with mode: 0644]
net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate [new file with mode: 0644]
net/vpnc/Makefile [new file with mode: 0644]
net/vpnc/patches/001-cross.patch [new file with mode: 0644]
net/vpnc/patches/002-vpn_script.patch [new file with mode: 0644]
net/vpnc/patches/003-no_makeman.patch [new file with mode: 0644]
net/vpzone/Makefile [new file with mode: 0644]
net/vpzone/files/vpzone.conf [new file with mode: 0644]
net/vpzone/files/vpzone.init [new file with mode: 0644]
net/vpzone/patches/001-no_werror.patch [new file with mode: 0644]
net/vpzone/patches/002-ipv6_inc_fix.patch [new file with mode: 0644]
net/vrrpd/Makefile [new file with mode: 0644]
net/vrrpd/files/vrrpd.config [new file with mode: 0644]
net/vrrpd/files/vrrpd.init [new file with mode: 0644]
net/vtun/Makefile [new file with mode: 0644]
net/vtun/patches/100-lzo2.patch [new file with mode: 0644]
net/wccpd/Makefile [new file with mode: 0644]
net/wdiag/Makefile [new file with mode: 0644]
net/weechat/Makefile [new file with mode: 0644]
net/wifidog/Makefile [new file with mode: 0644]
net/wifidog/files/wifidog.init [new file with mode: 0644]
net/wing/Makefile [new file with mode: 0644]
net/wing/files/etc/uci-defaults/wing [new file with mode: 0644]
net/wing/files/lib/netifd/proto/wing.sh [new file with mode: 0644]
net/wing/files/usr/bin/wing_status [new file with mode: 0755]
net/wiviz/Makefile [new file with mode: 0644]
net/wiviz/files/www/cgi-bin/wiviz/get.cgi [new file with mode: 0755]
net/wiviz/files/www/cgi-bin/wiviz/set.cgi [new file with mode: 0755]
net/wiviz/files/www/wiviz/adhoc-idle.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/adhoc-idle.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/adhoc.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/adhoc.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap-idle.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap-idle.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap-wep-idle.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap-wep-idle.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap-wep.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap-wep.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/ap.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/pip-idle.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/pip-idle.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/pip.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/pip.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/station-idle.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/station-idle.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/station.gif [new file with mode: 0755]
net/wiviz/files/www/wiviz/station.png [new file with mode: 0755]
net/wiviz/files/www/wiviz/wiviz.css [new file with mode: 0755]
net/wiviz/files/www/wiviz/wiviz.html [new file with mode: 0755]
net/wiviz/files/www/wiviz/wiviz.js [new file with mode: 0755]
net/wiviz/src/Makefile [new file with mode: 0644]
net/wiviz/src/channelhopper.c [new file with mode: 0644]
net/wiviz/src/channelhopper.h [new file with mode: 0644]
net/wiviz/src/structs.h [new file with mode: 0644]
net/wiviz/src/wiviz.c [new file with mode: 0644]
net/wiviz/src/wl_access.c [new file with mode: 0644]
net/wiviz/src/wl_access.h [new file with mode: 0644]
net/wknock/Makefile [new file with mode: 0644]
net/wol/Makefile [new file with mode: 0644]
net/wol/files/wol.config [new file with mode: 0644]
net/wol/files/wol.init [new file with mode: 0644]
net/wprobe/Makefile [new file with mode: 0644]
net/wprobe/files/wprobe.config [new file with mode: 0644]
net/wprobe/files/wprobe.init [new file with mode: 0755]
net/wprobe/src/Makefile.inc [new file with mode: 0644]
net/wprobe/src/exporter/Makefile [new file with mode: 0644]
net/wprobe/src/exporter/wprobe-export.c [new file with mode: 0644]
net/wprobe/src/exporter/wprobe-export.h [new file with mode: 0644]
net/wprobe/src/filter/README.txt [new file with mode: 0644]
net/wprobe/src/filter/gen_filter.pl [new file with mode: 0755]
net/wprobe/src/filter/pfc.c [new file with mode: 0644]
net/wprobe/src/kernel/Makefile [new file with mode: 0644]
net/wprobe/src/kernel/linux/wprobe.h [new file with mode: 0644]
net/wprobe/src/kernel/wprobe-core.c [new file with mode: 0644]
net/wprobe/src/kernel/wprobe-dummy.c [new file with mode: 0644]
net/wprobe/src/user/Makefile [new file with mode: 0644]
net/wprobe/src/user/list.h [new file with mode: 0644]
net/wprobe/src/user/wprobe-lib.c [new file with mode: 0644]
net/wprobe/src/user/wprobe-util.c [new file with mode: 0644]
net/wprobe/src/user/wprobe.h [new file with mode: 0644]
net/wput/Makefile [new file with mode: 0644]
net/wput/patches/100-socketlib.diff [new file with mode: 0644]
net/wput/patches/102-wput.diff [new file with mode: 0644]
net/wrt-radauth/Makefile [new file with mode: 0644]
net/wrt-radauth/patches/001-ldpath.patch [new file with mode: 0644]
net/xsupplicant/Makefile [new file with mode: 0644]
net/xsupplicant/patches/001-no-lfl.patch [new file with mode: 0644]
net/xsupplicant/patches/002-disable-procfs-check.patch [new file with mode: 0644]
net/xsupplicant/patches/003-compile_fix.patch [new file with mode: 0644]
net/xsupplicant/patches/005-no_private_linux_header_includes.patch [new file with mode: 0644]
net/xsupplicant/patches/006-no_wireless_h.patch [new file with mode: 0644]
net/yaddns/Makefile [new file with mode: 0644]
net/yaddns/files/etc/config/ddns [new file with mode: 0644]
net/yaddns/files/etc/hotplug.d/iface/25-ddns [new file with mode: 0644]
net/yaddns/files/usr/lib/ddns/services [new file with mode: 0644]
net/yafc/Makefile [new file with mode: 0644]
skels/Makefile.template [new file with mode: 0644]
skels/files/package.conf [new file with mode: 0644]
skels/files/package.init [new file with mode: 0755]
sound/cmus/Makefile [new file with mode: 0644]
sound/cmus/patches/010-do_not_use_ACS_VLINE.patch [new file with mode: 0644]
sound/cmus/patches/020-check_header_sys_soundcard.patch [new file with mode: 0644]
sound/empcd/Makefile [new file with mode: 0644]
sound/empcd/patches/001-Makefile_use_VFP_CFLAGS.patch [new file with mode: 0644]
sound/flite/Makefile [new file with mode: 0644]
sound/flite/patches/100-shared_libs [new file with mode: 0644]
sound/ices/Makefile [new file with mode: 0644]
sound/lame/Makefile [new file with mode: 0644]
sound/lame/patches/001-automake-compat.patch [new file with mode: 0644]
sound/listener/Makefile [new file with mode: 0644]
sound/listener/files/listener.conf [new file with mode: 0644]
sound/listener/patches/100-makefile.patch [new file with mode: 0644]
sound/madplay/Makefile [new file with mode: 0644]
sound/mocp/Makefile [new file with mode: 0644]
sound/mpdas/Makefile [new file with mode: 0644]
sound/mpdas/files/mpdas.init [new file with mode: 0644]
sound/mpdas/files/mpdasrc [new file with mode: 0644]
sound/mpdas/patches/001-flags.patch [new file with mode: 0644]
sound/mt-daapd/Makefile [new file with mode: 0644]
sound/mt-daapd/files/mt-daapd.init [new file with mode: 0644]
sound/pianobar/Makefile [new file with mode: 0644]
sound/pianobar/patches/001-verbose.patch [new file with mode: 0644]
sound/pianobar/patches/002-force-symlinks.patch [new file with mode: 0644]
sound/scmpc/Makefile [new file with mode: 0644]
sound/scmpc/files/scmpc.init [new file with mode: 0644]
sound/scmpc/patches/100-Rules.patch [new file with mode: 0644]
sound/shell-fm/Makefile [new file with mode: 0644]
sound/shell-fm/files/shell-fm.init [new file with mode: 0644]
sound/shell-fm/files/shell-fm.rc [new file with mode: 0644]
sound/sox/Makefile [new file with mode: 0644]
sound/sox/patches/001-cross_compile.patch [new file with mode: 0644]
sound/sox/patches/010-fix_uclibc_build_issue.patch [new file with mode: 0644]
sound/sox/patches/020-ffmpeg-0.11.patch [new file with mode: 0644]
sound/streamripper/Makefile [new file with mode: 0644]
utils/acpid/Makefile [new file with mode: 0644]
utils/acpid/files/acpid.hotplug [new file with mode: 0644]
utils/acpid/files/acpid.init [new file with mode: 0644]
utils/acpid/files/default [new file with mode: 0644]
utils/anyremote/Makefile [new file with mode: 0644]
utils/anyremote/files/anyremote.cfg [new file with mode: 0644]
utils/anyremote/files/anyremote.init [new file with mode: 0644]
utils/anyremote/patches/010-dont-add-host-includes.patch [new file with mode: 0644]
utils/ap51-flash/Makefile [new file with mode: 0644]
utils/ap51-flash/files/ap51-flash.config [new file with mode: 0644]
utils/ap51-flash/files/ap51-flash.init [new file with mode: 0644]
utils/ap51-flash/files/ap51-flash.sh [new file with mode: 0755]
utils/at/Makefile [new file with mode: 0644]
utils/at/files/atd.init [new file with mode: 0755]
utils/at/patches/100-cross-compile.patch [new file with mode: 0644]
utils/at/patches/110-getloadavg.patch [new file with mode: 0644]
utils/avrdude/Makefile [new file with mode: 0644]
utils/avrusbboot/Makefile [new file with mode: 0644]
utils/avrusbboot/patches/001-fix_makefile.patch [new file with mode: 0644]
utils/avrusbboot/patches/002-fix_compilation.patch [new file with mode: 0644]
utils/bandwidthd/Makefile [new file with mode: 0644]
utils/bandwidthd/files/bandwidthd.config [new file with mode: 0644]
utils/bandwidthd/files/bandwidthd.init [new file with mode: 0644]
utils/bandwidthd/files/logo.gif [new file with mode: 0644]
utils/bandwidthd/patches/010-dont-add-host-paths.patch [new file with mode: 0644]
utils/bandwidthd/patches/100-fix_config_file_location [new file with mode: 0644]
utils/bash-completion/Makefile [new file with mode: 0644]
utils/bash/Makefile [new file with mode: 0644]
utils/bash/patches/001-compile-fix.patch [new file with mode: 0644]
utils/bash/patches/002-force-internal-readline.patch [new file with mode: 0644]
utils/bash/patches/101-upstream-bash42-001.patch [new file with mode: 0644]
utils/bash/patches/102-upstream-bash42-002.patch [new file with mode: 0644]
utils/bash/patches/103-upstream-bash42-003.patch [new file with mode: 0644]
utils/bash/patches/104-upstream-bash42-004.patch [new file with mode: 0644]
utils/bash/patches/105-upstream-bash42-005.patch [new file with mode: 0644]
utils/bash/patches/106-upstream-bash42-006.patch [new file with mode: 0644]
utils/bash/patches/107-upstream-bash42-007.patch [new file with mode: 0644]
utils/bash/patches/108-upstream-bash42-008.patch [new file with mode: 0644]
utils/bash/patches/109-upstream-bash42-009.patch [new file with mode: 0644]
utils/bash/patches/110-upstream-bash42-010.patch [new file with mode: 0644]
utils/bash/patches/111-upstream-bash42-011.patch [new file with mode: 0644]
utils/bash/patches/112-upstream-bash42-012.patch [new file with mode: 0644]
utils/bash/patches/113-upstream-bash42-013.patch [new file with mode: 0644]
utils/bash/patches/114-upstream-bash42-014.patch [new file with mode: 0644]
utils/bash/patches/115-upstream-bash42-015.patch [new file with mode: 0644]
utils/bash/patches/116-upstream-bash42-016.patch [new file with mode: 0644]
utils/bash/patches/117-upstream-bash42-017.patch [new file with mode: 0644]
utils/bash/patches/118-upstream-bash42-018.patch [new file with mode: 0644]
utils/bash/patches/119-upstream-bash42-019.patch [new file with mode: 0644]
utils/bash/patches/120-upstream-bash42-020.patch [new file with mode: 0644]
utils/bash/patches/121-upstream-bash42-021.patch [new file with mode: 0644]
utils/bash/patches/122-upstream-bash42-022.patch [new file with mode: 0644]
utils/bash/patches/123-upstream-bash42-023.patch [new file with mode: 0644]
utils/bash/patches/124-upstream-bash42-024.patch [new file with mode: 0644]
utils/bash/patches/125-upstream-bash42-025.patch [new file with mode: 0644]
utils/bash/patches/126-upstream-bash42-026.patch [new file with mode: 0644]
utils/bash/patches/127-upstream-bash42-027.patch [new file with mode: 0644]
utils/bash/patches/128-upstream-bash42-028.patch [new file with mode: 0644]
utils/bash/patches/129-no_doc.patch [new file with mode: 0644]
utils/bc/Makefile [new file with mode: 0644]
utils/bc/patches/001-disable-doc.patch [new file with mode: 0644]
utils/bemused/Makefile [new file with mode: 0644]
utils/bemused/files/bemused-bookmarks [new file with mode: 0644]
utils/bemused/files/bemused.conf [new file with mode: 0644]
utils/bemused/files/bemused.init [new file with mode: 0644]
utils/bemused/patches/110-missing_includes.patch [new file with mode: 0644]
utils/bemused/patches/200-cxx-compile-fixes.patch [new file with mode: 0644]
utils/bluelog/Makefile [new file with mode: 0644]
utils/bluelog/files/bluelog.init [new file with mode: 0644]
utils/bluez-hcidump/Makefile [new file with mode: 0644]
utils/bluez-utils/Makefile [new file with mode: 0644]
utils/bluez-utils/files/bluetooth.config [new file with mode: 0644]
utils/bluez-utils/files/bluetooth.dbus [new file with mode: 0644]
utils/bluez-utils/files/bluez-utils.init [new file with mode: 0644]
utils/bluez-utils/files/givepin [new file with mode: 0644]
utils/bluez-utils/patches/001-include_limits.patch [new file with mode: 0644]
utils/bluez-utils/patches/002-hcid_pin_helper.patch [new file with mode: 0644]
utils/bluez-utils/patches/100-enokey.patch [new file with mode: 0644]
utils/bluez-utils/patches/200-uart-speed.patch [new file with mode: 0644]
utils/boblight/Makefile [new file with mode: 0644]
utils/boblight/files/boblight.init [new file with mode: 0644]
utils/bonnie++/Makefile [new file with mode: 0644]
utils/bonnie++/patches/001-cross_compile_fix.patch [new file with mode: 0644]
utils/bonnie++/patches/002-add-verbose-error-messages.patch [new file with mode: 0644]
utils/boxbackup/Makefile [new file with mode: 0644]
utils/boxbackup/files/bbstoreaccounts [new file with mode: 0755]
utils/boxbackup/files/bbstored.config [new file with mode: 0644]
utils/boxbackup/files/bbstored.init [new file with mode: 0644]
utils/boxbackup/files/bbstored.sh [new file with mode: 0644]
utils/bsdiff/Makefile [new file with mode: 0644]
utils/bsdiff/patches/001-makefile.patch [new file with mode: 0644]
utils/btrfs-progs/Makefile [new file with mode: 0644]
utils/btrfs-progs/files/btrfs-scan.init [new file with mode: 0644]
utils/btrfs-progs/patches/001-Makefile-gcc-fix [new file with mode: 0644]
utils/byobu/Makefile [new file with mode: 0644]
utils/calcurse/Makefile [new file with mode: 0644]
utils/calvaria/Makefile [new file with mode: 0644]
utils/calvaria/files/src/Makefile [new file with mode: 0644]
utils/calvaria/files/src/cal2p54.c [new file with mode: 0644]
utils/calvaria/files/src/calvaria.c [new file with mode: 0644]
utils/canutils/Makefile [new file with mode: 0644]
utils/cdparanoia/Makefile [new file with mode: 0644]
utils/cdparanoia/patches/002-fixbecrash-private-keyword.patch [new file with mode: 0644]
utils/cdparanoia/patches/010-fix_configure.patch [new file with mode: 0644]
utils/cksfv/Makefile [new file with mode: 0644]
utils/cksfv/patches/001-missing_inttypes_h.patch [new file with mode: 0644]
utils/clish/Makefile [new file with mode: 0644]
utils/cpusage/Makefile [new file with mode: 0644]
utils/cpusage/src/cpusage.c [new file with mode: 0644]
utils/crypto-tools/Makefile [new file with mode: 0644]
utils/cryptsetup/Makefile [new file with mode: 0644]
utils/cwiid/Makefile [new file with mode: 0644]
utils/cwiid/patches/100-dump_gtk_wmdemo.patch [new file with mode: 0644]
utils/daemontools/Makefile [new file with mode: 0644]
utils/daemontools/patches/crosscompile.patch [new file with mode: 0644]
utils/daemontools/patches/svscanboot.patch [new file with mode: 0644]
utils/dash/Makefile [new file with mode: 0644]
utils/deco/Makefile [new file with mode: 0644]
utils/deco/patches/100-tty.c.patch [new file with mode: 0644]
utils/devio/Makefile [new file with mode: 0644]
utils/devmem2/Makefile [new file with mode: 0644]
utils/devmem2/src/Makefile [new file with mode: 0644]
utils/devmem2/src/devmem2.c [new file with mode: 0644]
utils/dfu-util/Makefile [new file with mode: 0644]
utils/dfu-util/patches/001-no_static_binary.patch [new file with mode: 0644]
utils/dialog/Makefile [new file with mode: 0644]
utils/dialog/patches/001-cross_compile.patch [new file with mode: 0644]
utils/digitemp/Makefile [new file with mode: 0644]
utils/dir300-flash/Makefile [new file with mode: 0644]
utils/disktype/Makefile [new file with mode: 0644]
utils/dosfstools/Makefile [new file with mode: 0644]
utils/dosfstools/files/dosfsck.sh [new file with mode: 0644]
utils/dosfstools/patches/002-linux_26_headers.patch [new file with mode: 0644]
utils/dstat/Makefile [new file with mode: 0644]
utils/dt/Makefile [new file with mode: 0644]
utils/dtach/Makefile [new file with mode: 0644]
utils/empty/Makefile [new file with mode: 0644]
utils/event_test/Makefile [new file with mode: 0644]
utils/event_test/src/Makefile [new file with mode: 0644]
utils/event_test/src/evtest.c [new file with mode: 0644]
utils/fancontroled/Makefile [new file with mode: 0644]
utils/fancontroled/files/fancontroled.init [new file with mode: 0644]
utils/firmwarehotplug/Makefile [new file with mode: 0644]
utils/firmwarehotplug/patches/001-no_documentation.patch [new file with mode: 0644]
utils/firmwarehotplug/patches/100-compile-fixes.patch [new file with mode: 0644]
utils/fortune-mod/Makefile [new file with mode: 0644]
utils/fortune-mod/patches/01-strfile-64bit-fix [new file with mode: 0644]
utils/fowsr/Makefile [new file with mode: 0644]
utils/foxboard-utils/Makefile [new file with mode: 0644]
utils/fxload/Makefile [new file with mode: 0644]
utils/fxload/patches/010-compile_fix.patch [new file with mode: 0644]
utils/gadgetfs-test/Makefile [new file with mode: 0644]
utils/gadgetfs-test/patches/001-linux_usb_org_2007_11_29.patch [new file with mode: 0644]
utils/gawk/Makefile [new file with mode: 0644]
utils/gnokii/Makefile [new file with mode: 0644]
utils/gnupg/Makefile [new file with mode: 0644]
utils/gnuplot/Makefile [new file with mode: 0644]
utils/gnuplot/patches/010-Makefile.in.patch [new file with mode: 0644]
utils/goldfish-qemu/Makefile [new file with mode: 0644]
utils/goldfish-qemu/patches/100-darwin_fix.patch [new file with mode: 0644]
utils/goldfish-qemu/patches/110-single_image.patch [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/arrow_down.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/arrow_left.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/arrow_right.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/arrow_up.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/back.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/device.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/end.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/home.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/key.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/keyboard.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/layout [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/menu.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/power.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/select.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/send.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/spacebar.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/volume_down.png [new file with mode: 0644]
utils/goldfish-qemu/skins/HVGA/volume_up.png [new file with mode: 0644]
utils/gpiotoggling/Makefile [new file with mode: 0644]
utils/gzip/Makefile [new file with mode: 0644]
utils/gzip/patches/001-rsyncable.patch [new file with mode: 0644]
utils/hd-idle/Makefile [new file with mode: 0644]
utils/hd-idle/files/hd-idle.config [new file with mode: 0644]
utils/hd-idle/files/hd-idle.init [new file with mode: 0644]
utils/hdparm/Makefile [new file with mode: 0644]
utils/heyu/Makefile [new file with mode: 0644]
utils/heyu/files/x10.conf [new file with mode: 0644]
utils/heyu/patches/001-avoid_configure.patch [new file with mode: 0644]
utils/hplip/Makefile [new file with mode: 0644]
utils/hplip/files/20-hplip [new file with mode: 0644]
utils/hplip/files/hplib.conf [new file with mode: 0644]
utils/huaweiaktbbo/Makefile [new file with mode: 0644]
utils/huaweiaktbbo/src/huaweiAktBbo.c [new file with mode: 0644]
utils/i2c-tools/Makefile [new file with mode: 0644]
utils/iioutils/Makefile [new file with mode: 0644]
utils/ink/Makefile [new file with mode: 0644]
utils/input-utils/Makefile [new file with mode: 0644]
utils/input-utils/patches/001-Makefile_use_bash.patch [new file with mode: 0644]
utils/input-utils/patches/002-use_cross_headers_from_env.patch [new file with mode: 0644]
utils/io/Makefile [new file with mode: 0644]
utils/io/src/io.c [new file with mode: 0644]
utils/ipmitool/Makefile [new file with mode: 0644]
utils/ipmitool/patches/100-cubic_root.patch [new file with mode: 0644]
utils/ipmitool/patches/101-cross_compile.patch [new file with mode: 0644]
utils/joe/Makefile [new file with mode: 0644]
utils/joe/patches/001-mathaway.patch [new file with mode: 0644]
utils/klish/Makefile [new file with mode: 0644]
utils/kmemtrace-user/Makefile [new file with mode: 0644]
utils/lcd4linux-tew673gru/Makefile [new file with mode: 0644]
utils/lcd4linux-tew673gru/files/lcd4linux_tew673gru.conf [new file with mode: 0644]
utils/lcd4linux-tew673gru/files/openwrt_220x176.png [new file with mode: 0644]
utils/lcd4linux-tew673gru/files/tew673gru-lcd [new file with mode: 0755]
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/lcdproc/Makefile [new file with mode: 0644]
utils/lcdproc/files/LCDd [new file with mode: 0755]
utils/lcdproc/files/lcdexec [new file with mode: 0755]
utils/lcdproc/files/lcdproc [new file with mode: 0755]
utils/lcdproc/files/lcdvc [new file with mode: 0755]
utils/less/Makefile [new file with mode: 0644]
utils/lilo/Makefile [new file with mode: 0644]
utils/lilo/files/README [new file with mode: 0644]
utils/lilo/files/bdlilo.conf [new file with mode: 0644]
utils/lilo/files/boot.msg [new file with mode: 0644]
utils/lilo/files/lilo.conf [new file with mode: 0644]
utils/lilo/files/mkbootable [new file with mode: 0755]
utils/lirc/Makefile [new file with mode: 0644]
utils/lmbench/Makefile [new file with mode: 0644]
utils/lmbench/patches/001-fix_socklen_t_define.patch [new file with mode: 0644]
utils/lmbench/patches/002-install-cache.patch [new file with mode: 0644]
utils/lmbench/patches/003-add-LDLIBS.patch [new file with mode: 0644]
utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch [new file with mode: 0644]
utils/logrotate/Makefile [new file with mode: 0644]
utils/logrotate/files/logrotate.conf [new file with mode: 0644]
utils/loop-aes/Makefile [new file with mode: 0644]
utils/loop-aes/patches/001-no_sync.patch [new file with mode: 0644]
utils/lrzsz/Makefile [new file with mode: 0644]
utils/lrzsz/patches/100-install_delete_fix.patch [new file with mode: 0644]
utils/lvm2/Makefile [new file with mode: 0644]
utils/lvm2/files/lvm2.init [new file with mode: 0644]
utils/lvm2/patches/000-compile.patch [new file with mode: 0644]
utils/lxc/Makefile [new file with mode: 0644]
utils/lxc/patches/010-compile.patch [new file with mode: 0644]
utils/lxc/patches/015-getline.patch [new file with mode: 0644]
utils/lxc/patches/020-lxc-checkconfig.patch [new file with mode: 0644]
utils/macchanger/Makefile [new file with mode: 0644]
utils/maemo-kexec/Config.in [new file with mode: 0644]
utils/maemo-kexec/Makefile [new file with mode: 0644]
utils/maemo-kexec/files/sbin/bootmaemo [new file with mode: 0755]
utils/mc/Config.in [new file with mode: 0644]
utils/mc/Makefile [new file with mode: 0644]
utils/md5deep/Makefile [new file with mode: 0644]
utils/md5deep/patches/101-cross_compile.patch [new file with mode: 0644]
utils/memtester/Makefile [new file with mode: 0644]
utils/memtester/patches/100-quiet.diff [new file with mode: 0644]
utils/mg/Makefile [new file with mode: 0644]
utils/mgetty/Makefile [new file with mode: 0644]
utils/mgetty/patches/001-mgetty.patch [new file with mode: 0644]
utils/microcom/Makefile [new file with mode: 0644]
utils/microcom/patches/001-cross_compile.patch [new file with mode: 0644]
utils/mksh/Makefile [new file with mode: 0644]
utils/mksh/patches/100-dot_mkshrc [new file with mode: 0644]
utils/msr-tools/Makefile [new file with mode: 0644]
utils/msr-tools/patches/100-multiprocessor.patch [new file with mode: 0644]
utils/mtd-utils/Makefile [new file with mode: 0644]
utils/mtd-utils/patches/010-fix-rpmatch.patch [new file with mode: 0644]
utils/mtd-utils/patches/130-lzma_jffs2.patch [new file with mode: 0644]
utils/ntfs-3g/Makefile [new file with mode: 0644]
utils/ntfsprogs/Makefile [new file with mode: 0644]
utils/ntfsprogs/patches/001-autoconf_fixes.patch [new file with mode: 0644]
utils/nut/Makefile [new file with mode: 0644]
utils/nut/files/ups.init [new file with mode: 0755]
utils/nut/files/upsmon.init [new file with mode: 0755]
utils/nut/patches/001-fix-missing-libmath-flags.patch [new file with mode: 0644]
utils/nut/patches/002-minibox-openups-driver.patch [new file with mode: 0644]
utils/nut/patches/003-openups-backport.patch [new file with mode: 0644]
utils/nvramtool/Makefile [new file with mode: 0644]
utils/open-plc-utils/Makefile [new file with mode: 0644]
utils/open2300/Makefile [new file with mode: 0644]
utils/open2300/files/open2300.conf [new file with mode: 0644]
utils/open2300/patches/001-crosscompile.patch [new file with mode: 0644]
utils/oww/Makefile [new file with mode: 0644]
utils/oww/files/oww.init [new file with mode: 0644]
utils/pcmciautils/Makefile [new file with mode: 0644]
utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent [new file with mode: 0644]
utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent [new file with mode: 0644]
utils/pcmciautils/files/etc/init.d/pcmcia [new file with mode: 0755]
utils/pcmciautils/files/etc/init.d/pcmcia_socket [new file with mode: 0755]
utils/petitboot/Makefile [new file with mode: 0644]
utils/petitboot/files/petitboot.init [new file with mode: 0644]
utils/petitboot/patches/010-petitboot-fixups.diff [new file with mode: 0644]
utils/petitboot/patches/020-petitboot-fix-pb-twin.diff [new file with mode: 0644]
utils/petitboot/petitboot-config.in [new file with mode: 0644]
utils/picocom/Makefile [new file with mode: 0644]
utils/pipacs/Makefile [new file with mode: 0644]
utils/pipacs/src/Makefile [new file with mode: 0644]
utils/pipacs/src/parser.c [new file with mode: 0644]
utils/pipacs/src/parser.h [new file with mode: 0644]
utils/pipacs/src/pipacs.c [new file with mode: 0644]
utils/powertop/Makefile [new file with mode: 0644]
utils/powertop/patches/100-no-wide-ncurses.patch [new file with mode: 0644]
utils/powertop/patches/200-no-gettext.patch [new file with mode: 0644]
utils/pps-tools/Makefile [new file with mode: 0644]
utils/pps-tools/patches/001-source.patch [new file with mode: 0644]
utils/procps/Makefile [new file with mode: 0644]
utils/procps/patches/010-make_fix.patch [new file with mode: 0644]
utils/procps/patches/020_hz_fix.patch [new file with mode: 0644]
utils/procps/patches/030-fix-string-problems.patch [new file with mode: 0644]
utils/ps3-utils/Makefile [new file with mode: 0644]
utils/psmisc/Makefile [new file with mode: 0644]
utils/psplash/Makefile [new file with mode: 0644]
utils/psplash/files/image_480x640.h [new file with mode: 0644]
utils/psplash/files/image_generic.h [new file with mode: 0644]
utils/psplash/files/psplash.init [new file with mode: 0755]
utils/psplash/patches/000-adjust-for-openwrt.patch [new file with mode: 0644]
utils/psplash/patches/001-hide-msgfield-and-progressbar.patch [new file with mode: 0644]
utils/pv/Makefile [new file with mode: 0644]
utils/pwcrypt/Makefile [new file with mode: 0644]
utils/pwgen/Makefile [new file with mode: 0644]
utils/rcs/Makefile [new file with mode: 0644]
utils/rcs/patches/000-debian.patch [new file with mode: 0644]
utils/rcs/patches/100-cross_compile.patch [new file with mode: 0644]
utils/rdiff-backup/Makefile [new file with mode: 0644]
utils/rdiff-backup/patches/001-python_path.patch [new file with mode: 0644]
utils/redboot-ar231x/Makefile [new file with mode: 0644]
utils/redboot-ar231x/patches/010-fix-compile.patch [new file with mode: 0644]
utils/reiserfsprogs/Makefile [new file with mode: 0644]
utils/remind/Makefile [new file with mode: 0644]
utils/restorefactory/Makefile [new file with mode: 0644]
utils/restorefactory/files/hotplug_restorefactory [new file with mode: 0755]
utils/restorefactory/files/uci_defaults_restorefactory [new file with mode: 0755]
utils/rrdcollect/Makefile [new file with mode: 0644]
utils/rrdcollect/files/rrd.conf [new file with mode: 0644]
utils/rrdcollect/files/rrd.sh [new file with mode: 0644]
utils/rrdcollect/files/rrdcollect.conf [new file with mode: 0644]
utils/rrdcollect/files/rrdcollect.init [new file with mode: 0644]
utils/rrdtool/Makefile [new file with mode: 0644]
utils/rrdtool/patches/010-dont-add-host-include-paths.patch [new file with mode: 0644]
utils/rrdtool/patches/020-x86-float-cast.patch [new file with mode: 0644]
utils/rrdtool/patches/030-automake-compat.patch [new file with mode: 0644]
utils/rsnapshot/Makefile [new file with mode: 0644]
utils/rsnapshot/patches/001-busybox-logger-i.patch [new file with mode: 0644]
utils/rsyncrypto/Makefile [new file with mode: 0644]
utils/rtklib/Makefile [new file with mode: 0644]
utils/sane-backends/Makefile [new file with mode: 0644]
utils/sane-backends/patches/002-remove-uneeded.patch [new file with mode: 0644]
utils/sane-backends/patches/010-dont-add-host-include-path.patch [new file with mode: 0644]
utils/sane-backends/patches/020-non-i386-qcam.patch [new file with mode: 0644]
utils/schedtools/Makefile [new file with mode: 0644]
utils/scponly/Makefile [new file with mode: 0644]
utils/scponly/patches/001-elif_else_replacement.patch [new file with mode: 0644]
utils/sdparm/Makefile [new file with mode: 0644]
utils/sed/Makefile [new file with mode: 0644]
utils/setpwc/Makefile [new file with mode: 0644]
utils/setserial/Makefile [new file with mode: 0644]
utils/setserial/files/setserial.config [new file with mode: 0644]
utils/setserial/files/setserial.init [new file with mode: 0644]
utils/setserial/patches/100-compile-fixes.patch [new file with mode: 0644]
utils/sg3-utils/Makefile [new file with mode: 0644]
utils/sierra-pcmcia/Makefile [new file with mode: 0644]
utils/sispmctl/Makefile [new file with mode: 0644]
utils/squashfs-tools/Config.in [new file with mode: 0644]
utils/squashfs-tools/Makefile [new file with mode: 0644]
utils/ssldump/Makefile [new file with mode: 0644]
utils/ssldump/patches/001-missing_headers.patch [new file with mode: 0644]
utils/stress/Makefile [new file with mode: 0644]
utils/sysstat/Makefile [new file with mode: 0644]
utils/sysstat/files/config [new file with mode: 0644]
utils/sysstat/files/sysstat.init [new file with mode: 0755]
utils/tar/Makefile [new file with mode: 0644]
utils/taskwarrior/Makefile [new file with mode: 0644]
utils/tcpser/Makefile [new file with mode: 0644]
utils/tcsh/Makefile [new file with mode: 0644]
utils/tcsh/patches/001-gethost [new file with mode: 0644]
utils/tcsh/patches/002-NLS [new file with mode: 0644]
utils/tesseract/Makefile [new file with mode: 0644]
utils/testusb/Makefile [new file with mode: 0644]
utils/testusb/src/testusb.c [new file with mode: 0644]
utils/time/Makefile [new file with mode: 0644]
utils/time/patches/001-fix-configure.patch [new file with mode: 0644]
utils/time/patches/002-fix-rusage.patch [new file with mode: 0644]
utils/upx/Makefile [new file with mode: 0644]
utils/upx/patches/100-disable_doc.patch [new file with mode: 0644]
utils/usbmuxd/Makefile [new file with mode: 0644]
utils/usbmuxd/patches/001-disable_libusbmuxd_tools.patch [new file with mode: 0644]
utils/vim/Makefile [new file with mode: 0644]
utils/vim/files/vimrc [new file with mode: 0644]
utils/vim/files/vimrc.full [new file with mode: 0644]
utils/vim/patches/001-cross_compile.patch [new file with mode: 0644]
utils/watchcat/Makefile [new file with mode: 0644]
utils/watchcat/files/initd_watchcat [new file with mode: 0644]
utils/watchcat/files/uci_defaults_watchcat [new file with mode: 0644]
utils/watchcat/files/watchcat.sh [new file with mode: 0644]
utils/wattsup/Makefile [new file with mode: 0644]
utils/wattsup/src/Makefile [new file with mode: 0644]
utils/wattsup/src/wattsup.c [new file with mode: 0644]
utils/wifitoggle/Makefile [new file with mode: 0644]
utils/wifitoggle/files/wifitoggle.config [new file with mode: 0755]
utils/wifitoggle/files/wifitoggle.hotplug [new file with mode: 0755]
utils/wview/Makefile [new file with mode: 0644]
utils/wview/files/etc/init.d/wview [new file with mode: 0644]
utils/wview/patches/010-fix-cross-compile.patch [new file with mode: 0644]
utils/wview/patches/020-use-standard-awk.patch [new file with mode: 0644]
utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch [new file with mode: 0644]
utils/wview/patches/050-WMRUSB-fix-segfault-buffer-overflow.patch [new file with mode: 0644]
utils/wx200d/Makefile [new file with mode: 0644]
utils/xdelta3/Makefile [new file with mode: 0644]
utils/xdelta3/patches/001-decrease-default-window-size.patch [new file with mode: 0644]
utils/xz/Makefile [new file with mode: 0644]
utils/xz/patches/010-compile.patch [new file with mode: 0644]
utils/zoneinfo/Makefile [new file with mode: 0644]
utils/zsh/Makefile [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..b663c8b
--- /dev/null
@@ -0,0 +1,3 @@
+.*.swp
+*.orig
+*.rej
diff --git a/admin/facter/Makefile b/admin/facter/Makefile
new file mode 100644 (file)
index 0000000..7f020bb
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2013 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:=facter
+PKG_VERSION:=1.7.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
+PKG_SOURCE_URL:=http://downloads.puppetlabs.com/facter/
+PKG_MD5SUM:=50dd278ad91a6d9266aeebf444ba1a71
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/facter
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:= +ruby +libruby +ruby-core +ruby-enc +ruby-yaml
+  TITLE:=Collect and display facts about the system
+  URL:=http://projects.puppetlabs.com/projects/facter
+endef
+
+define Package/facter/description
+ A cross-platform Ruby library for retrieving facts from operating systems.
+ Supports multiple resolution mechanisms, any of which can be restricted to
+ working only on certain operating systems or environments. Facter is
+ especially useful for retrieving things like operating system names, IP
+ addresses, MAC addresses, and SSH keys.
+
+ It is easy to extend Facter to include your own custom facts or to include
+ additional mechanisms for retrieving facts.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/facter/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/1.9/facter
+       $(CP) $(PKG_BUILD_DIR)/lib/* $(1)/usr/lib/ruby/1.9/
+endef
+
+$(eval $(call BuildPackage,facter))
diff --git a/admin/gkrellmd/Makefile b/admin/gkrellmd/Makefile
new file mode 100644 (file)
index 0000000..d60bb1a
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2007-2009 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:=gkrellmd
+PKG_VERSION:=2.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=gkrellm-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://members.dslextreme.com/users/billw/gkrellm/
+PKG_MD5SUM:=009d8dddd3ce5cc83a4bb4d559ee922d
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/gkrellm-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gkrellmd
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+glib1
+  TITLE:=The GNU Krell Monitors Server
+  URL:=http://gkrellm.net/
+endef
+
+define Package/gkrellmd/description
+       Gkrellmd Listens for connections from gkrellm clients. When
+       a gkrellm client connects to a gkrellmd server all builtin
+       monitors collect their data from the server.
+endef
+
+define Package/gkrellmd/conffiles
+/etc/$(PKG_NAME).conf
+endef
+
+define Build/Compile
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS)" \
+       LDFLAGS="$(EXTRA_LDFLAGS) " \
+       $(MAKE) -C $(PKG_BUILD_DIR)/server \
+               CC="$(TARGET_CC)" \
+               glib12="yes" \
+               without-libsensors="yes" \
+               GLIB12_LIB="$(TARGET_LDFLAGS) -lglib -lgmodule" \
+               GLIB12_INCLUDE="-I$(STAGING_DIR)/usr/include/glib-1.2 -I$(STAGING_DIR)/usr/lib/glib/include"
+endef
+
+define Package/gkrellmd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/server/$(PKG_NAME).conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,gkrellmd))
diff --git a/admin/gkrellmd/files/gkrellmd.init b/admin/gkrellmd/files/gkrellmd.init
new file mode 100644 (file)
index 0000000..5bd88a9
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+START=60
+BIN=gkrellmd
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       mkdir -p $RUN_D
+       $BIN $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
diff --git a/admin/gkrellmd/patches/100-conf.patch b/admin/gkrellmd/patches/100-conf.patch
new file mode 100644 (file)
index 0000000..f90ca28
--- /dev/null
@@ -0,0 +1,40 @@
+Index: gkrellm-2.3.1/server/gkrellmd.conf
+===================================================================
+--- gkrellm-2.3.1.orig/server/gkrellmd.conf    2008-03-09 10:19:26.000000000 +0100
++++ gkrellm-2.3.1/server/gkrellmd.conf 2008-03-09 10:19:26.000000000 +0100
+@@ -4,7 +4,7 @@
+ # the client update frequency.  Values may be from 1 to 10 and should be
+ # smaller values to reduce network traffic.
+ #
+-update-hz 3
++update-hz 10
+ # Limit number of simultaneous clients allowed to connect.
+ #
+@@ -13,7 +13,7 @@
+ # Specify a specific network interface to listen on for connections.
+ # By default gkrellmd listens on all available network interfaces.
+ #
+-address 127.0.0.1
++#address 127.0.0.1
+ # Specify the port to listen on for connections.
+ #
+@@ -29,14 +29,14 @@
+ # Drop privileges after startup (you must start gkrellmd as root to do it).
+ #
+-#user nobody
++user  nobody
+ #group        proc
+ # Create a PID file for the running gkrellmd.  Default is no PID file.
+-#pidfile /var/run/gkrellmd.pid
++pidfile /var/run/gkrellmd.pid
+ # Run in background and detach from the controlling terminal
+-#detach
++detach
+ # Time interval between checks for various monitors.  If nfs-interval
+ # is <= 0 then gkrellmd will not read data for nfs file system types.
diff --git a/admin/nagios-plugins/Makefile b/admin/nagios-plugins/Makefile
new file mode 100644 (file)
index 0000000..d5fa97e
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2008-2010 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:=nagios-plugins
+PKG_VERSION:=1.4.14
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/nagiosplug
+PKG_MD5SUM:=a1835a48a777863ed2583de3c82446a9
+
+PKG_FIXUP:=patch-libtool
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+comma:= ,
+
+define Package/nagios-plugins
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=$(CXX_DEPENDS) +libpq +libopenssl +libradiusclient-ng +libopenldap
+  TITLE:=plugins for Nagios checks
+  URL:=http://nagiosplug.sourceforge.net/
+endef
+
+CONFIGURE_ARGS += \
+       --without-mysql \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --with-ping-command="/bin/ping -w %d -c %d %s" \
+       --with-ping6-command="/bin/ping6 -w %d -c %d %s" \
+       --with-ps-command="/bin/ps w" \
+       --with-ps-cols="6" \
+       --with-ps-format="%d %s %d %s %s %n" \
+       --with-ps-varlist="&procpid$(comma)&procuid$(comma)&procvsz$(comma)procstat$(comma)procprog$(comma)&pos" \
+       --with-uptime-command="/usr/bin/uptime" \
+       --with-ssh-command="/usr/bin/ssh" \
+       --with-nslookup-command="/usr/bin/nslookup"
+
+define Package/nagios-plugins/install
+       $(INSTALL_DIR) $(1)/usr/libexec/nagios
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/libexec/nagios/
+endef
+
+$(eval $(call BuildPackage,nagios-plugins))
diff --git a/admin/nagios-plugins/patches/002-plugins.patch b/admin/nagios-plugins/patches/002-plugins.patch
new file mode 100644 (file)
index 0000000..402aaba
--- /dev/null
@@ -0,0 +1,74 @@
+--- a/configure
++++ b/configure
+@@ -28209,7 +28209,7 @@ fi
+ if test "$ac_cv_have_decl_swapctl" = "yes";
+ then
+-      EXTRAS="$EXTRAS check_swap"
++      EXTRAS="$EXTRAS"
+       { echo "$as_me:$LINENO: checking for 2-arg (SVR4) swapctl" >&5
+ echo $ECHO_N "checking for 2-arg (SVR4) swapctl... $ECHO_C" >&6; }
+       if test "$ac_cv_type_swaptbl_t" = "yes" -a \
+@@ -28348,7 +28348,7 @@ cat >>confdefs.h <<\_ACEOF
+ #define HAVE_SWAP 1
+ _ACEOF
+-      EXTRAS="$EXTRAS check_swap"
++      EXTRAS="$EXTRAS"
+ fi
+ if test "x$ac_cv_swap_command" != "x"
+ then
+@@ -28400,7 +28400,7 @@ cat >>confdefs.h <<_ACEOF
+ #define PROC_MEMINFO "$ac_cv_proc_meminfo"
+ _ACEOF
+-      EXTRAS="$EXTRAS check_swap"
++      EXTRAS="$EXTRAS"
+ fi
+ # Extract the first word of "dig", so it can be a program name with args.
+--- a/plugins/Makefile.am
++++ b/plugins/Makefile.am
+@@ -34,8 +34,8 @@ libexec_PROGRAMS = check_apt check_clust
+ check_tcp_programs = check_ftp check_imap check_nntp check_pop \
+       check_udp check_clamd @check_tcp_ssl@
+-EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \
+-      check_swap check_fping check_ldap check_game check_dig \
++EXTRA_PROGRAMS = check_mysql check_radius check_snmp check_hpjd \
++      check_fping check_ldap check_game check_dig \
+       check_nagios check_by_ssh check_dns check_nt check_ide_smart    \
+       check_procs check_mysql_query check_apt
+--- a/plugins/Makefile.in
++++ b/plugins/Makefile.in
+@@ -32,7 +32,7 @@ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+ libexec_PROGRAMS = check_apt$(EXEEXT) check_cluster$(EXEEXT) \
+-      check_disk$(EXEEXT) check_dummy$(EXEEXT) check_http$(EXEEXT) \
++      check_dummy$(EXEEXT) check_http$(EXEEXT) \
+       check_load$(EXEEXT) check_mrtg$(EXEEXT) \
+       check_mrtgtraf$(EXEEXT) check_ntp$(EXEEXT) \
+       check_ntp_peer$(EXEEXT) check_nwstat$(EXEEXT) \
+@@ -41,8 +41,8 @@ libexec_PROGRAMS = check_apt$(EXEEXT) ch
+       check_time$(EXEEXT) check_ntp_time$(EXEEXT) check_ups$(EXEEXT) \
+       check_users$(EXEEXT) negate$(EXEEXT) urlize$(EXEEXT) @EXTRAS@
+ EXTRA_PROGRAMS = check_mysql$(EXEEXT) check_radius$(EXEEXT) \
+-      check_pgsql$(EXEEXT) check_snmp$(EXEEXT) check_hpjd$(EXEEXT) \
+-      check_swap$(EXEEXT) check_fping$(EXEEXT) check_ldap$(EXEEXT) \
++      check_snmp$(EXEEXT) check_hpjd$(EXEEXT) \
++      check_fping$(EXEEXT) check_ldap$(EXEEXT) \
+       check_game$(EXEEXT) check_dig$(EXEEXT) check_nagios$(EXEEXT) \
+       check_by_ssh$(EXEEXT) check_dns$(EXEEXT) check_nt$(EXEEXT) \
+       check_ide_smart$(EXEEXT) check_procs$(EXEEXT) \
+--- a/plugins/check_pgsql.c
++++ b/plugins/check_pgsql.c
+@@ -39,6 +39,7 @@ const char *email = "nagiosplug-devel@li
+ #include <libpq-fe.h>
+ #include <pg_config_manual.h>
++#define NAMEDATALEN 64
+ #define DEFAULT_DB "template1"
+ #define DEFAULT_HOST "127.0.0.1"
diff --git a/admin/nagios-plugins/patches/003-pgsl-header-fix.patch b/admin/nagios-plugins/patches/003-pgsl-header-fix.patch
new file mode 100644 (file)
index 0000000..8496e80
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/plugins/check_pgsql.c
++++ b/plugins/check_pgsql.c
+@@ -37,7 +37,7 @@ const char *email = "nagiosplug-devel@li
+ #include "netutils.h"
+ #include <libpq-fe.h>
+-#include <pg_config_manual.h>
++#include <postgresql/server/pg_config_manual.h>
+ #define NAMEDATALEN 64
+ #define DEFAULT_DB "template1"
diff --git a/admin/nagios/Makefile b/admin/nagios/Makefile
new file mode 100644 (file)
index 0000000..bb19fbe
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2008-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:=nagios
+PKG_VERSION:=2.10
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/nagios
+PKG_MD5SUM:=8c3a29e138f2ff8c8abbd3dd8a40c4b6
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nagios
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libpthread +microperl +libltdl
+  TITLE:=service and network monitoring program
+  URL:=http://www.nagios.org/
+endef
+
+define Package/nagios/description
+       service and network monitoring program
+endef
+
+EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
+
+CONFIGURE_VARS += \
+       ac_cv_lib_gd_gdImagePng_1=no \
+       ac_cv_lib_gd_gdImagePng_2=no \
+       ac_cv_lib_gd_gdImagePng_3=no \
+       ac_cv_lib_gd_gdImagePng_4=no
+
+CONFIGURE_ARGS += \
+       --with-nagios-user="root" \
+       --with-nagios-group="root" \
+       --sysconfdir="/etc/nagios" \
+       --without-gd-lib \
+       --without-gd-inc \
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               INSTALL_OPTS="" \
+               STRIP=: \
+               all install install-config
+endef
+
+define Package/nagios/install
+       $(INSTALL_DIR)  $(1)/etc/nagios
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/nagios/* $(1)/etc/nagios/
+       $(INSTALL_DIR)  $(1)/usr/bin
+       $(INSTALL_BIN)  $(PKG_INSTALL_DIR)/usr/bin/{nagios,nagiostats} $(1)/usr/bin/
+       $(INSTALL_DIR)  $(1)/usr/sbin
+       $(INSTALL_BIN)  $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+       $(INSTALL_DIR)  $(1)/usr/share
+       $(CP)   $(PKG_INSTALL_DIR)/usr/share/* $(1)/usr/share/
+endef
+
+define Package/nagios/conffiles
+/etc/nagios/cgi.cfg
+/etc/nagios/commands.cfg
+/etc/nagios/localhost.cfg
+/etc/nagios/nagios.cfg
+/etc/nagios/resource.cfg
+endef
+
+$(eval $(call BuildPackage,nagios))
diff --git a/admin/nrpe/Makefile b/admin/nrpe/Makefile
new file mode 100644 (file)
index 0000000..9495885
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007-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:=nrpe
+PKG_VERSION:=2.12
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/nagios
+PKG_MD5SUM:=b2d75e2962f1e3151ef58794d60c9e97
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nrpe
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libopenssl +libwrap
+  TITLE:=Daemon to execute Nagios check commands on remote hosts
+  URL:=http://www.nagios.org/download
+endef
+
+define Package/nrpe/description
+       The NRPE addon is designed to allow you to execute Nagios plugins on
+       remote Linux/Unix machines.  The main reason for doing this is to allow
+       Nagios to monitor "local" resources (like CPU load, memory usage, etc.)
+       on remote machines.  Since these public resources are not usually
+       exposed to external machines, an agent like NRPE must be installed on
+       the remote Linux/Unix machines.
+endef
+
+CONFIGURE_ARGS += \
+       --with-ssl="$(STAGING_DIR)/usr" \
+       --with-ssl-lib="$(STAGING_DIR)/usr/lib"
+
+define Package/nrpe/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/nrpe.cfg $(1)/etc/nrpe.cfg
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nrpe $(1)/usr/sbin
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+define Package/nrpe/conffiles
+/etc/nrpe.cfg
+endef
+
+$(eval $(call RequireCommand,openssl, \
+       $(PKG_NAME) requires openssl installed on the host-system. \
+))
+
+$(eval $(call BuildPackage,nrpe))
+
diff --git a/admin/nrpe/files/nrpe.cfg b/admin/nrpe/files/nrpe.cfg
new file mode 100644 (file)
index 0000000..e84bed7
--- /dev/null
@@ -0,0 +1,208 @@
+#############################################################################
+# Sample NRPE Config File 
+# Written by: Ethan Galstad (nagios@nagios.org)
+# 
+# Last Modified: 03-09-2007
+#
+# NOTES:
+# This is a sample configuration file for the NRPE daemon.  It needs to be
+# located on the remote host that is running the NRPE daemon, not the host
+# from which the check_nrpe client is being executed.
+#############################################################################
+
+
+# PID FILE
+# The name of the file in which the NRPE daemon should write it's process ID
+# number.  The file is only written if the NRPE daemon is started by the root
+# user and is running in standalone mode.
+
+pid_file=/var/run/nrpe.pid
+
+
+
+# PORT NUMBER
+# Port number we should wait for connections on.
+# NOTE: This must be a non-priviledged port (i.e. > 1024).
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+server_port=5666
+
+
+
+# SERVER ADDRESS
+# Address that nrpe should bind to in case there are more than one interface
+# and you do not want nrpe to bind on all interfaces.
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+server_address=192.168.1.1
+
+
+# NRPE USER
+# This determines the effective user that the NRPE daemon should run as.  
+# You can either supply a username or a UID.
+# 
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+nrpe_user=nagios
+
+
+
+# NRPE GROUP
+# This determines the effective group that the NRPE daemon should run as.  
+# You can either supply a group name or a GID.
+# 
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+nrpe_group=nagios
+
+
+
+# ALLOWED HOST ADDRESSES
+# This is an optional comma-delimited list of IP address or hostnames 
+# that are allowed to talk to the NRPE daemon.
+#
+# Note: The daemon only does rudimentary checking of the client's IP
+# address.  I would highly recommend adding entries in your /etc/hosts.allow
+# file to allow only the specified host to connect to the port
+# you are running this daemon on.
+#
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+allowed_hosts=192.168.1.2
+
+
+# COMMAND ARGUMENT PROCESSING
+# This option determines whether or not the NRPE daemon will allow clients
+# to specify arguments to commands that are executed.  This option only works
+# if the daemon was configured with the --enable-command-args configure script
+# option.  
+#
+# *** ENABLING THIS OPTION IS A SECURITY RISK! *** 
+# Read the SECURITY file for information on some of the security implications
+# of enabling this variable.
+#
+# Values: 0=do not allow arguments, 1=allow command arguments
+
+dont_blame_nrpe=0
+
+
+
+# COMMAND PREFIX
+# This option allows you to prefix all commands with a user-defined string.
+# A space is automatically added between the specified prefix string and the
+# command line from the command definition.
+#
+# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
+# Usage scenario: 
+# Execute restricted commmands using sudo.  For this to work, you need to add
+# the nagios user to your /etc/sudoers.  An example entry for alllowing 
+# execution of the plugins from might be:
+#
+# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
+#
+# This lets the nagios user run all commands in that directory (and only them)
+# without asking for a password.  If you do this, make sure you don't give
+# random users write access to that directory or its contents!
+
+# command_prefix=/usr/bin/sudo 
+
+
+
+# DEBUGGING OPTION
+# This option determines whether or not debugging messages are logged to the
+# syslog facility.
+# Values: 0=debugging off, 1=debugging on
+
+debug=0
+
+
+
+# COMMAND TIMEOUT
+# This specifies the maximum number of seconds that the NRPE daemon will
+# allow plugins to finish executing before killing them off.
+
+command_timeout=60
+
+
+
+# CONNECTION TIMEOUT
+# This specifies the maximum number of seconds that the NRPE daemon will
+# wait for a connection to be established before exiting. This is sometimes
+# seen where a network problem stops the SSL being established even though
+# all network sessions are connected. This causes the nrpe daemons to
+# accumulate, eating system resources. Do not set this too low.
+
+connection_timeout=300
+
+
+
+# WEEK RANDOM SEED OPTION
+# This directive allows you to use SSL even if your system does not have
+# a /dev/random or /dev/urandom (on purpose or because the necessary patches
+# were not applied). The random number generator will be seeded from a file
+# which is either a file pointed to by the environment valiable $RANDFILE
+# or $HOME/.rnd. If neither exists, the pseudo random number generator will
+# be initialized and a warning will be issued.
+# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
+
+#allow_weak_random_seed=1
+
+
+
+# INCLUDE CONFIG FILE
+# This directive allows you to include definitions from an external config file.
+
+#include=<somefile.cfg>
+
+
+
+# INCLUDE CONFIG DIRECTORY
+# This directive allows you to include definitions from config files (with a
+# .cfg extension) in one or more directories (with recursion).
+
+#include_dir=<somedirectory>
+#include_dir=<someotherdirectory>
+
+
+
+# COMMAND DEFINITIONS
+# Command definitions that this daemon will run.  Definitions
+# are in the following format:
+#
+# command[<command_name>]=<command_line>
+#
+# When the daemon receives a request to return the results of <command_name>
+# it will execute the command specified by the <command_line> argument.
+#
+# Unlike Nagios, the command line cannot contain macros - it must be
+# typed exactly as it should be executed.
+#
+# Note: Any plugins that are used in the command lines must reside
+# on the machine that this daemon is running on!  The examples below
+# assume that you have plugins installed in a /usr/local/nagios/libexec
+# directory.  Also note that you will have to modify the definitions below
+# to match the argument format the plugins expect.  Remember, these are
+# examples only!
+
+
+# The following examples use hardcoded command arguments...
+
+command[check_users]=/usr/libexec/nagios/check_users -w 3 -c 5
+command[check_load]=/usr/libexec/nagios/check_load -w 7,4,2 -c 10,5,3
+command[check_tmp]=/usr/libexec/nagios/check_disk -w 50% -c 25% -p /tmp
+command[check_zombie_procs]=/usr/libexec/nagios/check_procs -w 1 -c 3 -s Z
+command[check_total_procs]=/usr/libexec/nagios/check_procs -w 25 -c 30
+
+
+
+# The following examples allow user-supplied arguments and can
+# only be used if the NRPE daemon was compiled with support for 
+# command arguments *AND* the dont_blame_nrpe directive in this
+# config file is set to '1'.  This poses a potential security risk, so
+# make sure you read the SECURITY file before doing this.
+
+#command[check_users]=/usr/lib/check_users -w $ARG1$ -c $ARG2$
+#command[check_load]=/usr/lib/check_load -w $ARG1$ -c $ARG2$
+#command[check_disk]=/usr/lib/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
+#command[check_procs]=/usr/lib/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
diff --git a/admin/nrpe/files/nrpe.init b/admin/nrpe/files/nrpe.init
new file mode 100644 (file)
index 0000000..4632ac1
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2011 OpenWrt.org
+
+START=70
+
+SERVICE_USE_PID=1
+
+start() {
+       user_exists nagios 50 || user_add nagios 50
+       group_exists nagios 50 || group_add nagios 50
+       [ -d /var/run/nagios ] || {
+               mkdir -m 0755 -p /var/run/nagios
+               chown nagios:nagios /var/run/nagios
+       }
+       service_start /usr/sbin/nrpe -c /etc/nrpe.cfg -d
+}
+
+stop() {
+       service_stop /usr/sbin/nrpe
+}
diff --git a/admin/nrpe/patches/100-openssl-dh.patch b/admin/nrpe/patches/100-openssl-dh.patch
new file mode 100644 (file)
index 0000000..0b7f8c9
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/configure
++++ b/configure
+@@ -6694,11 +6694,9 @@
+                                               echo ""
+                       echo "*** Generating DH Parameters for SSL/TLS ***"
+-                      if test -f "$ssldir/sbin/openssl"; then
+-                              sslbin=$ssldir/sbin/openssl
+-                      else
+-                              sslbin=$ssldir/bin/openssl
+-                      fi
++                      # Use host openssl as it just generates some random stuff,
++                      # nothing machine-specific
++                      sslbin=/usr/bin/openssl
+                       # awk to strip off meta data at bottom of dhparam output
+                       $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h
+               fi
diff --git a/admin/nsca/Makefile b/admin/nsca/Makefile
new file mode 100644 (file)
index 0000000..7998066
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2006 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:=nsca
+PKG_VERSION:=2.7.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/nagios
+PKG_MD5SUM:=33a98e7975f633a9489d7a8938ed6131
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/send-nsca
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libmcrypt
+  TITLE:=Nagios Service Check Acceptor (NSCA) client
+  URL:=http://www.nagios.org/
+endef
+
+define Package/send-nsca/description
+       This is the client program that is used to send service check
+       information from a remote machine to the nsca daemon on the central
+       machine that runs Nagios.
+endef
+
+define Package/send-nsca/conffiles
+/etc/send_nsca.cfg
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-nsca-user="root" \
+               --with-nsca-grp="root" \
+               --with-libmcrypt-prefix="$(STAGING_DIR)/usr" \
+               , \
+               CFLAGS="$$$$CFLAGS $$$$CPPFLAGS" \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               send_nsca
+endef
+
+define Package/send-nsca/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/sample-config/send_nsca.cfg $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/send_nsca $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,send-nsca))
diff --git a/admin/osiris/Makefile b/admin/osiris/Makefile
new file mode 100644 (file)
index 0000000..d93689b
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# 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:=osiris
+PKG_VERSION:=4.2.3
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://osiris.shmoo.com/data/
+PKG_MD5SUM:=1951c7dc0fe729af9ffaf58910340d12
+
+PKG_FIXUP:=autoreconf
+PKG_LIBTOOL_PATHS:=src/db-4.2.52/build_unix
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/osirisd
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libopenssl +libpthread
+  TITLE:=Host integrity monitoring system (scanning agent)
+  URL:=http://osiris.shmoo.com/
+endef
+
+CONFIGURE_ARGS += \
+       --with-osiris-user=root \
+       --with-root-dir=/var/lib/osiris \
+       --with-readline=no, \
+       ac_cv_openssldir="$(STAGING_DIR)/usr"
+
+MAKE_FLAGS += \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               INTERACTIVE=0
+
+define Package/osirisd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/osirisd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/osirisd.init $(1)/etc/init.d/osirisd
+endef
+
+$(eval $(call BuildPackage,osirisd))
diff --git a/admin/osiris/files/osirisd.init b/admin/osiris/files/osirisd.init
new file mode 100644 (file)
index 0000000..1ce739b
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       mkdir -0755 -p /var/lib/osiris
+       service_start /usr/sbin/osirisd
+}
+
+stop() {
+       service_stop /usr/sbin/osirisd
+}
diff --git a/admin/osiris/patches/001-configure-cross.patch b/admin/osiris/patches/001-configure-cross.patch
new file mode 100644 (file)
index 0000000..025a3f8
--- /dev/null
@@ -0,0 +1,22 @@
+--- osiris-4.1.8-orig/configure        2005-04-13 15:22:13.000000000 +0200
++++ osiris-4.1.8-1/configure   2005-04-22 23:11:32.000000000 +0200
+@@ -3606,7 +3606,7 @@
+ esac
+-DB_CONFIG_ARGS="--enable-shared=no --enable-static=yes"
++DB_CONFIG_ARGS="--target=${target_alias} --host=${host_alias} --build=${build_alias} --enable-shared=no --enable-static=yes"
+ case "${OS_NAME}" in
+     MINGW32*)
+--- osiris-4.1.8-orig/configure.ac     2005-04-13 15:22:13.000000000 +0200
++++ osiris-4.1.8-1/configure.ac        2005-04-22 23:11:32.000000000 +0200
+@@ -270,7 +270,7 @@
+ dnl configure local copy of Berkely DB:
+-DB_CONFIG_ARGS="--enable-shared=no --enable-static=yes"
++DB_CONFIG_ARGS="--target=${target_alias} --host=${host_alias} --build=${build_alias} --enable-shared=no --enable-static=yes"
+ case "${OS_NAME}" in
+     MINGW32*)
diff --git a/admin/osiris/patches/002-osirisd-pidfile.patch b/admin/osiris/patches/002-osirisd-pidfile.patch
new file mode 100644 (file)
index 0000000..80c52db
--- /dev/null
@@ -0,0 +1,68 @@
+--- osiris-4.1.8-orig/src/osirisd/osirisd.c    2005-04-14 01:00:55.000000000 +0200
++++ osiris-4.1.8-1/src/osirisd/osirisd.c       2005-04-22 23:11:32.000000000 +0200
+@@ -218,6 +218,8 @@
+ #ifdef USE_PRIVSEP
+     rootpriv_setup_pidfile();
++#else
++    setup_pidfile();
+ #endif
+     process();
+--- osiris-4.1.8-orig/src/osirisd/rootpriv.c   2005-04-14 00:55:59.000000000 +0200
++++ osiris-4.1.8-1/src/osirisd/rootpriv.c      2005-04-22 23:25:10.000000000 +0200
+@@ -35,6 +35,10 @@
+ #include "logging.h"
+ #include "rootpriv.h"
++#ifndef WIN32
++extern char pid_file[MAX_PATH_LENGTH];
++#endif
++
+ #ifdef USE_PRIVSEP
+ /* this is defined in regex, and sometimes conflicts with stuff */
+@@ -80,10 +84,6 @@
+ extern pid_t child_pid;
+ extern int rootpriv_pipe[2];      /* socketpair used for rootpriv comm.  */
+-#ifndef WIN32
+-extern char pid_file[MAX_PATH_LENGTH];
+-#endif
+-
+ #define INCOMING_ROOT_REQUEST() ( FD_ISSET( rootpriv_pipe[1], &root_read_set ) )
+@@ -292,17 +292,6 @@
+ #endif
+ }
+-void setup_pidfile()
+-{
+-    FILE *pidfile = fopen( pid_file, "wb" );
+-
+-    if( pidfile != NULL )
+-    {
+-        fprintf( pidfile, "%ld\n", (long)getpid() );
+-        fclose( pidfile );
+-    }
+-}
+-
+ void handle_signals()
+ {
+     pid_t pid;
+@@ -789,3 +778,14 @@
+ #endif /* USE_PRIVSEP */
++void setup_pidfile()
++{
++    FILE *pidfile = fopen( pid_file, "wb" );
++
++    if( pidfile != NULL )
++    {
++        fprintf( pidfile, "%ld\n", (long)getpid() );
++        fclose( pidfile );
++    }
++}
++
diff --git a/admin/osiris/patches/003-openssl-0.9.8+.patch b/admin/osiris/patches/003-openssl-0.9.8+.patch
new file mode 100644 (file)
index 0000000..806cf3a
--- /dev/null
@@ -0,0 +1,16 @@
+diff -ruN osiris-4.1.9-old/src/osirismd/md_control.c osiris-4.1.9-new/src/osirismd/md_control.c
+--- osiris-4.1.9-old/src/osirismd/md_control.c 2005-03-24 16:36:07.000000000 +0100
++++ osiris-4.1.9-new/src/osirismd/md_control.c 2006-03-28 01:32:32.000000000 +0200
+@@ -3262,9 +3262,9 @@
+             int index;
+             char checksum[41];
+-            SHA_Init( &context );
+-            SHA_Update( &context, key, (unsigned long)keysize );
+-            SHA_Final( &( digest[0] ), &context );
++            SHA1_Init( &context );
++            SHA1_Update( &context, key, (unsigned long)keysize );
++            SHA1_Final( &( digest[0] ), &context );
+             for ( index = 0; index < SHA_DIGEST_LENGTH; index++ )
+             {
diff --git a/admin/osiris/patches/004-no_openssl_ripe.patch b/admin/osiris/patches/004-no_openssl_ripe.patch
new file mode 100644 (file)
index 0000000..75a9e9d
--- /dev/null
@@ -0,0 +1,59 @@
+diff -urN osiris-4.2.1/src/libosiris/filter_ripemd.c osiris-4.2.1.new/src/libosiris/filter_ripemd.c
+--- osiris-4.2.1/src/libosiris/filter_ripemd.c 2006-07-28 03:22:37.000000000 +0200
++++ osiris-4.2.1.new/src/libosiris/filter_ripemd.c     2006-11-29 12:16:00.000000000 +0100
+@@ -55,9 +55,9 @@
+         {
+             context->filter_argument += 2;
+         }
+-
++#ifndef OPENSSL_NO_RIPEMD
+         hash_file_ripemd( file_path, context->file_handle, hash, sizeof(hash) );
+-
++#endif
+         if( strcmp( hash, context->filter_argument ) == 0 )
+         {
+             return TRUE;
+diff -urN osiris-4.2.1/src/libosiris/ssl_utilities.c osiris-4.2.1.new/src/libosiris/ssl_utilities.c
+--- osiris-4.2.1/src/libosiris/ssl_utilities.c 2006-07-28 03:22:37.000000000 +0200
++++ osiris-4.2.1.new/src/libosiris/ssl_utilities.c     2006-11-29 12:17:33.000000000 +0100
+@@ -51,7 +51,9 @@
+ #include <openssl/rand.h>
+ #include <openssl/md5.h>
+ #include <openssl/sha.h>
++#ifndef OPENSSL_NO_RIPEMD
+ #include <openssl/ripemd.h>
++#endif
+ #ifdef WIN32
+ #include <winsock.h>
+@@ -348,6 +350,7 @@
+ int hash_file_ripemd( const char *file_path, FILE *file,
+                       char *buffer, int buffer_size )
+ {
++#ifndef OPENSSL_NO_RIPEMD
+     int fno;
+     FILE *file_to_hash  = file;
+     RIPEMD160_CTX context;
+@@ -430,7 +433,7 @@
+         osi_strlcpy( buffer, file_hash, buffer_size );
+         return 0;
+     }
+-
++#endif
+     return -1;
+ }
+diff -urN osiris-4.2.1/src/libosiris/utilities.c osiris-4.2.1.new/src/libosiris/utilities.c
+--- osiris-4.2.1/src/libosiris/utilities.c     2006-07-28 03:22:37.000000000 +0200
++++ osiris-4.2.1.new/src/libosiris/utilities.c 2006-11-29 12:16:38.000000000 +0100
+@@ -60,8 +60,9 @@
+ #include <openssl/md5.h>
+ #include <openssl/sha.h>
++#ifndef OPENSSL_NO_RIPEMD
+ #include <openssl/ripemd.h>
+-
++#endif
+ #include "utilities.h"
+ #include "error.h"
diff --git a/admin/osiris/patches/006-mod_nvram.patch b/admin/osiris/patches/006-mod_nvram.patch
new file mode 100644 (file)
index 0000000..69b6cd6
--- /dev/null
@@ -0,0 +1,213 @@
+Description:   The mod_nvram module was developed specifically to monitor 
+               configuration settings stored in nvram on Linksys devices. 
+               In the future, this module could be used to monitor other 
+               attributes of similar devices.
+Version:       0.1
+
+--- osiris-4.1.8-orig/src/osirisd/modules/mod_nvram/Makefile   1970-01-01 01:00:00.000000000 +0100
++++ osiris-4.1.8-1/src/osirisd/modules/mod_nvram/Makefile      2005-04-22 23:11:32.000000000 +0200
+@@ -0,0 +1,16 @@
++
++include ../Makefile
++
++SRCS=mod_nvram.c
++OBJS=$(SRCS:.c=.o)
++
++module: ${SRCS} ${OBJS}
++
++INCS=-I../.. -I../../../libosiris -I../../../libfileapi -I../../../..
++
++# meta-rule for compiling any "C" source file.
++$(OBJS): $(SRCS)
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) ${INCLUDES} ${INCS} $(AM_CPPFLAGS) \
++      $(CPPFLAGS) $(AM_CFLAGS)  $(CFLAGS) -c $(SRCS)
++      cp $@ ..
++
+--- osiris-4.1.8-orig/src/osirisd/modules/mod_nvram/README     1970-01-01 01:00:00.000000000 +0100
++++ osiris-4.1.8-1/src/osirisd/modules/mod_nvram/README        2005-04-22 23:11:32.000000000 +0200
+@@ -0,0 +1,40 @@
++
++Module: mod_nvram
++Author: Brian Wotring (brian@shmoo.com)
++
++
++
++DESCRIPTION:
++
++The mod_nvram module reads the key=value pairs stored in nvram.  This
++is primarily for Linksys routers, but could be modified to run on
++other systems if necessary.  On the routers like the WRT54G, the 
++nvram settings hold sensitive information that needs to be monitored.
++The format for the record structure is as follows:
++
++    name:value
++
++USE:
++
++To use this module, all  that is needed is to include it in the System
++block of a scan configuration, e.g.:
++
++    <System>
++    ...
++    Include mod_nvram
++    ...
++    </System>
++
++
++PARAMETERS:
++
++There are no parameters for this module.
++
++PLATFORMS:
++
++Currently, only for the Linksys WRT54G and WRT54GS devices.    
++
++NOTES:
++
++
++
+--- osiris-4.1.8-orig/src/osirisd/modules/mod_nvram/mod_nvram.c        1970-01-01 01:00:00.000000000 +0100
++++ osiris-4.1.8-1/src/osirisd/modules/mod_nvram/mod_nvram.c   2005-04-22 23:11:32.000000000 +0200
+@@ -0,0 +1,142 @@
++
++/******************************************************************************
++**
++**  This program is free software; you can redistribute it and/or
++**  modify it, however, you cannot sell it.
++**
++**  This program is distributed in the hope that it will be useful,
++**  but WITHOUT ANY WARRANTY; without even the implied warranty of
++**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++**
++**  You should have received a copy of the license attached to the
++**  use of this software.  If not, visit www.shmoo.com/osiris for
++**  details.
++**
++******************************************************************************/
++
++/*****************************************************************************
++**
++**  File:    mod_users.c
++**  Date:    January 1, 2004
++**
++**  Author:  Brian Wotring
++**  Purpose: platform specific methods for reading user file information.
++**
++******************************************************************************/
++
++#include "libosiris.h"
++#include "libfileapi.h"
++#include "rootpriv.h"
++#include "common.h"
++#include "version.h"
++
++#include "scanner.h"
++#include "logging.h"
++
++
++#define NVRAM_PATH "/usr/sbin/nvram"
++#define NVRAM_ARG "show"
++
++static const char *MODULE_NAME = "mod_nvram";
++
++
++void mod_nvram( SCANNER *scanner )
++{
++    int pid;
++    int pc[2];
++    int cp[2];
++    char temp_line[4096];
++    FILE *file;
++    SCAN_RECORD_TEXT_1 record;
++
++    if( pipe(pc) < 0)
++    {
++        log_error( "mod_nvram: error creating pipe!" );
++        return;
++    }
++
++    if( pipe(cp) < 0)
++    {
++        log_error( "mod_nvram: error creating pipe!" );
++        return;
++    }
++
++    /* Create a child to run nvram command. */
++
++    switch( pid = fork() )
++    {
++        case -1:
++            log_error( "nvram: fork error!" );
++            return;
++
++        case 0:
++
++            /* child */
++
++            close(1);    
++            dup( cp[1]); 
++            close(0); 
++            close( pc[1]);
++            close( cp[0]);
++            execl( NVRAM_PATH, NVRAM_PATH, NVRAM_ARG, NULL );
++            exit(0);
++
++        default:
++
++            /* parent */
++
++            close(pc[1]);
++            close(cp[1]);
++
++            file = fdopen( cp[0], "r" );
++
++            for(;;)
++            {
++                char *line;
++                char *key_end;
++
++                line = fgets( temp_line, sizeof( temp_line ), file );
++
++                if( line == NULL)
++                {
++                    break;
++                }
++
++                line = trim_white_space( line );
++
++                /* skip commented and empty lines. */
++
++                if( ( line == NULL ) || ( line[0] == '#' ) )
++                {
++                    continue;
++                }
++
++                /* locate the username, this is the first item in the colon list. */
++
++                if( ( key_end = strchr( line, '=' ) ) == NULL )
++                {
++                    continue;
++                }
++
++                initialize_scan_record( (SCAN_RECORD *)&record,
++                                         SCAN_RECORD_TYPE_TEXT_1 );
++
++                osi_strlcpy( record.module_name, MODULE_NAME,
++                             sizeof( record.module_name ) );
++
++                /* user the key as a key/path for this record. */
++
++                (*key_end) = '\0';
++                key_end++;
++                osi_strlcpy( record.name, "nvram:", sizeof( record.name ) );
++                osi_strlcat( record.name, line, sizeof( record.name ) );
++
++                /* now copy in the value into the data portion. */
++                /* and send this record on its way.             */
++
++                osi_strlcpy( record.data, key_end, sizeof( record.data ) );
++                send_scan_data( scanner, (SCAN_RECORD *)&record );
++            }
++    }
++}
++
diff --git a/admin/osiris/patches/007-mod_uptime.patch b/admin/osiris/patches/007-mod_uptime.patch
new file mode 100644 (file)
index 0000000..2bfeec6
--- /dev/null
@@ -0,0 +1,243 @@
+Description:   The mod_uptime module obtains the system boot time value 
+               for comparison with scans.
+Version:       0.2
+
+--- osiris-4.1.8-orig/src/osirisd/modules/mod_uptime/Makefile  1970-01-01 01:00:00.000000000 +0100
++++ osiris-4.1.8-1/src/osirisd/modules/mod_uptime/Makefile     2005-04-22 23:11:32.000000000 +0200
+@@ -0,0 +1,16 @@
++
++include ../Makefile
++
++SRCS=mod_uptime.c
++OBJS=$(SRCS:.c=.o)
++
++module: ${SRCS} ${OBJS}
++
++INCS=-I../.. -I../../../libosiris -I../../../libfileapi -I../../../..
++
++# meta-rule for compiling any "C" source file.
++$(OBJS): $(SRCS)
++      $(CC) $(DEFS) $(DEFAULT_INCLUDES) ${INCLUDES} ${INCS} $(AM_CPPFLAGS) \
++      $(CPPFLAGS) $(AM_CFLAGS)  $(CFLAGS) -c $(SRCS)
++      cp $@ ..
++
+--- osiris-4.1.8-orig/src/osirisd/modules/mod_uptime/README    1970-01-01 01:00:00.000000000 +0100
++++ osiris-4.1.8-1/src/osirisd/modules/mod_uptime/README       2005-04-22 23:11:32.000000000 +0200
+@@ -0,0 +1,36 @@
++
++Module: mod_uptime
++Author: Brian Wotring (brian@shmoo.com)
++
++
++
++DESCRIPTION:
++
++The mod_uptime module obtains the system boot time value for comparison
++with scans.
++
++USE:
++
++To use this module, all  that is needed is to include it in the System
++block of a scan configuration, e.g.:
++
++    <System>
++    ...
++    Include mod_uptime
++    ...
++    </System>
++
++
++PARAMETERS:
++
++There are no parameters for this module.
++
++PLATFORMS:
++    
++Currently, this module is implemented for FreeBSD, OpenBSD,
++Linux, Solaris, and Mac OS X.
++
++NOTES:
++
++
++
+--- osiris-4.1.8-orig/src/osirisd/modules/mod_uptime/mod_uptime.c      1970-01-01 01:00:00.000000000 +0100
++++ osiris-4.1.8-1/src/osirisd/modules/mod_uptime/mod_uptime.c 2005-04-22 23:11:32.000000000 +0200
+@@ -0,0 +1,178 @@
++
++/******************************************************************************
++**
++**  This program is free software; you can redistribute it and/or
++**  modify it, however, you cannot sell it.
++**
++**  This program is distributed in the hope that it will be useful,
++**  but WITHOUT ANY WARRANTY; without even the implied warranty of
++**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++**
++**  You should have received a copy of the license attached to the
++**  use of this software.  If not, visit www.shmoo.com/osiris for
++**  details.
++**
++******************************************************************************/
++
++/*****************************************************************************
++**
++**  File:    mod_uptime.c
++**  Date:    March 22, 2004
++**
++**  Author:  Brian Wotring
++**  Purpose: platform specific methods for obtaining the system boot time.
++**
++******************************************************************************/
++
++#include "libosiris.h"
++#include "libfileapi.h"
++#include "rootpriv.h"
++#include "common.h"
++#include "version.h"
++
++#include "scanner.h"
++#include "logging.h"
++#include "config.h"
++
++#ifdef HAVE_SYS_SYSCTL_H
++#include <sys/sysctl.h>
++#endif
++
++#ifdef SYSTEM_SUNOS
++#include <utmpx.h>
++#endif
++
++#ifdef SYSTEM_LINUX
++#include <utmp.h>
++#endif
++
++#define PROC_FILE "/proc/uptime"
++#define OSI_WTMP_FILE "/var/log/wtmp"
++
++static const char *MODULE_NAME = "mod_uptime";
++
++
++void mod_uptime( SCANNER *scanner )
++{
++    SCAN_RECORD_TEXT_1 record;
++    char *time = NULL;
++    char *temp;
++
++    initialize_scan_record( (SCAN_RECORD *)&record,
++                             SCAN_RECORD_TYPE_TEXT_1 );
++
++    osi_strlcpy( record.module_name, MODULE_NAME,
++                 sizeof( record.module_name ) );
++
++#if defined(SYSTEM_FREEBSD) || defined(SYSTEM_OPENBSD) || defined(SYSTEM_DARWIN)
++    {
++        time_t t;
++        struct timeval result;
++
++        int request[2] = { CTL_KERN, KERN_BOOTTIME };
++        size_t result_len = sizeof(result);
++
++        if( sysctl( request, 2, &result, &result_len, NULL, 0 ) < 0)
++        {
++            log_error( "unable to obtain uptime value." );
++            return;
++        }
++
++        t = result.tv_sec;
++        time = ctime( &t );
++    }
++
++#elif defined(SYSTEM_SUNOS)
++    {
++        struct utmpx * ent;
++        time_t t;
++
++        while( ( ent = getutxent() ) )
++        {
++            if( !strcmp( "system boot", ent->ut_line ) )
++            {
++                t = ent->ut_tv.tv_sec;
++                time = ctime( &t );
++            }
++        }
++    }
++
++#elif defined(SYSTEM_LINUX)
++    {
++        FILE *fp;
++        time_t t;
++        struct utmp ut;
++
++        char buf[40];
++        char buf2[10];
++        int filecount = 0;
++
++next_file:
++
++        osi_strlcpy( buf, OSI_WTMP_FILE, sizeof( buf ) );
++
++        if( filecount > 0 )
++        {
++            osi_snprintf( buf2, sizeof(buf2), "%d", filecount );
++            osi_strlcat( buf, buf2, sizeof(buf) );
++        }
++
++        fp = osi_fopen( buf, "r", 0 );
++
++        if( fp == NULL )
++        {
++            log_error( "unable to obtain uptime value." );
++            return;
++        }
++
++        while(1)
++        {
++            int rc = fread( &ut, 1, sizeof(ut), fp );
++
++            /* end of file, try next. */
++
++            if( rc == 0 )
++            {
++                filecount++;                
++                fclose( fp );
++
++                goto next_file;
++            }
++
++            /* found restart event. */
++
++            if( ( strcmp( ut.ut_name, "reboot" ) == 0 ) ||
++                ( strcmp( ut.ut_name, "shutdown" ) == 0 ) )
++            {
++
++                t = ut.ut_time;
++                time = ctime( &t );
++
++                break;
++            }
++        }
++
++        fclose( fp );
++    }
++#endif
++
++    if( time == NULL )
++    {
++        log_error( "unable to obtain uptime value." );
++        return;
++    }
++
++    /* remove any trailing newline from the ctime() calls. */
++
++    if( ( temp = strchr( time, '\n' ) ) )
++    {
++        (*temp) = '\0';
++    }
++
++    osi_strlcpy( record.name, "uptime", sizeof( record.name ) );
++    osi_strlcpy( record.data, time, sizeof( record.data ) );
++
++    send_scan_data( scanner, (SCAN_RECORD *)&record );
++}
++
++
diff --git a/admin/osiris/patches/010-dont-add-host-include-paths.patch b/admin/osiris/patches/010-dont-add-host-include-paths.patch
new file mode 100644 (file)
index 0000000..84e4ab6
--- /dev/null
@@ -0,0 +1,16 @@
+diff --git a/configure b/configure
+index f7f5ce9..322a49d 100755
+--- a/configure
++++ b/configure
+@@ -4448,11 +4448,6 @@ cat >>confdefs.h <<_ACEOF
+ #define SYSTEM_LINUX 1
+ _ACEOF
+-
+-    rc=`grep -c krb5 /usr/include/openssl/ssl.h`
+-    if test $rc -ne 0; then
+-        CPPFLAGS="-I/usr/kerberos/include/ ${CPPFLAGS}"
+-    fi
+     ;;
+ BSD*)
diff --git a/admin/ostiary/Makefile b/admin/ostiary/Makefile
new file mode 100644 (file)
index 0000000..757c595
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# Copyright (C) 2008-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:=ostiary
+PKG_VERSION:=4.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ingles.homeunix.net/software/ost/latest/
+PKG_MD5SUM:=420d1fda246097d7e4d1277f39069578
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ostiary
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Simple, Secure Remote Script Execution
+  URL:=http://ingles.homeunix.net/software/ost/index.html
+endef
+
+define Package/ostiary/description
+ Designed to allow you to run a fixed set of commands remotely,
+ without giving everyone else access to the same commands.
+
+ Provides - ostiaryd daemon (~25kb)
+          - ostclient (~9kb)
+endef
+
+EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
+
+CONFIGURE_ARGS += \
+    --prefix="/usr/bin" \
+    --sysconfdir="/etc/ostiaryd" \
+    CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               INSTALL_OPTS="" \
+               STRIP="" \
+               ostiaryd ostclient
+endef
+
+define Package/ostiary/install
+       $(INSTALL_DIR) $(1)/etc/ostiaryd
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/tests/ostiary.cfg $(1)/etc/ostiaryd/ostiary.cfg
+       $(INSTALL_DIR) $(1)/etc/ostiaryd/scripts
+       $(INSTALL_BIN) ./files/{ssh_enable,ssh_disable} $(1)/etc/ostiaryd/scripts
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/ostiaryd.init $(1)/etc/init.d/ostiaryd
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/{ostiaryd,ostclient} $(1)/usr/bin/
+endef
+
+
+
+
+define Package/ostiary/postinst
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Enabling rc.d symlink for ostiaryd"
+       /etc/init.d/ostiaryd enable
+fi
+exit 0
+endef
+
+define Package/ostiary/prerm
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       /etc/init.d/ostiaryd stop
+       echo "Removing rc.d symlink for ostiaryd"
+       /etc/init.d/ostiaryd disable
+       echo "Any config backups and scripts you created are not removed automatically."
+       echo "To finish cleanup, backup any files you want to keep, then run rm -f /etc/ostiaryd"
+fi
+exit 0
+endef
+
+
+$(eval $(call BuildPackage,ostiary))
diff --git a/admin/ostiary/files/ostiaryd.init b/admin/ostiary/files/ostiaryd.init
new file mode 100644 (file)
index 0000000..6c4ee09
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2012 OpenWrt.org
+
+START=85
+MYSERVICE=ostiaryd
+
+
+start() {
+    echo starting $MYSERVICE...
+    /usr/bin/$MYSERVICE
+    sleep 1
+    echo done
+}
+
+stop() {
+
+        if ps ax | grep -v grep | grep -v rc.common | grep $MYSERVICE> /dev/null
+        then
+                echo "stopping $MYSERVICE..."
+                pkill -9 $MYSERVICE
+                sleep 1
+                echo done
+        else
+                echo "$MYSERVICE is not running"
+        fi
+}
+
diff --git a/admin/ostiary/files/ssh_disable b/admin/ostiary/files/ssh_disable
new file mode 100644 (file)
index 0000000..1d4304f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+logger Ostiary is dis-abling SSH
+iptables -D zone_wan -p tcp --dport 22001 -j ACCEPT
diff --git a/admin/ostiary/files/ssh_enable b/admin/ostiary/files/ssh_enable
new file mode 100644 (file)
index 0000000..0987cde
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+logger Ostiary is enabling SSH
+iptables -I zone_wan -p tcp --dport 22001 -j ACCEPT
diff --git a/admin/pmacct/Makefile b/admin/pmacct/Makefile
new file mode 100644 (file)
index 0000000..4299a82
--- /dev/null
@@ -0,0 +1,178 @@
+#
+# Copyright (C) 2006-2012 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:=pmacct
+PKG_VERSION:=0.14.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.pmacct.net/
+PKG_MD5SUM:=4588531f0e8033fe82ad7fb22d1bbdb7
+
+PKG_BUILD_DEPENDS:=libpcap
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_IPV6 \
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pmacct/Default
+  SECTION:=admin
+  CATEGORY:=Administration
+  SUBMENU:=Pmacct suite
+  URL:=http://www.pmacct.net/
+  DEPENDS=+libpcap
+endef
+
+define Package/pmacct-client
+  $(call Package/pmacct/Default)
+  TITLE:=Command-line client to gather data from the IMT plugin
+  VARIANT:=basic
+endef
+
+define Package/nfacctd/Default
+  $(call Package/pmacct/Default)
+  TITLE:=NetFlow accounting daemon
+endef
+
+define Package/pmacctd/Default
+  $(call Package/pmacct/Default)
+  TITLE:=IP pcap-based accounting daemon
+endef
+
+define Package/sfacctd/Default
+  $(call Package/pmacct/Default)
+  TITLE:=sFlow accounting daemon
+endef
+
+define Package/uacctd/Default
+  $(call Package/pmacct/Default)
+  DEPENDS+= +iptables-mod-ulog
+  TITLE:=ulog accounting daemon
+endef
+
+
+CONFIGURE_ARGS+= \
+       $(call autoconf_bool,CONFIG_IPV6,ipv6) \
+       --with-pcap-includes="$(STAGING_DIR)/usr/include" \
+       --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
+       --enable-ulog \
+
+ifeq ($(BUILD_VARIANT),basic)
+
+  CONFIGURE_ARGS += \
+       --disable-mysql \
+       --disable-pgsql \
+       --disable-sqlite3 \
+
+endif
+
+ifeq ($(BUILD_VARIANT),mysql)
+
+  CONFIGURE_ARGS += \
+       --enable-mysql \
+       --with-mysql-includes="$(STAGING_DIR)/usr/include" \
+       --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
+       --disable-pgsql \
+       --disable-sqlite3 \
+
+  CONFIGURE_VARS+= \
+       LIBS="-lz" \
+
+endif
+
+ifeq ($(BUILD_VARIANT),pgsql)
+
+  CONFIGURE_ARGS += \
+       --disable-mysql \
+       --enable-pgsql \
+       --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
+       --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
+       --disable-sqlite3 \
+
+endif
+
+ifeq ($(BUILD_VARIANT),sqlite)
+
+  CONFIGURE_ARGS += \
+       --disable-mysql \
+       --disable-pgsql \
+       --enable-sqlite3 \
+       --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
+       --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
+
+endif
+
+
+define Package/pmacct-client/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
+endef
+
+
+# $(1): build variant {basic,mysql,pgsql,sqlite}
+# $(2): package name prefix {nfacctd,pmacctd,sfacctd,uacctd}
+# $(3): package name suffix {,-mysql,-pgsql,-sqlite}
+# $(4): additional title (with MySQL support, ...)
+# $(5): additional dependencies (+libmysqlclient, ...)
+
+define BuildPackage/Template
+
+  define Package/$(2)$(3)
+    $(call Package/$(2)/Default)
+    DEPENDS+= $(5)
+    TITLE+= $(4)
+    VARIANT:=$(1)
+  endef
+
+  define Package/$(2)$(3)/conffiles
+/etc/default/$(2)
+/etc/$(2).conf
+  endef
+
+  define Package/$(2)$(3)/install
+       $(INSTALL_DIR) $$(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(2) $$(1)/usr/sbin/
+       $(INSTALL_DIR) $$(1)/etc
+       $(INSTALL_DATA) ./files/$(2).conf $$(1)/etc/
+       $(INSTALL_DIR) $$(1)/etc/default
+       $(INSTALL_DATA) ./files/$(2).default $$(1)/etc/default/$(2)
+       $(INSTALL_DIR) $$(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(2).init $$(1)/etc/init.d/$(2)
+  endef
+
+  $$(eval $$(call BuildPackage,$(2)$(3)))
+
+endef
+
+$(eval $(call BuildPackage,pmacct-client))
+
+$(eval $(call BuildPackage/Template,basic,nfacctd,,,))
+$(eval $(call BuildPackage/Template,basic,pmacctd,,,))
+$(eval $(call BuildPackage/Template,basic,sfacctd,,,))
+$(eval $(call BuildPackage/Template,basic,uacctd,,,))
+
+$(eval $(call BuildPackage/Template,mysql,nfacctd,-mysql,with MySQL support,+libmysqlclient))
+$(eval $(call BuildPackage/Template,mysql,pmacctd,-mysql,with MySQL support,+libmysqlclient))
+$(eval $(call BuildPackage/Template,mysql,sfacctd,-mysql,with MySQL support,+libmysqlclient))
+$(eval $(call BuildPackage/Template,mysql,uacctd,-mysql,with MySQL support,+libmysqlclient))
+
+$(eval $(call BuildPackage/Template,pgsql,nfacctd,-pgsql,with PostgreSQL support,+libpq))
+$(eval $(call BuildPackage/Template,pgsql,pmacctd,-pgsql,with PostgreSQL support,+libpq))
+$(eval $(call BuildPackage/Template,pgsql,sfacctd,-pgsql,with PostgreSQL support,+libpq))
+$(eval $(call BuildPackage/Template,pgsql,uacctd,-pgsql,with PostgreSQL support,+libpq))
+
+$(eval $(call BuildPackage/Template,sqlite,nfacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
+$(eval $(call BuildPackage/Template,sqlite,pmacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
+$(eval $(call BuildPackage/Template,sqlite,sfacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
+$(eval $(call BuildPackage/Template,sqlite,uacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
diff --git a/admin/pmacct/files/nfacctd.conf b/admin/pmacct/files/nfacctd.conf
new file mode 100644 (file)
index 0000000..27b8956
--- /dev/null
@@ -0,0 +1,29 @@
+!
+! nfacctd configuration example
+!
+! debug: true
+daemonize: true
+pidfile: /var/run/nfacctd.pid
+! aggregate_filter[dummy]: src net 192.168.0.0/16
+aggregate: src_host, dst_host
+! plugin_buffer_size: 1024
+! nfacctd_port: 5678
+! nfacctd_time_secs: true
+! nfacctd_time_new: true
+plugins: memory
+imt_buckets: 65537
+imt_mem_pools_size: 65536
+! imt_mem_pools_number: 0
+! plugins: mysql
+! plugins: pgsql
+! plugins: sqlite3
+! sql_db: pmacct
+! sql_table: acct
+! sql_table_version: 2
+! sql_passwd: arealsmartpwd
+! sql_user: pmacct
+! sql_refresh_time: 90
+! sql_optimize_clauses: true
+! sql_history: 10m
+! sql_history_roundoff: mh
+! networks_file: ./networks.example
diff --git a/admin/pmacct/files/nfacctd.default b/admin/pmacct/files/nfacctd.default
new file mode 100644 (file)
index 0000000..9315b28
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-f /etc/nfacctd.conf"
diff --git a/admin/pmacct/files/nfacctd.init b/admin/pmacct/files/nfacctd.init
new file mode 100644 (file)
index 0000000..66b9021
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+PROG="nfacctd"
+DEFAULT="/etc/default/$PROG"
+COMMAND="/usr/sbin/$PROG"
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start $COMMAND $OPTIONS
+}
+
+stop() {
+       service_stop $COMMAND
+}
diff --git a/admin/pmacct/files/pmacctd.conf b/admin/pmacct/files/pmacctd.conf
new file mode 100644 (file)
index 0000000..e7e4892
--- /dev/null
@@ -0,0 +1,27 @@
+!
+! pmacctd configuration example
+!
+! debug: true
+interface: vlan1
+daemonize: true
+pidfile: /var/run/pmacctd.pid
+pmacctd_id: 1
+aggregate: src_host,dst_host
+! aggregate: src_net,dst_net
+plugins: memory
+imt_buckets: 65537
+imt_mem_pools_size: 65536
+! imt_mem_pools_number: 0
+! plugins: mysql
+! plugins: pgsql
+! plugins: sqlite3
+! sql_db: pmacct
+! sql_table: acct
+! sql_table_version: 2
+! sql_passwd: arealsmartpwd
+! sql_user: pmacct
+! sql_refresh_time: 90
+! sql_optimize_clauses: true
+! sql_history: 10m
+! sql_history_roundoff: mh
+! networks_file: ./networks.example
diff --git a/admin/pmacct/files/pmacctd.default b/admin/pmacct/files/pmacctd.default
new file mode 100644 (file)
index 0000000..3c06f08
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-f /etc/pmacctd.conf"
diff --git a/admin/pmacct/files/pmacctd.init b/admin/pmacct/files/pmacctd.init
new file mode 100644 (file)
index 0000000..3d75bcf
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+PROG="pmacctd"
+DEFAULT="/etc/default/$PROG"
+COMMAND="/usr/sbin/$PROG"
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start $COMMAND $OPTIONS
+}
+
+stop() {
+       service_stop $COMMAND
+}
diff --git a/admin/pmacct/files/sfacctd.conf b/admin/pmacct/files/sfacctd.conf
new file mode 100644 (file)
index 0000000..3d25e54
--- /dev/null
@@ -0,0 +1,27 @@
+!
+! sfacctd configuration example
+!
+! debug: true
+daemonize: true
+pidfile: /var/run/sfacctd.pid
+! aggregate_filter[dummy]: src net 192.168.0.0/16
+aggregate: src_host, dst_host
+! plugin_buffer_size: 1024
+! sfacctd_port: 5678
+plugins: memory
+imt_buckets: 65537
+imt_mem_pools_size: 65536
+! imt_mem_pools_number: 0
+! plugins: mysql
+! plugins: pgsql
+! plugins: sqlite3
+! sql_db: pmacct
+! sql_table: acct
+! sql_table_version: 2
+! sql_passwd: arealsmartpwd
+! sql_user: pmacct
+! sql_refresh_time: 90
+! sql_optimize_clauses: true
+! sql_history: 10m
+! sql_history_roundoff: mh
+! networks_file: ./networks.example
diff --git a/admin/pmacct/files/sfacctd.default b/admin/pmacct/files/sfacctd.default
new file mode 100644 (file)
index 0000000..abd0c34
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-f /etc/sfacctd.conf"
diff --git a/admin/pmacct/files/sfacctd.init b/admin/pmacct/files/sfacctd.init
new file mode 100644 (file)
index 0000000..16468d4
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+PROG="sfacctd"
+DEFAULT="/etc/default/$PROG"
+COMMAND="/usr/sbin/$PROG"
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start $COMMAND $OPTIONS
+}
+
+stop() {
+       service_stop $COMMAND
+}
diff --git a/admin/pmacct/files/uacctd.conf b/admin/pmacct/files/uacctd.conf
new file mode 100644 (file)
index 0000000..c8cdd7d
--- /dev/null
@@ -0,0 +1,28 @@
+!
+! uacctd configuration example
+!
+! debug: true
+
+uacctd_group : 1
+
+daemonize: true
+pidfile: /var/run/uacctd.pid
+aggregate: src_host,dst_host
+! aggregate: src_net,dst_net
+plugins: memory
+imt_buckets: 65537
+imt_mem_pools_size: 65536
+! imt_mem_pools_number: 0
+! plugins: mysql
+! plugins: pgsql
+! plugins: sqlite3
+! sql_db: uacct
+! sql_table: acct
+! sql_table_version: 2
+! sql_passwd: arealsmartpwd
+! sql_user: uacct
+! sql_refresh_time: 90
+! sql_optimize_clauses: true
+! sql_history: 10m
+! sql_history_roundoff: mh
+! networks_file: ./networks.example
diff --git a/admin/pmacct/files/uacctd.default b/admin/pmacct/files/uacctd.default
new file mode 100644 (file)
index 0000000..7b2834e
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-f /etc/uacctd.conf"
diff --git a/admin/pmacct/files/uacctd.init b/admin/pmacct/files/uacctd.init
new file mode 100644 (file)
index 0000000..39b27ba
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+PROG="uacctd"
+DEFAULT="/etc/default/$PROG"
+COMMAND="/usr/sbin/$PROG"
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start $COMMAND $OPTIONS
+}
+
+stop() {
+       service_stop $COMMAND
+}
diff --git a/admin/sudo/Makefile b/admin/sudo/Makefile
new file mode 100644 (file)
index 0000000..818db94
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# 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:=sudo
+PKG_VERSION:=1.7.10p8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.sudo.ws/sudo/dist
+PKG_MD5SUM:=4620e31c28b387dd9582dfd42e930cfb
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sudo
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Delegate authority to run commands
+  URL:=http://www.sudo.ws/
+endef
+
+define Package/sudo/description
+ Sudo (su "do") allows a system administrator to delegate authority to
+ give certain users (or groups of users) the ability to run some (or
+ all) commands as root or another user while providing an audit trail of
+ the commands and their arguments.
+endef
+
+define Package/sudo/conffiles
+/etc/sudoers
+endef
+
+CONFIGURE_ARGS+= \
+       --without-pam \
+       --disable-pam-session \
+       --with-editor=/bin/vi \
+       --without-lecture \
+       --disable-zlib
+
+CONFIGURE_VARS+= \
+       sudo_cv_uid_t_len=10 \
+       sudo_cv_func_unsetenv_void=no
+
+define Package/sudo/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/sudo $(1)/usr/bin/
+       chmod 4755 $(1)/usr/bin/sudo
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/visudo $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/sudoers $(1)/etc/
+       chmod 0440 $(1)/etc/sudoers
+       $(INSTALL_DIR) $(1)/etc/sudoers.d
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sudo_noexec.so $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sudo.init $(1)/etc/init.d/sudo
+endef
+
+define Package/sudo/postinst
+#!/bin/sh
+
+[ -n "$$IPKG_INSTROOT" ] || {
+       /etc/init.d/sudo enable
+       /etc/init.d/sudo start
+}
+endef
+
+$(eval $(call BuildPackage,sudo))
diff --git a/admin/sudo/files/sudo.init b/admin/sudo/files/sudo.init
new file mode 100755 (executable)
index 0000000..9df2737
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=99
+
+start() {
+       [ -d /var/lib/sudo ] || {
+               mkdir -m 0755 -p /var/lib/sudo
+               chmod 0700 /var/lib/sudo
+       }
+}
diff --git a/admin/syslog-ng/Makefile b/admin/syslog-ng/Makefile
new file mode 100644 (file)
index 0000000..4e5898e
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006-2012 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:=syslog-ng
+PKG_VERSION:=1.6.12
+PKG_RELEASE:=6
+PKG_MD5SUM:=a3cbfdb6e1e5beea181a7349749719f3
+
+PKG_SOURCE_URL:= \
+       http://www.balabit.com/downloads/files/syslog-ng/sources/1.6/src \
+       http://www.balabit.com/downloads/files/syslog-ng/stable/src
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/syslog-ng
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libol +librt
+  TITLE:=A powerful syslog daemon
+  URL:=http://www.balabit.com/products/syslog_ng/
+endef
+
+define Package/syslog-ng/description
+       syslog-ng reads and logs messages to the system console, log
+       files, other machines and/or users as specified by its
+       configuration file.
+endef
+
+define Package/syslog-ng/conffiles
+/etc/syslog-ng/syslog-ng.conf
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-dependency-tracking \
+        --disable-full-static \
+        --enable-tcp-wrapper \
+        --with-libol="$(STAGING_DIR)/host/bin" \
+               , \
+               CPPFLAGS="-I$(STAGING_DIR)/usr/include/libol $(TARGET_CPPFLAGS)" \
+               LDFLAGS="-L$(STAGING_DIR)/usr/lib/libol $(TARGET_LDFLAGS)" \
+       )
+endef
+
+define Package/syslog-ng/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/syslog-ng $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/syslog-ng.init $(1)/etc/init.d/syslog-ng
+       $(INSTALL_DIR) $(1)/etc/syslog-ng
+       $(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc/syslog-ng/
+endef
+
+$(eval $(call BuildPackage,syslog-ng))
diff --git a/admin/syslog-ng/files/syslog-ng.conf b/admin/syslog-ng/files/syslog-ng.conf
new file mode 100644 (file)
index 0000000..658abea
--- /dev/null
@@ -0,0 +1,16 @@
+options { 
+       chain_hostnames(off); 
+       sync(0); 
+
+       # The default action of syslog-ng 1.6.0 is to log a STATS line
+       # to the file every 10 minutes.  That's pretty ugly after a while.
+       # Change it to every 12 hours so you get a nice daily update of
+       # how many messages syslog-ng missed (0).
+       stats(43200); 
+};
+
+source src { unix-stream("/dev/log"); internal(); };
+
+destination messages { file("/var/log/messages"); };
+
+log { source(src); destination(messages); };
diff --git a/admin/syslog-ng/files/syslog-ng.init b/admin/syslog-ng/files/syslog-ng.init
new file mode 100644 (file)
index 0000000..07b8a05
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       [ -f /etc/syslog-ng/syslog-ng.conf ] || return 1
+       service_start /usr/sbin/syslog-ng
+}
+
+stop() {
+       service_stop /usr/sbin/syslog-ng
+}
+
+reload() {
+       service_reload /usr/sbin/syslog-ng
+}
diff --git a/admin/syslog-ng/patches/001-no_lfl.patch b/admin/syslog-ng/patches/001-no_lfl.patch
new file mode 100644 (file)
index 0000000..ce33d95
--- /dev/null
@@ -0,0 +1,38 @@
+diff -ubr /tmp/syslog-ng-1.6.12/configure syslog-ng-1.6.12/configure
+--- /tmp/syslog-ng-1.6.12/configure    2007-02-02 02:58:41.000000000 -0600
++++ syslog-ng-1.6.12/configure 2007-03-03 20:39:40.000000000 -0600
+@@ -3695,7 +3695,7 @@
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lfl  $LIBS"
++LIBS="$LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+diff -ubr /tmp/syslog-ng-1.6.12/Makefile.in syslog-ng-1.6.12/Makefile.in
+--- /tmp/syslog-ng-1.6.12/Makefile.in  2007-02-02 02:58:41.000000000 -0600
++++ syslog-ng-1.6.12/Makefile.in       2007-03-03 20:38:56.000000000 -0600
+@@ -65,7 +65,7 @@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
+ LEX = @LEX@
+-LEXLIB = @LEXLIB@
++LEXLIB =
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ LIBOBJS = @LIBOBJS@
+ LIBOL_DIR = @LIBOL_DIR@
+diff -ubr /tmp/syslog-ng-1.6.12/src/cfg-lex.c syslog-ng-1.6.12/src/cfg-lex.c
+--- /tmp/syslog-ng-1.6.12/src/cfg-lex.c        2006-08-22 03:43:36.000000000 -0500
++++ syslog-ng-1.6.12/src/cfg-lex.c     2007-03-03 20:36:52.000000000 -0600
+@@ -668,7 +668,9 @@
+ #ifdef __cplusplus
+ extern "C" int yywrap (void );
+ #else
+-extern int yywrap (void );
++int yywrap (void ) {
++      return 1;
++}
+ #endif
+ #endif
diff --git a/admin/syslog-ng3/Makefile b/admin/syslog-ng3/Makefile
new file mode 100644 (file)
index 0000000..a3dbe25
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# 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:=syslog-ng
+PKG_VERSION:=3.0.5
+PKG_RELEASE:=5
+
+PKG_SOURCE_URL:=http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/$(PKG_VERSION)/source/
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=28f0d9ff2243b330e8cd6311ef9b2f12
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_IPV6 \
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/syslog-ng3
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libpcre +glib2 +libeventlog +libopenssl +libwrap +libpthread +librt +zlib +libdbi
+  TITLE:=A powerful syslog daemon
+  URL:=http://www.balabit.com/network-security/syslog-ng/opensource-logging-system/
+endef
+
+define Package/syslog-ng3/description
+  syslog-ng reads and logs messages to the system console, log
+  files, other machines and/or users as specified by its
+  configuration file.
+endef
+
+define Package/syslog-ng3/conffiles
+/etc/syslog-ng.conf
+endef
+
+define Build/Configure
+       $(SED) 's,-I/usr/include,,' $(PKG_BUILD_DIR)/configure
+       $(Build/Configure/Default)
+endef
+
+CONFIGURE_ARGS +=  \
+       $(call autoconf_bool,CONFIG_IPV6,ipv6) \
+       --disable-dependency-tracking \
+       --enable-tcp-wrapper \
+       --disable-glibtest \
+       --disable-spoof-source \
+       --disable-sql \
+       --enable-prce \
+       --disable-linux-caps \
+
+TARGET_CPPFLAGS += \
+       -I$(STAGING_DIR)/usr/include/eventlog
+
+CONFIGURE_VARS += \
+       LIBDBI_CFLAGS="-I$(STAGING_DIR)/usr/include"
+
+define Package/syslog-ng3/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/syslog-ng $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/syslog-ng.init $(1)/etc/init.d/syslog-ng
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc
+endef
+
+$(eval $(call BuildPackage,syslog-ng3))
diff --git a/admin/syslog-ng3/files/syslog-ng.conf b/admin/syslog-ng3/files/syslog-ng.conf
new file mode 100644 (file)
index 0000000..972848c
--- /dev/null
@@ -0,0 +1,37 @@
+@version:3.0
+
+options {
+       chain_hostnames(no);
+       create_dirs(yes);
+       flush_lines(0);
+       keep_hostname(yes);
+       log_fifo_size(256);
+       log_msg_size(1024);
+       stats_freq(0);
+       flush_lines(0);
+       use_fqdn(no);
+};
+
+source src {
+       internal();
+       unix-stream("/dev/log");
+};
+
+source net {
+       udp(ip(0.0.0.0) port(514));
+};
+
+source kernel {
+        file("/proc/kmsg" program_override("kernel"));
+};
+
+destination messages {
+       file("/var/log/messages");
+};
+
+log {
+       source(src);
+       source(net);
+        source(kernel);
+       destination(messages);
+};
diff --git a/admin/syslog-ng3/files/syslog-ng.init b/admin/syslog-ng3/files/syslog-ng.init
new file mode 100644 (file)
index 0000000..a8bad3d
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       [ -f /etc/syslog-ng.conf ] || return 1
+       service_start /usr/sbin/syslog-ng
+}
+
+stop() {
+       service_stop /usr/sbin/syslog-ng
+}
+
+reload() {
+       service_reload /usr/sbin/syslog-ng
+}
diff --git a/devel/build-essential/Makefile b/devel/build-essential/Makefile
new file mode 100644 (file)
index 0000000..37bffb6
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# blogic@openwrt.org
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=build-essential
+PKG_RELEASE:=1
+PKG_VERSION:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/build-essential
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=Build essentials
+  DEPENDS=+gcc +make +binutils +patch +diffutils @NO_STRIP
+  PKGARCH:=all
+endef
+
+define Build/Compile
+
+endef
+
+define Package/build-essential/install
+    cp -r ./files/* $(1)
+endef
+
+$(eval $(call BuildPackage,build-essential))
diff --git a/devel/build-essential/files/usr/src/hello/hello.c b/devel/build-essential/files/usr/src/hello/hello.c
new file mode 100644 (file)
index 0000000..e693fd8
--- /dev/null
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+       printf("Hello OpenWrt\n");
+
+       return 0;
+}
diff --git a/devel/cppunit/Makefile b/devel/cppunit/Makefile
new file mode 100644 (file)
index 0000000..91b74e6
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 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:=cppunit
+PKG_VERSION:=1.12.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/cppunit
+PKG_MD5SUM:=bd30e9cf5523cdfc019b94f5e1d7fd19
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cppunit
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=Unit Testing Library for C++
+  URL:=http://cppunit.sourceforge.net/
+  DEPENDS:=+libstdcpp
+endef
+
+define Package/cppunit/description
+  Unit Testing Library for C++
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/cppunit
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/cppunit $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcppunit*so* $(1)/usr/lib/
+endef
+
+define Package/cppunit/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcppunit*so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,cppunit))
diff --git a/devel/diffutils/Makefile b/devel/diffutils/Makefile
new file mode 100644 (file)
index 0000000..05cd360
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2008-2012 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:=diffutils
+PKG_VERSION:=3.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/diffutils
+PKG_MD5SUM:=684aaba1baab743a2a90e52162ff07da
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/diffutils
+  SECTION:=devel
+  CATEGORY:=Development
+  DEPENDS:=+USE_EGLIBC:librt
+  TITLE:=diffutils
+  URL:=http://www.gnu.org/software/diffutils/
+endef
+
+define Package/diffutils/description
+  The Diffutils package contains programs that show the differences between
+  files or directories.
+endef
+
+CONFIGURE_VARS += \
+       ac_cv_func_mempcpy=n \
+
+define Package/diffutils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sdiff,diff3,diff,cmp} $(1)/usr/bin/
+endef
+
+define Package/diffutils/preinst
+#!/bin/sh
+for x in sdiff diff3 diff cmp; do
+  [ -L "$${IPKG_INSTROOT}/usr/bin/$$x" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/$$x"
+done
+exit 0
+endef
+
+define Package/diffutils/postrm
+#!/bin/sh
+for x in sdiff diff3 diff cmp; do
+  /bin/busybox $$x -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/$$x
+done
+exit 0
+endef
+
+$(eval $(call BuildPackage,diffutils))
diff --git a/devel/dmalloc/Makefile b/devel/dmalloc/Makefile
new file mode 100644 (file)
index 0000000..9e3e664
--- /dev/null
@@ -0,0 +1,78 @@
+#
+# Copyright (C) 2006-2010 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:=dmalloc
+PKG_VERSION:=5.5.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://dmalloc.com/releases/
+PKG_MD5SUM:=f92e5606c23a8092f3d5694e8d1c932e
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dmalloc/Default
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=Dmalloc
+  URL:=http://www.dmalloc.com/
+endef
+
+define Package/libdmalloc
+  $(call Package/dmalloc/Default)
+  TITLE+= (library)
+  DEPENDS:=@USE_EGLIBC
+endef
+
+define Package/dmalloc-utils
+  $(call Package/dmalloc/Default)
+  DEPENDS:=+libdmalloc
+  TITLE+= (utilities)
+endef
+
+define Package/dmalloc/description
+The debug memory allocation or dmalloc library has been designed as a drop in
+replacement for the system's malloc, realloc, calloc, free and other memory
+management routines while providing powerful debugging facilities configurable
+at runtime. These facilities include such things as memory-leak tracking,
+fence-post write detection, file/line number reporting, and general logging of
+statistics.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-cxx \
+       --with-pagesize=12
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_INSTALL_FLAGS += installsl
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/dmalloc.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libdmalloc.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libdmalloc/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libdmalloc.so* $(1)/usr/lib/
+endef
+
+define Package/dmalloc-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dmalloc $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libdmalloc))
+$(eval $(call BuildPackage,dmalloc-utils))
diff --git a/devel/dmalloc/patches/100-configure_pagesize.patch b/devel/dmalloc/patches/100-configure_pagesize.patch
new file mode 100644 (file)
index 0000000..0482d7a
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/configure
++++ b/configure
+@@ -857,6 +857,11 @@ Optional Features:
+    --enable-threads        build in thread support (disabled by default)
+    --enable-shlib          build shared libraries (disabled by default)
++Optional Packages:
++  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
++  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
++  --with-pagesize=nbits   log base 2 of machine page size
++
+ Some influential environment variables:
+   CC          C compiler command
+   CFLAGS      C compiler flags
+@@ -5307,6 +5312,14 @@ done
+ echo "$as_me:$LINENO: checking basic-block size" >&5
+ echo $ECHO_N "checking basic-block size... $ECHO_C" >&6
+ ac_cv_page_size=0
++
++# Check whether --with-pagesize or --without-pagesize was given.
++if test "${with_pagesize+set}" = set; then
++  withval="$with_pagesize"
++  case "$withval" in ?|1?) ac_cv_page_size=$withval; esac
++else
++  : # default to probing, set above
++fi;
+ if test $ac_cv_page_size = 0; then
+    if test "$cross_compiling" = yes; then
+   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+--- a/configure.ac
++++ b/configure.ac
+@@ -349,6 +349,12 @@ AC_MSG_RESULT([$ac_cv_use_mmap])
+ AC_CHECK_FUNCS(getpagesize)
+ AC_MSG_CHECKING([basic-block size])
+ ac_cv_page_size=0
++AC_ARG_WITH(pagesize,
++    [ AC_HELP_STRING([--with-pagesize=nbits],
++              [log base 2 of machine page size] ) ],
++    [ case "$withval" in ?|1?) ac_cv_page_size=$withval; esac ],
++    [ : # default to probing, set above ],
++)
+ if test $ac_cv_page_size = 0; then
+    AC_RUN_IFELSE([main() { if (getpagesize()<=2048) exit(0); else exit(1); }],
+       [ ac_cv_page_size=11 ] )
diff --git a/devel/dmalloc/patches/110-configure_cxx.patch b/devel/dmalloc/patches/110-configure_cxx.patch
new file mode 100644 (file)
index 0000000..4a2e8d7
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -56,10 +56,11 @@ AC_PROG_CC
+ AC_PROG_CXX
+ # see if we actually have a CXX program
+-if test "$ac_cv_prog_CXX" = "" -o ! -x "$ac_cv_prog_CXX"; then
+-    AC_MSG_WARN(could not find C++ compiler $ac_cv_prog_CXX)
+-    enable_cxx=no
+-fi
++# FIXME: always returns no
++#if test "$ac_cv_prog_CXX" = "" -o ! -x "$ac_cv_prog_CXX"; then
++#    AC_MSG_WARN(could not find C++ compiler $ac_cv_prog_CXX)
++#    enable_cxx=no
++#fi
+ # hopefully we have a stdc c-compiler
+ if test "$ac_cv_prog_cc_stdc" = "no" ; then
+--- a/configure
++++ b/configure
+@@ -2648,11 +2648,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ # see if we actually have a CXX program
+-if test "$ac_cv_prog_CXX" = "" -o ! -x "$ac_cv_prog_CXX"; then
+-    { echo "$as_me:$LINENO: WARNING: could not find C++ compiler $ac_cv_prog_CXX" >&5
+-echo "$as_me: WARNING: could not find C++ compiler $ac_cv_prog_CXX" >&2;}
+-    enable_cxx=no
+-fi
++# FIXME: always returns no
++#if test "$ac_cv_prog_CXX" = "" -o ! -x "$ac_cv_prog_CXX"; then
++#    { echo "$as_me:$LINENO: WARNING: could not find C++ compiler $ac_cv_prog_CXX" >&5
++#echo "$as_me: WARNING: could not find C++ compiler $ac_cv_prog_CXX" >&2;}
++#    enable_cxx=no
++#fi
+ # hopefully we have a stdc c-compiler
+ if test "$ac_cv_prog_cc_stdc" = "no" ; then
diff --git a/devel/dmalloc/patches/120-makefile_shared.patch b/devel/dmalloc/patches/120-makefile_shared.patch
new file mode 100644 (file)
index 0000000..1fd6ae4
--- /dev/null
@@ -0,0 +1,305 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -41,7 +41,7 @@ LIBRARY      = lib$(MODULE).a
+ # thread version of the library
+ LIB_TH        = lib$(MODULE)th.a
+-LIB_TH_SL = lib$(MODULE)th.@shlibext@
++LIB_TH_SL = lib$(MODULE)th.@shlibext@.5.5.2
+ @TH_ON@BUILD_ALL_1 = threads
+ @TH_ON@INSTALL_LIB_1 = installth
+ @SL_ON@BUILD_THREADS_1 = $(LIB_TH_SL)
+@@ -50,8 +50,8 @@ LIB_TH_SL = lib$(MODULE)th.@shlibext@
+ @TH_ON@@SL_ON@INSTALL_LIB_2 = installthsl
+ # C++ version of the library
+-LIB_CXX       = lib$(MODULE)xx.a
+-LIB_CXX_SL = lib$(MODULE)xx.@shlibext@
++LIB_CXX       = lib$(MODULE)cxx.a
++LIB_CXX_SL = lib$(MODULE)cxx.@shlibext@.5.5.2
+ @CXX_ON@BUILD_ALL_3 = $(LIB_CXX)
+ @CXX_ON@INSTALL_LIB_3 = installcxx
+ @SL_ON@BUILD_CXX_3 = $(LIB_CXX_SL)
+@@ -61,7 +61,7 @@ LIB_CXX_SL = lib$(MODULE)xx.@shlibext@
+ # threads + C++
+ LIB_TH_CXX = lib$(MODULE)thcxx.a
+-LIB_TH_CXX_SL = lib$(MODULE)thcxx.@shlibext@
++LIB_TH_CXX_SL = lib$(MODULE)thcxx.@shlibext@.5.5.2
+ @TH_ON@@CXX_ON@BUILD_ALL_5 = $(LIB_TH_CXX)
+ @TH_ON@@CXX_ON@INSTALL_LIB_5 = installthcxx
+ @TH_ON@BUILD_CXX_5 = $(LIB_TH_CXX)
+@@ -76,7 +76,7 @@ LIB_TH_CXX_SL = lib$(MODULE)thcxx.@shlib
+ @CXX_ON@@SL_ON@INSTALL_THREADS_6 = installthcxxsl
+ # shared versions of the libraries
+-LIB_SL = lib$(MODULE).@shlibext@
++LIB_SL = lib$(MODULE).@shlibext@.5.5.2
+ @SL_ON@BUILD_ALL_7 = $(LIB_SL)
+ @SL_ON@INSTALL_LIB_7 = installsl
+ @SL_ON@BUILD_TH_CXX_7 = $(LIB_TH_CXX_SL)
+@@ -145,9 +145,13 @@ SHELL = /bin/sh
+ HFLS = dmalloc.h
+ OBJS = arg_check.o compat.o dmalloc_rand.o dmalloc_tab.o env.o heap.o
++OBJS_SL = arg_check_sl.o compat_sl.o dmalloc_rand_sl.o dmalloc_tab_sl.o env_sl.o heap_sl.o
+ NORMAL_OBJS = chunk.o error.o malloc.o
++NORMAL_OBJS_SL = chunk_sl.o error_sl.o malloc_sl.o
+ THREAD_OBJS = chunk_th.o error_th.o malloc_th.o
++THREAD_OBJS_SL = chunk_th_sl.o error_th_sl.o malloc_th_sl.o
+ CXX_OBJS = dmallocc.o
++CXX_OBJS_SL = dmallocc_sl.o
+ CFLAGS = $(CCFLAGS)
+ TEST = $(MODULE)_t
+@@ -160,9 +164,9 @@ all : $(BUILD_ALL)
+ clean :
+       rm -f $(A_OUT) core *.o *.t
+-      rm -f $(LIBRARY) $(LIB_TH) $(LIB_CXX) $(LIB_TH_CXX) $(TEST) $(TEST_FC)
+-      rm -f $(LIB_TH_SL) $(LIB_CXX_SL) $(LIB_TH_CXX_SL) $(LIB_SL)
++      rm -f $(TEST) $(TEST_FC)
+       rm -f $(UTIL) dmalloc.h
++      rm -f lib$(MODULE)*.*
+ realclean : clean
+@@ -181,43 +185,43 @@ installincs : $(HFLS)
+       $(INSTALL_DATA) $(HFLS) $(includedir)
+ installthsl : $(LIB_TH_SL)
+-      $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL_PROGRAM) $(LIB_TH_SL) $(libdir)
++      $(srcdir)/mkinstalldirs $(shlibdir)
++      $(INSTALL) $(LIB_TH_SL) $(shlibdir)
+ installth : $(INSTALL_THREADS)
+       $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL_PROGRAM) $(LIB_TH) $(libdir)
++      $(INSTALL) $(LIB_TH) $(libdir)
+ @CXX_OFF@     @echo "Enter 'make installthcxx' to install the threaded C++ library"
+ @SL_OFF@      @echo "Enter 'make installthsl' to install the threaded shared-library"
+ installthcxxsl : $(LIB_TH_CXX_SL)
+       $(srcdir)/mkinstalldirs $(shlibdir)
+-      $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(shlibdir)
++      $(INSTALL) $(LIB_TH_CXX_SL) $(shlibdir)
+ installthcxx : $(INSTALL_TH_CXX)
+       $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(libdir)
++      $(INSTALL) $(LIB_TH_CXX) $(libdir)
+ @SL_OFF@      @echo "Enter 'make installthcxxsl' to install the threaded C++ shared-library"
+ installcxxsl : $(LIB_CXX_SL)
+-      $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(libdir)
++      $(srcdir)/mkinstalldirs $(shlibdir)
++      $(INSTALL) $(LIB_CXX_SL) $(shlibdir)
+ installcxx : $(INSTALL_CXX)
+       $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL_PROGRAM) $(LIB_CXX) $(libdir)
++      $(INSTALL) $(LIB_CXX) $(libdir)
+ @TH_OFF@      @echo "Enter 'make installthcxx' to install the threaded C++ library"
+ @SL_OFF@      @echo "Enter 'make installcxxsl' to install the C++ shared-library"
+ installsl : $(LIB_SL)
+       $(srcdir)/mkinstalldirs $(shlibdir)
+-      $(INSTALL_PROGRAM) $(LIB_SL) $(shlibdir)
++      $(INSTALL) $(LIB_SL) $(shlibdir)
+ @CXX_OFF@     @echo "Enter 'make installcxxsl' to install the C++ shared-library"
+ @TH_OFF@      @echo "Enter 'make installthsl' to install thread shared-library"
+ installlib : $(INSTALL_LIB)
+       $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL_PROGRAM) $(LIBRARY) $(libdir)
++      $(INSTALL) $(LIBRARY) $(libdir)
+       @RANLIB@ $(libdir)/$(LIBRARY)
+ @SL_OFF@      @echo "Enter 'make installsl' to install $(LIB_SL) in $(shlibdir)"
+ @CXX_OFF@     @echo "Enter 'make installcxx' to install the C++ library"
+@@ -255,10 +259,8 @@ shlib : $(BUILD_SL)
+ # NOTE: you may have to edit the configure.ac script to get this to
+ # work on your operating system.  Please send feedback to the author
+ # via: http://256.com/gray/email.html
+-$(LIB_SL) : $(LIBRARY)
+-      rm -f $@ $@.t
+-      @shlinkargs@ $(LIBRARY) $(OBJS) $(NORMAL_OBJS)
+-      mv $@.t $@
++$(LIB_SL) : $(OBJS_SL) $(NORMAL_OBJS_SL)
++      $(CC) -shared -Wl,-soname,libdmalloc.so.5 -o $@ $(OBJS_SL) $(NORMAL_OBJS_SL)
+ $(LIBRARY) : $(OBJS) $(NORMAL_OBJS)
+       ar cr $@ $?
+@@ -268,32 +270,26 @@ $(LIB_TH) : $(OBJS) $(THREAD_OBJS)
+       ar cr $@ $?
+       @RANLIB@ $@
+-$(LIB_TH_SL) : $(LIB_TH)
+-      rm -f $@ $@.t
+-      @shlinkargs@ $(LIB_TH) $(OBJS) $(THREAD_OBJS)
+-      mv $@.t $@
++$(LIB_TH_SL) : $(OBJS_SL) $(THREAD_OBJS_SL)
++      $(CC) -shared -Wl,-soname,libdmallocth.so.5 -o $@ $(OBJS_SL) $(THREAD_OBJS_SL)
+ $(LIB_CXX) : $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS)
+       ar cr $@ $?
+       @RANLIB@ $@
+-$(LIB_CXX_SL) : $(LIB_CXX)
+-      rm -f $@ $@.t
+-      @shlinkargs@ $(LIB_CXX) $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS)
+-      mv $@.t $@
++$(LIB_CXX_SL) : $(OBJS_SL) $(NORMAL_OBJS_SL) $(CXX_OBJS_SL)
++      $(CC) -shared -Wl,-soname,libdmalloccxx.so.5 -o $@ $(OBJS_SL) $(NORMAL_OBJS_SL) $(CXX_OBJS_SL)
+ $(LIB_TH_CXX) : $(OBJS) $(THREAD_OBJS) $(CXX_OBJS)
+       ar cr $@ $?
+       @RANLIB@ $@
+-$(LIB_TH_CXX_SL) : $(LIB_TH_CXX)
+-      rm -f $@ $@.t
+-      @shlinkargs@ $(LIB_TH_CXX) $(OBJS) $(THREAD_OBJS) $(CXX_OBJS)
+-      mv $@.t $@
++$(LIB_TH_CXX_SL) : $(OBJS_SL) $(THREAD_OBJS_SL) $(CXX_OBJS_SL)
++      $(CC) -shared -Wl,-soname,libdmallocthcxx.so.5 -o $@ $(OBJS_SL) $(THREAD_OBJS_SL) $(CXX_OBJS_SL)
+-threadssl : $(LIB_TH_SL)
++threadssl : $(LIB_TH_SL)$(ver)
+-threadscxxsl : $(LIB_TH_CXX_SL)
++threadscxxsl : $(LIB_TH_CXX_SL)$(ver)
+ threadscxx : $(BUILD_TH_CXX)
+ @SL_OFF@      @echo "Enter 'make threadscxxsl' to build the threaded C++ shared-library"
+@@ -302,7 +298,7 @@ threads : $(BUILD_THREADS)
+ @CXX_OFF@     @echo "Enter 'make threadscxx' to build the threaded C++ library"
+ @SL_OFF@      @echo "Enter 'make threadssl' to build the threaded shared library"
+-cxxsl :  $(LIB_CXX_SL)
++cxxsl :  $(LIB_CXX_SL)$(ver)
+ cxx : $(BUILD_CXX)
+ @SL_OFF@      @echo "Enter 'make cxxsl' to build the cxx shared library"
+@@ -371,6 +367,11 @@ dmallocc.o : $(srcdir)/dmallocc.cc
+       $(CXX) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCS) -c $(srcdir)/dmallocc.cc \
+               -o ./$@
++dmallocc_sl.o : $(srcdir)/dmallocc.cc
++      rm -f $@
++      $(CXX) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $(srcdir)/dmallocc.cc \
++              -o ./$@
++
+ #
+ # auto configure settings - uncomment if you are doing configure
+ # development on the library
+@@ -395,38 +396,109 @@ dmallocc.o : $(srcdir)/dmallocc.cc
+ arg_check.o: arg_check.c conf.h settings.h dmalloc.h chunk.h debug_tok.h \
+   dmalloc_loc.h error.h arg_check.h
++arg_check_sl.o: arg_check.c conf.h settings.h dmalloc.h chunk.h debug_tok.h \
++  dmalloc_loc.h error.h arg_check.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ chunk.o: chunk.c conf.h settings.h dmalloc.h chunk.h chunk_loc.h \
+   dmalloc_loc.h compat.h debug_tok.h dmalloc_rand.h dmalloc_tab.h error.h \
+   error_val.h heap.h
++chunk_sl.o: chunk.c conf.h settings.h dmalloc.h chunk.h chunk_loc.h \
++  dmalloc_loc.h compat.h debug_tok.h dmalloc_rand.h dmalloc_tab.h error.h \
++  error_val.h heap.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ compat.o: compat.c conf.h settings.h dmalloc.h compat.h dmalloc_loc.h
++compat_sl.o: compat.c conf.h settings.h dmalloc.h compat.h dmalloc_loc.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ dmalloc.o: dmalloc.c conf.h settings.h dmalloc_argv.h dmalloc.h compat.h \
+   debug_tok.h dmalloc_loc.h env.h error_val.h version.h
++dmalloc_sl.o: dmalloc.c conf.h settings.h dmalloc_argv.h dmalloc.h compat.h \
++  debug_tok.h dmalloc_loc.h env.h error_val.h version.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ dmalloc_argv.o: dmalloc_argv.c conf.h settings.h dmalloc_argv.h \
+   dmalloc_argv_loc.h compat.h
++dmalloc_argv_sl.o: dmalloc_argv.c conf.h settings.h dmalloc_argv.h \
++  dmalloc_argv_loc.h compat.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ dmalloc_fc_t.o: dmalloc_fc_t.c conf.h settings.h dmalloc.h dmalloc_argv.h \
+   dmalloc_rand.h debug_tok.h dmalloc_loc.h error_val.h
++dmalloc_fc_t_sl.o: dmalloc_fc_t.c conf.h settings.h dmalloc.h dmalloc_argv.h \
++  dmalloc_rand.h debug_tok.h dmalloc_loc.h error_val.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ dmalloc_rand.o: dmalloc_rand.c dmalloc_rand.h
++dmalloc_rand_sl.o: dmalloc_rand.c dmalloc_rand.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ dmalloc_t.o: dmalloc_t.c conf.h settings.h compat.h dmalloc.h \
+   dmalloc_argv.h dmalloc_rand.h arg_check.h debug_tok.h dmalloc_loc.h \
+   error_val.h heap.h
++dmalloc_t_sl.o: dmalloc_t.c conf.h settings.h compat.h dmalloc.h \
++  dmalloc_argv.h dmalloc_rand.h arg_check.h debug_tok.h dmalloc_loc.h \
++  error_val.h heap.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ dmalloc_tab.o: dmalloc_tab.c conf.h settings.h chunk.h compat.h dmalloc.h \
+   dmalloc_loc.h error.h error_val.h dmalloc_tab.h dmalloc_tab_loc.h
++dmalloc_tab_sl.o: dmalloc_tab.c conf.h settings.h chunk.h compat.h dmalloc.h \
++  dmalloc_loc.h error.h error_val.h dmalloc_tab.h dmalloc_tab_loc.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ env.o: env.c conf.h settings.h dmalloc.h compat.h dmalloc_loc.h \
+   debug_tok.h env.h error.h
++env_sl.o: env.c conf.h settings.h dmalloc.h compat.h dmalloc_loc.h \
++  debug_tok.h env.h error.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ error.o: error.c conf.h settings.h dmalloc.h chunk.h compat.h debug_tok.h \
+   dmalloc_loc.h env.h error.h error_val.h version.h
++error_sl.o: error.c conf.h settings.h dmalloc.h chunk.h compat.h debug_tok.h \
++  dmalloc_loc.h env.h error.h error_val.h version.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ heap.o: heap.c conf.h settings.h dmalloc.h chunk.h compat.h debug_tok.h \
+   dmalloc_loc.h error.h error_val.h heap.h
++heap_sl.o: heap.c conf.h settings.h dmalloc.h chunk.h compat.h debug_tok.h \
++  dmalloc_loc.h error.h error_val.h heap.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ malloc.o: malloc.c conf.h settings.h dmalloc.h chunk.h compat.h \
+   debug_tok.h dmalloc_loc.h env.h error.h error_val.h heap.h \
+   malloc_funcs.h return.h
++malloc_sl.o: malloc.c conf.h settings.h dmalloc.h chunk.h compat.h \
++  debug_tok.h dmalloc_loc.h env.h error.h error_val.h heap.h \
++  malloc_funcs.h return.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ protect.o: protect.c conf.h settings.h dmalloc.h dmalloc_loc.h error.h \
+   heap.h protect.h
++protect_sl.o: protect.c conf.h settings.h dmalloc.h dmalloc_loc.h error.h \
++  heap.h protect.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ chunk_th.o: chunk.c conf.h settings.h dmalloc.h chunk.h chunk_loc.h \
+   dmalloc_loc.h compat.h debug_tok.h dmalloc_rand.h dmalloc_tab.h error.h \
+   error_val.h heap.h
++chunk_th_sl.o: chunk.c conf.h settings.h dmalloc.h chunk.h chunk_loc.h \
++  dmalloc_loc.h compat.h debug_tok.h dmalloc_rand.h dmalloc_tab.h error.h \
++  error_val.h heap.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ error_th.o: error.c conf.h settings.h dmalloc.h chunk.h compat.h debug_tok.h \
+   dmalloc_loc.h env.h error.h error_val.h version.h
++error_th_sl.o: error.c conf.h settings.h dmalloc.h chunk.h compat.h debug_tok.h \
++  dmalloc_loc.h env.h error.h error_val.h version.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
+ malloc_th.o: malloc.c conf.h settings.h dmalloc.h chunk.h compat.h \
+   debug_tok.h dmalloc_loc.h env.h error.h error_val.h heap.h \
+   malloc_funcs.h return.h
++malloc_th_sl.o: malloc.c conf.h settings.h dmalloc.h chunk.h compat.h \
++  debug_tok.h dmalloc_loc.h env.h error.h error_val.h heap.h \
++  malloc_funcs.h return.h
++      rm -f $@
++      $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) $(DEFS) $(INCS) -c $< -o ./$@
diff --git a/devel/dmalloc/patches/130-makefile_destdir.patch b/devel/dmalloc/patches/130-makefile_destdir.patch
new file mode 100644 (file)
index 0000000..88a2da9
--- /dev/null
@@ -0,0 +1,97 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -178,66 +178,66 @@ distclean : clean
+ #     rm -f configure
+ installdirs :
+-      $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(bindir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(includedir) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
+ installincs : $(HFLS)
+-      $(srcdir)/mkinstalldirs $(includedir)
+-      $(INSTALL_DATA) $(HFLS) $(includedir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(includedir)
++      $(INSTALL_DATA) $(HFLS) $(DESTDIR)$(includedir)
+ installthsl : $(LIB_TH_SL)
+-      $(srcdir)/mkinstalldirs $(shlibdir)
+-      $(INSTALL) $(LIB_TH_SL) $(shlibdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(shlibdir)
++      $(INSTALL) $(LIB_TH_SL) $(DESTDIR)$(shlibdir)
+ installth : $(INSTALL_THREADS)
+-      $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL) $(LIB_TH) $(libdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
++      $(INSTALL) $(LIB_TH) $(DESTDIR)$(libdir)
+ @CXX_OFF@     @echo "Enter 'make installthcxx' to install the threaded C++ library"
+ @SL_OFF@      @echo "Enter 'make installthsl' to install the threaded shared-library"
+ installthcxxsl : $(LIB_TH_CXX_SL)
+-      $(srcdir)/mkinstalldirs $(shlibdir)
+-      $(INSTALL) $(LIB_TH_CXX_SL) $(shlibdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(shlibdir)
++      $(INSTALL) $(LIB_TH_CXX_SL) $(DESTDIR)$(shlibdir)
+ installthcxx : $(INSTALL_TH_CXX)
+-      $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL) $(LIB_TH_CXX) $(libdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
++      $(INSTALL) $(LIB_TH_CXX) $(DESTDIR)$(libdir)
+ @SL_OFF@      @echo "Enter 'make installthcxxsl' to install the threaded C++ shared-library"
+ installcxxsl : $(LIB_CXX_SL)
+-      $(srcdir)/mkinstalldirs $(shlibdir)
+-      $(INSTALL) $(LIB_CXX_SL) $(shlibdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(shlibdir)
++      $(INSTALL) $(LIB_CXX_SL) $(DESTDIR)$(shlibdir)
+ installcxx : $(INSTALL_CXX)
+-      $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL) $(LIB_CXX) $(libdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
++      $(INSTALL) $(LIB_CXX) $(DESTDIR)$(libdir)
+ @TH_OFF@      @echo "Enter 'make installthcxx' to install the threaded C++ library"
+ @SL_OFF@      @echo "Enter 'make installcxxsl' to install the C++ shared-library"
+ installsl : $(LIB_SL)
+-      $(srcdir)/mkinstalldirs $(shlibdir)
+-      $(INSTALL) $(LIB_SL) $(shlibdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(shlibdir)
++      $(INSTALL) $(LIB_SL) $(DESTDIR)$(shlibdir)
+ @CXX_OFF@     @echo "Enter 'make installcxxsl' to install the C++ shared-library"
+ @TH_OFF@      @echo "Enter 'make installthsl' to install thread shared-library"
+ installlib : $(INSTALL_LIB)
+-      $(srcdir)/mkinstalldirs $(libdir)
+-      $(INSTALL) $(LIBRARY) $(libdir)
+-      @RANLIB@ $(libdir)/$(LIBRARY)
+-@SL_OFF@      @echo "Enter 'make installsl' to install $(LIB_SL) in $(shlibdir)"
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
++      $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)
++      @RANLIB@ $(DESTDIR)$(libdir)/$(LIBRARY)
++@SL_OFF@      @echo "Enter 'make installsl' to install $(LIB_SL) in $(DESTDIR)$(shlibdir)"
+ @CXX_OFF@     @echo "Enter 'make installcxx' to install the C++ library"
+ @TH_OFF@      @echo "Enter 'make installth' to install thread library"
+ installdocs : $(srcdir)/docs/$(HTMLFILE) $(srcdir)/docs/$(TEXIFILE) \
+               $(srcdir)/docs/$(PDFFILE)
+-      $(srcdir)/mkinstalldirs $(docdir)
+-      $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(docdir)
+-      $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(docdir)
+-      $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(docdir)
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(docdir)
++      $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(DESTDIR)$(docdir)
++      $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(DESTDIR)$(docdir)
++      $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(DESTDIR)$(docdir)
+ install : installincs installlib $(UTIL)
+-      $(srcdir)/mkinstalldirs $(bindir)
+-      $(INSTALL_PROGRAM) $(UTIL) $(bindir)
+-      @echo "Enter 'make installdocs' to install $(DOCFILES) in $(docdir)"
++      $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
++      $(INSTALL_PROGRAM) $(UTIL) $(DESTDIR)$(bindir)
++      @echo "Enter 'make installdocs' to install $(DOCFILES) in $(DESTDIR)$(docdir)"
+ dmalloc.h.2 : $(srcdir)/configure
+       $(SHELL) $(srcdir)/configure
diff --git a/devel/dmalloc/patches/200-fix_return_address.patch b/devel/dmalloc/patches/200-fix_return_address.patch
new file mode 100644 (file)
index 0000000..0fb35e4
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/configure
++++ b/configure
+@@ -7120,7 +7120,7 @@ echo "$as_me:$LINENO: checking return.h
+ echo $ECHO_N "checking return.h macros work... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+    cat >>confdefs.h <<\_ACEOF
+-#define RETURN_MACROS_WORK 0
++#define RETURN_MACROS_WORK 1
+ _ACEOF
+  echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6
+--- a/return.h
++++ b/return.h
+@@ -106,25 +106,19 @@
+ /*************************************/
+ /*
+- * For DEC Mips machines running Ultrix
++ * For Mips machines running Linux
+  */
+ #if __mips
+ /*
+- * I have no idea how to get inline assembly with the default cc.
+- * Anyone know how?
+- */
+-
+-#if 0
+-
+-/*
+  * NOTE: we assume here that file is global.
+  *
+- * $31 is the frame pointer.  $2 looks to be the return address but maybe
+- * not consistently.
++ * $31 is the return address.
+  */
+-#define GET_RET_ADDR(file)    asm("sw $2, file")
+-
++#if (_MIPS_SZLONG == 32)
++#define GET_RET_ADDR(file)    asm("sw $31, %0" : "=m" (file))
++#else
++#define GET_RET_ADDR(file)    asm("sd $31, %0" : "=m" (file))
+ #endif
+ #endif /* __mips */
diff --git a/devel/dmalloc/patches/210-fix_threads.patch b/devel/dmalloc/patches/210-fix_threads.patch
new file mode 100644 (file)
index 0000000..c3cbd90
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/settings.dist
++++ b/settings.dist
+@@ -409,7 +409,7 @@
+  */
+ #ifndef LOCK_THREADS
+-#define LOCK_THREADS 0
++#define LOCK_THREADS 1
+ #endif
+ #if LOCK_THREADS
diff --git a/devel/dmalloc/patches/300-fix_summarize_script.patch b/devel/dmalloc/patches/300-fix_summarize_script.patch
new file mode 100644 (file)
index 0000000..d50106d
--- /dev/null
@@ -0,0 +1,8 @@
+--- a/contrib/dmalloc_summarize.pl
++++ b/contrib/dmalloc_summarize.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl5 -w
++#!/usr/bin/perl -w
+ #
+ # dmalloc_summarize -- summarizes dmalloc log files
+ #
diff --git a/devel/dmalloc/patches/400-undef-strndup.patch b/devel/dmalloc/patches/400-undef-strndup.patch
new file mode 100644 (file)
index 0000000..e7141ed
--- /dev/null
@@ -0,0 +1,10 @@
+--- dmalloc-5.5.2/dmalloc.h.3  2012-04-11 22:59:21.624323311 +0200
++++ dmalloc-5.5.2.mod/dmalloc.h.3      2012-04-11 23:00:53.612325497 +0200
+@@ -405,6 +405,7 @@
+  *
+  * string -> String we are duplicating.
+  */
++#undef strdup
+ extern
+ char  *strdup(const char *string);
+ #endif /* ifndef DMALLOC_STRDUP_MACRO */
diff --git a/devel/electric-fence/Makefile b/devel/electric-fence/Makefile
new file mode 100644 (file)
index 0000000..1153350
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2008-2010 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:= electric-fence
+PKG_VERSION:=2.1.13
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)-0.1.tar.gz
+PKG_SOURCE_URL:=http://perens.com/FreeSoftware/ElectricFence
+PKG_MD5SUM:=59e4e7817a30aff52d8971ce00e1ad35
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/electric-fence
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=electric-fence
+  URL:=http://perens.com/FreeSoftware/ElectricFence/
+  DEPENDS:=@USE_EGLIBC
+  MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
+endef
+
+TARGET_CFLAGS += -fPIC
+TARGET_LDFLAGS += -lpthread
+
+define Build/Compile
+       rm -f $(PKG_BUILD_DIR)/libefence.so $(PKG_BUILD_DIR)/libefence.a
+       $(TARGET_CC) $(TARGET_CFLAGS) -c $(PKG_BUILD_DIR)/efence.c -o $(PKG_BUILD_DIR)/efence.o
+       $(TARGET_CC) $(TARGET_CFLAGS) -c $(PKG_BUILD_DIR)/page.c -o $(PKG_BUILD_DIR)/page.o
+       $(TARGET_CC) $(TARGET_CFLAGS) -c $(PKG_BUILD_DIR)/print.c -o $(PKG_BUILD_DIR)/print.o
+       $(TARGET_CC) -shared $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/libefence.so $(PKG_BUILD_DIR)/efence.o $(PKG_BUILD_DIR)/page.o $(PKG_BUILD_DIR)/print.o
+       $(AR) crv $(LD_FLAGS) $(PKG_BUILD_DIR)/libefence.a $(PKG_BUILD_DIR)/efence.o $(PKG_BUILD_DIR)/page.o $(PKG_BUILD_DIR)/print.o
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+
+       $(INSTALL_DATA) \
+               $(PKG_BUILD_DIR)/libefence.so \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_BUILD_DIR)/libefence.a \
+               $(1)/usr/lib/
+endef
+
+define Package/electric-fence/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+
+       $(INSTALL_DATA) \
+               $(PKG_BUILD_DIR)/libefence.so \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,electric-fence))
diff --git a/devel/gcc/Makefile b/devel/gcc/Makefile
new file mode 100644 (file)
index 0000000..3f69a21
--- /dev/null
@@ -0,0 +1,90 @@
+#
+# Copyright (C) 2008 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:=gcc
+PKG_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
+PKG_RELEASE:=1
+PATCH_DIR=$(TOPDIR)/toolchain/gcc/patches/$(PKG_VERSION)
+PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
+    http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
+           ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=354853e0b2da90c527e35aabb8d6f1e6
+
+include $(INCLUDE_DIR)/package.mk
+
+SEP:=,
+TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
+EXTRA_TARGET=$(if $(CONFIG_EXTRA_TARGET_ARCH),--enable-biarch --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-uclibc)
+
+define Package/gcc
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=gcc
+  DEPENDS:=@TARGET_x86 @NO_STRIP
+endef
+
+define Package/gcc/description
+       build a native toolchain for compiling on target
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(PKG_BUILD_DIR)/gcc/version.c
+       $(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(PKG_BUILD_DIR)/gcc/version.c
+       (cd $(PKG_BUILD_DIR)/libstdc++-v3; autoconf;);
+       $(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(PKG_BUILD_DIR)/libstdc++-v3/configure
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); rm -f config.cache; \
+               SHELL="$(BASH)" \
+               $(TARGET_CONFIGURE_OPTS) \
+               $(PKG_BUILD_DIR)/configure \
+                       $(TARGET_CONFIGURE_ARGS) \
+                       --build=$(GNU_HOST_NAME) \
+                       --host=$(REAL_GNU_TARGET_NAME) \
+                       --target=$(REAL_GNU_TARGET_NAME) \
+                       --enable-languages=$(TARGET_LANGUAGES) \
+                       --enable-shared \
+                       --disable-__cxa_atexit \
+                       --enable-target-optspace \
+                       --with-gnu-ld \
+                       --disable-nls \
+                       --disable-libmudflap \
+                       --disable-multilib \
+                       $(EXTRA_TARGET) \
+                       $(SOFT_FLOAT_CONFIG_OPTION) \
+                       $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
+       );
+endef
+
+define Build/Compile
+       export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
+                       DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
+       # Set up the symlinks to enable lying about target name.
+       set -e; \
+       (cd $(TOOLCHAIN_DIR); \
+               ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
+               cd bin; \
+               for app in $(REAL_GNU_TARGET_NAME)-* ; do \
+                       ln -sf $$$${app} \
+                       $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
+               done; \
+       );
+endef
+
+define Package/gcc/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       cp -r $(PKG_INSTALL_DIR)/* $(1)
+       cp -r $(TOOLCHAIN_DIR)/include $(1)/usr/
+       cp $(TOOLCHAIN_DIR)/lib/crt* $(1)/usr/lib/
+       cp $(TOOLCHAIN_DIR)/lib/libc.so $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,gcc))
diff --git a/devel/ksymoops/Makefile b/devel/ksymoops/Makefile
new file mode 100644 (file)
index 0000000..1d635e9
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=ksymoops
+PKG_VERSION:=2.4.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/ksymoops/v2.4/
+PKG_MD5SUM:=4a8249e182a5dbc75e566d162e9f3314
+
+PKG_BUILD_DEPENDS:=binutils
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ksymoops
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=@mips||mipsel||m68k||i386 +zlib
+  TITLE:=Interpret oops of the kernel
+  URL:=http://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/
+  MENU:=1
+endef
+
+define Package/kexec-tools/description
+endef
+
+define Build/Configure
+endef
+
+TARGET=$(strip $(shell echo $(TARGET_CFLAGS) | cut -d- -f4 | cut -d= -f2))
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               BFD_PREFIX="$(STAGING_DIR)/usr" \
+               DEF_TARGET='\"$(TARGET)\"' \
+               DEF_ARCH='\"$(ARCH)\"' \
+               DEF_MAP='\"$(LINUX_DIR)/System.map\"' \
+               CROSS="$(TARGET_CROSS)" \
+               INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+               LDFLAGS="-lz" \
+               all install
+endef
+
+define Package/ksymoops/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/$(TARGET_CROSS)ksymoops $(1)/bin/ksymoops
+endef
+
+$(eval $(call BuildPackage,ksymoops))
diff --git a/devel/lttng-tools/Makefile b/devel/lttng-tools/Makefile
new file mode 100644 (file)
index 0000000..cb6703e
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2013 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:=lttng-tools
+PKG_VERSION:=2.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)
+PKG_MD5SUM:=cfc35db9eb2d4ae09a65c006a70204f6
+PKG_FIXUP:=autoreconf
+
+PKG_USE_MIPS16:=0
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lttng-tools
+  SECTION:=devel
+  CATEGORY:=Development
+  DEPENDS:=+lttng-ust +libpopt
+  TITLE:=LTTng tracing tools
+  URL:=https://lttng.org/
+endef
+
+TARGET_LDFLAGS += -lurcu-bp
+
+define Package/lttng-tools/description
+   LTTng Userspace Tracing Library
+endef
+
+define Package/lttng-tools/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lttng $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lttng* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,lttng-tools))
diff --git a/devel/lttng-tools/patches/001-uclibc_sync_file_ranges.patch b/devel/lttng-tools/patches/001-uclibc_sync_file_ranges.patch
new file mode 100644 (file)
index 0000000..e3507b6
--- /dev/null
@@ -0,0 +1,44 @@
+Make sync_file_range() usage optional
+
+Under uClibc, sync_file_range() is not available under all
+architectures, so we fall back to fdatasync() in this case.
+
+Inspired by the patch done by Thomas Petazzoni for the
+2.0-pre25 version.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+---
+ configure.ac              |    2 +-
+ src/common/compat/fcntl.h |    5 +++++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -150,7 +150,7 @@ AS_IF([test "x$lttng_ust_support" = "xye
+       )
+ ])
+ AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
+-AC_CHECK_FUNCS([sched_getcpu sysconf])
++AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
+ # check for dlopen
+ AC_CHECK_LIB([dl], [dlopen],
+@@ -394,4 +394,3 @@ AS_IF([test "x$consumerd_only" = "xno"],
+ ])
+ AS_ECHO()
+-
+--- a/src/common/compat/compat-fcntl.c
++++ b/src/common/compat/compat-fcntl.c
+@@ -23,7 +23,11 @@
+ int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+               unsigned int flags)
+ {
++#ifdef HAVE_SYNC_FILE_RANGE
+       return sync_file_range(fd, offset, nbytes, flags);
++#else
++      return fdatasync(fd);
++#endif
+ }
+ #endif /* __linux__ */
diff --git a/devel/make/Makefile b/devel/make/Makefile
new file mode 100644 (file)
index 0000000..81366af
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2007-2010 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:=make
+PKG_VERSION:=3.81
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=@GNU/make
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=354853e0b2da90c527e35aabb8d6f1e6
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/make
+  SECTION:=devel
+  CATEGORY:=Development
+  DEPENDS:=+libelf1
+  TITLE:=make
+  URL:=http://www.gnu.org/software/make/
+endef
+
+define Package/make/description
+       The Make package contains a program for compiling packages
+endef
+
+define Package/make/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/make $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,make))
diff --git a/devel/perf/Makefile b/devel/perf/Makefile
new file mode 100644 (file)
index 0000000..184e51d
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2011-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=perf
+PKG_VERSION:=$(LINUX_VERSION)
+PKG_RELEASE:=2
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/perf
+  SECTION:=devel
+  CATEGORY:=Development
+  DEPENDS:= +libelf1 +libdw +libpthread +librt +binutils
+  TITLE:=Linux performance monitoring tool
+  VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
+  URL:=http://www.kernel.org
+endef
+
+define Package/perf/description
+  perf is the Linux performance monitoring tool
+endef
+
+# Perf's makefile and headers are not relocatable and must be built from the
+# Linux sources directory
+define Build/Prepare
+       $(RM) -r $(PKG_BUILD_DIR)
+       ln -s $(LINUX_DIR)/tools/perf $(PKG_BUILD_DIR)
+endef
+
+# MAKE_FLAGS should be passed again upon cleaning because Perf's makefile
+# always performs checks before processing any rule
+define Build/Clean
+       -$(MAKE) -C $(PKG_BUILD_DIR) \
+               NO_DWARF=1 \
+               $(MAKE_FLAGS) \
+               clean
+endef
+
+MAKE_FLAGS = \
+       ARCH="$(LINUX_KARCH)" \
+       NO_LIBPERL=1 \
+       NO_LIBPYTHON=1 \
+       NO_NEWT=1 \
+       CROSS_COMPILE="$(TARGET_CROSS)" \
+       CC="$(TARGET_CC)" \
+       LD="$(TARGET_CROSS)ld" \
+       CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       V=1 \
+       prefix=/usr
+
+define Package/perf/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(LINUX_DIR)/tools/perf/perf $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,perf))
diff --git a/devel/sysprof/Makefile b/devel/sysprof/Makefile
new file mode 100644 (file)
index 0000000..25812f4
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2009-2013 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:=sysprof
+PKG_VERSION:=1.2.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://sysprof.com
+PKG_MD5SUM:=a81808d847732f8dafb59d26ec2eebbf
+
+PKG_BUILD_DEPENDS:= glib2
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/sysprof
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=Sysprof System Profiler
+  URL:=http://sysprof.com
+  DEPENDS:=+glib2
+endef
+
+
+define Package/sysprof/description
+       Sysprof is a statistical, system-wide profiler for Linux
+endef
+
+define Package/sysprof/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sysprof-cli $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sysprof))
diff --git a/devel/sysprof/patches/define-NT_GNU_BUILD_ID.patch b/devel/sysprof/patches/define-NT_GNU_BUILD_ID.patch
new file mode 100644 (file)
index 0000000..dcc2cbe
--- /dev/null
@@ -0,0 +1,22 @@
+On uclibc elf.h does not have GNU extentions but we need this define
+so we define it locally if its not getting it from elf.h
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+
+Index: git/elfparser.h
+===================================================================
+--- git.orig/elfparser.h       2011-07-16 18:57:41.000000000 -0700
++++ git/elfparser.h    2011-07-16 20:28:54.733829895 -0700
+@@ -17,6 +17,10 @@
+  */
+ #include <glib.h>
++#ifndef NT_GNU_BUILD_ID
++#define NT_GNU_BUILD_ID 3
++#endif
++
+ typedef struct ElfSym ElfSym;
+ typedef struct ElfParser ElfParser;
diff --git a/devel/sysprof/patches/rmb-arm.patch b/devel/sysprof/patches/rmb-arm.patch
new file mode 100644 (file)
index 0000000..a440348
--- /dev/null
@@ -0,0 +1,21 @@
+
+Upstream-Status: Pending
+
+Index: git/util.h
+===================================================================
+--- git.orig/util.h    2010-12-07 22:41:57.156243001 -0600
++++ git/util.h 2010-12-07 22:43:47.616243002 -0600
+@@ -37,4 +37,13 @@
+ #define cpu_relax()     asm volatile("" ::: "memory");
+ #endif
+
++#ifdef __arm__
++/*
++ * Use the __kuser_memory_barrier helper in the CPU helper page. See
++ * arch/arm/kernel/entry-armv.S in the kernel source for details.
++ */
++#define rmb()         ((void(*)(void))0xffff0fa0)()
++#define cpu_relax()   asm volatile("":::"memory")
++#endif
++
+ #endif
diff --git a/devel/sysprof/patches/rmb-mips.patch b/devel/sysprof/patches/rmb-mips.patch
new file mode 100644 (file)
index 0000000..e055b8a
--- /dev/null
@@ -0,0 +1,22 @@
+Upstream-Status: Pending
+
+Index: git/util.h
+===================================================================
+--- git.orig/util.h    2010-12-08 01:22:44.486243001 -0600
++++ git/util.h 2010-12-08 01:23:27.836243001 -0600
+@@ -37,4 +37,15 @@
+ #define cpu_relax()     asm volatile("" ::: "memory");
+ #endif
++#ifdef __mips__
++#define rmb()         asm volatile(                                   \
++                              ".set   mips2\n\t"                      \
++                              "sync\n\t"                              \
++                              ".set   mips0"                          \
++                              : /* no output */                       \
++                              : /* no input */                        \
++                              : "memory")
++#define cpu_relax()   asm volatile("" ::: "memory")
++#endif
++
+ #endif
diff --git a/ipv6/6tunnel/Makefile b/ipv6/6tunnel/Makefile
new file mode 100644 (file)
index 0000000..64809ad
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2007-2012 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:=6tunnel
+PKG_VERSION:=0.11rc2
+PKG_RELEASE:=3
+PKG_MD5SUM:=74e02d4f0704b3083a01feda66033449
+
+PKG_SOURCE_URL:=http://toxygen.net/6tunnel/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/6tunnel
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +kmod-sit
+  TITLE:=IPv4 / IPv6 tunnel proxy
+  URL:=http://toxygen.net/6tunnel/
+endef
+
+define Package/6tunnel/description
+IPv4 / IPv6 tunnel proxy
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/$(PKG_NAME) $(PKG_BUILD_DIR)/$(PKG_NAME).c
+endef
+
+define Package/6tunnel/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/6tunnel $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,6tunnel))
diff --git a/ipv6/6tunnel/patches/100-arm-fix-optc-initialization.patch b/ipv6/6tunnel/patches/100-arm-fix-optc-initialization.patch
new file mode 100644 (file)
index 0000000..e84da61
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/6tunnel.c
++++ b/6tunnel.c
+@@ -508,7 +508,7 @@ int main(int argc, char **argv)
+ {
+       int force = 0, lsock, csock, one = 0, jeden = 1, local_port;
+       int detach = 1, listen6 = 0, sa_len, conn_limit = 0;
+-      char optc, *username = NULL, *bind_host = NULL;
++      char optc = -1, *username = NULL, *bind_host = NULL;
+       struct sockaddr *sa;
+       struct sockaddr_in laddr, caddr;
+       struct sockaddr_in6 laddr6;
diff --git a/ipv6/dhcp6/Makefile b/ipv6/dhcp6/Makefile
new file mode 100644 (file)
index 0000000..a82f024
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2006-2009 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:=dhcp6
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=dhcpv6-linux-$(PKG_VERSION).zip
+PKG_SOURCE_URL:=@SF/dhcpv6-linux
+PKG_MD5SUM:=86193dfa62137db3ea459543db4f1102
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK:=unzip -d $(PKG_BUILD_DIR)/ $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/dhcp6/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=IPv6 DHCP
+  URL:=http://sourceforge.net/projects/dhcpv6-linux
+endef
+
+define Package/dhcp6-client
+  $(call Package/dhcp6/Default)
+  TITLE+= client
+endef
+
+define Package/dhcp6-client/conffiles
+/etc/dhcp6/solicit.conf
+endef
+
+define Package/dhcp6-server
+  $(call Package/dhcp6/Default)
+  TITLE+= server
+endef
+
+define Package/dhcp6-server/conffiles
+/etc/dhcpd6/dhcpd6.conf
+/etc/dhcpd6/leases6.conf
+/etc/dhcpd6/partial_leases6.conf
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       # prevent package from rebuilding
+       find $(PKG_BUILD_DIR) | xargs touch
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/client \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)"
+       $(MAKE) -C $(PKG_BUILD_DIR)/server \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)"
+endef
+
+define Package/dhcp6-client/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/dhcp6
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/cli $(1)/usr/sbin/dhcp6client
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/solicit.conf $(1)/etc/dhcp6/
+endef
+
+define Package/dhcp6-server/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/dhcpd6
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/serv $(1)/usr/sbin/dhcpd6
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/*.conf $(1)/etc/dhcpd6/
+endef
+
+$(eval $(call BuildPackage,dhcp6-client))
+$(eval $(call BuildPackage,dhcp6-server))
diff --git a/ipv6/dhcp6/patches/001-opt_flags.patch b/ipv6/dhcp6/patches/001-opt_flags.patch
new file mode 100644 (file)
index 0000000..326f210
--- /dev/null
@@ -0,0 +1,94 @@
+diff -urN orig/dhcp6-1.0/client/Makefile dhcp6-1.0/client/Makefile
+--- orig/dhcp6-1.0/client/Makefile     2025-06-28 23:21:40.000000000 +0200
++++ dhcp6-1.0/client/Makefile  2005-12-13 13:43:11.000000000 +0100
+@@ -3,40 +3,40 @@
+ STD_HEADERS = stdhead.h head.h struct.h options_type.h message_type.h states.h timer_val.h constants.h macros.h status_codes.h
+ OBJECT_FILES = client.o solicit.o clilib.o parse.o request.o decline.o renew.o rebind.o release.o
+ HEADER_FILES = solicit.h clilib.h parse.h request.h decline.h renew.h rebind.h release.h
+-
++CFLAGS = -g3
+ dhcpv6_client : dhcpv6_client.c cli
+-      $(CC) -g3 dhcpv6_client.c -o dhcpv6_client
++      $(CC) $(CFLAGS) $(LDFLAGS) dhcpv6_client.c -o dhcpv6_client
+ cli : $(OBJECT_FILES)
+-      $(CC) -g3 $(OBJECT_FILES) -o cli -lncurses
++      $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECT_FILES) -o cli -lncurses
+ client.o : client.c $(STD_HEADERS) $(HEADER_FILES)
+-      $(CC) -g3 -c client.c -o client.o
++      $(CC) $(CFLAGS) -c client.c -o client.o
+ release.o : release.c release.h clilib.h
+-      $(CC) -g3 -c release.c -o release.o
++      $(CC) $(CFLAGS) -c release.c -o release.o
+ rebind.o : rebind.c rebind.h clilib.h
+-      $(CC) -g3 -c rebind.c -o rebind.o
++      $(CC)  $(CFLAGS) -c rebind.c -o rebind.o
+ renew.o : renew.c renew.h clilib.h
+-      $(CC) -g3 -c renew.c -o renew.o
++      $(CC) $(CFLAGS) -c renew.c -o renew.o
+ request.o : request.c request.h clilib.h
+-      $(CC) -g3 -c request.c -o request.o
++      $(CC) $(CFLAGS) -c request.c -o request.o
+ decline.o : decline.c decline.h clilib.h parse.h solicit.h
+-      $(CC) -g3 -c decline.c -o decline.o
++      $(CC) $(CFLAGS) -c decline.c -o decline.o
+ solicit.o : solicit.c solicit.h clilib.h parse.h
+-      $(CC) -g3 -c solicit.c -o solicit.o
++      $(CC) $(CFLAGS) -c solicit.c -o solicit.o
+ clilib.o : clilib.c clilib.h parse.h
+-      $(CC) -g3 -c clilib.c -o clilib.o
++      $(CC) $(CFLAGS) -c clilib.c -o clilib.o
+ parse.o : parse.c parse.h clilib.h
+-      $(CC) -g3 -c parse.c -o parse.o
++      $(CC) $(CFLAGS) -c parse.c -o parse.o
+ clean :
+       rm -f *.o cli dhcpv6_client
+--- orig/dhcp6-1.0/server/Makefile     2002-06-28 14:50:04.000000000 +0200
++++ dhcp6-1.0/server/Makefile  2005-12-13 11:35:53.000000000 +0100
+@@ -1,27 +1,28 @@
+ CC = gcc
+ STD_HEADERS = stdhead.h head.h struct.h options_type.h message_type.h macros.h status_codes.h constants.h
+ OBJECT_FILES = server.o lib.o advertise.o parse.o leases.o reply.o
++CFLAGS = -g3
+ serv: $(OBJECT_FILES)
+-      $(CC) -g3 $(OBJECT_FILES) -o serv
++      $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECT_FILES) -o serv
+ lib.o: lib.c lib.h $(STD_HEADERS)
+-      $(CC) -g3 -c lib.c -o lib.o
++      $(CC) $(CFLAGS) -c lib.c -o lib.o
+ parse.o: parse.c parse.h $(STD_HEADERS)
+-      $(CC) -g3 -c parse.c -o parse.o
++      $(CC) $(CFLAGS) -c parse.c -o parse.o
+ leases.o: leases.c leases.h $(STD_HEADERS)
+-      $(CC) -g3 -c leases.c -o leases.o
++      $(CC) $(CFLAGS) -c leases.c -o leases.o
+ advertise.o: advertise.c advertise.h $(STD_HEADERS)
+-      $(CC) -g3 -c advertise.c -o advertise.o
++      $(CC) $(CFLAGS) -c advertise.c -o advertise.o
+ reply.o: reply.c reply.h $(STD_HEADERS)
+-      $(CC) -g3 -c reply.c -o reply.o
++      $(CC) $(CFLAGS) -c reply.c -o reply.o
+ server.o: server.c lib.h advertise.h reply.h leases.h parse.h $(STD_HEADERS)
+-      $(CC) -g3 -c server.c -o server.o
++      $(CC) $(CFLAGS) -c server.c -o server.o
+ clean: 
+       rm -f *.o serv
diff --git a/ipv6/dhcp6/patches/002-gcc_lvalue.patch b/ipv6/dhcp6/patches/002-gcc_lvalue.patch
new file mode 100644 (file)
index 0000000..e5deda6
--- /dev/null
@@ -0,0 +1,11 @@
+--- dhcp6-1.0/client/solicit.c 2025-06-28 23:21:40.000000000 -0700
++++ dhcp6-1.0-patched/client/solicit.c 2006-04-27 15:32:52.000000000 -0700
+@@ -18,7 +18,7 @@
+     dhcp_message_ptr -> opt = add_client_id_option (interface_details);
+     
+     opt_ptr = (struct OPTIONS *) dhcp_message_ptr -> opt;
+-    (struct OPTIONS *) ((struct DUID *) opt_ptr -> opt_data) -> opt = add_ia_option (interface_details);
++    ((struct DUID *) opt_ptr -> opt_data) -> opt = add_ia_option (interface_details);
+     return dhcp_message_ptr;
+ }
diff --git a/ipv6/dhcp6/patches/003-debug.patch b/ipv6/dhcp6/patches/003-debug.patch
new file mode 100644 (file)
index 0000000..7968df2
--- /dev/null
@@ -0,0 +1,22 @@
+diff -urN orig/dhcp6-1.0/client/clilib.c dhcp6-1.0/client/clilib.c
+--- orig/dhcp6-1.0/client/clilib.c     2025-06-28 23:21:40.000000000 +0200
++++ dhcp6-1.0/client/clilib.c  2005-12-13 13:42:43.000000000 +0100
+@@ -554,7 +554,7 @@
+ void generate_trans_id (u_int32_t *trans_id)
+ {
+-    extern u_int32_t g_trans_id;
++    extern int g_trans_id;
+     time_t t;
+     srand (time (&t));
+     *trans_id = 0;
+@@ -890,9 +890,7 @@
+                   break;
+               default :
+-#if DEBUG == 3
+                   printf ("Unrecognized DUID type\n");
+-#endif
+           }
+           next_opt = (struct OPTIONS *) malloc (sizeof (struct OPTIONS));
diff --git a/ipv6/dibbler/Makefile b/ipv6/dibbler/Makefile
new file mode 100644 (file)
index 0000000..e6f8832
--- /dev/null
@@ -0,0 +1,134 @@
+#
+# Copyright (C) 2006-2012 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:=dibbler
+PKG_VERSION:=0.8.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://klub.com.pl/dhcpv6/dibbler
+PKG_MD5SUM:=313044c95af3091607127a05c338d8ec
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dibbler/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=$(CXX_DEPENDS) +libpthread
+  TITLE:=Dibbler, a portable DHCPv6 implementation
+  URL:=http://klub.com.pl/dhcpv6/
+endef
+
+define Package/dibbler/Default/description
+       Dibbler is a portable DHCPv6 implementation. It supports stateful (i.e.
+       IPv6 address granting) as well as stateless (i.e. option granting)
+       autoconfiguration for IPv6.
+endef
+
+define Package/dibbler-client
+  $(call Package/dibbler/Default)
+  TITLE+= (client)
+endef
+
+define Package/dibbler-client/conffiles
+/etc/dibbler/client.conf
+endef
+
+define Package/dibbler-client/description
+       $(call Package/dibbler/Default/description)
+       This package contains the dibbler client.
+endef
+
+define Package/dibbler-relay
+  $(call Package/dibbler/Default)
+  TITLE+= (relay)
+endef
+
+define Package/dibbler-relay/conffiles
+/etc/dibbler/relay.conf
+endef
+
+define Package/dibbler-relay/description
+       $(call Package/dibbler/Default/description)
+       This package contains the dibbler relay.
+endef
+
+define Package/dibbler-requestor
+  $(call Package/dibbler/Default)
+  TITLE+= (requestor)
+endef
+
+define Package/dibbler-requestor/description
+       $(call Package/dibbler/Default/description)
+       This package contains the dibbler requestor.
+endef
+
+define Package/dibbler-server
+  $(call Package/dibbler/Default)
+  TITLE+= (server)
+endef
+
+define Package/dibbler-server/conffiles
+/etc/dibbler/server.conf
+endef
+
+define Package/dibbler-server/description
+       $(call Package/dibbler/Default/description)
+       This package contains the dibbler server.
+endef
+
+define Package/dibbler-client/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dibbler-client $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/dibbler
+       $(INSTALL_CONF) \
+               $(PKG_BUILD_DIR)/doc/examples/client.conf \
+               $(1)/etc/dibbler/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) \
+               ./files/dibbler-client.init \
+               $(1)/etc/init.d/dibbler-client
+endef
+
+define Package/dibbler-relay/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dibbler-relay $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/dibbler
+       $(INSTALL_CONF) \
+               $(PKG_BUILD_DIR)/doc/examples/relay.conf \
+               $(1)/etc/dibbler/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) \
+               ./files/dibbler-relay.init \
+               $(1)/etc/init.d/dibbler-relay
+endef
+
+define Package/dibbler-requestor/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dibbler-requestor $(1)/usr/sbin/
+endef
+
+define Package/dibbler-server/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dibbler-server $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/dibbler
+       $(INSTALL_CONF) \
+               $(PKG_BUILD_DIR)/doc/examples/server.conf \
+               $(1)/etc/dibbler/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) \
+               ./files/dibbler-server.init \
+               $(1)/etc/init.d/dibbler-server
+endef
+
+$(eval $(call BuildPackage,dibbler-client))
+$(eval $(call BuildPackage,dibbler-relay))
+$(eval $(call BuildPackage,dibbler-requestor))
+$(eval $(call BuildPackage,dibbler-server))
diff --git a/ipv6/dibbler/files/dibbler-client.init b/ipv6/dibbler/files/dibbler-client.init
new file mode 100644 (file)
index 0000000..04e8a4d
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=90
+STOP=90
+
+start() {
+       mkdir -p /var/lib/dibbler
+       dibbler-client start
+}
+
+stop() {
+       dibbler-client stop
+}
diff --git a/ipv6/dibbler/files/dibbler-relay.init b/ipv6/dibbler/files/dibbler-relay.init
new file mode 100644 (file)
index 0000000..9f42e22
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=90
+STOP=90
+
+start() {
+       mkdir -p /var/lib/dibbler
+       dibbler-relay start
+}
+
+stop() {
+       dibbler-relay stop
+}
diff --git a/ipv6/dibbler/files/dibbler-server.init b/ipv6/dibbler/files/dibbler-server.init
new file mode 100644 (file)
index 0000000..0a93c2a
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=90
+STOP=90
+
+start() {
+       mkdir -p /var/lib/dibbler
+       dibbler-server start
+}
+
+stop() {
+       dibbler-server stop
+}
diff --git a/ipv6/gw6c/Makefile b/ipv6/gw6c/Makefile
new file mode 100644 (file)
index 0000000..e17538a
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2008-2014 OpenWrt.org
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gw6c
+PKG_VERSION:=5.1
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://openwrt.linux-appliance.net/sources
+PKG_MD5SUM:=eeac7292a622681651ec3bd9b2e5b061
+PKG_BUILD_DIR:=$(BUILD_DIR)/gw6-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gw6c
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +ip +kmod-tun +kmod-ipv6 $(CXX_DEPENDS) +radvd
+  TITLE:=IPv6 tunnel client software
+  URL:=http://www.go6.net
+endef
+
+define Package/gw6c/description
+  Client to configure an IPv6 tunnel to
+  Hexago/freenet6/go6.net's migration broker.
+endef
+
+GW6C_OPTS:= \
+       C_COMPILER="$(TARGET_CC) -c -DNO_STDLIBCXX" \
+       COMPILER="$(TARGET_CXX) -c -DNO_STDLIBCXX" \
+       CPP_FLAGS="$(TARGET_CFLAGS) -I. -Wall -DNDEBUG  $(TARGET_CPPFLAGS)" \
+       C_FLAGS="$(TARGET_CFLAGS) -I. -Wall -DNDEBUG $(TARGET_CPPFLAGS)" \
+       RANLIB="$(TARGET_CROSS)ranlib" \
+       ARCHIVER="$(TARGET_CROSS)ar" \
+       C_LINKER="$(TARGET_CC)" \
+       LINKER="$(TARGET_CXX)" \
+       exportdir=$(PKG_BUILD_DIR)/gw6c \
+       export
+
+define Build/Configure
+       $(INSTALL_DIR) $(PKG_BUILD_DIR)/gw6c/include
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/gw6c-config/gw6cconfig/gw6c_c_wrapper.h \
+               $(PKG_BUILD_DIR)/gw6c/include
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/gw6c-config \
+               $(GW6C_OPTS)
+       $(MAKE) -C $(PKG_BUILD_DIR)/gw6c-messaging \
+               $(GW6C_OPTS)
+       $(MAKE) -C $(PKG_BUILD_DIR)/tspc-advanced \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -fno-builtin -Wall -I$(PKG_BUILD_DIR)/tspc-advanced/include \
+                       -I$(PKG_BUILD_DIR)/tspc-advanced/platform/openwrt -I$(PKG_BUILD_DIR)/tspc-advanced" \
+               LDFLAGS="-L$(PKG_BUILD_DIR)/tspc-advanced/gw6cconfig \
+                       -L$(PKG_BUILD_DIR)/tspc-advanced/gw6cmessaging \
+                       $(TARGET_LDFLAGS) $(LIBGCC_S)" \
+               target="openwrt" \
+               installdir="$(PKG_INSTALL_DIR)"
+endef
+
+define Package/gw6c/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tspc-advanced/bin/$(PKG_NAME) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/share/gw6c/template
+       $(CP) ./files/openwrt.sh $(1)/usr/share/gw6c/template
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/gw6c.init $(1)/etc/init.d/gw6c
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/gw6c.config $(1)/etc/config/gw6c
+endef
+
+define Package/gw6c/conffiles
+/etc/config/gw6c
+endef
+
+$(eval $(call BuildPackage,gw6c))
diff --git a/ipv6/gw6c/files/gw6c.config b/ipv6/gw6c/files/gw6c.config
new file mode 100644 (file)
index 0000000..e634c98
--- /dev/null
@@ -0,0 +1,66 @@
+config gw6c basic
+       #Comment out next line to enable gw6c
+       option disabled         1
+
+       #Leave empty if connecting anonymously  
+       option userid
+       option passwd
+       
+       #For anonymous use anon.frenet6.net and
+       #account holders should use broker.freenet6.net
+       option server           anon.freenet6.net
+       
+       #auth_method <anonymous|any|passds-3des-1|digest-md5|plain>
+       #Use anonymous with anonymous access and
+       #any if you are account holder
+       option auth_method      anonymous
+
+config gw6c routing
+       #host_type <host|router>
+       option host_type        host
+       option prefixlen        48
+       option ifprefix         br-lan
+       
+       #DNS server list to which the reverse prefix
+       #will be delegated. Separate servers with :
+       option dns_server
+       
+config gw6c advanced
+       #Location where to store configuration file
+       option gw6c_conf        /tmp/gw6c.conf
+       option gw6c_dir         /usr/share/gw6c
+       option auto_retry       yes
+       option retry_delay      30
+       option keepalive        yes
+       #keepalive interval
+       option interval         30
+       #tunnel_mode <v6v4|v6udpv4|v6anyv4|v4v6>
+       option if_tunnel_mode   v6anyv4
+       option if_v6v4          sit1
+       option if_v6udpv4       tun
+       option if_v4v6          sit0
+       option client_v4        auto
+       option client_v6        auto
+       option template         openwrt
+       option proxy_client     no
+
+config gw6c broker
+       option broker_list      /tmp/gw6c-broker-list.txt
+       option last_server      /tmp/gw6c-last-server.txt
+       # Always use last known working server? <yes|no>
+       option always_same_serv no
+
+config gw6c logging
+       option log_console      0
+       option log_stderr       1
+       option log_file         0
+       option log_syslog       0
+       
+       option log_filename     /var/log/gw6c.log
+       option log_rotation     yes
+       #Max size when using log file rotation
+       #possible values: 16|32|128|1024
+       option log_maxsize      32
+       
+       #<USER|LOCAL[0-7]>
+       option syslog_facility  USER
diff --git a/ipv6/gw6c/files/gw6c.init b/ipv6/gw6c/files/gw6c.init
new file mode 100755 (executable)
index 0000000..f311324
--- /dev/null
@@ -0,0 +1,111 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2011 OpenWrt.org
+# Copyright (C) 2007 RoadRunner.cx
+
+START=52
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+genconf() {
+
+       [ -f /etc/config/gw6c ] || {
+               echo "You are missing configuration file /etc/config/gw6c"
+               return 1
+       }
+
+       config_load "gw6c"
+
+       config_get DISABLED basic disabled
+
+       [ "$DISABLED" == "1" ] && {
+               echo "You haven't edited your configuration file. Gateway6 is disabled."
+               return 1
+       }
+
+       config_get USERID basic userid
+       config_get PASSWORD basic passwd
+       config_get SERVER basic server
+       config_get AUTH_METHOD basic auth_method
+
+       config_get HOST_TYPE routing host_type
+       config_get PREFIX_LEN routing prefixlen
+       config_get IF_PREFIX routing ifprefix
+       config_get DNS_SERVER routing dns_server
+
+       config_get GW6C_CONF advanced gw6c_conf
+       config_get GW6C_DIR advanced gw6c_dir
+       config_get AUTO_RETRY advanced auto_retry
+       config_get RETRY_DELAY advanced retry_delay
+       config_get KEEPALIVE advanced keepalive
+       config_get KEEPALIVE_INTERVAL advanced interval
+       config_get TUNNEL_MODE advanced if_tunnel_mode
+       config_get IF_V6V4 advanced if_v6v4
+       config_get IF_V6UDPV4 advanced if_v6udpv4
+       config_get IF_V4V6 advanced if_v4v6
+       config_get CLIENT_V4 advanced client_v4
+       config_get CLIENT_V6 advanced client_v6
+       config_get TEMPLATE advanced template
+       config_get PROXY_CLIENT advanced proxy_client
+
+       config_get BROKER_LIST broker broker_list
+       config_get LAST_SERVER broker last_server
+       config_get ALWAYS_SAMESERV broker always_same_serv
+
+       config_get LOG_CONSOLE logging log_console
+       config_get LOG_STDERR logging log_stderr
+       config_get LOG_FILE logging log_file
+       config_get LOG_SYSLOG logging log_syslog
+       config_get LOG_FILENAME logging log_filename
+       config_get LOG_ROTATE logging log_rotation
+       config_get LOG_MAXSIZE logging log_maxsize
+       config_get SYSLOG_FACILITY logging syslog_facility
+
+       cat >$GW6C_CONF <<EOF
+userid=$USERID
+passwd=$PASSWORD
+server=$SERVER
+auth_method=$AUTH_METHOD
+host_type=$HOST_TYPE
+prefixlen=$PREFIX_LEN
+if_prefix=$IF_PREFIX
+dns_server=$DNS_SERVER
+gw6_dir=$GW6C_DIR
+auto_retry_connect=$AUTO_RETRY
+retry_delay=$RETRY_DELAY
+keepalive=$KEEPALIVE
+keepalive_interval=$KEEPALIVE_INTERVAL
+tunnel_mode=$TUNNEL_MODE
+if_tunnel_v6v4=$IF_V6V4
+if_tunnel_v6udpv4=$IF_V6UDPV4
+if_tunnel_v4v6=$IF_V4V6
+client_v4=$CLIENT_V4
+client_v6=$CLIENT_V6
+template=$TEMPLATE
+proxy_client=$PROXY_CLIENT
+broker_list=$BROKER_LIST
+last_server=$LAST_SERVER
+always_use_same_server=$ALWAYS_SAMESERV
+log_console=$LOG_CONSOLE
+log_stderr=$LOG_STDERR
+log_file=$LOG_FILE
+log_syslog=$LOG_SYSLOG
+log_filename=$LOG_FILENAME
+log_rotation=$LOG_ROTATE
+log_rotation_size=$LOG_MAXSIZE
+syslog_facility=$SYSLOG_FACILITY
+EOF
+}
+
+start() {
+       genconf
+       [ -n "$GW6C_CONF" ] || return 1
+       [ -f "$GW6C_CONF" ] || return 1
+       service_start /usr/sbin/gw6c -f "$GW6C_CONF"
+}
+
+stop() {
+       service_stop /usr/sbin/gw6c && {
+               echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
+       }
+}
diff --git a/ipv6/gw6c/files/openwrt.sh b/ipv6/gw6c/files/openwrt.sh
new file mode 100755 (executable)
index 0000000..75d418f
--- /dev/null
@@ -0,0 +1,181 @@
+#!/bin/sh
+#
+# openwrt.sh,v 1.1.4.1 2007/01/12 19:16:12 dgregoire Exp
+#
+# This source code copyright (c) Hexago Inc. 2002-2007.
+#
+# LICENSE NOTICE: You may use and modify this source code only if you
+# have executed a valid license agreement with Hexago Inc. granting
+# you the right to do so, the said license agreement governing such
+# use and modifications.   Copyright or other intellectual property
+# notices are not to be removed from the source code.
+#
+# Note: IPV6 support and tun Support must be enabled before calling this script.
+# 
+
+
+LANGUAGE=C
+
+if [ -z $TSP_VERBOSE ]; then
+   TSP_VERBOSE=0
+fi
+
+KillProcess()
+{
+   if [ ! -z $TSP_VERBOSE ]; then
+      if [ $TSP_VERBOSE -ge 2 ]; then
+         echo killing $*
+      fi
+   fi
+   PID=`ps axww | grep $1 | grep -v grep | awk '{ print $1;}'`
+   echo $PID
+   if [ ! -z $PID ]; then
+      kill $PID
+   fi
+}
+
+Display()
+{
+   if [ -z $TSP_VERBOSE ]; then
+      return;
+   fi
+   if [ $TSP_VERBOSE -lt $1 ]; then
+      return;
+   fi
+   shift
+   echo "$*"
+}
+
+Exec()
+{
+   if [ ! -z $TSP_VERBOSE ]; then
+      if [ $TSP_VERBOSE -ge 2 ]; then
+         echo $*
+      fi
+   fi
+   $* # Execute command
+   if [ $? -ne 0 ]; then
+      echo "Error while executing $1"
+      echo "   Command: $*"
+      exit 1
+   fi
+}
+
+ExecNoCheck()
+{
+   if [ ! -z $TSP_VERBOSE ]; then
+      if [ $TSP_VERBOSE -ge 2 ]; then
+         echo $*
+      fi
+   fi
+   $* # Execute command
+}
+
+# Program localization 
+
+Display 1 "--- Start of configuration script. ---"
+Display 1 "Script: " `basename $0`
+
+ifconfig=/sbin/ifconfig
+route=/sbin/route
+ipconfig=/usr/sbin/ip
+rtadvd=/usr/sbin/radvd
+rtadvd_pid=/var/run/radvd.pid
+sysctl=/sbin/sysctl
+rtadvdconfigfilename=gw6c-radvd.conf
+rtadvdconfigfile=/tmp/$rtadvdconfigfilename
+
+if [ -z $TSP_HOME_DIR ]; then
+   echo "TSP_HOME_DIR variable not specified!;"
+   exit 1
+fi
+
+if [ ! -d $TSP_HOME_DIR ]; then
+   echo "Error : directory $TSP_HOME_DIR does not exist"
+   exit 1
+fi
+#
+
+if [ -z $TSP_HOST_TYPE ]; then
+   echo Error: TSP_HOST_TYPE not defined.
+   exit 1
+fi
+
+if [ X"${TSP_HOST_TYPE}" = X"host" ] || [ X"${TSP_HOST_TYPE}" = X"router" ]; then
+   #
+   # Configured tunnel config (IPv6) 
+   Display 1 "$TSP_TUNNEL_INTERFACE setup"
+   if [ X"${TSP_TUNNEL_MODE}" = X"v6v4" ]; then
+      Display 1 "Setting up link to $TSP_SERVER_ADDRESS_IPV4"
+       ExecNoCheck $ipconfig tunnel del $TSP_TUNNEL_INTERFACE
+       ExecNoCheck sleep 1
+        Exec $ipconfig tunnel add $TSP_TUNNEL_INTERFACE mode sit ttl 64 remote $TSP_SERVER_ADDRESS_IPV4
+   fi
+
+   Exec $ifconfig $TSP_TUNNEL_INTERFACE up
+
+   PREF=`echo $TSP_CLIENT_ADDRESS_IPV6 | sed "s/:0*/:/g" |cut -d : -f1-2`
+   OLDADDR=`$ifconfig $TSP_TUNNEL_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
+   if [ ! -z $OLDADDR ]; then
+      Display 1 "Removing old IPv6 address $OLDADDR"
+      Exec $ifconfig $TSP_TUNNEL_INTERFACE inet6 del $OLDADDR
+   fi
+   Display 1 "This host is: $TSP_CLIENT_ADDRESS_IPV6/$TSP_TUNNEL_PREFIXLEN"
+   Exec $ifconfig $TSP_TUNNEL_INTERFACE add $TSP_CLIENT_ADDRESS_IPV6/$TSP_TUNNEL_PREFIXLEN
+   Exec $ifconfig $TSP_TUNNEL_INTERFACE mtu 1280
+   # 
+   # Default route  
+   Display 1 "Adding default route"
+   ExecNoCheck $route -A inet6 del ::/0 2>/dev/null # delete old default route
+   ExecNoCheck $route -A inet6 del 2000::/3 2>/dev/null  # delete old gw route
+   Exec $route -A inet6 add ::/0 dev $TSP_TUNNEL_INTERFACE
+   Exec $route -A inet6 add 2000::/3 dev $TSP_TUNNEL_INTERFACE
+fi
+
+# Router configuration if required
+if [ X"${TSP_HOST_TYPE}" = X"router" ]; then
+   Display 1 "Router configuration"
+   Display 1 "Kernel setup"
+   if [ X"${TSP_PREFIXLEN}" != X"64" ]; then
+      #Better way on linux to avoid loop with the remaining /48?
+      $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
+   fi
+   Display 1 "Adding prefix to $TSP_HOME_INTERFACE"
+   OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
+   if [ ! -z $OLDADDR ]; then
+      Display 1 "Removing old IPv6 address $OLDADDR"
+      Exec $ifconfig $TSP_HOME_INTERFACE del $OLDADDR
+   fi
+   Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64
+   # Router advertisement configuration 
+   Display 1 "Create new $rtadvdconfigfile"
+   echo "##### rtadvd.conf made by Gateway6 Client ####" > "$rtadvdconfigfile"
+   echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
+   echo "{" >> "$rtadvdconfigfile"
+   echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
+   echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
+   echo " {" >> "$rtadvdconfigfile"
+   echo " AdvOnLink on;" >> "$rtadvdconfigfile"
+   echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
+   echo " };" >> "$rtadvdconfigfile"
+   echo "};" >> "$rtadvdconfigfile"
+   echo "" >> "$rtadvdconfigfile"
+   /etc/init.d/radvd stop
+   # Then enable forwarding. Killing
+   # radvd disables forwarding and radvd
+   # does NOT start without forwarding enabled
+   Exec $sysctl -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled  
+   if [ -f $rtadvdconfigfile ]; then
+      Exec $rtadvd -p $rtadvd_pid -C $rtadvdconfigfile
+      Display 1 "Starting radvd: $rtadvd -p $rtadvd_pid -C $rtadvdconfigfile"
+   else
+      echo "Error : file $rtadvdconfigfile not found"
+      exit 1
+   fi
+fi
+
+Display 1 "--- End of configuration script. ---"
+
+exit 0
+
+#---------------------------------------------------------------------
diff --git a/ipv6/gw6c/patches/001-sed-separator.patch b/ipv6/gw6c/patches/001-sed-separator.patch
new file mode 100644 (file)
index 0000000..93fbc3b
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/tspc-advanced/conf/Makefile
++++ b/tspc-advanced/conf/Makefile
+@@ -21,12 +21,12 @@ gw6c.conf.sample:
+       fi
+       @if [ -z "$(configdir)" ]; then \
+        if [ -z "$(installdir)" ]; then \
+-         sed -e "s+@ifname_v4v6@+$(ifname_v4v6)+" -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@conf_template@+$(conf_template)+" -e "s+@conf_gw6_dir@+`cd ..;pwd`+"  gw6c.conf.in>$(BIN)/gw6c.conf.sample; \
++         sed -e "s|@ifname_v4v6@|$(ifname_v4v6)|" -e "s|@ifname_tun@|$(ifname_tun)|" -e "s|@ifname@|$(ifname)|" -e "s|@conf_template@|$(conf_template)|" -e "s|@conf_gw6_dir@|`cd ..;pwd`|"  gw6c.conf.in>$(BIN)/gw6c.conf.sample; \
+        else \
+-         sed -e "s+@ifname_v4v6@+$(ifname_v4v6)+" -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@conf_template@+$(conf_template)+" -e "s+@conf_gw6_dir@+$(installdir)+" gw6c.conf.in >$(BIN)/gw6c.conf.sample; \
++         sed -e "s|@ifname_v4v6@|$(ifname_v4v6)|" -e "s|@ifname_tun@|$(ifname_tun)|" -e "s|@ifname@|$(ifname)|" -e "s|@conf_template@|$(conf_template)|" -e "s|@conf_gw6_dir@|$(installdir)|" gw6c.conf.in >$(BIN)/gw6c.conf.sample; \
+        fi \
+       else \
+-       sed -e "s+@ifname_v4v6@+$(ifname_v4v6)+" -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@conf_template@+$(conf_template)+" -e "s+@conf_gw6_dir@+$(configdir)+" gw6c.conf.in >$(BIN)/gw6c.conf.sample; \
++       sed -e "s|@ifname_v4v6@|$(ifname_v4v6)|" -e "s|@ifname_tun@|$(ifname_tun)|" -e "s|@ifname@|$(ifname)|" -e "s|@conf_template@|$(conf_template)|" -e "s|@conf_gw6_dir@|$(configdir)|" gw6c.conf.in >$(BIN)/gw6c.conf.sample; \
+       fi
+       chmod 700 $(BIN)/gw6c.conf.sample
diff --git a/ipv6/ipv6calc/Makefile b/ipv6/ipv6calc/Makefile
new file mode 100644 (file)
index 0000000..57c0a93
--- /dev/null
@@ -0,0 +1,119 @@
+#
+# Copyright (C) 2008-2012 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:=ipv6calc
+PKG_VERSION:=0.93.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.bieringer.de/pub/linux/IPv6/ipv6calc
+PKG_MD5SUM:=9a5b7fdd1a90cd621dc43623976d912a
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipv6calc/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://www.deepspace6.net/projects/ipv6calc.html
+endef
+
+define Package/ipv6calc/Default/description
+  ipv6calc is a small utility written in programming languate C to manipulate
+  (not only) IPv6 addresses. Intentions were convering a given IPv6 address
+  into compressed format, convering a given IPv6 address into the same format
+  like shown in /proc/net/if_inet6 and (because it was not difficulty)
+  migrating the Perl program ip6_int into. Now only one utiltity is needed to
+  do a lot.
+endef
+
+define Package/ipv6calc
+  $(call Package/ipv6calc/Default)
+  TITLE:=IPv6 addresses calculations (full)
+  VARIANT:=full
+endef
+
+define Package/ipv6calc/description
+  $(call Package/ipv6calc/Default/description)
+  This package contains an ipv6calc with the internal databases enabled.
+endef
+
+define Package/ipv6calc-mini
+  $(call Package/ipv6calc/Default)
+  TITLE:=IPv6 addresses calculations (mini)
+  VARIANT:=mini
+endef
+
+define Package/ipv6calc-mini/description
+  $(call Package/ipv6calc/Default/description)
+  This package contains an ipv6calc with the internal databases disabled.
+endef
+
+define Package/ipv6log
+  $(call Package/ipv6calc/Default)
+  TITLE:=Webserver log helper programs (full)
+  VARIANT:=full
+endef
+
+define Package/ipv6log/description
+  $(call Package/ipv6calc/Default/description)
+  This package contains webserver log anonymization, conversion, and statistics
+  helper programs with the internal databases enabled.
+endef
+
+define Package/ipv6log-mini
+  $(call Package/ipv6calc/Default)
+  TITLE:=Webserver log helper programs (mini)
+  VARIANT:=mini
+endef
+
+define Package/ipv6log-mini/description
+  $(call Package/ipv6calc/Default/description)
+  This package contains webserver log anonymization, conversion, and statistics
+  helper programs with the internal databases disabled.
+endef
+
+ifeq ($(BUILD_VARIANT),full)
+       CONFIGURE_ARGS += \
+               --enable-db-ieee \
+               --enable-db-ipv4 \
+               --enable-db-ipv6
+endif
+
+ifeq ($(BUILD_VARIANT),mini)
+       CONFIGURE_ARGS += \
+               --disable-db-ieee \
+               --disable-db-ipv4 \
+               --disable-db-ipv6
+endif
+
+MAKE_FLAGS += \
+       CC="$(TARGET_CC)" \
+       COPTS="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)"
+
+define Package/ipv6calc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ipv6calc $(1)/usr/bin/
+endef
+
+Package/ipv6calc-mini/install = $(Package/ipv6calc/install)
+
+define Package/ipv6log/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ipv6log* $(1)/usr/bin/
+endef
+
+Package/ipv6log-mini/install = $(Package/ipv6log/install)
+
+$(eval $(call BuildPackage,ipv6calc))
+$(eval $(call BuildPackage,ipv6calc-mini))
+$(eval $(call BuildPackage,ipv6log))
+$(eval $(call BuildPackage,ipv6log-mini))
diff --git a/ipv6/miredo/Makefile b/ipv6/miredo/Makefile
new file mode 100644 (file)
index 0000000..8dba320
--- /dev/null
@@ -0,0 +1,105 @@
+#
+# Copyright (C) 2006-2012 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:=miredo
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=3
+
+PKG_SOURCE_URL:=http://www.remlab.net/files/miredo
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=1281e7e75bddbde244cd778d99fa22d4
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/miredo/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=miredo: Teredo (IPv6 tunneling over UDP through NAT)
+  URL:=http://www.remlab.net/miredo/
+endef
+
+define Package/miredo-common
+$(call Package/miredo/Default)
+  TITLE:=Teredo (IPv6 tunneling over UDP through NAT) shared libraries
+  DEPENDS+= +ip +libpthread +librt $(CXX_DEPENDS) +kmod-ipv6 +kmod-tun
+endef
+
+define Package/miredo-server
+$(call Package/miredo/Default)
+  TITLE:=Teredo (IPv6 tunneling over UDP through NAT) server daemon
+  DEPENDS+= +miredo-common
+endef
+
+define Package/miredo-server/conffiles
+/etc/miredo/miredo-server.conf
+endef
+
+define Package/miredo-client
+$(call Package/miredo/Default)
+  TITLE:=Teredo (IPv6 tunneling over UDP through NAT) client and relay daemon
+  DEPENDS+= +miredo-common
+endef
+
+define Package/miredo-client/conffiles
+/etc/miredo/miredo.conf
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-gnu-ld \
+       --disable-rpath \
+       --disable-chroot \
+       --enable-teredo-client \
+       --enable-miredo-user=root \
+       --without-Judy
+
+EXTRA_CXXFLAGS=-fno-rtti
+
+CONFIGURE_VARS += \
+       LIBS="-lm" \
+       ac_cv_file__proc_self_maps=yes \
+       ac_cv_header_sys_capability_h=no
+
+MAKE_FLAGS := CXXLINK="$(TARGET_CXX)"
+
+define Package/miredo-common/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lib{teredo,tun6}.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/miredo
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/miredo/miredo-privproc $(1)/usr/lib/miredo
+endef
+
+define Package/miredo-server/install
+       $(INSTALL_DIR) $(1)/etc/miredo
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/miredo/examples/miredo-server.conf $(1)/etc/miredo/miredo-server.conf
+       $(INSTALL_BIN) ./files/client-hook $(1)/etc/miredo/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/miredo-server.init $(1)/etc/init.d/miredo-server
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/miredo-server $(1)/usr/sbin/
+endef
+
+define Package/miredo-client/install
+       $(INSTALL_DIR) $(1)/etc/miredo
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/miredo/examples/miredo.conf $(1)/etc/miredo/miredo.conf
+       $(INSTALL_BIN) ./files/client-hook $(1)/etc/miredo/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/miredo.init $(1)/etc/init.d/miredo
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/miredo $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,miredo-common))
+$(eval $(call BuildPackage,miredo-server))
+$(eval $(call BuildPackage,miredo-client))
diff --git a/ipv6/miredo/files/client-hook b/ipv6/miredo/files/client-hook
new file mode 100644 (file)
index 0000000..b4c3ce8
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+#
+# Miredo client hook script for Linux/iproute2
+# Copyright Â© 2007 Rémi Denis-Courmont.
+# Distributed under the terms of the GNU General Public License version 2.
+
+# Linux iproute2 path:
+IP="/usr/sbin/ip"
+
+# Linux default route default metric is 1024
+# (we put 1029 so that Teredo is used as a last resort):
+METRIC=1029
+
+# Linux routing table ID
+# (possible values: 1-252 from /etc/iproute/rt_tables):
+TABLE="teredo"
+
+# Linux routing rule priority
+# (possible values: 1-32765, lowest number is highest priority):
+PRIO=32765
+
+# MTU for the tunnel interface
+# (default: specified by the Teredo server, or 1280)
+#MTU=1400
+
+if ! test -x "$IP"; then
+       echo "$0: iproute2 is required! Please install it." >&2
+       exit 1
+fi
+
+# Nothing to do with destroy event
+if test "$STATE" = "destroy"; then exit 0; fi
+
+# If the source routing table is not configured, ignore it.
+if ! "$IP" route show table "$TABLE" >/dev/null 2>&1; then
+       unset TABLE
+else
+       if test "$OLD_ADDRESS"; then
+               "$IP" -6 rule del from "$OLD_ADDRESS" \
+                       prio "$PRIO" table "$TABLE" 2>/dev/null
+       fi
+       "$IP" -6 route flush table "$TABLE" 2>/dev/null
+fi
+
+"$IP" -6 route flush dev "$IFACE" 2>/dev/null
+"$IP" -6 address flush dev "$IFACE" 2>/dev/null
+
+"$IP" -6 link set dev "$IFACE" "$STATE"
+if test "$MTU"; then
+       "$IP" link set dev "$IFACE" mtu "$MTU"
+fi
+
+case "$STATE" in
+       up)
+               "$IP" -6 address add "${LLADDRESS}/64" dev "$IFACE"
+               "$IP" -6 address add "${ADDRESS}/32" dev "$IFACE"
+               "$IP" -6 route add default dev "$IFACE" metric "$METRIC"
+
+               if test "$TABLE"; then
+                       "$IP" -6 route add default dev "$IFACE" table "$TABLE"
+                       "$IP" -6 rule add from "$ADDRESS" \
+                               prio "$PRIO" table "$TABLE"
+               fi
+esac
+
+# This should be required when changing policy routing rules, but it
+# seems to confuse certain kernels into removing our default route!
+#"$IP" -6 route flush cache 2>/dev/null
+
+exit 0
diff --git a/ipv6/miredo/files/miredo-server.init b/ipv6/miredo/files/miredo-server.init
new file mode 100644 (file)
index 0000000..e82820f
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/miredo-server
+}
+
+stop() {
+       service_stop /usr/sbin/miredo-server
+}
diff --git a/ipv6/miredo/files/miredo.init b/ipv6/miredo/files/miredo.init
new file mode 100644 (file)
index 0000000..0a83c96
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+# XXX: miredo create a pid file but using it doesn't seem to work
+#SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/miredo
+}
+
+stop() {
+       service_stop /usr/sbin/miredo
+}
diff --git a/ipv6/miredo/patches/100-uclibc.patch b/ipv6/miredo/patches/100-uclibc.patch
new file mode 100644 (file)
index 0000000..8818402
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/libteredo/maintain.c
++++ b/libteredo/maintain.c
+@@ -59,7 +59,7 @@
+ static inline void gettime (struct timespec *now)
+ {
+-#if (_POSIX_CLOCK_SELECTION - 0 >= 0) && (_POSIX_MONOTONIC_CLOCK - 0 >= 0)
++#if (_POSIX_CLOCK_SELECTION - 0 >= 0) && (_POSIX_MONOTONIC_CLOCK - 0 >= 0) && !defined(__UCLIBC__)
+       if (clock_gettime (CLOCK_MONOTONIC, now) == 0)
+               return;
+ #else
+--- a/libteredo/tunnel.h
++++ b/libteredo/tunnel.h
+@@ -32,6 +32,7 @@
+ # define LIBTEREDO_TUNNEL_H
+ # include <stdbool.h>
++# include <ctype.h>
+ # ifdef __cplusplus
+ extern "C" {
diff --git a/ipv6/miredo/patches/110-fix_compile_error.patch b/ipv6/miredo/patches/110-fix_compile_error.patch
new file mode 100644 (file)
index 0000000..a49b3f2
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/src/main.c
++++ b/src/main.c
+@@ -300,7 +300,9 @@
+       if (val)
+       {
+               error_errno ("cap_set_proc");
++#ifdef MIREDO_DEFAULT_USERNAME
+               setuid_notice ();
++#endif
+               return -1;
+       }
+ #endif
diff --git a/ipv6/miredo/patches/120-automake-compat.patch b/ipv6/miredo/patches/120-automake-compat.patch
new file mode 100644 (file)
index 0000000..608bba5
--- /dev/null
@@ -0,0 +1,23 @@
+Index: miredo-1.2.4/src/Makefile.am
+===================================================================
+--- miredo-1.2.4.orig/src/Makefile.am  2012-04-17 01:15:14.000000000 +0300
++++ miredo-1.2.4/src/Makefile.am       2012-04-17 01:17:45.000000000 +0300
+@@ -32,7 +32,8 @@
+       -DPKGLIBDIR=\"$(pkglibdir)\"
+ sbin_PROGRAMS = miredo miredo-server miredo-checkconf
+-pkglib_PROGRAMS =
++programfilesdir = $(pkglibdir)
++programfiles_PROGRAMS =
+ EXTRA_PROGRAMS = privproc
+ noinst_LTLIBRARIES = libmiredo.la
+ TESTS =
+@@ -59,7 +60,7 @@
+ miredo_privproc_SOURCES = privproc.c privproc.h
+ miredo_privproc_LDADD = ../libteredo/libteredo.la $(LIBCAP)
+ if TEREDO_CLIENT
+-pkglib_PROGRAMS += miredo-privproc
++programfiles_PROGRAMS += miredo-privproc
+ TESTS += miredo-checkconf
+ endif
diff --git a/ipv6/ndisc/Makefile b/ipv6/ndisc/Makefile
new file mode 100644 (file)
index 0000000..78b7f17
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2006-2012 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:=ndisc6
+PKG_VERSION:=1.0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.remlab.net/files/ndisc6
+PKG_MD5SUM:=50cb4c19606cf6ff2b7388e71832f579
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ndisc
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IPv6 discovery tools
+  TITLE:=IPv6 discovery tools
+  URL:=http://www.remlab.net/ndisc6/
+  DEPENDS:=+libpthread +librt
+endef
+
+define Package/ndisc/description
+IPv6 discovery tools
+endef
+
+define Package/ndisc6
+  $(call Package/ndisc)
+  TITLE:=An ICMPv6 neighbour discovery tool
+endef
+
+define Package/ndisc6/description
+An ICMPv6 neighbour discovery tools
+endef
+
+define Package/rdisc6
+  $(call Package/ndisc)
+  TITLE:=An ICMPv6 router discovery tool
+endef
+
+define Package/rdisc6/description
+An ICMPv6 router discovery tool
+endef
+
+define Package/traceroute6
+  $(call Package/ndisc)
+  TITLE:=An IPv6-based traceroute implementation
+endef
+
+define Package/traceroute6/description
+An IPv6-based traceroute implementation
+endef
+
+define Package/rdnssd
+  $(call Package/ndisc)
+  TITLE:=DNS server discovery daemon
+endef
+
+define Package/rdnssd/description
+A recursive DNS server discovery daemon gathering
+information through stateless IPv6 autoconfiguration (RFC5006)
+endef
+
+TARGET_CFLAGS += -std=c99
+
+define Package/ndisc6/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndisc6 $(1)/usr/bin/
+endef
+
+define Package/rdisc6/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdisc6 $(1)/usr/bin/
+endef
+
+define Package/traceroute6/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{rl,tcp}traceroute6 $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tracert6 $(1)/usr/bin/
+endef
+
+define Package/rdnssd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rdnssd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ndisc6))
+$(eval $(call BuildPackage,rdisc6))
+$(eval $(call BuildPackage,traceroute6))
+$(eval $(call BuildPackage,rdnssd))
diff --git a/ipv6/ndisc/patches/100-favor_bsd.patch b/ipv6/ndisc/patches/100-favor_bsd.patch
new file mode 100644 (file)
index 0000000..ed6090d
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/trace-tcp.c
++++ b/src/trace-tcp.c
+@@ -24,6 +24,7 @@
+ #undef _GNU_SOURCE
+ #define _BSD_SOURCE 1
++#define __FAVOR_BSD 1
+ #include <string.h>
+ #include <inttypes.h>
+--- a/src/trace-udp.c
++++ b/src/trace-udp.c
+@@ -24,6 +24,7 @@
+ #undef _GNU_SOURCE
+ #define _BSD_SOURCE 1
++#define __FAVOR_BSD 1
+ #include <string.h>
+ #include <stdbool.h>
diff --git a/ipv6/ndisc/patches/110-strverscmp.patch b/ipv6/ndisc/patches/110-strverscmp.patch
new file mode 100644 (file)
index 0000000..345661f
--- /dev/null
@@ -0,0 +1,175 @@
+--- a/rdnssd/Makefile.am
++++ b/rdnssd/Makefile.am
+@@ -30,7 +30,8 @@ conf_SCRIPTS = merge-hook
+ # rdnssd
+ rdnssd_SOURCES = rdnssd.c rdnssd.h \
+       icmp.c \
+-      netlink.c
++      netlink.c \
++      strverscmp.c
+ rdnssd_LDADD = $(LIBRT) \
+               @top_builddir@/compat/libcompat.a
+--- a/rdnssd/Makefile.in
++++ b/rdnssd/Makefile.in
+@@ -60,7 +60,7 @@ CONFIG_CLEAN_FILES =
+ CONFIG_CLEAN_VPATH_FILES =
+ am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(confdir)"
+ PROGRAMS = $(sbin_PROGRAMS)
+-am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT)
++am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT) strverscmp.$(OBJEXT)
+ rdnssd_OBJECTS = $(am_rdnssd_OBJECTS)
+ am__DEPENDENCIES_1 =
+ rdnssd_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+@@ -251,7 +251,8 @@ conf_SCRIPTS = merge-hook
+ # rdnssd
+ rdnssd_SOURCES = rdnssd.c rdnssd.h \
+       icmp.c \
+-      netlink.c
++      netlink.c \
++      strverscmp.c
+ rdnssd_LDADD = $(LIBRT) \
+               @top_builddir@/compat/libcompat.a
+@@ -373,6 +374,7 @@ distclean-compile:
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icmp.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlink.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strverscmp.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdnssd.Po@am__quote@
+ .c.o:
+--- /dev/null
++++ b/rdnssd/strverscmp.c
+@@ -0,0 +1,131 @@
++/* Compare strings while treating digits characters numerically.
++   Copyright (C) 1997, 2000, 2002, 2004 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2, or (at your option)
++   any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License along
++   with this program; if not, write to the Free Software Foundation,
++   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <string.h>
++#include <ctype.h>
++
++/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
++           fractional parts, S_Z: idem but with leading Zeroes only */
++#define S_N    0x0
++#define S_I    0x4
++#define S_F    0x8
++#define S_Z    0xC
++
++/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
++#define CMP    2
++#define LEN    3
++
++
++/* ISDIGIT differs from isdigit, as follows:
++   - Its arg may be any int or unsigned int; it need not be an unsigned char.
++   - It's guaranteed to evaluate its argument exactly once.
++   - It's typically faster.
++   POSIX says that only '0' through '9' are digits.  Prefer ISDIGIT to
++   ISDIGIT_LOCALE unless it's important to use the locale's definition
++   of `digit' even when the host does not conform to POSIX.  */
++#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
++
++#undef __strverscmp
++#undef strverscmp
++
++#ifndef weak_alias
++# define __strverscmp strverscmp
++#endif
++
++/* Compare S1 and S2 as strings holding indices/version numbers,
++   returning less than, equal to or greater than zero if S1 is less than,
++   equal to or greater than S2 (for more info, see the texinfo doc).
++*/
++
++int
++__strverscmp (const char *s1, const char *s2)
++{
++  const unsigned char *p1 = (const unsigned char *) s1;
++  const unsigned char *p2 = (const unsigned char *) s2;
++  unsigned char c1, c2;
++  int state;
++  int diff;
++
++  /* Symbol(s)    0       [1-9]   others  (padding)
++     Transition   (10) 0  (01) d  (00) x  (11) -   */
++  static const unsigned int next_state[] =
++  {
++      /* state    x    d    0    - */
++      /* S_N */  S_N, S_I, S_Z, S_N,
++      /* S_I */  S_N, S_I, S_I, S_I,
++      /* S_F */  S_N, S_F, S_F, S_F,
++      /* S_Z */  S_N, S_F, S_Z, S_Z
++  };
++
++  static const int result_type[] =
++  {
++      /* state   x/x  x/d  x/0  x/-  d/x  d/d  d/0  d/-
++                 0/x  0/d  0/0  0/-  -/x  -/d  -/0  -/- */
++
++      /* S_N */  CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
++                 CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
++      /* S_I */  CMP, -1,  -1,  CMP,  1,  LEN, LEN, CMP,
++                  1,  LEN, LEN, CMP, CMP, CMP, CMP, CMP,
++      /* S_F */  CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
++                 CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
++      /* S_Z */  CMP,  1,   1,  CMP, -1,  CMP, CMP, CMP,
++                 -1,  CMP, CMP, CMP
++  };
++
++  if (p1 == p2)
++    return 0;
++
++  c1 = *p1++;
++  c2 = *p2++;
++  /* Hint: '0' is a digit too.  */
++  state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
++
++  while ((diff = c1 - c2) == 0 && c1 != '\0')
++    {
++      state = next_state[state];
++      c1 = *p1++;
++      c2 = *p2++;
++      state |= (c1 == '0') + (ISDIGIT (c1) != 0);
++    }
++
++  state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
++
++  switch (state)
++    {
++    case CMP:
++      return diff;
++
++    case LEN:
++      while (ISDIGIT (*p1++))
++      if (!ISDIGIT (*p2++))
++        return 1;
++
++      return ISDIGIT (*p2) ? -1 : diff;
++
++    default:
++      return state;
++    }
++}
++#ifdef weak_alias
++weak_alias (__strverscmp, strverscmp)
++#endif
diff --git a/ipv6/ptrtd/Makefile b/ipv6/ptrtd/Makefile
new file mode 100644 (file)
index 0000000..9ba0072
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# 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:=ptrtd
+PKG_VERSION:=0.5.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://v6web.litech.org/ptrtd/dist/
+PKG_MD5SUM:=bfe026445fdc4fe509a9c70ec4551744
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ptrtd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-ipv6 +kmod-tun +ip
+  TITLE:=Portable Transport Relay Translator Daemon
+  URL:=http://v6web.litech.org/ptrtd/
+endef
+
+define Package/ptrtd/description
+       The Portable Transport Relay Translator Daemon (pTRTd)
+       is a method of allowing IPv6 hosts to communicate with IPv4 hosts.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)"
+
+define Package/ptrtd/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/ptrtd.init $(1)/etc/init.d/ptrtd
+endef
+
+$(eval $(call BuildPackage,ptrtd))
diff --git a/ipv6/ptrtd/files/ptrtd.init b/ipv6/ptrtd/files/ptrtd.init
new file mode 100644 (file)
index 0000000..6d7cf68
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=60
+
+PREFIX="3ffe:abcd:1234:9876::"
+LEN=64
+
+start() {
+       service_start /usr/sbin/ptrtd -p $PREFIX -l $LEN
+}
+
+stop() {
+       service_stop /usr/sbin/ptrtd
+}
diff --git a/ipv6/ptrtd/patches/100-ptrtd-0.5.2-openwrt.patch b/ipv6/ptrtd/patches/100-ptrtd-0.5.2-openwrt.patch
new file mode 100644 (file)
index 0000000..3a9d003
--- /dev/null
@@ -0,0 +1,41 @@
+--- ptrtd-0.5.2/ptrtd.old      2007-02-22 16:10:57.896689015 +0100
++++ ptrtd-0.5.2/ptrtd.c        2007-02-22 16:11:39.194388792 +0100
+@@ -201,13 +201,13 @@
+       if( do_config )
+       {
+               printf( "Tunnel: %s\n", ifname );
+-              sprintf( cmd, "/sbin/ip link set %s up", ifname );
++              sprintf( cmd, "/usr/sbin/ip link set %s up", ifname );
+               printf( "command: %s\n", cmd );
+               system( cmd );
+-              sprintf( cmd, "/sbin/ip addr add fe80::1/64 dev %s", ifname );
++              sprintf( cmd, "/usr/sbin/ip addr add fe80::1/64 dev %s", ifname );
+               printf( "command: %s\n", cmd );
+               system( cmd );
+-              sprintf( cmd, "/sbin/ip route add %s/%d dev %s via fe80::5",
++              sprintf( cmd, "/usr/sbin/ip route add %s/%d dev %s via fe80::5",
+                               prefix, plen, ifname );
+               printf( "command: %s\n", cmd );
+               system( cmd );
+--- ptrtd-0.5.2/tap802ipd.old  2007-02-22 16:11:22.600920230 +0100
++++ ptrtd-0.5.2/tap802ipd.c    2007-02-22 16:11:51.040581581 +0100
+@@ -125,16 +125,16 @@
+       tap_get_name( (struct iface *)tap_iface, ifname );
+       printf( "Tunnel: %s\n", ifname );
+-      sprintf( cmd, "/sbin/ip link set %s address %02x:%02x:%02x:%02x:%02x:%02x up\n", ifname,
++      sprintf( cmd, "/usr/sbin/ip link set %s address %02x:%02x:%02x:%02x:%02x:%02x up\n", ifname,
+                       ip_iface->hwaddr[0], ip_iface->hwaddr[1],
+                       ip_iface->hwaddr[2], ip_iface->hwaddr[3],
+                       ip_iface->hwaddr[4], ip_iface->hwaddr[5] );
+       printf( "command: %s\n", cmd );
+       system( cmd );
+-      //sprintf( cmd, "/sbin/ip addr add fe80::1/64 dev %s", ifname );
++      //sprintf( cmd, "/usr/sbin/ip addr add fe80::1/64 dev %s", ifname );
+       //printf( "command: %s\n", cmd );
+       //system( cmd );
+-      //sprintf( cmd, "/sbin/ip route add %s/%d dev %s via fe80::5", prefix, plen, ifname );
++      //sprintf( cmd, "/usr/sbin/ip route add %s/%d dev %s via fe80::5", prefix, plen, ifname );
+       //printf( "command: %s\n", cmd );
+       //system( cmd );
+ }
diff --git a/ipv6/radvd/Makefile b/ipv6/radvd/Makefile
new file mode 100644 (file)
index 0000000..61d47c4
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2006-2012 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:=radvd
+PKG_VERSION:=1.9.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://v6web.litech.org/radvd/dist \
+               http://download.sourcemage.org/mirror
+PKG_MD5SUM:=e807ad7e9a76d46b6133df391385cd31
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/radvd/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=IPv6 Routing Advertisement
+  URL:=http://v6web.litech.org/radvd/
+  DEPENDS:=+kmod-ipv6 +libdaemon
+endef
+
+define Package/radvd
+  $(call Package/radvd/Default)
+  TITLE+= Daemon
+endef
+
+define Package/radvd/description
+radvd is the router advertisement daemon for IPv6. It listens to router
+solicitations and sends router advertisements as described in "Neighbor
+Discovery for IP Version 6 (IPv6)" (RFC 4861).  With these advertisements hosts
+can automatically configure their addresses and some other parameters. They also
+can choose a default router based on these advertisements.
+endef
+
+define Package/radvdump
+  $(call Package/radvd/Default)
+  TITLE+= Dumper
+endef
+
+define Package/radvdump/description
+radvdump prints out the contents of incoming router advertisements sent by radvd
+or some other software implementing (parts of) "Neighbor Discovery for IP
+Version 6 (IPv6)" (RFC 4861).
+endef
+
+CONFIGURE_ARGS += \
+       --with-configfile=/etc/radvd.conf \
+       --with-logfile=/var/log/radvd.log \
+       --with-pidfile=/var/run/radvd.pid
+
+define Package/radvd/conffiles
+/etc/config/radvd
+endef
+
+define Package/radvd/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/radvd.config $(1)/etc/config/radvd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/radvd.init $(1)/etc/init.d/radvd
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radvd $(1)/usr/sbin/
+endef
+
+define Package/radvdump/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radvdump $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,radvd))
+$(eval $(call BuildPackage,radvdump))
diff --git a/ipv6/radvd/files/radvd.config b/ipv6/radvd/files/radvd.config
new file mode 100644 (file)
index 0000000..1616c15
--- /dev/null
@@ -0,0 +1,32 @@
+config interface
+       option interface        'lan'
+       option AdvSendAdvert    1
+       option AdvManagedFlag   0
+       option AdvOtherConfigFlag 0
+       list client             ''
+       option ignore           1
+
+config prefix
+       option interface        'lan'
+       # If not specified, a non-link-local prefix of the interface is used
+       list prefix             ''
+       option AdvOnLink        1
+       option AdvAutonomous    1
+       option AdvRouterAddr    0
+       option ignore           1
+
+config route
+       option interface        'lan'
+       list prefix             ''
+       option ignore           1
+
+config rdnss
+       option interface        'lan'
+       # If not specified, the link-local address of the interface is used
+       list addr               ''
+       option ignore           1
+
+config dnssl
+       option interface        'lan'
+       list suffix             ''
+       option ignore           1
diff --git a/ipv6/radvd/files/radvd.init b/ipv6/radvd/files/radvd.init
new file mode 100644 (file)
index 0000000..8311c35
--- /dev/null
@@ -0,0 +1,416 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+# Copyright (C) 2008  Alina Friedrichsen <x-alina@gmx.net>
+
+START=50
+
+SERVICE_USE_PID=1
+
+RADVD_INTERFACE_STRING_OPTIONS='MaxRtrAdvInterval MinRtrAdvInterval MinDelayBetweenRAs AdvLinkMTU AdvReachableTime AdvRetransTimer AdvCurHopLimit AdvDefaultLifetime AdvDefaultPreference HomeAgentLifetime HomeAgentPreference'
+RADVD_INTERFACE_BOOLEAN_OPTIONS='IgnoreIfMissing AdvSendAdvert UnicastOnly AdvManagedFlag AdvOtherConfigFlag AdvSourceLLAddress AdvHomeAgentFlag AdvHomeAgentInfo AdvMobRtrSupportFlag AdvIntervalOpt'
+
+RADVD_PREFIX_STRING_OPTIONS='AdvValidLifetime AdvPreferredLifetime'
+RADVD_PREFIX_BOOLEAN_OPTIONS='AdvOnLink AdvAutonomous AdvRouterAddr DeprecatePrefix DecrementLifetimes'
+
+RADVD_ROUTE_STRING_OPTIONS='AdvRouteLifetime AdvRoutePreference'
+RADVD_ROUTE_BOOLEAN_OPTIONS='RemoveRoute'
+
+RADVD_RDNSS_STRING_OPTIONS='AdvRDNSSLifetime FlushRDNSS'
+
+RADVD_DNSSL_STRING_OPTIONS='AdvDNSSLLifetime FlushDNSSL'
+
+validate_varname() {
+       local varname=$1
+       [ -z "$varname" -o "$varname" != "${varname%%[!A-Za-z0-9_]*}" ] && return 1
+       return 0
+}
+
+validate_ip6addr() {
+       local ip6addr=$1
+       [ -z "$ip6addr" -o "$ip6addr" != "${ip6addr%%[!A-Fa-f0-9.:]*}" ] && return 1
+       return 0
+}
+
+validate_ip6prefix() {
+       local ip6prefix=$1
+       [ -z "$ip6prefix" -o "$ip6prefix" != "${ip6prefix%%[!A-Fa-f0-9./:]*}" ] && return 1
+       return 0
+}
+
+validate_radvd_string() {
+       local radvd_string=$1
+       [ -z "$radvd_string" -o "$radvd_string" != "${radvd_string%%[!A-Za-z0-9.:_-]*}" ] && return 1
+       return 0
+}
+
+get_ip6addr() {
+       local ifname=$1
+       local scope=$2
+       local iproute2_scope
+       local ifconfig_scope
+       local ip6addr
+
+       case "$scope" in
+               host) iproute2_scope=host ifconfig_scope=Host;;
+               link) iproute2_scope=link ifconfig_scope=Link;;
+               site) iproute2_scope=site ifconfig_scope=Site;;
+               global) iproute2_scope=global ifconfig_scope=Global;;
+               "") get_ip6addr "$ifname" global || get_ip6addr "$ifname" site; return;;
+               *) return 1;;
+       esac
+
+       ip6addr=$(LANG=C ip -f inet6 -- addr show dev "$ifname" 2> /dev/null | sed -n -e 's/^  *inet6 \([A-Fa-f0-9.:]*[/][0-9]*\) scope '"$iproute2_scope"' $/\1/p' | head -n 1)
+       if [ -z "$ip6addr" ]; then
+               ip6addr=$(LANG=C ifconfig "$ifname" 2> /dev/null | sed -n -e 's/^  *inet6 addr: \([A-Fa-f0-9.:]*[/][0-9]*\) Scope:'"$ifconfig_scope"'$/\1/p' | tail -n 1)
+               [ -z "$ip6addr" ] && return 1
+       fi
+
+       printf '%s\n' "$ip6addr"
+
+       return 0
+}
+
+radvd_find_config_file() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+       config_get RADVD_CONFIG_FILE "$cfg" config_file
+
+       return 0
+}
+
+radvd_add_interface() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+       local ignore
+       local interfaces
+       local interface
+       local list_interface
+       local exist
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+
+       config_get interfaces "$cfg" interface
+       for interface in $interfaces; do
+               validate_varname "$interface" || continue
+               exist=0
+               for list_interface in $RADVD_INTERFACES; do
+                       [ "$interface" = "$list_interface" ] && exist=1
+               done
+               [ "$exist" -eq 0 ] && RADVD_INTERFACES="$RADVD_INTERFACES $interface"
+       done
+
+       return 0
+}
+
+radvd_write_interface() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+       local ignore
+       local interfaces
+       local interface
+       local name
+       local value
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+
+       config_get interfaces "$cfg" interface
+       exist=0
+       for interface in $interfaces; do
+               [ "$INTERFACE" = "$interface" ] && exist=1
+       done
+       [ "$exist" -eq 0 ] && return 0
+
+       for name in $RADVD_INTERFACE_STRING_OPTIONS; do
+               config_get value "$cfg" "$name"
+               validate_radvd_string "$value" || continue
+               printf '\t%s %s;\n' "$name" "$value"
+       done
+
+       for name in $RADVD_INTERFACE_BOOLEAN_OPTIONS; do
+               config_get value "$cfg" "$name"
+               [ -z "$value" ] && continue
+               config_get_bool value "$cfg" "$name" 0
+               if [ "$value" -ne 0 ]; then 
+                       printf '\t%s on;\n' "$name"
+               else
+                       printf '\t%s off;\n' "$name"
+               fi
+       done
+
+       config_get clients "$cfg" client
+       if [ -n "$clients" ]; then
+               printf '\n\tclients\n\t{\n'
+
+               for client in $clients; do
+                       validate_ip6addr "$client" || continue
+                       printf '\t\t%s;\n' "$client"
+               done
+
+               printf '\t};\n'
+       fi
+
+       return 0
+}
+
+radvd_write_prefix() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+       local ignore
+       local interfaces
+       local interface
+       local device
+       local prefixes
+       local prefix
+       local name
+       local value
+       local cfgt
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+
+       config_get interfaces "$cfg" interface
+       exist=0
+       for interface in $interfaces; do
+               [ "$INTERFACE" = "$interface" ] && exist=1
+       done
+       [ "$exist" -eq 0 ] && return 0
+
+       config_get prefixes "$cfg" prefix
+       if [ -z "$prefixes" ]; then
+               prefixes=$(get_ip6addr "$IFNAME") || return 0
+       fi
+
+       for prefix in $prefixes; do
+               validate_ip6prefix "$prefix" || continue
+               printf '\n\tprefix %s\n\t{\n' "$prefix"
+
+               for name in $RADVD_PREFIX_STRING_OPTIONS; do
+                       config_get value "$cfg" "$name"
+                       validate_radvd_string "$value" || continue
+                       printf '\t\t%s %s;\n' "$name" "$value"
+               done
+
+               for name in $RADVD_PREFIX_BOOLEAN_OPTIONS; do
+                       config_get value "$cfg" "$name"
+                       [ -z "$value" ] && continue
+                       config_get_bool value "$cfg" "$name" 0
+                       if [ "$value" -ne 0 ]; then 
+                               printf '\t\t%s on;\n' "$name"
+                       else
+                               printf '\t\t%s off;\n' "$name"
+                       fi
+               done
+
+               config_get value "$cfg" Base6Interface
+               if [ -n "$value" ]; then
+                       if network_get_device device "$value"; then
+                               printf '\t\t%s %s;\n' "Base6Interface" "$device"
+                       fi
+               fi
+
+               config_get value "$cfg" Base6to4Interface
+               if [ -n "$value" ]; then
+                       if network_get_device device "$value"; then
+                               printf '\t\t%s %s;\n' "Base6to4Interface" "$device"
+                       fi
+               fi
+
+               printf '\t};\n'
+       done
+
+       return 0
+}
+
+radvd_write_route() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+       local ignore
+       local interfaces
+       local interface
+       local prefixes
+       local prefix
+       local name
+       local value
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+
+       config_get interfaces "$cfg" interface
+       exist=0
+       for interface in $interfaces; do
+               [ "$INTERFACE" = "$interface" ] && exist=1
+       done
+       [ "$exist" -eq 0 ] && return 0
+
+       config_get prefixes "$cfg" prefix
+       for prefix in $prefixes; do
+               validate_ip6prefix "$prefix" || continue
+               printf '\n\troute %s\n\t{\n' "$prefix"
+
+               for name in $RADVD_ROUTE_STRING_OPTIONS; do
+                       config_get value "$cfg" "$name"
+                       validate_radvd_string "$value" || continue
+                       printf '\t\t%s %s;\n' "$name" "$value"
+               done
+
+               for name in $RADVD_ROUTE_BOOLEAN_OPTIONS; do
+                       config_get value "$cfg" "$name"
+                       [ -z "$value" ] && continue
+                       config_get_bool value "$cfg" "$name" 0
+                       if [ "$value" -ne 0 ]; then 
+                               printf '\t\t%s on;\n' "$name"
+                       else
+                               printf '\t\t%s off;\n' "$name"
+                       fi
+               done
+
+               printf '\t};\n'
+       done
+
+       return 0
+}
+
+radvd_write_rdnss() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+       local ignore
+       local interfaces
+       local interface
+       local addrs
+       local addr
+       local addr_list
+       local name
+       local value
+       local i
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+
+       config_get interfaces "$cfg" interface
+       exist=0
+       for interface in $interfaces; do
+               [ "$INTERFACE" = "$interface" ] && exist=1
+       done
+       [ "$exist" -eq 0 ] && return 0
+
+       config_get addrs "$cfg" addr
+       i=0
+       for addr in $addrs; do
+               [ "$i" -ge 3 ] && break
+               validate_ip6addr "$addr" || continue
+               addr_list="$addr_list $addr"
+               i=$(($i+1))
+       done
+
+       if [ -z "$addr_list" ]; then
+               addr=$(get_ip6addr "$IFNAME" link) || return 0
+               addr_list=" ${addr%%[/]*}"
+       fi
+
+       printf '\n\tRDNSS%s\n\t{\n' "$addr_list"
+
+       for name in $RADVD_RDNSS_STRING_OPTIONS; do
+               config_get value "$cfg" "$name"
+               validate_radvd_string "$value" || continue
+               printf '\t\t%s %s;\n' "$name" "$value"
+       done
+
+       printf '\t};\n'
+
+       return 0
+}
+
+radvd_write_dnssl() {
+       local cfg=$1
+       validate_varname "$cfg" || return 0
+       local ignore
+       local interfaces
+       local interface
+       local suffixes
+       local suffix
+       local suffix_list
+       local name
+       local value
+
+       config_get_bool ignore "$cfg" ignore 0
+       [ "$ignore" -ne 0 ] && return 0
+
+       config_get interfaces "$cfg" interface
+       exist=0
+       for interface in $interfaces; do
+               [ "$INTERFACE" = "$interface" ] && exist=1
+       done
+       [ "$exist" -eq 0 ] && return 0
+
+       config_get suffixes "$cfg" suffix
+       for suffix in $suffixes; do
+               validate_radvd_string "$suffix" || continue
+               suffix_list="$suffix_list $suffix"
+       done
+
+       printf '\n\tDNSSL%s\n\t{\n' "$suffix_list"
+
+       for name in $RADVD_DNSSL_STRING_OPTIONS; do
+               config_get value "$cfg" "$name"
+               validate_radvd_string "$value" || continue
+               printf '\t\t%s %s;\n' "$name" "$value"
+       done
+
+       printf '\t};\n'
+
+       return 0
+}
+
+radvd_write_config() {
+       . /lib/functions/network.sh
+
+       RADVD_INTERFACES=
+       config_foreach radvd_add_interface interface
+       config_foreach radvd_add_interface prefix
+       config_foreach radvd_add_interface route
+       config_foreach radvd_add_interface RDNSS
+       config_foreach radvd_add_interface DNSSL
+
+       for INTERFACE in $RADVD_INTERFACES; do
+               network_get_device IFNAME "$INTERFACE" || continue
+               printf 'interface %s\n{\n' "$IFNAME"
+               config_foreach radvd_write_interface interface
+               config_foreach radvd_write_prefix prefix
+               config_foreach radvd_write_route route
+               config_foreach radvd_write_rdnss rdnss
+               config_foreach radvd_write_dnssl dnssl
+               printf '};\n\n'
+       done
+
+       return 0
+}
+
+start() {
+       config_load radvd
+
+       RADVD_CONFIG_FILE=
+       config_foreach radvd_find_config_file radvd
+
+       if [ -z "$RADVD_CONFIG_FILE" ]; then
+               mkdir -p -- /var/etc/
+               radvd_write_config > /var/etc/radvd.conf
+               if [ -s "/var/etc/radvd.conf" ]; then
+                       RADVD_CONFIG_FILE=/var/etc/radvd.conf
+               fi
+       fi
+
+       [ -z "$RADVD_CONFIG_FILE" ] && return 1
+
+       sysctl -w net.ipv6.conf.all.forwarding=1 > /dev/null 2> /dev/null
+
+       service_start /usr/sbin/radvd -C "$RADVD_CONFIG_FILE" -m stderr_syslog -p /var/run/radvd.pid
+}
+
+stop() {
+       service_stop /usr/sbin/radvd
+}
diff --git a/ipv6/radvd/patches/100-silent-netlink-config-reload.patch b/ipv6/radvd/patches/100-silent-netlink-config-reload.patch
new file mode 100644 (file)
index 0000000..049d654
--- /dev/null
@@ -0,0 +1,67 @@
+--- a/netlink.c
++++ b/netlink.c
+@@ -67,7 +67,7 @@ void process_netlink_msg(int sock)
+               else {
+                       dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is *NOT* running", ifname, ifinfo->ifi_index);
+               }
+-              reload_config();
++              reload_config(LOG_DEBUG);
+       }
+ }
+--- a/radvd.c
++++ b/radvd.c
+@@ -443,7 +443,7 @@ void main_loop(void)
+               if (sighup_received)
+               {
+                       dlog(LOG_INFO, 3, "sig hup received.\n");
+-                      reload_config();
++                      reload_config(LOG_INFO);
+                       sighup_received = 0;
+               }
+@@ -552,11 +552,11 @@ stop_adverts(void)
+       }
+ }
+-void reload_config(void)
++void reload_config(int loglevel)
+ {
+       struct Interface *iface;
+-      flog(LOG_INFO, "attempting to reread config file");
++      flog(loglevel, "attempting to reread config file");
+       iface=IfaceList;
+       while(iface)
+@@ -626,7 +626,7 @@ void reload_config(void)
+       config_interface();
+       kickoff_adverts();
+-      flog(LOG_INFO, "resuming normal operation");
++      flog(loglevel, "resuming normal operation");
+ }
+ void
+--- a/radvd.h
++++ b/radvd.h
+@@ -185,7 +185,7 @@ int yylex(void);
+ /* radvd.c */
+ int check_ip6_forwarding(void);
+-void reload_config(void);
++void reload_config(int);
+ void reset_prefix_lifetimes(void);
+ /* timer.c */
+--- a/send.c
++++ b/send.c
+@@ -154,7 +154,7 @@ send_ra(struct Interface *iface, struct
+                        * reload_config() will kick off new timers anyway.  This avoids
+                        * timer list corruption.
+                        */
+-                      reload_config();
++                      reload_config(LOG_INFO);
+                       return -1;
+               }
+       }
diff --git a/ipv6/send/Makefile b/ipv6/send/Makefile
new file mode 100644 (file)
index 0000000..ca60c23
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2008-2009 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:=send
+PKG_VERSION:=0.2-5.4
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)d_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://mobisend.org/debian-mobisend/pool/main/s/sendd/
+PKG_MD5SUM:=99c18e5d965e57d580f146d00145251a
+PKG_BUILD_DIR:=$(BUILD_DIR)/sendd-0.2
+
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/send
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Secure Neighbor Discovery implementation
+  URL:=http://mobisend.org/debian-mobisend.html
+  DEPENDS:=+kmod-ipv6 +ip6tables +libnetfilter-queue +libopenssl +libreadline +libncurses
+endef
+
+define Package/send/description
+       DoCoMo's Open Source SEND project provides an implementation of RFC 3971
+       Secure Neighbor Discovery (SEND). SEND cryptographically secures the
+       IPv6 neighbor discovery protocol, countering the threats discussed in
+       RFC 3756 (IPv6 Neighbor Discovery (ND) Trust Models and Threats).
+endef
+
+define Package/send/conffiles
+/etc/sendd/sendd.conf
+/etc/sendd/params.conf
+endef
+
+TARGET_CPPFLAGS+=-D_GNU_SOURCE
+
+MAKE_FLAGS += \
+       CC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libnetfilter_queue $(TARGET_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS) -lnfnetlink" \
+
+define Package/send/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sendd/sendd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/sendd/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/examples/sendd.conf $(1)/etc/sendd/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/examples/params.conf $(1)/etc/sendd/
+endef
+
+$(eval $(call BuildPackage,send))
diff --git a/ipv6/send/patches/001-libnetfilter_queue_update.patch b/ipv6/send/patches/001-libnetfilter_queue_update.patch
new file mode 100644 (file)
index 0000000..f300d7c
--- /dev/null
@@ -0,0 +1,388 @@
+# Update sendd to:
+#
+# - use $DESTDIR for prefix (Debian interest)
+# - use libnetfilter_queue instead of deprecated libipq
+#
+# Under GPLv2 - Copyright (C) 2008 - EADS - Arnaud Ebalard <arno@natisbad.org>
+--- a/Makefile.config
++++ b/Makefile.config
+@@ -19,7 +19,7 @@ OS=linux
+ #CC=gcc-4.0
+ # Where to install
+-prefix=/usr
++prefix=$(DESTDIR)/usr
+ # Set to "y" to build MT versions of sendd and cgatool
+ USE_THREADS=n
+--- a/README
++++ b/README
+@@ -20,7 +20,7 @@ Linux:
+   o CONFIG_NETFILTER, CONFIG_IPV6, CONFIG_IP6_NF_QUEUE, CONFIG_IP6_NF_IPTABLES,
+     CONFIG_IP6_NF_FILTER enabled in your kernel config.
+   o netfilter ip6tables command
+-  o netfilter libipq development library and headers
++  o netfilter libnetfilter_queue development library and headers
+ FreeBSD:
+   o NETGRAPH, NETGRAPH_BPF, NETGRAPH_ETHER, NETGRAPH_SOCKET enabled in
+--- a/cgatool/Makefile
++++ b/cgatool/Makefile
+@@ -25,7 +25,7 @@ endif
+ ifeq ($(USE_CONSOLE),y)
+ ifeq ($(USE_READLINE),y)
+-LDLIBS += -lreadline -lncurses
++LDLIBS += -lreadline
+ endif
+ endif
+--- a/sendd/Makefile
++++ b/sendd/Makefile
+@@ -37,7 +37,7 @@ endif
+ ifeq ($(USE_CONSOLE),y)
+ ifeq ($(USE_READLINE),y)
+-LDLIBS += -lreadline -lncurses
++LDLIBS += -lreadline
+ endif
+ endif
+--- a/sendd/os-linux/Makefile
++++ b/sendd/os-linux/Makefile
+@@ -1,23 +1,5 @@
+ OBJS += os/addr.o os/ipq.o os/rand.o os/snd_linux.o
+-OSLIBS= -ldl -lipq
++OSLIBS= -lnetfilter_queue
+-OSEXTRA= os/sendd os/snd_upd_fw
+-
+-ETCINIT= /etc/init.d
+-EXTRAINSTALL= $(ETCINIT)/sendd $(ETCINIT)/snd_upd_fw $(ETCINIT)/snd_fw_functions.sh
+-EXTRAUNINSTALL=$(EXTRAINSTALL)
+-EXTRACLEAN= os/sendd os/snd_upd_fw os/snd_fw_functions.sh
+-
+-$(ETCINIT)/%: os/%
+-      install $< $@
+-
+-os/%: os/%.in
+-      sed "s/@etcinit@/\/etc\/init.d/g" $< > $@
+-
+-os/%: os/%.in2
+-      @./os/find_ip6tables.sh
+-
+-# Sometimes libipq.h is installed in include/libipq.h, other times it is
+-# installed in include/libipq/libipq.h. This rule helps cpp to find it.
+-os/ipq.o: CPPFLAGS += -I/usr/include/libipq -I/usr/local/include/libipq
++os/ipq.o: CPPFLAGS += -I/usr/include/libnetfilter_queue
+--- a/sendd/os-linux/ipq.c
++++ b/sendd/os-linux/ipq.c
+@@ -32,8 +32,9 @@
+ #include <sys/select.h>
+ #include <netinet/in.h>
++#include <linux/types.h>
+ #include <linux/netfilter.h>
+-#include <libipq.h>
++#include <libnetfilter_queue.h>
+ #include "config.h"
+ #include <applog.h>
+@@ -42,122 +43,170 @@
+ #include "../sendd_local.h"
+ #include "snd_linux.h"
+-static struct ipq_handle *qh;
+-
+ extern unsigned if_nametoindex(const char *);
+-static inline void
+-process_pkt(ipq_packet_msg_t *pkt, struct sbuff *b)
+-{
++struct nfq_handle *h = NULL;
++struct nfq_q_handle *qh = NULL;
++
++/* This is the default queue number used in our init script */
++#define SND_DEFAULT_NFQUEUE_NUMBER 13
++
++/* The sbuff is must be made available to the callback function that will
++   handle the packet */
++struct callback_data {
++      struct sbuff *b;
++};
++
++struct callback_data process_pkt_data;
++
++/* nfqueue callback */
++static int process_pkt(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,
++                     struct nfq_data *nfa, void *data)
++{
++      struct callback_data * d = (struct callback_data *)data;
++      struct nfqnl_msg_packet_hdr *ph;
++      struct sbuff *b = d->b;
++      char *pkt_data;
+       int in, ifidx;
+-      b->data = pkt->payload;
+-      b->len = pkt->data_len;
++      b->len = nfq_get_payload(nfa, &pkt_data);
++      if (b->len == -1) {
++              applog(LOG_ERR, "%s: nfq_get_payload() failed.", __FUNCTION__);
++              return 0;
++      }
++      b->data = (unsigned char *)pkt_data;
+-      if (*(pkt->indev_name)) {
++      if ((ifidx = nfq_get_indev(nfa)) && ifidx != 0)
+               in = 1;
+-              ifidx = if_nametoindex(pkt->indev_name);
+-      } else if (*(pkt->outdev_name)) {
++      else if ((ifidx = nfq_get_outdev(nfa)) && ifidx != 0)
+               in = 0;
+-              ifidx = if_nametoindex(pkt->outdev_name);
+-      } else {
++      else {
+               applog(LOG_ERR, "%s: pkt has neither indev nor outdev",
+                      __FUNCTION__);
+               snd_put_buf(b);
+-              return;
++              return 0;
+       }
+-      snd_recv_pkt(b, ifidx, in, pkt);
+-}
++      /* Grab packet header to get its id later */
++      ph = nfq_get_msg_packet_hdr(nfa); /* FIXME Check return value */
+-static void
+-ipq_recv_pkt(void)
+-{
+-      int r;
+-      struct sbuff *b = snd_get_buf();
++      snd_recv_pkt(b, ifidx, in, (void *)ph);
+-      if (b == NULL) {
+-              return;
+-      }
+-      if ((r = ipq_read(qh, b->head, b->rem, -1)) < 0) {
+-              applog(LOG_ERR, "%s: ipq_read(): %s", __FUNCTION__,
+-                     ipq_errstr());
+-              goto fail;
+-      } else if (r == 0) {
+-              /* timeout */
+-              goto fail;
+-      }
+-
+-      switch ((r = ipq_message_type(b->head))) {
+-      case NLMSG_ERROR:
+-              applog(LOG_ERR, "%s: nlmsg error: %s", __FUNCTION__,
+-                     strerror(ipq_get_msgerr(b->head)));
+-              goto fail;
+-      case IPQM_PACKET:
+-              process_pkt(ipq_get_packet(b->head), b);
+-              return;
+-      default:
+-              break;
+-      }
+-
+-fail:
+-      snd_put_buf(b);
++      return 1;
+ }
+ void
+-linux_ipq_add_fds(fd_set *fds, int *maxfd)
++linux_nfq_add_fds(fd_set *fds, int *maxfd)
+ {
+-      FD_SET(qh->fd, fds);
+-      *maxfd = sendd_max(*maxfd, qh->fd);
++      int fd = nfnl_fd(nfq_nfnlh(h));
++
++      FD_SET(fd, fds);
++      *maxfd = sendd_max(*maxfd, fd);
+ }
+ void
+-linux_ipq_dispatch_fds(fd_set *fds)
++linux_nfq_dispatch_fds(fd_set *fds)
+ {
+-      if (FD_ISSET(qh->fd, fds)) {
+-              ipq_recv_pkt();
++      int fd = nfnl_fd(nfq_nfnlh(h));
++      int r;
++
++      if (FD_ISSET(fd, fds)) {
++              struct sbuff *b = snd_get_buf();
++
++              if (b == NULL) {
++                      return;
++              }
++
++              if ((r = recv(fd, b->head, b->rem, 0)) && r <= 0) {
++                      if (r < 0) /* not a timeout */
++                              applog(LOG_ERR, "%s: recv failed.",
++                                     __FUNCTION__);
++                      snd_put_buf(b);
++                      return;
++              }
++
++              process_pkt_data.b = b; /* make sbuff available to
++                                         callback function */
++              nfq_handle_packet(h, (char *)b->head, r);
+       }
+ }
+ void
+ os_specific_deliver_pkt(void *p, struct sbuff *b, int drop, int changed)
+ {
+-      ipq_packet_msg_t *pkt = p;
+-      void *newpkt = NULL;
++      struct nfqnl_msg_packet_hdr *ph = (struct nfqnl_msg_packet_hdr *)p;
++      unsigned char *newpkt = NULL;
+       int plen = 0;
++      uint32_t id = 0;
++
++      if (ph)
++              id = ntohl(ph->packet_id);
+       if (changed && !drop) {
+-              newpkt = sbuff_data(b);
++              newpkt = (unsigned char *)b->data;
+               plen = b->len;
+       }
+-      ipq_set_verdict(qh, pkt->packet_id, drop ? NF_DROP : NF_ACCEPT,
+-                      plen, newpkt);
++      nfq_set_verdict(qh, id, drop ? NF_DROP : NF_ACCEPT, plen, newpkt);
+       snd_put_buf(b);
+ }
+ int
+-linux_ipq_init(void)
++linux_nfq_init(void)
+ {
+-      if ((qh = ipq_create_handle(0, PF_INET6)) == NULL) {
+-              applog(LOG_ERR, "%s: ipq_create_handle() failed: %s",
+-                     __FUNCTION__, ipq_errstr());
+-              return (-1);
+-      }
+-      if (ipq_set_mode(qh, IPQ_COPY_PACKET, SND_MAX_PKT) < 0) {
+-              applog(LOG_ERR, "%s: ipq_set_mode() failed: %s",
+-                     __FUNCTION__, ipq_errstr());
+-              if (errno == ECONNREFUSED) {
+-                      applog(LOG_ERR, "%s: perhaps you need to modprobe "
+-                             "ip6_queue?", __FUNCTION__);
+-              }
+-              return (-1);
++      struct nfnl_handle *nh;
++      u_int16_t nfqueue_num = SND_DEFAULT_NFQUEUE_NUMBER;
++
++      /* Get netfilter queue connection handle */
++      h = nfq_open();
++      if (!h) {
++              applog(LOG_ERR, "%s: nfq_open() failed.", __FUNCTION__);
++              return -1;
++      }
++
++      /* Unbinding existing nfqueue handlers for AF_INET6. We ignore the
++         return value: http://www.spinics.net/lists/netfilter/msg42063.html.
++         Note that this call is required, otherwise, nfq_bind_pf() fails. */
++      nfq_unbind_pf(h, PF_INET6);
++
++      if (nfq_bind_pf(h, PF_INET6) < 0) {
++              applog(LOG_ERR, "%s: nfq_bind_pf failed.\n", __FUNCTION__);
++              return -1;
++      }
++
++      /* Binding this socket to queue number nfqueue_num and installing
++         our packet handler */
++      qh = nfq_create_queue(h, nfqueue_num,
++                            (nfq_callback *) &process_pkt,
++                            (void *)&process_pkt_data);
++      if (!qh) {
++              applog(LOG_ERR, "%s: nfq_create_queue() failed.\n",
++                     __FUNCTION__);
++              return -1;
++      }
++
++      /* Asking for entire copy of queued packets */
++      if (nfq_set_mode(qh, NFQNL_COPY_PACKET, 0xffff) < 0) { /* XXX was SND_MAX_PKT */
++              fprintf(stderr, "nfq_set_mode() failed.\n");
++              return -1;
+       }
+-      return (0);
++
++      /* XXX - Check if we have an interest in setting queue length */
++
++      /* The netlink handle associated with our queue connection handle */
++      nh = nfq_nfnlh(h);
++
++      return 0;
+ }
+ void
+-linux_ipq_fini(void)
++linux_nfq_fini(void)
+ {
+-      ipq_destroy_handle(qh);
++      /* Remove the binding for our queue handler*/
++      if (qh != NULL)
++              nfq_destroy_queue(qh);
++
++      /* Close connection associated with our connection handler */
++      if (h != NULL)
++              nfq_close(h);
+ }
+--- a/sendd/os-linux/snd_linux.c
++++ b/sendd/os-linux/snd_linux.c
+@@ -40,13 +40,13 @@
+ void
+ os_specific_add_fds(fd_set *fds, int *maxfd)
+ {
+-      linux_ipq_add_fds(fds, maxfd);
++      linux_nfq_add_fds(fds, maxfd);
+ }
+ void
+ os_specific_dispatch_fds(fd_set *fds)
+ {
+-      linux_ipq_dispatch_fds(fds);
++      linux_nfq_dispatch_fds(fds);
+ }
+ int
+@@ -59,7 +59,7 @@ int
+ os_specific_init(void)
+ {
+       if (linux_rand_init() < 0 ||
+-          linux_ipq_init() < 0) {
++          linux_nfq_init() < 0) {
+               return (-1);
+       }
+       return (0);
+@@ -68,6 +68,6 @@ os_specific_init(void)
+ void
+ os_specific_fini(void)
+ {
+-      linux_ipq_fini();
++      linux_nfq_fini();
+       linux_rand_fini();
+ }
+--- a/sendd/os-linux/snd_linux.h
++++ b/sendd/os-linux/snd_linux.h
+@@ -33,10 +33,10 @@
+ #ifndef       _SEND_LINUX_H
+ #define       _SEND_LINUX_H
+-extern void linux_ipq_add_fds(fd_set *, int *);
+-extern void linux_ipq_dispatch_fds(fd_set *);
+-extern int linux_ipq_init(void);
+-extern void linux_ipq_fini(void);
++extern void linux_nfq_add_fds(fd_set *, int *);
++extern void linux_nfq_dispatch_fds(fd_set *);
++extern int linux_nfq_init(void);
++extern void linux_nfq_fini(void);
+ extern void linux_rand_fini(void);
+ extern int linux_rand_init(void);
diff --git a/ipv6/send/patches/002-handle_max_bits_conf.patch b/ipv6/send/patches/002-handle_max_bits_conf.patch
new file mode 100644 (file)
index 0000000..ab4008c
--- /dev/null
@@ -0,0 +1,50 @@
+This patch allows one to specify a maximum number of bits
+for the CGA and RSA key size. RFC specifies that an implementation
+may optionnaly honor this setting (5.1.3). This is particularly
+useful on embedded systems where both the entropy and the processing
+power are limited.
+
+--- a/sendd/config.c
++++ b/sendd/config.c
+@@ -82,6 +82,7 @@ struct snd_conf snd_confs[] = {
+       SND_CFS(snd_cga_params, NULL, 1),
+       SND_CFIB(snd_full_secure, 1, 0),
+       SND_CFII(snd_min_key_bits, 1024, "bits", 0),
++      SND_CFII(snd_max_key_bits, 2048, "bits", 0),
+       SND_CFII(snd_nonce_cache_gc_intvl, 2, "seconds", 0),
+       SND_CFII(snd_pfx_cache_gc_intvl, 40, "seconds", 0),
+       SND_CFS(snd_pkixip_conf, NULL, 0),
+--- a/sendd/sig_rfc3971.c
++++ b/sendd/sig_rfc3971.c
+@@ -147,7 +147,7 @@ ver(struct iovec *iov, int iovlen, uint8
+       EVP_MD_CTX ctx[1];
+       EVP_PKEY *pub;
+       int rv = -1;
+-      int i, real_slen, min_bits;
++      int i, real_slen, min_bits, max_bits;
+       DEFINE_TIMESTAMP_VARS();
+       DBG_HEXDUMP(&dbg_cryptox, "key: ", key, klen);
+@@ -164,6 +164,12 @@ ver(struct iovec *iov, int iovlen, uint8
+                   "minimum: %d)", EVP_PKEY_bits(pub), min_bits);
+               return (-1);
+       }
++      max_bits = snd_conf_get_int(snd_max_key_bits);
++      if (EVP_PKEY_bits(pub) > max_bits) {
++              DBG(&dbg_snd, "Peer key too strong: %d bits (configured "
++                  "maximum: %d)", EVP_PKEY_bits(pub), max_bits);
++              return (-1);
++      }
+       real_slen = EVP_PKEY_size(pub);
+       if (real_slen < slen) {
+--- a/sendd/snd_config.h
++++ b/sendd/snd_config.h
+@@ -42,6 +42,7 @@ enum snd_conf_syms {
+       snd_cga_params,
+       snd_full_secure,
+       snd_min_key_bits,
++      snd_max_key_bits,
+       snd_nonce_cache_gc_intvl,
+       snd_pfx_cache_gc_intvl,
+       snd_pkixip_conf,
diff --git a/ipv6/send/patches/003-keysig_8bytes_alignment.patch b/ipv6/send/patches/003-keysig_8bytes_alignment.patch
new file mode 100644 (file)
index 0000000..561cc3e
--- /dev/null
@@ -0,0 +1,20 @@
+This patch aligns the structure describing the RSA signature
+option to 8 bytes. Before that, send was padding with N bytes
+(4 on 32-bits architectures) using a cast in sendd/proto_sig.c :
+
+       so = (struct snd_opt_sig *)(nd_so);
+
+which would align to the number of bytes representing a pointer
+on your architecture.
+
+--- a/sendd/snd_proto.h
++++ b/sendd/snd_proto.h
+@@ -69,7 +69,7 @@ struct snd_opt_sig {
+       uint32_t                reserved;       /* opt hdr + reserved */
+       uint8_t                 keyhash[SND_KEYHASH_LEN];
+       uint8_t                 sig[0];
+-};
++} __attribute__((aligned(8)));
+ struct snd_opt_timestamp {
+       uint8_t                 type;
diff --git a/ipv6/send/patches/004-always_link_with_ncurses.patch b/ipv6/send/patches/004-always_link_with_ncurses.patch
new file mode 100644 (file)
index 0000000..367baae
--- /dev/null
@@ -0,0 +1,26 @@
+We should always link with libncurses. This is not noticeable
+when building the debian packages because we install libncurses5
+runtime library as a dependency.
+
+--- a/cgatool/Makefile
++++ b/cgatool/Makefile
+@@ -17,7 +17,7 @@ LDLIBS= $(DEPLIBS)
+ LDFLAGS= -L../libs/.libs
+ endif
+-LDLIBS += -lcrypto
++LDLIBS += -lcrypto -lncurses
+ ifeq ($(USE_THREADS),y)
+ LDLIBS += -lpthread
+--- a/sendd/Makefile
++++ b/sendd/Makefile
+@@ -28,7 +28,7 @@ LDLIBS= $(DEPLIBS)
+ LDFLAGS= -L../libs/.libs
+ endif
+-LDLIBS += -lcrypto
++LDLIBS += -lcrypto -lncurses
+ LDLIBS += $(OSLIBS)
+ ifeq ($(USE_THREADS),y)
diff --git a/ipv6/send/patches/005-use-bundled-libconfig.patch b/ipv6/send/patches/005-use-bundled-libconfig.patch
new file mode 100644 (file)
index 0000000..99435f9
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/cgatool/cgatool.c
++++ b/cgatool/cgatool.c
+@@ -49,7 +49,7 @@
+ #include "config.h"
+ #include <applog.h>
+-#include <libconfig.h>
++#include "../libs/libconfig/libconfig.h"
+ #include <senddctl.h>
+ #include <cga.h>
+--- a/sendd/config.c
++++ b/sendd/config.c
+@@ -38,7 +38,7 @@
+ #include <net/if.h>
+ #include "config.h"
+-#include <libconfig.h>
++#include "../libs/libconfig/libconfig.h"
+ #include <applog.h>
+ #include "sendd_local.h"
diff --git a/ipv6/send/patches/006-openssl-1.0.0-compat.patch b/ipv6/send/patches/006-openssl-1.0.0-compat.patch
new file mode 100644 (file)
index 0000000..1df8a93
--- /dev/null
@@ -0,0 +1,143 @@
+--- a/include/cga_keyutils.h
++++ b/include/cga_keyutils.h
+@@ -40,8 +40,8 @@
+ extern int cga_add_key(cga_ctx_t *, EVP_PKEY *, int, uint16_t);
+ extern EVP_PKEY *cga_der2key(uint8_t *, int );
+-extern STACK *cga_der2keys(uint8_t *, int );
+-extern void cga_free_keystack(STACK *);
++extern STACK_OF(GENERAL_NAME) *cga_der2keys(uint8_t *, int );
++extern void cga_free_keystack(STACK_OF(GENERAL_NAME) *);
+ extern uint8_t *cga_key2der(EVP_PKEY *, int *);
+ extern int cga_load_cert(cga_ctx_t *, const char *);
+ extern int cga_load_key(cga_ctx_t *, const char *);
+--- a/libs/libcga/cga_keyutils.c
++++ b/libs/libcga/cga_keyutils.c
+@@ -215,7 +215,7 @@ cga_set_key(cga_ctx_t *cga, EVP_PKEY *k)
+ }
+ void
+-cga_free_keystack(STACK *sk)
++cga_free_keystack(STACK_OF(GENERAL_NAME) *sk)
+ {
+       EVP_PKEY *k;
+@@ -232,14 +232,14 @@ cga_free_keystack(STACK *sk)
+  *
+  * Returns a stack of EVP_PKEYs on success.
+  */
+-STACK *
++STACK_OF(GENERAL_NAME) *
+ cga_der2keys(uint8_t *der, int dlen)
+ {
+       uint8_t *dk;
+       EVP_PKEY *k;
+       int klen, elen;
+       uint16_t type;
+-      STACK *sk;
++      STACK_OF(GENERAL_NAME) *sk;
+       if ((sk = sk_new_null()) == NULL) {
+               APPLOG_NOMEM();
+--- a/include/pkixip_ext.h
++++ b/include/pkixip_ext.h
+@@ -54,7 +54,7 @@ extern int pkixip_add2stores_cert(X509 *
+ extern int pkixip_add2stores_file(const char *);
+ extern int pkixip_add_store(int *, int (*cmp)(X509_OBJECT **, X509_OBJECT **));
+ extern void *pkixip_find_cert(void *, int);
+-extern STACK *pkixip_get_mychain(void);
++extern STACK_OF(GENERAL_NAME) *pkixip_get_mychain(void);
+ extern X509_STORE_CTX *pkixip_get_store_ctx(void);
+ extern int pkixip_has_ext(X509 *x);
+ extern X509 *pkixip_load_cert(const char *);
+--- a/libs/libpkixipext/x509.c
++++ b/libs/libpkixipext/x509.c
+@@ -62,14 +62,14 @@ X509V3_EXT_METHOD pkix_ip_ext_method = {
+       i2v : (X509V3_EXT_I2V)i2v_IPAddrBlocks,
+ };
+-static STACK *stores[PKIXIP_MAX_STORES];
++static STACK_OF(GENERAL_NAME) *stores[PKIXIP_MAX_STORES];
+ static X509_STORE_CTX *ctx_bysubj;
+ static int next_store = 1;
+ static void *(*wrap_store_cert)(X509 *x);
+ static void (*trustanchor_cb)(X509 *x);
+ pthread_mutex_t stores_lock = PTHREAD_MUTEX_INITIALIZER;
+-static STACK *mychain;
++static STACK_OF(GENERAL_NAME) *mychain;
+ /* Lifted from openssl x509_lu.c */
+ static int
+@@ -243,7 +243,7 @@ pkixip_load_pkey(const char *f)
+       return (pkey);
+ }
+-static STACK *
++static STACK_OF(GENERAL_NAME) *
+ pkixip_get_store(int handle)
+ {
+       if (handle >= PKIXIP_MAX_STORES || handle < 0) {
+@@ -257,7 +257,7 @@ pkixip_get_store(int handle)
+ void
+ pkixip_walk_store(int (*cb)(X509 *, void *), void *cookie, int handle)
+ {
+-      STACK *objs;
++      STACK_OF(GENERAL_NAME) *objs;
+       int i;
+       X509_OBJECT *xo;
+@@ -282,7 +282,7 @@ done:
+ void *
+ pkixip_find_cert(void *k, int handle)
+ {
+-      STACK *store;
++      STACK_OF(GENERAL_NAME) *store;
+       int i;
+       void *r = NULL;
+@@ -305,7 +305,7 @@ done:
+ /* Caller must hold stores_lock */
+ static int
+ pkixip_do_add_store(int handle, int (*cmp)(X509_OBJECT **, X509_OBJECT **),
+-    STACK *objs)
++    STACK_OF(GENERAL_NAME) *objs)
+ {
+       if (objs == NULL && (objs = sk_X509_OBJECT_new(cmp)) == NULL) {
+               applog(LOG_CRIT, "no memory");
+@@ -538,7 +538,7 @@ done:
+       return (r);
+ }
+-STACK *
++STACK_OF(GENERAL_NAME) *
+ pkixip_get_mychain(void)
+ {
+       return (mychain);
+--- a/sendd/cpa.c
++++ b/sendd/cpa.c
+@@ -183,13 +183,13 @@ next:
+ }
+ static int
+-can_handle_cps(uint8_t *ops, int len, STACK *chain, X509 **x)
++can_handle_cps(uint8_t *ops, int len, STACK_OF(GENERAL_NAME) *chain, X509 **x)
+ {
+       int i, j, r = 0;
+       X509_NAME *dn;
+       X509 x509_s;
+       X509_CINF cinf_s;
+-      STACK *dchain;
++      STACK_OF(GENERAL_NAME) *dchain;
+       STACK_OF(X509_NAME) *dns;
+       *x = NULL;
+@@ -239,7 +239,7 @@ snd_handle_cps(struct sbuff *b, struct s
+ {
+       uint8_t *msg = sbuff_data(b);
+       int len = b->len;
+-      STACK *chain;
++      STACK_OF(GENERAL_NAME) *chain;
+       X509 *x, *trx = NULL;
+       int i, tot, olen;
+       uint8_t *ops;
diff --git a/ipv6/send/patches/007-use-flex.patch b/ipv6/send/patches/007-use-flex.patch
new file mode 100644 (file)
index 0000000..feb9bed
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/Makefile.config
++++ b/Makefile.config
+@@ -17,6 +17,7 @@ OS=linux
+ # Edit this if your gcc cannot be found at the usual address
+ #CC=gcc-4.0
++LEX=flex
+ # Where to install
+ prefix=$(DESTDIR)/usr
diff --git a/ipv6/shorewall6-lite/Makefile b/ipv6/shorewall6-lite/Makefile
new file mode 100644 (file)
index 0000000..5f6097f
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2008 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:=shorewall6-lite
+PKG_VERSION:=4.4.22.2
+PKG_DIRECTORY:=4.4.22
+PKG_RELEASE:=2
+
+PKG_SOURCE_URL:=http://www.shorewall.net/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
+       http://www1.shorewall.net/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
+       http://slovakia.shorewall.net/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
+       http://shorewall.de/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
+       http://www.shorewall.com.au/4.4/shorewall-$(PKG_DIRECTORY)/ \
+       http://shorewall.infohiiway.com/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
+       http://www.shorewall.com.ar/pub/shorewall/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=3ad7ba3790388bb562d3c937ba02fa31
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shorewall6-lite
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip +ip6tables
+  TITLE:=Shorewall6 Lite
+  URL:=http://www.shorewall.net/
+  SUBMENU:=Firewall
+endef
+
+define Package/shorewall6-lite/description
+       Shoreline Firewall 6 Lite is an iptables-based firewall for Linux systems.
+endef
+
+define Package/shorewall6-lite/conffiles
+/etc/shorewall6-lite/shorewall6-lite.conf
+/etc/shorewall6-lite/vardir
+endef
+
+define Build/Compile
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)
+       PREFIX=$(PKG_INSTALL_DIR) $(PKG_BUILD_DIR)/install.sh
+endef
+
+define Package/shorewall6-lite/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DIR) $(1)/etc/shorewall6-lite
+       $(INSTALL_DIR) $(1)/usr/share
+       $(INSTALL_BIN) ./files/shorewall-lite.init $(1)/etc/init.d/shorewall6-lite
+       $(INSTALL_BIN) ./files/hotplug_iface $(1)/etc/hotplug.d/iface/05-shorewall6-lite
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/shorewall6-lite $(1)/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/shorewall6-lite $(1)/usr/share
+       $(INSTALL_BIN) ./files/hostname $(1)/usr/share/shorewall6-lite
+       $(CP) $(PKG_INSTALL_DIR)/etc/shorewall6-lite $(1)/etc
+       $(CP) ./files/vardir $(1)/etc/shorewall6-lite
+endef
+
+$(eval $(call BuildPackage,shorewall6-lite))
diff --git a/ipv6/shorewall6-lite/files/hostname b/ipv6/shorewall6-lite/files/hostname
new file mode 100644 (file)
index 0000000..42e1643
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat /proc/sys/kernel/hostname
diff --git a/ipv6/shorewall6-lite/files/hotplug_iface b/ipv6/shorewall6-lite/files/hotplug_iface
new file mode 100644 (file)
index 0000000..58ecbf9
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# should restart shorewall when an interface comes up
+
+[ ifup = "$ACTION" ] && {
+       /etc/init.d/shorewall6-lite restart
+}
+
+[ ifdown = "$ACTION" ] && {
+       # might need to restore some routing
+       /etc/init.d/shorewall6-lite restart
+}
diff --git a/ipv6/shorewall6-lite/files/shorewall-lite.init b/ipv6/shorewall6-lite/files/shorewall-lite.init
new file mode 100644 (file)
index 0000000..ca24bbc
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+
+START=46
+start() {
+       touch /var/log/messages
+       mkdir -p /var/lock/subsys
+       /sbin/shorewall6-lite -qq start -f
+}
+
+stop() {
+       /sbin/shorewall6-lite -qq stop
+}
+
+restart() {
+       if [ -f /etc/shorewall6-lite/state/restore ] ; then
+               /sbin/shorewall6-lite -qq restore
+       else
+               /sbin/shorewall6-lite -qq restart
+       fi
+}
diff --git a/ipv6/shorewall6-lite/files/vardir b/ipv6/shorewall6-lite/files/vardir
new file mode 100644 (file)
index 0000000..e7a9030
--- /dev/null
@@ -0,0 +1,2 @@
+# move state dir out of ram
+VARDIR=/etc/shorewall6-lite/state
diff --git a/ipv6/shorewall6-lite/patches/110-MODULESDIR.patch b/ipv6/shorewall6-lite/patches/110-MODULESDIR.patch
new file mode 100644 (file)
index 0000000..cb01e8c
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/lib.common
++++ b/lib.common
+@@ -292,7 +292,7 @@
+     [ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
+-    [ -z "$MODULESDIR" ] && MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched
++    [ -z "$MODULESDIR" ] && MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched:/lib/modules/$(uname -r)
+     MODULES=$(lsmod | cut -d ' ' -f1)
+     for directory in $(split $MODULESDIR); do
+@@ -328,7 +328,7 @@
+     [ -n "${MODULE_SUFFIX:=o gz ko o.gz ko.gz}" ]
+     [ -z "$MODULESDIR" ] && \
+-      MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched
++      MODULESDIR=/lib/modules/$(uname -r)/kernel/net/ipv6/netfilter:/lib/modules/$(uname -r)/kernel/net/netfilter:/lib/modules/$(uname -r)/kernel/net/sched:/lib/modules/$(uname -r)
+     for directory in $(split $MODULESDIR); do
+       [ -d $directory ] && moduledirectories="$moduledirectories $directory"
diff --git a/ipv6/shorewall6-lite/patches/120-LOGFILE.patch b/ipv6/shorewall6-lite/patches/120-LOGFILE.patch
new file mode 100644 (file)
index 0000000..7fc11cd
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/shorewall6-lite.conf     2009-12-05 22:37:43.000000000 -0500
++++ b/shorewall6-lite.conf     2009-12-05 22:37:51.000000000 -0500
+@@ -28,7 +28,7 @@
+ #                            L O G G I N G
+ ###############################################################################
+-LOGFILE=
++LOGFILE=/dev/null
+
diff --git a/ipv6/totd/Makefile b/ipv6/totd/Makefile
new file mode 100644 (file)
index 0000000..0a1dad5
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# 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:=totd
+PKG_VERSION:=1.5.1
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.dillema.net/software/totd
+PKG_MD5SUM:=7edaedae9f6aca5912dd6c123582cf08
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/totd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-ipv6
+  TITLE:=Small DNS proxy that supports IPv6/IPv4 record translation
+  URL:=http://www.dillema.net/software/totd.html
+endef
+
+define Package/totd/description
+       totd is a small DNS proxy nameserver which supports IPv6 and enable IPv6
+       only sites to access IPv4 sites by using some translation mechanism such
+       as NAT-PT, KAME faith, etc...
+endef
+
+define Package/totd/conffiles
+/etc/totd.conf
+endef
+
+# uses GNU configure
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               CC="$(TARGET_CC)" \
+               all
+endef
+
+define Package/totd/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/
+       $(INSTALL_CONF) ./files/totd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/totd.init $(1)/etc/init.d/totd
+endef
+
+define Package/totd/conffiles
+/etc/totd.conf
+endef
+
+$(eval $(call BuildPackage,totd))
diff --git a/ipv6/totd/files/totd.conf b/ipv6/totd/files/totd.conf
new file mode 100644 (file)
index 0000000..37e0458
--- /dev/null
@@ -0,0 +1,17 @@
+; Totd sample configuration file
+; you can have multiple forwarders, totd will always prefer
+; forwarders listed early and only use forwarders listed later
+; if the first ones are unresponsive.
+forwarder 192.168.1.1 port 5353
+; you can have multiple prefixes or even no prefixes at all
+; totd uses them in round-robin fashion
+prefix 3ffe:abcd:1234:9876::
+; the port totd listens on for incoming requests
+port 53
+; the pidfile to use (default: /var/run/totd.pid)
+pidfile /var/run/totd.pid
+; interfaces totd listens on (UDP only for now and not on Linux)
+; If left out totd will only open wildcard sockets.
+; interfaces lo br0
+; 6to4 reverse lookup
+; stf
diff --git a/ipv6/totd/files/totd.init b/ipv6/totd/files/totd.init
new file mode 100644 (file)
index 0000000..9c2dd74
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=60
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/totd -c /etc/totd.conf
+}
+
+stop() {
+       service_stop /usr/sbin/totd
+}
diff --git a/ipv6/totd/patches/001-no_warning_as_errors.patch b/ipv6/totd/patches/001-no_warning_as_errors.patch
new file mode 100644 (file)
index 0000000..3f8f3b4
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -19,7 +19,7 @@ TOT_CONFIG_FILE=@sysconfdir@/totd.conf
+ INSTALL = /usr/bin/install
+-CFLAGS  = @CFLAGS@ @DEFS@  -Werror -Wall -DTOTCONF=\"$(TOT_CONFIG_FILE)\" @OPTFLAGS@ $(INCLUDEPATH)
++CFLAGS  = @CFLAGS@ @DEFS@ -Wall -DTOTCONF=\"$(TOT_CONFIG_FILE)\" @OPTFLAGS@ $(INCLUDEPATH)
+ # When debugging is enabled by --enable-malloc-debug flag to the configure
+ # script, the @DBMALLOC@ substitution will contain the empty string, thus
diff --git a/ipv6/tspc/Makefile b/ipv6/tspc/Makefile
new file mode 100644 (file)
index 0000000..d914325
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2014 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:=tspc
+PKG_VERSION:=2.1.1
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.fr.debian.org/debian/pool/main/t/tspc/
+PKG_MD5SUM:=65183cae002feaacd8bc92d6a5404cc2
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tspc
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Client for Hexago's (Freenet6's) IPv6 service
+  URL:=http://www.hexago.com
+endef
+
+define Package/tspc/description
+       Client to configure an IPv6 tunnel to
+       Hexago's (Freenet6's) migration broker.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/include -I$(PKG_BUILD_DIR)/platform/linux" \
+       SED="/bin/true" \
+       target=linux \
+       all
+
+define Package/tspc/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/tspc $(1)/bin/
+       $(INSTALL_DIR) $(1)/etc/tsp
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/bin/tspc.conf.sample $(1)/etc/tsp/tspc.conf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/template/linux.sh $(1)/etc/tsp/setup.sh
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/template/checktunnel.sh $(1)/etc/tsp/
+endef
+
+define Package/tspc/conffiles
+/etc/tsp/tspc.conf
+endef
+
+$(eval $(call BuildPackage,tspc))
diff --git a/ipv6/tspc/patches/001-debian_patches.patch b/ipv6/tspc/patches/001-debian_patches.patch
new file mode 100644 (file)
index 0000000..b0b0852
--- /dev/null
@@ -0,0 +1,233 @@
+--- a/conf/Makefile
++++ b/conf/Makefile
+@@ -34,15 +34,15 @@ tspc.conf.sample:
+       fi
+       @if [ -z "$(configdir)" ]; then \
+        if [ -z "$(installdir)" ]; then \
+-         sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+`cd ..;pwd`+"  tspc.conf.in>$(BIN)/tspc.conf.sample; \
++         $(SED) -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+`cd ..;pwd`+"  tspc.conf.in>$(BIN)/tspc.conf.sample; \
+        else \
+-         sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(installdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
++         $(SED) -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(installdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
+        fi \
+       else \
+-       sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(configdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
++       $(SED) -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(configdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \
+       fi
+-      chmod 700 $(BIN)/tspc.conf.sample
++      chmod 600 $(BIN)/tspc.conf.sample
+       
+ clean:
+--- a/conf/tspc.conf.in
++++ b/conf/tspc.conf.in
+@@ -18,13 +18,6 @@
+ # to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
+ # MA 02111-1307 USA
+ #------------------------------------------------------------------------------
+-#
+-#
+-# tsp directory:
+-#  the only use is for the OS scripts which will be taken 
+-#  from $tsp_dir/template
+-#
+-tsp_dir=@tsp_dir@
+ #
+ # authentication method:
+@@ -66,28 +59,19 @@ passwd=
+ #
+ # Name of the script:
+-# template=checktunnel|freebsd|netbsd|linux|windows|darwin|cisco|
+-#   solaris|openbsd
++# template=checktunnel|setup
+ #
+ # the value is the file name of the script in the tsp_dir/template directory
+ # The script will be executed after the TSP session is completed. The script
+ #  is configuring the tunnel interface and routes.
+ # checktunnel is only printing information and does not configure any tunnel
+-# freebsd is for FreeBSD 4.X and above
+-# netbsd is for NetBSD 1.6 and above
+-# linux is for Linux (most distributions)
+-# windows is for WindowsXP
+-# darwin is for MacOS X 10.2 and above
+-# cisco is for Cisco IOS. This script prints the cisco configuration while
+-#  not configuring the cisco itself.
+-# solaris is for Solaris 8 and above.
+-# openbsd is for OpenBSD 3.X and above
++# setup will do the actual work
+ # you could customize your own script, name it and put the filename in 
+ #  the template variable.
+ # on unix, '.sh' is added to the name of the script. 
+ # on windows, '.bat' is added to the name of the script.
+ # 
+-template=@target@
++template=setup
+ #
+ # 'server' is the tunnel broker identifier
+--- a/platform/linux/tsp_local.c
++++ b/platform/linux/tsp_local.c
+@@ -59,13 +59,13 @@
+ /* these globals are defined by US used by alot of things in  */
+-char *FileName  = "tspc.conf";
+-char *LogFile   = "tspc.log";
++char *FileName  = "/etc/tsp/tspc.conf";
++char *LogFile   = "/var/log/tspc.log";
+ char *LogFileName = NULL;
+-char *ScriptInterpretor = "/bin/sh";
++char *ScriptInterpretor = "";
+ char *ScriptExtension = "sh";
+ char *ScriptDir = NULL;
+-char *TspHomeDir = "/usr/local/etc/tsp";
++char *TspHomeDir = "/etc/tsp";
+ char DirSeparator = '/';
+ int Verbose = 0;
+@@ -143,7 +143,7 @@ int tspStartLocal(SOCKET socket, tConf *
+       {
+                 int tunfd;
+-                Display(0, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile);
++                Display(1, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile);
+                 if (daemon(0,0) == -1) {
+                         Display(1, ELError, "tspStartLocal", "Unable to fork.");
+--- a/src/lib/config.c
++++ b/src/lib/config.c
+@@ -474,14 +474,17 @@ int tspVerifyConfig(tConf *Conf)
+   if(IsPresent(Conf->dns_server)) {
+      char *Server;
+      char *dns = strdup(Conf->dns_server);
++     struct addrinfo *contact;
+      if (eq(Conf->host_type, "host")) {
+        Display(1,ELError, "tspVerifyConfig", "DNS delegation is not supported for host_type=host");
+        status = 1;
+      }
+      for(Server = strtok(dns, ":");Server; Server = strtok(NULL, ":")) {
+-        if(gethostbyname(Server) == NULL) {
++        if(getaddrinfo(Server, "domain", 0, &contact)!=0) {
+            Display(1,ELError, "tspVerifyConfig", "DNS server name %s is not resolving.", Server);
+            status = 1;
++        } else {
++           freeaddrinfo(contact);
+         }
+      }
+      free(dns);
+--- a/src/tsp/tsp_client.c
++++ b/src/tsp/tsp_client.c
+@@ -275,7 +275,7 @@ int tspSetupTunnel(tConf *conf, net_tool
+ start_show:
+-      Display(0, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel");
++      Display(1, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel");
+       /* and start the show */
+       ret = tspStartLocal(socket, conf, &t, nt[conf->transport]);
+@@ -337,8 +337,8 @@ int tspMain(int argc, char *argv[]) 
+       LogInit("tspc", LogFile);
+       Display( 1, ELInfo, "tspMain", "----- TSP Client Version %s Initializing -------------------------", TSP_CLIENT_VERSION);
+-      Display( 0, ELInfo, "tspMain", IDENTIFICATION);
+-      Display( 0, ELInfo, "tspMain", "Initializing (use -h for help)\n");
++      Display( 1, ELInfo, "tspMain", IDENTIFICATION);
++      Display( 1, ELInfo, "tspMain", "Initializing (use -h for help)\n");
+       if((status = tspInitialize(argc, argv, &c)) != 0) {     // *** we have no uninitialize
+               if (status == -1) {
+@@ -361,12 +361,12 @@ int tspMain(int argc, char *argv[]) 
+       /* first try with RUDP */
+       c.transport = NET_TOOLS_T_RUDP;
+-      Display( 0, ELInfo, "tspMain", "\nConnecting to server with reliable udp");
++      Display( 1, ELInfo, "tspMain", "\nConnecting to server with reliable udp");
+ try_server:
+       if (c.transport == NET_TOOLS_T_TCP)
+-              Display( 0, ELInfo, "tspMain", "\nConnecting to server with tcp");
++              Display( 1, ELInfo, "tspMain", "\nConnecting to server with tcp");
+       Display( 1, ELInfo, "tspMain", "Using TSP protocol version %s",
+               TspProtocolVersionStrings[version_index]); 
+--- a/template/linux.sh
++++ b/template/linux.sh
+@@ -135,9 +135,7 @@ if [ X"${TSP_HOST_TYPE}" = X"host" ] || 
+    # 
+    # Default route  
+    Display 1 "Adding default route"
+-   ExecNoCheck $route -A inet6 del ::/0 2>/dev/null # delete old default route
+    ExecNoCheck $route -A inet6 del 2000::/3 2>/dev/null  # delete old gw route
+-   Exec $route -A inet6 add ::/0 dev $TSP_TUNNEL_INTERFACE
+    Exec $route -A inet6 add 2000::/3 dev $TSP_TUNNEL_INTERFACE
+ fi
+@@ -147,9 +145,10 @@ if [ X"${TSP_HOST_TYPE}" = X"router" ]; 
+    Display 1 "Kernel setup"
+    if [ X"${TSP_PREFIXLEN}" != X"64" ]; then
+       #Better way on linux to avoid loop with the remaining /48?
+-      $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
++      ExecNoCheck $route -A inet6 del $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null
++      Exec $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE
+    fi
+-   Exec $sysctl -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled
++   Exec $sysctl -q -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled
+    Display 1 "Adding prefix to $TSP_HOME_INTERFACE"
+    OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"`
+    if [ ! -z $OLDADDR ]; then
+@@ -157,28 +156,28 @@ if [ X"${TSP_HOST_TYPE}" = X"router" ]; 
+       Exec $ifconfig $TSP_HOME_INTERFACE inet6 del $OLDADDR
+    fi
+    Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64
+-   # Router advertisement configuration 
+-   Display 1 "Create new $rtadvdconfigfile"
+-   echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile"
+-   echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
+-   echo "{" >> "$rtadvdconfigfile"
+-   echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
+-   echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
+-   echo " {" >> "$rtadvdconfigfile"
+-   echo " AdvOnLink on;" >> "$rtadvdconfigfile"
+-   echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
+-   echo " };" >> "$rtadvdconfigfile"
+-   echo "};" >> "$rtadvdconfigfile"
+-   echo "" >> "$rtadvdconfigfile"
+-   /etc/init.d/radvd stop
+-   if [ -f $rtadvdconfigfile ]; then
+-      KillProcess $rtadvdconfigfile
+-      Exec $rtadvd -u radvd -C $rtadvdconfigfile
+-      Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile"
+-   else
+-      echo "Error : file $rtadvdconfigfile not found"
+-      exit 1
+-   fi
++#   # Router advertisement configuration 
++#   Display 1 "Create new $rtadvdconfigfile"
++#   echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile"
++#   echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile"
++#   echo "{" >> "$rtadvdconfigfile"
++#   echo " AdvSendAdvert on;" >> "$rtadvdconfigfile"
++#   echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile"
++#   echo " {" >> "$rtadvdconfigfile"
++#   echo " AdvOnLink on;" >> "$rtadvdconfigfile"
++#   echo " AdvAutonomous on;" >> "$rtadvdconfigfile"
++#   echo " };" >> "$rtadvdconfigfile"
++#   echo "};" >> "$rtadvdconfigfile"
++#   echo "" >> "$rtadvdconfigfile"
++#   /etc/init.d/radvd stop
++#   if [ -f $rtadvdconfigfile ]; then
++#      KillProcess $rtadvdconfigfile
++#      Exec $rtadvd -u radvd -C $rtadvdconfigfile
++#      Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile"
++#   else
++#      echo "Error : file $rtadvdconfigfile not found"
++#      exit 1
++#   fi
+ fi
+ Display 1 "--- End of configuration script. ---"
diff --git a/ipv6/tunslip6/Makefile b/ipv6/tunslip6/Makefile
new file mode 100644 (file)
index 0000000..d379b5e
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# This Makefile is a skeleton
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=contiki
+PKG_VERSION:=2.5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
+PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/contiki/Contiki/Contiki%20$(PKG_VERSION)/
+PKG_MD5SUM:=e2dbc5a42a899177d20d285c13bb3702
+
+#PKG_BUILD_DIR:=$(BUILD_DIR)/tools
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tunslip6
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-slip
+  TITLE:=tunslip6 from Contiki OS
+  URL:=http://www.contiki-os.org/
+endef
+
+define Package/tun6slip/description
+  SLIP utility tool for connecting to Contiki 6LoWPAN devices.
+endef
+
+define Build/Compile
+       # pass CFLAGS again to override -O2 set by configure
+       $(MAKE) -C $(PKG_BUILD_DIR)/tools \
+               CROSS_COMPILE="$(KERNEL_CROSS)" \
+               ARCH="$(LINUX_KARCH)" \
+               KERNELDIR=$(LINUX_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               tunslip6
+endef
+
+define Package/tunslip6/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/tools/tunslip6 $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,tunslip6))
diff --git a/ipv6/wide-dhcpv6/Makefile b/ipv6/wide-dhcpv6/Makefile
new file mode 100644 (file)
index 0000000..3207fc4
--- /dev/null
@@ -0,0 +1,145 @@
+#
+# Copyright (C) 2010-2012 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:=wide-dhcpv6
+PKG_VERSION:=20080615
+PKG_RELEASE:=11
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=1011e165850fe40d3e332dad2bfd30b3
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wide-dhcpv6/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=WIDE-DHCPv6
+  SUBMENU:=wide-dhcpv6
+  DEPENDS:=+kmod-ipv6 
+  URL:=https://sourceforge.net/projects/wide-dhcpv6/
+  MAINTAINER:=Andrew Byrne <openwrt@andy.id.au>
+endef
+
+define Package/wide-dhcpv6-client
+  $(call Package/wide-dhcpv6/Default)
+  TITLE+= client
+endef
+
+define Package/wide-dhcpv6-client/description
+       WIDE-DHCPv6 is an open-source implementation of Dynamic Host Configuration Protocol
+       for IPv6 (DHCPv6) originally developed by the KAME project. The implementation
+       mainly conforms to the following standards: RFC3315,3319,3633,3646,4075,4272,etc.
+
+       This package installs the client component.
+endef
+
+define Package/wide-dhcpv6-server
+  $(call Package/wide-dhcpv6/Default)
+  TITLE+= server
+endef
+
+define Package/wide-dhcpv6-server/description
+       WIDE-DHCPv6 is an open-source implementation of Dynamic Host Configuration Protocol
+       for IPv6 (DHCPv6) originally developed by the KAME project. The implementation
+       mainly conforms to the following standards: RFC3315,3319,3633,3646,4075,4272,etc.
+
+       This package installs the server component.
+endef
+
+define Package/wide-dhcpv6-relay
+  $(call Package/wide-dhcpv6/Default)
+  TITLE+= relay
+endef
+
+define Package/wide-dhcpv6-relay/description
+       WIDE-DHCPv6 is an open-source implementation of Dynamic Host Configuration Protocol
+       for IPv6 (DHCPv6) originally developed by the KAME project. The implementation
+       mainly conforms to the following standards: RFC3315,3319,3633,3646,4075,4272,etc.
+
+       This package installs the relay component.
+endef
+
+define Package/wide-dhcpv6-control
+  $(call Package/wide-dhcpv6/Default)
+  TITLE+= client and server control utility
+endef
+
+define Package/wide-dhcpv6-control/description
+       WIDE-DHCPv6 is an open-source implementation of Dynamic Host Configuration Protocol
+       for IPv6 (DHCPv6) originally developed by the KAME project. The implementation
+       mainly conforms to the following standards: RFC3315,3319,3633,3646,4075,4272,etc.
+
+       This package installs the client and server control utility.
+endef
+
+TARGET_CFLAGS+=-D_GNU_SOURCE
+
+define Build/Configure
+       $(call Build/Configure/Default,--with-localdbdir=/var)
+endef
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               EXTRA_CFLAGS="-include debug.h" \
+               all 
+endef
+
+define Package/wide-dhcpv6-client/conffiles
+/etc/config/dhcp6c
+endef
+
+define Package/wide-dhcpv6-client/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dhcp6c $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/dhcp6c.config $(1)/etc/config/dhcp6c
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/dhcp6c.init $(1)/etc/init.d/dhcp6c
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/dhcp6c.hotplug $(1)/etc/hotplug.d/iface/40-dhcp6c
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/dhcp6c
+       $(INSTALL_DATA) ./files/dhcp6c-dnsmasq.hotplug $(1)/etc/hotplug.d/dhcp6c/10-dnsmasq
+       $(INSTALL_DATA) ./files/dhcp6c-radvd.hotplug $(1)/etc/hotplug.d/dhcp6c/20-radvd
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/dhcp6c-state $(1)/usr/bin/dhcp6c-state
+endef
+
+define Package/wide-dhcpv6-server/conffiles
+/etc/config/dhcp6s
+endef
+
+define Package/wide-dhcpv6-server/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dhcp6s $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/dhcp6s.conf.sample $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/dhcp6s.config $(1)/etc/config/dhcp6s
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/dhcp6s.init $(1)/etc/init.d/dhcp6s
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/dhcp6s.hotplug $(1)/etc/hotplug.d/iface/50-dhcp6s
+endef
+
+define Package/wide-dhcpv6-relay/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dhcp6relay $(1)/usr/sbin
+endef
+
+define Package/wide-dhcpv6-control/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dhcp6ctl $(1)/usr/sbin
+endef
+
+$(eval $(call BuildPackage,wide-dhcpv6-client))
+$(eval $(call BuildPackage,wide-dhcpv6-server))
+$(eval $(call BuildPackage,wide-dhcpv6-relay))
+$(eval $(call BuildPackage,wide-dhcpv6-control))
diff --git a/ipv6/wide-dhcpv6/files/dhcp6c-dnsmasq.hotplug b/ipv6/wide-dhcpv6/files/dhcp6c-dnsmasq.hotplug
new file mode 100644 (file)
index 0000000..61850cf
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+getoption() {
+       local cfg=$1
+       config_get resolvfile "$cfg" resolvfile
+}
+
+config_load dhcp6c
+
+local dns 
+config_get dns basic dns none
+[ $dns != "dnsmasq" ] && return 0
+
+if [ "$ACTION" = "start" ]; then
+
+       local domain_name_servers
+       config_get domain_name_servers state domain_name_servers
+
+       if [ -n "$domain_name_servers" ]; then
+
+               config_load dhcp
+       
+               local resolvfile
+               config_foreach getoption dnsmasq
+
+               if [ -n "$resolvfile" ]; then
+
+                       cp -pf $resolvfile "$resolvfile.dhcp6c_backup"
+       
+                       for nameserver in $domain_name_servers; do
+                               echo nameserver $nameserver >> $resolvfile
+                       done
+
+               fi
+       
+       fi
+
+fi
+
+if [ "$ACTION" = "stop" ]; then
+
+       config_load dhcp
+
+       local resolvfile
+       config_foreach getoption dnsmasq
+       if [ -f "$resolvfile.dhcp6c_backup" ]; then
+               mv -f "$resolvfile.dhcp6c_backup" $resolvfile
+       fi 
+
+fi
+
diff --git a/ipv6/wide-dhcpv6/files/dhcp6c-radvd.hotplug b/ipv6/wide-dhcpv6/files/dhcp6c-radvd.hotplug
new file mode 100644 (file)
index 0000000..5c08e8c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+[ -f /etc/config/radvd ] && /etc/init.d/radvd restart
diff --git a/ipv6/wide-dhcpv6/files/dhcp6c-state b/ipv6/wide-dhcpv6/files/dhcp6c-state
new file mode 100644 (file)
index 0000000..c777724
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+uci_revert_state dhcp6c state
+uci_set_state dhcp6c state "" dhcp6c_state
+uci_set_state dhcp6c state domain_name_servers "$new_domain_name_servers"
+uci_set_state dhcp6c state domain_name "$new_domain_name"                    
+uci_set_state dhcp6c state ntp_servers "$new_ntp_servers"                    
+uci_set_state dhcp6c state sip_server_address "$new_sip_servers"
+uci_set_state dhcp6c state sip_server_domain_name "$new_sip_name"
+uci_set_state dhcp6c state nis_server_address "$new_nis_servers"      
+uci_set_state dhcp6c state nis_domain_name "$new_nis_name"            
+uci_set_state dhcp6c state nisp_server_address "$new_nisp_servers"    
+uci_set_state dhcp6c state nisp_domain_name "$new_nisp_name"          
+uci_set_state dhcp6c state bcmcs_server_address "$new_bcmcs_servers"  
+uci_set_state dhcp6c state bcmcs_server_domain_name "$new_bcmcs_name"
+
diff --git a/ipv6/wide-dhcpv6/files/dhcp6c.config b/ipv6/wide-dhcpv6/files/dhcp6c.config
new file mode 100644 (file)
index 0000000..04a3ca9
--- /dev/null
@@ -0,0 +1,42 @@
+config 'dhcp6c' 'basic'
+       option 'enabled' '0'                            # 1 = enabled; 0 = disabled
+       option 'interface' 'wan'                        # This is the interface the DHCPv6 client will run on
+       option 'dns' 'dnsmasq'                          # Which DNS server you run (only dnsmasq currently supported)
+       option 'debug' '0'                              # 1 = enable debugging; 0 = disable debugging
+       
+       # Send options (1 = send; 0 = do not send)
+       option 'pd' '1'                                 # Prefix Delegation
+       option 'na' '0'                                 # Non-Temporary Address
+       option 'rapid_commit' '1'                       # Rapid Commit
+       
+       # Request options (1 = request; 0 = do not request)
+       option 'domain_name_servers' '1'
+       option 'domain_name' '0'
+       option 'ntp_servers' '0'
+       option 'sip_server_address' '0'
+       option 'sip_server_domain_name' '0'
+       option 'nis_server_address' '0'
+       option 'nis_domain_name' '0'
+       option 'nisp_server_address' '0'
+       option 'nisp_domain_name' '0'
+       option 'bcmcs_server_address' '0'
+       option 'bcmcs_server_domain_name' '0'
+       
+       # Override the used DUID, by default it is derived from the interface MAC
+       # The given value must be uppercase and globally unique!
+       #option 'duid' '00:03:00:06:D8:5D:4C:A5:03:F2'
+
+       # Script to run when a reply is received
+       option 'script' '/usr/bin/dhcp6c-state'
+
+# Define one or more interfaces on which prefixes should be assigned
+config 'interface' 'loopback'
+       option 'enabled' '1'                            # 1 = enabled; 0 = disabled
+       option 'sla_id' '0'                             # Site level aggregator identifier specified in decimal (subnet)
+       option 'sla_len' '4'                            # Site level aggregator length (64 - size of prefix being delegated)
+                                                       # e.g. /60 from ISP -> 64 - 60 = 4
+
+config 'interface' 'lan'
+       option 'enabled' '1'
+       option 'sla_id' '1'
+       option 'sla_len' '4'
diff --git a/ipv6/wide-dhcpv6/files/dhcp6c.hotplug b/ipv6/wide-dhcpv6/files/dhcp6c.hotplug
new file mode 100644 (file)
index 0000000..947c53c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+include /lib/network
+
+config_load "dhcp6c"
+
+local enabled
+config_get_bool enabled basic enabled 0
+[ $enabled -eq 0 ] && return 0
+
+local client_interface
+config_get client_interface basic interface
+
+if [ "$INTERFACE" = "$client_interface" ] && [ "$ACTION" = "ifup" ]; then
+       /etc/init.d/dhcp6c start
+fi
+
+if [ "$INTERFACE" = "$client_interface" ] && [ "$ACTION" = "ifdown" ]; then
+       /etc/init.d/dhcp6c stop
+fi
diff --git a/ipv6/wide-dhcpv6/files/dhcp6c.init b/ipv6/wide-dhcpv6/files/dhcp6c.init
new file mode 100644 (file)
index 0000000..6e224d6
--- /dev/null
@@ -0,0 +1,172 @@
+#!/bin/sh /etc/rc.common
+
+DHCP6C_REQUEST_OPTIONS='domain_name_servers domain_name ntp_servers sip_server_address sip_domain_name nis_server_address nis_domain_name nisp_server_address nisp_domain_name bcmcs_server_address bcmcs_domain_name'
+
+dhcp6c_write_duid() {
+       local mac="${1:-$(ifconfig "$client_device" | sed -ne 's/[[:space:]]*$//; s/.*HWaddr //p')}"
+       local pat="[0-9A-F][0-9A-F]"
+
+       case "$mac" in
+               # exactly 6 octets -> assume type 3 (DUID-LL - RFC3315, 9.4)
+               $pat:$pat:$pat:$pat:$pat:$pat)
+                       local oIFS="$IFS"; IFS=":"; set -- $mac; IFS="$oIFS"
+
+                       # low endian
+                       if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "" "%04x" ""')" = "0001" ]; then
+                               printf \\x0a\\x00
+
+                       # big endian
+                       else
+                               printf \\x00\\x0a
+                       fi
+
+                       printf \\x00\\x03\\x00\\x06\\x$1\\x$2\\x$3\\x$4\\x$5\\x$6
+                       logger -t dhcp6c "Using MAC address DUID 00:03:00:06:$1:$2:$3:$4:$5:$6"
+               ;;
+               # at least 7 octets -> could be type 1 or type 2
+               $pat:$pat:$pat:$pat:$pat:$pat:*)
+                       local len_id=":$(echo "$mac" | sed -e 's/[^:]//g')"
+                       local len_hi=$(printf "%02x" $((${#len_id} / 0xFF)) )
+                       local len_lo=$(printf "%02x" $((${#len_id} % 0xFF)) )
+
+                       # low endian
+                       if [ "$(printf \\1 | hexdump -n1 -ve '8/2 "" "%04x" ""')" = "0001" ]; then
+                               printf \\x$len_lo\\x$len_hi
+
+                       # big endian
+                       else
+                               printf \\x$len_hi\\x$len_lo
+                       fi
+
+                       printf $(echo "$mac" | sed -e 's/^/\\x/; s/:/\\x/g')
+                       logger -t dhcp6c "Using user provided DUID $mac"
+               ;;
+               *)
+                       logger -t dhcp6c "Unable to derive DUID from interface '$client_device' and no valid user DUID given"
+               ;;
+       esac
+}
+
+dhcp6c_write_interface() {
+       local cfg=$1
+       local sla_id
+       local sla_len
+       local enabled
+       local device
+
+       config_get_bool enabled "$cfg" enabled 0
+
+       if [ $enabled -ne 0 ]; then
+               config_get sla_id "$cfg" sla_id
+               config_get sla_len "$cfg" sla_len
+
+               network_get_device device "$cfg" && {
+                       printf '\tprefix-interface %s {\n' "$device"
+                       printf '\t\tsla-id %s;\n' "$sla_id"
+                       printf '\t\tsla-len %s;\n' "$sla_len"
+                       printf '\t};\n'
+               }
+       fi
+}
+
+dhcp6c_write_request() {
+       printf '\trequest %s;\n' $1 | sed -e s/_/-/g
+}
+
+dhcp6c_write_config() {
+       local pd
+       local na
+       config_get_bool pd basic pd 0
+       config_get_bool na basic na 0
+
+       printf 'interface %s {\n' "$client_ifname"
+
+       if [ $pd -ne 0 ]; then
+               printf '\tsend ia-pd 0;\n'
+       fi
+
+       if [ $na -ne 0 ]; then
+               printf '\tsend ia-na 0;\n'
+       fi
+
+       local rapid_commit
+       config_get_bool rapid_commit basic rapid_commit 0
+       [ $rapid_commit -ne 0 ] && printf '\tsend rapid-commit;\n'
+
+       local script
+       config_get script basic script
+       [ "$script" != "" ] && printf '\tscript "%s";\n' "$script"
+
+       local request
+       local value
+       for request in $DHCP6C_REQUEST_OPTIONS; do
+               config_get_bool value basic "$request" 0
+               [ $value -ne 0 ] && dhcp6c_write_request "$request"
+       done
+
+       printf '};\n\n'
+
+       if [ $pd -ne 0 ]; then
+               printf 'id-assoc pd 0 {\n'
+               config_foreach dhcp6c_write_interface interface
+               printf '};\n\n'
+       fi
+
+       if [ $na -ne 0 ]; then
+               printf 'id-assoc na 0 {\n'
+               printf '};\n\n'
+       fi
+
+       return 0
+}
+
+start() {
+       [ ! -e /etc/dhcp6cctlkey ] && `dd if=/dev/urandom count=1 2> /dev/null | md5sum | cut -d" " -f1 > /etc/dhcp6cctlkey`
+
+       [ -e /var/run/dhcp6c.pid ] && return 0
+
+       . /lib/functions/network.sh
+
+       config_load "dhcp6c"
+
+       local enabled
+       config_get_bool enabled basic enabled 0
+       [ $enabled -eq 0 ] && return 0
+
+       local user_duid
+       config_get user_duid basic duid
+
+       logger -t dhcp6c starting dhcp6c
+
+       local client_interface client_ifname client_device
+       config_get client_interface basic interface
+       network_get_device  client_ifname "$client_interface"
+       network_get_physdev client_device "$client_interface" || client_device="$client_ifname"
+
+       local config_file="/var/etc/dhcp6c.conf"
+       local duid_file="/var/dhcp6c_duid"
+       mkdir -m 755 -p /var/etc
+       dhcp6c_write_config > $config_file
+       dhcp6c_write_duid "$user_duid" > $duid_file
+
+       local debug
+       local debug_option
+       config_get_bool debug basic debug 0
+       [ $debug -eq 1 ] && debug_option="-D"
+       /usr/sbin/dhcp6c -c $config_file $debug_option $client_ifname
+
+       sleep 3
+       ACTION=start /sbin/hotplug-call dhcp6c
+
+       return 0
+}
+
+stop() {
+       logger -t dhcp6c stopping dhcp6c
+       service_kill dhcp6c /var/run/dhcp6c.pid
+       rm -f /var/etc/dhcp6c.conf /var/run/dhcp6c.pid
+       ACTION=stop /sbin/hotplug-call dhcp6c
+       return 0
+}
+
+
diff --git a/ipv6/wide-dhcpv6/files/dhcp6s.config b/ipv6/wide-dhcpv6/files/dhcp6s.config
new file mode 100644 (file)
index 0000000..dda53d1
--- /dev/null
@@ -0,0 +1,4 @@
+config 'dhcp6s' 'basic'
+       option 'enabled' '0'                            # 1 = enabled; 0 = disabled
+       option 'interface' 'lan'                        # This is the interface the DHCPv6 server will run on
+       option 'config_file' '/etc/dhcp6s.conf'         # Config file (as this UCI config doesn't fully support all options)
diff --git a/ipv6/wide-dhcpv6/files/dhcp6s.hotplug b/ipv6/wide-dhcpv6/files/dhcp6s.hotplug
new file mode 100644 (file)
index 0000000..7260149
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+include /lib/network
+
+config_load "dhcp6s"
+
+local enabled
+config_get_bool enabled basic enabled 0
+[ $enabled -eq 0 ] && return 0
+
+local server_interface
+config_get server_interface basic interface
+
+if [ "$INTERFACE" = "$server_interface" ] && [ "$ACTION" = "ifup" ]; then
+       /etc/init.d/dhcp6s start
+fi
+
+if [ "$INTERFACE" = "$server_interface" ] && [ "$ACTION" = "ifdown" ]; then
+       /etc/init.d/dhcp6s stop
+fi
diff --git a/ipv6/wide-dhcpv6/files/dhcp6s.init b/ipv6/wide-dhcpv6/files/dhcp6s.init
new file mode 100644 (file)
index 0000000..6141e72
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2012 OpenWrt.org
+
+SERVICE_USE_PID=1
+
+start() {
+       [ ! -e /etc/dhcp6sctlkey ] && `dd if=/dev/urandom count=1 2> /dev/null | md5sum | cut -d" " -f1 > /etc/dhcp6sctlkey`
+
+       [ -e /var/run/dhcp6s.pid ] && return 0
+
+       . /lib/functions/network.sh
+
+       config_load "dhcp6s"
+
+       local enabled
+       config_get_bool enabled basic enabled 0
+       [ $enabled -eq 0 ] && return 0
+
+       logger starting dhcp6s
+
+       local server_interface server_ifname
+       config_get server_interface basic interface
+       network_get_device server_ifname "$server_interface" || return 1
+
+       local config_file
+       config_get config_file basic config_file
+
+       [ ! -e $config_file ] && return 1
+
+       service_start /usr/sbin/dhcp6s -c $config_file $server_ifname
+}
+
+stop() {
+       logger stopping dhcp6s
+       service_stop /usr/sbin/dhcp6s
+}
+
diff --git a/ipv6/wide-dhcpv6/patches/000-cftoken-noyywrap.patch b/ipv6/wide-dhcpv6/patches/000-cftoken-noyywrap.patch
new file mode 100644 (file)
index 0000000..df1361e
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/cftoken.l        2007-03-21 10:52:55.000000000 +0100
++++ b/cftoken.l        2009-06-12 15:40:03.000000000 +0200
+@@ -1,5 +1,6 @@
+ /*    $KAME: cftoken.l,v 1.35 2005/01/12 06:06:11 suz Exp $   */
++%option noyywrap
+ %{
+ /*
+  * Copyright (C) 2002 WIDE Project.
diff --git a/ipv6/wide-dhcpv6/patches/001-linux_old_compat.patch b/ipv6/wide-dhcpv6/patches/001-linux_old_compat.patch
new file mode 100644 (file)
index 0000000..6dca9f3
--- /dev/null
@@ -0,0 +1,37 @@
+--- wide-dhcpv6-20080615.orig/common.h 2007-03-21 20:52:57.000000000 +1100
++++ wide-dhcpv6-20080615/common.h      2009-11-29 16:00:02.000000000 +1100
+@@ -187,3 +187,34 @@
+ #ifndef HAVE_STRLCPY
+ extern size_t strlcpy __P((char *, const char *, size_t));
+ #endif
++
++/*
++ * compat hacks in case libc and kernel get out of sync:
++ *
++ * glibc 2.4 and uClibc 0.9.29 introduce IPV6_RECVPKTINFO etc. and change IPV6_PKTINFO
++ * This is only supported in Linux kernel >= 2.6.14
++ *
++ * This is only an approximation because the kernel version that libc was compiled against
++ * could be older or newer than the one being run.  But this should not be a problem --
++ * we just keep using the old kernel interface.
++ *
++ * these are placed here because they're needed in all of socket.c, recv.c and send.c
++ */
++#ifdef __linux__
++#  if defined IPV6_RECVHOPLIMIT || defined IPV6_RECVPKTINFO
++#    include <linux/version.h>
++#    if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
++#      if defined IPV6_RECVHOPLIMIT && defined IPV6_2292HOPLIMIT
++#        undef IPV6_RECVHOPLIMIT
++#        define IPV6_RECVHOPLIMIT IPV6_2292HOPLIMIT
++#      endif
++#      if defined IPV6_RECVPKTINFO && defined IPV6_2292PKTINFO
++#        undef IPV6_RECVPKTINFO
++#        undef IPV6_PKTINFO
++#        define IPV6_RECVPKTINFO IPV6_2292PKTINFO
++#        define IPV6_PKTINFO IPV6_2292PKTINFO
++#      endif
++#    endif
++#  endif
++#endif
++
diff --git a/ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch b/ipv6/wide-dhcpv6/patches/002-fix-dprintf-clash.patch
new file mode 100644 (file)
index 0000000..a1efcae
--- /dev/null
@@ -0,0 +1,56 @@
+Index: wide-dhcpv6-20080615/common.c
+===================================================================
+--- wide-dhcpv6-20080615.orig/common.c 2010-11-02 22:07:03.161000001 +0100
++++ wide-dhcpv6-20080615/common.c      2010-11-02 22:07:19.532000002 +0100
+@@ -3207,7 +3207,7 @@
+ }
+ void
+-dprintf(int level, const char *fname, const char *fmt, ...)
++my_dprintf(int level, const char *fname, const char *fmt, ...)
+ {
+       va_list ap;
+       char logbuf[LINE_MAX];
+Index: wide-dhcpv6-20080615/Makefile.in
+===================================================================
+--- wide-dhcpv6-20080615.orig/Makefile.in      2010-11-02 22:07:03.151000001 +0100
++++ wide-dhcpv6-20080615/Makefile.in   2010-11-02 22:07:19.533000002 +0100
+@@ -37,7 +37,7 @@
+ group= @group@
+ CFLAGS=       @CFLAGS@ @DEFS@ -DSYSCONFDIR=\"${sysconfdir}\" \
+-      -DLOCALDBDIR=\"${localdbdir}\"
++      -DLOCALDBDIR=\"${localdbdir}\" $(EXTRA_CFLAGS)
+ LDFLAGS=@LDFLAGS@
+ LIBOBJS=@LIBOBJS@
+ LIBS= @LIBS@ @LEXLIB@
+Index: wide-dhcpv6-20080615/common.h
+===================================================================
+--- wide-dhcpv6-20080615.orig/common.h 2010-11-02 22:07:23.187000002 +0100
++++ wide-dhcpv6-20080615/common.h      2010-11-02 22:08:43.646001043 +0100
+@@ -155,7 +155,6 @@
+ extern int in6_addrscopebyif __P((struct in6_addr *, char *));
+ extern int in6_scope __P((struct in6_addr *));
+ extern void setloglevel __P((int));
+-extern void dprintf __P((int, const char *, const char *, ...));
+ extern int get_duid __P((char *, struct duid *));
+ extern void dhcp6_init_options __P((struct dhcp6_optinfo *));
+ extern void dhcp6_clear_options __P((struct dhcp6_optinfo *));
+Index: wide-dhcpv6-20080615/debug.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ wide-dhcpv6-20080615/debug.h       2010-11-02 22:14:58.354999418 +0100
+@@ -0,0 +1,13 @@
++#ifndef MY_DEBUG_H_
++#define MY_DEBUG_H_
++
++/* First include stdio.h, which may contain the prototype for the external dprintf.
++ * We do not want that. We redefine dprintf to our local implementation. */
++#include <stdio.h>
++#define dprintf my_dprintf
++#ifndef __P
++# define __P(x) x
++#endif
++extern void my_dprintf __P((int, const char *, const char *, ...));
++
++#endif /* MY_DEBUG_H_ */
diff --git a/lang/4th/Makefile b/lang/4th/Makefile
new file mode 100644 (file)
index 0000000..f830495
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=4th
+PKG_VERSION:=3.62.0
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nano.tar.gz
+PKG_SOURCE_URL:=http://4th.googlecode.com/files/
+PKG_MD5SUM:=087e3a18a278046cc02abc968515646c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/4th
+  MAINTAINER:="Xiangfu Liu" <xiangfu@sharism.cc>
+  TITLE:=4th
+  SECTION:=lang
+  CATEGORY:=Languages
+  URL:=http://thebeez.home.xs4all.nl/4tH/
+endef
+
+define Package/4th/description
+  4th forth compiler
+endef
+
+MAKE_VARS += \
+       LIBRARIES="${PKG_INSTALL_DIR}/usr/lib" \
+       BINARIES="${PKG_INSTALL_DIR}/usr/bin"
+MAKE_FLAGS += \
+       -C $(PKG_BUILD_DIR)/sources -f Makefile.NAN
+
+define Package/4th/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sources/4th $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sources/4tsh $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sources/pp4th $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/sources/lib4th.a $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,4th))
diff --git a/lang/arm/Makefile b/lang/arm/Makefile
new file mode 100644 (file)
index 0000000..939edd0
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2011-2012 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:=arm
+PKG_VERSION:=1.4.5.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://archive.torproject.org/arm
+PKG_MD5SUM:=f85f306e50b90796ab7097d948e8fcf2
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/arm
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=Terminal status monitor for Tor relays
+  URL:=http://www.atagar.com/arm/
+  DEPENDS:=+python +python-ncurses +python-readline
+endef
+
+define Package/arm/description
+  Command line application for monitoring Tor, providing real time status
+  information such as the current configuration, bandwidth usage, message log,
+  connections, etc. This uses a curses interface much like 'top' does for system
+  usage. The application is intended for command-line aficionados, ssh
+  connections, and anyone with a tty terminal for checking their relay's status.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
+endef
+
+define Package/arm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/arm $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/arm $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,arm))
diff --git a/lang/cython/Makefile b/lang/cython/Makefile
new file mode 100644 (file)
index 0000000..0e02fdf
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2009-2010 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:=cython
+PKG_VERSION:=0.10.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=Cython-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.cython.org/
+PKG_BUILD_DIR:=$(BUILD_DIR)/Cython-$(PKG_VERSION)
+PKG_MD5SUM:=684103ed37472d9beef3a38e0d5c431d
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/cython
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=cython
+  URL:=http://www.cython.org
+  DEPENDS:=+python-mini
+endef
+
+define Package/cython/description
+  Cython is a language that should make writing C extensions for the Python language easier
+endef
+
+define Build/Compile
+       # <--no-cython-compile> required, otherwise setup.py calls the target-gcc to create so-files which obviously can't be used by <python> on the host system.
+       $(call Build/Compile/PyMod,,install --no-cython-compile --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,cython))
diff --git a/lang/distribute/Makefile b/lang/distribute/Makefile
new file mode 100644 (file)
index 0000000..c38d277
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2006 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:=distribute
+PKG_VERSION:=0.6.21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/d/$(PKG_NAME)/
+PKG_MD5SUM:=f783444754861f9b33e9f4083bd97b60
+PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)/
+
+HOST_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+PYTHON:=$(HOST_PYTHON_BIN)
+
+define Package/distribute
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Distribute
+  URL:=http://pypi.python.org/pypi/distribute
+  DEPENDS:=+python
+  PROVIDES:=setuptools
+endef
+
+define Package/distribute/description
+  Distribute (fork of Setuptools) is a collection of extensions to Distutils
+endef
+
+define Host/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Host/Install
+       $(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(STAGING_DIR)$(PYTHON_PKG_DIR)/
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Package/distribute/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+           $(PKG_INSTALL_DIR)/usr/bin/easy_install \
+           $(1)/usr/bin/
+       $(SED) '1s/#\!.*/#\!\/usr\/bin\/python/' $(1)/usr/bin/easy_install
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,distribute))
diff --git a/lang/egenix-mx/Makefile b/lang/egenix-mx/Makefile
new file mode 100644 (file)
index 0000000..80ebe50
--- /dev/null
@@ -0,0 +1,94 @@
+#
+# Copyright (C) 2007-2008 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:=egenix-mx
+PKG_VERSION:=2.0.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-base-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.egenix.com/python/
+PKG_MD5SUM:=66841151728a06f92d0b8dd2ed317a29
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-base-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-egenix-mx
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+python-mini
+  TITLE:=Egenix mxBase
+  URL:=http://www.egenix.com/products/python/mxBase/
+endef
+
+define Package/python-egenix-mx/description
+ This package contains a set of base packages from Egenix required by other
+ python packages.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               build --build-lib="foo", \
+               BASECFLAGS="$(TARGET_CFLAGS)" \
+               OPT="" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/mx/BeeBase/mxBeeBase
+       $(CP) \
+               $(PKG_BUILD_DIR)/mx/BeeBase/mxBeeBase/mxh.h \
+               $(PKG_BUILD_DIR)/mx/BeeBase/mxBeeBase/btr.h \
+               $(PKG_BUILD_DIR)/mx/BeeBase/mxBeeBase/mxBeeBase.h \
+               $(1)$(PYTHON_PKG_DIR)/mx/BeeBase/mxBeeBase/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/mx/DateTime/mxDateTime
+       $(CP) \
+               $(PKG_BUILD_DIR)/mx/DateTime/mxDateTime/mxh.h \
+               $(PKG_BUILD_DIR)/mx/DateTime/mxDateTime/mxDateTime.h \
+               $(1)$(PYTHON_PKG_DIR)/mx/DateTime/mxDateTime/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/mx/Proxy/mxProxy
+       $(CP) \
+               $(PKG_BUILD_DIR)/mx/Proxy/mxProxy/mxh.h \
+               $(PKG_BUILD_DIR)/mx/Proxy/mxProxy/mxProxy.h \
+               $(1)$(PYTHON_PKG_DIR)/mx/Proxy/mxProxy/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/mx/Queue/mxQueue
+       $(CP) \
+               $(PKG_BUILD_DIR)/mx/Queue/mxQueue/mxh.h \
+               $(PKG_BUILD_DIR)/mx/Queue/mxQueue/mxQueue.h \
+               $(1)$(PYTHON_PKG_DIR)/mx/Queue/mxQueue/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/mx/TextTools/mxTextTools
+       $(CP) \
+               $(PKG_BUILD_DIR)/mx/TextTools/mxTextTools/mxh.h \
+               $(PKG_BUILD_DIR)/mx/TextTools/mxTextTools/mxbmse.h \
+               $(PKG_BUILD_DIR)/mx/TextTools/mxTextTools/mxte.h \
+               $(PKG_BUILD_DIR)/mx/TextTools/mxTextTools/mxTextTools.h \
+               $(1)$(PYTHON_PKG_DIR)/mx/TextTools/mxTextTools/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/mx/Tools/mxTools
+       $(CP) \
+               $(PKG_BUILD_DIR)/mx/Tools/mxTools/mxh.h \
+               $(PKG_BUILD_DIR)/mx/Tools/mxTools/mxTools.h \
+               $(1)$(PYTHON_PKG_DIR)/mx/Tools/mxTools/
+endef
+
+define PyPackage/python-egenix-mx/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) $(PKG_BUILD_DIR)/foo/mx $(1)$(PYTHON_PKG_DIR)/
+       ln -sf  $(1)$(PYTHON_PKG_DIR)/mx/BeeBase/ExitFunctions.py \
+               $(1)$(PYTHON_PKG_DIR)/mx/Misc/
+       rm -rf  $(1)$(PYTHON_PKG_DIR)/mx/*/Examples
+endef
+
+$(eval $(call PyPackage,python-egenix-mx))
+$(eval $(call BuildPackage,python-egenix-mx))
diff --git a/lang/eggdrop/Makefile b/lang/eggdrop/Makefile
new file mode 100644 (file)
index 0000000..c42d78f
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2008 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:=eggdrop
+PKG_VERSION:=1.6.17
+PKG_RELEASE:=1
+
+PKG_SOURCE:=eggdrop$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.eggheads.org/pub/eggdrop/source/1.6
+PKG_MD5SUM:=68e181201483dee398f9904e8652e6ca
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(PKG_VERSION)
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/eggdrop
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=EggDrop IRC BOT
+  DEPENDS:=+tcl +zlib
+  URL:=http://www.eggheads.org
+endef
+
+define Package/eggdrop/description
+       EggDrop IRC BOT
+endef
+
+CONFIGURE_ARGS+=\
+       --prefix="$(PKG_INSTALL_DIR)/eggdrop" \
+       --enable-threads \
+       --with-tcllib="$(STAGING_DIR)/usr/lib/libtcl8.5.so" \
+       --with-tclinc="$(STAGING_DIR)/usr/include/tcl.h"
+
+define Build/Compile
+       $(MAKE) config -C $(PKG_BUILD_DIR)
+       $(call Build/Compile/Default)
+endef
+
+define Build/Install
+       $(call Build/Install/Default)
+       rm -Rvf $(PKG_INSTALL_DIR)/eggdrop/doc
+endef
+
+define Package/eggdrop/install
+       $(INSTALL_DIR) $(1)/eggdrop
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/eggdrop
+endef
+
+$(eval $(call BuildPackage,eggdrop))
diff --git a/lang/eggdrop/patches/001-makefile_in.patch b/lang/eggdrop/patches/001-makefile_in.patch
new file mode 100644 (file)
index 0000000..8c09c41
--- /dev/null
@@ -0,0 +1,11 @@
+--- eggdrop/Makefile.in        2004-07-25 07:17:33.000000000 -0400
++++ eggdrop-patched/Makefile.in        2005-05-01 04:33:56.890000000 -0400
+@@ -71,7 +71,7 @@
+ modconf = $(top_srcdir)/misc/modconfig --top_srcdir=$(top_srcdir)
+-egg_test_run = EGG_LANGDIR=$(top_srcdir)/language ./$(EGGEXEC) -v
++egg_test_run = EGG_LANGDIR=$(top_srcdir)/language #./$(EGGEXEC) -v
+ post_config  =  echo "" && \
+               echo "You can now compile the bot, using \"make\"." && \
diff --git a/lang/eggdrop/patches/002-eggdrop_h.patch b/lang/eggdrop/patches/002-eggdrop_h.patch
new file mode 100644 (file)
index 0000000..311b63c
--- /dev/null
@@ -0,0 +1,12 @@
+--- eggdrop/src/eggdrop.h      2008-09-08 21:09:57.000000000 +0100
++++ eggdrop-patched/src/eggdrop.h      2008-09-08 21:11:46.000000000 +0100
+@@ -218,9 +218,6 @@
+ #  define sigemptyset(x) ((*(int *)(x))=0)
+ #endif
+-#ifndef HAVE_SOCKLEN_T
+-typedef int socklen_t;
+-#endif
+ /*
+  *    Handy aliases for memory tracking and core dumps
diff --git a/lang/eggdrop/patches/003-language_c.patch b/lang/eggdrop/patches/003-language_c.patch
new file mode 100644 (file)
index 0000000..d67d4fc
--- /dev/null
@@ -0,0 +1,25 @@
+--- eggdrop/src/language.c     2004-04-06 07:56:38.000000000 +0100
++++ eggdrop-patched/src/language.c     2008-09-08 23:24:34.000000000 +0100
+@@ -240,8 +240,19 @@
+ #else
+         if (sscanf(lbuf, "0x%x,%500c", &lidx, ltext) != 2) {
+ #endif
+-          putlog(LOG_MISC, "*", "Malformed text line in %s at %d.",
+-                 langfile, lline);
++        ltexts++;
++          ctmp = strchr(ltext, '\n');
++          *ctmp = 0;
++          while (ltext[strlen(ltext) - 1] == '\\') {
++            ltext[strlen(ltext) - 1] = 0;
++            if (fgets(lbuf, 511, FLANG)) {
++              lline++;
++              ctmp = strchr(lbuf, '\n');
++              *ctmp = 0;
++              ltext = nrealloc(ltext, strlen(lbuf) + strlen(ltext) + 1);
++              strcpy(strchr(ltext, 0), lbuf);
++            }
++        }
+         } else {
+           ltexts++;
+           ctmp = strchr(ltext, '\n');
+
diff --git a/lang/eggdrop/patches/004-main_c.patch b/lang/eggdrop/patches/004-main_c.patch
new file mode 100644 (file)
index 0000000..ad263cd
--- /dev/null
@@ -0,0 +1,14 @@
+--- eggdrop/src/main.c 2004-07-02 22:21:08.000000000 +0100
++++ eggdrop/src/main-patched/main.c    2008-09-08 21:37:18.000000000 +0100
+@@ -792,8 +792,8 @@
+   printf("\n%s\n", version);
+   /* Don't allow eggdrop to run as root */
+-  if (((int) getuid() == 0) || ((int) geteuid() == 0))
+-    fatal("ERROR: Eggdrop will not run as root!", 0);
++  if (((int) getuid() == 666) || ((int) geteuid() == 666))
++    fatal("ERROR: Eggdrop will not run the devil!", 0);
+   init_dcc_max();
+   init_userent();
+
diff --git a/lang/erlang/Makefile b/lang/erlang/Makefile
new file mode 100644 (file)
index 0000000..553a4f7
--- /dev/null
@@ -0,0 +1,331 @@
+#
+# Copyright (C) 2009-2012 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:=erlang
+PKG_VERSION:=R16B02
+PKG_RELEASE:=1
+
+PKG_SOURCE:=otp_src_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= http://www.erlang.org/download/ \
+       http://erlang.mirror.su.se/
+PKG_MD5SUM:= ca63bcde0e5ae0f2df9457f97b3115a4
+
+PKG_BUILD_DEPENDS:=erlang/host openssl
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/otp_src_$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/otp_src_$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/erlang/Default
+  SUBMENU:=Erlang
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Erlang/OTP programming language
+  URL:=http://www.erlang.org/
+endef
+
+define Package/erlang/Default/description
+ Erlang/OTP is a general-purpose programming language and runtime
+ environment. Erlang has built-in support for concurrency, distribution
+ and fault tolerance.
+endef
+
+define Package/erlang
+$(call Package/erlang/Default)
+  DEPENDS+= +libncurses +librt +zlib
+  PROVIDES:= erlang-erts=5.10.3 erlang-kernel=2.16.3 erlang-sasl=2.3.3 erlang-stdlib=1.19.3
+endef
+
+define Package/erlang/description
+$(call Package/erlang/Default/description)
+ .
+ This package contains the runtime implementation and a minimal set of
+ modules (erts, kernel, sasl & stdlib).
+endef
+
+
+define Package/erlang-asn1
+$(call Package/erlang/Default)
+  TITLE:=Abstract Syntax Notation One (ASN.1) support
+  VERSION:=2.0.3
+  DEPENDS+= +erlang +erlang-syntax-tools
+endef
+
+define Package/erlang-asn1/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides Abstract Syntax Notation One (ASN.1)
+ support.
+endef
+
+
+define Package/erlang-compiler
+$(call Package/erlang/Default)
+  TITLE:=Byte code compiler
+  VERSION:=4.9.3
+  DEPENDS+= +erlang +erlang-hipe
+endef
+
+define Package/erlang-compiler/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides a byte code compiler for Erlang which
+ produces highly compact code.
+endef
+
+
+define Package/erlang-crypto
+$(call Package/erlang/Default)
+  TITLE:=Cryptography support
+  VERSION:=3.1
+  DEPENDS+= +erlang +libopenssl
+endef
+
+define Package/erlang-crypto/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides functions for computation of message
+ digests, and encryption and decryption functions.
+endef
+
+
+define Package/erlang-hipe
+$(call Package/erlang/Default)
+  TITLE:=High Performance Erlang
+  VERSION:=3.10.2.1
+  DEPENDS+= +erlang
+endef
+
+define Package/erlang-hipe/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides HiPE (High Performance Erlang)
+ support.
+endef
+
+
+define Package/erlang-inets
+$(call Package/erlang/Default)
+  TITLE:=Internet clients and servers
+  VERSION:=5.9.6
+  DEPENDS+= +erlang
+endef
+
+define Package/erlang-inets/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides a container for Internet clients and
+ servers. Currently a FTP client, a HTTP client and server, and a tftp
+ client and server have been incorporated in Inets.
+endef
+
+
+define Package/erlang-mnesia
+$(call Package/erlang/Default)
+  TITLE:=Distributed database
+  VERSION:=4.10
+  DEPENDS+= +erlang
+endef
+
+define Package/erlang-mnesia/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides a distributed DataBase Management
+ System (DBMS), appropriate for telecommunications applications and
+ other Erlang applications which require continuous operation and
+ exhibit soft real-time properties.
+endef
+
+
+define Package/erlang-runtime-tools
+$(call Package/erlang/Default)
+  TITLE:=Low-profile debugging/tracing tools
+  VERSION:=1.8.12
+  DEPENDS+= +erlang
+endef
+
+define Package/erlang-runtime-tools/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides low footprint tracing/debugging tools
+ suitable for inclusion in a production system.
+endef
+
+
+define Package/erlang-snmp
+$(call Package/erlang/Default)
+  TITLE:=Simple Network Management Protocol (SNMP) support
+  VERSION:=4.24.2
+  DEPENDS+= +erlang +erlang-asn1
+endef
+
+define Package/erlang-snmp/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides Simple Network Management Protocol
+ (SNMP) support including a MIB compiler and tools for creating SNMP
+ agents.
+endef
+
+
+define Package/erlang-ssh
+$(call Package/erlang/Default)
+  TITLE:=Secure Shell (SSH) support
+  VERSION:=2.1.8
+  DEPENDS+= +erlang +erlang-crypto
+endef
+
+define Package/erlang-ssh/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides an implementation of the Secure Shell
+ protocol, with SSH & SFTP support.
+endef
+
+
+define Package/erlang-ssl
+$(call Package/erlang/Default)
+  TITLE:=Secure Sockets Layer (SSL) support
+  VERSION:=5.3.1
+  DEPENDS+= +erlang +erlang-crypto
+endef
+
+define Package/erlang-ssl/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides support for secure communication over
+ sockets.
+endef
+
+
+define Package/erlang-syntax-tools
+$(call Package/erlang/Default)
+  TITLE:=Abstract Erlang syntax trees handling support
+  VERSION:=1.6.11
+  DEPENDS+= +erlang
+endef
+
+define Package/erlang-syntax-tools/description
+$(call Package/erlang/Default/description)
+ .
+ This Erlang/OTP package provides support for handling abstract Erlang
+ syntax trees.
+endef
+
+
+# Host
+
+HOST_CONFIGURE_ARGS += \
+       --disable-hipe \
+       --disable-smp-support \
+       --without-javac
+
+define Host/Compile
+       $(MAKE) -C $(HOST_BUILD_DIR) all
+endef
+
+define Host/Install
+       $(MAKE) -C $(HOST_BUILD_DIR) install
+endef
+
+
+# Target
+
+CONFIGURE_ARGS += \
+       --disable-hipe \
+       --disable-smp-support \
+       --without-javac \
+       --enable-dynamic-ssl-lib
+
+CONFIGURE_VARS += \
+       SHLIB_LD="$(TARGET_CC)" \
+       TARGET_ARCH="$(TARGET_ARCH)" \
+       ac_cv_func_mmap_fixed_mapped=yes \
+       ac_cv_path_WX_CONFIG_PATH=no \
+       erl_xcomp_getaddrinfo=no \
+       erl_xcomp_sysroot="$(STAGING_DIR)"
+
+EXTRA_LDFLAGS+=-lz
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               noboot
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+define Package/erlang/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       for f in epmd erl erlc escript run_erl; do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$$f $(1)/usr/bin/ ; \
+       done
+       $(INSTALL_DIR) $(1)/usr/lib/erlang/bin
+       for f in erl erlc escript run_erl start start.boot start.script start_clean.boot start_erl start_sasl.boot to_erl; do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/bin/$$$$f $(1)/usr/lib/erlang/bin/ ; \
+       done
+       $(INSTALL_DIR) $(1)/usr/lib/erlang/lib
+       for m in erts kernel sasl stdlib; do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/lib/$$$$m-* $(1)/usr/lib/erlang/lib/ ; \
+               rm -rf $(1)/usr/lib/erlang/lib/$$$$m-*/examples ; \
+               rm -rf $(1)/usr/lib/erlang/lib/$$$$m-*/src ; \
+       done
+       $(INSTALL_DIR) $(1)/usr/lib/erlang
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/erts-* $(1)/usr/lib/erlang/
+       rm -rf $(1)/usr/lib/erlang/erts-*/{doc,include,lib,man,src}
+       rm -rf $(1)/usr/lib/erlang/erts-*/bin/*.src
+       $(INSTALL_DIR) $(1)/usr/lib/erlang/releases
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/releases/* $(1)/usr/lib/erlang/releases/
+       $(SED) 's,%ERL_ROOT%,/usr/lib/erlang,g' \
+               $(1)/usr/lib/erlang/releases/RELEASES.src
+       mv -f $(1)/usr/lib/erlang/releases/RELEASES.src \
+               $(1)/usr/lib/erlang/releases/RELEASES
+       for f in bin/erl bin/start erts-*/bin/erl erts-*/bin/start; do \
+               $(SED) 's,^\(ROOTDIR\)=.*,\1=/usr/lib/erlang,g' \
+                       $(1)/usr/lib/erlang/$$$$f ; \
+       done
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/erl_interface/obj/*/*.a $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/lib/erl_interface/include/*.h $(1)/usr/include
+endef
+
+define BuildModule
+
+  define Package/erlang-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/erlang/lib
+       for m in $(2); do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/lib/$$$$$$$$m-* $$(1)/usr/lib/erlang/lib/ ; \
+               rm -rf $$(1)/usr/lib/erlang/lib/$$$$$$$$m-*/{examples,priv/obj,src} ; \
+       done
+  endef
+
+  $$(eval $$(call BuildPackage,erlang-$(1)))
+
+endef
+
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,erlang))
+$(eval $(call BuildModule,asn1,asn1))
+$(eval $(call BuildModule,compiler,compiler))
+$(eval $(call BuildModule,crypto,crypto))
+$(eval $(call BuildModule,hipe,hipe))
+$(eval $(call BuildModule,inets,inets))
+$(eval $(call BuildModule,mnesia,mnesia))
+$(eval $(call BuildModule,runtime-tools,runtime_tools))
+$(eval $(call BuildModule,snmp,snmp))
+$(eval $(call BuildModule,ssh,ssh))
+$(eval $(call BuildModule,ssl,ssl))
+$(eval $(call BuildModule,syntax-tools,syntax_tools))
diff --git a/lang/erlang/patches/101-emulator_includes.patch b/lang/erlang/patches/101-emulator_includes.patch
new file mode 100644 (file)
index 0000000..14d0f66
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/erts/emulator/Makefile.in
++++ b/erts/emulator/Makefile.in
+@@ -591,7 +591,7 @@ endif
+ $(OBJDIR)/%.o: beam/%.c
+-      $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@
++      $(V_CC) $(INCLUDES) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $< -o $@
+ else
diff --git a/lang/erlang/patches/103-disable_emacs.patch b/lang/erlang/patches/103-disable_emacs.patch
new file mode 100644 (file)
index 0000000..9412195
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/lib/tools/Makefile
++++ b/lib/tools/Makefile
+@@ -23,7 +23,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
+ # Macros
+ # ----------------------------------------------------
+-SUB_DIRECTORIES = c_src src doc/src examples priv emacs
++SUB_DIRECTORIES = c_src src doc/src examples priv
+ include vsn.mk
+ VSN = $(TOOLS_VSN)
diff --git a/lang/gst-python/Makefile b/lang/gst-python/Makefile
new file mode 100644 (file)
index 0000000..5ae2d4d
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2008-2009 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:=gst-python
+PKG_VERSION:=0.10.13
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-python/
+PKG_MD5SUM:=870440c6aad304112961ef5700d7698f
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+$(call include_mk, python-package.mk)
+
+
+TARGET_CFLAGS += $(FPIC)
+CONFIGURE_VARS += PYTHON=$(HOST_PYTHON)
+
+define Package/gst-python
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python bindings for gstreamer
+  URL:=http://gstreamer.freedesktop.org/
+  DEPENDS:=+gstreamer +gst-plugins-base +python-gobject +python-mini
+endef
+
+define Package/gst-python/description
+  python bindings for gstreamer
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+
+       $(SED) \
+               "s,^defsdir=.*,defsdir=$(STAGING_DIR)/usr/share/gst-python/0.10/defs/,g" \
+               $(1)/usr/lib/pkgconfig/gst-python-0.10.pc
+
+       $(INSTALL_DIR) $(1)/usr/share/gst-python/0.10/defs
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/gst-python/0.10/defs/* \
+               $(1)/usr/share/gst-python/0.10/defs/
+endef
+
+define Package/gst-python/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gst-0.10/gst/extend
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/{gstoption.so,pygst.pth,pygst.py} \
+               $(1)$(PYTHON_PKG_DIR)/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gst-0.10/gst/*.{so,py} \
+               $(1)$(PYTHON_PKG_DIR)/gst-0.10/gst/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gst-0.10/gst/extend/*.py \
+               $(1)$(PYTHON_PKG_DIR)/gst-0.10/gst/extend/
+endef
+
+$(eval $(call BuildPackage,gst-python))
diff --git a/lang/ipython/Makefile b/lang/ipython/Makefile
new file mode 100644 (file)
index 0000000..a240e13
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2008-2010 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:=ipython
+PKG_VERSION:=0.8.2
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ipython.scipy.org/dist/
+PKG_FIXUP:=autoreconf
+PKG_MD5SUM:=fd5a1b6e518898a4aee8b8d8b428af70
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipython
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=ipython
+  URL:=http://ipython.scipy.org/
+endef
+
+define Package/ipython/description
+  An enhanced interactive Python shell from the SciPy project
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               if [ -x $(CONFIGURE_CMD) ]; then \
+                       $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/ && \
+                       $(CONFIGURE_VARS) \
+                       PYTHON=/usr/bin/python \
+                       $(CONFIGURE_CMD) \
+                       $(CONFIGURE_ARGS) ;\
+               fi \
+       )
+endef
+
+define Build/Compile
+       cd $(PKG_BUILD_DIR) ; $(CONFIGURE_VARS) ./setup.py install --prefix="$(PKG_INSTALL_DIR)/usr"
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+define Package/ipython/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,ipython))
diff --git a/lang/jamvm/Makefile b/lang/jamvm/Makefile
new file mode 100644 (file)
index 0000000..56ef4ba
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006-2012 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:=jamvm
+PKG_VERSION:=1.6.0-git
+PKG_RELEASE:=2
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://git.berlios.de/jamvm
+PKG_SOURCE_VERSION:=4617da717ecb05654ea5bb9572338061106a414d
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_MIRROR_MD5SUM:=66a728a3cb8dad0e3773035c4049eb5f
+
+PKG_USE_MIPS16:=0
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/jamvm
+  SUBMENU:=Java
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=A compact Java Virtual Machine
+  URL:=http://sourceforge.net/projects/jamvm
+  DEPENDS:=+zlib +libpthread +librt +classpath @!avr32
+endef
+
+define Package/jamvm/description
+ JamVM is a new Java Virtual Machine which conforms to the JVM
+ specification version (blue book). In comparison to most other VM's (free
+ and commercial) it is extremely small.However, unlike other small VMs
+ (e.g. KVM) it is designed to support the full specification, and includes
+ support for object finalisation, Soft/Weak/Phantom References, the Java
+ Native Interface (JNI) and the Reflection API.
+endef
+
+CONFIGURE_ARGS += \
+       --with-java-runtime-library=gnuclasspath \
+       --with-classpath-install-dir=/usr \
+       --disable-int-inlining \
+       --disable-shared \
+       --without-pic
+
+MAKE_FLAGS += \
+       GLIBJ_ZIP=$(STAGING_DIR)/usr/share/classpath/glibj.zip
+
+define Package/jamvm/install
+       $(INSTALL_DIR) $(1)/usr
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin \
+               $(PKG_INSTALL_DIR)/usr/share \
+               $(1)/usr/
+endef
+
+define Build/InstallDev
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,jamvm))
diff --git a/lang/jsonpath/Makefile b/lang/jsonpath/Makefile
new file mode 100644 (file)
index 0000000..25cb124
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 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:=jsonpath
+PKG_VERSION:=0.52.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.ultimate.com/phil/python/download/
+PKG_MD5SUM:=4cd0c3a70acbc67d2915d64f132cdb4f
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/jsonpath
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=JsonPath - XPath implementation
+  URL:=http://goessner.net/articles/JsonPath/
+  DEPENDS:=+python
+endef
+
+define Package/jsonpath/description
+  An XPath implementation for JSON
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/jsonpath/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,jsonpath))
diff --git a/lang/kid/Makefile b/lang/kid/Makefile
new file mode 100644 (file)
index 0000000..f5c4b90
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2007-2008 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:=kid
+PKG_VERSION:=0.9.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.kid-templating.org/dist/0.9.6/dist
+PKG_MD5SUM:=31e7156698a6f214b4067afb9e13728f
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-kid
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+python
+  TITLE:=XML-based Templating
+  URL:=http://www.kid-templating.org/
+endef
+
+define Package/python-kid/description
+ Kid is a simple template language for XML based vocabularies written in
+ Python.
+endef
+
+define PyPackage/python-kid/filespec
++|$(PYTHON_PKG_DIR)/kid
+-|$(PYTHON_PKG_DIR)/kid/test
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+$(eval $(call PyPackage,python-kid))
+$(eval $(call BuildPackage,python-kid))
diff --git a/lang/kid/patches/000-setup.patch b/lang/kid/patches/000-setup.patch
new file mode 100644 (file)
index 0000000..aeb059e
--- /dev/null
@@ -0,0 +1,20 @@
+diff -urN kid-0.9.6_orig/setup.py kid-0.9.6/setup.py
+--- kid-0.9.6/setup.py 2007-07-16 13:02:49.000000000 +0200
++++ kid-0.9.6/setup.py 2007-08-15 14:39:37.000000000 +0200
+@@ -1,15 +1,12 @@
+ #!/usr/bin/env python
+ # bootstrap setuptools if necessary
+-from ez_setup import use_setuptools
+-use_setuptools()
++from distutils.core import setup
+ import os
+ execfile(os.path.join("kid", "release.py"))
+-from setuptools import setup, find_packages
+-
+ setup(
+     name="kid",
+     version=version,
diff --git a/lang/logilab-astng/Makefile b/lang/logilab-astng/Makefile
new file mode 100644 (file)
index 0000000..c25a36c
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2008 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:=logilab-astng
+PKG_VERSION:=0.17.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.logilab.fr/pub/astng/
+PKG_MD5SUM:=a654d65a4644fb984d840906cf8b27d5
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/logilab-astng
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=logilab-astng
+  URL:=http://www.logilab.fr
+  DEPENDS:=+python-mini
+endef
+
+define Package/logilab-astng/description
+  The aim of this module is to provide a common base representation of python source code for projects such as pychecker, pyreverse, pylint...
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+define Package/logilab-astng/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,logilab-astng))
diff --git a/lang/logilab-common/Makefile b/lang/logilab-common/Makefile
new file mode 100644 (file)
index 0000000..94b2671
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2008 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:=logilab-common
+PKG_VERSION:=0.29.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.logilab.fr/pub/common/
+PKG_MD5SUM:=90f679e0d4ed19e2bf083fb932cde922
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/logilab-common
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=logilab-common
+  URL:=http://www.logilab.fr
+  DEPENDS:=+python-mini
+endef
+
+define Package/logilab-common/description
+  a bunch of modules providing low level functionnalities shared among some python projects devel
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+define Package/logilab-common/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,logilab-common))
diff --git a/lang/lsqlite3/Makefile b/lang/lsqlite3/Makefile
new file mode 100644 (file)
index 0000000..b5e15d3
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2009-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:=lsqlite3
+PKG_VERSION:=7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/4472
+PKG_MD5SUM:=ef7afdd3ea7a29333daa951cda3175bb
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lsqlite3
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=LuaSQLite3
+  URL:=http://luasqlite.luaforge.net/lsqlite3.html
+  DEPENDS:=+lua +libsqlite3
+endef
+
+define Package/lsqlite3/description
+ LuaSQLite 3 is a thin wrapper around the public domain SQLite3 database engine.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC) $(TARGET_CPPFLAGS) -std=c99
+
+TARGET_LDFLAGS += -llua -lsqlite3
+
+MAKE_FLAGS += \
+       CC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       INCS="$(TARGET_CPPFLAGS)" \
+       LIBS="$(TARGET_LDFLAGS)" \
+       SHFLAGS="-shared" \
+       UNAME="Linux"
+
+define Package/lsqlite3/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(CP) $(PKG_BUILD_DIR)/lsqlite3.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,lsqlite3))
diff --git a/lang/luacurl/Makefile b/lang/luacurl/Makefile
new file mode 100644 (file)
index 0000000..1b20c72
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2014 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:=luacurl
+PKG_VERSION:=20140207
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/msva/lua-curl.git
+PKG_SOURCE_VERSION:=047ac31ecd18c2526eed84e349e5016de2633fac
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/luacurl
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua-cURL
+  URL:=http://msva.github.io/lua-curl/
+  DEPENDS:=+liblua +libcurl
+endef
+
+define Package/luacurl/description
+ Lua-cURL is aiming for a full-fledged libcurl binding (easy/multi/share
+ interface) to the functionality of Lua
+endef
+
+CMAKE_OPTIONS += \
+       -DUSE_LUA=ON
+
+define Package/luacurl/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cURL.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,luacurl))
diff --git a/lang/luaprofiler/Makefile b/lang/luaprofiler/Makefile
new file mode 100644 (file)
index 0000000..d0e5568
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2006-2009 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:=luaprofiler
+PKG_VERSION:=2.0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/3400
+PKG_MD5SUM:=611435c8e61e1a330ee0aa8ddc9c124a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luaprofiler
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua Profiler
+  URL:=http://luaprofiler.luaforge.net
+  DEPENDS:=+lua
+endef
+
+define Package/luaprofiler/description
+ Profile any Lua application
+endef
+
+define Build/Configure
+
+endef
+
+TARGET_CFLAGS += $(FPIC) $(TARGET_CPPFLAGS)
+
+TARGET_LDFLAGS += -llua
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               -f Makefile.linux
+endef
+
+define Package/luaprofiler/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(CP) $(PKG_BUILD_DIR)/bin/profiler.so $(1)/usr/lib/lua/
+endef
+
+$(eval $(call BuildPackage,luaprofiler))
diff --git a/lang/luaprofiler/patches/100-link.patch b/lang/luaprofiler/patches/100-link.patch
new file mode 100644 (file)
index 0000000..804e39c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -4,7 +4,7 @@ OBJS= src/clocks.o src/core_profiler.o s
+ profiler: $(OBJS)
+-      mkdir -p bin && $(LD) -Bshareable -o $(PROFILER_OUTPUT) $(OBJS)
++      mkdir -p bin && $(LD) -Bshareable -o $(PROFILER_OUTPUT) $(OBJS) $(LDFLAGS)
+ clean:
+       rm -f $(PROFILER_OUTPUT) src/*.o
diff --git a/lang/luasoap/Makefile b/lang/luasoap/Makefile
new file mode 100644 (file)
index 0000000..6d650b7
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 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:=luasoap
+PKG_VERSION:=2.0.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/downloads/tomasguisasola/luasoap/
+PKG_MD5SUM:=3aafa06f3a65e65f4ee08e12b89ec583
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luasoap
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=LuaSOAP
+  URL:=https://github.com/tomasguisasola/luasoap
+  DEPENDS:=+lua +luaexpat +luasec +luasocket
+endef
+
+define Package/luasoap/description
+  LuaSOAP is a library of functions to deal with SOAP.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/luasoap/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/soap.lua $(1)/usr/lib/lua/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/soap
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{client,server}.lua $(1)/usr/lib/lua/soap/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/soap/client
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/client/https.lua $(1)/usr/lib/lua/soap/client/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/soap/tests
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/tests/test{,-http,-server}.lua $(1)/usr/lib/lua/soap/tests/
+endef
+
+$(eval $(call BuildPackage,luasoap))
diff --git a/lang/luasql/Makefile b/lang/luasql/Makefile
new file mode 100644 (file)
index 0000000..275d318
--- /dev/null
@@ -0,0 +1,121 @@
+#
+# Copyright (C) 2010 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:=luasql
+PKG_VERSION:=2.1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/2686/
+PKG_MD5SUM:=63bdd57de4b9d1be336ba112d8cb69eb
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luasql/Default
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lua SQL binding
+  URL:=http://www.keplerproject.org/luasql/
+  DEPENDS:= +lua
+endef
+
+define Package/luasql/Default/description
+ LuaSQL is a simple interface from Lua to a DBMS.
+endef
+
+
+define Package/luasql-mysql
+$(call Package/luasql/Default)
+  TITLE+= for MySQL
+  DEPENDS+= +libmysqlclient
+  VARIANT:=mysql
+endef
+
+define Package/luasql-mysql/description
+$(call Package/luasql/Default/description)
+ .
+ This package contains the MySQL binding.
+endef
+
+
+define Package/luasql-pgsql
+$(call Package/luasql/Default)
+  TITLE+= for PostgreSQL
+  DEPENDS+= +libpq
+  VARIANT:=postgres
+endef
+
+define Package/luasql-pgsql/description
+$(call Package/luasql/Default/description)
+ .
+ This package contains the PostgreSQL binding.
+endef
+
+
+define Package/luasql-sqlite3
+$(call Package/luasql/Default)
+  TITLE+= for SQLite 3
+  DEPENDS+= +libsqlite3
+  VARIANT:=sqlite3
+endef
+
+define Package/luasql-sqlite3/description
+$(call Package/luasql/Default/description)
+ .
+ This package contains the SQLite 3 binding.
+endef
+
+
+TARGET_CFLAGS += $(FPIC) -std=gnu99
+TARGET_CPPFLAGS += -DLUA_USE_LINUX
+
+ifeq ($(BUILD_VARIANT),mysql)
+  TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/mysql
+  TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
+endif
+
+ifeq ($(BUILD_VARIANT),postgres)
+  TARGET_LDFLAGS += -lpq
+endif
+
+ifeq ($(BUILD_VARIANT),sqlite3)
+  TARGET_LDFLAGS += -lsqlite3 -lpthread
+endif
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               T="$(BUILD_VARIANT)" \
+               PREFIX="$(STAGING_DIR)/usr" \
+               LUA_LIBDIR="$(STAGING_DIR)/usr/lib/lua" \
+               DRIVER_INCS="$(TARGET_CPPFLAGS)" \
+               DRIVER_LIBS="$(TARGET_LDFLAGS)" \
+               CC="$(TARGET_CROSS)gcc" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               lib
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               T="$(BUILD_VARIANT)" \
+               LUA_LIBDIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \
+               install
+endef
+
+define Build/Install/Default
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luasql
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lua/luasql/*.so $(1)/usr/lib/lua/luasql/
+endef
+
+Package/luasql-mysql/install = $(Build/Install/Default)
+Package/luasql-pgsql/install = $(Build/Install/Default)
+Package/luasql-sqlite3/install = $(Build/Install/Default)
+
+$(eval $(call BuildPackage,luasql-mysql))
+$(eval $(call BuildPackage,luasql-pgsql))
+$(eval $(call BuildPackage,luasql-sqlite3))
diff --git a/lang/luavstruct/Makefile b/lang/luavstruct/Makefile
new file mode 100644 (file)
index 0000000..f2ead47
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2013 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:=luavstruct
+PKG_VERSION:=1.1.4
+PKG_RELEASE=1
+
+PKG_SOURCE_URL:=https://github.com/ToxicFrog/vstruct.git
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_VERSION:=438d262bc5b88b69b4b076ce20d3fcfcbc97c0dc
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
+
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luavstruct
+  SUBMENU:=Lua
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=luavstruct
+  URL:=https://github.com/ToxicFrog/vstruct
+  DEPENDS:=+lua
+endef
+
+define Package/luavstruct/description
+VStruct is a library for Lua 5.1. It provides functions for manipulating binary
+data, in particular for unpacking binary files or byte buffers into Lua values
+and for packing Lua values back into files or buffers.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/luavstruct/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua/vstruct
+       $(CP) $(PKG_BUILD_DIR)/vstruct/*.lua $(1)/usr/lib/lua/vstruct
+       $(INSTALL_DIR) $(1)/usr/lib/lua/vstruct/ast
+       $(CP) $(PKG_BUILD_DIR)/vstruct/ast/*.lua $(1)/usr/lib/lua/vstruct/ast
+       $(INSTALL_DIR) $(1)/usr/lib/lua/vstruct/io
+       $(CP) $(PKG_BUILD_DIR)/vstruct/io/*.lua $(1)/usr/lib/lua/vstruct/io
+endef
+
+$(eval $(call BuildPackage,luavstruct))
diff --git a/lang/mako/Makefile b/lang/mako/Makefile
new file mode 100644 (file)
index 0000000..d5101d0
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2008 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:=mako
+PKG_VERSION:=0.2.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=Mako-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.makotemplates.org/downloads/
+PKG_MD5SUM:=d8ca783630dc5e93970a2075532fa643
+
+PKG_BUILD_DEPENDS:=distribute/host
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(subst .tar.gz,,$(PKG_SOURCE))
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/mako
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Mako Templates for Python
+  URL:=http://www.makotemplates.org/
+  DEPENDS:=+python
+endef
+
+define Package/mako/description
+Mako is a template library written in Python. It provides a familiar,
+non-XML syntax which compiles into Python modules for maximum
+performance. Mako's syntax and API borrows from the best ideas of many
+others, including Django templates, Cheetah, Myghty, and
+Genshi. Conceptually, Mako is an embedded Python (i.e. Python Server
+Page) language, which refines the familiar ideas of componentized
+layout and inheritance to produce one of the most straightforward and
+flexible models available, while also maintaining close ties to Python
+calling and scoping semantics.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Package/mako/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,mako))
diff --git a/lang/numpy/Makefile b/lang/numpy/Makefile
new file mode 100644 (file)
index 0000000..e9985cc
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2008-2009 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:=numpy
+PKG_VERSION:=1.0.4
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/numpy
+PKG_MD5SUM:=8f011e9d7697da570efaac61c51725e0
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/numpy
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=numpy
+  URL:=http://numpy.sf.net
+  DEPENDS:=+python-mini @TARGET_x86||TARGET_olpc||TARGET_uml @BROKEN
+endef
+
+define Package/numpy/description
+  API to GTK and glade library from python
+endef
+
+define Build/Compile
+       cd $(PKG_BUILD_DIR) ; $(CONFIGURE_VARS) $(MAKE_VARS) python2.5 ./setup.py install --prefix="$(PKG_INSTALL_DIR)/usr"
+endef
+
+define Package/numpy/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+define Require/python25-dev
+[ -e /usr/include/python2.5/pyconfig.h ]
+endef
+
+$(eval $(call Require,python25-dev, \
+       Please install Python 2.5 (including development headers and libraries) \
+))
+
+$(eval $(call BuildPackage,numpy))
+
diff --git a/lang/numpy/patches/100-compile.patch b/lang/numpy/patches/100-compile.patch
new file mode 100644 (file)
index 0000000..632e409
--- /dev/null
@@ -0,0 +1,112 @@
+diff -urN numpy-1.0.4/numpy/core/include/numpy/ufuncobject.h numpy-1.0.4.patched/numpy/core/include/numpy/ufuncobject.h
+--- numpy-1.0.4/numpy/core/include/numpy/ufuncobject.h 2007-11-07 22:05:15.000000000 +0000
++++ numpy-1.0.4.patched/numpy/core/include/numpy/ufuncobject.h 2008-05-25 11:07:14.000000000 +0100
+@@ -284,7 +284,7 @@
+ #elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__)
+ #if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__)
+-#include <fenv.h>
++#include "fenv/fenv.h"
+ #elif defined(__CYGWIN__)
+ #include "fenv/fenv.c"
+ #endif
+diff -urN numpy-1.0.4/numpy/core/setup.py numpy-1.0.4.patched/numpy/core/setup.py
+--- numpy-1.0.4/numpy/core/setup.py    2007-11-07 22:06:43.000000000 +0000
++++ numpy-1.0.4.patched/numpy/core/setup.py    2008-05-25 11:07:14.000000000 +0100
+@@ -36,6 +36,7 @@
+     def generate_config_h(ext, build_dir):
+         target = join(build_dir,'config.h')
++        log.info("-----------------------abc")
+         if newer(__file__,target):
+             config_cmd = config.get_config_cmd()
+             log.info('Generating %s',target)
+@@ -73,6 +74,7 @@
+                     nosmp = 1
+                 except KeyError:
+                     nosmp = 0
++            nosmp = 1
+             if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')]
+             else: moredefs = []
+             #
+@@ -123,8 +125,9 @@
+                     target_f.write('#define %s\n' % (d))
+                 else:
+                     target_f.write('#define %s %s\n' % (d[0],d[1]))
+-            if not nosmp:  # default is to use WITH_THREAD
+-                target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n')
++            log.info("-----------------------abc")
++            #if not nosmp:  # default is to use WITH_THREAD
++            target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n')
+             target_f.close()
+             print 'File:',target
+             target_f = open(target)
+diff -urN numpy-1.0.4/numpy/distutils/unixccompiler.py numpy-1.0.4.patched/numpy/distutils/unixccompiler.py
+--- numpy-1.0.4/numpy/distutils/unixccompiler.py       2007-11-07 22:05:15.000000000 +0000
++++ numpy-1.0.4.patched/numpy/distutils/unixccompiler.py       2008-05-25 11:07:14.000000000 +0100
+@@ -9,11 +9,36 @@
+ from numpy.distutils.ccompiler import replace_method
+ import log
++def UnixCCompiler__link_executable (self,
++                         objects,
++                         output_progname,
++                         output_dir=None,
++                         libraries=None,
++                         library_dirs=None,
++                         runtime_library_dirs=None,
++                         debug=0,
++                         extra_preargs=None,
++                         extra_postargs=None,
++                         target_lang=None):
++              if output_progname == "_configtest":
++                      self.spawn(['gcc', '-lm', '-o',output_progname]+objects, display = "")
++              else:
++                      print "#### Running " + str(CCompiler.EXECUTABLE)
++                      self.link(CCompiler.EXECUTABLE, objects,
++                  self.executable_filename(output_progname), output_dir,
++                  libraries, library_dirs, runtime_library_dirs, None,
++                  debug, extra_preargs, extra_postargs+ ['-lm'], None, target_lang)
++
++replace_method(UnixCCompiler, 'link_executable', UnixCCompiler__link_executable)
+ # Note that UnixCCompiler._compile appeared in Python 2.3
+ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+     display = '%s: %s' % (os.path.basename(self.compiler_so[0]),src)
+     try:
++      if src == "_configtest.c":
++        self.spawn(['gcc', '-fwrapv', '-O2', '-Wall', '-Wstrict-prototypes', '-I/umc/blogic/olpc/staging_dir/i386/usr/include', '-I/umc/blogic/olpc/staging_dir/i386/include', '-I/umc/blogic/olpc/staging_dir/i386/usr/include/python2.5','-I/umc/blogic/olpc/staging_dir/i386/usr/include', '-I/umc/blogic/olpc/staging_dir/i386/include', '-fPIC'] + cc_args + [src, '-o', obj] +
++                  extra_postargs, display = display)
++      else:
+         self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+                    extra_postargs, display = display)
+     except DistutilsExecError, msg:
+diff -urN numpy-1.0.4/numpy/numarray/_capi.c numpy-1.0.4.patched/numpy/numarray/_capi.c
+--- numpy-1.0.4/numpy/numarray/_capi.c 2007-11-07 22:05:16.000000000 +0000
++++ numpy-1.0.4.patched/numpy/numarray/_capi.c 2008-05-25 11:07:14.000000000 +0100
+@@ -5,7 +5,7 @@
+ #include <float.h>
+ #if defined(__GLIBC__) || defined(__APPLE__) || defined(__MINGW32__)
+-#include <fenv.h>
++#include "numpy/fenv/fenv.h"
+ #elif defined(__CYGWIN__)
+ #include "numpy/fenv/fenv.h"
+ #include "numpy/fenv/fenv.c"
+diff -urN numpy-1.0.4.p2/numpy/core/setup.py numpy-1.0.4/numpy/core/setup.py
+--- numpy-1.0.4.p2/numpy/core/setup.py 2008-05-25 11:18:19.000000000 +0100
++++ numpy-1.0.4/numpy/core/setup.py    2008-05-25 11:18:52.000000000 +0100
+@@ -6,13 +6,11 @@
+ from distutils.dep_util import newer
+ FUNCTIONS_TO_CHECK = [
+-    ('expl', 'HAVE_LONGDOUBLE_FUNCS'),
+     ('expf', 'HAVE_FLOAT_FUNCS'),
+     ('log1p', 'HAVE_LOG1P'),
+     ('expm1', 'HAVE_EXPM1'),
+     ('asinh', 'HAVE_INVERSE_HYPERBOLIC'),
+     ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'),
+-    ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'),
+     ('isnan', 'HAVE_ISNAN'),
+     ('isinf', 'HAVE_ISINF'),
+     ('rint', 'HAVE_RINT'),
diff --git a/lang/php-pear-db/Makefile b/lang/php-pear-db/Makefile
new file mode 100644 (file)
index 0000000..e135d09
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007-2010 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:=php-pear-db
+PKG_VERSION:=1.7.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=DB-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://download.pear.php.net/package
+PKG_MD5SUM:=a57302138757500706e075a4d3d87ef7
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/DB-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/php-pear-db
+  SUBMENU:=PHP
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PEAR DB module
+  URL:=http://pear.php.net/package/DB
+  DEPENDS:=php-pear
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/php-pear-db/install
+       $(INSTALL_DIR) $(1)/usr/lib/php
+       $(CP)   $(PKG_BUILD_DIR)/DB.php $(PKG_BUILD_DIR)/DB \
+               $(1)/usr/lib/php/
+endef
+
+$(eval $(call BuildPackage,php-pear-db))
diff --git a/lang/php-pear-db/patches/100-php5-deprecation-fixes.patch b/lang/php-pear-db/patches/100-php5-deprecation-fixes.patch
new file mode 100644 (file)
index 0000000..714b678
--- /dev/null
@@ -0,0 +1,34 @@
+diff -ubrN DB-1.7.11-orig/DB/common.php DB-1.7.11/DB/common.php
+--- DB-1.7.11-orig/DB/common.php       2007-03-28 02:11:15.000000000 -0500
++++ DB-1.7.11/DB/common.php    2007-06-11 14:49:37.000000000 -0500
+@@ -1014,7 +1014,7 @@
+         if ($result === DB_OK || DB::isError($result)) {
+             return $result;
+         } else {
+-            $tmp =& new DB_result($this, $result);
++            $tmp = new DB_result($this, $result);
+             return $tmp;
+         }
+     }
+@@ -1217,7 +1217,7 @@
+             if ($result === DB_OK || DB::isError($result)) {
+                 return $result;
+             } else {
+-                $tmp =& new DB_result($this, $result);
++                $tmp = new DB_result($this, $result);
+                 return $tmp;
+             }
+         }
+diff -ubrN DB-1.7.11-orig/DB.php DB-1.7.11/DB.php
+--- DB-1.7.11-orig/DB.php      2007-03-28 02:11:15.000000000 -0500
++++ DB-1.7.11/DB.php   2007-06-11 14:49:42.000000000 -0500
+@@ -591,7 +591,8 @@
+      */
+     function isError($value)
+     {
+-        return is_a($value, 'DB_Error');
++        return $value instanceof DB_Error;
++        // return is_a($value, 'DB_Error');
+     }
+     // }}}
diff --git a/lang/php-pear-xmlrpc/Makefile b/lang/php-pear-xmlrpc/Makefile
new file mode 100644 (file)
index 0000000..23f7679
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2007-2010 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:=php-pear-xmlrpc
+PKG_VERSION:=1.5.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=XML_RPC-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://download.pear.php.net/package
+PKG_MD5SUM:=1b516162ad65971b5fd04a7c279627ec
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/XML_RPC-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/php-pear-xmlrpc
+  SUBMENU:=PHP
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PEAR XML-RPC module
+  URL:=http://pear.php.net/package/XML_RPC
+  DEPENDS:=php-pear
+  PKGARCH:=all
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/php-pear-xmlrpc/install
+       $(INSTALL_DIR) $(1)/usr/lib/php/XML
+       $(CP)   $(PKG_BUILD_DIR)/Dump.php \
+               $(PKG_BUILD_DIR)/RPC.php \
+               $(PKG_BUILD_DIR)/Server.php \
+               $(1)/usr/lib/php/XML/
+endef
+
+$(eval $(call BuildPackage,php-pear-xmlrpc))
diff --git a/lang/php-pear/Makefile b/lang/php-pear/Makefile
new file mode 100644 (file)
index 0000000..22fe6fe
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2007-2010 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:=php-pear
+PKG_VERSION:=1.5.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=PEAR-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://download.pear.php.net/package
+PKG_MD5SUM:=06432c4768fdd7df2c4982c973d3f429
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/PEAR-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/php-pear
+  SUBMENU:=PHP
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PEAR
+  URL:=http://pear.php.net/package/PEAR
+  DEPENDS:=+php5
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/php-pear/install
+       $(INSTALL_DIR) $(1)/usr/lib/php
+       $(CP)   $(PKG_BUILD_DIR)/PEAR.php $(PKG_BUILD_DIR)/PEAR \
+               $(1)/usr/lib/php/
+endef
+
+$(eval $(call BuildPackage,php-pear))
+
diff --git a/lang/php-pear/patches/000-remove_deprecation_messages.patch b/lang/php-pear/patches/000-remove_deprecation_messages.patch
new file mode 100644 (file)
index 0000000..0f79cfc
--- /dev/null
@@ -0,0 +1,62 @@
+--- PEAR-1.5.4/PEAR.php        2007-05-07 23:10:49.000000000 -0500
++++ PEAR-1.5.4/PEAR.php.new    2007-05-23 16:36:05.699498250 -0500
+@@ -278,7 +278,8 @@
+      */
+     function isError($data, $code = null)
+     {
+-        if (is_a($data, 'PEAR_Error')) {
++        //if (is_a($data, 'PEAR_Error')) {
++        if ( $data instanceof PEAR_Error ) {
+             if (is_null($code)) {
+                 return true;
+             } elseif (is_string($code)) {
+@@ -334,7 +335,8 @@
+     function setErrorHandling($mode = null, $options = null)
+     {
+-        if (isset($this) && is_a($this, 'PEAR')) {
++        //if (isset($this) && is_a($this, 'PEAR')) {
++        if ( isset($this) && $this instanceof PEAR ) {
+             $setmode     = &$this->_default_error_mode;
+             $setoptions  = &$this->_default_error_options;
+         } else {
+@@ -588,7 +590,8 @@
+                          $code = null,
+                          $userinfo = null)
+     {
+-        if (isset($this) && is_a($this, 'PEAR')) {
++        //if (isset($this) && is_a($this, 'PEAR')) {
++        if ( isset($this) && $this instanceof PEAR ) {
+             $a = &$this->raiseError($message, $code, null, null, $userinfo);
+             return $a;
+         } else {
+@@ -686,7 +689,8 @@
+     function pushErrorHandling($mode, $options = null)
+     {
+         $stack = &$GLOBALS['_PEAR_error_handler_stack'];
+-        if (isset($this) && is_a($this, 'PEAR')) {
++        //if (isset($this) && is_a($this, 'PEAR')) {
++        if (isset($this) && $this instanceof PEAR ) {
+             $def_mode    = &$this->_default_error_mode;
+             $def_options = &$this->_default_error_options;
+         } else {
+@@ -695,7 +699,8 @@
+         }
+         $stack[] = array($def_mode, $def_options);
+-        if (isset($this) && is_a($this, 'PEAR')) {
++        //if (isset($this) && is_a($this, 'PEAR')) {
++        if (isset($this) && $this instanceof PEAR ) {
+             $this->setErrorHandling($mode, $options);
+         } else {
+             PEAR::setErrorHandling($mode, $options);
+@@ -720,7 +725,8 @@
+         array_pop($stack);
+         list($mode, $options) = $stack[sizeof($stack) - 1];
+         array_pop($stack);
+-        if (isset($this) && is_a($this, 'PEAR')) {
++        //if (isset($this) && is_a($this, 'PEAR')) {
++        if (isset($this) && $this instanceof PEAR ) {
+             $this->setErrorHandling($mode, $options);
+         } else {
+             PEAR::setErrorHandling($mode, $options);
diff --git a/lang/php5-pecl-apc/Makefile b/lang/php5-pecl-apc/Makefile
new file mode 100644 (file)
index 0000000..22b9fa4
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=APC
+PECL_LONGNAME:=Alternative PHP Cache
+
+PKG_VERSION:=3.1.13
+PKG_RELEASE:=1
+PKG_MD5SUM:=c9e47002e3a67ebde3a6f81437c7b6e0
+
+PKG_NAME:=php5-pecl-apc
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://pecl.php.net/get/
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php5/pecl.mk
+
+CONFIGURE_ARGS+= \
+       --enable-apc=shared \
+       --disable-apc-mmap \
+
+$(eval $(call PECLPackage,apc,$(PECL_LONGNAME),+librt))
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/lang/php5-pecl-bcompiler/Makefile b/lang/php5-pecl-bcompiler/Makefile
new file mode 100644 (file)
index 0000000..6bab984
--- /dev/null
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=bcompiler
+PECL_LONGNAME:=PHP bytecode Compiler
+
+PKG_VERSION:=1.0.2
+PKG_RELEASE:=1
+PKG_MD5SUM:=99f76a5ef536d43180b41036a6a13e43
+
+PKG_NAME:=php5-pecl-$(PECL_NAME)
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://pecl.php.net/get/
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php5/pecl.mk
+
+$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME),@BROKEN))
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/lang/php5-pecl-dio/Makefile b/lang/php5-pecl-dio/Makefile
new file mode 100644 (file)
index 0000000..f9c5f50
--- /dev/null
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=dio
+PECL_LONGNAME:=Direct I/O functions
+
+PKG_VERSION:=0.0.6
+PKG_RELEASE:=1
+PKG_MD5SUM:=95bde93a41def9c2d97532eeb0c83bd3
+
+PKG_NAME:=php5-pecl-$(PECL_NAME)
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://pecl.php.net/get/
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php5/pecl.mk
+
+$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME)))
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/lang/php5-pecl-dio/patches/010-additional-baudrates.patch b/lang/php5-pecl-dio/patches/010-additional-baudrates.patch
new file mode 100644 (file)
index 0000000..5032e6e
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/dio.c
++++ b/dio.c
+@@ -442,6 +442,26 @@ PHP_FUNCTION(dio_tcsetattr)
+       /* assign to correct values... */
+       switch (Baud_Rate)  {
++#ifdef B460800
++              case 460800:
++                      BAUD = B460800;
++                      break;
++#endif
++#ifdef B230400
++              case 230400:
++                      BAUD = B230400;
++                      break;
++#endif
++#ifdef B115200
++              case 115200:
++                      BAUD = B115200;
++                      break;
++#endif
++#ifdef B57600
++              case 57600:
++                      BAUD = B57600;
++                      break;
++#endif
+               case 38400:
+                       BAUD = B38400;
+                       break;
diff --git a/lang/php5-pecl-http/Makefile b/lang/php5-pecl-http/Makefile
new file mode 100644 (file)
index 0000000..0b4a00d
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2012-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=pecl_http
+PECL_LONGNAME:=Extended HTTP Support
+
+PKG_VERSION:=1.7.6
+PKG_RELEASE:=1
+PKG_MD5SUM:=4926c17a24a11a9b1cf3ec613fad97cb
+
+PKG_NAME:=php5-pecl-http
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://pecl.php.net/get/
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php5/pecl.mk
+
+CONFIGURE_ARGS+= \
+       --enable-http=shared \
+       --without-http-shared-deps \
+       --with-http-curl-requests="$(STAGING_DIR)/usr" \
+       --without-http-curl-libevent \
+
+$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+libcurl +librt +php5-mod-iconv +php5-mod-session))
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/lang/php5-pecl-libevent/Makefile b/lang/php5-pecl-libevent/Makefile
new file mode 100644 (file)
index 0000000..a4c9e40
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2012-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=libevent
+PECL_LONGNAME:=Libevent - event notification
+
+PKG_VERSION:=0.1.0
+PKG_RELEASE:=1
+PKG_MD5SUM:=e091371a9e714098a4c04a6e3daeb56a
+
+PKG_NAME:=php5-pecl-$(PECL_NAME)
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://pecl.php.net/get/
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php5/pecl.mk
+
+CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr"
+
+$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME),+libevent2))
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/lang/php5/Makefile b/lang/php5/Makefile
new file mode 100644 (file)
index 0000000..b7aff44
--- /dev/null
@@ -0,0 +1,534 @@
+#
+# Copyright (C) 2006-2014 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:=php
+PKG_VERSION:=5.4.27
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.php.net/distributions/
+PKG_MD5SUM:=1c6e99187d25023411b663ea09f145ee
+
+PKG_FIXUP:=libtool no-autoreconf
+PKG_BUILD_PARALLEL:=1
+
+PHP5_MODULES = \
+       calendar ctype curl \
+       fileinfo \
+       dom \
+       exif \
+       ftp \
+       gettext gd gmp \
+       hash \
+       iconv \
+       json \
+       ldap \
+       mbstring mcrypt mysql mysqli \
+       openssl \
+       pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
+       session shmop simplexml soap sockets sqlite sqlite3 sysvmsg sysvsem sysvshm \
+       tokenizer \
+       xml xmlreader xmlwriter zip \
+
+PKG_CONFIG_DEPENDS:= \
+       $(patsubst %,CONFIG_PACKAGE_php5-mod-%,$(PHP5_MODULES)) \
+       CONFIG_PHP5_FILTER CONFIG_PHP5_LIBXML CONFIG_PHP5_SYSTEMTZDATA
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/php5/Default
+  SUBMENU:=PHP
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PHP5 Hypertext preprocessor
+  URL:=http://www.php.net/
+  MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
+  DEPENDS:=php5
+endef
+
+define Package/php5/Default/description
+  PHP is a widely-used general-purpose scripting language that is especially
+  suited for Web development and can be embedded into HTML.
+endef
+
+define Package/php5/config
+       config PHP5_FILTER
+               bool "PHP5 Filter support"
+               depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
+
+       config PHP5_LIBXML
+               bool "PHP5 LIBXML support"
+               depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
+
+       config PHP5_SYSTEMTZDATA
+               bool "Use system timezone data instead of php's built-in database"
+               depends on PACKAGE_php5-cli || PACKAGE_php5-cgi
+               select PACKAGE_zoneinfo-core
+               default y
+               help
+                       Enabling this feature automatically selects the zoneinfo-core package
+                       which contains data for UTC timezone. To use other timezones you have
+                       to install the corresponding zoneinfo-... package(s).
+endef
+
+define Package/php5
+  $(call Package/php5/Default)
+
+  DEPENDS:=+libpcre +zlib \
+           +PHP5_LIBXML:libxml2
+endef
+
+define Package/php5/description
+  $(call Package/php5/Default/description)
+  This package contains only the PHP config file. You must actually choose
+  your PHP flavour (cli, cgi or fastcgi).
+endef
+
+define Package/php5-cli
+  $(call Package/php5/Default)
+  TITLE+= (CLI)
+endef
+
+define Package/php5-cli/description
+  $(call Package/php5/Default/description)
+  This package contains the CLI version of the PHP5 interpreter.
+endef
+
+define Package/php5-cgi
+  $(call Package/php5/Default)
+  TITLE+= (CGI & FastCGI)
+endef
+
+define Package/php5-cgi/description
+  $(call Package/php5/Default/description)
+  This package contains the CGI version of the PHP5 interpreter.
+endef
+
+define Package/php5-fastcgi
+  $(call Package/php5/Default)
+  DEPENDS+= +php5-cgi
+  TITLE:=FastCGI startup script
+endef
+
+define Package/php5-fastcgi/description
+  As FastCGI support is now a core feature the php5-fastcgi package now depends
+  on the php5-cgi package, containing just the startup script.
+endef
+
+CONFIGURE_ARGS+= \
+       --enable-cli \
+       --enable-cgi \
+       --enable-shared \
+       --disable-static \
+       --disable-rpath \
+       --disable-debug \
+       --without-pear \
+       \
+       --with-config-file-path=/etc \
+       --with-config-file-scan-dir=/etc/php5 \
+       --disable-short-tags \
+       \
+       --with-zlib="$(STAGING_DIR)/usr" \
+         --with-zlib-dir="$(STAGING_DIR)/usr" \
+       --with-pcre-regex="$(STAGING_DIR)/usr" \
+       --disable-phar
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-calendar),)
+  CONFIGURE_ARGS+= --enable-calendar=shared
+else
+  CONFIGURE_ARGS+= --disable-calendar
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ctype),)
+  CONFIGURE_ARGS+= --enable-ctype=shared
+else
+  CONFIGURE_ARGS+= --disable-ctype
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-curl),)
+  CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-curl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-fileinfo),)
+  CONFIGURE_ARGS+= --enable-fileinfo=shared
+else
+  CONFIGURE_ARGS+= --disable-fileinfo
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gettext),)
+  CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
+else
+  CONFIGURE_ARGS+= --without-gettext
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-dom),)
+  CONFIGURE_ARGS+= --enable-dom=shared
+else
+  CONFIGURE_ARGS+= --disable-dom
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-exif),)
+  CONFIGURE_ARGS+= --enable-exif=shared
+else
+  CONFIGURE_ARGS+= --disable-exif
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ftp),)
+  CONFIGURE_ARGS+= --enable-ftp=shared
+else
+  CONFIGURE_ARGS+= --disable-ftp
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gd),)
+  CONFIGURE_ARGS+= \
+       --with-gd=shared \
+       --without-freetype-dir \
+       --with-jpeg-dir="$(STAGING_DIR)/usr" \
+       --with-png-dir="$(STAGING_DIR)/usr" \
+       --without-xpm-dir \
+       --without-t1lib \
+       --enable-gd-native-ttf \
+       --disable-gd-jis-conv
+else
+  CONFIGURE_ARGS+= --without-gd
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-gmp),)
+  CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-gmp
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-hash),)
+  CONFIGURE_ARGS+= --enable-hash=shared
+else
+  CONFIGURE_ARGS+= --disable-hash
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-iconv),)
+  CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
+else
+  CONFIGURE_ARGS+= --without-iconv
+endif
+
+ifneq ($(CONFIG_PACKAGE_php5-mod-json),)
+  CONFIGURE_ARGS+= --enable-json=shared
+else
+  CONFIGURE_ARGS+= --disable-json
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-ldap),)
+  CONFIGURE_ARGS+= \
+       --with-ldap=shared,"$(STAGING_DIR)/usr" \
+       --with-ldap-sasl="$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-ldap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mbstring),)
+  CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex
+else
+  CONFIGURE_ARGS+= --disable-mbstring
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mcrypt),)
+  CONFIGURE_ARGS+=  --with-mcrypt=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-mcrypt
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysql),)
+  CONFIGURE_ARGS+= --with-mysql=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-mysql
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-mysqli),)
+  CONFIGURE_ARGS+= --with-mysqli=shared,"$(STAGING_DIR)/usr/bin/mysql_config"
+else
+  CONFIGURE_ARGS+= --without-mysqli
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-openssl),)
+  CONFIGURE_ARGS+= \
+       --with-openssl=shared,"$(STAGING_DIR)/usr" \
+       --with-kerberos=no \
+       --with-openssl-dir="$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-openssl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pcntl),)
+  CONFIGURE_ARGS+= --enable-pcntl=shared
+else
+  CONFIGURE_ARGS+= --disable-pcntl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo),)
+  CONFIGURE_ARGS+= --enable-pdo=shared
+  ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-mysql),)
+    CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr"
+  else
+    CONFIGURE_ARGS+= --without-pdo-mysql
+  endif
+  ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-pgsql),)
+    CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
+  else
+    CONFIGURE_ARGS+= --without-pdo-pgsql
+  endif
+  ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
+    CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
+  else
+    CONFIGURE_ARGS+= --without-pdo-sqlite
+  endif
+else
+  CONFIGURE_ARGS+= --disable-pdo
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-pgsql),)
+  CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-pgsql
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-session),)
+  CONFIGURE_ARGS+= --enable-session=shared
+else
+  CONFIGURE_ARGS+= --disable-session
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-shmop),)
+  CONFIGURE_ARGS+= --enable-shmop=shared
+else
+  CONFIGURE_ARGS+= --disable-shmop
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-simplexml),)
+  CONFIGURE_ARGS+= --enable-simplexml=shared
+else
+  CONFIGURE_ARGS+= --disable-simplexml
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-soap),)
+  CONFIGURE_ARGS+= --enable-soap=shared
+else
+  CONFIGURE_ARGS+= --disable-soap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sockets),)
+  CONFIGURE_ARGS+= --enable-sockets=shared
+else
+  CONFIGURE_ARGS+= --disable-sockets
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite),)
+  CONFIGURE_ARGS+= --with-sqlite=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-sqlite
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sqlite3),)
+  CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-sqlite3
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvmsg),)
+  CONFIGURE_ARGS+= --enable-sysvmsg=shared
+else
+  CONFIGURE_ARGS+= --disable-sysvmsg
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvsem),)
+  CONFIGURE_ARGS+= --enable-sysvsem=shared
+else
+  CONFIGURE_ARGS+= --disable-sysvsem
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-sysvshm),)
+  CONFIGURE_ARGS+= --enable-sysvshm=shared
+else
+  CONFIGURE_ARGS+= --disable-sysvshm
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-tokenizer),)
+  CONFIGURE_ARGS+= --enable-tokenizer=shared
+else
+  CONFIGURE_ARGS+= --disable-tokenizer
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xml),)
+  CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
+  ifneq ($(CONFIG_PHP5_LIBXML),)
+    CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
+  else
+    CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr"
+  endif
+else
+  CONFIGURE_ARGS+= --disable-xml
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlreader),)
+  CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --disable-xmlreader
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-xmlwriter),)
+  CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --disable-xmlwriter
+endif
+
+ifneq ($(CONFIG_PACKAGE_php5-mod-zip),)
+  CONFIGURE_ARGS+= --enable-zip=shared
+else
+  CONFIGURE_ARGS+= --disable-zip
+endif
+
+ifneq ($(SDK)$(CONFIG_PHP5_FILTER),)
+  CONFIGURE_ARGS+= --enable-filter
+else
+  CONFIGURE_ARGS+= --disable-filter
+endif
+
+ifneq ($(SDK)$(CONFIG_PHP5_LIBXML),)
+  CONFIGURE_ARGS+= --enable-libxml
+  CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2"
+else
+  CONFIGURE_ARGS+= --disable-libxml
+endif
+
+ifneq ($(CONFIG_PHP5_SYSTEMTZDATA),)
+  CONFIGURE_ARGS+= --with-system-tzdata
+else
+  CONFIGURE_ARGS+= --without-system-tzdata
+endif
+
+CONFIGURE_VARS+= \
+       ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
+       php_cv_cc_rpath="no" \
+       iconv_impl_name="gnu_libiconv" \
+       ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
+
+define Package/php5/conffiles
+/etc/php.ini
+endef
+
+define Package/php5/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/php.ini $(1)/etc/
+endef
+
+define Package/php5-cli/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
+endef
+
+define Package/php5-cgi/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
+       ln -sf php-cgi $(1)/usr/bin/php-fcgi
+endef
+
+define Package/php5-fastcgi/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/php5-fastcgi.config $(1)/etc/config/php5-fastcgi
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/php5-fastcgi.init $(1)/etc/init.d/php5-fastcgi
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       ( cd $(PKG_BUILD_DIR); touch configure.in; ./buildconf --force )
+endef
+
+define Build/InstallDev
+       mkdir -p $(PKG_BUILD_DIR)/staging/usr/bin
+       make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/staging
+       rm -f $(PKG_BUILD_DIR)/staging/usr/bin/php
+       $(CP) $(PKG_BUILD_DIR)/staging/* $(STAGING_DIR_HOST)
+       sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR_HOST)/usr'#" $(STAGING_DIR_HOST)/usr/bin/phpize
+       sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR_HOST)/usr'#" $(STAGING_DIR_HOST)/usr/bin/phpize
+       sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR_HOST)/usr\"#" $(STAGING_DIR_HOST)/usr/bin/php-config
+endef
+
+define BuildModule
+
+  define Package/php5-mod-$(1)
+    $(call Package/php5/Default)
+
+    ifneq ($(3),)
+      DEPENDS+=$(3)
+    endif
+
+    TITLE:=$(2) shared module
+  endef
+
+  define Package/php5-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/php
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
+       $(INSTALL_DIR) $$(1)/etc/php5
+       echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
+  endef
+
+  $$(eval $$(call BuildPackage,php5-mod-$(1)))
+
+endef
+
+$(eval $(call BuildPackage,php5))
+$(eval $(call BuildPackage,php5-cli))
+$(eval $(call BuildPackage,php5-cgi))
+$(eval $(call BuildPackage,php5-fastcgi))
+
+#$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
+$(eval $(call BuildModule,calendar,Calendar))
+$(eval $(call BuildModule,ctype,Ctype))
+$(eval $(call BuildModule,curl,cURL,+PACKAGE_php5-mod-curl:libcurl))
+$(eval $(call BuildModule,fileinfo,Fileinfo,+PACKAGE_php5-mod-fileinfo:libmagic))
+$(eval $(call BuildModule,dom,DOM,+@PHP5_LIBXML +PACKAGE_php5-mod-dom:libxml2))
+$(eval $(call BuildModule,exif,EXIF))
+$(eval $(call BuildModule,ftp,FTP,+PACKAGE_php5-mod-ftp:libopenssl))
+$(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php5-mod-gettext:libintl-full))
+$(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php5-mod-gd:libjpeg +PACKAGE_php5-mod-gd:libpng))
+$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php5-mod-gmp:libgmp))
+$(eval $(call BuildModule,hash,Hash))
+$(eval $(call BuildModule,iconv,iConv,+PACKAGE_php5-mod-iconv:libiconv))
+$(eval $(call BuildModule,json,JSON))
+$(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php5-mod-ldap:libopenldap +PACKAGE_php5-mod-ldap:libsasl2))
+$(eval $(call BuildModule,mbstring,MBString))
+$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php5-mod-mcrypt:libmcrypt +PACKAGE_php5-mod-mcrypt:libltdl))
+$(eval $(call BuildModule,mysql,MySQL,+PACKAGE_php5-mod-mysql:libmysqlclient))
+$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php5-mod-mysqli:libmysqlclient))
+$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php5-mod-openssl:libopenssl))
+$(eval $(call BuildModule,pcntl,PCNTL))
+$(eval $(call BuildModule,pdo,PHP Data Objects))
+$(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-mysql:libmysqlclient))
+$(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php5-mod-pdo +PACKAGE_php5-mod-pdo-pgsql:libpq))
+$(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php5-mod-pdo +PACKAGE_php5-mod-pdo-sqlite:libsqlite3 +PACKAGE_php5-mod-pdo-sqlite:libpthread +PACKAGE_php5-mod-pdo-sqlite:librt))
+$(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php5-mod-pgsql:libpq))
+$(eval $(call BuildModule,session,Session))
+$(eval $(call BuildModule,shmop,Shared Memory))
+$(eval $(call BuildModule,simplexml,SimpleXML,+@PHP5_LIBXML +PACKAGE_php5-mod-simplexml:libxml2))
+$(eval $(call BuildModule,soap,SOAP,+@PHP5_LIBXML +PACKAGE_php5-mod-soap:libxml2))
+$(eval $(call BuildModule,sockets,Sockets))
+$(eval $(call BuildModule,sqlite,SQLite 2.x,+PACKAGE_php5-mod-sqlite:libsqlite2))
+$(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php5-mod-sqlite3:libsqlite3 +PACKAGE_php5-mod-sqlite3:libpthread))
+$(eval $(call BuildModule,sysvmsg,System V messages))
+$(eval $(call BuildModule,sysvsem,System V shared memory))
+$(eval $(call BuildModule,sysvshm,System V semaphore))
+$(eval $(call BuildModule,tokenizer,Tokenizer))
+$(eval $(call BuildModule,xml,XML,+PHP5_LIBXML:libxml2 +!PHP5_LIBXML:libexpat))
+$(eval $(call BuildModule,xmlreader,XMLReader,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlreader:libxml2 +PACKAGE_php5-mod-xmlreader:libiconv))
+$(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP5_LIBXML +PACKAGE_php5-mod-xmlwriter:libxml2 +PACKAGE_php5-mod-xmlwriter:libiconv))
+$(eval $(call BuildModule,zip,ZIP,+PACKAGE_php5-mod-zip:zlib))
diff --git a/lang/php5/files/php.ini b/lang/php5/files/php.ini
new file mode 100644 (file)
index 0000000..6fe2a31
--- /dev/null
@@ -0,0 +1,311 @@
+[PHP]
+
+zend.ze1_compatibility_mode = Off
+
+; Language Options
+
+engine = On
+;short_open_tag = Off
+precision    =  12
+y2k_compliance = On
+output_buffering = Off
+;output_handler =
+zlib.output_compression = Off
+;zlib.output_compression_level = -1
+;zlib.output_handler =
+implicit_flush = Off
+unserialize_callback_func =
+serialize_precision = 100
+
+;open_basedir =
+disable_functions =
+disable_classes =
+
+; Colors for Syntax Highlighting mode.  Anything that's acceptable in
+; <span style="color: ???????"> would work.
+;highlight.string  = #DD0000
+;highlight.comment = #FF9900
+;highlight.keyword = #007700
+;highlight.bg      = #FFFFFF
+;highlight.default = #0000BB
+;highlight.html    = #000000
+
+;ignore_user_abort = On
+;realpath_cache_size = 16k
+;realpath_cache_ttl = 120
+
+; Miscellaneous
+
+expose_php = On
+
+; Resource Limits
+
+max_execution_time = 30        ; Maximum execution time of each script, in seconds.
+max_input_time = 60    ; Maximum amount of time each script may spend parsing request data.
+;max_input_nesting_level = 64
+memory_limit = 8M      ; Maximum amount of memory a script may consume.
+
+; Error handling and logging
+
+; Error Level Constants:
+; E_ALL             - All errors and warnings (includes E_STRICT as of PHP 6.0.0)
+; E_ERROR           - fatal run-time errors
+; E_RECOVERABLE_ERROR  - almost fatal run-time errors
+; E_WARNING         - run-time warnings (non-fatal errors)
+; E_PARSE           - compile-time parse errors
+; E_NOTICE          - run-time notices (these are warnings which often result
+;                     from a bug in your code, but it's possible that it was
+;                     intentional (e.g., using an uninitialized variable and
+;                     relying on the fact it's automatically initialized to an
+;                     empty string)
+; E_STRICT                     - run-time notices, enable to have PHP suggest changes
+;                     to your code which will ensure the best interoperability
+;                     and forward compatibility of your code
+; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
+; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
+;                     initial startup
+; E_COMPILE_ERROR   - fatal compile-time errors
+; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
+; E_USER_ERROR      - user-generated error message
+; E_USER_WARNING    - user-generated warning message
+; E_USER_NOTICE     - user-generated notice message
+; E_DEPRECATED      - warn about code that will not work in future versions
+;                     of PHP
+; E_USER_DEPRECATED - user-generated deprecation warnings
+;
+; Common Values:
+;   E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
+;   E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
+;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
+;   E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)
+; Default Value: E_ALL & ~E_NOTICE
+error_reporting  =  E_ALL & ~E_NOTICE & ~E_STRICT
+
+display_errors = On
+display_startup_errors = Off
+log_errors = Off
+log_errors_max_len = 1024
+ignore_repeated_errors = Off
+ignore_repeated_source = Off
+report_memleaks = On
+;report_zend_debug = 0
+track_errors = Off
+;html_errors = Off
+;docref_root = "/phpmanual/"
+;docref_ext = .html
+;error_prepend_string = "<font color=#ff0000>"
+;error_append_string = "</font>"
+; Log errors to specified file.
+;error_log = /var/log/php_errors.log
+; Log errors to syslog.
+;error_log = syslog
+
+; Data Handling
+
+;arg_separator.output = "&amp;"
+;arg_separator.input = ";&"
+variables_order = "EGPCS"
+request_order = "GP"
+register_globals = Off
+register_long_arrays = Off
+register_argc_argv = On
+auto_globals_jit = On
+post_max_size = 8M
+;magic_quotes_gpc = Off
+magic_quotes_runtime = Off
+magic_quotes_sybase = Off
+auto_prepend_file =
+auto_append_file =
+default_mimetype = "text/html"
+;default_charset = "iso-8859-1"
+;always_populate_raw_post_data = On
+
+; Paths and Directories
+
+; UNIX: "/path1:/path2"
+;include_path = ".:/php/includes"
+doc_root = "/www"
+user_dir =
+extension_dir = "/usr/lib/php"
+enable_dl = On
+;cgi.force_redirect = 1
+;cgi.nph = 1
+;cgi.redirect_status_env = ;
+cgi.fix_pathinfo=1
+;fastcgi.impersonate = 1;
+;fastcgi.logging = 0
+;cgi.rfc2616_headers = 0
+
+; File Uploads
+
+file_uploads = On
+upload_tmp_dir = "/tmp"
+upload_max_filesize = 2M
+max_file_uploads = 20
+
+; Fopen wrappers
+
+allow_url_fopen = On
+allow_url_include = Off
+;from="john@doe.com"
+;user_agent="PHP"
+default_socket_timeout = 60
+;auto_detect_line_endings = Off
+
+; Dynamic Extensions
+
+;extension=ctype.so
+;extension=curl.so
+;extension=dom.so
+;extension=exif.so
+;extension=ftp.so
+;extension=gd.so
+;extension=gmp.so
+;extension=hash.so
+;extension=iconv.so
+;extension=json.so
+;extension=ldap.so
+;extension=mbstring.so
+;extension=mcrypt.so
+;extension=mysql.so
+;extension=openssl.so
+;extension=pcre.so
+;extension=pdo.so
+;extension=pdo-mysql.so
+;extension=pdo-pgsql.so
+;extension=pdo_sqlite.so
+;extension=pgsql.so
+;extension=session.so
+;extension=soap.so
+;extension=sockets.so
+;extension=sqlite.so
+;extension=sqlite3.so
+;extension=tokenizer.so
+;extension=xml.so
+;extension=xmlreader.so
+;extension=xmlwriter.so
+
+; Module Settings
+
+[APC]
+apc.enabled = 1
+apc.shm_segments = 1   ;The number of shared memory segments to allocate for the compiler cache.
+apc.shm_size = 4M      ;The size of each shared memory segment.
+
+[Date]
+;date.timezone =
+;date.default_latitude = 31.7667
+;date.default_longitude = 35.2333
+;date.sunrise_zenith = 90.583333
+;date.sunset_zenith = 90.583333
+
+[filter]
+;filter.default = unsafe_raw
+;filter.default_flags =
+
+[iconv]
+;iconv.input_encoding = ISO-8859-1
+;iconv.internal_encoding = ISO-8859-1
+;iconv.output_encoding = ISO-8859-1
+
+[sqlite]
+;sqlite.assoc_case = 0
+
+[sqlite3]
+;sqlite3.extension_dir =
+
+[Pdo_mysql]
+pdo_mysql.cache_size = 2000
+pdo_mysql.default_socket=
+
+[MySQL]
+mysql.allow_local_infile = On
+mysql.allow_persistent = On
+mysql.cache_size = 2000
+mysql.max_persistent = -1
+mysql.max_links = -1
+mysql.default_port =
+mysql.default_socket =
+mysql.default_host =
+mysql.default_user =
+mysql.default_password =
+mysql.connect_timeout = 60
+mysql.trace_mode = Off
+
+[PostgresSQL]
+pgsql.allow_persistent = On
+pgsql.auto_reset_persistent = Off
+pgsql.max_persistent = -1
+pgsql.max_links = -1
+pgsql.ignore_notice = 0
+pgsql.log_notice = 0
+
+[Session]
+session.save_handler = files
+session.save_path = "/tmp"
+session.use_cookies = 1
+;session.cookie_secure =
+session.use_only_cookies = 1
+session.name = PHPSESSID
+session.auto_start = 0
+session.cookie_lifetime = 0
+session.cookie_path = /
+session.cookie_domain =
+session.cookie_httponly =
+session.serialize_handler = php
+session.gc_probability = 1
+session.gc_divisor     = 100
+session.gc_maxlifetime = 1440
+session.bug_compat_42 = On
+session.bug_compat_warn = On
+session.referer_check =
+session.entropy_length = 0
+;session.entropy_file = /dev/urandom
+session.entropy_file =
+;session.entropy_length = 16
+session.cache_limiter = nocache
+session.cache_expire = 180
+session.use_trans_sid = 0
+session.hash_function = 0
+session.hash_bits_per_character = 4
+url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
+
+[mbstring]
+;mbstring.language = Japanese
+;mbstring.internal_encoding = EUC-JP
+;mbstring.http_input = auto
+;mbstring.http_output = SJIS
+;mbstring.encoding_translation = Off
+;mbstring.detect_order = auto
+;mbstring.substitute_character = none;
+;mbstring.func_overload = 0
+;mbstring.strict_detection = Off
+;mbstring.http_output_conv_mimetype=
+;mbstring.script_encoding=
+
+[gd]
+;gd.jpeg_ignore_warning = 0
+
+[exif]
+;exif.encode_unicode = ISO-8859-15
+;exif.decode_unicode_motorola = UCS-2BE
+;exif.decode_unicode_intel    = UCS-2LE
+;exif.encode_jis =
+;exif.decode_jis_motorola = JIS
+;exif.decode_jis_intel    = JIS
+
+[soap]
+soap.wsdl_cache_enabled=1
+soap.wsdl_cache_dir="/tmp"
+soap.wsdl_cache_ttl=86400
+soap.wsdl_cache_limit = 5
+
+[sysvshm]
+;sysvshm.init_mem = 10000
+
+[ldap]
+ldap.max_links = -1
+
+[mcrypt]
+;mcrypt.algorithms_dir=
+;mcrypt.modes_dir=
diff --git a/lang/php5/files/php5-fastcgi.config b/lang/php5/files/php5-fastcgi.config
new file mode 100644 (file)
index 0000000..039d3bb
--- /dev/null
@@ -0,0 +1,3 @@
+config php5-fastcgi
+       option enabled 1
+       option port '1026'
diff --git a/lang/php5/files/php5-fastcgi.init b/lang/php5/files/php5-fastcgi.init
new file mode 100644 (file)
index 0000000..0c452ad
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start_instance() {
+       local section="$1"
+       local enabled
+       local port
+
+       config_get_bool enabled "$section" 'enabled' 0
+       config_get port "$section" 'port' 1026
+
+       [ $enabled -gt 0 ] || return 1
+
+       PHP_FCGI_CHILDREN='' \
+       service_start /usr/bin/php-fcgi -b $port
+}
+
+start() {
+       config_load 'php5-fastcgi'
+       config_foreach start_instance 'php5-fastcgi'
+}
+
+stop() {
+       service_stop /usr/bin/php-fcgi
+}
diff --git a/lang/php5/patches/090-restore-sqlite2.patch b/lang/php5/patches/090-restore-sqlite2.patch
new file mode 100644 (file)
index 0000000..27bcec5
--- /dev/null
@@ -0,0 +1,50845 @@
+--- /dev/null
++++ b/ext/sqlite/config.m4
+@@ -0,0 +1,157 @@
++dnl $Id$
++dnl config.m4 for extension sqlite
++dnl vim:et:ts=2:sw=2
++
++PHP_ARG_WITH(sqlite, for sqlite support,
++[  --without-sqlite=DIR    Do not include sqlite support.  DIR is the sqlite base
++                          install directory [BUNDLED]], yes)
++
++PHP_ARG_ENABLE(sqlite-utf8, whether to enable UTF-8 support in sqlite (default: ISO-8859-1),
++[  --enable-sqlite-utf8      SQLite: Enable UTF-8 support for SQLite], no, no)
++
++
++
++dnl
++dnl PHP_PROG_LEMON
++dnl
++dnl Search for lemon binary and check its version
++dnl
++AC_DEFUN([PHP_PROG_LEMON],[
++  # we only support certain lemon versions
++  lemon_version_list="1.0"
++
++  AC_CHECK_PROG(LEMON, lemon, lemon)
++  if test "$LEMON"; then
++    AC_CACHE_CHECK([for lemon version], php_cv_lemon_version, [
++      lemon_version=`$LEMON -x 2>/dev/null | $SED -e 's/^.* //'`
++      php_cv_lemon_version=invalid
++      for lemon_check_version in $lemon_version_list; do
++        if test "$lemon_version" = "$lemon_check_version"; then
++          php_cv_lemon_version="$lemon_check_version (ok)"
++        fi
++      done
++    ])
++  else
++    lemon_version=none
++  fi
++  case $php_cv_lemon_version in
++    ""|invalid[)]
++      lemon_msg="lemon versions supported for regeneration of libsqlite parsers: $lemon_version_list (found: $lemon_version)."
++      AC_MSG_WARN([$lemon_msg])
++      LEMON="exit 0;"
++      ;;
++  esac
++  PHP_SUBST(LEMON)
++])
++
++
++if test "$PHP_SQLITE" != "no"; then
++  if test "$PHP_PDO" != "no"; then
++    PHP_CHECK_PDO_INCLUDES([], [AC_MSG_WARN([Cannot find php_pdo_driver.h.])])
++    if test -n "$pdo_inc_path"; then
++      AC_DEFINE([PHP_SQLITE2_HAVE_PDO], [1], [Have PDO])
++      pdo_inc_path="-I$pdo_inc_path"
++    fi
++  fi  
++
++  if test "$PHP_SQLITE" != "yes"; then
++    SEARCH_PATH="/usr/local /usr"
++    SEARCH_FOR="/include/sqlite.h"
++    if test -r $PHP_SQLITE/; then # path given as parameter
++      SQLITE_DIR=$PHP_SQLITE
++    else # search default path list
++      AC_MSG_CHECKING([for sqlite files in default path])
++      for i in $SEARCH_PATH ; do
++        if test -r $i/$SEARCH_FOR; then
++          SQLITE_DIR=$i
++          AC_MSG_RESULT(found in $i)
++        fi
++      done
++    fi
++  
++    if test -z "$SQLITE_DIR"; then
++      AC_MSG_RESULT([not found])
++      AC_MSG_ERROR([Please reinstall the sqlite distribution from http://www.sqlite.org])
++    fi
++
++    PHP_CHECK_LIBRARY(sqlite, sqlite_open, [
++      PHP_ADD_LIBRARY_WITH_PATH(sqlite, $SQLITE_DIR/$PHP_LIBDIR, SQLITE_SHARED_LIBADD)
++      PHP_ADD_INCLUDE($SQLITE_DIR/include)
++    ],[
++      AC_MSG_ERROR([wrong sqlite lib version or lib not found])
++    ],[
++      -L$SQLITE_DIR/$PHP_LIBDIR -lm
++    ])
++    SQLITE_MODULE_TYPE=external
++    PHP_SQLITE_CFLAGS=$pdo_inc_path
++    sqlite_extra_sources="libsqlite/src/encode.c"
++  else
++    # use bundled library
++    PHP_PROG_LEMON
++    SQLITE_MODULE_TYPE=builtin
++    PHP_SQLITE_CFLAGS="-I@ext_srcdir@/libsqlite/src -I@ext_builddir@/libsqlite/src $pdo_inc_path"
++    sqlite_extra_sources="libsqlite/src/opcodes.c \
++        libsqlite/src/parse.c libsqlite/src/encode.c \
++        libsqlite/src/auth.c libsqlite/src/btree.c libsqlite/src/build.c \
++        libsqlite/src/delete.c libsqlite/src/expr.c libsqlite/src/func.c \
++        libsqlite/src/hash.c libsqlite/src/insert.c libsqlite/src/main.c \
++        libsqlite/src/os.c libsqlite/src/pager.c \
++        libsqlite/src/printf.c libsqlite/src/random.c \
++        libsqlite/src/select.c libsqlite/src/table.c libsqlite/src/tokenize.c \
++        libsqlite/src/update.c libsqlite/src/util.c libsqlite/src/vdbe.c \
++        libsqlite/src/attach.c libsqlite/src/btree_rb.c libsqlite/src/pragma.c \
++        libsqlite/src/vacuum.c libsqlite/src/copy.c \
++        libsqlite/src/vdbeaux.c libsqlite/src/date.c \
++        libsqlite/src/where.c libsqlite/src/trigger.c"
++  fi
++  dnl
++  dnl Common for both bundled/external
++  dnl
++  sqlite_sources="sqlite.c sess_sqlite.c pdo_sqlite2.c $sqlite_extra_sources" 
++  PHP_NEW_EXTENSION(sqlite, $sqlite_sources, $ext_shared,,$PHP_SQLITE_CFLAGS)
++  PHP_ADD_EXTENSION_DEP(sqlite, spl, true)
++  PHP_ADD_EXTENSION_DEP(sqlite, pdo, true)
++
++  PHP_ADD_MAKEFILE_FRAGMENT
++  PHP_SUBST(SQLITE_SHARED_LIBADD)
++  PHP_INSTALL_HEADERS([$ext_builddir/libsqlite/src/sqlite.h])
++  
++  if test "$SQLITE_MODULE_TYPE" = "builtin"; then
++    PHP_ADD_BUILD_DIR($ext_builddir/libsqlite/src, 1)
++    AC_CHECK_SIZEOF(char *, 4)
++    AC_DEFINE(SQLITE_PTR_SZ, SIZEOF_CHAR_P, [Size of a pointer])
++    dnl use latin 1 for SQLite older than 2.8.9; the utf-8 handling 
++    dnl in funcs.c uses assert(), which is a bit silly and something 
++    dnl we want to avoid. This assert() was removed in SQLite 2.8.9.
++    if test "$PHP_SQLITE_UTF8" = "yes"; then
++      SQLITE_ENCODING="UTF8"
++      AC_DEFINE(SQLITE_UTF8, 1, [ ])
++    else
++      SQLITE_ENCODING="ISO8859"
++    fi
++    PHP_SUBST(SQLITE_ENCODING)
++
++    SQLITE_VERSION=`cat $ext_srcdir/libsqlite/VERSION`
++    PHP_SUBST(SQLITE_VERSION)
++
++    sed -e s/--VERS--/$SQLITE_VERSION/ -e s/--ENCODING--/$SQLITE_ENCODING/ $ext_srcdir/libsqlite/src/sqlite.h.in > $ext_builddir/libsqlite/src/sqlite.h
++
++    if test "$ext_shared" = "no" || test "$ext_srcdir" != "$abs_srcdir"; then
++      echo '#include <php_config.h>' > $ext_builddir/libsqlite/src/config.h
++    else
++      echo "#include \"$abs_builddir/config.h\"" > $ext_builddir/libsqlite/src/config.h
++    fi
++    
++    cat >> $ext_builddir/libsqlite/src/config.h <<EOF
++#if ZTS
++# define THREADSAFE 1
++#endif
++#if !ZEND_DEBUG
++# define NDEBUG
++#endif
++EOF
++  fi
++  
++  AC_CHECK_FUNCS(usleep nanosleep)
++  AC_CHECK_HEADERS(time.h)
++fi
+--- /dev/null
++++ b/ext/sqlite/config.w32
+@@ -0,0 +1,39 @@
++// $Id$
++// vim:ft=javascript
++
++ARG_WITH("sqlite", "SQLite support", "no");
++
++if (PHP_SQLITE != "no") {
++      copy_and_subst(configure_module_dirname + "\\libsqlite\\src\\sqlite.h.in",
++              configure_module_dirname + "\\libsqlite\\src\\sqlite.h", new Array(
++                      "--VERS--", file_get_contents(configure_module_dirname + "\\libsqlite\\VERSION").replace(new RegExp("[\r\n]+", "g"), ""),
++                      "--ENCODING--", "ISO8859"
++              ));
++      
++      FSO.CopyFile(configure_module_dirname + "\\libsqlite\\src\\sqlite_config.w32.h",
++              configure_module_dirname + "\\libsqlite\\src\\config.h");
++
++      if (FSO.FileExists(configure_module_dirname + "\\..\\pdo\\php_pdo_driver.h")) {
++              PHP_SQLITE2_PDO_CFLAGS = " /DPHP_SQLITE2_HAVE_PDO=1 /I " + configure_module_dirname + "\\..";
++              ADD_EXTENSION_DEP('sqlite', 'pdo')
++      } else {
++              PHP_SQLITE2_PDO_CFLAGS = "";
++      }
++      
++      EXTENSION("sqlite", "sqlite.c sess_sqlite.c pdo_sqlite2.c", null,
++              "/D PHP_SQLITE_EXPORTS /I " + configure_module_dirname + "/libsqlite/src" +
++              PHP_SQLITE2_PDO_CFLAGS);
++              
++      
++      ADD_SOURCES(configure_module_dirname + "/libsqlite/src", "opcodes.c parse.c encode.c \
++              auth.c btree.c build.c delete.c expr.c func.c hash.c insert.c \
++              main.c os.c pager.c printf.c random.c select.c table.c tokenize.c \
++              update.c util.c vdbe.c attach.c btree_rb.c pragma.c vacuum.c \
++              copy.c where.c trigger.c vdbeaux.c date.c", "sqlite");
++
++      AC_DEFINE("HAVE_SQLITE", 1, "SQLite support");
++      if (!PHP_SQLITE_SHARED) {
++              ADD_DEF_FILE(configure_module_dirname + "\\php_sqlite.def");
++      }
++      ADD_EXTENSION_DEP('sqlite', 'spl')
++}
+--- /dev/null
++++ b/ext/sqlite/CREDITS
+@@ -0,0 +1,2 @@
++SQLite
++Wez Furlong, Tal Peer, Marcus Boerger, Ilia Alshanetsky
+--- /dev/null
++++ b/ext/sqlite/libsqlite/README
+@@ -0,0 +1,37 @@
++This directory contains source code to 
++
++    SQLite: An Embeddable SQL Database Engine
++
++To compile the project, first create a directory in which to place
++the build products.  It is recommended, but not required, that the
++build directory be separate from the source directory.  Cd into the
++build directory and then from the build directory run the configure
++script found at the root of the source tree.  Then run "make".
++
++For example:
++
++    tar xzf sqlite.tar.gz    ;#  Unpack the source tree into "sqlite"
++    mkdir bld                ;#  Build will occur in a sibling directory
++    cd bld                   ;#  Change to the build directory
++    ../sqlite/configure      ;#  Run the configure script
++    make                     ;#  Run the makefile.
++
++The configure script uses autoconf 2.50 and libtool.  If the configure
++script does not work out for you, there is a generic makefile named
++"Makefile.linux-gcc" in the top directory of the source tree that you
++can copy and edit to suite your needs.  Comments on the generic makefile
++show what changes are needed.
++
++The linux binaries on the website are created using the generic makefile,
++not the configure script.  The configure script is unmaintained.  (You
++can volunteer to take over maintenance of the configure script, if you want!)
++The windows binaries on the website are created using MinGW32 configured
++as a cross-compiler running under Linux.  For details, see the ./publish.sh
++script at the top-level of the source tree.
++
++Contacts:
++
++   http://www.sqlite.org/
++   http://www.hwaci.com/sw/sqlite/
++   http://groups.yahoo.com/group/sqlite/
++   drh@hwaci.com
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/attach.c
+@@ -0,0 +1,311 @@
++/*
++** 2003 April 6
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code used to implement the ATTACH and DETACH commands.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** This routine is called by the parser to process an ATTACH statement:
++**
++**     ATTACH DATABASE filename AS dbname
++**
++** The pFilename and pDbname arguments are the tokens that define the
++** filename and dbname in the ATTACH statement.
++*/
++void sqliteAttach(Parse *pParse, Token *pFilename, Token *pDbname, Token *pKey){
++  Db *aNew;
++  int rc, i;
++  char *zFile, *zName;
++  sqlite *db;
++  Vdbe *v;
++
++  v = sqliteGetVdbe(pParse);
++  sqliteVdbeAddOp(v, OP_Halt, 0, 0);
++  if( pParse->explain ) return;
++  db = pParse->db;
++  if( db->file_format<4 ){
++    sqliteErrorMsg(pParse, "cannot attach auxiliary databases to an "
++       "older format master database", 0);
++    pParse->rc = SQLITE_ERROR;
++    return;
++  }
++  if( db->nDb>=MAX_ATTACHED+2 ){
++    sqliteErrorMsg(pParse, "too many attached databases - max %d", 
++       MAX_ATTACHED);
++    pParse->rc = SQLITE_ERROR;
++    return;
++  }
++
++  zFile = 0;
++  sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0);
++  if( zFile==0 ) return;
++  sqliteDequote(zFile);
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  if( sqliteAuthCheck(pParse, SQLITE_ATTACH, zFile, 0, 0)!=SQLITE_OK ){
++    sqliteFree(zFile);
++    return;
++  }
++#endif /* SQLITE_OMIT_AUTHORIZATION */
++
++  zName = 0;
++  sqliteSetNString(&zName, pDbname->z, pDbname->n, 0);
++  if( zName==0 ) return;
++  sqliteDequote(zName);
++  for(i=0; i<db->nDb; i++){
++    if( db->aDb[i].zName && sqliteStrICmp(db->aDb[i].zName, zName)==0 ){
++      sqliteErrorMsg(pParse, "database %z is already in use", zName);
++      pParse->rc = SQLITE_ERROR;
++      sqliteFree(zFile);
++      return;
++    }
++  }
++
++  if( db->aDb==db->aDbStatic ){
++    aNew = sqliteMalloc( sizeof(db->aDb[0])*3 );
++    if( aNew==0 ) return;
++    memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2);
++  }else{
++    aNew = sqliteRealloc(db->aDb, sizeof(db->aDb[0])*(db->nDb+1) );
++    if( aNew==0 ) return;
++  }
++  db->aDb = aNew;
++  aNew = &db->aDb[db->nDb++];
++  memset(aNew, 0, sizeof(*aNew));
++  sqliteHashInit(&aNew->tblHash, SQLITE_HASH_STRING, 0);
++  sqliteHashInit(&aNew->idxHash, SQLITE_HASH_STRING, 0);
++  sqliteHashInit(&aNew->trigHash, SQLITE_HASH_STRING, 0);
++  sqliteHashInit(&aNew->aFKey, SQLITE_HASH_STRING, 1);
++  aNew->zName = zName;
++  rc = sqliteBtreeFactory(db, zFile, 0, MAX_PAGES, &aNew->pBt);
++  if( rc ){
++    sqliteErrorMsg(pParse, "unable to open database: %s", zFile);
++  }
++#if SQLITE_HAS_CODEC
++  {
++    extern int sqliteCodecAttach(sqlite*, int, void*, int);
++    char *zKey = 0;
++    int nKey;
++    if( pKey && pKey->z && pKey->n ){
++      sqliteSetNString(&zKey, pKey->z, pKey->n, 0);
++      sqliteDequote(zKey);
++      nKey = strlen(zKey);
++    }else{
++      zKey = 0;
++      nKey = 0;
++    }
++    sqliteCodecAttach(db, db->nDb-1, zKey, nKey);
++  }
++#endif
++  sqliteFree(zFile);
++  db->flags &= ~SQLITE_Initialized;
++  if( pParse->nErr ) return;
++  if( rc==SQLITE_OK ){
++    rc = sqliteInit(pParse->db, &pParse->zErrMsg);
++  }
++  if( rc ){
++    int i = db->nDb - 1;
++    assert( i>=2 );
++    if( db->aDb[i].pBt ){
++      sqliteBtreeClose(db->aDb[i].pBt);
++      db->aDb[i].pBt = 0;
++    }
++    sqliteResetInternalSchema(db, 0);
++    pParse->nErr++;
++    pParse->rc = SQLITE_ERROR;
++  }
++}
++
++/*
++** This routine is called by the parser to process a DETACH statement:
++**
++**    DETACH DATABASE dbname
++**
++** The pDbname argument is the name of the database in the DETACH statement.
++*/
++void sqliteDetach(Parse *pParse, Token *pDbname){
++  int i;
++  sqlite *db;
++  Vdbe *v;
++  Db *pDb;
++
++  v = sqliteGetVdbe(pParse);
++  sqliteVdbeAddOp(v, OP_Halt, 0, 0);
++  if( pParse->explain ) return;
++  db = pParse->db;
++  for(i=0; i<db->nDb; i++){
++    pDb = &db->aDb[i];
++    if( pDb->pBt==0 || pDb->zName==0 ) continue;
++    if( strlen(pDb->zName)!=pDbname->n ) continue;
++    if( sqliteStrNICmp(pDb->zName, pDbname->z, pDbname->n)==0 ) break;
++  }
++  if( i>=db->nDb ){
++    sqliteErrorMsg(pParse, "no such database: %T", pDbname);
++    return;
++  }
++  if( i<2 ){
++    sqliteErrorMsg(pParse, "cannot detach database %T", pDbname);
++    return;
++  }
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  if( sqliteAuthCheck(pParse,SQLITE_DETACH,db->aDb[i].zName,0,0)!=SQLITE_OK ){
++    return;
++  }
++#endif /* SQLITE_OMIT_AUTHORIZATION */
++  sqliteBtreeClose(pDb->pBt);
++  pDb->pBt = 0;
++  sqliteFree(pDb->zName);
++  sqliteResetInternalSchema(db, i);
++  if( pDb->pAux && pDb->xFreeAux ) pDb->xFreeAux(pDb->pAux);
++  db->nDb--;
++  if( i<db->nDb ){
++    db->aDb[i] = db->aDb[db->nDb];
++    memset(&db->aDb[db->nDb], 0, sizeof(db->aDb[0]));
++    sqliteResetInternalSchema(db, i);
++  }
++}
++
++/*
++** Initialize a DbFixer structure.  This routine must be called prior
++** to passing the structure to one of the sqliteFixAAAA() routines below.
++**
++** The return value indicates whether or not fixation is required.  TRUE
++** means we do need to fix the database references, FALSE means we do not.
++*/
++int sqliteFixInit(
++  DbFixer *pFix,      /* The fixer to be initialized */
++  Parse *pParse,      /* Error messages will be written here */
++  int iDb,            /* This is the database that must must be used */
++  const char *zType,  /* "view", "trigger", or "index" */
++  const Token *pName  /* Name of the view, trigger, or index */
++){
++  sqlite *db;
++
++  if( iDb<0 || iDb==1 ) return 0;
++  db = pParse->db;
++  assert( db->nDb>iDb );
++  pFix->pParse = pParse;
++  pFix->zDb = db->aDb[iDb].zName;
++  pFix->zType = zType;
++  pFix->pName = pName;
++  return 1;
++}
++
++/*
++** The following set of routines walk through the parse tree and assign
++** a specific database to all table references where the database name
++** was left unspecified in the original SQL statement.  The pFix structure
++** must have been initialized by a prior call to sqliteFixInit().
++**
++** These routines are used to make sure that an index, trigger, or
++** view in one database does not refer to objects in a different database.
++** (Exception: indices, triggers, and views in the TEMP database are
++** allowed to refer to anything.)  If a reference is explicitly made
++** to an object in a different database, an error message is added to
++** pParse->zErrMsg and these routines return non-zero.  If everything
++** checks out, these routines return 0.
++*/
++int sqliteFixSrcList(
++  DbFixer *pFix,       /* Context of the fixation */
++  SrcList *pList       /* The Source list to check and modify */
++){
++  int i;
++  const char *zDb;
++
++  if( pList==0 ) return 0;
++  zDb = pFix->zDb;
++  for(i=0; i<pList->nSrc; i++){
++    if( pList->a[i].zDatabase==0 ){
++      pList->a[i].zDatabase = sqliteStrDup(zDb);
++    }else if( sqliteStrICmp(pList->a[i].zDatabase,zDb)!=0 ){
++      sqliteErrorMsg(pFix->pParse,
++         "%s %z cannot reference objects in database %s",
++         pFix->zType, sqliteStrNDup(pFix->pName->z, pFix->pName->n),
++         pList->a[i].zDatabase);
++      return 1;
++    }
++    if( sqliteFixSelect(pFix, pList->a[i].pSelect) ) return 1;
++    if( sqliteFixExpr(pFix, pList->a[i].pOn) ) return 1;
++  }
++  return 0;
++}
++int sqliteFixSelect(
++  DbFixer *pFix,       /* Context of the fixation */
++  Select *pSelect      /* The SELECT statement to be fixed to one database */
++){
++  while( pSelect ){
++    if( sqliteFixExprList(pFix, pSelect->pEList) ){
++      return 1;
++    }
++    if( sqliteFixSrcList(pFix, pSelect->pSrc) ){
++      return 1;
++    }
++    if( sqliteFixExpr(pFix, pSelect->pWhere) ){
++      return 1;
++    }
++    if( sqliteFixExpr(pFix, pSelect->pHaving) ){
++      return 1;
++    }
++    pSelect = pSelect->pPrior;
++  }
++  return 0;
++}
++int sqliteFixExpr(
++  DbFixer *pFix,     /* Context of the fixation */
++  Expr *pExpr        /* The expression to be fixed to one database */
++){
++  while( pExpr ){
++    if( sqliteFixSelect(pFix, pExpr->pSelect) ){
++      return 1;
++    }
++    if( sqliteFixExprList(pFix, pExpr->pList) ){
++      return 1;
++    }
++    if( sqliteFixExpr(pFix, pExpr->pRight) ){
++      return 1;
++    }
++    pExpr = pExpr->pLeft;
++  }
++  return 0;
++}
++int sqliteFixExprList(
++  DbFixer *pFix,     /* Context of the fixation */
++  ExprList *pList    /* The expression to be fixed to one database */
++){
++  int i;
++  if( pList==0 ) return 0;
++  for(i=0; i<pList->nExpr; i++){
++    if( sqliteFixExpr(pFix, pList->a[i].pExpr) ){
++      return 1;
++    }
++  }
++  return 0;
++}
++int sqliteFixTriggerStep(
++  DbFixer *pFix,     /* Context of the fixation */
++  TriggerStep *pStep /* The trigger step be fixed to one database */
++){
++  while( pStep ){
++    if( sqliteFixSelect(pFix, pStep->pSelect) ){
++      return 1;
++    }
++    if( sqliteFixExpr(pFix, pStep->pWhere) ){
++      return 1;
++    }
++    if( sqliteFixExprList(pFix, pStep->pExprList) ){
++      return 1;
++    }
++    pStep = pStep->pNext;
++  }
++  return 0;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/auth.c
+@@ -0,0 +1,219 @@
++/*
++** 2003 January 11
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code used to implement the sqlite_set_authorizer()
++** API.  This facility is an optional feature of the library.  Embedded
++** systems that do not need this facility may omit it by recompiling
++** the library with -DSQLITE_OMIT_AUTHORIZATION=1
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** All of the code in this file may be omitted by defining a single
++** macro.
++*/
++#ifndef SQLITE_OMIT_AUTHORIZATION
++
++/*
++** Set or clear the access authorization function.
++**
++** The access authorization function is be called during the compilation
++** phase to verify that the user has read and/or write access permission on
++** various fields of the database.  The first argument to the auth function
++** is a copy of the 3rd argument to this routine.  The second argument
++** to the auth function is one of these constants:
++**
++**       SQLITE_COPY
++**       SQLITE_CREATE_INDEX
++**       SQLITE_CREATE_TABLE
++**       SQLITE_CREATE_TEMP_INDEX
++**       SQLITE_CREATE_TEMP_TABLE
++**       SQLITE_CREATE_TEMP_TRIGGER
++**       SQLITE_CREATE_TEMP_VIEW
++**       SQLITE_CREATE_TRIGGER
++**       SQLITE_CREATE_VIEW
++**       SQLITE_DELETE
++**       SQLITE_DROP_INDEX
++**       SQLITE_DROP_TABLE
++**       SQLITE_DROP_TEMP_INDEX
++**       SQLITE_DROP_TEMP_TABLE
++**       SQLITE_DROP_TEMP_TRIGGER
++**       SQLITE_DROP_TEMP_VIEW
++**       SQLITE_DROP_TRIGGER
++**       SQLITE_DROP_VIEW
++**       SQLITE_INSERT
++**       SQLITE_PRAGMA
++**       SQLITE_READ
++**       SQLITE_SELECT
++**       SQLITE_TRANSACTION
++**       SQLITE_UPDATE
++**
++** The third and fourth arguments to the auth function are the name of
++** the table and the column that are being accessed.  The auth function
++** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE.  If
++** SQLITE_OK is returned, it means that access is allowed.  SQLITE_DENY
++** means that the SQL statement will never-run - the sqlite_exec() call
++** will return with an error.  SQLITE_IGNORE means that the SQL statement
++** should run but attempts to read the specified column will return NULL
++** and attempts to write the column will be ignored.
++**
++** Setting the auth function to NULL disables this hook.  The default
++** setting of the auth function is NULL.
++*/
++int sqlite_set_authorizer(
++  sqlite *db,
++  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
++  void *pArg
++){
++  db->xAuth = xAuth;
++  db->pAuthArg = pArg;
++  return SQLITE_OK;
++}
++
++/*
++** Write an error message into pParse->zErrMsg that explains that the
++** user-supplied authorization function returned an illegal value.
++*/
++static void sqliteAuthBadReturnCode(Parse *pParse, int rc){
++  sqliteErrorMsg(pParse, "illegal return value (%d) from the "
++    "authorization function - should be SQLITE_OK, SQLITE_IGNORE, "
++    "or SQLITE_DENY", rc);
++  pParse->rc = SQLITE_MISUSE;
++}
++
++/*
++** The pExpr should be a TK_COLUMN expression.  The table referred to
++** is in pTabList or else it is the NEW or OLD table of a trigger.  
++** Check to see if it is OK to read this particular column.
++**
++** If the auth function returns SQLITE_IGNORE, change the TK_COLUMN 
++** instruction into a TK_NULL.  If the auth function returns SQLITE_DENY,
++** then generate an error.
++*/
++void sqliteAuthRead(
++  Parse *pParse,        /* The parser context */
++  Expr *pExpr,          /* The expression to check authorization on */
++  SrcList *pTabList     /* All table that pExpr might refer to */
++){
++  sqlite *db = pParse->db;
++  int rc;
++  Table *pTab;          /* The table being read */
++  const char *zCol;     /* Name of the column of the table */
++  int iSrc;             /* Index in pTabList->a[] of table being read */
++  const char *zDBase;   /* Name of database being accessed */
++  TriggerStack *pStack; /* The stack of current triggers */
++
++  if( db->xAuth==0 ) return;
++  assert( pExpr->op==TK_COLUMN );
++  for(iSrc=0; iSrc<pTabList->nSrc; iSrc++){
++    if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break;
++  }
++  if( iSrc>=0 && iSrc<pTabList->nSrc ){
++    pTab = pTabList->a[iSrc].pTab;
++  }else if( (pStack = pParse->trigStack)!=0 ){
++    /* This must be an attempt to read the NEW or OLD pseudo-tables
++    ** of a trigger.
++    */
++    assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx );
++    pTab = pStack->pTab;
++  }else{
++    return;
++  }
++  if( pTab==0 ) return;
++  if( pExpr->iColumn>=0 ){
++    assert( pExpr->iColumn<pTab->nCol );
++    zCol = pTab->aCol[pExpr->iColumn].zName;
++  }else if( pTab->iPKey>=0 ){
++    assert( pTab->iPKey<pTab->nCol );
++    zCol = pTab->aCol[pTab->iPKey].zName;
++  }else{
++    zCol = "ROWID";
++  }
++  assert( pExpr->iDb<db->nDb );
++  zDBase = db->aDb[pExpr->iDb].zName;
++  rc = db->xAuth(db->pAuthArg, SQLITE_READ, pTab->zName, zCol, zDBase, 
++                 pParse->zAuthContext);
++  if( rc==SQLITE_IGNORE ){
++    pExpr->op = TK_NULL;
++  }else if( rc==SQLITE_DENY ){
++    if( db->nDb>2 || pExpr->iDb!=0 ){
++      sqliteErrorMsg(pParse, "access to %s.%s.%s is prohibited", 
++         zDBase, pTab->zName, zCol);
++    }else{
++      sqliteErrorMsg(pParse, "access to %s.%s is prohibited", pTab->zName,zCol);
++    }
++    pParse->rc = SQLITE_AUTH;
++  }else if( rc!=SQLITE_OK ){
++    sqliteAuthBadReturnCode(pParse, rc);
++  }
++}
++
++/*
++** Do an authorization check using the code and arguments given.  Return
++** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY
++** is returned, then the error count and error message in pParse are
++** modified appropriately.
++*/
++int sqliteAuthCheck(
++  Parse *pParse,
++  int code,
++  const char *zArg1,
++  const char *zArg2,
++  const char *zArg3
++){
++  sqlite *db = pParse->db;
++  int rc;
++
++  if( db->init.busy || db->xAuth==0 ){
++    return SQLITE_OK;
++  }
++  rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext);
++  if( rc==SQLITE_DENY ){
++    sqliteErrorMsg(pParse, "not authorized");
++    pParse->rc = SQLITE_AUTH;
++  }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
++    rc = SQLITE_DENY;
++    sqliteAuthBadReturnCode(pParse, rc);
++  }
++  return rc;
++}
++
++/*
++** Push an authorization context.  After this routine is called, the
++** zArg3 argument to authorization callbacks will be zContext until
++** popped.  Or if pParse==0, this routine is a no-op.
++*/
++void sqliteAuthContextPush(
++  Parse *pParse,
++  AuthContext *pContext, 
++  const char *zContext
++){
++  pContext->pParse = pParse;
++  if( pParse ){
++    pContext->zAuthContext = pParse->zAuthContext;
++    pParse->zAuthContext = zContext;
++  }
++}
++
++/*
++** Pop an authorization context that was previously pushed
++** by sqliteAuthContextPush
++*/
++void sqliteAuthContextPop(AuthContext *pContext){
++  if( pContext->pParse ){
++    pContext->pParse->zAuthContext = pContext->zAuthContext;
++    pContext->pParse = 0;
++  }
++}
++
++#endif /* SQLITE_OMIT_AUTHORIZATION */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/btree.c
+@@ -0,0 +1,3584 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** $Id$
++**
++** This file implements a external (disk-based) database using BTrees.
++** For a detailed discussion of BTrees, refer to
++**
++**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
++**     "Sorting And Searching", pages 473-480. Addison-Wesley
++**     Publishing Company, Reading, Massachusetts.
++**
++** The basic idea is that each page of the file contains N database
++** entries and N+1 pointers to subpages.
++**
++**   ----------------------------------------------------------------
++**   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N) | Ptr(N+1) |
++**   ----------------------------------------------------------------
++**
++** All of the keys on the page that Ptr(0) points to have values less
++** than Key(0).  All of the keys on page Ptr(1) and its subpages have
++** values greater than Key(0) and less than Key(1).  All of the keys
++** on Ptr(N+1) and its subpages have values greater than Key(N).  And
++** so forth.
++**
++** Finding a particular key requires reading O(log(M)) pages from the 
++** disk where M is the number of entries in the tree.
++**
++** In this implementation, a single file can hold one or more separate 
++** BTrees.  Each BTree is identified by the index of its root page.  The
++** key and data for any entry are combined to form the "payload".  Up to
++** MX_LOCAL_PAYLOAD bytes of payload can be carried directly on the
++** database page.  If the payload is larger than MX_LOCAL_PAYLOAD bytes
++** then surplus bytes are stored on overflow pages.  The payload for an
++** entry and the preceding pointer are combined to form a "Cell".  Each 
++** page has a small header which contains the Ptr(N+1) pointer.
++**
++** The first page of the file contains a magic string used to verify that
++** the file really is a valid BTree database, a pointer to a list of unused
++** pages in the file, and some meta information.  The root of the first
++** BTree begins on page 2 of the file.  (Pages are numbered beginning with
++** 1, not 0.)  Thus a minimum database contains 2 pages.
++*/
++#include "sqliteInt.h"
++#include "pager.h"
++#include "btree.h"
++#include <assert.h>
++
++/* Forward declarations */
++static BtOps sqliteBtreeOps;
++static BtCursorOps sqliteBtreeCursorOps;
++
++/*
++** Macros used for byteswapping.  B is a pointer to the Btree
++** structure.  This is needed to access the Btree.needSwab boolean
++** in order to tell if byte swapping is needed or not.
++** X is an unsigned integer.  SWAB16 byte swaps a 16-bit integer.
++** SWAB32 byteswaps a 32-bit integer.
++*/
++#define SWAB16(B,X)   ((B)->needSwab? swab16((u16)X) : ((u16)X))
++#define SWAB32(B,X)   ((B)->needSwab? swab32(X) : (X))
++#define SWAB_ADD(B,X,A) \
++   if((B)->needSwab){ X=swab32(swab32(X)+A); }else{ X += (A); }
++
++/*
++** The following global variable - available only if SQLITE_TEST is
++** defined - is used to determine whether new databases are created in
++** native byte order or in non-native byte order.  Non-native byte order
++** databases are created for testing purposes only.  Under normal operation,
++** only native byte-order databases should be created, but we should be
++** able to read or write existing databases regardless of the byteorder.
++*/
++#ifdef SQLITE_TEST
++int btree_native_byte_order = 1;
++#else
++# define btree_native_byte_order 1
++#endif
++
++/*
++** Forward declarations of structures used only in this file.
++*/
++typedef struct PageOne PageOne;
++typedef struct MemPage MemPage;
++typedef struct PageHdr PageHdr;
++typedef struct Cell Cell;
++typedef struct CellHdr CellHdr;
++typedef struct FreeBlk FreeBlk;
++typedef struct OverflowPage OverflowPage;
++typedef struct FreelistInfo FreelistInfo;
++
++/*
++** All structures on a database page are aligned to 4-byte boundries.
++** This routine rounds up a number of bytes to the next multiple of 4.
++**
++** This might need to change for computer architectures that require
++** and 8-byte alignment boundry for structures.
++*/
++#define ROUNDUP(X)  ((X+3) & ~3)
++
++/*
++** This is a magic string that appears at the beginning of every
++** SQLite database in order to identify the file as a real database.
++*/
++static const char zMagicHeader[] = 
++   "** This file contains an SQLite 2.1 database **";
++#define MAGIC_SIZE (sizeof(zMagicHeader))
++
++/*
++** This is a magic integer also used to test the integrity of the database
++** file.  This integer is used in addition to the string above so that
++** if the file is written on a little-endian architecture and read
++** on a big-endian architectures (or vice versa) we can detect the
++** problem.
++**
++** The number used was obtained at random and has no special
++** significance other than the fact that it represents a different
++** integer on little-endian and big-endian machines.
++*/
++#define MAGIC 0xdae37528
++
++/*
++** The first page of the database file contains a magic header string
++** to identify the file as an SQLite database file.  It also contains
++** a pointer to the first free page of the file.  Page 2 contains the
++** root of the principle BTree.  The file might contain other BTrees
++** rooted on pages above 2.
++**
++** The first page also contains SQLITE_N_BTREE_META integers that
++** can be used by higher-level routines.
++**
++** Remember that pages are numbered beginning with 1.  (See pager.c
++** for additional information.)  Page 0 does not exist and a page
++** number of 0 is used to mean "no such page".
++*/
++struct PageOne {
++  char zMagic[MAGIC_SIZE]; /* String that identifies the file as a database */
++  int iMagic;              /* Integer to verify correct byte order */
++  Pgno freeList;           /* First free page in a list of all free pages */
++  int nFree;               /* Number of pages on the free list */
++  int aMeta[SQLITE_N_BTREE_META-1];  /* User defined integers */
++};
++
++/*
++** Each database page has a header that is an instance of this
++** structure.
++**
++** PageHdr.firstFree is 0 if there is no free space on this page.
++** Otherwise, PageHdr.firstFree is the index in MemPage.u.aDisk[] of a 
++** FreeBlk structure that describes the first block of free space.  
++** All free space is defined by a linked list of FreeBlk structures.
++**
++** Data is stored in a linked list of Cell structures.  PageHdr.firstCell
++** is the index into MemPage.u.aDisk[] of the first cell on the page.  The
++** Cells are kept in sorted order.
++**
++** A Cell contains all information about a database entry and a pointer
++** to a child page that contains other entries less than itself.  In
++** other words, the i-th Cell contains both Ptr(i) and Key(i).  The
++** right-most pointer of the page is contained in PageHdr.rightChild.
++*/
++struct PageHdr {
++  Pgno rightChild;  /* Child page that comes after all cells on this page */
++  u16 firstCell;    /* Index in MemPage.u.aDisk[] of the first cell */
++  u16 firstFree;    /* Index in MemPage.u.aDisk[] of the first free block */
++};
++
++/*
++** Entries on a page of the database are called "Cells".  Each Cell
++** has a header and data.  This structure defines the header.  The
++** key and data (collectively the "payload") follow this header on
++** the database page.
++**
++** A definition of the complete Cell structure is given below.  The
++** header for the cell must be defined first in order to do some
++** of the sizing #defines that follow.
++*/
++struct CellHdr {
++  Pgno leftChild; /* Child page that comes before this cell */
++  u16 nKey;       /* Number of bytes in the key */
++  u16 iNext;      /* Index in MemPage.u.aDisk[] of next cell in sorted order */
++  u8 nKeyHi;      /* Upper 8 bits of key size for keys larger than 64K bytes */
++  u8 nDataHi;     /* Upper 8 bits of data size when the size is more than 64K */
++  u16 nData;      /* Number of bytes of data */
++};
++
++/*
++** The key and data size are split into a lower 16-bit segment and an
++** upper 8-bit segment in order to pack them together into a smaller
++** space.  The following macros reassembly a key or data size back
++** into an integer.
++*/
++#define NKEY(b,h)  (SWAB16(b,h.nKey) + h.nKeyHi*65536)
++#define NDATA(b,h) (SWAB16(b,h.nData) + h.nDataHi*65536)
++
++/*
++** The minimum size of a complete Cell.  The Cell must contain a header
++** and at least 4 bytes of payload.
++*/
++#define MIN_CELL_SIZE  (sizeof(CellHdr)+4)
++
++/*
++** The maximum number of database entries that can be held in a single
++** page of the database. 
++*/
++#define MX_CELL ((SQLITE_USABLE_SIZE-sizeof(PageHdr))/MIN_CELL_SIZE)
++
++/*
++** The amount of usable space on a single page of the BTree.  This is the
++** page size minus the overhead of the page header.
++*/
++#define USABLE_SPACE  (SQLITE_USABLE_SIZE - sizeof(PageHdr))
++
++/*
++** The maximum amount of payload (in bytes) that can be stored locally for
++** a database entry.  If the entry contains more data than this, the
++** extra goes onto overflow pages.
++**
++** This number is chosen so that at least 4 cells will fit on every page.
++*/
++#define MX_LOCAL_PAYLOAD ((USABLE_SPACE/4-(sizeof(CellHdr)+sizeof(Pgno)))&~3)
++
++/*
++** Data on a database page is stored as a linked list of Cell structures.
++** Both the key and the data are stored in aPayload[].  The key always comes
++** first.  The aPayload[] field grows as necessary to hold the key and data,
++** up to a maximum of MX_LOCAL_PAYLOAD bytes.  If the size of the key and
++** data combined exceeds MX_LOCAL_PAYLOAD bytes, then Cell.ovfl is the
++** page number of the first overflow page.
++**
++** Though this structure is fixed in size, the Cell on the database
++** page varies in size.  Every cell has a CellHdr and at least 4 bytes
++** of payload space.  Additional payload bytes (up to the maximum of
++** MX_LOCAL_PAYLOAD) and the Cell.ovfl value are allocated only as
++** needed.
++*/
++struct Cell {
++  CellHdr h;                        /* The cell header */
++  char aPayload[MX_LOCAL_PAYLOAD];  /* Key and data */
++  Pgno ovfl;                        /* The first overflow page */
++};
++
++/*
++** Free space on a page is remembered using a linked list of the FreeBlk
++** structures.  Space on a database page is allocated in increments of
++** at least 4 bytes and is always aligned to a 4-byte boundry.  The
++** linked list of FreeBlks is always kept in order by address.
++*/
++struct FreeBlk {
++  u16 iSize;      /* Number of bytes in this block of free space */
++  u16 iNext;      /* Index in MemPage.u.aDisk[] of the next free block */
++};
++
++/*
++** The number of bytes of payload that will fit on a single overflow page.
++*/
++#define OVERFLOW_SIZE (SQLITE_USABLE_SIZE-sizeof(Pgno))
++
++/*
++** When the key and data for a single entry in the BTree will not fit in
++** the MX_LOCAL_PAYLOAD bytes of space available on the database page,
++** then all extra bytes are written to a linked list of overflow pages.
++** Each overflow page is an instance of the following structure.
++**
++** Unused pages in the database are also represented by instances of
++** the OverflowPage structure.  The PageOne.freeList field is the
++** page number of the first page in a linked list of unused database
++** pages.
++*/
++struct OverflowPage {
++  Pgno iNext;
++  char aPayload[OVERFLOW_SIZE];
++};
++
++/*
++** The PageOne.freeList field points to a linked list of overflow pages
++** hold information about free pages.  The aPayload section of each
++** overflow page contains an instance of the following structure.  The
++** aFree[] array holds the page number of nFree unused pages in the disk
++** file.
++*/
++struct FreelistInfo {
++  int nFree;
++  Pgno aFree[(OVERFLOW_SIZE-sizeof(int))/sizeof(Pgno)];
++};
++
++/*
++** For every page in the database file, an instance of the following structure
++** is stored in memory.  The u.aDisk[] array contains the raw bits read from
++** the disk.  The rest is auxiliary information held in memory only. The
++** auxiliary info is only valid for regular database pages - it is not
++** used for overflow pages and pages on the freelist.
++**
++** Of particular interest in the auxiliary info is the apCell[] entry.  Each
++** apCell[] entry is a pointer to a Cell structure in u.aDisk[].  The cells are
++** put in this array so that they can be accessed in constant time, rather
++** than in linear time which would be needed if we had to walk the linked 
++** list on every access.
++**
++** Note that apCell[] contains enough space to hold up to two more Cells
++** than can possibly fit on one page.  In the steady state, every apCell[]
++** points to memory inside u.aDisk[].  But in the middle of an insert
++** operation, some apCell[] entries may temporarily point to data space
++** outside of u.aDisk[].  This is a transient situation that is quickly
++** resolved.  But while it is happening, it is possible for a database
++** page to hold as many as two more cells than it might otherwise hold.
++** The extra two entries in apCell[] are an allowance for this situation.
++**
++** The pParent field points back to the parent page.  This allows us to
++** walk up the BTree from any leaf to the root.  Care must be taken to
++** unref() the parent page pointer when this page is no longer referenced.
++** The pageDestructor() routine handles that chore.
++*/
++struct MemPage {
++  union u_page_data {
++    char aDisk[SQLITE_PAGE_SIZE];  /* Page data stored on disk */
++    PageHdr hdr;                   /* Overlay page header */
++  } u;
++  u8 isInit;                     /* True if auxiliary data is initialized */
++  u8 idxShift;                   /* True if apCell[] indices have changed */
++  u8 isOverfull;                 /* Some apCell[] points outside u.aDisk[] */
++  MemPage *pParent;              /* The parent of this page.  NULL for root */
++  int idxParent;                 /* Index in pParent->apCell[] of this node */
++  int nFree;                     /* Number of free bytes in u.aDisk[] */
++  int nCell;                     /* Number of entries on this page */
++  Cell *apCell[MX_CELL+2];       /* All data entires in sorted order */
++};
++
++/*
++** The in-memory image of a disk page has the auxiliary information appended
++** to the end.  EXTRA_SIZE is the number of bytes of space needed to hold
++** that extra information.
++*/
++#define EXTRA_SIZE (sizeof(MemPage)-sizeof(union u_page_data))
++
++/*
++** Everything we need to know about an open database
++*/
++struct Btree {
++  BtOps *pOps;          /* Function table */
++  Pager *pPager;        /* The page cache */
++  BtCursor *pCursor;    /* A list of all open cursors */
++  PageOne *page1;       /* First page of the database */
++  u8 inTrans;           /* True if a transaction is in progress */
++  u8 inCkpt;            /* True if there is a checkpoint on the transaction */
++  u8 readOnly;          /* True if the underlying file is readonly */
++  u8 needSwab;          /* Need to byte-swapping */
++};
++typedef Btree Bt;
++
++/*
++** A cursor is a pointer to a particular entry in the BTree.
++** The entry is identified by its MemPage and the index in
++** MemPage.apCell[] of the entry.
++*/
++struct BtCursor {
++  BtCursorOps *pOps;        /* Function table */
++  Btree *pBt;               /* The Btree to which this cursor belongs */
++  BtCursor *pNext, *pPrev;  /* Forms a linked list of all cursors */
++  BtCursor *pShared;        /* Loop of cursors with the same root page */
++  Pgno pgnoRoot;            /* The root page of this tree */
++  MemPage *pPage;           /* Page that contains the entry */
++  int idx;                  /* Index of the entry in pPage->apCell[] */
++  u8 wrFlag;                /* True if writable */
++  u8 eSkip;                 /* Determines if next step operation is a no-op */
++  u8 iMatch;                /* compare result from last sqliteBtreeMoveto() */
++};
++
++/*
++** Legal values for BtCursor.eSkip.
++*/
++#define SKIP_NONE     0   /* Always step the cursor */
++#define SKIP_NEXT     1   /* The next sqliteBtreeNext() is a no-op */
++#define SKIP_PREV     2   /* The next sqliteBtreePrevious() is a no-op */
++#define SKIP_INVALID  3   /* Calls to Next() and Previous() are invalid */
++
++/* Forward declarations */
++static int fileBtreeCloseCursor(BtCursor *pCur);
++
++/*
++** Routines for byte swapping.
++*/
++u16 swab16(u16 x){
++  return ((x & 0xff)<<8) | ((x>>8)&0xff);
++}
++u32 swab32(u32 x){
++  return ((x & 0xff)<<24) | ((x & 0xff00)<<8) |
++         ((x>>8) & 0xff00) | ((x>>24)&0xff);
++}
++
++/*
++** Compute the total number of bytes that a Cell needs on the main
++** database page.  The number returned includes the Cell header,
++** local payload storage, and the pointer to overflow pages (if
++** applicable).  Additional space allocated on overflow pages
++** is NOT included in the value returned from this routine.
++*/
++static int cellSize(Btree *pBt, Cell *pCell){
++  int n = NKEY(pBt, pCell->h) + NDATA(pBt, pCell->h);
++  if( n>MX_LOCAL_PAYLOAD ){
++    n = MX_LOCAL_PAYLOAD + sizeof(Pgno);
++  }else{
++    n = ROUNDUP(n);
++  }
++  n += sizeof(CellHdr);
++  return n;
++}
++
++/*
++** Defragment the page given.  All Cells are moved to the
++** beginning of the page and all free space is collected 
++** into one big FreeBlk at the end of the page.
++*/
++static void defragmentPage(Btree *pBt, MemPage *pPage){
++  int pc, i, n;
++  FreeBlk *pFBlk;
++  char newPage[SQLITE_USABLE_SIZE];
++
++  assert( sqlitepager_iswriteable(pPage) );
++  assert( pPage->isInit );
++  pc = sizeof(PageHdr);
++  pPage->u.hdr.firstCell = SWAB16(pBt, pc);
++  memcpy(newPage, pPage->u.aDisk, pc);
++  for(i=0; i<pPage->nCell; i++){
++    Cell *pCell = pPage->apCell[i];
++
++    /* This routine should never be called on an overfull page.  The
++    ** following asserts verify that constraint. */
++    assert( Addr(pCell) > Addr(pPage) );
++    assert( Addr(pCell) < Addr(pPage) + SQLITE_USABLE_SIZE );
++
++    n = cellSize(pBt, pCell);
++    pCell->h.iNext = SWAB16(pBt, pc + n);
++    memcpy(&newPage[pc], pCell, n);
++    pPage->apCell[i] = (Cell*)&pPage->u.aDisk[pc];
++    pc += n;
++  }
++  assert( pPage->nFree==SQLITE_USABLE_SIZE-pc );
++  memcpy(pPage->u.aDisk, newPage, pc);
++  if( pPage->nCell>0 ){
++    pPage->apCell[pPage->nCell-1]->h.iNext = 0;
++  }
++  pFBlk = (FreeBlk*)&pPage->u.aDisk[pc];
++  pFBlk->iSize = SWAB16(pBt, SQLITE_USABLE_SIZE - pc);
++  pFBlk->iNext = 0;
++  pPage->u.hdr.firstFree = SWAB16(pBt, pc);
++  memset(&pFBlk[1], 0, SQLITE_USABLE_SIZE - pc - sizeof(FreeBlk));
++}
++
++/*
++** Allocate nByte bytes of space on a page.  nByte must be a 
++** multiple of 4.
++**
++** Return the index into pPage->u.aDisk[] of the first byte of
++** the new allocation. Or return 0 if there is not enough free
++** space on the page to satisfy the allocation request.
++**
++** If the page contains nBytes of free space but does not contain
++** nBytes of contiguous free space, then this routine automatically
++** calls defragementPage() to consolidate all free space before 
++** allocating the new chunk.
++*/
++static int allocateSpace(Btree *pBt, MemPage *pPage, int nByte){
++  FreeBlk *p;
++  u16 *pIdx;
++  int start;
++  int iSize;
++#ifndef NDEBUG
++  int cnt = 0;
++#endif
++
++  assert( sqlitepager_iswriteable(pPage) );
++  assert( nByte==ROUNDUP(nByte) );
++  assert( pPage->isInit );
++  if( pPage->nFree<nByte || pPage->isOverfull ) return 0;
++  pIdx = &pPage->u.hdr.firstFree;
++  p = (FreeBlk*)&pPage->u.aDisk[SWAB16(pBt, *pIdx)];
++  while( (iSize = SWAB16(pBt, p->iSize))<nByte ){
++    assert( cnt++ < SQLITE_USABLE_SIZE/4 );
++    if( p->iNext==0 ){
++      defragmentPage(pBt, pPage);
++      pIdx = &pPage->u.hdr.firstFree;
++    }else{
++      pIdx = &p->iNext;
++    }
++    p = (FreeBlk*)&pPage->u.aDisk[SWAB16(pBt, *pIdx)];
++  }
++  if( iSize==nByte ){
++    start = SWAB16(pBt, *pIdx);
++    *pIdx = p->iNext;
++  }else{
++    FreeBlk *pNew;
++    start = SWAB16(pBt, *pIdx);
++    pNew = (FreeBlk*)&pPage->u.aDisk[start + nByte];
++    pNew->iNext = p->iNext;
++    pNew->iSize = SWAB16(pBt, iSize - nByte);
++    *pIdx = SWAB16(pBt, start + nByte);
++  }
++  pPage->nFree -= nByte;
++  return start;
++}
++
++/*
++** Return a section of the MemPage.u.aDisk[] to the freelist.
++** The first byte of the new free block is pPage->u.aDisk[start]
++** and the size of the block is "size" bytes.  Size must be
++** a multiple of 4.
++**
++** Most of the effort here is involved in coalesing adjacent
++** free blocks into a single big free block.
++*/
++static void freeSpace(Btree *pBt, MemPage *pPage, int start, int size){
++  int end = start + size;
++  u16 *pIdx, idx;
++  FreeBlk *pFBlk;
++  FreeBlk *pNew;
++  FreeBlk *pNext;
++  int iSize;
++
++  assert( sqlitepager_iswriteable(pPage) );
++  assert( size == ROUNDUP(size) );
++  assert( start == ROUNDUP(start) );
++  assert( pPage->isInit );
++  pIdx = &pPage->u.hdr.firstFree;
++  idx = SWAB16(pBt, *pIdx);
++  while( idx!=0 && idx<start ){
++    pFBlk = (FreeBlk*)&pPage->u.aDisk[idx];
++    iSize = SWAB16(pBt, pFBlk->iSize);
++    if( idx + iSize == start ){
++      pFBlk->iSize = SWAB16(pBt, iSize + size);
++      if( idx + iSize + size == SWAB16(pBt, pFBlk->iNext) ){
++        pNext = (FreeBlk*)&pPage->u.aDisk[idx + iSize + size];
++        if( pBt->needSwab ){
++          pFBlk->iSize = swab16((u16)swab16(pNext->iSize)+iSize+size);
++        }else{
++          pFBlk->iSize += pNext->iSize;
++        }
++        pFBlk->iNext = pNext->iNext;
++      }
++      pPage->nFree += size;
++      return;
++    }
++    pIdx = &pFBlk->iNext;
++    idx = SWAB16(pBt, *pIdx);
++  }
++  pNew = (FreeBlk*)&pPage->u.aDisk[start];
++  if( idx != end ){
++    pNew->iSize = SWAB16(pBt, size);
++    pNew->iNext = SWAB16(pBt, idx);
++  }else{
++    pNext = (FreeBlk*)&pPage->u.aDisk[idx];
++    pNew->iSize = SWAB16(pBt, size + SWAB16(pBt, pNext->iSize));
++    pNew->iNext = pNext->iNext;
++  }
++  *pIdx = SWAB16(pBt, start);
++  pPage->nFree += size;
++}
++
++/*
++** Initialize the auxiliary information for a disk block.
++**
++** The pParent parameter must be a pointer to the MemPage which
++** is the parent of the page being initialized.  The root of the
++** BTree (usually page 2) has no parent and so for that page, 
++** pParent==NULL.
++**
++** Return SQLITE_OK on success.  If we see that the page does
++** not contain a well-formed database page, then return 
++** SQLITE_CORRUPT.  Note that a return of SQLITE_OK does not
++** guarantee that the page is well-formed.  It only shows that
++** we failed to detect any corruption.
++*/
++static int initPage(Bt *pBt, MemPage *pPage, Pgno pgnoThis, MemPage *pParent){
++  int idx;           /* An index into pPage->u.aDisk[] */
++  Cell *pCell;       /* A pointer to a Cell in pPage->u.aDisk[] */
++  FreeBlk *pFBlk;    /* A pointer to a free block in pPage->u.aDisk[] */
++  int sz;            /* The size of a Cell in bytes */
++  int freeSpace;     /* Amount of free space on the page */
++
++  if( pPage->pParent ){
++    assert( pPage->pParent==pParent );
++    return SQLITE_OK;
++  }
++  if( pParent ){
++    pPage->pParent = pParent;
++    sqlitepager_ref(pParent);
++  }
++  if( pPage->isInit ) return SQLITE_OK;
++  pPage->isInit = 1;
++  pPage->nCell = 0;
++  freeSpace = USABLE_SPACE;
++  idx = SWAB16(pBt, pPage->u.hdr.firstCell);
++  while( idx!=0 ){
++    if( idx>SQLITE_USABLE_SIZE-MIN_CELL_SIZE ) goto page_format_error;
++    if( idx<sizeof(PageHdr) ) goto page_format_error;
++    if( idx!=ROUNDUP(idx) ) goto page_format_error;
++    pCell = (Cell*)&pPage->u.aDisk[idx];
++    sz = cellSize(pBt, pCell);
++    if( idx+sz > SQLITE_USABLE_SIZE ) goto page_format_error;
++    freeSpace -= sz;
++    pPage->apCell[pPage->nCell++] = pCell;
++    idx = SWAB16(pBt, pCell->h.iNext);
++  }
++  pPage->nFree = 0;
++  idx = SWAB16(pBt, pPage->u.hdr.firstFree);
++  while( idx!=0 ){
++    int iNext;
++    if( idx>SQLITE_USABLE_SIZE-sizeof(FreeBlk) ) goto page_format_error;
++    if( idx<sizeof(PageHdr) ) goto page_format_error;
++    pFBlk = (FreeBlk*)&pPage->u.aDisk[idx];
++    pPage->nFree += SWAB16(pBt, pFBlk->iSize);
++    iNext = SWAB16(pBt, pFBlk->iNext);
++    if( iNext>0 && iNext <= idx ) goto page_format_error;
++    idx = iNext;
++  }
++  if( pPage->nCell==0 && pPage->nFree==0 ){
++    /* As a special case, an uninitialized root page appears to be
++    ** an empty database */
++    return SQLITE_OK;
++  }
++  if( pPage->nFree!=freeSpace ) goto page_format_error;
++  return SQLITE_OK;
++
++page_format_error:
++  return SQLITE_CORRUPT;
++}
++
++/*
++** Set up a raw page so that it looks like a database page holding
++** no entries.
++*/
++static void zeroPage(Btree *pBt, MemPage *pPage){
++  PageHdr *pHdr;
++  FreeBlk *pFBlk;
++  assert( sqlitepager_iswriteable(pPage) );
++  memset(pPage, 0, SQLITE_USABLE_SIZE);
++  pHdr = &pPage->u.hdr;
++  pHdr->firstCell = 0;
++  pHdr->firstFree = SWAB16(pBt, sizeof(*pHdr));
++  pFBlk = (FreeBlk*)&pHdr[1];
++  pFBlk->iNext = 0;
++  pPage->nFree = SQLITE_USABLE_SIZE - sizeof(*pHdr);
++  pFBlk->iSize = SWAB16(pBt, pPage->nFree);
++  pPage->nCell = 0;
++  pPage->isOverfull = 0;
++}
++
++/*
++** This routine is called when the reference count for a page
++** reaches zero.  We need to unref the pParent pointer when that
++** happens.
++*/
++static void pageDestructor(void *pData){
++  MemPage *pPage = (MemPage*)pData;
++  if( pPage->pParent ){
++    MemPage *pParent = pPage->pParent;
++    pPage->pParent = 0;
++    sqlitepager_unref(pParent);
++  }
++}
++
++/*
++** Open a new database.
++**
++** Actually, this routine just sets up the internal data structures
++** for accessing the database.  We do not open the database file 
++** until the first page is loaded.
++**
++** zFilename is the name of the database file.  If zFilename is NULL
++** a new database with a random name is created.  This randomly named
++** database file will be deleted when sqliteBtreeClose() is called.
++*/
++int sqliteBtreeOpen(
++  const char *zFilename,    /* Name of the file containing the BTree database */
++  int omitJournal,          /* if TRUE then do not journal this file */
++  int nCache,               /* How many pages in the page cache */
++  Btree **ppBtree           /* Pointer to new Btree object written here */
++){
++  Btree *pBt;
++  int rc;
++
++  /*
++  ** The following asserts make sure that structures used by the btree are
++  ** the right size.  This is to guard against size changes that result
++  ** when compiling on a different architecture.
++  */
++  assert( sizeof(u32)==4 );
++  assert( sizeof(u16)==2 );
++  assert( sizeof(Pgno)==4 );
++  assert( sizeof(PageHdr)==8 );
++  assert( sizeof(CellHdr)==12 );
++  assert( sizeof(FreeBlk)==4 );
++  assert( sizeof(OverflowPage)==SQLITE_USABLE_SIZE );
++  assert( sizeof(FreelistInfo)==OVERFLOW_SIZE );
++  assert( sizeof(ptr)==sizeof(char*) );
++  assert( sizeof(uptr)==sizeof(ptr) );
++
++  pBt = sqliteMalloc( sizeof(*pBt) );
++  if( pBt==0 ){
++    *ppBtree = 0;
++    return SQLITE_NOMEM;
++  }
++  if( nCache<10 ) nCache = 10;
++  rc = sqlitepager_open(&pBt->pPager, zFilename, nCache, EXTRA_SIZE,
++                        !omitJournal);
++  if( rc!=SQLITE_OK ){
++    if( pBt->pPager ) sqlitepager_close(pBt->pPager);
++    sqliteFree(pBt);
++    *ppBtree = 0;
++    return rc;
++  }
++  sqlitepager_set_destructor(pBt->pPager, pageDestructor);
++  pBt->pCursor = 0;
++  pBt->page1 = 0;
++  pBt->readOnly = sqlitepager_isreadonly(pBt->pPager);
++  pBt->pOps = &sqliteBtreeOps;
++  *ppBtree = pBt;
++  return SQLITE_OK;
++}
++
++/*
++** Close an open database and invalidate all cursors.
++*/
++static int fileBtreeClose(Btree *pBt){
++  while( pBt->pCursor ){
++    fileBtreeCloseCursor(pBt->pCursor);
++  }
++  sqlitepager_close(pBt->pPager);
++  sqliteFree(pBt);
++  return SQLITE_OK;
++}
++
++/*
++** Change the limit on the number of pages allowed in the cache.
++**
++** The maximum number of cache pages is set to the absolute
++** value of mxPage.  If mxPage is negative, the pager will
++** operate asynchronously - it will not stop to do fsync()s
++** to insure data is written to the disk surface before
++** continuing.  Transactions still work if synchronous is off,
++** and the database cannot be corrupted if this program
++** crashes.  But if the operating system crashes or there is
++** an abrupt power failure when synchronous is off, the database
++** could be left in an inconsistent and unrecoverable state.
++** Synchronous is on by default so database corruption is not
++** normally a worry.
++*/
++static int fileBtreeSetCacheSize(Btree *pBt, int mxPage){
++  sqlitepager_set_cachesize(pBt->pPager, mxPage);
++  return SQLITE_OK;
++}
++
++/*
++** Change the way data is synced to disk in order to increase or decrease
++** how well the database resists damage due to OS crashes and power
++** failures.  Level 1 is the same as asynchronous (no syncs() occur and
++** there is a high probability of damage)  Level 2 is the default.  There
++** is a very low but non-zero probability of damage.  Level 3 reduces the
++** probability of damage to near zero but with a write performance reduction.
++*/
++static int fileBtreeSetSafetyLevel(Btree *pBt, int level){
++  sqlitepager_set_safety_level(pBt->pPager, level);
++  return SQLITE_OK;
++}
++
++/*
++** Get a reference to page1 of the database file.  This will
++** also acquire a readlock on that file.
++**
++** SQLITE_OK is returned on success.  If the file is not a
++** well-formed database file, then SQLITE_CORRUPT is returned.
++** SQLITE_BUSY is returned if the database is locked.  SQLITE_NOMEM
++** is returned if we run out of memory.  SQLITE_PROTOCOL is returned
++** if there is a locking protocol violation.
++*/
++static int lockBtree(Btree *pBt){
++  int rc;
++  if( pBt->page1 ) return SQLITE_OK;
++  rc = sqlitepager_get(pBt->pPager, 1, (void**)&pBt->page1);
++  if( rc!=SQLITE_OK ) return rc;
++
++  /* Do some checking to help insure the file we opened really is
++  ** a valid database file. 
++  */
++  if( sqlitepager_pagecount(pBt->pPager)>0 ){
++    PageOne *pP1 = pBt->page1;
++    if( strcmp(pP1->zMagic,zMagicHeader)!=0 ||
++          (pP1->iMagic!=MAGIC && swab32(pP1->iMagic)!=MAGIC) ){
++      rc = SQLITE_NOTADB;
++      goto page1_init_failed;
++    }
++    pBt->needSwab = pP1->iMagic!=MAGIC;
++  }
++  return rc;
++
++page1_init_failed:
++  sqlitepager_unref(pBt->page1);
++  pBt->page1 = 0;
++  return rc;
++}
++
++/*
++** If there are no outstanding cursors and we are not in the middle
++** of a transaction but there is a read lock on the database, then
++** this routine unrefs the first page of the database file which 
++** has the effect of releasing the read lock.
++**
++** If there are any outstanding cursors, this routine is a no-op.
++**
++** If there is a transaction in progress, this routine is a no-op.
++*/
++static void unlockBtreeIfUnused(Btree *pBt){
++  if( pBt->inTrans==0 && pBt->pCursor==0 && pBt->page1!=0 ){
++    sqlitepager_unref(pBt->page1);
++    pBt->page1 = 0;
++    pBt->inTrans = 0;
++    pBt->inCkpt = 0;
++  }
++}
++
++/*
++** Create a new database by initializing the first two pages of the
++** file.
++*/
++static int newDatabase(Btree *pBt){
++  MemPage *pRoot;
++  PageOne *pP1;
++  int rc;
++  if( sqlitepager_pagecount(pBt->pPager)>1 ) return SQLITE_OK;
++  pP1 = pBt->page1;
++  rc = sqlitepager_write(pBt->page1);
++  if( rc ) return rc;
++  rc = sqlitepager_get(pBt->pPager, 2, (void**)&pRoot);
++  if( rc ) return rc;
++  rc = sqlitepager_write(pRoot);
++  if( rc ){
++    sqlitepager_unref(pRoot);
++    return rc;
++  }
++  strcpy(pP1->zMagic, zMagicHeader);
++  if( btree_native_byte_order ){
++    pP1->iMagic = MAGIC;
++    pBt->needSwab = 0;
++  }else{
++    pP1->iMagic = swab32(MAGIC);
++    pBt->needSwab = 1;
++  }
++  zeroPage(pBt, pRoot);
++  sqlitepager_unref(pRoot);
++  return SQLITE_OK;
++}
++
++/*
++** Attempt to start a new transaction.
++**
++** A transaction must be started before attempting any changes
++** to the database.  None of the following routines will work
++** unless a transaction is started first:
++**
++**      sqliteBtreeCreateTable()
++**      sqliteBtreeCreateIndex()
++**      sqliteBtreeClearTable()
++**      sqliteBtreeDropTable()
++**      sqliteBtreeInsert()
++**      sqliteBtreeDelete()
++**      sqliteBtreeUpdateMeta()
++*/
++static int fileBtreeBeginTrans(Btree *pBt){
++  int rc;
++  if( pBt->inTrans ) return SQLITE_ERROR;
++  if( pBt->readOnly ) return SQLITE_READONLY;
++  if( pBt->page1==0 ){
++    rc = lockBtree(pBt);
++    if( rc!=SQLITE_OK ){
++      return rc;
++    }
++  }
++  rc = sqlitepager_begin(pBt->page1);
++  if( rc==SQLITE_OK ){
++    rc = newDatabase(pBt);
++  }
++  if( rc==SQLITE_OK ){
++    pBt->inTrans = 1;
++    pBt->inCkpt = 0;
++  }else{
++    unlockBtreeIfUnused(pBt);
++  }
++  return rc;
++}
++
++/*
++** Commit the transaction currently in progress.
++**
++** This will release the write lock on the database file.  If there
++** are no active cursors, it also releases the read lock.
++*/
++static int fileBtreeCommit(Btree *pBt){
++  int rc;
++  rc = pBt->readOnly ? SQLITE_OK : sqlitepager_commit(pBt->pPager);
++  pBt->inTrans = 0;
++  pBt->inCkpt = 0;
++  unlockBtreeIfUnused(pBt);
++  return rc;
++}
++
++/*
++** Rollback the transaction in progress.  All cursors will be
++** invalided by this operation.  Any attempt to use a cursor
++** that was open at the beginning of this operation will result
++** in an error.
++**
++** This will release the write lock on the database file.  If there
++** are no active cursors, it also releases the read lock.
++*/
++static int fileBtreeRollback(Btree *pBt){
++  int rc;
++  BtCursor *pCur;
++  if( pBt->inTrans==0 ) return SQLITE_OK;
++  pBt->inTrans = 0;
++  pBt->inCkpt = 0;
++  rc = pBt->readOnly ? SQLITE_OK : sqlitepager_rollback(pBt->pPager);
++  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
++    if( pCur->pPage && pCur->pPage->isInit==0 ){
++      sqlitepager_unref(pCur->pPage);
++      pCur->pPage = 0;
++    }
++  }
++  unlockBtreeIfUnused(pBt);
++  return rc;
++}
++
++/*
++** Set the checkpoint for the current transaction.  The checkpoint serves
++** as a sub-transaction that can be rolled back independently of the
++** main transaction.  You must start a transaction before starting a
++** checkpoint.  The checkpoint is ended automatically if the transaction
++** commits or rolls back.
++**
++** Only one checkpoint may be active at a time.  It is an error to try
++** to start a new checkpoint if another checkpoint is already active.
++*/
++static int fileBtreeBeginCkpt(Btree *pBt){
++  int rc;
++  if( !pBt->inTrans || pBt->inCkpt ){
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  rc = pBt->readOnly ? SQLITE_OK : sqlitepager_ckpt_begin(pBt->pPager);
++  pBt->inCkpt = 1;
++  return rc;
++}
++
++
++/*
++** Commit a checkpoint to transaction currently in progress.  If no
++** checkpoint is active, this is a no-op.
++*/
++static int fileBtreeCommitCkpt(Btree *pBt){
++  int rc;
++  if( pBt->inCkpt && !pBt->readOnly ){
++    rc = sqlitepager_ckpt_commit(pBt->pPager);
++  }else{
++    rc = SQLITE_OK;
++  }
++  pBt->inCkpt = 0;
++  return rc;
++}
++
++/*
++** Rollback the checkpoint to the current transaction.  If there
++** is no active checkpoint or transaction, this routine is a no-op.
++**
++** All cursors will be invalided by this operation.  Any attempt
++** to use a cursor that was open at the beginning of this operation
++** will result in an error.
++*/
++static int fileBtreeRollbackCkpt(Btree *pBt){
++  int rc;
++  BtCursor *pCur;
++  if( pBt->inCkpt==0 || pBt->readOnly ) return SQLITE_OK;
++  rc = sqlitepager_ckpt_rollback(pBt->pPager);
++  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
++    if( pCur->pPage && pCur->pPage->isInit==0 ){
++      sqlitepager_unref(pCur->pPage);
++      pCur->pPage = 0;
++    }
++  }
++  pBt->inCkpt = 0;
++  return rc;
++}
++
++/*
++** Create a new cursor for the BTree whose root is on the page
++** iTable.  The act of acquiring a cursor gets a read lock on 
++** the database file.
++**
++** If wrFlag==0, then the cursor can only be used for reading.
++** If wrFlag==1, then the cursor can be used for reading or for
++** writing if other conditions for writing are also met.  These
++** are the conditions that must be met in order for writing to
++** be allowed:
++**
++** 1:  The cursor must have been opened with wrFlag==1
++**
++** 2:  No other cursors may be open with wrFlag==0 on the same table
++**
++** 3:  The database must be writable (not on read-only media)
++**
++** 4:  There must be an active transaction.
++**
++** Condition 2 warrants further discussion.  If any cursor is opened
++** on a table with wrFlag==0, that prevents all other cursors from
++** writing to that table.  This is a kind of "read-lock".  When a cursor
++** is opened with wrFlag==0 it is guaranteed that the table will not
++** change as long as the cursor is open.  This allows the cursor to
++** do a sequential scan of the table without having to worry about
++** entries being inserted or deleted during the scan.  Cursors should
++** be opened with wrFlag==0 only if this read-lock property is needed.
++** That is to say, cursors should be opened with wrFlag==0 only if they
++** intend to use the sqliteBtreeNext() system call.  All other cursors
++** should be opened with wrFlag==1 even if they never really intend
++** to write.
++** 
++** No checking is done to make sure that page iTable really is the
++** root page of a b-tree.  If it is not, then the cursor acquired
++** will not work correctly.
++*/
++static 
++int fileBtreeCursor(Btree *pBt, int iTable, int wrFlag, BtCursor **ppCur){
++  int rc;
++  BtCursor *pCur, *pRing;
++
++  if( pBt->readOnly && wrFlag ){
++    *ppCur = 0;
++    return SQLITE_READONLY;
++  }
++  if( pBt->page1==0 ){
++    rc = lockBtree(pBt);
++    if( rc!=SQLITE_OK ){
++      *ppCur = 0;
++      return rc;
++    }
++  }
++  pCur = sqliteMalloc( sizeof(*pCur) );
++  if( pCur==0 ){
++    rc = SQLITE_NOMEM;
++    goto create_cursor_exception;
++  }
++  pCur->pgnoRoot = (Pgno)iTable;
++  rc = sqlitepager_get(pBt->pPager, pCur->pgnoRoot, (void**)&pCur->pPage);
++  if( rc!=SQLITE_OK ){
++    goto create_cursor_exception;
++  }
++  rc = initPage(pBt, pCur->pPage, pCur->pgnoRoot, 0);
++  if( rc!=SQLITE_OK ){
++    goto create_cursor_exception;
++  }
++  pCur->pOps = &sqliteBtreeCursorOps;
++  pCur->pBt = pBt;
++  pCur->wrFlag = wrFlag;
++  pCur->idx = 0;
++  pCur->eSkip = SKIP_INVALID;
++  pCur->pNext = pBt->pCursor;
++  if( pCur->pNext ){
++    pCur->pNext->pPrev = pCur;
++  }
++  pCur->pPrev = 0;
++  pRing = pBt->pCursor;
++  while( pRing && pRing->pgnoRoot!=pCur->pgnoRoot ){ pRing = pRing->pNext; }
++  if( pRing ){
++    pCur->pShared = pRing->pShared;
++    pRing->pShared = pCur;
++  }else{
++    pCur->pShared = pCur;
++  }
++  pBt->pCursor = pCur;
++  *ppCur = pCur;
++  return SQLITE_OK;
++
++create_cursor_exception:
++  *ppCur = 0;
++  if( pCur ){
++    if( pCur->pPage ) sqlitepager_unref(pCur->pPage);
++    sqliteFree(pCur);
++  }
++  unlockBtreeIfUnused(pBt);
++  return rc;
++}
++
++/*
++** Close a cursor.  The read lock on the database file is released
++** when the last cursor is closed.
++*/
++static int fileBtreeCloseCursor(BtCursor *pCur){
++  Btree *pBt = pCur->pBt;
++  if( pCur->pPrev ){
++    pCur->pPrev->pNext = pCur->pNext;
++  }else{
++    pBt->pCursor = pCur->pNext;
++  }
++  if( pCur->pNext ){
++    pCur->pNext->pPrev = pCur->pPrev;
++  }
++  if( pCur->pPage ){
++    sqlitepager_unref(pCur->pPage);
++  }
++  if( pCur->pShared!=pCur ){
++    BtCursor *pRing = pCur->pShared;
++    while( pRing->pShared!=pCur ){ pRing = pRing->pShared; }
++    pRing->pShared = pCur->pShared;
++  }
++  unlockBtreeIfUnused(pBt);
++  sqliteFree(pCur);
++  return SQLITE_OK;
++}
++
++/*
++** Make a temporary cursor by filling in the fields of pTempCur.
++** The temporary cursor is not on the cursor list for the Btree.
++*/
++static void getTempCursor(BtCursor *pCur, BtCursor *pTempCur){
++  memcpy(pTempCur, pCur, sizeof(*pCur));
++  pTempCur->pNext = 0;
++  pTempCur->pPrev = 0;
++  if( pTempCur->pPage ){
++    sqlitepager_ref(pTempCur->pPage);
++  }
++}
++
++/*
++** Delete a temporary cursor such as was made by the CreateTemporaryCursor()
++** function above.
++*/
++static void releaseTempCursor(BtCursor *pCur){
++  if( pCur->pPage ){
++    sqlitepager_unref(pCur->pPage);
++  }
++}
++
++/*
++** Set *pSize to the number of bytes of key in the entry the
++** cursor currently points to.  Always return SQLITE_OK.
++** Failure is not possible.  If the cursor is not currently
++** pointing to an entry (which can happen, for example, if
++** the database is empty) then *pSize is set to 0.
++*/
++static int fileBtreeKeySize(BtCursor *pCur, int *pSize){
++  Cell *pCell;
++  MemPage *pPage;
++
++  pPage = pCur->pPage;
++  assert( pPage!=0 );
++  if( pCur->idx >= pPage->nCell ){
++    *pSize = 0;
++  }else{
++    pCell = pPage->apCell[pCur->idx];
++    *pSize = NKEY(pCur->pBt, pCell->h);
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Read payload information from the entry that the pCur cursor is
++** pointing to.  Begin reading the payload at "offset" and read
++** a total of "amt" bytes.  Put the result in zBuf.
++**
++** This routine does not make a distinction between key and data.
++** It just reads bytes from the payload area.
++*/
++static int getPayload(BtCursor *pCur, int offset, int amt, char *zBuf){
++  char *aPayload;
++  Pgno nextPage;
++  int rc;
++  Btree *pBt = pCur->pBt;
++  assert( pCur!=0 && pCur->pPage!=0 );
++  assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
++  aPayload = pCur->pPage->apCell[pCur->idx]->aPayload;
++  if( offset<MX_LOCAL_PAYLOAD ){
++    int a = amt;
++    if( a+offset>MX_LOCAL_PAYLOAD ){
++      a = MX_LOCAL_PAYLOAD - offset;
++    }
++    memcpy(zBuf, &aPayload[offset], a);
++    if( a==amt ){
++      return SQLITE_OK;
++    }
++    offset = 0;
++    zBuf += a;
++    amt -= a;
++  }else{
++    offset -= MX_LOCAL_PAYLOAD;
++  }
++  if( amt>0 ){
++    nextPage = SWAB32(pBt, pCur->pPage->apCell[pCur->idx]->ovfl);
++  }
++  while( amt>0 && nextPage ){
++    OverflowPage *pOvfl;
++    rc = sqlitepager_get(pBt->pPager, nextPage, (void**)&pOvfl);
++    if( rc!=0 ){
++      return rc;
++    }
++    nextPage = SWAB32(pBt, pOvfl->iNext);
++    if( offset<OVERFLOW_SIZE ){
++      int a = amt;
++      if( a + offset > OVERFLOW_SIZE ){
++        a = OVERFLOW_SIZE - offset;
++      }
++      memcpy(zBuf, &pOvfl->aPayload[offset], a);
++      offset = 0;
++      amt -= a;
++      zBuf += a;
++    }else{
++      offset -= OVERFLOW_SIZE;
++    }
++    sqlitepager_unref(pOvfl);
++  }
++  if( amt>0 ){
++    return SQLITE_CORRUPT;
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Read part of the key associated with cursor pCur.  A maximum
++** of "amt" bytes will be transfered into zBuf[].  The transfer
++** begins at "offset".  The number of bytes actually read is
++** returned. 
++**
++** Change:  It used to be that the amount returned will be smaller
++** than the amount requested if there are not enough bytes in the key
++** to satisfy the request.  But now, it must be the case that there
++** is enough data available to satisfy the request.  If not, an exception
++** is raised.  The change was made in an effort to boost performance
++** by eliminating unneeded tests.
++*/
++static int fileBtreeKey(BtCursor *pCur, int offset, int amt, char *zBuf){
++  MemPage *pPage;
++
++  assert( amt>=0 );
++  assert( offset>=0 );
++  assert( pCur->pPage!=0 );
++  pPage = pCur->pPage;
++  if( pCur->idx >= pPage->nCell ){
++    return 0;
++  }
++  assert( amt+offset <= NKEY(pCur->pBt, pPage->apCell[pCur->idx]->h) );
++  getPayload(pCur, offset, amt, zBuf);
++  return amt;
++}
++
++/*
++** Set *pSize to the number of bytes of data in the entry the
++** cursor currently points to.  Always return SQLITE_OK.
++** Failure is not possible.  If the cursor is not currently
++** pointing to an entry (which can happen, for example, if
++** the database is empty) then *pSize is set to 0.
++*/
++static int fileBtreeDataSize(BtCursor *pCur, int *pSize){
++  Cell *pCell;
++  MemPage *pPage;
++
++  pPage = pCur->pPage;
++  assert( pPage!=0 );
++  if( pCur->idx >= pPage->nCell ){
++    *pSize = 0;
++  }else{
++    pCell = pPage->apCell[pCur->idx];
++    *pSize = NDATA(pCur->pBt, pCell->h);
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Read part of the data associated with cursor pCur.  A maximum
++** of "amt" bytes will be transfered into zBuf[].  The transfer
++** begins at "offset".  The number of bytes actually read is
++** returned.  The amount returned will be smaller than the
++** amount requested if there are not enough bytes in the data
++** to satisfy the request.
++*/
++static int fileBtreeData(BtCursor *pCur, int offset, int amt, char *zBuf){
++  Cell *pCell;
++  MemPage *pPage;
++
++  assert( amt>=0 );
++  assert( offset>=0 );
++  assert( pCur->pPage!=0 );
++  pPage = pCur->pPage;
++  if( pCur->idx >= pPage->nCell ){
++    return 0;
++  }
++  pCell = pPage->apCell[pCur->idx];
++  assert( amt+offset <= NDATA(pCur->pBt, pCell->h) );
++  getPayload(pCur, offset + NKEY(pCur->pBt, pCell->h), amt, zBuf);
++  return amt;
++}
++
++/*
++** Compare an external key against the key on the entry that pCur points to.
++**
++** The external key is pKey and is nKey bytes long.  The last nIgnore bytes
++** of the key associated with pCur are ignored, as if they do not exist.
++** (The normal case is for nIgnore to be zero in which case the entire
++** internal key is used in the comparison.)
++**
++** The comparison result is written to *pRes as follows:
++**
++**    *pRes<0    This means pCur<pKey
++**
++**    *pRes==0   This means pCur==pKey for all nKey bytes
++**
++**    *pRes>0    This means pCur>pKey
++**
++** When one key is an exact prefix of the other, the shorter key is
++** considered less than the longer one.  In order to be equal the
++** keys must be exactly the same length. (The length of the pCur key
++** is the actual key length minus nIgnore bytes.)
++*/
++static int fileBtreeKeyCompare(
++  BtCursor *pCur,       /* Pointer to entry to compare against */
++  const void *pKey,     /* Key to compare against entry that pCur points to */
++  int nKey,             /* Number of bytes in pKey */
++  int nIgnore,          /* Ignore this many bytes at the end of pCur */
++  int *pResult          /* Write the result here */
++){
++  Pgno nextPage;
++  int n, c, rc, nLocal;
++  Cell *pCell;
++  Btree *pBt = pCur->pBt;
++  const char *zKey  = (const char*)pKey;
++
++  assert( pCur->pPage );
++  assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
++  pCell = pCur->pPage->apCell[pCur->idx];
++  nLocal = NKEY(pBt, pCell->h) - nIgnore;
++  if( nLocal<0 ) nLocal = 0;
++  n = nKey<nLocal ? nKey : nLocal;
++  if( n>MX_LOCAL_PAYLOAD ){
++    n = MX_LOCAL_PAYLOAD;
++  }
++  c = memcmp(pCell->aPayload, zKey, n);
++  if( c!=0 ){
++    *pResult = c;
++    return SQLITE_OK;
++  }
++  zKey += n;
++  nKey -= n;
++  nLocal -= n;
++  nextPage = SWAB32(pBt, pCell->ovfl);
++  while( nKey>0 && nLocal>0 ){
++    OverflowPage *pOvfl;
++    if( nextPage==0 ){
++      return SQLITE_CORRUPT;
++    }
++    rc = sqlitepager_get(pBt->pPager, nextPage, (void**)&pOvfl);
++    if( rc ){
++      return rc;
++    }
++    nextPage = SWAB32(pBt, pOvfl->iNext);
++    n = nKey<nLocal ? nKey : nLocal;
++    if( n>OVERFLOW_SIZE ){
++      n = OVERFLOW_SIZE;
++    }
++    c = memcmp(pOvfl->aPayload, zKey, n);
++    sqlitepager_unref(pOvfl);
++    if( c!=0 ){
++      *pResult = c;
++      return SQLITE_OK;
++    }
++    nKey -= n;
++    nLocal -= n;
++    zKey += n;
++  }
++  if( c==0 ){
++    c = nLocal - nKey;
++  }
++  *pResult = c;
++  return SQLITE_OK;
++}
++
++/*
++** Move the cursor down to a new child page.  The newPgno argument is the
++** page number of the child page in the byte order of the disk image.
++*/
++static int moveToChild(BtCursor *pCur, int newPgno){
++  int rc;
++  MemPage *pNewPage;
++  Btree *pBt = pCur->pBt;
++
++  newPgno = SWAB32(pBt, newPgno);
++  rc = sqlitepager_get(pBt->pPager, newPgno, (void**)&pNewPage);
++  if( rc ) return rc;
++  rc = initPage(pBt, pNewPage, newPgno, pCur->pPage);
++  if( rc ) return rc;
++  assert( pCur->idx>=pCur->pPage->nCell
++          || pCur->pPage->apCell[pCur->idx]->h.leftChild==SWAB32(pBt,newPgno) );
++  assert( pCur->idx<pCur->pPage->nCell
++          || pCur->pPage->u.hdr.rightChild==SWAB32(pBt,newPgno) );
++  pNewPage->idxParent = pCur->idx;
++  pCur->pPage->idxShift = 0;
++  sqlitepager_unref(pCur->pPage);
++  pCur->pPage = pNewPage;
++  pCur->idx = 0;
++  if( pNewPage->nCell<1 ){
++    return SQLITE_CORRUPT;
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Move the cursor up to the parent page.
++**
++** pCur->idx is set to the cell index that contains the pointer
++** to the page we are coming from.  If we are coming from the
++** right-most child page then pCur->idx is set to one more than
++** the largest cell index.
++*/
++static void moveToParent(BtCursor *pCur){
++  Pgno oldPgno;
++  MemPage *pParent;
++  MemPage *pPage;
++  int idxParent;
++  pPage = pCur->pPage;
++  assert( pPage!=0 );
++  pParent = pPage->pParent;
++  assert( pParent!=0 );
++  idxParent = pPage->idxParent;
++  sqlitepager_ref(pParent);
++  sqlitepager_unref(pPage);
++  pCur->pPage = pParent;
++  assert( pParent->idxShift==0 );
++  if( pParent->idxShift==0 ){
++    pCur->idx = idxParent;
++#ifndef NDEBUG  
++    /* Verify that pCur->idx is the correct index to point back to the child
++    ** page we just came from 
++    */
++    oldPgno = SWAB32(pCur->pBt, sqlitepager_pagenumber(pPage));
++    if( pCur->idx<pParent->nCell ){
++      assert( pParent->apCell[idxParent]->h.leftChild==oldPgno );
++    }else{
++      assert( pParent->u.hdr.rightChild==oldPgno );
++    }
++#endif
++  }else{
++    /* The MemPage.idxShift flag indicates that cell indices might have 
++    ** changed since idxParent was set and hence idxParent might be out
++    ** of date.  So recompute the parent cell index by scanning all cells
++    ** and locating the one that points to the child we just came from.
++    */
++    int i;
++    pCur->idx = pParent->nCell;
++    oldPgno = SWAB32(pCur->pBt, sqlitepager_pagenumber(pPage));
++    for(i=0; i<pParent->nCell; i++){
++      if( pParent->apCell[i]->h.leftChild==oldPgno ){
++        pCur->idx = i;
++        break;
++      }
++    }
++  }
++}
++
++/*
++** Move the cursor to the root page
++*/
++static int moveToRoot(BtCursor *pCur){
++  MemPage *pNew;
++  int rc;
++  Btree *pBt = pCur->pBt;
++
++  rc = sqlitepager_get(pBt->pPager, pCur->pgnoRoot, (void**)&pNew);
++  if( rc ) return rc;
++  rc = initPage(pBt, pNew, pCur->pgnoRoot, 0);
++  if( rc ) return rc;
++  sqlitepager_unref(pCur->pPage);
++  pCur->pPage = pNew;
++  pCur->idx = 0;
++  return SQLITE_OK;
++}
++
++/*
++** Move the cursor down to the left-most leaf entry beneath the
++** entry to which it is currently pointing.
++*/
++static int moveToLeftmost(BtCursor *pCur){
++  Pgno pgno;
++  int rc;
++
++  while( (pgno = pCur->pPage->apCell[pCur->idx]->h.leftChild)!=0 ){
++    rc = moveToChild(pCur, pgno);
++    if( rc ) return rc;
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Move the cursor down to the right-most leaf entry beneath the
++** page to which it is currently pointing.  Notice the difference
++** between moveToLeftmost() and moveToRightmost().  moveToLeftmost()
++** finds the left-most entry beneath the *entry* whereas moveToRightmost()
++** finds the right-most entry beneath the *page*.
++*/
++static int moveToRightmost(BtCursor *pCur){
++  Pgno pgno;
++  int rc;
++
++  while( (pgno = pCur->pPage->u.hdr.rightChild)!=0 ){
++    pCur->idx = pCur->pPage->nCell;
++    rc = moveToChild(pCur, pgno);
++    if( rc ) return rc;
++  }
++  pCur->idx = pCur->pPage->nCell - 1;
++  return SQLITE_OK;
++}
++
++/* Move the cursor to the first entry in the table.  Return SQLITE_OK
++** on success.  Set *pRes to 0 if the cursor actually points to something
++** or set *pRes to 1 if the table is empty.
++*/
++static int fileBtreeFirst(BtCursor *pCur, int *pRes){
++  int rc;
++  if( pCur->pPage==0 ) return SQLITE_ABORT;
++  rc = moveToRoot(pCur);
++  if( rc ) return rc;
++  if( pCur->pPage->nCell==0 ){
++    *pRes = 1;
++    return SQLITE_OK;
++  }
++  *pRes = 0;
++  rc = moveToLeftmost(pCur);
++  pCur->eSkip = SKIP_NONE;
++  return rc;
++}
++
++/* Move the cursor to the last entry in the table.  Return SQLITE_OK
++** on success.  Set *pRes to 0 if the cursor actually points to something
++** or set *pRes to 1 if the table is empty.
++*/
++static int fileBtreeLast(BtCursor *pCur, int *pRes){
++  int rc;
++  if( pCur->pPage==0 ) return SQLITE_ABORT;
++  rc = moveToRoot(pCur);
++  if( rc ) return rc;
++  assert( pCur->pPage->isInit );
++  if( pCur->pPage->nCell==0 ){
++    *pRes = 1;
++    return SQLITE_OK;
++  }
++  *pRes = 0;
++  rc = moveToRightmost(pCur);
++  pCur->eSkip = SKIP_NONE;
++  return rc;
++}
++
++/* Move the cursor so that it points to an entry near pKey.
++** Return a success code.
++**
++** If an exact match is not found, then the cursor is always
++** left pointing at a leaf page which would hold the entry if it
++** were present.  The cursor might point to an entry that comes
++** before or after the key.
++**
++** The result of comparing the key with the entry to which the
++** cursor is left pointing is stored in pCur->iMatch.  The same
++** value is also written to *pRes if pRes!=NULL.  The meaning of
++** this value is as follows:
++**
++**     *pRes<0      The cursor is left pointing at an entry that
++**                  is smaller than pKey or if the table is empty
++**                  and the cursor is therefore left point to nothing.
++**
++**     *pRes==0     The cursor is left pointing at an entry that
++**                  exactly matches pKey.
++**
++**     *pRes>0      The cursor is left pointing at an entry that
++**                  is larger than pKey.
++*/
++static
++int fileBtreeMoveto(BtCursor *pCur, const void *pKey, int nKey, int *pRes){
++  int rc;
++  if( pCur->pPage==0 ) return SQLITE_ABORT;
++  pCur->eSkip = SKIP_NONE;
++  rc = moveToRoot(pCur);
++  if( rc ) return rc;
++  for(;;){
++    int lwr, upr;
++    Pgno chldPg;
++    MemPage *pPage = pCur->pPage;
++    int c = -1;  /* pRes return if table is empty must be -1 */
++    lwr = 0;
++    upr = pPage->nCell-1;
++    while( lwr<=upr ){
++      pCur->idx = (lwr+upr)/2;
++      rc = fileBtreeKeyCompare(pCur, pKey, nKey, 0, &c);
++      if( rc ) return rc;
++      if( c==0 ){
++        pCur->iMatch = c;
++        if( pRes ) *pRes = 0;
++        return SQLITE_OK;
++      }
++      if( c<0 ){
++        lwr = pCur->idx+1;
++      }else{
++        upr = pCur->idx-1;
++      }
++    }
++    assert( lwr==upr+1 );
++    assert( pPage->isInit );
++    if( lwr>=pPage->nCell ){
++      chldPg = pPage->u.hdr.rightChild;
++    }else{
++      chldPg = pPage->apCell[lwr]->h.leftChild;
++    }
++    if( chldPg==0 ){
++      pCur->iMatch = c;
++      if( pRes ) *pRes = c;
++      return SQLITE_OK;
++    }
++    pCur->idx = lwr;
++    rc = moveToChild(pCur, chldPg);
++    if( rc ) return rc;
++  }
++  /* NOT REACHED */
++}
++
++/*
++** Advance the cursor to the next entry in the database.  If
++** successful then set *pRes=0.  If the cursor
++** was already pointing to the last entry in the database before
++** this routine was called, then set *pRes=1.
++*/
++static int fileBtreeNext(BtCursor *pCur, int *pRes){
++  int rc;
++  MemPage *pPage = pCur->pPage;
++  assert( pRes!=0 );
++  if( pPage==0 ){
++    *pRes = 1;
++    return SQLITE_ABORT;
++  }
++  assert( pPage->isInit );
++  assert( pCur->eSkip!=SKIP_INVALID );
++  if( pPage->nCell==0 ){
++    *pRes = 1;
++    return SQLITE_OK;
++  }
++  assert( pCur->idx<pPage->nCell );
++  if( pCur->eSkip==SKIP_NEXT ){
++    pCur->eSkip = SKIP_NONE;
++    *pRes = 0;
++    return SQLITE_OK;
++  }
++  pCur->eSkip = SKIP_NONE;
++  pCur->idx++;
++  if( pCur->idx>=pPage->nCell ){
++    if( pPage->u.hdr.rightChild ){
++      rc = moveToChild(pCur, pPage->u.hdr.rightChild);
++      if( rc ) return rc;
++      rc = moveToLeftmost(pCur);
++      *pRes = 0;
++      return rc;
++    }
++    do{
++      if( pPage->pParent==0 ){
++        *pRes = 1;
++        return SQLITE_OK;
++      }
++      moveToParent(pCur);
++      pPage = pCur->pPage;
++    }while( pCur->idx>=pPage->nCell );
++    *pRes = 0;
++    return SQLITE_OK;
++  }
++  *pRes = 0;
++  if( pPage->u.hdr.rightChild==0 ){
++    return SQLITE_OK;
++  }
++  rc = moveToLeftmost(pCur);
++  return rc;
++}
++
++/*
++** Step the cursor to the back to the previous entry in the database.  If
++** successful then set *pRes=0.  If the cursor
++** was already pointing to the first entry in the database before
++** this routine was called, then set *pRes=1.
++*/
++static int fileBtreePrevious(BtCursor *pCur, int *pRes){
++  int rc;
++  Pgno pgno;
++  MemPage *pPage;
++  pPage = pCur->pPage;
++  if( pPage==0 ){
++    *pRes = 1;
++    return SQLITE_ABORT;
++  }
++  assert( pPage->isInit );
++  assert( pCur->eSkip!=SKIP_INVALID );
++  if( pPage->nCell==0 ){
++    *pRes = 1;
++    return SQLITE_OK;
++  }
++  if( pCur->eSkip==SKIP_PREV ){
++    pCur->eSkip = SKIP_NONE;
++    *pRes = 0;
++    return SQLITE_OK;
++  }
++  pCur->eSkip = SKIP_NONE;
++  assert( pCur->idx>=0 );
++  if( (pgno = pPage->apCell[pCur->idx]->h.leftChild)!=0 ){
++    rc = moveToChild(pCur, pgno);
++    if( rc ) return rc;
++    rc = moveToRightmost(pCur);
++  }else{
++    while( pCur->idx==0 ){
++      if( pPage->pParent==0 ){
++        if( pRes ) *pRes = 1;
++        return SQLITE_OK;
++      }
++      moveToParent(pCur);
++      pPage = pCur->pPage;
++    }
++    pCur->idx--;
++    rc = SQLITE_OK;
++  }
++  *pRes = 0;
++  return rc;
++}
++
++/*
++** Allocate a new page from the database file.
++**
++** The new page is marked as dirty.  (In other words, sqlitepager_write()
++** has already been called on the new page.)  The new page has also
++** been referenced and the calling routine is responsible for calling
++** sqlitepager_unref() on the new page when it is done.
++**
++** SQLITE_OK is returned on success.  Any other return value indicates
++** an error.  *ppPage and *pPgno are undefined in the event of an error.
++** Do not invoke sqlitepager_unref() on *ppPage if an error is returned.
++**
++** If the "nearby" parameter is not 0, then a (feeble) effort is made to 
++** locate a page close to the page number "nearby".  This can be used in an
++** attempt to keep related pages close to each other in the database file,
++** which in turn can make database access faster.
++*/
++static int allocatePage(Btree *pBt, MemPage **ppPage, Pgno *pPgno, Pgno nearby){
++  PageOne *pPage1 = pBt->page1;
++  int rc;
++  if( pPage1->freeList ){
++    OverflowPage *pOvfl;
++    FreelistInfo *pInfo;
++
++    rc = sqlitepager_write(pPage1);
++    if( rc ) return rc;
++    SWAB_ADD(pBt, pPage1->nFree, -1);
++    rc = sqlitepager_get(pBt->pPager, SWAB32(pBt, pPage1->freeList),
++                        (void**)&pOvfl);
++    if( rc ) return rc;
++    rc = sqlitepager_write(pOvfl);
++    if( rc ){
++      sqlitepager_unref(pOvfl);
++      return rc;
++    }
++    pInfo = (FreelistInfo*)pOvfl->aPayload;
++    if( pInfo->nFree==0 ){
++      *pPgno = SWAB32(pBt, pPage1->freeList);
++      pPage1->freeList = pOvfl->iNext;
++      *ppPage = (MemPage*)pOvfl;
++    }else{
++      int closest, n;
++      n = SWAB32(pBt, pInfo->nFree);
++      if( n>1 && nearby>0 ){
++        int i, dist;
++        closest = 0;
++        dist = SWAB32(pBt, pInfo->aFree[0]) - nearby;
++        if( dist<0 ) dist = -dist;
++        for(i=1; i<n; i++){
++          int d2 = SWAB32(pBt, pInfo->aFree[i]) - nearby;
++          if( d2<0 ) d2 = -d2;
++          if( d2<dist ) closest = i;
++        }
++      }else{
++        closest = 0;
++      }
++      SWAB_ADD(pBt, pInfo->nFree, -1);
++      *pPgno = SWAB32(pBt, pInfo->aFree[closest]);
++      pInfo->aFree[closest] = pInfo->aFree[n-1];
++      rc = sqlitepager_get(pBt->pPager, *pPgno, (void**)ppPage);
++      sqlitepager_unref(pOvfl);
++      if( rc==SQLITE_OK ){
++        sqlitepager_dont_rollback(*ppPage);
++        rc = sqlitepager_write(*ppPage);
++      }
++    }
++  }else{
++    *pPgno = sqlitepager_pagecount(pBt->pPager) + 1;
++    rc = sqlitepager_get(pBt->pPager, *pPgno, (void**)ppPage);
++    if( rc ) return rc;
++    rc = sqlitepager_write(*ppPage);
++  }
++  return rc;
++}
++
++/*
++** Add a page of the database file to the freelist.  Either pgno or
++** pPage but not both may be 0. 
++**
++** sqlitepager_unref() is NOT called for pPage.
++*/
++static int freePage(Btree *pBt, void *pPage, Pgno pgno){
++  PageOne *pPage1 = pBt->page1;
++  OverflowPage *pOvfl = (OverflowPage*)pPage;
++  int rc;
++  int needUnref = 0;
++  MemPage *pMemPage;
++
++  if( pgno==0 ){
++    assert( pOvfl!=0 );
++    pgno = sqlitepager_pagenumber(pOvfl);
++  }
++  assert( pgno>2 );
++  assert( sqlitepager_pagenumber(pOvfl)==pgno );
++  pMemPage = (MemPage*)pPage;
++  pMemPage->isInit = 0;
++  if( pMemPage->pParent ){
++    sqlitepager_unref(pMemPage->pParent);
++    pMemPage->pParent = 0;
++  }
++  rc = sqlitepager_write(pPage1);
++  if( rc ){
++    return rc;
++  }
++  SWAB_ADD(pBt, pPage1->nFree, 1);
++  if( pPage1->nFree!=0 && pPage1->freeList!=0 ){
++    OverflowPage *pFreeIdx;
++    rc = sqlitepager_get(pBt->pPager, SWAB32(pBt, pPage1->freeList),
++                        (void**)&pFreeIdx);
++    if( rc==SQLITE_OK ){
++      FreelistInfo *pInfo = (FreelistInfo*)pFreeIdx->aPayload;
++      int n = SWAB32(pBt, pInfo->nFree);
++      if( n<(sizeof(pInfo->aFree)/sizeof(pInfo->aFree[0])) ){
++        rc = sqlitepager_write(pFreeIdx);
++        if( rc==SQLITE_OK ){
++          pInfo->aFree[n] = SWAB32(pBt, pgno);
++          SWAB_ADD(pBt, pInfo->nFree, 1);
++          sqlitepager_unref(pFreeIdx);
++          sqlitepager_dont_write(pBt->pPager, pgno);
++          return rc;
++        }
++      }
++      sqlitepager_unref(pFreeIdx);
++    }
++  }
++  if( pOvfl==0 ){
++    assert( pgno>0 );
++    rc = sqlitepager_get(pBt->pPager, pgno, (void**)&pOvfl);
++    if( rc ) return rc;
++    needUnref = 1;
++  }
++  rc = sqlitepager_write(pOvfl);
++  if( rc ){
++    if( needUnref ) sqlitepager_unref(pOvfl);
++    return rc;
++  }
++  pOvfl->iNext = pPage1->freeList;
++  pPage1->freeList = SWAB32(pBt, pgno);
++  memset(pOvfl->aPayload, 0, OVERFLOW_SIZE);
++  if( needUnref ) rc = sqlitepager_unref(pOvfl);
++  return rc;
++}
++
++/*
++** Erase all the data out of a cell.  This involves returning overflow
++** pages back the freelist.
++*/
++static int clearCell(Btree *pBt, Cell *pCell){
++  Pager *pPager = pBt->pPager;
++  OverflowPage *pOvfl;
++  Pgno ovfl, nextOvfl;
++  int rc;
++
++  if( NKEY(pBt, pCell->h) + NDATA(pBt, pCell->h) <= MX_LOCAL_PAYLOAD ){
++    return SQLITE_OK;
++  }
++  ovfl = SWAB32(pBt, pCell->ovfl);
++  pCell->ovfl = 0;
++  while( ovfl ){
++    rc = sqlitepager_get(pPager, ovfl, (void**)&pOvfl);
++    if( rc ) return rc;
++    nextOvfl = SWAB32(pBt, pOvfl->iNext);
++    rc = freePage(pBt, pOvfl, ovfl);
++    if( rc ) return rc;
++    sqlitepager_unref(pOvfl);
++    ovfl = nextOvfl;
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Create a new cell from key and data.  Overflow pages are allocated as
++** necessary and linked to this cell.  
++*/
++static int fillInCell(
++  Btree *pBt,              /* The whole Btree.  Needed to allocate pages */
++  Cell *pCell,             /* Populate this Cell structure */
++  const void *pKey, int nKey,    /* The key */
++  const void *pData,int nData    /* The data */
++){
++  OverflowPage *pOvfl, *pPrior;
++  Pgno *pNext;
++  int spaceLeft;
++  int n, rc;
++  int nPayload;
++  const char *pPayload;
++  char *pSpace;
++  Pgno nearby = 0;
++
++  pCell->h.leftChild = 0;
++  pCell->h.nKey = SWAB16(pBt, nKey & 0xffff);
++  pCell->h.nKeyHi = nKey >> 16;
++  pCell->h.nData = SWAB16(pBt, nData & 0xffff);
++  pCell->h.nDataHi = nData >> 16;
++  pCell->h.iNext = 0;
++
++  pNext = &pCell->ovfl;
++  pSpace = pCell->aPayload;
++  spaceLeft = MX_LOCAL_PAYLOAD;
++  pPayload = pKey;
++  pKey = 0;
++  nPayload = nKey;
++  pPrior = 0;
++  while( nPayload>0 ){
++    if( spaceLeft==0 ){
++      rc = allocatePage(pBt, (MemPage**)&pOvfl, pNext, nearby);
++      if( rc ){
++        *pNext = 0;
++      }else{
++        nearby = *pNext;
++      }
++      if( pPrior ) sqlitepager_unref(pPrior);
++      if( rc ){
++        clearCell(pBt, pCell);
++        return rc;
++      }
++      if( pBt->needSwab ) *pNext = swab32(*pNext);
++      pPrior = pOvfl;
++      spaceLeft = OVERFLOW_SIZE;
++      pSpace = pOvfl->aPayload;
++      pNext = &pOvfl->iNext;
++    }
++    n = nPayload;
++    if( n>spaceLeft ) n = spaceLeft;
++    memcpy(pSpace, pPayload, n);
++    nPayload -= n;
++    if( nPayload==0 && pData ){
++      pPayload = pData;
++      nPayload = nData;
++      pData = 0;
++    }else{
++      pPayload += n;
++    }
++    spaceLeft -= n;
++    pSpace += n;
++  }
++  *pNext = 0;
++  if( pPrior ){
++    sqlitepager_unref(pPrior);
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Change the MemPage.pParent pointer on the page whose number is
++** given in the second argument so that MemPage.pParent holds the
++** pointer in the third argument.
++*/
++static void reparentPage(Pager *pPager, Pgno pgno, MemPage *pNewParent,int idx){
++  MemPage *pThis;
++
++  if( pgno==0 ) return;
++  assert( pPager!=0 );
++  pThis = sqlitepager_lookup(pPager, pgno);
++  if( pThis && pThis->isInit ){
++    if( pThis->pParent!=pNewParent ){
++      if( pThis->pParent ) sqlitepager_unref(pThis->pParent);
++      pThis->pParent = pNewParent;
++      if( pNewParent ) sqlitepager_ref(pNewParent);
++    }
++    pThis->idxParent = idx;
++    sqlitepager_unref(pThis);
++  }
++}
++
++/*
++** Reparent all children of the given page to be the given page.
++** In other words, for every child of pPage, invoke reparentPage()
++** to make sure that each child knows that pPage is its parent.
++**
++** This routine gets called after you memcpy() one page into
++** another.
++*/
++static void reparentChildPages(Btree *pBt, MemPage *pPage){
++  int i;
++  Pager *pPager = pBt->pPager;
++  for(i=0; i<pPage->nCell; i++){
++    reparentPage(pPager, SWAB32(pBt, pPage->apCell[i]->h.leftChild), pPage, i);
++  }
++  reparentPage(pPager, SWAB32(pBt, pPage->u.hdr.rightChild), pPage, i);
++  pPage->idxShift = 0;
++}
++
++/*
++** Remove the i-th cell from pPage.  This routine effects pPage only.
++** The cell content is not freed or deallocated.  It is assumed that
++** the cell content has been copied someplace else.  This routine just
++** removes the reference to the cell from pPage.
++**
++** "sz" must be the number of bytes in the cell.
++**
++** Do not bother maintaining the integrity of the linked list of Cells.
++** Only the pPage->apCell[] array is important.  The relinkCellList() 
++** routine will be called soon after this routine in order to rebuild 
++** the linked list.
++*/
++static void dropCell(Btree *pBt, MemPage *pPage, int idx, int sz){
++  int j;
++  assert( idx>=0 && idx<pPage->nCell );
++  assert( sz==cellSize(pBt, pPage->apCell[idx]) );
++  assert( sqlitepager_iswriteable(pPage) );
++  freeSpace(pBt, pPage, Addr(pPage->apCell[idx]) - Addr(pPage), sz);
++  for(j=idx; j<pPage->nCell-1; j++){
++    pPage->apCell[j] = pPage->apCell[j+1];
++  }
++  pPage->nCell--;
++  pPage->idxShift = 1;
++}
++
++/*
++** Insert a new cell on pPage at cell index "i".  pCell points to the
++** content of the cell.
++**
++** If the cell content will fit on the page, then put it there.  If it
++** will not fit, then just make pPage->apCell[i] point to the content
++** and set pPage->isOverfull.  
++**
++** Do not bother maintaining the integrity of the linked list of Cells.
++** Only the pPage->apCell[] array is important.  The relinkCellList() 
++** routine will be called soon after this routine in order to rebuild 
++** the linked list.
++*/
++static void insertCell(Btree *pBt, MemPage *pPage, int i, Cell *pCell, int sz){
++  int idx, j;
++  assert( i>=0 && i<=pPage->nCell );
++  assert( sz==cellSize(pBt, pCell) );
++  assert( sqlitepager_iswriteable(pPage) );
++  idx = allocateSpace(pBt, pPage, sz);
++  for(j=pPage->nCell; j>i; j--){
++    pPage->apCell[j] = pPage->apCell[j-1];
++  }
++  pPage->nCell++;
++  if( idx<=0 ){
++    pPage->isOverfull = 1;
++    pPage->apCell[i] = pCell;
++  }else{
++    memcpy(&pPage->u.aDisk[idx], pCell, sz);
++    pPage->apCell[i] = (Cell*)&pPage->u.aDisk[idx];
++  }
++  pPage->idxShift = 1;
++}
++
++/*
++** Rebuild the linked list of cells on a page so that the cells
++** occur in the order specified by the pPage->apCell[] array.  
++** Invoke this routine once to repair damage after one or more
++** invocations of either insertCell() or dropCell().
++*/
++static void relinkCellList(Btree *pBt, MemPage *pPage){
++  int i;
++  u16 *pIdx;
++  assert( sqlitepager_iswriteable(pPage) );
++  pIdx = &pPage->u.hdr.firstCell;
++  for(i=0; i<pPage->nCell; i++){
++    int idx = Addr(pPage->apCell[i]) - Addr(pPage);
++    assert( idx>0 && idx<SQLITE_USABLE_SIZE );
++    *pIdx = SWAB16(pBt, idx);
++    pIdx = &pPage->apCell[i]->h.iNext;
++  }
++  *pIdx = 0;
++}
++
++/*
++** Make a copy of the contents of pFrom into pTo.  The pFrom->apCell[]
++** pointers that point into pFrom->u.aDisk[] must be adjusted to point
++** into pTo->u.aDisk[] instead.  But some pFrom->apCell[] entries might
++** not point to pFrom->u.aDisk[].  Those are unchanged.
++*/
++static void copyPage(MemPage *pTo, MemPage *pFrom){
++  uptr from, to;
++  int i;
++  memcpy(pTo->u.aDisk, pFrom->u.aDisk, SQLITE_USABLE_SIZE);
++  pTo->pParent = 0;
++  pTo->isInit = 1;
++  pTo->nCell = pFrom->nCell;
++  pTo->nFree = pFrom->nFree;
++  pTo->isOverfull = pFrom->isOverfull;
++  to = Addr(pTo);
++  from = Addr(pFrom);
++  for(i=0; i<pTo->nCell; i++){
++    uptr x = Addr(pFrom->apCell[i]);
++    if( x>from && x<from+SQLITE_USABLE_SIZE ){
++      *((uptr*)&pTo->apCell[i]) = x + to - from;
++    }else{
++      pTo->apCell[i] = pFrom->apCell[i];
++    }
++  }
++}
++
++/*
++** The following parameters determine how many adjacent pages get involved
++** in a balancing operation.  NN is the number of neighbors on either side
++** of the page that participate in the balancing operation.  NB is the
++** total number of pages that participate, including the target page and
++** NN neighbors on either side.
++**
++** The minimum value of NN is 1 (of course).  Increasing NN above 1
++** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance
++** in exchange for a larger degradation in INSERT and UPDATE performance.
++** The value of NN appears to give the best results overall.
++*/
++#define NN 1             /* Number of neighbors on either side of pPage */
++#define NB (NN*2+1)      /* Total pages involved in the balance */
++
++/*
++** This routine redistributes Cells on pPage and up to two siblings
++** of pPage so that all pages have about the same amount of free space.
++** Usually one sibling on either side of pPage is used in the balancing,
++** though both siblings might come from one side if pPage is the first
++** or last child of its parent.  If pPage has fewer than two siblings
++** (something which can only happen if pPage is the root page or a 
++** child of root) then all available siblings participate in the balancing.
++**
++** The number of siblings of pPage might be increased or decreased by
++** one in an effort to keep pages between 66% and 100% full. The root page
++** is special and is allowed to be less than 66% full. If pPage is 
++** the root page, then the depth of the tree might be increased
++** or decreased by one, as necessary, to keep the root page from being
++** overfull or empty.
++**
++** This routine calls relinkCellList() on its input page regardless of
++** whether or not it does any real balancing.  Client routines will typically
++** invoke insertCell() or dropCell() before calling this routine, so we
++** need to call relinkCellList() to clean up the mess that those other
++** routines left behind.
++**
++** pCur is left pointing to the same cell as when this routine was called
++** even if that cell gets moved to a different page.  pCur may be NULL.
++** Set the pCur parameter to NULL if you do not care about keeping track
++** of a cell as that will save this routine the work of keeping track of it.
++**
++** Note that when this routine is called, some of the Cells on pPage
++** might not actually be stored in pPage->u.aDisk[].  This can happen
++** if the page is overfull.  Part of the job of this routine is to
++** make sure all Cells for pPage once again fit in pPage->u.aDisk[].
++**
++** In the course of balancing the siblings of pPage, the parent of pPage
++** might become overfull or underfull.  If that happens, then this routine
++** is called recursively on the parent.
++**
++** If this routine fails for any reason, it might leave the database
++** in a corrupted state.  So if this routine fails, the database should
++** be rolled back.
++*/
++static int balance(Btree *pBt, MemPage *pPage, BtCursor *pCur){
++  MemPage *pParent;            /* The parent of pPage */
++  int nCell;                   /* Number of cells in apCell[] */
++  int nOld;                    /* Number of pages in apOld[] */
++  int nNew;                    /* Number of pages in apNew[] */
++  int nDiv;                    /* Number of cells in apDiv[] */
++  int i, j, k;                 /* Loop counters */
++  int idx;                     /* Index of pPage in pParent->apCell[] */
++  int nxDiv;                   /* Next divider slot in pParent->apCell[] */
++  int rc;                      /* The return code */
++  int iCur;                    /* apCell[iCur] is the cell of the cursor */
++  MemPage *pOldCurPage;        /* The cursor originally points to this page */
++  int subtotal;                /* Subtotal of bytes in cells on one page */
++  MemPage *extraUnref = 0;     /* A page that needs to be unref-ed */
++  MemPage *apOld[NB];          /* pPage and up to two siblings */
++  Pgno pgnoOld[NB];            /* Page numbers for each page in apOld[] */
++  MemPage *apNew[NB+1];        /* pPage and up to NB siblings after balancing */
++  Pgno pgnoNew[NB+1];          /* Page numbers for each page in apNew[] */
++  int idxDiv[NB];              /* Indices of divider cells in pParent */
++  Cell *apDiv[NB];             /* Divider cells in pParent */
++  Cell aTemp[NB];              /* Temporary holding area for apDiv[] */
++  int cntNew[NB+1];            /* Index in apCell[] of cell after i-th page */
++  int szNew[NB+1];             /* Combined size of cells place on i-th page */
++  MemPage aOld[NB];            /* Temporary copies of pPage and its siblings */
++  Cell *apCell[(MX_CELL+2)*NB]; /* All cells from pages being balanced */
++  int szCell[(MX_CELL+2)*NB];  /* Local size of all cells */
++
++  /* 
++  ** Return without doing any work if pPage is neither overfull nor
++  ** underfull.
++  */
++  assert( sqlitepager_iswriteable(pPage) );
++  if( !pPage->isOverfull && pPage->nFree<SQLITE_USABLE_SIZE/2 
++        && pPage->nCell>=2){
++    relinkCellList(pBt, pPage);
++    return SQLITE_OK;
++  }
++
++  /*
++  ** Find the parent of the page to be balanceed.
++  ** If there is no parent, it means this page is the root page and
++  ** special rules apply.
++  */
++  pParent = pPage->pParent;
++  if( pParent==0 ){
++    Pgno pgnoChild;
++    MemPage *pChild;
++    assert( pPage->isInit );
++    if( pPage->nCell==0 ){
++      if( pPage->u.hdr.rightChild ){
++        /*
++        ** The root page is empty.  Copy the one child page
++        ** into the root page and return.  This reduces the depth
++        ** of the BTree by one.
++        */
++        pgnoChild = SWAB32(pBt, pPage->u.hdr.rightChild);
++        rc = sqlitepager_get(pBt->pPager, pgnoChild, (void**)&pChild);
++        if( rc ) return rc;
++        memcpy(pPage, pChild, SQLITE_USABLE_SIZE);
++        pPage->isInit = 0;
++        rc = initPage(pBt, pPage, sqlitepager_pagenumber(pPage), 0);
++        assert( rc==SQLITE_OK );
++        reparentChildPages(pBt, pPage);
++        if( pCur && pCur->pPage==pChild ){
++          sqlitepager_unref(pChild);
++          pCur->pPage = pPage;
++          sqlitepager_ref(pPage);
++        }
++        freePage(pBt, pChild, pgnoChild);
++        sqlitepager_unref(pChild);
++      }else{
++        relinkCellList(pBt, pPage);
++      }
++      return SQLITE_OK;
++    }
++    if( !pPage->isOverfull ){
++      /* It is OK for the root page to be less than half full.
++      */
++      relinkCellList(pBt, pPage);
++      return SQLITE_OK;
++    }
++    /*
++    ** If we get to here, it means the root page is overfull.
++    ** When this happens, Create a new child page and copy the
++    ** contents of the root into the child.  Then make the root
++    ** page an empty page with rightChild pointing to the new
++    ** child.  Then fall thru to the code below which will cause
++    ** the overfull child page to be split.
++    */
++    rc = sqlitepager_write(pPage);
++    if( rc ) return rc;
++    rc = allocatePage(pBt, &pChild, &pgnoChild, sqlitepager_pagenumber(pPage));
++    if( rc ) return rc;
++    assert( sqlitepager_iswriteable(pChild) );
++    copyPage(pChild, pPage);
++    pChild->pParent = pPage;
++    pChild->idxParent = 0;
++    sqlitepager_ref(pPage);
++    pChild->isOverfull = 1;
++    if( pCur && pCur->pPage==pPage ){
++      sqlitepager_unref(pPage);
++      pCur->pPage = pChild;
++    }else{
++      extraUnref = pChild;
++    }
++    zeroPage(pBt, pPage);
++    pPage->u.hdr.rightChild = SWAB32(pBt, pgnoChild);
++    pParent = pPage;
++    pPage = pChild;
++  }
++  rc = sqlitepager_write(pParent);
++  if( rc ) return rc;
++  assert( pParent->isInit );
++  
++  /*
++  ** Find the Cell in the parent page whose h.leftChild points back
++  ** to pPage.  The "idx" variable is the index of that cell.  If pPage
++  ** is the rightmost child of pParent then set idx to pParent->nCell 
++  */
++  if( pParent->idxShift ){
++    Pgno pgno, swabPgno;
++    pgno = sqlitepager_pagenumber(pPage);
++    swabPgno = SWAB32(pBt, pgno);
++    for(idx=0; idx<pParent->nCell; idx++){
++      if( pParent->apCell[idx]->h.leftChild==swabPgno ){
++        break;
++      }
++    }
++    assert( idx<pParent->nCell || pParent->u.hdr.rightChild==swabPgno );
++  }else{
++    idx = pPage->idxParent;
++  }
++
++  /*
++  ** Initialize variables so that it will be safe to jump
++  ** directly to balance_cleanup at any moment.
++  */
++  nOld = nNew = 0;
++  sqlitepager_ref(pParent);
++
++  /*
++  ** Find sibling pages to pPage and the Cells in pParent that divide
++  ** the siblings.  An attempt is made to find NN siblings on either
++  ** side of pPage.  More siblings are taken from one side, however, if
++  ** pPage there are fewer than NN siblings on the other side.  If pParent
++  ** has NB or fewer children then all children of pParent are taken.
++  */
++  nxDiv = idx - NN;
++  if( nxDiv + NB > pParent->nCell ){
++    nxDiv = pParent->nCell - NB + 1;
++  }
++  if( nxDiv<0 ){
++    nxDiv = 0;
++  }
++  nDiv = 0;
++  for(i=0, k=nxDiv; i<NB; i++, k++){
++    if( k<pParent->nCell ){
++      idxDiv[i] = k;
++      apDiv[i] = pParent->apCell[k];
++      nDiv++;
++      pgnoOld[i] = SWAB32(pBt, apDiv[i]->h.leftChild);
++    }else if( k==pParent->nCell ){
++      pgnoOld[i] = SWAB32(pBt, pParent->u.hdr.rightChild);
++    }else{
++      break;
++    }
++    rc = sqlitepager_get(pBt->pPager, pgnoOld[i], (void**)&apOld[i]);
++    if( rc ) goto balance_cleanup;
++    rc = initPage(pBt, apOld[i], pgnoOld[i], pParent);
++    if( rc ) goto balance_cleanup;
++    apOld[i]->idxParent = k;
++    nOld++;
++  }
++
++  /*
++  ** Set iCur to be the index in apCell[] of the cell that the cursor
++  ** is pointing to.  We will need this later on in order to keep the
++  ** cursor pointing at the same cell.  If pCur points to a page that
++  ** has no involvement with this rebalancing, then set iCur to a large
++  ** number so that the iCur==j tests always fail in the main cell
++  ** distribution loop below.
++  */
++  if( pCur ){
++    iCur = 0;
++    for(i=0; i<nOld; i++){
++      if( pCur->pPage==apOld[i] ){
++        iCur += pCur->idx;
++        break;
++      }
++      iCur += apOld[i]->nCell;
++      if( i<nOld-1 && pCur->pPage==pParent && pCur->idx==idxDiv[i] ){
++        break;
++      }
++      iCur++;
++    }
++    pOldCurPage = pCur->pPage;
++  }
++
++  /*
++  ** Make copies of the content of pPage and its siblings into aOld[].
++  ** The rest of this function will use data from the copies rather
++  ** that the original pages since the original pages will be in the
++  ** process of being overwritten.
++  */
++  for(i=0; i<nOld; i++){
++    copyPage(&aOld[i], apOld[i]);
++  }
++
++  /*
++  ** Load pointers to all cells on sibling pages and the divider cells
++  ** into the local apCell[] array.  Make copies of the divider cells
++  ** into aTemp[] and remove the the divider Cells from pParent.
++  */
++  nCell = 0;
++  for(i=0; i<nOld; i++){
++    MemPage *pOld = &aOld[i];
++    for(j=0; j<pOld->nCell; j++){
++      apCell[nCell] = pOld->apCell[j];
++      szCell[nCell] = cellSize(pBt, apCell[nCell]);
++      nCell++;
++    }
++    if( i<nOld-1 ){
++      szCell[nCell] = cellSize(pBt, apDiv[i]);
++      memcpy(&aTemp[i], apDiv[i], szCell[nCell]);
++      apCell[nCell] = &aTemp[i];
++      dropCell(pBt, pParent, nxDiv, szCell[nCell]);
++      assert( SWAB32(pBt, apCell[nCell]->h.leftChild)==pgnoOld[i] );
++      apCell[nCell]->h.leftChild = pOld->u.hdr.rightChild;
++      nCell++;
++    }
++  }
++
++  /*
++  ** Figure out the number of pages needed to hold all nCell cells.
++  ** Store this number in "k".  Also compute szNew[] which is the total
++  ** size of all cells on the i-th page and cntNew[] which is the index
++  ** in apCell[] of the cell that divides path i from path i+1.  
++  ** cntNew[k] should equal nCell.
++  **
++  ** This little patch of code is critical for keeping the tree
++  ** balanced. 
++  */
++  for(subtotal=k=i=0; i<nCell; i++){
++    subtotal += szCell[i];
++    if( subtotal > USABLE_SPACE ){
++      szNew[k] = subtotal - szCell[i];
++      cntNew[k] = i;
++      subtotal = 0;
++      k++;
++    }
++  }
++  szNew[k] = subtotal;
++  cntNew[k] = nCell;
++  k++;
++  for(i=k-1; i>0; i--){
++    while( szNew[i]<USABLE_SPACE/2 ){
++      cntNew[i-1]--;
++      assert( cntNew[i-1]>0 );
++      szNew[i] += szCell[cntNew[i-1]];
++      szNew[i-1] -= szCell[cntNew[i-1]-1];
++    }
++  }
++  assert( cntNew[0]>0 );
++
++  /*
++  ** Allocate k new pages.  Reuse old pages where possible.
++  */
++  for(i=0; i<k; i++){
++    if( i<nOld ){
++      apNew[i] = apOld[i];
++      pgnoNew[i] = pgnoOld[i];
++      apOld[i] = 0;
++      sqlitepager_write(apNew[i]);
++    }else{
++      rc = allocatePage(pBt, &apNew[i], &pgnoNew[i], pgnoNew[i-1]);
++      if( rc ) goto balance_cleanup;
++    }
++    nNew++;
++    zeroPage(pBt, apNew[i]);
++    apNew[i]->isInit = 1;
++  }
++
++  /* Free any old pages that were not reused as new pages.
++  */
++  while( i<nOld ){
++    rc = freePage(pBt, apOld[i], pgnoOld[i]);
++    if( rc ) goto balance_cleanup;
++    sqlitepager_unref(apOld[i]);
++    apOld[i] = 0;
++    i++;
++  }
++
++  /*
++  ** Put the new pages in accending order.  This helps to
++  ** keep entries in the disk file in order so that a scan
++  ** of the table is a linear scan through the file.  That
++  ** in turn helps the operating system to deliver pages
++  ** from the disk more rapidly.
++  **
++  ** An O(n^2) insertion sort algorithm is used, but since
++  ** n is never more than NB (a small constant), that should
++  ** not be a problem.
++  **
++  ** When NB==3, this one optimization makes the database
++  ** about 25% faster for large insertions and deletions.
++  */
++  for(i=0; i<k-1; i++){
++    int minV = pgnoNew[i];
++    int minI = i;
++    for(j=i+1; j<k; j++){
++      if( pgnoNew[j]<(unsigned)minV ){
++        minI = j;
++        minV = pgnoNew[j];
++      }
++    }
++    if( minI>i ){
++      int t;
++      MemPage *pT;
++      t = pgnoNew[i];
++      pT = apNew[i];
++      pgnoNew[i] = pgnoNew[minI];
++      apNew[i] = apNew[minI];
++      pgnoNew[minI] = t;
++      apNew[minI] = pT;
++    }
++  }
++
++  /*
++  ** Evenly distribute the data in apCell[] across the new pages.
++  ** Insert divider cells into pParent as necessary.
++  */
++  j = 0;
++  for(i=0; i<nNew; i++){
++    MemPage *pNew = apNew[i];
++    while( j<cntNew[i] ){
++      assert( pNew->nFree>=szCell[j] );
++      if( pCur && iCur==j ){ pCur->pPage = pNew; pCur->idx = pNew->nCell; }
++      insertCell(pBt, pNew, pNew->nCell, apCell[j], szCell[j]);
++      j++;
++    }
++    assert( pNew->nCell>0 );
++    assert( !pNew->isOverfull );
++    relinkCellList(pBt, pNew);
++    if( i<nNew-1 && j<nCell ){
++      pNew->u.hdr.rightChild = apCell[j]->h.leftChild;
++      apCell[j]->h.leftChild = SWAB32(pBt, pgnoNew[i]);
++      if( pCur && iCur==j ){ pCur->pPage = pParent; pCur->idx = nxDiv; }
++      insertCell(pBt, pParent, nxDiv, apCell[j], szCell[j]);
++      j++;
++      nxDiv++;
++    }
++  }
++  assert( j==nCell );
++  apNew[nNew-1]->u.hdr.rightChild = aOld[nOld-1].u.hdr.rightChild;
++  if( nxDiv==pParent->nCell ){
++    pParent->u.hdr.rightChild = SWAB32(pBt, pgnoNew[nNew-1]);
++  }else{
++    pParent->apCell[nxDiv]->h.leftChild = SWAB32(pBt, pgnoNew[nNew-1]);
++  }
++  if( pCur ){
++    if( j<=iCur && pCur->pPage==pParent && pCur->idx>idxDiv[nOld-1] ){
++      assert( pCur->pPage==pOldCurPage );
++      pCur->idx += nNew - nOld;
++    }else{
++      assert( pOldCurPage!=0 );
++      sqlitepager_ref(pCur->pPage);
++      sqlitepager_unref(pOldCurPage);
++    }
++  }
++
++  /*
++  ** Reparent children of all cells.
++  */
++  for(i=0; i<nNew; i++){
++    reparentChildPages(pBt, apNew[i]);
++  }
++  reparentChildPages(pBt, pParent);
++
++  /*
++  ** balance the parent page.
++  */
++  rc = balance(pBt, pParent, pCur);
++
++  /*
++  ** Cleanup before returning.
++  */
++balance_cleanup:
++  if( extraUnref ){
++    sqlitepager_unref(extraUnref);
++  }
++  for(i=0; i<nOld; i++){
++    if( apOld[i]!=0 && apOld[i]!=&aOld[i] ) sqlitepager_unref(apOld[i]);
++  }
++  for(i=0; i<nNew; i++){
++    sqlitepager_unref(apNew[i]);
++  }
++  if( pCur && pCur->pPage==0 ){
++    pCur->pPage = pParent;
++    pCur->idx = 0;
++  }else{
++    sqlitepager_unref(pParent);
++  }
++  return rc;
++}
++
++/*
++** This routine checks all cursors that point to the same table
++** as pCur points to.  If any of those cursors were opened with
++** wrFlag==0 then this routine returns SQLITE_LOCKED.  If all
++** cursors point to the same table were opened with wrFlag==1
++** then this routine returns SQLITE_OK.
++**
++** In addition to checking for read-locks (where a read-lock 
++** means a cursor opened with wrFlag==0) this routine also moves
++** all cursors other than pCur so that they are pointing to the 
++** first Cell on root page.  This is necessary because an insert 
++** or delete might change the number of cells on a page or delete
++** a page entirely and we do not want to leave any cursors 
++** pointing to non-existant pages or cells.
++*/
++static int checkReadLocks(BtCursor *pCur){
++  BtCursor *p;
++  assert( pCur->wrFlag );
++  for(p=pCur->pShared; p!=pCur; p=p->pShared){
++    assert( p );
++    assert( p->pgnoRoot==pCur->pgnoRoot );
++    if( p->wrFlag==0 ) return SQLITE_LOCKED;
++    if( sqlitepager_pagenumber(p->pPage)!=p->pgnoRoot ){
++      moveToRoot(p);
++    }
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Insert a new record into the BTree.  The key is given by (pKey,nKey)
++** and the data is given by (pData,nData).  The cursor is used only to
++** define what database the record should be inserted into.  The cursor
++** is left pointing at the new record.
++*/
++static int fileBtreeInsert(
++  BtCursor *pCur,                /* Insert data into the table of this cursor */
++  const void *pKey, int nKey,    /* The key of the new record */
++  const void *pData, int nData   /* The data of the new record */
++){
++  Cell newCell;
++  int rc;
++  int loc;
++  int szNew;
++  MemPage *pPage;
++  Btree *pBt = pCur->pBt;
++
++  if( pCur->pPage==0 ){
++    return SQLITE_ABORT;  /* A rollback destroyed this cursor */
++  }
++  if( !pBt->inTrans || nKey+nData==0 ){
++    /* Must start a transaction before doing an insert */
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  assert( !pBt->readOnly );
++  if( !pCur->wrFlag ){
++    return SQLITE_PERM;   /* Cursor not open for writing */
++  }
++  if( checkReadLocks(pCur) ){
++    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
++  }
++  rc = fileBtreeMoveto(pCur, pKey, nKey, &loc);
++  if( rc ) return rc;
++  pPage = pCur->pPage;
++  assert( pPage->isInit );
++  rc = sqlitepager_write(pPage);
++  if( rc ) return rc;
++  rc = fillInCell(pBt, &newCell, pKey, nKey, pData, nData);
++  if( rc ) return rc;
++  szNew = cellSize(pBt, &newCell);
++  if( loc==0 ){
++    newCell.h.leftChild = pPage->apCell[pCur->idx]->h.leftChild;
++    rc = clearCell(pBt, pPage->apCell[pCur->idx]);
++    if( rc ) return rc;
++    dropCell(pBt, pPage, pCur->idx, cellSize(pBt, pPage->apCell[pCur->idx]));
++  }else if( loc<0 && pPage->nCell>0 ){
++    assert( pPage->u.hdr.rightChild==0 );  /* Must be a leaf page */
++    pCur->idx++;
++  }else{
++    assert( pPage->u.hdr.rightChild==0 );  /* Must be a leaf page */
++  }
++  insertCell(pBt, pPage, pCur->idx, &newCell, szNew);
++  rc = balance(pCur->pBt, pPage, pCur);
++  /* sqliteBtreePageDump(pCur->pBt, pCur->pgnoRoot, 1); */
++  /* fflush(stdout); */
++  pCur->eSkip = SKIP_INVALID;
++  return rc;
++}
++
++/*
++** Delete the entry that the cursor is pointing to.
++**
++** The cursor is left pointing at either the next or the previous
++** entry.  If the cursor is left pointing to the next entry, then 
++** the pCur->eSkip flag is set to SKIP_NEXT which forces the next call to 
++** sqliteBtreeNext() to be a no-op.  That way, you can always call
++** sqliteBtreeNext() after a delete and the cursor will be left
++** pointing to the first entry after the deleted entry.  Similarly,
++** pCur->eSkip is set to SKIP_PREV is the cursor is left pointing to
++** the entry prior to the deleted entry so that a subsequent call to
++** sqliteBtreePrevious() will always leave the cursor pointing at the
++** entry immediately before the one that was deleted.
++*/
++static int fileBtreeDelete(BtCursor *pCur){
++  MemPage *pPage = pCur->pPage;
++  Cell *pCell;
++  int rc;
++  Pgno pgnoChild;
++  Btree *pBt = pCur->pBt;
++
++  assert( pPage->isInit );
++  if( pCur->pPage==0 ){
++    return SQLITE_ABORT;  /* A rollback destroyed this cursor */
++  }
++  if( !pBt->inTrans ){
++    /* Must start a transaction before doing a delete */
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  assert( !pBt->readOnly );
++  if( pCur->idx >= pPage->nCell ){
++    return SQLITE_ERROR;  /* The cursor is not pointing to anything */
++  }
++  if( !pCur->wrFlag ){
++    return SQLITE_PERM;   /* Did not open this cursor for writing */
++  }
++  if( checkReadLocks(pCur) ){
++    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
++  }
++  rc = sqlitepager_write(pPage);
++  if( rc ) return rc;
++  pCell = pPage->apCell[pCur->idx];
++  pgnoChild = SWAB32(pBt, pCell->h.leftChild);
++  clearCell(pBt, pCell);
++  if( pgnoChild ){
++    /*
++    ** The entry we are about to delete is not a leaf so if we do not
++    ** do something we will leave a hole on an internal page.
++    ** We have to fill the hole by moving in a cell from a leaf.  The
++    ** next Cell after the one to be deleted is guaranteed to exist and
++    ** to be a leaf so we can use it.
++    */
++    BtCursor leafCur;
++    Cell *pNext;
++    int szNext;
++    int notUsed;
++    getTempCursor(pCur, &leafCur);
++    rc = fileBtreeNext(&leafCur, &notUsed);
++    if( rc!=SQLITE_OK ){
++      if( rc!=SQLITE_NOMEM ) rc = SQLITE_CORRUPT;
++      return rc;
++    }
++    rc = sqlitepager_write(leafCur.pPage);
++    if( rc ) return rc;
++    dropCell(pBt, pPage, pCur->idx, cellSize(pBt, pCell));
++    pNext = leafCur.pPage->apCell[leafCur.idx];
++    szNext = cellSize(pBt, pNext);
++    pNext->h.leftChild = SWAB32(pBt, pgnoChild);
++    insertCell(pBt, pPage, pCur->idx, pNext, szNext);
++    rc = balance(pBt, pPage, pCur);
++    if( rc ) return rc;
++    pCur->eSkip = SKIP_NEXT;
++    dropCell(pBt, leafCur.pPage, leafCur.idx, szNext);
++    rc = balance(pBt, leafCur.pPage, pCur);
++    releaseTempCursor(&leafCur);
++  }else{
++    dropCell(pBt, pPage, pCur->idx, cellSize(pBt, pCell));
++    if( pCur->idx>=pPage->nCell ){
++      pCur->idx = pPage->nCell-1;
++      if( pCur->idx<0 ){ 
++        pCur->idx = 0;
++        pCur->eSkip = SKIP_NEXT;
++      }else{
++        pCur->eSkip = SKIP_PREV;
++      }
++    }else{
++      pCur->eSkip = SKIP_NEXT;
++    }
++    rc = balance(pBt, pPage, pCur);
++  }
++  return rc;
++}
++
++/*
++** Create a new BTree table.  Write into *piTable the page
++** number for the root page of the new table.
++**
++** In the current implementation, BTree tables and BTree indices are the 
++** the same.  In the future, we may change this so that BTree tables
++** are restricted to having a 4-byte integer key and arbitrary data and
++** BTree indices are restricted to having an arbitrary key and no data.
++** But for now, this routine also serves to create indices.
++*/
++static int fileBtreeCreateTable(Btree *pBt, int *piTable){
++  MemPage *pRoot;
++  Pgno pgnoRoot;
++  int rc;
++  if( !pBt->inTrans ){
++    /* Must start a transaction first */
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  if( pBt->readOnly ){
++    return SQLITE_READONLY;
++  }
++  rc = allocatePage(pBt, &pRoot, &pgnoRoot, 0);
++  if( rc ) return rc;
++  assert( sqlitepager_iswriteable(pRoot) );
++  zeroPage(pBt, pRoot);
++  sqlitepager_unref(pRoot);
++  *piTable = (int)pgnoRoot;
++  return SQLITE_OK;
++}
++
++/*
++** Erase the given database page and all its children.  Return
++** the page to the freelist.
++*/
++static int clearDatabasePage(Btree *pBt, Pgno pgno, int freePageFlag){
++  MemPage *pPage;
++  int rc;
++  Cell *pCell;
++  int idx;
++
++  rc = sqlitepager_get(pBt->pPager, pgno, (void**)&pPage);
++  if( rc ) return rc;
++  rc = sqlitepager_write(pPage);
++  if( rc ) return rc;
++  rc = initPage(pBt, pPage, pgno, 0);
++  if( rc ) return rc;
++  idx = SWAB16(pBt, pPage->u.hdr.firstCell);
++  while( idx>0 ){
++    pCell = (Cell*)&pPage->u.aDisk[idx];
++    idx = SWAB16(pBt, pCell->h.iNext);
++    if( pCell->h.leftChild ){
++      rc = clearDatabasePage(pBt, SWAB32(pBt, pCell->h.leftChild), 1);
++      if( rc ) return rc;
++    }
++    rc = clearCell(pBt, pCell);
++    if( rc ) return rc;
++  }
++  if( pPage->u.hdr.rightChild ){
++    rc = clearDatabasePage(pBt, SWAB32(pBt, pPage->u.hdr.rightChild), 1);
++    if( rc ) return rc;
++  }
++  if( freePageFlag ){
++    rc = freePage(pBt, pPage, pgno);
++  }else{
++    zeroPage(pBt, pPage);
++  }
++  sqlitepager_unref(pPage);
++  return rc;
++}
++
++/*
++** Delete all information from a single table in the database.
++*/
++static int fileBtreeClearTable(Btree *pBt, int iTable){
++  int rc;
++  BtCursor *pCur;
++  if( !pBt->inTrans ){
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
++    if( pCur->pgnoRoot==(Pgno)iTable ){
++      if( pCur->wrFlag==0 ) return SQLITE_LOCKED;
++      moveToRoot(pCur);
++    }
++  }
++  rc = clearDatabasePage(pBt, (Pgno)iTable, 0);
++  if( rc ){
++    fileBtreeRollback(pBt);
++  }
++  return rc;
++}
++
++/*
++** Erase all information in a table and add the root of the table to
++** the freelist.  Except, the root of the principle table (the one on
++** page 2) is never added to the freelist.
++*/
++static int fileBtreeDropTable(Btree *pBt, int iTable){
++  int rc;
++  MemPage *pPage;
++  BtCursor *pCur;
++  if( !pBt->inTrans ){
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
++    if( pCur->pgnoRoot==(Pgno)iTable ){
++      return SQLITE_LOCKED;  /* Cannot drop a table that has a cursor */
++    }
++  }
++  rc = sqlitepager_get(pBt->pPager, (Pgno)iTable, (void**)&pPage);
++  if( rc ) return rc;
++  rc = fileBtreeClearTable(pBt, iTable);
++  if( rc ) return rc;
++  if( iTable>2 ){
++    rc = freePage(pBt, pPage, iTable);
++  }else{
++    zeroPage(pBt, pPage);
++  }
++  sqlitepager_unref(pPage);
++  return rc;  
++}
++
++#if 0 /* UNTESTED */
++/*
++** Copy all cell data from one database file into another.
++** pages back the freelist.
++*/
++static int copyCell(Btree *pBtFrom, BTree *pBtTo, Cell *pCell){
++  Pager *pFromPager = pBtFrom->pPager;
++  OverflowPage *pOvfl;
++  Pgno ovfl, nextOvfl;
++  Pgno *pPrev;
++  int rc = SQLITE_OK;
++  MemPage *pNew, *pPrevPg;
++  Pgno new;
++
++  if( NKEY(pBtTo, pCell->h) + NDATA(pBtTo, pCell->h) <= MX_LOCAL_PAYLOAD ){
++    return SQLITE_OK;
++  }
++  pPrev = &pCell->ovfl;
++  pPrevPg = 0;
++  ovfl = SWAB32(pBtTo, pCell->ovfl);
++  while( ovfl && rc==SQLITE_OK ){
++    rc = sqlitepager_get(pFromPager, ovfl, (void**)&pOvfl);
++    if( rc ) return rc;
++    nextOvfl = SWAB32(pBtFrom, pOvfl->iNext);
++    rc = allocatePage(pBtTo, &pNew, &new, 0);
++    if( rc==SQLITE_OK ){
++      rc = sqlitepager_write(pNew);
++      if( rc==SQLITE_OK ){
++        memcpy(pNew, pOvfl, SQLITE_USABLE_SIZE);
++        *pPrev = SWAB32(pBtTo, new);
++        if( pPrevPg ){
++          sqlitepager_unref(pPrevPg);
++        }
++        pPrev = &pOvfl->iNext;
++        pPrevPg = pNew;
++      }
++    }
++    sqlitepager_unref(pOvfl);
++    ovfl = nextOvfl;
++  }
++  if( pPrevPg ){
++    sqlitepager_unref(pPrevPg);
++  }
++  return rc;
++}
++#endif
++
++
++#if 0 /* UNTESTED */
++/*
++** Copy a page of data from one database over to another.
++*/
++static int copyDatabasePage(
++  Btree *pBtFrom,
++  Pgno pgnoFrom,
++  Btree *pBtTo,
++  Pgno *pTo
++){
++  MemPage *pPageFrom, *pPage;
++  Pgno to;
++  int rc;
++  Cell *pCell;
++  int idx;
++
++  rc = sqlitepager_get(pBtFrom->pPager, pgno, (void**)&pPageFrom);
++  if( rc ) return rc;
++  rc = allocatePage(pBt, &pPage, pTo, 0);
++  if( rc==SQLITE_OK ){
++    rc = sqlitepager_write(pPage);
++  }
++  if( rc==SQLITE_OK ){
++    memcpy(pPage, pPageFrom, SQLITE_USABLE_SIZE);
++    idx = SWAB16(pBt, pPage->u.hdr.firstCell);
++    while( idx>0 ){
++      pCell = (Cell*)&pPage->u.aDisk[idx];
++      idx = SWAB16(pBt, pCell->h.iNext);
++      if( pCell->h.leftChild ){
++        Pgno newChld;
++        rc = copyDatabasePage(pBtFrom, SWAB32(pBtFrom, pCell->h.leftChild),
++                              pBtTo, &newChld);
++        if( rc ) return rc;
++        pCell->h.leftChild = SWAB32(pBtFrom, newChld);
++      }
++      rc = copyCell(pBtFrom, pBtTo, pCell);
++      if( rc ) return rc;
++    }
++    if( pPage->u.hdr.rightChild ){
++      Pgno newChld;
++      rc = copyDatabasePage(pBtFrom, SWAB32(pBtFrom, pPage->u.hdr.rightChild), 
++                            pBtTo, &newChld);
++      if( rc ) return rc;
++      pPage->u.hdr.rightChild = SWAB32(pBtTo, newChild);
++    }
++  }
++  sqlitepager_unref(pPage);
++  return rc;
++}
++#endif
++
++/*
++** Read the meta-information out of a database file.
++*/
++static int fileBtreeGetMeta(Btree *pBt, int *aMeta){
++  PageOne *pP1;
++  int rc;
++  int i;
++
++  rc = sqlitepager_get(pBt->pPager, 1, (void**)&pP1);
++  if( rc ) return rc;
++  aMeta[0] = SWAB32(pBt, pP1->nFree);
++  for(i=0; i<sizeof(pP1->aMeta)/sizeof(pP1->aMeta[0]); i++){
++    aMeta[i+1] = SWAB32(pBt, pP1->aMeta[i]);
++  }
++  sqlitepager_unref(pP1);
++  return SQLITE_OK;
++}
++
++/*
++** Write meta-information back into the database.
++*/
++static int fileBtreeUpdateMeta(Btree *pBt, int *aMeta){
++  PageOne *pP1;
++  int rc, i;
++  if( !pBt->inTrans ){
++    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
++  }
++  pP1 = pBt->page1;
++  rc = sqlitepager_write(pP1);
++  if( rc ) return rc;   
++  for(i=0; i<sizeof(pP1->aMeta)/sizeof(pP1->aMeta[0]); i++){
++    pP1->aMeta[i] = SWAB32(pBt, aMeta[i+1]);
++  }
++  return SQLITE_OK;
++}
++
++/******************************************************************************
++** The complete implementation of the BTree subsystem is above this line.
++** All the code the follows is for testing and troubleshooting the BTree
++** subsystem.  None of the code that follows is used during normal operation.
++******************************************************************************/
++
++/*
++** Print a disassembly of the given page on standard output.  This routine
++** is used for debugging and testing only.
++*/
++#ifdef SQLITE_TEST
++static int fileBtreePageDump(Btree *pBt, int pgno, int recursive){
++  int rc;
++  MemPage *pPage;
++  int i, j;
++  int nFree;
++  u16 idx;
++  char range[20];
++  unsigned char payload[20];
++  rc = sqlitepager_get(pBt->pPager, (Pgno)pgno, (void**)&pPage);
++  if( rc ){
++    return rc;
++  }
++  if( recursive ) printf("PAGE %d:\n", pgno);
++  i = 0;
++  idx = SWAB16(pBt, pPage->u.hdr.firstCell);
++  while( idx>0 && idx<=SQLITE_USABLE_SIZE-MIN_CELL_SIZE ){
++    Cell *pCell = (Cell*)&pPage->u.aDisk[idx];
++    int sz = cellSize(pBt, pCell);
++    sprintf(range,"%d..%d", idx, idx+sz-1);
++    sz = NKEY(pBt, pCell->h) + NDATA(pBt, pCell->h);
++    if( sz>sizeof(payload)-1 ) sz = sizeof(payload)-1;
++    memcpy(payload, pCell->aPayload, sz);
++    for(j=0; j<sz; j++){
++      if( payload[j]<0x20 || payload[j]>0x7f ) payload[j] = '.';
++    }
++    payload[sz] = 0;
++    printf(
++      "cell %2d: i=%-10s chld=%-4d nk=%-4d nd=%-4d payload=%s\n",
++      i, range, (int)pCell->h.leftChild, 
++      NKEY(pBt, pCell->h), NDATA(pBt, pCell->h),
++      payload
++    );
++    if( pPage->isInit && pPage->apCell[i]!=pCell ){
++      printf("**** apCell[%d] does not match on prior entry ****\n", i);
++    }
++    i++;
++    idx = SWAB16(pBt, pCell->h.iNext);
++  }
++  if( idx!=0 ){
++    printf("ERROR: next cell index out of range: %d\n", idx);
++  }
++  printf("right_child: %d\n", SWAB32(pBt, pPage->u.hdr.rightChild));
++  nFree = 0;
++  i = 0;
++  idx = SWAB16(pBt, pPage->u.hdr.firstFree);
++  while( idx>0 && idx<SQLITE_USABLE_SIZE ){
++    FreeBlk *p = (FreeBlk*)&pPage->u.aDisk[idx];
++    sprintf(range,"%d..%d", idx, idx+p->iSize-1);
++    nFree += SWAB16(pBt, p->iSize);
++    printf("freeblock %2d: i=%-10s size=%-4d total=%d\n",
++       i, range, SWAB16(pBt, p->iSize), nFree);
++    idx = SWAB16(pBt, p->iNext);
++    i++;
++  }
++  if( idx!=0 ){
++    printf("ERROR: next freeblock index out of range: %d\n", idx);
++  }
++  if( recursive && pPage->u.hdr.rightChild!=0 ){
++    idx = SWAB16(pBt, pPage->u.hdr.firstCell);
++    while( idx>0 && idx<SQLITE_USABLE_SIZE-MIN_CELL_SIZE ){
++      Cell *pCell = (Cell*)&pPage->u.aDisk[idx];
++      fileBtreePageDump(pBt, SWAB32(pBt, pCell->h.leftChild), 1);
++      idx = SWAB16(pBt, pCell->h.iNext);
++    }
++    fileBtreePageDump(pBt, SWAB32(pBt, pPage->u.hdr.rightChild), 1);
++  }
++  sqlitepager_unref(pPage);
++  return SQLITE_OK;
++}
++#endif
++
++#ifdef SQLITE_TEST
++/*
++** Fill aResult[] with information about the entry and page that the
++** cursor is pointing to.
++** 
++**   aResult[0] =  The page number
++**   aResult[1] =  The entry number
++**   aResult[2] =  Total number of entries on this page
++**   aResult[3] =  Size of this entry
++**   aResult[4] =  Number of free bytes on this page
++**   aResult[5] =  Number of free blocks on the page
++**   aResult[6] =  Page number of the left child of this entry
++**   aResult[7] =  Page number of the right child for the whole page
++**
++** This routine is used for testing and debugging only.
++*/
++static int fileBtreeCursorDump(BtCursor *pCur, int *aResult){
++  int cnt, idx;
++  MemPage *pPage = pCur->pPage;
++  Btree *pBt = pCur->pBt;
++  aResult[0] = sqlitepager_pagenumber(pPage);
++  aResult[1] = pCur->idx;
++  aResult[2] = pPage->nCell;
++  if( pCur->idx>=0 && pCur->idx<pPage->nCell ){
++    aResult[3] = cellSize(pBt, pPage->apCell[pCur->idx]);
++    aResult[6] = SWAB32(pBt, pPage->apCell[pCur->idx]->h.leftChild);
++  }else{
++    aResult[3] = 0;
++    aResult[6] = 0;
++  }
++  aResult[4] = pPage->nFree;
++  cnt = 0;
++  idx = SWAB16(pBt, pPage->u.hdr.firstFree);
++  while( idx>0 && idx<SQLITE_USABLE_SIZE ){
++    cnt++;
++    idx = SWAB16(pBt, ((FreeBlk*)&pPage->u.aDisk[idx])->iNext);
++  }
++  aResult[5] = cnt;
++  aResult[7] = SWAB32(pBt, pPage->u.hdr.rightChild);
++  return SQLITE_OK;
++}
++#endif
++
++/*
++** Return the pager associated with a BTree.  This routine is used for
++** testing and debugging only.
++*/
++static Pager *fileBtreePager(Btree *pBt){
++  return pBt->pPager;
++}
++
++/*
++** This structure is passed around through all the sanity checking routines
++** in order to keep track of some global state information.
++*/
++typedef struct IntegrityCk IntegrityCk;
++struct IntegrityCk {
++  Btree *pBt;    /* The tree being checked out */
++  Pager *pPager; /* The associated pager.  Also accessible by pBt->pPager */
++  int nPage;     /* Number of pages in the database */
++  int *anRef;    /* Number of times each page is referenced */
++  char *zErrMsg; /* An error message.  NULL of no errors seen. */
++};
++
++/*
++** Append a message to the error message string.
++*/
++static void checkAppendMsg(IntegrityCk *pCheck, char *zMsg1, char *zMsg2){
++  if( pCheck->zErrMsg ){
++    char *zOld = pCheck->zErrMsg;
++    pCheck->zErrMsg = 0;
++    sqliteSetString(&pCheck->zErrMsg, zOld, "\n", zMsg1, zMsg2, (char*)0);
++    sqliteFree(zOld);
++  }else{
++    sqliteSetString(&pCheck->zErrMsg, zMsg1, zMsg2, (char*)0);
++  }
++}
++
++/*
++** Add 1 to the reference count for page iPage.  If this is the second
++** reference to the page, add an error message to pCheck->zErrMsg.
++** Return 1 if there are 2 ore more references to the page and 0 if
++** if this is the first reference to the page.
++**
++** Also check that the page number is in bounds.
++*/
++static int checkRef(IntegrityCk *pCheck, int iPage, char *zContext){
++  if( iPage==0 ) return 1;
++  if( iPage>pCheck->nPage || iPage<0 ){
++    char zBuf[100];
++    sprintf(zBuf, "invalid page number %d", iPage);
++    checkAppendMsg(pCheck, zContext, zBuf);
++    return 1;
++  }
++  if( pCheck->anRef[iPage]==1 ){
++    char zBuf[100];
++    sprintf(zBuf, "2nd reference to page %d", iPage);
++    checkAppendMsg(pCheck, zContext, zBuf);
++    return 1;
++  }
++  return  (pCheck->anRef[iPage]++)>1;
++}
++
++/*
++** Check the integrity of the freelist or of an overflow page list.
++** Verify that the number of pages on the list is N.
++*/
++static void checkList(
++  IntegrityCk *pCheck,  /* Integrity checking context */
++  int isFreeList,       /* True for a freelist.  False for overflow page list */
++  int iPage,            /* Page number for first page in the list */
++  int N,                /* Expected number of pages in the list */
++  char *zContext        /* Context for error messages */
++){
++  int i;
++  char zMsg[100];
++  while( N-- > 0 ){
++    OverflowPage *pOvfl;
++    if( iPage<1 ){
++      sprintf(zMsg, "%d pages missing from overflow list", N+1);
++      checkAppendMsg(pCheck, zContext, zMsg);
++      break;
++    }
++    if( checkRef(pCheck, iPage, zContext) ) break;
++    if( sqlitepager_get(pCheck->pPager, (Pgno)iPage, (void**)&pOvfl) ){
++      sprintf(zMsg, "failed to get page %d", iPage);
++      checkAppendMsg(pCheck, zContext, zMsg);
++      break;
++    }
++    if( isFreeList ){
++      FreelistInfo *pInfo = (FreelistInfo*)pOvfl->aPayload;
++      int n = SWAB32(pCheck->pBt, pInfo->nFree);
++      for(i=0; i<n; i++){
++        checkRef(pCheck, SWAB32(pCheck->pBt, pInfo->aFree[i]), zContext);
++      }
++      N -= n;
++    }
++    iPage = SWAB32(pCheck->pBt, pOvfl->iNext);
++    sqlitepager_unref(pOvfl);
++  }
++}
++
++/*
++** Return negative if zKey1<zKey2.
++** Return zero if zKey1==zKey2.
++** Return positive if zKey1>zKey2.
++*/
++static int keyCompare(
++  const char *zKey1, int nKey1,
++  const char *zKey2, int nKey2
++){
++  int min = nKey1>nKey2 ? nKey2 : nKey1;
++  int c = memcmp(zKey1, zKey2, min);
++  if( c==0 ){
++    c = nKey1 - nKey2;
++  }
++  return c;
++}
++
++/*
++** Do various sanity checks on a single page of a tree.  Return
++** the tree depth.  Root pages return 0.  Parents of root pages
++** return 1, and so forth.
++** 
++** These checks are done:
++**
++**      1.  Make sure that cells and freeblocks do not overlap
++**          but combine to completely cover the page.
++**      2.  Make sure cell keys are in order.
++**      3.  Make sure no key is less than or equal to zLowerBound.
++**      4.  Make sure no key is greater than or equal to zUpperBound.
++**      5.  Check the integrity of overflow pages.
++**      6.  Recursively call checkTreePage on all children.
++**      7.  Verify that the depth of all children is the same.
++**      8.  Make sure this page is at least 33% full or else it is
++**          the root of the tree.
++*/
++static int checkTreePage(
++  IntegrityCk *pCheck,  /* Context for the sanity check */
++  int iPage,            /* Page number of the page to check */
++  MemPage *pParent,     /* Parent page */
++  char *zParentContext, /* Parent context */
++  char *zLowerBound,    /* All keys should be greater than this, if not NULL */
++  int nLower,           /* Number of characters in zLowerBound */
++  char *zUpperBound,    /* All keys should be less than this, if not NULL */
++  int nUpper            /* Number of characters in zUpperBound */
++){
++  MemPage *pPage;
++  int i, rc, depth, d2, pgno;
++  char *zKey1, *zKey2;
++  int nKey1, nKey2;
++  BtCursor cur;
++  Btree *pBt;
++  char zMsg[100];
++  char zContext[100];
++  char hit[SQLITE_USABLE_SIZE];
++
++  /* Check that the page exists
++  */
++  cur.pBt = pBt = pCheck->pBt;
++  if( iPage==0 ) return 0;
++  if( checkRef(pCheck, iPage, zParentContext) ) return 0;
++  sprintf(zContext, "On tree page %d: ", iPage);
++  if( (rc = sqlitepager_get(pCheck->pPager, (Pgno)iPage, (void**)&pPage))!=0 ){
++    sprintf(zMsg, "unable to get the page. error code=%d", rc);
++    checkAppendMsg(pCheck, zContext, zMsg);
++    return 0;
++  }
++  if( (rc = initPage(pBt, pPage, (Pgno)iPage, pParent))!=0 ){
++    sprintf(zMsg, "initPage() returns error code %d", rc);
++    checkAppendMsg(pCheck, zContext, zMsg);
++    sqlitepager_unref(pPage);
++    return 0;
++  }
++
++  /* Check out all the cells.
++  */
++  depth = 0;
++  if( zLowerBound ){
++    zKey1 = sqliteMalloc( nLower+1 );
++    memcpy(zKey1, zLowerBound, nLower);
++    zKey1[nLower] = 0;
++  }else{
++    zKey1 = 0;
++  }
++  nKey1 = nLower;
++  cur.pPage = pPage;
++  for(i=0; i<pPage->nCell; i++){
++    Cell *pCell = pPage->apCell[i];
++    int sz;
++
++    /* Check payload overflow pages
++    */
++    nKey2 = NKEY(pBt, pCell->h);
++    sz = nKey2 + NDATA(pBt, pCell->h);
++    sprintf(zContext, "On page %d cell %d: ", iPage, i);
++    if( sz>MX_LOCAL_PAYLOAD ){
++      int nPage = (sz - MX_LOCAL_PAYLOAD + OVERFLOW_SIZE - 1)/OVERFLOW_SIZE;
++      checkList(pCheck, 0, SWAB32(pBt, pCell->ovfl), nPage, zContext);
++    }
++
++    /* Check that keys are in the right order
++    */
++    cur.idx = i;
++    zKey2 = sqliteMallocRaw( nKey2+1 );
++    getPayload(&cur, 0, nKey2, zKey2);
++    if( zKey1 && keyCompare(zKey1, nKey1, zKey2, nKey2)>=0 ){
++      checkAppendMsg(pCheck, zContext, "Key is out of order");
++    }
++
++    /* Check sanity of left child page.
++    */
++    pgno = SWAB32(pBt, pCell->h.leftChild);
++    d2 = checkTreePage(pCheck, pgno, pPage, zContext, zKey1,nKey1,zKey2,nKey2);
++    if( i>0 && d2!=depth ){
++      checkAppendMsg(pCheck, zContext, "Child page depth differs");
++    }
++    depth = d2;
++    sqliteFree(zKey1);
++    zKey1 = zKey2;
++    nKey1 = nKey2;
++  }
++  pgno = SWAB32(pBt, pPage->u.hdr.rightChild);
++  sprintf(zContext, "On page %d at right child: ", iPage);
++  checkTreePage(pCheck, pgno, pPage, zContext, zKey1,nKey1,zUpperBound,nUpper);
++  sqliteFree(zKey1);
++ 
++  /* Check for complete coverage of the page
++  */
++  memset(hit, 0, sizeof(hit));
++  memset(hit, 1, sizeof(PageHdr));
++  for(i=SWAB16(pBt, pPage->u.hdr.firstCell); i>0 && i<SQLITE_USABLE_SIZE; ){
++    Cell *pCell = (Cell*)&pPage->u.aDisk[i];
++    int j;
++    for(j=i+cellSize(pBt, pCell)-1; j>=i; j--) hit[j]++;
++    i = SWAB16(pBt, pCell->h.iNext);
++  }
++  for(i=SWAB16(pBt,pPage->u.hdr.firstFree); i>0 && i<SQLITE_USABLE_SIZE; ){
++    FreeBlk *pFBlk = (FreeBlk*)&pPage->u.aDisk[i];
++    int j;
++    for(j=i+SWAB16(pBt,pFBlk->iSize)-1; j>=i; j--) hit[j]++;
++    i = SWAB16(pBt,pFBlk->iNext);
++  }
++  for(i=0; i<SQLITE_USABLE_SIZE; i++){
++    if( hit[i]==0 ){
++      sprintf(zMsg, "Unused space at byte %d of page %d", i, iPage);
++      checkAppendMsg(pCheck, zMsg, 0);
++      break;
++    }else if( hit[i]>1 ){
++      sprintf(zMsg, "Multiple uses for byte %d of page %d", i, iPage);
++      checkAppendMsg(pCheck, zMsg, 0);
++      break;
++    }
++  }
++
++  /* Check that free space is kept to a minimum
++  */
++#if 0
++  if( pParent && pParent->nCell>2 && pPage->nFree>3*SQLITE_USABLE_SIZE/4 ){
++    sprintf(zMsg, "free space (%d) greater than max (%d)", pPage->nFree,
++       SQLITE_USABLE_SIZE/3);
++    checkAppendMsg(pCheck, zContext, zMsg);
++  }
++#endif
++
++  sqlitepager_unref(pPage);
++  return depth;
++}
++
++/*
++** This routine does a complete check of the given BTree file.  aRoot[] is
++** an array of pages numbers were each page number is the root page of
++** a table.  nRoot is the number of entries in aRoot.
++**
++** If everything checks out, this routine returns NULL.  If something is
++** amiss, an error message is written into memory obtained from malloc()
++** and a pointer to that error message is returned.  The calling function
++** is responsible for freeing the error message when it is done.
++*/
++char *fileBtreeIntegrityCheck(Btree *pBt, int *aRoot, int nRoot){
++  int i;
++  int nRef;
++  IntegrityCk sCheck;
++
++  nRef = *sqlitepager_stats(pBt->pPager);
++  if( lockBtree(pBt)!=SQLITE_OK ){
++    return sqliteStrDup("Unable to acquire a read lock on the database");
++  }
++  sCheck.pBt = pBt;
++  sCheck.pPager = pBt->pPager;
++  sCheck.nPage = sqlitepager_pagecount(sCheck.pPager);
++  if( sCheck.nPage==0 ){
++    unlockBtreeIfUnused(pBt);
++    return 0;
++  }
++  sCheck.anRef = sqliteMallocRaw( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );
++  sCheck.anRef[1] = 1;
++  for(i=2; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }
++  sCheck.zErrMsg = 0;
++
++  /* Check the integrity of the freelist
++  */
++  checkList(&sCheck, 1, SWAB32(pBt, pBt->page1->freeList),
++            SWAB32(pBt, pBt->page1->nFree), "Main freelist: ");
++
++  /* Check all the tables.
++  */
++  for(i=0; i<nRoot; i++){
++    if( aRoot[i]==0 ) continue;
++    checkTreePage(&sCheck, aRoot[i], 0, "List of tree roots: ", 0,0,0,0);
++  }
++
++  /* Make sure every page in the file is referenced
++  */
++  for(i=1; i<=sCheck.nPage; i++){
++    if( sCheck.anRef[i]==0 ){
++      char zBuf[100];
++      sprintf(zBuf, "Page %d is never used", i);
++      checkAppendMsg(&sCheck, zBuf, 0);
++    }
++  }
++
++  /* Make sure this analysis did not leave any unref() pages
++  */
++  unlockBtreeIfUnused(pBt);
++  if( nRef != *sqlitepager_stats(pBt->pPager) ){
++    char zBuf[100];
++    sprintf(zBuf, 
++      "Outstanding page count goes from %d to %d during this analysis",
++      nRef, *sqlitepager_stats(pBt->pPager)
++    );
++    checkAppendMsg(&sCheck, zBuf, 0);
++  }
++
++  /* Clean  up and report errors.
++  */
++  sqliteFree(sCheck.anRef);
++  return sCheck.zErrMsg;
++}
++
++/*
++** Return the full pathname of the underlying database file.
++*/
++static const char *fileBtreeGetFilename(Btree *pBt){
++  assert( pBt->pPager!=0 );
++  return sqlitepager_filename(pBt->pPager);
++}
++
++/*
++** Copy the complete content of pBtFrom into pBtTo.  A transaction
++** must be active for both files.
++**
++** The size of file pBtFrom may be reduced by this operation.
++** If anything goes wrong, the transaction on pBtFrom is rolled back.
++*/
++static int fileBtreeCopyFile(Btree *pBtTo, Btree *pBtFrom){
++  int rc = SQLITE_OK;
++  Pgno i, nPage, nToPage;
++
++  if( !pBtTo->inTrans || !pBtFrom->inTrans ) return SQLITE_ERROR;
++  if( pBtTo->needSwab!=pBtFrom->needSwab ) return SQLITE_ERROR;
++  if( pBtTo->pCursor ) return SQLITE_BUSY;
++  memcpy(pBtTo->page1, pBtFrom->page1, SQLITE_USABLE_SIZE);
++  rc = sqlitepager_overwrite(pBtTo->pPager, 1, pBtFrom->page1);
++  nToPage = sqlitepager_pagecount(pBtTo->pPager);
++  nPage = sqlitepager_pagecount(pBtFrom->pPager);
++  for(i=2; rc==SQLITE_OK && i<=nPage; i++){
++    void *pPage;
++    rc = sqlitepager_get(pBtFrom->pPager, i, &pPage);
++    if( rc ) break;
++    rc = sqlitepager_overwrite(pBtTo->pPager, i, pPage);
++    if( rc ) break;
++    sqlitepager_unref(pPage);
++  }
++  for(i=nPage+1; rc==SQLITE_OK && i<=nToPage; i++){
++    void *pPage;
++    rc = sqlitepager_get(pBtTo->pPager, i, &pPage);
++    if( rc ) break;
++    rc = sqlitepager_write(pPage);
++    sqlitepager_unref(pPage);
++    sqlitepager_dont_write(pBtTo->pPager, i);
++  }
++  if( !rc && nPage<nToPage ){
++    rc = sqlitepager_truncate(pBtTo->pPager, nPage);
++  }
++  if( rc ){
++    fileBtreeRollback(pBtTo);
++  }
++  return rc;  
++}
++
++/*
++** The following tables contain pointers to all of the interface
++** routines for this implementation of the B*Tree backend.  To
++** substitute a different implemention of the backend, one has merely
++** to provide pointers to alternative functions in similar tables.
++*/
++static BtOps sqliteBtreeOps = {
++    fileBtreeClose,
++    fileBtreeSetCacheSize,
++    fileBtreeSetSafetyLevel,
++    fileBtreeBeginTrans,
++    fileBtreeCommit,
++    fileBtreeRollback,
++    fileBtreeBeginCkpt,
++    fileBtreeCommitCkpt,
++    fileBtreeRollbackCkpt,
++    fileBtreeCreateTable,
++    fileBtreeCreateTable,  /* Really sqliteBtreeCreateIndex() */
++    fileBtreeDropTable,
++    fileBtreeClearTable,
++    fileBtreeCursor,
++    fileBtreeGetMeta,
++    fileBtreeUpdateMeta,
++    fileBtreeIntegrityCheck,
++    fileBtreeGetFilename,
++    fileBtreeCopyFile,
++    fileBtreePager,
++#ifdef SQLITE_TEST
++    fileBtreePageDump,
++#endif
++};
++static BtCursorOps sqliteBtreeCursorOps = {
++    fileBtreeMoveto,
++    fileBtreeDelete,
++    fileBtreeInsert,
++    fileBtreeFirst,
++    fileBtreeLast,
++    fileBtreeNext,
++    fileBtreePrevious,
++    fileBtreeKeySize,
++    fileBtreeKey,
++    fileBtreeKeyCompare,
++    fileBtreeDataSize,
++    fileBtreeData,
++    fileBtreeCloseCursor,
++#ifdef SQLITE_TEST
++    fileBtreeCursorDump,
++#endif
++};
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/btree.h
+@@ -0,0 +1,156 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This header file defines the interface that the sqlite B-Tree file
++** subsystem.  See comments in the source code for a detailed description
++** of what each interface routine does.
++**
++** @(#) $Id$
++*/
++#ifndef _BTREE_H_
++#define _BTREE_H_
++
++/*
++** Forward declarations of structure
++*/
++typedef struct Btree Btree;
++typedef struct BtCursor BtCursor;
++typedef struct BtOps BtOps;
++typedef struct BtCursorOps BtCursorOps;
++
++
++/*
++** An instance of the following structure contains pointers to all
++** methods against an open BTree.  Alternative BTree implementations
++** (examples: file based versus in-memory) can be created by substituting
++** different methods.  Users of the BTree cannot tell the difference.
++**
++** In C++ we could do this by defining a virtual base class and then
++** creating subclasses for each different implementation.  But this is
++** C not C++ so we have to be a little more explicit.
++*/
++struct BtOps {
++    int (*Close)(Btree*);
++    int (*SetCacheSize)(Btree*, int);
++    int (*SetSafetyLevel)(Btree*, int);
++    int (*BeginTrans)(Btree*);
++    int (*Commit)(Btree*);
++    int (*Rollback)(Btree*);
++    int (*BeginCkpt)(Btree*);
++    int (*CommitCkpt)(Btree*);
++    int (*RollbackCkpt)(Btree*);
++    int (*CreateTable)(Btree*, int*);
++    int (*CreateIndex)(Btree*, int*);
++    int (*DropTable)(Btree*, int);
++    int (*ClearTable)(Btree*, int);
++    int (*Cursor)(Btree*, int iTable, int wrFlag, BtCursor **ppCur);
++    int (*GetMeta)(Btree*, int*);
++    int (*UpdateMeta)(Btree*, int*);
++    char *(*IntegrityCheck)(Btree*, int*, int);
++    const char *(*GetFilename)(Btree*);
++    int (*Copyfile)(Btree*,Btree*);
++    struct Pager *(*Pager)(Btree*);
++#ifdef SQLITE_TEST
++    int (*PageDump)(Btree*, int, int);
++#endif
++};
++
++/*
++** An instance of this structure defines all of the methods that can
++** be executed against a cursor.
++*/
++struct BtCursorOps {
++    int (*Moveto)(BtCursor*, const void *pKey, int nKey, int *pRes);
++    int (*Delete)(BtCursor*);
++    int (*Insert)(BtCursor*, const void *pKey, int nKey,
++                             const void *pData, int nData);
++    int (*First)(BtCursor*, int *pRes);
++    int (*Last)(BtCursor*, int *pRes);
++    int (*Next)(BtCursor*, int *pRes);
++    int (*Previous)(BtCursor*, int *pRes);
++    int (*KeySize)(BtCursor*, int *pSize);
++    int (*Key)(BtCursor*, int offset, int amt, char *zBuf);
++    int (*KeyCompare)(BtCursor*, const void *pKey, int nKey,
++                                 int nIgnore, int *pRes);
++    int (*DataSize)(BtCursor*, int *pSize);
++    int (*Data)(BtCursor*, int offset, int amt, char *zBuf);
++    int (*CloseCursor)(BtCursor*);
++#ifdef SQLITE_TEST
++    int (*CursorDump)(BtCursor*, int*);
++#endif
++};
++
++/*
++** The number of 4-byte "meta" values contained on the first page of each
++** database file.
++*/
++#define SQLITE_N_BTREE_META 10
++
++int sqliteBtreeOpen(const char *zFilename, int mode, int nPg, Btree **ppBtree);
++int sqliteRbtreeOpen(const char *zFilename, int mode, int nPg, Btree **ppBtree);
++
++#define btOps(pBt) (*((BtOps **)(pBt)))
++#define btCOps(pCur) (*((BtCursorOps **)(pCur)))
++
++#define sqliteBtreeClose(pBt)              (btOps(pBt)->Close(pBt))
++#define sqliteBtreeSetCacheSize(pBt, sz)   (btOps(pBt)->SetCacheSize(pBt, sz))
++#define sqliteBtreeSetSafetyLevel(pBt, sl) (btOps(pBt)->SetSafetyLevel(pBt, sl))
++#define sqliteBtreeBeginTrans(pBt)         (btOps(pBt)->BeginTrans(pBt))
++#define sqliteBtreeCommit(pBt)             (btOps(pBt)->Commit(pBt))
++#define sqliteBtreeRollback(pBt)           (btOps(pBt)->Rollback(pBt))
++#define sqliteBtreeBeginCkpt(pBt)          (btOps(pBt)->BeginCkpt(pBt))
++#define sqliteBtreeCommitCkpt(pBt)         (btOps(pBt)->CommitCkpt(pBt))
++#define sqliteBtreeRollbackCkpt(pBt)       (btOps(pBt)->RollbackCkpt(pBt))
++#define sqliteBtreeCreateTable(pBt,piTable)\
++                (btOps(pBt)->CreateTable(pBt,piTable))
++#define sqliteBtreeCreateIndex(pBt, piIndex)\
++                (btOps(pBt)->CreateIndex(pBt, piIndex))
++#define sqliteBtreeDropTable(pBt, iTable) (btOps(pBt)->DropTable(pBt, iTable))
++#define sqliteBtreeClearTable(pBt, iTable)\
++                (btOps(pBt)->ClearTable(pBt, iTable))
++#define sqliteBtreeCursor(pBt, iTable, wrFlag, ppCur)\
++                (btOps(pBt)->Cursor(pBt, iTable, wrFlag, ppCur))
++#define sqliteBtreeMoveto(pCur, pKey, nKey, pRes)\
++                (btCOps(pCur)->Moveto(pCur, pKey, nKey, pRes))
++#define sqliteBtreeDelete(pCur)           (btCOps(pCur)->Delete(pCur))
++#define sqliteBtreeInsert(pCur, pKey, nKey, pData, nData) \
++                (btCOps(pCur)->Insert(pCur, pKey, nKey, pData, nData))
++#define sqliteBtreeFirst(pCur, pRes)      (btCOps(pCur)->First(pCur, pRes))
++#define sqliteBtreeLast(pCur, pRes)       (btCOps(pCur)->Last(pCur, pRes))
++#define sqliteBtreeNext(pCur, pRes)       (btCOps(pCur)->Next(pCur, pRes))
++#define sqliteBtreePrevious(pCur, pRes)   (btCOps(pCur)->Previous(pCur, pRes))
++#define sqliteBtreeKeySize(pCur, pSize)   (btCOps(pCur)->KeySize(pCur, pSize) )
++#define sqliteBtreeKey(pCur, offset, amt, zBuf)\
++                (btCOps(pCur)->Key(pCur, offset, amt, zBuf))
++#define sqliteBtreeKeyCompare(pCur, pKey, nKey, nIgnore, pRes)\
++                (btCOps(pCur)->KeyCompare(pCur, pKey, nKey, nIgnore, pRes))
++#define sqliteBtreeDataSize(pCur, pSize)  (btCOps(pCur)->DataSize(pCur, pSize))
++#define sqliteBtreeData(pCur, offset, amt, zBuf)\
++                (btCOps(pCur)->Data(pCur, offset, amt, zBuf))
++#define sqliteBtreeCloseCursor(pCur)      (btCOps(pCur)->CloseCursor(pCur))
++#define sqliteBtreeGetMeta(pBt, aMeta)    (btOps(pBt)->GetMeta(pBt, aMeta))
++#define sqliteBtreeUpdateMeta(pBt, aMeta) (btOps(pBt)->UpdateMeta(pBt, aMeta))
++#define sqliteBtreeIntegrityCheck(pBt, aRoot, nRoot)\
++                (btOps(pBt)->IntegrityCheck(pBt, aRoot, nRoot))
++#define sqliteBtreeGetFilename(pBt)       (btOps(pBt)->GetFilename(pBt))
++#define sqliteBtreeCopyFile(pBt1, pBt2)   (btOps(pBt1)->Copyfile(pBt1, pBt2))
++#define sqliteBtreePager(pBt)             (btOps(pBt)->Pager(pBt))
++
++#ifdef SQLITE_TEST
++#define sqliteBtreePageDump(pBt, pgno, recursive)\
++                (btOps(pBt)->PageDump(pBt, pgno, recursive))
++#define sqliteBtreeCursorDump(pCur, aResult)\
++                (btCOps(pCur)->CursorDump(pCur, aResult))
++int btree_native_byte_order;
++#endif /* SQLITE_TEST */
++
++
++#endif /* _BTREE_H_ */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/btree_rb.c
+@@ -0,0 +1,1488 @@
++/*
++** 2003 Feb 4
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** $Id$
++**
++** This file implements an in-core database using Red-Black balanced
++** binary trees.
++** 
++** It was contributed to SQLite by anonymous on 2003-Feb-04 23:24:49 UTC.
++*/
++#include "btree.h"
++#include "sqliteInt.h"
++#include <assert.h>
++
++/*
++** Omit this whole file if the SQLITE_OMIT_INMEMORYDB macro is
++** defined.  This allows a lot of code to be omitted for installations
++** that do not need it.
++*/
++#ifndef SQLITE_OMIT_INMEMORYDB
++
++
++typedef struct BtRbTree BtRbTree;
++typedef struct BtRbNode BtRbNode;
++typedef struct BtRollbackOp BtRollbackOp;
++typedef struct Rbtree Rbtree;
++typedef struct RbtCursor RbtCursor;
++
++/* Forward declarations */
++static BtOps sqliteRbtreeOps;
++static BtCursorOps sqliteRbtreeCursorOps;
++
++/*
++ * During each transaction (or checkpoint), a linked-list of
++ * "rollback-operations" is accumulated. If the transaction is rolled back,
++ * then the list of operations must be executed (to restore the database to
++ * it's state before the transaction started). If the transaction is to be
++ * committed, just delete the list.
++ *
++ * Each operation is represented as follows, depending on the value of eOp:
++ *
++ * ROLLBACK_INSERT  ->  Need to insert (pKey, pData) into table iTab.
++ * ROLLBACK_DELETE  ->  Need to delete the record (pKey) into table iTab.
++ * ROLLBACK_CREATE  ->  Need to create table iTab.
++ * ROLLBACK_DROP    ->  Need to drop table iTab.
++ */
++struct BtRollbackOp {
++  u8 eOp;
++  int iTab;
++  int nKey; 
++  void *pKey;
++  int nData;
++  void *pData;
++  BtRollbackOp *pNext;
++};
++
++/*
++** Legal values for BtRollbackOp.eOp:
++*/
++#define ROLLBACK_INSERT 1 /* Insert a record */
++#define ROLLBACK_DELETE 2 /* Delete a record */
++#define ROLLBACK_CREATE 3 /* Create a table */
++#define ROLLBACK_DROP   4 /* Drop a table */
++
++struct Rbtree {
++  BtOps *pOps;    /* Function table */
++  int aMetaData[SQLITE_N_BTREE_META];
++
++  int next_idx;   /* next available table index */
++  Hash tblHash;   /* All created tables, by index */
++  u8 isAnonymous; /* True if this Rbtree is to be deleted when closed */
++  u8 eTransState; /* State of this Rbtree wrt transactions */
++
++  BtRollbackOp *pTransRollback; 
++  BtRollbackOp *pCheckRollback;
++  BtRollbackOp *pCheckRollbackTail;
++};
++
++/*
++** Legal values for Rbtree.eTransState.
++*/
++#define TRANS_NONE           0  /* No transaction is in progress */
++#define TRANS_INTRANSACTION  1  /* A transaction is in progress */
++#define TRANS_INCHECKPOINT   2  /* A checkpoint is in progress  */
++#define TRANS_ROLLBACK       3  /* We are currently rolling back a checkpoint or
++                                 * transaction. */
++
++struct RbtCursor {
++  BtCursorOps *pOps;        /* Function table */
++  Rbtree    *pRbtree;
++  BtRbTree *pTree;
++  int       iTree;          /* Index of pTree in pRbtree */
++  BtRbNode *pNode;
++  RbtCursor *pShared;       /* List of all cursors on the same Rbtree */
++  u8 eSkip;                 /* Determines if next step operation is a no-op */
++  u8 wrFlag;                /* True if this cursor is open for writing */
++};
++
++/*
++** Legal values for RbtCursor.eSkip.
++*/
++#define SKIP_NONE     0   /* Always step the cursor */
++#define SKIP_NEXT     1   /* The next sqliteRbtreeNext() is a no-op */
++#define SKIP_PREV     2   /* The next sqliteRbtreePrevious() is a no-op */
++#define SKIP_INVALID  3   /* Calls to Next() and Previous() are invalid */
++
++struct BtRbTree {
++  RbtCursor *pCursors;     /* All cursors pointing to this tree */
++  BtRbNode *pHead;         /* Head of the tree, or NULL */
++};
++
++struct BtRbNode {
++  int nKey;
++  void *pKey;
++  int nData;
++  void *pData;
++  u8 isBlack;        /* true for a black node, 0 for a red node */
++  BtRbNode *pParent; /* Nodes parent node, NULL for the tree head */
++  BtRbNode *pLeft;   /* Nodes left child, or NULL */
++  BtRbNode *pRight;  /* Nodes right child, or NULL */
++
++  int nBlackHeight;  /* Only used during the red-black integrity check */
++};
++
++/* Forward declarations */
++static int memRbtreeMoveto(
++  RbtCursor* pCur,
++  const void *pKey,
++  int nKey,
++  int *pRes
++);
++static int memRbtreeClearTable(Rbtree* tree, int n);
++static int memRbtreeNext(RbtCursor* pCur, int *pRes);
++static int memRbtreeLast(RbtCursor* pCur, int *pRes);
++static int memRbtreePrevious(RbtCursor* pCur, int *pRes);
++
++
++/*
++** This routine checks all cursors that point to the same table
++** as pCur points to.  If any of those cursors were opened with
++** wrFlag==0 then this routine returns SQLITE_LOCKED.  If all
++** cursors point to the same table were opened with wrFlag==1
++** then this routine returns SQLITE_OK.
++**
++** In addition to checking for read-locks (where a read-lock 
++** means a cursor opened with wrFlag==0) this routine also NULLs
++** out the pNode field of all other cursors.
++** This is necessary because an insert 
++** or delete might change erase the node out from under
++** another cursor.
++*/
++static int checkReadLocks(RbtCursor *pCur){
++  RbtCursor *p;
++  assert( pCur->wrFlag );
++  for(p=pCur->pTree->pCursors; p; p=p->pShared){
++    if( p!=pCur ){
++      if( p->wrFlag==0 ) return SQLITE_LOCKED;
++      p->pNode = 0;
++    }
++  }
++  return SQLITE_OK;
++}
++
++/*
++ * The key-compare function for the red-black trees. Returns as follows:
++ *
++ * (key1 < key2)             -1
++ * (key1 == key2)             0 
++ * (key1 > key2)              1
++ *
++ * Keys are compared using memcmp(). If one key is an exact prefix of the
++ * other, then the shorter key is less than the longer key.
++ */
++static int key_compare(void const*pKey1, int nKey1, void const*pKey2, int nKey2)
++{
++  int mcmp = memcmp(pKey1, pKey2, (nKey1 <= nKey2)?nKey1:nKey2);
++  if( mcmp == 0){
++    if( nKey1 == nKey2 ) return 0;
++    return ((nKey1 < nKey2)?-1:1);
++  }
++  return ((mcmp>0)?1:-1);
++}
++
++/*
++ * Perform the LEFT-rotate transformation on node X of tree pTree. This
++ * transform is part of the red-black balancing code.
++ *
++ *        |                   |
++ *        X                   Y
++ *       / \                 / \
++ *      a   Y               X   c
++ *         / \             / \
++ *        b   c           a   b
++ *
++ *      BEFORE              AFTER
++ */
++static void leftRotate(BtRbTree *pTree, BtRbNode *pX)
++{
++  BtRbNode *pY;
++  BtRbNode *pb;
++  pY = pX->pRight;
++  pb = pY->pLeft;
++
++  pY->pParent = pX->pParent;
++  if( pX->pParent ){
++    if( pX->pParent->pLeft == pX ) pX->pParent->pLeft = pY;
++    else pX->pParent->pRight = pY;
++  }
++  pY->pLeft = pX;
++  pX->pParent = pY;
++  pX->pRight = pb;
++  if( pb ) pb->pParent = pX;
++  if( pTree->pHead == pX ) pTree->pHead = pY;
++}
++
++/*
++ * Perform the RIGHT-rotate transformation on node X of tree pTree. This
++ * transform is part of the red-black balancing code.
++ *
++ *        |                   |
++ *        X                   Y
++ *       / \                 / \
++ *      Y   c               a   X
++ *     / \                     / \
++ *    a   b                   b   c
++ *
++ *      BEFORE              AFTER
++ */
++static void rightRotate(BtRbTree *pTree, BtRbNode *pX)
++{
++  BtRbNode *pY;
++  BtRbNode *pb;
++  pY = pX->pLeft;
++  pb = pY->pRight;
++
++  pY->pParent = pX->pParent;
++  if( pX->pParent ){
++    if( pX->pParent->pLeft == pX ) pX->pParent->pLeft = pY;
++    else pX->pParent->pRight = pY;
++  }
++  pY->pRight = pX;
++  pX->pParent = pY;
++  pX->pLeft = pb;
++  if( pb ) pb->pParent = pX;
++  if( pTree->pHead == pX ) pTree->pHead = pY;
++}
++
++/*
++ * A string-manipulation helper function for check_redblack_tree(). If (orig ==
++ * NULL) a copy of val is returned. If (orig != NULL) then a copy of the *
++ * concatenation of orig and val is returned. The original orig is deleted
++ * (using sqliteFree()).
++ */
++static char *append_val(char * orig, char const * val){
++  char *z;
++  if( !orig ){
++    z = sqliteStrDup( val );
++  } else{
++    z = 0;
++    sqliteSetString(&z, orig, val, (char*)0);
++    sqliteFree( orig );
++  }
++  return z;
++}
++
++/*
++ * Append a string representation of the entire node to orig and return it.
++ * This is used to produce debugging information if check_redblack_tree() finds
++ * a problem with a red-black binary tree.
++ */
++static char *append_node(char * orig, BtRbNode *pNode, int indent)
++{
++  char buf[128];
++  int i;
++
++  for( i=0; i<indent; i++ ){
++      orig = append_val(orig, " ");
++  }
++
++  sprintf(buf, "%p", pNode);
++  orig = append_val(orig, buf);
++
++  if( pNode ){
++    indent += 3;
++    if( pNode->isBlack ){
++      orig = append_val(orig, " B \n");
++    }else{
++      orig = append_val(orig, " R \n");
++    }
++    orig = append_node( orig, pNode->pLeft, indent );
++    orig = append_node( orig, pNode->pRight, indent );
++  }else{
++    orig = append_val(orig, "\n");
++  }
++  return orig;
++}
++
++/*
++ * Print a representation of a node to stdout. This function is only included
++ * so you can call it from within a debugger if things get really bad.  It
++ * is not called from anyplace in the code.
++ */
++static void print_node(BtRbNode *pNode)
++{
++    char * str = append_node(0, pNode, 0);
++    printf("%s", str);
++
++    /* Suppress a warning message about print_node() being unused */
++    (void)print_node;
++}
++
++/* 
++ * Check the following properties of the red-black tree:
++ * (1) - If a node is red, both of it's children are black
++ * (2) - Each path from a given node to a leaf (NULL) node passes thru the
++ *       same number of black nodes 
++ *
++ * If there is a problem, append a description (using append_val() ) to *msg.
++ */
++static void check_redblack_tree(BtRbTree * tree, char ** msg)
++{
++  BtRbNode *pNode;
++
++  /* 0 -> came from parent 
++   * 1 -> came from left
++   * 2 -> came from right */
++  int prev_step = 0;
++
++  pNode = tree->pHead;
++  while( pNode ){
++    switch( prev_step ){
++      case 0:
++        if( pNode->pLeft ){
++          pNode = pNode->pLeft;
++        }else{ 
++          prev_step = 1;
++        }
++        break;
++      case 1:
++        if( pNode->pRight ){
++          pNode = pNode->pRight;
++          prev_step = 0;
++        }else{
++          prev_step = 2;
++        }
++        break;
++      case 2:
++        /* Check red-black property (1) */
++        if( !pNode->isBlack &&
++            ( (pNode->pLeft && !pNode->pLeft->isBlack) ||
++              (pNode->pRight && !pNode->pRight->isBlack) )
++          ){
++          char buf[128];
++          sprintf(buf, "Red node with red child at %p\n", pNode);
++          *msg = append_val(*msg, buf);
++          *msg = append_node(*msg, tree->pHead, 0);
++          *msg = append_val(*msg, "\n");
++        }
++
++        /* Check red-black property (2) */
++        { 
++          int leftHeight = 0;
++          int rightHeight = 0;
++          if( pNode->pLeft ){
++            leftHeight += pNode->pLeft->nBlackHeight;
++            leftHeight += (pNode->pLeft->isBlack?1:0);
++          }
++          if( pNode->pRight ){
++            rightHeight += pNode->pRight->nBlackHeight;
++            rightHeight += (pNode->pRight->isBlack?1:0);
++          }
++          if( leftHeight != rightHeight ){
++            char buf[128];
++            sprintf(buf, "Different black-heights at %p\n", pNode);
++            *msg = append_val(*msg, buf);
++            *msg = append_node(*msg, tree->pHead, 0);
++            *msg = append_val(*msg, "\n");
++          }
++          pNode->nBlackHeight = leftHeight;
++        }
++
++        if( pNode->pParent ){
++          if( pNode == pNode->pParent->pLeft ) prev_step = 1;
++          else prev_step = 2;
++        }
++        pNode = pNode->pParent;
++        break;
++      default: assert(0);
++    }
++  }
++} 
++
++/*
++ * Node pX has just been inserted into pTree (by code in sqliteRbtreeInsert()).
++ * It is possible that pX is a red node with a red parent, which is a violation
++ * of the red-black tree properties. This function performs rotations and 
++ * color changes to rebalance the tree
++ */
++static void do_insert_balancing(BtRbTree *pTree, BtRbNode *pX)
++{
++  /* In the first iteration of this loop, pX points to the red node just
++   * inserted in the tree. If the parent of pX exists (pX is not the root
++   * node) and is red, then the properties of the red-black tree are
++   * violated.
++   *
++   * At the start of any subsequent iterations, pX points to a red node
++   * with a red parent. In all other respects the tree is a legal red-black
++   * binary tree. */
++  while( pX != pTree->pHead && !pX->pParent->isBlack ){
++    BtRbNode *pUncle;
++    BtRbNode *pGrandparent;
++
++    /* Grandparent of pX must exist and must be black. */
++    pGrandparent = pX->pParent->pParent;
++    assert( pGrandparent );
++    assert( pGrandparent->isBlack );
++
++    /* Uncle of pX may or may not exist. */
++    if( pX->pParent == pGrandparent->pLeft ) 
++      pUncle = pGrandparent->pRight;
++    else 
++      pUncle = pGrandparent->pLeft;
++
++    /* If the uncle of pX exists and is red, we do the following:
++     *       |                 |
++     *      G(b)              G(r)
++     *      /  \              /  \        
++     *   U(r)   P(r)       U(b)  P(b)
++     *            \                \
++     *           X(r)              X(r)
++     *
++     *     BEFORE             AFTER
++     * pX is then set to G. If the parent of G is red, then the while loop
++     * will run again.  */
++    if( pUncle && !pUncle->isBlack ){
++      pGrandparent->isBlack = 0;
++      pUncle->isBlack = 1;
++      pX->pParent->isBlack = 1;
++      pX = pGrandparent;
++    }else{
++
++      if( pX->pParent == pGrandparent->pLeft ){
++        if( pX == pX->pParent->pRight ){
++          /* If pX is a right-child, do the following transform, essentially
++           * to change pX into a left-child: 
++           *       |                  | 
++           *      G(b)               G(b)
++           *      /  \               /  \        
++           *   P(r)   U(b)        X(r)  U(b)
++           *      \                /
++           *     X(r)            P(r) <-- new X
++           *
++           *     BEFORE             AFTER
++           */
++          pX = pX->pParent;
++          leftRotate(pTree, pX);
++        }
++
++        /* Do the following transform, which balances the tree :) 
++         *       |                  | 
++         *      G(b)               P(b)
++         *      /  \               /  \        
++         *   P(r)   U(b)        X(r)  G(r)
++         *    /                         \
++         *  X(r)                        U(b)
++         *
++         *     BEFORE             AFTER
++         */
++        assert( pGrandparent == pX->pParent->pParent );
++        pGrandparent->isBlack = 0;
++        pX->pParent->isBlack = 1;
++        rightRotate( pTree, pGrandparent );
++
++      }else{
++        /* This code is symetric to the illustrated case above. */
++        if( pX == pX->pParent->pLeft ){
++          pX = pX->pParent;
++          rightRotate(pTree, pX);
++        }
++        assert( pGrandparent == pX->pParent->pParent );
++        pGrandparent->isBlack = 0;
++        pX->pParent->isBlack = 1;
++        leftRotate( pTree, pGrandparent );
++      }
++    }
++  }
++  pTree->pHead->isBlack = 1;
++}
++
++/*
++ * A child of pParent, which in turn had child pX, has just been removed from 
++ * pTree (the figure below depicts the operation, Z is being removed). pParent
++ * or pX, or both may be NULL.  
++ *                |           |
++ *                P           P
++ *               / \         / \
++ *              Z           X
++ *             / \
++ *            X  nil
++ *
++ * This function is only called if Z was black. In this case the red-black tree
++ * properties have been violated, and pX has an "extra black". This function 
++ * performs rotations and color-changes to re-balance the tree.
++ */
++static 
++void do_delete_balancing(BtRbTree *pTree, BtRbNode *pX, BtRbNode *pParent)
++{
++  BtRbNode *pSib; 
++
++  /* TODO: Comment this code! */
++  while( pX != pTree->pHead && (!pX || pX->isBlack) ){
++    if( pX == pParent->pLeft ){
++      pSib = pParent->pRight;
++      if( pSib && !(pSib->isBlack) ){
++        pSib->isBlack = 1;
++        pParent->isBlack = 0;
++        leftRotate(pTree, pParent);
++        pSib = pParent->pRight;
++      }
++      if( !pSib ){
++        pX = pParent;
++      }else if( 
++          (!pSib->pLeft  || pSib->pLeft->isBlack) &&
++          (!pSib->pRight || pSib->pRight->isBlack) ) {
++        pSib->isBlack = 0;
++        pX = pParent;
++      }else{
++        if( (!pSib->pRight || pSib->pRight->isBlack) ){
++          if( pSib->pLeft ) pSib->pLeft->isBlack = 1;
++          pSib->isBlack = 0;
++          rightRotate( pTree, pSib );
++          pSib = pParent->pRight;
++        }
++        pSib->isBlack = pParent->isBlack;
++        pParent->isBlack = 1;
++        if( pSib->pRight ) pSib->pRight->isBlack = 1;
++        leftRotate(pTree, pParent);
++        pX = pTree->pHead;
++      }
++    }else{
++      pSib = pParent->pLeft;
++      if( pSib && !(pSib->isBlack) ){
++        pSib->isBlack = 1;
++        pParent->isBlack = 0;
++        rightRotate(pTree, pParent);
++        pSib = pParent->pLeft;
++      }
++      if( !pSib ){
++        pX = pParent;
++      }else if( 
++          (!pSib->pLeft  || pSib->pLeft->isBlack) &&
++          (!pSib->pRight || pSib->pRight->isBlack) ){
++        pSib->isBlack = 0;
++        pX = pParent;
++      }else{
++        if( (!pSib->pLeft || pSib->pLeft->isBlack) ){
++          if( pSib->pRight ) pSib->pRight->isBlack = 1;
++          pSib->isBlack = 0;
++          leftRotate( pTree, pSib );
++          pSib = pParent->pLeft;
++        }
++        pSib->isBlack = pParent->isBlack;
++        pParent->isBlack = 1;
++        if( pSib->pLeft ) pSib->pLeft->isBlack = 1;
++        rightRotate(pTree, pParent);
++        pX = pTree->pHead;
++      }
++    }
++    pParent = pX->pParent;
++  }
++  if( pX ) pX->isBlack = 1;
++}
++
++/*
++ * Create table n in tree pRbtree. Table n must not exist.
++ */
++static void btreeCreateTable(Rbtree* pRbtree, int n)
++{
++  BtRbTree *pNewTbl = sqliteMalloc(sizeof(BtRbTree));
++  sqliteHashInsert(&pRbtree->tblHash, 0, n, pNewTbl);
++}
++
++/*
++ * Log a single "rollback-op" for the given Rbtree. See comments for struct
++ * BtRollbackOp.
++ */
++static void btreeLogRollbackOp(Rbtree* pRbtree, BtRollbackOp *pRollbackOp)
++{
++  assert( pRbtree->eTransState == TRANS_INCHECKPOINT ||
++      pRbtree->eTransState == TRANS_INTRANSACTION );
++  if( pRbtree->eTransState == TRANS_INTRANSACTION ){
++    pRollbackOp->pNext = pRbtree->pTransRollback;
++    pRbtree->pTransRollback = pRollbackOp;
++  }
++  if( pRbtree->eTransState == TRANS_INCHECKPOINT ){
++    if( !pRbtree->pCheckRollback ){
++      pRbtree->pCheckRollbackTail = pRollbackOp;
++    }
++    pRollbackOp->pNext = pRbtree->pCheckRollback;
++    pRbtree->pCheckRollback = pRollbackOp;
++  }
++}
++
++int sqliteRbtreeOpen(
++  const char *zFilename,
++  int mode,
++  int nPg,
++  Btree **ppBtree
++){
++  Rbtree **ppRbtree = (Rbtree**)ppBtree;
++  *ppRbtree = (Rbtree *)sqliteMalloc(sizeof(Rbtree));
++  if( sqlite_malloc_failed ) goto open_no_mem;
++  sqliteHashInit(&(*ppRbtree)->tblHash, SQLITE_HASH_INT, 0);
++
++  /* Create a binary tree for the SQLITE_MASTER table at location 2 */
++  btreeCreateTable(*ppRbtree, 2);
++  if( sqlite_malloc_failed ) goto open_no_mem;
++  (*ppRbtree)->next_idx = 3;
++  (*ppRbtree)->pOps = &sqliteRbtreeOps;
++  /* Set file type to 4; this is so that "attach ':memory:' as ...."  does not
++  ** think that the database in uninitialised and refuse to attach
++  */
++  (*ppRbtree)->aMetaData[2] = 4;
++  
++  return SQLITE_OK;
++
++open_no_mem:
++  *ppBtree = 0;
++  return SQLITE_NOMEM;
++}
++
++/*
++ * Create a new table in the supplied Rbtree. Set *n to the new table number.
++ * Return SQLITE_OK if the operation is a success.
++ */
++static int memRbtreeCreateTable(Rbtree* tree, int* n)
++{
++  assert( tree->eTransState != TRANS_NONE );
++
++  *n = tree->next_idx++;
++  btreeCreateTable(tree, *n);
++  if( sqlite_malloc_failed ) return SQLITE_NOMEM;
++
++  /* Set up the rollback structure (if we are not doing this as part of a
++   * rollback) */
++  if( tree->eTransState != TRANS_ROLLBACK ){
++    BtRollbackOp *pRollbackOp = sqliteMalloc(sizeof(BtRollbackOp));
++    if( pRollbackOp==0 ) return SQLITE_NOMEM;
++    pRollbackOp->eOp = ROLLBACK_DROP;
++    pRollbackOp->iTab = *n;
++    btreeLogRollbackOp(tree, pRollbackOp);
++  }
++
++  return SQLITE_OK;
++}
++
++/*
++ * Delete table n from the supplied Rbtree. 
++ */
++static int memRbtreeDropTable(Rbtree* tree, int n)
++{
++  BtRbTree *pTree;
++  assert( tree->eTransState != TRANS_NONE );
++
++  memRbtreeClearTable(tree, n);
++  pTree = sqliteHashInsert(&tree->tblHash, 0, n, 0);
++  assert(pTree);
++  assert( pTree->pCursors==0 );
++  sqliteFree(pTree);
++
++  if( tree->eTransState != TRANS_ROLLBACK ){
++    BtRollbackOp *pRollbackOp = sqliteMalloc(sizeof(BtRollbackOp));
++    if( pRollbackOp==0 ) return SQLITE_NOMEM;
++    pRollbackOp->eOp = ROLLBACK_CREATE;
++    pRollbackOp->iTab = n;
++    btreeLogRollbackOp(tree, pRollbackOp);
++  }
++
++  return SQLITE_OK;
++}
++
++static int memRbtreeKeyCompare(RbtCursor* pCur, const void *pKey, int nKey,
++                                 int nIgnore, int *pRes)
++{
++  assert(pCur);
++
++  if( !pCur->pNode ) {
++    *pRes = -1;
++  } else {
++    if( (pCur->pNode->nKey - nIgnore) < 0 ){
++      *pRes = -1;
++    }else{
++      *pRes = key_compare(pCur->pNode->pKey, pCur->pNode->nKey-nIgnore, 
++          pKey, nKey);
++    }
++  }
++  return SQLITE_OK;
++}
++
++/*
++ * Get a new cursor for table iTable of the supplied Rbtree. The wrFlag
++ * parameter indicates that the cursor is open for writing.
++ *
++ * Note that RbtCursor.eSkip and RbtCursor.pNode both initialize to 0.
++ */
++static int memRbtreeCursor(
++  Rbtree* tree,
++  int iTable,
++  int wrFlag,
++  RbtCursor **ppCur
++){
++  RbtCursor *pCur;
++  assert(tree);
++  pCur = *ppCur = sqliteMalloc(sizeof(RbtCursor));
++  if( sqlite_malloc_failed ) return SQLITE_NOMEM;
++  pCur->pTree  = sqliteHashFind(&tree->tblHash, 0, iTable);
++  assert( pCur->pTree );
++  pCur->pRbtree = tree;
++  pCur->iTree  = iTable;
++  pCur->pOps = &sqliteRbtreeCursorOps;
++  pCur->wrFlag = wrFlag;
++  pCur->pShared = pCur->pTree->pCursors;
++  pCur->pTree->pCursors = pCur;
++
++  assert( (*ppCur)->pTree );
++  return SQLITE_OK;
++}
++
++/*
++ * Insert a new record into the Rbtree.  The key is given by (pKey,nKey)
++ * and the data is given by (pData,nData).  The cursor is used only to
++ * define what database the record should be inserted into.  The cursor
++ * is left pointing at the new record.
++ *
++ * If the key exists already in the tree, just replace the data. 
++ */
++static int memRbtreeInsert(
++  RbtCursor* pCur,
++  const void *pKey,
++  int nKey,
++  const void *pDataInput,
++  int nData
++){
++  void * pData;
++  int match;
++
++  /* It is illegal to call sqliteRbtreeInsert() if we are
++  ** not in a transaction */
++  assert( pCur->pRbtree->eTransState != TRANS_NONE );
++
++  /* Make sure some other cursor isn't trying to read this same table */
++  if( checkReadLocks(pCur) ){
++    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
++  }
++
++  /* Take a copy of the input data now, in case we need it for the 
++   * replace case */
++  pData = sqliteMallocRaw(nData);
++  if( sqlite_malloc_failed ) return SQLITE_NOMEM;
++  memcpy(pData, pDataInput, nData);
++
++  /* Move the cursor to a node near the key to be inserted. If the key already
++   * exists in the table, then (match == 0). In this case we can just replace
++   * the data associated with the entry, we don't need to manipulate the tree.
++   * 
++   * If there is no exact match, then the cursor points at what would be either
++   * the predecessor (match == -1) or successor (match == 1) of the
++   * searched-for key, were it to be inserted. The new node becomes a child of
++   * this node.
++   * 
++   * The new node is initially red.
++   */
++  memRbtreeMoveto( pCur, pKey, nKey, &match);
++  if( match ){
++    BtRbNode *pNode = sqliteMalloc(sizeof(BtRbNode));
++    if( pNode==0 ) return SQLITE_NOMEM;
++    pNode->nKey = nKey;
++    pNode->pKey = sqliteMallocRaw(nKey);
++    if( sqlite_malloc_failed ) return SQLITE_NOMEM;
++    memcpy(pNode->pKey, pKey, nKey);
++    pNode->nData = nData;
++    pNode->pData = pData; 
++    if( pCur->pNode ){
++      switch( match ){
++        case -1:
++          assert( !pCur->pNode->pRight );
++          pNode->pParent = pCur->pNode;
++          pCur->pNode->pRight = pNode;
++          break;
++        case 1:
++          assert( !pCur->pNode->pLeft );
++          pNode->pParent = pCur->pNode;
++          pCur->pNode->pLeft = pNode;
++          break;
++        default:
++          assert(0);
++      }
++    }else{
++      pCur->pTree->pHead = pNode;
++    }
++
++    /* Point the cursor at the node just inserted, as per SQLite requirements */
++    pCur->pNode = pNode;
++
++    /* A new node has just been inserted, so run the balancing code */
++    do_insert_balancing(pCur->pTree, pNode);
++
++    /* Set up a rollback-op in case we have to roll this operation back */
++    if( pCur->pRbtree->eTransState != TRANS_ROLLBACK ){
++      BtRollbackOp *pOp = sqliteMalloc( sizeof(BtRollbackOp) );
++      if( pOp==0 ) return SQLITE_NOMEM;
++      pOp->eOp = ROLLBACK_DELETE;
++      pOp->iTab = pCur->iTree;
++      pOp->nKey = pNode->nKey;
++      pOp->pKey = sqliteMallocRaw( pOp->nKey );
++      if( sqlite_malloc_failed ) return SQLITE_NOMEM;
++      memcpy( pOp->pKey, pNode->pKey, pOp->nKey );
++      btreeLogRollbackOp(pCur->pRbtree, pOp);
++    }
++
++  }else{ 
++    /* No need to insert a new node in the tree, as the key already exists.
++     * Just clobber the current nodes data. */
++
++    /* Set up a rollback-op in case we have to roll this operation back */
++    if( pCur->pRbtree->eTransState != TRANS_ROLLBACK ){
++      BtRollbackOp *pOp = sqliteMalloc( sizeof(BtRollbackOp) );
++      if( pOp==0 ) return SQLITE_NOMEM;
++      pOp->iTab = pCur->iTree;
++      pOp->nKey = pCur->pNode->nKey;
++      pOp->pKey = sqliteMallocRaw( pOp->nKey );
++      if( sqlite_malloc_failed ) return SQLITE_NOMEM;
++      memcpy( pOp->pKey, pCur->pNode->pKey, pOp->nKey );
++      pOp->nData = pCur->pNode->nData;
++      pOp->pData = pCur->pNode->pData;
++      pOp->eOp = ROLLBACK_INSERT;
++      btreeLogRollbackOp(pCur->pRbtree, pOp);
++    }else{
++      sqliteFree( pCur->pNode->pData );
++    }
++
++    /* Actually clobber the nodes data */
++    pCur->pNode->pData = pData;
++    pCur->pNode->nData = nData;
++  }
++
++  return SQLITE_OK;
++}
++
++/* Move the cursor so that it points to an entry near pKey.
++** Return a success code.
++**
++**     *pRes<0      The cursor is left pointing at an entry that
++**                  is smaller than pKey or if the table is empty
++**                  and the cursor is therefore left point to nothing.
++**
++**     *pRes==0     The cursor is left pointing at an entry that
++**                  exactly matches pKey.
++**
++**     *pRes>0      The cursor is left pointing at an entry that
++**                  is larger than pKey.
++*/
++static int memRbtreeMoveto(
++  RbtCursor* pCur,
++  const void *pKey,
++  int nKey,
++  int *pRes
++){
++  BtRbNode *pTmp = 0;
++
++  pCur->pNode = pCur->pTree->pHead;
++  *pRes = -1;
++  while( pCur->pNode && *pRes ) {
++    *pRes = key_compare(pCur->pNode->pKey, pCur->pNode->nKey, pKey, nKey);
++    pTmp = pCur->pNode;
++    switch( *pRes ){
++      case 1:    /* cursor > key */
++        pCur->pNode = pCur->pNode->pLeft;
++        break;
++      case -1:   /* cursor < key */
++        pCur->pNode = pCur->pNode->pRight;
++        break;
++    }
++  } 
++
++  /* If (pCur->pNode == NULL), then we have failed to find a match. Set
++   * pCur->pNode to pTmp, which is either NULL (if the tree is empty) or the
++   * last node traversed in the search. In either case the relation ship
++   * between pTmp and the searched for key is already stored in *pRes. pTmp is
++   * either the successor or predecessor of the key we tried to move to. */
++  if( !pCur->pNode ) pCur->pNode = pTmp;
++  pCur->eSkip = SKIP_NONE;
++
++  return SQLITE_OK;
++}
++
++
++/*
++** Delete the entry that the cursor is pointing to.
++**
++** The cursor is left pointing at either the next or the previous
++** entry.  If the cursor is left pointing to the next entry, then 
++** the pCur->eSkip flag is set to SKIP_NEXT which forces the next call to 
++** sqliteRbtreeNext() to be a no-op.  That way, you can always call
++** sqliteRbtreeNext() after a delete and the cursor will be left
++** pointing to the first entry after the deleted entry.  Similarly,
++** pCur->eSkip is set to SKIP_PREV is the cursor is left pointing to
++** the entry prior to the deleted entry so that a subsequent call to
++** sqliteRbtreePrevious() will always leave the cursor pointing at the
++** entry immediately before the one that was deleted.
++*/
++static int memRbtreeDelete(RbtCursor* pCur)
++{
++  BtRbNode *pZ;      /* The one being deleted */
++  BtRbNode *pChild;  /* The child of the spliced out node */
++
++  /* It is illegal to call sqliteRbtreeDelete() if we are
++  ** not in a transaction */
++  assert( pCur->pRbtree->eTransState != TRANS_NONE );
++
++  /* Make sure some other cursor isn't trying to read this same table */
++  if( checkReadLocks(pCur) ){
++    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
++  }
++
++  pZ = pCur->pNode;
++  if( !pZ ){
++    return SQLITE_OK;
++  }
++
++  /* If we are not currently doing a rollback, set up a rollback op for this 
++   * deletion */
++  if( pCur->pRbtree->eTransState != TRANS_ROLLBACK ){
++    BtRollbackOp *pOp = sqliteMalloc( sizeof(BtRollbackOp) );
++    if( pOp==0 ) return SQLITE_NOMEM;
++    pOp->iTab = pCur->iTree;
++    pOp->nKey = pZ->nKey;
++    pOp->pKey = pZ->pKey;
++    pOp->nData = pZ->nData;
++    pOp->pData = pZ->pData;
++    pOp->eOp = ROLLBACK_INSERT;
++    btreeLogRollbackOp(pCur->pRbtree, pOp);
++  }
++
++  /* First do a standard binary-tree delete (node pZ is to be deleted). How
++   * to do this depends on how many children pZ has:
++   *
++   * If pZ has no children or one child, then splice out pZ.  If pZ has two
++   * children, splice out the successor of pZ and replace the key and data of
++   * pZ with the key and data of the spliced out successor.  */
++  if( pZ->pLeft && pZ->pRight ){
++    BtRbNode *pTmp;
++    int dummy;
++    pCur->eSkip = SKIP_NONE;
++    memRbtreeNext(pCur, &dummy);
++    assert( dummy == 0 );
++    if( pCur->pRbtree->eTransState == TRANS_ROLLBACK ){
++      sqliteFree(pZ->pKey);
++      sqliteFree(pZ->pData);
++    }
++    pZ->pData = pCur->pNode->pData;
++    pZ->nData = pCur->pNode->nData;
++    pZ->pKey = pCur->pNode->pKey;
++    pZ->nKey = pCur->pNode->nKey;
++    pTmp = pZ;
++    pZ = pCur->pNode;
++    pCur->pNode = pTmp;
++    pCur->eSkip = SKIP_NEXT;
++  }else{
++    int res;
++    pCur->eSkip = SKIP_NONE;
++    memRbtreeNext(pCur, &res);
++    pCur->eSkip = SKIP_NEXT;
++    if( res ){
++      memRbtreeLast(pCur, &res);
++      memRbtreePrevious(pCur, &res);
++      pCur->eSkip = SKIP_PREV;
++    }
++    if( pCur->pRbtree->eTransState == TRANS_ROLLBACK ){
++        sqliteFree(pZ->pKey);
++        sqliteFree(pZ->pData);
++    }
++  }
++
++  /* pZ now points at the node to be spliced out. This block does the 
++   * splicing. */
++  {
++    BtRbNode **ppParentSlot = 0;
++    assert( !pZ->pLeft || !pZ->pRight ); /* pZ has at most one child */
++    pChild = ((pZ->pLeft)?pZ->pLeft:pZ->pRight);
++    if( pZ->pParent ){
++      assert( pZ == pZ->pParent->pLeft || pZ == pZ->pParent->pRight );
++      ppParentSlot = ((pZ == pZ->pParent->pLeft)
++          ?&pZ->pParent->pLeft:&pZ->pParent->pRight);
++      *ppParentSlot = pChild;
++    }else{
++      pCur->pTree->pHead = pChild;
++    }
++    if( pChild ) pChild->pParent = pZ->pParent;
++  }
++
++  /* pZ now points at the spliced out node. pChild is the only child of pZ, or
++   * NULL if pZ has no children. If pZ is black, and not the tree root, then we
++   * will have violated the "same number of black nodes in every path to a
++   * leaf" property of the red-black tree. The code in do_delete_balancing()
++   * repairs this. */
++  if( pZ->isBlack ){ 
++    do_delete_balancing(pCur->pTree, pChild, pZ->pParent);
++  }
++
++  sqliteFree(pZ);
++  return SQLITE_OK;
++}
++
++/*
++ * Empty table n of the Rbtree.
++ */
++static int memRbtreeClearTable(Rbtree* tree, int n)
++{
++  BtRbTree *pTree;
++  BtRbNode *pNode;
++
++  pTree = sqliteHashFind(&tree->tblHash, 0, n);
++  assert(pTree);
++
++  pNode = pTree->pHead;
++  while( pNode ){
++    if( pNode->pLeft ){
++      pNode = pNode->pLeft;
++    }
++    else if( pNode->pRight ){
++      pNode = pNode->pRight;
++    }
++    else {
++      BtRbNode *pTmp = pNode->pParent;
++      if( tree->eTransState == TRANS_ROLLBACK ){
++        sqliteFree( pNode->pKey );
++        sqliteFree( pNode->pData );
++      }else{
++        BtRollbackOp *pRollbackOp = sqliteMallocRaw(sizeof(BtRollbackOp));
++        if( pRollbackOp==0 ) return SQLITE_NOMEM;
++        pRollbackOp->eOp = ROLLBACK_INSERT;
++        pRollbackOp->iTab = n;
++        pRollbackOp->nKey = pNode->nKey;
++        pRollbackOp->pKey = pNode->pKey;
++        pRollbackOp->nData = pNode->nData;
++        pRollbackOp->pData = pNode->pData;
++        btreeLogRollbackOp(tree, pRollbackOp);
++      }
++      sqliteFree( pNode );
++      if( pTmp ){
++        if( pTmp->pLeft == pNode ) pTmp->pLeft = 0;
++        else if( pTmp->pRight == pNode ) pTmp->pRight = 0;
++      }
++      pNode = pTmp;
++    }
++  }
++
++  pTree->pHead = 0;
++  return SQLITE_OK;
++}
++
++static int memRbtreeFirst(RbtCursor* pCur, int *pRes)
++{
++  if( pCur->pTree->pHead ){
++    pCur->pNode = pCur->pTree->pHead;
++    while( pCur->pNode->pLeft ){
++      pCur->pNode = pCur->pNode->pLeft;
++    }
++  }
++  if( pCur->pNode ){
++    *pRes = 0;
++  }else{
++    *pRes = 1;
++  }
++  pCur->eSkip = SKIP_NONE;
++  return SQLITE_OK;
++}
++
++static int memRbtreeLast(RbtCursor* pCur, int *pRes)
++{
++  if( pCur->pTree->pHead ){
++    pCur->pNode = pCur->pTree->pHead;
++    while( pCur->pNode->pRight ){
++      pCur->pNode = pCur->pNode->pRight;
++    }
++  }
++  if( pCur->pNode ){
++    *pRes = 0;
++  }else{
++    *pRes = 1;
++  }
++  pCur->eSkip = SKIP_NONE;
++  return SQLITE_OK;
++}
++
++/*
++** Advance the cursor to the next entry in the database.  If
++** successful then set *pRes=0.  If the cursor
++** was already pointing to the last entry in the database before
++** this routine was called, then set *pRes=1.
++*/
++static int memRbtreeNext(RbtCursor* pCur, int *pRes)
++{
++  if( pCur->pNode && pCur->eSkip != SKIP_NEXT ){
++    if( pCur->pNode->pRight ){
++      pCur->pNode = pCur->pNode->pRight;
++      while( pCur->pNode->pLeft )
++        pCur->pNode = pCur->pNode->pLeft;
++    }else{
++      BtRbNode * pX = pCur->pNode;
++      pCur->pNode = pX->pParent;
++      while( pCur->pNode && (pCur->pNode->pRight == pX) ){
++        pX = pCur->pNode;
++        pCur->pNode = pX->pParent;
++      }
++    }
++  }
++  pCur->eSkip = SKIP_NONE;
++
++  if( !pCur->pNode ){
++    *pRes = 1;
++  }else{
++    *pRes = 0;
++  }
++
++  return SQLITE_OK;
++}
++
++static int memRbtreePrevious(RbtCursor* pCur, int *pRes)
++{
++  if( pCur->pNode && pCur->eSkip != SKIP_PREV ){
++    if( pCur->pNode->pLeft ){
++      pCur->pNode = pCur->pNode->pLeft;
++      while( pCur->pNode->pRight )
++        pCur->pNode = pCur->pNode->pRight;
++    }else{
++      BtRbNode * pX = pCur->pNode;
++      pCur->pNode = pX->pParent;
++      while( pCur->pNode && (pCur->pNode->pLeft == pX) ){
++        pX = pCur->pNode;
++        pCur->pNode = pX->pParent;
++      }
++    }
++  }
++  pCur->eSkip = SKIP_NONE;
++
++  if( !pCur->pNode ){
++    *pRes = 1;
++  }else{
++    *pRes = 0;
++  }
++
++  return SQLITE_OK;
++}
++
++static int memRbtreeKeySize(RbtCursor* pCur, int *pSize)
++{
++  if( pCur->pNode ){
++    *pSize = pCur->pNode->nKey;
++  }else{
++    *pSize = 0;
++  }
++  return SQLITE_OK;
++}
++
++static int memRbtreeKey(RbtCursor* pCur, int offset, int amt, char *zBuf)
++{
++  if( !pCur->pNode ) return 0;
++  if( !pCur->pNode->pKey || ((amt + offset) <= pCur->pNode->nKey) ){
++    memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, amt);
++  }else{
++    memcpy(zBuf, ((char*)pCur->pNode->pKey)+offset, pCur->pNode->nKey-offset);
++    amt = pCur->pNode->nKey-offset;
++  }
++  return amt;
++}
++
++static int memRbtreeDataSize(RbtCursor* pCur, int *pSize)
++{
++  if( pCur->pNode ){
++    *pSize = pCur->pNode->nData;
++  }else{
++    *pSize = 0;
++  }
++  return SQLITE_OK;
++}
++
++static int memRbtreeData(RbtCursor *pCur, int offset, int amt, char *zBuf)
++{
++  if( !pCur->pNode ) return 0;
++  if( (amt + offset) <= pCur->pNode->nData ){
++    memcpy(zBuf, ((char*)pCur->pNode->pData)+offset, amt);
++  }else{
++    memcpy(zBuf, ((char*)pCur->pNode->pData)+offset ,pCur->pNode->nData-offset);
++    amt = pCur->pNode->nData-offset;
++  }
++  return amt;
++}
++
++static int memRbtreeCloseCursor(RbtCursor* pCur)
++{
++  if( pCur->pTree->pCursors==pCur ){
++    pCur->pTree->pCursors = pCur->pShared;
++  }else{
++    RbtCursor *p = pCur->pTree->pCursors;
++    while( p && p->pShared!=pCur ){ p = p->pShared; }
++    assert( p!=0 );
++    if( p ){
++      p->pShared = pCur->pShared;
++    }
++  }
++  sqliteFree(pCur);
++  return SQLITE_OK;
++}
++
++static int memRbtreeGetMeta(Rbtree* tree, int* aMeta)
++{
++  memcpy( aMeta, tree->aMetaData, sizeof(int) * SQLITE_N_BTREE_META );
++  return SQLITE_OK;
++}
++
++static int memRbtreeUpdateMeta(Rbtree* tree, int* aMeta)
++{
++  memcpy( tree->aMetaData, aMeta, sizeof(int) * SQLITE_N_BTREE_META );
++  return SQLITE_OK;
++}
++
++/*
++ * Check that each table in the Rbtree meets the requirements for a red-black
++ * binary tree. If an error is found, return an explanation of the problem in 
++ * memory obtained from sqliteMalloc(). Parameters aRoot and nRoot are ignored. 
++ */
++static char *memRbtreeIntegrityCheck(Rbtree* tree, int* aRoot, int nRoot)
++{
++  char * msg = 0;
++  HashElem *p;
++
++  for(p=sqliteHashFirst(&tree->tblHash); p; p=sqliteHashNext(p)){
++    BtRbTree *pTree = sqliteHashData(p);
++    check_redblack_tree(pTree, &msg);
++  }
++
++  return msg;
++}
++
++static int memRbtreeSetCacheSize(Rbtree* tree, int sz)
++{
++  return SQLITE_OK;
++}
++
++static int memRbtreeSetSafetyLevel(Rbtree *pBt, int level){
++  return SQLITE_OK;
++}
++
++static int memRbtreeBeginTrans(Rbtree* tree)
++{
++  if( tree->eTransState != TRANS_NONE ) 
++    return SQLITE_ERROR;
++
++  assert( tree->pTransRollback == 0 );
++  tree->eTransState = TRANS_INTRANSACTION;
++  return SQLITE_OK;
++}
++
++/*
++** Delete a linked list of BtRollbackOp structures.
++*/
++static void deleteRollbackList(BtRollbackOp *pOp){
++  while( pOp ){
++    BtRollbackOp *pTmp = pOp->pNext;
++    sqliteFree(pOp->pData);
++    sqliteFree(pOp->pKey);
++    sqliteFree(pOp);
++    pOp = pTmp;
++  }
++}
++
++static int memRbtreeCommit(Rbtree* tree){
++  /* Just delete pTransRollback and pCheckRollback */
++  deleteRollbackList(tree->pCheckRollback);
++  deleteRollbackList(tree->pTransRollback);
++  tree->pTransRollback = 0;
++  tree->pCheckRollback = 0;
++  tree->pCheckRollbackTail = 0;
++  tree->eTransState = TRANS_NONE;
++  return SQLITE_OK;
++}
++
++/*
++ * Close the supplied Rbtree. Delete everything associated with it.
++ */
++static int memRbtreeClose(Rbtree* tree)
++{
++  HashElem *p;
++  memRbtreeCommit(tree);
++  while( (p=sqliteHashFirst(&tree->tblHash))!=0 ){
++    tree->eTransState = TRANS_ROLLBACK;
++    memRbtreeDropTable(tree, sqliteHashKeysize(p));
++  }
++  sqliteHashClear(&tree->tblHash);
++  sqliteFree(tree);
++  return SQLITE_OK;
++}
++
++/*
++ * Execute and delete the supplied rollback-list on pRbtree.
++ */
++static void execute_rollback_list(Rbtree *pRbtree, BtRollbackOp *pList)
++{
++  BtRollbackOp *pTmp;
++  RbtCursor cur;
++  int res;
++
++  cur.pRbtree = pRbtree;
++  cur.wrFlag = 1;
++  while( pList ){
++    switch( pList->eOp ){
++      case ROLLBACK_INSERT:
++        cur.pTree  = sqliteHashFind( &pRbtree->tblHash, 0, pList->iTab );
++        assert(cur.pTree);
++        cur.iTree  = pList->iTab;
++        cur.eSkip  = SKIP_NONE;
++        memRbtreeInsert( &cur, pList->pKey,
++            pList->nKey, pList->pData, pList->nData );
++        break;
++      case ROLLBACK_DELETE:
++        cur.pTree  = sqliteHashFind( &pRbtree->tblHash, 0, pList->iTab );
++        assert(cur.pTree);
++        cur.iTree  = pList->iTab;
++        cur.eSkip  = SKIP_NONE;
++        memRbtreeMoveto(&cur, pList->pKey, pList->nKey, &res);
++        assert(res == 0);
++        memRbtreeDelete( &cur );
++        break;
++      case ROLLBACK_CREATE:
++        btreeCreateTable(pRbtree, pList->iTab);
++        break;
++      case ROLLBACK_DROP:
++        memRbtreeDropTable(pRbtree, pList->iTab);
++        break;
++      default:
++        assert(0);
++    }
++    sqliteFree(pList->pKey);
++    sqliteFree(pList->pData);
++    pTmp = pList->pNext;
++    sqliteFree(pList);
++    pList = pTmp;
++  }
++}
++
++static int memRbtreeRollback(Rbtree* tree)
++{
++  tree->eTransState = TRANS_ROLLBACK;
++  execute_rollback_list(tree, tree->pCheckRollback);
++  execute_rollback_list(tree, tree->pTransRollback);
++  tree->pTransRollback = 0;
++  tree->pCheckRollback = 0;
++  tree->pCheckRollbackTail = 0;
++  tree->eTransState = TRANS_NONE;
++  return SQLITE_OK;
++}
++
++static int memRbtreeBeginCkpt(Rbtree* tree)
++{
++  if( tree->eTransState != TRANS_INTRANSACTION ) 
++    return SQLITE_ERROR;
++
++  assert( tree->pCheckRollback == 0 );
++  assert( tree->pCheckRollbackTail == 0 );
++  tree->eTransState = TRANS_INCHECKPOINT;
++  return SQLITE_OK;
++}
++
++static int memRbtreeCommitCkpt(Rbtree* tree)
++{
++  if( tree->eTransState == TRANS_INCHECKPOINT ){ 
++    if( tree->pCheckRollback ){
++      tree->pCheckRollbackTail->pNext = tree->pTransRollback;
++      tree->pTransRollback = tree->pCheckRollback;
++      tree->pCheckRollback = 0;
++      tree->pCheckRollbackTail = 0;
++    }
++    tree->eTransState = TRANS_INTRANSACTION;
++  }
++  return SQLITE_OK;
++}
++
++static int memRbtreeRollbackCkpt(Rbtree* tree)
++{
++  if( tree->eTransState != TRANS_INCHECKPOINT ) return SQLITE_OK;
++  tree->eTransState = TRANS_ROLLBACK;
++  execute_rollback_list(tree, tree->pCheckRollback);
++  tree->pCheckRollback = 0;
++  tree->pCheckRollbackTail = 0;
++  tree->eTransState = TRANS_INTRANSACTION;
++  return SQLITE_OK;
++}
++
++#ifdef SQLITE_TEST
++static int memRbtreePageDump(Rbtree* tree, int pgno, int rec)
++{
++  assert(!"Cannot call sqliteRbtreePageDump");
++  return SQLITE_OK;
++}
++
++static int memRbtreeCursorDump(RbtCursor* pCur, int* aRes)
++{
++  assert(!"Cannot call sqliteRbtreeCursorDump");
++  return SQLITE_OK;
++}
++#endif
++
++static struct Pager *memRbtreePager(Rbtree* tree)
++{
++  return 0;
++}
++
++/*
++** Return the full pathname of the underlying database file.
++*/
++static const char *memRbtreeGetFilename(Rbtree *pBt){
++  return 0;  /* A NULL return indicates there is no underlying file */
++}
++
++/*
++** The copy file function is not implemented for the in-memory database
++*/
++static int memRbtreeCopyFile(Rbtree *pBt, Rbtree *pBt2){
++  return SQLITE_INTERNAL;  /* Not implemented */
++}
++
++static BtOps sqliteRbtreeOps = {
++    (int(*)(Btree*)) memRbtreeClose,
++    (int(*)(Btree*,int)) memRbtreeSetCacheSize,
++    (int(*)(Btree*,int)) memRbtreeSetSafetyLevel,
++    (int(*)(Btree*)) memRbtreeBeginTrans,
++    (int(*)(Btree*)) memRbtreeCommit,
++    (int(*)(Btree*)) memRbtreeRollback,
++    (int(*)(Btree*)) memRbtreeBeginCkpt,
++    (int(*)(Btree*)) memRbtreeCommitCkpt,
++    (int(*)(Btree*)) memRbtreeRollbackCkpt,
++    (int(*)(Btree*,int*)) memRbtreeCreateTable,
++    (int(*)(Btree*,int*)) memRbtreeCreateTable,
++    (int(*)(Btree*,int)) memRbtreeDropTable,
++    (int(*)(Btree*,int)) memRbtreeClearTable,
++    (int(*)(Btree*,int,int,BtCursor**)) memRbtreeCursor,
++    (int(*)(Btree*,int*)) memRbtreeGetMeta,
++    (int(*)(Btree*,int*)) memRbtreeUpdateMeta,
++    (char*(*)(Btree*,int*,int)) memRbtreeIntegrityCheck,
++    (const char*(*)(Btree*)) memRbtreeGetFilename,
++    (int(*)(Btree*,Btree*)) memRbtreeCopyFile,
++    (struct Pager*(*)(Btree*)) memRbtreePager,
++#ifdef SQLITE_TEST
++    (int(*)(Btree*,int,int)) memRbtreePageDump,
++#endif
++};
++
++static BtCursorOps sqliteRbtreeCursorOps = {
++    (int(*)(BtCursor*,const void*,int,int*)) memRbtreeMoveto,
++    (int(*)(BtCursor*)) memRbtreeDelete,
++    (int(*)(BtCursor*,const void*,int,const void*,int)) memRbtreeInsert,
++    (int(*)(BtCursor*,int*)) memRbtreeFirst,
++    (int(*)(BtCursor*,int*)) memRbtreeLast,
++    (int(*)(BtCursor*,int*)) memRbtreeNext,
++    (int(*)(BtCursor*,int*)) memRbtreePrevious,
++    (int(*)(BtCursor*,int*)) memRbtreeKeySize,
++    (int(*)(BtCursor*,int,int,char*)) memRbtreeKey,
++    (int(*)(BtCursor*,const void*,int,int,int*)) memRbtreeKeyCompare,
++    (int(*)(BtCursor*,int*)) memRbtreeDataSize,
++    (int(*)(BtCursor*,int,int,char*)) memRbtreeData,
++    (int(*)(BtCursor*)) memRbtreeCloseCursor,
++#ifdef SQLITE_TEST
++    (int(*)(BtCursor*,int*)) memRbtreeCursorDump,
++#endif
++
++};
++
++#endif /* SQLITE_OMIT_INMEMORYDB */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/build.c
+@@ -0,0 +1,2156 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains C code routines that are called by the SQLite parser
++** when syntax rules are reduced.  The routines in this file handle the
++** following kinds of SQL syntax:
++**
++**     CREATE TABLE
++**     DROP TABLE
++**     CREATE INDEX
++**     DROP INDEX
++**     creating ID lists
++**     BEGIN TRANSACTION
++**     COMMIT
++**     ROLLBACK
++**     PRAGMA
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include <ctype.h>
++
++/*
++** This routine is called when a new SQL statement is beginning to
++** be parsed.  Check to see if the schema for the database needs
++** to be read from the SQLITE_MASTER and SQLITE_TEMP_MASTER tables.
++** If it does, then read it.
++*/
++void sqliteBeginParse(Parse *pParse, int explainFlag){
++  sqlite *db = pParse->db;
++  int i;
++  pParse->explain = explainFlag;
++  if((db->flags & SQLITE_Initialized)==0 && db->init.busy==0 ){
++    int rc = sqliteInit(db, &pParse->zErrMsg);
++    if( rc!=SQLITE_OK ){
++      pParse->rc = rc;
++      pParse->nErr++;
++    }
++  }
++  for(i=0; i<db->nDb; i++){
++    DbClearProperty(db, i, DB_Locked);
++    if( !db->aDb[i].inTrans ){
++      DbClearProperty(db, i, DB_Cookie);
++    }
++  }
++  pParse->nVar = 0;
++}
++
++/*
++** This routine is called after a single SQL statement has been
++** parsed and we want to execute the VDBE code to implement 
++** that statement.  Prior action routines should have already
++** constructed VDBE code to do the work of the SQL statement.
++** This routine just has to execute the VDBE code.
++**
++** Note that if an error occurred, it might be the case that
++** no VDBE code was generated.
++*/
++void sqliteExec(Parse *pParse){
++  sqlite *db = pParse->db;
++  Vdbe *v = pParse->pVdbe;
++
++  if( v==0 && (v = sqliteGetVdbe(pParse))!=0 ){
++    sqliteVdbeAddOp(v, OP_Halt, 0, 0);
++  }
++  if( sqlite_malloc_failed ) return;
++  if( v && pParse->nErr==0 ){
++    FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;
++    sqliteVdbeTrace(v, trace);
++    sqliteVdbeMakeReady(v, pParse->nVar, pParse->explain);
++    pParse->rc = pParse->nErr ? SQLITE_ERROR : SQLITE_DONE;
++    pParse->colNamesSet = 0;
++  }else if( pParse->rc==SQLITE_OK ){
++    pParse->rc = SQLITE_ERROR;
++  }
++  pParse->nTab = 0;
++  pParse->nMem = 0;
++  pParse->nSet = 0;
++  pParse->nAgg = 0;
++  pParse->nVar = 0;
++}
++
++/*
++** Locate the in-memory structure that describes 
++** a particular database table given the name
++** of that table and (optionally) the name of the database
++** containing the table.  Return NULL if not found.
++**
++** If zDatabase is 0, all databases are searched for the
++** table and the first matching table is returned.  (No checking
++** for duplicate table names is done.)  The search order is
++** TEMP first, then MAIN, then any auxiliary databases added
++** using the ATTACH command.
++**
++** See also sqliteLocateTable().
++*/
++Table *sqliteFindTable(sqlite *db, const char *zName, const char *zDatabase){
++  Table *p = 0;
++  int i;
++  for(i=0; i<db->nDb; i++){
++    int j = (i<2) ? i^1 : i;   /* Search TEMP before MAIN */
++    if( zDatabase!=0 && sqliteStrICmp(zDatabase, db->aDb[j].zName) ) continue;
++    p = sqliteHashFind(&db->aDb[j].tblHash, zName, strlen(zName)+1);
++    if( p ) break;
++  }
++  return p;
++}
++
++/*
++** Locate the in-memory structure that describes 
++** a particular database table given the name
++** of that table and (optionally) the name of the database
++** containing the table.  Return NULL if not found.
++** Also leave an error message in pParse->zErrMsg.
++**
++** The difference between this routine and sqliteFindTable()
++** is that this routine leaves an error message in pParse->zErrMsg
++** where sqliteFindTable() does not.
++*/
++Table *sqliteLocateTable(Parse *pParse, const char *zName, const char *zDbase){
++  Table *p;
++
++  p = sqliteFindTable(pParse->db, zName, zDbase);
++  if( p==0 ){
++    if( zDbase ){
++      sqliteErrorMsg(pParse, "no such table: %s.%s", zDbase, zName);
++    }else if( sqliteFindTable(pParse->db, zName, 0)!=0 ){
++      sqliteErrorMsg(pParse, "table \"%s\" is not in database \"%s\"",
++         zName, zDbase);
++    }else{
++      sqliteErrorMsg(pParse, "no such table: %s", zName);
++    }
++  }
++  return p;
++}
++
++/*
++** Locate the in-memory structure that describes 
++** a particular index given the name of that index
++** and the name of the database that contains the index.
++** Return NULL if not found.
++**
++** If zDatabase is 0, all databases are searched for the
++** table and the first matching index is returned.  (No checking
++** for duplicate index names is done.)  The search order is
++** TEMP first, then MAIN, then any auxiliary databases added
++** using the ATTACH command.
++*/
++Index *sqliteFindIndex(sqlite *db, const char *zName, const char *zDb){
++  Index *p = 0;
++  int i;
++  for(i=0; i<db->nDb; i++){
++    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */
++    if( zDb && sqliteStrICmp(zDb, db->aDb[j].zName) ) continue;
++    p = sqliteHashFind(&db->aDb[j].idxHash, zName, strlen(zName)+1);
++    if( p ) break;
++  }
++  return p;
++}
++
++/*
++** Remove the given index from the index hash table, and free
++** its memory structures.
++**
++** The index is removed from the database hash tables but
++** it is not unlinked from the Table that it indexes.
++** Unlinking from the Table must be done by the calling function.
++*/
++static void sqliteDeleteIndex(sqlite *db, Index *p){
++  Index *pOld;
++
++  assert( db!=0 && p->zName!=0 );
++  pOld = sqliteHashInsert(&db->aDb[p->iDb].idxHash, p->zName,
++                          strlen(p->zName)+1, 0);
++  if( pOld!=0 && pOld!=p ){
++    sqliteHashInsert(&db->aDb[p->iDb].idxHash, pOld->zName,
++                     strlen(pOld->zName)+1, pOld);
++  }
++  sqliteFree(p);
++}
++
++/*
++** Unlink the given index from its table, then remove
++** the index from the index hash table and free its memory
++** structures.
++*/
++void sqliteUnlinkAndDeleteIndex(sqlite *db, Index *pIndex){
++  if( pIndex->pTable->pIndex==pIndex ){
++    pIndex->pTable->pIndex = pIndex->pNext;
++  }else{
++    Index *p;
++    for(p=pIndex->pTable->pIndex; p && p->pNext!=pIndex; p=p->pNext){}
++    if( p && p->pNext==pIndex ){
++      p->pNext = pIndex->pNext;
++    }
++  }
++  sqliteDeleteIndex(db, pIndex);
++}
++
++/*
++** Erase all schema information from the in-memory hash tables of
++** database connection.  This routine is called to reclaim memory
++** before the connection closes.  It is also called during a rollback
++** if there were schema changes during the transaction.
++**
++** If iDb<=0 then reset the internal schema tables for all database
++** files.  If iDb>=2 then reset the internal schema for only the
++** single file indicated.
++*/
++void sqliteResetInternalSchema(sqlite *db, int iDb){
++  HashElem *pElem;
++  Hash temp1;
++  Hash temp2;
++  int i, j;
++
++  assert( iDb>=0 && iDb<db->nDb );
++  db->flags &= ~SQLITE_Initialized;
++  for(i=iDb; i<db->nDb; i++){
++    Db *pDb = &db->aDb[i];
++    temp1 = pDb->tblHash;
++    temp2 = pDb->trigHash;
++    sqliteHashInit(&pDb->trigHash, SQLITE_HASH_STRING, 0);
++    sqliteHashClear(&pDb->aFKey);
++    sqliteHashClear(&pDb->idxHash);
++    for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
++      Trigger *pTrigger = sqliteHashData(pElem);
++      sqliteDeleteTrigger(pTrigger);
++    }
++    sqliteHashClear(&temp2);
++    sqliteHashInit(&pDb->tblHash, SQLITE_HASH_STRING, 0);
++    for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
++      Table *pTab = sqliteHashData(pElem);
++      sqliteDeleteTable(db, pTab);
++    }
++    sqliteHashClear(&temp1);
++    DbClearProperty(db, i, DB_SchemaLoaded);
++    if( iDb>0 ) return;
++  }
++  assert( iDb==0 );
++  db->flags &= ~SQLITE_InternChanges;
++
++  /* If one or more of the auxiliary database files has been closed,
++  ** then remove then from the auxiliary database list.  We take the
++  ** opportunity to do this here since we have just deleted all of the
++  ** schema hash tables and therefore do not have to make any changes
++  ** to any of those tables.
++  */
++  for(i=0; i<db->nDb; i++){
++    struct Db *pDb = &db->aDb[i];
++    if( pDb->pBt==0 ){
++      if( pDb->pAux && pDb->xFreeAux ) pDb->xFreeAux(pDb->pAux);
++      pDb->pAux = 0;
++    }
++  }
++  for(i=j=2; i<db->nDb; i++){
++    struct Db *pDb = &db->aDb[i];
++    if( pDb->pBt==0 ){
++      sqliteFree(pDb->zName);
++      pDb->zName = 0;
++      continue;
++    }
++    if( j<i ){
++      db->aDb[j] = db->aDb[i];
++    }
++    j++;
++  }
++  memset(&db->aDb[j], 0, (db->nDb-j)*sizeof(db->aDb[j]));
++  db->nDb = j;
++  if( db->nDb<=2 && db->aDb!=db->aDbStatic ){
++    memcpy(db->aDbStatic, db->aDb, 2*sizeof(db->aDb[0]));
++    sqliteFree(db->aDb);
++    db->aDb = db->aDbStatic;
++  }
++}
++
++/*
++** This routine is called whenever a rollback occurs.  If there were
++** schema changes during the transaction, then we have to reset the
++** internal hash tables and reload them from disk.
++*/
++void sqliteRollbackInternalChanges(sqlite *db){
++  if( db->flags & SQLITE_InternChanges ){
++    sqliteResetInternalSchema(db, 0);
++  }
++}
++
++/*
++** This routine is called when a commit occurs.
++*/
++void sqliteCommitInternalChanges(sqlite *db){
++  db->aDb[0].schema_cookie = db->next_cookie;
++  db->flags &= ~SQLITE_InternChanges;
++}
++
++/*
++** Remove the memory data structures associated with the given
++** Table.  No changes are made to disk by this routine.
++**
++** This routine just deletes the data structure.  It does not unlink
++** the table data structure from the hash table.  Nor does it remove
++** foreign keys from the sqlite.aFKey hash table.  But it does destroy
++** memory structures of the indices and foreign keys associated with 
++** the table.
++**
++** Indices associated with the table are unlinked from the "db"
++** data structure if db!=NULL.  If db==NULL, indices attached to
++** the table are deleted, but it is assumed they have already been
++** unlinked.
++*/
++void sqliteDeleteTable(sqlite *db, Table *pTable){
++  int i;
++  Index *pIndex, *pNext;
++  FKey *pFKey, *pNextFKey;
++
++  if( pTable==0 ) return;
++
++  /* Delete all indices associated with this table
++  */
++  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
++    pNext = pIndex->pNext;
++    assert( pIndex->iDb==pTable->iDb || (pTable->iDb==0 && pIndex->iDb==1) );
++    sqliteDeleteIndex(db, pIndex);
++  }
++
++  /* Delete all foreign keys associated with this table.  The keys
++  ** should have already been unlinked from the db->aFKey hash table 
++  */
++  for(pFKey=pTable->pFKey; pFKey; pFKey=pNextFKey){
++    pNextFKey = pFKey->pNextFrom;
++    assert( pTable->iDb<db->nDb );
++    assert( sqliteHashFind(&db->aDb[pTable->iDb].aFKey,
++                           pFKey->zTo, strlen(pFKey->zTo)+1)!=pFKey );
++    sqliteFree(pFKey);
++  }
++
++  /* Delete the Table structure itself.
++  */
++  for(i=0; i<pTable->nCol; i++){
++    sqliteFree(pTable->aCol[i].zName);
++    sqliteFree(pTable->aCol[i].zDflt);
++    sqliteFree(pTable->aCol[i].zType);
++  }
++  sqliteFree(pTable->zName);
++  sqliteFree(pTable->aCol);
++  sqliteSelectDelete(pTable->pSelect);
++  sqliteFree(pTable);
++}
++
++/*
++** Unlink the given table from the hash tables and the delete the
++** table structure with all its indices and foreign keys.
++*/
++static void sqliteUnlinkAndDeleteTable(sqlite *db, Table *p){
++  Table *pOld;
++  FKey *pF1, *pF2;
++  int i = p->iDb;
++  assert( db!=0 );
++  pOld = sqliteHashInsert(&db->aDb[i].tblHash, p->zName, strlen(p->zName)+1, 0);
++  assert( pOld==0 || pOld==p );
++  for(pF1=p->pFKey; pF1; pF1=pF1->pNextFrom){
++    int nTo = strlen(pF1->zTo) + 1;
++    pF2 = sqliteHashFind(&db->aDb[i].aFKey, pF1->zTo, nTo);
++    if( pF2==pF1 ){
++      sqliteHashInsert(&db->aDb[i].aFKey, pF1->zTo, nTo, pF1->pNextTo);
++    }else{
++      while( pF2 && pF2->pNextTo!=pF1 ){ pF2=pF2->pNextTo; }
++      if( pF2 ){
++        pF2->pNextTo = pF1->pNextTo;
++      }
++    }
++  }
++  sqliteDeleteTable(db, p);
++}
++
++/*
++** Construct the name of a user table or index from a token.
++**
++** Space to hold the name is obtained from sqliteMalloc() and must
++** be freed by the calling function.
++*/
++char *sqliteTableNameFromToken(Token *pName){
++  char *zName = sqliteStrNDup(pName->z, pName->n);
++  sqliteDequote(zName);
++  return zName;
++}
++
++/*
++** Generate code to open the appropriate master table.  The table
++** opened will be SQLITE_MASTER for persistent tables and 
++** SQLITE_TEMP_MASTER for temporary tables.  The table is opened
++** on cursor 0.
++*/
++void sqliteOpenMasterTable(Vdbe *v, int isTemp){
++  sqliteVdbeAddOp(v, OP_Integer, isTemp, 0);
++  sqliteVdbeAddOp(v, OP_OpenWrite, 0, 2);
++}
++
++/*
++** Begin constructing a new table representation in memory.  This is
++** the first of several action routines that get called in response
++** to a CREATE TABLE statement.  In particular, this routine is called
++** after seeing tokens "CREATE" and "TABLE" and the table name.  The
++** pStart token is the CREATE and pName is the table name.  The isTemp
++** flag is true if the table should be stored in the auxiliary database
++** file instead of in the main database file.  This is normally the case
++** when the "TEMP" or "TEMPORARY" keyword occurs in between
++** CREATE and TABLE.
++**
++** The new table record is initialized and put in pParse->pNewTable.
++** As more of the CREATE TABLE statement is parsed, additional action
++** routines will be called to add more information to this record.
++** At the end of the CREATE TABLE statement, the sqliteEndTable() routine
++** is called to complete the construction of the new table record.
++*/
++void sqliteStartTable(
++  Parse *pParse,   /* Parser context */
++  Token *pStart,   /* The "CREATE" token */
++  Token *pName,    /* Name of table or view to create */
++  int isTemp,      /* True if this is a TEMP table */
++  int isView       /* True if this is a VIEW */
++){
++  Table *pTable;
++  Index *pIdx;
++  char *zName;
++  sqlite *db = pParse->db;
++  Vdbe *v;
++  int iDb;
++
++  pParse->sFirstToken = *pStart;
++  zName = sqliteTableNameFromToken(pName);
++  if( zName==0 ) return;
++  if( db->init.iDb==1 ) isTemp = 1;
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  assert( (isTemp & 1)==isTemp );
++  {
++    int code;
++    char *zDb = isTemp ? "temp" : "main";
++    if( sqliteAuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){
++      sqliteFree(zName);
++      return;
++    }
++    if( isView ){
++      if( isTemp ){
++        code = SQLITE_CREATE_TEMP_VIEW;
++      }else{
++        code = SQLITE_CREATE_VIEW;
++      }
++    }else{
++      if( isTemp ){
++        code = SQLITE_CREATE_TEMP_TABLE;
++      }else{
++        code = SQLITE_CREATE_TABLE;
++      }
++    }
++    if( sqliteAuthCheck(pParse, code, zName, 0, zDb) ){
++      sqliteFree(zName);
++      return;
++    }
++  }
++#endif
++ 
++
++  /* Before trying to create a temporary table, make sure the Btree for
++  ** holding temporary tables is open.
++  */
++  if( isTemp && db->aDb[1].pBt==0 && !pParse->explain ){
++    int rc = sqliteBtreeFactory(db, 0, 0, MAX_PAGES, &db->aDb[1].pBt);
++    if( rc!=SQLITE_OK ){
++      sqliteErrorMsg(pParse, "unable to open a temporary database "
++        "file for storing temporary tables");
++      pParse->nErr++;
++      return;
++    }
++    if( db->flags & SQLITE_InTrans ){
++      rc = sqliteBtreeBeginTrans(db->aDb[1].pBt);
++      if( rc!=SQLITE_OK ){
++        sqliteErrorMsg(pParse, "unable to get a write lock on "
++          "the temporary database file");
++        return;
++      }
++    }
++  }
++
++  /* Make sure the new table name does not collide with an existing
++  ** index or table name.  Issue an error message if it does.
++  **
++  ** If we are re-reading the sqlite_master table because of a schema
++  ** change and a new permanent table is found whose name collides with
++  ** an existing temporary table, that is not an error.
++  */
++  pTable = sqliteFindTable(db, zName, 0);
++  iDb = isTemp ? 1 : db->init.iDb;
++  if( pTable!=0 && (pTable->iDb==iDb || !db->init.busy) ){
++    sqliteErrorMsg(pParse, "table %T already exists", pName);
++    sqliteFree(zName);
++    return;
++  }
++  if( (pIdx = sqliteFindIndex(db, zName, 0))!=0 &&
++          (pIdx->iDb==0 || !db->init.busy) ){
++    sqliteErrorMsg(pParse, "there is already an index named %s", zName);
++    sqliteFree(zName);
++    return;
++  }
++  pTable = sqliteMalloc( sizeof(Table) );
++  if( pTable==0 ){
++    sqliteFree(zName);
++    return;
++  }
++  pTable->zName = zName;
++  pTable->nCol = 0;
++  pTable->aCol = 0;
++  pTable->iPKey = -1;
++  pTable->pIndex = 0;
++  pTable->iDb = iDb;
++  if( pParse->pNewTable ) sqliteDeleteTable(db, pParse->pNewTable);
++  pParse->pNewTable = pTable;
++
++  /* Begin generating the code that will insert the table record into
++  ** the SQLITE_MASTER table.  Note in particular that we must go ahead
++  ** and allocate the record number for the table entry now.  Before any
++  ** PRIMARY KEY or UNIQUE keywords are parsed.  Those keywords will cause
++  ** indices to be created and the table record must come before the 
++  ** indices.  Hence, the record number for the table must be allocated
++  ** now.
++  */
++  if( !db->init.busy && (v = sqliteGetVdbe(pParse))!=0 ){
++    sqliteBeginWriteOperation(pParse, 0, isTemp);
++    if( !isTemp ){
++      sqliteVdbeAddOp(v, OP_Integer, db->file_format, 0);
++      sqliteVdbeAddOp(v, OP_SetCookie, 0, 1);
++    }
++    sqliteOpenMasterTable(v, isTemp);
++    sqliteVdbeAddOp(v, OP_NewRecno, 0, 0);
++    sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++    sqliteVdbeAddOp(v, OP_String, 0, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, 0, 0);
++  }
++}
++
++/*
++** Add a new column to the table currently being constructed.
++**
++** The parser calls this routine once for each column declaration
++** in a CREATE TABLE statement.  sqliteStartTable() gets called
++** first to get things going.  Then this routine is called for each
++** column.
++*/
++void sqliteAddColumn(Parse *pParse, Token *pName){
++  Table *p;
++  int i;
++  char *z = 0;
++  Column *pCol;
++  if( (p = pParse->pNewTable)==0 ) return;
++  sqliteSetNString(&z, pName->z, pName->n, 0);
++  if( z==0 ) return;
++  sqliteDequote(z);
++  for(i=0; i<p->nCol; i++){
++    if( sqliteStrICmp(z, p->aCol[i].zName)==0 ){
++      sqliteErrorMsg(pParse, "duplicate column name: %s", z);
++      sqliteFree(z);
++      return;
++    }
++  }
++  if( (p->nCol & 0x7)==0 ){
++    Column *aNew;
++    aNew = sqliteRealloc( p->aCol, (p->nCol+8)*sizeof(p->aCol[0]));
++    if( aNew==0 ) return;
++    p->aCol = aNew;
++  }
++  pCol = &p->aCol[p->nCol];
++  memset(pCol, 0, sizeof(p->aCol[0]));
++  pCol->zName = z;
++  pCol->sortOrder = SQLITE_SO_NUM;
++  p->nCol++;
++}
++
++/*
++** This routine is called by the parser while in the middle of
++** parsing a CREATE TABLE statement.  A "NOT NULL" constraint has
++** been seen on a column.  This routine sets the notNull flag on
++** the column currently under construction.
++*/
++void sqliteAddNotNull(Parse *pParse, int onError){
++  Table *p;
++  int i;
++  if( (p = pParse->pNewTable)==0 ) return;
++  i = p->nCol-1;
++  if( i>=0 ) p->aCol[i].notNull = onError;
++}
++
++/*
++** This routine is called by the parser while in the middle of
++** parsing a CREATE TABLE statement.  The pFirst token is the first
++** token in the sequence of tokens that describe the type of the
++** column currently under construction.   pLast is the last token
++** in the sequence.  Use this information to construct a string
++** that contains the typename of the column and store that string
++** in zType.
++*/ 
++void sqliteAddColumnType(Parse *pParse, Token *pFirst, Token *pLast){
++  Table *p;
++  int i, j;
++  int n;
++  char *z, **pz;
++  Column *pCol;
++  if( (p = pParse->pNewTable)==0 ) return;
++  i = p->nCol-1;
++  if( i<0 ) return;
++  pCol = &p->aCol[i];
++  pz = &pCol->zType;
++  n = pLast->n + Addr(pLast->z) - Addr(pFirst->z);
++  sqliteSetNString(pz, pFirst->z, n, 0);
++  z = *pz;
++  if( z==0 ) return;
++  for(i=j=0; z[i]; i++){
++    int c = z[i];
++    if( isspace(c) ) continue;
++    z[j++] = c;
++  }
++  z[j] = 0;
++  if( pParse->db->file_format>=4 ){
++    pCol->sortOrder = sqliteCollateType(z, n);
++  }else{
++    pCol->sortOrder = SQLITE_SO_NUM;
++  }
++}
++
++/*
++** The given token is the default value for the last column added to
++** the table currently under construction.  If "minusFlag" is true, it
++** means the value token was preceded by a minus sign.
++**
++** This routine is called by the parser while in the middle of
++** parsing a CREATE TABLE statement.
++*/
++void sqliteAddDefaultValue(Parse *pParse, Token *pVal, int minusFlag){
++  Table *p;
++  int i;
++  char **pz;
++  if( (p = pParse->pNewTable)==0 ) return;
++  i = p->nCol-1;
++  if( i<0 ) return;
++  pz = &p->aCol[i].zDflt;
++  if( minusFlag ){
++    sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, 0);
++  }else{
++    sqliteSetNString(pz, pVal->z, pVal->n, 0);
++  }
++  sqliteDequote(*pz);
++}
++
++/*
++** Designate the PRIMARY KEY for the table.  pList is a list of names 
++** of columns that form the primary key.  If pList is NULL, then the
++** most recently added column of the table is the primary key.
++**
++** A table can have at most one primary key.  If the table already has
++** a primary key (and this is the second primary key) then create an
++** error.
++**
++** If the PRIMARY KEY is on a single column whose datatype is INTEGER,
++** then we will try to use that column as the row id.  (Exception:
++** For backwards compatibility with older databases, do not do this
++** if the file format version number is less than 1.)  Set the Table.iPKey
++** field of the table under construction to be the index of the
++** INTEGER PRIMARY KEY column.  Table.iPKey is set to -1 if there is
++** no INTEGER PRIMARY KEY.
++**
++** If the key is not an INTEGER PRIMARY KEY, then create a unique
++** index for the key.  No index is created for INTEGER PRIMARY KEYs.
++*/
++void sqliteAddPrimaryKey(Parse *pParse, IdList *pList, int onError){
++  Table *pTab = pParse->pNewTable;
++  char *zType = 0;
++  int iCol = -1, i;
++  if( pTab==0 ) goto primary_key_exit;
++  if( pTab->hasPrimKey ){
++    sqliteErrorMsg(pParse, 
++      "table \"%s\" has more than one primary key", pTab->zName);
++    goto primary_key_exit;
++  }
++  pTab->hasPrimKey = 1;
++  if( pList==0 ){
++    iCol = pTab->nCol - 1;
++    pTab->aCol[iCol].isPrimKey = 1;
++  }else{
++    for(i=0; i<pList->nId; i++){
++      for(iCol=0; iCol<pTab->nCol; iCol++){
++        if( sqliteStrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ) break;
++      }
++      if( iCol<pTab->nCol ) pTab->aCol[iCol].isPrimKey = 1;
++    }
++    if( pList->nId>1 ) iCol = -1;
++  }
++  if( iCol>=0 && iCol<pTab->nCol ){
++    zType = pTab->aCol[iCol].zType;
++  }
++  if( pParse->db->file_format>=1 && 
++           zType && sqliteStrICmp(zType, "INTEGER")==0 ){
++    pTab->iPKey = iCol;
++    pTab->keyConf = onError;
++  }else{
++    sqliteCreateIndex(pParse, 0, 0, pList, onError, 0, 0);
++    pList = 0;
++  }
++
++primary_key_exit:
++  sqliteIdListDelete(pList);
++  return;
++}
++
++/*
++** Return the appropriate collating type given a type name.
++**
++** The collation type is text (SQLITE_SO_TEXT) if the type
++** name contains the character stream "text" or "blob" or
++** "clob".  Any other type name is collated as numeric
++** (SQLITE_SO_NUM).
++*/
++int sqliteCollateType(const char *zType, int nType){
++  int i;
++  for(i=0; i<nType-3; i++){
++    int c = *(zType++) | 0x60;
++    if( (c=='b' || c=='c') && sqliteStrNICmp(zType, "lob", 3)==0 ){
++      return SQLITE_SO_TEXT;
++    }
++    if( c=='c' && sqliteStrNICmp(zType, "har", 3)==0 ){
++      return SQLITE_SO_TEXT;
++    }
++    if( c=='t' && sqliteStrNICmp(zType, "ext", 3)==0 ){
++      return SQLITE_SO_TEXT;
++    }
++  }
++  return SQLITE_SO_NUM;
++}
++
++/*
++** This routine is called by the parser while in the middle of
++** parsing a CREATE TABLE statement.  A "COLLATE" clause has
++** been seen on a column.  This routine sets the Column.sortOrder on
++** the column currently under construction.
++*/
++void sqliteAddCollateType(Parse *pParse, int collType){
++  Table *p;
++  int i;
++  if( (p = pParse->pNewTable)==0 ) return;
++  i = p->nCol-1;
++  if( i>=0 ) p->aCol[i].sortOrder = collType;
++}
++
++/*
++** Come up with a new random value for the schema cookie.  Make sure
++** the new value is different from the old.
++**
++** The schema cookie is used to determine when the schema for the
++** database changes.  After each schema change, the cookie value
++** changes.  When a process first reads the schema it records the
++** cookie.  Thereafter, whenever it goes to access the database,
++** it checks the cookie to make sure the schema has not changed
++** since it was last read.
++**
++** This plan is not completely bullet-proof.  It is possible for
++** the schema to change multiple times and for the cookie to be
++** set back to prior value.  But schema changes are infrequent
++** and the probability of hitting the same cookie value is only
++** 1 chance in 2^32.  So we're safe enough.
++*/
++void sqliteChangeCookie(sqlite *db, Vdbe *v){
++  if( db->next_cookie==db->aDb[0].schema_cookie ){
++    unsigned char r;
++    sqliteRandomness(1, &r);
++    db->next_cookie = db->aDb[0].schema_cookie + r + 1;
++    db->flags |= SQLITE_InternChanges;
++    sqliteVdbeAddOp(v, OP_Integer, db->next_cookie, 0);
++    sqliteVdbeAddOp(v, OP_SetCookie, 0, 0);
++  }
++}
++
++/*
++** Measure the number of characters needed to output the given
++** identifier.  The number returned includes any quotes used
++** but does not include the null terminator.
++*/
++static int identLength(const char *z){
++  int n;
++  int needQuote = 0;
++  for(n=0; *z; n++, z++){
++    if( *z=='\'' ){ n++; needQuote=1; }
++  }
++  return n + needQuote*2;
++}
++
++/*
++** Write an identifier onto the end of the given string.  Add
++** quote characters as needed.
++*/
++static void identPut(char *z, int *pIdx, char *zIdent){
++  int i, j, needQuote;
++  i = *pIdx;
++  for(j=0; zIdent[j]; j++){
++    if( !isalnum(zIdent[j]) && zIdent[j]!='_' ) break;
++  }
++  needQuote =  zIdent[j]!=0 || isdigit(zIdent[0])
++                  || sqliteKeywordCode(zIdent, j)!=TK_ID;
++  if( needQuote ) z[i++] = '\'';
++  for(j=0; zIdent[j]; j++){
++    z[i++] = zIdent[j];
++    if( zIdent[j]=='\'' ) z[i++] = '\'';
++  }
++  if( needQuote ) z[i++] = '\'';
++  z[i] = 0;
++  *pIdx = i;
++}
++
++/*
++** Generate a CREATE TABLE statement appropriate for the given
++** table.  Memory to hold the text of the statement is obtained
++** from sqliteMalloc() and must be freed by the calling function.
++*/
++static char *createTableStmt(Table *p){
++  int i, k, n;
++  char *zStmt;
++  char *zSep, *zSep2, *zEnd;
++  n = 0;
++  for(i=0; i<p->nCol; i++){
++    n += identLength(p->aCol[i].zName);
++  }
++  n += identLength(p->zName);
++  if( n<40 ){
++    zSep = "";
++    zSep2 = ",";
++    zEnd = ")";
++  }else{
++    zSep = "\n  ";
++    zSep2 = ",\n  ";
++    zEnd = "\n)";
++  }
++  n += 35 + 6*p->nCol;
++  zStmt = sqliteMallocRaw( n );
++  if( zStmt==0 ) return 0;
++  strcpy(zStmt, p->iDb==1 ? "CREATE TEMP TABLE " : "CREATE TABLE ");
++  k = strlen(zStmt);
++  identPut(zStmt, &k, p->zName);
++  zStmt[k++] = '(';
++  for(i=0; i<p->nCol; i++){
++    strcpy(&zStmt[k], zSep);
++    k += strlen(&zStmt[k]);
++    zSep = zSep2;
++    identPut(zStmt, &k, p->aCol[i].zName);
++  }
++  strcpy(&zStmt[k], zEnd);
++  return zStmt;
++}
++
++/*
++** This routine is called to report the final ")" that terminates
++** a CREATE TABLE statement.
++**
++** The table structure that other action routines have been building
++** is added to the internal hash tables, assuming no errors have
++** occurred.
++**
++** An entry for the table is made in the master table on disk, unless
++** this is a temporary table or db->init.busy==1.  When db->init.busy==1
++** it means we are reading the sqlite_master table because we just
++** connected to the database or because the sqlite_master table has
++** recently changes, so the entry for this table already exists in
++** the sqlite_master table.  We do not want to create it again.
++**
++** If the pSelect argument is not NULL, it means that this routine
++** was called to create a table generated from a 
++** "CREATE TABLE ... AS SELECT ..." statement.  The column names of
++** the new table will match the result set of the SELECT.
++*/
++void sqliteEndTable(Parse *pParse, Token *pEnd, Select *pSelect){
++  Table *p;
++  sqlite *db = pParse->db;
++
++  if( (pEnd==0 && pSelect==0) || pParse->nErr || sqlite_malloc_failed ) return;
++  p = pParse->pNewTable;
++  if( p==0 ) return;
++
++  /* If the table is generated from a SELECT, then construct the
++  ** list of columns and the text of the table.
++  */
++  if( pSelect ){
++    Table *pSelTab = sqliteResultSetOfSelect(pParse, 0, pSelect);
++    if( pSelTab==0 ) return;
++    assert( p->aCol==0 );
++    p->nCol = pSelTab->nCol;
++    p->aCol = pSelTab->aCol;
++    pSelTab->nCol = 0;
++    pSelTab->aCol = 0;
++    sqliteDeleteTable(0, pSelTab);
++  }
++
++  /* If the db->init.busy is 1 it means we are reading the SQL off the
++  ** "sqlite_master" or "sqlite_temp_master" table on the disk.
++  ** So do not write to the disk again.  Extract the root page number
++  ** for the table from the db->init.newTnum field.  (The page number
++  ** should have been put there by the sqliteOpenCb routine.)
++  */
++  if( db->init.busy ){
++    p->tnum = db->init.newTnum;
++  }
++
++  /* If not initializing, then create a record for the new table
++  ** in the SQLITE_MASTER table of the database.  The record number
++  ** for the new table entry should already be on the stack.
++  **
++  ** If this is a TEMPORARY table, write the entry into the auxiliary
++  ** file instead of into the main database file.
++  */
++  if( !db->init.busy ){
++    int n;
++    Vdbe *v;
++
++    v = sqliteGetVdbe(pParse);
++    if( v==0 ) return;
++    if( p->pSelect==0 ){
++      /* A regular table */
++      sqliteVdbeOp3(v, OP_CreateTable, 0, p->iDb, (char*)&p->tnum, P3_POINTER);
++    }else{
++      /* A view */
++      sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++    }
++    p->tnum = 0;
++    sqliteVdbeAddOp(v, OP_Pull, 1, 0);
++    sqliteVdbeOp3(v, OP_String, 0, 0, p->pSelect==0?"table":"view", P3_STATIC);
++    sqliteVdbeOp3(v, OP_String, 0, 0, p->zName, 0);
++    sqliteVdbeOp3(v, OP_String, 0, 0, p->zName, 0);
++    sqliteVdbeAddOp(v, OP_Dup, 4, 0);
++    sqliteVdbeAddOp(v, OP_String, 0, 0);
++    if( pSelect ){
++      char *z = createTableStmt(p);
++      n = z ? strlen(z) : 0;
++      sqliteVdbeChangeP3(v, -1, z, n);
++      sqliteFree(z);
++    }else{
++      assert( pEnd!=0 );
++      n = Addr(pEnd->z) - Addr(pParse->sFirstToken.z) + 1;
++      sqliteVdbeChangeP3(v, -1, pParse->sFirstToken.z, n);
++    }
++    sqliteVdbeAddOp(v, OP_MakeRecord, 5, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, 0, 0);
++    if( !p->iDb ){
++      sqliteChangeCookie(db, v);
++    }
++    sqliteVdbeAddOp(v, OP_Close, 0, 0);
++    if( pSelect ){
++      sqliteVdbeAddOp(v, OP_Integer, p->iDb, 0);
++      sqliteVdbeAddOp(v, OP_OpenWrite, 1, 0);
++      pParse->nTab = 2;
++      sqliteSelect(pParse, pSelect, SRT_Table, 1, 0, 0, 0);
++    }
++    sqliteEndWriteOperation(pParse);
++  }
++
++  /* Add the table to the in-memory representation of the database.
++  */
++  if( pParse->explain==0 && pParse->nErr==0 ){
++    Table *pOld;
++    FKey *pFKey;
++    pOld = sqliteHashInsert(&db->aDb[p->iDb].tblHash, 
++                            p->zName, strlen(p->zName)+1, p);
++    if( pOld ){
++      assert( p==pOld );  /* Malloc must have failed inside HashInsert() */
++      return;
++    }
++    for(pFKey=p->pFKey; pFKey; pFKey=pFKey->pNextFrom){
++      int nTo = strlen(pFKey->zTo) + 1;
++      pFKey->pNextTo = sqliteHashFind(&db->aDb[p->iDb].aFKey, pFKey->zTo, nTo);
++      sqliteHashInsert(&db->aDb[p->iDb].aFKey, pFKey->zTo, nTo, pFKey);
++    }
++    pParse->pNewTable = 0;
++    db->nTable++;
++    db->flags |= SQLITE_InternChanges;
++  }
++}
++
++/*
++** The parser calls this routine in order to create a new VIEW
++*/
++void sqliteCreateView(
++  Parse *pParse,     /* The parsing context */
++  Token *pBegin,     /* The CREATE token that begins the statement */
++  Token *pName,      /* The token that holds the name of the view */
++  Select *pSelect,   /* A SELECT statement that will become the new view */
++  int isTemp         /* TRUE for a TEMPORARY view */
++){
++  Table *p;
++  int n;
++  const char *z;
++  Token sEnd;
++  DbFixer sFix;
++
++  sqliteStartTable(pParse, pBegin, pName, isTemp, 1);
++  p = pParse->pNewTable;
++  if( p==0 || pParse->nErr ){
++    sqliteSelectDelete(pSelect);
++    return;
++  }
++  if( sqliteFixInit(&sFix, pParse, p->iDb, "view", pName)
++    && sqliteFixSelect(&sFix, pSelect)
++  ){
++    sqliteSelectDelete(pSelect);
++    return;
++  }
++
++  /* Make a copy of the entire SELECT statement that defines the view.
++  ** This will force all the Expr.token.z values to be dynamically
++  ** allocated rather than point to the input string - which means that
++  ** they will persist after the current sqlite_exec() call returns.
++  */
++  p->pSelect = sqliteSelectDup(pSelect);
++  sqliteSelectDelete(pSelect);
++  if( !pParse->db->init.busy ){
++    sqliteViewGetColumnNames(pParse, p);
++  }
++
++  /* Locate the end of the CREATE VIEW statement.  Make sEnd point to
++  ** the end.
++  */
++  sEnd = pParse->sLastToken;
++  if( sEnd.z[0]!=0 && sEnd.z[0]!=';' ){
++    sEnd.z += sEnd.n;
++  }
++  sEnd.n = 0;
++  n = sEnd.z - pBegin->z;
++  z = pBegin->z;
++  while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; }
++  sEnd.z = &z[n-1];
++  sEnd.n = 1;
++
++  /* Use sqliteEndTable() to add the view to the SQLITE_MASTER table */
++  sqliteEndTable(pParse, &sEnd, 0);
++  return;
++}
++
++/*
++** The Table structure pTable is really a VIEW.  Fill in the names of
++** the columns of the view in the pTable structure.  Return the number
++** of errors.  If an error is seen leave an error message in pParse->zErrMsg.
++*/
++int sqliteViewGetColumnNames(Parse *pParse, Table *pTable){
++  ExprList *pEList;
++  Select *pSel;
++  Table *pSelTab;
++  int nErr = 0;
++
++  assert( pTable );
++
++  /* A positive nCol means the columns names for this view are
++  ** already known.
++  */
++  if( pTable->nCol>0 ) return 0;
++
++  /* A negative nCol is a special marker meaning that we are currently
++  ** trying to compute the column names.  If we enter this routine with
++  ** a negative nCol, it means two or more views form a loop, like this:
++  **
++  **     CREATE VIEW one AS SELECT * FROM two;
++  **     CREATE VIEW two AS SELECT * FROM one;
++  **
++  ** Actually, this error is caught previously and so the following test
++  ** should always fail.  But we will leave it in place just to be safe.
++  */
++  if( pTable->nCol<0 ){
++    sqliteErrorMsg(pParse, "view %s is circularly defined", pTable->zName);
++    return 1;
++  }
++
++  /* If we get this far, it means we need to compute the table names.
++  */
++  assert( pTable->pSelect ); /* If nCol==0, then pTable must be a VIEW */
++  pSel = pTable->pSelect;
++
++  /* Note that the call to sqliteResultSetOfSelect() will expand any
++  ** "*" elements in this list.  But we will need to restore the list
++  ** back to its original configuration afterwards, so we save a copy of
++  ** the original in pEList.
++  */
++  pEList = pSel->pEList;
++  pSel->pEList = sqliteExprListDup(pEList);
++  if( pSel->pEList==0 ){
++    pSel->pEList = pEList;
++    return 1;  /* Malloc failed */
++  }
++  pTable->nCol = -1;
++  pSelTab = sqliteResultSetOfSelect(pParse, 0, pSel);
++  if( pSelTab ){
++    assert( pTable->aCol==0 );
++    pTable->nCol = pSelTab->nCol;
++    pTable->aCol = pSelTab->aCol;
++    pSelTab->nCol = 0;
++    pSelTab->aCol = 0;
++    sqliteDeleteTable(0, pSelTab);
++    DbSetProperty(pParse->db, pTable->iDb, DB_UnresetViews);
++  }else{
++    pTable->nCol = 0;
++    nErr++;
++  }
++  sqliteSelectUnbind(pSel);
++  sqliteExprListDelete(pSel->pEList);
++  pSel->pEList = pEList;
++  return nErr;  
++}
++
++/*
++** Clear the column names from the VIEW pTable.
++**
++** This routine is called whenever any other table or view is modified.
++** The view passed into this routine might depend directly or indirectly
++** on the modified or deleted table so we need to clear the old column
++** names so that they will be recomputed.
++*/
++static void sqliteViewResetColumnNames(Table *pTable){
++  int i;
++  Column *pCol;
++  assert( pTable!=0 && pTable->pSelect!=0 );
++  for(i=0, pCol=pTable->aCol; i<pTable->nCol; i++, pCol++){
++    sqliteFree(pCol->zName);
++    sqliteFree(pCol->zDflt);
++    sqliteFree(pCol->zType);
++  }
++  sqliteFree(pTable->aCol);
++  pTable->aCol = 0;
++  pTable->nCol = 0;
++}
++
++/*
++** Clear the column names from every VIEW in database idx.
++*/
++static void sqliteViewResetAll(sqlite *db, int idx){
++  HashElem *i;
++  if( !DbHasProperty(db, idx, DB_UnresetViews) ) return;
++  for(i=sqliteHashFirst(&db->aDb[idx].tblHash); i; i=sqliteHashNext(i)){
++    Table *pTab = sqliteHashData(i);
++    if( pTab->pSelect ){
++      sqliteViewResetColumnNames(pTab);
++    }
++  }
++  DbClearProperty(db, idx, DB_UnresetViews);
++}
++
++/*
++** Given a token, look up a table with that name.  If not found, leave
++** an error for the parser to find and return NULL.
++*/
++Table *sqliteTableFromToken(Parse *pParse, Token *pTok){
++  char *zName;
++  Table *pTab;
++  zName = sqliteTableNameFromToken(pTok);
++  if( zName==0 ) return 0;
++  pTab = sqliteFindTable(pParse->db, zName, 0);
++  sqliteFree(zName);
++  if( pTab==0 ){
++    sqliteErrorMsg(pParse, "no such table: %T", pTok);
++  }
++  return pTab;
++}
++
++/*
++** This routine is called to do the work of a DROP TABLE statement.
++** pName is the name of the table to be dropped.
++*/
++void sqliteDropTable(Parse *pParse, Token *pName, int isView){
++  Table *pTable;
++  Vdbe *v;
++  int base;
++  sqlite *db = pParse->db;
++  int iDb;
++
++  if( pParse->nErr || sqlite_malloc_failed ) return;
++  pTable = sqliteTableFromToken(pParse, pName);
++  if( pTable==0 ) return;
++  iDb = pTable->iDb;
++  assert( iDb>=0 && iDb<db->nDb );
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  {
++    int code;
++    const char *zTab = SCHEMA_TABLE(pTable->iDb);
++    const char *zDb = db->aDb[pTable->iDb].zName;
++    if( sqliteAuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){
++      return;
++    }
++    if( isView ){
++      if( iDb==1 ){
++        code = SQLITE_DROP_TEMP_VIEW;
++      }else{
++        code = SQLITE_DROP_VIEW;
++      }
++    }else{
++      if( iDb==1 ){
++        code = SQLITE_DROP_TEMP_TABLE;
++      }else{
++        code = SQLITE_DROP_TABLE;
++      }
++    }
++    if( sqliteAuthCheck(pParse, code, pTable->zName, 0, zDb) ){
++      return;
++    }
++    if( sqliteAuthCheck(pParse, SQLITE_DELETE, pTable->zName, 0, zDb) ){
++      return;
++    }
++  }
++#endif
++  if( pTable->readOnly ){
++    sqliteErrorMsg(pParse, "table %s may not be dropped", pTable->zName);
++    pParse->nErr++;
++    return;
++  }
++  if( isView && pTable->pSelect==0 ){
++    sqliteErrorMsg(pParse, "use DROP TABLE to delete table %s", pTable->zName);
++    return;
++  }
++  if( !isView && pTable->pSelect ){
++    sqliteErrorMsg(pParse, "use DROP VIEW to delete view %s", pTable->zName);
++    return;
++  }
++
++  /* Generate code to remove the table from the master table
++  ** on disk.
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v ){
++    static VdbeOpList dropTable[] = {
++      { OP_Rewind,     0, ADDR(8),  0},
++      { OP_String,     0, 0,        0}, /* 1 */
++      { OP_MemStore,   1, 1,        0},
++      { OP_MemLoad,    1, 0,        0}, /* 3 */
++      { OP_Column,     0, 2,        0},
++      { OP_Ne,         0, ADDR(7),  0},
++      { OP_Delete,     0, 0,        0},
++      { OP_Next,       0, ADDR(3),  0}, /* 7 */
++    };
++    Index *pIdx;
++    Trigger *pTrigger;
++    sqliteBeginWriteOperation(pParse, 0, pTable->iDb);
++
++    /* Drop all triggers associated with the table being dropped */
++    pTrigger = pTable->pTrigger;
++    while( pTrigger ){
++      assert( pTrigger->iDb==pTable->iDb || pTrigger->iDb==1 );
++      sqliteDropTriggerPtr(pParse, pTrigger, 1);
++      if( pParse->explain ){
++        pTrigger = pTrigger->pNext;
++      }else{
++        pTrigger = pTable->pTrigger;
++      }
++    }
++
++    /* Drop all SQLITE_MASTER entries that refer to the table */
++    sqliteOpenMasterTable(v, pTable->iDb);
++    base = sqliteVdbeAddOpList(v, ArraySize(dropTable), dropTable);
++    sqliteVdbeChangeP3(v, base+1, pTable->zName, 0);
++
++    /* Drop all SQLITE_TEMP_MASTER entries that refer to the table */
++    if( pTable->iDb!=1 ){
++      sqliteOpenMasterTable(v, 1);
++      base = sqliteVdbeAddOpList(v, ArraySize(dropTable), dropTable);
++      sqliteVdbeChangeP3(v, base+1, pTable->zName, 0);
++    }
++
++    if( pTable->iDb==0 ){
++      sqliteChangeCookie(db, v);
++    }
++    sqliteVdbeAddOp(v, OP_Close, 0, 0);
++    if( !isView ){
++      sqliteVdbeAddOp(v, OP_Destroy, pTable->tnum, pTable->iDb);
++      for(pIdx=pTable->pIndex; pIdx; pIdx=pIdx->pNext){
++        sqliteVdbeAddOp(v, OP_Destroy, pIdx->tnum, pIdx->iDb);
++      }
++    }
++    sqliteEndWriteOperation(pParse);
++  }
++
++  /* Delete the in-memory description of the table.
++  **
++  ** Exception: if the SQL statement began with the EXPLAIN keyword,
++  ** then no changes should be made.
++  */
++  if( !pParse->explain ){
++    sqliteUnlinkAndDeleteTable(db, pTable);
++    db->flags |= SQLITE_InternChanges;
++  }
++  sqliteViewResetAll(db, iDb);
++}
++
++/*
++** This routine constructs a P3 string suitable for an OP_MakeIdxKey
++** opcode and adds that P3 string to the most recently inserted instruction
++** in the virtual machine.  The P3 string consists of a single character
++** for each column in the index pIdx of table pTab.  If the column uses
++** a numeric sort order, then the P3 string character corresponding to
++** that column is 'n'.  If the column uses a text sort order, then the
++** P3 string is 't'.  See the OP_MakeIdxKey opcode documentation for
++** additional information.  See also the sqliteAddKeyType() routine.
++*/
++void sqliteAddIdxKeyType(Vdbe *v, Index *pIdx){
++  char *zType;
++  Table *pTab;
++  int i, n;
++  assert( pIdx!=0 && pIdx->pTable!=0 );
++  pTab = pIdx->pTable;
++  n = pIdx->nColumn;
++  zType = sqliteMallocRaw( n+1 );
++  if( zType==0 ) return;
++  for(i=0; i<n; i++){
++    int iCol = pIdx->aiColumn[i];
++    assert( iCol>=0 && iCol<pTab->nCol );
++    if( (pTab->aCol[iCol].sortOrder & SQLITE_SO_TYPEMASK)==SQLITE_SO_TEXT ){
++      zType[i] = 't';
++    }else{
++      zType[i] = 'n';
++    }
++  }
++  zType[n] = 0;
++  sqliteVdbeChangeP3(v, -1, zType, n);
++  sqliteFree(zType);
++}
++
++/*
++** This routine is called to create a new foreign key on the table
++** currently under construction.  pFromCol determines which columns
++** in the current table point to the foreign key.  If pFromCol==0 then
++** connect the key to the last column inserted.  pTo is the name of
++** the table referred to.  pToCol is a list of tables in the other
++** pTo table that the foreign key points to.  flags contains all
++** information about the conflict resolution algorithms specified
++** in the ON DELETE, ON UPDATE and ON INSERT clauses.
++**
++** An FKey structure is created and added to the table currently
++** under construction in the pParse->pNewTable field.  The new FKey
++** is not linked into db->aFKey at this point - that does not happen
++** until sqliteEndTable().
++**
++** The foreign key is set for IMMEDIATE processing.  A subsequent call
++** to sqliteDeferForeignKey() might change this to DEFERRED.
++*/
++void sqliteCreateForeignKey(
++  Parse *pParse,       /* Parsing context */
++  IdList *pFromCol,    /* Columns in this table that point to other table */
++  Token *pTo,          /* Name of the other table */
++  IdList *pToCol,      /* Columns in the other table */
++  int flags            /* Conflict resolution algorithms. */
++){
++  Table *p = pParse->pNewTable;
++  int nByte;
++  int i;
++  int nCol;
++  char *z;
++  FKey *pFKey = 0;
++
++  assert( pTo!=0 );
++  if( p==0 || pParse->nErr ) goto fk_end;
++  if( pFromCol==0 ){
++    int iCol = p->nCol-1;
++    if( iCol<0 ) goto fk_end;
++    if( pToCol && pToCol->nId!=1 ){
++      sqliteErrorMsg(pParse, "foreign key on %s"
++         " should reference only one column of table %T",
++         p->aCol[iCol].zName, pTo);
++      goto fk_end;
++    }
++    nCol = 1;
++  }else if( pToCol && pToCol->nId!=pFromCol->nId ){
++    sqliteErrorMsg(pParse,
++        "number of columns in foreign key does not match the number of "
++        "columns in the referenced table");
++    goto fk_end;
++  }else{
++    nCol = pFromCol->nId;
++  }
++  nByte = sizeof(*pFKey) + nCol*sizeof(pFKey->aCol[0]) + pTo->n + 1;
++  if( pToCol ){
++    for(i=0; i<pToCol->nId; i++){
++      nByte += strlen(pToCol->a[i].zName) + 1;
++    }
++  }
++  pFKey = sqliteMalloc( nByte );
++  if( pFKey==0 ) goto fk_end;
++  pFKey->pFrom = p;
++  pFKey->pNextFrom = p->pFKey;
++  z = (char*)&pFKey[1];
++  pFKey->aCol = (struct sColMap*)z;
++  z += sizeof(struct sColMap)*nCol;
++  pFKey->zTo = z;
++  memcpy(z, pTo->z, pTo->n);
++  z[pTo->n] = 0;
++  z += pTo->n+1;
++  pFKey->pNextTo = 0;
++  pFKey->nCol = nCol;
++  if( pFromCol==0 ){
++    pFKey->aCol[0].iFrom = p->nCol-1;
++  }else{
++    for(i=0; i<nCol; i++){
++      int j;
++      for(j=0; j<p->nCol; j++){
++        if( sqliteStrICmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){
++          pFKey->aCol[i].iFrom = j;
++          break;
++        }
++      }
++      if( j>=p->nCol ){
++        sqliteErrorMsg(pParse, 
++          "unknown column \"%s\" in foreign key definition", 
++          pFromCol->a[i].zName);
++        goto fk_end;
++      }
++    }
++  }
++  if( pToCol ){
++    for(i=0; i<nCol; i++){
++      int n = strlen(pToCol->a[i].zName);
++      pFKey->aCol[i].zCol = z;
++      memcpy(z, pToCol->a[i].zName, n);
++      z[n] = 0;
++      z += n+1;
++    }
++  }
++  pFKey->isDeferred = 0;
++  pFKey->deleteConf = flags & 0xff;
++  pFKey->updateConf = (flags >> 8 ) & 0xff;
++  pFKey->insertConf = (flags >> 16 ) & 0xff;
++
++  /* Link the foreign key to the table as the last step.
++  */
++  p->pFKey = pFKey;
++  pFKey = 0;
++
++fk_end:
++  sqliteFree(pFKey);
++  sqliteIdListDelete(pFromCol);
++  sqliteIdListDelete(pToCol);
++}
++
++/*
++** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED
++** clause is seen as part of a foreign key definition.  The isDeferred
++** parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE.
++** The behavior of the most recently created foreign key is adjusted
++** accordingly.
++*/
++void sqliteDeferForeignKey(Parse *pParse, int isDeferred){
++  Table *pTab;
++  FKey *pFKey;
++  if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
++  pFKey->isDeferred = isDeferred;
++}
++
++/*
++** Create a new index for an SQL table.  pIndex is the name of the index 
++** and pTable is the name of the table that is to be indexed.  Both will 
++** be NULL for a primary key or an index that is created to satisfy a
++** UNIQUE constraint.  If pTable and pIndex are NULL, use pParse->pNewTable
++** as the table to be indexed.  pParse->pNewTable is a table that is
++** currently being constructed by a CREATE TABLE statement.
++**
++** pList is a list of columns to be indexed.  pList will be NULL if this
++** is a primary key or unique-constraint on the most recent column added
++** to the table currently under construction.  
++*/
++void sqliteCreateIndex(
++  Parse *pParse,   /* All information about this parse */
++  Token *pName,    /* Name of the index.  May be NULL */
++  SrcList *pTable, /* Name of the table to index.  Use pParse->pNewTable if 0 */
++  IdList *pList,   /* A list of columns to be indexed */
++  int onError,     /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
++  Token *pStart,   /* The CREATE token that begins a CREATE TABLE statement */
++  Token *pEnd      /* The ")" that closes the CREATE INDEX statement */
++){
++  Table *pTab;     /* Table to be indexed */
++  Index *pIndex;   /* The index to be created */
++  char *zName = 0;
++  int i, j;
++  Token nullId;    /* Fake token for an empty ID list */
++  DbFixer sFix;    /* For assigning database names to pTable */
++  int isTemp;      /* True for a temporary index */
++  sqlite *db = pParse->db;
++
++  if( pParse->nErr || sqlite_malloc_failed ) goto exit_create_index;
++  if( db->init.busy 
++     && sqliteFixInit(&sFix, pParse, db->init.iDb, "index", pName)
++     && sqliteFixSrcList(&sFix, pTable)
++  ){
++    goto exit_create_index;
++  }
++
++  /*
++  ** Find the table that is to be indexed.  Return early if not found.
++  */
++  if( pTable!=0 ){
++    assert( pName!=0 );
++    assert( pTable->nSrc==1 );
++    pTab =  sqliteSrcListLookup(pParse, pTable);
++  }else{
++    assert( pName==0 );
++    pTab =  pParse->pNewTable;
++  }
++  if( pTab==0 || pParse->nErr ) goto exit_create_index;
++  if( pTab->readOnly ){
++    sqliteErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
++    goto exit_create_index;
++  }
++  if( pTab->iDb>=2 && db->init.busy==0 ){
++    sqliteErrorMsg(pParse, "table %s may not have indices added", pTab->zName);
++    goto exit_create_index;
++  }
++  if( pTab->pSelect ){
++    sqliteErrorMsg(pParse, "views may not be indexed");
++    goto exit_create_index;
++  }
++  isTemp = pTab->iDb==1;
++
++  /*
++  ** Find the name of the index.  Make sure there is not already another
++  ** index or table with the same name.  
++  **
++  ** Exception:  If we are reading the names of permanent indices from the
++  ** sqlite_master table (because some other process changed the schema) and
++  ** one of the index names collides with the name of a temporary table or
++  ** index, then we will continue to process this index.
++  **
++  ** If pName==0 it means that we are
++  ** dealing with a primary key or UNIQUE constraint.  We have to invent our
++  ** own name.
++  */
++  if( pName && !db->init.busy ){
++    Index *pISameName;    /* Another index with the same name */
++    Table *pTSameName;    /* A table with same name as the index */
++    zName = sqliteTableNameFromToken(pName);
++    if( zName==0 ) goto exit_create_index;
++    if( (pISameName = sqliteFindIndex(db, zName, 0))!=0 ){
++      sqliteErrorMsg(pParse, "index %s already exists", zName);
++      goto exit_create_index;
++    }
++    if( (pTSameName = sqliteFindTable(db, zName, 0))!=0 ){
++      sqliteErrorMsg(pParse, "there is already a table named %s", zName);
++      goto exit_create_index;
++    }
++  }else if( pName==0 ){
++    char zBuf[30];
++    int n;
++    Index *pLoop;
++    for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
++    sprintf(zBuf,"%d)",n);
++    zName = 0;
++    sqliteSetString(&zName, "(", pTab->zName, " autoindex ", zBuf, (char*)0);
++    if( zName==0 ) goto exit_create_index;
++  }else{
++    zName = sqliteTableNameFromToken(pName);
++  }
++
++  /* Check for authorization to create an index.
++  */
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  {
++    const char *zDb = db->aDb[pTab->iDb].zName;
++
++    assert( pTab->iDb==db->init.iDb || isTemp );
++    if( sqliteAuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){
++      goto exit_create_index;
++    }
++    i = SQLITE_CREATE_INDEX;
++    if( isTemp ) i = SQLITE_CREATE_TEMP_INDEX;
++    if( sqliteAuthCheck(pParse, i, zName, pTab->zName, zDb) ){
++      goto exit_create_index;
++    }
++  }
++#endif
++
++  /* If pList==0, it means this routine was called to make a primary
++  ** key out of the last column added to the table under construction.
++  ** So create a fake list to simulate this.
++  */
++  if( pList==0 ){
++    nullId.z = pTab->aCol[pTab->nCol-1].zName;
++    nullId.n = strlen(nullId.z);
++    pList = sqliteIdListAppend(0, &nullId);
++    if( pList==0 ) goto exit_create_index;
++  }
++
++  /* 
++  ** Allocate the index structure. 
++  */
++  pIndex = sqliteMalloc( sizeof(Index) + strlen(zName) + 1 +
++                        sizeof(int)*pList->nId );
++  if( pIndex==0 ) goto exit_create_index;
++  pIndex->aiColumn = (int*)&pIndex[1];
++  pIndex->zName = (char*)&pIndex->aiColumn[pList->nId];
++  strcpy(pIndex->zName, zName);
++  pIndex->pTable = pTab;
++  pIndex->nColumn = pList->nId;
++  pIndex->onError = onError;
++  pIndex->autoIndex = pName==0;
++  pIndex->iDb = isTemp ? 1 : db->init.iDb;
++
++  /* Scan the names of the columns of the table to be indexed and
++  ** load the column indices into the Index structure.  Report an error
++  ** if any column is not found.
++  */
++  for(i=0; i<pList->nId; i++){
++    for(j=0; j<pTab->nCol; j++){
++      if( sqliteStrICmp(pList->a[i].zName, pTab->aCol[j].zName)==0 ) break;
++    }
++    if( j>=pTab->nCol ){
++      sqliteErrorMsg(pParse, "table %s has no column named %s",
++        pTab->zName, pList->a[i].zName);
++      sqliteFree(pIndex);
++      goto exit_create_index;
++    }
++    pIndex->aiColumn[i] = j;
++  }
++
++  /* Link the new Index structure to its table and to the other
++  ** in-memory database structures. 
++  */
++  if( !pParse->explain ){
++    Index *p;
++    p = sqliteHashInsert(&db->aDb[pIndex->iDb].idxHash, 
++                         pIndex->zName, strlen(pIndex->zName)+1, pIndex);
++    if( p ){
++      assert( p==pIndex );  /* Malloc must have failed */
++      sqliteFree(pIndex);
++      goto exit_create_index;
++    }
++    db->flags |= SQLITE_InternChanges;
++  }
++
++  /* When adding an index to the list of indices for a table, make
++  ** sure all indices labeled OE_Replace come after all those labeled
++  ** OE_Ignore.  This is necessary for the correct operation of UPDATE
++  ** and INSERT.
++  */
++  if( onError!=OE_Replace || pTab->pIndex==0
++       || pTab->pIndex->onError==OE_Replace){
++    pIndex->pNext = pTab->pIndex;
++    pTab->pIndex = pIndex;
++  }else{
++    Index *pOther = pTab->pIndex;
++    while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){
++      pOther = pOther->pNext;
++    }
++    pIndex->pNext = pOther->pNext;
++    pOther->pNext = pIndex;
++  }
++
++  /* If the db->init.busy is 1 it means we are reading the SQL off the
++  ** "sqlite_master" table on the disk.  So do not write to the disk
++  ** again.  Extract the table number from the db->init.newTnum field.
++  */
++  if( db->init.busy && pTable!=0 ){
++    pIndex->tnum = db->init.newTnum;
++  }
++
++  /* If the db->init.busy is 0 then create the index on disk.  This
++  ** involves writing the index into the master table and filling in the
++  ** index with the current table contents.
++  **
++  ** The db->init.busy is 0 when the user first enters a CREATE INDEX 
++  ** command.  db->init.busy is 1 when a database is opened and 
++  ** CREATE INDEX statements are read out of the master table.  In
++  ** the latter case the index already exists on disk, which is why
++  ** we don't want to recreate it.
++  **
++  ** If pTable==0 it means this index is generated as a primary key
++  ** or UNIQUE constraint of a CREATE TABLE statement.  Since the table
++  ** has just been created, it contains no data and the index initialization
++  ** step can be skipped.
++  */
++  else if( db->init.busy==0 ){
++    int n;
++    Vdbe *v;
++    int lbl1, lbl2;
++    int i;
++    int addr;
++
++    v = sqliteGetVdbe(pParse);
++    if( v==0 ) goto exit_create_index;
++    if( pTable!=0 ){
++      sqliteBeginWriteOperation(pParse, 0, isTemp);
++      sqliteOpenMasterTable(v, isTemp);
++    }
++    sqliteVdbeAddOp(v, OP_NewRecno, 0, 0);
++    sqliteVdbeOp3(v, OP_String, 0, 0, "index", P3_STATIC);
++    sqliteVdbeOp3(v, OP_String, 0, 0, pIndex->zName, 0);
++    sqliteVdbeOp3(v, OP_String, 0, 0, pTab->zName, 0);
++    sqliteVdbeOp3(v, OP_CreateIndex, 0, isTemp,(char*)&pIndex->tnum,P3_POINTER);
++    pIndex->tnum = 0;
++    if( pTable ){
++      sqliteVdbeCode(v,
++          OP_Dup,       0,      0,
++          OP_Integer,   isTemp, 0,
++          OP_OpenWrite, 1,      0,
++      0);
++    }
++    addr = sqliteVdbeAddOp(v, OP_String, 0, 0);
++    if( pStart && pEnd ){
++      n = Addr(pEnd->z) - Addr(pStart->z) + 1;
++      sqliteVdbeChangeP3(v, addr, pStart->z, n);
++    }
++    sqliteVdbeAddOp(v, OP_MakeRecord, 5, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, 0, 0);
++    if( pTable ){
++      sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++      sqliteVdbeOp3(v, OP_OpenRead, 2, pTab->tnum, pTab->zName, 0);
++      lbl2 = sqliteVdbeMakeLabel(v);
++      sqliteVdbeAddOp(v, OP_Rewind, 2, lbl2);
++      lbl1 = sqliteVdbeAddOp(v, OP_Recno, 2, 0);
++      for(i=0; i<pIndex->nColumn; i++){
++        int iCol = pIndex->aiColumn[i];
++        if( pTab->iPKey==iCol ){
++          sqliteVdbeAddOp(v, OP_Dup, i, 0);
++        }else{
++          sqliteVdbeAddOp(v, OP_Column, 2, iCol);
++        }
++      }
++      sqliteVdbeAddOp(v, OP_MakeIdxKey, pIndex->nColumn, 0);
++      if( db->file_format>=4 ) sqliteAddIdxKeyType(v, pIndex);
++      sqliteVdbeOp3(v, OP_IdxPut, 1, pIndex->onError!=OE_None,
++                      "indexed columns are not unique", P3_STATIC);
++      sqliteVdbeAddOp(v, OP_Next, 2, lbl1);
++      sqliteVdbeResolveLabel(v, lbl2);
++      sqliteVdbeAddOp(v, OP_Close, 2, 0);
++      sqliteVdbeAddOp(v, OP_Close, 1, 0);
++    }
++    if( pTable!=0 ){
++      if( !isTemp ){
++        sqliteChangeCookie(db, v);
++      }
++      sqliteVdbeAddOp(v, OP_Close, 0, 0);
++      sqliteEndWriteOperation(pParse);
++    }
++  }
++
++  /* Clean up before exiting */
++exit_create_index:
++  sqliteIdListDelete(pList);
++  sqliteSrcListDelete(pTable);
++  sqliteFree(zName);
++  return;
++}
++
++/*
++** This routine will drop an existing named index.  This routine
++** implements the DROP INDEX statement.
++*/
++void sqliteDropIndex(Parse *pParse, SrcList *pName){
++  Index *pIndex;
++  Vdbe *v;
++  sqlite *db = pParse->db;
++
++  if( pParse->nErr || sqlite_malloc_failed ) return;
++  assert( pName->nSrc==1 );
++  pIndex = sqliteFindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
++  if( pIndex==0 ){
++    sqliteErrorMsg(pParse, "no such index: %S", pName, 0);
++    goto exit_drop_index;
++  }
++  if( pIndex->autoIndex ){
++    sqliteErrorMsg(pParse, "index associated with UNIQUE "
++      "or PRIMARY KEY constraint cannot be dropped", 0);
++    goto exit_drop_index;
++  }
++  if( pIndex->iDb>1 ){
++    sqliteErrorMsg(pParse, "cannot alter schema of attached "
++       "databases", 0);
++    goto exit_drop_index;
++  }
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  {
++    int code = SQLITE_DROP_INDEX;
++    Table *pTab = pIndex->pTable;
++    const char *zDb = db->aDb[pIndex->iDb].zName;
++    const char *zTab = SCHEMA_TABLE(pIndex->iDb);
++    if( sqliteAuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
++      goto exit_drop_index;
++    }
++    if( pIndex->iDb ) code = SQLITE_DROP_TEMP_INDEX;
++    if( sqliteAuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
++      goto exit_drop_index;
++    }
++  }
++#endif
++
++  /* Generate code to remove the index and from the master table */
++  v = sqliteGetVdbe(pParse);
++  if( v ){
++    static VdbeOpList dropIndex[] = {
++      { OP_Rewind,     0, ADDR(9), 0}, 
++      { OP_String,     0, 0,       0}, /* 1 */
++      { OP_MemStore,   1, 1,       0},
++      { OP_MemLoad,    1, 0,       0}, /* 3 */
++      { OP_Column,     0, 1,       0},
++      { OP_Eq,         0, ADDR(8), 0},
++      { OP_Next,       0, ADDR(3), 0},
++      { OP_Goto,       0, ADDR(9), 0},
++      { OP_Delete,     0, 0,       0}, /* 8 */
++    };
++    int base;
++
++    sqliteBeginWriteOperation(pParse, 0, pIndex->iDb);
++    sqliteOpenMasterTable(v, pIndex->iDb);
++    base = sqliteVdbeAddOpList(v, ArraySize(dropIndex), dropIndex);
++    sqliteVdbeChangeP3(v, base+1, pIndex->zName, 0);
++    if( pIndex->iDb==0 ){
++      sqliteChangeCookie(db, v);
++    }
++    sqliteVdbeAddOp(v, OP_Close, 0, 0);
++    sqliteVdbeAddOp(v, OP_Destroy, pIndex->tnum, pIndex->iDb);
++    sqliteEndWriteOperation(pParse);
++  }
++
++  /* Delete the in-memory description of this index.
++  */
++  if( !pParse->explain ){
++    sqliteUnlinkAndDeleteIndex(db, pIndex);
++    db->flags |= SQLITE_InternChanges;
++  }
++
++exit_drop_index:
++  sqliteSrcListDelete(pName);
++}
++
++/*
++** Append a new element to the given IdList.  Create a new IdList if
++** need be.
++**
++** A new IdList is returned, or NULL if malloc() fails.
++*/
++IdList *sqliteIdListAppend(IdList *pList, Token *pToken){
++  if( pList==0 ){
++    pList = sqliteMalloc( sizeof(IdList) );
++    if( pList==0 ) return 0;
++    pList->nAlloc = 0;
++  }
++  if( pList->nId>=pList->nAlloc ){
++    struct IdList_item *a;
++    pList->nAlloc = pList->nAlloc*2 + 5;
++    a = sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]) );
++    if( a==0 ){
++      sqliteIdListDelete(pList);
++      return 0;
++    }
++    pList->a = a;
++  }
++  memset(&pList->a[pList->nId], 0, sizeof(pList->a[0]));
++  if( pToken ){
++    char **pz = &pList->a[pList->nId].zName;
++    sqliteSetNString(pz, pToken->z, pToken->n, 0);
++    if( *pz==0 ){
++      sqliteIdListDelete(pList);
++      return 0;
++    }else{
++      sqliteDequote(*pz);
++    }
++  }
++  pList->nId++;
++  return pList;
++}
++
++/*
++** Append a new table name to the given SrcList.  Create a new SrcList if
++** need be.  A new entry is created in the SrcList even if pToken is NULL.
++**
++** A new SrcList is returned, or NULL if malloc() fails.
++**
++** If pDatabase is not null, it means that the table has an optional
++** database name prefix.  Like this:  "database.table".  The pDatabase
++** points to the table name and the pTable points to the database name.
++** The SrcList.a[].zName field is filled with the table name which might
++** come from pTable (if pDatabase is NULL) or from pDatabase.  
++** SrcList.a[].zDatabase is filled with the database name from pTable,
++** or with NULL if no database is specified.
++**
++** In other words, if call like this:
++**
++**         sqliteSrcListAppend(A,B,0);
++**
++** Then B is a table name and the database name is unspecified.  If called
++** like this:
++**
++**         sqliteSrcListAppend(A,B,C);
++**
++** Then C is the table name and B is the database name.
++*/
++SrcList *sqliteSrcListAppend(SrcList *pList, Token *pTable, Token *pDatabase){
++  if( pList==0 ){
++    pList = sqliteMalloc( sizeof(SrcList) );
++    if( pList==0 ) return 0;
++    pList->nAlloc = 1;
++  }
++  if( pList->nSrc>=pList->nAlloc ){
++    SrcList *pNew;
++    pList->nAlloc *= 2;
++    pNew = sqliteRealloc(pList,
++               sizeof(*pList) + (pList->nAlloc-1)*sizeof(pList->a[0]) );
++    if( pNew==0 ){
++      sqliteSrcListDelete(pList);
++      return 0;
++    }
++    pList = pNew;
++  }
++  memset(&pList->a[pList->nSrc], 0, sizeof(pList->a[0]));
++  if( pDatabase && pDatabase->z==0 ){
++    pDatabase = 0;
++  }
++  if( pDatabase && pTable ){
++    Token *pTemp = pDatabase;
++    pDatabase = pTable;
++    pTable = pTemp;
++  }
++  if( pTable ){
++    char **pz = &pList->a[pList->nSrc].zName;
++    sqliteSetNString(pz, pTable->z, pTable->n, 0);
++    if( *pz==0 ){
++      sqliteSrcListDelete(pList);
++      return 0;
++    }else{
++      sqliteDequote(*pz);
++    }
++  }
++  if( pDatabase ){
++    char **pz = &pList->a[pList->nSrc].zDatabase;
++    sqliteSetNString(pz, pDatabase->z, pDatabase->n, 0);
++    if( *pz==0 ){
++      sqliteSrcListDelete(pList);
++      return 0;
++    }else{
++      sqliteDequote(*pz);
++    }
++  }
++  pList->a[pList->nSrc].iCursor = -1;
++  pList->nSrc++;
++  return pList;
++}
++
++/*
++** Assign cursors to all tables in a SrcList
++*/
++void sqliteSrcListAssignCursors(Parse *pParse, SrcList *pList){
++  int i;
++  for(i=0; i<pList->nSrc; i++){
++    if( pList->a[i].iCursor<0 ){
++      pList->a[i].iCursor = pParse->nTab++;
++    }
++  }
++}
++
++/*
++** Add an alias to the last identifier on the given identifier list.
++*/
++void sqliteSrcListAddAlias(SrcList *pList, Token *pToken){
++  if( pList && pList->nSrc>0 ){
++    int i = pList->nSrc - 1;
++    sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, 0);
++    sqliteDequote(pList->a[i].zAlias);
++  }
++}
++
++/*
++** Delete an IdList.
++*/
++void sqliteIdListDelete(IdList *pList){
++  int i;
++  if( pList==0 ) return;
++  for(i=0; i<pList->nId; i++){
++    sqliteFree(pList->a[i].zName);
++  }
++  sqliteFree(pList->a);
++  sqliteFree(pList);
++}
++
++/*
++** Return the index in pList of the identifier named zId.  Return -1
++** if not found.
++*/
++int sqliteIdListIndex(IdList *pList, const char *zName){
++  int i;
++  if( pList==0 ) return -1;
++  for(i=0; i<pList->nId; i++){
++    if( sqliteStrICmp(pList->a[i].zName, zName)==0 ) return i;
++  }
++  return -1;
++}
++
++/*
++** Delete an entire SrcList including all its substructure.
++*/
++void sqliteSrcListDelete(SrcList *pList){
++  int i;
++  if( pList==0 ) return;
++  for(i=0; i<pList->nSrc; i++){
++    sqliteFree(pList->a[i].zDatabase);
++    sqliteFree(pList->a[i].zName);
++    sqliteFree(pList->a[i].zAlias);
++    if( pList->a[i].pTab && pList->a[i].pTab->isTransient ){
++      sqliteDeleteTable(0, pList->a[i].pTab);
++    }
++    sqliteSelectDelete(pList->a[i].pSelect);
++    sqliteExprDelete(pList->a[i].pOn);
++    sqliteIdListDelete(pList->a[i].pUsing);
++  }
++  sqliteFree(pList);
++}
++
++/*
++** Begin a transaction
++*/
++void sqliteBeginTransaction(Parse *pParse, int onError){
++  sqlite *db;
++
++  if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
++  if( pParse->nErr || sqlite_malloc_failed ) return;
++  if( sqliteAuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ) return;
++  if( db->flags & SQLITE_InTrans ){
++    sqliteErrorMsg(pParse, "cannot start a transaction within a transaction");
++    return;
++  }
++  sqliteBeginWriteOperation(pParse, 0, 0);
++  if( !pParse->explain ){
++    db->flags |= SQLITE_InTrans;
++    db->onError = onError;
++  }
++}
++
++/*
++** Commit a transaction
++*/
++void sqliteCommitTransaction(Parse *pParse){
++  sqlite *db;
++
++  if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
++  if( pParse->nErr || sqlite_malloc_failed ) return;
++  if( sqliteAuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ) return;
++  if( (db->flags & SQLITE_InTrans)==0 ){
++    sqliteErrorMsg(pParse, "cannot commit - no transaction is active");
++    return;
++  }
++  if( !pParse->explain ){
++    db->flags &= ~SQLITE_InTrans;
++  }
++  sqliteEndWriteOperation(pParse);
++  if( !pParse->explain ){
++    db->onError = OE_Default;
++  }
++}
++
++/*
++** Rollback a transaction
++*/
++void sqliteRollbackTransaction(Parse *pParse){
++  sqlite *db;
++  Vdbe *v;
++
++  if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
++  if( pParse->nErr || sqlite_malloc_failed ) return;
++  if( sqliteAuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ) return;
++  if( (db->flags & SQLITE_InTrans)==0 ){
++    sqliteErrorMsg(pParse, "cannot rollback - no transaction is active");
++    return; 
++  }
++  v = sqliteGetVdbe(pParse);
++  if( v ){
++    sqliteVdbeAddOp(v, OP_Rollback, 0, 0);
++  }
++  if( !pParse->explain ){
++    db->flags &= ~SQLITE_InTrans;
++    db->onError = OE_Default;
++  }
++}
++
++/*
++** Generate VDBE code that will verify the schema cookie for all
++** named database files.
++*/
++void sqliteCodeVerifySchema(Parse *pParse, int iDb){
++  sqlite *db = pParse->db;
++  Vdbe *v = sqliteGetVdbe(pParse);
++  assert( iDb>=0 && iDb<db->nDb );
++  assert( db->aDb[iDb].pBt!=0 );
++  if( iDb!=1 && !DbHasProperty(db, iDb, DB_Cookie) ){
++    sqliteVdbeAddOp(v, OP_VerifyCookie, iDb, db->aDb[iDb].schema_cookie);
++    DbSetProperty(db, iDb, DB_Cookie);
++  }
++}
++
++/*
++** Generate VDBE code that prepares for doing an operation that
++** might change the database.
++**
++** This routine starts a new transaction if we are not already within
++** a transaction.  If we are already within a transaction, then a checkpoint
++** is set if the setCheckpoint parameter is true.  A checkpoint should
++** be set for operations that might fail (due to a constraint) part of
++** the way through and which will need to undo some writes without having to
++** rollback the whole transaction.  For operations where all constraints
++** can be checked before any changes are made to the database, it is never
++** necessary to undo a write and the checkpoint should not be set.
++**
++** Only database iDb and the temp database are made writable by this call.
++** If iDb==0, then the main and temp databases are made writable.   If
++** iDb==1 then only the temp database is made writable.  If iDb>1 then the
++** specified auxiliary database and the temp database are made writable.
++*/
++void sqliteBeginWriteOperation(Parse *pParse, int setCheckpoint, int iDb){
++  Vdbe *v;
++  sqlite *db = pParse->db;
++  if( DbHasProperty(db, iDb, DB_Locked) ) return;
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) return;
++  if( !db->aDb[iDb].inTrans ){
++    sqliteVdbeAddOp(v, OP_Transaction, iDb, 0);
++    DbSetProperty(db, iDb, DB_Locked);
++    sqliteCodeVerifySchema(pParse, iDb);
++    if( iDb!=1 ){
++      sqliteBeginWriteOperation(pParse, setCheckpoint, 1);
++    }
++  }else if( setCheckpoint ){
++    sqliteVdbeAddOp(v, OP_Checkpoint, iDb, 0);
++    DbSetProperty(db, iDb, DB_Locked);
++  }
++}
++
++/*
++** Generate code that concludes an operation that may have changed
++** the database.  If a statement transaction was started, then emit
++** an OP_Commit that will cause the changes to be committed to disk.
++**
++** Note that checkpoints are automatically committed at the end of
++** a statement.  Note also that there can be multiple calls to 
++** sqliteBeginWriteOperation() but there should only be a single
++** call to sqliteEndWriteOperation() at the conclusion of the statement.
++*/
++void sqliteEndWriteOperation(Parse *pParse){
++  Vdbe *v;
++  sqlite *db = pParse->db;
++  if( pParse->trigStack ) return; /* if this is in a trigger */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) return;
++  if( db->flags & SQLITE_InTrans ){
++    /* A BEGIN has executed.  Do not commit until we see an explicit
++    ** COMMIT statement. */
++  }else{
++    sqliteVdbeAddOp(v, OP_Commit, 0, 0);
++  }
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/config_static.w32.h
+@@ -0,0 +1 @@
++#define SQLITE_PTR_SZ 4
+\ No newline at end of file
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/copy.c
+@@ -0,0 +1,110 @@
++/*
++** 2003 April 6
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code used to implement the COPY command.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** The COPY command is for compatibility with PostgreSQL and specificially
++** for the ability to read the output of pg_dump.  The format is as
++** follows:
++**
++**    COPY table FROM file [USING DELIMITERS string]
++**
++** "table" is an existing table name.  We will read lines of code from
++** file to fill this table with data.  File might be "stdin".  The optional
++** delimiter string identifies the field separators.  The default is a tab.
++*/
++void sqliteCopy(
++  Parse *pParse,       /* The parser context */
++  SrcList *pTableName, /* The name of the table into which we will insert */
++  Token *pFilename,    /* The file from which to obtain information */
++  Token *pDelimiter,   /* Use this as the field delimiter */
++  int onError          /* What to do if a constraint fails */
++){
++  Table *pTab;
++  int i;
++  Vdbe *v;
++  int addr, end;
++  char *zFile = 0;
++  const char *zDb;
++  sqlite *db = pParse->db;
++
++
++  if( sqlite_malloc_failed  ) goto copy_cleanup;
++  assert( pTableName->nSrc==1 );
++  pTab = sqliteSrcListLookup(pParse, pTableName);
++  if( pTab==0 || sqliteIsReadOnly(pParse, pTab, 0) ) goto copy_cleanup;
++  zFile = sqliteStrNDup(pFilename->z, pFilename->n);
++  sqliteDequote(zFile);
++  assert( pTab->iDb<db->nDb );
++  zDb = db->aDb[pTab->iDb].zName;
++  if( sqliteAuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb)
++      || sqliteAuthCheck(pParse, SQLITE_COPY, pTab->zName, zFile, zDb) ){
++    goto copy_cleanup;
++  }
++  v = sqliteGetVdbe(pParse);
++  if( v ){
++    sqliteBeginWriteOperation(pParse, 1, pTab->iDb);
++    addr = sqliteVdbeOp3(v, OP_FileOpen, 0, 0, pFilename->z, pFilename->n);
++    sqliteVdbeDequoteP3(v, addr);
++    sqliteOpenTableAndIndices(pParse, pTab, 0);
++    if( db->flags & SQLITE_CountRows ){
++      sqliteVdbeAddOp(v, OP_Integer, 0, 0);  /* Initialize the row count */
++    }
++    end = sqliteVdbeMakeLabel(v);
++    addr = sqliteVdbeAddOp(v, OP_FileRead, pTab->nCol, end);
++    if( pDelimiter ){
++      sqliteVdbeChangeP3(v, addr, pDelimiter->z, pDelimiter->n);
++      sqliteVdbeDequoteP3(v, addr);
++    }else{
++      sqliteVdbeChangeP3(v, addr, "\t", 1);
++    }
++    if( pTab->iPKey>=0 ){
++      sqliteVdbeAddOp(v, OP_FileColumn, pTab->iPKey, 0);
++      sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
++    }else{
++      sqliteVdbeAddOp(v, OP_NewRecno, 0, 0);
++    }
++    for(i=0; i<pTab->nCol; i++){
++      if( i==pTab->iPKey ){
++        /* The integer primary key column is filled with NULL since its
++        ** value is always pulled from the record number */
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++      }else{
++        sqliteVdbeAddOp(v, OP_FileColumn, i, 0);
++      }
++    }
++    sqliteGenerateConstraintChecks(pParse, pTab, 0, 0, pTab->iPKey>=0, 
++                                   0, onError, addr);
++    sqliteCompleteInsertion(pParse, pTab, 0, 0, 0, 0, -1);
++    if( (db->flags & SQLITE_CountRows)!=0 ){
++      sqliteVdbeAddOp(v, OP_AddImm, 1, 0);  /* Increment row count */
++    }
++    sqliteVdbeAddOp(v, OP_Goto, 0, addr);
++    sqliteVdbeResolveLabel(v, end);
++    sqliteVdbeAddOp(v, OP_Noop, 0, 0);
++    sqliteEndWriteOperation(pParse);
++    if( db->flags & SQLITE_CountRows ){
++      sqliteVdbeAddOp(v, OP_ColumnName, 0, 1);
++      sqliteVdbeChangeP3(v, -1, "rows inserted", P3_STATIC);
++      sqliteVdbeAddOp(v, OP_Callback, 1, 0);
++    }
++  }
++  
++copy_cleanup:
++  sqliteSrcListDelete(pTableName);
++  sqliteFree(zFile);
++  return;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/date.c
+@@ -0,0 +1,881 @@
++/*
++** 2003 October 31
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains the C functions that implement date and time
++** functions for SQLite.  
++**
++** There is only one exported symbol in this file - the function
++** sqliteRegisterDateTimeFunctions() found at the bottom of the file.
++** All other code has file scope.
++**
++** $Id$
++**
++** NOTES:
++**
++** SQLite processes all times and dates as Julian Day numbers.  The
++** dates and times are stored as the number of days since noon
++** in Greenwich on November 24, 4714 B.C. according to the Gregorian
++** calendar system.
++**
++** 1970-01-01 00:00:00 is JD 2440587.5
++** 2000-01-01 00:00:00 is JD 2451544.5
++**
++** This implemention requires years to be expressed as a 4-digit number
++** which means that only dates between 0000-01-01 and 9999-12-31 can
++** be represented, even though julian day numbers allow a much wider
++** range of dates.
++**
++** The Gregorian calendar system is used for all dates and times,
++** even those that predate the Gregorian calendar.  Historians usually
++** use the Julian calendar for dates prior to 1582-10-15 and for some
++** dates afterwards, depending on locale.  Beware of this difference.
++**
++** The conversion algorithms are implemented based on descriptions
++** in the following text:
++**
++**      Jean Meeus
++**      Astronomical Algorithms, 2nd Edition, 1998
++**      ISBM 0-943396-61-1
++**      Willmann-Bell, Inc
++**      Richmond, Virginia (USA)
++*/
++#include "os.h"
++#include "sqliteInt.h"
++#include <ctype.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <time.h>
++#ifndef PHP_WIN32
++#include "main/php_reentrancy.h"
++#endif
++
++#ifndef SQLITE_OMIT_DATETIME_FUNCS
++
++/*
++** A structure for holding a single date and time.
++*/
++typedef struct DateTime DateTime;
++struct DateTime {
++  double rJD;      /* The julian day number */
++  int Y, M, D;     /* Year, month, and day */
++  int h, m;        /* Hour and minutes */
++  int tz;          /* Timezone offset in minutes */
++  double s;        /* Seconds */
++  char validYMD;   /* True if Y,M,D are valid */
++  char validHMS;   /* True if h,m,s are valid */
++  char validJD;    /* True if rJD is valid */
++  char validTZ;    /* True if tz is valid */
++};
++
++
++/*
++** Convert zDate into one or more integers.  Additional arguments
++** come in groups of 5 as follows:
++**
++**       N       number of digits in the integer
++**       min     minimum allowed value of the integer
++**       max     maximum allowed value of the integer
++**       nextC   first character after the integer
++**       pVal    where to write the integers value.
++**
++** Conversions continue until one with nextC==0 is encountered.
++** The function returns the number of successful conversions.
++*/
++static int getDigits(const char *zDate, ...){
++  va_list ap;
++  int val;
++  int N;
++  int min;
++  int max;
++  int nextC;
++  int *pVal;
++  int cnt = 0;
++  va_start(ap, zDate);
++  do{
++    N = va_arg(ap, int);
++    min = va_arg(ap, int);
++    max = va_arg(ap, int);
++    nextC = va_arg(ap, int);
++    pVal = va_arg(ap, int*);
++    val = 0;
++    while( N-- ){
++      if( !isdigit(*zDate) ){
++        return cnt;
++      }
++      val = val*10 + *zDate - '0';
++      zDate++;
++    }
++    if( val<min || val>max || (nextC!=0 && nextC!=*zDate) ){
++      return cnt;
++    }
++    *pVal = val;
++    zDate++;
++    cnt++;
++  }while( nextC );
++  return cnt;
++}
++
++/*
++** Read text from z[] and convert into a floating point number.  Return
++** the number of digits converted.
++*/
++static int getValue(const char *z, double *pR){
++  const char *zEnd;
++  *pR = sqliteAtoF(z, &zEnd);
++  return zEnd - z;
++}
++
++/*
++** Parse a timezone extension on the end of a date-time.
++** The extension is of the form:
++**
++**        (+/-)HH:MM
++**
++** If the parse is successful, write the number of minutes
++** of change in *pnMin and return 0.  If a parser error occurs,
++** return 0.
++**
++** A missing specifier is not considered an error.
++*/
++static int parseTimezone(const char *zDate, DateTime *p){
++  int sgn = 0;
++  int nHr, nMn;
++  while( isspace(*zDate) ){ zDate++; }
++  p->tz = 0;
++  if( *zDate=='-' ){
++    sgn = -1;
++  }else if( *zDate=='+' ){
++    sgn = +1;
++  }else{
++    return *zDate!=0;
++  }
++  zDate++;
++  if( getDigits(zDate, 2, 0, 14, ':', &nHr, 2, 0, 59, 0, &nMn)!=2 ){
++    return 1;
++  }
++  zDate += 5;
++  p->tz = sgn*(nMn + nHr*60);
++  while( isspace(*zDate) ){ zDate++; }
++  return *zDate!=0;
++}
++
++/*
++** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.
++** The HH, MM, and SS must each be exactly 2 digits.  The
++** fractional seconds FFFF can be one or more digits.
++**
++** Return 1 if there is a parsing error and 0 on success.
++*/
++static int parseHhMmSs(const char *zDate, DateTime *p){
++  int h, m, s;
++  double ms = 0.0;
++  if( getDigits(zDate, 2, 0, 24, ':', &h, 2, 0, 59, 0, &m)!=2 ){
++    return 1;
++  }
++  zDate += 5;
++  if( *zDate==':' ){
++    zDate++;
++    if( getDigits(zDate, 2, 0, 59, 0, &s)!=1 ){
++      return 1;
++    }
++    zDate += 2;
++    if( *zDate=='.' && isdigit(zDate[1]) ){
++      double rScale = 1.0;
++      zDate++;
++      while( isdigit(*zDate) ){
++        ms = ms*10.0 + *zDate - '0';
++        rScale *= 10.0;
++        zDate++;
++      }
++      ms /= rScale;
++    }
++  }else{
++    s = 0;
++  }
++  p->validJD = 0;
++  p->validHMS = 1;
++  p->h = h;
++  p->m = m;
++  p->s = s + ms;
++  if( parseTimezone(zDate, p) ) return 1;
++  p->validTZ = p->tz!=0;
++  return 0;
++}
++
++/*
++** Convert from YYYY-MM-DD HH:MM:SS to julian day.  We always assume
++** that the YYYY-MM-DD is according to the Gregorian calendar.
++**
++** Reference:  Meeus page 61
++*/
++static void computeJD(DateTime *p){
++  int Y, M, D, A, B, X1, X2;
++
++  if( p->validJD ) return;
++  if( p->validYMD ){
++    Y = p->Y;
++    M = p->M;
++    D = p->D;
++  }else{
++    Y = 2000;  /* If no YMD specified, assume 2000-Jan-01 */
++    M = 1;
++    D = 1;
++  }
++  if( M<=2 ){
++    Y--;
++    M += 12;
++  }
++  A = Y/100;
++  B = 2 - A + (A/4);
++  X1 = 365.25*(Y+4716);
++  X2 = 30.6001*(M+1);
++  p->rJD = X1 + X2 + D + B - 1524.5;
++  p->validJD = 1;
++  p->validYMD = 0;
++  if( p->validHMS ){
++    p->rJD += (p->h*3600.0 + p->m*60.0 + p->s)/86400.0;
++    if( p->validTZ ){
++      p->rJD += p->tz*60/86400.0;
++      p->validHMS = 0;
++      p->validTZ = 0;
++    }
++  }
++}
++
++/*
++** Parse dates of the form
++**
++**     YYYY-MM-DD HH:MM:SS.FFF
++**     YYYY-MM-DD HH:MM:SS
++**     YYYY-MM-DD HH:MM
++**     YYYY-MM-DD
++**
++** Write the result into the DateTime structure and return 0
++** on success and 1 if the input string is not a well-formed
++** date.
++*/
++static int parseYyyyMmDd(const char *zDate, DateTime *p){
++  int Y, M, D, neg;
++
++  if( zDate[0]=='-' ){
++    zDate++;
++    neg = 1;
++  }else{
++    neg = 0;
++  }
++  if( getDigits(zDate,4,0,9999,'-',&Y,2,1,12,'-',&M,2,1,31,0,&D)!=3 ){
++    return 1;
++  }
++  zDate += 10;
++  while( isspace(*zDate) ){ zDate++; }
++  if( parseHhMmSs(zDate, p)==0 ){
++    /* We got the time */
++  }else if( *zDate==0 ){
++    p->validHMS = 0;
++  }else{
++    return 1;
++  }
++  p->validJD = 0;
++  p->validYMD = 1;
++  p->Y = neg ? -Y : Y;
++  p->M = M;
++  p->D = D;
++  if( p->validTZ ){
++    computeJD(p);
++  }
++  return 0;
++}
++
++/*
++** Attempt to parse the given string into a Julian Day Number.  Return
++** the number of errors.
++**
++** The following are acceptable forms for the input string:
++**
++**      YYYY-MM-DD HH:MM:SS.FFF  +/-HH:MM
++**      DDDD.DD 
++**      now
++**
++** In the first form, the +/-HH:MM is always optional.  The fractional
++** seconds extension (the ".FFF") is optional.  The seconds portion
++** (":SS.FFF") is option.  The year and date can be omitted as long
++** as there is a time string.  The time string can be omitted as long
++** as there is a year and date.
++*/
++static int parseDateOrTime(const char *zDate, DateTime *p){
++  memset(p, 0, sizeof(*p));
++  if( parseYyyyMmDd(zDate,p)==0 ){
++    return 0;
++  }else if( parseHhMmSs(zDate, p)==0 ){
++    return 0;
++  }else if( sqliteStrICmp(zDate,"now")==0){
++    double r;
++    if( sqliteOsCurrentTime(&r)==0 ){
++      p->rJD = r;
++      p->validJD = 1;
++      return 0;
++    }
++    return 1;
++  }else if( sqliteIsNumber(zDate) ){
++    p->rJD = sqliteAtoF(zDate, 0);
++    p->validJD = 1;
++    return 0;
++  }
++  return 1;
++}
++
++/*
++** Compute the Year, Month, and Day from the julian day number.
++*/
++static void computeYMD(DateTime *p){
++  int Z, A, B, C, D, E, X1;
++  if( p->validYMD ) return;
++  if( !p->validJD ){
++    p->Y = 2000;
++    p->M = 1;
++    p->D = 1;
++  }else{
++    Z = p->rJD + 0.5;
++    A = (Z - 1867216.25)/36524.25;
++    A = Z + 1 + A - (A/4);
++    B = A + 1524;
++    C = (B - 122.1)/365.25;
++    D = 365.25*C;
++    E = (B-D)/30.6001;
++    X1 = 30.6001*E;
++    p->D = B - D - X1;
++    p->M = E<14 ? E-1 : E-13;
++    p->Y = p->M>2 ? C - 4716 : C - 4715;
++  }
++  p->validYMD = 1;
++}
++
++/*
++** Compute the Hour, Minute, and Seconds from the julian day number.
++*/
++static void computeHMS(DateTime *p){
++  int Z, s;
++  if( p->validHMS ) return;
++  Z = p->rJD + 0.5;
++  s = (p->rJD + 0.5 - Z)*86400000.0 + 0.5;
++  p->s = 0.001*s;
++  s = p->s;
++  p->s -= s;
++  p->h = s/3600;
++  s -= p->h*3600;
++  p->m = s/60;
++  p->s += s - p->m*60;
++  p->validHMS = 1;
++}
++
++/*
++** Compute both YMD and HMS
++*/
++static void computeYMD_HMS(DateTime *p){
++  computeYMD(p);
++  computeHMS(p);
++}
++
++/*
++** Clear the YMD and HMS and the TZ
++*/
++static void clearYMD_HMS_TZ(DateTime *p){
++  p->validYMD = 0;
++  p->validHMS = 0;
++  p->validTZ = 0;
++}
++
++/*
++** Compute the difference (in days) between localtime and UTC (a.k.a. GMT)
++** for the time value p where p is in UTC.
++*/
++static double localtimeOffset(DateTime *p){
++  DateTime x, y;
++  time_t t;
++  struct tm *pTm, tmbuf;
++  x = *p;
++  computeYMD_HMS(&x);
++  if( x.Y<1971 || x.Y>=2038 ){
++    x.Y = 2000;
++    x.M = 1;
++    x.D = 1;
++    x.h = 0;
++    x.m = 0;
++    x.s = 0.0;
++  } else {
++    int s = x.s + 0.5;
++    x.s = s;
++  }
++  x.tz = 0;
++  x.validJD = 0;
++  computeJD(&x);
++  t = (x.rJD-2440587.5)*86400.0 + 0.5;
++  sqliteOsEnterMutex();
++  pTm = php_localtime_r(&t, &tmbuf);
++  if (!pTm) {
++        return 0;
++  }
++  y.Y = pTm->tm_year + 1900;
++  y.M = pTm->tm_mon + 1;
++  y.D = pTm->tm_mday;
++  y.h = pTm->tm_hour;
++  y.m = pTm->tm_min;
++  y.s = pTm->tm_sec;
++  sqliteOsLeaveMutex();
++  y.validYMD = 1;
++  y.validHMS = 1;
++  y.validJD = 0;
++  y.validTZ = 0;
++  computeJD(&y);
++  return y.rJD - x.rJD;
++}
++
++/*
++** Process a modifier to a date-time stamp.  The modifiers are
++** as follows:
++**
++**     NNN days
++**     NNN hours
++**     NNN minutes
++**     NNN.NNNN seconds
++**     NNN months
++**     NNN years
++**     start of month
++**     start of year
++**     start of week
++**     start of day
++**     weekday N
++**     unixepoch
++**     localtime
++**     utc
++**
++** Return 0 on success and 1 if there is any kind of error.
++*/
++static int parseModifier(const char *zMod, DateTime *p){
++  int rc = 1;
++  int n;
++  double r;
++  char *z, zBuf[30];
++  z = zBuf;
++  for(n=0; n<sizeof(zBuf)-1 && zMod[n]; n++){
++    z[n] = tolower(zMod[n]);
++  }
++  z[n] = 0;
++  switch( z[0] ){
++    case 'l': {
++      /*    localtime
++      **
++      ** Assuming the current time value is UTC (a.k.a. GMT), shift it to
++      ** show local time.
++      */
++      if( strcmp(z, "localtime")==0 ){
++        computeJD(p);
++        p->rJD += localtimeOffset(p);
++        clearYMD_HMS_TZ(p);
++        rc = 0;
++      }
++      break;
++    }
++    case 'u': {
++      /*
++      **    unixepoch
++      **
++      ** Treat the current value of p->rJD as the number of
++      ** seconds since 1970.  Convert to a real julian day number.
++      */
++      if( strcmp(z, "unixepoch")==0 && p->validJD ){
++        p->rJD = p->rJD/86400.0 + 2440587.5;
++        clearYMD_HMS_TZ(p);
++        rc = 0;
++      }else if( strcmp(z, "utc")==0 ){
++        double c1;
++        computeJD(p);
++        c1 = localtimeOffset(p);
++        p->rJD -= c1;
++        clearYMD_HMS_TZ(p);
++        p->rJD += c1 - localtimeOffset(p);
++        rc = 0;
++      }
++      break;
++    }
++    case 'w': {
++      /*
++      **    weekday N
++      **
++      ** Move the date to the same time on the next occurrance of
++      ** weekday N where 0==Sunday, 1==Monday, and so forth.  If the
++      ** date is already on the appropriate weekday, this is a no-op.
++      */
++      if( strncmp(z, "weekday ", 8)==0 && getValue(&z[8],&r)>0
++                 && (n=r)==r && n>=0 && r<7 ){
++        int Z;
++        computeYMD_HMS(p);
++        p->validTZ = 0;
++        p->validJD = 0;
++        computeJD(p);
++        Z = p->rJD + 1.5;
++        Z %= 7;
++        if( Z>n ) Z -= 7;
++        p->rJD += n - Z;
++        clearYMD_HMS_TZ(p);
++        rc = 0;
++      }
++      break;
++    }
++    case 's': {
++      /*
++      **    start of TTTTT
++      **
++      ** Move the date backwards to the beginning of the current day,
++      ** or month or year.
++      */
++      if( strncmp(z, "start of ", 9)!=0 ) break;
++      z += 9;
++      computeYMD(p);
++      p->validHMS = 1;
++      p->h = p->m = 0;
++      p->s = 0.0;
++      p->validTZ = 0;
++      p->validJD = 0;
++      if( strcmp(z,"month")==0 ){
++        p->D = 1;
++        rc = 0;
++      }else if( strcmp(z,"year")==0 ){
++        computeYMD(p);
++        p->M = 1;
++        p->D = 1;
++        rc = 0;
++      }else if( strcmp(z,"day")==0 ){
++        rc = 0;
++      }
++      break;
++    }
++    case '+':
++    case '-':
++    case '0':
++    case '1':
++    case '2':
++    case '3':
++    case '4':
++    case '5':
++    case '6':
++    case '7':
++    case '8':
++    case '9': {
++      n = getValue(z, &r);
++      if( n<=0 ) break;
++      if( z[n]==':' ){
++        /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the
++        ** specified number of hours, minutes, seconds, and fractional seconds
++        ** to the time.  The ".FFF" may be omitted.  The ":SS.FFF" may be
++        ** omitted.
++        */
++        const char *z2 = z;
++        DateTime tx;
++        int day;
++        if( !isdigit(*z2) ) z2++;
++        memset(&tx, 0, sizeof(tx));
++        if( parseHhMmSs(z2, &tx) ) break;
++        computeJD(&tx);
++        tx.rJD -= 0.5;
++        day = (int)tx.rJD;
++        tx.rJD -= day;
++        if( z[0]=='-' ) tx.rJD = -tx.rJD;
++        computeJD(p);
++        clearYMD_HMS_TZ(p);
++       p->rJD += tx.rJD;
++        rc = 0;
++        break;
++      }
++      z += n;
++      while( isspace(z[0]) ) z++;
++      n = strlen(z);
++      if( n>10 || n<3 ) break;
++      if( z[n-1]=='s' ){ z[n-1] = 0; n--; }
++      computeJD(p);
++      rc = 0;
++      if( n==3 && strcmp(z,"day")==0 ){
++        p->rJD += r;
++      }else if( n==4 && strcmp(z,"hour")==0 ){
++        p->rJD += r/24.0;
++      }else if( n==6 && strcmp(z,"minute")==0 ){
++        p->rJD += r/(24.0*60.0);
++      }else if( n==6 && strcmp(z,"second")==0 ){
++        p->rJD += r/(24.0*60.0*60.0);
++      }else if( n==5 && strcmp(z,"month")==0 ){
++        int x, y;
++        computeYMD_HMS(p);
++        p->M += r;
++        x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
++        p->Y += x;
++        p->M -= x*12;
++        p->validJD = 0;
++        computeJD(p);
++        y = r;
++        if( y!=r ){
++          p->rJD += (r - y)*30.0;
++        }
++      }else if( n==4 && strcmp(z,"year")==0 ){
++        computeYMD_HMS(p);
++        p->Y += r;
++        p->validJD = 0;
++        computeJD(p);
++      }else{
++        rc = 1;
++      }
++      clearYMD_HMS_TZ(p);
++      break;
++    }
++    default: {
++      break;
++    }
++  }
++  return rc;
++}
++
++/*
++** Process time function arguments.  argv[0] is a date-time stamp.
++** argv[1] and following are modifiers.  Parse them all and write
++** the resulting time into the DateTime structure p.  Return 0
++** on success and 1 if there are any errors.
++*/
++static int isDate(int argc, const char **argv, DateTime *p){
++  int i;
++  if( argc==0 ) return 1;
++  if( argv[0]==0 || parseDateOrTime(argv[0], p) ) return 1;
++  for(i=1; i<argc; i++){
++    if( argv[i]==0 || parseModifier(argv[i], p) ) return 1;
++  }
++  return 0;
++}
++
++
++/*
++** The following routines implement the various date and time functions
++** of SQLite.
++*/
++
++/*
++**    julianday( TIMESTRING, MOD, MOD, ...)
++**
++** Return the julian day number of the date specified in the arguments
++*/
++static void juliandayFunc(sqlite_func *context, int argc, const char **argv){
++  DateTime x;
++  if( isDate(argc, argv, &x)==0 ){
++    computeJD(&x);
++    sqlite_set_result_double(context, x.rJD);
++  }
++}
++
++/*
++**    datetime( TIMESTRING, MOD, MOD, ...)
++**
++** Return YYYY-MM-DD HH:MM:SS
++*/
++static void datetimeFunc(sqlite_func *context, int argc, const char **argv){
++  DateTime x;
++  if( isDate(argc, argv, &x)==0 ){
++    char zBuf[100];
++    computeYMD_HMS(&x);
++    sprintf(zBuf, "%04d-%02d-%02d %02d:%02d:%02d",x.Y, x.M, x.D, x.h, x.m,
++           (int)(x.s));
++    sqlite_set_result_string(context, zBuf, -1);
++  }
++}
++
++/*
++**    time( TIMESTRING, MOD, MOD, ...)
++**
++** Return HH:MM:SS
++*/
++static void timeFunc(sqlite_func *context, int argc, const char **argv){
++  DateTime x;
++  if( isDate(argc, argv, &x)==0 ){
++    char zBuf[100];
++    computeHMS(&x);
++    sprintf(zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s);
++    sqlite_set_result_string(context, zBuf, -1);
++  }
++}
++
++/*
++**    date( TIMESTRING, MOD, MOD, ...)
++**
++** Return YYYY-MM-DD
++*/
++static void dateFunc(sqlite_func *context, int argc, const char **argv){
++  DateTime x;
++  if( isDate(argc, argv, &x)==0 ){
++    char zBuf[100];
++    computeYMD(&x);
++    sprintf(zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D);
++    sqlite_set_result_string(context, zBuf, -1);
++  }
++}
++
++/*
++**    strftime( FORMAT, TIMESTRING, MOD, MOD, ...)
++**
++** Return a string described by FORMAT.  Conversions as follows:
++**
++**   %d  day of month
++**   %f  ** fractional seconds  SS.SSS
++**   %H  hour 00-24
++**   %j  day of year 000-366
++**   %J  ** Julian day number
++**   %m  month 01-12
++**   %M  minute 00-59
++**   %s  seconds since 1970-01-01
++**   %S  seconds 00-59
++**   %w  day of week 0-6  sunday==0
++**   %W  week of year 00-53
++**   %Y  year 0000-9999
++**   %%  %
++*/
++static void strftimeFunc(sqlite_func *context, int argc, const char **argv){
++  DateTime x;
++  int n, i, j;
++  char *z;
++  const char *zFmt = argv[0];
++  char zBuf[100];
++  if( argv[0]==0 || isDate(argc-1, argv+1, &x) ) return;
++  for(i=0, n=1; zFmt[i]; i++, n++){
++    if( zFmt[i]=='%' ){
++      switch( zFmt[i+1] ){
++        case 'd':
++        case 'H':
++        case 'm':
++        case 'M':
++        case 'S':
++        case 'W':
++          n++;
++          /* fall thru */
++        case 'w':
++        case '%':
++          break;
++        case 'f':
++          n += 8;
++          break;
++        case 'j':
++          n += 3;
++          break;
++        case 'Y':
++          n += 8;
++          break;
++        case 's':
++        case 'J':
++          n += 50;
++          break;
++        default:
++          return;  /* ERROR.  return a NULL */
++      }
++      i++;
++    }
++  }
++  if( n<sizeof(zBuf) ){
++    z = zBuf;
++  }else{
++    z = sqliteMalloc( n );
++    if( z==0 ) return;
++  }
++  computeJD(&x);
++  computeYMD_HMS(&x);
++  for(i=j=0; zFmt[i]; i++){
++    if( zFmt[i]!='%' ){
++      z[j++] = zFmt[i];
++    }else{
++      i++;
++      switch( zFmt[i] ){
++        case 'd':  sprintf(&z[j],"%02d",x.D); j+=2; break;
++        case 'f': {
++          int s = x.s;
++          int ms = (x.s - s)*1000.0;
++          sprintf(&z[j],"%02d.%03d",s,ms);
++          j += strlen(&z[j]);
++          break;
++        }
++        case 'H':  sprintf(&z[j],"%02d",x.h); j+=2; break;
++        case 'W': /* Fall thru */
++        case 'j': {
++          int n;             /* Number of days since 1st day of year */
++          DateTime y = x;
++          y.validJD = 0;
++          y.M = 1;
++          y.D = 1;
++          computeJD(&y);
++          n = x.rJD - y.rJD;
++          if( zFmt[i]=='W' ){
++            int wd;   /* 0=Monday, 1=Tuesday, ... 6=Sunday */
++            wd = ((int)(x.rJD+0.5)) % 7;
++            sprintf(&z[j],"%02d",(n+7-wd)/7);
++            j += 2;
++          }else{
++            sprintf(&z[j],"%03d",n+1);
++            j += 3;
++          }
++          break;
++        }
++        case 'J':  sprintf(&z[j],"%.16g",x.rJD); j+=strlen(&z[j]); break;
++        case 'm':  sprintf(&z[j],"%02d",x.M); j+=2; break;
++        case 'M':  sprintf(&z[j],"%02d",x.m); j+=2; break;
++        case 's': {
++          sprintf(&z[j],"%d",(int)((x.rJD-2440587.5)*86400.0 + 0.5));
++          j += strlen(&z[j]);
++          break;
++        }
++        case 'S':  sprintf(&z[j],"%02d",(int)(x.s+0.5)); j+=2; break;
++        case 'w':  z[j++] = (((int)(x.rJD+1.5)) % 7) + '0'; break;
++        case 'Y':  sprintf(&z[j],"%04d",x.Y); j+=strlen(&z[j]); break;
++        case '%':  z[j++] = '%'; break;
++      }
++    }
++  }
++  z[j] = 0;
++  sqlite_set_result_string(context, z, -1);
++  if( z!=zBuf ){
++    sqliteFree(z);
++  }
++}
++
++
++#endif /* !defined(SQLITE_OMIT_DATETIME_FUNCS) */
++
++/*
++** This function registered all of the above C functions as SQL
++** functions.  This should be the only routine in this file with
++** external linkage.
++*/
++void sqliteRegisterDateTimeFunctions(sqlite *db){
++#ifndef SQLITE_OMIT_DATETIME_FUNCS
++  static struct {
++     char *zName;
++     int nArg;
++     int dataType;
++     void (*xFunc)(sqlite_func*,int,const char**);
++  } aFuncs[] = {
++    { "julianday", -1, SQLITE_NUMERIC, juliandayFunc   },
++    { "date",      -1, SQLITE_TEXT,    dateFunc        },
++    { "time",      -1, SQLITE_TEXT,    timeFunc        },
++    { "datetime",  -1, SQLITE_TEXT,    datetimeFunc    },
++    { "strftime",  -1, SQLITE_TEXT,    strftimeFunc    },
++  };
++  int i;
++
++  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
++    sqlite_create_function(db, aFuncs[i].zName,
++           aFuncs[i].nArg, aFuncs[i].xFunc, 0);
++    if( aFuncs[i].xFunc ){
++      sqlite_function_type(db, aFuncs[i].zName, aFuncs[i].dataType);
++    }
++  }
++#endif
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/delete.c
+@@ -0,0 +1,393 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains C code routines that are called by the parser
++** to handle DELETE FROM statements.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** Look up every table that is named in pSrc.  If any table is not found,
++** add an error message to pParse->zErrMsg and return NULL.  If all tables
++** are found, return a pointer to the last table.
++*/
++Table *sqliteSrcListLookup(Parse *pParse, SrcList *pSrc){
++  Table *pTab = 0;
++  int i;
++  for(i=0; i<pSrc->nSrc; i++){
++    const char *zTab = pSrc->a[i].zName;
++    const char *zDb = pSrc->a[i].zDatabase;
++    pTab = sqliteLocateTable(pParse, zTab, zDb);
++    pSrc->a[i].pTab = pTab;
++  }
++  return pTab;
++}
++
++/*
++** Check to make sure the given table is writable.  If it is not
++** writable, generate an error message and return 1.  If it is
++** writable return 0;
++*/
++int sqliteIsReadOnly(Parse *pParse, Table *pTab, int viewOk){
++  if( pTab->readOnly ){
++    sqliteErrorMsg(pParse, "table %s may not be modified", pTab->zName);
++    return 1;
++  }
++  if( !viewOk && pTab->pSelect ){
++    sqliteErrorMsg(pParse, "cannot modify %s because it is a view",pTab->zName);
++    return 1;
++  }
++  return 0;
++}
++
++/*
++** Process a DELETE FROM statement.
++*/
++void sqliteDeleteFrom(
++  Parse *pParse,         /* The parser context */
++  SrcList *pTabList,     /* The table from which we should delete things */
++  Expr *pWhere           /* The WHERE clause.  May be null */
++){
++  Vdbe *v;               /* The virtual database engine */
++  Table *pTab;           /* The table from which records will be deleted */
++  const char *zDb;       /* Name of database holding pTab */
++  int end, addr;         /* A couple addresses of generated code */
++  int i;                 /* Loop counter */
++  WhereInfo *pWInfo;     /* Information about the WHERE clause */
++  Index *pIdx;           /* For looping over indices of the table */
++  int iCur;              /* VDBE Cursor number for pTab */
++  sqlite *db;            /* Main database structure */
++  int isView;            /* True if attempting to delete from a view */
++  AuthContext sContext;  /* Authorization context */
++
++  int row_triggers_exist = 0;  /* True if any triggers exist */
++  int before_triggers;         /* True if there are BEFORE triggers */
++  int after_triggers;          /* True if there are AFTER triggers */
++  int oldIdx = -1;             /* Cursor for the OLD table of AFTER triggers */
++
++  sContext.pParse = 0;
++  if( pParse->nErr || sqlite_malloc_failed ){
++    pTabList = 0;
++    goto delete_from_cleanup;
++  }
++  db = pParse->db;
++  assert( pTabList->nSrc==1 );
++
++  /* Locate the table which we want to delete.  This table has to be
++  ** put in an SrcList structure because some of the subroutines we
++  ** will be calling are designed to work with multiple tables and expect
++  ** an SrcList* parameter instead of just a Table* parameter.
++  */
++  pTab = sqliteSrcListLookup(pParse, pTabList);
++  if( pTab==0 )  goto delete_from_cleanup;
++  before_triggers = sqliteTriggersExist(pParse, pTab->pTrigger, 
++                         TK_DELETE, TK_BEFORE, TK_ROW, 0);
++  after_triggers = sqliteTriggersExist(pParse, pTab->pTrigger, 
++                         TK_DELETE, TK_AFTER, TK_ROW, 0);
++  row_triggers_exist = before_triggers || after_triggers;
++  isView = pTab->pSelect!=0;
++  if( sqliteIsReadOnly(pParse, pTab, before_triggers) ){
++    goto delete_from_cleanup;
++  }
++  assert( pTab->iDb<db->nDb );
++  zDb = db->aDb[pTab->iDb].zName;
++  if( sqliteAuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){
++    goto delete_from_cleanup;
++  }
++
++  /* If pTab is really a view, make sure it has been initialized.
++  */
++  if( isView && sqliteViewGetColumnNames(pParse, pTab) ){
++    goto delete_from_cleanup;
++  }
++
++  /* Allocate a cursor used to store the old.* data for a trigger.
++  */
++  if( row_triggers_exist ){ 
++    oldIdx = pParse->nTab++;
++  }
++
++  /* Resolve the column names in all the expressions.
++  */
++  assert( pTabList->nSrc==1 );
++  iCur = pTabList->a[0].iCursor = pParse->nTab++;
++  if( pWhere ){
++    if( sqliteExprResolveIds(pParse, pTabList, 0, pWhere) ){
++      goto delete_from_cleanup;
++    }
++    if( sqliteExprCheck(pParse, pWhere, 0, 0) ){
++      goto delete_from_cleanup;
++    }
++  }
++
++  /* Start the view context
++  */
++  if( isView ){
++    sqliteAuthContextPush(pParse, &sContext, pTab->zName);
++  }
++
++  /* Begin generating code.
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ){
++    goto delete_from_cleanup;
++  }
++  sqliteBeginWriteOperation(pParse, row_triggers_exist, pTab->iDb);
++
++  /* If we are trying to delete from a view, construct that view into
++  ** a temporary table.
++  */
++  if( isView ){
++    Select *pView = sqliteSelectDup(pTab->pSelect);
++    sqliteSelect(pParse, pView, SRT_TempTable, iCur, 0, 0, 0);
++    sqliteSelectDelete(pView);
++  }
++
++  /* Initialize the counter of the number of rows deleted, if
++  ** we are counting rows.
++  */
++  if( db->flags & SQLITE_CountRows ){
++    sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++  }
++
++  /* Special case: A DELETE without a WHERE clause deletes everything.
++  ** It is easier just to erase the whole table.  Note, however, that
++  ** this means that the row change count will be incorrect.
++  */
++  if( pWhere==0 && !row_triggers_exist ){
++    if( db->flags & SQLITE_CountRows ){
++      /* If counting rows deleted, just count the total number of
++      ** entries in the table. */
++      int endOfLoop = sqliteVdbeMakeLabel(v);
++      int addr;
++      if( !isView ){
++        sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++        sqliteVdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
++      }
++      sqliteVdbeAddOp(v, OP_Rewind, iCur, sqliteVdbeCurrentAddr(v)+2);
++      addr = sqliteVdbeAddOp(v, OP_AddImm, 1, 0);
++      sqliteVdbeAddOp(v, OP_Next, iCur, addr);
++      sqliteVdbeResolveLabel(v, endOfLoop);
++      sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++    }
++    if( !isView ){
++      sqliteVdbeAddOp(v, OP_Clear, pTab->tnum, pTab->iDb);
++      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
++        sqliteVdbeAddOp(v, OP_Clear, pIdx->tnum, pIdx->iDb);
++      }
++    }
++  }
++
++  /* The usual case: There is a WHERE clause so we have to scan through
++  ** the table and pick which records to delete.
++  */
++  else{
++    /* Begin the database scan
++    */
++    pWInfo = sqliteWhereBegin(pParse, pTabList, pWhere, 1, 0);
++    if( pWInfo==0 ) goto delete_from_cleanup;
++
++    /* Remember the key of every item to be deleted.
++    */
++    sqliteVdbeAddOp(v, OP_ListWrite, 0, 0);
++    if( db->flags & SQLITE_CountRows ){
++      sqliteVdbeAddOp(v, OP_AddImm, 1, 0);
++    }
++
++    /* End the database scan loop.
++    */
++    sqliteWhereEnd(pWInfo);
++
++    /* Open the pseudo-table used to store OLD if there are triggers.
++    */
++    if( row_triggers_exist ){
++      sqliteVdbeAddOp(v, OP_OpenPseudo, oldIdx, 0);
++    }
++
++    /* Delete every item whose key was written to the list during the
++    ** database scan.  We have to delete items after the scan is complete
++    ** because deleting an item can change the scan order.
++    */
++    sqliteVdbeAddOp(v, OP_ListRewind, 0, 0);
++    end = sqliteVdbeMakeLabel(v);
++
++    /* This is the beginning of the delete loop when there are
++    ** row triggers.
++    */
++    if( row_triggers_exist ){
++      addr = sqliteVdbeAddOp(v, OP_ListRead, 0, end);
++      sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++      if( !isView ){
++        sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++        sqliteVdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
++      }
++      sqliteVdbeAddOp(v, OP_MoveTo, iCur, 0);
++
++      sqliteVdbeAddOp(v, OP_Recno, iCur, 0);
++      sqliteVdbeAddOp(v, OP_RowData, iCur, 0);
++      sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
++      if( !isView ){
++        sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++      }
++
++      sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1, 
++          oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
++        addr);
++    }
++
++    if( !isView ){
++      /* Open cursors for the table we are deleting from and all its
++      ** indices.  If there are row triggers, this happens inside the
++      ** OP_ListRead loop because the cursor have to all be closed
++      ** before the trigger fires.  If there are no row triggers, the
++      ** cursors are opened only once on the outside the loop.
++      */
++      pParse->nTab = iCur + 1;
++      sqliteOpenTableAndIndices(pParse, pTab, iCur);
++
++      /* This is the beginning of the delete loop when there are no
++      ** row triggers */
++      if( !row_triggers_exist ){ 
++        addr = sqliteVdbeAddOp(v, OP_ListRead, 0, end);
++      }
++
++      /* Delete the row */
++      sqliteGenerateRowDelete(db, v, pTab, iCur, pParse->trigStack==0);
++    }
++
++    /* If there are row triggers, close all cursors then invoke
++    ** the AFTER triggers
++    */
++    if( row_triggers_exist ){
++      if( !isView ){
++        for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
++          sqliteVdbeAddOp(v, OP_Close, iCur + i, pIdx->tnum);
++        }
++        sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++      }
++      sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1, 
++          oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
++        addr);
++    }
++
++    /* End of the delete loop */
++    sqliteVdbeAddOp(v, OP_Goto, 0, addr);
++    sqliteVdbeResolveLabel(v, end);
++    sqliteVdbeAddOp(v, OP_ListReset, 0, 0);
++
++    /* Close the cursors after the loop if there are no row triggers */
++    if( !row_triggers_exist ){
++      for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
++        sqliteVdbeAddOp(v, OP_Close, iCur + i, pIdx->tnum);
++      }
++      sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++      pParse->nTab = iCur;
++    }
++  }
++  sqliteVdbeAddOp(v, OP_SetCounts, 0, 0);
++  sqliteEndWriteOperation(pParse);
++
++  /*
++  ** Return the number of rows that were deleted.
++  */
++  if( db->flags & SQLITE_CountRows ){
++    sqliteVdbeAddOp(v, OP_ColumnName, 0, 1);
++    sqliteVdbeChangeP3(v, -1, "rows deleted", P3_STATIC);
++    sqliteVdbeAddOp(v, OP_Callback, 1, 0);
++  }
++
++delete_from_cleanup:
++  sqliteAuthContextPop(&sContext);
++  sqliteSrcListDelete(pTabList);
++  sqliteExprDelete(pWhere);
++  return;
++}
++
++/*
++** This routine generates VDBE code that causes a single row of a
++** single table to be deleted.
++**
++** The VDBE must be in a particular state when this routine is called.
++** These are the requirements:
++**
++**   1.  A read/write cursor pointing to pTab, the table containing the row
++**       to be deleted, must be opened as cursor number "base".
++**
++**   2.  Read/write cursors for all indices of pTab must be open as
++**       cursor number base+i for the i-th index.
++**
++**   3.  The record number of the row to be deleted must be on the top
++**       of the stack.
++**
++** This routine pops the top of the stack to remove the record number
++** and then generates code to remove both the table record and all index
++** entries that point to that record.
++*/
++void sqliteGenerateRowDelete(
++  sqlite *db,        /* The database containing the index */
++  Vdbe *v,           /* Generate code into this VDBE */
++  Table *pTab,       /* Table containing the row to be deleted */
++  int iCur,          /* Cursor number for the table */
++  int count          /* Increment the row change counter */
++){
++  int addr;
++  addr = sqliteVdbeAddOp(v, OP_NotExists, iCur, 0);
++  sqliteGenerateRowIndexDelete(db, v, pTab, iCur, 0);
++  sqliteVdbeAddOp(v, OP_Delete, iCur,
++    (count?OPFLAG_NCHANGE:0) | OPFLAG_CSCHANGE);
++  sqliteVdbeChangeP2(v, addr, sqliteVdbeCurrentAddr(v));
++}
++
++/*
++** This routine generates VDBE code that causes the deletion of all
++** index entries associated with a single row of a single table.
++**
++** The VDBE must be in a particular state when this routine is called.
++** These are the requirements:
++**
++**   1.  A read/write cursor pointing to pTab, the table containing the row
++**       to be deleted, must be opened as cursor number "iCur".
++**
++**   2.  Read/write cursors for all indices of pTab must be open as
++**       cursor number iCur+i for the i-th index.
++**
++**   3.  The "iCur" cursor must be pointing to the row that is to be
++**       deleted.
++*/
++void sqliteGenerateRowIndexDelete(
++  sqlite *db,        /* The database containing the index */
++  Vdbe *v,           /* Generate code into this VDBE */
++  Table *pTab,       /* Table containing the row to be deleted */
++  int iCur,          /* Cursor number for the table */
++  char *aIdxUsed     /* Only delete if aIdxUsed!=0 && aIdxUsed[i]!=0 */
++){
++  int i;
++  Index *pIdx;
++
++  for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
++    int j;
++    if( aIdxUsed!=0 && aIdxUsed[i-1]==0 ) continue;
++    sqliteVdbeAddOp(v, OP_Recno, iCur, 0);
++    for(j=0; j<pIdx->nColumn; j++){
++      int idx = pIdx->aiColumn[j];
++      if( idx==pTab->iPKey ){
++        sqliteVdbeAddOp(v, OP_Dup, j, 0);
++      }else{
++        sqliteVdbeAddOp(v, OP_Column, iCur, idx);
++      }
++    }
++    sqliteVdbeAddOp(v, OP_MakeIdxKey, pIdx->nColumn, 0);
++    if( db->file_format>=4 ) sqliteAddIdxKeyType(v, pIdx);
++    sqliteVdbeAddOp(v, OP_IdxDelete, iCur+i, 0);
++  }
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/encode.c
+@@ -0,0 +1,257 @@
++/*
++** 2002 April 25
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains helper routines used to translate binary data into
++** a null-terminated string (suitable for use in SQLite) and back again.
++** These are convenience routines for use by people who want to store binary
++** data in an SQLite database.  The code in this file is not used by any other
++** part of the SQLite library.
++**
++** $Id$
++*/
++#include <string.h>
++#include <assert.h>
++
++/*
++** How This Encoder Works
++**
++** The output is allowed to contain any character except 0x27 (') and
++** 0x00.  This is accomplished by using an escape character to encode
++** 0x27 and 0x00 as a two-byte sequence.  The escape character is always
++** 0x01.  An 0x00 is encoded as the two byte sequence 0x01 0x01.  The
++** 0x27 character is encoded as the two byte sequence 0x01 0x28.  Finally,
++** the escape character itself is encoded as the two-character sequence
++** 0x01 0x02.
++**
++** To summarize, the encoder works by using an escape sequences as follows:
++**
++**       0x00  ->  0x01 0x01
++**       0x01  ->  0x01 0x02
++**       0x27  ->  0x01 0x28
++**
++** If that were all the encoder did, it would work, but in certain cases
++** it could double the size of the encoded string.  For example, to
++** encode a string of 100 0x27 characters would require 100 instances of
++** the 0x01 0x03 escape sequence resulting in a 200-character output.
++** We would prefer to keep the size of the encoded string smaller than
++** this.
++**
++** To minimize the encoding size, we first add a fixed offset value to each 
++** byte in the sequence.  The addition is modulo 256.  (That is to say, if
++** the sum of the original character value and the offset exceeds 256, then
++** the higher order bits are truncated.)  The offset is chosen to minimize
++** the number of characters in the string that need to be escaped.  For
++** example, in the case above where the string was composed of 100 0x27
++** characters, the offset might be 0x01.  Each of the 0x27 characters would
++** then be converted into an 0x28 character which would not need to be
++** escaped at all and so the 100 character input string would be converted
++** into just 100 characters of output.  Actually 101 characters of output - 
++** we have to record the offset used as the first byte in the sequence so
++** that the string can be decoded.  Since the offset value is stored as
++** part of the output string and the output string is not allowed to contain
++** characters 0x00 or 0x27, the offset cannot be 0x00 or 0x27.
++**
++** Here, then, are the encoding steps:
++**
++**     (1)   Choose an offset value and make it the first character of
++**           output.
++**
++**     (2)   Copy each input character into the output buffer, one by
++**           one, adding the offset value as you copy.
++**
++**     (3)   If the value of an input character plus offset is 0x00, replace
++**           that one character by the two-character sequence 0x01 0x01.
++**           If the sum is 0x01, replace it with 0x01 0x02.  If the sum
++**           is 0x27, replace it with 0x01 0x03.
++**
++**     (4)   Put a 0x00 terminator at the end of the output.
++**
++** Decoding is obvious:
++**
++**     (5)   Copy encoded characters except the first into the decode 
++**           buffer.  Set the first encoded character aside for use as
++**           the offset in step 7 below.
++**
++**     (6)   Convert each 0x01 0x01 sequence into a single character 0x00.
++**           Convert 0x01 0x02 into 0x01.  Convert 0x01 0x28 into 0x27.
++**
++**     (7)   Subtract the offset value that was the first character of
++**           the encoded buffer from all characters in the output buffer.
++**
++** The only tricky part is step (1) - how to compute an offset value to
++** minimize the size of the output buffer.  This is accomplished by testing
++** all offset values and picking the one that results in the fewest number
++** of escapes.  To do that, we first scan the entire input and count the
++** number of occurances of each character value in the input.  Suppose
++** the number of 0x00 characters is N(0), the number of occurances of 0x01
++** is N(1), and so forth up to the number of occurances of 0xff is N(255).
++** An offset of 0 is not allowed so we don't have to test it.  The number
++** of escapes required for an offset of 1 is N(1)+N(2)+N(40).  The number
++** of escapes required for an offset of 2 is N(2)+N(3)+N(41).  And so forth.
++** In this way we find the offset that gives the minimum number of escapes,
++** and thus minimizes the length of the output string.
++*/
++
++/*
++** Encode a binary buffer "in" of size n bytes so that it contains
++** no instances of characters '\'' or '\000'.  The output is 
++** null-terminated and can be used as a string value in an INSERT
++** or UPDATE statement.  Use sqlite_decode_binary() to convert the
++** string back into its original binary.
++**
++** The result is written into a preallocated output buffer "out".
++** "out" must be able to hold at least 2 +(257*n)/254 bytes.
++** In other words, the output will be expanded by as much as 3
++** bytes for every 254 bytes of input plus 2 bytes of fixed overhead.
++** (This is approximately 2 + 1.0118*n or about a 1.2% size increase.)
++**
++** The return value is the number of characters in the encoded
++** string, excluding the "\000" terminator.
++**
++** If out==NULL then no output is generated but the routine still returns
++** the number of characters that would have been generated if out had
++** not been NULL.
++*/
++int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out){
++  int i, j, e, m;
++  unsigned char x;
++  int cnt[256];
++  if( n<=0 ){
++    if( out ){
++      out[0] = 'x';
++      out[1] = 0;
++    }
++    return 1;
++  }
++  memset(cnt, 0, sizeof(cnt));
++  for(i=n-1; i>=0; i--){ cnt[in[i]]++; }
++  m = n;
++  for(i=1; i<256; i++){
++    int sum;
++    if( i=='\'' ) continue;
++    sum = cnt[i] + cnt[(i+1)&0xff] + cnt[(i+'\'')&0xff];
++    if( sum<m ){
++      m = sum;
++      e = i;
++      if( m==0 ) break;
++    }
++  }
++  if( out==0 ){
++    return n+m+1;
++  }
++  out[0] = e;
++  j = 1;
++  for(i=0; i<n; i++){
++    x = in[i] - e;
++    if( x==0 || x==1 || x=='\''){
++      out[j++] = 1;
++      x++;
++    }
++    out[j++] = x;
++  }
++  out[j] = 0;
++  assert( j==n+m+1 );
++  return j;
++}
++
++/*
++** Decode the string "in" into binary data and write it into "out".
++** This routine reverses the encoding created by sqlite_encode_binary().
++** The output will always be a few bytes less than the input.  The number
++** of bytes of output is returned.  If the input is not a well-formed
++** encoding, -1 is returned.
++**
++** The "in" and "out" parameters may point to the same buffer in order
++** to decode a string in place.
++*/
++int sqlite_decode_binary(const unsigned char *in, unsigned char *out){
++  int i, e;
++  unsigned char c;
++  e = *(in++);
++  if (e == 0) {
++    return 0;
++  }
++  i = 0;
++  while( (c = *(in++))!=0 ){
++    if (c == 1) {
++      c = *(in++) - 1;
++    }
++    out[i++] = c + e;
++  }
++  return i;
++}
++
++#ifdef ENCODER_TEST
++#include <stdio.h>
++/*
++** The subroutines above are not tested by the usual test suite.  To test
++** these routines, compile just this one file with a -DENCODER_TEST=1 option
++** and run the result.
++*/
++int main(int argc, char **argv){
++  int i, j, n, m, nOut, nByteIn, nByteOut;
++  unsigned char in[30000];
++  unsigned char out[33000];
++
++  nByteIn = nByteOut = 0;
++  for(i=0; i<sizeof(in); i++){
++    printf("Test %d: ", i+1);
++    n = rand() % (i+1);
++    if( i%100==0 ){
++      int k;
++      for(j=k=0; j<n; j++){
++        /* if( k==0 || k=='\'' ) k++; */
++        in[j] = k;
++        k = (k+1)&0xff;
++      }
++    }else{
++      for(j=0; j<n; j++) in[j] = rand() & 0xff;
++    }
++    nByteIn += n;
++    nOut = sqlite_encode_binary(in, n, out);
++    nByteOut += nOut;
++    if( nOut!=strlen(out) ){
++      printf(" ERROR return value is %d instead of %d\n", nOut, strlen(out));
++      exit(1);
++    }
++    if( nOut!=sqlite_encode_binary(in, n, 0) ){
++      printf(" ERROR actual output size disagrees with predicted size\n");
++      exit(1);
++    }
++    m = (256*n + 1262)/253;
++    printf("size %d->%d (max %d)", n, strlen(out)+1, m);
++    if( strlen(out)+1>m ){
++      printf(" ERROR output too big\n");
++      exit(1);
++    }
++    for(j=0; out[j]; j++){
++      if( out[j]=='\'' ){
++        printf(" ERROR contains (')\n");
++        exit(1);
++      }
++    }
++    j = sqlite_decode_binary(out, out);
++    if( j!=n ){
++      printf(" ERROR decode size %d\n", j);
++      exit(1);
++    }
++    if( memcmp(in, out, n)!=0 ){
++      printf(" ERROR decode mismatch\n");
++      exit(1);
++    }
++    printf(" OK\n");
++  }
++  fprintf(stderr,"Finished.  Total encoding: %d->%d bytes\n",
++          nByteIn, nByteOut);
++  fprintf(stderr,"Avg size increase: %.3f%%\n",
++    (nByteOut-nByteIn)*100.0/(double)nByteIn);
++}
++#endif /* ENCODER_TEST */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/expr.c
+@@ -0,0 +1,1662 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains routines used for analyzing expressions and
++** for generating VDBE code that evaluates expressions in SQLite.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include <ctype.h>
++
++/*
++** Construct a new expression node and return a pointer to it.  Memory
++** for this node is obtained from sqliteMalloc().  The calling function
++** is responsible for making sure the node eventually gets freed.
++*/
++Expr *sqliteExpr(int op, Expr *pLeft, Expr *pRight, Token *pToken){
++  Expr *pNew;
++  pNew = sqliteMalloc( sizeof(Expr) );
++  if( pNew==0 ){
++    /* When malloc fails, we leak memory from pLeft and pRight */
++    return 0;
++  }
++  pNew->op = op;
++  pNew->pLeft = pLeft;
++  pNew->pRight = pRight;
++  if( pToken ){
++    assert( pToken->dyn==0 );
++    pNew->token = *pToken;
++    pNew->span = *pToken;
++  }else{
++    assert( pNew->token.dyn==0 );
++    assert( pNew->token.z==0 );
++    assert( pNew->token.n==0 );
++    if( pLeft && pRight ){
++      sqliteExprSpan(pNew, &pLeft->span, &pRight->span);
++    }else{
++      pNew->span = pNew->token;
++    }
++  }
++  return pNew;
++}
++
++/*
++** Set the Expr.span field of the given expression to span all
++** text between the two given tokens.
++*/
++void sqliteExprSpan(Expr *pExpr, Token *pLeft, Token *pRight){
++  assert( pRight!=0 );
++  assert( pLeft!=0 );
++  /* Note: pExpr might be NULL due to a prior malloc failure */
++  if( pExpr && pRight->z && pLeft->z ){
++    if( pLeft->dyn==0 && pRight->dyn==0 ){
++      pExpr->span.z = pLeft->z;
++      pExpr->span.n = pRight->n + Addr(pRight->z) - Addr(pLeft->z);
++    }else{
++      pExpr->span.z = 0;
++    }
++  }
++}
++
++/*
++** Construct a new expression node for a function with multiple
++** arguments.
++*/
++Expr *sqliteExprFunction(ExprList *pList, Token *pToken){
++  Expr *pNew;
++  pNew = sqliteMalloc( sizeof(Expr) );
++  if( pNew==0 ){
++    /* sqliteExprListDelete(pList); // Leak pList when malloc fails */
++    return 0;
++  }
++  pNew->op = TK_FUNCTION;
++  pNew->pList = pList;
++  if( pToken ){
++    assert( pToken->dyn==0 );
++    pNew->token = *pToken;
++  }else{
++    pNew->token.z = 0;
++  }
++  pNew->span = pNew->token;
++  return pNew;
++}
++
++/*
++** Recursively delete an expression tree.
++*/
++void sqliteExprDelete(Expr *p){
++  if( p==0 ) return;
++  if( p->span.dyn ) sqliteFree((char*)p->span.z);
++  if( p->token.dyn ) sqliteFree((char*)p->token.z);
++  sqliteExprDelete(p->pLeft);
++  sqliteExprDelete(p->pRight);
++  sqliteExprListDelete(p->pList);
++  sqliteSelectDelete(p->pSelect);
++  sqliteFree(p);
++}
++
++
++/*
++** The following group of routines make deep copies of expressions,
++** expression lists, ID lists, and select statements.  The copies can
++** be deleted (by being passed to their respective ...Delete() routines)
++** without effecting the originals.
++**
++** The expression list, ID, and source lists return by sqliteExprListDup(),
++** sqliteIdListDup(), and sqliteSrcListDup() can not be further expanded 
++** by subsequent calls to sqlite*ListAppend() routines.
++**
++** Any tables that the SrcList might point to are not duplicated.
++*/
++Expr *sqliteExprDup(Expr *p){
++  Expr *pNew;
++  if( p==0 ) return 0;
++  pNew = sqliteMallocRaw( sizeof(*p) );
++  if( pNew==0 ) return 0;
++  memcpy(pNew, p, sizeof(*pNew));
++  if( p->token.z!=0 ){
++    pNew->token.z = sqliteStrNDup(p->token.z, p->token.n);
++    pNew->token.dyn = 1;
++  }else{
++    assert( pNew->token.z==0 );
++  }
++  pNew->span.z = 0;
++  pNew->pLeft = sqliteExprDup(p->pLeft);
++  pNew->pRight = sqliteExprDup(p->pRight);
++  pNew->pList = sqliteExprListDup(p->pList);
++  pNew->pSelect = sqliteSelectDup(p->pSelect);
++  return pNew;
++}
++void sqliteTokenCopy(Token *pTo, Token *pFrom){
++  if( pTo->dyn ) sqliteFree((char*)pTo->z);
++  if( pFrom->z ){
++    pTo->n = pFrom->n;
++    pTo->z = sqliteStrNDup(pFrom->z, pFrom->n);
++    pTo->dyn = 1;
++  }else{
++    pTo->z = 0;
++  }
++}
++ExprList *sqliteExprListDup(ExprList *p){
++  ExprList *pNew;
++  struct ExprList_item *pItem;
++  int i;
++  if( p==0 ) return 0;
++  pNew = sqliteMalloc( sizeof(*pNew) );
++  if( pNew==0 ) return 0;
++  pNew->nExpr = pNew->nAlloc = p->nExpr;
++  pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) );
++  if( pItem==0 ){
++    sqliteFree(pNew);
++    return 0;
++  }
++  for(i=0; i<p->nExpr; i++, pItem++){
++    Expr *pNewExpr, *pOldExpr;
++    pItem->pExpr = pNewExpr = sqliteExprDup(pOldExpr = p->a[i].pExpr);
++    if( pOldExpr->span.z!=0 && pNewExpr ){
++      /* Always make a copy of the span for top-level expressions in the
++      ** expression list.  The logic in SELECT processing that determines
++      ** the names of columns in the result set needs this information */
++      sqliteTokenCopy(&pNewExpr->span, &pOldExpr->span);
++    }
++    assert( pNewExpr==0 || pNewExpr->span.z!=0 
++            || pOldExpr->span.z==0 || sqlite_malloc_failed );
++    pItem->zName = sqliteStrDup(p->a[i].zName);
++    pItem->sortOrder = p->a[i].sortOrder;
++    pItem->isAgg = p->a[i].isAgg;
++    pItem->done = 0;
++  }
++  return pNew;
++}
++SrcList *sqliteSrcListDup(SrcList *p){
++  SrcList *pNew;
++  int i;
++  int nByte;
++  if( p==0 ) return 0;
++  nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
++  pNew = sqliteMallocRaw( nByte );
++  if( pNew==0 ) return 0;
++  pNew->nSrc = pNew->nAlloc = p->nSrc;
++  for(i=0; i<p->nSrc; i++){
++    struct SrcList_item *pNewItem = &pNew->a[i];
++    struct SrcList_item *pOldItem = &p->a[i];
++    pNewItem->zDatabase = sqliteStrDup(pOldItem->zDatabase);
++    pNewItem->zName = sqliteStrDup(pOldItem->zName);
++    pNewItem->zAlias = sqliteStrDup(pOldItem->zAlias);
++    pNewItem->jointype = pOldItem->jointype;
++    pNewItem->iCursor = pOldItem->iCursor;
++    pNewItem->pTab = 0;
++    pNewItem->pSelect = sqliteSelectDup(pOldItem->pSelect);
++    pNewItem->pOn = sqliteExprDup(pOldItem->pOn);
++    pNewItem->pUsing = sqliteIdListDup(pOldItem->pUsing);
++  }
++  return pNew;
++}
++IdList *sqliteIdListDup(IdList *p){
++  IdList *pNew;
++  int i;
++  if( p==0 ) return 0;
++  pNew = sqliteMallocRaw( sizeof(*pNew) );
++  if( pNew==0 ) return 0;
++  pNew->nId = pNew->nAlloc = p->nId;
++  pNew->a = sqliteMallocRaw( p->nId*sizeof(p->a[0]) );
++  if( pNew->a==0 ) return 0;
++  for(i=0; i<p->nId; i++){
++    struct IdList_item *pNewItem = &pNew->a[i];
++    struct IdList_item *pOldItem = &p->a[i];
++    pNewItem->zName = sqliteStrDup(pOldItem->zName);
++    pNewItem->idx = pOldItem->idx;
++  }
++  return pNew;
++}
++Select *sqliteSelectDup(Select *p){
++  Select *pNew;
++  if( p==0 ) return 0;
++  pNew = sqliteMallocRaw( sizeof(*p) );
++  if( pNew==0 ) return 0;
++  pNew->isDistinct = p->isDistinct;
++  pNew->pEList = sqliteExprListDup(p->pEList);
++  pNew->pSrc = sqliteSrcListDup(p->pSrc);
++  pNew->pWhere = sqliteExprDup(p->pWhere);
++  pNew->pGroupBy = sqliteExprListDup(p->pGroupBy);
++  pNew->pHaving = sqliteExprDup(p->pHaving);
++  pNew->pOrderBy = sqliteExprListDup(p->pOrderBy);
++  pNew->op = p->op;
++  pNew->pPrior = sqliteSelectDup(p->pPrior);
++  pNew->nLimit = p->nLimit;
++  pNew->nOffset = p->nOffset;
++  pNew->zSelect = 0;
++  pNew->iLimit = -1;
++  pNew->iOffset = -1;
++  return pNew;
++}
++
++
++/*
++** Add a new element to the end of an expression list.  If pList is
++** initially NULL, then create a new expression list.
++*/
++ExprList *sqliteExprListAppend(ExprList *pList, Expr *pExpr, Token *pName){
++  if( pList==0 ){
++    pList = sqliteMalloc( sizeof(ExprList) );
++    if( pList==0 ){
++      /* sqliteExprDelete(pExpr); // Leak memory if malloc fails */
++      return 0;
++    }
++    assert( pList->nAlloc==0 );
++  }
++  if( pList->nAlloc<=pList->nExpr ){
++    pList->nAlloc = pList->nAlloc*2 + 4;
++    pList->a = sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]));
++    if( pList->a==0 ){
++      /* sqliteExprDelete(pExpr); // Leak memory if malloc fails */
++      pList->nExpr = pList->nAlloc = 0;
++      return pList;
++    }
++  }
++  assert( pList->a!=0 );
++  if( pExpr || pName ){
++    struct ExprList_item *pItem = &pList->a[pList->nExpr++];
++    memset(pItem, 0, sizeof(*pItem));
++    pItem->pExpr = pExpr;
++    if( pName ){
++      sqliteSetNString(&pItem->zName, pName->z, pName->n, 0);
++      sqliteDequote(pItem->zName);
++    }
++  }
++  return pList;
++}
++
++/*
++** Delete an entire expression list.
++*/
++void sqliteExprListDelete(ExprList *pList){
++  int i;
++  if( pList==0 ) return;
++  assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
++  assert( pList->nExpr<=pList->nAlloc );
++  for(i=0; i<pList->nExpr; i++){
++    sqliteExprDelete(pList->a[i].pExpr);
++    sqliteFree(pList->a[i].zName);
++  }
++  sqliteFree(pList->a);
++  sqliteFree(pList);
++}
++
++/*
++** Walk an expression tree.  Return 1 if the expression is constant
++** and 0 if it involves variables.
++**
++** For the purposes of this function, a double-quoted string (ex: "abc")
++** is considered a variable but a single-quoted string (ex: 'abc') is
++** a constant.
++*/
++int sqliteExprIsConstant(Expr *p){
++  switch( p->op ){
++    case TK_ID:
++    case TK_COLUMN:
++    case TK_DOT:
++    case TK_FUNCTION:
++      return 0;
++    case TK_NULL:
++    case TK_STRING:
++    case TK_INTEGER:
++    case TK_FLOAT:
++    case TK_VARIABLE:
++      return 1;
++    default: {
++      if( p->pLeft && !sqliteExprIsConstant(p->pLeft) ) return 0;
++      if( p->pRight && !sqliteExprIsConstant(p->pRight) ) return 0;
++      if( p->pList ){
++        int i;
++        for(i=0; i<p->pList->nExpr; i++){
++          if( !sqliteExprIsConstant(p->pList->a[i].pExpr) ) return 0;
++        }
++      }
++      return p->pLeft!=0 || p->pRight!=0 || (p->pList && p->pList->nExpr>0);
++    }
++  }
++  return 0;
++}
++
++/*
++** If the given expression codes a constant integer that is small enough
++** to fit in a 32-bit integer, return 1 and put the value of the integer
++** in *pValue.  If the expression is not an integer or if it is too big
++** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
++*/
++int sqliteExprIsInteger(Expr *p, int *pValue){
++  switch( p->op ){
++    case TK_INTEGER: {
++      if( sqliteFitsIn32Bits(p->token.z) ){
++        *pValue = atoi(p->token.z);
++        return 1;
++      }
++      break;
++    }
++    case TK_STRING: {
++      const char *z = p->token.z;
++      int n = p->token.n;
++      if( n>0 && z[0]=='-' ){ z++; n--; }
++      while( n>0 && *z && isdigit(*z) ){ z++; n--; }
++      if( n==0 && sqliteFitsIn32Bits(p->token.z) ){
++        *pValue = atoi(p->token.z);
++        return 1;
++      }
++      break;
++    }
++    case TK_UPLUS: {
++      return sqliteExprIsInteger(p->pLeft, pValue);
++    }
++    case TK_UMINUS: {
++      int v;
++      if( sqliteExprIsInteger(p->pLeft, &v) ){
++        *pValue = -v;
++        return 1;
++      }
++      break;
++    }
++    default: break;
++  }
++  return 0;
++}
++
++/*
++** Return TRUE if the given string is a row-id column name.
++*/
++int sqliteIsRowid(const char *z){
++  if( sqliteStrICmp(z, "_ROWID_")==0 ) return 1;
++  if( sqliteStrICmp(z, "ROWID")==0 ) return 1;
++  if( sqliteStrICmp(z, "OID")==0 ) return 1;
++  return 0;
++}
++
++/*
++** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
++** that name in the set of source tables in pSrcList and make the pExpr 
++** expression node refer back to that source column.  The following changes
++** are made to pExpr:
++**
++**    pExpr->iDb           Set the index in db->aDb[] of the database holding
++**                         the table.
++**    pExpr->iTable        Set to the cursor number for the table obtained
++**                         from pSrcList.
++**    pExpr->iColumn       Set to the column number within the table.
++**    pExpr->dataType      Set to the appropriate data type for the column.
++**    pExpr->op            Set to TK_COLUMN.
++**    pExpr->pLeft         Any expression this points to is deleted
++**    pExpr->pRight        Any expression this points to is deleted.
++**
++** The pDbToken is the name of the database (the "X").  This value may be
++** NULL meaning that name is of the form Y.Z or Z.  Any available database
++** can be used.  The pTableToken is the name of the table (the "Y").  This
++** value can be NULL if pDbToken is also NULL.  If pTableToken is NULL it
++** means that the form of the name is Z and that columns from any table
++** can be used.
++**
++** If the name cannot be resolved unambiguously, leave an error message
++** in pParse and return non-zero.  Return zero on success.
++*/
++static int lookupName(
++  Parse *pParse,      /* The parsing context */
++  Token *pDbToken,     /* Name of the database containing table, or NULL */
++  Token *pTableToken,  /* Name of table containing column, or NULL */
++  Token *pColumnToken, /* Name of the column. */
++  SrcList *pSrcList,   /* List of tables used to resolve column names */
++  ExprList *pEList,    /* List of expressions used to resolve "AS" */
++  Expr *pExpr          /* Make this EXPR node point to the selected column */
++){
++  char *zDb = 0;       /* Name of the database.  The "X" in X.Y.Z */
++  char *zTab = 0;      /* Name of the table.  The "Y" in X.Y.Z or Y.Z */
++  char *zCol = 0;      /* Name of the column.  The "Z" */
++  int i, j;            /* Loop counters */
++  int cnt = 0;         /* Number of matching column names */
++  int cntTab = 0;      /* Number of matching table names */
++  sqlite *db = pParse->db;  /* The database */
++
++  assert( pColumnToken && pColumnToken->z ); /* The Z in X.Y.Z cannot be NULL */
++  if( pDbToken && pDbToken->z ){
++    zDb = sqliteStrNDup(pDbToken->z, pDbToken->n);
++    sqliteDequote(zDb);
++  }else{
++    zDb = 0;
++  }
++  if( pTableToken && pTableToken->z ){
++    zTab = sqliteStrNDup(pTableToken->z, pTableToken->n);
++    sqliteDequote(zTab);
++  }else{
++    assert( zDb==0 );
++    zTab = 0;
++  }
++  zCol = sqliteStrNDup(pColumnToken->z, pColumnToken->n);
++  sqliteDequote(zCol);
++  if( sqlite_malloc_failed ){
++    return 1;  /* Leak memory (zDb and zTab) if malloc fails */
++  }
++  assert( zTab==0 || pEList==0 );
++
++  pExpr->iTable = -1;
++  for(i=0; i<pSrcList->nSrc; i++){
++    struct SrcList_item *pItem = &pSrcList->a[i];
++    Table *pTab = pItem->pTab;
++    Column *pCol;
++
++    if( pTab==0 ) continue;
++    assert( pTab->nCol>0 );
++    if( zTab ){
++      if( pItem->zAlias ){
++        char *zTabName = pItem->zAlias;
++        if( sqliteStrICmp(zTabName, zTab)!=0 ) continue;
++      }else{
++        char *zTabName = pTab->zName;
++        if( zTabName==0 || sqliteStrICmp(zTabName, zTab)!=0 ) continue;
++        if( zDb!=0 && sqliteStrICmp(db->aDb[pTab->iDb].zName, zDb)!=0 ){
++          continue;
++        }
++      }
++    }
++    if( 0==(cntTab++) ){
++      pExpr->iTable = pItem->iCursor;
++      pExpr->iDb = pTab->iDb;
++    }
++    for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
++      if( sqliteStrICmp(pCol->zName, zCol)==0 ){
++        cnt++;
++        pExpr->iTable = pItem->iCursor;
++        pExpr->iDb = pTab->iDb;
++        /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
++        pExpr->iColumn = j==pTab->iPKey ? -1 : j;
++        pExpr->dataType = pCol->sortOrder & SQLITE_SO_TYPEMASK;
++        break;
++      }
++    }
++  }
++
++  /* If we have not already resolved the name, then maybe 
++  ** it is a new.* or old.* trigger argument reference
++  */
++  if( zDb==0 && zTab!=0 && cnt==0 && pParse->trigStack!=0 ){
++    TriggerStack *pTriggerStack = pParse->trigStack;
++    Table *pTab = 0;
++    if( pTriggerStack->newIdx != -1 && sqliteStrICmp("new", zTab) == 0 ){
++      pExpr->iTable = pTriggerStack->newIdx;
++      assert( pTriggerStack->pTab );
++      pTab = pTriggerStack->pTab;
++    }else if( pTriggerStack->oldIdx != -1 && sqliteStrICmp("old", zTab) == 0 ){
++      pExpr->iTable = pTriggerStack->oldIdx;
++      assert( pTriggerStack->pTab );
++      pTab = pTriggerStack->pTab;
++    }
++
++    if( pTab ){ 
++      int j;
++      Column *pCol = pTab->aCol;
++      
++      pExpr->iDb = pTab->iDb;
++      cntTab++;
++      for(j=0; j < pTab->nCol; j++, pCol++) {
++        if( sqliteStrICmp(pCol->zName, zCol)==0 ){
++          cnt++;
++          pExpr->iColumn = j==pTab->iPKey ? -1 : j;
++          pExpr->dataType = pCol->sortOrder & SQLITE_SO_TYPEMASK;
++          break;
++        }
++      }
++    }
++  }
++
++  /*
++  ** Perhaps the name is a reference to the ROWID
++  */
++  if( cnt==0 && cntTab==1 && sqliteIsRowid(zCol) ){
++    cnt = 1;
++    pExpr->iColumn = -1;
++    pExpr->dataType = SQLITE_SO_NUM;
++  }
++
++  /*
++  ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z
++  ** might refer to an result-set alias.  This happens, for example, when
++  ** we are resolving names in the WHERE clause of the following command:
++  **
++  **     SELECT a+b AS x FROM table WHERE x<10;
++  **
++  ** In cases like this, replace pExpr with a copy of the expression that
++  ** forms the result set entry ("a+b" in the example) and return immediately.
++  ** Note that the expression in the result set should have already been
++  ** resolved by the time the WHERE clause is resolved.
++  */
++  if( cnt==0 && pEList!=0 ){
++    for(j=0; j<pEList->nExpr; j++){
++      char *zAs = pEList->a[j].zName;
++      if( zAs!=0 && sqliteStrICmp(zAs, zCol)==0 ){
++        assert( pExpr->pLeft==0 && pExpr->pRight==0 );
++        pExpr->op = TK_AS;
++        pExpr->iColumn = j;
++        pExpr->pLeft = sqliteExprDup(pEList->a[j].pExpr);
++        sqliteFree(zCol);
++        assert( zTab==0 && zDb==0 );
++        return 0;
++      }
++    } 
++  }
++
++  /*
++  ** If X and Y are NULL (in other words if only the column name Z is
++  ** supplied) and the value of Z is enclosed in double-quotes, then
++  ** Z is a string literal if it doesn't match any column names.  In that
++  ** case, we need to return right away and not make any changes to
++  ** pExpr.
++  */
++  if( cnt==0 && zTab==0 && pColumnToken->z[0]=='"' ){
++    sqliteFree(zCol);
++    return 0;
++  }
++
++  /*
++  ** cnt==0 means there was not match.  cnt>1 means there were two or
++  ** more matches.  Either way, we have an error.
++  */
++  if( cnt!=1 ){
++    char *z = 0;
++    char *zErr;
++    zErr = cnt==0 ? "no such column: %s" : "ambiguous column name: %s";
++    if( zDb ){
++      sqliteSetString(&z, zDb, ".", zTab, ".", zCol, 0);
++    }else if( zTab ){
++      sqliteSetString(&z, zTab, ".", zCol, 0);
++    }else{
++      z = sqliteStrDup(zCol);
++    }
++    sqliteErrorMsg(pParse, zErr, z);
++    sqliteFree(z);
++  }
++
++  /* Clean up and return
++  */
++  sqliteFree(zDb);
++  sqliteFree(zTab);
++  sqliteFree(zCol);
++  sqliteExprDelete(pExpr->pLeft);
++  pExpr->pLeft = 0;
++  sqliteExprDelete(pExpr->pRight);
++  pExpr->pRight = 0;
++  pExpr->op = TK_COLUMN;
++  sqliteAuthRead(pParse, pExpr, pSrcList);
++  return cnt!=1;
++}
++
++/*
++** This routine walks an expression tree and resolves references to
++** table columns.  Nodes of the form ID.ID or ID resolve into an
++** index to the table in the table list and a column offset.  The 
++** Expr.opcode for such nodes is changed to TK_COLUMN.  The Expr.iTable
++** value is changed to the index of the referenced table in pTabList
++** plus the "base" value.  The base value will ultimately become the
++** VDBE cursor number for a cursor that is pointing into the referenced
++** table.  The Expr.iColumn value is changed to the index of the column 
++** of the referenced table.  The Expr.iColumn value for the special
++** ROWID column is -1.  Any INTEGER PRIMARY KEY column is tried as an
++** alias for ROWID.
++**
++** We also check for instances of the IN operator.  IN comes in two
++** forms:
++**
++**           expr IN (exprlist)
++** and
++**           expr IN (SELECT ...)
++**
++** The first form is handled by creating a set holding the list
++** of allowed values.  The second form causes the SELECT to generate 
++** a temporary table.
++**
++** This routine also looks for scalar SELECTs that are part of an expression.
++** If it finds any, it generates code to write the value of that select
++** into a memory cell.
++**
++** Unknown columns or tables provoke an error.  The function returns
++** the number of errors seen and leaves an error message on pParse->zErrMsg.
++*/
++int sqliteExprResolveIds(
++  Parse *pParse,     /* The parser context */
++  SrcList *pSrcList, /* List of tables used to resolve column names */
++  ExprList *pEList,  /* List of expressions used to resolve "AS" */
++  Expr *pExpr        /* The expression to be analyzed. */
++){
++  int i;
++
++  if( pExpr==0 || pSrcList==0 ) return 0;
++  for(i=0; i<pSrcList->nSrc; i++){
++    assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab );
++  }
++  switch( pExpr->op ){
++    /* Double-quoted strings (ex: "abc") are used as identifiers if
++    ** possible.  Otherwise they remain as strings.  Single-quoted
++    ** strings (ex: 'abc') are always string literals.
++    */
++    case TK_STRING: {
++      if( pExpr->token.z[0]=='\'' ) break;
++      /* Fall thru into the TK_ID case if this is a double-quoted string */
++    }
++    /* A lone identifier is the name of a columnd.
++    */
++    case TK_ID: {
++      if( lookupName(pParse, 0, 0, &pExpr->token, pSrcList, pEList, pExpr) ){
++        return 1;
++      }
++      break; 
++    }
++  
++    /* A table name and column name:     ID.ID
++    ** Or a database, table and column:  ID.ID.ID
++    */
++    case TK_DOT: {
++      Token *pColumn;
++      Token *pTable;
++      Token *pDb;
++      Expr *pRight;
++
++      pRight = pExpr->pRight;
++      if( pRight->op==TK_ID ){
++        pDb = 0;
++        pTable = &pExpr->pLeft->token;
++        pColumn = &pRight->token;
++      }else{
++        assert( pRight->op==TK_DOT );
++        pDb = &pExpr->pLeft->token;
++        pTable = &pRight->pLeft->token;
++        pColumn = &pRight->pRight->token;
++      }
++      if( lookupName(pParse, pDb, pTable, pColumn, pSrcList, 0, pExpr) ){
++        return 1;
++      }
++      break;
++    }
++
++    case TK_IN: {
++      Vdbe *v = sqliteGetVdbe(pParse);
++      if( v==0 ) return 1;
++      if( sqliteExprResolveIds(pParse, pSrcList, pEList, pExpr->pLeft) ){
++        return 1;
++      }
++      if( pExpr->pSelect ){
++        /* Case 1:     expr IN (SELECT ...)
++        **
++        ** Generate code to write the results of the select into a temporary
++        ** table.  The cursor number of the temporary table has already
++        ** been put in iTable by sqliteExprResolveInSelect().
++        */
++        pExpr->iTable = pParse->nTab++;
++        sqliteVdbeAddOp(v, OP_OpenTemp, pExpr->iTable, 1);
++        sqliteSelect(pParse, pExpr->pSelect, SRT_Set, pExpr->iTable, 0,0,0);
++      }else if( pExpr->pList ){
++        /* Case 2:     expr IN (exprlist)
++        **
++        ** Create a set to put the exprlist values in.  The Set id is stored
++        ** in iTable.
++        */
++        int i, iSet;
++        for(i=0; i<pExpr->pList->nExpr; i++){
++          Expr *pE2 = pExpr->pList->a[i].pExpr;
++          if( !sqliteExprIsConstant(pE2) ){
++            sqliteErrorMsg(pParse,
++              "right-hand side of IN operator must be constant");
++            return 1;
++          }
++          if( sqliteExprCheck(pParse, pE2, 0, 0) ){
++            return 1;
++          }
++        }
++        iSet = pExpr->iTable = pParse->nSet++;
++        for(i=0; i<pExpr->pList->nExpr; i++){
++          Expr *pE2 = pExpr->pList->a[i].pExpr;
++          switch( pE2->op ){
++            case TK_FLOAT:
++            case TK_INTEGER:
++            case TK_STRING: {
++              int addr;
++              assert( pE2->token.z );
++              addr = sqliteVdbeOp3(v, OP_SetInsert, iSet, 0,
++                                  pE2->token.z, pE2->token.n);
++              sqliteVdbeDequoteP3(v, addr);
++              break;
++            }
++            default: {
++              sqliteExprCode(pParse, pE2);
++              sqliteVdbeAddOp(v, OP_SetInsert, iSet, 0);
++              break;
++            }
++          }
++        }
++      }
++      break;
++    }
++
++    case TK_SELECT: {
++      /* This has to be a scalar SELECT.  Generate code to put the
++      ** value of this select in a memory cell and record the number
++      ** of the memory cell in iColumn.
++      */
++      pExpr->iColumn = pParse->nMem++;
++      if( sqliteSelect(pParse, pExpr->pSelect, SRT_Mem, pExpr->iColumn,0,0,0) ){
++        return 1;
++      }
++      break;
++    }
++
++    /* For all else, just recursively walk the tree */
++    default: {
++      if( pExpr->pLeft
++      && sqliteExprResolveIds(pParse, pSrcList, pEList, pExpr->pLeft) ){
++        return 1;
++      }
++      if( pExpr->pRight 
++      && sqliteExprResolveIds(pParse, pSrcList, pEList, pExpr->pRight) ){
++        return 1;
++      }
++      if( pExpr->pList ){
++        int i;
++        ExprList *pList = pExpr->pList;
++        for(i=0; i<pList->nExpr; i++){
++          Expr *pArg = pList->a[i].pExpr;
++          if( sqliteExprResolveIds(pParse, pSrcList, pEList, pArg) ){
++            return 1;
++          }
++        }
++      }
++    }
++  }
++  return 0;
++}
++
++/*
++** pExpr is a node that defines a function of some kind.  It might
++** be a syntactic function like "count(x)" or it might be a function
++** that implements an operator, like "a LIKE b".  
++**
++** This routine makes *pzName point to the name of the function and 
++** *pnName hold the number of characters in the function name.
++*/
++static void getFunctionName(Expr *pExpr, const char **pzName, int *pnName){
++  switch( pExpr->op ){
++    case TK_FUNCTION: {
++      *pzName = pExpr->token.z;
++      *pnName = pExpr->token.n;
++      break;
++    }
++    case TK_LIKE: {
++      *pzName = "like";
++      *pnName = 4;
++      break;
++    }
++    case TK_GLOB: {
++      *pzName = "glob";
++      *pnName = 4;
++      break;
++    }
++    default: {
++      *pzName = "can't happen";
++      *pnName = 12;
++      break;
++    }
++  }
++}
++
++/*
++** Error check the functions in an expression.  Make sure all
++** function names are recognized and all functions have the correct
++** number of arguments.  Leave an error message in pParse->zErrMsg
++** if anything is amiss.  Return the number of errors.
++**
++** if pIsAgg is not null and this expression is an aggregate function
++** (like count(*) or max(value)) then write a 1 into *pIsAgg.
++*/
++int sqliteExprCheck(Parse *pParse, Expr *pExpr, int allowAgg, int *pIsAgg){
++  int nErr = 0;
++  if( pExpr==0 ) return 0;
++  switch( pExpr->op ){
++    case TK_GLOB:
++    case TK_LIKE:
++    case TK_FUNCTION: {
++      int n = pExpr->pList ? pExpr->pList->nExpr : 0;  /* Number of arguments */
++      int no_such_func = 0;       /* True if no such function exists */
++      int wrong_num_args = 0;     /* True if wrong number of arguments */
++      int is_agg = 0;             /* True if is an aggregate function */
++      int i;
++      int nId;                    /* Number of characters in function name */
++      const char *zId;            /* The function name. */
++      FuncDef *pDef;
++
++      getFunctionName(pExpr, &zId, &nId);
++      pDef = sqliteFindFunction(pParse->db, zId, nId, n, 0);
++      if( pDef==0 ){
++        pDef = sqliteFindFunction(pParse->db, zId, nId, -1, 0);
++        if( pDef==0 ){
++          no_such_func = 1;
++        }else{
++          wrong_num_args = 1;
++        }
++      }else{
++        is_agg = pDef->xFunc==0;
++      }
++      if( is_agg && !allowAgg ){
++        sqliteErrorMsg(pParse, "misuse of aggregate function %.*s()", nId, zId);
++        nErr++;
++        is_agg = 0;
++      }else if( no_such_func ){
++        sqliteErrorMsg(pParse, "no such function: %.*s", nId, zId);
++        nErr++;
++      }else if( wrong_num_args ){
++        sqliteErrorMsg(pParse,"wrong number of arguments to function %.*s()",
++             nId, zId);
++        nErr++;
++      }
++      if( is_agg ){
++        pExpr->op = TK_AGG_FUNCTION;
++        if( pIsAgg ) *pIsAgg = 1;
++      }
++      for(i=0; nErr==0 && i<n; i++){
++        nErr = sqliteExprCheck(pParse, pExpr->pList->a[i].pExpr,
++                               allowAgg && !is_agg, pIsAgg);
++      }
++      if( pDef==0 ){
++        /* Already reported an error */
++      }else if( pDef->dataType>=0 ){
++        if( pDef->dataType<n ){
++          pExpr->dataType = 
++             sqliteExprType(pExpr->pList->a[pDef->dataType].pExpr);
++        }else{
++          pExpr->dataType = SQLITE_SO_NUM;
++        }
++      }else if( pDef->dataType==SQLITE_ARGS ){
++        pDef->dataType = SQLITE_SO_TEXT;
++        for(i=0; i<n; i++){
++          if( sqliteExprType(pExpr->pList->a[i].pExpr)==SQLITE_SO_NUM ){
++            pExpr->dataType = SQLITE_SO_NUM;
++            break;
++          }
++        }
++      }else if( pDef->dataType==SQLITE_NUMERIC ){
++        pExpr->dataType = SQLITE_SO_NUM;
++      }else{
++        pExpr->dataType = SQLITE_SO_TEXT;
++      }
++    }
++    default: {
++      if( pExpr->pLeft ){
++        nErr = sqliteExprCheck(pParse, pExpr->pLeft, allowAgg, pIsAgg);
++      }
++      if( nErr==0 && pExpr->pRight ){
++        nErr = sqliteExprCheck(pParse, pExpr->pRight, allowAgg, pIsAgg);
++      }
++      if( nErr==0 && pExpr->pList ){
++        int n = pExpr->pList->nExpr;
++        int i;
++        for(i=0; nErr==0 && i<n; i++){
++          Expr *pE2 = pExpr->pList->a[i].pExpr;
++          nErr = sqliteExprCheck(pParse, pE2, allowAgg, pIsAgg);
++        }
++      }
++      break;
++    }
++  }
++  return nErr;
++}
++
++/*
++** Return either SQLITE_SO_NUM or SQLITE_SO_TEXT to indicate whether the
++** given expression should sort as numeric values or as text.
++**
++** The sqliteExprResolveIds() and sqliteExprCheck() routines must have
++** both been called on the expression before it is passed to this routine.
++*/
++int sqliteExprType(Expr *p){
++  if( p==0 ) return SQLITE_SO_NUM;
++  while( p ) switch( p->op ){
++    case TK_PLUS:
++    case TK_MINUS:
++    case TK_STAR:
++    case TK_SLASH:
++    case TK_AND:
++    case TK_OR:
++    case TK_ISNULL:
++    case TK_NOTNULL:
++    case TK_NOT:
++    case TK_UMINUS:
++    case TK_UPLUS:
++    case TK_BITAND:
++    case TK_BITOR:
++    case TK_BITNOT:
++    case TK_LSHIFT:
++    case TK_RSHIFT:
++    case TK_REM:
++    case TK_INTEGER:
++    case TK_FLOAT:
++    case TK_IN:
++    case TK_BETWEEN:
++    case TK_GLOB:
++    case TK_LIKE:
++      return SQLITE_SO_NUM;
++
++    case TK_STRING:
++    case TK_NULL:
++    case TK_CONCAT:
++    case TK_VARIABLE:
++      return SQLITE_SO_TEXT;
++
++    case TK_LT:
++    case TK_LE:
++    case TK_GT:
++    case TK_GE:
++    case TK_NE:
++    case TK_EQ:
++      if( sqliteExprType(p->pLeft)==SQLITE_SO_NUM ){
++        return SQLITE_SO_NUM;
++      }
++      p = p->pRight;
++      break;
++
++    case TK_AS:
++      p = p->pLeft;
++      break;
++
++    case TK_COLUMN:
++    case TK_FUNCTION:
++    case TK_AGG_FUNCTION:
++      return p->dataType;
++
++    case TK_SELECT:
++      assert( p->pSelect );
++      assert( p->pSelect->pEList );
++      assert( p->pSelect->pEList->nExpr>0 );
++      p = p->pSelect->pEList->a[0].pExpr;
++      break;
++
++    case TK_CASE: {
++      if( p->pRight && sqliteExprType(p->pRight)==SQLITE_SO_NUM ){
++        return SQLITE_SO_NUM;
++      }
++      if( p->pList ){
++        int i;
++        ExprList *pList = p->pList;
++        for(i=1; i<pList->nExpr; i+=2){
++          if( sqliteExprType(pList->a[i].pExpr)==SQLITE_SO_NUM ){
++            return SQLITE_SO_NUM;
++          }
++        }
++      }
++      return SQLITE_SO_TEXT;
++    }
++
++    default:
++      assert( p->op==TK_ABORT );  /* Can't Happen */
++      break;
++  }
++  return SQLITE_SO_NUM;
++}
++
++/*
++** Generate code into the current Vdbe to evaluate the given
++** expression and leave the result on the top of stack.
++*/
++void sqliteExprCode(Parse *pParse, Expr *pExpr){
++  Vdbe *v = pParse->pVdbe;
++  int op;
++  if( v==0 || pExpr==0 ) return;
++  switch( pExpr->op ){
++    case TK_PLUS:     op = OP_Add;      break;
++    case TK_MINUS:    op = OP_Subtract; break;
++    case TK_STAR:     op = OP_Multiply; break;
++    case TK_SLASH:    op = OP_Divide;   break;
++    case TK_AND:      op = OP_And;      break;
++    case TK_OR:       op = OP_Or;       break;
++    case TK_LT:       op = OP_Lt;       break;
++    case TK_LE:       op = OP_Le;       break;
++    case TK_GT:       op = OP_Gt;       break;
++    case TK_GE:       op = OP_Ge;       break;
++    case TK_NE:       op = OP_Ne;       break;
++    case TK_EQ:       op = OP_Eq;       break;
++    case TK_ISNULL:   op = OP_IsNull;   break;
++    case TK_NOTNULL:  op = OP_NotNull;  break;
++    case TK_NOT:      op = OP_Not;      break;
++    case TK_UMINUS:   op = OP_Negative; break;
++    case TK_BITAND:   op = OP_BitAnd;   break;
++    case TK_BITOR:    op = OP_BitOr;    break;
++    case TK_BITNOT:   op = OP_BitNot;   break;
++    case TK_LSHIFT:   op = OP_ShiftLeft;  break;
++    case TK_RSHIFT:   op = OP_ShiftRight; break;
++    case TK_REM:      op = OP_Remainder;  break;
++    default: break;
++  }
++  switch( pExpr->op ){
++    case TK_COLUMN: {
++      if( pParse->useAgg ){
++        sqliteVdbeAddOp(v, OP_AggGet, 0, pExpr->iAgg);
++      }else if( pExpr->iColumn>=0 ){
++        sqliteVdbeAddOp(v, OP_Column, pExpr->iTable, pExpr->iColumn);
++      }else{
++        sqliteVdbeAddOp(v, OP_Recno, pExpr->iTable, 0);
++      }
++      break;
++    }
++    case TK_STRING:
++    case TK_FLOAT:
++    case TK_INTEGER: {
++      if( pExpr->op==TK_INTEGER && sqliteFitsIn32Bits(pExpr->token.z) ){
++        sqliteVdbeAddOp(v, OP_Integer, atoi(pExpr->token.z), 0);
++      }else{
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++      }
++      assert( pExpr->token.z );
++      sqliteVdbeChangeP3(v, -1, pExpr->token.z, pExpr->token.n);
++      sqliteVdbeDequoteP3(v, -1);
++      break;
++    }
++    case TK_NULL: {
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      break;
++    }
++    case TK_VARIABLE: {
++      sqliteVdbeAddOp(v, OP_Variable, pExpr->iTable, 0);
++      break;
++    }
++    case TK_LT:
++    case TK_LE:
++    case TK_GT:
++    case TK_GE:
++    case TK_NE:
++    case TK_EQ: {
++      if( pParse->db->file_format>=4 && sqliteExprType(pExpr)==SQLITE_SO_TEXT ){
++        op += 6;  /* Convert numeric opcodes to text opcodes */
++      }
++      /* Fall through into the next case */
++    }
++    case TK_AND:
++    case TK_OR:
++    case TK_PLUS:
++    case TK_STAR:
++    case TK_MINUS:
++    case TK_REM:
++    case TK_BITAND:
++    case TK_BITOR:
++    case TK_SLASH: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteExprCode(pParse, pExpr->pRight);
++      sqliteVdbeAddOp(v, op, 0, 0);
++      break;
++    }
++    case TK_LSHIFT:
++    case TK_RSHIFT: {
++      sqliteExprCode(pParse, pExpr->pRight);
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, op, 0, 0);
++      break;
++    }
++    case TK_CONCAT: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteExprCode(pParse, pExpr->pRight);
++      sqliteVdbeAddOp(v, OP_Concat, 2, 0);
++      break;
++    }
++    case TK_UMINUS: {
++      assert( pExpr->pLeft );
++      if( pExpr->pLeft->op==TK_FLOAT || pExpr->pLeft->op==TK_INTEGER ){
++        Token *p = &pExpr->pLeft->token;
++        char *z = sqliteMalloc( p->n + 2 );
++        sprintf(z, "-%.*s", p->n, p->z);
++        if( pExpr->pLeft->op==TK_INTEGER && sqliteFitsIn32Bits(z) ){
++          sqliteVdbeAddOp(v, OP_Integer, atoi(z), 0);
++        }else{
++          sqliteVdbeAddOp(v, OP_String, 0, 0);
++        }
++        sqliteVdbeChangeP3(v, -1, z, p->n+1);
++        sqliteFree(z);
++        break;
++      }
++      /* Fall through into TK_NOT */
++    }
++    case TK_BITNOT:
++    case TK_NOT: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, op, 0, 0);
++      break;
++    }
++    case TK_ISNULL:
++    case TK_NOTNULL: {
++      int dest;
++      sqliteVdbeAddOp(v, OP_Integer, 1, 0);
++      sqliteExprCode(pParse, pExpr->pLeft);
++      dest = sqliteVdbeCurrentAddr(v) + 2;
++      sqliteVdbeAddOp(v, op, 1, dest);
++      sqliteVdbeAddOp(v, OP_AddImm, -1, 0);
++      break;
++    }
++    case TK_AGG_FUNCTION: {
++      sqliteVdbeAddOp(v, OP_AggGet, 0, pExpr->iAgg);
++      break;
++    }
++    case TK_GLOB:
++    case TK_LIKE:
++    case TK_FUNCTION: {
++      ExprList *pList = pExpr->pList;
++      int nExpr = pList ? pList->nExpr : 0;
++      FuncDef *pDef;
++      int nId;
++      const char *zId;
++      getFunctionName(pExpr, &zId, &nId);
++      pDef = sqliteFindFunction(pParse->db, zId, nId, nExpr, 0);
++      assert( pDef!=0 );
++      nExpr = sqliteExprCodeExprList(pParse, pList, pDef->includeTypes);
++      sqliteVdbeOp3(v, OP_Function, nExpr, 0, (char*)pDef, P3_POINTER);
++      break;
++    }
++    case TK_SELECT: {
++      sqliteVdbeAddOp(v, OP_MemLoad, pExpr->iColumn, 0);
++      break;
++    }
++    case TK_IN: {
++      int addr;
++      sqliteVdbeAddOp(v, OP_Integer, 1, 0);
++      sqliteExprCode(pParse, pExpr->pLeft);
++      addr = sqliteVdbeCurrentAddr(v);
++      sqliteVdbeAddOp(v, OP_NotNull, -1, addr+4);
++      sqliteVdbeAddOp(v, OP_Pop, 2, 0);
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, addr+6);
++      if( pExpr->pSelect ){
++        sqliteVdbeAddOp(v, OP_Found, pExpr->iTable, addr+6);
++      }else{
++        sqliteVdbeAddOp(v, OP_SetFound, pExpr->iTable, addr+6);
++      }
++      sqliteVdbeAddOp(v, OP_AddImm, -1, 0);
++      break;
++    }
++    case TK_BETWEEN: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++      sqliteExprCode(pParse, pExpr->pList->a[0].pExpr);
++      sqliteVdbeAddOp(v, OP_Ge, 0, 0);
++      sqliteVdbeAddOp(v, OP_Pull, 1, 0);
++      sqliteExprCode(pParse, pExpr->pList->a[1].pExpr);
++      sqliteVdbeAddOp(v, OP_Le, 0, 0);
++      sqliteVdbeAddOp(v, OP_And, 0, 0);
++      break;
++    }
++    case TK_UPLUS:
++    case TK_AS: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      break;
++    }
++    case TK_CASE: {
++      int expr_end_label;
++      int jumpInst;
++      int addr;
++      int nExpr;
++      int i;
++
++      assert(pExpr->pList);
++      assert((pExpr->pList->nExpr % 2) == 0);
++      assert(pExpr->pList->nExpr > 0);
++      nExpr = pExpr->pList->nExpr;
++      expr_end_label = sqliteVdbeMakeLabel(v);
++      if( pExpr->pLeft ){
++        sqliteExprCode(pParse, pExpr->pLeft);
++      }
++      for(i=0; i<nExpr; i=i+2){
++        sqliteExprCode(pParse, pExpr->pList->a[i].pExpr);
++        if( pExpr->pLeft ){
++          sqliteVdbeAddOp(v, OP_Dup, 1, 1);
++          jumpInst = sqliteVdbeAddOp(v, OP_Ne, 1, 0);
++          sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++        }else{
++          jumpInst = sqliteVdbeAddOp(v, OP_IfNot, 1, 0);
++        }
++        sqliteExprCode(pParse, pExpr->pList->a[i+1].pExpr);
++        sqliteVdbeAddOp(v, OP_Goto, 0, expr_end_label);
++        addr = sqliteVdbeCurrentAddr(v);
++        sqliteVdbeChangeP2(v, jumpInst, addr);
++      }
++      if( pExpr->pLeft ){
++        sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      }
++      if( pExpr->pRight ){
++        sqliteExprCode(pParse, pExpr->pRight);
++      }else{
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++      }
++      sqliteVdbeResolveLabel(v, expr_end_label);
++      break;
++    }
++    case TK_RAISE: {
++      if( !pParse->trigStack ){
++        sqliteErrorMsg(pParse,
++                       "RAISE() may only be used within a trigger-program");
++        pParse->nErr++;
++      return;
++      }
++      if( pExpr->iColumn == OE_Rollback ||
++        pExpr->iColumn == OE_Abort ||
++        pExpr->iColumn == OE_Fail ){
++        sqliteVdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, pExpr->iColumn,
++                           pExpr->token.z, pExpr->token.n);
++        sqliteVdbeDequoteP3(v, -1);
++      } else {
++        assert( pExpr->iColumn == OE_Ignore );
++        sqliteVdbeOp3(v, OP_Goto, 0, pParse->trigStack->ignoreJump,
++                           "(IGNORE jump)", 0);
++      }
++    }
++    break;
++  }
++}
++
++/*
++** Generate code that pushes the value of every element of the given
++** expression list onto the stack.  If the includeTypes flag is true,
++** then also push a string that is the datatype of each element onto
++** the stack after the value.
++**
++** Return the number of elements pushed onto the stack.
++*/
++int sqliteExprCodeExprList(
++  Parse *pParse,     /* Parsing context */
++  ExprList *pList,   /* The expression list to be coded */
++  int includeTypes   /* TRUE to put datatypes on the stack too */
++){
++  struct ExprList_item *pItem;
++  int i, n;
++  Vdbe *v;
++  if( pList==0 ) return 0;
++  v = sqliteGetVdbe(pParse);
++  n = pList->nExpr;
++  for(pItem=pList->a, i=0; i<n; i++, pItem++){
++    sqliteExprCode(pParse, pItem->pExpr);
++    if( includeTypes ){
++      sqliteVdbeOp3(v, OP_String, 0, 0, 
++         sqliteExprType(pItem->pExpr)==SQLITE_SO_NUM ? "numeric" : "text",
++         P3_STATIC);
++    }
++  }
++  return includeTypes ? n*2 : n;
++}
++
++/*
++** Generate code for a boolean expression such that a jump is made
++** to the label "dest" if the expression is true but execution
++** continues straight thru if the expression is false.
++**
++** If the expression evaluates to NULL (neither true nor false), then
++** take the jump if the jumpIfNull flag is true.
++*/
++void sqliteExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
++  Vdbe *v = pParse->pVdbe;
++  int op = 0;
++  if( v==0 || pExpr==0 ) return;
++  switch( pExpr->op ){
++    case TK_LT:       op = OP_Lt;       break;
++    case TK_LE:       op = OP_Le;       break;
++    case TK_GT:       op = OP_Gt;       break;
++    case TK_GE:       op = OP_Ge;       break;
++    case TK_NE:       op = OP_Ne;       break;
++    case TK_EQ:       op = OP_Eq;       break;
++    case TK_ISNULL:   op = OP_IsNull;   break;
++    case TK_NOTNULL:  op = OP_NotNull;  break;
++    default:  break;
++  }
++  switch( pExpr->op ){
++    case TK_AND: {
++      int d2 = sqliteVdbeMakeLabel(v);
++      sqliteExprIfFalse(pParse, pExpr->pLeft, d2, !jumpIfNull);
++      sqliteExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
++      sqliteVdbeResolveLabel(v, d2);
++      break;
++    }
++    case TK_OR: {
++      sqliteExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
++      sqliteExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
++      break;
++    }
++    case TK_NOT: {
++      sqliteExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
++      break;
++    }
++    case TK_LT:
++    case TK_LE:
++    case TK_GT:
++    case TK_GE:
++    case TK_NE:
++    case TK_EQ: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteExprCode(pParse, pExpr->pRight);
++      if( pParse->db->file_format>=4 && sqliteExprType(pExpr)==SQLITE_SO_TEXT ){
++        op += 6;  /* Convert numeric opcodes to text opcodes */
++      }
++      sqliteVdbeAddOp(v, op, jumpIfNull, dest);
++      break;
++    }
++    case TK_ISNULL:
++    case TK_NOTNULL: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, op, 1, dest);
++      break;
++    }
++    case TK_IN: {
++      int addr;
++      sqliteExprCode(pParse, pExpr->pLeft);
++      addr = sqliteVdbeCurrentAddr(v);
++      sqliteVdbeAddOp(v, OP_NotNull, -1, addr+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, jumpIfNull ? dest : addr+4);
++      if( pExpr->pSelect ){
++        sqliteVdbeAddOp(v, OP_Found, pExpr->iTable, dest);
++      }else{
++        sqliteVdbeAddOp(v, OP_SetFound, pExpr->iTable, dest);
++      }
++      break;
++    }
++    case TK_BETWEEN: {
++      int addr;
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++      sqliteExprCode(pParse, pExpr->pList->a[0].pExpr);
++      addr = sqliteVdbeAddOp(v, OP_Lt, !jumpIfNull, 0);
++      sqliteExprCode(pParse, pExpr->pList->a[1].pExpr);
++      sqliteVdbeAddOp(v, OP_Le, jumpIfNull, dest);
++      sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++      sqliteVdbeChangeP2(v, addr, sqliteVdbeCurrentAddr(v));
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      break;
++    }
++    default: {
++      sqliteExprCode(pParse, pExpr);
++      sqliteVdbeAddOp(v, OP_If, jumpIfNull, dest);
++      break;
++    }
++  }
++}
++
++/*
++** Generate code for a boolean expression such that a jump is made
++** to the label "dest" if the expression is false but execution
++** continues straight thru if the expression is true.
++**
++** If the expression evaluates to NULL (neither true nor false) then
++** jump if jumpIfNull is true or fall through if jumpIfNull is false.
++*/
++void sqliteExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
++  Vdbe *v = pParse->pVdbe;
++  int op = 0;
++  if( v==0 || pExpr==0 ) return;
++  switch( pExpr->op ){
++    case TK_LT:       op = OP_Ge;       break;
++    case TK_LE:       op = OP_Gt;       break;
++    case TK_GT:       op = OP_Le;       break;
++    case TK_GE:       op = OP_Lt;       break;
++    case TK_NE:       op = OP_Eq;       break;
++    case TK_EQ:       op = OP_Ne;       break;
++    case TK_ISNULL:   op = OP_NotNull;  break;
++    case TK_NOTNULL:  op = OP_IsNull;   break;
++    default:  break;
++  }
++  switch( pExpr->op ){
++    case TK_AND: {
++      sqliteExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
++      sqliteExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
++      break;
++    }
++    case TK_OR: {
++      int d2 = sqliteVdbeMakeLabel(v);
++      sqliteExprIfTrue(pParse, pExpr->pLeft, d2, !jumpIfNull);
++      sqliteExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
++      sqliteVdbeResolveLabel(v, d2);
++      break;
++    }
++    case TK_NOT: {
++      sqliteExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
++      break;
++    }
++    case TK_LT:
++    case TK_LE:
++    case TK_GT:
++    case TK_GE:
++    case TK_NE:
++    case TK_EQ: {
++      if( pParse->db->file_format>=4 && sqliteExprType(pExpr)==SQLITE_SO_TEXT ){
++        /* Convert numeric comparison opcodes into text comparison opcodes.
++        ** This step depends on the fact that the text comparision opcodes are
++        ** always 6 greater than their corresponding numeric comparison
++        ** opcodes.
++        */
++        assert( OP_Eq+6 == OP_StrEq );
++        op += 6;
++      }
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteExprCode(pParse, pExpr->pRight);
++      sqliteVdbeAddOp(v, op, jumpIfNull, dest);
++      break;
++    }
++    case TK_ISNULL:
++    case TK_NOTNULL: {
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, op, 1, dest);
++      break;
++    }
++    case TK_IN: {
++      int addr;
++      sqliteExprCode(pParse, pExpr->pLeft);
++      addr = sqliteVdbeCurrentAddr(v);
++      sqliteVdbeAddOp(v, OP_NotNull, -1, addr+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, jumpIfNull ? dest : addr+4);
++      if( pExpr->pSelect ){
++        sqliteVdbeAddOp(v, OP_NotFound, pExpr->iTable, dest);
++      }else{
++        sqliteVdbeAddOp(v, OP_SetNotFound, pExpr->iTable, dest);
++      }
++      break;
++    }
++    case TK_BETWEEN: {
++      int addr;
++      sqliteExprCode(pParse, pExpr->pLeft);
++      sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++      sqliteExprCode(pParse, pExpr->pList->a[0].pExpr);
++      addr = sqliteVdbeCurrentAddr(v);
++      sqliteVdbeAddOp(v, OP_Ge, !jumpIfNull, addr+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, dest);
++      sqliteExprCode(pParse, pExpr->pList->a[1].pExpr);
++      sqliteVdbeAddOp(v, OP_Gt, jumpIfNull, dest);
++      break;
++    }
++    default: {
++      sqliteExprCode(pParse, pExpr);
++      sqliteVdbeAddOp(v, OP_IfNot, jumpIfNull, dest);
++      break;
++    }
++  }
++}
++
++/*
++** Do a deep comparison of two expression trees.  Return TRUE (non-zero)
++** if they are identical and return FALSE if they differ in any way.
++*/
++int sqliteExprCompare(Expr *pA, Expr *pB){
++  int i;
++  if( pA==0 ){
++    return pB==0;
++  }else if( pB==0 ){
++    return 0;
++  }
++  if( pA->op!=pB->op ) return 0;
++  if( !sqliteExprCompare(pA->pLeft, pB->pLeft) ) return 0;
++  if( !sqliteExprCompare(pA->pRight, pB->pRight) ) return 0;
++  if( pA->pList ){
++    if( pB->pList==0 ) return 0;
++    if( pA->pList->nExpr!=pB->pList->nExpr ) return 0;
++    for(i=0; i<pA->pList->nExpr; i++){
++      if( !sqliteExprCompare(pA->pList->a[i].pExpr, pB->pList->a[i].pExpr) ){
++        return 0;
++      }
++    }
++  }else if( pB->pList ){
++    return 0;
++  }
++  if( pA->pSelect || pB->pSelect ) return 0;
++  if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 0;
++  if( pA->token.z ){
++    if( pB->token.z==0 ) return 0;
++    if( pB->token.n!=pA->token.n ) return 0;
++    if( sqliteStrNICmp(pA->token.z, pB->token.z, pB->token.n)!=0 ) return 0;
++  }
++  return 1;
++}
++
++/*
++** Add a new element to the pParse->aAgg[] array and return its index.
++*/
++static int appendAggInfo(Parse *pParse){
++  if( (pParse->nAgg & 0x7)==0 ){
++    int amt = pParse->nAgg + 8;
++    AggExpr *aAgg = sqliteRealloc(pParse->aAgg, amt*sizeof(pParse->aAgg[0]));
++    if( aAgg==0 ){
++      return -1;
++    }
++    pParse->aAgg = aAgg;
++  }
++  memset(&pParse->aAgg[pParse->nAgg], 0, sizeof(pParse->aAgg[0]));
++  return pParse->nAgg++;
++}
++
++/*
++** Analyze the given expression looking for aggregate functions and
++** for variables that need to be added to the pParse->aAgg[] array.
++** Make additional entries to the pParse->aAgg[] array as necessary.
++**
++** This routine should only be called after the expression has been
++** analyzed by sqliteExprResolveIds() and sqliteExprCheck().
++**
++** If errors are seen, leave an error message in zErrMsg and return
++** the number of errors.
++*/
++int sqliteExprAnalyzeAggregates(Parse *pParse, Expr *pExpr){
++  int i;
++  AggExpr *aAgg;
++  int nErr = 0;
++
++  if( pExpr==0 ) return 0;
++  switch( pExpr->op ){
++    case TK_COLUMN: {
++      aAgg = pParse->aAgg;
++      for(i=0; i<pParse->nAgg; i++){
++        if( aAgg[i].isAgg ) continue;
++        if( aAgg[i].pExpr->iTable==pExpr->iTable
++         && aAgg[i].pExpr->iColumn==pExpr->iColumn ){
++          break;
++        }
++      }
++      if( i>=pParse->nAgg ){
++        i = appendAggInfo(pParse);
++        if( i<0 ) return 1;
++        pParse->aAgg[i].isAgg = 0;
++        pParse->aAgg[i].pExpr = pExpr;
++      }
++      pExpr->iAgg = i;
++      break;
++    }
++    case TK_AGG_FUNCTION: {
++      aAgg = pParse->aAgg;
++      for(i=0; i<pParse->nAgg; i++){
++        if( !aAgg[i].isAgg ) continue;
++        if( sqliteExprCompare(aAgg[i].pExpr, pExpr) ){
++          break;
++        }
++      }
++      if( i>=pParse->nAgg ){
++        i = appendAggInfo(pParse);
++        if( i<0 ) return 1;
++        pParse->aAgg[i].isAgg = 1;
++        pParse->aAgg[i].pExpr = pExpr;
++        pParse->aAgg[i].pFunc = sqliteFindFunction(pParse->db,
++             pExpr->token.z, pExpr->token.n,
++             pExpr->pList ? pExpr->pList->nExpr : 0, 0);
++      }
++      pExpr->iAgg = i;
++      break;
++    }
++    default: {
++      if( pExpr->pLeft ){
++        nErr = sqliteExprAnalyzeAggregates(pParse, pExpr->pLeft);
++      }
++      if( nErr==0 && pExpr->pRight ){
++        nErr = sqliteExprAnalyzeAggregates(pParse, pExpr->pRight);
++      }
++      if( nErr==0 && pExpr->pList ){
++        int n = pExpr->pList->nExpr;
++        int i;
++        for(i=0; nErr==0 && i<n; i++){
++          nErr = sqliteExprAnalyzeAggregates(pParse, pExpr->pList->a[i].pExpr);
++        }
++      }
++      break;
++    }
++  }
++  return nErr;
++}
++
++/*
++** Locate a user function given a name and a number of arguments.
++** Return a pointer to the FuncDef structure that defines that
++** function, or return NULL if the function does not exist.
++**
++** If the createFlag argument is true, then a new (blank) FuncDef
++** structure is created and liked into the "db" structure if a
++** no matching function previously existed.  When createFlag is true
++** and the nArg parameter is -1, then only a function that accepts
++** any number of arguments will be returned.
++**
++** If createFlag is false and nArg is -1, then the first valid
++** function found is returned.  A function is valid if either xFunc
++** or xStep is non-zero.
++*/
++FuncDef *sqliteFindFunction(
++  sqlite *db,        /* An open database */
++  const char *zName, /* Name of the function.  Not null-terminated */
++  int nName,         /* Number of characters in the name */
++  int nArg,          /* Number of arguments.  -1 means any number */
++  int createFlag     /* Create new entry if true and does not otherwise exist */
++){
++  FuncDef *pFirst, *p, *pMaybe;
++  pFirst = p = (FuncDef*)sqliteHashFind(&db->aFunc, zName, nName);
++  if( p && !createFlag && nArg<0 ){
++    while( p && p->xFunc==0 && p->xStep==0 ){ p = p->pNext; }
++    return p;
++  }
++  pMaybe = 0;
++  while( p && p->nArg!=nArg ){
++    if( p->nArg<0 && !createFlag && (p->xFunc || p->xStep) ) pMaybe = p;
++    p = p->pNext;
++  }
++  if( p && !createFlag && p->xFunc==0 && p->xStep==0 ){
++    return 0;
++  }
++  if( p==0 && pMaybe ){
++    assert( createFlag==0 );
++    return pMaybe;
++  }
++  if( p==0 && createFlag && (p = sqliteMalloc(sizeof(*p)))!=0 ){
++    p->nArg = nArg;
++    p->pNext = pFirst;
++    p->dataType = pFirst ? pFirst->dataType : SQLITE_NUMERIC;
++    sqliteHashInsert(&db->aFunc, zName, nName, (void*)p);
++  }
++  return p;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/func.c
+@@ -0,0 +1,658 @@
++/*
++** 2002 February 23
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains the C functions that implement various SQL
++** functions of SQLite.  
++**
++** There is only one exported symbol in this file - the function
++** sqliteRegisterBuildinFunctions() found at the bottom of the file.
++** All other code has file scope.
++**
++** $Id$
++*/
++#include <ctype.h>
++#include <math.h>
++#include <stdlib.h>
++#include <assert.h>
++#include "sqliteInt.h"
++#include "os.h"
++
++/*
++** Implementation of the non-aggregate min() and max() functions
++*/
++static void minmaxFunc(sqlite_func *context, int argc, const char **argv){
++  const char *zBest; 
++  int i;
++  int (*xCompare)(const char*, const char*);
++  int mask;    /* 0 for min() or 0xffffffff for max() */
++
++  if( argc==0 ) return;
++  mask = (int)sqlite_user_data(context);
++  zBest = argv[0];
++  if( zBest==0 ) return;
++  if( argv[1][0]=='n' ){
++    xCompare = sqliteCompare;
++  }else{
++    xCompare = strcmp;
++  }
++  for(i=2; i<argc; i+=2){
++    if( argv[i]==0 ) return;
++    if( (xCompare(argv[i], zBest)^mask)<0 ){
++      zBest = argv[i];
++    }
++  }
++  sqlite_set_result_string(context, zBest, -1);
++}
++
++/*
++** Return the type of the argument.
++*/
++static void typeofFunc(sqlite_func *context, int argc, const char **argv){
++  assert( argc==2 );
++  sqlite_set_result_string(context, argv[1], -1);
++}
++
++/*
++** Implementation of the length() function
++*/
++static void lengthFunc(sqlite_func *context, int argc, const char **argv){
++  const char *z;
++  int len;
++
++  assert( argc==1 );
++  z = argv[0];
++  if( z==0 ) return;
++#ifdef SQLITE_UTF8
++  for(len=0; *z; z++){ if( (0xc0&*z)!=0x80 ) len++; }
++#else
++  len = strlen(z);
++#endif
++  sqlite_set_result_int(context, len);
++}
++
++/*
++** Implementation of the abs() function
++*/
++static void absFunc(sqlite_func *context, int argc, const char **argv){
++  const char *z;
++  assert( argc==1 );
++  z = argv[0];
++  if( z==0 ) return;
++  if( z[0]=='-' && isdigit(z[1]) ) z++;
++  sqlite_set_result_string(context, z, -1);
++}
++
++/*
++** Implementation of the substr() function
++*/
++static void substrFunc(sqlite_func *context, int argc, const char **argv){
++  const char *z;
++#ifdef SQLITE_UTF8
++  const char *z2;
++  int i;
++#endif
++  int p1, p2, len;
++  assert( argc==3 );
++  z = argv[0];
++  if( z==0 ) return;
++  p1 = atoi(argv[1]?argv[1]:0);
++  p2 = atoi(argv[2]?argv[2]:0);
++#ifdef SQLITE_UTF8
++  for(len=0, z2=z; *z2; z2++){ if( (0xc0&*z2)!=0x80 ) len++; }
++#else
++  len = strlen(z);
++#endif
++  if( p1<0 ){
++    p1 += len;
++    if( p1<0 ){
++      p2 += p1;
++      p1 = 0;
++    }
++  }else if( p1>0 ){
++    p1--;
++  }
++  if( p1+p2>len ){
++    p2 = len-p1;
++  }
++#ifdef SQLITE_UTF8
++  for(i=0; i<p1 && z[i]; i++){
++    if( (z[i]&0xc0)==0x80 ) p1++;
++  }
++  while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p1++; }
++  for(; i<p1+p2 && z[i]; i++){
++    if( (z[i]&0xc0)==0x80 ) p2++;
++  }
++  while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p2++; }
++#endif
++  if( p2<0 ) p2 = 0;
++  sqlite_set_result_string(context, &z[p1], p2);
++}
++
++/*
++** Implementation of the round() function
++*/
++static void roundFunc(sqlite_func *context, int argc, const char **argv){
++  int n;
++  double r;
++  char zBuf[100];
++  assert( argc==1 || argc==2 );
++  if( argv[0]==0 || (argc==2 && argv[1]==0) ) return;
++  n = argc==2 ? atoi(argv[1]) : 0;
++  if( n>30 ) n = 30;
++  if( n<0 ) n = 0;
++  r = sqliteAtoF(argv[0], 0);
++  sprintf(zBuf,"%.*f",n,r);
++  sqlite_set_result_string(context, zBuf, -1);
++}
++
++/*
++** Implementation of the upper() and lower() SQL functions.
++*/
++static void upperFunc(sqlite_func *context, int argc, const char **argv){
++  unsigned char *z;
++  int i;
++  if( argc<1 || argv[0]==0 ) return;
++  z = (unsigned char*)sqlite_set_result_string(context, argv[0], -1);
++  if( z==0 ) return;
++  for(i=0; z[i]; i++){
++    if( islower(z[i]) ) z[i] = toupper(z[i]);
++  }
++}
++static void lowerFunc(sqlite_func *context, int argc, const char **argv){
++  unsigned char *z;
++  int i;
++  if( argc<1 || argv[0]==0 ) return;
++  z = (unsigned char*)sqlite_set_result_string(context, argv[0], -1);
++  if( z==0 ) return;
++  for(i=0; z[i]; i++){
++    if( isupper(z[i]) ) z[i] = tolower(z[i]);
++  }
++}
++
++/*
++** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  
++** All three do the same thing.  They return the first non-NULL
++** argument.
++*/
++static void ifnullFunc(sqlite_func *context, int argc, const char **argv){
++  int i;
++  for(i=0; i<argc; i++){
++    if( argv[i] ){
++      sqlite_set_result_string(context, argv[i], -1);
++      break;
++    }
++  }
++}
++
++/*
++** Implementation of random().  Return a random integer.  
++*/
++static void randomFunc(sqlite_func *context, int argc, const char **argv){
++  int r;
++  sqliteRandomness(sizeof(r), &r);
++  sqlite_set_result_int(context, r);
++}
++
++/*
++** Implementation of the last_insert_rowid() SQL function.  The return
++** value is the same as the sqlite_last_insert_rowid() API function.
++*/
++static void last_insert_rowid(sqlite_func *context, int arg, const char **argv){
++  sqlite *db = sqlite_user_data(context);
++  sqlite_set_result_int(context, sqlite_last_insert_rowid(db));
++}
++
++/*
++** Implementation of the change_count() SQL function.  The return
++** value is the same as the sqlite_changes() API function.
++*/
++static void change_count(sqlite_func *context, int arg, const char **argv){
++  sqlite *db = sqlite_user_data(context);
++  sqlite_set_result_int(context, sqlite_changes(db));
++}
++
++/*
++** Implementation of the last_statement_change_count() SQL function.  The
++** return value is the same as the sqlite_last_statement_changes() API function.
++*/
++static void last_statement_change_count(sqlite_func *context, int arg,
++                                        const char **argv){
++  sqlite *db = sqlite_user_data(context);
++  sqlite_set_result_int(context, sqlite_last_statement_changes(db));
++}
++
++/*
++** Implementation of the like() SQL function.  This function implements
++** the build-in LIKE operator.  The first argument to the function is the
++** string and the second argument is the pattern.  So, the SQL statements:
++**
++**       A LIKE B
++**
++** is implemented as like(A,B).
++*/
++static void likeFunc(sqlite_func *context, int arg, const char **argv){
++  if( argv[0]==0 || argv[1]==0 ) return;
++  sqlite_set_result_int(context, 
++    sqliteLikeCompare((const unsigned char*)argv[0],
++                      (const unsigned char*)argv[1]));
++}
++
++/*
++** Implementation of the glob() SQL function.  This function implements
++** the build-in GLOB operator.  The first argument to the function is the
++** string and the second argument is the pattern.  So, the SQL statements:
++**
++**       A GLOB B
++**
++** is implemented as glob(A,B).
++*/
++static void globFunc(sqlite_func *context, int arg, const char **argv){
++  if( argv[0]==0 || argv[1]==0 ) return;
++  sqlite_set_result_int(context,
++    sqliteGlobCompare((const unsigned char*)argv[0],
++                      (const unsigned char*)argv[1]));
++}
++
++/*
++** Implementation of the NULLIF(x,y) function.  The result is the first
++** argument if the arguments are different.  The result is NULL if the
++** arguments are equal to each other.
++*/
++static void nullifFunc(sqlite_func *context, int argc, const char **argv){
++  if( argv[0]!=0 && sqliteCompare(argv[0],argv[1])!=0 ){
++    sqlite_set_result_string(context, argv[0], -1);
++  }
++}
++
++/*
++** Implementation of the VERSION(*) function.  The result is the version
++** of the SQLite library that is running.
++*/
++static void versionFunc(sqlite_func *context, int argc, const char **argv){
++  sqlite_set_result_string(context, sqlite_version, -1);
++}
++
++/*
++** EXPERIMENTAL - This is not an official function.  The interface may
++** change.  This function may disappear.  Do not write code that depends
++** on this function.
++**
++** Implementation of the QUOTE() function.  This function takes a single
++** argument.  If the argument is numeric, the return value is the same as
++** the argument.  If the argument is NULL, the return value is the string
++** "NULL".  Otherwise, the argument is enclosed in single quotes with
++** single-quote escapes.
++*/
++static void quoteFunc(sqlite_func *context, int argc, const char **argv){
++  if( argc<1 ) return;
++  if( argv[0]==0 ){
++    sqlite_set_result_string(context, "NULL", 4);
++  }else if( sqliteIsNumber(argv[0]) ){
++    sqlite_set_result_string(context, argv[0], -1);
++  }else{
++    int i,j,n;
++    char *z;
++    for(i=n=0; argv[0][i]; i++){ if( argv[0][i]=='\'' ) n++; }
++    z = sqliteMalloc( i+n+3 );
++    if( z==0 ) return;
++    z[0] = '\'';
++    for(i=0, j=1; argv[0][i]; i++){
++      z[j++] = argv[0][i];
++      if( argv[0][i]=='\'' ){
++        z[j++] = '\'';
++      }
++    }
++    z[j++] = '\'';
++    z[j] = 0;
++    sqlite_set_result_string(context, z, j);
++    sqliteFree(z);
++  }
++}
++
++#ifdef SQLITE_SOUNDEX
++/*
++** Compute the soundex encoding of a word.
++*/
++static void soundexFunc(sqlite_func *context, int argc, const char **argv){
++  char zResult[8];
++  const char *zIn;
++  int i, j;
++  static const unsigned char iCode[] = {
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
++    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
++    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
++    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
++  };
++  assert( argc==1 );
++  zIn = argv[0];
++  for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}
++  if( zIn[i] ){
++    zResult[0] = toupper(zIn[i]);
++    for(j=1; j<4 && zIn[i]; i++){
++      int code = iCode[zIn[i]&0x7f];
++      if( code>0 ){
++        zResult[j++] = code + '0';
++      }
++    }
++    while( j<4 ){
++      zResult[j++] = '0';
++    }
++    zResult[j] = 0;
++    sqlite_set_result_string(context, zResult, 4);
++  }else{
++    sqlite_set_result_string(context, "?000", 4);
++  }
++}
++#endif
++
++#ifdef SQLITE_TEST
++/*
++** This function generates a string of random characters.  Used for
++** generating test data.
++*/
++static void randStr(sqlite_func *context, int argc, const char **argv){
++  static const unsigned char zSrc[] = 
++     "abcdefghijklmnopqrstuvwxyz"
++     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
++     "0123456789"
++     ".-!,:*^+=_|?/<> ";
++  int iMin, iMax, n, r, i;
++  unsigned char zBuf[1000];
++  if( argc>=1 ){
++    iMin = atoi(argv[0]);
++    if( iMin<0 ) iMin = 0;
++    if( iMin>=sizeof(zBuf) ) iMin = sizeof(zBuf)-1;
++  }else{
++    iMin = 1;
++  }
++  if( argc>=2 ){
++    iMax = atoi(argv[1]);
++    if( iMax<iMin ) iMax = iMin;
++    if( iMax>=sizeof(zBuf) ) iMax = sizeof(zBuf)-1;
++  }else{
++    iMax = 50;
++  }
++  n = iMin;
++  if( iMax>iMin ){
++    sqliteRandomness(sizeof(r), &r);
++    r &= 0x7fffffff;
++    n += r%(iMax + 1 - iMin);
++  }
++  assert( n<sizeof(zBuf) );
++  sqliteRandomness(n, zBuf);
++  for(i=0; i<n; i++){
++    zBuf[i] = zSrc[zBuf[i]%(sizeof(zSrc)-1)];
++  }
++  zBuf[n] = 0;
++  sqlite_set_result_string(context, zBuf, n);
++}
++#endif
++
++/*
++** An instance of the following structure holds the context of a
++** sum() or avg() aggregate computation.
++*/
++typedef struct SumCtx SumCtx;
++struct SumCtx {
++  double sum;     /* Sum of terms */
++  int cnt;        /* Number of elements summed */
++};
++
++/*
++** Routines used to compute the sum or average.
++*/
++static void sumStep(sqlite_func *context, int argc, const char **argv){
++  SumCtx *p;
++  if( argc<1 ) return;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  if( p && argv[0] ){
++    p->sum += sqliteAtoF(argv[0], 0);
++    p->cnt++;
++  }
++}
++static void sumFinalize(sqlite_func *context){
++  SumCtx *p;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  sqlite_set_result_double(context, p ? p->sum : 0.0);
++}
++static void avgFinalize(sqlite_func *context){
++  SumCtx *p;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  if( p && p->cnt>0 ){
++    sqlite_set_result_double(context, p->sum/(double)p->cnt);
++  }
++}
++
++/*
++** An instance of the following structure holds the context of a
++** variance or standard deviation computation.
++*/
++typedef struct StdDevCtx StdDevCtx;
++struct StdDevCtx {
++  double sum;     /* Sum of terms */
++  double sum2;    /* Sum of the squares of terms */
++  int cnt;        /* Number of terms counted */
++};
++
++#if 0   /* Omit because math library is required */
++/*
++** Routines used to compute the standard deviation as an aggregate.
++*/
++static void stdDevStep(sqlite_func *context, int argc, const char **argv){
++  StdDevCtx *p;
++  double x;
++  if( argc<1 ) return;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  if( p && argv[0] ){
++    x = sqliteAtoF(argv[0], 0);
++    p->sum += x;
++    p->sum2 += x*x;
++    p->cnt++;
++  }
++}
++static void stdDevFinalize(sqlite_func *context){
++  double rN = sqlite_aggregate_count(context);
++  StdDevCtx *p = sqlite_aggregate_context(context, sizeof(*p));
++  if( p && p->cnt>1 ){
++    double rCnt = cnt;
++    sqlite_set_result_double(context, 
++       sqrt((p->sum2 - p->sum*p->sum/rCnt)/(rCnt-1.0)));
++  }
++}
++#endif
++
++/*
++** The following structure keeps track of state information for the
++** count() aggregate function.
++*/
++typedef struct CountCtx CountCtx;
++struct CountCtx {
++  int n;
++};
++
++/*
++** Routines to implement the count() aggregate function.
++*/
++static void countStep(sqlite_func *context, int argc, const char **argv){
++  CountCtx *p;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  if( (argc==0 || argv[0]) && p ){
++    p->n++;
++  }
++}   
++static void countFinalize(sqlite_func *context){
++  CountCtx *p;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  sqlite_set_result_int(context, p ? p->n : 0);
++}
++
++/*
++** This function tracks state information for the min() and max()
++** aggregate functions.
++*/
++typedef struct MinMaxCtx MinMaxCtx;
++struct MinMaxCtx {
++  char *z;         /* The best so far */
++  char zBuf[28];   /* Space that can be used for storage */
++};
++
++/*
++** Routines to implement min() and max() aggregate functions.
++*/
++static void minmaxStep(sqlite_func *context, int argc, const char **argv){
++  MinMaxCtx *p;
++  int (*xCompare)(const char*, const char*);
++  int mask;    /* 0 for min() or 0xffffffff for max() */
++
++  assert( argc==2 );
++  if( argv[0]==0 ) return;  /* Ignore NULL values */
++  if( argv[1][0]=='n' ){
++    xCompare = sqliteCompare;
++  }else{
++    xCompare = strcmp;
++  }
++  mask = (int)sqlite_user_data(context);
++  assert( mask==0 || mask==-1 );
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  if( p==0 || argc<1 ) return;
++  if( p->z==0 || (xCompare(argv[0],p->z)^mask)<0 ){
++    int len;
++    if( p->zBuf[0] ){
++      sqliteFree(p->z);
++    }
++    len = strlen(argv[0]);
++    if( len < sizeof(p->zBuf)-1 ){
++      p->z = &p->zBuf[1];
++      p->zBuf[0] = 0;
++    }else{
++      p->z = sqliteMalloc( len+1 );
++      p->zBuf[0] = 1;
++      if( p->z==0 ) return;
++    }
++    strcpy(p->z, argv[0]);
++  }
++}
++static void minMaxFinalize(sqlite_func *context){
++  MinMaxCtx *p;
++  p = sqlite_aggregate_context(context, sizeof(*p));
++  if( p && p->z && p->zBuf[0]<2 ){
++    sqlite_set_result_string(context, p->z, strlen(p->z));
++  }
++  if( p && p->zBuf[0] ){
++    sqliteFree(p->z);
++  }
++}
++
++/*
++** This function registered all of the above C functions as SQL
++** functions.  This should be the only routine in this file with
++** external linkage.
++*/
++void sqliteRegisterBuiltinFunctions(sqlite *db){
++  static struct {
++     char *zName;
++     signed char nArg;
++     signed char dataType;
++     u8 argType;               /* 0: none.  1: db  2: (-1) */
++     void (*xFunc)(sqlite_func*,int,const char**);
++  } aFuncs[] = {
++    { "min",       -1, SQLITE_ARGS,    0, minmaxFunc },
++    { "min",        0, 0,              0, 0          },
++    { "max",       -1, SQLITE_ARGS,    2, minmaxFunc },
++    { "max",        0, 0,              2, 0          },
++    { "typeof",     1, SQLITE_TEXT,    0, typeofFunc },
++    { "length",     1, SQLITE_NUMERIC, 0, lengthFunc },
++    { "substr",     3, SQLITE_TEXT,    0, substrFunc },
++    { "abs",        1, SQLITE_NUMERIC, 0, absFunc    },
++    { "round",      1, SQLITE_NUMERIC, 0, roundFunc  },
++    { "round",      2, SQLITE_NUMERIC, 0, roundFunc  },
++    { "upper",      1, SQLITE_TEXT,    0, upperFunc  },
++    { "lower",      1, SQLITE_TEXT,    0, lowerFunc  },
++    { "coalesce",  -1, SQLITE_ARGS,    0, ifnullFunc },
++    { "coalesce",   0, 0,              0, 0          },
++    { "coalesce",   1, 0,              0, 0          },
++    { "ifnull",     2, SQLITE_ARGS,    0, ifnullFunc },
++    { "random",    -1, SQLITE_NUMERIC, 0, randomFunc },
++    { "like",       2, SQLITE_NUMERIC, 0, likeFunc   },
++    { "glob",       2, SQLITE_NUMERIC, 0, globFunc   },
++    { "nullif",     2, SQLITE_ARGS,    0, nullifFunc },
++    { "sqlite_version",0,SQLITE_TEXT,  0, versionFunc},
++    { "quote",      1, SQLITE_ARGS,    0, quoteFunc  },
++    { "last_insert_rowid", 0, SQLITE_NUMERIC, 1, last_insert_rowid },
++    { "change_count",      0, SQLITE_NUMERIC, 1, change_count      },
++    { "last_statement_change_count",
++                           0, SQLITE_NUMERIC, 1, last_statement_change_count },
++#ifdef SQLITE_SOUNDEX
++    { "soundex",    1, SQLITE_TEXT,    0, soundexFunc},
++#endif
++#ifdef SQLITE_TEST
++    { "randstr",    2, SQLITE_TEXT,    0, randStr    },
++#endif
++  };
++  static struct {
++    char *zName;
++    signed char nArg;
++    signed char dataType;
++    u8 argType;
++    void (*xStep)(sqlite_func*,int,const char**);
++    void (*xFinalize)(sqlite_func*);
++  } aAggs[] = {
++    { "min",    1, 0,              0, minmaxStep,   minMaxFinalize },
++    { "max",    1, 0,              2, minmaxStep,   minMaxFinalize },
++    { "sum",    1, SQLITE_NUMERIC, 0, sumStep,      sumFinalize    },
++    { "avg",    1, SQLITE_NUMERIC, 0, sumStep,      avgFinalize    },
++    { "count",  0, SQLITE_NUMERIC, 0, countStep,    countFinalize  },
++    { "count",  1, SQLITE_NUMERIC, 0, countStep,    countFinalize  },
++#if 0
++    { "stddev", 1, SQLITE_NUMERIC, 0, stdDevStep,   stdDevFinalize },
++#endif
++  };
++  static const char *azTypeFuncs[] = { "min", "max", "typeof" };
++  int i;
++
++  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
++    void *pArg;
++    switch( aFuncs[i].argType ){
++      case 0:  pArg = 0;           break;
++      case 1:  pArg = db;          break;
++      case 2:  pArg = (void*)(-1); break;
++    }
++    sqlite_create_function(db, aFuncs[i].zName,
++           aFuncs[i].nArg, aFuncs[i].xFunc, pArg);
++    if( aFuncs[i].xFunc ){
++      sqlite_function_type(db, aFuncs[i].zName, aFuncs[i].dataType);
++    }
++  }
++  for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
++    void *pArg;
++    switch( aAggs[i].argType ){
++      case 0:  pArg = 0;           break;
++      case 1:  pArg = db;          break;
++      case 2:  pArg = (void*)(-1); break;
++    }
++    sqlite_create_aggregate(db, aAggs[i].zName,
++           aAggs[i].nArg, aAggs[i].xStep, aAggs[i].xFinalize, pArg);
++    sqlite_function_type(db, aAggs[i].zName, aAggs[i].dataType);
++  }
++  for(i=0; i<sizeof(azTypeFuncs)/sizeof(azTypeFuncs[0]); i++){
++    int n = strlen(azTypeFuncs[i]);
++    FuncDef *p = sqliteHashFind(&db->aFunc, azTypeFuncs[i], n);
++    while( p ){
++      p->includeTypes = 1;
++      p = p->pNext;
++    }
++  }
++  sqliteRegisterDateTimeFunctions(db);
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/hash.c
+@@ -0,0 +1,356 @@
++/*
++** 2001 September 22
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This is the implementation of generic hash-tables
++** used in SQLite.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include <assert.h>
++
++/* Turn bulk memory into a hash table object by initializing the
++** fields of the Hash structure.
++**
++** "new" is a pointer to the hash table that is to be initialized.
++** keyClass is one of the constants SQLITE_HASH_INT, SQLITE_HASH_POINTER,
++** SQLITE_HASH_BINARY, or SQLITE_HASH_STRING.  The value of keyClass 
++** determines what kind of key the hash table will use.  "copyKey" is
++** true if the hash table should make its own private copy of keys and
++** false if it should just use the supplied pointer.  CopyKey only makes
++** sense for SQLITE_HASH_STRING and SQLITE_HASH_BINARY and is ignored
++** for other key classes.
++*/
++void sqliteHashInit(Hash *new, int keyClass, int copyKey){
++  assert( new!=0 );
++  assert( keyClass>=SQLITE_HASH_INT && keyClass<=SQLITE_HASH_BINARY );
++  new->keyClass = keyClass;
++  new->copyKey = copyKey &&
++                (keyClass==SQLITE_HASH_STRING || keyClass==SQLITE_HASH_BINARY);
++  new->first = 0;
++  new->count = 0;
++  new->htsize = 0;
++  new->ht = 0;
++}
++
++/* Remove all entries from a hash table.  Reclaim all memory.
++** Call this routine to delete a hash table or to reset a hash table
++** to the empty state.
++*/
++void sqliteHashClear(Hash *pH){
++  HashElem *elem;         /* For looping over all elements of the table */
++
++  assert( pH!=0 );
++  elem = pH->first;
++  pH->first = 0;
++  if( pH->ht ) sqliteFree(pH->ht);
++  pH->ht = 0;
++  pH->htsize = 0;
++  while( elem ){
++    HashElem *next_elem = elem->next;
++    if( pH->copyKey && elem->pKey ){
++      sqliteFree(elem->pKey);
++    }
++    sqliteFree(elem);
++    elem = next_elem;
++  }
++  pH->count = 0;
++}
++
++/*
++** Hash and comparison functions when the mode is SQLITE_HASH_INT
++*/
++static int intHash(const void *pKey, int nKey){
++  return nKey ^ (nKey<<8) ^ (nKey>>8);
++}
++static int intCompare(const void *pKey1, int n1, const void *pKey2, int n2){
++  return n2 - n1;
++}
++
++#if 0 /* NOT USED */
++/*
++** Hash and comparison functions when the mode is SQLITE_HASH_POINTER
++*/
++static int ptrHash(const void *pKey, int nKey){
++  uptr x = Addr(pKey);
++  return x ^ (x<<8) ^ (x>>8);
++}
++static int ptrCompare(const void *pKey1, int n1, const void *pKey2, int n2){
++  if( pKey1==pKey2 ) return 0;
++  if( pKey1<pKey2 ) return -1;
++  return 1;
++}
++#endif
++
++/*
++** Hash and comparison functions when the mode is SQLITE_HASH_STRING
++*/
++static int strHash(const void *pKey, int nKey){
++  return sqliteHashNoCase((const char*)pKey, nKey); 
++}
++static int strCompare(const void *pKey1, int n1, const void *pKey2, int n2){
++  if( n1!=n2 ) return n2-n1;
++  return sqliteStrNICmp((const char*)pKey1,(const char*)pKey2,n1);
++}
++
++/*
++** Hash and comparison functions when the mode is SQLITE_HASH_BINARY
++*/
++static int binHash(const void *pKey, int nKey){
++  int h = 0;
++  const char *z = (const char *)pKey;
++  while( nKey-- > 0 ){
++    h = (h<<3) ^ h ^ *(z++);
++  }
++  return h & 0x7fffffff;
++}
++static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){
++  if( n1!=n2 ) return n2-n1;
++  return memcmp(pKey1,pKey2,n1);
++}
++
++/*
++** Return a pointer to the appropriate hash function given the key class.
++**
++** The C syntax in this function definition may be unfamilar to some 
++** programmers, so we provide the following additional explanation:
++**
++** The name of the function is "hashFunction".  The function takes a
++** single parameter "keyClass".  The return value of hashFunction()
++** is a pointer to another function.  Specifically, the return value
++** of hashFunction() is a pointer to a function that takes two parameters
++** with types "const void*" and "int" and returns an "int".
++*/
++static int (*hashFunction(int keyClass))(const void*,int){
++  switch( keyClass ){
++    case SQLITE_HASH_INT:     return &intHash;
++    /* case SQLITE_HASH_POINTER: return &ptrHash; // NOT USED */
++    case SQLITE_HASH_STRING:  return &strHash;
++    case SQLITE_HASH_BINARY:  return &binHash;;
++    default: break;
++  }
++  return 0;
++}
++
++/*
++** Return a pointer to the appropriate hash function given the key class.
++**
++** For help in interpreted the obscure C code in the function definition,
++** see the header comment on the previous function.
++*/
++static int (*compareFunction(int keyClass))(const void*,int,const void*,int){
++  switch( keyClass ){
++    case SQLITE_HASH_INT:     return &intCompare;
++    /* case SQLITE_HASH_POINTER: return &ptrCompare; // NOT USED */
++    case SQLITE_HASH_STRING:  return &strCompare;
++    case SQLITE_HASH_BINARY:  return &binCompare;
++    default: break;
++  }
++  return 0;
++}
++
++
++/* Resize the hash table so that it cantains "new_size" buckets.
++** "new_size" must be a power of 2.  The hash table might fail 
++** to resize if sqliteMalloc() fails.
++*/
++static void rehash(Hash *pH, int new_size){
++  struct _ht *new_ht;            /* The new hash table */
++  HashElem *elem, *next_elem;    /* For looping over existing elements */
++  HashElem *x;                   /* Element being copied to new hash table */
++  int (*xHash)(const void*,int); /* The hash function */
++
++  assert( (new_size & (new_size-1))==0 );
++  new_ht = (struct _ht *)sqliteMalloc( new_size*sizeof(struct _ht) );
++  if( new_ht==0 ) return;
++  if( pH->ht ) sqliteFree(pH->ht);
++  pH->ht = new_ht;
++  pH->htsize = new_size;
++  xHash = hashFunction(pH->keyClass);
++  for(elem=pH->first, pH->first=0; elem; elem = next_elem){
++    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);
++    next_elem = elem->next;
++    x = new_ht[h].chain;
++    if( x ){
++      elem->next = x;
++      elem->prev = x->prev;
++      if( x->prev ) x->prev->next = elem;
++      else          pH->first = elem;
++      x->prev = elem;
++    }else{
++      elem->next = pH->first;
++      if( pH->first ) pH->first->prev = elem;
++      elem->prev = 0;
++      pH->first = elem;
++    }
++    new_ht[h].chain = elem;
++    new_ht[h].count++;
++  }
++}
++
++/* This function (for internal use only) locates an element in an
++** hash table that matches the given key.  The hash for this key has
++** already been computed and is passed as the 4th parameter.
++*/
++static HashElem *findElementGivenHash(
++  const Hash *pH,     /* The pH to be searched */
++  const void *pKey,   /* The key we are searching for */
++  int nKey,
++  int h               /* The hash for this key. */
++){
++  HashElem *elem;                /* Used to loop thru the element list */
++  int count;                     /* Number of elements left to test */
++  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */
++
++  if( pH->ht ){
++    elem = pH->ht[h].chain;
++    count = pH->ht[h].count;
++    xCompare = compareFunction(pH->keyClass);
++    while( count-- && elem ){
++      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ 
++        return elem;
++      }
++      elem = elem->next;
++    }
++  }
++  return 0;
++}
++
++/* Remove a single entry from the hash table given a pointer to that
++** element and a hash on the element's key.
++*/
++static void removeElementGivenHash(
++  Hash *pH,         /* The pH containing "elem" */
++  HashElem* elem,   /* The element to be removed from the pH */
++  int h             /* Hash value for the element */
++){
++  if( elem->prev ){
++    elem->prev->next = elem->next; 
++  }else{
++    pH->first = elem->next;
++  }
++  if( elem->next ){
++    elem->next->prev = elem->prev;
++  }
++  if( pH->ht[h].chain==elem ){
++    pH->ht[h].chain = elem->next;
++  }
++  pH->ht[h].count--;
++  if( pH->ht[h].count<=0 ){
++    pH->ht[h].chain = 0;
++  }
++  if( pH->copyKey && elem->pKey ){
++    sqliteFree(elem->pKey);
++  }
++  sqliteFree( elem );
++  pH->count--;
++}
++
++/* Attempt to locate an element of the hash table pH with a key
++** that matches pKey,nKey.  Return the data for this element if it is
++** found, or NULL if there is no match.
++*/
++void *sqliteHashFind(const Hash *pH, const void *pKey, int nKey){
++  int h;             /* A hash on key */
++  HashElem *elem;    /* The element that matches key */
++  int (*xHash)(const void*,int);  /* The hash function */
++
++  if( pH==0 || pH->ht==0 ) return 0;
++  xHash = hashFunction(pH->keyClass);
++  assert( xHash!=0 );
++  h = (*xHash)(pKey,nKey);
++  assert( (pH->htsize & (pH->htsize-1))==0 );
++  elem = findElementGivenHash(pH,pKey,nKey, h & (pH->htsize-1));
++  return elem ? elem->data : 0;
++}
++
++/* Insert an element into the hash table pH.  The key is pKey,nKey
++** and the data is "data".
++**
++** If no element exists with a matching key, then a new
++** element is created.  A copy of the key is made if the copyKey
++** flag is set.  NULL is returned.
++**
++** If another element already exists with the same key, then the
++** new data replaces the old data and the old data is returned.
++** The key is not copied in this instance.  If a malloc fails, then
++** the new data is returned and the hash table is unchanged.
++**
++** If the "data" parameter to this function is NULL, then the
++** element corresponding to "key" is removed from the hash table.
++*/
++void *sqliteHashInsert(Hash *pH, const void *pKey, int nKey, void *data){
++  int hraw;             /* Raw hash value of the key */
++  int h;                /* the hash of the key modulo hash table size */
++  HashElem *elem;       /* Used to loop thru the element list */
++  HashElem *new_elem;   /* New element added to the pH */
++  int (*xHash)(const void*,int);  /* The hash function */
++
++  assert( pH!=0 );
++  xHash = hashFunction(pH->keyClass);
++  assert( xHash!=0 );
++  hraw = (*xHash)(pKey, nKey);
++  assert( (pH->htsize & (pH->htsize-1))==0 );
++  h = hraw & (pH->htsize-1);
++  elem = findElementGivenHash(pH,pKey,nKey,h);
++  if( elem ){
++    void *old_data = elem->data;
++    if( data==0 ){
++      removeElementGivenHash(pH,elem,h);
++    }else{
++      elem->data = data;
++    }
++    return old_data;
++  }
++  if( data==0 ) return 0;
++  new_elem = (HashElem*)sqliteMalloc( sizeof(HashElem) );
++  if( new_elem==0 ) return data;
++  if( pH->copyKey && pKey!=0 ){
++    new_elem->pKey = sqliteMallocRaw( nKey );
++    if( new_elem->pKey==0 ){
++      sqliteFree(new_elem);
++      return data;
++    }
++    memcpy((void*)new_elem->pKey, pKey, nKey);
++  }else{
++    new_elem->pKey = (void*)pKey;
++  }
++  new_elem->nKey = nKey;
++  pH->count++;
++  if( pH->htsize==0 ) rehash(pH,8);
++  if( pH->htsize==0 ){
++    pH->count = 0;
++    sqliteFree(new_elem);
++    return data;
++  }
++  if( pH->count > pH->htsize ){
++    rehash(pH,pH->htsize*2);
++  }
++  assert( (pH->htsize & (pH->htsize-1))==0 );
++  h = hraw & (pH->htsize-1);
++  elem = pH->ht[h].chain;
++  if( elem ){
++    new_elem->next = elem;
++    new_elem->prev = elem->prev;
++    if( elem->prev ){ elem->prev->next = new_elem; }
++    else            { pH->first = new_elem; }
++    elem->prev = new_elem;
++  }else{
++    new_elem->next = pH->first;
++    new_elem->prev = 0;
++    if( pH->first ){ pH->first->prev = new_elem; }
++    pH->first = new_elem;
++  }
++  pH->ht[h].count++;
++  pH->ht[h].chain = new_elem;
++  new_elem->data = data;
++  return 0;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/hash.h
+@@ -0,0 +1,109 @@
++/*
++** 2001 September 22
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This is the header file for the generic hash-table implemenation
++** used in SQLite.
++**
++** $Id$
++*/
++#ifndef _SQLITE_HASH_H_
++#define _SQLITE_HASH_H_
++
++/* Forward declarations of structures. */
++typedef struct Hash Hash;
++typedef struct HashElem HashElem;
++
++/* A complete hash table is an instance of the following structure.
++** The internals of this structure are intended to be opaque -- client
++** code should not attempt to access or modify the fields of this structure
++** directly.  Change this structure only by using the routines below.
++** However, many of the "procedures" and "functions" for modifying and
++** accessing this structure are really macros, so we can't really make
++** this structure opaque.
++*/
++struct Hash {
++  char keyClass;          /* SQLITE_HASH_INT, _POINTER, _STRING, _BINARY */
++  char copyKey;           /* True if copy of key made on insert */
++  int count;              /* Number of entries in this table */
++  HashElem *first;        /* The first element of the array */
++  int htsize;             /* Number of buckets in the hash table */
++  struct _ht {            /* the hash table */
++    int count;               /* Number of entries with this hash */
++    HashElem *chain;         /* Pointer to first entry with this hash */
++  } *ht;
++};
++
++/* Each element in the hash table is an instance of the following 
++** structure.  All elements are stored on a single doubly-linked list.
++**
++** Again, this structure is intended to be opaque, but it can't really
++** be opaque because it is used by macros.
++*/
++struct HashElem {
++  HashElem *next, *prev;   /* Next and previous elements in the table */
++  void *data;              /* Data associated with this element */
++  void *pKey; int nKey;    /* Key associated with this element */
++};
++
++/*
++** There are 4 different modes of operation for a hash table:
++**
++**   SQLITE_HASH_INT         nKey is used as the key and pKey is ignored.
++**
++**   SQLITE_HASH_POINTER     pKey is used as the key and nKey is ignored.
++**
++**   SQLITE_HASH_STRING      pKey points to a string that is nKey bytes long
++**                           (including the null-terminator, if any).  Case
++**                           is ignored in comparisons.
++**
++**   SQLITE_HASH_BINARY      pKey points to binary data nKey bytes long. 
++**                           memcmp() is used to compare keys.
++**
++** A copy of the key is made for SQLITE_HASH_STRING and SQLITE_HASH_BINARY
++** if the copyKey parameter to HashInit is 1.  
++*/
++#define SQLITE_HASH_INT       1
++/* #define SQLITE_HASH_POINTER   2 // NOT USED */
++#define SQLITE_HASH_STRING    3
++#define SQLITE_HASH_BINARY    4
++
++/*
++** Access routines.  To delete, insert a NULL pointer.
++*/
++void sqliteHashInit(Hash*, int keytype, int copyKey);
++void *sqliteHashInsert(Hash*, const void *pKey, int nKey, void *pData);
++void *sqliteHashFind(const Hash*, const void *pKey, int nKey);
++void sqliteHashClear(Hash*);
++
++/*
++** Macros for looping over all elements of a hash table.  The idiom is
++** like this:
++**
++**   Hash h;
++**   HashElem *p;
++**   ...
++**   for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){
++**     SomeStructure *pData = sqliteHashData(p);
++**     // do something with pData
++**   }
++*/
++#define sqliteHashFirst(H)  ((H)->first)
++#define sqliteHashNext(E)   ((E)->next)
++#define sqliteHashData(E)   ((E)->data)
++#define sqliteHashKey(E)    ((E)->pKey)
++#define sqliteHashKeysize(E) ((E)->nKey)
++
++/*
++** Number of entries in a hash table
++*/
++#define sqliteHashCount(H)  ((H)->count)
++
++#endif /* _SQLITE_HASH_H_ */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/insert.c
+@@ -0,0 +1,919 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains C code routines that are called by the parser
++** to handle INSERT statements in SQLite.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** This routine is call to handle SQL of the following forms:
++**
++**    insert into TABLE (IDLIST) values(EXPRLIST)
++**    insert into TABLE (IDLIST) select
++**
++** The IDLIST following the table name is always optional.  If omitted,
++** then a list of all columns for the table is substituted.  The IDLIST
++** appears in the pColumn parameter.  pColumn is NULL if IDLIST is omitted.
++**
++** The pList parameter holds EXPRLIST in the first form of the INSERT
++** statement above, and pSelect is NULL.  For the second form, pList is
++** NULL and pSelect is a pointer to the select statement used to generate
++** data for the insert.
++**
++** The code generated follows one of three templates.  For a simple
++** select with data coming from a VALUES clause, the code executes
++** once straight down through.  The template looks like this:
++**
++**         open write cursor to <table> and its indices
++**         puts VALUES clause expressions onto the stack
++**         write the resulting record into <table>
++**         cleanup
++**
++** If the statement is of the form
++**
++**   INSERT INTO <table> SELECT ...
++**
++** And the SELECT clause does not read from <table> at any time, then
++** the generated code follows this template:
++**
++**         goto B
++**      A: setup for the SELECT
++**         loop over the tables in the SELECT
++**           gosub C
++**         end loop
++**         cleanup after the SELECT
++**         goto D
++**      B: open write cursor to <table> and its indices
++**         goto A
++**      C: insert the select result into <table>
++**         return
++**      D: cleanup
++**
++** The third template is used if the insert statement takes its
++** values from a SELECT but the data is being inserted into a table
++** that is also read as part of the SELECT.  In the third form,
++** we have to use a intermediate table to store the results of
++** the select.  The template is like this:
++**
++**         goto B
++**      A: setup for the SELECT
++**         loop over the tables in the SELECT
++**           gosub C
++**         end loop
++**         cleanup after the SELECT
++**         goto D
++**      C: insert the select result into the intermediate table
++**         return
++**      B: open a cursor to an intermediate table
++**         goto A
++**      D: open write cursor to <table> and its indices
++**         loop over the intermediate table
++**           transfer values form intermediate table into <table>
++**         end the loop
++**         cleanup
++*/
++void sqliteInsert(
++  Parse *pParse,        /* Parser context */
++  SrcList *pTabList,    /* Name of table into which we are inserting */
++  ExprList *pList,      /* List of values to be inserted */
++  Select *pSelect,      /* A SELECT statement to use as the data source */
++  IdList *pColumn,      /* Column names corresponding to IDLIST. */
++  int onError           /* How to handle constraint errors */
++){
++  Table *pTab;          /* The table to insert into */
++  char *zTab;           /* Name of the table into which we are inserting */
++  const char *zDb;      /* Name of the database holding this table */
++  int i, j, idx;        /* Loop counters */
++  Vdbe *v;              /* Generate code into this virtual machine */
++  Index *pIdx;          /* For looping over indices of the table */
++  int nColumn;          /* Number of columns in the data */
++  int base;             /* VDBE Cursor number for pTab */
++  int iCont, iBreak;    /* Beginning and end of the loop over srcTab */
++  sqlite *db;           /* The main database structure */
++  int keyColumn = -1;   /* Column that is the INTEGER PRIMARY KEY */
++  int endOfLoop;        /* Label for the end of the insertion loop */
++  int useTempTable;     /* Store SELECT results in intermediate table */
++  int srcTab;           /* Data comes from this temporary cursor if >=0 */
++  int iSelectLoop;      /* Address of code that implements the SELECT */
++  int iCleanup;         /* Address of the cleanup code */
++  int iInsertBlock;     /* Address of the subroutine used to insert data */
++  int iCntMem;          /* Memory cell used for the row counter */
++  int isView;           /* True if attempting to insert into a view */
++
++  int row_triggers_exist = 0; /* True if there are FOR EACH ROW triggers */
++  int before_triggers;        /* True if there are BEFORE triggers */
++  int after_triggers;         /* True if there are AFTER triggers */
++  int newIdx = -1;            /* Cursor for the NEW table */
++
++  if( pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup;
++  db = pParse->db;
++
++  /* Locate the table into which we will be inserting new information.
++  */
++  assert( pTabList->nSrc==1 );
++  zTab = pTabList->a[0].zName;
++  if( zTab==0 ) goto insert_cleanup;
++  pTab = sqliteSrcListLookup(pParse, pTabList);
++  if( pTab==0 ){
++    goto insert_cleanup;
++  }
++  assert( pTab->iDb<db->nDb );
++  zDb = db->aDb[pTab->iDb].zName;
++  if( sqliteAuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){
++    goto insert_cleanup;
++  }
++
++  /* Ensure that:
++  *  (a) the table is not read-only, 
++  *  (b) that if it is a view then ON INSERT triggers exist
++  */
++  before_triggers = sqliteTriggersExist(pParse, pTab->pTrigger, TK_INSERT, 
++                                       TK_BEFORE, TK_ROW, 0);
++  after_triggers = sqliteTriggersExist(pParse, pTab->pTrigger, TK_INSERT,
++                                       TK_AFTER, TK_ROW, 0);
++  row_triggers_exist = before_triggers || after_triggers;
++  isView = pTab->pSelect!=0;
++  if( sqliteIsReadOnly(pParse, pTab, before_triggers) ){
++    goto insert_cleanup;
++  }
++  if( pTab==0 ) goto insert_cleanup;
++
++  /* If pTab is really a view, make sure it has been initialized.
++  */
++  if( isView && sqliteViewGetColumnNames(pParse, pTab) ){
++    goto insert_cleanup;
++  }
++
++  /* Allocate a VDBE
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) goto insert_cleanup;
++  sqliteBeginWriteOperation(pParse, pSelect || row_triggers_exist, pTab->iDb);
++
++  /* if there are row triggers, allocate a temp table for new.* references. */
++  if( row_triggers_exist ){
++    newIdx = pParse->nTab++;
++  }
++
++  /* Figure out how many columns of data are supplied.  If the data
++  ** is coming from a SELECT statement, then this step also generates
++  ** all the code to implement the SELECT statement and invoke a subroutine
++  ** to process each row of the result. (Template 2.) If the SELECT
++  ** statement uses the the table that is being inserted into, then the
++  ** subroutine is also coded here.  That subroutine stores the SELECT
++  ** results in a temporary table. (Template 3.)
++  */
++  if( pSelect ){
++    /* Data is coming from a SELECT.  Generate code to implement that SELECT
++    */
++    int rc, iInitCode;
++    iInitCode = sqliteVdbeAddOp(v, OP_Goto, 0, 0);
++    iSelectLoop = sqliteVdbeCurrentAddr(v);
++    iInsertBlock = sqliteVdbeMakeLabel(v);
++    rc = sqliteSelect(pParse, pSelect, SRT_Subroutine, iInsertBlock, 0,0,0);
++    if( rc || pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup;
++    iCleanup = sqliteVdbeMakeLabel(v);
++    sqliteVdbeAddOp(v, OP_Goto, 0, iCleanup);
++    assert( pSelect->pEList );
++    nColumn = pSelect->pEList->nExpr;
++
++    /* Set useTempTable to TRUE if the result of the SELECT statement
++    ** should be written into a temporary table.  Set to FALSE if each
++    ** row of the SELECT can be written directly into the result table.
++    **
++    ** A temp table must be used if the table being updated is also one
++    ** of the tables being read by the SELECT statement.  Also use a 
++    ** temp table in the case of row triggers.
++    */
++    if( row_triggers_exist ){
++      useTempTable = 1;
++    }else{
++      int addr = sqliteVdbeFindOp(v, OP_OpenRead, pTab->tnum);
++      useTempTable = 0;
++      if( addr>0 ){
++        VdbeOp *pOp = sqliteVdbeGetOp(v, addr-2);
++        if( pOp->opcode==OP_Integer && pOp->p1==pTab->iDb ){
++          useTempTable = 1;
++        }
++      }
++    }
++
++    if( useTempTable ){
++      /* Generate the subroutine that SELECT calls to process each row of
++      ** the result.  Store the result in a temporary table
++      */
++      srcTab = pParse->nTab++;
++      sqliteVdbeResolveLabel(v, iInsertBlock);
++      sqliteVdbeAddOp(v, OP_MakeRecord, nColumn, 0);
++      sqliteVdbeAddOp(v, OP_NewRecno, srcTab, 0);
++      sqliteVdbeAddOp(v, OP_Pull, 1, 0);
++      sqliteVdbeAddOp(v, OP_PutIntKey, srcTab, 0);
++      sqliteVdbeAddOp(v, OP_Return, 0, 0);
++
++      /* The following code runs first because the GOTO at the very top
++      ** of the program jumps to it.  Create the temporary table, then jump
++      ** back up and execute the SELECT code above.
++      */
++      sqliteVdbeChangeP2(v, iInitCode, sqliteVdbeCurrentAddr(v));
++      sqliteVdbeAddOp(v, OP_OpenTemp, srcTab, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, iSelectLoop);
++      sqliteVdbeResolveLabel(v, iCleanup);
++    }else{
++      sqliteVdbeChangeP2(v, iInitCode, sqliteVdbeCurrentAddr(v));
++    }
++  }else{
++    /* This is the case if the data for the INSERT is coming from a VALUES
++    ** clause
++    */
++    SrcList dummy;
++    assert( pList!=0 );
++    srcTab = -1;
++    useTempTable = 0;
++    assert( pList );
++    nColumn = pList->nExpr;
++    dummy.nSrc = 0;
++    for(i=0; i<nColumn; i++){
++      if( sqliteExprResolveIds(pParse, &dummy, 0, pList->a[i].pExpr) ){
++        goto insert_cleanup;
++      }
++      if( sqliteExprCheck(pParse, pList->a[i].pExpr, 0, 0) ){
++        goto insert_cleanup;
++      }
++    }
++  }
++
++  /* Make sure the number of columns in the source data matches the number
++  ** of columns to be inserted into the table.
++  */
++  if( pColumn==0 && nColumn!=pTab->nCol ){
++    sqliteErrorMsg(pParse, 
++       "table %S has %d columns but %d values were supplied",
++       pTabList, 0, pTab->nCol, nColumn);
++    goto insert_cleanup;
++  }
++  if( pColumn!=0 && nColumn!=pColumn->nId ){
++    sqliteErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
++    goto insert_cleanup;
++  }
++
++  /* If the INSERT statement included an IDLIST term, then make sure
++  ** all elements of the IDLIST really are columns of the table and 
++  ** remember the column indices.
++  **
++  ** If the table has an INTEGER PRIMARY KEY column and that column
++  ** is named in the IDLIST, then record in the keyColumn variable
++  ** the index into IDLIST of the primary key column.  keyColumn is
++  ** the index of the primary key as it appears in IDLIST, not as
++  ** is appears in the original table.  (The index of the primary
++  ** key in the original table is pTab->iPKey.)
++  */
++  if( pColumn ){
++    for(i=0; i<pColumn->nId; i++){
++      pColumn->a[i].idx = -1;
++    }
++    for(i=0; i<pColumn->nId; i++){
++      for(j=0; j<pTab->nCol; j++){
++        if( sqliteStrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){
++          pColumn->a[i].idx = j;
++          if( j==pTab->iPKey ){
++            keyColumn = i;
++          }
++          break;
++        }
++      }
++      if( j>=pTab->nCol ){
++        if( sqliteIsRowid(pColumn->a[i].zName) ){
++          keyColumn = i;
++        }else{
++          sqliteErrorMsg(pParse, "table %S has no column named %s",
++              pTabList, 0, pColumn->a[i].zName);
++          pParse->nErr++;
++          goto insert_cleanup;
++        }
++      }
++    }
++  }
++
++  /* If there is no IDLIST term but the table has an integer primary
++  ** key, the set the keyColumn variable to the primary key column index
++  ** in the original table definition.
++  */
++  if( pColumn==0 ){
++    keyColumn = pTab->iPKey;
++  }
++
++  /* Open the temp table for FOR EACH ROW triggers
++  */
++  if( row_triggers_exist ){
++    sqliteVdbeAddOp(v, OP_OpenPseudo, newIdx, 0);
++  }
++    
++  /* Initialize the count of rows to be inserted
++  */
++  if( db->flags & SQLITE_CountRows ){
++    iCntMem = pParse->nMem++;
++    sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++    sqliteVdbeAddOp(v, OP_MemStore, iCntMem, 1);
++  }
++
++  /* Open tables and indices if there are no row triggers */
++  if( !row_triggers_exist ){
++    base = pParse->nTab;
++    idx = sqliteOpenTableAndIndices(pParse, pTab, base);
++    pParse->nTab += idx;
++  }
++
++  /* If the data source is a temporary table, then we have to create
++  ** a loop because there might be multiple rows of data.  If the data
++  ** source is a subroutine call from the SELECT statement, then we need
++  ** to launch the SELECT statement processing.
++  */
++  if( useTempTable ){
++    iBreak = sqliteVdbeMakeLabel(v);
++    sqliteVdbeAddOp(v, OP_Rewind, srcTab, iBreak);
++    iCont = sqliteVdbeCurrentAddr(v);
++  }else if( pSelect ){
++    sqliteVdbeAddOp(v, OP_Goto, 0, iSelectLoop);
++    sqliteVdbeResolveLabel(v, iInsertBlock);
++  }
++
++  /* Run the BEFORE and INSTEAD OF triggers, if there are any
++  */
++  endOfLoop = sqliteVdbeMakeLabel(v);
++  if( before_triggers ){
++
++    /* build the NEW.* reference row.  Note that if there is an INTEGER
++    ** PRIMARY KEY into which a NULL is being inserted, that NULL will be
++    ** translated into a unique ID for the row.  But on a BEFORE trigger,
++    ** we do not know what the unique ID will be (because the insert has
++    ** not happened yet) so we substitute a rowid of -1
++    */
++    if( keyColumn<0 ){
++      sqliteVdbeAddOp(v, OP_Integer, -1, 0);
++    }else if( useTempTable ){
++      sqliteVdbeAddOp(v, OP_Column, srcTab, keyColumn);
++    }else if( pSelect ){
++      sqliteVdbeAddOp(v, OP_Dup, nColumn - keyColumn - 1, 1);
++    }else{
++      sqliteExprCode(pParse, pList->a[keyColumn].pExpr);
++      sqliteVdbeAddOp(v, OP_NotNull, -1, sqliteVdbeCurrentAddr(v)+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      sqliteVdbeAddOp(v, OP_Integer, -1, 0);
++      sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
++    }
++
++    /* Create the new column data
++    */
++    for(i=0; i<pTab->nCol; i++){
++      if( pColumn==0 ){
++        j = i;
++      }else{
++        for(j=0; j<pColumn->nId; j++){
++          if( pColumn->a[j].idx==i ) break;
++        }
++      }
++      if( pColumn && j>=pColumn->nId ){
++        sqliteVdbeOp3(v, OP_String, 0, 0, pTab->aCol[i].zDflt, P3_STATIC);
++      }else if( useTempTable ){
++        sqliteVdbeAddOp(v, OP_Column, srcTab, j); 
++      }else if( pSelect ){
++        sqliteVdbeAddOp(v, OP_Dup, nColumn-j-1, 1);
++      }else{
++        sqliteExprCode(pParse, pList->a[j].pExpr);
++      }
++    }
++    sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, newIdx, 0);
++
++    /* Fire BEFORE or INSTEAD OF triggers */
++    if( sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_BEFORE, pTab, 
++        newIdx, -1, onError, endOfLoop) ){
++      goto insert_cleanup;
++    }
++  }
++
++  /* If any triggers exists, the opening of tables and indices is deferred
++  ** until now.
++  */
++  if( row_triggers_exist && !isView ){
++    base = pParse->nTab;
++    idx = sqliteOpenTableAndIndices(pParse, pTab, base);
++    pParse->nTab += idx;
++  }
++
++  /* Push the record number for the new entry onto the stack.  The
++  ** record number is a randomly generate integer created by NewRecno
++  ** except when the table has an INTEGER PRIMARY KEY column, in which
++  ** case the record number is the same as that column. 
++  */
++  if( !isView ){
++    if( keyColumn>=0 ){
++      if( useTempTable ){
++        sqliteVdbeAddOp(v, OP_Column, srcTab, keyColumn);
++      }else if( pSelect ){
++        sqliteVdbeAddOp(v, OP_Dup, nColumn - keyColumn - 1, 1);
++      }else{
++        sqliteExprCode(pParse, pList->a[keyColumn].pExpr);
++      }
++      /* If the PRIMARY KEY expression is NULL, then use OP_NewRecno
++      ** to generate a unique primary key value.
++      */
++      sqliteVdbeAddOp(v, OP_NotNull, -1, sqliteVdbeCurrentAddr(v)+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      sqliteVdbeAddOp(v, OP_NewRecno, base, 0);
++      sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
++    }else{
++      sqliteVdbeAddOp(v, OP_NewRecno, base, 0);
++    }
++
++    /* Push onto the stack, data for all columns of the new entry, beginning
++    ** with the first column.
++    */
++    for(i=0; i<pTab->nCol; i++){
++      if( i==pTab->iPKey ){
++        /* The value of the INTEGER PRIMARY KEY column is always a NULL.
++        ** Whenever this column is read, the record number will be substituted
++        ** in its place.  So will fill this column with a NULL to avoid
++        ** taking up data space with information that will never be used. */
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++        continue;
++      }
++      if( pColumn==0 ){
++        j = i;
++      }else{
++        for(j=0; j<pColumn->nId; j++){
++          if( pColumn->a[j].idx==i ) break;
++        }
++      }
++      if( pColumn && j>=pColumn->nId ){
++        sqliteVdbeOp3(v, OP_String, 0, 0, pTab->aCol[i].zDflt, P3_STATIC);
++      }else if( useTempTable ){
++        sqliteVdbeAddOp(v, OP_Column, srcTab, j); 
++      }else if( pSelect ){
++        sqliteVdbeAddOp(v, OP_Dup, i+nColumn-j, 1);
++      }else{
++        sqliteExprCode(pParse, pList->a[j].pExpr);
++      }
++    }
++
++    /* Generate code to check constraints and generate index keys and
++    ** do the insertion.
++    */
++    sqliteGenerateConstraintChecks(pParse, pTab, base, 0, keyColumn>=0,
++                                   0, onError, endOfLoop);
++    sqliteCompleteInsertion(pParse, pTab, base, 0,0,0,
++                            after_triggers ? newIdx : -1);
++  }
++
++  /* Update the count of rows that are inserted
++  */
++  if( (db->flags & SQLITE_CountRows)!=0 ){
++    sqliteVdbeAddOp(v, OP_MemIncr, iCntMem, 0);
++  }
++
++  if( row_triggers_exist ){
++    /* Close all tables opened */
++    if( !isView ){
++      sqliteVdbeAddOp(v, OP_Close, base, 0);
++      for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
++        sqliteVdbeAddOp(v, OP_Close, idx+base, 0);
++      }
++    }
++
++    /* Code AFTER triggers */
++    if( sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_AFTER, pTab, newIdx, -1, 
++          onError, endOfLoop) ){
++      goto insert_cleanup;
++    }
++  }
++
++  /* The bottom of the loop, if the data source is a SELECT statement
++  */
++  sqliteVdbeResolveLabel(v, endOfLoop);
++  if( useTempTable ){
++    sqliteVdbeAddOp(v, OP_Next, srcTab, iCont);
++    sqliteVdbeResolveLabel(v, iBreak);
++    sqliteVdbeAddOp(v, OP_Close, srcTab, 0);
++  }else if( pSelect ){
++    sqliteVdbeAddOp(v, OP_Pop, nColumn, 0);
++    sqliteVdbeAddOp(v, OP_Return, 0, 0);
++    sqliteVdbeResolveLabel(v, iCleanup);
++  }
++
++  if( !row_triggers_exist ){
++    /* Close all tables opened */
++    sqliteVdbeAddOp(v, OP_Close, base, 0);
++    for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
++      sqliteVdbeAddOp(v, OP_Close, idx+base, 0);
++    }
++  }
++
++  sqliteVdbeAddOp(v, OP_SetCounts, 0, 0);
++  sqliteEndWriteOperation(pParse);
++
++  /*
++  ** Return the number of rows inserted.
++  */
++  if( db->flags & SQLITE_CountRows ){
++    sqliteVdbeOp3(v, OP_ColumnName, 0, 1, "rows inserted", P3_STATIC);
++    sqliteVdbeAddOp(v, OP_MemLoad, iCntMem, 0);
++    sqliteVdbeAddOp(v, OP_Callback, 1, 0);
++  }
++
++insert_cleanup:
++  sqliteSrcListDelete(pTabList);
++  if( pList ) sqliteExprListDelete(pList);
++  if( pSelect ) sqliteSelectDelete(pSelect);
++  sqliteIdListDelete(pColumn);
++}
++
++/*
++** Generate code to do a constraint check prior to an INSERT or an UPDATE.
++**
++** When this routine is called, the stack contains (from bottom to top)
++** the following values:
++**
++**    1.  The recno of the row to be updated before the update.  This
++**        value is omitted unless we are doing an UPDATE that involves a
++**        change to the record number.
++**
++**    2.  The recno of the row after the update.
++**
++**    3.  The data in the first column of the entry after the update.
++**
++**    i.  Data from middle columns...
++**
++**    N.  The data in the last column of the entry after the update.
++**
++** The old recno shown as entry (1) above is omitted unless both isUpdate
++** and recnoChng are 1.  isUpdate is true for UPDATEs and false for
++** INSERTs and recnoChng is true if the record number is being changed.
++**
++** The code generated by this routine pushes additional entries onto
++** the stack which are the keys for new index entries for the new record.
++** The order of index keys is the same as the order of the indices on
++** the pTable->pIndex list.  A key is only created for index i if 
++** aIdxUsed!=0 and aIdxUsed[i]!=0.
++**
++** This routine also generates code to check constraints.  NOT NULL,
++** CHECK, and UNIQUE constraints are all checked.  If a constraint fails,
++** then the appropriate action is performed.  There are five possible
++** actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE.
++**
++**  Constraint type  Action       What Happens
++**  ---------------  ----------   ----------------------------------------
++**  any              ROLLBACK     The current transaction is rolled back and
++**                                sqlite_exec() returns immediately with a
++**                                return code of SQLITE_CONSTRAINT.
++**
++**  any              ABORT        Back out changes from the current command
++**                                only (do not do a complete rollback) then
++**                                cause sqlite_exec() to return immediately
++**                                with SQLITE_CONSTRAINT.
++**
++**  any              FAIL         Sqlite_exec() returns immediately with a
++**                                return code of SQLITE_CONSTRAINT.  The
++**                                transaction is not rolled back and any
++**                                prior changes are retained.
++**
++**  any              IGNORE       The record number and data is popped from
++**                                the stack and there is an immediate jump
++**                                to label ignoreDest.
++**
++**  NOT NULL         REPLACE      The NULL value is replace by the default
++**                                value for that column.  If the default value
++**                                is NULL, the action is the same as ABORT.
++**
++**  UNIQUE           REPLACE      The other row that conflicts with the row
++**                                being inserted is removed.
++**
++**  CHECK            REPLACE      Illegal.  The results in an exception.
++**
++** Which action to take is determined by the overrideError parameter.
++** Or if overrideError==OE_Default, then the pParse->onError parameter
++** is used.  Or if pParse->onError==OE_Default then the onError value
++** for the constraint is used.
++**
++** The calling routine must open a read/write cursor for pTab with
++** cursor number "base".  All indices of pTab must also have open
++** read/write cursors with cursor number base+i for the i-th cursor.
++** Except, if there is no possibility of a REPLACE action then
++** cursors do not need to be open for indices where aIdxUsed[i]==0.
++**
++** If the isUpdate flag is true, it means that the "base" cursor is
++** initially pointing to an entry that is being updated.  The isUpdate
++** flag causes extra code to be generated so that the "base" cursor
++** is still pointing at the same entry after the routine returns.
++** Without the isUpdate flag, the "base" cursor might be moved.
++*/
++void sqliteGenerateConstraintChecks(
++  Parse *pParse,      /* The parser context */
++  Table *pTab,        /* the table into which we are inserting */
++  int base,           /* Index of a read/write cursor pointing at pTab */
++  char *aIdxUsed,     /* Which indices are used.  NULL means all are used */
++  int recnoChng,      /* True if the record number will change */
++  int isUpdate,       /* True for UPDATE, False for INSERT */
++  int overrideError,  /* Override onError to this if not OE_Default */
++  int ignoreDest      /* Jump to this label on an OE_Ignore resolution */
++){
++  int i;
++  Vdbe *v;
++  int nCol;
++  int onError;
++  int addr;
++  int extra;
++  int iCur;
++  Index *pIdx;
++  int seenReplace = 0;
++  int jumpInst1, jumpInst2;
++  int contAddr;
++  int hasTwoRecnos = (isUpdate && recnoChng);
++
++  v = sqliteGetVdbe(pParse);
++  assert( v!=0 );
++  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
++  nCol = pTab->nCol;
++
++  /* Test all NOT NULL constraints.
++  */
++  for(i=0; i<nCol; i++){
++    if( i==pTab->iPKey ){
++      continue;
++    }
++    onError = pTab->aCol[i].notNull;
++    if( onError==OE_None ) continue;
++    if( overrideError!=OE_Default ){
++      onError = overrideError;
++    }else if( pParse->db->onError!=OE_Default ){
++      onError = pParse->db->onError;
++    }else if( onError==OE_Default ){
++      onError = OE_Abort;
++    }
++    if( onError==OE_Replace && pTab->aCol[i].zDflt==0 ){
++      onError = OE_Abort;
++    }
++    sqliteVdbeAddOp(v, OP_Dup, nCol-1-i, 1);
++    addr = sqliteVdbeAddOp(v, OP_NotNull, 1, 0);
++    switch( onError ){
++      case OE_Rollback:
++      case OE_Abort:
++      case OE_Fail: {
++        char *zMsg = 0;
++        sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, onError);
++        sqliteSetString(&zMsg, pTab->zName, ".", pTab->aCol[i].zName,
++                        " may not be NULL", (char*)0);
++        sqliteVdbeChangeP3(v, -1, zMsg, P3_DYNAMIC);
++        break;
++      }
++      case OE_Ignore: {
++        sqliteVdbeAddOp(v, OP_Pop, nCol+1+hasTwoRecnos, 0);
++        sqliteVdbeAddOp(v, OP_Goto, 0, ignoreDest);
++        break;
++      }
++      case OE_Replace: {
++        sqliteVdbeOp3(v, OP_String, 0, 0, pTab->aCol[i].zDflt, P3_STATIC);
++        sqliteVdbeAddOp(v, OP_Push, nCol-i, 0);
++        break;
++      }
++      default: assert(0);
++    }
++    sqliteVdbeChangeP2(v, addr, sqliteVdbeCurrentAddr(v));
++  }
++
++  /* Test all CHECK constraints
++  */
++  /**** TBD ****/
++
++  /* If we have an INTEGER PRIMARY KEY, make sure the primary key
++  ** of the new record does not previously exist.  Except, if this
++  ** is an UPDATE and the primary key is not changing, that is OK.
++  */
++  if( recnoChng ){
++    onError = pTab->keyConf;
++    if( overrideError!=OE_Default ){
++      onError = overrideError;
++    }else if( pParse->db->onError!=OE_Default ){
++      onError = pParse->db->onError;
++    }else if( onError==OE_Default ){
++      onError = OE_Abort;
++    }
++    
++    if( isUpdate ){
++      sqliteVdbeAddOp(v, OP_Dup, nCol+1, 1);
++      sqliteVdbeAddOp(v, OP_Dup, nCol+1, 1);
++      jumpInst1 = sqliteVdbeAddOp(v, OP_Eq, 0, 0);
++    }
++    sqliteVdbeAddOp(v, OP_Dup, nCol, 1);
++    jumpInst2 = sqliteVdbeAddOp(v, OP_NotExists, base, 0);
++    switch( onError ){
++      default: {
++        onError = OE_Abort;
++        /* Fall thru into the next case */
++      }
++      case OE_Rollback:
++      case OE_Abort:
++      case OE_Fail: {
++        sqliteVdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, onError,
++                         "PRIMARY KEY must be unique", P3_STATIC);
++        break;
++      }
++      case OE_Replace: {
++        sqliteGenerateRowIndexDelete(pParse->db, v, pTab, base, 0);
++        if( isUpdate ){
++          sqliteVdbeAddOp(v, OP_Dup, nCol+hasTwoRecnos, 1);
++          sqliteVdbeAddOp(v, OP_MoveTo, base, 0);
++        }
++        seenReplace = 1;
++        break;
++      }
++      case OE_Ignore: {
++        assert( seenReplace==0 );
++        sqliteVdbeAddOp(v, OP_Pop, nCol+1+hasTwoRecnos, 0);
++        sqliteVdbeAddOp(v, OP_Goto, 0, ignoreDest);
++        break;
++      }
++    }
++    contAddr = sqliteVdbeCurrentAddr(v);
++    sqliteVdbeChangeP2(v, jumpInst2, contAddr);
++    if( isUpdate ){
++      sqliteVdbeChangeP2(v, jumpInst1, contAddr);
++      sqliteVdbeAddOp(v, OP_Dup, nCol+1, 1);
++      sqliteVdbeAddOp(v, OP_MoveTo, base, 0);
++    }
++  }
++
++  /* Test all UNIQUE constraints by creating entries for each UNIQUE
++  ** index and making sure that duplicate entries do not already exist.
++  ** Add the new records to the indices as we go.
++  */
++  extra = -1;
++  for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){
++    if( aIdxUsed && aIdxUsed[iCur]==0 ) continue;  /* Skip unused indices */
++    extra++;
++
++    /* Create a key for accessing the index entry */
++    sqliteVdbeAddOp(v, OP_Dup, nCol+extra, 1);
++    for(i=0; i<pIdx->nColumn; i++){
++      int idx = pIdx->aiColumn[i];
++      if( idx==pTab->iPKey ){
++        sqliteVdbeAddOp(v, OP_Dup, i+extra+nCol+1, 1);
++      }else{
++        sqliteVdbeAddOp(v, OP_Dup, i+extra+nCol-idx, 1);
++      }
++    }
++    jumpInst1 = sqliteVdbeAddOp(v, OP_MakeIdxKey, pIdx->nColumn, 0);
++    if( pParse->db->file_format>=4 ) sqliteAddIdxKeyType(v, pIdx);
++
++    /* Find out what action to take in case there is an indexing conflict */
++    onError = pIdx->onError;
++    if( onError==OE_None ) continue;  /* pIdx is not a UNIQUE index */
++    if( overrideError!=OE_Default ){
++      onError = overrideError;
++    }else if( pParse->db->onError!=OE_Default ){
++      onError = pParse->db->onError;
++    }else if( onError==OE_Default ){
++      onError = OE_Abort;
++    }
++    if( seenReplace ){
++      if( onError==OE_Ignore ) onError = OE_Replace;
++      else if( onError==OE_Fail ) onError = OE_Abort;
++    }
++    
++
++    /* Check to see if the new index entry will be unique */
++    sqliteVdbeAddOp(v, OP_Dup, extra+nCol+1+hasTwoRecnos, 1);
++    jumpInst2 = sqliteVdbeAddOp(v, OP_IsUnique, base+iCur+1, 0);
++
++    /* Generate code that executes if the new index entry is not unique */
++    switch( onError ){
++      case OE_Rollback:
++      case OE_Abort:
++      case OE_Fail: {
++        int j, n1, n2;
++        char zErrMsg[200];
++        strcpy(zErrMsg, pIdx->nColumn>1 ? "columns " : "column ");
++        n1 = strlen(zErrMsg);
++        for(j=0; j<pIdx->nColumn && n1<sizeof(zErrMsg)-30; j++){
++          char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
++          n2 = strlen(zCol);
++          if( j>0 ){
++            strcpy(&zErrMsg[n1], ", ");
++            n1 += 2;
++          }
++          if( n1+n2>sizeof(zErrMsg)-30 ){
++            strcpy(&zErrMsg[n1], "...");
++            n1 += 3;
++            break;
++          }else{
++            strcpy(&zErrMsg[n1], zCol);
++            n1 += n2;
++          }
++        }
++        strcpy(&zErrMsg[n1], 
++            pIdx->nColumn>1 ? " are not unique" : " is not unique");
++        sqliteVdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, onError, zErrMsg, 0);
++        break;
++      }
++      case OE_Ignore: {
++        assert( seenReplace==0 );
++        sqliteVdbeAddOp(v, OP_Pop, nCol+extra+3+hasTwoRecnos, 0);
++        sqliteVdbeAddOp(v, OP_Goto, 0, ignoreDest);
++        break;
++      }
++      case OE_Replace: {
++        sqliteGenerateRowDelete(pParse->db, v, pTab, base, 0);
++        if( isUpdate ){
++          sqliteVdbeAddOp(v, OP_Dup, nCol+extra+1+hasTwoRecnos, 1);
++          sqliteVdbeAddOp(v, OP_MoveTo, base, 0);
++        }
++        seenReplace = 1;
++        break;
++      }
++      default: assert(0);
++    }
++    contAddr = sqliteVdbeCurrentAddr(v);
++#if NULL_DISTINCT_FOR_UNIQUE
++    sqliteVdbeChangeP2(v, jumpInst1, contAddr);
++#endif
++    sqliteVdbeChangeP2(v, jumpInst2, contAddr);
++  }
++}
++
++/*
++** This routine generates code to finish the INSERT or UPDATE operation
++** that was started by a prior call to sqliteGenerateConstraintChecks.
++** The stack must contain keys for all active indices followed by data
++** and the recno for the new entry.  This routine creates the new
++** entries in all indices and in the main table.
++**
++** The arguments to this routine should be the same as the first six
++** arguments to sqliteGenerateConstraintChecks.
++*/
++void sqliteCompleteInsertion(
++  Parse *pParse,      /* The parser context */
++  Table *pTab,        /* the table into which we are inserting */
++  int base,           /* Index of a read/write cursor pointing at pTab */
++  char *aIdxUsed,     /* Which indices are used.  NULL means all are used */
++  int recnoChng,      /* True if the record number will change */
++  int isUpdate,       /* True for UPDATE, False for INSERT */
++  int newIdx          /* Index of NEW table for triggers.  -1 if none */
++){
++  int i;
++  Vdbe *v;
++  int nIdx;
++  Index *pIdx;
++
++  v = sqliteGetVdbe(pParse);
++  assert( v!=0 );
++  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
++  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}
++  for(i=nIdx-1; i>=0; i--){
++    if( aIdxUsed && aIdxUsed[i]==0 ) continue;
++    sqliteVdbeAddOp(v, OP_IdxPut, base+i+1, 0);
++  }
++  sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
++  if( newIdx>=0 ){
++    sqliteVdbeAddOp(v, OP_Dup, 1, 0);
++    sqliteVdbeAddOp(v, OP_Dup, 1, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, newIdx, 0);
++  }
++  sqliteVdbeAddOp(v, OP_PutIntKey, base,
++    (pParse->trigStack?0:OPFLAG_NCHANGE) |
++    (isUpdate?0:OPFLAG_LASTROWID) | OPFLAG_CSCHANGE);
++  if( isUpdate && recnoChng ){
++    sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++  }
++}
++
++/*
++** Generate code that will open write cursors for a table and for all
++** indices of that table.  The "base" parameter is the cursor number used
++** for the table.  Indices are opened on subsequent cursors.
++**
++** Return the total number of cursors opened.  This is always at least
++** 1 (for the main table) plus more for each cursor.
++*/
++int sqliteOpenTableAndIndices(Parse *pParse, Table *pTab, int base){
++  int i;
++  Index *pIdx;
++  Vdbe *v = sqliteGetVdbe(pParse);
++  assert( v!=0 );
++  sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++  sqliteVdbeOp3(v, OP_OpenWrite, base, pTab->tnum, pTab->zName, P3_STATIC);
++  for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
++    sqliteVdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
++    sqliteVdbeOp3(v, OP_OpenWrite, i+base, pIdx->tnum, pIdx->zName, P3_STATIC);
++  }
++  return i;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/libsqlite.dsp
+@@ -0,0 +1,353 @@
++# Microsoft Developer Studio Project File - Name="libsqlite" - Package Owner=<4>\r
++# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
++# ** DO NOT EDIT **\r
++\r
++# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
++\r
++CFG=libsqlite - Win32 Debug_TS\r
++!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
++!MESSAGE use the Export Makefile command and run\r
++!MESSAGE \r
++!MESSAGE NMAKE /f "libsqlite.mak".\r
++!MESSAGE \r
++!MESSAGE You can specify a configuration when running NMAKE\r
++!MESSAGE by defining the macro CFG on the command line. For example:\r
++!MESSAGE \r
++!MESSAGE NMAKE /f "libsqlite.mak" CFG="libsqlite - Win32 Debug_TS"\r
++!MESSAGE \r
++!MESSAGE Possible choices for configuration are:\r
++!MESSAGE \r
++!MESSAGE "libsqlite - Win32 Debug_TS" (based on "Win32 (x86) Static Library")\r
++!MESSAGE "libsqlite - Win32 Release_TS" (based on "Win32 (x86) Static Library")\r
++!MESSAGE "libsqlite - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")\r
++!MESSAGE \r
++\r
++# Begin Project\r
++# PROP AllowPerConfigDependencies 0\r
++# PROP Scc_ProjName ""\r
++# PROP Scc_LocalPath ""\r
++CPP=cl.exe\r
++RSC=rc.exe\r
++\r
++!IF  "$(CFG)" == "libsqlite - Win32 Debug_TS"\r
++\r
++# PROP BASE Use_MFC 0\r
++# PROP BASE Use_Debug_Libraries 1\r
++# PROP BASE Output_Dir "Debug_TS"\r
++# PROP BASE Intermediate_Dir "Debug_TS"\r
++# PROP BASE Target_Dir ""\r
++# PROP Use_MFC 0\r
++# PROP Use_Debug_Libraries 1\r
++# PROP Output_Dir "..\..\Debug_TS"\r
++# PROP Intermediate_Dir "..\..\Debug_TS"\r
++# PROP Target_Dir ""\r
++# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c\r
++# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D THREADSAFE=1 /YX /FD /GZ /c\r
++# ADD BASE RSC /l 0x406 /d "_DEBUG"\r
++# ADD RSC /l 0x406 /d "_DEBUG"\r
++BSC32=bscmake.exe\r
++# ADD BASE BSC32 /nologo\r
++# ADD BSC32 /nologo\r
++LIB32=link.exe -lib\r
++# ADD BASE LIB32 /nologo\r
++# ADD LIB32 /nologo\r
++\r
++!ELSEIF  "$(CFG)" == "libsqlite - Win32 Release_TS"\r
++\r
++# PROP BASE Use_MFC 0\r
++# PROP BASE Use_Debug_Libraries 0\r
++# PROP BASE Output_Dir "Release_TS"\r
++# PROP BASE Intermediate_Dir "Release_TS"\r
++# PROP BASE Target_Dir ""\r
++# PROP Use_MFC 0\r
++# PROP Use_Debug_Libraries 0\r
++# PROP Output_Dir "..\..\Release_TS"\r
++# PROP Intermediate_Dir "..\..\Release_TS"\r
++# PROP Target_Dir ""\r
++# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c\r
++# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D THREADSAFE=1 /YX /FD /c\r
++# ADD BASE RSC /l 0x406 /d "NDEBUG"\r
++# ADD RSC /l 0x406 /d "NDEBUG"\r
++BSC32=bscmake.exe\r
++# ADD BASE BSC32 /nologo\r
++# ADD BSC32 /nologo\r
++LIB32=link.exe -lib\r
++# ADD BASE LIB32 /nologo\r
++# ADD LIB32 /nologo\r
++\r
++!ELSEIF  "$(CFG)" == "libsqlite - Win32 Release_TSDbg"\r
++\r
++# PROP BASE Use_MFC 0\r
++# PROP BASE Use_Debug_Libraries 0\r
++# PROP BASE Output_Dir "libsqlite___Win32_Release_TSDbg"\r
++# PROP BASE Intermediate_Dir "libsqlite___Win32_Release_TSDbg"\r
++# PROP BASE Target_Dir ""\r
++# PROP Use_MFC 0\r
++# PROP Use_Debug_Libraries 0\r
++# PROP Output_Dir "..\..\Release_TSDbg"\r
++# PROP Intermediate_Dir "..\..\Release_TSDbg"\r
++# PROP Target_Dir ""\r
++# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D THREADSAFE=1 /YX /FD /c\r
++# ADD CPP /nologo /MD /W3 /GX /Zi /Od /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D THREADSAFE=1 /YX /FD /c\r
++# ADD BASE RSC /l 0x406 /d "NDEBUG"\r
++# ADD RSC /l 0x406 /d "NDEBUG"\r
++BSC32=bscmake.exe\r
++# ADD BASE BSC32 /nologo\r
++# ADD BSC32 /nologo\r
++LIB32=link.exe -lib\r
++# ADD BASE LIB32 /nologo /out:"Release_TS\libsqlite.lib"\r
++# ADD LIB32 /nologo\r
++\r
++!ENDIF \r
++\r
++# Begin Target\r
++\r
++# Name "libsqlite - Win32 Debug_TS"\r
++# Name "libsqlite - Win32 Release_TS"\r
++# Name "libsqlite - Win32 Release_TSDbg"\r
++# Begin Group "Source Files"\r
++\r
++# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
++# Begin Source File\r
++\r
++SOURCE=attach.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=auth.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=btree.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=btree_rb.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=build.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=copy.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\date.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=delete.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=encode.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=expr.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=func.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=hash.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=insert.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=main.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=opcodes.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=os.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=pager.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=parse.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=pragma.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=printf.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=random.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=select.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=table.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=tokenize.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=trigger.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=update.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=util.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=vacuum.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=vdbe.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\vdbeaux.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=where.c\r
++# End Source File\r
++# End Group\r
++# Begin Group "Header Files"\r
++\r
++# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
++# Begin Source File\r
++\r
++SOURCE=btree.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=config_static.w32.h\r
++\r
++!IF  "$(CFG)" == "libsqlite - Win32 Debug_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\r
++InputPath=config_static.w32.h\r
++\r
++"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\config.h\r
++\r
++# End Custom Build\r
++\r
++!ELSEIF  "$(CFG)" == "libsqlite - Win32 Release_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\r
++InputPath=config_static.w32.h\r
++\r
++"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\config.h\r
++\r
++# End Custom Build\r
++\r
++!ELSEIF  "$(CFG)" == "libsqlite - Win32 Release_TSDbg"\r
++\r
++# Begin Custom Build\r
++InputDir=.\r
++InputPath=config_static.w32.h\r
++\r
++"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\config.h\r
++\r
++# End Custom Build\r
++\r
++!ENDIF \r
++\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=hash.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=opcodes.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=os.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=pager.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=parse.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=sqlite.w32.h\r
++\r
++!IF  "$(CFG)" == "libsqlite - Win32 Debug_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\r
++InputPath=sqlite.w32.h\r
++\r
++"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\sqlite.h\r
++\r
++# End Custom Build\r
++\r
++!ELSEIF  "$(CFG)" == "libsqlite - Win32 Release_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\r
++InputPath=sqlite.w32.h\r
++\r
++"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\sqlite.h\r
++\r
++# End Custom Build\r
++\r
++!ELSEIF  "$(CFG)" == "libsqlite - Win32 Release_TSDbg"\r
++\r
++# Begin Custom Build\r
++InputDir=.\r
++InputPath=sqlite.w32.h\r
++\r
++"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\sqlite.h\r
++\r
++# End Custom Build\r
++\r
++!ENDIF \r
++\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=sqliteInt.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=vdbe.h\r
++# End Source File\r
++# End Group\r
++# End Target\r
++# End Project\r
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/main.c
+@@ -0,0 +1,1143 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** Main file for the SQLite library.  The routines in this file
++** implement the programmer interface to the library.  Routines in
++** other files are for internal use by SQLite and should not be
++** accessed by users of the library.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include "os.h"
++#include <ctype.h>
++
++/*
++** A pointer to this structure is used to communicate information
++** from sqliteInit into the sqliteInitCallback.
++*/
++typedef struct {
++  sqlite *db;         /* The database being initialized */
++  char **pzErrMsg;    /* Error message stored here */
++} InitData;
++
++/*
++** Fill the InitData structure with an error message that indicates
++** that the database is corrupt.
++*/
++static void corruptSchema(InitData *pData, const char *zExtra){
++  sqliteSetString(pData->pzErrMsg, "malformed database schema",
++     zExtra!=0 && zExtra[0]!=0 ? " - " : (char*)0, zExtra, (char*)0);
++}
++
++/*
++** This is the callback routine for the code that initializes the
++** database.  See sqliteInit() below for additional information.
++**
++** Each callback contains the following information:
++**
++**     argv[0] = "file-format" or "schema-cookie" or "table" or "index"
++**     argv[1] = table or index name or meta statement type.
++**     argv[2] = root page number for table or index.  NULL for meta.
++**     argv[3] = SQL text for a CREATE TABLE or CREATE INDEX statement.
++**     argv[4] = "1" for temporary files, "0" for main database, "2" or more
++**               for auxiliary database files.
++**
++*/
++static
++int sqliteInitCallback(void *pInit, int argc, char **argv, char **azColName){
++  InitData *pData = (InitData*)pInit;
++  int nErr = 0;
++
++  assert( argc==5 );
++  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */
++  if( argv[0]==0 ){
++    corruptSchema(pData, 0);
++    return 1;
++  }
++  switch( argv[0][0] ){
++    case 'v':
++    case 'i':
++    case 't': {  /* CREATE TABLE, CREATE INDEX, or CREATE VIEW statements */
++      sqlite *db = pData->db;
++      if( argv[2]==0 || argv[4]==0 ){
++        corruptSchema(pData, 0);
++        return 1;
++      }
++      if( argv[3] && argv[3][0] ){
++        /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
++        ** But because db->init.busy is set to 1, no VDBE code is generated
++        ** or executed.  All the parser does is build the internal data
++        ** structures that describe the table, index, or view.
++        */
++        char *zErr;
++        assert( db->init.busy );
++        db->init.iDb = atoi(argv[4]);
++        assert( db->init.iDb>=0 && db->init.iDb<db->nDb );
++        db->init.newTnum = atoi(argv[2]);
++        if( sqlite_exec(db, argv[3], 0, 0, &zErr) ){
++          corruptSchema(pData, zErr);
++          sqlite_freemem(zErr);
++        }
++        db->init.iDb = 0;
++      }else{
++        /* If the SQL column is blank it means this is an index that
++        ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
++        ** constraint for a CREATE TABLE.  The index should have already
++        ** been created when we processed the CREATE TABLE.  All we have
++        ** to do here is record the root page number for that index.
++        */
++        int iDb;
++        Index *pIndex;
++
++        iDb = atoi(argv[4]);
++        assert( iDb>=0 && iDb<db->nDb );
++        pIndex = sqliteFindIndex(db, argv[1], db->aDb[iDb].zName);
++        if( pIndex==0 || pIndex->tnum!=0 ){
++          /* This can occur if there exists an index on a TEMP table which
++          ** has the same name as another index on a permanent index.  Since
++          ** the permanent table is hidden by the TEMP table, we can also
++          ** safely ignore the index on the permanent table.
++          */
++          /* Do Nothing */;
++        }else{
++          pIndex->tnum = atoi(argv[2]);
++        }
++      }
++      break;
++    }
++    default: {
++      /* This can not happen! */
++      nErr = 1;
++      assert( nErr==0 );
++    }
++  }
++  return nErr;
++}
++
++/*
++** This is a callback procedure used to reconstruct a table.  The
++** name of the table to be reconstructed is passed in as argv[0].
++**
++** This routine is used to automatically upgrade a database from
++** format version 1 or 2 to version 3.  The correct operation of
++** this routine relys on the fact that no indices are used when
++** copying a table out to a temporary file.
++**
++** The change from version 2 to version 3 occurred between SQLite
++** version 2.5.6 and 2.6.0 on 2002-July-18.  
++*/
++static
++int upgrade_3_callback(void *pInit, int argc, char **argv, char **NotUsed){
++  InitData *pData = (InitData*)pInit;
++  int rc;
++  Table *pTab;
++  Trigger *pTrig;
++  char *zErr = 0;
++
++  pTab = sqliteFindTable(pData->db, argv[0], 0);
++  assert( pTab!=0 );
++  assert( sqliteStrICmp(pTab->zName, argv[0])==0 );
++  if( pTab ){
++    pTrig = pTab->pTrigger;
++    pTab->pTrigger = 0;  /* Disable all triggers before rebuilding the table */
++  }
++  rc = sqlite_exec_printf(pData->db,
++    "CREATE TEMP TABLE sqlite_x AS SELECT * FROM '%q'; "
++    "DELETE FROM '%q'; "
++    "INSERT INTO '%q' SELECT * FROM sqlite_x; "
++    "DROP TABLE sqlite_x;",
++    0, 0, &zErr, argv[0], argv[0], argv[0]);
++  if( zErr ){
++    if( *pData->pzErrMsg ) sqlite_freemem(*pData->pzErrMsg);
++    *pData->pzErrMsg = zErr;
++  }
++
++  /* If an error occurred in the SQL above, then the transaction will
++  ** rollback which will delete the internal symbol tables.  This will
++  ** cause the structure that pTab points to be deleted.  In case that
++  ** happened, we need to refetch pTab.
++  */
++  pTab = sqliteFindTable(pData->db, argv[0], 0);
++  if( pTab ){
++    assert( sqliteStrICmp(pTab->zName, argv[0])==0 );
++    pTab->pTrigger = pTrig;  /* Re-enable triggers */
++  }
++  return rc!=SQLITE_OK;
++}
++
++
++
++/*
++** Attempt to read the database schema and initialize internal
++** data structures for a single database file.  The index of the
++** database file is given by iDb.  iDb==0 is used for the main
++** database.  iDb==1 should never be used.  iDb>=2 is used for
++** auxiliary databases.  Return one of the SQLITE_ error codes to
++** indicate success or failure.
++*/
++static int sqliteInitOne(sqlite *db, int iDb, char **pzErrMsg){
++  int rc;
++  BtCursor *curMain;
++  int size;
++  Table *pTab;
++  char const *azArg[6];
++  char zDbNum[30];
++  int meta[SQLITE_N_BTREE_META];
++  InitData initData;
++  char const *zMasterSchema;
++  char const *zMasterName;
++  char *zSql = 0;
++
++  /*
++  ** The master database table has a structure like this
++  */
++  static char master_schema[] = 
++     "CREATE TABLE sqlite_master(\n"
++     "  type text,\n"
++     "  name text,\n"
++     "  tbl_name text,\n"
++     "  rootpage integer,\n"
++     "  sql text\n"
++     ")"
++  ;
++  static char temp_master_schema[] = 
++     "CREATE TEMP TABLE sqlite_temp_master(\n"
++     "  type text,\n"
++     "  name text,\n"
++     "  tbl_name text,\n"
++     "  rootpage integer,\n"
++     "  sql text\n"
++     ")"
++  ;
++
++  assert( iDb>=0 && iDb<db->nDb );
++
++  /* zMasterSchema and zInitScript are set to point at the master schema
++  ** and initialisation script appropriate for the database being
++  ** initialised. zMasterName is the name of the master table.
++  */
++  if( iDb==1 ){
++    zMasterSchema = temp_master_schema;
++    zMasterName = TEMP_MASTER_NAME;
++  }else{
++    zMasterSchema = master_schema;
++    zMasterName = MASTER_NAME;
++  }
++
++  /* Construct the schema table.
++  */
++  sqliteSafetyOff(db);
++  azArg[0] = "table";
++  azArg[1] = zMasterName;
++  azArg[2] = "2";
++  azArg[3] = zMasterSchema;
++  sprintf(zDbNum, "%d", iDb);
++  azArg[4] = zDbNum;
++  azArg[5] = 0;
++  initData.db = db;
++  initData.pzErrMsg = pzErrMsg;
++  sqliteInitCallback(&initData, 5, (char **)azArg, 0);
++  pTab = sqliteFindTable(db, zMasterName, db->aDb[iDb].zName);
++  if( pTab ){
++    pTab->readOnly = 1;
++  }else{
++    return SQLITE_NOMEM;
++  }
++  sqliteSafetyOn(db);
++
++  /* Create a cursor to hold the database open
++  */
++  if( db->aDb[iDb].pBt==0 ) return SQLITE_OK;
++  rc = sqliteBtreeCursor(db->aDb[iDb].pBt, 2, 0, &curMain);
++  if( rc ){
++    sqliteSetString(pzErrMsg, sqlite_error_string(rc), (char*)0);
++    return rc;
++  }
++
++  /* Get the database meta information
++  */
++  rc = sqliteBtreeGetMeta(db->aDb[iDb].pBt, meta);
++  if( rc ){
++    sqliteSetString(pzErrMsg, sqlite_error_string(rc), (char*)0);
++    sqliteBtreeCloseCursor(curMain);
++    return rc;
++  }
++  db->aDb[iDb].schema_cookie = meta[1];
++  if( iDb==0 ){
++    db->next_cookie = meta[1];
++    db->file_format = meta[2];
++    size = meta[3];
++    if( size==0 ){ size = MAX_PAGES; }
++    db->cache_size = size;
++    db->safety_level = meta[4];
++    if( meta[6]>0 && meta[6]<=2 && db->temp_store==0 ){
++      db->temp_store = meta[6];
++    }
++    if( db->safety_level==0 ) db->safety_level = 2;
++
++    /*
++    **  file_format==1    Version 2.1.0.
++    **  file_format==2    Version 2.2.0. Add support for INTEGER PRIMARY KEY.
++    **  file_format==3    Version 2.6.0. Fix empty-string index bug.
++    **  file_format==4    Version 2.7.0. Add support for separate numeric and
++    **                    text datatypes.
++    */
++    if( db->file_format==0 ){
++      /* This happens if the database was initially empty */
++      db->file_format = 4;
++    }else if( db->file_format>4 ){
++      sqliteBtreeCloseCursor(curMain);
++      sqliteSetString(pzErrMsg, "unsupported file format", (char*)0);
++      return SQLITE_ERROR;
++    }
++  }else if( iDb!=1 && (db->file_format!=meta[2] || db->file_format<4) ){
++    assert( db->file_format>=4 );
++    if( meta[2]==0 ){
++      sqliteSetString(pzErrMsg, "cannot attach empty database: ",
++         db->aDb[iDb].zName, (char*)0);
++    }else{
++      sqliteSetString(pzErrMsg, "incompatible file format in auxiliary "
++         "database: ", db->aDb[iDb].zName, (char*)0);
++    }
++    sqliteBtreeClose(db->aDb[iDb].pBt);
++    db->aDb[iDb].pBt = 0;
++    return SQLITE_FORMAT;
++  }
++  sqliteBtreeSetCacheSize(db->aDb[iDb].pBt, db->cache_size);
++  sqliteBtreeSetSafetyLevel(db->aDb[iDb].pBt, meta[4]==0 ? 2 : meta[4]);
++
++  /* Read the schema information out of the schema tables
++  */
++  assert( db->init.busy );
++  sqliteSafetyOff(db);
++
++  /* The following SQL will read the schema from the master tables.
++  ** The first version works with SQLite file formats 2 or greater.
++  ** The second version is for format 1 files.
++  **
++  ** Beginning with file format 2, the rowid for new table entries
++  ** (including entries in sqlite_master) is an increasing integer.
++  ** So for file format 2 and later, we can play back sqlite_master
++  ** and all the CREATE statements will appear in the right order.
++  ** But with file format 1, table entries were random and so we
++  ** have to make sure the CREATE TABLEs occur before their corresponding
++  ** CREATE INDEXs.  (We don't have to deal with CREATE VIEW or
++  ** CREATE TRIGGER in file format 1 because those constructs did
++  ** not exist then.) 
++  */
++  if( db->file_format>=2 ){
++    sqliteSetString(&zSql, 
++        "SELECT type, name, rootpage, sql, ", zDbNum, " FROM \"",
++       db->aDb[iDb].zName, "\".", zMasterName, (char*)0);
++  }else{
++    sqliteSetString(&zSql, 
++        "SELECT type, name, rootpage, sql, ", zDbNum, " FROM \"",
++       db->aDb[iDb].zName, "\".", zMasterName, 
++       " WHERE type IN ('table', 'index')"
++       " ORDER BY CASE type WHEN 'table' THEN 0 ELSE 1 END", (char*)0);
++  }
++  rc = sqlite_exec(db, zSql, sqliteInitCallback, &initData, 0);
++
++  sqliteFree(zSql);
++  sqliteSafetyOn(db);
++  sqliteBtreeCloseCursor(curMain);
++  if( sqlite_malloc_failed ){
++    sqliteSetString(pzErrMsg, "out of memory", (char*)0);
++    rc = SQLITE_NOMEM;
++    sqliteResetInternalSchema(db, 0);
++  }
++  if( rc==SQLITE_OK ){
++    DbSetProperty(db, iDb, DB_SchemaLoaded);
++  }else{
++    sqliteResetInternalSchema(db, iDb);
++  }
++  return rc;
++}
++
++/*
++** Initialize all database files - the main database file, the file
++** used to store temporary tables, and any additional database files
++** created using ATTACH statements.  Return a success code.  If an
++** error occurs, write an error message into *pzErrMsg.
++**
++** After the database is initialized, the SQLITE_Initialized
++** bit is set in the flags field of the sqlite structure.  An
++** attempt is made to initialize the database as soon as it
++** is opened.  If that fails (perhaps because another process
++** has the sqlite_master table locked) than another attempt
++** is made the first time the database is accessed.
++*/
++int sqliteInit(sqlite *db, char **pzErrMsg){
++  int i, rc;
++  
++  if( db->init.busy ) return SQLITE_OK;
++  assert( (db->flags & SQLITE_Initialized)==0 );
++  rc = SQLITE_OK;
++  db->init.busy = 1;
++  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
++    if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue;
++    rc = sqliteInitOne(db, i, pzErrMsg);
++    if( rc ){
++      sqliteResetInternalSchema(db, i);
++    }
++  }
++
++  /* Once all the other databases have been initialised, load the schema
++  ** for the TEMP database. This is loaded last, as the TEMP database
++  ** schema may contain references to objects in other databases.
++  */
++  if( rc==SQLITE_OK && db->nDb>1 && !DbHasProperty(db, 1, DB_SchemaLoaded) ){
++    rc = sqliteInitOne(db, 1, pzErrMsg);
++    if( rc ){
++      sqliteResetInternalSchema(db, 1);
++    }
++  }
++
++  db->init.busy = 0;
++  if( rc==SQLITE_OK ){
++    db->flags |= SQLITE_Initialized;
++    sqliteCommitInternalChanges(db);
++  }
++
++  /* If the database is in formats 1 or 2, then upgrade it to
++  ** version 3.  This will reconstruct all indices.  If the
++  ** upgrade fails for any reason (ex: out of disk space, database
++  ** is read only, interrupt received, etc.) then fail the init.
++  */
++  if( rc==SQLITE_OK && db->file_format<3 ){
++    char *zErr = 0;
++    InitData initData;
++    int meta[SQLITE_N_BTREE_META];
++
++    db->magic = SQLITE_MAGIC_OPEN;
++    initData.db = db;
++    initData.pzErrMsg = &zErr;
++    db->file_format = 3;
++    rc = sqlite_exec(db,
++      "BEGIN; SELECT name FROM sqlite_master WHERE type='table';",
++      upgrade_3_callback,
++      &initData,
++      &zErr);
++    if( rc==SQLITE_OK ){
++      sqliteBtreeGetMeta(db->aDb[0].pBt, meta);
++      meta[2] = 4;
++      sqliteBtreeUpdateMeta(db->aDb[0].pBt, meta);
++      sqlite_exec(db, "COMMIT", 0, 0, 0);
++    }
++    if( rc!=SQLITE_OK ){
++      sqliteSetString(pzErrMsg, 
++        "unable to upgrade database to the version 2.6 format",
++        zErr ? ": " : 0, zErr, (char*)0);
++    }
++    sqlite_freemem(zErr);
++  }
++
++  if( rc!=SQLITE_OK ){
++    db->flags &= ~SQLITE_Initialized;
++  }
++  return rc;
++}
++
++/*
++** The version of the library
++*/
++const char rcsid[] = "@(#) \044Id: SQLite version " SQLITE_VERSION " $";
++const char sqlite_version[] = SQLITE_VERSION;
++
++/*
++** Does the library expect data to be encoded as UTF-8 or iso8859?  The
++** following global constant always lets us know.
++*/
++#ifdef SQLITE_UTF8
++const char sqlite_encoding[] = "UTF-8";
++#else
++const char sqlite_encoding[] = "iso8859";
++#endif
++
++/*
++** Open a new SQLite database.  Construct an "sqlite" structure to define
++** the state of this database and return a pointer to that structure.
++**
++** An attempt is made to initialize the in-memory data structures that
++** hold the database schema.  But if this fails (because the schema file
++** is locked) then that step is deferred until the first call to
++** sqlite_exec().
++*/
++sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){
++  sqlite *db;
++  int rc, i;
++
++  /* Allocate the sqlite data structure */
++  db = sqliteMalloc( sizeof(sqlite) );
++  if( pzErrMsg ) *pzErrMsg = 0;
++  if( db==0 ) goto no_mem_on_open;
++  db->onError = OE_Default;
++  db->priorNewRowid = 0;
++  db->magic = SQLITE_MAGIC_BUSY;
++  db->nDb = 2;
++  db->aDb = db->aDbStatic;
++  /* db->flags |= SQLITE_ShortColNames; */
++  sqliteHashInit(&db->aFunc, SQLITE_HASH_STRING, 1);
++  for(i=0; i<db->nDb; i++){
++    sqliteHashInit(&db->aDb[i].tblHash, SQLITE_HASH_STRING, 0);
++    sqliteHashInit(&db->aDb[i].idxHash, SQLITE_HASH_STRING, 0);
++    sqliteHashInit(&db->aDb[i].trigHash, SQLITE_HASH_STRING, 0);
++    sqliteHashInit(&db->aDb[i].aFKey, SQLITE_HASH_STRING, 1);
++  }
++  
++  /* Open the backend database driver */
++  if( zFilename[0]==':' && strcmp(zFilename,":memory:")==0 ){
++    db->temp_store = 2;
++  }
++  rc = sqliteBtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt);
++  if( rc!=SQLITE_OK ){
++    switch( rc ){
++      default: {
++        sqliteSetString(pzErrMsg, "unable to open database: ",
++           zFilename, (char*)0);
++      }
++    }
++    sqliteFree(db);
++    sqliteStrRealloc(pzErrMsg);
++    return 0;
++  }
++  db->aDb[0].zName = "main";
++  db->aDb[1].zName = "temp";
++
++  /* Attempt to read the schema */
++  sqliteRegisterBuiltinFunctions(db);
++  rc = sqliteInit(db, pzErrMsg);
++  db->magic = SQLITE_MAGIC_OPEN;
++  if( sqlite_malloc_failed ){
++    sqlite_close(db);
++    goto no_mem_on_open;
++  }else if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
++    sqlite_close(db);
++    sqliteStrRealloc(pzErrMsg);
++    return 0;
++  }else if( pzErrMsg ){
++    sqliteFree(*pzErrMsg);
++    *pzErrMsg = 0;
++  }
++
++  /* Return a pointer to the newly opened database structure */
++  return db;
++
++no_mem_on_open:
++  sqliteSetString(pzErrMsg, "out of memory", (char*)0);
++  sqliteStrRealloc(pzErrMsg);
++  return 0;
++}
++
++/*
++** Return the ROWID of the most recent insert
++*/
++int sqlite_last_insert_rowid(sqlite *db){
++  return db->lastRowid;
++}
++
++/*
++** Return the number of changes in the most recent call to sqlite_exec().
++*/
++int sqlite_changes(sqlite *db){
++  return db->nChange;
++}
++
++/*
++** Return the number of changes produced by the last INSERT, UPDATE, or
++** DELETE statement to complete execution. The count does not include
++** changes due to SQL statements executed in trigger programs that were
++** triggered by that statement
++*/
++int sqlite_last_statement_changes(sqlite *db){
++  return db->lsChange;
++}
++
++/*
++** Close an existing SQLite database
++*/
++void sqlite_close(sqlite *db){
++  HashElem *i;
++  int j;
++  db->want_to_close = 1;
++  if( sqliteSafetyCheck(db) || sqliteSafetyOn(db) ){
++    /* printf("DID NOT CLOSE\n"); fflush(stdout); */
++    return;
++  }
++  db->magic = SQLITE_MAGIC_CLOSED;
++  for(j=0; j<db->nDb; j++){
++    struct Db *pDb = &db->aDb[j];
++    if( pDb->pBt ){
++      sqliteBtreeClose(pDb->pBt);
++      pDb->pBt = 0;
++    }
++  }
++  sqliteResetInternalSchema(db, 0);
++  assert( db->nDb<=2 );
++  assert( db->aDb==db->aDbStatic );
++  for(i=sqliteHashFirst(&db->aFunc); i; i=sqliteHashNext(i)){
++    FuncDef *pFunc, *pNext;
++    for(pFunc = (FuncDef*)sqliteHashData(i); pFunc; pFunc=pNext){
++      pNext = pFunc->pNext;
++      sqliteFree(pFunc);
++    }
++  }
++  sqliteHashClear(&db->aFunc);
++  sqliteFree(db);
++}
++
++/*
++** Rollback all database files.
++*/
++void sqliteRollbackAll(sqlite *db){
++  int i;
++  for(i=0; i<db->nDb; i++){
++    if( db->aDb[i].pBt ){
++      sqliteBtreeRollback(db->aDb[i].pBt);
++      db->aDb[i].inTrans = 0;
++    }
++  }
++  sqliteResetInternalSchema(db, 0);
++  /* sqliteRollbackInternalChanges(db); */
++}
++
++/*
++** Execute SQL code.  Return one of the SQLITE_ success/failure
++** codes.  Also write an error message into memory obtained from
++** malloc() and make *pzErrMsg point to that message.
++**
++** If the SQL is a query, then for each row in the query result
++** the xCallback() function is called.  pArg becomes the first
++** argument to xCallback().  If xCallback=NULL then no callback
++** is invoked, even for queries.
++*/
++int sqlite_exec(
++  sqlite *db,                 /* The database on which the SQL executes */
++  const char *zSql,           /* The SQL to be executed */
++  sqlite_callback xCallback,  /* Invoke this callback routine */
++  void *pArg,                 /* First argument to xCallback() */
++  char **pzErrMsg             /* Write error messages here */
++){
++  int rc = SQLITE_OK;
++  const char *zLeftover;
++  sqlite_vm *pVm;
++  int nRetry = 0;
++  int nChange = 0;
++  int nCallback;
++
++  if( zSql==0 ) return SQLITE_OK;
++  while( rc==SQLITE_OK && zSql[0] ){
++    pVm = 0;
++    rc = sqlite_compile(db, zSql, &zLeftover, &pVm, pzErrMsg);
++    if( rc!=SQLITE_OK ){
++      assert( pVm==0 || sqlite_malloc_failed );
++      return rc;
++    }
++    if( pVm==0 ){
++      /* This happens if the zSql input contained only whitespace */
++      break;
++    }
++    db->nChange += nChange;
++    nCallback = 0;
++    while(1){
++      int nArg;
++      char **azArg, **azCol;
++      rc = sqlite_step(pVm, &nArg, (const char***)&azArg,(const char***)&azCol);
++      if( rc==SQLITE_ROW ){
++        if( xCallback!=0 && xCallback(pArg, nArg, azArg, azCol) ){
++          sqlite_finalize(pVm, 0);
++          return SQLITE_ABORT;
++        }
++        nCallback++;
++      }else{
++        if( rc==SQLITE_DONE && nCallback==0
++          && (db->flags & SQLITE_NullCallback)!=0 && xCallback!=0 ){
++          xCallback(pArg, nArg, azArg, azCol);
++        }
++        rc = sqlite_finalize(pVm, pzErrMsg);
++        if( rc==SQLITE_SCHEMA && nRetry<2 ){
++          nRetry++;
++          rc = SQLITE_OK;
++          break;
++        }
++        if( db->pVdbe==0 ){
++          nChange = db->nChange;
++        }
++        nRetry = 0;
++        zSql = zLeftover;
++        while( isspace(zSql[0]) ) zSql++;
++        break;
++      }
++    }
++  }
++  return rc;
++}
++
++
++/*
++** Compile a single statement of SQL into a virtual machine.  Return one
++** of the SQLITE_ success/failure codes.  Also write an error message into
++** memory obtained from malloc() and make *pzErrMsg point to that message.
++*/
++int sqlite_compile(
++  sqlite *db,                 /* The database on which the SQL executes */
++  const char *zSql,           /* The SQL to be executed */
++  const char **pzTail,        /* OUT: Next statement after the first */
++  sqlite_vm **ppVm,           /* OUT: The virtual machine */
++  char **pzErrMsg             /* OUT: Write error messages here */
++){
++  Parse sParse;
++
++  if( pzErrMsg ) *pzErrMsg = 0;
++  if( sqliteSafetyOn(db) ) goto exec_misuse;
++  if( !db->init.busy ){
++    if( (db->flags & SQLITE_Initialized)==0 ){
++      int rc, cnt = 1;
++      while( (rc = sqliteInit(db, pzErrMsg))==SQLITE_BUSY
++         && db->xBusyCallback
++         && db->xBusyCallback(db->pBusyArg, "", cnt++)!=0 ){}
++      if( rc!=SQLITE_OK ){
++        sqliteStrRealloc(pzErrMsg);
++        sqliteSafetyOff(db);
++        return rc;
++      }
++      if( pzErrMsg ){
++        sqliteFree(*pzErrMsg);
++        *pzErrMsg = 0;
++      }
++    }
++    if( db->file_format<3 ){
++      sqliteSafetyOff(db);
++      sqliteSetString(pzErrMsg, "obsolete database file format", (char*)0);
++      return SQLITE_ERROR;
++    }
++  }
++  assert( (db->flags & SQLITE_Initialized)!=0 || db->init.busy );
++  if( db->pVdbe==0 ){ db->nChange = 0; }
++  memset(&sParse, 0, sizeof(sParse));
++  sParse.db = db;
++  sqliteRunParser(&sParse, zSql, pzErrMsg);
++  if( db->xTrace && !db->init.busy ){
++    /* Trace only the statment that was compiled.
++    ** Make a copy of that part of the SQL string since zSQL is const
++    ** and we must pass a zero terminated string to the trace function
++    ** The copy is unnecessary if the tail pointer is pointing at the
++    ** beginnig or end of the SQL string.
++    */
++    if( sParse.zTail && sParse.zTail!=zSql && *sParse.zTail ){
++      char *tmpSql = sqliteStrNDup(zSql, sParse.zTail - zSql);
++      if( tmpSql ){
++        db->xTrace(db->pTraceArg, tmpSql);
++        free(tmpSql);
++      }else{
++        /* If a memory error occurred during the copy,
++        ** trace entire SQL string and fall through to the
++        ** sqlite_malloc_failed test to report the error.
++        */
++        db->xTrace(db->pTraceArg, zSql); 
++      }
++    }else{
++      db->xTrace(db->pTraceArg, zSql); 
++    }
++  }
++  if( sqlite_malloc_failed ){
++    sqliteSetString(pzErrMsg, "out of memory", (char*)0);
++    sParse.rc = SQLITE_NOMEM;
++    sqliteRollbackAll(db);
++    sqliteResetInternalSchema(db, 0);
++    db->flags &= ~SQLITE_InTrans;
++  }
++  if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;
++  if( sParse.rc!=SQLITE_OK && pzErrMsg && *pzErrMsg==0 ){
++    sqliteSetString(pzErrMsg, sqlite_error_string(sParse.rc), (char*)0);
++  }
++  sqliteStrRealloc(pzErrMsg);
++  if( sParse.rc==SQLITE_SCHEMA ){
++    sqliteResetInternalSchema(db, 0);
++  }
++  assert( ppVm );
++  *ppVm = (sqlite_vm*)sParse.pVdbe;
++  if( pzTail ) *pzTail = sParse.zTail;
++  if( sqliteSafetyOff(db) ) goto exec_misuse;
++  return sParse.rc;
++
++exec_misuse:
++  if( pzErrMsg ){
++    *pzErrMsg = 0;
++    sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), (char*)0);
++    sqliteStrRealloc(pzErrMsg);
++  }
++  return SQLITE_MISUSE;
++}
++
++
++/*
++** The following routine destroys a virtual machine that is created by
++** the sqlite_compile() routine.
++**
++** The integer returned is an SQLITE_ success/failure code that describes
++** the result of executing the virtual machine.  An error message is
++** written into memory obtained from malloc and *pzErrMsg is made to
++** point to that error if pzErrMsg is not NULL.  The calling routine
++** should use sqlite_freemem() to delete the message when it has finished
++** with it.
++*/
++int sqlite_finalize(
++  sqlite_vm *pVm,            /* The virtual machine to be destroyed */
++  char **pzErrMsg            /* OUT: Write error messages here */
++){
++  int rc = sqliteVdbeFinalize((Vdbe*)pVm, pzErrMsg);
++  sqliteStrRealloc(pzErrMsg);
++  return rc;
++}
++
++/*
++** Terminate the current execution of a virtual machine then
++** reset the virtual machine back to its starting state so that it
++** can be reused.  Any error message resulting from the prior execution
++** is written into *pzErrMsg.  A success code from the prior execution
++** is returned.
++*/
++int sqlite_reset(
++  sqlite_vm *pVm,            /* The virtual machine to be destroyed */
++  char **pzErrMsg            /* OUT: Write error messages here */
++){
++  int rc = sqliteVdbeReset((Vdbe*)pVm, pzErrMsg);
++  sqliteVdbeMakeReady((Vdbe*)pVm, -1, 0);
++  sqliteStrRealloc(pzErrMsg);
++  return rc;
++}
++
++/*
++** Return a static string that describes the kind of error specified in the
++** argument.
++*/
++const char *sqlite_error_string(int rc){
++  const char *z;
++  switch( rc ){
++    case SQLITE_OK:         z = "not an error";                          break;
++    case SQLITE_ERROR:      z = "SQL logic error or missing database";   break;
++    case SQLITE_INTERNAL:   z = "internal SQLite implementation flaw";   break;
++    case SQLITE_PERM:       z = "access permission denied";              break;
++    case SQLITE_ABORT:      z = "callback requested query abort";        break;
++    case SQLITE_BUSY:       z = "database is locked";                    break;
++    case SQLITE_LOCKED:     z = "database table is locked";              break;
++    case SQLITE_NOMEM:      z = "out of memory";                         break;
++    case SQLITE_READONLY:   z = "attempt to write a readonly database";  break;
++    case SQLITE_INTERRUPT:  z = "interrupted";                           break;
++    case SQLITE_IOERR:      z = "disk I/O error";                        break;
++    case SQLITE_CORRUPT:    z = "database disk image is malformed";      break;
++    case SQLITE_NOTFOUND:   z = "table or record not found";             break;
++    case SQLITE_FULL:       z = "database is full";                      break;
++    case SQLITE_CANTOPEN:   z = "unable to open database file";          break;
++    case SQLITE_PROTOCOL:   z = "database locking protocol failure";     break;
++    case SQLITE_EMPTY:      z = "table contains no data";                break;
++    case SQLITE_SCHEMA:     z = "database schema has changed";           break;
++    case SQLITE_TOOBIG:     z = "too much data for one table row";       break;
++    case SQLITE_CONSTRAINT: z = "constraint failed";                     break;
++    case SQLITE_MISMATCH:   z = "datatype mismatch";                     break;
++    case SQLITE_MISUSE:     z = "library routine called out of sequence";break;
++    case SQLITE_NOLFS:      z = "kernel lacks large file support";       break;
++    case SQLITE_AUTH:       z = "authorization denied";                  break;
++    case SQLITE_FORMAT:     z = "auxiliary database format error";       break;
++    case SQLITE_RANGE:      z = "bind index out of range";               break;
++    case SQLITE_NOTADB:     z = "file is encrypted or is not a database";break;
++    default:                z = "unknown error";                         break;
++  }
++  return z;
++}
++
++/*
++** This routine implements a busy callback that sleeps and tries
++** again until a timeout value is reached.  The timeout value is
++** an integer number of milliseconds passed in as the first
++** argument.
++*/
++static int sqliteDefaultBusyCallback(
++ void *Timeout,           /* Maximum amount of time to wait */
++ const char *NotUsed,     /* The name of the table that is busy */
++ int count                /* Number of times table has been busy */
++){
++#if SQLITE_MIN_SLEEP_MS==1
++  static const char delays[] =
++     { 1, 2, 5, 10, 15, 20, 25, 25,  25,  50,  50,  50, 100};
++  static const short int totals[] =
++     { 0, 1, 3,  8, 18, 33, 53, 78, 103, 128, 178, 228, 287};
++# define NDELAY (sizeof(delays)/sizeof(delays[0]))
++  int timeout = (int)(long)Timeout;
++  int delay, prior;
++
++  if( count <= NDELAY ){
++    delay = delays[count-1];
++    prior = totals[count-1];
++  }else{
++    delay = delays[NDELAY-1];
++    prior = totals[NDELAY-1] + delay*(count-NDELAY-1);
++  }
++  if( prior + delay > timeout ){
++    delay = timeout - prior;
++    if( delay<=0 ) return 0;
++  }
++  sqliteOsSleep(delay);
++  return 1;
++#else
++  int timeout = (int)(long)Timeout;
++  if( (count+1)*1000 > timeout ){
++    return 0;
++  }
++  sqliteOsSleep(1000);
++  return 1;
++#endif
++}
++
++/*
++** This routine sets the busy callback for an Sqlite database to the
++** given callback function with the given argument.
++*/
++void sqlite_busy_handler(
++  sqlite *db,
++  int (*xBusy)(void*,const char*,int),
++  void *pArg
++){
++  db->xBusyCallback = xBusy;
++  db->pBusyArg = pArg;
++}
++
++#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
++/*
++** This routine sets the progress callback for an Sqlite database to the
++** given callback function with the given argument. The progress callback will
++** be invoked every nOps opcodes.
++*/
++void sqlite_progress_handler(
++  sqlite *db, 
++  int nOps,
++  int (*xProgress)(void*), 
++  void *pArg
++){
++  if( nOps>0 ){
++    db->xProgress = xProgress;
++    db->nProgressOps = nOps;
++    db->pProgressArg = pArg;
++  }else{
++    db->xProgress = 0;
++    db->nProgressOps = 0;
++    db->pProgressArg = 0;
++  }
++}
++#endif
++
++
++/*
++** This routine installs a default busy handler that waits for the
++** specified number of milliseconds before returning 0.
++*/
++void sqlite_busy_timeout(sqlite *db, int ms){
++  if( ms>0 ){
++    sqlite_busy_handler(db, sqliteDefaultBusyCallback, (void*)(long)ms);
++  }else{
++    sqlite_busy_handler(db, 0, 0);
++  }
++}
++
++/*
++** Cause any pending operation to stop at its earliest opportunity.
++*/
++void sqlite_interrupt(sqlite *db){
++  db->flags |= SQLITE_Interrupt;
++}
++
++/*
++** Windows systems should call this routine to free memory that
++** is returned in the in the errmsg parameter of sqlite_open() when
++** SQLite is a DLL.  For some reason, it does not work to call free()
++** directly.
++**
++** Note that we need to call free() not sqliteFree() here, since every
++** string that is exported from SQLite should have already passed through
++** sqliteStrRealloc().
++*/
++void sqlite_freemem(void *p){ free(p); }
++
++/*
++** Windows systems need functions to call to return the sqlite_version
++** and sqlite_encoding strings since they are unable to access constants
++** within DLLs.
++*/
++const char *sqlite_libversion(void){ return sqlite_version; }
++const char *sqlite_libencoding(void){ return sqlite_encoding; }
++
++/*
++** Create new user-defined functions.  The sqlite_create_function()
++** routine creates a regular function and sqlite_create_aggregate()
++** creates an aggregate function.
++**
++** Passing a NULL xFunc argument or NULL xStep and xFinalize arguments
++** disables the function.  Calling sqlite_create_function() with the
++** same name and number of arguments as a prior call to
++** sqlite_create_aggregate() disables the prior call to
++** sqlite_create_aggregate(), and vice versa.
++**
++** If nArg is -1 it means that this function will accept any number
++** of arguments, including 0.  The maximum allowed value of nArg is 127.
++*/
++int sqlite_create_function(
++  sqlite *db,          /* Add the function to this database connection */
++  const char *zName,   /* Name of the function to add */
++  int nArg,            /* Number of arguments */
++  void (*xFunc)(sqlite_func*,int,const char**),  /* The implementation */
++  void *pUserData      /* User data */
++){
++  FuncDef *p;
++  int nName;
++  if( db==0 || zName==0 || sqliteSafetyCheck(db) ) return 1;
++  if( nArg<-1 || nArg>127 ) return 1;
++  nName = strlen(zName);
++  if( nName>255 ) return 1;
++  p = sqliteFindFunction(db, zName, nName, nArg, 1);
++  if( p==0 ) return 1;
++  p->xFunc = xFunc;
++  p->xStep = 0;
++  p->xFinalize = 0;
++  p->pUserData = pUserData;
++  return 0;
++}
++int sqlite_create_aggregate(
++  sqlite *db,          /* Add the function to this database connection */
++  const char *zName,   /* Name of the function to add */
++  int nArg,            /* Number of arguments */
++  void (*xStep)(sqlite_func*,int,const char**), /* The step function */
++  void (*xFinalize)(sqlite_func*),              /* The finalizer */
++  void *pUserData      /* User data */
++){
++  FuncDef *p;
++  int nName;
++  if( db==0 || zName==0 || sqliteSafetyCheck(db) ) return 1;
++  if( nArg<-1 || nArg>127 ) return 1;
++  nName = strlen(zName);
++  if( nName>255 ) return 1;
++  p = sqliteFindFunction(db, zName, nName, nArg, 1);
++  if( p==0 ) return 1;
++  p->xFunc = 0;
++  p->xStep = xStep;
++  p->xFinalize = xFinalize;
++  p->pUserData = pUserData;
++  return 0;
++}
++
++/*
++** Change the datatype for all functions with a given name.  See the
++** header comment for the prototype of this function in sqlite.h for
++** additional information.
++*/
++int sqlite_function_type(sqlite *db, const char *zName, int dataType){
++  FuncDef *p = (FuncDef*)sqliteHashFind(&db->aFunc, zName, strlen(zName));
++  while( p ){
++    p->dataType = dataType; 
++    p = p->pNext;
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Register a trace function.  The pArg from the previously registered trace
++** is returned.  
++**
++** A NULL trace function means that no tracing is executes.  A non-NULL
++** trace is a pointer to a function that is invoked at the start of each
++** sqlite_exec().
++*/
++void *sqlite_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){
++  void *pOld = db->pTraceArg;
++  db->xTrace = xTrace;
++  db->pTraceArg = pArg;
++  return pOld;
++}
++
++/*** EXPERIMENTAL ***
++**
++** Register a function to be invoked when a transaction comments.
++** If either function returns non-zero, then the commit becomes a
++** rollback.
++*/
++void *sqlite_commit_hook(
++  sqlite *db,               /* Attach the hook to this database */
++  int (*xCallback)(void*),  /* Function to invoke on each commit */
++  void *pArg                /* Argument to the function */
++){
++  void *pOld = db->pCommitArg;
++  db->xCommitCallback = xCallback;
++  db->pCommitArg = pArg;
++  return pOld;
++}
++
++
++/*
++** This routine is called to create a connection to a database BTree
++** driver.  If zFilename is the name of a file, then that file is
++** opened and used.  If zFilename is the magic name ":memory:" then
++** the database is stored in memory (and is thus forgotten as soon as
++** the connection is closed.)  If zFilename is NULL then the database
++** is for temporary use only and is deleted as soon as the connection
++** is closed.
++**
++** A temporary database can be either a disk file (that is automatically
++** deleted when the file is closed) or a set of red-black trees held in memory,
++** depending on the values of the TEMP_STORE compile-time macro and the
++** db->temp_store variable, according to the following chart:
++**
++**       TEMP_STORE     db->temp_store     Location of temporary database
++**       ----------     --------------     ------------------------------
++**           0               any             file
++**           1                1              file
++**           1                2              memory
++**           1                0              file
++**           2                1              file
++**           2                2              memory
++**           2                0              memory
++**           3               any             memory
++*/
++int sqliteBtreeFactory(
++  const sqlite *db,       /* Main database when opening aux otherwise 0 */
++  const char *zFilename,    /* Name of the file containing the BTree database */
++  int omitJournal,          /* if TRUE then do not journal this file */
++  int nCache,               /* How many pages in the page cache */
++  Btree **ppBtree){         /* Pointer to new Btree object written here */
++
++  assert( ppBtree != 0);
++
++#ifndef SQLITE_OMIT_INMEMORYDB
++  if( zFilename==0 ){
++    if (TEMP_STORE == 0) {
++      /* Always use file based temporary DB */
++      return sqliteBtreeOpen(0, omitJournal, nCache, ppBtree);
++    } else if (TEMP_STORE == 1 || TEMP_STORE == 2) {
++      /* Switch depending on compile-time and/or runtime settings. */
++      int location = db->temp_store==0 ? TEMP_STORE : db->temp_store;
++
++      if (location == 1) {
++        return sqliteBtreeOpen(zFilename, omitJournal, nCache, ppBtree);
++      } else {
++        return sqliteRbtreeOpen(0, 0, 0, ppBtree);
++      }
++    } else {
++      /* Always use in-core DB */
++      return sqliteRbtreeOpen(0, 0, 0, ppBtree);
++    }
++  }else if( zFilename[0]==':' && strcmp(zFilename,":memory:")==0 ){
++    return sqliteRbtreeOpen(0, 0, 0, ppBtree);
++  }else
++#endif
++  {
++    return sqliteBtreeOpen(zFilename, omitJournal, nCache, ppBtree);
++  }
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/opcodes.c
+@@ -0,0 +1,140 @@
++/* Automatically generated file.  Do not edit */
++char *sqliteOpcodeNames[] = { "???", 
++  "Goto", 
++  "Gosub", 
++  "Return", 
++  "Halt", 
++  "Integer", 
++  "String", 
++  "Variable", 
++  "Pop", 
++  "Dup", 
++  "Pull", 
++  "Push", 
++  "ColumnName", 
++  "Callback", 
++  "Concat", 
++  "Add", 
++  "Subtract", 
++  "Multiply", 
++  "Divide", 
++  "Remainder", 
++  "Function", 
++  "BitAnd", 
++  "BitOr", 
++  "ShiftLeft", 
++  "ShiftRight", 
++  "AddImm", 
++  "ForceInt", 
++  "MustBeInt", 
++  "Eq", 
++  "Ne", 
++  "Lt", 
++  "Le", 
++  "Gt", 
++  "Ge", 
++  "StrEq", 
++  "StrNe", 
++  "StrLt", 
++  "StrLe", 
++  "StrGt", 
++  "StrGe", 
++  "And", 
++  "Or", 
++  "Negative", 
++  "AbsValue", 
++  "Not", 
++  "BitNot", 
++  "Noop", 
++  "If", 
++  "IfNot", 
++  "IsNull", 
++  "NotNull", 
++  "MakeRecord", 
++  "MakeIdxKey", 
++  "MakeKey", 
++  "IncrKey", 
++  "Checkpoint", 
++  "Transaction", 
++  "Commit", 
++  "Rollback", 
++  "ReadCookie", 
++  "SetCookie", 
++  "VerifyCookie", 
++  "OpenRead", 
++  "OpenWrite", 
++  "OpenTemp", 
++  "OpenPseudo", 
++  "Close", 
++  "MoveLt", 
++  "MoveTo", 
++  "Distinct", 
++  "NotFound", 
++  "Found", 
++  "IsUnique", 
++  "NotExists", 
++  "NewRecno", 
++  "PutIntKey", 
++  "PutStrKey", 
++  "Delete", 
++  "SetCounts", 
++  "KeyAsData", 
++  "RowKey", 
++  "RowData", 
++  "Column", 
++  "Recno", 
++  "FullKey", 
++  "NullRow", 
++  "Last", 
++  "Rewind", 
++  "Prev", 
++  "Next", 
++  "IdxPut", 
++  "IdxDelete", 
++  "IdxRecno", 
++  "IdxLT", 
++  "IdxGT", 
++  "IdxGE", 
++  "IdxIsNull", 
++  "Destroy", 
++  "Clear", 
++  "CreateIndex", 
++  "CreateTable", 
++  "IntegrityCk", 
++  "ListWrite", 
++  "ListRewind", 
++  "ListRead", 
++  "ListReset", 
++  "ListPush", 
++  "ListPop", 
++  "ContextPush", 
++  "ContextPop", 
++  "SortPut", 
++  "SortMakeRec", 
++  "SortMakeKey", 
++  "Sort", 
++  "SortNext", 
++  "SortCallback", 
++  "SortReset", 
++  "FileOpen", 
++  "FileRead", 
++  "FileColumn", 
++  "MemStore", 
++  "MemLoad", 
++  "MemIncr", 
++  "AggReset", 
++  "AggInit", 
++  "AggFunc", 
++  "AggFocus", 
++  "AggSet", 
++  "AggGet", 
++  "AggNext", 
++  "SetInsert", 
++  "SetFound", 
++  "SetNotFound", 
++  "SetFirst", 
++  "SetNext", 
++  "Vacuum", 
++  "StackDepth", 
++  "StackReset", 
++};
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/opcodes.h
+@@ -0,0 +1,138 @@
++/* Automatically generated file.  Do not edit */
++#define OP_Goto                          1
++#define OP_Gosub                         2
++#define OP_Return                        3
++#define OP_Halt                          4
++#define OP_Integer                       5
++#define OP_String                        6
++#define OP_Variable                      7
++#define OP_Pop                           8
++#define OP_Dup                           9
++#define OP_Pull                         10
++#define OP_Push                         11
++#define OP_ColumnName                   12
++#define OP_Callback                     13
++#define OP_Concat                       14
++#define OP_Add                          15
++#define OP_Subtract                     16
++#define OP_Multiply                     17
++#define OP_Divide                       18
++#define OP_Remainder                    19
++#define OP_Function                     20
++#define OP_BitAnd                       21
++#define OP_BitOr                        22
++#define OP_ShiftLeft                    23
++#define OP_ShiftRight                   24
++#define OP_AddImm                       25
++#define OP_ForceInt                     26
++#define OP_MustBeInt                    27
++#define OP_Eq                           28
++#define OP_Ne                           29
++#define OP_Lt                           30
++#define OP_Le                           31
++#define OP_Gt                           32
++#define OP_Ge                           33
++#define OP_StrEq                        34
++#define OP_StrNe                        35
++#define OP_StrLt                        36
++#define OP_StrLe                        37
++#define OP_StrGt                        38
++#define OP_StrGe                        39
++#define OP_And                          40
++#define OP_Or                           41
++#define OP_Negative                     42
++#define OP_AbsValue                     43
++#define OP_Not                          44
++#define OP_BitNot                       45
++#define OP_Noop                         46
++#define OP_If                           47
++#define OP_IfNot                        48
++#define OP_IsNull                       49
++#define OP_NotNull                      50
++#define OP_MakeRecord                   51
++#define OP_MakeIdxKey                   52
++#define OP_MakeKey                      53
++#define OP_IncrKey                      54
++#define OP_Checkpoint                   55
++#define OP_Transaction                  56
++#define OP_Commit                       57
++#define OP_Rollback                     58
++#define OP_ReadCookie                   59
++#define OP_SetCookie                    60
++#define OP_VerifyCookie                 61
++#define OP_OpenRead                     62
++#define OP_OpenWrite                    63
++#define OP_OpenTemp                     64
++#define OP_OpenPseudo                   65
++#define OP_Close                        66
++#define OP_MoveLt                       67
++#define OP_MoveTo                       68
++#define OP_Distinct                     69
++#define OP_NotFound                     70
++#define OP_Found                        71
++#define OP_IsUnique                     72
++#define OP_NotExists                    73
++#define OP_NewRecno                     74
++#define OP_PutIntKey                    75
++#define OP_PutStrKey                    76
++#define OP_Delete                       77
++#define OP_SetCounts                    78
++#define OP_KeyAsData                    79
++#define OP_RowKey                       80
++#define OP_RowData                      81
++#define OP_Column                       82
++#define OP_Recno                        83
++#define OP_FullKey                      84
++#define OP_NullRow                      85
++#define OP_Last                         86
++#define OP_Rewind                       87
++#define OP_Prev                         88
++#define OP_Next                         89
++#define OP_IdxPut                       90
++#define OP_IdxDelete                    91
++#define OP_IdxRecno                     92
++#define OP_IdxLT                        93
++#define OP_IdxGT                        94
++#define OP_IdxGE                        95
++#define OP_IdxIsNull                    96
++#define OP_Destroy                      97
++#define OP_Clear                        98
++#define OP_CreateIndex                  99
++#define OP_CreateTable                 100
++#define OP_IntegrityCk                 101
++#define OP_ListWrite                   102
++#define OP_ListRewind                  103
++#define OP_ListRead                    104
++#define OP_ListReset                   105
++#define OP_ListPush                    106
++#define OP_ListPop                     107
++#define OP_ContextPush                 108
++#define OP_ContextPop                  109
++#define OP_SortPut                     110
++#define OP_SortMakeRec                 111
++#define OP_SortMakeKey                 112
++#define OP_Sort                        113
++#define OP_SortNext                    114
++#define OP_SortCallback                115
++#define OP_SortReset                   116
++#define OP_FileOpen                    117
++#define OP_FileRead                    118
++#define OP_FileColumn                  119
++#define OP_MemStore                    120
++#define OP_MemLoad                     121
++#define OP_MemIncr                     122
++#define OP_AggReset                    123
++#define OP_AggInit                     124
++#define OP_AggFunc                     125
++#define OP_AggFocus                    126
++#define OP_AggSet                      127
++#define OP_AggGet                      128
++#define OP_AggNext                     129
++#define OP_SetInsert                   130
++#define OP_SetFound                    131
++#define OP_SetNotFound                 132
++#define OP_SetFirst                    133
++#define OP_SetNext                     134
++#define OP_Vacuum                      135
++#define OP_StackDepth                  136
++#define OP_StackReset                  137
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/os.c
+@@ -0,0 +1,1850 @@
++/*
++** 2001 September 16
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++******************************************************************************
++**
++** This file contains code that is specific to particular operating
++** systems.  The purpose of this file is to provide a uniform abstraction
++** on which the rest of SQLite can operate.
++*/
++#include "os.h"          /* Must be first to enable large file support */
++#include "sqliteInt.h"
++
++#if OS_UNIX
++# include <time.h>
++# include <errno.h>
++# include <unistd.h>
++# ifndef O_LARGEFILE
++#  define O_LARGEFILE 0
++# endif
++# ifdef SQLITE_DISABLE_LFS
++#  undef O_LARGEFILE
++#  define O_LARGEFILE 0
++# endif
++# ifndef O_NOFOLLOW
++#  define O_NOFOLLOW 0
++# endif
++# ifndef O_BINARY
++#  define O_BINARY 0
++# endif
++#endif
++
++
++#if OS_WIN
++# include <winbase.h>
++#endif
++
++#if OS_MAC
++# include <extras.h>
++# include <path2fss.h>
++# include <TextUtils.h>
++# include <FinderRegistry.h>
++# include <Folders.h>
++# include <Timer.h>
++# include <OSUtils.h>
++#endif
++
++/*
++** The DJGPP compiler environment looks mostly like Unix, but it
++** lacks the fcntl() system call.  So redefine fcntl() to be something
++** that always succeeds.  This means that locking does not occur under
++** DJGPP.  But its DOS - what did you expect?
++*/
++#ifdef __DJGPP__
++# define fcntl(A,B,C) 0
++#endif
++
++/*
++** Macros used to determine whether or not to use threads.  The
++** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for
++** Posix threads and SQLITE_W32_THREADS is defined if we are
++** synchronizing using Win32 threads.
++*/
++#if OS_UNIX && defined(THREADSAFE) && THREADSAFE
++# include <pthread.h>
++# define SQLITE_UNIX_THREADS 1
++#endif
++#if OS_WIN && defined(THREADSAFE) && THREADSAFE
++# define SQLITE_W32_THREADS 1
++#endif
++#if OS_MAC && defined(THREADSAFE) && THREADSAFE
++# include <Multiprocessing.h>
++# define SQLITE_MACOS_MULTITASKING 1
++#endif
++
++/*
++** Macros for performance tracing.  Normally turned off
++*/
++#if 0
++static int last_page = 0;
++__inline__ unsigned long long int hwtime(void){
++  unsigned long long int x;
++  __asm__("rdtsc\n\t"
++          "mov %%edx, %%ecx\n\t"
++          :"=A" (x));
++  return x;
++}
++static unsigned long long int g_start;
++static unsigned int elapse;
++#define TIMER_START       g_start=hwtime()
++#define TIMER_END         elapse=hwtime()-g_start
++#define SEEK(X)           last_page=(X)
++#define TRACE1(X)         fprintf(stderr,X)
++#define TRACE2(X,Y)       fprintf(stderr,X,Y)
++#define TRACE3(X,Y,Z)     fprintf(stderr,X,Y,Z)
++#define TRACE4(X,Y,Z,A)   fprintf(stderr,X,Y,Z,A)
++#define TRACE5(X,Y,Z,A,B) fprintf(stderr,X,Y,Z,A,B)
++#else
++#define TIMER_START
++#define TIMER_END
++#define SEEK(X)
++#define TRACE1(X)
++#define TRACE2(X,Y)
++#define TRACE3(X,Y,Z)
++#define TRACE4(X,Y,Z,A)
++#define TRACE5(X,Y,Z,A,B)
++#endif
++
++
++#if OS_UNIX
++/*
++** Here is the dirt on POSIX advisory locks:  ANSI STD 1003.1 (1996)
++** section 6.5.2.2 lines 483 through 490 specify that when a process
++** sets or clears a lock, that operation overrides any prior locks set
++** by the same process.  It does not explicitly say so, but this implies
++** that it overrides locks set by the same process using a different
++** file descriptor.  Consider this test case:
++**
++**       int fd1 = open("./file1", O_RDWR|O_CREAT, 0644);
++**       int fd2 = open("./file2", O_RDWR|O_CREAT, 0644);
++**
++** Suppose ./file1 and ./file2 are really the same file (because
++** one is a hard or symbolic link to the other) then if you set
++** an exclusive lock on fd1, then try to get an exclusive lock
++** on fd2, it works.  I would have expected the second lock to
++** fail since there was already a lock on the file due to fd1.
++** But not so.  Since both locks came from the same process, the
++** second overrides the first, even though they were on different
++** file descriptors opened on different file names.
++**
++** Bummer.  If you ask me, this is broken.  Badly broken.  It means
++** that we cannot use POSIX locks to synchronize file access among
++** competing threads of the same process.  POSIX locks will work fine
++** to synchronize access for threads in separate processes, but not
++** threads within the same process.
++**
++** To work around the problem, SQLite has to manage file locks internally
++** on its own.  Whenever a new database is opened, we have to find the
++** specific inode of the database file (the inode is determined by the
++** st_dev and st_ino fields of the stat structure that fstat() fills in)
++** and check for locks already existing on that inode.  When locks are
++** created or removed, we have to look at our own internal record of the
++** locks to see if another thread has previously set a lock on that same
++** inode.
++**
++** The OsFile structure for POSIX is no longer just an integer file
++** descriptor.  It is now a structure that holds the integer file
++** descriptor and a pointer to a structure that describes the internal
++** locks on the corresponding inode.  There is one locking structure
++** per inode, so if the same inode is opened twice, both OsFile structures
++** point to the same locking structure.  The locking structure keeps
++** a reference count (so we will know when to delete it) and a "cnt"
++** field that tells us its internal lock status.  cnt==0 means the
++** file is unlocked.  cnt==-1 means the file has an exclusive lock.
++** cnt>0 means there are cnt shared locks on the file.
++**
++** Any attempt to lock or unlock a file first checks the locking
++** structure.  The fcntl() system call is only invoked to set a 
++** POSIX lock if the internal lock structure transitions between
++** a locked and an unlocked state.
++**
++** 2004-Jan-11:
++** More recent discoveries about POSIX advisory locks.  (The more
++** I discover, the more I realize the a POSIX advisory locks are
++** an abomination.)
++**
++** If you close a file descriptor that points to a file that has locks,
++** all locks on that file that are owned by the current process are
++** released.  To work around this problem, each OsFile structure contains
++** a pointer to an openCnt structure.  There is one openCnt structure
++** per open inode, which means that multiple OsFiles can point to a single
++** openCnt.  When an attempt is made to close an OsFile, if there are
++** other OsFiles open on the same inode that are holding locks, the call
++** to close() the file descriptor is deferred until all of the locks clear.
++** The openCnt structure keeps a list of file descriptors that need to
++** be closed and that list is walked (and cleared) when the last lock
++** clears.
++**
++** First, under Linux threads, because each thread has a separate
++** process ID, lock operations in one thread do not override locks
++** to the same file in other threads.  Linux threads behave like
++** separate processes in this respect.  But, if you close a file
++** descriptor in linux threads, all locks are cleared, even locks
++** on other threads and even though the other threads have different
++** process IDs.  Linux threads is inconsistent in this respect.
++** (I'm beginning to think that linux threads is an abomination too.)
++** The consequence of this all is that the hash table for the lockInfo
++** structure has to include the process id as part of its key because
++** locks in different threads are treated as distinct.  But the 
++** openCnt structure should not include the process id in its
++** key because close() clears lock on all threads, not just the current
++** thread.  Were it not for this goofiness in linux threads, we could
++** combine the lockInfo and openCnt structures into a single structure.
++*/
++
++/*
++** An instance of the following structure serves as the key used
++** to locate a particular lockInfo structure given its inode.  Note
++** that we have to include the process ID as part of the key.  On some
++** threading implementations (ex: linux), each thread has a separate
++** process ID.
++*/
++struct lockKey {
++  dev_t dev;   /* Device number */
++  ino_t ino;   /* Inode number */
++  pid_t pid;   /* Process ID */
++};
++
++/*
++** An instance of the following structure is allocated for each open
++** inode on each thread with a different process ID.  (Threads have
++** different process IDs on linux, but not on most other unixes.)
++**
++** A single inode can have multiple file descriptors, so each OsFile
++** structure contains a pointer to an instance of this object and this
++** object keeps a count of the number of OsFiles pointing to it.
++*/
++struct lockInfo {
++  struct lockKey key;  /* The lookup key */
++  int cnt;             /* 0: unlocked.  -1: write lock.  1...: read lock. */
++  int nRef;            /* Number of pointers to this structure */
++};
++
++/*
++** An instance of the following structure serves as the key used
++** to locate a particular openCnt structure given its inode.  This
++** is the same as the lockKey except that the process ID is omitted.
++*/
++struct openKey {
++  dev_t dev;   /* Device number */
++  ino_t ino;   /* Inode number */
++};
++
++/*
++** An instance of the following structure is allocated for each open
++** inode.  This structure keeps track of the number of locks on that
++** inode.  If a close is attempted against an inode that is holding
++** locks, the close is deferred until all locks clear by adding the
++** file descriptor to be closed to the pending list.
++*/
++struct openCnt {
++  struct openKey key;   /* The lookup key */
++  int nRef;             /* Number of pointers to this structure */
++  int nLock;            /* Number of outstanding locks */
++  int nPending;         /* Number of pending close() operations */
++  int *aPending;        /* Malloced space holding fd's awaiting a close() */
++};
++
++/* 
++** These hash table maps inodes and process IDs into lockInfo and openCnt
++** structures.  Access to these hash tables must be protected by a mutex.
++*/
++static Hash lockHash = { SQLITE_HASH_BINARY, 0, 0, 0, 0, 0 };
++static Hash openHash = { SQLITE_HASH_BINARY, 0, 0, 0, 0, 0 };
++
++/*
++** Release a lockInfo structure previously allocated by findLockInfo().
++*/
++static void releaseLockInfo(struct lockInfo *pLock){
++  pLock->nRef--;
++  if( pLock->nRef==0 ){
++    sqliteHashInsert(&lockHash, &pLock->key, sizeof(pLock->key), 0);
++    sqliteFree(pLock);
++  }
++}
++
++/*
++** Release a openCnt structure previously allocated by findLockInfo().
++*/
++static void releaseOpenCnt(struct openCnt *pOpen){
++  pOpen->nRef--;
++  if( pOpen->nRef==0 ){
++    sqliteHashInsert(&openHash, &pOpen->key, sizeof(pOpen->key), 0);
++    sqliteFree(pOpen->aPending);
++    sqliteFree(pOpen);
++  }
++}
++
++/*
++** Given a file descriptor, locate lockInfo and openCnt structures that
++** describes that file descriptor.  Create a new ones if necessary.  The
++** return values might be unset if an error occurs.
++**
++** Return the number of errors.
++*/
++int findLockInfo(
++  int fd,                      /* The file descriptor used in the key */
++  struct lockInfo **ppLock,    /* Return the lockInfo structure here */
++  struct openCnt **ppOpen   /* Return the openCnt structure here */
++){
++  int rc;
++  struct lockKey key1;
++  struct openKey key2;
++  struct stat statbuf;
++  struct lockInfo *pLock;
++  struct openCnt *pOpen;
++  rc = fstat(fd, &statbuf);
++  if( rc!=0 ) return 1;
++  memset(&key1, 0, sizeof(key1));
++  key1.dev = statbuf.st_dev;
++  key1.ino = statbuf.st_ino;
++  key1.pid = getpid();
++  memset(&key2, 0, sizeof(key2));
++  key2.dev = statbuf.st_dev;
++  key2.ino = statbuf.st_ino;
++  pLock = (struct lockInfo*)sqliteHashFind(&lockHash, &key1, sizeof(key1));
++  if( pLock==0 ){
++    struct lockInfo *pOld;
++    pLock = sqliteMallocRaw( sizeof(*pLock) );
++    if( pLock==0 ) return 1;
++    pLock->key = key1;
++    pLock->nRef = 1;
++    pLock->cnt = 0;
++    pOld = sqliteHashInsert(&lockHash, &pLock->key, sizeof(key1), pLock);
++    if( pOld!=0 ){
++      assert( pOld==pLock );
++      sqliteFree(pLock);
++      return 1;
++    }
++  }else{
++    pLock->nRef++;
++  }
++  *ppLock = pLock;
++  pOpen = (struct openCnt*)sqliteHashFind(&openHash, &key2, sizeof(key2));
++  if( pOpen==0 ){
++    struct openCnt *pOld;
++    pOpen = sqliteMallocRaw( sizeof(*pOpen) );
++    if( pOpen==0 ){
++      releaseLockInfo(pLock);
++      return 1;
++    }
++    pOpen->key = key2;
++    pOpen->nRef = 1;
++    pOpen->nLock = 0;
++    pOpen->nPending = 0;
++    pOpen->aPending = 0;
++    pOld = sqliteHashInsert(&openHash, &pOpen->key, sizeof(key2), pOpen);
++    if( pOld!=0 ){
++      assert( pOld==pOpen );
++      sqliteFree(pOpen);
++      releaseLockInfo(pLock);
++      return 1;
++    }
++  }else{
++    pOpen->nRef++;
++  }
++  *ppOpen = pOpen;
++  return 0;
++}
++
++#endif  /** POSIX advisory lock work-around **/
++
++/*
++** If we compile with the SQLITE_TEST macro set, then the following block
++** of code will give us the ability to simulate a disk I/O error.  This
++** is used for testing the I/O recovery logic.
++*/
++#ifdef SQLITE_TEST
++int sqlite_io_error_pending = 0;
++#define SimulateIOError(A)  \
++   if( sqlite_io_error_pending ) \
++     if( sqlite_io_error_pending-- == 1 ){ local_ioerr(); return A; }
++static void local_ioerr(){
++  sqlite_io_error_pending = 0;  /* Really just a place to set a breakpoint */
++}
++#else
++#define SimulateIOError(A)
++#endif
++
++/*
++** When testing, keep a count of the number of open files.
++*/
++#ifdef SQLITE_TEST
++int sqlite_open_file_count = 0;
++#define OpenCounter(X)  sqlite_open_file_count+=(X)
++#else
++#define OpenCounter(X)
++#endif
++
++
++/*
++** Delete the named file
++*/
++int sqliteOsDelete(const char *zFilename){
++#if OS_UNIX
++  unlink(zFilename);
++#endif
++#if OS_WIN
++  DeleteFile(zFilename);
++#endif
++#if OS_MAC
++  unlink(zFilename);
++#endif
++  return SQLITE_OK;
++}
++
++/*
++** Return TRUE if the named file exists.
++*/
++int sqliteOsFileExists(const char *zFilename){
++#if OS_UNIX
++  return access(zFilename, 0)==0;
++#endif
++#if OS_WIN
++  return GetFileAttributes(zFilename) != 0xffffffff;
++#endif
++#if OS_MAC
++  return access(zFilename, 0)==0;
++#endif
++}
++
++
++#if 0 /* NOT USED */
++/*
++** Change the name of an existing file.
++*/
++int sqliteOsFileRename(const char *zOldName, const char *zNewName){
++#if OS_UNIX
++  if( link(zOldName, zNewName) ){
++    return SQLITE_ERROR;
++  }
++  unlink(zOldName);
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  if( !MoveFile(zOldName, zNewName) ){
++    return SQLITE_ERROR;
++  }
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  /**** FIX ME ***/
++  return SQLITE_ERROR;
++#endif
++}
++#endif /* NOT USED */
++
++/*
++** Attempt to open a file for both reading and writing.  If that
++** fails, try opening it read-only.  If the file does not exist,
++** try to create it.
++**
++** On success, a handle for the open file is written to *id
++** and *pReadonly is set to 0 if the file was opened for reading and
++** writing or 1 if the file was opened read-only.  The function returns
++** SQLITE_OK.
++**
++** On failure, the function returns SQLITE_CANTOPEN and leaves
++** *id and *pReadonly unchanged.
++*/
++int sqliteOsOpenReadWrite(
++  const char *zFilename,
++  OsFile *id,
++  int *pReadonly
++){
++#if OS_UNIX
++  int rc;
++  id->dirfd = -1;
++  id->fd = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644);
++  if( id->fd<0 ){
++#ifdef EISDIR
++    if( errno==EISDIR ){
++      return SQLITE_CANTOPEN;
++    }
++#endif
++    id->fd = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
++    if( id->fd<0 ){
++      return SQLITE_CANTOPEN; 
++    }
++    *pReadonly = 1;
++  }else{
++    *pReadonly = 0;
++  }
++  sqliteOsEnterMutex();
++  rc = findLockInfo(id->fd, &id->pLock, &id->pOpen);
++  sqliteOsLeaveMutex();
++  if( rc ){
++    close(id->fd);
++    return SQLITE_NOMEM;
++  }
++  id->locked = 0;
++  TRACE3("OPEN    %-3d %s\n", id->fd, zFilename);
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  HANDLE h = CreateFile(zFilename,
++     GENERIC_READ | GENERIC_WRITE,
++     FILE_SHARE_READ | FILE_SHARE_WRITE,
++     NULL,
++     OPEN_ALWAYS,
++     FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
++     NULL
++  );
++  if( h==INVALID_HANDLE_VALUE ){
++    h = CreateFile(zFilename,
++       GENERIC_READ,
++       FILE_SHARE_READ,
++       NULL,
++       OPEN_ALWAYS,
++       FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
++       NULL
++    );
++    if( h==INVALID_HANDLE_VALUE ){
++      return SQLITE_CANTOPEN;
++    }
++    *pReadonly = 1;
++  }else{
++    *pReadonly = 0;
++  }
++  id->h = h;
++  id->locked = 0;
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  FSSpec fsSpec;
++# ifdef _LARGE_FILE
++  HFSUniStr255 dfName;
++  FSRef fsRef;
++  if( __path2fss(zFilename, &fsSpec) != noErr ){
++    if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr )
++      return SQLITE_CANTOPEN;
++  }
++  if( FSpMakeFSRef(&fsSpec, &fsRef) != noErr )
++    return SQLITE_CANTOPEN;
++  FSGetDataForkName(&dfName);
++  if( FSOpenFork(&fsRef, dfName.length, dfName.unicode,
++                 fsRdWrShPerm, &(id->refNum)) != noErr ){
++    if( FSOpenFork(&fsRef, dfName.length, dfName.unicode,
++                   fsRdWrPerm, &(id->refNum)) != noErr ){
++      if (FSOpenFork(&fsRef, dfName.length, dfName.unicode,
++                   fsRdPerm, &(id->refNum)) != noErr )
++        return SQLITE_CANTOPEN;
++      else
++        *pReadonly = 1;
++    } else
++      *pReadonly = 0;
++  } else
++    *pReadonly = 0;
++# else
++  __path2fss(zFilename, &fsSpec);
++  if( !sqliteOsFileExists(zFilename) ){
++    if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr )
++      return SQLITE_CANTOPEN;
++  }
++  if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrShPerm, &(id->refNum)) != noErr ){
++    if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrPerm, &(id->refNum)) != noErr ){
++      if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdPerm, &(id->refNum)) != noErr )
++        return SQLITE_CANTOPEN;
++      else
++        *pReadonly = 1;
++    } else
++      *pReadonly = 0;
++  } else
++    *pReadonly = 0;
++# endif
++  if( HOpenRF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrShPerm, &(id->refNumRF)) != noErr){
++    id->refNumRF = -1;
++  }
++  id->locked = 0;
++  id->delOnClose = 0;
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++}
++
++
++/*
++** Attempt to open a new file for exclusive access by this process.
++** The file will be opened for both reading and writing.  To avoid
++** a potential security problem, we do not allow the file to have
++** previously existed.  Nor do we allow the file to be a symbolic
++** link.
++**
++** If delFlag is true, then make arrangements to automatically delete
++** the file when it is closed.
++**
++** On success, write the file handle into *id and return SQLITE_OK.
++**
++** On failure, return SQLITE_CANTOPEN.
++*/
++int sqliteOsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){
++#if OS_UNIX
++  int rc;
++  if( access(zFilename, 0)==0 ){
++    return SQLITE_CANTOPEN;
++  }
++  id->dirfd = -1;
++  id->fd = open(zFilename,
++                O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_LARGEFILE|O_BINARY, 0600);
++  if( id->fd<0 ){
++    return SQLITE_CANTOPEN;
++  }
++  sqliteOsEnterMutex();
++  rc = findLockInfo(id->fd, &id->pLock, &id->pOpen);
++  sqliteOsLeaveMutex();
++  if( rc ){
++    close(id->fd);
++    unlink(zFilename);
++    return SQLITE_NOMEM;
++  }
++  id->locked = 0;
++  if( delFlag ){
++    unlink(zFilename);
++  }
++  TRACE3("OPEN-EX %-3d %s\n", id->fd, zFilename);
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  HANDLE h;
++  int fileflags;
++  if( delFlag ){
++    fileflags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_RANDOM_ACCESS 
++                     | FILE_FLAG_DELETE_ON_CLOSE;
++  }else{
++    fileflags = FILE_FLAG_RANDOM_ACCESS;
++  }
++  h = CreateFile(zFilename,
++     GENERIC_READ | GENERIC_WRITE,
++     0,
++     NULL,
++     CREATE_ALWAYS,
++     fileflags,
++     NULL
++  );
++  if( h==INVALID_HANDLE_VALUE ){
++    return SQLITE_CANTOPEN;
++  }
++  id->h = h;
++  id->locked = 0;
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  FSSpec fsSpec;
++# ifdef _LARGE_FILE
++  HFSUniStr255 dfName;
++  FSRef fsRef;
++  __path2fss(zFilename, &fsSpec);
++  if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr )
++    return SQLITE_CANTOPEN;
++  if( FSpMakeFSRef(&fsSpec, &fsRef) != noErr )
++    return SQLITE_CANTOPEN;
++  FSGetDataForkName(&dfName);
++  if( FSOpenFork(&fsRef, dfName.length, dfName.unicode,
++                 fsRdWrPerm, &(id->refNum)) != noErr )
++    return SQLITE_CANTOPEN;
++# else
++  __path2fss(zFilename, &fsSpec);
++  if( HCreate(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, 'SQLI', cDocumentFile) != noErr )
++    return SQLITE_CANTOPEN;
++  if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrPerm, &(id->refNum)) != noErr )
++    return SQLITE_CANTOPEN;
++# endif
++  id->refNumRF = -1;
++  id->locked = 0;
++  id->delOnClose = delFlag;
++  if (delFlag)
++    id->pathToDel = sqliteOsFullPathname(zFilename);
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++}
++
++/*
++** Attempt to open a new file for read-only access.
++**
++** On success, write the file handle into *id and return SQLITE_OK.
++**
++** On failure, return SQLITE_CANTOPEN.
++*/
++int sqliteOsOpenReadOnly(const char *zFilename, OsFile *id){
++#if OS_UNIX
++  int rc;
++  id->dirfd = -1;
++  id->fd = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
++  if( id->fd<0 ){
++    return SQLITE_CANTOPEN;
++  }
++  sqliteOsEnterMutex();
++  rc = findLockInfo(id->fd, &id->pLock, &id->pOpen);
++  sqliteOsLeaveMutex();
++  if( rc ){
++    close(id->fd);
++    return SQLITE_NOMEM;
++  }
++  id->locked = 0;
++  TRACE3("OPEN-RO %-3d %s\n", id->fd, zFilename);
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  HANDLE h = CreateFile(zFilename,
++     GENERIC_READ,
++     0,
++     NULL,
++     OPEN_EXISTING,
++     FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
++     NULL
++  );
++  if( h==INVALID_HANDLE_VALUE ){
++    return SQLITE_CANTOPEN;
++  }
++  id->h = h;
++  id->locked = 0;
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  FSSpec fsSpec;
++# ifdef _LARGE_FILE
++  HFSUniStr255 dfName;
++  FSRef fsRef;
++  if( __path2fss(zFilename, &fsSpec) != noErr )
++    return SQLITE_CANTOPEN;
++  if( FSpMakeFSRef(&fsSpec, &fsRef) != noErr )
++    return SQLITE_CANTOPEN;
++  FSGetDataForkName(&dfName);
++  if( FSOpenFork(&fsRef, dfName.length, dfName.unicode,
++                 fsRdPerm, &(id->refNum)) != noErr )
++    return SQLITE_CANTOPEN;
++# else
++  __path2fss(zFilename, &fsSpec);
++  if( HOpenDF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdPerm, &(id->refNum)) != noErr )
++    return SQLITE_CANTOPEN;
++# endif
++  if( HOpenRF(fsSpec.vRefNum, fsSpec.parID, fsSpec.name, fsRdWrShPerm, &(id->refNumRF)) != noErr){
++    id->refNumRF = -1;
++  }
++  id->locked = 0;
++  id->delOnClose = 0;
++  OpenCounter(+1);
++  return SQLITE_OK;
++#endif
++}
++
++/*
++** Attempt to open a file descriptor for the directory that contains a
++** file.  This file descriptor can be used to fsync() the directory
++** in order to make sure the creation of a new file is actually written
++** to disk.
++**
++** This routine is only meaningful for Unix.  It is a no-op under
++** windows since windows does not support hard links.
++**
++** On success, a handle for a previously open file is at *id is
++** updated with the new directory file descriptor and SQLITE_OK is
++** returned.
++**
++** On failure, the function returns SQLITE_CANTOPEN and leaves
++** *id unchanged.
++*/
++int sqliteOsOpenDirectory(
++  const char *zDirname,
++  OsFile *id
++){
++#if OS_UNIX
++  if( id->fd<0 ){
++    /* Do not open the directory if the corresponding file is not already
++    ** open. */
++    return SQLITE_CANTOPEN;
++  }
++  assert( id->dirfd<0 );
++  id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0644);
++  if( id->dirfd<0 ){
++    return SQLITE_CANTOPEN; 
++  }
++  TRACE3("OPENDIR %-3d %s\n", id->dirfd, zDirname);
++#endif
++  return SQLITE_OK;
++}
++
++/*
++** If the following global variable points to a string which is the
++** name of a directory, then that directory will be used to store
++** temporary files.
++*/
++const char *sqlite_temp_directory = 0;
++
++/*
++** Create a temporary file name in zBuf.  zBuf must be big enough to
++** hold at least SQLITE_TEMPNAME_SIZE characters.
++*/
++int sqliteOsTempFileName(char *zBuf){
++#if OS_UNIX
++  static const char *azDirs[] = {
++     0,
++     "/var/tmp",
++     "/usr/tmp",
++     "/tmp",
++     ".",
++  };
++  static unsigned char zChars[] =
++    "abcdefghijklmnopqrstuvwxyz"
++    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
++    "0123456789";
++  int i, j;
++  struct stat buf;
++  const char *zDir = ".";
++  azDirs[0] = sqlite_temp_directory;
++  for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
++    if( azDirs[i]==0 ) continue;
++    if( stat(azDirs[i], &buf) ) continue;
++    if( !S_ISDIR(buf.st_mode) ) continue;
++    if( access(azDirs[i], 07) ) continue;
++    zDir = azDirs[i];
++    break;
++  }
++  do{
++    sprintf(zBuf, "%s/"TEMP_FILE_PREFIX, zDir);
++    j = strlen(zBuf);
++    sqliteRandomness(15, &zBuf[j]);
++    for(i=0; i<15; i++, j++){
++      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
++    }
++    zBuf[j] = 0;
++  }while( access(zBuf,0)==0 );
++#endif
++#if OS_WIN
++  static char zChars[] =
++    "abcdefghijklmnopqrstuvwxyz"
++    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
++    "0123456789";
++  int i, j;
++  const char *zDir;
++  char zTempPath[SQLITE_TEMPNAME_SIZE];
++  if( sqlite_temp_directory==0 ){
++    GetTempPath(SQLITE_TEMPNAME_SIZE-30, zTempPath);
++    for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
++    zTempPath[i] = 0;
++    zDir = zTempPath;
++  }else{
++    zDir = sqlite_temp_directory;
++  }
++  for(;;){
++    sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zDir);
++    j = strlen(zBuf);
++    sqliteRandomness(15, &zBuf[j]);
++    for(i=0; i<15; i++, j++){
++      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
++    }
++    zBuf[j] = 0;
++    if( !sqliteOsFileExists(zBuf) ) break;
++  }
++#endif
++#if OS_MAC
++  static char zChars[] =
++    "abcdefghijklmnopqrstuvwxyz"
++    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
++    "0123456789";
++  int i, j;
++  char *zDir;
++  char zTempPath[SQLITE_TEMPNAME_SIZE];
++  char zdirName[32];
++  CInfoPBRec infoRec;
++  Str31 dirName;
++  memset(&infoRec, 0, sizeof(infoRec));
++  memset(zTempPath, 0, SQLITE_TEMPNAME_SIZE);
++  if( sqlite_temp_directory!=0 ){
++    zDir = sqlite_temp_directory;
++  }else if( FindFolder(kOnSystemDisk, kTemporaryFolderType,  kCreateFolder,
++       &(infoRec.dirInfo.ioVRefNum), &(infoRec.dirInfo.ioDrParID)) == noErr ){
++    infoRec.dirInfo.ioNamePtr = dirName;
++    do{
++      infoRec.dirInfo.ioFDirIndex = -1;
++      infoRec.dirInfo.ioDrDirID = infoRec.dirInfo.ioDrParID;
++      if( PBGetCatInfoSync(&infoRec) == noErr ){
++        CopyPascalStringToC(dirName, zdirName);
++        i = strlen(zdirName);
++        memmove(&(zTempPath[i+1]), zTempPath, strlen(zTempPath));
++        strcpy(zTempPath, zdirName);
++        zTempPath[i] = ':';
++      }else{
++        *zTempPath = 0;
++        break;
++      }
++    } while( infoRec.dirInfo.ioDrDirID != fsRtDirID );
++    zDir = zTempPath;
++  }
++  if( zDir[0]==0 ){
++    getcwd(zTempPath, SQLITE_TEMPNAME_SIZE-24);
++    zDir = zTempPath;
++  }
++  for(;;){
++    sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zDir);
++    j = strlen(zBuf);
++    sqliteRandomness(15, &zBuf[j]);
++    for(i=0; i<15; i++, j++){
++      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
++    }
++    zBuf[j] = 0;
++    if( !sqliteOsFileExists(zBuf) ) break;
++  }
++#endif
++  return SQLITE_OK; 
++}
++
++/*
++** Close a file.
++*/
++int sqliteOsClose(OsFile *id){
++#if OS_UNIX
++  sqliteOsUnlock(id);
++  if( id->dirfd>=0 ) close(id->dirfd);
++  id->dirfd = -1;
++  sqliteOsEnterMutex();
++  if( id->pOpen->nLock ){
++    /* If there are outstanding locks, do not actually close the file just
++    ** yet because that would clear those locks.  Instead, add the file
++    ** descriptor to pOpen->aPending.  It will be automatically closed when
++    ** the last lock is cleared.
++    */
++    int *aNew;
++    struct openCnt *pOpen = id->pOpen;
++    pOpen->nPending++;
++    aNew = sqliteRealloc( pOpen->aPending, pOpen->nPending*sizeof(int) );
++    if( aNew==0 ){
++      /* If a malloc fails, just leak the file descriptor */
++    }else{
++      pOpen->aPending = aNew;
++      pOpen->aPending[pOpen->nPending-1] = id->fd;
++    }
++  }else{
++    /* There are no outstanding locks so we can close the file immediately */
++    close(id->fd);
++  }
++  releaseLockInfo(id->pLock);
++  releaseOpenCnt(id->pOpen);
++  sqliteOsLeaveMutex();
++  TRACE2("CLOSE   %-3d\n", id->fd);
++  OpenCounter(-1);
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  CloseHandle(id->h);
++  OpenCounter(-1);
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  if( id->refNumRF!=-1 )
++    FSClose(id->refNumRF);
++# ifdef _LARGE_FILE
++  FSCloseFork(id->refNum);
++# else
++  FSClose(id->refNum);
++# endif
++  if( id->delOnClose ){
++    unlink(id->pathToDel);
++    sqliteFree(id->pathToDel);
++  }
++  OpenCounter(-1);
++  return SQLITE_OK;
++#endif
++}
++
++/*
++** Read data from a file into a buffer.  Return SQLITE_OK if all
++** bytes were read successfully and SQLITE_IOERR if anything goes
++** wrong.
++*/
++int sqliteOsRead(OsFile *id, void *pBuf, int amt){
++#if OS_UNIX
++  int got;
++  SimulateIOError(SQLITE_IOERR);
++  TIMER_START;
++  got = read(id->fd, pBuf, amt);
++  TIMER_END;
++  TRACE4("READ    %-3d %7d %d\n", id->fd, last_page, elapse);
++  SEEK(0);
++  /* if( got<0 ) got = 0; */
++  if( got==amt ){
++    return SQLITE_OK;
++  }else{
++    return SQLITE_IOERR;
++  }
++#endif
++#if OS_WIN
++  DWORD got;
++  SimulateIOError(SQLITE_IOERR);
++  TRACE2("READ %d\n", last_page);
++  if( !ReadFile(id->h, pBuf, amt, &got, 0) ){
++    got = 0;
++  }
++  if( got==(DWORD)amt ){
++    return SQLITE_OK;
++  }else{
++    return SQLITE_IOERR;
++  }
++#endif
++#if OS_MAC
++  int got;
++  SimulateIOError(SQLITE_IOERR);
++  TRACE2("READ %d\n", last_page);
++# ifdef _LARGE_FILE
++  FSReadFork(id->refNum, fsAtMark, 0, (ByteCount)amt, pBuf, (ByteCount*)&got);
++# else
++  got = amt;
++  FSRead(id->refNum, &got, pBuf);
++# endif
++  if( got==amt ){
++    return SQLITE_OK;
++  }else{
++    return SQLITE_IOERR;
++  }
++#endif
++}
++
++/*
++** Write data from a buffer into a file.  Return SQLITE_OK on success
++** or some other error code on failure.
++*/
++int sqliteOsWrite(OsFile *id, const void *pBuf, int amt){
++#if OS_UNIX
++  int wrote = 0;
++  SimulateIOError(SQLITE_IOERR);
++  TIMER_START;
++  while( amt>0 && (wrote = write(id->fd, pBuf, amt))>0 ){
++    amt -= wrote;
++    pBuf = &((char*)pBuf)[wrote];
++  }
++  TIMER_END;
++  TRACE4("WRITE   %-3d %7d %d\n", id->fd, last_page, elapse);
++  SEEK(0);
++  if( amt>0 ){
++    return SQLITE_FULL;
++  }
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  int rc;
++  DWORD wrote;
++  SimulateIOError(SQLITE_IOERR);
++  TRACE2("WRITE %d\n", last_page);
++  while( amt>0 && (rc = WriteFile(id->h, pBuf, amt, &wrote, 0))!=0 && wrote>0 ){
++    amt -= wrote;
++    pBuf = &((char*)pBuf)[wrote];
++  }
++  if( !rc || amt>(int)wrote ){
++    return SQLITE_FULL;
++  }
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  OSErr oserr;
++  int wrote = 0;
++  SimulateIOError(SQLITE_IOERR);
++  TRACE2("WRITE %d\n", last_page);
++  while( amt>0 ){
++# ifdef _LARGE_FILE
++    oserr = FSWriteFork(id->refNum, fsAtMark, 0,
++                        (ByteCount)amt, pBuf, (ByteCount*)&wrote);
++# else
++    wrote = amt;
++    oserr = FSWrite(id->refNum, &wrote, pBuf);
++# endif
++    if( wrote == 0 || oserr != noErr)
++      break;
++    amt -= wrote;
++    pBuf = &((char*)pBuf)[wrote];
++  }
++  if( oserr != noErr || amt>wrote ){
++    return SQLITE_FULL;
++  }
++  return SQLITE_OK;
++#endif
++}
++
++/*
++** Move the read/write pointer in a file.
++*/
++int sqliteOsSeek(OsFile *id, off_t offset){
++  SEEK(offset/1024 + 1);
++#if OS_UNIX
++  lseek(id->fd, offset, SEEK_SET);
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  {
++    LONG upperBits = offset>>32;
++    LONG lowerBits = offset & 0xffffffff;
++    DWORD rc;
++    rc = SetFilePointer(id->h, lowerBits, &upperBits, FILE_BEGIN);
++    /* TRACE3("SEEK rc=0x%x upper=0x%x\n", rc, upperBits); */
++  }
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++  {
++    off_t curSize;
++    if( sqliteOsFileSize(id, &curSize) != SQLITE_OK ){
++      return SQLITE_IOERR;
++    }
++    if( offset >= curSize ){
++      if( sqliteOsTruncate(id, offset+1) != SQLITE_OK ){
++        return SQLITE_IOERR;
++      }
++    }
++# ifdef _LARGE_FILE
++    if( FSSetForkPosition(id->refNum, fsFromStart, offset) != noErr ){
++# else
++    if( SetFPos(id->refNum, fsFromStart, offset) != noErr ){
++# endif
++      return SQLITE_IOERR;
++    }else{
++      return SQLITE_OK;
++    }
++  }
++#endif
++}
++
++#ifdef SQLITE_NOSYNC
++# define fsync(X) 0
++#endif
++
++/*
++** Make sure all writes to a particular file are committed to disk.
++**
++** Under Unix, also make sure that the directory entry for the file
++** has been created by fsync-ing the directory that contains the file.
++** If we do not do this and we encounter a power failure, the directory
++** entry for the journal might not exist after we reboot.  The next
++** SQLite to access the file will not know that the journal exists (because
++** the directory entry for the journal was never created) and the transaction
++** will not roll back - possibly leading to database corruption.
++*/
++int sqliteOsSync(OsFile *id){
++#if OS_UNIX
++  SimulateIOError(SQLITE_IOERR);
++  TRACE2("SYNC    %-3d\n", id->fd);
++  if( fsync(id->fd) ){
++    return SQLITE_IOERR;
++  }else{
++    if( id->dirfd>=0 ){
++      TRACE2("DIRSYNC %-3d\n", id->dirfd);
++      fsync(id->dirfd);
++      close(id->dirfd);  /* Only need to sync once, so close the directory */
++      id->dirfd = -1;    /* when we are done. */
++    }
++    return SQLITE_OK;
++  }
++#endif
++#if OS_WIN
++  if( FlushFileBuffers(id->h) ){
++    return SQLITE_OK;
++  }else{
++    return SQLITE_IOERR;
++  }
++#endif
++#if OS_MAC
++# ifdef _LARGE_FILE
++  if( FSFlushFork(id->refNum) != noErr ){
++# else
++  ParamBlockRec params;
++  memset(&params, 0, sizeof(ParamBlockRec));
++  params.ioParam.ioRefNum = id->refNum;
++  if( PBFlushFileSync(&params) != noErr ){
++# endif
++    return SQLITE_IOERR;
++  }else{
++    return SQLITE_OK;
++  }
++#endif
++}
++
++/*
++** Truncate an open file to a specified size
++*/
++int sqliteOsTruncate(OsFile *id, off_t nByte){
++  SimulateIOError(SQLITE_IOERR);
++#if OS_UNIX
++  return ftruncate(id->fd, nByte)==0 ? SQLITE_OK : SQLITE_IOERR;
++#endif
++#if OS_WIN
++  {
++    LONG upperBits = nByte>>32;
++    SetFilePointer(id->h, nByte, &upperBits, FILE_BEGIN);
++    SetEndOfFile(id->h);
++  }
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++# ifdef _LARGE_FILE
++  if( FSSetForkSize(id->refNum, fsFromStart, nByte) != noErr){
++# else
++  if( SetEOF(id->refNum, nByte) != noErr ){
++# endif
++    return SQLITE_IOERR;
++  }else{
++    return SQLITE_OK;
++  }
++#endif
++}
++
++/*
++** Determine the current size of a file in bytes
++*/
++int sqliteOsFileSize(OsFile *id, off_t *pSize){
++#if OS_UNIX
++  struct stat buf;
++  SimulateIOError(SQLITE_IOERR);
++  if( fstat(id->fd, &buf)!=0 ){
++    return SQLITE_IOERR;
++  }
++  *pSize = buf.st_size;
++  return SQLITE_OK;
++#endif
++#if OS_WIN
++  DWORD upperBits, lowerBits;
++  SimulateIOError(SQLITE_IOERR);
++  lowerBits = GetFileSize(id->h, &upperBits);
++  *pSize = (((off_t)upperBits)<<32) + lowerBits;
++  return SQLITE_OK;
++#endif
++#if OS_MAC
++# ifdef _LARGE_FILE
++  if( FSGetForkSize(id->refNum, pSize) != noErr){
++# else
++  if( GetEOF(id->refNum, pSize) != noErr ){
++# endif
++    return SQLITE_IOERR;
++  }else{
++    return SQLITE_OK;
++  }
++#endif
++}
++
++#if OS_WIN
++/*
++** Return true (non-zero) if we are running under WinNT, Win2K or WinXP.
++** Return false (zero) for Win95, Win98, or WinME.
++**
++** Here is an interesting observation:  Win95, Win98, and WinME lack
++** the LockFileEx() API.  But we can still statically link against that
++** API as long as we don't call it win running Win95/98/ME.  A call to
++** this routine is used to determine if the host is Win95/98/ME or
++** WinNT/2K/XP so that we will know whether or not we can safely call
++** the LockFileEx() API.
++*/
++int isNT(void){
++  static int osType = 0;   /* 0=unknown 1=win95 2=winNT */
++  if( osType==0 ){
++    OSVERSIONINFO sInfo;
++    sInfo.dwOSVersionInfoSize = sizeof(sInfo);
++    GetVersionEx(&sInfo);
++    osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
++  }
++  return osType==2;
++}
++#endif
++
++/*
++** Windows file locking notes:  [similar issues apply to MacOS]
++**
++** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because
++** those functions are not available.  So we use only LockFile() and
++** UnlockFile().
++**
++** LockFile() prevents not just writing but also reading by other processes.
++** (This is a design error on the part of Windows, but there is nothing
++** we can do about that.)  So the region used for locking is at the
++** end of the file where it is unlikely to ever interfere with an
++** actual read attempt.
++**
++** A database read lock is obtained by locking a single randomly-chosen 
++** byte out of a specific range of bytes. The lock byte is obtained at 
++** random so two separate readers can probably access the file at the 
++** same time, unless they are unlucky and choose the same lock byte.
++** A database write lock is obtained by locking all bytes in the range.
++** There can only be one writer.
++**
++** A lock is obtained on the first byte of the lock range before acquiring
++** either a read lock or a write lock.  This prevents two processes from
++** attempting to get a lock at a same time.  The semantics of 
++** sqliteOsReadLock() require that if there is already a write lock, that
++** lock is converted into a read lock atomically.  The lock on the first
++** byte allows us to drop the old write lock and get the read lock without
++** another process jumping into the middle and messing us up.  The same
++** argument applies to sqliteOsWriteLock().
++**
++** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available,
++** which means we can use reader/writer locks.  When reader writer locks
++** are used, the lock is placed on the same range of bytes that is used
++** for probabilistic locking in Win95/98/ME.  Hence, the locking scheme
++** will support two or more Win95 readers or two or more WinNT readers.
++** But a single Win95 reader will lock out all WinNT readers and a single
++** WinNT reader will lock out all other Win95 readers.
++**
++** Note: On MacOS we use the resource fork for locking.
++**
++** The following #defines specify the range of bytes used for locking.
++** N_LOCKBYTE is the number of bytes available for doing the locking.
++** The first byte used to hold the lock while the lock is changing does
++** not count toward this number.  FIRST_LOCKBYTE is the address of
++** the first byte in the range of bytes used for locking.
++*/
++#define N_LOCKBYTE       10239
++#if OS_MAC
++# define FIRST_LOCKBYTE   (0x000fffff - N_LOCKBYTE)
++#else
++# define FIRST_LOCKBYTE   (0xffffffff - N_LOCKBYTE)
++#endif
++
++/*
++** Change the status of the lock on the file "id" to be a readlock.
++** If the file was write locked, then this reduces the lock to a read.
++** If the file was read locked, then this acquires a new read lock.
++**
++** Return SQLITE_OK on success and SQLITE_BUSY on failure.  If this
++** library was compiled with large file support (LFS) but LFS is not
++** available on the host, then an SQLITE_NOLFS is returned.
++*/
++int sqliteOsReadLock(OsFile *id){
++#if OS_UNIX
++  int rc;
++  sqliteOsEnterMutex();
++  if( id->pLock->cnt>0 ){
++    if( !id->locked ){
++      id->pLock->cnt++;
++      id->locked = 1;
++      id->pOpen->nLock++;
++    }
++    rc = SQLITE_OK;
++  }else if( id->locked || id->pLock->cnt==0 ){
++    struct flock lock;
++    int s;
++    lock.l_type = F_RDLCK;
++    lock.l_whence = SEEK_SET;
++    lock.l_start = lock.l_len = 0L;
++    s = fcntl(id->fd, F_SETLK, &lock);
++    if( s!=0 ){
++      rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
++    }else{
++      rc = SQLITE_OK;
++      if( !id->locked ){
++        id->pOpen->nLock++;
++        id->locked = 1;
++      }
++      id->pLock->cnt = 1;
++    }
++  }else{
++    rc = SQLITE_BUSY;
++  }
++  sqliteOsLeaveMutex();
++  return rc;
++#endif
++#if OS_WIN
++  int rc;
++  if( id->locked>0 ){
++    rc = SQLITE_OK;
++  }else{
++    int lk;
++    int res;
++    int cnt = 100;
++    sqliteRandomness(sizeof(lk), &lk);
++    lk = (lk & 0x7fffffff)%N_LOCKBYTE + 1;
++    while( cnt-->0 && (res = LockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0))==0 ){
++      Sleep(1);
++    }
++    if( res ){
++      UnlockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0);
++      if( isNT() ){
++        OVERLAPPED ovlp;
++        ovlp.Offset = FIRST_LOCKBYTE+1;
++        ovlp.OffsetHigh = 0;
++        ovlp.hEvent = 0;
++        res = LockFileEx(id->h, LOCKFILE_FAIL_IMMEDIATELY, 
++                          0, N_LOCKBYTE, 0, &ovlp);
++      }else{
++        res = LockFile(id->h, FIRST_LOCKBYTE+lk, 0, 1, 0);
++      }
++      UnlockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0);
++    }
++    if( res ){
++      id->locked = lk;
++      rc = SQLITE_OK;
++    }else{
++      rc = SQLITE_BUSY;
++    }
++  }
++  return rc;
++#endif
++#if OS_MAC
++  int rc;
++  if( id->locked>0 || id->refNumRF == -1 ){
++    rc = SQLITE_OK;
++  }else{
++    int lk;
++    OSErr res;
++    int cnt = 5;
++    ParamBlockRec params;
++    sqliteRandomness(sizeof(lk), &lk);
++    lk = (lk & 0x7fffffff)%N_LOCKBYTE + 1;
++    memset(&params, 0, sizeof(params));
++    params.ioParam.ioRefNum = id->refNumRF;
++    params.ioParam.ioPosMode = fsFromStart;
++    params.ioParam.ioPosOffset = FIRST_LOCKBYTE;
++    params.ioParam.ioReqCount = 1;
++    while( cnt-->0 && (res = PBLockRangeSync(&params))!=noErr ){
++      UInt32 finalTicks;
++      Delay(1, &finalTicks); /* 1/60 sec */
++    }
++    if( res == noErr ){
++      params.ioParam.ioPosOffset = FIRST_LOCKBYTE+1;
++      params.ioParam.ioReqCount = N_LOCKBYTE;
++      PBUnlockRangeSync(&params);
++      params.ioParam.ioPosOffset = FIRST_LOCKBYTE+lk;
++      params.ioParam.ioReqCount = 1;
++      res = PBLockRangeSync(&params);
++      params.ioParam.ioPosOffset = FIRST_LOCKBYTE;
++      params.ioParam.ioReqCount = 1;
++      PBUnlockRangeSync(&params);
++    }
++    if( res == noErr ){
++      id->locked = lk;
++      rc = SQLITE_OK;
++    }else{
++      rc = SQLITE_BUSY;
++    }
++  }
++  return rc;
++#endif
++}
++
++/*
++** Change the lock status to be an exclusive or write lock.  Return
++** SQLITE_OK on success and SQLITE_BUSY on a failure.  If this
++** library was compiled with large file support (LFS) but LFS is not
++** available on the host, then an SQLITE_NOLFS is returned.
++*/
++int sqliteOsWriteLock(OsFile *id){
++#if OS_UNIX
++  int rc;
++  sqliteOsEnterMutex();
++  if( id->pLock->cnt==0 || (id->pLock->cnt==1 && id->locked==1) ){
++    struct flock lock;
++    int s;
++    lock.l_type = F_WRLCK;
++    lock.l_whence = SEEK_SET;
++    lock.l_start = lock.l_len = 0L;
++    s = fcntl(id->fd, F_SETLK, &lock);
++    if( s!=0 ){
++      rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
++    }else{
++      rc = SQLITE_OK;
++      if( !id->locked ){
++        id->pOpen->nLock++;
++        id->locked = 1;
++      }
++      id->pLock->cnt = -1;
++    }
++  }else{
++    rc = SQLITE_BUSY;
++  }
++  sqliteOsLeaveMutex();
++  return rc;
++#endif
++#if OS_WIN
++  int rc;
++  if( id->locked<0 ){
++    rc = SQLITE_OK;
++  }else{
++    int res;
++    int cnt = 100;
++    while( cnt-->0 && (res = LockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0))==0 ){
++      Sleep(1);
++    }
++    if( res ){
++      if( id->locked>0 ){
++        if( isNT() ){
++          UnlockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0);
++        }else{
++          res = UnlockFile(id->h, FIRST_LOCKBYTE + id->locked, 0, 1, 0);
++        }
++      }
++      if( res ){
++        res = LockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0);
++      }else{
++        res = 0;
++      }
++      UnlockFile(id->h, FIRST_LOCKBYTE, 0, 1, 0);
++    }
++    if( res ){
++      id->locked = -1;
++      rc = SQLITE_OK;
++    }else{
++      rc = SQLITE_BUSY;
++    }
++  }
++  return rc;
++#endif
++#if OS_MAC
++  int rc;
++  if( id->locked<0 || id->refNumRF == -1 ){
++    rc = SQLITE_OK;
++  }else{
++    OSErr res;
++    int cnt = 5;
++    ParamBlockRec params;
++    memset(&params, 0, sizeof(params));
++    params.ioParam.ioRefNum = id->refNumRF;
++    params.ioParam.ioPosMode = fsFromStart;
++    params.ioParam.ioPosOffset = FIRST_LOCKBYTE;
++    params.ioParam.ioReqCount = 1;
++    while( cnt-->0 && (res = PBLockRangeSync(&params))!=noErr ){
++      UInt32 finalTicks;
++      Delay(1, &finalTicks); /* 1/60 sec */
++    }
++    if( res == noErr ){
++      params.ioParam.ioPosOffset = FIRST_LOCKBYTE + id->locked;
++      params.ioParam.ioReqCount = 1;
++      if( id->locked==0 
++            || PBUnlockRangeSync(&params)==noErr ){
++        params.ioParam.ioPosOffset = FIRST_LOCKBYTE+1;
++        params.ioParam.ioReqCount = N_LOCKBYTE;
++        res = PBLockRangeSync(&params);
++      }else{
++        res = afpRangeNotLocked;
++      }
++      params.ioParam.ioPosOffset = FIRST_LOCKBYTE;
++      params.ioParam.ioReqCount = 1;
++      PBUnlockRangeSync(&params);
++    }
++    if( res == noErr ){
++      id->locked = -1;
++      rc = SQLITE_OK;
++    }else{
++      rc = SQLITE_BUSY;
++    }
++  }
++  return rc;
++#endif
++}
++
++/*
++** Unlock the given file descriptor.  If the file descriptor was
++** not previously locked, then this routine is a no-op.  If this
++** library was compiled with large file support (LFS) but LFS is not
++** available on the host, then an SQLITE_NOLFS is returned.
++*/
++int sqliteOsUnlock(OsFile *id){
++#if OS_UNIX
++  int rc;
++  if( !id->locked ) return SQLITE_OK;
++  sqliteOsEnterMutex();
++  assert( id->pLock->cnt!=0 );
++  if( id->pLock->cnt>1 ){
++    id->pLock->cnt--;
++    rc = SQLITE_OK;
++  }else{
++    struct flock lock;
++    int s;
++    lock.l_type = F_UNLCK;
++    lock.l_whence = SEEK_SET;
++    lock.l_start = lock.l_len = 0L;
++    s = fcntl(id->fd, F_SETLK, &lock);
++    if( s!=0 ){
++      rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
++    }else{
++      rc = SQLITE_OK;
++      id->pLock->cnt = 0;
++    }
++  }
++  if( rc==SQLITE_OK ){
++    /* Decrement the count of locks against this same file.  When the
++    ** count reaches zero, close any other file descriptors whose close
++    ** was deferred because of outstanding locks.
++    */
++    struct openCnt *pOpen = id->pOpen;
++    pOpen->nLock--;
++    assert( pOpen->nLock>=0 );
++    if( pOpen->nLock==0 && pOpen->nPending>0 ){
++      int i;
++      for(i=0; i<pOpen->nPending; i++){
++        close(pOpen->aPending[i]);
++      }
++      sqliteFree(pOpen->aPending);
++      pOpen->nPending = 0;
++      pOpen->aPending = 0;
++    }
++  }
++  sqliteOsLeaveMutex();
++  id->locked = 0;
++  return rc;
++#endif
++#if OS_WIN
++  int rc;
++  if( id->locked==0 ){
++    rc = SQLITE_OK;
++  }else if( isNT() || id->locked<0 ){
++    UnlockFile(id->h, FIRST_LOCKBYTE+1, 0, N_LOCKBYTE, 0);
++    rc = SQLITE_OK;
++    id->locked = 0;
++  }else{
++    UnlockFile(id->h, FIRST_LOCKBYTE+id->locked, 0, 1, 0);
++    rc = SQLITE_OK;
++    id->locked = 0;
++  }
++  return rc;
++#endif
++#if OS_MAC
++  int rc;
++  ParamBlockRec params;
++  memset(&params, 0, sizeof(params));
++  params.ioParam.ioRefNum = id->refNumRF;
++  params.ioParam.ioPosMode = fsFromStart;
++  if( id->locked==0 || id->refNumRF == -1 ){
++    rc = SQLITE_OK;
++  }else if( id->locked<0 ){
++    params.ioParam.ioPosOffset = FIRST_LOCKBYTE+1;
++    params.ioParam.ioReqCount = N_LOCKBYTE;
++    PBUnlockRangeSync(&params);
++    rc = SQLITE_OK;
++    id->locked = 0;
++  }else{
++    params.ioParam.ioPosOffset = FIRST_LOCKBYTE+id->locked;
++    params.ioParam.ioReqCount = 1;
++    PBUnlockRangeSync(&params);
++    rc = SQLITE_OK;
++    id->locked = 0;
++  }
++  return rc;
++#endif
++}
++
++/*
++** Get information to seed the random number generator.  The seed
++** is written into the buffer zBuf[256].  The calling function must
++** supply a sufficiently large buffer.
++*/
++int sqliteOsRandomSeed(char *zBuf){
++  /* We have to initialize zBuf to prevent valgrind from reporting
++  ** errors.  The reports issued by valgrind are incorrect - we would
++  ** prefer that the randomness be increased by making use of the
++  ** uninitialized space in zBuf - but valgrind errors tend to worry
++  ** some users.  Rather than argue, it seems easier just to initialize
++  ** the whole array and silence valgrind, even if that means less randomness
++  ** in the random seed.
++  **
++  ** When testing, initializing zBuf[] to zero is all we do.  That means
++  ** that we always use the same random number sequence.* This makes the
++  ** tests repeatable.
++  */
++  memset(zBuf, 0, 256);
++#if OS_UNIX && !defined(SQLITE_TEST)
++  {
++    int pid;
++    time((time_t*)zBuf);
++    pid = getpid();
++    memcpy(&zBuf[sizeof(time_t)], &pid, sizeof(pid));
++  }
++#endif
++#if OS_WIN && !defined(SQLITE_TEST)
++  GetSystemTime((LPSYSTEMTIME)zBuf);
++#endif
++#if OS_MAC
++  {
++    int pid;
++    Microseconds((UnsignedWide*)zBuf);
++    pid = getpid();
++    memcpy(&zBuf[sizeof(UnsignedWide)], &pid, sizeof(pid));
++  }
++#endif
++  return SQLITE_OK;
++}
++
++/*
++** Sleep for a little while.  Return the amount of time slept.
++*/
++int sqliteOsSleep(int ms){
++#if OS_UNIX
++#if defined(HAVE_USLEEP) && HAVE_USLEEP
++  usleep(ms*1000);
++  return ms;
++#else
++  sleep((ms+999)/1000);
++  return 1000*((ms+999)/1000);
++#endif
++#endif
++#if OS_WIN
++  Sleep(ms);
++  return ms;
++#endif
++#if OS_MAC
++  UInt32 finalTicks;
++  UInt32 ticks = (((UInt32)ms+16)*3)/50;  /* 1/60 sec per tick */
++  Delay(ticks, &finalTicks);
++  return (int)((ticks*50)/3);
++#endif
++}
++
++/*
++** Static variables used for thread synchronization
++*/
++static int inMutex = 0;
++#ifdef SQLITE_UNIX_THREADS
++  static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
++#endif
++#ifdef SQLITE_W32_THREADS
++  static CRITICAL_SECTION cs;
++#endif
++#ifdef SQLITE_MACOS_MULTITASKING
++  static MPCriticalRegionID criticalRegion;
++#endif
++
++/*
++** The following pair of routine implement mutual exclusion for
++** multi-threaded processes.  Only a single thread is allowed to
++** executed code that is surrounded by EnterMutex() and LeaveMutex().
++**
++** SQLite uses only a single Mutex.  There is not much critical
++** code and what little there is executes quickly and without blocking.
++*/
++void sqliteOsEnterMutex(){
++#ifdef SQLITE_UNIX_THREADS
++  pthread_mutex_lock(&mutex);
++#endif
++#ifdef SQLITE_W32_THREADS
++  static int isInit = 0;
++  while( !isInit ){
++    static long lock = 0;
++    if( InterlockedIncrement(&lock)==1 ){
++      InitializeCriticalSection(&cs);
++      isInit = 1;
++    }else{
++      Sleep(1);
++    }
++  }
++  EnterCriticalSection(&cs);
++#endif
++#ifdef SQLITE_MACOS_MULTITASKING
++  static volatile int notInit = 1;
++  if( notInit ){
++    if( notInit == 2 ) /* as close as you can get to thread safe init */
++      MPYield();
++    else{
++      notInit = 2;
++      MPCreateCriticalRegion(&criticalRegion);
++      notInit = 0;
++    }
++  }
++  MPEnterCriticalRegion(criticalRegion, kDurationForever);
++#endif
++  assert( !inMutex );
++  inMutex = 1;
++}
++void sqliteOsLeaveMutex(){
++  assert( inMutex );
++  inMutex = 0;
++#ifdef SQLITE_UNIX_THREADS
++  pthread_mutex_unlock(&mutex);
++#endif
++#ifdef SQLITE_W32_THREADS
++  LeaveCriticalSection(&cs);
++#endif
++#ifdef SQLITE_MACOS_MULTITASKING
++  MPExitCriticalRegion(criticalRegion);
++#endif
++}
++
++/*
++** Turn a relative pathname into a full pathname.  Return a pointer
++** to the full pathname stored in space obtained from sqliteMalloc().
++** The calling function is responsible for freeing this space once it
++** is no longer needed.
++*/
++char *sqliteOsFullPathname(const char *zRelative){
++#if OS_UNIX
++  char *zFull = 0;
++  if( zRelative[0]=='/' ){
++    sqliteSetString(&zFull, zRelative, (char*)0);
++  }else{
++    char zBuf[5000];
++    zBuf[0] = 0;
++    sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), "/", zRelative,
++                    (char*)0);
++  }
++  return zFull;
++#endif
++#if OS_WIN
++  char *zNotUsed;
++  char *zFull;
++  int nByte;
++  nByte = GetFullPathName(zRelative, 0, 0, &zNotUsed) + 1;
++  zFull = sqliteMalloc( nByte );
++  if( zFull==0 ) return 0;
++  GetFullPathName(zRelative, nByte, zFull, &zNotUsed);
++  return zFull;
++#endif
++#if OS_MAC
++  char *zFull = 0;
++  if( zRelative[0]==':' ){
++    char zBuf[_MAX_PATH+1];
++    sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), &(zRelative[1]),
++                    (char*)0);
++  }else{
++    if( strchr(zRelative, ':') ){
++      sqliteSetString(&zFull, zRelative, (char*)0);
++    }else{
++    char zBuf[_MAX_PATH+1];
++      sqliteSetString(&zFull, getcwd(zBuf, sizeof(zBuf)), zRelative, (char*)0);
++    }
++  }
++  return zFull;
++#endif
++}
++
++/*
++** The following variable, if set to a non-zero value, becomes the result
++** returned from sqliteOsCurrentTime().  This is used for testing.
++*/
++#ifdef SQLITE_TEST
++int sqlite_current_time = 0;
++#endif
++
++/*
++** Find the current time (in Universal Coordinated Time).  Write the
++** current time and date as a Julian Day number into *prNow and
++** return 0.  Return 1 if the time and date cannot be found.
++*/
++int sqliteOsCurrentTime(double *prNow){
++#if OS_UNIX
++  time_t t;
++  time(&t);
++  *prNow = t/86400.0 + 2440587.5;
++#endif
++#if OS_WIN
++  FILETIME ft;
++  /* FILETIME structure is a 64-bit value representing the number of 
++     100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). 
++  */
++  double now;
++  GetSystemTimeAsFileTime( &ft );
++  now = ((double)ft.dwHighDateTime) * 4294967296.0; 
++  *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
++#endif
++#ifdef SQLITE_TEST
++  if( sqlite_current_time ){
++    *prNow = sqlite_current_time/86400.0 + 2440587.5;
++  }
++#endif
++  return 0;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/os.h
+@@ -0,0 +1,191 @@
++/*
++** 2001 September 16
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++******************************************************************************
++**
++** This header file (together with is companion C source-code file
++** "os.c") attempt to abstract the underlying operating system so that
++** the SQLite library will work on both POSIX and windows systems.
++*/
++#ifndef _SQLITE_OS_H_
++#define _SQLITE_OS_H_
++
++/*
++** Helpful hint:  To get this to compile on HP/UX, add -D_INCLUDE_POSIX_SOURCE
++** to the compiler command line.
++*/
++
++/*
++** These #defines should enable >2GB file support on Posix if the
++** underlying operating system supports it.  If the OS lacks
++** large file support, or if the OS is windows, these should be no-ops.
++**
++** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
++** on the compiler command line.  This is necessary if you are compiling
++** on a recent machine (ex: RedHat 7.2) but you want your code to work
++** on an older machine (ex: RedHat 6.0).  If you compile on RedHat 7.2
++** without this option, LFS is enable.  But LFS does not exist in the kernel
++** in RedHat 6.0, so the code won't work.  Hence, for maximum binary
++** portability you should omit LFS.
++**
++** Similar is true for MacOS.  LFS is only supported on MacOS 9 and later.
++*/
++#ifndef SQLITE_DISABLE_LFS
++# define _LARGE_FILE       1
++# ifndef _FILE_OFFSET_BITS
++#   define _FILE_OFFSET_BITS 64
++# endif
++# define _LARGEFILE_SOURCE 1
++#endif
++
++/*
++** Temporary files are named starting with this prefix followed by 16 random
++** alphanumeric characters, and no file extension. They are stored in the
++** OS's standard temporary file directory, and are deleted prior to exit.
++** If sqlite is being embedded in another program, you may wish to change the
++** prefix to reflect your program's name, so that if your program exits
++** prematurely, old temporary files can be easily identified. This can be done
++** using -DTEMP_FILE_PREFIX=myprefix_ on the compiler command line.
++*/
++#ifndef TEMP_FILE_PREFIX
++# define TEMP_FILE_PREFIX "sqlite_"
++#endif
++
++/*
++** Figure out if we are dealing with Unix, Windows or MacOS.
++**
++** N.B. MacOS means Mac Classic (or Carbon). Treat Darwin (OS X) as Unix.
++**      The MacOS build is designed to use CodeWarrior (tested with v8)
++*/
++#ifndef OS_UNIX
++# ifndef OS_WIN
++#  ifndef OS_MAC
++#    if defined(__MACOS__)
++#      define OS_MAC 1
++#      define OS_WIN 0
++#      define OS_UNIX 0
++#    elif defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
++#      define OS_MAC 0
++#      define OS_WIN 1
++#      define OS_UNIX 0
++#    else
++#      define OS_MAC 0
++#      define OS_WIN 0
++#      define OS_UNIX 1
++#    endif
++#  else
++#    define OS_WIN 0
++#    define OS_UNIX 0
++#  endif
++# else
++#  define OS_MAC 0
++#  define OS_UNIX 0
++# endif
++#else
++# define OS_MAC 0
++# ifndef OS_WIN
++#  define OS_WIN 0
++# endif
++#endif
++
++/*
++** A handle for an open file is stored in an OsFile object.
++*/
++#if OS_UNIX
++# include <sys/types.h>
++# include <sys/stat.h>
++# include <fcntl.h>
++# include <unistd.h>
++  typedef struct OsFile OsFile;
++  struct OsFile {
++    struct openCnt *pOpen;    /* Info about all open fd's on this inode */
++    struct lockInfo *pLock;   /* Info about locks on this inode */
++    int fd;                   /* The file descriptor */
++    int locked;               /* True if this instance holds the lock */
++    int dirfd;                /* File descriptor for the directory */
++  };
++# define SQLITE_TEMPNAME_SIZE 200
++# if defined(HAVE_USLEEP) && HAVE_USLEEP
++#  define SQLITE_MIN_SLEEP_MS 1
++# else
++#  define SQLITE_MIN_SLEEP_MS 1000
++# endif
++#endif
++
++#if OS_WIN
++#include <windows.h>
++#include <winbase.h>
++  typedef struct OsFile OsFile;
++  struct OsFile {
++    HANDLE h;               /* Handle for accessing the file */
++    int locked;             /* 0: unlocked, <0: write lock, >0: read lock */
++  };
++# if defined(_MSC_VER) || defined(__BORLANDC__)
++    typedef __int64 off_t;
++# else
++#  if !defined(_CYGWIN_TYPES_H)
++     typedef long long off_t;
++#    if defined(__MINGW32__)
++#      define _OFF_T_
++#    endif
++#  endif
++# endif
++# define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)
++# define SQLITE_MIN_SLEEP_MS 1
++#endif
++
++#if OS_MAC
++# include <unistd.h>
++# include <Files.h>
++  typedef struct OsFile OsFile;
++  struct OsFile {
++    SInt16 refNum;           /* Data fork/file reference number */
++    SInt16 refNumRF;         /* Resource fork reference number (for locking) */
++    int locked;              /* 0: unlocked, <0: write lock, >0: read lock */
++    int delOnClose;          /* True if file is to be deleted on close */
++    char *pathToDel;         /* Name of file to delete on close */
++  };
++# ifdef _LARGE_FILE
++    typedef SInt64 off_t;
++# else
++    typedef SInt32 off_t;
++# endif
++# define SQLITE_TEMPNAME_SIZE _MAX_PATH
++# define SQLITE_MIN_SLEEP_MS 17
++#endif
++
++int sqliteOsDelete(const char*);
++int sqliteOsFileExists(const char*);
++int sqliteOsFileRename(const char*, const char*);
++int sqliteOsOpenReadWrite(const char*, OsFile*, int*);
++int sqliteOsOpenExclusive(const char*, OsFile*, int);
++int sqliteOsOpenReadOnly(const char*, OsFile*);
++int sqliteOsOpenDirectory(const char*, OsFile*);
++int sqliteOsTempFileName(char*);
++int sqliteOsClose(OsFile*);
++int sqliteOsRead(OsFile*, void*, int amt);
++int sqliteOsWrite(OsFile*, const void*, int amt);
++int sqliteOsSeek(OsFile*, off_t offset);
++int sqliteOsSync(OsFile*);
++int sqliteOsTruncate(OsFile*, off_t size);
++int sqliteOsFileSize(OsFile*, off_t *pSize);
++int sqliteOsReadLock(OsFile*);
++int sqliteOsWriteLock(OsFile*);
++int sqliteOsUnlock(OsFile*);
++int sqliteOsRandomSeed(char*);
++int sqliteOsSleep(int ms);
++int sqliteOsCurrentTime(double*);
++void sqliteOsEnterMutex(void);
++void sqliteOsLeaveMutex(void);
++char *sqliteOsFullPathname(const char*);
++
++
++
++#endif /* _SQLITE_OS_H_ */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/pager.c
+@@ -0,0 +1,2220 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This is the implementation of the page cache subsystem or "pager".
++** 
++** The pager is used to access a database disk file.  It implements
++** atomic commit and rollback through the use of a journal file that
++** is separate from the database file.  The pager also implements file
++** locking to prevent two processes from writing the same database
++** file simultaneously, or one process from reading the database while
++** another is writing.
++**
++** @(#) $Id$
++*/
++#include "os.h"         /* Must be first to enable large file support */
++#include "sqliteInt.h"
++#include "pager.h"
++#include <assert.h>
++#include <string.h>
++
++/*
++** Macros for troubleshooting.  Normally turned off
++*/
++#if 0
++static Pager *mainPager = 0;
++#define SET_PAGER(X)  if( mainPager==0 ) mainPager = (X)
++#define CLR_PAGER(X)  if( mainPager==(X) ) mainPager = 0
++#define TRACE1(X)     if( pPager==mainPager ) fprintf(stderr,X)
++#define TRACE2(X,Y)   if( pPager==mainPager ) fprintf(stderr,X,Y)
++#define TRACE3(X,Y,Z) if( pPager==mainPager ) fprintf(stderr,X,Y,Z)
++#else
++#define SET_PAGER(X)
++#define CLR_PAGER(X)
++#define TRACE1(X)
++#define TRACE2(X,Y)
++#define TRACE3(X,Y,Z)
++#endif
++
++
++/*
++** The page cache as a whole is always in one of the following
++** states:
++**
++**   SQLITE_UNLOCK       The page cache is not currently reading or 
++**                       writing the database file.  There is no
++**                       data held in memory.  This is the initial
++**                       state.
++**
++**   SQLITE_READLOCK     The page cache is reading the database.
++**                       Writing is not permitted.  There can be
++**                       multiple readers accessing the same database
++**                       file at the same time.
++**
++**   SQLITE_WRITELOCK    The page cache is writing the database.
++**                       Access is exclusive.  No other processes or
++**                       threads can be reading or writing while one
++**                       process is writing.
++**
++** The page cache comes up in SQLITE_UNLOCK.  The first time a
++** sqlite_page_get() occurs, the state transitions to SQLITE_READLOCK.
++** After all pages have been released using sqlite_page_unref(),
++** the state transitions back to SQLITE_UNLOCK.  The first time
++** that sqlite_page_write() is called, the state transitions to
++** SQLITE_WRITELOCK.  (Note that sqlite_page_write() can only be
++** called on an outstanding page which means that the pager must
++** be in SQLITE_READLOCK before it transitions to SQLITE_WRITELOCK.)
++** The sqlite_page_rollback() and sqlite_page_commit() functions 
++** transition the state from SQLITE_WRITELOCK back to SQLITE_READLOCK.
++*/
++#define SQLITE_UNLOCK      0
++#define SQLITE_READLOCK    1
++#define SQLITE_WRITELOCK   2
++
++
++/*
++** Each in-memory image of a page begins with the following header.
++** This header is only visible to this pager module.  The client
++** code that calls pager sees only the data that follows the header.
++**
++** Client code should call sqlitepager_write() on a page prior to making
++** any modifications to that page.  The first time sqlitepager_write()
++** is called, the original page contents are written into the rollback
++** journal and PgHdr.inJournal and PgHdr.needSync are set.  Later, once
++** the journal page has made it onto the disk surface, PgHdr.needSync
++** is cleared.  The modified page cannot be written back into the original
++** database file until the journal pages has been synced to disk and the
++** PgHdr.needSync has been cleared.
++**
++** The PgHdr.dirty flag is set when sqlitepager_write() is called and
++** is cleared again when the page content is written back to the original
++** database file.
++*/
++typedef struct PgHdr PgHdr;
++struct PgHdr {
++  Pager *pPager;                 /* The pager to which this page belongs */
++  Pgno pgno;                     /* The page number for this page */
++  PgHdr *pNextHash, *pPrevHash;  /* Hash collision chain for PgHdr.pgno */
++  int nRef;                      /* Number of users of this page */
++  PgHdr *pNextFree, *pPrevFree;  /* Freelist of pages where nRef==0 */
++  PgHdr *pNextAll, *pPrevAll;    /* A list of all pages */
++  PgHdr *pNextCkpt, *pPrevCkpt;  /* List of pages in the checkpoint journal */
++  u8 inJournal;                  /* TRUE if has been written to journal */
++  u8 inCkpt;                     /* TRUE if written to the checkpoint journal */
++  u8 dirty;                      /* TRUE if we need to write back changes */
++  u8 needSync;                   /* Sync journal before writing this page */
++  u8 alwaysRollback;             /* Disable dont_rollback() for this page */
++  PgHdr *pDirty;                 /* Dirty pages sorted by PgHdr.pgno */
++  /* SQLITE_PAGE_SIZE bytes of page data follow this header */
++  /* Pager.nExtra bytes of local data follow the page data */
++};
++
++
++/*
++** A macro used for invoking the codec if there is one
++*/
++#ifdef SQLITE_HAS_CODEC
++# define CODEC(P,D,N,X) if( P->xCodec ){ P->xCodec(P->pCodecArg,D,N,X); }
++#else
++# define CODEC(P,D,N,X)
++#endif
++
++/*
++** Convert a pointer to a PgHdr into a pointer to its data
++** and back again.
++*/
++#define PGHDR_TO_DATA(P)  ((void*)(&(P)[1]))
++#define DATA_TO_PGHDR(D)  (&((PgHdr*)(D))[-1])
++#define PGHDR_TO_EXTRA(P) ((void*)&((char*)(&(P)[1]))[SQLITE_PAGE_SIZE])
++
++/*
++** How big to make the hash table used for locating in-memory pages
++** by page number.
++*/
++#define N_PG_HASH 2048
++
++/*
++** Hash a page number
++*/
++#define pager_hash(PN)  ((PN)&(N_PG_HASH-1))
++
++/*
++** A open page cache is an instance of the following structure.
++*/
++struct Pager {
++  char *zFilename;            /* Name of the database file */
++  char *zJournal;             /* Name of the journal file */
++  char *zDirectory;           /* Directory hold database and journal files */
++  OsFile fd, jfd;             /* File descriptors for database and journal */
++  OsFile cpfd;                /* File descriptor for the checkpoint journal */
++  int dbSize;                 /* Number of pages in the file */
++  int origDbSize;             /* dbSize before the current change */
++  int ckptSize;               /* Size of database (in pages) at ckpt_begin() */
++  off_t ckptJSize;            /* Size of journal at ckpt_begin() */
++  int nRec;                   /* Number of pages written to the journal */
++  u32 cksumInit;              /* Quasi-random value added to every checksum */
++  int ckptNRec;               /* Number of records in the checkpoint journal */
++  int nExtra;                 /* Add this many bytes to each in-memory page */
++  void (*xDestructor)(void*); /* Call this routine when freeing pages */
++  int nPage;                  /* Total number of in-memory pages */
++  int nRef;                   /* Number of in-memory pages with PgHdr.nRef>0 */
++  int mxPage;                 /* Maximum number of pages to hold in cache */
++  int nHit, nMiss, nOvfl;     /* Cache hits, missing, and LRU overflows */
++  void (*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */
++  void *pCodecArg;            /* First argument to xCodec() */
++  u8 journalOpen;             /* True if journal file descriptors is valid */
++  u8 journalStarted;          /* True if header of journal is synced */
++  u8 useJournal;              /* Use a rollback journal on this file */
++  u8 ckptOpen;                /* True if the checkpoint journal is open */
++  u8 ckptInUse;               /* True we are in a checkpoint */
++  u8 ckptAutoopen;            /* Open ckpt journal when main journal is opened*/
++  u8 noSync;                  /* Do not sync the journal if true */
++  u8 fullSync;                /* Do extra syncs of the journal for robustness */
++  u8 state;                   /* SQLITE_UNLOCK, _READLOCK or _WRITELOCK */
++  u8 errMask;                 /* One of several kinds of errors */
++  u8 tempFile;                /* zFilename is a temporary file */
++  u8 readOnly;                /* True for a read-only database */
++  u8 needSync;                /* True if an fsync() is needed on the journal */
++  u8 dirtyFile;               /* True if database file has changed in any way */
++  u8 alwaysRollback;          /* Disable dont_rollback() for all pages */
++  u8 *aInJournal;             /* One bit for each page in the database file */
++  u8 *aInCkpt;                /* One bit for each page in the database */
++  PgHdr *pFirst, *pLast;      /* List of free pages */
++  PgHdr *pFirstSynced;        /* First free page with PgHdr.needSync==0 */
++  PgHdr *pAll;                /* List of all pages */
++  PgHdr *pCkpt;               /* List of pages in the checkpoint journal */
++  PgHdr *aHash[N_PG_HASH];    /* Hash table to map page number of PgHdr */
++};
++
++/*
++** These are bits that can be set in Pager.errMask.
++*/
++#define PAGER_ERR_FULL     0x01  /* a write() failed */
++#define PAGER_ERR_MEM      0x02  /* malloc() failed */
++#define PAGER_ERR_LOCK     0x04  /* error in the locking protocol */
++#define PAGER_ERR_CORRUPT  0x08  /* database or journal corruption */
++#define PAGER_ERR_DISK     0x10  /* general disk I/O error - bad hard drive? */
++
++/*
++** The journal file contains page records in the following
++** format.
++**
++** Actually, this structure is the complete page record for pager
++** formats less than 3.  Beginning with format 3, this record is surrounded
++** by two checksums.
++*/
++typedef struct PageRecord PageRecord;
++struct PageRecord {
++  Pgno pgno;                      /* The page number */
++  char aData[SQLITE_PAGE_SIZE];   /* Original data for page pgno */
++};
++
++/*
++** Journal files begin with the following magic string.  The data
++** was obtained from /dev/random.  It is used only as a sanity check.
++**
++** There are three journal formats (so far). The 1st journal format writes
++** 32-bit integers in the byte-order of the host machine.  New
++** formats writes integers as big-endian.  All new journals use the
++** new format, but we have to be able to read an older journal in order
++** to rollback journals created by older versions of the library.
++**
++** The 3rd journal format (added for 2.8.0) adds additional sanity
++** checking information to the journal.  If the power fails while the
++** journal is being written, semi-random garbage data might appear in
++** the journal file after power is restored.  If an attempt is then made
++** to roll the journal back, the database could be corrupted.  The additional
++** sanity checking data is an attempt to discover the garbage in the
++** journal and ignore it.
++**
++** The sanity checking information for the 3rd journal format consists
++** of a 32-bit checksum on each page of data.  The checksum covers both
++** the page number and the SQLITE_PAGE_SIZE bytes of data for the page.
++** This cksum is initialized to a 32-bit random value that appears in the
++** journal file right after the header.  The random initializer is important,
++** because garbage data that appears at the end of a journal is likely
++** data that was once in other files that have now been deleted.  If the
++** garbage data came from an obsolete journal file, the checksums might
++** be correct.  But by initializing the checksum to random value which
++** is different for every journal, we minimize that risk.
++*/
++static const unsigned char aJournalMagic1[] = {
++  0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd4,
++};
++static const unsigned char aJournalMagic2[] = {
++  0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd5,
++};
++static const unsigned char aJournalMagic3[] = {
++  0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd6,
++};
++#define JOURNAL_FORMAT_1 1
++#define JOURNAL_FORMAT_2 2
++#define JOURNAL_FORMAT_3 3
++
++/*
++** The following integer determines what format to use when creating
++** new primary journal files.  By default we always use format 3.
++** When testing, we can set this value to older journal formats in order to
++** make sure that newer versions of the library are able to rollback older
++** journal files.
++**
++** Note that checkpoint journals always use format 2 and omit the header.
++*/
++#ifdef SQLITE_TEST
++int journal_format = 3;
++#else
++# define journal_format 3
++#endif
++
++/*
++** The size of the header and of each page in the journal varies according
++** to which journal format is being used.  The following macros figure out
++** the sizes based on format numbers.
++*/
++#define JOURNAL_HDR_SZ(X) \
++   (sizeof(aJournalMagic1) + sizeof(Pgno) + ((X)>=3)*2*sizeof(u32))
++#define JOURNAL_PG_SZ(X) \
++   (SQLITE_PAGE_SIZE + sizeof(Pgno) + ((X)>=3)*sizeof(u32))
++
++/*
++** Enable reference count tracking here:
++*/
++#ifdef SQLITE_TEST
++  int pager_refinfo_enable = 0;
++  static void pager_refinfo(PgHdr *p){
++    static int cnt = 0;
++    if( !pager_refinfo_enable ) return;
++    printf(
++       "REFCNT: %4d addr=0x%08x nRef=%d\n",
++       p->pgno, (int)PGHDR_TO_DATA(p), p->nRef
++    );
++    cnt++;   /* Something to set a breakpoint on */
++  }
++# define REFINFO(X)  pager_refinfo(X)
++#else
++# define REFINFO(X)
++#endif
++
++/*
++** Read a 32-bit integer from the given file descriptor.  Store the integer
++** that is read in *pRes.  Return SQLITE_OK if everything worked, or an
++** error code is something goes wrong.
++**
++** If the journal format is 2 or 3, read a big-endian integer.  If the
++** journal format is 1, read an integer in the native byte-order of the
++** host machine.
++*/
++static int read32bits(int format, OsFile *fd, u32 *pRes){
++  u32 res;
++  int rc;
++  rc = sqliteOsRead(fd, &res, sizeof(res));
++  if( rc==SQLITE_OK && format>JOURNAL_FORMAT_1 ){
++    unsigned char ac[4];
++    memcpy(ac, &res, 4);
++    res = (ac[0]<<24) | (ac[1]<<16) | (ac[2]<<8) | ac[3];
++  }
++  *pRes = res;
++  return rc;
++}
++
++/*
++** Write a 32-bit integer into the given file descriptor.  Return SQLITE_OK
++** on success or an error code is something goes wrong.
++**
++** If the journal format is 2 or 3, write the integer as 4 big-endian
++** bytes.  If the journal format is 1, write the integer in the native
++** byte order.  In normal operation, only formats 2 and 3 are used.
++** Journal format 1 is only used for testing.
++*/
++static int write32bits(OsFile *fd, u32 val){
++  unsigned char ac[4];
++  if( journal_format<=1 ){
++    return sqliteOsWrite(fd, &val, 4);
++  }
++  ac[0] = (val>>24) & 0xff;
++  ac[1] = (val>>16) & 0xff;
++  ac[2] = (val>>8) & 0xff;
++  ac[3] = val & 0xff;
++  return sqliteOsWrite(fd, ac, 4);
++}
++
++/*
++** Write a 32-bit integer into a page header right before the
++** page data.  This will overwrite the PgHdr.pDirty pointer.
++**
++** The integer is big-endian for formats 2 and 3 and native byte order
++** for journal format 1.
++*/
++static void store32bits(u32 val, PgHdr *p, int offset){
++  unsigned char *ac;
++  ac = &((unsigned char*)PGHDR_TO_DATA(p))[offset];
++  if( journal_format<=1 ){
++    memcpy(ac, &val, 4);
++  }else{
++    ac[0] = (val>>24) & 0xff;
++    ac[1] = (val>>16) & 0xff;
++    ac[2] = (val>>8) & 0xff;
++    ac[3] = val & 0xff;
++  }
++}
++
++
++/*
++** Convert the bits in the pPager->errMask into an approprate
++** return code.
++*/
++static int pager_errcode(Pager *pPager){
++  int rc = SQLITE_OK;
++  if( pPager->errMask & PAGER_ERR_LOCK )    rc = SQLITE_PROTOCOL;
++  if( pPager->errMask & PAGER_ERR_DISK )    rc = SQLITE_IOERR;
++  if( pPager->errMask & PAGER_ERR_FULL )    rc = SQLITE_FULL;
++  if( pPager->errMask & PAGER_ERR_MEM )     rc = SQLITE_NOMEM;
++  if( pPager->errMask & PAGER_ERR_CORRUPT ) rc = SQLITE_CORRUPT;
++  return rc;
++}
++
++/*
++** Add or remove a page from the list of all pages that are in the
++** checkpoint journal.
++**
++** The Pager keeps a separate list of pages that are currently in
++** the checkpoint journal.  This helps the sqlitepager_ckpt_commit()
++** routine run MUCH faster for the common case where there are many
++** pages in memory but only a few are in the checkpoint journal.
++*/
++static void page_add_to_ckpt_list(PgHdr *pPg){
++  Pager *pPager = pPg->pPager;
++  if( pPg->inCkpt ) return;
++  assert( pPg->pPrevCkpt==0 && pPg->pNextCkpt==0 );
++  pPg->pPrevCkpt = 0;
++  if( pPager->pCkpt ){
++    pPager->pCkpt->pPrevCkpt = pPg;
++  }
++  pPg->pNextCkpt = pPager->pCkpt;
++  pPager->pCkpt = pPg;
++  pPg->inCkpt = 1;
++}
++static void page_remove_from_ckpt_list(PgHdr *pPg){
++  if( !pPg->inCkpt ) return;
++  if( pPg->pPrevCkpt ){
++    assert( pPg->pPrevCkpt->pNextCkpt==pPg );
++    pPg->pPrevCkpt->pNextCkpt = pPg->pNextCkpt;
++  }else{
++    assert( pPg->pPager->pCkpt==pPg );
++    pPg->pPager->pCkpt = pPg->pNextCkpt;
++  }
++  if( pPg->pNextCkpt ){
++    assert( pPg->pNextCkpt->pPrevCkpt==pPg );
++    pPg->pNextCkpt->pPrevCkpt = pPg->pPrevCkpt;
++  }
++  pPg->pNextCkpt = 0;
++  pPg->pPrevCkpt = 0;
++  pPg->inCkpt = 0;
++}
++
++/*
++** Find a page in the hash table given its page number.  Return
++** a pointer to the page or NULL if not found.
++*/
++static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
++  PgHdr *p = pPager->aHash[pager_hash(pgno)];
++  while( p && p->pgno!=pgno ){
++    p = p->pNextHash;
++  }
++  return p;
++}
++
++/*
++** Unlock the database and clear the in-memory cache.  This routine
++** sets the state of the pager back to what it was when it was first
++** opened.  Any outstanding pages are invalidated and subsequent attempts
++** to access those pages will likely result in a coredump.
++*/
++static void pager_reset(Pager *pPager){
++  PgHdr *pPg, *pNext;
++  for(pPg=pPager->pAll; pPg; pPg=pNext){
++    pNext = pPg->pNextAll;
++    sqliteFree(pPg);
++  }
++  pPager->pFirst = 0;
++  pPager->pFirstSynced = 0;
++  pPager->pLast = 0;
++  pPager->pAll = 0;
++  memset(pPager->aHash, 0, sizeof(pPager->aHash));
++  pPager->nPage = 0;
++  if( pPager->state>=SQLITE_WRITELOCK ){
++    sqlitepager_rollback(pPager);
++  }
++  sqliteOsUnlock(&pPager->fd);
++  pPager->state = SQLITE_UNLOCK;
++  pPager->dbSize = -1;
++  pPager->nRef = 0;
++  assert( pPager->journalOpen==0 );
++}
++
++/*
++** When this routine is called, the pager has the journal file open and
++** a write lock on the database.  This routine releases the database
++** write lock and acquires a read lock in its place.  The journal file
++** is deleted and closed.
++**
++** TODO: Consider keeping the journal file open for temporary databases.
++** This might give a performance improvement on windows where opening
++** a file is an expensive operation.
++*/
++static int pager_unwritelock(Pager *pPager){
++  int rc;
++  PgHdr *pPg;
++  if( pPager->state<SQLITE_WRITELOCK ) return SQLITE_OK;
++  sqlitepager_ckpt_commit(pPager);
++  if( pPager->ckptOpen ){
++    sqliteOsClose(&pPager->cpfd);
++    pPager->ckptOpen = 0;
++  }
++  if( pPager->journalOpen ){
++    sqliteOsClose(&pPager->jfd);
++    pPager->journalOpen = 0;
++    sqliteOsDelete(pPager->zJournal);
++    sqliteFree( pPager->aInJournal );
++    pPager->aInJournal = 0;
++    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
++      pPg->inJournal = 0;
++      pPg->dirty = 0;
++      pPg->needSync = 0;
++    }
++  }else{
++    assert( pPager->dirtyFile==0 || pPager->useJournal==0 );
++  }
++  rc = sqliteOsReadLock(&pPager->fd);
++  if( rc==SQLITE_OK ){
++    pPager->state = SQLITE_READLOCK;
++  }else{
++    /* This can only happen if a process does a BEGIN, then forks and the
++    ** child process does the COMMIT.  Because of the semantics of unix
++    ** file locking, the unlock will fail.
++    */
++    pPager->state = SQLITE_UNLOCK;
++  }
++  return rc;
++}
++
++/*
++** Compute and return a checksum for the page of data.
++**
++** This is not a real checksum.  It is really just the sum of the 
++** random initial value and the page number.  We considered do a checksum
++** of the database, but that was found to be too slow.
++*/
++static u32 pager_cksum(Pager *pPager, Pgno pgno, const char *aData){
++  u32 cksum = pPager->cksumInit + pgno;
++  return cksum;
++}
++
++/*
++** Read a single page from the journal file opened on file descriptor
++** jfd.  Playback this one page.
++**
++** There are three different journal formats.  The format parameter determines
++** which format is used by the journal that is played back.
++*/
++static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int format){
++  int rc;
++  PgHdr *pPg;              /* An existing page in the cache */
++  PageRecord pgRec;
++  u32 cksum;
++
++  rc = read32bits(format, jfd, &pgRec.pgno);
++  if( rc!=SQLITE_OK ) return rc;
++  rc = sqliteOsRead(jfd, &pgRec.aData, sizeof(pgRec.aData));
++  if( rc!=SQLITE_OK ) return rc;
++
++  /* Sanity checking on the page.  This is more important that I originally
++  ** thought.  If a power failure occurs while the journal is being written,
++  ** it could cause invalid data to be written into the journal.  We need to
++  ** detect this invalid data (with high probability) and ignore it.
++  */
++  if( pgRec.pgno==0 ){
++    return SQLITE_DONE;
++  }
++  if( pgRec.pgno>(unsigned)pPager->dbSize ){
++    return SQLITE_OK;
++  }
++  if( format>=JOURNAL_FORMAT_3 ){
++    rc = read32bits(format, jfd, &cksum);
++    if( rc ) return rc;
++    if( pager_cksum(pPager, pgRec.pgno, pgRec.aData)!=cksum ){
++      return SQLITE_DONE;
++    }
++  }
++
++  /* Playback the page.  Update the in-memory copy of the page
++  ** at the same time, if there is one.
++  */
++  pPg = pager_lookup(pPager, pgRec.pgno);
++  TRACE2("PLAYBACK %d\n", pgRec.pgno);
++  sqliteOsSeek(&pPager->fd, (pgRec.pgno-1)*(off_t)SQLITE_PAGE_SIZE);
++  rc = sqliteOsWrite(&pPager->fd, pgRec.aData, SQLITE_PAGE_SIZE);
++  if( pPg ){
++    /* No page should ever be rolled back that is in use, except for page
++    ** 1 which is held in use in order to keep the lock on the database
++    ** active.
++    */
++    assert( pPg->nRef==0 || pPg->pgno==1 );
++    memcpy(PGHDR_TO_DATA(pPg), pgRec.aData, SQLITE_PAGE_SIZE);
++    memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra);
++    pPg->dirty = 0;
++    pPg->needSync = 0;
++    CODEC(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
++  }
++  return rc;
++}
++
++/*
++** Playback the journal and thus restore the database file to
++** the state it was in before we started making changes.  
++**
++** The journal file format is as follows: 
++**
++**    *  8 byte prefix.  One of the aJournalMagic123 vectors defined
++**       above.  The format of the journal file is determined by which
++**       of the three prefix vectors is seen.
++**    *  4 byte big-endian integer which is the number of valid page records
++**       in the journal.  If this value is 0xffffffff, then compute the
++**       number of page records from the journal size.  This field appears
++**       in format 3 only.
++**    *  4 byte big-endian integer which is the initial value for the 
++**       sanity checksum.  This field appears in format 3 only.
++**    *  4 byte integer which is the number of pages to truncate the
++**       database to during a rollback.
++**    *  Zero or more pages instances, each as follows:
++**        +  4 byte page number.
++**        +  SQLITE_PAGE_SIZE bytes of data.
++**        +  4 byte checksum (format 3 only)
++**
++** When we speak of the journal header, we mean the first 4 bullets above.
++** Each entry in the journal is an instance of the 5th bullet.  Note that
++** bullets 2 and 3 only appear in format-3 journals.
++**
++** Call the value from the second bullet "nRec".  nRec is the number of
++** valid page entries in the journal.  In most cases, you can compute the
++** value of nRec from the size of the journal file.  But if a power
++** failure occurred while the journal was being written, it could be the
++** case that the size of the journal file had already been increased but
++** the extra entries had not yet made it safely to disk.  In such a case,
++** the value of nRec computed from the file size would be too large.  For
++** that reason, we always use the nRec value in the header.
++**
++** If the nRec value is 0xffffffff it means that nRec should be computed
++** from the file size.  This value is used when the user selects the
++** no-sync option for the journal.  A power failure could lead to corruption
++** in this case.  But for things like temporary table (which will be
++** deleted when the power is restored) we don't care.  
++**
++** Journal formats 1 and 2 do not have an nRec value in the header so we
++** have to compute nRec from the file size.  This has risks (as described
++** above) which is why all persistent tables have been changed to use
++** format 3.
++**
++** If the file opened as the journal file is not a well-formed
++** journal file then the database will likely already be
++** corrupted, so the PAGER_ERR_CORRUPT bit is set in pPager->errMask
++** and SQLITE_CORRUPT is returned.  If it all works, then this routine
++** returns SQLITE_OK.
++*/
++static int pager_playback(Pager *pPager, int useJournalSize){
++  off_t szJ;               /* Size of the journal file in bytes */
++  int nRec;                /* Number of Records in the journal */
++  int i;                   /* Loop counter */
++  Pgno mxPg = 0;           /* Size of the original file in pages */
++  int format;              /* Format of the journal file. */
++  unsigned char aMagic[sizeof(aJournalMagic1)];
++  int rc;
++
++  /* Figure out how many records are in the journal.  Abort early if
++  ** the journal is empty.
++  */
++  assert( pPager->journalOpen );
++  sqliteOsSeek(&pPager->jfd, 0);
++  rc = sqliteOsFileSize(&pPager->jfd, &szJ);
++  if( rc!=SQLITE_OK ){
++    goto end_playback;
++  }
++
++  /* If the journal file is too small to contain a complete header,
++  ** it must mean that the process that created the journal was just
++  ** beginning to write the journal file when it died.  In that case,
++  ** the database file should have still been completely unchanged.
++  ** Nothing needs to be rolled back.  We can safely ignore this journal.
++  */
++  if( szJ < sizeof(aMagic)+sizeof(Pgno) ){
++    goto end_playback;
++  }
++
++  /* Read the beginning of the journal and truncate the
++  ** database file back to its original size.
++  */
++  rc = sqliteOsRead(&pPager->jfd, aMagic, sizeof(aMagic));
++  if( rc!=SQLITE_OK ){
++    rc = SQLITE_PROTOCOL;
++    goto end_playback;
++  }
++  if( memcmp(aMagic, aJournalMagic3, sizeof(aMagic))==0 ){
++    format = JOURNAL_FORMAT_3;
++  }else if( memcmp(aMagic, aJournalMagic2, sizeof(aMagic))==0 ){
++    format = JOURNAL_FORMAT_2;
++  }else if( memcmp(aMagic, aJournalMagic1, sizeof(aMagic))==0 ){
++    format = JOURNAL_FORMAT_1;
++  }else{
++    rc = SQLITE_PROTOCOL;
++    goto end_playback;
++  }
++  if( format>=JOURNAL_FORMAT_3 ){
++    if( szJ < sizeof(aMagic) + 3*sizeof(u32) ){
++      /* Ignore the journal if it is too small to contain a complete
++      ** header.  We already did this test once above, but at the prior
++      ** test, we did not know the journal format and so we had to assume
++      ** the smallest possible header.  Now we know the header is bigger
++      ** than the minimum so we test again.
++      */
++      goto end_playback;
++    }
++    rc = read32bits(format, &pPager->jfd, (u32*)&nRec);
++    if( rc ) goto end_playback;
++    rc = read32bits(format, &pPager->jfd, &pPager->cksumInit);
++    if( rc ) goto end_playback;
++    if( nRec==0xffffffff || useJournalSize ){
++      nRec = (szJ - JOURNAL_HDR_SZ(3))/JOURNAL_PG_SZ(3);
++    }
++  }else{
++    nRec = (szJ - JOURNAL_HDR_SZ(2))/JOURNAL_PG_SZ(2);
++    assert( nRec*JOURNAL_PG_SZ(2)+JOURNAL_HDR_SZ(2)==szJ );
++  }
++  rc = read32bits(format, &pPager->jfd, &mxPg);
++  if( rc!=SQLITE_OK ){
++    goto end_playback;
++  }
++  assert( pPager->origDbSize==0 || pPager->origDbSize==mxPg );
++  rc = sqliteOsTruncate(&pPager->fd, SQLITE_PAGE_SIZE*(off_t)mxPg);
++  if( rc!=SQLITE_OK ){
++    goto end_playback;
++  }
++  pPager->dbSize = mxPg;
++  
++  /* Copy original pages out of the journal and back into the database file.
++  */
++  for(i=0; i<nRec; i++){
++    rc = pager_playback_one_page(pPager, &pPager->jfd, format);
++    if( rc!=SQLITE_OK ){
++      if( rc==SQLITE_DONE ){
++        rc = SQLITE_OK;
++      }
++      break;
++    }
++  }
++
++  /* Pages that have been written to the journal but never synced
++  ** where not restored by the loop above.  We have to restore those
++  ** pages by reading them back from the original database.
++  */
++  if( rc==SQLITE_OK ){
++    PgHdr *pPg;
++    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
++      char zBuf[SQLITE_PAGE_SIZE];
++      if( !pPg->dirty ) continue;
++      if( (int)pPg->pgno <= pPager->origDbSize ){
++        sqliteOsSeek(&pPager->fd, SQLITE_PAGE_SIZE*(off_t)(pPg->pgno-1));
++        rc = sqliteOsRead(&pPager->fd, zBuf, SQLITE_PAGE_SIZE);
++        TRACE2("REFETCH %d\n", pPg->pgno);
++        CODEC(pPager, zBuf, pPg->pgno, 2);
++        if( rc ) break;
++      }else{
++        memset(zBuf, 0, SQLITE_PAGE_SIZE);
++      }
++      if( pPg->nRef==0 || memcmp(zBuf, PGHDR_TO_DATA(pPg), SQLITE_PAGE_SIZE) ){
++        memcpy(PGHDR_TO_DATA(pPg), zBuf, SQLITE_PAGE_SIZE);
++        memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra);
++      }
++      pPg->needSync = 0;
++      pPg->dirty = 0;
++    }
++  }
++
++end_playback:
++  if( rc!=SQLITE_OK ){
++    pager_unwritelock(pPager);
++    pPager->errMask |= PAGER_ERR_CORRUPT;
++    rc = SQLITE_CORRUPT;
++  }else{
++    rc = pager_unwritelock(pPager);
++  }
++  return rc;
++}
++
++/*
++** Playback the checkpoint journal.
++**
++** This is similar to playing back the transaction journal but with
++** a few extra twists.
++**
++**    (1)  The number of pages in the database file at the start of
++**         the checkpoint is stored in pPager->ckptSize, not in the
++**         journal file itself.
++**
++**    (2)  In addition to playing back the checkpoint journal, also
++**         playback all pages of the transaction journal beginning
++**         at offset pPager->ckptJSize.
++*/
++static int pager_ckpt_playback(Pager *pPager){
++  off_t szJ;               /* Size of the full journal */
++  int nRec;                /* Number of Records */
++  int i;                   /* Loop counter */
++  int rc;
++
++  /* Truncate the database back to its original size.
++  */
++  rc = sqliteOsTruncate(&pPager->fd, SQLITE_PAGE_SIZE*(off_t)pPager->ckptSize);
++  pPager->dbSize = pPager->ckptSize;
++
++  /* Figure out how many records are in the checkpoint journal.
++  */
++  assert( pPager->ckptInUse && pPager->journalOpen );
++  sqliteOsSeek(&pPager->cpfd, 0);
++  nRec = pPager->ckptNRec;
++  
++  /* Copy original pages out of the checkpoint journal and back into the
++  ** database file.  Note that the checkpoint journal always uses format
++  ** 2 instead of format 3 since it does not need to be concerned with
++  ** power failures corrupting the journal and can thus omit the checksums.
++  */
++  for(i=nRec-1; i>=0; i--){
++    rc = pager_playback_one_page(pPager, &pPager->cpfd, 2);
++    assert( rc!=SQLITE_DONE );
++    if( rc!=SQLITE_OK ) goto end_ckpt_playback;
++  }
++
++  /* Figure out how many pages need to be copied out of the transaction
++  ** journal.
++  */
++  rc = sqliteOsSeek(&pPager->jfd, pPager->ckptJSize);
++  if( rc!=SQLITE_OK ){
++    goto end_ckpt_playback;
++  }
++  rc = sqliteOsFileSize(&pPager->jfd, &szJ);
++  if( rc!=SQLITE_OK ){
++    goto end_ckpt_playback;
++  }
++  nRec = (szJ - pPager->ckptJSize)/JOURNAL_PG_SZ(journal_format);
++  for(i=nRec-1; i>=0; i--){
++    rc = pager_playback_one_page(pPager, &pPager->jfd, journal_format);
++    if( rc!=SQLITE_OK ){
++      assert( rc!=SQLITE_DONE );
++      goto end_ckpt_playback;
++    }
++  }
++  
++end_ckpt_playback:
++  if( rc!=SQLITE_OK ){
++    pPager->errMask |= PAGER_ERR_CORRUPT;
++    rc = SQLITE_CORRUPT;
++  }
++  return rc;
++}
++
++/*
++** Change the maximum number of in-memory pages that are allowed.
++**
++** The maximum number is the absolute value of the mxPage parameter.
++** If mxPage is negative, the noSync flag is also set.  noSync bypasses
++** calls to sqliteOsSync().  The pager runs much faster with noSync on,
++** but if the operating system crashes or there is an abrupt power 
++** failure, the database file might be left in an inconsistent and
++** unrepairable state.  
++*/
++void sqlitepager_set_cachesize(Pager *pPager, int mxPage){
++  if( mxPage>=0 ){
++    pPager->noSync = pPager->tempFile;
++    if( pPager->noSync==0 ) pPager->needSync = 0;
++  }else{
++    pPager->noSync = 1;
++    mxPage = -mxPage;
++  }
++  if( mxPage>10 ){
++    pPager->mxPage = mxPage;
++  }
++}
++
++/*
++** Adjust the robustness of the database to damage due to OS crashes
++** or power failures by changing the number of syncs()s when writing
++** the rollback journal.  There are three levels:
++**
++**    OFF       sqliteOsSync() is never called.  This is the default
++**              for temporary and transient files.
++**
++**    NORMAL    The journal is synced once before writes begin on the
++**              database.  This is normally adequate protection, but
++**              it is theoretically possible, though very unlikely,
++**              that an inopertune power failure could leave the journal
++**              in a state which would cause damage to the database
++**              when it is rolled back.
++**
++**    FULL      The journal is synced twice before writes begin on the
++**              database (with some additional information - the nRec field
++**              of the journal header - being written in between the two
++**              syncs).  If we assume that writing a
++**              single disk sector is atomic, then this mode provides
++**              assurance that the journal will not be corrupted to the
++**              point of causing damage to the database during rollback.
++**
++** Numeric values associated with these states are OFF==1, NORMAL=2,
++** and FULL=3.
++*/
++void sqlitepager_set_safety_level(Pager *pPager, int level){
++  pPager->noSync =  level==1 || pPager->tempFile;
++  pPager->fullSync = level==3 && !pPager->tempFile;
++  if( pPager->noSync==0 ) pPager->needSync = 0;
++}
++
++/*
++** Open a temporary file.  Write the name of the file into zName
++** (zName must be at least SQLITE_TEMPNAME_SIZE bytes long.)  Write
++** the file descriptor into *fd.  Return SQLITE_OK on success or some
++** other error code if we fail.
++**
++** The OS will automatically delete the temporary file when it is
++** closed.
++*/
++static int sqlitepager_opentemp(char *zFile, OsFile *fd){
++  int cnt = 8;
++  int rc;
++  do{
++    cnt--;
++    sqliteOsTempFileName(zFile);
++    rc = sqliteOsOpenExclusive(zFile, fd, 1);
++  }while( cnt>0 && rc!=SQLITE_OK );
++  return rc;
++}
++
++/*
++** Create a new page cache and put a pointer to the page cache in *ppPager.
++** The file to be cached need not exist.  The file is not locked until
++** the first call to sqlitepager_get() and is only held open until the
++** last page is released using sqlitepager_unref().
++**
++** If zFilename is NULL then a randomly-named temporary file is created
++** and used as the file to be cached.  The file will be deleted
++** automatically when it is closed.
++*/
++int sqlitepager_open(
++  Pager **ppPager,         /* Return the Pager structure here */
++  const char *zFilename,   /* Name of the database file to open */
++  int mxPage,              /* Max number of in-memory cache pages */
++  int nExtra,              /* Extra bytes append to each in-memory page */
++  int useJournal           /* TRUE to use a rollback journal on this file */
++){
++  Pager *pPager;
++  char *zFullPathname;
++  int nameLen;
++  OsFile fd;
++  int rc, i;
++  int tempFile;
++  int readOnly = 0;
++  char zTemp[SQLITE_TEMPNAME_SIZE];
++
++  *ppPager = 0;
++  if( sqlite_malloc_failed ){
++    return SQLITE_NOMEM;
++  }
++  if( zFilename && zFilename[0] ){
++    zFullPathname = sqliteOsFullPathname(zFilename);
++    rc = sqliteOsOpenReadWrite(zFullPathname, &fd, &readOnly);
++    tempFile = 0;
++  }else{
++    rc = sqlitepager_opentemp(zTemp, &fd);
++    zFilename = zTemp;
++    zFullPathname = sqliteOsFullPathname(zFilename);
++    tempFile = 1;
++  }
++  if( sqlite_malloc_failed ){
++    return SQLITE_NOMEM;
++  }
++  if( rc!=SQLITE_OK ){
++    sqliteFree(zFullPathname);
++    return SQLITE_CANTOPEN;
++  }
++  nameLen = strlen(zFullPathname);
++  pPager = sqliteMalloc( sizeof(*pPager) + nameLen*3 + 30 );
++  if( pPager==0 ){
++    sqliteOsClose(&fd);
++    sqliteFree(zFullPathname);
++    return SQLITE_NOMEM;
++  }
++  SET_PAGER(pPager);
++  pPager->zFilename = (char*)&pPager[1];
++  pPager->zDirectory = &pPager->zFilename[nameLen+1];
++  pPager->zJournal = &pPager->zDirectory[nameLen+1];
++  strcpy(pPager->zFilename, zFullPathname);
++  strcpy(pPager->zDirectory, zFullPathname);
++  for(i=nameLen; i>0 && pPager->zDirectory[i-1]!='/'; i--){}
++  if( i>0 ) pPager->zDirectory[i-1] = 0;
++  strcpy(pPager->zJournal, zFullPathname);
++  sqliteFree(zFullPathname);
++  strcpy(&pPager->zJournal[nameLen], "-journal");
++  pPager->fd = fd;
++  pPager->journalOpen = 0;
++  pPager->useJournal = useJournal;
++  pPager->ckptOpen = 0;
++  pPager->ckptInUse = 0;
++  pPager->nRef = 0;
++  pPager->dbSize = -1;
++  pPager->ckptSize = 0;
++  pPager->ckptJSize = 0;
++  pPager->nPage = 0;
++  pPager->mxPage = mxPage>5 ? mxPage : 10;
++  pPager->state = SQLITE_UNLOCK;
++  pPager->errMask = 0;
++  pPager->tempFile = tempFile;
++  pPager->readOnly = readOnly;
++  pPager->needSync = 0;
++  pPager->noSync = pPager->tempFile || !useJournal;
++  pPager->pFirst = 0;
++  pPager->pFirstSynced = 0;
++  pPager->pLast = 0;
++  pPager->nExtra = nExtra;
++  memset(pPager->aHash, 0, sizeof(pPager->aHash));
++  *ppPager = pPager;
++  return SQLITE_OK;
++}
++
++/*
++** Set the destructor for this pager.  If not NULL, the destructor is called
++** when the reference count on each page reaches zero.  The destructor can
++** be used to clean up information in the extra segment appended to each page.
++**
++** The destructor is not called as a result sqlitepager_close().  
++** Destructors are only called by sqlitepager_unref().
++*/
++void sqlitepager_set_destructor(Pager *pPager, void (*xDesc)(void*)){
++  pPager->xDestructor = xDesc;
++}
++
++/*
++** Return the total number of pages in the disk file associated with
++** pPager.
++*/
++int sqlitepager_pagecount(Pager *pPager){
++  off_t n;
++  assert( pPager!=0 );
++  if( pPager->dbSize>=0 ){
++    return pPager->dbSize;
++  }
++  if( sqliteOsFileSize(&pPager->fd, &n)!=SQLITE_OK ){
++    pPager->errMask |= PAGER_ERR_DISK;
++    return 0;
++  }
++  n /= SQLITE_PAGE_SIZE;
++  if( pPager->state!=SQLITE_UNLOCK ){
++    pPager->dbSize = n;
++  }
++  return n;
++}
++
++/*
++** Forward declaration
++*/
++static int syncJournal(Pager*);
++
++/*
++** Truncate the file to the number of pages specified.
++*/
++int sqlitepager_truncate(Pager *pPager, Pgno nPage){
++  int rc;
++  if( pPager->dbSize<0 ){
++    sqlitepager_pagecount(pPager);
++  }
++  if( pPager->errMask!=0 ){
++    rc = pager_errcode(pPager);
++    return rc;
++  }
++  if( nPage>=(unsigned)pPager->dbSize ){
++    return SQLITE_OK;
++  }
++  syncJournal(pPager);
++  rc = sqliteOsTruncate(&pPager->fd, SQLITE_PAGE_SIZE*(off_t)nPage);
++  if( rc==SQLITE_OK ){
++    pPager->dbSize = nPage;
++  }
++  return rc;
++}
++
++/*
++** Shutdown the page cache.  Free all memory and close all files.
++**
++** If a transaction was in progress when this routine is called, that
++** transaction is rolled back.  All outstanding pages are invalidated
++** and their memory is freed.  Any attempt to use a page associated
++** with this page cache after this function returns will likely
++** result in a coredump.
++*/
++int sqlitepager_close(Pager *pPager){
++  PgHdr *pPg, *pNext;
++  switch( pPager->state ){
++    case SQLITE_WRITELOCK: {
++      sqlitepager_rollback(pPager);
++      sqliteOsUnlock(&pPager->fd);
++      assert( pPager->journalOpen==0 );
++      break;
++    }
++    case SQLITE_READLOCK: {
++      sqliteOsUnlock(&pPager->fd);
++      break;
++    }
++    default: {
++      /* Do nothing */
++      break;
++    }
++  }
++  for(pPg=pPager->pAll; pPg; pPg=pNext){
++    pNext = pPg->pNextAll;
++    sqliteFree(pPg);
++  }
++  sqliteOsClose(&pPager->fd);
++  assert( pPager->journalOpen==0 );
++  /* Temp files are automatically deleted by the OS
++  ** if( pPager->tempFile ){
++  **   sqliteOsDelete(pPager->zFilename);
++  ** }
++  */
++  CLR_PAGER(pPager);
++  if( pPager->zFilename!=(char*)&pPager[1] ){
++    assert( 0 );  /* Cannot happen */
++    sqliteFree(pPager->zFilename);
++    sqliteFree(pPager->zJournal);
++    sqliteFree(pPager->zDirectory);
++  }
++  sqliteFree(pPager);
++  return SQLITE_OK;
++}
++
++/*
++** Return the page number for the given page data.
++*/
++Pgno sqlitepager_pagenumber(void *pData){
++  PgHdr *p = DATA_TO_PGHDR(pData);
++  return p->pgno;
++}
++
++/*
++** Increment the reference count for a page.  If the page is
++** currently on the freelist (the reference count is zero) then
++** remove it from the freelist.
++*/
++#define page_ref(P)   ((P)->nRef==0?_page_ref(P):(void)(P)->nRef++)
++static void _page_ref(PgHdr *pPg){
++  if( pPg->nRef==0 ){
++    /* The page is currently on the freelist.  Remove it. */
++    if( pPg==pPg->pPager->pFirstSynced ){
++      PgHdr *p = pPg->pNextFree;
++      while( p && p->needSync ){ p = p->pNextFree; }
++      pPg->pPager->pFirstSynced = p;
++    }
++    if( pPg->pPrevFree ){
++      pPg->pPrevFree->pNextFree = pPg->pNextFree;
++    }else{
++      pPg->pPager->pFirst = pPg->pNextFree;
++    }
++    if( pPg->pNextFree ){
++      pPg->pNextFree->pPrevFree = pPg->pPrevFree;
++    }else{
++      pPg->pPager->pLast = pPg->pPrevFree;
++    }
++    pPg->pPager->nRef++;
++  }
++  pPg->nRef++;
++  REFINFO(pPg);
++}
++
++/*
++** Increment the reference count for a page.  The input pointer is
++** a reference to the page data.
++*/
++int sqlitepager_ref(void *pData){
++  PgHdr *pPg = DATA_TO_PGHDR(pData);
++  page_ref(pPg);
++  return SQLITE_OK;
++}
++
++/*
++** Sync the journal.  In other words, make sure all the pages that have
++** been written to the journal have actually reached the surface of the
++** disk.  It is not safe to modify the original database file until after
++** the journal has been synced.  If the original database is modified before
++** the journal is synced and a power failure occurs, the unsynced journal
++** data would be lost and we would be unable to completely rollback the
++** database changes.  Database corruption would occur.
++** 
++** This routine also updates the nRec field in the header of the journal.
++** (See comments on the pager_playback() routine for additional information.)
++** If the sync mode is FULL, two syncs will occur.  First the whole journal
++** is synced, then the nRec field is updated, then a second sync occurs.
++**
++** For temporary databases, we do not care if we are able to rollback
++** after a power failure, so sync occurs.
++**
++** This routine clears the needSync field of every page current held in
++** memory.
++*/
++static int syncJournal(Pager *pPager){
++  PgHdr *pPg;
++  int rc = SQLITE_OK;
++
++  /* Sync the journal before modifying the main database
++  ** (assuming there is a journal and it needs to be synced.)
++  */
++  if( pPager->needSync ){
++    if( !pPager->tempFile ){
++      assert( pPager->journalOpen );
++      /* assert( !pPager->noSync ); // noSync might be set if synchronous
++      ** was turned off after the transaction was started.  Ticket #615 */
++#ifndef NDEBUG
++      {
++        /* Make sure the pPager->nRec counter we are keeping agrees
++        ** with the nRec computed from the size of the journal file.
++        */
++        off_t hdrSz, pgSz, jSz;
++        hdrSz = JOURNAL_HDR_SZ(journal_format);
++        pgSz = JOURNAL_PG_SZ(journal_format);
++        rc = sqliteOsFileSize(&pPager->jfd, &jSz);
++        if( rc!=0 ) return rc;
++        assert( pPager->nRec*pgSz+hdrSz==jSz );
++      }
++#endif
++      if( journal_format>=3 ){
++        /* Write the nRec value into the journal file header */
++        off_t szJ;
++        if( pPager->fullSync ){
++          TRACE1("SYNC\n");
++          rc = sqliteOsSync(&pPager->jfd);
++          if( rc!=0 ) return rc;
++        }
++        sqliteOsSeek(&pPager->jfd, sizeof(aJournalMagic1));
++        rc = write32bits(&pPager->jfd, pPager->nRec);
++        if( rc ) return rc;
++        szJ = JOURNAL_HDR_SZ(journal_format) +
++                 pPager->nRec*JOURNAL_PG_SZ(journal_format);
++        sqliteOsSeek(&pPager->jfd, szJ);
++      }
++      TRACE1("SYNC\n");
++      rc = sqliteOsSync(&pPager->jfd);
++      if( rc!=0 ) return rc;
++      pPager->journalStarted = 1;
++    }
++    pPager->needSync = 0;
++
++    /* Erase the needSync flag from every page.
++    */
++    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
++      pPg->needSync = 0;
++    }
++    pPager->pFirstSynced = pPager->pFirst;
++  }
++
++#ifndef NDEBUG
++  /* If the Pager.needSync flag is clear then the PgHdr.needSync
++  ** flag must also be clear for all pages.  Verify that this
++  ** invariant is true.
++  */
++  else{
++    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
++      assert( pPg->needSync==0 );
++    }
++    assert( pPager->pFirstSynced==pPager->pFirst );
++  }
++#endif
++
++  return rc;
++}
++
++/*
++** Given a list of pages (connected by the PgHdr.pDirty pointer) write
++** every one of those pages out to the database file and mark them all
++** as clean.
++*/
++static int pager_write_pagelist(PgHdr *pList){
++  Pager *pPager;
++  int rc;
++
++  if( pList==0 ) return SQLITE_OK;
++  pPager = pList->pPager;
++  while( pList ){
++    assert( pList->dirty );
++    sqliteOsSeek(&pPager->fd, (pList->pgno-1)*(off_t)SQLITE_PAGE_SIZE);
++    CODEC(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6);
++    TRACE2("STORE %d\n", pList->pgno);
++    rc = sqliteOsWrite(&pPager->fd, PGHDR_TO_DATA(pList), SQLITE_PAGE_SIZE);
++    CODEC(pPager, PGHDR_TO_DATA(pList), pList->pgno, 0);
++    if( rc ) return rc;
++    pList->dirty = 0;
++    pList = pList->pDirty;
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Collect every dirty page into a dirty list and
++** return a pointer to the head of that list.  All pages are
++** collected even if they are still in use.
++*/
++static PgHdr *pager_get_all_dirty_pages(Pager *pPager){
++  PgHdr *p, *pList;
++  pList = 0;
++  for(p=pPager->pAll; p; p=p->pNextAll){
++    if( p->dirty ){
++      p->pDirty = pList;
++      pList = p;
++    }
++  }
++  return pList;
++}
++
++/*
++** Acquire a page.
++**
++** A read lock on the disk file is obtained when the first page is acquired. 
++** This read lock is dropped when the last page is released.
++**
++** A _get works for any page number greater than 0.  If the database
++** file is smaller than the requested page, then no actual disk
++** read occurs and the memory image of the page is initialized to
++** all zeros.  The extra data appended to a page is always initialized
++** to zeros the first time a page is loaded into memory.
++**
++** The acquisition might fail for several reasons.  In all cases,
++** an appropriate error code is returned and *ppPage is set to NULL.
++**
++** See also sqlitepager_lookup().  Both this routine and _lookup() attempt
++** to find a page in the in-memory cache first.  If the page is not already
++** in memory, this routine goes to disk to read it in whereas _lookup()
++** just returns 0.  This routine acquires a read-lock the first time it
++** has to go to disk, and could also playback an old journal if necessary.
++** Since _lookup() never goes to disk, it never has to deal with locks
++** or journal files.
++*/
++int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
++  PgHdr *pPg;
++  int rc;
++
++  /* Make sure we have not hit any critical errors.
++  */ 
++  assert( pPager!=0 );
++  assert( pgno!=0 );
++  *ppPage = 0;
++  if( pPager->errMask & ~(PAGER_ERR_FULL) ){
++    return pager_errcode(pPager);
++  }
++
++  /* If this is the first page accessed, then get a read lock
++  ** on the database file.
++  */
++  if( pPager->nRef==0 ){
++    rc = sqliteOsReadLock(&pPager->fd);
++    if( rc!=SQLITE_OK ){
++      return rc;
++    }
++    pPager->state = SQLITE_READLOCK;
++
++    /* If a journal file exists, try to play it back.
++    */
++    if( pPager->useJournal && sqliteOsFileExists(pPager->zJournal) ){
++       int rc;
++
++       /* Get a write lock on the database
++       */
++       rc = sqliteOsWriteLock(&pPager->fd);
++       if( rc!=SQLITE_OK ){
++         if( sqliteOsUnlock(&pPager->fd)!=SQLITE_OK ){
++           /* This should never happen! */
++           rc = SQLITE_INTERNAL;
++         }
++         return rc;
++       }
++       pPager->state = SQLITE_WRITELOCK;
++
++       /* Open the journal for reading only.  Return SQLITE_BUSY if
++       ** we are unable to open the journal file. 
++       **
++       ** The journal file does not need to be locked itself.  The
++       ** journal file is never open unless the main database file holds
++       ** a write lock, so there is never any chance of two or more
++       ** processes opening the journal at the same time.
++       */
++       rc = sqliteOsOpenReadOnly(pPager->zJournal, &pPager->jfd);
++       if( rc!=SQLITE_OK ){
++         rc = sqliteOsUnlock(&pPager->fd);
++         assert( rc==SQLITE_OK );
++         return SQLITE_BUSY;
++       }
++       pPager->journalOpen = 1;
++       pPager->journalStarted = 0;
++
++       /* Playback and delete the journal.  Drop the database write
++       ** lock and reacquire the read lock.
++       */
++       rc = pager_playback(pPager, 0);
++       if( rc!=SQLITE_OK ){
++         return rc;
++       }
++    }
++    pPg = 0;
++  }else{
++    /* Search for page in cache */
++    pPg = pager_lookup(pPager, pgno);
++  }
++  if( pPg==0 ){
++    /* The requested page is not in the page cache. */
++    int h;
++    pPager->nMiss++;
++    if( pPager->nPage<pPager->mxPage || pPager->pFirst==0 ){
++      /* Create a new page */
++      pPg = sqliteMallocRaw( sizeof(*pPg) + SQLITE_PAGE_SIZE 
++                              + sizeof(u32) + pPager->nExtra );
++      if( pPg==0 ){
++        pager_unwritelock(pPager);
++        pPager->errMask |= PAGER_ERR_MEM;
++        return SQLITE_NOMEM;
++      }
++      memset(pPg, 0, sizeof(*pPg));
++      pPg->pPager = pPager;
++      pPg->pNextAll = pPager->pAll;
++      if( pPager->pAll ){
++        pPager->pAll->pPrevAll = pPg;
++      }
++      pPg->pPrevAll = 0;
++      pPager->pAll = pPg;
++      pPager->nPage++;
++    }else{
++      /* Find a page to recycle.  Try to locate a page that does not
++      ** require us to do an fsync() on the journal.
++      */
++      pPg = pPager->pFirstSynced;
++
++      /* If we could not find a page that does not require an fsync()
++      ** on the journal file then fsync the journal file.  This is a
++      ** very slow operation, so we work hard to avoid it.  But sometimes
++      ** it can't be helped.
++      */
++      if( pPg==0 ){
++        int rc = syncJournal(pPager);
++        if( rc!=0 ){
++          sqlitepager_rollback(pPager);
++          return SQLITE_IOERR;
++        }
++        pPg = pPager->pFirst;
++      }
++      assert( pPg->nRef==0 );
++
++      /* Write the page to the database file if it is dirty.
++      */
++      if( pPg->dirty ){
++        assert( pPg->needSync==0 );
++        pPg->pDirty = 0;
++        rc = pager_write_pagelist( pPg );
++        if( rc!=SQLITE_OK ){
++          sqlitepager_rollback(pPager);
++          return SQLITE_IOERR;
++        }
++      }
++      assert( pPg->dirty==0 );
++
++      /* If the page we are recycling is marked as alwaysRollback, then
++      ** set the global alwaysRollback flag, thus disabling the
++      ** sqlite_dont_rollback() optimization for the rest of this transaction.
++      ** It is necessary to do this because the page marked alwaysRollback
++      ** might be reloaded at a later time but at that point we won't remember
++      ** that is was marked alwaysRollback.  This means that all pages must
++      ** be marked as alwaysRollback from here on out.
++      */
++      if( pPg->alwaysRollback ){
++        pPager->alwaysRollback = 1;
++      }
++
++      /* Unlink the old page from the free list and the hash table
++      */
++      if( pPg==pPager->pFirstSynced ){
++        PgHdr *p = pPg->pNextFree;
++        while( p && p->needSync ){ p = p->pNextFree; }
++        pPager->pFirstSynced = p;
++      }
++      if( pPg->pPrevFree ){
++        pPg->pPrevFree->pNextFree = pPg->pNextFree;
++      }else{
++        assert( pPager->pFirst==pPg );
++        pPager->pFirst = pPg->pNextFree;
++      }
++      if( pPg->pNextFree ){
++        pPg->pNextFree->pPrevFree = pPg->pPrevFree;
++      }else{
++        assert( pPager->pLast==pPg );
++        pPager->pLast = pPg->pPrevFree;
++      }
++      pPg->pNextFree = pPg->pPrevFree = 0;
++      if( pPg->pNextHash ){
++        pPg->pNextHash->pPrevHash = pPg->pPrevHash;
++      }
++      if( pPg->pPrevHash ){
++        pPg->pPrevHash->pNextHash = pPg->pNextHash;
++      }else{
++        h = pager_hash(pPg->pgno);
++        assert( pPager->aHash[h]==pPg );
++        pPager->aHash[h] = pPg->pNextHash;
++      }
++      pPg->pNextHash = pPg->pPrevHash = 0;
++      pPager->nOvfl++;
++    }
++    pPg->pgno = pgno;
++    if( pPager->aInJournal && (int)pgno<=pPager->origDbSize ){
++      sqliteCheckMemory(pPager->aInJournal, pgno/8);
++      assert( pPager->journalOpen );
++      pPg->inJournal = (pPager->aInJournal[pgno/8] & (1<<(pgno&7)))!=0;
++      pPg->needSync = 0;
++    }else{
++      pPg->inJournal = 0;
++      pPg->needSync = 0;
++    }
++    if( pPager->aInCkpt && (int)pgno<=pPager->ckptSize
++             && (pPager->aInCkpt[pgno/8] & (1<<(pgno&7)))!=0 ){
++      page_add_to_ckpt_list(pPg);
++    }else{
++      page_remove_from_ckpt_list(pPg);
++    }
++    pPg->dirty = 0;
++    pPg->nRef = 1;
++    REFINFO(pPg);
++    pPager->nRef++;
++    h = pager_hash(pgno);
++    pPg->pNextHash = pPager->aHash[h];
++    pPager->aHash[h] = pPg;
++    if( pPg->pNextHash ){
++      assert( pPg->pNextHash->pPrevHash==0 );
++      pPg->pNextHash->pPrevHash = pPg;
++    }
++    if( pPager->nExtra>0 ){
++      memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra);
++    }
++    if( pPager->dbSize<0 ) sqlitepager_pagecount(pPager);
++    if( pPager->errMask!=0 ){
++      sqlitepager_unref(PGHDR_TO_DATA(pPg));
++      rc = pager_errcode(pPager);
++      return rc;
++    }
++    if( pPager->dbSize<(int)pgno ){
++      memset(PGHDR_TO_DATA(pPg), 0, SQLITE_PAGE_SIZE);
++    }else{
++      int rc;
++      sqliteOsSeek(&pPager->fd, (pgno-1)*(off_t)SQLITE_PAGE_SIZE);
++      rc = sqliteOsRead(&pPager->fd, PGHDR_TO_DATA(pPg), SQLITE_PAGE_SIZE);
++      TRACE2("FETCH %d\n", pPg->pgno);
++      CODEC(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
++      if( rc!=SQLITE_OK ){
++        off_t fileSize;
++        if( sqliteOsFileSize(&pPager->fd,&fileSize)!=SQLITE_OK
++               || fileSize>=pgno*SQLITE_PAGE_SIZE ){
++          sqlitepager_unref(PGHDR_TO_DATA(pPg));
++          return rc;
++        }else{
++          memset(PGHDR_TO_DATA(pPg), 0, SQLITE_PAGE_SIZE);
++        }
++      }
++    }
++  }else{
++    /* The requested page is in the page cache. */
++    pPager->nHit++;
++    page_ref(pPg);
++  }
++  *ppPage = PGHDR_TO_DATA(pPg);
++  return SQLITE_OK;
++}
++
++/*
++** Acquire a page if it is already in the in-memory cache.  Do
++** not read the page from disk.  Return a pointer to the page,
++** or 0 if the page is not in cache.
++**
++** See also sqlitepager_get().  The difference between this routine
++** and sqlitepager_get() is that _get() will go to the disk and read
++** in the page if the page is not already in cache.  This routine
++** returns NULL if the page is not in cache or if a disk I/O error 
++** has ever happened.
++*/
++void *sqlitepager_lookup(Pager *pPager, Pgno pgno){
++  PgHdr *pPg;
++
++  assert( pPager!=0 );
++  assert( pgno!=0 );
++  if( pPager->errMask & ~(PAGER_ERR_FULL) ){
++    return 0;
++  }
++  /* if( pPager->nRef==0 ){
++  **  return 0;
++  ** }
++  */
++  pPg = pager_lookup(pPager, pgno);
++  if( pPg==0 ) return 0;
++  page_ref(pPg);
++  return PGHDR_TO_DATA(pPg);
++}
++
++/*
++** Release a page.
++**
++** If the number of references to the page drop to zero, then the
++** page is added to the LRU list.  When all references to all pages
++** are released, a rollback occurs and the lock on the database is
++** removed.
++*/
++int sqlitepager_unref(void *pData){
++  PgHdr *pPg;
++
++  /* Decrement the reference count for this page
++  */
++  pPg = DATA_TO_PGHDR(pData);
++  assert( pPg->nRef>0 );
++  pPg->nRef--;
++  REFINFO(pPg);
++
++  /* When the number of references to a page reach 0, call the
++  ** destructor and add the page to the freelist.
++  */
++  if( pPg->nRef==0 ){
++    Pager *pPager;
++    pPager = pPg->pPager;
++    pPg->pNextFree = 0;
++    pPg->pPrevFree = pPager->pLast;
++    pPager->pLast = pPg;
++    if( pPg->pPrevFree ){
++      pPg->pPrevFree->pNextFree = pPg;
++    }else{
++      pPager->pFirst = pPg;
++    }
++    if( pPg->needSync==0 && pPager->pFirstSynced==0 ){
++      pPager->pFirstSynced = pPg;
++    }
++    if( pPager->xDestructor ){
++      pPager->xDestructor(pData);
++    }
++  
++    /* When all pages reach the freelist, drop the read lock from
++    ** the database file.
++    */
++    pPager->nRef--;
++    assert( pPager->nRef>=0 );
++    if( pPager->nRef==0 ){
++      pager_reset(pPager);
++    }
++  }
++  return SQLITE_OK;
++}
++
++/*
++** Create a journal file for pPager.  There should already be a write
++** lock on the database file when this routine is called.
++**
++** Return SQLITE_OK if everything.  Return an error code and release the
++** write lock if anything goes wrong.
++*/
++static int pager_open_journal(Pager *pPager){
++  int rc;
++  assert( pPager->state==SQLITE_WRITELOCK );
++  assert( pPager->journalOpen==0 );
++  assert( pPager->useJournal );
++  sqlitepager_pagecount(pPager);
++  pPager->aInJournal = sqliteMalloc( pPager->dbSize/8 + 1 );
++  if( pPager->aInJournal==0 ){
++    sqliteOsReadLock(&pPager->fd);
++    pPager->state = SQLITE_READLOCK;
++    return SQLITE_NOMEM;
++  }
++  rc = sqliteOsOpenExclusive(pPager->zJournal, &pPager->jfd,pPager->tempFile);
++  if( rc!=SQLITE_OK ){
++    sqliteFree(pPager->aInJournal);
++    pPager->aInJournal = 0;
++    sqliteOsReadLock(&pPager->fd);
++    pPager->state = SQLITE_READLOCK;
++    return SQLITE_CANTOPEN;
++  }
++  sqliteOsOpenDirectory(pPager->zDirectory, &pPager->jfd);
++  pPager->journalOpen = 1;
++  pPager->journalStarted = 0;
++  pPager->needSync = 0;
++  pPager->alwaysRollback = 0;
++  pPager->nRec = 0;
++  if( pPager->errMask!=0 ){
++    rc = pager_errcode(pPager);
++    return rc;
++  }
++  pPager->origDbSize = pPager->dbSize;
++  if( journal_format==JOURNAL_FORMAT_3 ){
++    rc = sqliteOsWrite(&pPager->jfd, aJournalMagic3, sizeof(aJournalMagic3));
++    if( rc==SQLITE_OK ){
++      rc = write32bits(&pPager->jfd, pPager->noSync ? 0xffffffff : 0);
++    }
++    if( rc==SQLITE_OK ){
++      sqliteRandomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
++      rc = write32bits(&pPager->jfd, pPager->cksumInit);
++    }
++  }else if( journal_format==JOURNAL_FORMAT_2 ){
++    rc = sqliteOsWrite(&pPager->jfd, aJournalMagic2, sizeof(aJournalMagic2));
++  }else{
++    assert( journal_format==JOURNAL_FORMAT_1 );
++    rc = sqliteOsWrite(&pPager->jfd, aJournalMagic1, sizeof(aJournalMagic1));
++  }
++  if( rc==SQLITE_OK ){
++    rc = write32bits(&pPager->jfd, pPager->dbSize);
++  }
++  if( pPager->ckptAutoopen && rc==SQLITE_OK ){
++    rc = sqlitepager_ckpt_begin(pPager);
++  }
++  if( rc!=SQLITE_OK ){
++    rc = pager_unwritelock(pPager);
++    if( rc==SQLITE_OK ){
++      rc = SQLITE_FULL;
++    }
++  }
++  return rc;  
++}
++
++/*
++** Acquire a write-lock on the database.  The lock is removed when
++** the any of the following happen:
++**
++**   *  sqlitepager_commit() is called.
++**   *  sqlitepager_rollback() is called.
++**   *  sqlitepager_close() is called.
++**   *  sqlitepager_unref() is called to on every outstanding page.
++**
++** The parameter to this routine is a pointer to any open page of the
++** database file.  Nothing changes about the page - it is used merely
++** to acquire a pointer to the Pager structure and as proof that there
++** is already a read-lock on the database.
++**
++** A journal file is opened if this is not a temporary file.  For
++** temporary files, the opening of the journal file is deferred until
++** there is an actual need to write to the journal.
++**
++** If the database is already write-locked, this routine is a no-op.
++*/
++int sqlitepager_begin(void *pData){
++  PgHdr *pPg = DATA_TO_PGHDR(pData);
++  Pager *pPager = pPg->pPager;
++  int rc = SQLITE_OK;
++  assert( pPg->nRef>0 );
++  assert( pPager->state!=SQLITE_UNLOCK );
++  if( pPager->state==SQLITE_READLOCK ){
++    assert( pPager->aInJournal==0 );
++    rc = sqliteOsWriteLock(&pPager->fd);
++    if( rc!=SQLITE_OK ){
++      return rc;
++    }
++    pPager->state = SQLITE_WRITELOCK;
++    pPager->dirtyFile = 0;
++    TRACE1("TRANSACTION\n");
++    if( pPager->useJournal && !pPager->tempFile ){
++      rc = pager_open_journal(pPager);
++    }
++  }
++  return rc;
++}
++
++/*
++** Mark a data page as writeable.  The page is written into the journal 
++** if it is not there already.  This routine must be called before making
++** changes to a page.
++**
++** The first time this routine is called, the pager creates a new
++** journal and acquires a write lock on the database.  If the write
++** lock could not be acquired, this routine returns SQLITE_BUSY.  The
++** calling routine must check for that return value and be careful not to
++** change any page data until this routine returns SQLITE_OK.
++**
++** If the journal file could not be written because the disk is full,
++** then this routine returns SQLITE_FULL and does an immediate rollback.
++** All subsequent write attempts also return SQLITE_FULL until there
++** is a call to sqlitepager_commit() or sqlitepager_rollback() to
++** reset.
++*/
++int sqlitepager_write(void *pData){
++  PgHdr *pPg = DATA_TO_PGHDR(pData);
++  Pager *pPager = pPg->pPager;
++  int rc = SQLITE_OK;
++
++  /* Check for errors
++  */
++  if( pPager->errMask ){ 
++    return pager_errcode(pPager);
++  }
++  if( pPager->readOnly ){
++    return SQLITE_PERM;
++  }
++
++  /* Mark the page as dirty.  If the page has already been written
++  ** to the journal then we can return right away.
++  */
++  pPg->dirty = 1;
++  if( pPg->inJournal && (pPg->inCkpt || pPager->ckptInUse==0) ){
++    pPager->dirtyFile = 1;
++    return SQLITE_OK;
++  }
++
++  /* If we get this far, it means that the page needs to be
++  ** written to the transaction journal or the ckeckpoint journal
++  ** or both.
++  **
++  ** First check to see that the transaction journal exists and
++  ** create it if it does not.
++  */
++  assert( pPager->state!=SQLITE_UNLOCK );
++  rc = sqlitepager_begin(pData);
++  if( rc!=SQLITE_OK ){
++    return rc;
++  }
++  assert( pPager->state==SQLITE_WRITELOCK );
++  if( !pPager->journalOpen && pPager->useJournal ){
++    rc = pager_open_journal(pPager);
++    if( rc!=SQLITE_OK ) return rc;
++  }
++  assert( pPager->journalOpen || !pPager->useJournal );
++  pPager->dirtyFile = 1;
++
++  /* The transaction journal now exists and we have a write lock on the
++  ** main database file.  Write the current page to the transaction 
++  ** journal if it is not there already.
++  */
++  if( !pPg->inJournal && pPager->useJournal ){
++    if( (int)pPg->pgno <= pPager->origDbSize ){
++      int szPg;
++      u32 saved;
++      if( journal_format>=JOURNAL_FORMAT_3 ){
++        u32 cksum = pager_cksum(pPager, pPg->pgno, pData);
++        saved = *(u32*)PGHDR_TO_EXTRA(pPg);
++        store32bits(cksum, pPg, SQLITE_PAGE_SIZE);
++        szPg = SQLITE_PAGE_SIZE+8;
++      }else{
++        szPg = SQLITE_PAGE_SIZE+4;
++      }
++      store32bits(pPg->pgno, pPg, -4);
++      CODEC(pPager, pData, pPg->pgno, 7);
++      rc = sqliteOsWrite(&pPager->jfd, &((char*)pData)[-4], szPg);
++      TRACE3("JOURNAL %d %d\n", pPg->pgno, pPg->needSync);
++      CODEC(pPager, pData, pPg->pgno, 0);
++      if( journal_format>=JOURNAL_FORMAT_3 ){
++        *(u32*)PGHDR_TO_EXTRA(pPg) = saved;
++      }
++      if( rc!=SQLITE_OK ){
++        sqlitepager_rollback(pPager);
++        pPager->errMask |= PAGER_ERR_FULL;
++        return rc;
++      }
++      pPager->nRec++;
++      assert( pPager->aInJournal!=0 );
++      pPager->aInJournal[pPg->pgno/8] |= 1<<(pPg->pgno&7);
++      pPg->needSync = !pPager->noSync;
++      pPg->inJournal = 1;
++      if( pPager->ckptInUse ){
++        pPager->aInCkpt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
++        page_add_to_ckpt_list(pPg);
++      }
++    }else{
++      pPg->needSync = !pPager->journalStarted && !pPager->noSync;
++      TRACE3("APPEND %d %d\n", pPg->pgno, pPg->needSync);
++    }
++    if( pPg->needSync ){
++      pPager->needSync = 1;
++    }
++  }
++
++  /* If the checkpoint journal is open and the page is not in it,
++  ** then write the current page to the checkpoint journal.  Note that
++  ** the checkpoint journal always uses the simplier format 2 that lacks
++  ** checksums.  The header is also omitted from the checkpoint journal.
++  */
++  if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){
++    assert( pPg->inJournal || (int)pPg->pgno>pPager->origDbSize );
++    store32bits(pPg->pgno, pPg, -4);
++    CODEC(pPager, pData, pPg->pgno, 7);
++    rc = sqliteOsWrite(&pPager->cpfd, &((char*)pData)[-4], SQLITE_PAGE_SIZE+4);
++    TRACE2("CKPT-JOURNAL %d\n", pPg->pgno);
++    CODEC(pPager, pData, pPg->pgno, 0);
++    if( rc!=SQLITE_OK ){
++      sqlitepager_rollback(pPager);
++      pPager->errMask |= PAGER_ERR_FULL;
++      return rc;
++    }
++    pPager->ckptNRec++;
++    assert( pPager->aInCkpt!=0 );
++    pPager->aInCkpt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
++    page_add_to_ckpt_list(pPg);
++  }
++
++  /* Update the database size and return.
++  */
++  if( pPager->dbSize<(int)pPg->pgno ){
++    pPager->dbSize = pPg->pgno;
++  }
++  return rc;
++}
++
++/*
++** Return TRUE if the page given in the argument was previously passed
++** to sqlitepager_write().  In other words, return TRUE if it is ok
++** to change the content of the page.
++*/
++int sqlitepager_iswriteable(void *pData){
++  PgHdr *pPg = DATA_TO_PGHDR(pData);
++  return pPg->dirty;
++}
++
++/*
++** Replace the content of a single page with the information in the third
++** argument.
++*/
++int sqlitepager_overwrite(Pager *pPager, Pgno pgno, void *pData){
++  void *pPage;
++  int rc;
++
++  rc = sqlitepager_get(pPager, pgno, &pPage);
++  if( rc==SQLITE_OK ){
++    rc = sqlitepager_write(pPage);
++    if( rc==SQLITE_OK ){
++      memcpy(pPage, pData, SQLITE_PAGE_SIZE);
++    }
++    sqlitepager_unref(pPage);
++  }
++  return rc;
++}
++
++/*
++** A call to this routine tells the pager that it is not necessary to
++** write the information on page "pgno" back to the disk, even though
++** that page might be marked as dirty.
++**
++** The overlying software layer calls this routine when all of the data
++** on the given page is unused.  The pager marks the page as clean so
++** that it does not get written to disk.
++**
++** Tests show that this optimization, together with the
++** sqlitepager_dont_rollback() below, more than double the speed
++** of large INSERT operations and quadruple the speed of large DELETEs.
++**
++** When this routine is called, set the alwaysRollback flag to true.
++** Subsequent calls to sqlitepager_dont_rollback() for the same page
++** will thereafter be ignored.  This is necessary to avoid a problem
++** where a page with data is added to the freelist during one part of
++** a transaction then removed from the freelist during a later part
++** of the same transaction and reused for some other purpose.  When it
++** is first added to the freelist, this routine is called.  When reused,
++** the dont_rollback() routine is called.  But because the page contains
++** critical data, we still need to be sure it gets rolled back in spite
++** of the dont_rollback() call.
++*/
++void sqlitepager_dont_write(Pager *pPager, Pgno pgno){
++  PgHdr *pPg;
++
++  pPg = pager_lookup(pPager, pgno);
++  pPg->alwaysRollback = 1;
++  if( pPg && pPg->dirty && !pPager->ckptInUse ){
++    if( pPager->dbSize==(int)pPg->pgno && pPager->origDbSize<pPager->dbSize ){
++      /* If this pages is the last page in the file and the file has grown
++      ** during the current transaction, then do NOT mark the page as clean.
++      ** When the database file grows, we must make sure that the last page
++      ** gets written at least once so that the disk file will be the correct
++      ** size. If you do not write this page and the size of the file
++      ** on the disk ends up being too small, that can lead to database
++      ** corruption during the next transaction.
++      */
++    }else{
++      TRACE2("DONT_WRITE %d\n", pgno);
++      pPg->dirty = 0;
++    }
++  }
++}
++
++/*
++** A call to this routine tells the pager that if a rollback occurs,
++** it is not necessary to restore the data on the given page.  This
++** means that the pager does not have to record the given page in the
++** rollback journal.
++*/
++void sqlitepager_dont_rollback(void *pData){
++  PgHdr *pPg = DATA_TO_PGHDR(pData);
++  Pager *pPager = pPg->pPager;
++
++  if( pPager->state!=SQLITE_WRITELOCK || pPager->journalOpen==0 ) return;
++  if( pPg->alwaysRollback || pPager->alwaysRollback ) return;
++  if( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize ){
++    assert( pPager->aInJournal!=0 );
++    pPager->aInJournal[pPg->pgno/8] |= 1<<(pPg->pgno&7);
++    pPg->inJournal = 1;
++    if( pPager->ckptInUse ){
++      pPager->aInCkpt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
++      page_add_to_ckpt_list(pPg);
++    }
++    TRACE2("DONT_ROLLBACK %d\n", pPg->pgno);
++  }
++  if( pPager->ckptInUse && !pPg->inCkpt && (int)pPg->pgno<=pPager->ckptSize ){
++    assert( pPg->inJournal || (int)pPg->pgno>pPager->origDbSize );
++    assert( pPager->aInCkpt!=0 );
++    pPager->aInCkpt[pPg->pgno/8] |= 1<<(pPg->pgno&7);
++    page_add_to_ckpt_list(pPg);
++  }
++}
++
++/*
++** Commit all changes to the database and release the write lock.
++**
++** If the commit fails for any reason, a rollback attempt is made
++** and an error code is returned.  If the commit worked, SQLITE_OK
++** is returned.
++*/
++int sqlitepager_commit(Pager *pPager){
++  int rc;
++  PgHdr *pPg;
++
++  if( pPager->errMask==PAGER_ERR_FULL ){
++    rc = sqlitepager_rollback(pPager);
++    if( rc==SQLITE_OK ){
++      rc = SQLITE_FULL;
++    }
++    return rc;
++  }
++  if( pPager->errMask!=0 ){
++    rc = pager_errcode(pPager);
++    return rc;
++  }
++  if( pPager->state!=SQLITE_WRITELOCK ){
++    return SQLITE_ERROR;
++  }
++  TRACE1("COMMIT\n");
++  if( pPager->dirtyFile==0 ){
++    /* Exit early (without doing the time-consuming sqliteOsSync() calls)
++    ** if there have been no changes to the database file. */
++    assert( pPager->needSync==0 );
++    rc = pager_unwritelock(pPager);
++    pPager->dbSize = -1;
++    return rc;
++  }
++  assert( pPager->journalOpen );
++  rc = syncJournal(pPager);
++  if( rc!=SQLITE_OK ){
++    goto commit_abort;
++  }
++  pPg = pager_get_all_dirty_pages(pPager);
++  if( pPg ){
++    rc = pager_write_pagelist(pPg);
++    if( rc || (!pPager->noSync && sqliteOsSync(&pPager->fd)!=SQLITE_OK) ){
++      goto commit_abort;
++    }
++  }
++  rc = pager_unwritelock(pPager);
++  pPager->dbSize = -1;
++  return rc;
++
++  /* Jump here if anything goes wrong during the commit process.
++  */
++commit_abort:
++  rc = sqlitepager_rollback(pPager);
++  if( rc==SQLITE_OK ){
++    rc = SQLITE_FULL;
++  }
++  return rc;
++}
++
++/*
++** Rollback all changes.  The database falls back to read-only mode.
++** All in-memory cache pages revert to their original data contents.
++** The journal is deleted.
++**
++** This routine cannot fail unless some other process is not following
++** the correct locking protocol (SQLITE_PROTOCOL) or unless some other
++** process is writing trash into the journal file (SQLITE_CORRUPT) or
++** unless a prior malloc() failed (SQLITE_NOMEM).  Appropriate error
++** codes are returned for all these occasions.  Otherwise,
++** SQLITE_OK is returned.
++*/
++int sqlitepager_rollback(Pager *pPager){
++  int rc;
++  TRACE1("ROLLBACK\n");
++  if( !pPager->dirtyFile || !pPager->journalOpen ){
++    rc = pager_unwritelock(pPager);
++    pPager->dbSize = -1;
++    return rc;
++  }
++
++  if( pPager->errMask!=0 && pPager->errMask!=PAGER_ERR_FULL ){
++    if( pPager->state>=SQLITE_WRITELOCK ){
++      pager_playback(pPager, 1);
++    }
++    return pager_errcode(pPager);
++  }
++  if( pPager->state!=SQLITE_WRITELOCK ){
++    return SQLITE_OK;
++  }
++  rc = pager_playback(pPager, 1);
++  if( rc!=SQLITE_OK ){
++    rc = SQLITE_CORRUPT;
++    pPager->errMask |= PAGER_ERR_CORRUPT;
++  }
++  pPager->dbSize = -1;
++  return rc;
++}
++
++/*
++** Return TRUE if the database file is opened read-only.  Return FALSE
++** if the database is (in theory) writable.
++*/
++int sqlitepager_isreadonly(Pager *pPager){
++  return pPager->readOnly;
++}
++
++/*
++** This routine is used for testing and analysis only.
++*/
++int *sqlitepager_stats(Pager *pPager){
++  static int a[9];
++  a[0] = pPager->nRef;
++  a[1] = pPager->nPage;
++  a[2] = pPager->mxPage;
++  a[3] = pPager->dbSize;
++  a[4] = pPager->state;
++  a[5] = pPager->errMask;
++  a[6] = pPager->nHit;
++  a[7] = pPager->nMiss;
++  a[8] = pPager->nOvfl;
++  return a;
++}
++
++/*
++** Set the checkpoint.
++**
++** This routine should be called with the transaction journal already
++** open.  A new checkpoint journal is created that can be used to rollback
++** changes of a single SQL command within a larger transaction.
++*/
++int sqlitepager_ckpt_begin(Pager *pPager){
++  int rc;
++  char zTemp[SQLITE_TEMPNAME_SIZE];
++  if( !pPager->journalOpen ){
++    pPager->ckptAutoopen = 1;
++    return SQLITE_OK;
++  }
++  assert( pPager->journalOpen );
++  assert( !pPager->ckptInUse );
++  pPager->aInCkpt = sqliteMalloc( pPager->dbSize/8 + 1 );
++  if( pPager->aInCkpt==0 ){
++    sqliteOsReadLock(&pPager->fd);
++    return SQLITE_NOMEM;
++  }
++#ifndef NDEBUG
++  rc = sqliteOsFileSize(&pPager->jfd, &pPager->ckptJSize);
++  if( rc ) goto ckpt_begin_failed;
++  assert( pPager->ckptJSize == 
++    pPager->nRec*JOURNAL_PG_SZ(journal_format)+JOURNAL_HDR_SZ(journal_format) );
++#endif
++  pPager->ckptJSize = pPager->nRec*JOURNAL_PG_SZ(journal_format)
++                         + JOURNAL_HDR_SZ(journal_format);
++  pPager->ckptSize = pPager->dbSize;
++  if( !pPager->ckptOpen ){
++    rc = sqlitepager_opentemp(zTemp, &pPager->cpfd);
++    if( rc ) goto ckpt_begin_failed;
++    pPager->ckptOpen = 1;
++    pPager->ckptNRec = 0;
++  }
++  pPager->ckptInUse = 1;
++  return SQLITE_OK;
++ 
++ckpt_begin_failed:
++  if( pPager->aInCkpt ){
++    sqliteFree(pPager->aInCkpt);
++    pPager->aInCkpt = 0;
++  }
++  return rc;
++}
++
++/*
++** Commit a checkpoint.
++*/
++int sqlitepager_ckpt_commit(Pager *pPager){
++  if( pPager->ckptInUse ){
++    PgHdr *pPg, *pNext;
++    sqliteOsSeek(&pPager->cpfd, 0);
++    /* sqliteOsTruncate(&pPager->cpfd, 0); */
++    pPager->ckptNRec = 0;
++    pPager->ckptInUse = 0;
++    sqliteFree( pPager->aInCkpt );
++    pPager->aInCkpt = 0;
++    for(pPg=pPager->pCkpt; pPg; pPg=pNext){
++      pNext = pPg->pNextCkpt;
++      assert( pPg->inCkpt );
++      pPg->inCkpt = 0;
++      pPg->pPrevCkpt = pPg->pNextCkpt = 0;
++    }
++    pPager->pCkpt = 0;
++  }
++  pPager->ckptAutoopen = 0;
++  return SQLITE_OK;
++}
++
++/*
++** Rollback a checkpoint.
++*/
++int sqlitepager_ckpt_rollback(Pager *pPager){
++  int rc;
++  if( pPager->ckptInUse ){
++    rc = pager_ckpt_playback(pPager);
++    sqlitepager_ckpt_commit(pPager);
++  }else{
++    rc = SQLITE_OK;
++  }
++  pPager->ckptAutoopen = 0;
++  return rc;
++}
++
++/*
++** Return the full pathname of the database file.
++*/
++const char *sqlitepager_filename(Pager *pPager){
++  return pPager->zFilename;
++}
++
++/*
++** Set the codec for this pager
++*/
++void sqlitepager_set_codec(
++  Pager *pPager,
++  void (*xCodec)(void*,void*,Pgno,int),
++  void *pCodecArg
++){
++  pPager->xCodec = xCodec;
++  pPager->pCodecArg = pCodecArg;
++}
++
++#ifdef SQLITE_TEST
++/*
++** Print a listing of all referenced pages and their ref count.
++*/
++void sqlitepager_refdump(Pager *pPager){
++  PgHdr *pPg;
++  for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
++    if( pPg->nRef<=0 ) continue;
++    printf("PAGE %3d addr=0x%08x nRef=%d\n", 
++       pPg->pgno, (int)PGHDR_TO_DATA(pPg), pPg->nRef);
++  }
++}
++#endif
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/pager.h
+@@ -0,0 +1,107 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This header file defines the interface that the sqlite page cache
++** subsystem.  The page cache subsystem reads and writes a file a page
++** at a time and provides a journal for rollback.
++**
++** @(#) $Id$
++*/
++
++/*
++** The size of one page
++**
++** You can change this value to another (reasonable) value you want.
++** It need not be a power of two, though the interface to the disk
++** will likely be faster if it is.
++**
++** Experiments show that a page size of 1024 gives the best speed
++** for common usages.  The speed differences for different sizes
++** such as 512, 2048, 4096, an so forth, is minimal.  Note, however,
++** that changing the page size results in a completely imcompatible
++** file format.
++*/
++#ifndef SQLITE_PAGE_SIZE
++#define SQLITE_PAGE_SIZE 1024
++#endif
++
++/*
++** Number of extra bytes of data allocated at the end of each page and
++** stored on disk but not used by the higher level btree layer.  Changing
++** this value results in a completely incompatible file format.
++*/
++#ifndef SQLITE_PAGE_RESERVE
++#define SQLITE_PAGE_RESERVE 0
++#endif
++
++/*
++** The total number of usable bytes stored on disk for each page.
++** The usable bytes come at the beginning of the page and the reserve
++** bytes come at the end.
++*/
++#define SQLITE_USABLE_SIZE (SQLITE_PAGE_SIZE-SQLITE_PAGE_RESERVE)
++
++/*
++** Maximum number of pages in one database.  (This is a limitation of
++** imposed by 4GB files size limits.)
++*/
++#define SQLITE_MAX_PAGE 1073741823
++
++/*
++** The type used to represent a page number.  The first page in a file
++** is called page 1.  0 is used to represent "not a page".
++*/
++typedef unsigned int Pgno;
++
++/*
++** Each open file is managed by a separate instance of the "Pager" structure.
++*/
++typedef struct Pager Pager;
++
++/*
++** See source code comments for a detailed description of the following
++** routines:
++*/
++int sqlitepager_open(Pager **ppPager, const char *zFilename,
++                     int nPage, int nExtra, int useJournal);
++void sqlitepager_set_destructor(Pager*, void(*)(void*));
++void sqlitepager_set_cachesize(Pager*, int);
++int sqlitepager_close(Pager *pPager);
++int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage);
++void *sqlitepager_lookup(Pager *pPager, Pgno pgno);
++int sqlitepager_ref(void*);
++int sqlitepager_unref(void*);
++Pgno sqlitepager_pagenumber(void*);
++int sqlitepager_write(void*);
++int sqlitepager_iswriteable(void*);
++int sqlitepager_overwrite(Pager *pPager, Pgno pgno, void*);
++int sqlitepager_pagecount(Pager*);
++int sqlitepager_truncate(Pager*,Pgno);
++int sqlitepager_begin(void*);
++int sqlitepager_commit(Pager*);
++int sqlitepager_rollback(Pager*);
++int sqlitepager_isreadonly(Pager*);
++int sqlitepager_ckpt_begin(Pager*);
++int sqlitepager_ckpt_commit(Pager*);
++int sqlitepager_ckpt_rollback(Pager*);
++void sqlitepager_dont_rollback(void*);
++void sqlitepager_dont_write(Pager*, Pgno);
++int *sqlitepager_stats(Pager*);
++void sqlitepager_set_safety_level(Pager*,int);
++const char *sqlitepager_filename(Pager*);
++int sqlitepager_rename(Pager*, const char *zNewName);
++void sqlitepager_set_codec(Pager*,void(*)(void*,void*,Pgno,int),void*);
++
++#ifdef SQLITE_TEST
++void sqlitepager_refdump(Pager*);
++int pager_refinfo_enable;
++int journal_format;
++#endif
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/parse.c
+@@ -0,0 +1,3355 @@
++/* Driver template for the LEMON parser generator.
++** The author disclaims copyright to this source code.
++*/
++/* First off, code is included that follows the "include" declaration
++** in the input grammar file. */
++#include <stdio.h>
++#line 33 "ext/sqlite/libsqlite/src/parse.y"
++
++#include "sqliteInt.h"
++#include "parse.h"
++
++/*
++** An instance of this structure holds information about the
++** LIMIT clause of a SELECT statement.
++*/
++struct LimitVal {
++  int limit;    /* The LIMIT value.  -1 if there is no limit */
++  int offset;   /* The OFFSET.  0 if there is none */
++};
++
++/*
++** An instance of the following structure describes the event of a
++** TRIGGER.  "a" is the event type, one of TK_UPDATE, TK_INSERT,
++** TK_DELETE, or TK_INSTEAD.  If the event is of the form
++**
++**      UPDATE ON (a,b,c)
++**
++** Then the "b" IdList records the list "a,b,c".
++*/
++struct TrigEvent { int a; IdList * b; };
++
++#line 33 "ext/sqlite/libsqlite/src/parse.c"
++/* Next is all token values, in a form suitable for use by makeheaders.
++** This section will be null unless lemon is run with the -m switch.
++*/
++/* 
++** These constants (all generated automatically by the parser generator)
++** specify the various kinds of tokens (terminals) that the parser
++** understands. 
++**
++** Each symbol here is a terminal symbol in the grammar.
++*/
++/* Make sure the INTERFACE macro is defined.
++*/
++#ifndef INTERFACE
++# define INTERFACE 1
++#endif
++/* The next thing included is series of defines which control
++** various aspects of the generated parser.
++**    YYCODETYPE         is the data type used for storing terminal
++**                       and nonterminal numbers.  "unsigned char" is
++**                       used if there are fewer than 250 terminals
++**                       and nonterminals.  "int" is used otherwise.
++**    YYNOCODE           is a number of type YYCODETYPE which corresponds
++**                       to no legal terminal or nonterminal number.  This
++**                       number is used to fill in empty slots of the hash 
++**                       table.
++**    YYFALLBACK         If defined, this indicates that one or more tokens
++**                       have fall-back values which should be used if the
++**                       original value of the token will not parse.
++**    YYACTIONTYPE       is the data type used for storing terminal
++**                       and nonterminal numbers.  "unsigned char" is
++**                       used if there are fewer than 250 rules and
++**                       states combined.  "int" is used otherwise.
++**    sqliteParserTOKENTYPE     is the data type used for minor tokens given 
++**                       directly to the parser from the tokenizer.
++**    YYMINORTYPE        is the data type used for all minor tokens.
++**                       This is typically a union of many types, one of
++**                       which is sqliteParserTOKENTYPE.  The entry in the union
++**                       for base tokens is called "yy0".
++**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
++**                       zero the stack is dynamically sized using realloc()
++**    sqliteParserARG_SDECL     A static variable declaration for the %extra_argument
++**    sqliteParserARG_PDECL     A parameter declaration for the %extra_argument
++**    sqliteParserARG_STORE     Code to store %extra_argument into yypParser
++**    sqliteParserARG_FETCH     Code to extract %extra_argument from yypParser
++**    YYNSTATE           the combined number of states.
++**    YYNRULE            the number of rules in the grammar
++**    YYERRORSYMBOL      is the code number of the error symbol.  If not
++**                       defined, then do no error processing.
++*/
++#define YYCODETYPE unsigned char
++#define YYNOCODE 221
++#define YYACTIONTYPE unsigned short int
++#define sqliteParserTOKENTYPE Token
++typedef union {
++  int yyinit;
++  sqliteParserTOKENTYPE yy0;
++  TriggerStep * yy19;
++  struct LimitVal yy124;
++  Select* yy179;
++  Expr * yy182;
++  Expr* yy242;
++  struct TrigEvent yy290;
++  SrcList* yy307;
++  IdList* yy320;
++  ExprList* yy322;
++  int yy372;
++  struct {int value; int mask;} yy407;
++} YYMINORTYPE;
++#ifndef YYSTACKDEPTH
++#define YYSTACKDEPTH 100
++#endif
++#define sqliteParserARG_SDECL Parse *pParse;
++#define sqliteParserARG_PDECL ,Parse *pParse
++#define sqliteParserARG_FETCH Parse *pParse = yypParser->pParse
++#define sqliteParserARG_STORE yypParser->pParse = pParse
++#define YYNSTATE 563
++#define YYNRULE 293
++#define YYFALLBACK 1
++#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
++#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
++#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
++
++/* The yyzerominor constant is used to initialize instances of
++** YYMINORTYPE objects to zero. */
++static const YYMINORTYPE yyzerominor = { 0 };
++
++/* Define the yytestcase() macro to be a no-op if is not already defined
++** otherwise.
++**
++** Applications can choose to define yytestcase() in the %include section
++** to a macro that can assist in verifying code coverage.  For production
++** code the yytestcase() macro should be turned off.  But it is useful
++** for testing.
++*/
++#ifndef yytestcase
++# define yytestcase(X)
++#endif
++
++
++/* Next are the tables used to determine what action to take based on the
++** current state and lookahead token.  These tables are used to implement
++** functions that take a state number and lookahead value and return an
++** action integer.  
++**
++** Suppose the action integer is N.  Then the action is determined as
++** follows
++**
++**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
++**                                      token onto the stack and goto state N.
++**
++**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
++**
++**   N == YYNSTATE+YYNRULE              A syntax error has occurred.
++**
++**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
++**
++**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
++**                                      slots in the yy_action[] table.
++**
++** The action table is constructed as a single large table named yy_action[].
++** Given state S and lookahead X, the action is computed as
++**
++**      yy_action[ yy_shift_ofst[S] + X ]
++**
++** If the index value yy_shift_ofst[S]+X is out of range or if the value
++** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
++** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
++** and that yy_default[S] should be used instead.  
++**
++** The formula above is for computing the action when the lookahead is
++** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
++** a reduce action) then the yy_reduce_ofst[] array is used in place of
++** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
++** YY_SHIFT_USE_DFLT.
++**
++** The following are the tables generated in this section:
++**
++**  yy_action[]        A single table containing all actions.
++**  yy_lookahead[]     A table containing the lookahead for each entry in
++**                     yy_action.  Used to detect hash collisions.
++**  yy_shift_ofst[]    For each state, the offset into yy_action for
++**                     shifting terminals.
++**  yy_reduce_ofst[]   For each state, the offset into yy_action for
++**                     shifting non-terminals after a reduce.
++**  yy_default[]       Default action for each state.
++*/
++#define YY_ACTTAB_COUNT (1090)
++static const YYACTIONTYPE yy_action[] = {
++ /*     0 */   186,  561,  483,   69,   67,   70,   68,   64,   63,   62,
++ /*    10 */    61,   58,   57,   56,   55,   54,   53,  181,  180,  179,
++ /*    20 */   514,  421,  334,  420,  468,  515,   64,   63,   62,   61,
++ /*    30 */    58,   57,   56,   55,   54,   53,    9,  423,  422,   71,
++ /*    40 */    72,  129,   65,   66,  513,  510,  305,   52,  138,   69,
++ /*    50 */    67,   70,   68,   64,   63,   62,   61,   58,   57,   56,
++ /*    60 */    55,   54,   53,  448,  469,  175,  482,  514,  470,  344,
++ /*    70 */   342,   36,  515,   58,   57,   56,   55,   54,   53,    8,
++ /*    80 */   341,  281,  285,  307,  437,  178,   71,   72,  129,   65,
++ /*    90 */    66,  513,  510,  305,   52,  138,   69,   67,   70,   68,
++ /*   100 */    64,   63,   62,   61,   58,   57,   56,   55,   54,   53,
++ /*   110 */   130,  362,  360,  508,  507,  267,  551,  436,  298,  297,
++ /*   120 */   369,  368,   50,  128,  543,   29,  266,  449,  537,  447,
++ /*   130 */   591,  528,  442,  441,  187,  132,  514,  536,   47,   48,
++ /*   140 */   472,  515,  122,  427,  331,  409,   49,  371,  370,  518,
++ /*   150 */   328,  363,  517,  520,   45,   71,   72,  129,   65,   66,
++ /*   160 */   513,  510,  305,   52,  138,   69,   67,   70,   68,   64,
++ /*   170 */    63,   62,   61,   58,   57,   56,   55,   54,   53,  185,
++ /*   180 */   550,  549,  512,  175,  467,  516,   18,  344,  342,   36,
++ /*   190 */   544,  175,  320,  230,  231,  344,  342,   36,  341,   56,
++ /*   200 */    55,   54,   53,  212,  531,  514,  341,  551,    3,  213,
++ /*   210 */   515,    2,  551,   73,    7,  551,  184,  132,  551,  172,
++ /*   220 */   551,  309,  348,   42,   71,   72,  129,   65,   66,  513,
++ /*   230 */   510,  305,   52,  138,   69,   67,   70,   68,   64,   63,
++ /*   240 */    62,   61,   58,   57,   56,   55,   54,   53,  243,  197,
++ /*   250 */   282,  358,  268,  373,  264,  372,  183,  241,  436,  169,
++ /*   260 */   356,  171,  269,  240,  471,  426,   29,  446,  506,  514,
++ /*   270 */   445,  550,  549,  494,  515,  354,  550,  549,  359,  550,
++ /*   280 */   549,  144,  550,  549,  550,  549,  592,  309,   71,   72,
++ /*   290 */   129,   65,   66,  513,  510,  305,   52,  138,   69,   67,
++ /*   300 */    70,   68,   64,   63,   62,   61,   58,   57,   56,   55,
++ /*   310 */    54,   53,  514,  857,   82,  377,    1,  515,  268,  373,
++ /*   320 */   264,  372,  183,  241,  362,   12,  508,  507,  500,  240,
++ /*   330 */    17,   71,   72,  129,   65,   66,  513,  510,  305,   52,
++ /*   340 */   138,   69,   67,   70,   68,   64,   63,   62,   61,   58,
++ /*   350 */    57,   56,   55,   54,   53,  362,  182,  508,  507,  514,
++ /*   360 */   362,  527,  508,  507,  515,  563,  429,  463,  182,  444,
++ /*   370 */   375,  338,  443,  430,  379,  378,  593,  156,   71,   72,
++ /*   380 */   129,   65,   66,  513,  510,  305,   52,  138,   69,   67,
++ /*   390 */    70,   68,   64,   63,   62,   61,   58,   57,   56,   55,
++ /*   400 */    54,   53,  514,  526,  542,  450,  534,  515,  286,  493,
++ /*   410 */   453,   17,  478,  240,   80,   11,  533,  153,  194,  155,
++ /*   420 */   286,   71,   51,  129,   65,   66,  513,  510,  305,   52,
++ /*   430 */   138,   69,   67,   70,   68,   64,   63,   62,   61,   58,
++ /*   440 */    57,   56,   55,   54,   53,  514,  195,  466,  160,   17,
++ /*   450 */   515,  454,  490,   80,  459,  440,  460,  176,  239,  238,
++ /*   460 */    80,   80,  562,    1,   71,   40,  129,   65,   66,  513,
++ /*   470 */   510,  305,   52,  138,   69,   67,   70,   68,   64,   63,
++ /*   480 */    62,   61,   58,   57,   56,   55,   54,   53,  514,  365,
++ /*   490 */   154,   19,  339,  515,   80,  232,  405,   80,  165,  404,
++ /*   500 */   193,   32,  396,   13,   32,   86,  414,  108,   72,  129,
++ /*   510 */    65,   66,  513,  510,  305,   52,  138,   69,   67,   70,
++ /*   520 */    68,   64,   63,   62,   61,   58,   57,   56,   55,   54,
++ /*   530 */    53,  514,  551,  365,  483,  192,  515,  488,  323,  207,
++ /*   540 */   366,  249,  177,  186,   87,  483,  483,   46,   38,   44,
++ /*   550 */   458,  108,  129,   65,   66,  513,  510,  305,   52,  138,
++ /*   560 */    69,   67,   70,   68,   64,   63,   62,   61,   58,   57,
++ /*   570 */    56,   55,   54,   53,  274,  457,  272,  271,  270,   23,
++ /*   580 */     8,  551,  211,  412,  307,  257,  365,  385,  201,   31,
++ /*   590 */   217,  388,  141,  205,  387,  219,  550,  549,  482,  511,
++ /*   600 */   215,  376,  560,  134,   90,  477,  214,  514,  392,  482,
++ /*   610 */   482,  152,  515,  360,  203,  212,  409,  531,  800,  284,
++ /*   620 */   365,  145,  505,   50,  300,  365,  365,  173,  321,  212,
++ /*   630 */   487,  137,  135,    8,   41,  136,  531,  307,   93,   47,
++ /*   640 */    48,  346,  316,  106,  106,  550,  549,   49,  371,  370,
++ /*   650 */   518,  509,  531,  517,  520,  504,  531,  531,  162,  495,
++ /*   660 */   170,  317,  503,  319,  223,  231,  360,  551,  502,  283,
++ /*   670 */   162,  207,  557,  486,  212,  191,   50,   10,  289,  304,
++ /*   680 */   303,  556,  207,  531,    8,  531,  516,   18,  307,  498,
++ /*   690 */   498,  189,   47,   48,  393,  531,  555,   28,  302,  554,
++ /*   700 */    49,  371,  370,  518,  484,  480,  517,  520,  322,  299,
++ /*   710 */   553,  418,  365,  323,   17,  365,  365,  360,  416,  207,
++ /*   720 */   322,  417,  207,  418,  327,  212,  480,   50,  207,  326,
++ /*   730 */   106,  550,  549,  106,  105,  247,  407,  475,  332,  516,
++ /*   740 */    18,  326,  365,   47,   48,  207,  295,  365,  475,  294,
++ /*   750 */   158,   49,  371,  370,  518,  293,  473,  517,  520,  485,
++ /*   760 */   106,  391,  390,  202,  148,   93,  351,  480,  204,  301,
++ /*   770 */   333,  190,  291,  541,   60,  531,  498,  252,  453,  498,
++ /*   780 */   365,  365,  290,  365,  501,  475,  365,   79,  475,  531,
++ /*   790 */   516,   18,  379,  378,  475,  365,  465,  245,   89,  112,
++ /*   800 */   365,  109,  365,  131,  121,  288,  499,  365,  365,  439,
++ /*   810 */   365,  475,  365,  120,  365,  365,  343,  365,  119,  365,
++ /*   820 */   118,  365,  365,  365,  365,  117,  116,  365,  126,  365,
++ /*   830 */   125,  365,  124,  123,  365,  115,  365,  114,  431,  140,
++ /*   840 */   139,  255,  254,  365,  365,  253,  365,  280,  365,  107,
++ /*   850 */   365,  365,  113,  365,  111,   26,  365,  365,  365,  365,
++ /*   860 */   365,  279,  278,  365,  277,  365,   92,  365,  104,  103,
++ /*   870 */   365,   91,  365,  365,  102,  101,  110,  100,   99,  347,
++ /*   880 */    25,   98,  340,   30,   24,   97,  266,  174,   96,   85,
++ /*   890 */    95,   94,  166,  292,   78,  165,  415,   14,  163,   60,
++ /*   900 */   164,   22,    6,  408,    5,   77,   34,   33,  159,   16,
++ /*   910 */   157,  151,   75,  149,   15,  146,  313,  312,  395,  384,
++ /*   920 */   143,   20,   60,  206,   21,  273,  198,  559,  375,  548,
++ /*   930 */   547,  546,  374,    4,  540,  539,  538,  308,  535,  532,
++ /*   940 */   530,  212,  261,   38,  260,  352,  259,   39,  258,  367,
++ /*   950 */   529,  196,  210,  256,  521,  522,   53,   53,  209,   43,
++ /*   960 */   496,  188,  492,  208,  256,   81,  246,   37,  479,  349,
++ /*   970 */   244,   37,  474,  464,  276,   27,  452,  451,  433,  432,
++ /*   980 */   275,  235,  234,  335,  424,   35,  329,  413,  410,  127,
++ /*   990 */   161,   84,   76,  403,   38,  400,  188,  399,  224,  398,
++ /*  1000 */    38,  150,  318,  220,   83,  147,  315,  200,  381,  383,
++ /*  1010 */   199,  142,  545,  265,   88,  262,  523,  361,  491,  476,
++ /*  1020 */   463,  406,  397,  287,  389,  386,  310,  382,  552,   74,
++ /*  1030 */   306,  525,  524,  364,  519,  357,  355,  353,  497,  489,
++ /*  1040 */   481,  263,  242,  462,  461,  456,  455,  438,  296,  345,
++ /*  1050 */   434,  237,  425,  337,  168,  167,  336,  236,  419,  330,
++ /*  1060 */   233,  325,  324,  229,  228,  402,  401,  227,  226,  225,
++ /*  1070 */   222,  221,  218,  314,  394,  311,  216,  380,  251,  250,
++ /*  1080 */   133,  350,  248,  364,  558,   59,  435,  411,  428,  212,
++};
++static const YYCODETYPE yy_lookahead[] = {
++ /*     0 */    21,    9,   23,   70,   71,   72,   73,   74,   75,   76,
++ /*    10 */    77,   78,   79,   80,   81,   82,   83,  100,  101,  102,
++ /*    20 */    41,  100,  101,  102,   20,   46,   74,   75,   76,   77,
++ /*    30 */    78,   79,   80,   81,   82,   83,   19,   55,   56,   60,
++ /*    40 */    61,   62,   63,   64,   65,   66,   67,   68,   69,   70,
++ /*    50 */    71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
++ /*    60 */    81,   82,   83,   23,  108,   90,   87,   41,  112,   94,
++ /*    70 */    95,   96,   46,   78,   79,   80,   81,   82,   83,   19,
++ /*    80 */   105,  149,  143,   23,  152,  153,   60,   61,   62,   63,
++ /*    90 */    64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
++ /*   100 */    74,   75,   76,   77,   78,   79,   80,   81,   82,   83,
++ /*   110 */    31,  107,   52,  109,  110,   93,   23,  140,   78,   79,
++ /*   120 */    78,   79,   62,   22,  147,  148,  104,   87,   34,   89,
++ /*   130 */   113,   89,   92,   93,  183,  184,   41,   43,   78,   79,
++ /*   140 */    80,   46,  165,  166,  205,   53,   86,   87,   88,   89,
++ /*   150 */   211,   62,   92,   93,  128,   60,   61,   62,   63,   64,
++ /*   160 */    65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
++ /*   170 */    75,   76,   77,   78,   79,   80,   81,   82,   83,  146,
++ /*   180 */    87,   88,   93,   90,   20,  125,  126,   94,   95,   96,
++ /*   190 */    20,   90,  100,  101,  102,   94,   95,   96,  105,   80,
++ /*   200 */    81,   82,   83,  111,  171,   41,  105,   23,   19,   48,
++ /*   210 */    46,   19,   23,   19,   19,   23,  183,  184,   23,   17,
++ /*   220 */    23,   62,  189,  128,   60,   61,   62,   63,   64,   65,
++ /*   230 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
++ /*   240 */    76,   77,   78,   79,   80,   81,   82,   83,   20,   90,
++ /*   250 */    91,   15,   93,   94,   95,   96,   97,   98,  140,   57,
++ /*   260 */    24,   59,  144,  104,   80,  147,  148,   89,   20,   41,
++ /*   270 */    92,   87,   88,   20,   46,   39,   87,   88,   42,   87,
++ /*   280 */    88,   19,   87,   88,   87,   88,  113,   62,   60,   61,
++ /*   290 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
++ /*   300 */    72,   73,   74,   75,   76,   77,   78,   79,   80,   81,
++ /*   310 */    82,   83,   41,  132,  133,  134,  135,   46,   93,   94,
++ /*   320 */    95,   96,   97,   98,  107,   63,  109,  110,   20,  104,
++ /*   330 */    22,   60,   61,   62,   63,   64,   65,   66,   67,   68,
++ /*   340 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
++ /*   350 */    79,   80,   81,   82,   83,  107,   47,  109,  110,   41,
++ /*   360 */   107,   89,  109,  110,   46,    0,  161,  162,   47,   89,
++ /*   370 */    99,   62,   92,  168,    9,   10,  113,   17,   60,   61,
++ /*   380 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
++ /*   390 */    72,   73,   74,   75,   76,   77,   78,   79,   80,   81,
++ /*   400 */    82,   83,   41,   89,  155,  156,   26,   46,   99,   20,
++ /*   410 */   161,   22,   20,  104,   22,  118,   36,   57,   22,   59,
++ /*   420 */    99,   60,   61,   62,   63,   64,   65,   66,   67,   68,
++ /*   430 */    69,   70,   71,   72,   73,   74,   75,   76,   77,   78,
++ /*   440 */    79,   80,   81,   82,   83,   41,   50,   20,   22,   22,
++ /*   450 */    46,   20,   22,   22,   91,   20,   93,   22,   20,   20,
++ /*   460 */    22,   22,  134,  135,   60,   61,   62,   63,   64,   65,
++ /*   470 */    66,   67,   68,   69,   70,   71,   72,   73,   74,   75,
++ /*   480 */    76,   77,   78,   79,   80,   81,   82,   83,   41,  140,
++ /*   490 */   130,   22,   20,   46,   22,   20,   20,   22,   22,   20,
++ /*   500 */   113,   22,   20,   19,   22,   21,   18,  158,   61,   62,
++ /*   510 */    63,   64,   65,   66,   67,   68,   69,   70,   71,   72,
++ /*   520 */    73,   74,   75,   76,   77,   78,   79,   80,   81,   82,
++ /*   530 */    83,   41,   23,  140,   23,  113,   46,   22,  140,  140,
++ /*   540 */   191,  192,   19,   21,  114,   23,   23,  127,  122,  129,
++ /*   550 */    29,  158,   62,   63,   64,   65,   66,   67,   68,   69,
++ /*   560 */    70,   71,   72,   73,   74,   75,   76,   77,   78,   79,
++ /*   570 */    80,   81,   82,   83,   11,   54,   13,   14,   15,   16,
++ /*   580 */    19,   23,  174,   95,   23,  192,  140,   78,   79,  181,
++ /*   590 */    27,   89,  146,  195,   92,   32,   87,   88,   87,   93,
++ /*   600 */    37,  136,  137,   88,  158,  206,  141,   41,   99,   87,
++ /*   610 */    87,  146,   46,   52,   51,  111,   53,  171,  130,   19,
++ /*   620 */   140,   58,   14,   62,  103,  140,  140,  146,  124,  111,
++ /*   630 */   115,  146,  146,   19,   68,   69,  171,   23,  158,   78,
++ /*   640 */    79,   80,  124,  158,  158,   87,   88,   86,   87,   88,
++ /*   650 */    89,  108,  171,   92,   93,   20,  171,  171,  146,   93,
++ /*   660 */   146,  196,   20,  100,  101,  102,   52,   23,   20,  106,
++ /*   670 */   146,  140,   15,  115,  111,   22,   62,  118,  198,  194,
++ /*   680 */   194,   24,  140,  171,   19,  171,  125,  126,   23,  204,
++ /*   690 */   204,   22,   78,   79,  140,  171,   39,   19,  167,   42,
++ /*   700 */    86,   87,   88,   89,  115,  152,   92,   93,  196,  167,
++ /*   710 */    53,  140,  140,  140,   22,  140,  140,   52,   25,  140,
++ /*   720 */   196,   28,  140,  140,  212,  111,  152,   62,  140,  217,
++ /*   730 */   158,   87,   88,  158,  158,  182,  212,  206,   45,  125,
++ /*   740 */   126,  217,  140,   78,   79,  140,  167,  140,  206,  167,
++ /*   750 */   146,   86,   87,   88,   89,  167,  182,   92,   93,  115,
++ /*   760 */   158,  207,  208,  209,  146,  158,  194,  152,  195,  194,
++ /*   770 */   199,   22,  167,  156,  200,  171,  204,  201,  161,  204,
++ /*   780 */   140,  140,  199,  140,   20,  206,  140,   20,  206,  171,
++ /*   790 */   125,  126,    9,   10,  206,  140,   20,  182,  158,  158,
++ /*   800 */   140,  158,  140,  113,  158,  198,  204,  140,  140,   20,
++ /*   810 */   140,  206,  140,  158,  140,  140,   48,  140,  158,  140,
++ /*   820 */   158,  140,  140,  140,  140,  158,  158,  140,  158,  140,
++ /*   830 */   158,  140,  158,  158,  140,  158,  140,  158,  139,  158,
++ /*   840 */   158,  158,  158,  140,  140,  158,  140,  158,  140,  158,
++ /*   850 */   140,  140,  158,  140,  158,   19,  140,  140,  140,  140,
++ /*   860 */   140,  158,  158,  140,  158,  140,  158,  140,  158,  158,
++ /*   870 */   140,  158,  140,  140,  158,  158,  158,  158,  158,  140,
++ /*   880 */    19,  158,   48,  158,   19,  158,  104,   97,  158,   21,
++ /*   890 */   158,  158,   99,   38,   49,   22,   49,  158,   99,  200,
++ /*   900 */   130,   19,   11,   14,    9,  103,   63,   63,  123,   19,
++ /*   910 */   114,  114,  103,  123,   19,  114,  116,   35,   87,   20,
++ /*   920 */    21,  150,  200,  160,  160,  138,   12,  139,   99,  138,
++ /*   930 */   138,  138,  145,   22,  139,  139,  164,   44,  139,  139,
++ /*   940 */   171,  111,  176,  122,  177,  119,  178,  120,  179,  117,
++ /*   950 */   180,  121,  193,   98,  151,   23,   83,   83,  202,  127,
++ /*   960 */   186,  113,  186,  193,   98,  186,  187,   99,  188,  116,
++ /*   970 */   187,   99,  188,  139,  159,   19,  151,  164,  139,  139,
++ /*   980 */   159,  186,  215,   40,  216,  127,  186,  139,  169,   60,
++ /*   990 */   169,  197,   19,  176,  122,  186,  113,  186,  186,  176,
++ /*  1000 */   122,  169,  186,  186,  197,  169,  186,  218,   33,  219,
++ /*  1010 */   116,  218,  142,  157,  173,  175,  157,  203,  157,  157,
++ /*  1020 */   162,  176,  176,  152,  210,  210,  152,  152,  140,  140,
++ /*  1030 */   154,  154,  154,  140,  140,  140,  140,  140,  140,  185,
++ /*  1040 */   140,  172,  140,  140,  163,  163,  163,  152,  154,  154,
++ /*  1050 */   140,  140,  140,  140,  140,  213,  214,  140,  140,  140,
++ /*  1060 */   140,  140,  140,  140,  140,  140,  140,  140,  140,  140,
++ /*  1070 */   140,  140,  140,  140,  140,  140,  140,  140,  140,  140,
++ /*  1080 */   140,  140,  140,  140,  170,  200,  166,  170,  166,  111,
++};
++#define YY_SHIFT_USE_DFLT (-84)
++#define YY_SHIFT_COUNT (376)
++#define YY_SHIFT_MIN   (-83)
++#define YY_SHIFT_MAX   (978)
++static const short yy_shift_ofst[] = {
++ /*     0 */   783,  563,  614,  614,   93,   92,   92,  978,  614,  561,
++ /*    10 */   665,  665,  509,  197,  -21,  665,  665,  665,  665,  665,
++ /*    20 */   159,  309,  197,  488,  197,  197,  197,  197,  197,  511,
++ /*    30 */   271,   60,  665,  665,  665,  665,  665,  665,  665,  665,
++ /*    40 */   665,  665,  665,  665,  665,  665,  665,  665,  665,  665,
++ /*    50 */   665,  665,  665,  665,  665,  665,  665,  665,  665,  665,
++ /*    60 */   665,  665,  665,  665,  665,  665,  665,  665,  665,  665,
++ /*    70 */   665,  665,  665,  665,  225,  197,  197,  197,  197,  522,
++ /*    80 */   197,  522,  365,  518,  504,  978,  978,  -84,  -84,  228,
++ /*    90 */   164,   95,   26,  318,  318,  318,  318,  318,  318,  318,
++ /*   100 */   318,  404,  318,  318,  318,  318,  318,  361,  318,  447,
++ /*   110 */   490,  490,  490,  -67,  -67,  -67,  -67,  -67,  -48,  -48,
++ /*   120 */   -48,  -48,  101,   -5,   -5,   -5,   -5,  657,  -25,  566,
++ /*   130 */   657,  184,  195,  644,  558,  253,  192,  248,  189,  119,
++ /*   140 */   119,    4,  197,  197,  197,  197,  197,  197,  217,  197,
++ /*   150 */   197,  197,  217,  197,  197,  197,  197,  197,  217,  197,
++ /*   160 */   197,  197,  217,  197,  197,  197,  197,  -79,  693,  197,
++ /*   170 */   217,  197,  197,  217,  197,  197,   42,   42,  523,  521,
++ /*   180 */   521,  521,  197,  197,  515,  217,  197,  515,  197,  197,
++ /*   190 */   197,  197,  197,  197,   42,   42,   42,  197,  197,  511,
++ /*   200 */   511,  502,  502,  511,  426,  426,  321,  380,  380,  420,
++ /*   210 */   380,  430,  -44,  380,  484,  975,  894,  975,  883,  929,
++ /*   220 */   973,  883,  883,  929,  878,  883,  883,  883,  872,  973,
++ /*   230 */   929,  929,  829,  848,  858,  943,  848,  956,  829,  829,
++ /*   240 */   893,  932,  956,  829,  853,  872,  853,  868,  848,  866,
++ /*   250 */   848,  848,  832,  874,  874,  873,  932,  855,  830,  832,
++ /*   260 */   827,  826,  821,  830,  829,  829,  893,  829,  829,  911,
++ /*   270 */   914,  914,  914,  829,  914,  -84,  -84,  -84,  -84,  -84,
++ /*   280 */   -84,  -84,   40,  360,  236,  202,  -83,  262,  482,  479,
++ /*   290 */   476,  475,  -18,  472,  439,  438,  435,  280,  178,  431,
++ /*   300 */   363,  427,  392,  389,  308,   89,  396,   17,   94,   22,
++ /*   310 */   899,  899,  831,  882,  800,  801,  895,  790,  809,  797,
++ /*   320 */   796,  890,  785,  844,  843,  802,  895,  889,  891,  882,
++ /*   330 */   799,  770,  847,  873,  845,  855,  793,  868,  782,  790,
++ /*   340 */   865,  834,  861,  836,  768,  789,  776,  690,  767,  678,
++ /*   350 */   589,  692,  559,  764,  669,  648,  749,  642,  653,  635,
++ /*   360 */   600,  608,  543,  506,  422,  387,  469,  297,  314,  272,
++ /*   370 */   263,  173,  194,  161,  170,   79,   -8,
++};
++#define YY_REDUCE_USE_DFLT (-69)
++#define YY_REDUCE_COUNT (281)
++#define YY_REDUCE_MIN   (-68)
++#define YY_REDUCE_MAX   (943)
++static const short yy_reduce_ofst[] = {
++ /*     0 */   181,  465,  486,  485,  -23,  524,  512,   33,  446,  575,
++ /*    10 */   572,  349,  554,  118,  574,  607,  480,  602,  576,  393,
++ /*    20 */   249,  205,  605,  -61,  588,  582,  579,  542,  531,  -68,
++ /*    30 */   699,  739,  733,  732,  730,  727,  725,  723,  720,  719,
++ /*    40 */   718,  717,  716,  713,  711,  710,  708,  706,  704,  703,
++ /*    50 */   696,  694,  691,  689,  687,  684,  683,  682,  681,  679,
++ /*    60 */   677,  675,  674,  672,  670,  668,  667,  662,  660,  655,
++ /*    70 */   646,  643,  641,  640,  617,  573,  583,  398,  571,  615,
++ /*    80 */   399,  553,  328,  618,  604,  514,  481,  -49,  408,  722,
++ /*    90 */   722,  722,  722,  722,  722,  722,  722,  722,  722,  722,
++ /*   100 */   722,  722,  722,  722,  722,  722,  722,  722,  722,  722,
++ /*   110 */   722,  722,  722,  722,  722,  722,  722,  722,  722,  722,
++ /*   120 */   722,  722,  922,  722,  722,  722,  722,  917,  920,  885,
++ /*   130 */   914,  943,  942,  941,  940,  869,  939,  869,  938,  722,
++ /*   140 */   722,  869,  937,  936,  935,  934,  933,  932,  869,  931,
++ /*   150 */   930,  929,  869,  928,  927,  926,  925,  924,  869,  923,
++ /*   160 */   922,  921,  869,  920,  919,  918,  917,  842,  842,  914,
++ /*   170 */   869,  913,  912,  869,  911,  910,  895,  894,  895,  883,
++ /*   180 */   882,  881,  903,  902,  854,  869,  900,  854,  898,  897,
++ /*   190 */   896,  895,  894,  893,  878,  877,  876,  889,  888,  875,
++ /*   200 */   874,  815,  814,  871,  846,  845,  858,  862,  861,  814,
++ /*   210 */   859,  840,  841,  856,  870,  793,  790,  789,  820,  836,
++ /*   220 */   807,  817,  816,  832,  823,  812,  811,  809,  817,  794,
++ /*   230 */   821,  819,  848,  800,  768,  767,  795,  821,  840,  839,
++ /*   240 */   813,  825,  815,  834,  784,  783,  780,  779,  779,  770,
++ /*   250 */   776,  774,  756,  722,  722,  722,  803,  759,  770,  769,
++ /*   260 */   768,  767,  766,  769,  800,  799,  772,  796,  795,  787,
++ /*   270 */   793,  792,  791,  788,  787,  764,  763,  722,  722,  722,
++ /*   280 */   722,  771,
++};
++static const YYACTIONTYPE yy_default[] = {
++ /*     0 */   570,  856,  797,  797,  856,  839,  839,  685,  856,  797,
++ /*    10 */   797,  856,  822,  856,  681,  856,  856,  797,  793,  856,
++ /*    20 */   586,  649,  856,  581,  856,  856,  856,  856,  856,  594,
++ /*    30 */   651,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*    40 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*    50 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*    60 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*    70 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  681,
++ /*    80 */   856,  681,  570,  856,  856,  856,  856,  685,  675,  856,
++ /*    90 */   856,  856,  856,  730,  729,  724,  723,  837,  697,  721,
++ /*   100 */   714,  856,  789,  790,  788,  792,  796,  856,  705,  748,
++ /*   110 */   780,  774,  747,  779,  760,  759,  754,  753,  752,  751,
++ /*   120 */   750,  749,  640,  758,  757,  756,  755,  856,  856,  856,
++ /*   130 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  764,
++ /*   140 */   763,  856,  856,  856,  856,  809,  856,  856,  726,  856,
++ /*   150 */   856,  856,  663,  856,  856,  856,  856,  856,  842,  856,
++ /*   160 */   856,  856,  844,  856,  856,  856,  856,  856,  828,  856,
++ /*   170 */   661,  856,  856,  583,  856,  856,  856,  856,  595,  856,
++ /*   180 */   856,  856,  856,  856,  689,  688,  856,  683,  856,  856,
++ /*   190 */   856,  856,  856,  856,  856,  856,  856,  856,  573,  856,
++ /*   200 */   856,  856,  856,  856,  720,  720,  621,  708,  708,  791,
++ /*   210 */   708,  682,  673,  708,  856,  854,  852,  854,  690,  653,
++ /*   220 */   731,  690,  690,  653,  720,  690,  690,  690,  720,  731,
++ /*   230 */   653,  653,  651,  690,  836,  833,  690,  801,  651,  651,
++ /*   240 */   636,  856,  801,  651,  700,  698,  700,  698,  690,  709,
++ /*   250 */   690,  690,  856,  767,  766,  765,  856,  709,  715,  701,
++ /*   260 */   713,  711,  720,  856,  651,  651,  636,  651,  651,  639,
++ /*   270 */   572,  572,  572,  651,  572,  624,  624,  777,  776,  775,
++ /*   280 */   768,  604,  856,  856,  856,  856,  856,  816,  856,  856,
++ /*   290 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*   300 */   856,  856,  856,  856,  856,  856,  716,  737,  856,  856,
++ /*   310 */   856,  856,  856,  856,  808,  856,  856,  856,  856,  856,
++ /*   320 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*   330 */   856,  856,  856,  832,  831,  856,  856,  856,  856,  856,
++ /*   340 */   856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*   350 */   856,  712,  856,  856,  856,  856,  856,  856,  856,  856,
++ /*   360 */   856,  856,  666,  856,  739,  856,  702,  856,  856,  856,
++ /*   370 */   738,  743,  856,  856,  856,  856,  856,  565,  569,  567,
++ /*   380 */   855,  853,  851,  850,  815,  821,  818,  820,  819,  817,
++ /*   390 */   814,  813,  812,  811,  810,  807,  725,  722,  719,  849,
++ /*   400 */   806,  662,  660,  843,  841,  732,  840,  838,  823,  728,
++ /*   410 */   727,  654,  799,  798,  580,  827,  826,  825,  734,  733,
++ /*   420 */   830,  829,  835,  834,  824,  579,  585,  643,  642,  650,
++ /*   430 */   648,  647,  646,  645,  644,  641,  587,  598,  599,  597,
++ /*   440 */   596,  615,  612,  614,  611,  613,  610,  609,  608,  607,
++ /*   450 */   606,  635,  623,  622,  802,  629,  628,  633,  632,  631,
++ /*   460 */   630,  627,  626,  625,  620,  746,  745,  735,  778,  672,
++ /*   470 */   671,  678,  677,  676,  687,  804,  805,  803,  699,  686,
++ /*   480 */   680,  679,  590,  589,  696,  695,  694,  693,  692,  684,
++ /*   490 */   674,  704,  786,  783,  784,  772,  785,  691,  795,  794,
++ /*   500 */   781,  848,  847,  846,  845,  787,  782,  669,  668,  667,
++ /*   510 */   771,  773,  770,  769,  762,  761,  744,  742,  741,  740,
++ /*   520 */   736,  710,  588,  703,  718,  717,  602,  601,  600,  670,
++ /*   530 */   665,  664,  619,  707,  706,  618,  638,  637,  634,  617,
++ /*   540 */   616,  605,  603,  584,  582,  578,  577,  576,  575,  593,
++ /*   550 */   592,  591,  574,  659,  658,  657,  656,  655,  652,  571,
++ /*   560 */   568,  566,  564,
++};
++
++/* The next table maps tokens into fallback tokens.  If a construct
++** like the following:
++** 
++**      %fallback ID X Y Z.
++**
++** appears in the grammar, then ID becomes a fallback token for X, Y,
++** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
++** but it does not parse, the type of the token is changed to ID and
++** the parse is retried before an error is thrown.
++*/
++#ifdef YYFALLBACK
++static const YYCODETYPE yyFallback[] = {
++    0,  /*          $ => nothing */
++    0,  /* END_OF_FILE => nothing */
++    0,  /*    ILLEGAL => nothing */
++    0,  /*      SPACE => nothing */
++    0,  /* UNCLOSED_STRING => nothing */
++    0,  /*    COMMENT => nothing */
++    0,  /*   FUNCTION => nothing */
++    0,  /*     COLUMN => nothing */
++    0,  /* AGG_FUNCTION => nothing */
++    0,  /*       SEMI => nothing */
++   23,  /*    EXPLAIN => ID */
++   23,  /*      BEGIN => ID */
++    0,  /* TRANSACTION => nothing */
++    0,  /*     COMMIT => nothing */
++   23,  /*        END => ID */
++    0,  /*   ROLLBACK => nothing */
++    0,  /*     CREATE => nothing */
++    0,  /*      TABLE => nothing */
++   23,  /*       TEMP => ID */
++    0,  /*         LP => nothing */
++    0,  /*         RP => nothing */
++    0,  /*         AS => nothing */
++    0,  /*      COMMA => nothing */
++    0,  /*         ID => nothing */
++   23,  /*      ABORT => ID */
++   23,  /*      AFTER => ID */
++   23,  /*        ASC => ID */
++   23,  /*     ATTACH => ID */
++   23,  /*     BEFORE => ID */
++   23,  /*    CASCADE => ID */
++   23,  /*    CLUSTER => ID */
++   23,  /*   CONFLICT => ID */
++   23,  /*       COPY => ID */
++   23,  /*   DATABASE => ID */
++   23,  /*   DEFERRED => ID */
++   23,  /* DELIMITERS => ID */
++   23,  /*       DESC => ID */
++   23,  /*     DETACH => ID */
++   23,  /*       EACH => ID */
++   23,  /*       FAIL => ID */
++   23,  /*        FOR => ID */
++   23,  /*       GLOB => ID */
++   23,  /*     IGNORE => ID */
++   23,  /*  IMMEDIATE => ID */
++   23,  /*  INITIALLY => ID */
++   23,  /*    INSTEAD => ID */
++   23,  /*       LIKE => ID */
++   23,  /*      MATCH => ID */
++   23,  /*        KEY => ID */
++   23,  /*         OF => ID */
++   23,  /*     OFFSET => ID */
++   23,  /*     PRAGMA => ID */
++   23,  /*      RAISE => ID */
++   23,  /*    REPLACE => ID */
++   23,  /*   RESTRICT => ID */
++   23,  /*        ROW => ID */
++   23,  /*  STATEMENT => ID */
++   23,  /*    TRIGGER => ID */
++   23,  /*     VACUUM => ID */
++   23,  /*       VIEW => ID */
++};
++#endif /* YYFALLBACK */
++
++/* The following structure represents a single element of the
++** parser's stack.  Information stored includes:
++**
++**   +  The state number for the parser at this level of the stack.
++**
++**   +  The value of the token stored at this level of the stack.
++**      (In other words, the "major" token.)
++**
++**   +  The semantic value stored at this level of the stack.  This is
++**      the information used by the action routines in the grammar.
++**      It is sometimes called the "minor" token.
++*/
++struct yyStackEntry {
++  YYACTIONTYPE stateno;  /* The state-number */
++  YYCODETYPE major;      /* The major token value.  This is the code
++                         ** number for the token at this stack level */
++  YYMINORTYPE minor;     /* The user-supplied minor token value.  This
++                         ** is the value of the token  */
++};
++typedef struct yyStackEntry yyStackEntry;
++
++/* The state of the parser is completely contained in an instance of
++** the following structure */
++struct yyParser {
++  int yyidx;                    /* Index of top element in stack */
++#ifdef YYTRACKMAXSTACKDEPTH
++  int yyidxMax;                 /* Maximum value of yyidx */
++#endif
++  int yyerrcnt;                 /* Shifts left before out of the error */
++  sqliteParserARG_SDECL                /* A place to hold %extra_argument */
++#if YYSTACKDEPTH<=0
++  int yystksz;                  /* Current side of the stack */
++  yyStackEntry *yystack;        /* The parser's stack */
++#else
++  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
++#endif
++};
++typedef struct yyParser yyParser;
++
++#ifndef NDEBUG
++#include <stdio.h>
++static FILE *yyTraceFILE = 0;
++static char *yyTracePrompt = 0;
++#endif /* NDEBUG */
++
++#ifndef NDEBUG
++/* 
++** Turn parser tracing on by giving a stream to which to write the trace
++** and a prompt to preface each trace message.  Tracing is turned off
++** by making either argument NULL 
++**
++** Inputs:
++** <ul>
++** <li> A FILE* to which trace output should be written.
++**      If NULL, then tracing is turned off.
++** <li> A prefix string written at the beginning of every
++**      line of trace output.  If NULL, then tracing is
++**      turned off.
++** </ul>
++**
++** Outputs:
++** None.
++*/
++void sqliteParserTrace(FILE *TraceFILE, char *zTracePrompt){
++  yyTraceFILE = TraceFILE;
++  yyTracePrompt = zTracePrompt;
++  if( yyTraceFILE==0 ) yyTracePrompt = 0;
++  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
++}
++#endif /* NDEBUG */
++
++#ifndef NDEBUG
++/* For tracing shifts, the names of all terminals and nonterminals
++** are required.  The following table supplies these names */
++static const char *const yyTokenName[] = { 
++  "$",             "END_OF_FILE",   "ILLEGAL",       "SPACE",       
++  "UNCLOSED_STRING",  "COMMENT",       "FUNCTION",      "COLUMN",      
++  "AGG_FUNCTION",  "SEMI",          "EXPLAIN",       "BEGIN",       
++  "TRANSACTION",   "COMMIT",        "END",           "ROLLBACK",    
++  "CREATE",        "TABLE",         "TEMP",          "LP",          
++  "RP",            "AS",            "COMMA",         "ID",          
++  "ABORT",         "AFTER",         "ASC",           "ATTACH",      
++  "BEFORE",        "CASCADE",       "CLUSTER",       "CONFLICT",    
++  "COPY",          "DATABASE",      "DEFERRED",      "DELIMITERS",  
++  "DESC",          "DETACH",        "EACH",          "FAIL",        
++  "FOR",           "GLOB",          "IGNORE",        "IMMEDIATE",   
++  "INITIALLY",     "INSTEAD",       "LIKE",          "MATCH",       
++  "KEY",           "OF",            "OFFSET",        "PRAGMA",      
++  "RAISE",         "REPLACE",       "RESTRICT",      "ROW",         
++  "STATEMENT",     "TRIGGER",       "VACUUM",        "VIEW",        
++  "OR",            "AND",           "NOT",           "EQ",          
++  "NE",            "ISNULL",        "NOTNULL",       "IS",          
++  "BETWEEN",       "IN",            "GT",            "GE",          
++  "LT",            "LE",            "BITAND",        "BITOR",       
++  "LSHIFT",        "RSHIFT",        "PLUS",          "MINUS",       
++  "STAR",          "SLASH",         "REM",           "CONCAT",      
++  "UMINUS",        "UPLUS",         "BITNOT",        "STRING",      
++  "JOIN_KW",       "INTEGER",       "CONSTRAINT",    "DEFAULT",     
++  "FLOAT",         "NULL",          "PRIMARY",       "UNIQUE",      
++  "CHECK",         "REFERENCES",    "COLLATE",       "ON",          
++  "DELETE",        "UPDATE",        "INSERT",        "SET",         
++  "DEFERRABLE",    "FOREIGN",       "DROP",          "UNION",       
++  "ALL",           "INTERSECT",     "EXCEPT",        "SELECT",      
++  "DISTINCT",      "DOT",           "FROM",          "JOIN",        
++  "USING",         "ORDER",         "BY",            "GROUP",       
++  "HAVING",        "LIMIT",         "WHERE",         "INTO",        
++  "VALUES",        "VARIABLE",      "CASE",          "WHEN",        
++  "THEN",          "ELSE",          "INDEX",         "error",       
++  "input",         "cmdlist",       "ecmd",          "explain",     
++  "cmdx",          "cmd",           "trans_opt",     "onconf",      
++  "nm",            "create_table",  "create_table_args",  "temp",        
++  "columnlist",    "conslist_opt",  "select",        "column",      
++  "columnid",      "type",          "carglist",      "id",          
++  "ids",           "typename",      "signed",        "carg",        
++  "ccons",         "sortorder",     "expr",          "idxlist_opt", 
++  "refargs",       "defer_subclause",  "refarg",        "refact",      
++  "init_deferred_pred_opt",  "conslist",      "tcons",         "idxlist",     
++  "defer_subclause_opt",  "orconf",        "resolvetype",   "oneselect",   
++  "multiselect_op",  "distinct",      "selcollist",    "from",        
++  "where_opt",     "groupby_opt",   "having_opt",    "orderby_opt", 
++  "limit_opt",     "sclp",          "as",            "seltablist",  
++  "stl_prefix",    "joinop",        "dbnm",          "on_opt",      
++  "using_opt",     "seltablist_paren",  "joinop2",       "sortlist",    
++  "sortitem",      "collate",       "exprlist",      "setlist",     
++  "insert_cmd",    "inscollist_opt",  "itemlist",      "inscollist",  
++  "likeop",        "case_operand",  "case_exprlist",  "case_else",   
++  "expritem",      "uniqueflag",    "idxitem",       "plus_num",    
++  "minus_num",     "plus_opt",      "number",        "trigger_decl",
++  "trigger_cmd_list",  "trigger_time",  "trigger_event",  "foreach_clause",
++  "when_clause",   "trigger_cmd",   "database_kw_opt",  "key_opt",     
++};
++#endif /* NDEBUG */
++
++#ifndef NDEBUG
++/* For tracing reduce actions, the names of all rules are required.
++*/
++static const char *const yyRuleName[] = {
++ /*   0 */ "input ::= cmdlist",
++ /*   1 */ "cmdlist ::= cmdlist ecmd",
++ /*   2 */ "cmdlist ::= ecmd",
++ /*   3 */ "ecmd ::= explain cmdx SEMI",
++ /*   4 */ "ecmd ::= SEMI",
++ /*   5 */ "cmdx ::= cmd",
++ /*   6 */ "explain ::= EXPLAIN",
++ /*   7 */ "explain ::=",
++ /*   8 */ "cmd ::= BEGIN trans_opt onconf",
++ /*   9 */ "trans_opt ::=",
++ /*  10 */ "trans_opt ::= TRANSACTION",
++ /*  11 */ "trans_opt ::= TRANSACTION nm",
++ /*  12 */ "cmd ::= COMMIT trans_opt",
++ /*  13 */ "cmd ::= END trans_opt",
++ /*  14 */ "cmd ::= ROLLBACK trans_opt",
++ /*  15 */ "cmd ::= create_table create_table_args",
++ /*  16 */ "create_table ::= CREATE temp TABLE nm",
++ /*  17 */ "temp ::= TEMP",
++ /*  18 */ "temp ::=",
++ /*  19 */ "create_table_args ::= LP columnlist conslist_opt RP",
++ /*  20 */ "create_table_args ::= AS select",
++ /*  21 */ "columnlist ::= columnlist COMMA column",
++ /*  22 */ "columnlist ::= column",
++ /*  23 */ "column ::= columnid type carglist",
++ /*  24 */ "columnid ::= nm",
++ /*  25 */ "id ::= ID",
++ /*  26 */ "ids ::= ID",
++ /*  27 */ "ids ::= STRING",
++ /*  28 */ "nm ::= ID",
++ /*  29 */ "nm ::= STRING",
++ /*  30 */ "nm ::= JOIN_KW",
++ /*  31 */ "type ::=",
++ /*  32 */ "type ::= typename",
++ /*  33 */ "type ::= typename LP signed RP",
++ /*  34 */ "type ::= typename LP signed COMMA signed RP",
++ /*  35 */ "typename ::= ids",
++ /*  36 */ "typename ::= typename ids",
++ /*  37 */ "signed ::= INTEGER",
++ /*  38 */ "signed ::= PLUS INTEGER",
++ /*  39 */ "signed ::= MINUS INTEGER",
++ /*  40 */ "carglist ::= carglist carg",
++ /*  41 */ "carglist ::=",
++ /*  42 */ "carg ::= CONSTRAINT nm ccons",
++ /*  43 */ "carg ::= ccons",
++ /*  44 */ "carg ::= DEFAULT STRING",
++ /*  45 */ "carg ::= DEFAULT ID",
++ /*  46 */ "carg ::= DEFAULT INTEGER",
++ /*  47 */ "carg ::= DEFAULT PLUS INTEGER",
++ /*  48 */ "carg ::= DEFAULT MINUS INTEGER",
++ /*  49 */ "carg ::= DEFAULT FLOAT",
++ /*  50 */ "carg ::= DEFAULT PLUS FLOAT",
++ /*  51 */ "carg ::= DEFAULT MINUS FLOAT",
++ /*  52 */ "carg ::= DEFAULT NULL",
++ /*  53 */ "ccons ::= NULL onconf",
++ /*  54 */ "ccons ::= NOT NULL onconf",
++ /*  55 */ "ccons ::= PRIMARY KEY sortorder onconf",
++ /*  56 */ "ccons ::= UNIQUE onconf",
++ /*  57 */ "ccons ::= CHECK LP expr RP onconf",
++ /*  58 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
++ /*  59 */ "ccons ::= defer_subclause",
++ /*  60 */ "ccons ::= COLLATE id",
++ /*  61 */ "refargs ::=",
++ /*  62 */ "refargs ::= refargs refarg",
++ /*  63 */ "refarg ::= MATCH nm",
++ /*  64 */ "refarg ::= ON DELETE refact",
++ /*  65 */ "refarg ::= ON UPDATE refact",
++ /*  66 */ "refarg ::= ON INSERT refact",
++ /*  67 */ "refact ::= SET NULL",
++ /*  68 */ "refact ::= SET DEFAULT",
++ /*  69 */ "refact ::= CASCADE",
++ /*  70 */ "refact ::= RESTRICT",
++ /*  71 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
++ /*  72 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
++ /*  73 */ "init_deferred_pred_opt ::=",
++ /*  74 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
++ /*  75 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
++ /*  76 */ "conslist_opt ::=",
++ /*  77 */ "conslist_opt ::= COMMA conslist",
++ /*  78 */ "conslist ::= conslist COMMA tcons",
++ /*  79 */ "conslist ::= conslist tcons",
++ /*  80 */ "conslist ::= tcons",
++ /*  81 */ "tcons ::= CONSTRAINT nm",
++ /*  82 */ "tcons ::= PRIMARY KEY LP idxlist RP onconf",
++ /*  83 */ "tcons ::= UNIQUE LP idxlist RP onconf",
++ /*  84 */ "tcons ::= CHECK expr onconf",
++ /*  85 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
++ /*  86 */ "defer_subclause_opt ::=",
++ /*  87 */ "defer_subclause_opt ::= defer_subclause",
++ /*  88 */ "onconf ::=",
++ /*  89 */ "onconf ::= ON CONFLICT resolvetype",
++ /*  90 */ "orconf ::=",
++ /*  91 */ "orconf ::= OR resolvetype",
++ /*  92 */ "resolvetype ::= ROLLBACK",
++ /*  93 */ "resolvetype ::= ABORT",
++ /*  94 */ "resolvetype ::= FAIL",
++ /*  95 */ "resolvetype ::= IGNORE",
++ /*  96 */ "resolvetype ::= REPLACE",
++ /*  97 */ "cmd ::= DROP TABLE nm",
++ /*  98 */ "cmd ::= CREATE temp VIEW nm AS select",
++ /*  99 */ "cmd ::= DROP VIEW nm",
++ /* 100 */ "cmd ::= select",
++ /* 101 */ "select ::= oneselect",
++ /* 102 */ "select ::= select multiselect_op oneselect",
++ /* 103 */ "multiselect_op ::= UNION",
++ /* 104 */ "multiselect_op ::= UNION ALL",
++ /* 105 */ "multiselect_op ::= INTERSECT",
++ /* 106 */ "multiselect_op ::= EXCEPT",
++ /* 107 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
++ /* 108 */ "distinct ::= DISTINCT",
++ /* 109 */ "distinct ::= ALL",
++ /* 110 */ "distinct ::=",
++ /* 111 */ "sclp ::= selcollist COMMA",
++ /* 112 */ "sclp ::=",
++ /* 113 */ "selcollist ::= sclp expr as",
++ /* 114 */ "selcollist ::= sclp STAR",
++ /* 115 */ "selcollist ::= sclp nm DOT STAR",
++ /* 116 */ "as ::= AS nm",
++ /* 117 */ "as ::= ids",
++ /* 118 */ "as ::=",
++ /* 119 */ "from ::=",
++ /* 120 */ "from ::= FROM seltablist",
++ /* 121 */ "stl_prefix ::= seltablist joinop",
++ /* 122 */ "stl_prefix ::=",
++ /* 123 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
++ /* 124 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
++ /* 125 */ "seltablist_paren ::= select",
++ /* 126 */ "seltablist_paren ::= seltablist",
++ /* 127 */ "dbnm ::=",
++ /* 128 */ "dbnm ::= DOT nm",
++ /* 129 */ "joinop ::= COMMA",
++ /* 130 */ "joinop ::= JOIN",
++ /* 131 */ "joinop ::= JOIN_KW JOIN",
++ /* 132 */ "joinop ::= JOIN_KW nm JOIN",
++ /* 133 */ "joinop ::= JOIN_KW nm nm JOIN",
++ /* 134 */ "on_opt ::= ON expr",
++ /* 135 */ "on_opt ::=",
++ /* 136 */ "using_opt ::= USING LP idxlist RP",
++ /* 137 */ "using_opt ::=",
++ /* 138 */ "orderby_opt ::=",
++ /* 139 */ "orderby_opt ::= ORDER BY sortlist",
++ /* 140 */ "sortlist ::= sortlist COMMA sortitem collate sortorder",
++ /* 141 */ "sortlist ::= sortitem collate sortorder",
++ /* 142 */ "sortitem ::= expr",
++ /* 143 */ "sortorder ::= ASC",
++ /* 144 */ "sortorder ::= DESC",
++ /* 145 */ "sortorder ::=",
++ /* 146 */ "collate ::=",
++ /* 147 */ "collate ::= COLLATE id",
++ /* 148 */ "groupby_opt ::=",
++ /* 149 */ "groupby_opt ::= GROUP BY exprlist",
++ /* 150 */ "having_opt ::=",
++ /* 151 */ "having_opt ::= HAVING expr",
++ /* 152 */ "limit_opt ::=",
++ /* 153 */ "limit_opt ::= LIMIT signed",
++ /* 154 */ "limit_opt ::= LIMIT signed OFFSET signed",
++ /* 155 */ "limit_opt ::= LIMIT signed COMMA signed",
++ /* 156 */ "cmd ::= DELETE FROM nm dbnm where_opt",
++ /* 157 */ "where_opt ::=",
++ /* 158 */ "where_opt ::= WHERE expr",
++ /* 159 */ "cmd ::= UPDATE orconf nm dbnm SET setlist where_opt",
++ /* 160 */ "setlist ::= setlist COMMA nm EQ expr",
++ /* 161 */ "setlist ::= nm EQ expr",
++ /* 162 */ "cmd ::= insert_cmd INTO nm dbnm inscollist_opt VALUES LP itemlist RP",
++ /* 163 */ "cmd ::= insert_cmd INTO nm dbnm inscollist_opt select",
++ /* 164 */ "insert_cmd ::= INSERT orconf",
++ /* 165 */ "insert_cmd ::= REPLACE",
++ /* 166 */ "itemlist ::= itemlist COMMA expr",
++ /* 167 */ "itemlist ::= expr",
++ /* 168 */ "inscollist_opt ::=",
++ /* 169 */ "inscollist_opt ::= LP inscollist RP",
++ /* 170 */ "inscollist ::= inscollist COMMA nm",
++ /* 171 */ "inscollist ::= nm",
++ /* 172 */ "expr ::= LP expr RP",
++ /* 173 */ "expr ::= NULL",
++ /* 174 */ "expr ::= ID",
++ /* 175 */ "expr ::= JOIN_KW",
++ /* 176 */ "expr ::= nm DOT nm",
++ /* 177 */ "expr ::= nm DOT nm DOT nm",
++ /* 178 */ "expr ::= INTEGER",
++ /* 179 */ "expr ::= FLOAT",
++ /* 180 */ "expr ::= STRING",
++ /* 181 */ "expr ::= VARIABLE",
++ /* 182 */ "expr ::= ID LP exprlist RP",
++ /* 183 */ "expr ::= ID LP STAR RP",
++ /* 184 */ "expr ::= expr AND expr",
++ /* 185 */ "expr ::= expr OR expr",
++ /* 186 */ "expr ::= expr LT expr",
++ /* 187 */ "expr ::= expr GT expr",
++ /* 188 */ "expr ::= expr LE expr",
++ /* 189 */ "expr ::= expr GE expr",
++ /* 190 */ "expr ::= expr NE expr",
++ /* 191 */ "expr ::= expr EQ expr",
++ /* 192 */ "expr ::= expr BITAND expr",
++ /* 193 */ "expr ::= expr BITOR expr",
++ /* 194 */ "expr ::= expr LSHIFT expr",
++ /* 195 */ "expr ::= expr RSHIFT expr",
++ /* 196 */ "expr ::= expr likeop expr",
++ /* 197 */ "expr ::= expr NOT likeop expr",
++ /* 198 */ "likeop ::= LIKE",
++ /* 199 */ "likeop ::= GLOB",
++ /* 200 */ "expr ::= expr PLUS expr",
++ /* 201 */ "expr ::= expr MINUS expr",
++ /* 202 */ "expr ::= expr STAR expr",
++ /* 203 */ "expr ::= expr SLASH expr",
++ /* 204 */ "expr ::= expr REM expr",
++ /* 205 */ "expr ::= expr CONCAT expr",
++ /* 206 */ "expr ::= expr ISNULL",
++ /* 207 */ "expr ::= expr IS NULL",
++ /* 208 */ "expr ::= expr NOTNULL",
++ /* 209 */ "expr ::= expr NOT NULL",
++ /* 210 */ "expr ::= expr IS NOT NULL",
++ /* 211 */ "expr ::= NOT expr",
++ /* 212 */ "expr ::= BITNOT expr",
++ /* 213 */ "expr ::= MINUS expr",
++ /* 214 */ "expr ::= PLUS expr",
++ /* 215 */ "expr ::= LP select RP",
++ /* 216 */ "expr ::= expr BETWEEN expr AND expr",
++ /* 217 */ "expr ::= expr NOT BETWEEN expr AND expr",
++ /* 218 */ "expr ::= expr IN LP exprlist RP",
++ /* 219 */ "expr ::= expr IN LP select RP",
++ /* 220 */ "expr ::= expr NOT IN LP exprlist RP",
++ /* 221 */ "expr ::= expr NOT IN LP select RP",
++ /* 222 */ "expr ::= expr IN nm dbnm",
++ /* 223 */ "expr ::= expr NOT IN nm dbnm",
++ /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END",
++ /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
++ /* 226 */ "case_exprlist ::= WHEN expr THEN expr",
++ /* 227 */ "case_else ::= ELSE expr",
++ /* 228 */ "case_else ::=",
++ /* 229 */ "case_operand ::= expr",
++ /* 230 */ "case_operand ::=",
++ /* 231 */ "exprlist ::= exprlist COMMA expritem",
++ /* 232 */ "exprlist ::= expritem",
++ /* 233 */ "expritem ::= expr",
++ /* 234 */ "expritem ::=",
++ /* 235 */ "cmd ::= CREATE uniqueflag INDEX nm ON nm dbnm LP idxlist RP onconf",
++ /* 236 */ "uniqueflag ::= UNIQUE",
++ /* 237 */ "uniqueflag ::=",
++ /* 238 */ "idxlist_opt ::=",
++ /* 239 */ "idxlist_opt ::= LP idxlist RP",
++ /* 240 */ "idxlist ::= idxlist COMMA idxitem",
++ /* 241 */ "idxlist ::= idxitem",
++ /* 242 */ "idxitem ::= nm sortorder",
++ /* 243 */ "cmd ::= DROP INDEX nm dbnm",
++ /* 244 */ "cmd ::= COPY orconf nm dbnm FROM nm USING DELIMITERS STRING",
++ /* 245 */ "cmd ::= COPY orconf nm dbnm FROM nm",
++ /* 246 */ "cmd ::= VACUUM",
++ /* 247 */ "cmd ::= VACUUM nm",
++ /* 248 */ "cmd ::= PRAGMA ids EQ nm",
++ /* 249 */ "cmd ::= PRAGMA ids EQ ON",
++ /* 250 */ "cmd ::= PRAGMA ids EQ plus_num",
++ /* 251 */ "cmd ::= PRAGMA ids EQ minus_num",
++ /* 252 */ "cmd ::= PRAGMA ids LP nm RP",
++ /* 253 */ "cmd ::= PRAGMA ids",
++ /* 254 */ "plus_num ::= plus_opt number",
++ /* 255 */ "minus_num ::= MINUS number",
++ /* 256 */ "number ::= INTEGER",
++ /* 257 */ "number ::= FLOAT",
++ /* 258 */ "plus_opt ::= PLUS",
++ /* 259 */ "plus_opt ::=",
++ /* 260 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
++ /* 261 */ "trigger_decl ::= temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause",
++ /* 262 */ "trigger_time ::= BEFORE",
++ /* 263 */ "trigger_time ::= AFTER",
++ /* 264 */ "trigger_time ::= INSTEAD OF",
++ /* 265 */ "trigger_time ::=",
++ /* 266 */ "trigger_event ::= DELETE",
++ /* 267 */ "trigger_event ::= INSERT",
++ /* 268 */ "trigger_event ::= UPDATE",
++ /* 269 */ "trigger_event ::= UPDATE OF inscollist",
++ /* 270 */ "foreach_clause ::=",
++ /* 271 */ "foreach_clause ::= FOR EACH ROW",
++ /* 272 */ "foreach_clause ::= FOR EACH STATEMENT",
++ /* 273 */ "when_clause ::=",
++ /* 274 */ "when_clause ::= WHEN expr",
++ /* 275 */ "trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list",
++ /* 276 */ "trigger_cmd_list ::=",
++ /* 277 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
++ /* 278 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
++ /* 279 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
++ /* 280 */ "trigger_cmd ::= DELETE FROM nm where_opt",
++ /* 281 */ "trigger_cmd ::= select",
++ /* 282 */ "expr ::= RAISE LP IGNORE RP",
++ /* 283 */ "expr ::= RAISE LP ROLLBACK COMMA nm RP",
++ /* 284 */ "expr ::= RAISE LP ABORT COMMA nm RP",
++ /* 285 */ "expr ::= RAISE LP FAIL COMMA nm RP",
++ /* 286 */ "cmd ::= DROP TRIGGER nm dbnm",
++ /* 287 */ "cmd ::= ATTACH database_kw_opt ids AS nm key_opt",
++ /* 288 */ "key_opt ::= USING ids",
++ /* 289 */ "key_opt ::=",
++ /* 290 */ "database_kw_opt ::= DATABASE",
++ /* 291 */ "database_kw_opt ::=",
++ /* 292 */ "cmd ::= DETACH database_kw_opt nm",
++};
++#endif /* NDEBUG */
++
++
++#if YYSTACKDEPTH<=0
++/*
++** Try to increase the size of the parser stack.
++*/
++static void yyGrowStack(yyParser *p){
++  int newSize;
++  yyStackEntry *pNew;
++
++  newSize = p->yystksz*2 + 100;
++  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
++  if( pNew ){
++    p->yystack = pNew;
++    p->yystksz = newSize;
++#ifndef NDEBUG
++    if( yyTraceFILE ){
++      fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
++              yyTracePrompt, p->yystksz);
++    }
++#endif
++  }
++}
++#endif
++
++/* 
++** This function allocates a new parser.
++** The only argument is a pointer to a function which works like
++** malloc.
++**
++** Inputs:
++** A pointer to the function used to allocate memory.
++**
++** Outputs:
++** A pointer to a parser.  This pointer is used in subsequent calls
++** to sqliteParser and sqliteParserFree.
++*/
++void *sqliteParserAlloc(void *(*mallocProc)(size_t)){
++  yyParser *pParser;
++  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
++  if( pParser ){
++    pParser->yyidx = -1;
++#ifdef YYTRACKMAXSTACKDEPTH
++    pParser->yyidxMax = 0;
++#endif
++#if YYSTACKDEPTH<=0
++    pParser->yystack = NULL;
++    pParser->yystksz = 0;
++    yyGrowStack(pParser);
++#endif
++  }
++  return pParser;
++}
++
++/* The following function deletes the value associated with a
++** symbol.  The symbol can be either a terminal or nonterminal.
++** "yymajor" is the symbol code, and "yypminor" is a pointer to
++** the value.
++*/
++static void yy_destructor(
++  yyParser *yypParser,    /* The parser */
++  YYCODETYPE yymajor,     /* Type code for object to destroy */
++  YYMINORTYPE *yypminor   /* The object to be destroyed */
++){
++  sqliteParserARG_FETCH;
++  switch( yymajor ){
++    /* Here is inserted the actions which take place when a
++    ** terminal or non-terminal is destroyed.  This can happen
++    ** when the symbol is popped from the stack during a
++    ** reduce or during error processing or when a parser is 
++    ** being destroyed before it is finished parsing.
++    **
++    ** Note: during a reduce, the only symbols destroyed are those
++    ** which appear on the RHS of the rule, but which are not used
++    ** inside the C code.
++    */
++    case 146: /* select */
++    case 171: /* oneselect */
++    case 189: /* seltablist_paren */
++{
++#line 286 "ext/sqlite/libsqlite/src/parse.y"
++sqliteSelectDelete((yypminor->yy179));
++#line 1131 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    case 158: /* expr */
++    case 176: /* where_opt */
++    case 178: /* having_opt */
++    case 187: /* on_opt */
++    case 192: /* sortitem */
++    case 204: /* expritem */
++{
++#line 533 "ext/sqlite/libsqlite/src/parse.y"
++sqliteExprDelete((yypminor->yy242));
++#line 1143 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    case 159: /* idxlist_opt */
++    case 167: /* idxlist */
++    case 188: /* using_opt */
++    case 197: /* inscollist_opt */
++    case 199: /* inscollist */
++{
++#line 746 "ext/sqlite/libsqlite/src/parse.y"
++sqliteIdListDelete((yypminor->yy320));
++#line 1154 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    case 174: /* selcollist */
++    case 177: /* groupby_opt */
++    case 179: /* orderby_opt */
++    case 181: /* sclp */
++    case 191: /* sortlist */
++    case 194: /* exprlist */
++    case 195: /* setlist */
++    case 198: /* itemlist */
++    case 202: /* case_exprlist */
++{
++#line 322 "ext/sqlite/libsqlite/src/parse.y"
++sqliteExprListDelete((yypminor->yy322));
++#line 1169 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    case 175: /* from */
++    case 183: /* seltablist */
++    case 184: /* stl_prefix */
++{
++#line 353 "ext/sqlite/libsqlite/src/parse.y"
++sqliteSrcListDelete((yypminor->yy307));
++#line 1178 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    case 212: /* trigger_cmd_list */
++    case 217: /* trigger_cmd */
++{
++#line 828 "ext/sqlite/libsqlite/src/parse.y"
++sqliteDeleteTriggerStep((yypminor->yy19));
++#line 1186 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    case 214: /* trigger_event */
++{
++#line 812 "ext/sqlite/libsqlite/src/parse.y"
++sqliteIdListDelete((yypminor->yy290).b);
++#line 1193 "ext/sqlite/libsqlite/src/parse.c"
++}
++      break;
++    default:  break;   /* If no destructor action specified: do nothing */
++  }
++}
++
++/*
++** Pop the parser's stack once.
++**
++** If there is a destructor routine associated with the token which
++** is popped from the stack, then call it.
++**
++** Return the major token number for the symbol popped.
++*/
++static int yy_pop_parser_stack(yyParser *pParser){
++  YYCODETYPE yymajor;
++  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
++
++  if( pParser->yyidx<0 ) return 0;
++#ifndef NDEBUG
++  if( yyTraceFILE && pParser->yyidx>=0 ){
++    fprintf(yyTraceFILE,"%sPopping %s\n",
++      yyTracePrompt,
++      yyTokenName[yytos->major]);
++  }
++#endif
++  yymajor = yytos->major;
++  yy_destructor(pParser, yymajor, &yytos->minor);
++  pParser->yyidx--;
++  return yymajor;
++}
++
++/* 
++** Deallocate and destroy a parser.  Destructors are all called for
++** all stack elements before shutting the parser down.
++**
++** Inputs:
++** <ul>
++** <li>  A pointer to the parser.  This should be a pointer
++**       obtained from sqliteParserAlloc.
++** <li>  A pointer to a function used to reclaim memory obtained
++**       from malloc.
++** </ul>
++*/
++void sqliteParserFree(
++  void *p,                    /* The parser to be deleted */
++  void (*freeProc)(void*)     /* Function used to reclaim memory */
++){
++  yyParser *pParser = (yyParser*)p;
++  if( pParser==0 ) return;
++  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
++#if YYSTACKDEPTH<=0
++  free(pParser->yystack);
++#endif
++  (*freeProc)((void*)pParser);
++}
++
++/*
++** Return the peak depth of the stack for a parser.
++*/
++#ifdef YYTRACKMAXSTACKDEPTH
++int sqliteParserStackPeak(void *p){
++  yyParser *pParser = (yyParser*)p;
++  return pParser->yyidxMax;
++}
++#endif
++
++/*
++** Find the appropriate action for a parser given the terminal
++** look-ahead token iLookAhead.
++**
++** If the look-ahead token is YYNOCODE, then check to see if the action is
++** independent of the look-ahead.  If it is, return the action, otherwise
++** return YY_NO_ACTION.
++*/
++static int yy_find_shift_action(
++  yyParser *pParser,        /* The parser */
++  YYCODETYPE iLookAhead     /* The look-ahead token */
++){
++  int i;
++  int stateno = pParser->yystack[pParser->yyidx].stateno;
++ 
++  if( stateno>YY_SHIFT_COUNT
++   || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
++    return yy_default[stateno];
++  }
++  assert( iLookAhead!=YYNOCODE );
++  i += iLookAhead;
++  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
++    if( iLookAhead>0 ){
++#ifdef YYFALLBACK
++      YYCODETYPE iFallback;            /* Fallback token */
++      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
++             && (iFallback = yyFallback[iLookAhead])!=0 ){
++#ifndef NDEBUG
++        if( yyTraceFILE ){
++          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
++             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
++        }
++#endif
++        return yy_find_shift_action(pParser, iFallback);
++      }
++#endif
++#ifdef YYWILDCARD
++      {
++        int j = i - iLookAhead + YYWILDCARD;
++        if( 
++#if YY_SHIFT_MIN+YYWILDCARD<0
++          j>=0 &&
++#endif
++#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
++          j<YY_ACTTAB_COUNT &&
++#endif
++          yy_lookahead[j]==YYWILDCARD
++        ){
++#ifndef NDEBUG
++          if( yyTraceFILE ){
++            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
++               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
++          }
++#endif /* NDEBUG */
++          return yy_action[j];
++        }
++      }
++#endif /* YYWILDCARD */
++    }
++    return yy_default[stateno];
++  }else{
++    return yy_action[i];
++  }
++}
++
++/*
++** Find the appropriate action for a parser given the non-terminal
++** look-ahead token iLookAhead.
++**
++** If the look-ahead token is YYNOCODE, then check to see if the action is
++** independent of the look-ahead.  If it is, return the action, otherwise
++** return YY_NO_ACTION.
++*/
++static int yy_find_reduce_action(
++  int stateno,              /* Current state number */
++  YYCODETYPE iLookAhead     /* The look-ahead token */
++){
++  int i;
++#ifdef YYERRORSYMBOL
++  if( stateno>YY_REDUCE_COUNT ){
++    return yy_default[stateno];
++  }
++#else
++  assert( stateno<=YY_REDUCE_COUNT );
++#endif
++  i = yy_reduce_ofst[stateno];
++  assert( i!=YY_REDUCE_USE_DFLT );
++  assert( iLookAhead!=YYNOCODE );
++  i += iLookAhead;
++#ifdef YYERRORSYMBOL
++  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
++    return yy_default[stateno];
++  }
++#else
++  assert( i>=0 && i<YY_ACTTAB_COUNT );
++  assert( yy_lookahead[i]==iLookAhead );
++#endif
++  return yy_action[i];
++}
++
++/*
++** The following routine is called if the stack overflows.
++*/
++static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
++   sqliteParserARG_FETCH;
++   yypParser->yyidx--;
++#ifndef NDEBUG
++   if( yyTraceFILE ){
++     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
++   }
++#endif
++   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
++   /* Here code is inserted which will execute if the parser
++   ** stack every overflows */
++   sqliteParserARG_STORE; /* Suppress warning about unused %extra_argument var */
++}
++
++/*
++** Perform a shift action.
++*/
++static void yy_shift(
++  yyParser *yypParser,          /* The parser to be shifted */
++  int yyNewState,               /* The new state to shift in */
++  int yyMajor,                  /* The major token to shift in */
++  YYMINORTYPE *yypMinor         /* Pointer to the minor token to shift in */
++){
++  yyStackEntry *yytos;
++  yypParser->yyidx++;
++#ifdef YYTRACKMAXSTACKDEPTH
++  if( yypParser->yyidx>yypParser->yyidxMax ){
++    yypParser->yyidxMax = yypParser->yyidx;
++  }
++#endif
++#if YYSTACKDEPTH>0 
++  if( yypParser->yyidx>=YYSTACKDEPTH ){
++    yyStackOverflow(yypParser, yypMinor);
++    return;
++  }
++#else
++  if( yypParser->yyidx>=yypParser->yystksz ){
++    yyGrowStack(yypParser);
++    if( yypParser->yyidx>=yypParser->yystksz ){
++      yyStackOverflow(yypParser, yypMinor);
++      return;
++    }
++  }
++#endif
++  yytos = &yypParser->yystack[yypParser->yyidx];
++  yytos->stateno = (YYACTIONTYPE)yyNewState;
++  yytos->major = (YYCODETYPE)yyMajor;
++  yytos->minor = *yypMinor;
++#ifndef NDEBUG
++  if( yyTraceFILE && yypParser->yyidx>0 ){
++    int i;
++    fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
++    fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
++    for(i=1; i<=yypParser->yyidx; i++)
++      fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
++    fprintf(yyTraceFILE,"\n");
++  }
++#endif
++}
++
++/* The following table contains information about every rule that
++** is used during the reduce.
++*/
++static const struct {
++  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
++  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
++} yyRuleInfo[] = {
++  { 132, 1 },
++  { 133, 2 },
++  { 133, 1 },
++  { 134, 3 },
++  { 134, 1 },
++  { 136, 1 },
++  { 135, 1 },
++  { 135, 0 },
++  { 137, 3 },
++  { 138, 0 },
++  { 138, 1 },
++  { 138, 2 },
++  { 137, 2 },
++  { 137, 2 },
++  { 137, 2 },
++  { 137, 2 },
++  { 141, 4 },
++  { 143, 1 },
++  { 143, 0 },
++  { 142, 4 },
++  { 142, 2 },
++  { 144, 3 },
++  { 144, 1 },
++  { 147, 3 },
++  { 148, 1 },
++  { 151, 1 },
++  { 152, 1 },
++  { 152, 1 },
++  { 140, 1 },
++  { 140, 1 },
++  { 140, 1 },
++  { 149, 0 },
++  { 149, 1 },
++  { 149, 4 },
++  { 149, 6 },
++  { 153, 1 },
++  { 153, 2 },
++  { 154, 1 },
++  { 154, 2 },
++  { 154, 2 },
++  { 150, 2 },
++  { 150, 0 },
++  { 155, 3 },
++  { 155, 1 },
++  { 155, 2 },
++  { 155, 2 },
++  { 155, 2 },
++  { 155, 3 },
++  { 155, 3 },
++  { 155, 2 },
++  { 155, 3 },
++  { 155, 3 },
++  { 155, 2 },
++  { 156, 2 },
++  { 156, 3 },
++  { 156, 4 },
++  { 156, 2 },
++  { 156, 5 },
++  { 156, 4 },
++  { 156, 1 },
++  { 156, 2 },
++  { 160, 0 },
++  { 160, 2 },
++  { 162, 2 },
++  { 162, 3 },
++  { 162, 3 },
++  { 162, 3 },
++  { 163, 2 },
++  { 163, 2 },
++  { 163, 1 },
++  { 163, 1 },
++  { 161, 3 },
++  { 161, 2 },
++  { 164, 0 },
++  { 164, 2 },
++  { 164, 2 },
++  { 145, 0 },
++  { 145, 2 },
++  { 165, 3 },
++  { 165, 2 },
++  { 165, 1 },
++  { 166, 2 },
++  { 166, 6 },
++  { 166, 5 },
++  { 166, 3 },
++  { 166, 10 },
++  { 168, 0 },
++  { 168, 1 },
++  { 139, 0 },
++  { 139, 3 },
++  { 169, 0 },
++  { 169, 2 },
++  { 170, 1 },
++  { 170, 1 },
++  { 170, 1 },
++  { 170, 1 },
++  { 170, 1 },
++  { 137, 3 },
++  { 137, 6 },
++  { 137, 3 },
++  { 137, 1 },
++  { 146, 1 },
++  { 146, 3 },
++  { 172, 1 },
++  { 172, 2 },
++  { 172, 1 },
++  { 172, 1 },
++  { 171, 9 },
++  { 173, 1 },
++  { 173, 1 },
++  { 173, 0 },
++  { 181, 2 },
++  { 181, 0 },
++  { 174, 3 },
++  { 174, 2 },
++  { 174, 4 },
++  { 182, 2 },
++  { 182, 1 },
++  { 182, 0 },
++  { 175, 0 },
++  { 175, 2 },
++  { 184, 2 },
++  { 184, 0 },
++  { 183, 6 },
++  { 183, 7 },
++  { 189, 1 },
++  { 189, 1 },
++  { 186, 0 },
++  { 186, 2 },
++  { 185, 1 },
++  { 185, 1 },
++  { 185, 2 },
++  { 185, 3 },
++  { 185, 4 },
++  { 187, 2 },
++  { 187, 0 },
++  { 188, 4 },
++  { 188, 0 },
++  { 179, 0 },
++  { 179, 3 },
++  { 191, 5 },
++  { 191, 3 },
++  { 192, 1 },
++  { 157, 1 },
++  { 157, 1 },
++  { 157, 0 },
++  { 193, 0 },
++  { 193, 2 },
++  { 177, 0 },
++  { 177, 3 },
++  { 178, 0 },
++  { 178, 2 },
++  { 180, 0 },
++  { 180, 2 },
++  { 180, 4 },
++  { 180, 4 },
++  { 137, 5 },
++  { 176, 0 },
++  { 176, 2 },
++  { 137, 7 },
++  { 195, 5 },
++  { 195, 3 },
++  { 137, 9 },
++  { 137, 6 },
++  { 196, 2 },
++  { 196, 1 },
++  { 198, 3 },
++  { 198, 1 },
++  { 197, 0 },
++  { 197, 3 },
++  { 199, 3 },
++  { 199, 1 },
++  { 158, 3 },
++  { 158, 1 },
++  { 158, 1 },
++  { 158, 1 },
++  { 158, 3 },
++  { 158, 5 },
++  { 158, 1 },
++  { 158, 1 },
++  { 158, 1 },
++  { 158, 1 },
++  { 158, 4 },
++  { 158, 4 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 4 },
++  { 200, 1 },
++  { 200, 1 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 3 },
++  { 158, 2 },
++  { 158, 3 },
++  { 158, 2 },
++  { 158, 3 },
++  { 158, 4 },
++  { 158, 2 },
++  { 158, 2 },
++  { 158, 2 },
++  { 158, 2 },
++  { 158, 3 },
++  { 158, 5 },
++  { 158, 6 },
++  { 158, 5 },
++  { 158, 5 },
++  { 158, 6 },
++  { 158, 6 },
++  { 158, 4 },
++  { 158, 5 },
++  { 158, 5 },
++  { 202, 5 },
++  { 202, 4 },
++  { 203, 2 },
++  { 203, 0 },
++  { 201, 1 },
++  { 201, 0 },
++  { 194, 3 },
++  { 194, 1 },
++  { 204, 1 },
++  { 204, 0 },
++  { 137, 11 },
++  { 205, 1 },
++  { 205, 0 },
++  { 159, 0 },
++  { 159, 3 },
++  { 167, 3 },
++  { 167, 1 },
++  { 206, 2 },
++  { 137, 4 },
++  { 137, 9 },
++  { 137, 6 },
++  { 137, 1 },
++  { 137, 2 },
++  { 137, 4 },
++  { 137, 4 },
++  { 137, 4 },
++  { 137, 4 },
++  { 137, 5 },
++  { 137, 2 },
++  { 207, 2 },
++  { 208, 2 },
++  { 210, 1 },
++  { 210, 1 },
++  { 209, 1 },
++  { 209, 0 },
++  { 137, 5 },
++  { 211, 10 },
++  { 213, 1 },
++  { 213, 1 },
++  { 213, 2 },
++  { 213, 0 },
++  { 214, 1 },
++  { 214, 1 },
++  { 214, 1 },
++  { 214, 3 },
++  { 215, 0 },
++  { 215, 3 },
++  { 215, 3 },
++  { 216, 0 },
++  { 216, 2 },
++  { 212, 3 },
++  { 212, 0 },
++  { 217, 6 },
++  { 217, 8 },
++  { 217, 5 },
++  { 217, 4 },
++  { 217, 1 },
++  { 158, 4 },
++  { 158, 6 },
++  { 158, 6 },
++  { 158, 6 },
++  { 137, 4 },
++  { 137, 6 },
++  { 219, 2 },
++  { 219, 0 },
++  { 218, 1 },
++  { 218, 0 },
++  { 137, 3 },
++};
++
++static void yy_accept(yyParser*);  /* Forward Declaration */
++
++/*
++** Perform a reduce action and the shift that must immediately
++** follow the reduce.
++*/
++static void yy_reduce(
++  yyParser *yypParser,         /* The parser */
++  int yyruleno                 /* Number of the rule by which to reduce */
++){
++  int yygoto;                     /* The next state */
++  int yyact;                      /* The next action */
++  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
++  yyStackEntry *yymsp;            /* The top of the parser's stack */
++  int yysize;                     /* Amount to pop the stack */
++  sqliteParserARG_FETCH;
++  yymsp = &yypParser->yystack[yypParser->yyidx];
++#ifndef NDEBUG
++  if( yyTraceFILE && yyruleno>=0 
++        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
++    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
++      yyRuleName[yyruleno]);
++  }
++#endif /* NDEBUG */
++
++  /* Silence complaints from purify about yygotominor being uninitialized
++  ** in some cases when it is copied into the stack after the following
++  ** switch.  yygotominor is uninitialized when a rule reduces that does
++  ** not set the value of its left-hand side nonterminal.  Leaving the
++  ** value of the nonterminal uninitialized is utterly harmless as long
++  ** as the value is never used.  So really the only thing this code
++  ** accomplishes is to quieten purify.  
++  **
++  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
++  ** without this code, their parser segfaults.  I'm not sure what there
++  ** parser is doing to make this happen.  This is the second bug report
++  ** from wireshark this week.  Clearly they are stressing Lemon in ways
++  ** that it has not been previously stressed...  (SQLite ticket #2172)
++  */
++  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
++  yygotominor = yyzerominor;
++
++
++  switch( yyruleno ){
++  /* Beginning here are the reduction cases.  A typical example
++  ** follows:
++  **   case 0:
++  **  #line <lineno> <grammarfile>
++  **     { ... }           // User supplied code
++  **  #line <lineno> <thisfile>
++  **     break;
++  */
++      case 5: /* cmdx ::= cmd */
++#line 72 "ext/sqlite/libsqlite/src/parse.y"
++{ sqliteExec(pParse); }
++#line 1781 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 6: /* explain ::= EXPLAIN */
++#line 73 "ext/sqlite/libsqlite/src/parse.y"
++{ sqliteBeginParse(pParse, 1); }
++#line 1786 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 7: /* explain ::= */
++#line 74 "ext/sqlite/libsqlite/src/parse.y"
++{ sqliteBeginParse(pParse, 0); }
++#line 1791 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 8: /* cmd ::= BEGIN trans_opt onconf */
++#line 79 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteBeginTransaction(pParse,yymsp[0].minor.yy372);}
++#line 1796 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 12: /* cmd ::= COMMIT trans_opt */
++      case 13: /* cmd ::= END trans_opt */ yytestcase(yyruleno==13);
++#line 83 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteCommitTransaction(pParse);}
++#line 1802 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 14: /* cmd ::= ROLLBACK trans_opt */
++#line 85 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteRollbackTransaction(pParse);}
++#line 1807 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 16: /* create_table ::= CREATE temp TABLE nm */
++#line 90 "ext/sqlite/libsqlite/src/parse.y"
++{
++   sqliteStartTable(pParse,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0,yymsp[-2].minor.yy372,0);
++}
++#line 1814 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 17: /* temp ::= TEMP */
++      case 74: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==74);
++      case 108: /* distinct ::= DISTINCT */ yytestcase(yyruleno==108);
++#line 94 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = 1;}
++#line 1821 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 18: /* temp ::= */
++      case 73: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==73);
++      case 75: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==75);
++      case 86: /* defer_subclause_opt ::= */ yytestcase(yyruleno==86);
++      case 109: /* distinct ::= ALL */ yytestcase(yyruleno==109);
++      case 110: /* distinct ::= */ yytestcase(yyruleno==110);
++#line 95 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = 0;}
++#line 1831 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 19: /* create_table_args ::= LP columnlist conslist_opt RP */
++#line 96 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteEndTable(pParse,&yymsp[0].minor.yy0,0);
++}
++#line 1838 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 20: /* create_table_args ::= AS select */
++#line 99 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteEndTable(pParse,0,yymsp[0].minor.yy179);
++  sqliteSelectDelete(yymsp[0].minor.yy179);
++}
++#line 1846 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 24: /* columnid ::= nm */
++#line 111 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddColumn(pParse,&yymsp[0].minor.yy0);}
++#line 1851 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 25: /* id ::= ID */
++      case 26: /* ids ::= ID */ yytestcase(yyruleno==26);
++      case 27: /* ids ::= STRING */ yytestcase(yyruleno==27);
++      case 28: /* nm ::= ID */ yytestcase(yyruleno==28);
++      case 29: /* nm ::= STRING */ yytestcase(yyruleno==29);
++      case 30: /* nm ::= JOIN_KW */ yytestcase(yyruleno==30);
++      case 35: /* typename ::= ids */ yytestcase(yyruleno==35);
++      case 128: /* dbnm ::= DOT nm */ yytestcase(yyruleno==128);
++      case 254: /* plus_num ::= plus_opt number */ yytestcase(yyruleno==254);
++      case 255: /* minus_num ::= MINUS number */ yytestcase(yyruleno==255);
++      case 256: /* number ::= INTEGER */ yytestcase(yyruleno==256);
++      case 257: /* number ::= FLOAT */ yytestcase(yyruleno==257);
++#line 117 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy0 = yymsp[0].minor.yy0;}
++#line 1867 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 32: /* type ::= typename */
++#line 160 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddColumnType(pParse,&yymsp[0].minor.yy0,&yymsp[0].minor.yy0);}
++#line 1872 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 33: /* type ::= typename LP signed RP */
++#line 161 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddColumnType(pParse,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);}
++#line 1877 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 34: /* type ::= typename LP signed COMMA signed RP */
++#line 163 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddColumnType(pParse,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);}
++#line 1882 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 36: /* typename ::= typename ids */
++      case 242: /* idxitem ::= nm sortorder */ yytestcase(yyruleno==242);
++#line 166 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy0 = yymsp[-1].minor.yy0;}
++#line 1888 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 37: /* signed ::= INTEGER */
++      case 38: /* signed ::= PLUS INTEGER */ yytestcase(yyruleno==38);
++#line 168 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = atoi(yymsp[0].minor.yy0.z); }
++#line 1894 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 39: /* signed ::= MINUS INTEGER */
++#line 170 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = -atoi(yymsp[0].minor.yy0.z); }
++#line 1899 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 44: /* carg ::= DEFAULT STRING */
++      case 45: /* carg ::= DEFAULT ID */ yytestcase(yyruleno==45);
++      case 46: /* carg ::= DEFAULT INTEGER */ yytestcase(yyruleno==46);
++      case 47: /* carg ::= DEFAULT PLUS INTEGER */ yytestcase(yyruleno==47);
++      case 49: /* carg ::= DEFAULT FLOAT */ yytestcase(yyruleno==49);
++      case 50: /* carg ::= DEFAULT PLUS FLOAT */ yytestcase(yyruleno==50);
++#line 175 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddDefaultValue(pParse,&yymsp[0].minor.yy0,0);}
++#line 1909 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 48: /* carg ::= DEFAULT MINUS INTEGER */
++      case 51: /* carg ::= DEFAULT MINUS FLOAT */ yytestcase(yyruleno==51);
++#line 179 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddDefaultValue(pParse,&yymsp[0].minor.yy0,1);}
++#line 1915 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 54: /* ccons ::= NOT NULL onconf */
++#line 189 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddNotNull(pParse, yymsp[0].minor.yy372);}
++#line 1920 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 55: /* ccons ::= PRIMARY KEY sortorder onconf */
++#line 190 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddPrimaryKey(pParse,0,yymsp[0].minor.yy372);}
++#line 1925 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 56: /* ccons ::= UNIQUE onconf */
++#line 191 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteCreateIndex(pParse,0,0,0,yymsp[0].minor.yy372,0,0);}
++#line 1930 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 57: /* ccons ::= CHECK LP expr RP onconf */
++#line 192 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yy_destructor(yypParser,158,&yymsp[-2].minor);
++}
++#line 1937 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 58: /* ccons ::= REFERENCES nm idxlist_opt refargs */
++#line 194 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteCreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy320,yymsp[0].minor.yy372);}
++#line 1942 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 59: /* ccons ::= defer_subclause */
++#line 195 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteDeferForeignKey(pParse,yymsp[0].minor.yy372);}
++#line 1947 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 60: /* ccons ::= COLLATE id */
++#line 196 "ext/sqlite/libsqlite/src/parse.y"
++{
++   sqliteAddCollateType(pParse, sqliteCollateType(yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n));
++}
++#line 1954 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 61: /* refargs ::= */
++#line 206 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Restrict * 0x010101; }
++#line 1959 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 62: /* refargs ::= refargs refarg */
++#line 207 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = (yymsp[-1].minor.yy372 & yymsp[0].minor.yy407.mask) | yymsp[0].minor.yy407.value; }
++#line 1964 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 63: /* refarg ::= MATCH nm */
++#line 209 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy407.value = 0;     yygotominor.yy407.mask = 0x000000; }
++#line 1969 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 64: /* refarg ::= ON DELETE refact */
++#line 210 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy407.value = yymsp[0].minor.yy372;     yygotominor.yy407.mask = 0x0000ff; }
++#line 1974 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 65: /* refarg ::= ON UPDATE refact */
++#line 211 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy407.value = yymsp[0].minor.yy372<<8;  yygotominor.yy407.mask = 0x00ff00; }
++#line 1979 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 66: /* refarg ::= ON INSERT refact */
++#line 212 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy407.value = yymsp[0].minor.yy372<<16; yygotominor.yy407.mask = 0xff0000; }
++#line 1984 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 67: /* refact ::= SET NULL */
++#line 214 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_SetNull; }
++#line 1989 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 68: /* refact ::= SET DEFAULT */
++#line 215 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_SetDflt; }
++#line 1994 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 69: /* refact ::= CASCADE */
++#line 216 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Cascade; }
++#line 1999 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 70: /* refact ::= RESTRICT */
++#line 217 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Restrict; }
++#line 2004 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 71: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
++      case 72: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==72);
++      case 87: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==87);
++      case 164: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==164);
++#line 219 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = yymsp[0].minor.yy372;}
++#line 2012 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 82: /* tcons ::= PRIMARY KEY LP idxlist RP onconf */
++#line 236 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteAddPrimaryKey(pParse,yymsp[-2].minor.yy320,yymsp[0].minor.yy372);}
++#line 2017 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 83: /* tcons ::= UNIQUE LP idxlist RP onconf */
++#line 238 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteCreateIndex(pParse,0,0,yymsp[-2].minor.yy320,yymsp[0].minor.yy372,0,0);}
++#line 2022 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 84: /* tcons ::= CHECK expr onconf */
++#line 239 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yy_destructor(yypParser,158,&yymsp[-1].minor);
++}
++#line 2029 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 85: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
++#line 241 "ext/sqlite/libsqlite/src/parse.y"
++{
++    sqliteCreateForeignKey(pParse, yymsp[-6].minor.yy320, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy320, yymsp[-1].minor.yy372);
++    sqliteDeferForeignKey(pParse, yymsp[0].minor.yy372);
++}
++#line 2037 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 88: /* onconf ::= */
++      case 90: /* orconf ::= */ yytestcase(yyruleno==90);
++#line 255 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Default; }
++#line 2043 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 89: /* onconf ::= ON CONFLICT resolvetype */
++      case 91: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==91);
++#line 256 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = yymsp[0].minor.yy372; }
++#line 2049 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 92: /* resolvetype ::= ROLLBACK */
++#line 259 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Rollback; }
++#line 2054 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 93: /* resolvetype ::= ABORT */
++      case 236: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==236);
++#line 260 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Abort; }
++#line 2060 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 94: /* resolvetype ::= FAIL */
++#line 261 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Fail; }
++#line 2065 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 95: /* resolvetype ::= IGNORE */
++#line 262 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Ignore; }
++#line 2070 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 96: /* resolvetype ::= REPLACE */
++#line 263 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_Replace; }
++#line 2075 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 97: /* cmd ::= DROP TABLE nm */
++#line 267 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteDropTable(pParse,&yymsp[0].minor.yy0,0);}
++#line 2080 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 98: /* cmd ::= CREATE temp VIEW nm AS select */
++#line 271 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteCreateView(pParse, &yymsp[-5].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy179, yymsp[-4].minor.yy372);
++}
++#line 2087 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 99: /* cmd ::= DROP VIEW nm */
++#line 274 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteDropTable(pParse, &yymsp[0].minor.yy0, 1);
++}
++#line 2094 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 100: /* cmd ::= select */
++#line 280 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteSelect(pParse, yymsp[0].minor.yy179, SRT_Callback, 0, 0, 0, 0);
++  sqliteSelectDelete(yymsp[0].minor.yy179);
++}
++#line 2102 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 101: /* select ::= oneselect */
++      case 125: /* seltablist_paren ::= select */ yytestcase(yyruleno==125);
++#line 290 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy179 = yymsp[0].minor.yy179;}
++#line 2108 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 102: /* select ::= select multiselect_op oneselect */
++#line 291 "ext/sqlite/libsqlite/src/parse.y"
++{
++  if( yymsp[0].minor.yy179 ){
++    yymsp[0].minor.yy179->op = yymsp[-1].minor.yy372;
++    yymsp[0].minor.yy179->pPrior = yymsp[-2].minor.yy179;
++  }
++  yygotominor.yy179 = yymsp[0].minor.yy179;
++}
++#line 2119 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 103: /* multiselect_op ::= UNION */
++#line 299 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = TK_UNION;}
++#line 2124 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 104: /* multiselect_op ::= UNION ALL */
++#line 300 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = TK_ALL;}
++#line 2129 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 105: /* multiselect_op ::= INTERSECT */
++#line 301 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = TK_INTERSECT;}
++#line 2134 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 106: /* multiselect_op ::= EXCEPT */
++#line 302 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = TK_EXCEPT;}
++#line 2139 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 107: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
++#line 304 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy179 = sqliteSelectNew(yymsp[-6].minor.yy322,yymsp[-5].minor.yy307,yymsp[-4].minor.yy242,yymsp[-3].minor.yy322,yymsp[-2].minor.yy242,yymsp[-1].minor.yy322,yymsp[-7].minor.yy372,yymsp[0].minor.yy124.limit,yymsp[0].minor.yy124.offset);
++}
++#line 2146 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 111: /* sclp ::= selcollist COMMA */
++#line 325 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = yymsp[-1].minor.yy322;}
++#line 2151 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 112: /* sclp ::= */
++      case 138: /* orderby_opt ::= */ yytestcase(yyruleno==138);
++      case 148: /* groupby_opt ::= */ yytestcase(yyruleno==148);
++#line 326 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = 0;}
++#line 2158 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 113: /* selcollist ::= sclp expr as */
++#line 327 "ext/sqlite/libsqlite/src/parse.y"
++{
++   yygotominor.yy322 = sqliteExprListAppend(yymsp[-2].minor.yy322,yymsp[-1].minor.yy242,yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
++}
++#line 2165 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 114: /* selcollist ::= sclp STAR */
++#line 330 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy322 = sqliteExprListAppend(yymsp[-1].minor.yy322, sqliteExpr(TK_ALL, 0, 0, 0), 0);
++}
++#line 2172 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 115: /* selcollist ::= sclp nm DOT STAR */
++#line 333 "ext/sqlite/libsqlite/src/parse.y"
++{
++  Expr *pRight = sqliteExpr(TK_ALL, 0, 0, 0);
++  Expr *pLeft = sqliteExpr(TK_ID, 0, 0, &yymsp[-2].minor.yy0);
++  yygotominor.yy322 = sqliteExprListAppend(yymsp[-3].minor.yy322, sqliteExpr(TK_DOT, pLeft, pRight, 0), 0);
++}
++#line 2181 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 116: /* as ::= AS nm */
++      case 117: /* as ::= ids */ yytestcase(yyruleno==117);
++      case 288: /* key_opt ::= USING ids */ yytestcase(yyruleno==288);
++#line 343 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy0 = yymsp[0].minor.yy0; }
++#line 2188 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 118: /* as ::= */
++#line 345 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy0.n = 0; }
++#line 2193 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 119: /* from ::= */
++#line 357 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy307 = sqliteMalloc(sizeof(*yygotominor.yy307));}
++#line 2198 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 120: /* from ::= FROM seltablist */
++#line 358 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy307 = yymsp[0].minor.yy307;}
++#line 2203 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 121: /* stl_prefix ::= seltablist joinop */
++#line 363 "ext/sqlite/libsqlite/src/parse.y"
++{
++   yygotominor.yy307 = yymsp[-1].minor.yy307;
++   if( yygotominor.yy307 && yygotominor.yy307->nSrc>0 ) yygotominor.yy307->a[yygotominor.yy307->nSrc-1].jointype = yymsp[0].minor.yy372;
++}
++#line 2211 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 122: /* stl_prefix ::= */
++#line 367 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy307 = 0;}
++#line 2216 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 123: /* seltablist ::= stl_prefix nm dbnm as on_opt using_opt */
++#line 368 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy307 = sqliteSrcListAppend(yymsp[-5].minor.yy307,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0);
++  if( yymsp[-2].minor.yy0.n ) sqliteSrcListAddAlias(yygotominor.yy307,&yymsp[-2].minor.yy0);
++  if( yymsp[-1].minor.yy242 ){
++    if( yygotominor.yy307 && yygotominor.yy307->nSrc>1 ){ yygotominor.yy307->a[yygotominor.yy307->nSrc-2].pOn = yymsp[-1].minor.yy242; }
++    else { sqliteExprDelete(yymsp[-1].minor.yy242); }
++  }
++  if( yymsp[0].minor.yy320 ){
++    if( yygotominor.yy307 && yygotominor.yy307->nSrc>1 ){ yygotominor.yy307->a[yygotominor.yy307->nSrc-2].pUsing = yymsp[0].minor.yy320; }
++    else { sqliteIdListDelete(yymsp[0].minor.yy320); }
++  }
++}
++#line 2232 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 124: /* seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt */
++#line 381 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy307 = sqliteSrcListAppend(yymsp[-6].minor.yy307,0,0);
++  yygotominor.yy307->a[yygotominor.yy307->nSrc-1].pSelect = yymsp[-4].minor.yy179;
++  if( yymsp[-2].minor.yy0.n ) sqliteSrcListAddAlias(yygotominor.yy307,&yymsp[-2].minor.yy0);
++  if( yymsp[-1].minor.yy242 ){
++    if( yygotominor.yy307 && yygotominor.yy307->nSrc>1 ){ yygotominor.yy307->a[yygotominor.yy307->nSrc-2].pOn = yymsp[-1].minor.yy242; }
++    else { sqliteExprDelete(yymsp[-1].minor.yy242); }
++  }
++  if( yymsp[0].minor.yy320 ){
++    if( yygotominor.yy307 && yygotominor.yy307->nSrc>1 ){ yygotominor.yy307->a[yygotominor.yy307->nSrc-2].pUsing = yymsp[0].minor.yy320; }
++    else { sqliteIdListDelete(yymsp[0].minor.yy320); }
++  }
++}
++#line 2249 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 126: /* seltablist_paren ::= seltablist */
++#line 402 "ext/sqlite/libsqlite/src/parse.y"
++{
++   yygotominor.yy179 = sqliteSelectNew(0,yymsp[0].minor.yy307,0,0,0,0,0,-1,0);
++}
++#line 2256 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 127: /* dbnm ::= */
++#line 407 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
++#line 2261 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 129: /* joinop ::= COMMA */
++      case 130: /* joinop ::= JOIN */ yytestcase(yyruleno==130);
++#line 412 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = JT_INNER; }
++#line 2267 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 131: /* joinop ::= JOIN_KW JOIN */
++#line 414 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = sqliteJoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
++#line 2272 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 132: /* joinop ::= JOIN_KW nm JOIN */
++#line 415 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = sqliteJoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
++#line 2277 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 133: /* joinop ::= JOIN_KW nm nm JOIN */
++#line 417 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = sqliteJoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
++#line 2282 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 134: /* on_opt ::= ON expr */
++      case 142: /* sortitem ::= expr */ yytestcase(yyruleno==142);
++      case 151: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==151);
++      case 158: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==158);
++      case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227);
++      case 229: /* case_operand ::= expr */ yytestcase(yyruleno==229);
++      case 233: /* expritem ::= expr */ yytestcase(yyruleno==233);
++#line 421 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = yymsp[0].minor.yy242;}
++#line 2293 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 135: /* on_opt ::= */
++      case 150: /* having_opt ::= */ yytestcase(yyruleno==150);
++      case 157: /* where_opt ::= */ yytestcase(yyruleno==157);
++      case 228: /* case_else ::= */ yytestcase(yyruleno==228);
++      case 230: /* case_operand ::= */ yytestcase(yyruleno==230);
++      case 234: /* expritem ::= */ yytestcase(yyruleno==234);
++#line 422 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = 0;}
++#line 2303 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 136: /* using_opt ::= USING LP idxlist RP */
++      case 169: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==169);
++      case 239: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==239);
++#line 426 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy320 = yymsp[-1].minor.yy320;}
++#line 2310 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 137: /* using_opt ::= */
++      case 168: /* inscollist_opt ::= */ yytestcase(yyruleno==168);
++      case 238: /* idxlist_opt ::= */ yytestcase(yyruleno==238);
++#line 427 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy320 = 0;}
++#line 2317 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 139: /* orderby_opt ::= ORDER BY sortlist */
++      case 149: /* groupby_opt ::= GROUP BY exprlist */ yytestcase(yyruleno==149);
++#line 438 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = yymsp[0].minor.yy322;}
++#line 2323 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 140: /* sortlist ::= sortlist COMMA sortitem collate sortorder */
++#line 439 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy322 = sqliteExprListAppend(yymsp[-4].minor.yy322,yymsp[-2].minor.yy242,0);
++  if( yygotominor.yy322 ) yygotominor.yy322->a[yygotominor.yy322->nExpr-1].sortOrder = yymsp[-1].minor.yy372+yymsp[0].minor.yy372;
++}
++#line 2331 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 141: /* sortlist ::= sortitem collate sortorder */
++#line 443 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy322 = sqliteExprListAppend(0,yymsp[-2].minor.yy242,0);
++  if( yygotominor.yy322 ) yygotominor.yy322->a[0].sortOrder = yymsp[-1].minor.yy372+yymsp[0].minor.yy372;
++}
++#line 2339 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 143: /* sortorder ::= ASC */
++      case 145: /* sortorder ::= */ yytestcase(yyruleno==145);
++#line 452 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = SQLITE_SO_ASC;}
++#line 2345 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 144: /* sortorder ::= DESC */
++#line 453 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = SQLITE_SO_DESC;}
++#line 2350 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 146: /* collate ::= */
++#line 455 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = SQLITE_SO_UNK;}
++#line 2355 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 147: /* collate ::= COLLATE id */
++#line 456 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = sqliteCollateType(yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);}
++#line 2360 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 152: /* limit_opt ::= */
++#line 469 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy124.limit = -1; yygotominor.yy124.offset = 0;}
++#line 2365 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 153: /* limit_opt ::= LIMIT signed */
++#line 470 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy124.limit = yymsp[0].minor.yy372; yygotominor.yy124.offset = 0;}
++#line 2370 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 154: /* limit_opt ::= LIMIT signed OFFSET signed */
++#line 472 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy124.limit = yymsp[-2].minor.yy372; yygotominor.yy124.offset = yymsp[0].minor.yy372;}
++#line 2375 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 155: /* limit_opt ::= LIMIT signed COMMA signed */
++#line 474 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy124.limit = yymsp[0].minor.yy372; yygotominor.yy124.offset = yymsp[-2].minor.yy372;}
++#line 2380 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 156: /* cmd ::= DELETE FROM nm dbnm where_opt */
++#line 478 "ext/sqlite/libsqlite/src/parse.y"
++{
++   sqliteDeleteFrom(pParse, sqliteSrcListAppend(0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0), yymsp[0].minor.yy242);
++}
++#line 2387 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 159: /* cmd ::= UPDATE orconf nm dbnm SET setlist where_opt */
++#line 494 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteUpdate(pParse,sqliteSrcListAppend(0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0),yymsp[-1].minor.yy322,yymsp[0].minor.yy242,yymsp[-5].minor.yy372);}
++#line 2392 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 160: /* setlist ::= setlist COMMA nm EQ expr */
++#line 497 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = sqliteExprListAppend(yymsp[-4].minor.yy322,yymsp[0].minor.yy242,&yymsp[-2].minor.yy0);}
++#line 2397 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 161: /* setlist ::= nm EQ expr */
++#line 498 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = sqliteExprListAppend(0,yymsp[0].minor.yy242,&yymsp[-2].minor.yy0);}
++#line 2402 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 162: /* cmd ::= insert_cmd INTO nm dbnm inscollist_opt VALUES LP itemlist RP */
++#line 504 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteInsert(pParse, sqliteSrcListAppend(0,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0), yymsp[-1].minor.yy322, 0, yymsp[-4].minor.yy320, yymsp[-8].minor.yy372);}
++#line 2407 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 163: /* cmd ::= insert_cmd INTO nm dbnm inscollist_opt select */
++#line 506 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteInsert(pParse, sqliteSrcListAppend(0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0), 0, yymsp[0].minor.yy179, yymsp[-1].minor.yy320, yymsp[-5].minor.yy372);}
++#line 2412 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 165: /* insert_cmd ::= REPLACE */
++#line 510 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = OE_Replace;}
++#line 2417 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 166: /* itemlist ::= itemlist COMMA expr */
++      case 231: /* exprlist ::= exprlist COMMA expritem */ yytestcase(yyruleno==231);
++#line 516 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = sqliteExprListAppend(yymsp[-2].minor.yy322,yymsp[0].minor.yy242,0);}
++#line 2423 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 167: /* itemlist ::= expr */
++      case 232: /* exprlist ::= expritem */ yytestcase(yyruleno==232);
++#line 517 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy322 = sqliteExprListAppend(0,yymsp[0].minor.yy242,0);}
++#line 2429 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 170: /* inscollist ::= inscollist COMMA nm */
++      case 240: /* idxlist ::= idxlist COMMA idxitem */ yytestcase(yyruleno==240);
++#line 526 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy320 = sqliteIdListAppend(yymsp[-2].minor.yy320,&yymsp[0].minor.yy0);}
++#line 2435 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 171: /* inscollist ::= nm */
++      case 241: /* idxlist ::= idxitem */ yytestcase(yyruleno==241);
++#line 527 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy320 = sqliteIdListAppend(0,&yymsp[0].minor.yy0);}
++#line 2441 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 172: /* expr ::= LP expr RP */
++#line 535 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = yymsp[-1].minor.yy242; sqliteExprSpan(yygotominor.yy242,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
++#line 2446 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 173: /* expr ::= NULL */
++#line 536 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_NULL, 0, 0, &yymsp[0].minor.yy0);}
++#line 2451 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 174: /* expr ::= ID */
++      case 175: /* expr ::= JOIN_KW */ yytestcase(yyruleno==175);
++#line 537 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_ID, 0, 0, &yymsp[0].minor.yy0);}
++#line 2457 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 176: /* expr ::= nm DOT nm */
++#line 539 "ext/sqlite/libsqlite/src/parse.y"
++{
++  Expr *temp1 = sqliteExpr(TK_ID, 0, 0, &yymsp[-2].minor.yy0);
++  Expr *temp2 = sqliteExpr(TK_ID, 0, 0, &yymsp[0].minor.yy0);
++  yygotominor.yy242 = sqliteExpr(TK_DOT, temp1, temp2, 0);
++}
++#line 2466 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 177: /* expr ::= nm DOT nm DOT nm */
++#line 544 "ext/sqlite/libsqlite/src/parse.y"
++{
++  Expr *temp1 = sqliteExpr(TK_ID, 0, 0, &yymsp[-4].minor.yy0);
++  Expr *temp2 = sqliteExpr(TK_ID, 0, 0, &yymsp[-2].minor.yy0);
++  Expr *temp3 = sqliteExpr(TK_ID, 0, 0, &yymsp[0].minor.yy0);
++  Expr *temp4 = sqliteExpr(TK_DOT, temp2, temp3, 0);
++  yygotominor.yy242 = sqliteExpr(TK_DOT, temp1, temp4, 0);
++}
++#line 2477 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 178: /* expr ::= INTEGER */
++#line 551 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_INTEGER, 0, 0, &yymsp[0].minor.yy0);}
++#line 2482 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 179: /* expr ::= FLOAT */
++#line 552 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_FLOAT, 0, 0, &yymsp[0].minor.yy0);}
++#line 2487 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 180: /* expr ::= STRING */
++#line 553 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_STRING, 0, 0, &yymsp[0].minor.yy0);}
++#line 2492 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 181: /* expr ::= VARIABLE */
++#line 554 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_VARIABLE, 0, 0, &yymsp[0].minor.yy0);
++  if( yygotominor.yy242 ) yygotominor.yy242->iTable = ++pParse->nVar;
++}
++#line 2500 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 182: /* expr ::= ID LP exprlist RP */
++#line 558 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExprFunction(yymsp[-1].minor.yy322, &yymsp[-3].minor.yy0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
++}
++#line 2508 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 183: /* expr ::= ID LP STAR RP */
++#line 562 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExprFunction(0, &yymsp[-3].minor.yy0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
++}
++#line 2516 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 184: /* expr ::= expr AND expr */
++#line 566 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_AND, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2521 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 185: /* expr ::= expr OR expr */
++#line 567 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_OR, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2526 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 186: /* expr ::= expr LT expr */
++#line 568 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_LT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2531 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 187: /* expr ::= expr GT expr */
++#line 569 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_GT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2536 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 188: /* expr ::= expr LE expr */
++#line 570 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_LE, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2541 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 189: /* expr ::= expr GE expr */
++#line 571 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_GE, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2546 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 190: /* expr ::= expr NE expr */
++#line 572 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_NE, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2551 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 191: /* expr ::= expr EQ expr */
++#line 573 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_EQ, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2556 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 192: /* expr ::= expr BITAND expr */
++#line 574 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_BITAND, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2561 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 193: /* expr ::= expr BITOR expr */
++#line 575 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_BITOR, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2566 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 194: /* expr ::= expr LSHIFT expr */
++#line 576 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_LSHIFT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2571 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 195: /* expr ::= expr RSHIFT expr */
++#line 577 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_RSHIFT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2576 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 196: /* expr ::= expr likeop expr */
++#line 578 "ext/sqlite/libsqlite/src/parse.y"
++{
++  ExprList *pList = sqliteExprListAppend(0, yymsp[0].minor.yy242, 0);
++  pList = sqliteExprListAppend(pList, yymsp[-2].minor.yy242, 0);
++  yygotominor.yy242 = sqliteExprFunction(pList, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->op = yymsp[-1].minor.yy372;
++  sqliteExprSpan(yygotominor.yy242, &yymsp[-2].minor.yy242->span, &yymsp[0].minor.yy242->span);
++}
++#line 2587 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 197: /* expr ::= expr NOT likeop expr */
++#line 585 "ext/sqlite/libsqlite/src/parse.y"
++{
++  ExprList *pList = sqliteExprListAppend(0, yymsp[0].minor.yy242, 0);
++  pList = sqliteExprListAppend(pList, yymsp[-3].minor.yy242, 0);
++  yygotominor.yy242 = sqliteExprFunction(pList, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->op = yymsp[-1].minor.yy372;
++  yygotominor.yy242 = sqliteExpr(TK_NOT, yygotominor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-3].minor.yy242->span,&yymsp[0].minor.yy242->span);
++}
++#line 2599 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 198: /* likeop ::= LIKE */
++#line 594 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = TK_LIKE;}
++#line 2604 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 199: /* likeop ::= GLOB */
++#line 595 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy372 = TK_GLOB;}
++#line 2609 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 200: /* expr ::= expr PLUS expr */
++#line 596 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_PLUS, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2614 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 201: /* expr ::= expr MINUS expr */
++#line 597 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_MINUS, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2619 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 202: /* expr ::= expr STAR expr */
++#line 598 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_STAR, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2624 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 203: /* expr ::= expr SLASH expr */
++#line 599 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_SLASH, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2629 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 204: /* expr ::= expr REM expr */
++#line 600 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_REM, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2634 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 205: /* expr ::= expr CONCAT expr */
++#line 601 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy242 = sqliteExpr(TK_CONCAT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, 0);}
++#line 2639 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 206: /* expr ::= expr ISNULL */
++#line 602 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_ISNULL, yymsp[-1].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-1].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2647 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 207: /* expr ::= expr IS NULL */
++#line 606 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_ISNULL, yymsp[-2].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-2].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2655 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 208: /* expr ::= expr NOTNULL */
++#line 610 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_NOTNULL, yymsp[-1].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-1].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2663 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 209: /* expr ::= expr NOT NULL */
++#line 614 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_NOTNULL, yymsp[-2].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-2].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2671 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 210: /* expr ::= expr IS NOT NULL */
++#line 618 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_NOTNULL, yymsp[-3].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-3].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2679 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 211: /* expr ::= NOT expr */
++#line 622 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_NOT, yymsp[0].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy242->span);
++}
++#line 2687 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 212: /* expr ::= BITNOT expr */
++#line 626 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_BITNOT, yymsp[0].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy242->span);
++}
++#line 2695 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 213: /* expr ::= MINUS expr */
++#line 630 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_UMINUS, yymsp[0].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy242->span);
++}
++#line 2703 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 214: /* expr ::= PLUS expr */
++#line 634 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_UPLUS, yymsp[0].minor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy242->span);
++}
++#line 2711 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 215: /* expr ::= LP select RP */
++#line 638 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_SELECT, 0, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pSelect = yymsp[-1].minor.yy179;
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
++}
++#line 2720 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 216: /* expr ::= expr BETWEEN expr AND expr */
++#line 643 "ext/sqlite/libsqlite/src/parse.y"
++{
++  ExprList *pList = sqliteExprListAppend(0, yymsp[-2].minor.yy242, 0);
++  pList = sqliteExprListAppend(pList, yymsp[0].minor.yy242, 0);
++  yygotominor.yy242 = sqliteExpr(TK_BETWEEN, yymsp[-4].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pList = pList;
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-4].minor.yy242->span,&yymsp[0].minor.yy242->span);
++}
++#line 2731 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 217: /* expr ::= expr NOT BETWEEN expr AND expr */
++#line 650 "ext/sqlite/libsqlite/src/parse.y"
++{
++  ExprList *pList = sqliteExprListAppend(0, yymsp[-2].minor.yy242, 0);
++  pList = sqliteExprListAppend(pList, yymsp[0].minor.yy242, 0);
++  yygotominor.yy242 = sqliteExpr(TK_BETWEEN, yymsp[-5].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pList = pList;
++  yygotominor.yy242 = sqliteExpr(TK_NOT, yygotominor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-5].minor.yy242->span,&yymsp[0].minor.yy242->span);
++}
++#line 2743 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 218: /* expr ::= expr IN LP exprlist RP */
++#line 658 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_IN, yymsp[-4].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pList = yymsp[-1].minor.yy322;
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-4].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2752 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 219: /* expr ::= expr IN LP select RP */
++#line 663 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_IN, yymsp[-4].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pSelect = yymsp[-1].minor.yy179;
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-4].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2761 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 220: /* expr ::= expr NOT IN LP exprlist RP */
++#line 668 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_IN, yymsp[-5].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pList = yymsp[-1].minor.yy322;
++  yygotominor.yy242 = sqliteExpr(TK_NOT, yygotominor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-5].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2771 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 221: /* expr ::= expr NOT IN LP select RP */
++#line 674 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_IN, yymsp[-5].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pSelect = yymsp[-1].minor.yy179;
++  yygotominor.yy242 = sqliteExpr(TK_NOT, yygotominor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-5].minor.yy242->span,&yymsp[0].minor.yy0);
++}
++#line 2781 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 222: /* expr ::= expr IN nm dbnm */
++#line 680 "ext/sqlite/libsqlite/src/parse.y"
++{
++  SrcList *pSrc = sqliteSrcListAppend(0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);
++  yygotominor.yy242 = sqliteExpr(TK_IN, yymsp[-3].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pSelect = sqliteSelectNew(0,pSrc,0,0,0,0,0,-1,0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-3].minor.yy242->span,yymsp[0].minor.yy0.z?&yymsp[0].minor.yy0:&yymsp[-1].minor.yy0);
++}
++#line 2791 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 223: /* expr ::= expr NOT IN nm dbnm */
++#line 686 "ext/sqlite/libsqlite/src/parse.y"
++{
++  SrcList *pSrc = sqliteSrcListAppend(0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);
++  yygotominor.yy242 = sqliteExpr(TK_IN, yymsp[-4].minor.yy242, 0, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pSelect = sqliteSelectNew(0,pSrc,0,0,0,0,0,-1,0);
++  yygotominor.yy242 = sqliteExpr(TK_NOT, yygotominor.yy242, 0, 0);
++  sqliteExprSpan(yygotominor.yy242,&yymsp[-4].minor.yy242->span,yymsp[0].minor.yy0.z?&yymsp[0].minor.yy0:&yymsp[-1].minor.yy0);
++}
++#line 2802 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 224: /* expr ::= CASE case_operand case_exprlist case_else END */
++#line 696 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_CASE, yymsp[-3].minor.yy242, yymsp[-1].minor.yy242, 0);
++  if( yygotominor.yy242 ) yygotominor.yy242->pList = yymsp[-2].minor.yy322;
++  sqliteExprSpan(yygotominor.yy242, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
++}
++#line 2811 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
++#line 703 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy322 = sqliteExprListAppend(yymsp[-4].minor.yy322, yymsp[-2].minor.yy242, 0);
++  yygotominor.yy322 = sqliteExprListAppend(yygotominor.yy322, yymsp[0].minor.yy242, 0);
++}
++#line 2819 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 226: /* case_exprlist ::= WHEN expr THEN expr */
++#line 707 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy322 = sqliteExprListAppend(0, yymsp[-2].minor.yy242, 0);
++  yygotominor.yy322 = sqliteExprListAppend(yygotominor.yy322, yymsp[0].minor.yy242, 0);
++}
++#line 2827 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 235: /* cmd ::= CREATE uniqueflag INDEX nm ON nm dbnm LP idxlist RP onconf */
++#line 732 "ext/sqlite/libsqlite/src/parse.y"
++{
++  SrcList *pSrc = sqliteSrcListAppend(0, &yymsp[-5].minor.yy0, &yymsp[-4].minor.yy0);
++  if( yymsp[-9].minor.yy372!=OE_None ) yymsp[-9].minor.yy372 = yymsp[0].minor.yy372;
++  if( yymsp[-9].minor.yy372==OE_Default) yymsp[-9].minor.yy372 = OE_Abort;
++  sqliteCreateIndex(pParse, &yymsp[-7].minor.yy0, pSrc, yymsp[-2].minor.yy320, yymsp[-9].minor.yy372, &yymsp[-10].minor.yy0, &yymsp[-1].minor.yy0);
++}
++#line 2837 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 237: /* uniqueflag ::= */
++#line 741 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = OE_None; }
++#line 2842 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 243: /* cmd ::= DROP INDEX nm dbnm */
++#line 758 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteDropIndex(pParse, sqliteSrcListAppend(0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0));
++}
++#line 2849 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 244: /* cmd ::= COPY orconf nm dbnm FROM nm USING DELIMITERS STRING */
++#line 766 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteCopy(pParse,sqliteSrcListAppend(0,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0),&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0,yymsp[-7].minor.yy372);}
++#line 2854 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 245: /* cmd ::= COPY orconf nm dbnm FROM nm */
++#line 768 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteCopy(pParse,sqliteSrcListAppend(0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0),&yymsp[0].minor.yy0,0,yymsp[-4].minor.yy372);}
++#line 2859 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 246: /* cmd ::= VACUUM */
++#line 772 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteVacuum(pParse,0);}
++#line 2864 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 247: /* cmd ::= VACUUM nm */
++#line 773 "ext/sqlite/libsqlite/src/parse.y"
++{sqliteVacuum(pParse,&yymsp[0].minor.yy0);}
++#line 2869 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 248: /* cmd ::= PRAGMA ids EQ nm */
++      case 249: /* cmd ::= PRAGMA ids EQ ON */ yytestcase(yyruleno==249);
++      case 250: /* cmd ::= PRAGMA ids EQ plus_num */ yytestcase(yyruleno==250);
++#line 777 "ext/sqlite/libsqlite/src/parse.y"
++{sqlitePragma(pParse,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
++#line 2876 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 251: /* cmd ::= PRAGMA ids EQ minus_num */
++#line 780 "ext/sqlite/libsqlite/src/parse.y"
++{sqlitePragma(pParse,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
++#line 2881 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 252: /* cmd ::= PRAGMA ids LP nm RP */
++#line 781 "ext/sqlite/libsqlite/src/parse.y"
++{sqlitePragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
++#line 2886 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 253: /* cmd ::= PRAGMA ids */
++#line 782 "ext/sqlite/libsqlite/src/parse.y"
++{sqlitePragma(pParse,&yymsp[0].minor.yy0,&yymsp[0].minor.yy0,0);}
++#line 2891 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 260: /* cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END */
++#line 792 "ext/sqlite/libsqlite/src/parse.y"
++{
++  Token all;
++  all.z = yymsp[-4].minor.yy0.z;
++  all.n = (yymsp[0].minor.yy0.z - yymsp[-4].minor.yy0.z) + yymsp[0].minor.yy0.n;
++  sqliteFinishTrigger(pParse, yymsp[-1].minor.yy19, &all);
++}
++#line 2901 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 261: /* trigger_decl ::= temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause */
++#line 800 "ext/sqlite/libsqlite/src/parse.y"
++{
++  SrcList *pTab = sqliteSrcListAppend(0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0);
++  sqliteBeginTrigger(pParse, &yymsp[-7].minor.yy0, yymsp[-6].minor.yy372, yymsp[-5].minor.yy290.a, yymsp[-5].minor.yy290.b, pTab, yymsp[-1].minor.yy372, yymsp[0].minor.yy182, yymsp[-9].minor.yy372);
++}
++#line 2909 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 262: /* trigger_time ::= BEFORE */
++      case 265: /* trigger_time ::= */ yytestcase(yyruleno==265);
++#line 806 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = TK_BEFORE; }
++#line 2915 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 263: /* trigger_time ::= AFTER */
++#line 807 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = TK_AFTER;  }
++#line 2920 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 264: /* trigger_time ::= INSTEAD OF */
++#line 808 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = TK_INSTEAD;}
++#line 2925 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 266: /* trigger_event ::= DELETE */
++#line 813 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy290.a = TK_DELETE; yygotominor.yy290.b = 0; }
++#line 2930 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 267: /* trigger_event ::= INSERT */
++#line 814 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy290.a = TK_INSERT; yygotominor.yy290.b = 0; }
++#line 2935 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 268: /* trigger_event ::= UPDATE */
++#line 815 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy290.a = TK_UPDATE; yygotominor.yy290.b = 0;}
++#line 2940 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 269: /* trigger_event ::= UPDATE OF inscollist */
++#line 816 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy290.a = TK_UPDATE; yygotominor.yy290.b = yymsp[0].minor.yy320; }
++#line 2945 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 270: /* foreach_clause ::= */
++      case 271: /* foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==271);
++#line 819 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = TK_ROW; }
++#line 2951 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 272: /* foreach_clause ::= FOR EACH STATEMENT */
++#line 821 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy372 = TK_STATEMENT; }
++#line 2956 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 273: /* when_clause ::= */
++#line 824 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy182 = 0; }
++#line 2961 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 274: /* when_clause ::= WHEN expr */
++#line 825 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy182 = yymsp[0].minor.yy242; }
++#line 2966 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 275: /* trigger_cmd_list ::= trigger_cmd SEMI trigger_cmd_list */
++#line 829 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yymsp[-2].minor.yy19->pNext = yymsp[0].minor.yy19;
++  yygotominor.yy19 = yymsp[-2].minor.yy19;
++}
++#line 2974 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 276: /* trigger_cmd_list ::= */
++#line 833 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy19 = 0; }
++#line 2979 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 277: /* trigger_cmd ::= UPDATE orconf nm SET setlist where_opt */
++#line 839 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy19 = sqliteTriggerUpdateStep(&yymsp[-3].minor.yy0, yymsp[-1].minor.yy322, yymsp[0].minor.yy242, yymsp[-4].minor.yy372); }
++#line 2984 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 278: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP */
++#line 844 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy19 = sqliteTriggerInsertStep(&yymsp[-5].minor.yy0, yymsp[-4].minor.yy320, yymsp[-1].minor.yy322, 0, yymsp[-7].minor.yy372);}
++#line 2989 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 279: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt select */
++#line 847 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy19 = sqliteTriggerInsertStep(&yymsp[-2].minor.yy0, yymsp[-1].minor.yy320, 0, yymsp[0].minor.yy179, yymsp[-4].minor.yy372);}
++#line 2994 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 280: /* trigger_cmd ::= DELETE FROM nm where_opt */
++#line 851 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy19 = sqliteTriggerDeleteStep(&yymsp[-1].minor.yy0, yymsp[0].minor.yy242);}
++#line 2999 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 281: /* trigger_cmd ::= select */
++#line 854 "ext/sqlite/libsqlite/src/parse.y"
++{yygotominor.yy19 = sqliteTriggerSelectStep(yymsp[0].minor.yy179); }
++#line 3004 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 282: /* expr ::= RAISE LP IGNORE RP */
++#line 857 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_RAISE, 0, 0, 0); 
++  yygotominor.yy242->iColumn = OE_Ignore;
++  sqliteExprSpan(yygotominor.yy242, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
++}
++#line 3013 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 283: /* expr ::= RAISE LP ROLLBACK COMMA nm RP */
++#line 862 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); 
++  yygotominor.yy242->iColumn = OE_Rollback;
++  sqliteExprSpan(yygotominor.yy242, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
++}
++#line 3022 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 284: /* expr ::= RAISE LP ABORT COMMA nm RP */
++#line 867 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); 
++  yygotominor.yy242->iColumn = OE_Abort;
++  sqliteExprSpan(yygotominor.yy242, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
++}
++#line 3031 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 285: /* expr ::= RAISE LP FAIL COMMA nm RP */
++#line 872 "ext/sqlite/libsqlite/src/parse.y"
++{
++  yygotominor.yy242 = sqliteExpr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); 
++  yygotominor.yy242->iColumn = OE_Fail;
++  sqliteExprSpan(yygotominor.yy242, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
++}
++#line 3040 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 286: /* cmd ::= DROP TRIGGER nm dbnm */
++#line 879 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteDropTrigger(pParse,sqliteSrcListAppend(0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0));
++}
++#line 3047 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 287: /* cmd ::= ATTACH database_kw_opt ids AS nm key_opt */
++#line 884 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteAttach(pParse, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);
++}
++#line 3054 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 289: /* key_opt ::= */
++#line 889 "ext/sqlite/libsqlite/src/parse.y"
++{ yygotominor.yy0.z = 0; yygotominor.yy0.n = 0; }
++#line 3059 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      case 292: /* cmd ::= DETACH database_kw_opt nm */
++#line 895 "ext/sqlite/libsqlite/src/parse.y"
++{
++  sqliteDetach(pParse, &yymsp[0].minor.yy0);
++}
++#line 3066 "ext/sqlite/libsqlite/src/parse.c"
++        break;
++      default:
++      /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
++      /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1);
++      /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2);
++      /* (3) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==3);
++      /* (4) ecmd ::= SEMI */ yytestcase(yyruleno==4);
++      /* (9) trans_opt ::= */ yytestcase(yyruleno==9);
++      /* (10) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==10);
++      /* (11) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==11);
++      /* (15) cmd ::= create_table create_table_args */ yytestcase(yyruleno==15);
++      /* (21) columnlist ::= columnlist COMMA column */ yytestcase(yyruleno==21);
++      /* (22) columnlist ::= column */ yytestcase(yyruleno==22);
++      /* (23) column ::= columnid type carglist */ yytestcase(yyruleno==23);
++      /* (31) type ::= */ yytestcase(yyruleno==31);
++      /* (40) carglist ::= carglist carg */ yytestcase(yyruleno==40);
++      /* (41) carglist ::= */ yytestcase(yyruleno==41);
++      /* (42) carg ::= CONSTRAINT nm ccons */ yytestcase(yyruleno==42);
++      /* (43) carg ::= ccons */ yytestcase(yyruleno==43);
++      /* (52) carg ::= DEFAULT NULL */ yytestcase(yyruleno==52);
++      /* (53) ccons ::= NULL onconf */ yytestcase(yyruleno==53);
++      /* (76) conslist_opt ::= */ yytestcase(yyruleno==76);
++      /* (77) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==77);
++      /* (78) conslist ::= conslist COMMA tcons */ yytestcase(yyruleno==78);
++      /* (79) conslist ::= conslist tcons */ yytestcase(yyruleno==79);
++      /* (80) conslist ::= tcons */ yytestcase(yyruleno==80);
++      /* (81) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==81);
++      /* (258) plus_opt ::= PLUS */ yytestcase(yyruleno==258);
++      /* (259) plus_opt ::= */ yytestcase(yyruleno==259);
++      /* (290) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==290);
++      /* (291) database_kw_opt ::= */ yytestcase(yyruleno==291);
++        break;
++  };
++  yygoto = yyRuleInfo[yyruleno].lhs;
++  yysize = yyRuleInfo[yyruleno].nrhs;
++  yypParser->yyidx -= yysize;
++  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
++  if( yyact < YYNSTATE ){
++#ifdef NDEBUG
++    /* If we are not debugging and the reduce action popped at least
++    ** one element off the stack, then we can push the new element back
++    ** onto the stack here, and skip the stack overflow test in yy_shift().
++    ** That gives a significant speed improvement. */
++    if( yysize ){
++      yypParser->yyidx++;
++      yymsp -= yysize-1;
++      yymsp->stateno = (YYACTIONTYPE)yyact;
++      yymsp->major = (YYCODETYPE)yygoto;
++      yymsp->minor = yygotominor;
++    }else
++#endif
++    {
++      yy_shift(yypParser,yyact,yygoto,&yygotominor);
++    }
++  }else{
++    assert( yyact == YYNSTATE + YYNRULE + 1 );
++    yy_accept(yypParser);
++  }
++}
++
++/*
++** The following code executes when the parse fails
++*/
++#ifndef YYNOERRORRECOVERY
++static void yy_parse_failed(
++  yyParser *yypParser           /* The parser */
++){
++  sqliteParserARG_FETCH;
++#ifndef NDEBUG
++  if( yyTraceFILE ){
++    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
++  }
++#endif
++  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
++  /* Here code is inserted which will be executed whenever the
++  ** parser fails */
++  sqliteParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
++}
++#endif /* YYNOERRORRECOVERY */
++
++/*
++** The following code executes when a syntax error first occurs.
++*/
++static void yy_syntax_error(
++  yyParser *yypParser,           /* The parser */
++  int yymajor,                   /* The major type of the error token */
++  YYMINORTYPE yyminor            /* The minor type of the error token */
++){
++  sqliteParserARG_FETCH;
++#define TOKEN (yyminor.yy0)
++#line 23 "ext/sqlite/libsqlite/src/parse.y"
++
++  if( pParse->zErrMsg==0 ){
++    if( TOKEN.z[0] ){
++      sqliteErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
++    }else{
++      sqliteErrorMsg(pParse, "incomplete SQL statement");
++    }
++  }
++#line 3166 "ext/sqlite/libsqlite/src/parse.c"
++  sqliteParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
++}
++
++/*
++** The following is executed when the parser accepts
++*/
++static void yy_accept(
++  yyParser *yypParser           /* The parser */
++){
++  sqliteParserARG_FETCH;
++#ifndef NDEBUG
++  if( yyTraceFILE ){
++    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
++  }
++#endif
++  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
++  /* Here code is inserted which will be executed whenever the
++  ** parser accepts */
++  sqliteParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
++}
++
++/* The main parser program.
++** The first argument is a pointer to a structure obtained from
++** "sqliteParserAlloc" which describes the current state of the parser.
++** The second argument is the major token number.  The third is
++** the minor token.  The fourth optional argument is whatever the
++** user wants (and specified in the grammar) and is available for
++** use by the action routines.
++**
++** Inputs:
++** <ul>
++** <li> A pointer to the parser (an opaque structure.)
++** <li> The major token number.
++** <li> The minor token number.
++** <li> An option argument of a grammar-specified type.
++** </ul>
++**
++** Outputs:
++** None.
++*/
++void sqliteParser(
++  void *yyp,                   /* The parser */
++  int yymajor,                 /* The major token code number */
++  sqliteParserTOKENTYPE yyminor       /* The value for the token */
++  sqliteParserARG_PDECL               /* Optional %extra_argument parameter */
++){
++  YYMINORTYPE yyminorunion;
++  int yyact;            /* The parser action. */
++  int yyendofinput;     /* True if we are at the end of input */
++#ifdef YYERRORSYMBOL
++  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
++#endif
++  yyParser *yypParser;  /* The parser */
++
++  /* (re)initialize the parser, if necessary */
++  yypParser = (yyParser*)yyp;
++  if( yypParser->yyidx<0 ){
++#if YYSTACKDEPTH<=0
++    if( yypParser->yystksz <=0 ){
++      /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
++      yyminorunion = yyzerominor;
++      yyStackOverflow(yypParser, &yyminorunion);
++      return;
++    }
++#endif
++    yypParser->yyidx = 0;
++    yypParser->yyerrcnt = -1;
++    yypParser->yystack[0].stateno = 0;
++    yypParser->yystack[0].major = 0;
++  }
++  yyminorunion.yy0 = yyminor;
++  yyendofinput = (yymajor==0);
++  sqliteParserARG_STORE;
++
++#ifndef NDEBUG
++  if( yyTraceFILE ){
++    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
++  }
++#endif
++
++  do{
++    yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
++    if( yyact<YYNSTATE ){
++      assert( !yyendofinput );  /* Impossible to shift the $ token */
++      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
++      yypParser->yyerrcnt--;
++      yymajor = YYNOCODE;
++    }else if( yyact < YYNSTATE + YYNRULE ){
++      yy_reduce(yypParser,yyact-YYNSTATE);
++    }else{
++      assert( yyact == YY_ERROR_ACTION );
++#ifdef YYERRORSYMBOL
++      int yymx;
++#endif
++#ifndef NDEBUG
++      if( yyTraceFILE ){
++        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
++      }
++#endif
++#ifdef YYERRORSYMBOL
++      /* A syntax error has occurred.
++      ** The response to an error depends upon whether or not the
++      ** grammar defines an error token "ERROR".  
++      **
++      ** This is what we do if the grammar does define ERROR:
++      **
++      **  * Call the %syntax_error function.
++      **
++      **  * Begin popping the stack until we enter a state where
++      **    it is legal to shift the error symbol, then shift
++      **    the error symbol.
++      **
++      **  * Set the error count to three.
++      **
++      **  * Begin accepting and shifting new tokens.  No new error
++      **    processing will occur until three tokens have been
++      **    shifted successfully.
++      **
++      */
++      if( yypParser->yyerrcnt<0 ){
++        yy_syntax_error(yypParser,yymajor,yyminorunion);
++      }
++      yymx = yypParser->yystack[yypParser->yyidx].major;
++      if( yymx==YYERRORSYMBOL || yyerrorhit ){
++#ifndef NDEBUG
++        if( yyTraceFILE ){
++          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
++             yyTracePrompt,yyTokenName[yymajor]);
++        }
++#endif
++        yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
++        yymajor = YYNOCODE;
++      }else{
++         while(
++          yypParser->yyidx >= 0 &&
++          yymx != YYERRORSYMBOL &&
++          (yyact = yy_find_reduce_action(
++                        yypParser->yystack[yypParser->yyidx].stateno,
++                        YYERRORSYMBOL)) >= YYNSTATE
++        ){
++          yy_pop_parser_stack(yypParser);
++        }
++        if( yypParser->yyidx < 0 || yymajor==0 ){
++          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
++          yy_parse_failed(yypParser);
++          yymajor = YYNOCODE;
++        }else if( yymx!=YYERRORSYMBOL ){
++          YYMINORTYPE u2;
++          u2.YYERRSYMDT = 0;
++          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
++        }
++      }
++      yypParser->yyerrcnt = 3;
++      yyerrorhit = 1;
++#elif defined(YYNOERRORRECOVERY)
++      /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
++      ** do any kind of error recovery.  Instead, simply invoke the syntax
++      ** error routine and continue going as if nothing had happened.
++      **
++      ** Applications can set this macro (for example inside %include) if
++      ** they intend to abandon the parse upon the first syntax error seen.
++      */
++      yy_syntax_error(yypParser,yymajor,yyminorunion);
++      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
++      yymajor = YYNOCODE;
++      
++#else  /* YYERRORSYMBOL is not defined */
++      /* This is what we do if the grammar does not define ERROR:
++      **
++      **  * Report an error message, and throw away the input token.
++      **
++      **  * If the input token is $, then fail the parse.
++      **
++      ** As before, subsequent error messages are suppressed until
++      ** three input tokens have been successfully shifted.
++      */
++      if( yypParser->yyerrcnt<=0 ){
++        yy_syntax_error(yypParser,yymajor,yyminorunion);
++      }
++      yypParser->yyerrcnt = 3;
++      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
++      if( yyendofinput ){
++        yy_parse_failed(yypParser);
++      }
++      yymajor = YYNOCODE;
++#endif
++    }
++  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
++  return;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/parse.h
+@@ -0,0 +1,130 @@
++#define TK_END_OF_FILE                     1
++#define TK_ILLEGAL                         2
++#define TK_SPACE                           3
++#define TK_UNCLOSED_STRING                 4
++#define TK_COMMENT                         5
++#define TK_FUNCTION                        6
++#define TK_COLUMN                          7
++#define TK_AGG_FUNCTION                    8
++#define TK_SEMI                            9
++#define TK_EXPLAIN                        10
++#define TK_BEGIN                          11
++#define TK_TRANSACTION                    12
++#define TK_COMMIT                         13
++#define TK_END                            14
++#define TK_ROLLBACK                       15
++#define TK_CREATE                         16
++#define TK_TABLE                          17
++#define TK_TEMP                           18
++#define TK_LP                             19
++#define TK_RP                             20
++#define TK_AS                             21
++#define TK_COMMA                          22
++#define TK_ID                             23
++#define TK_ABORT                          24
++#define TK_AFTER                          25
++#define TK_ASC                            26
++#define TK_ATTACH                         27
++#define TK_BEFORE                         28
++#define TK_CASCADE                        29
++#define TK_CLUSTER                        30
++#define TK_CONFLICT                       31
++#define TK_COPY                           32
++#define TK_DATABASE                       33
++#define TK_DEFERRED                       34
++#define TK_DELIMITERS                     35
++#define TK_DESC                           36
++#define TK_DETACH                         37
++#define TK_EACH                           38
++#define TK_FAIL                           39
++#define TK_FOR                            40
++#define TK_GLOB                           41
++#define TK_IGNORE                         42
++#define TK_IMMEDIATE                      43
++#define TK_INITIALLY                      44
++#define TK_INSTEAD                        45
++#define TK_LIKE                           46
++#define TK_MATCH                          47
++#define TK_KEY                            48
++#define TK_OF                             49
++#define TK_OFFSET                         50
++#define TK_PRAGMA                         51
++#define TK_RAISE                          52
++#define TK_REPLACE                        53
++#define TK_RESTRICT                       54
++#define TK_ROW                            55
++#define TK_STATEMENT                      56
++#define TK_TRIGGER                        57
++#define TK_VACUUM                         58
++#define TK_VIEW                           59
++#define TK_OR                             60
++#define TK_AND                            61
++#define TK_NOT                            62
++#define TK_EQ                             63
++#define TK_NE                             64
++#define TK_ISNULL                         65
++#define TK_NOTNULL                        66
++#define TK_IS                             67
++#define TK_BETWEEN                        68
++#define TK_IN                             69
++#define TK_GT                             70
++#define TK_GE                             71
++#define TK_LT                             72
++#define TK_LE                             73
++#define TK_BITAND                         74
++#define TK_BITOR                          75
++#define TK_LSHIFT                         76
++#define TK_RSHIFT                         77
++#define TK_PLUS                           78
++#define TK_MINUS                          79
++#define TK_STAR                           80
++#define TK_SLASH                          81
++#define TK_REM                            82
++#define TK_CONCAT                         83
++#define TK_UMINUS                         84
++#define TK_UPLUS                          85
++#define TK_BITNOT                         86
++#define TK_STRING                         87
++#define TK_JOIN_KW                        88
++#define TK_INTEGER                        89
++#define TK_CONSTRAINT                     90
++#define TK_DEFAULT                        91
++#define TK_FLOAT                          92
++#define TK_NULL                           93
++#define TK_PRIMARY                        94
++#define TK_UNIQUE                         95
++#define TK_CHECK                          96
++#define TK_REFERENCES                     97
++#define TK_COLLATE                        98
++#define TK_ON                             99
++#define TK_DELETE                         100
++#define TK_UPDATE                         101
++#define TK_INSERT                         102
++#define TK_SET                            103
++#define TK_DEFERRABLE                     104
++#define TK_FOREIGN                        105
++#define TK_DROP                           106
++#define TK_UNION                          107
++#define TK_ALL                            108
++#define TK_INTERSECT                      109
++#define TK_EXCEPT                         110
++#define TK_SELECT                         111
++#define TK_DISTINCT                       112
++#define TK_DOT                            113
++#define TK_FROM                           114
++#define TK_JOIN                           115
++#define TK_USING                          116
++#define TK_ORDER                          117
++#define TK_BY                             118
++#define TK_GROUP                          119
++#define TK_HAVING                         120
++#define TK_LIMIT                          121
++#define TK_WHERE                          122
++#define TK_INTO                           123
++#define TK_VALUES                         124
++#define TK_VARIABLE                       125
++#define TK_CASE                           126
++#define TK_WHEN                           127
++#define TK_THEN                           128
++#define TK_ELSE                           129
++#define TK_INDEX                          130
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/parse.y
+@@ -0,0 +1,897 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains SQLite's grammar for SQL.  Process this file
++** using the lemon parser generator to generate C code that runs
++** the parser.  Lemon will also generate a header file containing
++** numeric codes for all of the tokens.
++**
++** @(#) $Id$
++*/
++%token_prefix TK_
++%token_type {Token}
++%default_type {Token}
++%extra_argument {Parse *pParse}
++%syntax_error {
++  if( pParse->zErrMsg==0 ){
++    if( TOKEN.z[0] ){
++      sqliteErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
++    }else{
++      sqliteErrorMsg(pParse, "incomplete SQL statement");
++    }
++  }
++}
++%name sqliteParser
++%include {
++#include "sqliteInt.h"
++#include "parse.h"
++
++/*
++** An instance of this structure holds information about the
++** LIMIT clause of a SELECT statement.
++*/
++struct LimitVal {
++  int limit;    /* The LIMIT value.  -1 if there is no limit */
++  int offset;   /* The OFFSET.  0 if there is none */
++};
++
++/*
++** An instance of the following structure describes the event of a
++** TRIGGER.  "a" is the event type, one of TK_UPDATE, TK_INSERT,
++** TK_DELETE, or TK_INSTEAD.  If the event is of the form
++**
++**      UPDATE ON (a,b,c)
++**
++** Then the "b" IdList records the list "a,b,c".
++*/
++struct TrigEvent { int a; IdList * b; };
++
++} // end %include
++
++// These are extra tokens used by the lexer but never seen by the
++// parser.  We put them in a rule so that the parser generator will
++// add them to the parse.h output file.
++//
++%nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
++          COLUMN AGG_FUNCTION.
++
++// Input is a single SQL command
++input ::= cmdlist.
++cmdlist ::= cmdlist ecmd.
++cmdlist ::= ecmd.
++ecmd ::= explain cmdx SEMI.
++ecmd ::= SEMI.
++cmdx ::= cmd.           { sqliteExec(pParse); }
++explain ::= EXPLAIN.    { sqliteBeginParse(pParse, 1); }
++explain ::= .           { sqliteBeginParse(pParse, 0); }
++
++///////////////////// Begin and end transactions. ////////////////////////////
++//
++
++cmd ::= BEGIN trans_opt onconf(R).  {sqliteBeginTransaction(pParse,R);}
++trans_opt ::= .
++trans_opt ::= TRANSACTION.
++trans_opt ::= TRANSACTION nm.
++cmd ::= COMMIT trans_opt.      {sqliteCommitTransaction(pParse);}
++cmd ::= END trans_opt.         {sqliteCommitTransaction(pParse);}
++cmd ::= ROLLBACK trans_opt.    {sqliteRollbackTransaction(pParse);}
++
++///////////////////// The CREATE TABLE statement ////////////////////////////
++//
++cmd ::= create_table create_table_args.
++create_table ::= CREATE(X) temp(T) TABLE nm(Y). {
++   sqliteStartTable(pParse,&X,&Y,T,0);
++}
++%type temp {int}
++temp(A) ::= TEMP.  {A = 1;}
++temp(A) ::= .      {A = 0;}
++create_table_args ::= LP columnlist conslist_opt RP(X). {
++  sqliteEndTable(pParse,&X,0);
++}
++create_table_args ::= AS select(S). {
++  sqliteEndTable(pParse,0,S);
++  sqliteSelectDelete(S);
++}
++columnlist ::= columnlist COMMA column.
++columnlist ::= column.
++
++// About the only information used for a column is the name of the
++// column.  The type is always just "text".  But the code will accept
++// an elaborate typename.  Perhaps someday we'll do something with it.
++//
++column ::= columnid type carglist. 
++columnid ::= nm(X).                {sqliteAddColumn(pParse,&X);}
++
++// An IDENTIFIER can be a generic identifier, or one of several
++// keywords.  Any non-standard keyword can also be an identifier.
++//
++%type id {Token}
++id(A) ::= ID(X).         {A = X;}
++
++// The following directive causes tokens ABORT, AFTER, ASC, etc. to
++// fallback to ID if they will not parse as their original value.
++// This obviates the need for the "id" nonterminal.
++//
++%fallback ID
++  ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT
++  COPY DATABASE DEFERRED DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR
++  GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY
++  OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT
++  TEMP TRIGGER VACUUM VIEW.
++
++// Define operator precedence early so that this is the first occurance
++// of the operator tokens in the grammer.  Keeping the operators together
++// causes them to be assigned integer values that are close together,
++// which keeps parser tables smaller.
++//
++%left OR.
++%left AND.
++%right NOT.
++%left EQ NE ISNULL NOTNULL IS LIKE GLOB BETWEEN IN.
++%left GT GE LT LE.
++%left BITAND BITOR LSHIFT RSHIFT.
++%left PLUS MINUS.
++%left STAR SLASH REM.
++%left CONCAT.
++%right UMINUS UPLUS BITNOT.
++
++// And "ids" is an identifer-or-string.
++//
++%type ids {Token}
++ids(A) ::= ID(X).        {A = X;}
++ids(A) ::= STRING(X).    {A = X;}
++
++// The name of a column or table can be any of the following:
++//
++%type nm {Token}
++nm(A) ::= ID(X).         {A = X;}
++nm(A) ::= STRING(X).     {A = X;}
++nm(A) ::= JOIN_KW(X).    {A = X;}
++
++type ::= .
++type ::= typename(X).                    {sqliteAddColumnType(pParse,&X,&X);}
++type ::= typename(X) LP signed RP(Y).    {sqliteAddColumnType(pParse,&X,&Y);}
++type ::= typename(X) LP signed COMMA signed RP(Y).
++                                         {sqliteAddColumnType(pParse,&X,&Y);}
++%type typename {Token}
++typename(A) ::= ids(X).           {A = X;}
++typename(A) ::= typename(X) ids.  {A = X;}
++%type signed {int}
++signed(A) ::= INTEGER(X).         { A = atoi(X.z); }
++signed(A) ::= PLUS INTEGER(X).    { A = atoi(X.z); }
++signed(A) ::= MINUS INTEGER(X).   { A = -atoi(X.z); }
++carglist ::= carglist carg.
++carglist ::= .
++carg ::= CONSTRAINT nm ccons.
++carg ::= ccons.
++carg ::= DEFAULT STRING(X).          {sqliteAddDefaultValue(pParse,&X,0);}
++carg ::= DEFAULT ID(X).              {sqliteAddDefaultValue(pParse,&X,0);}
++carg ::= DEFAULT INTEGER(X).         {sqliteAddDefaultValue(pParse,&X,0);}
++carg ::= DEFAULT PLUS INTEGER(X).    {sqliteAddDefaultValue(pParse,&X,0);}
++carg ::= DEFAULT MINUS INTEGER(X).   {sqliteAddDefaultValue(pParse,&X,1);}
++carg ::= DEFAULT FLOAT(X).           {sqliteAddDefaultValue(pParse,&X,0);}
++carg ::= DEFAULT PLUS FLOAT(X).      {sqliteAddDefaultValue(pParse,&X,0);}
++carg ::= DEFAULT MINUS FLOAT(X).     {sqliteAddDefaultValue(pParse,&X,1);}
++carg ::= DEFAULT NULL. 
++
++// In addition to the type name, we also care about the primary key and
++// UNIQUE constraints.
++//
++ccons ::= NULL onconf.
++ccons ::= NOT NULL onconf(R).               {sqliteAddNotNull(pParse, R);}
++ccons ::= PRIMARY KEY sortorder onconf(R).  {sqliteAddPrimaryKey(pParse,0,R);}
++ccons ::= UNIQUE onconf(R).           {sqliteCreateIndex(pParse,0,0,0,R,0,0);}
++ccons ::= CHECK LP expr RP onconf.
++ccons ::= REFERENCES nm(T) idxlist_opt(TA) refargs(R).
++                                {sqliteCreateForeignKey(pParse,0,&T,TA,R);}
++ccons ::= defer_subclause(D).   {sqliteDeferForeignKey(pParse,D);}
++ccons ::= COLLATE id(C).  {
++   sqliteAddCollateType(pParse, sqliteCollateType(C.z, C.n));
++}
++
++// The next group of rules parses the arguments to a REFERENCES clause
++// that determine if the referential integrity checking is deferred or
++// or immediate and which determine what action to take if a ref-integ
++// check fails.
++//
++%type refargs {int}
++refargs(A) ::= .                     { A = OE_Restrict * 0x010101; }
++refargs(A) ::= refargs(X) refarg(Y). { A = (X & Y.mask) | Y.value; }
++%type refarg {struct {int value; int mask;}}
++refarg(A) ::= MATCH nm.              { A.value = 0;     A.mask = 0x000000; }
++refarg(A) ::= ON DELETE refact(X).   { A.value = X;     A.mask = 0x0000ff; }
++refarg(A) ::= ON UPDATE refact(X).   { A.value = X<<8;  A.mask = 0x00ff00; }
++refarg(A) ::= ON INSERT refact(X).   { A.value = X<<16; A.mask = 0xff0000; }
++%type refact {int}
++refact(A) ::= SET NULL.              { A = OE_SetNull; }
++refact(A) ::= SET DEFAULT.           { A = OE_SetDflt; }
++refact(A) ::= CASCADE.               { A = OE_Cascade; }
++refact(A) ::= RESTRICT.              { A = OE_Restrict; }
++%type defer_subclause {int}
++defer_subclause(A) ::= NOT DEFERRABLE init_deferred_pred_opt(X).  {A = X;}
++defer_subclause(A) ::= DEFERRABLE init_deferred_pred_opt(X).      {A = X;}
++%type init_deferred_pred_opt {int}
++init_deferred_pred_opt(A) ::= .                       {A = 0;}
++init_deferred_pred_opt(A) ::= INITIALLY DEFERRED.     {A = 1;}
++init_deferred_pred_opt(A) ::= INITIALLY IMMEDIATE.    {A = 0;}
++
++// For the time being, the only constraint we care about is the primary
++// key and UNIQUE.  Both create indices.
++//
++conslist_opt ::= .
++conslist_opt ::= COMMA conslist.
++conslist ::= conslist COMMA tcons.
++conslist ::= conslist tcons.
++conslist ::= tcons.
++tcons ::= CONSTRAINT nm.
++tcons ::= PRIMARY KEY LP idxlist(X) RP onconf(R).
++                                             {sqliteAddPrimaryKey(pParse,X,R);}
++tcons ::= UNIQUE LP idxlist(X) RP onconf(R).
++                                       {sqliteCreateIndex(pParse,0,0,X,R,0,0);}
++tcons ::= CHECK expr onconf.
++tcons ::= FOREIGN KEY LP idxlist(FA) RP
++          REFERENCES nm(T) idxlist_opt(TA) refargs(R) defer_subclause_opt(D). {
++    sqliteCreateForeignKey(pParse, FA, &T, TA, R);
++    sqliteDeferForeignKey(pParse, D);
++}
++%type defer_subclause_opt {int}
++defer_subclause_opt(A) ::= .                    {A = 0;}
++defer_subclause_opt(A) ::= defer_subclause(X).  {A = X;}
++
++// The following is a non-standard extension that allows us to declare the
++// default behavior when there is a constraint conflict.
++//
++%type onconf {int}
++%type orconf {int}
++%type resolvetype {int}
++onconf(A) ::= .                              { A = OE_Default; }
++onconf(A) ::= ON CONFLICT resolvetype(X).    { A = X; }
++orconf(A) ::= .                              { A = OE_Default; }
++orconf(A) ::= OR resolvetype(X).             { A = X; }
++resolvetype(A) ::= ROLLBACK.                 { A = OE_Rollback; }
++resolvetype(A) ::= ABORT.                    { A = OE_Abort; }
++resolvetype(A) ::= FAIL.                     { A = OE_Fail; }
++resolvetype(A) ::= IGNORE.                   { A = OE_Ignore; }
++resolvetype(A) ::= REPLACE.                  { A = OE_Replace; }
++
++////////////////////////// The DROP TABLE /////////////////////////////////////
++//
++cmd ::= DROP TABLE nm(X).          {sqliteDropTable(pParse,&X,0);}
++
++///////////////////// The CREATE VIEW statement /////////////////////////////
++//
++cmd ::= CREATE(X) temp(T) VIEW nm(Y) AS select(S). {
++  sqliteCreateView(pParse, &X, &Y, S, T);
++}
++cmd ::= DROP VIEW nm(X). {
++  sqliteDropTable(pParse, &X, 1);
++}
++
++//////////////////////// The SELECT statement /////////////////////////////////
++//
++cmd ::= select(X).  {
++  sqliteSelect(pParse, X, SRT_Callback, 0, 0, 0, 0);
++  sqliteSelectDelete(X);
++}
++
++%type select {Select*}
++%destructor select {sqliteSelectDelete($$);}
++%type oneselect {Select*}
++%destructor oneselect {sqliteSelectDelete($$);}
++
++select(A) ::= oneselect(X).                      {A = X;}
++select(A) ::= select(X) multiselect_op(Y) oneselect(Z).  {
++  if( Z ){
++    Z->op = Y;
++    Z->pPrior = X;
++  }
++  A = Z;
++}
++%type multiselect_op {int}
++multiselect_op(A) ::= UNION.      {A = TK_UNION;}
++multiselect_op(A) ::= UNION ALL.  {A = TK_ALL;}
++multiselect_op(A) ::= INTERSECT.  {A = TK_INTERSECT;}
++multiselect_op(A) ::= EXCEPT.     {A = TK_EXCEPT;}
++oneselect(A) ::= SELECT distinct(D) selcollist(W) from(X) where_opt(Y)
++                 groupby_opt(P) having_opt(Q) orderby_opt(Z) limit_opt(L). {
++  A = sqliteSelectNew(W,X,Y,P,Q,Z,D,L.limit,L.offset);
++}
++
++// The "distinct" nonterminal is true (1) if the DISTINCT keyword is
++// present and false (0) if it is not.
++//
++%type distinct {int}
++distinct(A) ::= DISTINCT.   {A = 1;}
++distinct(A) ::= ALL.        {A = 0;}
++distinct(A) ::= .           {A = 0;}
++
++// selcollist is a list of expressions that are to become the return
++// values of the SELECT statement.  The "*" in statements like
++// "SELECT * FROM ..." is encoded as a special expression with an
++// opcode of TK_ALL.
++//
++%type selcollist {ExprList*}
++%destructor selcollist {sqliteExprListDelete($$);}
++%type sclp {ExprList*}
++%destructor sclp {sqliteExprListDelete($$);}
++sclp(A) ::= selcollist(X) COMMA.             {A = X;}
++sclp(A) ::= .                                {A = 0;}
++selcollist(A) ::= sclp(P) expr(X) as(Y).     {
++   A = sqliteExprListAppend(P,X,Y.n?&Y:0);
++}
++selcollist(A) ::= sclp(P) STAR. {
++  A = sqliteExprListAppend(P, sqliteExpr(TK_ALL, 0, 0, 0), 0);
++}
++selcollist(A) ::= sclp(P) nm(X) DOT STAR. {
++  Expr *pRight = sqliteExpr(TK_ALL, 0, 0, 0);
++  Expr *pLeft = sqliteExpr(TK_ID, 0, 0, &X);
++  A = sqliteExprListAppend(P, sqliteExpr(TK_DOT, pLeft, pRight, 0), 0);
++}
++
++// An option "AS <id>" phrase that can follow one of the expressions that
++// define the result set, or one of the tables in the FROM clause.
++//
++%type as {Token}
++as(X) ::= AS nm(Y).    { X = Y; }
++as(X) ::= ids(Y).      { X = Y; }
++as(X) ::= .            { X.n = 0; }
++
++
++%type seltablist {SrcList*}
++%destructor seltablist {sqliteSrcListDelete($$);}
++%type stl_prefix {SrcList*}
++%destructor stl_prefix {sqliteSrcListDelete($$);}
++%type from {SrcList*}
++%destructor from {sqliteSrcListDelete($$);}
++
++// A complete FROM clause.
++//
++from(A) ::= .                                 {A = sqliteMalloc(sizeof(*A));}
++from(A) ::= FROM seltablist(X).               {A = X;}
++
++// "seltablist" is a "Select Table List" - the content of the FROM clause
++// in a SELECT statement.  "stl_prefix" is a prefix of this list.
++//
++stl_prefix(A) ::= seltablist(X) joinop(Y).    {
++   A = X;
++   if( A && A->nSrc>0 ) A->a[A->nSrc-1].jointype = Y;
++}
++stl_prefix(A) ::= .                           {A = 0;}
++seltablist(A) ::= stl_prefix(X) nm(Y) dbnm(D) as(Z) on_opt(N) using_opt(U). {
++  A = sqliteSrcListAppend(X,&Y,&D);
++  if( Z.n ) sqliteSrcListAddAlias(A,&Z);
++  if( N ){
++    if( A && A->nSrc>1 ){ A->a[A->nSrc-2].pOn = N; }
++    else { sqliteExprDelete(N); }
++  }
++  if( U ){
++    if( A && A->nSrc>1 ){ A->a[A->nSrc-2].pUsing = U; }
++    else { sqliteIdListDelete(U); }
++  }
++}
++seltablist(A) ::= stl_prefix(X) LP seltablist_paren(S) RP
++                  as(Z) on_opt(N) using_opt(U). {
++  A = sqliteSrcListAppend(X,0,0);
++  A->a[A->nSrc-1].pSelect = S;
++  if( Z.n ) sqliteSrcListAddAlias(A,&Z);
++  if( N ){
++    if( A && A->nSrc>1 ){ A->a[A->nSrc-2].pOn = N; }
++    else { sqliteExprDelete(N); }
++  }
++  if( U ){
++    if( A && A->nSrc>1 ){ A->a[A->nSrc-2].pUsing = U; }
++    else { sqliteIdListDelete(U); }
++  }
++}
++
++// A seltablist_paren nonterminal represents anything in a FROM that
++// is contained inside parentheses.  This can be either a subquery or
++// a grouping of table and subqueries.
++//
++%type seltablist_paren {Select*}
++%destructor seltablist_paren {sqliteSelectDelete($$);}
++seltablist_paren(A) ::= select(S).      {A = S;}
++seltablist_paren(A) ::= seltablist(F).  {
++   A = sqliteSelectNew(0,F,0,0,0,0,0,-1,0);
++}
++
++%type dbnm {Token}
++dbnm(A) ::= .          {A.z=0; A.n=0;}
++dbnm(A) ::= DOT nm(X). {A = X;}
++
++%type joinop {int}
++%type joinop2 {int}
++joinop(X) ::= COMMA.                   { X = JT_INNER; }
++joinop(X) ::= JOIN.                    { X = JT_INNER; }
++joinop(X) ::= JOIN_KW(A) JOIN.         { X = sqliteJoinType(pParse,&A,0,0); }
++joinop(X) ::= JOIN_KW(A) nm(B) JOIN.   { X = sqliteJoinType(pParse,&A,&B,0); }
++joinop(X) ::= JOIN_KW(A) nm(B) nm(C) JOIN.
++                                       { X = sqliteJoinType(pParse,&A,&B,&C); }
++
++%type on_opt {Expr*}
++%destructor on_opt {sqliteExprDelete($$);}
++on_opt(N) ::= ON expr(E).   {N = E;}
++on_opt(N) ::= .             {N = 0;}
++
++%type using_opt {IdList*}
++%destructor using_opt {sqliteIdListDelete($$);}
++using_opt(U) ::= USING LP idxlist(L) RP.  {U = L;}
++using_opt(U) ::= .                        {U = 0;}
++
++
++%type orderby_opt {ExprList*}
++%destructor orderby_opt {sqliteExprListDelete($$);}
++%type sortlist {ExprList*}
++%destructor sortlist {sqliteExprListDelete($$);}
++%type sortitem {Expr*}
++%destructor sortitem {sqliteExprDelete($$);}
++
++orderby_opt(A) ::= .                          {A = 0;}
++orderby_opt(A) ::= ORDER BY sortlist(X).      {A = X;}
++sortlist(A) ::= sortlist(X) COMMA sortitem(Y) collate(C) sortorder(Z). {
++  A = sqliteExprListAppend(X,Y,0);
++  if( A ) A->a[A->nExpr-1].sortOrder = C+Z;
++}
++sortlist(A) ::= sortitem(Y) collate(C) sortorder(Z). {
++  A = sqliteExprListAppend(0,Y,0);
++  if( A ) A->a[0].sortOrder = C+Z;
++}
++sortitem(A) ::= expr(X).   {A = X;}
++
++%type sortorder {int}
++%type collate {int}
++
++sortorder(A) ::= ASC.           {A = SQLITE_SO_ASC;}
++sortorder(A) ::= DESC.          {A = SQLITE_SO_DESC;}
++sortorder(A) ::= .              {A = SQLITE_SO_ASC;}
++collate(C) ::= .                {C = SQLITE_SO_UNK;}
++collate(C) ::= COLLATE id(X).   {C = sqliteCollateType(X.z, X.n);}
++
++%type groupby_opt {ExprList*}
++%destructor groupby_opt {sqliteExprListDelete($$);}
++groupby_opt(A) ::= .                      {A = 0;}
++groupby_opt(A) ::= GROUP BY exprlist(X).  {A = X;}
++
++%type having_opt {Expr*}
++%destructor having_opt {sqliteExprDelete($$);}
++having_opt(A) ::= .                {A = 0;}
++having_opt(A) ::= HAVING expr(X).  {A = X;}
++
++%type limit_opt {struct LimitVal}
++limit_opt(A) ::= .                     {A.limit = -1; A.offset = 0;}
++limit_opt(A) ::= LIMIT signed(X).      {A.limit = X; A.offset = 0;}
++limit_opt(A) ::= LIMIT signed(X) OFFSET signed(Y). 
++                                       {A.limit = X; A.offset = Y;}
++limit_opt(A) ::= LIMIT signed(X) COMMA signed(Y). 
++                                       {A.limit = Y; A.offset = X;}
++
++/////////////////////////// The DELETE statement /////////////////////////////
++//
++cmd ::= DELETE FROM nm(X) dbnm(D) where_opt(Y). {
++   sqliteDeleteFrom(pParse, sqliteSrcListAppend(0,&X,&D), Y);
++}
++
++%type where_opt {Expr*}
++%destructor where_opt {sqliteExprDelete($$);}
++
++where_opt(A) ::= .                    {A = 0;}
++where_opt(A) ::= WHERE expr(X).       {A = X;}
++
++%type setlist {ExprList*}
++%destructor setlist {sqliteExprListDelete($$);}
++
++////////////////////////// The UPDATE command ////////////////////////////////
++//
++cmd ::= UPDATE orconf(R) nm(X) dbnm(D) SET setlist(Y) where_opt(Z).
++    {sqliteUpdate(pParse,sqliteSrcListAppend(0,&X,&D),Y,Z,R);}
++
++setlist(A) ::= setlist(Z) COMMA nm(X) EQ expr(Y).
++    {A = sqliteExprListAppend(Z,Y,&X);}
++setlist(A) ::= nm(X) EQ expr(Y).   {A = sqliteExprListAppend(0,Y,&X);}
++
++////////////////////////// The INSERT command /////////////////////////////////
++//
++cmd ::= insert_cmd(R) INTO nm(X) dbnm(D) inscollist_opt(F) 
++        VALUES LP itemlist(Y) RP.
++            {sqliteInsert(pParse, sqliteSrcListAppend(0,&X,&D), Y, 0, F, R);}
++cmd ::= insert_cmd(R) INTO nm(X) dbnm(D) inscollist_opt(F) select(S).
++            {sqliteInsert(pParse, sqliteSrcListAppend(0,&X,&D), 0, S, F, R);}
++
++%type insert_cmd {int}
++insert_cmd(A) ::= INSERT orconf(R).   {A = R;}
++insert_cmd(A) ::= REPLACE.            {A = OE_Replace;}
++
++
++%type itemlist {ExprList*}
++%destructor itemlist {sqliteExprListDelete($$);}
++
++itemlist(A) ::= itemlist(X) COMMA expr(Y).  {A = sqliteExprListAppend(X,Y,0);}
++itemlist(A) ::= expr(X).                    {A = sqliteExprListAppend(0,X,0);}
++
++%type inscollist_opt {IdList*}
++%destructor inscollist_opt {sqliteIdListDelete($$);}
++%type inscollist {IdList*}
++%destructor inscollist {sqliteIdListDelete($$);}
++
++inscollist_opt(A) ::= .                       {A = 0;}
++inscollist_opt(A) ::= LP inscollist(X) RP.    {A = X;}
++inscollist(A) ::= inscollist(X) COMMA nm(Y).  {A = sqliteIdListAppend(X,&Y);}
++inscollist(A) ::= nm(Y).                      {A = sqliteIdListAppend(0,&Y);}
++
++/////////////////////////// Expression Processing /////////////////////////////
++//
++
++%type expr {Expr*}
++%destructor expr {sqliteExprDelete($$);}
++
++expr(A) ::= LP(B) expr(X) RP(E). {A = X; sqliteExprSpan(A,&B,&E); }
++expr(A) ::= NULL(X).             {A = sqliteExpr(TK_NULL, 0, 0, &X);}
++expr(A) ::= ID(X).               {A = sqliteExpr(TK_ID, 0, 0, &X);}
++expr(A) ::= JOIN_KW(X).          {A = sqliteExpr(TK_ID, 0, 0, &X);}
++expr(A) ::= nm(X) DOT nm(Y). {
++  Expr *temp1 = sqliteExpr(TK_ID, 0, 0, &X);
++  Expr *temp2 = sqliteExpr(TK_ID, 0, 0, &Y);
++  A = sqliteExpr(TK_DOT, temp1, temp2, 0);
++}
++expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
++  Expr *temp1 = sqliteExpr(TK_ID, 0, 0, &X);
++  Expr *temp2 = sqliteExpr(TK_ID, 0, 0, &Y);
++  Expr *temp3 = sqliteExpr(TK_ID, 0, 0, &Z);
++  Expr *temp4 = sqliteExpr(TK_DOT, temp2, temp3, 0);
++  A = sqliteExpr(TK_DOT, temp1, temp4, 0);
++}
++expr(A) ::= INTEGER(X).      {A = sqliteExpr(TK_INTEGER, 0, 0, &X);}
++expr(A) ::= FLOAT(X).        {A = sqliteExpr(TK_FLOAT, 0, 0, &X);}
++expr(A) ::= STRING(X).       {A = sqliteExpr(TK_STRING, 0, 0, &X);}
++expr(A) ::= VARIABLE(X).     {
++  A = sqliteExpr(TK_VARIABLE, 0, 0, &X);
++  if( A ) A->iTable = ++pParse->nVar;
++}
++expr(A) ::= ID(X) LP exprlist(Y) RP(E). {
++  A = sqliteExprFunction(Y, &X);
++  sqliteExprSpan(A,&X,&E);
++}
++expr(A) ::= ID(X) LP STAR RP(E). {
++  A = sqliteExprFunction(0, &X);
++  sqliteExprSpan(A,&X,&E);
++}
++expr(A) ::= expr(X) AND expr(Y).   {A = sqliteExpr(TK_AND, X, Y, 0);}
++expr(A) ::= expr(X) OR expr(Y).    {A = sqliteExpr(TK_OR, X, Y, 0);}
++expr(A) ::= expr(X) LT expr(Y).    {A = sqliteExpr(TK_LT, X, Y, 0);}
++expr(A) ::= expr(X) GT expr(Y).    {A = sqliteExpr(TK_GT, X, Y, 0);}
++expr(A) ::= expr(X) LE expr(Y).    {A = sqliteExpr(TK_LE, X, Y, 0);}
++expr(A) ::= expr(X) GE expr(Y).    {A = sqliteExpr(TK_GE, X, Y, 0);}
++expr(A) ::= expr(X) NE expr(Y).    {A = sqliteExpr(TK_NE, X, Y, 0);}
++expr(A) ::= expr(X) EQ expr(Y).    {A = sqliteExpr(TK_EQ, X, Y, 0);}
++expr(A) ::= expr(X) BITAND expr(Y). {A = sqliteExpr(TK_BITAND, X, Y, 0);}
++expr(A) ::= expr(X) BITOR expr(Y).  {A = sqliteExpr(TK_BITOR, X, Y, 0);}
++expr(A) ::= expr(X) LSHIFT expr(Y). {A = sqliteExpr(TK_LSHIFT, X, Y, 0);}
++expr(A) ::= expr(X) RSHIFT expr(Y). {A = sqliteExpr(TK_RSHIFT, X, Y, 0);}
++expr(A) ::= expr(X) likeop(OP) expr(Y).  [LIKE]  {
++  ExprList *pList = sqliteExprListAppend(0, Y, 0);
++  pList = sqliteExprListAppend(pList, X, 0);
++  A = sqliteExprFunction(pList, 0);
++  if( A ) A->op = OP;
++  sqliteExprSpan(A, &X->span, &Y->span);
++}
++expr(A) ::= expr(X) NOT likeop(OP) expr(Y). [LIKE] {
++  ExprList *pList = sqliteExprListAppend(0, Y, 0);
++  pList = sqliteExprListAppend(pList, X, 0);
++  A = sqliteExprFunction(pList, 0);
++  if( A ) A->op = OP;
++  A = sqliteExpr(TK_NOT, A, 0, 0);
++  sqliteExprSpan(A,&X->span,&Y->span);
++}
++%type likeop {int}
++likeop(A) ::= LIKE. {A = TK_LIKE;}
++likeop(A) ::= GLOB. {A = TK_GLOB;}
++expr(A) ::= expr(X) PLUS expr(Y).  {A = sqliteExpr(TK_PLUS, X, Y, 0);}
++expr(A) ::= expr(X) MINUS expr(Y). {A = sqliteExpr(TK_MINUS, X, Y, 0);}
++expr(A) ::= expr(X) STAR expr(Y).  {A = sqliteExpr(TK_STAR, X, Y, 0);}
++expr(A) ::= expr(X) SLASH expr(Y). {A = sqliteExpr(TK_SLASH, X, Y, 0);}
++expr(A) ::= expr(X) REM expr(Y).   {A = sqliteExpr(TK_REM, X, Y, 0);}
++expr(A) ::= expr(X) CONCAT expr(Y). {A = sqliteExpr(TK_CONCAT, X, Y, 0);}
++expr(A) ::= expr(X) ISNULL(E). {
++  A = sqliteExpr(TK_ISNULL, X, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) IS NULL(E). {
++  A = sqliteExpr(TK_ISNULL, X, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) NOTNULL(E). {
++  A = sqliteExpr(TK_NOTNULL, X, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) NOT NULL(E). {
++  A = sqliteExpr(TK_NOTNULL, X, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) IS NOT NULL(E). {
++  A = sqliteExpr(TK_NOTNULL, X, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= NOT(B) expr(X). {
++  A = sqliteExpr(TK_NOT, X, 0, 0);
++  sqliteExprSpan(A,&B,&X->span);
++}
++expr(A) ::= BITNOT(B) expr(X). {
++  A = sqliteExpr(TK_BITNOT, X, 0, 0);
++  sqliteExprSpan(A,&B,&X->span);
++}
++expr(A) ::= MINUS(B) expr(X). [UMINUS] {
++  A = sqliteExpr(TK_UMINUS, X, 0, 0);
++  sqliteExprSpan(A,&B,&X->span);
++}
++expr(A) ::= PLUS(B) expr(X). [UPLUS] {
++  A = sqliteExpr(TK_UPLUS, X, 0, 0);
++  sqliteExprSpan(A,&B,&X->span);
++}
++expr(A) ::= LP(B) select(X) RP(E). {
++  A = sqliteExpr(TK_SELECT, 0, 0, 0);
++  if( A ) A->pSelect = X;
++  sqliteExprSpan(A,&B,&E);
++}
++expr(A) ::= expr(W) BETWEEN expr(X) AND expr(Y). {
++  ExprList *pList = sqliteExprListAppend(0, X, 0);
++  pList = sqliteExprListAppend(pList, Y, 0);
++  A = sqliteExpr(TK_BETWEEN, W, 0, 0);
++  if( A ) A->pList = pList;
++  sqliteExprSpan(A,&W->span,&Y->span);
++}
++expr(A) ::= expr(W) NOT BETWEEN expr(X) AND expr(Y). {
++  ExprList *pList = sqliteExprListAppend(0, X, 0);
++  pList = sqliteExprListAppend(pList, Y, 0);
++  A = sqliteExpr(TK_BETWEEN, W, 0, 0);
++  if( A ) A->pList = pList;
++  A = sqliteExpr(TK_NOT, A, 0, 0);
++  sqliteExprSpan(A,&W->span,&Y->span);
++}
++expr(A) ::= expr(X) IN LP exprlist(Y) RP(E).  {
++  A = sqliteExpr(TK_IN, X, 0, 0);
++  if( A ) A->pList = Y;
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) IN LP select(Y) RP(E).  {
++  A = sqliteExpr(TK_IN, X, 0, 0);
++  if( A ) A->pSelect = Y;
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) NOT IN LP exprlist(Y) RP(E).  {
++  A = sqliteExpr(TK_IN, X, 0, 0);
++  if( A ) A->pList = Y;
++  A = sqliteExpr(TK_NOT, A, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) NOT IN LP select(Y) RP(E).  {
++  A = sqliteExpr(TK_IN, X, 0, 0);
++  if( A ) A->pSelect = Y;
++  A = sqliteExpr(TK_NOT, A, 0, 0);
++  sqliteExprSpan(A,&X->span,&E);
++}
++expr(A) ::= expr(X) IN nm(Y) dbnm(D). {
++  SrcList *pSrc = sqliteSrcListAppend(0, &Y, &D);
++  A = sqliteExpr(TK_IN, X, 0, 0);
++  if( A ) A->pSelect = sqliteSelectNew(0,pSrc,0,0,0,0,0,-1,0);
++  sqliteExprSpan(A,&X->span,D.z?&D:&Y);
++}
++expr(A) ::= expr(X) NOT IN nm(Y) dbnm(D). {
++  SrcList *pSrc = sqliteSrcListAppend(0, &Y, &D);
++  A = sqliteExpr(TK_IN, X, 0, 0);
++  if( A ) A->pSelect = sqliteSelectNew(0,pSrc,0,0,0,0,0,-1,0);
++  A = sqliteExpr(TK_NOT, A, 0, 0);
++  sqliteExprSpan(A,&X->span,D.z?&D:&Y);
++}
++
++
++/* CASE expressions */
++expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
++  A = sqliteExpr(TK_CASE, X, Z, 0);
++  if( A ) A->pList = Y;
++  sqliteExprSpan(A, &C, &E);
++}
++%type case_exprlist {ExprList*}
++%destructor case_exprlist {sqliteExprListDelete($$);}
++case_exprlist(A) ::= case_exprlist(X) WHEN expr(Y) THEN expr(Z). {
++  A = sqliteExprListAppend(X, Y, 0);
++  A = sqliteExprListAppend(A, Z, 0);
++}
++case_exprlist(A) ::= WHEN expr(Y) THEN expr(Z). {
++  A = sqliteExprListAppend(0, Y, 0);
++  A = sqliteExprListAppend(A, Z, 0);
++}
++%type case_else {Expr*}
++case_else(A) ::=  ELSE expr(X).         {A = X;}
++case_else(A) ::=  .                     {A = 0;} 
++%type case_operand {Expr*}
++case_operand(A) ::= expr(X).            {A = X;} 
++case_operand(A) ::= .                   {A = 0;} 
++
++%type exprlist {ExprList*}
++%destructor exprlist {sqliteExprListDelete($$);}
++%type expritem {Expr*}
++%destructor expritem {sqliteExprDelete($$);}
++
++exprlist(A) ::= exprlist(X) COMMA expritem(Y). 
++   {A = sqliteExprListAppend(X,Y,0);}
++exprlist(A) ::= expritem(X).            {A = sqliteExprListAppend(0,X,0);}
++expritem(A) ::= expr(X).                {A = X;}
++expritem(A) ::= .                       {A = 0;}
++
++///////////////////////////// The CREATE INDEX command ///////////////////////
++//
++cmd ::= CREATE(S) uniqueflag(U) INDEX nm(X)
++        ON nm(Y) dbnm(D) LP idxlist(Z) RP(E) onconf(R). {
++  SrcList *pSrc = sqliteSrcListAppend(0, &Y, &D);
++  if( U!=OE_None ) U = R;
++  if( U==OE_Default) U = OE_Abort;
++  sqliteCreateIndex(pParse, &X, pSrc, Z, U, &S, &E);
++}
++
++%type uniqueflag {int}
++uniqueflag(A) ::= UNIQUE.  { A = OE_Abort; }
++uniqueflag(A) ::= .        { A = OE_None; }
++
++%type idxlist {IdList*}
++%destructor idxlist {sqliteIdListDelete($$);}
++%type idxlist_opt {IdList*}
++%destructor idxlist_opt {sqliteIdListDelete($$);}
++%type idxitem {Token}
++
++idxlist_opt(A) ::= .                         {A = 0;}
++idxlist_opt(A) ::= LP idxlist(X) RP.         {A = X;}
++idxlist(A) ::= idxlist(X) COMMA idxitem(Y).  {A = sqliteIdListAppend(X,&Y);}
++idxlist(A) ::= idxitem(Y).                   {A = sqliteIdListAppend(0,&Y);}
++idxitem(A) ::= nm(X) sortorder.              {A = X;}
++
++///////////////////////////// The DROP INDEX command /////////////////////////
++//
++
++cmd ::= DROP INDEX nm(X) dbnm(Y).   {
++  sqliteDropIndex(pParse, sqliteSrcListAppend(0,&X,&Y));
++}
++
++
++///////////////////////////// The COPY command ///////////////////////////////
++//
++cmd ::= COPY orconf(R) nm(X) dbnm(D) FROM nm(Y) USING DELIMITERS STRING(Z).
++    {sqliteCopy(pParse,sqliteSrcListAppend(0,&X,&D),&Y,&Z,R);}
++cmd ::= COPY orconf(R) nm(X) dbnm(D) FROM nm(Y).
++    {sqliteCopy(pParse,sqliteSrcListAppend(0,&X,&D),&Y,0,R);}
++
++///////////////////////////// The VACUUM command /////////////////////////////
++//
++cmd ::= VACUUM.                {sqliteVacuum(pParse,0);}
++cmd ::= VACUUM nm(X).         {sqliteVacuum(pParse,&X);}
++
++///////////////////////////// The PRAGMA command /////////////////////////////
++//
++cmd ::= PRAGMA ids(X) EQ nm(Y).         {sqlitePragma(pParse,&X,&Y,0);}
++cmd ::= PRAGMA ids(X) EQ ON(Y).          {sqlitePragma(pParse,&X,&Y,0);}
++cmd ::= PRAGMA ids(X) EQ plus_num(Y).    {sqlitePragma(pParse,&X,&Y,0);}
++cmd ::= PRAGMA ids(X) EQ minus_num(Y).   {sqlitePragma(pParse,&X,&Y,1);}
++cmd ::= PRAGMA ids(X) LP nm(Y) RP.      {sqlitePragma(pParse,&X,&Y,0);}
++cmd ::= PRAGMA ids(X).                   {sqlitePragma(pParse,&X,&X,0);}
++plus_num(A) ::= plus_opt number(X).   {A = X;}
++minus_num(A) ::= MINUS number(X).     {A = X;}
++number(A) ::= INTEGER(X).  {A = X;}
++number(A) ::= FLOAT(X).    {A = X;}
++plus_opt ::= PLUS.
++plus_opt ::= .
++
++//////////////////////////// The CREATE TRIGGER command /////////////////////
++
++cmd ::= CREATE(A) trigger_decl BEGIN trigger_cmd_list(S) END(Z). {
++  Token all;
++  all.z = A.z;
++  all.n = (Z.z - A.z) + Z.n;
++  sqliteFinishTrigger(pParse, S, &all);
++}
++
++trigger_decl ::= temp(T) TRIGGER nm(B) trigger_time(C) trigger_event(D)
++                 ON nm(E) dbnm(DB) foreach_clause(F) when_clause(G). {
++  SrcList *pTab = sqliteSrcListAppend(0, &E, &DB);
++  sqliteBeginTrigger(pParse, &B, C, D.a, D.b, pTab, F, G, T);
++}
++
++%type trigger_time  {int}
++trigger_time(A) ::= BEFORE.      { A = TK_BEFORE; }
++trigger_time(A) ::= AFTER.       { A = TK_AFTER;  }
++trigger_time(A) ::= INSTEAD OF.  { A = TK_INSTEAD;}
++trigger_time(A) ::= .            { A = TK_BEFORE; }
++
++%type trigger_event {struct TrigEvent}
++%destructor trigger_event {sqliteIdListDelete($$.b);}
++trigger_event(A) ::= DELETE. { A.a = TK_DELETE; A.b = 0; }
++trigger_event(A) ::= INSERT. { A.a = TK_INSERT; A.b = 0; }
++trigger_event(A) ::= UPDATE. { A.a = TK_UPDATE; A.b = 0;}
++trigger_event(A) ::= UPDATE OF inscollist(X). {A.a = TK_UPDATE; A.b = X; }
++
++%type foreach_clause {int}
++foreach_clause(A) ::= .                   { A = TK_ROW; }
++foreach_clause(A) ::= FOR EACH ROW.       { A = TK_ROW; }
++foreach_clause(A) ::= FOR EACH STATEMENT. { A = TK_STATEMENT; }
++
++%type when_clause {Expr *}
++when_clause(A) ::= .             { A = 0; }
++when_clause(A) ::= WHEN expr(X). { A = X; }
++
++%type trigger_cmd_list {TriggerStep *}
++%destructor trigger_cmd_list {sqliteDeleteTriggerStep($$);}
++trigger_cmd_list(A) ::= trigger_cmd(X) SEMI trigger_cmd_list(Y). {
++  X->pNext = Y;
++  A = X;
++}
++trigger_cmd_list(A) ::= . { A = 0; }
++
++%type trigger_cmd {TriggerStep *}
++%destructor trigger_cmd {sqliteDeleteTriggerStep($$);}
++// UPDATE 
++trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z).  
++               { A = sqliteTriggerUpdateStep(&X, Y, Z, R); }
++
++// INSERT
++trigger_cmd(A) ::= insert_cmd(R) INTO nm(X) inscollist_opt(F) 
++  VALUES LP itemlist(Y) RP.  
++{A = sqliteTriggerInsertStep(&X, F, Y, 0, R);}
++
++trigger_cmd(A) ::= insert_cmd(R) INTO nm(X) inscollist_opt(F) select(S).
++               {A = sqliteTriggerInsertStep(&X, F, 0, S, R);}
++
++// DELETE
++trigger_cmd(A) ::= DELETE FROM nm(X) where_opt(Y).
++               {A = sqliteTriggerDeleteStep(&X, Y);}
++
++// SELECT
++trigger_cmd(A) ::= select(X).  {A = sqliteTriggerSelectStep(X); }
++
++// The special RAISE expression that may occur in trigger programs
++expr(A) ::= RAISE(X) LP IGNORE RP(Y).  {
++  A = sqliteExpr(TK_RAISE, 0, 0, 0); 
++  A->iColumn = OE_Ignore;
++  sqliteExprSpan(A, &X, &Y);
++}
++expr(A) ::= RAISE(X) LP ROLLBACK COMMA nm(Z) RP(Y).  {
++  A = sqliteExpr(TK_RAISE, 0, 0, &Z); 
++  A->iColumn = OE_Rollback;
++  sqliteExprSpan(A, &X, &Y);
++}
++expr(A) ::= RAISE(X) LP ABORT COMMA nm(Z) RP(Y).  {
++  A = sqliteExpr(TK_RAISE, 0, 0, &Z); 
++  A->iColumn = OE_Abort;
++  sqliteExprSpan(A, &X, &Y);
++}
++expr(A) ::= RAISE(X) LP FAIL COMMA nm(Z) RP(Y).  {
++  A = sqliteExpr(TK_RAISE, 0, 0, &Z); 
++  A->iColumn = OE_Fail;
++  sqliteExprSpan(A, &X, &Y);
++}
++
++////////////////////////  DROP TRIGGER statement //////////////////////////////
++cmd ::= DROP TRIGGER nm(X) dbnm(D). {
++  sqliteDropTrigger(pParse,sqliteSrcListAppend(0,&X,&D));
++}
++
++//////////////////////// ATTACH DATABASE file AS name /////////////////////////
++cmd ::= ATTACH database_kw_opt ids(F) AS nm(D) key_opt(K). {
++  sqliteAttach(pParse, &F, &D, &K);
++}
++%type key_opt {Token}
++key_opt(A) ::= USING ids(X).  { A = X; }
++key_opt(A) ::= .              { A.z = 0; A.n = 0; }
++
++database_kw_opt ::= DATABASE.
++database_kw_opt ::= .
++
++//////////////////////// DETACH DATABASE name /////////////////////////////////
++cmd ::= DETACH database_kw_opt nm(D). {
++  sqliteDetach(pParse, &D);
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/pragma.c
+@@ -0,0 +1,712 @@
++/*
++** 2003 April 6
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code used to implement the PRAGMA command.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include <ctype.h>
++
++/*
++** Interpret the given string as a boolean value.
++*/
++static int getBoolean(const char *z){
++  static char *azTrue[] = { "yes", "on", "true" };
++  int i;
++  if( z[0]==0 ) return 0;
++  if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){
++    return atoi(z);
++  }
++  for(i=0; i<sizeof(azTrue)/sizeof(azTrue[0]); i++){
++    if( sqliteStrICmp(z,azTrue[i])==0 ) return 1;
++  }
++  return 0;
++}
++
++/*
++** Interpret the given string as a safety level.  Return 0 for OFF,
++** 1 for ON or NORMAL and 2 for FULL.  Return 1 for an empty or 
++** unrecognized string argument.
++**
++** Note that the values returned are one less that the values that
++** should be passed into sqliteBtreeSetSafetyLevel().  The is done
++** to support legacy SQL code.  The safety level used to be boolean
++** and older scripts may have used numbers 0 for OFF and 1 for ON.
++*/
++static int getSafetyLevel(char *z){
++  static const struct {
++    const char *zWord;
++    int val;
++  } aKey[] = {
++    { "no",    0 },
++    { "off",   0 },
++    { "false", 0 },
++    { "yes",   1 },
++    { "on",    1 },
++    { "true",  1 },
++    { "full",  2 },
++  };
++  int i;
++  if( z[0]==0 ) return 1;
++  if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){
++    return atoi(z);
++  }
++  for(i=0; i<sizeof(aKey)/sizeof(aKey[0]); i++){
++    if( sqliteStrICmp(z,aKey[i].zWord)==0 ) return aKey[i].val;
++  }
++  return 1;
++}
++
++/*
++** Interpret the given string as a temp db location. Return 1 for file
++** backed temporary databases, 2 for the Red-Black tree in memory database
++** and 0 to use the compile-time default.
++*/
++static int getTempStore(const char *z){
++  if( z[0]>='0' && z[0]<='2' ){
++    return z[0] - '0';
++  }else if( sqliteStrICmp(z, "file")==0 ){
++    return 1;
++  }else if( sqliteStrICmp(z, "memory")==0 ){
++    return 2;
++  }else{
++    return 0;
++  }
++}
++
++/*
++** If the TEMP database is open, close it and mark the database schema
++** as needing reloading.  This must be done when using the TEMP_STORE
++** or DEFAULT_TEMP_STORE pragmas.
++*/
++static int changeTempStorage(Parse *pParse, const char *zStorageType){
++  int ts = getTempStore(zStorageType);
++  sqlite *db = pParse->db;
++  if( db->temp_store==ts ) return SQLITE_OK;
++  if( db->aDb[1].pBt!=0 ){
++    if( db->flags & SQLITE_InTrans ){
++      sqliteErrorMsg(pParse, "temporary storage cannot be changed "
++        "from within a transaction");
++      return SQLITE_ERROR;
++    }
++    sqliteBtreeClose(db->aDb[1].pBt);
++    db->aDb[1].pBt = 0;
++    sqliteResetInternalSchema(db, 0);
++  }
++  db->temp_store = ts;
++  return SQLITE_OK;
++}
++
++/*
++** Check to see if zRight and zLeft refer to a pragma that queries
++** or changes one of the flags in db->flags.  Return 1 if so and 0 if not.
++** Also, implement the pragma.
++*/
++static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
++  static const struct {
++    const char *zName;  /* Name of the pragma */
++    int mask;           /* Mask for the db->flags value */
++  } aPragma[] = {
++    { "vdbe_trace",               SQLITE_VdbeTrace     },
++    { "full_column_names",        SQLITE_FullColNames  },
++    { "short_column_names",       SQLITE_ShortColNames },
++    { "show_datatypes",           SQLITE_ReportTypes   },
++    { "count_changes",            SQLITE_CountRows     },
++    { "empty_result_callbacks",   SQLITE_NullCallback  },
++  };
++  int i;
++  for(i=0; i<sizeof(aPragma)/sizeof(aPragma[0]); i++){
++    if( sqliteStrICmp(zLeft, aPragma[i].zName)==0 ){
++      sqlite *db = pParse->db;
++      Vdbe *v;
++      if( strcmp(zLeft,zRight)==0 && (v = sqliteGetVdbe(pParse))!=0 ){
++        sqliteVdbeOp3(v, OP_ColumnName, 0, 1, aPragma[i].zName, P3_STATIC);
++        sqliteVdbeOp3(v, OP_ColumnName, 1, 0, "boolean", P3_STATIC);
++        sqliteVdbeCode(v, OP_Integer, (db->flags & aPragma[i].mask)!=0, 0,
++                          OP_Callback, 1, 0,
++                          0);
++      }else if( getBoolean(zRight) ){
++        db->flags |= aPragma[i].mask;
++      }else{
++        db->flags &= ~aPragma[i].mask;
++      }
++      return 1;
++    }
++  }
++  return 0;
++}
++
++/*
++** Process a pragma statement.  
++**
++** Pragmas are of this form:
++**
++**      PRAGMA id = value
++**
++** The identifier might also be a string.  The value is a string, and
++** identifier, or a number.  If minusFlag is true, then the value is
++** a number that was preceded by a minus sign.
++*/
++void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
++  char *zLeft = 0;
++  char *zRight = 0;
++  sqlite *db = pParse->db;
++  Vdbe *v = sqliteGetVdbe(pParse);
++  if( v==0 ) return;
++
++  zLeft = sqliteStrNDup(pLeft->z, pLeft->n);
++  sqliteDequote(zLeft);
++  if( minusFlag ){
++    zRight = 0;
++    sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, 0);
++  }else{
++    zRight = sqliteStrNDup(pRight->z, pRight->n);
++    sqliteDequote(zRight);
++  }
++  if( sqliteAuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, 0) ){
++    sqliteFree(zLeft);
++    sqliteFree(zRight);
++    return;
++  }
++ 
++  /*
++  **  PRAGMA default_cache_size
++  **  PRAGMA default_cache_size=N
++  **
++  ** The first form reports the current persistent setting for the
++  ** page cache size.  The value returned is the maximum number of
++  ** pages in the page cache.  The second form sets both the current
++  ** page cache size value and the persistent page cache size value
++  ** stored in the database file.
++  **
++  ** The default cache size is stored in meta-value 2 of page 1 of the
++  ** database file.  The cache size is actually the absolute value of
++  ** this memory location.  The sign of meta-value 2 determines the
++  ** synchronous setting.  A negative value means synchronous is off
++  ** and a positive value means synchronous is on.
++  */
++  if( sqliteStrICmp(zLeft,"default_cache_size")==0 ){
++    static VdbeOpList getCacheSize[] = {
++      { OP_ReadCookie,  0, 2,        0},
++      { OP_AbsValue,    0, 0,        0},
++      { OP_Dup,         0, 0,        0},
++      { OP_Integer,     0, 0,        0},
++      { OP_Ne,          0, 6,        0},
++      { OP_Integer,     0, 0,        0},  /* 5 */
++      { OP_ColumnName,  0, 1,        "cache_size"},
++      { OP_Callback,    1, 0,        0},
++    };
++    int addr;
++    if( pRight->z==pLeft->z ){
++      addr = sqliteVdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
++      sqliteVdbeChangeP1(v, addr+5, MAX_PAGES);
++    }else{
++      int size = atoi(zRight);
++      if( size<0 ) size = -size;
++      sqliteBeginWriteOperation(pParse, 0, 0);
++      sqliteVdbeAddOp(v, OP_Integer, size, 0);
++      sqliteVdbeAddOp(v, OP_ReadCookie, 0, 2);
++      addr = sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++      sqliteVdbeAddOp(v, OP_Ge, 0, addr+3);
++      sqliteVdbeAddOp(v, OP_Negative, 0, 0);
++      sqliteVdbeAddOp(v, OP_SetCookie, 0, 2);
++      sqliteEndWriteOperation(pParse);
++      db->cache_size = db->cache_size<0 ? -size : size;
++      sqliteBtreeSetCacheSize(db->aDb[0].pBt, db->cache_size);
++    }
++  }else
++
++  /*
++  **  PRAGMA cache_size
++  **  PRAGMA cache_size=N
++  **
++  ** The first form reports the current local setting for the
++  ** page cache size.  The local setting can be different from
++  ** the persistent cache size value that is stored in the database
++  ** file itself.  The value returned is the maximum number of
++  ** pages in the page cache.  The second form sets the local
++  ** page cache size value.  It does not change the persistent
++  ** cache size stored on the disk so the cache size will revert
++  ** to its default value when the database is closed and reopened.
++  ** N should be a positive integer.
++  */
++  if( sqliteStrICmp(zLeft,"cache_size")==0 ){
++    static VdbeOpList getCacheSize[] = {
++      { OP_ColumnName,  0, 1,        "cache_size"},
++      { OP_Callback,    1, 0,        0},
++    };
++    if( pRight->z==pLeft->z ){
++      int size = db->cache_size;;
++      if( size<0 ) size = -size;
++      sqliteVdbeAddOp(v, OP_Integer, size, 0);
++      sqliteVdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
++    }else{
++      int size = atoi(zRight);
++      if( size<0 ) size = -size;
++      if( db->cache_size<0 ) size = -size;
++      db->cache_size = size;
++      sqliteBtreeSetCacheSize(db->aDb[0].pBt, db->cache_size);
++    }
++  }else
++
++  /*
++  **  PRAGMA default_synchronous
++  **  PRAGMA default_synchronous=ON|OFF|NORMAL|FULL
++  **
++  ** The first form returns the persistent value of the "synchronous" setting
++  ** that is stored in the database.  This is the synchronous setting that
++  ** is used whenever the database is opened unless overridden by a separate
++  ** "synchronous" pragma.  The second form changes the persistent and the
++  ** local synchronous setting to the value given.
++  **
++  ** If synchronous is OFF, SQLite does not attempt any fsync() systems calls
++  ** to make sure data is committed to disk.  Write operations are very fast,
++  ** but a power failure can leave the database in an inconsistent state.
++  ** If synchronous is ON or NORMAL, SQLite will do an fsync() system call to
++  ** make sure data is being written to disk.  The risk of corruption due to
++  ** a power loss in this mode is negligible but non-zero.  If synchronous
++  ** is FULL, extra fsync()s occur to reduce the risk of corruption to near
++  ** zero, but with a write performance penalty.  The default mode is NORMAL.
++  */
++  if( sqliteStrICmp(zLeft,"default_synchronous")==0 ){
++    static VdbeOpList getSync[] = {
++      { OP_ColumnName,  0, 1,        "synchronous"},
++      { OP_ReadCookie,  0, 3,        0},
++      { OP_Dup,         0, 0,        0},
++      { OP_If,          0, 0,        0},  /* 3 */
++      { OP_ReadCookie,  0, 2,        0},
++      { OP_Integer,     0, 0,        0},
++      { OP_Lt,          0, 5,        0},
++      { OP_AddImm,      1, 0,        0},
++      { OP_Callback,    1, 0,        0},
++      { OP_Halt,        0, 0,        0},
++      { OP_AddImm,     -1, 0,        0},  /* 10 */
++      { OP_Callback,    1, 0,        0}
++    };
++    if( pRight->z==pLeft->z ){
++      int addr = sqliteVdbeAddOpList(v, ArraySize(getSync), getSync);
++      sqliteVdbeChangeP2(v, addr+3, addr+10);
++    }else{
++      int addr;
++      int size = db->cache_size;
++      if( size<0 ) size = -size;
++      sqliteBeginWriteOperation(pParse, 0, 0);
++      sqliteVdbeAddOp(v, OP_ReadCookie, 0, 2);
++      sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++      addr = sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++      sqliteVdbeAddOp(v, OP_Ne, 0, addr+3);
++      sqliteVdbeAddOp(v, OP_AddImm, MAX_PAGES, 0);
++      sqliteVdbeAddOp(v, OP_AbsValue, 0, 0);
++      db->safety_level = getSafetyLevel(zRight)+1;
++      if( db->safety_level==1 ){
++        sqliteVdbeAddOp(v, OP_Negative, 0, 0);
++        size = -size;
++      }
++      sqliteVdbeAddOp(v, OP_SetCookie, 0, 2);
++      sqliteVdbeAddOp(v, OP_Integer, db->safety_level, 0);
++      sqliteVdbeAddOp(v, OP_SetCookie, 0, 3);
++      sqliteEndWriteOperation(pParse);
++      db->cache_size = size;
++      sqliteBtreeSetCacheSize(db->aDb[0].pBt, db->cache_size);
++      sqliteBtreeSetSafetyLevel(db->aDb[0].pBt, db->safety_level);
++    }
++  }else
++
++  /*
++  **   PRAGMA synchronous
++  **   PRAGMA synchronous=OFF|ON|NORMAL|FULL
++  **
++  ** Return or set the local value of the synchronous flag.  Changing
++  ** the local value does not make changes to the disk file and the
++  ** default value will be restored the next time the database is
++  ** opened.
++  */
++  if( sqliteStrICmp(zLeft,"synchronous")==0 ){
++    static VdbeOpList getSync[] = {
++      { OP_ColumnName,  0, 1,        "synchronous"},
++      { OP_Callback,    1, 0,        0},
++    };
++    if( pRight->z==pLeft->z ){
++      sqliteVdbeAddOp(v, OP_Integer, db->safety_level-1, 0);
++      sqliteVdbeAddOpList(v, ArraySize(getSync), getSync);
++    }else{
++      int size = db->cache_size;
++      if( size<0 ) size = -size;
++      db->safety_level = getSafetyLevel(zRight)+1;
++      if( db->safety_level==1 ) size = -size;
++      db->cache_size = size;
++      sqliteBtreeSetCacheSize(db->aDb[0].pBt, db->cache_size);
++      sqliteBtreeSetSafetyLevel(db->aDb[0].pBt, db->safety_level);
++    }
++  }else
++
++#ifndef NDEBUG
++  if( sqliteStrICmp(zLeft, "trigger_overhead_test")==0 ){
++    if( getBoolean(zRight) ){
++      always_code_trigger_setup = 1;
++    }else{
++      always_code_trigger_setup = 0;
++    }
++  }else
++#endif
++
++  if( flagPragma(pParse, zLeft, zRight) ){
++    /* The flagPragma() call also generates any necessary code */
++  }else
++
++  if( sqliteStrICmp(zLeft, "table_info")==0 ){
++    Table *pTab;
++    pTab = sqliteFindTable(db, zRight, 0);
++    if( pTab ){
++      static VdbeOpList tableInfoPreface[] = {
++        { OP_ColumnName,  0, 0,       "cid"},
++        { OP_ColumnName,  1, 0,       "name"},
++        { OP_ColumnName,  2, 0,       "type"},
++        { OP_ColumnName,  3, 0,       "notnull"},
++        { OP_ColumnName,  4, 0,       "dflt_value"},
++        { OP_ColumnName,  5, 1,       "pk"},
++      };
++      int i;
++      sqliteVdbeAddOpList(v, ArraySize(tableInfoPreface), tableInfoPreface);
++      sqliteViewGetColumnNames(pParse, pTab);
++      for(i=0; i<pTab->nCol; i++){
++        sqliteVdbeAddOp(v, OP_Integer, i, 0);
++        sqliteVdbeOp3(v, OP_String, 0, 0, pTab->aCol[i].zName, 0);
++        sqliteVdbeOp3(v, OP_String, 0, 0,
++           pTab->aCol[i].zType ? pTab->aCol[i].zType : "numeric", 0);
++        sqliteVdbeAddOp(v, OP_Integer, pTab->aCol[i].notNull, 0);
++        sqliteVdbeOp3(v, OP_String, 0, 0,
++           pTab->aCol[i].zDflt, P3_STATIC);
++        sqliteVdbeAddOp(v, OP_Integer, pTab->aCol[i].isPrimKey, 0);
++        sqliteVdbeAddOp(v, OP_Callback, 6, 0);
++      }
++    }
++  }else
++
++  if( sqliteStrICmp(zLeft, "index_info")==0 ){
++    Index *pIdx;
++    Table *pTab;
++    pIdx = sqliteFindIndex(db, zRight, 0);
++    if( pIdx ){
++      static VdbeOpList tableInfoPreface[] = {
++        { OP_ColumnName,  0, 0,       "seqno"},
++        { OP_ColumnName,  1, 0,       "cid"},
++        { OP_ColumnName,  2, 1,       "name"},
++      };
++      int i;
++      pTab = pIdx->pTable;
++      sqliteVdbeAddOpList(v, ArraySize(tableInfoPreface), tableInfoPreface);
++      for(i=0; i<pIdx->nColumn; i++){
++        int cnum = pIdx->aiColumn[i];
++        sqliteVdbeAddOp(v, OP_Integer, i, 0);
++        sqliteVdbeAddOp(v, OP_Integer, cnum, 0);
++        assert( pTab->nCol>cnum );
++        sqliteVdbeOp3(v, OP_String, 0, 0, pTab->aCol[cnum].zName, 0);
++        sqliteVdbeAddOp(v, OP_Callback, 3, 0);
++      }
++    }
++  }else
++
++  if( sqliteStrICmp(zLeft, "index_list")==0 ){
++    Index *pIdx;
++    Table *pTab;
++    pTab = sqliteFindTable(db, zRight, 0);
++    if( pTab ){
++      v = sqliteGetVdbe(pParse);
++      pIdx = pTab->pIndex;
++    }
++    if( pTab && pIdx ){
++      int i = 0; 
++      static VdbeOpList indexListPreface[] = {
++        { OP_ColumnName,  0, 0,       "seq"},
++        { OP_ColumnName,  1, 0,       "name"},
++        { OP_ColumnName,  2, 1,       "unique"},
++      };
++
++      sqliteVdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
++      while(pIdx){
++        sqliteVdbeAddOp(v, OP_Integer, i, 0);
++        sqliteVdbeOp3(v, OP_String, 0, 0, pIdx->zName, 0);
++        sqliteVdbeAddOp(v, OP_Integer, pIdx->onError!=OE_None, 0);
++        sqliteVdbeAddOp(v, OP_Callback, 3, 0);
++        ++i;
++        pIdx = pIdx->pNext;
++      }
++    }
++  }else
++
++  if( sqliteStrICmp(zLeft, "foreign_key_list")==0 ){
++    FKey *pFK;
++    Table *pTab;
++    pTab = sqliteFindTable(db, zRight, 0);
++    if( pTab ){
++      v = sqliteGetVdbe(pParse);
++      pFK = pTab->pFKey;
++    }
++    if( pTab && pFK ){
++      int i = 0; 
++      static VdbeOpList indexListPreface[] = {
++        { OP_ColumnName,  0, 0,       "id"},
++        { OP_ColumnName,  1, 0,       "seq"},
++        { OP_ColumnName,  2, 0,       "table"},
++        { OP_ColumnName,  3, 0,       "from"},
++        { OP_ColumnName,  4, 1,       "to"},
++      };
++
++      sqliteVdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
++      while(pFK){
++        int j;
++        for(j=0; j<pFK->nCol; j++){
++          sqliteVdbeAddOp(v, OP_Integer, i, 0);
++          sqliteVdbeAddOp(v, OP_Integer, j, 0);
++          sqliteVdbeOp3(v, OP_String, 0, 0, pFK->zTo, 0);
++          sqliteVdbeOp3(v, OP_String, 0, 0,
++                           pTab->aCol[pFK->aCol[j].iFrom].zName, 0);
++          sqliteVdbeOp3(v, OP_String, 0, 0, pFK->aCol[j].zCol, 0);
++          sqliteVdbeAddOp(v, OP_Callback, 5, 0);
++        }
++        ++i;
++        pFK = pFK->pNextFrom;
++      }
++    }
++  }else
++
++  if( sqliteStrICmp(zLeft, "database_list")==0 ){
++    int i;
++    static VdbeOpList indexListPreface[] = {
++      { OP_ColumnName,  0, 0,       "seq"},
++      { OP_ColumnName,  1, 0,       "name"},
++      { OP_ColumnName,  2, 1,       "file"},
++    };
++
++    sqliteVdbeAddOpList(v, ArraySize(indexListPreface), indexListPreface);
++    for(i=0; i<db->nDb; i++){
++      if( db->aDb[i].pBt==0 ) continue;
++      assert( db->aDb[i].zName!=0 );
++      sqliteVdbeAddOp(v, OP_Integer, i, 0);
++      sqliteVdbeOp3(v, OP_String, 0, 0, db->aDb[i].zName, 0);
++      sqliteVdbeOp3(v, OP_String, 0, 0,
++           sqliteBtreeGetFilename(db->aDb[i].pBt), 0);
++      sqliteVdbeAddOp(v, OP_Callback, 3, 0);
++    }
++  }else
++
++
++  /*
++  **   PRAGMA temp_store
++  **   PRAGMA temp_store = "default"|"memory"|"file"
++  **
++  ** Return or set the local value of the temp_store flag.  Changing
++  ** the local value does not make changes to the disk file and the default
++  ** value will be restored the next time the database is opened.
++  **
++  ** Note that it is possible for the library compile-time options to
++  ** override this setting
++  */
++  if( sqliteStrICmp(zLeft, "temp_store")==0 ){
++    static VdbeOpList getTmpDbLoc[] = {
++      { OP_ColumnName,  0, 1,        "temp_store"},
++      { OP_Callback,    1, 0,        0},
++    };
++    if( pRight->z==pLeft->z ){
++      sqliteVdbeAddOp(v, OP_Integer, db->temp_store, 0);
++      sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
++    }else{
++      changeTempStorage(pParse, zRight);
++    }
++  }else
++
++  /*
++  **   PRAGMA default_temp_store
++  **   PRAGMA default_temp_store = "default"|"memory"|"file"
++  **
++  ** Return or set the value of the persistent temp_store flag.  Any
++  ** change does not take effect until the next time the database is
++  ** opened.
++  **
++  ** Note that it is possible for the library compile-time options to
++  ** override this setting
++  */
++  if( sqliteStrICmp(zLeft, "default_temp_store")==0 ){
++    static VdbeOpList getTmpDbLoc[] = {
++      { OP_ColumnName,  0, 1,        "temp_store"},
++      { OP_ReadCookie,  0, 5,        0},
++      { OP_Callback,    1, 0,        0}};
++    if( pRight->z==pLeft->z ){
++      sqliteVdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc);
++    }else{
++      sqliteBeginWriteOperation(pParse, 0, 0);
++      sqliteVdbeAddOp(v, OP_Integer, getTempStore(zRight), 0);
++      sqliteVdbeAddOp(v, OP_SetCookie, 0, 5);
++      sqliteEndWriteOperation(pParse);
++    }
++  }else
++
++#ifndef NDEBUG
++  if( sqliteStrICmp(zLeft, "parser_trace")==0 ){
++    extern void sqliteParserTrace(FILE*, char *);
++    if( getBoolean(zRight) ){
++      sqliteParserTrace(stdout, "parser: ");
++    }else{
++      sqliteParserTrace(0, 0);
++    }
++  }else
++#endif
++
++  if( sqliteStrICmp(zLeft, "integrity_check")==0 ){
++    int i, j, addr;
++
++    /* Code that initializes the integrity check program.  Set the
++    ** error count 0
++    */
++    static VdbeOpList initCode[] = {
++      { OP_Integer,     0, 0,        0},
++      { OP_MemStore,    0, 1,        0},
++      { OP_ColumnName,  0, 1,        "integrity_check"},
++    };
++
++    /* Code to do an BTree integrity check on a single database file.
++    */
++    static VdbeOpList checkDb[] = {
++      { OP_SetInsert,   0, 0,        "2"},
++      { OP_Integer,     0, 0,        0},    /* 1 */
++      { OP_OpenRead,    0, 2,        0},
++      { OP_Rewind,      0, 7,        0},    /* 3 */
++      { OP_Column,      0, 3,        0},    /* 4 */
++      { OP_SetInsert,   0, 0,        0},
++      { OP_Next,        0, 4,        0},    /* 6 */
++      { OP_IntegrityCk, 0, 0,        0},    /* 7 */
++      { OP_Dup,         0, 1,        0},
++      { OP_String,      0, 0,        "ok"},
++      { OP_StrEq,       0, 12,       0},    /* 10 */
++      { OP_MemIncr,     0, 0,        0},
++      { OP_String,      0, 0,        "*** in database "},
++      { OP_String,      0, 0,        0},    /* 13 */
++      { OP_String,      0, 0,        " ***\n"},
++      { OP_Pull,        3, 0,        0},
++      { OP_Concat,      4, 1,        0},
++      { OP_Callback,    1, 0,        0},
++    };
++
++    /* Code that appears at the end of the integrity check.  If no error
++    ** messages have been generated, output OK.  Otherwise output the
++    ** error message
++    */
++    static VdbeOpList endCode[] = {
++      { OP_MemLoad,     0, 0,        0},
++      { OP_Integer,     0, 0,        0},
++      { OP_Ne,          0, 0,        0},    /* 2 */
++      { OP_String,      0, 0,        "ok"},
++      { OP_Callback,    1, 0,        0},
++    };
++
++    /* Initialize the VDBE program */
++    sqliteVdbeAddOpList(v, ArraySize(initCode), initCode);
++
++    /* Do an integrity check on each database file */
++    for(i=0; i<db->nDb; i++){
++      HashElem *x;
++
++      /* Do an integrity check of the B-Tree
++      */
++      addr = sqliteVdbeAddOpList(v, ArraySize(checkDb), checkDb);
++      sqliteVdbeChangeP1(v, addr+1, i);
++      sqliteVdbeChangeP2(v, addr+3, addr+7);
++      sqliteVdbeChangeP2(v, addr+6, addr+4);
++      sqliteVdbeChangeP2(v, addr+7, i);
++      sqliteVdbeChangeP2(v, addr+10, addr+ArraySize(checkDb));
++      sqliteVdbeChangeP3(v, addr+13, db->aDb[i].zName, P3_STATIC);
++
++      /* Make sure all the indices are constructed correctly.
++      */
++      sqliteCodeVerifySchema(pParse, i);
++      for(x=sqliteHashFirst(&db->aDb[i].tblHash); x; x=sqliteHashNext(x)){
++        Table *pTab = sqliteHashData(x);
++        Index *pIdx;
++        int loopTop;
++
++        if( pTab->pIndex==0 ) continue;
++        sqliteVdbeAddOp(v, OP_Integer, i, 0);
++        sqliteVdbeOp3(v, OP_OpenRead, 1, pTab->tnum, pTab->zName, 0);
++        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
++          if( pIdx->tnum==0 ) continue;
++          sqliteVdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
++          sqliteVdbeOp3(v, OP_OpenRead, j+2, pIdx->tnum, pIdx->zName, 0);
++        }
++        sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++        sqliteVdbeAddOp(v, OP_MemStore, 1, 1);
++        loopTop = sqliteVdbeAddOp(v, OP_Rewind, 1, 0);
++        sqliteVdbeAddOp(v, OP_MemIncr, 1, 0);
++        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
++          int k, jmp2;
++          static VdbeOpList idxErr[] = {
++            { OP_MemIncr,     0,  0,  0},
++            { OP_String,      0,  0,  "rowid "},
++            { OP_Recno,       1,  0,  0},
++            { OP_String,      0,  0,  " missing from index "},
++            { OP_String,      0,  0,  0},    /* 4 */
++            { OP_Concat,      4,  0,  0},
++            { OP_Callback,    1,  0,  0},
++          };
++          sqliteVdbeAddOp(v, OP_Recno, 1, 0);
++          for(k=0; k<pIdx->nColumn; k++){
++            int idx = pIdx->aiColumn[k];
++            if( idx==pTab->iPKey ){
++              sqliteVdbeAddOp(v, OP_Recno, 1, 0);
++            }else{
++              sqliteVdbeAddOp(v, OP_Column, 1, idx);
++            }
++          }
++          sqliteVdbeAddOp(v, OP_MakeIdxKey, pIdx->nColumn, 0);
++          if( db->file_format>=4 ) sqliteAddIdxKeyType(v, pIdx);
++          jmp2 = sqliteVdbeAddOp(v, OP_Found, j+2, 0);
++          addr = sqliteVdbeAddOpList(v, ArraySize(idxErr), idxErr);
++          sqliteVdbeChangeP3(v, addr+4, pIdx->zName, P3_STATIC);
++          sqliteVdbeChangeP2(v, jmp2, sqliteVdbeCurrentAddr(v));
++        }
++        sqliteVdbeAddOp(v, OP_Next, 1, loopTop+1);
++        sqliteVdbeChangeP2(v, loopTop, sqliteVdbeCurrentAddr(v));
++        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
++          static VdbeOpList cntIdx[] = {
++             { OP_Integer,      0,  0,  0},
++             { OP_MemStore,     2,  1,  0},
++             { OP_Rewind,       0,  0,  0},  /* 2 */
++             { OP_MemIncr,      2,  0,  0},
++             { OP_Next,         0,  0,  0},  /* 4 */
++             { OP_MemLoad,      1,  0,  0},
++             { OP_MemLoad,      2,  0,  0},
++             { OP_Eq,           0,  0,  0},  /* 7 */
++             { OP_MemIncr,      0,  0,  0},
++             { OP_String,       0,  0,  "wrong # of entries in index "},
++             { OP_String,       0,  0,  0},  /* 10 */
++             { OP_Concat,       2,  0,  0},
++             { OP_Callback,     1,  0,  0},
++          };
++          if( pIdx->tnum==0 ) continue;
++          addr = sqliteVdbeAddOpList(v, ArraySize(cntIdx), cntIdx);
++          sqliteVdbeChangeP1(v, addr+2, j+2);
++          sqliteVdbeChangeP2(v, addr+2, addr+5);
++          sqliteVdbeChangeP1(v, addr+4, j+2);
++          sqliteVdbeChangeP2(v, addr+4, addr+3);
++          sqliteVdbeChangeP2(v, addr+7, addr+ArraySize(cntIdx));
++          sqliteVdbeChangeP3(v, addr+10, pIdx->zName, P3_STATIC);
++        }
++      } 
++    }
++    addr = sqliteVdbeAddOpList(v, ArraySize(endCode), endCode);
++    sqliteVdbeChangeP2(v, addr+2, addr+ArraySize(endCode));
++  }else
++
++  {}
++  sqliteFree(zLeft);
++  sqliteFree(zRight);
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/printf.c
+@@ -0,0 +1,858 @@
++/*
++** The "printf" code that follows dates from the 1980's.  It is in
++** the public domain.  The original comments are included here for
++** completeness.  They are very out-of-date but might be useful as
++** an historical reference.  Most of the "enhancements" have been backed
++** out so that the functionality is now the same as standard printf().
++**
++**************************************************************************
++**
++** The following modules is an enhanced replacement for the "printf" subroutines
++** found in the standard C library.  The following enhancements are
++** supported:
++**
++**      +  Additional functions.  The standard set of "printf" functions
++**         includes printf, fprintf, sprintf, vprintf, vfprintf, and
++**         vsprintf.  This module adds the following:
++**
++**           *  snprintf -- Works like sprintf, but has an extra argument
++**                          which is the size of the buffer written to.
++**
++**           *  mprintf --  Similar to sprintf.  Writes output to memory
++**                          obtained from malloc.
++**
++**           *  xprintf --  Calls a function to dispose of output.
++**
++**           *  nprintf --  No output, but returns the number of characters
++**                          that would have been output by printf.
++**
++**           *  A v- version (ex: vsnprintf) of every function is also
++**              supplied.
++**
++**      +  A few extensions to the formatting notation are supported:
++**
++**           *  The "=" flag (similar to "-") causes the output to be
++**              be centered in the appropriately sized field.
++**
++**           *  The %b field outputs an integer in binary notation.
++**
++**           *  The %c field now accepts a precision.  The character output
++**              is repeated by the number of times the precision specifies.
++**
++**           *  The %' field works like %c, but takes as its character the
++**              next character of the format string, instead of the next
++**              argument.  For example,  printf("%.78'-")  prints 78 minus
++**              signs, the same as  printf("%.78c",'-').
++**
++**      +  When compiled using GCC on a SPARC, this version of printf is
++**         faster than the library printf for SUN OS 4.1.
++**
++**      +  All functions are fully reentrant.
++**
++*/
++#include "sqliteInt.h"
++
++/*
++** Conversion types fall into various categories as defined by the
++** following enumeration.
++*/
++#define etRADIX       1 /* Integer types.  %d, %x, %o, and so forth */
++#define etFLOAT       2 /* Floating point.  %f */
++#define etEXP         3 /* Exponentional notation. %e and %E */
++#define etGENERIC     4 /* Floating or exponential, depending on exponent. %g */
++#define etSIZE        5 /* Return number of characters processed so far. %n */
++#define etSTRING      6 /* Strings. %s */
++#define etDYNSTRING   7 /* Dynamically allocated strings. %z */
++#define etPERCENT     8 /* Percent symbol. %% */
++#define etCHARX       9 /* Characters. %c */
++#define etERROR      10 /* Used to indicate no such conversion type */
++/* The rest are extensions, not normally found in printf() */
++#define etCHARLIT    11 /* Literal characters.  %' */
++#define etSQLESCAPE  12 /* Strings with '\'' doubled.  %q */
++#define etSQLESCAPE2 13 /* Strings with '\'' doubled and enclosed in '',
++                          NULL pointers replaced by SQL NULL.  %Q */
++#define etTOKEN      14 /* a pointer to a Token structure */
++#define etSRCLIST    15 /* a pointer to a SrcList */
++
++
++/*
++** An "etByte" is an 8-bit unsigned value.
++*/
++typedef unsigned char etByte;
++
++/*
++** Each builtin conversion character (ex: the 'd' in "%d") is described
++** by an instance of the following structure
++*/
++typedef struct et_info {   /* Information about each format field */
++  char fmttype;            /* The format field code letter */
++  etByte base;             /* The base for radix conversion */
++  etByte flags;            /* One or more of FLAG_ constants below */
++  etByte type;             /* Conversion paradigm */
++  char *charset;           /* The character set for conversion */
++  char *prefix;            /* Prefix on non-zero values in alt format */
++} et_info;
++
++/*
++** Allowed values for et_info.flags
++*/
++#define FLAG_SIGNED  1     /* True if the value to convert is signed */
++#define FLAG_INTERN  2     /* True if for internal use only */
++
++
++/*
++** The following table is searched linearly, so it is good to put the
++** most frequently used conversion types first.
++*/
++static et_info fmtinfo[] = {
++  {  'd', 10, 1, etRADIX,      "0123456789",       0    },
++  {  's',  0, 0, etSTRING,     0,                  0    },
++  {  'z',  0, 2, etDYNSTRING,  0,                  0    },
++  {  'q',  0, 0, etSQLESCAPE,  0,                  0    },
++  {  'Q',  0, 0, etSQLESCAPE2, 0,                  0    },
++  {  'c',  0, 0, etCHARX,      0,                  0    },
++  {  'o',  8, 0, etRADIX,      "01234567",         "0"  },
++  {  'u', 10, 0, etRADIX,      "0123456789",       0    },
++  {  'x', 16, 0, etRADIX,      "0123456789abcdef", "x0" },
++  {  'X', 16, 0, etRADIX,      "0123456789ABCDEF", "X0" },
++  {  'f',  0, 1, etFLOAT,      0,                  0    },
++  {  'e',  0, 1, etEXP,        "e",                0    },
++  {  'E',  0, 1, etEXP,        "E",                0    },
++  {  'g',  0, 1, etGENERIC,    "e",                0    },
++  {  'G',  0, 1, etGENERIC,    "E",                0    },
++  {  'i', 10, 1, etRADIX,      "0123456789",       0    },
++  {  'n',  0, 0, etSIZE,       0,                  0    },
++  {  '%',  0, 0, etPERCENT,    0,                  0    },
++  {  'p', 10, 0, etRADIX,      "0123456789",       0    },
++  {  'T',  0, 2, etTOKEN,      0,                  0    },
++  {  'S',  0, 2, etSRCLIST,    0,                  0    },
++};
++#define etNINFO  (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
++
++/*
++** If NOFLOATINGPOINT is defined, then none of the floating point
++** conversions will work.
++*/
++#ifndef etNOFLOATINGPOINT
++/*
++** "*val" is a double such that 0.1 <= *val < 10.0
++** Return the ascii code for the leading digit of *val, then
++** multiply "*val" by 10.0 to renormalize.
++**
++** Example:
++**     input:     *val = 3.14159
++**     output:    *val = 1.4159    function return = '3'
++**
++** The counter *cnt is incremented each time.  After counter exceeds
++** 16 (the number of significant digits in a 64-bit float) '0' is
++** always returned.
++*/
++static int et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
++  int digit;
++  LONGDOUBLE_TYPE d;
++  if( (*cnt)++ >= 16 ) return '0';
++  digit = (int)*val;
++  d = digit;
++  digit += '0';
++  *val = (*val - d)*10.0;
++  return digit;
++}
++#endif
++
++#define etBUFSIZE 1000  /* Size of the output buffer */
++
++/*
++** The root program.  All variations call this core.
++**
++** INPUTS:
++**   func   This is a pointer to a function taking three arguments
++**            1. A pointer to anything.  Same as the "arg" parameter.
++**            2. A pointer to the list of characters to be output
++**               (Note, this list is NOT null terminated.)
++**            3. An integer number of characters to be output.
++**               (Note: This number might be zero.)
++**
++**   arg    This is the pointer to anything which will be passed as the
++**          first argument to "func".  Use it for whatever you like.
++**
++**   fmt    This is the format string, as in the usual print.
++**
++**   ap     This is a pointer to a list of arguments.  Same as in
++**          vfprint.
++**
++** OUTPUTS:
++**          The return value is the total number of characters sent to
++**          the function "func".  Returns -1 on a error.
++**
++** Note that the order in which automatic variables are declared below
++** seems to make a big difference in determining how fast this beast
++** will run.
++*/
++static int vxprintf(
++  void (*func)(void*,const char*,int),     /* Consumer of text */
++  void *arg,                         /* First argument to the consumer */
++  int useExtended,                   /* Allow extended %-conversions */
++  const char *fmt,                   /* Format string */
++  va_list ap                         /* arguments */
++){
++  int c;                     /* Next character in the format string */
++  char *bufpt;               /* Pointer to the conversion buffer */
++  int precision;             /* Precision of the current field */
++  int length;                /* Length of the field */
++  int idx;                   /* A general purpose loop counter */
++  int count;                 /* Total number of characters output */
++  int width;                 /* Width of the current field */
++  etByte flag_leftjustify;   /* True if "-" flag is present */
++  etByte flag_plussign;      /* True if "+" flag is present */
++  etByte flag_blanksign;     /* True if " " flag is present */
++  etByte flag_alternateform; /* True if "#" flag is present */
++  etByte flag_zeropad;       /* True if field width constant starts with zero */
++  etByte flag_long;          /* True if "l" flag is present */
++  unsigned long longvalue;   /* Value for integer types */
++  LONGDOUBLE_TYPE realvalue; /* Value for real types */
++  et_info *infop;            /* Pointer to the appropriate info structure */
++  char buf[etBUFSIZE];       /* Conversion buffer */
++  char prefix;               /* Prefix character.  "+" or "-" or " " or '\0'. */
++  etByte errorflag = 0;      /* True if an error is encountered */
++  etByte xtype;              /* Conversion paradigm */
++  char *zExtra;              /* Extra memory used for etTCLESCAPE conversions */
++  static char spaces[] = "                                                  ";
++#define etSPACESIZE (sizeof(spaces)-1)
++#ifndef etNOFLOATINGPOINT
++  int  exp;                  /* exponent of real numbers */
++  double rounder;            /* Used for rounding floating point values */
++  etByte flag_dp;            /* True if decimal point should be shown */
++  etByte flag_rtz;           /* True if trailing zeros should be removed */
++  etByte flag_exp;           /* True to force display of the exponent */
++  int nsd;                   /* Number of significant digits returned */
++#endif
++
++  func(arg,"",0);
++  count = length = 0;
++  bufpt = 0;
++  for(; (c=(*fmt))!=0; ++fmt){
++    if( c!='%' ){
++      int amt;
++      bufpt = (char *)fmt;
++      amt = 1;
++      while( (c=(*++fmt))!='%' && c!=0 ) amt++;
++      (*func)(arg,bufpt,amt);
++      count += amt;
++      if( c==0 ) break;
++    }
++    if( (c=(*++fmt))==0 ){
++      errorflag = 1;
++      (*func)(arg,"%",1);
++      count++;
++      break;
++    }
++    /* Find out what flags are present */
++    flag_leftjustify = flag_plussign = flag_blanksign = 
++     flag_alternateform = flag_zeropad = 0;
++    do{
++      switch( c ){
++        case '-':   flag_leftjustify = 1;     c = 0;   break;
++        case '+':   flag_plussign = 1;        c = 0;   break;
++        case ' ':   flag_blanksign = 1;       c = 0;   break;
++        case '#':   flag_alternateform = 1;   c = 0;   break;
++        case '0':   flag_zeropad = 1;         c = 0;   break;
++        default:                                       break;
++      }
++    }while( c==0 && (c=(*++fmt))!=0 );
++    /* Get the field width */
++    width = 0;
++    if( c=='*' ){
++      width = va_arg(ap,int);
++      if( width<0 ){
++        flag_leftjustify = 1;
++        width = -width;
++      }
++      c = *++fmt;
++    }else{
++      while( c>='0' && c<='9' ){
++        width = width*10 + c - '0';
++        c = *++fmt;
++      }
++    }
++    if( width > etBUFSIZE-10 ){
++      width = etBUFSIZE-10;
++    }
++    /* Get the precision */
++    if( c=='.' ){
++      precision = 0;
++      c = *++fmt;
++      if( c=='*' ){
++        precision = va_arg(ap,int);
++        if( precision<0 ) precision = -precision;
++        c = *++fmt;
++      }else{
++        while( c>='0' && c<='9' ){
++          precision = precision*10 + c - '0';
++          c = *++fmt;
++        }
++      }
++      /* Limit the precision to prevent overflowing buf[] during conversion */
++      if( precision>etBUFSIZE-40 ) precision = etBUFSIZE-40;
++    }else{
++      precision = -1;
++    }
++    /* Get the conversion type modifier */
++    if( c=='l' ){
++      flag_long = 1;
++      c = *++fmt;
++    }else{
++      flag_long = 0;
++    }
++    /* Fetch the info entry for the field */
++    infop = 0;
++    xtype = etERROR;
++    for(idx=0; idx<etNINFO; idx++){
++      if( c==fmtinfo[idx].fmttype ){
++        infop = &fmtinfo[idx];
++        if( useExtended || (infop->flags & FLAG_INTERN)==0 ){
++          xtype = infop->type;
++        }
++        break;
++      }
++    }
++    zExtra = 0;
++
++    /*
++    ** At this point, variables are initialized as follows:
++    **
++    **   flag_alternateform          TRUE if a '#' is present.
++    **   flag_plussign               TRUE if a '+' is present.
++    **   flag_leftjustify            TRUE if a '-' is present or if the
++    **                               field width was negative.
++    **   flag_zeropad                TRUE if the width began with 0.
++    **   flag_long                   TRUE if the letter 'l' (ell) prefixed
++    **                               the conversion character.
++    **   flag_blanksign              TRUE if a ' ' is present.
++    **   width                       The specified field width.  This is
++    **                               always non-negative.  Zero is the default.
++    **   precision                   The specified precision.  The default
++    **                               is -1.
++    **   xtype                       The class of the conversion.
++    **   infop                       Pointer to the appropriate info struct.
++    */
++    switch( xtype ){
++      case etRADIX:
++        if( flag_long )  longvalue = va_arg(ap,long);
++        else             longvalue = va_arg(ap,int);
++#if 1
++        /* For the format %#x, the value zero is printed "0" not "0x0".
++        ** I think this is stupid. */
++        if( longvalue==0 ) flag_alternateform = 0;
++#else
++        /* More sensible: turn off the prefix for octal (to prevent "00"),
++        ** but leave the prefix for hex. */
++        if( longvalue==0 && infop->base==8 ) flag_alternateform = 0;
++#endif
++        if( infop->flags & FLAG_SIGNED ){
++          if( *(long*)&longvalue<0 ){
++            longvalue = -*(long*)&longvalue;
++            prefix = '-';
++          }else if( flag_plussign )  prefix = '+';
++          else if( flag_blanksign )  prefix = ' ';
++          else                       prefix = 0;
++        }else                        prefix = 0;
++        if( flag_zeropad && precision<width-(prefix!=0) ){
++          precision = width-(prefix!=0);
++        }
++        bufpt = &buf[etBUFSIZE-1];
++        {
++          register char *cset;      /* Use registers for speed */
++          register int base;
++          cset = infop->charset;
++          base = infop->base;
++          do{                                           /* Convert to ascii */
++            *(--bufpt) = cset[longvalue%base];
++            longvalue = longvalue/base;
++          }while( longvalue>0 );
++        }
++        length = &buf[etBUFSIZE-1]-bufpt;
++        for(idx=precision-length; idx>0; idx--){
++          *(--bufpt) = '0';                             /* Zero pad */
++        }
++        if( prefix ) *(--bufpt) = prefix;               /* Add sign */
++        if( flag_alternateform && infop->prefix ){      /* Add "0" or "0x" */
++          char *pre, x;
++          pre = infop->prefix;
++          if( *bufpt!=pre[0] ){
++            for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x;
++          }
++        }
++        length = &buf[etBUFSIZE-1]-bufpt;
++        break;
++      case etFLOAT:
++      case etEXP:
++      case etGENERIC:
++        realvalue = va_arg(ap,double);
++#ifndef etNOFLOATINGPOINT
++        if( precision<0 ) precision = 6;         /* Set default precision */
++        if( precision>etBUFSIZE-10 ) precision = etBUFSIZE-10;
++        if( realvalue<0.0 ){
++          realvalue = -realvalue;
++          prefix = '-';
++        }else{
++          if( flag_plussign )          prefix = '+';
++          else if( flag_blanksign )    prefix = ' ';
++          else                         prefix = 0;
++        }
++        if( infop->type==etGENERIC && precision>0 ) precision--;
++        rounder = 0.0;
++#if 0
++        /* Rounding works like BSD when the constant 0.4999 is used.  Wierd! */
++        for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);
++#else
++        /* It makes more sense to use 0.5 */
++        for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1);
++#endif
++        if( infop->type==etFLOAT ) realvalue += rounder;
++        /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
++        exp = 0;
++        if( realvalue>0.0 ){
++          while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
++          while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
++          while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; }
++          while( realvalue<1.0 && exp>=-350 ){ realvalue *= 10.0; exp--; }
++          if( exp>350 || exp<-350 ){
++            bufpt = "NaN";
++            length = 3;
++            break;
++          }
++        }
++        bufpt = buf;
++        /*
++        ** If the field type is etGENERIC, then convert to either etEXP
++        ** or etFLOAT, as appropriate.
++        */
++        flag_exp = xtype==etEXP;
++        if( xtype!=etFLOAT ){
++          realvalue += rounder;
++          if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
++        }
++        if( xtype==etGENERIC ){
++          flag_rtz = !flag_alternateform;
++          if( exp<-4 || exp>precision ){
++            xtype = etEXP;
++          }else{
++            precision = precision - exp;
++            xtype = etFLOAT;
++          }
++        }else{
++          flag_rtz = 0;
++        }
++        /*
++        ** The "exp+precision" test causes output to be of type etEXP if
++        ** the precision is too large to fit in buf[].
++        */
++        nsd = 0;
++        if( xtype==etFLOAT && exp+precision<etBUFSIZE-30 ){
++          flag_dp = (precision>0 || flag_alternateform);
++          if( prefix ) *(bufpt++) = prefix;         /* Sign */
++          if( exp<0 )  *(bufpt++) = '0';            /* Digits before "." */
++          else for(; exp>=0; exp--) *(bufpt++) = et_getdigit(&realvalue,&nsd);
++          if( flag_dp ) *(bufpt++) = '.';           /* The decimal point */
++          for(exp++; exp<0 && precision>0; precision--, exp++){
++            *(bufpt++) = '0';
++          }
++          while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd);
++          *(bufpt--) = 0;                           /* Null terminate */
++          if( flag_rtz && flag_dp ){     /* Remove trailing zeros and "." */
++            while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0;
++            if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
++          }
++          bufpt++;                            /* point to next free slot */
++        }else{    /* etEXP or etGENERIC */
++          flag_dp = (precision>0 || flag_alternateform);
++          if( prefix ) *(bufpt++) = prefix;   /* Sign */
++          *(bufpt++) = et_getdigit(&realvalue,&nsd);  /* First digit */
++          if( flag_dp ) *(bufpt++) = '.';     /* Decimal point */
++          while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd);
++          bufpt--;                            /* point to last digit */
++          if( flag_rtz && flag_dp ){          /* Remove tail zeros */
++            while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0;
++            if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
++          }
++          bufpt++;                            /* point to next free slot */
++          if( exp || flag_exp ){
++            *(bufpt++) = infop->charset[0];
++            if( exp<0 ){ *(bufpt++) = '-'; exp = -exp; } /* sign of exp */
++            else       { *(bufpt++) = '+'; }
++            if( exp>=100 ){
++              *(bufpt++) = (exp/100)+'0';                /* 100's digit */
++              exp %= 100;
++            }
++            *(bufpt++) = exp/10+'0';                     /* 10's digit */
++            *(bufpt++) = exp%10+'0';                     /* 1's digit */
++          }
++        }
++        /* The converted number is in buf[] and zero terminated. Output it.
++        ** Note that the number is in the usual order, not reversed as with
++        ** integer conversions. */
++        length = bufpt-buf;
++        bufpt = buf;
++
++        /* Special case:  Add leading zeros if the flag_zeropad flag is
++        ** set and we are not left justified */
++        if( flag_zeropad && !flag_leftjustify && length < width){
++          int i;
++          int nPad = width - length;
++          for(i=width; i>=nPad; i--){
++            bufpt[i] = bufpt[i-nPad];
++          }
++          i = prefix!=0;
++          while( nPad-- ) bufpt[i++] = '0';
++          length = width;
++        }
++#endif
++        break;
++      case etSIZE:
++        *(va_arg(ap,int*)) = count;
++        length = width = 0;
++        break;
++      case etPERCENT:
++        buf[0] = '%';
++        bufpt = buf;
++        length = 1;
++        break;
++      case etCHARLIT:
++      case etCHARX:
++        c = buf[0] = (xtype==etCHARX ? va_arg(ap,int) : *++fmt);
++        if( precision>=0 ){
++          for(idx=1; idx<precision; idx++) buf[idx] = c;
++          length = precision;
++        }else{
++          length =1;
++        }
++        bufpt = buf;
++        break;
++      case etSTRING:
++      case etDYNSTRING:
++        bufpt = va_arg(ap,char*);
++        if( bufpt==0 ){
++          bufpt = "";
++        }else if( xtype==etDYNSTRING ){
++          zExtra = bufpt;
++        }
++        length = strlen(bufpt);
++        if( precision>=0 && precision<length ) length = precision;
++        break;
++      case etSQLESCAPE:
++      case etSQLESCAPE2:
++        {
++          int i, j, n, c, isnull;
++          char *arg = va_arg(ap,char*);
++          isnull = arg==0;
++          if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
++          for(i=n=0; (c=arg[i])!=0; i++){
++            if( c=='\'' )  n++;
++          }
++          n += i + 1 + ((!isnull && xtype==etSQLESCAPE2) ? 2 : 0);
++          if( n>etBUFSIZE ){
++            bufpt = zExtra = sqliteMalloc( n );
++            if( bufpt==0 ) return -1;
++          }else{
++            bufpt = buf;
++          }
++          j = 0;
++          if( !isnull && xtype==etSQLESCAPE2 ) bufpt[j++] = '\'';
++          for(i=0; (c=arg[i])!=0; i++){
++            bufpt[j++] = c;
++            if( c=='\'' ) bufpt[j++] = c;
++          }
++          if( !isnull && xtype==etSQLESCAPE2 ) bufpt[j++] = '\'';
++          bufpt[j] = 0;
++          length = j;
++          if( precision>=0 && precision<length ) length = precision;
++        }
++        break;
++      case etTOKEN: {
++        Token *pToken = va_arg(ap, Token*);
++        (*func)(arg, pToken->z, pToken->n);
++        length = width = 0;
++        break;
++      }
++      case etSRCLIST: {
++        SrcList *pSrc = va_arg(ap, SrcList*);
++        int k = va_arg(ap, int);
++        struct SrcList_item *pItem = &pSrc->a[k];
++        assert( k>=0 && k<pSrc->nSrc );
++        if( pItem->zDatabase && pItem->zDatabase[0] ){
++          (*func)(arg, pItem->zDatabase, strlen(pItem->zDatabase));
++          (*func)(arg, ".", 1);
++        }
++        (*func)(arg, pItem->zName, strlen(pItem->zName));
++        length = width = 0;
++        break;
++      }
++      case etERROR:
++        buf[0] = '%';
++        buf[1] = c;
++        errorflag = 0;
++        idx = 1+(c!=0);
++        (*func)(arg,"%",idx);
++        count += idx;
++        if( c==0 ) fmt--;
++        break;
++    }/* End switch over the format type */
++    /*
++    ** The text of the conversion is pointed to by "bufpt" and is
++    ** "length" characters long.  The field width is "width".  Do
++    ** the output.
++    */
++    if( !flag_leftjustify ){
++      register int nspace;
++      nspace = width-length;
++      if( nspace>0 ){
++        count += nspace;
++        while( nspace>=etSPACESIZE ){
++          (*func)(arg,spaces,etSPACESIZE);
++          nspace -= etSPACESIZE;
++        }
++        if( nspace>0 ) (*func)(arg,spaces,nspace);
++      }
++    }
++    if( length>0 ){
++      (*func)(arg,bufpt,length);
++      count += length;
++    }
++    if( flag_leftjustify ){
++      register int nspace;
++      nspace = width-length;
++      if( nspace>0 ){
++        count += nspace;
++        while( nspace>=etSPACESIZE ){
++          (*func)(arg,spaces,etSPACESIZE);
++          nspace -= etSPACESIZE;
++        }
++        if( nspace>0 ) (*func)(arg,spaces,nspace);
++      }
++    }
++    if( zExtra ){
++      sqliteFree(zExtra);
++    }
++  }/* End for loop over the format string */
++  return errorflag ? -1 : count;
++} /* End of function */
++
++
++/* This structure is used to store state information about the
++** write to memory that is currently in progress.
++*/
++struct sgMprintf {
++  char *zBase;     /* A base allocation */
++  char *zText;     /* The string collected so far */
++  int  nChar;      /* Length of the string so far */
++  int  nTotal;     /* Output size if unconstrained */
++  int  nAlloc;     /* Amount of space allocated in zText */
++  void *(*xRealloc)(void*,int);  /* Function used to realloc memory */
++};
++
++/* 
++** This function implements the callback from vxprintf. 
++**
++** This routine add nNewChar characters of text in zNewText to
++** the sgMprintf structure pointed to by "arg".
++*/
++static void mout(void *arg, const char *zNewText, int nNewChar){
++  struct sgMprintf *pM = (struct sgMprintf*)arg;
++  pM->nTotal += nNewChar;
++  if( pM->nChar + nNewChar + 1 > pM->nAlloc ){
++    if( pM->xRealloc==0 ){
++      nNewChar =  pM->nAlloc - pM->nChar - 1;
++    }else{
++      pM->nAlloc = pM->nChar + nNewChar*2 + 1;
++      if( pM->zText==pM->zBase ){
++        pM->zText = pM->xRealloc(0, pM->nAlloc);
++        if( pM->zText && pM->nChar ){
++          memcpy(pM->zText, pM->zBase, pM->nChar);
++        }
++      }else{
++        pM->zText = pM->xRealloc(pM->zText, pM->nAlloc);
++      }
++    }
++  }
++  if( pM->zText ){
++    if( nNewChar>0 ){
++      memcpy(&pM->zText[pM->nChar], zNewText, nNewChar);
++      pM->nChar += nNewChar;
++    }
++    pM->zText[pM->nChar] = 0;
++  }
++}
++
++/*
++** This routine is a wrapper around xprintf() that invokes mout() as
++** the consumer.  
++*/
++static char *base_vprintf(
++  void *(*xRealloc)(void*,int),   /* Routine to realloc memory. May be NULL */
++  int useInternal,                /* Use internal %-conversions if true */
++  char *zInitBuf,                 /* Initially write here, before mallocing */
++  int nInitBuf,                   /* Size of zInitBuf[] */
++  const char *zFormat,            /* format string */
++  va_list ap                      /* arguments */
++){
++  struct sgMprintf sM;
++  sM.zBase = sM.zText = zInitBuf;
++  sM.nChar = sM.nTotal = 0;
++  sM.nAlloc = nInitBuf;
++  sM.xRealloc = xRealloc;
++  vxprintf(mout, &sM, useInternal, zFormat, ap);
++  if( xRealloc ){
++    if( sM.zText==sM.zBase ){
++      sM.zText = xRealloc(0, sM.nChar+1);
++      memcpy(sM.zText, sM.zBase, sM.nChar+1);
++    }else if( sM.nAlloc>sM.nChar+10 ){
++      sM.zText = xRealloc(sM.zText, sM.nChar+1);
++    }
++  }
++  return sM.zText;
++}
++
++/*
++** Realloc that is a real function, not a macro.
++*/
++static void *printf_realloc(void *old, int size){
++  return sqliteRealloc(old,size);
++}
++
++/*
++** Print into memory obtained from sqliteMalloc().  Use the internal
++** %-conversion extensions.
++*/
++char *sqliteVMPrintf(const char *zFormat, va_list ap){
++  char zBase[1000];
++  return base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
++}
++
++/*
++** Print into memory obtained from sqliteMalloc().  Use the internal
++** %-conversion extensions.
++*/
++char *sqliteMPrintf(const char *zFormat, ...){
++  va_list ap;
++  char *z;
++  char zBase[1000];
++  va_start(ap, zFormat);
++  z = base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
++  va_end(ap);
++  return z;
++}
++
++/*
++** Print into memory obtained from malloc().  Do not use the internal
++** %-conversion extensions.  This routine is for use by external users.
++*/
++char *sqlite_mprintf(const char *zFormat, ...){
++  va_list ap;
++  char *z;
++  char zBuf[200];
++
++  va_start(ap,zFormat);
++  z = base_vprintf((void*(*)(void*,int))realloc, 0, 
++                   zBuf, sizeof(zBuf), zFormat, ap);
++  va_end(ap);
++  return z;
++}
++
++/* This is the varargs version of sqlite_mprintf.  
++*/
++char *sqlite_vmprintf(const char *zFormat, va_list ap){
++  char zBuf[200];
++  return base_vprintf((void*(*)(void*,int))realloc, 0,
++                      zBuf, sizeof(zBuf), zFormat, ap);
++}
++
++/*
++** sqlite_snprintf() works like snprintf() except that it ignores the
++** current locale settings.  This is important for SQLite because we
++** are not able to use a "," as the decimal point in place of "." as
++** specified by some locales.
++*/
++char *sqlite_snprintf(int n, char *zBuf, const char *zFormat, ...){
++  char *z;
++  va_list ap;
++
++  va_start(ap,zFormat);
++  z = base_vprintf(0, 0, zBuf, n, zFormat, ap);
++  va_end(ap);
++  return z;
++}
++
++/*
++** The following four routines implement the varargs versions of the
++** sqlite_exec() and sqlite_get_table() interfaces.  See the sqlite.h
++** header files for a more detailed description of how these interfaces
++** work.
++**
++** These routines are all just simple wrappers.
++*/
++int sqlite_exec_printf(
++  sqlite *db,                   /* An open database */
++  const char *sqlFormat,        /* printf-style format string for the SQL */
++  sqlite_callback xCallback,    /* Callback function */
++  void *pArg,                   /* 1st argument to callback function */
++  char **errmsg,                /* Error msg written here */
++  ...                           /* Arguments to the format string. */
++){
++  va_list ap;
++  int rc;
++
++  va_start(ap, errmsg);
++  rc = sqlite_exec_vprintf(db, sqlFormat, xCallback, pArg, errmsg, ap);
++  va_end(ap);
++  return rc;
++}
++int sqlite_exec_vprintf(
++  sqlite *db,                   /* An open database */
++  const char *sqlFormat,        /* printf-style format string for the SQL */
++  sqlite_callback xCallback,    /* Callback function */
++  void *pArg,                   /* 1st argument to callback function */
++  char **errmsg,                /* Error msg written here */
++  va_list ap                    /* Arguments to the format string. */
++){
++  char *zSql;
++  int rc;
++
++  zSql = sqlite_vmprintf(sqlFormat, ap);
++  rc = sqlite_exec(db, zSql, xCallback, pArg, errmsg);
++  free(zSql);
++  return rc;
++}
++int sqlite_get_table_printf(
++  sqlite *db,            /* An open database */
++  const char *sqlFormat, /* printf-style format string for the SQL */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncol,             /* Number of result columns written here */
++  char **errmsg,         /* Error msg written here */
++  ...                    /* Arguments to the format string */
++){
++  va_list ap;
++  int rc;
++
++  va_start(ap, errmsg);
++  rc = sqlite_get_table_vprintf(db, sqlFormat, resultp, nrow, ncol, errmsg, ap);
++  va_end(ap);
++  return rc;
++}
++int sqlite_get_table_vprintf(
++  sqlite *db,            /* An open database */
++  const char *sqlFormat, /* printf-style format string for the SQL */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg,         /* Error msg written here */
++  va_list ap             /* Arguments to the format string */
++){
++  char *zSql;
++  int rc;
++
++  zSql = sqlite_vmprintf(sqlFormat, ap);
++  rc = sqlite_get_table(db, zSql, resultp, nrow, ncolumn, errmsg);
++  free(zSql);
++  return rc;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/random.c
+@@ -0,0 +1,97 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code to implement a pseudo-random number
++** generator (PRNG) for SQLite.
++**
++** Random numbers are used by some of the database backends in order
++** to generate random integer keys for tables or random filenames.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include "os.h"
++
++
++/*
++** Get a single 8-bit random value from the RC4 PRNG.  The Mutex
++** must be held while executing this routine.
++**
++** Why not just use a library random generator like lrand48() for this?
++** Because the OP_NewRecno opcode in the VDBE depends on having a very
++** good source of random numbers.  The lrand48() library function may
++** well be good enough.  But maybe not.  Or maybe lrand48() has some
++** subtle problems on some systems that could cause problems.  It is hard
++** to know.  To minimize the risk of problems due to bad lrand48()
++** implementations, SQLite uses this random number generator based
++** on RC4, which we know works very well.
++*/
++static int randomByte(){
++  unsigned char t;
++
++  /* All threads share a single random number generator.
++  ** This structure is the current state of the generator.
++  */
++  static struct {
++    unsigned char isInit;          /* True if initialized */
++    unsigned char i, j;            /* State variables */
++    unsigned char s[256];          /* State variables */
++  } prng;
++
++  /* Initialize the state of the random number generator once,
++  ** the first time this routine is called.  The seed value does
++  ** not need to contain a lot of randomness since we are not
++  ** trying to do secure encryption or anything like that...
++  **
++  ** Nothing in this file or anywhere else in SQLite does any kind of
++  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random
++  ** number generator) not as an encryption device.
++  */
++  if( !prng.isInit ){
++    int i;
++    char k[256];
++    prng.j = 0;
++    prng.i = 0;
++    sqliteOsRandomSeed(k);
++    for(i=0; i<256; i++){
++      prng.s[i] = i;
++    }
++    for(i=0; i<256; i++){
++      prng.j += prng.s[i] + k[i];
++      t = prng.s[prng.j];
++      prng.s[prng.j] = prng.s[i];
++      prng.s[i] = t;
++    }
++    prng.isInit = 1;
++  }
++
++  /* Generate and return single random byte
++  */
++  prng.i++;
++  t = prng.s[prng.i];
++  prng.j += t;
++  prng.s[prng.i] = prng.s[prng.j];
++  prng.s[prng.j] = t;
++  t += prng.s[prng.i];
++  return prng.s[t];
++}
++
++/*
++** Return N random bytes.
++*/
++void sqliteRandomness(int N, void *pBuf){
++  unsigned char *zBuf = pBuf;
++  sqliteOsEnterMutex();
++  while( N-- ){
++    *(zBuf++) = randomByte();
++  }
++  sqliteOsLeaveMutex();
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/select.c
+@@ -0,0 +1,2434 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains C code routines that are called by the parser
++** to handle SELECT statements in SQLite.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++
++/*
++** Allocate a new Select structure and return a pointer to that
++** structure.
++*/
++Select *sqliteSelectNew(
++  ExprList *pEList,     /* which columns to include in the result */
++  SrcList *pSrc,        /* the FROM clause -- which tables to scan */
++  Expr *pWhere,         /* the WHERE clause */
++  ExprList *pGroupBy,   /* the GROUP BY clause */
++  Expr *pHaving,        /* the HAVING clause */
++  ExprList *pOrderBy,   /* the ORDER BY clause */
++  int isDistinct,       /* true if the DISTINCT keyword is present */
++  int nLimit,           /* LIMIT value.  -1 means not used */
++  int nOffset           /* OFFSET value.  0 means no offset */
++){
++  Select *pNew;
++  pNew = sqliteMalloc( sizeof(*pNew) );
++  if( pNew==0 ){
++    sqliteExprListDelete(pEList);
++    sqliteSrcListDelete(pSrc);
++    sqliteExprDelete(pWhere);
++    sqliteExprListDelete(pGroupBy);
++    sqliteExprDelete(pHaving);
++    sqliteExprListDelete(pOrderBy);
++  }else{
++    if( pEList==0 ){
++      pEList = sqliteExprListAppend(0, sqliteExpr(TK_ALL,0,0,0), 0);
++    }
++    pNew->pEList = pEList;
++    pNew->pSrc = pSrc;
++    pNew->pWhere = pWhere;
++    pNew->pGroupBy = pGroupBy;
++    pNew->pHaving = pHaving;
++    pNew->pOrderBy = pOrderBy;
++    pNew->isDistinct = isDistinct;
++    pNew->op = TK_SELECT;
++    pNew->nLimit = nLimit;
++    pNew->nOffset = nOffset;
++    pNew->iLimit = -1;
++    pNew->iOffset = -1;
++  }
++  return pNew;
++}
++
++/*
++** Given 1 to 3 identifiers preceeding the JOIN keyword, determine the
++** type of join.  Return an integer constant that expresses that type
++** in terms of the following bit values:
++**
++**     JT_INNER
++**     JT_OUTER
++**     JT_NATURAL
++**     JT_LEFT
++**     JT_RIGHT
++**
++** A full outer join is the combination of JT_LEFT and JT_RIGHT.
++**
++** If an illegal or unsupported join type is seen, then still return
++** a join type, but put an error in the pParse structure.
++*/
++int sqliteJoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){
++  int jointype = 0;
++  Token *apAll[3];
++  Token *p;
++  static struct {
++    const char *zKeyword;
++    int nChar;
++    int code;
++  } keywords[] = {
++    { "natural", 7, JT_NATURAL },
++    { "left",    4, JT_LEFT|JT_OUTER },
++    { "right",   5, JT_RIGHT|JT_OUTER },
++    { "full",    4, JT_LEFT|JT_RIGHT|JT_OUTER },
++    { "outer",   5, JT_OUTER },
++    { "inner",   5, JT_INNER },
++    { "cross",   5, JT_INNER },
++  };
++  int i, j;
++  apAll[0] = pA;
++  apAll[1] = pB;
++  apAll[2] = pC;
++  for(i=0; i<3 && apAll[i]; i++){
++    p = apAll[i];
++    for(j=0; j<sizeof(keywords)/sizeof(keywords[0]); j++){
++      if( p->n==keywords[j].nChar 
++          && sqliteStrNICmp(p->z, keywords[j].zKeyword, p->n)==0 ){
++        jointype |= keywords[j].code;
++        break;
++      }
++    }
++    if( j>=sizeof(keywords)/sizeof(keywords[0]) ){
++      jointype |= JT_ERROR;
++      break;
++    }
++  }
++  if(
++     (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||
++     (jointype & JT_ERROR)!=0
++  ){
++    static Token dummy = { 0, 0 };
++    char *zSp1 = " ", *zSp2 = " ";
++    if( pB==0 ){ pB = &dummy; zSp1 = 0; }
++    if( pC==0 ){ pC = &dummy; zSp2 = 0; }
++    sqliteSetNString(&pParse->zErrMsg, "unknown or unsupported join type: ", 0,
++       pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, 0);
++    pParse->nErr++;
++    jointype = JT_INNER;
++  }else if( jointype & JT_RIGHT ){
++    sqliteErrorMsg(pParse, 
++      "RIGHT and FULL OUTER JOINs are not currently supported");
++    jointype = JT_INNER;
++  }
++  return jointype;
++}
++
++/*
++** Return the index of a column in a table.  Return -1 if the column
++** is not contained in the table.
++*/
++static int columnIndex(Table *pTab, const char *zCol){
++  int i;
++  for(i=0; i<pTab->nCol; i++){
++    if( sqliteStrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
++  }
++  return -1;
++}
++
++/*
++** Add a term to the WHERE expression in *ppExpr that requires the
++** zCol column to be equal in the two tables pTab1 and pTab2.
++*/
++static void addWhereTerm(
++  const char *zCol,        /* Name of the column */
++  const Table *pTab1,      /* First table */
++  const Table *pTab2,      /* Second table */
++  Expr **ppExpr            /* Add the equality term to this expression */
++){
++  Token dummy;
++  Expr *pE1a, *pE1b, *pE1c;
++  Expr *pE2a, *pE2b, *pE2c;
++  Expr *pE;
++
++  dummy.z = zCol;
++  dummy.n = strlen(zCol);
++  dummy.dyn = 0;
++  pE1a = sqliteExpr(TK_ID, 0, 0, &dummy);
++  pE2a = sqliteExpr(TK_ID, 0, 0, &dummy);
++  dummy.z = pTab1->zName;
++  dummy.n = strlen(dummy.z);
++  pE1b = sqliteExpr(TK_ID, 0, 0, &dummy);
++  dummy.z = pTab2->zName;
++  dummy.n = strlen(dummy.z);
++  pE2b = sqliteExpr(TK_ID, 0, 0, &dummy);
++  pE1c = sqliteExpr(TK_DOT, pE1b, pE1a, 0);
++  pE2c = sqliteExpr(TK_DOT, pE2b, pE2a, 0);
++  pE = sqliteExpr(TK_EQ, pE1c, pE2c, 0);
++  ExprSetProperty(pE, EP_FromJoin);
++  if( *ppExpr ){
++    *ppExpr = sqliteExpr(TK_AND, *ppExpr, pE, 0);
++  }else{
++    *ppExpr = pE;
++  }
++}
++
++/*
++** Set the EP_FromJoin property on all terms of the given expression.
++**
++** The EP_FromJoin property is used on terms of an expression to tell
++** the LEFT OUTER JOIN processing logic that this term is part of the
++** join restriction specified in the ON or USING clause and not a part
++** of the more general WHERE clause.  These terms are moved over to the
++** WHERE clause during join processing but we need to remember that they
++** originated in the ON or USING clause.
++*/
++static void setJoinExpr(Expr *p){
++  while( p ){
++    ExprSetProperty(p, EP_FromJoin);
++    setJoinExpr(p->pLeft);
++    p = p->pRight;
++  } 
++}
++
++/*
++** This routine processes the join information for a SELECT statement.
++** ON and USING clauses are converted into extra terms of the WHERE clause.
++** NATURAL joins also create extra WHERE clause terms.
++**
++** This routine returns the number of errors encountered.
++*/
++static int sqliteProcessJoin(Parse *pParse, Select *p){
++  SrcList *pSrc;
++  int i, j;
++  pSrc = p->pSrc;
++  for(i=0; i<pSrc->nSrc-1; i++){
++    struct SrcList_item *pTerm = &pSrc->a[i];
++    struct SrcList_item *pOther = &pSrc->a[i+1];
++
++    if( pTerm->pTab==0 || pOther->pTab==0 ) continue;
++
++    /* When the NATURAL keyword is present, add WHERE clause terms for
++    ** every column that the two tables have in common.
++    */
++    if( pTerm->jointype & JT_NATURAL ){
++      Table *pTab;
++      if( pTerm->pOn || pTerm->pUsing ){
++        sqliteErrorMsg(pParse, "a NATURAL join may not have "
++           "an ON or USING clause", 0);
++        return 1;
++      }
++      pTab = pTerm->pTab;
++      for(j=0; j<pTab->nCol; j++){
++        if( columnIndex(pOther->pTab, pTab->aCol[j].zName)>=0 ){
++          addWhereTerm(pTab->aCol[j].zName, pTab, pOther->pTab, &p->pWhere);
++        }
++      }
++    }
++
++    /* Disallow both ON and USING clauses in the same join
++    */
++    if( pTerm->pOn && pTerm->pUsing ){
++      sqliteErrorMsg(pParse, "cannot have both ON and USING "
++        "clauses in the same join");
++      return 1;
++    }
++
++    /* Add the ON clause to the end of the WHERE clause, connected by
++    ** and AND operator.
++    */
++    if( pTerm->pOn ){
++      setJoinExpr(pTerm->pOn);
++      if( p->pWhere==0 ){
++        p->pWhere = pTerm->pOn;
++      }else{
++        p->pWhere = sqliteExpr(TK_AND, p->pWhere, pTerm->pOn, 0);
++      }
++      pTerm->pOn = 0;
++    }
++
++    /* Create extra terms on the WHERE clause for each column named
++    ** in the USING clause.  Example: If the two tables to be joined are 
++    ** A and B and the USING clause names X, Y, and Z, then add this
++    ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
++    ** Report an error if any column mentioned in the USING clause is
++    ** not contained in both tables to be joined.
++    */
++    if( pTerm->pUsing ){
++      IdList *pList;
++      int j;
++      assert( i<pSrc->nSrc-1 );
++      pList = pTerm->pUsing;
++      for(j=0; j<pList->nId; j++){
++        if( columnIndex(pTerm->pTab, pList->a[j].zName)<0 ||
++            columnIndex(pOther->pTab, pList->a[j].zName)<0 ){
++          sqliteErrorMsg(pParse, "cannot join using column %s - column "
++            "not present in both tables", pList->a[j].zName);
++          return 1;
++        }
++        addWhereTerm(pList->a[j].zName, pTerm->pTab, pOther->pTab, &p->pWhere);
++      }
++    }
++  }
++  return 0;
++}
++
++/*
++** Delete the given Select structure and all of its substructures.
++*/
++void sqliteSelectDelete(Select *p){
++  if( p==0 ) return;
++  sqliteExprListDelete(p->pEList);
++  sqliteSrcListDelete(p->pSrc);
++  sqliteExprDelete(p->pWhere);
++  sqliteExprListDelete(p->pGroupBy);
++  sqliteExprDelete(p->pHaving);
++  sqliteExprListDelete(p->pOrderBy);
++  sqliteSelectDelete(p->pPrior);
++  sqliteFree(p->zSelect);
++  sqliteFree(p);
++}
++
++/*
++** Delete the aggregate information from the parse structure.
++*/
++static void sqliteAggregateInfoReset(Parse *pParse){
++  sqliteFree(pParse->aAgg);
++  pParse->aAgg = 0;
++  pParse->nAgg = 0;
++  pParse->useAgg = 0;
++}
++
++/*
++** Insert code into "v" that will push the record on the top of the
++** stack into the sorter.
++*/
++static void pushOntoSorter(Parse *pParse, Vdbe *v, ExprList *pOrderBy){
++  char *zSortOrder;
++  int i;
++  zSortOrder = sqliteMalloc( pOrderBy->nExpr + 1 );
++  if( zSortOrder==0 ) return;
++  for(i=0; i<pOrderBy->nExpr; i++){
++    int order = pOrderBy->a[i].sortOrder;
++    int type;
++    int c;
++    if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_TEXT ){
++      type = SQLITE_SO_TEXT;
++    }else if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_NUM ){
++      type = SQLITE_SO_NUM;
++    }else if( pParse->db->file_format>=4 ){
++      type = sqliteExprType(pOrderBy->a[i].pExpr);
++    }else{
++      type = SQLITE_SO_NUM;
++    }
++    if( (order & SQLITE_SO_DIRMASK)==SQLITE_SO_ASC ){
++      c = type==SQLITE_SO_TEXT ? 'A' : '+';
++    }else{
++      c = type==SQLITE_SO_TEXT ? 'D' : '-';
++    }
++    zSortOrder[i] = c;
++    sqliteExprCode(pParse, pOrderBy->a[i].pExpr);
++  }
++  zSortOrder[pOrderBy->nExpr] = 0;
++  sqliteVdbeOp3(v, OP_SortMakeKey, pOrderBy->nExpr, 0, zSortOrder, P3_DYNAMIC);
++  sqliteVdbeAddOp(v, OP_SortPut, 0, 0);
++}
++
++/*
++** This routine adds a P3 argument to the last VDBE opcode that was
++** inserted. The P3 argument added is a string suitable for the 
++** OP_MakeKey or OP_MakeIdxKey opcodes.  The string consists of
++** characters 't' or 'n' depending on whether or not the various
++** fields of the key to be generated should be treated as numeric
++** or as text.  See the OP_MakeKey and OP_MakeIdxKey opcode
++** documentation for additional information about the P3 string.
++** See also the sqliteAddIdxKeyType() routine.
++*/
++void sqliteAddKeyType(Vdbe *v, ExprList *pEList){
++  int nColumn = pEList->nExpr;
++  char *zType = sqliteMalloc( nColumn+1 );
++  int i;
++  if( zType==0 ) return;
++  for(i=0; i<nColumn; i++){
++    zType[i] = sqliteExprType(pEList->a[i].pExpr)==SQLITE_SO_NUM ? 'n' : 't';
++  }
++  zType[i] = 0;
++  sqliteVdbeChangeP3(v, -1, zType, P3_DYNAMIC);
++}
++
++/*
++** Add code to implement the OFFSET and LIMIT
++*/
++static void codeLimiter(
++  Vdbe *v,          /* Generate code into this VM */
++  Select *p,        /* The SELECT statement being coded */
++  int iContinue,    /* Jump here to skip the current record */
++  int iBreak,       /* Jump here to end the loop */
++  int nPop          /* Number of times to pop stack when jumping */
++){
++  if( p->iOffset>=0 ){
++    int addr = sqliteVdbeCurrentAddr(v) + 2;
++    if( nPop>0 ) addr++;
++    sqliteVdbeAddOp(v, OP_MemIncr, p->iOffset, addr);
++    if( nPop>0 ){
++      sqliteVdbeAddOp(v, OP_Pop, nPop, 0);
++    }
++    sqliteVdbeAddOp(v, OP_Goto, 0, iContinue);
++  }
++  if( p->iLimit>=0 ){
++    sqliteVdbeAddOp(v, OP_MemIncr, p->iLimit, iBreak);
++  }
++}
++
++/*
++** This routine generates the code for the inside of the inner loop
++** of a SELECT.
++**
++** If srcTab and nColumn are both zero, then the pEList expressions
++** are evaluated in order to get the data for this row.  If nColumn>0
++** then data is pulled from srcTab and pEList is used only to get the
++** datatypes for each column.
++*/
++static int selectInnerLoop(
++  Parse *pParse,          /* The parser context */
++  Select *p,              /* The complete select statement being coded */
++  ExprList *pEList,       /* List of values being extracted */
++  int srcTab,             /* Pull data from this table */
++  int nColumn,            /* Number of columns in the source table */
++  ExprList *pOrderBy,     /* If not NULL, sort results using this key */
++  int distinct,           /* If >=0, make sure results are distinct */
++  int eDest,              /* How to dispose of the results */
++  int iParm,              /* An argument to the disposal method */
++  int iContinue,          /* Jump here to continue with next row */
++  int iBreak              /* Jump here to break out of the inner loop */
++){
++  Vdbe *v = pParse->pVdbe;
++  int i;
++  int hasDistinct;        /* True if the DISTINCT keyword is present */
++
++  if( v==0 ) return 0;
++  assert( pEList!=0 );
++
++  /* If there was a LIMIT clause on the SELECT statement, then do the check
++  ** to see if this row should be output.
++  */
++  hasDistinct = distinct>=0 && pEList && pEList->nExpr>0;
++  if( pOrderBy==0 && !hasDistinct ){
++    codeLimiter(v, p, iContinue, iBreak, 0);
++  }
++
++  /* Pull the requested columns.
++  */
++  if( nColumn>0 ){
++    for(i=0; i<nColumn; i++){
++      sqliteVdbeAddOp(v, OP_Column, srcTab, i);
++    }
++  }else{
++    nColumn = pEList->nExpr;
++    for(i=0; i<pEList->nExpr; i++){
++      sqliteExprCode(pParse, pEList->a[i].pExpr);
++    }
++  }
++
++  /* If the DISTINCT keyword was present on the SELECT statement
++  ** and this row has been seen before, then do not make this row
++  ** part of the result.
++  */
++  if( hasDistinct ){
++#if NULL_ALWAYS_DISTINCT
++    sqliteVdbeAddOp(v, OP_IsNull, -pEList->nExpr, sqliteVdbeCurrentAddr(v)+7);
++#endif
++    sqliteVdbeAddOp(v, OP_MakeKey, pEList->nExpr, 1);
++    if( pParse->db->file_format>=4 ) sqliteAddKeyType(v, pEList);
++    sqliteVdbeAddOp(v, OP_Distinct, distinct, sqliteVdbeCurrentAddr(v)+3);
++    sqliteVdbeAddOp(v, OP_Pop, pEList->nExpr+1, 0);
++    sqliteVdbeAddOp(v, OP_Goto, 0, iContinue);
++    sqliteVdbeAddOp(v, OP_String, 0, 0);
++    sqliteVdbeAddOp(v, OP_PutStrKey, distinct, 0);
++    if( pOrderBy==0 ){
++      codeLimiter(v, p, iContinue, iBreak, nColumn);
++    }
++  }
++
++  switch( eDest ){
++    /* In this mode, write each query result to the key of the temporary
++    ** table iParm.
++    */
++    case SRT_Union: {
++      sqliteVdbeAddOp(v, OP_MakeRecord, nColumn, NULL_ALWAYS_DISTINCT);
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
++      break;
++    }
++
++    /* Store the result as data using a unique key.
++    */
++    case SRT_Table:
++    case SRT_TempTable: {
++      sqliteVdbeAddOp(v, OP_MakeRecord, nColumn, 0);
++      if( pOrderBy ){
++        pushOntoSorter(pParse, v, pOrderBy);
++      }else{
++        sqliteVdbeAddOp(v, OP_NewRecno, iParm, 0);
++        sqliteVdbeAddOp(v, OP_Pull, 1, 0);
++        sqliteVdbeAddOp(v, OP_PutIntKey, iParm, 0);
++      }
++      break;
++    }
++
++    /* Construct a record from the query result, but instead of
++    ** saving that record, use it as a key to delete elements from
++    ** the temporary table iParm.
++    */
++    case SRT_Except: {
++      int addr;
++      addr = sqliteVdbeAddOp(v, OP_MakeRecord, nColumn, NULL_ALWAYS_DISTINCT);
++      sqliteVdbeAddOp(v, OP_NotFound, iParm, addr+3);
++      sqliteVdbeAddOp(v, OP_Delete, iParm, 0);
++      break;
++    }
++
++    /* If we are creating a set for an "expr IN (SELECT ...)" construct,
++    ** then there should be a single item on the stack.  Write this
++    ** item into the set table with bogus data.
++    */
++    case SRT_Set: {
++      int addr1 = sqliteVdbeCurrentAddr(v);
++      int addr2;
++      assert( nColumn==1 );
++      sqliteVdbeAddOp(v, OP_NotNull, -1, addr1+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      addr2 = sqliteVdbeAddOp(v, OP_Goto, 0, 0);
++      if( pOrderBy ){
++        pushOntoSorter(pParse, v, pOrderBy);
++      }else{
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++        sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
++      }
++      sqliteVdbeChangeP2(v, addr2, sqliteVdbeCurrentAddr(v));
++      break;
++    }
++
++    /* If this is a scalar select that is part of an expression, then
++    ** store the results in the appropriate memory cell and break out
++    ** of the scan loop.
++    */
++    case SRT_Mem: {
++      assert( nColumn==1 );
++      if( pOrderBy ){
++        pushOntoSorter(pParse, v, pOrderBy);
++      }else{
++        sqliteVdbeAddOp(v, OP_MemStore, iParm, 1);
++        sqliteVdbeAddOp(v, OP_Goto, 0, iBreak);
++      }
++      break;
++    }
++
++    /* Send the data to the callback function.
++    */
++    case SRT_Callback:
++    case SRT_Sorter: {
++      if( pOrderBy ){
++        sqliteVdbeAddOp(v, OP_SortMakeRec, nColumn, 0);
++        pushOntoSorter(pParse, v, pOrderBy);
++      }else{
++        assert( eDest==SRT_Callback );
++        sqliteVdbeAddOp(v, OP_Callback, nColumn, 0);
++      }
++      break;
++    }
++
++    /* Invoke a subroutine to handle the results.  The subroutine itself
++    ** is responsible for popping the results off of the stack.
++    */
++    case SRT_Subroutine: {
++      if( pOrderBy ){
++        sqliteVdbeAddOp(v, OP_MakeRecord, nColumn, 0);
++        pushOntoSorter(pParse, v, pOrderBy);
++      }else{
++        sqliteVdbeAddOp(v, OP_Gosub, 0, iParm);
++      }
++      break;
++    }
++
++    /* Discard the results.  This is used for SELECT statements inside
++    ** the body of a TRIGGER.  The purpose of such selects is to call
++    ** user-defined functions that have side effects.  We do not care
++    ** about the actual results of the select.
++    */
++    default: {
++      assert( eDest==SRT_Discard );
++      sqliteVdbeAddOp(v, OP_Pop, nColumn, 0);
++      break;
++    }
++  }
++  return 0;
++}
++
++/*
++** If the inner loop was generated using a non-null pOrderBy argument,
++** then the results were placed in a sorter.  After the loop is terminated
++** we need to run the sorter and output the results.  The following
++** routine generates the code needed to do that.
++*/
++static void generateSortTail(
++  Select *p,       /* The SELECT statement */
++  Vdbe *v,         /* Generate code into this VDBE */
++  int nColumn,     /* Number of columns of data */
++  int eDest,       /* Write the sorted results here */
++  int iParm        /* Optional parameter associated with eDest */
++){
++  int end1 = sqliteVdbeMakeLabel(v);
++  int end2 = sqliteVdbeMakeLabel(v);
++  int addr;
++  if( eDest==SRT_Sorter ) return;
++  sqliteVdbeAddOp(v, OP_Sort, 0, 0);
++  addr = sqliteVdbeAddOp(v, OP_SortNext, 0, end1);
++  codeLimiter(v, p, addr, end2, 1);
++  switch( eDest ){
++    case SRT_Callback: {
++      sqliteVdbeAddOp(v, OP_SortCallback, nColumn, 0);
++      break;
++    }
++    case SRT_Table:
++    case SRT_TempTable: {
++      sqliteVdbeAddOp(v, OP_NewRecno, iParm, 0);
++      sqliteVdbeAddOp(v, OP_Pull, 1, 0);
++      sqliteVdbeAddOp(v, OP_PutIntKey, iParm, 0);
++      break;
++    }
++    case SRT_Set: {
++      assert( nColumn==1 );
++      sqliteVdbeAddOp(v, OP_NotNull, -1, sqliteVdbeCurrentAddr(v)+3);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, sqliteVdbeCurrentAddr(v)+3);
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
++      break;
++    }
++    case SRT_Mem: {
++      assert( nColumn==1 );
++      sqliteVdbeAddOp(v, OP_MemStore, iParm, 1);
++      sqliteVdbeAddOp(v, OP_Goto, 0, end1);
++      break;
++    }
++    case SRT_Subroutine: {
++      int i;
++      for(i=0; i<nColumn; i++){
++        sqliteVdbeAddOp(v, OP_Column, -1-i, i);
++      }
++      sqliteVdbeAddOp(v, OP_Gosub, 0, iParm);
++      sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++      break;
++    }
++    default: {
++      /* Do nothing */
++      break;
++    }
++  }
++  sqliteVdbeAddOp(v, OP_Goto, 0, addr);
++  sqliteVdbeResolveLabel(v, end2);
++  sqliteVdbeAddOp(v, OP_Pop, 1, 0);
++  sqliteVdbeResolveLabel(v, end1);
++  sqliteVdbeAddOp(v, OP_SortReset, 0, 0);
++}
++
++/*
++** Generate code that will tell the VDBE the datatypes of
++** columns in the result set.
++**
++** This routine only generates code if the "PRAGMA show_datatypes=on"
++** has been executed.  The datatypes are reported out in the azCol
++** parameter to the callback function.  The first N azCol[] entries
++** are the names of the columns, and the second N entries are the
++** datatypes for the columns.
++**
++** The "datatype" for a result that is a column of a type is the
++** datatype definition extracted from the CREATE TABLE statement.
++** The datatype for an expression is either TEXT or NUMERIC.  The
++** datatype for a ROWID field is INTEGER.
++*/
++static void generateColumnTypes(
++  Parse *pParse,      /* Parser context */
++  SrcList *pTabList,  /* List of tables */
++  ExprList *pEList    /* Expressions defining the result set */
++){
++  Vdbe *v = pParse->pVdbe;
++  int i, j;
++  for(i=0; i<pEList->nExpr; i++){
++    Expr *p = pEList->a[i].pExpr;
++    char *zType = 0;
++    if( p==0 ) continue;
++    if( p->op==TK_COLUMN && pTabList ){
++      Table *pTab;
++      int iCol = p->iColumn;
++      for(j=0; j<pTabList->nSrc && pTabList->a[j].iCursor!=p->iTable; j++){}
++      assert( j<pTabList->nSrc );
++      pTab = pTabList->a[j].pTab;
++      if( iCol<0 ) iCol = pTab->iPKey;
++      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
++      if( iCol<0 ){
++        zType = "INTEGER";
++      }else{
++        zType = pTab->aCol[iCol].zType;
++      }
++    }else{
++      if( sqliteExprType(p)==SQLITE_SO_TEXT ){
++        zType = "TEXT";
++      }else{
++        zType = "NUMERIC";
++      }
++    }
++    sqliteVdbeOp3(v, OP_ColumnName, i + pEList->nExpr, 0, zType, 0);
++  }
++}
++
++/*
++** Generate code that will tell the VDBE the names of columns
++** in the result set.  This information is used to provide the
++** azCol[] values in the callback.
++*/
++static void generateColumnNames(
++  Parse *pParse,      /* Parser context */
++  SrcList *pTabList,  /* List of tables */
++  ExprList *pEList    /* Expressions defining the result set */
++){
++  Vdbe *v = pParse->pVdbe;
++  int i, j;
++  sqlite *db = pParse->db;
++  int fullNames, shortNames;
++
++  assert( v!=0 );
++  if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return;
++  pParse->colNamesSet = 1;
++  fullNames = (db->flags & SQLITE_FullColNames)!=0;
++  shortNames = (db->flags & SQLITE_ShortColNames)!=0;
++  for(i=0; i<pEList->nExpr; i++){
++    Expr *p;
++    int p2 = i==pEList->nExpr-1;
++    p = pEList->a[i].pExpr;
++    if( p==0 ) continue;
++    if( pEList->a[i].zName ){
++      char *zName = pEList->a[i].zName;
++      sqliteVdbeOp3(v, OP_ColumnName, i, p2, zName, 0);
++      continue;
++    }
++    if( p->op==TK_COLUMN && pTabList ){
++      Table *pTab;
++      char *zCol;
++      int iCol = p->iColumn;
++      for(j=0; j<pTabList->nSrc && pTabList->a[j].iCursor!=p->iTable; j++){}
++      assert( j<pTabList->nSrc );
++      pTab = pTabList->a[j].pTab;
++      if( iCol<0 ) iCol = pTab->iPKey;
++      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
++      if( iCol<0 ){
++        zCol = "_ROWID_";
++      }else{
++        zCol = pTab->aCol[iCol].zName;
++      }
++      if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){
++        int addr = sqliteVdbeOp3(v,OP_ColumnName, i, p2, p->span.z, p->span.n);
++        sqliteVdbeCompressSpace(v, addr);
++      }else if( fullNames || (!shortNames && pTabList->nSrc>1) ){
++        char *zName = 0;
++        char *zTab;
++ 
++        zTab = pTabList->a[j].zAlias;
++        if( fullNames || zTab==0 ) zTab = pTab->zName;
++        sqliteSetString(&zName, zTab, ".", zCol, 0);
++        sqliteVdbeOp3(v, OP_ColumnName, i, p2, zName, P3_DYNAMIC);
++      }else{
++        sqliteVdbeOp3(v, OP_ColumnName, i, p2, zCol, 0);
++      }
++    }else if( p->span.z && p->span.z[0] ){
++      int addr = sqliteVdbeOp3(v,OP_ColumnName, i, p2, p->span.z, p->span.n);
++      sqliteVdbeCompressSpace(v, addr);
++    }else{
++      char zName[30];
++      assert( p->op!=TK_COLUMN || pTabList==0 );
++      sprintf(zName, "column%d", i+1);
++      sqliteVdbeOp3(v, OP_ColumnName, i, p2, zName, 0);
++    }
++  }
++}
++
++/*
++** Name of the connection operator, used for error messages.
++*/
++static const char *selectOpName(int id){
++  char *z;
++  switch( id ){
++    case TK_ALL:       z = "UNION ALL";   break;
++    case TK_INTERSECT: z = "INTERSECT";   break;
++    case TK_EXCEPT:    z = "EXCEPT";      break;
++    default:           z = "UNION";       break;
++  }
++  return z;
++}
++
++/*
++** Forward declaration
++*/
++static int fillInColumnList(Parse*, Select*);
++
++/*
++** Given a SELECT statement, generate a Table structure that describes
++** the result set of that SELECT.
++*/
++Table *sqliteResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){
++  Table *pTab;
++  int i, j;
++  ExprList *pEList;
++  Column *aCol;
++
++  if( fillInColumnList(pParse, pSelect) ){
++    return 0;
++  }
++  pTab = sqliteMalloc( sizeof(Table) );
++  if( pTab==0 ){
++    return 0;
++  }
++  pTab->zName = zTabName ? sqliteStrDup(zTabName) : 0;
++  pEList = pSelect->pEList;
++  pTab->nCol = pEList->nExpr;
++  assert( pTab->nCol>0 );
++  pTab->aCol = aCol = sqliteMalloc( sizeof(pTab->aCol[0])*pTab->nCol );
++  for(i=0; i<pTab->nCol; i++){
++    Expr *p, *pR;
++    if( pEList->a[i].zName ){
++      aCol[i].zName = sqliteStrDup(pEList->a[i].zName);
++    }else if( (p=pEList->a[i].pExpr)->op==TK_DOT 
++               && (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){
++      int cnt;
++      sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, 0);
++      for(j=cnt=0; j<i; j++){
++        if( sqliteStrICmp(aCol[j].zName, aCol[i].zName)==0 ){
++          int n;
++          char zBuf[30];
++          sprintf(zBuf,"_%d",++cnt);
++          n = strlen(zBuf);
++          sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, zBuf, n,0);
++          j = -1;
++        }
++      }
++    }else if( p->span.z && p->span.z[0] ){
++      sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0);
++    }else{
++      char zBuf[30];
++      sprintf(zBuf, "column%d", i+1);
++      aCol[i].zName = sqliteStrDup(zBuf);
++    }
++    sqliteDequote(aCol[i].zName);
++  }
++  pTab->iPKey = -1;
++  return pTab;
++}
++
++/*
++** For the given SELECT statement, do three things.
++**
++**    (1)  Fill in the pTabList->a[].pTab fields in the SrcList that 
++**         defines the set of tables that should be scanned.  For views,
++**         fill pTabList->a[].pSelect with a copy of the SELECT statement
++**         that implements the view.  A copy is made of the view's SELECT
++**         statement so that we can freely modify or delete that statement
++**         without worrying about messing up the presistent representation
++**         of the view.
++**
++**    (2)  Add terms to the WHERE clause to accomodate the NATURAL keyword
++**         on joins and the ON and USING clause of joins.
++**
++**    (3)  Scan the list of columns in the result set (pEList) looking
++**         for instances of the "*" operator or the TABLE.* operator.
++**         If found, expand each "*" to be every column in every table
++**         and TABLE.* to be every column in TABLE.
++**
++** Return 0 on success.  If there are problems, leave an error message
++** in pParse and return non-zero.
++*/
++static int fillInColumnList(Parse *pParse, Select *p){
++  int i, j, k, rc;
++  SrcList *pTabList;
++  ExprList *pEList;
++  Table *pTab;
++
++  if( p==0 || p->pSrc==0 ) return 1;
++  pTabList = p->pSrc;
++  pEList = p->pEList;
++
++  /* Look up every table in the table list.
++  */
++  for(i=0; i<pTabList->nSrc; i++){
++    if( pTabList->a[i].pTab ){
++      /* This routine has run before!  No need to continue */
++      return 0;
++    }
++    if( pTabList->a[i].zName==0 ){
++      /* A sub-query in the FROM clause of a SELECT */
++      assert( pTabList->a[i].pSelect!=0 );
++      if( pTabList->a[i].zAlias==0 ){
++        char zFakeName[60];
++        sprintf(zFakeName, "sqlite_subquery_%p_",
++           (void*)pTabList->a[i].pSelect);
++        sqliteSetString(&pTabList->a[i].zAlias, zFakeName, 0);
++      }
++      pTabList->a[i].pTab = pTab = 
++        sqliteResultSetOfSelect(pParse, pTabList->a[i].zAlias,
++                                        pTabList->a[i].pSelect);
++      if( pTab==0 ){
++        return 1;
++      }
++      /* The isTransient flag indicates that the Table structure has been
++      ** dynamically allocated and may be freed at any time.  In other words,
++      ** pTab is not pointing to a persistent table structure that defines
++      ** part of the schema. */
++      pTab->isTransient = 1;
++    }else{
++      /* An ordinary table or view name in the FROM clause */
++      pTabList->a[i].pTab = pTab = 
++        sqliteLocateTable(pParse,pTabList->a[i].zName,pTabList->a[i].zDatabase);
++      if( pTab==0 ){
++        return 1;
++      }
++      if( pTab->pSelect ){
++        /* We reach here if the named table is a really a view */
++        if( sqliteViewGetColumnNames(pParse, pTab) ){
++          return 1;
++        }
++        /* If pTabList->a[i].pSelect!=0 it means we are dealing with a
++        ** view within a view.  The SELECT structure has already been
++        ** copied by the outer view so we can skip the copy step here
++        ** in the inner view.
++        */
++        if( pTabList->a[i].pSelect==0 ){
++          pTabList->a[i].pSelect = sqliteSelectDup(pTab->pSelect);
++        }
++      }
++    }
++  }
++
++  /* Process NATURAL keywords, and ON and USING clauses of joins.
++  */
++  if( sqliteProcessJoin(pParse, p) ) return 1;
++
++  /* For every "*" that occurs in the column list, insert the names of
++  ** all columns in all tables.  And for every TABLE.* insert the names
++  ** of all columns in TABLE.  The parser inserted a special expression
++  ** with the TK_ALL operator for each "*" that it found in the column list.
++  ** The following code just has to locate the TK_ALL expressions and expand
++  ** each one to the list of all columns in all tables.
++  **
++  ** The first loop just checks to see if there are any "*" operators
++  ** that need expanding.
++  */
++  for(k=0; k<pEList->nExpr; k++){
++    Expr *pE = pEList->a[k].pExpr;
++    if( pE->op==TK_ALL ) break;
++    if( pE->op==TK_DOT && pE->pRight && pE->pRight->op==TK_ALL
++         && pE->pLeft && pE->pLeft->op==TK_ID ) break;
++  }
++  rc = 0;
++  if( k<pEList->nExpr ){
++    /*
++    ** If we get here it means the result set contains one or more "*"
++    ** operators that need to be expanded.  Loop through each expression
++    ** in the result set and expand them one by one.
++    */
++    struct ExprList_item *a = pEList->a;
++    ExprList *pNew = 0;
++    for(k=0; k<pEList->nExpr; k++){
++      Expr *pE = a[k].pExpr;
++      if( pE->op!=TK_ALL &&
++           (pE->op!=TK_DOT || pE->pRight==0 || pE->pRight->op!=TK_ALL) ){
++        /* This particular expression does not need to be expanded.
++        */
++        pNew = sqliteExprListAppend(pNew, a[k].pExpr, 0);
++        pNew->a[pNew->nExpr-1].zName = a[k].zName;
++        a[k].pExpr = 0;
++        a[k].zName = 0;
++      }else{
++        /* This expression is a "*" or a "TABLE.*" and needs to be
++        ** expanded. */
++        int tableSeen = 0;      /* Set to 1 when TABLE matches */
++        char *zTName;           /* text of name of TABLE */
++        if( pE->op==TK_DOT && pE->pLeft ){
++          zTName = sqliteTableNameFromToken(&pE->pLeft->token);
++        }else{
++          zTName = 0;
++        }
++        for(i=0; i<pTabList->nSrc; i++){
++          Table *pTab = pTabList->a[i].pTab;
++          char *zTabName = pTabList->a[i].zAlias;
++          if( zTabName==0 || zTabName[0]==0 ){ 
++            zTabName = pTab->zName;
++          }
++          if( zTName && (zTabName==0 || zTabName[0]==0 || 
++                 sqliteStrICmp(zTName, zTabName)!=0) ){
++            continue;
++          }
++          tableSeen = 1;
++          for(j=0; j<pTab->nCol; j++){
++            Expr *pExpr, *pLeft, *pRight;
++            char *zName = pTab->aCol[j].zName;
++
++            if( i>0 && (pTabList->a[i-1].jointype & JT_NATURAL)!=0 &&
++                columnIndex(pTabList->a[i-1].pTab, zName)>=0 ){
++              /* In a NATURAL join, omit the join columns from the 
++              ** table on the right */
++              continue;
++            }
++            if( i>0 && sqliteIdListIndex(pTabList->a[i-1].pUsing, zName)>=0 ){
++              /* In a join with a USING clause, omit columns in the
++              ** using clause from the table on the right. */
++              continue;
++            }
++            pRight = sqliteExpr(TK_ID, 0, 0, 0);
++            if( pRight==0 ) break;
++            pRight->token.z = zName;
++            pRight->token.n = strlen(zName);
++            pRight->token.dyn = 0;
++            if( zTabName && pTabList->nSrc>1 ){
++              pLeft = sqliteExpr(TK_ID, 0, 0, 0);
++              pExpr = sqliteExpr(TK_DOT, pLeft, pRight, 0);
++              if( pExpr==0 ) break;
++              pLeft->token.z = zTabName;
++              pLeft->token.n = strlen(zTabName);
++              pLeft->token.dyn = 0;
++              sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, 0);
++              pExpr->span.n = strlen(pExpr->span.z);
++              pExpr->span.dyn = 1;
++              pExpr->token.z = 0;
++              pExpr->token.n = 0;
++              pExpr->token.dyn = 0;
++            }else{
++              pExpr = pRight;
++              pExpr->span = pExpr->token;
++            }
++            pNew = sqliteExprListAppend(pNew, pExpr, 0);
++          }
++        }
++        if( !tableSeen ){
++          if( zTName ){
++            sqliteErrorMsg(pParse, "no such table: %s", zTName);
++          }else{
++            sqliteErrorMsg(pParse, "no tables specified");
++          }
++          rc = 1;
++        }
++        sqliteFree(zTName);
++      }
++    }
++    sqliteExprListDelete(pEList);
++    p->pEList = pNew;
++  }
++  return rc;
++}
++
++/*
++** This routine recursively unlinks the Select.pSrc.a[].pTab pointers
++** in a select structure.  It just sets the pointers to NULL.  This
++** routine is recursive in the sense that if the Select.pSrc.a[].pSelect
++** pointer is not NULL, this routine is called recursively on that pointer.
++**
++** This routine is called on the Select structure that defines a
++** VIEW in order to undo any bindings to tables.  This is necessary
++** because those tables might be DROPed by a subsequent SQL command.
++** If the bindings are not removed, then the Select.pSrc->a[].pTab field
++** will be left pointing to a deallocated Table structure after the
++** DROP and a coredump will occur the next time the VIEW is used.
++*/
++void sqliteSelectUnbind(Select *p){
++  int i;
++  SrcList *pSrc = p->pSrc;
++  Table *pTab;
++  if( p==0 ) return;
++  for(i=0; i<pSrc->nSrc; i++){
++    if( (pTab = pSrc->a[i].pTab)!=0 ){
++      if( pTab->isTransient ){
++        sqliteDeleteTable(0, pTab);
++      }
++      pSrc->a[i].pTab = 0;
++      if( pSrc->a[i].pSelect ){
++        sqliteSelectUnbind(pSrc->a[i].pSelect);
++      }
++    }
++  }
++}
++
++/*
++** This routine associates entries in an ORDER BY expression list with
++** columns in a result.  For each ORDER BY expression, the opcode of
++** the top-level node is changed to TK_COLUMN and the iColumn value of
++** the top-level node is filled in with column number and the iTable
++** value of the top-level node is filled with iTable parameter.
++**
++** If there are prior SELECT clauses, they are processed first.  A match
++** in an earlier SELECT takes precedence over a later SELECT.
++**
++** Any entry that does not match is flagged as an error.  The number
++** of errors is returned.
++**
++** This routine does NOT correctly initialize the Expr.dataType  field
++** of the ORDER BY expressions.  The multiSelectSortOrder() routine
++** must be called to do that after the individual select statements
++** have all been analyzed.  This routine is unable to compute Expr.dataType
++** because it must be called before the individual select statements
++** have been analyzed.
++*/
++static int matchOrderbyToColumn(
++  Parse *pParse,          /* A place to leave error messages */
++  Select *pSelect,        /* Match to result columns of this SELECT */
++  ExprList *pOrderBy,     /* The ORDER BY values to match against columns */
++  int iTable,             /* Insert this value in iTable */
++  int mustComplete        /* If TRUE all ORDER BYs must match */
++){
++  int nErr = 0;
++  int i, j;
++  ExprList *pEList;
++
++  if( pSelect==0 || pOrderBy==0 ) return 1;
++  if( mustComplete ){
++    for(i=0; i<pOrderBy->nExpr; i++){ pOrderBy->a[i].done = 0; }
++  }
++  if( fillInColumnList(pParse, pSelect) ){
++    return 1;
++  }
++  if( pSelect->pPrior ){
++    if( matchOrderbyToColumn(pParse, pSelect->pPrior, pOrderBy, iTable, 0) ){
++      return 1;
++    }
++  }
++  pEList = pSelect->pEList;
++  for(i=0; i<pOrderBy->nExpr; i++){
++    Expr *pE = pOrderBy->a[i].pExpr;
++    int iCol = -1;
++    if( pOrderBy->a[i].done ) continue;
++    if( sqliteExprIsInteger(pE, &iCol) ){
++      if( iCol<=0 || iCol>pEList->nExpr ){
++        sqliteErrorMsg(pParse,
++          "ORDER BY position %d should be between 1 and %d",
++          iCol, pEList->nExpr);
++        nErr++;
++        break;
++      }
++      if( !mustComplete ) continue;
++      iCol--;
++    }
++    for(j=0; iCol<0 && j<pEList->nExpr; j++){
++      if( pEList->a[j].zName && (pE->op==TK_ID || pE->op==TK_STRING) ){
++        char *zName, *zLabel;
++        zName = pEList->a[j].zName;
++        assert( pE->token.z );
++        zLabel = sqliteStrNDup(pE->token.z, pE->token.n);
++        sqliteDequote(zLabel);
++        if( sqliteStrICmp(zName, zLabel)==0 ){ 
++          iCol = j;
++        }
++        sqliteFree(zLabel);
++      }
++      if( iCol<0 && sqliteExprCompare(pE, pEList->a[j].pExpr) ){
++        iCol = j;
++      }
++    }
++    if( iCol>=0 ){
++      pE->op = TK_COLUMN;
++      pE->iColumn = iCol;
++      pE->iTable = iTable;
++      pOrderBy->a[i].done = 1;
++    }
++    if( iCol<0 && mustComplete ){
++      sqliteErrorMsg(pParse,
++        "ORDER BY term number %d does not match any result column", i+1);
++      nErr++;
++      break;
++    }
++  }
++  return nErr;  
++}
++
++/*
++** Get a VDBE for the given parser context.  Create a new one if necessary.
++** If an error occurs, return NULL and leave a message in pParse.
++*/
++Vdbe *sqliteGetVdbe(Parse *pParse){
++  Vdbe *v = pParse->pVdbe;
++  if( v==0 ){
++    v = pParse->pVdbe = sqliteVdbeCreate(pParse->db);
++  }
++  return v;
++}
++
++/*
++** This routine sets the Expr.dataType field on all elements of
++** the pOrderBy expression list.  The pOrderBy list will have been
++** set up by matchOrderbyToColumn().  Hence each expression has
++** a TK_COLUMN as its root node.  The Expr.iColumn refers to a 
++** column in the result set.   The datatype is set to SQLITE_SO_TEXT
++** if the corresponding column in p and every SELECT to the left of
++** p has a datatype of SQLITE_SO_TEXT.  If the cooressponding column
++** in p or any of the left SELECTs is SQLITE_SO_NUM, then the datatype
++** of the order-by expression is set to SQLITE_SO_NUM.
++**
++** Examples:
++**
++**     CREATE TABLE one(a INTEGER, b TEXT);
++**     CREATE TABLE two(c VARCHAR(5), d FLOAT);
++**
++**     SELECT b, b FROM one UNION SELECT d, c FROM two ORDER BY 1, 2;
++**
++** The primary sort key will use SQLITE_SO_NUM because the "d" in
++** the second SELECT is numeric.  The 1st column of the first SELECT
++** is text but that does not matter because a numeric always overrides
++** a text.
++**
++** The secondary key will use the SQLITE_SO_TEXT sort order because
++** both the (second) "b" in the first SELECT and the "c" in the second
++** SELECT have a datatype of text.
++*/ 
++static void multiSelectSortOrder(Select *p, ExprList *pOrderBy){
++  int i;
++  ExprList *pEList;
++  if( pOrderBy==0 ) return;
++  if( p==0 ){
++    for(i=0; i<pOrderBy->nExpr; i++){
++      pOrderBy->a[i].pExpr->dataType = SQLITE_SO_TEXT;
++    }
++    return;
++  }
++  multiSelectSortOrder(p->pPrior, pOrderBy);
++  pEList = p->pEList;
++  for(i=0; i<pOrderBy->nExpr; i++){
++    Expr *pE = pOrderBy->a[i].pExpr;
++    if( pE->dataType==SQLITE_SO_NUM ) continue;
++    assert( pE->iColumn>=0 );
++    if( pEList->nExpr>pE->iColumn ){
++      pE->dataType = sqliteExprType(pEList->a[pE->iColumn].pExpr);
++    }
++  }
++}
++
++/*
++** Compute the iLimit and iOffset fields of the SELECT based on the
++** nLimit and nOffset fields.  nLimit and nOffset hold the integers
++** that appear in the original SQL statement after the LIMIT and OFFSET
++** keywords.  Or that hold -1 and 0 if those keywords are omitted.
++** iLimit and iOffset are the integer memory register numbers for
++** counters used to compute the limit and offset.  If there is no
++** limit and/or offset, then iLimit and iOffset are negative.
++**
++** This routine changes the values if iLimit and iOffset only if
++** a limit or offset is defined by nLimit and nOffset.  iLimit and
++** iOffset should have been preset to appropriate default values
++** (usually but not always -1) prior to calling this routine.
++** Only if nLimit>=0 or nOffset>0 do the limit registers get
++** redefined.  The UNION ALL operator uses this property to force
++** the reuse of the same limit and offset registers across multiple
++** SELECT statements.
++*/
++static void computeLimitRegisters(Parse *pParse, Select *p){
++  /* 
++  ** If the comparison is p->nLimit>0 then "LIMIT 0" shows
++  ** all rows.  It is the same as no limit. If the comparision is
++  ** p->nLimit>=0 then "LIMIT 0" show no rows at all.
++  ** "LIMIT -1" always shows all rows.  There is some
++  ** contraversy about what the correct behavior should be.
++  ** The current implementation interprets "LIMIT 0" to mean
++  ** no rows.
++  */
++  if( p->nLimit>=0 ){
++    int iMem = pParse->nMem++;
++    Vdbe *v = sqliteGetVdbe(pParse);
++    if( v==0 ) return;
++    sqliteVdbeAddOp(v, OP_Integer, -p->nLimit, 0);
++    sqliteVdbeAddOp(v, OP_MemStore, iMem, 1);
++    p->iLimit = iMem;
++  }
++  if( p->nOffset>0 ){
++    int iMem = pParse->nMem++;
++    Vdbe *v = sqliteGetVdbe(pParse);
++    if( v==0 ) return;
++    sqliteVdbeAddOp(v, OP_Integer, -p->nOffset, 0);
++    sqliteVdbeAddOp(v, OP_MemStore, iMem, 1);
++    p->iOffset = iMem;
++  }
++}
++
++/*
++** This routine is called to process a query that is really the union
++** or intersection of two or more separate queries.
++**
++** "p" points to the right-most of the two queries.  the query on the
++** left is p->pPrior.  The left query could also be a compound query
++** in which case this routine will be called recursively. 
++**
++** The results of the total query are to be written into a destination
++** of type eDest with parameter iParm.
++**
++** Example 1:  Consider a three-way compound SQL statement.
++**
++**     SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3
++**
++** This statement is parsed up as follows:
++**
++**     SELECT c FROM t3
++**      |
++**      `----->  SELECT b FROM t2
++**                |
++**                `------>  SELECT a FROM t1
++**
++** The arrows in the diagram above represent the Select.pPrior pointer.
++** So if this routine is called with p equal to the t3 query, then
++** pPrior will be the t2 query.  p->op will be TK_UNION in this case.
++**
++** Notice that because of the way SQLite parses compound SELECTs, the
++** individual selects always group from left to right.
++*/
++static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
++  int rc;             /* Success code from a subroutine */
++  Select *pPrior;     /* Another SELECT immediately to our left */
++  Vdbe *v;            /* Generate code to this VDBE */
++
++  /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only
++  ** the last SELECT in the series may have an ORDER BY or LIMIT.
++  */
++  if( p==0 || p->pPrior==0 ) return 1;
++  pPrior = p->pPrior;
++  if( pPrior->pOrderBy ){
++    sqliteErrorMsg(pParse,"ORDER BY clause should come after %s not before",
++      selectOpName(p->op));
++    return 1;
++  }
++  if( pPrior->nLimit>=0 || pPrior->nOffset>0 ){
++    sqliteErrorMsg(pParse,"LIMIT clause should come after %s not before",
++      selectOpName(p->op));
++    return 1;
++  }
++
++  /* Make sure we have a valid query engine.  If not, create a new one.
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) return 1;
++
++  /* Create the destination temporary table if necessary
++  */
++  if( eDest==SRT_TempTable ){
++    sqliteVdbeAddOp(v, OP_OpenTemp, iParm, 0);
++    eDest = SRT_Table;
++  }
++
++  /* Generate code for the left and right SELECT statements.
++  */
++  switch( p->op ){
++    case TK_ALL: {
++      if( p->pOrderBy==0 ){
++        pPrior->nLimit = p->nLimit;
++        pPrior->nOffset = p->nOffset;
++        rc = sqliteSelect(pParse, pPrior, eDest, iParm, 0, 0, 0);
++        if( rc ) return rc;
++        p->pPrior = 0;
++        p->iLimit = pPrior->iLimit;
++        p->iOffset = pPrior->iOffset;
++        p->nLimit = -1;
++        p->nOffset = 0;
++        rc = sqliteSelect(pParse, p, eDest, iParm, 0, 0, 0);
++        p->pPrior = pPrior;
++        if( rc ) return rc;
++        break;
++      }
++      /* For UNION ALL ... ORDER BY fall through to the next case */
++    }
++    case TK_EXCEPT:
++    case TK_UNION: {
++      int unionTab;    /* Cursor number of the temporary table holding result */
++      int op;          /* One of the SRT_ operations to apply to self */
++      int priorOp;     /* The SRT_ operation to apply to prior selects */
++      int nLimit, nOffset; /* Saved values of p->nLimit and p->nOffset */
++      ExprList *pOrderBy;  /* The ORDER BY clause for the right SELECT */
++
++      priorOp = p->op==TK_ALL ? SRT_Table : SRT_Union;
++      if( eDest==priorOp && p->pOrderBy==0 && p->nLimit<0 && p->nOffset==0 ){
++        /* We can reuse a temporary table generated by a SELECT to our
++        ** right.
++        */
++        unionTab = iParm;
++      }else{
++        /* We will need to create our own temporary table to hold the
++        ** intermediate results.
++        */
++        unionTab = pParse->nTab++;
++        if( p->pOrderBy 
++        && matchOrderbyToColumn(pParse, p, p->pOrderBy, unionTab, 1) ){
++          return 1;
++        }
++        if( p->op!=TK_ALL ){
++          sqliteVdbeAddOp(v, OP_OpenTemp, unionTab, 1);
++          sqliteVdbeAddOp(v, OP_KeyAsData, unionTab, 1);
++        }else{
++          sqliteVdbeAddOp(v, OP_OpenTemp, unionTab, 0);
++        }
++      }
++
++      /* Code the SELECT statements to our left
++      */
++      rc = sqliteSelect(pParse, pPrior, priorOp, unionTab, 0, 0, 0);
++      if( rc ) return rc;
++
++      /* Code the current SELECT statement
++      */
++      switch( p->op ){
++         case TK_EXCEPT:  op = SRT_Except;   break;
++         case TK_UNION:   op = SRT_Union;    break;
++         case TK_ALL:     op = SRT_Table;    break;
++      }
++      p->pPrior = 0;
++      pOrderBy = p->pOrderBy;
++      p->pOrderBy = 0;
++      nLimit = p->nLimit;
++      p->nLimit = -1;
++      nOffset = p->nOffset;
++      p->nOffset = 0;
++      rc = sqliteSelect(pParse, p, op, unionTab, 0, 0, 0);
++      p->pPrior = pPrior;
++      p->pOrderBy = pOrderBy;
++      p->nLimit = nLimit;
++      p->nOffset = nOffset;
++      if( rc ) return rc;
++
++      /* Convert the data in the temporary table into whatever form
++      ** it is that we currently need.
++      */      
++      if( eDest!=priorOp || unionTab!=iParm ){
++        int iCont, iBreak, iStart;
++        assert( p->pEList );
++        if( eDest==SRT_Callback ){
++          generateColumnNames(pParse, 0, p->pEList);
++          generateColumnTypes(pParse, p->pSrc, p->pEList);
++        }
++        iBreak = sqliteVdbeMakeLabel(v);
++        iCont = sqliteVdbeMakeLabel(v);
++        sqliteVdbeAddOp(v, OP_Rewind, unionTab, iBreak);
++        computeLimitRegisters(pParse, p);
++        iStart = sqliteVdbeCurrentAddr(v);
++        multiSelectSortOrder(p, p->pOrderBy);
++        rc = selectInnerLoop(pParse, p, p->pEList, unionTab, p->pEList->nExpr,
++                             p->pOrderBy, -1, eDest, iParm, 
++                             iCont, iBreak);
++        if( rc ) return 1;
++        sqliteVdbeResolveLabel(v, iCont);
++        sqliteVdbeAddOp(v, OP_Next, unionTab, iStart);
++        sqliteVdbeResolveLabel(v, iBreak);
++        sqliteVdbeAddOp(v, OP_Close, unionTab, 0);
++        if( p->pOrderBy ){
++          generateSortTail(p, v, p->pEList->nExpr, eDest, iParm);
++        }
++      }
++      break;
++    }
++    case TK_INTERSECT: {
++      int tab1, tab2;
++      int iCont, iBreak, iStart;
++      int nLimit, nOffset;
++
++      /* INTERSECT is different from the others since it requires
++      ** two temporary tables.  Hence it has its own case.  Begin
++      ** by allocating the tables we will need.
++      */
++      tab1 = pParse->nTab++;
++      tab2 = pParse->nTab++;
++      if( p->pOrderBy && matchOrderbyToColumn(pParse,p,p->pOrderBy,tab1,1) ){
++        return 1;
++      }
++      sqliteVdbeAddOp(v, OP_OpenTemp, tab1, 1);
++      sqliteVdbeAddOp(v, OP_KeyAsData, tab1, 1);
++
++      /* Code the SELECTs to our left into temporary table "tab1".
++      */
++      rc = sqliteSelect(pParse, pPrior, SRT_Union, tab1, 0, 0, 0);
++      if( rc ) return rc;
++
++      /* Code the current SELECT into temporary table "tab2"
++      */
++      sqliteVdbeAddOp(v, OP_OpenTemp, tab2, 1);
++      sqliteVdbeAddOp(v, OP_KeyAsData, tab2, 1);
++      p->pPrior = 0;
++      nLimit = p->nLimit;
++      p->nLimit = -1;
++      nOffset = p->nOffset;
++      p->nOffset = 0;
++      rc = sqliteSelect(pParse, p, SRT_Union, tab2, 0, 0, 0);
++      p->pPrior = pPrior;
++      p->nLimit = nLimit;
++      p->nOffset = nOffset;
++      if( rc ) return rc;
++
++      /* Generate code to take the intersection of the two temporary
++      ** tables.
++      */
++      assert( p->pEList );
++      if( eDest==SRT_Callback ){
++        generateColumnNames(pParse, 0, p->pEList);
++        generateColumnTypes(pParse, p->pSrc, p->pEList);
++      }
++      iBreak = sqliteVdbeMakeLabel(v);
++      iCont = sqliteVdbeMakeLabel(v);
++      sqliteVdbeAddOp(v, OP_Rewind, tab1, iBreak);
++      computeLimitRegisters(pParse, p);
++      iStart = sqliteVdbeAddOp(v, OP_FullKey, tab1, 0);
++      sqliteVdbeAddOp(v, OP_NotFound, tab2, iCont);
++      multiSelectSortOrder(p, p->pOrderBy);
++      rc = selectInnerLoop(pParse, p, p->pEList, tab1, p->pEList->nExpr,
++                             p->pOrderBy, -1, eDest, iParm, 
++                             iCont, iBreak);
++      if( rc ) return 1;
++      sqliteVdbeResolveLabel(v, iCont);
++      sqliteVdbeAddOp(v, OP_Next, tab1, iStart);
++      sqliteVdbeResolveLabel(v, iBreak);
++      sqliteVdbeAddOp(v, OP_Close, tab2, 0);
++      sqliteVdbeAddOp(v, OP_Close, tab1, 0);
++      if( p->pOrderBy ){
++        generateSortTail(p, v, p->pEList->nExpr, eDest, iParm);
++      }
++      break;
++    }
++  }
++  assert( p->pEList && pPrior->pEList );
++  if( p->pEList->nExpr!=pPrior->pEList->nExpr ){
++    sqliteErrorMsg(pParse, "SELECTs to the left and right of %s"
++      " do not have the same number of result columns", selectOpName(p->op));
++    return 1;
++  }
++  return 0;
++}
++
++/*
++** Scan through the expression pExpr.  Replace every reference to
++** a column in table number iTable with a copy of the iColumn-th
++** entry in pEList.  (But leave references to the ROWID column 
++** unchanged.)
++**
++** This routine is part of the flattening procedure.  A subquery
++** whose result set is defined by pEList appears as entry in the
++** FROM clause of a SELECT such that the VDBE cursor assigned to that
++** FORM clause entry is iTable.  This routine make the necessary 
++** changes to pExpr so that it refers directly to the source table
++** of the subquery rather the result set of the subquery.
++*/
++static void substExprList(ExprList*,int,ExprList*);  /* Forward Decl */
++static void substExpr(Expr *pExpr, int iTable, ExprList *pEList){
++  if( pExpr==0 ) return;
++  if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){
++    if( pExpr->iColumn<0 ){
++      pExpr->op = TK_NULL;
++    }else{
++      Expr *pNew;
++      assert( pEList!=0 && pExpr->iColumn<pEList->nExpr );
++      assert( pExpr->pLeft==0 && pExpr->pRight==0 && pExpr->pList==0 );
++      pNew = pEList->a[pExpr->iColumn].pExpr;
++      assert( pNew!=0 );
++      pExpr->op = pNew->op;
++      pExpr->dataType = pNew->dataType;
++      assert( pExpr->pLeft==0 );
++      pExpr->pLeft = sqliteExprDup(pNew->pLeft);
++      assert( pExpr->pRight==0 );
++      pExpr->pRight = sqliteExprDup(pNew->pRight);
++      assert( pExpr->pList==0 );
++      pExpr->pList = sqliteExprListDup(pNew->pList);
++      pExpr->iTable = pNew->iTable;
++      pExpr->iColumn = pNew->iColumn;
++      pExpr->iAgg = pNew->iAgg;
++      sqliteTokenCopy(&pExpr->token, &pNew->token);
++      sqliteTokenCopy(&pExpr->span, &pNew->span);
++    }
++  }else{
++    substExpr(pExpr->pLeft, iTable, pEList);
++    substExpr(pExpr->pRight, iTable, pEList);
++    substExprList(pExpr->pList, iTable, pEList);
++  }
++}
++static void 
++substExprList(ExprList *pList, int iTable, ExprList *pEList){
++  int i;
++  if( pList==0 ) return;
++  for(i=0; i<pList->nExpr; i++){
++    substExpr(pList->a[i].pExpr, iTable, pEList);
++  }
++}
++
++/*
++** This routine attempts to flatten subqueries in order to speed
++** execution.  It returns 1 if it makes changes and 0 if no flattening
++** occurs.
++**
++** To understand the concept of flattening, consider the following
++** query:
++**
++**     SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5
++**
++** The default way of implementing this query is to execute the
++** subquery first and store the results in a temporary table, then
++** run the outer query on that temporary table.  This requires two
++** passes over the data.  Furthermore, because the temporary table
++** has no indices, the WHERE clause on the outer query cannot be
++** optimized.
++**
++** This routine attempts to rewrite queries such as the above into
++** a single flat select, like this:
++**
++**     SELECT x+y AS a FROM t1 WHERE z<100 AND a>5
++**
++** The code generated for this simpification gives the same result
++** but only has to scan the data once.  And because indices might 
++** exist on the table t1, a complete scan of the data might be
++** avoided.
++**
++** Flattening is only attempted if all of the following are true:
++**
++**   (1)  The subquery and the outer query do not both use aggregates.
++**
++**   (2)  The subquery is not an aggregate or the outer query is not a join.
++**
++**   (3)  The subquery is not the right operand of a left outer join, or
++**        the subquery is not itself a join.  (Ticket #306)
++**
++**   (4)  The subquery is not DISTINCT or the outer query is not a join.
++**
++**   (5)  The subquery is not DISTINCT or the outer query does not use
++**        aggregates.
++**
++**   (6)  The subquery does not use aggregates or the outer query is not
++**        DISTINCT.
++**
++**   (7)  The subquery has a FROM clause.
++**
++**   (8)  The subquery does not use LIMIT or the outer query is not a join.
++**
++**   (9)  The subquery does not use LIMIT or the outer query does not use
++**        aggregates.
++**
++**  (10)  The subquery does not use aggregates or the outer query does not
++**        use LIMIT.
++**
++**  (11)  The subquery and the outer query do not both have ORDER BY clauses.
++**
++**  (12)  The subquery is not the right term of a LEFT OUTER JOIN or the
++**        subquery has no WHERE clause.  (added by ticket #350)
++**
++** In this routine, the "p" parameter is a pointer to the outer query.
++** The subquery is p->pSrc->a[iFrom].  isAgg is true if the outer query
++** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates.
++**
++** If flattening is not attempted, this routine is a no-op and returns 0.
++** If flattening is attempted this routine returns 1.
++**
++** All of the expression analysis must occur on both the outer query and
++** the subquery before this routine runs.
++*/
++static int flattenSubquery(
++  Parse *pParse,       /* The parsing context */
++  Select *p,           /* The parent or outer SELECT statement */
++  int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */
++  int isAgg,           /* True if outer SELECT uses aggregate functions */
++  int subqueryIsAgg    /* True if the subquery uses aggregate functions */
++){
++  Select *pSub;       /* The inner query or "subquery" */
++  SrcList *pSrc;      /* The FROM clause of the outer query */
++  SrcList *pSubSrc;   /* The FROM clause of the subquery */
++  ExprList *pList;    /* The result set of the outer query */
++  int iParent;        /* VDBE cursor number of the pSub result set temp table */
++  int i;
++  Expr *pWhere;
++
++  /* Check to see if flattening is permitted.  Return 0 if not.
++  */
++  if( p==0 ) return 0;
++  pSrc = p->pSrc;
++  assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
++  pSub = pSrc->a[iFrom].pSelect;
++  assert( pSub!=0 );
++  if( isAgg && subqueryIsAgg ) return 0;
++  if( subqueryIsAgg && pSrc->nSrc>1 ) return 0;
++  pSubSrc = pSub->pSrc;
++  assert( pSubSrc );
++  if( pSubSrc->nSrc==0 ) return 0;
++  if( (pSub->isDistinct || pSub->nLimit>=0) &&  (pSrc->nSrc>1 || isAgg) ){
++     return 0;
++  }
++  if( (p->isDistinct || p->nLimit>=0) && subqueryIsAgg ) return 0;
++  if( p->pOrderBy && pSub->pOrderBy ) return 0;
++
++  /* Restriction 3:  If the subquery is a join, make sure the subquery is 
++  ** not used as the right operand of an outer join.  Examples of why this
++  ** is not allowed:
++  **
++  **         t1 LEFT OUTER JOIN (t2 JOIN t3)
++  **
++  ** If we flatten the above, we would get
++  **
++  **         (t1 LEFT OUTER JOIN t2) JOIN t3
++  **
++  ** which is not at all the same thing.
++  */
++  if( pSubSrc->nSrc>1 && iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 ){
++    return 0;
++  }
++
++  /* Restriction 12:  If the subquery is the right operand of a left outer
++  ** join, make sure the subquery has no WHERE clause.
++  ** An examples of why this is not allowed:
++  **
++  **         t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)
++  **
++  ** If we flatten the above, we would get
++  **
++  **         (t1 LEFT OUTER JOIN t2) WHERE t2.x>0
++  **
++  ** But the t2.x>0 test will always fail on a NULL row of t2, which
++  ** effectively converts the OUTER JOIN into an INNER JOIN.
++  */
++  if( iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 
++      && pSub->pWhere!=0 ){
++    return 0;
++  }
++
++  /* If we reach this point, it means flattening is permitted for the
++  ** iFrom-th entry of the FROM clause in the outer query.
++  */
++
++  /* Move all of the FROM elements of the subquery into the
++  ** the FROM clause of the outer query.  Before doing this, remember
++  ** the cursor number for the original outer query FROM element in
++  ** iParent.  The iParent cursor will never be used.  Subsequent code
++  ** will scan expressions looking for iParent references and replace
++  ** those references with expressions that resolve to the subquery FROM
++  ** elements we are now copying in.
++  */
++  iParent = pSrc->a[iFrom].iCursor;
++  {
++    int nSubSrc = pSubSrc->nSrc;
++    int jointype = pSrc->a[iFrom].jointype;
++
++    if( pSrc->a[iFrom].pTab && pSrc->a[iFrom].pTab->isTransient ){
++      sqliteDeleteTable(0, pSrc->a[iFrom].pTab);
++    }
++    sqliteFree(pSrc->a[iFrom].zDatabase);
++    sqliteFree(pSrc->a[iFrom].zName);
++    sqliteFree(pSrc->a[iFrom].zAlias);
++    if( nSubSrc>1 ){
++      int extra = nSubSrc - 1;
++      for(i=1; i<nSubSrc; i++){
++        pSrc = sqliteSrcListAppend(pSrc, 0, 0);
++      }
++      p->pSrc = pSrc;
++      for(i=pSrc->nSrc-1; i-extra>=iFrom; i--){
++        pSrc->a[i] = pSrc->a[i-extra];
++      }
++    }
++    for(i=0; i<nSubSrc; i++){
++      pSrc->a[i+iFrom] = pSubSrc->a[i];
++      memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
++    }
++    pSrc->a[iFrom+nSubSrc-1].jointype = jointype;
++  }
++
++  /* Now begin substituting subquery result set expressions for 
++  ** references to the iParent in the outer query.
++  ** 
++  ** Example:
++  **
++  **   SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;
++  **   \                     \_____________ subquery __________/          /
++  **    \_____________________ outer query ______________________________/
++  **
++  ** We look at every expression in the outer query and every place we see
++  ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
++  */
++  substExprList(p->pEList, iParent, pSub->pEList);
++  pList = p->pEList;
++  for(i=0; i<pList->nExpr; i++){
++    Expr *pExpr;
++    if( pList->a[i].zName==0 && (pExpr = pList->a[i].pExpr)->span.z!=0 ){
++      pList->a[i].zName = sqliteStrNDup(pExpr->span.z, pExpr->span.n);
++    }
++  }
++  if( isAgg ){
++    substExprList(p->pGroupBy, iParent, pSub->pEList);
++    substExpr(p->pHaving, iParent, pSub->pEList);
++  }
++  if( pSub->pOrderBy ){
++    assert( p->pOrderBy==0 );
++    p->pOrderBy = pSub->pOrderBy;
++    pSub->pOrderBy = 0;
++  }else if( p->pOrderBy ){
++    substExprList(p->pOrderBy, iParent, pSub->pEList);
++  }
++  if( pSub->pWhere ){
++    pWhere = sqliteExprDup(pSub->pWhere);
++  }else{
++    pWhere = 0;
++  }
++  if( subqueryIsAgg ){
++    assert( p->pHaving==0 );
++    p->pHaving = p->pWhere;
++    p->pWhere = pWhere;
++    substExpr(p->pHaving, iParent, pSub->pEList);
++    if( pSub->pHaving ){
++      Expr *pHaving = sqliteExprDup(pSub->pHaving);
++      if( p->pHaving ){
++        p->pHaving = sqliteExpr(TK_AND, p->pHaving, pHaving, 0);
++      }else{
++        p->pHaving = pHaving;
++      }
++    }
++    assert( p->pGroupBy==0 );
++    p->pGroupBy = sqliteExprListDup(pSub->pGroupBy);
++  }else if( p->pWhere==0 ){
++    p->pWhere = pWhere;
++  }else{
++    substExpr(p->pWhere, iParent, pSub->pEList);
++    if( pWhere ){
++      p->pWhere = sqliteExpr(TK_AND, p->pWhere, pWhere, 0);
++    }
++  }
++
++  /* The flattened query is distinct if either the inner or the
++  ** outer query is distinct. 
++  */
++  p->isDistinct = p->isDistinct || pSub->isDistinct;
++
++  /* Transfer the limit expression from the subquery to the outer
++  ** query.
++  */
++  if( pSub->nLimit>=0 ){
++    if( p->nLimit<0 ){
++      p->nLimit = pSub->nLimit;
++    }else if( p->nLimit+p->nOffset > pSub->nLimit+pSub->nOffset ){
++      p->nLimit = pSub->nLimit + pSub->nOffset - p->nOffset;
++    }
++  }
++  p->nOffset += pSub->nOffset;
++
++  /* Finially, delete what is left of the subquery and return
++  ** success.
++  */
++  sqliteSelectDelete(pSub);
++  return 1;
++}
++
++/*
++** Analyze the SELECT statement passed in as an argument to see if it
++** is a simple min() or max() query.  If it is and this query can be
++** satisfied using a single seek to the beginning or end of an index,
++** then generate the code for this SELECT and return 1.  If this is not a 
++** simple min() or max() query, then return 0;
++**
++** A simply min() or max() query looks like this:
++**
++**    SELECT min(a) FROM table;
++**    SELECT max(a) FROM table;
++**
++** The query may have only a single table in its FROM argument.  There
++** can be no GROUP BY or HAVING or WHERE clauses.  The result set must
++** be the min() or max() of a single column of the table.  The column
++** in the min() or max() function must be indexed.
++**
++** The parameters to this routine are the same as for sqliteSelect().
++** See the header comment on that routine for additional information.
++*/
++static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
++  Expr *pExpr;
++  int iCol;
++  Table *pTab;
++  Index *pIdx;
++  int base;
++  Vdbe *v;
++  int seekOp;
++  int cont;
++  ExprList *pEList, *pList, eList;
++  struct ExprList_item eListItem;
++  SrcList *pSrc;
++  
++
++  /* Check to see if this query is a simple min() or max() query.  Return
++  ** zero if it is  not.
++  */
++  if( p->pGroupBy || p->pHaving || p->pWhere ) return 0;
++  pSrc = p->pSrc;
++  if( pSrc->nSrc!=1 ) return 0;
++  pEList = p->pEList;
++  if( pEList->nExpr!=1 ) return 0;
++  pExpr = pEList->a[0].pExpr;
++  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
++  pList = pExpr->pList;
++  if( pList==0 || pList->nExpr!=1 ) return 0;
++  if( pExpr->token.n!=3 ) return 0;
++  if( sqliteStrNICmp(pExpr->token.z,"min",3)==0 ){
++    seekOp = OP_Rewind;
++  }else if( sqliteStrNICmp(pExpr->token.z,"max",3)==0 ){
++    seekOp = OP_Last;
++  }else{
++    return 0;
++  }
++  pExpr = pList->a[0].pExpr;
++  if( pExpr->op!=TK_COLUMN ) return 0;
++  iCol = pExpr->iColumn;
++  pTab = pSrc->a[0].pTab;
++
++  /* If we get to here, it means the query is of the correct form.
++  ** Check to make sure we have an index and make pIdx point to the
++  ** appropriate index.  If the min() or max() is on an INTEGER PRIMARY
++  ** key column, no index is necessary so set pIdx to NULL.  If no
++  ** usable index is found, return 0.
++  */
++  if( iCol<0 ){
++    pIdx = 0;
++  }else{
++    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
++      assert( pIdx->nColumn>=1 );
++      if( pIdx->aiColumn[0]==iCol ) break;
++    }
++    if( pIdx==0 ) return 0;
++  }
++
++  /* Identify column types if we will be using the callback.  This
++  ** step is skipped if the output is going to a table or a memory cell.
++  ** The column names have already been generated in the calling function.
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) return 0;
++  if( eDest==SRT_Callback ){
++    generateColumnTypes(pParse, p->pSrc, p->pEList);
++  }
++
++  /* If the output is destined for a temporary table, open that table.
++  */
++  if( eDest==SRT_TempTable ){
++    sqliteVdbeAddOp(v, OP_OpenTemp, iParm, 0);
++  }
++
++  /* Generating code to find the min or the max.  Basically all we have
++  ** to do is find the first or the last entry in the chosen index.  If
++  ** the min() or max() is on the INTEGER PRIMARY KEY, then find the first
++  ** or last entry in the main table.
++  */
++  sqliteCodeVerifySchema(pParse, pTab->iDb);
++  base = pSrc->a[0].iCursor;
++  computeLimitRegisters(pParse, p);
++  if( pSrc->a[0].pSelect==0 ){
++    sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++    sqliteVdbeOp3(v, OP_OpenRead, base, pTab->tnum, pTab->zName, 0);
++  }
++  cont = sqliteVdbeMakeLabel(v);
++  if( pIdx==0 ){
++    sqliteVdbeAddOp(v, seekOp, base, 0);
++  }else{
++    sqliteVdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
++    sqliteVdbeOp3(v, OP_OpenRead, base+1, pIdx->tnum, pIdx->zName, P3_STATIC);
++    if( seekOp==OP_Rewind ){
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      sqliteVdbeAddOp(v, OP_MakeKey, 1, 0);
++      sqliteVdbeAddOp(v, OP_IncrKey, 0, 0);
++      seekOp = OP_MoveTo;
++    }
++    sqliteVdbeAddOp(v, seekOp, base+1, 0);
++    sqliteVdbeAddOp(v, OP_IdxRecno, base+1, 0);
++    sqliteVdbeAddOp(v, OP_Close, base+1, 0);
++    sqliteVdbeAddOp(v, OP_MoveTo, base, 0);
++  }
++  eList.nExpr = 1;
++  memset(&eListItem, 0, sizeof(eListItem));
++  eList.a = &eListItem;
++  eList.a[0].pExpr = pExpr;
++  selectInnerLoop(pParse, p, &eList, 0, 0, 0, -1, eDest, iParm, cont, cont);
++  sqliteVdbeResolveLabel(v, cont);
++  sqliteVdbeAddOp(v, OP_Close, base, 0);
++  
++  return 1;
++}
++
++/*
++** Generate code for the given SELECT statement.
++**
++** The results are distributed in various ways depending on the
++** value of eDest and iParm.
++**
++**     eDest Value       Result
++**     ------------    -------------------------------------------
++**     SRT_Callback    Invoke the callback for each row of the result.
++**
++**     SRT_Mem         Store first result in memory cell iParm
++**
++**     SRT_Set         Store results as keys of a table with cursor iParm
++**
++**     SRT_Union       Store results as a key in a temporary table iParm
++**
++**     SRT_Except      Remove results from the temporary table iParm.
++**
++**     SRT_Table       Store results in temporary table iParm
++**
++** The table above is incomplete.  Additional eDist value have be added
++** since this comment was written.  See the selectInnerLoop() function for
++** a complete listing of the allowed values of eDest and their meanings.
++**
++** This routine returns the number of errors.  If any errors are
++** encountered, then an appropriate error message is left in
++** pParse->zErrMsg.
++**
++** This routine does NOT free the Select structure passed in.  The
++** calling function needs to do that.
++**
++** The pParent, parentTab, and *pParentAgg fields are filled in if this
++** SELECT is a subquery.  This routine may try to combine this SELECT
++** with its parent to form a single flat query.  In so doing, it might
++** change the parent query from a non-aggregate to an aggregate query.
++** For that reason, the pParentAgg flag is passed as a pointer, so it
++** can be changed.
++**
++** Example 1:   The meaning of the pParent parameter.
++**
++**    SELECT * FROM t1 JOIN (SELECT x, count(*) FROM t2) JOIN t3;
++**    \                      \_______ subquery _______/        /
++**     \                                                      /
++**      \____________________ outer query ___________________/
++**
++** This routine is called for the outer query first.   For that call,
++** pParent will be NULL.  During the processing of the outer query, this 
++** routine is called recursively to handle the subquery.  For the recursive
++** call, pParent will point to the outer query.  Because the subquery is
++** the second element in a three-way join, the parentTab parameter will
++** be 1 (the 2nd value of a 0-indexed array.)
++*/
++int sqliteSelect(
++  Parse *pParse,         /* The parser context */
++  Select *p,             /* The SELECT statement being coded. */
++  int eDest,             /* How to dispose of the results */
++  int iParm,             /* A parameter used by the eDest disposal method */
++  Select *pParent,       /* Another SELECT for which this is a sub-query */
++  int parentTab,         /* Index in pParent->pSrc of this query */
++  int *pParentAgg        /* True if pParent uses aggregate functions */
++){
++  int i;
++  WhereInfo *pWInfo;
++  Vdbe *v;
++  int isAgg = 0;         /* True for select lists like "count(*)" */
++  ExprList *pEList;      /* List of columns to extract. */
++  SrcList *pTabList;     /* List of tables to select from */
++  Expr *pWhere;          /* The WHERE clause.  May be NULL */
++  ExprList *pOrderBy;    /* The ORDER BY clause.  May be NULL */
++  ExprList *pGroupBy;    /* The GROUP BY clause.  May be NULL */
++  Expr *pHaving;         /* The HAVING clause.  May be NULL */
++  int isDistinct;        /* True if the DISTINCT keyword is present */
++  int distinct;          /* Table to use for the distinct set */
++  int rc = 1;            /* Value to return from this function */
++
++  if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1;
++  if( sqliteAuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
++
++  /* If there is are a sequence of queries, do the earlier ones first.
++  */
++  if( p->pPrior ){
++    return multiSelect(pParse, p, eDest, iParm);
++  }
++
++  /* Make local copies of the parameters for this query.
++  */
++  pTabList = p->pSrc;
++  pWhere = p->pWhere;
++  pOrderBy = p->pOrderBy;
++  pGroupBy = p->pGroupBy;
++  pHaving = p->pHaving;
++  isDistinct = p->isDistinct;
++
++  /* Allocate VDBE cursors for each table in the FROM clause
++  */
++  sqliteSrcListAssignCursors(pParse, pTabList);
++
++  /* 
++  ** Do not even attempt to generate any code if we have already seen
++  ** errors before this routine starts.
++  */
++  if( pParse->nErr>0 ) goto select_end;
++
++  /* Expand any "*" terms in the result set.  (For example the "*" in
++  ** "SELECT * FROM t1")  The fillInColumnlist() routine also does some
++  ** other housekeeping - see the header comment for details.
++  */
++  if( fillInColumnList(pParse, p) ){
++    goto select_end;
++  }
++  pWhere = p->pWhere;
++  pEList = p->pEList;
++  if( pEList==0 ) goto select_end;
++
++  /* If writing to memory or generating a set
++  ** only a single column may be output.
++  */
++  if( (eDest==SRT_Mem || eDest==SRT_Set) && pEList->nExpr>1 ){
++    sqliteErrorMsg(pParse, "only a single result allowed for "
++       "a SELECT that is part of an expression");
++    goto select_end;
++  }
++
++  /* ORDER BY is ignored for some destinations.
++  */
++  switch( eDest ){
++    case SRT_Union:
++    case SRT_Except:
++    case SRT_Discard:
++      pOrderBy = 0;
++      break;
++    default:
++      break;
++  }
++
++  /* At this point, we should have allocated all the cursors that we
++  ** need to handle subquerys and temporary tables.  
++  **
++  ** Resolve the column names and do a semantics check on all the expressions.
++  */
++  for(i=0; i<pEList->nExpr; i++){
++    if( sqliteExprResolveIds(pParse, pTabList, 0, pEList->a[i].pExpr) ){
++      goto select_end;
++    }
++    if( sqliteExprCheck(pParse, pEList->a[i].pExpr, 1, &isAgg) ){
++      goto select_end;
++    }
++  }
++  if( pWhere ){
++    if( sqliteExprResolveIds(pParse, pTabList, pEList, pWhere) ){
++      goto select_end;
++    }
++    if( sqliteExprCheck(pParse, pWhere, 0, 0) ){
++      goto select_end;
++    }
++  }
++  if( pHaving ){
++    if( pGroupBy==0 ){
++      sqliteErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
++      goto select_end;
++    }
++    if( sqliteExprResolveIds(pParse, pTabList, pEList, pHaving) ){
++      goto select_end;
++    }
++    if( sqliteExprCheck(pParse, pHaving, 1, &isAgg) ){
++      goto select_end;
++    }
++  }
++  if( pOrderBy ){
++    for(i=0; i<pOrderBy->nExpr; i++){
++      int iCol;
++      Expr *pE = pOrderBy->a[i].pExpr;
++      if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){
++        sqliteExprDelete(pE);
++        pE = pOrderBy->a[i].pExpr = sqliteExprDup(pEList->a[iCol-1].pExpr);
++      }
++      if( sqliteExprResolveIds(pParse, pTabList, pEList, pE) ){
++        goto select_end;
++      }
++      if( sqliteExprCheck(pParse, pE, isAgg, 0) ){
++        goto select_end;
++      }
++      if( sqliteExprIsConstant(pE) ){
++        if( sqliteExprIsInteger(pE, &iCol)==0 ){
++          sqliteErrorMsg(pParse,
++             "ORDER BY terms must not be non-integer constants");
++          goto select_end;
++        }else if( iCol<=0 || iCol>pEList->nExpr ){
++          sqliteErrorMsg(pParse, 
++             "ORDER BY column number %d out of range - should be "
++             "between 1 and %d", iCol, pEList->nExpr);
++          goto select_end;
++        }
++      }
++    }
++  }
++  if( pGroupBy ){
++    for(i=0; i<pGroupBy->nExpr; i++){
++      int iCol;
++      Expr *pE = pGroupBy->a[i].pExpr;
++      if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){
++        sqliteExprDelete(pE);
++        pE = pGroupBy->a[i].pExpr = sqliteExprDup(pEList->a[iCol-1].pExpr);
++      }
++      if( sqliteExprResolveIds(pParse, pTabList, pEList, pE) ){
++        goto select_end;
++      }
++      if( sqliteExprCheck(pParse, pE, isAgg, 0) ){
++        goto select_end;
++      }
++      if( sqliteExprIsConstant(pE) ){
++        if( sqliteExprIsInteger(pE, &iCol)==0 ){
++          sqliteErrorMsg(pParse,
++            "GROUP BY terms must not be non-integer constants");
++          goto select_end;
++        }else if( iCol<=0 || iCol>pEList->nExpr ){
++          sqliteErrorMsg(pParse,
++             "GROUP BY column number %d out of range - should be "
++             "between 1 and %d", iCol, pEList->nExpr);
++          goto select_end;
++        }
++      }
++    }
++  }
++
++  /* Begin generating code.
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) goto select_end;
++
++  /* Identify column names if we will be using them in a callback.  This
++  ** step is skipped if the output is going to some other destination.
++  */
++  if( eDest==SRT_Callback ){
++    generateColumnNames(pParse, pTabList, pEList);
++  }
++
++  /* Generate code for all sub-queries in the FROM clause
++  */
++  for(i=0; i<pTabList->nSrc; i++){
++    const char *zSavedAuthContext;
++    int needRestoreContext;
++
++    if( pTabList->a[i].pSelect==0 ) continue;
++    if( pTabList->a[i].zName!=0 ){
++      zSavedAuthContext = pParse->zAuthContext;
++      pParse->zAuthContext = pTabList->a[i].zName;
++      needRestoreContext = 1;
++    }else{
++      needRestoreContext = 0;
++    }
++    sqliteSelect(pParse, pTabList->a[i].pSelect, SRT_TempTable, 
++                 pTabList->a[i].iCursor, p, i, &isAgg);
++    if( needRestoreContext ){
++      pParse->zAuthContext = zSavedAuthContext;
++    }
++    pTabList = p->pSrc;
++    pWhere = p->pWhere;
++    if( eDest!=SRT_Union && eDest!=SRT_Except && eDest!=SRT_Discard ){
++      pOrderBy = p->pOrderBy;
++    }
++    pGroupBy = p->pGroupBy;
++    pHaving = p->pHaving;
++    isDistinct = p->isDistinct;
++  }
++
++  /* Check for the special case of a min() or max() function by itself
++  ** in the result set.
++  */
++  if( simpleMinMaxQuery(pParse, p, eDest, iParm) ){
++    rc = 0;
++    goto select_end;
++  }
++
++  /* Check to see if this is a subquery that can be "flattened" into its parent.
++  ** If flattening is a possiblity, do so and return immediately.  
++  */
++  if( pParent && pParentAgg &&
++      flattenSubquery(pParse, pParent, parentTab, *pParentAgg, isAgg) ){
++    if( isAgg ) *pParentAgg = 1;
++    return rc;
++  }
++
++  /* Set the limiter.
++  */
++  computeLimitRegisters(pParse, p);
++
++  /* Identify column types if we will be using a callback.  This
++  ** step is skipped if the output is going to a destination other
++  ** than a callback.
++  **
++  ** We have to do this separately from the creation of column names
++  ** above because if the pTabList contains views then they will not
++  ** have been resolved and we will not know the column types until
++  ** now.
++  */
++  if( eDest==SRT_Callback ){
++    generateColumnTypes(pParse, pTabList, pEList);
++  }
++
++  /* If the output is destined for a temporary table, open that table.
++  */
++  if( eDest==SRT_TempTable ){
++    sqliteVdbeAddOp(v, OP_OpenTemp, iParm, 0);
++  }
++
++  /* Do an analysis of aggregate expressions.
++  */
++  sqliteAggregateInfoReset(pParse);
++  if( isAgg || pGroupBy ){
++    assert( pParse->nAgg==0 );
++    isAgg = 1;
++    for(i=0; i<pEList->nExpr; i++){
++      if( sqliteExprAnalyzeAggregates(pParse, pEList->a[i].pExpr) ){
++        goto select_end;
++      }
++    }
++    if( pGroupBy ){
++      for(i=0; i<pGroupBy->nExpr; i++){
++        if( sqliteExprAnalyzeAggregates(pParse, pGroupBy->a[i].pExpr) ){
++          goto select_end;
++        }
++      }
++    }
++    if( pHaving && sqliteExprAnalyzeAggregates(pParse, pHaving) ){
++      goto select_end;
++    }
++    if( pOrderBy ){
++      for(i=0; i<pOrderBy->nExpr; i++){
++        if( sqliteExprAnalyzeAggregates(pParse, pOrderBy->a[i].pExpr) ){
++          goto select_end;
++        }
++      }
++    }
++  }
++
++  /* Reset the aggregator
++  */
++  if( isAgg ){
++    sqliteVdbeAddOp(v, OP_AggReset, 0, pParse->nAgg);
++    for(i=0; i<pParse->nAgg; i++){
++      FuncDef *pFunc;
++      if( (pFunc = pParse->aAgg[i].pFunc)!=0 && pFunc->xFinalize!=0 ){
++        sqliteVdbeOp3(v, OP_AggInit, 0, i, (char*)pFunc, P3_POINTER);
++      }
++    }
++    if( pGroupBy==0 ){
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      sqliteVdbeAddOp(v, OP_AggFocus, 0, 0);
++    }
++  }
++
++  /* Initialize the memory cell to NULL
++  */
++  if( eDest==SRT_Mem ){
++    sqliteVdbeAddOp(v, OP_String, 0, 0);
++    sqliteVdbeAddOp(v, OP_MemStore, iParm, 1);
++  }
++
++  /* Open a temporary table to use for the distinct set.
++  */
++  if( isDistinct ){
++    distinct = pParse->nTab++;
++    sqliteVdbeAddOp(v, OP_OpenTemp, distinct, 1);
++  }else{
++    distinct = -1;
++  }
++
++  /* Begin the database scan
++  */
++  pWInfo = sqliteWhereBegin(pParse, pTabList, pWhere, 0, 
++                            pGroupBy ? 0 : &pOrderBy);
++  if( pWInfo==0 ) goto select_end;
++
++  /* Use the standard inner loop if we are not dealing with
++  ** aggregates
++  */
++  if( !isAgg ){
++    if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest,
++                    iParm, pWInfo->iContinue, pWInfo->iBreak) ){
++       goto select_end;
++    }
++  }
++
++  /* If we are dealing with aggregates, then do the special aggregate
++  ** processing.  
++  */
++  else{
++    AggExpr *pAgg;
++    if( pGroupBy ){
++      int lbl1;
++      for(i=0; i<pGroupBy->nExpr; i++){
++        sqliteExprCode(pParse, pGroupBy->a[i].pExpr);
++      }
++      sqliteVdbeAddOp(v, OP_MakeKey, pGroupBy->nExpr, 0);
++      if( pParse->db->file_format>=4 ) sqliteAddKeyType(v, pGroupBy);
++      lbl1 = sqliteVdbeMakeLabel(v);
++      sqliteVdbeAddOp(v, OP_AggFocus, 0, lbl1);
++      for(i=0, pAgg=pParse->aAgg; i<pParse->nAgg; i++, pAgg++){
++        if( pAgg->isAgg ) continue;
++        sqliteExprCode(pParse, pAgg->pExpr);
++        sqliteVdbeAddOp(v, OP_AggSet, 0, i);
++      }
++      sqliteVdbeResolveLabel(v, lbl1);
++    }
++    for(i=0, pAgg=pParse->aAgg; i<pParse->nAgg; i++, pAgg++){
++      Expr *pE;
++      int nExpr;
++      FuncDef *pDef;
++      if( !pAgg->isAgg ) continue;
++      assert( pAgg->pFunc!=0 );
++      assert( pAgg->pFunc->xStep!=0 );
++      pDef = pAgg->pFunc;
++      pE = pAgg->pExpr;
++      assert( pE!=0 );
++      assert( pE->op==TK_AGG_FUNCTION );
++      nExpr = sqliteExprCodeExprList(pParse, pE->pList, pDef->includeTypes);
++      sqliteVdbeAddOp(v, OP_Integer, i, 0);
++      sqliteVdbeOp3(v, OP_AggFunc, 0, nExpr, (char*)pDef, P3_POINTER);
++    }
++  }
++
++  /* End the database scan loop.
++  */
++  sqliteWhereEnd(pWInfo);
++
++  /* If we are processing aggregates, we need to set up a second loop
++  ** over all of the aggregate values and process them.
++  */
++  if( isAgg ){
++    int endagg = sqliteVdbeMakeLabel(v);
++    int startagg;
++    startagg = sqliteVdbeAddOp(v, OP_AggNext, 0, endagg);
++    pParse->useAgg = 1;
++    if( pHaving ){
++      sqliteExprIfFalse(pParse, pHaving, startagg, 1);
++    }
++    if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest,
++                    iParm, startagg, endagg) ){
++      goto select_end;
++    }
++    sqliteVdbeAddOp(v, OP_Goto, 0, startagg);
++    sqliteVdbeResolveLabel(v, endagg);
++    sqliteVdbeAddOp(v, OP_Noop, 0, 0);
++    pParse->useAgg = 0;
++  }
++
++  /* If there is an ORDER BY clause, then we need to sort the results
++  ** and send them to the callback one by one.
++  */
++  if( pOrderBy ){
++    generateSortTail(p, v, pEList->nExpr, eDest, iParm);
++  }
++
++  /* If this was a subquery, we have now converted the subquery into a
++  ** temporary table.  So delete the subquery structure from the parent
++  ** to prevent this subquery from being evaluated again and to force the
++  ** the use of the temporary table.
++  */
++  if( pParent ){
++    assert( pParent->pSrc->nSrc>parentTab );
++    assert( pParent->pSrc->a[parentTab].pSelect==p );
++    sqliteSelectDelete(p);
++    pParent->pSrc->a[parentTab].pSelect = 0;
++  }
++
++  /* The SELECT was successfully coded.   Set the return code to 0
++  ** to indicate no errors.
++  */
++  rc = 0;
++
++  /* Control jumps to here if an error is encountered above, or upon
++  ** successful coding of the SELECT.
++  */
++select_end:
++  sqliteAggregateInfoReset(pParse);
++  return rc;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/sqlite_config.w32.h
+@@ -0,0 +1,8 @@
++#include "config.w32.h"
++#if ZTS
++# define THREADSAFE 1
++#endif
++#if !ZEND_DEBUG && !defined(NDEBUG)
++# define NDEBUG
++#endif
++#define SQLITE_PTR_SZ 4
+\ No newline at end of file
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/sqlite.h.in
+@@ -0,0 +1,886 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This header file defines the interface that the SQLite library
++** presents to client programs.
++**
++** @(#) $Id$
++*/
++#ifndef _SQLITE_H_
++#define _SQLITE_H_
++#include <stdarg.h>     /* Needed for the definition of va_list */
++
++/*
++** Make sure we can call this stuff from C++.
++*/
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++** The version of the SQLite library.
++*/
++#ifdef SQLITE_VERSION
++# undef SQLITE_VERSION
++#else
++# define SQLITE_VERSION         "--VERS--"
++#endif
++
++/*
++** The version string is also compiled into the library so that a program
++** can check to make sure that the lib*.a file and the *.h file are from
++** the same version.
++*/
++extern const char sqlite_version[];
++
++/*
++** The SQLITE_UTF8 macro is defined if the library expects to see
++** UTF-8 encoded data.  The SQLITE_ISO8859 macro is defined if the
++** iso8859 encoded should be used.
++*/
++#define SQLITE_--ENCODING-- 1
++
++/*
++** The following constant holds one of two strings, "UTF-8" or "iso8859",
++** depending on which character encoding the SQLite library expects to
++** see.  The character encoding makes a difference for the LIKE and GLOB
++** operators and for the LENGTH() and SUBSTR() functions.
++*/
++extern const char sqlite_encoding[];
++
++/*
++** Each open sqlite database is represented by an instance of the
++** following opaque structure.
++*/
++typedef struct sqlite sqlite;
++
++/*
++** A function to open a new sqlite database.  
++**
++** If the database does not exist and mode indicates write
++** permission, then a new database is created.  If the database
++** does not exist and mode does not indicate write permission,
++** then the open fails, an error message generated (if errmsg!=0)
++** and the function returns 0.
++** 
++** If mode does not indicates user write permission, then the 
++** database is opened read-only.
++**
++** The Truth:  As currently implemented, all databases are opened
++** for writing all the time.  Maybe someday we will provide the
++** ability to open a database readonly.  The mode parameters is
++** provided in anticipation of that enhancement.
++*/
++sqlite *sqlite_open(const char *filename, int mode, char **errmsg);
++
++/*
++** A function to close the database.
++**
++** Call this function with a pointer to a structure that was previously
++** returned from sqlite_open() and the corresponding database will by closed.
++*/
++void sqlite_close(sqlite *);
++
++/*
++** The type for a callback function.
++*/
++typedef int (*sqlite_callback)(void*,int,char**, char**);
++
++/*
++** A function to executes one or more statements of SQL.
++**
++** If one or more of the SQL statements are queries, then
++** the callback function specified by the 3rd parameter is
++** invoked once for each row of the query result.  This callback
++** should normally return 0.  If the callback returns a non-zero
++** value then the query is aborted, all subsequent SQL statements
++** are skipped and the sqlite_exec() function returns the SQLITE_ABORT.
++**
++** The 4th parameter is an arbitrary pointer that is passed
++** to the callback function as its first parameter.
++**
++** The 2nd parameter to the callback function is the number of
++** columns in the query result.  The 3rd parameter to the callback
++** is an array of strings holding the values for each column.
++** The 4th parameter to the callback is an array of strings holding
++** the names of each column.
++**
++** The callback function may be NULL, even for queries.  A NULL
++** callback is not an error.  It just means that no callback
++** will be invoked.
++**
++** If an error occurs while parsing or evaluating the SQL (but
++** not while executing the callback) then an appropriate error
++** message is written into memory obtained from malloc() and
++** *errmsg is made to point to that message.  The calling function
++** is responsible for freeing the memory that holds the error
++** message.   Use sqlite_freemem() for this.  If errmsg==NULL,
++** then no error message is ever written.
++**
++** The return value is is SQLITE_OK if there are no errors and
++** some other return code if there is an error.  The particular
++** return value depends on the type of error. 
++**
++** If the query could not be executed because a database file is
++** locked or busy, then this function returns SQLITE_BUSY.  (This
++** behavior can be modified somewhat using the sqlite_busy_handler()
++** and sqlite_busy_timeout() functions below.)
++*/
++int sqlite_exec(
++  sqlite*,                      /* An open database */
++  const char *sql,              /* SQL to be executed */
++  sqlite_callback,              /* Callback function */
++  void *,                       /* 1st argument to callback function */
++  char **errmsg                 /* Error msg written here */
++);
++
++/*
++** Return values for sqlite_exec() and sqlite_step()
++*/
++#define SQLITE_OK           0   /* Successful result */
++#define SQLITE_ERROR        1   /* SQL error or missing database */
++#define SQLITE_INTERNAL     2   /* An internal logic error in SQLite */
++#define SQLITE_PERM         3   /* Access permission denied */
++#define SQLITE_ABORT        4   /* Callback routine requested an abort */
++#define SQLITE_BUSY         5   /* The database file is locked */
++#define SQLITE_LOCKED       6   /* A table in the database is locked */
++#define SQLITE_NOMEM        7   /* A malloc() failed */
++#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
++#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite_interrupt() */
++#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
++#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
++#define SQLITE_NOTFOUND    12   /* (Internal Only) Table or record not found */
++#define SQLITE_FULL        13   /* Insertion failed because database is full */
++#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
++#define SQLITE_PROTOCOL    15   /* Database lock protocol error */
++#define SQLITE_EMPTY       16   /* (Internal Only) Database table is empty */
++#define SQLITE_SCHEMA      17   /* The database schema changed */
++#define SQLITE_TOOBIG      18   /* Too much data for one row of a table */
++#define SQLITE_CONSTRAINT  19   /* Abort due to contraint violation */
++#define SQLITE_MISMATCH    20   /* Data type mismatch */
++#define SQLITE_MISUSE      21   /* Library used incorrectly */
++#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
++#define SQLITE_AUTH        23   /* Authorization denied */
++#define SQLITE_FORMAT      24   /* Auxiliary database format error */
++#define SQLITE_RANGE       25   /* 2nd parameter to sqlite_bind out of range */
++#define SQLITE_NOTADB      26   /* File opened that is not a database file */
++#define SQLITE_ROW         100  /* sqlite_step() has another row ready */
++#define SQLITE_DONE        101  /* sqlite_step() has finished executing */
++
++/*
++** Each entry in an SQLite table has a unique integer key.  (The key is
++** the value of the INTEGER PRIMARY KEY column if there is such a column,
++** otherwise the key is generated at random.  The unique key is always
++** available as the ROWID, OID, or _ROWID_ column.)  The following routine
++** returns the integer key of the most recent insert in the database.
++**
++** This function is similar to the mysql_insert_id() function from MySQL.
++*/
++int sqlite_last_insert_rowid(sqlite*);
++
++/*
++** This function returns the number of database rows that were changed
++** (or inserted or deleted) by the most recent called sqlite_exec().
++**
++** All changes are counted, even if they were later undone by a
++** ROLLBACK or ABORT.  Except, changes associated with creating and
++** dropping tables are not counted.
++**
++** If a callback invokes sqlite_exec() recursively, then the changes
++** in the inner, recursive call are counted together with the changes
++** in the outer call.
++**
++** SQLite implements the command "DELETE FROM table" without a WHERE clause
++** by dropping and recreating the table.  (This is much faster than going
++** through and deleting individual elements form the table.)  Because of
++** this optimization, the change count for "DELETE FROM table" will be
++** zero regardless of the number of elements that were originally in the
++** table. To get an accurate count of the number of rows deleted, use
++** "DELETE FROM table WHERE 1" instead.
++*/
++int sqlite_changes(sqlite*);
++
++/*
++** This function returns the number of database rows that were changed
++** by the last INSERT, UPDATE, or DELETE statment executed by sqlite_exec(),
++** or by the last VM to run to completion. The change count is not updated
++** by SQL statements other than INSERT, UPDATE or DELETE.
++**
++** Changes are counted, even if they are later undone by a ROLLBACK or
++** ABORT. Changes associated with trigger programs that execute as a
++** result of the INSERT, UPDATE, or DELETE statement are not counted.
++**
++** If a callback invokes sqlite_exec() recursively, then the changes
++** in the inner, recursive call are counted together with the changes
++** in the outer call.
++**
++** SQLite implements the command "DELETE FROM table" without a WHERE clause
++** by dropping and recreating the table.  (This is much faster than going
++** through and deleting individual elements form the table.)  Because of
++** this optimization, the change count for "DELETE FROM table" will be
++** zero regardless of the number of elements that were originally in the
++** table. To get an accurate count of the number of rows deleted, use
++** "DELETE FROM table WHERE 1" instead.
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++int sqlite_last_statement_changes(sqlite*);
++
++/* If the parameter to this routine is one of the return value constants
++** defined above, then this routine returns a constant text string which
++** descripts (in English) the meaning of the return value.
++*/
++const char *sqlite_error_string(int);
++#define sqliteErrStr sqlite_error_string  /* Legacy. Do not use in new code. */
++
++/* This function causes any pending database operation to abort and
++** return at its earliest opportunity.  This routine is typically
++** called in response to a user action such as pressing "Cancel"
++** or Ctrl-C where the user wants a long query operation to halt
++** immediately.
++*/
++void sqlite_interrupt(sqlite*);
++
++
++/* This function returns true if the given input string comprises
++** one or more complete SQL statements.
++**
++** The algorithm is simple.  If the last token other than spaces
++** and comments is a semicolon, then return true.  otherwise return
++** false.
++*/
++int sqlite_complete(const char *sql);
++
++/*
++** This routine identifies a callback function that is invoked
++** whenever an attempt is made to open a database table that is
++** currently locked by another process or thread.  If the busy callback
++** is NULL, then sqlite_exec() returns SQLITE_BUSY immediately if
++** it finds a locked table.  If the busy callback is not NULL, then
++** sqlite_exec() invokes the callback with three arguments.  The
++** second argument is the name of the locked table and the third
++** argument is the number of times the table has been busy.  If the
++** busy callback returns 0, then sqlite_exec() immediately returns
++** SQLITE_BUSY.  If the callback returns non-zero, then sqlite_exec()
++** tries to open the table again and the cycle repeats.
++**
++** The default busy callback is NULL.
++**
++** Sqlite is re-entrant, so the busy handler may start a new query. 
++** (It is not clear why anyone would every want to do this, but it
++** is allowed, in theory.)  But the busy handler may not close the
++** database.  Closing the database from a busy handler will delete 
++** data structures out from under the executing query and will 
++** probably result in a coredump.
++*/
++void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
++
++/*
++** This routine sets a busy handler that sleeps for a while when a
++** table is locked.  The handler will sleep multiple times until 
++** at least "ms" milleseconds of sleeping have been done.  After
++** "ms" milleseconds of sleeping, the handler returns 0 which
++** causes sqlite_exec() to return SQLITE_BUSY.
++**
++** Calling this routine with an argument less than or equal to zero
++** turns off all busy handlers.
++*/
++void sqlite_busy_timeout(sqlite*, int ms);
++
++/*
++** This next routine is really just a wrapper around sqlite_exec().
++** Instead of invoking a user-supplied callback for each row of the
++** result, this routine remembers each row of the result in memory
++** obtained from malloc(), then returns all of the result after the
++** query has finished. 
++**
++** As an example, suppose the query result where this table:
++**
++**        Name        | Age
++**        -----------------------
++**        Alice       | 43
++**        Bob         | 28
++**        Cindy       | 21
++**
++** If the 3rd argument were &azResult then after the function returns
++** azResult will contain the following data:
++**
++**        azResult[0] = "Name";
++**        azResult[1] = "Age";
++**        azResult[2] = "Alice";
++**        azResult[3] = "43";
++**        azResult[4] = "Bob";
++**        azResult[5] = "28";
++**        azResult[6] = "Cindy";
++**        azResult[7] = "21";
++**
++** Notice that there is an extra row of data containing the column
++** headers.  But the *nrow return value is still 3.  *ncolumn is
++** set to 2.  In general, the number of values inserted into azResult
++** will be ((*nrow) + 1)*(*ncolumn).
++**
++** After the calling function has finished using the result, it should 
++** pass the result data pointer to sqlite_free_table() in order to 
++** release the memory that was malloc-ed.  Because of the way the 
++** malloc() happens, the calling function must not try to call 
++** malloc() directly.  Only sqlite_free_table() is able to release 
++** the memory properly and safely.
++**
++** The return value of this routine is the same as from sqlite_exec().
++*/
++int sqlite_get_table(
++  sqlite*,               /* An open database */
++  const char *sql,       /* SQL to be executed */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg          /* Error msg written here */
++);
++
++/*
++** Call this routine to free the memory that sqlite_get_table() allocated.
++*/
++void sqlite_free_table(char **result);
++
++/*
++** The following routines are wrappers around sqlite_exec() and
++** sqlite_get_table().  The only difference between the routines that
++** follow and the originals is that the second argument to the 
++** routines that follow is really a printf()-style format
++** string describing the SQL to be executed.  Arguments to the format
++** string appear at the end of the argument list.
++**
++** All of the usual printf formatting options apply.  In addition, there
++** is a "%q" option.  %q works like %s in that it substitutes a null-terminated
++** string from the argument list.  But %q also doubles every '\'' character.
++** %q is designed for use inside a string literal.  By doubling each '\''
++** character it escapes that character and allows it to be inserted into
++** the string.
++**
++** For example, so some string variable contains text as follows:
++**
++**      char *zText = "It's a happy day!";
++**
++** We can use this text in an SQL statement as follows:
++**
++**      sqlite_exec_printf(db, "INSERT INTO table VALUES('%q')",
++**          callback1, 0, 0, zText);
++**
++** Because the %q format string is used, the '\'' character in zText
++** is escaped and the SQL generated is as follows:
++**
++**      INSERT INTO table1 VALUES('It''s a happy day!')
++**
++** This is correct.  Had we used %s instead of %q, the generated SQL
++** would have looked like this:
++**
++**      INSERT INTO table1 VALUES('It's a happy day!');
++**
++** This second example is an SQL syntax error.  As a general rule you
++** should always use %q instead of %s when inserting text into a string 
++** literal.
++*/
++int sqlite_exec_printf(
++  sqlite*,                      /* An open database */
++  const char *sqlFormat,        /* printf-style format string for the SQL */
++  sqlite_callback,              /* Callback function */
++  void *,                       /* 1st argument to callback function */
++  char **errmsg,                /* Error msg written here */
++  ...                           /* Arguments to the format string. */
++);
++int sqlite_exec_vprintf(
++  sqlite*,                      /* An open database */
++  const char *sqlFormat,        /* printf-style format string for the SQL */
++  sqlite_callback,              /* Callback function */
++  void *,                       /* 1st argument to callback function */
++  char **errmsg,                /* Error msg written here */
++  va_list ap                    /* Arguments to the format string. */
++);
++int sqlite_get_table_printf(
++  sqlite*,               /* An open database */
++  const char *sqlFormat, /* printf-style format string for the SQL */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg,         /* Error msg written here */
++  ...                    /* Arguments to the format string */
++);
++int sqlite_get_table_vprintf(
++  sqlite*,               /* An open database */
++  const char *sqlFormat, /* printf-style format string for the SQL */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg,         /* Error msg written here */
++  va_list ap             /* Arguments to the format string */
++);
++char *sqlite_mprintf(const char*,...);
++char *sqlite_vmprintf(const char*, va_list);
++
++/*
++** Windows systems should call this routine to free memory that
++** is returned in the in the errmsg parameter of sqlite_open() when
++** SQLite is a DLL.  For some reason, it does not work to call free()
++** directly.
++*/
++void sqlite_freemem(void *p);
++
++/*
++** Windows systems need functions to call to return the sqlite_version
++** and sqlite_encoding strings.
++*/
++const char *sqlite_libversion(void);
++const char *sqlite_libencoding(void);
++
++/*
++** A pointer to the following structure is used to communicate with
++** the implementations of user-defined functions.
++*/
++typedef struct sqlite_func sqlite_func;
++
++/*
++** Use the following routines to create new user-defined functions.  See
++** the documentation for details.
++*/
++int sqlite_create_function(
++  sqlite*,                  /* Database where the new function is registered */
++  const char *zName,        /* Name of the new function */
++  int nArg,                 /* Number of arguments.  -1 means any number */
++  void (*xFunc)(sqlite_func*,int,const char**),  /* C code to implement */
++  void *pUserData           /* Available via the sqlite_user_data() call */
++);
++int sqlite_create_aggregate(
++  sqlite*,                  /* Database where the new function is registered */
++  const char *zName,        /* Name of the function */
++  int nArg,                 /* Number of arguments */
++  void (*xStep)(sqlite_func*,int,const char**), /* Called for each row */
++  void (*xFinalize)(sqlite_func*),       /* Called once to get final result */
++  void *pUserData           /* Available via the sqlite_user_data() call */
++);
++
++/*
++** Use the following routine to define the datatype returned by a
++** user-defined function.  The second argument can be one of the
++** constants SQLITE_NUMERIC, SQLITE_TEXT, or SQLITE_ARGS or it
++** can be an integer greater than or equal to zero.  When the datatype
++** parameter is non-negative, the type of the result will be the
++** same as the datatype-th argument.  If datatype==SQLITE_NUMERIC
++** then the result is always numeric.  If datatype==SQLITE_TEXT then
++** the result is always text.  If datatype==SQLITE_ARGS then the result
++** is numeric if any argument is numeric and is text otherwise.
++*/
++int sqlite_function_type(
++  sqlite *db,               /* The database there the function is registered */
++  const char *zName,        /* Name of the function */
++  int datatype              /* The datatype for this function */
++);
++#define SQLITE_NUMERIC     (-1)
++/* #define SQLITE_TEXT     (-2)  // See below */
++#define SQLITE_ARGS        (-3)
++
++/*
++** SQLite version 3 defines SQLITE_TEXT differently.  To allow both
++** version 2 and version 3 to be included, undefine them both if a
++** conflict is seen.  Define SQLITE2_TEXT to be the version 2 value.
++*/
++#ifdef SQLITE_TEXT
++# undef SQLITE_TEXT
++#else
++# define SQLITE_TEXT     (-2)
++#endif
++#define SQLITE2_TEXT     (-2)
++
++
++
++/*
++** The user function implementations call one of the following four routines
++** in order to return their results.  The first parameter to each of these
++** routines is a copy of the first argument to xFunc() or xFinialize().
++** The second parameter to these routines is the result to be returned.
++** A NULL can be passed as the second parameter to sqlite_set_result_string()
++** in order to return a NULL result.
++**
++** The 3rd argument to _string and _error is the number of characters to
++** take from the string.  If this argument is negative, then all characters
++** up to and including the first '\000' are used.
++**
++** The sqlite_set_result_string() function allocates a buffer to hold the
++** result and returns a pointer to this buffer.  The calling routine
++** (that is, the implmentation of a user function) can alter the content
++** of this buffer if desired.
++*/
++char *sqlite_set_result_string(sqlite_func*,const char*,int);
++void sqlite_set_result_int(sqlite_func*,int);
++void sqlite_set_result_double(sqlite_func*,double);
++void sqlite_set_result_error(sqlite_func*,const char*,int);
++
++/*
++** The pUserData parameter to the sqlite_create_function() and
++** sqlite_create_aggregate() routines used to register user functions
++** is available to the implementation of the function using this
++** call.
++*/
++void *sqlite_user_data(sqlite_func*);
++
++/*
++** Aggregate functions use the following routine to allocate
++** a structure for storing their state.  The first time this routine
++** is called for a particular aggregate, a new structure of size nBytes
++** is allocated, zeroed, and returned.  On subsequent calls (for the
++** same aggregate instance) the same buffer is returned.  The implementation
++** of the aggregate can use the returned buffer to accumulate data.
++**
++** The buffer allocated is freed automatically be SQLite.
++*/
++void *sqlite_aggregate_context(sqlite_func*, int nBytes);
++
++/*
++** The next routine returns the number of calls to xStep for a particular
++** aggregate function instance.  The current call to xStep counts so this
++** routine always returns at least 1.
++*/
++int sqlite_aggregate_count(sqlite_func*);
++
++/*
++** This routine registers a callback with the SQLite library.  The
++** callback is invoked (at compile-time, not at run-time) for each
++** attempt to access a column of a table in the database.  The callback
++** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire
++** SQL statement should be aborted with an error and SQLITE_IGNORE
++** if the column should be treated as a NULL value.
++*/
++int sqlite_set_authorizer(
++  sqlite*,
++  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
++  void *pUserData
++);
++
++/*
++** The second parameter to the access authorization function above will
++** be one of the values below.  These values signify what kind of operation
++** is to be authorized.  The 3rd and 4th parameters to the authorization
++** function will be parameters or NULL depending on which of the following
++** codes is used as the second parameter.  The 5th parameter is the name
++** of the database ("main", "temp", etc.) if applicable.  The 6th parameter
++** is the name of the inner-most trigger or view that is responsible for
++** the access attempt or NULL if this access attempt is directly from 
++** input SQL code.
++**
++**                                          Arg-3           Arg-4
++*/
++#define SQLITE_COPY                  0   /* Table Name      File Name       */
++#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
++#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
++#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
++#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
++#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
++#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */
++#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */
++#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */
++#define SQLITE_DELETE                9   /* Table Name      NULL            */
++#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */
++#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */
++#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */
++#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */
++#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */
++#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */
++#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */
++#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */
++#define SQLITE_INSERT               18   /* Table Name      NULL            */
++#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */
++#define SQLITE_READ                 20   /* Table Name      Column Name     */
++#define SQLITE_SELECT               21   /* NULL            NULL            */
++#define SQLITE_TRANSACTION          22   /* NULL            NULL            */
++#define SQLITE_UPDATE               23   /* Table Name      Column Name     */
++#define SQLITE_ATTACH               24   /* Filename        NULL            */
++#define SQLITE_DETACH               25   /* Database Name   NULL            */
++
++
++/*
++** The return value of the authorization function should be one of the
++** following constants:
++*/
++/* #define SQLITE_OK  0   // Allow access (This is actually defined above) */
++#define SQLITE_DENY   1   /* Abort the SQL statement with an error */
++#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */
++
++/*
++** Register a function that is called at every invocation of sqlite_exec()
++** or sqlite_compile().  This function can be used (for example) to generate
++** a log file of all SQL executed against a database.
++*/
++void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
++
++/*** The Callback-Free API
++** 
++** The following routines implement a new way to access SQLite that does not
++** involve the use of callbacks.
++**
++** An sqlite_vm is an opaque object that represents a single SQL statement
++** that is ready to be executed.
++*/
++typedef struct sqlite_vm sqlite_vm;
++
++/*
++** To execute an SQLite query without the use of callbacks, you first have
++** to compile the SQL using this routine.  The 1st parameter "db" is a pointer
++** to an sqlite object obtained from sqlite_open().  The 2nd parameter
++** "zSql" is the text of the SQL to be compiled.   The remaining parameters
++** are all outputs.
++**
++** *pzTail is made to point to the first character past the end of the first
++** SQL statement in zSql.  This routine only compiles the first statement
++** in zSql, so *pzTail is left pointing to what remains uncompiled.
++**
++** *ppVm is left pointing to a "virtual machine" that can be used to execute
++** the compiled statement.  Or if there is an error, *ppVm may be set to NULL.
++** If the input text contained no SQL (if the input is and empty string or
++** a comment) then *ppVm is set to NULL.
++**
++** If any errors are detected during compilation, an error message is written
++** into space obtained from malloc() and *pzErrMsg is made to point to that
++** error message.  The calling routine is responsible for freeing the text
++** of this message when it has finished with it.  Use sqlite_freemem() to
++** free the message.  pzErrMsg may be NULL in which case no error message
++** will be generated.
++**
++** On success, SQLITE_OK is returned.  Otherwise and error code is returned.
++*/
++int sqlite_compile(
++  sqlite *db,                   /* The open database */
++  const char *zSql,             /* SQL statement to be compiled */
++  const char **pzTail,          /* OUT: uncompiled tail of zSql */
++  sqlite_vm **ppVm,             /* OUT: the virtual machine to execute zSql */
++  char **pzErrmsg               /* OUT: Error message. */
++);
++
++/*
++** After an SQL statement has been compiled, it is handed to this routine
++** to be executed.  This routine executes the statement as far as it can
++** go then returns.  The return value will be one of SQLITE_DONE,
++** SQLITE_ERROR, SQLITE_BUSY, SQLITE_ROW, or SQLITE_MISUSE.
++**
++** SQLITE_DONE means that the execute of the SQL statement is complete
++** an no errors have occurred.  sqlite_step() should not be called again
++** for the same virtual machine.  *pN is set to the number of columns in
++** the result set and *pazColName is set to an array of strings that
++** describe the column names and datatypes.  The name of the i-th column
++** is (*pazColName)[i] and the datatype of the i-th column is
++** (*pazColName)[i+*pN].  *pazValue is set to NULL.
++**
++** SQLITE_ERROR means that the virtual machine encountered a run-time
++** error.  sqlite_step() should not be called again for the same
++** virtual machine.  *pN is set to 0 and *pazColName and *pazValue are set
++** to NULL.  Use sqlite_finalize() to obtain the specific error code
++** and the error message text for the error.
++**
++** SQLITE_BUSY means that an attempt to open the database failed because
++** another thread or process is holding a lock.  The calling routine
++** can try again to open the database by calling sqlite_step() again.
++** The return code will only be SQLITE_BUSY if no busy handler is registered
++** using the sqlite_busy_handler() or sqlite_busy_timeout() routines.  If
++** a busy handler callback has been registered but returns 0, then this
++** routine will return SQLITE_ERROR and sqltie_finalize() will return
++** SQLITE_BUSY when it is called.
++**
++** SQLITE_ROW means that a single row of the result is now available.
++** The data is contained in *pazValue.  The value of the i-th column is
++** (*azValue)[i].  *pN and *pazColName are set as described in SQLITE_DONE.
++** Invoke sqlite_step() again to advance to the next row.
++**
++** SQLITE_MISUSE is returned if sqlite_step() is called incorrectly.
++** For example, if you call sqlite_step() after the virtual machine
++** has halted (after a prior call to sqlite_step() has returned SQLITE_DONE)
++** or if you call sqlite_step() with an incorrectly initialized virtual
++** machine or a virtual machine that has been deleted or that is associated
++** with an sqlite structure that has been closed.
++*/
++int sqlite_step(
++  sqlite_vm *pVm,              /* The virtual machine to execute */
++  int *pN,                     /* OUT: Number of columns in result */
++  const char ***pazValue,      /* OUT: Column data */
++  const char ***pazColName     /* OUT: Column names and datatypes */
++);
++
++/*
++** This routine is called to delete a virtual machine after it has finished
++** executing.  The return value is the result code.  SQLITE_OK is returned
++** if the statement executed successfully and some other value is returned if
++** there was any kind of error.  If an error occurred and pzErrMsg is not
++** NULL, then an error message is written into memory obtained from malloc()
++** and *pzErrMsg is made to point to that error message.  The calling routine
++** should use sqlite_freemem() to delete this message when it has finished
++** with it.
++**
++** This routine can be called at any point during the execution of the
++** virtual machine.  If the virtual machine has not completed execution
++** when this routine is called, that is like encountering an error or
++** an interrupt.  (See sqlite_interrupt().)  Incomplete updates may be
++** rolled back and transactions cancelled,  depending on the circumstances,
++** and the result code returned will be SQLITE_ABORT.
++*/
++int sqlite_finalize(sqlite_vm*, char **pzErrMsg);
++
++/*
++** This routine deletes the virtual machine, writes any error message to
++** *pzErrMsg and returns an SQLite return code in the same way as the
++** sqlite_finalize() function.
++**
++** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual
++** machine loaded with the compiled version of the original query ready for
++** execution.
++**
++** If sqlite_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++int sqlite_reset(sqlite_vm*, char **pzErrMsg);
++
++/*
++** If the SQL that was handed to sqlite_compile contains variables that
++** are represeted in the SQL text by a question mark ('?').  This routine
++** is used to assign values to those variables.
++**
++** The first parameter is a virtual machine obtained from sqlite_compile().
++** The 2nd "idx" parameter determines which variable in the SQL statement
++** to bind the value to.  The left most '?' is 1.  The 3rd parameter is
++** the value to assign to that variable.  The 4th parameter is the number
++** of bytes in the value, including the terminating \000 for strings.
++** Finally, the 5th "copy" parameter is TRUE if SQLite should make its
++** own private copy of this value, or false if the space that the 3rd
++** parameter points to will be unchanging and can be used directly by
++** SQLite.
++**
++** Unbound variables are treated as having a value of NULL.  To explicitly
++** set a variable to NULL, call this routine with the 3rd parameter as a
++** NULL pointer.
++**
++** If the 4th "len" parameter is -1, then strlen() is used to find the
++** length.
++**
++** This routine can only be called immediately after sqlite_compile()
++** or sqlite_reset() and before any calls to sqlite_step().
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++int sqlite_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
++
++/*
++** This routine configures a callback function - the progress callback - that
++** is invoked periodically during long running calls to sqlite_exec(),
++** sqlite_step() and sqlite_get_table(). An example use for this API is to keep
++** a GUI updated during a large query.
++**
++** The progress callback is invoked once for every N virtual machine opcodes,
++** where N is the second argument to this function. The progress callback
++** itself is identified by the third argument to this function. The fourth
++** argument to this function is a void pointer passed to the progress callback
++** function each time it is invoked.
++**
++** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results 
++** in less than N opcodes being executed, then the progress callback is not
++** invoked.
++** 
++** Calling this routine overwrites any previously installed progress callback.
++** To remove the progress callback altogether, pass NULL as the third
++** argument to this function.
++**
++** If the progress callback returns a result other than 0, then the current 
++** query is immediately terminated and any database changes rolled back. If the
++** query was part of a larger transaction, then the transaction is not rolled
++** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. 
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++void sqlite_progress_handler(sqlite*, int, int(*)(void*), void*);
++
++/*
++** Register a callback function to be invoked whenever a new transaction
++** is committed.  The pArg argument is passed through to the callback.
++** callback.  If the callback function returns non-zero, then the commit
++** is converted into a rollback.
++**
++** If another function was previously registered, its pArg value is returned.
++** Otherwise NULL is returned.
++**
++** Registering a NULL function disables the callback.
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++void *sqlite_commit_hook(sqlite*, int(*)(void*), void*);
++
++/*
++** Open an encrypted SQLite database.  If pKey==0 or nKey==0, this routine
++** is the same as sqlite_open().
++**
++** The code to implement this API is not available in the public release
++** of SQLite.
++*/
++sqlite *sqlite_open_encrypted(
++  const char *zFilename,   /* Name of the encrypted database */
++  const void *pKey,        /* Pointer to the key */
++  int nKey,                /* Number of bytes in the key */
++  int *pErrcode,           /* Write error code here */
++  char **pzErrmsg          /* Write error message here */
++);
++
++/*
++** Change the key on an open database.  If the current database is not
++** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
++** database is decrypted.
++**
++** The code to implement this API is not available in the public release
++** of SQLite.
++*/
++int sqlite_rekey(
++  sqlite *db,                    /* Database to be rekeyed */
++  const void *pKey, int nKey     /* The new key */
++);
++
++/*
++** Encode a binary buffer "in" of size n bytes so that it contains
++** no instances of characters '\'' or '\000'.  The output is 
++** null-terminated and can be used as a string value in an INSERT
++** or UPDATE statement.  Use sqlite_decode_binary() to convert the
++** string back into its original binary.
++**
++** The result is written into a preallocated output buffer "out".
++** "out" must be able to hold at least 2 +(257*n)/254 bytes.
++** In other words, the output will be expanded by as much as 3
++** bytes for every 254 bytes of input plus 2 bytes of fixed overhead.
++** (This is approximately 2 + 1.0118*n or about a 1.2% size increase.)
++**
++** The return value is the number of characters in the encoded
++** string, excluding the "\000" terminator.
++**
++** If out==NULL then no output is generated but the routine still returns
++** the number of characters that would have been generated if out had
++** not been NULL.
++*/
++int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);
++
++/*
++** Decode the string "in" into binary data and write it into "out".
++** This routine reverses the encoding created by sqlite_encode_binary().
++** The output will always be a few bytes less than the input.  The number
++** of bytes of output is returned.  If the input is not a well-formed
++** encoding, -1 is returned.
++**
++** The "in" and "out" parameters may point to the same buffer in order
++** to decode a string in place.
++*/
++int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
++
++#ifdef __cplusplus
++}  /* End of the 'extern "C"' block */
++#endif
++
++#endif /* _SQLITE_H_ */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/sqliteInt.h
+@@ -0,0 +1,1270 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** Internal interface definitions for SQLite.
++**
++** @(#) $Id$
++*/
++#include "config.h"
++#include "sqlite.h"
++#include "hash.h"
++#include "parse.h"
++#include "btree.h"
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <assert.h>
++
++/*
++** The maximum number of in-memory pages to use for the main database
++** table and for temporary tables.
++*/
++#define MAX_PAGES   2000
++#define TEMP_PAGES   500
++
++/*
++** If the following macro is set to 1, then NULL values are considered
++** distinct for the SELECT DISTINCT statement and for UNION or EXCEPT
++** compound queries.  No other SQL database engine (among those tested) 
++** works this way except for OCELOT.  But the SQL92 spec implies that
++** this is how things should work.
++**
++** If the following macro is set to 0, then NULLs are indistinct for
++** SELECT DISTINCT and for UNION.
++*/
++#define NULL_ALWAYS_DISTINCT 0
++
++/*
++** If the following macro is set to 1, then NULL values are considered
++** distinct when determining whether or not two entries are the same
++** in a UNIQUE index.  This is the way PostgreSQL, Oracle, DB2, MySQL,
++** OCELOT, and Firebird all work.  The SQL92 spec explicitly says this
++** is the way things are suppose to work.
++**
++** If the following macro is set to 0, the NULLs are indistinct for
++** a UNIQUE index.  In this mode, you can only have a single NULL entry
++** for a column declared UNIQUE.  This is the way Informix and SQL Server
++** work.
++*/
++#define NULL_DISTINCT_FOR_UNIQUE 1
++
++/*
++** The maximum number of attached databases.  This must be at least 2
++** in order to support the main database file (0) and the file used to
++** hold temporary tables (1).  And it must be less than 256 because
++** an unsigned character is used to stored the database index.
++*/
++#define MAX_ATTACHED 10
++
++/*
++** The next macro is used to determine where TEMP tables and indices
++** are stored.  Possible values:
++**
++**   0    Always use a temporary files
++**   1    Use a file unless overridden by "PRAGMA temp_store"
++**   2    Use memory unless overridden by "PRAGMA temp_store"
++**   3    Always use memory
++*/
++#ifndef TEMP_STORE
++# define TEMP_STORE 1
++#endif
++
++/*
++** When building SQLite for embedded systems where memory is scarce,
++** you can define one or more of the following macros to omit extra
++** features of the library and thus keep the size of the library to
++** a minimum.
++*/
++/* #define SQLITE_OMIT_AUTHORIZATION  1 */
++/* #define SQLITE_OMIT_INMEMORYDB     1 */
++/* #define SQLITE_OMIT_VACUUM         1 */
++/* #define SQLITE_OMIT_DATETIME_FUNCS 1 */
++/* #define SQLITE_OMIT_PROGRESS_CALLBACK 1 */
++
++/*
++** Integers of known sizes.  These typedefs might change for architectures
++** where the sizes very.  Preprocessor macros are available so that the
++** types can be conveniently redefined at compile-type.  Like this:
++**
++**         cc '-DUINTPTR_TYPE=long long int' ...
++*/
++#ifndef UINT32_TYPE
++# define UINT32_TYPE unsigned int
++#endif
++#ifndef UINT16_TYPE
++# define UINT16_TYPE unsigned short int
++#endif
++#ifndef INT16_TYPE
++# define INT16_TYPE short int
++#endif
++#ifndef UINT8_TYPE
++# define UINT8_TYPE unsigned char
++#endif
++#ifndef INT8_TYPE
++# define INT8_TYPE signed char
++#endif
++#ifndef INTPTR_TYPE
++# if SQLITE_PTR_SZ==4
++#   define INTPTR_TYPE int
++# else
++#   define INTPTR_TYPE long long
++# endif
++#endif
++typedef UINT32_TYPE u32;           /* 4-byte unsigned integer */
++typedef UINT16_TYPE u16;           /* 2-byte unsigned integer */
++typedef INT16_TYPE i16;            /* 2-byte signed integer */
++typedef UINT8_TYPE u8;             /* 1-byte unsigned integer */
++typedef UINT8_TYPE i8;             /* 1-byte signed integer */
++typedef INTPTR_TYPE ptr;           /* Big enough to hold a pointer */
++typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */
++
++/*
++** Defer sourcing vdbe.h until after the "u8" typedef is defined.
++*/
++#include "vdbe.h"
++
++/*
++** Most C compilers these days recognize "long double", don't they?
++** Just in case we encounter one that does not, we will create a macro
++** for long double so that it can be easily changed to just "double".
++*/
++#ifndef LONGDOUBLE_TYPE
++# define LONGDOUBLE_TYPE long double
++#endif
++
++/*
++** This macro casts a pointer to an integer.  Useful for doing
++** pointer arithmetic.
++*/
++#define Addr(X)  ((uptr)X)
++
++/*
++** The maximum number of bytes of data that can be put into a single
++** row of a single table.  The upper bound on this limit is 16777215
++** bytes (or 16MB-1).  We have arbitrarily set the limit to just 1MB
++** here because the overflow page chain is inefficient for really big
++** records and we want to discourage people from thinking that 
++** multi-megabyte records are OK.  If your needs are different, you can
++** change this define and recompile to increase or decrease the record
++** size.
++**
++** The 16777198 is computed as follows:  238 bytes of payload on the
++** original pages plus 16448 overflow pages each holding 1020 bytes of
++** data.
++*/
++#define MAX_BYTES_PER_ROW  1048576
++/* #define MAX_BYTES_PER_ROW 16777198 */
++
++/*
++** If memory allocation problems are found, recompile with
++**
++**      -DMEMORY_DEBUG=1
++**
++** to enable some sanity checking on malloc() and free().  To
++** check for memory leaks, recompile with
++**
++**      -DMEMORY_DEBUG=2
++**
++** and a line of text will be written to standard error for
++** each malloc() and free().  This output can be analyzed
++** by an AWK script to determine if there are any leaks.
++*/
++#ifdef MEMORY_DEBUG
++# define sqliteMalloc(X)    sqliteMalloc_(X,1,__FILE__,__LINE__)
++# define sqliteMallocRaw(X) sqliteMalloc_(X,0,__FILE__,__LINE__)
++# define sqliteFree(X)      sqliteFree_(X,__FILE__,__LINE__)
++# define sqliteRealloc(X,Y) sqliteRealloc_(X,Y,__FILE__,__LINE__)
++# define sqliteStrDup(X)    sqliteStrDup_(X,__FILE__,__LINE__)
++# define sqliteStrNDup(X,Y) sqliteStrNDup_(X,Y,__FILE__,__LINE__)
++  void sqliteStrRealloc(char**);
++#else
++# define sqliteRealloc_(X,Y) sqliteRealloc(X,Y)
++# define sqliteStrRealloc(X)
++#endif
++
++/*
++** This variable gets set if malloc() ever fails.  After it gets set,
++** the SQLite library shuts down permanently.
++*/
++extern int sqlite_malloc_failed;
++
++/*
++** The following global variables are used for testing and debugging
++** only.  They only work if MEMORY_DEBUG is defined.
++*/
++#ifdef MEMORY_DEBUG
++extern int sqlite_nMalloc;       /* Number of sqliteMalloc() calls */
++extern int sqlite_nFree;         /* Number of sqliteFree() calls */
++extern int sqlite_iMallocFail;   /* Fail sqliteMalloc() after this many calls */
++#endif
++
++/*
++** Name of the master database table.  The master database table
++** is a special table that holds the names and attributes of all
++** user tables and indices.
++*/
++#define MASTER_NAME       "sqlite_master"
++#define TEMP_MASTER_NAME  "sqlite_temp_master"
++
++/*
++** The name of the schema table.
++*/
++#define SCHEMA_TABLE(x)  (x?TEMP_MASTER_NAME:MASTER_NAME)
++
++/*
++** A convenience macro that returns the number of elements in
++** an array.
++*/
++#define ArraySize(X)    (sizeof(X)/sizeof(X[0]))
++
++/*
++** Forward references to structures
++*/
++typedef struct Column Column;
++typedef struct Table Table;
++typedef struct Index Index;
++typedef struct Instruction Instruction;
++typedef struct Expr Expr;
++typedef struct ExprList ExprList;
++typedef struct Parse Parse;
++typedef struct Token Token;
++typedef struct IdList IdList;
++typedef struct SrcList SrcList;
++typedef struct WhereInfo WhereInfo;
++typedef struct WhereLevel WhereLevel;
++typedef struct Select Select;
++typedef struct AggExpr AggExpr;
++typedef struct FuncDef FuncDef;
++typedef struct Trigger Trigger;
++typedef struct TriggerStep TriggerStep;
++typedef struct TriggerStack TriggerStack;
++typedef struct FKey FKey;
++typedef struct Db Db;
++typedef struct AuthContext AuthContext;
++
++/*
++** Each database file to be accessed by the system is an instance
++** of the following structure.  There are normally two of these structures
++** in the sqlite.aDb[] array.  aDb[0] is the main database file and
++** aDb[1] is the database file used to hold temporary tables.  Additional
++** databases may be attached.
++*/
++struct Db {
++  char *zName;         /* Name of this database */
++  Btree *pBt;          /* The B*Tree structure for this database file */
++  int schema_cookie;   /* Database schema version number for this file */
++  Hash tblHash;        /* All tables indexed by name */
++  Hash idxHash;        /* All (named) indices indexed by name */
++  Hash trigHash;       /* All triggers indexed by name */
++  Hash aFKey;          /* Foreign keys indexed by to-table */
++  u8 inTrans;          /* 0: not writable.  1: Transaction.  2: Checkpoint */
++  u16 flags;           /* Flags associated with this database */
++  void *pAux;          /* Auxiliary data.  Usually NULL */
++  void (*xFreeAux)(void*);  /* Routine to free pAux */
++};
++
++/*
++** These macros can be used to test, set, or clear bits in the 
++** Db.flags field.
++*/
++#define DbHasProperty(D,I,P)     (((D)->aDb[I].flags&(P))==(P))
++#define DbHasAnyProperty(D,I,P)  (((D)->aDb[I].flags&(P))!=0)
++#define DbSetProperty(D,I,P)     (D)->aDb[I].flags|=(P)
++#define DbClearProperty(D,I,P)   (D)->aDb[I].flags&=~(P)
++
++/*
++** Allowed values for the DB.flags field.
++**
++** The DB_Locked flag is set when the first OP_Transaction or OP_Checkpoint
++** opcode is emitted for a database.  This prevents multiple occurances
++** of those opcodes for the same database in the same program.  Similarly,
++** the DB_Cookie flag is set when the OP_VerifyCookie opcode is emitted,
++** and prevents duplicate OP_VerifyCookies from taking up space and slowing
++** down execution.
++**
++** The DB_SchemaLoaded flag is set after the database schema has been
++** read into internal hash tables.
++**
++** DB_UnresetViews means that one or more views have column names that
++** have been filled out.  If the schema changes, these column names might
++** changes and so the view will need to be reset.
++*/
++#define DB_Locked          0x0001  /* OP_Transaction opcode has been emitted */
++#define DB_Cookie          0x0002  /* OP_VerifyCookie opcode has been emiited */
++#define DB_SchemaLoaded    0x0004  /* The schema has been loaded */
++#define DB_UnresetViews    0x0008  /* Some views have defined column names */
++
++
++/*
++** Each database is an instance of the following structure.
++**
++** The sqlite.file_format is initialized by the database file
++** and helps determines how the data in the database file is
++** represented.  This field allows newer versions of the library
++** to read and write older databases.  The various file formats
++** are as follows:
++**
++**     file_format==1    Version 2.1.0.
++**     file_format==2    Version 2.2.0. Add support for INTEGER PRIMARY KEY.
++**     file_format==3    Version 2.6.0. Fix empty-string index bug.
++**     file_format==4    Version 2.7.0. Add support for separate numeric and
++**                       text datatypes.
++**
++** The sqlite.temp_store determines where temporary database files
++** are stored.  If 1, then a file is created to hold those tables.  If
++** 2, then they are held in memory.  0 means use the default value in
++** the TEMP_STORE macro.
++**
++** The sqlite.lastRowid records the last insert rowid generated by an
++** insert statement.  Inserts on views do not affect its value.  Each
++** trigger has its own context, so that lastRowid can be updated inside
++** triggers as usual.  The previous value will be restored once the trigger
++** exits.  Upon entering a before or instead of trigger, lastRowid is no
++** longer (since after version 2.8.12) reset to -1.
++**
++** The sqlite.nChange does not count changes within triggers and keeps no
++** context.  It is reset at start of sqlite_exec.
++** The sqlite.lsChange represents the number of changes made by the last
++** insert, update, or delete statement.  It remains constant throughout the
++** length of a statement and is then updated by OP_SetCounts.  It keeps a
++** context stack just like lastRowid so that the count of changes
++** within a trigger is not seen outside the trigger.  Changes to views do not
++** affect the value of lsChange.
++** The sqlite.csChange keeps track of the number of current changes (since
++** the last statement) and is used to update sqlite_lsChange.
++*/
++struct sqlite {
++  int nDb;                      /* Number of backends currently in use */
++  Db *aDb;                      /* All backends */
++  Db aDbStatic[2];              /* Static space for the 2 default backends */
++  int flags;                    /* Miscellanous flags. See below */
++  u8 file_format;               /* What file format version is this database? */
++  u8 safety_level;              /* How aggressive at synching data to disk */
++  u8 want_to_close;             /* Close after all VDBEs are deallocated */
++  u8 temp_store;                /* 1=file, 2=memory, 0=compile-time default */
++  u8 onError;                   /* Default conflict algorithm */
++  int next_cookie;              /* Next value of aDb[0].schema_cookie */
++  int cache_size;               /* Number of pages to use in the cache */
++  int nTable;                   /* Number of tables in the database */
++  void *pBusyArg;               /* 1st Argument to the busy callback */
++  int (*xBusyCallback)(void *,const char*,int);  /* The busy callback */
++  void *pCommitArg;             /* Argument to xCommitCallback() */   
++  int (*xCommitCallback)(void*);/* Invoked at every commit. */
++  Hash aFunc;                   /* All functions that can be in SQL exprs */
++  int lastRowid;                /* ROWID of most recent insert (see above) */
++  int priorNewRowid;            /* Last randomly generated ROWID */
++  int magic;                    /* Magic number for detect library misuse */
++  int nChange;                  /* Number of rows changed (see above) */
++  int lsChange;                 /* Last statement change count (see above) */
++  int csChange;                 /* Current statement change count (see above) */
++  struct sqliteInitInfo {       /* Information used during initialization */
++    int iDb;                       /* When back is being initialized */
++    int newTnum;                   /* Rootpage of table being initialized */
++    u8 busy;                       /* TRUE if currently initializing */
++  } init;
++  struct Vdbe *pVdbe;           /* List of active virtual machines */
++  void (*xTrace)(void*,const char*);     /* Trace function */
++  void *pTraceArg;                       /* Argument to the trace function */
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);
++                                /* Access authorization function */
++  void *pAuthArg;               /* 1st argument to the access auth function */
++#endif
++#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
++  int (*xProgress)(void *);     /* The progress callback */
++  void *pProgressArg;           /* Argument to the progress callback */
++  int nProgressOps;             /* Number of opcodes for progress callback */
++#endif
++};
++
++/*
++** Possible values for the sqlite.flags and or Db.flags fields.
++**
++** On sqlite.flags, the SQLITE_InTrans value means that we have
++** executed a BEGIN.  On Db.flags, SQLITE_InTrans means a statement
++** transaction is active on that particular database file.
++*/
++#define SQLITE_VdbeTrace      0x00000001  /* True to trace VDBE execution */
++#define SQLITE_Initialized    0x00000002  /* True after initialization */
++#define SQLITE_Interrupt      0x00000004  /* Cancel current operation */
++#define SQLITE_InTrans        0x00000008  /* True if in a transaction */
++#define SQLITE_InternChanges  0x00000010  /* Uncommitted Hash table changes */
++#define SQLITE_FullColNames   0x00000020  /* Show full column names on SELECT */
++#define SQLITE_ShortColNames  0x00000040  /* Show short columns names */
++#define SQLITE_CountRows      0x00000080  /* Count rows changed by INSERT, */
++                                          /*   DELETE, or UPDATE and return */
++                                          /*   the count using a callback. */
++#define SQLITE_NullCallback   0x00000100  /* Invoke the callback once if the */
++                                          /*   result set is empty */
++#define SQLITE_ReportTypes    0x00000200  /* Include information on datatypes */
++                                          /*   in 4th argument of callback */
++
++/*
++** Possible values for the sqlite.magic field.
++** The numbers are obtained at random and have no special meaning, other
++** than being distinct from one another.
++*/
++#define SQLITE_MAGIC_OPEN     0xa029a697  /* Database is open */
++#define SQLITE_MAGIC_CLOSED   0x9f3c2d33  /* Database is closed */
++#define SQLITE_MAGIC_BUSY     0xf03b7906  /* Database currently in use */
++#define SQLITE_MAGIC_ERROR    0xb5357930  /* An SQLITE_MISUSE error occurred */
++
++/*
++** Each SQL function is defined by an instance of the following
++** structure.  A pointer to this structure is stored in the sqlite.aFunc
++** hash table.  When multiple functions have the same name, the hash table
++** points to a linked list of these structures.
++*/
++struct FuncDef {
++  void (*xFunc)(sqlite_func*,int,const char**);  /* Regular function */
++  void (*xStep)(sqlite_func*,int,const char**);  /* Aggregate function step */
++  void (*xFinalize)(sqlite_func*);           /* Aggregate function finializer */
++  signed char nArg;         /* Number of arguments.  -1 means unlimited */
++  signed char dataType;     /* Arg that determines datatype.  -1=NUMERIC, */
++                            /* -2=TEXT. -3=SQLITE_ARGS */
++  u8 includeTypes;          /* Add datatypes to args of xFunc and xStep */
++  void *pUserData;          /* User data parameter */
++  FuncDef *pNext;           /* Next function with same name */
++};
++
++/*
++** information about each column of an SQL table is held in an instance
++** of this structure.
++*/
++struct Column {
++  char *zName;     /* Name of this column */
++  char *zDflt;     /* Default value of this column */
++  char *zType;     /* Data type for this column */
++  u8 notNull;      /* True if there is a NOT NULL constraint */
++  u8 isPrimKey;    /* True if this column is part of the PRIMARY KEY */
++  u8 sortOrder;    /* Some combination of SQLITE_SO_... values */
++  u8 dottedName;   /* True if zName contains a "." character */
++};
++
++/*
++** The allowed sort orders.
++**
++** The TEXT and NUM values use bits that do not overlap with DESC and ASC.
++** That way the two can be combined into a single number.
++*/
++#define SQLITE_SO_UNK       0  /* Use the default collating type.  (SCT_NUM) */
++#define SQLITE_SO_TEXT      2  /* Sort using memcmp() */
++#define SQLITE_SO_NUM       4  /* Sort using sqliteCompare() */
++#define SQLITE_SO_TYPEMASK  6  /* Mask to extract the collating sequence */
++#define SQLITE_SO_ASC       0  /* Sort in ascending order */
++#define SQLITE_SO_DESC      1  /* Sort in descending order */
++#define SQLITE_SO_DIRMASK   1  /* Mask to extract the sort direction */
++
++/*
++** Each SQL table is represented in memory by an instance of the
++** following structure.
++**
++** Table.zName is the name of the table.  The case of the original
++** CREATE TABLE statement is stored, but case is not significant for
++** comparisons.
++**
++** Table.nCol is the number of columns in this table.  Table.aCol is a
++** pointer to an array of Column structures, one for each column.
++**
++** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of
++** the column that is that key.   Otherwise Table.iPKey is negative.  Note
++** that the datatype of the PRIMARY KEY must be INTEGER for this field to
++** be set.  An INTEGER PRIMARY KEY is used as the rowid for each row of
++** the table.  If a table has no INTEGER PRIMARY KEY, then a random rowid
++** is generated for each row of the table.  Table.hasPrimKey is true if
++** the table has any PRIMARY KEY, INTEGER or otherwise.
++**
++** Table.tnum is the page number for the root BTree page of the table in the
++** database file.  If Table.iDb is the index of the database table backend
++** in sqlite.aDb[].  0 is for the main database and 1 is for the file that
++** holds temporary tables and indices.  If Table.isTransient
++** is true, then the table is stored in a file that is automatically deleted
++** when the VDBE cursor to the table is closed.  In this case Table.tnum 
++** refers VDBE cursor number that holds the table open, not to the root
++** page number.  Transient tables are used to hold the results of a
++** sub-query that appears instead of a real table name in the FROM clause 
++** of a SELECT statement.
++*/
++struct Table {
++  char *zName;     /* Name of the table */
++  int nCol;        /* Number of columns in this table */
++  Column *aCol;    /* Information about each column */
++  int iPKey;       /* If not less then 0, use aCol[iPKey] as the primary key */
++  Index *pIndex;   /* List of SQL indexes on this table. */
++  int tnum;        /* Root BTree node for this table (see note above) */
++  Select *pSelect; /* NULL for tables.  Points to definition if a view. */
++  u8 readOnly;     /* True if this table should not be written by the user */
++  u8 iDb;          /* Index into sqlite.aDb[] of the backend for this table */
++  u8 isTransient;  /* True if automatically deleted when VDBE finishes */
++  u8 hasPrimKey;   /* True if there exists a primary key */
++  u8 keyConf;      /* What to do in case of uniqueness conflict on iPKey */
++  Trigger *pTrigger; /* List of SQL triggers on this table */
++  FKey *pFKey;       /* Linked list of all foreign keys in this table */
++};
++
++/*
++** Each foreign key constraint is an instance of the following structure.
++**
++** A foreign key is associated with two tables.  The "from" table is
++** the table that contains the REFERENCES clause that creates the foreign
++** key.  The "to" table is the table that is named in the REFERENCES clause.
++** Consider this example:
++**
++**     CREATE TABLE ex1(
++**       a INTEGER PRIMARY KEY,
++**       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
++**     );
++**
++** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
++**
++** Each REFERENCES clause generates an instance of the following structure
++** which is attached to the from-table.  The to-table need not exist when
++** the from-table is created.  The existance of the to-table is not checked
++** until an attempt is made to insert data into the from-table.
++**
++** The sqlite.aFKey hash table stores pointers to this structure
++** given the name of a to-table.  For each to-table, all foreign keys
++** associated with that table are on a linked list using the FKey.pNextTo
++** field.
++*/
++struct FKey {
++  Table *pFrom;     /* The table that constains the REFERENCES clause */
++  FKey *pNextFrom;  /* Next foreign key in pFrom */
++  char *zTo;        /* Name of table that the key points to */
++  FKey *pNextTo;    /* Next foreign key that points to zTo */
++  int nCol;         /* Number of columns in this key */
++  struct sColMap {  /* Mapping of columns in pFrom to columns in zTo */
++    int iFrom;         /* Index of column in pFrom */
++    char *zCol;        /* Name of column in zTo.  If 0 use PRIMARY KEY */
++  } *aCol;          /* One entry for each of nCol column s */
++  u8 isDeferred;    /* True if constraint checking is deferred till COMMIT */
++  u8 updateConf;    /* How to resolve conflicts that occur on UPDATE */
++  u8 deleteConf;    /* How to resolve conflicts that occur on DELETE */
++  u8 insertConf;    /* How to resolve conflicts that occur on INSERT */
++};
++
++/*
++** SQLite supports many different ways to resolve a contraint
++** error.  ROLLBACK processing means that a constraint violation
++** causes the operation in process to fail and for the current transaction
++** to be rolled back.  ABORT processing means the operation in process
++** fails and any prior changes from that one operation are backed out,
++** but the transaction is not rolled back.  FAIL processing means that
++** the operation in progress stops and returns an error code.  But prior
++** changes due to the same operation are not backed out and no rollback
++** occurs.  IGNORE means that the particular row that caused the constraint
++** error is not inserted or updated.  Processing continues and no error
++** is returned.  REPLACE means that preexisting database rows that caused
++** a UNIQUE constraint violation are removed so that the new insert or
++** update can proceed.  Processing continues and no error is reported.
++**
++** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
++** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
++** same as ROLLBACK for DEFERRED keys.  SETNULL means that the foreign
++** key is set to NULL.  CASCADE means that a DELETE or UPDATE of the
++** referenced table row is propagated into the row that holds the
++** foreign key.
++** 
++** The following symbolic values are used to record which type
++** of action to take.
++*/
++#define OE_None     0   /* There is no constraint to check */
++#define OE_Rollback 1   /* Fail the operation and rollback the transaction */
++#define OE_Abort    2   /* Back out changes but do no rollback transaction */
++#define OE_Fail     3   /* Stop the operation but leave all prior changes */
++#define OE_Ignore   4   /* Ignore the error. Do not do the INSERT or UPDATE */
++#define OE_Replace  5   /* Delete existing record, then do INSERT or UPDATE */
++
++#define OE_Restrict 6   /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
++#define OE_SetNull  7   /* Set the foreign key value to NULL */
++#define OE_SetDflt  8   /* Set the foreign key value to its default */
++#define OE_Cascade  9   /* Cascade the changes */
++
++#define OE_Default  99  /* Do whatever the default action is */
++
++/*
++** Each SQL index is represented in memory by an
++** instance of the following structure.
++**
++** The columns of the table that are to be indexed are described
++** by the aiColumn[] field of this structure.  For example, suppose
++** we have the following table and index:
++**
++**     CREATE TABLE Ex1(c1 int, c2 int, c3 text);
++**     CREATE INDEX Ex2 ON Ex1(c3,c1);
++**
++** In the Table structure describing Ex1, nCol==3 because there are
++** three columns in the table.  In the Index structure describing
++** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.
++** The value of aiColumn is {2, 0}.  aiColumn[0]==2 because the 
++** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].
++** The second column to be indexed (c1) has an index of 0 in
++** Ex1.aCol[], hence Ex2.aiColumn[1]==0.
++**
++** The Index.onError field determines whether or not the indexed columns
++** must be unique and what to do if they are not.  When Index.onError=OE_None,
++** it means this is not a unique index.  Otherwise it is a unique index
++** and the value of Index.onError indicate the which conflict resolution 
++** algorithm to employ whenever an attempt is made to insert a non-unique
++** element.
++*/
++struct Index {
++  char *zName;     /* Name of this index */
++  int nColumn;     /* Number of columns in the table used by this index */
++  int *aiColumn;   /* Which columns are used by this index.  1st is 0 */
++  Table *pTable;   /* The SQL table being indexed */
++  int tnum;        /* Page containing root of this index in database file */
++  u8 onError;      /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
++  u8 autoIndex;    /* True if is automatically created (ex: by UNIQUE) */
++  u8 iDb;          /* Index in sqlite.aDb[] of where this index is stored */
++  Index *pNext;    /* The next index associated with the same table */
++};
++
++/*
++** Each token coming out of the lexer is an instance of
++** this structure.  Tokens are also used as part of an expression.
++**
++** Note if Token.z==0 then Token.dyn and Token.n are undefined and
++** may contain random values.  Do not make any assuptions about Token.dyn
++** and Token.n when Token.z==0.
++*/
++struct Token {
++  const char *z;      /* Text of the token.  Not NULL-terminated! */
++  unsigned dyn  : 1;  /* True for malloced memory, false for static */
++  unsigned n    : 31; /* Number of characters in this token */
++};
++
++/*
++** Each node of an expression in the parse tree is an instance
++** of this structure.
++**
++** Expr.op is the opcode.  The integer parser token codes are reused
++** as opcodes here.  For example, the parser defines TK_GE to be an integer
++** code representing the ">=" operator.  This same integer code is reused
++** to represent the greater-than-or-equal-to operator in the expression
++** tree.
++**
++** Expr.pRight and Expr.pLeft are subexpressions.  Expr.pList is a list
++** of argument if the expression is a function.
++**
++** Expr.token is the operator token for this node.  For some expressions
++** that have subexpressions, Expr.token can be the complete text that gave
++** rise to the Expr.  In the latter case, the token is marked as being
++** a compound token.
++**
++** An expression of the form ID or ID.ID refers to a column in a table.
++** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is
++** the integer cursor number of a VDBE cursor pointing to that table and
++** Expr.iColumn is the column number for the specific column.  If the
++** expression is used as a result in an aggregate SELECT, then the
++** value is also stored in the Expr.iAgg column in the aggregate so that
++** it can be accessed after all aggregates are computed.
++**
++** If the expression is a function, the Expr.iTable is an integer code
++** representing which function.  If the expression is an unbound variable
++** marker (a question mark character '?' in the original SQL) then the
++** Expr.iTable holds the index number for that variable.
++**
++** The Expr.pSelect field points to a SELECT statement.  The SELECT might
++** be the right operand of an IN operator.  Or, if a scalar SELECT appears
++** in an expression the opcode is TK_SELECT and Expr.pSelect is the only
++** operand.
++*/
++struct Expr {
++  u8 op;                 /* Operation performed by this node */
++  u8 dataType;           /* Either SQLITE_SO_TEXT or SQLITE_SO_NUM */
++  u8 iDb;                /* Database referenced by this expression */
++  u8 flags;              /* Various flags.  See below */
++  Expr *pLeft, *pRight;  /* Left and right subnodes */
++  ExprList *pList;       /* A list of expressions used as function arguments
++                         ** or in "<expr> IN (<expr-list)" */
++  Token token;           /* An operand token */
++  Token span;            /* Complete text of the expression */
++  int iTable, iColumn;   /* When op==TK_COLUMN, then this expr node means the
++                         ** iColumn-th field of the iTable-th table. */
++  int iAgg;              /* When op==TK_COLUMN and pParse->useAgg==TRUE, pull
++                         ** result from the iAgg-th element of the aggregator */
++  Select *pSelect;       /* When the expression is a sub-select.  Also the
++                         ** right side of "<expr> IN (<select>)" */
++};
++
++/*
++** The following are the meanings of bits in the Expr.flags field.
++*/
++#define EP_FromJoin     0x0001  /* Originated in ON or USING clause of a join */
++
++/*
++** These macros can be used to test, set, or clear bits in the 
++** Expr.flags field.
++*/
++#define ExprHasProperty(E,P)     (((E)->flags&(P))==(P))
++#define ExprHasAnyProperty(E,P)  (((E)->flags&(P))!=0)
++#define ExprSetProperty(E,P)     (E)->flags|=(P)
++#define ExprClearProperty(E,P)   (E)->flags&=~(P)
++
++/*
++** A list of expressions.  Each expression may optionally have a
++** name.  An expr/name combination can be used in several ways, such
++** as the list of "expr AS ID" fields following a "SELECT" or in the
++** list of "ID = expr" items in an UPDATE.  A list of expressions can
++** also be used as the argument to a function, in which case the a.zName
++** field is not used.
++*/
++struct ExprList {
++  int nExpr;             /* Number of expressions on the list */
++  int nAlloc;            /* Number of entries allocated below */
++  struct ExprList_item {
++    Expr *pExpr;           /* The list of expressions */
++    char *zName;           /* Token associated with this expression */
++    u8 sortOrder;          /* 1 for DESC or 0 for ASC */
++    u8 isAgg;              /* True if this is an aggregate like count(*) */
++    u8 done;               /* A flag to indicate when processing is finished */
++  } *a;                  /* One entry for each expression */
++};
++
++/*
++** An instance of this structure can hold a simple list of identifiers,
++** such as the list "a,b,c" in the following statements:
++**
++**      INSERT INTO t(a,b,c) VALUES ...;
++**      CREATE INDEX idx ON t(a,b,c);
++**      CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;
++**
++** The IdList.a.idx field is used when the IdList represents the list of
++** column names after a table name in an INSERT statement.  In the statement
++**
++**     INSERT INTO t(a,b,c) ...
++**
++** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
++*/
++struct IdList {
++  int nId;         /* Number of identifiers on the list */
++  int nAlloc;      /* Number of entries allocated for a[] below */
++  struct IdList_item {
++    char *zName;      /* Name of the identifier */
++    int idx;          /* Index in some Table.aCol[] of a column named zName */
++  } *a;
++};
++
++/*
++** The following structure describes the FROM clause of a SELECT statement.
++** Each table or subquery in the FROM clause is a separate element of
++** the SrcList.a[] array.
++**
++** With the addition of multiple database support, the following structure
++** can also be used to describe a particular table such as the table that
++** is modified by an INSERT, DELETE, or UPDATE statement.  In standard SQL,
++** such a table must be a simple name: ID.  But in SQLite, the table can
++** now be identified by a database name, a dot, then the table name: ID.ID.
++*/
++struct SrcList {
++  i16 nSrc;        /* Number of tables or subqueries in the FROM clause */
++  i16 nAlloc;      /* Number of entries allocated in a[] below */
++  struct SrcList_item {
++    char *zDatabase;  /* Name of database holding this table */
++    char *zName;      /* Name of the table */
++    char *zAlias;     /* The "B" part of a "A AS B" phrase.  zName is the "A" */
++    Table *pTab;      /* An SQL table corresponding to zName */
++    Select *pSelect;  /* A SELECT statement used in place of a table name */
++    int jointype;     /* Type of join between this table and the next */
++    int iCursor;      /* The VDBE cursor number used to access this table */
++    Expr *pOn;        /* The ON clause of a join */
++    IdList *pUsing;   /* The USING clause of a join */
++  } a[1];             /* One entry for each identifier on the list */
++};
++
++/*
++** Permitted values of the SrcList.a.jointype field
++*/
++#define JT_INNER     0x0001    /* Any kind of inner or cross join */
++#define JT_NATURAL   0x0002    /* True for a "natural" join */
++#define JT_LEFT      0x0004    /* Left outer join */
++#define JT_RIGHT     0x0008    /* Right outer join */
++#define JT_OUTER     0x0010    /* The "OUTER" keyword is present */
++#define JT_ERROR     0x0020    /* unknown or unsupported join type */
++
++/*
++** For each nested loop in a WHERE clause implementation, the WhereInfo
++** structure contains a single instance of this structure.  This structure
++** is intended to be private the the where.c module and should not be
++** access or modified by other modules.
++*/
++struct WhereLevel {
++  int iMem;            /* Memory cell used by this level */
++  Index *pIdx;         /* Index used */
++  int iCur;            /* Cursor number used for this index */
++  int score;           /* How well this indexed scored */
++  int brk;             /* Jump here to break out of the loop */
++  int cont;            /* Jump here to continue with the next loop cycle */
++  int op, p1, p2;      /* Opcode used to terminate the loop */
++  int iLeftJoin;       /* Memory cell used to implement LEFT OUTER JOIN */
++  int top;             /* First instruction of interior of the loop */
++  int inOp, inP1, inP2;/* Opcode used to implement an IN operator */
++  int bRev;            /* Do the scan in the reverse direction */
++};
++
++/*
++** The WHERE clause processing routine has two halves.  The
++** first part does the start of the WHERE loop and the second
++** half does the tail of the WHERE loop.  An instance of
++** this structure is returned by the first half and passed
++** into the second half to give some continuity.
++*/
++struct WhereInfo {
++  Parse *pParse;
++  SrcList *pTabList;   /* List of tables in the join */
++  int iContinue;       /* Jump here to continue with next record */
++  int iBreak;          /* Jump here to break out of the loop */
++  int nLevel;          /* Number of nested loop */
++  int savedNTab;       /* Value of pParse->nTab before WhereBegin() */
++  int peakNTab;        /* Value of pParse->nTab after WhereBegin() */
++  WhereLevel a[1];     /* Information about each nest loop in the WHERE */
++};
++
++/*
++** An instance of the following structure contains all information
++** needed to generate code for a single SELECT statement.
++**
++** The zSelect field is used when the Select structure must be persistent.
++** Normally, the expression tree points to tokens in the original input
++** string that encodes the select.  But if the Select structure must live
++** longer than its input string (for example when it is used to describe
++** a VIEW) we have to make a copy of the input string so that the nodes
++** of the expression tree will have something to point to.  zSelect is used
++** to hold that copy.
++**
++** nLimit is set to -1 if there is no LIMIT clause.  nOffset is set to 0.
++** If there is a LIMIT clause, the parser sets nLimit to the value of the
++** limit and nOffset to the value of the offset (or 0 if there is not
++** offset).  But later on, nLimit and nOffset become the memory locations
++** in the VDBE that record the limit and offset counters.
++*/
++struct Select {
++  ExprList *pEList;      /* The fields of the result */
++  u8 op;                 /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
++  u8 isDistinct;         /* True if the DISTINCT keyword is present */
++  SrcList *pSrc;         /* The FROM clause */
++  Expr *pWhere;          /* The WHERE clause */
++  ExprList *pGroupBy;    /* The GROUP BY clause */
++  Expr *pHaving;         /* The HAVING clause */
++  ExprList *pOrderBy;    /* The ORDER BY clause */
++  Select *pPrior;        /* Prior select in a compound select statement */
++  int nLimit, nOffset;   /* LIMIT and OFFSET values.  -1 means not used */
++  int iLimit, iOffset;   /* Memory registers holding LIMIT & OFFSET counters */
++  char *zSelect;         /* Complete text of the SELECT command */
++};
++
++/*
++** The results of a select can be distributed in several ways.
++*/
++#define SRT_Callback     1  /* Invoke a callback with each row of result */
++#define SRT_Mem          2  /* Store result in a memory cell */
++#define SRT_Set          3  /* Store result as unique keys in a table */
++#define SRT_Union        5  /* Store result as keys in a table */
++#define SRT_Except       6  /* Remove result from a UNION table */
++#define SRT_Table        7  /* Store result as data with a unique key */
++#define SRT_TempTable    8  /* Store result in a trasient table */
++#define SRT_Discard      9  /* Do not save the results anywhere */
++#define SRT_Sorter      10  /* Store results in the sorter */
++#define SRT_Subroutine  11  /* Call a subroutine to handle results */
++
++/*
++** When a SELECT uses aggregate functions (like "count(*)" or "avg(f1)")
++** we have to do some additional analysis of expressions.  An instance
++** of the following structure holds information about a single subexpression
++** somewhere in the SELECT statement.  An array of these structures holds
++** all the information we need to generate code for aggregate
++** expressions.
++**
++** Note that when analyzing a SELECT containing aggregates, both
++** non-aggregate field variables and aggregate functions are stored
++** in the AggExpr array of the Parser structure.
++**
++** The pExpr field points to an expression that is part of either the
++** field list, the GROUP BY clause, the HAVING clause or the ORDER BY
++** clause.  The expression will be freed when those clauses are cleaned
++** up.  Do not try to delete the expression attached to AggExpr.pExpr.
++**
++** If AggExpr.pExpr==0, that means the expression is "count(*)".
++*/
++struct AggExpr {
++  int isAgg;        /* if TRUE contains an aggregate function */
++  Expr *pExpr;      /* The expression */
++  FuncDef *pFunc;   /* Information about the aggregate function */
++};
++
++/*
++** An SQL parser context.  A copy of this structure is passed through
++** the parser and down into all the parser action routine in order to
++** carry around information that is global to the entire parse.
++*/
++struct Parse {
++  sqlite *db;          /* The main database structure */
++  int rc;              /* Return code from execution */
++  char *zErrMsg;       /* An error message */
++  Token sErrToken;     /* The token at which the error occurred */
++  Token sFirstToken;   /* The first token parsed */
++  Token sLastToken;    /* The last token parsed */
++  const char *zTail;   /* All SQL text past the last semicolon parsed */
++  Table *pNewTable;    /* A table being constructed by CREATE TABLE */
++  Vdbe *pVdbe;         /* An engine for executing database bytecode */
++  u8 colNamesSet;      /* TRUE after OP_ColumnName has been issued to pVdbe */
++  u8 explain;          /* True if the EXPLAIN flag is found on the query */
++  u8 nameClash;        /* A permanent table name clashes with temp table name */
++  u8 useAgg;           /* If true, extract field values from the aggregator
++                       ** while generating expressions.  Normally false */
++  int nErr;            /* Number of errors seen */
++  int nTab;            /* Number of previously allocated VDBE cursors */
++  int nMem;            /* Number of memory cells used so far */
++  int nSet;            /* Number of sets used so far */
++  int nAgg;            /* Number of aggregate expressions */
++  int nVar;            /* Number of '?' variables seen in the SQL so far */
++  AggExpr *aAgg;       /* An array of aggregate expressions */
++  const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
++  Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */
++  TriggerStack *trigStack;  /* Trigger actions being coded */
++};
++
++/*
++** An instance of the following structure can be declared on a stack and used
++** to save the Parse.zAuthContext value so that it can be restored later.
++*/
++struct AuthContext {
++  const char *zAuthContext;   /* Put saved Parse.zAuthContext here */
++  Parse *pParse;              /* The Parse structure */
++};
++
++/*
++** Bitfield flags for P2 value in OP_PutIntKey and OP_Delete
++*/
++#define OPFLAG_NCHANGE   1    /* Set to update db->nChange */
++#define OPFLAG_LASTROWID 2    /* Set to update db->lastRowid */
++#define OPFLAG_CSCHANGE  4    /* Set to update db->csChange */
++
++/*
++ * Each trigger present in the database schema is stored as an instance of
++ * struct Trigger. 
++ *
++ * Pointers to instances of struct Trigger are stored in two ways.
++ * 1. In the "trigHash" hash table (part of the sqlite* that represents the 
++ *    database). This allows Trigger structures to be retrieved by name.
++ * 2. All triggers associated with a single table form a linked list, using the
++ *    pNext member of struct Trigger. A pointer to the first element of the
++ *    linked list is stored as the "pTrigger" member of the associated
++ *    struct Table.
++ *
++ * The "step_list" member points to the first element of a linked list
++ * containing the SQL statements specified as the trigger program.
++ */
++struct Trigger {
++  char *name;             /* The name of the trigger                        */
++  char *table;            /* The table or view to which the trigger applies */
++  u8 iDb;                 /* Database containing this trigger               */
++  u8 iTabDb;              /* Database containing Trigger.table              */
++  u8 op;                  /* One of TK_DELETE, TK_UPDATE, TK_INSERT         */
++  u8 tr_tm;               /* One of TK_BEFORE, TK_AFTER */
++  Expr *pWhen;            /* The WHEN clause of the expresion (may be NULL) */
++  IdList *pColumns;       /* If this is an UPDATE OF <column-list> trigger,
++                             the <column-list> is stored here */
++  int foreach;            /* One of TK_ROW or TK_STATEMENT */
++  Token nameToken;        /* Token containing zName. Use during parsing only */
++
++  TriggerStep *step_list; /* Link list of trigger program steps             */
++  Trigger *pNext;         /* Next trigger associated with the table */
++};
++
++/*
++ * An instance of struct TriggerStep is used to store a single SQL statement
++ * that is a part of a trigger-program. 
++ *
++ * Instances of struct TriggerStep are stored in a singly linked list (linked
++ * using the "pNext" member) referenced by the "step_list" member of the 
++ * associated struct Trigger instance. The first element of the linked list is
++ * the first step of the trigger-program.
++ * 
++ * The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or
++ * "SELECT" statement. The meanings of the other members is determined by the 
++ * value of "op" as follows:
++ *
++ * (op == TK_INSERT)
++ * orconf    -> stores the ON CONFLICT algorithm
++ * pSelect   -> If this is an INSERT INTO ... SELECT ... statement, then
++ *              this stores a pointer to the SELECT statement. Otherwise NULL.
++ * target    -> A token holding the name of the table to insert into.
++ * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then
++ *              this stores values to be inserted. Otherwise NULL.
++ * pIdList   -> If this is an INSERT INTO ... (<column-names>) VALUES ... 
++ *              statement, then this stores the column-names to be
++ *              inserted into.
++ *
++ * (op == TK_DELETE)
++ * target    -> A token holding the name of the table to delete from.
++ * pWhere    -> The WHERE clause of the DELETE statement if one is specified.
++ *              Otherwise NULL.
++ * 
++ * (op == TK_UPDATE)
++ * target    -> A token holding the name of the table to update rows of.
++ * pWhere    -> The WHERE clause of the UPDATE statement if one is specified.
++ *              Otherwise NULL.
++ * pExprList -> A list of the columns to update and the expressions to update
++ *              them to. See sqliteUpdate() documentation of "pChanges"
++ *              argument.
++ * 
++ */
++struct TriggerStep {
++  int op;              /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
++  int orconf;          /* OE_Rollback etc. */
++  Trigger *pTrig;      /* The trigger that this step is a part of */
++
++  Select *pSelect;     /* Valid for SELECT and sometimes 
++                        INSERT steps (when pExprList == 0) */
++  Token target;        /* Valid for DELETE, UPDATE, INSERT steps */
++  Expr *pWhere;        /* Valid for DELETE, UPDATE steps */
++  ExprList *pExprList; /* Valid for UPDATE statements and sometimes 
++                         INSERT steps (when pSelect == 0)         */
++  IdList *pIdList;     /* Valid for INSERT statements only */
++
++  TriggerStep * pNext; /* Next in the link-list */
++};
++
++/*
++ * An instance of struct TriggerStack stores information required during code
++ * generation of a single trigger program. While the trigger program is being
++ * coded, its associated TriggerStack instance is pointed to by the
++ * "pTriggerStack" member of the Parse structure.
++ *
++ * The pTab member points to the table that triggers are being coded on. The 
++ * newIdx member contains the index of the vdbe cursor that points at the temp
++ * table that stores the new.* references. If new.* references are not valid
++ * for the trigger being coded (for example an ON DELETE trigger), then newIdx
++ * is set to -1. The oldIdx member is analogous to newIdx, for old.* references.
++ *
++ * The ON CONFLICT policy to be used for the trigger program steps is stored 
++ * as the orconf member. If this is OE_Default, then the ON CONFLICT clause 
++ * specified for individual triggers steps is used.
++ *
++ * struct TriggerStack has a "pNext" member, to allow linked lists to be
++ * constructed. When coding nested triggers (triggers fired by other triggers)
++ * each nested trigger stores its parent trigger's TriggerStack as the "pNext" 
++ * pointer. Once the nested trigger has been coded, the pNext value is restored
++ * to the pTriggerStack member of the Parse stucture and coding of the parent
++ * trigger continues.
++ *
++ * Before a nested trigger is coded, the linked list pointed to by the 
++ * pTriggerStack is scanned to ensure that the trigger is not about to be coded
++ * recursively. If this condition is detected, the nested trigger is not coded.
++ */
++struct TriggerStack {
++  Table *pTab;         /* Table that triggers are currently being coded on */
++  int newIdx;          /* Index of vdbe cursor to "new" temp table */
++  int oldIdx;          /* Index of vdbe cursor to "old" temp table */
++  int orconf;          /* Current orconf policy */
++  int ignoreJump;      /* where to jump to for a RAISE(IGNORE) */
++  Trigger *pTrigger;   /* The trigger currently being coded */
++  TriggerStack *pNext; /* Next trigger down on the trigger stack */
++};
++
++/*
++** The following structure contains information used by the sqliteFix...
++** routines as they walk the parse tree to make database references
++** explicit.  
++*/
++typedef struct DbFixer DbFixer;
++struct DbFixer {
++  Parse *pParse;      /* The parsing context.  Error messages written here */
++  const char *zDb;    /* Make sure all objects are contained in this database */
++  const char *zType;  /* Type of the container - used for error messages */
++  const Token *pName; /* Name of the container - used for error messages */
++};
++
++/*
++ * This global flag is set for performance testing of triggers. When it is set
++ * SQLite will perform the overhead of building new and old trigger references 
++ * even when no triggers exist
++ */
++extern int always_code_trigger_setup;
++
++/*
++** Internal function prototypes
++*/
++int sqliteStrICmp(const char *, const char *);
++int sqliteStrNICmp(const char *, const char *, int);
++int sqliteHashNoCase(const char *, int);
++int sqliteIsNumber(const char*);
++int sqliteCompare(const char *, const char *);
++int sqliteSortCompare(const char *, const char *);
++void sqliteRealToSortable(double r, char *);
++#ifdef MEMORY_DEBUG
++  void *sqliteMalloc_(int,int,char*,int);
++  void sqliteFree_(void*,char*,int);
++  void *sqliteRealloc_(void*,int,char*,int);
++  char *sqliteStrDup_(const char*,char*,int);
++  char *sqliteStrNDup_(const char*, int,char*,int);
++  void sqliteCheckMemory(void*,int);
++#else
++  void *sqliteMalloc(int);
++  void *sqliteMallocRaw(int);
++  void sqliteFree(void*);
++  void *sqliteRealloc(void*,int);
++  char *sqliteStrDup(const char*);
++  char *sqliteStrNDup(const char*, int);
++# define sqliteCheckMemory(a,b)
++#endif
++char *sqliteMPrintf(const char*, ...);
++char *sqliteVMPrintf(const char*, va_list);
++void sqliteSetString(char **, ...);
++void sqliteSetNString(char **, ...);
++void sqliteErrorMsg(Parse*, const char*, ...);
++void sqliteDequote(char*);
++int sqliteKeywordCode(const char*, int);
++int sqliteRunParser(Parse*, const char*, char **);
++void sqliteExec(Parse*);
++Expr *sqliteExpr(int, Expr*, Expr*, Token*);
++void sqliteExprSpan(Expr*,Token*,Token*);
++Expr *sqliteExprFunction(ExprList*, Token*);
++void sqliteExprDelete(Expr*);
++ExprList *sqliteExprListAppend(ExprList*,Expr*,Token*);
++void sqliteExprListDelete(ExprList*);
++int sqliteInit(sqlite*, char**);
++void sqlitePragma(Parse*,Token*,Token*,int);
++void sqliteResetInternalSchema(sqlite*, int);
++void sqliteBeginParse(Parse*,int);
++void sqliteRollbackInternalChanges(sqlite*);
++void sqliteCommitInternalChanges(sqlite*);
++Table *sqliteResultSetOfSelect(Parse*,char*,Select*);
++void sqliteOpenMasterTable(Vdbe *v, int);
++void sqliteStartTable(Parse*,Token*,Token*,int,int);
++void sqliteAddColumn(Parse*,Token*);
++void sqliteAddNotNull(Parse*, int);
++void sqliteAddPrimaryKey(Parse*, IdList*, int);
++void sqliteAddColumnType(Parse*,Token*,Token*);
++void sqliteAddDefaultValue(Parse*,Token*,int);
++int sqliteCollateType(const char*, int);
++void sqliteAddCollateType(Parse*, int);
++void sqliteEndTable(Parse*,Token*,Select*);
++void sqliteCreateView(Parse*,Token*,Token*,Select*,int);
++int sqliteViewGetColumnNames(Parse*,Table*);
++void sqliteDropTable(Parse*, Token*, int);
++void sqliteDeleteTable(sqlite*, Table*);
++void sqliteInsert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
++IdList *sqliteIdListAppend(IdList*, Token*);
++int sqliteIdListIndex(IdList*,const char*);
++SrcList *sqliteSrcListAppend(SrcList*, Token*, Token*);
++void sqliteSrcListAddAlias(SrcList*, Token*);
++void sqliteSrcListAssignCursors(Parse*, SrcList*);
++void sqliteIdListDelete(IdList*);
++void sqliteSrcListDelete(SrcList*);
++void sqliteCreateIndex(Parse*,Token*,SrcList*,IdList*,int,Token*,Token*);
++void sqliteDropIndex(Parse*, SrcList*);
++void sqliteAddKeyType(Vdbe*, ExprList*);
++void sqliteAddIdxKeyType(Vdbe*, Index*);
++int sqliteSelect(Parse*, Select*, int, int, Select*, int, int*);
++Select *sqliteSelectNew(ExprList*,SrcList*,Expr*,ExprList*,Expr*,ExprList*,
++                        int,int,int);
++void sqliteSelectDelete(Select*);
++void sqliteSelectUnbind(Select*);
++Table *sqliteSrcListLookup(Parse*, SrcList*);
++int sqliteIsReadOnly(Parse*, Table*, int);
++void sqliteDeleteFrom(Parse*, SrcList*, Expr*);
++void sqliteUpdate(Parse*, SrcList*, ExprList*, Expr*, int);
++WhereInfo *sqliteWhereBegin(Parse*, SrcList*, Expr*, int, ExprList**);
++void sqliteWhereEnd(WhereInfo*);
++void sqliteExprCode(Parse*, Expr*);
++int sqliteExprCodeExprList(Parse*, ExprList*, int);
++void sqliteExprIfTrue(Parse*, Expr*, int, int);
++void sqliteExprIfFalse(Parse*, Expr*, int, int);
++Table *sqliteFindTable(sqlite*,const char*, const char*);
++Table *sqliteLocateTable(Parse*,const char*, const char*);
++Index *sqliteFindIndex(sqlite*,const char*, const char*);
++void sqliteUnlinkAndDeleteIndex(sqlite*,Index*);
++void sqliteCopy(Parse*, SrcList*, Token*, Token*, int);
++void sqliteVacuum(Parse*, Token*);
++int sqliteRunVacuum(char**, sqlite*);
++int sqliteGlobCompare(const unsigned char*,const unsigned char*);
++int sqliteLikeCompare(const unsigned char*,const unsigned char*);
++char *sqliteTableNameFromToken(Token*);
++int sqliteExprCheck(Parse*, Expr*, int, int*);
++int sqliteExprType(Expr*);
++int sqliteExprCompare(Expr*, Expr*);
++int sqliteFuncId(Token*);
++int sqliteExprResolveIds(Parse*, SrcList*, ExprList*, Expr*);
++int sqliteExprAnalyzeAggregates(Parse*, Expr*);
++Vdbe *sqliteGetVdbe(Parse*);
++void sqliteRandomness(int, void*);
++void sqliteRollbackAll(sqlite*);
++void sqliteCodeVerifySchema(Parse*, int);
++void sqliteBeginTransaction(Parse*, int);
++void sqliteCommitTransaction(Parse*);
++void sqliteRollbackTransaction(Parse*);
++int sqliteExprIsConstant(Expr*);
++int sqliteExprIsInteger(Expr*, int*);
++int sqliteIsRowid(const char*);
++void sqliteGenerateRowDelete(sqlite*, Vdbe*, Table*, int, int);
++void sqliteGenerateRowIndexDelete(sqlite*, Vdbe*, Table*, int, char*);
++void sqliteGenerateConstraintChecks(Parse*,Table*,int,char*,int,int,int,int);
++void sqliteCompleteInsertion(Parse*, Table*, int, char*, int, int, int);
++int sqliteOpenTableAndIndices(Parse*, Table*, int);
++void sqliteBeginWriteOperation(Parse*, int, int);
++void sqliteEndWriteOperation(Parse*);
++Expr *sqliteExprDup(Expr*);
++void sqliteTokenCopy(Token*, Token*);
++ExprList *sqliteExprListDup(ExprList*);
++SrcList *sqliteSrcListDup(SrcList*);
++IdList *sqliteIdListDup(IdList*);
++Select *sqliteSelectDup(Select*);
++FuncDef *sqliteFindFunction(sqlite*,const char*,int,int,int);
++void sqliteRegisterBuiltinFunctions(sqlite*);
++void sqliteRegisterDateTimeFunctions(sqlite*);
++int sqliteSafetyOn(sqlite*);
++int sqliteSafetyOff(sqlite*);
++int sqliteSafetyCheck(sqlite*);
++void sqliteChangeCookie(sqlite*, Vdbe*);
++void sqliteBeginTrigger(Parse*, Token*,int,int,IdList*,SrcList*,int,Expr*,int);
++void sqliteFinishTrigger(Parse*, TriggerStep*, Token*);
++void sqliteDropTrigger(Parse*, SrcList*);
++void sqliteDropTriggerPtr(Parse*, Trigger*, int);
++int sqliteTriggersExist(Parse* , Trigger* , int , int , int, ExprList*);
++int sqliteCodeRowTrigger(Parse*, int, ExprList*, int, Table *, int, int, 
++                         int, int);
++void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
++void sqliteDeleteTriggerStep(TriggerStep*);
++TriggerStep *sqliteTriggerSelectStep(Select*);
++TriggerStep *sqliteTriggerInsertStep(Token*, IdList*, ExprList*, Select*, int);
++TriggerStep *sqliteTriggerUpdateStep(Token*, ExprList*, Expr*, int);
++TriggerStep *sqliteTriggerDeleteStep(Token*, Expr*);
++void sqliteDeleteTrigger(Trigger*);
++int sqliteJoinType(Parse*, Token*, Token*, Token*);
++void sqliteCreateForeignKey(Parse*, IdList*, Token*, IdList*, int);
++void sqliteDeferForeignKey(Parse*, int);
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  void sqliteAuthRead(Parse*,Expr*,SrcList*);
++  int sqliteAuthCheck(Parse*,int, const char*, const char*, const char*);
++  void sqliteAuthContextPush(Parse*, AuthContext*, const char*);
++  void sqliteAuthContextPop(AuthContext*);
++#else
++# define sqliteAuthRead(a,b,c)
++# define sqliteAuthCheck(a,b,c,d,e)    SQLITE_OK
++# define sqliteAuthContextPush(a,b,c)
++# define sqliteAuthContextPop(a)  ((void)(a))
++#endif
++void sqliteAttach(Parse*, Token*, Token*, Token*);
++void sqliteDetach(Parse*, Token*);
++int sqliteBtreeFactory(const sqlite *db, const char *zFilename,
++                       int mode, int nPg, Btree **ppBtree);
++int sqliteFixInit(DbFixer*, Parse*, int, const char*, const Token*);
++int sqliteFixSrcList(DbFixer*, SrcList*);
++int sqliteFixSelect(DbFixer*, Select*);
++int sqliteFixExpr(DbFixer*, Expr*);
++int sqliteFixExprList(DbFixer*, ExprList*);
++int sqliteFixTriggerStep(DbFixer*, TriggerStep*);
++double sqliteAtoF(const char *z, const char **);
++char *sqlite_snprintf(int,char*,const char*,...);
++int sqliteFitsIn32Bits(const char *);
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/sqlite.w32.h
+@@ -0,0 +1,764 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This header file defines the interface that the SQLite library
++** presents to client programs.
++**
++** @(#) $Id$
++*/
++#ifndef _SQLITE_H_
++#define _SQLITE_H_
++#include <stdarg.h>     /* Needed for the definition of va_list */
++
++/*
++** Make sure we can call this stuff from C++.
++*/
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++** The version of the SQLite library.
++*/
++#define SQLITE_VERSION         "2.8.17"
++
++/*
++** The version string is also compiled into the library so that a program
++** can check to make sure that the lib*.a file and the *.h file are from
++** the same version.
++*/
++extern const char sqlite_version[];
++
++/*
++** The SQLITE_UTF8 macro is defined if the library expects to see
++** UTF-8 encoded data.  The SQLITE_ISO8859 macro is defined if the
++** iso8859 encoded should be used.
++*/
++#define SQLITE_ISO8859 1
++
++/*
++** The following constant holds one of two strings, "UTF-8" or "iso8859",
++** depending on which character encoding the SQLite library expects to
++** see.  The character encoding makes a difference for the LIKE and GLOB
++** operators and for the LENGTH() and SUBSTR() functions.
++*/
++extern const char sqlite_encoding[];
++
++/*
++** Each open sqlite database is represented by an instance of the
++** following opaque structure.
++*/
++typedef struct sqlite sqlite;
++
++/*
++** A function to open a new sqlite database.  
++**
++** If the database does not exist and mode indicates write
++** permission, then a new database is created.  If the database
++** does not exist and mode does not indicate write permission,
++** then the open fails, an error message generated (if errmsg!=0)
++** and the function returns 0.
++** 
++** If mode does not indicates user write permission, then the 
++** database is opened read-only.
++**
++** The Truth:  As currently implemented, all databases are opened
++** for writing all the time.  Maybe someday we will provide the
++** ability to open a database readonly.  The mode parameters is
++** provided in anticipation of that enhancement.
++*/
++sqlite *sqlite_open(const char *filename, int mode, char **errmsg);
++
++/*
++** A function to close the database.
++**
++** Call this function with a pointer to a structure that was previously
++** returned from sqlite_open() and the corresponding database will by closed.
++*/
++void sqlite_close(sqlite *);
++
++/*
++** The type for a callback function.
++*/
++typedef int (*sqlite_callback)(void*,int,char**, char**);
++
++/*
++** A function to executes one or more statements of SQL.
++**
++** If one or more of the SQL statements are queries, then
++** the callback function specified by the 3rd parameter is
++** invoked once for each row of the query result.  This callback
++** should normally return 0.  If the callback returns a non-zero
++** value then the query is aborted, all subsequent SQL statements
++** are skipped and the sqlite_exec() function returns the SQLITE_ABORT.
++**
++** The 4th parameter is an arbitrary pointer that is passed
++** to the callback function as its first parameter.
++**
++** The 2nd parameter to the callback function is the number of
++** columns in the query result.  The 3rd parameter to the callback
++** is an array of strings holding the values for each column.
++** The 4th parameter to the callback is an array of strings holding
++** the names of each column.
++**
++** The callback function may be NULL, even for queries.  A NULL
++** callback is not an error.  It just means that no callback
++** will be invoked.
++**
++** If an error occurs while parsing or evaluating the SQL (but
++** not while executing the callback) then an appropriate error
++** message is written into memory obtained from malloc() and
++** *errmsg is made to point to that message.  The calling function
++** is responsible for freeing the memory that holds the error
++** message.   Use sqlite_freemem() for this.  If errmsg==NULL,
++** then no error message is ever written.
++**
++** The return value is is SQLITE_OK if there are no errors and
++** some other return code if there is an error.  The particular
++** return value depends on the type of error. 
++**
++** If the query could not be executed because a database file is
++** locked or busy, then this function returns SQLITE_BUSY.  (This
++** behavior can be modified somewhat using the sqlite_busy_handler()
++** and sqlite_busy_timeout() functions below.)
++*/
++int sqlite_exec(
++  sqlite*,                      /* An open database */
++  const char *sql,              /* SQL to be executed */
++  sqlite_callback,              /* Callback function */
++  void *,                       /* 1st argument to callback function */
++  char **errmsg                 /* Error msg written here */
++);
++
++/*
++** Return values for sqlite_exec() and sqlite_step()
++*/
++#define SQLITE_OK           0   /* Successful result */
++#define SQLITE_ERROR        1   /* SQL error or missing database */
++#define SQLITE_INTERNAL     2   /* An internal logic error in SQLite */
++#define SQLITE_PERM         3   /* Access permission denied */
++#define SQLITE_ABORT        4   /* Callback routine requested an abort */
++#define SQLITE_BUSY         5   /* The database file is locked */
++#define SQLITE_LOCKED       6   /* A table in the database is locked */
++#define SQLITE_NOMEM        7   /* A malloc() failed */
++#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
++#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite_interrupt() */
++#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
++#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
++#define SQLITE_NOTFOUND    12   /* (Internal Only) Table or record not found */
++#define SQLITE_FULL        13   /* Insertion failed because database is full */
++#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
++#define SQLITE_PROTOCOL    15   /* Database lock protocol error */
++#define SQLITE_EMPTY       16   /* (Internal Only) Database table is empty */
++#define SQLITE_SCHEMA      17   /* The database schema changed */
++#define SQLITE_TOOBIG      18   /* Too much data for one row of a table */
++#define SQLITE_CONSTRAINT  19   /* Abort due to contraint violation */
++#define SQLITE_MISMATCH    20   /* Data type mismatch */
++#define SQLITE_MISUSE      21   /* Library used incorrectly */
++#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
++#define SQLITE_AUTH        23   /* Authorization denied */
++#define SQLITE_FORMAT      24   /* Auxiliary database format error */
++#define SQLITE_RANGE       25   /* 2nd parameter to sqlite_bind out of range */
++#define SQLITE_NOTADB      26   /* File opened that is not a database file */
++#define SQLITE_ROW         100  /* sqlite_step() has another row ready */
++#define SQLITE_DONE        101  /* sqlite_step() has finished executing */
++
++/*
++** Each entry in an SQLite table has a unique integer key.  (The key is
++** the value of the INTEGER PRIMARY KEY column if there is such a column,
++** otherwise the key is generated at random.  The unique key is always
++** available as the ROWID, OID, or _ROWID_ column.)  The following routine
++** returns the integer key of the most recent insert in the database.
++**
++** This function is similar to the mysql_insert_id() function from MySQL.
++*/
++int sqlite_last_insert_rowid(sqlite*);
++
++/*
++** This function returns the number of database rows that were changed
++** (or inserted or deleted) by the most recent called sqlite_exec().
++**
++** All changes are counted, even if they were later undone by a
++** ROLLBACK or ABORT.  Except, changes associated with creating and
++** dropping tables are not counted.
++**
++** If a callback invokes sqlite_exec() recursively, then the changes
++** in the inner, recursive call are counted together with the changes
++** in the outer call.
++**
++** SQLite implements the command "DELETE FROM table" without a WHERE clause
++** by dropping and recreating the table.  (This is much faster than going
++** through and deleting individual elements form the table.)  Because of
++** this optimization, the change count for "DELETE FROM table" will be
++** zero regardless of the number of elements that were originally in the
++** table. To get an accurate count of the number of rows deleted, use
++** "DELETE FROM table WHERE 1" instead.
++*/
++int sqlite_changes(sqlite*);
++
++/* If the parameter to this routine is one of the return value constants
++** defined above, then this routine returns a constant text string which
++** descripts (in English) the meaning of the return value.
++*/
++const char *sqlite_error_string(int);
++#define sqliteErrStr sqlite_error_string  /* Legacy. Do not use in new code. */
++
++/* This function causes any pending database operation to abort and
++** return at its earliest opportunity.  This routine is typically
++** called in response to a user action such as pressing "Cancel"
++** or Ctrl-C where the user wants a long query operation to halt
++** immediately.
++*/
++void sqlite_interrupt(sqlite*);
++
++
++/* This function returns true if the given input string comprises
++** one or more complete SQL statements.
++**
++** The algorithm is simple.  If the last token other than spaces
++** and comments is a semicolon, then return true.  otherwise return
++** false.
++*/
++int sqlite_complete(const char *sql);
++
++/*
++** This routine identifies a callback function that is invoked
++** whenever an attempt is made to open a database table that is
++** currently locked by another process or thread.  If the busy callback
++** is NULL, then sqlite_exec() returns SQLITE_BUSY immediately if
++** it finds a locked table.  If the busy callback is not NULL, then
++** sqlite_exec() invokes the callback with three arguments.  The
++** second argument is the name of the locked table and the third
++** argument is the number of times the table has been busy.  If the
++** busy callback returns 0, then sqlite_exec() immediately returns
++** SQLITE_BUSY.  If the callback returns non-zero, then sqlite_exec()
++** tries to open the table again and the cycle repeats.
++**
++** The default busy callback is NULL.
++**
++** Sqlite is re-entrant, so the busy handler may start a new query. 
++** (It is not clear why anyone would every want to do this, but it
++** is allowed, in theory.)  But the busy handler may not close the
++** database.  Closing the database from a busy handler will delete 
++** data structures out from under the executing query and will 
++** probably result in a coredump.
++*/
++void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
++
++/*
++** This routine sets a busy handler that sleeps for a while when a
++** table is locked.  The handler will sleep multiple times until 
++** at least "ms" milleseconds of sleeping have been done.  After
++** "ms" milleseconds of sleeping, the handler returns 0 which
++** causes sqlite_exec() to return SQLITE_BUSY.
++**
++** Calling this routine with an argument less than or equal to zero
++** turns off all busy handlers.
++*/
++void sqlite_busy_timeout(sqlite*, int ms);
++
++/*
++** This next routine is really just a wrapper around sqlite_exec().
++** Instead of invoking a user-supplied callback for each row of the
++** result, this routine remembers each row of the result in memory
++** obtained from malloc(), then returns all of the result after the
++** query has finished. 
++**
++** As an example, suppose the query result where this table:
++**
++**        Name        | Age
++**        -----------------------
++**        Alice       | 43
++**        Bob         | 28
++**        Cindy       | 21
++**
++** If the 3rd argument were &azResult then after the function returns
++** azResult will contain the following data:
++**
++**        azResult[0] = "Name";
++**        azResult[1] = "Age";
++**        azResult[2] = "Alice";
++**        azResult[3] = "43";
++**        azResult[4] = "Bob";
++**        azResult[5] = "28";
++**        azResult[6] = "Cindy";
++**        azResult[7] = "21";
++**
++** Notice that there is an extra row of data containing the column
++** headers.  But the *nrow return value is still 3.  *ncolumn is
++** set to 2.  In general, the number of values inserted into azResult
++** will be ((*nrow) + 1)*(*ncolumn).
++**
++** After the calling function has finished using the result, it should 
++** pass the result data pointer to sqlite_free_table() in order to 
++** release the memory that was malloc-ed.  Because of the way the 
++** malloc() happens, the calling function must not try to call 
++** malloc() directly.  Only sqlite_free_table() is able to release 
++** the memory properly and safely.
++**
++** The return value of this routine is the same as from sqlite_exec().
++*/
++int sqlite_get_table(
++  sqlite*,               /* An open database */
++  const char *sql,       /* SQL to be executed */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg          /* Error msg written here */
++);
++
++/*
++** Call this routine to free the memory that sqlite_get_table() allocated.
++*/
++void sqlite_free_table(char **result);
++
++/*
++** The following routines are wrappers around sqlite_exec() and
++** sqlite_get_table().  The only difference between the routines that
++** follow and the originals is that the second argument to the 
++** routines that follow is really a printf()-style format
++** string describing the SQL to be executed.  Arguments to the format
++** string appear at the end of the argument list.
++**
++** All of the usual printf formatting options apply.  In addition, there
++** is a "%q" option.  %q works like %s in that it substitutes a null-terminated
++** string from the argument list.  But %q also doubles every '\'' character.
++** %q is designed for use inside a string literal.  By doubling each '\''
++** character it escapes that character and allows it to be inserted into
++** the string.
++**
++** For example, so some string variable contains text as follows:
++**
++**      char *zText = "It's a happy day!";
++**
++** We can use this text in an SQL statement as follows:
++**
++**      sqlite_exec_printf(db, "INSERT INTO table VALUES('%q')",
++**          callback1, 0, 0, zText);
++**
++** Because the %q format string is used, the '\'' character in zText
++** is escaped and the SQL generated is as follows:
++**
++**      INSERT INTO table1 VALUES('It''s a happy day!')
++**
++** This is correct.  Had we used %s instead of %q, the generated SQL
++** would have looked like this:
++**
++**      INSERT INTO table1 VALUES('It's a happy day!');
++**
++** This second example is an SQL syntax error.  As a general rule you
++** should always use %q instead of %s when inserting text into a string 
++** literal.
++*/
++int sqlite_exec_printf(
++  sqlite*,                      /* An open database */
++  const char *sqlFormat,        /* printf-style format string for the SQL */
++  sqlite_callback,              /* Callback function */
++  void *,                       /* 1st argument to callback function */
++  char **errmsg,                /* Error msg written here */
++  ...                           /* Arguments to the format string. */
++);
++int sqlite_exec_vprintf(
++  sqlite*,                      /* An open database */
++  const char *sqlFormat,        /* printf-style format string for the SQL */
++  sqlite_callback,              /* Callback function */
++  void *,                       /* 1st argument to callback function */
++  char **errmsg,                /* Error msg written here */
++  va_list ap                    /* Arguments to the format string. */
++);
++int sqlite_get_table_printf(
++  sqlite*,               /* An open database */
++  const char *sqlFormat, /* printf-style format string for the SQL */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg,         /* Error msg written here */
++  ...                    /* Arguments to the format string */
++);
++int sqlite_get_table_vprintf(
++  sqlite*,               /* An open database */
++  const char *sqlFormat, /* printf-style format string for the SQL */
++  char ***resultp,       /* Result written to a char *[]  that this points to */
++  int *nrow,             /* Number of result rows written here */
++  int *ncolumn,          /* Number of result columns written here */
++  char **errmsg,         /* Error msg written here */
++  va_list ap             /* Arguments to the format string */
++);
++char *sqlite_mprintf(const char*,...);
++char *sqlite_vmprintf(const char*, va_list);
++
++/*
++** Windows systems should call this routine to free memory that
++** is returned in the in the errmsg parameter of sqlite_open() when
++** SQLite is a DLL.  For some reason, it does not work to call free()
++** directly.
++*/
++void sqlite_freemem(void *p);
++
++/*
++** Windows systems need functions to call to return the sqlite_version
++** and sqlite_encoding strings.
++*/
++const char *sqlite_libversion(void);
++const char *sqlite_libencoding(void);
++
++/*
++** A pointer to the following structure is used to communicate with
++** the implementations of user-defined functions.
++*/
++typedef struct sqlite_func sqlite_func;
++
++/*
++** Use the following routines to create new user-defined functions.  See
++** the documentation for details.
++*/
++int sqlite_create_function(
++  sqlite*,                  /* Database where the new function is registered */
++  const char *zName,        /* Name of the new function */
++  int nArg,                 /* Number of arguments.  -1 means any number */
++  void (*xFunc)(sqlite_func*,int,const char**),  /* C code to implement */
++  void *pUserData           /* Available via the sqlite_user_data() call */
++);
++int sqlite_create_aggregate(
++  sqlite*,                  /* Database where the new function is registered */
++  const char *zName,        /* Name of the function */
++  int nArg,                 /* Number of arguments */
++  void (*xStep)(sqlite_func*,int,const char**), /* Called for each row */
++  void (*xFinalize)(sqlite_func*),       /* Called once to get final result */
++  void *pUserData           /* Available via the sqlite_user_data() call */
++);
++
++/*
++** Use the following routine to define the datatype returned by a
++** user-defined function.  The second argument can be one of the
++** constants SQLITE_NUMERIC, SQLITE_TEXT, or SQLITE_ARGS or it
++** can be an integer greater than or equal to zero.  The datatype
++** will be numeric or text (the only two types supported) if the
++** argument is SQLITE_NUMERIC or SQLITE_TEXT.  If the argument is
++** SQLITE_ARGS, then the datatype is numeric if any argument to the
++** function is numeric and is text otherwise.  If the second argument
++** is an integer, then the datatype of the result is the same as the
++** parameter to the function that corresponds to that integer.
++*/
++int sqlite_function_type(
++  sqlite *db,               /* The database there the function is registered */
++  const char *zName,        /* Name of the function */
++  int datatype              /* The datatype for this function */
++);
++#define SQLITE_NUMERIC     (-1)
++#define SQLITE_TEXT        (-2)
++#define SQLITE_ARGS        (-3)
++
++/*
++** The user function implementations call one of the following four routines
++** in order to return their results.  The first parameter to each of these
++** routines is a copy of the first argument to xFunc() or xFinialize().
++** The second parameter to these routines is the result to be returned.
++** A NULL can be passed as the second parameter to sqlite_set_result_string()
++** in order to return a NULL result.
++**
++** The 3rd argument to _string and _error is the number of characters to
++** take from the string.  If this argument is negative, then all characters
++** up to and including the first '\000' are used.
++**
++** The sqlite_set_result_string() function allocates a buffer to hold the
++** result and returns a pointer to this buffer.  The calling routine
++** (that is, the implmentation of a user function) can alter the content
++** of this buffer if desired.
++*/
++char *sqlite_set_result_string(sqlite_func*,const char*,int);
++void sqlite_set_result_int(sqlite_func*,int);
++void sqlite_set_result_double(sqlite_func*,double);
++void sqlite_set_result_error(sqlite_func*,const char*,int);
++
++/*
++** The pUserData parameter to the sqlite_create_function() and
++** sqlite_create_aggregate() routines used to register user functions
++** is available to the implementation of the function using this
++** call.
++*/
++void *sqlite_user_data(sqlite_func*);
++
++/*
++** Aggregate functions use the following routine to allocate
++** a structure for storing their state.  The first time this routine
++** is called for a particular aggregate, a new structure of size nBytes
++** is allocated, zeroed, and returned.  On subsequent calls (for the
++** same aggregate instance) the same buffer is returned.  The implementation
++** of the aggregate can use the returned buffer to accumulate data.
++**
++** The buffer allocated is freed automatically be SQLite.
++*/
++void *sqlite_aggregate_context(sqlite_func*, int nBytes);
++
++/*
++** The next routine returns the number of calls to xStep for a particular
++** aggregate function instance.  The current call to xStep counts so this
++** routine always returns at least 1.
++*/
++int sqlite_aggregate_count(sqlite_func*);
++
++/*
++** This routine registers a callback with the SQLite library.  The
++** callback is invoked (at compile-time, not at run-time) for each
++** attempt to access a column of a table in the database.  The callback
++** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire
++** SQL statement should be aborted with an error and SQLITE_IGNORE
++** if the column should be treated as a NULL value.
++*/
++int sqlite_set_authorizer(
++  sqlite*,
++  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
++  void *pUserData
++);
++
++/*
++** The second parameter to the access authorization function above will
++** be one of the values below.  These values signify what kind of operation
++** is to be authorized.  The 3rd and 4th parameters to the authorization
++** function will be parameters or NULL depending on which of the following
++** codes is used as the second parameter.  The 5th parameter is the name
++** of the database ("main", "temp", etc.) if applicable.  The 6th parameter
++** is the name of the inner-most trigger or view that is responsible for
++** the access attempt or NULL if this access attempt is directly from 
++** input SQL code.
++**
++**                                          Arg-3           Arg-4
++*/
++#define SQLITE_COPY                  0   /* Table Name      File Name       */
++#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
++#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
++#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
++#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
++#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
++#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */
++#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */
++#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */
++#define SQLITE_DELETE                9   /* Table Name      NULL            */
++#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */
++#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */
++#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */
++#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */
++#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */
++#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */
++#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */
++#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */
++#define SQLITE_INSERT               18   /* Table Name      NULL            */
++#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */
++#define SQLITE_READ                 20   /* Table Name      Column Name     */
++#define SQLITE_SELECT               21   /* NULL            NULL            */
++#define SQLITE_TRANSACTION          22   /* NULL            NULL            */
++#define SQLITE_UPDATE               23   /* Table Name      Column Name     */
++#define SQLITE_ATTACH               24   /* Filename        NULL            */
++#define SQLITE_DETACH               25   /* Database Name   NULL            */
++
++
++/*
++** The return value of the authorization function should be one of the
++** following constants:
++*/
++/* #define SQLITE_OK  0   // Allow access (This is actually defined above) */
++#define SQLITE_DENY   1   /* Abort the SQL statement with an error */
++#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */
++
++/*
++** Register a function that is called at every invocation of sqlite_exec()
++** or sqlite_compile().  This function can be used (for example) to generate
++** a log file of all SQL executed against a database.
++*/
++void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
++
++/*** The Callback-Free API
++** 
++** The following routines implement a new way to access SQLite that does not
++** involve the use of callbacks.
++**
++** An sqlite_vm is an opaque object that represents a single SQL statement
++** that is ready to be executed.
++*/
++typedef struct sqlite_vm sqlite_vm;
++
++/*
++** To execute an SQLite query without the use of callbacks, you first have
++** to compile the SQL using this routine.  The 1st parameter "db" is a pointer
++** to an sqlite object obtained from sqlite_open().  The 2nd parameter
++** "zSql" is the text of the SQL to be compiled.   The remaining parameters
++** are all outputs.
++**
++** *pzTail is made to point to the first character past the end of the first
++** SQL statement in zSql.  This routine only compiles the first statement
++** in zSql, so *pzTail is left pointing to what remains uncompiled.
++**
++** *ppVm is left pointing to a "virtual machine" that can be used to execute
++** the compiled statement.  Or if there is an error, *ppVm may be set to NULL.
++** If the input text contained no SQL (if the input is and empty string or
++** a comment) then *ppVm is set to NULL.
++**
++** If any errors are detected during compilation, an error message is written
++** into space obtained from malloc() and *pzErrMsg is made to point to that
++** error message.  The calling routine is responsible for freeing the text
++** of this message when it has finished with it.  Use sqlite_freemem() to
++** free the message.  pzErrMsg may be NULL in which case no error message
++** will be generated.
++**
++** On success, SQLITE_OK is returned.  Otherwise and error code is returned.
++*/
++int sqlite_compile(
++  sqlite *db,                   /* The open database */
++  const char *zSql,             /* SQL statement to be compiled */
++  const char **pzTail,          /* OUT: uncompiled tail of zSql */
++  sqlite_vm **ppVm,             /* OUT: the virtual machine to execute zSql */
++  char **pzErrmsg               /* OUT: Error message. */
++);
++
++/*
++** After an SQL statement has been compiled, it is handed to this routine
++** to be executed.  This routine executes the statement as far as it can
++** go then returns.  The return value will be one of SQLITE_DONE,
++** SQLITE_ERROR, SQLITE_BUSY, SQLITE_ROW, or SQLITE_MISUSE.
++**
++** SQLITE_DONE means that the execute of the SQL statement is complete
++** an no errors have occurred.  sqlite_step() should not be called again
++** for the same virtual machine.  *pN is set to the number of columns in
++** the result set and *pazColName is set to an array of strings that
++** describe the column names and datatypes.  The name of the i-th column
++** is (*pazColName)[i] and the datatype of the i-th column is
++** (*pazColName)[i+*pN].  *pazValue is set to NULL.
++**
++** SQLITE_ERROR means that the virtual machine encountered a run-time
++** error.  sqlite_step() should not be called again for the same
++** virtual machine.  *pN is set to 0 and *pazColName and *pazValue are set
++** to NULL.  Use sqlite_finalize() to obtain the specific error code
++** and the error message text for the error.
++**
++** SQLITE_BUSY means that an attempt to open the database failed because
++** another thread or process is holding a lock.  The calling routine
++** can try again to open the database by calling sqlite_step() again.
++** The return code will only be SQLITE_BUSY if no busy handler is registered
++** using the sqlite_busy_handler() or sqlite_busy_timeout() routines.  If
++** a busy handler callback has been registered but returns 0, then this
++** routine will return SQLITE_ERROR and sqltie_finalize() will return
++** SQLITE_BUSY when it is called.
++**
++** SQLITE_ROW means that a single row of the result is now available.
++** The data is contained in *pazValue.  The value of the i-th column is
++** (*azValue)[i].  *pN and *pazColName are set as described in SQLITE_DONE.
++** Invoke sqlite_step() again to advance to the next row.
++**
++** SQLITE_MISUSE is returned if sqlite_step() is called incorrectly.
++** For example, if you call sqlite_step() after the virtual machine
++** has halted (after a prior call to sqlite_step() has returned SQLITE_DONE)
++** or if you call sqlite_step() with an incorrectly initialized virtual
++** machine or a virtual machine that has been deleted or that is associated
++** with an sqlite structure that has been closed.
++*/
++int sqlite_step(
++  sqlite_vm *pVm,              /* The virtual machine to execute */
++  int *pN,                     /* OUT: Number of columns in result */
++  const char ***pazValue,      /* OUT: Column data */
++  const char ***pazColName     /* OUT: Column names and datatypes */
++);
++
++/*
++** This routine is called to delete a virtual machine after it has finished
++** executing.  The return value is the result code.  SQLITE_OK is returned
++** if the statement executed successfully and some other value is returned if
++** there was any kind of error.  If an error occurred and pzErrMsg is not
++** NULL, then an error message is written into memory obtained from malloc()
++** and *pzErrMsg is made to point to that error message.  The calling routine
++** should use sqlite_freemem() to delete this message when it has finished
++** with it.
++**
++** This routine can be called at any point during the execution of the
++** virtual machine.  If the virtual machine has not completed execution
++** when this routine is called, that is like encountering an error or
++** an interrupt.  (See sqlite_interrupt().)  Incomplete updates may be
++** rolled back and transactions cancelled,  depending on the circumstances,
++** and the result code returned will be SQLITE_ABORT.
++*/
++int sqlite_finalize(sqlite_vm*, char **pzErrMsg);
++
++/*
++** This routine deletes the virtual machine, writes any error message to
++** *pzErrMsg and returns an SQLite return code in the same way as the
++** sqlite_finalize() function.
++**
++** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual
++** machine loaded with the compiled version of the original query ready for
++** execution.
++**
++** If sqlite_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++int sqlite_reset(sqlite_vm*, char **pzErrMsg);
++
++/*
++** If the SQL that was handed to sqlite_compile contains variables that
++** are represeted in the SQL text by a question mark ('?').  This routine
++** is used to assign values to those variables.
++**
++** The first parameter is a virtual machine obtained from sqlite_compile().
++** The 2nd "idx" parameter determines which variable in the SQL statement
++** to bind the value to.  The left most '?' is 1.  The 3rd parameter is
++** the value to assign to that variable.  The 4th parameter is the number
++** of bytes in the value, including the terminating \000 for strings.
++** Finally, the 5th "copy" parameter is TRUE if SQLite should make its
++** own private copy of this value, or false if the space that the 3rd
++** parameter points to will be unchanging and can be used directly by
++** SQLite.
++**
++** Unbound variables are treated as having a value of NULL.  To explicitly
++** set a variable to NULL, call this routine with the 3rd parameter as a
++** NULL pointer.
++**
++** If the 4th "len" parameter is -1, then strlen() is used to find the
++** length.
++**
++** This routine can only be called immediately after sqlite_compile()
++** or sqlite_reset() and before any calls to sqlite_step().
++**
++******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
++*/
++int sqlite_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
++
++/*
++** This routine configures a callback function - the progress callback - that
++** is invoked periodically during long running calls to sqlite_exec(),
++** sqlite_step() and sqlite_get_table(). An example use for this API is to keep
++** a GUI updated during a large query.
++**
++** The progress callback is invoked once for every N virtual machine opcodes,
++** where N is the second argument to this function. The progress callback
++** itself is identified by the third argument to this function. The fourth
++** argument to this function is a void pointer passed to the progress callback
++** function each time it is invoked.
++**
++** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results 
++** in less than N opcodes being executed, then the progress callback is not
++** invoked.
++** 
++** Calling this routine overwrites any previously installed progress callback.
++** To remove the progress callback altogether, pass NULL as the third
++** argument to this function.
++**
++** If the progress callback returns a result other than 0, then the current 
++** query is immediately terminated and any database changes rolled back. If the
++** query was part of a larger transaction, then the transaction is not rolled
++** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. 
++*/
++void sqlite_progress_handler(sqlite*, int, int(*)(void*), void*);
++
++#ifdef __cplusplus
++}  /* End of the 'extern "C"' block */
++#endif
++
++#endif /* _SQLITE_H_ */
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/table.c
+@@ -0,0 +1,203 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains the sqlite_get_table() and sqlite_free_table()
++** interface routines.  These are just wrappers around the main
++** interface routine of sqlite_exec().
++**
++** These routines are in a separate files so that they will not be linked
++** if they are not used.
++*/
++#include <stdlib.h>
++#include <string.h>
++#include "sqliteInt.h"
++
++/*
++** This structure is used to pass data from sqlite_get_table() through
++** to the callback function is uses to build the result.
++*/
++typedef struct TabResult {
++  char **azResult;
++  char *zErrMsg;
++  int nResult;
++  int nAlloc;
++  int nRow;
++  int nColumn;
++  long nData;
++  int rc;
++} TabResult;
++
++/*
++** This routine is called once for each row in the result table.  Its job
++** is to fill in the TabResult structure appropriately, allocating new
++** memory as necessary.
++*/
++static int sqlite_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
++  TabResult *p = (TabResult*)pArg;
++  int need;
++  int i;
++  char *z;
++
++  /* Make sure there is enough space in p->azResult to hold everything
++  ** we need to remember from this invocation of the callback.
++  */
++  if( p->nRow==0 && argv!=0 ){
++    need = nCol*2;
++  }else{
++    need = nCol;
++  }
++  if( p->nData + need >= p->nAlloc ){
++    char **azNew;
++    p->nAlloc = p->nAlloc*2 + need + 1;
++    azNew = realloc( p->azResult, sizeof(char*)*p->nAlloc );
++    if( azNew==0 ){
++      p->rc = SQLITE_NOMEM;
++      return 1;
++    }
++    p->azResult = azNew;
++  }
++
++  /* If this is the first row, then generate an extra row containing
++  ** the names of all columns.
++  */
++  if( p->nRow==0 ){
++    p->nColumn = nCol;
++    for(i=0; i<nCol; i++){
++      if( colv[i]==0 ){
++        z = 0;
++      }else{
++        z = malloc( strlen(colv[i])+1 );
++        if( z==0 ){
++          p->rc = SQLITE_NOMEM;
++          return 1;
++        }
++        strcpy(z, colv[i]);
++      }
++      p->azResult[p->nData++] = z;
++    }
++  }else if( p->nColumn!=nCol ){
++    sqliteSetString(&p->zErrMsg,
++       "sqlite_get_table() called with two or more incompatible queries",
++       (char*)0);
++    p->rc = SQLITE_ERROR;
++    return 1;
++  }
++
++  /* Copy over the row data
++  */
++  if( argv!=0 ){
++    for(i=0; i<nCol; i++){
++      if( argv[i]==0 ){
++        z = 0;
++      }else{
++        z = malloc( strlen(argv[i])+1 );
++        if( z==0 ){
++          p->rc = SQLITE_NOMEM;
++          return 1;
++        }
++        strcpy(z, argv[i]);
++      }
++      p->azResult[p->nData++] = z;
++    }
++    p->nRow++;
++  }
++  return 0;
++}
++
++/*
++** Query the database.  But instead of invoking a callback for each row,
++** malloc() for space to hold the result and return the entire results
++** at the conclusion of the call.
++**
++** The result that is written to ***pazResult is held in memory obtained
++** from malloc().  But the caller cannot free this memory directly.  
++** Instead, the entire table should be passed to sqlite_free_table() when
++** the calling procedure is finished using it.
++*/
++int sqlite_get_table(
++  sqlite *db,                 /* The database on which the SQL executes */
++  const char *zSql,           /* The SQL to be executed */
++  char ***pazResult,          /* Write the result table here */
++  int *pnRow,                 /* Write the number of rows in the result here */
++  int *pnColumn,              /* Write the number of columns of result here */
++  char **pzErrMsg             /* Write error messages here */
++){
++  int rc;
++  TabResult res;
++  if( pazResult==0 ){ return SQLITE_ERROR; }
++  *pazResult = 0;
++  if( pnColumn ) *pnColumn = 0;
++  if( pnRow ) *pnRow = 0;
++  res.zErrMsg = 0;
++  res.nResult = 0;
++  res.nRow = 0;
++  res.nColumn = 0;
++  res.nData = 1;
++  res.nAlloc = 20;
++  res.rc = SQLITE_OK;
++  res.azResult = malloc( sizeof(char*)*res.nAlloc );
++  if( res.azResult==0 ){
++    return SQLITE_NOMEM;
++  }
++  res.azResult[0] = 0;
++  rc = sqlite_exec(db, zSql, sqlite_get_table_cb, &res, pzErrMsg);
++  if( res.azResult ){
++    res.azResult[0] = (char*)res.nData;
++  }
++  if( rc==SQLITE_ABORT ){
++    sqlite_free_table(&res.azResult[1]);
++    if( res.zErrMsg ){
++      if( pzErrMsg ){
++        free(*pzErrMsg);
++        *pzErrMsg = res.zErrMsg;
++        sqliteStrRealloc(pzErrMsg);
++      }else{
++        sqliteFree(res.zErrMsg);
++      }
++    }
++    return res.rc;
++  }
++  sqliteFree(res.zErrMsg);
++  if( rc!=SQLITE_OK ){
++    sqlite_free_table(&res.azResult[1]);
++    return rc;
++  }
++  if( res.nAlloc>res.nData ){
++    char **azNew;
++    azNew = realloc( res.azResult, sizeof(char*)*(res.nData+1) );
++    if( azNew==0 ){
++      sqlite_free_table(&res.azResult[1]);
++      return SQLITE_NOMEM;
++    }
++    res.nAlloc = res.nData+1;
++    res.azResult = azNew;
++  }
++  *pazResult = &res.azResult[1];
++  if( pnColumn ) *pnColumn = res.nColumn;
++  if( pnRow ) *pnRow = res.nRow;
++  return rc;
++}
++
++/*
++** This routine frees the space the sqlite_get_table() malloced.
++*/
++void sqlite_free_table(
++  char **azResult             /* Result returned from from sqlite_get_table() */
++){
++  if( azResult ){
++    int i, n;
++    azResult--;
++    if( azResult==0 ) return;
++    n = (int)(long)azResult[0];
++    for(i=1; i<n; i++){ if( azResult[i] ) free(azResult[i]); }
++    free(azResult);
++  }
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/tokenize.c
+@@ -0,0 +1,679 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** An tokenizer for SQL
++**
++** This file contains C code that splits an SQL input string up into
++** individual tokens and sends those tokens one-by-one over to the
++** parser for analysis.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include "os.h"
++#include <ctype.h>
++#include <stdlib.h>
++
++/*
++** All the keywords of the SQL language are stored as in a hash
++** table composed of instances of the following structure.
++*/
++typedef struct Keyword Keyword;
++struct Keyword {
++  char *zName;             /* The keyword name */
++  u8 tokenType;            /* Token value for this keyword */
++  u8 len;                  /* Length of this keyword */
++  u8 iNext;                /* Index in aKeywordTable[] of next with same hash */
++};
++
++/*
++** These are the keywords
++*/
++static Keyword aKeywordTable[] = {
++  { "ABORT",             TK_ABORT,        },
++  { "AFTER",             TK_AFTER,        },
++  { "ALL",               TK_ALL,          },
++  { "AND",               TK_AND,          },
++  { "AS",                TK_AS,           },
++  { "ASC",               TK_ASC,          },
++  { "ATTACH",            TK_ATTACH,       },
++  { "BEFORE",            TK_BEFORE,       },
++  { "BEGIN",             TK_BEGIN,        },
++  { "BETWEEN",           TK_BETWEEN,      },
++  { "BY",                TK_BY,           },
++  { "CASCADE",           TK_CASCADE,      },
++  { "CASE",              TK_CASE,         },
++  { "CHECK",             TK_CHECK,        },
++  { "CLUSTER",           TK_CLUSTER,      },
++  { "COLLATE",           TK_COLLATE,      },
++  { "COMMIT",            TK_COMMIT,       },
++  { "CONFLICT",          TK_CONFLICT,     },
++  { "CONSTRAINT",        TK_CONSTRAINT,   },
++  { "COPY",              TK_COPY,         },
++  { "CREATE",            TK_CREATE,       },
++  { "CROSS",             TK_JOIN_KW,      },
++  { "DATABASE",          TK_DATABASE,     },
++  { "DEFAULT",           TK_DEFAULT,      },
++  { "DEFERRED",          TK_DEFERRED,     },
++  { "DEFERRABLE",        TK_DEFERRABLE,   },
++  { "DELETE",            TK_DELETE,       },
++  { "DELIMITERS",        TK_DELIMITERS,   },
++  { "DESC",              TK_DESC,         },
++  { "DETACH",            TK_DETACH,       },
++  { "DISTINCT",          TK_DISTINCT,     },
++  { "DROP",              TK_DROP,         },
++  { "END",               TK_END,          },
++  { "EACH",              TK_EACH,         },
++  { "ELSE",              TK_ELSE,         },
++  { "EXCEPT",            TK_EXCEPT,       },
++  { "EXPLAIN",           TK_EXPLAIN,      },
++  { "FAIL",              TK_FAIL,         },
++  { "FOR",               TK_FOR,          },
++  { "FOREIGN",           TK_FOREIGN,      },
++  { "FROM",              TK_FROM,         },
++  { "FULL",              TK_JOIN_KW,      },
++  { "GLOB",              TK_GLOB,         },
++  { "GROUP",             TK_GROUP,        },
++  { "HAVING",            TK_HAVING,       },
++  { "IGNORE",            TK_IGNORE,       },
++  { "IMMEDIATE",         TK_IMMEDIATE,    },
++  { "IN",                TK_IN,           },
++  { "INDEX",             TK_INDEX,        },
++  { "INITIALLY",         TK_INITIALLY,    },
++  { "INNER",             TK_JOIN_KW,      },
++  { "INSERT",            TK_INSERT,       },
++  { "INSTEAD",           TK_INSTEAD,      },
++  { "INTERSECT",         TK_INTERSECT,    },
++  { "INTO",              TK_INTO,         },
++  { "IS",                TK_IS,           },
++  { "ISNULL",            TK_ISNULL,       },
++  { "JOIN",              TK_JOIN,         },
++  { "KEY",               TK_KEY,          },
++  { "LEFT",              TK_JOIN_KW,      },
++  { "LIKE",              TK_LIKE,         },
++  { "LIMIT",             TK_LIMIT,        },
++  { "MATCH",             TK_MATCH,        },
++  { "NATURAL",           TK_JOIN_KW,      },
++  { "NOT",               TK_NOT,          },
++  { "NOTNULL",           TK_NOTNULL,      },
++  { "NULL",              TK_NULL,         },
++  { "OF",                TK_OF,           },
++  { "OFFSET",            TK_OFFSET,       },
++  { "ON",                TK_ON,           },
++  { "OR",                TK_OR,           },
++  { "ORDER",             TK_ORDER,        },
++  { "OUTER",             TK_JOIN_KW,      },
++  { "PRAGMA",            TK_PRAGMA,       },
++  { "PRIMARY",           TK_PRIMARY,      },
++  { "RAISE",             TK_RAISE,        },
++  { "REFERENCES",        TK_REFERENCES,   },
++  { "REPLACE",           TK_REPLACE,      },
++  { "RESTRICT",          TK_RESTRICT,     },
++  { "RIGHT",             TK_JOIN_KW,      },
++  { "ROLLBACK",          TK_ROLLBACK,     },
++  { "ROW",               TK_ROW,          },
++  { "SELECT",            TK_SELECT,       },
++  { "SET",               TK_SET,          },
++  { "STATEMENT",         TK_STATEMENT,    },
++  { "TABLE",             TK_TABLE,        },
++  { "TEMP",              TK_TEMP,         },
++  { "TEMPORARY",         TK_TEMP,         },
++  { "THEN",              TK_THEN,         },
++  { "TRANSACTION",       TK_TRANSACTION,  },
++  { "TRIGGER",           TK_TRIGGER,      },
++  { "UNION",             TK_UNION,        },
++  { "UNIQUE",            TK_UNIQUE,       },
++  { "UPDATE",            TK_UPDATE,       },
++  { "USING",             TK_USING,        },
++  { "VACUUM",            TK_VACUUM,       },
++  { "VALUES",            TK_VALUES,       },
++  { "VIEW",              TK_VIEW,         },
++  { "WHEN",              TK_WHEN,         },
++  { "WHERE",             TK_WHERE,        },
++};
++
++/*
++** This is the hash table
++*/
++#define KEY_HASH_SIZE 101
++static u8 aiHashTable[KEY_HASH_SIZE];
++
++
++/*
++** This function looks up an identifier to determine if it is a
++** keyword.  If it is a keyword, the token code of that keyword is 
++** returned.  If the input is not a keyword, TK_ID is returned.
++*/
++int sqliteKeywordCode(const char *z, int n){
++  int h, i;
++  Keyword *p;
++  static char needInit = 1;
++  if( needInit ){
++    /* Initialize the keyword hash table */
++    sqliteOsEnterMutex();
++    if( needInit ){
++      int nk;
++      nk = sizeof(aKeywordTable)/sizeof(aKeywordTable[0]);
++      for(i=0; i<nk; i++){
++        aKeywordTable[i].len = strlen(aKeywordTable[i].zName);
++        h = sqliteHashNoCase(aKeywordTable[i].zName, aKeywordTable[i].len);
++        h %= KEY_HASH_SIZE;
++        aKeywordTable[i].iNext = aiHashTable[h];
++        aiHashTable[h] = i+1;
++      }
++      needInit = 0;
++    }
++    sqliteOsLeaveMutex();
++  }
++  h = sqliteHashNoCase(z, n) % KEY_HASH_SIZE;
++  for(i=aiHashTable[h]; i; i=p->iNext){
++    p = &aKeywordTable[i-1];
++    if( p->len==n && sqliteStrNICmp(p->zName, z, n)==0 ){
++      return p->tokenType;
++    }
++  }
++  return TK_ID;
++}
++
++
++/*
++** If X is a character that can be used in an identifier and
++** X&0x80==0 then isIdChar[X] will be 1.  If X&0x80==0x80 then
++** X is always an identifier character.  (Hence all UTF-8
++** characters can be part of an identifier).  isIdChar[X] will
++** be 0 for every character in the lower 128 ASCII characters
++** that cannot be used as part of an identifier.
++**
++** In this implementation, an identifier can be a string of
++** alphabetic characters, digits, and "_" plus any character
++** with the high-order bit set.  The latter rule means that
++** any sequence of UTF-8 characters or characters taken from
++** an extended ISO8859 character set can form an identifier.
++*/
++static const char isIdChar[] = {
++/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 0x */
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 1x */
++    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */
++    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
++    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
++    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
++    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
++    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
++};
++
++
++/*
++** Return the length of the token that begins at z[0]. 
++** Store the token type in *tokenType before returning.
++*/
++static int sqliteGetToken(const unsigned char *z, int *tokenType){
++  int i;
++  switch( *z ){
++    case ' ': case '\t': case '\n': case '\f': case '\r': {
++      for(i=1; isspace(z[i]); i++){}
++      *tokenType = TK_SPACE;
++      return i;
++    }
++    case '-': {
++      if( z[1]=='-' ){
++        for(i=2; z[i] && z[i]!='\n'; i++){}
++        *tokenType = TK_COMMENT;
++        return i;
++      }
++      *tokenType = TK_MINUS;
++      return 1;
++    }
++    case '(': {
++      *tokenType = TK_LP;
++      return 1;
++    }
++    case ')': {
++      *tokenType = TK_RP;
++      return 1;
++    }
++    case ';': {
++      *tokenType = TK_SEMI;
++      return 1;
++    }
++    case '+': {
++      *tokenType = TK_PLUS;
++      return 1;
++    }
++    case '*': {
++      *tokenType = TK_STAR;
++      return 1;
++    }
++    case '/': {
++      if( z[1]!='*' || z[2]==0 ){
++        *tokenType = TK_SLASH;
++        return 1;
++      }
++      for(i=3; z[i] && (z[i]!='/' || z[i-1]!='*'); i++){}
++      if( z[i] ) i++;
++      *tokenType = TK_COMMENT;
++      return i;
++    }
++    case '%': {
++      *tokenType = TK_REM;
++      return 1;
++    }
++    case '=': {
++      *tokenType = TK_EQ;
++      return 1 + (z[1]=='=');
++    }
++    case '<': {
++      if( z[1]=='=' ){
++        *tokenType = TK_LE;
++        return 2;
++      }else if( z[1]=='>' ){
++        *tokenType = TK_NE;
++        return 2;
++      }else if( z[1]=='<' ){
++        *tokenType = TK_LSHIFT;
++        return 2;
++      }else{
++        *tokenType = TK_LT;
++        return 1;
++      }
++    }
++    case '>': {
++      if( z[1]=='=' ){
++        *tokenType = TK_GE;
++        return 2;
++      }else if( z[1]=='>' ){
++        *tokenType = TK_RSHIFT;
++        return 2;
++      }else{
++        *tokenType = TK_GT;
++        return 1;
++      }
++    }
++    case '!': {
++      if( z[1]!='=' ){
++        *tokenType = TK_ILLEGAL;
++        return 2;
++      }else{
++        *tokenType = TK_NE;
++        return 2;
++      }
++    }
++    case '|': {
++      if( z[1]!='|' ){
++        *tokenType = TK_BITOR;
++        return 1;
++      }else{
++        *tokenType = TK_CONCAT;
++        return 2;
++      }
++    }
++    case ',': {
++      *tokenType = TK_COMMA;
++      return 1;
++    }
++    case '&': {
++      *tokenType = TK_BITAND;
++      return 1;
++    }
++    case '~': {
++      *tokenType = TK_BITNOT;
++      return 1;
++    }
++    case '\'': case '"': {
++      int delim = z[0];
++      for(i=1; z[i]; i++){
++        if( z[i]==delim ){
++          if( z[i+1]==delim ){
++            i++;
++          }else{
++            break;
++          }
++        }
++      }
++      if( z[i] ) i++;
++      *tokenType = TK_STRING;
++      return i;
++    }
++    case '.': {
++      *tokenType = TK_DOT;
++      return 1;
++    }
++    case '0': case '1': case '2': case '3': case '4':
++    case '5': case '6': case '7': case '8': case '9': {
++      *tokenType = TK_INTEGER;
++      for(i=1; isdigit(z[i]); i++){}
++      if( z[i]=='.' && isdigit(z[i+1]) ){
++        i += 2;
++        while( isdigit(z[i]) ){ i++; }
++        *tokenType = TK_FLOAT;
++      }
++      if( (z[i]=='e' || z[i]=='E') &&
++           ( isdigit(z[i+1]) 
++            || ((z[i+1]=='+' || z[i+1]=='-') && isdigit(z[i+2]))
++           )
++      ){
++        i += 2;
++        while( isdigit(z[i]) ){ i++; }
++        *tokenType = TK_FLOAT;
++      }
++      return i;
++    }
++    case '[': {
++      for(i=1; z[i] && z[i-1]!=']'; i++){}
++      *tokenType = TK_ID;
++      return i;
++    }
++    case '?': {
++      *tokenType = TK_VARIABLE;
++      return 1;
++    }
++    default: {
++      if( (*z&0x80)==0 && !isIdChar[*z] ){
++        break;
++      }
++      for(i=1; (z[i]&0x80)!=0 || isIdChar[z[i]]; i++){}
++      *tokenType = sqliteKeywordCode((char*)z, i);
++      return i;
++    }
++  }
++  *tokenType = TK_ILLEGAL;
++  return 1;
++}
++
++/*
++** Run the parser on the given SQL string.  The parser structure is
++** passed in.  An SQLITE_ status code is returned.  If an error occurs
++** and pzErrMsg!=NULL then an error message might be written into 
++** memory obtained from malloc() and *pzErrMsg made to point to that
++** error message.  Or maybe not.
++*/
++int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
++  int nErr = 0;
++  int i;
++  void *pEngine;
++  int tokenType;
++  int lastTokenParsed = -1;
++  sqlite *db = pParse->db;
++  extern void *sqliteParserAlloc(void*(*)(int));
++  extern void sqliteParserFree(void*, void(*)(void*));
++  extern int sqliteParser(void*, int, Token, Parse*);
++
++  db->flags &= ~SQLITE_Interrupt;
++  pParse->rc = SQLITE_OK;
++  i = 0;
++  pEngine = sqliteParserAlloc((void*(*)(int))malloc);
++  if( pEngine==0 ){
++    sqliteSetString(pzErrMsg, "out of memory", (char*)0);
++    return 1;
++  }
++  pParse->sLastToken.dyn = 0;
++  pParse->zTail = zSql;
++  while( sqlite_malloc_failed==0 && zSql[i]!=0 ){
++    assert( i>=0 );
++    pParse->sLastToken.z = &zSql[i];
++    assert( pParse->sLastToken.dyn==0 );
++    pParse->sLastToken.n = sqliteGetToken((unsigned char*)&zSql[i], &tokenType);
++    i += pParse->sLastToken.n;
++    switch( tokenType ){
++      case TK_SPACE:
++      case TK_COMMENT: {
++        if( (db->flags & SQLITE_Interrupt)!=0 ){
++          pParse->rc = SQLITE_INTERRUPT;
++          sqliteSetString(pzErrMsg, "interrupt", (char*)0);
++          goto abort_parse;
++        }
++        break;
++      }
++      case TK_ILLEGAL: {
++        sqliteSetNString(pzErrMsg, "unrecognized token: \"", -1, 
++           pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, 0);
++        nErr++;
++        goto abort_parse;
++      }
++      case TK_SEMI: {
++        pParse->zTail = &zSql[i];
++        /* Fall thru into the default case */
++      }
++      default: {
++        sqliteParser(pEngine, tokenType, pParse->sLastToken, pParse);
++        lastTokenParsed = tokenType;
++        if( pParse->rc!=SQLITE_OK ){
++          goto abort_parse;
++        }
++        break;
++      }
++    }
++  }
++abort_parse:
++  if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){
++    if( lastTokenParsed!=TK_SEMI ){
++      sqliteParser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
++      pParse->zTail = &zSql[i];
++    }
++    sqliteParser(pEngine, 0, pParse->sLastToken, pParse);
++  }
++  sqliteParserFree(pEngine, free);
++  if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
++    sqliteSetString(&pParse->zErrMsg, sqlite_error_string(pParse->rc),
++                    (char*)0);
++  }
++  if( pParse->zErrMsg ){
++    if( pzErrMsg && *pzErrMsg==0 ){
++      *pzErrMsg = pParse->zErrMsg;
++    }else{
++      sqliteFree(pParse->zErrMsg);
++    }
++    pParse->zErrMsg = 0;
++    if( !nErr ) nErr++;
++  }
++  if( pParse->pVdbe && pParse->nErr>0 ){
++    sqliteVdbeDelete(pParse->pVdbe);
++    pParse->pVdbe = 0;
++  }
++  if( pParse->pNewTable ){
++    sqliteDeleteTable(pParse->db, pParse->pNewTable);
++    pParse->pNewTable = 0;
++  }
++  if( pParse->pNewTrigger ){
++    sqliteDeleteTrigger(pParse->pNewTrigger);
++    pParse->pNewTrigger = 0;
++  }
++  if( nErr>0 && (pParse->rc==SQLITE_OK || pParse->rc==SQLITE_DONE) ){
++    pParse->rc = SQLITE_ERROR;
++  }
++  return nErr;
++}
++
++/*
++** Token types used by the sqlite_complete() routine.  See the header
++** comments on that procedure for additional information.
++*/
++#define tkEXPLAIN 0
++#define tkCREATE  1
++#define tkTEMP    2
++#define tkTRIGGER 3
++#define tkEND     4
++#define tkSEMI    5
++#define tkWS      6
++#define tkOTHER   7
++
++/*
++** Return TRUE if the given SQL string ends in a semicolon.
++**
++** Special handling is require for CREATE TRIGGER statements.
++** Whenever the CREATE TRIGGER keywords are seen, the statement
++** must end with ";END;".
++**
++** This implementation uses a state machine with 7 states:
++**
++**   (0) START     At the beginning or end of an SQL statement.  This routine
++**                 returns 1 if it ends in the START state and 0 if it ends
++**                 in any other state.
++**
++**   (1) EXPLAIN   The keyword EXPLAIN has been seen at the beginning of 
++**                 a statement.
++**
++**   (2) CREATE    The keyword CREATE has been seen at the beginning of a
++**                 statement, possibly preceeded by EXPLAIN and/or followed by
++**                 TEMP or TEMPORARY
++**
++**   (3) NORMAL    We are in the middle of statement which ends with a single
++**                 semicolon.
++**
++**   (4) TRIGGER   We are in the middle of a trigger definition that must be
++**                 ended by a semicolon, the keyword END, and another semicolon.
++**
++**   (5) SEMI      We've seen the first semicolon in the ";END;" that occurs at
++**                 the end of a trigger definition.
++**
++**   (6) END       We've seen the ";END" of the ";END;" that occurs at the end
++**                 of a trigger difinition.
++**
++** Transitions between states above are determined by tokens extracted
++** from the input.  The following tokens are significant:
++**
++**   (0) tkEXPLAIN   The "explain" keyword.
++**   (1) tkCREATE    The "create" keyword.
++**   (2) tkTEMP      The "temp" or "temporary" keyword.
++**   (3) tkTRIGGER   The "trigger" keyword.
++**   (4) tkEND       The "end" keyword.
++**   (5) tkSEMI      A semicolon.
++**   (6) tkWS        Whitespace
++**   (7) tkOTHER     Any other SQL token.
++**
++** Whitespace never causes a state transition and is always ignored.
++*/
++int sqlite_complete(const char *zSql){
++  u8 state = 0;   /* Current state, using numbers defined in header comment */
++  u8 token;       /* Value of the next token */
++
++  /* The following matrix defines the transition from one state to another
++  ** according to what token is seen.  trans[state][token] returns the
++  ** next state.
++  */
++  static const u8 trans[7][8] = {
++                     /* Token:                                                */
++     /* State:       **  EXPLAIN  CREATE  TEMP  TRIGGER  END  SEMI  WS  OTHER */
++     /* 0   START: */ {       1,      2,    3,       3,   3,    0,  0,     3, },
++     /* 1 EXPLAIN: */ {       3,      2,    3,       3,   3,    0,  1,     3, },
++     /* 2  CREATE: */ {       3,      3,    2,       4,   3,    0,  2,     3, },
++     /* 3  NORMAL: */ {       3,      3,    3,       3,   3,    0,  3,     3, },
++     /* 4 TRIGGER: */ {       4,      4,    4,       4,   4,    5,  4,     4, },
++     /* 5    SEMI: */ {       4,      4,    4,       4,   6,    5,  5,     4, },
++     /* 6     END: */ {       4,      4,    4,       4,   4,    0,  6,     4, },
++  };
++
++  while( *zSql ){
++    switch( *zSql ){
++      case ';': {  /* A semicolon */
++        token = tkSEMI;
++        break;
++      }
++      case ' ':
++      case '\r':
++      case '\t':
++      case '\n':
++      case '\f': {  /* White space is ignored */
++        token = tkWS;
++        break;
++      }
++      case '/': {   /* C-style comments */
++        if( zSql[1]!='*' ){
++          token = tkOTHER;
++          break;
++        }
++        zSql += 2;
++        while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
++        if( zSql[0]==0 ) return 0;
++        zSql++;
++        token = tkWS;
++        break;
++      }
++      case '-': {   /* SQL-style comments from "--" to end of line */
++        if( zSql[1]!='-' ){
++          token = tkOTHER;
++          break;
++        }
++        while( *zSql && *zSql!='\n' ){ zSql++; }
++        if( *zSql==0 ) return state==0;
++        token = tkWS;
++        break;
++      }
++      case '[': {   /* Microsoft-style identifiers in [...] */
++        zSql++;
++        while( *zSql && *zSql!=']' ){ zSql++; }
++        if( *zSql==0 ) return 0;
++        token = tkOTHER;
++        break;
++      }
++      case '"':     /* single- and double-quoted strings */
++      case '\'': {
++        int c = *zSql;
++        zSql++;
++        while( *zSql && *zSql!=c ){ zSql++; }
++        if( *zSql==0 ) return 0;
++        token = tkOTHER;
++        break;
++      }
++      default: {
++        if( isIdChar[(u8)*zSql] ){
++          /* Keywords and unquoted identifiers */
++          int nId;
++          for(nId=1; isIdChar[(u8)zSql[nId]]; nId++){}
++          switch( *zSql ){
++            case 'c': case 'C': {
++              if( nId==6 && sqliteStrNICmp(zSql, "create", 6)==0 ){
++                token = tkCREATE;
++              }else{
++                token = tkOTHER;
++              }
++              break;
++            }
++            case 't': case 'T': {
++              if( nId==7 && sqliteStrNICmp(zSql, "trigger", 7)==0 ){
++                token = tkTRIGGER;
++              }else if( nId==4 && sqliteStrNICmp(zSql, "temp", 4)==0 ){
++                token = tkTEMP;
++              }else if( nId==9 && sqliteStrNICmp(zSql, "temporary", 9)==0 ){
++                token = tkTEMP;
++              }else{
++                token = tkOTHER;
++              }
++              break;
++            }
++            case 'e':  case 'E': {
++              if( nId==3 && sqliteStrNICmp(zSql, "end", 3)==0 ){
++                token = tkEND;
++              }else if( nId==7 && sqliteStrNICmp(zSql, "explain", 7)==0 ){
++                token = tkEXPLAIN;
++              }else{
++                token = tkOTHER;
++              }
++              break;
++            }
++            default: {
++              token = tkOTHER;
++              break;
++            }
++          }
++          zSql += nId-1;
++        }else{
++          /* Operators and special symbols */
++          token = tkOTHER;
++        }
++        break;
++      }
++    }
++    state = trans[state][token];
++    zSql++;
++  }
++  return state==0;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/trigger.c
+@@ -0,0 +1,764 @@
++/*
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++*
++*/
++#include "sqliteInt.h"
++
++/*
++** Delete a linked list of TriggerStep structures.
++*/
++void sqliteDeleteTriggerStep(TriggerStep *pTriggerStep){
++  while( pTriggerStep ){
++    TriggerStep * pTmp = pTriggerStep;
++    pTriggerStep = pTriggerStep->pNext;
++
++    if( pTmp->target.dyn ) sqliteFree((char*)pTmp->target.z);
++    sqliteExprDelete(pTmp->pWhere);
++    sqliteExprListDelete(pTmp->pExprList);
++    sqliteSelectDelete(pTmp->pSelect);
++    sqliteIdListDelete(pTmp->pIdList);
++
++    sqliteFree(pTmp);
++  }
++}
++
++/*
++** This is called by the parser when it sees a CREATE TRIGGER statement
++** up to the point of the BEGIN before the trigger actions.  A Trigger
++** structure is generated based on the information available and stored
++** in pParse->pNewTrigger.  After the trigger actions have been parsed, the
++** sqliteFinishTrigger() function is called to complete the trigger
++** construction process.
++*/
++void sqliteBeginTrigger(
++  Parse *pParse,      /* The parse context of the CREATE TRIGGER statement */
++  Token *pName,       /* The name of the trigger */
++  int tr_tm,          /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
++  int op,             /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
++  IdList *pColumns,   /* column list if this is an UPDATE OF trigger */
++  SrcList *pTableName,/* The name of the table/view the trigger applies to */
++  int foreach,        /* One of TK_ROW or TK_STATEMENT */
++  Expr *pWhen,        /* WHEN clause */
++  int isTemp          /* True if the TEMPORARY keyword is present */
++){
++  Trigger *nt;
++  Table   *tab;
++  char *zName = 0;        /* Name of the trigger */
++  sqlite *db = pParse->db;
++  int iDb;                /* When database to store the trigger in */
++  DbFixer sFix;
++
++  /* Check that: 
++  ** 1. the trigger name does not already exist.
++  ** 2. the table (or view) does exist in the same database as the trigger.
++  ** 3. that we are not trying to create a trigger on the sqlite_master table
++  ** 4. That we are not trying to create an INSTEAD OF trigger on a table.
++  ** 5. That we are not trying to create a BEFORE or AFTER trigger on a view.
++  */
++  if( sqlite_malloc_failed ) goto trigger_cleanup;
++  assert( pTableName->nSrc==1 );
++  if( db->init.busy
++   && sqliteFixInit(&sFix, pParse, db->init.iDb, "trigger", pName)
++   && sqliteFixSrcList(&sFix, pTableName)
++  ){
++    goto trigger_cleanup;
++  }
++  tab = sqliteSrcListLookup(pParse, pTableName);
++  if( !tab ){
++    goto trigger_cleanup;
++  }
++  iDb = isTemp ? 1 : tab->iDb;
++  if( iDb>=2 && !db->init.busy ){
++    sqliteErrorMsg(pParse, "triggers may not be added to auxiliary "
++       "database %s", db->aDb[tab->iDb].zName);
++    goto trigger_cleanup;
++  }
++
++  zName = sqliteStrNDup(pName->z, pName->n);
++  sqliteDequote(zName);
++  if( sqliteHashFind(&(db->aDb[iDb].trigHash), zName,pName->n+1) ){
++    sqliteErrorMsg(pParse, "trigger %T already exists", pName);
++    goto trigger_cleanup;
++  }
++  if( sqliteStrNICmp(tab->zName, "sqlite_", 7)==0 ){
++    sqliteErrorMsg(pParse, "cannot create trigger on system table");
++    pParse->nErr++;
++    goto trigger_cleanup;
++  }
++  if( tab->pSelect && tr_tm != TK_INSTEAD ){
++    sqliteErrorMsg(pParse, "cannot create %s trigger on view: %S", 
++        (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName, 0);
++    goto trigger_cleanup;
++  }
++  if( !tab->pSelect && tr_tm == TK_INSTEAD ){
++    sqliteErrorMsg(pParse, "cannot create INSTEAD OF"
++        " trigger on table: %S", pTableName, 0);
++    goto trigger_cleanup;
++  }
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  {
++    int code = SQLITE_CREATE_TRIGGER;
++    const char *zDb = db->aDb[tab->iDb].zName;
++    const char *zDbTrig = isTemp ? db->aDb[1].zName : zDb;
++    if( tab->iDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
++    if( sqliteAuthCheck(pParse, code, zName, tab->zName, zDbTrig) ){
++      goto trigger_cleanup;
++    }
++    if( sqliteAuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(tab->iDb), 0, zDb)){
++      goto trigger_cleanup;
++    }
++  }
++#endif
++
++  /* INSTEAD OF triggers can only appear on views and BEGIN triggers
++  ** cannot appear on views.  So we might as well translate every
++  ** INSTEAD OF trigger into a BEFORE trigger.  It simplifies code
++  ** elsewhere.
++  */
++  if (tr_tm == TK_INSTEAD){
++    tr_tm = TK_BEFORE;
++  }
++
++  /* Build the Trigger object */
++  nt = (Trigger*)sqliteMalloc(sizeof(Trigger));
++  if( nt==0 ) goto trigger_cleanup;
++  nt->name = zName;
++  zName = 0;
++  nt->table = sqliteStrDup(pTableName->a[0].zName);
++  if( sqlite_malloc_failed ) goto trigger_cleanup;
++  nt->iDb = iDb;
++  nt->iTabDb = tab->iDb;
++  nt->op = op;
++  nt->tr_tm = tr_tm;
++  nt->pWhen = sqliteExprDup(pWhen);
++  nt->pColumns = sqliteIdListDup(pColumns);
++  nt->foreach = foreach;
++  sqliteTokenCopy(&nt->nameToken,pName);
++  assert( pParse->pNewTrigger==0 );
++  pParse->pNewTrigger = nt;
++
++trigger_cleanup:
++  sqliteFree(zName);
++  sqliteSrcListDelete(pTableName);
++  sqliteIdListDelete(pColumns);
++  sqliteExprDelete(pWhen);
++}
++
++/*
++** This routine is called after all of the trigger actions have been parsed
++** in order to complete the process of building the trigger.
++*/
++void sqliteFinishTrigger(
++  Parse *pParse,          /* Parser context */
++  TriggerStep *pStepList, /* The triggered program */
++  Token *pAll             /* Token that describes the complete CREATE TRIGGER */
++){
++  Trigger *nt = 0;          /* The trigger whose construction is finishing up */
++  sqlite *db = pParse->db;  /* The database */
++  DbFixer sFix;
++
++  if( pParse->nErr || pParse->pNewTrigger==0 ) goto triggerfinish_cleanup;
++  nt = pParse->pNewTrigger;
++  pParse->pNewTrigger = 0;
++  nt->step_list = pStepList;
++  while( pStepList ){
++    pStepList->pTrig = nt;
++    pStepList = pStepList->pNext;
++  }
++  if( sqliteFixInit(&sFix, pParse, nt->iDb, "trigger", &nt->nameToken) 
++          && sqliteFixTriggerStep(&sFix, nt->step_list) ){
++    goto triggerfinish_cleanup;
++  }
++
++  /* if we are not initializing, and this trigger is not on a TEMP table, 
++  ** build the sqlite_master entry
++  */
++  if( !db->init.busy ){
++    static VdbeOpList insertTrig[] = {
++      { OP_NewRecno,   0, 0,  0          },
++      { OP_String,     0, 0,  "trigger"  },
++      { OP_String,     0, 0,  0          },  /* 2: trigger name */
++      { OP_String,     0, 0,  0          },  /* 3: table name */
++      { OP_Integer,    0, 0,  0          },
++      { OP_String,     0, 0,  0          },  /* 5: SQL */
++      { OP_MakeRecord, 5, 0,  0          },
++      { OP_PutIntKey,  0, 0,  0          },
++    };
++    int addr;
++    Vdbe *v;
++
++    /* Make an entry in the sqlite_master table */
++    v = sqliteGetVdbe(pParse);
++    if( v==0 ) goto triggerfinish_cleanup;
++    sqliteBeginWriteOperation(pParse, 0, 0);
++    sqliteOpenMasterTable(v, nt->iDb);
++    addr = sqliteVdbeAddOpList(v, ArraySize(insertTrig), insertTrig);
++    sqliteVdbeChangeP3(v, addr+2, nt->name, 0); 
++    sqliteVdbeChangeP3(v, addr+3, nt->table, 0); 
++    sqliteVdbeChangeP3(v, addr+5, pAll->z, pAll->n);
++    if( nt->iDb==0 ){
++      sqliteChangeCookie(db, v);
++    }
++    sqliteVdbeAddOp(v, OP_Close, 0, 0);
++    sqliteEndWriteOperation(pParse);
++  }
++
++  if( !pParse->explain ){
++    Table *pTab;
++    sqliteHashInsert(&db->aDb[nt->iDb].trigHash, 
++                     nt->name, strlen(nt->name)+1, nt);
++    pTab = sqliteLocateTable(pParse, nt->table, db->aDb[nt->iTabDb].zName);
++    assert( pTab!=0 );
++    nt->pNext = pTab->pTrigger;
++    pTab->pTrigger = nt;
++    nt = 0;
++  }
++
++triggerfinish_cleanup:
++  sqliteDeleteTrigger(nt);
++  sqliteDeleteTrigger(pParse->pNewTrigger);
++  pParse->pNewTrigger = 0;
++  sqliteDeleteTriggerStep(pStepList);
++}
++
++/*
++** Make a copy of all components of the given trigger step.  This has
++** the effect of copying all Expr.token.z values into memory obtained
++** from sqliteMalloc().  As initially created, the Expr.token.z values
++** all point to the input string that was fed to the parser.  But that
++** string is ephemeral - it will go away as soon as the sqlite_exec()
++** call that started the parser exits.  This routine makes a persistent
++** copy of all the Expr.token.z strings so that the TriggerStep structure
++** will be valid even after the sqlite_exec() call returns.
++*/
++static void sqlitePersistTriggerStep(TriggerStep *p){
++  if( p->target.z ){
++    p->target.z = sqliteStrNDup(p->target.z, p->target.n);
++    p->target.dyn = 1;
++  }
++  if( p->pSelect ){
++    Select *pNew = sqliteSelectDup(p->pSelect);
++    sqliteSelectDelete(p->pSelect);
++    p->pSelect = pNew;
++  }
++  if( p->pWhere ){
++    Expr *pNew = sqliteExprDup(p->pWhere);
++    sqliteExprDelete(p->pWhere);
++    p->pWhere = pNew;
++  }
++  if( p->pExprList ){
++    ExprList *pNew = sqliteExprListDup(p->pExprList);
++    sqliteExprListDelete(p->pExprList);
++    p->pExprList = pNew;
++  }
++  if( p->pIdList ){
++    IdList *pNew = sqliteIdListDup(p->pIdList);
++    sqliteIdListDelete(p->pIdList);
++    p->pIdList = pNew;
++  }
++}
++
++/*
++** Turn a SELECT statement (that the pSelect parameter points to) into
++** a trigger step.  Return a pointer to a TriggerStep structure.
++**
++** The parser calls this routine when it finds a SELECT statement in
++** body of a TRIGGER.  
++*/
++TriggerStep *sqliteTriggerSelectStep(Select *pSelect){
++  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
++  if( pTriggerStep==0 ) return 0;
++
++  pTriggerStep->op = TK_SELECT;
++  pTriggerStep->pSelect = pSelect;
++  pTriggerStep->orconf = OE_Default;
++  sqlitePersistTriggerStep(pTriggerStep);
++
++  return pTriggerStep;
++}
++
++/*
++** Build a trigger step out of an INSERT statement.  Return a pointer
++** to the new trigger step.
++**
++** The parser calls this routine when it sees an INSERT inside the
++** body of a trigger.
++*/
++TriggerStep *sqliteTriggerInsertStep(
++  Token *pTableName,  /* Name of the table into which we insert */
++  IdList *pColumn,    /* List of columns in pTableName to insert into */
++  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */
++  Select *pSelect,    /* A SELECT statement that supplies values */
++  int orconf          /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
++){
++  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
++  if( pTriggerStep==0 ) return 0;
++
++  assert(pEList == 0 || pSelect == 0);
++  assert(pEList != 0 || pSelect != 0);
++
++  pTriggerStep->op = TK_INSERT;
++  pTriggerStep->pSelect = pSelect;
++  pTriggerStep->target  = *pTableName;
++  pTriggerStep->pIdList = pColumn;
++  pTriggerStep->pExprList = pEList;
++  pTriggerStep->orconf = orconf;
++  sqlitePersistTriggerStep(pTriggerStep);
++
++  return pTriggerStep;
++}
++
++/*
++** Construct a trigger step that implements an UPDATE statement and return
++** a pointer to that trigger step.  The parser calls this routine when it
++** sees an UPDATE statement inside the body of a CREATE TRIGGER.
++*/
++TriggerStep *sqliteTriggerUpdateStep(
++  Token *pTableName,   /* Name of the table to be updated */
++  ExprList *pEList,    /* The SET clause: list of column and new values */
++  Expr *pWhere,        /* The WHERE clause */
++  int orconf           /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
++){
++  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
++  if( pTriggerStep==0 ) return 0;
++
++  pTriggerStep->op = TK_UPDATE;
++  pTriggerStep->target  = *pTableName;
++  pTriggerStep->pExprList = pEList;
++  pTriggerStep->pWhere = pWhere;
++  pTriggerStep->orconf = orconf;
++  sqlitePersistTriggerStep(pTriggerStep);
++
++  return pTriggerStep;
++}
++
++/*
++** Construct a trigger step that implements a DELETE statement and return
++** a pointer to that trigger step.  The parser calls this routine when it
++** sees a DELETE statement inside the body of a CREATE TRIGGER.
++*/
++TriggerStep *sqliteTriggerDeleteStep(Token *pTableName, Expr *pWhere){
++  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
++  if( pTriggerStep==0 ) return 0;
++
++  pTriggerStep->op = TK_DELETE;
++  pTriggerStep->target  = *pTableName;
++  pTriggerStep->pWhere = pWhere;
++  pTriggerStep->orconf = OE_Default;
++  sqlitePersistTriggerStep(pTriggerStep);
++
++  return pTriggerStep;
++}
++
++/* 
++** Recursively delete a Trigger structure
++*/
++void sqliteDeleteTrigger(Trigger *pTrigger){
++  if( pTrigger==0 ) return;
++  sqliteDeleteTriggerStep(pTrigger->step_list);
++  sqliteFree(pTrigger->name);
++  sqliteFree(pTrigger->table);
++  sqliteExprDelete(pTrigger->pWhen);
++  sqliteIdListDelete(pTrigger->pColumns);
++  if( pTrigger->nameToken.dyn ) sqliteFree((char*)pTrigger->nameToken.z);
++  sqliteFree(pTrigger);
++}
++
++/*
++ * This function is called to drop a trigger from the database schema. 
++ *
++ * This may be called directly from the parser and therefore identifies
++ * the trigger by name.  The sqliteDropTriggerPtr() routine does the
++ * same job as this routine except it take a spointer to the trigger
++ * instead of the trigger name.
++ *
++ * Note that this function does not delete the trigger entirely. Instead it
++ * removes it from the internal schema and places it in the trigDrop hash 
++ * table. This is so that the trigger can be restored into the database schema
++ * if the transaction is rolled back.
++ */
++void sqliteDropTrigger(Parse *pParse, SrcList *pName){
++  Trigger *pTrigger;
++  int i;
++  const char *zDb;
++  const char *zName;
++  int nName;
++  sqlite *db = pParse->db;
++
++  if( sqlite_malloc_failed ) goto drop_trigger_cleanup;
++  assert( pName->nSrc==1 );
++  zDb = pName->a[0].zDatabase;
++  zName = pName->a[0].zName;
++  nName = strlen(zName);
++  for(i=0; i<db->nDb; i++){
++    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */
++    if( zDb && sqliteStrICmp(db->aDb[j].zName, zDb) ) continue;
++    pTrigger = sqliteHashFind(&(db->aDb[j].trigHash), zName, nName+1);
++    if( pTrigger ) break;
++  }
++  if( !pTrigger ){
++    sqliteErrorMsg(pParse, "no such trigger: %S", pName, 0);
++    goto drop_trigger_cleanup;
++  }
++  sqliteDropTriggerPtr(pParse, pTrigger, 0);
++
++drop_trigger_cleanup:
++  sqliteSrcListDelete(pName);
++}
++
++/*
++** Drop a trigger given a pointer to that trigger.  If nested is false,
++** then also generate code to remove the trigger from the SQLITE_MASTER
++** table.
++*/
++void sqliteDropTriggerPtr(Parse *pParse, Trigger *pTrigger, int nested){
++  Table   *pTable;
++  Vdbe *v;
++  sqlite *db = pParse->db;
++
++  assert( pTrigger->iDb<db->nDb );
++  if( pTrigger->iDb>=2 ){
++    sqliteErrorMsg(pParse, "triggers may not be removed from "
++       "auxiliary database %s", db->aDb[pTrigger->iDb].zName);
++    return;
++  }
++  pTable = sqliteFindTable(db, pTrigger->table,db->aDb[pTrigger->iTabDb].zName);
++  assert(pTable);
++  assert( pTable->iDb==pTrigger->iDb || pTrigger->iDb==1 );
++#ifndef SQLITE_OMIT_AUTHORIZATION
++  {
++    int code = SQLITE_DROP_TRIGGER;
++    const char *zDb = db->aDb[pTrigger->iDb].zName;
++    const char *zTab = SCHEMA_TABLE(pTrigger->iDb);
++    if( pTrigger->iDb ) code = SQLITE_DROP_TEMP_TRIGGER;
++    if( sqliteAuthCheck(pParse, code, pTrigger->name, pTable->zName, zDb) ||
++      sqliteAuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
++      return;
++    }
++  }
++#endif
++
++  /* Generate code to destroy the database record of the trigger.
++  */
++  if( pTable!=0 && !nested && (v = sqliteGetVdbe(pParse))!=0 ){
++    int base;
++    static VdbeOpList dropTrigger[] = {
++      { OP_Rewind,     0, ADDR(9),  0},
++      { OP_String,     0, 0,        0}, /* 1 */
++      { OP_Column,     0, 1,        0},
++      { OP_Ne,         0, ADDR(8),  0},
++      { OP_String,     0, 0,        "trigger"},
++      { OP_Column,     0, 0,        0},
++      { OP_Ne,         0, ADDR(8),  0},
++      { OP_Delete,     0, 0,        0},
++      { OP_Next,       0, ADDR(1),  0}, /* 8 */
++    };
++
++    sqliteBeginWriteOperation(pParse, 0, 0);
++    sqliteOpenMasterTable(v, pTrigger->iDb);
++    base = sqliteVdbeAddOpList(v,  ArraySize(dropTrigger), dropTrigger);
++    sqliteVdbeChangeP3(v, base+1, pTrigger->name, 0);
++    if( pTrigger->iDb==0 ){
++      sqliteChangeCookie(db, v);
++    }
++    sqliteVdbeAddOp(v, OP_Close, 0, 0);
++    sqliteEndWriteOperation(pParse);
++  }
++
++  /*
++   * If this is not an "explain", then delete the trigger structure.
++   */
++  if( !pParse->explain ){
++    const char *zName = pTrigger->name;
++    int nName = strlen(zName);
++    if( pTable->pTrigger == pTrigger ){
++      pTable->pTrigger = pTrigger->pNext;
++    }else{
++      Trigger *cc = pTable->pTrigger;
++      while( cc ){ 
++        if( cc->pNext == pTrigger ){
++          cc->pNext = cc->pNext->pNext;
++          break;
++        }
++        cc = cc->pNext;
++      }
++      assert(cc);
++    }
++    sqliteHashInsert(&(db->aDb[pTrigger->iDb].trigHash), zName, nName+1, 0);
++    sqliteDeleteTrigger(pTrigger);
++  }
++}
++
++/*
++** pEList is the SET clause of an UPDATE statement.  Each entry
++** in pEList is of the format <id>=<expr>.  If any of the entries
++** in pEList have an <id> which matches an identifier in pIdList,
++** then return TRUE.  If pIdList==NULL, then it is considered a
++** wildcard that matches anything.  Likewise if pEList==NULL then
++** it matches anything so always return true.  Return false only
++** if there is no match.
++*/
++static int checkColumnOverLap(IdList *pIdList, ExprList *pEList){
++  int e;
++  if( !pIdList || !pEList ) return 1;
++  for(e=0; e<pEList->nExpr; e++){
++    if( sqliteIdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1;
++  }
++  return 0; 
++}
++
++/* A global variable that is TRUE if we should always set up temp tables for
++ * for triggers, even if there are no triggers to code. This is used to test 
++ * how much overhead the triggers algorithm is causing.
++ *
++ * This flag can be set or cleared using the "trigger_overhead_test" pragma.
++ * The pragma is not documented since it is not really part of the interface
++ * to SQLite, just the test procedure.
++*/
++int always_code_trigger_setup = 0;
++
++/*
++ * Returns true if a trigger matching op, tr_tm and foreach that is NOT already
++ * on the Parse objects trigger-stack (to prevent recursive trigger firing) is
++ * found in the list specified as pTrigger.
++ */
++int sqliteTriggersExist(
++  Parse *pParse,          /* Used to check for recursive triggers */
++  Trigger *pTrigger,      /* A list of triggers associated with a table */
++  int op,                 /* one of TK_DELETE, TK_INSERT, TK_UPDATE */
++  int tr_tm,              /* one of TK_BEFORE, TK_AFTER */
++  int foreach,            /* one of TK_ROW or TK_STATEMENT */
++  ExprList *pChanges      /* Columns that change in an UPDATE statement */
++){
++  Trigger * pTriggerCursor;
++
++  if( always_code_trigger_setup ){
++    return 1;
++  }
++
++  pTriggerCursor = pTrigger;
++  while( pTriggerCursor ){
++    if( pTriggerCursor->op == op && 
++      pTriggerCursor->tr_tm == tr_tm && 
++      pTriggerCursor->foreach == foreach &&
++      checkColumnOverLap(pTriggerCursor->pColumns, pChanges) ){
++      TriggerStack * ss;
++      ss = pParse->trigStack;
++      while( ss && ss->pTrigger != pTrigger ){
++      ss = ss->pNext;
++      }
++      if( !ss )return 1;
++    }
++    pTriggerCursor = pTriggerCursor->pNext;
++  }
++
++  return 0;
++}
++
++/*
++** Convert the pStep->target token into a SrcList and return a pointer
++** to that SrcList.
++**
++** This routine adds a specific database name, if needed, to the target when
++** forming the SrcList.  This prevents a trigger in one database from
++** referring to a target in another database.  An exception is when the
++** trigger is in TEMP in which case it can refer to any other database it
++** wants.
++*/
++static SrcList *targetSrcList(
++  Parse *pParse,       /* The parsing context */
++  TriggerStep *pStep   /* The trigger containing the target token */
++){
++  Token sDb;           /* Dummy database name token */
++  int iDb;             /* Index of the database to use */
++  SrcList *pSrc;       /* SrcList to be returned */
++
++  iDb = pStep->pTrig->iDb;
++  if( iDb==0 || iDb>=2 ){
++    assert( iDb<pParse->db->nDb );
++    sDb.z = pParse->db->aDb[iDb].zName;
++    sDb.n = strlen(sDb.z);
++    pSrc = sqliteSrcListAppend(0, &sDb, &pStep->target);
++  } else {
++    pSrc = sqliteSrcListAppend(0, &pStep->target, 0);
++  }
++  return pSrc;
++}
++
++/*
++** Generate VDBE code for zero or more statements inside the body of a
++** trigger.  
++*/
++static int codeTriggerProgram(
++  Parse *pParse,            /* The parser context */
++  TriggerStep *pStepList,   /* List of statements inside the trigger body */
++  int orconfin              /* Conflict algorithm. (OE_Abort, etc) */  
++){
++  TriggerStep * pTriggerStep = pStepList;
++  int orconf;
++
++  while( pTriggerStep ){
++    int saveNTab = pParse->nTab;
++ 
++    orconf = (orconfin == OE_Default)?pTriggerStep->orconf:orconfin;
++    pParse->trigStack->orconf = orconf;
++    switch( pTriggerStep->op ){
++      case TK_SELECT: {
++      Select * ss = sqliteSelectDup(pTriggerStep->pSelect);             
++      assert(ss);
++      assert(ss->pSrc);
++      sqliteSelect(pParse, ss, SRT_Discard, 0, 0, 0, 0);
++      sqliteSelectDelete(ss);
++      break;
++      }
++      case TK_UPDATE: {
++        SrcList *pSrc;
++        pSrc = targetSrcList(pParse, pTriggerStep);
++        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPush, 0, 0);
++        sqliteUpdate(pParse, pSrc,
++              sqliteExprListDup(pTriggerStep->pExprList), 
++              sqliteExprDup(pTriggerStep->pWhere), orconf);
++        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPop, 0, 0);
++        break;
++      }
++      case TK_INSERT: {
++        SrcList *pSrc;
++        pSrc = targetSrcList(pParse, pTriggerStep);
++        sqliteInsert(pParse, pSrc,
++          sqliteExprListDup(pTriggerStep->pExprList), 
++          sqliteSelectDup(pTriggerStep->pSelect), 
++          sqliteIdListDup(pTriggerStep->pIdList), orconf);
++        break;
++      }
++      case TK_DELETE: {
++        SrcList *pSrc;
++        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPush, 0, 0);
++        pSrc = targetSrcList(pParse, pTriggerStep);
++        sqliteDeleteFrom(pParse, pSrc, sqliteExprDup(pTriggerStep->pWhere));
++        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPop, 0, 0);
++        break;
++      }
++      default:
++        assert(0);
++    } 
++    pParse->nTab = saveNTab;
++    pTriggerStep = pTriggerStep->pNext;
++  }
++
++  return 0;
++}
++
++/*
++** This is called to code FOR EACH ROW triggers.
++**
++** When the code that this function generates is executed, the following 
++** must be true:
++**
++** 1. No cursors may be open in the main database.  (But newIdx and oldIdx
++**    can be indices of cursors in temporary tables.  See below.)
++**
++** 2. If the triggers being coded are ON INSERT or ON UPDATE triggers, then
++**    a temporary vdbe cursor (index newIdx) must be open and pointing at
++**    a row containing values to be substituted for new.* expressions in the
++**    trigger program(s).
++**
++** 3. If the triggers being coded are ON DELETE or ON UPDATE triggers, then
++**    a temporary vdbe cursor (index oldIdx) must be open and pointing at
++**    a row containing values to be substituted for old.* expressions in the
++**    trigger program(s).
++**
++*/
++int sqliteCodeRowTrigger(
++  Parse *pParse,       /* Parse context */
++  int op,              /* One of TK_UPDATE, TK_INSERT, TK_DELETE */
++  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */
++  int tr_tm,           /* One of TK_BEFORE, TK_AFTER */
++  Table *pTab,         /* The table to code triggers from */
++  int newIdx,          /* The indice of the "new" row to access */
++  int oldIdx,          /* The indice of the "old" row to access */
++  int orconf,          /* ON CONFLICT policy */
++  int ignoreJump       /* Instruction to jump to for RAISE(IGNORE) */
++){
++  Trigger * pTrigger;
++  TriggerStack * pTriggerStack;
++
++  assert(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE);
++  assert(tr_tm == TK_BEFORE || tr_tm == TK_AFTER );
++
++  assert(newIdx != -1 || oldIdx != -1);
++
++  pTrigger = pTab->pTrigger;
++  while( pTrigger ){
++    int fire_this = 0;
++
++    /* determine whether we should code this trigger */
++    if( pTrigger->op == op && pTrigger->tr_tm == tr_tm && 
++        pTrigger->foreach == TK_ROW ){
++      fire_this = 1;
++      pTriggerStack = pParse->trigStack;
++      while( pTriggerStack ){
++        if( pTriggerStack->pTrigger == pTrigger ){
++        fire_this = 0;
++      }
++        pTriggerStack = pTriggerStack->pNext;
++      }
++      if( op == TK_UPDATE && pTrigger->pColumns &&
++          !checkColumnOverLap(pTrigger->pColumns, pChanges) ){
++        fire_this = 0;
++      }
++    }
++
++    if( fire_this && (pTriggerStack = sqliteMalloc(sizeof(TriggerStack)))!=0 ){
++      int endTrigger;
++      SrcList dummyTablist;
++      Expr * whenExpr;
++      AuthContext sContext;
++
++      dummyTablist.nSrc = 0;
++
++      /* Push an entry on to the trigger stack */
++      pTriggerStack->pTrigger = pTrigger;
++      pTriggerStack->newIdx = newIdx;
++      pTriggerStack->oldIdx = oldIdx;
++      pTriggerStack->pTab = pTab;
++      pTriggerStack->pNext = pParse->trigStack;
++      pTriggerStack->ignoreJump = ignoreJump;
++      pParse->trigStack = pTriggerStack;
++      sqliteAuthContextPush(pParse, &sContext, pTrigger->name);
++
++      /* code the WHEN clause */
++      endTrigger = sqliteVdbeMakeLabel(pParse->pVdbe);
++      whenExpr = sqliteExprDup(pTrigger->pWhen);
++      if( sqliteExprResolveIds(pParse, &dummyTablist, 0, whenExpr) ){
++        pParse->trigStack = pParse->trigStack->pNext;
++        sqliteFree(pTriggerStack);
++        sqliteExprDelete(whenExpr);
++        return 1;
++      }
++      sqliteExprIfFalse(pParse, whenExpr, endTrigger, 1);
++      sqliteExprDelete(whenExpr);
++
++      sqliteVdbeAddOp(pParse->pVdbe, OP_ContextPush, 0, 0);
++      codeTriggerProgram(pParse, pTrigger->step_list, orconf); 
++      sqliteVdbeAddOp(pParse->pVdbe, OP_ContextPop, 0, 0);
++
++      /* Pop the entry off the trigger stack */
++      pParse->trigStack = pParse->trigStack->pNext;
++      sqliteAuthContextPop(&sContext);
++      sqliteFree(pTriggerStack);
++
++      sqliteVdbeResolveLabel(pParse->pVdbe, endTrigger);
++    }
++    pTrigger = pTrigger->pNext;
++  }
++
++  return 0;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/update.c
+@@ -0,0 +1,459 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains C code routines that are called by the parser
++** to handle UPDATE statements.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** Process an UPDATE statement.
++**
++**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;
++**          \_______/ \________/     \______/       \________________/
++*            onError   pTabList      pChanges             pWhere
++*/
++void sqliteUpdate(
++  Parse *pParse,         /* The parser context */
++  SrcList *pTabList,     /* The table in which we should change things */
++  ExprList *pChanges,    /* Things to be changed */
++  Expr *pWhere,          /* The WHERE clause.  May be null */
++  int onError            /* How to handle constraint errors */
++){
++  int i, j;              /* Loop counters */
++  Table *pTab;           /* The table to be updated */
++  int loopStart;         /* VDBE instruction address of the start of the loop */
++  int jumpInst;          /* Addr of VDBE instruction to jump out of loop */
++  WhereInfo *pWInfo;     /* Information about the WHERE clause */
++  Vdbe *v;               /* The virtual database engine */
++  Index *pIdx;           /* For looping over indices */
++  int nIdx;              /* Number of indices that need updating */
++  int nIdxTotal;         /* Total number of indices */
++  int iCur;              /* VDBE Cursor number of pTab */
++  sqlite *db;            /* The database structure */
++  Index **apIdx = 0;     /* An array of indices that need updating too */
++  char *aIdxUsed = 0;    /* aIdxUsed[i]==1 if the i-th index is used */
++  int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the
++                         ** an expression for the i-th column of the table.
++                         ** aXRef[i]==-1 if the i-th column is not changed. */
++  int chngRecno;         /* True if the record number is being changed */
++  Expr *pRecnoExpr;      /* Expression defining the new record number */
++  int openAll;           /* True if all indices need to be opened */
++  int isView;            /* Trying to update a view */
++  int iStackDepth;       /* Index of memory cell holding stack depth */
++  AuthContext sContext;  /* The authorization context */
++
++  int before_triggers;         /* True if there are any BEFORE triggers */
++  int after_triggers;          /* True if there are any AFTER triggers */
++  int row_triggers_exist = 0;  /* True if any row triggers exist */
++
++  int newIdx      = -1;  /* index of trigger "new" temp table       */
++  int oldIdx      = -1;  /* index of trigger "old" temp table       */
++
++  sContext.pParse = 0;
++  if( pParse->nErr || sqlite_malloc_failed ) goto update_cleanup;
++  db = pParse->db;
++  assert( pTabList->nSrc==1 );
++  iStackDepth = pParse->nMem++;
++
++  /* Locate the table which we want to update. 
++  */
++  pTab = sqliteSrcListLookup(pParse, pTabList);
++  if( pTab==0 ) goto update_cleanup;
++  before_triggers = sqliteTriggersExist(pParse, pTab->pTrigger, 
++            TK_UPDATE, TK_BEFORE, TK_ROW, pChanges);
++  after_triggers = sqliteTriggersExist(pParse, pTab->pTrigger, 
++            TK_UPDATE, TK_AFTER, TK_ROW, pChanges);
++  row_triggers_exist = before_triggers || after_triggers;
++  isView = pTab->pSelect!=0;
++  if( sqliteIsReadOnly(pParse, pTab, before_triggers) ){
++    goto update_cleanup;
++  }
++  if( isView ){
++    if( sqliteViewGetColumnNames(pParse, pTab) ){
++      goto update_cleanup;
++    }
++  }
++  aXRef = sqliteMalloc( sizeof(int) * pTab->nCol );
++  if( aXRef==0 ) goto update_cleanup;
++  for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;
++
++  /* If there are FOR EACH ROW triggers, allocate cursors for the
++  ** special OLD and NEW tables
++  */
++  if( row_triggers_exist ){
++    newIdx = pParse->nTab++;
++    oldIdx = pParse->nTab++;
++  }
++
++  /* Allocate a cursors for the main database table and for all indices.
++  ** The index cursors might not be used, but if they are used they
++  ** need to occur right after the database cursor.  So go ahead and
++  ** allocate enough space, just in case.
++  */
++  pTabList->a[0].iCursor = iCur = pParse->nTab++;
++  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
++    pParse->nTab++;
++  }
++
++  /* Resolve the column names in all the expressions of the
++  ** of the UPDATE statement.  Also find the column index
++  ** for each column to be updated in the pChanges array.  For each
++  ** column to be updated, make sure we have authorization to change
++  ** that column.
++  */
++  chngRecno = 0;
++  for(i=0; i<pChanges->nExpr; i++){
++    if( sqliteExprResolveIds(pParse, pTabList, 0, pChanges->a[i].pExpr) ){
++      goto update_cleanup;
++    }
++    if( sqliteExprCheck(pParse, pChanges->a[i].pExpr, 0, 0) ){
++      goto update_cleanup;
++    }
++    for(j=0; j<pTab->nCol; j++){
++      if( sqliteStrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
++        if( j==pTab->iPKey ){
++          chngRecno = 1;
++          pRecnoExpr = pChanges->a[i].pExpr;
++        }
++        aXRef[j] = i;
++        break;
++      }
++    }
++    if( j>=pTab->nCol ){
++      if( sqliteIsRowid(pChanges->a[i].zName) ){
++        chngRecno = 1;
++        pRecnoExpr = pChanges->a[i].pExpr;
++      }else{
++        sqliteErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
++        goto update_cleanup;
++      }
++    }
++#ifndef SQLITE_OMIT_AUTHORIZATION
++    {
++      int rc;
++      rc = sqliteAuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
++                           pTab->aCol[j].zName, db->aDb[pTab->iDb].zName);
++      if( rc==SQLITE_DENY ){
++        goto update_cleanup;
++      }else if( rc==SQLITE_IGNORE ){
++        aXRef[j] = -1;
++      }
++    }
++#endif
++  }
++
++  /* Allocate memory for the array apIdx[] and fill it with pointers to every
++  ** index that needs to be updated.  Indices only need updating if their
++  ** key includes one of the columns named in pChanges or if the record
++  ** number of the original table entry is changing.
++  */
++  for(nIdx=nIdxTotal=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdxTotal++){
++    if( chngRecno ){
++      i = 0;
++    }else {
++      for(i=0; i<pIdx->nColumn; i++){
++        if( aXRef[pIdx->aiColumn[i]]>=0 ) break;
++      }
++    }
++    if( i<pIdx->nColumn ) nIdx++;
++  }
++  if( nIdxTotal>0 ){
++    apIdx = sqliteMalloc( sizeof(Index*) * nIdx + nIdxTotal );
++    if( apIdx==0 ) goto update_cleanup;
++    aIdxUsed = (char*)&apIdx[nIdx];
++  }
++  for(nIdx=j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
++    if( chngRecno ){
++      i = 0;
++    }else{
++      for(i=0; i<pIdx->nColumn; i++){
++        if( aXRef[pIdx->aiColumn[i]]>=0 ) break;
++      }
++    }
++    if( i<pIdx->nColumn ){
++      apIdx[nIdx++] = pIdx;
++      aIdxUsed[j] = 1;
++    }else{
++      aIdxUsed[j] = 0;
++    }
++  }
++
++  /* Resolve the column names in all the expressions in the
++  ** WHERE clause.
++  */
++  if( pWhere ){
++    if( sqliteExprResolveIds(pParse, pTabList, 0, pWhere) ){
++      goto update_cleanup;
++    }
++    if( sqliteExprCheck(pParse, pWhere, 0, 0) ){
++      goto update_cleanup;
++    }
++  }
++
++  /* Start the view context
++  */
++  if( isView ){
++    sqliteAuthContextPush(pParse, &sContext, pTab->zName);
++  }
++
++  /* Begin generating code.
++  */
++  v = sqliteGetVdbe(pParse);
++  if( v==0 ) goto update_cleanup;
++  sqliteBeginWriteOperation(pParse, 1, pTab->iDb);
++
++  /* If we are trying to update a view, construct that view into
++  ** a temporary table.
++  */
++  if( isView ){
++    Select *pView;
++    pView = sqliteSelectDup(pTab->pSelect);
++    sqliteSelect(pParse, pView, SRT_TempTable, iCur, 0, 0, 0);
++    sqliteSelectDelete(pView);
++  }
++
++  /* Begin the database scan
++  */
++  pWInfo = sqliteWhereBegin(pParse, pTabList, pWhere, 1, 0);
++  if( pWInfo==0 ) goto update_cleanup;
++
++  /* Remember the index of every item to be updated.
++  */
++  sqliteVdbeAddOp(v, OP_ListWrite, 0, 0);
++
++  /* End the database scan loop.
++  */
++  sqliteWhereEnd(pWInfo);
++
++  /* Initialize the count of updated rows
++  */
++  if( db->flags & SQLITE_CountRows && !pParse->trigStack ){
++    sqliteVdbeAddOp(v, OP_Integer, 0, 0);
++  }
++
++  if( row_triggers_exist ){
++    /* Create pseudo-tables for NEW and OLD
++    */
++    sqliteVdbeAddOp(v, OP_OpenPseudo, oldIdx, 0);
++    sqliteVdbeAddOp(v, OP_OpenPseudo, newIdx, 0);
++
++    /* The top of the update loop for when there are triggers.
++    */
++    sqliteVdbeAddOp(v, OP_ListRewind, 0, 0);
++    sqliteVdbeAddOp(v, OP_StackDepth, 0, 0);
++    sqliteVdbeAddOp(v, OP_MemStore, iStackDepth, 1);
++    loopStart = sqliteVdbeAddOp(v, OP_MemLoad, iStackDepth, 0);
++    sqliteVdbeAddOp(v, OP_StackReset, 0, 0);
++    jumpInst = sqliteVdbeAddOp(v, OP_ListRead, 0, 0);
++    sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++
++    /* Open a cursor and make it point to the record that is
++    ** being updated.
++    */
++    sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++    if( !isView ){
++      sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++      sqliteVdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
++    }
++    sqliteVdbeAddOp(v, OP_MoveTo, iCur, 0);
++
++    /* Generate the OLD table
++    */
++    sqliteVdbeAddOp(v, OP_Recno, iCur, 0);
++    sqliteVdbeAddOp(v, OP_RowData, iCur, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
++
++    /* Generate the NEW table
++    */
++    if( chngRecno ){
++      sqliteExprCode(pParse, pRecnoExpr);
++    }else{
++      sqliteVdbeAddOp(v, OP_Recno, iCur, 0);
++    }
++    for(i=0; i<pTab->nCol; i++){
++      if( i==pTab->iPKey ){
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++        continue;
++      }
++      j = aXRef[i];
++      if( j<0 ){
++        sqliteVdbeAddOp(v, OP_Column, iCur, i);
++      }else{
++        sqliteExprCode(pParse, pChanges->a[j].pExpr);
++      }
++    }
++    sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
++    sqliteVdbeAddOp(v, OP_PutIntKey, newIdx, 0);
++    if( !isView ){
++      sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++    }
++
++    /* Fire the BEFORE and INSTEAD OF triggers
++    */
++    if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab, 
++          newIdx, oldIdx, onError, loopStart) ){
++      goto update_cleanup;
++    }
++  }
++
++  if( !isView ){
++    /* 
++    ** Open every index that needs updating.  Note that if any
++    ** index could potentially invoke a REPLACE conflict resolution 
++    ** action, then we need to open all indices because we might need
++    ** to be deleting some records.
++    */
++    sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++    sqliteVdbeAddOp(v, OP_OpenWrite, iCur, pTab->tnum);
++    if( onError==OE_Replace ){
++      openAll = 1;
++    }else{
++      openAll = 0;
++      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
++        if( pIdx->onError==OE_Replace ){
++          openAll = 1;
++          break;
++        }
++      }
++    }
++    for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
++      if( openAll || aIdxUsed[i] ){
++        sqliteVdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
++        sqliteVdbeAddOp(v, OP_OpenWrite, iCur+i+1, pIdx->tnum);
++        assert( pParse->nTab>iCur+i+1 );
++      }
++    }
++
++    /* Loop over every record that needs updating.  We have to load
++    ** the old data for each record to be updated because some columns
++    ** might not change and we will need to copy the old value.
++    ** Also, the old data is needed to delete the old index entires.
++    ** So make the cursor point at the old record.
++    */
++    if( !row_triggers_exist ){
++      sqliteVdbeAddOp(v, OP_ListRewind, 0, 0);
++      jumpInst = loopStart = sqliteVdbeAddOp(v, OP_ListRead, 0, 0);
++      sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++    }
++    sqliteVdbeAddOp(v, OP_NotExists, iCur, loopStart);
++
++    /* If the record number will change, push the record number as it
++    ** will be after the update. (The old record number is currently
++    ** on top of the stack.)
++    */
++    if( chngRecno ){
++      sqliteExprCode(pParse, pRecnoExpr);
++      sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
++    }
++
++    /* Compute new data for this record.  
++    */
++    for(i=0; i<pTab->nCol; i++){
++      if( i==pTab->iPKey ){
++        sqliteVdbeAddOp(v, OP_String, 0, 0);
++        continue;
++      }
++      j = aXRef[i];
++      if( j<0 ){
++        sqliteVdbeAddOp(v, OP_Column, iCur, i);
++      }else{
++        sqliteExprCode(pParse, pChanges->a[j].pExpr);
++      }
++    }
++
++    /* Do constraint checks
++    */
++    sqliteGenerateConstraintChecks(pParse, pTab, iCur, aIdxUsed, chngRecno, 1,
++                                   onError, loopStart);
++
++    /* Delete the old indices for the current record.
++    */
++    sqliteGenerateRowIndexDelete(db, v, pTab, iCur, aIdxUsed);
++
++    /* If changing the record number, delete the old record.
++    */
++    if( chngRecno ){
++      sqliteVdbeAddOp(v, OP_Delete, iCur, 0);
++    }
++
++    /* Create the new index entries and the new record.
++    */
++    sqliteCompleteInsertion(pParse, pTab, iCur, aIdxUsed, chngRecno, 1, -1);
++  }
++
++  /* Increment the row counter 
++  */
++  if( db->flags & SQLITE_CountRows && !pParse->trigStack){
++    sqliteVdbeAddOp(v, OP_AddImm, 1, 0);
++  }
++
++  /* If there are triggers, close all the cursors after each iteration
++  ** through the loop.  The fire the after triggers.
++  */
++  if( row_triggers_exist ){
++    if( !isView ){
++      for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
++        if( openAll || aIdxUsed[i] )
++          sqliteVdbeAddOp(v, OP_Close, iCur+i+1, 0);
++      }
++      sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++      pParse->nTab = iCur;
++    }
++    if( sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab, 
++          newIdx, oldIdx, onError, loopStart) ){
++      goto update_cleanup;
++    }
++  }
++
++  /* Repeat the above with the next record to be updated, until
++  ** all record selected by the WHERE clause have been updated.
++  */
++  sqliteVdbeAddOp(v, OP_Goto, 0, loopStart);
++  sqliteVdbeChangeP2(v, jumpInst, sqliteVdbeCurrentAddr(v));
++  sqliteVdbeAddOp(v, OP_ListReset, 0, 0);
++
++  /* Close all tables if there were no FOR EACH ROW triggers */
++  if( !row_triggers_exist ){
++    for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
++      if( openAll || aIdxUsed[i] ){
++        sqliteVdbeAddOp(v, OP_Close, iCur+i+1, 0);
++      }
++    }
++    sqliteVdbeAddOp(v, OP_Close, iCur, 0);
++    pParse->nTab = iCur;
++  }else{
++    sqliteVdbeAddOp(v, OP_Close, newIdx, 0);
++    sqliteVdbeAddOp(v, OP_Close, oldIdx, 0);
++  }
++
++  sqliteVdbeAddOp(v, OP_SetCounts, 0, 0);
++  sqliteEndWriteOperation(pParse);
++
++  /*
++  ** Return the number of rows that were changed.
++  */
++  if( db->flags & SQLITE_CountRows && !pParse->trigStack ){
++    sqliteVdbeOp3(v, OP_ColumnName, 0, 1, "rows updated", P3_STATIC);
++    sqliteVdbeAddOp(v, OP_Callback, 1, 0);
++  }
++
++update_cleanup:
++  sqliteAuthContextPop(&sContext);
++  sqliteFree(apIdx);
++  sqliteFree(aXRef);
++  sqliteSrcListDelete(pTabList);
++  sqliteExprListDelete(pChanges);
++  sqliteExprDelete(pWhere);
++  return;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/util.c
+@@ -0,0 +1,1134 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** Utility functions used throughout sqlite.
++**
++** This file contains functions for allocating memory, comparing
++** strings, and stuff like that.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include <stdarg.h>
++#include <ctype.h>
++
++/*
++** If malloc() ever fails, this global variable gets set to 1.
++** This causes the library to abort and never again function.
++*/
++int sqlite_malloc_failed = 0;
++
++/*
++** If MEMORY_DEBUG is defined, then use versions of malloc() and
++** free() that track memory usage and check for buffer overruns.
++*/
++#ifdef MEMORY_DEBUG
++
++/*
++** For keeping track of the number of mallocs and frees.   This
++** is used to check for memory leaks.
++*/
++int sqlite_nMalloc;         /* Number of sqliteMalloc() calls */
++int sqlite_nFree;           /* Number of sqliteFree() calls */
++int sqlite_iMallocFail;     /* Fail sqliteMalloc() after this many calls */
++#if MEMORY_DEBUG>1
++static int memcnt = 0;
++#endif
++
++/*
++** Number of 32-bit guard words
++*/
++#define N_GUARD 1
++
++/*
++** Allocate new memory and set it to zero.  Return NULL if
++** no memory is available.
++*/
++void *sqliteMalloc_(int n, int bZero, char *zFile, int line){
++  void *p;
++  int *pi;
++  int i, k;
++  if( sqlite_iMallocFail>=0 ){
++    sqlite_iMallocFail--;
++    if( sqlite_iMallocFail==0 ){
++      sqlite_malloc_failed++;
++#if MEMORY_DEBUG>1
++      fprintf(stderr,"**** failed to allocate %d bytes at %s:%d\n",
++              n, zFile,line);
++#endif
++      sqlite_iMallocFail--;
++      return 0;
++    }
++  }
++  if( n==0 ) return 0;
++  k = (n+sizeof(int)-1)/sizeof(int);
++  pi = malloc( (N_GUARD*2+1+k)*sizeof(int));
++  if( pi==0 ){
++    sqlite_malloc_failed++;
++    return 0;
++  }
++  sqlite_nMalloc++;
++  for(i=0; i<N_GUARD; i++) pi[i] = 0xdead1122;
++  pi[N_GUARD] = n;
++  for(i=0; i<N_GUARD; i++) pi[k+1+N_GUARD+i] = 0xdead3344;
++  p = &pi[N_GUARD+1];
++  memset(p, bZero==0, n);
++#if MEMORY_DEBUG>1
++  fprintf(stderr,"%06d malloc %d bytes at 0x%x from %s:%d\n",
++      ++memcnt, n, (int)p, zFile,line);
++#endif
++  return p;
++}
++
++/*
++** Check to see if the given pointer was obtained from sqliteMalloc()
++** and is able to hold at least N bytes.  Raise an exception if this
++** is not the case.
++**
++** This routine is used for testing purposes only.
++*/
++void sqliteCheckMemory(void *p, int N){
++  int *pi = p;
++  int n, i, k;
++  pi -= N_GUARD+1;
++  for(i=0; i<N_GUARD; i++){
++    assert( pi[i]==0xdead1122 );
++  }
++  n = pi[N_GUARD];
++  assert( N>=0 && N<n );
++  k = (n+sizeof(int)-1)/sizeof(int);
++  for(i=0; i<N_GUARD; i++){
++    assert( pi[k+N_GUARD+1+i]==0xdead3344 );
++  }
++}
++
++/*
++** Free memory previously obtained from sqliteMalloc()
++*/
++void sqliteFree_(void *p, char *zFile, int line){
++  if( p ){
++    int *pi, i, k, n;
++    pi = p;
++    pi -= N_GUARD+1;
++    sqlite_nFree++;
++    for(i=0; i<N_GUARD; i++){
++      if( pi[i]!=0xdead1122 ){
++        fprintf(stderr,"Low-end memory corruption at 0x%x\n", (int)p);
++        return;
++      }
++    }
++    n = pi[N_GUARD];
++    k = (n+sizeof(int)-1)/sizeof(int);
++    for(i=0; i<N_GUARD; i++){
++      if( pi[k+N_GUARD+1+i]!=0xdead3344 ){
++        fprintf(stderr,"High-end memory corruption at 0x%x\n", (int)p);
++        return;
++      }
++    }
++    memset(pi, 0xff, (k+N_GUARD*2+1)*sizeof(int));
++#if MEMORY_DEBUG>1
++    fprintf(stderr,"%06d free %d bytes at 0x%x from %s:%d\n",
++         ++memcnt, n, (int)p, zFile,line);
++#endif
++    free(pi);
++  }
++}
++
++/*
++** Resize a prior allocation.  If p==0, then this routine
++** works just like sqliteMalloc().  If n==0, then this routine
++** works just like sqliteFree().
++*/
++void *sqliteRealloc_(void *oldP, int n, char *zFile, int line){
++  int *oldPi, *pi, i, k, oldN, oldK;
++  void *p;
++  if( oldP==0 ){
++    return sqliteMalloc_(n,1,zFile,line);
++  }
++  if( n==0 ){
++    sqliteFree_(oldP,zFile,line);
++    return 0;
++  }
++  oldPi = oldP;
++  oldPi -= N_GUARD+1;
++  if( oldPi[0]!=0xdead1122 ){
++    fprintf(stderr,"Low-end memory corruption in realloc at 0x%x\n", (int)oldP);
++    return 0;
++  }
++  oldN = oldPi[N_GUARD];
++  oldK = (oldN+sizeof(int)-1)/sizeof(int);
++  for(i=0; i<N_GUARD; i++){
++    if( oldPi[oldK+N_GUARD+1+i]!=0xdead3344 ){
++      fprintf(stderr,"High-end memory corruption in realloc at 0x%x\n",
++              (int)oldP);
++      return 0;
++    }
++  }
++  k = (n + sizeof(int) - 1)/sizeof(int);
++  pi = malloc( (k+N_GUARD*2+1)*sizeof(int) );
++  if( pi==0 ){
++    sqlite_malloc_failed++;
++    return 0;
++  }
++  for(i=0; i<N_GUARD; i++) pi[i] = 0xdead1122;
++  pi[N_GUARD] = n;
++  for(i=0; i<N_GUARD; i++) pi[k+N_GUARD+1+i] = 0xdead3344;
++  p = &pi[N_GUARD+1];
++  memcpy(p, oldP, n>oldN ? oldN : n);
++  if( n>oldN ){
++    memset(&((char*)p)[oldN], 0, n-oldN);
++  }
++  memset(oldPi, 0xab, (oldK+N_GUARD+2)*sizeof(int));
++  free(oldPi);
++#if MEMORY_DEBUG>1
++  fprintf(stderr,"%06d realloc %d to %d bytes at 0x%x to 0x%x at %s:%d\n",
++    ++memcnt, oldN, n, (int)oldP, (int)p, zFile, line);
++#endif
++  return p;
++}
++
++/*
++** Make a duplicate of a string into memory obtained from malloc()
++** Free the original string using sqliteFree().
++**
++** This routine is called on all strings that are passed outside of
++** the SQLite library.  That way clients can free the string using free()
++** rather than having to call sqliteFree().
++*/
++void sqliteStrRealloc(char **pz){
++  char *zNew;
++  if( pz==0 || *pz==0 ) return;
++  zNew = malloc( strlen(*pz) + 1 );
++  if( zNew==0 ){
++    sqlite_malloc_failed++;
++    sqliteFree(*pz);
++    *pz = 0;
++  }
++  strcpy(zNew, *pz);
++  sqliteFree(*pz);
++  *pz = zNew;
++}
++
++/*
++** Make a copy of a string in memory obtained from sqliteMalloc()
++*/
++char *sqliteStrDup_(const char *z, char *zFile, int line){
++  char *zNew;
++  if( z==0 ) return 0;
++  zNew = sqliteMalloc_(strlen(z)+1, 0, zFile, line);
++  if( zNew ) strcpy(zNew, z);
++  return zNew;
++}
++char *sqliteStrNDup_(const char *z, int n, char *zFile, int line){
++  char *zNew;
++  if( z==0 ) return 0;
++  zNew = sqliteMalloc_(n+1, 0, zFile, line);
++  if( zNew ){
++    memcpy(zNew, z, n);
++    zNew[n] = 0;
++  }
++  return zNew;
++}
++#endif /* MEMORY_DEBUG */
++
++/*
++** The following versions of malloc() and free() are for use in a
++** normal build.
++*/
++#if !defined(MEMORY_DEBUG)
++
++/*
++** Allocate new memory and set it to zero.  Return NULL if
++** no memory is available.  See also sqliteMallocRaw().
++*/
++void *sqliteMalloc(int n){
++  void *p;
++  if( (p = malloc(n))==0 ){
++    if( n>0 ) sqlite_malloc_failed++;
++  }else{
++    memset(p, 0, n);
++  }
++  return p;
++}
++
++/*
++** Allocate new memory but do not set it to zero.  Return NULL if
++** no memory is available.  See also sqliteMalloc().
++*/
++void *sqliteMallocRaw(int n){
++  void *p;
++  if( (p = malloc(n))==0 ){
++    if( n>0 ) sqlite_malloc_failed++;
++  }
++  return p;
++}
++
++/*
++** Free memory previously obtained from sqliteMalloc()
++*/
++void sqliteFree(void *p){
++  if( p ){
++    free(p);
++  }
++}
++
++/*
++** Resize a prior allocation.  If p==0, then this routine
++** works just like sqliteMalloc().  If n==0, then this routine
++** works just like sqliteFree().
++*/
++void *sqliteRealloc(void *p, int n){
++  void *p2;
++  if( p==0 ){
++    return sqliteMalloc(n);
++  }
++  if( n==0 ){
++    sqliteFree(p);
++    return 0;
++  }
++  p2 = realloc(p, n);
++  if( p2==0 ){
++    sqlite_malloc_failed++;
++  }
++  return p2;
++}
++
++/*
++** Make a copy of a string in memory obtained from sqliteMalloc()
++*/
++char *sqliteStrDup(const char *z){
++  char *zNew;
++  if( z==0 ) return 0;
++  zNew = sqliteMallocRaw(strlen(z)+1);
++  if( zNew ) strcpy(zNew, z);
++  return zNew;
++}
++char *sqliteStrNDup(const char *z, int n){
++  char *zNew;
++  if( z==0 ) return 0;
++  zNew = sqliteMallocRaw(n+1);
++  if( zNew ){
++    memcpy(zNew, z, n);
++    zNew[n] = 0;
++  }
++  return zNew;
++}
++#endif /* !defined(MEMORY_DEBUG) */
++
++/*
++** Create a string from the 2nd and subsequent arguments (up to the
++** first NULL argument), store the string in memory obtained from
++** sqliteMalloc() and make the pointer indicated by the 1st argument
++** point to that string.  The 1st argument must either be NULL or 
++** point to memory obtained from sqliteMalloc().
++*/
++void sqliteSetString(char **pz, ...){
++  va_list ap;
++  int nByte;
++  const char *z;
++  char *zResult;
++
++  if( pz==0 ) return;
++  nByte = 1;
++  va_start(ap, pz);
++  while( (z = va_arg(ap, const char*))!=0 ){
++    nByte += strlen(z);
++  }
++  va_end(ap);
++  sqliteFree(*pz);
++  *pz = zResult = sqliteMallocRaw( nByte );
++  if( zResult==0 ){
++    return;
++  }
++  *zResult = 0;
++  va_start(ap, pz);
++  while( (z = va_arg(ap, const char*))!=0 ){
++    strcpy(zResult, z);
++    zResult += strlen(zResult);
++  }
++  va_end(ap);
++#ifdef MEMORY_DEBUG
++#if MEMORY_DEBUG>1
++  fprintf(stderr,"string at 0x%x is %s\n", (int)*pz, *pz);
++#endif
++#endif
++}
++
++/*
++** Works like sqliteSetString, but each string is now followed by
++** a length integer which specifies how much of the source string 
++** to copy (in bytes).  -1 means use the whole string.  The 1st 
++** argument must either be NULL or point to memory obtained from 
++** sqliteMalloc().
++*/
++void sqliteSetNString(char **pz, ...){
++  va_list ap;
++  int nByte;
++  const char *z;
++  char *zResult;
++  int n;
++
++  if( pz==0 ) return;
++  nByte = 0;
++  va_start(ap, pz);
++  while( (z = va_arg(ap, const char*))!=0 ){
++    n = va_arg(ap, int);
++    if( n<=0 ) n = strlen(z);
++    nByte += n;
++  }
++  va_end(ap);
++  sqliteFree(*pz);
++  *pz = zResult = sqliteMallocRaw( nByte + 1 );
++  if( zResult==0 ) return;
++  va_start(ap, pz);
++  while( (z = va_arg(ap, const char*))!=0 ){
++    n = va_arg(ap, int);
++    if( n<=0 ) n = strlen(z);
++    strncpy(zResult, z, n);
++    zResult += n;
++  }
++  *zResult = 0;
++#ifdef MEMORY_DEBUG
++#if MEMORY_DEBUG>1
++  fprintf(stderr,"string at 0x%x is %s\n", (int)*pz, *pz);
++#endif
++#endif
++  va_end(ap);
++}
++
++/*
++** Add an error message to pParse->zErrMsg and increment pParse->nErr.
++** The following formatting characters are allowed:
++**
++**      %s      Insert a string
++**      %z      A string that should be freed after use
++**      %d      Insert an integer
++**      %T      Insert a token
++**      %S      Insert the first element of a SrcList
++*/
++void sqliteErrorMsg(Parse *pParse, const char *zFormat, ...){
++  va_list ap;
++  pParse->nErr++;
++  sqliteFree(pParse->zErrMsg);
++  va_start(ap, zFormat);
++  pParse->zErrMsg = sqliteVMPrintf(zFormat, ap);
++  va_end(ap);
++}
++
++/*
++** Convert an SQL-style quoted string into a normal string by removing
++** the quote characters.  The conversion is done in-place.  If the
++** input does not begin with a quote character, then this routine
++** is a no-op.
++**
++** 2002-Feb-14: This routine is extended to remove MS-Access style
++** brackets from around identifers.  For example:  "[a-b-c]" becomes
++** "a-b-c".
++*/
++void sqliteDequote(char *z){
++  int quote;
++  int i, j;
++  if( z==0 ) return;
++  quote = z[0];
++  switch( quote ){
++    case '\'':  break;
++    case '"':   break;
++    case '[':   quote = ']';  break;
++    default:    return;
++  }
++  for(i=1, j=0; z[i]; i++){
++    if( z[i]==quote ){
++      if( z[i+1]==quote ){
++        z[j++] = quote;
++        i++;
++      }else{
++        z[j++] = 0;
++        break;
++      }
++    }else{
++      z[j++] = z[i];
++    }
++  }
++}
++
++/* An array to map all upper-case characters into their corresponding
++** lower-case character. 
++*/
++static unsigned char UpperToLower[] = {
++      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
++     18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
++     36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
++     54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103,
++    104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,
++    122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,
++    108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
++    126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
++    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,
++    162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
++    180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,
++    198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
++    216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,
++    234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
++    252,253,254,255
++};
++
++/*
++** This function computes a hash on the name of a keyword.
++** Case is not significant.
++*/
++int sqliteHashNoCase(const char *z, int n){
++  int h = 0;
++  if( n<=0 ) n = strlen(z);
++  while( n > 0  ){
++    h = (h<<3) ^ h ^ UpperToLower[(unsigned char)*z++];
++    n--;
++  }
++  return h & 0x7fffffff;
++}
++
++/*
++** Some systems have stricmp().  Others have strcasecmp().  Because
++** there is no consistency, we will define our own.
++*/
++int sqliteStrICmp(const char *zLeft, const char *zRight){
++  register unsigned char *a, *b;
++  a = (unsigned char *)zLeft;
++  b = (unsigned char *)zRight;
++  while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
++  return UpperToLower[*a] - UpperToLower[*b];
++}
++int sqliteStrNICmp(const char *zLeft, const char *zRight, int N){
++  register unsigned char *a, *b;
++  a = (unsigned char *)zLeft;
++  b = (unsigned char *)zRight;
++  while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
++  return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
++}
++
++/*
++** Return TRUE if z is a pure numeric string.  Return FALSE if the
++** string contains any character which is not part of a number.
++**
++** Am empty string is considered non-numeric.
++*/
++int sqliteIsNumber(const char *z){
++  if( *z=='-' || *z=='+' ) z++;
++  if( !isdigit(*z) ){
++    return 0;
++  }
++  z++;
++  while( isdigit(*z) ){ z++; }
++  if( *z=='.' ){
++    z++;
++    if( !isdigit(*z) ) return 0;
++    while( isdigit(*z) ){ z++; }
++  }
++  if( *z=='e' || *z=='E' ){
++    z++;
++    if( *z=='+' || *z=='-' ) z++;
++    if( !isdigit(*z) ) return 0;
++    while( isdigit(*z) ){ z++; }
++  }
++  return *z==0;
++}
++
++/*
++** The string z[] is an ascii representation of a real number.
++** Convert this string to a double.
++**
++** This routine assumes that z[] really is a valid number.  If it
++** is not, the result is undefined.
++**
++** This routine is used instead of the library atof() function because
++** the library atof() might want to use "," as the decimal point instead
++** of "." depending on how locale is set.  But that would cause problems
++** for SQL.  So this routine always uses "." regardless of locale.
++*/
++double sqliteAtoF(const char *z, const char **pzEnd){
++  int sign = 1;
++  LONGDOUBLE_TYPE v1 = 0.0;
++  if( *z=='-' ){
++    sign = -1;
++    z++;
++  }else if( *z=='+' ){
++    z++;
++  }
++  while( isdigit(*z) ){
++    v1 = v1*10.0 + (*z - '0');
++    z++;
++  }
++  if( *z=='.' ){
++    LONGDOUBLE_TYPE divisor = 1.0;
++    z++;
++    while( isdigit(*z) ){
++      v1 = v1*10.0 + (*z - '0');
++      divisor *= 10.0;
++      z++;
++    }
++    v1 /= divisor;
++  }
++  if( *z=='e' || *z=='E' ){
++    int esign = 1;
++    int eval = 0;
++    LONGDOUBLE_TYPE scale = 1.0;
++    z++;
++    if( *z=='-' ){
++      esign = -1;
++      z++;
++    }else if( *z=='+' ){
++      z++;
++    }
++    while( isdigit(*z) ){
++      eval = eval*10 + *z - '0';
++      z++;
++    }
++    while( eval>=64 ){ scale *= 1.0e+64; eval -= 64; }
++    while( eval>=16 ){ scale *= 1.0e+16; eval -= 16; }
++    while( eval>=4 ){ scale *= 1.0e+4; eval -= 4; }
++    while( eval>=1 ){ scale *= 1.0e+1; eval -= 1; }
++    if( esign<0 ){
++      v1 /= scale;
++    }else{
++      v1 *= scale;
++    }
++  }
++  if( pzEnd ) *pzEnd = z;
++  return sign<0 ? -v1 : v1;
++}
++
++/*
++** The string zNum represents an integer.  There might be some other
++** information following the integer too, but that part is ignored.
++** If the integer that the prefix of zNum represents will fit in a
++** 32-bit signed integer, return TRUE.  Otherwise return FALSE.
++**
++** This routine returns FALSE for the string -2147483648 even that
++** that number will, in theory fit in a 32-bit integer.  But positive
++** 2147483648 will not fit in 32 bits.  So it seems safer to return
++** false.
++*/
++int sqliteFitsIn32Bits(const char *zNum){
++  int i, c;
++  if( *zNum=='-' || *zNum=='+' ) zNum++;
++  for(i=0; (c=zNum[i])>='0' && c<='9'; i++){}
++  return i<10 || (i==10 && memcmp(zNum,"2147483647",10)<=0);
++}
++
++/* This comparison routine is what we use for comparison operations
++** between numeric values in an SQL expression.  "Numeric" is a little
++** bit misleading here.  What we mean is that the strings have a
++** type of "numeric" from the point of view of SQL.  The strings
++** do not necessarily contain numbers.  They could contain text.
++**
++** If the input strings both look like actual numbers then they
++** compare in numerical order.  Numerical strings are always less 
++** than non-numeric strings so if one input string looks like a
++** number and the other does not, then the one that looks like
++** a number is the smaller.  Non-numeric strings compare in 
++** lexigraphical order (the same order as strcmp()).
++*/
++int sqliteCompare(const char *atext, const char *btext){
++  int result;
++  int isNumA, isNumB;
++  if( atext==0 ){
++    return -1;
++  }else if( btext==0 ){
++    return 1;
++  }
++  isNumA = sqliteIsNumber(atext);
++  isNumB = sqliteIsNumber(btext);
++  if( isNumA ){
++    if( !isNumB ){
++      result = -1;
++    }else{
++      double rA, rB;
++      rA = sqliteAtoF(atext, 0);
++      rB = sqliteAtoF(btext, 0);
++      if( rA<rB ){
++        result = -1;
++      }else if( rA>rB ){
++        result = +1;
++      }else{
++        result = 0;
++      }
++    }
++  }else if( isNumB ){
++    result = +1;
++  }else {
++    result = strcmp(atext, btext);
++  }
++  return result; 
++}
++
++/*
++** This routine is used for sorting.  Each key is a list of one or more
++** null-terminated elements.  The list is terminated by two nulls in
++** a row.  For example, the following text is a key with three elements
++**
++**            Aone\000Dtwo\000Athree\000\000
++**
++** All elements begin with one of the characters "+-AD" and end with "\000"
++** with zero or more text elements in between.  Except, NULL elements
++** consist of the special two-character sequence "N\000".
++**
++** Both arguments will have the same number of elements.  This routine
++** returns negative, zero, or positive if the first argument is less
++** than, equal to, or greater than the first.  (Result is a-b).
++**
++** Each element begins with one of the characters "+", "-", "A", "D".
++** This character determines the sort order and collating sequence:
++**
++**     +      Sort numerically in ascending order
++**     -      Sort numerically in descending order
++**     A      Sort as strings in ascending order
++**     D      Sort as strings in descending order.
++**
++** For the "+" and "-" sorting, pure numeric strings (strings for which the
++** isNum() function above returns TRUE) always compare less than strings
++** that are not pure numerics.  Non-numeric strings compare in memcmp()
++** order.  This is the same sort order as the sqliteCompare() function
++** above generates.
++**
++** The last point is a change from version 2.6.3 to version 2.7.0.  In
++** version 2.6.3 and earlier, substrings of digits compare in numerical 
++** and case was used only to break a tie.
++**
++** Elements that begin with 'A' or 'D' compare in memcmp() order regardless
++** of whether or not they look like a number.
++**
++** Note that the sort order imposed by the rules above is the same
++** from the ordering defined by the "<", "<=", ">", and ">=" operators
++** of expressions and for indices.  This was not the case for version
++** 2.6.3 and earlier.
++*/
++int sqliteSortCompare(const char *a, const char *b){
++  int res = 0;
++  int isNumA, isNumB;
++  int dir = 0;
++
++  while( res==0 && *a && *b ){
++    if( a[0]=='N' || b[0]=='N' ){
++      if( a[0]==b[0] ){
++        a += 2;
++        b += 2;
++        continue;
++      }
++      if( a[0]=='N' ){
++        dir = b[0];
++        res = -1;
++      }else{
++        dir = a[0];
++        res = +1;
++      }
++      break;
++    }
++    assert( a[0]==b[0] );
++    if( (dir=a[0])=='A' || a[0]=='D' ){
++      res = strcmp(&a[1],&b[1]);
++      if( res ) break;
++    }else{
++      isNumA = sqliteIsNumber(&a[1]);
++      isNumB = sqliteIsNumber(&b[1]);
++      if( isNumA ){
++        double rA, rB;
++        if( !isNumB ){
++          res = -1;
++          break;
++        }
++        rA = sqliteAtoF(&a[1], 0);
++        rB = sqliteAtoF(&b[1], 0);
++        if( rA<rB ){
++          res = -1;
++          break;
++        }
++        if( rA>rB ){
++          res = +1;
++          break;
++        }
++      }else if( isNumB ){
++        res = +1;
++        break;
++      }else{
++        res = strcmp(&a[1],&b[1]);
++        if( res ) break;
++      }
++    }
++    a += strlen(&a[1]) + 2;
++    b += strlen(&b[1]) + 2;
++  }
++  if( dir=='-' || dir=='D' ) res = -res;
++  return res;
++}
++
++/*
++** Some powers of 64.  These constants are needed in the
++** sqliteRealToSortable() routine below.
++*/
++#define _64e3  (64.0 * 64.0 * 64.0)
++#define _64e4  (64.0 * 64.0 * 64.0 * 64.0)
++#define _64e15 (_64e3 * _64e4 * _64e4 * _64e4)
++#define _64e16 (_64e4 * _64e4 * _64e4 * _64e4)
++#define _64e63 (_64e15 * _64e16 * _64e16 * _64e16)
++#define _64e64 (_64e16 * _64e16 * _64e16 * _64e16)
++
++/*
++** The following procedure converts a double-precision floating point
++** number into a string.  The resulting string has the property that
++** two such strings comparied using strcmp() or memcmp() will give the
++** same results as a numeric comparison of the original floating point
++** numbers.
++**
++** This routine is used to generate database keys from floating point
++** numbers such that the keys sort in the same order as the original
++** floating point numbers even though the keys are compared using
++** memcmp().
++**
++** The calling function should have allocated at least 14 characters
++** of space for the buffer z[].
++*/
++void sqliteRealToSortable(double r, char *z){
++  int neg;
++  int exp;
++  int cnt = 0;
++
++  /* This array maps integers between 0 and 63 into base-64 digits.
++  ** The digits must be chosen such at their ASCII codes are increasing.
++  ** This means we can not use the traditional base-64 digit set. */
++  static const char zDigit[] = 
++     "0123456789"
++     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
++     "abcdefghijklmnopqrstuvwxyz"
++     "|~";
++  if( r<0.0 ){
++    neg = 1;
++    r = -r;
++    *z++ = '-';
++  } else {
++    neg = 0;
++    *z++ = '0';
++  }
++  exp = 0;
++
++  if( r==0.0 ){
++    exp = -1024;
++  }else if( r<(0.5/64.0) ){
++    while( r < 0.5/_64e64 && exp > -961  ){ r *= _64e64;  exp -= 64; }
++    while( r < 0.5/_64e16 && exp > -1009 ){ r *= _64e16;  exp -= 16; }
++    while( r < 0.5/_64e4  && exp > -1021 ){ r *= _64e4;   exp -= 4; }
++    while( r < 0.5/64.0   && exp > -1024 ){ r *= 64.0;    exp -= 1; }
++  }else if( r>=0.5 ){
++    while( r >= 0.5*_64e63 && exp < 960  ){ r *= 1.0/_64e64; exp += 64; }
++    while( r >= 0.5*_64e15 && exp < 1008 ){ r *= 1.0/_64e16; exp += 16; }
++    while( r >= 0.5*_64e3  && exp < 1020 ){ r *= 1.0/_64e4;  exp += 4; }
++    while( r >= 0.5        && exp < 1023 ){ r *= 1.0/64.0;   exp += 1; }
++  }
++  if( neg ){
++    exp = -exp;
++    r = -r;
++  }
++  exp += 1024;
++  r += 0.5;
++  if( exp<0 ) return;
++  if( exp>=2048 || r>=1.0 ){
++    strcpy(z, "~~~~~~~~~~~~");
++    return;
++  }
++  *z++ = zDigit[(exp>>6)&0x3f];
++  *z++ = zDigit[exp & 0x3f];
++  while( r>0.0 && cnt<10 ){
++    int digit;
++    r *= 64.0;
++    digit = (int)r;
++    assert( digit>=0 && digit<64 );
++    *z++ = zDigit[digit & 0x3f];
++    r -= digit;
++    cnt++;
++  }
++  *z = 0;
++}
++
++#ifdef SQLITE_UTF8
++/*
++** X is a pointer to the first byte of a UTF-8 character.  Increment
++** X so that it points to the next character.  This only works right
++** if X points to a well-formed UTF-8 string.
++*/
++#define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
++#define sqliteCharVal(X)   sqlite_utf8_to_int(X)
++
++#else /* !defined(SQLITE_UTF8) */
++/*
++** For iso8859 encoding, the next character is just the next byte.
++*/
++#define sqliteNextChar(X)  (++(X));
++#define sqliteCharVal(X)   ((int)*(X))
++
++#endif /* defined(SQLITE_UTF8) */
++
++
++#ifdef SQLITE_UTF8
++/*
++** Convert the UTF-8 character to which z points into a 31-bit
++** UCS character.  This only works right if z points to a well-formed
++** UTF-8 string.
++*/
++static int sqlite_utf8_to_int(const unsigned char *z){
++  int c;
++  static const int initVal[] = {
++      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
++     15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
++     30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
++     45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
++     60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
++     75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
++     90,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104,
++    105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
++    120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
++    135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
++    150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
++    165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
++    180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,   0,   1,   2,
++      3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,
++     18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,   0,
++      1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
++      0,   1,   2,   3,   4,   5,   6,   7,   0,   1,   2,   3,   0,   1, 254,
++    255,
++  };
++  c = initVal[*(z++)];
++  while( (0xc0&*z)==0x80 ){
++    c = (c<<6) | (0x3f&*(z++));
++  }
++  return c;
++}
++#endif
++
++/*
++** Compare two UTF-8 strings for equality where the first string can
++** potentially be a "glob" expression.  Return true (1) if they
++** are the same and false (0) if they are different.
++**
++** Globbing rules:
++**
++**      '*'       Matches any sequence of zero or more characters.
++**
++**      '?'       Matches exactly one character.
++**
++**     [...]      Matches one character from the enclosed list of
++**                characters.
++**
++**     [^...]     Matches one character not in the enclosed list.
++**
++** With the [...] and [^...] matching, a ']' character can be included
++** in the list by making it the first character after '[' or '^'.  A
++** range of characters can be specified using '-'.  Example:
++** "[a-z]" matches any single lower-case letter.  To match a '-', make
++** it the last character in the list.
++**
++** This routine is usually quick, but can be N**2 in the worst case.
++**
++** Hints: to match '*' or '?', put them in "[]".  Like this:
++**
++**         abc[*]xyz        Matches "abc*xyz" only
++*/
++int 
++sqliteGlobCompare(const unsigned char *zPattern, const unsigned char *zString){
++  register int c;
++  int invert;
++  int seen;
++  int c2;
++
++  while( (c = *zPattern)!=0 ){
++    switch( c ){
++      case '*':
++        while( (c=zPattern[1]) == '*' || c == '?' ){
++          if( c=='?' ){
++            if( *zString==0 ) return 0;
++            sqliteNextChar(zString);
++          }
++          zPattern++;
++        }
++        if( c==0 ) return 1;
++        if( c=='[' ){
++          while( *zString && sqliteGlobCompare(&zPattern[1],zString)==0 ){
++            sqliteNextChar(zString);
++          }
++          return *zString!=0;
++        }else{
++          while( (c2 = *zString)!=0 ){
++            while( c2 != 0 && c2 != c ){ c2 = *++zString; }
++            if( c2==0 ) return 0;
++            if( sqliteGlobCompare(&zPattern[1],zString) ) return 1;
++            sqliteNextChar(zString);
++          }
++          return 0;
++        }
++      case '?': {
++        if( *zString==0 ) return 0;
++        sqliteNextChar(zString);
++        zPattern++;
++        break;
++      }
++      case '[': {
++        int prior_c = 0;
++        seen = 0;
++        invert = 0;
++        c = sqliteCharVal(zString);
++        if( c==0 ) return 0;
++        c2 = *++zPattern;
++        if( c2=='^' ){ invert = 1; c2 = *++zPattern; }
++        if( c2==']' ){
++          if( c==']' ) seen = 1;
++          c2 = *++zPattern;
++        }
++        while( (c2 = sqliteCharVal(zPattern))!=0 && c2!=']' ){
++          if( c2=='-' && zPattern[1]!=']' && zPattern[1]!=0 && prior_c>0 ){
++            zPattern++;
++            c2 = sqliteCharVal(zPattern);
++            if( c>=prior_c && c<=c2 ) seen = 1;
++            prior_c = 0;
++          }else if( c==c2 ){
++            seen = 1;
++            prior_c = c2;
++          }else{
++            prior_c = c2;
++          }
++          sqliteNextChar(zPattern);
++        }
++        if( c2==0 || (seen ^ invert)==0 ) return 0;
++        sqliteNextChar(zString);
++        zPattern++;
++        break;
++      }
++      default: {
++        if( c != *zString ) return 0;
++        zPattern++;
++        zString++;
++        break;
++      }
++    }
++  }
++  return *zString==0;
++}
++
++/*
++** Compare two UTF-8 strings for equality using the "LIKE" operator of
++** SQL.  The '%' character matches any sequence of 0 or more
++** characters and '_' matches any single character.  Case is
++** not significant.
++**
++** This routine is just an adaptation of the sqliteGlobCompare()
++** routine above.
++*/
++int 
++sqliteLikeCompare(const unsigned char *zPattern, const unsigned char *zString){
++  register int c;
++  int c2;
++
++  while( (c = UpperToLower[*zPattern])!=0 ){
++    switch( c ){
++      case '%': {
++        while( (c=zPattern[1]) == '%' || c == '_' ){
++          if( c=='_' ){
++            if( *zString==0 ) return 0;
++            sqliteNextChar(zString);
++          }
++          zPattern++;
++        }
++        if( c==0 ) return 1;
++        c = UpperToLower[c];
++        while( (c2=UpperToLower[*zString])!=0 ){
++          while( c2 != 0 && c2 != c ){ c2 = UpperToLower[*++zString]; }
++          if( c2==0 ) return 0;
++          if( sqliteLikeCompare(&zPattern[1],zString) ) return 1;
++          sqliteNextChar(zString);
++        }
++        return 0;
++      }
++      case '_': {
++        if( *zString==0 ) return 0;
++        sqliteNextChar(zString);
++        zPattern++;
++        break;
++      }
++      default: {
++        if( c != UpperToLower[*zString] ) return 0;
++        zPattern++;
++        zString++;
++        break;
++      }
++    }
++  }
++  return *zString==0;
++}
++
++/*
++** Change the sqlite.magic from SQLITE_MAGIC_OPEN to SQLITE_MAGIC_BUSY.
++** Return an error (non-zero) if the magic was not SQLITE_MAGIC_OPEN
++** when this routine is called.
++**
++** This routine is a attempt to detect if two threads use the
++** same sqlite* pointer at the same time.  There is a race 
++** condition so it is possible that the error is not detected.
++** But usually the problem will be seen.  The result will be an
++** error which can be used to debug the application that is
++** using SQLite incorrectly.
++**
++** Ticket #202:  If db->magic is not a valid open value, take care not
++** to modify the db structure at all.  It could be that db is a stale
++** pointer.  In other words, it could be that there has been a prior
++** call to sqlite_close(db) and db has been deallocated.  And we do
++** not want to write into deallocated memory.
++*/
++int sqliteSafetyOn(sqlite *db){
++  if( db->magic==SQLITE_MAGIC_OPEN ){
++    db->magic = SQLITE_MAGIC_BUSY;
++    return 0;
++  }else if( db->magic==SQLITE_MAGIC_BUSY || db->magic==SQLITE_MAGIC_ERROR
++             || db->want_to_close ){
++    db->magic = SQLITE_MAGIC_ERROR;
++    db->flags |= SQLITE_Interrupt;
++  }
++  return 1;
++}
++
++/*
++** Change the magic from SQLITE_MAGIC_BUSY to SQLITE_MAGIC_OPEN.
++** Return an error (non-zero) if the magic was not SQLITE_MAGIC_BUSY
++** when this routine is called.
++*/
++int sqliteSafetyOff(sqlite *db){
++  if( db->magic==SQLITE_MAGIC_BUSY ){
++    db->magic = SQLITE_MAGIC_OPEN;
++    return 0;
++  }else if( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ERROR
++             || db->want_to_close ){
++    db->magic = SQLITE_MAGIC_ERROR;
++    db->flags |= SQLITE_Interrupt;
++  }
++  return 1;
++}
++
++/*
++** Check to make sure we are not currently executing an sqlite_exec().
++** If we are currently in an sqlite_exec(), return true and set
++** sqlite.magic to SQLITE_MAGIC_ERROR.  This will cause a complete
++** shutdown of the database.
++**
++** This routine is used to try to detect when API routines are called
++** at the wrong time or in the wrong sequence.
++*/
++int sqliteSafetyCheck(sqlite *db){
++  if( db->pVdbe!=0 ){
++    db->magic = SQLITE_MAGIC_ERROR;
++    return 1;
++  }
++  return 0;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/vacuum.c
+@@ -0,0 +1,305 @@
++/*
++** 2003 April 6
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code used to implement the VACUUM command.
++**
++** Most of the code in this file may be omitted by defining the
++** SQLITE_OMIT_VACUUM macro.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include "os.h"
++
++/*
++** A structure for holding a dynamic string - a string that can grow
++** without bound. 
++*/
++typedef struct dynStr dynStr;
++struct dynStr {
++  char *z;        /* Text of the string in space obtained from sqliteMalloc() */
++  int nAlloc;     /* Amount of space allocated to z[] */
++  int nUsed;      /* Next unused slot in z[] */
++};
++
++/*
++** A structure that holds the vacuum context
++*/
++typedef struct vacuumStruct vacuumStruct;
++struct vacuumStruct {
++  sqlite *dbOld;       /* Original database */
++  sqlite *dbNew;       /* New database */
++  char **pzErrMsg;     /* Write errors here */
++  int rc;              /* Set to non-zero on an error */
++  const char *zTable;  /* Name of a table being copied */
++  const char *zPragma; /* Pragma to execute with results */
++  dynStr s1, s2;       /* Two dynamic strings */
++};
++
++#if !defined(SQLITE_OMIT_VACUUM) || SQLITE_OMIT_VACUUM
++/*
++** Append text to a dynamic string
++*/
++static void appendText(dynStr *p, const char *zText, int nText){
++  if( nText<0 ) nText = strlen(zText);
++  if( p->z==0 || p->nUsed + nText + 1 >= p->nAlloc ){
++    char *zNew;
++    p->nAlloc = p->nUsed + nText + 1000;
++    zNew = sqliteRealloc(p->z, p->nAlloc);
++    if( zNew==0 ){
++      sqliteFree(p->z);
++      memset(p, 0, sizeof(*p));
++      return;
++    }
++    p->z = zNew;
++  }
++  memcpy(&p->z[p->nUsed], zText, nText+1);
++  p->nUsed += nText;
++}
++
++/*
++** Append text to a dynamic string, having first put the text in quotes.
++*/
++static void appendQuoted(dynStr *p, const char *zText){
++  int i, j;
++  appendText(p, "'", 1);
++  for(i=j=0; zText[i]; i++){
++    if( zText[i]=='\'' ){
++      appendText(p, &zText[j], i-j+1);
++      j = i + 1;
++      appendText(p, "'", 1);
++    }
++  }
++  if( j<i ){
++    appendText(p, &zText[j], i-j);
++  }
++  appendText(p, "'", 1);
++}
++
++/*
++** Execute statements of SQL.  If an error occurs, write the error
++** message into *pzErrMsg and return non-zero.
++*/
++static int execsql(char **pzErrMsg, sqlite *db, const char *zSql){ 
++  char *zErrMsg = 0;
++  int rc;
++
++  /* printf("***** executing *****\n%s\n", zSql); */
++  rc = sqlite_exec(db, zSql, 0, 0, &zErrMsg);
++  if( zErrMsg ){
++    sqliteSetString(pzErrMsg, zErrMsg, (char*)0);
++    sqlite_freemem(zErrMsg);
++  }
++  return rc;
++}
++
++/*
++** This is the second stage callback.  Each invocation contains all the
++** data for a single row of a single table in the original database.  This
++** routine must write that information into the new database.
++*/
++static int vacuumCallback2(void *pArg, int argc, char **argv, char **NotUsed){
++  vacuumStruct *p = (vacuumStruct*)pArg;
++  const char *zSep = "(";
++  int i;
++
++  if( argv==0 ) return 0;
++  p->s2.nUsed = 0;
++  appendText(&p->s2, "INSERT INTO ", -1);
++  appendQuoted(&p->s2, p->zTable);
++  appendText(&p->s2, " VALUES", -1);
++  for(i=0; i<argc; i++){
++    appendText(&p->s2, zSep, 1);
++    zSep = ",";
++    if( argv[i]==0 ){
++      appendText(&p->s2, "NULL", 4);
++    }else{
++      appendQuoted(&p->s2, argv[i]);
++    }
++  }
++  appendText(&p->s2,")", 1);
++  p->rc = execsql(p->pzErrMsg, p->dbNew, p->s2.z);
++  return p->rc;
++}
++
++/*
++** This is the first stage callback.  Each invocation contains three
++** arguments where are taken from the SQLITE_MASTER table of the original
++** database:  (1) the entry type, (2) the entry name, and (3) the SQL for
++** the entry.  In all cases, execute the SQL of the third argument.
++** For tables, run a query to select all entries in that table and 
++** transfer them to the second-stage callback.
++*/
++static int vacuumCallback1(void *pArg, int argc, char **argv, char **NotUsed){
++  vacuumStruct *p = (vacuumStruct*)pArg;
++  int rc = 0;
++  assert( argc==3 );
++  if( argv==0 ) return 0;
++  assert( argv[0]!=0 );
++  assert( argv[1]!=0 );
++  assert( argv[2]!=0 );
++  rc = execsql(p->pzErrMsg, p->dbNew, argv[2]);
++  if( rc==SQLITE_OK && strcmp(argv[0],"table")==0 ){
++    char *zErrMsg = 0;
++    p->s1.nUsed = 0;
++    appendText(&p->s1, "SELECT * FROM ", -1);
++    appendQuoted(&p->s1, argv[1]);
++    p->zTable = argv[1];
++    rc = sqlite_exec(p->dbOld, p->s1.z, vacuumCallback2, p, &zErrMsg);
++    if( zErrMsg ){
++      sqliteSetString(p->pzErrMsg, zErrMsg, (char*)0);
++      sqlite_freemem(zErrMsg);
++    }
++  }
++  if( rc!=SQLITE_ABORT ) p->rc = rc;
++  return rc;
++}
++
++/*
++** Generate a random name of 20 character in length.
++*/
++static void randomName(unsigned char *zBuf){
++  static const unsigned char zChars[] =
++    "abcdefghijklmnopqrstuvwxyz"
++    "0123456789";
++  int i;
++  sqliteRandomness(20, zBuf);
++  for(i=0; i<20; i++){
++    zBuf[i] = zChars[ zBuf[i]%(sizeof(zChars)-1) ];
++  }
++}
++#endif
++
++/*
++** The non-standard VACUUM command is used to clean up the database,
++** collapse free space, etc.  It is modelled after the VACUUM command
++** in PostgreSQL.
++**
++** In version 1.0.x of SQLite, the VACUUM command would call
++** gdbm_reorganize() on all the database tables.  But beginning
++** with 2.0.0, SQLite no longer uses GDBM so this command has
++** become a no-op.
++*/
++void sqliteVacuum(Parse *pParse, Token *pTableName){
++  Vdbe *v = sqliteGetVdbe(pParse);
++  sqliteVdbeAddOp(v, OP_Vacuum, 0, 0);
++  return;
++}
++
++/*
++** This routine implements the OP_Vacuum opcode of the VDBE.
++*/
++int sqliteRunVacuum(char **pzErrMsg, sqlite *db){
++#if !defined(SQLITE_OMIT_VACUUM) || SQLITE_OMIT_VACUUM
++  const char *zFilename;  /* full pathname of the database file */
++  int nFilename;          /* number of characters  in zFilename[] */
++  char *zTemp = 0;        /* a temporary file in same directory as zFilename */
++  sqlite *dbNew = 0;      /* The new vacuumed database */
++  int rc = SQLITE_OK;     /* Return code from service routines */
++  int i;                  /* Loop counter */
++  char *zErrMsg;          /* Error message */
++  vacuumStruct sVac;      /* Information passed to callbacks */
++
++  if( db->flags & SQLITE_InTrans ){
++    sqliteSetString(pzErrMsg, "cannot VACUUM from within a transaction", 
++       (char*)0);
++    return SQLITE_ERROR;
++  }
++  if( db->flags & SQLITE_Interrupt ){
++    return SQLITE_INTERRUPT;
++  }
++  memset(&sVac, 0, sizeof(sVac));
++
++  /* Get the full pathname of the database file and create two
++  ** temporary filenames in the same directory as the original file.
++  */
++  zFilename = sqliteBtreeGetFilename(db->aDb[0].pBt);
++  if( zFilename==0 ){
++    /* This only happens with the in-memory database.  VACUUM is a no-op
++    ** there, so just return */
++    return SQLITE_OK;
++  }
++  nFilename = strlen(zFilename);
++  zTemp = sqliteMalloc( nFilename+100 );
++  if( zTemp==0 ) return SQLITE_NOMEM;
++  strcpy(zTemp, zFilename);
++  for(i=0; i<10; i++){
++    zTemp[nFilename] = '-';
++    randomName((unsigned char*)&zTemp[nFilename+1]);
++    if( !sqliteOsFileExists(zTemp) ) break;
++  }
++  if( i>=10 ){
++    sqliteSetString(pzErrMsg, "unable to create a temporary database file "
++       "in the same directory as the original database", (char*)0);
++    goto end_of_vacuum;
++  }
++
++  
++  dbNew = sqlite_open(zTemp, 0, &zErrMsg);
++  if( dbNew==0 ){
++    sqliteSetString(pzErrMsg, "unable to open a temporary database at ",
++       zTemp, " - ", zErrMsg, (char*)0);
++    goto end_of_vacuum;
++  }
++  if( (rc = execsql(pzErrMsg, db, "BEGIN"))!=0 ) goto end_of_vacuum;
++  if( (rc = execsql(pzErrMsg, dbNew, "PRAGMA synchronous=off; BEGIN"))!=0 ){
++    goto end_of_vacuum;
++  }
++  
++  sVac.dbOld = db;
++  sVac.dbNew = dbNew;
++  sVac.pzErrMsg = pzErrMsg;
++  if( rc==SQLITE_OK ){
++    rc = sqlite_exec(db, 
++      "SELECT type, name, sql FROM sqlite_master "
++      "WHERE sql NOT NULL AND type!='view' "
++      "UNION ALL "
++      "SELECT type, name, sql FROM sqlite_master "
++      "WHERE sql NOT NULL AND type=='view'",
++      vacuumCallback1, &sVac, &zErrMsg);
++  }
++  if( rc==SQLITE_OK ){
++    int meta1[SQLITE_N_BTREE_META];
++    int meta2[SQLITE_N_BTREE_META];
++    sqliteBtreeGetMeta(db->aDb[0].pBt, meta1);
++    sqliteBtreeGetMeta(dbNew->aDb[0].pBt, meta2);
++    meta2[1] = meta1[1]+1;
++    meta2[3] = meta1[3];
++    meta2[4] = meta1[4];
++    meta2[6] = meta1[6];
++    rc = sqliteBtreeUpdateMeta(dbNew->aDb[0].pBt, meta2);
++  }
++  if( rc==SQLITE_OK ){
++    rc = sqliteBtreeCopyFile(db->aDb[0].pBt, dbNew->aDb[0].pBt);
++    sqlite_exec(db, "COMMIT", 0, 0, 0);
++    sqliteResetInternalSchema(db, 0);
++  }
++
++end_of_vacuum:
++  if( rc && zErrMsg!=0 ){
++    sqliteSetString(pzErrMsg, "unable to vacuum database - ", 
++       zErrMsg, (char*)0);
++  }
++  sqlite_exec(db, "ROLLBACK", 0, 0, 0);
++  if( (dbNew && (dbNew->flags & SQLITE_Interrupt)) 
++         || (db->flags & SQLITE_Interrupt) ){
++    rc = SQLITE_INTERRUPT;
++  }
++  if( dbNew ) sqlite_close(dbNew);
++  sqliteOsDelete(zTemp);
++  sqliteFree(zTemp);
++  sqliteFree(sVac.s1.z);
++  sqliteFree(sVac.s2.z);
++  if( zErrMsg ) sqlite_freemem(zErrMsg);
++  if( rc==SQLITE_ABORT && sVac.rc!=SQLITE_INTERRUPT ) sVac.rc = SQLITE_ERROR;
++  return sVac.rc;
++#endif
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/vdbeaux.c
+@@ -0,0 +1,1061 @@
++/*
++** 2003 September 6
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This file contains code used for creating, destroying, and populating
++** a VDBE (or an "sqlite_vm" as it is known to the outside world.)  Prior
++** to version 2.8.7, all this code was combined into the vdbe.c source file.
++** But that file was getting too big so this subroutines were split out.
++*/
++#include "sqliteInt.h"
++#include "os.h"
++#include <ctype.h>
++#include "vdbeInt.h"
++
++
++/*
++** When debugging the code generator in a symbolic debugger, one can
++** set the sqlite_vdbe_addop_trace to 1 and all opcodes will be printed
++** as they are added to the instruction stream.
++*/
++#ifndef NDEBUG
++int sqlite_vdbe_addop_trace = 0;
++#endif
++
++
++/*
++** Create a new virtual database engine.
++*/
++Vdbe *sqliteVdbeCreate(sqlite *db){
++  Vdbe *p;
++  p = sqliteMalloc( sizeof(Vdbe) );
++  if( p==0 ) return 0;
++  p->db = db;
++  if( db->pVdbe ){
++    db->pVdbe->pPrev = p;
++  }
++  p->pNext = db->pVdbe;
++  p->pPrev = 0;
++  db->pVdbe = p;
++  p->magic = VDBE_MAGIC_INIT;
++  return p;
++}
++
++/*
++** Turn tracing on or off
++*/
++void sqliteVdbeTrace(Vdbe *p, FILE *trace){
++  p->trace = trace;
++}
++
++/*
++** Add a new instruction to the list of instructions current in the
++** VDBE.  Return the address of the new instruction.
++**
++** Parameters:
++**
++**    p               Pointer to the VDBE
++**
++**    op              The opcode for this instruction
++**
++**    p1, p2          First two of the three possible operands.
++**
++** Use the sqliteVdbeResolveLabel() function to fix an address and
++** the sqliteVdbeChangeP3() function to change the value of the P3
++** operand.
++*/
++int sqliteVdbeAddOp(Vdbe *p, int op, int p1, int p2){
++  int i;
++  VdbeOp *pOp;
++
++  i = p->nOp;
++  p->nOp++;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( i>=p->nOpAlloc ){
++    int oldSize = p->nOpAlloc;
++    Op *aNew;
++    p->nOpAlloc = p->nOpAlloc*2 + 100;
++    aNew = sqliteRealloc(p->aOp, p->nOpAlloc*sizeof(Op));
++    if( aNew==0 ){
++      p->nOpAlloc = oldSize;
++      return 0;
++    }
++    p->aOp = aNew;
++    memset(&p->aOp[oldSize], 0, (p->nOpAlloc-oldSize)*sizeof(Op));
++  }
++  pOp = &p->aOp[i];
++  pOp->opcode = op;
++  pOp->p1 = p1;
++  if( p2<0 && (-1-p2)<p->nLabel && p->aLabel[-1-p2]>=0 ){
++    p2 = p->aLabel[-1-p2];
++  }
++  pOp->p2 = p2;
++  pOp->p3 = 0;
++  pOp->p3type = P3_NOTUSED;
++#ifndef NDEBUG
++  if( sqlite_vdbe_addop_trace ) sqliteVdbePrintOp(0, i, &p->aOp[i]);
++#endif
++  return i;
++}
++
++/*
++** Add an opcode that includes the p3 value.
++*/
++int sqliteVdbeOp3(Vdbe *p, int op, int p1, int p2, const char *zP3, int p3type){
++  int addr = sqliteVdbeAddOp(p, op, p1, p2);
++  sqliteVdbeChangeP3(p, addr, zP3, p3type);
++  return addr;
++}
++
++/*
++** Add multiple opcodes.  The list is terminated by an opcode of 0.
++*/
++int sqliteVdbeCode(Vdbe *p, ...){
++  int addr;
++  va_list ap;
++  int opcode, p1, p2;
++  va_start(ap, p);
++  addr = p->nOp;
++  while( (opcode = va_arg(ap,int))!=0 ){
++    p1 = va_arg(ap,int);
++    p2 = va_arg(ap,int);
++    sqliteVdbeAddOp(p, opcode, p1, p2);
++  }
++  va_end(ap);
++  return addr;
++}
++
++
++
++/*
++** Create a new symbolic label for an instruction that has yet to be
++** coded.  The symbolic label is really just a negative number.  The
++** label can be used as the P2 value of an operation.  Later, when
++** the label is resolved to a specific address, the VDBE will scan
++** through its operation list and change all values of P2 which match
++** the label into the resolved address.
++**
++** The VDBE knows that a P2 value is a label because labels are
++** always negative and P2 values are suppose to be non-negative.
++** Hence, a negative P2 value is a label that has yet to be resolved.
++*/
++int sqliteVdbeMakeLabel(Vdbe *p){
++  int i;
++  i = p->nLabel++;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( i>=p->nLabelAlloc ){
++    int *aNew;
++    p->nLabelAlloc = p->nLabelAlloc*2 + 10;
++    aNew = sqliteRealloc( p->aLabel, p->nLabelAlloc*sizeof(p->aLabel[0]));
++    if( aNew==0 ){
++      sqliteFree(p->aLabel);
++    }
++    p->aLabel = aNew;
++  }
++  if( p->aLabel==0 ){
++    p->nLabel = 0;
++    p->nLabelAlloc = 0;
++    return 0;
++  }
++  p->aLabel[i] = -1;
++  return -1-i;
++}
++
++/*
++** Resolve label "x" to be the address of the next instruction to
++** be inserted.  The parameter "x" must have been obtained from
++** a prior call to sqliteVdbeMakeLabel().
++*/
++void sqliteVdbeResolveLabel(Vdbe *p, int x){
++  int j;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( x<0 && (-x)<=p->nLabel && p->aOp ){
++    if( p->aLabel[-1-x]==p->nOp ) return;
++    assert( p->aLabel[-1-x]<0 );
++    p->aLabel[-1-x] = p->nOp;
++    for(j=0; j<p->nOp; j++){
++      if( p->aOp[j].p2==x ) p->aOp[j].p2 = p->nOp;
++    }
++  }
++}
++
++/*
++** Return the address of the next instruction to be inserted.
++*/
++int sqliteVdbeCurrentAddr(Vdbe *p){
++  assert( p->magic==VDBE_MAGIC_INIT );
++  return p->nOp;
++}
++
++/*
++** Add a whole list of operations to the operation stack.  Return the
++** address of the first operation added.
++*/
++int sqliteVdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
++  int addr;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( p->nOp + nOp >= p->nOpAlloc ){
++    int oldSize = p->nOpAlloc;
++    Op *aNew;
++    p->nOpAlloc = p->nOpAlloc*2 + nOp + 10;
++    aNew = sqliteRealloc(p->aOp, p->nOpAlloc*sizeof(Op));
++    if( aNew==0 ){
++      p->nOpAlloc = oldSize;
++      return 0;
++    }
++    p->aOp = aNew;
++    memset(&p->aOp[oldSize], 0, (p->nOpAlloc-oldSize)*sizeof(Op));
++  }
++  addr = p->nOp;
++  if( nOp>0 ){
++    int i;
++    VdbeOpList const *pIn = aOp;
++    for(i=0; i<nOp; i++, pIn++){
++      int p2 = pIn->p2;
++      VdbeOp *pOut = &p->aOp[i+addr];
++      pOut->opcode = pIn->opcode;
++      pOut->p1 = pIn->p1;
++      pOut->p2 = p2<0 ? addr + ADDR(p2) : p2;
++      pOut->p3 = pIn->p3;
++      pOut->p3type = pIn->p3 ? P3_STATIC : P3_NOTUSED;
++#ifndef NDEBUG
++      if( sqlite_vdbe_addop_trace ){
++        sqliteVdbePrintOp(0, i+addr, &p->aOp[i+addr]);
++      }
++#endif
++    }
++    p->nOp += nOp;
++  }
++  return addr;
++}
++
++/*
++** Change the value of the P1 operand for a specific instruction.
++** This routine is useful when a large program is loaded from a
++** static array using sqliteVdbeAddOpList but we want to make a
++** few minor changes to the program.
++*/
++void sqliteVdbeChangeP1(Vdbe *p, int addr, int val){
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( p && addr>=0 && p->nOp>addr && p->aOp ){
++    p->aOp[addr].p1 = val;
++  }
++}
++
++/*
++** Change the value of the P2 operand for a specific instruction.
++** This routine is useful for setting a jump destination.
++*/
++void sqliteVdbeChangeP2(Vdbe *p, int addr, int val){
++  assert( val>=0 );
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( p && addr>=0 && p->nOp>addr && p->aOp ){
++    p->aOp[addr].p2 = val;
++  }
++}
++
++/*
++** Change the value of the P3 operand for a specific instruction.
++** This routine is useful when a large program is loaded from a
++** static array using sqliteVdbeAddOpList but we want to make a
++** few minor changes to the program.
++**
++** If n>=0 then the P3 operand is dynamic, meaning that a copy of
++** the string is made into memory obtained from sqliteMalloc().
++** A value of n==0 means copy bytes of zP3 up to and including the
++** first null byte.  If n>0 then copy n+1 bytes of zP3.
++**
++** If n==P3_STATIC  it means that zP3 is a pointer to a constant static
++** string and we can just copy the pointer.  n==P3_POINTER means zP3 is
++** a pointer to some object other than a string.
++**
++** If addr<0 then change P3 on the most recently inserted instruction.
++*/
++void sqliteVdbeChangeP3(Vdbe *p, int addr, const char *zP3, int n){
++  Op *pOp;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( p==0 || p->aOp==0 ) return;
++  if( addr<0 || addr>=p->nOp ){
++    addr = p->nOp - 1;
++    if( addr<0 ) return;
++  }
++  pOp = &p->aOp[addr];
++  if( pOp->p3 && pOp->p3type==P3_DYNAMIC ){
++    sqliteFree(pOp->p3);
++    pOp->p3 = 0;
++  }
++  if( zP3==0 ){
++    pOp->p3 = 0;
++    pOp->p3type = P3_NOTUSED;
++  }else if( n<0 ){
++    pOp->p3 = (char*)zP3;
++    pOp->p3type = n;
++  }else{
++    sqliteSetNString(&pOp->p3, zP3, n, 0);
++    pOp->p3type = P3_DYNAMIC;
++  }
++}
++
++/*
++** If the P3 operand to the specified instruction appears
++** to be a quoted string token, then this procedure removes 
++** the quotes.
++**
++** The quoting operator can be either a grave ascent (ASCII 0x27)
++** or a double quote character (ASCII 0x22).  Two quotes in a row
++** resolve to be a single actual quote character within the string.
++*/
++void sqliteVdbeDequoteP3(Vdbe *p, int addr){
++  Op *pOp;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( p->aOp==0 ) return;
++  if( addr<0 || addr>=p->nOp ){
++    addr = p->nOp - 1;
++    if( addr<0 ) return;
++  }
++  pOp = &p->aOp[addr];
++  if( pOp->p3==0 || pOp->p3[0]==0 ) return;
++  if( pOp->p3type==P3_POINTER ) return;
++  if( pOp->p3type!=P3_DYNAMIC ){
++    pOp->p3 = sqliteStrDup(pOp->p3);
++    pOp->p3type = P3_DYNAMIC;
++  }
++  sqliteDequote(pOp->p3);
++}
++
++/*
++** On the P3 argument of the given instruction, change all
++** strings of whitespace characters into a single space and
++** delete leading and trailing whitespace.
++*/
++void sqliteVdbeCompressSpace(Vdbe *p, int addr){
++  unsigned char *z;
++  int i, j;
++  Op *pOp;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  if( p->aOp==0 || addr<0 || addr>=p->nOp ) return;
++  pOp = &p->aOp[addr];
++  if( pOp->p3type==P3_POINTER ){
++    return;
++  }
++  if( pOp->p3type!=P3_DYNAMIC ){
++    pOp->p3 = sqliteStrDup(pOp->p3);
++    pOp->p3type = P3_DYNAMIC;
++  }
++  z = (unsigned char*)pOp->p3;
++  if( z==0 ) return;
++  i = j = 0;
++  while( isspace(z[i]) ){ i++; }
++  while( z[i] ){
++    if( isspace(z[i]) ){
++      z[j++] = ' ';
++      while( isspace(z[++i]) ){}
++    }else{
++      z[j++] = z[i++];
++    }
++  }
++  while( j>0 && isspace(z[j-1]) ){ j--; }
++  z[j] = 0;
++}
++
++/*
++** Search for the current program for the given opcode and P2
++** value.  Return the address plus 1 if found and 0 if not found.
++*/
++int sqliteVdbeFindOp(Vdbe *p, int op, int p2){
++  int i;
++  assert( p->magic==VDBE_MAGIC_INIT );
++  for(i=0; i<p->nOp; i++){
++    if( p->aOp[i].opcode==op && p->aOp[i].p2==p2 ) return i+1;
++  }
++  return 0;
++}
++
++/*
++** Return the opcode for a given address.
++*/
++VdbeOp *sqliteVdbeGetOp(Vdbe *p, int addr){
++  assert( p->magic==VDBE_MAGIC_INIT );
++  assert( addr>=0 && addr<p->nOp );
++  return &p->aOp[addr];
++}
++
++/*
++** The following group or routines are employed by installable functions
++** to return their results.
++**
++** The sqlite_set_result_string() routine can be used to return a string
++** value or to return a NULL.  To return a NULL, pass in NULL for zResult.
++** A copy is made of the string before this routine returns so it is safe
++** to pass in an ephemeral string.
++**
++** sqlite_set_result_error() works like sqlite_set_result_string() except
++** that it signals a fatal error.  The string argument, if any, is the
++** error message.  If the argument is NULL a generic substitute error message
++** is used.
++**
++** The sqlite_set_result_int() and sqlite_set_result_double() set the return
++** value of the user function to an integer or a double.
++**
++** These routines are defined here in vdbe.c because they depend on knowing
++** the internals of the sqlite_func structure which is only defined in 
++** this source file.
++*/
++char *sqlite_set_result_string(sqlite_func *p, const char *zResult, int n){
++  assert( !p->isStep );
++  if( p->s.flags & MEM_Dyn ){
++    sqliteFree(p->s.z);
++  }
++  if( zResult==0 ){
++    p->s.flags = MEM_Null;
++    n = 0;
++    p->s.z = 0;
++    p->s.n = 0;
++  }else{
++    if( n<0 ) n = strlen(zResult);
++    if( n<NBFS-1 ){
++      memcpy(p->s.zShort, zResult, n);
++      p->s.zShort[n] = 0;
++      p->s.flags = MEM_Str | MEM_Short;
++      p->s.z = p->s.zShort;
++    }else{
++      p->s.z = sqliteMallocRaw( n+1 );
++      if( p->s.z ){
++        memcpy(p->s.z, zResult, n);
++        p->s.z[n] = 0;
++      }
++      p->s.flags = MEM_Str | MEM_Dyn;
++    }
++    p->s.n = n+1;
++  }
++  return p->s.z;
++}
++void sqlite_set_result_int(sqlite_func *p, int iResult){
++  assert( !p->isStep );
++  if( p->s.flags & MEM_Dyn ){
++    sqliteFree(p->s.z);
++  }
++  p->s.i = iResult;
++  p->s.flags = MEM_Int;
++}
++void sqlite_set_result_double(sqlite_func *p, double rResult){
++  assert( !p->isStep );
++  if( p->s.flags & MEM_Dyn ){
++    sqliteFree(p->s.z);
++  }
++  p->s.r = rResult;
++  p->s.flags = MEM_Real;
++}
++void sqlite_set_result_error(sqlite_func *p, const char *zMsg, int n){
++  assert( !p->isStep );
++  sqlite_set_result_string(p, zMsg, n);
++  p->isError = 1;
++}
++
++/*
++** Extract the user data from a sqlite_func structure and return a
++** pointer to it.
++*/
++void *sqlite_user_data(sqlite_func *p){
++  assert( p && p->pFunc );
++  return p->pFunc->pUserData;
++}
++
++/*
++** Allocate or return the aggregate context for a user function.  A new
++** context is allocated on the first call.  Subsequent calls return the
++** same context that was returned on prior calls.
++**
++** This routine is defined here in vdbe.c because it depends on knowing
++** the internals of the sqlite_func structure which is only defined in
++** this source file.
++*/
++void *sqlite_aggregate_context(sqlite_func *p, int nByte){
++  assert( p && p->pFunc && p->pFunc->xStep );
++  if( p->pAgg==0 ){
++    if( nByte<=NBFS ){
++      p->pAgg = (void*)p->s.z;
++      memset(p->pAgg, 0, nByte);
++    }else{
++      p->pAgg = sqliteMalloc( nByte );
++    }
++  }
++  return p->pAgg;
++}
++
++/*
++** Return the number of times the Step function of a aggregate has been 
++** called.
++**
++** This routine is defined here in vdbe.c because it depends on knowing
++** the internals of the sqlite_func structure which is only defined in
++** this source file.
++*/
++int sqlite_aggregate_count(sqlite_func *p){
++  assert( p && p->pFunc && p->pFunc->xStep );
++  return p->cnt;
++}
++
++#if !defined(NDEBUG) || defined(VDBE_PROFILE)
++/*
++** Print a single opcode.  This routine is used for debugging only.
++*/
++void sqliteVdbePrintOp(FILE *pOut, int pc, Op *pOp){
++  char *zP3;
++  char zPtr[40];
++  if( pOp->p3type==P3_POINTER ){
++    sprintf(zPtr, "ptr(%#lx)", (long)pOp->p3);
++    zP3 = zPtr;
++  }else{
++    zP3 = pOp->p3;
++  }
++  if( pOut==0 ) pOut = stdout;
++  fprintf(pOut,"%4d %-12s %4d %4d %s\n",
++      pc, sqliteOpcodeNames[pOp->opcode], pOp->p1, pOp->p2, zP3 ? zP3 : "");
++  fflush(pOut);
++}
++#endif
++
++/*
++** Give a listing of the program in the virtual machine.
++**
++** The interface is the same as sqliteVdbeExec().  But instead of
++** running the code, it invokes the callback once for each instruction.
++** This feature is used to implement "EXPLAIN".
++*/
++int sqliteVdbeList(
++  Vdbe *p                   /* The VDBE */
++){
++  sqlite *db = p->db;
++  int i;
++  int rc = SQLITE_OK;
++  static char *azColumnNames[] = {
++     "addr", "opcode", "p1",  "p2",  "p3", 
++     "int",  "text",   "int", "int", "text",
++     0
++  };
++
++  assert( p->popStack==0 );
++  assert( p->explain );
++  p->azColName = azColumnNames;
++  p->azResColumn = p->zArgv;
++  for(i=0; i<5; i++) p->zArgv[i] = p->aStack[i].zShort;
++  i = p->pc;
++  if( i>=p->nOp ){
++    p->rc = SQLITE_OK;
++    rc = SQLITE_DONE;
++  }else if( db->flags & SQLITE_Interrupt ){
++    db->flags &= ~SQLITE_Interrupt;
++    if( db->magic!=SQLITE_MAGIC_BUSY ){
++      p->rc = SQLITE_MISUSE;
++    }else{
++      p->rc = SQLITE_INTERRUPT;
++    }
++    rc = SQLITE_ERROR;
++    sqliteSetString(&p->zErrMsg, sqlite_error_string(p->rc), (char*)0);
++  }else{
++    sprintf(p->zArgv[0],"%d",i);
++    sprintf(p->zArgv[2],"%d", p->aOp[i].p1);
++    sprintf(p->zArgv[3],"%d", p->aOp[i].p2);
++    if( p->aOp[i].p3type==P3_POINTER ){
++      sprintf(p->aStack[4].zShort, "ptr(%#lx)", (long)p->aOp[i].p3);
++      p->zArgv[4] = p->aStack[4].zShort;
++    }else{
++      p->zArgv[4] = p->aOp[i].p3;
++    }
++    p->zArgv[1] = sqliteOpcodeNames[p->aOp[i].opcode];
++    p->pc = i+1;
++    p->azResColumn = p->zArgv;
++    p->nResColumn = 5;
++    p->rc = SQLITE_OK;
++    rc = SQLITE_ROW;
++  }
++  return rc;
++}
++
++/*
++** Prepare a virtual machine for execution.  This involves things such
++** as allocating stack space and initializing the program counter.
++** After the VDBE has be prepped, it can be executed by one or more
++** calls to sqliteVdbeExec().  
++*/
++void sqliteVdbeMakeReady(
++  Vdbe *p,                       /* The VDBE */
++  int nVar,                      /* Number of '?' see in the SQL statement */
++  int isExplain                  /* True if the EXPLAIN keywords is present */
++){
++  int n;
++
++  assert( p!=0 );
++  assert( p->magic==VDBE_MAGIC_INIT );
++
++  /* Add a HALT instruction to the very end of the program.
++  */
++  if( p->nOp==0 || (p->aOp && p->aOp[p->nOp-1].opcode!=OP_Halt) ){
++    sqliteVdbeAddOp(p, OP_Halt, 0, 0);
++  }
++
++  /* No instruction ever pushes more than a single element onto the
++  ** stack.  And the stack never grows on successive executions of the
++  ** same loop.  So the total number of instructions is an upper bound
++  ** on the maximum stack depth required.
++  **
++  ** Allocation all the stack space we will ever need.
++  */
++  if( p->aStack==0 ){
++    p->nVar = nVar;
++    assert( nVar>=0 );
++    n = isExplain ? 10 : p->nOp;
++    p->aStack = sqliteMalloc(
++      n*(sizeof(p->aStack[0]) + 2*sizeof(char*))     /* aStack and zArgv */
++        + p->nVar*(sizeof(char*)+sizeof(int)+1)    /* azVar, anVar, abVar */
++    );
++    p->zArgv = (char**)&p->aStack[n];
++    p->azColName = (char**)&p->zArgv[n];
++    p->azVar = (char**)&p->azColName[n];
++    p->anVar = (int*)&p->azVar[p->nVar];
++    p->abVar = (u8*)&p->anVar[p->nVar];
++  }
++
++  sqliteHashInit(&p->agg.hash, SQLITE_HASH_BINARY, 0);
++  p->agg.pSearch = 0;
++#ifdef MEMORY_DEBUG
++  if( sqliteOsFileExists("vdbe_trace") ){
++    p->trace = stdout;
++  }
++#endif
++  p->pTos = &p->aStack[-1];
++  p->pc = 0;
++  p->rc = SQLITE_OK;
++  p->uniqueCnt = 0;
++  p->returnDepth = 0;
++  p->errorAction = OE_Abort;
++  p->undoTransOnError = 0;
++  p->popStack =  0;
++  p->explain |= isExplain;
++  p->magic = VDBE_MAGIC_RUN;
++#ifdef VDBE_PROFILE
++  {
++    int i;
++    for(i=0; i<p->nOp; i++){
++      p->aOp[i].cnt = 0;
++      p->aOp[i].cycles = 0;
++    }
++  }
++#endif
++}
++
++
++/*
++** Remove any elements that remain on the sorter for the VDBE given.
++*/
++void sqliteVdbeSorterReset(Vdbe *p){
++  while( p->pSort ){
++    Sorter *pSorter = p->pSort;
++    p->pSort = pSorter->pNext;
++    sqliteFree(pSorter->zKey);
++    sqliteFree(pSorter->pData);
++    sqliteFree(pSorter);
++  }
++}
++
++/*
++** Reset an Agg structure.  Delete all its contents. 
++**
++** For installable aggregate functions, if the step function has been
++** called, make sure the finalizer function has also been called.  The
++** finalizer might need to free memory that was allocated as part of its
++** private context.  If the finalizer has not been called yet, call it
++** now.
++*/
++void sqliteVdbeAggReset(Agg *pAgg){
++  int i;
++  HashElem *p;
++  for(p = sqliteHashFirst(&pAgg->hash); p; p = sqliteHashNext(p)){
++    AggElem *pElem = sqliteHashData(p);
++    assert( pAgg->apFunc!=0 );
++    for(i=0; i<pAgg->nMem; i++){
++      Mem *pMem = &pElem->aMem[i];
++      if( pAgg->apFunc[i] && (pMem->flags & MEM_AggCtx)!=0 ){
++        sqlite_func ctx;
++        ctx.pFunc = pAgg->apFunc[i];
++        ctx.s.flags = MEM_Null;
++        ctx.pAgg = pMem->z;
++        ctx.cnt = pMem->i;
++        ctx.isStep = 0;
++        ctx.isError = 0;
++        (*pAgg->apFunc[i]->xFinalize)(&ctx);
++        if( pMem->z!=0 && pMem->z!=pMem->zShort ){
++          sqliteFree(pMem->z);
++        }
++        if( ctx.s.flags & MEM_Dyn ){
++          sqliteFree(ctx.s.z);
++        }
++      }else if( pMem->flags & MEM_Dyn ){
++        sqliteFree(pMem->z);
++      }
++    }
++    sqliteFree(pElem);
++  }
++  sqliteHashClear(&pAgg->hash);
++  sqliteFree(pAgg->apFunc);
++  pAgg->apFunc = 0;
++  pAgg->pCurrent = 0;
++  pAgg->pSearch = 0;
++  pAgg->nMem = 0;
++}
++
++/*
++** Delete a keylist
++*/
++void sqliteVdbeKeylistFree(Keylist *p){
++  while( p ){
++    Keylist *pNext = p->pNext;
++    sqliteFree(p);
++    p = pNext;
++  }
++}
++
++/*
++** Close a cursor and release all the resources that cursor happens
++** to hold.
++*/
++void sqliteVdbeCleanupCursor(Cursor *pCx){
++  if( pCx->pCursor ){
++    sqliteBtreeCloseCursor(pCx->pCursor);
++  }
++  if( pCx->pBt ){
++    sqliteBtreeClose(pCx->pBt);
++  }
++  sqliteFree(pCx->pData);
++  memset(pCx, 0, sizeof(Cursor));
++}
++
++/*
++** Close all cursors
++*/
++static void closeAllCursors(Vdbe *p){
++  int i;
++  for(i=0; i<p->nCursor; i++){
++    sqliteVdbeCleanupCursor(&p->aCsr[i]);
++  }
++  sqliteFree(p->aCsr);
++  p->aCsr = 0;
++  p->nCursor = 0;
++}
++
++/*
++** Clean up the VM after execution.
++**
++** This routine will automatically close any cursors, lists, and/or
++** sorters that were left open.  It also deletes the values of
++** variables in the azVariable[] array.
++*/
++static void Cleanup(Vdbe *p){
++  int i;
++  if( p->aStack ){
++    Mem *pTos = p->pTos;
++    while( pTos>=p->aStack ){
++      if( pTos->flags & MEM_Dyn ){
++        sqliteFree(pTos->z);
++      }
++      pTos--;
++    }
++    p->pTos = pTos;
++  }
++  closeAllCursors(p);
++  if( p->aMem ){
++    for(i=0; i<p->nMem; i++){
++      if( p->aMem[i].flags & MEM_Dyn ){
++        sqliteFree(p->aMem[i].z);
++      }
++    }
++  }
++  sqliteFree(p->aMem);
++  p->aMem = 0;
++  p->nMem = 0;
++  if( p->pList ){
++    sqliteVdbeKeylistFree(p->pList);
++    p->pList = 0;
++  }
++  sqliteVdbeSorterReset(p);
++  if( p->pFile ){
++    if( p->pFile!=stdin ) fclose(p->pFile);
++    p->pFile = 0;
++  }
++  if( p->azField ){
++    sqliteFree(p->azField);
++    p->azField = 0;
++  }
++  p->nField = 0;
++  if( p->zLine ){
++    sqliteFree(p->zLine);
++    p->zLine = 0;
++  }
++  p->nLineAlloc = 0;
++  sqliteVdbeAggReset(&p->agg);
++  if( p->aSet ){
++    for(i=0; i<p->nSet; i++){
++      sqliteHashClear(&p->aSet[i].hash);
++    }
++  }
++  sqliteFree(p->aSet);
++  p->aSet = 0;
++  p->nSet = 0;
++  if( p->keylistStack ){
++    int ii;
++    for(ii = 0; ii < p->keylistStackDepth; ii++){
++      sqliteVdbeKeylistFree(p->keylistStack[ii]);
++    }
++    sqliteFree(p->keylistStack);
++    p->keylistStackDepth = 0;
++    p->keylistStack = 0;
++  }
++  sqliteFree(p->contextStack);
++  p->contextStack = 0;
++  sqliteFree(p->zErrMsg);
++  p->zErrMsg = 0;
++}
++
++/*
++** Clean up a VDBE after execution but do not delete the VDBE just yet.
++** Write any error messages into *pzErrMsg.  Return the result code.
++**
++** After this routine is run, the VDBE should be ready to be executed
++** again.
++*/
++int sqliteVdbeReset(Vdbe *p, char **pzErrMsg){
++  sqlite *db = p->db;
++  int i;
++
++  if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
++    sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), (char*)0);
++    return SQLITE_MISUSE;
++  }
++  if( p->zErrMsg ){
++    if( pzErrMsg && *pzErrMsg==0 ){
++      *pzErrMsg = p->zErrMsg;
++    }else{
++      sqliteFree(p->zErrMsg);
++    }
++    p->zErrMsg = 0;
++  }else if( p->rc ){
++    sqliteSetString(pzErrMsg, sqlite_error_string(p->rc), (char*)0);
++  }
++  Cleanup(p);
++  if( p->rc!=SQLITE_OK ){
++    switch( p->errorAction ){
++      case OE_Abort: {
++        if( !p->undoTransOnError ){
++          for(i=0; i<db->nDb; i++){
++            if( db->aDb[i].pBt ){
++              sqliteBtreeRollbackCkpt(db->aDb[i].pBt);
++            }
++          }
++          break;
++        }
++        /* Fall through to ROLLBACK */
++      }
++      case OE_Rollback: {
++        sqliteRollbackAll(db);
++        db->flags &= ~SQLITE_InTrans;
++        db->onError = OE_Default;
++        break;
++      }
++      default: {
++        if( p->undoTransOnError ){
++          sqliteRollbackAll(db);
++          db->flags &= ~SQLITE_InTrans;
++          db->onError = OE_Default;
++        }
++        break;
++      }
++    }
++    sqliteRollbackInternalChanges(db);
++  }
++  for(i=0; i<db->nDb; i++){
++    if( db->aDb[i].pBt && db->aDb[i].inTrans==2 ){
++      sqliteBtreeCommitCkpt(db->aDb[i].pBt);
++      db->aDb[i].inTrans = 1;
++    }
++  }
++  assert( p->pTos<&p->aStack[p->pc] || sqlite_malloc_failed==1 );
++#ifdef VDBE_PROFILE
++  {
++    FILE *out = fopen("vdbe_profile.out", "a");
++    if( out ){
++      int i;
++      fprintf(out, "---- ");
++      for(i=0; i<p->nOp; i++){
++        fprintf(out, "%02x", p->aOp[i].opcode);
++      }
++      fprintf(out, "\n");
++      for(i=0; i<p->nOp; i++){
++        fprintf(out, "%6d %10lld %8lld ",
++           p->aOp[i].cnt,
++           p->aOp[i].cycles,
++           p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0
++        );
++        sqliteVdbePrintOp(out, i, &p->aOp[i]);
++      }
++      fclose(out);
++    }
++  }
++#endif
++  p->magic = VDBE_MAGIC_INIT;
++  return p->rc;
++}
++
++/*
++** Clean up and delete a VDBE after execution.  Return an integer which is
++** the result code.  Write any error message text into *pzErrMsg.
++*/
++int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){
++  int rc;
++  sqlite *db;
++
++  if( p->magic!=VDBE_MAGIC_RUN && p->magic!=VDBE_MAGIC_HALT ){
++    sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), (char*)0);
++    return SQLITE_MISUSE;
++  }
++  db = p->db;
++  rc = sqliteVdbeReset(p, pzErrMsg);
++  sqliteVdbeDelete(p);
++  if( db->want_to_close && db->pVdbe==0 ){
++    sqlite_close(db);
++  }
++  if( rc==SQLITE_SCHEMA ){
++    sqliteResetInternalSchema(db, 0);
++  }
++  return rc;
++}
++
++/*
++** Set the values of all variables.  Variable $1 in the original SQL will
++** be the string azValue[0].  $2 will have the value azValue[1].  And
++** so forth.  If a value is out of range (for example $3 when nValue==2)
++** then its value will be NULL.
++**
++** This routine overrides any prior call.
++*/
++int sqlite_bind(sqlite_vm *pVm, int i, const char *zVal, int len, int copy){
++  Vdbe *p = (Vdbe*)pVm;
++  if( p->magic!=VDBE_MAGIC_RUN || p->pc!=0 ){
++    return SQLITE_MISUSE;
++  }
++  if( i<1 || i>p->nVar ){
++    return SQLITE_RANGE;
++  }
++  i--;
++  if( p->abVar[i] ){
++    sqliteFree(p->azVar[i]);
++  }
++  if( zVal==0 ){
++    copy = 0;
++    len = 0;
++  }
++  if( len<0 ){
++    len = strlen(zVal)+1;
++  }
++  if( copy ){
++    p->azVar[i] = sqliteMalloc( len );
++    if( p->azVar[i] ) memcpy(p->azVar[i], zVal, len);
++  }else{
++    p->azVar[i] = (char*)zVal;
++  }
++  p->abVar[i] = copy;
++  p->anVar[i] = len;
++  return SQLITE_OK;
++}
++
++
++/*
++** Delete an entire VDBE.
++*/
++void sqliteVdbeDelete(Vdbe *p){
++  int i;
++  if( p==0 ) return;
++  Cleanup(p);
++  if( p->pPrev ){
++    p->pPrev->pNext = p->pNext;
++  }else{
++    assert( p->db->pVdbe==p );
++    p->db->pVdbe = p->pNext;
++  }
++  if( p->pNext ){
++    p->pNext->pPrev = p->pPrev;
++  }
++  p->pPrev = p->pNext = 0;
++  if( p->nOpAlloc==0 ){
++    p->aOp = 0;
++    p->nOp = 0;
++  }
++  for(i=0; i<p->nOp; i++){
++    if( p->aOp[i].p3type==P3_DYNAMIC ){
++      sqliteFree(p->aOp[i].p3);
++    }
++  }
++  for(i=0; i<p->nVar; i++){
++    if( p->abVar[i] ) sqliteFree(p->azVar[i]);
++  }
++  sqliteFree(p->aOp);
++  sqliteFree(p->aLabel);
++  sqliteFree(p->aStack);
++  p->magic = VDBE_MAGIC_DEAD;
++  sqliteFree(p);
++}
++
++/*
++** Convert an integer in between the native integer format and
++** the bigEndian format used as the record number for tables.
++**
++** The bigEndian format (most significant byte first) is used for
++** record numbers so that records will sort into the correct order
++** even though memcmp() is used to compare the keys.  On machines
++** whose native integer format is little endian (ex: i486) the
++** order of bytes is reversed.  On native big-endian machines
++** (ex: Alpha, Sparc, Motorola) the byte order is the same.
++**
++** This function is its own inverse.  In other words
++**
++**         X == byteSwap(byteSwap(X))
++*/
++int sqliteVdbeByteSwap(int x){
++  union {
++     char zBuf[sizeof(int)];
++     int i;
++  } ux;
++  ux.zBuf[3] = x&0xff;
++  ux.zBuf[2] = (x>>8)&0xff;
++  ux.zBuf[1] = (x>>16)&0xff;
++  ux.zBuf[0] = (x>>24)&0xff;
++  return ux.i;
++}
++
++/*
++** If a MoveTo operation is pending on the given cursor, then do that
++** MoveTo now.  Return an error code.  If no MoveTo is pending, this
++** routine does nothing and returns SQLITE_OK.
++*/
++int sqliteVdbeCursorMoveto(Cursor *p){
++  if( p->deferredMoveto ){
++    int res;
++    extern int sqlite_search_count;
++    sqliteBtreeMoveto(p->pCursor, (char*)&p->movetoTarget, sizeof(int), &res);
++    p->lastRecno = keyToInt(p->movetoTarget);
++    p->recnoIsValid = res==0;
++    if( res<0 ){
++      sqliteBtreeNext(p->pCursor, &res);
++    }
++    sqlite_search_count++;
++    p->deferredMoveto = 0;
++  }
++  return SQLITE_OK;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/vdbe.c
+@@ -0,0 +1,4921 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** The code in this file implements execution method of the 
++** Virtual Database Engine (VDBE).  A separate file ("vdbeaux.c")
++** handles housekeeping details such as creating and deleting
++** VDBE instances.  This file is solely interested in executing
++** the VDBE program.
++**
++** In the external interface, an "sqlite_vm*" is an opaque pointer
++** to a VDBE.
++**
++** The SQL parser generates a program which is then executed by
++** the VDBE to do the work of the SQL statement.  VDBE programs are 
++** similar in form to assembly language.  The program consists of
++** a linear sequence of operations.  Each operation has an opcode 
++** and 3 operands.  Operands P1 and P2 are integers.  Operand P3 
++** is a null-terminated string.   The P2 operand must be non-negative.
++** Opcodes will typically ignore one or more operands.  Many opcodes
++** ignore all three operands.
++**
++** Computation results are stored on a stack.  Each entry on the
++** stack is either an integer, a null-terminated string, a floating point
++** number, or the SQL "NULL" value.  An inplicit conversion from one
++** type to the other occurs as necessary.
++** 
++** Most of the code in this file is taken up by the sqliteVdbeExec()
++** function which does the work of interpreting a VDBE program.
++** But other routines are also provided to help in building up
++** a program instruction by instruction.
++**
++** Various scripts scan this source file in order to generate HTML
++** documentation, headers files, or other derived files.  The formatting
++** of the code in this file is, therefore, important.  See other comments
++** in this file for details.  If in doubt, do not deviate from existing
++** commenting and indentation practices when changing or adding code.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++#include "os.h"
++#include <ctype.h>
++#include "vdbeInt.h"
++
++/*
++** The following global variable is incremented every time a cursor
++** moves, either by the OP_MoveTo or the OP_Next opcode.  The test
++** procedures use this information to make sure that indices are
++** working correctly.  This variable has no function other than to
++** help verify the correct operation of the library.
++*/
++int sqlite_search_count = 0;
++
++/*
++** When this global variable is positive, it gets decremented once before
++** each instruction in the VDBE.  When reaches zero, the SQLITE_Interrupt
++** of the db.flags field is set in order to simulate an interrupt.
++**
++** This facility is used for testing purposes only.  It does not function
++** in an ordinary build.
++*/
++int sqlite_interrupt_count = 0;
++
++/*
++** Advance the virtual machine to the next output row.
++**
++** The return vale will be either SQLITE_BUSY, SQLITE_DONE, 
++** SQLITE_ROW, SQLITE_ERROR, or SQLITE_MISUSE.
++**
++** SQLITE_BUSY means that the virtual machine attempted to open
++** a locked database and there is no busy callback registered.
++** Call sqlite_step() again to retry the open.  *pN is set to 0
++** and *pazColName and *pazValue are both set to NULL.
++**
++** SQLITE_DONE means that the virtual machine has finished
++** executing.  sqlite_step() should not be called again on this
++** virtual machine.  *pN and *pazColName are set appropriately
++** but *pazValue is set to NULL.
++**
++** SQLITE_ROW means that the virtual machine has generated another
++** row of the result set.  *pN is set to the number of columns in
++** the row.  *pazColName is set to the names of the columns followed
++** by the column datatypes.  *pazValue is set to the values of each
++** column in the row.  The value of the i-th column is (*pazValue)[i].
++** The name of the i-th column is (*pazColName)[i] and the datatype
++** of the i-th column is (*pazColName)[i+*pN].
++**
++** SQLITE_ERROR means that a run-time error (such as a constraint
++** violation) has occurred.  The details of the error will be returned
++** by the next call to sqlite_finalize().  sqlite_step() should not
++** be called again on the VM.
++**
++** SQLITE_MISUSE means that the this routine was called inappropriately.
++** Perhaps it was called on a virtual machine that had already been
++** finalized or on one that had previously returned SQLITE_ERROR or
++** SQLITE_DONE.  Or it could be the case the the same database connection
++** is being used simulataneously by two or more threads.
++*/
++int sqlite_step(
++  sqlite_vm *pVm,              /* The virtual machine to execute */
++  int *pN,                     /* OUT: Number of columns in result */
++  const char ***pazValue,      /* OUT: Column data */
++  const char ***pazColName     /* OUT: Column names and datatypes */
++){
++  Vdbe *p = (Vdbe*)pVm;
++  sqlite *db;
++  int rc;
++
++  if( !p || p->magic!=VDBE_MAGIC_RUN ){
++    return SQLITE_MISUSE;
++  }
++  db = p->db;
++  if( sqliteSafetyOn(db) ){
++    p->rc = SQLITE_MISUSE;
++    return SQLITE_MISUSE;
++  }
++  if( p->explain ){
++    rc = sqliteVdbeList(p);
++  }else{
++    rc = sqliteVdbeExec(p);
++  }
++  if( rc==SQLITE_DONE || rc==SQLITE_ROW ){
++    if( pazColName ) *pazColName = (const char**)p->azColName;
++    if( pN ) *pN = p->nResColumn;
++  }else{
++    if( pazColName) *pazColName = 0;
++    if( pN ) *pN = 0;
++  }
++  if( pazValue ){
++    if( rc==SQLITE_ROW ){
++      *pazValue = (const char**)p->azResColumn;
++    }else{
++      *pazValue = 0;
++    }
++  }
++  if( sqliteSafetyOff(db) ){
++    return SQLITE_MISUSE;
++  }
++  return rc;
++}
++
++/*
++** Insert a new aggregate element and make it the element that
++** has focus.
++**
++** Return 0 on success and 1 if memory is exhausted.
++*/
++static int AggInsert(Agg *p, char *zKey, int nKey){
++  AggElem *pElem, *pOld;
++  int i;
++  Mem *pMem;
++  pElem = sqliteMalloc( sizeof(AggElem) + nKey +
++                        (p->nMem-1)*sizeof(pElem->aMem[0]) );
++  if( pElem==0 ) return 1;
++  pElem->zKey = (char*)&pElem->aMem[p->nMem];
++  memcpy(pElem->zKey, zKey, nKey);
++  pElem->nKey = nKey;
++  pOld = sqliteHashInsert(&p->hash, pElem->zKey, pElem->nKey, pElem);
++  if( pOld!=0 ){
++    assert( pOld==pElem );  /* Malloc failed on insert */
++    sqliteFree(pOld);
++    return 0;
++  }
++  for(i=0, pMem=pElem->aMem; i<p->nMem; i++, pMem++){
++    pMem->flags = MEM_Null;
++  }
++  p->pCurrent = pElem;
++  return 0;
++}
++
++/*
++** Get the AggElem currently in focus
++*/
++#define AggInFocus(P)   ((P).pCurrent ? (P).pCurrent : _AggInFocus(&(P)))
++static AggElem *_AggInFocus(Agg *p){
++  HashElem *pElem = sqliteHashFirst(&p->hash);
++  if( pElem==0 ){
++    AggInsert(p,"",1);
++    pElem = sqliteHashFirst(&p->hash);
++  }
++  return pElem ? sqliteHashData(pElem) : 0;
++}
++
++/*
++** Convert the given stack entity into a string if it isn't one
++** already.
++*/
++#define Stringify(P) if(((P)->flags & MEM_Str)==0){hardStringify(P);}
++static int hardStringify(Mem *pStack){
++  int fg = pStack->flags;
++  if( fg & MEM_Real ){
++    sqlite_snprintf(sizeof(pStack->zShort),pStack->zShort,"%.15g",pStack->r);
++  }else if( fg & MEM_Int ){
++    sqlite_snprintf(sizeof(pStack->zShort),pStack->zShort,"%d",pStack->i);
++  }else{
++    pStack->zShort[0] = 0;
++  }
++  pStack->z = pStack->zShort;
++  pStack->n = strlen(pStack->zShort)+1;
++  pStack->flags = MEM_Str | MEM_Short;
++  return 0;
++}
++
++/*
++** Convert the given stack entity into a string that has been obtained
++** from sqliteMalloc().  This is different from Stringify() above in that
++** Stringify() will use the NBFS bytes of static string space if the string
++** will fit but this routine always mallocs for space.
++** Return non-zero if we run out of memory.
++*/
++#define Dynamicify(P) (((P)->flags & MEM_Dyn)==0 ? hardDynamicify(P):0)
++static int hardDynamicify(Mem *pStack){
++  int fg = pStack->flags;
++  char *z;
++  if( (fg & MEM_Str)==0 ){
++    hardStringify(pStack);
++  }
++  assert( (fg & MEM_Dyn)==0 );
++  z = sqliteMallocRaw( pStack->n );
++  if( z==0 ) return 1;
++  memcpy(z, pStack->z, pStack->n);
++  pStack->z = z;
++  pStack->flags |= MEM_Dyn;
++  return 0;
++}
++
++/*
++** An ephemeral string value (signified by the MEM_Ephem flag) contains
++** a pointer to a dynamically allocated string where some other entity
++** is responsible for deallocating that string.  Because the stack entry
++** does not control the string, it might be deleted without the stack
++** entry knowing it.
++**
++** This routine converts an ephemeral string into a dynamically allocated
++** string that the stack entry itself controls.  In other words, it
++** converts an MEM_Ephem string into an MEM_Dyn string.
++*/
++#define Deephemeralize(P) \
++   if( ((P)->flags&MEM_Ephem)!=0 && hardDeephem(P) ){ goto no_mem;}
++static int hardDeephem(Mem *pStack){
++  char *z;
++  assert( (pStack->flags & MEM_Ephem)!=0 );
++  z = sqliteMallocRaw( pStack->n );
++  if( z==0 ) return 1;
++  memcpy(z, pStack->z, pStack->n);
++  pStack->z = z;
++  pStack->flags &= ~MEM_Ephem;
++  pStack->flags |= MEM_Dyn;
++  return 0;
++}
++
++/*
++** Release the memory associated with the given stack level.  This
++** leaves the Mem.flags field in an inconsistent state.
++*/
++#define Release(P) if((P)->flags&MEM_Dyn){ sqliteFree((P)->z); }
++
++/*
++** Pop the stack N times.
++*/
++static void popStack(Mem **ppTos, int N){
++  Mem *pTos = *ppTos;
++  while( N>0 ){
++    N--;
++    Release(pTos);
++    pTos--;
++  }
++  *ppTos = pTos;
++}
++
++/*
++** Return TRUE if zNum is a 32-bit signed integer and write
++** the value of the integer into *pNum.  If zNum is not an integer
++** or is an integer that is too large to be expressed with just 32
++** bits, then return false.
++**
++** Under Linux (RedHat 7.2) this routine is much faster than atoi()
++** for converting strings into integers.
++*/
++static int toInt(const char *zNum, int *pNum){
++  int v = 0;
++  int neg;
++  int i, c;
++  if( *zNum=='-' ){
++    neg = 1;
++    zNum++;
++  }else if( *zNum=='+' ){
++    neg = 0;
++    zNum++;
++  }else{
++    neg = 0;
++  }
++  for(i=0; (c=zNum[i])>='0' && c<='9'; i++){
++    v = v*10 + c - '0';
++  }
++  *pNum = neg ? -v : v;
++  return c==0 && i>0 && (i<10 || (i==10 && memcmp(zNum,"2147483647",10)<=0));
++}
++
++/*
++** Convert the given stack entity into a integer if it isn't one
++** already.
++**
++** Any prior string or real representation is invalidated.  
++** NULLs are converted into 0.
++*/
++#define Integerify(P) if(((P)->flags&MEM_Int)==0){ hardIntegerify(P); }
++static void hardIntegerify(Mem *pStack){
++  if( pStack->flags & MEM_Real ){
++    pStack->i = (int)pStack->r;
++    Release(pStack);
++  }else if( pStack->flags & MEM_Str ){
++    toInt(pStack->z, &pStack->i);
++    Release(pStack);
++  }else{
++    pStack->i = 0;
++  }
++  pStack->flags = MEM_Int;
++}
++
++/*
++** Get a valid Real representation for the given stack element.
++**
++** Any prior string or integer representation is retained.
++** NULLs are converted into 0.0.
++*/
++#define Realify(P) if(((P)->flags&MEM_Real)==0){ hardRealify(P); }
++static void hardRealify(Mem *pStack){
++  if( pStack->flags & MEM_Str ){
++    pStack->r = sqliteAtoF(pStack->z, 0);
++  }else if( pStack->flags & MEM_Int ){
++    pStack->r = pStack->i;
++  }else{
++    pStack->r = 0.0;
++  }
++  pStack->flags |= MEM_Real;
++}
++
++/*
++** The parameters are pointers to the head of two sorted lists
++** of Sorter structures.  Merge these two lists together and return
++** a single sorted list.  This routine forms the core of the merge-sort
++** algorithm.
++**
++** In the case of a tie, left sorts in front of right.
++*/
++static Sorter *Merge(Sorter *pLeft, Sorter *pRight){
++  Sorter sHead;
++  Sorter *pTail;
++  pTail = &sHead;
++  pTail->pNext = 0;
++  while( pLeft && pRight ){
++    int c = sqliteSortCompare(pLeft->zKey, pRight->zKey);
++    if( c<=0 ){
++      pTail->pNext = pLeft;
++      pLeft = pLeft->pNext;
++    }else{
++      pTail->pNext = pRight;
++      pRight = pRight->pNext;
++    }
++    pTail = pTail->pNext;
++  }
++  if( pLeft ){
++    pTail->pNext = pLeft;
++  }else if( pRight ){
++    pTail->pNext = pRight;
++  }
++  return sHead.pNext;
++}
++
++/*
++** The following routine works like a replacement for the standard
++** library routine fgets().  The difference is in how end-of-line (EOL)
++** is handled.  Standard fgets() uses LF for EOL under unix, CRLF
++** under windows, and CR under mac.  This routine accepts any of these
++** character sequences as an EOL mark.  The EOL mark is replaced by
++** a single LF character in zBuf.
++*/
++static char *vdbe_fgets(char *zBuf, int nBuf, FILE *in){
++  int i, c;
++  for(i=0; i<nBuf-1 && (c=getc(in))!=EOF; i++){
++    zBuf[i] = c;
++    if( c=='\r' || c=='\n' ){
++      if( c=='\r' ){
++        zBuf[i] = '\n';
++        c = getc(in);
++        if( c!=EOF && c!='\n' ) ungetc(c, in);
++      }
++      i++;
++      break;
++    }
++  }
++  zBuf[i]  = 0;
++  return i>0 ? zBuf : 0;
++}
++
++/*
++** Make sure there is space in the Vdbe structure to hold at least
++** mxCursor cursors.  If there is not currently enough space, then
++** allocate more.
++**
++** If a memory allocation error occurs, return 1.  Return 0 if
++** everything works.
++*/
++static int expandCursorArraySize(Vdbe *p, int mxCursor){
++  if( mxCursor>=p->nCursor ){
++    Cursor *aCsr = sqliteRealloc( p->aCsr, (mxCursor+1)*sizeof(Cursor) );
++    if( aCsr==0 ) return 1;
++    p->aCsr = aCsr;
++    memset(&p->aCsr[p->nCursor], 0, sizeof(Cursor)*(mxCursor+1-p->nCursor));
++    p->nCursor = mxCursor+1;
++  }
++  return 0;
++}
++
++#ifdef VDBE_PROFILE
++/*
++** The following routine only works on pentium-class processors.
++** It uses the RDTSC opcode to read cycle count value out of the
++** processor and returns that value.  This can be used for high-res
++** profiling.
++*/
++__inline__ unsigned long long int hwtime(void){
++  unsigned long long int x;
++  __asm__("rdtsc\n\t"
++          "mov %%edx, %%ecx\n\t"
++          :"=A" (x));
++  return x;
++}
++#endif
++
++/*
++** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
++** sqlite_interrupt() routine has been called.  If it has been, then
++** processing of the VDBE program is interrupted.
++**
++** This macro added to every instruction that does a jump in order to
++** implement a loop.  This test used to be on every single instruction,
++** but that meant we more testing that we needed.  By only testing the
++** flag on jump instructions, we get a (small) speed improvement.
++*/
++#define CHECK_FOR_INTERRUPT \
++   if( db->flags & SQLITE_Interrupt ) goto abort_due_to_interrupt;
++
++
++/*
++** Execute as much of a VDBE program as we can then return.
++**
++** sqliteVdbeMakeReady() must be called before this routine in order to
++** close the program with a final OP_Halt and to set up the callbacks
++** and the error message pointer.
++**
++** Whenever a row or result data is available, this routine will either
++** invoke the result callback (if there is one) or return with
++** SQLITE_ROW.
++**
++** If an attempt is made to open a locked database, then this routine
++** will either invoke the busy callback (if there is one) or it will
++** return SQLITE_BUSY.
++**
++** If an error occurs, an error message is written to memory obtained
++** from sqliteMalloc() and p->zErrMsg is made to point to that memory.
++** The error code is stored in p->rc and this routine returns SQLITE_ERROR.
++**
++** If the callback ever returns non-zero, then the program exits
++** immediately.  There will be no error message but the p->rc field is
++** set to SQLITE_ABORT and this routine will return SQLITE_ERROR.
++**
++** A memory allocation error causes p->rc to be set to SQLITE_NOMEM and this
++** routine to return SQLITE_ERROR.
++**
++** Other fatal errors return SQLITE_ERROR.
++**
++** After this routine has finished, sqliteVdbeFinalize() should be
++** used to clean up the mess that was left behind.
++*/
++int sqliteVdbeExec(
++  Vdbe *p                    /* The VDBE */
++){
++  int pc;                    /* The program counter */
++  Op *pOp;                   /* Current operation */
++  int rc = SQLITE_OK;        /* Value to return */
++  sqlite *db = p->db;        /* The database */
++  Mem *pTos;                 /* Top entry in the operand stack */
++  char zBuf[100];            /* Space to sprintf() an integer */
++#ifdef VDBE_PROFILE
++  unsigned long long start;  /* CPU clock count at start of opcode */
++  int origPc;                /* Program counter at start of opcode */
++#endif
++#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
++  int nProgressOps = 0;      /* Opcodes executed since progress callback. */
++#endif
++
++  if( p->magic!=VDBE_MAGIC_RUN ) return SQLITE_MISUSE;
++  assert( db->magic==SQLITE_MAGIC_BUSY );
++  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );
++  p->rc = SQLITE_OK;
++  assert( p->explain==0 );
++  if( sqlite_malloc_failed ) goto no_mem;
++  pTos = p->pTos;
++  if( p->popStack ){
++    popStack(&pTos, p->popStack);
++    p->popStack = 0;
++  }
++  CHECK_FOR_INTERRUPT;
++  for(pc=p->pc; rc==SQLITE_OK; pc++){
++    assert( pc>=0 && pc<p->nOp );
++    assert( pTos<=&p->aStack[pc] );
++#ifdef VDBE_PROFILE
++    origPc = pc;
++    start = hwtime();
++#endif
++    pOp = &p->aOp[pc];
++
++    /* Only allow tracing if NDEBUG is not defined.
++    */
++#ifndef NDEBUG
++    if( p->trace ){
++      sqliteVdbePrintOp(p->trace, pc, pOp);
++    }
++#endif
++
++    /* Check to see if we need to simulate an interrupt.  This only happens
++    ** if we have a special test build.
++    */
++#ifdef SQLITE_TEST
++    if( sqlite_interrupt_count>0 ){
++      sqlite_interrupt_count--;
++      if( sqlite_interrupt_count==0 ){
++        sqlite_interrupt(db);
++      }
++    }
++#endif
++
++#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
++    /* Call the progress callback if it is configured and the required number
++    ** of VDBE ops have been executed (either since this invocation of
++    ** sqliteVdbeExec() or since last time the progress callback was called).
++    ** If the progress callback returns non-zero, exit the virtual machine with
++    ** a return code SQLITE_ABORT.
++    */
++    if( db->xProgress ){
++      if( db->nProgressOps==nProgressOps ){
++        if( db->xProgress(db->pProgressArg)!=0 ){
++          rc = SQLITE_ABORT;
++          continue; /* skip to the next iteration of the for loop */
++        }
++        nProgressOps = 0;
++      }
++      nProgressOps++;
++    }
++#endif
++
++    switch( pOp->opcode ){
++
++/*****************************************************************************
++** What follows is a massive switch statement where each case implements a
++** separate instruction in the virtual machine.  If we follow the usual
++** indentation conventions, each case should be indented by 6 spaces.  But
++** that is a lot of wasted space on the left margin.  So the code within
++** the switch statement will break with convention and be flush-left. Another
++** big comment (similar to this one) will mark the point in the code where
++** we transition back to normal indentation.
++**
++** The formatting of each case is important.  The makefile for SQLite
++** generates two C files "opcodes.h" and "opcodes.c" by scanning this
++** file looking for lines that begin with "case OP_".  The opcodes.h files
++** will be filled with #defines that give unique integer values to each
++** opcode and the opcodes.c file is filled with an array of strings where
++** each string is the symbolic name for the corresponding opcode.
++**
++** Documentation about VDBE opcodes is generated by scanning this file
++** for lines of that contain "Opcode:".  That line and all subsequent
++** comment lines are used in the generation of the opcode.html documentation
++** file.
++**
++** SUMMARY:
++**
++**     Formatting is important to scripts that scan this file.
++**     Do not deviate from the formatting style currently in use.
++**
++*****************************************************************************/
++
++/* Opcode:  Goto * P2 *
++**
++** An unconditional jump to address P2.
++** The next instruction executed will be 
++** the one at index P2 from the beginning of
++** the program.
++*/
++case OP_Goto: {
++  CHECK_FOR_INTERRUPT;
++  pc = pOp->p2 - 1;
++  break;
++}
++
++/* Opcode:  Gosub * P2 *
++**
++** Push the current address plus 1 onto the return address stack
++** and then jump to address P2.
++**
++** The return address stack is of limited depth.  If too many
++** OP_Gosub operations occur without intervening OP_Returns, then
++** the return address stack will fill up and processing will abort
++** with a fatal error.
++*/
++case OP_Gosub: {
++  if( p->returnDepth>=sizeof(p->returnStack)/sizeof(p->returnStack[0]) ){
++    sqliteSetString(&p->zErrMsg, "return address stack overflow", (char*)0);
++    p->rc = SQLITE_INTERNAL;
++    return SQLITE_ERROR;
++  }
++  p->returnStack[p->returnDepth++] = pc+1;
++  pc = pOp->p2 - 1;
++  break;
++}
++
++/* Opcode:  Return * * *
++**
++** Jump immediately to the next instruction after the last unreturned
++** OP_Gosub.  If an OP_Return has occurred for all OP_Gosubs, then
++** processing aborts with a fatal error.
++*/
++case OP_Return: {
++  if( p->returnDepth<=0 ){
++    sqliteSetString(&p->zErrMsg, "return address stack underflow", (char*)0);
++    p->rc = SQLITE_INTERNAL;
++    return SQLITE_ERROR;
++  }
++  p->returnDepth--;
++  pc = p->returnStack[p->returnDepth] - 1;
++  break;
++}
++
++/* Opcode:  Halt P1 P2 *
++**
++** Exit immediately.  All open cursors, Lists, Sorts, etc are closed
++** automatically.
++**
++** P1 is the result code returned by sqlite_exec().  For a normal
++** halt, this should be SQLITE_OK (0).  For errors, it can be some
++** other value.  If P1!=0 then P2 will determine whether or not to
++** rollback the current transaction.  Do not rollback if P2==OE_Fail.
++** Do the rollback if P2==OE_Rollback.  If P2==OE_Abort, then back
++** out all changes that have occurred during this execution of the
++** VDBE, but do not rollback the transaction. 
++**
++** There is an implied "Halt 0 0 0" instruction inserted at the very end of
++** every program.  So a jump past the last instruction of the program
++** is the same as executing Halt.
++*/
++case OP_Halt: {
++  p->magic = VDBE_MAGIC_HALT;
++  p->pTos = pTos;
++  if( pOp->p1!=SQLITE_OK ){
++    p->rc = pOp->p1;
++    p->errorAction = pOp->p2;
++    if( pOp->p3 ){
++      sqliteSetString(&p->zErrMsg, pOp->p3, (char*)0);
++    }
++    return SQLITE_ERROR;
++  }else{
++    p->rc = SQLITE_OK;
++    return SQLITE_DONE;
++  }
++}
++
++/* Opcode: Integer P1 * P3
++**
++** The integer value P1 is pushed onto the stack.  If P3 is not zero
++** then it is assumed to be a string representation of the same integer.
++*/
++case OP_Integer: {
++  pTos++;
++  pTos->i = pOp->p1;
++  pTos->flags = MEM_Int;
++  if( pOp->p3 ){
++    pTos->z = pOp->p3;
++    pTos->flags |= MEM_Str | MEM_Static;
++    pTos->n = strlen(pOp->p3)+1;
++  }
++  break;
++}
++
++/* Opcode: String * * P3
++**
++** The string value P3 is pushed onto the stack.  If P3==0 then a
++** NULL is pushed onto the stack.
++*/
++case OP_String: {
++  char *z = pOp->p3;
++  pTos++;
++  if( z==0 ){
++    pTos->flags = MEM_Null;
++  }else{
++    pTos->z = z;
++    pTos->n = strlen(z) + 1;
++    pTos->flags = MEM_Str | MEM_Static;
++  }
++  break;
++}
++
++/* Opcode: Variable P1 * *
++**
++** Push the value of variable P1 onto the stack.  A variable is
++** an unknown in the original SQL string as handed to sqlite_compile().
++** Any occurance of the '?' character in the original SQL is considered
++** a variable.  Variables in the SQL string are number from left to
++** right beginning with 1.  The values of variables are set using the
++** sqlite_bind() API.
++*/
++case OP_Variable: {
++  int j = pOp->p1 - 1;
++  pTos++;
++  if( j>=0 && j<p->nVar && p->azVar[j]!=0 ){
++    pTos->z = p->azVar[j];
++    pTos->n = p->anVar[j];
++    pTos->flags = MEM_Str | MEM_Static;
++  }else{
++    pTos->flags = MEM_Null;
++  }
++  break;
++}
++
++/* Opcode: Pop P1 * *
++**
++** P1 elements are popped off of the top of stack and discarded.
++*/
++case OP_Pop: {
++  assert( pOp->p1>=0 );
++  popStack(&pTos, pOp->p1);
++  assert( pTos>=&p->aStack[-1] );
++  break;
++}
++
++/* Opcode: Dup P1 P2 *
++**
++** A copy of the P1-th element of the stack 
++** is made and pushed onto the top of the stack.
++** The top of the stack is element 0.  So the
++** instruction "Dup 0 0 0" will make a copy of the
++** top of the stack.
++**
++** If the content of the P1-th element is a dynamically
++** allocated string, then a new copy of that string
++** is made if P2==0.  If P2!=0, then just a pointer
++** to the string is copied.
++**
++** Also see the Pull instruction.
++*/
++case OP_Dup: {
++  Mem *pFrom = &pTos[-pOp->p1];
++  assert( pFrom<=pTos && pFrom>=p->aStack );
++  pTos++;
++  memcpy(pTos, pFrom, sizeof(*pFrom)-NBFS);
++  if( pTos->flags & MEM_Str ){
++    if( pOp->p2 && (pTos->flags & (MEM_Dyn|MEM_Ephem)) ){
++      pTos->flags &= ~MEM_Dyn;
++      pTos->flags |= MEM_Ephem;
++    }else if( pTos->flags & MEM_Short ){
++      memcpy(pTos->zShort, pFrom->zShort, pTos->n);
++      pTos->z = pTos->zShort;
++    }else if( (pTos->flags & MEM_Static)==0 ){
++      pTos->z = sqliteMallocRaw(pFrom->n);
++      if( sqlite_malloc_failed ) goto no_mem;
++      memcpy(pTos->z, pFrom->z, pFrom->n);
++      pTos->flags &= ~(MEM_Static|MEM_Ephem|MEM_Short);
++      pTos->flags |= MEM_Dyn;
++    }
++  }
++  break;
++}
++
++/* Opcode: Pull P1 * *
++**
++** The P1-th element is removed from its current location on 
++** the stack and pushed back on top of the stack.  The
++** top of the stack is element 0, so "Pull 0 0 0" is
++** a no-op.  "Pull 1 0 0" swaps the top two elements of
++** the stack.
++**
++** See also the Dup instruction.
++*/
++case OP_Pull: {
++  Mem *pFrom = &pTos[-pOp->p1];
++  int i;
++  Mem ts;
++
++  ts = *pFrom;
++  Deephemeralize(pTos);
++  for(i=0; i<pOp->p1; i++, pFrom++){
++    Deephemeralize(&pFrom[1]);
++    *pFrom = pFrom[1];
++    assert( (pFrom->flags & MEM_Ephem)==0 );
++    if( pFrom->flags & MEM_Short ){
++      assert( pFrom->flags & MEM_Str );
++      assert( pFrom->z==pFrom[1].zShort );
++      pFrom->z = pFrom->zShort;
++    }
++  }
++  *pTos = ts;
++  if( pTos->flags & MEM_Short ){
++    assert( pTos->flags & MEM_Str );
++    assert( pTos->z==pTos[-pOp->p1].zShort );
++    pTos->z = pTos->zShort;
++  }
++  break;
++}
++
++/* Opcode: Push P1 * *
++**
++** Overwrite the value of the P1-th element down on the
++** stack (P1==0 is the top of the stack) with the value
++** of the top of the stack.  Then pop the top of the stack.
++*/
++case OP_Push: {
++  Mem *pTo = &pTos[-pOp->p1];
++
++  assert( pTo>=p->aStack );
++  Deephemeralize(pTos);
++  Release(pTo);
++  *pTo = *pTos;
++  if( pTo->flags & MEM_Short ){
++    assert( pTo->z==pTos->zShort );
++    pTo->z = pTo->zShort;
++  }
++  pTos--;
++  break;
++}
++
++
++/* Opcode: ColumnName P1 P2 P3
++**
++** P3 becomes the P1-th column name (first is 0).  An array of pointers
++** to all column names is passed as the 4th parameter to the callback.
++** If P2==1 then this is the last column in the result set and thus the
++** number of columns in the result set will be P1.  There must be at least
++** one OP_ColumnName with a P2==1 before invoking OP_Callback and the
++** number of columns specified in OP_Callback must one more than the P1
++** value of the OP_ColumnName that has P2==1.
++*/
++case OP_ColumnName: {
++  assert( pOp->p1>=0 && pOp->p1<p->nOp );
++  p->azColName[pOp->p1] = pOp->p3;
++  p->nCallback = 0;
++  if( pOp->p2 ) p->nResColumn = pOp->p1+1;
++  break;
++}
++
++/* Opcode: Callback P1 * *
++**
++** Pop P1 values off the stack and form them into an array.  Then
++** invoke the callback function using the newly formed array as the
++** 3rd parameter.
++*/
++case OP_Callback: {
++  int i;
++  char **azArgv = p->zArgv;
++  Mem *pCol;
++
++  pCol = &pTos[1-pOp->p1];
++  assert( pCol>=p->aStack );
++  for(i=0; i<pOp->p1; i++, pCol++){
++    if( pCol->flags & MEM_Null ){
++      azArgv[i] = 0;
++    }else{
++      Stringify(pCol);
++      azArgv[i] = pCol->z;
++    }
++  }
++  azArgv[i] = 0;
++  p->nCallback++;
++  p->azResColumn = azArgv;
++  assert( p->nResColumn==pOp->p1 );
++  p->popStack = pOp->p1;
++  p->pc = pc + 1;
++  p->pTos = pTos;
++  return SQLITE_ROW;
++}
++
++/* Opcode: Concat P1 P2 P3
++**
++** Look at the first P1 elements of the stack.  Append them all 
++** together with the lowest element first.  Use P3 as a separator.  
++** Put the result on the top of the stack.  The original P1 elements
++** are popped from the stack if P2==0 and retained if P2==1.  If
++** any element of the stack is NULL, then the result is NULL.
++**
++** If P3 is NULL, then use no separator.  When P1==1, this routine
++** makes a copy of the top stack element into memory obtained
++** from sqliteMalloc().
++*/
++case OP_Concat: {
++  char *zNew;
++  int nByte;
++  int nField;
++  int i, j;
++  char *zSep;
++  int nSep;
++  Mem *pTerm;
++
++  nField = pOp->p1;
++  zSep = pOp->p3;
++  if( zSep==0 ) zSep = "";
++  nSep = strlen(zSep);
++  assert( &pTos[1-nField] >= p->aStack );
++  nByte = 1 - nSep;
++  pTerm = &pTos[1-nField];
++  for(i=0; i<nField; i++, pTerm++){
++    if( pTerm->flags & MEM_Null ){
++      nByte = -1;
++      break;
++    }else{
++      Stringify(pTerm);
++      nByte += pTerm->n - 1 + nSep;
++    }
++  }
++  if( nByte<0 ){
++    if( pOp->p2==0 ){
++      popStack(&pTos, nField);
++    }
++    pTos++;
++    pTos->flags = MEM_Null;
++    break;
++  }
++  zNew = sqliteMallocRaw( nByte );
++  if( zNew==0 ) goto no_mem;
++  j = 0;
++  pTerm = &pTos[1-nField];
++  for(i=j=0; i<nField; i++, pTerm++){
++    assert( pTerm->flags & MEM_Str );
++    memcpy(&zNew[j], pTerm->z, pTerm->n-1);
++    j += pTerm->n-1;
++    if( nSep>0 && i<nField-1 ){
++      memcpy(&zNew[j], zSep, nSep);
++      j += nSep;
++    }
++  }
++  zNew[j] = 0;
++  if( pOp->p2==0 ){
++    popStack(&pTos, nField);
++  }
++  pTos++;
++  pTos->n = nByte;
++  pTos->flags = MEM_Str|MEM_Dyn;
++  pTos->z = zNew;
++  break;
++}
++
++/* Opcode: Add * * *
++**
++** Pop the top two elements from the stack, add them together,
++** and push the result back onto the stack.  If either element
++** is a string then it is converted to a double using the atof()
++** function before the addition.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: Multiply * * *
++**
++** Pop the top two elements from the stack, multiply them together,
++** and push the result back onto the stack.  If either element
++** is a string then it is converted to a double using the atof()
++** function before the multiplication.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: Subtract * * *
++**
++** Pop the top two elements from the stack, subtract the
++** first (what was on top of the stack) from the second (the
++** next on stack)
++** and push the result back onto the stack.  If either element
++** is a string then it is converted to a double using the atof()
++** function before the subtraction.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: Divide * * *
++**
++** Pop the top two elements from the stack, divide the
++** first (what was on top of the stack) from the second (the
++** next on stack)
++** and push the result back onto the stack.  If either element
++** is a string then it is converted to a double using the atof()
++** function before the division.  Division by zero returns NULL.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: Remainder * * *
++**
++** Pop the top two elements from the stack, divide the
++** first (what was on top of the stack) from the second (the
++** next on stack)
++** and push the remainder after division onto the stack.  If either element
++** is a string then it is converted to a double using the atof()
++** function before the division.  Division by zero returns NULL.
++** If either operand is NULL, the result is NULL.
++*/
++case OP_Add:
++case OP_Subtract:
++case OP_Multiply:
++case OP_Divide:
++case OP_Remainder: {
++  Mem *pNos = &pTos[-1];
++  assert( pNos>=p->aStack );
++  if( ((pTos->flags | pNos->flags) & MEM_Null)!=0 ){
++    Release(pTos);
++    pTos--;
++    Release(pTos);
++    pTos->flags = MEM_Null;
++  }else if( (pTos->flags & pNos->flags & MEM_Int)==MEM_Int ){
++    int a, b;
++    a = pTos->i;
++    b = pNos->i;
++    switch( pOp->opcode ){
++      case OP_Add:         b += a;       break;
++      case OP_Subtract:    b -= a;       break;
++      case OP_Multiply:    b *= a;       break;
++      case OP_Divide: {
++        if( a==0 ) goto divide_by_zero;
++        b /= a;
++        break;
++      }
++      default: {
++        if( a==0 ) goto divide_by_zero;
++        b %= a;
++        break;
++      }
++    }
++    Release(pTos);
++    pTos--;
++    Release(pTos);
++    pTos->i = b;
++    pTos->flags = MEM_Int;
++  }else{
++    double a, b;
++    Realify(pTos);
++    Realify(pNos);
++    a = pTos->r;
++    b = pNos->r;
++    switch( pOp->opcode ){
++      case OP_Add:         b += a;       break;
++      case OP_Subtract:    b -= a;       break;
++      case OP_Multiply:    b *= a;       break;
++      case OP_Divide: {
++        if( a==0.0 ) goto divide_by_zero;
++        b /= a;
++        break;
++      }
++      default: {
++        int ia = (int)a;
++        int ib = (int)b;
++        if( ia==0.0 ) goto divide_by_zero;
++        b = ib % ia;
++        break;
++      }
++    }
++    Release(pTos);
++    pTos--;
++    Release(pTos);
++    pTos->r = b;
++    pTos->flags = MEM_Real;
++  }
++  break;
++
++divide_by_zero:
++  Release(pTos);
++  pTos--;
++  Release(pTos);
++  pTos->flags = MEM_Null;
++  break;
++}
++
++/* Opcode: Function P1 * P3
++**
++** Invoke a user function (P3 is a pointer to a Function structure that
++** defines the function) with P1 string arguments taken from the stack.
++** Pop all arguments from the stack and push back the result.
++**
++** See also: AggFunc
++*/
++case OP_Function: {
++  int n, i;
++  Mem *pArg;
++  char **azArgv;
++  sqlite_func ctx;
++
++  n = pOp->p1;
++  pArg = &pTos[1-n];
++  azArgv = p->zArgv;
++  for(i=0; i<n; i++, pArg++){
++    if( pArg->flags & MEM_Null ){
++      azArgv[i] = 0;
++    }else{
++      Stringify(pArg);
++      azArgv[i] = pArg->z;
++    }
++  }
++  ctx.pFunc = (FuncDef*)pOp->p3;
++  ctx.s.flags = MEM_Null;
++  ctx.s.z = 0;
++  ctx.isError = 0;
++  ctx.isStep = 0;
++  if( sqliteSafetyOff(db) ) goto abort_due_to_misuse;
++  (*ctx.pFunc->xFunc)(&ctx, n, (const char**)azArgv);
++  if( sqliteSafetyOn(db) ) goto abort_due_to_misuse;
++  popStack(&pTos, n);
++  pTos++;
++  *pTos = ctx.s;
++  if( pTos->flags & MEM_Short ){
++    pTos->z = pTos->zShort;
++  }
++  if( ctx.isError ){
++    sqliteSetString(&p->zErrMsg, 
++       (pTos->flags & MEM_Str)!=0 ? pTos->z : "user function error", (char*)0);
++    rc = SQLITE_ERROR;
++  }
++  break;
++}
++
++/* Opcode: BitAnd * * *
++**
++** Pop the top two elements from the stack.  Convert both elements
++** to integers.  Push back onto the stack the bit-wise AND of the
++** two elements.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: BitOr * * *
++**
++** Pop the top two elements from the stack.  Convert both elements
++** to integers.  Push back onto the stack the bit-wise OR of the
++** two elements.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: ShiftLeft * * *
++**
++** Pop the top two elements from the stack.  Convert both elements
++** to integers.  Push back onto the stack the top element shifted
++** left by N bits where N is the second element on the stack.
++** If either operand is NULL, the result is NULL.
++*/
++/* Opcode: ShiftRight * * *
++**
++** Pop the top two elements from the stack.  Convert both elements
++** to integers.  Push back onto the stack the top element shifted
++** right by N bits where N is the second element on the stack.
++** If either operand is NULL, the result is NULL.
++*/
++case OP_BitAnd:
++case OP_BitOr:
++case OP_ShiftLeft:
++case OP_ShiftRight: {
++  Mem *pNos = &pTos[-1];
++  int a, b;
++
++  assert( pNos>=p->aStack );
++  if( (pTos->flags | pNos->flags) & MEM_Null ){
++    popStack(&pTos, 2);
++    pTos++;
++    pTos->flags = MEM_Null;
++    break;
++  }
++  Integerify(pTos);
++  Integerify(pNos);
++  a = pTos->i;
++  b = pNos->i;
++  switch( pOp->opcode ){
++    case OP_BitAnd:      a &= b;     break;
++    case OP_BitOr:       a |= b;     break;
++    case OP_ShiftLeft:   a <<= b;    break;
++    case OP_ShiftRight:  a >>= b;    break;
++    default:   /* CANT HAPPEN */     break;
++  }
++  assert( (pTos->flags & MEM_Dyn)==0 );
++  assert( (pNos->flags & MEM_Dyn)==0 );
++  pTos--;
++  Release(pTos);
++  pTos->i = a;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: AddImm  P1 * *
++** 
++** Add the value P1 to whatever is on top of the stack.  The result
++** is always an integer.
++**
++** To force the top of the stack to be an integer, just add 0.
++*/
++case OP_AddImm: {
++  assert( pTos>=p->aStack );
++  Integerify(pTos);
++  pTos->i += pOp->p1;
++  break;
++}
++
++/* Opcode: ForceInt P1 P2 *
++**
++** Convert the top of the stack into an integer.  If the current top of
++** the stack is not numeric (meaning that is is a NULL or a string that
++** does not look like an integer or floating point number) then pop the
++** stack and jump to P2.  If the top of the stack is numeric then
++** convert it into the least integer that is greater than or equal to its
++** current value if P1==0, or to the least integer that is strictly
++** greater than its current value if P1==1.
++*/
++case OP_ForceInt: {
++  int v;
++  assert( pTos>=p->aStack );
++  if( (pTos->flags & (MEM_Int|MEM_Real))==0
++         && ((pTos->flags & MEM_Str)==0 || sqliteIsNumber(pTos->z)==0) ){
++    Release(pTos);
++    pTos--;
++    pc = pOp->p2 - 1;
++    break;
++  }
++  if( pTos->flags & MEM_Int ){
++    v = pTos->i + (pOp->p1!=0);
++  }else{
++    Realify(pTos);
++    v = (int)pTos->r;
++    if( pTos->r>(double)v ) v++;
++    if( pOp->p1 && pTos->r==(double)v ) v++;
++  }
++  Release(pTos);
++  pTos->i = v;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: MustBeInt P1 P2 *
++** 
++** Force the top of the stack to be an integer.  If the top of the
++** stack is not an integer and cannot be converted into an integer
++** with out data loss, then jump immediately to P2, or if P2==0
++** raise an SQLITE_MISMATCH exception.
++**
++** If the top of the stack is not an integer and P2 is not zero and
++** P1 is 1, then the stack is popped.  In all other cases, the depth
++** of the stack is unchanged.
++*/
++case OP_MustBeInt: {
++  assert( pTos>=p->aStack );
++  if( pTos->flags & MEM_Int ){
++    /* Do nothing */
++  }else if( pTos->flags & MEM_Real ){
++    int i = (int)pTos->r;
++    double r = (double)i;
++    if( r!=pTos->r ){
++      goto mismatch;
++    }
++    pTos->i = i;
++  }else if( pTos->flags & MEM_Str ){
++    int v;
++    if( !toInt(pTos->z, &v) ){
++      double r;
++      if( !sqliteIsNumber(pTos->z) ){
++        goto mismatch;
++      }
++      Realify(pTos);
++      v = (int)pTos->r;
++      r = (double)v;
++      if( r!=pTos->r ){
++        goto mismatch;
++      }
++    }
++    pTos->i = v;
++  }else{
++    goto mismatch;
++  }
++  Release(pTos);
++  pTos->flags = MEM_Int;
++  break;
++
++mismatch:
++  if( pOp->p2==0 ){
++    rc = SQLITE_MISMATCH;
++    goto abort_due_to_error;
++  }else{
++    if( pOp->p1 ) popStack(&pTos, 1);
++    pc = pOp->p2 - 1;
++  }
++  break;
++}
++
++/* Opcode: Eq P1 P2 *
++**
++** Pop the top two elements from the stack.  If they are equal, then
++** jump to instruction P2.  Otherwise, continue to the next instruction.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** If both values are numeric, they are converted to doubles using atof()
++** and compared for equality that way.  Otherwise the strcmp() library
++** routine is used for the comparison.  For a pure text comparison
++** use OP_StrEq.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: Ne P1 P2 *
++**
++** Pop the top two elements from the stack.  If they are not equal, then
++** jump to instruction P2.  Otherwise, continue to the next instruction.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** If both values are numeric, they are converted to doubles using atof()
++** and compared in that format.  Otherwise the strcmp() library
++** routine is used for the comparison.  For a pure text comparison
++** use OP_StrNe.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: Lt P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the
++** next on stack) is less than the first (the top of stack), then
++** jump to instruction P2.  Otherwise, continue to the next instruction.
++** In other words, jump if NOS<TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** If both values are numeric, they are converted to doubles using atof()
++** and compared in that format.  Numeric values are always less than
++** non-numeric values.  If both operands are non-numeric, the strcmp() library
++** routine is used for the comparison.  For a pure text comparison
++** use OP_StrLt.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: Le P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the
++** next on stack) is less than or equal to the first (the top of stack),
++** then jump to instruction P2. In other words, jump if NOS<=TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** If both values are numeric, they are converted to doubles using atof()
++** and compared in that format.  Numeric values are always less than
++** non-numeric values.  If both operands are non-numeric, the strcmp() library
++** routine is used for the comparison.  For a pure text comparison
++** use OP_StrLe.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: Gt P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the
++** next on stack) is greater than the first (the top of stack),
++** then jump to instruction P2. In other words, jump if NOS>TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** If both values are numeric, they are converted to doubles using atof()
++** and compared in that format.  Numeric values are always less than
++** non-numeric values.  If both operands are non-numeric, the strcmp() library
++** routine is used for the comparison.  For a pure text comparison
++** use OP_StrGt.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: Ge P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the next
++** on stack) is greater than or equal to the first (the top of stack),
++** then jump to instruction P2. In other words, jump if NOS>=TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** If both values are numeric, they are converted to doubles using atof()
++** and compared in that format.  Numeric values are always less than
++** non-numeric values.  If both operands are non-numeric, the strcmp() library
++** routine is used for the comparison.  For a pure text comparison
++** use OP_StrGe.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++case OP_Eq:
++case OP_Ne:
++case OP_Lt:
++case OP_Le:
++case OP_Gt:
++case OP_Ge: {
++  Mem *pNos = &pTos[-1];
++  int c, v;
++  int ft, fn;
++  assert( pNos>=p->aStack );
++  ft = pTos->flags;
++  fn = pNos->flags;
++  if( (ft | fn) & MEM_Null ){
++    popStack(&pTos, 2);
++    if( pOp->p2 ){
++      if( pOp->p1 ) pc = pOp->p2-1;
++    }else{
++      pTos++;
++      pTos->flags = MEM_Null;
++    }
++    break;
++  }else if( (ft & fn & MEM_Int)==MEM_Int ){
++    c = pNos->i - pTos->i;
++  }else if( (ft & MEM_Int)!=0 && (fn & MEM_Str)!=0 && toInt(pNos->z,&v) ){
++    c = v - pTos->i;
++  }else if( (fn & MEM_Int)!=0 && (ft & MEM_Str)!=0 && toInt(pTos->z,&v) ){
++    c = pNos->i - v;
++  }else{
++    Stringify(pTos);
++    Stringify(pNos);
++    c = sqliteCompare(pNos->z, pTos->z);
++  }
++  switch( pOp->opcode ){
++    case OP_Eq:    c = c==0;     break;
++    case OP_Ne:    c = c!=0;     break;
++    case OP_Lt:    c = c<0;      break;
++    case OP_Le:    c = c<=0;     break;
++    case OP_Gt:    c = c>0;      break;
++    default:       c = c>=0;     break;
++  }
++  popStack(&pTos, 2);
++  if( pOp->p2 ){
++    if( c ) pc = pOp->p2-1;
++  }else{
++    pTos++;
++    pTos->i = c;
++    pTos->flags = MEM_Int;
++  }
++  break;
++}
++/* INSERT NO CODE HERE!
++**
++** The opcode numbers are extracted from this source file by doing
++**
++**    grep '^case OP_' vdbe.c | ... >opcodes.h
++**
++** The opcodes are numbered in the order that they appear in this file.
++** But in order for the expression generating code to work right, the
++** string comparison operators that follow must be numbered exactly 6
++** greater than the numeric comparison opcodes above.  So no other
++** cases can appear between the two.
++*/
++/* Opcode: StrEq P1 P2 *
++**
++** Pop the top two elements from the stack.  If they are equal, then
++** jump to instruction P2.  Otherwise, continue to the next instruction.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** The strcmp() library routine is used for the comparison.  For a
++** numeric comparison, use OP_Eq.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: StrNe P1 P2 *
++**
++** Pop the top two elements from the stack.  If they are not equal, then
++** jump to instruction P2.  Otherwise, continue to the next instruction.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** The strcmp() library routine is used for the comparison.  For a
++** numeric comparison, use OP_Ne.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: StrLt P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the
++** next on stack) is less than the first (the top of stack), then
++** jump to instruction P2.  Otherwise, continue to the next instruction.
++** In other words, jump if NOS<TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** The strcmp() library routine is used for the comparison.  For a
++** numeric comparison, use OP_Lt.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: StrLe P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the
++** next on stack) is less than or equal to the first (the top of stack),
++** then jump to instruction P2. In other words, jump if NOS<=TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** The strcmp() library routine is used for the comparison.  For a
++** numeric comparison, use OP_Le.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: StrGt P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the
++** next on stack) is greater than the first (the top of stack),
++** then jump to instruction P2. In other words, jump if NOS>TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** The strcmp() library routine is used for the comparison.  For a
++** numeric comparison, use OP_Gt.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++/* Opcode: StrGe P1 P2 *
++**
++** Pop the top two elements from the stack.  If second element (the next
++** on stack) is greater than or equal to the first (the top of stack),
++** then jump to instruction P2. In other words, jump if NOS>=TOS.
++**
++** If either operand is NULL (and thus if the result is unknown) then
++** take the jump if P1 is true.
++**
++** The strcmp() library routine is used for the comparison.  For a
++** numeric comparison, use OP_Ge.
++**
++** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
++** stack if the jump would have been taken, or a 0 if not.  Push a
++** NULL if either operand was NULL.
++*/
++case OP_StrEq:
++case OP_StrNe:
++case OP_StrLt:
++case OP_StrLe:
++case OP_StrGt:
++case OP_StrGe: {
++  Mem *pNos = &pTos[-1];
++  int c;
++  assert( pNos>=p->aStack );
++  if( (pNos->flags | pTos->flags) & MEM_Null ){
++    popStack(&pTos, 2);
++    if( pOp->p2 ){
++      if( pOp->p1 ) pc = pOp->p2-1;
++    }else{
++      pTos++;
++      pTos->flags = MEM_Null;
++    }
++    break;
++  }else{
++    Stringify(pTos);
++    Stringify(pNos);
++    c = strcmp(pNos->z, pTos->z);
++  }
++  /* The asserts on each case of the following switch are there to verify
++  ** that string comparison opcodes are always exactly 6 greater than the
++  ** corresponding numeric comparison opcodes.  The code generator depends
++  ** on this fact.
++  */
++  switch( pOp->opcode ){
++    case OP_StrEq:    c = c==0;    assert( pOp->opcode-6==OP_Eq );   break;
++    case OP_StrNe:    c = c!=0;    assert( pOp->opcode-6==OP_Ne );   break;
++    case OP_StrLt:    c = c<0;     assert( pOp->opcode-6==OP_Lt );   break;
++    case OP_StrLe:    c = c<=0;    assert( pOp->opcode-6==OP_Le );   break;
++    case OP_StrGt:    c = c>0;     assert( pOp->opcode-6==OP_Gt );   break;
++    default:          c = c>=0;    assert( pOp->opcode-6==OP_Ge );   break;
++  }
++  popStack(&pTos, 2);
++  if( pOp->p2 ){
++    if( c ) pc = pOp->p2-1;
++  }else{
++    pTos++;
++    pTos->flags = MEM_Int;
++    pTos->i = c;
++  }
++  break;
++}
++
++/* Opcode: And * * *
++**
++** Pop two values off the stack.  Take the logical AND of the
++** two values and push the resulting boolean value back onto the
++** stack. 
++*/
++/* Opcode: Or * * *
++**
++** Pop two values off the stack.  Take the logical OR of the
++** two values and push the resulting boolean value back onto the
++** stack. 
++*/
++case OP_And:
++case OP_Or: {
++  Mem *pNos = &pTos[-1];
++  int v1, v2;    /* 0==TRUE, 1==FALSE, 2==UNKNOWN or NULL */
++
++  assert( pNos>=p->aStack );
++  if( pTos->flags & MEM_Null ){
++    v1 = 2;
++  }else{
++    Integerify(pTos);
++    v1 = pTos->i==0;
++  }
++  if( pNos->flags & MEM_Null ){
++    v2 = 2;
++  }else{
++    Integerify(pNos);
++    v2 = pNos->i==0;
++  }
++  if( pOp->opcode==OP_And ){
++    static const unsigned char and_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 };
++    v1 = and_logic[v1*3+v2];
++  }else{
++    static const unsigned char or_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 };
++    v1 = or_logic[v1*3+v2];
++  }
++  popStack(&pTos, 2);
++  pTos++;
++  if( v1==2 ){
++    pTos->flags = MEM_Null;
++  }else{
++    pTos->i = v1==0;
++    pTos->flags = MEM_Int;
++  }
++  break;
++}
++
++/* Opcode: Negative * * *
++**
++** Treat the top of the stack as a numeric quantity.  Replace it
++** with its additive inverse.  If the top of the stack is NULL
++** its value is unchanged.
++*/
++/* Opcode: AbsValue * * *
++**
++** Treat the top of the stack as a numeric quantity.  Replace it
++** with its absolute value. If the top of the stack is NULL
++** its value is unchanged.
++*/
++case OP_Negative:
++case OP_AbsValue: {
++  assert( pTos>=p->aStack );
++  if( pTos->flags & MEM_Real ){
++    Release(pTos);
++    if( pOp->opcode==OP_Negative || pTos->r<0.0 ){
++      pTos->r = -pTos->r;
++    }
++    pTos->flags = MEM_Real;
++  }else if( pTos->flags & MEM_Int ){
++    Release(pTos);
++    if( pOp->opcode==OP_Negative || pTos->i<0 ){
++      pTos->i = -pTos->i;
++    }
++    pTos->flags = MEM_Int;
++  }else if( pTos->flags & MEM_Null ){
++    /* Do nothing */
++  }else{
++    Realify(pTos);
++    Release(pTos);
++    if( pOp->opcode==OP_Negative || pTos->r<0.0 ){
++      pTos->r = -pTos->r;
++    }
++    pTos->flags = MEM_Real;
++  }
++  break;
++}
++
++/* Opcode: Not * * *
++**
++** Interpret the top of the stack as a boolean value.  Replace it
++** with its complement.  If the top of the stack is NULL its value
++** is unchanged.
++*/
++case OP_Not: {
++  assert( pTos>=p->aStack );
++  if( pTos->flags & MEM_Null ) break;  /* Do nothing to NULLs */
++  Integerify(pTos);
++  Release(pTos);
++  pTos->i = !pTos->i;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: BitNot * * *
++**
++** Interpret the top of the stack as an value.  Replace it
++** with its ones-complement.  If the top of the stack is NULL its
++** value is unchanged.
++*/
++case OP_BitNot: {
++  assert( pTos>=p->aStack );
++  if( pTos->flags & MEM_Null ) break;  /* Do nothing to NULLs */
++  Integerify(pTos);
++  Release(pTos);
++  pTos->i = ~pTos->i;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: Noop * * *
++**
++** Do nothing.  This instruction is often useful as a jump
++** destination.
++*/
++case OP_Noop: {
++  break;
++}
++
++/* Opcode: If P1 P2 *
++**
++** Pop a single boolean from the stack.  If the boolean popped is
++** true, then jump to p2.  Otherwise continue to the next instruction.
++** An integer is false if zero and true otherwise.  A string is
++** false if it has zero length and true otherwise.
++**
++** If the value popped of the stack is NULL, then take the jump if P1
++** is true and fall through if P1 is false.
++*/
++/* Opcode: IfNot P1 P2 *
++**
++** Pop a single boolean from the stack.  If the boolean popped is
++** false, then jump to p2.  Otherwise continue to the next instruction.
++** An integer is false if zero and true otherwise.  A string is
++** false if it has zero length and true otherwise.
++**
++** If the value popped of the stack is NULL, then take the jump if P1
++** is true and fall through if P1 is false.
++*/
++case OP_If:
++case OP_IfNot: {
++  int c;
++  assert( pTos>=p->aStack );
++  if( pTos->flags & MEM_Null ){
++    c = pOp->p1;
++  }else{
++    Integerify(pTos);
++    c = pTos->i;
++    if( pOp->opcode==OP_IfNot ) c = !c;
++  }
++  assert( (pTos->flags & MEM_Dyn)==0 );
++  pTos--;
++  if( c ) pc = pOp->p2-1;
++  break;
++}
++
++/* Opcode: IsNull P1 P2 *
++**
++** If any of the top abs(P1) values on the stack are NULL, then jump
++** to P2.  Pop the stack P1 times if P1>0.   If P1<0 leave the stack
++** unchanged.
++*/
++case OP_IsNull: {
++  int i, cnt;
++  Mem *pTerm;
++  cnt = pOp->p1;
++  if( cnt<0 ) cnt = -cnt;
++  pTerm = &pTos[1-cnt];
++  assert( pTerm>=p->aStack );
++  for(i=0; i<cnt; i++, pTerm++){
++    if( pTerm->flags & MEM_Null ){
++      pc = pOp->p2-1;
++      break;
++    }
++  }
++  if( pOp->p1>0 ) popStack(&pTos, cnt);
++  break;
++}
++
++/* Opcode: NotNull P1 P2 *
++**
++** Jump to P2 if the top P1 values on the stack are all not NULL.  Pop the
++** stack if P1 times if P1 is greater than zero.  If P1 is less than
++** zero then leave the stack unchanged.
++*/
++case OP_NotNull: {
++  int i, cnt;
++  cnt = pOp->p1;
++  if( cnt<0 ) cnt = -cnt;
++  assert( &pTos[1-cnt] >= p->aStack );
++  for(i=0; i<cnt && (pTos[1+i-cnt].flags & MEM_Null)==0; i++){}
++  if( i>=cnt ) pc = pOp->p2-1;
++  if( pOp->p1>0 ) popStack(&pTos, cnt);
++  break;
++}
++
++/* Opcode: MakeRecord P1 P2 *
++**
++** Convert the top P1 entries of the stack into a single entry
++** suitable for use as a data record in a database table.  The
++** details of the format are irrelavant as long as the OP_Column
++** opcode can decode the record later.  Refer to source code
++** comments for the details of the record format.
++**
++** If P2 is true (non-zero) and one or more of the P1 entries
++** that go into building the record is NULL, then add some extra
++** bytes to the record to make it distinct for other entries created
++** during the same run of the VDBE.  The extra bytes added are a
++** counter that is reset with each run of the VDBE, so records
++** created this way will not necessarily be distinct across runs.
++** But they should be distinct for transient tables (created using
++** OP_OpenTemp) which is what they are intended for.
++**
++** (Later:) The P2==1 option was intended to make NULLs distinct
++** for the UNION operator.  But I have since discovered that NULLs
++** are indistinct for UNION.  So this option is never used.
++*/
++case OP_MakeRecord: {
++  char *zNewRecord;
++  int nByte;
++  int nField;
++  int i, j;
++  int idxWidth;
++  u32 addr;
++  Mem *pRec;
++  int addUnique = 0;   /* True to cause bytes to be added to make the
++                       ** generated record distinct */
++  char zTemp[NBFS];    /* Temp space for small records */
++
++  /* Assuming the record contains N fields, the record format looks
++  ** like this:
++  **
++  **   -------------------------------------------------------------------
++  **   | idx0 | idx1 | ... | idx(N-1) | idx(N) | data0 | ... | data(N-1) |
++  **   -------------------------------------------------------------------
++  **
++  ** All data fields are converted to strings before being stored and
++  ** are stored with their null terminators.  NULL entries omit the
++  ** null terminator.  Thus an empty string uses 1 byte and a NULL uses
++  ** zero bytes.  Data(0) is taken from the lowest element of the stack
++  ** and data(N-1) is the top of the stack.
++  **
++  ** Each of the idx() entries is either 1, 2, or 3 bytes depending on
++  ** how big the total record is.  Idx(0) contains the offset to the start
++  ** of data(0).  Idx(k) contains the offset to the start of data(k).
++  ** Idx(N) contains the total number of bytes in the record.
++  */
++  nField = pOp->p1;
++  pRec = &pTos[1-nField];
++  assert( pRec>=p->aStack );
++  nByte = 0;
++  for(i=0; i<nField; i++, pRec++){
++    if( pRec->flags & MEM_Null ){
++      addUnique = pOp->p2;
++    }else{
++      Stringify(pRec);
++      nByte += pRec->n;
++    }
++  }
++  if( addUnique ) nByte += sizeof(p->uniqueCnt);
++  if( nByte + nField + 1 < 256 ){
++    idxWidth = 1;
++  }else if( nByte + 2*nField + 2 < 65536 ){
++    idxWidth = 2;
++  }else{
++    idxWidth = 3;
++  }
++  nByte += idxWidth*(nField + 1);
++  if( nByte>MAX_BYTES_PER_ROW ){
++    rc = SQLITE_TOOBIG;
++    goto abort_due_to_error;
++  }
++  if( nByte<=NBFS ){
++    zNewRecord = zTemp;
++  }else{
++    zNewRecord = sqliteMallocRaw( nByte );
++    if( zNewRecord==0 ) goto no_mem;
++  }
++  j = 0;
++  addr = idxWidth*(nField+1) + addUnique*sizeof(p->uniqueCnt);
++  for(i=0, pRec=&pTos[1-nField]; i<nField; i++, pRec++){
++    zNewRecord[j++] = addr & 0xff;
++    if( idxWidth>1 ){
++      zNewRecord[j++] = (addr>>8)&0xff;
++      if( idxWidth>2 ){
++        zNewRecord[j++] = (addr>>16)&0xff;
++      }
++    }
++    if( (pRec->flags & MEM_Null)==0 ){
++      addr += pRec->n;
++    }
++  }
++  zNewRecord[j++] = addr & 0xff;
++  if( idxWidth>1 ){
++    zNewRecord[j++] = (addr>>8)&0xff;
++    if( idxWidth>2 ){
++      zNewRecord[j++] = (addr>>16)&0xff;
++    }
++  }
++  if( addUnique ){
++    memcpy(&zNewRecord[j], &p->uniqueCnt, sizeof(p->uniqueCnt));
++    p->uniqueCnt++;
++    j += sizeof(p->uniqueCnt);
++  }
++  for(i=0, pRec=&pTos[1-nField]; i<nField; i++, pRec++){
++    if( (pRec->flags & MEM_Null)==0 ){
++      memcpy(&zNewRecord[j], pRec->z, pRec->n);
++      j += pRec->n;
++    }
++  }
++  popStack(&pTos, nField);
++  pTos++;
++  pTos->n = nByte;
++  if( nByte<=NBFS ){
++    assert( zNewRecord==zTemp );
++    memcpy(pTos->zShort, zTemp, nByte);
++    pTos->z = pTos->zShort;
++    pTos->flags = MEM_Str | MEM_Short;
++  }else{
++    assert( zNewRecord!=zTemp );
++    pTos->z = zNewRecord;
++    pTos->flags = MEM_Str | MEM_Dyn;
++  }
++  break;
++}
++
++/* Opcode: MakeKey P1 P2 P3
++**
++** Convert the top P1 entries of the stack into a single entry suitable
++** for use as the key in an index.  The top P1 records are
++** converted to strings and merged.  The null-terminators 
++** are retained and used as separators.
++** The lowest entry in the stack is the first field and the top of the
++** stack becomes the last.
++**
++** If P2 is not zero, then the original entries remain on the stack
++** and the new key is pushed on top.  If P2 is zero, the original
++** data is popped off the stack first then the new key is pushed
++** back in its place.
++**
++** P3 is a string that is P1 characters long.  Each character is either
++** an 'n' or a 't' to indicates if the argument should be intepreted as
++** numeric or text type.  The first character of P3 corresponds to the
++** lowest element on the stack.  If P3 is NULL then all arguments are
++** assumed to be of the numeric type.
++**
++** The type makes a difference in that text-type fields may not be 
++** introduced by 'b' (as described in the next paragraph).  The
++** first character of a text-type field must be either 'a' (if it is NULL)
++** or 'c'.  Numeric fields will be introduced by 'b' if their content
++** looks like a well-formed number.  Otherwise the 'a' or 'c' will be
++** used.
++**
++** The key is a concatenation of fields.  Each field is terminated by
++** a single 0x00 character.  A NULL field is introduced by an 'a' and
++** is followed immediately by its 0x00 terminator.  A numeric field is
++** introduced by a single character 'b' and is followed by a sequence
++** of characters that represent the number such that a comparison of
++** the character string using memcpy() sorts the numbers in numerical
++** order.  The character strings for numbers are generated using the
++** sqliteRealToSortable() function.  A text field is introduced by a
++** 'c' character and is followed by the exact text of the field.  The
++** use of an 'a', 'b', or 'c' character at the beginning of each field
++** guarantees that NULLs sort before numbers and that numbers sort
++** before text.  0x00 characters do not occur except as separators
++** between fields.
++**
++** See also: MakeIdxKey, SortMakeKey
++*/
++/* Opcode: MakeIdxKey P1 P2 P3
++**
++** Convert the top P1 entries of the stack into a single entry suitable
++** for use as the key in an index.  In addition, take one additional integer
++** off of the stack, treat that integer as a four-byte record number, and
++** append the four bytes to the key.  Thus a total of P1+1 entries are
++** popped from the stack for this instruction and a single entry is pushed
++** back.  The first P1 entries that are popped are strings and the last
++** entry (the lowest on the stack) is an integer record number.
++**
++** The converstion of the first P1 string entries occurs just like in
++** MakeKey.  Each entry is separated from the others by a null.
++** The entire concatenation is null-terminated.  The lowest entry
++** in the stack is the first field and the top of the stack becomes the
++** last.
++**
++** If P2 is not zero and one or more of the P1 entries that go into the
++** generated key is NULL, then jump to P2 after the new key has been
++** pushed on the stack.  In other words, jump to P2 if the key is
++** guaranteed to be unique.  This jump can be used to skip a subsequent
++** uniqueness test.
++**
++** P3 is a string that is P1 characters long.  Each character is either
++** an 'n' or a 't' to indicates if the argument should be numeric or
++** text.  The first character corresponds to the lowest element on the
++** stack.  If P3 is null then all arguments are assumed to be numeric.
++**
++** See also:  MakeKey, SortMakeKey
++*/
++case OP_MakeIdxKey:
++case OP_MakeKey: {
++  char *zNewKey;
++  int nByte;
++  int nField;
++  int addRowid;
++  int i, j;
++  int containsNull = 0;
++  Mem *pRec;
++  char zTemp[NBFS];
++
++  addRowid = pOp->opcode==OP_MakeIdxKey;
++  nField = pOp->p1;
++  pRec = &pTos[1-nField];
++  assert( pRec>=p->aStack );
++  nByte = 0;
++  for(j=0, i=0; i<nField; i++, j++, pRec++){
++    int flags = pRec->flags;
++    int len;
++    char *z;
++    if( flags & MEM_Null ){
++      nByte += 2;
++      containsNull = 1;
++    }else if( pOp->p3 && pOp->p3[j]=='t' ){
++      Stringify(pRec);
++      pRec->flags &= ~(MEM_Int|MEM_Real);
++      nByte += pRec->n+1;
++    }else if( (flags & (MEM_Real|MEM_Int))!=0 || sqliteIsNumber(pRec->z) ){
++      if( (flags & (MEM_Real|MEM_Int))==MEM_Int ){
++        pRec->r = pRec->i;
++      }else if( (flags & (MEM_Real|MEM_Int))==0 ){
++        pRec->r = sqliteAtoF(pRec->z, 0);
++      }
++      Release(pRec);
++      z = pRec->zShort;
++      sqliteRealToSortable(pRec->r, z);
++      len = strlen(z);
++      pRec->z = 0;
++      pRec->flags = MEM_Real;
++      pRec->n = len+1;
++      nByte += pRec->n+1;
++    }else{
++      nByte += pRec->n+1;
++    }
++  }
++  if( nByte+sizeof(u32)>MAX_BYTES_PER_ROW ){
++    rc = SQLITE_TOOBIG;
++    goto abort_due_to_error;
++  }
++  if( addRowid ) nByte += sizeof(u32);
++  if( nByte<=NBFS ){
++    zNewKey = zTemp;
++  }else{
++    zNewKey = sqliteMallocRaw( nByte );
++    if( zNewKey==0 ) goto no_mem;
++  }
++  j = 0;
++  pRec = &pTos[1-nField];
++  for(i=0; i<nField; i++, pRec++){
++    if( pRec->flags & MEM_Null ){
++      zNewKey[j++] = 'a';
++      zNewKey[j++] = 0;
++    }else if( pRec->flags==MEM_Real ){
++      zNewKey[j++] = 'b';
++      memcpy(&zNewKey[j], pRec->zShort, pRec->n);
++      j += pRec->n;
++    }else{
++      assert( pRec->flags & MEM_Str );
++      zNewKey[j++] = 'c';
++      memcpy(&zNewKey[j], pRec->z, pRec->n);
++      j += pRec->n;
++    }
++  }
++  if( addRowid ){
++    u32 iKey;
++    pRec = &pTos[-nField];
++    assert( pRec>=p->aStack );
++    Integerify(pRec);
++    iKey = intToKey(pRec->i);
++    memcpy(&zNewKey[j], &iKey, sizeof(u32));
++    popStack(&pTos, nField+1);
++    if( pOp->p2 && containsNull ) pc = pOp->p2 - 1;
++  }else{
++    if( pOp->p2==0 ) popStack(&pTos, nField);
++  }
++  pTos++;
++  pTos->n = nByte;
++  if( nByte<=NBFS ){
++    assert( zNewKey==zTemp );
++    pTos->z = pTos->zShort;
++    memcpy(pTos->zShort, zTemp, nByte);
++    pTos->flags = MEM_Str | MEM_Short;
++  }else{
++    pTos->z = zNewKey;
++    pTos->flags = MEM_Str | MEM_Dyn;
++  }
++  break;
++}
++
++/* Opcode: IncrKey * * *
++**
++** The top of the stack should contain an index key generated by
++** The MakeKey opcode.  This routine increases the least significant
++** byte of that key by one.  This is used so that the MoveTo opcode
++** will move to the first entry greater than the key rather than to
++** the key itself.
++*/
++case OP_IncrKey: {
++  assert( pTos>=p->aStack );
++  /* The IncrKey opcode is only applied to keys generated by
++  ** MakeKey or MakeIdxKey and the results of those operands
++  ** are always dynamic strings or zShort[] strings.  So we
++  ** are always free to modify the string in place.
++  */
++  assert( pTos->flags & (MEM_Dyn|MEM_Short) );
++  pTos->z[pTos->n-1]++;
++  break;
++}
++
++/* Opcode: Checkpoint P1 * *
++**
++** Begin a checkpoint.  A checkpoint is the beginning of a operation that
++** is part of a larger transaction but which might need to be rolled back
++** itself without effecting the containing transaction.  A checkpoint will
++** be automatically committed or rollback when the VDBE halts.
++**
++** The checkpoint is begun on the database file with index P1.  The main
++** database file has an index of 0 and the file used for temporary tables
++** has an index of 1.
++*/
++case OP_Checkpoint: {
++  int i = pOp->p1;
++  if( i>=0 && i<db->nDb && db->aDb[i].pBt && db->aDb[i].inTrans==1 ){
++    rc = sqliteBtreeBeginCkpt(db->aDb[i].pBt);
++    if( rc==SQLITE_OK ) db->aDb[i].inTrans = 2;
++  }
++  break;
++}
++
++/* Opcode: Transaction P1 * *
++**
++** Begin a transaction.  The transaction ends when a Commit or Rollback
++** opcode is encountered.  Depending on the ON CONFLICT setting, the
++** transaction might also be rolled back if an error is encountered.
++**
++** P1 is the index of the database file on which the transaction is
++** started.  Index 0 is the main database file and index 1 is the
++** file used for temporary tables.
++**
++** A write lock is obtained on the database file when a transaction is
++** started.  No other process can read or write the file while the
++** transaction is underway.  Starting a transaction also creates a
++** rollback journal.  A transaction must be started before any changes
++** can be made to the database.
++*/
++case OP_Transaction: {
++  int busy = 1;
++  int i = pOp->p1;
++  assert( i>=0 && i<db->nDb );
++  if( db->aDb[i].inTrans ) break;
++  while( db->aDb[i].pBt!=0 && busy ){
++    rc = sqliteBtreeBeginTrans(db->aDb[i].pBt);
++    switch( rc ){
++      case SQLITE_BUSY: {
++        if( db->xBusyCallback==0 ){
++          p->pc = pc;
++          p->undoTransOnError = 1;
++          p->rc = SQLITE_BUSY;
++          p->pTos = pTos;
++          return SQLITE_BUSY;
++        }else if( (*db->xBusyCallback)(db->pBusyArg, "", busy++)==0 ){
++          sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
++          busy = 0;
++        }
++        break;
++      }
++      case SQLITE_READONLY: {
++        rc = SQLITE_OK;
++        /* Fall thru into the next case */
++      }
++      case SQLITE_OK: {
++        p->inTempTrans = 0;
++        busy = 0;
++        break;
++      }
++      default: {
++        goto abort_due_to_error;
++      }
++    }
++  }
++  db->aDb[i].inTrans = 1;
++  p->undoTransOnError = 1;
++  break;
++}
++
++/* Opcode: Commit * * *
++**
++** Cause all modifications to the database that have been made since the
++** last Transaction to actually take effect.  No additional modifications
++** are allowed until another transaction is started.  The Commit instruction
++** deletes the journal file and releases the write lock on the database.
++** A read lock continues to be held if there are still cursors open.
++*/
++case OP_Commit: {
++  int i;
++  if( db->xCommitCallback!=0 ){
++    if( sqliteSafetyOff(db) ) goto abort_due_to_misuse; 
++    if( db->xCommitCallback(db->pCommitArg)!=0 ){
++      rc = SQLITE_CONSTRAINT;
++    }
++    if( sqliteSafetyOn(db) ) goto abort_due_to_misuse;
++  }
++  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
++    if( db->aDb[i].inTrans ){
++      rc = sqliteBtreeCommit(db->aDb[i].pBt);
++      db->aDb[i].inTrans = 0;
++    }
++  }
++  if( rc==SQLITE_OK ){
++    sqliteCommitInternalChanges(db);
++  }else{
++    sqliteRollbackAll(db);
++  }
++  break;
++}
++
++/* Opcode: Rollback P1 * *
++**
++** Cause all modifications to the database that have been made since the
++** last Transaction to be undone. The database is restored to its state
++** before the Transaction opcode was executed.  No additional modifications
++** are allowed until another transaction is started.
++**
++** P1 is the index of the database file that is committed.  An index of 0
++** is used for the main database and an index of 1 is used for the file used
++** to hold temporary tables.
++**
++** This instruction automatically closes all cursors and releases both
++** the read and write locks on the indicated database.
++*/
++case OP_Rollback: {
++  sqliteRollbackAll(db);
++  break;
++}
++
++/* Opcode: ReadCookie P1 P2 *
++**
++** Read cookie number P2 from database P1 and push it onto the stack.
++** P2==0 is the schema version.  P2==1 is the database format.
++** P2==2 is the recommended pager cache size, and so forth.  P1==0 is
++** the main database file and P1==1 is the database file used to store
++** temporary tables.
++**
++** There must be a read-lock on the database (either a transaction
++** must be started or there must be an open cursor) before
++** executing this instruction.
++*/
++case OP_ReadCookie: {
++  int aMeta[SQLITE_N_BTREE_META];
++  assert( pOp->p2<SQLITE_N_BTREE_META );
++  assert( pOp->p1>=0 && pOp->p1<db->nDb );
++  assert( db->aDb[pOp->p1].pBt!=0 );
++  rc = sqliteBtreeGetMeta(db->aDb[pOp->p1].pBt, aMeta);
++  pTos++;
++  pTos->i = aMeta[1+pOp->p2];
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: SetCookie P1 P2 *
++**
++** Write the top of the stack into cookie number P2 of database P1.
++** P2==0 is the schema version.  P2==1 is the database format.
++** P2==2 is the recommended pager cache size, and so forth.  P1==0 is
++** the main database file and P1==1 is the database file used to store
++** temporary tables.
++**
++** A transaction must be started before executing this opcode.
++*/
++case OP_SetCookie: {
++  int aMeta[SQLITE_N_BTREE_META];
++  assert( pOp->p2<SQLITE_N_BTREE_META );
++  assert( pOp->p1>=0 && pOp->p1<db->nDb );
++  assert( db->aDb[pOp->p1].pBt!=0 );
++  assert( pTos>=p->aStack );
++  Integerify(pTos)
++  rc = sqliteBtreeGetMeta(db->aDb[pOp->p1].pBt, aMeta);
++  if( rc==SQLITE_OK ){
++    aMeta[1+pOp->p2] = pTos->i;
++    rc = sqliteBtreeUpdateMeta(db->aDb[pOp->p1].pBt, aMeta);
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: VerifyCookie P1 P2 *
++**
++** Check the value of global database parameter number 0 (the
++** schema version) and make sure it is equal to P2.  
++** P1 is the database number which is 0 for the main database file
++** and 1 for the file holding temporary tables and some higher number
++** for auxiliary databases.
++**
++** The cookie changes its value whenever the database schema changes.
++** This operation is used to detect when that the cookie has changed
++** and that the current process needs to reread the schema.
++**
++** Either a transaction needs to have been started or an OP_Open needs
++** to be executed (to establish a read lock) before this opcode is
++** invoked.
++*/
++case OP_VerifyCookie: {
++  int aMeta[SQLITE_N_BTREE_META];
++  assert( pOp->p1>=0 && pOp->p1<db->nDb );
++  rc = sqliteBtreeGetMeta(db->aDb[pOp->p1].pBt, aMeta);
++  if( rc==SQLITE_OK && aMeta[1]!=pOp->p2 ){
++    sqliteSetString(&p->zErrMsg, "database schema has changed", (char*)0);
++    rc = SQLITE_SCHEMA;
++  }
++  break;
++}
++
++/* Opcode: OpenRead P1 P2 P3
++**
++** Open a read-only cursor for the database table whose root page is
++** P2 in a database file.  The database file is determined by an 
++** integer from the top of the stack.  0 means the main database and
++** 1 means the database used for temporary tables.  Give the new 
++** cursor an identifier of P1.  The P1 values need not be contiguous
++** but all P1 values should be small integers.  It is an error for
++** P1 to be negative.
++**
++** If P2==0 then take the root page number from the next of the stack.
++**
++** There will be a read lock on the database whenever there is an
++** open cursor.  If the database was unlocked prior to this instruction
++** then a read lock is acquired as part of this instruction.  A read
++** lock allows other processes to read the database but prohibits
++** any other process from modifying the database.  The read lock is
++** released when all cursors are closed.  If this instruction attempts
++** to get a read lock but fails, the script terminates with an
++** SQLITE_BUSY error code.
++**
++** The P3 value is the name of the table or index being opened.
++** The P3 value is not actually used by this opcode and may be
++** omitted.  But the code generator usually inserts the index or
++** table name into P3 to make the code easier to read.
++**
++** See also OpenWrite.
++*/
++/* Opcode: OpenWrite P1 P2 P3
++**
++** Open a read/write cursor named P1 on the table or index whose root
++** page is P2.  If P2==0 then take the root page number from the stack.
++**
++** The P3 value is the name of the table or index being opened.
++** The P3 value is not actually used by this opcode and may be
++** omitted.  But the code generator usually inserts the index or
++** table name into P3 to make the code easier to read.
++**
++** This instruction works just like OpenRead except that it opens the cursor
++** in read/write mode.  For a given table, there can be one or more read-only
++** cursors or a single read/write cursor but not both.
++**
++** See also OpenRead.
++*/
++case OP_OpenRead:
++case OP_OpenWrite: {
++  int busy = 0;
++  int i = pOp->p1;
++  int p2 = pOp->p2;
++  int wrFlag;
++  Btree *pX;
++  int iDb;
++  
++  assert( pTos>=p->aStack );
++  Integerify(pTos);
++  iDb = pTos->i;
++  pTos--;
++  assert( iDb>=0 && iDb<db->nDb );
++  pX = db->aDb[iDb].pBt;
++  assert( pX!=0 );
++  wrFlag = pOp->opcode==OP_OpenWrite;
++  if( p2<=0 ){
++    assert( pTos>=p->aStack );
++    Integerify(pTos);
++    p2 = pTos->i;
++    pTos--;
++    if( p2<2 ){
++      sqliteSetString(&p->zErrMsg, "root page number less than 2", (char*)0);
++      rc = SQLITE_INTERNAL;
++      break;
++    }
++  }
++  assert( i>=0 );
++  if( expandCursorArraySize(p, i) ) goto no_mem;
++  sqliteVdbeCleanupCursor(&p->aCsr[i]);
++  memset(&p->aCsr[i], 0, sizeof(Cursor));
++  p->aCsr[i].nullRow = 1;
++  if( pX==0 ) break;
++  do{
++    rc = sqliteBtreeCursor(pX, p2, wrFlag, &p->aCsr[i].pCursor);
++    switch( rc ){
++      case SQLITE_BUSY: {
++        if( db->xBusyCallback==0 ){
++          p->pc = pc;
++          p->rc = SQLITE_BUSY;
++          p->pTos = &pTos[1 + (pOp->p2<=0)]; /* Operands must remain on stack */
++          return SQLITE_BUSY;
++        }else if( (*db->xBusyCallback)(db->pBusyArg, pOp->p3, ++busy)==0 ){
++          sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
++          busy = 0;
++        }
++        break;
++      }
++      case SQLITE_OK: {
++        busy = 0;
++        break;
++      }
++      default: {
++        goto abort_due_to_error;
++      }
++    }
++  }while( busy );
++  break;
++}
++
++/* Opcode: OpenTemp P1 P2 *
++**
++** Open a new cursor to a transient table.
++** The transient cursor is always opened read/write even if 
++** the main database is read-only.  The transient table is deleted
++** automatically when the cursor is closed.
++**
++** The cursor points to a BTree table if P2==0 and to a BTree index
++** if P2==1.  A BTree table must have an integer key and can have arbitrary
++** data.  A BTree index has no data but can have an arbitrary key.
++**
++** This opcode is used for tables that exist for the duration of a single
++** SQL statement only.  Tables created using CREATE TEMPORARY TABLE
++** are opened using OP_OpenRead or OP_OpenWrite.  "Temporary" in the
++** context of this opcode means for the duration of a single SQL statement
++** whereas "Temporary" in the context of CREATE TABLE means for the duration
++** of the connection to the database.  Same word; different meanings.
++*/
++case OP_OpenTemp: {
++  int i = pOp->p1;
++  Cursor *pCx;
++  assert( i>=0 );
++  if( expandCursorArraySize(p, i) ) goto no_mem;
++  pCx = &p->aCsr[i];
++  sqliteVdbeCleanupCursor(pCx);
++  memset(pCx, 0, sizeof(*pCx));
++  pCx->nullRow = 1;
++  rc = sqliteBtreeFactory(db, 0, 1, TEMP_PAGES, &pCx->pBt);
++
++  if( rc==SQLITE_OK ){
++    rc = sqliteBtreeBeginTrans(pCx->pBt);
++  }
++  if( rc==SQLITE_OK ){
++    if( pOp->p2 ){
++      int pgno;
++      rc = sqliteBtreeCreateIndex(pCx->pBt, &pgno);
++      if( rc==SQLITE_OK ){
++        rc = sqliteBtreeCursor(pCx->pBt, pgno, 1, &pCx->pCursor);
++      }
++    }else{
++      rc = sqliteBtreeCursor(pCx->pBt, 2, 1, &pCx->pCursor);
++    }
++  }
++  break;
++}
++
++/* Opcode: OpenPseudo P1 * *
++**
++** Open a new cursor that points to a fake table that contains a single
++** row of data.  Any attempt to write a second row of data causes the
++** first row to be deleted.  All data is deleted when the cursor is
++** closed.
++**
++** A pseudo-table created by this opcode is useful for holding the
++** NEW or OLD tables in a trigger.
++*/
++case OP_OpenPseudo: {
++  int i = pOp->p1;
++  Cursor *pCx;
++  assert( i>=0 );
++  if( expandCursorArraySize(p, i) ) goto no_mem;
++  pCx = &p->aCsr[i];
++  sqliteVdbeCleanupCursor(pCx);
++  memset(pCx, 0, sizeof(*pCx));
++  pCx->nullRow = 1;
++  pCx->pseudoTable = 1;
++  break;
++}
++
++/* Opcode: Close P1 * *
++**
++** Close a cursor previously opened as P1.  If P1 is not
++** currently open, this instruction is a no-op.
++*/
++case OP_Close: {
++  int i = pOp->p1;
++  if( i>=0 && i<p->nCursor ){
++    sqliteVdbeCleanupCursor(&p->aCsr[i]);
++  }
++  break;
++}
++
++/* Opcode: MoveTo P1 P2 *
++**
++** Pop the top of the stack and use its value as a key.  Reposition
++** cursor P1 so that it points to an entry with a matching key.  If
++** the table contains no record with a matching key, then the cursor
++** is left pointing at the first record that is greater than the key.
++** If there are no records greater than the key and P2 is not zero,
++** then an immediate jump to P2 is made.
++**
++** See also: Found, NotFound, Distinct, MoveLt
++*/
++/* Opcode: MoveLt P1 P2 *
++**
++** Pop the top of the stack and use its value as a key.  Reposition
++** cursor P1 so that it points to the entry with the largest key that is
++** less than the key popped from the stack.
++** If there are no records less than than the key and P2
++** is not zero then an immediate jump to P2 is made.
++**
++** See also: MoveTo
++*/
++case OP_MoveLt:
++case OP_MoveTo: {
++  int i = pOp->p1;
++  Cursor *pC;
++
++  assert( pTos>=p->aStack );
++  assert( i>=0 && i<p->nCursor );
++  pC = &p->aCsr[i];
++  if( pC->pCursor!=0 ){
++    int res, oc;
++    pC->nullRow = 0;
++    if( pTos->flags & MEM_Int ){
++      int iKey = intToKey(pTos->i);
++      if( pOp->p2==0 && pOp->opcode==OP_MoveTo ){
++        pC->movetoTarget = iKey;
++        pC->deferredMoveto = 1;
++        Release(pTos);
++        pTos--;
++        break;
++      }
++      sqliteBtreeMoveto(pC->pCursor, (char*)&iKey, sizeof(int), &res);
++      pC->lastRecno = pTos->i;
++      pC->recnoIsValid = res==0;
++    }else{
++      Stringify(pTos);
++      sqliteBtreeMoveto(pC->pCursor, pTos->z, pTos->n, &res);
++      pC->recnoIsValid = 0;
++    }
++    pC->deferredMoveto = 0;
++    sqlite_search_count++;
++    oc = pOp->opcode;
++    if( oc==OP_MoveTo && res<0 ){
++      sqliteBtreeNext(pC->pCursor, &res);
++      pC->recnoIsValid = 0;
++      if( res && pOp->p2>0 ){
++        pc = pOp->p2 - 1;
++      }
++    }else if( oc==OP_MoveLt ){
++      if( res>=0 ){
++        sqliteBtreePrevious(pC->pCursor, &res);
++        pC->recnoIsValid = 0;
++      }else{
++        /* res might be negative because the table is empty.  Check to
++        ** see if this is the case.
++        */
++        int keysize;
++        res = sqliteBtreeKeySize(pC->pCursor,&keysize)!=0 || keysize==0;
++      }
++      if( res && pOp->p2>0 ){
++        pc = pOp->p2 - 1;
++      }
++    }
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: Distinct P1 P2 *
++**
++** Use the top of the stack as a string key.  If a record with that key does
++** not exist in the table of cursor P1, then jump to P2.  If the record
++** does already exist, then fall thru.  The cursor is left pointing
++** at the record if it exists. The key is not popped from the stack.
++**
++** This operation is similar to NotFound except that this operation
++** does not pop the key from the stack.
++**
++** See also: Found, NotFound, MoveTo, IsUnique, NotExists
++*/
++/* Opcode: Found P1 P2 *
++**
++** Use the top of the stack as a string key.  If a record with that key
++** does exist in table of P1, then jump to P2.  If the record
++** does not exist, then fall thru.  The cursor is left pointing
++** to the record if it exists.  The key is popped from the stack.
++**
++** See also: Distinct, NotFound, MoveTo, IsUnique, NotExists
++*/
++/* Opcode: NotFound P1 P2 *
++**
++** Use the top of the stack as a string key.  If a record with that key
++** does not exist in table of P1, then jump to P2.  If the record
++** does exist, then fall thru.  The cursor is left pointing to the
++** record if it exists.  The key is popped from the stack.
++**
++** The difference between this operation and Distinct is that
++** Distinct does not pop the key from the stack.
++**
++** See also: Distinct, Found, MoveTo, NotExists, IsUnique
++*/
++case OP_Distinct:
++case OP_NotFound:
++case OP_Found: {
++  int i = pOp->p1;
++  int alreadyExists = 0;
++  Cursor *pC;
++  assert( pTos>=p->aStack );
++  assert( i>=0 && i<p->nCursor );
++  if( (pC = &p->aCsr[i])->pCursor!=0 ){
++    int res, rx;
++    Stringify(pTos);
++    rx = sqliteBtreeMoveto(pC->pCursor, pTos->z, pTos->n, &res);
++    alreadyExists = rx==SQLITE_OK && res==0;
++    pC->deferredMoveto = 0;
++  }
++  if( pOp->opcode==OP_Found ){
++    if( alreadyExists ) pc = pOp->p2 - 1;
++  }else{
++    if( !alreadyExists ) pc = pOp->p2 - 1;
++  }
++  if( pOp->opcode!=OP_Distinct ){
++    Release(pTos);
++    pTos--;
++  }
++  break;
++}
++
++/* Opcode: IsUnique P1 P2 *
++**
++** The top of the stack is an integer record number.  Call this
++** record number R.  The next on the stack is an index key created
++** using MakeIdxKey.  Call it K.  This instruction pops R from the
++** stack but it leaves K unchanged.
++**
++** P1 is an index.  So all but the last four bytes of K are an
++** index string.  The last four bytes of K are a record number.
++**
++** This instruction asks if there is an entry in P1 where the
++** index string matches K but the record number is different
++** from R.  If there is no such entry, then there is an immediate
++** jump to P2.  If any entry does exist where the index string
++** matches K but the record number is not R, then the record
++** number for that entry is pushed onto the stack and control
++** falls through to the next instruction.
++**
++** See also: Distinct, NotFound, NotExists, Found
++*/
++case OP_IsUnique: {
++  int i = pOp->p1;
++  Mem *pNos = &pTos[-1];
++  BtCursor *pCrsr;
++  int R;
++
++  /* Pop the value R off the top of the stack
++  */
++  assert( pNos>=p->aStack );
++  Integerify(pTos);
++  R = pTos->i;
++  pTos--;
++  assert( i>=0 && i<=p->nCursor );
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int res, rc;
++    int v;         /* The record number on the P1 entry that matches K */
++    char *zKey;    /* The value of K */
++    int nKey;      /* Number of bytes in K */
++
++    /* Make sure K is a string and make zKey point to K
++    */
++    Stringify(pNos);
++    zKey = pNos->z;
++    nKey = pNos->n;
++    assert( nKey >= 4 );
++
++    /* Search for an entry in P1 where all but the last four bytes match K.
++    ** If there is no such entry, jump immediately to P2.
++    */
++    assert( p->aCsr[i].deferredMoveto==0 );
++    rc = sqliteBtreeMoveto(pCrsr, zKey, nKey-4, &res);
++    if( rc!=SQLITE_OK ) goto abort_due_to_error;
++    if( res<0 ){
++      rc = sqliteBtreeNext(pCrsr, &res);
++      if( res ){
++        pc = pOp->p2 - 1;
++        break;
++      }
++    }
++    rc = sqliteBtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &res);
++    if( rc!=SQLITE_OK ) goto abort_due_to_error;
++    if( res>0 ){
++      pc = pOp->p2 - 1;
++      break;
++    }
++
++    /* At this point, pCrsr is pointing to an entry in P1 where all but
++    ** the last for bytes of the key match K.  Check to see if the last
++    ** four bytes of the key are different from R.  If the last four
++    ** bytes equal R then jump immediately to P2.
++    */
++    sqliteBtreeKey(pCrsr, nKey - 4, 4, (char*)&v);
++    v = keyToInt(v);
++    if( v==R ){
++      pc = pOp->p2 - 1;
++      break;
++    }
++
++    /* The last four bytes of the key are different from R.  Convert the
++    ** last four bytes of the key into an integer and push it onto the
++    ** stack.  (These bytes are the record number of an entry that
++    ** violates a UNIQUE constraint.)
++    */
++    pTos++;
++    pTos->i = v;
++    pTos->flags = MEM_Int;
++  }
++  break;
++}
++
++/* Opcode: NotExists P1 P2 *
++**
++** Use the top of the stack as a integer key.  If a record with that key
++** does not exist in table of P1, then jump to P2.  If the record
++** does exist, then fall thru.  The cursor is left pointing to the
++** record if it exists.  The integer key is popped from the stack.
++**
++** The difference between this operation and NotFound is that this
++** operation assumes the key is an integer and NotFound assumes it
++** is a string.
++**
++** See also: Distinct, Found, MoveTo, NotFound, IsUnique
++*/
++case OP_NotExists: {
++  int i = pOp->p1;
++  BtCursor *pCrsr;
++  assert( pTos>=p->aStack );
++  assert( i>=0 && i<p->nCursor );
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int res, rx, iKey;
++    assert( pTos->flags & MEM_Int );
++    iKey = intToKey(pTos->i);
++    rx = sqliteBtreeMoveto(pCrsr, (char*)&iKey, sizeof(int), &res);
++    p->aCsr[i].lastRecno = pTos->i;
++    p->aCsr[i].recnoIsValid = res==0;
++    p->aCsr[i].nullRow = 0;
++    if( rx!=SQLITE_OK || res!=0 ){
++      pc = pOp->p2 - 1;
++      p->aCsr[i].recnoIsValid = 0;
++    }
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: NewRecno P1 * *
++**
++** Get a new integer record number used as the key to a table.
++** The record number is not previously used as a key in the database
++** table that cursor P1 points to.  The new record number is pushed 
++** onto the stack.
++*/
++case OP_NewRecno: {
++  int i = pOp->p1;
++  int v = 0;
++  Cursor *pC;
++  assert( i>=0 && i<p->nCursor );
++  if( (pC = &p->aCsr[i])->pCursor==0 ){
++    v = 0;
++  }else{
++    /* The next rowid or record number (different terms for the same
++    ** thing) is obtained in a two-step algorithm.
++    **
++    ** First we attempt to find the largest existing rowid and add one
++    ** to that.  But if the largest existing rowid is already the maximum
++    ** positive integer, we have to fall through to the second
++    ** probabilistic algorithm
++    **
++    ** The second algorithm is to select a rowid at random and see if
++    ** it already exists in the table.  If it does not exist, we have
++    ** succeeded.  If the random rowid does exist, we select a new one
++    ** and try again, up to 1000 times.
++    **
++    ** For a table with less than 2 billion entries, the probability
++    ** of not finding a unused rowid is about 1.0e-300.  This is a 
++    ** non-zero probability, but it is still vanishingly small and should
++    ** never cause a problem.  You are much, much more likely to have a
++    ** hardware failure than for this algorithm to fail.
++    **
++    ** The analysis in the previous paragraph assumes that you have a good
++    ** source of random numbers.  Is a library function like lrand48()
++    ** good enough?  Maybe. Maybe not. It's hard to know whether there
++    ** might be subtle bugs is some implementations of lrand48() that
++    ** could cause problems. To avoid uncertainty, SQLite uses its own 
++    ** random number generator based on the RC4 algorithm.
++    **
++    ** To promote locality of reference for repetitive inserts, the
++    ** first few attempts at chosing a random rowid pick values just a little
++    ** larger than the previous rowid.  This has been shown experimentally
++    ** to double the speed of the COPY operation.
++    */
++    int res, rx, cnt, x;
++    cnt = 0;
++    if( !pC->useRandomRowid ){
++      if( pC->nextRowidValid ){
++        v = pC->nextRowid;
++      }else{
++        rx = sqliteBtreeLast(pC->pCursor, &res);
++        if( res ){
++          v = 1;
++        }else{
++          sqliteBtreeKey(pC->pCursor, 0, sizeof(v), (void*)&v);
++          v = keyToInt(v);
++          if( v==0x7fffffff ){
++            pC->useRandomRowid = 1;
++          }else{
++            v++;
++          }
++        }
++      }
++      if( v<0x7fffffff ){
++        pC->nextRowidValid = 1;
++        pC->nextRowid = v+1;
++      }else{
++        pC->nextRowidValid = 0;
++      }
++    }
++    if( pC->useRandomRowid ){
++      v = db->priorNewRowid;
++      cnt = 0;
++      do{
++        if( v==0 || cnt>2 ){
++          sqliteRandomness(sizeof(v), &v);
++          if( cnt<5 ) v &= 0xffffff;
++        }else{
++          unsigned char r;
++          sqliteRandomness(1, &r);
++          v += r + 1;
++        }
++        if( v==0 ) continue;
++        x = intToKey(v);
++        rx = sqliteBtreeMoveto(pC->pCursor, &x, sizeof(int), &res);
++        cnt++;
++      }while( cnt<1000 && rx==SQLITE_OK && res==0 );
++      db->priorNewRowid = v;
++      if( rx==SQLITE_OK && res==0 ){
++        rc = SQLITE_FULL;
++        goto abort_due_to_error;
++      }
++    }
++    pC->recnoIsValid = 0;
++    pC->deferredMoveto = 0;
++  }
++  pTos++;
++  pTos->i = v;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: PutIntKey P1 P2 *
++**
++** Write an entry into the table of cursor P1.  A new entry is
++** created if it doesn't already exist or the data for an existing
++** entry is overwritten.  The data is the value on the top of the
++** stack.  The key is the next value down on the stack.  The key must
++** be an integer.  The stack is popped twice by this instruction.
++**
++** If the OPFLAG_NCHANGE flag of P2 is set, then the row change count is
++** incremented (otherwise not).  If the OPFLAG_CSCHANGE flag is set,
++** then the current statement change count is incremented (otherwise not).
++** If the OPFLAG_LASTROWID flag of P2 is set, then rowid is
++** stored for subsequent return by the sqlite_last_insert_rowid() function
++** (otherwise it's unmodified).
++*/
++/* Opcode: PutStrKey P1 * *
++**
++** Write an entry into the table of cursor P1.  A new entry is
++** created if it doesn't already exist or the data for an existing
++** entry is overwritten.  The data is the value on the top of the
++** stack.  The key is the next value down on the stack.  The key must
++** be a string.  The stack is popped twice by this instruction.
++**
++** P1 may not be a pseudo-table opened using the OpenPseudo opcode.
++*/
++case OP_PutIntKey:
++case OP_PutStrKey: {
++  Mem *pNos = &pTos[-1];
++  int i = pOp->p1;
++  Cursor *pC;
++  assert( pNos>=p->aStack );
++  assert( i>=0 && i<p->nCursor );
++  if( ((pC = &p->aCsr[i])->pCursor!=0 || pC->pseudoTable) ){
++    char *zKey;
++    int nKey, iKey;
++    if( pOp->opcode==OP_PutStrKey ){
++      Stringify(pNos);
++      nKey = pNos->n;
++      zKey = pNos->z;
++    }else{
++      assert( pNos->flags & MEM_Int );
++      nKey = sizeof(int);
++      iKey = intToKey(pNos->i);
++      zKey = (char*)&iKey;
++      if( pOp->p2 & OPFLAG_NCHANGE ) db->nChange++;
++      if( pOp->p2 & OPFLAG_LASTROWID ) db->lastRowid = pNos->i;
++      if( pOp->p2 & OPFLAG_CSCHANGE ) db->csChange++;
++      if( pC->nextRowidValid && pTos->i>=pC->nextRowid ){
++        pC->nextRowidValid = 0;
++      }
++    }
++    if( pTos->flags & MEM_Null ){
++      pTos->z = 0;
++      pTos->n = 0;
++    }else{
++      assert( pTos->flags & MEM_Str );
++    }
++    if( pC->pseudoTable ){
++      /* PutStrKey does not work for pseudo-tables.
++      ** The following assert makes sure we are not trying to use
++      ** PutStrKey on a pseudo-table
++      */
++      assert( pOp->opcode==OP_PutIntKey );
++      sqliteFree(pC->pData);
++      pC->iKey = iKey;
++      pC->nData = pTos->n;
++      if( pTos->flags & MEM_Dyn ){
++        pC->pData = pTos->z;
++        pTos->flags = MEM_Null;
++      }else{
++        pC->pData = sqliteMallocRaw( pC->nData );
++        if( pC->pData ){
++          memcpy(pC->pData, pTos->z, pC->nData);
++        }
++      }
++      pC->nullRow = 0;
++    }else{
++      rc = sqliteBtreeInsert(pC->pCursor, zKey, nKey, pTos->z, pTos->n);
++    }
++    pC->recnoIsValid = 0;
++    pC->deferredMoveto = 0;
++  }
++  popStack(&pTos, 2);
++  break;
++}
++
++/* Opcode: Delete P1 P2 *
++**
++** Delete the record at which the P1 cursor is currently pointing.
++**
++** The cursor will be left pointing at either the next or the previous
++** record in the table. If it is left pointing at the next record, then
++** the next Next instruction will be a no-op.  Hence it is OK to delete
++** a record from within an Next loop.
++**
++** If the OPFLAG_NCHANGE flag of P2 is set, then the row change count is
++** incremented (otherwise not).  If OPFLAG_CSCHANGE flag is set,
++** then the current statement change count is incremented (otherwise not).
++**
++** If P1 is a pseudo-table, then this instruction is a no-op.
++*/
++case OP_Delete: {
++  int i = pOp->p1;
++  Cursor *pC;
++  assert( i>=0 && i<p->nCursor );
++  pC = &p->aCsr[i];
++  if( pC->pCursor!=0 ){
++    sqliteVdbeCursorMoveto(pC);
++    rc = sqliteBtreeDelete(pC->pCursor);
++    pC->nextRowidValid = 0;
++  }
++  if( pOp->p2 & OPFLAG_NCHANGE ) db->nChange++;
++  if( pOp->p2 & OPFLAG_CSCHANGE ) db->csChange++;
++  break;
++}
++
++/* Opcode: SetCounts * * *
++**
++** Called at end of statement.  Updates lsChange (last statement change count)
++** and resets csChange (current statement change count) to 0.
++*/
++case OP_SetCounts: {
++  db->lsChange=db->csChange;
++  db->csChange=0;
++  break;
++}
++
++/* Opcode: KeyAsData P1 P2 *
++**
++** Turn the key-as-data mode for cursor P1 either on (if P2==1) or
++** off (if P2==0).  In key-as-data mode, the OP_Column opcode pulls
++** data off of the key rather than the data.  This is used for
++** processing compound selects.
++*/
++case OP_KeyAsData: {
++  int i = pOp->p1;
++  assert( i>=0 && i<p->nCursor );
++  p->aCsr[i].keyAsData = pOp->p2;
++  break;
++}
++
++/* Opcode: RowData P1 * *
++**
++** Push onto the stack the complete row data for cursor P1.
++** There is no interpretation of the data.  It is just copied
++** onto the stack exactly as it is found in the database file.
++**
++** If the cursor is not pointing to a valid row, a NULL is pushed
++** onto the stack.
++*/
++/* Opcode: RowKey P1 * *
++**
++** Push onto the stack the complete row key for cursor P1.
++** There is no interpretation of the key.  It is just copied
++** onto the stack exactly as it is found in the database file.
++**
++** If the cursor is not pointing to a valid row, a NULL is pushed
++** onto the stack.
++*/
++case OP_RowKey:
++case OP_RowData: {
++  int i = pOp->p1;
++  Cursor *pC;
++  int n;
++
++  pTos++;
++  assert( i>=0 && i<p->nCursor );
++  pC = &p->aCsr[i];
++  if( pC->nullRow ){
++    pTos->flags = MEM_Null;
++  }else if( pC->pCursor!=0 ){
++    BtCursor *pCrsr = pC->pCursor;
++    sqliteVdbeCursorMoveto(pC);
++    if( pC->nullRow ){
++      pTos->flags = MEM_Null;
++      break;
++    }else if( pC->keyAsData || pOp->opcode==OP_RowKey ){
++      sqliteBtreeKeySize(pCrsr, &n);
++    }else{
++      sqliteBtreeDataSize(pCrsr, &n);
++    }
++    pTos->n = n;
++    if( n<=NBFS ){
++      pTos->flags = MEM_Str | MEM_Short;
++      pTos->z = pTos->zShort;
++    }else{
++      char *z = sqliteMallocRaw( n );
++      if( z==0 ) goto no_mem;
++      pTos->flags = MEM_Str | MEM_Dyn;
++      pTos->z = z;
++    }
++    if( pC->keyAsData || pOp->opcode==OP_RowKey ){
++      sqliteBtreeKey(pCrsr, 0, n, pTos->z);
++    }else{
++      sqliteBtreeData(pCrsr, 0, n, pTos->z);
++    }
++  }else if( pC->pseudoTable ){
++    pTos->n = pC->nData;
++    pTos->z = pC->pData;
++    pTos->flags = MEM_Str|MEM_Ephem;
++  }else{
++    pTos->flags = MEM_Null;
++  }
++  break;
++}
++
++/* Opcode: Column P1 P2 *
++**
++** Interpret the data that cursor P1 points to as
++** a structure built using the MakeRecord instruction.
++** (See the MakeRecord opcode for additional information about
++** the format of the data.)
++** Push onto the stack the value of the P2-th column contained
++** in the data.
++**
++** If the KeyAsData opcode has previously executed on this cursor,
++** then the field might be extracted from the key rather than the
++** data.
++**
++** If P1 is negative, then the record is stored on the stack rather
++** than in a table.  For P1==-1, the top of the stack is used.
++** For P1==-2, the next on the stack is used.  And so forth.  The
++** value pushed is always just a pointer into the record which is
++** stored further down on the stack.  The column value is not copied.
++*/
++case OP_Column: {
++  int amt, offset, end, payloadSize;
++  int i = pOp->p1;
++  int p2 = pOp->p2;
++  Cursor *pC;
++  char *zRec;
++  BtCursor *pCrsr;
++  int idxWidth;
++  unsigned char aHdr[10];
++
++  assert( i<p->nCursor );
++  pTos++;
++  if( i<0 ){
++    assert( &pTos[i]>=p->aStack );
++    assert( pTos[i].flags & MEM_Str );
++    zRec = pTos[i].z;
++    payloadSize = pTos[i].n;
++  }else if( (pC = &p->aCsr[i])->pCursor!=0 ){
++    sqliteVdbeCursorMoveto(pC);
++    zRec = 0;
++    pCrsr = pC->pCursor;
++    if( pC->nullRow ){
++      payloadSize = 0;
++    }else if( pC->keyAsData ){
++      sqliteBtreeKeySize(pCrsr, &payloadSize);
++    }else{
++      sqliteBtreeDataSize(pCrsr, &payloadSize);
++    }
++  }else if( pC->pseudoTable ){
++    payloadSize = pC->nData;
++    zRec = pC->pData;
++    assert( payloadSize==0 || zRec!=0 );
++  }else{
++    payloadSize = 0;
++  }
++
++  /* Figure out how many bytes in the column data and where the column
++  ** data begins.
++  */
++  if( payloadSize==0 ){
++    pTos->flags = MEM_Null;
++    break;
++  }else if( payloadSize<256 ){
++    idxWidth = 1;
++  }else if( payloadSize<65536 ){
++    idxWidth = 2;
++  }else{
++    idxWidth = 3;
++  }
++
++  /* Figure out where the requested column is stored and how big it is.
++  */
++  if( payloadSize < idxWidth*(p2+1) ){
++    rc = SQLITE_CORRUPT;
++    goto abort_due_to_error;
++  }
++  if( zRec ){
++    memcpy(aHdr, &zRec[idxWidth*p2], idxWidth*2);
++  }else if( pC->keyAsData ){
++    sqliteBtreeKey(pCrsr, idxWidth*p2, idxWidth*2, (char*)aHdr);
++  }else{
++    sqliteBtreeData(pCrsr, idxWidth*p2, idxWidth*2, (char*)aHdr);
++  }
++  offset = aHdr[0];
++  end = aHdr[idxWidth];
++  if( idxWidth>1 ){
++    offset |= aHdr[1]<<8;
++    end |= aHdr[idxWidth+1]<<8;
++    if( idxWidth>2 ){
++      offset |= aHdr[2]<<16;
++      end |= aHdr[idxWidth+2]<<16;
++    }
++  }
++  amt = end - offset;
++  if( amt<0 || offset<0 || end>payloadSize ){
++    rc = SQLITE_CORRUPT;
++    goto abort_due_to_error;
++  }
++
++  /* amt and offset now hold the offset to the start of data and the
++  ** amount of data.  Go get the data and put it on the stack.
++  */
++  pTos->n = amt;
++  if( amt==0 ){
++    pTos->flags = MEM_Null;
++  }else if( zRec ){
++    pTos->flags = MEM_Str | MEM_Ephem;
++    pTos->z = &zRec[offset];
++  }else{
++    if( amt<=NBFS ){
++      pTos->flags = MEM_Str | MEM_Short;
++      pTos->z = pTos->zShort;
++    }else{
++      char *z = sqliteMallocRaw( amt );
++      if( z==0 ) goto no_mem;
++      pTos->flags = MEM_Str | MEM_Dyn;
++      pTos->z = z;
++    }
++    if( pC->keyAsData ){
++      sqliteBtreeKey(pCrsr, offset, amt, pTos->z);
++    }else{
++      sqliteBtreeData(pCrsr, offset, amt, pTos->z);
++    }
++  }
++  break;
++}
++
++/* Opcode: Recno P1 * *
++**
++** Push onto the stack an integer which is the first 4 bytes of the
++** the key to the current entry in a sequential scan of the database
++** file P1.  The sequential scan should have been started using the 
++** Next opcode.
++*/
++case OP_Recno: {
++  int i = pOp->p1;
++  Cursor *pC;
++  int v;
++
++  assert( i>=0 && i<p->nCursor );
++  pC = &p->aCsr[i];
++  sqliteVdbeCursorMoveto(pC);
++  pTos++;
++  if( pC->recnoIsValid ){
++    v = pC->lastRecno;
++  }else if( pC->pseudoTable ){
++    v = keyToInt(pC->iKey);
++  }else if( pC->nullRow || pC->pCursor==0 ){
++    pTos->flags = MEM_Null;
++    break;
++  }else{
++    assert( pC->pCursor!=0 );
++    sqliteBtreeKey(pC->pCursor, 0, sizeof(u32), (char*)&v);
++    v = keyToInt(v);
++  }
++  pTos->i = v;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: FullKey P1 * *
++**
++** Extract the complete key from the record that cursor P1 is currently
++** pointing to and push the key onto the stack as a string.
++**
++** Compare this opcode to Recno.  The Recno opcode extracts the first
++** 4 bytes of the key and pushes those bytes onto the stack as an
++** integer.  This instruction pushes the entire key as a string.
++**
++** This opcode may not be used on a pseudo-table.
++*/
++case OP_FullKey: {
++  int i = pOp->p1;
++  BtCursor *pCrsr;
++
++  assert( p->aCsr[i].keyAsData );
++  assert( !p->aCsr[i].pseudoTable );
++  assert( i>=0 && i<p->nCursor );
++  pTos++;
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int amt;
++    char *z;
++
++    sqliteVdbeCursorMoveto(&p->aCsr[i]);
++    sqliteBtreeKeySize(pCrsr, &amt);
++    if( amt<=0 ){
++      rc = SQLITE_CORRUPT;
++      goto abort_due_to_error;
++    }
++    if( amt>NBFS ){
++      z = sqliteMallocRaw( amt );
++      if( z==0 ) goto no_mem;
++      pTos->flags = MEM_Str | MEM_Dyn;
++    }else{
++      z = pTos->zShort;
++      pTos->flags = MEM_Str | MEM_Short;
++    }
++    sqliteBtreeKey(pCrsr, 0, amt, z);
++    pTos->z = z;
++    pTos->n = amt;
++  }
++  break;
++}
++
++/* Opcode: NullRow P1 * *
++**
++** Move the cursor P1 to a null row.  Any OP_Column operations
++** that occur while the cursor is on the null row will always push 
++** a NULL onto the stack.
++*/
++case OP_NullRow: {
++  int i = pOp->p1;
++
++  assert( i>=0 && i<p->nCursor );
++  p->aCsr[i].nullRow = 1;
++  p->aCsr[i].recnoIsValid = 0;
++  break;
++}
++
++/* Opcode: Last P1 P2 *
++**
++** The next use of the Recno or Column or Next instruction for P1 
++** will refer to the last entry in the database table or index.
++** If the table or index is empty and P2>0, then jump immediately to P2.
++** If P2 is 0 or if the table or index is not empty, fall through
++** to the following instruction.
++*/
++case OP_Last: {
++  int i = pOp->p1;
++  Cursor *pC;
++  BtCursor *pCrsr;
++
++  assert( i>=0 && i<p->nCursor );
++  pC = &p->aCsr[i];
++  if( (pCrsr = pC->pCursor)!=0 ){
++    int res;
++    rc = sqliteBtreeLast(pCrsr, &res);
++    pC->nullRow = res;
++    pC->deferredMoveto = 0;
++    if( res && pOp->p2>0 ){
++      pc = pOp->p2 - 1;
++    }
++  }else{
++    pC->nullRow = 0;
++  }
++  break;
++}
++
++/* Opcode: Rewind P1 P2 *
++**
++** The next use of the Recno or Column or Next instruction for P1 
++** will refer to the first entry in the database table or index.
++** If the table or index is empty and P2>0, then jump immediately to P2.
++** If P2 is 0 or if the table or index is not empty, fall through
++** to the following instruction.
++*/
++case OP_Rewind: {
++  int i = pOp->p1;
++  Cursor *pC;
++  BtCursor *pCrsr;
++
++  assert( i>=0 && i<p->nCursor );
++  pC = &p->aCsr[i];
++  if( (pCrsr = pC->pCursor)!=0 ){
++    int res;
++    rc = sqliteBtreeFirst(pCrsr, &res);
++    pC->atFirst = res==0;
++    pC->nullRow = res;
++    pC->deferredMoveto = 0;
++    if( res && pOp->p2>0 ){
++      pc = pOp->p2 - 1;
++    }
++  }else{
++    pC->nullRow = 0;
++  }
++  break;
++}
++
++/* Opcode: Next P1 P2 *
++**
++** Advance cursor P1 so that it points to the next key/data pair in its
++** table or index.  If there are no more key/value pairs then fall through
++** to the following instruction.  But if the cursor advance was successful,
++** jump immediately to P2.
++**
++** See also: Prev
++*/
++/* Opcode: Prev P1 P2 *
++**
++** Back up cursor P1 so that it points to the previous key/data pair in its
++** table or index.  If there is no previous key/value pairs then fall through
++** to the following instruction.  But if the cursor backup was successful,
++** jump immediately to P2.
++*/
++case OP_Prev:
++case OP_Next: {
++  Cursor *pC;
++  BtCursor *pCrsr;
++
++  CHECK_FOR_INTERRUPT;
++  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
++  pC = &p->aCsr[pOp->p1];
++  if( (pCrsr = pC->pCursor)!=0 ){
++    int res;
++    if( pC->nullRow ){
++      res = 1;
++    }else{
++      assert( pC->deferredMoveto==0 );
++      rc = pOp->opcode==OP_Next ? sqliteBtreeNext(pCrsr, &res) :
++                                  sqliteBtreePrevious(pCrsr, &res);
++      pC->nullRow = res;
++    }
++    if( res==0 ){
++      pc = pOp->p2 - 1;
++      sqlite_search_count++;
++    }
++  }else{
++    pC->nullRow = 1;
++  }
++  pC->recnoIsValid = 0;
++  break;
++}
++
++/* Opcode: IdxPut P1 P2 P3
++**
++** The top of the stack holds a SQL index key made using the
++** MakeIdxKey instruction.  This opcode writes that key into the
++** index P1.  Data for the entry is nil.
++**
++** If P2==1, then the key must be unique.  If the key is not unique,
++** the program aborts with a SQLITE_CONSTRAINT error and the database
++** is rolled back.  If P3 is not null, then it becomes part of the
++** error message returned with the SQLITE_CONSTRAINT.
++*/
++case OP_IdxPut: {
++  int i = pOp->p1;
++  BtCursor *pCrsr;
++  assert( pTos>=p->aStack );
++  assert( i>=0 && i<p->nCursor );
++  assert( pTos->flags & MEM_Str );
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int nKey = pTos->n;
++    const char *zKey = pTos->z;
++    if( pOp->p2 ){
++      int res, n;
++      assert( nKey >= 4 );
++      rc = sqliteBtreeMoveto(pCrsr, zKey, nKey-4, &res);
++      if( rc!=SQLITE_OK ) goto abort_due_to_error;
++      while( res!=0 ){
++        int c;
++        sqliteBtreeKeySize(pCrsr, &n);
++        if( n==nKey
++           && sqliteBtreeKeyCompare(pCrsr, zKey, nKey-4, 4, &c)==SQLITE_OK
++           && c==0
++        ){
++          rc = SQLITE_CONSTRAINT;
++          if( pOp->p3 && pOp->p3[0] ){
++            sqliteSetString(&p->zErrMsg, pOp->p3, (char*)0);
++          }
++          goto abort_due_to_error;
++        }
++        if( res<0 ){
++          sqliteBtreeNext(pCrsr, &res);
++          res = +1;
++        }else{
++          break;
++        }
++      }
++    }
++    rc = sqliteBtreeInsert(pCrsr, zKey, nKey, "", 0);
++    assert( p->aCsr[i].deferredMoveto==0 );
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: IdxDelete P1 * *
++**
++** The top of the stack is an index key built using the MakeIdxKey opcode.
++** This opcode removes that entry from the index.
++*/
++case OP_IdxDelete: {
++  int i = pOp->p1;
++  BtCursor *pCrsr;
++  assert( pTos>=p->aStack );
++  assert( pTos->flags & MEM_Str );
++  assert( i>=0 && i<p->nCursor );
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int rx, res;
++    rx = sqliteBtreeMoveto(pCrsr, pTos->z, pTos->n, &res);
++    if( rx==SQLITE_OK && res==0 ){
++      rc = sqliteBtreeDelete(pCrsr);
++    }
++    assert( p->aCsr[i].deferredMoveto==0 );
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: IdxRecno P1 * *
++**
++** Push onto the stack an integer which is the last 4 bytes of the
++** the key to the current entry in index P1.  These 4 bytes should
++** be the record number of the table entry to which this index entry
++** points.
++**
++** See also: Recno, MakeIdxKey.
++*/
++case OP_IdxRecno: {
++  int i = pOp->p1;
++  BtCursor *pCrsr;
++
++  assert( i>=0 && i<p->nCursor );
++  pTos++;
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int v;
++    int sz;
++    assert( p->aCsr[i].deferredMoveto==0 );
++    sqliteBtreeKeySize(pCrsr, &sz);
++    if( sz<sizeof(u32) ){
++      pTos->flags = MEM_Null;
++    }else{
++      sqliteBtreeKey(pCrsr, sz - sizeof(u32), sizeof(u32), (char*)&v);
++      v = keyToInt(v);
++      pTos->i = v;
++      pTos->flags = MEM_Int;
++    }
++  }else{
++    pTos->flags = MEM_Null;
++  }
++  break;
++}
++
++/* Opcode: IdxGT P1 P2 *
++**
++** Compare the top of the stack against the key on the index entry that
++** cursor P1 is currently pointing to.  Ignore the last 4 bytes of the
++** index entry.  If the index entry is greater than the top of the stack
++** then jump to P2.  Otherwise fall through to the next instruction.
++** In either case, the stack is popped once.
++*/
++/* Opcode: IdxGE P1 P2 *
++**
++** Compare the top of the stack against the key on the index entry that
++** cursor P1 is currently pointing to.  Ignore the last 4 bytes of the
++** index entry.  If the index entry is greater than or equal to 
++** the top of the stack
++** then jump to P2.  Otherwise fall through to the next instruction.
++** In either case, the stack is popped once.
++*/
++/* Opcode: IdxLT P1 P2 *
++**
++** Compare the top of the stack against the key on the index entry that
++** cursor P1 is currently pointing to.  Ignore the last 4 bytes of the
++** index entry.  If the index entry is less than the top of the stack
++** then jump to P2.  Otherwise fall through to the next instruction.
++** In either case, the stack is popped once.
++*/
++case OP_IdxLT:
++case OP_IdxGT:
++case OP_IdxGE: {
++  int i= pOp->p1;
++  BtCursor *pCrsr;
++
++  assert( i>=0 && i<p->nCursor );
++  assert( pTos>=p->aStack );
++  if( (pCrsr = p->aCsr[i].pCursor)!=0 ){
++    int res, rc;
++ 
++    Stringify(pTos);
++    assert( p->aCsr[i].deferredMoveto==0 );
++    rc = sqliteBtreeKeyCompare(pCrsr, pTos->z, pTos->n, 4, &res);
++    if( rc!=SQLITE_OK ){
++      break;
++    }
++    if( pOp->opcode==OP_IdxLT ){
++      res = -res;
++    }else if( pOp->opcode==OP_IdxGE ){
++      res++;
++    }
++    if( res>0 ){
++      pc = pOp->p2 - 1 ;
++    }
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: IdxIsNull P1 P2 *
++**
++** The top of the stack contains an index entry such as might be generated
++** by the MakeIdxKey opcode.  This routine looks at the first P1 fields of
++** that key.  If any of the first P1 fields are NULL, then a jump is made
++** to address P2.  Otherwise we fall straight through.
++**
++** The index entry is always popped from the stack.
++*/
++case OP_IdxIsNull: {
++  int i = pOp->p1;
++  int k, n;
++  const char *z;
++
++  assert( pTos>=p->aStack );
++  assert( pTos->flags & MEM_Str );
++  z = pTos->z;
++  n = pTos->n;
++  for(k=0; k<n && i>0; i--){
++    if( z[k]=='a' ){
++      pc = pOp->p2-1;
++      break;
++    }
++    while( k<n && z[k] ){ k++; }
++    k++;
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: Destroy P1 P2 *
++**
++** Delete an entire database table or index whose root page in the database
++** file is given by P1.
++**
++** The table being destroyed is in the main database file if P2==0.  If
++** P2==1 then the table to be clear is in the auxiliary database file
++** that is used to store tables create using CREATE TEMPORARY TABLE.
++**
++** See also: Clear
++*/
++case OP_Destroy: {
++  rc = sqliteBtreeDropTable(db->aDb[pOp->p2].pBt, pOp->p1);
++  break;
++}
++
++/* Opcode: Clear P1 P2 *
++**
++** Delete all contents of the database table or index whose root page
++** in the database file is given by P1.  But, unlike Destroy, do not
++** remove the table or index from the database file.
++**
++** The table being clear is in the main database file if P2==0.  If
++** P2==1 then the table to be clear is in the auxiliary database file
++** that is used to store tables create using CREATE TEMPORARY TABLE.
++**
++** See also: Destroy
++*/
++case OP_Clear: {
++  rc = sqliteBtreeClearTable(db->aDb[pOp->p2].pBt, pOp->p1);
++  break;
++}
++
++/* Opcode: CreateTable * P2 P3
++**
++** Allocate a new table in the main database file if P2==0 or in the
++** auxiliary database file if P2==1.  Push the page number
++** for the root page of the new table onto the stack.
++**
++** The root page number is also written to a memory location that P3
++** points to.  This is the mechanism is used to write the root page
++** number into the parser's internal data structures that describe the
++** new table.
++**
++** The difference between a table and an index is this:  A table must
++** have a 4-byte integer key and can have arbitrary data.  An index
++** has an arbitrary key but no data.
++**
++** See also: CreateIndex
++*/
++/* Opcode: CreateIndex * P2 P3
++**
++** Allocate a new index in the main database file if P2==0 or in the
++** auxiliary database file if P2==1.  Push the page number of the
++** root page of the new index onto the stack.
++**
++** See documentation on OP_CreateTable for additional information.
++*/
++case OP_CreateIndex:
++case OP_CreateTable: {
++  int pgno;
++  assert( pOp->p3!=0 && pOp->p3type==P3_POINTER );
++  assert( pOp->p2>=0 && pOp->p2<db->nDb );
++  assert( db->aDb[pOp->p2].pBt!=0 );
++  if( pOp->opcode==OP_CreateTable ){
++    rc = sqliteBtreeCreateTable(db->aDb[pOp->p2].pBt, &pgno);
++  }else{
++    rc = sqliteBtreeCreateIndex(db->aDb[pOp->p2].pBt, &pgno);
++  }
++  pTos++;
++  if( rc==SQLITE_OK ){
++    pTos->i = pgno;
++    pTos->flags = MEM_Int;
++    *(u32*)pOp->p3 = pgno;
++    pOp->p3 = 0;
++  }else{
++    pTos->flags = MEM_Null;
++  }
++  break;
++}
++
++/* Opcode: IntegrityCk P1 P2 *
++**
++** Do an analysis of the currently open database.  Push onto the
++** stack the text of an error message describing any problems.
++** If there are no errors, push a "ok" onto the stack.
++**
++** P1 is the index of a set that contains the root page numbers
++** for all tables and indices in the main database file.  The set
++** is cleared by this opcode.  In other words, after this opcode
++** has executed, the set will be empty.
++**
++** If P2 is not zero, the check is done on the auxiliary database
++** file, not the main database file.
++**
++** This opcode is used for testing purposes only.
++*/
++case OP_IntegrityCk: {
++  int nRoot;
++  int *aRoot;
++  int iSet = pOp->p1;
++  Set *pSet;
++  int j;
++  HashElem *i;
++  char *z;
++
++  assert( iSet>=0 && iSet<p->nSet );
++  pTos++;
++  pSet = &p->aSet[iSet];
++  nRoot = sqliteHashCount(&pSet->hash);
++  aRoot = sqliteMallocRaw( sizeof(int)*(nRoot+1) );
++  if( aRoot==0 ) goto no_mem;
++  for(j=0, i=sqliteHashFirst(&pSet->hash); i; i=sqliteHashNext(i), j++){
++    toInt((char*)sqliteHashKey(i), &aRoot[j]);
++  }
++  aRoot[j] = 0;
++  sqliteHashClear(&pSet->hash);
++  pSet->prev = 0;
++  z = sqliteBtreeIntegrityCheck(db->aDb[pOp->p2].pBt, aRoot, nRoot);
++  if( z==0 || z[0]==0 ){
++    if( z ) sqliteFree(z);
++    pTos->z = "ok";
++    pTos->n = 3;
++    pTos->flags = MEM_Str | MEM_Static;
++  }else{
++    pTos->z = z;
++    pTos->n = strlen(z) + 1;
++    pTos->flags = MEM_Str | MEM_Dyn;
++  }
++  sqliteFree(aRoot);
++  break;
++}
++
++/* Opcode: ListWrite * * *
++**
++** Write the integer on the top of the stack
++** into the temporary storage list.
++*/
++case OP_ListWrite: {
++  Keylist *pKeylist;
++  assert( pTos>=p->aStack );
++  pKeylist = p->pList;
++  if( pKeylist==0 || pKeylist->nUsed>=pKeylist->nKey ){
++    pKeylist = sqliteMallocRaw( sizeof(Keylist)+999*sizeof(pKeylist->aKey[0]) );
++    if( pKeylist==0 ) goto no_mem;
++    pKeylist->nKey = 1000;
++    pKeylist->nRead = 0;
++    pKeylist->nUsed = 0;
++    pKeylist->pNext = p->pList;
++    p->pList = pKeylist;
++  }
++  Integerify(pTos);
++  pKeylist->aKey[pKeylist->nUsed++] = pTos->i;
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: ListRewind * * *
++**
++** Rewind the temporary buffer back to the beginning.
++*/
++case OP_ListRewind: {
++  /* What this opcode codes, really, is reverse the order of the
++  ** linked list of Keylist structures so that they are read out
++  ** in the same order that they were read in. */
++  Keylist *pRev, *pTop;
++  pRev = 0;
++  while( p->pList ){
++    pTop = p->pList;
++    p->pList = pTop->pNext;
++    pTop->pNext = pRev;
++    pRev = pTop;
++  }
++  p->pList = pRev;
++  break;
++}
++
++/* Opcode: ListRead * P2 *
++**
++** Attempt to read an integer from the temporary storage buffer
++** and push it onto the stack.  If the storage buffer is empty, 
++** push nothing but instead jump to P2.
++*/
++case OP_ListRead: {
++  Keylist *pKeylist;
++  CHECK_FOR_INTERRUPT;
++  pKeylist = p->pList;
++  if( pKeylist!=0 ){
++    assert( pKeylist->nRead>=0 );
++    assert( pKeylist->nRead<pKeylist->nUsed );
++    assert( pKeylist->nRead<pKeylist->nKey );
++    pTos++;
++    pTos->i = pKeylist->aKey[pKeylist->nRead++];
++    pTos->flags = MEM_Int;
++    if( pKeylist->nRead>=pKeylist->nUsed ){
++      p->pList = pKeylist->pNext;
++      sqliteFree(pKeylist);
++    }
++  }else{
++    pc = pOp->p2 - 1;
++  }
++  break;
++}
++
++/* Opcode: ListReset * * *
++**
++** Reset the temporary storage buffer so that it holds nothing.
++*/
++case OP_ListReset: {
++  if( p->pList ){
++    sqliteVdbeKeylistFree(p->pList);
++    p->pList = 0;
++  }
++  break;
++}
++
++/* Opcode: ListPush * * * 
++**
++** Save the current Vdbe list such that it can be restored by a ListPop
++** opcode. The list is empty after this is executed.
++*/
++case OP_ListPush: {
++  p->keylistStackDepth++;
++  assert(p->keylistStackDepth > 0);
++  p->keylistStack = sqliteRealloc(p->keylistStack, 
++          sizeof(Keylist *) * p->keylistStackDepth);
++  if( p->keylistStack==0 ) goto no_mem;
++  p->keylistStack[p->keylistStackDepth - 1] = p->pList;
++  p->pList = 0;
++  break;
++}
++
++/* Opcode: ListPop * * * 
++**
++** Restore the Vdbe list to the state it was in when ListPush was last
++** executed.
++*/
++case OP_ListPop: {
++  assert(p->keylistStackDepth > 0);
++  p->keylistStackDepth--;
++  sqliteVdbeKeylistFree(p->pList);
++  p->pList = p->keylistStack[p->keylistStackDepth];
++  p->keylistStack[p->keylistStackDepth] = 0;
++  if( p->keylistStackDepth == 0 ){
++    sqliteFree(p->keylistStack);
++    p->keylistStack = 0;
++  }
++  break;
++}
++
++/* Opcode: ContextPush * * * 
++**
++** Save the current Vdbe context such that it can be restored by a ContextPop
++** opcode. The context stores the last insert row id, the last statement change
++** count, and the current statement change count.
++*/
++case OP_ContextPush: {
++  p->contextStackDepth++;
++  assert(p->contextStackDepth > 0);
++  p->contextStack = sqliteRealloc(p->contextStack, 
++          sizeof(Context) * p->contextStackDepth);
++  if( p->contextStack==0 ) goto no_mem;
++  p->contextStack[p->contextStackDepth - 1].lastRowid = p->db->lastRowid;
++  p->contextStack[p->contextStackDepth - 1].lsChange = p->db->lsChange;
++  p->contextStack[p->contextStackDepth - 1].csChange = p->db->csChange;
++  break;
++}
++
++/* Opcode: ContextPop * * * 
++**
++** Restore the Vdbe context to the state it was in when contextPush was last
++** executed. The context stores the last insert row id, the last statement
++** change count, and the current statement change count.
++*/
++case OP_ContextPop: {
++  assert(p->contextStackDepth > 0);
++  p->contextStackDepth--;
++  p->db->lastRowid = p->contextStack[p->contextStackDepth].lastRowid;
++  p->db->lsChange = p->contextStack[p->contextStackDepth].lsChange;
++  p->db->csChange = p->contextStack[p->contextStackDepth].csChange;
++  if( p->contextStackDepth == 0 ){
++    sqliteFree(p->contextStack);
++    p->contextStack = 0;
++  }
++  break;
++}
++
++/* Opcode: SortPut * * *
++**
++** The TOS is the key and the NOS is the data.  Pop both from the stack
++** and put them on the sorter.  The key and data should have been
++** made using SortMakeKey and SortMakeRec, respectively.
++*/
++case OP_SortPut: {
++  Mem *pNos = &pTos[-1];
++  Sorter *pSorter;
++  assert( pNos>=p->aStack );
++  if( Dynamicify(pTos) || Dynamicify(pNos) ) goto no_mem;
++  pSorter = sqliteMallocRaw( sizeof(Sorter) );
++  if( pSorter==0 ) goto no_mem;
++  pSorter->pNext = p->pSort;
++  p->pSort = pSorter;
++  assert( pTos->flags & MEM_Dyn );
++  pSorter->nKey = pTos->n;
++  pSorter->zKey = pTos->z;
++  assert( pNos->flags & MEM_Dyn );
++  pSorter->nData = pNos->n;
++  pSorter->pData = pNos->z;
++  pTos -= 2;
++  break;
++}
++
++/* Opcode: SortMakeRec P1 * *
++**
++** The top P1 elements are the arguments to a callback.  Form these
++** elements into a single data entry that can be stored on a sorter
++** using SortPut and later fed to a callback using SortCallback.
++*/
++case OP_SortMakeRec: {
++  char *z;
++  char **azArg;
++  int nByte;
++  int nField;
++  int i;
++  Mem *pRec;
++
++  nField = pOp->p1;
++  pRec = &pTos[1-nField];
++  assert( pRec>=p->aStack );
++  nByte = 0;
++  for(i=0; i<nField; i++, pRec++){
++    if( (pRec->flags & MEM_Null)==0 ){
++      Stringify(pRec);
++      nByte += pRec->n;
++    }
++  }
++  nByte += sizeof(char*)*(nField+1);
++  azArg = sqliteMallocRaw( nByte );
++  if( azArg==0 ) goto no_mem;
++  z = (char*)&azArg[nField+1];
++  for(pRec=&pTos[1-nField], i=0; i<nField; i++, pRec++){
++    if( pRec->flags & MEM_Null ){
++      azArg[i] = 0;
++    }else{
++      azArg[i] = z;
++      memcpy(z, pRec->z, pRec->n);
++      z += pRec->n;
++    }
++  }
++  popStack(&pTos, nField);
++  pTos++;
++  pTos->n = nByte;
++  pTos->z = (char*)azArg;
++  pTos->flags = MEM_Str | MEM_Dyn;
++  break;
++}
++
++/* Opcode: SortMakeKey * * P3
++**
++** Convert the top few entries of the stack into a sort key.  The
++** number of stack entries consumed is the number of characters in 
++** the string P3.  One character from P3 is prepended to each entry.
++** The first character of P3 is prepended to the element lowest in
++** the stack and the last character of P3 is prepended to the top of
++** the stack.  All stack entries are separated by a \000 character
++** in the result.  The whole key is terminated by two \000 characters
++** in a row.
++**
++** "N" is substituted in place of the P3 character for NULL values.
++**
++** See also the MakeKey and MakeIdxKey opcodes.
++*/
++case OP_SortMakeKey: {
++  char *zNewKey;
++  int nByte;
++  int nField;
++  int i, j, k;
++  Mem *pRec;
++
++  nField = strlen(pOp->p3);
++  pRec = &pTos[1-nField];
++  nByte = 1;
++  for(i=0; i<nField; i++, pRec++){
++    if( pRec->flags & MEM_Null ){
++      nByte += 2;
++    }else{
++      Stringify(pRec);
++      nByte += pRec->n+2;
++    }
++  }
++  zNewKey = sqliteMallocRaw( nByte );
++  if( zNewKey==0 ) goto no_mem;
++  j = 0;
++  k = 0;
++  for(pRec=&pTos[1-nField], i=0; i<nField; i++, pRec++){
++    if( pRec->flags & MEM_Null ){
++      zNewKey[j++] = 'N';
++      zNewKey[j++] = 0;
++      k++;
++    }else{
++      zNewKey[j++] = pOp->p3[k++];
++      memcpy(&zNewKey[j], pRec->z, pRec->n-1);
++      j += pRec->n-1;
++      zNewKey[j++] = 0;
++    }
++  }
++  zNewKey[j] = 0;
++  assert( j<nByte );
++  popStack(&pTos, nField);
++  pTos++;
++  pTos->n = nByte;
++  pTos->flags = MEM_Str|MEM_Dyn;
++  pTos->z = zNewKey;
++  break;
++}
++
++/* Opcode: Sort * * *
++**
++** Sort all elements on the sorter.  The algorithm is a
++** mergesort.
++*/
++case OP_Sort: {
++  int i;
++  Sorter *pElem;
++  Sorter *apSorter[NSORT];
++  for(i=0; i<NSORT; i++){
++    apSorter[i] = 0;
++  }
++  while( p->pSort ){
++    pElem = p->pSort;
++    p->pSort = pElem->pNext;
++    pElem->pNext = 0;
++    for(i=0; i<NSORT-1; i++){
++    if( apSorter[i]==0 ){
++        apSorter[i] = pElem;
++        break;
++      }else{
++        pElem = Merge(apSorter[i], pElem);
++        apSorter[i] = 0;
++      }
++    }
++    if( i>=NSORT-1 ){
++      apSorter[NSORT-1] = Merge(apSorter[NSORT-1],pElem);
++    }
++  }
++  pElem = 0;
++  for(i=0; i<NSORT; i++){
++    pElem = Merge(apSorter[i], pElem);
++  }
++  p->pSort = pElem;
++  break;
++}
++
++/* Opcode: SortNext * P2 *
++**
++** Push the data for the topmost element in the sorter onto the
++** stack, then remove the element from the sorter.  If the sorter
++** is empty, push nothing on the stack and instead jump immediately 
++** to instruction P2.
++*/
++case OP_SortNext: {
++  Sorter *pSorter = p->pSort;
++  CHECK_FOR_INTERRUPT;
++  if( pSorter!=0 ){
++    p->pSort = pSorter->pNext;
++    pTos++;
++    pTos->z = pSorter->pData;
++    pTos->n = pSorter->nData;
++    pTos->flags = MEM_Str|MEM_Dyn;
++    sqliteFree(pSorter->zKey);
++    sqliteFree(pSorter);
++  }else{
++    pc = pOp->p2 - 1;
++  }
++  break;
++}
++
++/* Opcode: SortCallback P1 * *
++**
++** The top of the stack contains a callback record built using
++** the SortMakeRec operation with the same P1 value as this
++** instruction.  Pop this record from the stack and invoke the
++** callback on it.
++*/
++case OP_SortCallback: {
++  assert( pTos>=p->aStack );
++  assert( pTos->flags & MEM_Str );
++  p->nCallback++;
++  p->pc = pc+1;
++  p->azResColumn = (char**)pTos->z;
++  assert( p->nResColumn==pOp->p1 );
++  p->popStack = 1;
++  p->pTos = pTos;
++  return SQLITE_ROW;
++}
++
++/* Opcode: SortReset * * *
++**
++** Remove any elements that remain on the sorter.
++*/
++case OP_SortReset: {
++  sqliteVdbeSorterReset(p);
++  break;
++}
++
++/* Opcode: FileOpen * * P3
++**
++** Open the file named by P3 for reading using the FileRead opcode.
++** If P3 is "stdin" then open standard input for reading.
++*/
++case OP_FileOpen: {
++  assert( pOp->p3!=0 );
++  if( p->pFile ){
++    if( p->pFile!=stdin ) fclose(p->pFile);
++    p->pFile = 0;
++  }
++  if( sqliteStrICmp(pOp->p3,"stdin")==0 ){
++    p->pFile = stdin;
++  }else{
++    p->pFile = fopen(pOp->p3, "r");
++  }
++  if( p->pFile==0 ){
++    sqliteSetString(&p->zErrMsg,"unable to open file: ", pOp->p3, (char*)0);
++    rc = SQLITE_ERROR;
++  }
++  break;
++}
++
++/* Opcode: FileRead P1 P2 P3
++**
++** Read a single line of input from the open file (the file opened using
++** FileOpen).  If we reach end-of-file, jump immediately to P2.  If
++** we are able to get another line, split the line apart using P3 as
++** a delimiter.  There should be P1 fields.  If the input line contains
++** more than P1 fields, ignore the excess.  If the input line contains
++** fewer than P1 fields, assume the remaining fields contain NULLs.
++**
++** Input ends if a line consists of just "\.".  A field containing only
++** "\N" is a null field.  The backslash \ character can be used be used
++** to escape newlines or the delimiter.
++*/
++case OP_FileRead: {
++  int n, eol, nField, i, c, nDelim;
++  char *zDelim, *z;
++  CHECK_FOR_INTERRUPT;
++  if( p->pFile==0 ) goto fileread_jump;
++  nField = pOp->p1;
++  if( nField<=0 ) goto fileread_jump;
++  if( nField!=p->nField || p->azField==0 ){
++    char **azField = sqliteRealloc(p->azField, sizeof(char*)*nField+1);
++    if( azField==0 ){ goto no_mem; }
++    p->azField = azField;
++    p->nField = nField;
++  }
++  n = 0;
++  eol = 0;
++  while( eol==0 ){
++    if( p->zLine==0 || n+200>p->nLineAlloc ){
++      char *zLine;
++      p->nLineAlloc = p->nLineAlloc*2 + 300;
++      zLine = sqliteRealloc(p->zLine, p->nLineAlloc);
++      if( zLine==0 ){
++        p->nLineAlloc = 0;
++        sqliteFree(p->zLine);
++        p->zLine = 0;
++        goto no_mem;
++      }
++      p->zLine = zLine;
++    }
++    if( vdbe_fgets(&p->zLine[n], p->nLineAlloc-n, p->pFile)==0 ){
++      eol = 1;
++      p->zLine[n] = 0;
++    }else{
++      int c;
++      while( (c = p->zLine[n])!=0 ){
++        if( c=='\\' ){
++          if( p->zLine[n+1]==0 ) break;
++          n += 2;
++        }else if( c=='\n' ){
++          p->zLine[n] = 0;
++          eol = 1;
++          break;
++        }else{
++          n++;
++        }
++      }
++    }
++  }
++  if( n==0 ) goto fileread_jump;
++  z = p->zLine;
++  if( z[0]=='\\' && z[1]=='.' && z[2]==0 ){
++    goto fileread_jump;
++  }
++  zDelim = pOp->p3;
++  if( zDelim==0 ) zDelim = "\t";
++  c = zDelim[0];
++  nDelim = strlen(zDelim);
++  p->azField[0] = z;
++  for(i=1; *z!=0 && i<=nField; i++){
++    int from, to;
++    from = to = 0;
++    if( z[0]=='\\' && z[1]=='N' 
++       && (z[2]==0 || strncmp(&z[2],zDelim,nDelim)==0) ){
++      if( i<=nField ) p->azField[i-1] = 0;
++      z += 2 + nDelim;
++      if( i<nField ) p->azField[i] = z;
++      continue;
++    }
++    while( z[from] ){
++      if( z[from]=='\\' && z[from+1]!=0 ){
++        int tx = z[from+1];
++        switch( tx ){
++          case 'b':  tx = '\b'; break;
++          case 'f':  tx = '\f'; break;
++          case 'n':  tx = '\n'; break;
++          case 'r':  tx = '\r'; break;
++          case 't':  tx = '\t'; break;
++          case 'v':  tx = '\v'; break;
++          default:   break;
++        }
++        z[to++] = tx;
++        from += 2;
++        continue;
++      }
++      if( z[from]==c && strncmp(&z[from],zDelim,nDelim)==0 ) break;
++      z[to++] = z[from++];
++    }
++    if( z[from] ){
++      z[to] = 0;
++      z += from + nDelim;
++      if( i<nField ) p->azField[i] = z;
++    }else{
++      z[to] = 0;
++      z = "";
++    }
++  }
++  while( i<nField ){
++    p->azField[i++] = 0;
++  }
++  break;
++
++  /* If we reach end-of-file, or if anything goes wrong, jump here.
++  ** This code will cause a jump to P2 */
++fileread_jump:
++  pc = pOp->p2 - 1;
++  break;
++}
++
++/* Opcode: FileColumn P1 * *
++**
++** Push onto the stack the P1-th column of the most recently read line
++** from the input file.
++*/
++case OP_FileColumn: {
++  int i = pOp->p1;
++  char *z;
++  assert( i>=0 && i<p->nField );
++  if( p->azField ){
++    z = p->azField[i];
++  }else{
++    z = 0;
++  }
++  pTos++;
++  if( z ){
++    pTos->n = strlen(z) + 1;
++    pTos->z = z;
++    pTos->flags = MEM_Str | MEM_Ephem;
++  }else{
++    pTos->flags = MEM_Null;
++  }
++  break;
++}
++
++/* Opcode: MemStore P1 P2 *
++**
++** Write the top of the stack into memory location P1.
++** P1 should be a small integer since space is allocated
++** for all memory locations between 0 and P1 inclusive.
++**
++** After the data is stored in the memory location, the
++** stack is popped once if P2 is 1.  If P2 is zero, then
++** the original data remains on the stack.
++*/
++case OP_MemStore: {
++  int i = pOp->p1;
++  Mem *pMem;
++  assert( pTos>=p->aStack );
++  if( i>=p->nMem ){
++    int nOld = p->nMem;
++    Mem *aMem;
++    p->nMem = i + 5;
++    aMem = sqliteRealloc(p->aMem, p->nMem*sizeof(p->aMem[0]));
++    if( aMem==0 ) goto no_mem;
++    if( aMem!=p->aMem ){
++      int j;
++      for(j=0; j<nOld; j++){
++        if( aMem[j].flags & MEM_Short ){
++          aMem[j].z = aMem[j].zShort;
++        }
++      }
++    }
++    p->aMem = aMem;
++    if( nOld<p->nMem ){
++      memset(&p->aMem[nOld], 0, sizeof(p->aMem[0])*(p->nMem-nOld));
++    }
++  }
++  Deephemeralize(pTos);
++  pMem = &p->aMem[i];
++  Release(pMem);
++  *pMem = *pTos;
++  if( pMem->flags & MEM_Dyn ){
++    if( pOp->p2 ){
++      pTos->flags = MEM_Null;
++    }else{
++      pMem->z = sqliteMallocRaw( pMem->n );
++      if( pMem->z==0 ) goto no_mem;
++      memcpy(pMem->z, pTos->z, pMem->n);
++    }
++  }else if( pMem->flags & MEM_Short ){
++    pMem->z = pMem->zShort;
++  }
++  if( pOp->p2 ){
++    Release(pTos);
++    pTos--;
++  }
++  break;
++}
++
++/* Opcode: MemLoad P1 * *
++**
++** Push a copy of the value in memory location P1 onto the stack.
++**
++** If the value is a string, then the value pushed is a pointer to
++** the string that is stored in the memory location.  If the memory
++** location is subsequently changed (using OP_MemStore) then the
++** value pushed onto the stack will change too.
++*/
++case OP_MemLoad: {
++  int i = pOp->p1;
++  assert( i>=0 && i<p->nMem );
++  pTos++;
++  memcpy(pTos, &p->aMem[i], sizeof(pTos[0])-NBFS);;
++  if( pTos->flags & MEM_Str ){
++    pTos->flags |= MEM_Ephem;
++    pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short);
++  }
++  break;
++}
++
++/* Opcode: MemIncr P1 P2 *
++**
++** Increment the integer valued memory cell P1 by 1.  If P2 is not zero
++** and the result after the increment is greater than zero, then jump
++** to P2.
++**
++** This instruction throws an error if the memory cell is not initially
++** an integer.
++*/
++case OP_MemIncr: {
++  int i = pOp->p1;
++  Mem *pMem;
++  assert( i>=0 && i<p->nMem );
++  pMem = &p->aMem[i];
++  assert( pMem->flags==MEM_Int );
++  pMem->i++;
++  if( pOp->p2>0 && pMem->i>0 ){
++     pc = pOp->p2 - 1;
++  }
++  break;
++}
++
++/* Opcode: AggReset * P2 *
++**
++** Reset the aggregator so that it no longer contains any data.
++** Future aggregator elements will contain P2 values each.
++*/
++case OP_AggReset: {
++  sqliteVdbeAggReset(&p->agg);
++  p->agg.nMem = pOp->p2;
++  p->agg.apFunc = sqliteMalloc( p->agg.nMem*sizeof(p->agg.apFunc[0]) );
++  if( p->agg.apFunc==0 ) goto no_mem;
++  break;
++}
++
++/* Opcode: AggInit * P2 P3
++**
++** Initialize the function parameters for an aggregate function.
++** The aggregate will operate out of aggregate column P2.
++** P3 is a pointer to the FuncDef structure for the function.
++*/
++case OP_AggInit: {
++  int i = pOp->p2;
++  assert( i>=0 && i<p->agg.nMem );
++  p->agg.apFunc[i] = (FuncDef*)pOp->p3;
++  break;
++}
++
++/* Opcode: AggFunc * P2 P3
++**
++** Execute the step function for an aggregate.  The
++** function has P2 arguments.  P3 is a pointer to the FuncDef
++** structure that specifies the function.
++**
++** The top of the stack must be an integer which is the index of
++** the aggregate column that corresponds to this aggregate function.
++** Ideally, this index would be another parameter, but there are
++** no free parameters left.  The integer is popped from the stack.
++*/
++case OP_AggFunc: {
++  int n = pOp->p2;
++  int i;
++  Mem *pMem, *pRec;
++  char **azArgv = p->zArgv;
++  sqlite_func ctx;
++
++  assert( n>=0 );
++  assert( pTos->flags==MEM_Int );
++  pRec = &pTos[-n];
++  assert( pRec>=p->aStack );
++  for(i=0; i<n; i++, pRec++){
++    if( pRec->flags & MEM_Null ){
++      azArgv[i] = 0;
++    }else{
++      Stringify(pRec);
++      azArgv[i] = pRec->z;
++    }
++  }
++  i = pTos->i;
++  assert( i>=0 && i<p->agg.nMem );
++  ctx.pFunc = (FuncDef*)pOp->p3;
++  pMem = &p->agg.pCurrent->aMem[i];
++  ctx.s.z = pMem->zShort;  /* Space used for small aggregate contexts */
++  ctx.pAgg = pMem->z;
++  ctx.cnt = ++pMem->i;
++  ctx.isError = 0;
++  ctx.isStep = 1;
++  (ctx.pFunc->xStep)(&ctx, n, (const char**)azArgv);
++  pMem->z = ctx.pAgg;
++  pMem->flags = MEM_AggCtx;
++  popStack(&pTos, n+1);
++  if( ctx.isError ){
++    rc = SQLITE_ERROR;
++  }
++  break;
++}
++
++/* Opcode: AggFocus * P2 *
++**
++** Pop the top of the stack and use that as an aggregator key.  If
++** an aggregator with that same key already exists, then make the
++** aggregator the current aggregator and jump to P2.  If no aggregator
++** with the given key exists, create one and make it current but
++** do not jump.
++**
++** The order of aggregator opcodes is important.  The order is:
++** AggReset AggFocus AggNext.  In other words, you must execute
++** AggReset first, then zero or more AggFocus operations, then
++** zero or more AggNext operations.  You must not execute an AggFocus
++** in between an AggNext and an AggReset.
++*/
++case OP_AggFocus: {
++  AggElem *pElem;
++  char *zKey;
++  int nKey;
++
++  assert( pTos>=p->aStack );
++  Stringify(pTos);
++  zKey = pTos->z;
++  nKey = pTos->n;
++  pElem = sqliteHashFind(&p->agg.hash, zKey, nKey);
++  if( pElem ){
++    p->agg.pCurrent = pElem;
++    pc = pOp->p2 - 1;
++  }else{
++    AggInsert(&p->agg, zKey, nKey);
++    if( sqlite_malloc_failed ) goto no_mem;
++  }
++  Release(pTos);
++  pTos--;
++  break; 
++}
++
++/* Opcode: AggSet * P2 *
++**
++** Move the top of the stack into the P2-th field of the current
++** aggregate.  String values are duplicated into new memory.
++*/
++case OP_AggSet: {
++  AggElem *pFocus = AggInFocus(p->agg);
++  Mem *pMem;
++  int i = pOp->p2;
++  assert( pTos>=p->aStack );
++  if( pFocus==0 ) goto no_mem;
++  assert( i>=0 && i<p->agg.nMem );
++  Deephemeralize(pTos);
++  pMem = &pFocus->aMem[i];
++  Release(pMem);
++  *pMem = *pTos;
++  if( pMem->flags & MEM_Dyn ){
++    pTos->flags = MEM_Null;
++  }else if( pMem->flags & MEM_Short ){
++    pMem->z = pMem->zShort;
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: AggGet * P2 *
++**
++** Push a new entry onto the stack which is a copy of the P2-th field
++** of the current aggregate.  Strings are not duplicated so
++** string values will be ephemeral.
++*/
++case OP_AggGet: {
++  AggElem *pFocus = AggInFocus(p->agg);
++  Mem *pMem;
++  int i = pOp->p2;
++  if( pFocus==0 ) goto no_mem;
++  assert( i>=0 && i<p->agg.nMem );
++  pTos++;
++  pMem = &pFocus->aMem[i];
++  *pTos = *pMem;
++  if( pTos->flags & MEM_Str ){
++    pTos->flags &= ~(MEM_Dyn|MEM_Static|MEM_Short);
++    pTos->flags |= MEM_Ephem;
++  }
++  if( pTos->flags & MEM_AggCtx ){
++    Release(pTos);
++    pTos->flags = MEM_Null;
++  }
++  break;
++}
++
++/* Opcode: AggNext * P2 *
++**
++** Make the next aggregate value the current aggregate.  The prior
++** aggregate is deleted.  If all aggregate values have been consumed,
++** jump to P2.
++**
++** The order of aggregator opcodes is important.  The order is:
++** AggReset AggFocus AggNext.  In other words, you must execute
++** AggReset first, then zero or more AggFocus operations, then
++** zero or more AggNext operations.  You must not execute an AggFocus
++** in between an AggNext and an AggReset.
++*/
++case OP_AggNext: {
++  CHECK_FOR_INTERRUPT;
++  if( p->agg.pSearch==0 ){
++    p->agg.pSearch = sqliteHashFirst(&p->agg.hash);
++  }else{
++    p->agg.pSearch = sqliteHashNext(p->agg.pSearch);
++  }
++  if( p->agg.pSearch==0 ){
++    pc = pOp->p2 - 1;
++  } else {
++    int i;
++    sqlite_func ctx;
++    Mem *aMem;
++    p->agg.pCurrent = sqliteHashData(p->agg.pSearch);
++    aMem = p->agg.pCurrent->aMem;
++    for(i=0; i<p->agg.nMem; i++){
++      int freeCtx;
++      if( p->agg.apFunc[i]==0 ) continue;
++      if( p->agg.apFunc[i]->xFinalize==0 ) continue;
++      ctx.s.flags = MEM_Null;
++      ctx.s.z = aMem[i].zShort;
++      ctx.pAgg = (void*)aMem[i].z;
++      freeCtx = aMem[i].z && aMem[i].z!=aMem[i].zShort;
++      ctx.cnt = aMem[i].i;
++      ctx.isStep = 0;
++      ctx.pFunc = p->agg.apFunc[i];
++      (*p->agg.apFunc[i]->xFinalize)(&ctx);
++      if( freeCtx ){
++        sqliteFree( aMem[i].z );
++      }
++      aMem[i] = ctx.s;
++      if( aMem[i].flags & MEM_Short ){
++        aMem[i].z = aMem[i].zShort;
++      }
++    }
++  }
++  break;
++}
++
++/* Opcode: SetInsert P1 * P3
++**
++** If Set P1 does not exist then create it.  Then insert value
++** P3 into that set.  If P3 is NULL, then insert the top of the
++** stack into the set.
++*/
++case OP_SetInsert: {
++  int i = pOp->p1;
++  if( p->nSet<=i ){
++    int k;
++    Set *aSet = sqliteRealloc(p->aSet, (i+1)*sizeof(p->aSet[0]) );
++    if( aSet==0 ) goto no_mem;
++    p->aSet = aSet;
++    for(k=p->nSet; k<=i; k++){
++      sqliteHashInit(&p->aSet[k].hash, SQLITE_HASH_BINARY, 1);
++    }
++    p->nSet = i+1;
++  }
++  if( pOp->p3 ){
++    sqliteHashInsert(&p->aSet[i].hash, pOp->p3, strlen(pOp->p3)+1, p);
++  }else{
++    assert( pTos>=p->aStack );
++    Stringify(pTos);
++    sqliteHashInsert(&p->aSet[i].hash, pTos->z, pTos->n, p);
++    Release(pTos);
++    pTos--;
++  }
++  if( sqlite_malloc_failed ) goto no_mem;
++  break;
++}
++
++/* Opcode: SetFound P1 P2 *
++**
++** Pop the stack once and compare the value popped off with the
++** contents of set P1.  If the element popped exists in set P1,
++** then jump to P2.  Otherwise fall through.
++*/
++case OP_SetFound: {
++  int i = pOp->p1;
++  assert( pTos>=p->aStack );
++  Stringify(pTos);
++  if( i>=0 && i<p->nSet && sqliteHashFind(&p->aSet[i].hash, pTos->z, pTos->n)){
++    pc = pOp->p2 - 1;
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: SetNotFound P1 P2 *
++**
++** Pop the stack once and compare the value popped off with the
++** contents of set P1.  If the element popped does not exists in 
++** set P1, then jump to P2.  Otherwise fall through.
++*/
++case OP_SetNotFound: {
++  int i = pOp->p1;
++  assert( pTos>=p->aStack );
++  Stringify(pTos);
++  if( i<0 || i>=p->nSet ||
++       sqliteHashFind(&p->aSet[i].hash, pTos->z, pTos->n)==0 ){
++    pc = pOp->p2 - 1;
++  }
++  Release(pTos);
++  pTos--;
++  break;
++}
++
++/* Opcode: SetFirst P1 P2 *
++**
++** Read the first element from set P1 and push it onto the stack.  If the
++** set is empty, push nothing and jump immediately to P2.  This opcode is
++** used in combination with OP_SetNext to loop over all elements of a set.
++*/
++/* Opcode: SetNext P1 P2 *
++**
++** Read the next element from set P1 and push it onto the stack.  If there
++** are no more elements in the set, do not do the push and fall through.
++** Otherwise, jump to P2 after pushing the next set element.
++*/
++case OP_SetFirst: 
++case OP_SetNext: {
++  Set *pSet;
++  CHECK_FOR_INTERRUPT;
++  if( pOp->p1<0 || pOp->p1>=p->nSet ){
++    if( pOp->opcode==OP_SetFirst ) pc = pOp->p2 - 1;
++    break;
++  }
++  pSet = &p->aSet[pOp->p1];
++  if( pOp->opcode==OP_SetFirst ){
++    pSet->prev = sqliteHashFirst(&pSet->hash);
++    if( pSet->prev==0 ){
++      pc = pOp->p2 - 1;
++      break;
++    }
++  }else{
++    if( pSet->prev ){
++      pSet->prev = sqliteHashNext(pSet->prev);
++    }
++    if( pSet->prev==0 ){
++      break;
++    }else{
++      pc = pOp->p2 - 1;
++    }
++  }
++  pTos++;
++  pTos->z = sqliteHashKey(pSet->prev);
++  pTos->n = sqliteHashKeysize(pSet->prev);
++  pTos->flags = MEM_Str | MEM_Ephem;
++  break;
++}
++
++/* Opcode: Vacuum * * *
++**
++** Vacuum the entire database.  This opcode will cause other virtual
++** machines to be created and run.  It may not be called from within
++** a transaction.
++*/
++case OP_Vacuum: {
++  if( sqliteSafetyOff(db) ) goto abort_due_to_misuse; 
++  rc = sqliteRunVacuum(&p->zErrMsg, db);
++  if( sqliteSafetyOn(db) ) goto abort_due_to_misuse;
++  break;
++}
++
++/* Opcode: StackDepth * * *
++**
++** Push an integer onto the stack which is the depth of the stack prior
++** to that integer being pushed.
++*/
++case OP_StackDepth: {
++  int depth = (&pTos[1]) - p->aStack;
++  pTos++;
++  pTos->i = depth;
++  pTos->flags = MEM_Int;
++  break;
++}
++
++/* Opcode: StackReset * * *
++**
++** Pop a single integer off of the stack.  Then pop the stack
++** as many times as necessary to get the depth of the stack down
++** to the value of the integer that was popped.
++*/
++case OP_StackReset: {
++  int depth, goal;
++  assert( pTos>=p->aStack );
++  Integerify(pTos);
++  goal = pTos->i;
++  depth = (&pTos[1]) - p->aStack;
++  assert( goal<depth );
++  popStack(&pTos, depth-goal);
++  break;
++}
++
++/* An other opcode is illegal...
++*/
++default: {
++  sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode);
++  sqliteSetString(&p->zErrMsg, "unknown opcode ", zBuf, (char*)0);
++  rc = SQLITE_INTERNAL;
++  break;
++}
++
++/*****************************************************************************
++** The cases of the switch statement above this line should all be indented
++** by 6 spaces.  But the left-most 6 spaces have been removed to improve the
++** readability.  From this point on down, the normal indentation rules are
++** restored.
++*****************************************************************************/
++    }
++
++#ifdef VDBE_PROFILE
++    {
++      long long elapse = hwtime() - start;
++      pOp->cycles += elapse;
++      pOp->cnt++;
++#if 0
++        fprintf(stdout, "%10lld ", elapse);
++        sqliteVdbePrintOp(stdout, origPc, &p->aOp[origPc]);
++#endif
++    }
++#endif
++
++    /* The following code adds nothing to the actual functionality
++    ** of the program.  It is only here for testing and debugging.
++    ** On the other hand, it does burn CPU cycles every time through
++    ** the evaluator loop.  So we can leave it out when NDEBUG is defined.
++    */
++#ifndef NDEBUG
++    /* Sanity checking on the top element of the stack */
++    if( pTos>=p->aStack ){
++      assert( pTos->flags!=0 );  /* Must define some type */
++      if( pTos->flags & MEM_Str ){
++        int x = pTos->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short);
++        assert( x!=0 );            /* Strings must define a string subtype */
++        assert( (x & (x-1))==0 );  /* Only one string subtype can be defined */
++        assert( pTos->z!=0 );      /* Strings must have a value */
++        /* Mem.z points to Mem.zShort iff the subtype is MEM_Short */
++        assert( (pTos->flags & MEM_Short)==0 || pTos->z==pTos->zShort );
++        assert( (pTos->flags & MEM_Short)!=0 || pTos->z!=pTos->zShort );
++      }else{
++        /* Cannot define a string subtype for non-string objects */
++        assert( (pTos->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short))==0 );
++      }
++      /* MEM_Null excludes all other types */
++      assert( pTos->flags==MEM_Null || (pTos->flags&MEM_Null)==0 );
++    }
++    if( pc<-1 || pc>=p->nOp ){
++      sqliteSetString(&p->zErrMsg, "jump destination out of range", (char*)0);
++      rc = SQLITE_INTERNAL;
++    }
++    if( p->trace && pTos>=p->aStack ){
++      int i;
++      fprintf(p->trace, "Stack:");
++      for(i=0; i>-5 && &pTos[i]>=p->aStack; i--){
++        if( pTos[i].flags & MEM_Null ){
++          fprintf(p->trace, " NULL");
++        }else if( (pTos[i].flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
++          fprintf(p->trace, " si:%d", pTos[i].i);
++        }else if( pTos[i].flags & MEM_Int ){
++          fprintf(p->trace, " i:%d", pTos[i].i);
++        }else if( pTos[i].flags & MEM_Real ){
++          fprintf(p->trace, " r:%g", pTos[i].r);
++        }else if( pTos[i].flags & MEM_Str ){
++          int j, k;
++          char zBuf[100];
++          zBuf[0] = ' ';
++          if( pTos[i].flags & MEM_Dyn ){
++            zBuf[1] = 'z';
++            assert( (pTos[i].flags & (MEM_Static|MEM_Ephem))==0 );
++          }else if( pTos[i].flags & MEM_Static ){
++            zBuf[1] = 't';
++            assert( (pTos[i].flags & (MEM_Dyn|MEM_Ephem))==0 );
++          }else if( pTos[i].flags & MEM_Ephem ){
++            zBuf[1] = 'e';
++            assert( (pTos[i].flags & (MEM_Static|MEM_Dyn))==0 );
++          }else{
++            zBuf[1] = 's';
++          }
++          zBuf[2] = '[';
++          k = 3;
++          for(j=0; j<20 && j<pTos[i].n; j++){
++            int c = pTos[i].z[j];
++            if( c==0 && j==pTos[i].n-1 ) break;
++            if( isprint(c) && !isspace(c) ){
++              zBuf[k++] = c;
++            }else{
++              zBuf[k++] = '.';
++            }
++          }
++          zBuf[k++] = ']';
++          zBuf[k++] = 0;
++          fprintf(p->trace, "%s", zBuf);
++        }else{
++          fprintf(p->trace, " ???");
++        }
++      }
++      if( rc!=0 ) fprintf(p->trace," rc=%d",rc);
++      fprintf(p->trace,"\n");
++    }
++#endif
++  }  /* The end of the for(;;) loop the loops through opcodes */
++
++  /* If we reach this point, it means that execution is finished.
++  */
++vdbe_halt:
++  CHECK_FOR_INTERRUPT
++  if( rc ){
++    p->rc = rc;
++    rc = SQLITE_ERROR;
++  }else{
++    rc = SQLITE_DONE;
++  }
++  p->magic = VDBE_MAGIC_HALT;
++  p->pTos = pTos;
++  return rc;
++
++  /* Jump to here if a malloc() fails.  It's hard to get a malloc()
++  ** to fail on a modern VM computer, so this code is untested.
++  */
++no_mem:
++  sqliteSetString(&p->zErrMsg, "out of memory", (char*)0);
++  rc = SQLITE_NOMEM;
++  goto vdbe_halt;
++
++  /* Jump to here for an SQLITE_MISUSE error.
++  */
++abort_due_to_misuse:
++  rc = SQLITE_MISUSE;
++  /* Fall thru into abort_due_to_error */
++
++  /* Jump to here for any other kind of fatal error.  The "rc" variable
++  ** should hold the error number.
++  */
++abort_due_to_error:
++  if( p->zErrMsg==0 ){
++    if( sqlite_malloc_failed ) rc = SQLITE_NOMEM;
++    sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
++  }
++  goto vdbe_halt;
++
++  /* Jump to here if the sqlite_interrupt() API sets the interrupt
++  ** flag.
++  */
++abort_due_to_interrupt:
++  assert( db->flags & SQLITE_Interrupt );
++  db->flags &= ~SQLITE_Interrupt;
++  if( db->magic!=SQLITE_MAGIC_BUSY ){
++    rc = SQLITE_MISUSE;
++  }else{
++    rc = SQLITE_INTERRUPT;
++  }
++  sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
++  goto vdbe_halt;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/vdbe.h
+@@ -0,0 +1,112 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** Header file for the Virtual DataBase Engine (VDBE)
++**
++** This header defines the interface to the virtual database engine
++** or VDBE.  The VDBE implements an abstract machine that runs a
++** simple program to access and modify the underlying database.
++**
++** $Id$
++*/
++#ifndef _SQLITE_VDBE_H_
++#define _SQLITE_VDBE_H_
++#include <stdio.h>
++
++/*
++** A single VDBE is an opaque structure named "Vdbe".  Only routines
++** in the source file sqliteVdbe.c are allowed to see the insides
++** of this structure.
++*/
++typedef struct Vdbe Vdbe;
++
++/*
++** A single instruction of the virtual machine has an opcode
++** and as many as three operands.  The instruction is recorded
++** as an instance of the following structure:
++*/
++struct VdbeOp {
++  u8 opcode;          /* What operation to perform */
++  int p1;             /* First operand */
++  int p2;             /* Second parameter (often the jump destination) */
++  char *p3;           /* Third parameter */
++  int p3type;         /* P3_STATIC, P3_DYNAMIC or P3_POINTER */
++#ifdef VDBE_PROFILE
++  int cnt;            /* Number of times this instruction was executed */
++  long long cycles;   /* Total time spend executing this instruction */
++#endif
++};
++typedef struct VdbeOp VdbeOp;
++
++/*
++** A smaller version of VdbeOp used for the VdbeAddOpList() function because
++** it takes up less space.
++*/
++struct VdbeOpList {
++  u8 opcode;          /* What operation to perform */
++  signed char p1;     /* First operand */
++  short int p2;       /* Second parameter (often the jump destination) */
++  char *p3;           /* Third parameter */
++};
++typedef struct VdbeOpList VdbeOpList;
++
++/*
++** Allowed values of VdbeOp.p3type
++*/
++#define P3_NOTUSED    0   /* The P3 parameter is not used */
++#define P3_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */
++#define P3_STATIC   (-2)  /* Pointer to a static string */
++#define P3_POINTER  (-3)  /* P3 is a pointer to some structure or object */
++
++/*
++** The following macro converts a relative address in the p2 field
++** of a VdbeOp structure into a negative number so that 
++** sqliteVdbeAddOpList() knows that the address is relative.  Calling
++** the macro again restores the address.
++*/
++#define ADDR(X)  (-1-(X))
++
++/*
++** The makefile scans the vdbe.c source file and creates the "opcodes.h"
++** header file that defines a number for each opcode used by the VDBE.
++*/
++#include "opcodes.h"
++
++/*
++** Prototypes for the VDBE interface.  See comments on the implementation
++** for a description of what each of these routines does.
++*/
++Vdbe *sqliteVdbeCreate(sqlite*);
++void sqliteVdbeCreateCallback(Vdbe*, int*);
++int sqliteVdbeAddOp(Vdbe*,int,int,int);
++int sqliteVdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
++int sqliteVdbeCode(Vdbe*,...);
++int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
++void sqliteVdbeChangeP1(Vdbe*, int addr, int P1);
++void sqliteVdbeChangeP2(Vdbe*, int addr, int P2);
++void sqliteVdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
++void sqliteVdbeDequoteP3(Vdbe*, int addr);
++int sqliteVdbeFindOp(Vdbe*, int, int);
++VdbeOp *sqliteVdbeGetOp(Vdbe*, int);
++int sqliteVdbeMakeLabel(Vdbe*);
++void sqliteVdbeDelete(Vdbe*);
++void sqliteVdbeMakeReady(Vdbe*,int,int);
++int sqliteVdbeExec(Vdbe*);
++int sqliteVdbeList(Vdbe*);
++int sqliteVdbeFinalize(Vdbe*,char**);
++void sqliteVdbeResolveLabel(Vdbe*, int);
++int sqliteVdbeCurrentAddr(Vdbe*);
++void sqliteVdbeTrace(Vdbe*,FILE*);
++void sqliteVdbeCompressSpace(Vdbe*,int);
++int sqliteVdbeReset(Vdbe*,char **);
++int sqliteVdbeSetVariables(Vdbe*,int,const char**);
++
++#endif
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/vdbeInt.h
+@@ -0,0 +1,303 @@
++/*
++** 2003 September 6
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This is the header file for information that is private to the
++** VDBE.  This information used to all be at the top of the single
++** source code file "vdbe.c".  When that file became too big (over
++** 6000 lines long) it was split up into several smaller files and
++** this header information was factored out.
++*/
++
++/*
++** When converting from the native format to the key format and back
++** again, in addition to changing the byte order we invert the high-order
++** bit of the most significant byte.  This causes negative numbers to
++** sort before positive numbers in the memcmp() function.
++*/
++#define keyToInt(X)   (sqliteVdbeByteSwap(X) ^ 0x80000000)
++#define intToKey(X)   (sqliteVdbeByteSwap((X) ^ 0x80000000))
++
++/*
++** The makefile scans this source file and creates the following
++** array of string constants which are the names of all VDBE opcodes.
++** This array is defined in a separate source code file named opcode.c
++** which is automatically generated by the makefile.
++*/
++extern char *sqliteOpcodeNames[];
++
++/*
++** SQL is translated into a sequence of instructions to be
++** executed by a virtual machine.  Each instruction is an instance
++** of the following structure.
++*/
++typedef struct VdbeOp Op;
++
++/*
++** Boolean values
++*/
++typedef unsigned char Bool;
++
++/*
++** A cursor is a pointer into a single BTree within a database file.
++** The cursor can seek to a BTree entry with a particular key, or
++** loop over all entries of the Btree.  You can also insert new BTree
++** entries or retrieve the key or data from the entry that the cursor
++** is currently pointing to.
++** 
++** Every cursor that the virtual machine has open is represented by an
++** instance of the following structure.
++**
++** If the Cursor.isTriggerRow flag is set it means that this cursor is
++** really a single row that represents the NEW or OLD pseudo-table of
++** a row trigger.  The data for the row is stored in Cursor.pData and
++** the rowid is in Cursor.iKey.
++*/
++struct Cursor {
++  BtCursor *pCursor;    /* The cursor structure of the backend */
++  int lastRecno;        /* Last recno from a Next or NextIdx operation */
++  int nextRowid;        /* Next rowid returned by OP_NewRowid */
++  Bool recnoIsValid;    /* True if lastRecno is valid */
++  Bool keyAsData;       /* The OP_Column command works on key instead of data */
++  Bool atFirst;         /* True if pointing to first entry */
++  Bool useRandomRowid;  /* Generate new record numbers semi-randomly */
++  Bool nullRow;         /* True if pointing to a row with no data */
++  Bool nextRowidValid;  /* True if the nextRowid field is valid */
++  Bool pseudoTable;     /* This is a NEW or OLD pseudo-tables of a trigger */
++  Bool deferredMoveto;  /* A call to sqliteBtreeMoveto() is needed */
++  int movetoTarget;     /* Argument to the deferred sqliteBtreeMoveto() */
++  Btree *pBt;           /* Separate file holding temporary table */
++  int nData;            /* Number of bytes in pData */
++  char *pData;          /* Data for a NEW or OLD pseudo-table */
++  int iKey;             /* Key for the NEW or OLD pseudo-table row */
++};
++typedef struct Cursor Cursor;
++
++/*
++** A sorter builds a list of elements to be sorted.  Each element of
++** the list is an instance of the following structure.
++*/
++typedef struct Sorter Sorter;
++struct Sorter {
++  int nKey;           /* Number of bytes in the key */
++  char *zKey;         /* The key by which we will sort */
++  int nData;          /* Number of bytes in the data */
++  char *pData;        /* The data associated with this key */
++  Sorter *pNext;      /* Next in the list */
++};
++
++/* 
++** Number of buckets used for merge-sort.  
++*/
++#define NSORT 30
++
++/*
++** Number of bytes of string storage space available to each stack
++** layer without having to malloc.  NBFS is short for Number of Bytes
++** For Strings.
++*/
++#define NBFS 32
++
++/*
++** A single level of the stack or a single memory cell
++** is an instance of the following structure. 
++*/
++struct Mem {
++  int i;              /* Integer value */
++  int n;              /* Number of characters in string value, including '\0' */
++  int flags;          /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
++  double r;           /* Real value */
++  char *z;            /* String value */
++  char zShort[NBFS];  /* Space for short strings */
++};
++typedef struct Mem Mem;
++
++/*
++** Allowed values for Mem.flags
++*/
++#define MEM_Null      0x0001   /* Value is NULL */
++#define MEM_Str       0x0002   /* Value is a string */
++#define MEM_Int       0x0004   /* Value is an integer */
++#define MEM_Real      0x0008   /* Value is a real number */
++#define MEM_Dyn       0x0010   /* Need to call sqliteFree() on Mem.z */
++#define MEM_Static    0x0020   /* Mem.z points to a static string */
++#define MEM_Ephem     0x0040   /* Mem.z points to an ephemeral string */
++#define MEM_Short     0x0080   /* Mem.z points to Mem.zShort */
++
++/* The following MEM_ value appears only in AggElem.aMem.s.flag fields.
++** It indicates that the corresponding AggElem.aMem.z points to a
++** aggregate function context that needs to be finalized.
++*/
++#define MEM_AggCtx    0x0100   /* Mem.z points to an agg function context */
++
++/*
++** The "context" argument for a installable function.  A pointer to an
++** instance of this structure is the first argument to the routines used
++** implement the SQL functions.
++**
++** There is a typedef for this structure in sqlite.h.  So all routines,
++** even the public interface to SQLite, can use a pointer to this structure.
++** But this file is the only place where the internal details of this
++** structure are known.
++**
++** This structure is defined inside of vdbe.c because it uses substructures
++** (Mem) which are only defined there.
++*/
++struct sqlite_func {
++  FuncDef *pFunc;   /* Pointer to function information.  MUST BE FIRST */
++  Mem s;            /* The return value is stored here */
++  void *pAgg;       /* Aggregate context */
++  u8 isError;       /* Set to true for an error */
++  u8 isStep;        /* Current in the step function */
++  int cnt;          /* Number of times that the step function has been called */
++};
++
++/*
++** An Agg structure describes an Aggregator.  Each Agg consists of
++** zero or more Aggregator elements (AggElem).  Each AggElem contains
++** a key and one or more values.  The values are used in processing
++** aggregate functions in a SELECT.  The key is used to implement
++** the GROUP BY clause of a select.
++*/
++typedef struct Agg Agg;
++typedef struct AggElem AggElem;
++struct Agg {
++  int nMem;            /* Number of values stored in each AggElem */
++  AggElem *pCurrent;   /* The AggElem currently in focus */
++  HashElem *pSearch;   /* The hash element for pCurrent */
++  Hash hash;           /* Hash table of all aggregate elements */
++  FuncDef **apFunc;    /* Information about aggregate functions */
++};
++struct AggElem {
++  char *zKey;          /* The key to this AggElem */
++  int nKey;            /* Number of bytes in the key, including '\0' at end */
++  Mem aMem[1];         /* The values for this AggElem */
++};
++
++/*
++** A Set structure is used for quick testing to see if a value
++** is part of a small set.  Sets are used to implement code like
++** this:
++**            x.y IN ('hi','hoo','hum')
++*/
++typedef struct Set Set;
++struct Set {
++  Hash hash;             /* A set is just a hash table */
++  HashElem *prev;        /* Previously accessed hash elemen */
++};
++
++/*
++** A Keylist is a bunch of keys into a table.  The keylist can
++** grow without bound.  The keylist stores the ROWIDs of database
++** records that need to be deleted or updated.
++*/
++typedef struct Keylist Keylist;
++struct Keylist {
++  int nKey;         /* Number of slots in aKey[] */
++  int nUsed;        /* Next unwritten slot in aKey[] */
++  int nRead;        /* Next unread slot in aKey[] */
++  Keylist *pNext;   /* Next block of keys */
++  int aKey[1];      /* One or more keys.  Extra space allocated as needed */
++};
++
++/*
++** A Context stores the last insert rowid, the last statement change count,
++** and the current statement change count (i.e. changes since last statement).
++** Elements of Context structure type make up the ContextStack, which is
++** updated by the ContextPush and ContextPop opcodes (used by triggers)
++*/
++typedef struct Context Context;
++struct Context {
++  int lastRowid;    /* Last insert rowid (from db->lastRowid) */
++  int lsChange;     /* Last statement change count (from db->lsChange) */
++  int csChange;     /* Current statement change count (from db->csChange) */
++};
++
++/*
++** An instance of the virtual machine.  This structure contains the complete
++** state of the virtual machine.
++**
++** The "sqlite_vm" structure pointer that is returned by sqlite_compile()
++** is really a pointer to an instance of this structure.
++*/
++struct Vdbe {
++  sqlite *db;         /* The whole database */
++  Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
++  FILE *trace;        /* Write an execution trace here, if not NULL */
++  int nOp;            /* Number of instructions in the program */
++  int nOpAlloc;       /* Number of slots allocated for aOp[] */
++  Op *aOp;            /* Space to hold the virtual machine's program */
++  int nLabel;         /* Number of labels used */
++  int nLabelAlloc;    /* Number of slots allocated in aLabel[] */
++  int *aLabel;        /* Space to hold the labels */
++  Mem *aStack;        /* The operand stack, except string values */
++  Mem *pTos;          /* Top entry in the operand stack */
++  char **zArgv;       /* Text values used by the callback */
++  char **azColName;   /* Becomes the 4th parameter to callbacks */
++  int nCursor;        /* Number of slots in aCsr[] */
++  Cursor *aCsr;       /* One element of this array for each open cursor */
++  Sorter *pSort;      /* A linked list of objects to be sorted */
++  FILE *pFile;        /* At most one open file handler */
++  int nField;         /* Number of file fields */
++  char **azField;     /* Data for each file field */
++  int nVar;           /* Number of entries in azVariable[] */
++  char **azVar;       /* Values for the OP_Variable opcode */
++  int *anVar;         /* Length of each value in azVariable[] */
++  u8 *abVar;          /* TRUE if azVariable[i] needs to be sqliteFree()ed */
++  char *zLine;            /* A single line from the input file */
++  int nLineAlloc;         /* Number of spaces allocated for zLine */
++  int magic;              /* Magic number for sanity checking */
++  int nMem;               /* Number of memory locations currently allocated */
++  Mem *aMem;              /* The memory locations */
++  Agg agg;                /* Aggregate information */
++  int nSet;               /* Number of sets allocated */
++  Set *aSet;              /* An array of sets */
++  int nCallback;          /* Number of callbacks invoked so far */
++  Keylist *pList;         /* A list of ROWIDs */
++  int keylistStackDepth;  /* The size of the "keylist" stack */
++  Keylist **keylistStack; /* The stack used by opcodes ListPush & ListPop */
++  int contextStackDepth;  /* The size of the "context" stack */
++  Context *contextStack;  /* Stack used by opcodes ContextPush & ContextPop*/
++  int pc;                 /* The program counter */
++  int rc;                 /* Value to return */
++  unsigned uniqueCnt;     /* Used by OP_MakeRecord when P2!=0 */
++  int errorAction;        /* Recovery action to do in case of an error */
++  int undoTransOnError;   /* If error, either ROLLBACK or COMMIT */
++  int inTempTrans;        /* True if temp database is transactioned */
++  int returnStack[100];   /* Return address stack for OP_Gosub & OP_Return */
++  int returnDepth;        /* Next unused element in returnStack[] */
++  int nResColumn;         /* Number of columns in one row of the result set */
++  char **azResColumn;     /* Values for one row of result */ 
++  int popStack;           /* Pop the stack this much on entry to VdbeExec() */
++  char *zErrMsg;          /* Error message written here */
++  u8 explain;             /* True if EXPLAIN present on SQL command */
++};
++
++/*
++** The following are allowed values for Vdbe.magic
++*/
++#define VDBE_MAGIC_INIT     0x26bceaa5    /* Building a VDBE program */
++#define VDBE_MAGIC_RUN      0xbdf20da3    /* VDBE is ready to execute */
++#define VDBE_MAGIC_HALT     0x519c2973    /* VDBE has completed execution */
++#define VDBE_MAGIC_DEAD     0xb606c3c8    /* The VDBE has been deallocated */
++
++/*
++** Function prototypes
++*/
++void sqliteVdbeCleanupCursor(Cursor*);
++void sqliteVdbeSorterReset(Vdbe*);
++void sqliteVdbeAggReset(Agg*);
++void sqliteVdbeKeylistFree(Keylist*);
++void sqliteVdbePopStack(Vdbe*,int);
++int sqliteVdbeCursorMoveto(Cursor*);
++int sqliteVdbeByteSwap(int);
++#if !defined(NDEBUG) || defined(VDBE_PROFILE)
++void sqliteVdbePrintOp(FILE*, int, Op*);
++#endif
+--- /dev/null
++++ b/ext/sqlite/libsqlite/src/where.c
+@@ -0,0 +1,1235 @@
++/*
++** 2001 September 15
++**
++** The author disclaims copyright to this source code.  In place of
++** a legal notice, here is a blessing:
++**
++**    May you do good and not evil.
++**    May you find forgiveness for yourself and forgive others.
++**    May you share freely, never taking more than you give.
++**
++*************************************************************************
++** This module contains C code that generates VDBE code used to process
++** the WHERE clause of SQL statements.
++**
++** $Id$
++*/
++#include "sqliteInt.h"
++
++/*
++** The query generator uses an array of instances of this structure to
++** help it analyze the subexpressions of the WHERE clause.  Each WHERE
++** clause subexpression is separated from the others by an AND operator.
++*/
++typedef struct ExprInfo ExprInfo;
++struct ExprInfo {
++  Expr *p;                /* Pointer to the subexpression */
++  u8 indexable;           /* True if this subexprssion is usable by an index */
++  short int idxLeft;      /* p->pLeft is a column in this table number. -1 if
++                          ** p->pLeft is not the column of any table */
++  short int idxRight;     /* p->pRight is a column in this table number. -1 if
++                          ** p->pRight is not the column of any table */
++  unsigned prereqLeft;    /* Bitmask of tables referenced by p->pLeft */
++  unsigned prereqRight;   /* Bitmask of tables referenced by p->pRight */
++  unsigned prereqAll;     /* Bitmask of tables referenced by p */
++};
++
++/*
++** An instance of the following structure keeps track of a mapping
++** between VDBE cursor numbers and bitmasks.  The VDBE cursor numbers
++** are small integers contained in SrcList_item.iCursor and Expr.iTable
++** fields.  For any given WHERE clause, we want to track which cursors
++** are being used, so we assign a single bit in a 32-bit word to track
++** that cursor.  Then a 32-bit integer is able to show the set of all
++** cursors being used.
++*/
++typedef struct ExprMaskSet ExprMaskSet;
++struct ExprMaskSet {
++  int n;          /* Number of assigned cursor values */
++  int ix[31];     /* Cursor assigned to each bit */
++};
++
++/*
++** Determine the number of elements in an array.
++*/
++#define ARRAYSIZE(X)  (sizeof(X)/sizeof(X[0]))
++
++/*
++** This routine is used to divide the WHERE expression into subexpressions
++** separated by the AND operator.
++**
++** aSlot[] is an array of subexpressions structures.
++** There are nSlot spaces left in this array.  This routine attempts to
++** split pExpr into subexpressions and fills aSlot[] with those subexpressions.
++** The return value is the number of slots filled.
++*/
++static int exprSplit(int nSlot, ExprInfo *aSlot, Expr *pExpr){
++  int cnt = 0;
++  if( pExpr==0 || nSlot<1 ) return 0;
++  if( nSlot==1 || pExpr->op!=TK_AND ){
++    aSlot[0].p = pExpr;
++    return 1;
++  }
++  if( pExpr->pLeft->op!=TK_AND ){
++    aSlot[0].p = pExpr->pLeft;
++    cnt = 1 + exprSplit(nSlot-1, &aSlot[1], pExpr->pRight);
++  }else{
++    cnt = exprSplit(nSlot, aSlot, pExpr->pLeft);
++    cnt += exprSplit(nSlot-cnt, &aSlot[cnt], pExpr->pRight);
++  }
++  return cnt;
++}
++
++/*
++** Initialize an expression mask set
++*/
++#define initMaskSet(P)  memset(P, 0, sizeof(*P))
++
++/*
++** Return the bitmask for the given cursor.  Assign a new bitmask
++** if this is the first time the cursor has been seen.
++*/
++static int getMask(ExprMaskSet *pMaskSet, int iCursor){
++  int i;
++  for(i=0; i<pMaskSet->n; i++){
++    if( pMaskSet->ix[i]==iCursor ) return 1<<i;
++  }
++  if( i==pMaskSet->n && i<ARRAYSIZE(pMaskSet->ix) ){
++    pMaskSet->n++;
++    pMaskSet->ix[i] = iCursor;
++    return 1<<i;
++  }
++  return 0;
++}
++
++/*
++** Destroy an expression mask set
++*/
++#define freeMaskSet(P)   /* NO-OP */
++
++/*
++** This routine walks (recursively) an expression tree and generates
++** a bitmask indicating which tables are used in that expression
++** tree.
++**
++** In order for this routine to work, the calling function must have
++** previously invoked sqliteExprResolveIds() on the expression.  See
++** the header comment on that routine for additional information.
++** The sqliteExprResolveIds() routines looks for column names and
++** sets their opcodes to TK_COLUMN and their Expr.iTable fields to
++** the VDBE cursor number of the table.
++*/
++static int exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){
++  unsigned int mask = 0;
++  if( p==0 ) return 0;
++  if( p->op==TK_COLUMN ){
++    mask = getMask(pMaskSet, p->iTable);
++    if( mask==0 ) mask = -1;
++    return mask;
++  }
++  if( p->pRight ){
++    mask = exprTableUsage(pMaskSet, p->pRight);
++  }
++  if( p->pLeft ){
++    mask |= exprTableUsage(pMaskSet, p->pLeft);
++  }
++  if( p->pList ){
++    int i;
++    for(i=0; i<p->pList->nExpr; i++){
++      mask |= exprTableUsage(pMaskSet, p->pList->a[i].pExpr);
++    }
++  }
++  return mask;
++}
++
++/*
++** Return TRUE if the given operator is one of the operators that is
++** allowed for an indexable WHERE clause.  The allowed operators are
++** "=", "<", ">", "<=", ">=", and "IN".
++*/
++static int allowedOp(int op){
++  switch( op ){
++    case TK_LT:
++    case TK_LE:
++    case TK_GT:
++    case TK_GE:
++    case TK_EQ:
++    case TK_IN:
++      return 1;
++    default:
++      return 0;
++  }
++}
++
++/*
++** The input to this routine is an ExprInfo structure with only the
++** "p" field filled in.  The job of this routine is to analyze the
++** subexpression and populate all the other fields of the ExprInfo
++** structure.
++*/
++static void exprAnalyze(ExprMaskSet *pMaskSet, ExprInfo *pInfo){
++  Expr *pExpr = pInfo->p;
++  pInfo->prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft);
++  pInfo->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight);
++  pInfo->prereqAll = exprTableUsage(pMaskSet, pExpr);
++  pInfo->indexable = 0;
++  pInfo->idxLeft = -1;
++  pInfo->idxRight = -1;
++  if( allowedOp(pExpr->op) && (pInfo->prereqRight & pInfo->prereqLeft)==0 ){
++    if( pExpr->pRight && pExpr->pRight->op==TK_COLUMN ){
++      pInfo->idxRight = pExpr->pRight->iTable;
++      pInfo->indexable = 1;
++    }
++    if( pExpr->pLeft->op==TK_COLUMN ){
++      pInfo->idxLeft = pExpr->pLeft->iTable;
++      pInfo->indexable = 1;
++    }
++  }
++}
++
++/*
++** pOrderBy is an ORDER BY clause from a SELECT statement.  pTab is the
++** left-most table in the FROM clause of that same SELECT statement and
++** the table has a cursor number of "base".
++**
++** This routine attempts to find an index for pTab that generates the
++** correct record sequence for the given ORDER BY clause.  The return value
++** is a pointer to an index that does the job.  NULL is returned if the
++** table has no index that will generate the correct sort order.
++**
++** If there are two or more indices that generate the correct sort order
++** and pPreferredIdx is one of those indices, then return pPreferredIdx.
++**
++** nEqCol is the number of columns of pPreferredIdx that are used as
++** equality constraints.  Any index returned must have exactly this same
++** set of columns.  The ORDER BY clause only matches index columns beyond the
++** the first nEqCol columns.
++**
++** All terms of the ORDER BY clause must be either ASC or DESC.  The
++** *pbRev value is set to 1 if the ORDER BY clause is all DESC and it is
++** set to 0 if the ORDER BY clause is all ASC.
++*/
++static Index *findSortingIndex(
++  Table *pTab,            /* The table to be sorted */
++  int base,               /* Cursor number for pTab */
++  ExprList *pOrderBy,     /* The ORDER BY clause */
++  Index *pPreferredIdx,   /* Use this index, if possible and not NULL */
++  int nEqCol,             /* Number of index columns used with == constraints */
++  int *pbRev              /* Set to 1 if ORDER BY is DESC */
++){
++  int i, j;
++  Index *pMatch;
++  Index *pIdx;
++  int sortOrder;
++
++  assert( pOrderBy!=0 );
++  assert( pOrderBy->nExpr>0 );
++  sortOrder = pOrderBy->a[0].sortOrder & SQLITE_SO_DIRMASK;
++  for(i=0; i<pOrderBy->nExpr; i++){
++    Expr *p;
++    if( (pOrderBy->a[i].sortOrder & SQLITE_SO_DIRMASK)!=sortOrder ){
++      /* Indices can only be used if all ORDER BY terms are either
++      ** DESC or ASC.  Indices cannot be used on a mixture. */
++      return 0;
++    }
++    if( (pOrderBy->a[i].sortOrder & SQLITE_SO_TYPEMASK)!=SQLITE_SO_UNK ){
++      /* Do not sort by index if there is a COLLATE clause */
++      return 0;
++    }
++    p = pOrderBy->a[i].pExpr;
++    if( p->op!=TK_COLUMN || p->iTable!=base ){
++      /* Can not use an index sort on anything that is not a column in the
++      ** left-most table of the FROM clause */
++      return 0;
++    }
++  }
++  
++  /* If we get this far, it means the ORDER BY clause consists only of
++  ** ascending columns in the left-most table of the FROM clause.  Now
++  ** check for a matching index.
++  */
++  pMatch = 0;
++  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
++    int nExpr = pOrderBy->nExpr;
++    if( pIdx->nColumn < nEqCol || pIdx->nColumn < nExpr ) continue;
++    for(i=j=0; i<nEqCol; i++){
++      if( pPreferredIdx->aiColumn[i]!=pIdx->aiColumn[i] ) break;
++      if( j<nExpr && pOrderBy->a[j].pExpr->iColumn==pIdx->aiColumn[i] ){ j++; }
++    }
++    if( i<nEqCol ) continue;
++    for(i=0; i+j<nExpr; i++){
++      if( pOrderBy->a[i+j].pExpr->iColumn!=pIdx->aiColumn[i+nEqCol] ) break;
++    }
++    if( i+j>=nExpr ){
++      pMatch = pIdx;
++      if( pIdx==pPreferredIdx ) break;
++    }
++  }
++  if( pMatch && pbRev ){
++    *pbRev = sortOrder==SQLITE_SO_DESC;
++  }
++  return pMatch;
++}
++
++/*
++** Disable a term in the WHERE clause.  Except, do not disable the term
++** if it controls a LEFT OUTER JOIN and it did not originate in the ON
++** or USING clause of that join.
++**
++** Consider the term t2.z='ok' in the following queries:
++**
++**   (1)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'
++**   (2)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'
++**   (3)  SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
++**
++** The t2.z='ok' is disabled in the in (2) because it did not originate
++** in the ON clause.  The term is disabled in (3) because it is not part
++** of a LEFT OUTER JOIN.  In (1), the term is not disabled.
++**
++** Disabling a term causes that term to not be tested in the inner loop
++** of the join.  Disabling is an optimization.  We would get the correct
++** results if nothing were ever disabled, but joins might run a little
++** slower.  The trick is to disable as much as we can without disabling
++** too much.  If we disabled in (1), we'd get the wrong answer.
++** See ticket #813.
++*/
++static void disableTerm(WhereLevel *pLevel, Expr **ppExpr){
++  Expr *pExpr = *ppExpr;
++  if( pLevel->iLeftJoin==0 || ExprHasProperty(pExpr, EP_FromJoin) ){
++    *ppExpr = 0;
++  }
++}
++
++/*
++** Generate the beginning of the loop used for WHERE clause processing.
++** The return value is a pointer to an (opaque) structure that contains
++** information needed to terminate the loop.  Later, the calling routine
++** should invoke sqliteWhereEnd() with the return value of this function
++** in order to complete the WHERE clause processing.
++**
++** If an error occurs, this routine returns NULL.
++**
++** The basic idea is to do a nested loop, one loop for each table in
++** the FROM clause of a select.  (INSERT and UPDATE statements are the
++** same as a SELECT with only a single table in the FROM clause.)  For
++** example, if the SQL is this:
++**
++**       SELECT * FROM t1, t2, t3 WHERE ...;
++**
++** Then the code generated is conceptually like the following:
++**
++**      foreach row1 in t1 do       \    Code generated
++**        foreach row2 in t2 do      |-- by sqliteWhereBegin()
++**          foreach row3 in t3 do   /
++**            ...
++**          end                     \    Code generated
++**        end                        |-- by sqliteWhereEnd()
++**      end                         /
++**
++** There are Btree cursors associated with each table.  t1 uses cursor
++** number pTabList->a[0].iCursor.  t2 uses the cursor pTabList->a[1].iCursor.
++** And so forth.  This routine generates code to open those VDBE cursors
++** and sqliteWhereEnd() generates the code to close them.
++**
++** If the WHERE clause is empty, the foreach loops must each scan their
++** entire tables.  Thus a three-way join is an O(N^3) operation.  But if
++** the tables have indices and there are terms in the WHERE clause that
++** refer to those indices, a complete table scan can be avoided and the
++** code will run much faster.  Most of the work of this routine is checking
++** to see if there are indices that can be used to speed up the loop.
++**
++** Terms of the WHERE clause are also used to limit which rows actually
++** make it to the "..." in the middle of the loop.  After each "foreach",
++** terms of the WHERE clause that use only terms in that loop and outer
++** loops are evaluated and if false a jump is made around all subsequent
++** inner loops (or around the "..." if the test occurs within the inner-
++** most loop)
++**
++** OUTER JOINS
++**
++** An outer join of tables t1 and t2 is conceptally coded as follows:
++**
++**    foreach row1 in t1 do
++**      flag = 0
++**      foreach row2 in t2 do
++**        start:
++**          ...
++**          flag = 1
++**      end
++**      if flag==0 then
++**        move the row2 cursor to a null row
++**        goto start
++**      fi
++**    end
++**
++** ORDER BY CLAUSE PROCESSING
++**
++** *ppOrderBy is a pointer to the ORDER BY clause of a SELECT statement,
++** if there is one.  If there is no ORDER BY clause or if this routine
++** is called from an UPDATE or DELETE statement, then ppOrderBy is NULL.
++**
++** If an index can be used so that the natural output order of the table
++** scan is correct for the ORDER BY clause, then that index is used and
++** *ppOrderBy is set to NULL.  This is an optimization that prevents an
++** unnecessary sort of the result set if an index appropriate for the
++** ORDER BY clause already exists.
++**
++** If the where clause loops cannot be arranged to provide the correct
++** output order, then the *ppOrderBy is unchanged.
++*/
++WhereInfo *sqliteWhereBegin(
++  Parse *pParse,       /* The parser context */
++  SrcList *pTabList,   /* A list of all tables to be scanned */
++  Expr *pWhere,        /* The WHERE clause */
++  int pushKey,         /* If TRUE, leave the table key on the stack */
++  ExprList **ppOrderBy /* An ORDER BY clause, or NULL */
++){
++  int i;                     /* Loop counter */
++  WhereInfo *pWInfo;         /* Will become the return value of this function */
++  Vdbe *v = pParse->pVdbe;   /* The virtual database engine */
++  int brk, cont = 0;         /* Addresses used during code generation */
++  int nExpr;           /* Number of subexpressions in the WHERE clause */
++  int loopMask;        /* One bit set for each outer loop */
++  int haveKey;         /* True if KEY is on the stack */
++  ExprMaskSet maskSet; /* The expression mask set */
++  int iDirectEq[32];   /* Term of the form ROWID==X for the N-th table */
++  int iDirectLt[32];   /* Term of the form ROWID<X or ROWID<=X */
++  int iDirectGt[32];   /* Term of the form ROWID>X or ROWID>=X */
++  ExprInfo aExpr[101]; /* The WHERE clause is divided into these expressions */
++
++  /* pushKey is only allowed if there is a single table (as in an INSERT or
++  ** UPDATE statement)
++  */
++  assert( pushKey==0 || pTabList->nSrc==1 );
++
++  /* Split the WHERE clause into separate subexpressions where each
++  ** subexpression is separated by an AND operator.  If the aExpr[]
++  ** array fills up, the last entry might point to an expression which
++  ** contains additional unfactored AND operators.
++  */
++  initMaskSet(&maskSet);
++  memset(aExpr, 0, sizeof(aExpr));
++  nExpr = exprSplit(ARRAYSIZE(aExpr), aExpr, pWhere);
++  if( nExpr==ARRAYSIZE(aExpr) ){
++    sqliteErrorMsg(pParse, "WHERE clause too complex - no more "
++       "than %d terms allowed", (int)ARRAYSIZE(aExpr)-1);
++    return 0;
++  }
++  
++  /* Allocate and initialize the WhereInfo structure that will become the
++  ** return value.
++  */
++  pWInfo = sqliteMalloc( sizeof(WhereInfo) + pTabList->nSrc*sizeof(WhereLevel));
++  if( sqlite_malloc_failed ){
++    sqliteFree(pWInfo);
++    return 0;
++  }
++  pWInfo->pParse = pParse;
++  pWInfo->pTabList = pTabList;
++  pWInfo->peakNTab = pWInfo->savedNTab = pParse->nTab;
++  pWInfo->iBreak = sqliteVdbeMakeLabel(v);
++
++  /* Special case: a WHERE clause that is constant.  Evaluate the
++  ** expression and either jump over all of the code or fall thru.
++  */
++  if( pWhere && (pTabList->nSrc==0 || sqliteExprIsConstant(pWhere)) ){
++    sqliteExprIfFalse(pParse, pWhere, pWInfo->iBreak, 1);
++    pWhere = 0;
++  }
++
++  /* Analyze all of the subexpressions.
++  */
++  for(i=0; i<nExpr; i++){
++    exprAnalyze(&maskSet, &aExpr[i]);
++
++    /* If we are executing a trigger body, remove all references to
++    ** new.* and old.* tables from the prerequisite masks.
++    */
++    if( pParse->trigStack ){
++      int x;
++      if( (x = pParse->trigStack->newIdx) >= 0 ){
++        int mask = ~getMask(&maskSet, x);
++        aExpr[i].prereqRight &= mask;
++        aExpr[i].prereqLeft &= mask;
++        aExpr[i].prereqAll &= mask;
++      }
++      if( (x = pParse->trigStack->oldIdx) >= 0 ){
++        int mask = ~getMask(&maskSet, x);
++        aExpr[i].prereqRight &= mask;
++        aExpr[i].prereqLeft &= mask;
++        aExpr[i].prereqAll &= mask;
++      }
++    }
++  }
++
++  /* Figure out what index to use (if any) for each nested loop.
++  ** Make pWInfo->a[i].pIdx point to the index to use for the i-th nested
++  ** loop where i==0 is the outer loop and i==pTabList->nSrc-1 is the inner
++  ** loop. 
++  **
++  ** If terms exist that use the ROWID of any table, then set the
++  ** iDirectEq[], iDirectLt[], or iDirectGt[] elements for that table
++  ** to the index of the term containing the ROWID.  We always prefer
++  ** to use a ROWID which can directly access a table rather than an
++  ** index which requires reading an index first to get the rowid then
++  ** doing a second read of the actual database table.
++  **
++  ** Actually, if there are more than 32 tables in the join, only the
++  ** first 32 tables are candidates for indices.  This is (again) due
++  ** to the limit of 32 bits in an integer bitmask.
++  */
++  loopMask = 0;
++  for(i=0; i<pTabList->nSrc && i<ARRAYSIZE(iDirectEq); i++){
++    int j;
++    int iCur = pTabList->a[i].iCursor;    /* The cursor for this table */
++    int mask = getMask(&maskSet, iCur);   /* Cursor mask for this table */
++    Table *pTab = pTabList->a[i].pTab;
++    Index *pIdx;
++    Index *pBestIdx = 0;
++    int bestScore = 0;
++
++    /* Check to see if there is an expression that uses only the
++    ** ROWID field of this table.  For terms of the form ROWID==expr
++    ** set iDirectEq[i] to the index of the term.  For terms of the
++    ** form ROWID<expr or ROWID<=expr set iDirectLt[i] to the term index.
++    ** For terms like ROWID>expr or ROWID>=expr set iDirectGt[i].
++    **
++    ** (Added:) Treat ROWID IN expr like ROWID=expr.
++    */
++    pWInfo->a[i].iCur = -1;
++    iDirectEq[i] = -1;
++    iDirectLt[i] = -1;
++    iDirectGt[i] = -1;
++    for(j=0; j<nExpr; j++){
++      if( aExpr[j].idxLeft==iCur && aExpr[j].p->pLeft->iColumn<0
++            && (aExpr[j].prereqRight & loopMask)==aExpr[j].prereqRight ){
++        switch( aExpr[j].p->op ){
++          case TK_IN:
++          case TK_EQ: iDirectEq[i] = j; break;
++          case TK_LE:
++          case TK_LT: iDirectLt[i] = j; break;
++          case TK_GE:
++          case TK_GT: iDirectGt[i] = j;  break;
++        }
++      }
++      if( aExpr[j].idxRight==iCur && aExpr[j].p->pRight->iColumn<0
++            && (aExpr[j].prereqLeft & loopMask)==aExpr[j].prereqLeft ){
++        switch( aExpr[j].p->op ){
++          case TK_EQ: iDirectEq[i] = j;  break;
++          case TK_LE:
++          case TK_LT: iDirectGt[i] = j;  break;
++          case TK_GE:
++          case TK_GT: iDirectLt[i] = j;  break;
++        }
++      }
++    }
++    if( iDirectEq[i]>=0 ){
++      loopMask |= mask;
++      pWInfo->a[i].pIdx = 0;
++      continue;
++    }
++
++    /* Do a search for usable indices.  Leave pBestIdx pointing to
++    ** the "best" index.  pBestIdx is left set to NULL if no indices
++    ** are usable.
++    **
++    ** The best index is determined as follows.  For each of the
++    ** left-most terms that is fixed by an equality operator, add
++    ** 8 to the score.  The right-most term of the index may be
++    ** constrained by an inequality.  Add 1 if for an "x<..." constraint
++    ** and add 2 for an "x>..." constraint.  Chose the index that
++    ** gives the best score.
++    **
++    ** This scoring system is designed so that the score can later be
++    ** used to determine how the index is used.  If the score&7 is 0
++    ** then all constraints are equalities.  If score&1 is not 0 then
++    ** there is an inequality used as a termination key.  (ex: "x<...")
++    ** If score&2 is not 0 then there is an inequality used as the
++    ** start key.  (ex: "x>...").  A score or 4 is the special case
++    ** of an IN operator constraint.  (ex:  "x IN ...").
++    **
++    ** The IN operator (as in "<expr> IN (...)") is treated the same as
++    ** an equality comparison except that it can only be used on the
++    ** left-most column of an index and other terms of the WHERE clause
++    ** cannot be used in conjunction with the IN operator to help satisfy
++    ** other columns of the index.
++    */
++    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
++      int eqMask = 0;  /* Index columns covered by an x=... term */
++      int ltMask = 0;  /* Index columns covered by an x<... term */
++      int gtMask = 0;  /* Index columns covered by an x>... term */
++      int inMask = 0;  /* Index columns covered by an x IN .. term */
++      int nEq, m, score;
++
++      if( pIdx->nColumn>32 ) continue;  /* Ignore indices too many columns */
++      for(j=0; j<nExpr; j++){
++        if( aExpr[j].idxLeft==iCur 
++             && (aExpr[j].prereqRight & loopMask)==aExpr[j].prereqRight ){
++          int iColumn = aExpr[j].p->pLeft->iColumn;
++          int k;
++          for(k=0; k<pIdx->nColumn; k++){
++            if( pIdx->aiColumn[k]==iColumn ){
++              switch( aExpr[j].p->op ){
++                case TK_IN: {
++                  if( k==0 ) inMask |= 1;
++                  break;
++                }
++                case TK_EQ: {
++                  eqMask |= 1<<k;
++                  break;
++                }
++                case TK_LE:
++                case TK_LT: {
++                  ltMask |= 1<<k;
++                  break;
++                }
++                case TK_GE:
++                case TK_GT: {
++                  gtMask |= 1<<k;
++                  break;
++                }
++                default: {
++                  /* CANT_HAPPEN */
++                  assert( 0 );
++                  break;
++                }
++              }
++              break;
++            }
++          }
++        }
++        if( aExpr[j].idxRight==iCur 
++             && (aExpr[j].prereqLeft & loopMask)==aExpr[j].prereqLeft ){
++          int iColumn = aExpr[j].p->pRight->iColumn;
++          int k;
++          for(k=0; k<pIdx->nColumn; k++){
++            if( pIdx->aiColumn[k]==iColumn ){
++              switch( aExpr[j].p->op ){
++                case TK_EQ: {
++                  eqMask |= 1<<k;
++                  break;
++                }
++                case TK_LE:
++                case TK_LT: {
++                  gtMask |= 1<<k;
++                  break;
++                }
++                case TK_GE:
++                case TK_GT: {
++                  ltMask |= 1<<k;
++                  break;
++                }
++                default: {
++                  /* CANT_HAPPEN */
++                  assert( 0 );
++                  break;
++                }
++              }
++              break;
++            }
++          }
++        }
++      }
++
++      /* The following loop ends with nEq set to the number of columns
++      ** on the left of the index with == constraints.
++      */
++      for(nEq=0; nEq<pIdx->nColumn; nEq++){
++        m = (1<<(nEq+1))-1;
++        if( (m & eqMask)!=m ) break;
++      }
++      score = nEq*8;   /* Base score is 8 times number of == constraints */
++      m = 1<<nEq;
++      if( m & ltMask ) score++;    /* Increase score for a < constraint */
++      if( m & gtMask ) score+=2;   /* Increase score for a > constraint */
++      if( score==0 && inMask ) score = 4;  /* Default score for IN constraint */
++      if( score>bestScore ){
++        pBestIdx = pIdx;
++        bestScore = score;
++      }
++    }
++    pWInfo->a[i].pIdx = pBestIdx;
++    pWInfo->a[i].score = bestScore;
++    pWInfo->a[i].bRev = 0;
++    loopMask |= mask;
++    if( pBestIdx ){
++      pWInfo->a[i].iCur = pParse->nTab++;
++      pWInfo->peakNTab = pParse->nTab;
++    }
++  }
++
++  /* Check to see if the ORDER BY clause is or can be satisfied by the
++  ** use of an index on the first table.
++  */
++  if( ppOrderBy && *ppOrderBy && pTabList->nSrc>0 ){
++     Index *pSortIdx;
++     Index *pIdx;
++     Table *pTab;
++     int bRev = 0;
++
++     pTab = pTabList->a[0].pTab;
++     pIdx = pWInfo->a[0].pIdx;
++     if( pIdx && pWInfo->a[0].score==4 ){
++       /* If there is already an IN index on the left-most table,
++       ** it will not give the correct sort order.
++       ** So, pretend that no suitable index is found.
++       */
++       pSortIdx = 0;
++     }else if( iDirectEq[0]>=0 || iDirectLt[0]>=0 || iDirectGt[0]>=0 ){
++       /* If the left-most column is accessed using its ROWID, then do
++       ** not try to sort by index.
++       */
++       pSortIdx = 0;
++     }else{
++       int nEqCol = (pWInfo->a[0].score+4)/8;
++       pSortIdx = findSortingIndex(pTab, pTabList->a[0].iCursor, 
++                                   *ppOrderBy, pIdx, nEqCol, &bRev);
++     }
++     if( pSortIdx && (pIdx==0 || pIdx==pSortIdx) ){
++       if( pIdx==0 ){
++         pWInfo->a[0].pIdx = pSortIdx;
++         pWInfo->a[0].iCur = pParse->nTab++;
++         pWInfo->peakNTab = pParse->nTab;
++       }
++       pWInfo->a[0].bRev = bRev;
++       *ppOrderBy = 0;
++     }
++  }
++
++  /* Open all tables in the pTabList and all indices used by those tables.
++  */
++  for(i=0; i<pTabList->nSrc; i++){
++    Table *pTab;
++    Index *pIx;
++
++    pTab = pTabList->a[i].pTab;
++    if( pTab->isTransient || pTab->pSelect ) continue;
++    sqliteVdbeAddOp(v, OP_Integer, pTab->iDb, 0);
++    sqliteVdbeOp3(v, OP_OpenRead, pTabList->a[i].iCursor, pTab->tnum,
++                     pTab->zName, P3_STATIC);
++    sqliteCodeVerifySchema(pParse, pTab->iDb);
++    if( (pIx = pWInfo->a[i].pIdx)!=0 ){
++      sqliteVdbeAddOp(v, OP_Integer, pIx->iDb, 0);
++      sqliteVdbeOp3(v, OP_OpenRead, pWInfo->a[i].iCur, pIx->tnum, pIx->zName,0);
++    }
++  }
++
++  /* Generate the code to do the search
++  */
++  loopMask = 0;
++  for(i=0; i<pTabList->nSrc; i++){
++    int j, k;
++    int iCur = pTabList->a[i].iCursor;
++    Index *pIdx;
++    WhereLevel *pLevel = &pWInfo->a[i];
++
++    /* If this is the right table of a LEFT OUTER JOIN, allocate and
++    ** initialize a memory cell that records if this table matches any
++    ** row of the left table of the join.
++    */
++    if( i>0 && (pTabList->a[i-1].jointype & JT_LEFT)!=0 ){
++      if( !pParse->nMem ) pParse->nMem++;
++      pLevel->iLeftJoin = pParse->nMem++;
++      sqliteVdbeAddOp(v, OP_String, 0, 0);
++      sqliteVdbeAddOp(v, OP_MemStore, pLevel->iLeftJoin, 1);
++    }
++
++    pIdx = pLevel->pIdx;
++    pLevel->inOp = OP_Noop;
++    if( i<ARRAYSIZE(iDirectEq) && iDirectEq[i]>=0 ){
++      /* Case 1:  We can directly reference a single row using an
++      **          equality comparison against the ROWID field.  Or
++      **          we reference multiple rows using a "rowid IN (...)"
++      **          construct.
++      */
++      k = iDirectEq[i];
++      assert( k<nExpr );
++      assert( aExpr[k].p!=0 );
++      assert( aExpr[k].idxLeft==iCur || aExpr[k].idxRight==iCur );
++      brk = pLevel->brk = sqliteVdbeMakeLabel(v);
++      if( aExpr[k].idxLeft==iCur ){
++        Expr *pX = aExpr[k].p;
++        if( pX->op!=TK_IN ){
++          sqliteExprCode(pParse, aExpr[k].p->pRight);
++        }else if( pX->pList ){
++          sqliteVdbeAddOp(v, OP_SetFirst, pX->iTable, brk);
++          pLevel->inOp = OP_SetNext;
++          pLevel->inP1 = pX->iTable;
++          pLevel->inP2 = sqliteVdbeCurrentAddr(v);
++        }else{
++          assert( pX->pSelect );
++          sqliteVdbeAddOp(v, OP_Rewind, pX->iTable, brk);
++          sqliteVdbeAddOp(v, OP_KeyAsData, pX->iTable, 1);
++          pLevel->inP2 = sqliteVdbeAddOp(v, OP_FullKey, pX->iTable, 0);
++          pLevel->inOp = OP_Next;
++          pLevel->inP1 = pX->iTable;
++        }
++      }else{
++        sqliteExprCode(pParse, aExpr[k].p->pLeft);
++      }
++      disableTerm(pLevel, &aExpr[k].p);
++      cont = pLevel->cont = sqliteVdbeMakeLabel(v);
++      sqliteVdbeAddOp(v, OP_MustBeInt, 1, brk);
++      haveKey = 0;
++      sqliteVdbeAddOp(v, OP_NotExists, iCur, brk);
++      pLevel->op = OP_Noop;
++    }else if( pIdx!=0 && pLevel->score>0 && pLevel->score%4==0 ){
++      /* Case 2:  There is an index and all terms of the WHERE clause that
++      **          refer to the index use the "==" or "IN" operators.
++      */
++      int start;
++      int testOp;
++      int nColumn = (pLevel->score+4)/8;
++      brk = pLevel->brk = sqliteVdbeMakeLabel(v);
++      for(j=0; j<nColumn; j++){
++        for(k=0; k<nExpr; k++){
++          Expr *pX = aExpr[k].p;
++          if( pX==0 ) continue;
++          if( aExpr[k].idxLeft==iCur
++             && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight 
++             && pX->pLeft->iColumn==pIdx->aiColumn[j]
++          ){
++            if( pX->op==TK_EQ ){
++              sqliteExprCode(pParse, pX->pRight);
++              disableTerm(pLevel, &aExpr[k].p);
++              break;
++            }
++            if( pX->op==TK_IN && nColumn==1 ){
++              if( pX->pList ){
++                sqliteVdbeAddOp(v, OP_SetFirst, pX->iTable, brk);
++                pLevel->inOp = OP_SetNext;
++                pLevel->inP1 = pX->iTable;
++                pLevel->inP2 = sqliteVdbeCurrentAddr(v);
++              }else{
++                assert( pX->pSelect );
++                sqliteVdbeAddOp(v, OP_Rewind, pX->iTable, brk);
++                sqliteVdbeAddOp(v, OP_KeyAsData, pX->iTable, 1);
++                pLevel->inP2 = sqliteVdbeAddOp(v, OP_FullKey, pX->iTable, 0);
++                pLevel->inOp = OP_Next;
++                pLevel->inP1 = pX->iTable;
++              }
++              disableTerm(pLevel, &aExpr[k].p);
++              break;
++            }
++          }
++          if( aExpr[k].idxRight==iCur
++             && aExpr[k].p->op==TK_EQ
++             && (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft
++             && aExpr[k].p->pRight->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, aExpr[k].p->pLeft);
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++        }
++      }
++      pLevel->iMem = pParse->nMem++;
++      cont = pLevel->cont = sqliteVdbeMakeLabel(v);
++      sqliteVdbeAddOp(v, OP_NotNull, -nColumn, sqliteVdbeCurrentAddr(v)+3);
++      sqliteVdbeAddOp(v, OP_Pop, nColumn, 0);
++      sqliteVdbeAddOp(v, OP_Goto, 0, brk);
++      sqliteVdbeAddOp(v, OP_MakeKey, nColumn, 0);
++      sqliteAddIdxKeyType(v, pIdx);
++      if( nColumn==pIdx->nColumn || pLevel->bRev ){
++        sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 0);
++        testOp = OP_IdxGT;
++      }else{
++        sqliteVdbeAddOp(v, OP_Dup, 0, 0);
++        sqliteVdbeAddOp(v, OP_IncrKey, 0, 0);
++        sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 1);
++        testOp = OP_IdxGE;
++      }
++      if( pLevel->bRev ){
++        /* Scan in reverse order */
++        sqliteVdbeAddOp(v, OP_IncrKey, 0, 0);
++        sqliteVdbeAddOp(v, OP_MoveLt, pLevel->iCur, brk);
++        start = sqliteVdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
++        sqliteVdbeAddOp(v, OP_IdxLT, pLevel->iCur, brk);
++        pLevel->op = OP_Prev;
++      }else{
++        /* Scan in the forward order */
++        sqliteVdbeAddOp(v, OP_MoveTo, pLevel->iCur, brk);
++        start = sqliteVdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
++        sqliteVdbeAddOp(v, testOp, pLevel->iCur, brk);
++        pLevel->op = OP_Next;
++      }
++      sqliteVdbeAddOp(v, OP_RowKey, pLevel->iCur, 0);
++      sqliteVdbeAddOp(v, OP_IdxIsNull, nColumn, cont);
++      sqliteVdbeAddOp(v, OP_IdxRecno, pLevel->iCur, 0);
++      if( i==pTabList->nSrc-1 && pushKey ){
++        haveKey = 1;
++      }else{
++        sqliteVdbeAddOp(v, OP_MoveTo, iCur, 0);
++        haveKey = 0;
++      }
++      pLevel->p1 = pLevel->iCur;
++      pLevel->p2 = start;
++    }else if( i<ARRAYSIZE(iDirectLt) && (iDirectLt[i]>=0 || iDirectGt[i]>=0) ){
++      /* Case 3:  We have an inequality comparison against the ROWID field.
++      */
++      int testOp = OP_Noop;
++      int start;
++
++      brk = pLevel->brk = sqliteVdbeMakeLabel(v);
++      cont = pLevel->cont = sqliteVdbeMakeLabel(v);
++      if( iDirectGt[i]>=0 ){
++        k = iDirectGt[i];
++        assert( k<nExpr );
++        assert( aExpr[k].p!=0 );
++        assert( aExpr[k].idxLeft==iCur || aExpr[k].idxRight==iCur );
++        if( aExpr[k].idxLeft==iCur ){
++          sqliteExprCode(pParse, aExpr[k].p->pRight);
++        }else{
++          sqliteExprCode(pParse, aExpr[k].p->pLeft);
++        }
++        sqliteVdbeAddOp(v, OP_ForceInt,
++          aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT, brk);
++        sqliteVdbeAddOp(v, OP_MoveTo, iCur, brk);
++        disableTerm(pLevel, &aExpr[k].p);
++      }else{
++        sqliteVdbeAddOp(v, OP_Rewind, iCur, brk);
++      }
++      if( iDirectLt[i]>=0 ){
++        k = iDirectLt[i];
++        assert( k<nExpr );
++        assert( aExpr[k].p!=0 );
++        assert( aExpr[k].idxLeft==iCur || aExpr[k].idxRight==iCur );
++        if( aExpr[k].idxLeft==iCur ){
++          sqliteExprCode(pParse, aExpr[k].p->pRight);
++        }else{
++          sqliteExprCode(pParse, aExpr[k].p->pLeft);
++        }
++        /* sqliteVdbeAddOp(v, OP_MustBeInt, 0, sqliteVdbeCurrentAddr(v)+1); */
++        pLevel->iMem = pParse->nMem++;
++        sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 1);
++        if( aExpr[k].p->op==TK_LT || aExpr[k].p->op==TK_GT ){
++          testOp = OP_Ge;
++        }else{
++          testOp = OP_Gt;
++        }
++        disableTerm(pLevel, &aExpr[k].p);
++      }
++      start = sqliteVdbeCurrentAddr(v);
++      pLevel->op = OP_Next;
++      pLevel->p1 = iCur;
++      pLevel->p2 = start;
++      if( testOp!=OP_Noop ){
++        sqliteVdbeAddOp(v, OP_Recno, iCur, 0);
++        sqliteVdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
++        sqliteVdbeAddOp(v, testOp, 0, brk);
++      }
++      haveKey = 0;
++    }else if( pIdx==0 ){
++      /* Case 4:  There is no usable index.  We must do a complete
++      **          scan of the entire database table.
++      */
++      int start;
++
++      brk = pLevel->brk = sqliteVdbeMakeLabel(v);
++      cont = pLevel->cont = sqliteVdbeMakeLabel(v);
++      sqliteVdbeAddOp(v, OP_Rewind, iCur, brk);
++      start = sqliteVdbeCurrentAddr(v);
++      pLevel->op = OP_Next;
++      pLevel->p1 = iCur;
++      pLevel->p2 = start;
++      haveKey = 0;
++    }else{
++      /* Case 5: The WHERE clause term that refers to the right-most
++      **         column of the index is an inequality.  For example, if
++      **         the index is on (x,y,z) and the WHERE clause is of the
++      **         form "x=5 AND y<10" then this case is used.  Only the
++      **         right-most column can be an inequality - the rest must
++      **         use the "==" operator.
++      **
++      **         This case is also used when there are no WHERE clause
++      **         constraints but an index is selected anyway, in order
++      **         to force the output order to conform to an ORDER BY.
++      */
++      int score = pLevel->score;
++      int nEqColumn = score/8;
++      int start;
++      int leFlag, geFlag;
++      int testOp;
++
++      /* Evaluate the equality constraints
++      */
++      for(j=0; j<nEqColumn; j++){
++        for(k=0; k<nExpr; k++){
++          if( aExpr[k].p==0 ) continue;
++          if( aExpr[k].idxLeft==iCur
++             && aExpr[k].p->op==TK_EQ
++             && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight 
++             && aExpr[k].p->pLeft->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, aExpr[k].p->pRight);
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++          if( aExpr[k].idxRight==iCur
++             && aExpr[k].p->op==TK_EQ
++             && (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft
++             && aExpr[k].p->pRight->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, aExpr[k].p->pLeft);
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++        }
++      }
++
++      /* Duplicate the equality term values because they will all be
++      ** used twice: once to make the termination key and once to make the
++      ** start key.
++      */
++      for(j=0; j<nEqColumn; j++){
++        sqliteVdbeAddOp(v, OP_Dup, nEqColumn-1, 0);
++      }
++
++      /* Labels for the beginning and end of the loop
++      */
++      cont = pLevel->cont = sqliteVdbeMakeLabel(v);
++      brk = pLevel->brk = sqliteVdbeMakeLabel(v);
++
++      /* Generate the termination key.  This is the key value that
++      ** will end the search.  There is no termination key if there
++      ** are no equality terms and no "X<..." term.
++      **
++      ** 2002-Dec-04: On a reverse-order scan, the so-called "termination"
++      ** key computed here really ends up being the start key.
++      */
++      if( (score & 1)!=0 ){
++        for(k=0; k<nExpr; k++){
++          Expr *pExpr = aExpr[k].p;
++          if( pExpr==0 ) continue;
++          if( aExpr[k].idxLeft==iCur
++             && (pExpr->op==TK_LT || pExpr->op==TK_LE)
++             && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight 
++             && pExpr->pLeft->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, pExpr->pRight);
++            leFlag = pExpr->op==TK_LE;
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++          if( aExpr[k].idxRight==iCur
++             && (pExpr->op==TK_GT || pExpr->op==TK_GE)
++             && (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft
++             && pExpr->pRight->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, pExpr->pLeft);
++            leFlag = pExpr->op==TK_GE;
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++        }
++        testOp = OP_IdxGE;
++      }else{
++        testOp = nEqColumn>0 ? OP_IdxGE : OP_Noop;
++        leFlag = 1;
++      }
++      if( testOp!=OP_Noop ){
++        int nCol = nEqColumn + (score & 1);
++        pLevel->iMem = pParse->nMem++;
++        sqliteVdbeAddOp(v, OP_NotNull, -nCol, sqliteVdbeCurrentAddr(v)+3);
++        sqliteVdbeAddOp(v, OP_Pop, nCol, 0);
++        sqliteVdbeAddOp(v, OP_Goto, 0, brk);
++        sqliteVdbeAddOp(v, OP_MakeKey, nCol, 0);
++        sqliteAddIdxKeyType(v, pIdx);
++        if( leFlag ){
++          sqliteVdbeAddOp(v, OP_IncrKey, 0, 0);
++        }
++        if( pLevel->bRev ){
++          sqliteVdbeAddOp(v, OP_MoveLt, pLevel->iCur, brk);
++        }else{
++          sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 1);
++        }
++      }else if( pLevel->bRev ){
++        sqliteVdbeAddOp(v, OP_Last, pLevel->iCur, brk);
++      }
++
++      /* Generate the start key.  This is the key that defines the lower
++      ** bound on the search.  There is no start key if there are no
++      ** equality terms and if there is no "X>..." term.  In
++      ** that case, generate a "Rewind" instruction in place of the
++      ** start key search.
++      **
++      ** 2002-Dec-04: In the case of a reverse-order search, the so-called
++      ** "start" key really ends up being used as the termination key.
++      */
++      if( (score & 2)!=0 ){
++        for(k=0; k<nExpr; k++){
++          Expr *pExpr = aExpr[k].p;
++          if( pExpr==0 ) continue;
++          if( aExpr[k].idxLeft==iCur
++             && (pExpr->op==TK_GT || pExpr->op==TK_GE)
++             && (aExpr[k].prereqRight & loopMask)==aExpr[k].prereqRight 
++             && pExpr->pLeft->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, pExpr->pRight);
++            geFlag = pExpr->op==TK_GE;
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++          if( aExpr[k].idxRight==iCur
++             && (pExpr->op==TK_LT || pExpr->op==TK_LE)
++             && (aExpr[k].prereqLeft & loopMask)==aExpr[k].prereqLeft
++             && pExpr->pRight->iColumn==pIdx->aiColumn[j]
++          ){
++            sqliteExprCode(pParse, pExpr->pLeft);
++            geFlag = pExpr->op==TK_LE;
++            disableTerm(pLevel, &aExpr[k].p);
++            break;
++          }
++        }
++      }else{
++        geFlag = 1;
++      }
++      if( nEqColumn>0 || (score&2)!=0 ){
++        int nCol = nEqColumn + ((score&2)!=0);
++        sqliteVdbeAddOp(v, OP_NotNull, -nCol, sqliteVdbeCurrentAddr(v)+3);
++        sqliteVdbeAddOp(v, OP_Pop, nCol, 0);
++        sqliteVdbeAddOp(v, OP_Goto, 0, brk);
++        sqliteVdbeAddOp(v, OP_MakeKey, nCol, 0);
++        sqliteAddIdxKeyType(v, pIdx);
++        if( !geFlag ){
++          sqliteVdbeAddOp(v, OP_IncrKey, 0, 0);
++        }
++        if( pLevel->bRev ){
++          pLevel->iMem = pParse->nMem++;
++          sqliteVdbeAddOp(v, OP_MemStore, pLevel->iMem, 1);
++          testOp = OP_IdxLT;
++        }else{
++          sqliteVdbeAddOp(v, OP_MoveTo, pLevel->iCur, brk);
++        }
++      }else if( pLevel->bRev ){
++        testOp = OP_Noop;
++      }else{
++        sqliteVdbeAddOp(v, OP_Rewind, pLevel->iCur, brk);
++      }
++
++      /* Generate the the top of the loop.  If there is a termination
++      ** key we have to test for that key and abort at the top of the
++      ** loop.
++      */
++      start = sqliteVdbeCurrentAddr(v);
++      if( testOp!=OP_Noop ){
++        sqliteVdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0);
++        sqliteVdbeAddOp(v, testOp, pLevel->iCur, brk);
++      }
++      sqliteVdbeAddOp(v, OP_RowKey, pLevel->iCur, 0);
++      sqliteVdbeAddOp(v, OP_IdxIsNull, nEqColumn + (score & 1), cont);
++      sqliteVdbeAddOp(v, OP_IdxRecno, pLevel->iCur, 0);
++      if( i==pTabList->nSrc-1 && pushKey ){
++        haveKey = 1;
++      }else{
++        sqliteVdbeAddOp(v, OP_MoveTo, iCur, 0);
++        haveKey = 0;
++      }
++
++      /* Record the instruction used to terminate the loop.
++      */
++      pLevel->op = pLevel->bRev ? OP_Prev : OP_Next;
++      pLevel->p1 = pLevel->iCur;
++      pLevel->p2 = start;
++    }
++    loopMask |= getMask(&maskSet, iCur);
++
++    /* Insert code to test every subexpression that can be completely
++    ** computed using the current set of tables.
++    */
++    for(j=0; j<nExpr; j++){
++      if( aExpr[j].p==0 ) continue;
++      if( (aExpr[j].prereqAll & loopMask)!=aExpr[j].prereqAll ) continue;
++      if( pLevel->iLeftJoin && !ExprHasProperty(aExpr[j].p,EP_FromJoin) ){
++        continue;
++      }
++      if( haveKey ){
++        haveKey = 0;
++        sqliteVdbeAddOp(v, OP_MoveTo, iCur, 0);
++      }
++      sqliteExprIfFalse(pParse, aExpr[j].p, cont, 1);
++      aExpr[j].p = 0;
++    }
++    brk = cont;
++
++    /* For a LEFT OUTER JOIN, generate code that will record the fact that
++    ** at least one row of the right table has matched the left table.  
++    */
++    if( pLevel->iLeftJoin ){
++      pLevel->top = sqliteVdbeCurrentAddr(v);
++      sqliteVdbeAddOp(v, OP_Integer, 1, 0);
++      sqliteVdbeAddOp(v, OP_MemStore, pLevel->iLeftJoin, 1);
++      for(j=0; j<nExpr; j++){
++        if( aExpr[j].p==0 ) continue;
++        if( (aExpr[j].prereqAll & loopMask)!=aExpr[j].prereqAll ) continue;
++        if( haveKey ){
++          /* Cannot happen.  "haveKey" can only be true if pushKey is true
++          ** an pushKey can only be true for DELETE and UPDATE and there are
++          ** no outer joins with DELETE and UPDATE.
++          */
++          haveKey = 0;
++          sqliteVdbeAddOp(v, OP_MoveTo, iCur, 0);
++        }
++        sqliteExprIfFalse(pParse, aExpr[j].p, cont, 1);
++        aExpr[j].p = 0;
++      }
++    }
++  }
++  pWInfo->iContinue = cont;
++  if( pushKey && !haveKey ){
++    sqliteVdbeAddOp(v, OP_Recno, pTabList->a[0].iCursor, 0);
++  }
++  freeMaskSet(&maskSet);
++  return pWInfo;
++}
++
++/*
++** Generate the end of the WHERE loop.  See comments on 
++** sqliteWhereBegin() for additional information.
++*/
++void sqliteWhereEnd(WhereInfo *pWInfo){
++  Vdbe *v = pWInfo->pParse->pVdbe;
++  int i;
++  WhereLevel *pLevel;
++  SrcList *pTabList = pWInfo->pTabList;
++
++  for(i=pTabList->nSrc-1; i>=0; i--){
++    pLevel = &pWInfo->a[i];
++    sqliteVdbeResolveLabel(v, pLevel->cont);
++    if( pLevel->op!=OP_Noop ){
++      sqliteVdbeAddOp(v, pLevel->op, pLevel->p1, pLevel->p2);
++    }
++    sqliteVdbeResolveLabel(v, pLevel->brk);
++    if( pLevel->inOp!=OP_Noop ){
++      sqliteVdbeAddOp(v, pLevel->inOp, pLevel->inP1, pLevel->inP2);
++    }
++    if( pLevel->iLeftJoin ){
++      int addr;
++      addr = sqliteVdbeAddOp(v, OP_MemLoad, pLevel->iLeftJoin, 0);
++      sqliteVdbeAddOp(v, OP_NotNull, 1, addr+4 + (pLevel->iCur>=0));
++      sqliteVdbeAddOp(v, OP_NullRow, pTabList->a[i].iCursor, 0);
++      if( pLevel->iCur>=0 ){
++        sqliteVdbeAddOp(v, OP_NullRow, pLevel->iCur, 0);
++      }
++      sqliteVdbeAddOp(v, OP_Goto, 0, pLevel->top);
++    }
++  }
++  sqliteVdbeResolveLabel(v, pWInfo->iBreak);
++  for(i=0; i<pTabList->nSrc; i++){
++    Table *pTab = pTabList->a[i].pTab;
++    assert( pTab!=0 );
++    if( pTab->isTransient || pTab->pSelect ) continue;
++    pLevel = &pWInfo->a[i];
++    sqliteVdbeAddOp(v, OP_Close, pTabList->a[i].iCursor, 0);
++    if( pLevel->pIdx!=0 ){
++      sqliteVdbeAddOp(v, OP_Close, pLevel->iCur, 0);
++    }
++  }
++#if 0  /* Never reuse a cursor */
++  if( pWInfo->pParse->nTab==pWInfo->peakNTab ){
++    pWInfo->pParse->nTab = pWInfo->savedNTab;
++  }
++#endif
++  sqliteFree(pWInfo);
++  return;
++}
+--- /dev/null
++++ b/ext/sqlite/libsqlite/VERSION
+@@ -0,0 +1 @@
++2.8.17
+--- /dev/null
++++ b/ext/sqlite/Makefile.frag
+@@ -0,0 +1,2 @@
++$(srcdir)/libsqlite/src/parse.c: $(srcdir)/libsqlite/src/parse.y
++      @$(LEMON) $(srcdir)/libsqlite/src/parse.y 
+--- /dev/null
++++ b/ext/sqlite/package.xml
+@@ -0,0 +1,136 @@
++<?xml version="1.0" encoding="ISO-8859-1" ?>
++<!DOCTYPE package SYSTEM "../pear/package.dtd">
++<package>
++ <name>SQLite</name>
++ <summary>SQLite database bindings</summary>
++ <maintainers>
++  <maintainer>
++   <user>wez</user>
++   <name>Wez Furlong</name>
++   <email>wez@php.net</email>
++   <role>lead</role>
++  </maintainer>
++  <maintainer>
++   <user>tal</user>
++   <name>Tal Peer</name>
++   <email>tal@php.net</email>
++   <role>developer</role>
++  </maintainer>
++  <maintainer>
++   <user>helly</user>
++   <name>Marcus Börger</name>
++   <email>helly@php.net</email>
++   <role>lead</role>
++  </maintainer>
++  <maintainer>
++   <user>iliaa</user>
++   <name>Ilia Alshanetsky</name>
++   <email>ilia@php.net</email>
++   <role>developer</role>
++  </maintainer>
++ </maintainers>
++ <description>
++SQLite is a C library that implements an embeddable SQL database engine.
++Programs that link with the SQLite library can have SQL database access
++without running a separate RDBMS process.
++This extension allows you to access SQLite databases from within PHP.
++
++Windows binary available from:
++http://snaps.php.net/win32/PECL_STABLE/php_sqlite.dll
++ </description>
++ <license>PHP</license>
++ <release>
++  <state>stable</state>
++  <version>2.0-dev</version>
++  <date>TBA</date>
++  <notes>
++   Added:
++   OO API (Marcus).
++  </notes>
++  <filelist>
++   <file role="src" name="config.m4"/>
++   <file role="src" name="config.w32"/>
++   <file role="src" name="sqlite.c"/>
++   <file role="src" name="sqlite.dsp"/>
++   <file role="src" name="php_sqlite.h"/>
++   <file role="src" name="php_sqlite.def"/>
++   <file role="doc" name="CREDITS"/>
++   <file role="doc" name="README"/>
++   <file role="doc" name="TODO"/>
++   <file role="doc" name="sqlite.php"/>
++   <file role="test" name="tests/sqlite_001.phpt"/>
++   <file role="test" name="tests/sqlite_002.phpt"/>
++   <file role="test" name="tests/sqlite_003.phpt"/>
++   <file role="test" name="tests/sqlite_004.phpt"/>
++   <file role="test" name="tests/sqlite_005.phpt"/>
++   <file role="test" name="tests/sqlite_006.phpt"/>
++   <file role="test" name="tests/sqlite_007.phpt"/>
++   <file role="test" name="tests/sqlite_008.phpt"/>
++   <file role="test" name="tests/sqlite_009.phpt"/>
++   <file role="test" name="tests/sqlite_010.phpt"/>
++   <file role="test" name="tests/sqlite_011.phpt"/>
++   <file role="test" name="tests/sqlite_012.phpt"/>
++   <file role="test" name="tests/sqlite_013.phpt"/>
++   <file role="test" name="tests/sqlite_014.phpt"/>
++   <file role="test" name="tests/sqlite_015.phpt"/>
++   <file role="test" name="tests/sqlite_016.phpt"/>
++   <file role="test" name="tests/sqlite_017.phpt"/>
++   <file role="test" name="tests/blankdb.inc"/>
++
++   <dir name="libsqlite">
++    <file role="doc" name="README"/>
++    <file role="src" name="VERSION"/>
++
++    <dir name="src">
++     <file role="src" name="attach.c"/>
++     <file role="src" name="auth.c"/>
++     <file role="src" name="btree.c"/>
++     <file role="src" name="btree_rb.c"/>
++     <file role="src" name="build.c"/>
++     <file role="src" name="copy.c"/>
++     <file role="src" name="delete.c"/>
++     <file role="src" name="encode.c"/>
++     <file role="src" name="expr.c"/>
++     <file role="src" name="func.c"/>
++     <file role="src" name="hash.c"/>
++     <file role="src" name="insert.c"/>
++     <file role="src" name="main.c"/>
++     <file role="src" name="opcodes.c"/>
++     <file role="src" name="os.c"/>
++     <file role="src" name="pager.c"/>
++     <file role="src" name="parse.c"/>
++     <file role="src" name="parse.y"/>
++     <file role="src" name="pragma.c"/>
++     <file role="src" name="printf.c"/>
++     <file role="src" name="random.c"/>
++     <file role="src" name="select.c"/>
++     <file role="src" name="table.c"/>
++     <file role="src" name="tokenize.c"/>
++     <file role="src" name="trigger.c"/>
++     <file role="src" name="update.c"/>
++     <file role="src" name="util.c"/>
++     <file role="src" name="vacuum.c"/>
++     <file role="src" name="vdbe.c"/>
++     <file role="src" name="where.c"/>
++     <file role="src" name="btree.h"/>
++     <file role="src" name="hash.h"/>
++     <file role="src" name="opcodes.h"/>
++     <file role="src" name="os.h"/>
++     <file role="src" name="pager.h"/>
++     <file role="src" name="parse.h"/>
++     <file role="src" name="sqlite_config.w32.h"/>
++     <file role="src" name="sqlite.h.in"/>
++     <file role="src" name="sqliteInt.h"/>
++     <file role="src" name="sqlite.w32.h"/>
++     <file role="src" name="vdbe.h"/>
++    </dir>
++   </dir>
++  </filelist>
++  <deps>
++   <dep type="php" rel="ge" version="5" />
++  </deps>
++ </release>
++</package>
++<!--
++vim:et:ts=1:sw=1
++-->
+--- /dev/null
++++ b/ext/sqlite/pdo_sqlite2.c
+@@ -0,0 +1,638 @@
++/*
++  +----------------------------------------------------------------------+
++  | PHP Version 5                                                        |
++  +----------------------------------------------------------------------+
++  | Copyright (c) 1997-2012 The PHP Group                                |
++  +----------------------------------------------------------------------+
++  | This source file is subject to version 3.01 of the PHP license,      |
++  | that is bundled with this package in the file LICENSE, and is        |
++  | available through the world-wide-web at the following url:           |
++  | http://www.php.net/license/3_01.txt                                  |
++  | If you did not receive a copy of the PHP license and are unable to   |
++  | obtain it through the world-wide-web, please send a note to          |
++  | license@php.net so we can mail you a copy immediately.               |
++  +----------------------------------------------------------------------+
++  | Author: Wez Furlong <wez@php.net>                                    |
++  +----------------------------------------------------------------------+
++*/
++
++/* $Id$ */
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++#include "php.h"
++
++#ifdef PHP_SQLITE2_HAVE_PDO
++#include "sqlite.h"
++#include "pdo/php_pdo.h"
++#include "pdo/php_pdo_driver.h"
++#include "zend_exceptions.h"
++
++#define php_sqlite_encode_binary(in, n, out) sqlite_encode_binary((const unsigned char *)in, n, (unsigned char *)out)
++#define php_sqlite_decode_binary(in, out)    sqlite_decode_binary((const unsigned char *)in, (unsigned char *)out)
++
++
++typedef struct {
++      const char *file;
++      int line;
++      unsigned int errcode;
++      char *errmsg;
++} pdo_sqlite2_error_info;
++
++typedef struct {
++      sqlite *db;
++      pdo_sqlite2_error_info einfo;
++} pdo_sqlite2_db_handle;
++
++typedef struct {
++      pdo_sqlite2_db_handle   *H;
++      sqlite_vm *vm;
++      const char **rowdata, **colnames;
++      int ncols;
++      unsigned pre_fetched:1;
++      unsigned done:1;
++      pdo_sqlite2_error_info einfo;
++} pdo_sqlite2_stmt;
++
++extern int _pdo_sqlite2_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *errmsg, const char *file, int line TSRMLS_DC);
++#define pdo_sqlite2_error(msg, s) _pdo_sqlite2_error(s, NULL, msg, __FILE__, __LINE__ TSRMLS_CC)
++#define pdo_sqlite2_error_stmt(msg, s) _pdo_sqlite2_error(stmt->dbh, stmt, msg, __FILE__, __LINE__ TSRMLS_CC)
++
++extern struct pdo_stmt_methods sqlite2_stmt_methods;
++
++static int pdo_sqlite2_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
++{
++      pdo_sqlite2_stmt *S = (pdo_sqlite2_stmt*)stmt->driver_data;
++
++      if (S->vm) {
++              char *errmsg = NULL;
++              sqlite_finalize(S->vm, &errmsg);
++              if (errmsg) {
++                      sqlite_freemem(errmsg);
++              }
++              S->vm = NULL;
++      }
++      if (S->einfo.errmsg) {
++              pefree(S->einfo.errmsg, stmt->dbh->is_persistent);
++      }
++      efree(S);
++      return 1;
++}
++
++static int pdo_sqlite2_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
++{
++      pdo_sqlite2_stmt *S = (pdo_sqlite2_stmt*)stmt->driver_data;
++      char *errmsg = NULL;
++      const char *tail;
++
++      if (stmt->executed && !S->done) {
++              sqlite_finalize(S->vm, &errmsg);
++              pdo_sqlite2_error_stmt(errmsg, stmt);
++              errmsg = NULL;
++              S->vm = NULL;
++      }
++
++      S->einfo.errcode = sqlite_compile(S->H->db, stmt->active_query_string, &tail, &S->vm, &errmsg);
++      if (S->einfo.errcode != SQLITE_OK) {
++              pdo_sqlite2_error_stmt(errmsg, stmt);
++              return 0;
++      }
++
++      S->done = 0;
++      S->einfo.errcode = sqlite_step(S->vm, &S->ncols, &S->rowdata, &S->colnames);
++      switch (S->einfo.errcode) {
++              case SQLITE_ROW:
++                      S->pre_fetched = 1;
++                      stmt->column_count = S->ncols;
++                      return 1;
++
++              case SQLITE_DONE:
++                      stmt->column_count = S->ncols;
++                      stmt->row_count = sqlite_changes(S->H->db);
++                      S->einfo.errcode = sqlite_reset(S->vm, &errmsg);
++                      if (S->einfo.errcode != SQLITE_OK) {
++                              pdo_sqlite2_error_stmt(errmsg, stmt);
++                      }
++                      S->done = 1;
++                      return 1;
++
++              case SQLITE_ERROR:
++              case SQLITE_MISUSE:
++              case SQLITE_BUSY:
++              default:
++                      pdo_sqlite2_error_stmt(errmsg, stmt);
++                      return 0;
++      }
++}
++
++static int pdo_sqlite2_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param,
++              enum pdo_param_event event_type TSRMLS_DC)
++{
++      return 1;
++}
++
++static int pdo_sqlite2_stmt_fetch(pdo_stmt_t *stmt,
++      enum pdo_fetch_orientation ori, long offset TSRMLS_DC)
++{
++      pdo_sqlite2_stmt *S = (pdo_sqlite2_stmt*)stmt->driver_data;
++      char *errmsg = NULL;
++
++      if (!S->vm) {
++              return 0;       
++      }
++      if (S->pre_fetched) {
++              S->pre_fetched = 0;
++              return 1;
++      }
++      if (S->done) {
++              return 0;
++      }
++
++      S->einfo.errcode = sqlite_step(S->vm, &S->ncols, &S->rowdata, &S->colnames);
++      switch (S->einfo.errcode) {
++              case SQLITE_ROW:
++                      return 1;
++
++              case SQLITE_DONE:
++                      S->done = 1;
++                      S->einfo.errcode = sqlite_reset(S->vm, &errmsg);
++                      if (S->einfo.errcode != SQLITE_OK) {
++                              pdo_sqlite2_error_stmt(errmsg, stmt);
++                              errmsg = NULL;
++                      }
++                      return 0;
++
++              default:
++                      pdo_sqlite2_error_stmt(errmsg, stmt);
++                      return 0;
++      }
++}
++
++static int pdo_sqlite2_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
++{
++      pdo_sqlite2_stmt *S = (pdo_sqlite2_stmt*)stmt->driver_data;
++
++      if(colno >= S->ncols) {
++              /* error invalid column */
++              pdo_sqlite2_error_stmt(NULL, stmt);
++              return 0;
++      }
++
++      stmt->columns[colno].name = estrdup(S->colnames[colno]);
++      stmt->columns[colno].namelen = strlen(stmt->columns[colno].name);
++      stmt->columns[colno].maxlen = 0xffffffff;
++      stmt->columns[colno].precision = 0;
++      stmt->columns[colno].param_type = PDO_PARAM_STR;
++
++      return 1;
++}
++
++static int pdo_sqlite2_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC)
++{
++      pdo_sqlite2_stmt *S = (pdo_sqlite2_stmt*)stmt->driver_data;
++      if (!S->vm) {
++              return 0;
++      }
++      if(colno >= S->ncols) {
++              /* error invalid column */
++              pdo_sqlite2_error_stmt(NULL, stmt);
++              return 0;
++      }
++      if (S->rowdata[colno]) {
++              if (S->rowdata[colno][0] == '\x01') {
++                      /* encoded */
++                      *caller_frees = 1;
++                      *ptr = emalloc(strlen(S->rowdata[colno]));
++                      *len = php_sqlite_decode_binary(S->rowdata[colno]+1, *ptr);
++                      (*(char**)ptr)[*len] = '\0';
++              } else {
++                      *ptr = (char*)S->rowdata[colno];
++                      *len = strlen(*ptr);
++              }
++      } else {
++              *ptr = NULL;
++              *len = 0;
++      }
++      return 1;
++}
++
++struct pdo_stmt_methods sqlite2_stmt_methods = {
++      pdo_sqlite2_stmt_dtor,
++      pdo_sqlite2_stmt_execute,
++      pdo_sqlite2_stmt_fetch,
++      pdo_sqlite2_stmt_describe,
++      pdo_sqlite2_stmt_get_col,
++      pdo_sqlite2_stmt_param_hook,
++      NULL, /* set_attr */
++      NULL, /* get_attr */
++      NULL
++};
++
++
++int _pdo_sqlite2_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *errmsg, const char *file, int line TSRMLS_DC) /* {{{ */
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code;
++      pdo_sqlite2_error_info *einfo = &H->einfo;
++      pdo_sqlite2_stmt *S;
++
++      if (stmt) {
++              S = stmt->driver_data;
++              einfo = &S->einfo;
++      }
++
++      einfo->file = file;
++      einfo->line = line;
++
++      if (einfo->errmsg) {
++              pefree(einfo->errmsg, dbh->is_persistent);
++              einfo->errmsg = NULL;
++      }
++
++      if (einfo->errcode != SQLITE_OK) {
++              if (errmsg) {
++                      einfo->errmsg = pestrdup(errmsg, dbh->is_persistent);
++                      sqlite_freemem(errmsg);
++              } else {
++                      einfo->errmsg = pestrdup(sqlite_error_string(einfo->errcode), dbh->is_persistent);
++              }
++      } else { /* no error */
++              strcpy(*pdo_err, PDO_ERR_NONE);
++              return 0;
++      }
++      switch (einfo->errcode) {
++              case SQLITE_NOTFOUND:
++                      strcpy(*pdo_err, "42S02");
++                      break;  
++
++              case SQLITE_INTERRUPT:
++                      strcpy(*pdo_err, "01002");
++                      break;
++
++              case SQLITE_NOLFS:
++                      strcpy(*pdo_err, "HYC00");
++                      break;
++
++              case SQLITE_TOOBIG:
++                      strcpy(*pdo_err, "22001");
++                      break;
++
++              case SQLITE_CONSTRAINT:
++                      strcpy(*pdo_err, "23000");
++                      break;
++
++              case SQLITE_ERROR:
++              default:
++                      strcpy(*pdo_err, "HY000");
++                      break;
++      }
++
++      if (!dbh->methods) {
++              zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
++                              *pdo_err, einfo->errcode, einfo->errmsg);
++      }
++
++      return einfo->errcode;
++}
++/* }}} */
++
++static int pdo_sqlite2_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      pdo_sqlite2_error_info *einfo = &H->einfo;
++      pdo_sqlite2_stmt *S;
++
++      if (stmt) {
++              S = stmt->driver_data;
++              einfo = &S->einfo;
++      }
++
++      if (einfo->errcode) {
++              add_next_index_long(info, einfo->errcode);
++              if (einfo->errmsg) {
++                      add_next_index_string(info, einfo->errmsg, 1);
++              }
++      }
++
++      return 1;
++}
++
++static int sqlite2_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      
++      if (H) {
++              if (H->db) {
++                      sqlite_close(H->db);
++                      H->db = NULL;
++              }
++              if (H->einfo.errmsg) {
++                      pefree(H->einfo.errmsg, dbh->is_persistent);
++                      H->einfo.errmsg = NULL;
++              }
++              pefree(H, dbh->is_persistent);
++              dbh->driver_data = NULL;
++      }
++      return 0;
++}
++/* }}} */
++
++static int sqlite2_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      pdo_sqlite2_stmt *S = ecalloc(1, sizeof(pdo_sqlite2_stmt));
++
++      S->H = H;
++      stmt->driver_data = S;
++      stmt->methods = &sqlite2_stmt_methods;
++      stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;
++
++      if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) {
++              H->einfo.errcode = SQLITE_ERROR;
++              pdo_sqlite2_error(NULL, dbh);
++              return 0;
++      }
++
++      return 1;
++}
++
++static long sqlite2_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      char *errmsg = NULL;
++
++      if ((H->einfo.errcode = sqlite_exec(H->db, sql, NULL, NULL, &errmsg)) != SQLITE_OK) {
++              pdo_sqlite2_error(errmsg, dbh);
++              return -1;
++      } else {
++              return sqlite_changes(H->db);
++      }
++}
++
++static char *pdo_sqlite2_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      char *id;
++      
++      id = php_pdo_int64_to_str(sqlite_last_insert_rowid(H->db) TSRMLS_CC);
++      *len = strlen(id);
++      return id;
++}
++
++static int sqlite2_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype  TSRMLS_DC)
++{
++      char *ret;
++
++      if (unquotedlen && (unquoted[0] == '\x01' || memchr(unquoted, '\0', unquotedlen) != NULL)) {
++              /* binary string */
++              int len;
++              ret = safe_emalloc(1 + unquotedlen / 254, 257, 5);
++              ret[0] = '\'';
++              ret[1] = '\x01';
++              len = php_sqlite_encode_binary(unquoted, unquotedlen, ret+2);
++              ret[len + 2] = '\'';
++              ret[len + 3] = '\0';
++              *quoted = ret;
++              *quotedlen = len + 3;
++              /* fprintf(stderr, "Quoting:%d:%.*s:\n", *quotedlen, *quotedlen, *quoted); */
++              return 1;
++      } else if (unquotedlen) {
++              ret = sqlite_mprintf("'%q'", unquoted);
++              if (ret) {
++                      *quoted = estrdup(ret);
++                      *quotedlen = strlen(ret);
++                      sqlite_freemem(ret);
++                      return 1;
++              }
++              return 0;
++      } else {
++              *quoted = estrdup("''");
++              *quotedlen = 2;
++              return 1;
++      }
++}
++
++static int sqlite2_handle_begin(pdo_dbh_t *dbh TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      char *errmsg = NULL;
++
++      if (sqlite_exec(H->db, "BEGIN", NULL, NULL, &errmsg) != SQLITE_OK) {
++              pdo_sqlite2_error(errmsg, dbh);
++              return 0;
++      }
++      return 1;
++}
++
++static int sqlite2_handle_commit(pdo_dbh_t *dbh TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      char *errmsg = NULL;
++
++      if (sqlite_exec(H->db, "COMMIT", NULL, NULL, &errmsg) != SQLITE_OK) {
++              pdo_sqlite2_error(errmsg, dbh);
++              return 0;
++      }
++      return 1;
++}
++
++static int sqlite2_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++      char *errmsg = NULL;
++
++      if (sqlite_exec(H->db, "ROLLBACK", NULL, NULL, &errmsg) != SQLITE_OK) {
++              pdo_sqlite2_error(errmsg, dbh);
++              return 0;
++      }
++      return 1;
++}
++
++static int pdo_sqlite2_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC)
++{
++      switch (attr) {
++              case PDO_ATTR_CLIENT_VERSION:
++              case PDO_ATTR_SERVER_VERSION:
++                      ZVAL_STRING(return_value, (char *)sqlite_libversion(), 1);
++                      break;
++              
++              default:
++                      return 0;       
++      }
++
++      return 1;
++}
++
++static int pdo_sqlite2_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC)
++{
++      pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
++
++      switch (attr) {
++              case PDO_ATTR_TIMEOUT:
++                      convert_to_long(val);
++                      sqlite_busy_timeout(H->db, Z_LVAL_P(val) * 1000);
++                      return 1;
++      }
++      return 0;
++}
++
++static PHP_FUNCTION(sqlite2_create_function)
++{
++      /* TODO: implement this stuff */
++}
++
++static const zend_function_entry dbh_methods[] = {
++      PHP_FE(sqlite2_create_function, NULL)
++      {NULL, NULL, NULL}
++};
++
++static const zend_function_entry *get_driver_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC)
++{
++      switch (kind) {
++              case PDO_DBH_DRIVER_METHOD_KIND_DBH:
++                      return dbh_methods;
++
++              default:
++                      return NULL;
++      }
++}
++
++static struct pdo_dbh_methods sqlite2_methods = {
++      sqlite2_handle_closer,
++      sqlite2_handle_preparer,
++      sqlite2_handle_doer,
++      sqlite2_handle_quoter,
++      sqlite2_handle_begin,
++      sqlite2_handle_commit,
++      sqlite2_handle_rollback,
++      pdo_sqlite2_set_attr,
++      pdo_sqlite2_last_insert_id,
++      pdo_sqlite2_fetch_error_func,
++      pdo_sqlite2_get_attribute,
++      NULL,   /* check_liveness: not needed */
++      get_driver_methods
++};
++
++static char *make_filename_safe(const char *filename TSRMLS_DC)
++{
++      if (*filename && strncmp(filename, ":memory:", sizeof(":memory:")-1)) {
++              char *fullpath = expand_filepath(filename, NULL TSRMLS_CC);
++
++              if (!fullpath) {
++                      return NULL;
++              }
++
++              if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
++                      efree(fullpath);
++                      return NULL;
++              }
++
++              if (php_check_open_basedir(fullpath TSRMLS_CC)) {
++                      efree(fullpath);
++                      return NULL;
++              }
++              return fullpath;
++      }
++      return estrdup(filename);
++}
++
++static int authorizer(void *autharg, int access_type, const char *arg3, const char *arg4,
++              const char *arg5, const char *arg6)
++{
++      char *filename;
++      switch (access_type) {
++              case SQLITE_COPY: {
++                      TSRMLS_FETCH();
++                      filename = make_filename_safe(arg4 TSRMLS_CC);
++                      if (!filename) {
++                              return SQLITE_DENY;
++                      }
++                      efree(filename);
++                      return SQLITE_OK;
++              }
++
++              case SQLITE_ATTACH: {
++                      TSRMLS_FETCH();
++                      filename = make_filename_safe(arg3 TSRMLS_CC);
++                      if (!filename) {
++                              return SQLITE_DENY;
++                      }
++                      efree(filename);
++                      return SQLITE_OK;
++              }
++
++              default:
++                      /* access allowed */
++                      return SQLITE_OK;
++      }
++}
++
++static int pdo_sqlite2_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */
++{
++      pdo_sqlite2_db_handle *H;
++      int ret = 0;
++      long timeout = 60;
++      char *filename;
++      char *errmsg = NULL;
++
++      H = pecalloc(1, sizeof(pdo_sqlite2_db_handle), dbh->is_persistent);
++
++      H->einfo.errcode = 0;
++      H->einfo.errmsg = NULL;
++      dbh->driver_data = H;
++
++      filename = make_filename_safe(dbh->data_source TSRMLS_CC);
++
++      if (!filename) {
++              zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
++                              "safe_mode/open_basedir prohibits opening %s",
++                              dbh->data_source);
++              goto cleanup;
++      }
++
++      H->db = sqlite_open(filename, 0666, &errmsg);
++      efree(filename);
++
++      if (!H->db) {
++              H->einfo.errcode = SQLITE_ERROR;
++              pdo_sqlite2_error(errmsg, dbh);
++              goto cleanup;
++      }
++
++      sqlite_set_authorizer(H->db, authorizer, NULL);
++
++      if (driver_options) {
++              timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC);
++      }
++      sqlite_busy_timeout(H->db, timeout * 1000);
++
++      dbh->alloc_own_columns = 1;
++      dbh->max_escaped_char_length = 2;
++
++      ret = 1;
++
++cleanup:
++      dbh->methods = &sqlite2_methods;
++
++      return ret;
++}
++/* }}} */
++
++pdo_driver_t pdo_sqlite2_driver = {
++      PDO_DRIVER_HEADER(sqlite2),
++      pdo_sqlite2_handle_factory
++};
++
++
++
++#endif
++
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim600: noet sw=4 ts=4 fdm=marker
++ * vim<600: noet sw=4 ts=4
++ */
+--- /dev/null
++++ b/ext/sqlite/php_sqlite.def
+@@ -0,0 +1,43 @@
++EXPORTS
++sqlite_open
++sqlite_close
++sqlite_exec
++sqlite_last_insert_rowid
++sqlite_changes
++sqlite_error_string
++sqlite_interrupt
++sqlite_complete
++sqlite_busy_handler
++sqlite_busy_timeout
++sqlite_get_table
++sqlite_free_table
++sqlite_exec_printf
++sqlite_exec_vprintf
++sqlite_get_table_printf
++sqlite_get_table_vprintf
++sqlite_mprintf
++sqlite_vmprintf
++sqlite_freemem
++sqlite_libversion
++sqlite_libencoding
++sqlite_create_function
++sqlite_create_aggregate
++sqlite_function_type
++sqlite_set_result_string
++sqlite_set_result_int
++sqlite_set_result_double
++sqlite_set_result_error
++sqlite_user_data
++sqlite_aggregate_context
++sqlite_aggregate_count
++sqlite_set_authorizer
++sqlite_trace
++sqlite_compile
++sqlite_step
++sqlite_finalize
++; some experimental stuff
++sqlite_last_statement_changes
++sqlite_reset
++sqlite_bind
++sqlite_progress_handler
++sqlite_commit_hook
+--- /dev/null
++++ b/ext/sqlite/php_sqlite.h
+@@ -0,0 +1,107 @@
++/*
++   +----------------------------------------------------------------------+
++   | PHP Version 5                                                        |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 1997-2012 The PHP Group                                |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 3.01 of the PHP license,      |
++   | that is bundled with this package in the file LICENSE, and is        |
++   | available through the world-wide-web at the following url:           |
++   | http://www.php.net/license/3_01.txt                                  |
++   | If you did not receive a copy of the PHP license and are unable to   |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license@php.net so we can mail you a copy immediately.               |
++   +----------------------------------------------------------------------+
++   | Authors: Wez Furlong <wez@thebrainroom.com>                          |
++   |          Tal Peer <tal@php.net>                                      |
++   |          Marcus Boerger <helly@php.net>                              |
++   +----------------------------------------------------------------------+
++
++   $Id$ 
++*/
++
++#ifndef PHP_SQLITE_H
++#define PHP_SQLITE_H
++
++extern zend_module_entry sqlite_module_entry;
++#define phpext_sqlite_ptr &sqlite_module_entry
++
++#ifdef ZTS
++#include "TSRM.h"
++#endif
++
++PHP_MINIT_FUNCTION(sqlite);
++PHP_MSHUTDOWN_FUNCTION(sqlite);
++PHP_RSHUTDOWN_FUNCTION(sqlite);
++PHP_MINFO_FUNCTION(sqlite);
++
++PHP_FUNCTION(sqlite_open);
++PHP_FUNCTION(sqlite_popen);
++PHP_FUNCTION(sqlite_close);
++PHP_FUNCTION(sqlite_query);
++PHP_FUNCTION(sqlite_exec);
++PHP_FUNCTION(sqlite_unbuffered_query);
++PHP_FUNCTION(sqlite_array_query);
++PHP_FUNCTION(sqlite_single_query);
++
++PHP_FUNCTION(sqlite_fetch_array);
++PHP_FUNCTION(sqlite_fetch_object);
++PHP_FUNCTION(sqlite_fetch_single);
++PHP_FUNCTION(sqlite_fetch_all);
++PHP_FUNCTION(sqlite_current);
++PHP_FUNCTION(sqlite_column);
++
++PHP_FUNCTION(sqlite_num_rows);
++PHP_FUNCTION(sqlite_num_fields);
++PHP_FUNCTION(sqlite_field_name);
++PHP_FUNCTION(sqlite_seek);
++PHP_FUNCTION(sqlite_rewind);
++PHP_FUNCTION(sqlite_next);
++PHP_FUNCTION(sqlite_prev);
++PHP_FUNCTION(sqlite_key);
++
++PHP_FUNCTION(sqlite_valid);
++PHP_FUNCTION(sqlite_has_prev);
++
++PHP_FUNCTION(sqlite_libversion);
++PHP_FUNCTION(sqlite_libencoding);
++
++PHP_FUNCTION(sqlite_changes);
++PHP_FUNCTION(sqlite_last_insert_rowid);
++
++PHP_FUNCTION(sqlite_escape_string);
++
++PHP_FUNCTION(sqlite_busy_timeout);
++
++PHP_FUNCTION(sqlite_last_error);
++PHP_FUNCTION(sqlite_error_string);
++
++PHP_FUNCTION(sqlite_create_aggregate);
++PHP_FUNCTION(sqlite_create_function);
++PHP_FUNCTION(sqlite_udf_decode_binary);
++PHP_FUNCTION(sqlite_udf_encode_binary);
++
++PHP_FUNCTION(sqlite_factory);
++
++PHP_FUNCTION(sqlite_fetch_column_types);
++
++ZEND_BEGIN_MODULE_GLOBALS(sqlite)
++       long assoc_case;
++ZEND_END_MODULE_GLOBALS(sqlite)
++
++#ifdef ZTS
++#define SQLITE_G(v) TSRMG(sqlite_globals_id, zend_sqlite_globals *, v)
++#else
++#define SQLITE_G(v) (sqlite_globals.v)
++#endif
++
++#endif
++
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * indent-tabs-mode: t
++ * End:
++ */
+--- /dev/null
++++ b/ext/sqlite/README
+@@ -0,0 +1,14 @@
++This is an extension for the SQLite Embeddable SQL Database Engine.
++http://www.sqlite.org/
++
++SQLite is a C library that implements an embeddable SQL database engine.
++Programs that link with the SQLite library can have SQL database access
++without running a separate RDBMS process.
++
++SQLite is not a client library used to connect to a big database server.
++SQLite is the server. The SQLite library reads and writes directly to and from
++the database files on disk
++
++
++
++vim:tw=78:et
+--- /dev/null
++++ b/ext/sqlite/sess_sqlite.c
+@@ -0,0 +1,201 @@
++/* 
++   +----------------------------------------------------------------------+
++   | PHP Version 5                                                        |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 1997-2012 The PHP Group                                |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 3.01 of the PHP license,      |
++   | that is bundled with this package in the file LICENSE, and is        |
++   | available through the world-wide-web at the following url:           |
++   | http://www.php.net/license/3_01.txt                                  |
++   | If you did not receive a copy of the PHP license and are unable to   |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license@php.net so we can mail you a copy immediately.               |
++   +----------------------------------------------------------------------+
++   | Authors: John Coggeshall <john@php.net>                              |
++   |          Wez Furlong <wez@thebrainroom.com>                          |
++   +----------------------------------------------------------------------+
++ */
++
++/* $Id$ */
++
++#include "php.h"
++
++#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
++
++#include "ext/session/php_session.h"
++#include "ext/standard/php_lcg.h"
++#include <sqlite.h>
++#define SQLITE_RETVAL(__r) ((__r) == SQLITE_OK ? SUCCESS : FAILURE)
++#define PS_SQLITE_DATA sqlite *db = (sqlite*)PS_GET_MOD_DATA()
++extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);
++extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
++
++PS_FUNCS(sqlite);
++
++ps_module ps_mod_sqlite = {
++      PS_MOD(sqlite)
++};
++
++PS_OPEN_FUNC(sqlite) 
++{
++      char *errmsg = NULL;
++      sqlite *db;
++
++      /* TODO: do we need a safe_mode check here? */
++      db = sqlite_open(save_path, 0666, &errmsg);
++      if (db == NULL) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, 
++                              "SQLite: failed to open/create session database `%s' - %s", save_path, errmsg);
++              sqlite_freemem(errmsg);
++              return FAILURE;
++      }
++
++      /* allow up to 1 minute when busy */
++      sqlite_busy_timeout(db, 60000);
++
++      sqlite_exec(db, "PRAGMA default_synchronous = OFF", NULL, NULL, NULL);
++      sqlite_exec(db, "PRAGMA count_changes = OFF", NULL, NULL, NULL);
++
++      /* This will fail if the table already exists, but that's not a big problem. I'm
++         unclear as to how to check for a table's existence in SQLite -- that would be better here. */
++      sqlite_exec(db, 
++          "CREATE TABLE session_data ("
++          "    sess_id PRIMARY KEY," 
++          "    value TEXT, "
++          "    updated INTEGER "
++          ")", NULL, NULL, NULL);
++
++      PS_SET_MOD_DATA(db);
++
++      return SUCCESS;
++}
++
++PS_CLOSE_FUNC(sqlite) 
++{
++      PS_SQLITE_DATA;
++
++      sqlite_close(db);
++
++      return SUCCESS;
++}
++
++PS_READ_FUNC(sqlite) 
++{
++      PS_SQLITE_DATA;
++      char *query;
++      const char *tail;
++      sqlite_vm *vm;
++      int colcount, result;
++      const char **rowdata, **colnames;
++      char *error;
++
++      *val = NULL;
++      *vallen = 0;
++      
++      query = sqlite_mprintf("SELECT value FROM session_data WHERE sess_id='%q' LIMIT 1", key);
++      if (query == NULL) {
++              /* no memory */
++              return FAILURE;
++      }
++
++      if (sqlite_compile(db, query, &tail, &vm, &error) != SQLITE_OK) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLite: Could not compile session read query: %s", error);
++              sqlite_freemem(error);
++              sqlite_freemem(query);
++              return FAILURE;
++      }
++
++      switch ((result = sqlite_step(vm, &colcount, &rowdata, &colnames))) {
++              case SQLITE_ROW:
++                      if (rowdata[0] != NULL) {
++                              *vallen = strlen(rowdata[0]);
++                              if (*vallen) {
++                                      *val = emalloc(*vallen);
++                                      *vallen = sqlite_decode_binary(rowdata[0], *val);
++                                      (*val)[*vallen] = '\0';
++                              } else {
++                                      *val = STR_EMPTY_ALLOC();
++                              }
++                      }
++                      break;
++              default:
++                      sqlite_freemem(error);
++                      error = NULL;
++      }
++      
++      if (SQLITE_OK != sqlite_finalize(vm, &error)) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLite: session read: error %s", error);
++              sqlite_freemem(error);
++              error = NULL;
++      }
++
++      sqlite_freemem(query);
++      
++      return *val == NULL ? FAILURE : SUCCESS;
++}
++
++PS_WRITE_FUNC(sqlite) 
++{
++      PS_SQLITE_DATA;
++      char *error;
++      time_t t;
++      char *binary;
++      int binlen;
++      int rv;
++      
++      t = time(NULL);
++
++      binary = safe_emalloc(1 + vallen / 254, 257, 3);
++      binlen = sqlite_encode_binary((const unsigned char*)val, vallen, binary);
++      
++      rv = sqlite_exec_printf(db, "REPLACE INTO session_data VALUES('%q', '%q', %d)", NULL, NULL, &error, key, binary, t);
++      if (rv != SQLITE_OK) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLite: session write query failed: %s", error);
++              sqlite_freemem(error);
++      }
++      efree(binary);
++
++      return SQLITE_RETVAL(rv);
++}
++
++PS_DESTROY_FUNC(sqlite) 
++{
++      int rv;
++      PS_SQLITE_DATA;
++
++      rv = sqlite_exec_printf(db, "DELETE FROM session_data WHERE sess_id='%q'", NULL, NULL, NULL, key);
++      
++      return SQLITE_RETVAL(rv);
++}
++
++PS_GC_FUNC(sqlite) 
++{
++      PS_SQLITE_DATA;
++      int rv;
++      time_t t = time(NULL);
++
++      rv = sqlite_exec_printf(db, 
++                      "DELETE FROM session_data WHERE (%d - updated) > %d", 
++                      NULL, NULL, NULL, t, maxlifetime);
++
++      /* because SQLite does not actually clear the deleted data from the database 
++       * we need to occassionaly do so manually to prevent the sessions database 
++       * from growing endlessly.
++       */
++      if ((int) ((float) PS(gc_divisor) * PS(gc_divisor) * php_combined_lcg(TSRMLS_C)) < PS(gc_probability)) {
++              rv = sqlite_exec_printf(db, "VACUUM", NULL, NULL, NULL);
++      }
++      return SQLITE_RETVAL(rv);
++}
++
++#endif /* HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) */
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim600: sw=4 ts=4 fdm=marker
++ * vim<600: sw=4 ts=4
++ */
+--- /dev/null
++++ b/ext/sqlite/sqlite.c
+@@ -0,0 +1,3448 @@
++/*
++   +----------------------------------------------------------------------+
++   | PHP Version 5                                                        |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 1997-2012 The PHP Group                                |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 3.01 of the PHP license,      |
++   | that is bundled with this package in the file LICENSE, and is        |
++   | available through the world-wide-web at the following url:           |
++   | http://www.php.net/license/3_01.txt                                  |
++   | If you did not receive a copy of the PHP license and are unable to   |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license@php.net so we can mail you a copy immediately.               |
++   +----------------------------------------------------------------------+
++   | Authors: Wez Furlong <wez@thebrainroom.com>                          |
++   |          Tal Peer <tal@php.net>                                      |
++   |          Marcus Boerger <helly@php.net>                              |
++   +----------------------------------------------------------------------+
++
++   $Id$
++*/
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#define PHP_SQLITE_MODULE_VERSION     "2.0-dev"
++
++#include "php.h"
++#include "php_ini.h"
++#include "ext/standard/info.h"
++#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
++#include "ext/session/php_session.h"
++#endif
++#include "php_sqlite.h"
++
++#if HAVE_TIME_H
++# include <time.h>
++#endif
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include <sqlite.h>
++
++#include "zend_exceptions.h"
++#include "zend_interfaces.h"
++
++#if defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
++extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
++extern PHPAPI zend_class_entry *spl_ce_Countable;
++#endif
++
++#if PHP_SQLITE2_HAVE_PDO
++# include "pdo/php_pdo.h"
++# include "pdo/php_pdo_driver.h"
++extern pdo_driver_t pdo_sqlite2_driver;
++#endif
++
++#ifndef safe_emalloc
++# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c))
++#endif
++
++ZEND_DECLARE_MODULE_GLOBALS(sqlite)
++static PHP_GINIT_FUNCTION(sqlite);
++
++#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
++extern ps_module ps_mod_sqlite;
++#define ps_sqlite_ptr &ps_mod_sqlite
++#endif
++
++extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);
++extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
++
++#define php_sqlite_encode_binary(in, n, out) sqlite_encode_binary((const unsigned char *)in, n, (unsigned char *)out)
++#define php_sqlite_decode_binary(in, out) in && *in ? sqlite_decode_binary((const unsigned char *)in, (unsigned char *)out) : 0
++
++static int sqlite_count_elements(zval *object, long *count TSRMLS_DC);
++
++static int le_sqlite_db, le_sqlite_result, le_sqlite_pdb;
++
++static inline void php_sqlite_strtoupper(char *s)
++{
++      while (*s!='\0') {
++              *s = toupper(*s);
++              s++;
++      }
++}
++
++static inline void php_sqlite_strtolower(char *s)
++{
++      while (*s!='\0') {
++              *s = tolower(*s);
++              s++;
++      }
++}
++
++/* {{{ PHP_INI
++ */
++PHP_INI_BEGIN()
++STD_PHP_INI_ENTRY_EX("sqlite.assoc_case", "0", PHP_INI_ALL, OnUpdateLong, assoc_case, zend_sqlite_globals, sqlite_globals, display_link_numbers)
++PHP_INI_END()
++/* }}} */
++
++#define DB_FROM_ZVAL(db, zv)  ZEND_FETCH_RESOURCE2(db, struct php_sqlite_db *, zv, -1, "sqlite database", le_sqlite_db, le_sqlite_pdb)
++
++#define DB_FROM_OBJECT(db, object) \
++      { \
++              sqlite_object *obj = (sqlite_object*) zend_object_store_get_object(object TSRMLS_CC); \
++              db = obj->u.db; \
++              if (!db) { \
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "The database wasn't opened"); \
++                      RETURN_NULL(); \
++              } \
++      }
++
++#define RES_FROM_OBJECT_RESTORE_ERH(res, object, error_handling) \
++      { \
++              sqlite_object *obj = (sqlite_object*) zend_object_store_get_object(object TSRMLS_CC); \
++              res = obj->u.res; \
++              if (!res) { \
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "No result set available"); \
++                      if (error_handling) \
++                              zend_restore_error_handling(error_handling TSRMLS_CC); \
++                      RETURN_NULL(); \
++              } \
++      }
++
++#define RES_FROM_OBJECT(res, object) RES_FROM_OBJECT_RESTORE_ERH(res, object, NULL)
++
++#define PHP_SQLITE_EMPTY_QUERY \
++      if (!sql_len || !*sql) { \
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot execute empty query."); \
++              RETURN_FALSE; \
++      }
++
++struct php_sqlite_result {
++      struct php_sqlite_db *db;
++      sqlite_vm *vm;
++      int buffered;
++      int ncolumns;
++      int nrows;
++      int curr_row;
++      char **col_names;
++      int alloc_rows;
++      int mode;
++      char **table;
++};
++
++struct php_sqlite_db {
++      sqlite *db;
++      int last_err_code;
++      zend_bool is_persistent;
++      long rsrc_id;
++
++      HashTable callbacks;
++};
++
++struct php_sqlite_agg_functions {
++      struct php_sqlite_db *db;
++      int is_valid;
++      zval *step;
++      zval *fini;
++};
++
++static void php_sqlite_fetch_array(struct php_sqlite_result *res, int mode, zend_bool decode_binary, int move_next, zval *return_value TSRMLS_DC);
++static int php_sqlite_fetch(struct php_sqlite_result *rres TSRMLS_DC);
++
++enum { PHPSQLITE_ASSOC = 1, PHPSQLITE_NUM = 2, PHPSQLITE_BOTH = PHPSQLITE_ASSOC|PHPSQLITE_NUM };
++
++/* {{{ arginfo */
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_popen, 0, 0, 1)
++      ZEND_ARG_INFO(0, filename)
++      ZEND_ARG_INFO(0, mode)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_open, 0, 0, 1)
++      ZEND_ARG_INFO(0, filename)
++      ZEND_ARG_INFO(0, mode)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_factory, 0, 0, 1)
++      ZEND_ARG_INFO(0, filename)
++      ZEND_ARG_INFO(0, mode)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_busy_timeout, 0, 0, 2)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, ms)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_busy_timeout, 0, 0, 1)
++      ZEND_ARG_INFO(0, ms)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_close, 0, 0, 1)
++      ZEND_ARG_INFO(0, db)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_unbuffered_query, 0, 0, 2)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_unbuffered_query, 0, 0, 1)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_fetch_column_types, 0, 0, 2)
++      ZEND_ARG_INFO(0, table_name)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, result_type)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_fetch_column_types, 0, 0, 1)
++      ZEND_ARG_INFO(0, table_name)
++      ZEND_ARG_INFO(0, result_type)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_query, 0, 0, 2)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_query, 0, 0, 1)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_exec, 0, 0, 2)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_exec, 0, 0, 1)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(1, error_message)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_fetch_all, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_fetch_all, 0, 0, 0)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_fetch_array, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_fetch_array, 0, 0, 0)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_fetch_object, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, class_name)
++      ZEND_ARG_INFO(0, ctor_params)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_fetch_object, 0, 0, 0)
++      ZEND_ARG_INFO(0, class_name)
++      ZEND_ARG_INFO(0, ctor_params)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_array_query, 0, 0, 2)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_array_query, 0, 0, 1)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_single_query, 0, 0, 2)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, first_row_only)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_single_query, 0, 0, 1)
++      ZEND_ARG_INFO(0, query)
++      ZEND_ARG_INFO(0, first_row_only)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_fetch_single, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_fetch_single, 0, 0, 0)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_current, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_current, 0, 0, 0)
++      ZEND_ARG_INFO(0, result_type)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_column, 0, 0, 2)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, index_or_name)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_column, 0, 0, 1)
++      ZEND_ARG_INFO(0, index_or_name)
++      ZEND_ARG_INFO(0, decode_binary)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_libversion, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_libencoding, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_changes, 0, 0, 1)
++      ZEND_ARG_INFO(0, db)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_changes, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_last_insert_rowid, 0, 0, 1)
++      ZEND_ARG_INFO(0, db)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_last_insert_rowid, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_num_rows, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_num_rows, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_valid, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_valid, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_has_prev, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_has_prev, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_num_fields, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_num_fields, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_field_name, 0, 0, 2)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, field_index)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_field_name, 0, 0, 1)
++      ZEND_ARG_INFO(0, field_index)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_seek, 0, 0, 2)
++      ZEND_ARG_INFO(0, result)
++      ZEND_ARG_INFO(0, row)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_seek, 0, 0, 1)
++      ZEND_ARG_INFO(0, row)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_rewind, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_rewind, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_next, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_next, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_key, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_key, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_prev, 0, 0, 1)
++      ZEND_ARG_INFO(0, result)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_prev, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_escape_string, 0, 0, 1)
++      ZEND_ARG_INFO(0, item)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_last_error, 0, 0, 1)
++      ZEND_ARG_INFO(0, db)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO(arginfo_sqlite_method_last_error, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_error_string, 0, 0, 1)
++      ZEND_ARG_INFO(0, error_code)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_create_aggregate, 0, 0, 4)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, funcname)
++      ZEND_ARG_INFO(0, step_func)
++      ZEND_ARG_INFO(0, finalize_func)
++      ZEND_ARG_INFO(0, num_args)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_create_aggregate, 0, 0, 3)
++      ZEND_ARG_INFO(0, funcname)
++      ZEND_ARG_INFO(0, step_func)
++      ZEND_ARG_INFO(0, finalize_func)
++      ZEND_ARG_INFO(0, num_args)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_create_function, 0, 0, 3)
++      ZEND_ARG_INFO(0, db)
++      ZEND_ARG_INFO(0, funcname)
++      ZEND_ARG_INFO(0, callback)
++      ZEND_ARG_INFO(0, num_args)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_method_create_function, 0, 0, 2)
++      ZEND_ARG_INFO(0, funcname)
++      ZEND_ARG_INFO(0, callback)
++      ZEND_ARG_INFO(0, num_args)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_udf_encode_binary, 0, 0, 1)
++      ZEND_ARG_INFO(0, data)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite_udf_decode_binary, 0, 0, 1)
++      ZEND_ARG_INFO(0, data)
++ZEND_END_ARG_INFO()
++/* }}} */
++
++const zend_function_entry sqlite_functions[] = {
++      PHP_FE(sqlite_open,                             arginfo_sqlite_open)
++      PHP_FE(sqlite_popen,                            arginfo_sqlite_popen)
++      PHP_FE(sqlite_close,                            arginfo_sqlite_close)
++      PHP_FE(sqlite_query,                            arginfo_sqlite_query)
++      PHP_FE(sqlite_exec,                             arginfo_sqlite_exec)
++      PHP_FE(sqlite_array_query,                      arginfo_sqlite_array_query)
++      PHP_FE(sqlite_single_query,             arginfo_sqlite_single_query)
++      PHP_FE(sqlite_fetch_array,                      arginfo_sqlite_fetch_array)
++      PHP_FE(sqlite_fetch_object,             arginfo_sqlite_fetch_object)
++      PHP_FE(sqlite_fetch_single,             arginfo_sqlite_fetch_single)
++      PHP_FALIAS(sqlite_fetch_string, sqlite_fetch_single, arginfo_sqlite_fetch_single)
++      PHP_FE(sqlite_fetch_all,                        arginfo_sqlite_fetch_all)
++      PHP_FE(sqlite_current,                          arginfo_sqlite_current)
++      PHP_FE(sqlite_column,                           arginfo_sqlite_column)
++      PHP_FE(sqlite_libversion,                       arginfo_sqlite_libversion)
++      PHP_FE(sqlite_libencoding,                      arginfo_sqlite_libencoding)
++      PHP_FE(sqlite_changes,                          arginfo_sqlite_changes)
++      PHP_FE(sqlite_last_insert_rowid,        arginfo_sqlite_last_insert_rowid)
++      PHP_FE(sqlite_num_rows,                         arginfo_sqlite_num_rows)
++      PHP_FE(sqlite_num_fields,                       arginfo_sqlite_num_fields)
++      PHP_FE(sqlite_field_name,                       arginfo_sqlite_field_name)
++      PHP_FE(sqlite_seek,                             arginfo_sqlite_seek)
++      PHP_FE(sqlite_rewind,                           arginfo_sqlite_rewind)
++      PHP_FE(sqlite_next,                             arginfo_sqlite_next)
++      PHP_FE(sqlite_prev,                             arginfo_sqlite_prev)
++      PHP_FE(sqlite_valid,                            arginfo_sqlite_valid)
++      PHP_FALIAS(sqlite_has_more, sqlite_valid, arginfo_sqlite_valid)
++      PHP_FE(sqlite_has_prev,                         arginfo_sqlite_has_prev)
++      PHP_FE(sqlite_escape_string,            arginfo_sqlite_escape_string)
++      PHP_FE(sqlite_busy_timeout,             arginfo_sqlite_busy_timeout)
++      PHP_FE(sqlite_last_error,                       arginfo_sqlite_last_error)
++      PHP_FE(sqlite_error_string,             arginfo_sqlite_error_string)
++      PHP_FE(sqlite_unbuffered_query,         arginfo_sqlite_unbuffered_query)
++      PHP_FE(sqlite_create_aggregate,         arginfo_sqlite_create_aggregate)
++      PHP_FE(sqlite_create_function,          arginfo_sqlite_create_function)
++      PHP_FE(sqlite_factory,                          arginfo_sqlite_factory)
++      PHP_FE(sqlite_udf_encode_binary,        arginfo_sqlite_udf_encode_binary)
++      PHP_FE(sqlite_udf_decode_binary,        arginfo_sqlite_udf_decode_binary)
++      PHP_FE(sqlite_fetch_column_types,       arginfo_sqlite_fetch_column_types)
++      {NULL, NULL, NULL}
++};
++
++const zend_function_entry sqlite_funcs_db[] = {
++      PHP_ME_MAPPING(__construct, sqlite_open, arginfo_sqlite_open, 0)
++/*    PHP_ME_MAPPING(close, sqlite_close, NULL, 0)*/
++      PHP_ME_MAPPING(query, sqlite_query, arginfo_sqlite_method_query, 0)
++      PHP_ME_MAPPING(queryExec, sqlite_exec, arginfo_sqlite_method_exec, 0)
++      PHP_ME_MAPPING(arrayQuery, sqlite_array_query, arginfo_sqlite_method_array_query, 0)
++      PHP_ME_MAPPING(singleQuery, sqlite_single_query, arginfo_sqlite_method_single_query, 0)
++      PHP_ME_MAPPING(unbufferedQuery, sqlite_unbuffered_query, arginfo_sqlite_method_unbuffered_query, 0)
++      PHP_ME_MAPPING(lastInsertRowid, sqlite_last_insert_rowid, arginfo_sqlite_method_last_insert_rowid, 0)
++      PHP_ME_MAPPING(changes, sqlite_changes, arginfo_sqlite_method_changes, 0)
++      PHP_ME_MAPPING(createAggregate, sqlite_create_aggregate, arginfo_sqlite_method_create_aggregate, 0)
++      PHP_ME_MAPPING(createFunction, sqlite_create_function, arginfo_sqlite_method_create_function, 0)
++      PHP_ME_MAPPING(busyTimeout, sqlite_busy_timeout, arginfo_sqlite_method_busy_timeout, 0)
++      PHP_ME_MAPPING(lastError, sqlite_last_error, arginfo_sqlite_method_last_error, 0)
++      PHP_ME_MAPPING(fetchColumnTypes, sqlite_fetch_column_types, arginfo_sqlite_method_fetch_column_types, 0)
++/*    PHP_ME_MAPPING(error_string, sqlite_error_string, NULL, 0) static */
++/*    PHP_ME_MAPPING(escape_string, sqlite_escape_string, NULL, 0) static */
++      {NULL, NULL, NULL}
++};
++
++const zend_function_entry sqlite_funcs_query[] = {
++      PHP_ME_MAPPING(fetch, sqlite_fetch_array, arginfo_sqlite_method_fetch_array, 0)
++      PHP_ME_MAPPING(fetchObject, sqlite_fetch_object, arginfo_sqlite_method_fetch_object, 0)
++      PHP_ME_MAPPING(fetchSingle, sqlite_fetch_single, arginfo_sqlite_method_fetch_single, 0)
++      PHP_ME_MAPPING(fetchAll, sqlite_fetch_all, arginfo_sqlite_method_fetch_all, 0)
++      PHP_ME_MAPPING(column, sqlite_column, arginfo_sqlite_method_column, 0)
++      PHP_ME_MAPPING(numFields, sqlite_num_fields, arginfo_sqlite_method_num_fields, 0)
++      PHP_ME_MAPPING(fieldName, sqlite_field_name, arginfo_sqlite_method_field_name, 0)
++      /* iterator */
++      PHP_ME_MAPPING(current, sqlite_current, arginfo_sqlite_method_current, 0)
++      PHP_ME_MAPPING(key, sqlite_key, arginfo_sqlite_method_key, 0)
++      PHP_ME_MAPPING(next, sqlite_next, arginfo_sqlite_method_next, 0)
++      PHP_ME_MAPPING(valid, sqlite_valid, arginfo_sqlite_method_valid, 0)
++      PHP_ME_MAPPING(rewind, sqlite_rewind, arginfo_sqlite_method_rewind, 0)
++      /* countable */
++      PHP_ME_MAPPING(count, sqlite_num_rows, arginfo_sqlite_method_num_rows, 0)
++      /* additional */
++      PHP_ME_MAPPING(prev, sqlite_prev, arginfo_sqlite_method_prev, 0)
++      PHP_ME_MAPPING(hasPrev, sqlite_has_prev, arginfo_sqlite_method_has_prev, 0)
++      PHP_ME_MAPPING(numRows, sqlite_num_rows, arginfo_sqlite_method_num_rows, 0)
++      PHP_ME_MAPPING(seek, sqlite_seek, arginfo_sqlite_method_seek, 0)
++      {NULL, NULL, NULL}
++};
++
++const zend_function_entry sqlite_funcs_ub_query[] = {
++      PHP_ME_MAPPING(fetch, sqlite_fetch_array, arginfo_sqlite_method_fetch_array, 0)
++      PHP_ME_MAPPING(fetchObject, sqlite_fetch_object, arginfo_sqlite_method_fetch_object, 0)
++      PHP_ME_MAPPING(fetchSingle, sqlite_fetch_single, arginfo_sqlite_method_fetch_single, 0)
++      PHP_ME_MAPPING(fetchAll, sqlite_fetch_all, arginfo_sqlite_method_fetch_all, 0)
++      PHP_ME_MAPPING(column, sqlite_column, arginfo_sqlite_method_column, 0)
++      PHP_ME_MAPPING(numFields, sqlite_num_fields, arginfo_sqlite_method_num_fields, 0)
++      PHP_ME_MAPPING(fieldName, sqlite_field_name, arginfo_sqlite_method_field_name, 0)
++      /* iterator */
++      PHP_ME_MAPPING(current, sqlite_current, arginfo_sqlite_method_current, 0)
++      PHP_ME_MAPPING(next, sqlite_next, arginfo_sqlite_method_next, 0)
++      PHP_ME_MAPPING(valid, sqlite_valid, arginfo_sqlite_method_valid, 0)
++      {NULL, NULL, NULL}
++};
++
++const zend_function_entry sqlite_funcs_exception[] = {
++      {NULL, NULL, NULL}
++};
++
++/* Dependancies */
++static const zend_module_dep sqlite_deps[] = {
++#if defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
++      ZEND_MOD_REQUIRED("spl")
++#endif
++#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
++      ZEND_MOD_REQUIRED("session")
++#endif
++#ifdef PHP_SQLITE2_HAVE_PDO
++      ZEND_MOD_REQUIRED("pdo")
++#endif
++      {NULL, NULL, NULL}
++};
++
++zend_module_entry sqlite_module_entry = {
++#if ZEND_MODULE_API_NO >= 20050922
++      STANDARD_MODULE_HEADER_EX, NULL,
++      sqlite_deps,
++#elif ZEND_MODULE_API_NO >= 20010901
++      STANDARD_MODULE_HEADER,
++#endif
++      "SQLite",
++      sqlite_functions,
++      PHP_MINIT(sqlite),
++      PHP_MSHUTDOWN(sqlite),
++      NULL,
++      PHP_RSHUTDOWN(sqlite),
++      PHP_MINFO(sqlite),
++#if ZEND_MODULE_API_NO >= 20010901
++      PHP_SQLITE_MODULE_VERSION,
++#endif
++#if ZEND_MODULE_API_NO >= 20060613
++      PHP_MODULE_GLOBALS(sqlite),
++      PHP_GINIT(sqlite),
++      NULL,
++      NULL,
++      STANDARD_MODULE_PROPERTIES_EX
++#else
++      STANDARD_MODULE_PROPERTIES
++#endif
++};
++
++
++#ifdef COMPILE_DL_SQLITE
++ZEND_GET_MODULE(sqlite)
++#endif
++
++static int php_sqlite_callback_invalidator(struct php_sqlite_agg_functions *funcs TSRMLS_DC)
++{
++      if (!funcs->is_valid) {
++              return 0;
++      }
++
++      if (funcs->step) {
++              zval_ptr_dtor(&funcs->step);
++              funcs->step = NULL;
++      }
++
++      if (funcs->fini) {
++              zval_ptr_dtor(&funcs->fini);
++              funcs->fini = NULL;
++      }
++
++      funcs->is_valid = 0;
++
++      return 0;
++}
++
++
++static void php_sqlite_callback_dtor(void *pDest)
++{
++      struct php_sqlite_agg_functions *funcs = (struct php_sqlite_agg_functions*)pDest;
++
++      if (funcs->is_valid) {
++              TSRMLS_FETCH();
++
++              php_sqlite_callback_invalidator(funcs TSRMLS_CC);
++      }
++}
++
++static ZEND_RSRC_DTOR_FUNC(php_sqlite_db_dtor)
++{
++      if (rsrc->ptr) {
++              struct php_sqlite_db *db = (struct php_sqlite_db*)rsrc->ptr;
++
++              sqlite_close(db->db);
++
++              zend_hash_destroy(&db->callbacks);
++
++              pefree(db, db->is_persistent);
++
++              rsrc->ptr = NULL;
++      }
++}
++
++static void real_result_dtor(struct php_sqlite_result *res TSRMLS_DC)
++{
++      int i, j, base;
++
++      if (res->vm) {
++              sqlite_finalize(res->vm, NULL);
++      }
++
++      if (res->table) {
++              if (!res->buffered && res->nrows) {
++                      res->nrows = 1; /* only one row is stored */
++              }
++              for (i = 0; i < res->nrows; i++) {
++                      base = i * res->ncolumns;
++                      for (j = 0; j < res->ncolumns; j++) {
++                              if (res->table[base + j] != NULL) {
++                                      efree(res->table[base + j]);
++                              }
++                      }
++              }
++              efree(res->table);
++      }
++      if (res->col_names) {
++              for (j = 0; j < res->ncolumns; j++) {
++                      efree(res->col_names[j]);
++              }
++              efree(res->col_names);
++      }
++
++      if (res->db) {
++              zend_list_delete(res->db->rsrc_id);
++      }
++      efree(res);
++}
++
++static int _clean_unfinished_results(zend_rsrc_list_entry *le, void *db TSRMLS_DC)
++{
++      if (Z_TYPE_P(le) == le_sqlite_result) {
++              struct php_sqlite_result *res = (struct php_sqlite_result *)le->ptr;
++              if (res->db->rsrc_id == ((struct php_sqlite_db*)db)->rsrc_id) {
++                      return ZEND_HASH_APPLY_REMOVE;
++              }
++      }
++      return ZEND_HASH_APPLY_KEEP;
++}
++
++static ZEND_RSRC_DTOR_FUNC(php_sqlite_result_dtor)
++{
++      struct php_sqlite_result *res = (struct php_sqlite_result *)rsrc->ptr;
++      real_result_dtor(res TSRMLS_CC);
++}
++
++static int php_sqlite_forget_persistent_id_numbers(zend_rsrc_list_entry *rsrc TSRMLS_DC)
++{
++      struct php_sqlite_db *db = (struct php_sqlite_db*)rsrc->ptr;
++
++      if (Z_TYPE_P(rsrc) != le_sqlite_pdb) {
++              return 0;
++      }
++
++      /* prevent bad mojo if someone tries to use a previously registered function in the next request */
++      zend_hash_apply(&db->callbacks, (apply_func_t)php_sqlite_callback_invalidator TSRMLS_CC);
++
++      db->rsrc_id = FAILURE;
++
++      /* don't leave pending commits hanging around */
++      sqlite_exec(db->db, "ROLLBACK", NULL, NULL, NULL);
++
++      return 0;
++}
++
++PHP_RSHUTDOWN_FUNCTION(sqlite)
++{
++      zend_hash_apply(&EG(persistent_list), (apply_func_t)php_sqlite_forget_persistent_id_numbers TSRMLS_CC);
++      return SUCCESS;
++}
++
++/* {{{ PHP Function interface */
++static void php_sqlite_generic_function_callback(sqlite_func *func, int argc, const char **argv)
++{
++      zval *retval = NULL;
++      zval ***zargs = NULL;
++      zval funcname;
++      int i, res;
++      char *callable = NULL, *errbuf=NULL;
++      TSRMLS_FETCH();
++
++      /* sanity check the args */
++      if (argc == 0) {
++              sqlite_set_result_error(func, "not enough parameters", -1);
++              return;
++      }
++
++      ZVAL_STRING(&funcname, (char*)argv[0], 1);
++
++      if (!zend_make_callable(&funcname, &callable TSRMLS_CC)) {
++              spprintf(&errbuf, 0, "function `%s' is not a function name", callable);
++              sqlite_set_result_error(func, errbuf, -1);
++              efree(errbuf);
++              efree(callable);
++              zval_dtor(&funcname);
++              return;
++      }
++
++      if (argc > 1) {
++              zargs = (zval ***)safe_emalloc((argc - 1), sizeof(zval **), 0);
++
++              for (i = 0; i < argc-1; i++) {
++                      zargs[i] = emalloc(sizeof(zval *));
++                      MAKE_STD_ZVAL(*zargs[i]);
++                      ZVAL_STRING(*zargs[i], (char*)argv[i+1], 1);
++              }
++      }
++
++      res = call_user_function_ex(EG(function_table),
++                      NULL,
++                      &funcname,
++                      &retval,
++                      argc-1,
++                      zargs,
++                      0, NULL TSRMLS_CC);
++
++      zval_dtor(&funcname);
++
++      if (res == SUCCESS) {
++              if (retval == NULL) {
++                      sqlite_set_result_string(func, NULL, 0);
++              } else {
++                      switch (Z_TYPE_P(retval)) {
++                              case IS_STRING:
++                                      sqlite_set_result_string(func, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
++                                      break;
++                              case IS_LONG:
++                              case IS_BOOL:
++                                      sqlite_set_result_int(func, Z_LVAL_P(retval));
++                                      break;
++                              case IS_DOUBLE:
++                                      sqlite_set_result_double(func, Z_DVAL_P(retval));
++                                      break;
++                              case IS_NULL:
++                              default:
++                                      sqlite_set_result_string(func, NULL, 0);
++                      }
++              }
++      } else {
++              char *errbuf;
++              spprintf(&errbuf, 0, "call_user_function_ex failed for function %s()", callable);
++              sqlite_set_result_error(func, errbuf, -1);
++              efree(errbuf);
++      }
++
++      efree(callable);
++
++      if (retval) {
++              zval_ptr_dtor(&retval);
++      }
++
++      if (zargs) {
++              for (i = 0; i < argc-1; i++) {
++                      zval_ptr_dtor(zargs[i]);
++                      efree(zargs[i]);
++              }
++              efree(zargs);
++      }
++}
++/* }}} */
++
++/* {{{ callback for sqlite_create_function */
++static void php_sqlite_function_callback(sqlite_func *func, int argc, const char **argv)
++{
++      zval *retval = NULL;
++      zval ***zargs = NULL;
++      int i, res;
++      struct php_sqlite_agg_functions *funcs = sqlite_user_data(func);
++      TSRMLS_FETCH();
++
++      if (!funcs->is_valid) {
++              sqlite_set_result_error(func, "this function has not been correctly defined for this request", -1);
++              return;
++      }
++
++      if (argc > 0) {
++              zargs = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
++
++              for (i = 0; i < argc; i++) {
++                      zargs[i] = emalloc(sizeof(zval *));
++                      MAKE_STD_ZVAL(*zargs[i]);
++
++                      if (argv[i] == NULL) {
++                              ZVAL_NULL(*zargs[i]);
++                      } else {
++                              ZVAL_STRING(*zargs[i], (char*)argv[i], 1);
++                      }
++              }
++      }
++
++      res = call_user_function_ex(EG(function_table),
++                      NULL,
++                      funcs->step,
++                      &retval,
++                      argc,
++                      zargs,
++                      0, NULL TSRMLS_CC);
++
++      if (res == SUCCESS) {
++              if (retval == NULL) {
++                      sqlite_set_result_string(func, NULL, 0);
++              } else {
++                      switch (Z_TYPE_P(retval)) {
++                              case IS_STRING:
++                                      /* TODO: for binary results, need to encode the string */
++                                      sqlite_set_result_string(func, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
++                                      break;
++                              case IS_LONG:
++                              case IS_BOOL:
++                                      sqlite_set_result_int(func, Z_LVAL_P(retval));
++                                      break;
++                              case IS_DOUBLE:
++                                      sqlite_set_result_double(func, Z_DVAL_P(retval));
++                                      break;
++                              case IS_NULL:
++                              default:
++                                      sqlite_set_result_string(func, NULL, 0);
++                      }
++              }
++      } else {
++              sqlite_set_result_error(func, "call_user_function_ex failed", -1);
++      }
++
++      if (retval) {
++              zval_ptr_dtor(&retval);
++      }
++
++      if (zargs) {
++              for (i = 0; i < argc; i++) {
++                      zval_ptr_dtor(zargs[i]);
++                      efree(zargs[i]);
++              }
++              efree(zargs);
++      }
++}
++/* }}} */
++
++/* {{{ callback for sqlite_create_aggregate: step function */
++static void php_sqlite_agg_step_function_callback(sqlite_func *func, int argc, const char **argv)
++{
++      zval *retval = NULL;
++      zval ***zargs;
++      zval **context_p;
++      int i, res, zargc;
++      struct php_sqlite_agg_functions *funcs = sqlite_user_data(func);
++      TSRMLS_FETCH();
++
++      if (!funcs->is_valid) {
++              sqlite_set_result_error(func, "this function has not been correctly defined for this request", -1);
++              return;
++      }
++
++      /* sanity check the args */
++      if (argc < 1) {
++              return;
++      }
++
++      zargc = argc + 1;
++      zargs = (zval ***)safe_emalloc(zargc, sizeof(zval **), 0);
++
++      /* first arg is always the context zval */
++      context_p = (zval **)sqlite_aggregate_context(func, sizeof(*context_p));
++
++      if (*context_p == NULL) {
++              MAKE_STD_ZVAL(*context_p);
++              Z_SET_ISREF_PP(context_p);
++              Z_TYPE_PP(context_p) = IS_NULL;
++      }
++
++      zargs[0] = context_p;
++
++      /* copy the other args */
++      for (i = 0; i < argc; i++) {
++              zargs[i+1] = emalloc(sizeof(zval *));
++              MAKE_STD_ZVAL(*zargs[i+1]);
++              if (argv[i] == NULL) {
++                      ZVAL_NULL(*zargs[i+1]);
++              } else {
++                      ZVAL_STRING(*zargs[i+1], (char*)argv[i], 1);
++              }
++      }
++
++      res = call_user_function_ex(EG(function_table),
++                      NULL,
++                      funcs->step,
++                      &retval,
++                      zargc,
++                      zargs,
++                      0, NULL TSRMLS_CC);
++
++      if (res != SUCCESS) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "call_user_function_ex failed");
++      }
++
++      if (retval) {
++              zval_ptr_dtor(&retval);
++      }
++
++      if (zargs) {
++              for (i = 1; i < zargc; i++) {
++                      zval_ptr_dtor(zargs[i]);
++                      efree(zargs[i]);
++              }
++              efree(zargs);
++      }
++}
++/* }}} */
++
++/* {{{ callback for sqlite_create_aggregate: finalize function */
++static void php_sqlite_agg_fini_function_callback(sqlite_func *func)
++{
++      zval *retval = NULL;
++      int res;
++      struct php_sqlite_agg_functions *funcs = sqlite_user_data(func);
++      zval **context_p;
++      TSRMLS_FETCH();
++
++      if (!funcs->is_valid) {
++              sqlite_set_result_error(func, "this function has not been correctly defined for this request", -1);
++              return;
++      }
++
++      context_p = (zval **)sqlite_aggregate_context(func, sizeof(*context_p));
++
++      res = call_user_function_ex(EG(function_table),
++                      NULL,
++                      funcs->fini,
++                      &retval,
++                      1,
++                      &context_p,
++                      0, NULL TSRMLS_CC);
++
++      if (res == SUCCESS) {
++              if (retval == NULL) {
++                      sqlite_set_result_string(func, NULL, 0);
++              } else {
++                      switch (Z_TYPE_P(retval)) {
++                              case IS_STRING:
++                                      /* TODO: for binary results, need to encode the string */
++                                      sqlite_set_result_string(func, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
++                                      break;
++                              case IS_LONG:
++                              case IS_BOOL:
++                                      sqlite_set_result_int(func, Z_LVAL_P(retval));
++                                      break;
++                              case IS_DOUBLE:
++                                      sqlite_set_result_double(func, Z_DVAL_P(retval));
++                                      break;
++                              case IS_NULL:
++                              default:
++                                      sqlite_set_result_string(func, NULL, 0);
++                      }
++              }
++      } else {
++              sqlite_set_result_error(func, "call_user_function_ex failed", -1);
++      }
++
++      if (retval) {
++              zval_ptr_dtor(&retval);
++      }
++
++      zval_ptr_dtor(context_p);
++}
++/* }}} */
++
++/* {{{ Authorization Callback */
++static int php_sqlite_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4,
++              const char *arg5, const char *arg6)
++{
++      switch (access_type) {
++              case SQLITE_COPY:
++                      if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) {
++                              TSRMLS_FETCH();
++                              if (PG(safe_mode) && (!php_checkuid(arg4, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
++                                      return SQLITE_DENY;
++                              }
++
++                              if (php_check_open_basedir(arg4 TSRMLS_CC)) {
++                                      return SQLITE_DENY;
++                              }
++                      }
++                      return SQLITE_OK;
++#ifdef SQLITE_ATTACH
++              case SQLITE_ATTACH:
++                      if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) {
++                              TSRMLS_FETCH();
++                              if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
++                                      return SQLITE_DENY;
++                              }
++
++                              if (php_check_open_basedir(arg3 TSRMLS_CC)) {
++                                      return SQLITE_DENY;
++                              }
++                      }
++                      return SQLITE_OK;
++#endif
++
++              default:
++                      /* access allowed */
++                      return SQLITE_OK;
++      }
++}
++/* }}} */
++
++/* {{{ OO init/structure stuff */
++#define REGISTER_SQLITE_CLASS(name, c_name, parent) \
++      { \
++              zend_class_entry ce; \
++              INIT_CLASS_ENTRY(ce, "SQLite" # name, sqlite_funcs_ ## c_name); \
++              ce.create_object = sqlite_object_new_ ## c_name; \
++              sqlite_ce_ ## c_name = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
++              memcpy(&sqlite_object_handlers_ ## c_name, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
++              sqlite_object_handlers_ ## c_name.clone_obj = NULL; \
++              sqlite_ce_ ## c_name->ce_flags |= ZEND_ACC_FINAL_CLASS; \
++      }
++
++zend_class_entry *sqlite_ce_db, *sqlite_ce_exception;
++zend_class_entry *sqlite_ce_query, *sqlite_ce_ub_query;
++
++static zend_object_handlers sqlite_object_handlers_db;
++static zend_object_handlers sqlite_object_handlers_query;
++static zend_object_handlers sqlite_object_handlers_ub_query;
++static zend_object_handlers sqlite_object_handlers_exception;
++
++typedef enum {
++      is_db,
++      is_result
++} sqlite_obj_type;
++
++typedef struct _sqlite_object {
++      zend_object       std;
++      sqlite_obj_type   type;
++      union {
++              struct php_sqlite_db     *db;
++              struct php_sqlite_result *res;
++              void *ptr;
++      } u;
++} sqlite_object;
++
++static int sqlite_free_persistent(zend_rsrc_list_entry *le, void *ptr TSRMLS_DC)
++{
++      return le->ptr == ptr ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_KEEP;
++}
++
++static void sqlite_object_free_storage(void *object TSRMLS_DC)
++{
++      sqlite_object *intern = (sqlite_object *)object;
++
++      zend_object_std_dtor(&intern->std TSRMLS_CC);
++
++      if (intern->u.ptr) {
++              if (intern->type == is_db) {
++                      if (intern->u.db->rsrc_id) {
++                              zend_list_delete(intern->u.db->rsrc_id);
++                              zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) sqlite_free_persistent, &intern->u.ptr TSRMLS_CC);
++                      }
++              } else {
++                      real_result_dtor(intern->u.res TSRMLS_CC);
++              }
++      }
++
++      efree(object);
++}
++
++static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers *handlers, zend_object_value *retval TSRMLS_DC)
++{
++      sqlite_object *intern;
++      zval *tmp;
++
++      intern = emalloc(sizeof(sqlite_object));
++      memset(intern, 0, sizeof(sqlite_object));
++
++      zend_object_std_init(&intern->std, class_type TSRMLS_CC);
++      zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
++
++      retval->handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) sqlite_object_free_storage, NULL TSRMLS_CC);
++      retval->handlers = handlers;
++}
++
++static zend_object_value sqlite_object_new_db(zend_class_entry *class_type TSRMLS_DC)
++{
++      zend_object_value retval;
++
++      sqlite_object_new(class_type, &sqlite_object_handlers_db, &retval TSRMLS_CC);
++      return retval;
++}
++
++static zend_object_value sqlite_object_new_query(zend_class_entry *class_type TSRMLS_DC)
++{
++      zend_object_value retval;
++
++      sqlite_object_new(class_type, &sqlite_object_handlers_query, &retval TSRMLS_CC);
++      return retval;
++}
++
++static zend_object_value sqlite_object_new_ub_query(zend_class_entry *class_type TSRMLS_DC)
++{
++      zend_object_value retval;
++
++      sqlite_object_new(class_type, &sqlite_object_handlers_ub_query, &retval TSRMLS_CC);
++      return retval;
++}
++
++static zend_object_value sqlite_object_new_exception(zend_class_entry *class_type TSRMLS_DC)
++{
++      zend_object_value retval;
++
++      sqlite_object_new(class_type, &sqlite_object_handlers_exception, &retval TSRMLS_CC);
++      return retval;
++}
++
++#define SQLITE_REGISTER_OBJECT(_type, _object, _ptr) \
++      { \
++              sqlite_object *obj; \
++              obj = (sqlite_object*)zend_object_store_get_object(_object TSRMLS_CC); \
++              obj->type = is_ ## _type; \
++              obj->u._type = _ptr; \
++      }
++
++static zend_class_entry *sqlite_get_ce_query(const zval *object TSRMLS_DC)
++{
++      return sqlite_ce_query;
++}
++
++static zend_class_entry *sqlite_get_ce_ub_query(const zval *object TSRMLS_DC)
++{
++      return sqlite_ce_ub_query;
++}
++
++static zval * sqlite_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC)
++{
++      if (!object) {
++              ALLOC_ZVAL(object);
++      }
++      Z_TYPE_P(object) = IS_OBJECT;
++      object_init_ex(object, pce);
++      Z_SET_REFCOUNT_P(object, 1);
++      Z_SET_ISREF_P(object);
++      return object;
++}
++
++typedef struct _sqlite_object_iterator {
++      zend_object_iterator     it;
++      struct php_sqlite_result *res;
++      zval *value;
++} sqlite_object_iterator;
++
++void sqlite_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
++{
++      zval *object = (zval*)((sqlite_object_iterator*)iter)->it.data;
++
++      if (((sqlite_object_iterator*)iter)->value) {
++              zval_ptr_dtor(&((sqlite_object_iterator*)iter)->value);
++              ((sqlite_object_iterator*)iter)->value = NULL;
++      }
++      zval_ptr_dtor(&object);
++      efree(iter);
++}
++
++void sqlite_iterator_rewind(zend_object_iterator *iter TSRMLS_DC)
++{
++      struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res;
++
++      if (((sqlite_object_iterator*)iter)->value) {
++              zval_ptr_dtor(&((sqlite_object_iterator*)iter)->value);
++              ((sqlite_object_iterator*)iter)->value = NULL;
++      }
++      if (res) {
++              res->curr_row = 0;
++      }
++}
++
++int sqlite_iterator_valid(zend_object_iterator *iter TSRMLS_DC)
++{
++      struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res;
++
++      if (res && res->curr_row < res->nrows && res->nrows) { /* curr_row may be -1 */
++              return SUCCESS;
++      } else {
++              return FAILURE;
++      }
++}
++
++void sqlite_iterator_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
++{
++      struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res;
++
++      *data = &((sqlite_object_iterator*)iter)->value;
++      if (res && !**data) {
++              MAKE_STD_ZVAL(**data);
++              php_sqlite_fetch_array(res, res->mode, 1, 0, **data TSRMLS_CC);
++      }
++
++}
++
++int sqlite_iterator_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
++{
++      struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res;
++
++      *str_key = NULL;
++      *str_key_len = 0;
++      *int_key = res ? res->curr_row : 0;
++      return HASH_KEY_IS_LONG;
++}
++
++void sqlite_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
++{
++      struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res;
++
++      if (((sqlite_object_iterator*)iter)->value) {
++              zval_ptr_dtor(&((sqlite_object_iterator*)iter)->value);
++              ((sqlite_object_iterator*)iter)->value = NULL;
++      }
++      if (res) {
++              if (!res->buffered && res->vm) {
++                      php_sqlite_fetch(res TSRMLS_CC);
++              }
++              if (res->curr_row >= res->nrows) {
++                      /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "no more rows available"); */
++                      return;
++              }
++
++              res->curr_row++;
++      }
++}
++
++zend_object_iterator_funcs sqlite_ub_query_iterator_funcs = {
++      sqlite_iterator_dtor,
++      sqlite_iterator_valid,
++      sqlite_iterator_get_current_data,
++      sqlite_iterator_get_current_key,
++      sqlite_iterator_move_forward,
++      NULL
++};
++
++zend_object_iterator_funcs sqlite_query_iterator_funcs = {
++      sqlite_iterator_dtor,
++      sqlite_iterator_valid,
++      sqlite_iterator_get_current_data,
++      sqlite_iterator_get_current_key,
++      sqlite_iterator_move_forward,
++      sqlite_iterator_rewind
++};
++
++zend_object_iterator *sqlite_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
++{
++      sqlite_object_iterator *iterator = emalloc(sizeof(sqlite_object_iterator));
++
++      sqlite_object *obj = (sqlite_object*) zend_object_store_get_object(object TSRMLS_CC);
++
++      if (by_ref) {
++              zend_error(E_RECOVERABLE_ERROR, "An iterator cannot be used with foreach by reference");
++      }
++      Z_ADDREF_P(object);
++      iterator->it.data = (void*)object;
++      iterator->it.funcs = ce->iterator_funcs.funcs;
++      iterator->res = obj->u.res;
++      iterator->value = NULL;
++      return (zend_object_iterator*)iterator;
++}
++/* }}} */
++
++static PHP_GINIT_FUNCTION(sqlite)
++{
++      sqlite_globals->assoc_case = 0;
++}
++
++PHP_MINIT_FUNCTION(sqlite)
++{
++      REGISTER_SQLITE_CLASS(Database,   db,        NULL);
++      REGISTER_SQLITE_CLASS(Result,     query,     NULL);
++      REGISTER_SQLITE_CLASS(Unbuffered, ub_query,  NULL);
++#if defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
++      REGISTER_SQLITE_CLASS(Exception,  exception, spl_ce_RuntimeException);
++#else
++      REGISTER_SQLITE_CLASS(Exception,  exception, zend_exception_get_default(TSRMLS_C));
++#endif
++
++      sqlite_ce_db->ce_flags &= ~ZEND_ACC_FINAL_CLASS;
++      sqlite_ce_db->constructor->common.fn_flags |= ZEND_ACC_FINAL;
++
++      sqlite_object_handlers_query.get_class_entry = sqlite_get_ce_query;
++      sqlite_object_handlers_ub_query.get_class_entry = sqlite_get_ce_ub_query;
++      sqlite_object_handlers_ub_query.count_elements = sqlite_count_elements;
++
++      sqlite_ce_ub_query->get_iterator = sqlite_get_iterator;
++      sqlite_ce_ub_query->iterator_funcs.funcs = &sqlite_ub_query_iterator_funcs;
++
++#if defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
++      zend_class_implements(sqlite_ce_query TSRMLS_CC, 2, zend_ce_iterator, spl_ce_Countable);
++#else
++      zend_class_implements(sqlite_ce_query TSRMLS_CC, 1, zend_ce_iterator);
++#endif
++      sqlite_ce_query->get_iterator = sqlite_get_iterator;
++      sqlite_ce_query->iterator_funcs.funcs = &sqlite_query_iterator_funcs;
++
++      REGISTER_INI_ENTRIES();
++
++#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
++      php_session_register_module(ps_sqlite_ptr);
++#endif
++
++      le_sqlite_db = zend_register_list_destructors_ex(php_sqlite_db_dtor, NULL, "sqlite database", module_number);
++      le_sqlite_pdb = zend_register_list_destructors_ex(NULL, php_sqlite_db_dtor, "sqlite database (persistent)", module_number);
++      le_sqlite_result = zend_register_list_destructors_ex(php_sqlite_result_dtor, NULL, "sqlite result", module_number);
++
++      REGISTER_LONG_CONSTANT("SQLITE_BOTH",   PHPSQLITE_BOTH, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_NUM",    PHPSQLITE_NUM, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_ASSOC",  PHPSQLITE_ASSOC, CONST_CS|CONST_PERSISTENT);
++
++      REGISTER_LONG_CONSTANT("SQLITE_OK",                             SQLITE_OK, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_ERROR",                  SQLITE_ERROR, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_INTERNAL",               SQLITE_INTERNAL, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_PERM",                   SQLITE_PERM, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_ABORT",                  SQLITE_ABORT, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_BUSY",                   SQLITE_BUSY, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_LOCKED",                 SQLITE_LOCKED, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_NOMEM",                  SQLITE_NOMEM, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_READONLY",               SQLITE_READONLY, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_INTERRUPT",              SQLITE_INTERRUPT, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_IOERR",                  SQLITE_IOERR, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_CORRUPT",                SQLITE_CORRUPT, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_NOTFOUND",               SQLITE_NOTFOUND, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_FULL",                   SQLITE_FULL, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_CANTOPEN",               SQLITE_CANTOPEN, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_PROTOCOL",               SQLITE_PROTOCOL, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_EMPTY",                  SQLITE_EMPTY, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_SCHEMA",                 SQLITE_SCHEMA, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_TOOBIG",                 SQLITE_TOOBIG, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_CONSTRAINT",             SQLITE_CONSTRAINT, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_MISMATCH",               SQLITE_MISMATCH, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_MISUSE",                 SQLITE_MISUSE, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_NOLFS",                  SQLITE_NOLFS, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_AUTH",                   SQLITE_AUTH, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_NOTADB",                 SQLITE_NOTADB, CONST_CS|CONST_PERSISTENT);
++#ifdef SQLITE_FORMAT
++      REGISTER_LONG_CONSTANT("SQLITE_FORMAT",                 SQLITE_FORMAT, CONST_CS|CONST_PERSISTENT);
++#endif
++      REGISTER_LONG_CONSTANT("SQLITE_ROW",                    SQLITE_ROW, CONST_CS|CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("SQLITE_DONE",                   SQLITE_DONE, CONST_CS|CONST_PERSISTENT);
++
++#ifdef PHP_SQLITE2_HAVE_PDO
++    if (FAILURE == php_pdo_register_driver(&pdo_sqlite2_driver)) {
++      return FAILURE;
++    }
++#endif
++
++      return SUCCESS;
++}
++
++PHP_MSHUTDOWN_FUNCTION(sqlite)
++{
++      UNREGISTER_INI_ENTRIES();
++
++#ifdef PHP_SQLITE2_HAVE_PDO
++    php_pdo_unregister_driver(&pdo_sqlite2_driver);
++#endif
++
++      return SUCCESS;
++}
++
++PHP_MINFO_FUNCTION(sqlite)
++{
++      php_info_print_table_start();
++      php_info_print_table_header(2, "SQLite support", "enabled");
++      php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id$");
++      php_info_print_table_row(2, "SQLite Library", sqlite_libversion());
++      php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding());
++      php_info_print_table_end();
++
++      DISPLAY_INI_ENTRIES();
++}
++
++static struct php_sqlite_db *php_sqlite_open(char *filename, int mode, char *persistent_id, zval *return_value, zval *errmsg, zval *object TSRMLS_DC)
++{
++      char *errtext = NULL;
++      sqlite *sdb = NULL;
++      struct php_sqlite_db *db = NULL;
++
++      sdb = sqlite_open(filename, mode, &errtext);
++
++      if (sdb == NULL) {
++
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++
++              if (errmsg) {
++                      ZVAL_STRING(errmsg, errtext, 1);
++              }
++
++              sqlite_freemem(errtext);
++
++              /* if object is not an object then we're called from the factory() function */
++              if (object && Z_TYPE_P(object) != IS_OBJECT) {
++                      RETVAL_NULL();
++              } else {
++                      RETVAL_FALSE;
++              }
++              return NULL;
++      }
++
++      db = (struct php_sqlite_db *)pemalloc(sizeof(struct php_sqlite_db), persistent_id ? 1 : 0);
++      db->is_persistent = persistent_id ? 1 : 0;
++      db->last_err_code = SQLITE_OK;
++      db->db = sdb;
++
++      zend_hash_init(&db->callbacks, 0, NULL, php_sqlite_callback_dtor, db->is_persistent);
++
++      /* register the PHP functions */
++      sqlite_create_function(sdb, "php", -1, php_sqlite_generic_function_callback, 0);
++
++      /* set default busy handler; keep retrying up until 1 minute has passed,
++       * then fail with a busy status code */
++      sqlite_busy_timeout(sdb, 60000);
++
++      /* authorizer hook so we can enforce safe mode
++       * Note: the declaration of php_sqlite_authorizer is correct for 2.8.2 of libsqlite,
++       * and IS backwards binary compatible with earlier versions */
++      if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
++              sqlite_set_authorizer(sdb, php_sqlite_authorizer, NULL);
++      }
++
++      db->rsrc_id = ZEND_REGISTER_RESOURCE(object ? NULL : return_value, db, persistent_id ? le_sqlite_pdb : le_sqlite_db);
++      if (object) {
++              /* if object is not an object then we're called from the factory() function */
++              if (Z_TYPE_P(object) != IS_OBJECT) {
++                      sqlite_instanciate(sqlite_ce_db, object TSRMLS_CC);
++              }
++              /* and now register the object */
++              SQLITE_REGISTER_OBJECT(db, object, db)
++      }
++
++      if (persistent_id) {
++              zend_rsrc_list_entry le;
++
++              Z_TYPE(le) = le_sqlite_pdb;
++              le.ptr = db;
++
++              if (FAILURE == zend_hash_update(&EG(persistent_list), persistent_id,
++                                      strlen(persistent_id)+1,
++                                      (void *)&le, sizeof(le), NULL)) {
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to register persistent resource");
++              }
++      }
++
++      return db;
++}
++
++/* {{{ proto resource sqlite_popen(string filename [, int mode [, string &error_message]])
++   Opens a persistent handle to a SQLite database. Will create the database if it does not exist. */
++PHP_FUNCTION(sqlite_popen)
++{
++      long mode = 0666;
++      char *filename, *fullpath, *hashkey;
++      int filename_len, hashkeylen;
++      zval *errmsg = NULL;
++      struct php_sqlite_db *db = NULL;
++      zend_rsrc_list_entry *le;
++
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/",
++                              &filename, &filename_len, &mode, &errmsg)) {
++              return;
++      }
++      if (errmsg) {
++              zval_dtor(errmsg);
++              ZVAL_NULL(errmsg);
++      }
++
++      if (strlen(filename) != filename_len) {
++              RETURN_FALSE;
++      }
++      if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
++              /* resolve the fully-qualified path name to use as the hash key */
++              if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
++                      RETURN_FALSE;
++              }
++
++              if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || 
++                              php_check_open_basedir(fullpath TSRMLS_CC)) {
++                      efree(fullpath);
++                      RETURN_FALSE;
++              }
++      } else {
++              fullpath = estrndup(filename, filename_len);
++      }
++
++      hashkeylen = spprintf(&hashkey, 0, "sqlite_pdb_%s:%ld", fullpath, mode);
++
++      /* do we have an existing persistent connection ? */
++      if (SUCCESS == zend_hash_find(&EG(persistent_list), hashkey, hashkeylen+1, (void*)&le)) {
++              if (Z_TYPE_P(le) == le_sqlite_pdb) {
++                      db = (struct php_sqlite_db*)le->ptr;
++
++                      if (db->rsrc_id == FAILURE) {
++                              /* give it a valid resource id for this request */
++                              db->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, db, le_sqlite_pdb);
++                      } else {
++                              int type;
++                              /* sanity check to ensure that the resource is still a valid regular resource
++                               * number */
++                              if (zend_list_find(db->rsrc_id, &type) == db) {
++                                      /* already accessed this request; map it */
++                                      zend_list_addref(db->rsrc_id);
++                                      ZVAL_RESOURCE(return_value, db->rsrc_id);
++                              } else {
++                                      db->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, db, le_sqlite_pdb);
++                              }
++                      }
++
++                      /* all set */
++                      goto done;
++              }
++
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Some other type of persistent resource is using this hash key!?");
++              RETVAL_FALSE;
++              goto done;
++      }
++
++      /* now we need to open the database */
++      php_sqlite_open(fullpath, (int)mode, hashkey, return_value, errmsg, NULL TSRMLS_CC);
++done:
++      efree(fullpath);
++      efree(hashkey);
++}
++/* }}} */
++
++/* {{{ proto resource sqlite_open(string filename [, int mode [, string &error_message]])
++   Opens a SQLite database. Will create the database if it does not exist. */
++PHP_FUNCTION(sqlite_open)
++{
++      long mode = 0666;
++      char *filename, *fullpath = NULL;
++      int filename_len;
++      zval *errmsg = NULL;
++      zval *object = getThis();
++      zend_error_handling error_handling;
++
++      zend_replace_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception, &error_handling TSRMLS_CC);
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/",
++                              &filename, &filename_len, &mode, &errmsg)) {
++              zend_restore_error_handling(&error_handling TSRMLS_CC);
++              return;
++      }
++      if (errmsg) {
++              zval_dtor(errmsg);
++              ZVAL_NULL(errmsg);
++      }
++
++      if (strlen(filename) != filename_len) {
++              zend_restore_error_handling(&error_handling TSRMLS_CC);
++              RETURN_FALSE;
++      }
++
++      if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
++              /* resolve the fully-qualified path name to use as the hash key */
++              if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
++                      zend_restore_error_handling(&error_handling TSRMLS_CC);
++                      if (object) {
++                              RETURN_NULL();
++                      } else {
++                              RETURN_FALSE;
++                      }
++              }
++
++              if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
++                              php_check_open_basedir(fullpath TSRMLS_CC)) {
++                      efree(fullpath);
++                      zend_restore_error_handling(&error_handling TSRMLS_CC);
++                      if (object) {
++                              RETURN_NULL();
++                      } else {
++                              RETURN_FALSE;
++                      }
++              }
++      }
++
++      php_sqlite_open(fullpath ? fullpath : filename, (int)mode, NULL, return_value, errmsg, object TSRMLS_CC);
++
++      if (fullpath) {
++              efree(fullpath);
++      }
++      zend_restore_error_handling(&error_handling TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto object sqlite_factory(string filename [, int mode [, string &error_message]])
++   Opens a SQLite database and creates an object for it. Will create the database if it does not exist. */
++PHP_FUNCTION(sqlite_factory)
++{
++      long mode = 0666;
++      char *filename, *fullpath = NULL;
++      int filename_len;
++      zval *errmsg = NULL;
++      zend_error_handling error_handling;
++
++      zend_replace_error_handling(EH_THROW, sqlite_ce_exception, &error_handling TSRMLS_CC);
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/",
++                              &filename, &filename_len, &mode, &errmsg)) {
++              zend_restore_error_handling(&error_handling TSRMLS_CC);
++              RETURN_NULL();
++      }
++      if (errmsg) {
++              zval_dtor(errmsg);
++              ZVAL_NULL(errmsg);
++      }
++
++      if (strlen(filename) != filename_len) {
++              zend_restore_error_handling(&error_handling TSRMLS_CC);
++              RETURN_FALSE;
++      }
++
++      if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
++              /* resolve the fully-qualified path name to use as the hash key */
++              if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
++                      zend_restore_error_handling(&error_handling TSRMLS_CC);
++                      RETURN_NULL();
++              }
++
++              if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
++                              php_check_open_basedir(fullpath TSRMLS_CC)) {
++                      efree(fullpath);
++                      zend_restore_error_handling(&error_handling TSRMLS_CC);
++                      RETURN_NULL();
++              }
++      }
++
++      php_sqlite_open(fullpath ? fullpath : filename, (int)mode, NULL, return_value, errmsg, return_value TSRMLS_CC);
++      if (fullpath) {
++              efree(fullpath);
++      }
++      zend_restore_error_handling(&error_handling TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto void sqlite_busy_timeout(resource db, int ms)
++   Set busy timeout duration. If ms <= 0, all busy handlers are disabled. */
++PHP_FUNCTION(sqlite_busy_timeout)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      long ms;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ms)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zdb, &ms)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      sqlite_busy_timeout(db->db, ms);
++}
++/* }}} */
++
++/* {{{ proto void sqlite_close(resource db)
++   Closes an open sqlite database. */
++PHP_FUNCTION(sqlite_close)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      zval *object = getThis();
++
++      if (object) {
++              php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Ignored, you must destruct the object instead");
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zdb)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      zend_hash_apply_with_argument(&EG(regular_list),
++              (apply_func_arg_t) _clean_unfinished_results,
++              db TSRMLS_CC);
++
++      zend_list_delete(Z_RESVAL_P(zdb));
++}
++/* }}} */
++
++/* {{{ php_sqlite_fetch */
++static int php_sqlite_fetch(struct php_sqlite_result *rres TSRMLS_DC)
++{
++      const char **rowdata, **colnames;
++      int ret, i, base;
++      char *errtext = NULL;
++
++next_row:
++      ret = sqlite_step(rres->vm, &rres->ncolumns, &rowdata, &colnames);
++      if (!rres->nrows) {
++              /* first row - lets copy the column names */
++              rres->col_names = safe_emalloc(rres->ncolumns, sizeof(char *), 0);
++              for (i = 0; i < rres->ncolumns; i++) {
++                      rres->col_names[i] = estrdup((char*)colnames[i]);
++
++                      if (SQLITE_G(assoc_case) == 1) {
++                              php_sqlite_strtoupper(rres->col_names[i]);
++                      } else if (SQLITE_G(assoc_case) == 2) {
++                              php_sqlite_strtolower(rres->col_names[i]);
++                      }
++              }
++              if (!rres->buffered) {
++                      /* non buffered mode - also fetch memory for on single row */
++                      rres->table = safe_emalloc(rres->ncolumns, sizeof(char *), 0);
++              }
++      }
++
++      switch (ret) {
++              case SQLITE_ROW:
++                      if (rres->buffered) {
++                              /* add the row to our collection */
++                              if (rres->nrows + 1 >= rres->alloc_rows) {
++                                      rres->alloc_rows = rres->alloc_rows ? rres->alloc_rows * 2 : 16;
++                                      rres->table = safe_erealloc(rres->table, rres->alloc_rows, rres->ncolumns*sizeof(char *), 0);
++                              }
++                              base = rres->nrows * rres->ncolumns;
++                              for (i = 0; i < rres->ncolumns; i++) {
++                                      if (rowdata[i]) {
++                                              rres->table[base + i] = estrdup(rowdata[i]);
++                                      } else {
++                                              rres->table[base + i] = NULL;
++                                      }
++                              }
++                              rres->nrows++;
++                              goto next_row;
++                      } else {
++                              /* non buffered: only fetch one row but first free data if not first row */
++                              if (rres->nrows++) {
++                                      for (i = 0; i < rres->ncolumns; i++) {
++                                              if (rres->table[i]) {
++                                                      efree(rres->table[i]);
++                                              }
++                                      }
++                              }
++                              for (i = 0; i < rres->ncolumns; i++) {
++                                      if (rowdata[i]) {
++                                              rres->table[i] = estrdup(rowdata[i]);
++                                      } else {
++                                              rres->table[i] = NULL;
++                                      }
++                              }
++                      }
++                      ret = SQLITE_OK;
++                      break;
++
++              case SQLITE_BUSY:
++              case SQLITE_ERROR:
++              case SQLITE_MISUSE:
++              case SQLITE_DONE:
++              default:
++                      if (rres->vm) {
++                              ret = sqlite_finalize(rres->vm, &errtext);
++                      }
++                      rres->vm = NULL;
++                      if (ret != SQLITE_OK) {
++                              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++                              sqlite_freemem(errtext);
++                      }
++                      break;
++      }
++      rres->db->last_err_code = ret;
++
++      return ret;
++}
++/* }}} */
++
++/* {{{ sqlite_query */
++void sqlite_query(zval *object, struct php_sqlite_db *db, char *sql, long sql_len, int mode, int buffered, zval *return_value, struct php_sqlite_result **prres, zval *errmsg TSRMLS_DC)
++{
++      struct php_sqlite_result res, *rres;
++      int ret;
++      char *errtext = NULL;
++      const char *tail;
++
++      memset(&res, 0, sizeof(res));
++      res.buffered = buffered;
++      res.mode = mode;
++
++      ret = sqlite_compile(db->db, sql, &tail, &res.vm, &errtext);
++      db->last_err_code = ret;
++
++      if (ret != SQLITE_OK) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++              if (errmsg) {
++                      ZVAL_STRING(errmsg, errtext, 1);
++              }
++              sqlite_freemem(errtext);
++              goto terminate;
++      } else if (!res.vm) { /* empty query */
++terminate:
++              if (return_value) {
++                      RETURN_FALSE;
++              } else {
++                      return;
++              }
++      }
++
++      if (!prres) {
++              rres = NULL;
++              prres = &rres;
++      }
++      if (!*prres) {
++              *prres = (struct php_sqlite_result*)emalloc(sizeof(**prres));
++      }
++      memcpy(*prres, &res, sizeof(**prres));
++      (*prres)->db = db;
++      zend_list_addref(db->rsrc_id);
++
++
++      /* now the result set is ready for stepping: get first row */
++      if (php_sqlite_fetch((*prres) TSRMLS_CC) != SQLITE_OK) {
++              real_result_dtor((*prres) TSRMLS_CC);
++              *prres = NULL;
++              if (return_value) {
++                      RETURN_FALSE;
++              } else {
++                      return;
++              }
++      }
++
++      (*prres)->curr_row = 0;
++
++      if (object) {
++              sqlite_object *obj;
++              if (buffered) {
++                      sqlite_instanciate(sqlite_ce_query, return_value TSRMLS_CC);
++              } else {
++                      sqlite_instanciate(sqlite_ce_ub_query, return_value TSRMLS_CC);
++              }
++              obj = (sqlite_object *) zend_object_store_get_object(return_value TSRMLS_CC);
++              obj->type = is_result;
++              obj->u.res = (*prres);
++      } else if (return_value) {
++              ZEND_REGISTER_RESOURCE(object ? NULL : return_value, (*prres), le_sqlite_result);
++      }
++}
++/* }}} */
++
++/* {{{ proto resource sqlite_unbuffered_query(string query, resource db [ , int result_type [, string &error_message]])
++   Executes a query that does not prefetch and buffer all data. */
++PHP_FUNCTION(sqlite_unbuffered_query)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      char *sql;
++      int sql_len;
++      long mode = PHPSQLITE_BOTH;
++      char *errtext = NULL;
++      zval *errmsg = NULL;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &sql, &sql_len, &mode, &errmsg)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
++                              ZEND_NUM_ARGS() TSRMLS_CC, "sr|lz/", &sql, &sql_len, &zdb, &mode, &errmsg) &&
++                      FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz/", &zdb, &sql, &sql_len, &mode, &errmsg)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      if (errmsg) {
++              zval_dtor(errmsg);
++              ZVAL_NULL(errmsg);
++      }
++
++      PHP_SQLITE_EMPTY_QUERY;
++
++      /* avoid doing work if we can */
++      if (!return_value_used) {
++              db->last_err_code = sqlite_exec(db->db, sql, NULL, NULL, &errtext);
++
++              if (db->last_err_code != SQLITE_OK) {
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++                      if (errmsg) {
++                              ZVAL_STRING(errmsg, errtext, 1);
++                      }
++                      sqlite_freemem(errtext);
++              }
++              return;
++      }
++
++      sqlite_query(object, db, sql, sql_len, (int)mode, 0, return_value, NULL, errmsg TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto resource sqlite_fetch_column_types(string table_name, resource db [, int result_type])
++   Return an array of column types from a particular table. */
++PHP_FUNCTION(sqlite_fetch_column_types)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      char *tbl, *sql;
++      int tbl_len;
++      char *errtext = NULL;
++      zval *object = getThis();
++      struct php_sqlite_result res;
++      const char **rowdata, **colnames, *tail;
++      int i, ncols;
++      long result_type = PHPSQLITE_ASSOC;
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &tbl, &tbl_len, &result_type)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
++                              ZEND_NUM_ARGS() TSRMLS_CC, "sr|l", &tbl, &tbl_len, &zdb, &result_type) &&
++                      FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &zdb, &tbl, &tbl_len, &result_type)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      if (!(sql = sqlite_mprintf("SELECT * FROM '%q' LIMIT 1", tbl))) {
++              RETURN_FALSE;
++      }
++
++      sqlite_exec(db->db, "PRAGMA show_datatypes = ON", NULL, NULL, NULL);
++
++      db->last_err_code = sqlite_compile(db->db, sql, &tail, &res.vm, &errtext);
++
++      sqlite_freemem(sql);
++
++      if (db->last_err_code != SQLITE_OK) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++              sqlite_freemem(errtext);
++              RETVAL_FALSE;
++              goto done;
++      }
++
++      sqlite_step(res.vm, &ncols, &rowdata, &colnames);
++
++      array_init(return_value);
++
++      for (i = 0; i < ncols; i++) {
++              if (result_type == PHPSQLITE_ASSOC) {
++                      char *colname = estrdup((char *)colnames[i]);
++
++                      if (SQLITE_G(assoc_case) == 1) {
++                              php_sqlite_strtoupper(colname);
++                      } else if (SQLITE_G(assoc_case) == 2) {
++                              php_sqlite_strtolower(colname);
++                      }
++
++                      add_assoc_string(return_value, colname, colnames[ncols + i] ? (char *)colnames[ncols + i] : "", 1);
++                      efree(colname);
++              }
++              if (result_type == PHPSQLITE_NUM) {
++                      add_index_string(return_value, i, colnames[ncols + i] ? (char *)colnames[ncols + i] : "", 1);
++              }
++      }
++      if (res.vm) {
++              sqlite_finalize(res.vm, NULL);
++      }
++done:
++      sqlite_exec(db->db, "PRAGMA show_datatypes = OFF", NULL, NULL, NULL);
++}
++/* }}} */
++
++/* {{{ proto resource sqlite_query(string query, resource db [, int result_type [, string &error_message]])
++   Executes a query against a given database and returns a result handle. */
++PHP_FUNCTION(sqlite_query)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      char *sql;
++      int sql_len;
++      long mode = PHPSQLITE_BOTH;
++      char *errtext = NULL;
++      zval *errmsg = NULL;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &sql, &sql_len, &mode, &errmsg)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
++                              ZEND_NUM_ARGS() TSRMLS_CC, "sr|lz/", &sql, &sql_len, &zdb, &mode, &errmsg) &&
++                      FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz/", &zdb, &sql, &sql_len, &mode, &errmsg)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      if (errmsg) {
++              zval_dtor(errmsg);
++              ZVAL_NULL(errmsg);
++      }
++
++      PHP_SQLITE_EMPTY_QUERY;
++
++      /* avoid doing work if we can */
++      if (!return_value_used) {
++              db->last_err_code = sqlite_exec(db->db, sql, NULL, NULL, &errtext);
++
++              if (db->last_err_code != SQLITE_OK) {
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++                      if (errmsg) {
++                              ZVAL_STRING(errmsg, errtext, 1);
++                      }
++                      sqlite_freemem(errtext);
++              }
++              return;
++      }
++
++      sqlite_query(object, db, sql, sql_len, (int)mode, 1, return_value, NULL, errmsg TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto boolean sqlite_exec(string query, resource db[, string &error_message])
++   Executes a result-less query against a given database */
++PHP_FUNCTION(sqlite_exec)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      char *sql;
++      int sql_len;
++      char *errtext = NULL;
++      zval *errmsg = NULL;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &sql, &sql_len, &errmsg)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if(FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
++                      ZEND_NUM_ARGS() TSRMLS_CC, "sr", &sql, &sql_len, &zdb) &&
++                 FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &zdb, &sql, &sql_len, &errmsg)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      if (errmsg) {
++              zval_dtor(errmsg);
++              ZVAL_NULL(errmsg);
++      }
++
++      PHP_SQLITE_EMPTY_QUERY;
++
++      db->last_err_code = sqlite_exec(db->db, sql, NULL, NULL, &errtext);
++
++      if (db->last_err_code != SQLITE_OK) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++              if (errmsg) {
++                      ZVAL_STRING(errmsg, errtext, 1);
++              }
++              sqlite_freemem(errtext);
++              RETURN_FALSE;
++      }
++
++      RETURN_TRUE;
++}
++/* }}} */
++
++/* {{{ php_sqlite_fetch_array */
++static void php_sqlite_fetch_array(struct php_sqlite_result *res, int mode, zend_bool decode_binary, int move_next, zval *return_value TSRMLS_DC)
++{
++      int j, n = res->ncolumns, buffered = res->buffered;
++      const char **rowdata, **colnames;
++
++      /* check range of the row */
++      if (res->curr_row >= res->nrows) {
++              /* no more */
++              RETURN_FALSE;
++      }
++      colnames = (const char**)res->col_names;
++      if (res->buffered) {
++              rowdata = (const char**)&res->table[res->curr_row * res->ncolumns];
++      } else {
++              rowdata = (const char**)res->table;
++      }
++
++      /* now populate the result */
++      array_init(return_value);
++
++      for (j = 0; j < n; j++) {
++              zval *decoded;
++              MAKE_STD_ZVAL(decoded);
++
++              if (rowdata[j] == NULL) {
++                      ZVAL_NULL(decoded);
++              } else if (decode_binary && rowdata[j][0] == '\x01') {
++                      Z_STRVAL_P(decoded) = emalloc(strlen(rowdata[j]));
++                      Z_STRLEN_P(decoded) = php_sqlite_decode_binary(rowdata[j]+1, Z_STRVAL_P(decoded));
++                      Z_STRVAL_P(decoded)[Z_STRLEN_P(decoded)] = '\0';
++                      Z_TYPE_P(decoded) = IS_STRING;
++                      if (!buffered) {
++                              efree((char*)rowdata[j]);
++                              rowdata[j] = NULL;
++                      }
++              } else {
++                      ZVAL_STRING(decoded, (char*)rowdata[j], buffered);
++                      if (!buffered) {
++                              rowdata[j] = NULL;
++                      }
++              }
++
++              if (mode & PHPSQLITE_NUM) {
++                      if (mode & PHPSQLITE_ASSOC) {
++                              add_index_zval(return_value, j, decoded);
++                              Z_ADDREF_P(decoded);
++                              add_assoc_zval(return_value, (char*)colnames[j], decoded);
++                      } else {
++                              add_next_index_zval(return_value, decoded);
++                      }
++              } else {
++                      add_assoc_zval(return_value, (char*)colnames[j], decoded);
++              }
++      }
++
++      if (move_next) {
++              if (!res->buffered) {
++                      /* non buffered: fetch next row */
++                      php_sqlite_fetch(res TSRMLS_CC);
++              }
++              /* advance the row pointer */
++              res->curr_row++;
++      }
++}
++/* }}} */
++
++/* {{{ php_sqlite_fetch_column */
++static void php_sqlite_fetch_column(struct php_sqlite_result *res, zval *which, zend_bool decode_binary, zval *return_value TSRMLS_DC)
++{
++      int j;
++      const char **rowdata, **colnames;
++
++      /* check range of the row */
++      if (res->curr_row >= res->nrows) {
++              /* no more */
++              RETURN_FALSE;
++      }
++      colnames = (const char**)res->col_names;
++
++      if (Z_TYPE_P(which) == IS_LONG) {
++              j = Z_LVAL_P(which);
++      } else {
++              convert_to_string_ex(&which);
++              for (j = 0; j < res->ncolumns; j++) {
++                      if (!strcasecmp((char*)colnames[j], Z_STRVAL_P(which))) {
++                              break;
++                      }
++              }
++      }
++      if (j < 0 || j >= res->ncolumns) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such column %d", j);
++              RETURN_FALSE;
++      }
++
++      if (res->buffered) {
++              rowdata = (const char**)&res->table[res->curr_row * res->ncolumns];
++      } else {
++              rowdata = (const char**)res->table;
++      }
++
++      if (rowdata[j] == NULL) {
++              RETURN_NULL();
++      } else if (decode_binary && rowdata[j] != NULL && rowdata[j][0] == '\x01') {
++              int l = strlen(rowdata[j]);
++              char *decoded = emalloc(l);
++              l = php_sqlite_decode_binary(rowdata[j]+1, decoded);
++              decoded[l] = '\0';
++              RETVAL_STRINGL(decoded, l, 0);
++              if (!res->buffered) {
++                      efree((char*)rowdata[j]);
++                      rowdata[j] = NULL;
++              }
++      } else {
++              RETVAL_STRING((char*)rowdata[j], res->buffered);
++              if (!res->buffered) {
++                      rowdata[j] = NULL;
++              }
++      }
++}
++/* }}} */
++
++/* {{{ proto array sqlite_fetch_all(resource result [, int result_type [, bool decode_binary]])
++   Fetches all rows from a result set as an array of arrays. */
++PHP_FUNCTION(sqlite_fetch_all)
++{
++      zval *zres, *ent;
++      long mode = PHPSQLITE_BOTH;
++      zend_bool decode_binary = 1;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", &mode, &decode_binary)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++              if (!ZEND_NUM_ARGS()) {
++                      mode = res->mode;
++              }
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lb", &zres, &mode, &decode_binary)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++              if (ZEND_NUM_ARGS() < 2) {
++                      mode = res->mode;
++              }
++      }
++
++      if (res->curr_row >= res->nrows && res->nrows) {
++              if (!res->buffered) {
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "One or more rowsets were already returned; returning NULL this time");
++              } else {
++                      res->curr_row = 0;
++              }
++      }
++
++      array_init(return_value);
++
++      while (res->curr_row < res->nrows) {
++              MAKE_STD_ZVAL(ent);
++              php_sqlite_fetch_array(res, mode, decode_binary, 1, ent TSRMLS_CC);
++              add_next_index_zval(return_value, ent);
++      }
++}
++/* }}} */
++
++/* {{{ proto array sqlite_fetch_array(resource result [, int result_type [, bool decode_binary]])
++   Fetches the next row from a result set as an array. */
++PHP_FUNCTION(sqlite_fetch_array)
++{
++      zval *zres;
++      long mode = PHPSQLITE_BOTH;
++      zend_bool decode_binary = 1;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", &mode, &decode_binary)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++              if (!ZEND_NUM_ARGS()) {
++                      mode = res->mode;
++              }
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lb", &zres, &mode, &decode_binary)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++              if (ZEND_NUM_ARGS() < 2) {
++                      mode = res->mode;
++              }
++      }
++
++      php_sqlite_fetch_array(res, mode, decode_binary, 1, return_value TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto object sqlite_fetch_object(resource result [, string class_name [, NULL|array ctor_params [, bool decode_binary]]])
++   Fetches the next row from a result set as an object. */
++   /* note that you can do array(&$val) for param ctor_params */
++PHP_FUNCTION(sqlite_fetch_object)
++{
++      zval *zres;
++      zend_bool decode_binary = 1;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++      char *class_name = NULL;
++      int class_name_len;
++      zend_class_entry *ce;
++      zval dataset;
++      zend_fcall_info fci;
++      zend_fcall_info_cache fcc;
++      zval *retval_ptr;
++      zval *ctor_params = NULL;
++      zend_error_handling error_handling;
++
++      zend_replace_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception, &error_handling TSRMLS_CC);
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|szb", &class_name, &class_name_len, &ctor_params, &decode_binary)) {
++                      zend_restore_error_handling(&error_handling TSRMLS_CC);
++                      return;
++              }
++              RES_FROM_OBJECT_RESTORE_ERH(res, object, &error_handling);
++              if (!class_name) {
++                      ce = zend_standard_class_def;
++              } else {
++                      ce = zend_fetch_class(class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
++              }
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|szb", &zres, &class_name, &class_name_len, &ctor_params, &decode_binary)) {
++                      zend_restore_error_handling(&error_handling TSRMLS_CC);
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++              if (!class_name) {
++                      ce = zend_standard_class_def;
++              } else {
++                      ce = zend_fetch_class(class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
++              }
++      }
++
++      if (!ce) {
++              zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not find class '%s'", class_name);
++              zend_restore_error_handling(&error_handling TSRMLS_CC);
++              return;
++      }
++
++      if (res->curr_row < res->nrows) {
++              php_sqlite_fetch_array(res, PHPSQLITE_ASSOC, decode_binary, 1, &dataset TSRMLS_CC);
++      } else {
++              zend_restore_error_handling(&error_handling TSRMLS_CC);
++              RETURN_FALSE;
++      }
++
++      object_and_properties_init(return_value, ce, NULL);
++      zend_merge_properties(return_value, Z_ARRVAL(dataset), 1 TSRMLS_CC);
++
++      zend_restore_error_handling(&error_handling TSRMLS_CC);
++
++      if (ce->constructor) {
++              fci.size = sizeof(fci);
++              fci.function_table = &ce->function_table;
++              fci.function_name = NULL;
++              fci.symbol_table = NULL;
++              fci.object_ptr = return_value;
++              fci.retval_ptr_ptr = &retval_ptr;
++              if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
++                      if (Z_TYPE_P(ctor_params) == IS_ARRAY) {
++                              HashTable *ht = Z_ARRVAL_P(ctor_params);
++                              Bucket *p;
++
++                              fci.param_count = 0;
++                              fci.params = safe_emalloc(sizeof(zval*), ht->nNumOfElements, 0);
++                              p = ht->pListHead;
++                              while (p != NULL) {
++                                      fci.params[fci.param_count++] = (zval**)p->pData;
++                                      p = p->pListNext;
++                              }
++                      } else {
++                              /* Two problems why we throw exceptions here: PHP is typeless
++                               * and hence passing one argument that's not an array could be
++                               * by mistake and the other way round is possible, too. The
++                               * single value is an array. Also we'd have to make that one
++                               * argument passed by reference.
++                               */
++                              zend_throw_exception(sqlite_ce_exception, "Parameter ctor_params must be an array", 0 TSRMLS_CC);
++                              return;
++                      }
++              } else {
++                      fci.param_count = 0;
++                      fci.params = NULL;
++              }
++              fci.no_separation = 1;
++
++              fcc.initialized = 1;
++              fcc.function_handler = ce->constructor;
++              fcc.calling_scope = EG(scope);
++              fcc.called_scope = Z_OBJCE_P(return_value);
++              fcc.object_ptr = return_value;
++
++              if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
++                      zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not execute %s::%s()", class_name, ce->constructor->common.function_name);
++              } else {
++                      if (retval_ptr) {
++                              zval_ptr_dtor(&retval_ptr);
++                      }
++              }
++              if (fci.params) {
++                      efree(fci.params);
++              }
++      } else if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
++              zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name);
++      }
++}
++/* }}} */
++
++/* {{{ proto array sqlite_array_query(resource db, string query [ , int result_type [, bool decode_binary]])
++   Executes a query against a given database and returns an array of arrays. */
++PHP_FUNCTION(sqlite_array_query)
++{
++      zval *zdb, *ent;
++      struct php_sqlite_db *db;
++      struct php_sqlite_result *rres;
++      char *sql;
++      int sql_len;
++      long mode = PHPSQLITE_BOTH;
++      char *errtext = NULL;
++      zend_bool decode_binary = 1;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lb", &sql, &sql_len, &mode, &decode_binary)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
++                              ZEND_NUM_ARGS() TSRMLS_CC, "sr|lb", &sql, &sql_len, &zdb, &mode, &decode_binary) &&
++                      FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lb", &zdb, &sql, &sql_len, &mode, &decode_binary)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      PHP_SQLITE_EMPTY_QUERY;
++
++      /* avoid doing work if we can */
++      if (!return_value_used) {
++              db->last_err_code = sqlite_exec(db->db, sql, NULL, NULL, &errtext);
++
++              if (db->last_err_code != SQLITE_OK) {
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++                      sqlite_freemem(errtext);
++              }
++              return;
++      }
++
++      rres = (struct php_sqlite_result *)ecalloc(1, sizeof(*rres));
++      sqlite_query(NULL, db, sql, sql_len, (int)mode, 0, NULL, &rres, NULL TSRMLS_CC);
++      if (db->last_err_code != SQLITE_OK) {
++              if (rres) {
++                      efree(rres);
++              }
++              RETURN_FALSE;
++      }
++
++      array_init(return_value);
++
++      while (rres->curr_row < rres->nrows) {
++              MAKE_STD_ZVAL(ent);
++              php_sqlite_fetch_array(rres, mode, decode_binary, 1, ent TSRMLS_CC);
++              add_next_index_zval(return_value, ent);
++      }
++      real_result_dtor(rres TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ php_sqlite_fetch_single */
++static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool decode_binary, zval *return_value TSRMLS_DC)
++{
++      const char **rowdata;
++      char *decoded;
++      int decoded_len;
++
++      /* check range of the row */
++      if (res->curr_row >= res->nrows) {
++              /* no more */
++              RETURN_FALSE;
++      }
++
++      if (res->buffered) {
++              rowdata = (const char**)&res->table[res->curr_row * res->ncolumns];
++      } else {
++              rowdata = (const char**)res->table;
++      }
++
++      if (decode_binary && rowdata[0] != NULL && rowdata[0][0] == '\x01') {
++              decoded = emalloc(strlen(rowdata[0]));
++              decoded_len = php_sqlite_decode_binary(rowdata[0]+1, decoded);
++              if (!res->buffered) {
++                      efree((char*)rowdata[0]);
++                      rowdata[0] = NULL;
++              }
++      } else if (rowdata[0]) {
++              decoded_len = strlen((char*)rowdata[0]);
++              if (res->buffered) {
++                      decoded = estrndup((char*)rowdata[0], decoded_len);
++              } else {
++                      decoded = (char*)rowdata[0];
++                      rowdata[0] = NULL;
++              }
++      } else {
++              decoded = NULL;
++              decoded_len = 0;
++      }
++
++      if (!res->buffered) {
++              /* non buffered: fetch next row */
++              php_sqlite_fetch(res TSRMLS_CC);
++      }
++      /* advance the row pointer */
++      res->curr_row++;
++
++      if (decoded == NULL) {
++              RETURN_NULL();
++      } else {
++              RETURN_STRINGL(decoded, decoded_len, 0);
++      }
++}
++/* }}} */
++
++
++/* {{{ proto array sqlite_single_query(resource db, string query [, bool first_row_only [, bool decode_binary]])
++   Executes a query and returns either an array for one single column or the value of the first row. */
++PHP_FUNCTION(sqlite_single_query)
++{
++      zval *zdb, *ent;
++      struct php_sqlite_db *db;
++      struct php_sqlite_result *rres;
++      char *sql;
++      int sql_len;
++      char *errtext = NULL;
++      zend_bool decode_binary = 1;
++      zend_bool srow = 1;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bb", &sql, &sql_len, &srow, &decode_binary)) {
++                      return;
++              }
++              RES_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
++                              ZEND_NUM_ARGS() TSRMLS_CC, "sr|bb", &sql, &sql_len, &zdb, &srow, &decode_binary) &&
++                      FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|bb", &zdb, &sql, &sql_len, &srow, &decode_binary)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      PHP_SQLITE_EMPTY_QUERY;
++
++      /* avoid doing work if we can */
++      if (!return_value_used) {
++              db->last_err_code = sqlite_exec(db->db, sql, NULL, NULL, &errtext);
++
++              if (db->last_err_code != SQLITE_OK) {
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
++                      sqlite_freemem(errtext);
++              }
++              return;
++      }
++
++      rres = (struct php_sqlite_result *)ecalloc(1, sizeof(*rres));
++      sqlite_query(NULL, db, sql, sql_len, PHPSQLITE_NUM, 0, NULL, &rres, NULL TSRMLS_CC);
++      if (db->last_err_code != SQLITE_OK) {
++              if (rres) {
++                      efree(rres);
++              }
++              RETURN_FALSE;
++      }
++
++      if (!srow) {
++              array_init(return_value);
++      }
++
++      while (rres->curr_row < rres->nrows) {
++              MAKE_STD_ZVAL(ent);
++              php_sqlite_fetch_single(rres, decode_binary, ent TSRMLS_CC);
++
++              /* if set and we only have 1 row in the result set, return the result as a string. */
++              if (srow) {
++                      if (rres->curr_row == 1 && rres->curr_row >= rres->nrows) {
++                              *return_value = *ent;
++                              zval_copy_ctor(return_value);
++                              zval_dtor(ent);
++                              FREE_ZVAL(ent);
++                              break;
++                      } else {
++                              srow = 0;
++                              array_init(return_value);
++                      }
++              }
++              add_next_index_zval(return_value, ent);
++      }
++
++      real_result_dtor(rres TSRMLS_CC);
++}
++/* }}} */
++
++
++/* {{{ proto string sqlite_fetch_single(resource result [, bool decode_binary])
++   Fetches the first column of a result set as a string. */
++PHP_FUNCTION(sqlite_fetch_single)
++{
++      zval *zres;
++      zend_bool decode_binary = 1;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &decode_binary)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|b", &zres, &decode_binary)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      php_sqlite_fetch_single(res, decode_binary, return_value TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto array sqlite_current(resource result [, int result_type [, bool decode_binary]])
++   Fetches the current row from a result set as an array. */
++PHP_FUNCTION(sqlite_current)
++{
++      zval *zres;
++      long mode = PHPSQLITE_BOTH;
++      zend_bool decode_binary = 1;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (ZEND_NUM_ARGS() && FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", &mode, &decode_binary)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++              if (!ZEND_NUM_ARGS()) {
++                      mode = res->mode;
++              }
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lb", &zres, &mode, &decode_binary)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++              if (ZEND_NUM_ARGS() < 2) {
++                      mode = res->mode;
++              }
++      }
++
++      php_sqlite_fetch_array(res, mode, decode_binary, 0, return_value TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto mixed sqlite_column(resource result, mixed index_or_name [, bool decode_binary])
++   Fetches a column from the current row of a result set. */
++PHP_FUNCTION(sqlite_column)
++{
++      zval *zres;
++      zval *which;
++      zend_bool decode_binary = 1;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &which, &decode_binary)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|b", &zres, &which, &decode_binary)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      php_sqlite_fetch_column(res, which, decode_binary, return_value TSRMLS_CC);
++}
++/* }}} */
++
++/* {{{ proto string sqlite_libversion()
++   Returns the version of the linked SQLite library. */
++PHP_FUNCTION(sqlite_libversion)
++{
++      if (zend_parse_parameters_none() == FAILURE) {
++              return;
++      }
++      RETURN_STRING((char*)sqlite_libversion(), 1);
++}
++/* }}} */
++
++/* {{{ proto string sqlite_libencoding()
++   Returns the encoding (iso8859 or UTF-8) of the linked SQLite library. */
++PHP_FUNCTION(sqlite_libencoding)
++{
++      if (zend_parse_parameters_none() == FAILURE) {
++              return;
++      }
++      RETURN_STRING((char*)sqlite_libencoding(), 1);
++}
++/* }}} */
++
++/* {{{ proto int sqlite_changes(resource db)
++   Returns the number of rows that were changed by the most recent SQL statement. */
++PHP_FUNCTION(sqlite_changes)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zdb)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      RETURN_LONG(sqlite_changes(db->db));
++}
++/* }}} */
++
++/* {{{ proto int sqlite_last_insert_rowid(resource db)
++   Returns the rowid of the most recently inserted row. */
++PHP_FUNCTION(sqlite_last_insert_rowid)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zdb)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      RETURN_LONG(sqlite_last_insert_rowid(db->db));
++}
++/* }}} */
++
++static int sqlite_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
++{
++      sqlite_object *obj = (sqlite_object*) zend_object_store_get_object(object TSRMLS_CC);
++
++      if (obj->u.res == NULL) {
++              zend_throw_exception(sqlite_ce_exception, "Row count is not available for this query", 0 TSRMLS_CC);
++              return FAILURE;
++      }
++
++      if (obj->u.res->buffered) {
++              * count = obj->u.res->nrows;
++              return SUCCESS;
++      } else {
++              zend_throw_exception(sqlite_ce_exception, "Row count is not available for unbuffered queries", 0 TSRMLS_CC);
++              return FAILURE;
++      }
++} /* }}} */
++
++/* {{{ proto int sqlite_num_rows(resource result)
++   Returns the number of rows in a buffered result set. */
++PHP_FUNCTION(sqlite_num_rows)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if (res->buffered) {
++              RETURN_LONG(res->nrows);
++      } else {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Row count is not available for unbuffered queries");
++              RETURN_FALSE;
++      }
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_valid(resource result)
++   Returns whether more rows are available. */
++PHP_FUNCTION(sqlite_valid)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      RETURN_BOOL(res->curr_row < res->nrows && res->nrows); /* curr_row may be -1 */
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_has_prev(resource result)
++ * Returns whether a previous row is available. */
++PHP_FUNCTION(sqlite_has_prev)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if(!res->buffered) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "you cannot use sqlite_has_prev on unbuffered querys");
++              RETURN_FALSE;
++      }
++
++      RETURN_BOOL(res->curr_row);
++}
++/* }}} */
++
++/* {{{ proto int sqlite_num_fields(resource result)
++   Returns the number of fields in a result set. */
++PHP_FUNCTION(sqlite_num_fields)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      RETURN_LONG(res->ncolumns);
++}
++/* }}} */
++
++/* {{{ proto string sqlite_field_name(resource result, int field_index)
++   Returns the name of a particular field of a result set. */
++PHP_FUNCTION(sqlite_field_name)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      long field;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &field)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zres, &field)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if (field < 0 || field >= res->ncolumns) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "field %ld out of range", field);
++              RETURN_FALSE;
++      }
++
++      RETURN_STRING(res->col_names[field], 1);
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_seek(resource result, int row)
++   Seek to a particular row number of a buffered result set. */
++PHP_FUNCTION(sqlite_seek)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      long row;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &row)) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zres, &row)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if (!res->buffered) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot seek an unbuffered result set");
++              RETURN_FALSE;
++      }
++
++      if (row < 0 || row >= res->nrows) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "row %ld out of range", row);
++              RETURN_FALSE;
++      }
++
++      res->curr_row = row;
++      RETURN_TRUE;
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_rewind(resource result)
++   Seek to the first row number of a buffered result set. */
++PHP_FUNCTION(sqlite_rewind)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if (!res->buffered) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot rewind an unbuffered result set");
++              RETURN_FALSE;
++      }
++
++      if (!res->nrows) {
++              php_error_docref(NULL TSRMLS_CC, E_NOTICE, "no rows received");
++              RETURN_FALSE;
++      }
++
++      res->curr_row = 0;
++      RETURN_TRUE;
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_next(resource result)
++   Seek to the next row number of a result set. */
++PHP_FUNCTION(sqlite_next)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if (!res->buffered && res->vm) {
++              php_sqlite_fetch(res TSRMLS_CC);
++      }
++
++      if (res->curr_row >= res->nrows) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "no more rows available");
++              RETURN_FALSE;
++      }
++
++      res->curr_row++;
++
++      RETURN_TRUE;
++}
++/* }}} */
++
++/* {{{ proto int sqlite_key(resource result)
++   Return the current row index of a buffered result. */
++PHP_FUNCTION(sqlite_key)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      RETURN_LONG(res->curr_row);
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_prev(resource result)
++ * Seek to the previous row number of a result set. */
++PHP_FUNCTION(sqlite_prev)
++{
++      zval *zres;
++      struct php_sqlite_result *res;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              RES_FROM_OBJECT(res, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zres)) {
++                      return;
++              }
++              ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result);
++      }
++
++      if (!res->buffered) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "you cannot use sqlite_prev on unbuffered querys");
++              RETURN_FALSE;
++      }
++
++      if (res->curr_row <= 0) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "no previous row available");
++              RETURN_FALSE;
++      }
++
++      res->curr_row--;
++
++      RETURN_TRUE;
++}
++/* }}} */
++
++/* {{{ proto string sqlite_escape_string(string item)
++   Escapes a string for use as a query parameter. */
++PHP_FUNCTION(sqlite_escape_string)
++{
++      char *string = NULL;
++      int stringlen;
++      char *ret;
++
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &stringlen)) {
++              return;
++      }
++
++      if (stringlen && (string[0] == '\x01' || memchr(string, '\0', stringlen) != NULL)) {
++              /* binary string */
++              int enclen;
++
++              ret = safe_emalloc(1 + stringlen / 254, 257, 3);
++              ret[0] = '\x01';
++              enclen = php_sqlite_encode_binary(string, stringlen, ret+1);
++              RETVAL_STRINGL(ret, enclen+1, 0);
++
++      } else if (stringlen) {
++              ret = sqlite_mprintf("%q", string);
++              if (ret) {
++                      RETVAL_STRING(ret, 1);
++                      sqlite_freemem(ret);
++              }
++      } else {
++              RETURN_EMPTY_STRING();
++      }
++}
++/* }}} */
++
++/* {{{ proto int sqlite_last_error(resource db)
++   Returns the error code of the last error for a database. */
++PHP_FUNCTION(sqlite_last_error)
++{
++      zval *zdb;
++      struct php_sqlite_db *db;
++      zval *object = getThis();
++
++      if (object) {
++              if (zend_parse_parameters_none() == FAILURE) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zdb)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      RETURN_LONG(db->last_err_code);
++}
++/* }}} */
++
++/* {{{ proto string sqlite_error_string(int error_code)
++   Returns the textual description of an error code. */
++PHP_FUNCTION(sqlite_error_string)
++{
++      long code;
++      const char *msg;
++
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code)) {
++              return;
++      }
++
++      msg = sqlite_error_string(code);
++
++      if (msg) {
++              RETURN_STRING((char*)msg, 1);
++      } else {
++              RETURN_NULL();
++      }
++}
++/* }}} */
++
++/* manages duplicate registrations of a particular function, and
++ * also handles the case where the db is using a persistent connection */
++enum callback_prep_t { DO_REG, SKIP_REG, ERR };
++
++static enum callback_prep_t prep_callback_struct(struct php_sqlite_db *db, int is_agg,
++              char *funcname,
++              zval *step, zval *fini, struct php_sqlite_agg_functions **funcs)
++{
++      struct php_sqlite_agg_functions *alloc_funcs, func_tmp;
++      char *hashkey;
++      int hashkeylen;
++      enum callback_prep_t ret;
++
++      hashkeylen = spprintf(&hashkey, 0, "%s-%s", is_agg ? "agg" : "reg", funcname);
++
++      /* is it already registered ? */
++      if (SUCCESS == zend_hash_find(&db->callbacks, hashkey, hashkeylen+1, (void*)&alloc_funcs)) {
++              /* override the previous definition */
++
++              if (alloc_funcs->is_valid) {
++                      /* release these */
++
++                      if (alloc_funcs->step) {
++                              zval_ptr_dtor(&alloc_funcs->step);
++                              alloc_funcs->step = NULL;
++                      }
++
++                      if (alloc_funcs->fini) {
++                              zval_ptr_dtor(&alloc_funcs->fini);
++                              alloc_funcs->fini = NULL;
++                      }
++              }
++
++              ret = SKIP_REG;
++      } else {
++              /* add a new one */
++              func_tmp.db = db;
++
++              ret = SUCCESS == zend_hash_update(&db->callbacks, hashkey, hashkeylen+1,
++                              (void*)&func_tmp, sizeof(func_tmp), (void**)&alloc_funcs) ? DO_REG : ERR;
++      }
++
++      efree(hashkey);
++
++      MAKE_STD_ZVAL(alloc_funcs->step);
++      *(alloc_funcs->step)  = *step;
++      zval_copy_ctor(alloc_funcs->step);
++      INIT_PZVAL(alloc_funcs->step);
++
++      if (is_agg) {
++              MAKE_STD_ZVAL(alloc_funcs->fini);
++              *(alloc_funcs->fini) = *fini;
++              zval_copy_ctor(alloc_funcs->fini);
++              INIT_PZVAL(alloc_funcs->fini);
++      } else {
++              alloc_funcs->fini = NULL;
++      }
++      alloc_funcs->is_valid = 1;
++      *funcs = alloc_funcs;
++
++      return ret;
++}
++
++
++/* {{{ proto bool sqlite_create_aggregate(resource db, string funcname, mixed step_func, mixed finalize_func[, long num_args])
++    Registers an aggregate function for queries. */
++PHP_FUNCTION(sqlite_create_aggregate)
++{
++      char *funcname = NULL;
++      int funcname_len;
++      zval *zstep, *zfinal, *zdb;
++      struct php_sqlite_db *db;
++      struct php_sqlite_agg_functions *funcs;
++      char *callable = NULL;
++      long num_args = -1;
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &funcname, &funcname_len, &zstep, &zfinal, &num_args)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rszz|l", &zdb, &funcname, &funcname_len, &zstep, &zfinal, &num_args)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      if (!zend_is_callable(zstep, 0, &callable TSRMLS_CC)) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "step function `%s' is not callable", callable);
++              efree(callable);
++              return;
++      }
++      efree(callable);
++
++      if (!zend_is_callable(zfinal, 0, &callable TSRMLS_CC)) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "finalize function `%s' is not callable", callable);
++              efree(callable);
++              return;
++      }
++      efree(callable);
++
++
++      if (prep_callback_struct(db, 1, funcname, zstep, zfinal, &funcs) == DO_REG) {
++              sqlite_create_aggregate(db->db, funcname, num_args,
++                              php_sqlite_agg_step_function_callback,
++                              php_sqlite_agg_fini_function_callback, funcs);
++      }
++
++
++}
++/* }}} */
++
++/* {{{ proto bool sqlite_create_function(resource db, string funcname, mixed callback[, long num_args])
++    Registers a "regular" function for queries. */
++PHP_FUNCTION(sqlite_create_function)
++{
++      char *funcname = NULL;
++      int funcname_len;
++      zval *zcall, *zdb;
++      struct php_sqlite_db *db;
++      struct php_sqlite_agg_functions *funcs;
++      char *callable = NULL;
++      long num_args = -1;
++
++      zval *object = getThis();
++
++      if (object) {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &funcname, &funcname_len, &zcall, &num_args)) {
++                      return;
++              }
++              DB_FROM_OBJECT(db, object);
++      } else {
++              if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz|l", &zdb, &funcname, &funcname_len, &zcall, &num_args)) {
++                      return;
++              }
++              DB_FROM_ZVAL(db, &zdb);
++      }
++
++      if (!zend_is_callable(zcall, 0, &callable TSRMLS_CC)) {
++              php_error_docref(NULL TSRMLS_CC, E_WARNING, "function `%s' is not callable", callable);
++              efree(callable);
++              return;
++      }
++      efree(callable);
++
++      if (prep_callback_struct(db, 0, funcname, zcall, NULL, &funcs) == DO_REG) {
++              sqlite_create_function(db->db, funcname, num_args, php_sqlite_function_callback, funcs);
++      }
++}
++/* }}} */
++
++/* {{{ proto string sqlite_udf_encode_binary(string data)
++   Apply binary encoding (if required) to a string to return from an UDF. */
++PHP_FUNCTION(sqlite_udf_encode_binary)
++{
++      char *data = NULL;
++      int datalen;
++
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!", &data, &datalen)) {
++              return;
++      }
++
++      if (data == NULL) {
++              RETURN_NULL();
++      }
++      if (datalen && (data[0] == '\x01' || memchr(data, '\0', datalen) != NULL)) {
++              /* binary string */
++              int enclen;
++              char *ret;
++
++              ret = safe_emalloc(1 + datalen / 254, 257, 3);
++              ret[0] = '\x01';
++              enclen = php_sqlite_encode_binary(data, datalen, ret+1);
++              RETVAL_STRINGL(ret, enclen+1, 0);
++      } else {
++              RETVAL_STRINGL(data, datalen, 1);
++      }
++}
++/* }}} */
++
++/* {{{ proto string sqlite_udf_decode_binary(string data)
++   Decode binary encoding on a string parameter passed to an UDF. */
++PHP_FUNCTION(sqlite_udf_decode_binary)
++{
++      char *data = NULL;
++      int datalen;
++
++      if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!", &data, &datalen)) {
++              return;
++      }
++
++      if (data == NULL) {
++              RETURN_NULL();
++      }
++      if (datalen && data[0] == '\x01') {
++              /* encoded string */
++              int enclen;
++              char *ret;
++
++              ret = emalloc(datalen);
++              enclen = php_sqlite_decode_binary(data+1, ret);
++              ret[enclen] = '\0';
++              RETVAL_STRINGL(ret, enclen, 0);
++      } else {
++              RETVAL_STRINGL(data, datalen, 1);
++      }
++}
++/* }}} */
++
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * End:
++ * vim600: sw=4 ts=4 fdm=marker
++ * vim<600: sw=4 ts=4
++ */
+--- /dev/null
++++ b/ext/sqlite/sqlite.dsp
+@@ -0,0 +1,339 @@
++# Microsoft Developer Studio Project File - Name="sqlite" - Package Owner=<4>\r
++# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
++# ** DO NOT EDIT **\r
++\r
++# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
++\r
++CFG=sqlite - Win32 Debug_TS\r
++!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
++!MESSAGE use the Export Makefile command and run\r
++!MESSAGE \r
++!MESSAGE NMAKE /f "sqlite.mak".\r
++!MESSAGE \r
++!MESSAGE You can specify a configuration when running NMAKE\r
++!MESSAGE by defining the macro CFG on the command line. For example:\r
++!MESSAGE \r
++!MESSAGE NMAKE /f "sqlite.mak" CFG="sqlite - Win32 Debug_TS"\r
++!MESSAGE \r
++!MESSAGE Possible choices for configuration are:\r
++!MESSAGE \r
++!MESSAGE "sqlite - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")\r
++!MESSAGE "sqlite - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")\r
++!MESSAGE \r
++\r
++# Begin Project\r
++# PROP AllowPerConfigDependencies 0\r
++# PROP Scc_ProjName ""\r
++# PROP Scc_LocalPath ""\r
++CPP=cl.exe\r
++MTL=midl.exe\r
++RSC=rc.exe\r
++\r
++!IF  "$(CFG)" == "sqlite - Win32 Release_TS"\r
++\r
++# PROP BASE Use_MFC 0\r
++# PROP BASE Use_Debug_Libraries 0\r
++# PROP BASE Output_Dir "Release_TS"\r
++# PROP BASE Intermediate_Dir "Release_TS"\r
++# PROP BASE Ignore_Export_Lib 0\r
++# PROP BASE Target_Dir ""\r
++# PROP Use_MFC 0\r
++# PROP Use_Debug_Libraries 0\r
++# PROP Output_Dir "Release_TS"\r
++# PROP Intermediate_Dir "Release_TS"\r
++# PROP Ignore_Export_Lib 0\r
++# PROP Target_Dir ""\r
++# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SQLITE_EXPORTS" /YX /FD /c\r
++# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /I "..\..\..\php_build" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_SQLITE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS" /FR /YX /FD /c\r
++# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
++# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
++# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
++# ADD RSC /l 0x407 /d "NDEBUG"\r
++BSC32=bscmake.exe\r
++# ADD BASE BSC32 /nologo\r
++# ADD BSC32 /nologo\r
++LINK32=link.exe\r
++# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
++# ADD LINK32 php5ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_sqlite.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\release"\r
++\r
++!ELSEIF  "$(CFG)" == "sqlite - Win32 Debug_TS"\r
++\r
++# PROP BASE Use_MFC 0\r
++# PROP BASE Use_Debug_Libraries 1\r
++# PROP BASE Output_Dir "Debug_TS"\r
++# PROP BASE Intermediate_Dir "Debug_TS"\r
++# PROP BASE Target_Dir ""\r
++# PROP Use_MFC 0\r
++# PROP Use_Debug_Libraries 1\r
++# PROP Output_Dir "Debug_TS"\r
++# PROP Intermediate_Dir "Debug_TS"\r
++# PROP Ignore_Export_Lib 0\r
++# PROP Target_Dir ""\r
++# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SQLITE_EXPORTS" /YX /FD /GZ /c\r
++# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /I "..\..\..\php_build" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_SQLITE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SQLITE=1 /D "PHP_SQLITE_EXPORTS" /YX /FD /GZ /c\r
++# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
++# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
++# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
++# ADD RSC /l 0x407 /d "_DEBUG"\r
++BSC32=bscmake.exe\r
++# ADD BASE BSC32 /nologo\r
++# ADD BSC32 /nologo\r
++LINK32=link.exe\r
++# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
++# ADD LINK32 php5ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_sqlite.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\release"\r
++\r
++!ENDIF \r
++\r
++# Begin Target\r
++\r
++# Name "sqlite - Win32 Release_TS"\r
++# Name "sqlite - Win32 Debug_TS"\r
++# Begin Group "Source Files"\r
++\r
++# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
++# Begin Group "libsqlite"\r
++\r
++# PROP Default_Filter ""\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\attach.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\auth.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\btree.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\btree.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\btree_rb.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\build.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\config.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\copy.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\date.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\delete.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\encode.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\expr.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\func.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\hash.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\hash.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\insert.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\main.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\opcodes.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\opcodes.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\os.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\os.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\pager.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\pager.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\parse.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\parse.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\pragma.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\printf.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\random.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\select.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\sqlite.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\sqlite.w32.h\r
++\r
++!IF  "$(CFG)" == "sqlite - Win32 Release_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\libsqlite\src\r
++InputPath=.\libsqlite\src\sqlite.w32.h\r
++\r
++"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\sqlite.h\r
++\r
++# End Custom Build\r
++\r
++!ELSEIF  "$(CFG)" == "sqlite - Win32 Debug_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\libsqlite\src\r
++InputPath=.\libsqlite\src\sqlite.w32.h\r
++\r
++"$(InputDir)\sqlite.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\sqlite.h\r
++\r
++# End Custom Build\r
++\r
++!ENDIF \r
++\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\sqlite_config.w32.h\r
++\r
++!IF  "$(CFG)" == "sqlite - Win32 Release_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\libsqlite\src\r
++InputPath=.\libsqlite\src\sqlite_config.w32.h\r
++\r
++"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\config.h\r
++\r
++# End Custom Build\r
++\r
++!ELSEIF  "$(CFG)" == "sqlite - Win32 Debug_TS"\r
++\r
++# Begin Custom Build\r
++InputDir=.\libsqlite\src\r
++InputPath=.\libsqlite\src\sqlite_config.w32.h\r
++\r
++"$(InputDir)\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
++      copy $(InputPath) $(InputDir)\config.h\r
++\r
++# End Custom Build\r
++\r
++!ENDIF \r
++\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\sqliteInt.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\table.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\tokenize.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\trigger.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\update.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\util.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\vacuum.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\vdbe.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\vdbe.h\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\vdbeaux.c\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\libsqlite\src\where.c\r
++# End Source File\r
++# End Group\r
++# Begin Source File\r
++\r
++SOURCE=.\php_sqlite.def\r
++# End Source File\r
++# Begin Source File\r
++\r
++SOURCE=.\sqlite.c\r
++# ADD CPP /I "libsqlite\src"\r
++# End Source File\r
++# End Group\r
++# Begin Group "Header Files"\r
++\r
++# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
++# Begin Source File\r
++\r
++SOURCE=.\php_sqlite.h\r
++# End Source File\r
++# End Group\r
++# End Target\r
++# End Project\r
+--- /dev/null
++++ b/ext/sqlite/sqlite.php
+@@ -0,0 +1,36 @@
++<?php
++if (!extension_loaded("sqlite")) {
++      dl("sqlite.so");
++      if (!extension_loaded("sqlite")) {
++              exit("Please enable SQLite support\n");
++      }
++}
++
++debug_zval_dump(sqlite_libversion());
++debug_zval_dump(sqlite_libencoding());
++
++$s = sqlite_open("weztest.sqlite", 0666, $err);
++
++debug_zval_dump($err);
++debug_zval_dump($s);
++
++$r = sqlite_query("create table foo (a INTEGER PRIMARY KEY, b INTEGER )", $s);
++debug_zval_dump(sqlite_last_error($s));
++debug_zval_dump(sqlite_error_string(sqlite_last_error($s)));
++
++$r = sqlite_query("select *, php('md5', sql) as o from sqlite_master", $s);
++debug_zval_dump($r);
++debug_zval_dump(sqlite_num_rows($r));
++debug_zval_dump(sqlite_num_fields($r));
++
++for ($j = 0; $j < sqlite_num_fields($r); $j++) {
++      echo "Field $j is " . sqlite_field_name($r, $j) . "\n";
++}
++
++while ($row = sqlite_fetch_array($r, SQLITE_ASSOC)) {
++      print_r($row);
++}
++
++sqlite_close($s);
++
++?>
+--- /dev/null
++++ b/ext/sqlite/tests/blankdb.inc
+@@ -0,0 +1,3 @@
++<?php #vim:ft=php
++$db = sqlite_open(":memory:");
++?>
+--- /dev/null
++++ b/ext/sqlite/tests/blankdb_oo.inc
+@@ -0,0 +1,3 @@
++<?php #vim:ft=php
++$db = new SQLiteDatabase(":memory:");
++?>
+--- /dev/null
++++ b/ext/sqlite/tests/bug26911.phpt
+@@ -0,0 +1,12 @@
++--TEST--
++Bug #26911 (crash when fetching data from empty queries)
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++      $db = sqlite_open(":memory:");
++      $a = sqlite_query($db, "  ");
++      echo "I am ok\n";
++?>
++--EXPECT--
++I am ok
+--- /dev/null
++++ b/ext/sqlite/tests/bug28112.phpt
+@@ -0,0 +1,16 @@
++--TEST--
++Bug #28112 (sqlite_query() crashing apache on malformed query)
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++
++if (!($db = sqlite_open(":memory:", 666, $error))) die ("Couldn't open the database");
++sqlite_query($db, "create table frob (foo INTEGER PRIMARY KEY, bar text);");
++$res = @sqlite_array_query($db, "");
++
++?>
++===DONE===
++<?php exit(0); ?>
++--EXPECTF--
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/bug35248.phpt
+@@ -0,0 +1,15 @@
++--TEST--
++Bug #35248 (sqlite_query does not return parse error message)
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++      $db = sqlite_open(":memory:");
++      $res = @sqlite_query($db, "asdfesdfa", SQLITE_NUM, $err);
++      var_dump($err);
++      $res = @sqlite_unbuffered_query($db, "asdfesdfa", SQLITE_NUM, $err);
++      var_dump($err);
++?>
++--EXPECT--
++string(30) "near "asdfesdfa": syntax error"
++string(30) "near "asdfesdfa": syntax error"
+--- /dev/null
++++ b/ext/sqlite/tests/bug38759.phpt
+@@ -0,0 +1,18 @@
++--TEST--
++Bug #38759 (sqlite2 empty query causes segfault)
++--SKIPIF--
++<?php 
++if (!extension_loaded("pdo")) print "skip"; 
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php
++
++$dbh = new PDO('sqlite2::memory:');
++var_dump($dbh->query(" "));
++
++echo "Done\n";
++?>
++--EXPECTF--   
++bool(false)
++Done
+--- /dev/null
++++ b/ext/sqlite/tests/bug48679.phpt
+@@ -0,0 +1,20 @@
++--TEST--
++Bug #48679 (sqlite2 count on unbuffered query causes segfault)
++--SKIPIF--
++<?php 
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php
++
++try {
++      $x = new sqliteunbuffered;
++      count($x);
++} catch (SQLiteException $e) {
++      var_dump($e->getMessage());
++}
++echo "Done\n";
++?>
++--EXPECT--    
++string(41) "Row count is not available for this query"
++Done
+--- /dev/null
++++ b/ext/sqlite/tests/pdo/common.phpt
+@@ -0,0 +1,12 @@
++--TEST--
++SQLite2
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded('pdo') || !extension_loaded('sqlite')) print 'skip'; ?>
++--REDIRECTTEST--
++return array(
++      'ENV' => array(
++                      'PDOTEST_DSN' => 'sqlite2::memory:'
++              ),
++      'TESTS' => 'ext/pdo/tests'
++      );
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_001.phpt
+@@ -0,0 +1,16 @@
++--TEST--
++sqlite: sqlite_open/close
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++require_once('blankdb.inc');
++echo "$db\n";
++sqlite_close($db);
++echo "Done\n";
++?>
++--EXPECTF--
++Resource id #%d
++Done
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_002.phpt
+@@ -0,0 +1,32 @@
++--TEST--
++sqlite: Simple insert/select
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db);
++sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db);
++$r = sqlite_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r));
++sqlite_close($db);
++?>
++--EXPECT--
++array(6) {
++  [0]=>
++  string(10) "2002-01-02"
++  ["c1"]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  ["c2"]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++  ["c3"]=>
++  NULL
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_003.phpt
+@@ -0,0 +1,52 @@
++--TEST--
++sqlite: Simple insert/select, different result represenatation
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db);
++sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db);
++$r = sqlite_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r, SQLITE_BOTH));
++$r = sqlite_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r, SQLITE_NUM));
++$r = sqlite_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r, SQLITE_ASSOC));
++sqlite_close($db);
++?>
++--EXPECT--
++array(6) {
++  [0]=>
++  string(10) "2002-01-02"
++  ["c1"]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  ["c2"]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++  ["c3"]=>
++  NULL
++}
++array(3) {
++  [0]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++}
++array(3) {
++  ["c1"]=>
++  string(10) "2002-01-02"
++  ["c2"]=>
++  string(8) "12:49:00"
++  ["c3"]=>
++  NULL
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_004.phpt
+@@ -0,0 +1,49 @@
++--TEST--
++sqlite: binary encoding
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$strings = array(
++      "hello",
++      "hello\x01o",
++      "\x01hello there",
++      "hello\x00there",
++      ""
++);
++
++sqlite_query("CREATE TABLE strings(a)", $db);
++
++foreach ($strings as $str) {
++      sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db);
++}
++
++$i = 0;
++$r = sqlite_query("SELECT * from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      if ($row[0] !== $strings[$i]) {
++              echo "FAIL!\n";
++              var_dump($row[0]);
++              var_dump($strings[$i]);
++      } else {
++              echo "OK!\n";
++      }
++      $i++;
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++OK!
++OK!
++OK!
++OK!
++OK!
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_005.phpt
+@@ -0,0 +1,50 @@
++--TEST--
++sqlite: aggregate functions
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db);
++}
++
++function cat_step(&$context, $string)
++{
++      $context .= $string;
++}
++
++function cat_fin(&$context)
++{
++      return $context;
++}
++
++sqlite_create_aggregate($db, "cat", "cat_step", "cat_fin");
++
++$r = sqlite_query("SELECT cat(a) from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      var_dump($row);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(11) "onetwothree"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_006.phpt
+@@ -0,0 +1,55 @@
++--TEST--
++sqlite: regular functions
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      array("one", "uno"),
++      array("two", "dos"),
++      array("three", "tres"),
++      );
++
++sqlite_query("CREATE TABLE strings(a,b)", $db);
++
++function implode_args()
++{
++      $args = func_get_args();
++      $sep = array_shift($args);
++      return implode($sep, $args);
++}
++
++foreach ($data as $row) {
++      sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($row[0]) . "','" . sqlite_escape_string($row[1]) . "')", $db);
++}
++
++sqlite_create_function($db, "implode", "implode_args");
++
++$r = sqlite_query("SELECT implode('-', a, b) from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      var_dump($row);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(7) "one-uno"
++}
++array(1) {
++  [0]=>
++  string(7) "two-dos"
++}
++array(1) {
++  [0]=>
++  string(10) "three-tres"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_007.phpt
+@@ -0,0 +1,52 @@
++--TEST--
++sqlite: Simple insert/select (unbuffered)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))", $db);
++sqlite_query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)", $db);
++$r = sqlite_unbuffered_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r, SQLITE_BOTH));
++$r = sqlite_unbuffered_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r, SQLITE_NUM));
++$r = sqlite_unbuffered_query("SELECT * from foo", $db);
++var_dump(sqlite_fetch_array($r, SQLITE_ASSOC));
++sqlite_close($db);
++?>
++--EXPECT--
++array(6) {
++  [0]=>
++  string(10) "2002-01-02"
++  ["c1"]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  ["c2"]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++  ["c3"]=>
++  NULL
++}
++array(3) {
++  [0]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++}
++array(3) {
++  ["c1"]=>
++  string(10) "2002-01-02"
++  ["c2"]=>
++  string(8) "12:49:00"
++  ["c3"]=>
++  NULL
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_008.phpt
+@@ -0,0 +1,46 @@
++--TEST--
++sqlite: fetch all (buffered)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++$r = sqlite_query("SELECT a from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      var_dump($row);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_009.phpt
+@@ -0,0 +1,46 @@
++--TEST--
++sqlite: fetch all (unbuffered)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++$r = sqlite_unbuffered_query("SELECT a from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      var_dump($row);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_010.phpt
+@@ -0,0 +1,81 @@
++--TEST--
++sqlite: fetch all (iterator)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++$r = sqlite_unbuffered_query("SELECT a from strings", $db);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_current($r, SQLITE_NUM));
++      sqlite_next($r);
++}
++$r = sqlite_query("SELECT a from strings", $db);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_current($r, SQLITE_NUM));
++      sqlite_next($r);
++}
++sqlite_rewind($r);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_current($r, SQLITE_NUM));
++      sqlite_next($r);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_011.phpt
+@@ -0,0 +1,34 @@
++--TEST--
++sqlite: returned associative column names
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query("CREATE TABLE foo (c1 char, c2 char, c3 char)", $db);
++sqlite_query("CREATE TABLE bar (c1 char, c2 char, c3 char)", $db);
++sqlite_query("INSERT INTO foo VALUES ('1', '2', '3')", $db);
++sqlite_query("INSERT INTO bar VALUES ('4', '5', '6')", $db);
++$r = sqlite_query("SELECT * from foo, bar", $db, SQLITE_ASSOC);
++var_dump(sqlite_fetch_array($r));
++sqlite_close($db);
++?>
++--EXPECT--
++array(6) {
++  ["foo.c1"]=>
++  string(1) "1"
++  ["foo.c2"]=>
++  string(1) "2"
++  ["foo.c3"]=>
++  string(1) "3"
++  ["bar.c1"]=>
++  string(1) "4"
++  ["bar.c2"]=>
++  string(1) "5"
++  ["bar.c3"]=>
++  string(1) "6"
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_012.phpt
+@@ -0,0 +1,38 @@
++--TEST--
++sqlite: read field names
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query("CREATE TABLE strings(foo VARCHAR, bar VARCHAR, baz VARCHAR)", $db);
++
++echo "Buffered\n";
++$r = sqlite_query("SELECT * from strings", $db);
++for($i=0; $i<sqlite_num_fields($r); $i++) {
++      var_dump(sqlite_field_name($r, $i));
++}
++echo "Unbuffered\n";
++$r = sqlite_unbuffered_query("SELECT * from strings", $db);
++for($i=0; $i<sqlite_num_fields($r); $i++) {
++      var_dump(sqlite_field_name($r, $i));
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++Buffered
++string(3) "foo"
++string(3) "bar"
++string(3) "baz"
++Unbuffered
++string(3) "foo"
++string(3) "bar"
++string(3) "baz"
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_013.phpt
+@@ -0,0 +1,78 @@
++--TEST--
++sqlite: fetch column
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      array (0 => 'one', 1 => 'two'),
++      array (0 => 'three', 1 => 'four')
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR, b VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')", $db);
++}
++
++echo "====BUFFERED====\n";
++$r = sqlite_query("SELECT a, b from strings", $db);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_current($r, SQLITE_NUM));
++      var_dump(sqlite_column($r, 0));
++      var_dump(sqlite_column($r, 1));
++      var_dump(sqlite_column($r, 'a'));
++      var_dump(sqlite_column($r, 'b'));
++      sqlite_next($r);
++}
++echo "====UNBUFFERED====\n";
++$r = sqlite_unbuffered_query("SELECT a, b from strings", $db);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_column($r, 0));
++      var_dump(sqlite_column($r, 'b'));
++      var_dump(sqlite_column($r, 1));
++      var_dump(sqlite_column($r, 'a'));
++      sqlite_next($r);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++====BUFFERED====
++array(2) {
++  [0]=>
++  string(3) "one"
++  [1]=>
++  string(3) "two"
++}
++string(3) "one"
++string(3) "two"
++string(3) "one"
++string(3) "two"
++array(2) {
++  [0]=>
++  string(5) "three"
++  [1]=>
++  string(4) "four"
++}
++string(5) "three"
++string(4) "four"
++string(5) "three"
++string(4) "four"
++====UNBUFFERED====
++string(3) "one"
++string(3) "two"
++NULL
++NULL
++string(5) "three"
++string(4) "four"
++NULL
++NULL
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_014.phpt
+@@ -0,0 +1,120 @@
++--TEST--
++sqlite: fetch all (fetch_all)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++echo "unbuffered twice\n";
++$r = sqlite_unbuffered_query("SELECT a from strings", $db, SQLITE_NUM);
++var_dump(sqlite_fetch_all($r));
++var_dump(sqlite_fetch_all($r));
++
++echo "unbuffered with fetch_array\n";
++$r = sqlite_unbuffered_query("SELECT a from strings", $db, SQLITE_NUM);
++var_dump(sqlite_fetch_array($r));
++var_dump(sqlite_fetch_all($r));
++
++echo "buffered\n";
++$r = sqlite_query("SELECT a from strings", $db, SQLITE_NUM);
++var_dump(sqlite_fetch_all($r));
++var_dump(sqlite_fetch_array($r));
++var_dump(sqlite_fetch_all($r));
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECTF--
++unbuffered twice
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++
++Warning: sqlite_fetch_all(): One or more rowsets were already returned; returning NULL this time in %ssqlite_014.php on line %d
++array(0) {
++}
++unbuffered with fetch_array
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(2) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++buffered
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++bool(false)
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_015.phpt
+@@ -0,0 +1,49 @@
++--TEST--
++sqlite: fetch all (array_query)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++$res = sqlite_array_query("SELECT a from strings", $db, SQLITE_NUM);
++var_dump($res);
++
++$db = null;
++
++echo "DONE!\n";
++?>
++--EXPECTF--
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_016.phpt
+@@ -0,0 +1,45 @@
++--TEST--
++sqlite: fetch single
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      array (0 => 'one', 1 => 'two'),
++      array (0 => 'three', 1 => 'four')
++      );
++
++sqlite_query("CREATE TABLE strings(a VARCHAR, b VARCHAR)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')", $db);
++}
++
++echo "====BUFFERED====\n";
++$r = sqlite_query("SELECT a, b from strings", $db);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_fetch_single($r));
++}
++echo "====UNBUFFERED====\n";
++$r = sqlite_unbuffered_query("SELECT a, b from strings", $db);
++while (sqlite_valid($r)) {
++      var_dump(sqlite_fetch_single($r));
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++====BUFFERED====
++string(3) "one"
++string(5) "three"
++====UNBUFFERED====
++string(3) "one"
++string(5) "three"
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_017.phpt
+@@ -0,0 +1,33 @@
++--TEST--
++sqlite: UDF binary handling functions
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++
++$data = array(
++      "hello there",
++      "this has a \x00 char in the middle",
++      "\x01 this has an 0x01 at the start",
++      "this has \x01 in the middle"
++      );
++
++foreach ($data as $item) {
++      $coded = sqlite_udf_encode_binary($item);
++      echo bin2hex($coded) . "\n";
++      $decoded = sqlite_udf_decode_binary($coded);
++      if ($item != $decoded) {
++              echo "FAIL! $item decoded is $decoded\n";
++      }
++}
++
++echo "OK!\n";
++
++?>
++--EXPECT--
++68656c6c6f207468657265
++0101736768721f6760721f601fff1f626760711f686d1f7367641f6c6863636b64
++0102ff1e726667711e665f711e5f6c1e2e762e2f1e5f721e7266631e71725f7072
++7468697320686173200120696e20746865206d6964646c65
++OK!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_018.phpt
+@@ -0,0 +1,14 @@
++--TEST--
++sqlite: crash on bad queries inside sqlite_array_query()
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++include "blankdb.inc";
++
++sqlite_array_query($db, "SELECT foo FROM foobar");
++sqlite_close($db);
++?>
++--EXPECTF--
++Warning: sqlite_array_query(): no such table: foobar in %s on line %d
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_019.phpt
+@@ -0,0 +1,47 @@
++--TEST--
++sqlite: single query
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++include "blankdb.inc";
++      
++sqlite_query($db, "CREATE TABLE test_db ( id INTEGER PRIMARY KEY, data VARCHAR(100) )");
++for ($i = 0; $i < 10; $i++) {
++      sqlite_query($db, "INSERT INTO test_db (data) VALUES('{$i}data')");
++}
++sqlite_query($db, "INSERT INTO test_db (data) VALUES(NULL)");
++                                               
++var_dump(sqlite_single_query($db, "SELECT id FROM test_db WHERE id=5"));
++var_dump(sqlite_single_query($db, "SELECT * FROM test_db WHERE id=4"));
++var_dump(sqlite_single_query($db, "SELECT data FROM test_db WHERE id=6"));
++var_dump(sqlite_single_query($db, "SELECT * FROM test_db WHERE id < 5"));
++var_dump(sqlite_single_query($db, "SELECT * FROM test db WHERE id < 4"));
++var_dump(sqlite_single_query($db, "SELECT * FROM test_db WHERE id=999999"));
++var_dump(sqlite_single_query($db, "SELECT id FROM test_db WHERE id=5", FALSE));
++
++sqlite_close($db);
++?>
++--EXPECTF--
++string(1) "5"
++string(1) "4"
++string(5) "5data"
++array(4) {
++  [0]=>
++  string(1) "1"
++  [1]=>
++  string(1) "2"
++  [2]=>
++  string(1) "3"
++  [3]=>
++  string(1) "4"
++}
++
++Warning: sqlite_single_query(): no such table: test in %s on line %d
++bool(false)
++NULL
++array(1) {
++  [0]=>
++  string(1) "5"
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_022.phpt
+@@ -0,0 +1,101 @@
++--TEST--
++sqlite: sqlite_seek
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++$res = sqlite_query("SELECT a FROM strings", $db, SQLITE_NUM);
++for ($idx = -1; $idx < 4; $idx++) {
++      echo "====SEEK:$idx====\n";
++      sqlite_seek($res, $idx);
++      var_dump(sqlite_current($res));
++}
++echo "====AGAIN====\n";
++for ($idx = -1; $idx < 4; $idx++) {
++      echo "====SEEK:$idx====\n";
++      sqlite_seek($res, $idx);
++      var_dump(sqlite_current($res));
++}
++
++sqlite_close($db);
++
++echo "====DONE!====\n";
++?>
++--EXPECTF--
++====SEEK:-1====
++
++Warning: sqlite_seek(): row -1 out of range in %ssqlite_022.php on line %d
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====SEEK:0====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====SEEK:1====
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++====SEEK:2====
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====SEEK:3====
++
++Warning: sqlite_seek(): row 3 out of range in %ssqlite_022.php on line %d
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====AGAIN====
++====SEEK:-1====
++
++Warning: sqlite_seek(): row -1 out of range in %ssqlite_022.php on line %d
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====SEEK:0====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====SEEK:1====
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++====SEEK:2====
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====SEEK:3====
++
++Warning: sqlite_seek(): row 3 out of range in %ssqlite_022.php on line %d
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====DONE!====
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_023.phpt
+@@ -0,0 +1,105 @@
++--TEST--
++sqlite: sqlite_[has_]prev
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++include "blankdb.inc";
++
++$data = array(
++              "one",
++              "two",
++              "three"
++              );
++
++sqlite_query("CREATE TABLE strings(a)", $db);
++
++foreach ($data as $str) {
++  sqlite_query("INSERT INTO strings VALUES('$str')", $db);
++}
++
++$r = sqlite_query("SELECT a FROM strings", $db, SQLITE_NUM);
++
++echo "====TRAVERSE====\n";
++for(sqlite_rewind($r); sqlite_valid($r); sqlite_next($r)) {
++  var_dump(sqlite_current($r));
++
++}
++echo "====REVERSE====\n";
++do {
++  sqlite_prev($r);
++  var_dump(sqlite_current($r));
++} while(sqlite_has_prev($r));
++
++echo "====UNBUFFERED====\n";
++
++$r = sqlite_unbuffered_query("SELECT a FROM strings", $db, SQLITE_NUM);
++
++echo "====TRAVERSE====\n";
++for(sqlite_rewind($r); sqlite_valid($r); sqlite_next($r)) {
++  var_dump(sqlite_current($r));
++
++}
++echo "====REVERSE====\n";
++do {
++  sqlite_prev($r);
++  var_dump(sqlite_current($r));
++} while(sqlite_has_prev($r));
++
++sqlite_close($db);
++
++echo "====DONE!====\n";
++?>
++--EXPECTF--
++====TRAVERSE====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====REVERSE====
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====UNBUFFERED====
++====TRAVERSE====
++
++Warning: sqlite_rewind(): Cannot rewind an unbuffered result set in %ssqlite_023.php on line %d
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====REVERSE====
++
++Warning: sqlite_prev(): you cannot use sqlite_prev on unbuffered querys in %ssqlite_023.php on line %d
++bool(false)
++
++Warning: sqlite_has_prev(): you cannot use sqlite_has_prev on unbuffered querys in %ssqlite_023.php on line %d
++====DONE!====
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_024.phpt
+@@ -0,0 +1,76 @@
++--TEST--
++sqlite: sqlite_fetch_object
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++class class24 {
++      function __construct() {
++              echo __METHOD__ . "\n";
++      }
++}
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query($db, "CREATE TABLE strings(a)");
++
++foreach ($data as $str) {
++      sqlite_query($db, "INSERT INTO strings VALUES('$str')");
++}
++
++echo "====class24====\n";
++$res = sqlite_query($db, "SELECT a FROM strings", SQLITE_ASSOC);
++while (sqlite_valid($res)) {
++      var_dump(sqlite_fetch_object($res, 'class24'));
++}
++
++echo "====stdclass====\n";
++$res = sqlite_query($db, "SELECT a FROM strings", SQLITE_ASSOC);
++while (sqlite_valid($res)) {
++      var_dump(sqlite_fetch_object($res));
++}
++
++sqlite_close($db);
++
++echo "====DONE!====\n";
++?>
++--EXPECTF--
++====class24====
++class24::__construct
++object(class24)#%d (1) {
++  ["a"]=>
++  string(3) "one"
++}
++class24::__construct
++object(class24)#%d (1) {
++  ["a"]=>
++  string(3) "two"
++}
++class24::__construct
++object(class24)#%d (1) {
++  ["a"]=>
++  string(5) "three"
++}
++====stdclass====
++object(stdClass)#%d (1) {
++  ["a"]=>
++  string(3) "one"
++}
++object(stdClass)#%d (1) {
++  ["a"]=>
++  string(3) "two"
++}
++object(stdClass)#%d (1) {
++  ["a"]=>
++  string(5) "three"
++}
++====DONE!====
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_025.phpt
+@@ -0,0 +1,38 @@
++--TEST--
++sqlite: sqlite_fetch_object in a loop
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query($db, "CREATE TABLE strings(a)");
++
++foreach (array("one", "two", "three") as $str) {
++      sqlite_query($db, "INSERT INTO strings VALUES('$str')");
++}
++
++$res = sqlite_query("SELECT * FROM strings", $db);
++
++while (($obj = sqlite_fetch_object($res))) {
++      var_dump($obj);
++}
++
++sqlite_close($db);
++?>
++--EXPECTF--
++object(stdClass)#1 (1) {
++  ["a"]=>
++  string(3) "one"
++}
++object(stdClass)#2 (1) {
++  ["a"]=>
++  string(3) "two"
++}
++object(stdClass)#1 (1) {
++  ["a"]=>
++  string(5) "three"
++}
+\ No newline at end of file
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_026.phpt
+@@ -0,0 +1,27 @@
++--TEST--
++sqlite: sqlite_fetch_column_types
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++sqlite_query($db, "CREATE TABLE strings(a, b INTEGER, c VARCHAR(10), d)");
++sqlite_query($db, "INSERT INTO strings VALUES('1', '2', '3', 'abc')");
++
++var_dump(sqlite_fetch_column_types($db, "strings"));
++
++sqlite_close($db);
++?>
++--EXPECT--
++array(4) {
++  ["a"]=>
++  string(0) ""
++  ["b"]=>
++  string(7) "INTEGER"
++  ["c"]=>
++  string(11) "VARCHAR(10)"
++  ["d"]=>
++  string(0) ""
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_027.phpt
+@@ -0,0 +1,15 @@
++--TEST--
++sqlite: crash inside sqlite_escape_string() & sqlite_udf_encode_binary
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--INI--
++memory_limit=-1
++--FILE--
++<?php
++      var_dump(strlen(sqlite_escape_string(str_repeat("\0", 20000000))));
++      var_dump(strlen(sqlite_udf_encode_binary(str_repeat("\0", 20000000))));
++?>
++--EXPECT--
++int(20000002)
++int(20000002)
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_closures_001.phpt
+@@ -0,0 +1,54 @@
++--TEST--
++sqlite: aggregate functions with closures
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++sqlite_query("CREATE TABLE strings(a)", $db);
++
++foreach ($data as $str) {
++      sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db);
++}
++
++function cat_step(&$context, $string)
++{
++      $context .= $string;
++}
++
++function cat_fin(&$context)
++{
++      return $context;
++}
++
++sqlite_create_aggregate($db, "cat", function (&$context, $string) {
++      $context .= $string;
++}, function (&$context) {
++      return $context;
++});
++
++$r = sqlite_query("SELECT cat(a) from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      var_dump($row);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(11) "onetwothree"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_closures_002.phpt
+@@ -0,0 +1,52 @@
++--TEST--
++sqlite: regular functions with closures
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb.inc";
++
++$data = array(
++      array("one", "uno"),
++      array("two", "dos"),
++      array("three", "tres"),
++      );
++
++sqlite_query("CREATE TABLE strings(a,b)", $db);
++
++foreach ($data as $row) {
++      sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($row[0]) . "','" . sqlite_escape_string($row[1]) . "')", $db);
++}
++
++sqlite_create_function($db, "implode", function () {
++      $args = func_get_args();
++      $sep = array_shift($args);
++      return implode($sep, $args);
++});
++
++$r = sqlite_query("SELECT implode('-', a, b) from strings", $db);
++while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
++      var_dump($row);
++}
++
++sqlite_close($db);
++
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(7) "one-uno"
++}
++array(1) {
++  [0]=>
++  string(7) "two-dos"
++}
++array(1) {
++  [0]=>
++  string(10) "three-tres"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlitedatabase_arrayquery.phpt
+@@ -0,0 +1,23 @@
++--TEST--
++Testing SQLiteDatabase::ArrayQuery with NULL-byte string
++--SKIPIF--
++<?php
++if (!extension_loaded("sqlite")) print "skip";
++?>
++--FILE--
++<?php
++
++$method = new ReflectionMethod('sqlitedatabase::arrayquery');
++
++$class = $method->getDeclaringClass()->newInstanceArgs(array(':memory:'));
++
++$p = "\0";
++
++$method->invokeArgs($class, array_fill(0, 2, $p));
++$method->invokeArgs($class, array_fill(0, 1, $p));
++
++?>
++--EXPECTF--
++Warning: SQLiteDatabase::arrayQuery() expects parameter 2 to be long, string given in %s on line %d
++
++Warning: SQLiteDatabase::arrayQuery(): Cannot execute empty query. in %s on line %d
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_exec_basic.phpt
+@@ -0,0 +1,34 @@
++--TEST--
++Test sqlite_exec() function : basic functionality 
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
++--FILE--
++<?php
++/* Prototype  : boolean sqlite_exec(string query, resource db[, string &error_message])
++ * Description: Executes a result-less query against a given database 
++ * Source code: ext/sqlite/sqlite.c
++ * Alias to functions: 
++ */
++
++echo "*** Testing sqlite_exec() : basic functionality ***\n";
++
++// set up variables
++$query = 'CREATE TABLE foobar (id INTEGER PRIMARY KEY, name CHAR(255));';
++$error_message = null;
++
++// procedural
++$db = sqlite_open(':memory:');
++var_dump( sqlite_exec($db, $query) );
++sqlite_close($db);
++
++// oo-style
++$db = new SQLiteDatabase(':memory:');
++var_dump( $db->queryExec($query, $error_message) );
++
++?>
++===DONE===
++--EXPECTF--
++*** Testing sqlite_exec() : basic functionality ***
++bool(true)
++bool(true)
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_exec_error.phpt
+@@ -0,0 +1,44 @@
++--TEST--
++Test sqlite_exec() function : error behaviour and functionality 
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
++--FILE--
++<?php
++/* Prototype  : boolean sqlite_exec(string query, resource db[, string &error_message])
++ * Description: Executes a result-less query against a given database 
++ * Source code: ext/sqlite/sqlite.c
++ * Alias to functions: 
++ */
++
++echo "*** Testing sqlite_exec() : error functionality ***\n";
++
++// set up variables
++$fail = 'CRE ATE TABLE';
++$error_message = null;
++
++// procedural
++$db = sqlite_open(':memory:');
++var_dump( sqlite_exec($db, $fail, $error_message) );
++var_dump( $error_message );
++var_dump( sqlite_exec($db) );
++sqlite_close($db);
++
++// oo-style
++$db = new SQLiteDatabase(':memory:');
++var_dump( $db->queryExec($fail, $error_message, 'fooparam') );
++
++?>
++===DONE===
++--EXPECTF--
++*** Testing sqlite_exec() : error functionality ***
++
++Warning: sqlite_exec(): near "CRE": syntax error in %s on line %d
++bool(false)
++%string|unicode%(24) "near "CRE": syntax error"
++
++Warning: sqlite_exec() expects at least 2 parameters, 1 given in %s on line %d
++NULL
++
++Warning: SQLiteDatabase::queryExec() expects at most 2 parameters, 3 given in %s on line %d
++NULL
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_last_error_basic.phpt
+@@ -0,0 +1,48 @@
++--TEST--
++Test sqlite_last_error() function : basic functionality 
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
++--FILE--
++<?php
++/* Prototype  : int sqlite_last_error(resource db)
++ * Description: Returns the error code of the last error for a database. 
++ * Source code: ext/sqlite/sqlite.c
++ * Alias to functions: 
++ */
++
++echo "*** Testing sqlite_last_error() : basic functionality ***\n";
++
++// set up variables
++$query = 'CREATE TAB LE foobar (id INTEGER PRIMARY KEY, name CHAR(255));';
++$query_ok = 'CREATE TABLE foobar (id INTEGER, name CHAR(255));';
++
++// procedural
++$db = sqlite_open(':memory:');
++var_dump( sqlite_last_error($db) === SQLITE_OK );
++sqlite_exec($db, $query);
++var_dump( sqlite_last_error($db) === SQLITE_ERROR );
++sqlite_exec($db, $query_ok);
++var_dump( sqlite_last_error($db) === SQLITE_OK );
++sqlite_close($db);
++
++// oo-style
++$db = new SQLiteDatabase(':memory:');
++$db->queryExec($query);
++var_dump( $db->lastError() === SQLITE_ERROR );
++$db->queryExec($query_ok);
++var_dump( $db->lastError() === SQLITE_OK );
++
++?>
++===DONE===
++--EXPECTF--
++*** Testing sqlite_last_error() : basic functionality ***
++bool(true)
++
++Warning: sqlite_exec(): near "TAB": syntax error in %s on line %d
++bool(true)
++bool(true)
++
++Warning: SQLiteDatabase::queryExec(): near "TAB": syntax error in %s on line %d
++bool(true)
++bool(true)
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_last_error_error.phpt
+@@ -0,0 +1,47 @@
++--TEST--
++Test sqlite_last_error() function : error conditions 
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
++--FILE--
++<?php
++/* Prototype  : int sqlite_last_error(resource db)
++ * Description: Returns the error code of the last error for a database. 
++ * Source code: ext/sqlite/sqlite.c
++ * Alias to functions: 
++ */
++
++echo "*** Testing sqlite_last_error() : error conditions ***\n";
++
++// Zero arguments
++echo "\n-- Testing sqlite_last_error() function with Zero arguments --\n";
++var_dump( sqlite_last_error() );
++
++//Test sqlite_last_error with one more than the expected number of arguments
++echo "\n-- Testing sqlite_last_error() function with more than expected no. of arguments --\n";
++
++$db = sqlite_open(':memory:');
++$extra_arg = 10;
++var_dump( sqlite_last_error($db, $extra_arg) );
++sqlite_close($db);
++
++$db = new SQLiteDatabase(':memory:');
++var_dump( $db->lastError($extra_arg) );
++
++?>
++===DONE===
++--EXPECTF--
++*** Testing sqlite_last_error() : error conditions ***
++
++-- Testing sqlite_last_error() function with Zero arguments --
++
++Warning: sqlite_last_error() expects exactly 1 parameter, 0 given in %s on line %d
++NULL
++
++-- Testing sqlite_last_error() function with more than expected no. of arguments --
++
++Warning: sqlite_last_error() expects exactly 1 parameter, 2 given in %s on line %d
++NULL
++
++Warning: SQLiteDatabase::lastError() expects exactly 0 parameters, 1 given in %s on line %d
++NULL
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_001.phpt
+@@ -0,0 +1,17 @@
++--TEST--
++sqlite-oo: sqlite_open/close
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++require_once('blankdb_oo.inc');
++var_dump($db);
++$db = NULL;
++echo "Done\n";
++?>
++--EXPECTF--
++object(SQLiteDatabase)#%d (0) {
++}
++Done
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_002.phpt
+@@ -0,0 +1,41 @@
++--TEST--
++sqlite-oo: Simple insert/select
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++require_once('blankdb_oo.inc');
++var_dump($db);
++
++var_dump($db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))"));
++var_dump($db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)"));
++$r = $db->query("SELECT * from foo");
++var_dump($r);
++var_dump($r->fetch());
++?>
++--EXPECTF--
++object(SQLiteDatabase)#%d (0) {
++}
++object(SQLiteResult)#%d (0) {
++}
++object(SQLiteResult)#%d (0) {
++}
++object(SQLiteResult)#%d (0) {
++}
++array(6) {
++  [0]=>
++  string(10) "2002-01-02"
++  ["c1"]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  ["c2"]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++  ["c3"]=>
++  NULL
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_003.phpt
+@@ -0,0 +1,51 @@
++--TEST--
++sqlite-oo: Simple insert/select, different result representation
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE foo(c1 date, c2 time, c3 varchar(64))");
++$db->query("INSERT INTO foo VALUES ('2002-01-02', '12:49:00', NULL)");
++$r = $db->query("SELECT * from foo");
++var_dump($r->fetch(SQLITE_BOTH));
++$r = $db->query("SELECT * from foo");
++var_dump($r->fetch(SQLITE_NUM));
++$r = $db->query("SELECT * from foo");
++var_dump($r->fetch(SQLITE_ASSOC));
++?>
++--EXPECT--
++array(6) {
++  [0]=>
++  string(10) "2002-01-02"
++  ["c1"]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  ["c2"]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++  ["c3"]=>
++  NULL
++}
++array(3) {
++  [0]=>
++  string(10) "2002-01-02"
++  [1]=>
++  string(8) "12:49:00"
++  [2]=>
++  NULL
++}
++array(3) {
++  ["c1"]=>
++  string(10) "2002-01-02"
++  ["c2"]=>
++  string(8) "12:49:00"
++  ["c3"]=>
++  NULL
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_008.phpt
+@@ -0,0 +1,43 @@
++--TEST--
++sqlite-oo: fetch all (buffered)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++$r = $db->query("SELECT a from strings");
++while ($row = $r->fetch(SQLITE_NUM)) {
++      var_dump($row);
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_009.phpt
+@@ -0,0 +1,43 @@
++--TEST--
++sqlite-oo: fetch all (unbuffered)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++$r = $db->unbufferedQuery("SELECT a from strings");
++while ($row = $r->fetch(SQLITE_NUM)) {
++      var_dump($row);
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_010.phpt
+@@ -0,0 +1,44 @@
++--TEST--
++sqlite-oo: fetch all (iterator)
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
++while ($row = $r->valid()) {
++      var_dump($r->current());
++      $r->next();
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_011.phpt
+@@ -0,0 +1,33 @@
++--TEST--
++sqlite-oo: returned associative column names
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE foo (c1 char, c2 char, c3 char)");
++$db->query("CREATE TABLE bar (c1 char, c2 char, c3 char)");
++$db->query("INSERT INTO foo VALUES ('1', '2', '3')");
++$db->query("INSERT INTO bar VALUES ('4', '5', '6')");
++$r = $db->query("SELECT * from foo, bar", SQLITE_ASSOC);
++var_dump($r->fetch());
++?>
++--EXPECT--
++array(6) {
++  ["foo.c1"]=>
++  string(1) "1"
++  ["foo.c2"]=>
++  string(1) "2"
++  ["foo.c3"]=>
++  string(1) "3"
++  ["bar.c1"]=>
++  string(1) "4"
++  ["bar.c2"]=>
++  string(1) "5"
++  ["bar.c3"]=>
++  string(1) "6"
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_012.phpt
+@@ -0,0 +1,35 @@
++--TEST--
++sqlite-oo: read field names
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE strings(foo VARCHAR, bar VARCHAR, baz VARCHAR)");
++
++echo "Buffered\n";
++$r = $db->query("SELECT * from strings");
++for($i=0; $i<$r->numFields(); $i++) {
++      var_dump($r->fieldName($i));
++}
++echo "Unbuffered\n";
++$r = $db->unbufferedQuery("SELECT * from strings");
++for($i=0; $i<$r->numFields(); $i++) {
++      var_dump($r->fieldName($i));
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++Buffered
++string(3) "foo"
++string(3) "bar"
++string(3) "baz"
++Unbuffered
++string(3) "foo"
++string(3) "bar"
++string(3) "baz"
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_013.phpt
+@@ -0,0 +1,75 @@
++--TEST--
++sqlite-oo: fetch column
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      array (0 => 'one', 1 => 'two'),
++      array (0 => 'three', 1 => 'four')
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR, b VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')");
++}
++
++echo "====BUFFERED====\n";
++$r = $db->query("SELECT a, b from strings");
++while ($r->valid()) {
++      var_dump($r->current(SQLITE_NUM));
++      var_dump($r->column(0));
++      var_dump($r->column(1));
++      var_dump($r->column('a'));
++      var_dump($r->column('b'));
++      $r->next();
++}
++echo "====UNBUFFERED====\n";
++$r = $db->unbufferedQuery("SELECT a, b from strings");
++while ($r->valid()) {
++      var_dump($r->column(0));
++      var_dump($r->column('b'));
++      var_dump($r->column(1));
++      var_dump($r->column('a'));
++      $r->next();
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++====BUFFERED====
++array(2) {
++  [0]=>
++  string(3) "one"
++  [1]=>
++  string(3) "two"
++}
++string(3) "one"
++string(3) "two"
++string(3) "one"
++string(3) "two"
++array(2) {
++  [0]=>
++  string(5) "three"
++  [1]=>
++  string(4) "four"
++}
++string(5) "three"
++string(4) "four"
++string(5) "three"
++string(4) "four"
++====UNBUFFERED====
++string(3) "one"
++string(3) "two"
++NULL
++NULL
++string(5) "three"
++string(4) "four"
++NULL
++NULL
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_014.phpt
+@@ -0,0 +1,118 @@
++--TEST--
++sqlite-oo: fetch all
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++echo "unbuffered twice\n";
++$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
++var_dump($r->fetchAll());
++var_dump($r->fetchAll());
++
++echo "unbuffered with fetch_array\n";
++$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
++var_dump($r->fetch());
++var_dump($r->fetchAll());
++
++echo "buffered\n";
++$r = $db->query("SELECT a from strings", SQLITE_NUM);
++var_dump($r->fetchAll());
++var_dump($r->fetch());
++var_dump($r->fetchAll());
++
++echo "DONE!\n";
++?>
++--EXPECTF--
++unbuffered twice
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++
++Warning: SQLiteUnbuffered::fetchAll(): One or more rowsets were already returned; returning NULL this time in %ssqlite_oo_014.php on line %d
++array(0) {
++}
++unbuffered with fetch_array
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(2) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++buffered
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++bool(false)
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_015.phpt
+@@ -0,0 +1,47 @@
++--TEST--
++sqlite-oo: array_query
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++$res = $db->arrayQuery("SELECT a from strings", SQLITE_NUM);
++var_dump($res);
++
++echo "DONE!\n";
++?>
++--EXPECTF--
++array(3) {
++  [0]=>
++  array(1) {
++    [0]=>
++    string(3) "one"
++  }
++  [1]=>
++  array(1) {
++    [0]=>
++    string(3) "two"
++  }
++  [2]=>
++  array(1) {
++    [0]=>
++    string(5) "three"
++  }
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_016.phpt
+@@ -0,0 +1,42 @@
++--TEST--
++sqlite-oo: fetch single
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      array (0 => 'one', 1 => 'two'),
++      array (0 => 'three', 1 => 'four')
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR, b VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')");
++}
++
++echo "====BUFFERED====\n";
++$r = $db->query("SELECT a, b from strings");
++while ($r->valid()) {
++      var_dump($r->fetchSingle());
++}
++echo "====UNBUFFERED====\n";
++$r = $db->unbufferedQuery("SELECT a, b from strings");
++while ($r->valid()) {
++      var_dump($r->fetchSingle());
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++====BUFFERED====
++string(3) "one"
++string(5) "three"
++====UNBUFFERED====
++string(3) "one"
++string(5) "three"
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_020.phpt
+@@ -0,0 +1,66 @@
++--TEST--
++sqlite-oo: factory and exception
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++$dbname = tempnam(dirname(__FILE__), "phpsql");
++function cleanup() {
++      global $db, $dbname;
++
++      $db = NULL;
++      unlink($dbname);
++}
++register_shutdown_function("cleanup");
++
++try {
++      $db = sqlite_factory();
++} catch(SQLiteException $err) {
++      echo "Message: ".$err->getMessage()."\n";
++      echo "File: ".$err->getFile()."\n";
++      //echo "Line: ".$err->getLine()."\n";
++      //print_r($err->getTrace());
++      //echo "BackTrace: ".$err->getTraceAsString()."\n";
++}
++
++$db = sqlite_factory($dbname);
++
++$data = array(
++      array (0 => 'one', 1 => 'two'),
++      array (0 => 'three', 1 => 'four')
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR, b VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('${str[0]}','${str[1]}')");
++}
++
++$r = $db->unbufferedQuery("SELECT a, b from strings");
++while ($r->valid()) {
++      var_dump($r->current(SQLITE_NUM));
++      $r->next();
++}
++$r = null;
++$db = null;
++echo "DONE!\n";
++?>
++--EXPECTF--
++Message: sqlite_factory() expects at least 1 parameter, 0 given
++File: %ssqlite_oo_020.php
++array(2) {
++  [0]=>
++  string(3) "one"
++  [1]=>
++  string(3) "two"
++}
++array(2) {
++  [0]=>
++  string(5) "three"
++  [1]=>
++  string(4) "four"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_021.phpt
+@@ -0,0 +1,48 @@
++--TEST--
++sqlite-oo: single query
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE test_db ( id INTEGER PRIMARY KEY, data VARCHAR(100) )");
++for ($i = 0; $i < 10; $i++) {
++      $db->query("INSERT INTO test_db (data) VALUES('{$i}data')");
++}
++$db->query("INSERT INTO test_db (data) VALUES(NULL)");
++
++var_dump($db->singleQuery("SELECT id FROM test_db WHERE id=5"));
++var_dump($db->singleQuery("SELECT * FROM test_db WHERE id=4"));
++var_dump($db->singleQuery("SELECT data FROM test_db WHERE id=6"));
++var_dump($db->singleQuery("SELECT * FROM test_db WHERE id < 5"));
++var_dump($db->singleQuery("SELECT * FROM test db WHERE id < 4"));
++var_dump($db->singleQuery("SELECT * FROM test_db WHERE id=999999"));
++var_dump($db->singleQuery("SELECT id FROM test_db WHERE id=5", FALSE));
++
++echo "DONE!\n";
++?>
++--EXPECTF--
++string(1) "5"
++string(1) "4"
++string(5) "5data"
++array(4) {
++  [0]=>
++  string(1) "1"
++  [1]=>
++  string(1) "2"
++  [2]=>
++  string(1) "3"
++  [3]=>
++  string(1) "4"
++}
++
++Warning: SQLiteDatabase::singleQuery(): no such table: test in %s on line %d
++bool(false)
++NULL
++array(1) {
++  [0]=>
++  string(1) "5"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_022.phpt
+@@ -0,0 +1,98 @@
++--TEST--
++sqlite-oo: sqlite::seek
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++$res = $db->query("SELECT a FROM strings", SQLITE_NUM);
++for ($idx = -1; $idx < 4; $idx++) {
++      echo "====SEEK:$idx====\n";
++      $res->seek($idx);
++      var_dump($res->current());
++}
++echo "====AGAIN====\n";
++for ($idx = -1; $idx < 4; $idx++) {
++      echo "====SEEK:$idx====\n";
++      $res->seek($idx);
++      var_dump($res->current());
++}
++echo "====DONE!====\n";
++?>
++--EXPECTF--
++====SEEK:-1====
++
++Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====SEEK:0====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====SEEK:1====
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++====SEEK:2====
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====SEEK:3====
++
++Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====AGAIN====
++====SEEK:-1====
++
++Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====SEEK:0====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++====SEEK:1====
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++====SEEK:2====
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====SEEK:3====
++
++Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====DONE!====
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_024.phpt
+@@ -0,0 +1,74 @@
++--TEST--
++sqlite-oo: sqlite::fetch_object
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++class class24 {
++      function __construct() {
++              echo __METHOD__ . "\n";
++      }
++}
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++echo "====class24====\n";
++$res = $db->query("SELECT a FROM strings", SQLITE_ASSOC);
++while ($res->valid()) {
++      var_dump($res->fetchObject('class24'));
++}
++
++echo "====stdclass====\n";
++$res = $db->query("SELECT a FROM strings", SQLITE_ASSOC);
++while ($res->valid()) {
++      var_dump($res->fetchObject());
++}
++
++echo "====DONE!====\n";
++?>
++--EXPECTF--
++====class24====
++class24::__construct
++object(class24)#%d (1) {
++  ["a"]=>
++  string(3) "one"
++}
++class24::__construct
++object(class24)#%d (1) {
++  ["a"]=>
++  string(3) "two"
++}
++class24::__construct
++object(class24)#%d (1) {
++  ["a"]=>
++  string(5) "three"
++}
++====stdclass====
++object(stdClass)#%d (1) {
++  ["a"]=>
++  string(3) "one"
++}
++object(stdClass)#%d (1) {
++  ["a"]=>
++  string(3) "two"
++}
++object(stdClass)#%d (1) {
++  ["a"]=>
++  string(5) "three"
++}
++====DONE!====
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_025.phpt
+@@ -0,0 +1,103 @@
++--TEST--
++sqlite-oo: sqlite / foreach
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++echo "====UNBUFFERED====\n";
++$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
++//var_dump(class_implements($r));
++foreach($r as $row) {
++      var_dump($row);
++}
++echo "====NO-MORE====\n";
++foreach($r as $row) {
++      var_dump($row);
++}
++echo "====DIRECT====\n";
++foreach($db->unbufferedQuery("SELECT a from strings", SQLITE_NUM) as $row) {
++      var_dump($row);
++}
++echo "====BUFFERED====\n";
++$r = $db->query("SELECT a from strings", SQLITE_NUM);
++//var_dump(class_implements($r));
++foreach($r as $row) {
++      var_dump($row);
++}
++foreach($r as $row) {
++      var_dump($row);
++}
++echo "DONE!\n";
++?>
++--EXPECT--
++====UNBUFFERED====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====NO-MORE====
++====DIRECT====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++====BUFFERED====
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++array(1) {
++  [0]=>
++  string(3) "one"
++}
++array(1) {
++  [0]=>
++  string(3) "two"
++}
++array(1) {
++  [0]=>
++  string(5) "three"
++}
++DONE!
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_026.phpt
+@@ -0,0 +1,56 @@
++--TEST--
++sqlite-oo: unbuffered
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array(
++      "one",
++      "two",
++      "three"
++      );
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++}
++
++echo "====FOREACH====\n";
++$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
++foreach($r as $idx => $row) {
++      var_dump($row[0]);
++      var_dump($row[0]);
++}
++echo "====FOR====\n";
++$r = $db->unbufferedQuery("SELECT a from strings", SQLITE_NUM);
++for(;$r->valid(); $r->next()) {
++      $v = $r->column(0);
++      var_dump($v);
++      $c = $r->column(0);
++      var_dump(is_null($c) || $c==$v);
++}
++echo "===DONE===\n";
++?>
++--EXPECT--
++====FOREACH====
++string(3) "one"
++string(3) "one"
++string(3) "two"
++string(3) "two"
++string(5) "three"
++string(5) "three"
++====FOR====
++string(3) "one"
++bool(true)
++string(3) "two"
++bool(true)
++string(5) "three"
++bool(true)
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_027.phpt
+@@ -0,0 +1,42 @@
++--TEST--
++sqlite-oo: changes
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$data = array("one", "two", "three");
++
++$db->query("CREATE TABLE strings(a VARCHAR)");
++
++foreach ($data as $str) {
++      $db->query("INSERT INTO strings VALUES('$str')");
++      echo $db->changes() . "\n";
++}
++
++$db->query("UPDATE strings SET a='foo' WHERE a!='two'");
++echo $db->changes() . "\n";
++
++$db->query("DELETE FROM strings WHERE 1");
++echo $db->changes() . "\n";
++
++$str = '';
++foreach ($data as $s) {
++      $str .= "INSERT INTO strings VALUES('".$s."');";
++}
++$db->query($str);
++echo $db->changes() . "\n";
++
++?>
++--EXPECT--
++1
++1
++1
++2
++3
++3
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_028.phpt
+@@ -0,0 +1,25 @@
++--TEST--
++sqlite-oo: sqlite_fetch_column_types
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php 
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE strings(a, b INTEGER, c VARCHAR(10), d)");
++$db->query("INSERT INTO strings VALUES('1', '2', '3', 'abc')");
++
++var_dump($db->fetchColumnTypes("strings"));
++?>
++--EXPECT--
++array(4) {
++  ["a"]=>
++  string(0) ""
++  ["b"]=>
++  string(7) "INTEGER"
++  ["c"]=>
++  string(11) "VARCHAR(10)"
++  ["d"]=>
++  string(0) ""
++}
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_029.phpt
+@@ -0,0 +1,53 @@
++--TEST--
++sqlite-oo: call method with $this
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE strings(key VARCHAR(10), var VARCHAR(10))");
++$db->query("INSERT INTO strings VALUES('foo', 'foo')");
++
++class sqlite_help
++{
++      function __construct($db){
++              $this->db = $db;
++              $this->db->createFunction('link_keywords', array(&$this, 'linkers'), 1);
++      }
++
++      function getSingle($key)
++      {
++              return $this->db->singleQuery('SELECT link_keywords(var) FROM strings WHERE key=\''.$key.'\'', 1);
++      }
++
++      function linkers($str)
++      {
++              $str = str_replace('foo', 'bar', $str);
++              return $str;
++      }
++
++      function free()
++      {
++              unset($this->db);
++      }
++
++      function __destruct()
++      {
++              echo "DESTRUCTED\n";
++      }
++}
++
++$obj = new sqlite_help($db);
++echo $obj->getSingle('foo')."\n";
++$obj->free();
++unset($obj);
++
++?>
++===DONE===
++--EXPECT--
++bar
++===DONE===
++DESTRUCTED
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_oo_030.phpt
+@@ -0,0 +1,44 @@
++--TEST--
++sqlite-oo: calling static methods
++--INI--
++sqlite.assoc_case=0
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++?>
++--FILE--
++<?php
++
++require_once('blankdb_oo.inc'); 
++
++class foo {
++    static function bar($param = NULL) {
++              return $param;
++    }
++}
++
++function baz($param = NULL) {
++      return $param;
++}
++
++var_dump($db->singleQuery("select php('baz')", 1));
++var_dump($db->singleQuery("select php('baz', 1)", 1));
++var_dump($db->singleQuery("select php('baz', \"PHP\")", 1));
++var_dump($db->singleQuery("select php('foo::bar')", 1));
++var_dump($db->singleQuery("select php('foo::bar', 1)", 1));
++var_dump($db->singleQuery("select php('foo::bar', \"PHP\")", 1));
++var_dump($db->singleQuery("select php('foo::bar(\"PHP\")')", 1));
++
++?>
++===DONE===
++--EXPECTF--
++NULL
++string(1) "1"
++string(3) "PHP"
++NULL
++string(1) "1"
++string(3) "PHP"
++
++Warning: SQLiteDatabase::singleQuery(): function `foo::bar("PHP")' is not a function name in %ssqlite_oo_030.php on line %d
++bool(false)
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_popen_basic.phpt
+@@ -0,0 +1,27 @@
++--TEST--
++SQLite: sqlite_popen() basic tests
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip"; ?>
++--FILE--
++<?php
++/* Prototype  : resource sqlite_popen(string filename [, int mode [, string &error_message]])
++ * Description: Opens a persistent handle to a SQLite database. Will create the database if it does not exist.
++ * Source code: ext/sqlite/sqlite.c
++ * Alias to functions:
++*/
++
++      $db1 = sqlite_popen(":memory:");
++      $db2 = sqlite_popen(":memory:");
++
++      var_dump($db1);
++      var_dump($db2);
++
++      list($resourceId1) = sscanf((string) $db1, "resource(%d) of type (sqlite database (persistent))");
++      list($resourceId2) = sscanf((string) $db2, "resource(%d) of type (sqlite database (persistent))");
++
++      var_dump($resourceId1 === $resourceId2);
++?>
++--EXPECTF--
++resource(%d) of type (sqlite database (persistent))
++resource(%d) of type (sqlite database (persistent))
++bool(true)
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_popen_error.phpt
+@@ -0,0 +1,34 @@
++--TEST--
++Test sqlite_popen() function : error conditions 
++--SKIPIF--
++<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
++--FILE--
++<?php
++/* Prototype  : resource sqlite_popen(string filename [, int mode [, string &error_message]])
++ * Description: Opens a persistent handle to a SQLite database. Will create the database if it does not exist. 
++ * Source code: ext/sqlite/sqlite.c
++ * Alias to functions: 
++ */
++
++$message = '';
++
++echo "*** Testing sqlite_popen() : error conditions ***\n";
++
++var_dump( sqlite_popen() );
++var_dump( sqlite_popen(":memory:", 0666, $message, 'foobar') );
++var_dump( sqlite_popen("", 0666, $message) );
++var_dump( $message );
++
++?>
++===DONE===
++--EXPECTF--
++*** Testing sqlite_popen() : error conditions ***
++
++Warning: sqlite_popen() expects at least 1 parameter, 0 given in %s on line %d
++NULL
++
++Warning: sqlite_popen() expects at most 3 parameters, 4 given in %s on line %d
++NULL
++bool(false)
++NULL
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_session_001.phpt
+@@ -0,0 +1,46 @@
++--TEST--
++sqlite, session storage test
++--CREDITS--
++Mats Lindh <mats at lindh.no>
++#Testfest php.no
++--INI--
++session.save_handler = sqlite
++--SKIPIF--
++if (!extension_loaded("session"))
++{
++      die("skip Session module not loaded");
++}
++if (!extension_loaded("sqlite"))
++{
++      die("skip Session module not loaded");
++}
++--FILE--
++<?php
++/* Description: Tests that sqlite can be used as a session save handler
++* Source code: ext/sqlite/sess_sqlite.c
++*/
++
++ob_start();
++session_save_path(__DIR__ . "/sessiondb.sdb");
++
++// create the session and set a session value
++session_start();
++$_SESSION["test"] = "foo_bar";
++
++// close the session and unset the value
++session_write_close();
++unset($_SESSION["test"]);
++var_dump(isset($_SESSION["test"]));
++
++// start the session again and check that we have the proper value
++session_start();
++var_dump($_SESSION["test"]);
++ob_end_flush();
++?>
++--EXPECTF--
++bool(false)
++%unicode|string%(7) "foo_bar"
++--CLEAN--
++<?php
++      unlink(__DIR__ . "/sessiondb.sdb")
++?>
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_session_002.phpt
+@@ -0,0 +1,54 @@
++--TEST--
++sqlite, session destroy test
++--CREDITS--
++Mats Lindh <mats at lindh.no>
++#Testfest php.no
++--INI--
++session.save_handler = sqlite
++--SKIPIF--
++if (!extension_loaded("session"))
++{
++      die("skip Session module not loaded");
++}
++if (!extension_loaded("sqlite"))
++{
++      die("skip sqlite module not loaded");
++}
++--FILE--
++<?php
++/* Description: Tests that sqlite will destroy a session when used as a session handler
++* Source code: ext/sqlite/sess_sqlite.c
++*/
++ob_start();
++session_save_path(__DIR__ . "/sessiondb.sdb");
++
++// start a session and save a value to it before commiting the session to the database
++session_start();
++$_SESSION["test"] = "foo_bar";
++session_write_close();
++
++// remove the session value
++unset($_SESSION["test"]);
++var_dump(isset($_SESSION["test"]));
++
++// start the session again and destroy it
++session_start();
++var_dump($_SESSION["test"]);
++session_destroy();
++session_write_close();
++
++unset($_SESSION["test"]);
++
++// check that the session has been destroyed
++session_start();
++var_dump(isset($_SESSION["test"]));
++ob_end_flush();
++?>
++--EXPECTF--
++bool(false)
++%unicode|string%(7) "foo_bar"
++bool(false)
++--CLEAN--
++<?php
++      unlink(__DIR__ . "/sessiondb.sdb")
++?>
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_spl_001.phpt
+@@ -0,0 +1,125 @@
++--TEST--
++sqlite-spl: Iteration
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++if (!extension_loaded("spl")) print "skip SPL is not present"; 
++?>
++--FILE--
++<?php
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE menu(id_l int PRIMARY KEY, id_r int UNIQUE, key VARCHAR(10))");
++$db->query("INSERT INTO menu VALUES( 1, 12, 'A')"); 
++$db->query("INSERT INTO menu VALUES( 2,  9, 'B')"); 
++$db->query("INSERT INTO menu VALUES(10, 11, 'F')"); 
++$db->query("INSERT INTO menu VALUES( 3,  6, 'C')"); 
++$db->query("INSERT INTO menu VALUES( 7,  8, 'E')"); 
++$db->query("INSERT INTO menu VALUES( 4,  5, 'D')"); 
++
++class SqliteNestedsetElement
++{
++      protected $id_l;
++      protected $id_r;
++      protected $key;
++
++      function __construct($db)
++      {
++              $this->db = $db;
++      }
++      
++      function getLeft()
++      {
++              return $this->id_l;
++      }
++      
++      function getRight()
++      {
++              return $this->id_r;
++      }
++      
++      function __toString()
++      {
++              return $this->key;
++      }
++
++      function key()
++      {
++              return $this->key;
++      }
++}
++
++class SqliteNestedset implements RecursiveIterator
++{
++      protected $id;
++      protected $id_l;
++      protected $id_r;
++      protected $entry;
++
++      function __construct($db, $id_l = 1)
++      {
++              $this->db = $db;
++              $this->id_l = $id_l;
++              $this->id_r = $this->db->singleQuery('SELECT id_r FROM menu WHERE id_l='.$id_l, 1);
++              $this->id = $id_l;
++      }
++      
++      function rewind()
++      {
++              $this->id = $this->id_l;
++              $this->fetch();
++      }
++
++      function valid()
++      {
++              return is_object($this->entry);
++      }
++      
++      function current()
++      {
++              return $this->entry->__toString();
++      }
++      
++      function key()
++      {
++              return $this->entry->key();;
++      }
++      
++      function next()
++      {
++              $this->id = $this->entry->getRight() + 1;
++              $this->fetch();
++      }
++
++      protected function fetch()
++      {
++              $res = $this->db->unbufferedQuery('SELECT * FROM menu WHERE id_l='.$this->id);
++              $this->entry = $res->fetchObject('SqliteNestedsetElement', array(&$this->db));
++              unset($res);
++      }
++      
++      function hasChildren()
++      {
++              return $this->entry->getLeft() + 1 < $this->entry->getRight();
++      }
++      
++      function getChildren()
++      {
++              return new SqliteNestedset($this->db, $this->entry->getLeft() + 1, $this->entry->getRight() - 1);
++      }
++}
++
++$menu_iterator = new RecursiveIteratorIterator(new SqliteNestedset($db), RecursiveIteratorIterator::SELF_FIRST);
++foreach($menu_iterator as $entry) {
++      echo $menu_iterator->getDepth() . $entry . "\n";
++}
++?>
++===DONE===
++--EXPECT--
++0A
++1B
++2C
++3D
++2E
++1F
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_spl_002.phpt
+@@ -0,0 +1,29 @@
++--TEST--
++sqlite-spl: Countable
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++if (!extension_loaded("spl")) print "skip SPL is not present"; 
++?>
++--FILE--
++<?php
++include "blankdb_oo.inc";
++
++$db->query("CREATE TABLE menu(id_l int PRIMARY KEY, id_r int UNIQUE, key VARCHAR(10))");
++$db->query("INSERT INTO menu VALUES( 1, 12, 'A')"); 
++$db->query("INSERT INTO menu VALUES( 2,  9, 'B')"); 
++$db->query("INSERT INTO menu VALUES(10, 11, 'F')"); 
++$db->query("INSERT INTO menu VALUES( 3,  6, 'C')"); 
++$db->query("INSERT INTO menu VALUES( 7,  8, 'E')"); 
++$db->query("INSERT INTO menu VALUES( 4,  5, 'D')"); 
++
++$res = $db->query("SELECT * from menu");
++
++var_dump($res->count());
++var_dump(count($res));
++?>
++===DONE===
++--EXPECT--
++int(6)
++int(6)
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/tests/sqlite_spl_003.phpt
+@@ -0,0 +1,28 @@
++--TEST--
++sqlite-spl: Exception
++--SKIPIF--
++<?php # vim:ft=php
++if (!extension_loaded("sqlite")) print "skip"; 
++if (!extension_loaded("spl")) print "skip SPL is not present"; 
++?>
++--FILE--
++<?php
++
++try
++{
++      $db = sqlite_factory();
++}
++catch(SQLiteException $e)
++{
++      $parents = class_parents($e);
++      if (array_key_exists('RuntimeException', $parents))
++      {
++              echo "GOOD\n";
++      }
++}
++
++?>
++===DONE===
++--EXPECT--
++GOOD
++===DONE===
+--- /dev/null
++++ b/ext/sqlite/TODO
+@@ -0,0 +1,19 @@
++- Implement a PDO driver, called sqlite2
++
++- Transparent binary encoding of return values from PHP callback functions.
++
++- Add user-space callback for the authorizer function (this is potentially
++  very slow, so it needs to be implemented carefully).
++
++- Add user-space callback to handle busy databases.
++
++  o Test how robust we are when a user-space function is registered as
++    a callback for a persistent connection in script A, then script B is
++      called that doesn't register the callback but does make use of the
++      function in an SQL query.
++      --> Our test suite doesn't allow us to test persistent connections
++          at this time :/
++
++- Use later version of built-in library
++
++vim:tw=78
diff --git a/lang/php5/patches/091-fix-sqlite2.patch b/lang/php5/patches/091-fix-sqlite2.patch
new file mode 100644 (file)
index 0000000..fcbfb23
--- /dev/null
@@ -0,0 +1,101 @@
+--- a/ext/sqlite/pdo_sqlite2.c
++++ b/ext/sqlite/pdo_sqlite2.c
+@@ -522,11 +522,6 @@ static char *make_filename_safe(const ch
+                       return NULL;
+               }
+-              if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+-                      efree(fullpath);
+-                      return NULL;
+-              }
+-
+               if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+                       efree(fullpath);
+                       return NULL;
+@@ -585,7 +580,7 @@ static int pdo_sqlite2_handle_factory(pd
+       if (!filename) {
+               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+-                              "safe_mode/open_basedir prohibits opening %s",
++                              "open_basedir prohibits opening %s",
+                               dbh->data_source);
+               goto cleanup;
+       }
+--- a/ext/sqlite/sqlite.c
++++ b/ext/sqlite/sqlite.c
+@@ -1066,10 +1066,6 @@ static int php_sqlite_authorizer(void *a
+               case SQLITE_COPY:
+                       if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) {
+                               TSRMLS_FETCH();
+-                              if (PG(safe_mode) && (!php_checkuid(arg4, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+-                                      return SQLITE_DENY;
+-                              }
+-
+                               if (php_check_open_basedir(arg4 TSRMLS_CC)) {
+                                       return SQLITE_DENY;
+                               }
+@@ -1079,10 +1075,6 @@ static int php_sqlite_authorizer(void *a
+               case SQLITE_ATTACH:
+                       if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) {
+                               TSRMLS_FETCH();
+-                              if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+-                                      return SQLITE_DENY;
+-                              }
+-
+                               if (php_check_open_basedir(arg3 TSRMLS_CC)) {
+                                       return SQLITE_DENY;
+                               }
+@@ -1160,13 +1152,12 @@ static void sqlite_object_free_storage(v
+ static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers *handlers, zend_object_value *retval TSRMLS_DC)
+ {
+       sqlite_object *intern;
+-      zval *tmp;
+       intern = emalloc(sizeof(sqlite_object));
+       memset(intern, 0, sizeof(sqlite_object));
+       zend_object_std_init(&intern->std, class_type TSRMLS_CC);
+-      zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
++      object_properties_init(&intern->std, class_type);
+       retval->handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) sqlite_object_free_storage, NULL TSRMLS_CC);
+       retval->handlers = handlers;
+@@ -1510,7 +1501,7 @@ static struct php_sqlite_db *php_sqlite_
+       /* authorizer hook so we can enforce safe mode
+        * Note: the declaration of php_sqlite_authorizer is correct for 2.8.2 of libsqlite,
+        * and IS backwards binary compatible with earlier versions */
+-      if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
++      if (PG(open_basedir) && *PG(open_basedir)) {
+               sqlite_set_authorizer(sdb, php_sqlite_authorizer, NULL);
+       }
+@@ -1569,8 +1560,7 @@ PHP_FUNCTION(sqlite_popen)
+                       RETURN_FALSE;
+               }
+-              if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || 
+-                              php_check_open_basedir(fullpath TSRMLS_CC)) {
++              if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+                       efree(fullpath);
+                       RETURN_FALSE;
+               }
+@@ -1656,8 +1646,7 @@ PHP_FUNCTION(sqlite_open)
+                       }
+               }
+-              if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
+-                              php_check_open_basedir(fullpath TSRMLS_CC)) {
++              if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+                       efree(fullpath);
+                       zend_restore_error_handling(&error_handling TSRMLS_CC);
+                       if (object) {
+@@ -1710,8 +1699,7 @@ PHP_FUNCTION(sqlite_factory)
+                       RETURN_NULL();
+               }
+-              if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
+-                              php_check_open_basedir(fullpath TSRMLS_CC)) {
++              if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+                       efree(fullpath);
+                       zend_restore_error_handling(&error_handling TSRMLS_CC);
+                       RETURN_NULL();
diff --git a/lang/php5/patches/101-fix_membar_producer_link_error_gcc3x.patch b/lang/php5/patches/101-fix_membar_producer_link_error_gcc3x.patch
new file mode 100644 (file)
index 0000000..3e81dd6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ext/standard/php_crypt_r.c
++++ b/ext/standard/php_crypt_r.c
+@@ -96,6 +96,8 @@ void _crypt_extended_init_r(void)
+               InterlockedIncrement(&initialized);
+ #elif defined(HAVE_SYNC_FETCH_AND_ADD)
+               __sync_fetch_and_add(&initialized, 1);
++#elif (defined(__GNUC__) && (__GNUC__ == 3))
++              initialized = 1;
+ #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */
+               membar_producer();
+               atomic_add_int(&initialized, 1);
diff --git a/lang/php5/patches/102-debian_patches_use_embedded_timezonedb.patch b/lang/php5/patches/102-debian_patches_use_embedded_timezonedb.patch
new file mode 100644 (file)
index 0000000..438274a
--- /dev/null
@@ -0,0 +1,620 @@
+
+Add support for use of the system timezone database, rather
+than embedding a copy.  Discussed upstream but was not desired.
+
+History:
+r9: fix another compile error without --with-system-tzdata configured
+r8: fix compile error without --with-system-tzdata configured
+r7: improve check for valid timezone id to exclude directories
+r6: fix fd leak in r5, fix country code/BC flag use in 
+    timezone_identifiers_list() using system db,
+    fix use of PECL timezonedb to override system db,
+r5: reverts addition of "System/Localtime" fake tzname.
+    updated for 5.3.0, parses zone.tab to pick up mapping between
+    timezone name, country code and long/lat coords
+r4: added "System/Localtime" tzname which uses /etc/localtime
+r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert)
+r2: add filesystem trawl to set up name alias index
+r1: initial revision
+
+--- a/ext/date/lib/parse_tz.c
++++ b/ext/date/lib/parse_tz.c
+@@ -20,6 +20,16 @@
+ #include "timelib.h"
++#ifdef HAVE_SYSTEM_TZDATA
++#include <sys/mman.h>
++#include <sys/stat.h>
++#include <limits.h>
++#include <fcntl.h>
++#include <unistd.h>
++
++#include "php_scandir.h"
++#endif
++
+ #include <stdio.h>
+ #ifdef HAVE_LOCALE_H
+@@ -31,7 +41,12 @@
+ #else
+ #include <strings.h>
+ #endif
++
++#ifndef HAVE_SYSTEM_TZDATA
+ #include "timezonedb.h"
++#endif
++
++#include <ctype.h>
+ #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+ # if defined(__LITTLE_ENDIAN__)
+@@ -51,9 +66,14 @@
+ static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
+ {
+-      /* skip ID */
+-      *tzf += 4;
+-      
++        if (memcmp(tzf, "TZif", 4) == 0) {
++                *tzf += 20;
++                return;
++        }
++        
++        /* skip ID */
++        *tzf += 4;
++                
+       /* read BC flag */
+       tz->bc = (**tzf == '\1');
+       *tzf += 1;
+@@ -256,7 +276,397 @@ void timelib_dump_tzinfo(timelib_tzinfo
+       }
+ }
+-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
++#ifdef HAVE_SYSTEM_TZDATA
++
++#ifdef HAVE_SYSTEM_TZDATA_PREFIX
++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX
++#else
++#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
++#endif
++
++/* System timezone database pointer. */
++static const timelib_tzdb *timezonedb_system = NULL;
++
++/* Hash table entry for the cache of the zone.tab mapping table. */
++struct location_info {
++        char code[2];
++        double latitude, longitude;
++        char name[64];
++        char *comment;
++        struct location_info *next;
++};
++
++/* Cache of zone.tab. */
++static struct location_info **system_location_table;
++
++/* Size of the zone.tab hash table; a random-ish prime big enough to
++ * prevent too many collisions. */
++#define LOCINFO_HASH_SIZE (1021)
++
++static uint32_t tz_hash(const char *str)
++{
++    const unsigned char *p = (const unsigned char *)str;
++    uint32_t hash = 5381;
++    int c;
++    
++    while ((c = *p++) != '\0') {
++        hash = (hash << 5) ^ hash ^ c;
++    }
++    
++    return hash % LOCINFO_HASH_SIZE;
++}
++
++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the
++ * parsed string on success, or NULL on parse error.  On success,
++ * writes the parsed number to *result. */
++static char *parse_iso6709(char *p, double *result)
++{
++    double v, sign;
++    char *pend;
++    size_t len;
++
++    if (*p == '+')
++        sign = 1.0;
++    else if (*p == '-')
++        sign = -1.0;
++    else
++        return NULL;
++
++    p++;
++    for (pend = p; *pend >= '0' && *pend <= '9'; pend++)
++        ;;
++
++    /* Annoying encoding used by zone.tab has no decimal point, so use
++     * the length to determine the format:
++     * 
++     * 4 = DDMM
++     * 5 = DDDMM
++     * 6 = DDMMSS
++     * 7 = DDDMMSS
++     */
++    len = pend - p;
++    if (len < 4 || len > 7) {
++        return NULL;
++    }
++
++    /* p => [D]DD */
++    v = (p[0] - '0') * 10.0 + (p[1] - '0');
++    p += 2;
++    if (len == 5 || len == 7)
++        v = v * 10.0 + (*p++ - '0');
++    /* p => MM[SS] */
++    v += (10.0 * (p[0] - '0')
++          + p[1] - '0') / 60.0;
++    p += 2;
++    /* p => [SS] */
++    if (len > 5) {
++        v += (10.0 * (p[0] - '0')
++              + p[1] - '0') / 3600.0;
++        p += 2;
++    }
++
++    /* Round to five decimal place, not because it's a good idea,
++     * but, because the builtin data uses rounded data, so, match
++     * that. */
++    *result = round(v * sign * 100000.0) / 100000.0;
++
++    return p;
++}
++
++/* This function parses the zone.tab file to build up the mapping of
++ * timezone to country code and geographic location, and returns a
++ * hash table.  The hash table is indexed by the function:
++ *
++ *   tz_hash(timezone-name)
++ */
++static struct location_info **create_location_table(void)
++{
++    struct location_info **li, *i;
++    char zone_tab[PATH_MAX];
++    char line[512];
++    FILE *fp;
++
++    strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab);
++
++    fp = fopen(zone_tab, "r");
++    if (!fp) {
++        return NULL;
++    }
++
++    li = calloc(LOCINFO_HASH_SIZE, sizeof *li);
++
++    while (fgets(line, sizeof line, fp)) {
++        char *p = line, *code, *name, *comment;
++        uint32_t hash;
++        double latitude, longitude;
++
++        while (isspace(*p))
++            p++;
++
++        if (*p == '#' || *p == '\0' || *p == '\n')
++            continue;
++        
++        if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t')
++            continue;
++        
++        /* code => AA */
++        code = p;
++        p[2] = 0;
++        p += 3;
++
++        /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */
++        p = parse_iso6709(p, &latitude);
++        if (!p) {
++            continue;
++        }
++        p = parse_iso6709(p, &longitude);
++        if (!p) {
++            continue;
++        }
++
++        if (!p || *p != '\t') {
++            continue;
++        }
++
++        /* name = string */
++        name = ++p;
++        while (*p != '\t' && *p && *p != '\n')
++            p++;
++
++        *p++ = '\0';
++
++        /* comment = string */
++        comment = p;
++        while (*p != '\t' && *p && *p != '\n')
++            p++;
++
++        if (*p == '\n' || *p == '\t')
++            *p = '\0';
++        
++        hash = tz_hash(name);
++        i = malloc(sizeof *i);
++        memcpy(i->code, code, 2);
++        strncpy(i->name, name, sizeof i->name);
++        i->comment = strdup(comment);
++        i->longitude = longitude;
++        i->latitude = latitude;
++        i->next = li[hash];
++        li[hash] = i;
++        /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */
++    }
++
++    fclose(fp);
++
++    return li;
++}
++
++/* Return location info from hash table, using given timezone name.
++ * Returns NULL if the name could not be found. */
++const struct location_info *find_zone_info(struct location_info **li, 
++                                           const char *name)
++{
++    uint32_t hash = tz_hash(name);
++    const struct location_info *l;
++
++    if (!li) {
++        return NULL;
++    }
++
++    for (l = li[hash]; l; l = l->next) {
++        if (strcasecmp(l->name, name) == 0)
++            return l;
++    }
++
++    return NULL;
++}    
++
++/* Filter out some non-tzdata files and the posix/right databases, if
++ * present. */
++static int index_filter(const struct dirent *ent)
++{
++      return strcmp(ent->d_name, ".") != 0
++              && strcmp(ent->d_name, "..") != 0
++              && strcmp(ent->d_name, "posix") != 0
++              && strcmp(ent->d_name, "posixrules") != 0
++              && strcmp(ent->d_name, "right") != 0
++              && strstr(ent->d_name, ".tab") == NULL;
++}
++
++static int sysdbcmp(const void *first, const void *second)
++{
++        const timelib_tzdb_index_entry *alpha = first, *beta = second;
++
++        return strcmp(alpha->id, beta->id);
++}
++
++
++/* Create the zone identifier index by trawling the filesystem. */
++static void create_zone_index(timelib_tzdb *db)
++{
++      size_t dirstack_size,  dirstack_top;
++      size_t index_size, index_next;
++      timelib_tzdb_index_entry *db_index;
++      char **dirstack;
++
++      /* LIFO stack to hold directory entries to scan; each slot is a
++       * directory name relative to the zoneinfo prefix. */
++      dirstack_size = 32;
++      dirstack = malloc(dirstack_size * sizeof *dirstack);
++      dirstack_top = 1;
++      dirstack[0] = strdup("");
++      
++      /* Index array. */
++      index_size = 64;
++      db_index = malloc(index_size * sizeof *db_index);
++      index_next = 0;
++
++      do {
++              struct dirent **ents;
++              char name[PATH_MAX], *top;
++              int count;
++
++              /* Pop the top stack entry, and iterate through its contents. */
++              top = dirstack[--dirstack_top];
++              snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top);
++
++              count = php_scandir(name, &ents, index_filter, php_alphasort);
++
++              while (count > 0) {
++                      struct stat st;
++                      const char *leaf = ents[count - 1]->d_name;
++
++                      snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", 
++                               top, leaf);
++                      
++                      if (strlen(name) && stat(name, &st) == 0) {
++                              /* Name, relative to the zoneinfo prefix. */
++                              const char *root = top;
++
++                              if (root[0] == '/') root++;
++
++                              snprintf(name, sizeof name, "%s%s%s", root, 
++                                       *root ? "/": "", leaf);
++
++                              if (S_ISDIR(st.st_mode)) {
++                                      if (dirstack_top == dirstack_size) {
++                                              dirstack_size *= 2;
++                                              dirstack = realloc(dirstack, 
++                                                                 dirstack_size * sizeof *dirstack);
++                                      }
++                                      dirstack[dirstack_top++] = strdup(name);
++                              }
++                              else {
++                                      if (index_next == index_size) {
++                                              index_size *= 2;
++                                              db_index = realloc(db_index,
++                                                                 index_size * sizeof *db_index);
++                                      }
++
++                                      db_index[index_next++].id = strdup(name);
++                              }
++                      }
++
++                      free(ents[--count]);
++              }
++              
++              if (count != -1) free(ents);
++              free(top);
++      } while (dirstack_top);
++
++        qsort(db_index, index_next, sizeof *db_index, sysdbcmp);
++
++      db->index = db_index;
++      db->index_size = index_next;
++
++      free(dirstack);
++}
++
++#define FAKE_HEADER "1234\0??\1??"
++#define FAKE_UTC_POS (7 - 4)
++
++/* Create a fake data segment for database 'sysdb'. */
++static void fake_data_segment(timelib_tzdb *sysdb,
++                              struct location_info **info)
++{
++        size_t n;
++        char *data, *p;
++        
++        data = malloc(3 * sysdb->index_size + 7);
++
++        p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1);
++
++        for (n = 0; n < sysdb->index_size; n++) {
++                const struct location_info *li;
++                timelib_tzdb_index_entry *ent;
++
++                ent = (timelib_tzdb_index_entry *)&sysdb->index[n];
++
++                /* Lookup the timezone name in the hash table. */
++                if (strcmp(ent->id, "UTC") == 0) {
++                        ent->pos = FAKE_UTC_POS;
++                        continue;
++                }
++
++                li = find_zone_info(info, ent->id);
++                if (li) {
++                        /* If found, append the BC byte and the
++                         * country code; set the position for this
++                         * section of timezone data.  */
++                        ent->pos = (p - data) - 4;
++                        *p++ = '\1';
++                        *p++ = li->code[0];
++                        *p++ = li->code[1];
++                }
++                else {
++                        /* If not found, the timezone data can
++                         * point at the header. */
++                        ent->pos = 0;
++                }
++        }
++        
++        sysdb->data = (unsigned char *)data;
++}
++
++/* Returns true if the passed-in stat structure describes a
++ * probably-valid timezone file. */
++static int is_valid_tzfile(const struct stat *st)
++{
++      return S_ISREG(st->st_mode) && st->st_size > 20;
++}
++
++/* Return the mmap()ed tzfile if found, else NULL.  On success, the
++ * length of the mapped data is placed in *length. */
++static char *map_tzfile(const char *timezone, size_t *length)
++{
++      char fname[PATH_MAX];
++      struct stat st;
++      char *p;
++      int fd;
++      
++      if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
++              return NULL;
++      }
++
++      snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
++      
++      fd = open(fname, O_RDONLY);
++      if (fd == -1) {
++              return NULL;
++      } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) {
++              close(fd);
++              return NULL;
++      }
++
++      *length = st.st_size;
++      p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
++      close(fd);
++      
++      return p != MAP_FAILED ? p : NULL;
++}
++
++#endif
++
++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
+ {
+       int left = 0, right = tzdb->index_size - 1;
+ #ifdef HAVE_SETLOCALE
+@@ -295,36 +705,128 @@ static int seek_to_tz_position(const uns
+       return 0;
+ }
++static int seek_to_tz_position(const unsigned char **tzf, char *timezone, 
++                             char **map, size_t *maplen,
++                             const timelib_tzdb *tzdb)
++{
++#ifdef HAVE_SYSTEM_TZDATA
++      if (tzdb == timezonedb_system) {
++              char *orig;
++
++              orig = map_tzfile(timezone, maplen);
++              if (orig == NULL) {
++                      return 0;
++              }
++              
++              (*tzf) = (unsigned char *)orig ;
++              *map = orig;
++                
++                return 1;
++      }
++      else
++#endif
++      {
++              return inmem_seek_to_tz_position(tzf, timezone, tzdb);
++      }
++}
++
+ const timelib_tzdb *timelib_builtin_db(void)
+ {
++#ifdef HAVE_SYSTEM_TZDATA
++      if (timezonedb_system == NULL) {
++              timelib_tzdb *tmp = malloc(sizeof *tmp);
++
++              tmp->version = "0.system";
++              tmp->data = NULL;
++              create_zone_index(tmp);
++              system_location_table = create_location_table();
++                fake_data_segment(tmp, system_location_table);
++              timezonedb_system = tmp;
++      }
++
++                      
++      return timezonedb_system;
++#else
+       return &timezonedb_builtin;
++#endif
+ }
+ const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count)
+ {
++#ifdef HAVE_SYSTEM_TZDATA
++      *count = timezonedb_system->index_size;
++      return timezonedb_system->index;
++#else
+       *count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin);
+       return timezonedb_idx_builtin;
++#endif
+ }
+ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
+ {
+       const unsigned char *tzf;
+-      return (seek_to_tz_position(&tzf, timezone, tzdb));
++
++#ifdef HAVE_SYSTEM_TZDATA
++        if (tzdb == timezonedb_system) {
++            char fname[PATH_MAX];
++            struct stat st;
++
++            if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
++              return 0;
++            }
++            
++            snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
++            
++            return stat(fname, &st) == 0 && is_valid_tzfile(&st);
++        }
++#endif
++
++      return (inmem_seek_to_tz_position(&tzf, timezone, tzdb));
+ }
+ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
+ {
+       const unsigned char *tzf;
++      char *memmap = NULL;
++      size_t maplen;
+       timelib_tzinfo *tmp;
+-      if (seek_to_tz_position(&tzf, timezone, tzdb)) {
++      if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) {
+               tmp = timelib_tzinfo_ctor(timezone);
+               read_preamble(&tzf, tmp);
+               read_header(&tzf, tmp);
+               read_transistions(&tzf, tmp);
+               read_types(&tzf, tmp);
+-              read_location(&tzf, tmp);
++
++#ifdef HAVE_SYSTEM_TZDATA
++              if (memmap) {
++                      const struct location_info *li;
++
++                      /* TZif-style - grok the location info from the system database,
++                       * if possible. */
++
++                      if ((li = find_zone_info(system_location_table, timezone)) != NULL) {
++                              tmp->location.comments = strdup(li->comment);
++                                strncpy(tmp->location.country_code, li->code, 2);
++                              tmp->location.longitude = li->longitude;
++                              tmp->location.latitude = li->latitude;
++                              tmp->bc = 1;
++                      }
++                      else {
++                              strcpy(tmp->location.country_code, "??");
++                              tmp->bc = 0;
++                              tmp->location.comments = strdup("");
++                      }
++
++                      /* Now done with the mmap segment - discard it. */
++                      munmap(memmap, maplen);
++              } else
++#endif
++              {
++                      /* PHP-style - use the embedded info. */
++                      read_location(&tzf, tmp);
++              }
+       } else {
+               tmp = NULL;
+       }
+--- a/ext/date/lib/timelib.m4
++++ b/ext/date/lib/timelib.m4
+@@ -78,3 +78,17 @@ stdlib.h
+ dnl Check for strtoll, atoll
+ AC_CHECK_FUNCS(strtoll atoll strftime)
++
++PHP_ARG_WITH(system-tzdata, for use of system timezone data,
++[  --with-system-tzdata[=DIR]      to specify use of system timezone data],
++no, no)
++
++if test "$PHP_SYSTEM_TZDATA" != "no"; then
++   AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
++
++   if test "$PHP_SYSTEM_TZDATA" != "yes"; then
++      AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
++                         [Define for location of system timezone data])
++   fi
++fi
++
diff --git a/lang/php5/patches/103-debian_patches_use_embedded_timezonedb.patch b/lang/php5/patches/103-debian_patches_use_embedded_timezonedb.patch
new file mode 100644 (file)
index 0000000..ae8d182
--- /dev/null
@@ -0,0 +1,19 @@
+Author: Sean Finney <seanius@debian.org>
+Forwarded: no (upstream doesn't want it)
+Description: Silence warnings about using the default system timezone info
+ In vanilla upstream php, this is considered an error (i.e. the user must
+ set the timezone explicitly), though with our use of the system timezonedb
+ patch, we actually feel quite comfortable using the default timezone info.
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571762
+--- a/ext/date/tests/date_default_timezone_set-1.phpt
++++ b/ext/date/tests/date_default_timezone_set-1.phpt
+@@ -22,9 +22,6 @@ date.timezone=
+       echo date(DATE_ISO8601, $date4), "\n";
+ ?>
+ --EXPECTF--
+-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 3
+-
+-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 4
+ America/Indiana/Knox
+ 2005-01-12T03:00:00-0500
+ 2005-07-12T03:00:00-0500
diff --git a/lang/php5/patches/950-Fix-dl-cross-compiling-issue.patch b/lang/php5/patches/950-Fix-dl-cross-compiling-issue.patch
new file mode 100644 (file)
index 0000000..216a518
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/configure.in
++++ b/configure.in
+@@ -453,7 +453,10 @@ PHP_CHECK_FUNC(gethostname, nsl)
+ PHP_CHECK_FUNC(gethostbyaddr, nsl)
+ PHP_CHECK_FUNC(yp_get_default_domain, nsl)
+-PHP_CHECK_FUNC(dlopen, dl)
++PHP_ADD_LIBRARY(dl)
++PHP_DEF_HAVE(dlopen)
++PHP_DEF_HAVE(libdl)
++ac_cv_func_dlopen=yes
+ if test "$ac_cv_func_dlopen" = "yes"; then
+   AC_DEFINE(HAVE_LIBDL, 1, [ ])
+ fi
diff --git a/lang/php5/pecl.mk b/lang/php5/pecl.mk
new file mode 100644 (file)
index 0000000..e1b9819
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2011-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/php5-pecl/Default
+  SUBMENU:=PHP
+  SECTION:=lang
+  CATEGORY:=Languages
+  URL:=http://pecl.php.net/
+  MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
+  DEPENDS:=php5
+endef
+
+define Build/Configure
+       ( cd $(PKG_BUILD_DIR); $(STAGING_DIR_HOST)/usr/bin/phpize )
+       $(Build/Configure/Default)
+endef
+
+CONFIGURE_ARGS+= \
+       --with-php-config=$(STAGING_DIR_HOST)/usr/bin/php-config
+
+define PECLPackage
+
+  define Package/php5-pecl-$(1)
+    $(call Package/php5-pecl/Default)
+    TITLE:=$(2)
+
+    ifneq ($(3),)
+      DEPENDS+=$(3)
+    endif
+  endef
+
+  define Package/php5-pecl-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/php
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
+       $(INSTALL_DIR) $$(1)/etc/php5
+    ifeq ($(4),zend)
+       echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
+    else
+       echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
+    endif
+  endef
+
+endef
diff --git a/lang/psycopg/Makefile b/lang/psycopg/Makefile
new file mode 100644 (file)
index 0000000..e39714c
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2007-2008 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:=psycopg
+PKG_VERSION:=1.1.21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.initd.org/pub/software/psycopg/
+PKG_MD5SUM:=a31f79f68d6d32898d6f24e11369a106
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-psycopg
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PostgreSQL database adapter for Python
+  URL:=http://www.initd.org/
+  DEPENDS:=+python-mini +libpq +python-egenix-mx
+endef
+
+define Package/python-psycopg/description
+ This package contains is a PostgreSQL database adapter for the Python
+ programming language.
+endef
+
+CONFIGURE_ARGS += \
+       --with-python="$(PYTHON)" \
+       --with-postgres-libraries="$(STAGING_DIR)/usr/lib" \
+       --with-postgres-includes="$(STAGING_DIR)/usr/include" \
+       --with-mxdatetime-includes="$(STAGING_DIR)$(PYTHON_PKG_DIR)/mx/DateTime/mxDateTime" \
+       --with-python-prefix=$(STAGING_DIR)/usr
+       --with-python-exec-prefix=$(STAGING_DIR)/usr
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               OPT="$(TARGET_CFLAGS)"
+endef
+
+define PyPackage/python-psycopg/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/psycopgmodule.so $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call PyPackage,python-psycopg))
+$(eval $(call BuildPackage,python-psycopg))
diff --git a/lang/pybluez/Makefile b/lang/pybluez/Makefile
new file mode 100644 (file)
index 0000000..871ed8b
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2007-2010 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:=pybluez
+PKG_VERSION:=0.13
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-src-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://org.csail.mit.edu/pybluez/release/
+PKG_MD5SUM:=eb38d423b49255a7b9f5ba1f50844b53
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-bluez
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python wrapper for the BlueZ Bluetooth stack
+  URL:=http://code.google.com/p/pybluez/
+  DEPENDS:=+python-mini +bluez-libs
+endef
+
+define Package/python-psycopg/description
+ This package contains is a Python wrapper for the BlueZ Bluetooth stack
+endef
+
+CONFIGURE_ARGS += \
+       --with-python="$(PYTHON)" \
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+define PyPackage/python-bluez/filespec
++|$(PYTHON_PKG_DIR)/bluetooth/__init__.py
++|$(PYTHON_PKG_DIR)/bluetooth/_bluetooth.so
++|$(PYTHON_PKG_DIR)/bluetooth/bluez.py
++|$(PYTHON_PKG_DIR)/bluetooth/btcommon.py
+endef
+
+$(eval $(call PyPackage,python-bluez))
+$(eval $(call BuildPackage,python-bluez))
diff --git a/lang/pyclips/Makefile b/lang/pyclips/Makefile
new file mode 100644 (file)
index 0000000..4fff1a0
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 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:=pyclips
+PKG_VERSION:=1.0.7.348
+PKG_RELEASE:=1
+
+PKG_SOURCE:=pyclips-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/pyclips
+PKG_MD5SUM:=c548d62ec951bf9f98c86c70815ed27c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/pyclips
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyclips
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=pyclips
+  URL:=http://sourceforge.net/projects/pyclips/
+  DEPENDS:=+python
+endef
+
+define Package/pyclips/description
+  Python module to interface the CLIPS expert system shell library.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/pyclips/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,pyclips))
diff --git a/lang/pyevent/Makefile b/lang/pyevent/Makefile
new file mode 100644 (file)
index 0000000..d578e6e
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2007-2008 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:=pyevent
+PKG_VERSION:=0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pyevent.googlecode.com/files/
+PKG_MD5SUM:=584912c92d08bf005283fb29a47a6e4d
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-event
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python interface to libevent
+  URL:=http://code.google.com/p/pyevent/
+  DEPENDS:=+python-mini +libevent2
+endef
+
+define PyPackage/python-event/filespec
++|$(PYTHON_PKG_DIR)/event.so
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+               LIBEVENT_HOME="$(STAGING_DIR)/usr/lib" \
+       )
+endef
+
+$(eval $(call PyPackage,python-event))
+$(eval $(call BuildPackage,python-event))
diff --git a/lang/pyevent/patches/000-libenevt_path_from_env.patch b/lang/pyevent/patches/000-libenevt_path_from_env.patch
new file mode 100644 (file)
index 0000000..1457ddc
--- /dev/null
@@ -0,0 +1,20 @@
+diff -ruN pyevent-0.3.pris/setup.py pyevent-0.3/setup.py
+--- pyevent-0.3.pris/setup.py  2005-09-11 22:44:04.000000000 -0500
++++ pyevent-0.3/setup.py       2007-04-23 11:17:14.500323500 -0500
+@@ -5,9 +5,13 @@
+ from distutils.core import setup, Extension
+ import glob, os, sys
+-if glob.glob('/usr/lib/libevent.*'):
+-    print 'found system libevent for', sys.platform
+-    event = Extension(name='event',
++# Where to find libevent
++libevent_location = os.environ.get('LIBEVENT_HOME')
++
++if libevent_location != None:
++    if glob.glob('%s/libevent.*' % (libevent_location,)):
++        print 'found system libevent for', sys.platform
++        event = Extension(name='event',
+                        sources=[ 'event.c' ],
+                        libraries=[ 'event' ])
+ elif glob.glob('%s/lib/libevent.*' % sys.prefix):
diff --git a/lang/pyevent/patches/001-event-pyx-python25.patch b/lang/pyevent/patches/001-event-pyx-python25.patch
new file mode 100644 (file)
index 0000000..2d97e87
--- /dev/null
@@ -0,0 +1,11 @@
+--- pyevent-0.3-old/event.pyx  2005-09-11 22:16:15.000000000 -0500
++++ pyevent-0.3/event.pyx      2007-06-12 11:28:33.000000000 -0500
+@@ -259,7 +259,7 @@
+     global __event_exc
+     event_dispatch()
+     if __event_exc:
+-        raise __event_exc[0], __event_exc[1], __event_exc[2]
++        raise OSError, "%s [%s]" % (__event_exc[0], __event_exc[1]), __event_exc[2]
+ def loop(nonblock=False):
+     """Dispatch all pending events on queue in a single pass."""
diff --git a/lang/pygobject/Makefile b/lang/pygobject/Makefile
new file mode 100644 (file)
index 0000000..1fb2332
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Copyright (C) 2008 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:=pygobject
+PKG_VERSION:=2.21.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.21
+PKG_MD5SUM:=77ad7e8dbf13188364c9f56f907e530a
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+$(call include_mk, python-package.mk)
+
+EXTRA_LDFLAGS+= \
+       -L$(ICONV_PREFIX) -L$(INTL_PREFIX)
+
+TARGET_CFLAGS += $(FPIC)
+CONFIGURE_ARGS += --enable-static --disable-instrospection
+
+define Package/python-gobject
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=GLib bindings for python
+  URL:=http://www.pygtk.org/
+  DEPENDS:=+python-mini +glib2 +libffi
+endef
+
+define Package/python-gobject/description
+  GLib bindings for python
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-libffi --disable-introspection \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/pygtk-2.0/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/pygtk-2.0/* \
+               $(1)/usr/include/pygtk-2.0/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so,a,la} \
+               $(1)/usr/lib/
+
+       $(SED) \
+               "s,^\(prefix\|exec_prefix\|datadir\)=,\1=$(STAGING_DIR),g" \
+               $(1)/usr/lib/pkgconfig/pygobject-2.0.pc
+
+       $(INSTALL_DIR) $(1)/usr/share/pygobject/2.0/codegen
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pygobject/2.0/codegen/*.py \
+               $(1)/usr/share/pygobject/2.0/codegen
+
+       $(INSTALL_DIR) $(1)/usr/share/pygobject/2.0/defs
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pygobject/2.0/defs/* \
+               $(1)/usr/share/pygobject/2.0/defs
+
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/* \
+               $(2)/bin
+
+       $(SED) \
+               "s,^\(prefix\|datadir\)=,\1=$(STAGING_DIR),g" \
+               $(2)/bin/pygobject-codegen-2.0
+endef
+
+define Package/python-gobject/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/*.{pth,py} \
+               $(1)$(PYTHON_PKG_DIR)/
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gtk-2.0
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gtk-2.0/*.py \
+               $(1)$(PYTHON_PKG_DIR)/gtk-2.0/
+
+       $(foreach d,gobject gio glib, \
+               $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gtk-2.0/$(d); \
+               $(INSTALL_DATA) \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gtk-2.0/$(d)/*.{py,so} \
+                       $(1)$(PYTHON_PKG_DIR)/gtk-2.0/$(d); \
+       )
+endef
+
+$(eval $(call BuildPackage,python-gobject))
diff --git a/lang/pymysql/Makefile b/lang/pymysql/Makefile
new file mode 100644 (file)
index 0000000..4669591
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2007-2008 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:=MySQL-python
+PKG_VERSION:=1.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/mysql-python
+PKG_MD5SUM:=532268f02870bea18c1d465e88afff30
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-mysql
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=MySQL database adapter for Python
+  URL:=http://mysql-python.sourceforge.net/
+  DEPENDS:=+python +libmysqlclient
+endef
+
+define Package/python-mysql/description
+ MySQLdb is an thread-compatible interface to the popular MySQL database
+ server that provides the Python database API.
+endef
+
+define PyPackage/python-mysql/filespec
++|$(PYTHON_PKG_DIR)/_mysql.so
++|$(PYTHON_PKG_DIR)/_mysql_exceptions.py*
++|$(PYTHON_PKG_DIR)/MySQLdb
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+$(eval $(call PyPackage,python-mysql))
+$(eval $(call BuildPackage,python-mysql))
diff --git a/lang/pymysql/patches/000-setup.patch b/lang/pymysql/patches/000-setup.patch
new file mode 100644 (file)
index 0000000..e04e2f9
--- /dev/null
@@ -0,0 +1,12 @@
+--- MySQL-python-1.2.2/setup.py        2007-02-25 04:37:12.000000000 +0100
++++ MySQL-python-1.2.2/setup.py        2007-08-15 12:23:18.000000000 +0200
+@@ -2,8 +2,7 @@
+ import os
+ import sys
+-import ez_setup; ez_setup.use_setuptools()
+-from setuptools import setup, Extension
++from distutils.core import setup, Extension
+ if sys.version_info < (2, 3):
+     raise Error, "Python-2.3 or newer is required"
diff --git a/lang/pymysql/patches/010-threadsafe.patch b/lang/pymysql/patches/010-threadsafe.patch
new file mode 100644 (file)
index 0000000..bcd9af8
--- /dev/null
@@ -0,0 +1,11 @@
+--- MySQL-python-1.2.2/site_orig.cfg   2007-08-15 12:58:40.000000000 +0200
++++ MySQL-python-1.2.2/site.cfg        2007-08-15 12:58:49.000000000 +0200
+@@ -4,7 +4,7 @@
+ # static: link against a static library (probably required for embedded)
+ embedded = False
+-threadsafe = True
++threadsafe = False
+ static = False
+ # The path to mysql_config.
diff --git a/lang/pyopenssl/Makefile b/lang/pyopenssl/Makefile
new file mode 100644 (file)
index 0000000..1e0a435
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008 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:=pyopenssl
+PKG_VERSION:=0.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=pyOpenSSL-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/p/pyOpenSSL/
+PKG_MD5SUM:=34db8056ec53ce80c7f5fc58bee9f093
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/pyOpenSSL-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyopenssl
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=pyopenssl
+  URL:=http://pyopenssl.sourceforge.net/
+  DEPENDS:=+python +libopenssl
+endef
+
+define Package/pyopenssl/description
+  Python interface to the OpenSSL library.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/pyopenssl/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,pyopenssl))
diff --git a/lang/pypcap/Makefile b/lang/pypcap/Makefile
new file mode 100644 (file)
index 0000000..ecc0df5
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2007-2008 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:=pypcap
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypcap.googlecode.com/files
+PKG_MD5SUM:=034c3cbbfa81aa19e8f685b767c65764
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-pcap
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python interface to lipcap
+  URL:=http://code.google.com/p/pypcap/
+  DEPENDS:=+python-mini +libpcap
+endef
+
+define PyPackage/python-pcap/filespec
++|$(PYTHON_PKG_DIR)/pcap.so
+endef
+
+TARGET_CFLAGS += -DHAVE_PCAP_FILE=1
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+               PCAP_HOME="$(STAGING_DIR)/usr" \
+       )
+endef
+
+$(eval $(call PyPackage,python-pcap))
+$(eval $(call BuildPackage,python-pcap))
diff --git a/lang/pypcap/patches/000-no_cpickle.patch b/lang/pypcap/patches/000-no_cpickle.patch
new file mode 100644 (file)
index 0000000..8cabb05
--- /dev/null
@@ -0,0 +1,142 @@
+--- pypcap/setup.py    2006-03-15 13:59:54.000000000 -0600
++++ pypcap.new/setup.py        2007-05-25 17:29:02.413355500 -0500
+@@ -4,69 +4,53 @@
+ from distutils.core import setup, Extension
+ from distutils.command import config, clean
+-import cPickle, glob, os, sys
++import os,sys,glob
+-pcap_config = {}
+-pcap_cache = 'config.pkl'
++# where to find pcap
++pcap_location = os.environ.get('PCAP_HOME')
+-class config_pcap(config.config):
+-    description = 'configure pcap paths'
+-    user_options = [ ('with-pcap=', None,
+-                      'path to pcap build or installation directory') ]
+-    
+-    def initialize_options(self):
+-        config.config.initialize_options(self)
+-        self.dump_source = 0
+-        #self.noisy = 0
+-        self.with_pcap = None
+-
+-    def _write_config_h(self, cfg):
+-        # XXX - write out config.h for pcap_ex.c
+-        d = {}
+-        if os.path.exists(os.path.join(cfg['include_dirs'][0], 'pcap-int.h')):
+-            d['HAVE_PCAP_INT_H'] = 1
+-        buf = open(os.path.join(cfg['include_dirs'][0], 'pcap.h')).read()
+-        if buf.find('pcap_file(') != -1:
+-            d['HAVE_PCAP_FILE'] = 1
+-        if buf.find('pcap_compile_nopcap(') != -1:
+-            d['HAVE_PCAP_COMPILE_NOPCAP'] = 1
+-        if buf.find('pcap_setnonblock(') != -1:
+-            d['HAVE_PCAP_SETNONBLOCK'] = 1
+-        f = open('config.h', 'w')
+-        for k, v in d.iteritems():
+-            f.write('#define %s %s\n' % (k, v))
+-    
+-    def _pcap_config(self, dirs=[ None ]):
+-        cfg = {}
+-        if not dirs[0]:
+-            dirs = [ '/usr', sys.prefix ] + glob.glob('/opt/libpcap*') + \
+-                   glob.glob('../libpcap*') + glob.glob('../wpdpack*')
+-        for d in dirs:
+-            for sd in ('include', 'include/pcap', ''):
+-                incdirs = [ os.path.join(d, sd) ]
+-                if os.path.exists(os.path.join(d, sd, 'pcap.h')):
+-                    cfg['include_dirs'] = [ os.path.join(d, sd) ]
+-                    for sd in ('lib', ''):
+-                        for lib in (('pcap', 'libpcap.a'),
+-                                    ('pcap', 'libpcap.dylib'),
+-                                    ('wpcap', 'wpcap.lib')):
+-                            if os.path.exists(os.path.join(d, sd, lib[1])):
+-                                cfg['library_dirs'] = [ os.path.join(d, sd) ]
+-                                cfg['libraries'] = [ lib[0] ]
+-                                if lib[0] == 'wpcap':
+-                                    cfg['libraries'].append('iphlpapi')
+-                                    cfg['extra_compile_args'] = \
+-                                        [ '-DWIN32', '-DWPCAP' ]
+-                                print 'found', cfg
+-                                self._write_config_h(cfg)
+-                                return cfg
+-        raise "couldn't find pcap build or installation directory"
+-    
+-    def run(self):
+-        #config.log.set_verbosity(0)
+-        cPickle.dump(self._pcap_config([ self.with_pcap ]),
+-                     open(pcap_cache, 'wb'))
+-        self.temp_files.append(pcap_cache)
++def write_config_h(cfg):
++    # XXX - write out config.h for pcap_ex.c
++    d = {}
++    if os.path.exists(os.path.join(cfg['include_dirs'][0], 'pcap-int.h')):
++        d['HAVE_PCAP_INT_H'] = 1
++    buf = open(os.path.join(cfg['include_dirs'][0], 'pcap.h')).read()
++    if buf.find('pcap_file(') != -1:
++        d['HAVE_PCAP_FILE'] = 1
++    if buf.find('pcap_compile_nopcap(') != -1:
++        d['HAVE_PCAP_COMPILE_NOPCAP'] = 1
++    if buf.find('pcap_setnonblock(') != -1:
++        d['HAVE_PCAP_SETNONBLOCK'] = 1
++    f = open('config.h', 'w')
++    for k, v in d.iteritems():
++        f.write('#define %s %s\n' % (k, v))
++
++
++def f_pcap_config(dirs=[ None ]):
++    cfg = {}
++    if not dirs[0]:
++        dirs = [ '/usr', sys.prefix ] + glob.glob('/opt/libpcap*') + \
++               glob.glob('../libpcap*') + glob.glob('../wpdpack*')
++    for d in dirs:
++        for sd in ('include/pcap', 'include', ''):
++            incdirs = [ os.path.join(d, sd) ]
++            if os.path.exists(os.path.join(d, sd, 'pcap.h')):
++                cfg['include_dirs'] = [ os.path.join(d, sd) ]
++                for sd in ('lib', ''):
++                    for lib in (('pcap', 'libpcap.a'),
++                                ('pcap', 'libpcap.dylib'),
++                                ('wpcap', 'wpcap.lib')):
++                        if os.path.exists(os.path.join(d, sd, lib[1])):
++                            cfg['library_dirs'] = [ os.path.join(d, sd) ]
++                            cfg['libraries'] = [ lib[0] ]
++                            if lib[0] == 'wpcap':
++                                cfg['libraries'].append('iphlpapi')
++                                cfg['extra_compile_args'] = \
++                                    [ '-DWIN32', '-DWPCAP' ]
++                            print 'found', cfg
++                            write_config_h(cfg)
++                            return cfg
++    raise "couldn't find pcap build or installation directory"
+ class clean_pcap(clean.clean):
+     def run(self):
+@@ -75,13 +59,9 @@
+             print "removing '%s'" % pcap_cache
+             os.unlink(pcap_cache)
+-if len(sys.argv) > 1 and sys.argv[1] == 'build':
+-    try:
+-        pcap_config = cPickle.load(open(pcap_cache))
+-    except IOError:
+-        print >>sys.stderr, 'run "%s config" first!' % sys.argv[0]
+-        sys.exit(1)
++
++pcap_config = f_pcap_config([pcap_location])
+ pcap = Extension(name='pcap',
+                  sources=[ 'pcap.c', 'pcap_ex.c' ],
+                  include_dirs=pcap_config.get('include_dirs', ''),
+@@ -89,7 +69,7 @@
+                  libraries=pcap_config.get('libraries', ''),
+                  extra_compile_args=pcap_config.get('extra_compile_args', ''))
+-pcap_cmds = { 'config':config_pcap, 'clean':clean_pcap }
++pcap_cmds = { 'clean':clean_pcap }
+ setup(name='pcap',
+       version='1.1',
diff --git a/lang/pypcap/patches/001-python2_5.patch b/lang/pypcap/patches/001-python2_5.patch
new file mode 100644 (file)
index 0000000..d2bb3a0
--- /dev/null
@@ -0,0 +1,11 @@
+--- pypcap-1.1-old/pcap.pyx 2005-10-16 18:00:11.000000000 -0500
++++ pypcap-1.1/pcap.pyx     2007-06-12 11:11:41.000000000 -0500
+@@ -285,7 +285,7 @@
+                           <unsigned char *>&ctx)
+         if ctx.got_exc:
+             exc = sys.exc_info()
+-            raise exc[0], exc[1], exc[2]
++            raise OSError, "%s [%s]" % (exc[0], exc[1]), exc[2]
+         return n
+     def loop(self, callback, *args):
diff --git a/lang/pyrrd/Makefile b/lang/pyrrd/Makefile
new file mode 100644 (file)
index 0000000..c919cd7
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 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:=pyrrd
+PKG_VERSION:=0.1.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=PyRRD-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/P/PyRRD/
+PKG_MD5SUM:=c33a0760b42a23e45e423b8b9f2cd0b0
+
+PKG_BUILD_DEPENDS:=python
+PKG_BUILD_DIR:=$(BUILD_DIR)/PyRRD-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyrrd
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PyRRD - An Object-Oriented Python Interface for RRDTool
+  URL:=http://code.google.com/p/pyrrd/
+  DEPENDS:=+python +distribute +rrdtool
+endef
+
+define Package/pyrrd/description
+  An Object-Oriented Python Interface for RRDTool
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,., \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+       )
+endef
+
+define Package/pyrrd/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+               $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,pyrrd))
diff --git a/lang/pyrrd/patches/101-cross.patch b/lang/pyrrd/patches/101-cross.patch
new file mode 100644 (file)
index 0000000..978e5a8
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/setup.py
++++ b/setup.py
+@@ -1,4 +1,6 @@
+-from setuptools import setup
++#!/usr/bin/env python
++
++from distutils.core import setup
+ from pyrrd import meta
+ from pyrrd.util import dist
diff --git a/lang/pyrrd/patches/200-fetch.patch b/lang/pyrrd/patches/200-fetch.patch
new file mode 100644 (file)
index 0000000..b547555
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/pyrrd/backend/external.py    2011-10-19 05:33:13 +0000
++++ b/pyrrd/backend/external.py    2011-10-19 05:44:55 +0000
+@@ -262,7 +262,7 @@
+         data += [unicode(x) for x in obj.rra]
+         return (obj.filename, params + data)
+
+-    if function == 'update':
++    elif function == 'update':
+         validParams = ['template']
+         params = common.buildParameters(obj, validParams)
+         FIRST_VALUE = 0
+@@ -275,15 +275,15 @@
+             data = [data for data, nil in obj.values]
+         return (obj.filename, params + data)
+
+-    if function == 'fetch':
++    elif function == 'fetch':
+         validParams = ['resolution', 'start', 'end']
+         params = common.buildParameters(obj, validParams)
+-        return (obj.filename, obj.cf, params)
++        return (obj.filename, [obj.cf] + params)
+
+-    if function == 'info':
++    elif function == 'info':
+         return (obj.filename, obj)
+
+-    if function == 'graph':
++    elif function == 'graph':
+         validParams = ['start', 'end', 'step', 'title',
+             'vertical_label', 'width', 'height', 'only_graph',
+             'upper_limit', 'lower_limit', 'rigid', 'alt_autoscale',
diff --git a/lang/pyserial/Makefile b/lang/pyserial/Makefile
new file mode 100644 (file)
index 0000000..aed6919
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2008-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:=pyserial
+PKG_VERSION:=2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/pyserial
+PKG_MD5SUM:=eec19df59fd75ba5a136992897f8e468
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyserial
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=pyserial
+  URL:=http://pyserial.sourceforge.net
+  DEPENDS:=+python-mini
+endef
+
+define Package/pyserial/description
+  serial port python bindings
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,., \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \
+       )
+endef
+
+define Package/pyserial/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,pyserial))
diff --git a/lang/pysqlite/Makefile b/lang/pysqlite/Makefile
new file mode 100644 (file)
index 0000000..ffdcbd3
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2007-2008 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:=pysqlite
+PKG_VERSION:=2.3.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://initd.org/pub/software/pysqlite/releases/2.3/2.3.5/
+PKG_MD5SUM:=b4a185e936848370fcc1a5b17755b641
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-sqlite
+ SUBMENU:=Python
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=SQLite database adapter for Python
+ URL:=http://www.initd.org/tracker/pysqlite/wiki/pysqlite
+ DEPENDS:=+python-mini +libsqlite3
+endef
+
+define Package/python-sqlite/description
+ This package contains an SQLite database adapter for the Python
+ programming language.
+endef
+
+define PyPackage/python-sqlite/filespec
++|$(PYTHON_PKG_DIR)/pysqlite2
+-|$(PYTHON_PKG_DIR)/pysqlite2/test
+endef
+
+define Build/Configure
+       cp ./files/setup.cfg.in $(PKG_BUILD_DIR)/setup.cfg
+       $(SED) \
+               's,@INCLUDE_DIRS@,$(STAGING_DIR)/usr/include,g' \
+               -e 's,@INCLUDE_DIRS@,$(STAGING_DIR)/usr/include,g' \
+               $(PKG_BUILD_DIR)/setup.cfg
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+$(eval $(call PyPackage,python-sqlite))
+$(eval $(call BuildPackage,python-sqlite))
diff --git a/lang/pysqlite/files/setup.cfg.in b/lang/pysqlite/files/setup.cfg.in
new file mode 100644 (file)
index 0000000..50f04cd
--- /dev/null
@@ -0,0 +1,5 @@
+[build_ext]
+define=
+include_dirs=@INCLUDE_DIRS@
+library_dirs=@LIBRARY_DIRS@
+libraries=sqlite3
diff --git a/lang/python-cjson/Makefile b/lang/python-cjson/Makefile
new file mode 100644 (file)
index 0000000..ce6dc2d
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2010 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-cjson
+PKG_VERSION:=1.0.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=python-cjson-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/p/python-cjson/
+PKG_MD5SUM:=4d55b66ecdf0300313af9d030d9644a3
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/python-cjson-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-cjson
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-cjson
+  URL:=http://pypi.python.org/pypi/python-cjson/
+  DEPENDS:=+python
+endef
+
+define Package/python-cjson/description
+  Fast JSON encoder/decoder for Python
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/python-cjson/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-cjson))
diff --git a/lang/python-cjson/patches/001-unicode-buffer-overflow.patch b/lang/python-cjson/patches/001-unicode-buffer-overflow.patch
new file mode 100644 (file)
index 0000000..21c4994
--- /dev/null
@@ -0,0 +1,79 @@
+=== modified file 'cjson.c'
+--- a/cjson.c  2007-08-24 16:12:17 +0000
++++ b/cjson.c  2010-05-26 05:05:55 +0000
+@@ -613,6 +613,25 @@
+     char *p;
+     static const char *hexdigit = "0123456789abcdef";
++#ifdef Py_UNICODE_WIDE
++    const Py_ssize_t expandsize = 10;
++#else
++    const Py_ssize_t expandsize = 6;
++#endif
++
++    /* Initial allocation is based on the longest-possible unichr
++       escape.
++
++       In wide (UTF-32) builds '\U00xxxxxx' is 10 chars per source
++       unichr, so in this case it's the longest unichr escape. In
++       narrow (UTF-16) builds this is five chars per source unichr
++       since there are two unichrs in the surrogate pair, so in narrow
++       (UTF-16) builds it's not the longest unichr escape.
++
++       In wide or narrow builds '\uxxxx' is 6 chars per source unichr,
++       so in the narrow (UTF-16) build case it's the longest unichr
++       escape.
++    */
+     s = PyUnicode_AS_UNICODE(unicode);
+     size = PyUnicode_GET_SIZE(unicode);
+@@ -623,7 +642,7 @@
+         return NULL;
+     }
+-    repr = PyString_FromStringAndSize(NULL, 2 + 6*size + 1);
++    repr = PyString_FromStringAndSize(NULL, 2 + expandsize*size + 1);
+     if (repr == NULL)
+         return NULL;
+@@ -644,15 +663,6 @@
+ #ifdef Py_UNICODE_WIDE
+         /* Map 21-bit characters to '\U00xxxxxx' */
+         else if (ch >= 0x10000) {
+-            int offset = p - PyString_AS_STRING(repr);
+-
+-            /* Resize the string if necessary */
+-            if (offset + 12 > PyString_GET_SIZE(repr)) {
+-                if (_PyString_Resize(&repr, PyString_GET_SIZE(repr) + 100))
+-                    return NULL;
+-                p = PyString_AS_STRING(repr) + offset;
+-            }
+-
+             *p++ = '\\';
+             *p++ = 'U';
+             *p++ = hexdigit[(ch >> 28) & 0x0000000F];
+
+=== modified file 'jsontest.py'
+--- a/jsontest.py      2007-08-24 16:12:17 +0000
++++ b/jsontest.py      2010-05-26 05:05:55 +0000
+@@ -316,6 +316,18 @@
+     def testWriteLong(self):
+         self.assertEqual("12345678901234567890", cjson.encode(12345678901234567890))
++
++    def testWriteLongUnicode(self):
++        # This test causes a buffer overrun in cjson 1.0.5, on UCS4 builds.
++        # The string length is only resized for wide unicode characters if
++        # there is less than 12 bytes of space left. Padding with
++        # narrow-but-escaped characters prevents string resizing.
++        # Note that u'\U0001D11E\u1234' also breaks, but sometimes goes
++        # undetected.
++        s = cjson.encode(u'\U0001D11E\U0001D11E\U0001D11E\U0001D11E'
++                         u'\u1234\u1234\u1234\u1234\u1234\u1234')
++        self.assertEqual(r'"\U0001d11e\U0001d11e\U0001d11e\U0001d11e'
++                         r'\u1234\u1234\u1234\u1234\u1234\u1234"', s)
+         
+ def main():
+     unittest.main()
+
+
diff --git a/lang/python-crypto/Makefile b/lang/python-crypto/Makefile
new file mode 100644 (file)
index 0000000..d5e1f46
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2009-2010 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:=pycrypto
+PKG_VERSION:=2.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/
+PKG_MD5SUM:=88dad0a270d1fe83a39e0467a66a22bb
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-crypto
+       SECTION:=lang-python
+       CATEGORY:=Languages
+       SUBMENU:=Python
+       TITLE:=python-crypto
+       URL:=http://www.pycrypto.org/
+       DEPENDS:=+python +libgmp
+endef
+
+define Package/python-crypto/description
+A collection of both secure hash functions (such as MD5 and SHA),
+and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.).
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Package/python-crypto/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+               $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,python-crypto))
diff --git a/lang/python-crypto/patches/001-no-host-paths.patch b/lang/python-crypto/patches/001-no-host-paths.patch
new file mode 100644 (file)
index 0000000..d481627
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/setup.py
++++ b/setup.py
+@@ -370,7 +370,7 @@ kw = {'name':"pycrypto",
+       'ext_modules': plat_ext + [
+             # _fastmath (uses GNU mp library)
+             Extension("Crypto.PublicKey._fastmath",
+-                      include_dirs=['src/','/usr/include/'],
++                      include_dirs=['src/'],
+                       libraries=['gmp'],
+                       sources=["src/_fastmath.c"]),
diff --git a/lang/python-curl/Makefile b/lang/python-curl/Makefile
new file mode 100644 (file)
index 0000000..e2f106a
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2010 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:=pycurl
+PKG_VERSION:=7.19.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pycurl.sourceforge.net/download/
+PKG_MD5SUM:=
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-curl
+  SECTION:=language-python
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=python-curl
+  URL:=http://sourceforge.net/projects/pycurl
+  DEPENDS:=+python +libcurl
+endef
+
+define Package/python-curl/description
+Python module interface to the cURL library.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Package/python-curl/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-curl))
diff --git a/lang/python-curl/patches/001-no_static.patch b/lang/python-curl/patches/001-no_static.patch
new file mode 100644 (file)
index 0000000..3aa7706
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/setup.py
++++ b/setup.py
+@@ -97,8 +97,7 @@ else:
+         else:
+             extra_compile_args.append(e)
+     libs = split_quoted(
+-        os.popen("'%s' --libs" % CURL_CONFIG).read()+\
+-        os.popen("'%s' --static-libs" % CURL_CONFIG).read())
++        os.popen("'%s' --libs" % CURL_CONFIG).read())
+     for e in libs:
+         if e[:2] == "-l":
+             libraries.append(e[2:])
diff --git a/lang/python-dbus/Makefile b/lang/python-dbus/Makefile
new file mode 100644 (file)
index 0000000..3e270d9
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2008-2010 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:=dbus-python
+PKG_VERSION:=0.83.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://dbus.freedesktop.org/releases/dbus-python/
+PKG_MD5SUM:=562c78876219bf458d79a041af18293d
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+$(call include_mk, python-package.mk)
+
+
+TARGET_LDFLAGS += \
+       -Wl,-rpath=$(STAGING_DIR)/usr/lib
+
+define Package/dbus-python
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python bindings for dbus
+  URL:=http://dbus.freedesktop.org/
+  DEPENDS:=+python +python-expat +libdbus-glib
+endef
+
+define Package/dbus-python/description
+  Python bindings for dbus.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/dbus-1.0/dbus
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/dbus-1.0/dbus/* \
+               $(1)/usr/include/dbus-1.0/dbus/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig
+endef
+
+define Package/dbus-python/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/*.{py,so} \
+               $(1)$(PYTHON_PKG_DIR)
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/dbus
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/dbus/*.py \
+               $(1)$(PYTHON_PKG_DIR)/dbus
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/dbus/mainloop
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/dbus/mainloop/*.py \
+               $(1)$(PYTHON_PKG_DIR)/dbus/mainloop
+
+endef
+
+$(eval $(call BuildPackage,dbus-python))
diff --git a/lang/python-django/Makefile b/lang/python-django/Makefile
new file mode 100644 (file)
index 0000000..efd0e9c
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 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:=python-django
+PKG_VERSION:=1.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=Django-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://media.djangoproject.com/releases/1.3/
+PKG_MD5SUM:=62d8642fd06b9a0bf8544178f8500767
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Django-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-django
+  SECTION:=language-python
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=Django Web framework
+  URL:=https://www.djangoproject.com/
+  DEPENDS:=+python
+endef
+
+define Package/python-django/description
+ Django is a high-level Python Web framework that encourages rapid
+ development and clean, pragmatic design.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,., \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+       )
+endef
+
+define Package/python-django/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+               $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,python-django))
diff --git a/lang/python-eeml/Makefile b/lang/python-eeml/Makefile
new file mode 100644 (file)
index 0000000..6fef33a
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2008-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:=python-eeml
+PKG_VERSION:=20111202
+PKG_RELEASE:=1
+PKG_REV:=9f0173e56a0b2a0ae7d3a2c76eb5428381912ac6
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=git://github.com/petervizi/python-eeml.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=git
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-eeml
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-eeml
+  URL:=http://petervizi.github.com/python-eeml/
+  DEPENDS:=+python +distribute
+endef
+
+define Package/python-eeml/description
+  A python package for generating eeml documents.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,., \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \
+       )
+endef
+
+define Package/python-eeml/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,python-eeml))
diff --git a/lang/python-eeml/patches/101-cross.patch b/lang/python-eeml/patches/101-cross.patch
new file mode 100644 (file)
index 0000000..fd80751
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/setup.py
++++ b/setup.py
+@@ -1,5 +1,6 @@
+-from setuptools import setup
+-from setuptools import find_packages
++#!/usr/bin/env python
++
++from distutils.core import setup
+
+ setup(name="Python EEML",
+       version="0.1",
+
diff --git a/lang/python-flup/Makefile b/lang/python-flup/Makefile
new file mode 100644 (file)
index 0000000..e3c82ba
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2012 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:=flup
+PKG_VERSION:=1.0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=flup-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/f/flup/
+PKG_MD5SUM:=24dad7edc5ada31dddd49456ee8d5254
+
+PKG_LICENSE:=BSD
+PKG_LICENSE_FILES:PKG-INFO
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-flup
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-flup
+  URL:=http://pypi.python.org/pypi/flup/
+  DEPENDS:=+python
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/python-flup/description
+  Random assortment of WSGI servers
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_BUILD_DIR)/flup \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-flup/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/flup \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-flup))
diff --git a/lang/python-ifconfig/Makefile b/lang/python-ifconfig/Makefile
new file mode 100644 (file)
index 0000000..d16baf2
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2010 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-ifconfig
+PKG_VERSION:=0.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=python-ifconfig-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://python-ifconfig.googlecode.com/files/
+PKG_MD5SUM:=6d780d29c1df1acc17195bde7be0e394
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/python-ifconfig-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-ifconfig
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-ifconfig
+  URL:=http://code.google.com/p/python-ifconfig/
+  DEPENDS:=+python
+endef
+
+define Package/python-ifconfig/description
+  Display network interface status.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/python-ifconfig/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-ifconfig))
diff --git a/lang/python-ifconfig/patches/001-errorcheck.patch b/lang/python-ifconfig/patches/001-errorcheck.patch
new file mode 100644 (file)
index 0000000..86048f4
--- /dev/null
@@ -0,0 +1,69 @@
+--- a/ifconfig.old     2010-12-10 11:18:19.890041196 +0100
++++ b/ifconfig.c       2010-12-10 11:59:58.170347114 +0100
+@@ -43,6 +43,9 @@
+     char addr[20];
+     char brdaddr[20];
+     char netmask[20];
++    short int flags = 0;
++
++    hwaddr[0] = addr[0] = brdaddr[0] = netmask[0] = 0;
+     if (!PyArg_ParseTuple(args, "s", &itf))
+       return NULL;
+@@ -51,29 +54,35 @@
+     strcpy(ifreq.ifr_name, itf);
+-    /* hardware address */
+-    ioctl(fd, SIOCGIFHWADDR, &ifreq);
+-    hw = ifreq.ifr_hwaddr.sa_data;
+-    sprintf(hwaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
+-          *hw, *(hw + 1), *(hw + 2), *(hw + 3), *(hw + 4), *(hw + 5));
+-
+-    /* address */
+-    ioctl(fd, SIOCGIFADDR, &ifreq);
+-    sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
+-    sprintf(addr, "%s", inet_ntoa(sin->sin_addr));
+-
+-    /* broadcast */
+-    ioctl(fd, SIOCGIFBRDADDR, &ifreq);
+-    sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
+-    sprintf(brdaddr, "%s", inet_ntoa(sin->sin_addr));
+-
+-    /* netmask */
+-    ioctl(fd, SIOCGIFNETMASK, &ifreq);
+-    sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
+-    sprintf(netmask, "%s", inet_ntoa(sin->sin_addr));
++    /* flags */
++    if (ioctl(fd, SIOCGIFFLAGS, &ifreq) == 0) {
++        flags = ifreq.ifr_flags;
++
++        /* hardware address */
++        ioctl(fd, SIOCGIFHWADDR, &ifreq);
++        hw = ifreq.ifr_hwaddr.sa_data;
++        sprintf(hwaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
++              *hw, *(hw + 1), *(hw + 2), *(hw + 3), *(hw + 4), *(hw + 5));
++
++        /* address */
++        ioctl(fd, SIOCGIFADDR, &ifreq);
++        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
++        sprintf(addr, "%s", inet_ntoa(sin->sin_addr));
++
++        /* broadcast */
++        ioctl(fd, SIOCGIFBRDADDR, &ifreq);
++        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
++        sprintf(brdaddr, "%s", inet_ntoa(sin->sin_addr));
++
++        /* netmask */
++        ioctl(fd, SIOCGIFNETMASK, &ifreq);
++        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
++        sprintf(netmask, "%s", inet_ntoa(sin->sin_addr));
++    }
+     close(fd);
+-    return Py_BuildValue("{s:s,s:s,s:s,s:s}",
++    return Py_BuildValue("{s:i,s:s,s:s,s:s,s:s}",
++                         "flags", flags,
+                        "hwaddr", hwaddr,
+                        "addr", addr,
+                        "brdaddr", brdaddr,
diff --git a/lang/python-ifconfig/patches/002-checkflags-up.patch b/lang/python-ifconfig/patches/002-checkflags-up.patch
new file mode 100644 (file)
index 0000000..9f98c9e
--- /dev/null
@@ -0,0 +1,39 @@
+--- a/ifconfig.old     2010-12-10 12:14:12.026329707 +0100
++++ b/ifconfig.c       2010-12-10 12:15:18.374672352 +0100
+@@ -64,20 +64,22 @@
+         sprintf(hwaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
+               *hw, *(hw + 1), *(hw + 2), *(hw + 3), *(hw + 4), *(hw + 5));
+-        /* address */
+-        ioctl(fd, SIOCGIFADDR, &ifreq);
+-        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
+-        sprintf(addr, "%s", inet_ntoa(sin->sin_addr));
+-
+-        /* broadcast */
+-        ioctl(fd, SIOCGIFBRDADDR, &ifreq);
+-        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
+-        sprintf(brdaddr, "%s", inet_ntoa(sin->sin_addr));
+-
+-        /* netmask */
+-        ioctl(fd, SIOCGIFNETMASK, &ifreq);
+-        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
+-        sprintf(netmask, "%s", inet_ntoa(sin->sin_addr));
++        if (flags & IFF_UP) {
++            /* address */
++            ioctl(fd, SIOCGIFADDR, &ifreq);
++            sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
++            sprintf(addr, "%s", inet_ntoa(sin->sin_addr));
++
++            /* broadcast */
++            ioctl(fd, SIOCGIFBRDADDR, &ifreq);
++            sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
++            sprintf(brdaddr, "%s", inet_ntoa(sin->sin_addr));
++
++            /* netmask */
++            ioctl(fd, SIOCGIFNETMASK, &ifreq);
++            sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
++            sprintf(netmask, "%s", inet_ntoa(sin->sin_addr));
++        }
+     }
+     close(fd);
diff --git a/lang/python-imaging-library/Makefile b/lang/python-imaging-library/Makefile
new file mode 100644 (file)
index 0000000..128327c
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 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:=python-imaging-library
+PKG_VERSION:=1.1.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=Imaging-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://effbot.org/downloads
+PKG_MD5SUM:=fc14a54e1ce02a0225be8854bfba478e
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Imaging-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-imaging-library
+  SECTION:=language-python
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=Python Imaging Library (PIL)
+  URL:=http://www.pythonware.com/products/pil/
+  DEPENDS:=+python +libfreetype +libjpeg +zlib
+endef
+
+define Package/python-imaging-library/description
+ The Python Imaging Library adds image processing capabilities to your
+ Python interpreter.
+ .
+ This library provides extensive file format support, an efficient
+ internal representation, and fairly powerful image processing
+ capabilities.
+ .
+ The core image library is designed for fast access to data stored in a
+ few basic pixel formats. It should provide a solid foundation for a
+ general image processing tool.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,., \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \
+       )
+endef
+
+define Package/python-imaging-library/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+               $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,python-imaging-library))
diff --git a/lang/python-imaging-library/patches/101-cross_compile.patch b/lang/python-imaging-library/patches/101-cross_compile.patch
new file mode 100644 (file)
index 0000000..fee0e82
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/setup.py 2011-11-15 01:06:00.000000000 +0100
++++ b/setup.py 2011-11-15 01:07:32.000000000 +0100
+@@ -147,7 +147,6 @@
+             add_directory(library_dirs, "/opt/local/lib")
+             add_directory(include_dirs, "/opt/local/include")
+-        add_directory(library_dirs, "/usr/local/lib")
+         # FIXME: check /opt/stuff directories here?
+         prefix = sysconfig.get_config_var("prefix")
+@@ -199,22 +198,6 @@
+             add_directory(include_dirs, include_root)
+         #
+-        # add standard directories
+-
+-        # look for tcl specific subdirectory (e.g debian)
+-        if _tkinter:
+-            tcl_dir = "/usr/include/tcl" + TCL_VERSION
+-            if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
+-                add_directory(include_dirs, tcl_dir)
+-
+-        # standard locations
+-        add_directory(library_dirs, "/usr/local/lib")
+-        add_directory(include_dirs, "/usr/local/include")
+-
+-        add_directory(library_dirs, "/usr/lib")
+-        add_directory(include_dirs, "/usr/include")
+-
+-        #
+         # insert new dirs *before* default libs, to avoid conflicts
+         # between Python PYD stub libs and real libraries
diff --git a/lang/python-json/Makefile b/lang/python-json/Makefile
new file mode 100644 (file)
index 0000000..b02f0c5
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008-2010 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:=json-py
+PKG_VERSION:=3_4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=921ebfede886a10ff32d6d4b4e216f8f
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+PKG_UNPACK:=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-json
+       SECTION:=language-python
+       CATEGORY:=Languages
+       SUBMENU:=Python
+       TITLE:=json-py
+       URL:=http://sourceforge.net/projects/json-py/
+       DEPENDS:=+python-mini
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) \
+               $(PKG_BUILD_DIR)/json.py \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-json/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/json.py \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-json))
diff --git a/lang/python-mimms/Makefile b/lang/python-mimms/Makefile
new file mode 100644 (file)
index 0000000..b84bc53
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2012 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:=mimms
+PKG_VERSION:=3.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=mimms-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/mimms
+PKG_MD5SUM:=ec629d8899551b4789ba15c17402c36f
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+PKG_LICENSE:=GPLv3
+PKG_LICENSE_FILES:=COPYING
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-mimms
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-mimms
+  URL:=http://savannah.nongnu.org/projects/mimms
+  DEPENDS:=+python +libmms
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/python-mimms/description
+  mimms is an mms (e.g. mms://) stream downloader
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/libmimms
+       $(CP) \
+               $(PKG_BUILD_DIR)/libmimms \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/libmimms
+       $(CP) \
+               $(PKG_BUILD_DIR)/mimms \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-mimms/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/libmimms
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/libmimms \
+               $(1)$(PYTHON_PKG_DIR)/libmimms
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/mimms \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-mimms))
diff --git a/lang/python-pydaemon/Makefile b/lang/python-pydaemon/Makefile
new file mode 100644 (file)
index 0000000..f3490c3
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2012 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:=pydaemon
+PKG_VERSION:=0.2.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://wookr.com/pydaemon/dl/
+PKG_MD5SUM:=99f844f4d40c21c4d99a8659ecff000d
+
+PKG_LICENSE:=BSD
+PKG_LICENSE_FILES:=License.txt
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-pydaemon
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-pydaemon
+  URL:=http://wookr.com/pydaemon
+  DEPENDS:=+python +python-rsfile
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/python-pydaemon/description
+  Turn python scripts into Unix daemons
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/pydaemon
+       $(CP) \
+               $(PKG_BUILD_DIR)/src/pydaemon \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-pydaemon/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/pydaemon
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/pydaemon \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-pydaemon))
diff --git a/lang/python-pyosc/Makefile b/lang/python-pyosc/Makefile
new file mode 100644 (file)
index 0000000..d843938
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2012 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:=pyOSC
+PKG_VERSION:=0.3.5b-5294
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://trac.v2.nl/raw-attachment/wiki/pyOSC
+PKG_MD5SUM:=933f85d1ae76f31e711d4a2228507dd8
+
+PKG_LICENSE:=LGPLv2.1
+PKG_LICENSE_FILES:=lesser.txt
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-pyosc
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-pyosc
+  URL:=http://trac.v2.nl/wiki/pyOSC
+  DEPENDS:=+python
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/python-pyosc/description
+  A simple OpenSoundControl implementation in pure Python
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_BUILD_DIR)/OSC.py \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-pyosc/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/OSC.py \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-pyosc))
diff --git a/lang/python-rsfile/Makefile b/lang/python-rsfile/Makefile
new file mode 100644 (file)
index 0000000..1265606
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2012 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:=RSFile
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/R/RSFile
+PKG_MD5SUM:=06f53cbcc268039212a853703abcb85a
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-rsfile
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-rsfile
+  URL:=http://pypi.python.org/pypi/RSFile/
+  DEPENDS:=+python
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/python-rsfile/description
+  RockSolidTools' file I/O implementation
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_BUILD_DIR)/rsfile \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_BUILD_DIR)/rsbackends \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-rsfile/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/rsfile \
+               $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_BUILD_DIR)/rsbackends \
+                       $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-rsfile))
diff --git a/lang/python-sip/Makefile b/lang/python-sip/Makefile
new file mode 100644 (file)
index 0000000..cd84aa8
--- /dev/null
@@ -0,0 +1,148 @@
+#
+# Copyright (C) 2010 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-sip
+PKG_VERSION:=4.12.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=sip-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://bu3sch.de/pyqt4/
+PKG_MD5SUM:=0f8e8305b14c1812191de2e0ee22fea9
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+HOST_BUILD_PARALLEL:=1
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/sip-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/sip-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=python
+HOST_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+-include $(if $(DUMP),,./files/python-sip-package.mk)
+
+define Package/python-sip
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=Python SIP
+  DEPENDS:=+python
+  MAINTAINER:=Michael Buesch <mb@bu3sch.de>
+  URL:=http://www.riverbankcomputing.co.uk/software/sip/download
+endef
+
+
+# ===> TARGET <===
+
+EXTRA_CFLAGS:=\
+       $(FPIC)
+
+define Build/Configure
+       $(INSTALL_DIR) "$(PYTHON_SIP_CONFIG_TEMPLATE_DIR)"
+       $(CP) ./files/sipconfig.macros.template "$(PYTHON_SIP_CONFIG_TEMPLATE)"
+       echo "CC                        $(TARGET_CROSS)gcc" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "CFLAGS                    $(TARGET_CFLAGS) $(EXTRA_CFLAGS)" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "CXX                       $(TARGET_CROSS)g++" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "CXXFLAGS                  $(TARGET_CFLAGS) $(EXTRA_CFLAGS)" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "LINK                      $(TARGET_CROSS)g++" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "LINK_SHLIB                $(TARGET_CROSS)g++" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "LFLAGS                    $(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "AR                        $(TARGET_CROSS)ar cqs" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       echo "STRIP                     $(STRIP)" >> $(PYTHON_SIP_CONFIG_TEMPLATE)
+       $(call HostPython, \
+               cd "$(PKG_BUILD_DIR)"; \
+               , \
+               ./configure.py \
+                       --crosscompile \
+                       --bindir=$(PKG_INSTALL_DIR)/usr/bin \
+                       --destdir=$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR) \
+                       --incdir=$(PKG_INSTALL_DIR)/usr/include \
+                       --sipdir=$(PKG_INSTALL_DIR)/usr/share/sip \
+                       --sipconfig-macros="$(PYTHON_SIP_CONFIG_TEMPLATE)" \
+                       --py-site-dir=$(STAGING_DIR)/$(PYTHON_PKG_DIR) \
+                       --py-inc-dir=$(PYTHON_INC_DIR) \
+                       --py-conf-inc-dir=$(PKG_BUILD_DIR) \
+                       --py-lib-dir=$(PYTHON_LIB_DIR) \
+                       --py-bin-dir=$(PYTHON_BIN_DIR) \
+                       --py-sip-dir=$(STAGING_DIR)/usr/share/sip \
+       )
+endef
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CROSS)gcc" \
+               CXX="$(TARGET_CROSS)g++" \
+               LINK="$(TARGET_CROSS)g++" \
+               CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+               CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/mk $(1)/$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) ./files/python-sip-package.mk $(1)/mk/
+       $(CP) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)/* $(1)/$(PYTHON_PKG_DIR)
+endef
+
+define Build/Install
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CROSS)gcc" \
+               CXX="$(TARGET_CROSS)g++" \
+               LINK="$(TARGET_CROSS)g++" \
+               CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+               CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+               DESTDIR="" \
+               install
+endef
+
+define Package/python-sip/install
+       # We only install the python module for now...
+       $(INSTALL_DIR) $(1)/$(PYTHON_PKG_DIR)
+       $(CP) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)/* $(1)/$(PYTHON_PKG_DIR)
+endef
+
+
+# ===> HOST <===
+
+HOST_CFLAGS+= \
+       $(HOST_FPIC) \
+       -I$(STAGING_DIR_HOST)/include/python$(PYTHON_VERSION)
+
+define Host/Configure
+       $(call HostPython, \
+               cd "$(HOST_BUILD_DIR)"; \
+               , \
+               ./configure.py \
+                       --bindir=$(STAGING_DIR_HOST)/usr/bin \
+                       --destdir=$(STAGING_DIR_HOST)/$(PYTHON_PKG_DIR) \
+                       --incdir=$(STAGING_DIR_HOST)/usr/include \
+                       --sipdir=$(STAGING_DIR_HOST)/usr/share/sip \
+       )
+endef
+
+define Host/Compile
+       $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
+               CC="$(HOSTCC)" \
+               CXX="g++" \
+               LINK="g++" \
+               CFLAGS="$(HOST_CFLAGS)" \
+               CXXFLAGS="$(HOST_CFLAGS)"
+endef
+
+define Host/Install
+       $(MAKE) -C $(HOST_BUILD_DIR) \
+               CC="$(HOSTCC)" \
+               CXX="g++" \
+               LINK="g++" \
+               CFLAGS="$(HOST_CFLAGS)" \
+               CXXFLAGS="$(HOST_CFLAGS)" \
+               install
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,python-sip))
diff --git a/lang/python-sip/files/python-sip-package.mk b/lang/python-sip/files/python-sip-package.mk
new file mode 100644 (file)
index 0000000..ac2292c
--- /dev/null
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+PYTHON_SIP_CONFIG_TEMPLATE_DIR:=$(STAGING_DIR)/usr/share/python-sip
+PYTHON_SIP_CONFIG_TEMPLATE:=$(PYTHON_SIP_CONFIG_TEMPLATE_DIR)/sipconfig.template
+
diff --git a/lang/python-sip/files/sipconfig.macros.template b/lang/python-sip/files/sipconfig.macros.template
new file mode 100644 (file)
index 0000000..ae9e1a6
--- /dev/null
@@ -0,0 +1,87 @@
+AIX_SHLIB
+AR                             ar cqs
+CC                             gcc
+CFLAGS                         -pipe
+CFLAGS_CONSOLE
+CFLAGS_DEBUG
+CFLAGS_EXCEPTIONS_OFF
+CFLAGS_EXCEPTIONS_ON
+CFLAGS_MT
+CFLAGS_MT_DBG
+CFLAGS_MT_DLL
+CFLAGS_MT_DLLDBG
+CFLAGS_RELEASE
+CFLAGS_RTTI_OFF
+CFLAGS_RTTI_ON
+CFLAGS_SHLIB
+CFLAGS_STL_OFF
+CFLAGS_STL_ON
+CFLAGS_THREAD                  -D_REENTRANT
+CFLAGS_WARN_OFF                        -w
+CFLAGS_WARN_ON                 -Wall -W
+CHK_DIR_EXISTS                 test -d
+CONFIG                         qt warn_on release incremental link_prl
+COPY                           cp -f
+CXX                            g++
+CXXFLAGS                       -pipe
+CXXFLAGS_CONSOLE
+CXXFLAGS_DEBUG
+CXXFLAGS_EXCEPTIONS_OFF
+CXXFLAGS_EXCEPTIONS_ON
+CXXFLAGS_MT
+CXXFLAGS_MT_DBG
+CXXFLAGS_MT_DLL
+CXXFLAGS_MT_DLLDBG
+CXXFLAGS_RELEASE
+CXXFLAGS_RTTI_OFF
+CXXFLAGS_RTTI_ON
+CXXFLAGS_SHLIB
+CXXFLAGS_STL_OFF
+CXXFLAGS_STL_ON
+CXXFLAGS_THREAD                        -D_REENTRANT
+CXXFLAGS_WARN_OFF              -w
+CXXFLAGS_WARN_ON               -Wall -W
+DEFINES
+DEL_FILE                       rm -f
+EXTENSION_PLUGIN
+EXTENSION_SHLIB
+INCDIR
+INCDIR_OPENGL                  /usr/X11R6/include
+INCDIR_X11                     /usr/X11R6/include
+LFLAGS
+LFLAGS_CONSOLE
+LFLAGS_CONSOLE_DLL
+LFLAGS_DEBUG
+LFLAGS_DLL
+LFLAGS_OPENGL
+LFLAGS_PLUGIN                  -shared
+LFLAGS_RELEASE
+LFLAGS_SHLIB                   -shared
+LFLAGS_SONAME                  -Wl,-soname,
+LFLAGS_THREAD
+LFLAGS_WINDOWS
+LFLAGS_WINDOWS_DLL
+LIB
+LIBDIR
+LIBDIR_OPENGL                  /usr/X11R6/lib
+LIBDIR_X11                     /usr/X11R6/lib
+LIBS
+LIBS_CONSOLE
+LIBS_CORE
+LIBS_GUI
+LIBS_NETWORK
+LIBS_OPENGL                    -lGLU -lGL
+LIBS_RT
+LIBS_RTMT
+LIBS_THREAD                    -lpthread
+LIBS_WEBKIT
+LIBS_WINDOWS
+LIBS_X11                       -lXext -lX11 -lm
+LINK                           g++
+LINK_SHLIB                     g++
+LINK_SHLIB_CMD
+MAKEFILE_GENERATOR             UNIX
+MKDIR                          mkdir -p
+RANLIB
+RPATH                          -Wl,-rpath,
+STRIP                          strip
diff --git a/lang/python-sip/patches/100-cross-compile.patch b/lang/python-sip/patches/100-cross-compile.patch
new file mode 100644 (file)
index 0000000..9b7c3da
--- /dev/null
@@ -0,0 +1,208 @@
+Index: sip-4.12.1/configure.py
+===================================================================
+--- sip-4.12.1.orig/configure.py       2011-01-22 14:47:21.000000000 +0100
++++ sip-4.12.1/configure.py    2011-03-13 16:47:19.085716739 +0100
+@@ -19,7 +19,6 @@ import sys
+ import os
+ import glob
+ import optparse
+-from distutils import sysconfig
+ import siputils
+@@ -197,21 +196,45 @@ def set_platform_directories():
+     global plat_py_site_dir, plat_py_inc_dir, plat_py_conf_inc_dir
+     global plat_bin_dir, plat_py_lib_dir, plat_sip_dir
+-    # We trust distutils for some stuff.
+-    plat_py_site_dir = sysconfig.get_python_lib(plat_specific=1)
+-    plat_py_inc_dir = sysconfig.get_python_inc()
+-    plat_py_conf_inc_dir = os.path.dirname(sysconfig.get_config_h_filename())
+-
+-    if sys.platform == "win32":
+-        plat_py_lib_dir = sys.prefix + "\\libs"
+-        plat_bin_dir = sys.exec_prefix
+-        plat_sip_dir = sys.prefix + "\\sip"
+-    else:
+-        lib_dir = sysconfig.get_python_lib(plat_specific=1, standard_lib=1)
++    if not opts.crosscompile:
++        # We trust distutils for some stuff.
++        from distutils import sysconfig
++        plat_py_site_dir = sysconfig.get_python_lib(plat_specific=1)
++        plat_py_inc_dir = sysconfig.get_python_inc()
++        plat_py_conf_inc_dir = os.path.dirname(sysconfig.get_config_h_filename())
++
++        if sys.platform == "win32":
++            plat_py_lib_dir = sys.prefix + "\\libs"
++            plat_bin_dir = sys.exec_prefix
++            plat_sip_dir = sys.prefix + "\\sip"
++        else:
++            lib_dir = sysconfig.get_python_lib(plat_specific=1, standard_lib=1)
+-        plat_py_lib_dir = lib_dir + "/config"
+-        plat_bin_dir = sys.exec_prefix + "/bin"
+-        plat_sip_dir = sys.prefix + "/share/sip"
++            plat_py_lib_dir = lib_dir + "/config"
++            plat_bin_dir = sys.exec_prefix + "/bin"
++            plat_sip_dir = sys.prefix + "/share/sip"
++
++    count = 0
++    if opts.py_site_dir:
++        plat_py_site_dir = opts.py_site_dir
++        count += 1
++    if opts.py_inc_dir:
++        plat_py_inc_dir = opts.py_inc_dir
++        count += 1
++    if opts.py_conf_inc_dir:
++        plat_py_conf_inc_dir = opts.py_conf_inc_dir
++        count += 1
++    if opts.py_lib_dir:
++        plat_py_lib_dir = opts.py_lib_dir
++        count += 1
++    if opts.py_bin_dir:
++        plat_py_bin_dir = opts.py_bin_dir
++        count += 1
++    if opts.py_sip_dir:
++        plat_sip_dir = opts.py_sip_dir
++        count += 1
++    if count != 6 and opts.crosscompile:
++        siputils.error("Need to specify all --py-... options for crosscompile.")
+ def patch_files():
+@@ -337,6 +360,11 @@ def create_optparser():
+     def store_abspath(option, opt_str, value, parser):
+         setattr(parser.values, option.dest, os.path.abspath(value))
++    def store_abspath_file(option, opt_str, value, parser):
++        if not os.path.isfile(value):
++            raise optparse.OptionValueError("'%s' is not a file" % value)
++        setattr(parser.values, option.dest, os.path.abspath(value))
++
+     p = optparse.OptionParser(usage="python %prog [opts] [macro=value] "
+             "[macro+=value]", version=sip_version_str)
+@@ -411,9 +439,62 @@ def create_optparser():
+             "are normally installed [default: %s]" % default_sipsipdir)
+     p.add_option_group(g)
++    # Crosscompilation
++    g = optparse.OptionGroup(p, title="Crosscompilation")
++    g.add_option("--crosscompile", action="store_true",
++                 default=False, dest="crosscompile",
++                 help="Set, if cross-compiling")
++    g.add_option("--sipconfig-macros", action="callback", metavar="FILE",
++                 default=None, dest="sipconfig_macros", type="string",
++                 callback=store_abspath_file,
++                 help="Path to a file containing sipconfig macros")
++    g.add_option("--py-site-dir", action="callback",
++                 default=None, dest="py_site_dir", type="string",
++               callback=store_abspath,
++               help="Python site directory")
++    g.add_option("--py-inc-dir", action="callback",
++                 default=None, dest="py_inc_dir", type="string",
++               callback=store_abspath,
++               help="Python include directory")
++    g.add_option("--py-conf-inc-dir", action="callback",
++                 default=None, dest="py_conf_inc_dir", type="string",
++               callback=store_abspath,
++               help="Python config include directory")
++    g.add_option("--py-lib-dir", action="callback",
++                 default=None, dest="py_lib_dir", type="string",
++               callback=store_abspath,
++               help="Python library directory")
++    g.add_option("--py-bin-dir", action="callback",
++                 default=None, dest="py_bin_dir", type="string",
++               callback=store_abspath,
++               help="Python binary directory")
++    g.add_option("--py-sip-dir", action="callback",
++                 default=None, dest="py_sip_dir", type="string",
++               callback=store_abspath,
++               help="Python SIP directory")
++    p.add_option_group(g)
++
+     return p
++def load_sipconfig_macros(filename):
++    macros = {}
++    fd = file(filename, "r")
++    for line in fd.readlines():
++        line = line.split()
++        try:
++            key = line[0]
++        except IndexError:
++            sipconfig.error("Invalid sipconfig macros file format")
++        value = ""
++        try:
++            value = " ".join(line[1:])
++        except IndexError:
++            pass
++        macros[key] = value
++    return macros
++
++
+ def main(argv):
+     """Create the configuration module module.
+@@ -424,9 +505,6 @@ def main(argv):
+     if py_version < 0x020300:
+         siputils.error("This version of SIP requires Python v2.3 or later.")
+-    # Basic initialisation.
+-    set_platform_directories()
+-
+     # Build up the list of valid specs.
+     for s in os.listdir(os.path.join(src_dir, "specs")):
+         platform_specs.append(s)
+@@ -438,6 +516,9 @@ def main(argv):
+     p = create_optparser()
+     opts, args = p.parse_args()
++    # Basic initialisation.
++    set_platform_directories()
++
+     # Make sure MacOS specific options get initialised.
+     if sys.platform != 'darwin':
+         opts.universal = ''
+@@ -477,14 +558,16 @@ def main(argv):
+     else:
+         opts.universal = ''
+-    # Get the platform specific macros for building.
+-    macros = siputils.parse_build_macros(
+-            os.path.join(src_dir, "specs", opts.platform), build_macro_names,
+-            args)
+-
+-    if macros is None:
+-        siputils.error("Unsupported macro name specified. Use the --show-build-macros flag to see a list of supported macros.")
+-        sys.exit(2)
++    if opts.sipconfig_macros:
++        macros = load_sipconfig_macros(opts.sipconfig_macros)
++    else:
++        # Get the platform specific macros for building.
++        macros = siputils.parse_build_macros(
++                os.path.join(src_dir, "specs", opts.platform), build_macro_names,
++                args)
++        if macros is None:
++            siputils.error("Unsupported macro name specified. Use the --show-build-macros flag to see a list of supported macros.")
++            sys.exit(2)
+     # Fix the name of the sip module.
+     global sip_module_base
+Index: sip-4.12.1/siputils.py
+===================================================================
+--- sip-4.12.1.orig/siputils.py        2011-01-22 14:45:38.000000000 +0100
++++ sip-4.12.1/siputils.py     2011-03-13 16:47:19.087716533 +0100
+@@ -1044,9 +1044,11 @@ class Makefile:
+         for f in self.optional_list("DEFINES"):
+             cppflags.append("-D" + f)
++            print "CPPFLAGS: Adding -D", f
+         for f in self.optional_list("INCDIR"):
+             cppflags.append("-I" + _quote(f))
++            print "CPPFLAGS: Adding -I", _quote(f)
+         libs = []
diff --git a/lang/python-webpy/Makefile b/lang/python-webpy/Makefile
new file mode 100644 (file)
index 0000000..0350e0d
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2012 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:=web.py
+PKG_VERSION:=0.37
+PKG_RELEASE:=2
+
+PKG_SOURCE:=web.py-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://webpy.org/static/
+PKG_MD5SUM:=93375e3f03e74d6bf5c5096a4962a8db
+
+PKG_LICENSE:=PUBLICDOMAIN BSD
+PKG_LICENSE_FILES:=
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-webpy
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-webpy
+  URL:=http://webpy.org
+  DEPENDS:=+python
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/python-web.py/description
+  Think about the ideal way to write a web app. Write the code to make it happen.
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_BUILD_DIR)/web \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)
+endef
+
+define Package/python-webpy/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/web \
+               $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-webpy))
diff --git a/lang/python/Makefile b/lang/python/Makefile
new file mode 100644 (file)
index 0000000..8493b55
--- /dev/null
@@ -0,0 +1,511 @@
+#
+# Copyright (C) 2006-2012 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
+PKG_VERSION:=2.7.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
+PKG_MD5SUM:=62c4c1699170078c469f79ddfed21bc0
+
+PKG_LICENSE:=PSF
+PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+HOST_BUILD_PARALLEL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=python/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,./files/python-package.mk)
+
+define Package/python/Default
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python $(PYTHON_VERSION) programming language
+  URL:=http://www.python.org/
+endef
+
+define Package/python/Default/description
+ Python is a dynamic object-oriented programming language that can be used
+ for many kinds of software development. It offers strong support for
+ integration with other languages and tools, comes with extensive standard
+ libraries, and can be learned in a few days. Many Python programmers
+ report substantial productivity gains and feel the language encourages
+ the development of higher quality, more maintainable code.
+endef
+
+define Package/python
+$(call Package/python/Default)
+  TITLE+= (full)
+  DEPENDS:=+libpthread +zlib +libffi +python-mini
+endef
+
+define Package/python/description
+$(call Package/python/Default/description)
+ .
+ This package contains the full Python install.
+endef
+
+define Package/python-mini
+$(call Package/python/Default)
+  TITLE+= (minimal)
+  DEPENDS:=+libpthread +zlib
+endef
+
+define Package/python-mini/description
+$(call Package/python/Default/description)
+  .
+  This package contains only a minimal Python install.
+endef
+
+define Package/python-doc
+$(call Package/python/Default)
+  TITLE:=Python interactive documentation
+  DEPENDS+=+python-mini
+endef
+
+define Package/python-bzip2
+$(call Package/python/Default)
+  TITLE:=Python support for Bzip2
+  DEPENDS+=+python-mini +libbz2
+endef
+
+define Package/python-expat
+$(call Package/python/Default)
+  TITLE:=Python support for expat
+  DEPENDS+=+python-mini +libexpat
+endef
+
+define Package/python-gzip
+$(call Package/python/Default)
+  TITLE:=Python support for gzip
+  DEPENDS+=+python-mini
+endef
+
+define Package/python-openssl
+$(call Package/python/Default)
+ TITLE:=Python support for OpenSSL
+ DEPENDS+=+python-mini +libopenssl
+endef
+
+define Package/python-shutil
+$(call Package/python/Default)
+  TITLE:=Python support for shutil
+  DEPENDS+=+python-mini
+endef
+
+# Needs datetime
+define Package/python-sqlite3
+$(call Package/python/Default)
+ TITLE:=Python support for sqlite3
+ DEPENDS+=+python +libsqlite3
+endef
+
+define Package/python-gdbm
+$(call Package/python/Default)
+ TITLE:=Python support for gdbm
+ DEPENDS+=+python-mini +libgdbm
+endef
+
+define Package/python-readline
+$(call Package/python/Default)
+ TITLE:=Python support for readline
+ DEPENDS+=+python-mini +libreadline +libncurses @BROKEN
+endef
+
+define Package/python-ncurses
+$(call Package/python/Default)
+ TITLE:=Python support for readline
+ DEPENDS+=+python-mini +libncurses
+endef
+
+MAKE_FLAGS:=\
+       $(TARGET_CONFIGURE_OPTS) \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       CROSS_COMPILE=yes \
+       CFLAGS="$(TARGET_CFLAGS) -DNDEBUG -fno-inline" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       LD="$(TARGET_CC)" \
+       HOSTPYTHON=./hostpython \
+       HOSTPGEN=./hostpgen
+
+ENABLE_IPV6:=
+ifeq ($(CONFIG_IPV6),y)
+       ENABLE_IPV6 += --enable-ipv6
+endif
+
+define Build/Configure
+       -$(MAKE) -C $(PKG_BUILD_DIR) distclean
+       (cd $(PKG_BUILD_DIR); autoreconf --force --install || exit 0)
+       # The python executable needs to stay in the rootdir since its location will
+       # be used to compute the path of the config files.
+       $(CP) $(STAGING_DIR_HOST)/bin/pgen $(PKG_BUILD_DIR)/hostpgen
+       $(CP) $(STAGING_DIR_HOST)/bin/python$(PYTHON_VERSION) $(PKG_BUILD_DIR)/hostpython
+       $(call Build/Configure/Default, \
+               --sysconfdir=/etc \
+               --disable-shared \
+               --without-cxx-main \
+               --with-threads \
+               --with-system-ffi="$(STAGING_DIR)/usr" \
+               $(ENABLE_IPV6) \
+               ac_cv_have_chflags=no \
+               ac_cv_have_lchflags=no \
+               ac_cv_py_format_size_t=no \
+               ac_cv_have_long_long_format=yes \
+               ac_cv_buggy_getaddrinfo=no \
+               OPT="$(TARGET_CFLAGS)" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
+       $(INSTALL_DIR) $(STAGING_DIR)/mk/
+       $(INSTALL_DATA) ./files/python-package.mk $(STAGING_DIR)/mk/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
+               $(1)/usr/include/
+       $(CP) \
+               $(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \
+               $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
+               $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
+               $(1)/usr/lib/python$(PYTHON_VERSION)/
+
+       $(CP) \
+               $(STAGING_DIR_HOST)/bin/python$(PYTHON_VERSION) \
+               $(1)/usr/bin/hostpython
+       (cd $(2)/bin; \
+       ln -sf ../../usr/bin/hostpython python$(PYTHON_VERSION); \
+       ln -sf python$(PYTHON_VERSION) python)
+
+       $(CP) \
+               $(STAGING_DIR_HOST)/bin/python$(PYTHON_VERSION)-config \
+               $(2)/bin/
+       $(SED) 's,^#!.*,#!/usr/bin/env python$(PYTHON_VERSION),g' $(2)/bin/python$(PYTHON_VERSION)-config
+
+       (cd $(2)/bin; \
+       ln -sf python$(PYTHON_VERSION)-config python-config;)
+endef
+
+define PyPackage/python/filespec
++|/usr/lib/python$(PYTHON_VERSION)
+-|/usr/lib/python$(PYTHON_VERSION)/bsddb/test
+-|/usr/lib/python$(PYTHON_VERSION)/config
+-|/usr/lib/python$(PYTHON_VERSION)/ctypes/test
+-|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst-*.exe
+-|/usr/lib/python$(PYTHON_VERSION)/distutils/tests
+-|/usr/lib/python$(PYTHON_VERSION)/email/test
+-|/usr/lib/python$(PYTHON_VERSION)/idlelib
+-|/usr/lib/python$(PYTHON_VERSION)/json/tests
+-|/usr/lib/python$(PYTHON_VERSION)/lib-tk
+-|/usr/lib/python$(PYTHON_VERSION)/sqlite3
+-|/usr/lib/python$(PYTHON_VERSION)/test
+-|/usr/lib/python$(PYTHON_VERSION)/lib2to3
+-|/usr/lib/python$(PYTHON_VERSION)/lib-old
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/bz2.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so
+-|/usr/lib/python$(PYTHON_VERSION)/pydoc_data
+-|/usr/lib/python$(PYTHON_VERSION)/pydoc.py
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ctypes_test.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
+-|/usr/lib/python$(PYTHON_VERSION)/__future__.py
+-|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
+-|/usr/lib/python$(PYTHON_VERSION)/abc.py
+-|/usr/lib/python$(PYTHON_VERSION)/codecs.py
+-|/usr/lib/python$(PYTHON_VERSION)/compileall.py
+-|/usr/lib/python$(PYTHON_VERSION)/ConfigParser.py
+-|/usr/lib/python$(PYTHON_VERSION)/copy.py
+-|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
+-|/usr/lib/python$(PYTHON_VERSION)/dis.py
+-|/usr/lib/python$(PYTHON_VERSION)/encodings
+-|/usr/lib/python$(PYTHON_VERSION)/fnmatch.py
+-|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
+-|/usr/lib/python$(PYTHON_VERSION)/getopt.py
+-|/usr/lib/python$(PYTHON_VERSION)/glob.py
+-|/usr/lib/python$(PYTHON_VERSION)/hashlib.py
+-|/usr/lib/python$(PYTHON_VERSION)/inspect.py
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/array.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/binascii.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/cStringIO.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses_panel.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/dbm.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_bsddb.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/fcntl.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_md5.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha256.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha512.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/syslog.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/time.so
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so
+-|/usr/lib/python$(PYTHON_VERSION)/linecache.py
+-|/usr/lib/python$(PYTHON_VERSION)/md5.py
+-|/usr/lib/python$(PYTHON_VERSION)/new.py
+-|/usr/lib/python$(PYTHON_VERSION)/opcode.py
+-|/usr/lib/python$(PYTHON_VERSION)/optparse.py
+-|/usr/lib/python$(PYTHON_VERSION)/os.py
+-|/usr/lib/python$(PYTHON_VERSION)/pickle.py
+-|/usr/lib/python$(PYTHON_VERSION)/pickle.py
+-|/usr/lib/python$(PYTHON_VERSION)/pkgutil.py
+-|/usr/lib/python$(PYTHON_VERSION)/popen2.py
+-|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
+-|/usr/lib/python$(PYTHON_VERSION)/py_compile.py
+-|/usr/lib/python$(PYTHON_VERSION)/random.py
+-|/usr/lib/python$(PYTHON_VERSION)/repr.py
+-|/usr/lib/python$(PYTHON_VERSION)/re.py
+-|/usr/lib/python$(PYTHON_VERSION)/sha.py
+-|/usr/lib/python$(PYTHON_VERSION)/site.py
+-|/usr/lib/python$(PYTHON_VERSION)/socket.py
+-|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
+-|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
+-|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
+-|/usr/lib/python$(PYTHON_VERSION)/sre.py
+-|/usr/lib/python$(PYTHON_VERSION)/stat.py
+-|/usr/lib/python$(PYTHON_VERSION)/StringIO.py
+-|/usr/lib/python$(PYTHON_VERSION)/stringprep.py
+-|/usr/lib/python$(PYTHON_VERSION)/string.py
+-|/usr/lib/python$(PYTHON_VERSION)/struct.py
+-|/usr/lib/python$(PYTHON_VERSION)/subprocess.py
+-|/usr/lib/python$(PYTHON_VERSION)/tempfile.py
+-|/usr/lib/python$(PYTHON_VERSION)/textwrap.py
+-|/usr/lib/python$(PYTHON_VERSION)/tokenize.py
+-|/usr/lib/python$(PYTHON_VERSION)/token.py
+-|/usr/lib/python$(PYTHON_VERSION)/traceback.py
+-|/usr/lib/python$(PYTHON_VERSION)/types.py
+-|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
+-|/usr/lib/python$(PYTHON_VERSION)/warnings.py
+-|/usr/lib/python$(PYTHON_VERSION)/weakref.py
+-|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
+-|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
+-|/usr/lib/python$(PYTHON_VERSION)/functools.py
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_functools.so
+-|/usr/lib/python$(PYTHON_VERSION)/collections.py
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_collections.so
+-|/usr/lib/python$(PYTHON_VERSION)/keyword.py
+-|/usr/lib/python$(PYTHON_VERSION)/heapq.py
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_heapq.so
+-|/usr/lib/python$(PYTHON_VERSION)/bisect.py
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_bisect.so
+endef
+
+define PyPackage/python-mini/filespec
++|/usr/bin/python$(PYTHON_VERSION)
++|/usr/lib/python$(PYTHON_VERSION)/__future__.py
++|/usr/lib/python$(PYTHON_VERSION)/_abcoll.py
++|/usr/lib/python$(PYTHON_VERSION)/abc.py
++|/usr/lib/python$(PYTHON_VERSION)/codecs.py
++|/usr/lib/python$(PYTHON_VERSION)/compileall.py
++|/usr/lib/python$(PYTHON_VERSION)/ConfigParser.py
++|/usr/lib/python$(PYTHON_VERSION)/copy.py
++|/usr/lib/python$(PYTHON_VERSION)/copy_reg.py
++|/usr/lib/python$(PYTHON_VERSION)/dis.py
++|/usr/lib/python$(PYTHON_VERSION)/encodings
++|/usr/lib/python$(PYTHON_VERSION)/fnmatch.py
++|/usr/lib/python$(PYTHON_VERSION)/genericpath.py
++|/usr/lib/python$(PYTHON_VERSION)/getopt.py
++|/usr/lib/python$(PYTHON_VERSION)/glob.py
++|/usr/lib/python$(PYTHON_VERSION)/hashlib.py
++|/usr/lib/python$(PYTHON_VERSION)/inspect.py
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/array.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/binascii.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/cStringIO.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/fcntl.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/grp.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/itertools.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/math.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_md5.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/operator.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_random.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/select.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha256.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sha512.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_socket.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/strop.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_struct.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/syslog.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/time.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/unicodedata.so
++|/usr/lib/python$(PYTHON_VERSION)/linecache.py
++|/usr/lib/python$(PYTHON_VERSION)/md5.py
++|/usr/lib/python$(PYTHON_VERSION)/new.py
++|/usr/lib/python$(PYTHON_VERSION)/opcode.py
++|/usr/lib/python$(PYTHON_VERSION)/optparse.py
++|/usr/lib/python$(PYTHON_VERSION)/os.py
++|/usr/lib/python$(PYTHON_VERSION)/pickle.py
++|/usr/lib/python$(PYTHON_VERSION)/pickle.py
++|/usr/lib/python$(PYTHON_VERSION)/pkgutil.py
++|/usr/lib/python$(PYTHON_VERSION)/popen2.py
++|/usr/lib/python$(PYTHON_VERSION)/posixpath.py
++|/usr/lib/python$(PYTHON_VERSION)/py_compile.py
++|/usr/lib/python$(PYTHON_VERSION)/random.py
++|/usr/lib/python$(PYTHON_VERSION)/repr.py
++|/usr/lib/python$(PYTHON_VERSION)/re.py
++|/usr/lib/python$(PYTHON_VERSION)/sha.py
++|/usr/lib/python$(PYTHON_VERSION)/site.py
++|/usr/lib/python$(PYTHON_VERSION)/socket.py
++|/usr/lib/python$(PYTHON_VERSION)/sre_compile.py
++|/usr/lib/python$(PYTHON_VERSION)/sre_constants.py
++|/usr/lib/python$(PYTHON_VERSION)/sre_parse.py
++|/usr/lib/python$(PYTHON_VERSION)/sre.py
++|/usr/lib/python$(PYTHON_VERSION)/stat.py
++|/usr/lib/python$(PYTHON_VERSION)/StringIO.py
++|/usr/lib/python$(PYTHON_VERSION)/stringprep.py
++|/usr/lib/python$(PYTHON_VERSION)/string.py
++|/usr/lib/python$(PYTHON_VERSION)/struct.py
++|/usr/lib/python$(PYTHON_VERSION)/subprocess.py
++|/usr/lib/python$(PYTHON_VERSION)/tempfile.py
++|/usr/lib/python$(PYTHON_VERSION)/textwrap.py
++|/usr/lib/python$(PYTHON_VERSION)/tokenize.py
++|/usr/lib/python$(PYTHON_VERSION)/token.py
++|/usr/lib/python$(PYTHON_VERSION)/traceback.py
++|/usr/lib/python$(PYTHON_VERSION)/types.py
++|/usr/lib/python$(PYTHON_VERSION)/UserDict.py
++|/usr/lib/python$(PYTHON_VERSION)/warnings.py
++|/usr/lib/python$(PYTHON_VERSION)/weakref.py
++|/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py
++|/usr/lib/python$(PYTHON_VERSION)/config/Makefile
++|/usr/lib/python$(PYTHON_VERSION)/sysconfig.py
++|/usr/lib/python$(PYTHON_VERSION)/functools.py
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_functools.so
++|/usr/lib/python$(PYTHON_VERSION)/collections.py
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_collections.so
++|/usr/lib/python$(PYTHON_VERSION)/keyword.py
++|/usr/lib/python$(PYTHON_VERSION)/heapq.py
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_heapq.so
++|/usr/lib/python$(PYTHON_VERSION)/bisect.py
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_bisect.so
++|/usr/include/python$(PYTHON_VERSION)/pyconfig.h
+endef
+
+define PyPackage/python-mini/install
+       ln -sf python$(PYTHON_VERSION) $(1)/usr/bin/python
+endef
+
+define PyPackage/python-doc/filespec
++|/usr/lib/python$(PYTHON_VERSION)/pydoc_data
++|/usr/lib/python$(PYTHON_VERSION)/pydoc.py
+endef
+
+define PyPackage/python-bzip2/filespec
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/bz2.so
+endef
+
+define PyPackage/python-expat/filespec
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/pyexpat.so
+endef
+
+define PyPackage/python-gzip/filespec
++|/usr/lib/python$(PYTHON_VERSION)/gzip.py
+endef
+
+define PyPackage/python-openssl/filespec
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_ssl.so
+endef
+
+define PyPackage/python-shutil/filespec
++|/usr/lib/python$(PYTHON_VERSION)/shutil.py
+endef
+
+define PyPackage/python-sqlite3/filespec
++|/usr/lib/python$(PYTHON_VERSION)/sqlite3
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_sqlite3.so
+endef
+
+define PyPackage/python-gdbm/filespec
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/gdbm.so
+endef
+
+define PyPackage/python-readline/filespec
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
+endef
+
+define PyPackage/python-ncurses/filespec
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses.so
++|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_curses_panel.so
+endef
+
+define Host/Configure
+       -$(MAKE) -C $(HOST_BUILD_DIR) distclean
+       (cd $(HOST_BUILD_DIR); autoreconf --force --install || exit 0)
+       (cd $(HOST_BUILD_DIR); \
+               rm -rf config.cache; \
+               CONFIG_SITE= \
+               OPT="$(HOST_CFLAGS)" \
+               ./configure --without-cxx-main --with-threads --prefix=$(STAGING_DIR_HOST); \
+       )
+endef
+
+define Host/Compile
+       +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
+               python Parser/pgen
+       +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
+               HOSTPYTHON=$(HOST_BUILD_DIR)/python \
+               sharedmods
+endef
+
+define Host/Install
+       $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
+       $(MAKE) -C $(HOST_BUILD_DIR) \
+               HOSTPYTHON=$(HOST_BUILD_DIR)/python \
+               install
+       $(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(STAGING_DIR_HOST)/bin/
+endef
+
+
+$(eval $(call HostBuild))
+
+$(eval $(call PyPackage,python))
+$(eval $(call PyPackage,python-mini))
+$(eval $(call PyPackage,python-doc))
+$(eval $(call PyPackage,python-bzip2))
+$(eval $(call PyPackage,python-expat))
+$(eval $(call PyPackage,python-gzip))
+$(eval $(call PyPackage,python-openssl))
+$(eval $(call PyPackage,python-shutil))
+$(eval $(call PyPackage,python-sqlite3))
+$(eval $(call PyPackage,python-gdbm))
+$(eval $(call PyPackage,python-readline))
+$(eval $(call PyPackage,python-ncurses))
+
+$(eval $(call BuildPackage,python))
+$(eval $(call BuildPackage,python-mini))
+$(eval $(call BuildPackage,python-doc))
+$(eval $(call BuildPackage,python-bzip2))
+$(eval $(call BuildPackage,python-expat))
+$(eval $(call BuildPackage,python-gzip))
+$(eval $(call BuildPackage,python-openssl))
+$(eval $(call BuildPackage,python-shutil))
+$(eval $(call BuildPackage,python-sqlite3))
+$(eval $(call BuildPackage,python-gdbm))
+$(eval $(call BuildPackage,python-readline))
+$(eval $(call BuildPackage,python-ncurses))
diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk
new file mode 100644 (file)
index 0000000..70e6300
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+PYTHON_VERSION=2.7
+
+PYTHON_DIR:=$(STAGING_DIR)/usr
+PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
+PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
+PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
+
+PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
+
+PYTHON:=python$(PYTHON_VERSION)
+
+HOST_PYTHON_BIN:=$(STAGING_DIR)/usr/bin/hostpython
+
+define HostPython
+       (       export PYTHONPATH="$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR)"; \
+               export PYTHONOPTIMIZE=""; \
+               export PYTHONDONTWRITEBYTECODE=1; \
+               $(1) \
+               $(HOST_PYTHON_BIN) $(2); \
+       )
+endef
+
+define PyPackage
+  $(call shexport,PyPackage/$(1)/filespec)
+
+  define Package/$(1)/install
+       @$(SH_FUNC) getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
+               IFS='|'; \
+               while read fop fspec fperm; do \
+                 if [ "$$$$$$$$fop" = "+" ]; then \
+                       dpath=`dirname "$$$$$$$$fspec"`; \
+                       if [ -n "$$$$$$$$fperm" ]; then \
+                         dperm="-m$$$$$$$$fperm"; \
+                       else \
+                         dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
+                       fi; \
+                       mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
+                       echo "copying: '$$$$$$$$fspec'"; \
+                       cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
+                       if [ -n "$$$$$$$$fperm" ]; then \
+                         chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
+                       fi; \
+                 elif [ "$$$$$$$$fop" = "-" ]; then \
+                       echo "removing: '$$$$$$$$fspec'"; \
+                       rm -fR $$(1)$$$$$$$$fspec; \
+                 elif [ "$$$$$$$$fop" = "=" ]; then \
+                       echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
+                       chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
+                 fi; \
+               done; \
+       )
+       $(call PyPackage/$(1)/install,$$(1))
+  endef
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/PyMod
+       $(call HostPython, \
+               cd $(PKG_BUILD_DIR)/$(strip $(1)); \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               $(3) \
+               , \
+               ./setup.py $(2) \
+       )
+       find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
+endef
diff --git a/lang/python/patches/000-cross-compile.patch b/lang/python/patches/000-cross-compile.patch
new file mode 100644 (file)
index 0000000..a6f208e
--- /dev/null
@@ -0,0 +1,112 @@
+---
+ Makefile.pre.in |   25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -182,6 +182,7 @@ UNICODE_OBJS=   @UNICODE_OBJS@
+ PYTHON=               python$(EXE)
+ BUILDPYTHON=  python$(BUILDEXE)
++HOSTPYTHON=   $(BUILDPYTHON)
+ # The task to run while instrument when building the profile-opt target
+ PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
+@@ -214,6 +215,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
+ ##########################################################################
+ # Parser
+ PGEN=         Parser/pgen$(EXE)
++HOSTPGEN=     $(PGEN)$(EXE)
+ POBJS=                \
+               Parser/acceler.o \
+@@ -384,7 +386,7 @@ build_all_generate_profile:
+       $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
+ run_profile_task:
+-      ./$(BUILDPYTHON) $(PROFILE_TASK)
++      $(HOSTPYTHON) $(PROFILE_TASK)
+ build_all_use_profile:
+       $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
+@@ -402,14 +404,14 @@ $(BUILDPYTHON):  Modules/python.o $(LIBRA
+                       $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ platform: $(BUILDPYTHON)
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++      $(RUNSHARED) $(HOSTPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+       @case $$MAKEFLAGS in \
+-      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+-      *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+       esac
+ # Build static library
+@@ -543,7 +545,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
+ $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
+ Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
+               -@$(INSTALL) -d Include
+-              $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++              $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+               -touch Parser/pgen.stamp
+ $(PGEN):      $(PGENOBJS)
+@@ -708,7 +710,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho
+ TESTOPTS=     -l $(EXTRATESTOPTS)
+ TESTPROG=     $(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=   $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
++TESTPYTHON=   $(RUNSHARED) $(HOSTPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
+ test:         all platform
+               -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+               -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+@@ -1062,7 +1064,7 @@ libainstall:     all python-config
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall: sharedmods
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++      $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
+               --prefix=$(prefix) \
+               --install-scripts=$(BINDIR) \
+               --install-platlib=$(DESTSHARED) \
+@@ -1100,7 +1102,7 @@ frameworkinstallstructure:       $(LDLIBRARY)
+               fi; \
+       done
+       $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
+-      sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
++      sed 's/%VERSION%/'"`$(RUNSHARED) $(HOSTPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
+       $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
+       $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
+       $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
+@@ -1135,7 +1137,7 @@ frameworkinstallextras:
+ # This installs a few of the useful scripts in Tools/scripts
+ scriptsinstall:
+       SRCDIR=$(srcdir) $(RUNSHARED) \
+-      ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
++      $(HOSTPYTHON) $(srcdir)/Tools/scripts/setup.py install \
+       --prefix=$(prefix) \
+       --install-scripts=$(BINDIR) \
+       --root=$(DESTDIR)/
+@@ -1157,7 +1159,7 @@ config.status:   $(srcdir)/configure
+ # Run reindent on the library
+ reindent:
+-      ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
++      $(HOSTPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
+ # Rerun configure with the same options as it was run last time,
+ # provided the config.status script exists
+@@ -1260,7 +1262,7 @@ funny:
+ # Perform some verification checks on any modified files.
+ patchcheck:
+-      $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
++      $(RUNSHARED) $(HOSTPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
+ # Dependencies
diff --git a/lang/python/patches/020-dont-compile-python-files.patch b/lang/python/patches/020-dont-compile-python-files.patch
new file mode 100644 (file)
index 0000000..57bd51d
--- /dev/null
@@ -0,0 +1,33 @@
+---
+ Makefile.pre.in |   16 ----------------
+ 1 file changed, 16 deletions(-)
+
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -940,26 +940,6 @@ libinstall:       build_all $(srcdir)/Lib/$(PL
+               $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+                       $(DESTDIR)$(LIBDEST)/distutils/tests ; \
+       fi
+-      PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+-              -d $(LIBDEST) -f \
+-              -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+-              $(DESTDIR)$(LIBDEST)
+-      PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+-              -d $(LIBDEST) -f \
+-              -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
+-              $(DESTDIR)$(LIBDEST)
+-      -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+-              -d $(LIBDEST)/site-packages -f \
+-              -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+-      -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+-              -d $(LIBDEST)/site-packages -f \
+-              -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+-      -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):
diff --git a/lang/python/patches/030-fixup-include-dirs.patch b/lang/python/patches/030-fixup-include-dirs.patch
new file mode 100644 (file)
index 0000000..6cc6bba
--- /dev/null
@@ -0,0 +1,50 @@
+---
+ setup.py |   15 ++-------------
+ 1 file changed, 2 insertions(+), 13 deletions(-)
+
+--- a/setup.py
++++ b/setup.py
+@@ -368,11 +368,6 @@ class PyBuildExt(build_ext):
+             os.unlink(tmpfile)
+     def detect_modules(self):
+-        # Ensure that /usr/local is always used
+-        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+-        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+-        self.add_multiarch_paths()
+-
+         # Add paths specified in the environment variables LDFLAGS and
+         # CPPFLAGS for header and library files.
+         # We must get the values from the Makefile and not the environment
+@@ -407,17 +402,6 @@ class PyBuildExt(build_ext):
+                     for directory in reversed(options.dirs):
+                         add_dir_to_list(dir_list, directory)
+-        if os.path.normpath(sys.prefix) != '/usr' \
+-                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
+-            # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
+-            # (PYTHONFRAMEWORK is set) to avoid # linking problems when
+-            # building a framework with different architectures than
+-            # the one that is currently installed (issue #7473)
+-            add_dir_to_list(self.compiler.library_dirs,
+-                            sysconfig.get_config_var("LIBDIR"))
+-            add_dir_to_list(self.compiler.include_dirs,
+-                            sysconfig.get_config_var("INCLUDEDIR"))
+-
+         try:
+             have_unicode = unicode
+         except NameError:
+@@ -426,11 +410,8 @@ class PyBuildExt(build_ext):
+         # lib_dirs and inc_dirs are used to search for files;
+         # if a file is found in one of those directories, it can
+         # be assumed that no additional -I,-L directives are needed.
+-        lib_dirs = self.compiler.library_dirs + [
+-            '/lib64', '/usr/lib64',
+-            '/lib', '/usr/lib',
+-            ]
+-        inc_dirs = self.compiler.include_dirs + ['/usr/include']
++        lib_dirs = self.compiler.library_dirs
++        inc_dirs = self.compiler.include_dirs
+         exts = []
+         missing = []
diff --git a/lang/python/patches/040-dont-import-cross-compiled-modules.patch b/lang/python/patches/040-dont-import-cross-compiled-modules.patch
new file mode 100644 (file)
index 0000000..1793569
--- /dev/null
@@ -0,0 +1,43 @@
+---
+ setup.py |   30 ------------------------------
+ 1 file changed, 30 deletions(-)
+
+--- a/setup.py
++++ b/setup.py
+@@ -307,36 +307,6 @@ class PyBuildExt(build_ext):
+         ext_filename = os.path.join(
+             self.build_lib,
+             self.get_ext_filename(self.get_ext_fullname(ext.name)))
+-        try:
+-            imp.load_dynamic(ext.name, ext_filename)
+-        except ImportError, why:
+-            self.failed.append(ext.name)
+-            self.announce('*** WARNING: renaming "%s" since importing it'
+-                          ' failed: %s' % (ext.name, why), level=3)
+-            assert not self.inplace
+-            basename, tail = os.path.splitext(ext_filename)
+-            newname = basename + "_failed" + tail
+-            if os.path.exists(newname):
+-                os.remove(newname)
+-            os.rename(ext_filename, newname)
+-
+-            # XXX -- This relies on a Vile HACK in
+-            # distutils.command.build_ext.build_extension().  The
+-            # _built_objects attribute is stored there strictly for
+-            # use here.
+-            # If there is a failure, _built_objects may not be there,
+-            # so catch the AttributeError and move on.
+-            try:
+-                for filename in self._built_objects:
+-                    os.remove(filename)
+-            except AttributeError:
+-                self.announce('unable to remove files (ignored)')
+-        except:
+-            exc_type, why, tb = sys.exc_info()
+-            self.announce('*** WARNING: importing extension "%s" '
+-                          'failed with %s: %s' % (ext.name, exc_type, why),
+-                          level=3)
+-            self.failed.append(ext.name)
+     def get_platform(self):
+         # Get value of sys.platform
diff --git a/lang/python/patches/070-dont-clean-ipkg-install.patch b/lang/python/patches/070-dont-clean-ipkg-install.patch
new file mode 100644 (file)
index 0000000..0796c19
--- /dev/null
@@ -0,0 +1,23 @@
+---
+ Makefile.pre.in |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1169,12 +1169,12 @@ TAGS::
+ # Sanitation targets -- clean leaves libraries, executables and tags
+ # files, which clobber removes as well
+ pycremoval:
+-      find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
++      find $(srcdir) ! -path './ipkg-install/*' -name '*.py[co]' -exec rm -f {} ';'
+ clean: pycremoval
+-      find . -name '*.[oa]' -exec rm -f {} ';'
+-      find . -name '*.s[ol]' -exec rm -f {} ';'
+-      find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
++      find . ! -path './ipkg-install/*' -name '*.[oa]' -exec rm -f {} ';'
++      find . ! -path './ipkg-install/*' -name '*.s[ol]' -exec rm -f {} ';'
++      find . ! -path './ipkg-install/*' -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
+       find build -name 'fficonfig.h' -exec rm -f {} ';' || true
+       find build -name 'fficonfig.py' -exec rm -f {} ';' || true
+       -rm -f Lib/lib2to3/*Grammar*.pickle
diff --git a/lang/python/patches/080-distutils-dont_adjust_files.patch b/lang/python/patches/080-distutils-dont_adjust_files.patch
new file mode 100644 (file)
index 0000000..97d62fb
--- /dev/null
@@ -0,0 +1,63 @@
+---
+ Lib/distutils/command/build_scripts.py |   43 +++------------------------------
+ 1 file changed, 4 insertions(+), 39 deletions(-)
+
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -51,10 +51,7 @@ class build_scripts (Command):
+     def copy_scripts (self):
+-        """Copy each script listed in 'self.scripts'; if it's marked as a
+-        Python script in the Unix way (first line matches 'first_line_re',
+-        ie. starts with "\#!" and contains "python"), then adjust the first
+-        line to refer to the current Python interpreter as we copy.
++        """Copy each script listed in 'self.scripts'
+         """
+         _sysconfig = __import__('sysconfig')
+         self.mkpath(self.build_dir)
+@@ -78,41 +75,9 @@ class build_scripts (Command):
+                 if not self.dry_run:
+                     raise
+                 f = None
+-            else:
+-                first_line = f.readline()
+-                if not first_line:
+-                    self.warn("%s is an empty file (skipping)" % script)
+-                    continue
+-
+-                match = first_line_re.match(first_line)
+-                if match:
+-                    adjust = 1
+-                    post_interp = match.group(1) or ''
+-
+-            if adjust:
+-                log.info("copying and adjusting %s -> %s", script,
+-                         self.build_dir)
+-                if not self.dry_run:
+-                    outf = open(outfile, "w")
+-                    if not _sysconfig.is_python_build():
+-                        outf.write("#!%s%s\n" %
+-                                   (self.executable,
+-                                    post_interp))
+-                    else:
+-                        outf.write("#!%s%s\n" %
+-                                   (os.path.join(
+-                            _sysconfig.get_config_var("BINDIR"),
+-                           "python%s%s" % (_sysconfig.get_config_var("VERSION"),
+-                                           _sysconfig.get_config_var("EXE"))),
+-                                    post_interp))
+-                    outf.writelines(f.readlines())
+-                    outf.close()
+-                if f:
+-                    f.close()
+-            else:
+-                if f:
+-                    f.close()
+-                self.copy_file(script, outfile)
++            if f:
++                f.close()
++            self.copy_file(script, outfile)
+         if os.name == 'posix':
+             for file in outfiles:
diff --git a/lang/python/patches/110-enable-zlib.patch b/lang/python/patches/110-enable-zlib.patch
new file mode 100644 (file)
index 0000000..cdc7073
--- /dev/null
@@ -0,0 +1,15 @@
+---
+ Modules/Setup.dist |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -460,7 +460,7 @@ GLHACK=-Dclear=__GLclear
+ # Andrew Kuchling's zlib module.
+ # This require zlib 1.1.3 (or later).
+ # See http://www.gzip.org/zlib/
+-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
++zlib zlibmodule.c -lz
+ # Interface to the Expat XML parser
+ #
diff --git a/lang/python/patches/120-force-internal-modules-for-hashlib.patch b/lang/python/patches/120-force-internal-modules-for-hashlib.patch
new file mode 100644 (file)
index 0000000..ad10a44
--- /dev/null
@@ -0,0 +1,25 @@
+---
+ setup.py |   10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/setup.py
++++ b/setup.py
+@@ -704,8 +704,7 @@ class PyBuildExt(build_ext):
+         min_openssl_ver = 0x00907000
+         have_any_openssl = ssl_incs is not None and ssl_libs is not None
+-        have_usable_openssl = (have_any_openssl and
+-                               openssl_ver >= min_openssl_ver)
++        have_usable_openssl = False
+         if have_any_openssl:
+             if have_usable_openssl:
+@@ -730,7 +729,7 @@ class PyBuildExt(build_ext):
+                             depends = ['md5.h']) )
+         min_sha2_openssl_ver = 0x00908000
+-        if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver:
++        if True:
+             # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
+             exts.append( Extension('_sha256', ['sha256module.c']) )
+             exts.append( Extension('_sha512', ['sha512module.c']) )
diff --git a/lang/python/patches/130-readline-setup.patch b/lang/python/patches/130-readline-setup.patch
new file mode 100644 (file)
index 0000000..c19dbb2
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/setup.py
++++ b/setup.py
+@@ -573,32 +573,7 @@ class PyBuildExt(build_ext):
+         # readline
+         do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
+         readline_termcap_library = ""
+-        curses_library = ""
+-        # Determine if readline is already linked against curses or tinfo.
+-        if do_readline and find_executable('ldd'):
+-            fp = os.popen("ldd %s" % do_readline)
+-            ldd_output = fp.readlines()
+-            ret = fp.close()
+-            if ret is None or ret >> 8 == 0:
+-                for ln in ldd_output:
+-                    if 'curses' in ln:
+-                        readline_termcap_library = re.sub(
+-                            r'.*lib(n?cursesw?)\.so.*', r'\1', ln
+-                        ).rstrip()
+-                        break
+-                    if 'tinfo' in ln: # termcap interface split out from ncurses
+-                        readline_termcap_library = 'tinfo'
+-                        break
+-        # Issue 7384: If readline is already linked against curses,
+-        # use the same library for the readline and curses modules.
+-        if 'curses' in readline_termcap_library:
+-            curses_library = readline_termcap_library
+-        elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
+-            curses_library = 'ncursesw'
+-        elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
+-            curses_library = 'ncurses'
+-        elif self.compiler.find_library_file(lib_dirs, 'curses'):
+-            curses_library = 'curses'
++        curses_library = "ncurses"
+         if platform == 'darwin':
+             os_release = int(os.uname()[2].split('.')[0])
diff --git a/lang/python/patches/140-verbose-sharedmods.patch b/lang/python/patches/140-verbose-sharedmods.patch
new file mode 100644 (file)
index 0000000..a761c34
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -410,7 +410,7 @@ platform: $(BUILDPYTHON)
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+       @case $$MAKEFLAGS in \
+-      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+       *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+       esac
diff --git a/lang/python/patches/150-no-sqlite-rpath.patch b/lang/python/patches/150-no-sqlite-rpath.patch
new file mode 100644 (file)
index 0000000..4f0ec41
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/setup.py
++++ b/setup.py
+@@ -1021,7 +1021,6 @@ class PyBuildExt(build_ext):
+                                   include_dirs=["Modules/_sqlite",
+                                                 sqlite_incdir],
+                                   library_dirs=sqlite_libdir,
+-                                  runtime_library_dirs=sqlite_libdir,
+                                   extra_link_args=sqlite_extra_link_args,
+                                   libraries=["sqlite3",]))
+         else:
diff --git a/lang/python2-chardet/Makefile b/lang/python2-chardet/Makefile
new file mode 100644 (file)
index 0000000..4e8bcb3
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2008-2010 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:=python2-chardet
+PKG_VERSION:=2.0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://chardet.feedparser.org/download/
+PKG_MD5SUM:=ec771971bab5dd1943a10362ebd2fd4c
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python2-chardet
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Universal Encoding Detector
+  URL:=http://chardet.feedparser.org/
+  DEPENDS:=+python
+endef
+
+define Package/python2-chardet/description
+  Character encoding auto-detection in Python.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/python2-chardet/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python2-chardet))
diff --git a/lang/pyusb/Makefile b/lang/pyusb/Makefile
new file mode 100644 (file)
index 0000000..3a879ff
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2010 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:=pyusb
+PKG_VERSION:=0.4.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/pyusb
+PKG_MD5SUM:=5667a00af1ac0d5062103b4512e227f8
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyusb
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=pyusb
+  URL:=http://pyusb.sourceforge.net
+  DEPENDS:=+python-mini +libusb-compat
+endef
+
+define Package/pyusb/description
+  usb port python bindings
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/pyusb/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,pyusb))
diff --git a/lang/pyxdg/Makefile b/lang/pyxdg/Makefile
new file mode 100644 (file)
index 0000000..1eb255c
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2008 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:=pyxdg
+PKG_VERSION:=0.18
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://people.freedesktop.org/~lanius/
+PKG_MD5SUM:=076b57722e91dab8ab83028c6ef9dcea
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyxdg
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=pyxdg
+  URL:=http://freedesktop.org/wiki/Software/pyxdg
+  DEPENDS:=+python
+endef
+
+define Package/pyxdg/description
+  A Python module to deal with freedesktop.org specifications
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/pyxdg/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,pyxdg))
diff --git a/lang/pyyaml/Makefile b/lang/pyyaml/Makefile
new file mode 100644 (file)
index 0000000..a2759e8
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2008 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:=PyYAML
+PKG_VERSION:=3.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pyyaml.org/download/pyyaml/
+PKG_MD5SUM:=f50e08ef0fe55178479d3a618efe21db
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pyyaml
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=pyyaml
+  URL:=http://pyyaml.org
+  DEPENDS:=+python +libyaml
+endef
+
+define Package/pyyaml/description
+  yaml python bindings
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,--with-libyaml install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/pyyaml/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,pyyaml))
diff --git a/lang/ruby/Makefile b/lang/ruby/Makefile
new file mode 100644 (file)
index 0000000..9952504
--- /dev/null
@@ -0,0 +1,483 @@
+#
+# Copyright (C) 2006-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+#
+# To Do:
+#  - split up encodings
+#  - allow selection of either native or pure version of a library where supported
+#  +-> some native libraries are probably only supported if ruby-dl is enabled
+# anything else?
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ruby
+PKG_VERSION:=1.9.3-p545
+PKG_RELEASE:=1
+
+PKG_LIBVER:=1.9
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.ruby-lang.org/pub/ruby/$(PKG_LIBVER)/
+PKG_MD5SUM:=4743c1dc48491070bae8fc8b423bc1a7
+
+PKG_BUILD_DEPENDS:=ruby/host
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/ruby/Default
+  SUBMENU:=Ruby
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Ruby scripting language
+  URL:=http://www.ruby-lang.org/
+endef
+
+define Package/ruby/Default/description
+ Ruby is the interpreted scripting language for quick and  easy
+ object-oriented programming.  It has many features to process text files
+ and to do system management tasks (as in perl).  It is simple,
+ straight-forward, and extensible.
+endef
+
+define Package/ruby
+$(call Package/ruby/Default)
+  TITLE+= (interpreter)
+  DEPENDS:=+libruby
+endef
+
+define Package/ruby/description
+$(call Package/ruby/Default/description)
+endef
+
+define Package/libruby
+$(call Package/ruby/Default)
+  SUBMENU:=
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (shared library)
+  DEPENDS+= +libpthread +librt
+endef
+
+# Ongoing work to break up ruby's standard library into coherent pieces
+# with minimal dependencies between them
+
+define Package/ruby-core
+$(call Package/ruby/Default)
+  TITLE:=Ruby standard libraries
+  DEPENDS:=ruby +libdb47 +libffi
+endef
+
+define Package/ruby-cgi
+$(call Package/ruby/Default)
+  TITLE:=Ruby CGI support toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-dl
+$(call Package/ruby/Default)
+  TITLE+= (dynamic linker support) (adds 5MB+)
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-enc
+$(call Package/ruby/Default)
+  TITLE+= (character re-coding library) (adds 2MB+)
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-erb
+$(call Package/ruby/Default)
+  TITLE+= (embedded interpreter)
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-gdbm
+$(call Package/ruby/Default)
+  TITLE:=Ruby support for gdbm
+  DEPENDS:=ruby +libgdbm
+endef
+
+define Package/ruby-gems
+$(call Package/ruby/Default)
+  TITLE:=Ruby gems packet management
+  DEPENDS:=ruby +ruby-yaml +ruby-zlib +ruby-openssl +ruby-webrick +ruby-erb
+endef
+
+define Package/ruby-irb
+$(call Package/ruby/Default)
+  TITLE+= (interactive shell)
+  DEPENDS:=ruby +ruby-core
+endef
+
+define Package/ruby-json
+$(call Package/ruby/Default)
+  TITLE:=Ruby support for JSON
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-ncurses
+$(call Package/ruby/Default)
+  TITLE:=Ruby support for ncurses
+  DEPENDS:=ruby +libncurses +libncursesw
+endef
+
+define Package/ruby-nkf
+$(call Package/ruby/Default)
+  TITLE:=Ruby Network Kanji Filter
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-openssl
+$(call Package/ruby/Default)
+  TITLE:=Ruby support for openssl
+  DEPENDS:=ruby +libopenssl
+endef
+
+define Package/ruby-rdoc
+$(call Package/ruby/Default)
+  TITLE+= (documentation generator)
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-rake
+$(call Package/ruby/Default)
+  TITLE+=Ruby Rake (make replacement)
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-readline
+$(call Package/ruby/Default)
+  TITLE:=Ruby support for readline
+  DEPENDS:=ruby +libncurses +libreadline
+endef
+
+define Package/ruby-rexml
+$(call Package/ruby/Default)
+  TITLE:=Ruby XML toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-rss
+$(call Package/ruby/Default)
+  TITLE:=Ruby RSS toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-unit
+$(call Package/ruby/Default)
+  TITLE:=Ruby unit testing toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-webrick
+$(call Package/ruby/Default)
+  TITLE:=Ruby Web server toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-xmlrpc
+$(call Package/ruby/Default)
+  TITLE:=Ruby XML-RPC toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-yaml
+$(call Package/ruby/Default)
+  TITLE:=Ruby YAML toolkit
+  DEPENDS:=ruby
+endef
+
+define Package/ruby-zlib
+$(call Package/ruby/Default)
+  TITLE:=Ruby support for zlib
+  DEPENDS:=ruby +zlib
+endef
+
+HOST_CONFIGURE_ARGS += \
+       --disable-install-doc \
+       --disable-install-rdoc \
+       --disable-install-capi
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-rpath \
+       --enable-ipv6 \
+       --with-ruby-version=minor \
+       --with-iconv-dir=$(ICONV_PREFIX) \
+
+TARGET_LDFLAGS += -L$(PKG_BUILD_DIR)
+
+MAKE_FLAGS += \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       SHELL="/bin/bash"
+
+define Package/ruby/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ruby $(1)/usr/bin/
+endef
+
+define Package/libruby/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libruby.so.* $(1)/usr/lib/
+endef
+
+define Package/ruby-core/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby $(1)/usr/lib/
+       rm -rf  \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/curses.so \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/gdbm.so \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/kconv.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/nkf.so \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/digest \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/digest.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/digest \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/digest.so \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/openssl \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/openssl.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/openssl.so \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/drb/ssl.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/net/https.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/webrick/ssl.rb \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/dl.so \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/enc \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/readline.so \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb/completion.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb/ext/save-history.rb \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/zlib.so \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/erb.rb \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/json.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/json \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/json \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rdoc \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rake.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rake \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rubygems.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rubygems \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/cgi.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/cgi \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rexml \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rss \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/rss.rb \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/test \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/webrick \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/webrick.rb \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/xmlrpc \
+               \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/yaml \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/yaml.rb \
+               $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/syck.so \
+
+       find $(1) -name '*.h' | xargs rm -f
+endef
+
+define Package/ruby-cgi/install
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/cgi $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/cgi.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-dl/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/*/dl.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-enc/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/*/enc \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-erb/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/erb $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/erb.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-gdbm/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/*/gdbm.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-gems/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/gem $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rubygems.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rubygems $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-irb/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/irb $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/irb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/irb.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-json/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/json.rb \
+               usr/lib/ruby/$(PKG_LIBVER)/json \
+               usr/lib/ruby/$(PKG_LIBVER)/*/json \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-ncurses/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/*/curses.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-nkf/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/kconv.rb \
+               usr/lib/ruby/$(PKG_LIBVER)/*/nkf.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-openssl/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/digest \
+               usr/lib/ruby/$(PKG_LIBVER)/digest.rb \
+               usr/lib/ruby/$(PKG_LIBVER)/*/digest.so \
+               usr/lib/ruby/$(PKG_LIBVER)/*/digest/*.so \
+               usr/lib/ruby/$(PKG_LIBVER)/openssl \
+               usr/lib/ruby/$(PKG_LIBVER)/openssl.rb \
+               usr/lib/ruby/$(PKG_LIBVER)/*/openssl.so \
+               usr/lib/ruby/$(PKG_LIBVER)/drb/ssl.rb \
+               usr/lib/ruby/$(PKG_LIBVER)/net/https.rb \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-rdoc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdoc $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ri $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rdoc $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-rake/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rake $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rake.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rake $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-readline/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/*/readline.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-rexml/install
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rexml $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+
+define Package/ruby-rss/install
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rss $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rss.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-unit/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/testrb $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/test $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-webrick/install
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/webrick $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/webrick.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-xmlrpc/install
+       $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/xmlrpc $(1)/usr/lib/ruby/$(PKG_LIBVER)/
+endef
+
+define Package/ruby-yaml/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/yaml \
+               usr/lib/ruby/$(PKG_LIBVER)/yaml.rb \
+               usr/lib/ruby/$(PKG_LIBVER)/*/syck.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/ruby-zlib/install
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               usr/lib/ruby/$(PKG_LIBVER)/*/zlib.so \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Build/InstallDev
+       ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+               . \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+$(eval $(call BuildPackage,ruby))
+$(eval $(call BuildPackage,libruby))
+$(eval $(call BuildPackage,ruby-core))
+$(eval $(call BuildPackage,ruby-cgi))
+$(eval $(call BuildPackage,ruby-dl))
+$(eval $(call BuildPackage,ruby-enc))
+$(eval $(call BuildPackage,ruby-erb))
+$(eval $(call BuildPackage,ruby-gdbm))
+$(eval $(call BuildPackage,ruby-gems))
+$(eval $(call BuildPackage,ruby-json))
+$(eval $(call BuildPackage,ruby-irb))
+$(eval $(call BuildPackage,ruby-ncurses))
+$(eval $(call BuildPackage,ruby-nkf))
+$(eval $(call BuildPackage,ruby-openssl))
+$(eval $(call BuildPackage,ruby-rake))
+$(eval $(call BuildPackage,ruby-rdoc))
+$(eval $(call BuildPackage,ruby-readline))
+$(eval $(call BuildPackage,ruby-rexml))
+$(eval $(call BuildPackage,ruby-rss))
+$(eval $(call BuildPackage,ruby-unit))
+$(eval $(call BuildPackage,ruby-webrick))
+$(eval $(call BuildPackage,ruby-xmlrpc))
+$(eval $(call BuildPackage,ruby-yaml))
+$(eval $(call BuildPackage,ruby-zlib))
+$(eval $(call HostBuild))
diff --git a/lang/ruby/patches/001-ignore_wide_getaddrinfo_while_crosscompiling.patch b/lang/ruby/patches/001-ignore_wide_getaddrinfo_while_crosscompiling.patch
new file mode 100644 (file)
index 0000000..4262726
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/ext/socket/extconf.rb    2013-02-14 23:20:13.581918676 -0200
++++ b/ext/socket/extconf.rb    2013-02-14 23:21:25.761918667 -0200
+@@ -254,6 +254,7 @@
+ end
+ getaddr_info_ok = (enable_config("wide-getaddrinfo") && :wide) ||
++  (CROSS_COMPILING && :cross) ||
+   (checking_for("wide getaddrinfo") {try_run(<<EOF)} && :os)
+ #{cpp_include(headers)}
+ #include <stdlib.h>
diff --git a/lang/sigscheme/Makefile b/lang/sigscheme/Makefile
new file mode 100644 (file)
index 0000000..dc1e47d
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006-2010 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:=sigscheme
+PKG_VERSION:=0.8.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://sigscheme.googlecode.com/files/
+PKG_MD5SUM:=f25b0acbb854651b375b42f17ad20f39
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sigscheme
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=SigScheme
+  URL:=http://code.google.com/p/sigscheme/
+  DEPENDS:=@!avr32
+endef
+
+define Package/sigscheme/description
+SigScheme is a R5RS Scheme interpreter for embedded use. It features small
+footprint (64KB in library form on the 'small' configuration) like SIOD and
+TinyScheme, low memory consumption (2-words per cons cell), multibyte characters
+handling (UTF-8, EUCs and Shift_JIS) and more.
+endef
+
+define Package/sigscheme/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{gcroots,sscm}.so.* $(1)/usr/lib
+
+       $(INSTALL_DIR) $(1)/usr/share/sigscheme/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/sigscheme/lib/* \
+               $(1)/usr/share/sigscheme/lib/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/sscm $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,sigscheme))
diff --git a/lang/simplejson/Makefile b/lang/simplejson/Makefile
new file mode 100644 (file)
index 0000000..f10ec97
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 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:=simplejson
+PKG_VERSION:=2.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/s/simplejson/
+PKG_MD5SUM:=070c6467462bd63306f1756b01df6d70
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/simplejson
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Simple, fast, extensible JSON encoder/decoder for Python
+  URL:=http://simplejson.readthedocs.org/
+  DEPENDS:=+python +distribute
+endef
+
+define Package/simplejson/description
+  Simple, fast, extensible JSON encoder/decoder for Python
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Package/simplejson/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,simplejson))
diff --git a/lang/sqlite3-ruby/Makefile b/lang/sqlite3-ruby/Makefile
new file mode 100644 (file)
index 0000000..c675550
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2010 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:=sqlite3-ruby
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://files.rubyforge.vm.bytemark.co.uk/sqlite-ruby/
+PKG_MD5SUM:=fe75fa99dd9a2b5a2f84ab484e7f6469
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ruby-sqlite3
+  SUBMENU:=Ruby
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Ruby interface for SQLite
+  URL:=http://www.ruby-lang.org/
+  DEPENDS:=+libruby +libsqlite3 @BROKEN
+endef
+
+RUBY:= \
+       ruby -I $(STAGING_DIR)/usr/share/ruby \
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR)/ext/sqlite3_api; \
+               $(RUBY) extconf.rb; \
+       )
+endef
+
+define Build/Compile
+       (cd $(PKG_BUILD_DIR)/ext/sqlite3_api; \
+               $(MAKE); \
+       )
+endef
+
+define Package/ruby-sqlite3/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+
+endef
+
+$(eval $(call BuildPackage,ruby-sqlite3))
diff --git a/lang/tcl/Makefile b/lang/tcl/Makefile
new file mode 100644 (file)
index 0000000..98fa165
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2006-2010 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:=tcl
+PKG_VERSION:=8.5.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION)-src.tar.gz
+PKG_SOURCE_URL:=@SF/tcl
+PKG_MD5SUM:=7f123e53b3daaaba2478d3af5a0752e3
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(PKG_VERSION)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tcl
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+libpthread
+  TITLE:=TCL Lang
+  URL:=http://www.tcl.tk
+endef
+
+define Package/tcl/description
+Tcl (Tool Command Language) is a very powerful but easy to learn dynamic
+programming language, suitable for a very wide range of uses, including web and
+desktop applications, networking, administration, testing and many more. Open
+source and business-friendly, Tcl is a mature yet evolving language that is truly
+cross platform, easily deployed and highly extensible.
+endef
+
+CONFIGURE_PATH := unix
+
+CONFIGURE_VARS += \
+       tcl_cv_strtod_unbroken=ok
+
+CONFIGURE_ARGS += \
+       --enable-threads
+
+MAKE_PATH := unix
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtcl*.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/tcl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so $(1)/usr/lib
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,tcl))
diff --git a/lang/tcl/patches/100-disable_tzdata_and_msgs_install.patch b/lang/tcl/patches/100-disable_tzdata_and_msgs_install.patch
new file mode 100644 (file)
index 0000000..1db8f07
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/unix/Makefile.in
++++ b/unix/Makefile.in
+@@ -817,15 +817,15 @@ install-tzdata: tclsh
+       @echo "Installing time zone data"
+       @@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
+       TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
+-      ./tclsh $(TOOL_DIR)/installData.tcl \
+-          $(TOP_DIR)/library/tzdata "$(SCRIPT_INSTALL_DIR)"/tzdata
++      #./tclsh $(TOOL_DIR)/installData.tcl \
++      #    $(TOP_DIR)/library/tzdata "$(SCRIPT_INSTALL_DIR)"/tzdata
+ install-msgs: tclsh
+       @echo "Installing message catalogs"
+       @@LD_LIBRARY_PATH_VAR@="`pwd`:$${@LD_LIBRARY_PATH_VAR@}"; export @LD_LIBRARY_PATH_VAR@; \
+       TCL_LIBRARY="${TCL_BUILDTIME_LIBRARY}"; export TCL_LIBRARY; \
+-      ./tclsh $(TOOL_DIR)/installData.tcl \
+-          $(TOP_DIR)/library/msgs "$(SCRIPT_INSTALL_DIR)"/msgs
++      #./tclsh $(TOOL_DIR)/installData.tcl \
++      #    $(TOP_DIR)/library/msgs "$(SCRIPT_INSTALL_DIR)"/msgs
+ install-doc: doc
+       @for i in "$(MAN_INSTALL_DIR)" "$(MAN1_INSTALL_DIR)" "$(MAN3_INSTALL_DIR)" "$(MANN_INSTALL_DIR)" ; \
diff --git a/lang/tcl/patches/200-fix_mips_build.patch b/lang/tcl/patches/200-fix_mips_build.patch
new file mode 100644 (file)
index 0000000..48485ca
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/generic/tclStrToD.c
++++ b/generic/tclStrToD.c
+@@ -73,7 +73,7 @@ typedef unsigned int fpu_control_t __att
+  * MIPS floating-point units need special settings in control registers
+  * to use gradual underflow as we expect.
+  */
+-#if defined(__mips)
++#if defined(__sgi) && defined(_COMPILER_VERSION)
+ #include <sys/fpu.h>
+ #endif
+ /*
+@@ -2166,7 +2166,7 @@ TclInitDoubleConversion(void)
+     } bitwhack;
+ #endif
+-#if defined(__mips)
++#if defined(__sgi) && defined(_COMPILER_VERSION)
+     union fpc_csr mipsCR;
+     mipsCR.fc_word = get_fpc_csr();
diff --git a/lang/telepathy-python/Makefile b/lang/telepathy-python/Makefile
new file mode 100644 (file)
index 0000000..436ea67
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2008-2009 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:=telepathy-python
+PKG_VERSION:=0.15.3
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://telepathy.freedesktop.org/releases/telepathy-python/
+PKG_MD5SUM:=594a66a70764052e30df9428b5be52b2
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/telepathy-python
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=telepathy-python
+  URL:=http://telepathy.freedesktop.org
+  DEPENDS:=+python-mini +dbus-python
+endef
+
+define Package/telepathy-python/description
+  telepathy python bindings
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/telepathy-python/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call RequireCommand,xsltproc, \
+       $(PKG_NAME) requires xsltproc installed on the host-system. \
+))
+
+$(eval $(call BuildPackage,telepathy-python))
+
diff --git a/lang/twisted/Makefile b/lang/twisted/Makefile
new file mode 100644 (file)
index 0000000..fd2d9b2
--- /dev/null
@@ -0,0 +1,248 @@
+#
+# 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:=twisted
+PKG_VERSION:=2.5.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=Twisted-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://tmrc.mit.edu/mirror/twisted/Twisted/2.5
+PKG_MD5SUM:=56df2ae66db57932515a491c03bf514f
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Twisted-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python USE_UCLIBC:librpc
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/twisted/default
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  URL:=http://twistedmatrix.com/
+  DEPENDS:=+python-mini
+endef
+
+define Package/twisted/default/description
+ Twisted is a networking engine written in Python, supporting numerous
+ protocols. It contains a web server, numerous chat clients, chat servers,
+ mail servers, and more.
+endef
+
+define Package/twisted
+$(call Package/twisted/default)
+  TITLE:=Python networking engine
+  DEPENDS+= +zope-interface
+endef
+
+define Package/twisted-conch
+$(call Package/twisted/default)
+  TITLE:=Twisted - Conch
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-lore
+$(call Package/twisted/default)
+  TITLE:=Twisted - Lore
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-mail
+$(call Package/twisted/default)
+  TITLE:=Twisted - Mail
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-names
+$(call Package/twisted/default)
+  TITLE:=Twisted - Names
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-news
+$(call Package/twisted/default)
+  TITLE:=Twisted - News
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-runner
+$(call Package/twisted/default)
+  TITLE:=Twisted - Runner
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-web
+$(call Package/twisted/default)
+  TITLE:=Twisted - Web
+  DEPENDS+= twisted
+endef
+
+define Package/twisted-words
+$(call Package/twisted/default)
+  TITLE:=Twisted - Words
+  DEPENDS+= twisted
+endef
+
+define Package/zope-interface
+$(call Package/twisted/default)
+  TITLE:=Zope interface
+endef
+
+TWISTED_SUPPROJECTS:=core
+
+ZOPE_IF_VER=3.3.0
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-conch),)
+  TWISTED_SUBPROJECTS+=conch
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-lore),)
+  TWISTED_SUBPROJECTS+=lore
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-mail),)
+  TWISTED_SUBPROJECTS+=mail
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-names),)
+  TWISTED_SUBPROJECTS+=names
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-news),)
+  TWISTED_SUBPROJECTS+=news
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-runner),)
+  TWISTED_SUBPROJECTS+=runner
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-web),)
+  TWISTED_SUBPROJECTS+=web
+endif
+ifneq ($(SDK)$(CONFIG_PACKAGE_twisted-words),)
+  TWISTED_SUBPROJECTS+=words
+endif
+
+
+define Build/Configure
+endef
+
+define PyPackage/twisted/filespec
++|/usr/bin/mktap
++|/usr/bin/twistd
++|$(PYTHON_PKG_DIR)/twisted/application
++|$(PYTHON_PKG_DIR)/twisted/copyright.py
++|$(PYTHON_PKG_DIR)/twisted/cred
++|$(PYTHON_PKG_DIR)/twisted/enterprise
++|$(PYTHON_PKG_DIR)/twisted/im.py
++|$(PYTHON_PKG_DIR)/twisted/__init__.py
++|$(PYTHON_PKG_DIR)/twisted/internet
++|$(PYTHON_PKG_DIR)/twisted/manhole
++|$(PYTHON_PKG_DIR)/twisted/persisted
++|$(PYTHON_PKG_DIR)/twisted/plugin.py
++|$(PYTHON_PKG_DIR)/twisted/protocols
++|$(PYTHON_PKG_DIR)/twisted/python
++|$(PYTHON_PKG_DIR)/twisted/scripts
++|$(PYTHON_PKG_DIR)/twisted/spread
++|$(PYTHON_PKG_DIR)/twisted/tap
++|$(PYTHON_PKG_DIR)/twisted/trial
+-|$(PYTHON_PKG_DIR)/twisted/trial/test
++|$(PYTHON_PKG_DIR)/twisted/_version.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/dropin.cache
++|$(PYTHON_PKG_DIR)/twisted/plugins/__init__.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/notestplugin.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/testplugin.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_ftp.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_inet.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_manhole.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_portforward.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_reactors.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_socks.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_telnet.py
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_trial.py
+endef
+
+define PyPackage/twisted-conch/filespec
++|$(PYTHON_PKG_DIR)/twisted/conch
+-|$(PYTHON_PKG_DIR)/twisted/conch/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_conch.py
+endef
+
+define PyPackage/twisted-lore/filespec
++|$(PYTHON_PKG_DIR)/twisted/lore
+-|$(PYTHON_PKG_DIR)/twisted/lore/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_lore.py
+endef
+
+define PyPackage/twisted-mail/filespec
++|$(PYTHON_PKG_DIR)/twisted/mail
+-|$(PYTHON_PKG_DIR)/twisted/mail/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_mail.py
+endef
+
+define PyPackage/twisted-names/filespec
++|$(PYTHON_PKG_DIR)/twisted/names
+-|$(PYTHON_PKG_DIR)/twisted/names/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_names.py
+endef
+
+define PyPackage/twisted-news/filespec
++|$(PYTHON_PKG_DIR)/twisted/news
+-|$(PYTHON_PKG_DIR)/twisted/news/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_news.py
+endef
+
+define PyPackage/twisted-runner/filespec
++|$(PYTHON_PKG_DIR)/twisted/runner
+endef
+
+define PyPackage/twisted-web/filespec
++|$(PYTHON_PKG_DIR)/twisted/web
+-|$(PYTHON_PKG_DIR)/twisted/web/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_web.py
+endef
+
+define PyPackage/twisted-words/filespec
++|$(PYTHON_PKG_DIR)/twisted/words
+-|$(PYTHON_PKG_DIR)/twisted/words/test
++|$(PYTHON_PKG_DIR)/twisted/plugins/twisted_words.py
+endef
+
+define PyPackage/zope-interface/filespec
++|$(PYTHON_PKG_DIR)/zope
+-|$(PYTHON_PKG_DIR)/zope/interface/tests
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" --no-compile, \
+               TWISTED_SUBPROJECTS="$(TWISTED_SUBPROJECTS)" \
+       )
+       $(call Build/Compile/PyMod,zope.interface-$(ZOPE_IF_VER), \
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" --no-compile, \
+       )
+       $(SED) 's,#!$(PYTHON),#!/usr/bin/python,' $(PKG_INSTALL_DIR)/usr/bin/*
+endef
+
+$(eval $(call PyPackage,twisted))
+$(eval $(call PyPackage,twisted-conch))
+$(eval $(call PyPackage,twisted-lore))
+$(eval $(call PyPackage,twisted-mail))
+$(eval $(call PyPackage,twisted-names))
+$(eval $(call PyPackage,twisted-news))
+$(eval $(call PyPackage,twisted-runner))
+$(eval $(call PyPackage,twisted-web))
+$(eval $(call PyPackage,twisted-words))
+$(eval $(call PyPackage,zope-interface))
+
+$(eval $(call BuildPackage,twisted))
+$(eval $(call BuildPackage,twisted-conch))
+$(eval $(call BuildPackage,twisted-lore))
+$(eval $(call BuildPackage,twisted-mail))
+$(eval $(call BuildPackage,twisted-names))
+$(eval $(call BuildPackage,twisted-news))
+$(eval $(call BuildPackage,twisted-runner))
+$(eval $(call BuildPackage,twisted-web))
+$(eval $(call BuildPackage,twisted-words))
+$(eval $(call BuildPackage,zope-interface))
diff --git a/lang/twisted/patches/000-select_submodules.patch b/lang/twisted/patches/000-select_submodules.patch
new file mode 100644 (file)
index 0000000..d36e737
--- /dev/null
@@ -0,0 +1,25 @@
+diff -ruN Twisted-2.5.0/setup.py Twisted-2.5.0.new/setup.py
+--- Twisted-2.5.0/setup.py     2007-01-08 16:30:05.000000000 -0600
++++ Twisted-2.5.0.new/setup.py 2007-05-10 13:42:28.361934000 -0500
+@@ -16,9 +16,19 @@
+ """
+ import sys, os, glob
++#    sumoSubprojects = ['core', 'conch', 'lore', 'mail', 'names',
++#                   'runner', 'web', 'words', 'news']
++
++sp = os.getenv("TWISTED_SUBPROJECTS", None)
++if sp == None:
++    sumoSubprojects = ['core']
++else:
++    sumoSubprojects = sp.split()
++
++## make sure core is in sumoSubprojects
++if 'core' not in sumoSubprojects:
++    sumoSubprojects.insert(0, 'core')
+-sumoSubprojects = ['core', 'conch', 'lore', 'mail', 'names',
+-                   'runner', 'web', 'words', 'news']
+ specialPaths = {'core': 'twisted/topfiles/setup.py'}
diff --git a/lang/twisted/patches/001-dont_use_zope.patch b/lang/twisted/patches/001-dont_use_zope.patch
new file mode 100644 (file)
index 0000000..5f42bd0
--- /dev/null
@@ -0,0 +1,162 @@
+--- Twisted-2.5.0/TwistedCore-2.5.0/setup.py   2006-12-22 23:02:47.000000000 -0600
++++ Twisted-2.5.0.new/TwistedCore-2.5.0/setup.py       2007-05-14 16:13:36.095282000 -0500
+@@ -16,9 +16,8 @@
+ from distutils.core import Extension
+ if os.path.exists('twisted'):
+-    sys.path.insert(0, '.') # eek! need this to import twisted. sorry.
+-from twisted import copyright
+-from twisted.python import dist, util
++    sys.path.insert(0, 'twisted/python') # eek! need this to import twisted. sorry.
++import dist
+ def detectExtensions(builder):
+     """
+@@ -72,7 +71,7 @@
+ setup_args = dict(
+     # metadata
+     name="Twisted",
+-    version=copyright.version,
++    version="2.5.0",
+     description="An asynchronous networking framework written in Python",
+     author="Twisted Matrix Laboratories",
+     author_email="twisted-python@twistedmatrix.com",
+--- Twisted-2.5.0/TwistedWords-0.5.0/setup.py  2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedWords-0.5.0/setup.py      2007-05-14 16:24:39.860764750 -0500
+@@ -1,7 +1,8 @@
+ import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
+ try:
+-    from twisted.python import dist
++    import dist
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedCore-2.5.0/twisted/python/dist.py     2006-10-01 14:16:04.000000000 -0500
++++ Twisted-2.5.0.new//TwistedCore-2.5.0/twisted/python/dist.py        2007-05-14 16:50:07.952264500 -0500
+@@ -85,12 +85,25 @@
+     "2.0.0".
+     """
+     if proj == 'core':
+-        vfile = os.path.join(base, '_version.py')
++        return '2.5.0'
++    elif proj == 'words':
++        return '0.7.0'
++    elif proj == 'conch':
++        return '0.8.0'
++    elif proj == 'lore':
++        return '0.3.0'
++    elif proj == 'mail':
++        return '0.4.0'
++    elif proj == 'names':
++        return '0.4.0'
++    elif proj == 'news':
++        return '0.3.0'
++    elif proj == 'runner':
++        return '0.2.0'
++    elif proj == 'web':
++        return '0.7.0'
+     else:
+-        vfile = os.path.join(base, proj, '_version.py')
+-    ns = {'__name__': 'Nothing to see here'}
+-    execfile(vfile, ns)
+-    return ns['version'].base()
++        return False
+     
+ # Names that are exluded from globbing results:
+--- Twisted-2.5.0/TwistedConch-0.8.0/setup.py  2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new//TwistedConch-0.8.0/setup.py     2007-05-14 17:00:05.501609000 -0500
+@@ -1,7 +1,8 @@
+ import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
+ try:
+-    from twisted.python import dist
++    import dist
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedLore-0.3.0/setup.py   2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedLore-0.3.0/setup.py       2007-05-14 17:17:25.374597000 -0500
+@@ -1,7 +1,8 @@
+ import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
+ try:
+-    from twisted.python import dist
++    import dist
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedMail-0.4.0/setup.py   2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedMail-0.4.0/setup.py       2007-05-14 17:18:02.544920000 -0500
+@@ -1,7 +1,10 @@
+ import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
++
+ try:
+-    from twisted.python import dist
++    import dist
++
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedNames-0.4.0/setup.py  2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedNames-0.4.0/setup.py      2007-05-14 17:18:37.707117500 -0500
+@@ -1,7 +1,10 @@
+ import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
++
+ try:
+-    from twisted.python import dist
++    import dist
++
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedNews-0.3.0/setup.py   2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedNews-0.3.0/setup.py       2007-05-14 17:19:16.769558750 -0500
+@@ -1,6 +1,9 @@
++import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
+ try:
+-    from twisted.python import dist
++    import dist
++
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedRunner-0.2.0/setup.py 2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedRunner-0.2.0/setup.py     2007-05-14 17:20:54.367658250 -0500
+@@ -1,8 +1,11 @@
++import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
+ from distutils.core import Extension
+ try:
+-    from twisted.python import dist
++    import dist
++
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
+--- Twisted-2.5.0/TwistedWeb-0.7.0/setup.py    2006-05-13 14:26:09.000000000 -0500
++++ Twisted-2.5.0.new/TwistedWeb-0.7.0/setup.py        2007-05-14 17:21:21.065326750 -0500
+@@ -1,7 +1,10 @@
+ import sys
++sys.path.append('../TwistedCore-2.5.0/twisted/python')
++
+ try:
+-    from twisted.python import dist
++    import dist
++
+ except ImportError:
+     raise SystemExit("twisted.python.dist module not found.  Make sure you "
+                      "have installed the Twisted core package before "
diff --git a/lang/urbi/Makefile b/lang/urbi/Makefile
new file mode 100644 (file)
index 0000000..7614d94
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2007-2010 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:=urbi
+PKG_VERSION:=1.0RC2-l455
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-sdk-$(PKG_VERSION)-src.zip
+PKG_SOURCE_URL:=http://www.gostai.com/downloads/aibo/
+PKG_MD5SUM:=02f64abb6232ddd7b0cb6dc182e2df26
+PKG_FIXUP:=libtool-ucxx
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-sdk
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/urbi
+  SECTION:=lang
+  CATEGORY:=Languages
+  DEPENDS:=+uclibcxx +libpthread @BROKEN
+  TITLE:=URBI SDK
+  URL:=http://www.urbiforge.com
+endef
+
+define Package/urbi/description
+  Universal Real-Time Behavior Interface for robots.
+endef
+
+CONFIGURE_VARS += \
+       CXX="g++-uc" \
+       CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \
+       EXAMPLES=0 \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               WARNING_CXXFLAGS="-Wall" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/urbi
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/urbi* $(1)/usr/include/urbi/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liburbi* $(1)/usr/lib/
+endef
+
+define Package/urbi/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/gostai
+       $(CP) $(PKG_INSTALL_DIR)/usr/gostai/* $(1)/usr/gostai/
+endef
+
+$(eval $(call BuildPackage,urbi))
diff --git a/lang/urbi/patches/001-no_examples.patch b/lang/urbi/patches/001-no_examples.patch
new file mode 100644 (file)
index 0000000..0991b6e
--- /dev/null
@@ -0,0 +1,31 @@
+diff -urN urbi-sdk/src/Makefile.am urbi-sdk.new/src/Makefile.am
+--- urbi-sdk/src/Makefile.am   2007-01-31 11:37:04.000000000 +0100
++++ urbi-sdk.new/src/Makefile.am       2007-10-03 11:17:00.000000000 +0200
+@@ -1,5 +1,5 @@
+ SUBDIRS = liburbi 
+ if EXAMPLES
+-SUBDIRS += utils examples
++SUBDIRS += utils
+ endif
+diff -urN urbi-sdk/src/Makefile.in urbi-sdk.new/src/Makefile.in
+--- urbi-sdk/src/Makefile.in   2007-04-10 17:44:07.000000000 +0200
++++ urbi-sdk.new/src/Makefile.in       2007-10-03 11:14:33.000000000 +0200
+@@ -30,7 +30,7 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-@EXAMPLES_TRUE@am__append_1 = utils examples
++@EXAMPLES_TRUE@am__append_1 = utils
+ subdir = src
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -68,7 +68,7 @@
+   distclean-recursive maintainer-clean-recursive
+ ETAGS = etags
+ CTAGS = ctags
+-DIST_SUBDIRS = liburbi utils examples
++DIST_SUBDIRS = liburbi utils
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ INSTALL_HEADER = @INSTALL_HEADER@
+ ACLOCAL = @ACLOCAL@
diff --git a/lang/urbi/patches/005-fix-gcc_4_3-compile.patch b/lang/urbi/patches/005-fix-gcc_4_3-compile.patch
new file mode 100644 (file)
index 0000000..790d73e
--- /dev/null
@@ -0,0 +1,22 @@
+diff --git a/libport/semaphore.hxx b/libport/semaphore.hxx
+index bb2546d..38b0d8e 100644
+--- a/libport/semaphore.hxx
++++ b/libport/semaphore.hxx
+@@ -5,6 +5,7 @@
+ # include "exception.hh"
+ # include <sstream>
+ # include <string>
++# include <cstring>
+ namespace libport
+ {
+--- a/src/liburbi/uconversion.cc       2007-01-31 11:37:04.000000000 +0100
++++ b/src/liburbi/uconversion.cc       2010-03-29 09:43:00.000000000 +0200
+@@ -1,5 +1,7 @@
+ #include "urbi/uconversion.hh"
++#include <cstdio>
++
+ #ifndef NO_IMAGE_CONVERSION
+ # include <setjmp.h>
diff --git a/lang/vala/Makefile b/lang/vala/Makefile
new file mode 100644 (file)
index 0000000..a7152de
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2006-2012 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:=vala
+PKG_VERSION:=0.16.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNOME/vala/0.16/
+PKG_MD5SUM:=84b742e9cca4c90fde3026c3793c03c1
+
+PKG_BUILD_DEPENDS:=glib2/host vala/host
+HOST_BUILD_DEPENDS:=glib2/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+        -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/vala
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=C-sharp like language for the GObject system
+  URL:=http://live.gnome.org/Vala
+endef
+
+define Package/vala/description
+Vala is a C-sharp like language for the GObject system. This package contains
+the Vala-to-C compiler.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) \
+               $(1)/usr/share/vala-0.16/vapi \
+               $(1)/usr/lib \
+               $(1)/usr/share/pkgconfig \
+               $(1)/usr/bin
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/vala-0.16/vapi/* \
+               $(1)/usr/share/vala-0.16/vapi
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/libvala-0.16.{so*,la} \
+               $(1)/usr/lib
+
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/{vala,vala-0.16,valac,valac-0.16,vapicheck,vapicheck-0.16,vapigen,vapigen-0.16,vala-gen-introspect,vala-gen-introspect-0.16} \
+               $(1)/usr/bin
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pkgconfig/*.pc \
+               $(1)/usr/share/pkgconfig
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,vala))
diff --git a/lang/xapian-bindings/Makefile b/lang/xapian-bindings/Makefile
new file mode 100644 (file)
index 0000000..a0f96ec
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2008-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:=xapian-bindings
+PKG_VERSION:=1.2.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://oligarchy.co.uk/xapian/$(PKG_VERSION)
+PKG_MD5SUM:=4bfe673c71ac074e349ef691d7ba56d0
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+PKG_INSTALL=1
+
+define Package/python-xapian
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  TITLE:=xapian python bindings
+  URL:=http://xapian.org/
+  DEPENDS:=+python-mini +libxapian
+endef
+
+MAKE_FLAGS += \
+       pkgpylib_DATA=xapian/__init__.py
+
+CONFIGURE_ARGS+= \
+       --with-python \
+
+CONFIGURE_VARS+= \
+       PYTHON_LIB="$(PYTHON_PKG_DIR)" \
+
+define Package/python-xapian/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,python-xapian))
+
+
diff --git a/lang/yapsnmp/Makefile b/lang/yapsnmp/Makefile
new file mode 100644 (file)
index 0000000..188e8c7
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2007-2008 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:=yapsnmp
+PKG_VERSION:=0.7.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=8a3e9a5b814388d7907c639105cb2365
+
+PKG_BUILD_DEPENDS:=python
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 acinclude.m4
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-yapsnmp
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python interface to Net-SNMP
+  URL:=http://yapsnmp.sourceforge.net/
+  DEPENDS:=+python-mini +libnetsnmp
+endef
+
+define Package/python-yapsnmp/description
+ This package contains a Python SNMP module based on the net-snmp (formerly
+ known as ucd-snmp) library. It's composed of a low level interface to the
+ library, created using SWIG, and a higher level python module removing all
+ the complexity out of dealing with SNMP.
+endef
+
+define PyPackage/python-yapsnmp/filespec
++|$(PYTHON_PKG_DIR)/netsnmp.py
++|$(PYTHON_PKG_DIR)/netsnmpc.so
++|$(PYTHON_PKG_DIR)/yapsnmp.py
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --enable-site-packages-prefix="$(PYTHON_PKG_DIR)" \
+
+CONFIGURE_VARS += \
+       ac_cv_file__usr_include_net_snmp_library="yes" \
+       ac_cv_prog_SWIG="echo MISSING SWIG" \
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               INCLUDES="-I$(PYTHON_INC_DIR)" \
+               SNMPINCDIR="$(STAGING_DIR)/usr/include/net-snmp/library" \
+               all
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
+endef
+
+$(eval $(call PyPackage,python-yapsnmp))
+$(eval $(call BuildPackage,python-yapsnmp))
diff --git a/lang/yapsnmp/patches/000-compile_fix.patch b/lang/yapsnmp/patches/000-compile_fix.patch
new file mode 100644 (file)
index 0000000..6d94f05
--- /dev/null
@@ -0,0 +1,334 @@
+--- a/configure
++++ b/configure
+@@ -8757,13 +8757,13 @@ _ACEOF
+ fi
+-echo "$as_me:$LINENO: checking for init_snmp in -lsnmp" >&5
+-echo $ECHO_N "checking for init_snmp in -lsnmp... $ECHO_C" >&6
++echo "$as_me:$LINENO: checking for init_snmp in -lnetsnmp" >&5
++echo $ECHO_N "checking for init_snmp in -lnetsnmp... $ECHO_C" >&6
+ if test "${ac_cv_lib_snmp_init_snmp+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lsnmp  $LIBS"
++LIBS="-lnetsnmp  $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ /* confdefs.h.  */
+@@ -8816,7 +8816,7 @@ if test $ac_cv_lib_snmp_init_snmp = yes;
+ #define HAVE_LIBSNMP 1
+ _ACEOF
+-  LIBS="-lsnmp $LIBS"
++  LIBS="-lnetsnmp $LIBS"
+ else
+   { { echo "$as_me:$LINENO: error: Couldn't find libsnmp" >&5
+@@ -9291,7 +9291,7 @@ fi
+ done
+-for PYTHONINCPATH in python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
++for PYTHONINCPATH in python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
+ do
+  as_ac_Header=`echo "ac_cv_header_$PYTHONINCPATH/Python.h" | $as_tr_sh`
+ if eval "test \"\${$as_ac_Header+set}\" = set"; then
+--- a/src/mib.h-patch
++++ b/src/mib.h-patch
+@@ -1,36 +1,11 @@
+-*** /usr/include/net-snmp/library/mib.h       2003-11-11 08:37:02.000000000 -0800
+---- mib.h     2004-03-07 14:59:47.000000000 -0800
+-***************
+-*** 127,133 ****
+-      int             get_wild_node(const char *, oid *, size_t *);
+-      int             get_node(const char *, oid *, size_t *);
+-      oid            *snmp_parse_oid(const char *, oid *, size_t *);
+-!     struct tree    *get_symbol(oid *, size_t, struct tree *, char *);
+-      struct tree    *get_tree(const oid *, size_t, struct tree *);
+-      struct tree    *get_tree_head(void);
+-      void            set_function(struct tree *);
+---- 127,133 ----
+-      int             get_wild_node(const char *, oid *, size_t *);
+-      int             get_node(const char *, oid *, size_t *);
+-      oid            *snmp_parse_oid(const char *, oid *, size_t *);
+-! /*    struct tree    *get_symbol(oid *, size_t, struct tree *, char *);*/
+-      struct tree    *get_tree(const oid *, size_t, struct tree *);
+-      struct tree    *get_tree_head(void);
+-      void            set_function(struct tree *);
+-***************
+-*** 482,488 ****
+-      const char     *parse_octet_hint(const char *hint, const char *value,
+-                                   unsigned char **new_val, int *new_val_len);
+-  
+-!     void            clear_tree_flags(register struct tree *tp);
+-  
+-      char           *snmp_out_toggle_options(char *);
+-      void            snmp_out_toggle_options_usage(const char *, FILE *);
+---- 482,488 ----
+-      const char     *parse_octet_hint(const char *hint, const char *value,
+-                                   unsigned char **new_val, int *new_val_len);
+-  
+-!     /*    void            clear_tree_flags(register struct tree *tp);*/
+-  
+-      char           *snmp_out_toggle_options(char *);
+-      void            snmp_out_toggle_options_usage(const char *, FILE *);
++--- mib.h.old 2007-07-19 15:11:03.917123577 -0500
+++++ mib.h     2007-07-19 15:10:44.804034380 -0500
++@@ -498,7 +498,7 @@
++     const char     *parse_octet_hint(const char *hint, const char *value,
++                                   unsigned char **new_val, int *new_val_len);
++ 
++-    void            clear_tree_flags(register struct tree *tp);
+++    /* void            clear_tree_flags(register struct tree *tp); */
++ 
++     char           *snmp_out_toggle_options(char *);
++     void            snmp_out_toggle_options_usage(const char *, FILE *);
+--- a/src/snmp_api.h-patch
++++ b/src/snmp_api.h-patch
+@@ -1,147 +1,100 @@
+-*** /usr/include/net-snmp/library/snmp_api.h  2003-11-11 08:37:07.000000000 -0800
+---- snmp_api.h        2004-03-07 15:02:18.000000000 -0800
+-***************
+-*** 82,91 ****
+-  
+-      /*
+-       * The actual transport domain.  This SHOULD NOT BE FREE()D.  
+--      */
+-  
+-      const oid      *tDomain;
+-      size_t          tDomainLen;
+-  
+-      netsnmp_variable_list *variables;
+-  
+---- 82,91 ----
+-  
+-      /*
+-       * The actual transport domain.  This SHOULD NOT BE FREE()D.  
+-  
+-      const oid      *tDomain;
+-      size_t          tDomainLen;
+-+      */
+-  
+-      netsnmp_variable_list *variables;
+-  
+-***************
+-*** 152,158 ****
+-      /*
+-       * Authentication function or NULL if null authentication is used 
+-       */
+-!     u_char         *(*authenticator) (u_char *, size_t *, u_char *, size_t);
+-      netsnmp_callback callback;      /* Function to interpret incoming data */
+-      /*
+-       * Pointer to data that the callback function may consider important 
+---- 152,158 ----
+-      /*
+-       * Authentication function or NULL if null authentication is used 
+-       */
+-!     /*    u_char         *(*authenticator) (u_char *, size_t *, u_char *, size_t);*/
+-      netsnmp_callback callback;      /* Function to interpret incoming data */
+-      /*
+-       * Pointer to data that the callback function may consider important 
+-***************
+-*** 384,391 ****
+---- 384,393 ----
+-  
+-  #define SNMPERR_MAX                 (-63)
+-  
+-+ /*
+-  #define non_repeaters       errstat
+-  #define max_repetitions errindex
+-+ */
+-  
+-  struct variable_list {
+-      struct variable_list *next_variable;    /* NULL for last variable */
+-***************
+-*** 410,416 ****
+-      oid             name_loc[MAX_OID_LEN];  /* 90 percentile < 24. */
+-      u_char          buf[40];        /* 90 percentile < 40. */
+-      void           *data;   /* (Opaque) hook for additional data */
+-!     void            (*dataFreeHook)(void *);       /* callback to free above */
+-      int             index;
+-  };
+-  
+---- 412,418 ----
+-      oid             name_loc[MAX_OID_LEN];  /* 90 percentile < 24. */
+-      u_char          buf[40];        /* 90 percentile < 40. */
+-      void           *data;   /* (Opaque) hook for additional data */
+-!     /*    void            (*dataFreeHook)(void *); */      /* callback to free above */
+-      int             index;
+-  };
+-  
+-***************
+-*** 601,608 ****
+-                                           size_t);
+-      int             netsnmp_oid_equals(const oid *, size_t, const oid *,
+-                                         size_t);
+-!     int             netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
+-!                                             size_t);
+-      int             netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
+-                                             size_t);
+-      int             netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
+---- 603,610 ----
+-                                           size_t);
+-      int             netsnmp_oid_equals(const oid *, size_t, const oid *,
+-                                         size_t);
+-! /*    int             netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
+-!                                             size_t);*/
+-      int             netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
+-                                             size_t);
+-      int             netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
+-***************
+-*** 619,629 ****
+---- 621,633 ----
++--- snmp_api.h.orig   Fri Jan  7 17:06:46 2005
+++++ snmp_api.h        Fri Jan  7 17:10:01 2005
++@@ -112,10 +112,10 @@
++ 
++     /**
++      * The actual transport domain.  This SHOULD NOT BE FREE()D.  
++-     */
++ 
++     const oid      *tDomain;
++     size_t          tDomainLen;
+++     */
++ 
++     netsnmp_variable_list *variables;
++ 
++@@ -209,7 +209,7 @@
++     /**
++      * Authentication function or NULL if null authentication is used 
++      */
++-    u_char         *(*authenticator) (u_char *, size_t *, u_char *, size_t);
+++    /* u_char         *(*authenticator) (u_char *, size_t *, u_char *, size_t); */
++     /** Function to interpret incoming data */
++     netsnmp_callback callback;      
++     /**
++@@ -487,8 +487,10 @@
++ 
++ #define SNMPERR_MAX                  (-63)
++ 
+++/*
++ #define non_repeaters        errstat
++ #define max_repetitions errindex
+++*/
++ 
++ typedef union {
++    long           *integer;
++@@ -530,7 +532,7 @@
++    /** (Opaque) hook for additional data */
++    void           *data;
++    /** callback to free above */
++-   void            (*dataFreeHook)(void *);    
+++   /* void            (*dataFreeHook)(void *); */
++    int             index;
++ };
++ 
++@@ -721,8 +723,8 @@
++                                          size_t);
++     int             netsnmp_oid_equals(const oid *, size_t, const oid *,
++                                        size_t);
++-    int             netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
++-                                            size_t);
+++/*    int             netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
+++                                            size_t);*/
++     int             netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
++                                            size_t);
++     int             netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
++@@ -739,11 +741,13 @@
++                                         size_t * out_length,
++                                         u_char * pdu_data,
++                                         size_t pdu_data_len);
+++/*
++     int             snmpv3_packet_rbuild(netsnmp_session *,
++                                          netsnmp_pdu *pdu, u_char * packet,
+                                           size_t * out_length,
+                                           u_char * pdu_data,
+                                           size_t pdu_data_len);
+-+ /*
+-      int             snmpv3_packet_rbuild(netsnmp_session *,
+-                                           netsnmp_pdu *pdu, u_char * packet,
+-                                           size_t * out_length,
+-                                           u_char * pdu_data,
+-                                           size_t pdu_data_len);
+-+ */
+-      int             snmpv3_make_report(netsnmp_pdu *pdu, int error);
+-      int             snmpv3_get_report_type(netsnmp_pdu *pdu);
+-      int             snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
+-***************
+-*** 672,677 ****
+---- 676,682 ----
+-       * Extended open; fpre_parse has changed.  
+-       */
+-  
+-+     /*
+-      netsnmp_session *snmp_open_ex(netsnmp_session *,
+-                                    int (*fpre_parse) (netsnmp_session *,
+-                                                       struct
+-***************
+-*** 689,694 ****
+---- 694,700 ----
+-                                                    netsnmp_pdu *, u_char **,
+-                                                    size_t *, size_t *),
+-                                    int (*fcheck) (u_char *, size_t));
+-+     */
+-  
+-      /*
+-       * provided for backwards compatability.  Don't use these functions.
+-***************
+-*** 770,775 ****
+---- 776,782 ----
+-       * 
+-       */
+-  
+-+     /*
+-      void           *snmp_sess_add_ex(netsnmp_session *,
+-                                       struct netsnmp_transport_s *,
+-                                       int (*fpre_parse) (netsnmp_session *,
+-***************
+-*** 836,841 ****
+---- 843,849 ----
+-                                                                  *, void *,
+-                                                                  size_t)
+-          );
+-+     */
+-  
+-      /*
+-       * use return value from snmp_sess_open as void * parameter 
+++*/
++     int             snmpv3_make_report(netsnmp_pdu *pdu, int error);
++     int             snmpv3_get_report_type(netsnmp_pdu *pdu);
++     int             snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
++@@ -793,6 +797,7 @@
++      * Extended open; fpre_parse has changed.  
++      */
++ 
+++    /*
++     netsnmp_session *snmp_open_ex(netsnmp_session *,
++                                   int (*fpre_parse) (netsnmp_session *,
++                                                      struct
++@@ -810,6 +815,7 @@
++                                                   netsnmp_pdu *, u_char **,
++                                                   size_t *, size_t *),
++                                   int (*fcheck) (u_char *, size_t));
+++    */
++ 
++     /*
++      * provided for backwards compatability.  Don't use these functions.
++@@ -891,6 +897,7 @@
++      * 
++      */
++ 
+++    /*
++     void           *snmp_sess_add_ex(netsnmp_session *,
++                                      struct netsnmp_transport_s *,
++                                      int (*fpre_parse) (netsnmp_session *,
++@@ -957,6 +964,7 @@
++                                                                 *, void *,
++                                                                 size_t)
++         );
+++    */
++ 
++     /*
++      * use return value from snmp_sess_open as void * parameter 
diff --git a/lang/yapsnmp/patches/001-automake-compat.patch b/lang/yapsnmp/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..f738190
--- /dev/null
@@ -0,0 +1,46 @@
+--- a/configure.in
++++ b/configure.in
+@@ -15,7 +15,7 @@ dnl Checks for libraries.
+ AC_CHECK_LIB(kstat, kstat_open)
+ AC_CHECK_LIB(socket, socket)
+ AC_CHECK_LIB(crypto, HMAC)
+-AC_CHECK_LIB(snmp, init_snmp, , AC_MSG_ERROR(Couldn't find libsnmp))
++AC_CHECK_LIB(netsnmp, init_snmp, , AC_MSG_ERROR(Couldn't find libsnmp))
+ dnl Checks for header files.
+ AC_HEADER_STDC
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -19,10 +19,10 @@ moduledir = $(SITEPACKAGE)
+ module_DATA = yapsnmp.py $(module).py
+ lib_LTLIBRARIES = netsnmpc.la
+-netsnmpc_la_SOURCES = $(prodname)_wrap.c
++netsnmpc_la_SOURCES = net-snmp_wrap.c
+ netsnmpc_la_LDFLAGS = -module -avoid-version
+-$(module).py $(prodname)_wrap.c: $(prodname).i $(includefiles)
++$(module).py net-snmp_wrap.c: $(prodname).i $(includefiles)
+       $(SWIG) -python -shadow -I$(snmpinclude) $(prodname).i
+ $(includefiles): $(patchfiles)
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -101,7 +101,7 @@ patchfiles = snmp_api.h-patch snmp_clien
+ EXTRA_DIST = yapsnmp.py $(prodname).i $(module).py $(patchfiles)
+ CLEANFILES = $(includefiles)
+-MAINTAINERCLEANFILES = $(module).py $(prodname)_wrap.c $(prodname)_wrap.doc Makefile.in
++MAINTAINERCLEANFILES = $(module).py net-snmp_wrap.c $(prodname)_wrap.doc Makefile.in
+ INCLUDES = -I$(oldincludedir)/$(PYTHONINCPATH) -I$(includedir)/$(PYTHONINCPATH)
+@@ -109,7 +109,7 @@ moduledir = $(SITEPACKAGE)
+ module_DATA = yapsnmp.py $(module).py
+ lib_LTLIBRARIES = netsnmpc.la
+-netsnmpc_la_SOURCES = $(prodname)_wrap.c
++netsnmpc_la_SOURCES = net-snmp_wrap.c
+ netsnmpc_la_LDFLAGS = -module -avoid-version
+ subdir = src
+ mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
diff --git a/libs/aalib/Makefile b/libs/aalib/Makefile
new file mode 100644 (file)
index 0000000..a980bf1
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2009 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:=aalib
+PKG_VERSION:=1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/aa-project
+PKG_MD5SUM:=790434e0f2005fc95559ab3eab42e746
+
+PKG_LICENSE:=LGPLv2
+PKG_LICENSE_FILE:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libaa
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Ascii-Art rendering library
+  URL:=http://aa-project.sourceforge.net/
+  DEPENDS:=+libncurses
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+               --without-x \
+               --with-x11-driver=no \
+               --with-slang-driver=no \
+               --with-ncurses=$(STAGING_DIR)/usr \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/aalib.h \
+               $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libaa.{a,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libaa/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libaa.so.* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libaa))
diff --git a/libs/aalib/patches/001-destdir.patch b/libs/aalib/patches/001-destdir.patch
new file mode 100644 (file)
index 0000000..df1d65e
--- /dev/null
@@ -0,0 +1,91 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -37,6 +37,8 @@ AUTOCONF = @AUTOCONF@
+ AUTOMAKE = @AUTOMAKE@
+ AUTOHEADER = @AUTOHEADER@
++DESTDIR =
++
+ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_DATA = @INSTALL_DATA@
+@@ -235,11 +237,11 @@ maintainer-clean-libLTLIBRARIES:
+ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+-      $(mkinstalldirs) $(libdir)
++      $(mkinstalldirs) $(DESTDIR)$(libdir)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+-          echo "$(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p"; \
+-          $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p; \
++          echo "$(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libdir)/$$p"; \
++          $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libdir)/$$p; \
+         else :; fi; \
+       done
+@@ -289,11 +291,11 @@ maintainer-clean-binPROGRAMS:
+ install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+-      $(mkinstalldirs) $(bindir)
++      $(mkinstalldirs) $(DESTDIR)$(bindir)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         if test -f $$p; then \
+-          echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \
+-          $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \
++          echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
++          $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
+         else :; fi; \
+       done
+@@ -357,21 +359,21 @@ DVIPS = dvips
+ install-info-am: $(INFO_DEPS)
+       @$(NORMAL_INSTALL)
+-      $(mkinstalldirs) $(infodir)
++      $(mkinstalldirs) $(DESTDIR)$(infodir)
+       @for file in $(INFO_DEPS); do \
+         d=$(srcdir); \
+         for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
+           if test -f $$d/$$ifile; then \
+-            echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
+-            $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
++            echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
++            $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
+           else : ; fi; \
+         done; \
+       done
+       @$(POST_INSTALL)
+       @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
+         for file in $(INFO_DEPS); do \
+-          echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
+-          install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
++          echo " install-info --info-dir=$(infodir) $(DESTDIR)$(infodir)/$$file";\
++          install-info --info-dir=$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
+         done; \
+       else : ; fi
+@@ -412,10 +414,10 @@ maintainer-clean-aminfo:
+ install-includeHEADERS: $(include_HEADERS)
+       @$(NORMAL_INSTALL)
+-      $(mkinstalldirs) $(includedir)
++      $(mkinstalldirs) $(DESTDIR)$(includedir)
+       @list='$(include_HEADERS)'; for p in $$list; do \
+-        echo " $(INSTALL_DATA) $(srcdir)/$$p $(includedir)/$$p"; \
+-        $(INSTALL_DATA) $(srcdir)/$$p $(includedir)/$$p; \
++        echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(includedir)/$$p"; \
++        $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(includedir)/$$p; \
+       done
+ uninstall-includeHEADERS:
+@@ -508,7 +510,7 @@ all: Makefile $(INFO_DEPS) $(LTLIBRARIES
+ install-strip:
+       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+ installdirs:
+-      $(mkinstalldirs)  $(libdir) $(bindir) $(infodir) $(includedir)
++      $(mkinstalldirs)  $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(infodir) $(DESTDIR)$(includedir)
+ mostlyclean-generic:
diff --git a/libs/aalib/patches/002-configure.patch b/libs/aalib/patches/002-configure.patch
new file mode 100644 (file)
index 0000000..945d3de
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure.in
++++ b/configure.in
+@@ -88,7 +88,7 @@
+ AC_ARG_WITH(slang-driver,
+         [  --with-slang-driver=no   Used to disable slang driver],[
+       if test x$withval = xno; then
+-        vga_driver_test=no
++        slang_driver_test=no
+       fi
+ ])
+ AC_ARG_WITH(curses-driver,
diff --git a/libs/argtable/Makefile b/libs/argtable/Makefile
new file mode 100644 (file)
index 0000000..c44db19
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2007-2012 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:=argtable
+PKG_VERSION:=2.13
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)2-13.tar.gz
+PKG_SOURCE_URL:=@SF/argtable
+PKG_MD5SUM:=156773989d0d6406cea36526d3926668
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)2-13
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/argtable
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A library for parsing GNU style command line options
+  URL:=http://argtable.sourceforge.net/
+endef
+
+define Package/argtable/description
+       Argtable is an ANSI C library for parsing GNU style command line options
+       with a minimum of fuss. It enables a program's command line syntax to be
+       defined in the source code as an array of argtable structs. The command
+       line is then parsed according to that specification and the resulting
+       values are returned in those same structs where they are accessible to
+       the main program. Both tagged (-v, --verbose, --foo=bar) and untagged
+       arguments are supported, as are multiple instances of each argument.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+MAKE_PATH = ./src
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/argtable2.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libargtable2.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/argtable/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libargtable2.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,argtable))
diff --git a/libs/axtls/Makefile b/libs/axtls/Makefile
new file mode 100644 (file)
index 0000000..460b02f
--- /dev/null
@@ -0,0 +1,93 @@
+#
+# Copyright (C) 2006-2013 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:=axtls
+PKG_VERSION:=1.4.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=axTLS-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/axtls
+PKG_MD5SUM:=6d519bc3b5f20faa6ef8d423f5062241
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libaxtls
+  SUBMENU:=SSL
+  SECTION:=libs
+  CATEGORY:=Libraries
+  SUBMENU:=SSL
+  TITLE:=Embedded client/server TLSv1 SSL library
+  URL:=http://sourceforge.net/projects/axtls
+endef
+
+define Package/axhttpd
+  SUBMENU:=Web Servers/Proxies
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A small embedded web server using the axTLS library
+  URL:=http://www.axtls.co.nr/
+  DEPENDS:=+libaxtls
+endef
+
+define Package/axtlswrap
+  SUBMENU:=SSL
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=A simple TLS/SSL wrapper using the axTLS library
+  URL:=http://sourceforge.net/projects/axtls
+  DEPENDS:=+libaxtls
+endef
+
+define Build/Configure
+       $(CP) ./files/config $(PKG_BUILD_DIR)/config/.config
+       $(MAKE) -C $(PKG_BUILD_DIR) oldconfig
+endef
+
+TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components 1 $(TAR_OPTIONS)
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               STRIP="/bin/true" \
+               OPT_CFLAGS="$(TARGET_CFLAGS)" OPT_LDFLAGS="" \
+               all
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               PREFIX="$(PKG_INSTALL_DIR)/usr" \
+               install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/axTLS $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libaxtls.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libaxtls/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libaxtls.so.* $(1)/usr/lib/
+endef
+
+define Package/axhttpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/axhttpd $(1)/usr/sbin/
+endef
+
+define Package/axtlswrap/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/_stage/axtlswrap $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,libaxtls))
+$(eval $(call BuildPackage,axhttpd))
+$(eval $(call BuildPackage,axtlswrap))
diff --git a/libs/axtls/files/config b/libs/axtls/files/config
new file mode 100644 (file)
index 0000000..0e33fef
--- /dev/null
@@ -0,0 +1,126 @@
+#
+# Automatically generated make config: don't edit
+#
+HAVE_DOT_CONFIG=y
+CONFIG_PLATFORM_LINUX=y
+# CONFIG_PLATFORM_CYGWIN is not set
+# CONFIG_PLATFORM_WIN32 is not set
+
+#
+# General Configuration
+#
+PREFIX="/usr"
+# CONFIG_DEBUG is not set
+CONFIG_STRIP_UNWANTED_SECTIONS=y
+# CONFIG_VISUAL_STUDIO_7_0 is not set
+# CONFIG_VISUAL_STUDIO_8_0 is not set
+# CONFIG_VISUAL_STUDIO_10_0 is not set
+CONFIG_VISUAL_STUDIO_7_0_BASE=""
+CONFIG_VISUAL_STUDIO_8_0_BASE=""
+CONFIG_VISUAL_STUDIO_10_0_BASE=""
+CONFIG_EXTRA_CFLAGS_OPTIONS=""
+CONFIG_EXTRA_LDFLAGS_OPTIONS=""
+
+#
+# SSL Library
+#
+# CONFIG_SSL_SERVER_ONLY is not set
+# CONFIG_SSL_CERT_VERIFICATION is not set
+# CONFIG_SSL_ENABLE_CLIENT is not set
+CONFIG_SSL_FULL_MODE=y
+# CONFIG_SSL_SKELETON_MODE is not set
+# CONFIG_SSL_PROT_LOW is not set
+CONFIG_SSL_PROT_MEDIUM=y
+# CONFIG_SSL_PROT_HIGH is not set
+CONFIG_SSL_USE_DEFAULT_KEY=y
+CONFIG_SSL_PRIVATE_KEY_LOCATION=""
+CONFIG_SSL_PRIVATE_KEY_PASSWORD=""
+CONFIG_SSL_X509_CERT_LOCATION=""
+# CONFIG_SSL_GENERATE_X509_CERT is not set
+CONFIG_SSL_X509_COMMON_NAME=""
+CONFIG_SSL_X509_ORGANIZATION_NAME=""
+CONFIG_SSL_X509_ORGANIZATION_UNIT_NAME=""
+# CONFIG_SSL_ENABLE_V23_HANDSHAKE is not set
+CONFIG_SSL_HAS_PEM=y
+CONFIG_SSL_USE_PKCS12=y
+CONFIG_SSL_EXPIRY_TIME=24
+CONFIG_X509_MAX_CA_CERTS=150
+CONFIG_SSL_MAX_CERTS=3
+# CONFIG_SSL_CTX_MUTEXING is not set
+CONFIG_USE_DEV_URANDOM=y
+# CONFIG_WIN32_USE_CRYPTO_LIB is not set
+# CONFIG_OPENSSL_COMPATIBLE is not set
+# CONFIG_PERFORMANCE_TESTING is not set
+# CONFIG_SSL_TEST is not set
+CONFIG_AXHTTPD=y
+CONFIG_AXTLSWRAP=y
+
+#
+# Axhttpd Configuration
+#
+# CONFIG_HTTP_STATIC_BUILD is not set
+CONFIG_HTTP_PORT=80
+CONFIG_HTTP_HTTPS_PORT=443
+CONFIG_HTTP_SESSION_CACHE_SIZE=5
+CONFIG_HTTP_WEBROOT=""
+CONFIG_HTTP_TIMEOUT=300
+
+#
+# CGI
+#
+# CONFIG_HTTP_HAS_CGI is not set
+CONFIG_HTTP_CGI_EXTENSIONS=""
+# CONFIG_HTTP_ENABLE_LUA is not set
+CONFIG_HTTP_LUA_PREFIX=""
+CONFIG_HTTP_LUA_CGI_LAUNCHER=""
+# CONFIG_HTTP_BUILD_LUA is not set
+# CONFIG_HTTP_DIRECTORIES is not set
+# CONFIG_HTTP_HAS_AUTHORIZATION is not set
+# CONFIG_HTTP_HAS_IPV6 is not set
+# CONFIG_HTTP_ENABLE_DIFFERENT_USER is not set
+CONFIG_HTTP_USER=""
+# CONFIG_HTTP_VERBOSE is not set
+# CONFIG_HTTP_IS_DAEMON is not set
+
+#
+# Language Bindings
+#
+# CONFIG_BINDINGS is not set
+# CONFIG_CSHARP_BINDINGS is not set
+# CONFIG_VBNET_BINDINGS is not set
+CONFIG_DOT_NET_FRAMEWORK_BASE=""
+# CONFIG_JAVA_BINDINGS is not set
+CONFIG_JAVA_HOME=""
+# CONFIG_PERL_BINDINGS is not set
+CONFIG_PERL_CORE=""
+CONFIG_PERL_LIB=""
+# CONFIG_LUA_BINDINGS is not set
+CONFIG_LUA_CORE=""
+
+#
+# Samples
+#
+# CONFIG_SAMPLES is not set
+# CONFIG_C_SAMPLES is not set
+# CONFIG_CSHARP_SAMPLES is not set
+# CONFIG_VBNET_SAMPLES is not set
+# CONFIG_JAVA_SAMPLES is not set
+# CONFIG_PERL_SAMPLES is not set
+# CONFIG_LUA_SAMPLES is not set
+
+#
+# BigInt Options
+#
+# CONFIG_BIGINT_CLASSICAL is not set
+# CONFIG_BIGINT_MONTGOMERY is not set
+CONFIG_BIGINT_BARRETT=y
+CONFIG_BIGINT_CRT=y
+# CONFIG_BIGINT_KARATSUBA is not set
+MUL_KARATSUBA_THRESH=0
+SQU_KARATSUBA_THRESH=0
+CONFIG_BIGINT_SLIDING_WINDOW=y
+CONFIG_BIGINT_SQUARE=y
+# CONFIG_BIGINT_CHECK_ON is not set
+CONFIG_INTEGER_32BIT=y
+# CONFIG_INTEGER_16BIT is not set
+# CONFIG_INTEGER_8BIT is not set
diff --git a/libs/axtls/patches/001-opt_flags.patch b/libs/axtls/patches/001-opt_flags.patch
new file mode 100644 (file)
index 0000000..afa4e00
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/config/makefile.conf
++++ b/config/makefile.conf
+@@ -110,20 +110,23 @@ endif
+ endif
+ ifdef CONFIG_DEBUG
+-CFLAGS += -g
++OPT_CFLAGS = -g
+ else
+-LDFLAGS += -s
++OPT_LDFLAGS = -s
+ ifdef CONFIG_PLATFORM_SOLARIS
+-CFLAGS += -O 
++OPT_CFLAGS = -O 
+ else
+-CFLAGS += -O3
++OPT_CFLAGS = -O3
+ endif
+ endif # CONFIG_DEBUG
+ endif   # WIN32
+-CFLAGS+=$(subst ",, $(strip $(CONFIG_EXTRA_CFLAGS_OPTIONS)))
+-LDFLAGS+=$(subst ",, $(strip $(CONFIG_EXTRA_LDFLAGS_OPTIONS)))
++EXTRA_CFLAGS=$(subst ",, $(strip $(CONFIG_EXTRA_CFLAGS_OPTIONS)))
++EXTRA_LDFLAGS=$(subst ",, $(strip $(CONFIG_EXTRA_LDFLAGS_OPTIONS)))
++
++CFLAGS += $(OPT_CFLAGS) $(EXTRA_CFLAGS)
++LDFLAGS += $(OPT_LDFLAGS) $(EXTRA_LDFLAGS)
+ endif   # not 'clean'
diff --git a/libs/axtls/patches/002-axhttpd_install.patch b/libs/axtls/patches/002-axhttpd_install.patch
new file mode 100644 (file)
index 0000000..22469d7
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/Makefile
++++ b/Makefile
+@@ -91,8 +91,11 @@ win32_demo:
+ install: $(PREFIX) all
+       cp --no-dereference $(STAGE)/libax* $(PREFIX)/lib
+       chmod 755 $(PREFIX)/lib/libax* 
++ifdef CONFIG_AXHTTPD
++      install -m 755 $(STAGE)/axhttpd $(PREFIX)/bin
++endif
+ ifdef CONFIG_SAMPLES
+-      install -m 755 $(STAGE)/ax* $(PREFIX)/bin 
++      install -m 755 $(STAGE)/axssl $(PREFIX)/bin 
+ endif
+ ifdef CONFIG_HTTP_HAS_AUTHORIZATION
+       install -m 755 $(STAGE)/htpasswd $(PREFIX)/bin 
diff --git a/libs/bluez-libs/Makefile b/libs/bluez-libs/Makefile
new file mode 100644 (file)
index 0000000..a54b739
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006-2010 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:=bluez-libs
+PKG_VERSION:=3.36
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://bluez.sourceforge.net/download
+PKG_MD5SUM:=8c2ca546c0e7bb73dbd0e906fce7f6b1
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bluez-libs
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Bluetooth library
+  URL:=http://www.bluez.org/
+endef
+
+CONFIGURE_ARGS += \
+               --enable-shared \
+               --enable-static \
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/bluetooth
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/bluetooth/*.h $(1)/usr/include/bluetooth
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/bluez.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/bluez-libs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,bluez-libs))
diff --git a/libs/bluez-libs/patches/010-dont-override-libdir.patch b/libs/bluez-libs/patches/010-dont-override-libdir.patch
new file mode 100644 (file)
index 0000000..af7568c
--- /dev/null
@@ -0,0 +1,15 @@
+diff --git a/configure b/configure
+index 6a387c6..5ffc003 100755
+--- a/configure
++++ b/configure
+@@ -2430,10 +2430,6 @@ fi
+               prefix="${ac_default_prefix}"
+       fi
+-      if (test "${libdir}" = '${exec_prefix}/lib'); then
+-              libdir="${prefix}/lib"
+-      fi
+-
+       if (test "$sysconfdir" = '${prefix}/etc'); then
+               configdir="${prefix}/etc/bluetooth"
+       else
diff --git a/libs/boost/Makefile b/libs/boost/Makefile
new file mode 100644 (file)
index 0000000..42ee58e
--- /dev/null
@@ -0,0 +1,378 @@
+#
+# Copyright (C) 2009-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Dude, this "boost" is really one of the most crude stuff I ported yet.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=boost
+PKG_VERSION:=1_51_0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/boost
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_VERSION)
+PKG_MD5SUM:=6a1f32d902203ac70fbec78af95b3cf8
+
+PKG_BUILD_DEPENDS:=boost/host
+PKG_BUILD_PARALLEL:=0
+PKG_USE_MIPS16:=0
+
+PKG_CONFIG_DEPENDS := \
+       CONFIG_PACKAGE_boost-date_time \
+       CONFIG_PACKAGE_boost-filesystem \
+       CONFIG_PACKAGE_boost-graph \
+       CONFIG_PACKAGE_boost-iostreams \
+       CONFIG_PACKAGE_boost-math \
+       CONFIG_PACKAGE_boost-program_options \
+       CONFIG_PACKAGE_boost-python \
+       CONFIG_PACKAGE_boost-regex \
+       CONFIG_PACKAGE_boost-serialization \
+       CONFIG_PACKAGE_boost-signals \
+       CONFIG_PACKAGE_boost-system \
+       CONFIG_PACKAGE_boost-test \
+       CONFIG_PACKAGE_boost-thread \
+       CONFIG_PACKAGE_boost-wave \
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+define Package/boost/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Boost C++ source libraries
+  URL:=http://www.boost.org
+  DEPENDS:=+libstdcpp +libpthread +librt
+  MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
+endef
+
+define Package/boost/Default/description
+  Boost provides free peer-reviewed portable C++ source libraries
+endef
+
+define Package/boost-chrono
+  $(call Package/boost/Default)
+  TITLE+= (chrono)
+  DEPENDS+= +boost-system
+endef
+
+define Package/boost-date_time
+  $(call Package/boost/Default)
+  TITLE+= (date_time)
+endef
+
+define Package/boost-exception
+  $(call Package/boost/Default)
+  TITLE+= (exception)
+endef
+
+define Package/boost-filesystem
+  $(call Package/boost/Default)
+  TITLE+= (filesystem)
+  DEPENDS+= +boost-system
+endef
+
+define Package/boost-graph
+  $(call Package/boost/Default)
+  TITLE+= (graph)
+  DEPENDS+= +boost-regex
+endef
+
+define Package/boost-graph_parallel
+  $(call Package/boost/Default)
+  TITLE+= (graph_parallel)
+endef
+
+define Package/boost-iostreams
+  $(call Package/boost/Default)
+  TITLE+= (iostreams)
+  DEPENDS+= +zlib
+endef
+
+define Package/boost-locale
+  $(call Package/boost/Default)
+  TITLE+= (locale)
+endef
+
+define Package/boost-math
+  $(call Package/boost/Default)
+  TITLE+= (math)
+endef
+
+define Package/boost-mpi
+  $(call Package/boost/Default)
+  TITLE+= (mpi)
+endef
+
+define Package/boost-program_options
+  $(call Package/boost/Default)
+  TITLE+= (program_options)
+endef
+
+define Package/boost-python
+  $(call Package/boost/Default)
+  TITLE+= (python)
+  DEPENDS+= +PACKAGE_boost-python:python
+endef
+
+define Package/boost-random
+  $(call Package/boost/Default)
+  TITLE+= (random)
+endef
+
+define Package/boost-regex
+  $(call Package/boost/Default)
+  TITLE+= (regex)
+endef
+
+define Package/boost-serialization
+  $(call Package/boost/Default)
+  TITLE+= (serialization)
+endef
+
+define Package/boost-signals
+  $(call Package/boost/Default)
+  TITLE+= (signals)
+endef
+
+define Package/boost-system
+  $(call Package/boost/Default)
+  TITLE+= (system)
+endef
+
+define Package/boost-test
+  $(call Package/boost/Default)
+  TITLE+= (test)
+endef
+
+define Package/boost-thread
+  $(call Package/boost/Default)
+  TITLE+= (thread)
+  DEPENDS+= +boost-system +boost-chrono
+endef
+
+define Package/boost-timer
+  $(call Package/boost/Default)
+  TITLE+= (timer)
+  DEPENDS+= boost-chrono
+endef
+
+define Package/boost-wave
+  $(call Package/boost/Default)
+  TITLE+= (wave)
+  DEPENDS+= +boost-date_time +boost-thread +boost-filesystem
+endef
+
+define Package/boost
+  $(call Package/boost/Default)
+  TITLE+= (header-only)
+  BUILDONLY:=1
+endef
+
+define Build/Configure
+endef
+
+define Host/Compile
+       # bjam does not provide a configure-script nor a Makefile
+       ( cd $(HOST_BUILD_DIR)/tools/build/v2/engine ; ./build.sh gcc )
+endef
+
+CONFIGURE_PREFIX:=$(PKG_INSTALL_DIR)
+TARGET_LDFLAGS += -pthread -lrt
+
+define Build/Compile
+       ( cd $(PKG_BUILD_DIR) ; \
+               echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/v2/user-config.jam ; \
+               $(if $(CONFIG_PACKAGE_boost-python), \
+                       echo "using python : : $(STAGING_DIR_ROOT)/usr/bin/python :     $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
+                               tools/build/v2/user-config.jam; \
+               ) \
+               bjam \
+                       '-sBUILD=release <optimization>space <inlining>on <debug-symbols>off' \
+                       --toolset=gcc-$(ARCH) --build-type=minimal --layout=system \
+                       --disable-long-double \
+                       $(CONFIGURE_ARGS) \
+                       $(if $(CONFIG_PACKAGE_boost-chrono),,--without-chrono) \
+                       $(if $(CONFIG_PACKAGE_boost-date_time),,--without-date_time) \
+                       $(if $(CONFIG_PACKAGE_boost-exception),,--without-exception) \
+                       $(if $(CONFIG_PACKAGE_boost-filesystem),,--without-filesystem) \
+                       $(if $(CONFIG_PACKAGE_boost-graph),,--without-graph) \
+                       $(if $(CONFIG_PACKAGE_boost-graph_parallel),,--without-graph_parallel) \
+                       $(if $(CONFIG_PACKAGE_boost-iostreams),,--without-iostreams) \
+                       $(if $(CONFIG_PACKAGE_boost-locale),,--without-locale) \
+                       $(if $(CONFIG_PACKAGE_boost-math),,--without-math) \
+                       $(if $(CONFIG_PACKAGE_boost-mpi),,--without-mpi) \
+                       $(if $(CONFIG_PACKAGE_boost-program_options),,--without-program_options) \
+                       $(if $(CONFIG_PACKAGE_boost-python),,--without-python) \
+                       $(if $(CONFIG_PACKAGE_boost-random),,--without-random) \
+                       $(if $(CONFIG_PACKAGE_boost-regex),,--without-regex) \
+                       $(if $(CONFIG_PACKAGE_boost-serialization),,--without-serialization) \
+                       $(if $(CONFIG_PACKAGE_boost-signals),,--without-signals) \
+                       $(if $(CONFIG_PACKAGE_boost-system),,--without-system) \
+                       $(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
+                       $(if $(CONFIG_PACKAGE_boost-thread),,--without-thread) \
+                       $(if $(CONFIG_PACKAGE_boost-timer),,--without-timer) \
+                       $(if $(CONFIG_PACKAGE_boost-wave),,--without-wave) \
+                       \
+                       $(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
+                               -sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
+                       install \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) \
+               $(1)/usr/include/boost/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/include/boost/* \
+               $(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
+endef
+
+define Host/Install
+       $(INSTALL_DIR) \
+               $(STAGING_DIR_HOST)/bin
+
+       $(CP) \
+               $(HOST_BUILD_DIR)/tools/build/v2/engine/bin.*/bjam \
+               $(STAGING_DIR_HOST)/bin/
+endef
+
+define Package/boost/Default/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/lib/libboost_$(2)*.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/boost-chrono/install
+  $(call Package/boost/Default/install,$(1),chrono)
+endef
+
+define Package/boost-date_time/install
+  $(call Package/boost/Default/install,$(1),date_time)
+endef
+
+define Package/boost-exception/install
+  $(call Package/boost/Default/install,$(1),exception)
+endef
+
+define Package/boost-filesystem/install
+  $(call Package/boost/Default/install,$(1),filesystem)
+endef
+
+define Package/boost-graph/install
+  $(call Package/boost/Default/install,$(1),graph)
+endef
+
+define Package/boost-graph_parallel/install
+  $(call Package/boost/Default/install,$(1),graph_parallel)
+endef
+
+define Package/boost-iostreams/install
+  $(call Package/boost/Default/install,$(1),iostreams)
+endef
+
+define Package/boost-math/install
+  $(call Package/boost/Default/install,$(1),math)
+endef
+
+define Package/boost-mpi/install
+  $(call Package/boost/Default/install,$(1),mpi)
+endef
+
+define Package/boost-program_options/install
+  $(call Package/boost/Default/install,$(1),program_options)
+endef
+
+define Package/boost-python/install
+  $(call Package/boost/Default/install,$(1),python)
+endef
+
+define Package/boost-random/install
+  $(call Package/boost/Default/install,$(1),random)
+endef
+
+define Package/boost-regex/install
+  $(call Package/boost/Default/install,$(1),regex)
+endef
+
+define Package/boost-serialization/install
+  $(call Package/boost/Default/install,$(1),serialization)
+endef
+
+define Package/boost-signals/install
+  $(call Package/boost/Default/install,$(1),signals)
+endef
+
+define Package/boost-system/install
+  $(call Package/boost/Default/install,$(1),system)
+endef
+
+define Package/boost-test/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/lib/libboost_unit_test_framework*.so* \
+               $(1)/usr/lib/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/lib/libboost_prg_exec_monitor*.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/boost-thread/install
+  $(call Package/boost/Default/install,$(1),thread)
+endef
+
+define Package/boost-timer/install
+  $(call Package/boost/Default/install,$(1),timer)
+endef
+
+define Package/boost-wave/install
+  $(call Package/boost/Default/install,$(1),wave)
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,boost))
+$(eval $(call BuildPackage,boost-chrono))
+$(eval $(call BuildPackage,boost-date_time))
+#$(eval $(call BuildPackage,boost-exception))
+$(eval $(call BuildPackage,boost-filesystem))
+$(eval $(call BuildPackage,boost-graph))
+#$(eval $(call BuildPackage,boost-graph_parallel))
+$(eval $(call BuildPackage,boost-iostreams))
+$(eval $(call BuildPackage,boost-locale))
+$(eval $(call BuildPackage,boost-math))
+#$(eval $(call BuildPackage,boost-mpi))
+$(eval $(call BuildPackage,boost-program_options))
+$(eval $(call BuildPackage,boost-random))
+$(eval $(call BuildPackage,boost-python))
+$(eval $(call BuildPackage,boost-regex))
+$(eval $(call BuildPackage,boost-serialization))
+$(eval $(call BuildPackage,boost-signals))
+$(eval $(call BuildPackage,boost-system))
+$(eval $(call BuildPackage,boost-test))
+$(eval $(call BuildPackage,boost-thread))
+$(eval $(call BuildPackage,boost-timer))
+$(eval $(call BuildPackage,boost-wave))
diff --git a/libs/boost/patches/100-do-not-use-librt.patch b/libs/boost/patches/100-do-not-use-librt.patch
new file mode 100644 (file)
index 0000000..d1c0f37
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/tools/build/v2/tools/gcc.jam
++++ b/tools/build/v2/tools/gcc.jam
+@@ -1063,8 +1063,7 @@ rule setup-threading ( targets * : sourc
+             }
+             case * :
+             {
+-                option = -pthread ;
+-                libs = rt ;
++                # pass appropriate options via OpenWrt
+             }
+         }
+     
+--- a/tools/build/v2/tools/gcc.py
++++ b/tools/build/v2/tools/gcc.py
+@@ -685,8 +685,8 @@ elif bjam.variable('UNIX'):
+         # Darwin has no threading options, don't set anything here.
+         pass
+     else:
+-        flags('gcc', 'OPTIONS', ['<threading>multi'], ['-pthread'])
+-        flags('gcc', 'FINDLIBS-SA', [], ['rt'])
++        # pass appropriate options via OpenWrt
++        pass
+ def cpu_flags(toolset, variable, architecture, instruction_set, values, default=None):
+     #FIXME: for some reason this fails.  Probably out of date feature code
diff --git a/libs/boost/patches/200-cstdint_missing_include.patch b/libs/boost/patches/200-cstdint_missing_include.patch
new file mode 100644 (file)
index 0000000..4cb778d
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/libs/context/src/fcontext.cpp.new        2012-12-11 17:59:59.349131458 +0100
++++ b/libs/context/src/fcontext.cpp    2012-12-11 18:00:06.925131652 +0100
+@@ -9,6 +9,9 @@
+ #include <boost/context/fcontext.hpp>
+ #include <cstddef>
++extern "C" {
++#include <stdint.h>
++}
+ #ifdef BOOST_HAS_ABI_HEADERS
+ #  include BOOST_ABI_PREFIX
diff --git a/libs/cgilib/Makefile b/libs/cgilib/Makefile
new file mode 100644 (file)
index 0000000..ef6ee03
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2006-2009 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:=cgilib
+PKG_VERSION:=0.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.infodrom.org/projects/cgilib/download
+PKG_MD5SUM:=2c7053f58dfb06f7a80a112797ed7e86
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_DEPENDS:=libltdl
+
+LIBTOOL="$(STAGING_DIR)/host/bin/libtool"
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cgilib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Simple CGI Library
+  URL:=http://www.infodrom.org/projects/cgilib/
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+                OFLAGS="$(TARGET_CFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               LIBTOOL="$(LIBTOOL)" \
+                install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/cgi.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcgi.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/cgilib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcgi.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,cgilib))
diff --git a/libs/cgilib/patches/200-cgitest_bugfix.patch b/libs/cgilib/patches/200-cgitest_bugfix.patch
new file mode 100644 (file)
index 0000000..745aa0e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/cgitest.c
++++ b/cgitest.c
+@@ -216,7 +216,7 @@ int main (int argc, char **argv, char **
+           cgiSetHeader ("Set-Cookie", "Version=1; Library=cgilib; Path=/");
+             cgiHeader();
+           printf (HTML_CSS HTML_HEAD);
+-          printf ("<h3>Cookie Library set</h3>\n");
++          printf ("<h3>Cookie \"Library\" set</h3>\n");
+           printf ("<p><br><p><br><a href=\"/cgi-bin/cgitest\">Test</a><p>\n");
+           printf ("<p><br><p><br><a href=\"/cgi-bin/cgitest/redirect\">Redirect</a><p>\n");
+           printf ("<p><br><p><br><a href=\"/cgi-bin/cgitest/listall\">List Everything</a><p>\n");
diff --git a/libs/cgilib/patches/300-cpp_bugfix.patch b/libs/cgilib/patches/300-cpp_bugfix.patch
new file mode 100644 (file)
index 0000000..c06f816
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/cgi.h
++++ b/cgi.h
+@@ -24,6 +24,10 @@
+ extern "C" {
+ #endif
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ typedef struct var_s {
+       char    *name,
+               *value;
+@@ -146,4 +150,8 @@ char *cgiEscape (char *string);
+ extern }
+ #endif
++#ifdef __cplusplus
++} /* end of extern "C" */
++#endif
++
+ #endif /* _CGI_H_ */
diff --git a/libs/check/Makefile b/libs/check/Makefile
new file mode 100644 (file)
index 0000000..5444079
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2008-2010 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:=check
+PKG_VERSION:=0.9.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/check
+PKG_MD5SUM:=5d75e9a6027cde79d2c339ef261e7470
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/check
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Unit testing framework for C
+  URL:=http://check.sourceforge.net/
+  DEPENDS:= +libpthread
+endef
+
+define Package/check/description
+  Check features a simple interface for defining unit tests, putting little in
+  the way of the developer. Tests are run in a separate address space, so Check
+  can catch both assertion failures and code errors that cause segmentation
+  faults or other signals. The output from unit tests can be used within source
+  code editors and IDEs.
+endef
+
+define Build/Configure
+       $(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/build-aux/
+       $(call Build/Configure/Default)
+endef
+
+define Build/Install
+       $(call Build/Install/Default)
+       cd $(PKG_INSTALL_DIR)/usr/lib/ ; ln -nsf libcheck.so libcheck_pic.so
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+define Package/check/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcheck.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,check))
diff --git a/libs/classpath/Makefile b/libs/classpath/Makefile
new file mode 100644 (file)
index 0000000..4963c42
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# Copyright (C) 2006-2010 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:=classpath
+PKG_VERSION:=0.98
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/classpath
+PKG_MD5SUM:=90c6571b8b0309e372faa0f9f6255ea9
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/classpath
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GNU Classpath
+  URL:=http://www.gnu.org/software/classpath/
+  MAINTAINER:=Roberto Riggio <roberto.riggio@create-net.org>
+  DEPENDS:=+alsa-lib +libgmp +libmagic
+endef
+
+define Package/classpath/Description
+       GNU Classpath, Essential Libraries for Java, is a GNU project
+       to create free core class libraries for use with virtual
+       machines and compilers for the java programming language.
+endef
+
+define Package/classpath-tools
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GNU Classpath tools
+  URL:=http://www.gnu.org/software/classpath/
+  MAINTAINER:=Roberto Riggio <roberto.riggio@create-net.org>
+endef
+
+define Download/antlr
+  URL:=http://www.antlr.org/download
+  FILE:=antlr-3.4-complete.jar
+  MD5SUM:=1b91dea1c7d480b3223f7c8a9aa0e172
+endef
+$(eval $(call Download,antlr))
+
+CONFIGURE_ARGS += \
+       --without-x \
+       --disable-gtk-peer \
+       --disable-qt-peer \
+       --disable-dssi \
+       --disable-plugin \
+       --disable-gconf-peer \
+       --disable-gjdoc \
+       --with-antlr-jar=$(DL_DIR)/antlr-3.4-complete.jar
+
+define Package/classpath/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib/classpath \
+               $(1)/usr/share/classpath
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/security \
+               $(PKG_INSTALL_DIR)/usr/lib/logging.properties \
+               $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/classpath/*.so* $(1)/usr/lib/classpath/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/classpath/glibj.zip $(1)/usr/share/classpath/
+endef
+
+define Package/classpath-tools/install
+       $(INSTALL_DIR) \
+               $(1)/usr/bin \
+               $(1)/usr/share/classpath
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/classpath/tools.zip $(1)/usr/share/classpath/
+endef
+
+define Build/InstallDev
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,classpath))
+$(eval $(call BuildPackage,classpath-tools))
diff --git a/libs/classpath/patches/000-fix_include.patch b/libs/classpath/patches/000-fix_include.patch
new file mode 100644 (file)
index 0000000..214e132
--- /dev/null
@@ -0,0 +1,14 @@
+Index: classpath-0.98/configure.ac
+===================================================================
+--- classpath-0.98.orig/configure.ac   2009-02-06 00:26:08.000000000 +0100
++++ classpath-0.98/configure.ac        2012-08-22 10:18:53.325876508 +0200
+@@ -762,8 +762,7 @@
+   dnl change the name of the corresponding ac_ variable on lines 860...
+   if test "x${COMPILE_GMP}" = xyes; then
+     AC_CHECK_LIB(gmp, __gmpz_mul_si,
+-      [GMP_CFLAGS=-I/usr/include
+-       GMP_LIBS=-lgmp ],
++      [GMP_LIBS=-lgmp ],
+       [GMP_CFLAGS=
+        GMP_LIBS= ])
+     AC_SUBST(GMP_CFLAGS)
diff --git a/libs/clearsilver/Config.in b/libs/clearsilver/Config.in
new file mode 100644 (file)
index 0000000..2d25b8e
--- /dev/null
@@ -0,0 +1,11 @@
+config CLEARSILVER_ENABLE_COMPRESSION
+       bool "HTML compression support"
+       default y
+
+config CLEARSILVER_ENABLE_REMOTE_DEBUGGER
+       bool "Remote X CGI debugging"
+       default n
+
+config CLEARSILVER_ENABLE_GETTEXT
+       bool "Gettext message translation"
+       default n
diff --git a/libs/clearsilver/Makefile b/libs/clearsilver/Makefile
new file mode 100644 (file)
index 0000000..52d6ddc
--- /dev/null
@@ -0,0 +1,102 @@
+#
+# Copyright (C) 2006-2010 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:=clearsilver
+PKG_VERSION:=0.10.5
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.clearsilver.net/downloads/
+PKG_MD5SUM:=b8c0c7fbe0ef5e06e0c935f134304d44
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_CLEARSILVER_ENABLE_COMPRESSION \
+       CONFIG_CLEARSILVER_ENABLE_REMOTE_DEBUGGER \
+       CONFIG_CLEARSILVER_ENABLE_GETTEXT
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/clearsilver
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=ClearSilver template system
+  URL:=http://www.clearsilver.net/
+  MAINTAINER:=Raphaël HUCK <rhk@cksum.org>
+  DEPENDS:=+CLEARSILVER_ENABLE_COMPRESSION:zlib +CLEARSILVER_ENABLE_GETTEXT:libintl
+endef
+
+define Package/clearsilver/config
+  menu "Configuration"
+  depends on PACKAGE_clearsilver
+  source "$(SOURCE)/Config.in"
+  endmenu
+endef
+
+define Package/clearsilver/description
+Clearsilver is a fast, powerful, and language-neutral HTML template system. In
+both static content sites and dynamic HTML applications, it provides a separation
+between presentation code and application logic which makes working with your
+project easier.
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-wdb \
+       --disable-apache \
+       --disable-python \
+       --disable-perl \
+       --disable-ruby \
+       --disable-java \
+       --disable-csharp \
+       --prefix=/usr
+
+ifeq ($(SDK)$(CONFIG_CLEARSILVER_ENABLE_COMPRESSION),y)
+       CONFIGURE_ARGS+= \
+               --enable-compression
+else
+       CONFIGURE_ARGS+= \
+               --disable-compression
+endif
+
+ifeq ($(SDK)$(CONFIG_CLEARSILVER_ENABLE_REMOTE_DEBUGGER),y)
+       CONFIGURE_ARGS+= \
+               --enable-remote-debugger
+else
+       CONFIGURE_ARGS+= \
+               --disable-remote-debugger
+endif
+
+ifeq ($(SDK)$(CONFIG_CLEARSILVER_ENABLE_GETTEXT),y)
+       CONFIGURE_ARGS+= \
+               --enable-gettext
+else
+       CONFIGURE_ARGS+= \
+               --disable-gettext
+endif
+
+TARGET_CFLAGS+=$(FPIC)
+
+MAKE_FLAGS+= \
+       $(TARGET_CONFIGURE_OPTS) \
+       AR="$(AR) cr" \
+       LD="$(TARGET_CC) -o" \
+       OSTYPE=Linux
+
+define Build/InstallDev
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+define Package/clearsilver/install
+       $(INSTALL_DIR) $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,clearsilver))
diff --git a/libs/clearsilver/patches/001-gcc-vs-dollar-cc.patch b/libs/clearsilver/patches/001-gcc-vs-dollar-cc.patch
new file mode 100644 (file)
index 0000000..fe7191a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/rules.mk.in
++++ b/rules.mk.in
+@@ -158,7 +158,7 @@ Makefile.depends: $(NEOTONIC_ROOT)/rules
+       @touch Makefile.depends
+       @if test "x" != "x$(SOURCE_FILES)"; then \
+         for II in "$(SOURCE_FILES)"; do \
+-              gcc -M -MG ${CFLAGS} $$II >> Makefile.depends; \
++              $(CC) -M -MG ${CFLAGS} $$II >> Makefile.depends; \
+         done; \
+        fi
+       @echo "** (done) "
diff --git a/libs/clearsilver/patches/002-make-install-depends.patch b/libs/clearsilver/patches/002-make-install-depends.patch
new file mode 100644 (file)
index 0000000..978db0b
--- /dev/null
@@ -0,0 +1,99 @@
+--- a/Makefile
++++ b/Makefile
+@@ -35,7 +35,7 @@ cs: output_dir
+         fi; \
+       done
+-install: all
++install:
+       ./mkinstalldirs $(DESTDIR)$(cs_includedir)
+       ./mkinstalldirs $(DESTDIR)$(bindir)
+       ./mkinstalldirs $(DESTDIR)$(libdir)
+--- a/cgi/Makefile
++++ b/cgi/Makefile
+@@ -38,7 +38,7 @@ $(STATIC_CSO): $(STATIC_OBJ) $(DEP_LIBS)
+ $(CGICSTEST_EXE): $(CGICSTEST_OBJ) $(DEP_LIBS)
+       $(LD) $@ $(CGICSTEST_OBJ) $(LDFLAGS) $(DLIBS) $(LIBS)
+-install: all
++install:
+       $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/cgi
+       $(INSTALL) -m 644 cgi.h $(DESTDIR)$(cs_includedir)/cgi
+       $(INSTALL) -m 644 cgiwrap.h $(DESTDIR)$(cs_includedir)/cgi
+--- a/cs/Makefile
++++ b/cs/Makefile
+@@ -89,7 +89,7 @@ test: $(CSTEST_EXE) $(CS_TESTS)
+       @touch test
+       @echo "Passed"
+       
+-install: all
++install:
+       $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/cs
+       $(INSTALL) -m 644 cs.h $(DESTDIR)$(cs_includedir)/cs
+       $(INSTALL) -m 644 $(CS_LIB) $(DESTDIR)$(libdir)
+--- a/dso/Makefile
++++ b/dso/Makefile
+@@ -21,7 +21,7 @@ $(NEO_SO): $(NEO_STATIC_LIBS) $(DEP_LIBS
+ #     $(LDSHARED) -o $@ $(LDFLAGS) -Wl,-whole-archive $(DLIBS)
+-install: all
++install:
+       $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(PYTHON_SITE)
+       $(INSTALL) $(TARGETS) $(DESTDIR)$(PYTHON_SITE)
+--- a/java-jni/Makefile
++++ b/java-jni/Makefile
+@@ -74,7 +74,7 @@ $(NEO_UTIL_SO): $(NEO_UTIL_JAVA_JAR) $(N
+       $(LDSHARED) -o $@ $(LDFLAGS) $(NEO_UTIL_OBJ) $(LIBS)
+ # I guess we'll just stick the .jar file in the lib directory
+-install: all
++install:
+       $(INSTALL) $(NEO_UTIL_SO) $(DESTDIR)$(libdir)
+       $(INSTALL) $(NEO_UTIL_JAVA_JAR) $(DESTDIR)$(libdir)
+--- a/mod_ecs/Makefile
++++ b/mod_ecs/Makefile
+@@ -19,7 +19,7 @@ all: $(TARGETS)
+ $(MOD_ECS_SO): $(MOD_ECS_SRC) $(DEP_LIBS)
+       $(APXS) -c -o $@ $(MOD_ECS_SRC)
+-install: all
++install:
+       $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(libexecdir)
+       $(INSTALL) $(MOD_ECS_SO) $(DESTDIR)$(libexecdir)
+--- a/python/Makefile
++++ b/python/Makefile
+@@ -40,7 +40,7 @@ $(NEO_UTIL_PYD): $(NEO_UTIL_OBJ) $(DEP_L
+               --target=i386-mingw32 \
+               $(LDFLAGS) $(PYTHON_LIB) $(LIBS)
+-install: all
++install:
+       $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(PYTHON_SITE)
+       $(INSTALL) $(TARGETS) $(DESTDIR)$(PYTHON_SITE)
+--- a/ruby/Makefile
++++ b/ruby/Makefile
+@@ -40,7 +40,7 @@ testrb: ext/hdf/hdf.so
+       @echo  "Passed ruby test"
+-install: all
++install:
+       $(RUBY) install.rb install
+ clean:
+--- a/util/Makefile
++++ b/util/Makefile
+@@ -21,7 +21,7 @@ $(UTL_LIB): $(UTL_OBJ)
+       $(AR) $@ $(UTL_OBJ)
+       $(RANLIB) $@
+-install: all
++install:
+       $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/util
+       $(INSTALL) -m 644 $(UTL_HDR) $(DESTDIR)$(cs_includedir)/util
+       $(INSTALL) -m 644 $(UTL_LIB) $(DESTDIR)$(libdir)
diff --git a/libs/clearsilver/patches/003-disable-tests.patch b/libs/clearsilver/patches/003-disable-tests.patch
new file mode 100644 (file)
index 0000000..562dcd8
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/cs/Makefile
++++ b/cs/Makefile
+@@ -24,7 +24,7 @@ CSDUMP_OBJ = $(CSDUMP_SRC:%.c=%.o)
+ LIBS += -lneo_cs -lneo_utl #  -lefence
+-TARGETS = $(CS_LIB) $(CSTEST_EXE) $(CSR_EXE) test
++TARGETS = $(CS_LIB) $(CSTEST_EXE) $(CSR_EXE) # test
+ CS_TESTS = test.cs test2.cs test3.cs test4.cs test5.cs test6.cs test7.cs \
+            test8.cs test9.cs test10.cs test11.cs test12.cs test13.cs \
diff --git a/libs/clearsilver/patches/100-remove_warnings.patch b/libs/clearsilver/patches/100-remove_warnings.patch
new file mode 100644 (file)
index 0000000..cf0605b
--- /dev/null
@@ -0,0 +1,690 @@
+--- a/cgi/cgi.c
++++ b/cgi/cgi.c
+@@ -698,7 +698,7 @@ NEOERR *cgi_parse (CGI *cgi)
+     x = 0;
+     while (x < len)
+     {
+-      if (len-x > sizeof(buf))
++      if (len-x > (int) sizeof(buf))
+       cgiwrap_read (buf, sizeof(buf), &r);
+       else
+       cgiwrap_read (buf, len - x, &r);
+@@ -1363,6 +1363,8 @@ void cgi_neo_error (CGI *cgi, NEOERR *er
+ {
+   STRING str;
++  UNUSED(cgi);
++
+   string_init(&str);
+   cgiwrap_writef("Status: 500\n");
+   cgiwrap_writef("Content-Type: text/html\n\n");
+@@ -1377,6 +1379,8 @@ void cgi_error (CGI *cgi, const char *fm
+ {
+   va_list ap;
++  UNUSED(cgi);
++
+   cgiwrap_writef("Status: 500\n");
+   cgiwrap_writef("Content-Type: text/html\n\n");
+   cgiwrap_writef("<html><body>\nAn error occured:<pre>");
+@@ -1536,6 +1540,8 @@ NEOERR *cgi_cookie_set (CGI *cgi, const
+   STRING str;
+   char my_time[256];
++  UNUSED(cgi);
++
+   if (path == NULL) path = "/";
+   string_init(&str);
+@@ -1584,6 +1590,8 @@ NEOERR *cgi_cookie_set (CGI *cgi, const
+ NEOERR *cgi_cookie_clear (CGI *cgi, const char *name, const char *domain,
+                           const char *path)
+ {
++  UNUSED(cgi);
++
+   if (path == NULL) path = "/";
+   if (domain)
+   {
+--- a/cgi/cgiwrap.c
++++ b/cgi/cgiwrap.c
+@@ -14,6 +14,9 @@
+ #if HAVE_FEATURES_H
+ #include <features.h>
+ #endif
++#ifdef __UCLIBC__
++#include <unistd.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+--- a/cgi/date.c
++++ b/cgi/date.c
+@@ -94,7 +94,7 @@ NEOERR *export_date_tm (HDF *data, const
+   if (err) return nerr_pass(err);
+   err = hdf_set_int_value (obj, "wday", ttm->tm_wday);
+   if (err) return nerr_pass(err);
+-  // neo_tz_offset() returns offset from GMT in seconds
++  /* neo_tz_offset() returns offset from GMT in seconds */
+   tzoffset_seconds = neo_tz_offset(ttm);
+   tzoffset = tzoffset_seconds / 60;
+   if (tzoffset < 0)
+@@ -109,12 +109,12 @@ NEOERR *export_date_tm (HDF *data, const
+   return STATUS_OK;
+ }
+-NEOERR *export_date_time_t (HDF *data, const char *prefix, const char *timezone,
++NEOERR *export_date_time_t (HDF *data, const char *prefix, const char *tz,
+                             time_t tt)
+ {
+   struct tm ttm;
+-  neo_time_expand (tt, timezone, &ttm);
++  neo_time_expand (tt, tz, &ttm);
+   return nerr_pass (export_date_tm (data, prefix, &ttm));
+ }
+--- a/cgi/date.h
++++ b/cgi/date.h
+@@ -17,7 +17,7 @@
+ __BEGIN_DECLS
+ NEOERR *export_date_tm (HDF *obj, const char *prefix, struct tm *ttm);
+-NEOERR *export_date_time_t (HDF *obj, const char *prefix, const char *timezone, 
++NEOERR *export_date_time_t (HDF *obj, const char *prefix, const char *tz,
+                             time_t tt);
+ __END_DECLS
+--- a/cgi/html.c
++++ b/cgi/html.c
+@@ -774,7 +774,7 @@ NEOERR *html_strip_alloc(const char *src
+       }
+       else
+       {
+-        if (ampl < sizeof(amp)-1)
++        if (ampl < (int) sizeof(amp)-1)
+           amp[ampl++] = tolower(src[x]);
+         else
+         {
+--- a/cgi/rfc2388.c
++++ b/cgi/rfc2388.c
+@@ -155,14 +155,14 @@ static NEOERR * _read_line (CGI *cgi, ch
+     ofs = cgi->readlen - cgi->nl;
+     memmove(cgi->buf, cgi->buf + cgi->nl, ofs);
+   }
+-  // Read either as much buffer space as we have left, or up to 
+-  // the amount of data remaining according to Content-Length
+-  // If there is no Content-Length, just use the buffer space, but recognize
+-  // that it might not work on some servers or cgiwrap implementations.
+-  // Some servers will close their end of the stdin pipe, so cgiwrap_read
+-  // will return if we ask for too much.  Techically, not including
+-  // Content-Length is against the HTTP spec, so we should consider failing
+-  // earlier if we don't have a length.
++  /* Read either as much buffer space as we have left, or up to
++   * the amount of data remaining according to Content-Length
++   * If there is no Content-Length, just use the buffer space, but recognize
++   * that it might not work on some servers or cgiwrap implementations.
++   * Some servers will close their end of the stdin pipe, so cgiwrap_read
++   * will return if we ask for too much.  Techically, not including
++   * Content-Length is against the HTTP spec, so we should consider failing
++   * earlier if we don't have a length. */
+   to_read = cgi->buflen - ofs;
+   if (cgi->data_expected && (to_read > cgi->data_expected - cgi->data_read))
+   {
+--- a/cs/csparse.c
++++ b/cs/csparse.c
+@@ -59,7 +59,7 @@ typedef enum
+   ST_DEF = 1<<6,
+   ST_LOOP =  1<<7,
+   ST_ALT = 1<<8,
+-  ST_ESCAPE = 1<<9,
++  ST_ESCAPE = 1<<9
+ } CS_STATE;
+ #define ST_ANYWHERE (ST_EACH | ST_WITH | ST_ELSE | ST_IF | ST_GLOBAL | ST_DEF | ST_LOOP | ST_ALT | ST_ESCAPE)
+@@ -178,7 +178,8 @@ CS_CMDS Commands[] = {
+     escape_parse, escape_eval, 1},
+   {"/escape",    sizeof("/escape")-1,    ST_ESCAPE,     ST_POP,
+     end_parse, skip_eval, 1},
+-  {NULL},
++  {NULL,    0,    0,    0,
++      NULL, NULL, 0}
+ };
+ /* Possible Config.VarEscapeMode values */
+@@ -193,7 +194,7 @@ CS_ESCAPE_MODES EscapeModes[] = {
+   {"html", NEOS_ESCAPE_HTML},
+   {"js",   NEOS_ESCAPE_SCRIPT},
+   {"url",  NEOS_ESCAPE_URL},
+-  {NULL},
++  {NULL,   0}
+ };
+@@ -1154,7 +1155,7 @@ static char *token_list (CSTOKEN *tokens
+     {
+       t = snprintf(p, buflen, "%s%d:%s", i ? "  ":"", i, expand_token_type(tokens[i].type, 0));
+     }
+-    if (t == -1 || t >= buflen) return buf;
++    if (t == -1 || t >= (int) buflen) return buf;
+     buflen -= t;
+     p += t;
+   }
+@@ -2567,6 +2568,9 @@ static NEOERR *else_parse (CSPARSE *pars
+   NEOERR *err;
+   STACK_ENTRY *entry;
++  UNUSED(cmd);
++  UNUSED(arg);
++
+   /* ne_warn ("else"); */
+   err = uListGet (parse->stack, -1, (void *)&entry);
+   if (err != STATUS_OK) return nerr_pass(err);
+@@ -2600,6 +2604,9 @@ static NEOERR *endif_parse (CSPARSE *par
+   NEOERR *err;
+   STACK_ENTRY *entry;
++  UNUSED(cmd);
++  UNUSED(arg);
++
+   /* ne_warn ("endif"); */
+   err = uListGet (parse->stack, -1, (void *)&entry);
+   if (err != STATUS_OK) return nerr_pass(err);
+@@ -2781,6 +2788,9 @@ static NEOERR *end_parse (CSPARSE *parse
+   NEOERR *err;
+   STACK_ENTRY *entry;
++  UNUSED(cmd);
++  UNUSED(arg);
++
+   err = uListGet (parse->stack, -1, (void *)&entry);
+   if (err != STATUS_OK) return nerr_pass(err);
+@@ -2796,6 +2806,8 @@ static NEOERR *include_parse (CSPARSE *p
+   int flags = 0;
+   CSARG arg1, val;
++  UNUSED(cmd);
++
+   memset(&arg1, 0, sizeof(CSARG));
+   if (arg[0] == '!')
+     flags |= CSF_REQUIRED;
+@@ -3511,6 +3523,8 @@ static NEOERR *loop_eval (CSPARSE *parse
+ static NEOERR *skip_eval (CSPARSE *parse, CSTREE *node, CSTREE **next)
+ {
++  UNUSED(parse);
++
+   *next = node->next;
+   return STATUS_OK;
+ }
+@@ -3651,6 +3665,8 @@ static NEOERR * _builtin_subcount(CSPARS
+   int count = 0;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3683,6 +3699,8 @@ static NEOERR * _builtin_str_length(CSPA
+   NEOERR *err;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3706,6 +3724,8 @@ static NEOERR * _builtin_str_crc(CSPARSE
+   NEOERR *err;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3731,6 +3751,8 @@ static NEOERR * _builtin_str_find(CSPARS
+   char *substr = NULL;
+   char *pstr = NULL;
++  UNUSED(csf);
++
+   result->op_type = CS_TYPE_NUM;
+   result->n = -1;
+@@ -3758,6 +3780,8 @@ static NEOERR * _builtin_name(CSPARSE *p
+   HDF *obj;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3790,6 +3814,8 @@ static NEOERR * _builtin_first(CSPARSE *
+   char *c;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3819,6 +3845,8 @@ static NEOERR * _builtin_last(CSPARSE *p
+   char *c;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3853,6 +3881,8 @@ static NEOERR * _builtin_abs (CSPARSE *p
+   int n1 = 0;
+   CSARG val;
++  UNUSED(csf);
++
+   memset(&val, 0, sizeof(val));
+   err = eval_expr(parse, args, &val);
+   if (err) return nerr_pass(err);
+@@ -3873,6 +3903,8 @@ static NEOERR * _builtin_max (CSPARSE *p
+   long int n1 = 0;
+   long int n2 = 0;
++  UNUSED(csf);
++
+   result->op_type = CS_TYPE_NUM;
+   result->n = 0;
+@@ -3891,6 +3923,8 @@ static NEOERR * _builtin_min (CSPARSE *p
+   long int n1 = 0;
+   long int n2 = 0;
++  UNUSED(csf);
++
+   result->op_type = CS_TYPE_NUM;
+   result->n = 0;
+@@ -3910,6 +3944,8 @@ static NEOERR * _builtin_str_slice (CSPA
+   long int e = 0;
+   size_t len;
++  UNUSED(csf);
++
+   result->op_type = CS_TYPE_STRING;
+   result->s = "";
+@@ -3921,9 +3957,9 @@ static NEOERR * _builtin_str_slice (CSPA
+   if (b < 0 && e == 0) e = len;
+   if (b < 0) b += len;
+   if (e < 0) e += len;
+-  if (e > len) e = len;
++  if (e > (int) len) e = len;
+   /* Its the whole string */
+-  if (b == 0 && e == len)
++  if (b == 0 && e == (int) len)
+   {
+     result->s = s;
+     result->alloc = 1;
+@@ -4179,10 +4215,10 @@ static NEOERR *cs_init_internal (CSPARSE
+     my_parse->global_hdf = parent->global_hdf;
+     my_parse->fileload = parent->fileload;
+     my_parse->fileload_ctx = parent->fileload_ctx;
+-    // This should be safe since locals handling is done entirely local to the
+-    // eval functions, not globally by the parse handling.  This should
+-    // pass the locals down to the new parse context to make locals work with
+-    // lvar
++    /* This should be safe since locals handling is done entirely local to the
++     * eval functions, not globally by the parse handling.  This should
++     * pass the locals down to the new parse context to make locals work with
++     * lvar */
+     my_parse->locals = parent->locals;
+     my_parse->parent = parent;
+--- a/util/dict.c
++++ b/util/dict.c
+@@ -87,6 +87,8 @@ static NEOERR *dictNewItem(dictCtx dict,
+ {
+   dictItemPtr my_item;
++  UNUSED(dict);
++
+   if (item != NULL)
+     *item = NULL;
+--- a/util/neo_date.h
++++ b/util/neo_date.h
+@@ -17,10 +17,10 @@
+ __BEGIN_DECLS
+ /* UTC time_t -> struct tm in local timezone */
+-void neo_time_expand (const time_t tt, const char *timezone, struct tm *ttm);
++void neo_time_expand (const time_t tt, const char *tz, struct tm *ttm);
+ /* local timezone struct tm -> time_t UTC */
+-time_t neo_time_compact (struct tm *ttm, const char *timezone);
++time_t neo_time_compact (struct tm *ttm, const char *tz);
+ /* To be portable... in seconds */
+ long neo_tz_offset(struct tm *ttm);
+--- a/util/neo_files.c
++++ b/util/neo_files.c
+@@ -35,7 +35,7 @@ NEOERR *ne_mkdirs (const char *path, mod
+   strncpy (mypath, path, sizeof(mypath));
+   x = strlen(mypath);
+-  if ((x < sizeof(mypath)) && (mypath[x-1] != '/'))
++  if ((x < (int) sizeof(mypath)) && (mypath[x-1] != '/'))
+   {
+     mypath[x] = '/';
+     mypath[x+1] = '\0';
+--- a/util/neo_hash.c
++++ b/util/neo_hash.c
+@@ -57,7 +57,7 @@ void ne_hash_destroy (NE_HASH **hash)
+   my_hash = *hash;
+-  for (x = 0; x < my_hash->size; x++)
++  for (x = 0; x < (int) my_hash->size; x++)
+   {
+     node = my_hash->nodes[x];
+     while (node)
+@@ -111,16 +111,16 @@ void *ne_hash_lookup(NE_HASH *hash, void
+ void *ne_hash_remove(NE_HASH *hash, void *key)
+ {
+-  NE_HASHNODE **node, *remove;
++  NE_HASHNODE **node, *rem;
+   void *value = NULL;
+   node = _hash_lookup_node(hash, key, NULL);
+   if (*node)
+   {
+-    remove = *node;
+-    *node = remove->next;
+-    value = remove->value;
+-    free(remove);
++    rem = *node;
++    *node = rem->next;
++    value = rem->value;
++    free(rem);
+     hash->num--;
+   }
+   return value;
+@@ -233,7 +233,7 @@ static NEOERR *_hash_resize(NE_HASH *has
+   hash->size = hash->size*2;
+   /* Initialize new parts */
+-  for (x = orig_size; x < hash->size; x++)
++  for (x = orig_size; x < (int) hash->size; x++)
+   {
+     hash->nodes[x] = NULL;
+   }
+@@ -248,7 +248,7 @@ static NEOERR *_hash_resize(NE_HASH *has
+        entry; 
+        entry = prev ? prev->next : hash->nodes[x]) 
+     {
+-      if ((entry->hashv & hash_mask) != x)
++      if ((int) (entry->hashv & hash_mask) != x)
+       {
+       if (prev)
+       {
+--- a/util/neo_hdf.c
++++ b/util/neo_hdf.c
+@@ -54,7 +54,7 @@ static UINT32 hash_hdf_hash(const void *
+ }
+ static NEOERR *_alloc_hdf (HDF **hdf, const char *name, size_t nlen, 
+-                           const char *value, int dup, int wf, HDF *top)
++                           const char *value, int dupl, int wf, HDF *top)
+ {
+   *hdf = calloc (1, sizeof (HDF));
+   if (*hdf == NULL)
+@@ -80,7 +80,7 @@ static NEOERR *_alloc_hdf (HDF **hdf, co
+   }
+   if (value != NULL)
+   {
+-    if (dup)
++    if (dupl)
+     {
+       (*hdf)->alloc_value = 1;
+       (*hdf)->value = strdup(value);
+@@ -233,7 +233,7 @@ static int _walk_hdf (HDF *hdf, const ch
+   n = name;
+   s = strchr (n, '.');
+-  x = (s == NULL) ? strlen(n) : s - n;
++  x = (s == NULL) ? (int) strlen(n) : s - n;
+   while (1)
+   {
+@@ -279,7 +279,7 @@ static int _walk_hdf (HDF *hdf, const ch
+     }
+     n = s + 1;
+     s = strchr (n, '.');
+-    x = (s == NULL) ? strlen(n) : s - n;
++    x = (s == NULL) ? (int) strlen(n) : s - n;
+   } 
+   if (hp->link)
+   {
+@@ -570,7 +570,7 @@ NEOERR* _hdf_hash_level(HDF *hdf)
+ }
+ static NEOERR* _set_value (HDF *hdf, const char *name, const char *value, 
+-                           int dup, int wf, int link, HDF_ATTR *attr, 
++                           int dupl, int wf, int lnk, HDF_ATTR *attr, 
+                            HDF **set_node)
+ {
+   NEOERR *err;
+@@ -615,7 +615,7 @@ static NEOERR* _set_value (HDF *hdf, con
+       hdf->alloc_value = 0;
+       hdf->value = NULL;
+     }
+-    else if (dup)
++    else if (dupl)
+     {
+       hdf->alloc_value = 1;
+       hdf->value = strdup(value);
+@@ -650,7 +650,7 @@ static NEOERR* _set_value (HDF *hdf, con
+     strcpy(new_name, hdf->value);
+     strcat(new_name, ".");
+     strcat(new_name, name);
+-    err = _set_value (hdf->top, new_name, value, dup, wf, link, attr, set_node);
++    err = _set_value (hdf->top, new_name, value, dupl, wf, lnk, attr, set_node);
+     free(new_name);
+     return nerr_pass(err);
+   }
+@@ -719,8 +719,8 @@ skip_search:
+       }
+       else
+       {
+-      err = _alloc_hdf (&hp, n, x, value, dup, wf, hdf->top);
+-      if (link) hp->link = 1;
++      err = _alloc_hdf (&hp, n, x, value, dupl, wf, hdf->top);
++      if (lnk) hp->link = 1;
+       else hp->link = 0;
+       hp->attr = attr;
+       }
+@@ -770,7 +770,7 @@ skip_search:
+         hp->alloc_value = 0;
+         hp->value = NULL;
+       }
+-      else if (dup)
++      else if (dupl)
+       {
+         hp->alloc_value = 1;
+         hp->value = strdup(value);
+@@ -784,7 +784,7 @@ skip_search:
+         hp->value = (char *)value;
+       }
+       }
+-      if (link) hp->link = 1;
++      if (lnk) hp->link = 1;
+       else hp->link = 0;
+     }
+     else if (hp->link) 
+@@ -796,7 +796,7 @@ skip_search:
+       }
+       strcpy(new_name, hp->value);
+       strcat(new_name, s);
+-      err = _set_value (hdf->top, new_name, value, dup, wf, link, attr, set_node);
++      err = _set_value (hdf->top, new_name, value, dupl, wf, lnk, attr, set_node);
+       free(new_name);
+       return nerr_pass(err);
+     }
+@@ -1267,6 +1267,8 @@ NEOERR* hdf_dump(HDF *hdf, const char *p
+ NEOERR* hdf_dump_format (HDF *hdf, int lvl, FILE *fp)
+ {
++  UNUSED(lvl);
++
+   return nerr_pass(hdf_dump_cb(hdf, "", DUMP_TYPE_PRETTY, 0, fp, _fp_dump_cb));
+ }
+@@ -1357,7 +1359,7 @@ static int _copy_line (const char **s, c
+   int x = 0;
+   const char *st = *s;
+-  while (*st && x < buf_len-1)
++  while (*st && x < (int) buf_len-1)
+   {
+     buf[x++] = *st;
+     if (*st++ == '\n') break;
+@@ -1398,17 +1400,17 @@ static NEOERR *_copy_line_advance(const
+ char *_strndup(const char *s, int len) {
+   int x;
+-  char *dup; 
++  char *t;
+   if (s == NULL) return NULL;
+-  dup = (char *) malloc(len+1);
+-  if (dup == NULL) return NULL;
++  t = (char *) malloc(len+1);
++  if (t == NULL) return NULL;
+   for (x = 0; x < len && s[x]; x++)
+   {
+-    dup[x] = s[x];
++    t[x] = s[x];
+   }
+-  dup[x] = '\0';
+-  dup[len] = '\0';
+-  return dup;
++  t[x] = '\0';
++  t[len] = '\0';
++  return t;
+ }
+ /* attributes are of the form [key1, key2, key3=value, key4="repr"] */
+--- a/util/neo_misc.c
++++ b/util/neo_misc.c
+@@ -34,7 +34,7 @@ void ne_vwarn (const char *fmt, va_list
+   localtime_r(&now, &my_tm);
+-  strftime(tbuf, sizeof(tbuf), "%m/%d %T", &my_tm);
++  strftime(tbuf, sizeof(tbuf), "%m/%d %H:%M:%S", &my_tm);
+   vsnprintf (buf, sizeof(buf), fmt, ap);
+   len = strlen(buf);
+--- a/util/neo_misc.h
++++ b/util/neo_misc.h
+@@ -106,6 +106,10 @@ typedef char BOOL;
+ #define MIN(x,y)        (((x) < (y)) ? (x) : (y))
+ #endif
++#ifndef UNUSED
++#define UNUSED(x)        ((void)(x))
++#endif
++
+ #ifndef TRUE
+ #define TRUE 1
+ #endif
+--- a/util/neo_net.c
++++ b/util/neo_net.c
+@@ -489,7 +489,7 @@ static NEOERR *_ne_net_read_int(NSOCK *s
+   char buf[32];
+   char *ep = NULL;
+-  while (x < sizeof(buf))
++  while (x < (int) sizeof(buf))
+   {
+     while (sock->il - sock->ib > 0)
+     {
+--- a/util/neo_server.c
++++ b/util/neo_server.c
+@@ -104,6 +104,8 @@ static int ShutdownPending = 0;
+ static void sig_term(int sig)
+ {
++  UNUSED(sig);
++
+   ShutdownPending = 1;
+   ne_net_shutdown();
+ }
+--- a/util/neo_str.c
++++ b/util/neo_str.c
+@@ -592,11 +592,11 @@ char *repr_string_alloc (const char *s)
+   return rs;
+ }
+-// List of all characters that must be escaped
+-// List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
++/* List of all characters that must be escaped
++ * List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm */
+ static char EscapedChars[] = "$&+,/:;=?@ \"<>#%{}|\\^~[]`'";
+-// Check if a single character needs to be escaped
++/* Check if a single character needs to be escaped */
+ static BOOL is_reserved_char(char c)
+ {
+   int i = 0;
+@@ -835,15 +835,15 @@ NEOERR *neos_url_validate (const char *i
+   colonpos = memchr(in, ':', i);
+   if (colonpos == NULL) {
+-    // no scheme in 'in': so this is a relative url
++    /* no scheme in 'in': so this is a relative url */
+     valid = 1;
+   }
+   else {
+-    for (i = 0; i < num_protocols; i++)
++    for (i = 0; (int) i < num_protocols; i++)
+     {
+       if ((inlen >= strlen(URL_PROTOCOLS[i])) && 
+           strncmp(in, URL_PROTOCOLS[i], strlen(URL_PROTOCOLS[i])) == 0) {
+-        // 'in' starts with one of the allowed protocols
++        /* 'in' starts with one of the allowed protocols */
+         valid = 1;
+         break;
+       }
+@@ -854,7 +854,7 @@ NEOERR *neos_url_validate (const char *i
+   if (valid)
+     return neos_html_escape(in, inlen, esc);
+-  // 'in' contains an unsupported scheme, replace with '#' 
++  /* 'in' contains an unsupported scheme, replace with '#' */
+   string_init(&out_s);
+   err = string_append (&out_s, "#");
+   if (err) return nerr_pass (err);
+--- a/util/skiplist.c
++++ b/util/skiplist.c
+@@ -409,7 +409,7 @@ NEOERR *skipNewList(skipList *skip, int
+     if (err != STATUS_OK) break;
+     for(i = 0;                                       /* init header and tail */
+-        i <= list->maxLevel;
++        i <= (UINT32) list->maxLevel;
+         i++) {
+       list->tail->next[i] = NULL;
+       list->header->next[i] = list->tail;
+@@ -444,7 +444,7 @@ static void skipFreeAllItems(skipList li
+   }
+                                                     /* clear header pointers */
+   for(i = 0;
+-      i <= list->maxLevel;
++      i <= (UINT32) list->maxLevel;
+       i++)
+     list->header->next[i] = list->tail;
diff --git a/libs/clearsilver/patches/101-fix_content_type_ff3.patch b/libs/clearsilver/patches/101-fix_content_type_ff3.patch
new file mode 100644 (file)
index 0000000..95eb5b6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/cgi/cgi.c
++++ b/cgi/cgi.c
+@@ -640,7 +640,7 @@ NEOERR *cgi_parse (CGI *cgi)
+   if (!strcmp(method, "POST"))
+   {
+-    if (type && !strcmp(type, "application/x-www-form-urlencoded"))
++    if (type && !strncmp(type, "application/x-www-form-urlencoded", 33))
+     {
+       err = _parse_post_form(cgi);
+       if (err != STATUS_OK) return nerr_pass (err);
diff --git a/libs/clearsilver/patches/102-add_x_requested_http_headers.patch b/libs/clearsilver/patches/102-add_x_requested_http_headers.patch
new file mode 100644 (file)
index 0000000..51cbbfe
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/cgi/cgi.c
++++ b/cgi/cgi.c
+@@ -201,6 +201,8 @@ struct _http_vars
+   {"HTTP_IF_MODIFIED_SINCE", "IfModifiedSince"},
+   {"HTTP_REFERER", "Referer"},
+   {"HTTP_VIA", "Via"},
++  {"HTTP_X_REQUESTED_WITH", "XRequestedWith"},
++  {"HTTP_X_REQUESTED_HANDLER", "XRequestedHandler"},  
+   /* SOAP */
+   {"HTTP_SOAPACTION", "Soap.Action"},
+   {NULL, NULL}
diff --git a/libs/clinkc/Makefile b/libs/clinkc/Makefile
new file mode 100644 (file)
index 0000000..73fa014
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2006 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:=clinkc
+PKG_VERSION:=101
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/clinkc/
+PKG_MD5SUM:=4c8ac54a15da47203a86daf77fbc2664
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/CyberLinkC
+
+PKG_BUILD_DEPENDS:=libexpat
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libclinkc
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libexpat
+  TITLE:=Embedded UPnP library
+  URL:=http://sourceforge.net/projects/clinkc
+endef
+
+define Package/libclinkc/description
+CyberLink for C is a UPnP library using C for small and embedded platforms.
+endef
+
+# uses GNU configure
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       chmod +x $(PKG_BUILD_DIR)/config/install-sh
+       $(call Build/Compile/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/cybergarage $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libclinkc.a $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libclinkc))
diff --git a/libs/confuse/Makefile b/libs/confuse/Makefile
new file mode 100644 (file)
index 0000000..b66f987
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2006-2010 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:=confuse
+PKG_VERSION:=2.6
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://bzero.se/confuse
+PKG_MD5SUM:=0e883d66f0f58fc33585b430c652aa30
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/confuse
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libConfuse is a configuration file parser library
+  URL:=http://www.nongnu.org/confuse/
+endef
+
+define Package/confuse/description
+       libConfuse is a configuration file parser library, licensed under the
+       terms of the ISC license, and written in C. It supports sections and
+       (lists of) values (strings, integers, floats, booleans or other
+       sections), as well as some other features (such as single/double-quoted
+       strings, environment variable expansion, functions and nested include
+       statements). It makes it very easy to add configuration file capability
+       to a program using a simple API.
+
+       The goal of libConfuse is not to be the configuration file parser
+       library with a gazillion of features. Instead, it aims to be easy to use
+       and quick to integrate with your code. libConfuse was called libcfg
+       before, but was changed to not confuse with other similar libraries.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-rpath \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+
+MAKE_FLAGS += \
+       -C $(PKG_BUILD_DIR)/src \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       all install \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/confuse.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libconfuse.{a,so*} $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/*.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Build/UninstallDev
+       rm -rf \
+       $(STAGING_DIR)/usr/include/confuse.h \
+       $(STAGING_DIR)/usr/lib/libconfuse.{a,so*}
+endef
+
+define Package/confuse/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libconfuse.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,confuse))
diff --git a/libs/confuse/patches/001-no_werror.patch b/libs/confuse/patches/001-no_werror.patch
new file mode 100644 (file)
index 0000000..a6a7dc4
--- /dev/null
@@ -0,0 +1,24 @@
+diff -urN confuse-2.6/src/Makefile.am confuse-2.6.new/src/Makefile.am
+--- confuse-2.6/src/Makefile.am        2007-10-13 13:18:28.000000000 +0200
++++ confuse-2.6.new/src/Makefile.am    2009-06-18 18:00:02.000000000 +0200
+@@ -10,7 +10,7 @@
+ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+ if cc_is_gcc
+-AM_CFLAGS=-Wall -Werror
++AM_CFLAGS=-Wall
+ endif
+ LIBS = @LIBS@
+diff -urN confuse-2.6/src/Makefile.in confuse-2.6.new/src/Makefile.in
+--- confuse-2.6/src/Makefile.in        2007-12-29 11:56:12.000000000 +0100
++++ confuse-2.6.new/src/Makefile.in    2009-06-18 17:59:55.000000000 +0200
+@@ -196,7 +196,7 @@
+ libconfuse_la_SOURCES = confuse.c lexer.l
+ libconfuse_la_LIBADD = $(LTLIBINTL)
+ include_HEADERS = confuse.h
+-@cc_is_gcc_TRUE@AM_CFLAGS = -Wall -Werror
++@cc_is_gcc_TRUE@AM_CFLAGS = -Wall
+ CLEANFILES = *~ \#*\#
+ AM_LFLAGS = -Pcfg_yy -olex.yy.c
+ all: all-am
diff --git a/libs/credis/Makefile b/libs/credis/Makefile
new file mode 100644 (file)
index 0000000..3fea0cc
--- /dev/null
@@ -0,0 +1,51 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=credis
+PKG_VERSION:=0.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://credis.googlecode.com/files/
+PKG_MD5SUM:=bbc498beb22b8590005520405766cf6e
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/credis
+  SECTION:=libs
+  CATEGORY:=Libraries
+       TITLE:=C library for communicating with Redis servers.
+  URL:=http://code.google.com/p/credis
+endef
+
+define Package/credis/description
+ Credis is a client library in plain C for communicating with Redis
+ servers. Redis is a high performance key-value database, refer to
+ Redis project page for more information. Credis aims to be fast
+ and minimalistic with respect to memory usage. It supports
+ connections to multiple Redis servers.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC='$(TARGET_CC)' \
+               CFLAGS='$(TARGET_CFLAGS)' \
+               LDFLAGS='$(TARGET_LDFLAGS)' \
+               AR='$(TARGET_CROSS)ar' \
+               all
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/credis.h $(1)/usr/include/credis.h
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libcredis.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/credis/install
+       $(INSTALL_DIR)  $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libcredis.so $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,credis))
diff --git a/libs/credis/patches/200-Makefile.patch b/libs/credis/patches/200-Makefile.patch
new file mode 100644 (file)
index 0000000..177a809
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/Makefile 2010-05-19 22:50:09.000000000 +0200
++++ b/Makefile 2010-06-22 09:59:16.000000000 +0200
+@@ -1,9 +1,9 @@
+-CFLAGS = -g -O2 -Wall
+-LDFLAGS =
++CFLAGS += -g -O2 -Wall
++LDFLAGS +=
+ #CPPFLAGS = -DPRINTDEBUG
+ # build shared lib under OS X or Linux
+-OS = $(shell uname -s)
++OS = Linux
+ ifeq ($(OS),Darwin)
+       SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
+ else
diff --git a/libs/cyrus-sasl/Makefile b/libs/cyrus-sasl/Makefile
new file mode 100644 (file)
index 0000000..e184125
--- /dev/null
@@ -0,0 +1,111 @@
+#
+# Copyright (C) 2006-2008 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:=cyrus-sasl
+PKG_VERSION:=2.1.23
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ftp.andrew.cmu.edu/pub/cyrus-mail/
+PKG_MD5SUM:=2eb0e48106f0e9cd8001e654f267ecbc
+
+PKG_LICENSE:=BSD-4c BSD
+PKG_LICENSE_FILES:=COPYING cmulocal/COPYING saslauthd/COPYING
+
+PKG_BUILD_DEPENDS:=libopenssl
+
+PKG_FIXUP:=autoreconf
+PKG_MACRO_PATHS:=cmulocal config ../cmulocal ../config
+PKG_AUTOMAKE_PATHS:=. saslauthd sasldb
+PKG_REMOVE_FILES:=aclocal.m4 saslauthd/aclocal.m4 config/libtool.m4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libsasl2
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A general purpose authentication library
+  URL:=http://asg.web.cmu.edu/sasl/
+endef
+
+TARGET_CFLAGS += $(FPIC)
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-sample \
+       --enable-staticdlopen \
+       --disable-java \
+       --disable-alwaystrue \
+       --disable-checkapop \
+       --enable-cram \
+       --enable-digest \
+       --without-auth-sasldb \
+       --disable-otp \
+       --disable-srp \
+       --disable-srp-setpass \
+       --disable-krb4 \
+       --disable-gssapi \
+       --disable-gss_mutexes \
+       --enable-plain \
+       --enable-anon \
+       --disable-login \
+       --disable-ntlm \
+       --disable-sql \
+       --disable-ldapdb \
+       --without-dblib \
+       --without-gdbm \
+       --with-devrandom="/dev/urandom" \
+       --without-pam \
+       --without-saslauthd \
+       --without-authdaemond \
+       --without-pwcheck \
+       --with-ipctype=unix \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --without-des \
+       --without-opie \
+       --without-ldap \
+       --without-mysql \
+       --without-pgsql \
+       --without-sqlite \
+       --without-rc4 \
+       --without-dmalloc \
+       --without-sfio \
+       --disable-sample
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/include \
+               CC="$(HOSTCC)" \
+               LINK="$(HOSTCC) -o makemd5 -lc" \
+               CFLAGS="" \
+               CPPFLAGS="" \
+               makemd5
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/sasl $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsasl2.{a,so*} $(1)/usr/lib/
+       ln -sf libsasl2.a $(1)/usr/lib/libsasl.a
+       ln -sf libsasl2.so $(1)/usr/lib/libsasl.so
+       $(INSTALL_DIR) $(1)/usr/lib/sasl2
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sasl2/lib*.{a,so*} $(1)/usr/lib/sasl2/
+endef
+
+define Package/libsasl2/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsasl2.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/sasl2
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sasl2/lib*.so.* $(1)/usr/lib/sasl2/
+endef
+
+$(eval $(call BuildPackage,libsasl2))
diff --git a/libs/cyrus-sasl/patches/001-automake-compat.patch b/libs/cyrus-sasl/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..d6a4808
--- /dev/null
@@ -0,0 +1,125 @@
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -44,6 +44,7 @@
+ sasl_version = 2:23:0
+ INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/plugins -I$(top_builddir)/include -I$(top_srcdir)/sasldb
++SASL_STATIC_SRC = $(patsubst %.o, %.c, $(SASL_STATIC_OBJS))
+ EXTRA_DIST = windlopen.c staticopen.h NTMakefile
+ EXTRA_LIBRARIES = libsasl2.a
+@@ -93,7 +94,7 @@ libsasl2.a: libsasl2.la $(SASL_STATIC_OB
+       rm -f $@
+       ln -s .libs/$@ $@
+-$(SASL_STATIC_OBJS): linksrcs
++$(SASL_STATIC_SRC): linksrcs
+ linksrcs:
+       -ln -s $(SASL_STATIC_SRCS) .
+--- a/lib/Makefile.in
++++ b/lib/Makefile.in
+@@ -176,6 +176,7 @@ SASL_KRB_LIB = @SASL_KRB_LIB@
+ SASL_MECHS = @SASL_MECHS@
+ SASL_STATIC_LIBS = @SASL_STATIC_LIBS@
+ SASL_STATIC_OBJS = @SASL_STATIC_OBJS@
++SASL_STATIC_SRC = $(patsubst %.o, %.c, $(SASL_STATIC_OBJS)) 
+ SASL_STATIC_SRCS = @SASL_STATIC_SRCS@
+ SASL_UTIL_HEADERS_EXTRA = @SASL_UTIL_HEADERS_EXTRA@
+ SASL_UTIL_LIBS_EXTRA = @SASL_UTIL_LIBS_EXTRA@
+@@ -646,7 +647,7 @@ libsasl2.a: libsasl2.la $(SASL_STATIC_OB
+       rm -f $@
+       ln -s .libs/$@ $@
+-$(SASL_STATIC_OBJS): linksrcs
++$(SASL_STATIC_SRC): linksrcs
+ linksrcs:
+       -ln -s $(SASL_STATIC_SRCS) .
+--- a/plugins/Makefile.am
++++ b/plugins/Makefile.am
+@@ -82,12 +82,12 @@ EXTRA_LTLIBRARIES = libplain.la libanony
+       libntlm.la libpassdss.la libsasldb.la libsql.la libldapdb.la
+ libplain_la_SOURCES = plain.c plain_init.c $(common_sources)
+-libplain_la_LDFLAGS = -version-info $(plain_version)
++libplain_la_LDFLAGS = -version-info $(plain_version) $(AM_LDFLAGS)
+ libplain_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libplain_la_LIBADD = $(PLAIN_LIBS) $(COMPAT_OBJS)
+ libanonymous_la_SOURCES = anonymous.c anonymous_init.c $(common_sources)
+-libanonymous_la_LDFLAGS = -version-info $(anonymous_version)
++libanonymous_la_LDFLAGS = -version-info $(anonymous_version) $(AM_LDFLAGS)
+ libanonymous_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libanonymous_la_LIBADD = $(COMPAT_OBJS)
+@@ -97,58 +97,58 @@ libkerberos4_la_DEPENDENCIES = $(COMPAT_
+ libkerberos4_la_LIBADD = $(SASL_KRB_LIB) $(LIB_SOCKET) $(COMPAT_OBJS)
+ libgssapiv2_la_SOURCES = gssapi.c gssapiv2_init.c $(common_sources)
+-libgssapiv2_la_LDFLAGS = -version-info $(gssapiv2_version)
++libgssapiv2_la_LDFLAGS = -version-info $(gssapiv2_version) $(AM_LDFLAGS)
+ libgssapiv2_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libgssapiv2_la_LIBADD = $(GSSAPIBASE_LIBS) $(GSSAPI_LIBS) $(LIB_SOCKET) $(COMPAT_OBJS)
+ libcrammd5_la_SOURCES = cram.c crammd5_init.c $(common_sources)
+-libcrammd5_la_LDFLAGS = -version-info $(crammd5_version)
++libcrammd5_la_LDFLAGS = -version-info $(crammd5_version) $(AM_LDFLAGS)
+ libcrammd5_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libcrammd5_la_LIBADD = $(COMPAT_OBJS)
+ libdigestmd5_la_SOURCES = digestmd5.c digestmd5_init.c $(common_sources)
+-libdigestmd5_la_LDFLAGS = -version-info $(digestmd5_version)
++libdigestmd5_la_LDFLAGS = -version-info $(digestmd5_version) $(AM_LDFLAGS)
+ libdigestmd5_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libdigestmd5_la_LIBADD = $(LIB_DES) $(LIB_SOCKET) $(COMPAT_OBJS)
+ liblogin_la_SOURCES = login.c login_init.c $(common_sources)
+-liblogin_la_LDFLAGS = -version-info $(login_version)
++liblogin_la_LDFLAGS = -version-info $(login_version) $(AM_LDFLAGS)
+ liblogin_la_DEPENDENCIES = $(COMPAT_OBJS)
+ liblogin_la_LIBADD = $(PLAIN_LIBS) $(COMPAT_OBJS)
+ libsrp_la_SOURCES = srp.c srp_init.c $(common_sources)
+-libsrp_la_LDFLAGS = -version-info $(srp_version)
++libsrp_la_LDFLAGS = -version-info $(srp_version) $(AM_LDFLAGS)
+ libsrp_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libsrp_la_LIBADD = $(SRP_LIBS) $(COMPAT_OBJS)
+ libotp_la_SOURCES = otp.c otp_init.c otp.h $(common_sources)
+-libotp_la_LDFLAGS = -version-info $(otp_version)
++libotp_la_LDFLAGS = -version-info $(otp_version) $(AM_LDFLAGS)
+ libotp_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libotp_la_LIBADD = $(OTP_LIBS) $(COMPAT_OBJS)
+ libntlm_la_SOURCES = ntlm.c ntlm_init.c $(common_sources)
+-libntlm_la_LDFLAGS = -version-info $(ntlm_version)
++libntlm_la_LDFLAGS = -version-info $(ntlm_version) $(AM_LDFLAGS)
+ libntlm_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libntlm_la_LIBADD = $(NTLM_LIBS) $(COMPAT_OBJS)
+ libpassdss_la_SOURCES = passdss.c passdss_init.c $(common_sources)
+-libpassdss_la_LDFLAGS = -version-info $(passdss_version)
++libpassdss_la_LDFLAGS = -version-info $(passdss_version) $(AM_LDFLAGS)
+ libpassdss_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libpassdss_la_LIBADD = $(PASSDSS_LIBS) $(COMPAT_OBJS)
+ # Auxprop Plugins
+ libsasldb_la_SOURCES = sasldb.c sasldb_init.c $(common_sources)
+-libsasldb_la_LDFLAGS = -version-info $(sasldb_version)
++libsasldb_la_LDFLAGS = -version-info $(sasldb_version) $(AM_LDFLAGS)
+ libsasldb_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libsasldb_la_LIBADD = ../sasldb/libsasldb.la $(SASL_DB_LIB) $(COMPAT_OBJS)
+ libldapdb_la_SOURCES = ldapdb.c ldapdb_init.c $(common_sources)
+-libldapdb_la_LDFLAGS = $(LIB_LDAP) -version-info $(ldapdb_version)
++libldapdb_la_LDFLAGS = $(LIB_LDAP) -version-info $(ldapdb_version) $(AM_LDFLAGS)
+ libldapdb_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libldapdb_la_LIBADD = $(COMPAT_OBJS)
+ libsql_la_SOURCES = sql.c sql_init.c $(common_sources)
+-libsql_la_LDFLAGS = $(LIB_MYSQL) $(LIB_PGSQL) $(LIB_SQLITE) -version-info $(sql_version)
++libsql_la_LDFLAGS = $(LIB_MYSQL) $(LIB_PGSQL) $(LIB_SQLITE) -version-info $(sql_version) $(AM_LDFLAGS)
+ libsql_la_DEPENDENCIES = $(COMPAT_OBJS)
+ libsql_la_LIBADD = $(COMPAT_OBJS)
diff --git a/libs/cyrus-sasl/patches/200-fix_avr32_compile.patch b/libs/cyrus-sasl/patches/200-fix_avr32_compile.patch
new file mode 100644 (file)
index 0000000..4058a7b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/config/config.sub
++++ b/config/config.sub
+@@ -241,7 +241,7 @@ case $basic_machine in
+               | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \
+               | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
+               | v850 | c4x \
+-              | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
++              | thumb | d10v | d30v | fr30 | avr | avr32 | openrisc | tic80 \
+               | pj | pjl | h8500 | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
diff --git a/libs/dbus-glib/Makefile b/libs/dbus-glib/Makefile
new file mode 100644 (file)
index 0000000..8a79f98
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2007-2009 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:=dbus-glib
+PKG_VERSION:=0.80
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://dbus.freedesktop.org/releases/dbus-glib/
+PKG_MD5SUM:=86ea60ba2118a1b9deafe8257f6a6a1a
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+
+define Package/libdbus-glib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=D-Bus Glib bindings
+  URL:=http://dbus.freedesktop.org/doc/dbus-glib/
+  DEPENDS:=+libdbus +glib2 $(ICONV_DEPENDS) $(INTL_DEPENDS)
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-tests \
+       --disable-xml-docs \
+       --disable-doxygen-docs \
+
+CONFIGURE_VARS+= \
+       ac_cv_func_posix_getpwnam_r="yes" \
+       ac_cv_have_abstract_sockets="yes" \
+       CPPFLAGS="$$$$CPPFLAGS -I$(ICONV_PREFIX)/include" \
+       CPPFLAGS="$$$$CPPFLAGS -I$(INTL_PREFIX)/include" \
+       LDFLAGS="$$$$LDFLAGS -L$(ICONV_PREFIX)/lib" \
+       LDFLAGS="$$$$LDFLAGS -L$(INTL_PREFIX)/lib" \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/dbus-1.0/dbus
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/dbus-1.0/dbus/*.h \
+               $(1)/usr/include/dbus-1.0/dbus/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libdbus-glib-1.{la,a,so*} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/dbus-glib-1.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libdbus-glib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdbus-glib-1.so.* $(1)/usr/lib/
+endef
+
+
+$(eval $(call BuildPackage,libdbus-glib))
diff --git a/libs/dbus-glib/patches/001-cross.patch b/libs/dbus-glib/patches/001-cross.patch
new file mode 100644 (file)
index 0000000..486782d
--- /dev/null
@@ -0,0 +1,96 @@
+--- a/dbus/Makefile.in
++++ b/dbus/Makefile.in
+@@ -315,7 +315,7 @@ target_vendor = @target_vendor@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = . examples
++SUBDIRS = .
+ INCLUDES = \
+       -I$(top_srcdir)                                         \
+       -I$(top_builddir)                                       \
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -267,8 +267,8 @@ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ GLIB_PC = dbus-glib-1.pc
+-SUBDIRS = dbus tools test doc
+-DIST_SUBDIRS = dbus tools test doc m4
++SUBDIRS = dbus
++DIST_SUBDIRS = dbus tools m4
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = $(GLIB_PC)
+ DISTCLEANFILES = \
+--- a/tools/Makefile.am
++++ b/tools/Makefile.am
+@@ -1,24 +1,10 @@
+ INCLUDES=-I$(top_srcdir) $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_X_CFLAGS) $(DBUS_GTK_THREADS_CFLAGS) -DDBUS_COMPILATION
+-nodist_libdbus_glib_HEADERS = dbus-glib-bindings.h
+ libdbus_glibdir = $(includedir)/dbus-1.0/dbus
+-dbus-glib-bindings.h: dbus-bus-introspect.xml $(top_builddir)/dbus/dbus-binding-tool$(EXEEXT)
+-      $(top_builddir)/dbus/dbus-binding-tool --mode=glib-client --prefix=dbus_bus --output=dbus-glib-bindings.h dbus-bus-introspect.xml
+-
+-BUILT_SOURCES = dbus-glib-bindings.h dbus-bus-introspect.xml
+-
+-if USE_INTROSPECT_XML
+-dbus-bus-introspect.xml: $(INTROSPECT_XML_PATH)
+-      cp $(INTROSPECT_XML_PATH) dbus-bus-introspect.xml
+-else
+-dbus-bus-introspect.xml:
+-      DBUS_TOP_BUILDDIR=$(top_builddir) @DBUS_DAEMONDIR@dbus-daemon --introspect > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml
+-endif
++BUILT_SOURCES = 
+ EXTRA_DIST = run-with-tmp-session-bus.sh session.conf
+ CLEANFILES =                          \
+-      run-with-tmp-session-bus.conf   \
+-        dbus-bus-introspect.xml         \
+-        dbus-glib-bindings.h
++      run-with-tmp-session-bus.conf
+--- a/configure.ac
++++ b/configure.ac
+@@ -58,9 +58,6 @@ AC_ARG_ENABLE(bash-completion, AS_HELP_S
+ AC_ARG_WITH(test-socket-dir, AS_HELP_STRING([--with-test-socket-dir=[dirname]],[Where to put sockets for make check]))
+-AC_ARG_WITH(introspect-xml, AS_HELP_STRING([--with-introspect-xml=[filename]],[Pass in a pregenerated dbus daemon introspection xml file (as generated by 'dbus-daemon --introspect') to use instead of querying the installed dbus daemon]))
+-
+-
+ AM_CONDITIONAL(DBUS_BASH_COMPLETION, test x$enable_bash_completion = xyes)
+ if test x$enable_bash_completion = xyes; then
+   AC_DEFINE(DBUS_BASH_COMPLETION,1,[Enable bash completion])
+@@ -815,18 +812,6 @@ fi
+ AC_SUBST(TEST_SOCKET_DIR)
+ AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
+-#### Test if we should generate daemon introspection xml
+-use_introspect_xml=false
+-
+-if ! test -z "$with_introspect_xml" ; then
+-  use_introspect_xml=true
+-  INTROSPECT_XML_PATH="$with_introspect_xml"
+-  AC_DEFINE(INTROSPECT_XML_PATH, "$INTROSPECT_XML_PATH", [Path to pregenerated xml for dbus daemon introspection])
+-  AC_SUBST(INTROSPECT_XML_PATH)
+-fi
+-
+-AM_CONDITIONAL(USE_INTROSPECT_XML, $use_introspect_xml)
+-
+ AC_OUTPUT([
+ Makefile
+ m4/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,7 +1,7 @@
+ GLIB_PC=dbus-glib-1.pc
+-SUBDIRS=dbus tools test doc
+-DIST_SUBDIRS=dbus tools test doc m4
++SUBDIRS=dbus tools
++DIST_SUBDIRS=dbus tools m4
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = $(GLIB_PC)
diff --git a/libs/dbus-glib/patches/003-disable-tests-docs-examples.patch b/libs/dbus-glib/patches/003-disable-tests-docs-examples.patch
new file mode 100644 (file)
index 0000000..e6945d9
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -815,18 +815,7 @@ AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR,
+ AC_OUTPUT([
+ Makefile
+ m4/Makefile
+-doc/Makefile
+-doc/reference/Makefile
+-doc/reference/version.xml
+ dbus/Makefile
+-dbus/examples/Makefile
+-dbus/examples/statemachine/Makefile
+-test/Makefile
+-test/core/Makefile
+-test/interfaces/Makefile
+-test/data/valid-service-files/debug-glib.service
+-test/data/valid-service-files/debug-echo.service
+-test/data/valid-service-files/interfaces-test.service
+ tools/Makefile
+ dbus-glib-1.pc
+ dbus-glib-1-uninstalled.pc
+--- a/dbus/Makefile.am
++++ b/dbus/Makefile.am
+@@ -1,4 +1,4 @@
+-SUBDIRS = . examples
++SUBDIRS = .
+ INCLUDES = \
+       -I$(top_srcdir)                                         \
diff --git a/libs/elfutils/Makefile b/libs/elfutils/Makefile
new file mode 100644 (file)
index 0000000..7b00131
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2010-2013 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:=elfutils
+PKG_VERSION:=0.155
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://fedorahosted.org/releases/e/l/$(PKG_NAME)/$(PKG_VERSION)
+PKG_MD5SUM:=163a5712b86f6bdfebdf233cc6e2192d
+
+PKG_INSTALL:=1
+PKG_USE_MIPS16:=0
+
+PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/elfutils/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=$(INTL_DEPENDS)
+  TITLE:=ELF manipulation libraries
+  URL:=https://fedorahosted.org/elfutils/
+endef
+
+define Package/libdw
+  $(call Package/elfutils/Default)
+  DEPENDS:=libelf1 +zlib +libbz2
+  TITLE+= (libdw)
+endef
+
+define Package/libelf1
+  $(call Package/elfutils/Default)
+  TITLE+= (libelf)
+endef
+
+ifeq ($(CONFIG_BUILD_NLS),y)
+TARGET_LDFLAGS += "-lintl"
+endif
+
+ifdef CONFIG_USE_UCLIBC
+CONFIGURE_VARS += \
+       LIBS="-largp"
+endif
+
+CONFIGURE_ARGS += \
+       --disable-werror \
+       --without-lzma
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libdw/libdw.{a,so*} $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/libelf/libelf.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libdw/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libdw/libdw.so* $(1)/usr/lib/
+endef
+
+define Package/libelf1/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libelf/libelf.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libdw))
+$(eval $(call BuildPackage,libelf1))
diff --git a/libs/elfutils/patches/001-elfutils-portability.patch b/libs/elfutils/patches/001-elfutils-portability.patch
new file mode 100644 (file)
index 0000000..482f2f6
--- /dev/null
@@ -0,0 +1,1684 @@
+--- elfutils/backends/ChangeLog
++++ elfutils/backends/ChangeLog
+@@ -135,6 +135,10 @@
+       * ppc_attrs.c (ppc_check_object_attribute): Handle tag
+       GNU_Power_ABI_Struct_Return.
++2009-01-23  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (libebl_%.so): Use $(LD_AS_NEEDED).
++
+ 2008-10-04  Ulrich Drepper  <drepper@redhat.com>
+       * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
+@@ -462,6 +466,11 @@
+       * sparc_init.c: Likewise.
+       * x86_64_init.c: Likewise.
++2005-11-22  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (LD_AS_NEEDED): New variable, substituted by configure.
++      (libebl_%.so rule): Use it in place of -Wl,--as-needed.
++
+ 2005-11-19  Roland McGrath  <roland@redhat.com>
+       * ppc64_reloc.def: REL30 -> ADDR30.
+@@ -484,6 +493,9 @@
+       * Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
+       (CLEANFILES): Add libebl_$(m).so.
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+       * ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>.
+       * ppc64_reloc.def: Likewise.
+--- elfutils/backends/Makefile.am
++++ elfutils/backends/Makefile.am
+@@ -111,7 +111,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
+       $(LINK) -shared -o $(@:.map=.so) \
+               -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
+               -Wl,--version-script,$(@:.so=.map) \
+-              -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
++              -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
+       $(textrel_check)
+ libebl_i386.so: $(cpu_i386)
+--- elfutils/backends/Makefile.in
++++ elfutils/backends/Makefile.in
+@@ -38,7 +38,8 @@ build_triplet = @build@
+ host_triplet = @host@
+ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
+ subdir = backends
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+@@ -172,6 +173,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -201,6 +203,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -263,10 +266,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
+       -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
+       -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1)
++      $(am__append_1) $(am__append_2)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+@@ -725,7 +727,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
+       $(LINK) -shared -o $(@:.map=.so) \
+               -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
+               -Wl,--version-script,$(@:.so=.map) \
+-              -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
++              -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
+       $(textrel_check)
+ libebl_i386.so: $(cpu_i386)
+--- elfutils/ChangeLog
++++ elfutils/ChangeLog
+@@ -16,6 +16,8 @@
+ 2012-01-24  Mark Wielaard  <mjw@redhat.com>
++      * configure.ac: Wrap AC_COMPILE_IFELSE sources in AC_LANG_SOURCE.
++
+       * COPYING: Fix address. Updated version from gnulib.
+ 2012-01-23  Mark Wielaard  <mjw@redhat.com>
+@@ -34,6 +36,9 @@
+ 2011-10-08  Mike Frysinger  <vapier@gentoo.org>
++      * configure.ac (--disable-werror): Handle it, controlling BUILD_WERROR
++      automake option.
++
+       * configure.ac: Fix use of AC_ARG_ENABLE to handle $enableval correctly.
+ 2011-10-02  Ulrich Drepper  <drepper@gmail.com>
+@@ -55,6 +60,10 @@
+       * configure.ac (LOCALEDIR, DATADIRNAME): Removed.
++2009-11-22  Roland McGrath  <roland@redhat.com>
++
++      * configure.ac: Use sed and expr instead of modern bash extensions.
++
+ 2009-09-21  Ulrich Drepper  <drepper@redhat.com>
+       * configure.ac: Update for more modern autoconf.
+@@ -63,6 +72,10 @@
+       * configure.ac (zip_LIBS): Check for liblzma too.
++2009-08-17  Roland McGrath  <roland@redhat.com>
++
++      * configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works.
++
+ 2009-04-19  Roland McGrath  <roland@redhat.com>
+       * configure.ac (eu_version): Round down here, not in version.h macros.
+@@ -74,6 +87,8 @@
+ 2009-01-23  Roland McGrath  <roland@redhat.com>
++      * configure.ac: Check for __builtin_popcount.
++
+       * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
+       * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
+@@ -154,6 +169,10 @@
+       * configure.ac: Add dummy automake conditional to get dependencies
+       for non-generic linker right.  See src/Makefile.am.
++2005-11-22  Roland McGrath  <roland@redhat.com>
++
++      * configure.ac: Check for --as-needed linker option.
++
+ 2005-11-18  Roland McGrath  <roland@redhat.com>
+       * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
+@@ -201,6 +220,17 @@
+       * Makefile.am (all_SUBDIRS): Add libdwfl.
+       * configure.ac: Write libdwfl/Makefile.
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
++      * configure.ac (WEXTRA): Check for -Wextra and set this substitution.
++
++      * configure.ac: Check for struct stat st_?tim members.
++      * src/strip.c (process_file): Use st_?time if st_?tim are not there.
++
++      * configure.ac: Check for futimes function.
++      * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead.
++      (handle_ar) [! HAVE_FUTIMES]: Likewise.
++
+ 2005-05-19  Roland McGrath  <roland@redhat.com>
+       * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
+--- elfutils/config/ChangeLog
++++ elfutils/config/ChangeLog
+@@ -19,6 +19,10 @@
+       * known-dwarf.awk: Use gawk.
++2011-10-08  Mike Frysinger  <vapier@gentoo.org>
++
++      * eu.am [BUILD_WERROR]: Conditionalize -Werror use on this.
++
+ 2010-07-02  Ulrich Drepper  <drepper@redhat.com>
+       * elfutils.spec.in: Add more BuildRequires.
+--- elfutils/config/eu.am
++++ elfutils/config/eu.am
+@@ -1,6 +1,6 @@
+ ## Common automake fragments for elfutils subdirectory makefiles.
+ ##
+-## Copyright (C) 2010 Red Hat, Inc.
++## Copyright (C) 2010-2011 Red Hat, Inc.
+ ##
+ ## This file is part of elfutils.
+ ##
+@@ -29,14 +29,20 @@
+ ## not, see <http://www.gnu.org/licenses/>.
+ ##
++WEXTRA = @WEXTRA@
++LD_AS_NEEDED = @LD_AS_NEEDED@
++
+ DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
+ INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
+-          $(if $($(*F)_no_Werror),,-Werror) \
+-          $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
++          $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
+           $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
+           $($(*F)_CFLAGS)
++if BUILD_WERROR
++AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
++endif
++
+ if MUDFLAP
+ AM_CFLAGS += -fmudflap
+ libmudflap = -lmudflap
+--- elfutils/config/Makefile.in
++++ elfutils/config/Makefile.in
+@@ -76,6 +76,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -105,6 +106,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+--- elfutils/config.h.in
++++ elfutils/config.h.in
+@@ -6,6 +6,9 @@
+ /* Defined if libdw should support GNU ref_alt FORM, dwz multi files. */
+ #undef ENABLE_DWZ
++/* Have __builtin_popcount. */
++#undef HAVE_BUILTIN_POPCOUNT
++
+ /* $libdir subdirectory containing libebl modules. */
+ #undef LIBEBL_SUBDIR
+@@ -64,4 +67,7 @@
+ /* Define for large files, on AIX-style hosts. */
+ #undef _LARGE_FILES
++/* Stubbed out if missing compiler support. */
++#undef __thread
++
+ #include <eu-config.h>
+--- elfutils/configure
++++ elfutils/configure
+@@ -598,6 +598,8 @@ ZLIB_TRUE
+ LIBEBL_SUBDIR
+ TESTS_RPATH_FALSE
+ TESTS_RPATH_TRUE
++BUILD_WERROR_FALSE
++BUILD_WERROR_TRUE
+ BUILD_STATIC_FALSE
+ BUILD_STATIC_TRUE
+ GCOV_FALSE
+@@ -612,6 +614,8 @@ NEVER_TRUE
+ base_cpu
+ NATIVE_LD_FALSE
+ NATIVE_LD_TRUE
++LD_AS_NEEDED
++WEXTRA
+ LEXLIB
+ LEX_OUTPUT_ROOT
+ LEX
+@@ -726,6 +730,7 @@ enable_mudflap
+ enable_debugpred
+ enable_gprof
+ enable_gcov
++enable_werror
+ enable_tests_rpath
+ enable_libebl_subdir
+ with_zlib
+@@ -1379,6 +1384,7 @@ Optional Features:
+                           prediction
+   --enable-gprof          build binaries with gprof support
+   --enable-gcov           build binaries with gcov support
++  --disable-werror        do not build with -Werror
+   --enable-tests-rpath    build $ORIGIN-using rpath into tests
+   --enable-libebl-subdir=DIR
+                           install libebl_CPU modules in $(libdir)/DIR
+@@ -3920,6 +3926,130 @@ if test "x$ac_cv_c99" != xyes; then :
+   as_fn_error $? "gcc with C99 support required" "$LINENO" 5
+ fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra option to $CC" >&5
++$as_echo_n "checking for -Wextra option to $CC... " >&6; }
++if ${ac_cv_cc_wextra+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  old_CFLAGS="$CFLAGS"
++CFLAGS="$CFLAGS -Wextra"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++void foo (void) { }
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  ac_cv_cc_wextra=yes
++else
++  ac_cv_cc_wextra=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++CFLAGS="$old_CFLAGS"
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_wextra" >&5
++$as_echo "$ac_cv_cc_wextra" >&6; }
++
++if test "x$ac_cv_cc_wextra" = xyes; then :
++  WEXTRA=-Wextra
++else
++  WEXTRA=-W
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fgnu89-inline option to $CC" >&5
++$as_echo_n "checking for -fgnu89-inline option to $CC... " >&6; }
++if ${ac_cv_cc_gnu89_inline+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  old_CFLAGS="$CFLAGS"
++CFLAGS="$CFLAGS -fgnu89-inline -Werror"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++void foo (void)
++{
++  inline void bar (void) {}
++  bar ();
++}
++extern inline void baz (void) {}
++
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  ac_cv_cc_gnu89_inline=yes
++else
++  ac_cv_cc_gnu89_inline=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++CFLAGS="$old_CFLAGS"
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_gnu89_inline" >&5
++$as_echo "$ac_cv_cc_gnu89_inline" >&6; }
++if test "x$ac_cv_cc_gnu89_inline" = xyes; then :
++  WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --as-needed linker option" >&5
++$as_echo_n "checking for --as-needed linker option... " >&6; }
++if ${ac_cv_as_needed+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat > conftest.c <<EOF
++int main (void) { return 0; }
++EOF
++if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
++                          -fPIC -shared -o conftest.so conftest.c
++                          -Wl,--as-needed 1>&5'
++  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; }
++then
++  ac_cv_as_needed=yes
++else
++  ac_cv_as_needed=no
++fi
++rm -f conftest*
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_as_needed" >&5
++$as_echo "$ac_cv_as_needed" >&6; }
++if test "x$ac_cv_as_needed" = xyes; then :
++  LD_AS_NEEDED=-Wl,--as-needed
++else
++  LD_AS_NEEDED=
++fi
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
++$as_echo_n "checking for __builtin_popcount... " >&6; }
++if ${ac_cv_popcount+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++int
++main ()
++{
++exit (__builtin_popcount (127));
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_popcount=yes
++else
++  ac_cv_popcount=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_popcount" >&5
++$as_echo "$ac_cv_popcount" >&6; }
++if test "x$ac_cv_popcount" = xyes; then :
++
++$as_echo "#define HAVE_BUILTIN_POPCOUNT 1" >>confdefs.h
++
++fi
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support" >&5
+ $as_echo_n "checking for __thread support... " >&6; }
+ if ${ac_cv_tls+:} false; then :
+@@ -3956,7 +4086,13 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
+ $as_echo "$ac_cv_tls" >&6; }
+ if test "x$ac_cv_tls" != xyes; then :
+-  as_fn_error $? "__thread support required" "$LINENO" 5
++  if test "$use_locks" = yes; then :
++  as_fn_error $? "--enable-thread-safety requires __thread support" "$LINENO" 5
++else
++
++$as_echo "#define __thread /* empty: no multi-thread support */" >>confdefs.h
++
++fi
+ fi
+ # Check whether --enable-largefile was given.
+@@ -4305,6 +4441,22 @@ else
+ fi
++# Check whether --enable-werror was given.
++if test "${enable_werror+set}" = set; then :
++  enableval=$enable_werror; enable_werror=$enableval
++else
++  enable_werror=yes
++fi
++
++ if test "$enable_werror" = yes; then
++  BUILD_WERROR_TRUE=
++  BUILD_WERROR_FALSE='#'
++else
++  BUILD_WERROR_TRUE='#'
++  BUILD_WERROR_FALSE=
++fi
++
++
+ # Check whether --enable-tests-rpath was given.
+ if test "${enable_tests_rpath+set}" = set; then :
+   enableval=$enable_tests_rpath; tests_use_rpath=$enableval
+@@ -5025,7 +5177,7 @@ case "$eu_version" in
+ esac
+ # Round up to the next release API (x.y) version.
+-eu_version=$(( (eu_version + 999) / 1000 ))
++eu_version=`expr \( $eu_version + 999 \) / 1000`
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+@@ -5188,6 +5340,10 @@ if test -z "${BUILD_STATIC_TRUE}" && tes
+   as_fn_error $? "conditional \"BUILD_STATIC\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${BUILD_WERROR_TRUE}" && test -z "${BUILD_WERROR_FALSE}"; then
++  as_fn_error $? "conditional \"BUILD_WERROR\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+ if test -z "${TESTS_RPATH_TRUE}" && test -z "${TESTS_RPATH_FALSE}"; then
+   as_fn_error $? "conditional \"TESTS_RPATH\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+--- elfutils/configure.ac
++++ elfutils/configure.ac
+@@ -90,6 +90,54 @@ CFLAGS="$old_CFLAGS"])
+ AS_IF([test "x$ac_cv_c99" != xyes],
+       AC_MSG_ERROR([gcc with C99 support required]))
++AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl
++old_CFLAGS="$CFLAGS"
++CFLAGS="$CFLAGS -Wextra"
++AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo (void) { }])],
++                ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
++CFLAGS="$old_CFLAGS"])
++AC_SUBST(WEXTRA)
++AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W])
++
++AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl
++old_CFLAGS="$CFLAGS"
++CFLAGS="$CFLAGS -fgnu89-inline -Werror"
++AC_COMPILE_IFELSE([AC_LANG_SOURCE([
++void foo (void)
++{
++  inline void bar (void) {}
++  bar ();
++}
++extern inline void baz (void) {}
++])], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no)
++CFLAGS="$old_CFLAGS"])
++AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes],
++      [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"])
++
++AC_CACHE_CHECK([for --as-needed linker option],
++             ac_cv_as_needed, [dnl
++cat > conftest.c <<EOF
++int main (void) { return 0; }
++EOF
++if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
++                          -fPIC -shared -o conftest.so conftest.c
++                          -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
++then
++  ac_cv_as_needed=yes
++else
++  ac_cv_as_needed=no
++fi
++rm -f conftest*])
++AS_IF([test "x$ac_cv_as_needed" = xyes],
++      [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=])
++AC_SUBST(LD_AS_NEEDED)
++
++AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl
++AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])],
++             ac_cv_popcount=yes, ac_cv_popcount=no)])
++AS_IF([test "x$ac_cv_popcount" = xyes],
++      [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])])
++
+ AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
+ # Use the same flags that we use for our DSOs, so the test is representative.
+ # Some old compiler/linker/libc combinations fail some ways and not others.
+@@ -105,7 +153,10 @@ static __thread int a; int foo (int b) {
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"])
+ AS_IF([test "x$ac_cv_tls" != xyes],
+-      AC_MSG_ERROR([__thread support required]))
++      [AS_IF([test "$use_locks" = yes],
++           [AC_MSG_ERROR([--enable-thread-safety requires __thread support])],
++           [AC_DEFINE([__thread], [/* empty: no multi-thread support */],
++                      [Stubbed out if missing compiler support.])])])
+ dnl This test must come as early as possible after the compiler configuration
+ dnl tests, because the choice of the file model can (in principle) affect
+@@ -193,6 +244,11 @@ AM_CONDITIONAL(GCOV, test "$use_gcov" =
+ AM_CONDITIONAL(BUILD_STATIC, [dnl
+ test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
++AC_ARG_ENABLE([werror],
++AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
++             [enable_werror=$enableval], [enable_werror=yes])
++AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
++
+ AC_ARG_ENABLE([tests-rpath],
+ AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
+              [tests_use_rpath=$enableval], [tests_use_rpath=no])
+@@ -304,6 +360,6 @@ case "$eu_version" in
+ esac
+ # Round up to the next release API (x.y) version.
+-eu_version=$(( (eu_version + 999) / 1000 ))
++eu_version=`expr \( $eu_version + 999 \) / 1000`
+ AC_OUTPUT
+--- elfutils/lib/ChangeLog
++++ elfutils/lib/ChangeLog
+@@ -35,6 +35,9 @@
+ 2009-01-23  Roland McGrath  <roland@redhat.com>
++      * eu-config.h [! HAVE_BUILTIN_POPCOUNT]
++      (__builtin_popcount): New inline function.
++
+       * eu-config.h: Add multiple inclusion protection.
+ 2009-01-17  Ulrich Drepper  <drepper@redhat.com>
+@@ -91,6 +94,11 @@
+       * Makefile.am (libeu_a_SOURCES): Add it.
+       * system.h: Declare crc32_file.
++2005-02-07  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+ 2005-04-30  Ulrich Drepper  <drepper@redhat.com>
+       * Makefile.am: Use -ffunction-sections for xmalloc.c.
+--- elfutils/lib/eu-config.h
++++ elfutils/lib/eu-config.h
+@@ -162,6 +162,17 @@ asm (".section predict_data, \"aw\"; .pr
+ /* This macro is used by the tests conditionalize for standalone building.  */
+ #define ELFUTILS_HEADER(name) <lib##name.h>
++#ifndef HAVE_BUILTIN_POPCOUNT
++# define __builtin_popcount hakmem_popcount
++static inline unsigned int __attribute__ ((unused))
++hakmem_popcount (unsigned int x)
++{
++  /* HAKMEM 169 */
++  unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
++  return ((n + (n >> 3)) & 030707070707) % 63;
++}
++#endif        /* HAVE_BUILTIN_POPCOUNT */
++
+ #ifdef SHARED
+ # define OLD_VERSION(name, version) \
+--- elfutils/lib/Makefile.in
++++ elfutils/lib/Makefile.in
+@@ -37,7 +37,8 @@ build_triplet = @build@
+ host_triplet = @host@
+ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
+ subdir = lib
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+@@ -100,6 +101,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -129,6 +131,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -190,10 +193,9 @@ zip_LIBS = @zip_LIBS@
+ INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
+       -I$(srcdir)/../libelf
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1) -fpic
++      $(am__append_1) $(am__append_2) -fpic
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+--- elfutils/libasm/ChangeLog
++++ elfutils/libasm/ChangeLog
+@@ -71,6 +71,11 @@
+       * asm_error.c: Add new error ASM_E_IOERROR.
+       * libasmP.h: Add ASM_E_IOERROR definition.
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+ 2005-02-15  Ulrich Drepper  <drepper@redhat.com>
+       * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
+--- elfutils/libasm/Makefile.in
++++ elfutils/libasm/Makefile.in
+@@ -39,10 +39,11 @@ host_triplet = @host@
+ DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
+ @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
+ @MUDFLAP_TRUE@am_libasm_pic_a_OBJECTS =
+-@MUDFLAP_FALSE@@USE_LOCKS_TRUE@am__append_2 = -lpthread
++@MUDFLAP_FALSE@@USE_LOCKS_TRUE@am__append_3 = -lpthread
+ subdir = libasm
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+@@ -153,6 +154,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -182,6 +184,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = 1
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -244,10 +247,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
+       -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
+       -I$(top_srcdir)/libdw
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1)
++      $(am__append_1) $(am__append_2)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+@@ -276,7 +278,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort
+ @MUDFLAP_FALSE@libasm_pic_a_SOURCES = 
+ @MUDFLAP_FALSE@am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
+-@MUDFLAP_FALSE@libasm_so_LDLIBS = $(am__append_2)
++@MUDFLAP_FALSE@libasm_so_LDLIBS = $(am__append_3)
+ @MUDFLAP_FALSE@libasm_so_SOURCES = 
+ noinst_HEADERS = libasmP.h symbolhash.h
+ EXTRA_DIST = libasm.map
+--- elfutils/libcpu/ChangeLog
++++ elfutils/libcpu/ChangeLog
+@@ -38,6 +38,9 @@
+ 2009-01-23  Roland McGrath  <roland@redhat.com>
++      * i386_disasm.c (i386_disasm): Add abort after assert-constant for old
++      compilers that don't realize it's noreturn.
++
+       * Makefile.am (i386_parse_CFLAGS): Use quotes around command
+       substitution that can produce leading whitespace.
+@@ -367,6 +370,11 @@
+       * defs/i386.doc: New file.
+       * defs/x86_64: New file.
++2005-04-04  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it instead of -Wextra.
++
+ 2005-02-15  Ulrich Drepper  <drepper@redhat.com>
+       * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
+--- elfutils/libcpu/i386_disasm.c
++++ elfutils/libcpu/i386_disasm.c
+@@ -822,6 +822,7 @@ i386_disasm (const uint8_t **startp, con
+                       default:
+                         assert (! "INVALID not handled");
++                        abort ();
+                       }
+                   }
+                 else
+--- elfutils/libcpu/Makefile.in
++++ elfutils/libcpu/Makefile.in
+@@ -39,7 +39,8 @@ host_triplet = @host@
+ DIST_COMMON = $(am__noinst_HEADERS_DIST) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog \
+       i386_lex.c i386_parse.c
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
+ @MAINTAINER_MODE_TRUE@noinst_PROGRAMS = i386_gendis$(EXEEXT)
+ subdir = libcpu
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -117,6 +118,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
+@@ -146,6 +148,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -208,10 +211,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
+       -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
+       -I$(srcdir)/../libdw -I$(srcdir)/../libasm
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1) -fpic -fdollars-in-identifiers
++      $(am__append_1) $(am__append_2) -fpic -fdollars-in-identifiers
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+--- elfutils/libdw/ChangeLog
++++ elfutils/libdw/ChangeLog
+@@ -82,6 +82,10 @@
+       * Makefile.am (known-dwarf.h): Run gawk on config/known-dwarf.awk.
++2011-07-20  Mark Wielaard  <mjw@redhat.com>
++
++      * dwarf_begin_elf.c: Add fallback for be64toh if not defined.
++
+ 2011-07-14  Mark Wielaard  <mjw@redhat.com>
+       * libdw.h (dwarf_offdie): Fix documentation to mention .debug_info.
+@@ -441,6 +445,10 @@
+       * dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
++2009-08-17  Roland McGrath  <roland@redhat.com>
++
++      * libdw.h: Disable extern inlines for GCC 4.2.
++
+ 2009-08-10  Roland McGrath  <roland@redhat.com>
+       * dwarf_getscopevar.c: Use dwarf_diename.
+@@ -1209,6 +1217,11 @@
+ 2005-05-31  Roland McGrath  <roland@redhat.com>
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
+       * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
+       formref offset.
+--- elfutils/libdw/dwarf_begin_elf.c
++++ elfutils/libdw/dwarf_begin_elf.c
+@@ -48,6 +48,14 @@
+ #if USE_ZLIB
+ # include <endian.h>
+ # define crc32                loser_crc32
++# ifndef be64toh
++#  include <byteswap.h>
++#  if __BYTE_ORDER == __LITTLE_ENDIAN
++#   define be64toh(x) bswap_64 (x)
++#  else
++#   define be64toh(x) (x)
++#  endif
++# endif
+ # include <zlib.h>
+ # undef crc32
+ #endif
+--- elfutils/libdw/libdw.h
++++ elfutils/libdw/libdw.h
+@@ -831,7 +831,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (
+ /* Inline optimizations.  */
+-#ifdef __OPTIMIZE__
++#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
+ /* Return attribute code of given attribute.  */
+ __libdw_extern_inline unsigned int
+ dwarf_whatattr (Dwarf_Attribute *attr)
+--- elfutils/libdw/Makefile.in
++++ elfutils/libdw/Makefile.in
+@@ -39,8 +39,9 @@ host_triplet = @host@
+ DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
+       $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
+-@BUILD_STATIC_TRUE@am__append_2 = -fpic
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
++@BUILD_STATIC_TRUE@am__append_3 = -fpic
+ @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
+ @MUDFLAP_TRUE@am_libdw_pic_a_OBJECTS =
+ subdir = libdw
+@@ -198,6 +199,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -227,6 +229,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = 1
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -288,10 +291,9 @@ zip_LIBS = @zip_LIBS@
+ INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
+       -I$(srcdir)/../libelf
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1) $(am__append_2)
++      $(am__append_1) $(am__append_2) $(am__append_3)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+--- elfutils/libdwfl/ChangeLog
++++ elfutils/libdwfl/ChangeLog
+@@ -1420,6 +1420,11 @@
+ 2005-07-21  Roland McGrath  <roland@redhat.com>
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
++2005-07-21  Roland McGrath  <roland@redhat.com>
++
+       * Makefile.am (noinst_HEADERS): Add loc2c.c.
+       * test2.c (main): Check sscanf result to quiet warning.
+--- elfutils/libdwfl/Makefile.in
++++ elfutils/libdwfl/Makefile.in
+@@ -38,11 +38,12 @@ host_triplet = @host@
+ DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
+-@MUDFLAP_FALSE@am__append_2 = libdwfl_pic.a
+-@ZLIB_TRUE@am__append_3 = gzip.c
+-@BZLIB_TRUE@am__append_4 = bzip2.c
+-@LZMA_TRUE@am__append_5 = lzma.c
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
++@MUDFLAP_FALSE@am__append_3 = libdwfl_pic.a
++@ZLIB_TRUE@am__append_4 = gzip.c
++@BZLIB_TRUE@am__append_5 = bzip2.c
++@LZMA_TRUE@am__append_6 = lzma.c
+ @MUDFLAP_TRUE@am_libdwfl_pic_a_OBJECTS =
+ subdir = libdwfl
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -188,6 +189,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -217,6 +219,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = 1
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -279,10 +282,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
+       -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
+       -I$(srcdir)/../libdw
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1)
++      $(am__append_1) $(am__append_2)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+@@ -290,7 +292,7 @@ COMPILE.os = $(filter-out -fprofile-arcs
+ CLEANFILES = *.gcno *.gcda $(am_libdwfl_pic_a_OBJECTS)
+ textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+-noinst_LIBRARIES = libdwfl.a $(am__append_2)
++noinst_LIBRARIES = libdwfl.a $(am__append_3)
+ pkginclude_HEADERS = libdwfl.h
+ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c \
+       dwfl_version.c dwfl_module.c dwfl_report_elf.c relocate.c \
+@@ -311,8 +313,8 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
+       dwfl_module_getsym.c dwfl_module_addrname.c \
+       dwfl_module_addrsym.c dwfl_module_return_value_location.c \
+       dwfl_module_register_names.c dwfl_segment_report_module.c \
+-      link_map.c core-file.c open.c image-header.c $(am__append_3) \
+-      $(am__append_4) $(am__append_5)
++      link_map.c core-file.c open.c image-header.c $(am__append_4) \
++      $(am__append_5) $(am__append_6)
+ @MUDFLAP_FALSE@libdwfl = $(libdw)
+ @MUDFLAP_TRUE@libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu)
+ @MUDFLAP_FALSE@libdw = ../libdw/libdw.so
+--- elfutils/libebl/ChangeLog
++++ elfutils/libebl/ChangeLog
+@@ -658,6 +658,11 @@
+       * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
+       tracking works right.
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+ 2005-05-21  Ulrich Drepper  <drepper@redhat.com>
+       * libebl_x86_64.map: Add x86_64_core_note.
+--- elfutils/libebl/Makefile.in
++++ elfutils/libebl/Makefile.in
+@@ -38,7 +38,8 @@ host_triplet = @host@
+ DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
+ subdir = libebl
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+@@ -150,6 +151,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -179,6 +181,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = 1
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -241,10 +244,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
+       -I$(srcdir)/../libelf -I$(srcdir)/../libdw \
+       -I$(srcdir)/../libasm
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1) -fpic
++      $(am__append_1) $(am__append_2) -fpic
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+--- elfutils/libelf/ChangeLog
++++ elfutils/libelf/ChangeLog
+@@ -34,6 +34,11 @@
+       * elf-knowledge.h (SECTION_STRIP_P): Remove < SHT_NUM check.
++2011-03-10  Roland McGrath  <roland@redhat.com>
++
++      * gnuhash_xlate.h (elf_cvt_gnuhash): Avoid post-increment in bswap_32
++      argument, since some implementations are buggy macros.
++
+ 2011-02-26  Mark Wielaard  <mjw@redhat.com>
+       * elf_end.c (elf_end): Call rwlock_unlock before rwlock_fini.
+@@ -711,6 +716,11 @@
+       * elf.h: Update from glibc.
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+ 2005-05-08  Roland McGrath  <roland@redhat.com>
+       * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
+--- elfutils/libelf/common.h
++++ elfutils/libelf/common.h
+@@ -139,7 +139,7 @@ libelf_release_all (Elf *elf)
+   (Var) = (sizeof (Var) == 1                                                \
+          ? (unsigned char) (Var)                                            \
+          : (sizeof (Var) == 2                                               \
+-            ? bswap_16 (Var)                                                \
++            ? (unsigned short int) bswap_16 (Var)                           \
+             : (sizeof (Var) == 4                                            \
+                ? bswap_32 (Var)                                             \
+                : bswap_64 (Var))))
+@@ -148,7 +148,7 @@ libelf_release_all (Elf *elf)
+   (Dst) = (sizeof (Var) == 1                                                \
+          ? (unsigned char) (Var)                                            \
+          : (sizeof (Var) == 2                                               \
+-            ? bswap_16 (Var)                                                \
++            ? (unsigned short int) bswap_16 (Var)                           \
+             : (sizeof (Var) == 4                                            \
+                ? bswap_32 (Var)                                             \
+                : bswap_64 (Var))))
+--- elfutils/libelf/gnuhash_xlate.h
++++ elfutils/libelf/gnuhash_xlate.h
+@@ -1,5 +1,5 @@
+ /* Conversion functions for versioning information.
+-   Copyright (C) 2006, 2007 Red Hat, Inc.
++   Copyright (C) 2006-2011 Red Hat, Inc.
+    This file is part of elfutils.
+    Written by Ulrich Drepper <drepper@redhat.com>, 2006.
+@@ -68,7 +68,9 @@ elf_cvt_gnuhash (void *dest, const void
+   dest32 = (Elf32_Word *) &dest64[bitmask_words];
+   while (len >= 4)
+     {
+-      *dest32++ = bswap_32 (*src32++);
++      *dest32 = bswap_32 (*src32);
++      ++dest32;
++      ++src32;
+       len -= 4;
+     }
+ }
+--- elfutils/libelf/Makefile.in
++++ elfutils/libelf/Makefile.in
+@@ -39,11 +39,12 @@ host_triplet = @host@
+ DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
+       $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
+-@BUILD_STATIC_TRUE@am__append_2 = -fpic
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
++@BUILD_STATIC_TRUE@am__append_3 = -fpic
+ @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
+ @MUDFLAP_TRUE@am_libelf_pic_a_OBJECTS =
+-@MUDFLAP_FALSE@@USE_LOCKS_TRUE@am__append_3 = -lpthread
++@MUDFLAP_FALSE@@USE_LOCKS_TRUE@am__append_4 = -lpthread
+ subdir = libelf
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+@@ -195,6 +196,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -224,6 +226,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = 1
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -284,10 +287,9 @@ top_srcdir = @top_srcdir@
+ zip_LIBS = @zip_LIBS@
+ INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1) $(am__append_2)
++      $(am__append_1) $(am__append_2) $(am__append_3)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+@@ -352,7 +354,7 @@ libelf_a_SOURCES = elf_version.c elf_has
+ @MUDFLAP_FALSE@libelf_pic_a_SOURCES = 
+ @MUDFLAP_FALSE@am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
+-@MUDFLAP_FALSE@libelf_so_LDLIBS = $(am__append_3)
++@MUDFLAP_FALSE@libelf_so_LDLIBS = $(am__append_4)
+ @MUDFLAP_FALSE@libelf_so_SOURCES = 
+ noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
+                version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h
+--- elfutils/m4/Makefile.in
++++ elfutils/m4/Makefile.in
+@@ -75,6 +75,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -104,6 +105,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+--- elfutils/Makefile.in
++++ elfutils/Makefile.in
+@@ -165,6 +165,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -194,6 +195,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+--- elfutils/src/addr2line.c
++++ elfutils/src/addr2line.c
+@@ -447,10 +447,10 @@ handle_address (const char *string, Dwfl
+       bool parsed = false;
+       int i, j;
+       char *name = NULL;
+-      if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
++      if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
+         && string[i] == '\0')
+       parsed = adjust_to_section (name, &addr, dwfl);
+-      switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
++      switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
+       {
+       default:
+         break;
+--- elfutils/src/ChangeLog
++++ elfutils/src/ChangeLog
+@@ -606,8 +606,16 @@
+       * readelf.c (attr_callback): Use print_block only when we don't use
+       print_ops.
++2009-08-17  Roland McGrath  <roland@redhat.com>
++
++      * ld.h: Disable extern inlines for GCC 4.2.
++
+ 2009-08-14  Roland McGrath  <roland@redhat.com>
++      * strings.c (read_block): Conditionalize posix_fadvise use
++      on [POSIX_FADV_SEQUENTIAL].
++      From Petr Salinger <Petr.Salinger@seznam.cz>.
++
+       * ar.c (do_oper_extract): Use pathconf instead of statfs.
+ 2009-08-01  Ulrich Drepper  <drepper@redhat.com>
+@@ -771,6 +779,8 @@
+       * readelf.c (print_debug_frame_section): Use t instead of j formats
+       for ptrdiff_t OFFSET.
++      * addr2line.c (handle_address): Use %a instead of %m for compatibility.
++
+ 2009-01-21  Ulrich Drepper  <drepper@redhat.com>
+       * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
+@@ -954,6 +964,11 @@
+       that matches its PT_LOAD's p_flags &~ PF_W.  On sparc, PF_X really
+       is valid in RELRO.
++2008-03-01  Roland McGrath  <roland@redhat.com>
++
++      * readelf.c (dump_archive_index): Tweak portability hack
++      to match [__GNUC__ < 4] too.
++
+ 2008-02-29  Roland McGrath  <roland@redhat.com>
+       * readelf.c (print_attributes): Add a cast.
+@@ -1205,6 +1220,8 @@
+       * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
++      * Makefile.am (readelf_no_Werror): New variable.
++
+ 2007-10-15  Roland McGrath  <roland@redhat.com>
+       * make-debug-archive.in: New file.
+@@ -1644,6 +1661,10 @@
+       * elflint.c (valid_e_machine): Add EM_ALPHA.
+       Reported by Christian Aichinger <Greek0@gmx.net>.
++      * strings.c (map_file): Define POSIX_MADV_SEQUENTIAL to
++      MADV_SEQUENTIAL if undefined.   Don't call posix_madvise
++      if neither is defined.
++
+ 2006-08-08  Ulrich Drepper  <drepper@redhat.com>
+       * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
+@@ -1720,6 +1741,10 @@
+       * Makefile.am: Add hacks to create dependency files for non-generic
+       linker.
++2006-04-05  Roland McGrath  <roland@redhat.com>
++
++      * strings.c (MAP_POPULATE): Define to 0 if undefined.
++
+ 2006-06-12  Ulrich Drepper  <drepper@redhat.com>
+       * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
+@@ -2068,6 +2093,11 @@
+       * readelf.c (print_debug_loc_section): Fix indentation for larger
+       address size.
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+ 2005-05-30  Roland McGrath  <roland@redhat.com>
+       * readelf.c (print_debug_line_section): Print section offset of each
+--- elfutils/src/findtextrel.c
++++ elfutils/src/findtextrel.c
+@@ -496,7 +496,11 @@ ptrcompare (const void *p1, const void *
+ static void
+-check_rel (size_t nsegments, struct segments segments[nsegments],
++check_rel (size_t nsegments, struct segments segments[
++#if __GNUC__ >= 4
++                                                    nsegments
++#endif
++         ],
+          GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
+          const char *fname, bool more_than_one, void **knownsrcs)
+ {
+--- elfutils/src/ld.h
++++ elfutils/src/ld.h
+@@ -1114,6 +1114,7 @@ extern bool dynamically_linked_p (void);
+ /* Checked whether the symbol is undefined and referenced from a DSO.  */
+ extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
++#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
+ #ifdef __GNUC_STDC_INLINE__
+ __attribute__ ((__gnu_inline__))
+ #endif
+@@ -1131,5 +1132,6 @@ linked_from_dso_p (struct scninfo *scnin
+   return sym->defined && sym->in_dso;
+ }
++#endif        /* Optimizing and not GCC 4.2.  */
+ #endif        /* ld.h */
+--- elfutils/src/Makefile.am
++++ elfutils/src/Makefile.am
+@@ -95,6 +95,9 @@ addr2line_no_Wformat = yes
+ # XXX While the file is not finished, don't warn about this
+ ldgeneric_no_Wunused = yes
++# Buggy old compilers.
++readelf_no_Werror = yes
++
+ readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+ nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+          $(demanglelib)
+--- elfutils/src/Makefile.in
++++ elfutils/src/Makefile.in
+@@ -40,7 +40,8 @@ host_triplet = @host@
+ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/config/eu.am ChangeLog \
+       ldlex.c ldscript.c
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
+ bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \
+       strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) \
+       findtextrel$(EXEEXT) addr2line$(EXEEXT) elfcmp$(EXEEXT) \
+@@ -49,9 +50,9 @@ bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEE
+ @NATIVE_LD_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
+ # We never build this library but we need to get the dependency files
+ # of all the linker backends that might be used in a non-generic linker.
+-@NEVER_TRUE@am__append_2 = libdummy.a
++@NEVER_TRUE@am__append_3 = libdummy.a
+ # -ldl is always needed for libebl.
+-@NATIVE_LD_TRUE@am__append_3 = libld_elf.a
++@NATIVE_LD_TRUE@am__append_4 = libld_elf.a
+ @NATIVE_LD_TRUE@am_libld_elf_i386_pic_a_OBJECTS =
+ subdir = src
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -115,7 +116,7 @@ am_ld_OBJECTS = ld.$(OBJEXT) ldgeneric.$
+       versionhash.$(OBJEXT)
+ ld_OBJECTS = $(am_ld_OBJECTS)
+ ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__DEPENDENCIES_1) \
+-      $(am__append_3)
++      $(am__append_4)
+ ld_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ld_LDFLAGS) $(LDFLAGS) -o \
+       $@
+ am_libld_elf_i386_so_OBJECTS =
+@@ -235,6 +236,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -264,6 +266,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -327,10 +330,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
+       -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \
+       -I$(srcdir)/../libasm
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1)
++      $(am__append_1) $(am__append_2)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+@@ -346,8 +348,8 @@ AM_LFLAGS = -Pld -olex.yy.c
+ native_ld = @native_ld@
+ ld_dsos = libld_elf_i386_pic.a
+ @NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) \
+-@NATIVE_LD_FALSE@     $(am__append_2)
+-@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_2)
++@NATIVE_LD_FALSE@     $(am__append_3)
++@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_3)
+ @NATIVE_LD_TRUE@native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
+ @NEVER_TRUE@libdummy_a_SOURCES = i386_ld.c
+ ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
+@@ -376,6 +378,9 @@ strings_no_Wformat = yes
+ addr2line_no_Wformat = yes
+ # XXX While the file is not finished, don't warn about this
+ ldgeneric_no_Wunused = yes
++
++# Buggy old compilers.
++readelf_no_Werror = yes
+ readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+ nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+          $(demanglelib)
+@@ -383,7 +388,7 @@ nm_LDADD = $(libdw) $(libebl) $(libelf)
+ size_LDADD = $(libelf) $(libeu) $(libmudflap)
+ strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+ ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+-      $(am__append_3)
++      $(am__append_4)
+ ld_LDFLAGS = -rdynamic
+ elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+ findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
+--- elfutils/src/readelf.c
++++ elfutils/src/readelf.c
+@@ -3949,10 +3949,11 @@ struct listptr
+ #define listptr_offset_size(p)        ((p)->dwarf64 ? 8 : 4)
+ #define listptr_address_size(p)       ((p)->addr64 ? 8 : 4)
++static const char *listptr_name;
+ static int
+-compare_listptr (const void *a, const void *b, void *arg)
++compare_listptr (const void *a, const void *b)
+ {
+-  const char *name = arg;
++  const char *const name = listptr_name;
+   struct listptr *p1 = (void *) a;
+   struct listptr *p2 = (void *) b;
+@@ -4033,8 +4034,11 @@ static void
+ sort_listptr (struct listptr_table *table, const char *name)
+ {
+   if (table->n > 0)
+-    qsort_r (table->table, table->n, sizeof table->table[0],
+-           &compare_listptr, (void *) name);
++    {
++      listptr_name = name;
++      qsort (table->table, table->n, sizeof table->table[0],
++           &compare_listptr);
++    }
+ }
+ static bool
+@@ -8442,7 +8446,7 @@ dump_archive_index (Elf *elf, const char
+         if (unlikely (elf_rand (elf, as_off) == 0)
+             || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
+                          == NULL))
+-#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
++#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) || __GNUC__ < 4
+           while (1)
+ #endif
+             error (EXIT_FAILURE, 0,
+--- elfutils/src/strings.c
++++ elfutils/src/strings.c
+@@ -43,6 +43,10 @@
+ #include <system.h>
++#ifndef MAP_POPULATE
++# define MAP_POPULATE 0
++#endif
++
+ /* Prototypes of local functions.  */
+ static int read_fd (int fd, const char *fname, off64_t fdlen);
+@@ -483,8 +487,13 @@ map_file (int fd, off64_t start_off, off
+                   fd, start_off);
+       if (mem != MAP_FAILED)
+       {
++#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
++# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
++#endif
++#ifdef POSIX_MADV_SEQUENTIAL
+         /* We will go through the mapping sequentially.  */
+         (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
++#endif
+         break;
+       }
+       if (errno != EINVAL && errno != ENOMEM)
+@@ -576,9 +585,11 @@ read_block (int fd, const char *fname, o
+       elfmap_off = from & ~(ps - 1);
+       elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
++#ifdef POSIX_FADV_SEQUENTIAL
+       if (unlikely (elfmap == MAP_FAILED))
+       /* Let the kernel know we are going to read everything in sequence.  */
+       (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
++#endif
+     }
+   if (unlikely (elfmap == MAP_FAILED))
+--- elfutils/src/strip.c
++++ elfutils/src/strip.c
+@@ -45,6 +45,12 @@
+ #include <libebl.h>
+ #include <system.h>
++#ifdef HAVE_FUTIMES
++# define FUTIMES(fd, fname, tvp) futimes (fd, tvp)
++#else
++# define FUTIMES(fd, fname, tvp) utimes (fname, tvp)
++#endif
++
+ typedef uint8_t GElf_Byte;
+ /* Name and version of program.  */
+@@ -318,8 +324,18 @@ process_file (const char *fname)
+       /* If we have to preserve the timestamp, we need it in the
+        format utimes() understands.  */
++#ifdef HAVE_STRUCT_STAT_ST_ATIM
+       TIMESPEC_TO_TIMEVAL (&tv[0], &pre_st.st_atim);
++#else
++      tv[0].tv_sec = pre_st.st_atime;
++      tv[0].tv_usec = 0;
++#endif
++#ifdef HAVE_STRUCT_STAT_ST_MTIM
+       TIMESPEC_TO_TIMEVAL (&tv[1], &pre_st.st_mtim);
++#else
++      tv[1].tv_sec = pre_st.st_atime;
++      tv[1].tv_usec = 0;
++#endif
+     }
+   /* Open the file.  */
+@@ -2055,7 +2071,7 @@ while computing checksum for debug infor
+   /* If requested, preserve the timestamp.  */
+   if (tvp != NULL)
+     {
+-      if (futimes (fd, tvp) != 0)
++      if (FUTIMES (fd, output_fname, tvp) != 0)
+       {
+         error (0, errno, gettext ("\
+ cannot set access and modification date of '%s'"),
+@@ -2112,7 +2128,7 @@ handle_ar (int fd, Elf *elf, const char
+   if (tvp != NULL)
+     {
+-      if (unlikely (futimes (fd, tvp) != 0))
++      if (unlikely (FUTIMES (fd, fname, tvp) != 0))
+       {
+         error (0, errno, gettext ("\
+ cannot set access and modification date of '%s'"), fname);
+--- elfutils/tests/ChangeLog
++++ elfutils/tests/ChangeLog
+@@ -439,6 +439,8 @@
+ 2008-01-21  Roland McGrath  <roland@redhat.com>
++      * line2addr.c (main): Revert last change.
++
+       * testfile45.S.bz2: Add tests for cltq, cqto.
+       * testfile45.expect.bz2: Adjust.
+@@ -1147,6 +1149,11 @@
+       * Makefile.am (TESTS): Add run-elflint-test.sh.
+       (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
++2005-05-31  Roland McGrath  <roland@redhat.com>
++
++      * Makefile.am (WEXTRA): New variable, substituted by configure.
++      (AM_CFLAGS): Use it in place of -Wextra.
++
+ 2005-05-24  Ulrich Drepper  <drepper@redhat.com>
+       * get-files.c (main): Use correct format specifier.
+--- elfutils/tests/line2addr.c
++++ elfutils/tests/line2addr.c
+@@ -124,7 +124,7 @@ main (int argc, char *argv[])
+     {
+       struct args a = { .arg = argv[cnt] };
+-      switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
++      switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
+       {
+       default:
+       case 0:
+--- elfutils/tests/Makefile.in
++++ elfutils/tests/Makefile.in
+@@ -35,14 +35,15 @@ build_triplet = @build@
+ host_triplet = @host@
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/eu.am ChangeLog
+-@MUDFLAP_TRUE@am__append_1 = -fmudflap
+-@STANDALONE_FALSE@am__append_2 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
++@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
++@MUDFLAP_TRUE@am__append_2 = -fmudflap
++@STANDALONE_FALSE@am__append_3 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
+ @STANDALONE_FALSE@        -I$(top_srcdir)/libdwfl \
+ @STANDALONE_FALSE@        -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \
+ @STANDALONE_FALSE@        -I$(top_srcdir)/lib -I..
+-@STANDALONE_FALSE@am__append_3 = -Wl,-rpath-link,../libasm:../libdw:../libelf
+-@TESTS_RPATH_TRUE@am__append_4 = -Wl,-rpath,$(BUILD_RPATH)
++@STANDALONE_FALSE@am__append_4 = -Wl,-rpath-link,../libasm:../libdw:../libelf
++@TESTS_RPATH_TRUE@am__append_5 = -Wl,-rpath,$(BUILD_RPATH)
+ check_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \
+       newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \
+       sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \
+@@ -92,12 +93,12 @@ TESTS = run-arextract.sh run-arsymtest.s
+       run-readelf-gdb_index.sh run-unstrip-n.sh run-low_high_pc.sh \
+       run-macro-test.sh run-elf_cntl_gelf_getshdr.sh \
+       run-test-archive64.sh $(am__EXEEXT_1) $(am__EXEEXT_3) \
+-      $(am__append_9)
+-@STANDALONE_FALSE@am__append_5 = msg_tst md5-sha1-test
++      $(am__append_10)
+ @STANDALONE_FALSE@am__append_6 = msg_tst md5-sha1-test
+-@HAVE_LIBASM_TRUE@am__append_7 = $(asm_TESTS)
++@STANDALONE_FALSE@am__append_7 = msg_tst md5-sha1-test
+ @HAVE_LIBASM_TRUE@am__append_8 = $(asm_TESTS)
+-@ENABLE_DWZ_TRUE@am__append_9 = run-readelf-dwz-multi.sh
++@HAVE_LIBASM_TRUE@am__append_9 = $(asm_TESTS)
++@ENABLE_DWZ_TRUE@am__append_10 = run-readelf-dwz-multi.sh
+ subdir = tests
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+@@ -412,6 +413,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LDFLAGS = @LDFLAGS@
++LD_AS_NEEDED = @LD_AS_NEEDED@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+@@ -441,6 +443,7 @@ SHELL = @SHELL@
+ STRIP = @STRIP@
+ USE_NLS = @USE_NLS@
+ VERSION = @VERSION@
++WEXTRA = @WEXTRA@
+ XGETTEXT = @XGETTEXT@
+ XGETTEXT_015 = @XGETTEXT_015@
+ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+@@ -499,12 +502,11 @@ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ zip_LIBS = @zip_LIBS@
+-INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2)
++INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_3)
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
+-      $($(*F)_no_Werror),,-Werror) $(if \
+-      $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
++      $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
+       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
+-      $(am__append_1)
++      $(am__append_1) $(am__append_2)
+ @MUDFLAP_FALSE@libmudflap = 
+ @MUDFLAP_TRUE@libmudflap = -lmudflap
+ COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
+@@ -514,7 +516,7 @@ CLEANFILES = *.gcno *.gcda
+ textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ @MUDFLAP_FALSE@BUILD_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf
+ @MUDFLAP_TRUE@BUILD_RPATH = \$$ORIGIN/../backends
+-AM_LDFLAGS = $(am__append_3) $(am__append_4)
++AM_LDFLAGS = $(am__append_4) $(am__append_5)
+ @TESTS_RPATH_FALSE@tests_rpath = no
+ @TESTS_RPATH_TRUE@tests_rpath = yes
+ asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
diff --git a/libs/elfutils/patches/002-no_tests.patch b/libs/elfutils/patches/002-no_tests.patch
new file mode 100644 (file)
index 0000000..2c7a02a
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -31,7 +31,7 @@ pkginclude_HEADERS = version.h
+ # Add doc back when we have some real content.
+ SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
+-        src po tests
++        src po
+ EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -249,7 +249,7 @@ pkginclude_HEADERS = version.h
+ # Add doc back when we have some real content.
+ SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
+-        src po tests
++        src po
+ EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION
diff --git a/libs/elfutils/patches/004-memcpy_def.patch b/libs/elfutils/patches/004-memcpy_def.patch
new file mode 100644 (file)
index 0000000..62e4d0c
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/libelf/libelf.h
++++ b/libelf/libelf.h
+@@ -34,6 +34,11 @@
+ /* Get the ELF types.  */
+ #include <elf.h>
++#ifndef _LIBC
++#ifndef __mempcpy
++#define __mempcpy mempcpy
++#endif
++#endif
+ /* Known translation types.  */
+ typedef enum
diff --git a/libs/elfutils/patches/005-only_libdw_libelf.patch b/libs/elfutils/patches/005-only_libdw_libelf.patch
new file mode 100644 (file)
index 0000000..a2babc0
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -23,8 +23,7 @@ ACLOCAL_AMFLAGS = -I m4
+ pkginclude_HEADERS = version.h
+ # Add doc back when we have some real content.
+-SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
+-        src po
++SUBDIRS = config m4 lib libelf libebl libdwfl libdw
+ EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
+            COPYING COPYING-GPLV2 COPYING-LGPLV3
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -258,8 +258,7 @@ ACLOCAL_AMFLAGS = -I m4
+ pkginclude_HEADERS = version.h
+ # Add doc back when we have some real content.
+-SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
+-        src po
++SUBDIRS = config m4 lib libelf libebl libdwfl libdw
+ EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
+            COPYING COPYING-GPLV2 COPYING-LGPLV3
diff --git a/libs/elfutils/patches/006-libdw_LIBS.patch b/libs/elfutils/patches/006-libdw_LIBS.patch
new file mode 100644 (file)
index 0000000..1d1f9d3
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/libdw/Makefile.am
++++ b/libdw/Makefile.am
+@@ -111,7 +111,7 @@ libdw.so: $(srcdir)/libdw.map libdw_pic.
+               -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+               -Wl,--version-script,$<,--no-undefined \
+               -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+-              -ldl $(zip_LIBS)
++              -ldl $(zip_LIBS) $(LIBS)
+       if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       ln -fs $@ $@.$(VERSION)
+--- a/libdw/Makefile.in
++++ b/libdw/Makefile.in
+@@ -845,7 +845,7 @@ uninstall-am: uninstall-includeHEADERS u
+ @MUDFLAP_FALSE@               -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ @MUDFLAP_FALSE@               -Wl,--version-script,$<,--no-undefined \
+ @MUDFLAP_FALSE@               -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+-@MUDFLAP_FALSE@               -ldl $(zip_LIBS)
++@MUDFLAP_FALSE@               -ldl $(zip_LIBS) $(LIBS)
+ @MUDFLAP_FALSE@       if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ @MUDFLAP_FALSE@       ln -fs $@ $@.$(VERSION)
diff --git a/libs/elfutils/patches/007-no_textrel_checks.patch b/libs/elfutils/patches/007-no_textrel_checks.patch
new file mode 100644 (file)
index 0000000..ce6f7f9
--- /dev/null
@@ -0,0 +1,60 @@
+--- a/libasm/Makefile.am
++++ b/libasm/Makefile.am
+@@ -69,7 +69,6 @@ libasm.so: libasm_pic.a libasm.map
+               -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
+               -Wl,--soname,$@.$(VERSION) \
+               ../libebl/libebl.a ../libelf/libelf.so  $(libasm_so_LDLIBS)
+-      if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       ln -fs $@ $@.$(VERSION)
+ install: install-am libasm.so
+--- a/libasm/Makefile.in
++++ b/libasm/Makefile.in
+@@ -656,7 +656,6 @@ uninstall-am: uninstall-libLIBRARIES uni
+ @MUDFLAP_FALSE@               -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
+ @MUDFLAP_FALSE@               -Wl,--soname,$@.$(VERSION) \
+ @MUDFLAP_FALSE@               ../libebl/libebl.a ../libelf/libelf.so  $(libasm_so_LDLIBS)
+-@MUDFLAP_FALSE@       if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ @MUDFLAP_FALSE@       ln -fs $@ $@.$(VERSION)
+ @MUDFLAP_FALSE@install: install-am libasm.so
+--- a/libdw/Makefile.am
++++ b/libdw/Makefile.am
+@@ -112,7 +112,6 @@ libdw.so: $(srcdir)/libdw.map libdw_pic.
+               -Wl,--version-script,$<,--no-undefined \
+               -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+               -ldl $(zip_LIBS) $(LIBS)
+-      if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       ln -fs $@ $@.$(VERSION)
+ install: install-am libdw.so
+--- a/libdw/Makefile.in
++++ b/libdw/Makefile.in
+@@ -846,7 +846,6 @@ uninstall-am: uninstall-includeHEADERS u
+ @MUDFLAP_FALSE@               -Wl,--version-script,$<,--no-undefined \
+ @MUDFLAP_FALSE@               -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+ @MUDFLAP_FALSE@               -ldl $(zip_LIBS) $(LIBS)
+-@MUDFLAP_FALSE@       if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ @MUDFLAP_FALSE@       ln -fs $@ $@.$(VERSION)
+ @MUDFLAP_FALSE@install: install-am libdw.so
+--- a/libelf/Makefile.am
++++ b/libelf/Makefile.am
+@@ -106,7 +106,6 @@ libelf.so: libelf_pic.a libelf.map
+       $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+               -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
+               -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
+-      if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+       ln -fs $@ $@.$(VERSION)
+ install: install-am libelf.so
+--- a/libelf/Makefile.in
++++ b/libelf/Makefile.in
+@@ -832,7 +832,6 @@ uninstall-am: uninstall-includeHEADERS u
+ @MUDFLAP_FALSE@       $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ @MUDFLAP_FALSE@               -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
+ @MUDFLAP_FALSE@               -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
+-@MUDFLAP_FALSE@       if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
+ @MUDFLAP_FALSE@       ln -fs $@ $@.$(VERSION)
+ @MUDFLAP_FALSE@install: install-am libelf.so
diff --git a/libs/eventlog/Makefile b/libs/eventlog/Makefile
new file mode 100644 (file)
index 0000000..c311692
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2009-2010 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:=eventlog
+PKG_VERSION:=0.2.9
+PKG_RELEASE:=2
+
+PKG_SOURCE_URL:=http://www.balabit.com/downloads/files/eventlog/0.2/
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=76e3d7a0b8f335c12099e9b91191fbf1
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libeventlog
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A new API to format and send structured log messages.
+endef
+
+define Package/eventlog/description
+  A new API to format and send structured log messages. It supports multiple message
+  representations (plain, XML attributes and XML tags) and multiple output methods
+  (local syslogd).
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/eventlog $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/eventlog.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libeventlog/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libeventlog))
diff --git a/libs/ezxml/Makefile b/libs/ezxml/Makefile
new file mode 100644 (file)
index 0000000..ddcf963
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2010 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:=ezxml
+PKG_VERSION:=0.8.6
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ezxml
+PKG_MD5SUM:=e22ae17a0bd82dfa2a66f9876f1a8fd7
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ezxml/Default
+  TITLE:=ezXML
+  URL:=http://ezxml.sourceforge.net/
+endef
+
+define Package/libezxml
+  $(call Package/ezxml/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+endef
+
+define Package/libezxml/description
+       ezXML is a fast and lightweight C library for parsing XML documents.
+endef
+
+TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components 1 $(TAR_OPTIONS)
+
+TARGET_CFLAGS += $(FPIC) -D_GNU_SOURCE
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/ezxml.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libezxml.{a,so} $(1)/usr/lib/
+endef
+
+define Package/libezxml/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libezxml.so $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libezxml))
diff --git a/libs/ezxml/patches/100-cross_compile.patch b/libs/ezxml/patches/100-cross_compile.patch
new file mode 100644 (file)
index 0000000..dd3ef3d
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -21,10 +21,10 @@
+ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+-CC = gcc
+-AR = ar
++#CC = gcc
++#AR = ar
+ RM = rm -f
+-CFLAGS = -Wall -O2
++#CFLAGS = -Wall -O2
+ DEBUG_CFLAGS = -O0 -g
+ OBJS = ezxml.o
+ LIB = libezxml.a
diff --git a/libs/ezxml/patches/101-build_shared.patch b/libs/ezxml/patches/101-build_shared.patch
new file mode 100644 (file)
index 0000000..e3124f0
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -28,6 +28,7 @@ RM = rm -f
+ DEBUG_CFLAGS = -O0 -g
+ OBJS = ezxml.o
+ LIB = libezxml.a
++DYN = libezxml.so
+ TEST = ezxmltest
+ ifdef NOMMAP
+ CFLAGS += -D EZXML_NOMMAP
+@@ -36,11 +37,14 @@ ifdef DEBUG
+ CFLAGS += $(DEBUG_CFLAGS)
+ endif
+-all: $(LIB)
++all: $(LIB) $(DYN)
+ $(LIB): $(OBJS)
+       $(AR) rcs $(LIB) $(OBJS)
++$(DYN): $(OBJS)
++      $(CC) -shared -o $(DYN) $(OBJS)
++
+ nommap: CFLAGS += -D EZXML_NOMMAP
+ nommap: all
diff --git a/libs/ezxml/patches/200-ezxml_parse_str.patch b/libs/ezxml/patches/200-ezxml_parse_str.patch
new file mode 100644 (file)
index 0000000..dd65def
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/ezxml.c
++++ b/ezxml.c
+@@ -599,6 +599,19 @@ ezxml_t ezxml_parse_str(char *s, size_t
+     else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
+ }
++// parse the given xml string and return an ezxml structure
++ezxml_t ezxml_parse_str_d(char const *_s, size_t len)
++{
++    ezxml_root_t root;
++    char *s;
++
++    if (! (s = strndup(_s, len))) return NULL;
++
++    root = (ezxml_root_t)ezxml_parse_str(s, strlen(s));
++    root->len = -1; // so we know to free s in ezxml_free()
++    return &root->xml;
++}
++
+ // Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
+ // stream into memory and then parses it. For xml files, use ezxml_parse_file()
+ // or ezxml_parse_fd()
+--- a/ezxml.h
++++ b/ezxml.h
+@@ -59,6 +59,11 @@ struct ezxml {
+ // pass in the copy. Returns NULL on failure.
+ ezxml_t ezxml_parse_str(char *s, size_t len);
++// Given a string of xml data and its length, parses it and creates an ezxml
++// structure. that strdup()s s
++// Returns NULL on failure.
++ezxml_t ezxml_parse_str_d(char const *s, size_t len);
++
+ // A wrapper for ezxml_parse_str() that accepts a file descriptor. First
+ // attempts to mem map the file. Failing that, reads the file into memory.
+ // Returns NULL on failure.
diff --git a/libs/ezxml/patches/201-ezxml_int.patch b/libs/ezxml/patches/201-ezxml_int.patch
new file mode 100644 (file)
index 0000000..1616bd5
--- /dev/null
@@ -0,0 +1,123 @@
+--- a/ezxml.c
++++ b/ezxml.c
+@@ -25,6 +25,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
++#include <errno.h>
+ #include <string.h>
+ #include <ctype.h>
+ #include <unistd.h>
+@@ -72,6 +73,19 @@ ezxml_t ezxml_idx(ezxml_t xml, int idx)
+     return xml;
+ }
++int ezxml_int(ezxml_t xml, int default_value)
++{
++      int ret;
++      
++      if(!xml)
++              return default_value;
++              
++      errno = 0;
++      ret = strtol(xml->txt, NULL, 10);
++
++      return (errno == 0 ? ret : default_value);
++}
++
+ // returns the value of the requested tag attribute or NULL if not found
+ const char *ezxml_attr(ezxml_t xml, const char *attr)
+ {
+@@ -89,6 +103,23 @@ const char *ezxml_attr(ezxml_t xml, cons
+     return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL; // found default
+ }
++int ezxml_attr_int(ezxml_t xml, const char *attr, int default_value)
++{
++      int ret;
++      const char *val = NULL;
++      
++      if(!xml)
++              return default_value;
++              
++      if((val = ezxml_attr(xml, attr)) == NULL)
++              return default_value;
++      
++      errno = 0;
++      ret = strtol(val, NULL, 10);
++
++      return (errno == 0 ? ret : default_value);
++}
++
+ // same as ezxml_get but takes an already initialized va_list
+ ezxml_t ezxml_vget(ezxml_t xml, va_list ap)
+ {
+@@ -926,6 +957,16 @@ ezxml_t ezxml_set_txt(ezxml_t xml, const
+     return xml;
+ }
++ezxml_t ezxml_set_int(ezxml_t xml, int data)
++{
++      char *buf = NULL;
++      if (! xml) return NULL;
++      
++      asprintf(&buf, "%d", data);
++      
++      return ezxml_set_flag(ezxml_set_txt(xml, buf), EZXML_TXTM);
++}
++
+ // Sets the given tag attribute or adds a new attribute if not found. A value
+ // of NULL will remove the specified attribute. Returns the tag given.
+ ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value)
+@@ -968,6 +1009,15 @@ ezxml_t ezxml_set_attr(ezxml_t xml, cons
+     return xml;
+ }
++ezxml_t ezxml_set_attr_int(ezxml_t xml, const char *name, int data)
++{
++      char *buf = NULL;
++      if (! xml) return NULL;
++      
++      asprintf(&buf, "%d", data);
++      return ezxml_set_attr(ezxml_set_flag(xml, EZXML_DUP), name, buf);
++}
++
+ // sets a flag for the given tag and returns the tag
+ ezxml_t ezxml_set_flag(ezxml_t xml, short flag)
+ {
+--- a/ezxml.h
++++ b/ezxml.h
+@@ -95,9 +95,13 @@ ezxml_t ezxml_idx(ezxml_t xml, int idx);
+ // returns the given tag's character content or empty string if none
+ #define ezxml_txt(xml) ((xml) ? xml->txt : "")
++int ezxml_int(ezxml_t xml, int default_value);
++
+ // returns the value of the requested tag attribute, or NULL if not found
+ const char *ezxml_attr(ezxml_t xml, const char *attr);
++int ezxml_attr_int(ezxml_t xml, const char *attr, int default_value);
++
+ // Traverses the ezxml sturcture to retrieve a specific subtag. Takes a
+ // variable length list of tag names and indexes. The argument list must be
+ // terminated by either an index of -1 or an empty string tag name. Example: 
+@@ -137,6 +141,9 @@ ezxml_t ezxml_add_child(ezxml_t xml, con
+ // sets the character content for the given tag and returns the tag
+ ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt);
++// set int value
++ezxml_t ezxml_set_int(ezxml_t xml, int data);
++
+ // wrapper for ezxml_set_txt() that strdup()s txt
+ #define ezxml_set_txt_d(xml, txt) \
+     ezxml_set_flag(ezxml_set_txt(xml, strdup(txt)), EZXML_TXTM)
+@@ -144,6 +151,9 @@ ezxml_t ezxml_set_txt(ezxml_t xml, const
+ // Sets the given tag attribute or adds a new attribute if not found. A value
+ // of NULL will remove the specified attribute. Returns the tag given.
+ ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value);
++      
++// set int value for an attr
++ezxml_t ezxml_set_attr_int(ezxml_t xml, const char *name, int data);
+ // Wrapper for ezxml_set_attr() that strdup()s name/value. Value cannot be NULL
+ #define ezxml_set_attr_d(xml, name, value) \
diff --git a/libs/ezxml/patches/202-ezxml_child.patch b/libs/ezxml/patches/202-ezxml_child.patch
new file mode 100644 (file)
index 0000000..96e3085
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/ezxml.h
++++ b/ezxml.h
+@@ -175,6 +175,17 @@ ezxml_t ezxml_insert(ezxml_t xml, ezxml_
+ // removes a tag along with all its subtags
+ #define ezxml_remove(xml) ezxml_free(ezxml_cut(xml))
++static inline char const * ezxml_child_txt( ezxml_t node, char const *child )
++{
++      return ezxml_txt( ezxml_child( node, child ) );
++}
++
++static inline ezxml_t ezxml_child_set_txt_d( ezxml_t node, char const *child,
++                                      char const *value )
++{
++      return ezxml_set_txt_d( ezxml_child( node, child ), value );
++}
++
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/libs/ezxml/patches/203-ezxml_cut.patch b/libs/ezxml/patches/203-ezxml_cut.patch
new file mode 100644 (file)
index 0000000..63642de
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/ezxml.c
++++ b/ezxml.c
+@@ -1042,7 +1042,7 @@ ezxml_t ezxml_cut(ezxml_t xml)
+             cur = xml->parent->child; // go back to head of subtag list
+             if (strcmp(cur->name, xml->name)) { // not in first sibling list
+-                while (strcmp(cur->sibling->name, xml->name))
++                while (cur->sibling && strcmp(cur->sibling->name, xml->name))
+                     cur = cur->sibling;
+                 if (cur->sibling == xml) { // first of a sibling list
+                     cur->sibling = (xml->next) ? xml->next
+@@ -1051,8 +1051,9 @@ ezxml_t ezxml_cut(ezxml_t xml)
+                 else cur = cur->sibling; // not first of a sibling list
+             }
+-            while (cur->next && cur->next != xml) cur = cur->next;
+-            if (cur->next) cur->next = cur->next->next; // patch next list
++            cur = xml->parent->child; // go back to head of subtag list
++            while (cur && cur->next != xml) cur = cur->ordered;
++            if (cur && cur->next) cur->next = cur->next->next; // patch next list
+         }        
+     }
+     xml->ordered = xml->sibling = xml->next = NULL;
diff --git a/libs/fftw3/Makefile b/libs/fftw3/Makefile
new file mode 100644 (file)
index 0000000..bc4eff9
--- /dev/null
@@ -0,0 +1,118 @@
+#
+# Copyright (C) 2007-2010 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:=fftw3
+PKG_VERSION:=3.2.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=fftw-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.fftw.org
+PKG_MD5SUM:=b616e5c91218cc778b5aa735fefb61ae
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/fftw-$(PKG_VERSION)
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fftw3
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=@!avr32 +libpthread
+  VARIANT:=double
+  TITLE:=Fast Fourier transform library
+  URL:=http://www.fftw.org/
+endef
+
+define Package/fftw3f
+  $(call Package/fftw3)
+  VARIANT:=single
+  TITLE+= (single precision)
+endef
+
+define Package/fftw3l
+  $(call Package/fftw3)
+  DEPENDS:=@BROKEN
+  VARIANT:=long-double
+  TITLE+= (long-double precision)
+endef
+
+define Package/fftw3/description
+       FFTW is a collection of fast C routines for computing the
+       Discrete Fourier Transform in one or more dimensions. It
+       includes complex, real, and parallel transforms, and can
+       handle arbitrary array sizes efficiently.
+endef
+
+define Package/fftw3f/description
+  $(call Package/fftw3/description)
+
+  This package contains the single precision library.
+endef
+
+define Package/fftw3l/description
+  $(call Package/fftw3/description)
+
+  This package contains the long-double precision library.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --prefix=/usr \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+       --disable-nls \
+       --enable-shared \
+       --enable-threads \
+       --enable-type-prefix \
+       --disable-debug \
+       --disable-fortran
+
+ifeq ($(BUILD_VARIANT), single)
+CONFIGURE_ARGS += \
+       --enable-single
+endif
+
+ifeq ($(BUILD_VARIANT), long-double)
+CONFIGURE_ARGS += \
+       --enable-long-double
+endif
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/fftw3.h $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfftw3*.{a,la} $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfftw3*.so* $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/fftw3/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfftw3.so* $(1)/usr/lib/
+endef
+
+define Package/fftw3f/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfftw3f.so* $(1)/usr/lib/
+endef
+
+define Package/fftw3l/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfftw3l.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,fftw3))
+$(eval $(call BuildPackage,fftw3f))
+$(eval $(call BuildPackage,fftw3l))
diff --git a/libs/fftw3/patches/001-makefile.patch b/libs/fftw3/patches/001-makefile.patch
new file mode 100644 (file)
index 0000000..d09bc2d
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -110,7 +110,7 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-re
+ ETAGS = etags
+ CTAGS = ctags
+ DIST_SUBDIRS = support genfft kernel simd dft rdft reodft api threads \
+-      cell libbench2 . tests doc tools m4
++      cell libbench2 . doc tools m4
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -278,7 +278,7 @@ lib_LTLIBRARIES = libfftw3@PREC_SUFFIX@.
+ @MAINTAINER_MODE_TRUE@GENFFT = genfft
+ ACLOCAL_AMFLAGS = -I m4
+ SUBDIRS = support $(GENFFT) kernel simd dft rdft reodft api threads \
+-cell libbench2 . tests doc tools m4
++cell libbench2 . m4
+ EXTRA_DIST = COPYRIGHT bootstrap.sh CONVENTIONS fftw.pc.in README.Cell
+ @HAVE_SIMD_TRUE@SIMD_LIBS = \
diff --git a/libs/file/Makefile b/libs/file/Makefile
new file mode 100644 (file)
index 0000000..7831a43
--- /dev/null
@@ -0,0 +1,94 @@
+#
+# Copyright (C) 2007-2012 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:=file
+PKG_VERSION:=5.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.astron.com/pub/file/
+PKG_MD5SUM:=16a407bd66d6c7a832f3a5c0d609c27b
+
+PKG_LICENSE:=BSD-2c
+PKG_LICENSE_FILES:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/file/Default
+  TITLE:=File type determination
+  URL:=ftp://ftp.astron.com/pub/file/
+  MAINTAINER:=Luka Perkov <openwrt@lukaperkov.net>
+endef
+
+define Package/file
+$(call package/file/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= utility
+  DEPENDS:=+libmagic
+endef
+
+define Package/libmagic
+$(call package/file/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+  DEPENDS:=+zlib
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+MAKE_PATH := src
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile/magic
+       ( cd $(PKG_BUILD_DIR)/magic/Magdir; \
+               for f in `ls`; do \
+                       cat $$$${f}; \
+               done \
+       ) > $(PKG_BUILD_DIR)/magic/magic
+endef
+Hooks/Compile/Post += Build/Compile/magic
+
+define Build/Install/magic
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/file
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/magic $(PKG_INSTALL_DIR)/usr/share/file/
+endef
+Hooks/Install/Post += Build/Install/magic
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/magic.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/file/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/misc
+       $(SED) "/^#/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
+       $(SED) "/^$$$$/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/file/magic $(1)/usr/share/misc/
+endef
+
+define Package/libmagic/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,file))
+$(eval $(call BuildPackage,libmagic))
diff --git a/libs/freetype/Makefile b/libs/freetype/Makefile
new file mode 100644 (file)
index 0000000..3a979bb
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2012 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:=freetype
+PKG_VERSION:=2.4.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/freetype
+PKG_MD5SUM:=dbf2caca1d3afd410a29217a9809d397
+
+PKG_LICENSE:=FTL GPLv2 MIT ZLIB
+PKG_LICENSE_FILES:=docs/LICENSE.TXT docs/FTL.TXT docs/GPLv2.TXT src/bdf/README src/pcf/README src/gzip/zlib.h
+
+PKG_FIXUP:=autoreconf
+PKG_LIBTOOL_PATHS:=builds/unix
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libfreetype
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A free, high-quality and portable font engine
+  URL:=http://www.freetype.org/
+  DEPENDS:=+zlib +libbz2
+endef
+
+define Package/libfreetype/description
+ The FreeType project is a team of volunteers who develop free,
+ portable and high-quality software solutions for digital typography.
+ They specifically target embedded systems and focus on bringing small,
+ efficient and ubiquitous products.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/freetype-config $(2)/bin/
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/freetype2 $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ft2build.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreetype.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/freetype2.pc $(1)/usr/lib/pkgconfig/
+
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1="$(STAGING_DIR)/usr",g' \
+                $(2)/bin/freetype-config
+endef
+
+
+define Package/libfreetype/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreetype.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,libfreetype))
diff --git a/libs/fribidi/Makefile b/libs/fribidi/Makefile
new file mode 100644 (file)
index 0000000..2ba43b2
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2006-2010 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:=fribidi
+PKG_VERSION:=0.10.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fribidi.org/download
+PKG_MD5SUM:=647aee89079b056269ff0918dc1c6d28
+
+PKG_LICENSE:=LGPLv2.1
+PKG_LICENSE_FILES:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fribidi
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GNU FriBidi is an implementation of the Unicode Bidirectional Algorithm (bidi)
+  URL:=http://fribidi.org
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/fribidi $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/fribidi/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfribidi.so* $(1)/usr/lib/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,fribidi))
diff --git a/libs/ftplib/Makefile b/libs/ftplib/Makefile
new file mode 100644 (file)
index 0000000..1c6b516
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2008-2014 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:=ftplib
+PKG_VERSION:=3.1-1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nbpfaus.net/~pfau/ftplib/
+PKG_MD5SUM:=763be9c7e7b110776f88521a558dbc55
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKE_PATH:=src
+
+define Package/ftplib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=ftplib
+  URL:=http://nbpfaus.net/~pfau/ftplib/
+endef
+
+define Package/ftplib/description
+ftplib is a set of routines that implement the FTP protocol. They allow
+applications to create and access remote files through function calls instead
+of needing to fork and exec an interactive ftp client program.
+endef
+
+MAKE_FLAGS += \
+       DEFINES="$(TARGET_CFLAGS)"
+
+define Build/Compile
+       $(call Build/Compile/Default,all)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/ftplib.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/src/libftp.{so*,a} $(1)/usr/lib/
+endef
+
+define Package/ftplib/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/src/libftp.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,ftplib))
diff --git a/libs/ftplib/patches/001-fix_ascii_read_without_eol.patch b/libs/ftplib/patches/001-fix_ascii_read_without_eol.patch
new file mode 100644 (file)
index 0000000..a1b56c7
--- /dev/null
@@ -0,0 +1,38 @@
+Description: Fix reading FTP data is ASCII mode
+ In ASCII mode, if you don't have a line in the next block that you're
+ trying to read, then ftplib would set the first character to '\0'.
+ .
+ Upstream probably intented to return an empty string when requesting
+ to read only 1 character since that doesn't make much sense when the
+ EOL delimiter is 2 characters already (\r\n). However, due to the
+ way data is read, max can be set to 1 just after having read max-1
+ legitimate bytes and we should not be overwriting the first byte.
+ .
+ Patch is not submitted upstream since upstream is not actively
+ maintaining it.
+Origin: vendor, see Author
+Author: Raphaël Hertzog <hertzog@debian.org>
+Last-Update: 2009-11-24
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- a/src/ftplib.c
++++ b/src/ftplib.c
+@@ -220,7 +220,6 @@ static int readline(char *buf,int max,ne
+       }
+       if (max == 1)
+       {
+-          *buf = '\0';
+           break;
+       }
+       if (ctl->cput == ctl->cget)
diff --git a/libs/ftplib/patches/002-check_getserv_by_name.patch b/libs/ftplib/patches/002-check_getserv_by_name.patch
new file mode 100644 (file)
index 0000000..59ab73d
--- /dev/null
@@ -0,0 +1,28 @@
+Description: Verify value returned by getservbyname
+ getservbyname() can return a NULL pointer and dereferencing it
+ would lead to a segfault.
+ .
+ The patch is not forwarded upstream but there's no real maintainance
+ upstream any more.
+Origin: vendor, see changelog entry 3.1-1-2
+Author: Richard Braakman <dark@xs4all.nl>
+Last-Update: 2009-10-29
+Forwarded: no
+
+diff --git a/linux/ftplib.c b/linux/ftplib.c
+index 9089a5b..c4a5873 100644
+--- a/src/ftplib.c
++++ b/src/ftplib.c
+@@ -416,7 +416,11 @@ GLOBALDEF int FtpConnect(const char *host, netbuf **nControl)
+           sin.sin_port = htons(atoi(pnum));
+       else
+       {
+-          pse = getservbyname(pnum,"tcp");
++          if ((pse = getservbyname(pnum,"tcp")) == NULL)
++            {
++                perror("getservbyname");
++                return 0;
++            }
+           sin.sin_port = pse->s_port;
+       }
+     }
diff --git a/libs/giflib/Makefile b/libs/giflib/Makefile
new file mode 100644 (file)
index 0000000..e703f45
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2006-2014 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:=giflib
+PKG_VERSION:=5.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/giflib
+PKG_MD5SUM:=c7e9f1c10b755ab955156d4c1ac7fc5d
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/giflib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GIF libraries
+  URL:=http://sourceforge.net/projects/giflib
+endef
+
+define Package/giflib/description
+  giflib is a library for reading and writing gif images.
+  It is API and ABI compatible with libungif which was in wide use while
+  the LZW compression algorithm was patented.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+CONFIGURE_ARGS += --enable-x11=no
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib,include}
+       $(CP) $(PKG_BUILD_DIR)/lib/.libs/lib*so* $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/.libs/libgif.a $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libgif.la $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/*.h $(1)/usr/include/
+endef
+
+define Package/giflib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/.libs/lib*so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,giflib))
diff --git a/libs/glib/Makefile b/libs/glib/Makefile
new file mode 100644 (file)
index 0000000..7ed894d
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# Copyright (C) 2006 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:=glib
+PKG_VERSION:=1.2.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.gtk.org/pub/gtk/v1.2 \
+       http://ftp.gwdg.de/pub/misc/grafik/gimp/gtk/v1.2/ \
+       http://ftp.esat.net/mirrors/ftp.gimp.org/pub/gtk/v1.2/ \
+       http://www.mirrorservice.org/sites/ftp.gimp.org/pub/gtk/v1.2/
+PKG_MD5SUM:=6fe30dad87c77b91b632def29dd69ef9
+
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=COPYING docs/reference/COPYING glib/pcre/COPYING gmodule/COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 acinclude.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/glib1
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpthread
+  TITLE:=The GLib library of C routines
+  URL:=http://www.gtk.org/
+endef
+
+define Package/glib1/description
+ GLib is a library containing many useful C routines for things such
+ as trees, hashes, and lists.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/lib
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+CONFIGURE_VARS += \
+       glib_cv_prog_cc_ansi_proto=no \
+       glib_cv_has__inline=yes \
+       glib_cv_has__inline__=yes \
+       glib_cv_hasinline=yes \
+       glib_cv_sane_realloc=yes \
+       glib_cv_va_copy=no \
+       glib_cv___va_copy=yes \
+       glib_cv_va_val_copy=yes \
+       glib_cv_rtldglobal_broken=no \
+       glib_cv_uscore=no \
+       glib_cv_func_pthread_mutex_trylock_posix=yes \
+       glib_cv_func_pthread_cond_timedwait_posix=yes \
+       glib_cv_sizeof_gmutex=24 \
+       glib_cv_byte_contents_gmutex="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" \
+       glib_cv_sys_pthread_getspecific_posix=yes \
+       glib_cv_sys_pthread_mutex_trylock_posix=yes \
+       glib_cv_sys_pthread_cond_timedwait_posix=yes \
+       ac_cv_func_getpwuid_r=yes \
+       ac_cv_func_getpwuid_r_posix=yes
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1) $(2)/bin
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+       $(CP) $(PKG_BUILD_DIR)/.libs/*.a $(PKG_BUILD_DIR)/*/.libs/*.a $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/glibconfig-sysdefs.h $(1)/usr/include/glib-1.2/
+       ln -sf $(STAGING_DIR)/usr/bin/glib-config $(2)/bin/
+       $(SED) 's,-I$$$${prefix}/include/glib,-I$(STAGING_DIR)/usr/include/glib,g' $(1)/usr/bin/glib-config
+       $(SED) 's,-I$$$${exec_prefix}/lib/glib,-I$(STAGING_DIR)/usr/lib/glib,g' $(1)/usr/bin/glib-config
+       $(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/glib-config
+endef
+
+define Package/glib1/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libg{lib,module,thread}-1.2.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,glib1))
diff --git a/libs/glib/patches/001-automake-compat.patch b/libs/glib/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..195f5a0
--- /dev/null
@@ -0,0 +1,286 @@
+--- a/configure.in
++++ b/configure.in
+@@ -1,10 +1,9 @@
+ dnl ***********************************
+ dnl *** include special GLib macros ***
+ dnl ***********************************
+-builtin(include, acglib.m4)dnl
+-# require autoconf 2.13
+-AC_PREREQ(2.13)
++# require autoconf 2.53
++AC_PREREQ(2.53)
+ # init autoconf (and check for presence of glist.c)
+ AC_INIT(glist.c)
+@@ -13,11 +12,10 @@ AC_INIT(glist.c)
+ cflags_set=${CFLAGS+set}
+ # we rewrite this file
+-rm -f glibconfig-sysdefs.h
++if test "x$cross_compiling" != "xyes"; then
++      rm -f glibconfig-sysdefs.h
++fi
+-dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
+-dnl are available for $ac_help expansion (don't we all *love* autoconf?)
+-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+ #
+ # The following version number definitions apply to GLib, GModule and GThread
+ # as a whole, so if changes occoured in any of them, they are all
+@@ -38,7 +36,6 @@ GLIB_INTERFACE_AGE=10
+ GLIB_BINARY_AGE=10
+ GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
+ dnl
+-AC_DIVERT_POP()dnl
+ AC_SUBST(GLIB_MAJOR_VERSION)
+ AC_SUBST(GLIB_MINOR_VERSION)
+@@ -77,17 +74,13 @@ AM_PROG_LIBTOOL
+ dnl Initialize maintainer mode
+ AM_MAINTAINER_MODE
+-AC_CANONICAL_HOST
+-
+ dnl figure debugging default, prior to $ac_help setup
+ dnl
+-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+ if test `expr $GLIB_MINOR_VERSION \% 2` = 1 ; then
+       debug_default=yes
+ else
+       debug_default=minimum
+ fi
+-AC_DIVERT_POP()dnl
+ dnl declare --enable-* args and collect ac_help strings
+ AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
+@@ -178,38 +171,6 @@ if test "x$GCC" = "xyes"; then
+ fi
+ changequote([,])dnl
+-dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
+-AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
+-glib_save_LIBS=$LIBS
+-LIBS="$LIBS -lm"
+-AC_TRY_RUN([#include <math.h>
+-             int main (void) { return (log(1) != log(1.)); }],
+-     AC_MSG_RESULT(none needed),
+-     glib_save_CFLAGS=$CFLAGS
+-     CFLAGS="$CFLAGS -std1"
+-     AC_TRY_RUN([#include <math.h>
+-                 int main (void) { return (log(1) != log(1.)); }],
+-         AC_MSG_RESULT(-std1),
+-         AC_MSG_RESULT()
+-         CFLAGS=$glib_save_CFLAGS
+-         AC_MSG_WARN(
+-                [No ANSI prototypes found in library. (-std1 didn't work.)])
+-     )
+-)
+-LIBS=$glib_save_LIBS
+-
+-dnl NeXTStep cc seems to need this
+-AC_MSG_CHECKING([for extra flags for POSIX compliance])
+-AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
+-  AC_MSG_RESULT(none needed),
+-  glib_save_CFLAGS=$CFLAGS
+-  CFLAGS="$CFLAGS -posix"
+-  AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
+-    AC_MSG_RESULT(-posix),
+-    AC_MSG_RESULT()
+-    CFLAGS=$glib_save_CFLAGS
+-    AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
+-
+ # Checks for header files.
+ AC_HEADER_STDC
+@@ -405,11 +366,13 @@ AC_CACHE_VAL(glib_cv_sane_realloc,[
+         return realloc (0, sizeof (int)) == 0;
+       }],
+       glib_cv_sane_realloc=yes
+-      AC_DEFINE(REALLOC_0_WORKS)
+       ,
+       glib_cv_sane_realloc=no
+       ,)
+ ])
++if test "x$glib_cv_sane_realloc" = "xyes"; then
++      AC_DEFINE(REALLOC_0_WORKS)
++fi
+ AC_MSG_RESULT($glib_cv_sane_realloc)
+@@ -485,7 +448,8 @@ AC_CACHE_VAL(glib_cv_va_val_copy,[
+ ])
+ if test "x$glib_cv_va_copy" = "xyes"; then
+   AC_DEFINE(G_VA_COPY, va_copy)
+-else if test "x$glib_cv___va_copy" = "xyes"; then
++else
++if test "x$glib_cv___va_copy" = "xyes"; then
+   AC_DEFINE(G_VA_COPY, __va_copy)
+ fi
+ fi
+@@ -505,21 +469,13 @@ G_MODULE_NEED_USCORE=0
+ G_MODULE_BROKEN_RTLD_GLOBAL=0
+ G_MODULE_HAVE_DLERROR=0
+ dnl *** dlopen() and dlsym() in system libraries
+-if test -z "$G_MODULE_IMPL"; then
+-      AC_CHECK_FUNC(dlopen,
+-              AC_CHECK_FUNC(dlsym,
+-                      G_MODULE_IMPL=G_MODULE_IMPL_DL
+-              ,)
+-      ,)
+-fi
++AC_CHECK_FUNC([dlopen], [AC_CHECK_FUNC([dlsym], [G_MODULE_IMPL=G_MODULE_IMPL_DL], [])], [])
+ dnl *** dlopen() and dlsym() in libdl
+ if test -z "$G_MODULE_IMPL"; then
+-      AC_CHECK_LIB(dl, dlopen,
+-              AC_CHECK_LIB(dl, dlsym,
+-                      G_MODULE_LIBS=-ldl
+-                      G_MODULE_IMPL=G_MODULE_IMPL_DL
+-              ,)
+-      ,)
++      AC_CHECK_LIB([dl], [dlopen], [AC_CHECK_LIB([dl], [dlsym], [
++              G_MODULE_LIBS=-ldl
++              G_MODULE_IMPL=G_MODULE_IMPL_DL
++      ], [])], [])
+ fi
+ dnl *** shl_load() in libdld (HP-UX)
+ if test -z "$G_MODULE_IMPL"; then
+@@ -854,49 +810,68 @@ if test x"$have_threads" != xnone; then
+                       AC_MSG_CHECKING(whether getpwuid_r is posix like)
+                       # The signature for the POSIX version is:
+                       # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **)
+-                      AC_TRY_COMPILE([#include <pwd.h>
+-                                        #include <sys/types.h>
+-                                        #include <stdlib.h>],
+-                              [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
+-                              [AC_DEFINE(HAVE_GETPWUID_R_POSIX)
+-                              AC_MSG_RESULT(yes)],
+-                              [AC_MSG_RESULT(no)])
++                      AC_CACHE_CHECK([whether pthread_getspecific is posix like],
++                              [ac_cv_func_getpwuid_r_posix],
++                              [AC_TRY_COMPILE([#include <pwd.h>
++                                 #include <sys/types.h>
++                                 #include <stdlib.h>],
++                                      [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
++                                      [ac_cv_func_getpwuid_r_posix=yes],
++                                      [ac_cv_func_getpwuid_r_posix=no])]
++                      )
++                      if test "x$ac_cv_func_getpwuid_r_posix" = "xyes"; then
++                              AC_DEFINE(HAVE_GETPWUID_R_POSIX)
++                      fi
+               fi
+       fi
+       if test x"$have_threads" = xposix; then
+               LIBS="$LIBS $G_THREAD_LIBS"
+               AC_MSG_CHECKING(whether pthread_getspecific is posix like)
+               # PCThreads has pthread_getspecific(pthread_key_t, void **);
+-              AC_TRY_COMPILE([#include <pthread.h>],
+-                      [pthread_getspecific(0,NULL);],
+-                      [AC_MSG_RESULT(no)],
+-                      [AC_MSG_RESULT(yes)
+-                      AC_DEFINE(HAVE_PTHREAD_GETSPECIFIC_POSIX)])
++              AC_CACHE_CHECK([whether pthread_getspecific is posix like],
++                      [glib_cv_sys_pthread_getspecific_posix],
++                      [AC_TRY_COMPILE([#include <pthread.h>],
++                              [pthread_getspecific(0,NULL);],
++                              [glib_cv_sys_pthread_getspecific_posix=no],
++                              [glib_cv_sys_pthread_getspecific_posix=yes])]
++              )
++              if test "x$glib_cv_sys_pthread_getspecific_posix" = "xyes"; then
++                      AC_DEFINE(HAVE_PTHREAD_GETSPECIFIC_POSIX)
++              fi
+               AC_MSG_CHECKING(whether pthread_mutex_trylock is posix like)
+               # DCE Threads return 1 as success, posix 0. what a mess.
+-              AC_TRY_RUN([#include <pthread.h>
+-                      pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+-                      int main () { 
+-                      return !pthread_mutex_trylock (&mutex); }],
+-                      [AC_MSG_RESULT(no)],
+-                      [AC_MSG_RESULT(yes)
+-                      AC_DEFINE(HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX)])
++              AC_CACHE_CHECK([whether pthread_mutex_trylock is posix like],
++                      [glib_cv_sys_pthread_mutex_trylock_posix],
++                      [AC_TRY_RUN([#include <pthread.h>
++                              pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
++                              int main () { 
++                              return !pthread_mutex_trylock (&mutex); }],
++                      [glib_cv_sys_pthread_mutex_trylock_posix=no],
++                      [glib_cv_sys_pthread_mutex_trylock_posix=yes])]
++              )
++              if test "x$glib_cv_sys_pthread_mutex_trylock_posix=no" = "xyes"; then
++                      AC_DEFINE(HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX)
++              fi
+               AC_MSG_CHECKING(whether pthread_cond_timedwait is posix like)
+               # DCE Threads return -1 as failure, posix ETIMEDOUT.
+-              AC_TRY_RUN([#include <pthread.h>
+-                      int main () { 
+-                      pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+-                      pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+-                      struct timeval tval;
+-                      struct timespec tspec;
+-                      gettimeofday (&tval, NULL);
+-                      tspec.tv_sec = tval.tv_sec;
+-                      tspec.tv_nsec = 0;
+-                      return pthread_cond_timedwait (&cond,&mutex,&tspec) 
+-                              != -1;}],
+-                      [AC_MSG_RESULT(no)],
+-                      [AC_MSG_RESULT(yes)
+-                      AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_POSIX)])
++              AC_CACHE_CHECK([whether pthread_cond_timedwait is posix like],
++                      [glib_cv_sys_pthread_cond_timedwait_posix],
++                      [AC_TRY_RUN([#include <pthread.h>
++                              int main () { 
++                              pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
++                              pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
++                              struct timeval tval;
++                              struct timespec tspec;
++                              gettimeofday (&tval, NULL);
++                              tspec.tv_sec = tval.tv_sec;
++                              tspec.tv_nsec = 0;
++                              return pthread_cond_timedwait (&cond,&mutex,&tspec) != -1;}],
++                      [glib_cv_sys_pthread_cond_timedwait_posix=no],
++                      [glib_cv_sys_pthread_cond_timedwait_posix=yes])]
++              )
++              if test "x$glib_cv_sys_pthread_cond_timedwait_posix" = "xyes"; then
++                      AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_POSIX)
++              fi
+       fi
+       LIBS="$glib_save_LIBS"
+       CFLAGS="$glib_save_CFLAGS"
+@@ -940,12 +915,14 @@ GLIB_IF_VAR_EQ(mutex_has_default, yes,
+ dnl ****************************************
+ dnl *** GLib POLL* compatibility defines ***
+ dnl ****************************************
++if test "x$cross_compiling" != "xyes"; then
+ GLIB_SYSDEFS(
+ [#include <sys/types.h>
+ #include <sys/poll.h>],
+       POLLIN:1 POLLOUT:4 POLLPRI:2 POLLERR:8 POLLHUP:16 POLLNVAL:32,
+       glibconfig-sysdefs.h,
+       =)
++fi
+ dnl ******************************
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -70,7 +70,7 @@ configinclude_DATA = \
+ CONFIGURE_DEPENDENCIES = acglib.m4            
+-BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h
++BUILT_SOURCES += stamp-gc-h #note: not glibconfig.h
+ glibconfig.h: stamp-gc-h
+       @:
+ stamp-gc-h: config.status
+--- a/gmodule/Makefile.am
++++ b/gmodule/Makefile.am
+@@ -42,7 +42,7 @@ libgplugin_b_la_LDFLAGS = @G_MODULE_LDFL
+ libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ # $(libglib)
+ noinst_PROGRAMS = testgmodule
+-testgmodule_LDFLAGS += @G_MODULE_LDFLAGS@
++testgmodule_LDFLAGS = @G_MODULE_LDFLAGS@
+ testgmodule_LDADD = libgmodule.la $(libglib) @G_MODULE_LIBS@
+ .PHONY: files release
diff --git a/libs/glib/patches/002-glibconfig-sysdefs.h.patch b/libs/glib/patches/002-glibconfig-sysdefs.h.patch
new file mode 100644 (file)
index 0000000..be21652
--- /dev/null
@@ -0,0 +1,9 @@
+--- /dev/null
++++ b/glibconfig-sysdefs.h
+@@ -0,0 +1,6 @@
++#define GLIB_SYSDEF_POLLIN    =1
++#define GLIB_SYSDEF_POLLPRI   =2
++#define GLIB_SYSDEF_POLLOUT   =4
++#define GLIB_SYSDEF_POLLERR   =8
++#define GLIB_SYSDEF_POLLHUP   =16
++#define GLIB_SYSDEF_POLLNVAL  =32
diff --git a/libs/glib/patches/003-gcc-3.4-compat.patch b/libs/glib/patches/003-gcc-3.4-compat.patch
new file mode 100644 (file)
index 0000000..9b58ab5
--- /dev/null
@@ -0,0 +1,22 @@
+Submitted By: Uwe Düffert (lfs at uwe-dueffert dot de)
+Date: 2004-05-15
+Initial Package Version: 1.2.10
+Origin: self-created, http://www.uwe-dueffert.de/lfs/ownpatches/glib-1.2.10-gcc34-1.patch
+Upstream Status: not reported
+Description: fix compilation of glib1 with gcc34
+$LastChangedBy: pavlov $
+$Date: 2007-03-05 02:34:12 +0100 (Mon, 05 Mar 2007) $
+
+diff -Naur glib-1.2.10.orig/gstrfuncs.c glib-1.2.10/gstrfuncs.c
+--- glib-1.2.10.orig/gstrfuncs.c       2004-05-15 13:40:03.556092792 +0000
++++ glib-1.2.10/gstrfuncs.c    2004-05-15 13:40:36.712052320 +0000
+@@ -47,6 +47,8 @@
+  * inteferes with g_strsignal() on some OSes
+  */
++#define G_GNUC_PRETTY_FUNCTION
++
+ typedef union  _GDoubleIEEE754  GDoubleIEEE754;
+ #define G_IEEE754_DOUBLE_BIAS   (1023)
+ /* multiply with base2 exponent to get base10 exponent (nomal numbers) */
diff --git a/libs/glib/patches/004-underquoted-glib.m4.patch b/libs/glib/patches/004-underquoted-glib.m4.patch
new file mode 100644 (file)
index 0000000..4c76b57
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/glib.m4
++++ b/glib.m4
+@@ -5,7 +5,7 @@ dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTI
+ dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or 
+ dnl gthread is specified in MODULES, pass to glib-config
+ dnl
+-AC_DEFUN(AM_PATH_GLIB,
++AC_DEFUN([AM_PATH_GLIB],
+ [dnl 
+ dnl Get the cflags and libraries from the glib-config script
+ dnl
diff --git a/libs/glibmm/Makefile b/libs/glibmm/Makefile
new file mode 100644 (file)
index 0000000..19fb30e
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2009-2010 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:=glibmm
+PKG_VERSION:=2.22.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/glibmm/2.22
+PKG_MD5SUM:=1a96c7fde75ddbb421bc23fb4aa7adba
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/glibmm
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libsigcxx +glib2 +libstdcpp
+  TITLE:=glibmm
+  URL:=http://www.gtk.org/
+endef
+
+define Package/glibmm/description
+c++ bindings for glib2
+endef
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+CONFIGURE_ARGS+= --disable-fulldocs
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig
+endef
+
+define Package/glibmm/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,glibmm))
diff --git a/libs/glibmm/patches/100-disable-examples-tests-doc-tools-scripts.patch b/libs/glibmm/patches/100-disable-examples-tests-doc-tools-scripts.patch
new file mode 100644 (file)
index 0000000..4cbfefb
--- /dev/null
@@ -0,0 +1,125 @@
+diff -ruN glibmm-2.22.1.orig/configure glibmm-2.22.1/configure
+--- glibmm-2.22.1.orig/configure       2009-09-21 18:07:01.000000000 +0200
++++ glibmm-2.22.1/configure    2009-11-05 17:32:32.000000000 +0100
+@@ -18361,7 +18361,7 @@
+   fi
+-ac_config_files="$ac_config_files Makefile tools/Makefile tools/gmmproc tools/generate_wrap_init.pl glib/${GLIBMM_MODULE_NAME}.pc:glib/glibmm.pc.in glib/${GLIBMM_MODULE_NAME}-uninstalled.pc:glib/glibmm-uninstalled.pc.in glib/src/Makefile glib/glibmm/Makefile gio/${GIOMM_MODULE_NAME}.pc:gio/giomm.pc.in gio/${GIOMM_MODULE_NAME}-uninstalled.pc:gio/giomm-uninstalled.pc.in gio/src/Makefile gio/giomm/Makefile tests/Makefile examples/Makefile docs/Makefile docs/reference/Doxyfile MSVC_Net2005/glibmm/glibmm.rc MSVC_Net2005/giomm/giomm.rc MSVC_Net2008/glibmm/glibmm.rc MSVC_Net2008/giomm/giomm.rc"
++ac_config_files="$ac_config_files Makefile glib/${GLIBMM_MODULE_NAME}.pc:glib/glibmm.pc.in glib/${GLIBMM_MODULE_NAME}-uninstalled.pc:glib/glibmm-uninstalled.pc.in glib/src/Makefile glib/glibmm/Makefile gio/${GIOMM_MODULE_NAME}.pc:gio/giomm.pc.in gio/${GIOMM_MODULE_NAME}-uninstalled.pc:gio/giomm-uninstalled.pc.in gio/src/Makefile gio/giomm/Makefile MSVC_Net2005/glibmm/glibmm.rc MSVC_Net2005/giomm/giomm.rc MSVC_Net2008/glibmm/glibmm.rc MSVC_Net2008/giomm/giomm.rc"
+ # Copy the generated configuration headers into the MSVC project directories.
+@@ -19400,9 +19400,6 @@
+     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+-    "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
+-    "tools/gmmproc") CONFIG_FILES="$CONFIG_FILES tools/gmmproc" ;;
+-    "tools/generate_wrap_init.pl") CONFIG_FILES="$CONFIG_FILES tools/generate_wrap_init.pl" ;;
+     "glib/${GLIBMM_MODULE_NAME}.pc") CONFIG_FILES="$CONFIG_FILES glib/${GLIBMM_MODULE_NAME}.pc:glib/glibmm.pc.in" ;;
+     "glib/${GLIBMM_MODULE_NAME}-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES glib/${GLIBMM_MODULE_NAME}-uninstalled.pc:glib/glibmm-uninstalled.pc.in" ;;
+     "glib/src/Makefile") CONFIG_FILES="$CONFIG_FILES glib/src/Makefile" ;;
+@@ -19411,10 +19408,6 @@
+     "gio/${GIOMM_MODULE_NAME}-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES gio/${GIOMM_MODULE_NAME}-uninstalled.pc:gio/giomm-uninstalled.pc.in" ;;
+     "gio/src/Makefile") CONFIG_FILES="$CONFIG_FILES gio/src/Makefile" ;;
+     "gio/giomm/Makefile") CONFIG_FILES="$CONFIG_FILES gio/giomm/Makefile" ;;
+-    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+-    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+-    "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;;
+-    "docs/reference/Doxyfile") CONFIG_FILES="$CONFIG_FILES docs/reference/Doxyfile" ;;
+     "MSVC_Net2005/glibmm/glibmm.rc") CONFIG_FILES="$CONFIG_FILES MSVC_Net2005/glibmm/glibmm.rc" ;;
+     "MSVC_Net2005/giomm/giomm.rc") CONFIG_FILES="$CONFIG_FILES MSVC_Net2005/giomm/giomm.rc" ;;
+     "MSVC_Net2008/glibmm/glibmm.rc") CONFIG_FILES="$CONFIG_FILES MSVC_Net2008/glibmm/glibmm.rc" ;;
+diff -ruN glibmm-2.22.1.orig/configure.ac glibmm-2.22.1/configure.ac
+--- glibmm-2.22.1.orig/configure.ac    2009-09-21 18:03:52.000000000 +0200
++++ glibmm-2.22.1/configure.ac 2009-11-05 17:32:41.000000000 +0100
+@@ -124,9 +124,6 @@
+ GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS
+ AC_CONFIG_FILES([Makefile
+-                 tools/Makefile
+-                 tools/gmmproc
+-                 tools/generate_wrap_init.pl
+                  glib/${GLIBMM_MODULE_NAME}.pc:glib/glibmm.pc.in
+                  glib/${GLIBMM_MODULE_NAME}-uninstalled.pc:glib/glibmm-uninstalled.pc.in
+                  glib/src/Makefile
+@@ -135,10 +132,6 @@
+                  gio/${GIOMM_MODULE_NAME}-uninstalled.pc:gio/giomm-uninstalled.pc.in
+                  gio/src/Makefile
+                  gio/giomm/Makefile
+-                 tests/Makefile
+-                 examples/Makefile
+-                 docs/Makefile
+-                 docs/reference/Doxyfile
+                  MSVC_Net2005/glibmm/glibmm.rc
+                  MSVC_Net2005/giomm/giomm.rc
+                  MSVC_Net2008/glibmm/glibmm.rc
+diff -ruN glibmm-2.22.1.orig/Makefile.am glibmm-2.22.1/Makefile.am
+--- glibmm-2.22.1.orig/Makefile.am     2009-09-08 18:12:29.000000000 +0200
++++ glibmm-2.22.1/Makefile.am  2009-11-05 17:33:01.000000000 +0100
+@@ -28,7 +28,7 @@
+ else
+ doc_subdirs =
+ endif
+-SUBDIRS = tools $(src_subdirs) glib/glibmm gio/giomm tests examples $(doc_subdirs)
++SUBDIRS = $(src_subdirs) glib/glibmm gio/giomm
+ glibmm_includedir = $(includedir)/$(GLIBMM_MODULE_NAME)
+ glibmm_include_HEADERS = glib/glibmm.h
+diff -ruN glibmm-2.22.1.orig/Makefile.in glibmm-2.22.1/Makefile.in
+--- glibmm-2.22.1.orig/Makefile.in     2009-09-21 18:07:00.000000000 +0200
++++ glibmm-2.22.1/Makefile.in  2009-11-05 17:32:54.000000000 +0100
+@@ -137,8 +137,7 @@
+       distdir dist dist-all distcheck
+ ETAGS = etags
+ CTAGS = ctags
+-DIST_SUBDIRS = tools glib/src gio/src glib/glibmm gio/giomm tests \
+-      examples docs
++DIST_SUBDIRS = glib/src gio/src glib/glibmm gio/giomm
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -330,7 +329,7 @@
+ @MAINTAINER_MODE_TRUE@src_subdirs = glib/src gio/src
+ @ENABLE_DOCUMENTATION_FALSE@doc_subdirs = 
+ @ENABLE_DOCUMENTATION_TRUE@doc_subdirs = docs
+-SUBDIRS = tools $(src_subdirs) glib/glibmm gio/giomm tests examples $(doc_subdirs)
++SUBDIRS = $(src_subdirs) glib/glibmm gio/giomm
+ glibmm_includedir = $(includedir)/$(GLIBMM_MODULE_NAME)
+ glibmm_include_HEADERS = glib/glibmm.h
+ glibmm_libincludedir = $(libdir)/$(GLIBMM_MODULE_NAME)/include
+@@ -350,15 +349,7 @@
+       glibmm/glibmm.vcproj                    \
+       glibmm/glibmmconfig.h                   \
+       giomm/giomm.vcproj                      \
+-      giomm/giommconfig.h                     \
+-      tests/giomm_simple/giomm_simple.vcproj  \
+-      tests/glibmm_value/glibmm_value.vcproj  \
+-      examples/dispatcher/dispatcher.vcproj   \
+-      examples/dispatcher2/dispatcher2.vcproj \
+-      examples/markup/markup.vcproj           \
+-      examples/options/options.vcproj         \
+-      examples/thread/thread.vcproj           \
+-      examples/thread_pool/thread_pool.vcproj
++      giomm/giommconfig.h
+ msvc_net2008_data = \
+       blank.cpp                               \
+@@ -368,15 +359,7 @@
+       glibmm/glibmm.vcproj                    \
+       glibmm/glibmmconfig.h                   \
+       giomm/giomm.vcproj                      \
+-      giomm/giommconfig.h                     \
+-      tests/giomm_simple/giomm_simple.vcproj  \
+-      tests/glibmm_value/glibmm_value.vcproj  \
+-      examples/dispatcher/dispatcher.vcproj   \
+-      examples/dispatcher2/dispatcher2.vcproj \
+-      examples/markup/markup.vcproj           \
+-      examples/options/options.vcproj         \
+-      examples/thread/thread.vcproj           \
+-      examples/thread_pool/thread_pool.vcproj
++      giomm/giommconfig.h
+ text_files = COPYING.tools README.SUN README.win32
+ msvc_files = $(addprefix MSVC_Net2005/,$(msvc_net2005_data)) \
diff --git a/libs/google-authenticator/Makefile b/libs/google-authenticator/Makefile
new file mode 100644 (file)
index 0000000..aab8553
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006-2012 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:=google-authenticator
+PKG_REV:=a096a628455a
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=http://code.google.com/p/google-authenticator/
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libpam-google-authenticator
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpam +libqrencode
+  TITLE:=Googles 2-step verification PAM library
+  URL:=http://code.google.com/p/google-authenticator/
+endef
+
+define Package/libpam-google-authenticator/description
+The Google Authenticator project includes implementations of one-time
+passcode generators for several mobile platforms, as well as a pluggable
+authentication module (PAM). One-time passcodes are generated using open
+standards developed by the Initiative for Open Authentication (OATH)
+(which is unrelated to OAuth).
+
+These implementations support the HMAC-Based One-time Password (HOTP)
+algorithm specified in RFC 4226 and the Time-based One-time Password
+(TOTP) algorithm specified in RFC 6238.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS+= -I$(STAGING_DIR)/usr/include
+TARGET_LDFLAGS+= -s
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/libpam \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               all
+endef
+
+define Package/libpam-google-authenticator/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/security
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/libpam/google-authenticator $(1)/usr/sbin/
+       $(CP) $(PKG_BUILD_DIR)/libpam/pam_google_authenticator.so $(1)/lib/security/
+endef
+
+$(eval $(call BuildPackage,libpam-google-authenticator))
diff --git a/libs/google-authenticator/patches/000-ld.patch b/libs/google-authenticator/patches/000-ld.patch
new file mode 100644 (file)
index 0000000..963b1c0
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/libpam/Makefile
++++ b/libpam/Makefile
+@@ -18,16 +18,9 @@
+ .SUFFIXES: .so
+-ifeq ($(origin CC), default)
+-  CC := gcc
+-endif
+-
+-DEF_CFLAGS := $(shell [ `uname` = SunOS ] &&                                  \
+-                echo ' -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT')              \
+-              -fvisibility=hidden $(CFLAGS)
+-DEF_LDFLAGS := $(shell [ `uname` = SunOS ] && echo ' -mimpure-text') $(LDFLAGS)
+-LDL_LDFLAGS := $(shell $(CC) -shared -ldl -xc -o /dev/null /dev/null          \
+-                       >/dev/null 2>&1 && echo ' -ldl')
++DEF_CFLAGS  := -fvisibility=hidden $(CFLAGS)
++DEF_LDFLAGS := $(LDFLAGS)
++LDL_LDFLAGS := '-ldl'
+ all: google-authenticator pam_google_authenticator.so demo                    \
+      pam_google_authenticator_unittest
diff --git a/libs/gperf/Makefile b/libs/gperf/Makefile
new file mode 100644 (file)
index 0000000..6859a9e
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2006-2008 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:=gperf
+PKG_VERSION:=3.0.3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/gperf
+PKG_MD5SUM:=cc20e58975a38075440423c8fb85fd00
+PKG_HOST_ONLY=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gperf
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Perfect hash function generator
+  BUILDONLY:=1
+  URL:=http://www.gnu.org/software/gperf
+endef
+
+define Package/lua/Default/description
+ gperf is a perfect hash function generator
+endef
+
+define Host/Install
+       $(MAKE) -C $(HOST_BUILD_DIR) install
+endef
+
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,gperf))
diff --git a/libs/gpgme/Makefile b/libs/gpgme/Makefile
new file mode 100644 (file)
index 0000000..e397220
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2013 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:=gpgme
+PKG_VERSION:=1.4.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.gnupg.org/gcrypt/gpgme/
+PKG_MD5SUM:=334e524cffa8af4e2f43ae8afe585672
+
+PKG_INSTALL:=1
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libgpgme
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GnuPG Made Easy library
+  DEPENDS:=+gnupg +libassuan +libpthread
+  URL:=http://www.gnupg.org/
+endef
+
+define Package/libgpgme/description
+  GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG easier for
+  applications. It provides a High-Level Crypto API for encryption, decryption, signing,
+  signature verification and key management. Currently it uses GnuPG as its backend but
+  the API isn't restricted to this engine; in fact we have already developed a backend
+  for CMS (S/MIME).
+endef
+
+ifdef CONFIG_USE_UCLIBC
+CONFIGURE_VARS += \
+    LIBS="-largp"
+endif
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-gpg=/"usr/bin/gpg" \
+       --with-gpg-error-prefix="$(STAGING_DIR)/usr" \
+       --with-libassuan-prefix="$(STAGING_DIR)/usr" \
+       --without-g13 \
+       --without-gpgconf \
+       --without-gpgsm \
+       --without-pth \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gpgme.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpgme{,-pthread}.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libgpgme/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpgme{,-pthread}.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgpgme))
diff --git a/libs/gsl/Makefile b/libs/gsl/Makefile
new file mode 100644 (file)
index 0000000..590e720
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2008-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:=gsl
+PKG_VERSION:=1.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/gsl
+PKG_MD5SUM:=81dca4362ae8d2aa1547b7d010881e43
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libgsl
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=@!TARGET_avr32
+  TITLE:=GNU Scientific Library
+  URL:=http://www.gnu.org/software/gsl/
+endef
+
+define Package/libgsl/description
+       The library provides a wide range of mathematical routines such as
+       random number generators, special functions and least-squares fitting.
+       There are over 1000 functions in total with an extensive test suite.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/libgsl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsl.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgslcblas.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/gsl $(1)/usr/lib $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gsl/*.h $(1)/usr/include/gsl
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsl.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgslcblas.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/gsl.pc $(1)/usr/lib/pkgconfig/
+endef
+
+$(eval $(call BuildPackage,libgsl))
diff --git a/libs/gsm/Makefile b/libs/gsm/Makefile
new file mode 100644 (file)
index 0000000..111be2d
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2006-2009 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:=gsm
+PKG_VERSION:=1.0.13
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://user.cs.tu-berlin.de/~jutta/gsm/
+PKG_MD5SUM:=c1ba392ce61dc4aff1c29ea4e92f6df4
+
+PKG_LICENSE:=FREE
+PKG_LICENSE_FILES:=COPYRIGHT
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-1.0-pl13
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gsm/Default
+  TITLE:=GSM transcoding
+  URL:=http://user.cs.tu-berlin.de/~jutta/toast.html
+endef
+
+define Package/gsm/description/Default
+ An implementation of the European GSM 06.10 provisional standard
+ for full-rate speech transcoding, prI-ETS 300 036, which uses
+ RPE/LTP (residual pulse excitation/long term prediction) coding
+ at 13 kbit/s.
+endef
+
+define Package/libgsm
+$(call Package/gsm/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+endef
+
+define Package/libgsm/description
+$(call Package/gsm/description/Default)
+ This package contains a shared GSM transcoding library, used by other
+ programs.
+endef
+
+define Package/gsm-utils
+$(call Package/gsm/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libgsm
+  TITLE+= utilities
+endef
+
+define Package/gsm-utils/description
+$(call Package/gsm/description/Default)
+ This package contains GSM transcoding utilities.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               LD="$(TARGET_CC)" \
+               COPTS="$(TARGET_CFLAGS)" \
+               INSTALL_ROOT="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/libgsm/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsm.so.* $(1)/usr/lib/
+endef
+
+define Package/gsm-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/toast $(1)/usr/bin/
+       (cd $(1)/usr/bin; ln -sf toast untoast; ln -sf toast tcat)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/gsm
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gsm.h $(1)/usr/include/gsm/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgsm.{a,so*} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgsm))
+$(eval $(call BuildPackage,gsm-utils))
diff --git a/libs/gsm/patches/001-debian-libsgm-1.0.10-13.patch b/libs/gsm/patches/001-debian-libsgm-1.0.10-13.patch
new file mode 100644 (file)
index 0000000..479c63d
--- /dev/null
@@ -0,0 +1,428 @@
+--- a/Makefile
++++ b/Makefile
+@@ -8,10 +8,12 @@ SASR = -DSASR
+ ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
+ # MULHACK = -DUSE_FLOAT_MUL
++MULHACK =
+ ######### Define this if your host multiplies floats faster than integers,
+ ######### e.g. on a SPARCstation.
+ # FAST        = -DFAST
++FAST  =
+ ######### Define together with USE_FLOAT_MUL to enable the GSM library's
+ ######### approximation option for incorrect, but good-enough results.
+@@ -22,8 +24,8 @@ LTP_CUT      =
+ ######### both integer and floating point multiplications.
+ ######### This flag is still in the experimental stage.
+-WAV49 = -DWAV49
+-# WAV49       =
++# WAV49       = -DWAV49
++WAV49 =
+ ######### Define to enable the GSM library's option to pack GSM frames 
+ ######### in the style used by the WAV #49 format.  If you want to write
+ ######### a tool that produces .WAV files which contain GSM-encoded data,
+@@ -44,7 +46,8 @@ WAV49        = -DWAV49
+ # CCFLAGS     = -c -O
+ CC            = gcc -ansi -pedantic
+-CCFLAGS       = -c -O2 -DNeedFunctionPrototypes=1
++COPTS         = -O2
++CCFLAGS       = -c $(COPTS) -DNeedFunctionPrototypes=1
+ LD            = $(CC)
+@@ -78,10 +81,10 @@ INSTALL_ROOT       =
+ # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
+ # this directory.
+-GSM_INSTALL_ROOT = $(INSTALL_ROOT)
++GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr
+ GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
+-GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
+-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
++GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
++GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
+ # Where do you want to install the toast binaries and their manpage?
+@@ -89,14 +92,14 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma
+ # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
+ # of this directory.
+-TOAST_INSTALL_ROOT      = $(INSTALL_ROOT)
++TOAST_INSTALL_ROOT      = $(INSTALL_ROOT)/usr
+ TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
+-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
++TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
+ #  Other tools
+ SHELL         = /bin/sh
+-LN            = ln
++LN            = ln -s
+ BASENAME      = basename
+ AR            = ar
+ ARFLAGS               = cr
+@@ -126,7 +129,7 @@ INC        = $(ROOT)/inc
+ # Flags
+-# DEBUG       = -DNDEBUG
++DEBUG = -DNDEBUG
+ ######### Remove -DNDEBUG to enable assertions.
+ CFLAGS        = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
+@@ -140,6 +143,7 @@ LFLAGS     = $(LDFLAGS) $(LDINC)
+ # Targets
+ LIBGSM        = $(LIB)/libgsm.a
++LIBGSMSO= $(LIB)/libgsm.so
+ TOAST = $(BIN)/toast
+ UNTOAST       = $(BIN)/untoast
+@@ -258,6 +262,9 @@ STUFF =    ChangeLog                       \
+ GSM_INSTALL_TARGETS = \
+               $(GSM_INSTALL_LIB)/libgsm.a             \
++              $(GSM_INSTALL_LIB)/libgsm.so            \
++              $(GSM_INSTALL_LIB)/libgsm.so.1          \
++              $(GSM_INSTALL_LIB)/libgsm.so.1.0.10     \
+               $(GSM_INSTALL_INC)/gsm.h                \
+               $(GSM_INSTALL_MAN)/gsm.3                \
+               $(GSM_INSTALL_MAN)/gsm_explode.3        \
+@@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS =    \
+ # Target rules
+-all:          $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
++all:          $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
+               @-echo $(ROOT): Done.
+ tst:          $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
+@@ -299,6 +306,11 @@ install:  toastinstall gsminstall
+ # The basic API: libgsm
++$(LIBGSMSO):  $(LIB) $(GSM_OBJECTS)
++              $(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
++              ln -fs libgsm.so.1.0.10 lib/libgsm.so.1
++              ln -fs libgsm.so.1.0.10 lib/libgsm.so
++
+ $(LIBGSM):    $(LIB) $(GSM_OBJECTS)
+               -rm $(RMFLAGS) $(LIBGSM)
+               $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
+@@ -308,15 +320,15 @@ $(LIBGSM):       $(LIB) $(GSM_OBJECTS)
+ # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
+ $(TOAST):     $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
+-              $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
++              $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
+ $(UNTOAST):   $(BIN) $(TOAST)
+               -rm $(RMFLAGS) $(UNTOAST)
+-              $(LN) $(TOAST) $(UNTOAST)
++              $(LN) toast $(UNTOAST)
+ $(TCAT):      $(BIN) $(TOAST)
+               -rm $(RMFLAGS) $(TCAT)
+-              $(LN) $(TOAST) $(TCAT)
++              $(LN) toast $(TCAT)
+ # The local bin and lib directories
+@@ -351,53 +363,66 @@ toastuninstall:
+               fi
+ $(TOAST_INSTALL_BIN)/toast:   $(TOAST)
+-              -rm $@
+-              cp $(TOAST) $@
++              mkdir -p $(TOAST_INSTALL_BIN)
++              cp -f $(TOAST) $@
+               chmod 755 $@
+ $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
+-              -rm $@
+-              ln $? $@
++              mkdir -p $(TOAST_INSTALL_BIN)
++              ln -sf $? $@
+ $(TOAST_INSTALL_BIN)/tcat:    $(TOAST_INSTALL_BIN)/toast
+-              -rm $@
+-              ln $? $@
++              mkdir -p $(TOAST_INSTALL_BIN)
++              ln -sf $? $@
+ $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(TOAST_INSTALL_MAN)
++              cp -f $? $@
+               chmod 444 $@
+ $(GSM_INSTALL_MAN)/gsm.3:     $(MAN)/gsm.3
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(GSM_INSTALL_MAN)
++              cp -f $? $@
+               chmod 444 $@
+ $(GSM_INSTALL_MAN)/gsm_option.3:      $(MAN)/gsm_option.3
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(GSM_INSTALL_MAN)
++              cp -f $? $@
+               chmod 444 $@
+ $(GSM_INSTALL_MAN)/gsm_explode.3:     $(MAN)/gsm_explode.3
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(GSM_INSTALL_MAN)
++              cp -f $? $@
+               chmod 444 $@
+ $(GSM_INSTALL_MAN)/gsm_print.3:       $(MAN)/gsm_print.3
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(GSM_INSTALL_MAN)
++              cp -f $? $@
+               chmod 444 $@
+ $(GSM_INSTALL_INC)/gsm.h:     $(INC)/gsm.h
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(GSM_INSTALL_INC)
++              cp -f $? $@
+               chmod 444 $@
+ $(GSM_INSTALL_LIB)/libgsm.a:  $(LIBGSM)
+-              -rm $@
+-              cp $? $@
++              mkdir -p $(GSM_INSTALL_LIB)
++              cp -f $? $@
+               chmod 444 $@
++$(GSM_INSTALL_LIB)/libgsm.so: $(LIBGSMSO)
++              mkdir -p $(GSM_INSTALL_LIB)
++              cp -f $? $@
++
++$(GSM_INSTALL_LIB)/libgsm.so.1:       $(LIBGSMSO)
++              mkdir -p $(GSM_INSTALL_LIB)
++              cp -f $? $@
++
++$(GSM_INSTALL_LIB)/libgsm.so.1.0.10:  $(LIBGSMSO)
++              mkdir -p $(GSM_INSTALL_LIB)
++              cp -f $? $@
++              chmod 755 $@
++
+ # Distribution
+@@ -426,7 +451,9 @@ semi-clean:
+ clean:        semi-clean
+               -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add          \
+-                      $(TOAST) $(TCAT) $(UNTOAST)     \
++                      $(LIBGSMSO) $(LIB)/libgsm.so.1.0.10     \
++                      $(LIB)libgsm.so.1                       \
++                      $(TOAST) $(TCAT) $(UNTOAST)             \
+                       $(ROOT)/gsm-1.0.tar.Z
+--- a/inc/config.h
++++ b/inc/config.h
+@@ -9,8 +9,8 @@
+ #ifndef       CONFIG_H
+ #define       CONFIG_H
+-/*efine       SIGHANDLER_T    int             /* signal handlers are void     */
+-/*efine HAS_SYSV_SIGNAL       1               /* sigs not blocked/reset?      */
++/*efine       SIGHANDLER_T    int             *//* signal handlers are void   */
++/*efine HAS_SYSV_SIGNAL       1               *//* sigs not blocked/reset?    */
+ #define       HAS_STDLIB_H    1               /* /usr/include/stdlib.h        */
+ #define       HAS_LIMITS_H    1               /* /usr/include/limits.h        */
+@@ -22,16 +22,16 @@
+ #define       HAS_CHMOD       1               /* chmod syscall                */
+ #define       HAS_FCHOWN      1               /* fchown syscall               */
+ #define       HAS_CHOWN       1               /* chown syscall                */
+-/*efine       HAS__FSETMODE   1               /* _fsetmode -- set file mode   */
++/*efine       HAS__FSETMODE   1               *//* _fsetmode -- set file mode */
+ #define       HAS_STRING_H    1               /* /usr/include/string.h        */
+-/*efine       HAS_STRINGS_H   1               /* /usr/include/strings.h       */
++/*efine       HAS_STRINGS_H   1               *//* /usr/include/strings.h     */
+ #define       HAS_UNISTD_H    1               /* /usr/include/unistd.h        */
+ #define       HAS_UTIME       1               /* POSIX utime(path, times)     */
+-/*efine       HAS_UTIMES      1               /* use utimes() syscall instead */
++/*efine       HAS_UTIMES      1               *//* use utimes()       syscall instead */
+ #define       HAS_UTIME_H     1               /* UTIME header file            */
+ #define       HAS_UTIMBUF     1               /* struct utimbuf               */
+-/*efine       HAS_UTIMEUSEC   1               /* microseconds in utimbuf?     */
++/*efine       HAS_UTIMEUSEC   1               *//* microseconds in utimbuf?   */
+ #endif        /* CONFIG_H */
+--- a/inc/gsm.h
++++ b/inc/gsm.h
+@@ -54,6 +54,10 @@ typedef gsm_byte            gsm_frame[33];          /* 33
+ #define       GSM_OPT_FRAME_INDEX     5
+ #define       GSM_OPT_FRAME_CHAIN     6
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern gsm  gsm_create        GSM_P((void));
+ extern void gsm_destroy GSM_P((gsm)); 
+@@ -66,6 +70,10 @@ extern int  gsm_decode  GSM_P((gsm, gsm_
+ extern int  gsm_explode GSM_P((gsm, gsm_byte   *, gsm_signal *));
+ extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte   *));
++#ifdef __cplusplus
++}
++#endif
++
+ #undef        GSM_P
+ #endif        /* GSM_H */
+--- a/inc/toast.h
++++ b/inc/toast.h
+@@ -16,11 +16,12 @@
+ #include <stdio.h>
+ #include <ctype.h>
++#include <pthread.h>
+ #include <signal.h>
+ #include <errno.h>
+-#ifndef       HAS_ERRNO_DECL
+-       extern int     errno;
++#ifndef errno
++ extern int   errno;
+ #endif
+ #ifdef        HAS_LIMITS_H
+@@ -37,6 +38,10 @@
+ # endif
+ #endif
++#ifdef  HAS_STDIO_H
++# include <stdio.h>
++#endif
++
+ #include "gsm.h"
+ #ifndef       S_ISREG
+--- a/src/code.c
++++ b/src/code.c
+@@ -9,8 +9,8 @@
+ #include      "config.h"
+-#ifdef        HAS_STDLIB_H
+-#include      <stdlib.h>
++#ifdef        HAS_STRING_H
++#include      <string.h>
+ #else
+ #     include "proto.h"
+       extern char     * memcpy P((char *, char *, int));
+--- a/src/debug.c
++++ b/src/debug.c
+@@ -49,7 +49,7 @@ void gsm_debug_longwords P4( (name, from
+       fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
+       while (from <= to) {
+-              fprintf(stderr, "%d ", ptr[ from ] );
++              fprintf(stderr, "%ld ", ptr[ from ] );
+               from++;
+               if (nprinted++ >= 7) {
+                       nprinted = 0;
+@@ -63,14 +63,14 @@ void gsm_debug_longword P2(  (name, valu
+       char            * name,
+       longword          value )
+ {
+-      fprintf(stderr, "%s: %d\n", name, (long)value );
++      fprintf(stderr, "%s: %ld\n", name, (long)value );
+ }
+ void gsm_debug_word P2(  (name, value),
+       char    * name,
+       word      value )
+ {
+-      fprintf(stderr, "%s: %d\n", name, (long)value);
++      fprintf(stderr, "%s: %ld\n", name, (long)value);
+ }
+ #endif
+--- a/src/toast.c
++++ b/src/toast.c
+@@ -251,8 +251,8 @@ static char * emalloc P1((len), size_t l
+ {
+       char * s;
+       if (!(s = malloc(len))) {
+-              fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
+-                      progname, len);
++              fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
++                      progname, (long) len);
+               onintr();
+               exit(1);
+       }
+@@ -270,7 +270,7 @@ static char* normalname P3((name, want, 
+       maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
+       p = strcpy(emalloc(maxlen), name);
+-      if (s = suffix(p, cut)) strcpy(s, want);
++      if ((s = suffix(p, cut))) strcpy(s, want);
+       else if (*want && !suffix(p, want)) strcat(p, want);
+       return p;
+@@ -386,7 +386,7 @@ static void update_times P0()
+               ut[0] = instat.st_atime;
+               ut[1] = instat.st_mtime;
+-              (void) utime(outname, ut);
++              (void) utime(outname, (struct utimbuf *)ut);
+ #endif        /* UTIMBUF */
+       }
+@@ -416,7 +416,7 @@ static int okay_as_input P3((name,f,st),
+       }
+       if (st->st_nlink > 1 && !f_cat && !f_precious) {
+               fprintf(stderr, 
+-                    "%s: \"%s\" has %s other link%s -- unchanged.\n",
++                    "%s: \"%s\" has %d other link%s -- unchanged.\n",
+                       progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
+               return 0;
+       }
+@@ -585,8 +585,8 @@ static int process_decode P0()
+               if (cc != sizeof(s)) {
+                       if (cc >= 0) fprintf(stderr,
+-                      "%s: incomplete frame (%d byte%s missing) from %s\n",
+-                                      progname, sizeof(s) - cc,
++                      "%s: incomplete frame (%ld byte%s missing) from %s\n",
++                                      progname, (long) sizeof(s) - cc,
+                                       "s" + (sizeof(s) - cc == 1),
+                                       inname ? inname : "stdin" );
+                       gsm_destroy(r);
+@@ -624,8 +624,6 @@ static int process_decode P0()
+ static int process P1((name), char * name)
+ {
+-      int step = 0;
+-
+       out     = (FILE *)0;
+       in      = (FILE *)0;
+@@ -779,7 +777,6 @@ int main P2((ac, av), int ac, char **av)
+       case 'h': help();    exit(0);
+       default: 
+-      usage:
+               fprintf(stderr,
+       "Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
+                       progname);
diff --git a/libs/gssdp/Makefile b/libs/gssdp/Makefile
new file mode 100644 (file)
index 0000000..b3b6848
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2006-2012 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:=gssdp
+PKG_VERSION:=0.13.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/gssdp/0.13/
+PKG_MD5SUM:=758ed423cdd258a9a22d59c321b535ed
+
+PKG_BUILD_DEPENDS:=libsoup glib2 $(ICONV_DEPENDS)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libgssdp
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Library for resource discovery and announcement over SSDP
+  URL:=http://www.gupnp.org/
+  DEPENDS:=+libsoup +glib2
+endef
+
+define Package/libgssdp/description
+A GObject-based API for doing SSDP (Simple Service Discovery Protocol) transparently.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/gssdp-1.0/libgssdp}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgssdp-1.0.{so*,la,a} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/gssdp-1.0/libgssdp/*.h \
+               $(1)/usr/include/gssdp-1.0/libgssdp/
+endef
+
+define Package/libgssdp/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgssdp-1.0.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgssdp))
diff --git a/libs/gupnp-av/Makefile b/libs/gupnp-av/Makefile
new file mode 100644 (file)
index 0000000..db4167f
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2006-2012 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:=gupnp-av
+PKG_VERSION:=0.12.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNOME/gupnp-av/0.12/
+PKG_MD5SUM:=2d15a94d743720febb400b2cacde1cdc
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+        -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libgupnp-av
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Library for dealing with UPnP/AV profiles
+  URL:=http://www.gupnp.org/
+  DEPENDS:=+libgupnp
+endef
+
+define Package/libgupnp-av/description
+GUPnP A/V is a small utility library that aims to ease the handling and
+implementation of UPnP A/V profiles.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/gupnp-av-1.0/libgupnp-av}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgupnp-av-1.0.{so*,la,a} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/gupnp-av-1.0/libgupnp-av/*.h \
+               $(1)/usr/include/gupnp-av-1.0/libgupnp-av/
+endef
+
+define Package/libgupnp-av/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgupnp-av-1.0.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgupnp-av))
diff --git a/libs/gupnp-dlna/Makefile b/libs/gupnp-dlna/Makefile
new file mode 100644 (file)
index 0000000..b99cfce
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2006-2012 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:=gupnp-dlna
+PKG_VERSION:=0.6.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/gupnp-dlna/0.6/
+PKG_MD5SUM:=4e3151125de991f474f728c1c5343ab1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libgupnp-dlna
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Library for dealing with DLNA-related tasks
+  URL:=http://www.gupnp.org/
+  DEPENDS:=+libgupnp +gstreamer +libgstpbutils
+endef
+
+define Package/libgupnp-dlna/description
+A small utility library that aims to ease the DLNA-related tasks such as media
+profile guessing, transcoding to a given profile, etc.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/gupnp-dlna-1.0/libgupnp-dlna}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgupnp-dlna-1.0.{so*,la,a} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/gupnp-dlna-1.0/libgupnp-dlna/*.h \
+               $(1)/usr/include/gupnp-dlna-1.0/libgupnp-dlna/
+endef
+
+define Package/libgupnp-dlna/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgupnp-dlna-1.0.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgupnp-dlna))
diff --git a/libs/gupnp-vala/Makefile b/libs/gupnp-vala/Makefile
new file mode 100644 (file)
index 0000000..d980a3e
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006-2012 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:=gupnp-vala
+PKG_VERSION:=0.10.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/gupnp-vala/0.10/
+PKG_MD5SUM:=
+
+PKG_BUILD_DEPENDS:=vala/host libgssdp libgupnp libgupnp-av libgupnp-dlna
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libgupnp-vala
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=GUPnP Vala bindings
+  URL:=http://live.gnome.org/GUPnP
+endef
+
+define Package/libgupnp-vala/description
+Vala bindings for GUPnP
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DIR) $(1)/usr/share/vala/vapi
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/vala/vapi/*.{vapi,deps} \
+               $(1)/usr/share/vala/vapi
+endef
+
+$(eval $(call BuildPackage,libgupnp-vala))
diff --git a/libs/gupnp-vala/patches/010-no-tests.patch b/libs/gupnp-vala/patches/010-no-tests.patch
new file mode 100644 (file)
index 0000000..faf919e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2,7 +2,7 @@
+ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+-SUBDIRS = . tests
++SUBDIRS = .
+ pkgconfig_DATA= gupnp-vala-1.0.pc
+ pkgconfigdir = $(libdir)/pkgconfig
diff --git a/libs/gupnp/Makefile b/libs/gupnp/Makefile
new file mode 100644 (file)
index 0000000..228bef6
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2006-2012 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:=gupnp
+PKG_VERSION:=0.19.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/gupnp/0.19/
+PKG_MD5SUM:=516549cebc5af416f2fd7177d6512a0f
+
+PKG_BUILD_DEPENDS:=libgnutls
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+        -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libgupnp
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Library for implementing both UPnP clients and services in C
+  URL:=http://www.gupnp.org/
+  DEPENDS:=+libgssdp +libuuid
+endef
+
+define Package/libgupnp/description
+GUPnP is a library for implementing both UPnP clients and services in C, using
+GObject and LibSoup. It allows for fully asynchronous use without using threads
+and so cleanly integrates naturally into main-loop based applications, and
+supports all of the UPnP features.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/gupnp-1.0/libgupnp}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgupnp-1.0.{so*,la,a} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/gupnp-1.0/libgupnp/*.h \
+               $(1)/usr/include/gupnp-1.0/libgupnp/
+endef
+
+define Package/libgupnp/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgupnp-1.0.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgupnp))
diff --git a/libs/howl/Makefile b/libs/howl/Makefile
new file mode 100644 (file)
index 0000000..3b70f7d
--- /dev/null
@@ -0,0 +1,148 @@
+#
+# 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:=howl
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.porchdogsoft.com/download/
+PKG_MD5SUM:=c389d3ffba0e69a179de2ec650f1fdcc
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/howl/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Zeroconf networking implementation
+  URL:=http://www.porchdogsoft.com/products/howl/
+endef
+
+define Package/libhowl
+  $(call Package/howl/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+endef
+
+define Package/libhowl/description
+       Howl is a cross-platform implementation of Zeroconf networking. 
+       This package contains the Howl shared libraries, used by other programs.
+endef
+
+define Package/howl-autoipd
+  $(call Package/howl/Default)
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=+libhowl +libpthread
+  TITLE:=An IPv4 Link-Local address self-assigner daemon
+endef
+
+define Package/howl-autoipd/description
+       Howl is a cross-platform implementation of Zeroconf networking. 
+       This package contains an IPv4 Link-Local address self-assigner daemon.
+endef
+
+define Package/howl-mdnsresponder
+  $(call Package/howl/Default)
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=+libhowl +libpthread
+  TITLE:=An mDNS (Multicast DNS) service responder daemon
+endef
+
+define Package/howl-mdnsresponder/description
+       Howl is a cross-platform implementation of Zeroconf networking. 
+       This package contains an mDNS (Multicast DNS) service responder daemon.
+endef
+
+define Package/howl-mdnsresponder/conffiles
+/etc/mDNSResponder.conf
+endef
+
+define Package/howl-nifd
+  $(call Package/howl/Default)
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=+libhowl +libpthread
+  TITLE:=A network interface monitor daemon
+endef
+
+define Package/howl-nifd/description
+       This package contains a network interface monitor daemon.
+endef
+
+define Package/howl-utils
+  $(call Package/howl/Default)
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=+libhowl +libpthread
+  TITLE+= (utilities)
+endef
+
+define Package/howl-utils/description
+       This package contains mDNS (Multicast DNS) client utilities.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+       );
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/howl $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{howl,mDNSResponder}.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/howl.pc $(1)/usr/lib/pkgconfig/
+       $(SED) 's,-I/usr/include,-I$$$${includedir},g' $(1)/usr/lib/pkgconfig/howl.pc
+       $(SED) 's,-L/usr/lib/howl,-L$$$${libdir}/howl,g' $(1)/usr/lib/pkgconfig/howl.pc
+endef
+
+define Package/libhowl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{howl,mDNSResponder}.so.* $(1)/usr/lib/
+endef
+
+define Package/howl-autoipd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/autoipd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/autoipd.init $(1)/etc/init.d/autoipd
+endef
+
+define Package/howl-mdnsresponder/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mDNSResponder $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/mDNSResponder.conf $(1)/etc/mDNSResponder.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mDNSResponder.init $(1)/etc/init.d/mDNSResponder
+endef
+
+define Package/howl-nifd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nifd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/nifd.init $(1)/etc/init.d/nifd
+endef
+
+define Package/howl-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mDNS{Browse,Publish,Query,Resolve} $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libhowl))
+$(eval $(call BuildPackage,howl-autoipd))
+$(eval $(call BuildPackage,howl-mdnsresponder))
+$(eval $(call BuildPackage,howl-nifd))
+$(eval $(call BuildPackage,howl-utils))
diff --git a/libs/howl/files/autoipd.init b/libs/howl/files/autoipd.init
new file mode 100644 (file)
index 0000000..4a8ec07
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+# XXX: pid-file is /var/run/autoipd-<INTERFACE>.pid
+SERVICE_USE_PID=
+
+start() {
+       service_start /usr/sbin/autoipd
+}
+stop() {
+       service_stop /usr/sbin/autoipd
+}
+
diff --git a/libs/howl/files/mDNSResponder.conf b/libs/howl/files/mDNSResponder.conf
new file mode 100644 (file)
index 0000000..eac712f
--- /dev/null
@@ -0,0 +1,2 @@
+#name         #type        #domain  #port  #text
+"My Router"   _http._tcp   local.   80     "txtvers=1" "path=/P" "note=My Router"
diff --git a/libs/howl/files/mDNSResponder.init b/libs/howl/files/mDNSResponder.init
new file mode 100644 (file)
index 0000000..d43fdb5
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/mDNSResponder
+}
+stop() {
+       service_stop /usr/sbin/mDNSResponder
+}
+
diff --git a/libs/howl/files/nifd.init b/libs/howl/files/nifd.init
new file mode 100644 (file)
index 0000000..376eaaf
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/nifd
+}
+stop() {
+       service_stop /usr/sbin/nifd
+}
+
diff --git a/libs/howl/patches/001-config.patch b/libs/howl/patches/001-config.patch
new file mode 100644 (file)
index 0000000..a0c26d1
--- /dev/null
@@ -0,0 +1,14 @@
+--- howl-0.9.10-orig/src/mDNSResponder/Posix/posix_main.c      2005-01-27 04:11:20.000000000 +0100
++++ howl-0.9.10-2/src/mDNSResponder/Posix/posix_main.c 2005-03-19 13:04:42.000000000 +0100
+@@ -249,9 +249,9 @@
+       {
+               sw_mdns_servant_load_file(servant, conf_file);
+       }
+-      else if (sw_mdns_servant_load_file(servant, "/etc/howl/mDNSResponder.conf") != SW_OKAY)
++      else
+       {
+-              sw_mdns_servant_load_file(servant, "/usr/local/etc/howl/mDNSResponder.conf");
++              sw_mdns_servant_load_file(servant, "/etc/mDNSResponder.conf");
+       }
+       write_pidfile("mDNSResponder", &pidfd);
diff --git a/libs/howl/patches/002-debug_log.patch b/libs/howl/patches/002-debug_log.patch
new file mode 100644 (file)
index 0000000..91410b8
--- /dev/null
@@ -0,0 +1,10 @@
+--- howl-0.9.10-orig/src/mDNSResponder/Posix/posix_main.c      2005-01-27 04:11:20.000000000 +0100
++++ howl-0.9.10-2/src/mDNSResponder/Posix/posix_main.c 2005-03-19 13:04:42.000000000 +0100
+@@ -186,6 +186,7 @@
+                       case 'd':
+                       {
+                               make_daemon = SW_FALSE;
++                              sw_debug_set_level(SW_LOG_VERBOSE);
+                       }
+                       break;
diff --git a/libs/howl/patches/003-proto_fix.patch b/libs/howl/patches/003-proto_fix.patch
new file mode 100644 (file)
index 0000000..0b9d105
--- /dev/null
@@ -0,0 +1,11 @@
+--- howl-0.9.10-orig/include/salt/platform.h   2005-01-28 21:46:14.000000000 +0100
++++ howl-0.9.10-2/include/salt/platform.h      2005-03-19 13:04:42.000000000 +0100
+@@ -409,7 +409,7 @@
+  */
+ sw_const_string
+-sw_strerror();
++sw_strerror(void);
+ /*
diff --git a/libs/howl/patches/004-linux_types.patch b/libs/howl/patches/004-linux_types.patch
new file mode 100644 (file)
index 0000000..ee36760
--- /dev/null
@@ -0,0 +1,11 @@
+diff -ruN howl-1.0.0-old/src/lib/howl/Posix/posix_interface.c howl-1.0.0-new/src/lib/howl/Posix/posix_interface.c
+--- howl-1.0.0-old/src/lib/howl/Posix/posix_interface.c        2005-05-19 23:39:27.000000000 +0200
++++ howl-1.0.0-new/src/lib/howl/Posix/posix_interface.c        2007-01-07 23:56:54.000000000 +0100
+@@ -41,6 +41,7 @@
+ typedef __uint32_t    u32;
+ typedef __uint16_t    u16;
+ typedef __uint8_t             u8;
++#     include <linux/types.h>
+ #     include <linux/sockios.h>
+ #     include <linux/ethtool.h> 
+ #endif
diff --git a/libs/id3lib/Makefile b/libs/id3lib/Makefile
new file mode 100644 (file)
index 0000000..da3791c
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2006 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:=id3lib
+PKG_VERSION:=3.8.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/id3lib
+PKG_MD5SUM:=19f27ddd2dda4b2d26a559a4f0f402a7
+
+PKG_FIXUP:=libtool-ucxx
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/id3lib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+zlib $(CXX_DEPENDS)
+  TITLE:=An ID3v1/ID3v2 tag manipulation library
+  URL:=http://www.id3lib.org/
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/id3 $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/id3.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libid3.{a,so} $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libid3-*.so.* $(1)/usr/lib/
+endef
+
+define Package/id3lib/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libid3-*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,id3lib))
diff --git a/libs/id3lib/patches/100-missing_include.patch b/libs/id3lib/patches/100-missing_include.patch
new file mode 100644 (file)
index 0000000..81199ab
--- /dev/null
@@ -0,0 +1,11 @@
+diff -urN id3lib-3.8.3/include/id3/id3lib_strings.h id3lib-3.8.3.new/include/id3/id3lib_strings.h
+--- id3lib-3.8.3/include/id3/id3lib_strings.h  2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3.new/include/id3/id3lib_strings.h      2007-08-28 12:08:44.000000000 +0200
+@@ -30,6 +30,7 @@
+ #define _ID3LIB_STRINGS_H_
+ #include <string>
++#include <streambuf>
+ #if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000))
+ namespace std
diff --git a/libs/id3lib/patches/120-fix-configure-remove-check-for-iomanip_h.patch b/libs/id3lib/patches/120-fix-configure-remove-check-for-iomanip_h.patch
new file mode 100644 (file)
index 0000000..26944cc
--- /dev/null
@@ -0,0 +1,24 @@
+diff --git a/configure b/configure
+index 37b66f3..723ca1e 100755
+--- a/configure
++++ b/configure
+@@ -10296,7 +10296,6 @@ done
+ for ac_header in \
+   string                        \
+-  iomanip.h                     \
+ do
+ as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+diff --git a/configure.in b/configure.in
+index c857735..abfe4cd 100644
+--- a/configure.in
++++ b/configure.in
+@@ -227,7 +227,6 @@ AC_CHECK_HEADERS(fstream iostream iomanip vector \
+ )
+ AC_CHECK_HEADERS(               \
+   string                        \
+-  iomanip.h                     \
+   ,,AC_MSG_ERROR([Missing a vital header file for id3lib])
+ )
diff --git a/libs/id3lib/patches/130-fix-includes.patch b/libs/id3lib/patches/130-fix-includes.patch
new file mode 100644 (file)
index 0000000..d3e636a
--- /dev/null
@@ -0,0 +1,25 @@
+diff --git a/include/id3/id3lib_strings.h b/include/id3/id3lib_strings.h
+index 02a9aba..101b797 100644
+--- a/include/id3/id3lib_strings.h
++++ b/include/id3/id3lib_strings.h
+@@ -29,6 +29,7 @@
+ #ifndef _ID3LIB_STRINGS_H_
+ #define _ID3LIB_STRINGS_H_
++#include <string.h>
+ #include <string>
+ #include <streambuf>
+diff --git a/include/id3/writers.h b/include/id3/writers.h
+index 1cbb0dc..4bc8f77 100644
+--- a/include/id3/writers.h
++++ b/include/id3/writers.h
+@@ -30,7 +30,7 @@
+ #include "id3/writer.h"
+ #include "id3/id3lib_streams.h"
+-//#include <string.h>
++#include <string.h>
+ class ID3_CPP_EXPORT ID3_OStreamWriter : public ID3_Writer
+ {
diff --git a/libs/id3lib/patches/140-dont-build-examples.patch b/libs/id3lib/patches/140-dont-build-examples.patch
new file mode 100644 (file)
index 0000000..61b97e0
--- /dev/null
@@ -0,0 +1,15 @@
+diff --git a/Makefile.in b/Makefile.in
+index 8c121c5..b2131c2 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -132,8 +132,8 @@ EXTRA_DIST = \
+ @ID3_NEEDZLIB_TRUE@zlib_subdir = zlib
+ @ID3_NEEDZLIB_FALSE@zlib_subdir = 
+-SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples
+-DIST_SUBDIRS = . m4 zlib doc include id3com src examples prj libprj
++SUBDIRS = . m4 $(zlib_subdir) doc include id3com src
++DIST_SUBDIRS = . m4 zlib doc include id3com src prj libprj
+ INCLUDES = @ID3LIB_DEBUG_FLAGS@
diff --git a/libs/iksemel/Makefile b/libs/iksemel/Makefile
new file mode 100644 (file)
index 0000000..a5861a6
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006-2009 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:=iksemel
+PKG_VERSION:=1.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://iksemel.googlecode.com/files/
+PKG_MD5SUM:=532e77181694f87ad5eb59435d11c1ca
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libiksemel
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Iksemel Jabber Library
+  URL:=http://code.google.com/p/iksemel/
+  DEPENDS:= +libgnutls +libtasn1 +libgcrypt +libgpg-error
+endef
+
+define Package/libiksemel/description
+  Iksemel is an XML parser library mainly designed for Jabber applications.
+  It provides SAX, DOM, and special Jabber stream APIs. Library is coded
+  in ANSI C except the network code (which is POSIX compatible), thus
+  highly portable.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_LDFLAGS += \
+       -Wl,-rpath-link,$(STAGING_DIR)/usr/lib \
+       -lgnutls -lgcrypt -lgpg-error
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+               --with-libgnutls-prefix="$(STAGING_DIR)/usr" \
+               , \
+               LIBS="$(TARGET_LDFLAGS)" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/iksemel.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiksemel.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/iksemel.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libiksemel/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libiksemel.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libiksemel))
diff --git a/libs/iksemel/patches/001-missing-macros.patch b/libs/iksemel/patches/001-missing-macros.patch
new file mode 100644 (file)
index 0000000..4563ac5
--- /dev/null
@@ -0,0 +1,163 @@
+--- /dev/null
++++ b/gnutls.m4
+@@ -0,0 +1,160 @@
++dnl Autoconf macros for libgnutls
++dnl $id$
++
++# Modified for LIBGNUTLS -- nmav
++# Configure paths for LIBGCRYPT
++# Shamelessly stolen from the one of XDELTA by Owen Taylor
++# Werner Koch   99-12-09
++
++dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
++dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
++dnl
++AC_DEFUN([AM_PATH_LIBGNUTLS],
++[dnl
++dnl Get the cflags and libraries from the libgnutls-config script
++dnl
++AC_ARG_WITH(libgnutls-prefix,
++          [  --with-libgnutls-prefix=PFX   Prefix where libgnutls is installed (optional)],
++          libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
++
++  if test x$libgnutls_config_prefix != x ; then
++     if test x${LIBGNUTLS_CONFIG+set} != xset ; then
++        LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
++     fi
++  fi
++
++  AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
++  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
++  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
++  no_libgnutls=""
++  if test "$LIBGNUTLS_CONFIG" = "no" ; then
++    no_libgnutls=yes
++  else
++    LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
++    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
++    libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
++
++
++      ac_save_CFLAGS="$CFLAGS"
++      ac_save_LIBS="$LIBS"
++      CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
++      LIBS="$LIBS $LIBGNUTLS_LIBS"
++dnl
++dnl Now check if the installed libgnutls is sufficiently new. Also sanity
++dnl checks the results of libgnutls-config to some extent
++dnl
++      rm -f conf.libgnutlstest
++      AC_TRY_RUN([
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <gnutls/gnutls.h>
++
++int
++main ()
++{
++    system ("touch conf.libgnutlstest");
++
++    if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
++    {
++      printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
++             "$libgnutls_config_version", gnutls_check_version(NULL) );
++      printf("*** was found! If libgnutls-config was correct, then it is best\n");
++      printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
++      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
++      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
++      printf("*** required on your system.\n");
++      printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
++      printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
++      printf("*** before re-running configure\n");
++    }
++    else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
++    {
++      printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
++      printf("*** library (version %s)\n", gnutls_check_version(NULL) );
++    }
++    else
++    {
++      if ( gnutls_check_version( "$min_libgnutls_version" ) )
++      {
++        return 0;
++      }
++     else
++      {
++        printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
++                gnutls_check_version(NULL) );
++        printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
++               "$min_libgnutls_version" );
++        printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
++        printf("*** \n");
++        printf("*** If you have already installed a sufficiently new version, this error\n");
++        printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
++        printf("*** being found. The easiest way to fix this is to remove the old version\n");
++        printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
++        printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
++        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
++        printf("*** so that the correct libraries are found at run-time))\n");
++      }
++    }
++  return 1;
++}
++],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
++       CFLAGS="$ac_save_CFLAGS"
++       LIBS="$ac_save_LIBS"
++  fi
++
++  if test "x$no_libgnutls" = x ; then
++     AC_MSG_RESULT(yes)
++     ifelse([$2], , :, [$2])
++  else
++     if test -f conf.libgnutlstest ; then
++        :
++     else
++        AC_MSG_RESULT(no)
++     fi
++     if test "$LIBGNUTLS_CONFIG" = "no" ; then
++       echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
++       echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
++       echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
++       echo "*** full path to libgnutls-config."
++     else
++       if test -f conf.libgnutlstest ; then
++        :
++       else
++          echo "*** Could not run libgnutls test program, checking why..."
++          CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
++          LIBS="$LIBS $LIBGNUTLS_LIBS"
++          AC_TRY_LINK([
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <gnutls/gnutls.h>
++],      [ return !!gnutls_check_version(NULL); ],
++        [ echo "*** The test program compiled, but did not run. This usually means"
++          echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
++          echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
++          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
++          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
++          echo "*** is required on your system"
++          echo "***"
++          echo "*** If you have an old version installed, it is best to remove it, although"
++          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
++          echo "***" ],
++        [ echo "*** The test program failed to compile or link. See the file config.log for the"
++          echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
++          echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
++          echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
++          CFLAGS="$ac_save_CFLAGS"
++          LIBS="$ac_save_LIBS"
++       fi
++     fi
++     LIBGNUTLS_CFLAGS=""
++     LIBGNUTLS_LIBS=""
++     ifelse([$3], , :, [$3])
++  fi
++  rm -f conf.libgnutlstest
++  AC_SUBST(LIBGNUTLS_CFLAGS)
++  AC_SUBST(LIBGNUTLS_LIBS)
++])
++
++dnl *-*wedit:notab*-*  Please keep this as the last line.
diff --git a/libs/jansson/Makefile b/libs/jansson/Makefile
new file mode 100644 (file)
index 0000000..bce1994
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2011-2012 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:=jansson
+PKG_VERSION:=2.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.digip.org/jansson/releases/
+PKG_MD5SUM:=ebf4ebc7af47de27f7b9d79ad5853176
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/jansson
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=JSON library
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib,include}
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+endef
+
+define Package/jansson/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson*so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,jansson))
diff --git a/libs/jansson/patches/01-jansson-add-jason_object_deep_update.patch b/libs/jansson/patches/01-jansson-add-jason_object_deep_update.patch
new file mode 100644 (file)
index 0000000..e9c389d
--- /dev/null
@@ -0,0 +1,50 @@
+This patch adds a function which can be used to update
+json key values on all levels, not just one, automagically
+adding new keys to objects which do not exist in old object.
+
+Signed-off-by: Roman Yeryomin <roman@advem.lv>
+
+--- a/src/value.c      2011-04-21 13:15:58.000000000 +0300
++++ b/src/value.c      2011-07-01 00:23:05.105103308 +0300
+@@ -215,6 +215,41 @@
+     return 0;
+ }
+
++int json_object_deep_update(json_t *object, json_t *other)
++{
++    void *iter;
++
++    if(!json_is_object(object) || !json_is_object(other))
++        return -1;
++
++    iter = json_object_iter(other);
++    while(iter) {
++        const char *key;
++        json_t *value;
++
++        key = json_object_iter_key(iter);
++        value = json_object_iter_value(iter);
++
++        if (!json_is_object(value)) {
++            if ( json_object_set_nocheck( object, key, value ) )
++                return -1;
++        } else {
++            json_t *subobj = json_object_get(object, key);
++            if (!subobj) {
++                json_object_set_nocheck( object, key, value );
++                iter = json_object_iter_next(other, iter);
++                continue;
++            }
++            if (json_object_deep_update( subobj, value ) == -1)
++                return -1;
++        }
++
++        iter = json_object_iter_next(other, iter);
++    }
++
++    return 0;
++}
++
+ void *json_object_iter(json_t *json)
+ {
+     json_object_t *object;
diff --git a/libs/jansson/patches/100-add-jason_object_deep_update.patch b/libs/jansson/patches/100-add-jason_object_deep_update.patch
new file mode 100644 (file)
index 0000000..d7c94ba
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/jansson.h
++++ b/src/jansson.h
+@@ -126,6 +126,7 @@ int json_object_set_new_nocheck(json_t *
+ int json_object_del(json_t *object, const char *key);
+ int json_object_clear(json_t *object);
+ int json_object_update(json_t *object, json_t *other);
++int json_object_deep_update(json_t *object, json_t *other);
+ void *json_object_iter(json_t *object);
+ void *json_object_iter_at(json_t *object, const char *key);
+ void *json_object_iter_next(json_t *object, void *iter);
diff --git a/libs/keynote/Makefile b/libs/keynote/Makefile
new file mode 100644 (file)
index 0000000..9a13a94
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006 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:=keynote
+PKG_VERSION:=2.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
+PKG_MD5SUM:=b569066ac2ba1356c2112b118a7d74d0
+
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/keynote
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl
+  TITLE:=Simple and flexible trust-management system
+  URL:=http://www1.cs.columbia.edu/~angelos/keynote.html
+endef
+
+define Package/keynote/description
+ KeyNote is a simple and flexible trust-management system designed to work
+ well for a variety of large- and small- scale Internet-based applications.
+ It provides a single, unified language for both local policies and
+ credentials.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/keynote
+       $(CP) $(PKG_BUILD_DIR)/{assertion,header,keynote,signature}.h $(1)/usr/include/keynote/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libkeynote.a $(1)/usr/lib/
+endef
+
+define Package/keynote/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/keynote $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,keynote))
diff --git a/libs/keynote/patches/001-build.patch b/libs/keynote/patches/001-build.patch
new file mode 100644 (file)
index 0000000..88db372
--- /dev/null
@@ -0,0 +1,345 @@
+Index: keynote-2.3/configure.in
+===================================================================
+--- keynote-2.3.orig/configure.in      2007-06-04 13:22:41.284579072 +0200
++++ keynote-2.3/configure.in   2007-06-04 13:22:41.389563112 +0200
+@@ -21,19 +21,13 @@
+ AC_PATH_PROG(ECHO, echo, /bin/echo)
+ AC_PATH_PROG(SED, sed, /usr/bin/sed)
+-dnl Checks for libraries.
+-LIBS="-L/usr/lib -L/usr/local/lib -L/usr/ssl/lib -L/usr/openssl/lib\
+- -L/usr/local/ssl/lib -L/usr/local/openssl/lib -L/usr/pkg/lib -L/pkg/lib"
+-
+ AC_CHECK_LIB(m, floor, LIBS="$LIBS -lm")
+ AC_CHECK_LIB(rsaref, RSAPrivateDecrypt, LIBS="$LIBS -lrsaref")
+ AC_CHECK_LIB(crypto, i2a_ASN1_STRING, LIBS="$LIBS -lcrypto")
+ AC_CHECK_LIB(RSAglue, RSA_ref_private_encrypt, LIBS="$LIBS -lRSAglue")
+ dnl Checks for header files.
+-CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/ssl/include\
+- -I/usr/local/ssl/include -I/usr/openssl/include -I/usr/pkg/include\
+- -I/usr/local/openssl/include -I/pkg/include"
++CPPFLAGS="-I/usr/include/openssl"
+ AC_HEADER_STDC
+ AC_HEADER_TIME
+Index: keynote-2.3/keynote-keygen.c
+===================================================================
+--- keynote-2.3.orig/keynote-keygen.c  2007-06-04 13:22:41.290578160 +0200
++++ keynote-2.3/keynote-keygen.c       2007-06-04 13:22:41.389563112 +0200
+@@ -161,7 +161,7 @@
+     if (strlen(algname) + 2 > prlen)
+     {
+       fprintf(stderr, "Parameter ``print-length'' should be larger "
+-              "than the length of AlgorithmName (%d)\n", strlen(algname));
++              "than the length of AlgorithmName (%lu)\n", strlen(algname));
+       exit(-1);
+     }
+Index: keynote-2.3/keynote.l
+===================================================================
+--- keynote-2.3.orig/keynote.l 2007-06-04 13:22:41.295577400 +0200
++++ keynote-2.3/keynote.l      2007-06-04 13:22:41.390562960 +0200
+@@ -61,7 +61,8 @@
+ static struct lex_list *keynote_lex_list = (struct lex_list *) NULL;
+ static int    keynote_max_lex_list = 32;
+ static int    keynote_lex_counter = 0;
+-static int    first_tok = 0;
++extern int    first_tok;
++int    first_tok = 0;
+ %}
+ digit         [0-9]
+ specnumber      [1-9][0-9]*
+@@ -766,7 +767,7 @@
+     if (0)
+     {
+       yyunput(0, NULL);
+-      yy_flex_realloc(0, NULL);
++      yy_flex_realloc(NULL, 0);
+     }
+     return en;
+Index: keynote-2.3/keynote-ver.l
+===================================================================
+--- keynote-2.3.orig/keynote-ver.l     2007-06-04 13:22:41.301576488 +0200
++++ keynote-2.3/keynote-ver.l  2007-06-04 13:22:41.390562960 +0200
+@@ -267,7 +267,7 @@
+     if (0)
+     {
+       yyunput(0, NULL);
+-      yy_flex_realloc(0, NULL);
++      yy_flex_realloc(NULL, 0);
+     }
+ }
+Index: keynote-2.3/keynote-ver.y
+===================================================================
+--- keynote-2.3.orig/keynote-ver.y     2007-06-04 13:22:41.306575728 +0200
++++ keynote-2.3/keynote-ver.y  2007-06-04 13:22:41.390562960 +0200
+@@ -49,7 +49,7 @@
+                                return keynote_errno;
+                                free($1);
+                              }
+-
++              ;
+ expr: VSTRING EQ STRING      { int i = kn_add_action(sessid, $1, $3, 0);
+                                if (i != 0)
+@@ -64,6 +64,7 @@
+                              free($1);
+                              free($3);
+                              } expr 
++              ;
+ %%
+ void
+ kverror(char *s)
+Index: keynote-2.3/keynote.y
+===================================================================
+--- keynote-2.3.orig/keynote.y 2007-06-04 13:22:41.311574968 +0200
++++ keynote-2.3/keynote.y      2007-06-04 13:22:41.391562808 +0200
+@@ -73,8 +73,7 @@
+ %}
+ %%
+-grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; }
+-                localinit
++grammarswitch: LOCINI { keynote_exceptionflag = keynote_donteval = 0; } localinit
+              | ACTSTR { keynote_exceptionflag = keynote_donteval = 0; } program
+            | KEYPRE { keynote_exceptionflag = keynote_donteval = 0; }
+                 keypredicate
+@@ -91,17 +90,17 @@
+                         STRING { keynote_lex_remove($3);
+                                keynote_privkey = $3;
+                              }
+-    
++              ;
+ keypredicate: /* Nothing */   { keynote_returnvalue = 0;
+                                 return 0; 
+                               }
+        | notemptykeypredicate { keynote_returnvalue = $1;
+                               return 0;
+                               }
+-
++              ;
+ notemptykeypredicate:  key     { $$ = $1; }
+                            | keyexp  { $$ = $1; }
+-
++              ;
+ keyexp: notemptykeypredicate AND { if (($1 == 0) && !keynote_justrecord)
+                                      keynote_donteval = 1;
+                                  } notemptykeypredicate 
+@@ -138,7 +137,7 @@
+                           else
+                             $$ = 0;
+                         }  /* K-th */
+-
++                      ;
+ keylist: key
+           { /* Don't do anything if we're just recording */ 
+               if (!keynote_justrecord && !keynote_donteval)
+@@ -155,7 +154,7 @@
+             keylistcount++;
+             }
+-
++              ;
+ key: str        {
+                  if (keynote_donteval)
+                    $$ = 0;
+@@ -193,10 +192,10 @@
+                        }
+                  }
+                  }
+-
++              ;
+ localinit: /* Nothing */
+          | localconstants
+-
++              ;
+ localconstants: VARIABLE EQQ STRING 
+         {
+             int i;
+@@ -265,12 +264,12 @@
+           if (i != RESULT_TRUE)
+             return -1;
+         } localconstants
+-
++              ;
+ program: prog { 
+               keynote_returnvalue = $1;
+               return 0;
+             }
+-
++              ;
+ prog:   /* Nada */ { $$ = 0; }
+        | notemptyprog {
+                         /* 
+@@ -285,7 +284,7 @@
+                     else
+                       $$ = $4;
+                     } 
+-
++              ;
+ notemptyprog: expr HINT afterhint
+               {
+               if (checkexception($1))
+@@ -300,7 +299,7 @@
+               else
+                 $$ = 0;
+             }
+-
++              ;
+ afterhint: str {  if (keynote_exceptionflag || keynote_donteval)
+                   $$ = 0;
+                 else
+@@ -315,7 +314,7 @@
+                 }
+                 }
+          | OPENBLOCK prog CLOSEBLOCK { $$ = $2; }
+-
++              ;
+ expr:     OPENPAREN expr CLOSEPAREN   { $$ = $2; }
+       | expr AND { if ($1 == 0)
+@@ -334,19 +333,19 @@
+       | stringexp                     { $$ = $1; }
+         | TRUE                                { $$ = 1; }
+         | FALSE                               { $$ = 0; }
+-
++              ;
+ numexp:         numex LT numex { $$ = $1 < $3; }
+       | numex GT numex { $$ = $1 > $3; }
+       | numex EQ numex { $$ = $1 == $3; }
+       | numex LE numex { $$ = $1 <= $3; }
+       | numex GE numex { $$ = $1 >= $3; }
+       | numex NE numex { $$ = $1 != $3; }
+-
++              ;
+ floatexp: floatex LT floatex { $$ = $1 < $3; }
+       | floatex GT floatex { $$ = $1 > $3; }
+       | floatex LE floatex { $$ = $1 <= $3; }
+       | floatex GE floatex { $$ = $1 >= $3; }
+-
++              ;
+ numex:          numex PLUS numex  { $$ = $1 + $3; }
+       | numex MINUS numex { $$ = $1 - $3; }
+       | numex MULT numex  { $$ = $1 * $3; }
+@@ -384,7 +383,7 @@
+                                             free($2);
+                                         }
+                                       }
+-
++              ;
+ floatex:  floatex PLUS floatex        { $$ = ($1 + $3); }
+       | floatex MINUS floatex         { $$ = ($1 - $3); }
+       | floatex MULT floatex          { $$ = ($1 * $3); }
+@@ -418,7 +417,7 @@
+                                             free($2);
+                                         }
+                                       }
+-
++              ;
+ stringexp: str EQ str {
+                         if (keynote_exceptionflag || keynote_donteval)
+                         $$ = 0;
+@@ -529,9 +528,9 @@
+                     if (i == 0)
+                     {
+ #if !defined(HAVE_SNPRINTF)
+-                        sprintf(grp, "%d", preg.re_nsub);
++                        sprintf(grp, "%d", (int)preg.re_nsub);
+ #else /* !HAVE_SNPRINTF */
+-                        snprintf(grp, 3, "%d", preg.re_nsub);
++                        snprintf(grp, 3, "%d", (int)preg.re_nsub);
+ #endif /* !HAVE_SNPRINTF */
+                         if (keynote_env_add("_0", grp, &keynote_temp_list,
+                                             1, 0) != RESULT_TRUE)
+@@ -579,7 +578,7 @@
+                 }
+             }
+           }
+-
++              ;
+ str: str DOTT str    {  if (keynote_exceptionflag || keynote_donteval)
+                         $$ = (char *) NULL;
+                       else
+@@ -605,7 +604,7 @@
+                       }
+                     }
+       | strnotconcat { $$ = $1; }
+-
++              ;
+ strnotconcat: STRING                  { $$ = $1; }
+         | OPENPAREN str CLOSEPAREN    { $$ = $2; }
+         | VARIABLE      {  if (keynote_exceptionflag || keynote_donteval)
+@@ -660,6 +659,7 @@
+                                 return -1;
+                           }
+                        }
++              ;
+ %%
+ /*
+Index: keynote-2.3/Makefile.in
+===================================================================
+--- keynote-2.3.orig/Makefile.in       2007-06-04 13:22:41.317574056 +0200
++++ keynote-2.3/Makefile.in    2007-06-04 13:22:41.391562808 +0200
+@@ -41,7 +41,8 @@
+ YACCFLAGS = -d -p kn -b k
+ LEXFLAGS2 = -Pkv -s -i
+ LEXFLAGS = -Cr -Pkn -s -i
+-CFLAGS = -O2 -Wall # -g
++CFLAGS = -O2 -Wall -fno-strict-aliasing # -g
++LDFLAGS = @LDFLAGS@
+ RMFLAGS2 = -rf
+ RMFLAGS = -f
+ NROFFFLAGS = -mandoc
+@@ -83,7 +84,7 @@
+       $(RANLIB) $(TARGET)
+ $(TARGET2): $(TARGET) $(OBJS2)
+-      $(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LIBS)
++      $(CC) $(CFLAGS) -o $(TARGET2) $(OBJS2) $(LDFLAGS) $(LIBS)
+ k.tab.c: keynote.y header.h keynote.h assertion.h config.h
+       $(YACC) $(YACCFLAGS) keynote.y
+Index: keynote-2.3/signature.c
+===================================================================
+--- keynote-2.3.orig/signature.c       2007-06-04 13:22:41.323573144 +0200
++++ keynote-2.3/signature.c    2007-06-04 13:22:41.392562656 +0200
+@@ -515,7 +515,7 @@
+       kk = dc->dec_key;
+       if (keytype == KEYNOTE_PRIVATE_KEY)
+       {
+-          if (d2i_DSAPrivateKey((DSA **) &kk, &decoded, len) == (DSA *) NULL)
++          if (d2i_DSAPrivateKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL)
+           {
+               if (ptr != (unsigned char *) NULL)
+                 free(ptr);
+@@ -526,7 +526,7 @@
+       }
+       else
+       {
+-          if (d2i_DSAPublicKey((DSA **) &kk, &decoded, len) == (DSA *) NULL)
++          if (d2i_DSAPublicKey((DSA **) &kk, (const unsigned char **) &decoded, len) == (DSA *) NULL)
+           {
+               if (ptr != (unsigned char *) NULL)
+                 free(ptr);
+@@ -556,7 +556,7 @@
+         kk = dc->dec_key;
+         if (keytype == KEYNOTE_PRIVATE_KEY)
+         {
+-            if (d2i_RSAPrivateKey((RSA **) &kk, &decoded, len) == (RSA *) NULL)
++            if (d2i_RSAPrivateKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL)
+             {
+                 if (ptr != (unsigned char *) NULL)
+                   free(ptr);
+@@ -567,7 +567,7 @@
+         }
+         else
+         {
+-            if (d2i_RSAPublicKey((RSA **) &kk, &decoded, len) == (RSA *) NULL)
++            if (d2i_RSAPublicKey((RSA **) &kk, (const unsigned char **) &decoded, len) == (RSA *) NULL)
+             {
+                 if (ptr != (unsigned char *) NULL)
+                   free(ptr);
diff --git a/libs/keynote/patches/002-cross_compile.patch b/libs/keynote/patches/002-cross_compile.patch
new file mode 100644 (file)
index 0000000..050efbd
--- /dev/null
@@ -0,0 +1,588 @@
+Index: keynote-2.3/configure
+===================================================================
+--- keynote-2.3.orig/configure 2007-06-04 13:22:41.259582872 +0200
++++ keynote-2.3/configure      2007-06-04 13:22:41.658522224 +0200
+@@ -889,52 +889,10 @@
+ done
+ test -n "$YACC" || YACC="yacc"
+-for ac_prog in openssl ssleay
+-do
+-# Extract the first word of "$ac_prog", so it can be a program name with args.
+-set dummy $ac_prog; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:898: checking for $ac_word" >&5
+-if eval "test \"`echo '$''{'ac_cv_path_SSLEAY'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
+-else
+-  case "$SSLEAY" in
+-  /*)
+-  ac_cv_path_SSLEAY="$SSLEAY" # Let the user override the test with a path.
+-  ;;
+-  ?:/*)                        
+-  ac_cv_path_SSLEAY="$SSLEAY" # Let the user override the test with a dos path.
+-  ;;
+-  *)
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
+-  ac_dummy="\
+-               $PATH:/usr/local/bin:/usr/local/ssl/sbin:/usr/local/ssl/bin:/usr/ssl/bin:/usr/ssl/sbin:/usr/sbin:/usr/openssl/bin:/usr/openssl/bin:/usr/local/openssl/bin:/usr/local/openssl/sbin"
+-  for ac_dir in $ac_dummy; do 
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_SSLEAY="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
+-  ;;
+-esac
+-fi
+-SSLEAY="$ac_cv_path_SSLEAY"
+-if test -n "$SSLEAY"; then
+-  echo "$ac_t""$SSLEAY" 1>&6
+-else
+-  echo "$ac_t""no" 1>&6
+-fi
+-
+-test -n "$SSLEAY" && break
+-done
+-test -n "$SSLEAY" || SSLEAY="/usr/local/bin/ssleay"
+-
+ # Extract the first word of "rm", so it can be a program name with args.
+ set dummy rm; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:938: checking for $ac_word" >&5
++echo "configure:896: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -970,7 +928,7 @@
+ # Extract the first word of "ar", so it can be a program name with args.
+ set dummy ar; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:974: checking for $ac_word" >&5
++echo "configure:932: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1006,7 +964,7 @@
+ # Extract the first word of "nroff", so it can be a program name with args.
+ set dummy nroff; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1010: checking for $ac_word" >&5
++echo "configure:968: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_NROFF'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1042,7 +1000,7 @@
+ # Extract the first word of "tar", so it can be a program name with args.
+ set dummy tar; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1046: checking for $ac_word" >&5
++echo "configure:1004: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1078,7 +1036,7 @@
+ # Extract the first word of "true", so it can be a program name with args.
+ set dummy true; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1082: checking for $ac_word" >&5
++echo "configure:1040: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_TRUE'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1114,7 +1072,7 @@
+ # Extract the first word of "mkdir", so it can be a program name with args.
+ set dummy mkdir; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1118: checking for $ac_word" >&5
++echo "configure:1076: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1150,7 +1108,7 @@
+ # Extract the first word of "tr", so it can be a program name with args.
+ set dummy tr; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1154: checking for $ac_word" >&5
++echo "configure:1112: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_TR'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1186,7 +1144,7 @@
+ # Extract the first word of "echo", so it can be a program name with args.
+ set dummy echo; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1190: checking for $ac_word" >&5
++echo "configure:1148: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_ECHO'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1222,7 +1180,7 @@
+ # Extract the first word of "sed", so it can be a program name with args.
+ set dummy sed; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:1226: checking for $ac_word" >&5
++echo "configure:1184: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -1256,11 +1214,8 @@
+ fi
+-LIBS="-L/usr/lib -L/usr/local/lib -L/usr/ssl/lib -L/usr/openssl/lib\
+- -L/usr/local/ssl/lib -L/usr/local/openssl/lib -L/usr/pkg/lib -L/pkg/lib"
+-
+ echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
+-echo "configure:1264: checking for floor in -lm" >&5
++echo "configure:1219: checking for floor in -lm" >&5
+ ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1268,7 +1223,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lm  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 1272 "configure"
++#line 1227 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -1279,7 +1234,7 @@
+ floor()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -1300,7 +1255,7 @@
+ fi
+ echo $ac_n "checking for RSAPrivateDecrypt in -lrsaref""... $ac_c" 1>&6
+-echo "configure:1304: checking for RSAPrivateDecrypt in -lrsaref" >&5
++echo "configure:1259: checking for RSAPrivateDecrypt in -lrsaref" >&5
+ ac_lib_var=`echo rsaref'_'RSAPrivateDecrypt | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1308,7 +1263,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lrsaref  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 1312 "configure"
++#line 1267 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -1319,7 +1274,7 @@
+ RSAPrivateDecrypt()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -1340,7 +1295,7 @@
+ fi
+ echo $ac_n "checking for i2a_ASN1_STRING in -lcrypto""... $ac_c" 1>&6
+-echo "configure:1344: checking for i2a_ASN1_STRING in -lcrypto" >&5
++echo "configure:1299: checking for i2a_ASN1_STRING in -lcrypto" >&5
+ ac_lib_var=`echo crypto'_'i2a_ASN1_STRING | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1348,7 +1303,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lcrypto  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 1352 "configure"
++#line 1307 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -1359,7 +1314,7 @@
+ i2a_ASN1_STRING()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -1380,7 +1335,7 @@
+ fi
+ echo $ac_n "checking for RSA_ref_private_encrypt in -lRSAglue""... $ac_c" 1>&6
+-echo "configure:1384: checking for RSA_ref_private_encrypt in -lRSAglue" >&5
++echo "configure:1339: checking for RSA_ref_private_encrypt in -lRSAglue" >&5
+ ac_lib_var=`echo RSAglue'_'RSA_ref_private_encrypt | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1388,7 +1343,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lRSAglue  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 1392 "configure"
++#line 1347 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -1399,7 +1354,7 @@
+ RSA_ref_private_encrypt()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -1420,12 +1375,9 @@
+ fi
+-CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/ssl/include\
+- -I/usr/local/ssl/include -I/usr/openssl/include -I/usr/pkg/include\
+- -I/usr/local/openssl/include -I/pkg/include"
+ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+-echo "configure:1429: checking how to run the C preprocessor" >&5
++echo "configure:1381: checking how to run the C preprocessor" >&5
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+   CPP=
+@@ -1440,13 +1392,13 @@
+   # On the NeXT, cc -E runs the code through the compiler's parser,
+   # not just through cpp.
+   cat > conftest.$ac_ext <<EOF
+-#line 1444 "configure"
++#line 1396 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1450: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   :
+@@ -1457,13 +1409,13 @@
+   rm -rf conftest*
+   CPP="${CC-cc} -E -traditional-cpp"
+   cat > conftest.$ac_ext <<EOF
+-#line 1461 "configure"
++#line 1413 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1419: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   :
+@@ -1474,13 +1426,13 @@
+   rm -rf conftest*
+   CPP="${CC-cc} -nologo -E"
+   cat > conftest.$ac_ext <<EOF
+-#line 1478 "configure"
++#line 1430 "configure"
+ #include "confdefs.h"
+ #include <assert.h>
+ Syntax Error
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   :
+@@ -1505,12 +1457,12 @@
+ echo "$ac_t""$CPP" 1>&6
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+-echo "configure:1509: checking for ANSI C header files" >&5
++echo "configure:1461: checking for ANSI C header files" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1514 "configure"
++#line 1466 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ #include <stdarg.h>
+@@ -1518,7 +1470,7 @@
+ #include <float.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1535,7 +1487,7 @@
+ if test $ac_cv_header_stdc = yes; then
+   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+-#line 1539 "configure"
++#line 1491 "configure"
+ #include "confdefs.h"
+ #include <string.h>
+ EOF
+@@ -1553,7 +1505,7 @@
+ if test $ac_cv_header_stdc = yes; then
+   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat > conftest.$ac_ext <<EOF
+-#line 1557 "configure"
++#line 1509 "configure"
+ #include "confdefs.h"
+ #include <stdlib.h>
+ EOF
+@@ -1574,7 +1526,7 @@
+   :
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1578 "configure"
++#line 1530 "configure"
+ #include "confdefs.h"
+ #include <ctype.h>
+ #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+@@ -1585,7 +1537,7 @@
+ exit (0); }
+ EOF
+-if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
++if { (eval echo configure:1541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+   :
+ else
+@@ -1609,12 +1561,12 @@
+ fi
+ echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+-echo "configure:1613: checking whether time.h and sys/time.h may both be included" >&5
++echo "configure:1565: checking whether time.h and sys/time.h may both be included" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1618 "configure"
++#line 1570 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #include <sys/time.h>
+@@ -1623,7 +1575,7 @@
+ struct tm *tp;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_header_time=yes
+ else
+@@ -1647,17 +1599,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1651: checking for $ac_hdr" >&5
++echo "configure:1603: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1656 "configure"
++#line 1608 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1687,17 +1639,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1691: checking for $ac_hdr" >&5
++echo "configure:1643: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1696 "configure"
++#line 1648 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1653: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1726,12 +1678,12 @@
+ echo $ac_n "checking for working const""... $ac_c" 1>&6
+-echo "configure:1730: checking for working const" >&5
++echo "configure:1682: checking for working const" >&5
+ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1735 "configure"
++#line 1687 "configure"
+ #include "confdefs.h"
+ int main() {
+@@ -1780,7 +1732,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ac_cv_c_const=yes
+ else
+@@ -1801,12 +1753,12 @@
+ fi
+ echo $ac_n "checking for u_int""... $ac_c" 1>&6
+-echo "configure:1805: checking for u_int" >&5
++echo "configure:1757: checking for u_int" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_u_int'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1810 "configure"
++#line 1762 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+@@ -1834,12 +1786,12 @@
+ fi
+ echo $ac_n "checking for u_char""... $ac_c" 1>&6
+-echo "configure:1838: checking for u_char" >&5
++echo "configure:1790: checking for u_char" >&5
+ if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1843 "configure"
++#line 1795 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #if STDC_HEADERS
+@@ -1870,12 +1822,12 @@
+ for ac_func in regcomp open close read _open _close _read strchr memcpy
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:1874: checking for $ac_func" >&5
++echo "configure:1826: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1879 "configure"
++#line 1831 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+@@ -1898,7 +1850,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -1925,12 +1877,12 @@
+ for ac_func in strcasecmp strncasecmp stricmp strnicmp snprintf __b64_ntop
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:1929: checking for $ac_func" >&5
++echo "configure:1881: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1934 "configure"
++#line 1886 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+@@ -1953,7 +1905,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -1980,12 +1932,12 @@
+ for ac_func in getopt
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:1984: checking for $ac_func" >&5
++echo "configure:1936: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1989 "configure"
++#line 1941 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+@@ -2008,7 +1960,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2172,7 +2124,6 @@
+ s%@CC@%$CC%g
+ s%@RANLIB@%$RANLIB%g
+ s%@YACC@%$YACC%g
+-s%@SSLEAY@%$SSLEAY%g
+ s%@RM@%$RM%g
+ s%@AR@%$AR%g
+ s%@NROFF@%$NROFF%g
+Index: keynote-2.3/configure.in
+===================================================================
+--- keynote-2.3.orig/configure.in      2007-06-04 13:22:41.389563112 +0200
++++ keynote-2.3/configure.in   2007-06-04 13:22:41.658522224 +0200
+@@ -9,8 +9,8 @@
+ AC_PROG_CC
+ AC_PROG_RANLIB
+ AC_PROG_YACC
+-AC_PATH_PROGS(SSLEAY, openssl ssleay, /usr/local/bin/ssleay, \
+-               $PATH:/usr/local/bin:/usr/local/ssl/sbin:/usr/local/ssl/bin:/usr/ssl/bin:/usr/ssl/sbin:/usr/sbin:/usr/openssl/bin:/usr/openssl/bin:/usr/local/openssl/bin:/usr/local/openssl/sbin)
++dnl AC_PATH_PROGS(SSLEAY, openssl ssleay, /usr/local/bin/ssleay, \
++dnl                $PATH:/usr/local/bin:/usr/local/ssl/sbin:/usr/local/ssl/bin:/usr/ssl/bin:/usr/ssl/sbin:/usr/sbin:/usr/openssl/bin:/usr/openssl/bin:/usr/local/openssl/bin:/usr/local/openssl/sbin)
+ AC_PATH_PROG(RM, rm, /bin/rm)
+ AC_PATH_PROG(AR, ar, /usr/bin/ar)
+ AC_PATH_PROG(NROFF, nroff, /usr/bin/nroff)
+@@ -27,7 +27,7 @@
+ AC_CHECK_LIB(RSAglue, RSA_ref_private_encrypt, LIBS="$LIBS -lRSAglue")
+ dnl Checks for header files.
+-CPPFLAGS="-I/usr/include/openssl"
++dnl CPPFLAGS="-I/usr/include/openssl"
+ AC_HEADER_STDC
+ AC_HEADER_TIME
diff --git a/libs/ldns/Makefile b/libs/ldns/Makefile
new file mode 100644 (file)
index 0000000..d2d77df
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2011-2014 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:=ldns
+PKG_VERSION:=1.6.17
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.nlnetlabs.nl/downloads/ldns
+PKG_MD5SUM:=a79423bcc4129e6d59b616b1cae11e5e
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libldns/Default
+  URL:=http://www.nlnetlabs.nl/projects/ldns/
+  DEPENDS:=+libopenssl
+endef
+
+define Package/libldns
+  $(call Package/libldns/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A library to simplify DNS programming
+endef
+
+define Package/libldns/description
+  The goal of ldns is to simplify DNS programming, it supports recent RFCs like
+  the DNSSEC documents, and allows developers to easily create software
+  conforming to current RFCs, and experimental software for current Internet
+  Drafts.
+endef
+
+define Package/drill
+  $(call Package/libldns/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=DNS(SEC) information tool
+  DEPENDS+= +libldns
+endef
+
+define Package/drill/description
+  drill is a tool to designed to get all sorts of information out of the DNS. It
+  is specificly designed to be used with DNSSEC.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-ecdsa \
+       --disable-gost \
+       --with-drill \
+       --with-ssl="$(STAGING_DIR)/usr"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ldns $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libldns.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libldns/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libldns.so.* $(1)/usr/lib/
+endef
+
+define Package/drill/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/drill $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libldns))
+$(eval $(call BuildPackage,drill))
diff --git a/libs/leptonica/Makefile b/libs/leptonica/Makefile
new file mode 100644 (file)
index 0000000..cd1a31f
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 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:=leptonica
+PKG_VERSION:=1.68
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://leptonica.googlecode.com/files/
+PKG_MD5SUM:=5cd7092f9ff2ca7e3f3e73bfcd556403
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libleptonica
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A library for efficient image processing and image analysis operations
+  URL:=http://leptonica.googlecode.com/
+  DEPENDS:=+giflib +libjpeg +libpng +libtiff +zlib
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/leptonica $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblept.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libleptonica/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblept.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libleptonica))
+
diff --git a/libs/libIDL2/Makefile b/libs/libIDL2/Makefile
new file mode 100644 (file)
index 0000000..5d7cc25
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2008 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:=libIDL2
+PKG_VERSION:=0.8.13
+PKG_RELEASE:=1
+
+PKG_SOURCE:=libIDL-$(PKG_VERSION).tar.bz2
+PKG_BUILD_DIR:=$(BUILD_DIR)/libIDL-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/libIDL-$(PKG_VERSION)
+PKG_SOURCE_URL:=@GNOME/libIDL/0.8
+PKG_MD5SUM:=b43b289a859eb38a710f70622c46e571
+PKG_FIXUP:=autoreconf
+HOST_BUILD_DEPENDS:=glib2/host
+PKG_INSTALL=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libIDL2
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=IDL Compiling Library
+  URL:=http://andrewtv.org/libIDL/
+  DEPENDS:=+glib2
+endef
+
+define Package/libIDL2/description
+  libIDL is a library licensed under the GNU LGPL for creating trees of
+  CORBA Interface Definition Language (IDL) files, which is a
+  specification for defining portable interfaces.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default,libIDL_cv_long_long_format=ll)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+endef
+
+define Package/libIDL2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,libIDL2))
diff --git a/libs/libamsel/Makefile b/libs/libamsel/Makefile
new file mode 100644 (file)
index 0000000..42426da
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006 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:=libamsel
+PKG_VERSION:=20040621-cvs
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.amselinux.net/source/
+PKG_MD5SUM:=2077e620047404881a65d39c53c9917e
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libamsel
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=The amwall library
+  URL:=http://amselinux.de/
+endef
+
+define Package/libamsel/description
+       A library for amwall configuration files.
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR) -fPIC" \
+       LDIR=$(PKG_BUILD_DIR) \
+       PREFIX="$(PKG_INSTALL_DIR)/usr" \
+       all install
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/amsel/compat.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/include/compat
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/amsel/compat/queue.h $(1)/usr/include/compat/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libamsel.so $(1)/usr/lib/
+endef
+
+define Package/libamsel/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,libamsel))
diff --git a/libs/libao/Makefile b/libs/libao/Makefile
new file mode 100644 (file)
index 0000000..a4e14a0
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2006 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:=libao
+PKG_VERSION:=1.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.xiph.org/releases/ao/
+PKG_MD5SUM:=2b2508c29bc97e4dc218fa162cf883c8
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libao
+  SECTION:=libs
+  DEPENDS:=+alsa-lib
+  CATEGORY:=Libraries
+  TITLE:=A cross platform audio library
+  URL:=http://www.xiph.org/ao/
+endef
+
+define Package/libao/description
+       Libao is a cross-platform audio library that allows programs to
+       output audio using a simple API on a wide variety of platforms.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-esd \
+       --disable-arts \
+       --disable-nas \
+       --disable-pulse
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ao $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libao.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/ao.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libao/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libao.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/ao/plugins-4
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ao/plugins-4/lib*.so $(1)/usr/lib/ao/plugins-4/
+endef
+
+$(eval $(call BuildPackage,libao))
diff --git a/libs/libart/Makefile b/libs/libart/Makefile
new file mode 100644 (file)
index 0000000..6f0bb51
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2006-2010 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:=libart
+PKG_VERSION:=2.3.21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_lgpl-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)_lgpl/2.3
+PKG_MD5SUM:=08559ff3c67fd95d57b0c5e91a6b4302
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_lgpl-$(PKG_VERSION)
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libart
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=An high-performance 2D graphics library
+  URL:=http://www.levien.com/libart/
+endef
+
+define Package/libart/description
+ A library of functions for 2D graphics supporting a superset of the
+ PostScript imaging model, designed to be integrated with graphics,
+ artwork, and illustration programs. It is written in optimized C, and
+ is fully compatible with C++. With a small footprint of 10,000 lines of
+ code, it is especially suitable for embedded applications.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin $(1)/usr/include $(1)/usr/lib/pkgconfig
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/libart2-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/libart2-config
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/libart-2.0 \
+                       $(1)/usr/include/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libart_lgpl_2.{la,a,so*} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libart-2.0.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libart/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libart_lgpl_2.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libart))
diff --git a/libs/libassuan/Makefile b/libs/libassuan/Makefile
new file mode 100644 (file)
index 0000000..ff2a4fe
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 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:=libassuan
+PKG_VERSION:=2.0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.gnupg.org/gcrypt/libassuan/
+PKG_MD5SUM:=3e7d00fd2ee8a0b9c51ac7616ef3f1ec
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libassuan
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GnuPG IPC library
+  URL:=http://www.gnupg.org/
+  DEPENDS:=+libgpg-error
+endef
+
+define Package/libassuan/description
+ The Libassuan package contains an IPC library used by some of the other
+ GnuPG related packages. Libassuan's primary use is to allow a client to
+ interact with a non-persistent server. Libassuan is not, however,
+ limited to use with GnuPG servers and clients. It was designed to be
+ flexible enough to meet the demands of many transaction based
+ environments with non-persistent servers.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-gpg-error-prefix="$(STAGING_DIR)/usr" \
+       --without-pth-test \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/assuan.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libassuan.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share/aclocal
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/aclocal/libassuan.m4 $(1)/usr/share/aclocal/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/libassuan-config $(1)/usr/bin/
+       $(INSTALL_DIR) $(2)/bin
+       $(LN) -nsf ../../usr/bin/libassuan-config $(2)/bin/
+endef
+
+define Package/libassuan/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libassuan*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libassuan))
diff --git a/libs/libatomicops/Makefile b/libs/libatomicops/Makefile
new file mode 100644 (file)
index 0000000..52e6bbd
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007-2010 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:=libatomicops
+PKG_VERSION:=1.2
+PKG_EXTRA_VERSION:=+cvs20080819.orig
+PKG_RELEASE:=2
+
+PKG_SOURCE:=libatomic-ops_$(PKG_VERSION)$(PKG_EXTRA_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/liba/libatomic-ops/
+PKG_MD5SUM:=bf26c062f28796e3daaab586a38abec1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/libatomic_ops-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libatomicops
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=implementations for atomic memory update operations
+  DEPENDS:=@!TARGET_avr32
+  URL:=http://www.hpl.hp.com/research/linux/atomic_ops/
+endef
+
+define Package/libatomicops/description
+  Provides implementations for atomic memory update
+  operations on a number of architectures. This allows
+  direct use of these in reasonably portable code. Unlike
+  earlier similar packages, this one explicitly considers
+  memory barrier semantics, and allows the construction of
+  code that involves minimum overhead across a variety of
+  architectures.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(CP) $(PKG_BUILD_DIR)/src/atomic_ops $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libatomic_ops*.a $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libatomicops))
diff --git a/libs/libcelt/Makefile b/libs/libcelt/Makefile
new file mode 100644 (file)
index 0000000..fb57a7d
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2009-2010 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:=celt
+PKG_VERSION:=0.7.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.us.xiph.org/releases/celt/
+PKG_MD5SUM:=0bb72abec367f4ef12551f79dda11b23
+
+PKG_BUILD_DEPENDS:=libogg
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libcelt
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=CELT Codec
+  URL:=http://www.celt-codec.org/
+endef
+
+define Package/libcelt/description
+ The CELT codec is an experimental audio codec for use in low-delay speech and audio communication.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --without-ogg \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/celt
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/celt/celt*.h \
+               $(1)/usr/include/celt
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* \
+               $(1)/usr/lib/
+endef
+
+define Package/libcelt/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcelt.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcelt))
diff --git a/libs/libcli/Makefile b/libs/libcli/Makefile
new file mode 100644 (file)
index 0000000..e00fe1e
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006 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:=libcli
+PKG_VERSION:=1.9.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://libcli.googlecode.com/files
+PKG_MD5SUM:=b917617d21b90db214971efe64a33416
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libcli
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A Cisco-like CLI library
+  URL:=http://code.google.com/p/libcli/
+  DEPENDS:=+EXTERNAL_TOOLCHAIN:libc +EXTERNAL_TOOLCHAIN:libgcc
+endef
+
+define Package/libcli/description
+       Libcli provides a shared library for including a Cisco-like
+       command-line interface into other software. It's a telnet
+       interface which supports command-line editing, history,
+       authentication and callbacks for a user-definable function tree.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_FLAGS += \
+       DEBUG="" \
+       OPTIM="$(TARGET_CFLAGS)" \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       PREFIX="/usr" \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       all install
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libcli.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcli.so* $(1)/usr/lib/
+endef
+
+define Package/libcli/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcli.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcli))
diff --git a/libs/libcroco/Makefile b/libs/libcroco/Makefile
new file mode 100644 (file)
index 0000000..60708b0
--- /dev/null
@@ -0,0 +1,59 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libcroco
+PKG_VERSION:=0.6.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/0.6/
+PKG_MD5SUM:=1429c597aa4b75fc610ab3a542c99209
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+EXTRA_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+               -L$(ICONV_PREFIX) -L$(INTL_PREFIX)
+
+define Package/libcroco
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Croco css2 parsing libraray.
+  DEPENDS:=+glib2 +libxml2
+  URL:=http://www.freespiders.org/projects/libcroco/
+endef
+
+define Package/libcroco/description
+Libcroco is a standalone css2 parsing and manipulation library.
+The parser provides a low level event driven SAC like api
+and a css object model like api.
+Libcroco provides a CSS2 selection engine and an experimental
+xml/css rendering engine.
+
+This library is being written to bring the css support
+to the mlview xml editor project but it can be used
+for other applications as well.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+       $(MAKE) -C $(PKG_BUILD_DIR)/ install DESTDIR=$(PKG_INSTALL_DIR)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/host/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/croco-0.6-config $(1)/host/bin/
+endef
+
+define Package/libcroco/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*{a,so*} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcroco))
+
+
diff --git a/libs/libcroco/patches/001-automake-compat.patch b/libs/libcroco/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..0012c56
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure.in
++++ b/configure.in
+@@ -67,8 +67,6 @@ case "$host" in
+ esac
+ AM_CONDITIONAL(PLATFORM_WIN32, [test "$platform_win32" = "yes"])
+-GTK_DOC_CHECK([1.0])
+-
+ dnl **************************************************************
+ dnl check for the different --enable-option=val  
+ dnl messages issued by the user
diff --git a/libs/libcrypto++/Makefile b/libs/libcrypto++/Makefile
new file mode 100644 (file)
index 0000000..734ef0a
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2009-2012 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:=libcrypto++
+PKG_VERSION:=5.6.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/libc/libcrypto++/
+PKG_MD5SUM:=681f830145bf93cbc16113eaf61fbe2a
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 GNUmakefile
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libcryptoxx
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpthread +libstdcpp
+  TITLE:=Crypto++ is library for creating C++ programs which use cryptographic algorithms
+  URL:=http://packages.debian.org/sid/libcrypto++-dev
+endef
+
+define Package/package/libcryptoxx
+  Crypto++ is library for creating C++ programs which use cryptographic algorithms.
+  The library uses a Pipes & Filters architecture with heavy use of templates and
+  abstract base classes.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared
+
+TARGET_LDFLAGS += \
+       -lpthread
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/crypto++
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/crypto--/* $(1)/usr/include/crypto++/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcrypto++.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libcryptoxx/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcrypto++.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcryptoxx))
diff --git a/libs/libcrypto++/patches/001-strict_gcc43_include.patch b/libs/libcrypto++/patches/001-strict_gcc43_include.patch
new file mode 100644 (file)
index 0000000..f8c38eb
--- /dev/null
@@ -0,0 +1,16 @@
+## strict-gcc43-include.diff by Jens Peter Secher <jps@debian.org>
+##
+## Explicitly include cstring to allow compilation with GCC 4.3.
+
+Index: libcrypto++/misc.h
+===================================================================
+--- libcrypto++.orig/misc.h    2009-04-07 02:48:55.000000000 +0200
++++ libcrypto++/misc.h 2009-04-07 02:50:56.000000000 +0200
+@@ -40,6 +40,7 @@
+ #if defined(__GNUC__) && defined(__linux__)
+ #define CRYPTOPP_BYTESWAP_AVAILABLE
+ #include <byteswap.h>
++#include <cstring>
+ #endif
+ NAMESPACE_BEGIN(CryptoPP)
diff --git a/libs/libcrypto++/patches/002-cryptest_data_files_location.patch b/libs/libcrypto++/patches/002-cryptest_data_files_location.patch
new file mode 100644 (file)
index 0000000..2dbb696
--- /dev/null
@@ -0,0 +1,500 @@
+## cryptest-data-files-location.diff by Jens Peter Secher <jps@debian.org>
+##
+## Prefix data file names by PACKAGE_DATA_DIR which is set during build.
+
+Index: libcrypto++/bench2.cpp
+===================================================================
+--- libcrypto++.orig/bench2.cpp        2009-04-07 03:08:36.000000000 +0200
++++ libcrypto++/bench2.cpp     2009-04-07 03:23:43.000000000 +0200
+@@ -245,44 +245,44 @@
+       cout << "<THEAD><TR><TH>Operation<TH>Milliseconds/Operation" << (g_hertz ? "<TH>Megacycles/Operation" : "") << endl;
+       cout << "\n<TBODY style=\"background: yellow\">";
+-      BenchMarkCrypto<RSAES<OAEP<SHA> > >("TestData/rsa1024.dat", "RSA 1024", t);
+-      BenchMarkCrypto<LUCES<OAEP<SHA> > >("TestData/luc1024.dat", "LUC 1024", t);
+-      BenchMarkCrypto<DLIES<> >("TestData/dlie1024.dat", "DLIES 1024", t);
+-      BenchMarkCrypto<LUC_IES<> >("TestData/lucc512.dat", "LUCELG 512", t);
++      BenchMarkCrypto<RSAES<OAEP<SHA> > >(PACKAGE_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
++      BenchMarkCrypto<LUCES<OAEP<SHA> > >(PACKAGE_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
++      BenchMarkCrypto<DLIES<> >(PACKAGE_DATA_DIR "TestData/dlie1024.dat", "DLIES 1024", t);
++      BenchMarkCrypto<LUC_IES<> >(PACKAGE_DATA_DIR "TestData/lucc512.dat", "LUCELG 512", t);
+       cout << "\n<TBODY style=\"background: white\">";
+-      BenchMarkCrypto<RSAES<OAEP<SHA> > >("TestData/rsa2048.dat", "RSA 2048", t);
+-      BenchMarkCrypto<LUCES<OAEP<SHA> > >("TestData/luc2048.dat", "LUC 2048", t);
+-      BenchMarkCrypto<DLIES<> >("TestData/dlie2048.dat", "DLIES 2048", t);
+-      BenchMarkCrypto<LUC_IES<> >("TestData/lucc1024.dat", "LUCELG 1024", t);
++      BenchMarkCrypto<RSAES<OAEP<SHA> > >(PACKAGE_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
++      BenchMarkCrypto<LUCES<OAEP<SHA> > >(PACKAGE_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
++      BenchMarkCrypto<DLIES<> >(PACKAGE_DATA_DIR "TestData/dlie2048.dat", "DLIES 2048", t);
++      BenchMarkCrypto<LUC_IES<> >(PACKAGE_DATA_DIR "TestData/lucc1024.dat", "LUCELG 1024", t);
+       cout << "\n<TBODY style=\"background: yellow\">";
+-      BenchMarkSignature<RSASS<PSSR, SHA> >("TestData/rsa1024.dat", "RSA 1024", t);
+-      BenchMarkSignature<RWSS<PSSR, SHA> >("TestData/rw1024.dat", "RW 1024", t);
+-      BenchMarkSignature<LUCSS<PSSR, SHA> >("TestData/luc1024.dat", "LUC 1024", t);
+-      BenchMarkSignature<NR<SHA> >("TestData/nr1024.dat", "NR 1024", t);
+-      BenchMarkSignature<DSA>("TestData/dsa1024.dat", "DSA 1024", t);
+-      BenchMarkSignature<LUC_HMP<SHA> >("TestData/lucs512.dat", "LUC-HMP 512", t);
+-      BenchMarkSignature<ESIGN<SHA> >("TestData/esig1023.dat", "ESIGN 1023", t);
+-      BenchMarkSignature<ESIGN<SHA> >("TestData/esig1536.dat", "ESIGN 1536", t);
++      BenchMarkSignature<RSASS<PSSR, SHA> >(PACKAGE_DATA_DIR "TestData/rsa1024.dat", "RSA 1024", t);
++      BenchMarkSignature<RWSS<PSSR, SHA> >(PACKAGE_DATA_DIR "TestData/rw1024.dat", "RW 1024", t);
++      BenchMarkSignature<LUCSS<PSSR, SHA> >(PACKAGE_DATA_DIR "TestData/luc1024.dat", "LUC 1024", t);
++      BenchMarkSignature<NR<SHA> >(PACKAGE_DATA_DIR "TestData/nr1024.dat", "NR 1024", t);
++      BenchMarkSignature<DSA>(PACKAGE_DATA_DIR "TestData/dsa1024.dat", "DSA 1024", t);
++      BenchMarkSignature<LUC_HMP<SHA> >(PACKAGE_DATA_DIR "TestData/lucs512.dat", "LUC-HMP 512", t);
++      BenchMarkSignature<ESIGN<SHA> >(PACKAGE_DATA_DIR "TestData/esig1023.dat", "ESIGN 1023", t);
++      BenchMarkSignature<ESIGN<SHA> >(PACKAGE_DATA_DIR "TestData/esig1536.dat", "ESIGN 1536", t);
+       cout << "\n<TBODY style=\"background: white\">";
+-      BenchMarkSignature<RSASS<PSSR, SHA> >("TestData/rsa2048.dat", "RSA 2048", t);
+-      BenchMarkSignature<RWSS<PSSR, SHA> >("TestData/rw2048.dat", "RW 2048", t);
+-      BenchMarkSignature<LUCSS<PSSR, SHA> >("TestData/luc2048.dat", "LUC 2048", t);
+-      BenchMarkSignature<NR<SHA> >("TestData/nr2048.dat", "NR 2048", t);
+-      BenchMarkSignature<LUC_HMP<SHA> >("TestData/lucs1024.dat", "LUC-HMP 1024", t);
+-      BenchMarkSignature<ESIGN<SHA> >("TestData/esig2046.dat", "ESIGN 2046", t);
++      BenchMarkSignature<RSASS<PSSR, SHA> >(PACKAGE_DATA_DIR "TestData/rsa2048.dat", "RSA 2048", t);
++      BenchMarkSignature<RWSS<PSSR, SHA> >(PACKAGE_DATA_DIR "TestData/rw2048.dat", "RW 2048", t);
++      BenchMarkSignature<LUCSS<PSSR, SHA> >(PACKAGE_DATA_DIR "TestData/luc2048.dat", "LUC 2048", t);
++      BenchMarkSignature<NR<SHA> >(PACKAGE_DATA_DIR "TestData/nr2048.dat", "NR 2048", t);
++      BenchMarkSignature<LUC_HMP<SHA> >(PACKAGE_DATA_DIR "TestData/lucs1024.dat", "LUC-HMP 1024", t);
++      BenchMarkSignature<ESIGN<SHA> >(PACKAGE_DATA_DIR "TestData/esig2046.dat", "ESIGN 2046", t);
+       cout << "\n<TBODY style=\"background: yellow\">";
+-      BenchMarkKeyAgreement<XTR_DH>("TestData/xtrdh171.dat", "XTR-DH 171", t);
+-      BenchMarkKeyAgreement<XTR_DH>("TestData/xtrdh342.dat", "XTR-DH 342", t);
+-      BenchMarkKeyAgreement<DH>("TestData/dh1024.dat", "DH 1024", t);
+-      BenchMarkKeyAgreement<DH>("TestData/dh2048.dat", "DH 2048", t);
+-      BenchMarkKeyAgreement<LUC_DH>("TestData/lucd512.dat", "LUCDIF 512", t);
+-      BenchMarkKeyAgreement<LUC_DH>("TestData/lucd1024.dat", "LUCDIF 1024", t);
+-      BenchMarkKeyAgreement<MQV>("TestData/mqv1024.dat", "MQV 1024", t);
+-      BenchMarkKeyAgreement<MQV>("TestData/mqv2048.dat", "MQV 2048", t);
++      BenchMarkKeyAgreement<XTR_DH>(PACKAGE_DATA_DIR "TestData/xtrdh171.dat", "XTR-DH 171", t);
++      BenchMarkKeyAgreement<XTR_DH>(PACKAGE_DATA_DIR "TestData/xtrdh342.dat", "XTR-DH 342", t);
++      BenchMarkKeyAgreement<DH>(PACKAGE_DATA_DIR "TestData/dh1024.dat", "DH 1024", t);
++      BenchMarkKeyAgreement<DH>(PACKAGE_DATA_DIR "TestData/dh2048.dat", "DH 2048", t);
++      BenchMarkKeyAgreement<LUC_DH>(PACKAGE_DATA_DIR "TestData/lucd512.dat", "LUCDIF 512", t);
++      BenchMarkKeyAgreement<LUC_DH>(PACKAGE_DATA_DIR "TestData/lucd1024.dat", "LUCDIF 1024", t);
++      BenchMarkKeyAgreement<MQV>(PACKAGE_DATA_DIR "TestData/mqv1024.dat", "MQV 1024", t);
++      BenchMarkKeyAgreement<MQV>(PACKAGE_DATA_DIR "TestData/mqv2048.dat", "MQV 2048", t);
+       cout << "\n<TBODY style=\"background: white\">";
+       {
+Index: libcrypto++/test.cpp
+===================================================================
+--- libcrypto++.orig/test.cpp  2009-04-07 03:08:36.000000000 +0200
++++ libcrypto++/test.cpp       2009-04-07 03:24:04.000000000 +0200
+@@ -337,7 +337,7 @@
+                       AES_CTR_Encrypt(argv[2], argv[3], argv[4], argv[5]);
+               else if (command == "h")
+               {
+-                      FileSource usage("TestData/usage.dat", true, new FileSink(cout));
++                      FileSource usage(PACKAGE_DATA_DIR "TestData/usage.dat", true, new FileSink(cout));
+                       return 1;
+               }
+               else if (command == "V")
+Index: libcrypto++/validat1.cpp
+===================================================================
+--- libcrypto++.orig/validat1.cpp      2009-04-07 03:08:36.000000000 +0200
++++ libcrypto++/validat1.cpp   2009-04-07 03:25:57.000000000 +0200
+@@ -508,12 +508,12 @@
+ {
+       cout << "\nDES validation suite running...\n\n";
+-      FileSource valdata("TestData/descert.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/descert.dat", true, new HexDecoder);
+       bool pass = BlockTransformationTest(FixedRoundsCipherFactory<DESEncryption, DESDecryption>(), valdata);
+       cout << "\nTesting EDE2, EDE3, and XEX3 variants...\n\n";
+-      FileSource valdata1("TestData/3desval.dat", true, new HexDecoder);
++      FileSource valdata1(PACKAGE_DATA_DIR "TestData/3desval.dat", true, new HexDecoder);
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<DES_EDE2_Encryption, DES_EDE2_Decryption>(), valdata1, 1) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<DES_EDE3_Encryption, DES_EDE3_Decryption>(), valdata1, 1) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<DES_XEX3_Encryption, DES_XEX3_Decryption>(), valdata1, 1) && pass;
+@@ -855,7 +855,7 @@
+ {
+       cout << "\nIDEA validation suite running...\n\n";
+-      FileSource valdata("TestData/ideaval.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/ideaval.dat", true, new HexDecoder);
+       return BlockTransformationTest(FixedRoundsCipherFactory<IDEAEncryption, IDEADecryption>(), valdata);
+ }
+@@ -863,7 +863,7 @@
+ {
+       cout << "\nSAFER validation suite running...\n\n";
+-      FileSource valdata("TestData/saferval.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/saferval.dat", true, new HexDecoder);
+       bool pass = true;
+       pass = BlockTransformationTest(VariableRoundsCipherFactory<SAFER_K_Encryption, SAFER_K_Decryption>(8,6), valdata, 4) && pass;
+       pass = BlockTransformationTest(VariableRoundsCipherFactory<SAFER_K_Encryption, SAFER_K_Decryption>(16,12), valdata, 4) && pass;
+@@ -876,7 +876,7 @@
+ {
+       cout << "\nRC2 validation suite running...\n\n";
+-      FileSource valdata("TestData/rc2val.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/rc2val.dat", true, new HexDecoder);
+       HexEncoder output(new FileSink(cout));
+       SecByteBlock plain(RC2Encryption::BLOCKSIZE), cipher(RC2Encryption::BLOCKSIZE), out(RC2Encryption::BLOCKSIZE), outplain(RC2Encryption::BLOCKSIZE);
+       SecByteBlock key(128);
+@@ -1086,7 +1086,7 @@
+ {
+       cout << "\nRC5 validation suite running...\n\n";
+-      FileSource valdata("TestData/rc5val.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/rc5val.dat", true, new HexDecoder);
+       return BlockTransformationTest(VariableRoundsCipherFactory<RC5Encryption, RC5Decryption>(16, 12), valdata);
+ }
+@@ -1094,7 +1094,7 @@
+ {
+       cout << "\nRC6 validation suite running...\n\n";
+-      FileSource valdata("TestData/rc6val.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/rc6val.dat", true, new HexDecoder);
+       bool pass = true;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<RC6Encryption, RC6Decryption>(16), valdata, 2) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<RC6Encryption, RC6Decryption>(24), valdata, 2) && pass;
+@@ -1106,7 +1106,7 @@
+ {
+       cout << "\nMARS validation suite running...\n\n";
+-      FileSource valdata("TestData/marsval.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/marsval.dat", true, new HexDecoder);
+       bool pass = true;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<MARSEncryption, MARSDecryption>(16), valdata, 4) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<MARSEncryption, MARSDecryption>(24), valdata, 3) && pass;
+@@ -1118,7 +1118,7 @@
+ {
+       cout << "\nRijndael (AES) validation suite running...\n\n";
+-      FileSource valdata("TestData/rijndael.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/rijndael.dat", true, new HexDecoder);
+       bool pass = true;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<RijndaelEncryption, RijndaelDecryption>(16), valdata, 4) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<RijndaelEncryption, RijndaelDecryption>(24), valdata, 3) && pass;
+@@ -1131,7 +1131,7 @@
+ {
+       cout << "\nTwofish validation suite running...\n\n";
+-      FileSource valdata("TestData/twofishv.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/twofishv.dat", true, new HexDecoder);
+       bool pass = true;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<TwofishEncryption, TwofishDecryption>(16), valdata, 4) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<TwofishEncryption, TwofishDecryption>(24), valdata, 3) && pass;
+@@ -1143,7 +1143,7 @@
+ {
+       cout << "\nSerpent validation suite running...\n\n";
+-      FileSource valdata("TestData/serpentv.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/serpentv.dat", true, new HexDecoder);
+       bool pass = true;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<SerpentEncryption, SerpentDecryption>(16), valdata, 4) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<SerpentEncryption, SerpentDecryption>(24), valdata, 3) && pass;
+@@ -1189,7 +1189,7 @@
+ {
+       cout << "\n3-WAY validation suite running...\n\n";
+-      FileSource valdata("TestData/3wayval.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/3wayval.dat", true, new HexDecoder);
+       return BlockTransformationTest(FixedRoundsCipherFactory<ThreeWayEncryption, ThreeWayDecryption>(), valdata);
+ }
+@@ -1197,7 +1197,7 @@
+ {
+       cout << "\nGOST validation suite running...\n\n";
+-      FileSource valdata("TestData/gostval.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/gostval.dat", true, new HexDecoder);
+       return BlockTransformationTest(FixedRoundsCipherFactory<GOSTEncryption, GOSTDecryption>(), valdata);
+ }
+@@ -1205,7 +1205,7 @@
+ {
+       cout << "\nSHARK validation suite running...\n\n";
+-      FileSource valdata("TestData/sharkval.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/sharkval.dat", true, new HexDecoder);
+       return BlockTransformationTest(FixedRoundsCipherFactory<SHARKEncryption, SHARKDecryption>(), valdata);
+ }
+@@ -1215,14 +1215,14 @@
+       cout << "\nCAST-128 validation suite running...\n\n";
+-      FileSource val128("TestData/cast128v.dat", true, new HexDecoder);
++      FileSource val128(PACKAGE_DATA_DIR "TestData/cast128v.dat", true, new HexDecoder);
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CAST128Encryption, CAST128Decryption>(16), val128, 1) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CAST128Encryption, CAST128Decryption>(10), val128, 1) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CAST128Encryption, CAST128Decryption>(5), val128, 1) && pass;
+       cout << "\nCAST-256 validation suite running...\n\n";
+-      FileSource val256("TestData/cast256v.dat", true, new HexDecoder);
++      FileSource val256(PACKAGE_DATA_DIR "TestData/cast256v.dat", true, new HexDecoder);
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CAST256Encryption, CAST256Decryption>(16), val256, 1) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CAST256Encryption, CAST256Decryption>(24), val256, 1) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CAST256Encryption, CAST256Decryption>(32), val256, 1) && pass;
+@@ -1234,7 +1234,7 @@
+ {
+       cout << "\nSquare validation suite running...\n\n";
+-      FileSource valdata("TestData/squareva.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/squareva.dat", true, new HexDecoder);
+       return BlockTransformationTest(FixedRoundsCipherFactory<SquareEncryption, SquareDecryption>(), valdata);
+ }
+@@ -1242,7 +1242,7 @@
+ {
+       cout << "\nSKIPJACK validation suite running...\n\n";
+-      FileSource valdata("TestData/skipjack.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/skipjack.dat", true, new HexDecoder);
+       return BlockTransformationTest(FixedRoundsCipherFactory<SKIPJACKEncryption, SKIPJACKDecryption>(), valdata);
+ }
+@@ -1346,7 +1346,7 @@
+       cout << "\nSHACAL-2 validation suite running...\n\n";
+       bool pass = true;
+-      FileSource valdata("TestData/shacal2v.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/shacal2v.dat", true, new HexDecoder);
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<SHACAL2Encryption, SHACAL2Decryption>(16), valdata, 4) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<SHACAL2Encryption, SHACAL2Decryption>(64), valdata, 10) && pass;
+       return pass;
+@@ -1357,7 +1357,7 @@
+       cout << "\nCamellia validation suite running...\n\n";
+       bool pass = true;
+-      FileSource valdata("TestData/camellia.dat", true, new HexDecoder);
++      FileSource valdata(PACKAGE_DATA_DIR "TestData/camellia.dat", true, new HexDecoder);
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CamelliaEncryption, CamelliaDecryption>(16), valdata, 15) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CamelliaEncryption, CamelliaDecryption>(24), valdata, 15) && pass;
+       pass = BlockTransformationTest(FixedRoundsCipherFactory<CamelliaEncryption, CamelliaDecryption>(32), valdata, 15) && pass;
+@@ -1368,19 +1368,19 @@
+ {
+       cout << "\nSalsa validation suite running...\n";
+-      return RunTestDataFile("TestVectors/salsa.txt");
++      return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/salsa.txt");
+ }
+ bool ValidateSosemanuk()
+ {
+       cout << "\nSosemanuk validation suite running...\n";
+-      return RunTestDataFile("TestVectors/sosemanuk.txt");
++      return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/sosemanuk.txt");
+ }
+ bool ValidateVMAC()
+ {
+       cout << "\nVMAC validation suite running...\n";
+-      return RunTestDataFile("TestVectors/vmac.txt");
++      return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/vmac.txt");
+ }
+ bool ValidateCCM()
+Index: libcrypto++/validat2.cpp
+===================================================================
+--- libcrypto++.orig/validat2.cpp      2009-04-07 03:08:36.000000000 +0200
++++ libcrypto++/validat2.cpp   2009-04-07 03:28:02.000000000 +0200
+@@ -268,7 +268,7 @@
+                       "\x69\x94\xac\x04\xf3\x41\xb5\x7d\x05\x20\x2d\x42\x8f\xb2\xa2\x7b"
+                       "\x5c\x77\xdf\xd9\xb1\x5b\xfc\x3d\x55\x93\x53\x50\x34\x10\xc1\xe1";
+-              FileSource keys("TestData/rsa512a.dat", true, new HexDecoder);
++              FileSource keys(PACKAGE_DATA_DIR "TestData/rsa512a.dat", true, new HexDecoder);
+               Weak::RSASSA_PKCS1v15_MD2_Signer rsaPriv(keys);
+               Weak::RSASSA_PKCS1v15_MD2_Verifier rsaPub(rsaPriv);
+@@ -293,7 +293,7 @@
+               cout << "invalid signature verification\n";
+       }
+       {
+-              FileSource keys("TestData/rsa1024.dat", true, new HexDecoder);
++              FileSource keys(PACKAGE_DATA_DIR "TestData/rsa1024.dat", true, new HexDecoder);
+               RSAES_PKCS1v15_Decryptor rsaPriv(keys);
+               RSAES_PKCS1v15_Encryptor rsaPub(rsaPriv);
+@@ -320,8 +320,8 @@
+               bq.Put(oaepSeed, 20);
+               FixedRNG rng(bq);
+-              FileSource privFile("TestData/rsa400pv.dat", true, new HexDecoder);
+-              FileSource pubFile("TestData/rsa400pb.dat", true, new HexDecoder);
++              FileSource privFile(PACKAGE_DATA_DIR "TestData/rsa400pv.dat", true, new HexDecoder);
++              FileSource pubFile(PACKAGE_DATA_DIR "TestData/rsa400pb.dat", true, new HexDecoder);
+               RSAES_OAEP_SHA_Decryptor rsaPriv;
+               rsaPriv.AccessKey().BERDecodePrivateKey(privFile, false, 0);
+               RSAES_OAEP_SHA_Encryptor rsaPub(pubFile);
+@@ -344,7 +344,7 @@
+ {
+       cout << "\nDH validation suite running...\n\n";
+-      FileSource f("TestData/dh1024.dat", true, new HexDecoder());
++      FileSource f(PACKAGE_DATA_DIR "TestData/dh1024.dat", true, new HexDecoder());
+       DH dh(f);
+       return SimpleKeyAgreementValidate(dh);
+ }
+@@ -353,7 +353,7 @@
+ {
+       cout << "\nMQV validation suite running...\n\n";
+-      FileSource f("TestData/mqv1024.dat", true, new HexDecoder());
++      FileSource f(PACKAGE_DATA_DIR "TestData/mqv1024.dat", true, new HexDecoder());
+       MQV mqv(f);
+       return AuthenticatedKeyAgreementValidate(mqv);
+ }
+@@ -362,7 +362,7 @@
+ {
+       cout << "\nLUC-DH validation suite running...\n\n";
+-      FileSource f("TestData/lucd512.dat", true, new HexDecoder());
++      FileSource f(PACKAGE_DATA_DIR "TestData/lucd512.dat", true, new HexDecoder());
+       LUC_DH dh(f);
+       return SimpleKeyAgreementValidate(dh);
+ }
+@@ -371,7 +371,7 @@
+ {
+       cout << "\nXTR-DH validation suite running...\n\n";
+-      FileSource f("TestData/xtrdh171.dat", true, new HexDecoder());
++      FileSource f(PACKAGE_DATA_DIR "TestData/xtrdh171.dat", true, new HexDecoder());
+       XTR_DH dh(f);
+       return SimpleKeyAgreementValidate(dh);
+ }
+@@ -381,7 +381,7 @@
+       cout << "\nElGamal validation suite running...\n\n";
+       bool pass = true;
+       {
+-              FileSource fc("TestData/elgc1024.dat", true, new HexDecoder);
++              FileSource fc(PACKAGE_DATA_DIR "TestData/elgc1024.dat", true, new HexDecoder);
+               ElGamalDecryptor privC(fc);
+               ElGamalEncryptor pubC(privC);
+               privC.AccessKey().Precompute();
+@@ -399,7 +399,7 @@
+       cout << "\nDLIES validation suite running...\n\n";
+       bool pass = true;
+       {
+-              FileSource fc("TestData/dlie1024.dat", true, new HexDecoder);
++              FileSource fc(PACKAGE_DATA_DIR "TestData/dlie1024.dat", true, new HexDecoder);
+               DLIES<>::Decryptor privC(fc);
+               DLIES<>::Encryptor pubC(privC);
+               pass = CryptoSystemValidate(privC, pubC) && pass;
+@@ -422,7 +422,7 @@
+       cout << "\nNR validation suite running...\n\n";
+       bool pass = true;
+       {
+-              FileSource f("TestData/nr2048.dat", true, new HexDecoder);
++              FileSource f(PACKAGE_DATA_DIR "TestData/nr2048.dat", true, new HexDecoder);
+               NR<SHA>::Signer privS(f);
+               privS.AccessKey().Precompute();
+               NR<SHA>::Verifier pubS(privS);
+@@ -445,7 +445,7 @@
+       bool pass = true, fail;
+       {
+-      FileSource fs("TestData/dsa512.dat", true, new HexDecoder());
++      FileSource fs(PACKAGE_DATA_DIR "TestData/dsa512.dat", true, new HexDecoder());
+       GDSA<SHA>::Signer priv(fs);
+       priv.AccessKey().Precompute(16);
+       GDSA<SHA>::Verifier pub(priv);
+@@ -487,10 +487,10 @@
+       fail = pub.VerifyMessage((byte *)"xyz", 3, sig, sizeof(sig));
+       pass = pass && !fail;
+       }
+-      FileSource fs1("TestData/dsa1024.dat", true, new HexDecoder());
++      FileSource fs1(PACKAGE_DATA_DIR "TestData/dsa1024.dat", true, new HexDecoder());
+       DSA::Signer priv(fs1);
+       DSA::Verifier pub(priv);
+-      FileSource fs2("TestData/dsa1024b.dat", true, new HexDecoder());
++      FileSource fs2(PACKAGE_DATA_DIR "TestData/dsa1024b.dat", true, new HexDecoder());
+       DSA::Verifier pub1(fs2);
+       assert(pub.GetKey() == pub1.GetKey());
+       pass = SignatureValidate(priv, pub, thorough) && pass;
+@@ -503,7 +503,7 @@
+       bool pass=true;
+       {
+-              FileSource f("TestData/luc1024.dat", true, new HexDecoder);
++              FileSource f(PACKAGE_DATA_DIR "TestData/luc1024.dat", true, new HexDecoder);
+               LUCSSA_PKCS1v15_SHA_Signer priv(f);
+               LUCSSA_PKCS1v15_SHA_Verifier pub(priv);
+               pass = SignatureValidate(priv, pub) && pass;
+@@ -520,14 +520,14 @@
+ {
+       cout << "\nLUC-HMP validation suite running...\n\n";
+-      FileSource f("TestData/lucs512.dat", true, new HexDecoder);
++      FileSource f(PACKAGE_DATA_DIR "TestData/lucs512.dat", true, new HexDecoder);
+       LUC_HMP<SHA>::Signer privS(f);
+       LUC_HMP<SHA>::Verifier pubS(privS);
+       bool pass = SignatureValidate(privS, pubS);
+       cout << "\nLUC-IES validation suite running...\n\n";
+-      FileSource fc("TestData/lucc512.dat", true, new HexDecoder);
++      FileSource fc(PACKAGE_DATA_DIR "TestData/lucc512.dat", true, new HexDecoder);
+       LUC_IES<>::Decryptor privC(fc);
+       LUC_IES<>::Encryptor pubC(privC);
+       pass = CryptoSystemValidate(privC, pubC) && pass;
+@@ -541,7 +541,7 @@
+       bool pass=true;
+       {
+-              FileSource f("TestData/rabi1024.dat", true, new HexDecoder);
++              FileSource f(PACKAGE_DATA_DIR "TestData/rabi1024.dat", true, new HexDecoder);
+               RabinSS<PSSR, SHA>::Signer priv(f);
+               RabinSS<PSSR, SHA>::Verifier pub(priv);
+               pass = SignatureValidate(priv, pub) && pass;
+@@ -558,7 +558,7 @@
+ {
+       cout << "\nRW validation suite running...\n\n";
+-      FileSource f("TestData/rw1024.dat", true, new HexDecoder);
++      FileSource f(PACKAGE_DATA_DIR "TestData/rw1024.dat", true, new HexDecoder);
+       RWSS<PSSR, SHA>::Signer priv(f);
+       RWSS<PSSR, SHA>::Verifier pub(priv);
+@@ -570,7 +570,7 @@
+ {
+       cout << "\nBlumGoldwasser validation suite running...\n\n";
+-      FileSource f("TestData/blum512.dat", true, new HexDecoder);
++      FileSource f(PACKAGE_DATA_DIR "TestData/blum512.dat", true, new HexDecoder);
+       BlumGoldwasserPrivateKey priv(f);
+       BlumGoldwasserPublicKey pub(priv);
+@@ -740,7 +740,7 @@
+               "\x74\x02\x37\x0E\xED\x0A\x06\xAD\xF4\x15\x65\xB8\xE1\xD1\x45\xAE\x39\x19\xB4\xFF\x5D\xF1\x45\x7B\xE0\xFE\x72\xED\x11\x92\x8F\x61\x41\x4F\x02\x00\xF2\x76\x6F\x7C"
+               "\x79\xA2\xE5\x52\x20\x5D\x97\x5E\xFE\x39\xAE\x21\x10\xFB\x35\xF4\x80\x81\x41\x13\xDD\xE8\x5F\xCA\x1E\x4F\xF8\x9B\xB2\x68\xFB\x28";
+-      FileSource keys("TestData/esig1536.dat", true, new HexDecoder);
++      FileSource keys(PACKAGE_DATA_DIR "TestData/esig1536.dat", true, new HexDecoder);
+       ESIGN<SHA>::Signer signer(keys);
+       ESIGN<SHA>::Verifier verifier(signer);
+Index: libcrypto++/validat3.cpp
+===================================================================
+--- libcrypto++.orig/validat3.cpp      2009-04-07 03:08:36.000000000 +0200
++++ libcrypto++/validat3.cpp   2009-04-07 03:29:42.000000000 +0200
+@@ -365,14 +365,14 @@
+ {
+       cout << "\nPanama validation suite running...\n";
+-      return RunTestDataFile("TestVectors/panama.txt");
++      return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/panama.txt");
+ }
+ bool ValidateWhirlpool()
+ {
+       cout << "\nWhirlpool Hash Function validation suite running...\n";
+-      return RunTestDataFile("TestVectors/whrlpool.txt");
++      return RunTestDataFile(PACKAGE_DATA_DIR "TestVectors/whrlpool.txt");
+ }
+ #ifdef CRYPTOPP_REMOVED
diff --git a/libs/libcrypto++/patches/003-autoconf_files.patch b/libs/libcrypto++/patches/003-autoconf_files.patch
new file mode 100644 (file)
index 0000000..16ea3ff
--- /dev/null
@@ -0,0 +1,822 @@
+--- /dev/null  2009-09-20 12:09:29.503935207 +0200
++++ debian/configure.ac        2009-09-20 18:51:50.000000000 +0200
+@@ -0,0 +1,43 @@
++# -*- autoconf -*-
++# Process this file with autoconf to produce a configure script.
++# Written by Jens Peter Secher <jps@debian.org>.
++
++AC_INIT([Crypto++], [5.6.0], [libcrypto++@bugs.debian.org])
++AC_CONFIG_SRCDIR([cryptlib.h])
++AC_CONFIG_HEADERS([cryptopp_config.h])
++AC_CONFIG_HEADERS([config.h])
++AM_INIT_AUTOMAKE([foreign])
++AM_MAINTAINER_MODE
++
++# Checks for programs.
++AC_PROG_CXX
++AC_PROG_CC
++AC_PROG_LN_S
++AC_PROG_LIBTOOL
++
++# Checks for header files.
++AC_HEADER_STDC
++AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
++
++# Checks for typedefs, structures, and compiler characteristics.
++AC_HEADER_STDBOOL
++AC_C_CONST
++AC_C_INLINE
++AC_TYPE_SIZE_T
++AC_HEADER_TIME
++AC_CHECK_TYPES([ptrdiff_t])
++AC_C_BIGENDIAN(
++      AC_DEFINE(IS_BIG_ENDIAN, [], [Big-endian architecture]),
++      AC_DEFINE(IS_LITTLE_ENDIAN, [], [Little-endian architecture]),
++      AC_MSG_ERROR([Can't tell endianess of platform]))
++
++# Checks for library functions.
++AC_PROG_GCC_TRADITIONAL
++AC_FUNC_MALLOC
++AC_FUNC_MEMCMP
++AC_FUNC_SELECT_ARGTYPES
++AC_TYPE_SIGNAL
++AC_CHECK_FUNCS([gethostbyname gettimeofday memmove memset pow select socket])
++
++AC_CONFIG_FILES([Makefile libcrypto++.pc])
++AC_OUTPUT
+--- /dev/null  2009-09-20 12:09:29.503935207 +0200
++++ debian/Makefile.am 2009-09-20 18:51:50.000000000 +0200
+@@ -0,0 +1,303 @@
++## Process this file with automake to produce Makefile.in
++# Written by Jens Peter Secher <jps@debian.org>.
++
++# Build two versions of cryptest, one that uses data files from the
++# current working directory, and one that uses data files from
++# /usr/share/crypto++.  The former is for running the test suite at
++# build time, the latter is included in the package.
++
++# To test against newest GCC, uncomment the following two lines.
++#CXX = /usr/lib/gcc-snapshot/bin/g++
++#CXXCPP = /usr/lib/gcc-snapshot/bin/g++
++
++bin_PROGRAMS = cryptest cryptestcwd
++cryptest_CXXFLAGS = -DPACKAGE_DATA_DIR='"/usr/share/crypto++/"'
++cryptest_SOURCES = \
++      bench.cpp \
++      bench2.cpp \
++      datatest.cpp \
++      dlltest.cpp \
++      fipsalgt.cpp \
++      regtest.cpp \
++      test.cpp \
++      validat1.cpp \
++      validat2.cpp \
++      validat3.cpp
++cryptest_LDADD = libcrypto++.la
++cryptestcwd_CXXFLAGS = -DPACKAGE_DATA_DIR='""'
++cryptestcwd_SOURCES = \
++      bench.cpp \
++      bench2.cpp \
++      datatest.cpp \
++      dlltest.cpp \
++      fipsalgt.cpp \
++      regtest.cpp \
++      test.cpp \
++      validat1.cpp \
++      validat2.cpp \
++      validat3.cpp
++cryptestcwd_LDADD = libcrypto++.la
++
++lib_LTLIBRARIES = libcrypto++.la
++libcrypto___la_LDFLAGS = -version-info 8:0:0
++libcrypto___la_SOURCES = \
++      3way.cpp \
++      adler32.cpp \
++      algebra.cpp \
++      algparam.cpp \
++      arc4.cpp \
++      asn.cpp \
++      authenc.cpp \
++      base32.cpp \
++      base64.cpp \
++      basecode.cpp \
++      bfinit.cpp \
++      blowfish.cpp \
++      blumshub.cpp \
++      camellia.cpp \
++      cast.cpp \
++      casts.cpp \
++      cbcmac.cpp \
++      ccm.cpp \
++      channels.cpp \
++      cmac.cpp \
++      cpu.cpp \
++      crc.cpp \
++      cryptlib.cpp \
++      default.cpp \
++      des.cpp \
++      dessp.cpp \
++      dh2.cpp \
++      dh.cpp \
++      dll.cpp \
++      dsa.cpp \
++      eax.cpp \
++      ec2n.cpp \
++      eccrypto.cpp \
++      ecp.cpp \
++      elgamal.cpp \
++      emsa2.cpp \
++      eprecomp.cpp \
++      esign.cpp \
++      files.cpp \
++      filters.cpp \
++      fips140.cpp \
++      fipstest.cpp \
++      gcm.cpp \
++      gf2_32.cpp \
++      gf256.cpp \
++      gf2n.cpp \
++      gfpcrypt.cpp \
++      gost.cpp \
++      gzip.cpp \
++      hex.cpp \
++      hmac.cpp \
++      hrtimer.cpp \
++      ida.cpp \
++      idea.cpp \
++      integer.cpp \
++      iterhash.cpp \
++      luc.cpp \
++      mars.cpp \
++      marss.cpp \
++      md2.cpp \
++      md4.cpp \
++      md5.cpp \
++      misc.cpp \
++      modes.cpp \
++      mqueue.cpp \
++      mqv.cpp \
++      nbtheory.cpp \
++      network.cpp \
++      oaep.cpp \
++      osrng.cpp \
++      panama.cpp \
++      pch.cpp \
++      pkcspad.cpp \
++      polynomi.cpp \
++      pssr.cpp \
++      pubkey.cpp \
++      queue.cpp \
++      rabin.cpp \
++      randpool.cpp \
++      rc2.cpp \
++      rc5.cpp \
++      rc6.cpp \
++      rdtables.cpp \
++      rijndael.cpp \
++      ripemd.cpp \
++      rng.cpp \
++      rsa.cpp \
++      rw.cpp \
++      safer.cpp \
++      salsa.cpp \
++      seal.cpp \
++      seed.cpp \
++      serpent.cpp \
++      shacal2.cpp \
++      sha.cpp \
++      sharkbox.cpp \
++      shark.cpp \
++      simple.cpp \
++      skipjack.cpp \
++      socketft.cpp \
++      sosemanuk.cpp \
++      square.cpp \
++      squaretb.cpp \
++      strciphr.cpp \
++      tea.cpp \
++      tftables.cpp \
++      tiger.cpp \
++      tigertab.cpp \
++      trdlocal.cpp \
++      ttmac.cpp \
++      twofish.cpp \
++      vmac.cpp \
++      wait.cpp \
++      wake.cpp \
++      whrlpool.cpp \
++      winpipes.cpp \
++      xtr.cpp \
++      xtrcrypt.cpp \
++      zdeflate.cpp \
++      zinflate.cpp \
++      zlib.cpp
++
++pkginclude_HEADERS = \
++      3way.h \
++      adler32.h \
++      aes.h \
++      algebra.h \
++      algparam.h \
++      arc4.h \
++      argnames.h \
++      asn.h \
++      authenc.h \
++      base32.h \
++      base64.h \
++      basecode.h \
++      bench.h \
++      blowfish.h \
++      blumshub.h \
++      camellia.h \
++      cast.h \
++      cbcmac.h \
++      ccm.h \
++      channels.h \
++      cmac.h \
++      config.h \
++      cpu.h \
++      crc.h \
++      cryptlib.h \
++      default.h \
++      des.h \
++      dh2.h \
++      dh.h \
++      dll.h \
++      dmac.h \
++      dsa.h \
++      eax.h \
++      ec2n.h \
++      eccrypto.h \
++      ecp.h \
++      elgamal.h \
++      emsa2.h \
++      eprecomp.h \
++      esign.h \
++      factory.h \
++      files.h \
++      filters.h \
++      fips140.h \
++      fltrimpl.h \
++      gcm.h \
++      gf2_32.h \
++      gf256.h \
++      gf2n.h \
++      gfpcrypt.h \
++      gost.h \
++      gzip.h \
++      hex.h \
++      hmac.h \
++      hrtimer.h \
++      ida.h \
++      idea.h \
++      integer.h \
++      iterhash.h \
++      lubyrack.h \
++      luc.h \
++      mars.h \
++      md2.h \
++      md4.h \
++      md5.h \
++      mdc.h \
++      misc.h \
++      modarith.h \
++      modes.h  \
++      modexppc.h \
++      mqueue.h \
++      mqv.h \
++      nbtheory.h \
++      network.h \
++      nr.h \
++      oaep.h \
++      oids.h \
++      osrng.h \
++      panama.h \
++      pch.h \
++      pkcspad.h \
++      polynomi.h \
++      pssr.h \
++      pubkey.h \
++      pwdbased.h \
++      queue.h \
++      rabin.h \
++      randpool.h \
++      rc2.h \
++      rc5.h \
++      rc6.h \
++      rijndael.h \
++      ripemd.h \
++      rng.h \
++      rsa.h \
++      rw.h \
++      safer.h \
++      salsa.h \
++      seal.h \
++      secblock.h \
++      seckey.h \
++      seed.h \
++      serpent.h \
++      serpentp.h \
++      shacal2.h \
++      sha.h \
++      shark.h \
++      simple.h \
++      skipjack.h \
++      smartptr.h \
++      socketft.h \
++      sosemanuk.h \
++      square.h \
++      stdcpp.h \
++      strciphr.h \
++      tea.h \
++      tiger.h \
++      trdlocal.h \
++      trunhash.h \
++      ttmac.h \
++      twofish.h \
++      vmac.h \
++      wait.h \
++      wake.h \
++      whrlpool.h \
++      winpipes.h \
++      words.h \
++      xtr.h \
++      xtrcrypt.h \
++      zdeflate.h \
++      zinflate.h \
++      zlib.h
++
++htmldir = $(datadir)/html
++
++html: $(libcrypto___la_SOURCES)
++      doxygen
+--- /dev/null  2009-09-20 12:09:29.503935207 +0200
++++ debian/config.h.in 2009-09-20 18:51:50.000000000 +0200
+@@ -0,0 +1,452 @@
++// Debian note: This is a copy of the original config.h file except for the two
++// endianness undefs below; they are substituted by the autoconf process
++// according to the build architecture.
++
++#ifndef CRYPTOPP_CONFIG_H
++#define CRYPTOPP_CONFIG_H
++
++// ***************** Important Settings ********************
++
++// Endianness
++#undef IS_BIG_ENDIAN
++#undef IS_LITTLE_ENDIAN
++
++// define this if you want to disable all OS-dependent features,
++// such as sockets and OS-provided random number generators
++// #define NO_OS_DEPENDENCE
++
++// Define this to use features provided by Microsoft's CryptoAPI.
++// Currently the only feature used is random number generation.
++// This macro will be ignored if NO_OS_DEPENDENCE is defined.
++#define USE_MS_CRYPTOAPI
++
++// Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
++#ifndef DSA_1024_BIT_MODULUS_ONLY
++#     define DSA_1024_BIT_MODULUS_ONLY 1
++#endif
++
++// ***************** Less Important Settings ***************
++
++// define this to retain (as much as possible) old deprecated function and class names
++// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
++
++#define GZIP_OS_CODE 0
++
++// Try this if your CPU has 256K internal cache or a slow multiply instruction
++// and you want a (possibly) faster IDEA implementation using log tables
++// #define IDEA_LARGECACHE
++
++// Define this if, for the linear congruential RNG, you want to use
++// the original constants as specified in S.K. Park and K.W. Miller's
++// CACM paper.
++// #define LCRNG_ORIGINAL_NUMBERS
++
++// choose which style of sockets to wrap (mostly useful for cygwin which has both)
++#define PREFER_BERKELEY_STYLE_SOCKETS
++// #define PREFER_WINDOWS_STYLE_SOCKETS
++
++// set the name of Rijndael cipher, was "Rijndael" before version 5.3
++#define CRYPTOPP_RIJNDAEL_NAME "AES"
++
++// ***************** Important Settings Again ********************
++// But the defaults should be ok.
++
++// namespace support is now required
++#ifdef NO_NAMESPACE
++#     error namespace support is now required
++#endif
++
++// Define this to workaround a Microsoft CryptoAPI bug where
++// each call to CryptAcquireContext causes a 100 KB memory leak.
++// Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
++#define WORKAROUND_MS_BUG_Q258000
++
++#ifdef CRYPTOPP_DOXYGEN_PROCESSING
++// Avoid putting "CryptoPP::" in front of everything in Doxygen output
++#     define CryptoPP
++#     define NAMESPACE_BEGIN(x)
++#     define NAMESPACE_END
++// Get Doxygen to generate better documentation for these typedefs
++#     define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
++#else
++#     define NAMESPACE_BEGIN(x) namespace x {
++#     define NAMESPACE_END }
++#     define DOCUMENTED_TYPEDEF(x, y) typedef x y;
++#endif
++#define ANONYMOUS_NAMESPACE_BEGIN namespace {
++#define USING_NAMESPACE(x) using namespace x;
++#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
++#define DOCUMENTED_NAMESPACE_END }
++
++// What is the type of the third parameter to bind?
++// For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
++// Unfortunately there is no way to tell whether or not socklen_t is defined.
++// To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
++#ifndef TYPE_OF_SOCKLEN_T
++#     if defined(_WIN32) || defined(__CYGWIN__)
++#             define TYPE_OF_SOCKLEN_T int
++#     else
++#             define TYPE_OF_SOCKLEN_T ::socklen_t
++#     endif
++#endif
++
++#if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
++#     define __USE_W32_SOCKETS
++#endif
++
++typedef unsigned char byte;           // put in global namespace to avoid ambiguity with other byte typedefs
++
++NAMESPACE_BEGIN(CryptoPP)
++
++typedef unsigned short word16;
++typedef unsigned int word32;
++
++#if defined(_MSC_VER) || defined(__BORLANDC__)
++      typedef unsigned __int64 word64;
++      #define W64LIT(x) x##ui64
++#else
++      typedef unsigned long long word64;
++      #define W64LIT(x) x##ULL
++#endif
++
++// define large word type, used for file offsets and such
++typedef word64 lword;
++const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
++
++#ifdef __GNUC__
++      #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
++#endif
++
++// define hword, word, and dword. these are used for multiprecision integer arithmetic
++// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
++#if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
++      typedef word32 hword;
++      typedef word64 word;
++#else
++      #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
++      #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
++              #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
++                      // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
++                      // mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
++                      typedef word32 hword;
++                      typedef word64 word;
++                      typedef __uint128_t dword;
++                      typedef __uint128_t word128;
++                      #define CRYPTOPP_WORD128_AVAILABLE
++              #else
++                      // if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results
++                      typedef word16 hword;
++                      typedef word32 word;
++                      typedef word64 dword;
++              #endif
++      #else
++              // being here means the native register size is probably 32 bits or less
++              #define CRYPTOPP_BOOL_SLOW_WORD64 1
++              typedef word16 hword;
++              typedef word32 word;
++              typedef word64 dword;
++      #endif
++#endif
++#ifndef CRYPTOPP_BOOL_SLOW_WORD64
++      #define CRYPTOPP_BOOL_SLOW_WORD64 0
++#endif
++
++const unsigned int WORD_SIZE = sizeof(word);
++const unsigned int WORD_BITS = WORD_SIZE * 8;
++
++NAMESPACE_END
++
++#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
++      // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
++      #if defined(_M_X64) || defined(__x86_64__)
++              #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
++      #else
++              // L1 cache line size is 32 on Pentium III and earlier
++              #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
++      #endif
++#endif
++
++#if defined(_MSC_VER)
++      #if _MSC_VER == 1200
++              #include <malloc.h>
++      #endif
++      #if _MSC_VER > 1200 || defined(_mm_free)
++              #define CRYPTOPP_MSVC6PP_OR_LATER               // VC 6 processor pack or later
++      #else
++              #define CRYPTOPP_MSVC6_NO_PP                    // VC 6 without processor pack
++      #endif
++#endif
++
++#ifndef CRYPTOPP_ALIGN_DATA
++      #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
++              #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
++      #elif defined(__GNUC__)
++              #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
++      #else
++              #define CRYPTOPP_ALIGN_DATA(x)
++      #endif
++#endif
++
++#ifndef CRYPTOPP_SECTION_ALIGN16
++      #if defined(__GNUC__) && !defined(__APPLE__)
++              // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
++              #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
++      #else
++              #define CRYPTOPP_SECTION_ALIGN16
++      #endif
++#endif
++
++#if defined(_MSC_VER) || defined(__fastcall)
++      #define CRYPTOPP_FASTCALL __fastcall
++#else
++      #define CRYPTOPP_FASTCALL
++#endif
++
++// VC60 workaround: it doesn't allow typename in some places
++#if defined(_MSC_VER) && (_MSC_VER < 1300)
++#define CPP_TYPENAME
++#else
++#define CPP_TYPENAME typename
++#endif
++
++// VC60 workaround: can't cast unsigned __int64 to float or double
++#if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
++#define CRYPTOPP_VC6_INT64 (__int64)
++#else
++#define CRYPTOPP_VC6_INT64
++#endif
++
++#ifdef _MSC_VER
++#define CRYPTOPP_NO_VTABLE __declspec(novtable)
++#else
++#define CRYPTOPP_NO_VTABLE
++#endif
++
++#ifdef _MSC_VER
++      // 4231: nonstandard extension used : 'extern' before template explicit instantiation
++      // 4250: dominance
++      // 4251: member needs to have dll-interface
++      // 4275: base needs to have dll-interface
++      // 4660: explicitly instantiating a class that's already implicitly instantiated
++      // 4661: no suitable definition provided for explicit template instantiation request
++      // 4786: identifer was truncated in debug information
++      // 4355: 'this' : used in base member initializer list
++      // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
++#     pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910)
++#endif
++
++#ifdef __BORLANDC__
++// 8037: non-const function called for const object. needed to work around BCB2006 bug
++#     pragma warn -8037
++#endif
++
++#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
++#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
++#endif
++
++#ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
++#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
++#endif
++
++#ifdef CRYPTOPP_DISABLE_X86ASM                // for backwards compatibility: this macro had both meanings
++#define CRYPTOPP_DISABLE_ASM
++#define CRYPTOPP_DISABLE_SSE2
++#endif
++
++#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
++      #define CRYPTOPP_X86_ASM_AVAILABLE
++
++      #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300)
++              #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
++      #else
++              #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
++      #endif
++
++      // SSSE3 was actually introduced in GNU as 2.17, which was released 6/23/2006, but we can't tell what version of binutils is installed.
++      // GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version.
++      #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102)
++              #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
++      #else
++              #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
++      #endif
++#endif
++
++#if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
++      #define CRYPTOPP_X64_MASM_AVAILABLE
++#endif
++
++#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
++      #define CRYPTOPP_X64_ASM_AVAILABLE
++#endif
++
++#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
++      #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
++#else
++      #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
++#endif
++
++#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
++      #define CRYPTOPP_BOOL_ALIGN16_ENABLED 1
++#else
++      #define CRYPTOPP_BOOL_ALIGN16_ENABLED 0
++#endif
++
++// how to allocate 16-byte aligned memory (for SSE2)
++#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
++      #define CRYPTOPP_MM_MALLOC_AVAILABLE
++#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
++      #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
++#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
++      #define CRYPTOPP_MEMALIGN_AVAILABLE
++#else
++      #define CRYPTOPP_NO_ALIGNED_ALLOC
++#endif
++
++// how to disable inlining
++#if defined(_MSC_VER) && _MSC_VER >= 1300
++#     define CRYPTOPP_NOINLINE_DOTDOTDOT
++#     define CRYPTOPP_NOINLINE __declspec(noinline)
++#elif defined(__GNUC__)
++#     define CRYPTOPP_NOINLINE_DOTDOTDOT
++#     define CRYPTOPP_NOINLINE __attribute__((noinline))
++#else
++#     define CRYPTOPP_NOINLINE_DOTDOTDOT ...
++#     define CRYPTOPP_NOINLINE 
++#endif
++
++// how to declare class constants
++#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER)
++#     define CRYPTOPP_CONSTANT(x) enum {x};
++#else
++#     define CRYPTOPP_CONSTANT(x) static const int x;
++#endif
++
++#if defined(_M_X64) || defined(__x86_64__)
++      #define CRYPTOPP_BOOL_X64 1
++#else
++      #define CRYPTOPP_BOOL_X64 0
++#endif
++
++// see http://predef.sourceforge.net/prearch.html
++#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)
++      #define CRYPTOPP_BOOL_X86 1
++#else
++      #define CRYPTOPP_BOOL_X86 0
++#endif
++
++#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__)
++      #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
++#endif
++
++#define CRYPTOPP_VERSION 560
++
++// ***************** determine availability of OS features ********************
++
++#ifndef NO_OS_DEPENDENCE
++
++#if defined(_WIN32) || defined(__CYGWIN__)
++#define CRYPTOPP_WIN32_AVAILABLE
++#endif
++
++#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
++#define CRYPTOPP_UNIX_AVAILABLE
++#endif
++
++#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
++#     define HIGHRES_TIMER_AVAILABLE
++#endif
++
++#ifdef CRYPTOPP_UNIX_AVAILABLE
++#     define HAS_BERKELEY_STYLE_SOCKETS
++#endif
++
++#ifdef CRYPTOPP_WIN32_AVAILABLE
++#     define HAS_WINDOWS_STYLE_SOCKETS
++#endif
++
++#if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
++#     define SOCKETS_AVAILABLE
++#endif
++
++#if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
++#     define USE_WINDOWS_STYLE_SOCKETS
++#else
++#     define USE_BERKELEY_STYLE_SOCKETS
++#endif
++
++#if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
++#     define WINDOWS_PIPES_AVAILABLE
++#endif
++
++#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
++#     define NONBLOCKING_RNG_AVAILABLE
++#     define OS_RNG_AVAILABLE
++#endif
++
++#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
++#     define NONBLOCKING_RNG_AVAILABLE
++#     define BLOCKING_RNG_AVAILABLE
++#     define OS_RNG_AVAILABLE
++#     define HAS_PTHREADS
++#     define THREADS_AVAILABLE
++#endif
++
++#ifdef CRYPTOPP_WIN32_AVAILABLE
++#     define HAS_WINTHREADS
++#     define THREADS_AVAILABLE
++#endif
++
++#endif        // NO_OS_DEPENDENCE
++
++// ***************** DLL related ********************
++
++#ifdef CRYPTOPP_WIN32_AVAILABLE
++
++#ifdef CRYPTOPP_EXPORTS
++#define CRYPTOPP_IS_DLL
++#define CRYPTOPP_DLL __declspec(dllexport)
++#elif defined(CRYPTOPP_IMPORTS)
++#define CRYPTOPP_IS_DLL
++#define CRYPTOPP_DLL __declspec(dllimport)
++#else
++#define CRYPTOPP_DLL
++#endif
++
++#define CRYPTOPP_API __cdecl
++
++#else // CRYPTOPP_WIN32_AVAILABLE
++
++#define CRYPTOPP_DLL
++#define CRYPTOPP_API
++
++#endif        // CRYPTOPP_WIN32_AVAILABLE
++
++#if defined(__MWERKS__)
++#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
++#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
++#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
++#else
++#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
++#endif
++
++#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
++#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
++#else
++#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
++#endif
++
++#if defined(__MWERKS__)
++#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
++#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
++#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
++#else
++#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
++#endif
++
++#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
++#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
++#else
++#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
++#endif
++
++#endif
+--- /dev/null  2009-09-20 12:09:29.503935207 +0200
++++ debian/libcrypto++.pc.in   2009-09-20 18:51:50.000000000 +0200
+@@ -0,0 +1,12 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: libcrypto++
++Description: General purpose cryptographic shared library
++URL: http://www.cryptopp.com
++Version: @VERSION@
++Requires:
++Libs: -lcrypto++
++Cflags:
diff --git a/libs/libcrypto++/patches/004-gcc4.7.0.patch b/libs/libcrypto++/patches/004-gcc4.7.0.patch
new file mode 100644 (file)
index 0000000..a2ef66a
--- /dev/null
@@ -0,0 +1,102 @@
+diff -rupN libcrypto++-5.6.0.orig/algebra.cpp libcrypto++-5.6.0/algebra.cpp\r
+--- libcrypto++-5.6.0.orig/algebra.cpp Sun Mar  1 20:44:04 2009\r
++++ libcrypto++-5.6.0/algebra.cpp      Fri Oct 12 20:18:44 2012\r
+@@ -58,7 +58,7 @@ template <class T> const T& AbstractEucl\r
+       Element g[3]={b, a};\r
+       unsigned int i0=0, i1=1, i2=2;\r
\r
+-      while (!Equal(g[i1], this->Identity()))\r
++      while (!this->Equal(g[i1], this->Identity()))\r
+       {\r
+               g[i2] = Mod(g[i0], g[i1]);\r
+               unsigned int t = i0; i0 = i1; i1 = i2; i2 = t;\r
+diff -rupN libcrypto++-5.6.0.orig/eccrypto.cpp libcrypto++-5.6.0/eccrypto.cpp\r
+--- libcrypto++-5.6.0.orig/eccrypto.cpp        Sun Mar 15 03:48:02 2009\r
++++ libcrypto++-5.6.0/eccrypto.cpp     Fri Oct 12 20:17:08 2012\r
+@@ -435,7 +435,7 @@ template <class EC> void DL_GroupParamet\r
+       StringSource ssG(param.g, true, new HexDecoder);\r
+       Element G;\r
+       bool result = GetCurve().DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable());\r
+-      SetSubgroupGenerator(G);\r
++      this->SetSubgroupGenerator(G);\r
+       assert(result);\r
\r
+       StringSource ssN(param.n, true, new HexDecoder);\r
+@@ -591,7 +591,7 @@ bool DL_GroupParameters_EC<EC>::Validate\r
+       if (level >= 2 && pass)\r
+       {\r
+               const Integer &q = GetSubgroupOrder();\r
+-              Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q);\r
++              Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : this->ExponentiateElement(g, q);\r
+               pass = pass && IsIdentity(gq);\r
+       }\r
+       return pass;\r
+@@ -629,7 +629,7 @@ void DL_PublicKey_EC<EC>::BERDecodePubli\r
+       typename EC::Point P;\r
+       if (!this->GetGroupParameters().GetCurve().DecodePoint(P, bt, size))\r
+               BERDecodeError();\r
+-      SetPublicElement(P);\r
++      this->SetPublicElement(P);\r
+ }\r
\r
+ template <class EC>\r
+diff -rupN libcrypto++-5.6.0.orig/eccrypto.h libcrypto++-5.6.0/eccrypto.h\r
+--- libcrypto++-5.6.0.orig/eccrypto.h  Sun Mar  1 20:44:02 2009\r
++++ libcrypto++-5.6.0/eccrypto.h       Fri Oct 12 20:17:30 2012\r
+@@ -43,7 +43,7 @@ public:\r
+       void Initialize(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero())\r
+       {\r
+               this->m_groupPrecomputation.SetCurve(ec);\r
+-              SetSubgroupGenerator(G);\r
++              this->SetSubgroupGenerator(G);\r
+               m_n = n;\r
+               m_k = k;\r
+       }\r
+@@ -145,9 +145,9 @@ public:\r
+       typedef typename EC::Point Element;\r
\r
+       void Initialize(const DL_GroupParameters_EC<EC> &params, const Element &Q)\r
+-              {this->AccessGroupParameters() = params; SetPublicElement(Q);}\r
++              {this->AccessGroupParameters() = params; this->SetPublicElement(Q);}\r
+       void Initialize(const EC &ec, const Element &G, const Integer &n, const Element &Q)\r
+-              {this->AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);}\r
++              {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPublicElement(Q);}\r
\r
+       // X509PublicKey\r
+       void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size);\r
+@@ -166,9 +166,9 @@ public:\r
+       void Initialize(const EC &ec, const Element &G, const Integer &n, const Integer &x)\r
+               {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPrivateExponent(x);}\r
+       void Initialize(RandomNumberGenerator &rng, const DL_GroupParameters_EC<EC> &params)\r
+-              {GenerateRandom(rng, params);}\r
++              {this->GenerateRandom(rng, params);}\r
+       void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n)\r
+-              {GenerateRandom(rng, DL_GroupParameters_EC<EC>(ec, G, n));}\r
++              {this->GenerateRandom(rng, DL_GroupParameters_EC<EC>(ec, G, n));}\r
\r
+       // PKCS8PrivateKey\r
+       void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size);\r
+diff -rupN libcrypto++-5.6.0.orig/panama.cpp libcrypto++-5.6.0/panama.cpp\r
+--- libcrypto++-5.6.0.orig/panama.cpp  Sun Mar  1 20:44:00 2009\r
++++ libcrypto++-5.6.0/panama.cpp       Fri Oct 12 20:19:27 2012\r
+@@ -420,7 +420,7 @@ void PanamaHash<B>::TruncatedFinal(byte \r
+ {\r
+       this->ThrowIfInvalidTruncatedSize(size);\r
\r
+-      PadLastBlock(this->BLOCKSIZE, 0x01);\r
++      this->PadLastBlock(this->BLOCKSIZE, 0x01);\r
+       \r
+       HashEndianCorrectedBlock(this->m_data);\r
\r
+diff -rupN libcrypto++-5.6.0.orig/secblock.h libcrypto++-5.6.0/secblock.h\r
+--- libcrypto++-5.6.0.orig/secblock.h  Sun Mar 15 03:48:02 2009\r
++++ libcrypto++-5.6.0/secblock.h       Fri Oct 12 20:13:31 2012\r
+@@ -94,7 +94,7 @@ public:\r
\r
+       pointer allocate(size_type n, const void * = NULL)\r
+       {\r
+-              CheckSize(n);\r
++              this->CheckSize(n);\r
+               if (n == 0)\r
+                       return NULL;\r
\r
diff --git a/libs/libcunit/Makefile b/libs/libcunit/Makefile
new file mode 100644 (file)
index 0000000..76fd50a
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 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:=libcunit
+PKG_VERSION:=2.1-0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=CUnit-$(PKG_VERSION)-src.tar.gz
+PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/cunit/CUnit/$(PKG_VERSION)
+PKG_MD5SUM:=f4f53d2c41e9315a91b4f14a1706fe4f
+PKG_BUILD_DIR:=$(BUILD_DIR)/CUnit-$(PKG_VERSION)
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libcunit
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Unit testing framework for C
+  URL:=http://cunit.sourceforge.net/
+endef
+
+define Package/libcunit/description
+  CUnit, lightweight unit testing for C
+  CUnit is a lightweight system for writing, administering, and running unit
+  tests in C.  It provides C programmers a basic testing functionality with a
+  flexible variety of user interfaces.
+endef
+
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               , \
+               BUILD_CC="$(TARGET_CC)" \
+               HOSTCC="$(HOSTCC)" \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CCOPT="$(TARGET_CFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+
+define Build/InstallDev
+       mkdir -p $(1)/usr/include/CUnit
+       $(CP)   $(PKG_INSTALL_DIR)/usr/include/CUnit/* \
+               $(1)/usr/include/CUnit
+
+       mkdir -p $(1)/usr/lib
+       $(CP)   $(PKG_INSTALL_DIR)/usr/lib/libcunit.* \
+               $(1)/usr/lib
+endef
+
+
+define Package/libcunit/install
+       $(INSTALL_DIR)  $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcunit.* $(1)/usr/lib
+endef
+
+
+$(eval $(call BuildPackage,libcunit))
diff --git a/libs/libdaq/Makefile b/libs/libdaq/Makefile
new file mode 100644 (file)
index 0000000..0fe3426
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2012 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:=libdaq
+PKG_VERSION:=1.1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.snort.org/dl/snort-current/
+PKG_SOURCE:=daq-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=bc204ea09165b4ecbb1bb49c7c1a2ad4
+PKG_BUILD_DIR:=$(BUILD_DIR)/daq-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libdaq
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=DAQ library
+  URL:=$(PKG_SOURCE_URL)
+  DEPENDS:=+libdnet +libpcap
+endef
+
+define Package/libdaq/description
+ Data Acquisition library for packet I/O.
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-static \
+       --disable-nfq-module \
+       --with-dnet-includes="$(STAGING_DIR)/usr/include" \
+       --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
+       --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
+       --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
+
+define Build/Compile
+       $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR)
+endef
+
+define Build/Install
+       $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR) install DESTDIR=$(PKG_INSTALL_DIR)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(STAGING_DIR)/usr/include/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(STAGING_DIR)/usr/lib/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/daq
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/daq/* $(STAGING_DIR)/usr/lib/daq/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daq-modules-config $(STAGING_DIR)/usr/bin/
+endef
+
+define Package/libdaq/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/daq
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/daq/*.so* $(1)/usr/lib/daq/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daq-modules-config $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libdaq))
diff --git a/libs/libdaq/patches/001-cross-compile-test.patch b/libs/libdaq/patches/001-cross-compile-test.patch
new file mode 100644 (file)
index 0000000..6eadb9e
--- /dev/null
@@ -0,0 +1,18 @@
+--- daq-1.1.1/configure        2012-07-10 21:32:51.000000000 +0200
++++ daq-new/configure  2012-08-03 15:47:07.654945651 +0200
+@@ -12717,10 +12717,11 @@
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpcap version >= \"1.0.0\"" >&5
+ $as_echo_n "checking for libpcap version >= \"1.0.0\"... " >&6; }
+     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
+-See \`config.log' for more details" "$LINENO" 5; }
++#  { { $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
++#See \`config.log' for more details" "$LINENO" 5; }
++        echo "    No cross compiling test."
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/libs/libdbi-drivers/Makefile b/libs/libdbi-drivers/Makefile
new file mode 100644 (file)
index 0000000..211d96c
--- /dev/null
@@ -0,0 +1,137 @@
+#
+# Copyright (C) 2009-2014 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:=libdbi-drivers
+PKG_VERSION:=0.9.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libdbi-drivers
+PKG_MD5SUM:=9f47b960e225eede2cdeaabf7d22f59f
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libdbi-drivers/default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libdbi-drivers
+  URL:=http://libdbi-drivers.sourceforge.net/
+endef
+
+define Package/libdbi-drivers/default/description
+       libdbi-drivers project provides the database-specific drivers
+for the libdbi framework
+endef
+
+define Package/libdbi-drivers-mysql
+$(call Package/libdbi-drivers/default)
+  DEPENDS:=libdbi +PACKAGE_libdbi-drivers-mysql:libmysqlclient
+  TITLE:= libdbi-drivers-mysql
+endef
+
+define Package/libdbi-drivers-mysql2/description
+       libdbi-driver for mysql
+endef
+
+define Package/libdbi-drivers-pgsql
+$(call Package/libdbi-drivers/default)
+  DEPENDS:=libdbi +PACKAGE_libdbi-drivers-pgsql:libpq
+  TITLE:= libdbi-drivers-pgsql
+endef
+
+define Package/libdbi-drivers-pgsql/description
+       libdbi-driver for pgsql
+endef
+
+define Package/libdbi-drivers-sqlite2
+$(call Package/libdbi-drivers/default)
+  DEPENDS:=libdbi +PACKAGE_libdbi-drivers-sqlite2:libsqlite2
+  TITLE:= libdbi-drivers-sqlite2
+endef
+
+define Package/libdbi-drivers-sqlite2/description
+       libdbi-driver for sqlite2
+endef
+
+define Package/libdbi-drivers-sqlite3
+$(call Package/libdbi-drivers/default)
+  DEPENDS:=libdbi +PACKAGE_libdbi-drivers-sqlite3:libsqlite3
+  TITLE:= libdbi-drivers-sqlite3
+endef
+
+define Package/libdbi-drivers-sqlite3/description
+       libdbi-driver for sqlite3
+endef
+
+CONFIGURE_ARGS += \
+                 --enable-shared \
+                 --disable-static \
+                 --disable-rpath \
+                 --disable-docs \
+                 --with-dbi-incdir=$(STAGING_DIR)/usr/include \
+                 --with-dbi-libdir=$(STAGING_DIR)/usr/lib
+
+ifneq ($(CONFIG_PACKAGE_libdbi-drivers-mysql),)
+CONFIGURE_ARGS += \
+                 --with-mysql \
+                 --with-mysql-incdir=$(STAGING_DIR)/usr/include/mysql \
+                 --with-mysql-libdir=$(STAGING_DIR)/usr/lib/mysql
+TARGET_LDFLAGS += \
+                 -L$(STAGING_DIR)/usr/lib/mysql/
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_libdbi-drivers-pgsql),)
+CONFIGURE_ARGS += \
+                 --with-pgsql \
+                 --with-pgsql-incdir=$(STAGING_DIR)/usr/include \
+                 --with-pgsql-libdir=$(STAGING_DIR)/usr/lib
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_libdbi-drivers-sqlite2),)
+CONFIGURE_ARGS += \
+                 --with-sqlite \
+                 --with-sqlite-incdir=$(STAGING_DIR)/usr/include \
+                 --with-sqlite-libdir=$(STAGING_DIR)/usr/lib
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_libdbi-drivers-sqlite3),)
+CONFIGURE_ARGS += \
+                 --with-sqlite3 \
+                 --with-sqlite3-incdir=$(STAGING_DIR)/usr/include \
+                 --with-sqlite3-libdir=$(STAGING_DIR)/usr/lib
+endif
+
+define Package/libdbi-drivers-mysql/install
+       $(INSTALL_DIR) $(1)/usr/lib/dbd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/drivers/mysql/.libs/libdbdmysql.so $(1)/usr/lib/dbd
+endef
+
+define Package/libdbi-drivers-pgsql/install
+       $(INSTALL_DIR) $(1)/usr/lib/dbd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/drivers/pgsql/.libs/libdbdpgsql.so $(1)/usr/lib/dbd
+endef
+
+define Package/libdbi-drivers-sqlite2/install
+       $(INSTALL_DIR) $(1)/usr/lib/dbd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/drivers/sqlite/.libs/libdbdsqlite.so $(1)/usr/lib/dbd
+endef
+
+define Package/libdbi-drivers-sqlite3/install
+       $(INSTALL_DIR) $(1)/usr/lib/dbd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/drivers/sqlite3/.libs/libdbdsqlite3.so $(1)/usr/lib/dbd
+endef
+
+
+#$(eval $(call BuildPackage,libdbi-drivers))
+$(eval $(call BuildPackage,libdbi-drivers-mysql))
+$(eval $(call BuildPackage,libdbi-drivers-pgsql))
+$(eval $(call BuildPackage,libdbi-drivers-sqlite2))
+$(eval $(call BuildPackage,libdbi-drivers-sqlite3))
diff --git a/libs/libdbi-drivers/patches/001_libsqlite3_fix.patch b/libs/libdbi-drivers/patches/001_libsqlite3_fix.patch
new file mode 100644 (file)
index 0000000..5ded953
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -310,7 +310,7 @@ if test "$ac_sqlite3" = "yes"; then
+               AC_SEARCH_LIBS_VAR([sqlite3_exec], sqlite3, , , , SQLITE3_LIBS)
+               SQLITE3_LDFLAGS=""
+       else
+-              SQLITE3_LIBS=-lsqlite
++              SQLITE3_LIBS=-lsqlite3
+               SQLITE3_LDFLAGS=-L$ac_sqlite3_libdir
+       fi
diff --git a/libs/libdbi/Makefile b/libs/libdbi/Makefile
new file mode 100644 (file)
index 0000000..e27b09a
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2009-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:=libdbi
+PKG_VERSION:=0.9.0
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libdbi
+PKG_MD5SUM:=05e2ceeac4bc85fbe40de8b4b22d9ab3
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libdbi
+  NAME:=libdbi
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+  URL:=http://libdbi.sourceforge.net/
+endef
+
+define Package/libdbi/description
+       libdbi implements a database-independent abstraction layer in C.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-docs
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/dbi $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdbi.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libdbi/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdbi.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libdbi))
diff --git a/libs/libdirectfb/Makefile b/libs/libdirectfb/Makefile
new file mode 100644 (file)
index 0000000..13b02e4
--- /dev/null
@@ -0,0 +1,121 @@
+#
+# Copyright (C) 2010 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:=DirectFB
+PKG_VERSION:=1.4.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.directfb.org/downloads/Core/DirectFB-1.4
+PKG_MD5SUM:=e4376c6c5b8e27d735edb7f62a7a8e86
+
+PKG_LICENSE:=LGPLv2.1
+PKG_LICENSE_FILES:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/directfb
+    TITLE:=DirectFB
+    SECTION:=libs
+    CATEGORY:=Libraries
+    URL:=http://directfb.org
+    DEPENDS:=+libpng +libjpeg +libpthread +libfreetype +libsysfs
+endef
+
+define Package/directfb/description
+    DirectFB is a thin library that provides hardware graphics acceleration, input device handling and abstraction, integrated windowing system with support for translucent windows and multiple display layers, not only on top of the Linux Framebuffer Device. It is a complete hardware abstraction layer with software fallbacks for every graphics operation that is not supported by the underlying hardware.
+endef
+
+TARGET_LDFLAGS+="-Wl,-rpath-link=$(STAGING_DIR)/usr/lib"
+CONFIGURE_CMD=./autogen.sh
+
+define Feature/DirectFB
+  TARGET_NAME:=drawing-backend
+  TARGET_TITLE:=Drawing Backend
+  NAME:=DirectFB
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-osx \
+               --disable-x11 \
+               --enable-debug-support \
+               --disable-network \
+               --disable-mmx \
+               --disable-sse \
+               --enable-fbdev \
+               --disable-sdl \
+               --disable-vnc \
+               --enable-sysfs \
+               --with-inputdrivers=linuxinput \
+               --with-gfxdrivers=none \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) \
+               $(1)/usr/include \
+               $(1)/usr/lib \
+               $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/* \
+               $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig \
+               $(1)/usr/lib/
+endef
+
+define Package/directfb/install
+       $(INSTALL_DIR) \
+               $(1)/usr/bin \
+               $(1)/usr/lib \
+               $(1)/usr/share/directfb-1.4.2 \
+               $(1)/usr/lib/directfb-1.4-0/interfaces/IDirectFBFont \
+               $(1)/usr/lib/directfb-1.4-0/interfaces/IDirectFBImageProvider \
+               $(1)/usr/lib/directfb-1.4-0/interfaces/IDirectFBVideoProvider \
+               $(1)/usr/lib/directfb-1.4-0/wm \
+               $(1)/usr/lib/directfb-1.4-0/systems \
+               $(1)/usr/lib/directfb-1.4-0/inputdrivers
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin/* \
+               $(1)/usr/bin/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/directfb-1.4.2/* \
+               $(1)/usr/share/directfb-1.4.2/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/lib{direct,fusion}*.so* \
+               $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/directfb-1.4-0/interfaces/IDirectFBFont/*.so* \
+               $(1)/usr/lib/directfb-1.4-0/interfaces/IDirectFBFont/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/directfb-1.4-0/interfaces/IDirectFBImageProvider/*.so* \
+               $(1)/usr/lib/directfb-1.4-0/interfaces/IDirectFBImageProvider/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/directfb-1.4-0/interfaces/IDirectFBVideoProvider/*.so* \
+               $(1)/usr/lib/directfb-1.4-0/interfaces/IDirectFBVideoProvider/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/directfb-1.4-0/wm/*.so* \
+               $(1)/usr/lib/directfb-1.4-0/wm/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/directfb-1.4-0/systems/*.so* \
+               $(1)/usr/lib/directfb-1.4-0/systems/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/directfb-1.4-0/inputdrivers/*.so* \
+               $(1)/usr/lib/directfb-1.4-0/inputdrivers/
+endef
+
+$(eval $(call Feature,DirectFB))
+$(eval $(call BuildPackage,directfb))
diff --git a/libs/libdirectfb/patches/001-disable-asm.patch b/libs/libdirectfb/patches/001-disable-asm.patch
new file mode 100644 (file)
index 0000000..c38498a
--- /dev/null
@@ -0,0 +1,13 @@
+--- DirectFB-1.4.2/configure.in.orig   2009-10-14 17:19:38.000000000 +0200
++++ DirectFB-1.4.2/configure.in        2009-10-14 17:19:55.000000000 +0200
+@@ -221,8 +221,8 @@
+ have_kos=no
+ need_libc_r=no
+ need_libdl=yes
++want_ppcasm=no
++want_armasm=no
+-want_ppcasm=yes
+-want_armasm=yes
+ case "$target_or_host" in
+   *-linux*)
diff --git a/libs/libdirectfb/patches/002-use-volatile-keyword.patch b/libs/libdirectfb/patches/002-use-volatile-keyword.patch
new file mode 100644 (file)
index 0000000..7904110
--- /dev/null
@@ -0,0 +1,30 @@
+diff -burN DirectFB-1.4.2.orig/lib/direct/interface.c DirectFB-1.4.2/lib/direct/interface.c
+--- DirectFB-1.4.2.orig/lib/direct/interface.c 2013-01-29 13:57:25.000000000 +0100
++++ DirectFB-1.4.2/lib/direct/interface.c      2013-01-29 13:59:37.000000000 +0100
+@@ -74,7 +74,7 @@
+ } DirectInterfaceImplementation;
+ static pthread_mutex_t  implementations_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+-static DirectLink      *implementations       = NULL;
++static DirectLink      * volatile implementations       = NULL;
+ /**************************************************************************************************/
+@@ -96,7 +96,7 @@
+      D_DEBUG_AT( Direct_Interface, "  -> %s | %s\n", impl->type, impl->implementation );
+      pthread_mutex_lock( &implementations_mutex );
+-     direct_list_prepend( &implementations, &impl->link );
++     direct_list_prepend( (DirectLink**)&implementations, &impl->link );
+      pthread_mutex_unlock( &implementations_mutex );
+ }
+@@ -111,7 +111,7 @@
+           D_MAGIC_ASSERT( impl, DirectInterfaceImplementation );
+           if (impl->funcs == funcs) {
+-               direct_list_remove( &implementations, &impl->link );
++               direct_list_remove( (DirectLink**)&implementations, &impl->link );
+                break;
+           }
diff --git a/libs/libdlna/Makefile b/libs/libdlna/Makefile
new file mode 100644 (file)
index 0000000..9c4ca16
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2006-2013 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:=libdlna
+PKG_VERSION:=0.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://libdlna.geexbox.org/releases/
+PKG_MD5SUM:=64d7de57aff5a729f2434fc5e69b4ffc
+
+PKG_LICENSE:=LGPLv2.1+
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libdlna
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:= Reference DLNA implementation
+ URL:=http://libdlna.geexbox.org/
+ DEPENDS:=+libffmpeg
+endef
+
+define Package/libdlna/description
+ libdlna aims at being the reference open-source implementation of DLNA
+ (Digital Living Network Alliance) standards. Its primary goal is to
+ provide DLNA support to uShare, an embedded DLNA & UPnP A/V Media Server,
+ but it will be used to build both DLNA servers and players in the long
+ term.
+endef
+
+define Build/Configure
+       # this is *NOT* GNU configure
+       ( cd $(PKG_BUILD_DIR); \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -lpthread" \
+               HOST_CC="$(HOSTCC)" \
+               ./configure \
+               --cross-compile \
+               --cross-prefix=$(TARGET_CROSS) \
+               --prefix=/usr \
+               --enable-shared \
+               --enable-static \
+               --disable-debug \
+               --disable-optimize \
+               --disable-strip \
+       )
+endef
+
+# XXX: fix build on systems where install is not at its usual location
+# INSTALL defaults to /usr/bin/install
+MAKE_INSTALL_FLAGS += \
+       INSTALL="install" \
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/dlna.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdlna.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libdlna.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libdlna/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdlna.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libdlna))
diff --git a/libs/libdlna/patches/010-configure-crosscompile.patch b/libs/libdlna/patches/010-configure-crosscompile.patch
new file mode 100644 (file)
index 0000000..00ca9a4
--- /dev/null
@@ -0,0 +1,59 @@
+--- a/configure
++++ b/configure
+@@ -184,6 +184,19 @@ check_ld(){
+     check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
+ }
++check_host_cc(){
++    log check_host_cc "$@"
++    cat >$TMPC
++    log_file $TMPC
++    check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
++}
++
++check_host_ld(){
++    log check_host_ld "$@"
++    check_host_cc || return
++    check_cmd $host_cc $host_cflags $host_ldflags "$@" -o $TMPE $TMPO
++}
++
+ check_exec(){
+     check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
+ }
+@@ -318,6 +331,7 @@ includedir='$(PREFIX)/include'
+ static="yes"
+ shared="yes"
+ cc="gcc"
++host_cc="gcc"
+ ar="ar"
+ ranlib="ranlib"
+ make="make"
+@@ -465,6 +479,10 @@ else
+   [ -n "$STRIP" ] && strip="$STRIP"
+ fi
+ [ -n "$MAKE" ] && make="$MAKE"
++[ -n "$HOST_CC" ] && host_cc="$HOST_CC"
++[ -n "$HOST_CFLAGS" ] && host_cflags="$HOST_CFLAGS"
++[ -n "$HOST_LDFLAGS" ] && host_ldflags="$HOST_LDFLAGS"
++host_cflags="-Isrc $host_cflags"
+ #################################################
+ #   create logging file
+@@ -649,8 +667,7 @@ check_lib libavcodec/avcodec.h avcodec_r
+ #################################################
+ #   version
+ #################################################
+-temp_cflags "-Isrc"
+-check_ld <<EOF
++check_host_ld <<EOF
+ #include <stdio.h>
+ #include <dlna.h>
+ int main(){
+@@ -660,7 +677,6 @@ int main(){
+ }
+ EOF
+ VERSION=`$TMPE`
+-restore_flags
+ #################################################
diff --git a/libs/libdlna/patches/200-parallel-build.patch b/libs/libdlna/patches/200-parallel-build.patch
new file mode 100644 (file)
index 0000000..7f9934b
--- /dev/null
@@ -0,0 +1,17 @@
+---
+ Makefile |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- libdlna-0.2.3.orig/Makefile
++++ libdlna-0.2.3/Makefile
+@@ -32,8 +32,8 @@ lib:
+ test: $(LIBTEST)
+-$(LIBTEST): $(SRCS)
+-      $(CC) $? $(OPTFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
++$(LIBTEST): lib $(SRCS)
++      $(CC) $(SRCS) $(OPTFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+ clean:
+       $(MAKE) -C src clean
diff --git a/libs/libdlna/patches/300-ffmpeg_compat.patch b/libs/libdlna/patches/300-ffmpeg_compat.patch
new file mode 100644 (file)
index 0000000..8fb9b39
--- /dev/null
@@ -0,0 +1,35 @@
+--- a/src/profiles.c
++++ b/src/profiles.c
+@@ -205,13 +205,13 @@ av_profile_get_codecs (AVFormatContext *
+   for (i = 0; i < ctx->nb_streams; i++)
+   {
+     if (audio_stream == -1 &&
+-        ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
++        ctx->streams[i]->codec->codec_type == LIBDLNA_CODEC_TYPE_AUDIO)
+     {
+       audio_stream = i;
+       continue;
+     }
+     else if (video_stream == -1 &&
+-             ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
++             ctx->streams[i]->codec->codec_type == LIBDLNA_CODEC_TYPE_VIDEO)
+     {
+       video_stream = i;
+       continue;
+--- a/src/profiles.h
++++ b/src/profiles.h
+@@ -25,6 +25,14 @@
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
++#if (LIBAVCODEC_VERSION_MAJOR > 52)
++# define LIBDLNA_CODEC_TYPE_AUDIO  (AVMEDIA_TYPE_AUDIO)
++# define LIBDLNA_CODEC_TYPE_VIDEO  (AVMEDIA_TYPE_VIDEO)
++#else
++# define LIBDLNA_CODEC_TYPE_AUDIO  (CODEC_TYPE_AUDIO)
++# define LIBDLNA_CODEC_TYPE_VIDEO  (CODEC_TYPE_VIDEO)
++#endif
++
+ #include "dlna_internals.h"
+ #include "containers.h"
diff --git a/libs/libdmapsharing/Makefile b/libs/libdmapsharing/Makefile
new file mode 100644 (file)
index 0000000..55cadfd
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2009-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# This Makefile is a skeleton
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libdmapsharing
+PKG_VERSION:=2.9.15
+PKG_RELEASE:=1
+
+PKG_SOURCE:=libdmapsharing-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.flyn.org/projects/libdmapsharing/
+PKG_MD5SUM:=52c9e4d3de931d9013eeaccf7371bb2d
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/libdmapsharing-$(PKG_VERSION)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libdmapsharing
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libsoup +mdnsresponder +gstreamer +gst-plugins-base +libgstapp
+  TITLE:=libdmapsharing
+  URL:=http://www.flyn.org/projects/libdmapsharing/
+  MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+endef
+
+define Package/libdmapsharing/decription
+  Libdmapsharing is a DMAP library implementation in C
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/libdmapsharing-3.0/ \
+               $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libdmapsharing/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libdmapsharing))
diff --git a/libs/libdmapsharing/patches/001-diable_pixbuf.patch b/libs/libdmapsharing/patches/001-diable_pixbuf.patch
new file mode 100644 (file)
index 0000000..663dd49
--- /dev/null
@@ -0,0 +1,24 @@
+Index: libdmapsharing-2.9.15/configure.ac
+===================================================================
+--- libdmapsharing-2.9.15.orig/configure.ac    2012-08-14 21:02:31.861158482 +0200
++++ libdmapsharing-2.9.15/configure.ac 2012-08-14 21:03:42.448658906 +0200
+@@ -112,18 +112,7 @@
+ AC_SUBST(GOBJECT_CFLAGS)
+ AC_SUBST(GOBJECT_LIBS)
+-dnl Check for gdk-pixbuf, needed for DACP Now Playing Artwork
+-PKG_CHECK_MODULES(GDKPIXBUF, gdk-pixbuf-2.0,
+-  HAVE_GDKPIXBUF=yes,
+-  HAVE_GDKPIXBUF=no)
+-
+-if test x"$HAVE_GDKPIXBUF" = "xyes"; then
+-  AC_DEFINE(HAVE_GDKPIXBUF, 1, [Define if gdk-pixbuf support is enabled])
+-else
+-  AC_WARN(Gdk-pixbuf library not present, Now Playing artwork might be affected.)
+-fi
+-
+-AM_CONDITIONAL(USE_GDKPIXBUF, test x"$HAVE_GDKPIXBUF" = "xyes")
++HAVE_GDKPIXBUF=no
+ AC_SUBST(GDKPIXBUF_CFLAGS)
+ AC_SUBST(GDKPIXBUF_LIBS)
diff --git a/libs/libdnet/Makefile b/libs/libdnet/Makefile
new file mode 100644 (file)
index 0000000..d1e7f63
--- /dev/null
@@ -0,0 +1,144 @@
+#
+# Copyright (C) 2006-2010 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:=libdnet
+PKG_VERSION:=1.11
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=04c394ed8e1e7fc455456e79e908916d
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS:=\
+       CONFIG_PACKAGE_libdnet \
+       CONFIG_PACKAGE_pydnet
+
+PKG_BUILD_DEPENDS:=PACKAGE_pydnet:python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/libdnet/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Low-level network library
+  URL:=http://sourceforge.net/projects/libdnet/
+endef
+
+define Package/libdnet/Default/description
+       libdnet is a library of simplified, portable interface to several
+       low-level networking routines.
+endef
+
+define Package/libdnet
+  $(call Package/libdnet/Default)
+endef
+
+define Package/libdnet/description
+  $(call Package/libdnet/Default/description)
+endef
+
+define Package/pydnet
+  $(call Package/libdnet/Default)
+  DEPENDS:=libdnet +python-mini
+endef
+
+define Package/pydnet/description
+  $(call Package/libdnet/Default/description)
+  This package contains the python dnet library.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --without-check \
+       --without-python
+
+CONFIGURE_VARS += \
+       ac_cv_dnet_bsd_bpf=no
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               ln -sf config/acinclude.m4 . ; \
+               autoreconf -v --install || exit 1 \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default)
+       $(if $(CONFIG_PACKAGE_pydnet), \
+               $(call Build/Compile/PyMod, \
+                       python/, \
+                       build \
+               ) \
+       )
+endef
+
+define Build/Install
+       $(call Build/Install/Default)
+       $(if $(CONFIG_PACKAGE_pydnet), \
+               $(call Build/Compile/PyMod, \
+                       python/, \
+                       install --no-compile --prefix $(PKG_INSTALL_DIR)/usr \
+               ) \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/dnet-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/dnet-config
+
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA)\
+               $(PKG_INSTALL_DIR)/usr/include/dnet.h \
+               $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/dnet \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libdnet.{la,a,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libdnet/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libdnet.so.* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/dnet \
+               $(1)/usr/sbin/
+endef
+
+define Package/pydnet/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python* $(1)/usr/lib/
+endef
+
+
+$(eval $(call BuildPackage,libdnet))
+$(eval $(call BuildPackage,pydnet))
diff --git a/libs/libdnet/patches/001-dnet_config.patch b/libs/libdnet/patches/001-dnet_config.patch
new file mode 100644 (file)
index 0000000..cde376a
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/dnet-config.in
++++ b/dnet-config.in
+@@ -45,10 +45,18 @@ while test $# -gt 0; do
+ done
+ if test "$echo_cflags" = "yes"; then
+-      echo -I@includedir@
++      includes=
++      if test "@includedir@" != "/usr/include" ; then
++             includes=-I@includedir@
++      fi
++      echo $includes
+ fi
+ if test "$echo_libs" = "yes"; then
+-      echo -L@libdir@ -ldnet @LIBS@
++      libs=
++      if test "@libdir@" != "/usr/lib" ; then
++             libs=-I@libdir@
++      fi
++      echo $libs -ldnet @LIBS@
+ fi      
diff --git a/libs/libdnet/patches/002-fix_avr32_compile.patch b/libs/libdnet/patches/002-fix_avr32_compile.patch
new file mode 100644 (file)
index 0000000..54223c9
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/config/config.sub
++++ b/config/config.sub
+@@ -228,7 +228,7 @@ case $basic_machine in
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+-      | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++      | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+@@ -290,7 +290,7 @@ case $basic_machine in
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+-      | avr-* \
++      | avr-* | avr32-* \
+       | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c54x-* \
+       | clipper-* | cydra-* \
diff --git a/libs/libdnet/patches/010-gcc4.patch b/libs/libdnet/patches/010-gcc4.patch
new file mode 100644 (file)
index 0000000..bfbf822
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/python/dnet.c
++++ b/python/dnet.c
+@@ -2726,7 +2726,7 @@ static PyObject *__pyx_f_4dnet_15__addr_
+   PyObject *__pyx_3 = 0;
+   unsigned short __pyx_4;
+   Py_INCREF(__pyx_v_self);
+-  ((PyObject*)__pyx_v_next) = Py_None; Py_INCREF(((PyObject*)__pyx_v_next));
++  __pyx_v_next = Py_None; Py_INCREF(((PyObject*)__pyx_v_next));
+   /* "/Users/dugsong/projects/libdnet/python/./dnet.pyx":634 */
+   __pyx_1 = (((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->cur <= ((struct __pyx_obj_4dnet___addr_ip4_iter *)__pyx_v_self)->max);
+@@ -2738,7 +2738,7 @@ static PyObject *__pyx_f_4dnet_15__addr_
+     Py_DECREF(__pyx_2); __pyx_2 = 0;
+     if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_4dnet_addr)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
+     Py_DECREF(((PyObject *)__pyx_v_next));
+-    ((PyObject *)__pyx_v_next) = __pyx_3;
++    __pyx_v_next = __pyx_3;
+     __pyx_3 = 0;
+     /* "/Users/dugsong/projects/libdnet/python/./dnet.pyx":636 */
diff --git a/libs/libdvbpsi/Makefile b/libs/libdvbpsi/Makefile
new file mode 100644 (file)
index 0000000..2dd1d23
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2007-2008 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:=libdvbpsi5
+PKG_VERSION:=0.1.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.videolan.org/pub/libdvbpsi/$(PKG_VERSION)/
+PKG_MD5SUM:=bd2d9861be3311e1e03c91cd9345f542
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/libdvbpsi
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=MPEG TS and DVB PSI tables decoding and generating
+  URL:=http://www.videolan.org/developers/libdvbpsi.html
+endef
+
+define Package/libdvbpsi/description
+       libdvbpsi is a simple library designed for MPEG TS and DVB PSI tables
+       decoding and generating.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/dvbpsi
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/dvbpsi/*.h \
+               $(1)/usr/include/dvbpsi/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libdvbpsi.{so*,a,la} \
+               $(1)/usr/lib/
+endef
+
+define Package/libdvbpsi/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libdvbpsi.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libdvbpsi))
diff --git a/libs/libdvbpsi/patches/001-no_doc_examples.patch b/libs/libdvbpsi/patches/001-no_doc_examples.patch
new file mode 100644 (file)
index 0000000..a32f5da
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,7 +1,7 @@
+ ## Process this file with automake to produce Makefile.in
+-SUBDIRS = src examples misc
+-DIST_SUBDIRS = $(SUBDIRS) doc debian wince
++SUBDIRS = src
++DIST_SUBDIRS = $(SUBDIRS) debian wince
+ EXTRA_DIST = libdvbpsi.spec bootstrap
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -179,8 +179,8 @@ target_alias = @target_alias@
+ target_cpu = @target_cpu@
+ target_os = @target_os@
+ target_vendor = @target_vendor@
+-SUBDIRS = src examples misc
+-DIST_SUBDIRS = $(SUBDIRS) doc debian wince
++SUBDIRS = src
++DIST_SUBDIRS = $(SUBDIRS) debian wince
+ EXTRA_DIST = libdvbpsi.spec bootstrap
+ AUTOMAKE_OPTIONS = foreign dist-bzip2 subdir-objects
+ all: config.h
diff --git a/libs/libdvdread/Makefile b/libs/libdvdread/Makefile
new file mode 100644 (file)
index 0000000..50f4f96
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2006-2010 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:=libdvdread
+PKG_VERSION:=0.9.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.dtek.chalmers.se/~dvd/dist
+PKG_MD5SUM:=078788c9241ae16763529e1235502337
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libdvdread
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=simple foundation for reading DVD video disks.
+  URL:=http://www.dtek.chalmers.se/~dvd/downloads.shtml
+endef
+
+define Package/libdvdread/description
+       libdvdread provides a simple foundation for reading DVD video disks.
+       It provides the functionality that is required to access many DVDs.
+       It parses IFO files, reads NAV-blocks, and performs CSS
+       authentication and descrambling.
+endef
+
+TARGET_CFLAGS += \
+       -ffunction-sections -fdata-sections
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static
+#      --with-build-cc="$(HOSTCC)"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/dvdread
+       $(CP)   $(PKG_INSTALL_DIR)/usr/include/dvdread/*.h \
+               $(1)/usr/include/dvdread
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP)   $(PKG_INSTALL_DIR)/usr/lib/libdvdread.{a,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libdvdread/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdvdread.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libdvdread))
diff --git a/libs/libfreefare/Makefile b/libs/libfreefare/Makefile
new file mode 100644 (file)
index 0000000..1aab78a
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2010-2012 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:=libfreefare
+PKG_VERSION:=0.4.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://libfreefare.googlecode.com/files/
+PKG_MD5SUM:=98db0c9aea71bda1cdf99dc119987c8c
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libfreefare/Default
+  TITLE:=Library for high level manipulation of MIFARE cards
+  URL:=http://code.google.com/p/nfc-tools/wiki/libfreefare
+endef
+
+define Package/libfreefare
+$(call Package/libfreefare/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libnfc +libopenssl
+endef
+
+define Package/libfreefare/description
+  The libfreefare project aims to provide a convenient API for MIFARE card
+  manipulations.
+endef
+
+define Package/libfreefare-examples
+$(call Package/libfreefare/Default)
+  TITLE+= (examples)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libfreefare
+endef
+
+define Package/libfreefare-examples/description
+  libfreefare is provided with some examples:
+   * mifare-classic-format, mifare-desfire-format: attempt to format Mifare
+   cards;
+   * mifare-classic-write-ndef, mifare-desfire-write-ndef: write NDEF file to
+   Mifare cards;
+   * some mifare-desfire-* examples to made various access to Mifare DESFire.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/freefare.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreefare.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libfreefare.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libfreefare/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreefare.so.* $(1)/usr/lib/
+endef
+
+define Package/libfreefare-examples/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/mifare-* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libfreefare))
+$(eval $(call BuildPackage,libfreefare-examples))
diff --git a/libs/libfreenect/Makefile b/libs/libfreenect/Makefile
new file mode 100644 (file)
index 0000000..0f5b6bc
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2012 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:=libfreenect
+PKG_VERSION:=2012-01-29
+PKG_RELEASE:=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=git://github.com/OpenKinect/libfreenect.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=bbc109a589a1dd2c229f8bc98536dbc184dd73f9
+PKG_MIRROR_MD5SUM:=08f8cb77dd8b9bce21fc7440f62110e7
+CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/libfreenect
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Xbox Kinect library
+  DEPENDS:=+libusb-1.0
+endef
+
+CMAKE_OPTIONS += -DBUILD_EXAMPLES="OFF"
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+
+define Package/libfreenect/description
+       Drivers and libraries for the Xbox Kinect device
+endef
+
+define Package/libfreenect/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfreenect.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libfreenect))
diff --git a/libs/libfreenect/patches/001-cflags_override.patch b/libs/libfreenect/patches/001-cflags_override.patch
new file mode 100644 (file)
index 0000000..a4862cc
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -4,8 +4,6 @@
+ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+-set(CMAKE_C_FLAGS "-Wall")
+-
+ include_directories(${LIBUSB_1_INCLUDE_DIRS})
+ IF(WIN32)
+   LIST(APPEND SRC core.c tilt.c cameras.c usb_libusb10.c registration.c ../platform/windows/libusb10emu/libusb-1.0/libusbemu.cpp ../platform/windows/libusb10emu/libusb-1.0/failguard.cpp)
diff --git a/libs/libgee/Makefile b/libs/libgee/Makefile
new file mode 100644 (file)
index 0000000..afcd249
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2006-2012 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:=libgee
+PKG_VERSION:=0.6.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNOME/libgee/0.6/
+PKG_MD5SUM:=a32bf498cf33d5e3417823a7b252ad22
+
+PKG_BUILD_DEPENDS:=vala/host glib2
+
+TARGET_LDFLAGS+=\
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libgee
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GObject based collection library
+  URL:=http://live.gnome.org/Libgee
+  DEPENDS:=+glib2
+endef
+
+define Package/libgee/description
+libgee is a collection library providing GObject-based interfaces and classes
+for commonly used data structures.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/gee-1.0}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgee.{so*,la} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/gee-1.0/gee.h \
+               $(1)/usr/include/gee-1.0/
+
+       $(INSTALL_DIR) $(1)/usr/share/vala/vapi
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/vala/vapi/gee-1.0.vapi \
+               $(1)/usr/share/vala/vapi
+endef
+
+define Package/libgee/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libgee.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libgee))
diff --git a/libs/libgphoto2/Makefile b/libs/libgphoto2/Makefile
new file mode 100644 (file)
index 0000000..bf4f55f
--- /dev/null
@@ -0,0 +1,103 @@
+#
+# Copyright (C) 2006-2012 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:=libgphoto2
+PKG_VERSION:=2.4.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/gphoto
+PKG_MD5SUM:=735c50ebb15cb8be61bac400ee4afb1e
+
+PKG_FIXUP:=autoreconf
+PKG_LIBTOOL_PATHS:=. libgphoto2_port
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libgphoto2/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  URL:=http://www.gphoto.org/
+endef
+
+define Package/libgphoto2
+  $(call Package/libgphoto2/Default)
+  DEPENDS:=+libexif +libjpeg +libpthread +libltdl $(ICONV_DEPENDS)
+  TITLE:=The basic library of the gphoto2 program.
+  MENU:=1
+endef
+
+define Package/libgphoto2-drivers
+  $(call Package/libgphoto2/Default)
+  DEPENDS:=libgphoto2 +libusb-compat +libgd
+  TITLE:=Gphoto2 drivers for various cameras
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-rpath \
+       --with-drivers=all \
+       --without-included-ltdl \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+
+CONFIGURE_VARS += \
+       CPPFLAGS="$$$$CPPFLAGS $(ICONV_CFLAGS)" \
+       LDFLAGS="$$$$LDFLAGS $(ICONV_LDFLAGS)" \
+       LIBEXIF_CFLAGS="$$$$CPPFLAGS" \
+       LIBEXIF_LIBS="$$$$LDFLAGS -lexif" \
+       LIBUSB_CFLAGS="$$$$CPPFLAGS" \
+       LIBUSB_LIBS="$$$$LDFLAGS -lusb" \
+       LIBS="-lltdl" \
+
+# If OpenWrt is using the iconv stub, we disable iconv support
+# in libgphoto2 entirely since the stub lacks some essential
+# conversions like UCS-2 to UTF-8 which will let certain drivers
+# fail with "Failed to create iconv converter" .
+ifneq ($(ICONV_FULL),1)
+  CONFIGURE_VARS += am_cv_func_iconv=no am_cv_lib_iconv=no
+endif
+
+MAKE_FLAGS += \
+       LIBLTDL="" \
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gphoto2{,-port}-config $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gphoto2 $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgphoto2{,_port}.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgphoto2.pc $(1)/usr/lib/pkgconfig/
+       $(SED) 's,-I$$$${prefix}/include/gphoto2,,g' $(1)/usr/bin/gphoto2{,-port}-config
+       $(SED) 's,-I$$$${prefix}/include,,g' $(1)/usr/bin/gphoto2{,-port}-config
+       # remove annoying recursive symlink
+       rm -f $(1)/usr/include/gphoto2/gphoto2
+endef
+
+define Package/libgphoto2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgphoto2{,_port}.so.* $(1)/usr/lib/
+endef
+
+define Package/libgphoto2-drivers/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgphoto2{,_port} $(1)/usr/lib/
+       rm -rf $(1)/usr/lib/libgphoto2{,_port}/*/*.{,l}a
+       rm -f $(1)/usr/lib/libgphoto2_port/*/usb.so
+endef
+
+$(eval $(call BuildPackage,libgphoto2))
+$(eval $(call BuildPackage,libgphoto2-drivers))
diff --git a/libs/libgphoto2/patches/001-automake-compat.patch b/libs/libgphoto2/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..60e47c8
--- /dev/null
@@ -0,0 +1,53 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -227,7 +227,6 @@ ALL_LINGUAS="da de es eu fr hu it ja nl
+ GP_GETTEXT_HACK([${PACKAGE}-${LIBGPHOTO2_CURRENT_MIN}],[The gPhoto Team],[${MAIL_GPHOTO_TRANSLATION}])
+ AM_GNU_GETTEXT_VERSION([0.14.1])
+ AM_GNU_GETTEXT([external])
+-AM_PO_SUBDIRS()
+ AM_ICONV()
+ GP_GETTEXT_FLAGS()
+--- a/libgphoto2_port/configure.ac
++++ b/libgphoto2_port/configure.ac
+@@ -116,7 +116,6 @@ GP_GETTEXT_HACK([${PACKAGE}-${LIBGPHOTO2
+ ALL_LINGUAS="cs da de fr es eu it ja nl pl pt_BR ru sk sv uk vi zh_CN zh_TW"
+ AM_GNU_GETTEXT_VERSION([0.14.1])
+ AM_GNU_GETTEXT([external])
+-AM_PO_SUBDIRS()
+ AM_ICONV()
+ GP_GETTEXT_FLAGS()
+--- a/libgphoto2_port/libgphoto2_port/Makefile.in
++++ b/libgphoto2_port/libgphoto2_port/Makefile.in
+@@ -15,6 +15,8 @@
+ @SET_MAKE@
++SHELL = @SHELL@
++
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
+ pkgincludedir = $(includedir)/@PACKAGE@
+--- a/libgphoto2_port/Makefile.in
++++ b/libgphoto2_port/Makefile.in
+@@ -15,7 +15,7 @@
+ @SET_MAKE@
+-
++SHELL = @SHELL@
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -20,7 +20,7 @@
+ ########################################################################
+ # put file lists and special compile rules here
+-
++SHELL = @SHELL@
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/libs/libgphoto2/patches/002-no-tests-docs-examples-translations.patch b/libs/libgphoto2/patches/002-no-tests-docs-examples-translations.patch
new file mode 100644 (file)
index 0000000..702e4cf
--- /dev/null
@@ -0,0 +1,86 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -637,20 +637,11 @@ camlibs/konica/localization/Makefile
+ libgphoto2/Makefile
+ libgphoto2.pc
+ libgphoto2-uninstalled.pc
+-examples/Makefile
+-tests/Makefile
+-tests/check-camera-list.sh
+-tests/ddb/Makefile
+-tests/ddb/check-ddb.sh
+ packaging/Makefile
+ packaging/linux-hotplug/Makefile
+ packaging/generic/Makefile
+ packaging/rpm/Makefile
+ packaging/rpm/package.spec
+-po/Makefile.in
+-doc/Makefile
+-doc/Doxyfile
+-doc/api/Makefile
+ ],[
+ dnl This relies on this code being called for each of the above files
+ dnl with ac_file set to the filename.
+--- a/libgphoto2_port/configure.ac
++++ b/libgphoto2_port/configure.ac
+@@ -485,7 +485,6 @@ AC_SUBST([AM_LDFLAGS])
+ # ---------------------------------------------------------------------------
+ AC_CONFIG_FILES([
+ Makefile
+-po/Makefile.in
+ libgphoto2_port/Makefile
+ libgphoto2_port.pc
+ libgphoto2_port-uninstalled.pc
+@@ -497,8 +496,6 @@ usbscsi/Makefile
+ disk/Makefile
+ ptpip/Makefile
+ gphoto2-port-config
+-test/Makefile
+-doc/Makefile
+ m4/Makefile
+ ])
+ AC_OUTPUT
+--- a/libgphoto2_port/Makefile.am
++++ b/libgphoto2_port/Makefile.am
+@@ -10,7 +10,7 @@ VERSION_FLAGS = -DLIBGPPORT_VERSION=\"@L
+ bin_SCRIPTS = gphoto2-port-config
+ # Note: @subdirs@ lists all the directories from AC_CONFIG_SUBDIRS()
+-SUBDIRS = po libgphoto2_port test @IOLIB_SUBDIRS@ doc m4
++SUBDIRS = libgphoto2_port @IOLIB_SUBDIRS@ m4
+ EXTRA_DIST =                  \
+       AUTHORS \
+--- a/libgphoto2_port/Makefile.in
++++ b/libgphoto2_port/Makefile.in
+@@ -325,7 +325,7 @@ VERSION_FLAGS = -DLIBGPPORT_VERSION=\"@L
+ bin_SCRIPTS = gphoto2-port-config
+ # Note: @subdirs@ lists all the directories from AC_CONFIG_SUBDIRS()
+-SUBDIRS = po libgphoto2_port test @IOLIB_SUBDIRS@ doc m4
++SUBDIRS = libgphoto2_port @IOLIB_SUBDIRS@ m4
+ EXTRA_DIST = AUTHORS ChangeLog COPYING.LIB NEWS README iolib.sym \
+       gphoto2-port-config.in libgphoto2_port.pc.in \
+       libgphoto2_port-uninstalled.pc.in \
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -8,7 +8,7 @@ bin_SCRIPTS = gphoto2-config
+ EXTRA_DIST = HACKING MAINTAINERS TESTERS installcheck.mk README.packaging
+ # Note: @subdirs@ lists all the directories from AC_CONFIG_SUBDIRS()
+-SUBDIRS = @subdirs@ libgphoto2 camlibs tests examples po packaging doc
++SUBDIRS = @subdirs@ libgphoto2 camlibs packaging
+ EXTRA_DIST    += libgphoto2.pc.in
+ pkgconfig_DATA = libgphoto2.pc
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -357,7 +357,7 @@ EXTRA_DIST = HACKING MAINTAINERS TESTERS
+       ChangeLog INSTALL README.in README README.packaging
+ # Note: @subdirs@ lists all the directories from AC_CONFIG_SUBDIRS()
+-SUBDIRS = @subdirs@ libgphoto2 camlibs tests examples po packaging doc
++SUBDIRS = @subdirs@ libgphoto2 camlibs packaging
+ pkgconfig_DATA = libgphoto2.pc
+ noinst_DATA = libgphoto2-uninstalled.pc
+ doc_DATA = AUTHORS COPYING NEWS ABOUT-NLS ChangeLog README \
diff --git a/libs/libgssapi/Makefile b/libs/libgssapi/Makefile
new file mode 100644 (file)
index 0000000..01de32d
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2007-2010 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:=libgssapi
+PKG_VERSION:=0.11
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.citi.umich.edu/projects/nfsv4/linux/libgssapi/
+PKG_MD5SUM:=0e5b4c7267724f8ddf64bc35514c272e
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libgssapi
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=required libraries for the nfs-utils
+  URL:=http://www.citi.umich.edu/projects/nfsv4/linux
+endef
+
+define Package/libgssapi/description
+ Support libraries - for newer nfs mount command (nfs4)
+endef
+
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib $(FPIC)
+
+MAKE_FLAGS += \
+       OPT="$(TARGET_CFLAGS)" \
+       INSTALLSUID="install -m 4755" \
+       DESTDIR="$(PKG_INSTALL_DIR)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/gssglue/gssapi
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gssglue/gssapi/gssapi.h $(1)/usr/include/gssglue/gssapi
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgssapi.{a,so*} $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgssapi.pc $(1)/usr/lib/pkgconfig
+endef
+
+$(eval $(call BuildPackage,libgssapi))
diff --git a/libs/libimobiledevice/Makefile b/libs/libimobiledevice/Makefile
new file mode 100644 (file)
index 0000000..9d2b5ef
--- /dev/null
@@ -0,0 +1,91 @@
+#
+# Copyright (C) 2012-2014 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:=libimobiledevice
+PKG_VERSION:=1.1.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.libimobiledevice.org/downloads
+PKG_MD5SUM:=274783651e9b772774cd9fed2fc52e08
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+$(call include_mk, python-package.mk)
+
+define Package/libimobiledevice/Default
+  TITLE:=A library that talks to Apple devices.
+  URL:=http://www.libimobiledevice.org/
+endef
+
+define Package/libimobiledevice/Default/description
+  libimobiledevice is a software library that talks the protocols to support
+  iPhone®, iPod Touch®, iPad® and Apple TV® devices.
+endef
+
+define Package/libimobiledevice
+  $(call Package/libimobiledevice/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libgcrypt +libgnutls $(ICONV_DEPENDS) +libplist +libtasn1 +libusbmuxd
+endef
+
+define Package/libimobiledevice/description
+  $(call Package/libimobiledevice/Default/description)
+endef
+
+define Package/libimobiledevice-utils
+  $(call Package/libimobiledevice/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libimobiledevice
+endef
+
+define Package/libimobiledevice-utils/description
+  $(call Package/libimobiledevice/Default/description)
+  This package contains the libimobiledevice utilities.
+endef
+
+CONFIGURE_VARS += \
+       libusbmuxd_CFLAGS="-I$(STAGING_DIR)/usr/include" \
+       libusbmuxd_LIBS="-L$(STAGING_DIR)/usr/lib -lusbmuxd" \
+       openssl_CFLAGS=" " \
+       openssl_LIBS=" "
+
+CONFIGURE_ARGS += \
+       --without-cython \
+       --disable-largefile \
+       --disable-openssl
+
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libimobiledevice $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libimobiledevice.{a,la,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libimobiledevice-*.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libimobiledevice/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libimobiledevice.so.* $(1)/usr/lib/
+endef
+
+define Package/libimobiledevice-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/idevice* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libimobiledevice))
+$(eval $(call BuildPackage,libimobiledevice-utils))
diff --git a/libs/libinklevel/Makefile b/libs/libinklevel/Makefile
new file mode 100644 (file)
index 0000000..c3012a9
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2006-2010 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:=libinklevel
+PKG_VERSION:=0.8.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libinklevel
+PKG_MD5SUM:=83464cb23fe46a1d1adbe10f08b247be
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libinklevel
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=$(if $(WITH_PARPORT), +libieee1284)
+  TITLE:=Printers Ink Level Library
+  URL:=http://libinklevel.sourceforge.net/
+endef
+
+define Package/libinklevel/description
+  Libinklevel is a library for checking the ink level of your printer on a system which runs Linux.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_LIBS += $(if $(WITH_PARPORT), -lieee1284)
+MAKE_ARGS += LIBS="$(TARGET_LIBS)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/inklevel.h \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libinklevel.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/libinklevel/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libinklevel.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libinklevel))
diff --git a/libs/libinklevel/patches/001-configure.patch b/libs/libinklevel/patches/001-configure.patch
new file mode 100644 (file)
index 0000000..8fda561
--- /dev/null
@@ -0,0 +1,275 @@
+--- a/configure
++++ b/configure
+@@ -12070,7 +12070,7 @@ fi
+ ## Check for optional  header files
+-for ac_header in ifaddrs.h ieee1284.h
++for ac_header in ifaddrs.h
+ do
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+@@ -13690,235 +13690,6 @@ case $host in
+ cat >>confdefs.h <<_ACEOF
+ #define HOST_OS LINUX
+ _ACEOF
+-
+-
+-for ac_header in ieee1284.h
+-do
+-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+-$as_echo_n "checking for $ac_header... " >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  $as_echo_n "(cached) " >&6
+-fi
+-ac_res=`eval 'as_val=${'$as_ac_Header'}
+-               $as_echo "$as_val"'`
+-             { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-else
+-  # Is the header compilable?
+-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+-$as_echo_n "checking $ac_header usability... " >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-#include <$ac_header>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_header_compiler=yes
+-else
+-  $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_header_compiler=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+-$as_echo "$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+-$as_echo_n "checking $ac_header presence... " >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <$ac_header>
+-_ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  ac_header_preproc=yes
+-else
+-  $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-  ac_header_preproc=no
+-fi
+-
+-rm -f conftest.err conftest.$ac_ext
+-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+-$as_echo "$ac_header_preproc" >&6; }
+-
+-# So?  What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+-  yes:no: )
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+-    ac_header_preproc=yes
+-    ;;
+-  no:yes:* )
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+-
+-    ;;
+-esac
+-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+-$as_echo_n "checking for $ac_header... " >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  $as_echo_n "(cached) " >&6
+-else
+-  eval "$as_ac_Header=\$ac_header_preproc"
+-fi
+-ac_res=`eval 'as_val=${'$as_ac_Header'}
+-               $as_echo "$as_val"'`
+-             { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+-$as_echo "$ac_res" >&6; }
+-
+-fi
+-as_val=`eval 'as_val=${'$as_ac_Header'}
+-               $as_echo "$as_val"'`
+-   if test "x$as_val" = x""yes; then
+-  cat >>confdefs.h <<_ACEOF
+-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+-_ACEOF
+-
+-else
+-  { { $as_echo "$as_me:$LINENO: error: ( required header file ieee1284.h missing)" >&5
+-$as_echo "$as_me: error: ( required header file ieee1284.h missing)" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+-
+-done
+-
+-
+-{ $as_echo "$as_me:$LINENO: checking for ieee1284_open in -lieee1284" >&5
+-$as_echo_n "checking for ieee1284_open in -lieee1284... " >&6; }
+-if test "${ac_cv_lib_ieee1284_ieee1284_open+set}" = set; then
+-  $as_echo_n "(cached) " >&6
+-else
+-  ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lieee1284  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char ieee1284_open ();
+-int
+-main ()
+-{
+-return ieee1284_open ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext && {
+-       test "$cross_compiling" = yes ||
+-       $as_test_x conftest$ac_exeext
+-       }; then
+-  ac_cv_lib_ieee1284_ieee1284_open=yes
+-else
+-  $as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_ieee1284_ieee1284_open=no
+-fi
+-
+-rm -rf conftest.dSYM
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
+-LIBS=$ac_check_lib_save_LIBS
+-fi
+-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ieee1284_ieee1284_open" >&5
+-$as_echo "$ac_cv_lib_ieee1284_ieee1284_open" >&6; }
+-if test "x$ac_cv_lib_ieee1284_ieee1284_open" = x""yes; then
+-  cat >>confdefs.h <<_ACEOF
+-#define HAVE_LIBIEEE1284 1
+-_ACEOF
+-
+-  LIBS="-lieee1284 $LIBS"
+-
+-else
+-  { { $as_echo "$as_me:$LINENO: error: Library not found" >&5
+-$as_echo "$as_me: error: Library not found" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+ ;;
+   *-*-solaris2.*)
+--- a/configure.in
++++ b/configure.in
+@@ -60,7 +60,7 @@ fi
+ ## Check for optional  header files
+-AC_CHECK_HEADERS([ifaddrs.h ieee1284.h])
++AC_CHECK_HEADERS([ifaddrs.h])
+ ## Check for mandatory header files
+@@ -95,15 +95,7 @@ AC_TYPE_UINT32_T
+ AC_TYPE_UINT8_T
+ AC_DEFINE_UNQUOTED(LINUX,1,[Define value for Linux OS])
+ AC_DEFINE_UNQUOTED(OPENSOLARIS,2,[Define value for OpenSolaris OS])
+-case $host in
+-  *-*-linux*) AC_DEFINE_UNQUOTED(HOST_OS,LINUX,[Host OS])
+-            AC_CHECK_HEADERS([ieee1284.h],,
+-                              AC_MSG_ERROR(( required header file ieee1284.h missing)))
+-            AC_CHECK_LIB([ieee1284],ieee1284_open,, AC_MSG_ERROR(Library not found),);;
+-
+-  *-*-solaris2.*) AC_DEFINE(HOST_OS,OPENSOLARIS,[HOST OS]);;
+-  *-*-*) AC_MSG_ERROR( Host OS not (yet) supported) ;;
+-esac
++AC_DEFINE_UNQUOTED(HOST_OS,LINUX,[Host OS])
+ ## Variables to be exported
diff --git a/libs/libinklevel/patches/002-disable_parport.patch b/libs/libinklevel/patches/002-disable_parport.patch
new file mode 100644 (file)
index 0000000..72d0338
--- /dev/null
@@ -0,0 +1,55 @@
+--- a/linux.c
++++ b/linux.c
+@@ -16,10 +16,11 @@
+ #include <string.h>
+ #include <sys/ioctl.h>
++#ifdef WITH_PARPORT
+ /* ieee1284.h uses HAVE_IEEE1284_H, so we undefine it */
+ #undef HAVE_IEEE1284_H
+ #include <ieee1284.h>
+-
++#endif
+ #include "internal.h"
+ #include "inklevel.h"
+ #include "platform_specific.h"
+@@ -32,7 +33,9 @@
+ int get_device_id(const int port, const char *device_file, 
+                   const int portnumber, char *device_id) {
++#ifdef WITH_PARPORT
+   struct parport_list parports;
++#endif
+   char tmp[BUFLEN];
+   char device_file1[256];
+   char device_file2[256];
+@@ -41,6 +44,7 @@ int get_device_id(const int port, const 
+   char *c;
+   int realsize;
++#ifdef WITH_PARPORT
+   if (port == PARPORT ) {
+     /* check if we have appropiate permissions */
+@@ -73,7 +77,9 @@ int get_device_id(const int port, const 
+     return COULD_NOT_GET_DEVICE_ID;
+-  } else if (port == USB || port == CUSTOM_USB) {
++  } else
++#endif
++  if (port == USB || port == CUSTOM_USB) {
+     if (port == USB) {
+       sprintf(device_file1, "/dev/usb/lp%d", portnumber);
+@@ -138,8 +144,10 @@ int open_printer_device(const int port, 
+   if (port == USB) {
+     sprintf(device_file1, "/dev/usb/lp%d", portnumber);
+     sprintf(device_file2, "/dev/usblp%d", portnumber);
++#ifdef WITH_PARPORT
+   } else if (port == PARPORT) {
+     sprintf(device_file1, "/dev/lp%d", portnumber);
++#endif
+   } else if (port == CUSTOM_USB) {
+     strncpy(device_file1, device_file, 255);
+     device_file1[255] = '\0';
diff --git a/libs/libinklevel/patches/003-fix_usb_device_location.patch b/libs/libinklevel/patches/003-fix_usb_device_location.patch
new file mode 100644 (file)
index 0000000..7bf78c3
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/linux.c
++++ b/linux.c
+@@ -82,7 +82,7 @@ int get_device_id(const int port, const 
+   if (port == USB || port == CUSTOM_USB) {
+     if (port == USB) {
+-      sprintf(device_file1, "/dev/usb/lp%d", portnumber);
++      sprintf(device_file1, "/dev/lp%d", portnumber);
+       sprintf(device_file2, "/dev/usblp%d", portnumber);
+       fd = open(device_file1, O_RDONLY);
+       if (fd == -1) {
+@@ -142,7 +142,7 @@ int open_printer_device(const int port, 
+   int fd;
+   if (port == USB) {
+-    sprintf(device_file1, "/dev/usb/lp%d", portnumber);
++    sprintf(device_file1, "/dev/lp%d", portnumber);
+     sprintf(device_file2, "/dev/usblp%d", portnumber);
+ #ifdef WITH_PARPORT
+   } else if (port == PARPORT) {
diff --git a/libs/libipfix/Makefile b/libs/libipfix/Makefile
new file mode 100644 (file)
index 0000000..e270de9
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2006 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:=libipfix
+PKG_VERSION:=r51
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
+PKG_MD5SUM:=0e5b2871ea20ac48eda3f6006c5dba28
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libipfix
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=IP Flow Information Export Library
+  URL:=http://www.fokus.fraunhofer.de/de/net/more_about/download/ipfixlib.html
+  BUILDONLY:=1
+endef
+
+TARGET_CFLAGS += \
+       -ffunction-sections -fdata-sections
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CCOPT="$(TARGET_CFLAGS) -I$(BUILD_DIR)/linux/include" \
+               prefix="$(PKG_INSTALL_DIR)/usr" \
+               exec_prefix="$(PKG_INSTALL_DIR)/usr" \
+               all install
+       $(TARGET_CROSS)ranlib $(PKG_INSTALL_DIR)/usr/lib/libipfix.a
+       $(TARGET_CROSS)ranlib $(PKG_INSTALL_DIR)/usr/lib/libipfixmisc.a
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,libipfix))
diff --git a/libs/libipfix/extra/append-wprobe-ie.pl b/libs/libipfix/extra/append-wprobe-ie.pl
new file mode 100644 (file)
index 0000000..8bb658b
--- /dev/null
@@ -0,0 +1,38 @@
+use strict;
+
+my @fields = (
+       [ "_n", "UINT", " - Number of samples", 4 ],
+       [ "_s", "UINT", " - Sum of samples", 8 ],
+       [ "_ss", "UINT", " - Sum of squared samples", 8 ],
+);
+
+my $file = $ARGV[0] or die "Syntax: $0 <file> <start>\n";
+-f $file or die "File not found\n";
+my $start = $ARGV[1];
+$start =~ /^\d+$/ or die "Invalid start number";
+open FILE, "<$file" or die "Can't open file";
+while (<FILE>) {
+       /^(%?)(\w+),\s*(\w+),\s*(.+)$/ and do {
+               my $counter = $1;
+               my $rfield = $2;
+               my $nfield = $3;
+               my $descr = $4;
+               my @f;
+               if ($counter) {
+                       @f = [ "", "UINT", "", 4];
+               } else {
+                       @f = @fields;
+               }
+               foreach my $f (@f) {
+                       my $nr = $start++;
+                       my $n = $f->[0];
+                       my $N = uc $n;
+                       my $ftype = $f->[1];
+                       my $fdesc = $f->[2];
+                       my $size = $f->[3];
+                       print "$nr, IPFIX_FT_WPROBE_$rfield$N, $size, IPFIX_CODING_$ftype, \"$nfield$n\", \"$descr$fdesc\"\n";
+               }
+       };
+}
+close FILE;
+
diff --git a/libs/libipfix/extra/wprobe-ie.txt b/libs/libipfix/extra/wprobe-ie.txt
new file mode 100644 (file)
index 0000000..26d64d2
--- /dev/null
@@ -0,0 +1,14 @@
+NOISE, global_noise, wprobe global noice floor
+PHY_BUSY, global_phy_busy, wprobe global airtime total
+PHY_RX, global_phy_rx, wprobe global airtime total from rx-frame
+PHY_TX, global_phy_tx, wprobe global airtime total from tx-frame
+RSSI, link_rssi, wprobe link received signal strength indication
+SIGNAL, link_signal, wprobe link signal strength in dB
+IEEE_RX_RATE, link_ieee_rx_rate, wprobe link IEEE 802.11 RX data rate
+IEEE_TX_RATE, link_ieee_tx_rate, wprobe link IEEE 802.11 TX data rate
+RETRANSMIT_200, link_retransmit_200, wprobe link total retransmissions per packet - <200 bytes
+RETRANSMIT_400, link_retransmit_400, wprobe link total retransmissions per packet - <400 bytes
+RETRANSMIT_800, link_retransmit_800, wprobe link total retransmissions per packet - <800 bytes
+RETRANSMIT_1600, link_retransmit_1600, wprobe link total retransmissions per packet - >800 bytes
+%FRAMES, global_frames, wprobe global number of 802.11 frames seen
+%PROBEREQ, global_probereq, wprobe global number of 802.11 probe requests seen
diff --git a/libs/libipfix/patches/100-openimp_sync.patch b/libs/libipfix/patches/100-openimp_sync.patch
new file mode 100644 (file)
index 0000000..5b6e2e3
--- /dev/null
@@ -0,0 +1,474 @@
+--- a/lib/ipfix.c
++++ b/lib/ipfix.c
+@@ -37,6 +37,9 @@ $$LIC$$
+ #ifdef SCTPSUPPORT
+ #include <netinet/sctp.h>
+ #endif
++#ifndef NOTHREADS
++#include <pthread.h>
++#endif
+ #include <fcntl.h>
+ #include <netdb.h>
+@@ -123,6 +126,18 @@ static uint16_t           g_lasttid;    
+ static ipfix_datarecord_t g_data = { NULL, NULL, 0 }; /* ipfix_export */
+ static ipfix_field_t      *g_ipfix_fields;
++#ifndef NOTHREADS
++static pthread_mutex_t    g_mutex;
++#define mod_lock()        { \
++                            if ( pthread_mutex_lock( &g_mutex ) !=0 ) \
++                                mlogf( 0, "[ipfix] mutex_lock() failed: %s\n", \
++                                       strerror( errno ) ); \
++                          }
++#define mod_unlock()      {  pthread_mutex_unlock( &g_mutex ); }
++#else
++#define mod_lock()
++#define mod_unlock()
++#endif
+ /*----- prototypes -------------------------------------------------------*/
+@@ -133,6 +148,7 @@ int  _ipfix_send_message( ipfix_t *ifh, 
+                           ipfix_message_t *message );
+ int  _ipfix_write_msghdr( ipfix_t *ifh, ipfix_message_t *msg, iobuf_t *buf );
+ void _ipfix_disconnect( ipfix_collector_t *col );
++int  _ipfix_export_flush( ipfix_t *ifh );
+ /* name      : do_writeselect
+@@ -576,16 +592,18 @@ int ipfix_decode_float( void *in, void *
+ int ipfix_snprint_float( char *str, size_t size, void *data, size_t len )
+ {
+-    float tmp32;
+-    double tmp64;
++    uint32_t tmp32;
++    uint64_t tmp64;
+     switch ( len ) {
+       case 4:
+-          ipfix_decode_float( data, &tmp32, 4);
+-          return snprintf( str, size, "%f", tmp32 );
++          memcpy( &tmp32, data, len );
++          tmp32 = htonl( tmp32 );
++          return snprintf( str, size, "%f", (float)tmp32 );
+       case 8:
+-          ipfix_decode_float( data, &tmp64, 8);
+-          return snprintf( str, size, "%lf", tmp64);
++          memcpy( &tmp64, data, len );
++          tmp64 = HTONLL( tmp64 );
++          return snprintf( str, size, "%lf", (double)tmp64 );
+       default:
+           break;
+     }
+@@ -682,12 +700,19 @@ int ipfix_get_eno_ieid( char *field, int
+  * parameters:
+  * remarks:     init module, read field type info.
+  */
+-int ipfix_init ( void )
++int ipfix_init( void )
+ {
+     if ( g_tstart ) {
+         ipfix_cleanup();
+     }
++#ifndef NOTHREADS
++    if ( pthread_mutex_init( &g_mutex, NULL ) !=0 ) {
++        mlogf( 0, "[ipfix] pthread_mutex_init() failed: %s\n",
++               strerror(errno) );
++        return -1;
++    }
++#endif
+     g_tstart = time(NULL);
+     signal( SIGPIPE, SIG_IGN );
+     g_lasttid = 255;
+@@ -806,6 +831,9 @@ void ipfix_cleanup ( void )
+     g_data.maxfields = 0;
+     g_data.lens  = NULL;
+     g_data.addrs = NULL;
++#ifndef NOTHREADS
++    (void)pthread_mutex_destroy( &g_mutex );
++#endif
+ }
+ int _ipfix_connect ( ipfix_collector_t *col )
+@@ -1465,7 +1493,7 @@ int _ipfix_write_template( ipfix_t      
+       default:
+           /* check space */
+           if ( tsize+ifh->offset > IPFIX_DEFAULT_BUFLEN ) {
+-              if ( ipfix_export_flush( ifh ) < 0 )
++              if ( _ipfix_export_flush( ifh ) < 0 )
+                   return -1;
+               if ( tsize+ifh->offset > IPFIX_DEFAULT_BUFLEN )
+                   return -1;
+@@ -1474,6 +1502,8 @@ int _ipfix_write_template( ipfix_t      
+           /* write template prior to data */
+           if ( ifh->offset > 0 ) {
+               memmove( ifh->buffer + tsize, ifh->buffer, ifh->offset );
++              if ( ifh->cs_tid )
++                  ifh->cs_header += tsize;
+           }
+           buf = ifh->buffer;
+@@ -1615,8 +1645,11 @@ int ipfix_open( ipfix_t **ipfixh, int so
+         return -1;
+     }
+     node->ifh   = i;
++
++    mod_lock();
+     node->next  = g_ipfixlist;
+     g_ipfixlist = node;
++    mod_unlock();
+     *ipfixh = i;
+     return 0;
+@@ -1633,7 +1666,8 @@ void ipfix_close( ipfix_t *h )
+     {
+         ipfix_node_t *l, *n;
+-        ipfix_export_flush( h );
++        mod_lock();
++        _ipfix_export_flush( h );
+         while( h->collectors )
+             _ipfix_drop_collector( (ipfix_collector_t**)&h->collectors );
+@@ -1659,6 +1693,7 @@ void ipfix_close( ipfix_t *h )
+ #endif
+         free(h->buffer);
+         free(h);
++        mod_unlock();
+     }
+ }
+@@ -2156,6 +2191,22 @@ void ipfix_release_template( ipfix_t *if
+     ipfix_delete_template( ifh, templ );
+ }
++static void _finish_cs( ipfix_t *ifh )
++{
++    size_t   buflen;
++    uint8_t  *buf;
++
++    /* finish current dataset */
++    if ( (buf=ifh->cs_header) ==NULL )
++        return;
++    buflen = 0;
++    INSERTU16( buf+buflen, buflen, ifh->cs_tid );
++    INSERTU16( buf+buflen, buflen, ifh->cs_bytes );
++    ifh->cs_bytes = 0;
++    ifh->cs_header = NULL;
++    ifh->cs_tid = 0;
++}
++
+ int ipfix_export( ipfix_t *ifh, ipfix_template_t *templ, ... )
+ {
+     int       i;
+@@ -2199,13 +2250,14 @@ int ipfix_export( ipfix_t *ifh, ipfix_te
+                                g_data.addrs, g_data.lens );
+ }
+-int ipfix_export_array( ipfix_t          *ifh,
+-                        ipfix_template_t *templ,
+-                        int              nfields,
+-                        void             **fields,
+-                        uint16_t         *lengths )
++static int
++_ipfix_export_array( ipfix_t          *ifh,
++                     ipfix_template_t *templ,
++                     int              nfields,
++                     void             **fields,
++                     uint16_t         *lengths )
+ {
+-    int               i;
++    int               i, newset_f=0;
+     size_t            buflen, datasetlen;
+     uint8_t           *p, *buf;
+@@ -2249,7 +2301,19 @@ int ipfix_export_array( ipfix_t         
+     /** get size of data set, check space
+      */
+-    for ( i=0, datasetlen=4; i<nfields; i++ ) {
++    if ( templ->tid == ifh->cs_tid ) {
++        newset_f = 0;
++        datasetlen = 0;
++    }
++    else {
++        if ( ifh->cs_tid > 0 ) {
++            _finish_cs( ifh );
++        }
++        newset_f = 1;
++        datasetlen = 4;
++    }
++
++    for ( i=0; i<nfields; i++ ) {
+         if ( templ->fields[i].flength == IPFIX_FT_VARLEN ) {
+             if ( lengths[i]>254 )
+                 datasetlen += 3;
+@@ -2263,21 +2327,29 @@ int ipfix_export_array( ipfix_t         
+         }
+         datasetlen += lengths[i];
+     }
+-    if ( ((ifh->offset + datasetlen) > IPFIX_DEFAULT_BUFLEN )
+-         && (ipfix_export_flush( ifh ) <0) ) {
+-        return -1;
++
++    if ( (ifh->offset + datasetlen) > IPFIX_DEFAULT_BUFLEN ) {
++        if ( ifh->cs_tid )
++            _finish_cs( ifh );
++        newset_f = 1;
++
++        if ( _ipfix_export_flush( ifh ) <0 )
++            return -1;
+     }
+-    /* fill buffer
+-     */
++    /* fill buffer */
+     buf    = (uint8_t*)(ifh->buffer) + ifh->offset;
+     buflen = 0;
+-    /* insert data set
+-     */
+-    ifh->nrecords ++;
+-    INSERTU16( buf+buflen, buflen, templ->tid );
+-    INSERTU16( buf+buflen, buflen, datasetlen );
++    if ( newset_f ) {
++        /* insert data set
++         */
++        ifh->cs_bytes = 0;
++        ifh->cs_header = buf;
++        ifh->cs_tid = templ->tid;
++        INSERTU16( buf+buflen, buflen, templ->tid );
++        INSERTU16( buf+buflen, buflen, 4 );
++    }
+     /* insert data record
+      */
+@@ -2303,7 +2375,9 @@ int ipfix_export_array( ipfix_t         
+         buflen += lengths[i];
+     }
++    ifh->nrecords ++;
+     ifh->offset += buflen;
++    ifh->cs_bytes += buflen;
+     if ( ifh->version == IPFIX_VERSION )
+         ifh->seqno ++;
+     return 0;
+@@ -2313,7 +2387,7 @@ int ipfix_export_array( ipfix_t         
+  * parameters:
+  * remarks:     rewrite this func!
+  */
+-int ipfix_export_flush( ipfix_t *ifh )
++int _ipfix_export_flush( ipfix_t *ifh )
+ {
+     iobuf_t           *buf;
+     ipfix_collector_t *col;
+@@ -2322,8 +2396,14 @@ int ipfix_export_flush( ipfix_t *ifh )
+     if ( (ifh==NULL) || (ifh->offset==0) )
+         return 0;
+-    if ( (buf=_ipfix_getbuf()) ==NULL )
++    if ( ifh->cs_tid > 0 ) {
++        /* finish current dataset */
++        _finish_cs( ifh );
++    }
++
++    if ( (buf=_ipfix_getbuf()) ==NULL ) {
+         return -1;
++    }
+ #ifdef DEBUG
+     mlogf( 0, "[ipfix_export_flush] msg has %d records, %d bytes\n",
+@@ -2350,3 +2430,30 @@ int ipfix_export_flush( ipfix_t *ifh )
+     _ipfix_freebuf( buf );
+     return ret;
+ }
++
++int ipfix_export_array( ipfix_t          *ifh,
++                        ipfix_template_t *templ,
++                        int              nfields,
++                        void             **fields,
++                        uint16_t         *lengths )
++{
++    int ret;
++
++    mod_lock();
++    ret = _ipfix_export_array( ifh, templ, nfields, fields, lengths );
++    mod_unlock();
++
++    return ret;
++}
++
++int ipfix_export_flush( ipfix_t *ifh )
++{
++    int ret;
++
++    mod_lock();
++    ret = _ipfix_export_flush( ifh );
++    mod_unlock();
++
++    return ret;
++}
++
+--- a/lib/ipfix.h
++++ b/lib/ipfix.h
+@@ -142,6 +142,12 @@ typedef struct
+     int         nrecords;         /* no. of records in buffer */
+     size_t      offset;           /* output buffer fill level */
+     uint32_t    seqno;            /* sequence no. of next message */
++
++    /* experimental */
++    int        cs_tid;            /* template id of current dataset */
++    int        cs_bytes;          /* size of current set */
++    uint8_t    *cs_header;        /* start of current set */
++
+ } ipfix_t;
+ /** exporter funcs
+--- a/lib/ipfix_col.c
++++ b/lib/ipfix_col.c
+@@ -897,6 +897,8 @@ int ipfix_decode_datarecord( ipfixt_node
+             return -1;
+         }
++        n->ipfixt->fields[i].elem->decode(p,p,len);
++
+         data->lens[i]  = len;
+         data->addrs[i] = p;
+@@ -907,7 +909,7 @@ int ipfix_decode_datarecord( ipfixt_node
+     return 0;
+ }
+-static void do_free_datarecord( ipfix_datarecord_t   *data )
++void ipfix_free_datarecord( ipfix_datarecord_t   *data )
+ { 
+     if ( data ) {
+         if ( data->addrs )
+@@ -925,6 +927,7 @@ int ipfix_parse_msg( ipfix_input_t *inpu
+     ipfix_hdr_t          hdr;                  /* ipfix packet header */
+     ipfixs_node_t        *s;
+     ipfix_datarecord_t   data = { NULL, NULL, 0 };
++    ipfixe_node_t        *e;
+     uint8_t              *buf;                 /* ipfix payload */
+     uint16_t             setid, setlen;        /* set id, set lenght */
+     int                  i, nread, offset;     /* counter */
+@@ -1042,6 +1045,12 @@ int ipfix_parse_msg( ipfix_input_t *inpu
+                 err_flag = 1;
+             } 
+             else {
++                for ( e=g_exporter; e!=NULL; e=e->next ) {
++                    if ( e->elem->export_dset )
++                        (void) e->elem->export_dset( t, buf+nread, setlen,
++                                                     e->elem->data );
++                }
++
+                 /** read data records
+                  */
+                 for ( offset=nread, bytesleft=setlen; bytesleft>4; ) {
+@@ -1076,11 +1085,11 @@ int ipfix_parse_msg( ipfix_input_t *inpu
+         goto errend;
+  end:
+-    do_free_datarecord( &data );
++    ipfix_free_datarecord( &data );
+     return nread;
+  errend:
+-    do_free_datarecord( &data );
++    ipfix_free_datarecord( &data );
+     return -1;
+ }
+@@ -1093,7 +1102,7 @@ void process_client_tcp( int fd, int mas
+     tcp_conn_t   *tcon = (tcp_conn_t*)data;
+     char         *func = "process_client_tcp";
+-    mlogf( 3,  "[%s] fd %d mask %d called.\n", func, fd, mask );
++    mlogf( 4,  "[%s] fd %d mask %d called.\n", func, fd, mask );
+     /** read ipfix header 
+      */
+--- a/lib/ipfix_col.h
++++ b/lib/ipfix_col.h
+@@ -88,6 +88,7 @@ typedef struct ipfix_col_info
+     int (*export_newsource)(ipfixs_node_t*,void*);
+     int (*export_newmsg)(ipfixs_node_t*,ipfix_hdr_t*,void*);
+     int (*export_trecord)(ipfixs_node_t*,ipfixt_node_t*,void*);
++    int (*export_dset)(ipfixt_node_t*,uint8_t*,size_t,void*);
+     int (*export_drecord)(ipfixs_node_t*,ipfixt_node_t*,
+                           ipfix_datarecord_t*,void*);
+     void (*export_cleanup)(void*);
+--- a/lib/ipfix_col_files.c
++++ b/lib/ipfix_col_files.c
+@@ -68,7 +68,7 @@ static int export_newsource_file( ipfixs
+             return -1;
+         }
+         snprintf( s->fname+strlen(s->fname), PATH_MAX-strlen(s->fname),
+-                  "/%u", s->odid );
++                  "/%u", (unsigned int)s->odid );
+         if ( (access( s->fname, R_OK ) <0 )
+              && (mkdir( s->fname, S_IRWXU ) <0) ) {
+             mlogf( 0, "[%s] cannot access dir '%s': %s\n",
+--- a/lib/ipfix_FOKUS_IEs.txt
++++ b/lib/ipfix_FOKUS_IEs.txt
+@@ -24,6 +24,8 @@
+ 196, IPFIX_FT_PKTID,                4, IPFIX_CODING_UINT, "pktId", "FOKUS packet id"
+ 197, IPFIX_FT_STARTTIME,            4, IPFIX_CODING_INT, "startTime", "FOKUS interval start"
+ 198, IPFIX_FT_ENDTIME,              4, IPFIX_CODING_INT, "endTime", "FOKUS interval end"
++199, IPFIX_FT_RTT_USEC,             8, IPFIX_CODING_UINT, "rtt_usec", "FOKUS rtt in us"
++
+ 300, IPFIX_FT_FLOWCREATIONTIMEUSEC, 4, IPFIX_CODING_INT, "flowCreationTimeUsec", "FOKUS flow start usec fraction"
+ 301, IPFIX_FT_FLOWENDTIMEUSEC,      4, IPFIX_CODING_INT, "flowEndTimeUsec", "FOKUS flow end usec fraction"
+ 303, IPFIX_FT_TC_PACKETS,           4, IPFIX_CODING_UINT, "tcPackets", "DAIDALOS Packets seen"
+@@ -39,3 +41,48 @@
+ 313, IPFIX_FT_OWDVARMIN_NSEC,       4, IPFIX_CODING_INT, "owdvarmin_nsec", "FOKUS minimum owd variance in ns"
+ 314, IPFIX_FT_OWDVARMAX_NSEC,       4, IPFIX_CODING_INT, "owdvarmax_nsec", "FOKUS maximum ow variance in ns"
++# Project INTERSECTION
++315, IPFIX_FT_SOURCEIPV4FANOUT,     4, IPFIX_CODING_UINT,"sourceIPv4FanOut", "FOKUS IPv4 fanout"
++316, IPFIX_FT_DESTINATIONIPV4FANIN, 4, IPFIX_CODING_UINT,"destinationIPv4FanIn", "FOKUS IPv4 fanin"
++
++# Project PRISM
++
++330, IPFIX_FT_PR_SESSIONID,   4, IPFIX_CODING_UINT, "sessionId", "PRISM Session ID"
++331, IPFIX_FT_PR_TRANSACTIONID, 4, IPFIX_CODING_UINT, "transactionId", "PRISM Transaction ID"
++332, IPFIX_FT_PR_ENCRYPTEDDATA, 65535, IPFIX_CODING_STRING, "encryptedData", "PRISM encrypted data"
++333, IPFIX_FT_PR_DECRYPTIONKEY, 65535, IPFIX_CODING_STRING, "decryptionKey", "PRISM decryption key"
++334, IPFIX_FT_PR_KEYSHARE,      65535, IPFIX_CODING_STRING, "keyShare", "PRISM key share"
++335, IPFIX_FT_PR_KEYSHAREADP,   65535, IPFIX_CODING_STRING, "keyShareAdp", "PRISM key share ADP"
++336, IPFIX_FT_PR_INITVECTOR,    65535, IPFIX_CODING_STRING, "cryptoInitVector", "PRISM crypto init vector"
++
++
++# these information elements have been defined by FOKUS for the Oracle project
++
++402, IPFIX_FT_ORsignalBandwidth, 4, IPFIX_CODING_UINT, "ORsignalBandwidth", "signal bandwidth" 
++403, IPFIX_FT_ORsignalPower, 2, IPFIX_CODING_UINT, "ORsignalPower", "ERIP" 
++404, IPFIX_FT_ORmodulationType, 2, IPFIX_CODING_UINT, "ORmodulationType", "AM/FM,.."
++405, IPFIX_FT_ORsymbolRate, 2, IPFIX_CODING_UINT, "ORsymbolRate", "symbol rate"
++406, IPFIX_FT_ORmodulationOrder, 1, IPFIX_CODING_UINT, "ORmodulationOrder", "number of levels"
++407, IPFIX_FT_ORrolloffFactor, 2, IPFIX_CODING_UINT, "ORrolloffFactor", "roll of factor"
++408, IPFIX_FT_ORgeopositionLon, 4, IPFIX_CODING_UINT, "ORgeopositionLon", "GPS coordinate, resolution 1 cm"
++409, IPFIX_FT_ORgeopositionLat, 4, IPFIX_CODING_UINT, "ORgeopositionLat", "GPS coordinate, resolution 1 cm"
++410, IPFIX_FT_ORgeopositionElev, 4, IPFIX_CODING_UINT, "ORgeopositionElev", "GPS coordinate, resolution 1 cm"
++411, IPFIX_FT_ORpolicyRecord, 65535, IPFIX_CODING_STRING, "ORpolicyRecord", "policy record has variable length, First 8 bits in data describe the length (in bytes) of the field"
++420, IPFIX_FT_channel_status, 1, IPFIX_CODING_UINT, "channel_status", vacancy of the scanned channel (1: channel busy, 0: channel idle)"
++421, IPFIX_FT_sensing_value, 2, IPFIX_CODING_UINT, "sensing_value", "Cost function output"
++422, IPFIX_FT_sensing_threshold, 2, IPFIX_CODING_UINT, "sensing_threshold", "Decision threshold"
++423, IPFIX_FT_OR_terminal_id, 1, IPFIX_CODING_UINT, "OR_terminal_id", "terminal identifier"
++424, IPFIX_FT_OR_terminal_id_list, 65535, IPFIX_CODING_STRING, "OR_terminal_id_list", "terminal identifier list"
++425, IPFIX_FT_Infrastructure_network_id, 1, IPFIX_CODING_UINT, "Infrastructure_network_id", "network identifier"
++426, IPFIX_FT_Infrastructure_network_type, 1, IPFIX_CODING_UINT, "Infrastructure_network_type", "network type (GSM - 1, UMTS - 2, WiMAX - 3, WiFi - 4)" 
++427, IPFIX_FT_Battery_lifetime_min, 1, IPFIX_CODING_UINT, "Battery_lifetime_min", "expected battery lifetime to provide requested services or functionalities, in minutes"
++428, IPFIX_FT_Battery_lifetime_h, 1, IPFIX_CODING_UINT, "Battery_lifetime_h", "expected battery lifetime to provide requested services or functionalities, in hours"
++429, IPFIX_FT_Battery_status, 1, IPFIX_CODING_UINT, "Battery_status", "expected battery lifetime to provide requested services or functionalities, 1 bit status flag, values 1 or 0"
++430, IPFIX_FT_Cell_id_number, 4, IPFIX_CODING_UINT, "Cell_id_number", "16-32 bit cell id number, identifier"
++431, IPFIX_FT_Spectral_allocation_vector, 1, IPFIX_CODING_UINT, "Spectral_allocation_vector", "binary vector to indicate whether a band is free 1 bit 0 or not 1 bit 1"
++432, IPFIX_FT_Spectral_allocation_profile, 2, IPFIX_CODING_UINT, "Spectral_allocation_profile", "received power spectral density vs. frequency to indicate spectral activity in the band of interest (8-16 bits per discrete frequency value)"
++433, IPFIX_FT_Center_frequency, 2, IPFIX_CODING_UINT, "Center_frequency", "Center frequency of the sensed band"
++434, IPFIX_FT_Bandwidth_of_CAP, 2, IPFIX_CODING_UINT, "Bandwidth_of_CAP", "Bandwidth of the spectral allocation profile"
++435, IPFIX_FT_ORmodulation, 1, IPFIX_CODING_UINT, "ORmodulation", "CREST factor"
++436, IPFIX_FT_ORprofileRecord, 65535, IPFIX_CODING_STRING, "ORprofileRecord", "profile record has variable length, First 8 bits in data describe the length (in bytes) of the field"
++
diff --git a/libs/libipfix/patches/110-wprobe_ie.patch b/libs/libipfix/patches/110-wprobe_ie.patch
new file mode 100644 (file)
index 0000000..5e37280
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/lib/ipfix_FOKUS_IEs.txt
++++ b/lib/ipfix_FOKUS_IEs.txt
+@@ -86,3 +86,41 @@
+ 435, IPFIX_FT_ORmodulation, 1, IPFIX_CODING_UINT, "ORmodulation", "CREST factor"
+ 436, IPFIX_FT_ORprofileRecord, 65535, IPFIX_CODING_STRING, "ORprofileRecord", "profile record has variable length, First 8 bits in data describe the length (in bytes) of the field"
++500, IPFIX_FT_WPROBE_NOISE_N, 4, IPFIX_CODING_UINT, "global_noise_n", "wprobe global noice floor - Number of samples"
++501, IPFIX_FT_WPROBE_NOISE_S, 8, IPFIX_CODING_UINT, "global_noise_s", "wprobe global noice floor - Sum of samples"
++502, IPFIX_FT_WPROBE_NOISE_SS, 8, IPFIX_CODING_UINT, "global_noise_ss", "wprobe global noice floor - Sum of squared samples"
++503, IPFIX_FT_WPROBE_PHY_BUSY_N, 4, IPFIX_CODING_UINT, "global_phy_busy_n", "wprobe global airtime total - Number of samples"
++504, IPFIX_FT_WPROBE_PHY_BUSY_S, 8, IPFIX_CODING_UINT, "global_phy_busy_s", "wprobe global airtime total - Sum of samples"
++505, IPFIX_FT_WPROBE_PHY_BUSY_SS, 8, IPFIX_CODING_UINT, "global_phy_busy_ss", "wprobe global airtime total - Sum of squared samples"
++506, IPFIX_FT_WPROBE_PHY_RX_N, 4, IPFIX_CODING_UINT, "global_phy_rx_n", "wprobe global airtime total from rx-frame - Number of samples"
++507, IPFIX_FT_WPROBE_PHY_RX_S, 8, IPFIX_CODING_UINT, "global_phy_rx_s", "wprobe global airtime total from rx-frame - Sum of samples"
++508, IPFIX_FT_WPROBE_PHY_RX_SS, 8, IPFIX_CODING_UINT, "global_phy_rx_ss", "wprobe global airtime total from rx-frame - Sum of squared samples"
++509, IPFIX_FT_WPROBE_PHY_TX_N, 4, IPFIX_CODING_UINT, "global_phy_tx_n", "wprobe global airtime total from tx-frame - Number of samples"
++510, IPFIX_FT_WPROBE_PHY_TX_S, 8, IPFIX_CODING_UINT, "global_phy_tx_s", "wprobe global airtime total from tx-frame - Sum of samples"
++511, IPFIX_FT_WPROBE_PHY_TX_SS, 8, IPFIX_CODING_UINT, "global_phy_tx_ss", "wprobe global airtime total from tx-frame - Sum of squared samples"
++512, IPFIX_FT_WPROBE_RSSI_N, 4, IPFIX_CODING_UINT, "link_rssi_n", "wprobe link received signal strength indication - Number of samples"
++513, IPFIX_FT_WPROBE_RSSI_S, 8, IPFIX_CODING_UINT, "link_rssi_s", "wprobe link received signal strength indication - Sum of samples"
++514, IPFIX_FT_WPROBE_RSSI_SS, 8, IPFIX_CODING_UINT, "link_rssi_ss", "wprobe link received signal strength indication - Sum of squared samples"
++515, IPFIX_FT_WPROBE_SIGNAL_N, 4, IPFIX_CODING_UINT, "link_signal_n", "wprobe link signal strength in dB - Number of samples"
++516, IPFIX_FT_WPROBE_SIGNAL_S, 8, IPFIX_CODING_UINT, "link_signal_s", "wprobe link signal strength in dB - Sum of samples"
++517, IPFIX_FT_WPROBE_SIGNAL_SS, 8, IPFIX_CODING_UINT, "link_signal_ss", "wprobe link signal strength in dB - Sum of squared samples"
++518, IPFIX_FT_WPROBE_IEEE_RX_RATE_N, 4, IPFIX_CODING_UINT, "link_ieee_rx_rate_n", "wprobe link IEEE 802.11 RX data rate - Number of samples"
++519, IPFIX_FT_WPROBE_IEEE_RX_RATE_S, 8, IPFIX_CODING_UINT, "link_ieee_rx_rate_s", "wprobe link IEEE 802.11 RX data rate - Sum of samples"
++520, IPFIX_FT_WPROBE_IEEE_RX_RATE_SS, 8, IPFIX_CODING_UINT, "link_ieee_rx_rate_ss", "wprobe link IEEE 802.11 RX data rate - Sum of squared samples"
++521, IPFIX_FT_WPROBE_IEEE_TX_RATE_N, 4, IPFIX_CODING_UINT, "link_ieee_tx_rate_n", "wprobe link IEEE 802.11 TX data rate - Number of samples"
++522, IPFIX_FT_WPROBE_IEEE_TX_RATE_S, 8, IPFIX_CODING_UINT, "link_ieee_tx_rate_s", "wprobe link IEEE 802.11 TX data rate - Sum of samples"
++523, IPFIX_FT_WPROBE_IEEE_TX_RATE_SS, 8, IPFIX_CODING_UINT, "link_ieee_tx_rate_ss", "wprobe link IEEE 802.11 TX data rate - Sum of squared samples"
++524, IPFIX_FT_WPROBE_RETRANSMIT_200_N, 4, IPFIX_CODING_UINT, "link_retransmit_200_n", "wprobe link total retransmissions per packet - <200 bytes - Number of samples"
++525, IPFIX_FT_WPROBE_RETRANSMIT_200_S, 8, IPFIX_CODING_UINT, "link_retransmit_200_s", "wprobe link total retransmissions per packet - <200 bytes - Sum of samples"
++526, IPFIX_FT_WPROBE_RETRANSMIT_200_SS, 8, IPFIX_CODING_UINT, "link_retransmit_200_ss", "wprobe link total retransmissions per packet - <200 bytes - Sum of squared samples"
++527, IPFIX_FT_WPROBE_RETRANSMIT_400_N, 4, IPFIX_CODING_UINT, "link_retransmit_400_n", "wprobe link total retransmissions per packet - <400 bytes - Number of samples"
++528, IPFIX_FT_WPROBE_RETRANSMIT_400_S, 8, IPFIX_CODING_UINT, "link_retransmit_400_s", "wprobe link total retransmissions per packet - <400 bytes - Sum of samples"
++529, IPFIX_FT_WPROBE_RETRANSMIT_400_SS, 8, IPFIX_CODING_UINT, "link_retransmit_400_ss", "wprobe link total retransmissions per packet - <400 bytes - Sum of squared samples"
++530, IPFIX_FT_WPROBE_RETRANSMIT_800_N, 4, IPFIX_CODING_UINT, "link_retransmit_800_n", "wprobe link total retransmissions per packet - <800 bytes - Number of samples"
++531, IPFIX_FT_WPROBE_RETRANSMIT_800_S, 8, IPFIX_CODING_UINT, "link_retransmit_800_s", "wprobe link total retransmissions per packet - <800 bytes - Sum of samples"
++532, IPFIX_FT_WPROBE_RETRANSMIT_800_SS, 8, IPFIX_CODING_UINT, "link_retransmit_800_ss", "wprobe link total retransmissions per packet - <800 bytes - Sum of squared samples"
++533, IPFIX_FT_WPROBE_RETRANSMIT_1600_N, 4, IPFIX_CODING_UINT, "link_retransmit_1600_n", "wprobe link total retransmissions per packet - >800 bytes - Number of samples"
++534, IPFIX_FT_WPROBE_RETRANSMIT_1600_S, 8, IPFIX_CODING_UINT, "link_retransmit_1600_s", "wprobe link total retransmissions per packet - >800 bytes - Sum of samples"
++535, IPFIX_FT_WPROBE_RETRANSMIT_1600_SS, 8, IPFIX_CODING_UINT, "link_retransmit_1600_ss", "wprobe link total retransmissions per packet - >800 bytes - Sum of squared samples"
++536, IPFIX_FT_WPROBE_FRAMES, 4, IPFIX_CODING_UINT, "global_frames", "wprobe global number of 802.11 frames seen"
++537, IPFIX_FT_WPROBE_PROBEREQ, 4, IPFIX_CODING_UINT, "global_probereq", "wprobe global number of 802.11 probe requests seen"
diff --git a/libs/libipfix/patches/120-ipfixmisc.patch b/libs/libipfix/patches/120-ipfixmisc.patch
new file mode 100644 (file)
index 0000000..e3f5a05
--- /dev/null
@@ -0,0 +1,27 @@
+Index: libipfix.r51/lib/Makefile.in
+===================================================================
+--- libipfix.r51.orig/lib/Makefile.in  2008-08-05 15:15:23.000000000 +0200
++++ libipfix.r51/lib/Makefile.in       2012-06-05 19:26:34.061692890 +0200
+@@ -41,7 +41,7 @@
+ INCLS = -I. -I..
+ CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
+-TARGETS = libmisc.a libipfix.a
++TARGETS = libipfixmisc.a libipfix.a
+ OBJS = ipfix.o ipfix_col.o ipfix_print.o \
+        ipfix_col_files.o ipfix_col_db.o @IPFIX_DB_OBJ@ @IPFIX_SSL_OBJ@
+ DEPHDR = ipfix.h ipfix_def.h ipfix_fields.h ipfix_def_fokus.h ipfix_fields_fokus.h
+@@ -60,11 +60,11 @@
+ install:
+       @[ -d ${libdir} ] || (mkdir -p ${libdir}; chmod 755 ${libdir})
+       $(INSTALL_DATA) libipfix.a ${libdir}/
+-      $(INSTALL_DATA) libmisc.a ${libdir}/
++      $(INSTALL_DATA) libipfixmisc.a ${libdir}/
+       @[ -d ${includedir} ] || (mkdir -p ${includedir}; chmod 755 ${includedir})
+       $(INSTALL_HEADER) ipfix*.h mlog.h mpoll.h ${includedir}/
+-libmisc.a: $(MISCOBJS) Makefile
++libipfixmisc.a: $(MISCOBJS) Makefile
+       @rm -f $@
+       $(AR) rc $@ $(MISCOBJS) 
diff --git a/libs/libipfix/patches/130-fix-string-problems.patch b/libs/libipfix/patches/130-fix-string-problems.patch
new file mode 100644 (file)
index 0000000..ab967ec
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/lib/mlog.c
++++ b/lib/mlog.c
+@@ -60,7 +60,7 @@ void debugf ( char fmt[], ... )
+     va_end(args);
+     fprintf ( stderr, "DEBUG <" );
+-    fprintf ( stderr, tmpbuf );
++    fprintf ( stderr, "%s", tmpbuf );
+     fprintf ( stderr, ">\n" );
+     fflush  ( stderr );
+ #endif
+@@ -80,7 +80,7 @@ void errorf ( char fmt[], ... )
+     (void) vsnprintf( tmpbuf, sizeof(tmpbuf), fmt, args );
+     va_end(args);
+-    fprintf ( stderr, tmpbuf );
++    fprintf ( stderr, "%s", tmpbuf );
+ }
+ /*--------------------------------------------------
+@@ -104,7 +104,7 @@ void mlogf ( int vlevel, char fmt[], ...
+     (void) vsnprintf( tmpbuf, sizeof(tmpbuf), fmt, args );
+     va_end(args);
+-    fprintf( mlog_fp, tmpbuf );
++    fprintf( mlog_fp, "%s", tmpbuf );
+     if ( mlog_vlevel > 1 )
+         fflush( mlog_fp );
+ }
diff --git a/libs/liblo/Makefile b/libs/liblo/Makefile
new file mode 100644 (file)
index 0000000..a76f191
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (C) 2010 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:=liblo
+PKG_VERSION:=0.26
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/liblo
+PKG_MD5SUM:=5351de14262560e15e7f23865293b16f
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/liblo/Default
+  SUBMENU:=Sound
+  TITLE:=Lightweight Open Sound Control (OSC)
+  URL:=http://liblo.sourceforge.net/
+endef
+
+define Package/liblo
+$(call Package/liblo/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+  DEPENDS:= +libpthread
+endef
+
+define Package/liblo-utils
+$(call Package/liblo/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= utilities
+  DEPENDS:= +liblo
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/include/lo \
+               $(1)/usr/include/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/liblo.so* \
+               $(1)/usr/lib/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/pkgconfig/liblo.pc \
+               $(1)/usr/lib/pkgconfig/ \
+       )
+endef
+
+define Package/liblo/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/liblo.so.* \
+               $(1)/usr/lib/ \
+       )
+endef
+
+define Package/liblo-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/bin/oscdump \
+               ./usr/bin/oscsend \
+               $(1)/usr/bin/ \
+       )
+endef
+
+$(eval $(call BuildPackage,liblo))
+$(eval $(call BuildPackage,liblo-utils))
diff --git a/libs/libmbus/Makefile b/libs/libmbus/Makefile
new file mode 100644 (file)
index 0000000..08468e8
--- /dev/null
@@ -0,0 +1,105 @@
+#
+# Copyright (C) 2011-2012 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:=libmbus
+PKG_VERSION:=0.7.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.freescada.com/public-dist/
+PKG_MD5SUM:=2f1a7ba0ccd683e6708364a13310a6d1
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libmbus/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.freescada.com/libmbus/
+  TITLE:=mbus-tools
+endef
+
+define Package/libmbus/Default/description
+  libmbus is an open source M-bus (Meter-Bus) library.
+  The Meter-Bus is a standard for reading out meter data from
+  electricity meters, heat meters, gas meters, etc.
+endef
+
+define Package/libmbus
+  $(call Package/libmbus/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libmbus
+endef
+
+define Package/libmbus/description
+  $(call Package/libmbus/Default/description)
+
+  This package contains the M-bus shared library, used by other programs.
+endef
+
+define Package/mbus-serial
+  $(call Package/libmbus/Default)
+  DEPENDS+=+libmbus
+  TITLE+= (serial)
+endef
+
+define Package/mbus-serial/description
+  $(call Package/libmbus/Default/description)
+
+  This package contains command line tools for scanning the M-bus
+  and retrieving data from meters which are connected through a
+  serial (e.g. RS232) interface.
+endef
+
+define Package/mbus-tcp
+  $(call Package/libmbus/Default)
+  DEPENDS+=+libmbus
+  TITLE+= (tcp)
+endef
+
+define Package/mbus-tcp/description
+  $(call Package/libmbus/Default/description)
+
+  This package contains command line tools for scanning the M-bus
+  and retrieving data from meters which are accessible through
+  M-bus gateways via TCP.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/mbus $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmbus.{so*,la} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmbus.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libmbus/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmbus.so* $(1)/usr/lib/
+endef
+
+define Package/mbus-serial/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbus-serial-* $(1)/usr/bin/
+endef
+
+define Package/mbus-tcp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbus-tcp-* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libmbus))
+$(eval $(call BuildPackage,mbus-serial))
+$(eval $(call BuildPackage,mbus-tcp))
diff --git a/libs/libmcrypt/Makefile b/libs/libmcrypt/Makefile
new file mode 100644 (file)
index 0000000..e676daf
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2006-2010 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:=libmcrypt
+PKG_VERSION:=2.5.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/mcrypt
+PKG_MD5SUM:=c4f491dd411a09e9de3b8702ea6f73eb
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/libmcrypt
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Cryptographic library
+  URL:=http://mcrypt.sourceforge.net/
+endef
+
+define Package/libmcrypt/description
+       libmcrypt is a cryptographic library that conveniently brings
+       together a variety of ciphers for convenient use.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmcrypt.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libmcrypt-config $(1)/usr/bin/
+       $(SED) 's,-I$$$${prefix}/include,,g' $(1)/usr/bin/libmcrypt-config
+       $(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/libmcrypt-config
+endef
+
+define Package/libmcrypt/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmcrypt.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libmcrypt))
diff --git a/libs/libmicrohttpd/Makefile b/libs/libmicrohttpd/Makefile
new file mode 100644 (file)
index 0000000..1f9f9d6
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2011-2012 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:=libmicrohttpd
+PKG_VERSION:=0.9.19
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/libmicrohttpd
+PKG_MD5SUM:=0f4c55ba224ce75b3b993b558e072a6b
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libmicrohttpd
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Microhttpd
+  URL:=http://www.gnu.org/software/libmicrohttpd
+  DEPENDS:=+libpthread
+endef
+
+define Package/libmicrohttpd/description
+ GNU libmicrohttpd is a small C library that is supposed to make it easy to run an HTTP server as part of another application.
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-curl \
+       --disable-https \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/microhttpd.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmicrohttpd.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmicrohttpd.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libmicrohttpd/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmicrohttpd.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libmicrohttpd))
diff --git a/libs/libmicroxml/Makefile b/libs/libmicroxml/Makefile
new file mode 100644 (file)
index 0000000..559cc75
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2012 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:=libmicroxml
+PKG_VERSION:=2012-06-11
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://dev.freecwmp.org/microxml
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=72965423184f24cc0b963d91c2d1863cdb01b6aa
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libmicroxml
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=XML library
+endef
+
+define Package/libmicroxml/description
+ A micro sized XML library
+endef
+
+CONFIGURE_ARGS += \
+       --disable-threads \
+       --enable-static \
+       --enable-shared
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/microxml.h $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libmicroxml.so* $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_BUILD_DIR)/microxml.pc $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libmicroxml/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libmicroxml.so* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,libmicroxml))
diff --git a/libs/libmikmod/Makefile b/libs/libmikmod/Makefile
new file mode 100644 (file)
index 0000000..50d7a3c
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2010-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:=libmikmod
+PKG_VERSION:=3.1.12
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://prdownloads.sourceforge.net/mikmod
+PKG_MD5SUM:=9f3c740298260d5f88981fc0d51f6f16
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libmikmod
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Mikmod sound library
+  URL:=http://mikmod.raphnet.net/
+  DEPENDS:=+alsa-lib +libpthread
+endef
+
+define Package/libmikmod/description
+  Mikmod is a library supporting many formats, including mod, s3m, it, and xm.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-af \
+               --enable-alsa \
+               --disable-oss \
+               --disable-esd \
+               --disable-sam9407 \
+               --disable-ultra \
+               --enable-dl \
+               --disable-debug \
+               --enable-threads \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/mikmod.h \
+               $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libmikmod.{a,la,so*} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/libmikmod-config \
+               $(2)/bin
+
+       $(SED) 's,^\(exec_prefix\|prefix\)=.*,\1=\"$(STAGING_DIR)/usr/\",g' \
+               $(2)/bin/libmikmod-config
+
+       $(INSTALL_DIR) $(1)/usr/share/aclocal
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/aclocal/* \
+               $(1)/usr/share/aclocal/
+endef
+
+define Package/libmikmod/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmikmod.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libmikmod))
diff --git a/libs/libmikmod/patches/001-disable-doc.patch b/libs/libmikmod/patches/001-disable-doc.patch
new file mode 100644 (file)
index 0000000..723102b
--- /dev/null
@@ -0,0 +1,21 @@
+--- libmikmod-3.1.12/Makefile.am       2004-01-21 17:43:53.000000000 +0000
++++ libmikmod-3.1.12/Makefile.am.new   2010-07-03 12:12:51.946725127 +0000
+@@ -1,6 +1,6 @@
+ AUTOMAKE_OPTIONS = foreign
+ SUBDIRS = drivers include libmikmod loaders mmio playercode \
+-          docs dlapi macintosh posix os2 win32
++          dlapi macintosh posix os2 win32
+ bin_SCRIPTS = libmikmod-config
+--- libmikmod-3.1.12/Makefile.in       2004-01-21 17:43:53.000000000 +0000
++++ libmikmod-3.1.12/Makefile.in.new   2010-07-03 12:12:39.626725146 +0000
+@@ -86,7 +86,7 @@
+ VERSION = @VERSION@
+ AUTOMAKE_OPTIONS = foreign
+-SUBDIRS = drivers include libmikmod loaders mmio playercode           docs dlapi macintosh posix os2 win32
++SUBDIRS = drivers include libmikmod loaders mmio playercode dlapi macintosh posix os2 win32
+ bin_SCRIPTS = libmikmod-config
diff --git a/libs/libmikmod/patches/003-automake-compat.patch b/libs/libmikmod/patches/003-automake-compat.patch
new file mode 100644 (file)
index 0000000..bf94fca
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/libmikmod-config.in
++++ b/libmikmod-config.in
+@@ -1,4 +1,4 @@
+-#! /bin/sh
++#! @SHELL@
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+--- a/libmikmod/Makefile.in
++++ b/libmikmod/Makefile.in
+@@ -1,3 +1,5 @@
++SHELL = @SHELL@
++
+ exec_prefix=@exec_prefix@
+ prefix=@prefix@
diff --git a/libs/libmpcdec/Makefile b/libs/libmpcdec/Makefile
new file mode 100644 (file)
index 0000000..b63b0f0
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2007-2009 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:=libmpcdec
+PKG_VERSION:=1.2.6
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://files.musepack.net/source/
+PKG_MD5SUM:=7f7a060e83b4278acf4b77d7a7b9d2c0
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/libmpcdec
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Musepack decoder library
+  URL:=http://www.musepack.net
+endef
+
+define Package/libmpcdec/description
+       Musepack decoder library
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/mpcdec/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/mpcdec/*.h \
+               $(1)/usr/include/mpcdec/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} \
+               $(1)/usr/lib/
+endef
+
+define Package/libmpcdec/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libmpcdec.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libmpcdec))
diff --git a/libs/libmpcdec/patches/001-automake-compat.patch b/libs/libmpcdec/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..4cb4c5a
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -4,6 +4,7 @@ AC_CONFIG_AUX_DIR(config)
+ AM_INIT_AUTOMAKE(libmpcdec,1.2.6)
+ AM_CONFIG_HEADER(include/config.h)
++AC_PROG_CXX
+ AM_PROG_LIBTOOL
+ CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -fPIC"
diff --git a/libs/libmpcdec/patches/100-fixed_point.patch b/libs/libmpcdec/patches/100-fixed_point.patch
new file mode 100644 (file)
index 0000000..0f7752f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/include/mpcdec/math.h
++++ b/include/mpcdec/math.h
+@@ -38,7 +38,7 @@
+ #ifndef _mpcdec_math_h_
+ #define _mpcdec_math_h_
+-//#define MPC_FIXED_POINT
++#define MPC_FIXED_POINT
+ #define MPC_FIXED_POINT_SHIFT 16
diff --git a/libs/libmpd/Makefile b/libs/libmpd/Makefile
new file mode 100644 (file)
index 0000000..627db34
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2007-2010 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:=libmpd
+PKG_VERSION:=0.20.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.sarine.nl/Programs/gmpc/$(PKG_VERSION)/
+PKG_MD5SUM:=2f1c99e12c69f7d95cfd1e27368056ed
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/libmpd
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+glib2
+  TITLE:=Libmpd is an a library to easily connect to a mpd server
+  URL:=http://gmpc.wikia.com/wiki/LIBMPD_RELEASES
+endef
+
+define Package/libmpd/description
+It's wraps around libmpdclient and provides a higher level api.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libmpd-1.0 $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmpd.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmpd.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libmpd/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmpd.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libmpd))
diff --git a/libs/libnatpmp/Makefile b/libs/libnatpmp/Makefile
new file mode 100644 (file)
index 0000000..40d7b75
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (C) 2011-2012 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:=libnatpmp
+PKG_VERSION:=20110808
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://miniupnp.free.fr/files
+PKG_MD5SUM:=22a1225b890471a7750a9bf26eb863f7
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnatpmp/Default
+  TITLE:=NAT Port Mapping Protocol (NAT-PMP)
+  URL:=http://miniupnp.free.fr/libnatpmp.html
+endef
+
+define Package/libnatpmp/Default/description
+  libnatpmp is an attempt to make a portable and fully compliant implementation
+  of the protocol for the client side. It is based on non blocking sockets and
+  all calls of the API are asynchronous. It is therefore very easy to integrate
+  the NAT-PMP code to any event driven code.
+endef
+
+define Package/libnatpmp
+  $(call Package/libnatpmp/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+endef
+
+define Package/libnatpmp/description
+  $(call Package/libnatpmp/Default/description)
+  This package contains the shared library.
+endef
+
+define Package/natpmpc
+  $(call Package/libnatpmp/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall
+  TITLE+= client
+  DEPENDS:=+libnatpmp
+endef
+
+define Package/natpmpc/description
+  $(call Package/libnatpmp/Default/description)
+  This package contains the natpmp client.
+endef
+
+MAKE_FLAGS += \
+       COPTS="$(TARGET_CFLAGS)" \
+       PREFIX="$(PKG_INSTALL_DIR)" \
+       OS="Linux"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/natpmp.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp*.{so*,a} $(1)/usr/lib/
+endef
+
+define Package/libnatpmp/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libnatpmp.so.* $(1)/usr/lib/
+endef
+
+define Package/natpmpc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/natpmpc $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libnatpmp))
+$(eval $(call BuildPackage,natpmpc))
diff --git a/libs/libnatpmp/patches/001-cross_compile.patch b/libs/libnatpmp/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..1136f93
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile
++++ b/Makefile
+@@ -11,7 +11,8 @@ INSTALL = install
+ # APIVERSION is used in soname
+ APIVERSION = 1
+ #LDFLAGS = -Wl,--no-undefined
+-CFLAGS = -O -fPIC -Wall -DENABLE_STRNATPMPERR
++COPTS = -O
++CFLAGS = $(COPTS) -fPIC -Wall -DENABLE_STRNATPMPERR
+ LIBOBJS = natpmp.o getgateway.o
diff --git a/libs/libnet-1.0.x/Makefile b/libs/libnet-1.0.x/Makefile
new file mode 100644 (file)
index 0000000..c35b7ee
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2006-2014 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:=libnet0
+PKG_VERSION:=1.0.2a
+PKG_RELEASE:=9
+
+PKG_SOURCE:=libnet-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.packetfactory.net/libnet/dist/deprecated/
+PKG_MD5SUM:=ddf53f0f484184390e8c2a1bd0853667
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Libnet-$(PKG_VERSION)
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnet0
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpcap
+  TITLE:=Low-level packet creation library (v1.0.x)
+  URL:=http://www.packetfactory.net/libnet/
+endef
+
+ENDIANESS:=lil
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+  ENDIANESS:=big
+endif
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-pf_packet=yes
+
+CONFIGURE_VARS += \
+       ac_cv_libnet_endianess=$(ENDIANESS) \
+       ac_libnet_have_pf_packet=yes \
+       LL_INT_TYPE=sockpacket
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               include.m4 \
+               aclocal.m4 \
+               Makefile.in \
+               configure \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(1)/usr/lib/libnet-1.0.x/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(1)/usr/lib/libnet-1.0.x/include/
+       $(INSTALL_DIR) $(1)/usr/lib/libnet-1.0.x/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(1)/usr/lib/libnet-1.0.x/lib/
+endef
+
+define Package/libnet0/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libnet0))
diff --git a/libs/libnet-1.0.x/patches/100-debian_subset.patch.gz b/libs/libnet-1.0.x/patches/100-debian_subset.patch.gz
new file mode 100644 (file)
index 0000000..0c1d676
Binary files /dev/null and b/libs/libnet-1.0.x/patches/100-debian_subset.patch.gz differ
diff --git a/libs/libnet-1.0.x/patches/150-portability.patch b/libs/libnet-1.0.x/patches/150-portability.patch
new file mode 100644 (file)
index 0000000..5c9dc90
--- /dev/null
@@ -0,0 +1,28 @@
+diff -ur libnet.old/configure libnet.dev/configure
+--- libnet.old/configure       2007-04-01 17:36:55.000000000 +0200
++++ libnet.dev/configure       2007-04-01 17:40:06.000000000 +0200
+@@ -8613,7 +8613,9 @@
+ echo "$as_me:$LINENO: checking low-level packet interface type" >&5
+ echo $ECHO_N "checking low-level packet interface type... $ECHO_C" >&6
+-if test -r /dev/bpf0 ; then
++if [ -n "$LL_INT_TYPE" ]; then
++    echo "$as_me:$LINENO: result: found $LL_INT_TYPE (cached)" >&5
++elif test -r /dev/bpf0 ; then
+     LL_INT_TYPE=bpf
+     echo "$as_me:$LINENO: result: found bpf" >&5
+ echo "${ECHO_T}found bpf" >&6
+diff -ur libnet.old/configure.in libnet.dev/configure.in
+--- libnet.old/configure.in    2007-04-01 17:36:55.000000000 +0200
++++ libnet.dev/configure.in    2007-04-01 17:41:08.000000000 +0200
+@@ -97,7 +97,9 @@
+ dnl
+ AC_MSG_CHECKING(low-level packet interface type)
+-if test -r /dev/bpf0 ; then
++if [ -n "$LL_INT_TYPE" ]; then
++    AC_MSG_RESULT(found $LL_INT_TYPE (cached))
++elif test -r /dev/bpf0 ; then
+     LL_INT_TYPE=bpf
+     AC_MSG_RESULT(found bpf)
+ elif test -r /usr/include/net/pfilt.h ; then
diff --git a/libs/libnet-1.0.x/patches/200-no_cflags_ovveride.patch b/libs/libnet-1.0.x/patches/200-no_cflags_ovveride.patch
new file mode 100644 (file)
index 0000000..23f8a25
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/configure.in     2014-03-06 14:55:36.627221831 -0800
++++ b/configure.in     2014-03-06 14:56:48.709112089 -0800
+@@ -53,16 +53,6 @@
+ dnl
+-dnl Use these compiler flags if we have gcc.
+-dnl
+-if test $ac_cv_prog_gcc = yes; then
+-dnl if test -z $CFLAGS; then 
+-    CCOPTS='-O2 -funroll-loops -fomit-frame-pointer -Wall'
+-    CFLAGS="$CCOPTS"
+-dnl fi
+-fi
+-
+-dnl
+ dnl Check for package inclusion/exclusion
+ dnl
+ AC_ARG_WITH(pf_packet, [ --with-pf_packet=[yes,no] override defaults], \
diff --git a/libs/libnet-1.1.x/Makefile b/libs/libnet-1.1.x/Makefile
new file mode 100644 (file)
index 0000000..a4d2dff
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2013 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:=libnet
+PKG_VERSION:=1.1.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=be845c41170d72c7db524f3411b50256
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/libnet
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnet1
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpcap
+  TITLE:=Low-level packet creation library (v1.1.x)
+  URL:=http://www.packetfactory.net/libnet/
+endef
+
+ENDIANESS:=lil
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+  ENDIANESS:=big
+endif
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-pf_packet=yes
+
+CONFIGURE_VARS += \
+       ac_cv_libnet_endianess=$(ENDIANESS) \
+       ac_libnet_have_pf_packet=yes \
+       LL_INT_TYPE=libnet_link_linux
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               include.m4 \
+               aclocal.m4 \
+               Makefile.in \
+               configure \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libnet-config $(1)/usr/lib/libnet-1.1.x/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libnet* $(1)/usr/lib/libnet-1.1.x/include/
+       $(INSTALL_DIR) $(1)/usr/lib/libnet-1.1.x/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.{a,so*} $(1)/usr/lib/libnet-1.1.x/lib/
+endef
+
+define Package/libnet1/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnet.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libnet1))
diff --git a/libs/libnet-1.1.x/patches/100-debian-subset.patch b/libs/libnet-1.1.x/patches/100-debian-subset.patch
new file mode 100644 (file)
index 0000000..9d663be
--- /dev/null
@@ -0,0 +1,107 @@
+--- a/configure.in
++++ b/configure.in
+@@ -21,7 +21,7 @@ dnl Check for the usual programs
+ dnl
+ AC_PROG_CC
+ AC_PROG_INSTALL
+-AC_PROG_RANLIB
++AC_PROG_LIBTOOL
+ AC_CHECK_HEADERS(sys/sockio.h)
+--- a/include/libnet/libnet-functions.h
++++ b/include/libnet/libnet-functions.h
+@@ -1429,7 +1429,7 @@ libnet_t *l, libnet_ptag_t ptag);
+  * @param ptag protocol tag to modify an existing header, 0 to build a new one
+  * @return protocol tag value on success, -1 on error
+  */
+-inline u_int32_t
++u_int32_t
+ libnet_getgre_length(u_int16_t fv);
+ /**
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -12,4 +12,4 @@ SUBDIRS = include src sample
+ EXTRA_DIST = Makefile.am.common
+-bin_scripts = libnet-config
++bin_SCRIPTS = libnet-config
+--- a/sample/Makefile.am
++++ b/sample/Makefile.am
+@@ -60,4 +60,4 @@ ip_raw_SOURCES          = ip_raw.c
+ ip_link_SOURCES               = ip_link.c
+ sebek_SOURCES           = sebek.c
+-LDADD = $(top_srcdir)/src/libnet.a
++LDADD = $(top_srcdir)/src/libnet.la
+--- a/src/libnet_checksum.c
++++ b/src/libnet_checksum.c
+@@ -42,8 +42,10 @@ int
+ libnet_in_cksum(u_int16_t *addr, int len)
+ {
+     int sum;
++    u_int16_t last_byte;
+     sum = 0;
++    last_byte = 0;
+     while (len > 1)
+     {
+@@ -52,7 +54,8 @@ libnet_in_cksum(u_int16_t *addr, int len
+     }
+     if (len == 1)
+     {
+-        sum += *(u_int16_t *)addr;
++        *(u_int8_t*)&last_byte = *(u_int8_t*)addr;
++        sum += last_byte;
+     }
+     return (sum);
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -8,9 +8,9 @@
+ include $(top_srcdir)/Makefile.am.common
+-lib_LIBRARIES = libnet.a
++lib_LTLIBRARIES = libnet.la
+-libnet_a_SOURCES = libnet_asn1.c \
++libnet_la_SOURCES = libnet_asn1.c \
+                       libnet_build_802.1q.c \
+                       libnet_build_802.1x.c \
+                       libnet_build_802.2.c \
+@@ -57,15 +57,20 @@ libnet_a_SOURCES = libnet_asn1.c \
+                       libnet_version.c \
+                       libnet_write.c
+-EXTRA_libnet_a_SOURCES = libnet_link_bpf.c \
+-                      libnet_link_dlpi.c \
+-                      libnet_link_linux.c \
+-                      libnet_link_nit.c \
+-                      libnet_link_none.c \
+-                      libnet_link_pf.c \
+-                      libnet_link_snit.c \
+-                      libnet_link_snoop.c \
+-                      libnet_link_win32.c
+-
+-libnet_a_LIBADD = @LIBOBJS@
++libnet_la_LIBADD = @LTLIBOBJS@
++#   Here are a set of rules to help you update your library version
++# information:
++# 
++#   1. If the library source code has changed at all since the last
++#      update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
++# 
++#   2. If any interfaces have been added, removed, or changed since the
++#      last update, increment CURRENT, and set REVISION to 0.
++# 
++#   3. If any interfaces have been added since the last public release,
++#      then increment AGE.
++# 
++#   4. If any interfaces have been removed since the last public release,
++#      then set AGE to 0.
++libnet_la_LDFLAGS = -version-info 4:0:3 # CURRENT[:REVISION[:AGE]]
diff --git a/libs/libnet-1.1.x/patches/150-portability.patch b/libs/libnet-1.1.x/patches/150-portability.patch
new file mode 100644 (file)
index 0000000..f95aa9b
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/configure.in
++++ b/configure.in
+@@ -67,7 +67,10 @@ dnl Get link-layer interface type
+ dnl
+ AC_MSG_CHECKING(link-layer packet interface type)
+-if test -r /dev/bpf0 ; then
++if test -n "$LL_INT_TYPE"; then
++      AC_LIBOBJ($LL_INT_TYPE)
++      AC_MSG_RESULT(found $LL_INT_TYPE (cached))
++elif test -r /dev/bpf0 ; then
+     AC_LIBOBJ([libnet_link_bpf])
+     AC_MSG_RESULT(found bpf)
+ elif test -r /usr/include/net/pfilt.h ; then
diff --git a/libs/libnet-1.1.x/patches/160-endian_cache.patch b/libs/libnet-1.1.x/patches/160-endian_cache.patch
new file mode 100644 (file)
index 0000000..7460327
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -281,6 +281,7 @@ dnl
+ AC_DEFUN(AC_LIBNET_ENDIAN_CHECK,
+     [AC_MSG_CHECKING(machine endianess)
++    if \! test x${ac_cv_libnet_endianess+set} = xset ; then
+     cat > conftest.c << EOF
+ #       include <stdio.h>
+ #       include <stdlib.h>
+@@ -332,6 +333,7 @@ dnl failed to compile for some reason
+             fi                                
+         fi
+         rm -f conftest* core core.conftest
++      fi
+         AC_MSG_RESULT($ac_cv_libnet_endianess)
diff --git a/libs/libnetfilter-log/Makefile b/libs/libnetfilter-log/Makefile
new file mode 100644 (file)
index 0000000..2eca7ff
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2009-2010 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:=libnetfilter_log
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:= \
+       http://www.netfilter.org/projects/libnetfilter_log/files/ \
+       ftp://ftp.netfilter.org/pub/libnetfilter_log/ \
+       http://mirrors.evolva.ro/netfilter.org/libnetfilter_log/
+PKG_MD5SUM:=acdb188a1e7504e95636d0770ade393c
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnetfilter-log
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libnfnetlink +kmod-nfnetlink-log
+  TITLE:=API to packets logged by the kernel packet filter
+  URL:=http://www.netfilter.org/projects/libnetfilter_log/
+endef
+
+define Package/libnetfilter-log/description
+ libnetfilter_log is a userspace library providing interface to
+ packets that have been logged by the kernel packet filter.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared \
+
+CONFIGURE_VARS += \
+       LIBNFNETLINK_CFLAGS="$(TARGET_CPPFLAGS)" \
+       LIBNFNETLINK_LIBS="$(TARGET_LDFLAGS)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/libnetfilter_log
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/libnetfilter_log/*.h \
+               $(1)/usr/include/libnetfilter_log/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libnetfilter_log*.{so*,a,la} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_log.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libnetfilter-log/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetfilter_log*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libnetfilter-log))
diff --git a/libs/libnetfilter-queue/Makefile b/libs/libnetfilter-queue/Makefile
new file mode 100644 (file)
index 0000000..c1d5fd5
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2007-2010 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:=libnetfilter_queue
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:= \
+       http://www.netfilter.org/projects/libnetfilter_queue/files/ \
+       ftp://ftp.netfilter.org/pub/libnetfilter_queue/ \
+       http://mirrors.evolva.ro/netfilter.org/libnetfilter_queue/
+PKG_MD5SUM:=af6a9ea350f63a13609bc3b47b5c395c
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnetfilter-queue
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libnfnetlink +kmod-nfnetlink-queue
+  TITLE:=API to packets queued by the kernel packet filter
+  URL:=http://www.netfilter.org/projects/libnetfilter_queue/
+endef
+
+define Package/libnetfilter-queue/description
+ libnetfilter_queue is a userspace library providing an API to packets
+ that have been queued by the kernel packet filter.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared \
+
+CONFIGURE_VARS += \
+       LIBNFNETLINK_CFLAGS="$(TARGET_CPPFLAGS)" \
+       LIBNFNETLINK_LIBS="$(TARGET_LDFLAGS)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/libnetfilter_queue
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/libnetfilter_queue/*.h \
+               $(1)/usr/include/libnetfilter_queue/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libnetfilter_queue*.{so*,a,la} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_queue.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libnetfilter-queue/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetfilter_queue*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libnetfilter-queue))
diff --git a/libs/libnfc/Makefile b/libs/libnfc/Makefile
new file mode 100644 (file)
index 0000000..2e28c22
--- /dev/null
@@ -0,0 +1,118 @@
+#
+# Copyright (C) 2010-2012 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:=libnfc
+PKG_VERSION:=1.7.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://libnfc.googlecode.com/files
+PKG_MD5SUM:=8d8aced79cc0859c605c04d59e4484b3
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnfc/Default
+  TITLE:=Near Field Communication (NFC) library
+  URL:=http://www.libnfc.org
+endef
+
+define Package/libnfc
+$(call Package/libnfc/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libusb-compat +pcscd +ccid
+endef
+
+define Package/libnfc/description
+  libnfc is a free software library used to handle NFC capable devices.
+  It supports the four main NFC modulations:
+   * ISO14443-A (NXP MIFARE),
+   * ISO14443-B,
+   * JIS X 6319-4 (Sony Felica) and
+   * Jewel Topaz (Innovision Research & Development).
+  And depending on hardware, it supports:
+   * Read (RFID @13.56Mhz),
+   * Emulation and
+   * Peer2Peer mode.
+endef
+
+define Package/libnfc-bin
+$(call Package/libnfc/Default)
+  TITLE+= (binaries)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libnfc
+endef
+
+define Package/libnfc-bin/description
+  libnfc is provided with some useful tools:
+   * nfc-list: target listing;
+   * nfc-mfclassic: Mifare Classic operations;
+   * nfc-mfultralight: Mifare Ultralight operations.
+endef
+
+define Package/libnfc-examples
+$(call Package/libnfc/Default)
+  TITLE+= (examples)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libnfc
+endef
+
+define Package/libnfc-examples/description
+  libnfc is provided with some examples like:
+   * various targets emulation;
+   * NFC frames relay (ie. over network);
+   * manually done anticollision;
+   * etc.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+CONFIGURE_ARGS += --without-readline
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/nfc $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnfc.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnfc.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libnfc/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnfc.so.* $(1)/usr/lib/
+endef
+
+define Package/libnfc-bin/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-list $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-mfclassic $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-mfultralight $(1)/usr/bin/
+endef
+
+define Package/libnfc-examples/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-anticol $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-dep-initiator $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-dep-target $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-emulate-forum-tag4 $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-emulate-tag $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-emulate-uid $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-poll $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-relay $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/nfc-relay-picc $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libnfc))
+$(eval $(call BuildPackage,libnfc-bin))
+$(eval $(call BuildPackage,libnfc-examples))
diff --git a/libs/libnfsidmap/Makefile b/libs/libnfsidmap/Makefile
new file mode 100644 (file)
index 0000000..65415c3
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2007-2010 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:=libnfsidmap
+PKG_VERSION:=0.20
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap/
+PKG_MD5SUM:=9233cb77876eb642374a0d2bcaba1170
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnfsidmap
+  SECTION:=libs
+  CATEGORY:=Libraries
+  SUBMENU:=Filesystem
+  TITLE:=libnfsidmap, for compiling mount.nfs4
+  URL:=http://www.citi.umich.edu/projects/nfsv4
+endef
+
+define Package/libnfsidmap/description
+ needed for nfs-utils
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib
+
+MAKE_FLAGS += \
+       OPT="$(TARGET_CFLAGS)" \
+       INSTALLSUID="install -m 4755" \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       all install
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/nfsidmap.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnfsidmap.{a,so*} $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnfsidmap.pc $(1)/usr/lib/pkgconfig
+endef
+
+$(eval $(call BuildPackage,libnfsidmap))
diff --git a/libs/libnfsidmap/patches/000-no-getgrouplist.patch b/libs/libnfsidmap/patches/000-no-getgrouplist.patch
new file mode 100644 (file)
index 0000000..ea48245
--- /dev/null
@@ -0,0 +1,17 @@
+Index: libnfsidmap-0.20/nss.c
+===================================================================
+--- libnfsidmap-0.20.orig/nss.c        2007-07-12 11:42:09.000000000 +0200
++++ libnfsidmap-0.20/nss.c     2007-07-12 11:42:09.000000000 +0200
+@@ -295,9 +295,9 @@
+               ret = -ENOENT;
+               goto out;
+       }
+-      if (getgrouplist(pw->pw_name, pw->pw_gid, groups, ngroups) < 0)
+-              ret = -ERANGE;
+-      free(pw);
++      //      if (getgrouplist(pw->pw_name, pw->pw_gid, groups, ngroups) < 0)
++      //              ret = -ERANGE;
++      //      free(pw);
+ out:
+       return ret;
+ }
diff --git a/libs/libnids/Makefile b/libs/libnids/Makefile
new file mode 100644 (file)
index 0000000..05baa6b
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2006-2009 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:=libnids
+PKG_VERSION:=1.24
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libnids
+PKG_MD5SUM:=72d37c79c85615ffe158aa524d649610
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnids
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libnet0
+  TITLE:=A network intrusion detection library
+  URL:=http://libnids.sourceforge.net/
+endef
+
+define Package/libnids/description
+       An implementation of an E-component of Network Intrusion Detection
+       System.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+               --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.0.x" \
+               --with-libpcap="$(STAGING_DIR)/usr" \
+               --disable-libglib \
+               , \
+               CFLAGS="$$$$CFLAGS $$$$CPPFLAGS" \
+       )
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               LNETLIB="-L$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib -lnet" \
+               PCAPLIB="$(TARGET_LDFLAGS) -lpcap" \
+               install_prefix="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/nids.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnids.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libnids/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnids.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libnids))
diff --git a/libs/libnids/patches/001-no_asm_for_i386.patch b/libs/libnids/patches/001-no_asm_for_i386.patch
new file mode 100644 (file)
index 0000000..548f30d
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/checksum.c
++++ b/src/checksum.c
+@@ -25,7 +25,7 @@ static int dontchksum(unsigned int ip)
+       return 0;
+ }
+  
+-#if ( __i386__ || __i386 )
++#if 0
+ // all asm procedures are copied from Linux 2.0.36 and 2.2.10 kernels
+ /*
diff --git a/libs/libnids/patches/002-configure.patch b/libs/libnids/patches/002-configure.patch
new file mode 100644 (file)
index 0000000..fdc9791
--- /dev/null
@@ -0,0 +1,61 @@
+--- a/configure
++++ b/configure
+@@ -3640,7 +3640,7 @@ presetting ac_cv_c_bigendian=no (or yes)
+ esac
+-CFLAGS="$CFLAGS -D_BSD_SOURCE"
++CFLAGS="$CFLAGS"
+ for ac_func in gettimeofday
+ do
+@@ -3917,17 +3917,21 @@ if test "${with_libpcap+set}" = set; the
+ echo "${ECHO_T}no" >&6
+      ;;
+   *)
+-     echo "$as_me:$LINENO: result: $withval" >&5
+-echo "${ECHO_T}$withval" >&6
++     echo "$ac_t""$withval" 1>&6
+      if test -f $withval/pcap.h -a -f $withval/libpcap.a; then
+         owd=`pwd`
+         if cd $withval; then withval=`pwd`; cd $owd; fi
+-      PCAP_CFLAGS="-I$withval -I$withval/bpf"
++      PCAPINC="-I$withval -I$withval/bpf"
+       PCAPLIB="-L$withval -lpcap"
++     elif test -f $withval/include/pcap.h -a \
++             -f $withval/include/pcap-bpf.h -a \
++             -f $withval/lib/libpcap.a; then
++      owd=`pwd`
++      if cd $withval; then withval=`pwd`; cd $owd; fi
++      PCAPINC="-I$withval/include"
++      PCAPLIB="-L$withval/lib -lpcap"
+      else
+-        { { echo "$as_me:$LINENO: error: pcap.h or libpcap.a not found in $withval" >&5
+-echo "$as_me: error: pcap.h or libpcap.a not found in $withval" >&2;}
+-   { (exit 1); exit 1; }; }
++        { echo "configure: error: pcap.h" 1>&2; exit 1; }
+      fi
+      ;;
+   esac
+@@ -4399,10 +4403,10 @@ echo "${ECHO_T}no" >&6
+   *)
+      echo "$as_me:$LINENO: result: $withval" >&5
+ echo "${ECHO_T}$withval" >&6
+-     if test -f $withval/include/libnet.h -a -f $withval/lib/libnet.a -a -f $withval/libnet-config ; then
++     if test -f $withval/include/libnet.h -a -f $withval/lib/libnet.a -a -f $withval/bin/libnet-config ; then
+         owd=`pwd`
+         if cd $withval; then withval=`pwd`; cd $owd; fi
+-      LNET_CFLAGS="-I$withval/include `$withval/libnet-config --defines`"
++      LNET_CFLAGS="-I$withval/include `$withval/bin/libnet-config --defines`"
+       LNETLIB="-L$withval/lib -lnet"
+      elif test -f $withval/include/libnet.h -a -f $withval/src/libnet.a; then
+         owd=`pwd`
+@@ -4684,7 +4688,7 @@ else
+   echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+-HAVE_BSD_UDPHDR=0
++HAVE_BSD_UDPHDR=1
+ fi
+ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
diff --git a/libs/libol/Makefile b/libs/libol/Makefile
new file mode 100644 (file)
index 0000000..7c4b1cd
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2006-2010 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:=libol
+PKG_VERSION:=0.3.18
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.balabit.com/downloads/files/libol/0.3
+PKG_MD5SUM:=cbadf4b7ea276dfa85acc38a1cc5ff17
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libol
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Support library for syslog-ng
+  URL:=http://www.balabit.com/products/syslog_ng/
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+       )
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+# pass CFLAGS again to override -O2 set by configure
+MAKE_ARGS += CFLAGS="$(TARGET_CFLAGS)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/libol-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/libol-config
+
+       $(INSTALL_DIR) $(1)/usr/include/libol
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/libol/*.h \
+               $(1)/usr/include/libol/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libol.{a,la,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libol/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libol.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libol))
diff --git a/libs/libotr/Makefile b/libs/libotr/Makefile
new file mode 100644 (file)
index 0000000..bb8de06
--- /dev/null
@@ -0,0 +1,51 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libotr
+PKG_VERSION:=3.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.cypherpunks.ca/otr/
+PKG_MD5SUM:=974acf937d2ce0ee89b27a9815c17a3f
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libotr
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=OTR Messaging Library
+  URL:=http://www.cypherpunks.ca/otr/
+  DEPENDS:=+libgcrypt
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+endef
+
+define Package/libotr/description
+  Off-the-Record (OTR) Messaging allows you to have private conversations over
+  instant messaging.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC='$(TARGET_CC) $(FPIC)' \
+               CFLAGS='$(TARGET_CFLAGS) -Wall -D_GNU_SOURCE' \
+               LDFLAGS='$(TARGET_LDFLAGS)' \
+               all
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libotr $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libotr.{a,la,so*} $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libotr.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libotr/install
+       $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libotr.so.* $(1)/usr/lib/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,libotr))
diff --git a/libs/libotr/patches/001-no-host-paths.patch b/libs/libotr/patches/001-no-host-paths.patch
new file mode 100644 (file)
index 0000000..87c65b6
--- /dev/null
@@ -0,0 +1,8 @@
+--- a/toolkit/Makefile.am
++++ b/toolkit/Makefile.am
+@@ -1,4 +1,4 @@
+-INCLUDES = -I$(includedir) -I../src @LIBGCRYPT_CFLAGS@
++INCLUDES = -I../src @LIBGCRYPT_CFLAGS@
+ noinst_HEADERS = aes.h ctrmode.h parse.h sesskeys.h readotr.h sha1hmac.h
diff --git a/libs/libpar2/Makefile b/libs/libpar2/Makefile
new file mode 100644 (file)
index 0000000..1f8be5b
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2009-2012 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:=libpar2
+PKG_VERSION:=0.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/parchive
+PKG_MD5SUM:=94c6df4e38efe08056ecde2a04e0be91
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libpar2
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libsigcxx
+  TITLE:=A library for performing common tasks related to PAR recovery sets
+  URL:=http://parchive.sourceforge.net/
+endef
+
+define Package/libpar2/description
+A library for performing common tasks related to PAR recovery sets
+endef
+
+CONFIGURE_ARGS += \
+       --disable-static \
+       --disable-nls \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/libpar2
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/libpar2/*.h \
+               $(1)/usr/include/libpar2/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libpar2.{la,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libpar2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libpar2.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libpar2))
diff --git a/libs/libpar2/patches/100-par2cmdline-0.4-packed.patch b/libs/libpar2/patches/100-par2cmdline-0.4-packed.patch
new file mode 100644 (file)
index 0000000..23f6d1f
--- /dev/null
@@ -0,0 +1,217 @@
+--- a/letype.h
++++ b/letype.h
+@@ -28,44 +28,15 @@ typedef u64 leu64;
+ #else
+-class leu16
++struct leu16
+ {
+-public:
+-  leu16(void);
+-
+-  leu16(const leu16 &other);
+-  leu16& operator=(const leu16 &other);
+-
+-  leu16(const u16 &other);
+   leu16& operator=(const u16 &other);
+   operator u16(void) const;
+-protected:
+   u16 value;
+ };
+-inline leu16::leu16(void)
+-{
+-}
+-
+-inline leu16::leu16(const leu16 &other)
+-: value(other.value)
+-{
+-}
+-
+-inline leu16& leu16::operator =(const leu16 &other)
+-{
+-  value = other.value;
+-  return *this;
+-}
+-
+-inline leu16::leu16(const u16 &other)
+-{
+-  ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
+-  ((unsigned char*)&value)[1] = (unsigned char)((other >> 8) & 0xff);
+-}
+-
+ inline leu16& leu16::operator=(const u16 &other)
+ {
+   ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
+@@ -81,46 +52,15 @@ inline leu16::operator u16(void) const
+ }
+-class leu32
++struct leu32
+ {
+-public:
+-  leu32(void);
+-
+-  leu32(const leu32 &other);
+-  leu32& operator=(const leu32 &other);
+-
+-  leu32(const u32 &other);
+   leu32& operator=(const u32 &other);
+   operator u32(void) const;
+-protected:
+   u32 value;
+ };
+-inline leu32::leu32(void)
+-{
+-}
+-
+-inline leu32::leu32(const leu32 &other)
+-: value(other.value)
+-{
+-}
+-
+-inline leu32& leu32::operator =(const leu32 &other)
+-{
+-  value = other.value;
+-  return *this;
+-}
+-
+-inline leu32::leu32(const u32 &other)
+-{
+-  ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
+-  ((unsigned char*)&value)[1] = (unsigned char)((other >> 8) & 0xff);
+-  ((unsigned char*)&value)[2] = (unsigned char)((other >> 16) & 0xff);
+-  ((unsigned char*)&value)[3] = (unsigned char)((other >> 24) & 0xff);
+-}
+-
+ inline leu32& leu32::operator=(const u32 &other)
+ {
+   ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
+@@ -140,50 +80,15 @@ inline leu32::operator u32(void) const
+ }
+-class leu64
++struct leu64
+ {
+-public:
+-  leu64(void);
+-
+-  leu64(const leu64 &other);
+-  leu64& operator=(const leu64 &other);
+-
+-  leu64(const u64 &other);
+   leu64& operator=(const u64 &other);
+   operator u64(void) const;
+-protected:
+   u64 value;
+ };
+-inline leu64::leu64(void)
+-{
+-}
+-
+-inline leu64::leu64(const leu64 &other)
+-: value(other.value)
+-{
+-}
+-
+-inline leu64& leu64::operator =(const leu64 &other)
+-{
+-  value = other.value;
+-  return *this;
+-}
+-
+-inline leu64::leu64(const u64 &other)
+-{
+-  ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
+-  ((unsigned char*)&value)[1] = (unsigned char)((other >> 8) & 0xff);
+-  ((unsigned char*)&value)[2] = (unsigned char)((other >> 16) & 0xff);
+-  ((unsigned char*)&value)[3] = (unsigned char)((other >> 24) & 0xff);
+-  ((unsigned char*)&value)[4] = (unsigned char)((other >> 32) & 0xff);
+-  ((unsigned char*)&value)[5] = (unsigned char)((other >> 40) & 0xff);
+-  ((unsigned char*)&value)[6] = (unsigned char)((other >> 48) & 0xff);
+-  ((unsigned char*)&value)[7] = (unsigned char)((other >> 56) & 0xff);
+-}
+-
+ inline leu64& leu64::operator=(const u64 &other)
+ {
+   ((unsigned char*)&value)[0] = (unsigned char)((other >> 0) & 0xff);
+--- a/md5.h
++++ b/md5.h
+@@ -20,6 +20,13 @@
+ #ifndef __MD5_H__
+ #define __MD5_H__
++#ifdef WIN32
++#pragma pack(push, 1)
++#define PACKED
++#else
++#define PACKED __attribute__ ((packed))
++#endif
++
+ // This file defines the MD5Hash and MD5Context objects which are used
+ // to compute and manipulate the MD5 Hash values for a block of data.
+@@ -35,12 +42,11 @@
+ // MD5 Hash value
+-class MD5Hash
+-{
+-public:
+-  // Constructor does not initialise the value
+-  MD5Hash(void) {};
++struct MD5Hash;
++ostream& operator<<(ostream &s, const MD5Hash &hash);
++struct MD5Hash
++{
+   // Comparison operators
+   bool operator==(const MD5Hash &other) const;
+   bool operator!=(const MD5Hash &other) const;
+@@ -54,13 +60,8 @@ public:
+   friend ostream& operator<<(ostream &s, const MD5Hash &hash);
+   string print(void) const;
+-  // Copy and assignment
+-  MD5Hash(const MD5Hash &other);
+-  MD5Hash& operator=(const MD5Hash &other);
+-
+-public:
+   u8 hash[16]; // 16 byte MD5 Hash value
+-};
++} PACKED;
+ // Intermediate computation state
+@@ -144,16 +145,9 @@ inline bool MD5Hash::operator<=(const MD
+   return !other.operator<(*this);
+ }
+-inline MD5Hash::MD5Hash(const MD5Hash &other)
+-{
+-  memcpy(&hash, &other.hash, sizeof(hash));
+-}
+-
+-inline MD5Hash& MD5Hash::operator=(const MD5Hash &other)
+-{
+-  memcpy(&hash, &other.hash, sizeof(hash));
+-
+-  return *this;
+-}
++#ifdef WIN32
++#pragma pack(pop)
++#endif
++#undef PACKED
+ #endif // __MD5_H__
diff --git a/libs/libpfm/Makefile b/libs/libpfm/Makefile
new file mode 100644 (file)
index 0000000..449a162
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006-2008 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:=libpfm
+PKG_VERSION:=3.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/perfmon2
+PKG_MD5SUM:=5075fa45ddce4aa647b70e9f9446eacc
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libpfm
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Perfmon2 Kernel performance monitoring interface
+  URL:=http://perfmon2.sourceforge.net/
+  DEPENDS:=@BROKEN
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               ARCH=cell \
+               CC=$(TARGET_CROSS)gcc \
+               AR=$(TARGET_CROSS)ar \
+               lib
+endef
+
+define Build/InstallDev
+       echo "Build/InstallDev"
+       $(MAKE) -C $(PKG_BUILD_DIR)/include \
+               ARCH=cell \
+               DESTDIR=$(1) \
+               INCDIR=/usr/include \
+               CONFIG_PFMLIB_ARCH_POWERPC=y \
+               install
+#      $(MAKE) -C $(PKG_BUILD_DIR)/lib \
+#              ARCH=cell \
+#              CC=$(TARGET_CROSS)gcc \
+#              DESTDIR=$(1) \
+#              LIBDIR=/usr/lib \
+#              CONFIG_PFMLIB_ARCH_POWERPC=y \
+#              CONFIG_PFMLIB_CELL=y \
+#              CONFIG_PFMLIB_SHARED=y \
+#              install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP)   $(PKG_BUILD_DIR)/lib/libpfm* $(1)/usr/lib/
+endef
+
+define Package/libpfm/install
+       echo "Package/libpfm/install"
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libpfm* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libpfm))
diff --git a/libs/libplist/Makefile b/libs/libplist/Makefile
new file mode 100644 (file)
index 0000000..ba8c7bc
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2012-2014 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:=libplist
+PKG_VERSION:=1.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.libimobiledevice.org/downloads
+PKG_MD5SUM:=82de65f38cb2f0a9fd0839679b46072b
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libplist/Default
+  TITLE:=Apple property list
+  URL:=http://www.libimobiledevice.org/
+endef
+
+define Package/libplist/Default/description
+  A library to handle Apple Property List format whereas it's binary or XML
+endef
+
+define Package/libplist
+  $(call Package/libplist/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libxml2
+  TITLE+= library
+endef
+
+define Package/libplist/description
+  $(call Package/libplist/Default/description)
+endef
+
+define Package/libplistcxx
+  $(call Package/libplist/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libplist +libstdcpp
+  TITLE+= C++ library
+endef
+
+define Package/libplistcxx/description
+  $(call Package/libplist/Default/description)
+  This package contains the libplist C++ shared library.
+endef
+
+define Package/libplist-utils
+  $(call Package/libplist/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libplist
+  TITLE+= converter
+endef
+
+define Package/libplist-utils/description
+  $(call Package/libplist/Default/description)
+  This package contains the libplist utilities.
+endef
+
+CONFIGURE_ARGS += \
+       --without-cython
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/plist $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libplist*.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libplist*.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libplist/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libplist.so.* $(1)/usr/lib/
+endef
+
+define Package/libplistcxx/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libplist++.so.* $(1)/usr/lib/
+endef
+
+define Package/libplist-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/plistutil $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libplist))
+$(eval $(call BuildPackage,libplistcxx))
+$(eval $(call BuildPackage,libplist-utils))
diff --git a/libs/libpthread-stubs/Makefile b/libs/libpthread-stubs/Makefile
new file mode 100644 (file)
index 0000000..16d5fcc
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008 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:=libpthread-stubs
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://xcb.freedesktop.org/dist/
+PKG_MD5SUM:=774eabaf33440d534efe108ef9130a7d
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libpthread-stubs
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libpthread-stubs
+  URL:=http://xcb.freedesktop.org/
+  BUILDONLY:=1
+endef
+
+define Package/libpthread-stubs/description
+This library provides weak aliases for pthread functions not provided in libc
+or otherwise available by default.  Libraries like libxcb rely on pthread
+stubs to use pthreads optionally, becoming thread-safe when linked to
+libpthread, while avoiding any performance hit when running single-threaded.
+libpthread-stubs supports this behavior even on platforms which do not supply
+all the necessary pthread stubs.  On platforms which already supply all the
+necessary pthread stubs, this package ships only the pkg-config file
+pthread-stubs.pc, to allow libraries to unconditionally express a dependency
+on pthread-stubs and still obtain correct behavior.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+$(eval $(call BuildPackage,libpthread-stubs))
diff --git a/libs/libptmalloc3/Makefile b/libs/libptmalloc3/Makefile
new file mode 100644 (file)
index 0000000..81f6174
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright (C) 2008-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+#
+# Sample usage:
+#   env LD_PRELOAD="/usr/lib/libptmalloc3.so" <application>
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libptmalloc3
+PKG_VERSION:=20060531
+PKG_RELEASE:=2
+PKG_BUILD_DIR:=$(BUILD_DIR)/ptmalloc3
+
+PKG_SOURCE:=ptmalloc3-current.tar.gz
+PKG_SOURCE_URL:=http://www.malloc.de/malloc/
+PKG_MD5SUM:=c0b9dd5f16f8eae979166dc74b60015c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libptmalloc3
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Efficient malloc implementation
+  URL:=http://www.malloc.de/en/
+endef
+
+# flags: taken from ptmalloc3/Makefile by combining
+# 'linux-shared' and 'linux-nothreads' targets
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               OPT_FLAGS="$(TARGET_CFLAGS)" \
+               linux-shared-nothreads
+endef
+
+define Package/libptmalloc3/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libptmalloc3.so $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libptmalloc3))
diff --git a/libs/libptmalloc3/patches/100-nothreads.patch b/libs/libptmalloc3/patches/100-nothreads.patch
new file mode 100644 (file)
index 0000000..d8682de
--- /dev/null
@@ -0,0 +1,20 @@
+This patch adds an additional target to build a shared library without pthreads
+(should this be the default? or is the ulibc malloc threadsafe? or should we
+build two separate packages?)
+
+--- ptmalloc3/Makefile.orig    2007-11-08 09:10:46.000000000 +0000
++++ ptmalloc3/Makefile 2007-11-08 09:17:09.000000000 +0000
+@@ -150,6 +150,13 @@
+  INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' M_FLAGS='$(M_FLAGS)' \
+  LIB_MALLOC=libptmalloc3.so
++linux-shared-nothreads:
++      $(MAKE) SYS_FLAGS='-D_GNU_SOURCE=1 -fpic' \
++ WARN_FLAGS='-Wall -Wstrict-prototypes' \
++ OPT_FLAGS='$(OPT_FLAGS)' THR_FLAGS='' THR_LIBS='' \
++ INC_FLAGS='-Isysdeps/generic -I.' M_FLAGS='$(M_FLAGS)' \
++ LIB_MALLOC=libptmalloc3.so
++
+ sproc:
+       $(MAKE) THR_FLAGS='' THR_LIBS='' OPT_FLAGS='$(OPT_FLAGS)' CC='$(CC)' \
+       INC_FLAGS='-Isysdeps/sproc -Isysdeps/generic -I.' \
diff --git a/libs/libqmi/Makefile b/libs/libqmi/Makefile
new file mode 100644 (file)
index 0000000..14e6569
--- /dev/null
@@ -0,0 +1,57 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libqmi
+PKG_VERSION:=1.8.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=libqmi-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://www.freedesktop.org/software/libqmi
+PKG_MD5SUM:=1c4c64c0894f691632727363abec32b8
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libqmi
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+glib2 +zlib +kmod-usb-net-qmi-wwan
+  TITLE:=Helper library and utils to talk to QMI enabled modems
+  URL:=http://www.freedesktop.org/wiki/Software/libqmi
+endef
+
+define Package/libqmi/description
+  Helper library and utils to talk to QMI enabled modems
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/libqmi-glib \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/qmi-glib.pc \
+               $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libqmi/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qmicli $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qmi-network $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libqmi))
diff --git a/libs/librpcsecgss/Makefile b/libs/librpcsecgss/Makefile
new file mode 100644 (file)
index 0000000..5d3d0cd
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2007-2010 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:=librpcsecgss
+PKG_VERSION:=0.14
+PKG_RELEASE:=2
+
+PKG_SOURCE:=librpcsecgss-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.citi.umich.edu/projects/nfsv4/linux/librpcsecgss/
+PKG_MD5SUM:=0d4cdee46a98731b1b71e30504589281
+
+PKG_BUILD_DEPENDS:=libgssapi
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/librpcsecgss
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=required libraries for the nfs-utils
+  URL:=http://www.citi.umich.edu/projects/nfsv4/linux
+endef
+
+define Package/librpcsecgss/description
+ Support libraries - for newer nfs mount command (nfs4)
+endef
+
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib -I$(STAGING_DIR)/usr/include/gssglue/ $(FPIC)
+
+MAKE_FLAGS += \
+       OPT="$(TARGET_CFLAGS)" \
+       INSTALLSUID="install -m 4755" \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+        GSSAPI_LIBS="usr/lib/libgssapi.a"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/rpcsecgss/rpc
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/rpcsecgss/rpc/*.h $(1)/usr/include/rpcsecgss/rpc/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/librpcsecgss.{a,so*} $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/librpcsecgss.pc $(1)/usr/lib/pkgconfig
+endef
+
+$(eval $(call BuildPackage,librpcsecgss))
diff --git a/libs/librsync/Makefile b/libs/librsync/Makefile
new file mode 100644 (file)
index 0000000..653be54
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2006-2010 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:=librsync
+PKG_VERSION:=0.9.7
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/librsync
+PKG_MD5SUM:=24cdb6b78f45e0e83766903fd4f6bc84
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/librsync
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=implementation of the rolling-checksum algorithm
+  DEPENDS:=+libbz2 +libpopt +zlib
+  URL:=http://librsync.sourceforge.net/
+endef
+
+define Package/librsync/description
+       librsync implements the rolling-checksum algorithm of remote file
+       synchronization that was popularized by the rsync utility and is
+       used in rproxy. This algorithm transfers the differences between 2
+       files without needing both files on the same system.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+       );
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/librsync{,-config}.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/librsync.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/librsync/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/librsync.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,librsync))
diff --git a/libs/librsync/patches/001-4gb_files.patch b/libs/librsync/patches/001-4gb_files.patch
new file mode 100644 (file)
index 0000000..3c0128e
--- /dev/null
@@ -0,0 +1,31 @@
+diff -urN librsync-0.9.7/mdfour.h librsync-0.9.7.new/mdfour.h
+--- librsync-0.9.7/mdfour.h    2004-02-08 00:17:57.000000000 +0100
++++ librsync-0.9.7.new/mdfour.h        2009-08-08 16:08:57.000000000 +0200
+@@ -24,7 +24,7 @@
+ #include "types.h"
+ struct rs_mdfour {
+-    int                 A, B, C, D;
++    unsigned int                 A, B, C, D;
+ #if HAVE_UINT64
+     uint64_t            totalN;
+ #else
+diff -urN librsync-0.9.7/patch.c librsync-0.9.7.new/patch.c
+--- librsync-0.9.7/patch.c     2004-09-17 23:35:50.000000000 +0200
++++ librsync-0.9.7.new/patch.c 2009-08-08 16:10:40.000000000 +0200
+@@ -214,12 +214,12 @@
+     void            *buf, *ptr;
+     rs_buffers_t    *buffs = job->stream;
+-    len = job->basis_len;
+-    
+     /* copy only as much as will fit in the output buffer, so that we
+      * don't have to block or store the input. */
+-    if (len > buffs->avail_out)
++    if (job->basis_len > buffs->avail_out)
+         len = buffs->avail_out;
++    else
++      len = job->basis_len;
+     if (!len)
+         return RS_BLOCKED;
diff --git a/libs/libsamplerate/Makefile b/libs/libsamplerate/Makefile
new file mode 100644 (file)
index 0000000..b31a649
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2007-2009 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:=libsamplerate
+PKG_VERSION:=0.1.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.mega-nerd.com/SRC/
+PKG_MD5SUM:=ad093e60ec44f0a60de8e29983ddbc0f
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libsamplerate
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libsndfile
+  TITLE:=Sample Rate Converter
+  URL:=http://www.mega-nerd.com/SRC/index.html
+endef
+
+define Package/libsamplerate/description
+ Secret Rabbit Code (aka libsamplerate) is a Sample Rate
+ Converter for audio.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --disable-fftw \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+define Package/libsamplerate/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsamplerate.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsamplerate))
diff --git a/libs/libsamplerate/patches/001-fix-m4-loop.patch b/libs/libsamplerate/patches/001-fix-m4-loop.patch
new file mode 100644 (file)
index 0000000..e91499c
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -135,7 +135,6 @@ if test $ac_cv_c_byte_order = unknown ; 
+       fi
+ )
+-]
+ if test $ac_cv_c_byte_order = big ; then
+       ac_cv_c_big_endian=1
+@@ -154,6 +153,7 @@ else
+       AC_MSG_WARN([[*****************************************************************]])
+       fi
++]
+ )# AC_C_FIND_ENDIAN
diff --git a/libs/libsdl/Makefile b/libs/libsdl/Makefile
new file mode 100644 (file)
index 0000000..e87700c
--- /dev/null
@@ -0,0 +1,164 @@
+#
+# Copyright (C) 2010 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:=SDL
+PKG_VERSION:=1.2.14
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.libsdl.org/release/
+PKG_MD5SUM:=e52086d1b508fa0b76c52ee30b55bec4
+
+PKG_LICENSE:=LGPLv2.1
+PKG_LICENSE_FILES:=COPYING test/COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS:=CONFIG_AUDIO_SUPPORT
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libsdl
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Simple DirectMedia Layer
+  URL:=http://www.libsdl.org
+  DEPENDS:=+directfb +zlib +libpthread +AUDIO_SUPPORT:alsa-lib
+endef
+
+define Package/libsdl/description
+ SDL is a library that allows programs portable low level access to a video
+ framebuffer, audio output, mouse, and keyboard.
+endef
+
+CONFIGURE_ARGS+= \
+       --enable-libc \
+       --enable-video \
+       --enable-events \
+       --enable-joystick \
+       --enable-cdrom \
+       --enable-threads \
+       --enable-timers \
+       --enable-file \
+       --enable-loadso \
+       --enable-cpuinfo \
+       --enable-assembly \
+       --disable-oss \
+       --disable-alsatest \
+       --enable-alsa-shared \
+       --disable-esd \
+       --disable-esdtest \
+       --enable-esd-shared \
+       --disable-pulseaudio \
+       --enable-pulseaudio-shared \
+       --disable-arts \
+       --enable-arts-shared \
+       --disable-nas \
+       --enable-nas-shared \
+       --disable-diskaudio \
+       --disable-dummyaudio \
+       --disable-mintaudio \
+       --disable-nasm \
+       --disable-altivec \
+       --disable-ipod \
+       --disable-nanox \
+       --disable-video-x11 \
+       --enable-x11-shared \
+       --enable-dga \
+       --enable-video-dga \
+       --enable-video-x11-dgamouse \
+       --enable-video-x11-vm \
+       --enable-video-x11-xv \
+       --disable-video-x11-xinerama \
+       --disable-video-x11-xme \
+       --disable-video-x11-xrandr \
+       --disable-video-photon \
+       --disable-video-carbon \
+       --disable-video-cocoa \
+       --enable-video-fbcon \
+       --enable-video-directfb \
+       --disable-video-ps2gs \
+       --disable-video-ps3 \
+       --disable-video-ggi \
+       --disable-video-svga \
+       --disable-video-vgl \
+       --disable-video-wscons \
+       --disable-video-aalib \
+       --disable-video-caca \
+       --disable-video-qtopia \
+       --disable-video-picogui \
+       --disable-video-xbios \
+       --disable-video-gem \
+       --disable-video-dummy \
+       --disable-video-opengl \
+       --disable-osmesa-shared \
+       --disable-screensaver \
+       --enable-input-events \
+       --disable-input-tslib \
+       --enable-pth \
+       --enable-pthreads \
+       --enable-pthread-sem \
+       --disable-stdio-redirect \
+       --disable-directx \
+       --enable-sdl-dlopen \
+       --disable-atari-ldg \
+       --disable-clock_gettime \
+       --without-x \
+       --disable-rpath \
+
+ifneq ($(CONFIG_AUDIO_SUPPORT),)
+  CONFIGURE_ARGS+= \
+       --enable-audio \
+       --enable-alsa
+else
+  CONFIGURE_ARGS+= \
+       --disable-audio \
+       --disable-alsa
+endif
+
+CONFIGURE_VARS+= \
+               ac_cv_path_DIRECTFBCONFIG=no \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/SDL* \
+               $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libSDL*.{a,so*} \
+               $(1)/usr/lib/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig
+
+
+       $(INSTALL_DIR) $(1)/usr/share/aclocal
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/aclocal/* \
+               $(1)/usr/share/aclocal/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/sdl-config \
+               $(1)/usr/bin/
+
+       $(SED) 's,^\(exec_prefix\|prefix\)=.*,\1=\"$(STAGING_DIR)/usr/\",g' \
+               $(1)/usr/bin/sdl-config
+
+       $(INSTALL_DIR) $(1)/host/bin
+       ln -sf ../../usr/bin/sdl-config $(1)/host/bin/
+endef
+
+define Package/libsdl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libSDL*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsdl))
diff --git a/libs/libsdl/patches/001-automake-compat.patch b/libs/libsdl/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..0e8ac79
--- /dev/null
@@ -0,0 +1,5 @@
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1,2 @@
++SUBDIRS = .
++ACLOCAL_AMFLAGS = -I . -I acinclude
diff --git a/libs/libsdl_mixer/Makefile b/libs/libsdl_mixer/Makefile
new file mode 100644 (file)
index 0000000..232080c
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2010 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:=SDL_mixer
+PKG_VERSION:=1.2.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.libsdl.org/projects/SDL_mixer/release/
+PKG_MD5SUM:=65ada3d997fe85109191a5fb083f248c
+
+PKG_FIXUP:=autoreconf
+PKG_MACRO_PATHS:=acinclude
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_LDFLAGS += -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/libsdl-mixer
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Simple DirectMedia Layer Sound Mixer
+  URL:=http://www.libsdl.org/projects/SDL_mixer/
+  DEPENDS:=+libsdl +libmikmod +libvorbisidec
+endef
+
+define Package/libsdl-mixer/description
+  SDL_mixer is a sample multi-channel audio mixer library.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-sdltest \
+               --enable-music-cmd \
+               --enable-music-wave \
+               --enable-music-mod \
+               --enable-music-mod-shared \
+               --enable-music-midi \
+               --disable-music-ogg \
+               --enable-music-ogg-tremor \
+               --enable-music-ogg-shared \
+               --disable-music-flac \
+               --enable-music-flag-shared \
+               --disable-music-mp3 \
+               --enable-music-mp3-shared \
+               --disable-smpegtest \
+               --disable-music-mp3-mad-gpl \
+               --with-sdl-exec-prefix="$(STAGING_DIR)/usr" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/SDL $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/SDL/SDL_mixer.h \
+               $(1)/usr/include/SDL/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libSDL_mixer*.{a,la,so*} \
+               $(1)/usr/lib/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libsdl-mixer/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libSDL_mixer*.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsdl-mixer))
diff --git a/libs/libsdl_mixer/files/sdl-config b/libs/libsdl_mixer/files/sdl-config
new file mode 100755 (executable)
index 0000000..e496baf
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Fake sdl-config
+echo "-lSDL -ldirect -ldirectfb -lfusion"
diff --git a/libs/libsdl_mixer/patches/001-automake-compat.patch b/libs/libsdl_mixer/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..8e879c3
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/configure.in
++++ b/configure.in
+@@ -1,6 +1,6 @@
+ dnl Process this file with autoconf to produce a configure script.
+ AC_INIT(README)
+-AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
++AC_CONFIG_AUX_DIR([build-scripts])
+ dnl Set various version strings - taken gratefully from the GTk sources
diff --git a/libs/libsdl_mixer/patches/002-fix-linking.patch b/libs/libsdl_mixer/patches/002-fix-linking.patch
new file mode 100644 (file)
index 0000000..a7b1fb1
--- /dev/null
@@ -0,0 +1,17 @@
+diff --git a/Makefile.in b/Makefile.in
+index 76fdd3c..3ab4939 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -75,10 +75,10 @@ $(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
+       $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
+ $(objects)/playwave$(EXE): $(objects)/playwave.lo $(objects)/$(TARGET)
+-      $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET)
++      $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playwave.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
+ $(objects)/playmus$(EXE): $(objects)/playmus.lo $(objects)/$(TARGET)
+-      $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET)
++      $(LIBTOOL) --mode=link $(CC) -o $@ $(objects)/playmus.lo $(SDL_CFLAGS) $(SDL_LIBS) $(objects)/$(TARGET) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
+ install: all install-hdrs install-lib #install-bin
+ install-hdrs:
diff --git a/libs/libsdl_sound/Makefile b/libs/libsdl_sound/Makefile
new file mode 100644 (file)
index 0000000..a8549d2
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2010 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:=libsdl-sound
+PKG_VERSION:=1.0.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=SDL_sound-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://icculus.org/SDL_sound/downloads/
+PKG_MD5SUM:=aa09cd52df85d29bee87a664424c94b5
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/SDL_sound-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_LDFLAGS += -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/libsdl-sound
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Simple DirectMedia Layer Sound Decoder
+  URL:=http://icculus.org/SDL_sound/
+  DEPENDS:=+libsdl
+endef
+
+define Package/libsdl-sound/description
+  SDL_sound is a library that handles the decoding
+  of several popular sound file formats, such as .WAV and .MP3.
+endef
+
+CONFIGURE_ARGS += \
+       --with-sdl-prefix="$(STAGING_DIR)/usr" \
+       --disable-flac \
+       --disable-mikmod \
+       --disable-modplug \
+       --disable-ogg \
+       --disable-smpeg \
+       --disable-speex \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/SDL $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/SDL/SDL_sound.h \
+               $(1)/usr/include/SDL/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libSDL_sound*.{a,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libsdl-sound/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libSDL_sound*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsdl-sound))
diff --git a/libs/libshout/Makefile b/libs/libshout/Makefile
new file mode 100644 (file)
index 0000000..af12afa
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2008-2010 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:=libshout
+PKG_VERSION:=2.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.us.xiph.org/releases/libshout/
+PKG_MD5SUM:=11765b2592e7ea623ccd93d3f8df172c
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libshout
+  SECTION:=libs
+  DEPENDS:= +libspeex +libtheora +libvorbis +libvorbisidec +libpthread
+  CATEGORY:=Libraries
+  TITLE:=Library which can be used to write a source client like ices
+  URL:=http://www.icecast.org/download.php
+endef
+
+define Package/libshout/description
+       libshout allows applications to easily communicate and broadcast
+       to an Icecast streaming media server. It handles the socket connections,
+       metadata communication, and data streaming for the calling application,
+       and lets developers focus on feature sets instead of implementation
+       details.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               VORBIS_CFLAGS="-I$(STAGING_DIR)/usr/include/tremor/" \
+               VORBIS_LIBS="$(TARGET_LDFLAGS) -lvorbis -lvorbisidec" \
+               --enable-shared \
+               --enable-static \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/shout
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/shout/shout.h $(1)/usr/include/shout
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libshout.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(SED) 's|/usr/include|$(STAGING_DIR)/usr/include|' \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/shout.pc
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/shout.pc $(1)/usr/lib/pkgconfig/             
+endef
+
+define Package/libshout/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libshout.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libshout))
diff --git a/libs/libshout/patches/120-vorbis-c.patch b/libs/libshout/patches/120-vorbis-c.patch
new file mode 100644 (file)
index 0000000..a9e41f9
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/vorbis.c
++++ b/src/vorbis.c
+@@ -28,7 +28,7 @@
+ #endif
+ #include <stdlib.h>
+-#include <vorbis/codec.h>
++#include <tremor/ivorbiscodec.h>
+ #include "shout_private.h"
+ #include "shout_ogg.h"
diff --git a/libs/libshout/patches/140-no_example_doc_win32.patch b/libs/libshout/patches/140-no_example_doc_win32.patch
new file mode 100644 (file)
index 0000000..9e8b5a3
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -288,12 +288,12 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = 1.6 foreign
+ ACLOCAL_AMFLAGS = -I m4
+-SUBDIRS = include src examples debian doc win32
++SUBDIRS = include src debian
+ EXTRA_DIST = INSTALL m4/shout.m4 m4/acx_pthread.m4 \
+       m4/ogg.m4 m4/vorbis.m4 m4/xiph_compiler.m4 m4/xiph_net.m4 \
+       m4/xiph_types.m4
+-doc_DATA = COPYING NEWS README examples/example.c examples/nonblocking.c
++doc_DATA = COPYING NEWS README
+ m4datadir = $(datadir)/aclocal
+ m4data_DATA = m4/shout.m4
+ @HAVE_PKGCONFIG_TRUE@pkgconfigdir = $(libdir)/pkgconfig
diff --git a/libs/libsml/Makefile b/libs/libsml/Makefile
new file mode 100644 (file)
index 0000000..b1649f7
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2012 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:=libsml
+PKG_VERSION:=0.2
+PKG_RELEASE:=1
+PKG_REV:=550aa8216295ff76076f35ce2eb00872dfd83f8f
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://github.com/dailab/libsml.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=git
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libsml
+  SECTION:=libs
+  CATEGORY:=Libraries
+  URL:=https://github.com/dailab/libsml
+  TITLE:=Library which implements the Smart Messaging Language (SML) protocol
+  DEPENDS:=+libuuid
+endef
+
+MAKE_FLAGS += \
+             UNAME="Linux"
+
+define Package/libsml/description
+  libSML is a library which implements the Smart Messaging Language (SML) protocol specified by
+  VDE's Forum Netztechnik/Netzbetrieb (FNN). It can be utilized to communicate to FNN specified
+  Smart Meters or Smart Meter components (EDL/MUC).
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/sml/include/sml $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/sml/lib/libsml.{so*,a} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_BUILD_DIR)/sml.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libsml/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/sml/lib/libsml.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsml))
diff --git a/libs/libsml/patches/010-no-examples-tests.patch b/libs/libsml/patches/010-no-examples-tests.patch
new file mode 100644 (file)
index 0000000..bf2220c
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,8 +1,8 @@
+ all:
+       @$(MAKE) -C sml
+-      @$(MAKE) -C examples
+-      @$(MAKE) -C test
++#     @$(MAKE) -C examples
++#     @$(MAKE) -C test
+ .PHONY: clean
+ clean :
diff --git a/libs/libsml/patches/020-ldflags.patch b/libs/libsml/patches/020-ldflags.patch
new file mode 100644 (file)
index 0000000..d6fa2e4
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/sml/Makefile
++++ b/sml/Makefile
+@@ -54,7 +54,7 @@ libsml: $(ST_LIB) $(OBJ_LIB)
+ endif
+ $(DYN_LIB): $(OBJS)
+-      $(LD) $(LIBS) -shared -soname $(SONAME) -o $@ $^
++      $(LD) $(LDFLAGS) $(LIBS) -shared -soname $(SONAME) -o $@ $^
+ $(OBJ_LIB): $(OBJS)
+       $(LD) -r -o $@ $^
diff --git a/libs/libsml/patches/030-cross_compile.patch b/libs/libsml/patches/030-cross_compile.patch
new file mode 100644 (file)
index 0000000..6e33014
--- /dev/null
@@ -0,0 +1,8 @@
+--- a/sml/Makefile     2012-12-05 18:54:49.000000000 +0100
++++ b/sml/Makefile     2012-12-05 19:01:26.347952235 +0100
+@@ -1,4 +1,4 @@
+-UNAME := $(shell uname)
++UNAME ?= $(shell uname)
+ CFLAGS += -I./include/ -fPIC -fno-stack-protector -g -Wall
+ # Available Flags:
diff --git a/libs/libsocketcan/Makefile b/libs/libsocketcan/Makefile
new file mode 100644 (file)
index 0000000..14d2a19
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2013 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:=libsocketcan
+PKG_VERSION:=0.0.9
+PKG_RELEASE=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.pengutronix.de/software/libsocketcan/download/
+PKG_MD5SUM:=cd92766be40d98b5cb08366b71ea4663
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libsocketcan
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libsocketcan
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/can_netlink.h $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libsocketcan.h $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsocketcan.{a,so*} $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsocketcan.pc $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libsocketcan/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsocketcan.so* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,libsocketcan))
diff --git a/libs/libsoup/Makefile b/libs/libsoup/Makefile
new file mode 100644 (file)
index 0000000..f6a7f84
--- /dev/null
@@ -0,0 +1,64 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libsoup
+PKG_VERSION:=2.38.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.38
+PKG_MD5SUM:=d13fb4968acea24c26b83268a308f580
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/libsoup
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libsoup
+  URL:=http://live.gnome.org/LibSoup
+  DEPENDS:=+glib2 +libxml2 +libgnutls
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-ssl \
+               --disable-glibtest \
+               --without-apache-httpd \
+               --without-gnome \
+       )
+endef
+
+define package/libsoup/decription
+Libsoup is an HTTP library implementation in C
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib/pkgconfig,include/libsoup-2.4/libsoup}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libsoup-2.4.{so*,la,a} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/libsoup-2.4/libsoup/*.h \
+               $(1)/usr/include/libsoup-2.4/libsoup/
+endef
+
+define Package/libsoup/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libsoup-2.4.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsoup))
diff --git a/libs/libspe2/Makefile b/libs/libspe2/Makefile
new file mode 100644 (file)
index 0000000..0693adc
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2006-2008 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:=libspe2
+PKG_VERSION:=2.3.0
+PKG_MINOR_VERSION:=135
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).$(PKG_MINOR_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libspe
+PKG_MD5SUM:=c77dc69d3585d45f980e661232ae2b0b
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libspe2
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=SPE Runtime Management Library for the Cell Broadband Engine
+  DEPENDS:=@TARGET_ps3||TARGET_ps3chk
+  URL:=http://sourceforge.net/projects/libspe/
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" SYSROOT="" CROSS=$(TARGET_CROSS) all install
+endef
+
+define Build/InstallDev
+       echo "Build/InstallDev"
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP)   $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP)   $(PKG_INSTALL_DIR)/usr/lib/libspe2* $(1)/usr/lib/
+endef
+
+define Package/libspe2/install
+       echo "Package/libspe2/install"
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libspe2* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libspe2))
diff --git a/libs/libspe2/patches/001-remove_tls_requirement.patch b/libs/libspe2/patches/001-remove_tls_requirement.patch
new file mode 100644 (file)
index 0000000..ae4d118
--- /dev/null
@@ -0,0 +1,93 @@
+--- libspe2-2.3.0.old/spebase/run.c    2008-10-28 14:43:09.000000000 +0100
++++ libspe2-2.3.0/spebase/run.c        2008-10-28 14:44:07.000000000 +0100
+@@ -37,6 +37,7 @@
+ #include "spebase.h"
+ #include "regs.h"
++#if 0
+ /*Thread-local variable for use by the debugger*/
+ __thread struct spe_context_info {
+       int spe_id;
+@@ -44,13 +45,15 @@
+       unsigned int status;
+       struct spe_context_info *prev;
+ }*__spe_current_active_context;
++#endif
+-
++#if 0
+ static void cleanupspeinfo(struct spe_context_info *ctxinfo)
+ {
+       struct spe_context_info *tmp = ctxinfo->prev;
+       __spe_current_active_context = tmp;
+ }
++#endif
+ static int issue_isolated_exit(struct spe_context *spe)
+ {
+@@ -69,12 +72,14 @@
+       return 0;
+ }
++#if 0
+ static inline void freespeinfo()
+ {
+       /*Clean up the debug variable*/
+       struct spe_context_info *tmp = __spe_current_active_context->prev;
+       __spe_current_active_context = tmp;
+ }
++#endif
+ int _base_spe_context_run(spe_context_ptr_t spe, unsigned int *entry,
+               unsigned int runflags, void *argp, void *envp,
+@@ -83,7 +88,9 @@
+       int retval = 0, run_rc;
+       unsigned int run_status, tmp_entry;
+       spe_stop_info_t stopinfo_buf;
++#if 0
+       struct spe_context_info this_context_info __attribute__((cleanup(cleanupspeinfo)));
++#endif
+       /* If the caller hasn't set a stopinfo buffer, provide a buffer on the
+        * stack instead. */
+@@ -146,6 +153,7 @@
+                       return -1;
+       }
++#if 0
+       /*Leave a trail of breadcrumbs for the debugger to follow */
+       if (!__spe_current_active_context) {
+               __spe_current_active_context = &this_context_info;
+@@ -162,18 +170,23 @@
+       }
+       /*remember the ls-addr*/
+       __spe_current_active_context->spe_id = spe->base_private->fd_spe_dir;
++#endif
+ do_run:
++#if 0
+       /*Remember the npc value*/
+       __spe_current_active_context->npc = tmp_entry;
++#endif
+       /* run SPE context */
+       run_rc = spu_run(spe->base_private->fd_spe_dir,
+                       &tmp_entry, &run_status);
++#if 0
+       /*Remember the npc value*/
+       __spe_current_active_context->npc = tmp_entry;
+       __spe_current_active_context->status = run_status;
++#endif
+       DEBUG_PRINTF("spu_run returned run_rc=0x%08x, entry=0x%04x, "
+                       "ext_status=0x%04x.\n", run_rc, tmp_entry, run_status);
+@@ -341,6 +354,8 @@
+       }
++#if 0
+       freespeinfo();
++#endif
+       return retval;
+ }
diff --git a/libs/libsynce/Makefile b/libs/libsynce/Makefile
new file mode 100644 (file)
index 0000000..48d5a12
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2008 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:=libsynce
+PKG_VERSION:=0.12
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/synce
+PKG_MD5SUM:=fd473d3deceda7912af4427dede1736f
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+define Package/libsynce
+  DEPENDS:=$(ICONV_DEPENDS) $(INTL_DEPENDS)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=SynCE library
+  URL:=http://synce.sourceforge.net/
+endef
+
+define Package/libsynce/description
+The purpose of the SynCE project is to provide a means of communication with a
+Windows CE or Pocket PC device from a computer running Linux, *BSD or other unices.
+endef
+
+MAKE_FLAGS += \
+       OPTIM="$(TARGET_CFLAGS)" \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       DESTDIR="$(PKG_INSTALL_DIR)"
+
+CONFIGURE_ARGS += \
+       --enable-hal-support=no \
+       --enable-odccm-support=no
+
+CONFIGURE_VARS+= \
+       CPPFLAGS="$$$$CPPFLAGS -I$(ICONV_PREFIX)/include" \
+       CPPFLAGS="$$$$CPPFLAGS -I$(INTL_PREFIX)/include" \
+       LDFLAGS="$$$$LDFLAGS -L$(ICONV_PREFIX)/lib" \
+       LDFLAGS="$$$$LDFLAGS -L$(INTL_PREFIX)/lib" \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsynce.so* $(1)/usr/lib/
+endef
+
+define Package/libsynce/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsynce.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libsynce))
diff --git a/libs/libtorrent/Makefile b/libs/libtorrent/Makefile
new file mode 100644 (file)
index 0000000..ce203ce
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2007-2013 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:=libtorrent
+PKG_VERSION:=0.13.3-git
+PKG_RELEASE=$(PKG_SOURCE_VERSION)-1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/rakshasa/libtorrent.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=680576e23e7d5f642ee51486fdf301ac0195e188
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libtorrent
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Rakshasa's BitTorrent library
+  URL:=http://libtorrent.rakshasa.no/
+  DEPENDS:=+libopenssl +libsigcxx
+endef
+
+define Package/libtorrent/description
+ LibTorrent is a BitTorrent library written in C++ for *nix, with a focus on
+ high performance and good code. The library differentiates itself from other
+ implementations by transfering directly from file pages to the network stack.
+ On high-bandwidth connections it is able to seed at 3 times the speed of the
+ official client.
+endef
+
+TARGET_LDFLAGS += $(LIBGCC_S)
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --enable-static \
+       --enable-aligned \
+       --disable-debug \
+       --enable-openssl \
+       --disable-instrumentation
+
+define Build/Configure
+       ( cd $(PKG_BUILD_DIR); ./autogen.sh );
+       $(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/torrent $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtorrent.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libtorrent/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libtorrent))
diff --git a/libs/libtorrent/patches/100-fix_cross_compile.patch b/libs/libtorrent/patches/100-fix_cross_compile.patch
new file mode 100644 (file)
index 0000000..202ee00
--- /dev/null
@@ -0,0 +1,41 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -19,7 +19,6 @@ AC_SUBST(LIBTORRENT_INTERFACE_VERSION_NO
+ AM_INIT_AUTOMAKE
+ AC_CONFIG_HEADERS(config.h)
+-AM_PATH_CPPUNIT(1.9.6)
+ AC_PROG_CXX
+--- a/scripts/checks.m4
++++ b/scripts/checks.m4
+@@ -96,7 +96,7 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE], [
+ AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [
+   AC_MSG_CHECKING(whether kqueue supports pipes and ptys)
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([
++  AC_LINK_IFELSE([AC_LANG_SOURCE([
+       #include <fcntl.h>
+       #include <stdlib.h>
+       #include <unistd.h>
+--- a/scripts/common.m4
++++ b/scripts/common.m4
+@@ -223,7 +223,7 @@ dnl   Need to fix this so that it uses t
+ AC_DEFUN([TORRENT_CHECK_EXECINFO], [
+   AC_MSG_CHECKING(for execinfo.h)
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([
++  AC_LINK_IFELSE([AC_LANG_SOURCE([
+       #include <execinfo.h>
+       int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); return 0;}
+       ])],
+@@ -238,7 +238,7 @@ AC_DEFUN([TORRENT_CHECK_EXECINFO], [
+ AC_DEFUN([TORRENT_CHECK_ALIGNED], [
+   AC_MSG_CHECKING(the byte alignment)
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([
++  AC_LINK_IFELSE([AC_LANG_SOURCE([
+       #include <inttypes.h>
+       int main() {
+         char buf@<:@8@:>@ = { 0, 0, 0, 0, 1, 0, 0, 0 };
diff --git a/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch b/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch
new file mode 100644 (file)
index 0000000..1a46627
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/src/net/socket_datagram.cc
++++ b/src/net/socket_datagram.cc
+@@ -73,6 +73,23 @@ SocketDatagram::write_datagram(const voi
+   int r;
+   if (sa != NULL) {
++#ifdef RAK_USE_INET6
++    if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet) {
++      uint32_t addr32[4];
++      sockaddr_in6 mapped_addr;
++      memset(&mapped_addr, 0, sizeof(mapped_addr));
++      mapped_addr.sin6_family = AF_INET6;
++      addr32[0] = 0;
++      addr32[1] = 0;
++      addr32[2] = htonl(0xffff);
++      addr32[3] = sa->sa_inet()->address_n();
++      memcpy(mapped_addr.sin6_addr.s6_addr, addr32, sizeof(uint32_t) * 4);
++      mapped_addr.sin6_port = sa->sa_inet()->port_n();
++      r = ::sendto(m_fileDesc, buffer, length, 0, (sockaddr*)&mapped_addr, sizeof(mapped_addr));
++    } else if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet6) {
++      r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet6()->c_sockaddr(), sizeof(rak::socket_address_inet6));
++    } else
++#endif
+     r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet));
+   } else {
+     r = ::send(m_fileDesc, buffer, length, 0);
diff --git a/libs/libtwin/Makefile b/libs/libtwin/Makefile
new file mode 100644 (file)
index 0000000..9e6d1c9
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2006 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:=libtwin
+PKG_VERSION:=0.0.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ozlabs.org/~jk/projects/petitboot/downloads/
+PKG_MD5SUM:=ebd7c5cca3c9e108208a7bf17b256a6c
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/libtwin
+       SECTION:=libs
+       CATEGORY:=Libraries
+       DEPENDS:=+zlib +libpng +libjpeg +libfreetype
+       TITLE:=The tiny windowing system library
+       URL:=http://ozlabs.org/~jk/projects/petitboot/
+       MAINTAINER:=Geoff Levand <geoffrey.levand@am.sony.com>
+endef
+
+define Package/libtwin/description
+       Keith Packard's Tiny Windowing System Library
+endef
+
+CONFIGURE_ARGS += --enable-shared --enable-static --disable-x11
+
+ifdef CONFIG_powerpc
+  EXTRA_CFLAGS += -flax-vector-conversions
+endif
+
+TARGET_LDFLAGS += \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/libtwin
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/libtwin/*.h \
+               $(1)/usr/include/libtwin
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/lib/libtwin.{la,a,so*} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtwin.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libtwin/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/lib/libtwin.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libtwin))
diff --git a/libs/libtwin/patches/100-compile_fix.patch b/libs/libtwin/patches/100-compile_fix.patch
new file mode 100644 (file)
index 0000000..dd9f9f8
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/libtwin/twin_feature.c
++++ b/libtwin/twin_feature.c
+@@ -55,7 +55,7 @@
+ }
+ #else
+-#define _twin_have_altivec()
++#define _twin_have_altivec() 0
+ #endif /* HAVE_ALTIVEC */
+ int twin_has_feature(unsigned int feature)
diff --git a/libs/libugpio/Makefile b/libs/libugpio/Makefile
new file mode 100644 (file)
index 0000000..3aed0d1
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2012 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:=libugpio
+PKG_VERSION:=0.0.1
+PKG_RELEASE=$(PKG_SOURCE_VERSION)-1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/mhei/libugpio.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=8235d04096bfa9db594d5df75c5cd634a3bbc39a
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libugpio
+  SECTION:=libs
+  CATEGORY:=Libraries
+  URL:=https://github.com/mhei/libugpio
+  TITLE:=Library for using sysfs gpio interface from C programs
+  DEPENDS:=@GPIO_SUPPORT
+endef
+
+define Package/libugpio/description
+  libugpio is a library to ease the use of linux kernel's sysfs
+  gpio interface from C programs and/or other libraries.
+endef
+
+define Package/gpioctl-sysfs
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Tool for controlling gpio pins
+  DEPENDS:=+libugpio
+endef
+
+define Package/gpioctl-sysfs/description
+  Tool for controlling gpio pins using the sysfs api provided by the kernel.
+endef
+
+define Build/Configure
+       ( cd "$(PKG_BUILD_DIR)"; ./autogen.sh )
+       $(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ugpio $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libugpio.{so*,a} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libugpio.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libugpio/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libugpio.so* $(1)/usr/lib/
+endef
+
+define Package/gpioctl-sysfs/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gpioctl $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libugpio))
+$(eval $(call BuildPackage,gpioctl-sysfs))
diff --git a/libs/libusbmuxd/Makefile b/libs/libusbmuxd/Makefile
new file mode 100644 (file)
index 0000000..121597f
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (C) 2012-2014 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:=libusbmuxd
+PKG_VERSION:=1.0.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.libimobiledevice.org/downloads
+PKG_MD5SUM:=3f1d4bd0c0a1a4d7bf96219e117ec499
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libusbmuxd/Default
+  TITLE:=USB multiplexing daemon
+  URL:=http://www.libimobiledevice.org/
+endef
+
+define Package/libusbmuxd/Default/description
+  This daemon is in charge of multiplexing connections over USB to an iPhone or
+  iPod touch. To users, it means you can sync your music, contacts, photos, etc.
+  over USB. To developers, it means you can connect to any listening localhost
+  socket on the device. usbmuxd is not used for tethering data transfer, which
+  uses a dedicated USB interface as a virtual network device.
+endef
+
+define Package/libusbmuxd
+  $(call Package/libusbmuxd/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+  DEPENDS:=+libplist +libpthread +libxml2 +zlib
+endef
+
+define Package/libusbmuxd/description
+  $(call Package/libusbmuxd/Default/description)
+  This package contains the libusbmuxd shared library.
+endef
+
+define Package/libusbmuxd-utils
+  $(call Package/libusbmuxd/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= utilies
+  DEPENDS:=+libusbmuxd
+endef
+
+define Package/libusbmuxd-utils/description
+  $(call Package/libusbmuxd/Default/description)
+  This package contains the libusbmuxd utilities.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusbmuxd.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libusbmuxd.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libusbmuxd/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusbmuxd.so.* $(1)/usr/lib/
+endef
+
+define Package/libusbmuxd-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/iproxy $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libusbmuxd))
+$(eval $(call BuildPackage,libusbmuxd-utils))
diff --git a/libs/libvncserver/Makefile b/libs/libvncserver/Makefile
new file mode 100644 (file)
index 0000000..fedd59f
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2009 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:=LibVNCServer
+PKG_VERSION:=0.9.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libvncserver
+PKG_MD5SUM:=14af5bdae461df4666c18e5f83c150c4
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+PKG_INSTALL=1
+
+define Package/libvncserver
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+zlib +libjpeg +libpthread $(ICONV_DEPENDS)
+  TITLE:=VNC Server Library
+  URL:=http://libvncserver.sourceforge.net/
+endef
+
+CONFIGURE_ARGS += \
+       --without-xkeyboard \
+       --without-xinerama \
+       --without-xrandr \
+       --without-xfixes \
+       --without-xdamage \
+       --without-xtrap \
+       --without-xrecord \
+       --without-fbpm \
+       --without-dpms \
+       --without-filetransfer \
+       --without-macosx-native \
+       --without-ssl \
+       --without-avahi
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib,include,bin}
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+endef
+
+define Package/libvncserver/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libvncserver))
diff --git a/libs/libvncserver/patches/001-automake-compat.patch b/libs/libvncserver/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..eb8de73
--- /dev/null
@@ -0,0 +1,6426 @@
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -601,6401 +601,3 @@ AS_VAR_POPDEF([_PKG])dnl
+ AS_VAR_POPDEF([_DEF])dnl
+ AS_VAR_POPDEF([_OUT])dnl
+ ],[PACKAGE="$PACKAGE"])])
+-
+-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+-## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+-## Free Software Foundation, Inc.
+-## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+-##
+-## This file is free software; the Free Software Foundation gives
+-## unlimited permission to copy and/or distribute it, with or without
+-## modifications, as long as this notice is preserved.
+-
+-# serial 48 AC_PROG_LIBTOOL
+-
+-
+-# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+-# -----------------------------------------------------------
+-# If this macro is not defined by Autoconf, define it here.
+-m4_ifdef([AC_PROVIDE_IFELSE],
+-         [],
+-         [m4_define([AC_PROVIDE_IFELSE],
+-               [m4_ifdef([AC_PROVIDE_$1],
+-                         [$2], [$3])])])
+-
+-
+-# AC_PROG_LIBTOOL
+-# ---------------
+-AC_DEFUN([AC_PROG_LIBTOOL],
+-[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+-dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+-dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+-  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+-    [AC_LIBTOOL_CXX],
+-    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+-  ])])
+-dnl And a similar setup for Fortran 77 support
+-  AC_PROVIDE_IFELSE([AC_PROG_F77],
+-    [AC_LIBTOOL_F77],
+-    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+-])])
+-
+-dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+-dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+-dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+-  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+-    [AC_LIBTOOL_GCJ],
+-    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+-      [AC_LIBTOOL_GCJ],
+-      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+-      [AC_LIBTOOL_GCJ],
+-      [ifdef([AC_PROG_GCJ],
+-           [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+-       ifdef([A][M_PROG_GCJ],
+-           [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+-       ifdef([LT_AC_PROG_GCJ],
+-           [define([LT_AC_PROG_GCJ],
+-              defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+-])])# AC_PROG_LIBTOOL
+-
+-
+-# _AC_PROG_LIBTOOL
+-# ----------------
+-AC_DEFUN([_AC_PROG_LIBTOOL],
+-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+-AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+-AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+-AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+-
+-# This can be used to rebuild libtool when needed
+-LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+-
+-# Always use our own libtool.
+-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+-AC_SUBST(LIBTOOL)dnl
+-
+-# Prevent multiple expansion
+-define([AC_PROG_LIBTOOL], [])
+-])# _AC_PROG_LIBTOOL
+-
+-
+-# AC_LIBTOOL_SETUP
+-# ----------------
+-AC_DEFUN([AC_LIBTOOL_SETUP],
+-[AC_PREREQ(2.50)dnl
+-AC_REQUIRE([AC_ENABLE_SHARED])dnl
+-AC_REQUIRE([AC_ENABLE_STATIC])dnl
+-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+-AC_REQUIRE([AC_CANONICAL_HOST])dnl
+-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+-AC_REQUIRE([AC_PROG_CC])dnl
+-AC_REQUIRE([AC_PROG_LD])dnl
+-AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+-AC_REQUIRE([AC_PROG_NM])dnl
+-
+-AC_REQUIRE([AC_PROG_LN_S])dnl
+-AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+-AC_REQUIRE([AC_OBJEXT])dnl
+-AC_REQUIRE([AC_EXEEXT])dnl
+-dnl
+-
+-AC_LIBTOOL_SYS_MAX_CMD_LEN
+-AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+-AC_LIBTOOL_OBJDIR
+-
+-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+-_LT_AC_PROG_ECHO_BACKSLASH
+-
+-case $host_os in
+-aix3*)
+-  # AIX sometimes has problems with the GCC collect2 program.  For some
+-  # reason, if we set the COLLECT_NAMES environment variable, the problems
+-  # vanish in a puff of smoke.
+-  if test "X${COLLECT_NAMES+set}" != Xset; then
+-    COLLECT_NAMES=
+-    export COLLECT_NAMES
+-  fi
+-  ;;
+-esac
+-
+-# Sed substitution that helps us do robust quoting.  It backslashifies
+-# metacharacters that are still active within double-quoted strings.
+-Xsed='sed -e 1s/^X//'
+-[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+-
+-# Same as above, but do not quote variable references.
+-[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+-
+-# Sed substitution to delay expansion of an escaped shell variable in a
+-# double_quote_subst'ed string.
+-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+-
+-# Sed substitution to avoid accidental globbing in evaled expressions
+-no_glob_subst='s/\*/\\\*/g'
+-
+-# Constants:
+-rm="rm -f"
+-
+-# Global variables:
+-default_ofile=libtool
+-can_build_shared=yes
+-
+-# All known linkers require a `.a' archive for static linking (except MSVC,
+-# which needs '.lib').
+-libext=a
+-ltmain="$ac_aux_dir/ltmain.sh"
+-ofile="$default_ofile"
+-with_gnu_ld="$lt_cv_prog_gnu_ld"
+-
+-AC_CHECK_TOOL(AR, ar, false)
+-AC_CHECK_TOOL(RANLIB, ranlib, :)
+-AC_CHECK_TOOL(STRIP, strip, :)
+-
+-old_CC="$CC"
+-old_CFLAGS="$CFLAGS"
+-
+-# Set sane defaults for various variables
+-test -z "$AR" && AR=ar
+-test -z "$AR_FLAGS" && AR_FLAGS=cru
+-test -z "$AS" && AS=as
+-test -z "$CC" && CC=cc
+-test -z "$LTCC" && LTCC=$CC
+-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+-test -z "$DLLTOOL" && DLLTOOL=dlltool
+-test -z "$LD" && LD=ld
+-test -z "$LN_S" && LN_S="ln -s"
+-test -z "$MAGIC_CMD" && MAGIC_CMD=file
+-test -z "$NM" && NM=nm
+-test -z "$SED" && SED=sed
+-test -z "$OBJDUMP" && OBJDUMP=objdump
+-test -z "$RANLIB" && RANLIB=:
+-test -z "$STRIP" && STRIP=:
+-test -z "$ac_objext" && ac_objext=o
+-
+-# Determine commands to create old-style static archives.
+-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+-old_postinstall_cmds='chmod 644 $oldlib'
+-old_postuninstall_cmds=
+-
+-if test -n "$RANLIB"; then
+-  case $host_os in
+-  openbsd*)
+-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+-    ;;
+-  *)
+-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+-    ;;
+-  esac
+-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+-fi
+-
+-_LT_CC_BASENAME([$compiler])
+-
+-# Only perform the check for file, if the check method requires it
+-case $deplibs_check_method in
+-file_magic*)
+-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+-    AC_PATH_MAGIC
+-  fi
+-  ;;
+-esac
+-
+-AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+-enable_win32_dll=yes, enable_win32_dll=no)
+-
+-AC_ARG_ENABLE([libtool-lock],
+-    [AC_HELP_STRING([--disable-libtool-lock],
+-      [avoid locking (might break parallel builds)])])
+-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+-
+-AC_ARG_WITH([pic],
+-    [AC_HELP_STRING([--with-pic],
+-      [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+-    [pic_mode="$withval"],
+-    [pic_mode=default])
+-test -z "$pic_mode" && pic_mode=default
+-
+-# Use C for the default configuration in the libtool script
+-tagname=
+-AC_LIBTOOL_LANG_C_CONFIG
+-_LT_AC_TAGCONFIG
+-])# AC_LIBTOOL_SETUP
+-
+-
+-# _LT_AC_SYS_COMPILER
+-# -------------------
+-AC_DEFUN([_LT_AC_SYS_COMPILER],
+-[AC_REQUIRE([AC_PROG_CC])dnl
+-
+-# If no C compiler was specified, use CC.
+-LTCC=${LTCC-"$CC"}
+-
+-# If no C compiler flags were specified, use CFLAGS.
+-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+-
+-# Allow CC to be a program name with arguments.
+-compiler=$CC
+-])# _LT_AC_SYS_COMPILER
+-
+-
+-# _LT_CC_BASENAME(CC)
+-# -------------------
+-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+-AC_DEFUN([_LT_CC_BASENAME],
+-[for cc_temp in $1""; do
+-  case $cc_temp in
+-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+-    \-*) ;;
+-    *) break;;
+-  esac
+-done
+-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+-])
+-
+-
+-# _LT_COMPILER_BOILERPLATE
+-# ------------------------
+-# Check for compiler boilerplate output or warnings with
+-# the simple compiler test code.
+-AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+-[ac_outfile=conftest.$ac_objext
+-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+-_lt_compiler_boilerplate=`cat conftest.err`
+-$rm conftest*
+-])# _LT_COMPILER_BOILERPLATE
+-
+-
+-# _LT_LINKER_BOILERPLATE
+-# ----------------------
+-# Check for linker boilerplate output or warnings with
+-# the simple link test code.
+-AC_DEFUN([_LT_LINKER_BOILERPLATE],
+-[ac_outfile=conftest.$ac_objext
+-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+-_lt_linker_boilerplate=`cat conftest.err`
+-$rm conftest*
+-])# _LT_LINKER_BOILERPLATE
+-
+-
+-# _LT_AC_SYS_LIBPATH_AIX
+-# ----------------------
+-# Links a minimal program and checks the executable
+-# for the system default hardcoded library path. In most cases,
+-# this is /usr/lib:/lib, but when the MPI compilers are used
+-# the location of the communication and MPI libs are included too.
+-# If we don't find anything, use the default library path according
+-# to the aix ld manual.
+-AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+-[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+-}'`
+-# Check for a 64-bit object if we didn't find anything.
+-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+-}'`; fi],[])
+-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+-])# _LT_AC_SYS_LIBPATH_AIX
+-
+-
+-# _LT_AC_SHELL_INIT(ARG)
+-# ----------------------
+-AC_DEFUN([_LT_AC_SHELL_INIT],
+-[ifdef([AC_DIVERSION_NOTICE],
+-           [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+-       [AC_DIVERT_PUSH(NOTICE)])
+-$1
+-AC_DIVERT_POP
+-])# _LT_AC_SHELL_INIT
+-
+-
+-# _LT_AC_PROG_ECHO_BACKSLASH
+-# --------------------------
+-# Add some code to the start of the generated configure script which
+-# will find an echo command which doesn't interpret backslashes.
+-AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+-[_LT_AC_SHELL_INIT([
+-# Check that we are running under the correct shell.
+-SHELL=${CONFIG_SHELL-/bin/sh}
+-
+-case X$ECHO in
+-X*--fallback-echo)
+-  # Remove one level of quotation (which was required for Make).
+-  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+-  ;;
+-esac
+-
+-echo=${ECHO-echo}
+-if test "X[$]1" = X--no-reexec; then
+-  # Discard the --no-reexec flag, and continue.
+-  shift
+-elif test "X[$]1" = X--fallback-echo; then
+-  # Avoid inline document here, it may be left over
+-  :
+-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+-  # Yippee, $echo works!
+-  :
+-else
+-  # Restart under the correct shell.
+-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+-fi
+-
+-if test "X[$]1" = X--fallback-echo; then
+-  # used as fallback echo
+-  shift
+-  cat <<EOF
+-[$]*
+-EOF
+-  exit 0
+-fi
+-
+-# The HP-UX ksh and POSIX shell print the target directory to stdout
+-# if CDPATH is set.
+-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+-
+-if test -z "$ECHO"; then
+-if test "X${echo_test_string+set}" != Xset; then
+-# find a string as large as possible, as long as the shell can cope with it
+-  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+-    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+-    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+-       echo_test_string=`eval $cmd` &&
+-       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+-    then
+-      break
+-    fi
+-  done
+-fi
+-
+-if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+-   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+-   test "X$echo_testing_string" = "X$echo_test_string"; then
+-  :
+-else
+-  # The Solaris, AIX, and Digital Unix default echo programs unquote
+-  # backslashes.  This makes it impossible to quote backslashes using
+-  #   echo "$something" | sed 's/\\/\\\\/g'
+-  #
+-  # So, first we look for a working echo in the user's PATH.
+-
+-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+-  for dir in $PATH /usr/ucb; do
+-    IFS="$lt_save_ifs"
+-    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+-       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+-       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+-       test "X$echo_testing_string" = "X$echo_test_string"; then
+-      echo="$dir/echo"
+-      break
+-    fi
+-  done
+-  IFS="$lt_save_ifs"
+-
+-  if test "X$echo" = Xecho; then
+-    # We didn't find a better echo, so look for alternatives.
+-    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+-       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+-       test "X$echo_testing_string" = "X$echo_test_string"; then
+-      # This shell has a builtin print -r that does the trick.
+-      echo='print -r'
+-    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+-       test "X$CONFIG_SHELL" != X/bin/ksh; then
+-      # If we have ksh, try running configure again with it.
+-      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+-      export ORIGINAL_CONFIG_SHELL
+-      CONFIG_SHELL=/bin/ksh
+-      export CONFIG_SHELL
+-      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+-    else
+-      # Try using printf.
+-      echo='printf %s\n'
+-      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+-       echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+-       test "X$echo_testing_string" = "X$echo_test_string"; then
+-      # Cool, printf works
+-      :
+-      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+-         test "X$echo_testing_string" = 'X\t' &&
+-         echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+-         test "X$echo_testing_string" = "X$echo_test_string"; then
+-      CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+-      export CONFIG_SHELL
+-      SHELL="$CONFIG_SHELL"
+-      export SHELL
+-      echo="$CONFIG_SHELL [$]0 --fallback-echo"
+-      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+-         test "X$echo_testing_string" = 'X\t' &&
+-         echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+-         test "X$echo_testing_string" = "X$echo_test_string"; then
+-      echo="$CONFIG_SHELL [$]0 --fallback-echo"
+-      else
+-      # maybe with a smaller string...
+-      prev=:
+-
+-      for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+-        if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+-        then
+-          break
+-        fi
+-        prev="$cmd"
+-      done
+-
+-      if test "$prev" != 'sed 50q "[$]0"'; then
+-        echo_test_string=`eval $prev`
+-        export echo_test_string
+-        exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+-      else
+-        # Oops.  We lost completely, so just stick with echo.
+-        echo=echo
+-      fi
+-      fi
+-    fi
+-  fi
+-fi
+-fi
+-
+-# Copy echo and quote the copy suitably for passing to libtool from
+-# the Makefile, instead of quoting the original, which is used later.
+-ECHO=$echo
+-if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+-   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+-fi
+-
+-AC_SUBST(ECHO)
+-])])# _LT_AC_PROG_ECHO_BACKSLASH
+-
+-
+-# _LT_AC_LOCK
+-# -----------
+-AC_DEFUN([_LT_AC_LOCK],
+-[AC_ARG_ENABLE([libtool-lock],
+-    [AC_HELP_STRING([--disable-libtool-lock],
+-      [avoid locking (might break parallel builds)])])
+-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+-
+-# Some flags need to be propagated to the compiler or linker for good
+-# libtool support.
+-case $host in
+-ia64-*-hpux*)
+-  # Find out which ABI we are using.
+-  echo 'int i;' > conftest.$ac_ext
+-  if AC_TRY_EVAL(ac_compile); then
+-    case `/usr/bin/file conftest.$ac_objext` in
+-    *ELF-32*)
+-      HPUX_IA64_MODE="32"
+-      ;;
+-    *ELF-64*)
+-      HPUX_IA64_MODE="64"
+-      ;;
+-    esac
+-  fi
+-  rm -rf conftest*
+-  ;;
+-*-*-irix6*)
+-  # Find out which ABI we are using.
+-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+-  if AC_TRY_EVAL(ac_compile); then
+-   if test "$lt_cv_prog_gnu_ld" = yes; then
+-    case `/usr/bin/file conftest.$ac_objext` in
+-    *32-bit*)
+-      LD="${LD-ld} -melf32bsmip"
+-      ;;
+-    *N32*)
+-      LD="${LD-ld} -melf32bmipn32"
+-      ;;
+-    *64-bit*)
+-      LD="${LD-ld} -melf64bmip"
+-      ;;
+-    esac
+-   else
+-    case `/usr/bin/file conftest.$ac_objext` in
+-    *32-bit*)
+-      LD="${LD-ld} -32"
+-      ;;
+-    *N32*)
+-      LD="${LD-ld} -n32"
+-      ;;
+-    *64-bit*)
+-      LD="${LD-ld} -64"
+-      ;;
+-    esac
+-   fi
+-  fi
+-  rm -rf conftest*
+-  ;;
+-
+-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+-  # Find out which ABI we are using.
+-  echo 'int i;' > conftest.$ac_ext
+-  if AC_TRY_EVAL(ac_compile); then
+-    case `/usr/bin/file conftest.o` in
+-    *32-bit*)
+-      case $host in
+-        x86_64-*linux*)
+-          LD="${LD-ld} -m elf_i386"
+-          ;;
+-        ppc64-*linux*|powerpc64-*linux*)
+-          LD="${LD-ld} -m elf32ppclinux"
+-          ;;
+-        s390x-*linux*)
+-          LD="${LD-ld} -m elf_s390"
+-          ;;
+-        sparc64-*linux*)
+-          LD="${LD-ld} -m elf32_sparc"
+-          ;;
+-      esac
+-      ;;
+-    *64-bit*)
+-      case $host in
+-        x86_64-*linux*)
+-          LD="${LD-ld} -m elf_x86_64"
+-          ;;
+-        ppc*-*linux*|powerpc*-*linux*)
+-          LD="${LD-ld} -m elf64ppc"
+-          ;;
+-        s390*-*linux*)
+-          LD="${LD-ld} -m elf64_s390"
+-          ;;
+-        sparc*-*linux*)
+-          LD="${LD-ld} -m elf64_sparc"
+-          ;;
+-      esac
+-      ;;
+-    esac
+-  fi
+-  rm -rf conftest*
+-  ;;
+-
+-*-*-sco3.2v5*)
+-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+-  SAVE_CFLAGS="$CFLAGS"
+-  CFLAGS="$CFLAGS -belf"
+-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+-    [AC_LANG_PUSH(C)
+-     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+-     AC_LANG_POP])
+-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+-    CFLAGS="$SAVE_CFLAGS"
+-  fi
+-  ;;
+-sparc*-*solaris*)
+-  # Find out which ABI we are using.
+-  echo 'int i;' > conftest.$ac_ext
+-  if AC_TRY_EVAL(ac_compile); then
+-    case `/usr/bin/file conftest.o` in
+-    *64-bit*)
+-      case $lt_cv_prog_gnu_ld in
+-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+-      *)    LD="${LD-ld} -64" ;;
+-      esac
+-      ;;
+-    esac
+-  fi
+-  rm -rf conftest*
+-  ;;
+-
+-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+-[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+-  AC_CHECK_TOOL(AS, as, false)
+-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+-  ;;
+-  ])
+-esac
+-
+-need_locks="$enable_libtool_lock"
+-
+-])# _LT_AC_LOCK
+-
+-
+-# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+-#             [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+-# ----------------------------------------------------------------
+-# Check whether the given compiler option works
+-AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+-[AC_REQUIRE([LT_AC_PROG_SED])
+-AC_CACHE_CHECK([$1], [$2],
+-  [$2=no
+-  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+-   lt_compiler_flag="$3"
+-   # Insert the option either (1) after the last *FLAGS variable, or
+-   # (2) before a word containing "conftest.", or (3) at the end.
+-   # Note that $ac_compile itself does not contain backslashes and begins
+-   # with a dollar sign (not a hyphen), so the echo should work correctly.
+-   # The option is referenced via a variable to avoid confusing sed.
+-   lt_compile=`echo "$ac_compile" | $SED \
+-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+-   -e 's:$: $lt_compiler_flag:'`
+-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+-   (eval "$lt_compile" 2>conftest.err)
+-   ac_status=$?
+-   cat conftest.err >&AS_MESSAGE_LOG_FD
+-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+-   if (exit $ac_status) && test -s "$ac_outfile"; then
+-     # The compiler can only warn and ignore the option if not recognized
+-     # So say no if there are warnings other than the usual output.
+-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+-       $2=yes
+-     fi
+-   fi
+-   $rm conftest*
+-])
+-
+-if test x"[$]$2" = xyes; then
+-    ifelse([$5], , :, [$5])
+-else
+-    ifelse([$6], , :, [$6])
+-fi
+-])# AC_LIBTOOL_COMPILER_OPTION
+-
+-
+-# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+-#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+-# ------------------------------------------------------------
+-# Check whether the given compiler option works
+-AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+-[AC_CACHE_CHECK([$1], [$2],
+-  [$2=no
+-   save_LDFLAGS="$LDFLAGS"
+-   LDFLAGS="$LDFLAGS $3"
+-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+-     # The linker can only warn and ignore the option if not recognized
+-     # So say no if there are warnings
+-     if test -s conftest.err; then
+-       # Append any errors to the config.log.
+-       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+-       if diff conftest.exp conftest.er2 >/dev/null; then
+-         $2=yes
+-       fi
+-     else
+-       $2=yes
+-     fi
+-   fi
+-   $rm conftest*
+-   LDFLAGS="$save_LDFLAGS"
+-])
+-
+-if test x"[$]$2" = xyes; then
+-    ifelse([$4], , :, [$4])
+-else
+-    ifelse([$5], , :, [$5])
+-fi
+-])# AC_LIBTOOL_LINKER_OPTION
+-
+-
+-# AC_LIBTOOL_SYS_MAX_CMD_LEN
+-# --------------------------
+-AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+-[# find the maximum length of command line arguments
+-AC_MSG_CHECKING([the maximum length of command line arguments])
+-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+-  i=0
+-  teststring="ABCD"
+-
+-  case $build_os in
+-  msdosdjgpp*)
+-    # On DJGPP, this test can blow up pretty badly due to problems in libc
+-    # (any single argument exceeding 2000 bytes causes a buffer overrun
+-    # during glob expansion).  Even if it were fixed, the result of this
+-    # check would be larger than it should be.
+-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+-    ;;
+-
+-  gnu*)
+-    # Under GNU Hurd, this test is not required because there is
+-    # no limit to the length of command line arguments.
+-    # Libtool will interpret -1 as no limit whatsoever
+-    lt_cv_sys_max_cmd_len=-1;
+-    ;;
+-
+-  cygwin* | mingw*)
+-    # On Win9x/ME, this test blows up -- it succeeds, but takes
+-    # about 5 minutes as the teststring grows exponentially.
+-    # Worse, since 9x/ME are not pre-emptively multitasking,
+-    # you end up with a "frozen" computer, even though with patience
+-    # the test eventually succeeds (with a max line length of 256k).
+-    # Instead, let's just punt: use the minimum linelength reported by
+-    # all of the supported platforms: 8192 (on NT/2K/XP).
+-    lt_cv_sys_max_cmd_len=8192;
+-    ;;
+-
+-  amigaos*)
+-    # On AmigaOS with pdksh, this test takes hours, literally.
+-    # So we just punt and use a minimum line length of 8192.
+-    lt_cv_sys_max_cmd_len=8192;
+-    ;;
+-
+-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+-    # This has been around since 386BSD, at least.  Likely further.
+-    if test -x /sbin/sysctl; then
+-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+-    elif test -x /usr/sbin/sysctl; then
+-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+-    else
+-      lt_cv_sys_max_cmd_len=65536     # usable default for all BSDs
+-    fi
+-    # And add a safety zone
+-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+-    ;;
+-
+-  interix*)
+-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+-    lt_cv_sys_max_cmd_len=196608
+-    ;;
+-
+-  osf*)
+-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+-    # nice to cause kernel panics so lets avoid the loop below.
+-    # First set a reasonable default.
+-    lt_cv_sys_max_cmd_len=16384
+-    #
+-    if test -x /sbin/sysconfig; then
+-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+-      esac
+-    fi
+-    ;;
+-  sco3.2v5*)
+-    lt_cv_sys_max_cmd_len=102400
+-    ;;
+-  sysv5* | sco5v6* | sysv4.2uw2*)
+-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+-    if test -n "$kargmax"; then
+-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[      ]]//'`
+-    else
+-      lt_cv_sys_max_cmd_len=32768
+-    fi
+-    ;;
+-  *)
+-    # If test is not a shell built-in, we'll probably end up computing a
+-    # maximum length that is only half of the actual maximum length, but
+-    # we can't tell.
+-    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+-    while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+-             = "XX$teststring") >/dev/null 2>&1 &&
+-          new_result=`expr "X$teststring" : ".*" 2>&1` &&
+-          lt_cv_sys_max_cmd_len=$new_result &&
+-          test $i != 17 # 1/2 MB should be enough
+-    do
+-      i=`expr $i + 1`
+-      teststring=$teststring$teststring
+-    done
+-    teststring=
+-    # Add a significant safety factor because C++ compilers can tack on massive
+-    # amounts of additional arguments before passing them to the linker.
+-    # It appears as though 1/2 is a usable value.
+-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+-    ;;
+-  esac
+-])
+-if test -n $lt_cv_sys_max_cmd_len ; then
+-  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+-else
+-  AC_MSG_RESULT(none)
+-fi
+-])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+-
+-
+-# _LT_AC_CHECK_DLFCN
+-# ------------------
+-AC_DEFUN([_LT_AC_CHECK_DLFCN],
+-[AC_CHECK_HEADERS(dlfcn.h)dnl
+-])# _LT_AC_CHECK_DLFCN
+-
+-
+-# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+-#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+-# ---------------------------------------------------------------------
+-AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+-if test "$cross_compiling" = yes; then :
+-  [$4]
+-else
+-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+-  lt_status=$lt_dlunknown
+-  cat > conftest.$ac_ext <<EOF
+-[#line __oline__ "configure"
+-#include "confdefs.h"
+-
+-#if HAVE_DLFCN_H
+-#include <dlfcn.h>
+-#endif
+-
+-#include <stdio.h>
+-
+-#ifdef RTLD_GLOBAL
+-#  define LT_DLGLOBAL         RTLD_GLOBAL
+-#else
+-#  ifdef DL_GLOBAL
+-#    define LT_DLGLOBAL               DL_GLOBAL
+-#  else
+-#    define LT_DLGLOBAL               0
+-#  endif
+-#endif
+-
+-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+-   find out it does not work in some platform. */
+-#ifndef LT_DLLAZY_OR_NOW
+-#  ifdef RTLD_LAZY
+-#    define LT_DLLAZY_OR_NOW          RTLD_LAZY
+-#  else
+-#    ifdef DL_LAZY
+-#      define LT_DLLAZY_OR_NOW                DL_LAZY
+-#    else
+-#      ifdef RTLD_NOW
+-#        define LT_DLLAZY_OR_NOW      RTLD_NOW
+-#      else
+-#        ifdef DL_NOW
+-#          define LT_DLLAZY_OR_NOW    DL_NOW
+-#        else
+-#          define LT_DLLAZY_OR_NOW    0
+-#        endif
+-#      endif
+-#    endif
+-#  endif
+-#endif
+-
+-#ifdef __cplusplus
+-extern "C" void exit (int);
+-#endif
+-
+-void fnord() { int i=42;}
+-int main ()
+-{
+-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+-  int status = $lt_dlunknown;
+-
+-  if (self)
+-    {
+-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+-      /* dlclose (self); */
+-    }
+-  else
+-    puts (dlerror ());
+-
+-    exit (status);
+-}]
+-EOF
+-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+-    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+-    lt_status=$?
+-    case x$lt_status in
+-      x$lt_dlno_uscore) $1 ;;
+-      x$lt_dlneed_uscore) $2 ;;
+-      x$lt_dlunknown|x*) $3 ;;
+-    esac
+-  else :
+-    # compilation failed
+-    $3
+-  fi
+-fi
+-rm -fr conftest*
+-])# _LT_AC_TRY_DLOPEN_SELF
+-
+-
+-# AC_LIBTOOL_DLOPEN_SELF
+-# ----------------------
+-AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+-if test "x$enable_dlopen" != xyes; then
+-  enable_dlopen=unknown
+-  enable_dlopen_self=unknown
+-  enable_dlopen_self_static=unknown
+-else
+-  lt_cv_dlopen=no
+-  lt_cv_dlopen_libs=
+-
+-  case $host_os in
+-  beos*)
+-    lt_cv_dlopen="load_add_on"
+-    lt_cv_dlopen_libs=
+-    lt_cv_dlopen_self=yes
+-    ;;
+-
+-  mingw* | pw32*)
+-    lt_cv_dlopen="LoadLibrary"
+-    lt_cv_dlopen_libs=
+-   ;;
+-
+-  cygwin*)
+-    lt_cv_dlopen="dlopen"
+-    lt_cv_dlopen_libs=
+-   ;;
+-
+-  darwin*)
+-  # if libdl is installed we need to link against it
+-    AC_CHECK_LIB([dl], [dlopen],
+-              [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+-    lt_cv_dlopen="dyld"
+-    lt_cv_dlopen_libs=
+-    lt_cv_dlopen_self=yes
+-    ])
+-   ;;
+-
+-  *)
+-    AC_CHECK_FUNC([shl_load],
+-        [lt_cv_dlopen="shl_load"],
+-      [AC_CHECK_LIB([dld], [shl_load],
+-          [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+-      [AC_CHECK_FUNC([dlopen],
+-            [lt_cv_dlopen="dlopen"],
+-        [AC_CHECK_LIB([dl], [dlopen],
+-              [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+-          [AC_CHECK_LIB([svld], [dlopen],
+-                [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+-            [AC_CHECK_LIB([dld], [dld_link],
+-                  [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+-            ])
+-          ])
+-        ])
+-      ])
+-      ])
+-    ;;
+-  esac
+-
+-  if test "x$lt_cv_dlopen" != xno; then
+-    enable_dlopen=yes
+-  else
+-    enable_dlopen=no
+-  fi
+-
+-  case $lt_cv_dlopen in
+-  dlopen)
+-    save_CPPFLAGS="$CPPFLAGS"
+-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+-
+-    save_LDFLAGS="$LDFLAGS"
+-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+-
+-    save_LIBS="$LIBS"
+-    LIBS="$lt_cv_dlopen_libs $LIBS"
+-
+-    AC_CACHE_CHECK([whether a program can dlopen itself],
+-        lt_cv_dlopen_self, [dnl
+-        _LT_AC_TRY_DLOPEN_SELF(
+-          lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+-          lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+-    ])
+-
+-    if test "x$lt_cv_dlopen_self" = xyes; then
+-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+-      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+-        lt_cv_dlopen_self_static, [dnl
+-        _LT_AC_TRY_DLOPEN_SELF(
+-          lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+-          lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+-      ])
+-    fi
+-
+-    CPPFLAGS="$save_CPPFLAGS"
+-    LDFLAGS="$save_LDFLAGS"
+-    LIBS="$save_LIBS"
+-    ;;
+-  esac
+-
+-  case $lt_cv_dlopen_self in
+-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+-  *) enable_dlopen_self=unknown ;;
+-  esac
+-
+-  case $lt_cv_dlopen_self_static in
+-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+-  *) enable_dlopen_self_static=unknown ;;
+-  esac
+-fi
+-])# AC_LIBTOOL_DLOPEN_SELF
+-
+-
+-# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+-# ---------------------------------
+-# Check to see if options -c and -o are simultaneously supported by compiler
+-AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+-  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+-  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+-   $rm -r conftest 2>/dev/null
+-   mkdir conftest
+-   cd conftest
+-   mkdir out
+-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+-
+-   lt_compiler_flag="-o out/conftest2.$ac_objext"
+-   # Insert the option either (1) after the last *FLAGS variable, or
+-   # (2) before a word containing "conftest.", or (3) at the end.
+-   # Note that $ac_compile itself does not contain backslashes and begins
+-   # with a dollar sign (not a hyphen), so the echo should work correctly.
+-   lt_compile=`echo "$ac_compile" | $SED \
+-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+-   -e 's:$: $lt_compiler_flag:'`
+-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+-   (eval "$lt_compile" 2>out/conftest.err)
+-   ac_status=$?
+-   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+-   then
+-     # The compiler can only warn and ignore the option if not recognized
+-     # So say no if there are warnings
+-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+-       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+-     fi
+-   fi
+-   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+-   $rm conftest*
+-   # SGI C++ compiler will create directory out/ii_files/ for
+-   # template instantiation
+-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+-   $rm out/* && rmdir out
+-   cd ..
+-   rmdir conftest
+-   $rm conftest*
+-])
+-])# AC_LIBTOOL_PROG_CC_C_O
+-
+-
+-# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+-# -----------------------------------------
+-# Check to see if we can do hard links to lock some files if needed
+-AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+-[AC_REQUIRE([_LT_AC_LOCK])dnl
+-
+-hard_links="nottested"
+-if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+-  # do not overwrite the value of need_locks provided by the user
+-  AC_MSG_CHECKING([if we can lock with hard links])
+-  hard_links=yes
+-  $rm conftest*
+-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+-  touch conftest.a
+-  ln conftest.a conftest.b 2>&5 || hard_links=no
+-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+-  AC_MSG_RESULT([$hard_links])
+-  if test "$hard_links" = no; then
+-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+-    need_locks=warn
+-  fi
+-else
+-  need_locks=no
+-fi
+-])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+-
+-
+-# AC_LIBTOOL_OBJDIR
+-# -----------------
+-AC_DEFUN([AC_LIBTOOL_OBJDIR],
+-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+-[rm -f .libs 2>/dev/null
+-mkdir .libs 2>/dev/null
+-if test -d .libs; then
+-  lt_cv_objdir=.libs
+-else
+-  # MS-DOS does not allow filenames that begin with a dot.
+-  lt_cv_objdir=_libs
+-fi
+-rmdir .libs 2>/dev/null])
+-objdir=$lt_cv_objdir
+-])# AC_LIBTOOL_OBJDIR
+-
+-
+-# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+-# ----------------------------------------------
+-# Check hardcoding attributes.
+-AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+-[AC_MSG_CHECKING([how to hardcode library paths into programs])
+-_LT_AC_TAGVAR(hardcode_action, $1)=
+-if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+-   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+-   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+-
+-  # We can hardcode non-existant directories.
+-  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+-     # have to relink, otherwise we might link with an installed library
+-     # when we should be linking with a yet-to-be-installed one
+-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+-     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+-    # Linking always hardcodes the temporary library directory.
+-    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+-  else
+-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+-    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+-  fi
+-else
+-  # We cannot hardcode anything, or else we can only hardcode existing
+-  # directories.
+-  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+-fi
+-AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+-
+-if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+-  # Fast installation is not supported
+-  enable_fast_install=no
+-elif test "$shlibpath_overrides_runpath" = yes ||
+-     test "$enable_shared" = no; then
+-  # Fast installation is not necessary
+-  enable_fast_install=needless
+-fi
+-])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+-
+-
+-# AC_LIBTOOL_SYS_LIB_STRIP
+-# ------------------------
+-AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+-[striplib=
+-old_striplib=
+-AC_MSG_CHECKING([whether stripping libraries is possible])
+-if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+-  AC_MSG_RESULT([yes])
+-else
+-# FIXME - insert some real tests, host_os isn't really good enough
+-  case $host_os in
+-   darwin*)
+-       if test -n "$STRIP" ; then
+-         striplib="$STRIP -x"
+-         AC_MSG_RESULT([yes])
+-       else
+-  AC_MSG_RESULT([no])
+-fi
+-       ;;
+-   *)
+-  AC_MSG_RESULT([no])
+-    ;;
+-  esac
+-fi
+-])# AC_LIBTOOL_SYS_LIB_STRIP
+-
+-
+-# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+-# -----------------------------
+-# PORTME Fill in your ld.so characteristics
+-AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+-[AC_MSG_CHECKING([dynamic linker characteristics])
+-library_names_spec=
+-libname_spec='lib$name'
+-soname_spec=
+-shrext_cmds=".so"
+-postinstall_cmds=
+-postuninstall_cmds=
+-finish_cmds=
+-finish_eval=
+-shlibpath_var=
+-shlibpath_overrides_runpath=unknown
+-version_type=none
+-dynamic_linker="$host_os ld.so"
+-sys_lib_dlsearch_path_spec="/lib /usr/lib"
+-if test "$GCC" = yes; then
+-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+-  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+-    # if the path contains ";" then we assume it to be the separator
+-    # otherwise default to the standard path separator (i.e. ":") - it is
+-    # assumed that no part of a normal pathname contains ";" but that should
+-    # okay in the real world where ";" in dirpaths is itself problematic.
+-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+-  else
+-    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+-  fi
+-else
+-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+-fi
+-need_lib_prefix=unknown
+-hardcode_into_libs=no
+-
+-# when you set need_version to no, make sure it does not cause -set_version
+-# flags to be left without arguments
+-need_version=unknown
+-
+-case $host_os in
+-aix3*)
+-  version_type=linux
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+-  shlibpath_var=LIBPATH
+-
+-  # AIX 3 has no versioning support, so we append a major version to the name.
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  ;;
+-
+-aix4* | aix5*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  hardcode_into_libs=yes
+-  if test "$host_cpu" = ia64; then
+-    # AIX 5 supports IA64
+-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+-    shlibpath_var=LD_LIBRARY_PATH
+-  else
+-    # With GCC up to 2.95.x, collect2 would create an import file
+-    # for dependence libraries.  The import file would start with
+-    # the line `#! .'.  This would cause the generated library to
+-    # depend on `.', always an invalid library.  This was fixed in
+-    # development snapshots of GCC prior to 3.0.
+-    case $host_os in
+-      aix4 | aix4.[[01]] | aix4.[[01]].*)
+-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+-         echo ' yes '
+-         echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+-      :
+-      else
+-      can_build_shared=no
+-      fi
+-      ;;
+-    esac
+-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+-    # soname into executable. Probably we can add versioning support to
+-    # collect2, so additional links can be useful in future.
+-    if test "$aix_use_runtimelinking" = yes; then
+-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+-      # instead of lib<name>.a to let people know that these are not
+-      # typical AIX shared libraries.
+-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-    else
+-      # We preserve .a as extension for shared libraries through AIX4.2
+-      # and later when we are not doing run time linking.
+-      library_names_spec='${libname}${release}.a $libname.a'
+-      soname_spec='${libname}${release}${shared_ext}$major'
+-    fi
+-    shlibpath_var=LIBPATH
+-  fi
+-  ;;
+-
+-amigaos*)
+-  library_names_spec='$libname.ixlibrary $libname.a'
+-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+-  ;;
+-
+-beos*)
+-  library_names_spec='${libname}${shared_ext}'
+-  dynamic_linker="$host_os ld.so"
+-  shlibpath_var=LIBRARY_PATH
+-  ;;
+-
+-bsdi[[45]]*)
+-  version_type=linux
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+-  # the default ld.so.conf also contains /usr/contrib/lib and
+-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+-  # libtool to hard-code these into programs
+-  ;;
+-
+-cygwin* | mingw* | pw32*)
+-  version_type=windows
+-  shrext_cmds=".dll"
+-  need_version=no
+-  need_lib_prefix=no
+-
+-  case $GCC,$host_os in
+-  yes,cygwin* | yes,mingw* | yes,pw32*)
+-    library_names_spec='$libname.dll.a'
+-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+-    postinstall_cmds='base_file=`basename \${file}`~
+-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+-      dldir=$destdir/`dirname \$dlpath`~
+-      test -d \$dldir || mkdir -p \$dldir~
+-      $install_prog $dir/$dlname \$dldir/$dlname~
+-      chmod a+x \$dldir/$dlname'
+-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+-      dlpath=$dir/\$dldll~
+-       $rm \$dlpath'
+-    shlibpath_overrides_runpath=yes
+-
+-    case $host_os in
+-    cygwin*)
+-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+-      ;;
+-    mingw*)
+-      # MinGW DLLs use traditional 'lib' prefix
+-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+-      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+-        # It is most probably a Windows format PATH printed by
+-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+-        # path with ; separators, and with drive letters. We can handle the
+-        # drive letters (cygwin fileutils understands them), so leave them,
+-        # especially as we might pass files found there to a mingw objdump,
+-        # which wouldn't understand a cygwinified path. Ahh.
+-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+-      else
+-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+-      fi
+-      ;;
+-    pw32*)
+-      # pw32 DLLs use 'pw' prefix rather than 'lib'
+-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+-      ;;
+-    esac
+-    ;;
+-
+-  *)
+-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+-    ;;
+-  esac
+-  dynamic_linker='Win32 ld.exe'
+-  # FIXME: first we should search . and the directory the executable is in
+-  shlibpath_var=PATH
+-  ;;
+-
+-darwin* | rhapsody*)
+-  dynamic_linker="$host_os dyld"
+-  version_type=darwin
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+-  soname_spec='${libname}${release}${major}$shared_ext'
+-  shlibpath_overrides_runpath=yes
+-  shlibpath_var=DYLD_LIBRARY_PATH
+-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+-  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+-  if test "$GCC" = yes; then
+-    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+-  else
+-    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+-  fi
+-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+-  ;;
+-
+-dgux*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  ;;
+-
+-freebsd1*)
+-  dynamic_linker=no
+-  ;;
+-
+-kfreebsd*-gnu)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=no
+-  hardcode_into_libs=yes
+-  dynamic_linker='GNU ld.so'
+-  ;;
+-
+-freebsd* | dragonfly*)
+-  # DragonFly does not have aout.  When/if they implement a new
+-  # versioning mechanism, adjust this.
+-  if test -x /usr/bin/objformat; then
+-    objformat=`/usr/bin/objformat`
+-  else
+-    case $host_os in
+-    freebsd[[123]]*) objformat=aout ;;
+-    *) objformat=elf ;;
+-    esac
+-  fi
+-  version_type=freebsd-$objformat
+-  case $version_type in
+-    freebsd-elf*)
+-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+-      need_version=no
+-      need_lib_prefix=no
+-      ;;
+-    freebsd-*)
+-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+-      need_version=yes
+-      ;;
+-  esac
+-  shlibpath_var=LD_LIBRARY_PATH
+-  case $host_os in
+-  freebsd2*)
+-    shlibpath_overrides_runpath=yes
+-    ;;
+-  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+-    shlibpath_overrides_runpath=yes
+-    hardcode_into_libs=yes
+-    ;;
+-  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+-  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+-    shlibpath_overrides_runpath=no
+-    hardcode_into_libs=yes
+-    ;;
+-  freebsd*) # from 4.6 on
+-    shlibpath_overrides_runpath=yes
+-    hardcode_into_libs=yes
+-    ;;
+-  esac
+-  ;;
+-
+-gnu*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  hardcode_into_libs=yes
+-  ;;
+-
+-hpux9* | hpux10* | hpux11*)
+-  # Give a soname corresponding to the major version so that dld.sl refuses to
+-  # link against other versions.
+-  version_type=sunos
+-  need_lib_prefix=no
+-  need_version=no
+-  case $host_cpu in
+-  ia64*)
+-    shrext_cmds='.so'
+-    hardcode_into_libs=yes
+-    dynamic_linker="$host_os dld.so"
+-    shlibpath_var=LD_LIBRARY_PATH
+-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-    soname_spec='${libname}${release}${shared_ext}$major'
+-    if test "X$HPUX_IA64_MODE" = X32; then
+-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+-    else
+-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+-    fi
+-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+-    ;;
+-   hppa*64*)
+-     shrext_cmds='.sl'
+-     hardcode_into_libs=yes
+-     dynamic_linker="$host_os dld.sl"
+-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-     soname_spec='${libname}${release}${shared_ext}$major'
+-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+-     ;;
+-   *)
+-    shrext_cmds='.sl'
+-    dynamic_linker="$host_os dld.sl"
+-    shlibpath_var=SHLIB_PATH
+-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-    soname_spec='${libname}${release}${shared_ext}$major'
+-    ;;
+-  esac
+-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+-  postinstall_cmds='chmod 555 $lib'
+-  ;;
+-
+-interix3*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=no
+-  hardcode_into_libs=yes
+-  ;;
+-
+-irix5* | irix6* | nonstopux*)
+-  case $host_os in
+-    nonstopux*) version_type=nonstopux ;;
+-    *)
+-      if test "$lt_cv_prog_gnu_ld" = yes; then
+-              version_type=linux
+-      else
+-              version_type=irix
+-      fi ;;
+-  esac
+-  need_lib_prefix=no
+-  need_version=no
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+-  case $host_os in
+-  irix5* | nonstopux*)
+-    libsuff= shlibsuff=
+-    ;;
+-  *)
+-    case $LD in # libtool.m4 will add one of these switches to LD
+-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+-      libsuff= shlibsuff= libmagic=32-bit;;
+-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+-      libsuff=32 shlibsuff=N32 libmagic=N32;;
+-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+-    *) libsuff= shlibsuff= libmagic=never-match;;
+-    esac
+-    ;;
+-  esac
+-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+-  shlibpath_overrides_runpath=no
+-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+-  hardcode_into_libs=yes
+-  ;;
+-
+-# No shared lib support for Linux oldld, aout, or coff.
+-linux*oldld* | linux*aout* | linux*coff*)
+-  dynamic_linker=no
+-  ;;
+-
+-# This must be Linux ELF.
+-linux*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=no
+-  # This implies no fast_install, which is unacceptable.
+-  # Some rework will be needed to allow for fast_install
+-  # before this can be enabled.
+-  hardcode_into_libs=yes
+-
+-  # Append ld.so.conf contents to the search path
+-  if test -f /etc/ld.so.conf; then
+-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,  ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+-  fi
+-
+-  # We used to test for /lib/ld.so.1 and disable shared libraries on
+-  # powerpc, because MkLinux only supported shared libraries with the
+-  # GNU dynamic linker.  Since this was broken with cross compilers,
+-  # most powerpc-linux boxes support dynamic linking these days and
+-  # people can always --disable-shared, the test was removed, and we
+-  # assume the GNU/Linux dynamic linker is in use.
+-  dynamic_linker='GNU/Linux ld.so'
+-  ;;
+-
+-knetbsd*-gnu)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=no
+-  hardcode_into_libs=yes
+-  dynamic_linker='GNU ld.so'
+-  ;;
+-
+-netbsd*)
+-  version_type=sunos
+-  need_lib_prefix=no
+-  need_version=no
+-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+-    dynamic_linker='NetBSD (a.out) ld.so'
+-  else
+-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+-    soname_spec='${libname}${release}${shared_ext}$major'
+-    dynamic_linker='NetBSD ld.elf_so'
+-  fi
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=yes
+-  hardcode_into_libs=yes
+-  ;;
+-
+-newsos6)
+-  version_type=linux
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=yes
+-  ;;
+-
+-nto-qnx*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=yes
+-  ;;
+-
+-openbsd*)
+-  version_type=sunos
+-  sys_lib_dlsearch_path_spec="/usr/lib"
+-  need_lib_prefix=no
+-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+-  case $host_os in
+-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+-    *)                         need_version=no  ;;
+-  esac
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+-    case $host_os in
+-      openbsd2.[[89]] | openbsd2.[[89]].*)
+-      shlibpath_overrides_runpath=no
+-      ;;
+-      *)
+-      shlibpath_overrides_runpath=yes
+-      ;;
+-      esac
+-  else
+-    shlibpath_overrides_runpath=yes
+-  fi
+-  ;;
+-
+-os2*)
+-  libname_spec='$name'
+-  shrext_cmds=".dll"
+-  need_lib_prefix=no
+-  library_names_spec='$libname${shared_ext} $libname.a'
+-  dynamic_linker='OS/2 ld.exe'
+-  shlibpath_var=LIBPATH
+-  ;;
+-
+-osf3* | osf4* | osf5*)
+-  version_type=osf
+-  need_lib_prefix=no
+-  need_version=no
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+-  ;;
+-
+-solaris*)
+-  version_type=linux
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=yes
+-  hardcode_into_libs=yes
+-  # ldd complains unless libraries are executable
+-  postinstall_cmds='chmod +x $lib'
+-  ;;
+-
+-sunos4*)
+-  version_type=sunos
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  shlibpath_overrides_runpath=yes
+-  if test "$with_gnu_ld" = yes; then
+-    need_lib_prefix=no
+-  fi
+-  need_version=yes
+-  ;;
+-
+-sysv4 | sysv4.3*)
+-  version_type=linux
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  case $host_vendor in
+-    sni)
+-      shlibpath_overrides_runpath=no
+-      need_lib_prefix=no
+-      export_dynamic_flag_spec='${wl}-Blargedynsym'
+-      runpath_var=LD_RUN_PATH
+-      ;;
+-    siemens)
+-      need_lib_prefix=no
+-      ;;
+-    motorola)
+-      need_lib_prefix=no
+-      need_version=no
+-      shlibpath_overrides_runpath=no
+-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+-      ;;
+-  esac
+-  ;;
+-
+-sysv4*MP*)
+-  if test -d /usr/nec ;then
+-    version_type=linux
+-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+-    soname_spec='$libname${shared_ext}.$major'
+-    shlibpath_var=LD_LIBRARY_PATH
+-  fi
+-  ;;
+-
+-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+-  version_type=freebsd-elf
+-  need_lib_prefix=no
+-  need_version=no
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  hardcode_into_libs=yes
+-  if test "$with_gnu_ld" = yes; then
+-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+-    shlibpath_overrides_runpath=no
+-  else
+-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+-    shlibpath_overrides_runpath=yes
+-    case $host_os in
+-      sco3.2v5*)
+-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+-      ;;
+-    esac
+-  fi
+-  sys_lib_dlsearch_path_spec='/usr/lib'
+-  ;;
+-
+-uts4*)
+-  version_type=linux
+-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+-  soname_spec='${libname}${release}${shared_ext}$major'
+-  shlibpath_var=LD_LIBRARY_PATH
+-  ;;
+-
+-*)
+-  dynamic_linker=no
+-  ;;
+-esac
+-AC_MSG_RESULT([$dynamic_linker])
+-test "$dynamic_linker" = no && can_build_shared=no
+-
+-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+-if test "$GCC" = yes; then
+-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+-fi
+-])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+-
+-
+-# _LT_AC_TAGCONFIG
+-# ----------------
+-AC_DEFUN([_LT_AC_TAGCONFIG],
+-[AC_ARG_WITH([tags],
+-    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+-        [include additional configurations @<:@automatic@:>@])],
+-    [tagnames="$withval"])
+-
+-if test -f "$ltmain" && test -n "$tagnames"; then
+-  if test ! -f "${ofile}"; then
+-    AC_MSG_WARN([output file `$ofile' does not exist])
+-  fi
+-
+-  if test -z "$LTCC"; then
+-    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+-    if test -z "$LTCC"; then
+-      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+-    else
+-      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+-    fi
+-  fi
+-  if test -z "$LTCFLAGS"; then
+-    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+-  fi
+-
+-  # Extract list of available tagged configurations in $ofile.
+-  # Note that this assumes the entire list is on one line.
+-  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+-
+-  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+-  for tagname in $tagnames; do
+-    IFS="$lt_save_ifs"
+-    # Check whether tagname contains only valid characters
+-    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+-    "") ;;
+-    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+-      ;;
+-    esac
+-
+-    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+-    then
+-      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+-    fi
+-
+-    # Update the list of available tags.
+-    if test -n "$tagname"; then
+-      echo appending configuration tag \"$tagname\" to $ofile
+-
+-      case $tagname in
+-      CXX)
+-      if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+-          ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+-          (test "X$CXX" != "Xg++"))) ; then
+-        AC_LIBTOOL_LANG_CXX_CONFIG
+-      else
+-        tagname=""
+-      fi
+-      ;;
+-
+-      F77)
+-      if test -n "$F77" && test "X$F77" != "Xno"; then
+-        AC_LIBTOOL_LANG_F77_CONFIG
+-      else
+-        tagname=""
+-      fi
+-      ;;
+-
+-      GCJ)
+-      if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+-        AC_LIBTOOL_LANG_GCJ_CONFIG
+-      else
+-        tagname=""
+-      fi
+-      ;;
+-
+-      RC)
+-      AC_LIBTOOL_LANG_RC_CONFIG
+-      ;;
+-
+-      *)
+-      AC_MSG_ERROR([Unsupported tag name: $tagname])
+-      ;;
+-      esac
+-
+-      # Append the new tag name to the list of available tags.
+-      if test -n "$tagname" ; then
+-      available_tags="$available_tags $tagname"
+-    fi
+-    fi
+-  done
+-  IFS="$lt_save_ifs"
+-
+-  # Now substitute the updated list of available tags.
+-  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+-    mv "${ofile}T" "$ofile"
+-    chmod +x "$ofile"
+-  else
+-    rm -f "${ofile}T"
+-    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+-  fi
+-fi
+-])# _LT_AC_TAGCONFIG
+-
+-
+-# AC_LIBTOOL_DLOPEN
+-# -----------------
+-# enable checks for dlopen support
+-AC_DEFUN([AC_LIBTOOL_DLOPEN],
+- [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+-])# AC_LIBTOOL_DLOPEN
+-
+-
+-# AC_LIBTOOL_WIN32_DLL
+-# --------------------
+-# declare package support for building win32 DLLs
+-AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+-[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+-])# AC_LIBTOOL_WIN32_DLL
+-
+-
+-# AC_ENABLE_SHARED([DEFAULT])
+-# ---------------------------
+-# implement the --enable-shared flag
+-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+-AC_DEFUN([AC_ENABLE_SHARED],
+-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+-AC_ARG_ENABLE([shared],
+-    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+-      [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+-    [p=${PACKAGE-default}
+-    case $enableval in
+-    yes) enable_shared=yes ;;
+-    no) enable_shared=no ;;
+-    *)
+-      enable_shared=no
+-      # Look at the argument we got.  We use all the common list separators.
+-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+-      for pkg in $enableval; do
+-      IFS="$lt_save_ifs"
+-      if test "X$pkg" = "X$p"; then
+-        enable_shared=yes
+-      fi
+-      done
+-      IFS="$lt_save_ifs"
+-      ;;
+-    esac],
+-    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+-])# AC_ENABLE_SHARED
+-
+-
+-# AC_DISABLE_SHARED
+-# -----------------
+-# set the default shared flag to --disable-shared
+-AC_DEFUN([AC_DISABLE_SHARED],
+-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+-AC_ENABLE_SHARED(no)
+-])# AC_DISABLE_SHARED
+-
+-
+-# AC_ENABLE_STATIC([DEFAULT])
+-# ---------------------------
+-# implement the --enable-static flag
+-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+-AC_DEFUN([AC_ENABLE_STATIC],
+-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+-AC_ARG_ENABLE([static],
+-    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+-      [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+-    [p=${PACKAGE-default}
+-    case $enableval in
+-    yes) enable_static=yes ;;
+-    no) enable_static=no ;;
+-    *)
+-     enable_static=no
+-      # Look at the argument we got.  We use all the common list separators.
+-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+-      for pkg in $enableval; do
+-      IFS="$lt_save_ifs"
+-      if test "X$pkg" = "X$p"; then
+-        enable_static=yes
+-      fi
+-      done
+-      IFS="$lt_save_ifs"
+-      ;;
+-    esac],
+-    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+-])# AC_ENABLE_STATIC
+-
+-
+-# AC_DISABLE_STATIC
+-# -----------------
+-# set the default static flag to --disable-static
+-AC_DEFUN([AC_DISABLE_STATIC],
+-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+-AC_ENABLE_STATIC(no)
+-])# AC_DISABLE_STATIC
+-
+-
+-# AC_ENABLE_FAST_INSTALL([DEFAULT])
+-# ---------------------------------
+-# implement the --enable-fast-install flag
+-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+-AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+-AC_ARG_ENABLE([fast-install],
+-    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+-    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+-    [p=${PACKAGE-default}
+-    case $enableval in
+-    yes) enable_fast_install=yes ;;
+-    no) enable_fast_install=no ;;
+-    *)
+-      enable_fast_install=no
+-      # Look at the argument we got.  We use all the common list separators.
+-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+-      for pkg in $enableval; do
+-      IFS="$lt_save_ifs"
+-      if test "X$pkg" = "X$p"; then
+-        enable_fast_install=yes
+-      fi
+-      done
+-      IFS="$lt_save_ifs"
+-      ;;
+-    esac],
+-    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+-])# AC_ENABLE_FAST_INSTALL
+-
+-
+-# AC_DISABLE_FAST_INSTALL
+-# -----------------------
+-# set the default to --disable-fast-install
+-AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+-AC_ENABLE_FAST_INSTALL(no)
+-])# AC_DISABLE_FAST_INSTALL
+-
+-
+-# AC_LIBTOOL_PICMODE([MODE])
+-# --------------------------
+-# implement the --with-pic flag
+-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+-AC_DEFUN([AC_LIBTOOL_PICMODE],
+-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+-pic_mode=ifelse($#,1,$1,default)
+-])# AC_LIBTOOL_PICMODE
+-
+-
+-# AC_PROG_EGREP
+-# -------------
+-# This is predefined starting with Autoconf 2.54, so this conditional
+-# definition can be removed once we require Autoconf 2.54 or later.
+-m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+-[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+-   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+-    then ac_cv_prog_egrep='grep -E'
+-    else ac_cv_prog_egrep='egrep'
+-    fi])
+- EGREP=$ac_cv_prog_egrep
+- AC_SUBST([EGREP])
+-])])
+-
+-
+-# AC_PATH_TOOL_PREFIX
+-# -------------------
+-# find a file program which can recognise shared library
+-AC_DEFUN([AC_PATH_TOOL_PREFIX],
+-[AC_REQUIRE([AC_PROG_EGREP])dnl
+-AC_MSG_CHECKING([for $1])
+-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+-[case $MAGIC_CMD in
+-[[\\/*] |  ?:[\\/]*])
+-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+-  ;;
+-*)
+-  lt_save_MAGIC_CMD="$MAGIC_CMD"
+-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+-dnl $ac_dummy forces splitting on constant user-supplied paths.
+-dnl POSIX.2 word splitting is done only on the output of word expansions,
+-dnl not every word.  This closes a longstanding sh security hole.
+-  ac_dummy="ifelse([$2], , $PATH, [$2])"
+-  for ac_dir in $ac_dummy; do
+-    IFS="$lt_save_ifs"
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$1; then
+-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+-      if test -n "$file_magic_test_file"; then
+-      case $deplibs_check_method in
+-      "file_magic "*)
+-        file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+-        MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+-        if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+-          $EGREP "$file_magic_regex" > /dev/null; then
+-          :
+-        else
+-          cat <<EOF 1>&2
+-
+-*** Warning: the command libtool uses to detect shared libraries,
+-*** $file_magic_cmd, produces output that libtool cannot recognize.
+-*** The result is that libtool may fail to recognize shared libraries
+-*** as such.  This will affect the creation of libtool libraries that
+-*** depend on shared libraries, but programs linked with such libtool
+-*** libraries will work regardless of this problem.  Nevertheless, you
+-*** may want to report the problem to your system manager and/or to
+-*** bug-libtool@gnu.org
+-
+-EOF
+-        fi ;;
+-      esac
+-      fi
+-      break
+-    fi
+-  done
+-  IFS="$lt_save_ifs"
+-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+-  ;;
+-esac])
+-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+-if test -n "$MAGIC_CMD"; then
+-  AC_MSG_RESULT($MAGIC_CMD)
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-])# AC_PATH_TOOL_PREFIX
+-
+-
+-# AC_PATH_MAGIC
+-# -------------
+-# find a file program which can recognise a shared library
+-AC_DEFUN([AC_PATH_MAGIC],
+-[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+-if test -z "$lt_cv_path_MAGIC_CMD"; then
+-  if test -n "$ac_tool_prefix"; then
+-    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+-  else
+-    MAGIC_CMD=:
+-  fi
+-fi
+-])# AC_PATH_MAGIC
+-
+-
+-# AC_PROG_LD
+-# ----------
+-# find the pathname to the GNU or non-GNU linker
+-AC_DEFUN([AC_PROG_LD],
+-[AC_ARG_WITH([gnu-ld],
+-    [AC_HELP_STRING([--with-gnu-ld],
+-      [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+-    [test "$withval" = no || with_gnu_ld=yes],
+-    [with_gnu_ld=no])
+-AC_REQUIRE([LT_AC_PROG_SED])dnl
+-AC_REQUIRE([AC_PROG_CC])dnl
+-AC_REQUIRE([AC_CANONICAL_HOST])dnl
+-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+-ac_prog=ld
+-if test "$GCC" = yes; then
+-  # Check if gcc -print-prog-name=ld gives a path.
+-  AC_MSG_CHECKING([for ld used by $CC])
+-  case $host in
+-  *-*-mingw*)
+-    # gcc leaves a trailing carriage return which upsets mingw
+-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+-  *)
+-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+-  esac
+-  case $ac_prog in
+-    # Accept absolute paths.
+-    [[\\/]]* | ?:[[\\/]]*)
+-      re_direlt='/[[^/]][[^/]]*/\.\./'
+-      # Canonicalize the pathname of ld
+-      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+-      ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+-      done
+-      test -z "$LD" && LD="$ac_prog"
+-      ;;
+-  "")
+-    # If it fails, then pretend we aren't using GCC.
+-    ac_prog=ld
+-    ;;
+-  *)
+-    # If it is relative, then search for the first ld in PATH.
+-    with_gnu_ld=unknown
+-    ;;
+-  esac
+-elif test "$with_gnu_ld" = yes; then
+-  AC_MSG_CHECKING([for GNU ld])
+-else
+-  AC_MSG_CHECKING([for non-GNU ld])
+-fi
+-AC_CACHE_VAL(lt_cv_path_LD,
+-[if test -z "$LD"; then
+-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+-  for ac_dir in $PATH; do
+-    IFS="$lt_save_ifs"
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+-      lt_cv_path_LD="$ac_dir/$ac_prog"
+-      # Check to see if the program is GNU ld.  I'd rather use --version,
+-      # but apparently some variants of GNU ld only accept -v.
+-      # Break only if it was the GNU/non-GNU ld that we prefer.
+-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+-      *GNU* | *'with BFD'*)
+-      test "$with_gnu_ld" != no && break
+-      ;;
+-      *)
+-      test "$with_gnu_ld" != yes && break
+-      ;;
+-      esac
+-    fi
+-  done
+-  IFS="$lt_save_ifs"
+-else
+-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+-fi])
+-LD="$lt_cv_path_LD"
+-if test -n "$LD"; then
+-  AC_MSG_RESULT($LD)
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+-AC_PROG_LD_GNU
+-])# AC_PROG_LD
+-
+-
+-# AC_PROG_LD_GNU
+-# --------------
+-AC_DEFUN([AC_PROG_LD_GNU],
+-[AC_REQUIRE([AC_PROG_EGREP])dnl
+-AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+-case `$LD -v 2>&1 </dev/null` in
+-*GNU* | *'with BFD'*)
+-  lt_cv_prog_gnu_ld=yes
+-  ;;
+-*)
+-  lt_cv_prog_gnu_ld=no
+-  ;;
+-esac])
+-with_gnu_ld=$lt_cv_prog_gnu_ld
+-])# AC_PROG_LD_GNU
+-
+-
+-# AC_PROG_LD_RELOAD_FLAG
+-# ----------------------
+-# find reload flag for linker
+-#   -- PORTME Some linkers may need a different reload flag.
+-AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+-[AC_CACHE_CHECK([for $LD option to reload object files],
+-  lt_cv_ld_reload_flag,
+-  [lt_cv_ld_reload_flag='-r'])
+-reload_flag=$lt_cv_ld_reload_flag
+-case $reload_flag in
+-"" | " "*) ;;
+-*) reload_flag=" $reload_flag" ;;
+-esac
+-reload_cmds='$LD$reload_flag -o $output$reload_objs'
+-case $host_os in
+-  darwin*)
+-    if test "$GCC" = yes; then
+-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+-    else
+-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+-    fi
+-    ;;
+-esac
+-])# AC_PROG_LD_RELOAD_FLAG
+-
+-
+-# AC_DEPLIBS_CHECK_METHOD
+-# -----------------------
+-# how to check for library dependencies
+-#  -- PORTME fill in with the dynamic library characteristics
+-AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+-[AC_CACHE_CHECK([how to recognise dependent libraries],
+-lt_cv_deplibs_check_method,
+-[lt_cv_file_magic_cmd='$MAGIC_CMD'
+-lt_cv_file_magic_test_file=
+-lt_cv_deplibs_check_method='unknown'
+-# Need to set the preceding variable on all platforms that support
+-# interlibrary dependencies.
+-# 'none' -- dependencies not supported.
+-# `unknown' -- same as none, but documents that we really don't know.
+-# 'pass_all' -- all dependencies passed with no checks.
+-# 'test_compile' -- check by making test program.
+-# 'file_magic [[regex]]' -- check by looking for files in library path
+-# which responds to the $file_magic_cmd with a given extended regex.
+-# If you have `file' or equivalent on your system and you're not sure
+-# whether `pass_all' will *always* work, you probably want this one.
+-
+-case $host_os in
+-aix4* | aix5*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-beos*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-bsdi[[45]]*)
+-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+-  lt_cv_file_magic_cmd='/usr/bin/file -L'
+-  lt_cv_file_magic_test_file=/shlib/libc.so
+-  ;;
+-
+-cygwin*)
+-  # func_win32_libid is a shell function defined in ltmain.sh
+-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+-  lt_cv_file_magic_cmd='func_win32_libid'
+-  ;;
+-
+-mingw* | pw32*)
+-  # Base MSYS/MinGW do not provide the 'file' command needed by
+-  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+-  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+-  lt_cv_file_magic_cmd='$OBJDUMP -f'
+-  ;;
+-
+-darwin* | rhapsody*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-freebsd* | kfreebsd*-gnu | dragonfly*)
+-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+-    case $host_cpu in
+-    i*86 )
+-      # Not sure whether the presence of OpenBSD here was a mistake.
+-      # Let's accept both of them until this is cleared up.
+-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+-      lt_cv_file_magic_cmd=/usr/bin/file
+-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+-      ;;
+-    esac
+-  else
+-    lt_cv_deplibs_check_method=pass_all
+-  fi
+-  ;;
+-
+-gnu*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-hpux10.20* | hpux11*)
+-  lt_cv_file_magic_cmd=/usr/bin/file
+-  case $host_cpu in
+-  ia64*)
+-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+-    ;;
+-  hppa*64*)
+-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+-    ;;
+-  *)
+-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+-    ;;
+-  esac
+-  ;;
+-
+-interix3*)
+-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+-  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+-  ;;
+-
+-irix5* | irix6* | nonstopux*)
+-  case $LD in
+-  *-32|*"-32 ") libmagic=32-bit;;
+-  *-n32|*"-n32 ") libmagic=N32;;
+-  *-64|*"-64 ") libmagic=64-bit;;
+-  *) libmagic=never-match;;
+-  esac
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-# This must be Linux ELF.
+-linux*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-netbsd*)
+-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+-  else
+-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+-  fi
+-  ;;
+-
+-newos6*)
+-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+-  lt_cv_file_magic_cmd=/usr/bin/file
+-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+-  ;;
+-
+-nto-qnx*)
+-  lt_cv_deplibs_check_method=unknown
+-  ;;
+-
+-openbsd*)
+-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+-  else
+-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+-  fi
+-  ;;
+-
+-osf3* | osf4* | osf5*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-solaris*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-
+-sysv4 | sysv4.3*)
+-  case $host_vendor in
+-  motorola)
+-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+-    ;;
+-  ncr)
+-    lt_cv_deplibs_check_method=pass_all
+-    ;;
+-  sequent)
+-    lt_cv_file_magic_cmd='/bin/file'
+-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+-    ;;
+-  sni)
+-    lt_cv_file_magic_cmd='/bin/file'
+-    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+-    lt_cv_file_magic_test_file=/lib/libc.so
+-    ;;
+-  siemens)
+-    lt_cv_deplibs_check_method=pass_all
+-    ;;
+-  pc)
+-    lt_cv_deplibs_check_method=pass_all
+-    ;;
+-  esac
+-  ;;
+-
+-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+-  lt_cv_deplibs_check_method=pass_all
+-  ;;
+-esac
+-])
+-file_magic_cmd=$lt_cv_file_magic_cmd
+-deplibs_check_method=$lt_cv_deplibs_check_method
+-test -z "$deplibs_check_method" && deplibs_check_method=unknown
+-])# AC_DEPLIBS_CHECK_METHOD
+-
+-
+-# AC_PROG_NM
+-# ----------
+-# find the pathname to a BSD-compatible name lister
+-AC_DEFUN([AC_PROG_NM],
+-[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+-[if test -n "$NM"; then
+-  # Let the user override the test.
+-  lt_cv_path_NM="$NM"
+-else
+-  lt_nm_to_check="${ac_tool_prefix}nm"
+-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 
+-    lt_nm_to_check="$lt_nm_to_check nm"
+-  fi
+-  for lt_tmp_nm in $lt_nm_to_check; do
+-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+-      IFS="$lt_save_ifs"
+-      test -z "$ac_dir" && ac_dir=.
+-      tmp_nm="$ac_dir/$lt_tmp_nm"
+-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+-      # Check to see if the nm accepts a BSD-compat flag.
+-      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+-      #   nm: unknown option "B" ignored
+-      # Tru64's nm complains that /dev/null is an invalid object file
+-      case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+-      */dev/null* | *'Invalid file or object type'*)
+-        lt_cv_path_NM="$tmp_nm -B"
+-        break
+-        ;;
+-      *)
+-        case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+-        */dev/null*)
+-          lt_cv_path_NM="$tmp_nm -p"
+-          break
+-          ;;
+-        *)
+-          lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+-          continue # so that we can try to find one that supports BSD flags
+-          ;;
+-        esac
+-        ;;
+-      esac
+-      fi
+-    done
+-    IFS="$lt_save_ifs"
+-  done
+-  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+-fi])
+-NM="$lt_cv_path_NM"
+-])# AC_PROG_NM
+-
+-
+-# AC_CHECK_LIBM
+-# -------------
+-# check for math library
+-AC_DEFUN([AC_CHECK_LIBM],
+-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+-LIBM=
+-case $host in
+-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+-  # These system don't have libm, or don't need it
+-  ;;
+-*-ncr-sysv4.3*)
+-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+-  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+-  ;;
+-*)
+-  AC_CHECK_LIB(m, cos, LIBM="-lm")
+-  ;;
+-esac
+-])# AC_CHECK_LIBM
+-
+-
+-# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+-# -----------------------------------
+-# sets LIBLTDL to the link flags for the libltdl convenience library and
+-# LTDLINCL to the include flags for the libltdl header and adds
+-# --enable-ltdl-convenience to the configure arguments.  Note that
+-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+-# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+-# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+-# (note the single quotes!).  If your package is not flat and you're not
+-# using automake, define top_builddir and top_srcdir appropriately in
+-# the Makefiles.
+-AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+-  case $enable_ltdl_convenience in
+-  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+-  "") enable_ltdl_convenience=yes
+-      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+-  esac
+-  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+-  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+-  # For backwards non-gettext consistent compatibility...
+-  INCLTDL="$LTDLINCL"
+-])# AC_LIBLTDL_CONVENIENCE
+-
+-
+-# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+-# -----------------------------------
+-# sets LIBLTDL to the link flags for the libltdl installable library and
+-# LTDLINCL to the include flags for the libltdl header and adds
+-# --enable-ltdl-install to the configure arguments.  Note that
+-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+-# and an installed libltdl is not found, it is assumed to be `libltdl'.
+-# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+-# '${top_srcdir}/' (note the single quotes!).  If your package is not
+-# flat and you're not using automake, define top_builddir and top_srcdir
+-# appropriately in the Makefiles.
+-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+-AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+-  AC_CHECK_LIB(ltdl, lt_dlinit,
+-  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+-  [if test x"$enable_ltdl_install" = xno; then
+-     AC_MSG_WARN([libltdl not installed, but installation disabled])
+-   else
+-     enable_ltdl_install=yes
+-   fi
+-  ])
+-  if test x"$enable_ltdl_install" = x"yes"; then
+-    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+-    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+-    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+-  else
+-    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+-    LIBLTDL="-lltdl"
+-    LTDLINCL=
+-  fi
+-  # For backwards non-gettext consistent compatibility...
+-  INCLTDL="$LTDLINCL"
+-])# AC_LIBLTDL_INSTALLABLE
+-
+-
+-# AC_LIBTOOL_CXX
+-# --------------
+-# enable support for C++ libraries
+-AC_DEFUN([AC_LIBTOOL_CXX],
+-[AC_REQUIRE([_LT_AC_LANG_CXX])
+-])# AC_LIBTOOL_CXX
+-
+-
+-# _LT_AC_LANG_CXX
+-# ---------------
+-AC_DEFUN([_LT_AC_LANG_CXX],
+-[AC_REQUIRE([AC_PROG_CXX])
+-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+-])# _LT_AC_LANG_CXX
+-
+-# _LT_AC_PROG_CXXCPP
+-# ------------------
+-AC_DEFUN([_LT_AC_PROG_CXXCPP],
+-[
+-AC_REQUIRE([AC_PROG_CXX])
+-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+-    (test "X$CXX" != "Xg++"))) ; then
+-  AC_PROG_CXXCPP
+-fi
+-])# _LT_AC_PROG_CXXCPP
+-
+-# AC_LIBTOOL_F77
+-# --------------
+-# enable support for Fortran 77 libraries
+-AC_DEFUN([AC_LIBTOOL_F77],
+-[AC_REQUIRE([_LT_AC_LANG_F77])
+-])# AC_LIBTOOL_F77
+-
+-
+-# _LT_AC_LANG_F77
+-# ---------------
+-AC_DEFUN([_LT_AC_LANG_F77],
+-[AC_REQUIRE([AC_PROG_F77])
+-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+-])# _LT_AC_LANG_F77
+-
+-
+-# AC_LIBTOOL_GCJ
+-# --------------
+-# enable support for GCJ libraries
+-AC_DEFUN([AC_LIBTOOL_GCJ],
+-[AC_REQUIRE([_LT_AC_LANG_GCJ])
+-])# AC_LIBTOOL_GCJ
+-
+-
+-# _LT_AC_LANG_GCJ
+-# ---------------
+-AC_DEFUN([_LT_AC_LANG_GCJ],
+-[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+-    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+-      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+-       [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+-         [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+-])# _LT_AC_LANG_GCJ
+-
+-
+-# AC_LIBTOOL_RC
+-# -------------
+-# enable support for Windows resource files
+-AC_DEFUN([AC_LIBTOOL_RC],
+-[AC_REQUIRE([LT_AC_PROG_RC])
+-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+-])# AC_LIBTOOL_RC
+-
+-
+-# AC_LIBTOOL_LANG_C_CONFIG
+-# ------------------------
+-# Ensure that the configuration vars for the C compiler are
+-# suitably defined.  Those variables are subsequently used by
+-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+-AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+-AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+-[lt_save_CC="$CC"
+-AC_LANG_PUSH(C)
+-
+-# Source file extension for C test sources.
+-ac_ext=c
+-
+-# Object file extension for compiled C test sources.
+-objext=o
+-_LT_AC_TAGVAR(objext, $1)=$objext
+-
+-# Code to be used in simple compile tests
+-lt_simple_compile_test_code="int some_variable = 0;\n"
+-
+-# Code to be used in simple link tests
+-lt_simple_link_test_code='int main(){return(0);}\n'
+-
+-_LT_AC_SYS_COMPILER
+-
+-# save warnings/boilerplate of simple test code
+-_LT_COMPILER_BOILERPLATE
+-_LT_LINKER_BOILERPLATE
+-
+-## CAVEAT EMPTOR:
+-## There is no encapsulation within the following macros, do not change
+-## the running order or otherwise move them around unless you know exactly
+-## what you are doing...
+-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+-AC_LIBTOOL_PROG_COMPILER_PIC($1)
+-AC_LIBTOOL_PROG_CC_C_O($1)
+-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+-AC_LIBTOOL_PROG_LD_SHLIBS($1)
+-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+-AC_LIBTOOL_SYS_LIB_STRIP
+-AC_LIBTOOL_DLOPEN_SELF
+-
+-# Report which library types will actually be built
+-AC_MSG_CHECKING([if libtool supports shared libraries])
+-AC_MSG_RESULT([$can_build_shared])
+-
+-AC_MSG_CHECKING([whether to build shared libraries])
+-test "$can_build_shared" = "no" && enable_shared=no
+-
+-# On AIX, shared libraries and static libraries use the same namespace, and
+-# are all built from PIC.
+-case $host_os in
+-aix3*)
+-  test "$enable_shared" = yes && enable_static=no
+-  if test -n "$RANLIB"; then
+-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+-    postinstall_cmds='$RANLIB $lib'
+-  fi
+-  ;;
+-
+-aix4* | aix5*)
+-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+-    test "$enable_shared" = yes && enable_static=no
+-  fi
+-    ;;
+-esac
+-AC_MSG_RESULT([$enable_shared])
+-
+-AC_MSG_CHECKING([whether to build static libraries])
+-# Make sure either enable_shared or enable_static is yes.
+-test "$enable_shared" = yes || enable_static=yes
+-AC_MSG_RESULT([$enable_static])
+-
+-AC_LIBTOOL_CONFIG($1)
+-
+-AC_LANG_POP
+-CC="$lt_save_CC"
+-])# AC_LIBTOOL_LANG_C_CONFIG
+-
+-
+-# AC_LIBTOOL_LANG_CXX_CONFIG
+-# --------------------------
+-# Ensure that the configuration vars for the C compiler are
+-# suitably defined.  Those variables are subsequently used by
+-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+-AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+-AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+-[AC_LANG_PUSH(C++)
+-AC_REQUIRE([AC_PROG_CXX])
+-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+-
+-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+-_LT_AC_TAGVAR(always_export_symbols, $1)=no
+-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+-_LT_AC_TAGVAR(hardcode_direct, $1)=no
+-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+-_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+-_LT_AC_TAGVAR(module_cmds, $1)=
+-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+-_LT_AC_TAGVAR(no_undefined_flag, $1)=
+-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+-
+-# Dependencies to place before and after the object being linked:
+-_LT_AC_TAGVAR(predep_objects, $1)=
+-_LT_AC_TAGVAR(postdep_objects, $1)=
+-_LT_AC_TAGVAR(predeps, $1)=
+-_LT_AC_TAGVAR(postdeps, $1)=
+-_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+-
+-# Source file extension for C++ test sources.
+-ac_ext=cpp
+-
+-# Object file extension for compiled C++ test sources.
+-objext=o
+-_LT_AC_TAGVAR(objext, $1)=$objext
+-
+-# Code to be used in simple compile tests
+-lt_simple_compile_test_code="int some_variable = 0;\n"
+-
+-# Code to be used in simple link tests
+-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+-
+-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+-_LT_AC_SYS_COMPILER
+-
+-# save warnings/boilerplate of simple test code
+-_LT_COMPILER_BOILERPLATE
+-_LT_LINKER_BOILERPLATE
+-
+-# Allow CC to be a program name with arguments.
+-lt_save_CC=$CC
+-lt_save_LD=$LD
+-lt_save_GCC=$GCC
+-GCC=$GXX
+-lt_save_with_gnu_ld=$with_gnu_ld
+-lt_save_path_LD=$lt_cv_path_LD
+-if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+-  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+-else
+-  $as_unset lt_cv_prog_gnu_ld
+-fi
+-if test -n "${lt_cv_path_LDCXX+set}"; then
+-  lt_cv_path_LD=$lt_cv_path_LDCXX
+-else
+-  $as_unset lt_cv_path_LD
+-fi
+-test -z "${LDCXX+set}" || LD=$LDCXX
+-CC=${CXX-"c++"}
+-compiler=$CC
+-_LT_AC_TAGVAR(compiler, $1)=$CC
+-_LT_CC_BASENAME([$compiler])
+-
+-# We don't want -fno-exception wen compiling C++ code, so set the
+-# no_builtin_flag separately
+-if test "$GXX" = yes; then
+-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+-else
+-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+-fi
+-
+-if test "$GXX" = yes; then
+-  # Set up default GNU C++ configuration
+-
+-  AC_PROG_LD
+-
+-  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+-  # archiving commands below assume that GNU ld is being used.
+-  if test "$with_gnu_ld" = yes; then
+-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+-
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+-
+-    # If archive_cmds runs LD, not CC, wlarc should be empty
+-    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+-    #     investigate it a little bit more. (MM)
+-    wlarc='${wl}'
+-
+-    # ancient GNU ld didn't support --whole-archive et. al.
+-    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+-      grep 'no-whole-archive' > /dev/null; then
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+-    else
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+-    fi
+-  else
+-    with_gnu_ld=no
+-    wlarc=
+-
+-    # A generic and very simple default shared library creation
+-    # command for GNU C++ for the case where it uses the native
+-    # linker, instead of GNU ld.  If possible, this setting should
+-    # overridden to take advantage of the native linker features on
+-    # the platform it is being used on.
+-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+-  fi
+-
+-  # Commands to make compiler produce verbose output that lists
+-  # what "hidden" libraries, object files and flags are used when
+-  # linking a shared library.
+-  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+-
+-else
+-  GXX=no
+-  with_gnu_ld=no
+-  wlarc=
+-fi
+-
+-# PORTME: fill in a description of your system's C++ link characteristics
+-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+-_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+-case $host_os in
+-  aix3*)
+-    # FIXME: insert proper C++ library support
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  aix4* | aix5*)
+-    if test "$host_cpu" = ia64; then
+-      # On IA64, the linker does run time linking by default, so we don't
+-      # have to do anything special.
+-      aix_use_runtimelinking=no
+-      exp_sym_flag='-Bexport'
+-      no_entry_flag=""
+-    else
+-      aix_use_runtimelinking=no
+-
+-      # Test if we are trying to use run time linking or normal
+-      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+-      # need to do runtime linking.
+-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+-      for ld_flag in $LDFLAGS; do
+-        case $ld_flag in
+-        *-brtl*)
+-          aix_use_runtimelinking=yes
+-          break
+-          ;;
+-        esac
+-      done
+-      ;;
+-      esac
+-
+-      exp_sym_flag='-bexport'
+-      no_entry_flag='-bnoentry'
+-    fi
+-
+-    # When large executables or shared objects are built, AIX ld can
+-    # have problems creating the table of contents.  If linking a library
+-    # or program results in "error TOC overflow" add -mminimal-toc to
+-    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+-    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+-
+-    _LT_AC_TAGVAR(archive_cmds, $1)=''
+-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+-    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-
+-    if test "$GXX" = yes; then
+-      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+-      # We only want to do this on AIX 4.2 and lower, the check
+-      # below for broken collect2 doesn't work under 4.3+
+-      collect2name=`${CC} -print-prog-name=collect2`
+-      if test -f "$collect2name" && \
+-         strings "$collect2name" | grep resolve_lib_name >/dev/null
+-      then
+-        # We have reworked collect2
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      else
+-        # We have old collect2
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+-        # It fails to find uninstalled libraries when the uninstalled
+-        # path is not listed in the libpath.  Setting hardcode_minus_L
+-        # to unsupported forces relinking
+-        _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+-      fi
+-      ;;
+-      esac
+-      shared_flag='-shared'
+-      if test "$aix_use_runtimelinking" = yes; then
+-      shared_flag="$shared_flag "'${wl}-G'
+-      fi
+-    else
+-      # not using gcc
+-      if test "$host_cpu" = ia64; then
+-      # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+-      # chokes on -Wl,-G. The following line is correct:
+-      shared_flag='-G'
+-      else
+-      if test "$aix_use_runtimelinking" = yes; then
+-        shared_flag='${wl}-G'
+-      else
+-        shared_flag='${wl}-bM:SRE'
+-      fi
+-      fi
+-    fi
+-
+-    # It seems that -bexpall does not export symbols beginning with
+-    # underscore (_), so it is better to generate a list of symbols to export.
+-    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+-    if test "$aix_use_runtimelinking" = yes; then
+-      # Warning - without using the other runtime loading flags (-brtl),
+-      # -berok will link without error, but may produce a broken library.
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+-      # Determine the default libpath from the value encoded in an empty executable.
+-      _LT_AC_SYS_LIBPATH_AIX
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+-
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+-     else
+-      if test "$host_cpu" = ia64; then
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+-      else
+-      # Determine the default libpath from the value encoded in an empty executable.
+-      _LT_AC_SYS_LIBPATH_AIX
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+-      # Warning - without using the other run time loading flags,
+-      # -berok will link without error, but may produce a broken library.
+-      _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+-      # Exported symbols can be pulled into shared objects from archives
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+-      # This is similar to how AIX traditionally builds its shared libraries.
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+-      fi
+-    fi
+-    ;;
+-
+-  beos*)
+-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+-      # support --undefined.  This deserves some investigation.  FIXME
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-    else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    fi
+-    ;;
+-
+-  chorus*)
+-    case $cc_basename in
+-      *)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    esac
+-    ;;
+-
+-  cygwin* | mingw* | pw32*)
+-    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+-    # as there is no search path for DLLs.
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+-
+-    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+-      # If the export-symbols file already is a .def file (1st line
+-      # is EXPORTS), use it as is; otherwise, prepend...
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+-      cp $export_symbols $output_objdir/$soname.def;
+-      else
+-      echo EXPORTS > $output_objdir/$soname.def;
+-      cat $export_symbols >> $output_objdir/$soname.def;
+-      fi~
+-      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+-    else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    fi
+-  ;;
+-      darwin* | rhapsody*)
+-        case $host_os in
+-        rhapsody* | darwin1.[[012]])
+-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+-         ;;
+-       *) # Darwin 1.3 on
+-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+-         else
+-           case ${MACOSX_DEPLOYMENT_TARGET} in
+-             10.[[012]])
+-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+-               ;;
+-             10.*)
+-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+-               ;;
+-           esac
+-         fi
+-         ;;
+-        esac
+-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-
+-    if test "$GXX" = yes ; then
+-      lt_int_apple_cc_single_mod=no
+-      output_verbose_link_cmd='echo'
+-      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+-       lt_int_apple_cc_single_mod=yes
+-      fi
+-      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+-       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+-      else
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+-        fi
+-        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+-        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+-          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-          else
+-            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-          fi
+-            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-      else
+-      case $cc_basename in
+-        xlc*)
+-         output_verbose_link_cmd='echo'
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+-          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-          ;;
+-       *)
+-         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-          ;;
+-      esac
+-      fi
+-        ;;
+-
+-  dgux*)
+-    case $cc_basename in
+-      ec++*)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      ghcx*)
+-      # Green Hills C++ Compiler
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      *)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    esac
+-    ;;
+-  freebsd[[12]]*)
+-    # C++ shared libraries reported to be fairly broken before switch to ELF
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  freebsd-elf*)
+-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-    ;;
+-  freebsd* | kfreebsd*-gnu | dragonfly*)
+-    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+-    # conventions
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+-    ;;
+-  gnu*)
+-    ;;
+-  hpux9*)
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+-                              # but as the default
+-                              # location of the library.
+-
+-    case $cc_basename in
+-    CC*)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    aCC*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+-      # Commands to make compiler produce verbose output that lists
+-      # what "hidden" libraries, object files and flags are used when
+-      # linking a shared library.
+-      #
+-      # There doesn't appear to be a way to prevent this compiler from
+-      # explicitly linking system object files so we need to strip them
+-      # from the output so that they don't get included in the library
+-      # dependencies.
+-      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+-      ;;
+-    *)
+-      if test "$GXX" = yes; then
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+-      else
+-        # FIXME: insert proper C++ library support
+-        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-    esac
+-    ;;
+-  hpux10*|hpux11*)
+-    if test $with_gnu_ld = no; then
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      case $host_cpu in
+-      hppa*64*|ia64*)
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+-        ;;
+-      *)
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-        ;;
+-      esac
+-    fi
+-    case $host_cpu in
+-    hppa*64*|ia64*)
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-    *)
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+-                                            # but as the default
+-                                            # location of the library.
+-      ;;
+-    esac
+-
+-    case $cc_basename in
+-      CC*)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      aCC*)
+-      case $host_cpu in
+-      hppa*64*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-        ;;
+-      ia64*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-        ;;
+-      *)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-        ;;
+-      esac
+-      # Commands to make compiler produce verbose output that lists
+-      # what "hidden" libraries, object files and flags are used when
+-      # linking a shared library.
+-      #
+-      # There doesn't appear to be a way to prevent this compiler from
+-      # explicitly linking system object files so we need to strip them
+-      # from the output so that they don't get included in the library
+-      # dependencies.
+-      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+-      ;;
+-      *)
+-      if test "$GXX" = yes; then
+-        if test $with_gnu_ld = no; then
+-          case $host_cpu in
+-          hppa*64*)
+-            _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-            ;;
+-          ia64*)
+-            _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-            ;;
+-          *)
+-            _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-            ;;
+-          esac
+-        fi
+-      else
+-        # FIXME: insert proper C++ library support
+-        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-    esac
+-    ;;
+-  interix3*)
+-    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+-    # Instead, shared libraries are loaded at an image base (0x10000000 by
+-    # default) and relocated if they conflict, which is a slow very memory
+-    # consuming and fragmenting process.  To avoid this, we pick a random,
+-    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+-    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+-    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+-    ;;
+-  irix5* | irix6*)
+-    case $cc_basename in
+-      CC*)
+-      # SGI C++
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+-
+-      # Archives containing C++ object files must be created using
+-      # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+-      # necessary to make sure instantiated templates are included
+-      # in the archive.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+-      ;;
+-      *)
+-      if test "$GXX" = yes; then
+-        if test "$with_gnu_ld" = no; then
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+-        else
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+-        fi
+-      fi
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-      ;;
+-    esac
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-    ;;
+-  linux*)
+-    case $cc_basename in
+-      KCC*)
+-      # Kuck and Associates, Inc. (KAI) C++ Compiler
+-
+-      # KCC will only create a shared library if the output file
+-      # ends with ".so" (or ".sl" for HP-UX), so rename the library
+-      # to its proper name (with version) after linking.
+-      _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+-      # Commands to make compiler produce verbose output that lists
+-      # what "hidden" libraries, object files and flags are used when
+-      # linking a shared library.
+-      #
+-      # There doesn't appear to be a way to prevent this compiler from
+-      # explicitly linking system object files so we need to strip them
+-      # from the output so that they don't get included in the library
+-      # dependencies.
+-      output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+-
+-      # Archives containing C++ object files must be created using
+-      # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+-      ;;
+-      icpc*)
+-      # Intel C++
+-      with_gnu_ld=yes
+-      # version 8.0 and above of icpc choke on multiply defined symbols
+-      # if we add $predep_objects and $postdep_objects, however 7.1 and
+-      # earlier do not add the objects themselves.
+-      case `$CC -V 2>&1` in
+-      *"Version 7."*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+-        ;;
+-      *)  # Version 8.0 or newer
+-        tmp_idyn=
+-        case $host_cpu in
+-          ia64*) tmp_idyn=' -i_dynamic';;
+-        esac
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+-        ;;
+-      esac
+-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+-      ;;
+-      pgCC*)
+-        # Portland Group C++ compiler
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+-        ;;
+-      cxx*)
+-      # Compaq C++
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+-
+-      runpath_var=LD_RUN_PATH
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      # Commands to make compiler produce verbose output that lists
+-      # what "hidden" libraries, object files and flags are used when
+-      # linking a shared library.
+-      #
+-      # There doesn't appear to be a way to prevent this compiler from
+-      # explicitly linking system object files so we need to strip them
+-      # from the output so that they don't get included in the library
+-      # dependencies.
+-      output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+-      ;;
+-    esac
+-    ;;
+-  lynxos*)
+-    # FIXME: insert proper C++ library support
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  m88k*)
+-    # FIXME: insert proper C++ library support
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  mvs*)
+-    case $cc_basename in
+-      cxx*)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      *)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    esac
+-    ;;
+-  netbsd*)
+-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+-      wlarc=
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-    fi
+-    # Workaround some broken pre-1.5 toolchains
+-    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+-    ;;
+-  openbsd2*)
+-    # C++ shared libraries are fairly broken
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  openbsd*)
+-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+-    fi
+-    output_verbose_link_cmd='echo'
+-    ;;
+-  osf3*)
+-    case $cc_basename in
+-      KCC*)
+-      # Kuck and Associates, Inc. (KAI) C++ Compiler
+-
+-      # KCC will only create a shared library if the output file
+-      # ends with ".so" (or ".sl" for HP-UX), so rename the library
+-      # to its proper name (with version) after linking.
+-      _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      # Archives containing C++ object files must be created using
+-      # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+-
+-      ;;
+-      RCC*)
+-      # Rational C++ 2.4.1
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      cxx*)
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      # Commands to make compiler produce verbose output that lists
+-      # what "hidden" libraries, object files and flags are used when
+-      # linking a shared library.
+-      #
+-      # There doesn't appear to be a way to prevent this compiler from
+-      # explicitly linking system object files so we need to strip them
+-      # from the output so that they don't get included in the library
+-      # dependencies.
+-      output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+-      ;;
+-      *)
+-      if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+-
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-        # Commands to make compiler produce verbose output that lists
+-        # what "hidden" libraries, object files and flags are used when
+-        # linking a shared library.
+-        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+-
+-      else
+-        # FIXME: insert proper C++ library support
+-        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-    esac
+-    ;;
+-  osf4* | osf5*)
+-    case $cc_basename in
+-      KCC*)
+-      # Kuck and Associates, Inc. (KAI) C++ Compiler
+-
+-      # KCC will only create a shared library if the output file
+-      # ends with ".so" (or ".sl" for HP-UX), so rename the library
+-      # to its proper name (with version) after linking.
+-      _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      # Archives containing C++ object files must be created using
+-      # the KAI C++ compiler.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+-      ;;
+-      RCC*)
+-      # Rational C++ 2.4.1
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      cxx*)
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+-        echo "-hidden">> $lib.exp~
+-        $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+-        $rm $lib.exp'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      # Commands to make compiler produce verbose output that lists
+-      # what "hidden" libraries, object files and flags are used when
+-      # linking a shared library.
+-      #
+-      # There doesn't appear to be a way to prevent this compiler from
+-      # explicitly linking system object files so we need to strip them
+-      # from the output so that they don't get included in the library
+-      # dependencies.
+-      output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+-      ;;
+-      *)
+-      if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+-       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+-
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-        # Commands to make compiler produce verbose output that lists
+-        # what "hidden" libraries, object files and flags are used when
+-        # linking a shared library.
+-        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+-
+-      else
+-        # FIXME: insert proper C++ library support
+-        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-    esac
+-    ;;
+-  psos*)
+-    # FIXME: insert proper C++ library support
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  sunos4*)
+-    case $cc_basename in
+-      CC*)
+-      # Sun C++ 4.x
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      lcc*)
+-      # Lucid
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      *)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    esac
+-    ;;
+-  solaris*)
+-    case $cc_basename in
+-      CC*)
+-      # Sun C++ 4.2, 5.x and Centerline C++
+-        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+-      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+-      $CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+-
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      case $host_os in
+-        solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+-        *)
+-          # The C++ compiler is used as linker so we must use $wl
+-          # flag to pass the commands to the underlying system
+-          # linker. We must also pass each convience library through
+-          # to the system linker between allextract/defaultextract.
+-          # The C++ compiler will combine linker options so we
+-          # cannot just pass the convience library names through
+-          # without $wl.
+-          # Supported since Solaris 2.6 (maybe 2.5.1?)
+-          _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+-          ;;
+-      esac
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-
+-      output_verbose_link_cmd='echo'
+-
+-      # Archives containing C++ object files must be created using
+-      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+-      # necessary to make sure instantiated templates are included
+-      # in the archive.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+-      ;;
+-      gcx*)
+-      # Green Hills C++ Compiler
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+-
+-      # The C++ compiler must be used to create the archive.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+-      ;;
+-      *)
+-      # GNU C++ compiler with Solaris linker
+-      if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+-        _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+-        if $CC --version | grep -v '^2\.7' > /dev/null; then
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+-              $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+-
+-          # Commands to make compiler produce verbose output that lists
+-          # what "hidden" libraries, object files and flags are used when
+-          # linking a shared library.
+-          output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+-        else
+-          # g++ 2.7 appears to require `-G' NOT `-shared' on this
+-          # platform.
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+-              $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+-
+-          # Commands to make compiler produce verbose output that lists
+-          # what "hidden" libraries, object files and flags are used when
+-          # linking a shared library.
+-          output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+-        fi
+-
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+-      fi
+-      ;;
+-    esac
+-    ;;
+-  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+-    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-    runpath_var='LD_RUN_PATH'
+-
+-    case $cc_basename in
+-      CC*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      ;;
+-      *)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      ;;
+-    esac
+-    ;;
+-  sysv5* | sco3.2v5* | sco5v6*)
+-    # Note: We can NOT use -z defs as we might desire, because we do not
+-    # link with -lc, and that would cause any symbols used from libc to
+-    # always be unresolved, which means just about no library would
+-    # ever link correctly.  If we're not using GNU ld we use -z text
+-    # though, which does catch some bad symbols but isn't as heavy-handed
+-    # as -z defs.
+-    # For security reasons, it is highly recommended that you always
+-    # use absolute paths for naming shared libraries, and exclude the
+-    # DT_RUNPATH tag from executables and libraries.  But doing so
+-    # requires that you compile everything twice, which is a pain.
+-    # So that behaviour is only enabled if SCOABSPATH is set to a
+-    # non-empty value in the environment.  Most likely only useful for
+-    # creating official distributions of packages.
+-    # This is a hack until libtool officially supports absolute path
+-    # names for shared libraries.
+-    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+-    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+-    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+-    runpath_var='LD_RUN_PATH'
+-
+-    case $cc_basename in
+-      CC*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      ;;
+-      *)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      ;;
+-    esac
+-    ;;
+-  tandem*)
+-    case $cc_basename in
+-      NCC*)
+-      # NonStop-UX NCC 3.20
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-      *)
+-      # FIXME: insert proper C++ library support
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    esac
+-    ;;
+-  vxworks*)
+-    # FIXME: insert proper C++ library support
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-  *)
+-    # FIXME: insert proper C++ library support
+-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-    ;;
+-esac
+-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+-
+-_LT_AC_TAGVAR(GCC, $1)="$GXX"
+-_LT_AC_TAGVAR(LD, $1)="$LD"
+-
+-## CAVEAT EMPTOR:
+-## There is no encapsulation within the following macros, do not change
+-## the running order or otherwise move them around unless you know exactly
+-## what you are doing...
+-AC_LIBTOOL_POSTDEP_PREDEP($1)
+-AC_LIBTOOL_PROG_COMPILER_PIC($1)
+-AC_LIBTOOL_PROG_CC_C_O($1)
+-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+-AC_LIBTOOL_PROG_LD_SHLIBS($1)
+-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+-
+-AC_LIBTOOL_CONFIG($1)
+-
+-AC_LANG_POP
+-CC=$lt_save_CC
+-LDCXX=$LD
+-LD=$lt_save_LD
+-GCC=$lt_save_GCC
+-with_gnu_ldcxx=$with_gnu_ld
+-with_gnu_ld=$lt_save_with_gnu_ld
+-lt_cv_path_LDCXX=$lt_cv_path_LD
+-lt_cv_path_LD=$lt_save_path_LD
+-lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+-lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+-])# AC_LIBTOOL_LANG_CXX_CONFIG
+-
+-# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+-# ------------------------------------
+-# Figure out "hidden" library dependencies from verbose
+-# compiler output when linking a shared library.
+-# Parse the compiler output and extract the necessary
+-# objects, libraries and library flags.
+-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+-dnl we can't use the lt_simple_compile_test_code here,
+-dnl because it contains code intended for an executable,
+-dnl not a library.  It's possible we should let each
+-dnl tag define a new lt_????_link_test_code variable,
+-dnl but it's only used here...
+-ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+-int a;
+-void foo (void) { a = 0; }
+-EOF
+-],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+-class Foo
+-{
+-public:
+-  Foo (void) { a = 0; }
+-private:
+-  int a;
+-};
+-EOF
+-],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+-      subroutine foo
+-      implicit none
+-      integer*4 a
+-      a=0
+-      return
+-      end
+-EOF
+-],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+-public class foo {
+-  private int a;
+-  public void bar (void) {
+-    a = 0;
+-  }
+-};
+-EOF
+-])
+-dnl Parse the compiler output and extract the necessary
+-dnl objects, libraries and library flags.
+-if AC_TRY_EVAL(ac_compile); then
+-  # Parse the compiler output and extract the necessary
+-  # objects, libraries and library flags.
+-
+-  # Sentinel used to keep track of whether or not we are before
+-  # the conftest object file.
+-  pre_test_object_deps_done=no
+-
+-  # The `*' in the case matches for architectures that use `case' in
+-  # $output_verbose_cmd can trigger glob expansion during the loop
+-  # eval without this substitution.
+-  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+-
+-  for p in `eval $output_verbose_link_cmd`; do
+-    case $p in
+-
+-    -L* | -R* | -l*)
+-       # Some compilers place space between "-{L,R}" and the path.
+-       # Remove the space.
+-       if test $p = "-L" \
+-        || test $p = "-R"; then
+-       prev=$p
+-       continue
+-       else
+-       prev=
+-       fi
+-
+-       if test "$pre_test_object_deps_done" = no; then
+-       case $p in
+-       -L* | -R*)
+-         # Internal compiler library paths should come after those
+-         # provided the user.  The postdeps already come after the
+-         # user supplied libs so there is no need to process them.
+-         if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+-           _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+-         else
+-           _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+-         fi
+-         ;;
+-       # The "-l" case would never come before the object being
+-       # linked, so don't bother handling this case.
+-       esac
+-       else
+-       if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+-         _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+-       else
+-         _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+-       fi
+-       fi
+-       ;;
+-
+-    *.$objext)
+-       # This assumes that the test object file only shows up
+-       # once in the compiler output.
+-       if test "$p" = "conftest.$objext"; then
+-       pre_test_object_deps_done=yes
+-       continue
+-       fi
+-
+-       if test "$pre_test_object_deps_done" = no; then
+-       if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+-         _LT_AC_TAGVAR(predep_objects, $1)="$p"
+-       else
+-         _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+-       fi
+-       else
+-       if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+-         _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+-       else
+-         _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+-       fi
+-       fi
+-       ;;
+-
+-    *) ;; # Ignore the rest.
+-
+-    esac
+-  done
+-
+-  # Clean up.
+-  rm -f a.out a.exe
+-else
+-  echo "libtool.m4: error: problem compiling $1 test program"
+-fi
+-
+-$rm -f confest.$objext
+-
+-# PORTME: override above test on systems where it is broken
+-ifelse([$1],[CXX],
+-[case $host_os in
+-interix3*)
+-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+-  # hack all around it, let's just trust "g++" to DTRT.
+-  _LT_AC_TAGVAR(predep_objects,$1)=
+-  _LT_AC_TAGVAR(postdep_objects,$1)=
+-  _LT_AC_TAGVAR(postdeps,$1)=
+-  ;;
+-
+-solaris*)
+-  case $cc_basename in
+-  CC*)
+-    # Adding this requires a known-good setup of shared libraries for
+-    # Sun compiler versions before 5.6, else PIC objects from an old
+-    # archive will be linked into the output, leading to subtle bugs.
+-    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+-    ;;
+-  esac
+-  ;;
+-esac
+-])
+-
+-case " $_LT_AC_TAGVAR(postdeps, $1) " in
+-*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+-esac
+-])# AC_LIBTOOL_POSTDEP_PREDEP
+-
+-# AC_LIBTOOL_LANG_F77_CONFIG
+-# --------------------------
+-# Ensure that the configuration vars for the C compiler are
+-# suitably defined.  Those variables are subsequently used by
+-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+-AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+-AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+-[AC_REQUIRE([AC_PROG_F77])
+-AC_LANG_PUSH(Fortran 77)
+-
+-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+-_LT_AC_TAGVAR(always_export_symbols, $1)=no
+-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+-_LT_AC_TAGVAR(hardcode_direct, $1)=no
+-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+-_LT_AC_TAGVAR(module_cmds, $1)=
+-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+-_LT_AC_TAGVAR(no_undefined_flag, $1)=
+-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+-
+-# Source file extension for f77 test sources.
+-ac_ext=f
+-
+-# Object file extension for compiled f77 test sources.
+-objext=o
+-_LT_AC_TAGVAR(objext, $1)=$objext
+-
+-# Code to be used in simple compile tests
+-lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+-
+-# Code to be used in simple link tests
+-lt_simple_link_test_code="      program t\n      end\n"
+-
+-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+-_LT_AC_SYS_COMPILER
+-
+-# save warnings/boilerplate of simple test code
+-_LT_COMPILER_BOILERPLATE
+-_LT_LINKER_BOILERPLATE
+-
+-# Allow CC to be a program name with arguments.
+-lt_save_CC="$CC"
+-CC=${F77-"f77"}
+-compiler=$CC
+-_LT_AC_TAGVAR(compiler, $1)=$CC
+-_LT_CC_BASENAME([$compiler])
+-
+-AC_MSG_CHECKING([if libtool supports shared libraries])
+-AC_MSG_RESULT([$can_build_shared])
+-
+-AC_MSG_CHECKING([whether to build shared libraries])
+-test "$can_build_shared" = "no" && enable_shared=no
+-
+-# On AIX, shared libraries and static libraries use the same namespace, and
+-# are all built from PIC.
+-case $host_os in
+-aix3*)
+-  test "$enable_shared" = yes && enable_static=no
+-  if test -n "$RANLIB"; then
+-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+-    postinstall_cmds='$RANLIB $lib'
+-  fi
+-  ;;
+-aix4* | aix5*)
+-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+-    test "$enable_shared" = yes && enable_static=no
+-  fi
+-  ;;
+-esac
+-AC_MSG_RESULT([$enable_shared])
+-
+-AC_MSG_CHECKING([whether to build static libraries])
+-# Make sure either enable_shared or enable_static is yes.
+-test "$enable_shared" = yes || enable_static=yes
+-AC_MSG_RESULT([$enable_static])
+-
+-_LT_AC_TAGVAR(GCC, $1)="$G77"
+-_LT_AC_TAGVAR(LD, $1)="$LD"
+-
+-AC_LIBTOOL_PROG_COMPILER_PIC($1)
+-AC_LIBTOOL_PROG_CC_C_O($1)
+-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+-AC_LIBTOOL_PROG_LD_SHLIBS($1)
+-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+-
+-AC_LIBTOOL_CONFIG($1)
+-
+-AC_LANG_POP
+-CC="$lt_save_CC"
+-])# AC_LIBTOOL_LANG_F77_CONFIG
+-
+-
+-# AC_LIBTOOL_LANG_GCJ_CONFIG
+-# --------------------------
+-# Ensure that the configuration vars for the C compiler are
+-# suitably defined.  Those variables are subsequently used by
+-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+-AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+-AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+-[AC_LANG_SAVE
+-
+-# Source file extension for Java test sources.
+-ac_ext=java
+-
+-# Object file extension for compiled Java test sources.
+-objext=o
+-_LT_AC_TAGVAR(objext, $1)=$objext
+-
+-# Code to be used in simple compile tests
+-lt_simple_compile_test_code="class foo {}\n"
+-
+-# Code to be used in simple link tests
+-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+-
+-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+-_LT_AC_SYS_COMPILER
+-
+-# save warnings/boilerplate of simple test code
+-_LT_COMPILER_BOILERPLATE
+-_LT_LINKER_BOILERPLATE
+-
+-# Allow CC to be a program name with arguments.
+-lt_save_CC="$CC"
+-CC=${GCJ-"gcj"}
+-compiler=$CC
+-_LT_AC_TAGVAR(compiler, $1)=$CC
+-_LT_CC_BASENAME([$compiler])
+-
+-# GCJ did not exist at the time GCC didn't implicitly link libc in.
+-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-
+-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+-
+-## CAVEAT EMPTOR:
+-## There is no encapsulation within the following macros, do not change
+-## the running order or otherwise move them around unless you know exactly
+-## what you are doing...
+-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+-AC_LIBTOOL_PROG_COMPILER_PIC($1)
+-AC_LIBTOOL_PROG_CC_C_O($1)
+-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+-AC_LIBTOOL_PROG_LD_SHLIBS($1)
+-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+-
+-AC_LIBTOOL_CONFIG($1)
+-
+-AC_LANG_RESTORE
+-CC="$lt_save_CC"
+-])# AC_LIBTOOL_LANG_GCJ_CONFIG
+-
+-
+-# AC_LIBTOOL_LANG_RC_CONFIG
+-# -------------------------
+-# Ensure that the configuration vars for the Windows resource compiler are
+-# suitably defined.  Those variables are subsequently used by
+-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+-AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+-AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+-[AC_LANG_SAVE
+-
+-# Source file extension for RC test sources.
+-ac_ext=rc
+-
+-# Object file extension for compiled RC test sources.
+-objext=o
+-_LT_AC_TAGVAR(objext, $1)=$objext
+-
+-# Code to be used in simple compile tests
+-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+-
+-# Code to be used in simple link tests
+-lt_simple_link_test_code="$lt_simple_compile_test_code"
+-
+-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+-_LT_AC_SYS_COMPILER
+-
+-# save warnings/boilerplate of simple test code
+-_LT_COMPILER_BOILERPLATE
+-_LT_LINKER_BOILERPLATE
+-
+-# Allow CC to be a program name with arguments.
+-lt_save_CC="$CC"
+-CC=${RC-"windres"}
+-compiler=$CC
+-_LT_AC_TAGVAR(compiler, $1)=$CC
+-_LT_CC_BASENAME([$compiler])
+-_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+-
+-AC_LIBTOOL_CONFIG($1)
+-
+-AC_LANG_RESTORE
+-CC="$lt_save_CC"
+-])# AC_LIBTOOL_LANG_RC_CONFIG
+-
+-
+-# AC_LIBTOOL_CONFIG([TAGNAME])
+-# ----------------------------
+-# If TAGNAME is not passed, then create an initial libtool script
+-# with a default configuration from the untagged config vars.  Otherwise
+-# add code to config.status for appending the configuration named by
+-# TAGNAME from the matching tagged config vars.
+-AC_DEFUN([AC_LIBTOOL_CONFIG],
+-[# The else clause should only fire when bootstrapping the
+-# libtool distribution, otherwise you forgot to ship ltmain.sh
+-# with your package, and you will get complaints that there are
+-# no rules to generate ltmain.sh.
+-if test -f "$ltmain"; then
+-  # See if we are running on zsh, and set the options which allow our commands through
+-  # without removal of \ escapes.
+-  if test -n "${ZSH_VERSION+set}" ; then
+-    setopt NO_GLOB_SUBST
+-  fi
+-  # Now quote all the things that may contain metacharacters while being
+-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+-  # variables and quote the copies for generation of the libtool script.
+-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+-    SED SHELL STRIP \
+-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+-    deplibs_check_method reload_flag reload_cmds need_locks \
+-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+-    lt_cv_sys_global_symbol_to_c_name_address \
+-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+-    old_postinstall_cmds old_postuninstall_cmds \
+-    _LT_AC_TAGVAR(compiler, $1) \
+-    _LT_AC_TAGVAR(CC, $1) \
+-    _LT_AC_TAGVAR(LD, $1) \
+-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+-    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+-    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+-    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+-    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+-    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+-    _LT_AC_TAGVAR(predep_objects, $1) \
+-    _LT_AC_TAGVAR(postdep_objects, $1) \
+-    _LT_AC_TAGVAR(predeps, $1) \
+-    _LT_AC_TAGVAR(postdeps, $1) \
+-    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+-    _LT_AC_TAGVAR(archive_cmds, $1) \
+-    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+-    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+-    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+-    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+-    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+-    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+-    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+-    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+-    _LT_AC_TAGVAR(module_cmds, $1) \
+-    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+-    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+-    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+-    _LT_AC_TAGVAR(include_expsyms, $1); do
+-
+-    case $var in
+-    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+-    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+-    _LT_AC_TAGVAR(archive_cmds, $1) | \
+-    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+-    _LT_AC_TAGVAR(module_cmds, $1) | \
+-    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+-    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+-    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+-    postinstall_cmds | postuninstall_cmds | \
+-    old_postinstall_cmds | old_postuninstall_cmds | \
+-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+-      # Double-quote double-evaled strings.
+-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+-      ;;
+-    *)
+-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+-      ;;
+-    esac
+-  done
+-
+-  case $lt_echo in
+-  *'\[$]0 --fallback-echo"')
+-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+-    ;;
+-  esac
+-
+-ifelse([$1], [],
+-  [cfgfile="${ofile}T"
+-  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+-  $rm -f "$cfgfile"
+-  AC_MSG_NOTICE([creating $ofile])],
+-  [cfgfile="$ofile"])
+-
+-  cat <<__EOF__ >> "$cfgfile"
+-ifelse([$1], [],
+-[#! $SHELL
+-
+-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+-#
+-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+-# Free Software Foundation, Inc.
+-#
+-# This file is part of GNU Libtool:
+-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+-#
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 2 of the License, or
+-# (at your option) any later version.
+-#
+-# This program is distributed in the hope that it will be useful, but
+-# WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-# General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program; if not, write to the Free Software
+-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+-#
+-# As a special exception to the GNU General Public License, if you
+-# distribute this file as part of a program that contains a
+-# configuration script generated by Autoconf, you may include it under
+-# the same distribution terms that you use for the rest of that program.
+-
+-# A sed program that does not truncate output.
+-SED=$lt_SED
+-
+-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+-Xsed="$SED -e 1s/^X//"
+-
+-# The HP-UX ksh and POSIX shell print the target directory to stdout
+-# if CDPATH is set.
+-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+-
+-# The names of the tagged configurations supported by this script.
+-available_tags=
+-
+-# ### BEGIN LIBTOOL CONFIG],
+-[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+-
+-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+-
+-# Shell to use when invoking shell scripts.
+-SHELL=$lt_SHELL
+-
+-# Whether or not to build shared libraries.
+-build_libtool_libs=$enable_shared
+-
+-# Whether or not to build static libraries.
+-build_old_libs=$enable_static
+-
+-# Whether or not to add -lc for building shared libraries.
+-build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+-
+-# Whether or not to disallow shared libs when runtime libs are static
+-allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+-
+-# Whether or not to optimize for fast installation.
+-fast_install=$enable_fast_install
+-
+-# The host system.
+-host_alias=$host_alias
+-host=$host
+-host_os=$host_os
+-
+-# The build system.
+-build_alias=$build_alias
+-build=$build
+-build_os=$build_os
+-
+-# An echo program that does not interpret backslashes.
+-echo=$lt_echo
+-
+-# The archiver.
+-AR=$lt_AR
+-AR_FLAGS=$lt_AR_FLAGS
+-
+-# A C compiler.
+-LTCC=$lt_LTCC
+-
+-# LTCC compiler flags.
+-LTCFLAGS=$lt_LTCFLAGS
+-
+-# A language-specific compiler.
+-CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+-
+-# Is the compiler the GNU C compiler?
+-with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+-
+-# An ERE matcher.
+-EGREP=$lt_EGREP
+-
+-# The linker used to build libraries.
+-LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+-
+-# Whether we need hard or soft links.
+-LN_S=$lt_LN_S
+-
+-# A BSD-compatible nm program.
+-NM=$lt_NM
+-
+-# A symbol stripping program
+-STRIP=$lt_STRIP
+-
+-# Used to examine libraries when file_magic_cmd begins "file"
+-MAGIC_CMD=$MAGIC_CMD
+-
+-# Used on cygwin: DLL creation program.
+-DLLTOOL="$DLLTOOL"
+-
+-# Used on cygwin: object dumper.
+-OBJDUMP="$OBJDUMP"
+-
+-# Used on cygwin: assembler.
+-AS="$AS"
+-
+-# The name of the directory that contains temporary libtool files.
+-objdir=$objdir
+-
+-# How to create reloadable object files.
+-reload_flag=$lt_reload_flag
+-reload_cmds=$lt_reload_cmds
+-
+-# How to pass a linker flag through the compiler.
+-wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+-
+-# Object file suffix (normally "o").
+-objext="$ac_objext"
+-
+-# Old archive suffix (normally "a").
+-libext="$libext"
+-
+-# Shared library suffix (normally ".so").
+-shrext_cmds='$shrext_cmds'
+-
+-# Executable file suffix (normally "").
+-exeext="$exeext"
+-
+-# Additional compiler flags for building library objects.
+-pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+-pic_mode=$pic_mode
+-
+-# What is the maximum length of a command?
+-max_cmd_len=$lt_cv_sys_max_cmd_len
+-
+-# Does compiler simultaneously support -c and -o options?
+-compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+-
+-# Must we lock files when doing compilation?
+-need_locks=$lt_need_locks
+-
+-# Do we need the lib prefix for modules?
+-need_lib_prefix=$need_lib_prefix
+-
+-# Do we need a version for libraries?
+-need_version=$need_version
+-
+-# Whether dlopen is supported.
+-dlopen_support=$enable_dlopen
+-
+-# Whether dlopen of programs is supported.
+-dlopen_self=$enable_dlopen_self
+-
+-# Whether dlopen of statically linked programs is supported.
+-dlopen_self_static=$enable_dlopen_self_static
+-
+-# Compiler flag to prevent dynamic linking.
+-link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+-
+-# Compiler flag to turn off builtin functions.
+-no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+-
+-# Compiler flag to allow reflexive dlopens.
+-export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+-
+-# Compiler flag to generate shared objects directly from archives.
+-whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+-
+-# Compiler flag to generate thread-safe objects.
+-thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+-
+-# Library versioning type.
+-version_type=$version_type
+-
+-# Format of library name prefix.
+-libname_spec=$lt_libname_spec
+-
+-# List of archive names.  First name is the real one, the rest are links.
+-# The last name is the one that the linker finds with -lNAME.
+-library_names_spec=$lt_library_names_spec
+-
+-# The coded name of the library, if different from the real name.
+-soname_spec=$lt_soname_spec
+-
+-# Commands used to build and install an old-style archive.
+-RANLIB=$lt_RANLIB
+-old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+-old_postinstall_cmds=$lt_old_postinstall_cmds
+-old_postuninstall_cmds=$lt_old_postuninstall_cmds
+-
+-# Create an old-style archive from a shared archive.
+-old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+-
+-# Create a temporary old-style archive to link instead of a shared archive.
+-old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+-
+-# Commands used to build and install a shared archive.
+-archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+-archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+-postinstall_cmds=$lt_postinstall_cmds
+-postuninstall_cmds=$lt_postuninstall_cmds
+-
+-# Commands used to build a loadable module (assumed same as above if empty)
+-module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+-module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+-
+-# Commands to strip libraries.
+-old_striplib=$lt_old_striplib
+-striplib=$lt_striplib
+-
+-# Dependencies to place before the objects being linked to create a
+-# shared library.
+-predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+-
+-# Dependencies to place after the objects being linked to create a
+-# shared library.
+-postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+-
+-# Dependencies to place before the objects being linked to create a
+-# shared library.
+-predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+-
+-# Dependencies to place after the objects being linked to create a
+-# shared library.
+-postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+-
+-# The library search path used internally by the compiler when linking
+-# a shared library.
+-compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+-
+-# Method to check whether dependent libraries are shared objects.
+-deplibs_check_method=$lt_deplibs_check_method
+-
+-# Command to use when deplibs_check_method == file_magic.
+-file_magic_cmd=$lt_file_magic_cmd
+-
+-# Flag that allows shared libraries with undefined symbols to be built.
+-allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+-
+-# Flag that forces no undefined symbols.
+-no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+-
+-# Commands used to finish a libtool library installation in a directory.
+-finish_cmds=$lt_finish_cmds
+-
+-# Same as above, but a single script fragment to be evaled but not shown.
+-finish_eval=$lt_finish_eval
+-
+-# Take the output of nm and produce a listing of raw symbols and C names.
+-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+-
+-# Transform the output of nm in a proper C declaration
+-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+-
+-# Transform the output of nm in a C name address pair
+-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+-
+-# This is the shared library runtime path variable.
+-runpath_var=$runpath_var
+-
+-# This is the shared library path variable.
+-shlibpath_var=$shlibpath_var
+-
+-# Is shlibpath searched before the hard-coded library search path?
+-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+-
+-# How to hardcode a shared library path into an executable.
+-hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+-
+-# Whether we should hardcode library paths into libraries.
+-hardcode_into_libs=$hardcode_into_libs
+-
+-# Flag to hardcode \$libdir into a binary during linking.
+-# This must work even if \$libdir does not exist.
+-hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+-
+-# If ld is used when linking, flag to hardcode \$libdir into
+-# a binary during linking. This must work even if \$libdir does
+-# not exist.
+-hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+-
+-# Whether we need a single -rpath flag with a separated argument.
+-hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+-
+-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+-# resulting binary.
+-hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+-
+-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+-# resulting binary.
+-hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+-
+-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+-# the resulting binary.
+-hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+-
+-# Set to yes if building a shared library automatically hardcodes DIR into the library
+-# and all subsequent libraries and executables linked against it.
+-hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+-
+-# Variables whose values should be saved in libtool wrapper scripts and
+-# restored at relink time.
+-variables_saved_for_relink="$variables_saved_for_relink"
+-
+-# Whether libtool must link a program against all its dependency libraries.
+-link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+-
+-# Compile-time system search path for libraries
+-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+-
+-# Run-time system search path for libraries
+-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+-
+-# Fix the shell variable \$srcfile for the compiler.
+-fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+-
+-# Set to yes if exported symbols are required.
+-always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+-
+-# The commands to list exported symbols.
+-export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+-
+-# The commands to extract the exported symbol list from a shared archive.
+-extract_expsyms_cmds=$lt_extract_expsyms_cmds
+-
+-# Symbols that should not be listed in the preloaded symbols.
+-exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+-
+-# Symbols that must always be exported.
+-include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+-
+-ifelse([$1],[],
+-[# ### END LIBTOOL CONFIG],
+-[# ### END LIBTOOL TAG CONFIG: $tagname])
+-
+-__EOF__
+-
+-ifelse([$1],[], [
+-  case $host_os in
+-  aix3*)
+-    cat <<\EOF >> "$cfgfile"
+-
+-# AIX sometimes has problems with the GCC collect2 program.  For some
+-# reason, if we set the COLLECT_NAMES environment variable, the problems
+-# vanish in a puff of smoke.
+-if test "X${COLLECT_NAMES+set}" != Xset; then
+-  COLLECT_NAMES=
+-  export COLLECT_NAMES
+-fi
+-EOF
+-    ;;
+-  esac
+-
+-  # We use sed instead of cat because bash on DJGPP gets confused if
+-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+-  # text mode, it properly converts lines to CR/LF.  This bash problem
+-  # is reportedly fixed, but why not run on old versions too?
+-  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+-
+-  mv -f "$cfgfile" "$ofile" || \
+-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+-  chmod +x "$ofile"
+-])
+-else
+-  # If there is no Makefile yet, we rely on a make rule to execute
+-  # `config.status --recheck' to rerun these tests and create the
+-  # libtool script then.
+-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+-  if test -f "$ltmain_in"; then
+-    test -f Makefile && make "$ltmain"
+-  fi
+-fi
+-])# AC_LIBTOOL_CONFIG
+-
+-
+-# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+-# -------------------------------------------
+-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+-
+-_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+-
+-if test "$GCC" = yes; then
+-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+-
+-  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+-    lt_cv_prog_compiler_rtti_exceptions,
+-    [-fno-rtti -fno-exceptions], [],
+-    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+-fi
+-])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+-
+-
+-# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+-# ---------------------------------
+-AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+-[AC_REQUIRE([AC_CANONICAL_HOST])
+-AC_REQUIRE([AC_PROG_NM])
+-AC_REQUIRE([AC_OBJEXT])
+-# Check for command to grab the raw symbol name followed by C symbol from nm.
+-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+-[
+-# These are sane defaults that work on at least a few old systems.
+-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+-
+-# Character class describing NM global symbol codes.
+-symcode='[[BCDEGRST]]'
+-
+-# Regexp to match symbols that can be accessed directly from C.
+-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+-
+-# Transform an extracted symbol line into a proper C declaration
+-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+-
+-# Transform an extracted symbol line into symbol name and symbol address
+-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+-
+-# Define system-specific variables.
+-case $host_os in
+-aix*)
+-  symcode='[[BCDT]]'
+-  ;;
+-cygwin* | mingw* | pw32*)
+-  symcode='[[ABCDGISTW]]'
+-  ;;
+-hpux*) # Its linker distinguishes data from code symbols
+-  if test "$host_cpu" = ia64; then
+-    symcode='[[ABCDEGRST]]'
+-  fi
+-  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+-  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+-  ;;
+-linux*)
+-  if test "$host_cpu" = ia64; then
+-    symcode='[[ABCDGIRSTW]]'
+-    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+-    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+-  fi
+-  ;;
+-irix* | nonstopux*)
+-  symcode='[[BCDEGRST]]'
+-  ;;
+-osf*)
+-  symcode='[[BCDEGQRST]]'
+-  ;;
+-solaris*)
+-  symcode='[[BDRT]]'
+-  ;;
+-sco3.2v5*)
+-  symcode='[[DT]]'
+-  ;;
+-sysv4.2uw2*)
+-  symcode='[[DT]]'
+-  ;;
+-sysv5* | sco5v6* | unixware* | OpenUNIX*)
+-  symcode='[[ABDT]]'
+-  ;;
+-sysv4)
+-  symcode='[[DFNSTU]]'
+-  ;;
+-esac
+-
+-# Handle CRLF in mingw tool chain
+-opt_cr=
+-case $build_os in
+-mingw*)
+-  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+-  ;;
+-esac
+-
+-# If we're using GNU nm, then use its standard symbol codes.
+-case `$NM -V 2>&1` in
+-*GNU* | *'with BFD'*)
+-  symcode='[[ABCDGIRSTW]]' ;;
+-esac
+-
+-# Try without a prefix undercore, then with it.
+-for ac_symprfx in "" "_"; do
+-
+-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+-  symxfrm="\\1 $ac_symprfx\\2 \\2"
+-
+-  # Write the raw and C identifiers.
+-  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[    ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+-
+-  # Check to see that the pipe works correctly.
+-  pipe_works=no
+-
+-  rm -f conftest*
+-  cat > conftest.$ac_ext <<EOF
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-char nm_test_var;
+-void nm_test_func(){}
+-#ifdef __cplusplus
+-}
+-#endif
+-int main(){nm_test_var='a';nm_test_func();return(0);}
+-EOF
+-
+-  if AC_TRY_EVAL(ac_compile); then
+-    # Now try to grab the symbols.
+-    nlist=conftest.nm
+-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+-      # Try sorting and uniquifying the output.
+-      if sort "$nlist" | uniq > "$nlist"T; then
+-      mv -f "$nlist"T "$nlist"
+-      else
+-      rm -f "$nlist"T
+-      fi
+-
+-      # Make sure that we snagged all the symbols we need.
+-      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+-      if grep ' nm_test_func$' "$nlist" >/dev/null; then
+-        cat <<EOF > conftest.$ac_ext
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-EOF
+-        # Now generate the symbol file.
+-        eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+-
+-        cat <<EOF >> conftest.$ac_ext
+-#if defined (__STDC__) && __STDC__
+-# define lt_ptr_t void *
+-#else
+-# define lt_ptr_t char *
+-# define const
+-#endif
+-
+-/* The mapping between symbol names and symbols. */
+-const struct {
+-  const char *name;
+-  lt_ptr_t address;
+-}
+-lt_preloaded_symbols[[]] =
+-{
+-EOF
+-        $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+-        cat <<\EOF >> conftest.$ac_ext
+-  {0, (lt_ptr_t) 0}
+-};
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-EOF
+-        # Now try linking the two files.
+-        mv conftest.$ac_objext conftstm.$ac_objext
+-        lt_save_LIBS="$LIBS"
+-        lt_save_CFLAGS="$CFLAGS"
+-        LIBS="conftstm.$ac_objext"
+-        CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+-        if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+-          pipe_works=yes
+-        fi
+-        LIBS="$lt_save_LIBS"
+-        CFLAGS="$lt_save_CFLAGS"
+-      else
+-        echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+-      fi
+-      else
+-      echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+-      fi
+-    else
+-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+-    fi
+-  else
+-    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+-    cat conftest.$ac_ext >&5
+-  fi
+-  rm -f conftest* conftst*
+-
+-  # Do not use the global_symbol_pipe unless it works.
+-  if test "$pipe_works" = yes; then
+-    break
+-  else
+-    lt_cv_sys_global_symbol_pipe=
+-  fi
+-done
+-])
+-if test -z "$lt_cv_sys_global_symbol_pipe"; then
+-  lt_cv_sys_global_symbol_to_cdecl=
+-fi
+-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+-  AC_MSG_RESULT(failed)
+-else
+-  AC_MSG_RESULT(ok)
+-fi
+-]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+-
+-
+-# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+-# ---------------------------------------
+-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+-[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+-_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+-_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+-
+-AC_MSG_CHECKING([for $compiler option to produce PIC])
+- ifelse([$1],[CXX],[
+-  # C++ specific cases for pic, static, wl, etc.
+-  if test "$GXX" = yes; then
+-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+-
+-    case $host_os in
+-    aix*)
+-      # All AIX code is PIC.
+-      if test "$host_cpu" = ia64; then
+-      # AIX 5 now supports IA64 processor
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      fi
+-      ;;
+-    amigaos*)
+-      # FIXME: we need at least 68020 code to build shared libraries, but
+-      # adding the `-m68020' flag to GCC prevents building anything better,
+-      # like `-m68040'.
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+-      ;;
+-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+-      # PIC is the default for these OSes.
+-      ;;
+-    mingw* | os2* | pw32*)
+-      # This hack is so that the source file can tell whether it is being
+-      # built for inclusion in a dll (and should export symbols for example).
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+-      ;;
+-    darwin* | rhapsody*)
+-      # PIC is the default on this platform
+-      # Common symbols not allowed in MH_DYLIB files
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+-      ;;
+-    *djgpp*)
+-      # DJGPP does not support shared libraries at all
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+-      ;;
+-    interix3*)
+-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+-      # Instead, we relocate shared libraries at runtime.
+-      ;;
+-    sysv4*MP*)
+-      if test -d /usr/nec; then
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+-      fi
+-      ;;
+-    hpux*)
+-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+-      # not for PA HP-UX.
+-      case $host_cpu in
+-      hppa*64*|ia64*)
+-      ;;
+-      *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+-      ;;
+-      esac
+-      ;;
+-    *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+-      ;;
+-    esac
+-  else
+-    case $host_os in
+-      aix4* | aix5*)
+-      # All AIX code is PIC.
+-      if test "$host_cpu" = ia64; then
+-        # AIX 5 now supports IA64 processor
+-        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      else
+-        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+-      fi
+-      ;;
+-      chorus*)
+-      case $cc_basename in
+-      cxch68*)
+-        # Green Hills C++ Compiler
+-        # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+-        ;;
+-      esac
+-      ;;
+-       darwin*)
+-         # PIC is the default on this platform
+-         # Common symbols not allowed in MH_DYLIB files
+-         case $cc_basename in
+-           xlc*)
+-           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+-           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-           ;;
+-         esac
+-       ;;
+-      dgux*)
+-      case $cc_basename in
+-        ec++*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-          ;;
+-        ghcx*)
+-          # Green Hills C++ Compiler
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      freebsd* | kfreebsd*-gnu | dragonfly*)
+-      # FreeBSD uses GNU C++
+-      ;;
+-      hpux9* | hpux10* | hpux11*)
+-      case $cc_basename in
+-        CC*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+-          if test "$host_cpu" != ia64; then
+-            _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+-          fi
+-          ;;
+-        aCC*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+-          case $host_cpu in
+-          hppa*64*|ia64*)
+-            # +Z the default
+-            ;;
+-          *)
+-            _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+-            ;;
+-          esac
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      interix*)
+-      # This is c89, which is MS Visual C++ (no shared libs)
+-      # Anyone wants to do a port?
+-      ;;
+-      irix5* | irix6* | nonstopux*)
+-      case $cc_basename in
+-        CC*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+-          # CC pic flag -KPIC is the default.
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      linux*)
+-      case $cc_basename in
+-        KCC*)
+-          # KAI C++ Compiler
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+-          ;;
+-        icpc* | ecpc*)
+-          # Intel C++
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+-          ;;
+-        pgCC*)
+-          # Portland Group C++ compiler.
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-          ;;
+-        cxx*)
+-          # Compaq C++
+-          # Make sure the PIC flag is empty.  It appears that all Alpha
+-          # Linux and Compaq Tru64 Unix objects are PIC.
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      lynxos*)
+-      ;;
+-      m88k*)
+-      ;;
+-      mvs*)
+-      case $cc_basename in
+-        cxx*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      netbsd*)
+-      ;;
+-      osf3* | osf4* | osf5*)
+-      case $cc_basename in
+-        KCC*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+-          ;;
+-        RCC*)
+-          # Rational C++ 2.4.1
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+-          ;;
+-        cxx*)
+-          # Digital/Compaq C++
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          # Make sure the PIC flag is empty.  It appears that all Alpha
+-          # Linux and Compaq Tru64 Unix objects are PIC.
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      psos*)
+-      ;;
+-      solaris*)
+-      case $cc_basename in
+-        CC*)
+-          # Sun C++ 4.2, 5.x and Centerline C++
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+-          ;;
+-        gcx*)
+-          # Green Hills C++ Compiler
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      sunos4*)
+-      case $cc_basename in
+-        CC*)
+-          # Sun C++ 4.x
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-          ;;
+-        lcc*)
+-          # Lucid
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      tandem*)
+-      case $cc_basename in
+-        NCC*)
+-          # NonStop-UX NCC 3.20
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-          ;;
+-        *)
+-          ;;
+-      esac
+-      ;;
+-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+-      case $cc_basename in
+-        CC*)
+-          _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-          _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-          _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-          ;;
+-      esac
+-      ;;
+-      vxworks*)
+-      ;;
+-      *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+-      ;;
+-    esac
+-  fi
+-],
+-[
+-  if test "$GCC" = yes; then
+-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+-
+-    case $host_os in
+-      aix*)
+-      # All AIX code is PIC.
+-      if test "$host_cpu" = ia64; then
+-      # AIX 5 now supports IA64 processor
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      fi
+-      ;;
+-
+-    amigaos*)
+-      # FIXME: we need at least 68020 code to build shared libraries, but
+-      # adding the `-m68020' flag to GCC prevents building anything better,
+-      # like `-m68040'.
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+-      ;;
+-
+-    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+-      # PIC is the default for these OSes.
+-      ;;
+-
+-    mingw* | pw32* | os2*)
+-      # This hack is so that the source file can tell whether it is being
+-      # built for inclusion in a dll (and should export symbols for example).
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+-      ;;
+-
+-    darwin* | rhapsody*)
+-      # PIC is the default on this platform
+-      # Common symbols not allowed in MH_DYLIB files
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+-      ;;
+-
+-    interix3*)
+-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+-      # Instead, we relocate shared libraries at runtime.
+-      ;;
+-
+-    msdosdjgpp*)
+-      # Just because we use GCC doesn't mean we suddenly get shared libraries
+-      # on systems that don't support them.
+-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+-      enable_shared=no
+-      ;;
+-
+-    sysv4*MP*)
+-      if test -d /usr/nec; then
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+-      fi
+-      ;;
+-
+-    hpux*)
+-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+-      # not for PA HP-UX.
+-      case $host_cpu in
+-      hppa*64*|ia64*)
+-      # +Z the default
+-      ;;
+-      *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+-      ;;
+-      esac
+-      ;;
+-
+-    *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+-      ;;
+-    esac
+-  else
+-    # PORTME Check for flag to pass linker flags through the system compiler.
+-    case $host_os in
+-    aix*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      if test "$host_cpu" = ia64; then
+-      # AIX 5 now supports IA64 processor
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      else
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+-      fi
+-      ;;
+-      darwin*)
+-        # PIC is the default on this platform
+-        # Common symbols not allowed in MH_DYLIB files
+-       case $cc_basename in
+-         xlc*)
+-         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+-         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-         ;;
+-       esac
+-       ;;
+-
+-    mingw* | pw32* | os2*)
+-      # This hack is so that the source file can tell whether it is being
+-      # built for inclusion in a dll (and should export symbols for example).
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+-      ;;
+-
+-    hpux9* | hpux10* | hpux11*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+-      # not for PA HP-UX.
+-      case $host_cpu in
+-      hppa*64*|ia64*)
+-      # +Z the default
+-      ;;
+-      *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+-      ;;
+-      esac
+-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+-      ;;
+-
+-    irix5* | irix6* | nonstopux*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      # PIC (with -KPIC) is the default.
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+-      ;;
+-
+-    newsos6)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      ;;
+-
+-    linux*)
+-      case $cc_basename in
+-      icc* | ecc*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+-        ;;
+-      pgcc* | pgf77* | pgf90* | pgf95*)
+-        # Portland Group compilers (*not* the Pentium gcc compiler,
+-      # which looks to be a dead project)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-        ;;
+-      ccc*)
+-        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-        # All Alpha code is PIC.
+-        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+-        ;;
+-      esac
+-      ;;
+-
+-    osf3* | osf4* | osf5*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      # All OSF/1 code is PIC.
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+-      ;;
+-
+-    solaris*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      case $cc_basename in
+-      f77* | f90* | f95*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+-      *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+-      esac
+-      ;;
+-
+-    sunos4*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      ;;
+-
+-    sysv4 | sysv4.2uw2* | sysv4.3*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      ;;
+-
+-    sysv4*MP*)
+-      if test -d /usr/nec ;then
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      fi
+-      ;;
+-
+-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      ;;
+-
+-    unicos*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+-      ;;
+-
+-    uts4*)
+-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+-      ;;
+-
+-    *)
+-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+-      ;;
+-    esac
+-  fi
+-])
+-AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+-
+-#
+-# Check to make sure the PIC flag actually works.
+-#
+-if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+-  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+-    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+-    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+-    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+-     "" | " "*) ;;
+-     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+-     esac],
+-    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+-     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+-fi
+-case $host_os in
+-  # For platforms which do not support PIC, -DPIC is meaningless:
+-  *djgpp*)
+-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+-    ;;
+-  *)
+-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+-    ;;
+-esac
+-
+-#
+-# Check to make sure the static flag actually works.
+-#
+-wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+-AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+-  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+-  $lt_tmp_static_flag,
+-  [],
+-  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+-])
+-
+-
+-# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+-# ------------------------------------
+-# See if the linker supports building shared libraries.
+-AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+-[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+-ifelse([$1],[CXX],[
+-  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+-  case $host_os in
+-  aix4* | aix5*)
+-    # If we're using GNU nm, then we don't want the "-C" option.
+-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+-    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+-    else
+-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+-    fi
+-    ;;
+-  pw32*)
+-    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+-  ;;
+-  cygwin* | mingw*)
+-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+-  ;;
+-  *)
+-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+-  ;;
+-  esac
+-],[
+-  runpath_var=
+-  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+-  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+-  _LT_AC_TAGVAR(archive_cmds, $1)=
+-  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+-  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+-  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+-  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+-  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+-  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+-  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+-  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+-  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+-  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+-  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+-  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+-  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+-  _LT_AC_TAGVAR(module_cmds, $1)=
+-  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+-  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+-  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+-  # include_expsyms should be a list of space-separated symbols to be *always*
+-  # included in the symbol list
+-  _LT_AC_TAGVAR(include_expsyms, $1)=
+-  # exclude_expsyms can be an extended regexp of symbols to exclude
+-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+-  # as well as any symbol that contains `d'.
+-  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+-  # platforms (ab)use it in PIC code, but their linkers get confused if
+-  # the symbol is explicitly referenced.  Since portable code cannot
+-  # rely on this symbol name, it's probably fine to never include it in
+-  # preloaded symbol tables.
+-  extract_expsyms_cmds=
+-  # Just being paranoid about ensuring that cc_basename is set.
+-  _LT_CC_BASENAME([$compiler])
+-  case $host_os in
+-  cygwin* | mingw* | pw32*)
+-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+-    # When not using gcc, we currently assume that we are using
+-    # Microsoft Visual C++.
+-    if test "$GCC" != yes; then
+-      with_gnu_ld=no
+-    fi
+-    ;;
+-  interix*)
+-    # we just hope/assume this is gcc and not c89 (= MSVC++)
+-    with_gnu_ld=yes
+-    ;;
+-  openbsd*)
+-    with_gnu_ld=no
+-    ;;
+-  esac
+-
+-  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+-  if test "$with_gnu_ld" = yes; then
+-    # If archive_cmds runs LD, not CC, wlarc should be empty
+-    wlarc='${wl}'
+-
+-    # Set some defaults for GNU ld with shared library support. These
+-    # are reset later if shared libraries are not supported. Putting them
+-    # here allows them to be overridden if necessary.
+-    runpath_var=LD_RUN_PATH
+-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+-    # ancient GNU ld didn't support --whole-archive et. al.
+-    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+-      else
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+-    fi
+-    supports_anon_versioning=no
+-    case `$LD -v 2>/dev/null` in
+-      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+-      *\ 2.11.*) ;; # other 2.11 versions
+-      *) supports_anon_versioning=yes ;;
+-    esac
+-
+-    # See if GNU ld supports shared libraries.
+-    case $host_os in
+-    aix3* | aix4* | aix5*)
+-      # On AIX/PPC, the GNU linker is very broken
+-      if test "$host_cpu" != ia64; then
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      cat <<EOF 1>&2
+-
+-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+-*** to be unable to reliably create shared libraries on AIX.
+-*** Therefore, libtool is disabling shared libraries support.  If you
+-*** really care for shared libraries, you may want to modify your PATH
+-*** so that a non-GNU linker is found, and then restart.
+-
+-EOF
+-      fi
+-      ;;
+-
+-    amigaos*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-
+-      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+-      # that the semantics of dynamic libraries on AmigaOS, at least up
+-      # to version 4, is to share data among multiple programs linked
+-      # with the same dynamic library.  Since this doesn't match the
+-      # behavior of shared libraries on other platforms, we can't use
+-      # them.
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-
+-    beos*)
+-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+-      # support --undefined.  This deserves some investigation.  FIXME
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-      else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-
+-    cygwin* | mingw* | pw32*)
+-      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+-      # as there is no search path for DLLs.
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+-
+-      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+-      # If the export-symbols file already is a .def file (1st line
+-      # is EXPORTS), use it as is; otherwise, prepend...
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+-        cp $export_symbols $output_objdir/$soname.def;
+-      else
+-        echo EXPORTS > $output_objdir/$soname.def;
+-        cat $export_symbols >> $output_objdir/$soname.def;
+-      fi~
+-      $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+-      else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-
+-    interix3*)
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+-      # Instead, shared libraries are loaded at an image base (0x10000000 by
+-      # default) and relocated if they conflict, which is a slow very memory
+-      # consuming and fragmenting process.  To avoid this, we pick a random,
+-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+-      ;;
+-
+-    linux*)
+-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+-      tmp_addflag=
+-      case $cc_basename,$host_cpu in
+-      pgcc*)                          # Portland Group C compiler
+-        _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+-        tmp_addflag=' $pic_flag'
+-        ;;
+-      pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+-        _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+-        tmp_addflag=' $pic_flag -Mnomain' ;;
+-      ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+-        tmp_addflag=' -i_dynamic' ;;
+-      efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+-        tmp_addflag=' -i_dynamic -nofor_main' ;;
+-      ifc* | ifort*)                  # Intel Fortran compiler
+-        tmp_addflag=' -nofor_main' ;;
+-      esac
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-
+-      if test $supports_anon_versioning = yes; then
+-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+-  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+-  $echo "local: *; };" >> $output_objdir/$libname.ver~
+-        $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+-      fi
+-      else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-
+-    netbsd*)
+-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+-      wlarc=
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+-      fi
+-      ;;
+-
+-    solaris*)
+-      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      cat <<EOF 1>&2
+-
+-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+-*** create shared libraries on Solaris systems.  Therefore, libtool
+-*** is disabling shared libraries support.  We urge you to upgrade GNU
+-*** binutils to release 2.9.1 or newer.  Another option is to modify
+-*** your PATH or compiler configuration so that the native linker is
+-*** used, and then restart.
+-
+-EOF
+-      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+-      else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-
+-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+-      case `$LD -v 2>&1` in
+-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      cat <<_LT_EOF 1>&2
+-
+-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+-*** reliably create shared libraries on SCO systems.  Therefore, libtool
+-*** is disabling shared libraries support.  We urge you to upgrade GNU
+-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+-*** your PATH or compiler configuration so that the native linker is
+-*** used, and then restart.
+-
+-_LT_EOF
+-      ;;
+-      *)
+-        if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+-          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+-        else
+-          _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-        fi
+-      ;;
+-      esac
+-      ;;
+-
+-    sunos4*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+-      wlarc=
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    *)
+-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+-      else
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      fi
+-      ;;
+-    esac
+-
+-    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+-      runpath_var=
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+-    fi
+-  else
+-    # PORTME fill in a description of your system's linker (not GNU ld)
+-    case $host_os in
+-    aix3*)
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+-      # Note: this linker hardcodes the directories in LIBPATH if there
+-      # are no directories specified by -L.
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+-      # Neither direct hardcoding nor static linking is supported with a
+-      # broken collect2.
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+-      fi
+-      ;;
+-
+-    aix4* | aix5*)
+-      if test "$host_cpu" = ia64; then
+-      # On IA64, the linker does run time linking by default, so we don't
+-      # have to do anything special.
+-      aix_use_runtimelinking=no
+-      exp_sym_flag='-Bexport'
+-      no_entry_flag=""
+-      else
+-      # If we're using GNU nm, then we don't want the "-C" option.
+-      # -C means demangle to AIX nm, but means don't demangle with GNU nm
+-      if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+-        _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+-      else
+-        _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+-      fi
+-      aix_use_runtimelinking=no
+-
+-      # Test if we are trying to use run time linking or normal
+-      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+-      # need to do runtime linking.
+-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+-        for ld_flag in $LDFLAGS; do
+-        if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+-          aix_use_runtimelinking=yes
+-          break
+-        fi
+-        done
+-        ;;
+-      esac
+-
+-      exp_sym_flag='-bexport'
+-      no_entry_flag='-bnoentry'
+-      fi
+-
+-      # When large executables or shared objects are built, AIX ld can
+-      # have problems creating the table of contents.  If linking a library
+-      # or program results in "error TOC overflow" add -mminimal-toc to
+-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+-
+-      _LT_AC_TAGVAR(archive_cmds, $1)=''
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-
+-      if test "$GCC" = yes; then
+-      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+-      # We only want to do this on AIX 4.2 and lower, the check
+-      # below for broken collect2 doesn't work under 4.3+
+-        collect2name=`${CC} -print-prog-name=collect2`
+-        if test -f "$collect2name" && \
+-         strings "$collect2name" | grep resolve_lib_name >/dev/null
+-        then
+-        # We have reworked collect2
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-        else
+-        # We have old collect2
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+-        # It fails to find uninstalled libraries when the uninstalled
+-        # path is not listed in the libpath.  Setting hardcode_minus_L
+-        # to unsupported forces relinking
+-        _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-        _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+-        fi
+-        ;;
+-      esac
+-      shared_flag='-shared'
+-      if test "$aix_use_runtimelinking" = yes; then
+-        shared_flag="$shared_flag "'${wl}-G'
+-      fi
+-      else
+-      # not using gcc
+-      if test "$host_cpu" = ia64; then
+-      # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+-      # chokes on -Wl,-G. The following line is correct:
+-        shared_flag='-G'
+-      else
+-        if test "$aix_use_runtimelinking" = yes; then
+-          shared_flag='${wl}-G'
+-        else
+-          shared_flag='${wl}-bM:SRE'
+-        fi
+-      fi
+-      fi
+-
+-      # It seems that -bexpall does not export symbols beginning with
+-      # underscore (_), so it is better to generate a list of symbols to export.
+-      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+-      if test "$aix_use_runtimelinking" = yes; then
+-      # Warning - without using the other runtime loading flags (-brtl),
+-      # -berok will link without error, but may produce a broken library.
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+-       # Determine the default libpath from the value encoded in an empty executable.
+-       _LT_AC_SYS_LIBPATH_AIX
+-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+-       else
+-      if test "$host_cpu" = ia64; then
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+-        _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+-      else
+-       # Determine the default libpath from the value encoded in an empty executable.
+-       _LT_AC_SYS_LIBPATH_AIX
+-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+-        # Warning - without using the other run time loading flags,
+-        # -berok will link without error, but may produce a broken library.
+-        _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+-        # Exported symbols can be pulled into shared objects from archives
+-        _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+-        _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+-        # This is similar to how AIX traditionally builds its shared libraries.
+-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+-      fi
+-      fi
+-      ;;
+-
+-    amigaos*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      # see comment about different semantics on the GNU ld section
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-
+-    bsdi[[45]]*)
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+-      ;;
+-
+-    cygwin* | mingw* | pw32*)
+-      # When not using gcc, we currently assume that we are using
+-      # Microsoft Visual C++.
+-      # hardcode_libdir_flag_spec is actually meaningless, as there is
+-      # no search path for DLLs.
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-      # Tell ltmain to make .lib files, not .a files.
+-      libext=lib
+-      # Tell ltmain to make .dll files, not .so files.
+-      shrext_cmds=".dll"
+-      # FIXME: Setting linknames here is a bad hack.
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+-      # The linker will automatically build a .lib file if we build a DLL.
+-      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+-      # FIXME: Should let the user specify the lib program.
+-      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+-      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+-      ;;
+-
+-    darwin* | rhapsody*)
+-      case $host_os in
+-        rhapsody* | darwin1.[[012]])
+-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+-         ;;
+-       *) # Darwin 1.3 on
+-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+-         else
+-           case ${MACOSX_DEPLOYMENT_TARGET} in
+-             10.[[012]])
+-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+-               ;;
+-             10.*)
+-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+-               ;;
+-           esac
+-         fi
+-         ;;
+-      esac
+-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-    if test "$GCC" = yes ; then
+-      output_verbose_link_cmd='echo'
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+-      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-    else
+-      case $cc_basename in
+-        xlc*)
+-         output_verbose_link_cmd='echo'
+-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+-         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+-         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+-          ;;
+-       *)
+-         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-          ;;
+-      esac
+-    fi
+-      ;;
+-
+-    dgux*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    freebsd1*)
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-
+-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+-    # support.  Future versions do this automatically, but an explicit c++rt0.o
+-    # does not break anything, and helps significantly (at the cost of a little
+-    # extra space).
+-    freebsd2.2*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+-    freebsd2*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+-    freebsd* | kfreebsd*-gnu | dragonfly*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    hpux9*)
+-      if test "$GCC" = yes; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-
+-      # hardcode_minus_L: Not really in the search PATH,
+-      # but as the default location of the library.
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-      ;;
+-
+-    hpux10*)
+-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+-      fi
+-      if test "$with_gnu_ld" = no; then
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-
+-      # hardcode_minus_L: Not really in the search PATH,
+-      # but as the default location of the library.
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      fi
+-      ;;
+-
+-    hpux11*)
+-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+-      case $host_cpu in
+-      hppa*64*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-        ;;
+-      ia64*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+-        ;;
+-      *)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+-        ;;
+-      esac
+-      else
+-      case $host_cpu in
+-      hppa*64*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-        ;;
+-      ia64*)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+-        ;;
+-      *)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+-        ;;
+-      esac
+-      fi
+-      if test "$with_gnu_ld" = no; then
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-
+-      case $host_cpu in
+-      hppa*64*|ia64*)
+-        _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-        _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-        ;;
+-      *)
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-        _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-
+-        # hardcode_minus_L: Not really in the search PATH,
+-        # but as the default location of the library.
+-        _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-        ;;
+-      esac
+-      fi
+-      ;;
+-
+-    irix5* | irix6* | nonstopux*)
+-      if test "$GCC" = yes; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-      ;;
+-
+-    netbsd*)
+-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    newsos6)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    openbsd*)
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+-      else
+-       case $host_os in
+-       openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+-         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-         ;;
+-       *)
+-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+-         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+-         ;;
+-       esac
+-      fi
+-      ;;
+-
+-    os2*)
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+-      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+-      ;;
+-
+-    osf3*)
+-      if test "$GCC" = yes; then
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+-      else
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-      ;;
+-
+-    osf4* | osf5*)    # as osf3* with the addition of -msym flag
+-      if test "$GCC" = yes; then
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+-      else
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+-      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+-
+-      # Both c and cxx compiler support -rpath directly
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+-      ;;
+-
+-    solaris*)
+-      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+-      if test "$GCC" = yes; then
+-      wlarc='${wl}'
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+-        $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+-      else
+-      wlarc=''
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+-      $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      case $host_os in
+-      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+-      *)
+-      # The compiler driver will combine linker options so we
+-      # cannot just pass the convience library names through
+-      # without $wl, iff we do not link with $LD.
+-      # Luckily, gcc supports the same syntax we need for Sun Studio.
+-      # Supported since Solaris 2.6 (maybe 2.5.1?)
+-      case $wlarc in
+-      '')
+-        _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+-      *)
+-        _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+-      esac ;;
+-      esac
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-      ;;
+-
+-    sunos4*)
+-      if test "x$host_vendor" = xsequent; then
+-      # Use $CC to link under sequent, because it throws in some extra .o
+-      # files that make .init and .fini sections work.
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+-      fi
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    sysv4)
+-      case $host_vendor in
+-      sni)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+-      ;;
+-      siemens)
+-        ## LD is ld it makes a PLAMLIB
+-        ## CC just makes a GrossModule.
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+-        _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=no
+-        ;;
+-      motorola)
+-        _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-        _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+-      ;;
+-      esac
+-      runpath_var='LD_RUN_PATH'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    sysv4.3*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+-      ;;
+-
+-    sysv4*MP*)
+-      if test -d /usr/nec; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      runpath_var=LD_RUN_PATH
+-      hardcode_runpath_var=yes
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+-      fi
+-      ;;
+-
+-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
+-      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      runpath_var='LD_RUN_PATH'
+-
+-      if test "$GCC" = yes; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      fi
+-      ;;
+-
+-    sysv5* | sco3.2v5* | sco5v6*)
+-      # Note: We can NOT use -z defs as we might desire, because we do not
+-      # link with -lc, and that would cause any symbols used from libc to
+-      # always be unresolved, which means just about no library would
+-      # ever link correctly.  If we're not using GNU ld we use -z text
+-      # though, which does catch some bad symbols but isn't as heavy-handed
+-      # as -z defs.
+-      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+-      runpath_var='LD_RUN_PATH'
+-
+-      if test "$GCC" = yes; then
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      else
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+-      fi
+-      ;;
+-
+-    uts4*)
+-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+-      ;;
+-
+-    *)
+-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+-      ;;
+-    esac
+-  fi
+-])
+-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+-
+-#
+-# Do we need to explicitly link libc?
+-#
+-case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+-x|xyes)
+-  # Assume -lc should be added
+-  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+-
+-  if test "$enable_shared" = yes && test "$GCC" = yes; then
+-    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+-    *'~'*)
+-      # FIXME: we may have to deal with multi-command sequences.
+-      ;;
+-    '$CC '*)
+-      # Test whether the compiler implicitly links with -lc since on some
+-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+-      # to ld, don't add -lc before -lgcc.
+-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+-      $rm conftest*
+-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+-
+-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+-        soname=conftest
+-        lib=conftest
+-        libobjs=conftest.$ac_objext
+-        deplibs=
+-        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+-      pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+-        compiler_flags=-v
+-        linker_flags=-v
+-        verstring=
+-        output_objdir=.
+-        libname=conftest
+-        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+-        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+-        then
+-        _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+-        else
+-        _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+-        fi
+-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+-      else
+-        cat conftest.err 1>&5
+-      fi
+-      $rm conftest*
+-      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+-      ;;
+-    esac
+-  fi
+-  ;;
+-esac
+-])# AC_LIBTOOL_PROG_LD_SHLIBS
+-
+-
+-# _LT_AC_FILE_LTDLL_C
+-# -------------------
+-# Be careful that the start marker always follows a newline.
+-AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+-# /* ltdll.c starts here */
+-# #define WIN32_LEAN_AND_MEAN
+-# #include <windows.h>
+-# #undef WIN32_LEAN_AND_MEAN
+-# #include <stdio.h>
+-#
+-# #ifndef __CYGWIN__
+-# #  ifdef __CYGWIN32__
+-# #    define __CYGWIN__ __CYGWIN32__
+-# #  endif
+-# #endif
+-#
+-# #ifdef __cplusplus
+-# extern "C" {
+-# #endif
+-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+-# #ifdef __cplusplus
+-# }
+-# #endif
+-#
+-# #ifdef __CYGWIN__
+-# #include <cygwin/cygwin_dll.h>
+-# DECLARE_CYGWIN_DLL( DllMain );
+-# #endif
+-# HINSTANCE __hDllInstance_base;
+-#
+-# BOOL APIENTRY
+-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+-# {
+-#   __hDllInstance_base = hInst;
+-#   return TRUE;
+-# }
+-# /* ltdll.c ends here */
+-])# _LT_AC_FILE_LTDLL_C
+-
+-
+-# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+-# ---------------------------------
+-AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+-
+-
+-# old names
+-AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+-AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+-AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+-AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+-AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+-AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+-AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+-
+-# This is just to silence aclocal about the macro not being used
+-ifelse([AC_DISABLE_FAST_INSTALL])
+-
+-AC_DEFUN([LT_AC_PROG_GCJ],
+-[AC_CHECK_TOOL(GCJ, gcj, no)
+-  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+-  AC_SUBST(GCJFLAGS)
+-])
+-
+-AC_DEFUN([LT_AC_PROG_RC],
+-[AC_CHECK_TOOL(RC, windres, no)
+-])
+-
+-############################################################
+-# NOTE: This macro has been submitted for inclusion into   #
+-#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+-#  a released version of Autoconf we should remove this    #
+-#  macro and use it instead.                               #
+-############################################################
+-# LT_AC_PROG_SED
+-# --------------
+-# Check for a fully-functional sed program, that truncates
+-# as few characters as possible.  Prefer GNU sed if found.
+-AC_DEFUN([LT_AC_PROG_SED],
+-[AC_MSG_CHECKING([for a sed that does not truncate output])
+-AC_CACHE_VAL(lt_cv_path_SED,
+-[# Loop through the user's path and test for sed and gsed.
+-# Then use that list of sed's as ones to test for truncation.
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+-  IFS=$as_save_IFS
+-  test -z "$as_dir" && as_dir=.
+-  for lt_ac_prog in sed gsed; do
+-    for ac_exec_ext in '' $ac_executable_extensions; do
+-      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+-      fi
+-    done
+-  done
+-done
+-lt_ac_max=0
+-lt_ac_count=0
+-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+-# along with /bin/sed that truncates output.
+-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+-  test ! -f $lt_ac_sed && continue
+-  cat /dev/null > conftest.in
+-  lt_ac_count=0
+-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+-  # Check for GNU sed and select it if it is found.
+-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+-    lt_cv_path_SED=$lt_ac_sed
+-    break
+-  fi
+-  while true; do
+-    cat conftest.in conftest.in >conftest.tmp
+-    mv conftest.tmp conftest.in
+-    cp conftest.in conftest.nl
+-    echo >>conftest.nl
+-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+-    cmp -s conftest.out conftest.nl || break
+-    # 10000 chars as input seems more than enough
+-    test $lt_ac_count -gt 10 && break
+-    lt_ac_count=`expr $lt_ac_count + 1`
+-    if test $lt_ac_count -gt $lt_ac_max; then
+-      lt_ac_max=$lt_ac_count
+-      lt_cv_path_SED=$lt_ac_sed
+-    fi
+-  done
+-done
+-])
+-SED=$lt_cv_path_SED
+-AC_MSG_RESULT([$SED])
+-])
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -241,19 +241,6 @@ all: rfbconfig.h
+ .SUFFIXES:
+ am--refresh:
+       @:
+-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+-      @for dep in $?; do \
+-        case '$(am__configure_deps)' in \
+-          *$$dep*) \
+-            echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+-            cd $(srcdir) && $(AUTOMAKE) --gnu  \
+-              && exit 0; \
+-            exit 1;; \
+-        esac; \
+-      done; \
+-      echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+-      cd $(top_srcdir) && \
+-        $(AUTOMAKE) --gnu  Makefile
+ .PRECIOUS: Makefile
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
diff --git a/libs/libvncserver/patches/100-noexamples.patch b/libs/libvncserver/patches/100-noexamples.patch
new file mode 100644 (file)
index 0000000..dc7d933
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -228,8 +228,8 @@ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+ with_ffmpeg = @with_ffmpeg@
+ @WITH_X11VNC_TRUE@X11VNC = x11vnc
+-SUBDIRS = libvncserver examples contrib libvncclient vncterm classes client_examples test $(X11VNC)
+-DIST_SUBDIRS = libvncserver examples contrib libvncclient vncterm classes client_examples test
++SUBDIRS = libvncserver
++DIST_SUBDIRS = libvncserver
+ bin_SCRIPTS = libvncserver-config
+ #include_HEADERS=rfb.h rfbconfig.h rfbint.h rfbproto.h keysym.h rfbregion.h
+ include_HEADERS = rfb/rfb.h rfb/rfbconfig.h rfb/rfbint.h rfb/rfbproto.h \
+--- a/configure.ac
++++ b/configure.ac
+@@ -748,14 +748,6 @@ AC_SUBST(RPMSOURCEDIR)
+ AC_CONFIG_FILES([Makefile
+       libvncserver/Makefile
+-      contrib/Makefile
+-      examples/Makefile
+-      vncterm/Makefile
+-      classes/Makefile
+-      classes/ssl/Makefile
+-      libvncclient/Makefile
+-      client_examples/Makefile
+-      test/Makefile
+       libvncserver-config
+       LibVNCServer.spec])
+ #
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -4,8 +4,8 @@ if WITH_X11VNC
+ X11VNC=x11vnc
+ endif
+-SUBDIRS=libvncserver examples contrib libvncclient vncterm classes client_examples test $(X11VNC)
+-DIST_SUBDIRS=libvncserver examples contrib libvncclient vncterm classes client_examples test
++SUBDIRS=libvncserver
++DIST_SUBDIRS=libvncserver
+ bin_SCRIPTS = libvncserver-config
diff --git a/libs/libxapian/Makefile b/libs/libxapian/Makefile
new file mode 100644 (file)
index 0000000..757a60b
--- /dev/null
@@ -0,0 +1,85 @@
+#
+# Copyright (C) 2008-2010 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:=xapian-core
+PKG_VERSION:=1.2.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://oligarchy.co.uk/xapian/$(PKG_VERSION)
+PKG_MD5SUM:=6c9f9e7ac43aa4e086283201329e98ee
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_BUILD_DEPENDS:=util-linux
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libxapian
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=xapian
+  URL:=http://xapian.org
+  DEPENDS:=+libstdcpp +libuuid +zlib
+endef
+
+MAKE_FLAGS += \
+       SUBDIRS=.
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/share/aclocal
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/aclocal/* \
+               $(1)/usr/share/aclocal
+
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/xapian.h \
+               $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/include/xapian
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/xapian/* \
+               $(1)/usr/include/xapian
+
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} \
+               $(1)/usr/lib/
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/xapian-config \
+               $(2)/bin
+       $(SED) 's,prefix=",prefix="$(STAGING_DIR),g' $(2)/bin/xapian-config
+
+       #FIXME: Libtool should handle this
+       if [ -f $(TOOLCHAIN_DIR)/usr/lib/libstdc++.la ]; then \
+         $(SED) \
+               "s,$(STAGING_DIR)/usr/lib/libstdc++,$(TOOLCHAIN_DIR)/usr/lib/libstdc++,g" \
+               $(1)/usr/lib/libxapian.la ; \
+       else \
+         $(SED) \
+               "s,$(STAGING_DIR)/usr/lib/libstdc++,$(TOOLCHAIN_DIR)/lib/libstdc++,g" \
+               $(1)/usr/lib/libxapian.la ; \
+       fi
+endef
+
+define Package/libxapian/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/* \
+               $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,libxapian))
diff --git a/libs/libxapian/patches/001-missing_includes.patch b/libs/libxapian/patches/001-missing_includes.patch
new file mode 100644 (file)
index 0000000..fba4bc0
--- /dev/null
@@ -0,0 +1,50 @@
+--- a/backends/flint/flint_version.cc
++++ b/backends/flint/flint_version.cc
+@@ -20,6 +20,7 @@
+  */
+ #include <config.h>
++#include <stdio.h>
+ #include "safeerrno.h"
+--- a/bin/xapian-progsrv.cc
++++ b/bin/xapian-progsrv.cc
+@@ -19,6 +19,7 @@
+  */
+ #include <config.h>
++#include <stdio.h>
+ #include "remoteserver.h"
+--- a/bin/xapian-tcpsrv.cc
++++ b/bin/xapian-tcpsrv.cc
+@@ -21,6 +21,7 @@
+  */
+ #include <config.h>
++#include <stdio.h>
+ #include <cstdlib>
+--- a/examples/delve.cc
++++ b/examples/delve.cc
+@@ -21,6 +21,7 @@
+  */
+ #include <config.h>
++#include <stdio.h>
+ #include <xapian.h>
+--- a/examples/quest.cc
++++ b/examples/quest.cc
+@@ -19,6 +19,7 @@
+  */
+ #include <config.h>
++#include <stdio.h>
+ #include <xapian.h>
diff --git a/libs/libxapian/patches/002-xapian_config_no_ltlibs.patch b/libs/libxapian/patches/002-xapian_config_no_ltlibs.patch
new file mode 100644 (file)
index 0000000..c5d4dc7
--- /dev/null
@@ -0,0 +1,55 @@
+--- a/m4-macros/xapian.m4
++++ b/m4-macros/xapian.m4
+@@ -52,11 +52,11 @@
+       [$2])
+   else
+     AC_MSG_CHECKING([$XAPIAN_CONFIG works])
+-    dnl check for --ltlibs but not --libs as "xapian-config --libs" will
++    dnl check for --libs but not --libs as "xapian-config --libs" will
+     dnl fail if xapian isn't installed...
+     dnl run with exec to avoid leaking output on "real" bourne shells
+-    if (exec >&5 2>&5 ; $XAPIAN_CONFIG --ltlibs --cxxflags; exit $?) then
++    if (exec >&5 2>&5 ; $XAPIAN_CONFIG --libs --cxxflags; exit $?) then
+       AC_MSG_RESULT(yes)
+     else
+       case $? in
+@@ -70,7 +70,7 @@
+       AC_MSG_ERROR([\`$XAPIAN_CONFIG' not executable, aborting])
+       ;;
+       esac
+-      AC_MSG_ERROR([\`$XAPIAN_CONFIG --ltlibs --cxxflags' doesn't work, aborting])
++      AC_MSG_ERROR([\`$XAPIAN_CONFIG --libs --cxxflags' doesn't work, aborting])
+     fi
+ dnl If LT_INIT, AC_PROG_LIBTOOL or the deprecated older version
+@@ -80,11 +80,11 @@
+     XAPIAN_VERSION=`$XAPIAN_CONFIG --version|sed 's/.* //;s/_svn[[0-9]]*$//'`
+     XAPIAN_CXXFLAGS=`$XAPIAN_CONFIG --cxxflags`
+     AC_PROVIDE_IFELSE([LT_INIT],
+-      [XAPIAN_LIBS=`$XAPIAN_CONFIG --ltlibs`],
++      [XAPIAN_LIBS=`$XAPIAN_CONFIG --libs`],
+       [AC_PROVIDE_IFELSE([AC_PROG_LIBTOOL],
+-      [XAPIAN_LIBS=`$XAPIAN_CONFIG --ltlibs`],
++      [XAPIAN_LIBS=`$XAPIAN_CONFIG --libs`],
+       [AC_PROVIDE_IFELSE([AM_PROG_LIBTOOL],
+-        [XAPIAN_LIBS=`$XAPIAN_CONFIG --ltlibs`],
++        [XAPIAN_LIBS=`$XAPIAN_CONFIG --libs`],
+         dnl Pass magic option so xapian-config knows we called it (so it
+         dnl can choose a more appropriate error message if asked to link
+         dnl with an uninstalled libxapian).  Also pass ac_top_srcdir
+@@ -92,11 +92,11 @@
+         dnl "configure.in" according to which is in use.
+         [XAPIAN_LIBS=`ac_top_srcdir="$ac_top_srcdir" $XAPIAN_CONFIG --from-xo-lib-xapian --libs`
+         define([LT_INIT], defn([LT_INIT])
+-               [XAPIAN_LIBS=`$XAPIAN_CONFIG --ltlibs`])
++               [XAPIAN_LIBS=`$XAPIAN_CONFIG --libs`])
+         define([AC_PROG_LIBTOOL], defn([AC_PROG_LIBTOOL])
+-               [XAPIAN_LIBS=`$XAPIAN_CONFIG --ltlibs`])
++               [XAPIAN_LIBS=`$XAPIAN_CONFIG --libs`])
+         define([AM_PROG_LIBTOOL], defn([AM_PROG_LIBTOOL])
+-               [XAPIAN_LIBS=`$XAPIAN_CONFIG --ltlibs`])])])])
++               [XAPIAN_LIBS=`$XAPIAN_CONFIG --libs`])])])])
+     ifelse([$1], , :, [$1])
+   fi
+   AC_SUBST(XAPIAN_CXXFLAGS)
diff --git a/libs/libyaml/Makefile b/libs/libyaml/Makefile
new file mode 100644 (file)
index 0000000..8f26a6b
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008-2010 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:=yaml
+PKG_VERSION:=0.1.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pyyaml.org/download/libyaml/
+PKG_MD5SUM:=5fe00cda18ca5daeb43762b80c38e06e
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/libyaml
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=libyaml
+  URL:=http://pyyaml.org/wiki/LibYAML
+endef
+
+define Package/libyaml/description
+  yaml library written in c
+endef
+
+define Package/libyaml/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libyaml.so $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libyaml.{a,la} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libyaml))
diff --git a/libs/libzip/Makefile b/libs/libzip/Makefile
new file mode 100644 (file)
index 0000000..e38557e
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2012 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:=libzip
+PKG_VERSION:=0.10.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.nih.at/libzip/
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libzip/default
+  TITLE:=libzip
+  URL:=http://www.nih.at/libzip/
+endef
+
+define Package/libzip
+$(call Package/libzip/default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+zlib
+endef
+
+define Package/libzip-utils
+$(call Package/libzip/default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=compression
+  TITLE+= utilities
+  DEPENDS:=+libzip
+endef
+
+define Package/libzip/description
+ C library for reading, creating, and modifying zip archives
+endef
+
+define Package/libzip-utils/description
+ package contains binaries from libzip library (zipcmp, ziptorrent, zipmerge)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
+
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* \
+               $(PKG_INSTALL_DIR)/usr/lib/libzip/include/* \
+               $(1)/usr/include/
+
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{a,la,so*} \
+               $(1)/usr/lib/
+
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libzip.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libzip/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+endef
+
+define Package/libzip-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libzip))
+$(eval $(call BuildPackage,libzip-utils))
diff --git a/libs/libzstream/Makefile b/libs/libzstream/Makefile
new file mode 100644 (file)
index 0000000..1faaf02
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2012 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:=libzstream
+PKG_VERSION:=2012-06-11
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://dev.freecwmp.org/zstream-clone/
+# PKG_SOURCE_URL:=git://midlink.org/zstream.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=3b9748999aa3d81a5811eff1cc221266a2588e28
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libzstream
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=minimalistic network stream library
+  DEPENDS:=+libubox +libopenssl
+endef
+
+define Package/zstream
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  TITLE:=minimalistic network stream client
+  DEPENDS:=+libzstream
+endef
+
+TARGET_LDFLAGS += \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               WFLAGS="-Wall -Werror"
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/zstream.h $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/include/zstream
+       $(CP) $(PKG_BUILD_DIR)/zstream/http.h $(1)/usr/include/zstream
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/libzstream.so $(1)/usr/lib
+endef
+
+define Package/libzstream/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/libzstream.so $(1)/usr/lib
+endef
+
+define Package/zstream/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/cli/zstream $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,libzstream))
+$(eval $(call BuildPackage,zstream))
diff --git a/libs/loudmouth/Makefile b/libs/loudmouth/Makefile
new file mode 100644 (file)
index 0000000..dfb1da2
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2011-2013 Entware
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libloudmouth1
+PKG_VERSION:=1.5.0-20121201
+PKG_RELEASE:=1
+
+PKG_SOURCE:=loudmouth-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://mcabber.com/files/
+PKG_MD5SUM:=c03025069d376049eee8af4fbaf4d9cf
+PKG_BUILD_DIR:=$(BUILD_DIR)/loudmouth-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DEPENDS:=libopenssl
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/libloudmouth1
+       SECTION:=libs
+       CATEGORY:=Libraries
+       DEPENDS:=+libopenssl +glib2
+       TITLE:=Lightweight C Jabber library
+       URL:=http://mcabber.com
+       MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+endef
+
+define Package/libloudmouth1/description
+  Loudmouth is a lightweight and easy-to-use C library for programming with the
+  Jabber protocol. It's designed to be easy to get started with and yet
+  extensible to let you do anything the Jabber protocol allows.
+endef
+
+CONFIGURE_VARS += \
+       ac_cv_path_KRB5CONFIG=no \
+       LIBS="-liconv -lgobject-2.0"
+
+CONFIGURE_ARGS += \
+       --with-compile-warnings=no \
+       --with-ssl=openssl
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/loudmouth-1.0/loudmouth
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/loudmouth-1.0/loudmouth/*.h $(1)/usr/include/loudmouth-1.0/loudmouth
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libloudmouth-1.{a,la,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/loudmouth-1.0.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libloudmouth1/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/loudmouth/.libs/libloudmouth-1.so* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,libloudmouth1))
diff --git a/libs/lttng-ust/Makefile b/libs/lttng-ust/Makefile
new file mode 100644 (file)
index 0000000..3c5ca05
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2013 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:=lttng-ust
+PKG_VERSION:=2.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)
+PKG_MD5SUM:=2032e66f3438949c51ec9922c6f8542b
+
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lttng-ust
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+liburcu +libuuid +librt
+  TITLE:=LTTng Userspace Tracing Library
+  URL:=https://lttng.org/
+endef
+
+define Package/lttng-ust/description
+   LTTng Userspace Tracing Library
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/lttng* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ust*.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/lttng-ust/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ust*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,lttng-ust))
diff --git a/libs/lttng-ust/patches/001.no_docs_tests.patch b/libs/lttng-ust/patches/001.no_docs_tests.patch
new file mode 100644 (file)
index 0000000..3a58fb9
--- /dev/null
@@ -0,0 +1,35 @@
+diff -urN lttng-ust-2.1.0/Makefile.am lttng-ust-2.1.0.new/Makefile.am
+--- lttng-ust-2.1.0/Makefile.am        2012-12-10 21:29:20.000000000 +0100
++++ lttng-ust-2.1.0.new/Makefile.am    2013-01-14 14:25:41.923661688 +0100
+@@ -5,9 +5,7 @@
+               liblttng-ust-ctl \
+               liblttng-ust-fork \
+               liblttng-ust-libc-wrapper \
+-              tools \
+-              tests \
+-              doc
++              tools
+ if BUILD_JNI_INTERFACE
+ SUBDIRS += liblttng-ust-java
+diff -urN lttng-ust-2.1.0/Makefile.in lttng-ust-2.1.0.new/Makefile.in
+--- lttng-ust-2.1.0/Makefile.in        2012-12-20 19:24:57.000000000 +0100
++++ lttng-ust-2.1.0.new/Makefile.in    2013-01-14 14:25:31.247661789 +0100
+@@ -135,7 +135,7 @@
+ CTAGS = ctags
+ DIST_SUBDIRS = . include snprintf libringbuffer liblttng-ust-comm \
+       liblttng-ust liblttng-ust-ctl liblttng-ust-fork \
+-      liblttng-ust-libc-wrapper tools tests doc liblttng-ust-java
++      liblttng-ust-libc-wrapper tools liblttng-ust-java
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -307,7 +307,7 @@
+ ACLOCAL_AMFLAGS = -I config
+ SUBDIRS = . include snprintf libringbuffer liblttng-ust-comm \
+       liblttng-ust liblttng-ust-ctl liblttng-ust-fork \
+-      liblttng-ust-libc-wrapper tools tests doc $(am__append_1)
++      liblttng-ust-libc-wrapper tools $(am__append_1)
+ #temporarily disabled
+ # liblttng-ust-malloc
diff --git a/libs/matrixssl/Makefile b/libs/matrixssl/Makefile
new file mode 100644 (file)
index 0000000..6099aad
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006 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:=matrixssl
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nbd.vd-s.ath.cx/openwrt
+PKG_MD5SUM:=771c1489488e62668d673478311d63ca
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libmatrixssl
+  SECTION:=libs
+  SUBMENU:=SSL
+  CATEGORY:=Libraries
+  DEPENDS:=+libpthread
+  TITLE:=Embedded SSL implementation
+  URL:=http://www.matrixssl.org/
+endef
+
+define Build/Configure
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/src \
+               $(TARGET_CONFIGURE_OPTS) \
+               DFLAGS="$(TARGET_CFLAGS) -Wall"
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/matrixSsl
+       $(CP) $(PKG_BUILD_DIR)/matrixSsl.h $(1)/usr/include/matrixSsl/
+       ln -sf matrixSsl/matrixSsl.h $(1)/usr/include/matrixSsl.h
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/src/libmatrixssl.so* $(1)/usr/lib/
+endef
+
+define Package/libmatrixssl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/src/libmatrixssl.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libmatrixssl))
diff --git a/libs/matrixssl/patches/100-matrixssl_1.2.4.patch b/libs/matrixssl/patches/100-matrixssl_1.2.4.patch
new file mode 100644 (file)
index 0000000..b4a2bc9
--- /dev/null
@@ -0,0 +1,1971 @@
+diff -urN matrixssl.old/matrixSsl.h matrixssl/matrixSsl.h
+--- matrixssl.old/matrixSsl.h  2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/matrixSsl.h      2005-03-06 01:32:33.000000000 +0100
+@@ -154,6 +154,29 @@
+ #define       SSL_OPTION_DELETE_SESSION               0
++
++#define SSL_MD5_DIGEST_LENGTH 16
++#define SSL_MD5_CONTEXT_DATA_SIZE 96
++
++typedef struct {
++      unsigned char data[SSL_MD5_CONTEXT_DATA_SIZE];
++} sslMd5Context_t;
++
++
++#define SSL_SHA1_DIGEST_LENGTH 20
++#define SSL_SHA1_CONTEXT_DATA_SIZE 96
++
++typedef struct {
++      unsigned char data[SSL_SHA1_CONTEXT_DATA_SIZE];
++} sslSha1Context_t;
++
++
++#define SSL_CIPHER_CONTEXT_DATA_SIZE 784
++
++typedef struct {
++      unsigned char data[SSL_CIPHER_CONTEXT_DATA_SIZE];
++} sslCipherContext_t;
++
+ /******************************************************************************/
+ /*
+       Explicitly import these apis on Windows.  If we're being included from the
+@@ -220,6 +243,71 @@
+                                                               char *privBuf, int32 privLen, char *privPass,
+                                                               char *trustedCABuf, int32 trustedCALen);
++
++/*
++      ARC4 (RC4) API
++*/
++
++SSLPUBLIC void        matrixArc4Init(sslCipherContext_t *ctx, unsigned char *key, 
++                                              int keylen);
++
++SSLPUBLIC int matrixArc4(sslCipherContext_t *ctx, unsigned char *in,
++                                              unsigned char *out, int len);
++
++/*
++      3DES (Triple-DES) API
++*/
++
++SSLPUBLIC int matrix3desInit(sslCipherContext_t *ctx, unsigned char *IV,
++                                              unsigned char *key, int keylen);
++
++SSLPUBLIC int matrix3desEncrypt(sslCipherContext_t *ctx, unsigned char *pt, 
++                                              unsigned char *ct, int len);
++
++SSLPUBLIC int matrix3desDecrypt(sslCipherContext_t *ctx, unsigned char *ct,
++                                              unsigned char *pt, int len);
++
++/*
++      AES API
++*/
++
++SSLPUBLIC int matrixAesInit(sslCipherContext_t *ctx, unsigned char *IV,
++                                              unsigned char *key, int keylen);
++
++SSLPUBLIC int matrixAesEncrypt(sslCipherContext_t *ctx, unsigned char *pt,
++                                              unsigned char *ct, int len);
++
++SSLPUBLIC int matrixAesDecrypt(sslCipherContext_t *ctx, unsigned char *ct,
++                                              unsigned char *pt, int len);
++
++/*
++      MD5 API
++*/
++
++SSLPUBLIC void        matrixMd5Init(sslMd5Context_t *ctx);
++
++SSLPUBLIC void        matrixMd5Update(sslMd5Context_t *ctx, const unsigned char *buf, 
++                                              unsigned long len);
++
++SSLPUBLIC int matrixMd5Final(sslMd5Context_t *ctx, unsigned char *hash);
++
++SSLPUBLIC unsigned char *matrixMd5Digest(const unsigned char *buf, 
++                                              unsigned long len, unsigned char *hash);
++
++/*
++      SHA1 API
++*/
++
++SSLPUBLIC void        matrixSha1Init(sslSha1Context_t *ctx);
++
++SSLPUBLIC void        matrixSha1Update(sslSha1Context_t *ctx, const unsigned char *buf, 
++                                              unsigned long len);
++
++SSLPUBLIC int matrixSha1Final(sslSha1Context_t *ctx, unsigned char *hash);
++
++SSLPUBLIC unsigned char *matrixSha1Digest(const unsigned char *buf, 
++                                              unsigned long len, unsigned char *hash);
++
+ /******************************************************************************/
+ #ifdef __cplusplus
+diff -urN matrixssl.old/src/crypto/cryptoLayer.h matrixssl/src/crypto/cryptoLayer.h
+--- matrixssl.old/src/crypto/cryptoLayer.h     2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/src/crypto/cryptoLayer.h 2005-03-06 01:32:33.000000000 +0100
+@@ -115,6 +115,7 @@
+ */
+ /* #define USE_FULL_CERT_PARSE */
+ /* #define USE_MD2 */
++#define USE_AES
+ /*
+       Now that we've set up the required defines, include the crypto layer header
+diff -urN matrixssl.old/src/crypto/peersec/aes.c matrixssl/src/crypto/peersec/aes.c
+--- matrixssl.old/src/crypto/peersec/aes.c     1970-01-01 01:00:00.000000000 +0100
++++ matrixssl/src/crypto/peersec/aes.c 2005-03-06 01:32:33.000000000 +0100
+@@ -0,0 +1,1708 @@
++/*
++ *    aes.c
++ *
++ *    AES CBC block cipher implementation
++ */
++/*
++ *    Copyright (c) PeerSec Networks, 2002-2004. All Rights Reserved.
++ *    The latest version of this code is available at http://www.matrixssl.org
++ *
++ *    This software is open source; you can redistribute it and/or modify
++ *    it under the terms of the GNU General Public License as published by
++ *    the Free Software Foundation; either version 2 of the License, or
++ *    (at your option) any later version.
++ *
++ *    This General Public License does NOT permit incorporating this software 
++ *    into proprietary programs.  If you are unable to comply with the GPL, a 
++ *    commercial license for this software may be purchased from PeerSec Networks
++ *    at http://www.peersec.com
++ *    
++ *    This program is distributed in 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *    http://www.gnu.org/copyleft/gpl.html
++ */
++/******************************************************************************/
++
++#include "../cryptoLayer.h"
++
++#ifdef USE_AES
++
++/* The precomputed tables for AES */
++/*
++Te0[x] = S [x].[02, 01, 01, 03];
++Te1[x] = S [x].[03, 02, 01, 01];
++Te2[x] = S [x].[01, 03, 02, 01];
++Te3[x] = S [x].[01, 01, 03, 02];
++Te4[x] = S [x].[01, 01, 01, 01];
++
++Td0[x] = Si[x].[0e, 09, 0d, 0b];
++Td1[x] = Si[x].[0b, 0e, 09, 0d];
++Td2[x] = Si[x].[0d, 0b, 0e, 09];
++Td3[x] = Si[x].[09, 0d, 0b, 0e];
++Td4[x] = Si[x].[01, 01, 01, 01];
++*/
++
++static const ulong32 TE0[256] = {
++    0xc66363a5UL, 0xf87c7c84UL, 0xee777799UL, 0xf67b7b8dUL,
++    0xfff2f20dUL, 0xd66b6bbdUL, 0xde6f6fb1UL, 0x91c5c554UL,
++    0x60303050UL, 0x02010103UL, 0xce6767a9UL, 0x562b2b7dUL,
++    0xe7fefe19UL, 0xb5d7d762UL, 0x4dababe6UL, 0xec76769aUL,
++    0x8fcaca45UL, 0x1f82829dUL, 0x89c9c940UL, 0xfa7d7d87UL,
++    0xeffafa15UL, 0xb25959ebUL, 0x8e4747c9UL, 0xfbf0f00bUL,
++    0x41adadecUL, 0xb3d4d467UL, 0x5fa2a2fdUL, 0x45afafeaUL,
++    0x239c9cbfUL, 0x53a4a4f7UL, 0xe4727296UL, 0x9bc0c05bUL,
++    0x75b7b7c2UL, 0xe1fdfd1cUL, 0x3d9393aeUL, 0x4c26266aUL,
++    0x6c36365aUL, 0x7e3f3f41UL, 0xf5f7f702UL, 0x83cccc4fUL,
++    0x6834345cUL, 0x51a5a5f4UL, 0xd1e5e534UL, 0xf9f1f108UL,
++    0xe2717193UL, 0xabd8d873UL, 0x62313153UL, 0x2a15153fUL,
++    0x0804040cUL, 0x95c7c752UL, 0x46232365UL, 0x9dc3c35eUL,
++    0x30181828UL, 0x379696a1UL, 0x0a05050fUL, 0x2f9a9ab5UL,
++    0x0e070709UL, 0x24121236UL, 0x1b80809bUL, 0xdfe2e23dUL,
++    0xcdebeb26UL, 0x4e272769UL, 0x7fb2b2cdUL, 0xea75759fUL,
++    0x1209091bUL, 0x1d83839eUL, 0x582c2c74UL, 0x341a1a2eUL,
++    0x361b1b2dUL, 0xdc6e6eb2UL, 0xb45a5aeeUL, 0x5ba0a0fbUL,
++    0xa45252f6UL, 0x763b3b4dUL, 0xb7d6d661UL, 0x7db3b3ceUL,
++    0x5229297bUL, 0xdde3e33eUL, 0x5e2f2f71UL, 0x13848497UL,
++    0xa65353f5UL, 0xb9d1d168UL, 0x00000000UL, 0xc1eded2cUL,
++    0x40202060UL, 0xe3fcfc1fUL, 0x79b1b1c8UL, 0xb65b5bedUL,
++    0xd46a6abeUL, 0x8dcbcb46UL, 0x67bebed9UL, 0x7239394bUL,
++    0x944a4adeUL, 0x984c4cd4UL, 0xb05858e8UL, 0x85cfcf4aUL,
++    0xbbd0d06bUL, 0xc5efef2aUL, 0x4faaaae5UL, 0xedfbfb16UL,
++    0x864343c5UL, 0x9a4d4dd7UL, 0x66333355UL, 0x11858594UL,
++    0x8a4545cfUL, 0xe9f9f910UL, 0x04020206UL, 0xfe7f7f81UL,
++    0xa05050f0UL, 0x783c3c44UL, 0x259f9fbaUL, 0x4ba8a8e3UL,
++    0xa25151f3UL, 0x5da3a3feUL, 0x804040c0UL, 0x058f8f8aUL,
++    0x3f9292adUL, 0x219d9dbcUL, 0x70383848UL, 0xf1f5f504UL,
++    0x63bcbcdfUL, 0x77b6b6c1UL, 0xafdada75UL, 0x42212163UL,
++    0x20101030UL, 0xe5ffff1aUL, 0xfdf3f30eUL, 0xbfd2d26dUL,
++    0x81cdcd4cUL, 0x180c0c14UL, 0x26131335UL, 0xc3ecec2fUL,
++    0xbe5f5fe1UL, 0x359797a2UL, 0x884444ccUL, 0x2e171739UL,
++    0x93c4c457UL, 0x55a7a7f2UL, 0xfc7e7e82UL, 0x7a3d3d47UL,
++    0xc86464acUL, 0xba5d5de7UL, 0x3219192bUL, 0xe6737395UL,
++    0xc06060a0UL, 0x19818198UL, 0x9e4f4fd1UL, 0xa3dcdc7fUL,
++    0x44222266UL, 0x542a2a7eUL, 0x3b9090abUL, 0x0b888883UL,
++    0x8c4646caUL, 0xc7eeee29UL, 0x6bb8b8d3UL, 0x2814143cUL,
++    0xa7dede79UL, 0xbc5e5ee2UL, 0x160b0b1dUL, 0xaddbdb76UL,
++    0xdbe0e03bUL, 0x64323256UL, 0x743a3a4eUL, 0x140a0a1eUL,
++    0x924949dbUL, 0x0c06060aUL, 0x4824246cUL, 0xb85c5ce4UL,
++    0x9fc2c25dUL, 0xbdd3d36eUL, 0x43acacefUL, 0xc46262a6UL,
++    0x399191a8UL, 0x319595a4UL, 0xd3e4e437UL, 0xf279798bUL,
++    0xd5e7e732UL, 0x8bc8c843UL, 0x6e373759UL, 0xda6d6db7UL,
++    0x018d8d8cUL, 0xb1d5d564UL, 0x9c4e4ed2UL, 0x49a9a9e0UL,
++    0xd86c6cb4UL, 0xac5656faUL, 0xf3f4f407UL, 0xcfeaea25UL,
++    0xca6565afUL, 0xf47a7a8eUL, 0x47aeaee9UL, 0x10080818UL,
++    0x6fbabad5UL, 0xf0787888UL, 0x4a25256fUL, 0x5c2e2e72UL,
++    0x381c1c24UL, 0x57a6a6f1UL, 0x73b4b4c7UL, 0x97c6c651UL,
++    0xcbe8e823UL, 0xa1dddd7cUL, 0xe874749cUL, 0x3e1f1f21UL,
++    0x964b4bddUL, 0x61bdbddcUL, 0x0d8b8b86UL, 0x0f8a8a85UL,
++    0xe0707090UL, 0x7c3e3e42UL, 0x71b5b5c4UL, 0xcc6666aaUL,
++    0x904848d8UL, 0x06030305UL, 0xf7f6f601UL, 0x1c0e0e12UL,
++    0xc26161a3UL, 0x6a35355fUL, 0xae5757f9UL, 0x69b9b9d0UL,
++    0x17868691UL, 0x99c1c158UL, 0x3a1d1d27UL, 0x279e9eb9UL,
++    0xd9e1e138UL, 0xebf8f813UL, 0x2b9898b3UL, 0x22111133UL,
++    0xd26969bbUL, 0xa9d9d970UL, 0x078e8e89UL, 0x339494a7UL,
++    0x2d9b9bb6UL, 0x3c1e1e22UL, 0x15878792UL, 0xc9e9e920UL,
++    0x87cece49UL, 0xaa5555ffUL, 0x50282878UL, 0xa5dfdf7aUL,
++    0x038c8c8fUL, 0x59a1a1f8UL, 0x09898980UL, 0x1a0d0d17UL,
++    0x65bfbfdaUL, 0xd7e6e631UL, 0x844242c6UL, 0xd06868b8UL,
++    0x824141c3UL, 0x299999b0UL, 0x5a2d2d77UL, 0x1e0f0f11UL,
++    0x7bb0b0cbUL, 0xa85454fcUL, 0x6dbbbbd6UL, 0x2c16163aUL,
++};
++
++static const ulong32 Te4[256] = {
++    0x63636363UL, 0x7c7c7c7cUL, 0x77777777UL, 0x7b7b7b7bUL,
++    0xf2f2f2f2UL, 0x6b6b6b6bUL, 0x6f6f6f6fUL, 0xc5c5c5c5UL,
++    0x30303030UL, 0x01010101UL, 0x67676767UL, 0x2b2b2b2bUL,
++    0xfefefefeUL, 0xd7d7d7d7UL, 0xababababUL, 0x76767676UL,
++    0xcacacacaUL, 0x82828282UL, 0xc9c9c9c9UL, 0x7d7d7d7dUL,
++    0xfafafafaUL, 0x59595959UL, 0x47474747UL, 0xf0f0f0f0UL,
++    0xadadadadUL, 0xd4d4d4d4UL, 0xa2a2a2a2UL, 0xafafafafUL,
++    0x9c9c9c9cUL, 0xa4a4a4a4UL, 0x72727272UL, 0xc0c0c0c0UL,
++    0xb7b7b7b7UL, 0xfdfdfdfdUL, 0x93939393UL, 0x26262626UL,
++    0x36363636UL, 0x3f3f3f3fUL, 0xf7f7f7f7UL, 0xccccccccUL,
++    0x34343434UL, 0xa5a5a5a5UL, 0xe5e5e5e5UL, 0xf1f1f1f1UL,
++    0x71717171UL, 0xd8d8d8d8UL, 0x31313131UL, 0x15151515UL,
++    0x04040404UL, 0xc7c7c7c7UL, 0x23232323UL, 0xc3c3c3c3UL,
++    0x18181818UL, 0x96969696UL, 0x05050505UL, 0x9a9a9a9aUL,
++    0x07070707UL, 0x12121212UL, 0x80808080UL, 0xe2e2e2e2UL,
++    0xebebebebUL, 0x27272727UL, 0xb2b2b2b2UL, 0x75757575UL,
++    0x09090909UL, 0x83838383UL, 0x2c2c2c2cUL, 0x1a1a1a1aUL,
++    0x1b1b1b1bUL, 0x6e6e6e6eUL, 0x5a5a5a5aUL, 0xa0a0a0a0UL,
++    0x52525252UL, 0x3b3b3b3bUL, 0xd6d6d6d6UL, 0xb3b3b3b3UL,
++    0x29292929UL, 0xe3e3e3e3UL, 0x2f2f2f2fUL, 0x84848484UL,
++    0x53535353UL, 0xd1d1d1d1UL, 0x00000000UL, 0xededededUL,
++    0x20202020UL, 0xfcfcfcfcUL, 0xb1b1b1b1UL, 0x5b5b5b5bUL,
++    0x6a6a6a6aUL, 0xcbcbcbcbUL, 0xbebebebeUL, 0x39393939UL,
++    0x4a4a4a4aUL, 0x4c4c4c4cUL, 0x58585858UL, 0xcfcfcfcfUL,
++    0xd0d0d0d0UL, 0xefefefefUL, 0xaaaaaaaaUL, 0xfbfbfbfbUL,
++    0x43434343UL, 0x4d4d4d4dUL, 0x33333333UL, 0x85858585UL,
++    0x45454545UL, 0xf9f9f9f9UL, 0x02020202UL, 0x7f7f7f7fUL,
++    0x50505050UL, 0x3c3c3c3cUL, 0x9f9f9f9fUL, 0xa8a8a8a8UL,
++    0x51515151UL, 0xa3a3a3a3UL, 0x40404040UL, 0x8f8f8f8fUL,
++    0x92929292UL, 0x9d9d9d9dUL, 0x38383838UL, 0xf5f5f5f5UL,
++    0xbcbcbcbcUL, 0xb6b6b6b6UL, 0xdadadadaUL, 0x21212121UL,
++    0x10101010UL, 0xffffffffUL, 0xf3f3f3f3UL, 0xd2d2d2d2UL,
++    0xcdcdcdcdUL, 0x0c0c0c0cUL, 0x13131313UL, 0xececececUL,
++    0x5f5f5f5fUL, 0x97979797UL, 0x44444444UL, 0x17171717UL,
++    0xc4c4c4c4UL, 0xa7a7a7a7UL, 0x7e7e7e7eUL, 0x3d3d3d3dUL,
++    0x64646464UL, 0x5d5d5d5dUL, 0x19191919UL, 0x73737373UL,
++    0x60606060UL, 0x81818181UL, 0x4f4f4f4fUL, 0xdcdcdcdcUL,
++    0x22222222UL, 0x2a2a2a2aUL, 0x90909090UL, 0x88888888UL,
++    0x46464646UL, 0xeeeeeeeeUL, 0xb8b8b8b8UL, 0x14141414UL,
++    0xdedededeUL, 0x5e5e5e5eUL, 0x0b0b0b0bUL, 0xdbdbdbdbUL,
++    0xe0e0e0e0UL, 0x32323232UL, 0x3a3a3a3aUL, 0x0a0a0a0aUL,
++    0x49494949UL, 0x06060606UL, 0x24242424UL, 0x5c5c5c5cUL,
++    0xc2c2c2c2UL, 0xd3d3d3d3UL, 0xacacacacUL, 0x62626262UL,
++    0x91919191UL, 0x95959595UL, 0xe4e4e4e4UL, 0x79797979UL,
++    0xe7e7e7e7UL, 0xc8c8c8c8UL, 0x37373737UL, 0x6d6d6d6dUL,
++    0x8d8d8d8dUL, 0xd5d5d5d5UL, 0x4e4e4e4eUL, 0xa9a9a9a9UL,
++    0x6c6c6c6cUL, 0x56565656UL, 0xf4f4f4f4UL, 0xeaeaeaeaUL,
++    0x65656565UL, 0x7a7a7a7aUL, 0xaeaeaeaeUL, 0x08080808UL,
++    0xbabababaUL, 0x78787878UL, 0x25252525UL, 0x2e2e2e2eUL,
++    0x1c1c1c1cUL, 0xa6a6a6a6UL, 0xb4b4b4b4UL, 0xc6c6c6c6UL,
++    0xe8e8e8e8UL, 0xddddddddUL, 0x74747474UL, 0x1f1f1f1fUL,
++    0x4b4b4b4bUL, 0xbdbdbdbdUL, 0x8b8b8b8bUL, 0x8a8a8a8aUL,
++    0x70707070UL, 0x3e3e3e3eUL, 0xb5b5b5b5UL, 0x66666666UL,
++    0x48484848UL, 0x03030303UL, 0xf6f6f6f6UL, 0x0e0e0e0eUL,
++    0x61616161UL, 0x35353535UL, 0x57575757UL, 0xb9b9b9b9UL,
++    0x86868686UL, 0xc1c1c1c1UL, 0x1d1d1d1dUL, 0x9e9e9e9eUL,
++    0xe1e1e1e1UL, 0xf8f8f8f8UL, 0x98989898UL, 0x11111111UL,
++    0x69696969UL, 0xd9d9d9d9UL, 0x8e8e8e8eUL, 0x94949494UL,
++    0x9b9b9b9bUL, 0x1e1e1e1eUL, 0x87878787UL, 0xe9e9e9e9UL,
++    0xcecececeUL, 0x55555555UL, 0x28282828UL, 0xdfdfdfdfUL,
++    0x8c8c8c8cUL, 0xa1a1a1a1UL, 0x89898989UL, 0x0d0d0d0dUL,
++    0xbfbfbfbfUL, 0xe6e6e6e6UL, 0x42424242UL, 0x68686868UL,
++    0x41414141UL, 0x99999999UL, 0x2d2d2d2dUL, 0x0f0f0f0fUL,
++    0xb0b0b0b0UL, 0x54545454UL, 0xbbbbbbbbUL, 0x16161616UL,
++};
++
++static const ulong32 TD0[256] = {
++    0x51f4a750UL, 0x7e416553UL, 0x1a17a4c3UL, 0x3a275e96UL,
++    0x3bab6bcbUL, 0x1f9d45f1UL, 0xacfa58abUL, 0x4be30393UL,
++    0x2030fa55UL, 0xad766df6UL, 0x88cc7691UL, 0xf5024c25UL,
++    0x4fe5d7fcUL, 0xc52acbd7UL, 0x26354480UL, 0xb562a38fUL,
++    0xdeb15a49UL, 0x25ba1b67UL, 0x45ea0e98UL, 0x5dfec0e1UL,
++    0xc32f7502UL, 0x814cf012UL, 0x8d4697a3UL, 0x6bd3f9c6UL,
++    0x038f5fe7UL, 0x15929c95UL, 0xbf6d7aebUL, 0x955259daUL,
++    0xd4be832dUL, 0x587421d3UL, 0x49e06929UL, 0x8ec9c844UL,
++    0x75c2896aUL, 0xf48e7978UL, 0x99583e6bUL, 0x27b971ddUL,
++    0xbee14fb6UL, 0xf088ad17UL, 0xc920ac66UL, 0x7dce3ab4UL,
++    0x63df4a18UL, 0xe51a3182UL, 0x97513360UL, 0x62537f45UL,
++    0xb16477e0UL, 0xbb6bae84UL, 0xfe81a01cUL, 0xf9082b94UL,
++    0x70486858UL, 0x8f45fd19UL, 0x94de6c87UL, 0x527bf8b7UL,
++    0xab73d323UL, 0x724b02e2UL, 0xe31f8f57UL, 0x6655ab2aUL,
++    0xb2eb2807UL, 0x2fb5c203UL, 0x86c57b9aUL, 0xd33708a5UL,
++    0x302887f2UL, 0x23bfa5b2UL, 0x02036abaUL, 0xed16825cUL,
++    0x8acf1c2bUL, 0xa779b492UL, 0xf307f2f0UL, 0x4e69e2a1UL,
++    0x65daf4cdUL, 0x0605bed5UL, 0xd134621fUL, 0xc4a6fe8aUL,
++    0x342e539dUL, 0xa2f355a0UL, 0x058ae132UL, 0xa4f6eb75UL,
++    0x0b83ec39UL, 0x4060efaaUL, 0x5e719f06UL, 0xbd6e1051UL,
++    0x3e218af9UL, 0x96dd063dUL, 0xdd3e05aeUL, 0x4de6bd46UL,
++    0x91548db5UL, 0x71c45d05UL, 0x0406d46fUL, 0x605015ffUL,
++    0x1998fb24UL, 0xd6bde997UL, 0x894043ccUL, 0x67d99e77UL,
++    0xb0e842bdUL, 0x07898b88UL, 0xe7195b38UL, 0x79c8eedbUL,
++    0xa17c0a47UL, 0x7c420fe9UL, 0xf8841ec9UL, 0x00000000UL,
++    0x09808683UL, 0x322bed48UL, 0x1e1170acUL, 0x6c5a724eUL,
++    0xfd0efffbUL, 0x0f853856UL, 0x3daed51eUL, 0x362d3927UL,
++    0x0a0fd964UL, 0x685ca621UL, 0x9b5b54d1UL, 0x24362e3aUL,
++    0x0c0a67b1UL, 0x9357e70fUL, 0xb4ee96d2UL, 0x1b9b919eUL,
++    0x80c0c54fUL, 0x61dc20a2UL, 0x5a774b69UL, 0x1c121a16UL,
++    0xe293ba0aUL, 0xc0a02ae5UL, 0x3c22e043UL, 0x121b171dUL,
++    0x0e090d0bUL, 0xf28bc7adUL, 0x2db6a8b9UL, 0x141ea9c8UL,
++    0x57f11985UL, 0xaf75074cUL, 0xee99ddbbUL, 0xa37f60fdUL,
++    0xf701269fUL, 0x5c72f5bcUL, 0x44663bc5UL, 0x5bfb7e34UL,
++    0x8b432976UL, 0xcb23c6dcUL, 0xb6edfc68UL, 0xb8e4f163UL,
++    0xd731dccaUL, 0x42638510UL, 0x13972240UL, 0x84c61120UL,
++    0x854a247dUL, 0xd2bb3df8UL, 0xaef93211UL, 0xc729a16dUL,
++    0x1d9e2f4bUL, 0xdcb230f3UL, 0x0d8652ecUL, 0x77c1e3d0UL,
++    0x2bb3166cUL, 0xa970b999UL, 0x119448faUL, 0x47e96422UL,
++    0xa8fc8cc4UL, 0xa0f03f1aUL, 0x567d2cd8UL, 0x223390efUL,
++    0x87494ec7UL, 0xd938d1c1UL, 0x8ccaa2feUL, 0x98d40b36UL,
++    0xa6f581cfUL, 0xa57ade28UL, 0xdab78e26UL, 0x3fadbfa4UL,
++    0x2c3a9de4UL, 0x5078920dUL, 0x6a5fcc9bUL, 0x547e4662UL,
++    0xf68d13c2UL, 0x90d8b8e8UL, 0x2e39f75eUL, 0x82c3aff5UL,
++    0x9f5d80beUL, 0x69d0937cUL, 0x6fd52da9UL, 0xcf2512b3UL,
++    0xc8ac993bUL, 0x10187da7UL, 0xe89c636eUL, 0xdb3bbb7bUL,
++    0xcd267809UL, 0x6e5918f4UL, 0xec9ab701UL, 0x834f9aa8UL,
++    0xe6956e65UL, 0xaaffe67eUL, 0x21bccf08UL, 0xef15e8e6UL,
++    0xbae79bd9UL, 0x4a6f36ceUL, 0xea9f09d4UL, 0x29b07cd6UL,
++    0x31a4b2afUL, 0x2a3f2331UL, 0xc6a59430UL, 0x35a266c0UL,
++    0x744ebc37UL, 0xfc82caa6UL, 0xe090d0b0UL, 0x33a7d815UL,
++    0xf104984aUL, 0x41ecdaf7UL, 0x7fcd500eUL, 0x1791f62fUL,
++    0x764dd68dUL, 0x43efb04dUL, 0xccaa4d54UL, 0xe49604dfUL,
++    0x9ed1b5e3UL, 0x4c6a881bUL, 0xc12c1fb8UL, 0x4665517fUL,
++    0x9d5eea04UL, 0x018c355dUL, 0xfa877473UL, 0xfb0b412eUL,
++    0xb3671d5aUL, 0x92dbd252UL, 0xe9105633UL, 0x6dd64713UL,
++    0x9ad7618cUL, 0x37a10c7aUL, 0x59f8148eUL, 0xeb133c89UL,
++    0xcea927eeUL, 0xb761c935UL, 0xe11ce5edUL, 0x7a47b13cUL,
++    0x9cd2df59UL, 0x55f2733fUL, 0x1814ce79UL, 0x73c737bfUL,
++    0x53f7cdeaUL, 0x5ffdaa5bUL, 0xdf3d6f14UL, 0x7844db86UL,
++    0xcaaff381UL, 0xb968c43eUL, 0x3824342cUL, 0xc2a3405fUL,
++    0x161dc372UL, 0xbce2250cUL, 0x283c498bUL, 0xff0d9541UL,
++    0x39a80171UL, 0x080cb3deUL, 0xd8b4e49cUL, 0x6456c190UL,
++    0x7bcb8461UL, 0xd532b670UL, 0x486c5c74UL, 0xd0b85742UL,
++};
++
++static const ulong32 Td4[256] = {
++    0x52525252UL, 0x09090909UL, 0x6a6a6a6aUL, 0xd5d5d5d5UL,
++    0x30303030UL, 0x36363636UL, 0xa5a5a5a5UL, 0x38383838UL,
++    0xbfbfbfbfUL, 0x40404040UL, 0xa3a3a3a3UL, 0x9e9e9e9eUL,
++    0x81818181UL, 0xf3f3f3f3UL, 0xd7d7d7d7UL, 0xfbfbfbfbUL,
++    0x7c7c7c7cUL, 0xe3e3e3e3UL, 0x39393939UL, 0x82828282UL,
++    0x9b9b9b9bUL, 0x2f2f2f2fUL, 0xffffffffUL, 0x87878787UL,
++    0x34343434UL, 0x8e8e8e8eUL, 0x43434343UL, 0x44444444UL,
++    0xc4c4c4c4UL, 0xdedededeUL, 0xe9e9e9e9UL, 0xcbcbcbcbUL,
++    0x54545454UL, 0x7b7b7b7bUL, 0x94949494UL, 0x32323232UL,
++    0xa6a6a6a6UL, 0xc2c2c2c2UL, 0x23232323UL, 0x3d3d3d3dUL,
++    0xeeeeeeeeUL, 0x4c4c4c4cUL, 0x95959595UL, 0x0b0b0b0bUL,
++    0x42424242UL, 0xfafafafaUL, 0xc3c3c3c3UL, 0x4e4e4e4eUL,
++    0x08080808UL, 0x2e2e2e2eUL, 0xa1a1a1a1UL, 0x66666666UL,
++    0x28282828UL, 0xd9d9d9d9UL, 0x24242424UL, 0xb2b2b2b2UL,
++    0x76767676UL, 0x5b5b5b5bUL, 0xa2a2a2a2UL, 0x49494949UL,
++    0x6d6d6d6dUL, 0x8b8b8b8bUL, 0xd1d1d1d1UL, 0x25252525UL,
++    0x72727272UL, 0xf8f8f8f8UL, 0xf6f6f6f6UL, 0x64646464UL,
++    0x86868686UL, 0x68686868UL, 0x98989898UL, 0x16161616UL,
++    0xd4d4d4d4UL, 0xa4a4a4a4UL, 0x5c5c5c5cUL, 0xccccccccUL,
++    0x5d5d5d5dUL, 0x65656565UL, 0xb6b6b6b6UL, 0x92929292UL,
++    0x6c6c6c6cUL, 0x70707070UL, 0x48484848UL, 0x50505050UL,
++    0xfdfdfdfdUL, 0xededededUL, 0xb9b9b9b9UL, 0xdadadadaUL,
++    0x5e5e5e5eUL, 0x15151515UL, 0x46464646UL, 0x57575757UL,
++    0xa7a7a7a7UL, 0x8d8d8d8dUL, 0x9d9d9d9dUL, 0x84848484UL,
++    0x90909090UL, 0xd8d8d8d8UL, 0xababababUL, 0x00000000UL,
++    0x8c8c8c8cUL, 0xbcbcbcbcUL, 0xd3d3d3d3UL, 0x0a0a0a0aUL,
++    0xf7f7f7f7UL, 0xe4e4e4e4UL, 0x58585858UL, 0x05050505UL,
++    0xb8b8b8b8UL, 0xb3b3b3b3UL, 0x45454545UL, 0x06060606UL,
++    0xd0d0d0d0UL, 0x2c2c2c2cUL, 0x1e1e1e1eUL, 0x8f8f8f8fUL,
++    0xcacacacaUL, 0x3f3f3f3fUL, 0x0f0f0f0fUL, 0x02020202UL,
++    0xc1c1c1c1UL, 0xafafafafUL, 0xbdbdbdbdUL, 0x03030303UL,
++    0x01010101UL, 0x13131313UL, 0x8a8a8a8aUL, 0x6b6b6b6bUL,
++    0x3a3a3a3aUL, 0x91919191UL, 0x11111111UL, 0x41414141UL,
++    0x4f4f4f4fUL, 0x67676767UL, 0xdcdcdcdcUL, 0xeaeaeaeaUL,
++    0x97979797UL, 0xf2f2f2f2UL, 0xcfcfcfcfUL, 0xcecececeUL,
++    0xf0f0f0f0UL, 0xb4b4b4b4UL, 0xe6e6e6e6UL, 0x73737373UL,
++    0x96969696UL, 0xacacacacUL, 0x74747474UL, 0x22222222UL,
++    0xe7e7e7e7UL, 0xadadadadUL, 0x35353535UL, 0x85858585UL,
++    0xe2e2e2e2UL, 0xf9f9f9f9UL, 0x37373737UL, 0xe8e8e8e8UL,
++    0x1c1c1c1cUL, 0x75757575UL, 0xdfdfdfdfUL, 0x6e6e6e6eUL,
++    0x47474747UL, 0xf1f1f1f1UL, 0x1a1a1a1aUL, 0x71717171UL,
++    0x1d1d1d1dUL, 0x29292929UL, 0xc5c5c5c5UL, 0x89898989UL,
++    0x6f6f6f6fUL, 0xb7b7b7b7UL, 0x62626262UL, 0x0e0e0e0eUL,
++    0xaaaaaaaaUL, 0x18181818UL, 0xbebebebeUL, 0x1b1b1b1bUL,
++    0xfcfcfcfcUL, 0x56565656UL, 0x3e3e3e3eUL, 0x4b4b4b4bUL,
++    0xc6c6c6c6UL, 0xd2d2d2d2UL, 0x79797979UL, 0x20202020UL,
++    0x9a9a9a9aUL, 0xdbdbdbdbUL, 0xc0c0c0c0UL, 0xfefefefeUL,
++    0x78787878UL, 0xcdcdcdcdUL, 0x5a5a5a5aUL, 0xf4f4f4f4UL,
++    0x1f1f1f1fUL, 0xddddddddUL, 0xa8a8a8a8UL, 0x33333333UL,
++    0x88888888UL, 0x07070707UL, 0xc7c7c7c7UL, 0x31313131UL,
++    0xb1b1b1b1UL, 0x12121212UL, 0x10101010UL, 0x59595959UL,
++    0x27272727UL, 0x80808080UL, 0xececececUL, 0x5f5f5f5fUL,
++    0x60606060UL, 0x51515151UL, 0x7f7f7f7fUL, 0xa9a9a9a9UL,
++    0x19191919UL, 0xb5b5b5b5UL, 0x4a4a4a4aUL, 0x0d0d0d0dUL,
++    0x2d2d2d2dUL, 0xe5e5e5e5UL, 0x7a7a7a7aUL, 0x9f9f9f9fUL,
++    0x93939393UL, 0xc9c9c9c9UL, 0x9c9c9c9cUL, 0xefefefefUL,
++    0xa0a0a0a0UL, 0xe0e0e0e0UL, 0x3b3b3b3bUL, 0x4d4d4d4dUL,
++    0xaeaeaeaeUL, 0x2a2a2a2aUL, 0xf5f5f5f5UL, 0xb0b0b0b0UL,
++    0xc8c8c8c8UL, 0xebebebebUL, 0xbbbbbbbbUL, 0x3c3c3c3cUL,
++    0x83838383UL, 0x53535353UL, 0x99999999UL, 0x61616161UL,
++    0x17171717UL, 0x2b2b2b2bUL, 0x04040404UL, 0x7e7e7e7eUL,
++    0xbabababaUL, 0x77777777UL, 0xd6d6d6d6UL, 0x26262626UL,
++    0xe1e1e1e1UL, 0x69696969UL, 0x14141414UL, 0x63636363UL,
++    0x55555555UL, 0x21212121UL, 0x0c0c0c0cUL, 0x7d7d7d7dUL,
++};
++
++#ifdef SMALL_CODE
++
++#define Te0(x) TE0[x]
++#define Te1(x) ROR(TE0[x], 8)
++#define Te2(x) ROR(TE0[x], 16)
++#define Te3(x) ROR(TE0[x], 24)
++
++#define Td0(x) TD0[x]
++#define Td1(x) ROR(TD0[x], 8)
++#define Td2(x) ROR(TD0[x], 16)
++#define Td3(x) ROR(TD0[x], 24)
++
++#define Te4_0 0x000000FF & Te4
++#define Te4_1 0x0000FF00 & Te4
++#define Te4_2 0x00FF0000 & Te4
++#define Te4_3 0xFF000000 & Te4
++
++#else /* SMALL_CODE */
++
++#define Te0(x) TE0[x]
++#define Te1(x) TE1[x]
++#define Te2(x) TE2[x]
++#define Te3(x) TE3[x]
++
++#define Td0(x) TD0[x]
++#define Td1(x) TD1[x]
++#define Td2(x) TD2[x]
++#define Td3(x) TD3[x]
++
++static const ulong32 TE1[256] = {
++    0xa5c66363UL, 0x84f87c7cUL, 0x99ee7777UL, 0x8df67b7bUL,
++    0x0dfff2f2UL, 0xbdd66b6bUL, 0xb1de6f6fUL, 0x5491c5c5UL,
++    0x50603030UL, 0x03020101UL, 0xa9ce6767UL, 0x7d562b2bUL,
++    0x19e7fefeUL, 0x62b5d7d7UL, 0xe64dababUL, 0x9aec7676UL,
++    0x458fcacaUL, 0x9d1f8282UL, 0x4089c9c9UL, 0x87fa7d7dUL,
++    0x15effafaUL, 0xebb25959UL, 0xc98e4747UL, 0x0bfbf0f0UL,
++    0xec41adadUL, 0x67b3d4d4UL, 0xfd5fa2a2UL, 0xea45afafUL,
++    0xbf239c9cUL, 0xf753a4a4UL, 0x96e47272UL, 0x5b9bc0c0UL,
++    0xc275b7b7UL, 0x1ce1fdfdUL, 0xae3d9393UL, 0x6a4c2626UL,
++    0x5a6c3636UL, 0x417e3f3fUL, 0x02f5f7f7UL, 0x4f83ccccUL,
++    0x5c683434UL, 0xf451a5a5UL, 0x34d1e5e5UL, 0x08f9f1f1UL,
++    0x93e27171UL, 0x73abd8d8UL, 0x53623131UL, 0x3f2a1515UL,
++    0x0c080404UL, 0x5295c7c7UL, 0x65462323UL, 0x5e9dc3c3UL,
++    0x28301818UL, 0xa1379696UL, 0x0f0a0505UL, 0xb52f9a9aUL,
++    0x090e0707UL, 0x36241212UL, 0x9b1b8080UL, 0x3ddfe2e2UL,
++    0x26cdebebUL, 0x694e2727UL, 0xcd7fb2b2UL, 0x9fea7575UL,
++    0x1b120909UL, 0x9e1d8383UL, 0x74582c2cUL, 0x2e341a1aUL,
++    0x2d361b1bUL, 0xb2dc6e6eUL, 0xeeb45a5aUL, 0xfb5ba0a0UL,
++    0xf6a45252UL, 0x4d763b3bUL, 0x61b7d6d6UL, 0xce7db3b3UL,
++    0x7b522929UL, 0x3edde3e3UL, 0x715e2f2fUL, 0x97138484UL,
++    0xf5a65353UL, 0x68b9d1d1UL, 0x00000000UL, 0x2cc1ededUL,
++    0x60402020UL, 0x1fe3fcfcUL, 0xc879b1b1UL, 0xedb65b5bUL,
++    0xbed46a6aUL, 0x468dcbcbUL, 0xd967bebeUL, 0x4b723939UL,
++    0xde944a4aUL, 0xd4984c4cUL, 0xe8b05858UL, 0x4a85cfcfUL,
++    0x6bbbd0d0UL, 0x2ac5efefUL, 0xe54faaaaUL, 0x16edfbfbUL,
++    0xc5864343UL, 0xd79a4d4dUL, 0x55663333UL, 0x94118585UL,
++    0xcf8a4545UL, 0x10e9f9f9UL, 0x06040202UL, 0x81fe7f7fUL,
++    0xf0a05050UL, 0x44783c3cUL, 0xba259f9fUL, 0xe34ba8a8UL,
++    0xf3a25151UL, 0xfe5da3a3UL, 0xc0804040UL, 0x8a058f8fUL,
++    0xad3f9292UL, 0xbc219d9dUL, 0x48703838UL, 0x04f1f5f5UL,
++    0xdf63bcbcUL, 0xc177b6b6UL, 0x75afdadaUL, 0x63422121UL,
++    0x30201010UL, 0x1ae5ffffUL, 0x0efdf3f3UL, 0x6dbfd2d2UL,
++    0x4c81cdcdUL, 0x14180c0cUL, 0x35261313UL, 0x2fc3ececUL,
++    0xe1be5f5fUL, 0xa2359797UL, 0xcc884444UL, 0x392e1717UL,
++    0x5793c4c4UL, 0xf255a7a7UL, 0x82fc7e7eUL, 0x477a3d3dUL,
++    0xacc86464UL, 0xe7ba5d5dUL, 0x2b321919UL, 0x95e67373UL,
++    0xa0c06060UL, 0x98198181UL, 0xd19e4f4fUL, 0x7fa3dcdcUL,
++    0x66442222UL, 0x7e542a2aUL, 0xab3b9090UL, 0x830b8888UL,
++    0xca8c4646UL, 0x29c7eeeeUL, 0xd36bb8b8UL, 0x3c281414UL,
++    0x79a7dedeUL, 0xe2bc5e5eUL, 0x1d160b0bUL, 0x76addbdbUL,
++    0x3bdbe0e0UL, 0x56643232UL, 0x4e743a3aUL, 0x1e140a0aUL,
++    0xdb924949UL, 0x0a0c0606UL, 0x6c482424UL, 0xe4b85c5cUL,
++    0x5d9fc2c2UL, 0x6ebdd3d3UL, 0xef43acacUL, 0xa6c46262UL,
++    0xa8399191UL, 0xa4319595UL, 0x37d3e4e4UL, 0x8bf27979UL,
++    0x32d5e7e7UL, 0x438bc8c8UL, 0x596e3737UL, 0xb7da6d6dUL,
++    0x8c018d8dUL, 0x64b1d5d5UL, 0xd29c4e4eUL, 0xe049a9a9UL,
++    0xb4d86c6cUL, 0xfaac5656UL, 0x07f3f4f4UL, 0x25cfeaeaUL,
++    0xafca6565UL, 0x8ef47a7aUL, 0xe947aeaeUL, 0x18100808UL,
++    0xd56fbabaUL, 0x88f07878UL, 0x6f4a2525UL, 0x725c2e2eUL,
++    0x24381c1cUL, 0xf157a6a6UL, 0xc773b4b4UL, 0x5197c6c6UL,
++    0x23cbe8e8UL, 0x7ca1ddddUL, 0x9ce87474UL, 0x213e1f1fUL,
++    0xdd964b4bUL, 0xdc61bdbdUL, 0x860d8b8bUL, 0x850f8a8aUL,
++    0x90e07070UL, 0x427c3e3eUL, 0xc471b5b5UL, 0xaacc6666UL,
++    0xd8904848UL, 0x05060303UL, 0x01f7f6f6UL, 0x121c0e0eUL,
++    0xa3c26161UL, 0x5f6a3535UL, 0xf9ae5757UL, 0xd069b9b9UL,
++    0x91178686UL, 0x5899c1c1UL, 0x273a1d1dUL, 0xb9279e9eUL,
++    0x38d9e1e1UL, 0x13ebf8f8UL, 0xb32b9898UL, 0x33221111UL,
++    0xbbd26969UL, 0x70a9d9d9UL, 0x89078e8eUL, 0xa7339494UL,
++    0xb62d9b9bUL, 0x223c1e1eUL, 0x92158787UL, 0x20c9e9e9UL,
++    0x4987ceceUL, 0xffaa5555UL, 0x78502828UL, 0x7aa5dfdfUL,
++    0x8f038c8cUL, 0xf859a1a1UL, 0x80098989UL, 0x171a0d0dUL,
++    0xda65bfbfUL, 0x31d7e6e6UL, 0xc6844242UL, 0xb8d06868UL,
++    0xc3824141UL, 0xb0299999UL, 0x775a2d2dUL, 0x111e0f0fUL,
++    0xcb7bb0b0UL, 0xfca85454UL, 0xd66dbbbbUL, 0x3a2c1616UL,
++};
++static const ulong32 TE2[256] = {
++    0x63a5c663UL, 0x7c84f87cUL, 0x7799ee77UL, 0x7b8df67bUL,
++    0xf20dfff2UL, 0x6bbdd66bUL, 0x6fb1de6fUL, 0xc55491c5UL,
++    0x30506030UL, 0x01030201UL, 0x67a9ce67UL, 0x2b7d562bUL,
++    0xfe19e7feUL, 0xd762b5d7UL, 0xabe64dabUL, 0x769aec76UL,
++    0xca458fcaUL, 0x829d1f82UL, 0xc94089c9UL, 0x7d87fa7dUL,
++    0xfa15effaUL, 0x59ebb259UL, 0x47c98e47UL, 0xf00bfbf0UL,
++    0xadec41adUL, 0xd467b3d4UL, 0xa2fd5fa2UL, 0xafea45afUL,
++    0x9cbf239cUL, 0xa4f753a4UL, 0x7296e472UL, 0xc05b9bc0UL,
++    0xb7c275b7UL, 0xfd1ce1fdUL, 0x93ae3d93UL, 0x266a4c26UL,
++    0x365a6c36UL, 0x3f417e3fUL, 0xf702f5f7UL, 0xcc4f83ccUL,
++    0x345c6834UL, 0xa5f451a5UL, 0xe534d1e5UL, 0xf108f9f1UL,
++    0x7193e271UL, 0xd873abd8UL, 0x31536231UL, 0x153f2a15UL,
++    0x040c0804UL, 0xc75295c7UL, 0x23654623UL, 0xc35e9dc3UL,
++    0x18283018UL, 0x96a13796UL, 0x050f0a05UL, 0x9ab52f9aUL,
++    0x07090e07UL, 0x12362412UL, 0x809b1b80UL, 0xe23ddfe2UL,
++    0xeb26cdebUL, 0x27694e27UL, 0xb2cd7fb2UL, 0x759fea75UL,
++    0x091b1209UL, 0x839e1d83UL, 0x2c74582cUL, 0x1a2e341aUL,
++    0x1b2d361bUL, 0x6eb2dc6eUL, 0x5aeeb45aUL, 0xa0fb5ba0UL,
++    0x52f6a452UL, 0x3b4d763bUL, 0xd661b7d6UL, 0xb3ce7db3UL,
++    0x297b5229UL, 0xe33edde3UL, 0x2f715e2fUL, 0x84971384UL,
++    0x53f5a653UL, 0xd168b9d1UL, 0x00000000UL, 0xed2cc1edUL,
++    0x20604020UL, 0xfc1fe3fcUL, 0xb1c879b1UL, 0x5bedb65bUL,
++    0x6abed46aUL, 0xcb468dcbUL, 0xbed967beUL, 0x394b7239UL,
++    0x4ade944aUL, 0x4cd4984cUL, 0x58e8b058UL, 0xcf4a85cfUL,
++    0xd06bbbd0UL, 0xef2ac5efUL, 0xaae54faaUL, 0xfb16edfbUL,
++    0x43c58643UL, 0x4dd79a4dUL, 0x33556633UL, 0x85941185UL,
++    0x45cf8a45UL, 0xf910e9f9UL, 0x02060402UL, 0x7f81fe7fUL,
++    0x50f0a050UL, 0x3c44783cUL, 0x9fba259fUL, 0xa8e34ba8UL,
++    0x51f3a251UL, 0xa3fe5da3UL, 0x40c08040UL, 0x8f8a058fUL,
++    0x92ad3f92UL, 0x9dbc219dUL, 0x38487038UL, 0xf504f1f5UL,
++    0xbcdf63bcUL, 0xb6c177b6UL, 0xda75afdaUL, 0x21634221UL,
++    0x10302010UL, 0xff1ae5ffUL, 0xf30efdf3UL, 0xd26dbfd2UL,
++    0xcd4c81cdUL, 0x0c14180cUL, 0x13352613UL, 0xec2fc3ecUL,
++    0x5fe1be5fUL, 0x97a23597UL, 0x44cc8844UL, 0x17392e17UL,
++    0xc45793c4UL, 0xa7f255a7UL, 0x7e82fc7eUL, 0x3d477a3dUL,
++    0x64acc864UL, 0x5de7ba5dUL, 0x192b3219UL, 0x7395e673UL,
++    0x60a0c060UL, 0x81981981UL, 0x4fd19e4fUL, 0xdc7fa3dcUL,
++    0x22664422UL, 0x2a7e542aUL, 0x90ab3b90UL, 0x88830b88UL,
++    0x46ca8c46UL, 0xee29c7eeUL, 0xb8d36bb8UL, 0x143c2814UL,
++    0xde79a7deUL, 0x5ee2bc5eUL, 0x0b1d160bUL, 0xdb76addbUL,
++    0xe03bdbe0UL, 0x32566432UL, 0x3a4e743aUL, 0x0a1e140aUL,
++    0x49db9249UL, 0x060a0c06UL, 0x246c4824UL, 0x5ce4b85cUL,
++    0xc25d9fc2UL, 0xd36ebdd3UL, 0xacef43acUL, 0x62a6c462UL,
++    0x91a83991UL, 0x95a43195UL, 0xe437d3e4UL, 0x798bf279UL,
++    0xe732d5e7UL, 0xc8438bc8UL, 0x37596e37UL, 0x6db7da6dUL,
++    0x8d8c018dUL, 0xd564b1d5UL, 0x4ed29c4eUL, 0xa9e049a9UL,
++    0x6cb4d86cUL, 0x56faac56UL, 0xf407f3f4UL, 0xea25cfeaUL,
++    0x65afca65UL, 0x7a8ef47aUL, 0xaee947aeUL, 0x08181008UL,
++    0xbad56fbaUL, 0x7888f078UL, 0x256f4a25UL, 0x2e725c2eUL,
++    0x1c24381cUL, 0xa6f157a6UL, 0xb4c773b4UL, 0xc65197c6UL,
++    0xe823cbe8UL, 0xdd7ca1ddUL, 0x749ce874UL, 0x1f213e1fUL,
++    0x4bdd964bUL, 0xbddc61bdUL, 0x8b860d8bUL, 0x8a850f8aUL,
++    0x7090e070UL, 0x3e427c3eUL, 0xb5c471b5UL, 0x66aacc66UL,
++    0x48d89048UL, 0x03050603UL, 0xf601f7f6UL, 0x0e121c0eUL,
++    0x61a3c261UL, 0x355f6a35UL, 0x57f9ae57UL, 0xb9d069b9UL,
++    0x86911786UL, 0xc15899c1UL, 0x1d273a1dUL, 0x9eb9279eUL,
++    0xe138d9e1UL, 0xf813ebf8UL, 0x98b32b98UL, 0x11332211UL,
++    0x69bbd269UL, 0xd970a9d9UL, 0x8e89078eUL, 0x94a73394UL,
++    0x9bb62d9bUL, 0x1e223c1eUL, 0x87921587UL, 0xe920c9e9UL,
++    0xce4987ceUL, 0x55ffaa55UL, 0x28785028UL, 0xdf7aa5dfUL,
++    0x8c8f038cUL, 0xa1f859a1UL, 0x89800989UL, 0x0d171a0dUL,
++    0xbfda65bfUL, 0xe631d7e6UL, 0x42c68442UL, 0x68b8d068UL,
++    0x41c38241UL, 0x99b02999UL, 0x2d775a2dUL, 0x0f111e0fUL,
++    0xb0cb7bb0UL, 0x54fca854UL, 0xbbd66dbbUL, 0x163a2c16UL,
++};
++static const ulong32 TE3[256] = {
++
++    0x6363a5c6UL, 0x7c7c84f8UL, 0x777799eeUL, 0x7b7b8df6UL,
++    0xf2f20dffUL, 0x6b6bbdd6UL, 0x6f6fb1deUL, 0xc5c55491UL,
++    0x30305060UL, 0x01010302UL, 0x6767a9ceUL, 0x2b2b7d56UL,
++    0xfefe19e7UL, 0xd7d762b5UL, 0xababe64dUL, 0x76769aecUL,
++    0xcaca458fUL, 0x82829d1fUL, 0xc9c94089UL, 0x7d7d87faUL,
++    0xfafa15efUL, 0x5959ebb2UL, 0x4747c98eUL, 0xf0f00bfbUL,
++    0xadadec41UL, 0xd4d467b3UL, 0xa2a2fd5fUL, 0xafafea45UL,
++    0x9c9cbf23UL, 0xa4a4f753UL, 0x727296e4UL, 0xc0c05b9bUL,
++    0xb7b7c275UL, 0xfdfd1ce1UL, 0x9393ae3dUL, 0x26266a4cUL,
++    0x36365a6cUL, 0x3f3f417eUL, 0xf7f702f5UL, 0xcccc4f83UL,
++    0x34345c68UL, 0xa5a5f451UL, 0xe5e534d1UL, 0xf1f108f9UL,
++    0x717193e2UL, 0xd8d873abUL, 0x31315362UL, 0x15153f2aUL,
++    0x04040c08UL, 0xc7c75295UL, 0x23236546UL, 0xc3c35e9dUL,
++    0x18182830UL, 0x9696a137UL, 0x05050f0aUL, 0x9a9ab52fUL,
++    0x0707090eUL, 0x12123624UL, 0x80809b1bUL, 0xe2e23ddfUL,
++    0xebeb26cdUL, 0x2727694eUL, 0xb2b2cd7fUL, 0x75759feaUL,
++    0x09091b12UL, 0x83839e1dUL, 0x2c2c7458UL, 0x1a1a2e34UL,
++    0x1b1b2d36UL, 0x6e6eb2dcUL, 0x5a5aeeb4UL, 0xa0a0fb5bUL,
++    0x5252f6a4UL, 0x3b3b4d76UL, 0xd6d661b7UL, 0xb3b3ce7dUL,
++    0x29297b52UL, 0xe3e33eddUL, 0x2f2f715eUL, 0x84849713UL,
++    0x5353f5a6UL, 0xd1d168b9UL, 0x00000000UL, 0xeded2cc1UL,
++    0x20206040UL, 0xfcfc1fe3UL, 0xb1b1c879UL, 0x5b5bedb6UL,
++    0x6a6abed4UL, 0xcbcb468dUL, 0xbebed967UL, 0x39394b72UL,
++    0x4a4ade94UL, 0x4c4cd498UL, 0x5858e8b0UL, 0xcfcf4a85UL,
++    0xd0d06bbbUL, 0xefef2ac5UL, 0xaaaae54fUL, 0xfbfb16edUL,
++    0x4343c586UL, 0x4d4dd79aUL, 0x33335566UL, 0x85859411UL,
++    0x4545cf8aUL, 0xf9f910e9UL, 0x02020604UL, 0x7f7f81feUL,
++    0x5050f0a0UL, 0x3c3c4478UL, 0x9f9fba25UL, 0xa8a8e34bUL,
++    0x5151f3a2UL, 0xa3a3fe5dUL, 0x4040c080UL, 0x8f8f8a05UL,
++    0x9292ad3fUL, 0x9d9dbc21UL, 0x38384870UL, 0xf5f504f1UL,
++    0xbcbcdf63UL, 0xb6b6c177UL, 0xdada75afUL, 0x21216342UL,
++    0x10103020UL, 0xffff1ae5UL, 0xf3f30efdUL, 0xd2d26dbfUL,
++    0xcdcd4c81UL, 0x0c0c1418UL, 0x13133526UL, 0xecec2fc3UL,
++    0x5f5fe1beUL, 0x9797a235UL, 0x4444cc88UL, 0x1717392eUL,
++    0xc4c45793UL, 0xa7a7f255UL, 0x7e7e82fcUL, 0x3d3d477aUL,
++    0x6464acc8UL, 0x5d5de7baUL, 0x19192b32UL, 0x737395e6UL,
++    0x6060a0c0UL, 0x81819819UL, 0x4f4fd19eUL, 0xdcdc7fa3UL,
++    0x22226644UL, 0x2a2a7e54UL, 0x9090ab3bUL, 0x8888830bUL,
++    0x4646ca8cUL, 0xeeee29c7UL, 0xb8b8d36bUL, 0x14143c28UL,
++    0xdede79a7UL, 0x5e5ee2bcUL, 0x0b0b1d16UL, 0xdbdb76adUL,
++    0xe0e03bdbUL, 0x32325664UL, 0x3a3a4e74UL, 0x0a0a1e14UL,
++    0x4949db92UL, 0x06060a0cUL, 0x24246c48UL, 0x5c5ce4b8UL,
++    0xc2c25d9fUL, 0xd3d36ebdUL, 0xacacef43UL, 0x6262a6c4UL,
++    0x9191a839UL, 0x9595a431UL, 0xe4e437d3UL, 0x79798bf2UL,
++    0xe7e732d5UL, 0xc8c8438bUL, 0x3737596eUL, 0x6d6db7daUL,
++    0x8d8d8c01UL, 0xd5d564b1UL, 0x4e4ed29cUL, 0xa9a9e049UL,
++    0x6c6cb4d8UL, 0x5656faacUL, 0xf4f407f3UL, 0xeaea25cfUL,
++    0x6565afcaUL, 0x7a7a8ef4UL, 0xaeaee947UL, 0x08081810UL,
++    0xbabad56fUL, 0x787888f0UL, 0x25256f4aUL, 0x2e2e725cUL,
++    0x1c1c2438UL, 0xa6a6f157UL, 0xb4b4c773UL, 0xc6c65197UL,
++    0xe8e823cbUL, 0xdddd7ca1UL, 0x74749ce8UL, 0x1f1f213eUL,
++    0x4b4bdd96UL, 0xbdbddc61UL, 0x8b8b860dUL, 0x8a8a850fUL,
++    0x707090e0UL, 0x3e3e427cUL, 0xb5b5c471UL, 0x6666aaccUL,
++    0x4848d890UL, 0x03030506UL, 0xf6f601f7UL, 0x0e0e121cUL,
++    0x6161a3c2UL, 0x35355f6aUL, 0x5757f9aeUL, 0xb9b9d069UL,
++    0x86869117UL, 0xc1c15899UL, 0x1d1d273aUL, 0x9e9eb927UL,
++    0xe1e138d9UL, 0xf8f813ebUL, 0x9898b32bUL, 0x11113322UL,
++    0x6969bbd2UL, 0xd9d970a9UL, 0x8e8e8907UL, 0x9494a733UL,
++    0x9b9bb62dUL, 0x1e1e223cUL, 0x87879215UL, 0xe9e920c9UL,
++    0xcece4987UL, 0x5555ffaaUL, 0x28287850UL, 0xdfdf7aa5UL,
++    0x8c8c8f03UL, 0xa1a1f859UL, 0x89898009UL, 0x0d0d171aUL,
++    0xbfbfda65UL, 0xe6e631d7UL, 0x4242c684UL, 0x6868b8d0UL,
++    0x4141c382UL, 0x9999b029UL, 0x2d2d775aUL, 0x0f0f111eUL,
++    0xb0b0cb7bUL, 0x5454fca8UL, 0xbbbbd66dUL, 0x16163a2cUL,
++};
++
++static const ulong32 Te4_0[] = {
++0x00000063UL, 0x0000007cUL, 0x00000077UL, 0x0000007bUL, 0x000000f2UL, 0x0000006bUL, 0x0000006fUL, 0x000000c5UL, 
++0x00000030UL, 0x00000001UL, 0x00000067UL, 0x0000002bUL, 0x000000feUL, 0x000000d7UL, 0x000000abUL, 0x00000076UL, 
++0x000000caUL, 0x00000082UL, 0x000000c9UL, 0x0000007dUL, 0x000000faUL, 0x00000059UL, 0x00000047UL, 0x000000f0UL, 
++0x000000adUL, 0x000000d4UL, 0x000000a2UL, 0x000000afUL, 0x0000009cUL, 0x000000a4UL, 0x00000072UL, 0x000000c0UL, 
++0x000000b7UL, 0x000000fdUL, 0x00000093UL, 0x00000026UL, 0x00000036UL, 0x0000003fUL, 0x000000f7UL, 0x000000ccUL, 
++0x00000034UL, 0x000000a5UL, 0x000000e5UL, 0x000000f1UL, 0x00000071UL, 0x000000d8UL, 0x00000031UL, 0x00000015UL, 
++0x00000004UL, 0x000000c7UL, 0x00000023UL, 0x000000c3UL, 0x00000018UL, 0x00000096UL, 0x00000005UL, 0x0000009aUL, 
++0x00000007UL, 0x00000012UL, 0x00000080UL, 0x000000e2UL, 0x000000ebUL, 0x00000027UL, 0x000000b2UL, 0x00000075UL, 
++0x00000009UL, 0x00000083UL, 0x0000002cUL, 0x0000001aUL, 0x0000001bUL, 0x0000006eUL, 0x0000005aUL, 0x000000a0UL, 
++0x00000052UL, 0x0000003bUL, 0x000000d6UL, 0x000000b3UL, 0x00000029UL, 0x000000e3UL, 0x0000002fUL, 0x00000084UL, 
++0x00000053UL, 0x000000d1UL, 0x00000000UL, 0x000000edUL, 0x00000020UL, 0x000000fcUL, 0x000000b1UL, 0x0000005bUL, 
++0x0000006aUL, 0x000000cbUL, 0x000000beUL, 0x00000039UL, 0x0000004aUL, 0x0000004cUL, 0x00000058UL, 0x000000cfUL, 
++0x000000d0UL, 0x000000efUL, 0x000000aaUL, 0x000000fbUL, 0x00000043UL, 0x0000004dUL, 0x00000033UL, 0x00000085UL, 
++0x00000045UL, 0x000000f9UL, 0x00000002UL, 0x0000007fUL, 0x00000050UL, 0x0000003cUL, 0x0000009fUL, 0x000000a8UL, 
++0x00000051UL, 0x000000a3UL, 0x00000040UL, 0x0000008fUL, 0x00000092UL, 0x0000009dUL, 0x00000038UL, 0x000000f5UL, 
++0x000000bcUL, 0x000000b6UL, 0x000000daUL, 0x00000021UL, 0x00000010UL, 0x000000ffUL, 0x000000f3UL, 0x000000d2UL, 
++0x000000cdUL, 0x0000000cUL, 0x00000013UL, 0x000000ecUL, 0x0000005fUL, 0x00000097UL, 0x00000044UL, 0x00000017UL, 
++0x000000c4UL, 0x000000a7UL, 0x0000007eUL, 0x0000003dUL, 0x00000064UL, 0x0000005dUL, 0x00000019UL, 0x00000073UL, 
++0x00000060UL, 0x00000081UL, 0x0000004fUL, 0x000000dcUL, 0x00000022UL, 0x0000002aUL, 0x00000090UL, 0x00000088UL, 
++0x00000046UL, 0x000000eeUL, 0x000000b8UL, 0x00000014UL, 0x000000deUL, 0x0000005eUL, 0x0000000bUL, 0x000000dbUL, 
++0x000000e0UL, 0x00000032UL, 0x0000003aUL, 0x0000000aUL, 0x00000049UL, 0x00000006UL, 0x00000024UL, 0x0000005cUL, 
++0x000000c2UL, 0x000000d3UL, 0x000000acUL, 0x00000062UL, 0x00000091UL, 0x00000095UL, 0x000000e4UL, 0x00000079UL, 
++0x000000e7UL, 0x000000c8UL, 0x00000037UL, 0x0000006dUL, 0x0000008dUL, 0x000000d5UL, 0x0000004eUL, 0x000000a9UL, 
++0x0000006cUL, 0x00000056UL, 0x000000f4UL, 0x000000eaUL, 0x00000065UL, 0x0000007aUL, 0x000000aeUL, 0x00000008UL, 
++0x000000baUL, 0x00000078UL, 0x00000025UL, 0x0000002eUL, 0x0000001cUL, 0x000000a6UL, 0x000000b4UL, 0x000000c6UL, 
++0x000000e8UL, 0x000000ddUL, 0x00000074UL, 0x0000001fUL, 0x0000004bUL, 0x000000bdUL, 0x0000008bUL, 0x0000008aUL, 
++0x00000070UL, 0x0000003eUL, 0x000000b5UL, 0x00000066UL, 0x00000048UL, 0x00000003UL, 0x000000f6UL, 0x0000000eUL, 
++0x00000061UL, 0x00000035UL, 0x00000057UL, 0x000000b9UL, 0x00000086UL, 0x000000c1UL, 0x0000001dUL, 0x0000009eUL, 
++0x000000e1UL, 0x000000f8UL, 0x00000098UL, 0x00000011UL, 0x00000069UL, 0x000000d9UL, 0x0000008eUL, 0x00000094UL, 
++0x0000009bUL, 0x0000001eUL, 0x00000087UL, 0x000000e9UL, 0x000000ceUL, 0x00000055UL, 0x00000028UL, 0x000000dfUL, 
++0x0000008cUL, 0x000000a1UL, 0x00000089UL, 0x0000000dUL, 0x000000bfUL, 0x000000e6UL, 0x00000042UL, 0x00000068UL, 
++0x00000041UL, 0x00000099UL, 0x0000002dUL, 0x0000000fUL, 0x000000b0UL, 0x00000054UL, 0x000000bbUL, 0x00000016UL
++};
++
++static const ulong32 Te4_1[] = {
++0x00006300UL, 0x00007c00UL, 0x00007700UL, 0x00007b00UL, 0x0000f200UL, 0x00006b00UL, 0x00006f00UL, 0x0000c500UL, 
++0x00003000UL, 0x00000100UL, 0x00006700UL, 0x00002b00UL, 0x0000fe00UL, 0x0000d700UL, 0x0000ab00UL, 0x00007600UL, 
++0x0000ca00UL, 0x00008200UL, 0x0000c900UL, 0x00007d00UL, 0x0000fa00UL, 0x00005900UL, 0x00004700UL, 0x0000f000UL, 
++0x0000ad00UL, 0x0000d400UL, 0x0000a200UL, 0x0000af00UL, 0x00009c00UL, 0x0000a400UL, 0x00007200UL, 0x0000c000UL, 
++0x0000b700UL, 0x0000fd00UL, 0x00009300UL, 0x00002600UL, 0x00003600UL, 0x00003f00UL, 0x0000f700UL, 0x0000cc00UL, 
++0x00003400UL, 0x0000a500UL, 0x0000e500UL, 0x0000f100UL, 0x00007100UL, 0x0000d800UL, 0x00003100UL, 0x00001500UL, 
++0x00000400UL, 0x0000c700UL, 0x00002300UL, 0x0000c300UL, 0x00001800UL, 0x00009600UL, 0x00000500UL, 0x00009a00UL, 
++0x00000700UL, 0x00001200UL, 0x00008000UL, 0x0000e200UL, 0x0000eb00UL, 0x00002700UL, 0x0000b200UL, 0x00007500UL, 
++0x00000900UL, 0x00008300UL, 0x00002c00UL, 0x00001a00UL, 0x00001b00UL, 0x00006e00UL, 0x00005a00UL, 0x0000a000UL, 
++0x00005200UL, 0x00003b00UL, 0x0000d600UL, 0x0000b300UL, 0x00002900UL, 0x0000e300UL, 0x00002f00UL, 0x00008400UL, 
++0x00005300UL, 0x0000d100UL, 0x00000000UL, 0x0000ed00UL, 0x00002000UL, 0x0000fc00UL, 0x0000b100UL, 0x00005b00UL, 
++0x00006a00UL, 0x0000cb00UL, 0x0000be00UL, 0x00003900UL, 0x00004a00UL, 0x00004c00UL, 0x00005800UL, 0x0000cf00UL, 
++0x0000d000UL, 0x0000ef00UL, 0x0000aa00UL, 0x0000fb00UL, 0x00004300UL, 0x00004d00UL, 0x00003300UL, 0x00008500UL, 
++0x00004500UL, 0x0000f900UL, 0x00000200UL, 0x00007f00UL, 0x00005000UL, 0x00003c00UL, 0x00009f00UL, 0x0000a800UL, 
++0x00005100UL, 0x0000a300UL, 0x00004000UL, 0x00008f00UL, 0x00009200UL, 0x00009d00UL, 0x00003800UL, 0x0000f500UL, 
++0x0000bc00UL, 0x0000b600UL, 0x0000da00UL, 0x00002100UL, 0x00001000UL, 0x0000ff00UL, 0x0000f300UL, 0x0000d200UL, 
++0x0000cd00UL, 0x00000c00UL, 0x00001300UL, 0x0000ec00UL, 0x00005f00UL, 0x00009700UL, 0x00004400UL, 0x00001700UL, 
++0x0000c400UL, 0x0000a700UL, 0x00007e00UL, 0x00003d00UL, 0x00006400UL, 0x00005d00UL, 0x00001900UL, 0x00007300UL, 
++0x00006000UL, 0x00008100UL, 0x00004f00UL, 0x0000dc00UL, 0x00002200UL, 0x00002a00UL, 0x00009000UL, 0x00008800UL, 
++0x00004600UL, 0x0000ee00UL, 0x0000b800UL, 0x00001400UL, 0x0000de00UL, 0x00005e00UL, 0x00000b00UL, 0x0000db00UL, 
++0x0000e000UL, 0x00003200UL, 0x00003a00UL, 0x00000a00UL, 0x00004900UL, 0x00000600UL, 0x00002400UL, 0x00005c00UL, 
++0x0000c200UL, 0x0000d300UL, 0x0000ac00UL, 0x00006200UL, 0x00009100UL, 0x00009500UL, 0x0000e400UL, 0x00007900UL, 
++0x0000e700UL, 0x0000c800UL, 0x00003700UL, 0x00006d00UL, 0x00008d00UL, 0x0000d500UL, 0x00004e00UL, 0x0000a900UL, 
++0x00006c00UL, 0x00005600UL, 0x0000f400UL, 0x0000ea00UL, 0x00006500UL, 0x00007a00UL, 0x0000ae00UL, 0x00000800UL, 
++0x0000ba00UL, 0x00007800UL, 0x00002500UL, 0x00002e00UL, 0x00001c00UL, 0x0000a600UL, 0x0000b400UL, 0x0000c600UL, 
++0x0000e800UL, 0x0000dd00UL, 0x00007400UL, 0x00001f00UL, 0x00004b00UL, 0x0000bd00UL, 0x00008b00UL, 0x00008a00UL, 
++0x00007000UL, 0x00003e00UL, 0x0000b500UL, 0x00006600UL, 0x00004800UL, 0x00000300UL, 0x0000f600UL, 0x00000e00UL, 
++0x00006100UL, 0x00003500UL, 0x00005700UL, 0x0000b900UL, 0x00008600UL, 0x0000c100UL, 0x00001d00UL, 0x00009e00UL, 
++0x0000e100UL, 0x0000f800UL, 0x00009800UL, 0x00001100UL, 0x00006900UL, 0x0000d900UL, 0x00008e00UL, 0x00009400UL, 
++0x00009b00UL, 0x00001e00UL, 0x00008700UL, 0x0000e900UL, 0x0000ce00UL, 0x00005500UL, 0x00002800UL, 0x0000df00UL, 
++0x00008c00UL, 0x0000a100UL, 0x00008900UL, 0x00000d00UL, 0x0000bf00UL, 0x0000e600UL, 0x00004200UL, 0x00006800UL, 
++0x00004100UL, 0x00009900UL, 0x00002d00UL, 0x00000f00UL, 0x0000b000UL, 0x00005400UL, 0x0000bb00UL, 0x00001600UL
++};
++
++static const ulong32 Te4_2[] = {
++0x00630000UL, 0x007c0000UL, 0x00770000UL, 0x007b0000UL, 0x00f20000UL, 0x006b0000UL, 0x006f0000UL, 0x00c50000UL, 
++0x00300000UL, 0x00010000UL, 0x00670000UL, 0x002b0000UL, 0x00fe0000UL, 0x00d70000UL, 0x00ab0000UL, 0x00760000UL, 
++0x00ca0000UL, 0x00820000UL, 0x00c90000UL, 0x007d0000UL, 0x00fa0000UL, 0x00590000UL, 0x00470000UL, 0x00f00000UL, 
++0x00ad0000UL, 0x00d40000UL, 0x00a20000UL, 0x00af0000UL, 0x009c0000UL, 0x00a40000UL, 0x00720000UL, 0x00c00000UL, 
++0x00b70000UL, 0x00fd0000UL, 0x00930000UL, 0x00260000UL, 0x00360000UL, 0x003f0000UL, 0x00f70000UL, 0x00cc0000UL, 
++0x00340000UL, 0x00a50000UL, 0x00e50000UL, 0x00f10000UL, 0x00710000UL, 0x00d80000UL, 0x00310000UL, 0x00150000UL, 
++0x00040000UL, 0x00c70000UL, 0x00230000UL, 0x00c30000UL, 0x00180000UL, 0x00960000UL, 0x00050000UL, 0x009a0000UL, 
++0x00070000UL, 0x00120000UL, 0x00800000UL, 0x00e20000UL, 0x00eb0000UL, 0x00270000UL, 0x00b20000UL, 0x00750000UL, 
++0x00090000UL, 0x00830000UL, 0x002c0000UL, 0x001a0000UL, 0x001b0000UL, 0x006e0000UL, 0x005a0000UL, 0x00a00000UL, 
++0x00520000UL, 0x003b0000UL, 0x00d60000UL, 0x00b30000UL, 0x00290000UL, 0x00e30000UL, 0x002f0000UL, 0x00840000UL, 
++0x00530000UL, 0x00d10000UL, 0x00000000UL, 0x00ed0000UL, 0x00200000UL, 0x00fc0000UL, 0x00b10000UL, 0x005b0000UL, 
++0x006a0000UL, 0x00cb0000UL, 0x00be0000UL, 0x00390000UL, 0x004a0000UL, 0x004c0000UL, 0x00580000UL, 0x00cf0000UL, 
++0x00d00000UL, 0x00ef0000UL, 0x00aa0000UL, 0x00fb0000UL, 0x00430000UL, 0x004d0000UL, 0x00330000UL, 0x00850000UL, 
++0x00450000UL, 0x00f90000UL, 0x00020000UL, 0x007f0000UL, 0x00500000UL, 0x003c0000UL, 0x009f0000UL, 0x00a80000UL, 
++0x00510000UL, 0x00a30000UL, 0x00400000UL, 0x008f0000UL, 0x00920000UL, 0x009d0000UL, 0x00380000UL, 0x00f50000UL, 
++0x00bc0000UL, 0x00b60000UL, 0x00da0000UL, 0x00210000UL, 0x00100000UL, 0x00ff0000UL, 0x00f30000UL, 0x00d20000UL, 
++0x00cd0000UL, 0x000c0000UL, 0x00130000UL, 0x00ec0000UL, 0x005f0000UL, 0x00970000UL, 0x00440000UL, 0x00170000UL, 
++0x00c40000UL, 0x00a70000UL, 0x007e0000UL, 0x003d0000UL, 0x00640000UL, 0x005d0000UL, 0x00190000UL, 0x00730000UL, 
++0x00600000UL, 0x00810000UL, 0x004f0000UL, 0x00dc0000UL, 0x00220000UL, 0x002a0000UL, 0x00900000UL, 0x00880000UL, 
++0x00460000UL, 0x00ee0000UL, 0x00b80000UL, 0x00140000UL, 0x00de0000UL, 0x005e0000UL, 0x000b0000UL, 0x00db0000UL, 
++0x00e00000UL, 0x00320000UL, 0x003a0000UL, 0x000a0000UL, 0x00490000UL, 0x00060000UL, 0x00240000UL, 0x005c0000UL, 
++0x00c20000UL, 0x00d30000UL, 0x00ac0000UL, 0x00620000UL, 0x00910000UL, 0x00950000UL, 0x00e40000UL, 0x00790000UL, 
++0x00e70000UL, 0x00c80000UL, 0x00370000UL, 0x006d0000UL, 0x008d0000UL, 0x00d50000UL, 0x004e0000UL, 0x00a90000UL, 
++0x006c0000UL, 0x00560000UL, 0x00f40000UL, 0x00ea0000UL, 0x00650000UL, 0x007a0000UL, 0x00ae0000UL, 0x00080000UL, 
++0x00ba0000UL, 0x00780000UL, 0x00250000UL, 0x002e0000UL, 0x001c0000UL, 0x00a60000UL, 0x00b40000UL, 0x00c60000UL, 
++0x00e80000UL, 0x00dd0000UL, 0x00740000UL, 0x001f0000UL, 0x004b0000UL, 0x00bd0000UL, 0x008b0000UL, 0x008a0000UL, 
++0x00700000UL, 0x003e0000UL, 0x00b50000UL, 0x00660000UL, 0x00480000UL, 0x00030000UL, 0x00f60000UL, 0x000e0000UL, 
++0x00610000UL, 0x00350000UL, 0x00570000UL, 0x00b90000UL, 0x00860000UL, 0x00c10000UL, 0x001d0000UL, 0x009e0000UL, 
++0x00e10000UL, 0x00f80000UL, 0x00980000UL, 0x00110000UL, 0x00690000UL, 0x00d90000UL, 0x008e0000UL, 0x00940000UL, 
++0x009b0000UL, 0x001e0000UL, 0x00870000UL, 0x00e90000UL, 0x00ce0000UL, 0x00550000UL, 0x00280000UL, 0x00df0000UL, 
++0x008c0000UL, 0x00a10000UL, 0x00890000UL, 0x000d0000UL, 0x00bf0000UL, 0x00e60000UL, 0x00420000UL, 0x00680000UL, 
++0x00410000UL, 0x00990000UL, 0x002d0000UL, 0x000f0000UL, 0x00b00000UL, 0x00540000UL, 0x00bb0000UL, 0x00160000UL
++};
++
++static const ulong32 Te4_3[] = {
++0x63000000UL, 0x7c000000UL, 0x77000000UL, 0x7b000000UL, 0xf2000000UL, 0x6b000000UL, 0x6f000000UL, 0xc5000000UL, 
++0x30000000UL, 0x01000000UL, 0x67000000UL, 0x2b000000UL, 0xfe000000UL, 0xd7000000UL, 0xab000000UL, 0x76000000UL, 
++0xca000000UL, 0x82000000UL, 0xc9000000UL, 0x7d000000UL, 0xfa000000UL, 0x59000000UL, 0x47000000UL, 0xf0000000UL, 
++0xad000000UL, 0xd4000000UL, 0xa2000000UL, 0xaf000000UL, 0x9c000000UL, 0xa4000000UL, 0x72000000UL, 0xc0000000UL, 
++0xb7000000UL, 0xfd000000UL, 0x93000000UL, 0x26000000UL, 0x36000000UL, 0x3f000000UL, 0xf7000000UL, 0xcc000000UL, 
++0x34000000UL, 0xa5000000UL, 0xe5000000UL, 0xf1000000UL, 0x71000000UL, 0xd8000000UL, 0x31000000UL, 0x15000000UL, 
++0x04000000UL, 0xc7000000UL, 0x23000000UL, 0xc3000000UL, 0x18000000UL, 0x96000000UL, 0x05000000UL, 0x9a000000UL, 
++0x07000000UL, 0x12000000UL, 0x80000000UL, 0xe2000000UL, 0xeb000000UL, 0x27000000UL, 0xb2000000UL, 0x75000000UL, 
++0x09000000UL, 0x83000000UL, 0x2c000000UL, 0x1a000000UL, 0x1b000000UL, 0x6e000000UL, 0x5a000000UL, 0xa0000000UL, 
++0x52000000UL, 0x3b000000UL, 0xd6000000UL, 0xb3000000UL, 0x29000000UL, 0xe3000000UL, 0x2f000000UL, 0x84000000UL, 
++0x53000000UL, 0xd1000000UL, 0x00000000UL, 0xed000000UL, 0x20000000UL, 0xfc000000UL, 0xb1000000UL, 0x5b000000UL, 
++0x6a000000UL, 0xcb000000UL, 0xbe000000UL, 0x39000000UL, 0x4a000000UL, 0x4c000000UL, 0x58000000UL, 0xcf000000UL, 
++0xd0000000UL, 0xef000000UL, 0xaa000000UL, 0xfb000000UL, 0x43000000UL, 0x4d000000UL, 0x33000000UL, 0x85000000UL, 
++0x45000000UL, 0xf9000000UL, 0x02000000UL, 0x7f000000UL, 0x50000000UL, 0x3c000000UL, 0x9f000000UL, 0xa8000000UL, 
++0x51000000UL, 0xa3000000UL, 0x40000000UL, 0x8f000000UL, 0x92000000UL, 0x9d000000UL, 0x38000000UL, 0xf5000000UL, 
++0xbc000000UL, 0xb6000000UL, 0xda000000UL, 0x21000000UL, 0x10000000UL, 0xff000000UL, 0xf3000000UL, 0xd2000000UL, 
++0xcd000000UL, 0x0c000000UL, 0x13000000UL, 0xec000000UL, 0x5f000000UL, 0x97000000UL, 0x44000000UL, 0x17000000UL, 
++0xc4000000UL, 0xa7000000UL, 0x7e000000UL, 0x3d000000UL, 0x64000000UL, 0x5d000000UL, 0x19000000UL, 0x73000000UL, 
++0x60000000UL, 0x81000000UL, 0x4f000000UL, 0xdc000000UL, 0x22000000UL, 0x2a000000UL, 0x90000000UL, 0x88000000UL, 
++0x46000000UL, 0xee000000UL, 0xb8000000UL, 0x14000000UL, 0xde000000UL, 0x5e000000UL, 0x0b000000UL, 0xdb000000UL, 
++0xe0000000UL, 0x32000000UL, 0x3a000000UL, 0x0a000000UL, 0x49000000UL, 0x06000000UL, 0x24000000UL, 0x5c000000UL, 
++0xc2000000UL, 0xd3000000UL, 0xac000000UL, 0x62000000UL, 0x91000000UL, 0x95000000UL, 0xe4000000UL, 0x79000000UL, 
++0xe7000000UL, 0xc8000000UL, 0x37000000UL, 0x6d000000UL, 0x8d000000UL, 0xd5000000UL, 0x4e000000UL, 0xa9000000UL, 
++0x6c000000UL, 0x56000000UL, 0xf4000000UL, 0xea000000UL, 0x65000000UL, 0x7a000000UL, 0xae000000UL, 0x08000000UL, 
++0xba000000UL, 0x78000000UL, 0x25000000UL, 0x2e000000UL, 0x1c000000UL, 0xa6000000UL, 0xb4000000UL, 0xc6000000UL, 
++0xe8000000UL, 0xdd000000UL, 0x74000000UL, 0x1f000000UL, 0x4b000000UL, 0xbd000000UL, 0x8b000000UL, 0x8a000000UL, 
++0x70000000UL, 0x3e000000UL, 0xb5000000UL, 0x66000000UL, 0x48000000UL, 0x03000000UL, 0xf6000000UL, 0x0e000000UL, 
++0x61000000UL, 0x35000000UL, 0x57000000UL, 0xb9000000UL, 0x86000000UL, 0xc1000000UL, 0x1d000000UL, 0x9e000000UL, 
++0xe1000000UL, 0xf8000000UL, 0x98000000UL, 0x11000000UL, 0x69000000UL, 0xd9000000UL, 0x8e000000UL, 0x94000000UL, 
++0x9b000000UL, 0x1e000000UL, 0x87000000UL, 0xe9000000UL, 0xce000000UL, 0x55000000UL, 0x28000000UL, 0xdf000000UL, 
++0x8c000000UL, 0xa1000000UL, 0x89000000UL, 0x0d000000UL, 0xbf000000UL, 0xe6000000UL, 0x42000000UL, 0x68000000UL, 
++0x41000000UL, 0x99000000UL, 0x2d000000UL, 0x0f000000UL, 0xb0000000UL, 0x54000000UL, 0xbb000000UL, 0x16000000UL
++};
++
++static const ulong32 TD1[256] = {
++    0x5051f4a7UL, 0x537e4165UL, 0xc31a17a4UL, 0x963a275eUL,
++    0xcb3bab6bUL, 0xf11f9d45UL, 0xabacfa58UL, 0x934be303UL,
++    0x552030faUL, 0xf6ad766dUL, 0x9188cc76UL, 0x25f5024cUL,
++    0xfc4fe5d7UL, 0xd7c52acbUL, 0x80263544UL, 0x8fb562a3UL,
++    0x49deb15aUL, 0x6725ba1bUL, 0x9845ea0eUL, 0xe15dfec0UL,
++    0x02c32f75UL, 0x12814cf0UL, 0xa38d4697UL, 0xc66bd3f9UL,
++    0xe7038f5fUL, 0x9515929cUL, 0xebbf6d7aUL, 0xda955259UL,
++    0x2dd4be83UL, 0xd3587421UL, 0x2949e069UL, 0x448ec9c8UL,
++    0x6a75c289UL, 0x78f48e79UL, 0x6b99583eUL, 0xdd27b971UL,
++    0xb6bee14fUL, 0x17f088adUL, 0x66c920acUL, 0xb47dce3aUL,
++    0x1863df4aUL, 0x82e51a31UL, 0x60975133UL, 0x4562537fUL,
++    0xe0b16477UL, 0x84bb6baeUL, 0x1cfe81a0UL, 0x94f9082bUL,
++    0x58704868UL, 0x198f45fdUL, 0x8794de6cUL, 0xb7527bf8UL,
++    0x23ab73d3UL, 0xe2724b02UL, 0x57e31f8fUL, 0x2a6655abUL,
++    0x07b2eb28UL, 0x032fb5c2UL, 0x9a86c57bUL, 0xa5d33708UL,
++    0xf2302887UL, 0xb223bfa5UL, 0xba02036aUL, 0x5ced1682UL,
++    0x2b8acf1cUL, 0x92a779b4UL, 0xf0f307f2UL, 0xa14e69e2UL,
++    0xcd65daf4UL, 0xd50605beUL, 0x1fd13462UL, 0x8ac4a6feUL,
++    0x9d342e53UL, 0xa0a2f355UL, 0x32058ae1UL, 0x75a4f6ebUL,
++    0x390b83ecUL, 0xaa4060efUL, 0x065e719fUL, 0x51bd6e10UL,
++    0xf93e218aUL, 0x3d96dd06UL, 0xaedd3e05UL, 0x464de6bdUL,
++    0xb591548dUL, 0x0571c45dUL, 0x6f0406d4UL, 0xff605015UL,
++    0x241998fbUL, 0x97d6bde9UL, 0xcc894043UL, 0x7767d99eUL,
++    0xbdb0e842UL, 0x8807898bUL, 0x38e7195bUL, 0xdb79c8eeUL,
++    0x47a17c0aUL, 0xe97c420fUL, 0xc9f8841eUL, 0x00000000UL,
++    0x83098086UL, 0x48322bedUL, 0xac1e1170UL, 0x4e6c5a72UL,
++    0xfbfd0effUL, 0x560f8538UL, 0x1e3daed5UL, 0x27362d39UL,
++    0x640a0fd9UL, 0x21685ca6UL, 0xd19b5b54UL, 0x3a24362eUL,
++    0xb10c0a67UL, 0x0f9357e7UL, 0xd2b4ee96UL, 0x9e1b9b91UL,
++    0x4f80c0c5UL, 0xa261dc20UL, 0x695a774bUL, 0x161c121aUL,
++    0x0ae293baUL, 0xe5c0a02aUL, 0x433c22e0UL, 0x1d121b17UL,
++    0x0b0e090dUL, 0xadf28bc7UL, 0xb92db6a8UL, 0xc8141ea9UL,
++    0x8557f119UL, 0x4caf7507UL, 0xbbee99ddUL, 0xfda37f60UL,
++    0x9ff70126UL, 0xbc5c72f5UL, 0xc544663bUL, 0x345bfb7eUL,
++    0x768b4329UL, 0xdccb23c6UL, 0x68b6edfcUL, 0x63b8e4f1UL,
++    0xcad731dcUL, 0x10426385UL, 0x40139722UL, 0x2084c611UL,
++    0x7d854a24UL, 0xf8d2bb3dUL, 0x11aef932UL, 0x6dc729a1UL,
++    0x4b1d9e2fUL, 0xf3dcb230UL, 0xec0d8652UL, 0xd077c1e3UL,
++    0x6c2bb316UL, 0x99a970b9UL, 0xfa119448UL, 0x2247e964UL,
++    0xc4a8fc8cUL, 0x1aa0f03fUL, 0xd8567d2cUL, 0xef223390UL,
++    0xc787494eUL, 0xc1d938d1UL, 0xfe8ccaa2UL, 0x3698d40bUL,
++    0xcfa6f581UL, 0x28a57adeUL, 0x26dab78eUL, 0xa43fadbfUL,
++    0xe42c3a9dUL, 0x0d507892UL, 0x9b6a5fccUL, 0x62547e46UL,
++    0xc2f68d13UL, 0xe890d8b8UL, 0x5e2e39f7UL, 0xf582c3afUL,
++    0xbe9f5d80UL, 0x7c69d093UL, 0xa96fd52dUL, 0xb3cf2512UL,
++    0x3bc8ac99UL, 0xa710187dUL, 0x6ee89c63UL, 0x7bdb3bbbUL,
++    0x09cd2678UL, 0xf46e5918UL, 0x01ec9ab7UL, 0xa8834f9aUL,
++    0x65e6956eUL, 0x7eaaffe6UL, 0x0821bccfUL, 0xe6ef15e8UL,
++    0xd9bae79bUL, 0xce4a6f36UL, 0xd4ea9f09UL, 0xd629b07cUL,
++    0xaf31a4b2UL, 0x312a3f23UL, 0x30c6a594UL, 0xc035a266UL,
++    0x37744ebcUL, 0xa6fc82caUL, 0xb0e090d0UL, 0x1533a7d8UL,
++    0x4af10498UL, 0xf741ecdaUL, 0x0e7fcd50UL, 0x2f1791f6UL,
++    0x8d764dd6UL, 0x4d43efb0UL, 0x54ccaa4dUL, 0xdfe49604UL,
++    0xe39ed1b5UL, 0x1b4c6a88UL, 0xb8c12c1fUL, 0x7f466551UL,
++    0x049d5eeaUL, 0x5d018c35UL, 0x73fa8774UL, 0x2efb0b41UL,
++    0x5ab3671dUL, 0x5292dbd2UL, 0x33e91056UL, 0x136dd647UL,
++    0x8c9ad761UL, 0x7a37a10cUL, 0x8e59f814UL, 0x89eb133cUL,
++    0xeecea927UL, 0x35b761c9UL, 0xede11ce5UL, 0x3c7a47b1UL,
++    0x599cd2dfUL, 0x3f55f273UL, 0x791814ceUL, 0xbf73c737UL,
++    0xea53f7cdUL, 0x5b5ffdaaUL, 0x14df3d6fUL, 0x867844dbUL,
++    0x81caaff3UL, 0x3eb968c4UL, 0x2c382434UL, 0x5fc2a340UL,
++    0x72161dc3UL, 0x0cbce225UL, 0x8b283c49UL, 0x41ff0d95UL,
++    0x7139a801UL, 0xde080cb3UL, 0x9cd8b4e4UL, 0x906456c1UL,
++    0x617bcb84UL, 0x70d532b6UL, 0x74486c5cUL, 0x42d0b857UL,
++};
++static const ulong32 TD2[256] = {
++    0xa75051f4UL, 0x65537e41UL, 0xa4c31a17UL, 0x5e963a27UL,
++    0x6bcb3babUL, 0x45f11f9dUL, 0x58abacfaUL, 0x03934be3UL,
++    0xfa552030UL, 0x6df6ad76UL, 0x769188ccUL, 0x4c25f502UL,
++    0xd7fc4fe5UL, 0xcbd7c52aUL, 0x44802635UL, 0xa38fb562UL,
++    0x5a49deb1UL, 0x1b6725baUL, 0x0e9845eaUL, 0xc0e15dfeUL,
++    0x7502c32fUL, 0xf012814cUL, 0x97a38d46UL, 0xf9c66bd3UL,
++    0x5fe7038fUL, 0x9c951592UL, 0x7aebbf6dUL, 0x59da9552UL,
++    0x832dd4beUL, 0x21d35874UL, 0x692949e0UL, 0xc8448ec9UL,
++    0x896a75c2UL, 0x7978f48eUL, 0x3e6b9958UL, 0x71dd27b9UL,
++    0x4fb6bee1UL, 0xad17f088UL, 0xac66c920UL, 0x3ab47dceUL,
++    0x4a1863dfUL, 0x3182e51aUL, 0x33609751UL, 0x7f456253UL,
++    0x77e0b164UL, 0xae84bb6bUL, 0xa01cfe81UL, 0x2b94f908UL,
++    0x68587048UL, 0xfd198f45UL, 0x6c8794deUL, 0xf8b7527bUL,
++    0xd323ab73UL, 0x02e2724bUL, 0x8f57e31fUL, 0xab2a6655UL,
++    0x2807b2ebUL, 0xc2032fb5UL, 0x7b9a86c5UL, 0x08a5d337UL,
++    0x87f23028UL, 0xa5b223bfUL, 0x6aba0203UL, 0x825ced16UL,
++    0x1c2b8acfUL, 0xb492a779UL, 0xf2f0f307UL, 0xe2a14e69UL,
++    0xf4cd65daUL, 0xbed50605UL, 0x621fd134UL, 0xfe8ac4a6UL,
++    0x539d342eUL, 0x55a0a2f3UL, 0xe132058aUL, 0xeb75a4f6UL,
++    0xec390b83UL, 0xefaa4060UL, 0x9f065e71UL, 0x1051bd6eUL,
++    0x8af93e21UL, 0x063d96ddUL, 0x05aedd3eUL, 0xbd464de6UL,
++    0x8db59154UL, 0x5d0571c4UL, 0xd46f0406UL, 0x15ff6050UL,
++    0xfb241998UL, 0xe997d6bdUL, 0x43cc8940UL, 0x9e7767d9UL,
++    0x42bdb0e8UL, 0x8b880789UL, 0x5b38e719UL, 0xeedb79c8UL,
++    0x0a47a17cUL, 0x0fe97c42UL, 0x1ec9f884UL, 0x00000000UL,
++    0x86830980UL, 0xed48322bUL, 0x70ac1e11UL, 0x724e6c5aUL,
++    0xfffbfd0eUL, 0x38560f85UL, 0xd51e3daeUL, 0x3927362dUL,
++    0xd9640a0fUL, 0xa621685cUL, 0x54d19b5bUL, 0x2e3a2436UL,
++    0x67b10c0aUL, 0xe70f9357UL, 0x96d2b4eeUL, 0x919e1b9bUL,
++    0xc54f80c0UL, 0x20a261dcUL, 0x4b695a77UL, 0x1a161c12UL,
++    0xba0ae293UL, 0x2ae5c0a0UL, 0xe0433c22UL, 0x171d121bUL,
++    0x0d0b0e09UL, 0xc7adf28bUL, 0xa8b92db6UL, 0xa9c8141eUL,
++    0x198557f1UL, 0x074caf75UL, 0xddbbee99UL, 0x60fda37fUL,
++    0x269ff701UL, 0xf5bc5c72UL, 0x3bc54466UL, 0x7e345bfbUL,
++    0x29768b43UL, 0xc6dccb23UL, 0xfc68b6edUL, 0xf163b8e4UL,
++    0xdccad731UL, 0x85104263UL, 0x22401397UL, 0x112084c6UL,
++    0x247d854aUL, 0x3df8d2bbUL, 0x3211aef9UL, 0xa16dc729UL,
++    0x2f4b1d9eUL, 0x30f3dcb2UL, 0x52ec0d86UL, 0xe3d077c1UL,
++    0x166c2bb3UL, 0xb999a970UL, 0x48fa1194UL, 0x642247e9UL,
++    0x8cc4a8fcUL, 0x3f1aa0f0UL, 0x2cd8567dUL, 0x90ef2233UL,
++    0x4ec78749UL, 0xd1c1d938UL, 0xa2fe8ccaUL, 0x0b3698d4UL,
++    0x81cfa6f5UL, 0xde28a57aUL, 0x8e26dab7UL, 0xbfa43fadUL,
++    0x9de42c3aUL, 0x920d5078UL, 0xcc9b6a5fUL, 0x4662547eUL,
++    0x13c2f68dUL, 0xb8e890d8UL, 0xf75e2e39UL, 0xaff582c3UL,
++    0x80be9f5dUL, 0x937c69d0UL, 0x2da96fd5UL, 0x12b3cf25UL,
++    0x993bc8acUL, 0x7da71018UL, 0x636ee89cUL, 0xbb7bdb3bUL,
++    0x7809cd26UL, 0x18f46e59UL, 0xb701ec9aUL, 0x9aa8834fUL,
++    0x6e65e695UL, 0xe67eaaffUL, 0xcf0821bcUL, 0xe8e6ef15UL,
++    0x9bd9bae7UL, 0x36ce4a6fUL, 0x09d4ea9fUL, 0x7cd629b0UL,
++    0xb2af31a4UL, 0x23312a3fUL, 0x9430c6a5UL, 0x66c035a2UL,
++    0xbc37744eUL, 0xcaa6fc82UL, 0xd0b0e090UL, 0xd81533a7UL,
++    0x984af104UL, 0xdaf741ecUL, 0x500e7fcdUL, 0xf62f1791UL,
++    0xd68d764dUL, 0xb04d43efUL, 0x4d54ccaaUL, 0x04dfe496UL,
++    0xb5e39ed1UL, 0x881b4c6aUL, 0x1fb8c12cUL, 0x517f4665UL,
++    0xea049d5eUL, 0x355d018cUL, 0x7473fa87UL, 0x412efb0bUL,
++    0x1d5ab367UL, 0xd25292dbUL, 0x5633e910UL, 0x47136dd6UL,
++    0x618c9ad7UL, 0x0c7a37a1UL, 0x148e59f8UL, 0x3c89eb13UL,
++    0x27eecea9UL, 0xc935b761UL, 0xe5ede11cUL, 0xb13c7a47UL,
++    0xdf599cd2UL, 0x733f55f2UL, 0xce791814UL, 0x37bf73c7UL,
++    0xcdea53f7UL, 0xaa5b5ffdUL, 0x6f14df3dUL, 0xdb867844UL,
++    0xf381caafUL, 0xc43eb968UL, 0x342c3824UL, 0x405fc2a3UL,
++    0xc372161dUL, 0x250cbce2UL, 0x498b283cUL, 0x9541ff0dUL,
++    0x017139a8UL, 0xb3de080cUL, 0xe49cd8b4UL, 0xc1906456UL,
++    0x84617bcbUL, 0xb670d532UL, 0x5c74486cUL, 0x5742d0b8UL,
++};
++static const ulong32 TD3[256] = {
++    0xf4a75051UL, 0x4165537eUL, 0x17a4c31aUL, 0x275e963aUL,
++    0xab6bcb3bUL, 0x9d45f11fUL, 0xfa58abacUL, 0xe303934bUL,
++    0x30fa5520UL, 0x766df6adUL, 0xcc769188UL, 0x024c25f5UL,
++    0xe5d7fc4fUL, 0x2acbd7c5UL, 0x35448026UL, 0x62a38fb5UL,
++    0xb15a49deUL, 0xba1b6725UL, 0xea0e9845UL, 0xfec0e15dUL,
++    0x2f7502c3UL, 0x4cf01281UL, 0x4697a38dUL, 0xd3f9c66bUL,
++    0x8f5fe703UL, 0x929c9515UL, 0x6d7aebbfUL, 0x5259da95UL,
++    0xbe832dd4UL, 0x7421d358UL, 0xe0692949UL, 0xc9c8448eUL,
++    0xc2896a75UL, 0x8e7978f4UL, 0x583e6b99UL, 0xb971dd27UL,
++    0xe14fb6beUL, 0x88ad17f0UL, 0x20ac66c9UL, 0xce3ab47dUL,
++    0xdf4a1863UL, 0x1a3182e5UL, 0x51336097UL, 0x537f4562UL,
++    0x6477e0b1UL, 0x6bae84bbUL, 0x81a01cfeUL, 0x082b94f9UL,
++    0x48685870UL, 0x45fd198fUL, 0xde6c8794UL, 0x7bf8b752UL,
++    0x73d323abUL, 0x4b02e272UL, 0x1f8f57e3UL, 0x55ab2a66UL,
++    0xeb2807b2UL, 0xb5c2032fUL, 0xc57b9a86UL, 0x3708a5d3UL,
++    0x2887f230UL, 0xbfa5b223UL, 0x036aba02UL, 0x16825cedUL,
++    0xcf1c2b8aUL, 0x79b492a7UL, 0x07f2f0f3UL, 0x69e2a14eUL,
++    0xdaf4cd65UL, 0x05bed506UL, 0x34621fd1UL, 0xa6fe8ac4UL,
++    0x2e539d34UL, 0xf355a0a2UL, 0x8ae13205UL, 0xf6eb75a4UL,
++    0x83ec390bUL, 0x60efaa40UL, 0x719f065eUL, 0x6e1051bdUL,
++    0x218af93eUL, 0xdd063d96UL, 0x3e05aeddUL, 0xe6bd464dUL,
++    0x548db591UL, 0xc45d0571UL, 0x06d46f04UL, 0x5015ff60UL,
++    0x98fb2419UL, 0xbde997d6UL, 0x4043cc89UL, 0xd99e7767UL,
++    0xe842bdb0UL, 0x898b8807UL, 0x195b38e7UL, 0xc8eedb79UL,
++    0x7c0a47a1UL, 0x420fe97cUL, 0x841ec9f8UL, 0x00000000UL,
++    0x80868309UL, 0x2bed4832UL, 0x1170ac1eUL, 0x5a724e6cUL,
++    0x0efffbfdUL, 0x8538560fUL, 0xaed51e3dUL, 0x2d392736UL,
++    0x0fd9640aUL, 0x5ca62168UL, 0x5b54d19bUL, 0x362e3a24UL,
++    0x0a67b10cUL, 0x57e70f93UL, 0xee96d2b4UL, 0x9b919e1bUL,
++    0xc0c54f80UL, 0xdc20a261UL, 0x774b695aUL, 0x121a161cUL,
++    0x93ba0ae2UL, 0xa02ae5c0UL, 0x22e0433cUL, 0x1b171d12UL,
++    0x090d0b0eUL, 0x8bc7adf2UL, 0xb6a8b92dUL, 0x1ea9c814UL,
++    0xf1198557UL, 0x75074cafUL, 0x99ddbbeeUL, 0x7f60fda3UL,
++    0x01269ff7UL, 0x72f5bc5cUL, 0x663bc544UL, 0xfb7e345bUL,
++    0x4329768bUL, 0x23c6dccbUL, 0xedfc68b6UL, 0xe4f163b8UL,
++    0x31dccad7UL, 0x63851042UL, 0x97224013UL, 0xc6112084UL,
++    0x4a247d85UL, 0xbb3df8d2UL, 0xf93211aeUL, 0x29a16dc7UL,
++    0x9e2f4b1dUL, 0xb230f3dcUL, 0x8652ec0dUL, 0xc1e3d077UL,
++    0xb3166c2bUL, 0x70b999a9UL, 0x9448fa11UL, 0xe9642247UL,
++    0xfc8cc4a8UL, 0xf03f1aa0UL, 0x7d2cd856UL, 0x3390ef22UL,
++    0x494ec787UL, 0x38d1c1d9UL, 0xcaa2fe8cUL, 0xd40b3698UL,
++    0xf581cfa6UL, 0x7ade28a5UL, 0xb78e26daUL, 0xadbfa43fUL,
++    0x3a9de42cUL, 0x78920d50UL, 0x5fcc9b6aUL, 0x7e466254UL,
++    0x8d13c2f6UL, 0xd8b8e890UL, 0x39f75e2eUL, 0xc3aff582UL,
++    0x5d80be9fUL, 0xd0937c69UL, 0xd52da96fUL, 0x2512b3cfUL,
++    0xac993bc8UL, 0x187da710UL, 0x9c636ee8UL, 0x3bbb7bdbUL,
++    0x267809cdUL, 0x5918f46eUL, 0x9ab701ecUL, 0x4f9aa883UL,
++    0x956e65e6UL, 0xffe67eaaUL, 0xbccf0821UL, 0x15e8e6efUL,
++    0xe79bd9baUL, 0x6f36ce4aUL, 0x9f09d4eaUL, 0xb07cd629UL,
++    0xa4b2af31UL, 0x3f23312aUL, 0xa59430c6UL, 0xa266c035UL,
++    0x4ebc3774UL, 0x82caa6fcUL, 0x90d0b0e0UL, 0xa7d81533UL,
++    0x04984af1UL, 0xecdaf741UL, 0xcd500e7fUL, 0x91f62f17UL,
++    0x4dd68d76UL, 0xefb04d43UL, 0xaa4d54ccUL, 0x9604dfe4UL,
++    0xd1b5e39eUL, 0x6a881b4cUL, 0x2c1fb8c1UL, 0x65517f46UL,
++    0x5eea049dUL, 0x8c355d01UL, 0x877473faUL, 0x0b412efbUL,
++    0x671d5ab3UL, 0xdbd25292UL, 0x105633e9UL, 0xd647136dUL,
++    0xd7618c9aUL, 0xa10c7a37UL, 0xf8148e59UL, 0x133c89ebUL,
++    0xa927eeceUL, 0x61c935b7UL, 0x1ce5ede1UL, 0x47b13c7aUL,
++    0xd2df599cUL, 0xf2733f55UL, 0x14ce7918UL, 0xc737bf73UL,
++    0xf7cdea53UL, 0xfdaa5b5fUL, 0x3d6f14dfUL, 0x44db8678UL,
++    0xaff381caUL, 0x68c43eb9UL, 0x24342c38UL, 0xa3405fc2UL,
++    0x1dc37216UL, 0xe2250cbcUL, 0x3c498b28UL, 0x0d9541ffUL,
++    0xa8017139UL, 0x0cb3de08UL, 0xb4e49cd8UL, 0x56c19064UL,
++    0xcb84617bUL, 0x32b670d5UL, 0x6c5c7448UL, 0xb85742d0UL,
++};
++
++static const ulong32 Tks0[] = {
++0x00000000UL, 0x0e090d0bUL, 0x1c121a16UL, 0x121b171dUL, 0x3824342cUL, 0x362d3927UL, 0x24362e3aUL, 0x2a3f2331UL, 
++0x70486858UL, 0x7e416553UL, 0x6c5a724eUL, 0x62537f45UL, 0x486c5c74UL, 0x4665517fUL, 0x547e4662UL, 0x5a774b69UL, 
++0xe090d0b0UL, 0xee99ddbbUL, 0xfc82caa6UL, 0xf28bc7adUL, 0xd8b4e49cUL, 0xd6bde997UL, 0xc4a6fe8aUL, 0xcaaff381UL, 
++0x90d8b8e8UL, 0x9ed1b5e3UL, 0x8ccaa2feUL, 0x82c3aff5UL, 0xa8fc8cc4UL, 0xa6f581cfUL, 0xb4ee96d2UL, 0xbae79bd9UL, 
++0xdb3bbb7bUL, 0xd532b670UL, 0xc729a16dUL, 0xc920ac66UL, 0xe31f8f57UL, 0xed16825cUL, 0xff0d9541UL, 0xf104984aUL, 
++0xab73d323UL, 0xa57ade28UL, 0xb761c935UL, 0xb968c43eUL, 0x9357e70fUL, 0x9d5eea04UL, 0x8f45fd19UL, 0x814cf012UL, 
++0x3bab6bcbUL, 0x35a266c0UL, 0x27b971ddUL, 0x29b07cd6UL, 0x038f5fe7UL, 0x0d8652ecUL, 0x1f9d45f1UL, 0x119448faUL, 
++0x4be30393UL, 0x45ea0e98UL, 0x57f11985UL, 0x59f8148eUL, 0x73c737bfUL, 0x7dce3ab4UL, 0x6fd52da9UL, 0x61dc20a2UL, 
++0xad766df6UL, 0xa37f60fdUL, 0xb16477e0UL, 0xbf6d7aebUL, 0x955259daUL, 0x9b5b54d1UL, 0x894043ccUL, 0x87494ec7UL, 
++0xdd3e05aeUL, 0xd33708a5UL, 0xc12c1fb8UL, 0xcf2512b3UL, 0xe51a3182UL, 0xeb133c89UL, 0xf9082b94UL, 0xf701269fUL, 
++0x4de6bd46UL, 0x43efb04dUL, 0x51f4a750UL, 0x5ffdaa5bUL, 0x75c2896aUL, 0x7bcb8461UL, 0x69d0937cUL, 0x67d99e77UL, 
++0x3daed51eUL, 0x33a7d815UL, 0x21bccf08UL, 0x2fb5c203UL, 0x058ae132UL, 0x0b83ec39UL, 0x1998fb24UL, 0x1791f62fUL, 
++0x764dd68dUL, 0x7844db86UL, 0x6a5fcc9bUL, 0x6456c190UL, 0x4e69e2a1UL, 0x4060efaaUL, 0x527bf8b7UL, 0x5c72f5bcUL, 
++0x0605bed5UL, 0x080cb3deUL, 0x1a17a4c3UL, 0x141ea9c8UL, 0x3e218af9UL, 0x302887f2UL, 0x223390efUL, 0x2c3a9de4UL, 
++0x96dd063dUL, 0x98d40b36UL, 0x8acf1c2bUL, 0x84c61120UL, 0xaef93211UL, 0xa0f03f1aUL, 0xb2eb2807UL, 0xbce2250cUL, 
++0xe6956e65UL, 0xe89c636eUL, 0xfa877473UL, 0xf48e7978UL, 0xdeb15a49UL, 0xd0b85742UL, 0xc2a3405fUL, 0xccaa4d54UL, 
++0x41ecdaf7UL, 0x4fe5d7fcUL, 0x5dfec0e1UL, 0x53f7cdeaUL, 0x79c8eedbUL, 0x77c1e3d0UL, 0x65daf4cdUL, 0x6bd3f9c6UL, 
++0x31a4b2afUL, 0x3fadbfa4UL, 0x2db6a8b9UL, 0x23bfa5b2UL, 0x09808683UL, 0x07898b88UL, 0x15929c95UL, 0x1b9b919eUL, 
++0xa17c0a47UL, 0xaf75074cUL, 0xbd6e1051UL, 0xb3671d5aUL, 0x99583e6bUL, 0x97513360UL, 0x854a247dUL, 0x8b432976UL, 
++0xd134621fUL, 0xdf3d6f14UL, 0xcd267809UL, 0xc32f7502UL, 0xe9105633UL, 0xe7195b38UL, 0xf5024c25UL, 0xfb0b412eUL, 
++0x9ad7618cUL, 0x94de6c87UL, 0x86c57b9aUL, 0x88cc7691UL, 0xa2f355a0UL, 0xacfa58abUL, 0xbee14fb6UL, 0xb0e842bdUL, 
++0xea9f09d4UL, 0xe49604dfUL, 0xf68d13c2UL, 0xf8841ec9UL, 0xd2bb3df8UL, 0xdcb230f3UL, 0xcea927eeUL, 0xc0a02ae5UL, 
++0x7a47b13cUL, 0x744ebc37UL, 0x6655ab2aUL, 0x685ca621UL, 0x42638510UL, 0x4c6a881bUL, 0x5e719f06UL, 0x5078920dUL, 
++0x0a0fd964UL, 0x0406d46fUL, 0x161dc372UL, 0x1814ce79UL, 0x322bed48UL, 0x3c22e043UL, 0x2e39f75eUL, 0x2030fa55UL, 
++0xec9ab701UL, 0xe293ba0aUL, 0xf088ad17UL, 0xfe81a01cUL, 0xd4be832dUL, 0xdab78e26UL, 0xc8ac993bUL, 0xc6a59430UL, 
++0x9cd2df59UL, 0x92dbd252UL, 0x80c0c54fUL, 0x8ec9c844UL, 0xa4f6eb75UL, 0xaaffe67eUL, 0xb8e4f163UL, 0xb6edfc68UL, 
++0x0c0a67b1UL, 0x02036abaUL, 0x10187da7UL, 0x1e1170acUL, 0x342e539dUL, 0x3a275e96UL, 0x283c498bUL, 0x26354480UL, 
++0x7c420fe9UL, 0x724b02e2UL, 0x605015ffUL, 0x6e5918f4UL, 0x44663bc5UL, 0x4a6f36ceUL, 0x587421d3UL, 0x567d2cd8UL, 
++0x37a10c7aUL, 0x39a80171UL, 0x2bb3166cUL, 0x25ba1b67UL, 0x0f853856UL, 0x018c355dUL, 0x13972240UL, 0x1d9e2f4bUL, 
++0x47e96422UL, 0x49e06929UL, 0x5bfb7e34UL, 0x55f2733fUL, 0x7fcd500eUL, 0x71c45d05UL, 0x63df4a18UL, 0x6dd64713UL, 
++0xd731dccaUL, 0xd938d1c1UL, 0xcb23c6dcUL, 0xc52acbd7UL, 0xef15e8e6UL, 0xe11ce5edUL, 0xf307f2f0UL, 0xfd0efffbUL, 
++0xa779b492UL, 0xa970b999UL, 0xbb6bae84UL, 0xb562a38fUL, 0x9f5d80beUL, 0x91548db5UL, 0x834f9aa8UL, 0x8d4697a3UL
++};
++
++static const ulong32 Tks1[] = {
++0x00000000UL, 0x0b0e090dUL, 0x161c121aUL, 0x1d121b17UL, 0x2c382434UL, 0x27362d39UL, 0x3a24362eUL, 0x312a3f23UL, 
++0x58704868UL, 0x537e4165UL, 0x4e6c5a72UL, 0x4562537fUL, 0x74486c5cUL, 0x7f466551UL, 0x62547e46UL, 0x695a774bUL, 
++0xb0e090d0UL, 0xbbee99ddUL, 0xa6fc82caUL, 0xadf28bc7UL, 0x9cd8b4e4UL, 0x97d6bde9UL, 0x8ac4a6feUL, 0x81caaff3UL, 
++0xe890d8b8UL, 0xe39ed1b5UL, 0xfe8ccaa2UL, 0xf582c3afUL, 0xc4a8fc8cUL, 0xcfa6f581UL, 0xd2b4ee96UL, 0xd9bae79bUL, 
++0x7bdb3bbbUL, 0x70d532b6UL, 0x6dc729a1UL, 0x66c920acUL, 0x57e31f8fUL, 0x5ced1682UL, 0x41ff0d95UL, 0x4af10498UL, 
++0x23ab73d3UL, 0x28a57adeUL, 0x35b761c9UL, 0x3eb968c4UL, 0x0f9357e7UL, 0x049d5eeaUL, 0x198f45fdUL, 0x12814cf0UL, 
++0xcb3bab6bUL, 0xc035a266UL, 0xdd27b971UL, 0xd629b07cUL, 0xe7038f5fUL, 0xec0d8652UL, 0xf11f9d45UL, 0xfa119448UL, 
++0x934be303UL, 0x9845ea0eUL, 0x8557f119UL, 0x8e59f814UL, 0xbf73c737UL, 0xb47dce3aUL, 0xa96fd52dUL, 0xa261dc20UL, 
++0xf6ad766dUL, 0xfda37f60UL, 0xe0b16477UL, 0xebbf6d7aUL, 0xda955259UL, 0xd19b5b54UL, 0xcc894043UL, 0xc787494eUL, 
++0xaedd3e05UL, 0xa5d33708UL, 0xb8c12c1fUL, 0xb3cf2512UL, 0x82e51a31UL, 0x89eb133cUL, 0x94f9082bUL, 0x9ff70126UL, 
++0x464de6bdUL, 0x4d43efb0UL, 0x5051f4a7UL, 0x5b5ffdaaUL, 0x6a75c289UL, 0x617bcb84UL, 0x7c69d093UL, 0x7767d99eUL, 
++0x1e3daed5UL, 0x1533a7d8UL, 0x0821bccfUL, 0x032fb5c2UL, 0x32058ae1UL, 0x390b83ecUL, 0x241998fbUL, 0x2f1791f6UL, 
++0x8d764dd6UL, 0x867844dbUL, 0x9b6a5fccUL, 0x906456c1UL, 0xa14e69e2UL, 0xaa4060efUL, 0xb7527bf8UL, 0xbc5c72f5UL, 
++0xd50605beUL, 0xde080cb3UL, 0xc31a17a4UL, 0xc8141ea9UL, 0xf93e218aUL, 0xf2302887UL, 0xef223390UL, 0xe42c3a9dUL, 
++0x3d96dd06UL, 0x3698d40bUL, 0x2b8acf1cUL, 0x2084c611UL, 0x11aef932UL, 0x1aa0f03fUL, 0x07b2eb28UL, 0x0cbce225UL, 
++0x65e6956eUL, 0x6ee89c63UL, 0x73fa8774UL, 0x78f48e79UL, 0x49deb15aUL, 0x42d0b857UL, 0x5fc2a340UL, 0x54ccaa4dUL, 
++0xf741ecdaUL, 0xfc4fe5d7UL, 0xe15dfec0UL, 0xea53f7cdUL, 0xdb79c8eeUL, 0xd077c1e3UL, 0xcd65daf4UL, 0xc66bd3f9UL, 
++0xaf31a4b2UL, 0xa43fadbfUL, 0xb92db6a8UL, 0xb223bfa5UL, 0x83098086UL, 0x8807898bUL, 0x9515929cUL, 0x9e1b9b91UL, 
++0x47a17c0aUL, 0x4caf7507UL, 0x51bd6e10UL, 0x5ab3671dUL, 0x6b99583eUL, 0x60975133UL, 0x7d854a24UL, 0x768b4329UL, 
++0x1fd13462UL, 0x14df3d6fUL, 0x09cd2678UL, 0x02c32f75UL, 0x33e91056UL, 0x38e7195bUL, 0x25f5024cUL, 0x2efb0b41UL, 
++0x8c9ad761UL, 0x8794de6cUL, 0x9a86c57bUL, 0x9188cc76UL, 0xa0a2f355UL, 0xabacfa58UL, 0xb6bee14fUL, 0xbdb0e842UL, 
++0xd4ea9f09UL, 0xdfe49604UL, 0xc2f68d13UL, 0xc9f8841eUL, 0xf8d2bb3dUL, 0xf3dcb230UL, 0xeecea927UL, 0xe5c0a02aUL, 
++0x3c7a47b1UL, 0x37744ebcUL, 0x2a6655abUL, 0x21685ca6UL, 0x10426385UL, 0x1b4c6a88UL, 0x065e719fUL, 0x0d507892UL, 
++0x640a0fd9UL, 0x6f0406d4UL, 0x72161dc3UL, 0x791814ceUL, 0x48322bedUL, 0x433c22e0UL, 0x5e2e39f7UL, 0x552030faUL, 
++0x01ec9ab7UL, 0x0ae293baUL, 0x17f088adUL, 0x1cfe81a0UL, 0x2dd4be83UL, 0x26dab78eUL, 0x3bc8ac99UL, 0x30c6a594UL, 
++0x599cd2dfUL, 0x5292dbd2UL, 0x4f80c0c5UL, 0x448ec9c8UL, 0x75a4f6ebUL, 0x7eaaffe6UL, 0x63b8e4f1UL, 0x68b6edfcUL, 
++0xb10c0a67UL, 0xba02036aUL, 0xa710187dUL, 0xac1e1170UL, 0x9d342e53UL, 0x963a275eUL, 0x8b283c49UL, 0x80263544UL, 
++0xe97c420fUL, 0xe2724b02UL, 0xff605015UL, 0xf46e5918UL, 0xc544663bUL, 0xce4a6f36UL, 0xd3587421UL, 0xd8567d2cUL, 
++0x7a37a10cUL, 0x7139a801UL, 0x6c2bb316UL, 0x6725ba1bUL, 0x560f8538UL, 0x5d018c35UL, 0x40139722UL, 0x4b1d9e2fUL, 
++0x2247e964UL, 0x2949e069UL, 0x345bfb7eUL, 0x3f55f273UL, 0x0e7fcd50UL, 0x0571c45dUL, 0x1863df4aUL, 0x136dd647UL, 
++0xcad731dcUL, 0xc1d938d1UL, 0xdccb23c6UL, 0xd7c52acbUL, 0xe6ef15e8UL, 0xede11ce5UL, 0xf0f307f2UL, 0xfbfd0effUL, 
++0x92a779b4UL, 0x99a970b9UL, 0x84bb6baeUL, 0x8fb562a3UL, 0xbe9f5d80UL, 0xb591548dUL, 0xa8834f9aUL, 0xa38d4697UL
++};
++
++static const ulong32 Tks2[] = {
++0x00000000UL, 0x0d0b0e09UL, 0x1a161c12UL, 0x171d121bUL, 0x342c3824UL, 0x3927362dUL, 0x2e3a2436UL, 0x23312a3fUL, 
++0x68587048UL, 0x65537e41UL, 0x724e6c5aUL, 0x7f456253UL, 0x5c74486cUL, 0x517f4665UL, 0x4662547eUL, 0x4b695a77UL, 
++0xd0b0e090UL, 0xddbbee99UL, 0xcaa6fc82UL, 0xc7adf28bUL, 0xe49cd8b4UL, 0xe997d6bdUL, 0xfe8ac4a6UL, 0xf381caafUL, 
++0xb8e890d8UL, 0xb5e39ed1UL, 0xa2fe8ccaUL, 0xaff582c3UL, 0x8cc4a8fcUL, 0x81cfa6f5UL, 0x96d2b4eeUL, 0x9bd9bae7UL, 
++0xbb7bdb3bUL, 0xb670d532UL, 0xa16dc729UL, 0xac66c920UL, 0x8f57e31fUL, 0x825ced16UL, 0x9541ff0dUL, 0x984af104UL, 
++0xd323ab73UL, 0xde28a57aUL, 0xc935b761UL, 0xc43eb968UL, 0xe70f9357UL, 0xea049d5eUL, 0xfd198f45UL, 0xf012814cUL, 
++0x6bcb3babUL, 0x66c035a2UL, 0x71dd27b9UL, 0x7cd629b0UL, 0x5fe7038fUL, 0x52ec0d86UL, 0x45f11f9dUL, 0x48fa1194UL, 
++0x03934be3UL, 0x0e9845eaUL, 0x198557f1UL, 0x148e59f8UL, 0x37bf73c7UL, 0x3ab47dceUL, 0x2da96fd5UL, 0x20a261dcUL, 
++0x6df6ad76UL, 0x60fda37fUL, 0x77e0b164UL, 0x7aebbf6dUL, 0x59da9552UL, 0x54d19b5bUL, 0x43cc8940UL, 0x4ec78749UL, 
++0x05aedd3eUL, 0x08a5d337UL, 0x1fb8c12cUL, 0x12b3cf25UL, 0x3182e51aUL, 0x3c89eb13UL, 0x2b94f908UL, 0x269ff701UL, 
++0xbd464de6UL, 0xb04d43efUL, 0xa75051f4UL, 0xaa5b5ffdUL, 0x896a75c2UL, 0x84617bcbUL, 0x937c69d0UL, 0x9e7767d9UL, 
++0xd51e3daeUL, 0xd81533a7UL, 0xcf0821bcUL, 0xc2032fb5UL, 0xe132058aUL, 0xec390b83UL, 0xfb241998UL, 0xf62f1791UL, 
++0xd68d764dUL, 0xdb867844UL, 0xcc9b6a5fUL, 0xc1906456UL, 0xe2a14e69UL, 0xefaa4060UL, 0xf8b7527bUL, 0xf5bc5c72UL, 
++0xbed50605UL, 0xb3de080cUL, 0xa4c31a17UL, 0xa9c8141eUL, 0x8af93e21UL, 0x87f23028UL, 0x90ef2233UL, 0x9de42c3aUL, 
++0x063d96ddUL, 0x0b3698d4UL, 0x1c2b8acfUL, 0x112084c6UL, 0x3211aef9UL, 0x3f1aa0f0UL, 0x2807b2ebUL, 0x250cbce2UL, 
++0x6e65e695UL, 0x636ee89cUL, 0x7473fa87UL, 0x7978f48eUL, 0x5a49deb1UL, 0x5742d0b8UL, 0x405fc2a3UL, 0x4d54ccaaUL, 
++0xdaf741ecUL, 0xd7fc4fe5UL, 0xc0e15dfeUL, 0xcdea53f7UL, 0xeedb79c8UL, 0xe3d077c1UL, 0xf4cd65daUL, 0xf9c66bd3UL, 
++0xb2af31a4UL, 0xbfa43fadUL, 0xa8b92db6UL, 0xa5b223bfUL, 0x86830980UL, 0x8b880789UL, 0x9c951592UL, 0x919e1b9bUL, 
++0x0a47a17cUL, 0x074caf75UL, 0x1051bd6eUL, 0x1d5ab367UL, 0x3e6b9958UL, 0x33609751UL, 0x247d854aUL, 0x29768b43UL, 
++0x621fd134UL, 0x6f14df3dUL, 0x7809cd26UL, 0x7502c32fUL, 0x5633e910UL, 0x5b38e719UL, 0x4c25f502UL, 0x412efb0bUL, 
++0x618c9ad7UL, 0x6c8794deUL, 0x7b9a86c5UL, 0x769188ccUL, 0x55a0a2f3UL, 0x58abacfaUL, 0x4fb6bee1UL, 0x42bdb0e8UL, 
++0x09d4ea9fUL, 0x04dfe496UL, 0x13c2f68dUL, 0x1ec9f884UL, 0x3df8d2bbUL, 0x30f3dcb2UL, 0x27eecea9UL, 0x2ae5c0a0UL, 
++0xb13c7a47UL, 0xbc37744eUL, 0xab2a6655UL, 0xa621685cUL, 0x85104263UL, 0x881b4c6aUL, 0x9f065e71UL, 0x920d5078UL, 
++0xd9640a0fUL, 0xd46f0406UL, 0xc372161dUL, 0xce791814UL, 0xed48322bUL, 0xe0433c22UL, 0xf75e2e39UL, 0xfa552030UL, 
++0xb701ec9aUL, 0xba0ae293UL, 0xad17f088UL, 0xa01cfe81UL, 0x832dd4beUL, 0x8e26dab7UL, 0x993bc8acUL, 0x9430c6a5UL, 
++0xdf599cd2UL, 0xd25292dbUL, 0xc54f80c0UL, 0xc8448ec9UL, 0xeb75a4f6UL, 0xe67eaaffUL, 0xf163b8e4UL, 0xfc68b6edUL, 
++0x67b10c0aUL, 0x6aba0203UL, 0x7da71018UL, 0x70ac1e11UL, 0x539d342eUL, 0x5e963a27UL, 0x498b283cUL, 0x44802635UL, 
++0x0fe97c42UL, 0x02e2724bUL, 0x15ff6050UL, 0x18f46e59UL, 0x3bc54466UL, 0x36ce4a6fUL, 0x21d35874UL, 0x2cd8567dUL, 
++0x0c7a37a1UL, 0x017139a8UL, 0x166c2bb3UL, 0x1b6725baUL, 0x38560f85UL, 0x355d018cUL, 0x22401397UL, 0x2f4b1d9eUL, 
++0x642247e9UL, 0x692949e0UL, 0x7e345bfbUL, 0x733f55f2UL, 0x500e7fcdUL, 0x5d0571c4UL, 0x4a1863dfUL, 0x47136dd6UL, 
++0xdccad731UL, 0xd1c1d938UL, 0xc6dccb23UL, 0xcbd7c52aUL, 0xe8e6ef15UL, 0xe5ede11cUL, 0xf2f0f307UL, 0xfffbfd0eUL, 
++0xb492a779UL, 0xb999a970UL, 0xae84bb6bUL, 0xa38fb562UL, 0x80be9f5dUL, 0x8db59154UL, 0x9aa8834fUL, 0x97a38d46UL
++};
++
++static const ulong32 Tks3[] = {
++0x00000000UL, 0x090d0b0eUL, 0x121a161cUL, 0x1b171d12UL, 0x24342c38UL, 0x2d392736UL, 0x362e3a24UL, 0x3f23312aUL, 
++0x48685870UL, 0x4165537eUL, 0x5a724e6cUL, 0x537f4562UL, 0x6c5c7448UL, 0x65517f46UL, 0x7e466254UL, 0x774b695aUL, 
++0x90d0b0e0UL, 0x99ddbbeeUL, 0x82caa6fcUL, 0x8bc7adf2UL, 0xb4e49cd8UL, 0xbde997d6UL, 0xa6fe8ac4UL, 0xaff381caUL, 
++0xd8b8e890UL, 0xd1b5e39eUL, 0xcaa2fe8cUL, 0xc3aff582UL, 0xfc8cc4a8UL, 0xf581cfa6UL, 0xee96d2b4UL, 0xe79bd9baUL, 
++0x3bbb7bdbUL, 0x32b670d5UL, 0x29a16dc7UL, 0x20ac66c9UL, 0x1f8f57e3UL, 0x16825cedUL, 0x0d9541ffUL, 0x04984af1UL, 
++0x73d323abUL, 0x7ade28a5UL, 0x61c935b7UL, 0x68c43eb9UL, 0x57e70f93UL, 0x5eea049dUL, 0x45fd198fUL, 0x4cf01281UL, 
++0xab6bcb3bUL, 0xa266c035UL, 0xb971dd27UL, 0xb07cd629UL, 0x8f5fe703UL, 0x8652ec0dUL, 0x9d45f11fUL, 0x9448fa11UL, 
++0xe303934bUL, 0xea0e9845UL, 0xf1198557UL, 0xf8148e59UL, 0xc737bf73UL, 0xce3ab47dUL, 0xd52da96fUL, 0xdc20a261UL, 
++0x766df6adUL, 0x7f60fda3UL, 0x6477e0b1UL, 0x6d7aebbfUL, 0x5259da95UL, 0x5b54d19bUL, 0x4043cc89UL, 0x494ec787UL, 
++0x3e05aeddUL, 0x3708a5d3UL, 0x2c1fb8c1UL, 0x2512b3cfUL, 0x1a3182e5UL, 0x133c89ebUL, 0x082b94f9UL, 0x01269ff7UL, 
++0xe6bd464dUL, 0xefb04d43UL, 0xf4a75051UL, 0xfdaa5b5fUL, 0xc2896a75UL, 0xcb84617bUL, 0xd0937c69UL, 0xd99e7767UL, 
++0xaed51e3dUL, 0xa7d81533UL, 0xbccf0821UL, 0xb5c2032fUL, 0x8ae13205UL, 0x83ec390bUL, 0x98fb2419UL, 0x91f62f17UL, 
++0x4dd68d76UL, 0x44db8678UL, 0x5fcc9b6aUL, 0x56c19064UL, 0x69e2a14eUL, 0x60efaa40UL, 0x7bf8b752UL, 0x72f5bc5cUL, 
++0x05bed506UL, 0x0cb3de08UL, 0x17a4c31aUL, 0x1ea9c814UL, 0x218af93eUL, 0x2887f230UL, 0x3390ef22UL, 0x3a9de42cUL, 
++0xdd063d96UL, 0xd40b3698UL, 0xcf1c2b8aUL, 0xc6112084UL, 0xf93211aeUL, 0xf03f1aa0UL, 0xeb2807b2UL, 0xe2250cbcUL, 
++0x956e65e6UL, 0x9c636ee8UL, 0x877473faUL, 0x8e7978f4UL, 0xb15a49deUL, 0xb85742d0UL, 0xa3405fc2UL, 0xaa4d54ccUL, 
++0xecdaf741UL, 0xe5d7fc4fUL, 0xfec0e15dUL, 0xf7cdea53UL, 0xc8eedb79UL, 0xc1e3d077UL, 0xdaf4cd65UL, 0xd3f9c66bUL, 
++0xa4b2af31UL, 0xadbfa43fUL, 0xb6a8b92dUL, 0xbfa5b223UL, 0x80868309UL, 0x898b8807UL, 0x929c9515UL, 0x9b919e1bUL, 
++0x7c0a47a1UL, 0x75074cafUL, 0x6e1051bdUL, 0x671d5ab3UL, 0x583e6b99UL, 0x51336097UL, 0x4a247d85UL, 0x4329768bUL, 
++0x34621fd1UL, 0x3d6f14dfUL, 0x267809cdUL, 0x2f7502c3UL, 0x105633e9UL, 0x195b38e7UL, 0x024c25f5UL, 0x0b412efbUL, 
++0xd7618c9aUL, 0xde6c8794UL, 0xc57b9a86UL, 0xcc769188UL, 0xf355a0a2UL, 0xfa58abacUL, 0xe14fb6beUL, 0xe842bdb0UL, 
++0x9f09d4eaUL, 0x9604dfe4UL, 0x8d13c2f6UL, 0x841ec9f8UL, 0xbb3df8d2UL, 0xb230f3dcUL, 0xa927eeceUL, 0xa02ae5c0UL, 
++0x47b13c7aUL, 0x4ebc3774UL, 0x55ab2a66UL, 0x5ca62168UL, 0x63851042UL, 0x6a881b4cUL, 0x719f065eUL, 0x78920d50UL, 
++0x0fd9640aUL, 0x06d46f04UL, 0x1dc37216UL, 0x14ce7918UL, 0x2bed4832UL, 0x22e0433cUL, 0x39f75e2eUL, 0x30fa5520UL, 
++0x9ab701ecUL, 0x93ba0ae2UL, 0x88ad17f0UL, 0x81a01cfeUL, 0xbe832dd4UL, 0xb78e26daUL, 0xac993bc8UL, 0xa59430c6UL, 
++0xd2df599cUL, 0xdbd25292UL, 0xc0c54f80UL, 0xc9c8448eUL, 0xf6eb75a4UL, 0xffe67eaaUL, 0xe4f163b8UL, 0xedfc68b6UL, 
++0x0a67b10cUL, 0x036aba02UL, 0x187da710UL, 0x1170ac1eUL, 0x2e539d34UL, 0x275e963aUL, 0x3c498b28UL, 0x35448026UL, 
++0x420fe97cUL, 0x4b02e272UL, 0x5015ff60UL, 0x5918f46eUL, 0x663bc544UL, 0x6f36ce4aUL, 0x7421d358UL, 0x7d2cd856UL, 
++0xa10c7a37UL, 0xa8017139UL, 0xb3166c2bUL, 0xba1b6725UL, 0x8538560fUL, 0x8c355d01UL, 0x97224013UL, 0x9e2f4b1dUL, 
++0xe9642247UL, 0xe0692949UL, 0xfb7e345bUL, 0xf2733f55UL, 0xcd500e7fUL, 0xc45d0571UL, 0xdf4a1863UL, 0xd647136dUL, 
++0x31dccad7UL, 0x38d1c1d9UL, 0x23c6dccbUL, 0x2acbd7c5UL, 0x15e8e6efUL, 0x1ce5ede1UL, 0x07f2f0f3UL, 0x0efffbfdUL, 
++0x79b492a7UL, 0x70b999a9UL, 0x6bae84bbUL, 0x62a38fb5UL, 0x5d80be9fUL, 0x548db591UL, 0x4f9aa883UL, 0x4697a38dUL
++};
++
++#endif /* SMALL CODE */
++
++static const ulong32 rcon[] = {
++    0x01000000UL, 0x02000000UL, 0x04000000UL, 0x08000000UL,
++    0x10000000UL, 0x20000000UL, 0x40000000UL, 0x80000000UL,
++    0x1B000000UL, 0x36000000UL, /* for 128-bit blocks, AES never uses more than 10 rcon values */
++};
++
++
++static int    aes_setup(const unsigned char *key, int keylen, int rounds, aes_CBC *skey);
++static void   aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_CBC *skey);
++static void   aes_ecb_decrypt(const unsigned char *ct, unsigned char *pt, aes_CBC *skey);
++
++#ifdef CLEAN_STACK
++static void _aes_ecb_decrypt(const unsigned char *ct, unsigned char *pt, aes_CBC *skey);
++static void _aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_CBC *skey);
++#endif
++
++int matrixAesInit(sslCipherContext_t *ctx, unsigned char *IV, unsigned char *key, int keylen)
++{
++      int             x, err;
++
++      if (IV == NULL || key == NULL || ctx == NULL) {
++              return -1;
++      }
++/*
++      setup cipher
++ */
++      if ((err = aes_setup(key, keylen, 0, &ctx->aes)) != CRYPT_OK) {
++              return -1;
++      }
++/*
++      copy IV
++ */
++      ctx->aes.blocklen = 16;
++      for (x = 0; x < ctx->aes.blocklen; x++) {
++              ctx->aes.IV[x] = IV[x];
++      }
++      return 0;
++}
++
++int matrixAesEncrypt(sslCipherContext_t *ctx, unsigned char *pt, unsigned char *ct, int len)
++{
++      int                             x, i;
++      unsigned char   tmp[MAXBLOCKSIZE];
++
++      if (pt == NULL || ct == NULL || ctx == NULL || (len & 0x7) != 0) {
++              matrixStrDebugMsg("Bad parameters to matrixAesEncrypt\n", NULL);
++              return -1;
++      }
++
++/*
++      is blocklen valid?
++ */
++      if (ctx->aes.blocklen < 0 || ctx->aes.blocklen > 
++                      (int)sizeof(ctx->aes.IV)) {
++              return -1;
++      }
++
++      for (i = 0; i < len; i += ctx->aes.blocklen) {
++/*
++              xor IV against plaintext
++ */
++              for (x = 0; x < ctx->aes.blocklen; x++) {
++                      tmp[x] = pt[x] ^ ctx->aes.IV[x];
++              }
++/*
++              encrypt
++ */
++              aes_ecb_encrypt(tmp, ct, &ctx->aes);
++
++/*
++              store IV [ciphertext] for a future block
++ */
++              for (x = 0; x < ctx->aes.blocklen; x++) {
++                      ctx->aes.IV[x] = ct[x];
++              }
++              ct += ctx->aes.blocklen;
++              pt += ctx->aes.blocklen;
++      }
++
++#ifdef CLEAN_STACK
++      zeromem(tmp, sizeof(tmp));
++#endif
++      return len;
++}
++
++int matrixAesDecrypt(sslCipherContext_t *ctx, unsigned char *ct, unsigned char *pt, int len)
++{
++      int                             x, i;
++      unsigned char   tmp[MAXBLOCKSIZE], tmp2[MAXBLOCKSIZE];
++
++      if (pt == NULL || ct == NULL || ctx == NULL || (len & 0x7) != 0) {
++              matrixStrDebugMsg("Bad parameters to matrixAesDecrypt\n", NULL);
++              return -1;
++      }
++
++/*
++      is blocklen valid?
++ */
++      if (ctx->aes.blocklen < 0 || ctx->aes.blocklen > 
++              (int)sizeof(ctx->aes.IV)) {
++              return -1;
++      }
++      for (i = 0; i < len; i += ctx->aes.blocklen) {
++/*
++              decrypt the block from ct into tmp
++ */
++              aes_ecb_decrypt(ct, tmp, &ctx->aes);
++/*
++              xor IV against the plaintext of the previous step
++ */
++              for (x = 0; x < ctx->aes.blocklen; x++) { 
++/*
++                      copy CT in case ct == pt
++ */
++                      tmp2[x] = ct[x]; 
++/*
++                      actually decrypt the byte
++ */
++                      pt[x] = tmp[x] ^ ctx->aes.IV[x]; 
++              }
++/*
++              replace IV with this current ciphertext
++ */
++              for (x = 0; x < ctx->aes.blocklen; x++) {
++                      ctx->aes.IV[x] = tmp2[x];
++              }
++              ct += ctx->aes.blocklen;
++              pt += ctx->aes.blocklen;
++      }
++#ifdef CLEAN_STACK
++      zeromem(tmp, sizeof(tmp));
++      zeromem(tmp2, sizeof(tmp2));
++#endif
++      return len;
++}
++
++int aes_setup(const unsigned char *key, int keylen, int rounds, aes_CBC *skey)
++{
++      int                     i, j;
++      ulong32         temp, *rk, *rrk;
++      
++      if (key == NULL || skey == NULL) {
++              return -1;
++      }
++      
++      if (keylen != 16 && keylen != 24 && keylen != 32) {
++              return CRYPT_INVALID_KEYSIZE;
++      }
++      
++      if (rounds != 0 && rounds != (10 + ((keylen/8)-2)*2)) {
++              return CRYPT_INVALID_ROUNDS;
++      }
++      
++      skey->key.Nr = 10 + ((keylen/8)-2)*2;
++              
++/*
++      setup the forward key
++ */
++      i                               = 0;
++      rk                              = skey->key.eK;
++      LOAD32H(rk[0], key         );
++      LOAD32H(rk[1], key +  4);
++      LOAD32H(rk[2], key +  8);
++      LOAD32H(rk[3], key + 12);
++      if (keylen == 16) {
++              j = 44;
++              for (;;) {
++                      temp  = rk[3];
++                      rk[4] = rk[0] ^
++                              (Te4_3[byte(temp, 2)]) ^
++                              (Te4_2[byte(temp, 1)]) ^
++                              (Te4_1[byte(temp, 0)]) ^
++                              (Te4_0[byte(temp, 3)]) ^
++                              rcon[i];
++                      rk[5] = rk[1] ^ rk[4];
++                      rk[6] = rk[2] ^ rk[5];
++                      rk[7] = rk[3] ^ rk[6];
++                      if (++i == 10) {
++                              break;
++                      }
++                      rk += 4;
++              }
++      } else if (keylen == 24) {
++              j = 52;
++              LOAD32H(rk[4], key + 16);
++              LOAD32H(rk[5], key + 20);
++              for (;;) {
++              #ifdef _MSC_VER
++                      temp = skey->key.eK[rk - skey->key.eK + 5];
++              #else
++                      temp = rk[5];
++              #endif /* _MSC_VER */
++                      rk[ 6] = rk[ 0] ^
++                              (Te4_3[byte(temp, 2)]) ^
++                              (Te4_2[byte(temp, 1)]) ^
++                              (Te4_1[byte(temp, 0)]) ^
++                              (Te4_0[byte(temp, 3)]) ^
++                              rcon[i];
++                      rk[ 7] = rk[ 1] ^ rk[ 6];
++                      rk[ 8] = rk[ 2] ^ rk[ 7];
++                      rk[ 9] = rk[ 3] ^ rk[ 8];
++                      if (++i == 8) {
++                              break;
++                      }
++                      rk[10] = rk[ 4] ^ rk[ 9];
++                      rk[11] = rk[ 5] ^ rk[10];
++                      rk += 6;
++              }
++      } else if (keylen == 32) {
++              j = 60;
++              LOAD32H(rk[4], key + 16);
++              LOAD32H(rk[5], key + 20);
++              LOAD32H(rk[6], key + 24);
++              LOAD32H(rk[7], key + 28);
++              for (;;) {
++              #ifdef _MSC_VER
++                      temp = skey->key.eK[rk - skey->key.eK + 7];
++              #else
++                      temp = rk[7];
++              #endif /* _MSC_VER */
++                      rk[ 8] = rk[ 0] ^
++                              (Te4_3[byte(temp, 2)]) ^
++                              (Te4_2[byte(temp, 1)]) ^
++                              (Te4_1[byte(temp, 0)]) ^
++                              (Te4_0[byte(temp, 3)]) ^
++                              rcon[i];
++                      rk[ 9] = rk[ 1] ^ rk[ 8];
++                      rk[10] = rk[ 2] ^ rk[ 9];
++                      rk[11] = rk[ 3] ^ rk[10];
++                      if (++i == 7) {
++                              break;
++                      }
++                      temp = rk[11];
++                      rk[12] = rk[ 4] ^
++                              (Te4_3[byte(temp, 3)]) ^
++                              (Te4_2[byte(temp, 2)]) ^
++                              (Te4_1[byte(temp, 1)]) ^
++                              (Te4_0[byte(temp, 0)]);
++                      rk[13] = rk[ 5] ^ rk[12];
++                      rk[14] = rk[ 6] ^ rk[13];
++                      rk[15] = rk[ 7] ^ rk[14];
++                      rk += 8;
++              }
++      } else {
++/*
++              this can't happen
++ */
++              j = 4;
++      }
++      
++/*
++      setup the inverse key now
++ */
++      rk              = skey->key.dK;
++      rrk             = skey->key.eK + j - 4; 
++      
++/*
++      apply the inverse MixColumn transform to all round keys but the first and the last:
++ */
++      /* copy first */
++      *rk++   = *rrk++;
++      *rk++   = *rrk++;
++      *rk++   = *rrk++;
++      *rk             = *rrk;
++      rk -= 3; rrk -= 3;
++      
++      for (i = 1; i < skey->key.Nr; i++) {
++              rrk     -= 4;
++              rk      += 4;
++#ifdef SMALL_CODE
++              temp = rrk[0];
++              rk[0] =
++                      Td0(255 & Te4[byte(temp, 3)]) ^
++                      Td1(255 & Te4[byte(temp, 2)]) ^
++                      Td2(255 & Te4[byte(temp, 1)]) ^
++                      Td3(255 & Te4[byte(temp, 0)]);
++              temp = rrk[1];
++              rk[1] =
++                      Td0(255 & Te4[byte(temp, 3)]) ^
++                      Td1(255 & Te4[byte(temp, 2)]) ^
++                      Td2(255 & Te4[byte(temp, 1)]) ^
++                      Td3(255 & Te4[byte(temp, 0)]);
++              temp = rrk[2];
++              rk[2] =
++                      Td0(255 & Te4[byte(temp, 3)]) ^
++                      Td1(255 & Te4[byte(temp, 2)]) ^
++                      Td2(255 & Te4[byte(temp, 1)]) ^
++                      Td3(255 & Te4[byte(temp, 0)]);
++              temp = rrk[3];
++              rk[3] =
++                      Td0(255 & Te4[byte(temp, 3)]) ^
++                      Td1(255 & Te4[byte(temp, 2)]) ^
++                      Td2(255 & Te4[byte(temp, 1)]) ^
++                      Td3(255 & Te4[byte(temp, 0)]);
++#else /* SMALL CODE */
++              temp = rrk[0];
++              rk[0] =
++                      Tks0[byte(temp, 3)] ^
++                      Tks1[byte(temp, 2)] ^
++                      Tks2[byte(temp, 1)] ^
++                      Tks3[byte(temp, 0)];
++              temp = rrk[1];
++              rk[1] =
++                      Tks0[byte(temp, 3)] ^
++                      Tks1[byte(temp, 2)] ^
++                      Tks2[byte(temp, 1)] ^
++                      Tks3[byte(temp, 0)];
++              temp = rrk[2];
++              rk[2] =
++                      Tks0[byte(temp, 3)] ^
++                      Tks1[byte(temp, 2)] ^
++                      Tks2[byte(temp, 1)] ^
++                      Tks3[byte(temp, 0)];
++              temp = rrk[3];
++              rk[3] =
++                      Tks0[byte(temp, 3)] ^
++                      Tks1[byte(temp, 2)] ^
++                      Tks2[byte(temp, 1)] ^
++                      Tks3[byte(temp, 0)];
++#endif /* SMALL CODE */
++      }
++
++      /* copy last */
++      rrk     -= 4;
++      rk      += 4;
++      *rk++ = *rrk++;
++      *rk++ = *rrk++;
++      *rk++ = *rrk++;
++      *rk       = *rrk;
++
++      return CRYPT_OK;
++}
++
++#ifdef CLEAN_STACK
++void aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_CBC *skey)
++{
++      _aes_ecb_encrypt(pt, ct, skey);
++      burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
++}
++#endif /* CLEAN_STACK */
++
++#ifdef CLEAN_STACK
++static void _aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_CBC *skey)
++#else
++void aes_ecb_encrypt(const unsigned char *pt, unsigned char *ct, aes_CBC *skey)
++#endif /* CLEAN_STACK */
++{
++              ulong32         s0, s1, s2, s3, t0, t1, t2, t3, *rk;
++              int                     Nr, r;
++
++      if (pt == NULL || ct == NULL || skey == NULL) {
++              return;
++      }
++      
++      Nr = skey->key.Nr;
++      rk = skey->key.eK;
++      
++/*
++      map byte array block to cipher state
++      and add initial round key:
++ */
++      LOAD32H(s0, pt     ); s0 ^= rk[0];
++      LOAD32H(s1, pt +  4); s1 ^= rk[1];
++      LOAD32H(s2, pt +  8); s2 ^= rk[2];
++      LOAD32H(s3, pt + 12); s3 ^= rk[3];
++
++/*
++      Nr - 1 full rounds:
++ */
++      r = Nr >> 1;
++      for (;;) {
++
++              t0 =
++                      Te0(byte(s0, 3)) ^
++                      Te1(byte(s1, 2)) ^
++                      Te2(byte(s2, 1)) ^
++                      Te3(byte(s3, 0)) ^
++                      rk[4];
++              t1 =
++                      Te0(byte(s1, 3)) ^
++                      Te1(byte(s2, 2)) ^
++                      Te2(byte(s3, 1)) ^
++                      Te3(byte(s0, 0)) ^
++                      rk[5];
++              t2 =
++                      Te0(byte(s2, 3)) ^
++                      Te1(byte(s3, 2)) ^
++                      Te2(byte(s0, 1)) ^
++                      Te3(byte(s1, 0)) ^
++                      rk[6];
++              t3 =
++                      Te0(byte(s3, 3)) ^
++                      Te1(byte(s0, 2)) ^
++                      Te2(byte(s1, 1)) ^
++                      Te3(byte(s2, 0)) ^
++                      rk[7];
++
++              rk += 8;
++              if (--r == 0) {
++                      break;
++              }
++
++              s0 =
++                      Te0(byte(t0, 3)) ^
++                      Te1(byte(t1, 2)) ^
++                      Te2(byte(t2, 1)) ^
++                      Te3(byte(t3, 0)) ^
++                      rk[0];
++              s1 =
++                      Te0(byte(t1, 3)) ^
++                      Te1(byte(t2, 2)) ^
++                      Te2(byte(t3, 1)) ^
++                      Te3(byte(t0, 0)) ^
++                      rk[1];
++              s2 =
++                      Te0(byte(t2, 3)) ^
++                      Te1(byte(t3, 2)) ^
++                      Te2(byte(t0, 1)) ^
++                      Te3(byte(t1, 0)) ^
++                      rk[2];
++              s3 =
++                      Te0(byte(t3, 3)) ^
++                      Te1(byte(t0, 2)) ^
++                      Te2(byte(t1, 1)) ^
++                      Te3(byte(t2, 0)) ^
++                      rk[3];
++      }
++/*
++              apply last round and map cipher state to byte array block:
++ */
++      s0 =
++              (Te4_3[byte(t0, 3)]) ^
++              (Te4_2[byte(t1, 2)]) ^
++              (Te4_1[byte(t2, 1)]) ^
++              (Te4_0[byte(t3, 0)]) ^
++              rk[0];
++      STORE32H(s0, ct);
++      s1 =
++              (Te4_3[byte(t1, 3)]) ^
++              (Te4_2[byte(t2, 2)]) ^
++              (Te4_1[byte(t3, 1)]) ^
++              (Te4_0[byte(t0, 0)]) ^
++              rk[1];
++      STORE32H(s1, ct+4);
++      s2 =
++              (Te4_3[byte(t2, 3)]) ^
++              (Te4_2[byte(t3, 2)]) ^
++              (Te4_1[byte(t0, 1)]) ^
++              (Te4_0[byte(t1, 0)]) ^
++              rk[2];
++      STORE32H(s2, ct+8);
++      s3 =
++              (Te4_3[byte(t3, 3)]) ^
++              (Te4_2[byte(t0, 2)]) ^
++              (Te4_1[byte(t1, 1)]) ^
++              (Te4_0[byte(t2, 0)]) ^ 
++              rk[3];
++      STORE32H(s3, ct+12);
++}
++
++#ifdef CLEAN_STACK
++void aes_ecb_decrypt(const unsigned char *pt, unsigned char *ct, aes_CBC *skey)
++{
++      _aes_ecb_decrypt(pt, ct, skey);
++      burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
++}
++#endif /* CLEAN_STACK */
++
++#ifdef CLEAN_STACK
++static void _aes_ecb_decrypt(const unsigned char *ct, unsigned char *pt, aes_CBC *skey)
++#else
++void aes_ecb_decrypt(const unsigned char *ct, unsigned char *pt, aes_CBC *skey)
++#endif /* CLEAN_STACK */
++{
++      ulong32         s0, s1, s2, s3, t0, t1, t2, t3, *rk;
++      int                     Nr, r;
++
++      if (pt == NULL || ct == NULL || skey == NULL) {
++              return;
++      }
++
++      Nr = skey->key.Nr;
++      rk = skey->key.dK;
++
++/*
++      map byte array block to cipher state and add initial round key:
++ */
++      LOAD32H(s0, ct          ); s0 ^= rk[0];
++      LOAD32H(s1, ct  +  4); s1 ^= rk[1];
++      LOAD32H(s2, ct  +  8); s2 ^= rk[2];
++      LOAD32H(s3, ct  + 12); s3 ^= rk[3];
++
++/*
++      Nr - 1 full rounds:
++ */
++      r = Nr >> 1;
++      for     (;;) {
++
++              t0 =
++                      Td0(byte(s0, 3)) ^
++                      Td1(byte(s3, 2)) ^
++                      Td2(byte(s2, 1)) ^
++                      Td3(byte(s1, 0)) ^
++                      rk[4];
++              t1 =
++                      Td0(byte(s1, 3)) ^
++                      Td1(byte(s0, 2)) ^
++                      Td2(byte(s3, 1)) ^
++                      Td3(byte(s2, 0)) ^
++                      rk[5];
++              t2 =
++                      Td0(byte(s2, 3)) ^
++                      Td1(byte(s1, 2)) ^
++                      Td2(byte(s0, 1)) ^
++                      Td3(byte(s3, 0)) ^
++                      rk[6];
++              t3 =
++                      Td0(byte(s3, 3)) ^
++                      Td1(byte(s2, 2)) ^
++                      Td2(byte(s1, 1)) ^
++                      Td3(byte(s0, 0)) ^
++                      rk[7];
++
++              rk += 8;
++              if (--r == 0) {
++                      break;
++              }
++
++              s0 =
++                      Td0(byte(t0, 3)) ^
++                      Td1(byte(t3, 2)) ^
++                      Td2(byte(t2, 1)) ^
++                      Td3(byte(t1, 0)) ^
++                      rk[0];
++              s1 =
++                      Td0(byte(t1, 3)) ^
++                      Td1(byte(t0, 2)) ^
++                      Td2(byte(t3, 1)) ^
++                      Td3(byte(t2, 0)) ^
++                      rk[1];
++              s2 =
++                      Td0(byte(t2, 3)) ^
++                      Td1(byte(t1, 2)) ^
++                      Td2(byte(t0, 1)) ^
++                      Td3(byte(t3, 0)) ^
++                      rk[2];
++              s3 =
++                      Td0(byte(t3, 3)) ^
++                      Td1(byte(t2, 2)) ^
++                      Td2(byte(t1, 1)) ^
++                      Td3(byte(t0, 0)) ^
++                      rk[3];
++      }
++
++/*
++      apply last round and map cipher state to byte array block:
++ */
++      s0 =
++              (Td4[byte(t0, 3)] & 0xff000000) ^
++              (Td4[byte(t3, 2)] & 0x00ff0000) ^
++              (Td4[byte(t2, 1)] & 0x0000ff00) ^
++              (Td4[byte(t1, 0)] & 0x000000ff) ^
++              rk[0];
++      STORE32H(s0, pt);
++      s1 =
++              (Td4[byte(t1, 3)] & 0xff000000) ^
++              (Td4[byte(t0, 2)] & 0x00ff0000) ^
++              (Td4[byte(t3, 1)] & 0x0000ff00) ^
++              (Td4[byte(t2, 0)] & 0x000000ff) ^
++              rk[1];
++      STORE32H(s1, pt+4);
++      s2 =
++              (Td4[byte(t2, 3)] & 0xff000000) ^
++              (Td4[byte(t1, 2)] & 0x00ff0000) ^
++              (Td4[byte(t0, 1)] & 0x0000ff00) ^
++              (Td4[byte(t3, 0)] & 0x000000ff) ^
++              rk[2];
++      STORE32H(s2, pt+8);
++      s3 =
++              (Td4[byte(t3, 3)] & 0xff000000) ^
++              (Td4[byte(t2, 2)] & 0x00ff0000) ^
++              (Td4[byte(t1, 1)] & 0x0000ff00) ^
++              (Td4[byte(t0, 0)] & 0x000000ff) ^
++              rk[3];
++      STORE32H(s3, pt+12);
++}
++
++#ifdef CLEAN_STACK
++void aes(const unsigned char *ct, unsigned char *pt, aes_CBC *skey) 
++{
++      _aes_ecb_decrypt(ct, pt, skey);
++      burn_stack(sizeof(unsigned long)*8 + sizeof(unsigned long*) + sizeof(int)*2);
++}
++#endif /* CLEAN_STACK */
++
++
++#ifdef PEERSEC_TEST
++
++int matrixAesTest()
++{
++      int err;
++      static const struct {
++              int keylen;
++              unsigned char key[32], pt[16], ct[16];
++      } tests[] = {
++      { 16,
++              { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
++                      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, 
++              { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
++                      0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
++              { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 
++                      0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a }
++              }, { 
++              24,
++              { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
++                      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
++                      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
++              { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
++                      0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
++              { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 
++                      0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 }
++              }, {
++              32,
++              { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
++                      0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
++                      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 
++                      0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
++              { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
++                      0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
++              { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, 
++                      0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 }
++              }
++      };
++
++      aes_CBC key;
++      unsigned char tmp[2][16];
++      int i, y;
++
++      for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
++              zeromem(&key, sizeof(key));
++              if ((err = aes_setup(tests[i].key, tests[i].keylen, 0, &key)) != CRYPT_OK) { 
++                      return err;
++              }
++
++              aes_ecb_encrypt(tests[i].pt, tmp[0], &key);
++              aes_ecb_decrypt(tmp[0], tmp[1], &key);
++              if (memcmp(tmp[0], tests[i].ct, 16) || memcmp(tmp[1], tests[i].pt, 16)) {
++#if 0
++                      printf("\n\nTest %d failed\n", i);
++                      if (memcmp(tmp[0], tests[i].ct, 16)) {
++                              printf("CT: ");
++                              for (i = 0; i < 16; i++) {
++                                      printf("%02x ", tmp[0][i]);
++                              }
++                              printf("\n");
++                      } else {
++                              printf("PT: ");
++                              for (i = 0; i < 16; i++) {
++                                      printf("%02x ", tmp[1][i]);
++                              }
++                              printf("\n");
++                      }
++#endif /* 0 */
++              return CRYPT_FAIL_TESTVECTOR;
++              }
++
++/* 
++              now see if we can encrypt all zero bytes 1000 times,
++              decrypt and come back where we started 
++ */
++              for (y = 0; y < 16; y++) tmp[0][y] = 0;
++              for (y = 0; y < 1000; y++) aes_ecb_encrypt(tmp[0], tmp[0], &key);
++              for (y = 0; y < 1000; y++) aes_ecb_decrypt(tmp[0], tmp[0], &key);
++              for (y = 0; y < 16; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR;
++      }
++      return CRYPT_OK;
++}
++#endif /* PEERSEC_TEST */
++
++#endif /* USE_AES */
++/******************************************************************************/
+diff -urN matrixssl.old/src/crypto/peersec/md5.c matrixssl/src/crypto/peersec/md5.c
+--- matrixssl.old/src/crypto/peersec/md5.c     2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/src/crypto/peersec/md5.c 2005-03-06 01:32:33.000000000 +0100
+@@ -334,7 +334,7 @@
+ #ifdef CLEAN_STACK
+       psZeromem(md, sizeof(hash_state));
+ #endif /* CLEAN_STACK */
+-      return 16;
++      return SSL_MD5_HASH_SIZE;
+ }
+ #ifdef PEERSEC_TEST
+diff -urN matrixssl.old/src/crypto/peersec/pscrypto.h matrixssl/src/crypto/peersec/pscrypto.h
+--- matrixssl.old/src/crypto/peersec/pscrypto.h        2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/src/crypto/peersec/pscrypto.h    2005-03-06 01:32:33.000000000 +0100
+@@ -40,7 +40,7 @@
+       PeerSec crypto-specific defines.
+  */
+ #define SMALL_CODE
+-#define CLEAN_STACK
++#undef CLEAN_STACK
+ /*
+       If Native 64 bit integers are not supported, we must set the 16 bit flag
+       to produce 32 bit mp_words in mpi.h
+diff -urN matrixssl.old/src/crypto/peersec/sha1.c matrixssl/src/crypto/peersec/sha1.c
+--- matrixssl.old/src/crypto/peersec/sha1.c    2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/src/crypto/peersec/sha1.c        2005-03-06 01:32:33.000000000 +0100
+@@ -273,7 +273,7 @@
+ #ifdef CLEAN_STACK
+       psZeromem(md, sizeof(hash_state));
+ #endif /* CLEAN_STACK */
+-      return 20;
++      return SSL_SHA1_HASH_SIZE;
+ }
+ #ifdef PEERSEC_TEST
+diff -urN matrixssl.old/src/Makefile matrixssl/src/Makefile
+--- matrixssl.old/src/Makefile 2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/src/Makefile     2005-03-06 01:39:06.000000000 +0100
+@@ -15,7 +15,14 @@
+ E       =
+ LIBRARY       = libmatrixssl$(SO)
+-STATIC        = libmatrixsslstatic$(A)
++
++SOVERSION_MAJ := 1
++SOVERSION_MIN := 2
++SOVERSION_REV := 4
++SONAME := $(LIBRARY).$(SOVERSION_MAJ)
++SOREAL := $(LIBRARY).$(SOVERSION_MAJ).$(SOVERSION_MIN).$(SOVERSION_REV)
++
+++STATIC       = libmatrixsslstatic$(A)
+ OBJECTS       = \
+               cipherSuite$(O) \
+@@ -24,6 +31,7 @@
+               sslEncode$(O) \
+               sslv3$(O) \
+               os/linux/linux$(O)      \
++              crypto/peersec/aes$(O) \
+               crypto/peersec/arc4$(O) \
+               crypto/peersec/asn1$(O) \
+               crypto/peersec/base64$(O) \
+@@ -66,7 +74,7 @@
+ #
+ SHARED        = -shared
+ CFLAGS  = $(DFLAGS) -DLINUX -I./ -Icrypto/peersec
+-LDFLAGS = -lc -lpthread -lcrypto
++LDFLAGS = -lc -lpthread -Wl,-soname,$(SONAME)
+ #
+ #     Override variables for compilation on Mac OS X (Darwin)
+@@ -105,8 +113,9 @@
+ # Build the library
+ #
+ $(LIBRARY): $(OBJECTS)
+-      $(CC) $(SHARED) -o $@ $^ $(LDFLAGS)
+-      $(STRIP) $(LIBRARY)
++      $(CC) $(SHARED) -o $(SOREAL) $^ $(LDFLAGS)
++      ln -sf $(SOREAL) $(SONAME)
++      ln -sf $(SONAME) $(LIBRARY)
+ #
+ # Build the static library
+@@ -119,4 +128,4 @@
+ #     Clean up all generated files
+ #
+ clean:
+-      rm -f $(LIBRARY) $(OBJECTS) $(STATIC)
++      rm -f $(LIBRARY) $(OBJECTS) $(SONAME) $(SOREAL)
+diff -urN matrixssl.old/src/matrixSsl.c matrixssl/src/matrixSsl.c
+--- matrixssl.old/src/matrixSsl.c      2005-02-23 22:43:10.000000000 +0100
++++ matrixssl/src/matrixSsl.c  2005-03-06 01:37:41.000000000 +0100
+@@ -950,6 +950,49 @@
+       sslAssert(ssl->hsPool == NULL);
+ }
++
++/******************************************************************************/
++/*
++      Compute an MD5 digest
++*/
++unsigned char *matrixMd5Digest(
++      const unsigned char *buf, unsigned long len, unsigned char *hash)
++{
++      sslMd5Context_t ctx;
++      static unsigned char hashBuf[SSL_MD5_HASH_SIZE];
++
++      if (hash == NULL) {
++              hash = hashBuf;
++      }
++
++      matrixMd5Init(&ctx);
++      matrixMd5Update(&ctx, buf, len);
++      matrixMd5Final(&ctx, hash);
++
++      return hash;
++}
++
++/******************************************************************************/
++/*
++      Compute an SHA1 digest
++*/
++unsigned char *matrixSha1Digest(
++      const unsigned char *buf, unsigned long len, unsigned char *hash)
++{
++      sslSha1Context_t ctx;
++      static unsigned char hashBuf[SSL_SHA1_HASH_SIZE];
++
++      if (hash == NULL) {
++              hash = hashBuf;
++      }
++
++      matrixSha1Init(&ctx);
++      matrixSha1Update(&ctx, buf, len);
++      matrixSha1Final(&ctx, hash);
++
++      return hash;
++}
++
+ /******************************************************************************/
+ /*
+       Debugging APIs
diff --git a/libs/matrixssl/patches/200-compile-fixes.patch b/libs/matrixssl/patches/200-compile-fixes.patch
new file mode 100644 (file)
index 0000000..ab6a261
--- /dev/null
@@ -0,0 +1,64 @@
+Index: matrixssl/src/os/linux/linux.c
+===================================================================
+--- matrixssl.orig/src/os/linux/linux.c        2010-11-02 21:01:53.702000002 +0100
++++ matrixssl/src/os/linux/linux.c     2010-11-02 21:02:37.657009753 +0100
+@@ -39,8 +39,12 @@
+ #include "../osLayer.h"
++#ifndef CLK_TCK
++# define CLK_TCK      CLOCKS_PER_SEC
++#endif
++
+ #if defined(__i386__) || defined(RDTSC)
+-#include <asm/timex.h>
++//#include <asm/timex.h>
+ /*
+       As defined in asm/timex.h for x386:
+ */
+@@ -51,7 +55,7 @@
+ static sslTime_t      hiresStart;     /* zero-time */
+ static sslTime_t      hiresFreq;              /* tics per second */
+ #else /* __i386__ */
+-static unsigned       int32 prevTicks;                /* Check wrap */
++static uint32         prevTicks;              /* Check wrap */
+ static sslTime_t      elapsedTime;    /* Last elapsed time */
+ #endif
+Index: matrixssl/src/Makefile
+===================================================================
+--- matrixssl.orig/src/Makefile        2010-11-02 21:02:42.312000001 +0100
++++ matrixssl/src/Makefile     2010-11-02 21:04:21.979001189 +0100
+@@ -63,13 +63,6 @@
+ endif
+ #
+-#     Override variables for compilation on x86-64 (AMD64, Nacona, etc)
+-#
+-ifeq ($(shell uname -m),x86_64)
+-DFLAGS  += -march=k8 -fPIC -DFP_64BIT -DTFM_X86_64 -DRDTSC
+-endif
+-
+-#
+ #     Compile options
+ #
+ SHARED        = -shared
+@@ -77,18 +70,6 @@
+ LDFLAGS = -lc -lpthread -Wl,-soname,$(SONAME)
+ #
+-#     Override variables for compilation on Mac OS X (Darwin)
+-#
+-ifeq ($(shell uname),Darwin)
+-CC    = cc
+-SO    = .dylib
+-SHARED        = -dynamiclib
+-CFLAGS += -DOSX -isystem -I/usr/include
+-LDFLAGS = -flat_namespace -install_name @executable_path/../src/$(LIBRARY)
+-STRIP = test
+-endif
+-
+-#
+ #     Override variables for compilation on uClinux (example only)
+ #
+ ifdef UCLINUX
diff --git a/libs/mxml/Makefile b/libs/mxml/Makefile
new file mode 100644 (file)
index 0000000..45b0443
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2010 Tobias Schneider
+# Copyright (C) 2007 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:=mxml
+PKG_VERSION:=2.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.msweet.org/files/project3/
+PKG_FIXUP:=autoreconf
+PKG_MD5SUM:=d85ee6d30de053581242c4a86e79a5d2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mxml
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=mini-xml
+  URL:=http://www.minixml.org/
+endef
+
+define Package/mxml/description
+  A small xml library.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+       )
+endef
+
+define Build/InstallDev
+       mkdir -p $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/mxml.h $(1)/usr/include/
+       mkdir -p $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libmxml.so* $(1)/usr/lib/
+       mkdir -p $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_BUILD_DIR)/mxml.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/mxml/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libmxml.so*  $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,mxml))
diff --git a/libs/mxml/patches/001-targets.patch b/libs/mxml/patches/001-targets.patch
new file mode 100644 (file)
index 0000000..86379f0
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -88,7 +88,7 @@ PUBLIBOBJS   =       mxml-attr.o mxml-entity.o m
+                       mxml-index.o mxml-node.o mxml-search.o mxml-set.o
+ LIBOBJS               =       $(PUBLIBOBJS) mxml-private.o mxml-string.o
+ OBJS          =       mxmldoc.o testmxml.o $(LIBOBJS)
+-TARGETS               =       $(LIBMXML) mxmldoc testmxml mxml.xml doc/mxml.man
++TARGETS               =       $(LIBMXML)
+ #
diff --git a/libs/mysql/Makefile b/libs/mysql/Makefile
new file mode 100644 (file)
index 0000000..4252a4a
--- /dev/null
@@ -0,0 +1,186 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/uclibc++.mk
+
+PKG_NAME:=mysql
+PKG_VERSION:=5.1.73
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=\
+       http://mysql.he.net/Downloads/MySQL-5.1/ \
+       http://www.linorg.usp.br/mysql/Downloads/MySQL-5.1/ \
+       http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/ \
+       http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-5.1/ \
+       http://downloads.mysql.com/archives/mysql-5.1/
+
+PKG_MD5SUM:=887f869bcc757957067b9198f707f32f
+
+PKG_BUILD_DEPENDS:=libncurses libreadline
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+PKG_FIXUP:=libtool
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libmysqlclient/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=$(CXX_DEPENDS) +zlib
+  TITLE:=MySQL client library
+  URL:=http://dev.mysql.com/
+endef
+
+define Package/mysql-server
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libmysqlclient +libpthread +libncursesw +libreadline
+  TITLE:=MySQL Server
+  URL:=http://dev.mysql.com/
+  SUBMENU:=database
+endef
+
+define Package/libmysqlclient
+  $(call Package/libmysqlclient/Default)
+endef
+
+define Package/libmysqlclient-r
+  $(call Package/libmysqlclient/Default)
+  TITLE += threadsafe
+  DEPENDS+= +libpthread
+endef
+
+TARGET_CXX=g++-uc
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --enable-thread-safe-client \
+       --disable-assembler \
+       --with-pthread \
+       --with-server \
+       --without-mysqlmanager \
+       --with-mysqld-user=root \
+       --with-unix-socket-path=/tmp \
+       --without-libwrap \
+       --with-low-memory \
+       --without-embedded-server \
+       --without-query-cache \
+       --without-ssl \
+       --without-docs \
+       --without-man \
+       --without-readline \
+       --without-debug \
+       --with-named-thread-libs=-lpthread
+
+CONFIGURE_VARS += \
+       mysql_cv_compress=yes \
+       mysql_cv_gethostname_style=glibc2 \
+       mysql_cv_gcc_atomic_builtins=yes \
+       mysql_cv_gcc_atomic_builtins_pthread_t=yes \
+       ac_cv_c_stack_direction=-1
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="include" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="include" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+       g++ -I $(PKG_BUILD_DIR)/include \
+               -o $(PKG_BUILD_DIR)/sql/gen_lex_hash \
+               $(PKG_BUILD_DIR)/sql/gen_lex_hash.cc
+       +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \
+               CC="g++" \
+               CFLAGS="$(HOST_CFLAGS)" \
+               CPPFLAGS="$(HOST_CFLAGS)" \
+               LDFLAGS="$(HOST_LDFLAGS)" \
+               conf_to_src
+       +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+       +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql_r" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="libmysql_r" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               SUBDIRS="scripts" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               bin_SCRIPTS="mysql_config" \
+               install
+       +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
+       ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
+       # NOTE: needed for MySQL-Python
+       $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
+       rm -f $(1)/usr/lib/mysql/libmysqlclient.la
+endef
+
+define Package/libmysqlclient/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
+endef
+define Package/libmysqlclient-r/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/
+endef
+
+define Package/mysql-server/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
+       $(INSTALL_CONF) conf/my.cnf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/share/mysql
+       $(INSTALL_DIR) $(1)/usr/share/mysql/english
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/
+endef
+
+define Package/mysql-server/conffiles
+/etc/my.cnf
+endef
+
+$(eval $(call BuildPackage,mysql-server))
+$(eval $(call BuildPackage,libmysqlclient))
+$(eval $(call BuildPackage,libmysqlclient-r))
diff --git a/libs/mysql/conf/my.cnf b/libs/mysql/conf/my.cnf
new file mode 100644 (file)
index 0000000..ec2ade2
--- /dev/null
@@ -0,0 +1,54 @@
+[client]
+port           = 3306
+socket         = /var/run/mysqld.sock
+
+[mysqld]
+user           = root
+socket         = /var/run/mysqld.sock
+port           = 3306
+basedir                = /usr
+
+############ Don't put this on the NAND #############
+# Figure out where you are going to put the databases
+# And run mysql_install_db --force
+datadir                = /mnt/data/mysql/
+
+######### This should also not go on the NAND #######
+tmpdir         = /mnt/data/tmp/
+
+skip-external-locking
+
+bind-address           = 127.0.0.1
+
+# Fine Tuning
+key_buffer             = 16M
+max_allowed_packet     = 16M
+thread_stack           = 192K
+thread_cache_size       = 8
+
+# Here you can see queries with especially long duration
+#log_slow_queries      = /var/log/mysql/mysql-slow.log
+#long_query_time = 2
+#log-queries-not-using-indexes
+
+# The following can be used as easy to replay backup logs or for replication.
+#server-id             = 1
+#log_bin                       = /var/log/mysql/mysql-bin.log
+#expire_logs_days      = 10
+#max_binlog_size         = 100M
+#binlog_do_db          = include_database_name
+#binlog_ignore_db      = include_database_name
+
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet     = 16M
+
+[mysql]
+#no-auto-rehash        # faster start of mysql but no tab completition
+
+[isamchk]
+key_buffer             = 16M
+
+
diff --git a/libs/mysql/files/mysqld.init b/libs/mysql/files/mysqld.init
new file mode 100644 (file)
index 0000000..48e6189
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=95
+STOP=10
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+SERVICE_STOP_TIME=9
+
+error() {
+       echo "${initscript}:" "$@" 1>&2
+}
+
+start() {
+       local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)
+       if [ ! -d "$datadir" ]; then
+               error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist"
+               return 1
+       fi
+       if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then
+               error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables"
+               return 1
+       fi
+       service_start /usr/bin/mysqld
+}
+
+stop() {
+       service_stop /usr/bin/mysqld
+}
diff --git a/libs/mysql/patches/100-fix_hostname.patch b/libs/mysql/patches/100-fix_hostname.patch
new file mode 100644 (file)
index 0000000..faedc27
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/scripts/mysql_install_db.sh
++++ b/scripts/mysql_install_db.sh
+@@ -322,7 +322,7 @@ then
+ fi
+ # Try to determine the hostname
+-hostname=`@HOSTNAME@`
++hostname=`cat /proc/sys/kernel/hostname`
+ # Check if hostname is valid
+ if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
diff --git a/libs/mysql/patches/110-cross_compile.patch b/libs/mysql/patches/110-cross_compile.patch
new file mode 100644 (file)
index 0000000..85d2591
--- /dev/null
@@ -0,0 +1,179 @@
+--- a/storage/innodb_plugin/plug.in
++++ b/storage/innodb_plugin/plug.in
+@@ -56,10 +56,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
+   esac
+   AC_SUBST(INNODB_DYNAMIC_CFLAGS)
+-  AC_MSG_CHECKING(whether GCC atomic builtins are available)
+-  # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
+-  AC_TRY_RUN(
+-    [
++  AC_CACHE_CHECK([whether GCC atomic builtins are available],
++               [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
+       int main()
+       {
+       long    x;
+@@ -96,21 +94,18 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
+       return(0);
+       }
+-    ],
+-    [
+-      AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
+-                [GCC atomic builtins are available])
+-      AC_MSG_RESULT(yes)
+-    ],
+-    [
+-      AC_MSG_RESULT(no)
+-    ]
+-  )
++    ], [mysql_cv_gcc_atomic_builtins=yes],
++       [mysql_cv_gcc_atomic_builtins=no],
++       [mysql_cv_gcc_atomic_builtins=no])])
++
++  if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
++    AC_DEFINE(HAVE_IB_GCC_ATOMIC_BUILTINS, 1,
++              [Define to 1 if compiler provides atomic builtins.])
++  fi
+-  AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
+-  # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
+-  AC_TRY_RUN(
+-    [
++
++  AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
++               [mysql_cv_gcc_atomic_builtins_pthread_t], [AC_TRY_RUN([
+       #include <pthread.h>
+       #include <string.h>
+@@ -127,16 +122,14 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
+         return(0);
+       }
+-    ],
+-    [
+-      AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
+-                [pthread_t can be used by GCC atomic builtins])
+-      AC_MSG_RESULT(yes)
+-    ],
+-    [
+-      AC_MSG_RESULT(no)
+-    ]
+-  )
++    ], [mysql_cv_gcc_atomic_builtins_pthread_t=yes],
++       [mysql_cv_gcc_atomic_builtins_pthread_t=no],
++       [mysql_cv_gcc_atomic_builtins_pthread_t=no])])
++
++  if test "x$mysql_cv_gcc_atomic_builtins_pthread_t" = xyes; then
++    AC_DEFINE(HAVE_IB_ATOMIC_PTHREAD_T_GCC, 1,
++              [Define to 1 if pthread_t can be used by GCC atomic builtins])
++  fi
+   AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
+   # Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following
+@@ -156,7 +149,6 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
+     AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
+       [Define to 1 if Solaris libc atomic functions are available]
+     )
+-  fi
+   AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
+   # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
+@@ -230,6 +222,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
+       AC_MSG_RESULT(no)
+     ]
+   )
++  fi
++
+   ])
+ # vim: set ft=config:
+--- a/sql/gen_lex_hash.cc
++++ b/sql/gen_lex_hash.cc
+@@ -344,55 +344,6 @@ void print_find_structs()
+ }
+-static void usage(int version)
+-{
+-  printf("%s  Ver 3.6 Distrib %s, for %s (%s)\n",
+-       my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+-  if (version)
+-    return;
+-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
+-  puts("This program generates a perfect hashing function for the sql_lex.cc");
+-  printf("Usage: %s [OPTIONS]\n\n", my_progname);
+-  my_print_help(my_long_options);
+-}
+-
+-
+-extern "C" my_bool
+-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
+-             char *argument __attribute__((unused)))
+-{
+-  switch(optid) {
+-  case 'V':
+-    usage(1);
+-    exit(0);
+-  case 'I':
+-  case '?':
+-    usage(0);
+-    exit(0);
+-  case '#':
+-    DBUG_PUSH(argument ? argument : default_dbug_option);
+-    break;
+-  }
+-  return 0;
+-}
+-
+-
+-static int get_options(int argc, char **argv)
+-{
+-  int ho_error;
+-
+-  if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option)))
+-    exit(ho_error);
+-
+-  if (argc >= 1)
+-  {
+-    usage(0);
+-     exit(1);
+-  }
+-  return(0);
+-}
+-
+-
+ int check_dup_symbols(SYMBOL *s1, SYMBOL *s2)
+ {
+   if (s1->length!=s2->length || strncmp(s1->name,s2->name,s1->length))
+@@ -443,12 +394,6 @@ int check_duplicates()
+ int main(int argc,char **argv)
+ {
+-  MY_INIT(argv[0]);
+-  DBUG_PROCESS(argv[0]);
+-
+-  if (get_options(argc,(char **) argv))
+-    exit(1);
+-
+   /* Broken up to indicate that it's not advice to you, gentle reader. */
+   printf("/*\n\n  Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
+@@ -549,7 +494,6 @@ static SYMBOL *get_hash_symbol(const cha
+   }\n\
+ }\n"
+ );
+-  my_end(0);
+   exit(0);
+ }
+--- a/sql/Makefile.am
++++ b/sql/Makefile.am
+@@ -26,7 +26,6 @@ INCLUDES =           @ZLIB_INCLUDES@ \
+ WRAPLIBS=             @WRAPLIBS@
+ SUBDIRS =             share
+ libexec_PROGRAMS =    mysqld
+-EXTRA_PROGRAMS =      gen_lex_hash
+ bin_PROGRAMS =                mysql_tzinfo_to_sql
+ noinst_LTLIBRARIES=   libndb.la \
diff --git a/libs/neon/Makefile b/libs/neon/Makefile
new file mode 100644 (file)
index 0000000..4a95cac
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2007-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:=neon
+PKG_VERSION:=0.29.6
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.webdav.org/neon
+PKG_MD5SUM:=591e0c82e6979e7e615211b386b8f6bc
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libneon
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=HTTP and WebDAV client library
+  URL:=http://www.webdav.org/neon/
+  DEPENDS:=+libopenssl +libexpat
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-expat \
+       --with-ssl="openssl" \
+       --without-egd \
+       --without-libproxy \
+
+CONFIGURE_VARS += \
+       LDFLAGS="$$$$LDFLAGS -lcrypto -lssl"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/neon-config $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/neon $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libneon.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/neon.pc $(1)/usr/lib/pkgconfig/
+       $(SED) 's,-I$$$${includedir}/,-I$(STAGING_DIR)/usr/include/,g' $(1)/usr/bin/neon-config
+       $(SED) 's,-L$$$${libdir},,g' $(1)/usr/bin/neon-config
+endef
+
+define Package/libneon/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libneon.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libneon))
diff --git a/libs/neon/patches/001-automake-compat.patch b/libs/neon/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..f6ffa0f
--- /dev/null
@@ -0,0 +1,5 @@
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1,2 @@
++SUBDIRS = .
++ACLOCAL_AMFLAGS = -I macros
diff --git a/libs/newt/Makefile b/libs/newt/Makefile
new file mode 100644 (file)
index 0000000..79dad88
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2011 SMBPhone Inc.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=newt
+PKG_VERSION:=0.52.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://fedorahosted.org/releases/n/e/newt/
+PKG_MD5SUM:=51b04128d9e1bf000fa769c417b74486
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnewt
+  URL:=http://fedorahosted.org/newt/
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Not Erik's Windowing Toolkit
+  DEPENDS:= +libslang2 +libpopt
+endef
+
+define Package/libnewt/description
+  Programming library for colour text mode widget-based user interfaces,
+  based on S-Lang.
+endef
+
+define Package/whiptail
+  URL:=http://fedorahosted.org/newt/
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Dialog boxes from shell scripts
+  DEPENDS:= +libnewt
+endef
+
+define Package/whiptail/description
+  A lightweight replacement for the dialog command (dialog boxes from shell
+  scripts), based on libnewt.
+endef
+
+TARGET_CFLAGS += $(FPIC) -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib
+
+CONFIGURE_ARGS += \
+       --disable-nls \
+       --without-tcl \
+       --without-gpm-support
+
+MAKE_FLAGS += AR="$(TARGET_CROSS)ar"
+
+define Package/libnewt/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libnewt.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/newt.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libnewt.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/whiptail/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/whiptail $(1)/usr/bin/  
+endef
+
+$(eval $(call BuildPackage,libnewt))
+$(eval $(call BuildPackage,whiptail))
+
diff --git a/libs/newt/patches/100-compile-fix-broken-makefile.patch b/libs/newt/patches/100-compile-fix-broken-makefile.patch
new file mode 100644 (file)
index 0000000..cbada60
--- /dev/null
@@ -0,0 +1,68 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -4,7 +4,8 @@ LIBTCL = -ltcl8.4
+ CC = @CC@
+ CPP = @CPP@
+ CFLAGS = @CFLAGS@
+-CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@ 
++AR ?= ar
++CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@
+ SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver
+ VERSION = @VERSION@
+@@ -53,19 +54,19 @@ endif
+ all:  $(TARGET) _snackmodule.so
+ test: test.o $(LIBNEWT)
+-      $(CC) -g -o test test.o $(LIBNEWT) $(LIBS)
++      $(CC) $(CFLAGS) -g -o test test.o $(LIBNEWT) $(LIBS)
+ testgrid:     testgrid.o $(LIBNEWT)
+-      $(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
++      $(CC) $(CFLAGS) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
+ testtree:     testtree.o $(LIBNEWT)
+-      $(CC) -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
++      $(CC) $(CFLAGS) -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
+ showchars:    showchars.o $(LIBNEWT)
+-      $(CC) -g -o showchars showchars.o $(LIBNEWT) $(LIBS)
++      $(CC) $(CFLAGS) -g -o showchars showchars.o $(LIBNEWT) $(LIBS)
+ showkey:      showkey.o $(LIBNEWT)
+-      $(CC) -g -o showkey showkey.o $(LIBNEWT) $(LIBS)
++      $(CC) $(CFLAGS) -g -o showkey showkey.o $(LIBNEWT) $(LIBS)
+ _snackmodule.so:   snackmodule.c $(LIBNEWTSH)
+       for ver in $(PYTHONVERS) ; do \
+@@ -76,13 +77,13 @@ _snackmodule.so:   snackmodule.c $(LIBNE
+       touch $@
+ whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
+-      $(CC) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt
++      $(CC) $(CFLAGS) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt
+ whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
+       $(CC) -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . -lnewt  $(LIBTCL) -lpopt
+ $(LIBNEWT): $(LIBOBJS)
+-      ar rv $@ $^
++      $(AR) rv $@ $^
+ newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
+@@ -102,12 +103,12 @@ $(SHAREDDIR):
+ sharedlib: $(LIBNEWTSH)
+ $(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS)
+-      $(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(LIBS)
++      $(CC) $(CFLAGS) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(LIBS)
+       ln -fs $(LIBNEWTSONAME) libnewt.so
+       ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
+ $(SHAREDDIR)/%.o : %.c
+-      $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
++      $(CC) $(CFLAGS) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+ install: $(LIBNEWT) install-sh whiptail
+       [ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)
diff --git a/libs/newt/patches/110-disable-snackmodule-python.patch b/libs/newt/patches/110-disable-snackmodule-python.patch
new file mode 100644 (file)
index 0000000..79e7e11
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -51,7 +51,7 @@ else
+ TARGET=depend $(PROGS)
+ endif
+-all:  $(TARGET) _snackmodule.so
++all:  $(TARGET)
+ test: test.o $(LIBNEWT)
+       $(CC) $(CFLAGS) -g -o test test.o $(LIBNEWT) $(LIBS)
+@@ -68,14 +68,6 @@ showchars:  showchars.o $(LIBNEWT)
+ showkey:      showkey.o $(LIBNEWT)
+       $(CC) $(CFLAGS) -g -o showkey showkey.o $(LIBNEWT) $(LIBS)
+-_snackmodule.so:   snackmodule.c $(LIBNEWTSH)
+-      for ver in $(PYTHONVERS) ; do \
+-              mkdir -p $$ver ;\
+-              $(CC) $(CFLAGS) -I/usr/include/$$ver $(SHCFLAGS) -c -o $$ver/snackmodule.o snackmodule.c ;\
+-              $(CC) --shared $(SHCFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L .  -lnewt ;\
+-      done
+-      touch $@
+-
+ whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
+       $(CC) $(CFLAGS) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt
+@@ -122,17 +114,12 @@ install: $(LIBNEWT) install-sh whiptail
+       make -C po datadir=$(instroot)/$(datadir) install
+       install -m 644 -D libnewt.pc $(instroot)/$(pkgconfigdir)/libnewt.pc
+-install-sh: sharedlib $(WHIPTCLSO) _snackmodule.so
++install-sh: sharedlib $(WHIPTCLSO)
+       [ -d $(instroot)/$(libdir) ] || install -m 755 -d $(instroot)/$(libdir)
+       install -m 755 $(LIBNEWTSH) $(instroot)/$(libdir)
+       ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.so
+       ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME)
+       [ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.so $(instroot)/$(libdir) || :
+-      for ver in $(PYTHONVERS) ; do \
+-         [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
+-         install -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\
+-         install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
+-      done
+ Makefile: newt.spec
+       echo "You need to rerun ./configure before continuing"
diff --git a/libs/nmeap/Makefile b/libs/nmeap/Makefile
new file mode 100644 (file)
index 0000000..66589da
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2007 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:=nmeap
+PKG_VERSION:=0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/nmeap
+PKG_MD5SUM:=cbcc9fdf5176f9d6c9e48f27db443c4f
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnmeap
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=extensible NMEA-0183 parser written in standard C
+  URL:=http://www.dmh2000.com/nmea/nmeap.shtml
+endef
+
+define Package/libnmeap/description
+The NMEAP parser is intended for use in applications that need to input NMEA-0183
+       data from a GPS (typically over a serial port). NMEAP is a linkable library written in portable
+       standard C and is suitable for both desktop and embedded applications.
+       It is licensed under the BSD open source license.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/inc/nmeap{,_def}.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libnmeap.a $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libnmeap))
diff --git a/libs/nmeap/patches/100-no_test.patch b/libs/nmeap/patches/100-no_test.patch
new file mode 100644 (file)
index 0000000..891e2a8
--- /dev/null
@@ -0,0 +1,21 @@
+--- nmeap-0.3/Makefile         2005-05-06 19:57:39.000000000 +0200
++++ nmeap-0.3.new/Makefile     2007-07-25 15:26:47.000000000 +0200
+@@ -5,18 +5,15 @@
+ # directories\r
+ BASE :=$(shell pwd)\r
+ export SRC=$(BASE)/src\r
+-export TST=$(BASE)/tst\r
+ export INC=$(BASE)/inc\r
+ export LIB=$(BASE)/lib\r
\r
+ all :\r
+       cd $(SRC) && $(MAKE) all\r
+-      cd $(TST) && $(MAKE) all\r
+       \r
\r
+ clean :\r
+       cd $(SRC) && $(MAKE) clean\r
+-      cd $(TST) && $(MAKE) clean\r
+       \r
+ doc  :\r
+       doxygen\r
diff --git a/libs/opencdk/Makefile b/libs/opencdk/Makefile
new file mode 100644 (file)
index 0000000..f2ce930
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# 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:=opencdk
+PKG_VERSION:=0.6.6
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.gnutls.org/pub/gnutls/attic/opencdk
+PKG_MD5SUM:=813d62d7afe7b2c2d8f3df0a6c9d9331
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/libopencdk
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libgcrypt zlib
+  TITLE:=The Open Crypto Development Kit library
+  URL:=ftp://ftp.gnutls.org/pub/gnutls/attic/opencdk/
+endef
+
+define Package/libopencdk/description
+       This library provides basic parts of the OpenPGP message format.
+       For reference, please read the rfc2440.txt in the doc/ directory.
+       Due to some possible security problems, the library also implements
+       parts of draft-ietf-openpgp-rfc2440bis-08.txt. If you want to exchange
+       messages with earlier PGP version < 7, you should use the compat mode.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+               --with-libgcrypt-prefix="$(STAGING_DIR)/usr" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/opencdk-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/opencdk-config
+
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/opencdk.h \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libopencdk.{la,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/libopencdk/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libopencdk.so.* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libopencdk))
diff --git a/libs/opencdk/patches/100-fix-tests-build b/libs/opencdk/patches/100-fix-tests-build
new file mode 100644 (file)
index 0000000..c4df1a0
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -34,7 +34,7 @@
+ CLEANFILES = plain-test
+-LDADD = ../src/libopencdk.la
++LDADD = ../src/libopencdk.la $(LIBGCRYPT_LIBS)
+ if HAVE_W32_SYSTEM
+ # there is a problem with some tests and WINE
+--- a/tests/Makefile.in
++++ b/tests/Makefile.in
+@@ -258,7 +258,7 @@
+ AM_LDFLAGS = -no-install
+ AM_CPPFLAGS = $(LIBGCRYPT_CFLAGS)
+ CLEANFILES = plain-test
+-LDADD = ../src/libopencdk.la
++LDADD = ../src/libopencdk.la $(LIBGCRYPT_LIBS)
+ noinst_HEADER = t-support.h
+ all: all-am
diff --git a/libs/opencdk/patches/200-verify-clearsigned.patch b/libs/opencdk/patches/200-verify-clearsigned.patch
new file mode 100644 (file)
index 0000000..a222aa8
--- /dev/null
@@ -0,0 +1,13 @@
+--- opencdk-0.6.6/src/stream.c 2007-11-08 19:31:45.000000000 +0100
++++ opencdk-0.6.6-my/src/stream.c      2011-01-17 20:30:19.000000000 +0100
+@@ -1384,7 +1384,9 @@
+   while (!cdk_stream_eof (s) && count > 0)
+     {
+       c = cdk_stream_getc (s);
+-      if (c == EOF || c == '\r' || c == '\n' ) 
++      if (c == '\r')
++        c = cdk_stream_getc (s);
++      if (c == EOF || c == '\n' )
+       {
+         buf[i++] = '\0';
+         break;
diff --git a/libs/openldap/Makefile b/libs/openldap/Makefile
new file mode 100644 (file)
index 0000000..5344080
--- /dev/null
@@ -0,0 +1,150 @@
+#
+# Copyright (C) 2006-2012 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:=openldap
+PKG_VERSION:=2.4.39
+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_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openldap/Default
+  TITLE:=LDAP implementation
+  URL:=http://www.openldap.org/
+  MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+endef
+
+define Package/openldap/Default/description
+       OpenLDAP Software is an open source implementation of the
+       Lightweight Directory Access Protocol (LDAP).
+endef
+
+define Package/libopenldap
+  $(call Package/openldap/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libopenssl +libsasl2 +libpthread
+  TITLE+= (libraries)
+endef
+
+define Package/libopenldap/description
+       $(call Package/openldap/Default/description)
+       This package contains the shared LDAP client libraries, needed by other programs.
+endef
+
+define Package/libopenldap/conffiles
+/etc/openldap/ldap.conf
+endef
+
+define Package/openldap-utils
+  $(call Package/openldap/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libopenldap
+  TITLE+= (utilities)
+endef
+
+define Package/openldap-utils/description
+       $(call Package/openldap/Default/description)
+       This package contains client programs required to access LDAP servers.
+endef
+
+define Package/openldap-server
+  $(call Package/openldap/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenldap +libuuid
+  TITLE+= (server)
+endef
+
+define Package/openldap-server/description
+       $(call Package/openldap/Default/description)
+       This package contains server programs required to provide LDAP services.
+endef
+
+define Package/openldap-server/conffiles
+/etc/openldap/slapd.conf
+endef
+
+TARGET_CFLAGS += $(FPIC) -lpthread
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-debug \
+       --enable-dynamic \
+       --enable-syslog \
+       --disable-local \
+       --disable-slurpd \
+       --with-cyrus-sasl \
+       --without-fetch \
+       --with-threads \
+       --with-tls \
+       --with-yielding_select="yes" \
+       --without-cyrus-sasl \
+       --without-threads \
+       --without-tls \
+       --enable-null \
+       --disable-bdb \
+       --disable-hdb \
+       --disable-monitor \
+       --disable-relay
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               HOSTCC="$(HOSTCC)" \
+               depend all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/{lber,ldap}*.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{lber,ldap}*.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libopenldap/install
+       $(INSTALL_DIR) $(1)/etc/openldap
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/ldap.conf $(1)/etc/openldap/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{lber,ldap}*.so.* $(1)/usr/lib/
+endef
+
+define Package/openldap-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ldap* $(1)/usr/bin/
+endef
+
+define Package/openldap-server/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ldap.init $(1)/etc/init.d/ldap
+       $(INSTALL_DIR) $(1)/etc/openldap/schema
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/schema/* $(1)/etc/openldap/schema/
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/openldap/slapd.conf $(1)/etc/openldap/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       # XXX: OpenLDAP installs slapd into libexecdir, not sbindir:
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/slapd $(1)/usr/sbin/
+       # XXX: switch default backend to ldif, since bdb is disabled
+       $(SED) 's|^\(database\)\([ \t]\+\)bdb|\1\2ldif|g' \
+           -e 's|^\(index\)|#\1|g' \
+           $(1)/etc/openldap/slapd.conf
+endef
+
+$(eval $(call BuildPackage,libopenldap))
+$(eval $(call BuildPackage,openldap-utils))
+$(eval $(call BuildPackage,openldap-server))
diff --git a/libs/openldap/files/ldap.init b/libs/openldap/files/ldap.init
new file mode 100644 (file)
index 0000000..b30bbf1
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+
+START=60
+
+SERVICE_USE_PID=1
+
+start() {
+       mkdir -m 0755 -p /var/openldap-data
+       service_start /usr/sbin/slapd
+}
+
+stop() {
+       service_stop /usr/sbin/slapd
+}
+
+reload() {
+       service_reload /usr/sbin/slapd
+}
diff --git a/libs/openldap/patches/001-automake-compat.patch b/libs/openldap/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..71cdebe
--- /dev/null
@@ -0,0 +1,323 @@
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1 @@
++SUBDIRS = include libraries clients servers tests doc
+--- a/libraries/Makefile.in
++++ b/libraries/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SUBDIRS= \
+       liblutil \
+       liblber \
+--- a/libraries/liblber/Makefile.in
++++ b/libraries/liblber/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ LIBRARY = liblber.la
+ NT_SRCS = nt_err.c
+--- a/libraries/libldap/Makefile.in
++++ b/libraries/libldap/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ LIBRARY = libldap.la
+ PROGRAMS = apitest dntest ftest ltest urltest
+--- a/libraries/libldap_r/Makefile.in
++++ b/libraries/libldap_r/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ LIBRARY = libldap_r.la
+ PROGRAMS = apitest ltest
+--- a/libraries/liblunicode/Makefile.in
++++ b/libraries/liblunicode/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ LIBRARY = liblunicode.a
+ XXDIR = $(srcdir)/ucdata/
+--- a/libraries/liblutil/Makefile.in
++++ b/libraries/liblutil/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ LIBRARY       = liblutil.a
+ PROGRAM = testavl
+--- a/libraries/librewrite/Makefile.in
++++ b/libraries/librewrite/Makefile.in
+@@ -16,6 +16,8 @@
+ ## Copyright 2000-2001 Pierangelo Masarati <ando@sys-net.it>
+ ##
++SHELL = @SHELL@
++
+ SRCS = config.c context.c info.c ldapmap.c map.c params.c rule.c \
+       session.c subst.c var.c xmap.c \
+       parse.c rewrite.c
+--- a/clients/tools/Makefile.in
++++ b/clients/tools/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c \
+               ldappasswd.c ldapwhoami.c ldapcompare.c \
+               ldapexop.c ldapurl.c common.c
+--- a/servers/slapd/Makefile.in
++++ b/servers/slapd/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SLAPTOOLS=slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema
+ PROGRAMS=slapd $(SLAPTOOLS)
+ XPROGRAMS=sslapd libbackends.a .backend liboverlays.a
+--- a/servers/slapd/overlays/Makefile.in
++++ b/servers/slapd/overlays/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS = overlays.c \
+       accesslog.c \
+       auditlog.c \
+--- a/tests/progs/Makefile.in
++++ b/tests/progs/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ PROGRAMS = slapd-tester slapd-search slapd-read slapd-addel slapd-modrdn \
+               slapd-modify slapd-bind slapd-mtread ldif-filter
+--- a/servers/slapd/back-bdb/Makefile.in
++++ b/servers/slapd/back-bdb/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS = init.c tools.c config.c \
+       add.c bind.c compare.c delete.c modify.c modrdn.c search.c \
+       extended.c referral.c operational.c \
+--- a/servers/slapd/back-dnssrv/Makefile.in
++++ b/servers/slapd/back-dnssrv/Makefile.in
+@@ -18,6 +18,8 @@
+ #  The DNSSRV backend was written by Kurt D. Zeilenga.
+ #
++SHELL = @SHELL@
++
+ SRCS  = init.c bind.c search.c config.c referral.c
+ OBJS  = init.lo bind.lo search.lo config.lo referral.lo
+--- a/servers/slapd/back-hdb/Makefile.in
++++ b/servers/slapd/back-hdb/Makefile.in
+@@ -15,6 +15,8 @@
+ #
+ ## Copyright 2003 Howard Chu @ Symas Corp. See master COPYRIGHT file for terms.
++SHELL = @SHELL@
++
+ XXDIR = $(srcdir)/../back-bdb
+ XXSRCS = init.c tools.c config.c \
+--- a/servers/slapd/back-ldap/Makefile.in
++++ b/servers/slapd/back-ldap/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = init.c config.c search.c bind.c unbind.c add.c compare.c \
+               delete.c modify.c modrdn.c extended.c chain.c \
+               distproc.c monitor.c pbind.c
+--- a/servers/slapd/back-ldif/Makefile.in
++++ b/servers/slapd/back-ldif/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS = ldif.c
+ OBJS = ldif.lo
+--- a/servers/slapd/back-mdb/Makefile.in
++++ b/servers/slapd/back-mdb/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS = init.c tools.c config.c \
+       add.c bind.c compare.c delete.c modify.c modrdn.c search.c \
+       extended.c operational.c \
+--- a/servers/slapd/back-meta/Makefile.in
++++ b/servers/slapd/back-meta/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = init.c config.c search.c bind.c unbind.c add.c compare.c \
+               delete.c modify.c modrdn.c suffixmassage.c map.c \
+               conn.c candidates.c dncache.c
+--- a/servers/slapd/back-monitor/Makefile.in
++++ b/servers/slapd/back-monitor/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS = init.c search.c compare.c modify.c bind.c \
+       operational.c \
+       cache.c entry.c \
+--- a/servers/slapd/back-ndb/Makefile.in
++++ b/servers/slapd/back-ndb/Makefile.in
+@@ -17,6 +17,8 @@
+ ## This work was initially developed by Howard Chu for inclusion
+ ## in OpenLDAP Software. This work was sponsored by MySQL.
++SHELL = @SHELL@
++
+ SRCS = init.cpp tools.cpp config.cpp ndbio.cpp \
+       add.cpp bind.cpp compare.cpp delete.cpp modify.cpp modrdn.cpp search.cpp
+--- a/servers/slapd/back-null/Makefile.in
++++ b/servers/slapd/back-null/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS = null.c
+ OBJS = null.lo
+--- a/servers/slapd/back-passwd/Makefile.in
++++ b/servers/slapd/back-passwd/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = search.c config.c init.c
+ OBJS  = search.lo config.lo init.lo
+--- a/servers/slapd/back-perl/Makefile.in
++++ b/servers/slapd/back-perl/Makefile.in
+@@ -14,6 +14,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = init.c search.c close.c config.c bind.c compare.c \
+               modify.c add.c modrdn.c delete.c
+ OBJS  = init.lo search.lo close.lo config.lo bind.lo compare.lo \
+--- a/servers/slapd/back-relay/Makefile.in
++++ b/servers/slapd/back-relay/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = init.c op.c
+ OBJS  = init.lo op.lo
+--- a/servers/slapd/back-shell/Makefile.in
++++ b/servers/slapd/back-shell/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = init.c config.c fork.c search.c bind.c unbind.c add.c \
+               delete.c modify.c modrdn.c compare.c result.c
+ OBJS  = init.lo config.lo fork.lo search.lo bind.lo unbind.lo add.lo \
+--- a/servers/slapd/back-sock/Makefile.in
++++ b/servers/slapd/back-sock/Makefile.in
+@@ -17,6 +17,8 @@
+ ## This work was initially developed by Brian Candler for inclusion
+ ## in OpenLDAP Software.
++SHELL = @SHELL@
++
+ SRCS  = init.c config.c opensock.c search.c bind.c unbind.c add.c \
+               delete.c modify.c modrdn.c compare.c result.c
+ OBJS  = init.lo config.lo opensock.lo search.lo bind.lo unbind.lo add.lo \
+--- a/servers/slapd/back-sql/Makefile.in
++++ b/servers/slapd/back-sql/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ SRCS  = init.c config.c search.c bind.c compare.c operational.c \
+               entry-id.c schema-map.c sql-wrap.c modify.c util.c \
+               add.c delete.c modrdn.c api.c
+--- a/servers/slapd/shell-backends/Makefile.in
++++ b/servers/slapd/shell-backends/Makefile.in
+@@ -13,6 +13,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ PROGRAMS = passwd-shell
+ SRCS = passwd-shell.c shellutil.c
+--- a/servers/slapd/slapi/Makefile.in
++++ b/servers/slapd/slapi/Makefile.in
+@@ -14,6 +14,8 @@
+ ## top-level directory of the distribution or, alternatively, at
+ ## <http://www.OpenLDAP.org/license.html>.
++SHELL = @SHELL@
++
+ LIBRARY = libslapi.la
+ #all-common: $(LIBRARY) $(PROGRAMS)
diff --git a/libs/openldap/patches/020-autofs-schema.patch b/libs/openldap/patches/020-autofs-schema.patch
new file mode 100644 (file)
index 0000000..11c73f5
--- /dev/null
@@ -0,0 +1,26 @@
+--- /dev/null
++++ b/servers/slapd/schema/autofs.schema
+@@ -0,0 +1,23 @@
++attributetype ( 1.3.6.1.1.1.1.31 NAME 'automountMapName'
++      DESC 'Automount map name'
++      EQUALITY caseExactMatch
++      SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
++
++attributetype ( 1.3.6.1.1.1.1.32 NAME 'automountKey'
++      DESC 'Automount key value'
++      EQUALITY caseExactMatch
++      SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
++
++attributetype ( 1.3.6.1.1.1.1.33 NAME 'automountInformation'
++      DESC 'Automount information'
++      EQUALITY caseExactMatch
++      SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
++
++objectclass ( 1.3.6.1.1.1.2.16 NAME 'automountMap' SUP top STRUCTURAL
++      MUST ( automountMapName )
++      MAY ( description ) )
++
++objectclass ( 1.3.6.1.1.1.2.17 NAME 'automount' SUP top STRUCTURAL
++      DESC 'Automount'
++      MUST ( automountKey $ automountInformation )
++      MAY description )
diff --git a/libs/openldap/patches/750-no-strip.patch b/libs/openldap/patches/750-no-strip.patch
new file mode 100644 (file)
index 0000000..a70aacc
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/clients/tools/Makefile.in
++++ b/clients/tools/Makefile.in
+@@ -122,7 +122,7 @@ install-local:     FORCE
+       -$(MKDIR) $(DESTDIR)$(bindir)
+       @(                                                              \
+           for prg in $(PROGRAMS); do                                  \
+-              $(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 $$prg$(EXEEXT)     \
++              $(LTINSTALL) $(INSTALLFLAGS) -m 755 $$prg$(EXEEXT)      \
+                   $(DESTDIR)$(bindir);                                \
+           done                                                        \
+       )
+--- a/servers/slapd/Makefile.in
++++ b/servers/slapd/Makefile.in
+@@ -380,7 +380,7 @@ install-local-srv: install-slapd install
+ install-slapd: FORCE
+       -$(MKDIR) $(DESTDIR)$(libexecdir)
+       -$(MKDIR) $(DESTDIR)$(localstatedir)/run
+-      $(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 \
++      $(LTINSTALL) $(INSTALLFLAGS) -m 755 \
+               slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
+       @for i in $(SUBDIRS); do \
+           if test -d $$i && test -f $$i/Makefile ; then \
diff --git a/libs/orbit2/Makefile b/libs/orbit2/Makefile
new file mode 100644 (file)
index 0000000..320ba38
--- /dev/null
@@ -0,0 +1,103 @@
+#
+# Copyright (C) 2009-2010 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:=orbit2
+PKG_VERSION:=2.14.19
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/ORBit2-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/ORBit2-$(PKG_VERSION)
+PKG_SOURCE:=ORBit2-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/ORBit2/2.14
+PKG_MD5SUM:=7082d317a9573ab338302243082d10d1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+PKG_INSTALL:=1
+
+HOST_BUILD_DEPENDS:=libIDL2/host
+PKG_BUILD_DEPENDS:=orbit2/host
+
+BIGENDIAN=no
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+       BIGENDIAN:=yes
+endif
+
+CONFIGURE_VARS += \
+       ac_cv_c_bigendian=$(BIGENDIAN) \
+       ac_cv_alignof_CORBA_octet=1 \
+       ac_cv_alignof_CORBA_boolean=1 \
+       ac_cv_alignof_CORBA_char=1 \
+       ac_cv_alignof_CORBA_wchar=2 \
+       ac_cv_alignof_CORBA_short=2 \
+       ac_cv_alignof_CORBA_long=4 \
+       ac_cv_alignof_CORBA_long_long=4 \
+       ac_cv_alignof_CORBA_float=4 \
+       ac_cv_alignof_CORBA_double=4 \
+       ac_cv_alignof_CORBA_long_double=4 \
+       ac_cv_alignof_CORBA_struct=1 \
+       ac_cv_alignof_CORBA_pointer=4
+
+define Package/orbit2
+  SECTION:=xorg-libraries
+  CATEGORY:=Xorg
+  SUBMENU:=libraries
+  TITLE:=ORBit2
+  URL:=http://www.gnome.org/projects/ORBit2/
+  DEPENDS:=+glib2 +libIDL2
+endef
+
+define Package/orbit2/description
+ORBit2 is a CORBA 2.4-compliant Object Request Broker (ORB).
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default)
+       find $(PKG_BUILD_DIR) -name Makefile -exec sed -i 's,IDL_COMPILER.*orbit-idl-2,IDL_COMPILER = $(STAGING_DIR_HOST)/bin/orbit-idl-2,g' {} \; # tell orbit2 to use the host-built idl-compiler
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{include/orbit-2.0,lib/pkgconfig}
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/orbit-2.0/* \
+               $(1)/usr/include/orbit-2.0/
+
+       $(INSTALL_DIR) $(1)/usr/share/aclocal
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/aclocal/* \
+               $(1)/usr/share/aclocal/
+
+       $(INSTALL_DIR) $(1)/usr/share/idl/orbit-2.0
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/idl/orbit-2.0/* \
+               $(1)/usr/share/idl/orbit-2.0/
+endef
+
+define Package/orbit2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libORBit*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,orbit2))
diff --git a/libs/orbit2/patches/010-dont-run-testprograms.patch b/libs/orbit2/patches/010-dont-run-testprograms.patch
new file mode 100644 (file)
index 0000000..5e105f2
--- /dev/null
@@ -0,0 +1,28 @@
+--- ORBit2-2.14.19/configure.in        2010-07-01 15:57:01.000000000 +0200
++++ ORBit2-2.14.19.new/configure.in    2012-12-11 14:02:51.624767158 +0100
+@@ -213,25 +213,6 @@
+ AC_C_BIGENDIAN
+-dnl
+-dnl   So many people with broken linking setups asked about this
+-dnl it turned out to be necessary to check for this.
+-dnl
+-dofus_save_libs="$LIBS"
+-LIBS="$ORBIT_LIBS $LIBS"
+-AC_TRY_RUN([ #include <stdio.h>
+-             main ()
+-             {
+-               return 0;
+-             } ],,
+-           AC_MSG_ERROR([
+-Linking is badly borked on your system. Please ensure your library path is correct
+-Check config.log for details - check near the end of the log above 'failed program was'
+-Alternatively ensure that your /etc/ld.so.conf (and/or LD_LIBRARY_PATH) includes the
+-prefix you're compiling on: '${prefix}' ]), 
+-AC_MSG_WARN([Could not check for borked linking while cross-compiling]))
+-LIBS="$dofus_save_libs"
+-
+ orig_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $ORBIT_CFLAGS"
+ AC_CHECK_ALIGNOF(CORBA_octet)
diff --git a/libs/orbit2/patches/020-build-fix.patch b/libs/orbit2/patches/020-build-fix.patch
new file mode 100644 (file)
index 0000000..615e8e2
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure.in
++++ b/configure.in
+@@ -243,7 +243,7 @@ AC_SUBST(pkglibdir)
+ if test "$enable_maintainer_mode" = "yes"; then
+       DISABLE_DEPRECATED_CFLAGS=" \
+-              -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES"
++              -DG_DISABLE_SINGLE_INCLUDES"
+       AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
+ fi
+--- a/linc2/src/Makefile.am
++++ b/linc2/src/Makefile.am
+@@ -13,7 +13,7 @@ INCLUDES =                         \
+       -I$(top_srcdir)/linc2/include    \
+       $(LINC_CFLAGS)             \
+       $(WARN_CFLAGS)             \
+-      -DG_DISABLE_DEPRECATED
++      $(DISABLE_DEPRECATED_CFLAGS)
+ if OS_WIN32
+ else
diff --git a/libs/ortp/Makefile b/libs/ortp/Makefile
new file mode 100644 (file)
index 0000000..801bba0
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2010-2014 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:=ortp
+PKG_VERSION:=0.16.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= \
+       http://download.savannah.gnu.org/releases-noredirect/linphone/ortp/sources/ \
+       http://www.very-clever.com/download/nongnu/linphone/ortp/sources/
+PKG_MD5SUM:=2b0281600cb958d1c94e318a86b62fe3
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libortp
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Real-time Transport Protocol (RTP) library
+  URL:=http://www.linphone.org/index.php/eng/code_review/ortp
+  DEPENDS:= +libpthread
+endef
+
+ifneq ($(CONFIG_avr32),)
+  TARGET_CFLAGS += -fsigned-char
+endif
+
+CONFIGURE_ARGS += \
+       --disable-debug \
+       --enable-ipv6 \
+       --enable-perf \
+       --disable-ssl-hmac \
+       --disable-so-reuseaddr \
+       --without-srtp \
+
+CONFIGURE_VARS += \
+       ac_cv_header_srtp_srtp_h=no \
+       ac_cv_lib_srtp_srtp_init=no \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/include/ortp \
+               $(1)/usr/include/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libortp.{a,so*} \
+               $(1)/usr/lib/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/pkgconfig/ortp.pc \
+               $(1)/usr/lib/pkgconfig/ \
+       )
+endef
+
+define Package/libortp/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libortp.so.* \
+               $(1)/usr/lib/ \
+       )
+endef
+
+$(eval $(call BuildPackage,libortp))
diff --git a/libs/ortp/patches/001-memset_fix.patch b/libs/ortp/patches/001-memset_fix.patch
new file mode 100644 (file)
index 0000000..89e2359
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/stun.c
++++ b/src/stun.c
+@@ -399,7 +399,7 @@ stunParseMessage( char* buf, unsigned in
+    char* body;
+    unsigned int size;
+        ortp_debug("stun: Received stun message: %i bytes\n", bufLen);
+-   memset(msg, 0, sizeof(msg));
++   memset(msg, 0, sizeof(*msg));
+       
+    if (sizeof(StunMsgHdr) > bufLen)
+    {
diff --git a/libs/ossp-js/Makefile b/libs/ossp-js/Makefile
new file mode 100644 (file)
index 0000000..129cd12
--- /dev/null
@@ -0,0 +1,119 @@
+#
+# Copyright (C) 2008 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:=js
+PKG_VERSION:=1.6.20070208
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.ossp.org/pkg/lib/js/
+PKG_MD5SUM:=07f6cad7e03fd74a949588c3d4b333de
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 libtool.m4
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/js/Default
+ TITLE:=Mozilla JavaScript Engine
+ URL:=http://www.ossp.org/pkg/lib/js/
+endef
+
+define Package/js
+$(call Package/js/Default)
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=JavaScript
+ TITLE+= (interpreter)
+ DEPENDS+= +libjs +libreadline +libncurses
+endef
+
+define Package/libjs
+$(call Package/js/Default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE+= (library)
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-dso \
+       --with-editline \
+       --with-file \
+       --without-perl
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); rm -f config.cache; \
+               ./configure \
+                       --prefix=/usr \
+                       --exec-prefix=/usr \
+                       --bindir=/usr/bin \
+                       --datadir=/usr/share \
+                       --includedir=/usr/include \
+                       --infodir=/usr/share/info \
+                       --libdir=/usr/lib \
+                       --libexecdir=/usr/lib \
+                       --localstatedir=/var \
+                       --mandir=/usr/share/man \
+                       --sbindir=/usr/sbin \
+                       --sysconfdir=/etc \
+                       $(DISABLE_NLS) \
+                       --disable-shared \
+                       --enable-static \
+       );
+       $(MAKE) -C $(PKG_BUILD_DIR) src/jsautocfg.h
+       $(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/js-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/js-config
+
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/js \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libjs.{la,so*} \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/js.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/js/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/js \
+               $(1)/usr/bin/
+endef
+
+define Package/libjs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libjs.so.* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,js))
+$(eval $(call BuildPackage,libjs))
diff --git a/libs/phidget21/Makefile b/libs/phidget21/Makefile
new file mode 100644 (file)
index 0000000..70a2ef8
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2009 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:=phidget21
+PKG_VERSION:=2.1.6.20091105
+PKG_RELEASE:=1
+
+PKG_SOURCE:=Phidgetlinux_$(PKG_VERSION).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/Phidgetlinux
+PKG_SOURCE_URL:=http://www.phidgets.com/downloads/libraries/
+PKG_MD5SUM:=eb48c7fc68ab189a0255c35e71d55ecd
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/phidget21
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpthread
+  TITLE:=Phidget API
+  URL:=http://www.phidgets.com/
+endef
+
+define Package/phidget21/description
+ The Phidget API library.
+endef
+
+define Package/phidget-service
+  SECTION:=misc
+  CATEGORY:=Network
+  TITLE:=Phidget Web Service
+  URL:=http://www.phidgets.com/
+  DEPENDS:=phidget21
+endef
+
+define Package/phidget-service/description
+ The Phidget Web Service.
+endef
+
+define Build/Configure
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/include/
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/lib/
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/phidget21 \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -Wno-strict-aliasing -fpic -D_LINUX -I. -Iutils" \
+               INSTALLPREFIX="$(PKG_INSTALL_DIR)" LDCONFIG="" \
+               all install
+       $(MAKE) -C $(PKG_BUILD_DIR)/webservice \
+               $(TARGET_CONFIGURE_OPTS) LDCONFIG="true" \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -Wno-strict-aliasing -fpic -D_LINUX -I. -Iutils" \
+               phidget21internal.h
+       $(MAKE) -C $(PKG_BUILD_DIR)/webservice \
+               $(TARGET_CONFIGURE_OPTS) LDCONFIG="true" \
+               LIBS="-lphidget21 -lpthread -ldl -L../phidget21" \
+               CFLAGS="$(TARGET_CFLAGS) -static -D_LINUX -I. -I../phidget21 -I../phidget21/utils" \
+               webservice21
+endef
+
+define Build/InstallDev
+       ls $(PKG_INSTALL_DIR)
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/phidget21.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libphidget21.so $(1)/usr/lib/
+endef
+
+define Package/phidget21/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libphidget21.so $(1)/usr/lib/
+endef
+
+define Package/phidget-service/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/webservice/phidgetwebservice21 $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,phidget21))
+$(eval $(call BuildPackage,phidget-service))
diff --git a/libs/poco/Makefile b/libs/poco/Makefile
new file mode 100644 (file)
index 0000000..d93a990
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2007-2014 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:=poco
+PKG_VERSION:=1.3.6p2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/poco/sources/poco-1.3.6
+PKG_MD5SUM:=32d154ca5f34d20217c0baaffa432c1c
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/poco
+  NAME:=poco
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Poco C++ libraries
+  URL:=http://www.pocoproject.org/
+  DEPENDS:=+libstdcpp +libpthread +librt
+endef
+
+define Package/poco/description
+  Modern, powerful open source C++ class libraries and frameworks for building
+  network- and internet-based applications that run on desktop, server and
+  embedded systems.
+endef
+
+CONFIGURE_ARGS += \
+       --config=Linux \
+       --no-tests \
+       --no-samples \
+       --no-fpenvironment \
+       --no-sharedmemory \
+       --no-wstring
+
+MAKE_FLAGS += \
+       CXXFLAGS32="$(TARGET_CXXFLAGS)" \
+       CFLAGS32="$(TARGET_CFLAGS)" \
+       LINKFLAGS32="$(TARGET_LDFLAGS)"
+
+define Package/poco/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libPoco{Foundation,XML,Net,Util}.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) -r $(PKG_INSTALL_DIR)/usr/include/Poco $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libPoco{Foundation,XML,Net,Util}.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,poco))
diff --git a/libs/poco/patches/100-sharedmemory.patch b/libs/poco/patches/100-sharedmemory.patch
new file mode 100644 (file)
index 0000000..811a964
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/configure
++++ b/configure
+@@ -50,6 +50,11 @@
+     Useful if your C++ compiler has incomplete floating-point support
+     (such as uClibc-based systems).
++  --no-sharedmemory
++    Compile with -DPOCO_NO_SHAREDMEMORY
++    Useful if your C++ compiler has incomplete shared memory support
++    (such as uClibc-based systems).
++
+   --omit=<component>{,<component>}
+     Do not build the specified component(s).
+     Example: --omit=Data/MySQL,Data/ODBC,Zip
+@@ -140,6 +145,10 @@
+               flags="$flags -DPOCO_NO_FPENVIRONMENT"
+       fi
++      if [ "$1" = "--no-sharedmemory" ] ; then
++              flags="$flags -DPOCO_NO_SHAREDMEMORY"
++      fi
++
+       if [ "$1" = "--poquito" ] ; then
+               flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION"
+       fi
+
diff --git a/libs/pthsem/Makefile b/libs/pthsem/Makefile
new file mode 100644 (file)
index 0000000..c40930b
--- /dev/null
@@ -0,0 +1,59 @@
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pthsem
+PKG_VERSION:=2.0.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.auto.tuwien.ac.at/~mkoegler/pth/
+PKG_MD5SUM:=9144b26dcc27e67498d63dd5456f934c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pthsem
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GNU pth extended with semaphore support
+  URL:=http://www.auto.tuwien.ac.at/~mkoegler/index.php/pth
+  DEPENDS:=@USE_EGLIBC @TARGET_x86
+endef
+
+define Package/pthsem/description
+  GNU pth is a user mode multi threading library.
+  pthsem is an extend version, with support for semaphores added. It can be installed parallel to a normal pth.
+endef
+
+MAKE_FLAGS += \
+        OPTIM="$(TARGET_CFLAGS)" \
+        CFLAGS="$(TARGET_CFLAGS)" \
+        DESTDIR="$(PKG_INSTALL_DIR)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/pthsem-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/pthsem-config
+
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP)   $(PKG_INSTALL_DIR)/usr/include/*.h \
+               $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP)   $(PKG_INSTALL_DIR)/usr/lib/libpthsem.{a,la,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/pthsem/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpthsem.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,pthsem))
diff --git a/libs/qrencode/Makefile b/libs/qrencode/Makefile
new file mode 100644 (file)
index 0000000..da9a46f
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2006-2012 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:=qrencode
+PKG_VERSION:=3.4.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fukuchi.org/works/qrencode/
+PKG_MD5SUM:=2bb7fb7c7bd1a4042d4910b29609319e
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libqrencode
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Library for encoding data in a QR Code symbol
+  URL:=http://fukuchi.org/works/qrencode/
+endef
+
+define Package/libqrencode/description
+Libqrencode is a C library for encoding data in a QR Code symbol,
+a kind of 2D symbology that can be scanned by handy terminals such
+as a mobile phone with CCD. The capacity of QR Code is up to 7000
+digits or 4000 characters, and is highly robust.
+
+
+endef
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --enable-static \
+       --disable-rpath \
+       --disable-sdltest \
+       --without-tools \
+       --without-tests
+
+TARGET_LDFLAGS+= -s
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/qrencode.h $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libqrencode.{a,so*} $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/libqrencode.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libqrencode/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libqrencode.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libqrencode))
diff --git a/libs/radiusclient-ng/Makefile b/libs/radiusclient-ng/Makefile
new file mode 100644 (file)
index 0000000..0ebde3f
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2006-2010 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:=radiusclient-ng
+PKG_VERSION:=0.5.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.berlios.de/radiusclient-ng/
+PKG_MD5SUM:=6fb7d4d0aefafaee7385831ac46a8e9c
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/radiusclient-ng/Default
+  URL:=http://developer.berlios.de/projects/radiusclient-ng/
+endef
+
+define Package/radiusclient-ng/Default/description
+ Purpose of this project is to build a portable, easy-to-use and
+ standard compliant library suitable for developing free and commercial
+ software that need support for RADIUS protocol (RFCs 2128 and 2139).
+endef
+
+define Package/libradiusclient-ng
+$(call Package/radiusclient-ng/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=RADIUS client library
+endef
+
+define Package/libradiusclient-ng/description
+$(call Package/radiusclient-ng/Default/description)
+ This package contains shared libraries, needed by other programs.
+endef
+
+define Package/libradiusclient-ng/conffiles
+/etc/radiusclient-ng/issue
+/etc/radiusclient-ng/port-id-map
+/etc/radiusclient-ng/radiusclient.conf
+/etc/radiusclient-ng/servers
+endef
+
+define Package/radiusclient-ng
+  $(call Package/radiusclient-ng/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libradiusclient-ng
+  TITLE:=RADIUS client
+endef
+
+define Package/radiusclient-ng/description
+$(call Package/radiusclient-ng/Default/description)
+ This package contains a RADIUS client.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/radiusclient-ng.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libradiusclient-ng.{a,so}* $(1)/usr/lib/
+endef
+
+define Package/libradiusclient-ng/install
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/radiusclient-ng $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libradiusclient-ng.so.* $(1)/usr/lib/
+endef
+
+define Package/radiusclient-ng/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rad{acct,iusclient,login,status} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,libradiusclient-ng))
+$(eval $(call BuildPackage,radiusclient-ng))
diff --git a/libs/radiusclient-ng/patches/001-cross_compile.patch b/libs/radiusclient-ng/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..3925563
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/configure
++++ b/configure
+@@ -23332,8 +23332,7 @@ echo $ECHO_N "checking for field domainn
+   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+ echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&2;} }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+--- a/configure.in
++++ b/configure.in
+@@ -104,32 +104,7 @@ AC_REPLACE_FUNCS(strdup strerror strcase
+ AC_CHECK_FUNCS(flock fcntl uname gethostname sysinfo getdomainname)
+ AC_CHECK_FUNCS(stricmp random rand snprintf vsnprintf)
+-if test "$ac_cv_func_uname" = 'yes'
+-then
+-      AC_MSG_CHECKING([for field domainname in struct utsname])
+-      AC_TRY_RUN([
+-      #include <sys/utsname.h>
+-      
+-      main(int argc, char **argv)
+-      {
+-              struct utsname uts;
+-              uts.domainname[0] = '\0';
+-      }
+-      ],
+-      AC_MSG_RESULT(yes)
+-      AC_DEFINE(HAVE_STRUCT_UTSNAME_DOMAINNAME),
+-      AC_MSG_RESULT(no)
+-      )
+-fi
+-
+-AC_MSG_CHECKING([for /dev/urandom])
+-if test -c /dev/urandom
+-then
+-      AC_MSG_RESULT(yes)
+-      AC_DEFINE(HAVE_DEV_URANDOM)
+-else
+-      AC_MSG_RESULT(no)
+-fi
++AC_DEFINE(HAVE_DEV_URANDOM)
+ dnl Determine PATH setting
+ echo $ac_n "using the following PATH setting for exec'ed programs... $ac_c" 1>&6
diff --git a/libs/radlib/Makefile b/libs/radlib/Makefile
new file mode 100644 (file)
index 0000000..0f406b2
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2006-2010 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:=radlib
+PKG_VERSION:=2.12.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/radlib
+PKG_SHA1SUM:=1b3feace6d0361436c9e4ce9b06856195a5ac1b1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/radlib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpthread +libsqlite3
+  TITLE:=Rapid Application Development Library
+  URL:=http://www.radlib.teel.ws/
+endef
+
+define Package/radlib/description
+       radlib is a rapid application development library for unix multi-process applications
+endef
+
+define Package/radlib-sqlite/description
+  $(call Package/radlib/description)
+  This package comes with sqlite support
+endef
+
+EXTRA_LDFLAGS=-lsqlite3
+CONFIGURE_ARGS += \
+       --prefix="$(TOOLCHAIN_DIR)/usr" \
+       --enable-sqlite
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/h/rad*.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/src/.libs/librad.so* $(1)/usr/lib/
+endef
+
+define Package/radlib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/.libs/librad.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/msgRouter/.libs/radmrouted $(1)/usr/bin/
+endef
+
+define Package/radlib-sqlite/install
+       $(call Package/radlib/install,$(1))
+endef
+
+$(eval $(call BuildPackage,radlib))
diff --git a/libs/radlib/patches/001-cross_compile_link_bug.patch b/libs/radlib/patches/001-cross_compile_link_bug.patch
new file mode 100644 (file)
index 0000000..2c943bd
--- /dev/null
@@ -0,0 +1,71 @@
+--- a/debug/Makefile.am
++++ b/debug/Makefile.am
+@@ -27,8 +27,8 @@ raddebug_LDADD   += -lsqlite3
+ endif\r
\r
+ # define library directories\r
+-raddebug_LDFLAGS = -L../src/.libs -L$(prefix)/lib -L/usr/lib\r
+-INCLUDES         += -I$(prefix)/include -I/usr/include\r
++raddebug_LDFLAGS = -L../src/.libs -L$(prefix)/lib\r
++INCLUDES         += -I$(prefix)/include\r
\r
+ if MYSQL\r
+ raddebug_LDFLAGS += -L$(prefix)/lib64/mysql -L$(prefix)/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql\r
+@@ -39,6 +39,6 @@ INCLUDES         += -I$(prefix)/pgsql/in
+ endif\r
+ endif\r
\r
+-if CROSSCOMPILE\r
+-raddebug_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o\r
+-endif\r
++#if CROSSCOMPILE\r
++#raddebug_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o\r
++#endif\r
+--- a/msgRouter/Makefile.am
++++ b/msgRouter/Makefile.am
+@@ -27,8 +27,8 @@ radmrouted_LDADD   += -lsqlite3
+ endif\r
\r
+ # define library directories\r
+-radmrouted_LDFLAGS = -L../src/.libs -L$(prefix)/lib -L/usr/lib\r
+-INCLUDES           += -I$(prefix)/include -I/usr/include\r
++radmrouted_LDFLAGS = -L../src/.libs -L$(prefix)/lib\r
++INCLUDES           += -I$(prefix)/include\r
\r
+ if MYSQL\r
+ radmrouted_LDFLAGS += -L$(prefix)/lib64/mysql -L$(prefix)/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql\r
+@@ -39,6 +39,6 @@ INCLUDES           += -I$(prefix)/pgsql/
+ endif\r
+ endif\r
\r
+-if CROSSCOMPILE\r
+-radmrouted_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o\r
+-endif\r
++#if CROSSCOMPILE\r
++#radmrouted_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o\r
++#endif\r
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -34,9 +34,6 @@ PGSQL_HDRS   = \
+               $(top_srcdir)/database/postgresql/_pg-types.h\r
+ endif\r
+ if SQLITE\r
+-SQ_INCLUDES   = \\r
+-              -I$(prefix)/include \\r
+-              -I/usr/include\r
+ SQ_SOURCES    = \\r
+               $(top_srcdir)/src/radsqlite.c\r
+ SQLITE_HDRS   = \\r
+@@ -46,11 +43,9 @@ endif
+ # define include directories\r
+ INCLUDES = \\r
+               -I$(top_srcdir)/h \\r
+-              -I$(prefix)/include \\r
+               -D_GNU_SOURCE \\r
+               $(MY_INCLUDES) \\r
+-              $(PG_INCLUDES) \\r
+-              $(SQ_INCLUDES)\r
++              $(PG_INCLUDES)\r
\r
\r
\r
diff --git a/libs/rblibtorrent/Makefile b/libs/rblibtorrent/Makefile
new file mode 100644 (file)
index 0000000..760f185
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 9173 2007-10-07 03:20:26Z blogic $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rblibtorrent
+PKG_VERSION:=0.14.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=libtorrent-rasterbar-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/libtorrent
+PKG_MD5SUM:=6959f719245d82758235fd73d93373b2
+PKG_BUILD_DIR:=$(BUILD_DIR)/libtorrent-rasterbar-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=libtool
+BOOSTPOSTFIX=mt
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rblibtorrent
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Rasterbar BitTorrent library
+  URL:=http://www.rasterbar.com/products/libtorrent/
+  DEPENDS:=+boost +boost-python +boost-filesystem +boost-regex +boost-thread +boost-program_options +boost-system +libopenssl @BROKEN
+endef
+
+define Package/rblibtorrent/description
+Rasterbar libtorrent is a C++ library that aims to be a good alternative to
+all the other bittorrent implementations around. It is a library and not a
+full featured client, although it comes with a working example client.
+endef
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --disable-debug \
+       --enable-python-binding \
+       --with-ssl=$(STAGING_DIR)/usr \
+       --with-boost=$(STAGING_DIR)/usr/include \
+       --with-boost-libdir=$(STAGING_DIR)/usr/lib \
+       --with-zlib=detect \
+       --with-boost-system=boost_system-$(BOOSTPOSTFIX) \
+       --with-boost-filesystem=boost_filesystem-$(BOOSTPOSTFIX) \
+       --with-boost-thread=boost_thread-$(BOOSTPOSTFIX) \
+       --with-boost-regex=boost_regex-$(BOOSTPOSTFIX) \
+       --with-boost-python=boost_python-$(BOOSTPOSTFIX) \
+       --with-boost-program_options=boost_program_options-$(BOOSTPOSTFIX)
+
+CONFIGURE_VARS+=CC="$(TARGET_CXX)"
+
+EXTRA_LDFLAGS+=-lz -lpthread
+
+define Build/Compile
+       $(call Build/Compile/Default)
+       $(call Build/Install/Default)
+endef
+
+define Build/InstallDev
+       mkdir -p $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libtorrent $(1)/usr/include/
+       mkdir -p $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+       mkdir -p $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtorrent-rasterbar.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/rblibtorrent/install
+       $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/lib/python2.6/site-packages/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.6/site-packages/*.so* $(1)/usr/lib/python2.6/site-packages/
+endef
+
+$(eval $(call BuildPackage,rblibtorrent))
diff --git a/libs/rblibtorrent/patches/enable-shared-linking.patch b/libs/rblibtorrent/patches/enable-shared-linking.patch
new file mode 100644 (file)
index 0000000..dec80cc
--- /dev/null
@@ -0,0 +1,11 @@
+--- libtorrent-rasterbar-0.14.7/bindings/python/Makefile.in    2009-11-18 09:25:39.000000000 +0100
++++ libtorrent-rasterbar-0.14.7/bindings/python/Makefile.in    2010-02-26 13:27:58.000000000 +0100
+@@ -408,7 +408,7 @@
+ @ENABLE_PYTHON_BINDING_TRUE@all-local:
+-@ENABLE_PYTHON_BINDING_TRUE@  $(PYTHON) setup.py build
++@ENABLE_PYTHON_BINDING_TRUE@  CXX="$(CXX) -pthread -shared" $(PYTHON) setup.py build
+ @ENABLE_PYTHON_BINDING_TRUE@install-exec-local:
+ @ENABLE_PYTHON_BINDING_TRUE@  $(PYTHON) setup.py install @PYTHON_INSTALL_PARAMS@
diff --git a/libs/sctp/Makefile b/libs/sctp/Makefile
new file mode 100644 (file)
index 0000000..dd9e3a7
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2010 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:=lksctp-tools
+PKG_VERSION:=1.0.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/lksctp/
+PKG_MD5SUM:=e9cf6c57402c9d4f1173a9529466e16d
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+#####
+## lksctp library: provides sctp_* functions in user space
+#####
+
+define Package/sctp
+  SECTION:=libs
+  CATEGORY:=Network
+  TITLE:=SCTP user-land library
+  URL:=http://lksctp.sourceforge.net
+  DEPENDS:=+kmod-sctp
+endef
+
+define Package/sctp/description
+ SCTP user-land library for sctp_* functions (when socket API is too limited).
+endef
+
+TARGET_LDFLAGS := -L$(STAGING_DIR)/usr/lib $(TARGET_LDFLAGS)
+
+define Package/sctp/install
+       # Install the library in the router
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libsctp.so* \
+               $(1)/usr/lib/
+       # And also in staging for dependent packages
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/include/netinet
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/netinet/* \
+               $(STAGING_DIR)/usr/include/netinet/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libsctp.so* \
+               $(STAGING_DIR)/usr/lib/
+
+endef
+
+$(eval $(call BuildPackage,sctp))
+
diff --git a/libs/serdisplib/Makefile b/libs/serdisplib/Makefile
new file mode 100644 (file)
index 0000000..af08760
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# 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:=serdisplib
+PKG_VERSION:=1.97.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/serdisplib
+PKG_MD5SUM:=130552ec60d01e974712a60274f34de7
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/serdisplib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A display control library
+  URL:=http://serdisplib.sourceforge.net/
+  DEPENDS:=+libusb-compat
+endef
+
+define Package/serdisplib/description
+       serdisplib is a library to drive serial and parallel displays
+       with built-in controllers.
+endef
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --enable-static \
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -Wno-implicit -I../include -I.." \
+               all
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/include/serdisplib $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libserdisp.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/serdisplib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libserdisp.so.* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,serdisplib))
diff --git a/libs/slang2/Makefile b/libs/slang2/Makefile
new file mode 100644 (file)
index 0000000..fc43bf0
--- /dev/null
@@ -0,0 +1,97 @@
+#
+# Copyright (C) 2006-2011 Openwrt.org
+# Copyright (C) 2011 SMBPhone Inc.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=slang
+PKG_VERSION:=2.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://space.mit.edu/pub/davis/slang/v2.2 \
+       ftp://space.mit.edu/pub/davis/slang/v2.2/OLD
+PKG_MD5SUM:=7fcfd447e378f07dd0c0bae671fe6487
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libslang2
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=S-Lang v2.2
+  URL:=http://www.jedsoft.org/slang
+  DEPENDS:= +terminfo
+endef
+
+define Package/libslang2/description
+  Multi-platform programmer's library providing facilities for interactive
+  applications.  Includes such things as display/screen management,
+  keyboard input, keymaps, etc.  Includes the embeddable S-Lang interpreter.
+endef
+
+define Package/slsh
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=S-Lang Shell
+  URL:=http://www.jedsoft.org/slang/slsh.html
+  DEPENDS:= +libslang2
+endef
+
+define Package/libslang2/description
+  This is a shell which is mostly just a wrapper around the S-Lang Interpreter,
+  which is part of the S-Lang Library.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_LDFLAGS += -L../src/${ARCH}elfobjs
+
+CONFIGURE_ARGS += \
+       --enable-largefile \
+       --disable-warnings \
+       --with-terminfo=default \
+       --with-readline=slang \
+       --without-x \
+       --without-pcre \
+       --without-onig \
+       --without-png \
+       --without-z \
+       ac_cv_path_nc5config=$(PWD)/files/ncurses5-config
+
+define Build/Compile
+       $(call Build/Compile/Default)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               static install install-static
+endef
+
+define Package/libslang2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libslang.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/slang/ $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libslang.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/slsh/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/slsh $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/slsh/ $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,libslang2))
+$(eval $(call BuildPackage,slsh))
diff --git a/libs/slang2/files/ncurses5-config b/libs/slang2/files/ncurses5-config
new file mode 100755 (executable)
index 0000000..210d43f
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ "$1" == "--terminfo" ]; then
+       echo "/usr/share/terminfo"
+fi
+
diff --git a/libs/sqlite2/Makefile b/libs/sqlite2/Makefile
new file mode 100644 (file)
index 0000000..5cc703e
--- /dev/null
@@ -0,0 +1,101 @@
+#
+# Copyright (C) 2006-2010 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:=sqlite2
+PKG_VERSION:=2.8.17
+PKG_RELEASE:=2
+
+PKG_SOURCE:=sqlite-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.sqlite.org/
+PKG_MD5SUM:=838dbac20b56d2c4292e98848505a05b
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/sqlite-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=libncurses libreadline
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/sqlite2/Default
+  SUBMENU:=database
+  TITLE:=SQLite (v2.x) database engine
+  URL:=http://www.sqlite.org/
+endef
+
+define Package/libsqlite2
+  $(call Package/sqlite2/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+endef
+
+define Package/libsqlite2/description
+       SQLite is a small C library that implements a self-contained, embeddable,
+       zero-configuration SQL database engine.
+       This package contains the SQLite (v2.x) shared library, used by other programs.
+endef
+
+define Package/sqlite2-cli
+  $(call Package/sqlite2/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libsqlite2 +libncurses +libreadline
+  TITLE+= (cli)
+  SUBMENU:=database
+endef
+
+define Package/sqlite2-cli/description
+       SQLite is a small C library that implements a self-contained, embeddable,
+       zero-configuration SQL database engine.
+       This package contains a terminal-based front-end to the SQLite (v2.x) library
+       that can evaluate queries interactively and display the results in
+       multiple formats.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --enable-static \
+               , \
+               config_BUILD_CC="$(HOSTCC)" \
+               config_BUILD_CFLAGS="-O2" \
+               config_TARGET_CC="$(TARGET_CC)" \
+               config_TARGET_CFLAGS="$(TARGET_CFLAGS)" \
+               config_TARGET_READLINE_INC="$(TARGET_CPPFLAGS)" \
+               config_TARGET_READLINE_LIBS="$(TARGET_LDFLAGS) -lreadline -lncurses" \
+               config_TARGET_TCL_INC="-DNO_TCL=1" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/sqlite.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/sqlite.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libsqlite2/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsqlite.so.* $(1)/usr/lib/
+endef
+
+define Package/sqlite2-cli/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sqlite $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libsqlite2))
+$(eval $(call BuildPackage,sqlite2-cli))
diff --git a/libs/st2205tool/Makefile b/libs/st2205tool/Makefile
new file mode 100644 (file)
index 0000000..6ff9b1f
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2008-2009 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:=st2205tool
+PKG_VERSION:=1.4.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=st2205tool-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
+PKG_MD5SUM:=827e3b719ebaf6bc537f2ce0ece3fccb
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/st2205tool
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=ST220xu powered photo-frames library
+  DEPENDS:=+libgd
+  URL:=http://picframe.spritesserver.nl/wiki/
+endef
+
+define Package/st2205tool/description
+  Library for hacked photo-frames based on st220xu chipset. You may use those photo-frames with
+  mplayer or LCD4Linux
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/libst2205/" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       SETPICLIBS="$(TARGET_LDFLAGS) -lgd -ljpeg -lpng -lz -L../libst2205 -lst2205" \
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/libst2205/st2205.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libst2205/libst2205.{a,so*} $(1)/usr/lib/
+endef
+
+
+define Package/st2205tool/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/setpic/setpic $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libst2205/libst2205.so $(1)/usr/lib/libst2205.so.1
+endef
+
+$(eval $(call BuildPackage,st2205tool))
diff --git a/libs/st2205tool/patches/100-base-makefile.patch b/libs/st2205tool/patches/100-base-makefile.patch
new file mode 100644 (file)
index 0000000..854d040
--- /dev/null
@@ -0,0 +1,45 @@
+---
+ Makefile |   20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+--- st2205tool.orig/Makefile
++++ st2205tool/Makefile
+@@ -6,27 +6,27 @@ LIBS =
+ all:  libst2205/libst2205.so setpic/setpic phack splice bgrep
+ install: all
+-      make -C libst2205 install
++      $(MAKE) -C libst2205 install
+ libst2205/libst2205.so: 
+-      make -C libst2205
++      $(MAKE) -C libst2205
+-setpic/setpic:
+-      make -C setpic
++setpic/setpic: libst2205/libst2205.so
++      $(MAKE) -C setpic
+ phack:        $(OBJ) $(SRC)
+-      gcc -o $(@) $(OBJ) $(LIBS) $(FLAGS)
++      $(GCC) -o $(@) $(OBJ) $(LIBS) $(FLAGS)
+ splice:       splice.o splice.c
+-      gcc -o splice splice.o
++      $(GCC) -o splice splice.o
+ bgrep:        bgrep.o bgrep.c
+-      gcc -o bgrep bgrep.o
++      $(GCC) -o bgrep bgrep.o
+ clean:        
+-      make -C libst2205 clean
+-      make -C setpic clean
++      $(MAKE) -C libst2205 clean
++      $(MAKE) -C setpic clean
+       rm -f $(OBJ) phack splice splice.o bgrep bgrep.o
+ distclean: clean
+-      rm -f fwimage.bak memimage.bak fwimage.bin
+\ No newline at end of file
++      rm -f fwimage.bak memimage.bak fwimage.bin
diff --git a/libs/st2205tool/patches/110-libst-makefile.patch b/libs/st2205tool/patches/110-libst-makefile.patch
new file mode 100644 (file)
index 0000000..96b95ae
--- /dev/null
@@ -0,0 +1,25 @@
+--- st2205tool/libst2205/Makefile.orig 2009-08-19 17:05:54.000000000 +0200
++++ st2205tool/libst2205/Makefile      2009-08-19 17:06:27.000000000 +0200
+@@ -7,15 +7,15 @@
+ all:  libst2205.so
+ libst2205.so: $(OBJ) $(SRC) $(HEADERS) 
+-      ar -rv libst2205.a $(OBJ) 
+-      gcc -shared -Wl,-soname,libst2205.so.1 -o libst2205.so $(OBJ) $(LIBS)
++      $(AR) -rv libst2205.a $(OBJ) 
++      $(GCC) -shared -Wl,-soname,libst2205.so.1 -o libst2205.so $(OBJ) $(LIBS)
+ clean:        
+       rm -f $(OBJ) test *.a *.so
+ install: libst2205.so
+-      test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
+-      test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include"
+-      install libst2205.so /usr/local/lib
+-      install st2205.h /usr/local/include
+-      ldconfig
++#     test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
++#     test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include"
++#     install libst2205.so /usr/local/lib
++#     install st2205.h /usr/local/include
++#     ldconfig
diff --git a/libs/st2205tool/patches/120-setpic-makefile.patch b/libs/st2205tool/patches/120-setpic-makefile.patch
new file mode 100644 (file)
index 0000000..a3a0121
--- /dev/null
@@ -0,0 +1,18 @@
+--- st2205tool/setpic/Makefile.orig    2008-01-20 19:50:11.000000000 +0100
++++ st2205tool/setpic/Makefile 2008-04-22 16:06:40.000000000 +0200
+@@ -1,12 +1,12 @@
+ SRC   =       main.c
+ OBJ   =       main.o
+-CFLAGS        =       -g -Wall -I../libst2205
+-LIBS  =       -lgd -L../libst2205 -lst2205 
++#CFLAGS       =       -g -Wall -I./../libst2205
++#LIBS =       -lgd -lst2205 
+ all:  setpic
+ setpic:       $(OBJ) $(SRC)
+-      gcc -o $(@) $(OBJ) $(LIBS) $(FLAGS)
++      $(GCC) -o $(@) $(OBJ) $(SETPICLIBS) $(CFLAGS)
+ clean:        
+       rm -f $(OBJ) setpic
diff --git a/libs/taglib/Makefile b/libs/taglib/Makefile
new file mode 100644 (file)
index 0000000..8ef4101
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2007-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:=taglib
+PKG_VERSION:=1.6.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://developer.kde.org/~wheeler/files/src/
+PKG_MD5SUM:=ddf02f4e1d2dc30f76734df806e613eb
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+PKG_INSTALL:=1
+
+define Package/taglib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:= $(CXX_DEPENDS) +zlib @!TARGET_avr32
+  TITLE:=Audio output library
+  URL:=http://developer.kde.org/~wheeler/taglib.html
+endef
+
+define Package/taglibc
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+taglib
+  TITLE:=Audio output library
+  URL:=http://developer.kde.org/~wheeler/taglib.html
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/taglib-config \
+               $(2)/bin/
+       $(SED) \
+               's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+               $(2)/bin/taglib-config
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libtag{,_c}.so* \
+               $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/include/taglib
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/taglib/* \
+               $(1)/usr/include/taglib/
+endef
+
+define Package/taglib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtag.so.* $(1)/usr/lib/
+endef
+
+define Package/taglibc/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtag_c.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,taglib))
+$(eval $(call BuildPackage,taglibc))
diff --git a/libs/taglib/patches/100-uclibc++-compat.patch b/libs/taglib/patches/100-uclibc++-compat.patch
new file mode 100644 (file)
index 0000000..69a175e
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/taglib/toolkit/tlist.h
++++ b/taglib/toolkit/tlist.h
+@@ -226,6 +226,7 @@ namespace TagLib {
+      * the same.
+      */
+     bool operator==(const List<T> &l) const;
++    bool operator!=(const List<T> &l) const;
+   protected:
+     /*
+--- a/taglib/toolkit/tlist.tcc
++++ b/taglib/toolkit/tlist.tcc
+@@ -300,6 +300,12 @@ bool List<T>::operator==(const List<T> &
+   return d->list == l.d->list;
+ }
++template <class T>
++bool List<T>::operator!=(const List<T> &l) const
++{
++  return !(operator==(l));
++}
++
+ ////////////////////////////////////////////////////////////////////////////////
+ // protected members
+ ////////////////////////////////////////////////////////////////////////////////
+--- a/taglib/toolkit/tstring.cpp
++++ b/taglib/toolkit/tstring.cpp
+@@ -546,6 +546,11 @@ bool String::operator==(const String &s)
+   return d == s.d || d->data == s.d->data;
+ }
++bool String::operator!=(const String &s) const
++{
++  return !(operator==(s));
++}
++
+ String &String::operator+=(const String &s)
+ {
+   detach();
+--- a/taglib/toolkit/tstring.h
++++ b/taglib/toolkit/tstring.h
+@@ -342,6 +342,7 @@ namespace TagLib {
+      * returns true if the strings match.
+      */
+     bool operator==(const String &s) const;
++    bool operator!=(const String &s) const;
+     /*!
+      * Appends \a s to the end of the String.
diff --git a/libs/tiff/Makefile b/libs/tiff/Makefile
new file mode 100644 (file)
index 0000000..148a12e
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2006-2014 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:=tiff
+PKG_VERSION:=4.0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.osgeo.org/libtiff
+PKG_MD5SUM:=051c1068e6a0627f461948c365290410
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_libtiffxx
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tiff/Default
+  TITLE:=TIFF
+  URL:=http://www.remotesensing.org/libtiff/
+endef
+
+define Package/libtiff
+$(call Package/tiff/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+  DEPENDS:=+zlib +libjpeg
+endef
+
+define Package/libtiffxx
+$(call Package/tiff/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library(c++ bindings)
+  DEPENDS:=+libtiff $(CXX_DEPENDS)
+endef
+
+define Package/tiff-utils
+$(call Package/tiff/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= utilities
+  DEPENDS:=+libtiff
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               $(if $(CONFIG_PACKAGE_libtiffxx), \
+                       --enable-cxx, \
+                       --disable-cxx \
+               ) \
+               --disable-lzma \
+               --enable-ccitt \
+               --enable-packbits \
+               --enable-lzw \
+               --enable-thunder \
+               --enable-next \
+               --enable-logluv \
+               --enable-mdi \
+               --enable-zlib \
+               --enable-jpeg \
+               --disable-old-jpeg \
+               --disable-jbig \
+               --without-x \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/{lib,include}
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+endef
+
+define Package/libtiff/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiff.so.* $(1)/usr/lib/
+endef
+
+define Package/libtiffxx/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiffxx.so.* $(1)/usr/lib/
+endef
+
+define Package/tiff-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libtiff))
+$(eval $(call BuildPackage,libtiffxx))
+$(eval $(call BuildPackage,tiff-utils))
diff --git a/libs/tiff/patches/001-autoconf-compat.patch b/libs/tiff/patches/001-autoconf-compat.patch
new file mode 100644 (file)
index 0000000..c7c0dfc
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -25,7 +25,7 @@
+ docdir = $(LIBTIFF_DOCDIR)
+-AUTOMAKE_OPTIONS = 1.12 dist-zip foreign
++AUTOMAKE_OPTIONS = dist-zip foreign
+ ACLOCAL_AMFLAGS = -I m4
+ docfiles = \
+@@ -48,7 +48,7 @@ EXTRA_DIST = \
+ dist_doc_DATA = $(docfiles)
+-SUBDIRS = port libtiff tools build contrib test man html
++SUBDIRS = port libtiff tools build contrib
+ release:
+       (rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -23,7 +23,7 @@
+ # Process this file with automake to produce Makefile.in.
+-AUTOMAKE_OPTIONS = 1.12 color-tests parallel-tests foreign
++AUTOMAKE_OPTIONS = color-tests parallel-tests foreign
+ LIBTIFF = $(top_builddir)/libtiff/libtiff.la
diff --git a/libs/tokyocabinet/Makefile b/libs/tokyocabinet/Makefile
new file mode 100644 (file)
index 0000000..6dd9907
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2007-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:=tokyocabinet
+PKG_VERSION:=1.4.47
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fallabs.com/tokyocabinet
+PKG_MD5SUM:=3d94fe2aebf5d9ff0478ed895bc46fc9
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tokyocabinet
+  SUBMENU:=database
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A library of routines to manage databases
+  URL:=http://fallabs.com/tokyocabinet/
+  DEPENDS:=+zlib +bzip2 +libpthread +librt
+  MAINTAINER:=Obinou <obconseil@gmail.com>
+endef
+
+define Package/tokyocabinet/description
+ Tokyo Cabinet is a library of routines for managing a database.
+ The database is a simple data file containing records, each
+ is a pair of a key and a value. Every key and value is serial bytes
+ with variable length. Both binary data and character string can be
+ used as a key and a value. There is neither concept of data tables
+ nor data types. Records are organized in hash table, B+ tree,
+ or fixed-length array.
+
+ Tokyo Cabinet is developed as the successor of GDBM and QDBM on the
+ following purposes. They are achieved and Tokyo Cabinet replaces
+ conventional DBM products.
+endef
+
+CONFIGURE_ARGS += --prefix=/usr
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
+endef
+
+define Build/InstallDev
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(1)" install
+endef
+
+define Package/tokyocabinet/install
+       $(INSTALL_DIR)  $(1)/usr/lib
+       $(CP)  $(PKG_INSTALL_DIR)/usr/lib/libtokyocabinet.so*  $(1)/usr/lib
+       $(INSTALL_DIR)   $(1)/usr/share/tokyocabinet
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/tokyocabinet/tokyocabinet.idl $(1)/usr/share/tokyocabinet
+endef
+
+$(eval $(call BuildPackage,tokyocabinet))
diff --git a/libs/tokyocabinet/patches/100-remove_extra_paths_from_configure.patch b/libs/tokyocabinet/patches/100-remove_extra_paths_from_configure.patch
new file mode 100644 (file)
index 0000000..aa9ba24
--- /dev/null
@@ -0,0 +1,75 @@
+diff -ru tokyocabinet-1.4.47/configure tokyocabinet-1.4.47-new/configure
+--- tokyocabinet-1.4.47/configure      2011-02-11 10:59:53.000000000 +0100
++++ tokyocabinet-1.4.47-new/configure  2011-06-01 16:54:33.082157954 +0200
+@@ -2066,24 +2066,14 @@
+ # Building flags
+ MYCFLAGS="-std=c99 -Wall -fPIC -fsigned-char -O2"
+-MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I$HOME/include -I/usr/local/include"
++MYCPPFLAGS="-I."
+ MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__"
+-MYLDFLAGS="-L. -L\$(LIBDIR) -L$HOME/lib -L/usr/local/lib"
++MYLDFLAGS="-L."
+ MYCMDLDFLAGS=""
+ MYRUNPATH="\$(LIBDIR)"
+ MYLDLIBPATHENV="LD_LIBRARY_PATH"
+ MYPOSTCMD="true"
+-# Building paths
+-PATH="$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
+-PATH="$PATH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/ucb"
+-CPATH="$HOME/include:/usr/local/include:$CPATH"
+-LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH"
+-LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH"
+-PKG_CONFIG_PATH="$HOME/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
+-export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH
+-
+-
+ #================================================================
+ # Options
+diff -ru tokyocabinet-1.4.47/configure.in tokyocabinet-1.4.47-new/configure.in
+--- tokyocabinet-1.4.47/configure.in   2010-08-15 16:14:53.000000000 +0200
++++ tokyocabinet-1.4.47-new/configure.in       2011-06-01 16:53:34.645989924 +0200
+@@ -32,25 +32,14 @@
+ # Building flags
+ MYCFLAGS="-std=c99 -Wall -fPIC -fsigned-char -O2"
+-MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I$HOME/include -I/usr/local/include"
++MYCPPFLAGS="-I."
+ MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__"
+-MYLDFLAGS="-L. -L\$(LIBDIR) -L$HOME/lib -L/usr/local/lib"
++MYLDFLAGS="-L."
+ MYCMDLDFLAGS=""
+ MYRUNPATH="\$(LIBDIR)"
+ MYLDLIBPATHENV="LD_LIBRARY_PATH"
+ MYPOSTCMD="true"
+-# Building paths
+-PATH="$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
+-PATH="$PATH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/ucb"
+-CPATH="$HOME/include:/usr/local/include:$CPATH"
+-LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH"
+-LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH"
+-PKG_CONFIG_PATH="$HOME/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
+-export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH
+-
+-
+-
+ #================================================================
+ # Options
+ #================================================================
+diff -ru tokyocabinet-1.4.47/Makefile.in tokyocabinet-1.4.47-new/Makefile.in
+--- tokyocabinet-1.4.47/Makefile.in    2010-07-04 10:36:20.000000000 +0200
++++ tokyocabinet-1.4.47-new/Makefile.in        2011-06-01 15:02:19.383826342 +0200
+@@ -54,8 +54,8 @@
+ LDFLAGS = @MYLDFLAGS@
+ CMDLDFLAGS = @MYCMDLDFLAGS@
+ LIBS = @LIBS@
+-LDENV = LD_RUN_PATH=/lib:/usr/lib:$(LIBDIR):$(HOME)/lib:/usr/local/lib:@MYRUNPATH@:.
+-RUNENV = @MYLDLIBPATHENV@=.:/lib:/usr/lib:$(LIBDIR):$(HOME)/lib:/usr/local/lib:@MYRUNPATH@
++LDENV = LD_RUN_PATH=$(LIBDIR):@MYRUNPATH@:.
++RUNENV = @MYLDLIBPATHENV@=.:$(LIBDIR):@MYRUNPATH@
+ POSTCMD = @MYPOSTCMD@
diff --git a/libs/tokyocabinet/patches/200-uclibc_0.9.30_compat.patch b/libs/tokyocabinet/patches/200-uclibc_0.9.30_compat.patch
new file mode 100644 (file)
index 0000000..bf6a434
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/tctdb.c
++++ b/tctdb.c
+@@ -20,6 +20,26 @@
+ #include "tctdb.h"
+ #include "myconf.h"
++#ifdef __UCLIBC__
++# include <features.h>
++# if __UCLIBC_MINOR__ <= 9 && __UCLIBC_SUBLEVEL__ <= 30
++
++size_t strlen(const char *s);
++long double strtold(const char *nptr, char **endptr);
++static inline long double nanl(const char *tagp)
++{
++        if (tagp[0] != '\0') {
++                char buf[6 + strlen(tagp)];
++                sprintf(buf, "NAN(%s)", tagp);
++                return strtold(buf, NULL);
++        }
++        return NAN;
++}
++
++# endif /* __UCLIBC_MINOR__ <= 9 && __UCLIBC_SUBLEVEL__ <= 30 */
++#endif /* __UCLIBC__ */
++
++
+ #define TDBOPAQUESIZ   64                // size of using opaque field
+ #define TDBLEFTOPQSIZ  64                // size of left opaque field
+ #define TDBPAGEBUFSIZ  32768             // size of a buffer to read each page
diff --git a/libs/ucl/Makefile b/libs/ucl/Makefile
new file mode 100644 (file)
index 0000000..50dafd9
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006-2010 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:=ucl
+PKG_VERSION:=1.03
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/ucl/download/
+PKG_MD5SUM:=852bd691d8abc75b52053465846fba34
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libucl
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Portable lossless data compression library
+  URL:=http://www.oberhumer.com/opensource/ucl/
+endef
+
+define Package/libucl/description
+UCL is a portable lossless data compression library written in ANSI C. UCL
+implements a number of compression algorithms that achieve an excellent
+compression ratio while allowing *very* fast decompression. Decompression
+requires no additional memory.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared \
+       --disable-asm
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/ucl
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ucl/ucl{,conf}.h $(1)/usr/include/ucl/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucl.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/libucl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucl.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libucl))
diff --git a/libs/ucl/patches/001-autoconf-compat.patch b/libs/ucl/patches/001-autoconf-compat.patch
new file mode 100644 (file)
index 0000000..7dda83d
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -48,7 +48,7 @@ AC_CANONICAL_TARGET
+ AM_MAINTAINER_MODE
+ if test -z "$ac_abs_top_srcdir"; then
+-    _AC_SRCPATHS(.)
++    _AC_SRCDIRS(.)
+ fi
+ if test -r .Conf.settings1; then
+     . ./.Conf.settings1
diff --git a/libs/uclibc++/patches/001-do-not-set-make.patch b/libs/uclibc++/patches/001-do-not-set-make.patch
new file mode 100644 (file)
index 0000000..d5ce623
--- /dev/null
@@ -0,0 +1,8 @@
+diff -Nur uClibc++-0.2.4.orig/Makefile uClibc++-0.2.4/Makefile
+--- uClibc++-0.2.4.orig/Makefile       2012-05-25 23:15:31.000000000 +0200
++++ uClibc++-0.2.4/Makefile    2013-03-11 11:50:03.000000000 +0100
+@@ -1,4 +1,3 @@
+-MAKE    = make
+ SUBDIRS = bin include src
+ # User defines:
diff --git a/libs/ustl/Makefile b/libs/ustl/Makefile
new file mode 100644 (file)
index 0000000..ebbdecd
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006 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:=ustl
+PKG_VERSION:=0.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-0.8-0.tar.bz2
+PKG_SOURCE_URL:=@SF/ustl
+PKG_MD5SUM:=dd59483c327f1bd1356273bc5ae4dde0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ustl
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=C++ STL for embedded systems
+  DEPENDS:=@!TARGET_avr32
+  URL:=http://ustl.sourceforge.net/
+endef
+
+define Package/ustl/description
+       C++ Standard Template Library (STL) for embedded systems.\\\
+    uSTL is a partial implementation of the STL (Standard Template \\\
+    Library) that reduces code size by factoring memory management \\\
+    code into a non-template base class and deriving containers \\\
+    from it.
+endef
+
+define Build/Configure
+       $(CP) ./files/config.h $(PKG_BUILD_DIR)/
+       $(CP) ./files/Common.mk $(PKG_BUILD_DIR)/
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CROSS="$(TARGET_CROSS)" \
+               OPTFLAGS="$(TARGET_CFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/ustl/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libustl.so.* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ustl* $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libustl.{a,so*} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,ustl))
diff --git a/libs/ustl/files/Common.mk b/libs/ustl/files/Common.mk
new file mode 100644 (file)
index 0000000..ab0cdf5
--- /dev/null
@@ -0,0 +1,74 @@
+LIBNAME                = ustl
+MAJOR          = 0
+MINOR          = 8
+BUILD          = 0
+
+CC             = $(CROSS)gcc 
+CXX            = $(CROSS)g++ 
+LD             = $(CROSS)gcc 
+AR             = $(CROSS)ar
+RANLIB         = $(CROSS)ranlib
+DOXYGEN                = echo
+INSTALL                = install
+RM             = rm -f
+LN             = ln -sf
+
+prefix         = /usr
+exec_prefix    = /usr
+BINDIR         = /usr/bin
+INCDIR         = /usr/include
+LIBDIR         = /usr/lib
+
+DESTDIR                =
+
+INSTALLDIR     = ${INSTALL} -d
+INSTALLLIB     = ${INSTALL} -p -m 644
+INSTALLEXE     = ${INSTALL} -p -m 755
+INSTALLDATA    = ${INSTALL} -p -m 644
+
+CWARNOPTS      = -Wall -W -Wpointer-arith -Wno-cast-align \
+               -Wcast-qual -Wwrite-strings -Wredundant-decls 
+CXXWARNOPTS    = ${CWARNOPTS} -Wconversion -Wsign-promo -Wsynth -Woverloaded-virtual
+PROCESSOR_OPTS =
+INLINE_OPTS    = -finline-limit=65535
+CUSTOMINCDIR   =
+CUSTOMLIBDIR   =
+
+BUILD_SHARED   = 1
+BUILD_STATIC   = 1 
+#DEBUG         = 1
+#PROFILE       = 1
+STANDALONE     = -nodefaultlibs
+
+CFLAGS         =  \
+               ${CUSTOMINCDIR} ${OPTFLAGS} ${CWARNOPTS} ${STANDALONE}
+CXXFLAGS       =  \
+               ${CUSTOMINCDIR} ${OPTFLAGS} ${INLINE_OPTS} \
+               ${CXXWARNOPTS} ${STANDALONE} -fno-builtin
+LDFLAGS                = ${CUSTOMLIBDIR} ${STANDALONE}
+OPTFLAGS       = ${PROCESSOR_OPTS}
+ifdef DEBUG
+    OPTFLAGS   += -O0 -g
+else
+    OPTFLAGS   += -O3 -DNDEBUG=1
+endif
+ifdef PROFILE
+    OPTFLAGS   += -pg
+endif
+ifdef STANDALONE
+    LIBS       += -lsupc++ -lgcc_s -lc
+endif
+ifdef BUILD_SHARED
+    CFLAGS     += -fPIC
+    CXXFLAGS   += -fPIC
+endif
+SHBLDFL                = -shared
+
+LIBA           = lib${LIBNAME}.a
+LIBSO          = lib${LIBNAME}.so
+ifdef MAJOR
+LIBSOLNK       = ${LIBSO}.${MAJOR}.${MINOR}
+LIBSOBLD       = ${LIBSO}.${MAJOR}.${MINOR}.${BUILD}
+endif
+TOCLEAN                += ${LIBSO} ${LIBA} ${LIBSOBLD}
+
diff --git a/libs/ustl/files/config.h b/libs/ustl/files/config.h
new file mode 100644 (file)
index 0000000..903e225
--- /dev/null
@@ -0,0 +1,286 @@
+// config.h
+//
+// Autogenerated from config.h.in by bsconf.
+//
+
+#ifndef CONFIG_H_01E33670634DAAC779EE5FF41CCBB36F
+#define CONFIG_H_01E33670634DAAC779EE5FF41CCBB36F
+
+// Define to the one symbol short name of this package.
+#define USTL_NAME      "ustl"
+// Define to the full name and version of this package.
+#define USTL_STRING    "ustl 0.8"
+// Define to the version of this package.
+#define USTL_VERSION   0x080
+// Define to the address where bug reports for this package should be sent.
+#define USTL_BUGREPORT "Mike Sharov <msharov@users.sourceforge.net>"
+
+/// Define to 1 if you want to build without libstdc++
+#define WITHOUT_LIBSTDCPP 1
+
+/// Define to 1 if you want stream operations to throw exceptions on
+/// insufficient data or insufficient space. All these errors should
+/// be preventable in output code; the input code should verify the
+/// data in a separate step. It slows down stream operations a lot,
+/// but it's your call. By default only debug builds throw.
+///
+#undef WANT_STREAM_BOUNDS_CHECKING
+
+#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) && !defined(WITHOUT_LIBSTDCPP)
+    #define WANT_STREAM_BOUNDS_CHECKING 1
+#endif
+
+/// Define to 1 if you don't want the standard streams.
+/// You will not be able to run bvt tests if you do this.
+///
+#undef WITHOUT_CIN_COUT_CERR
+
+/// Define GNU extensions if unavailable.
+#ifndef __GNUC__
+    /// GCC (and some other compilers) define '__attribute__'; ustl is using this
+    /// macro to alert the compiler to flag inconsistencies in printf/scanf-like
+    /// function calls.  Just in case '__attribute__' isn't defined, make a dummy.
+    /// 
+    #ifndef __attribute__
+       #define __attribute__(p)
+    #endif
+#endif
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+    #define DLL_EXPORT         __attribute__((visibility("default")))
+    #define DLL_LOCAL          __attribute__((visibility("hidden")))
+#else
+    #define DLL_EXPORT
+    #define DLL_LOCAL
+#endif
+#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(__i386__)
+    /// GCC 3+ supports the prefetch directive, which some CPUs use to improve caching
+    #define prefetch(p,rw,loc) __builtin_prefetch(p,rw,loc)
+#else
+    #define prefetch(p,rw,loc)
+#endif
+#if !defined(__GNUC__) || (__GNUC__ < 3)
+    /// __alignof__ returns the recommended alignment for the type
+    #define __alignof__(v)     min(sizeof(v), sizeof(void*))
+#endif
+
+/// Define to 1 if you have the `atexit' function.
+#define HAVE_ATEXIT 1
+
+/// Define to 1 if you have the <assert.h> header file.
+#define HAVE_ASSERT_H 1
+
+/// Define to 1 if you have the <ctype.h> header file.
+#define HAVE_CTYPE_H 1
+
+/// Define to 1 if you have the <errno.h> header file.
+#define HAVE_ERRNO_H 1
+
+/// Define to 1 if you have the <fcntl.h> header file.
+#define HAVE_FCNTL_H 1
+
+/// Define to 1 if you have the <float.h> header file.
+#define HAVE_FLOAT_H 1
+
+/// Define to 1 if you have the <inttypes.h> header file.
+#define HAVE_INTTYPES_H 1
+
+/// Define to 1 if you have the <limits.h> header file.
+#define HAVE_LIMITS_H 1
+
+/// Define to 1 if you have the <locale.h> header file.
+#define HAVE_LOCALE_H 1
+
+/// Define to 1 if your system has a working `malloc' function.
+#define HAVE_MALLOC 1
+
+// Define to 1 if you have the <malloc.h> header file.
+#define HAVE_MALLOC_H 1
+
+// Define to 1 if you have the <alloca.h> header file.
+#define HAVE_ALLOCA_H 1
+
+// Define to 1 if you have the `memchr' function.
+#define HAVE_MEMCHR 1
+
+// Define to 1 if you have the `memmove' function.
+#define HAVE_MEMMOVE 1
+
+// Define to 1 if you have the <memory.h> header file.
+#define HAVE_MEMORY_H 1
+
+// Define to 1 if you have the `memset' function.
+#define HAVE_MEMSET 1
+
+// Define to 1 if the system has the type `ptrdiff_t'.
+#define HAVE_PTRDIFF_T 1
+
+// Define to 1 if you have the <signal.h> header file.
+#define HAVE_SIGNAL_H 1
+
+// Define to 1 if you have the __va_copy function
+#define HAVE_VA_COPY 1
+
+// Define to 1 if `stat' has the bug that it succeeds when given the
+// zero-length file name argument.
+/* #undef HAVE_STAT_EMPTY_STRING_BUG */
+
+// Define to 1 if you have the <stdarg.h> header file.
+#define HAVE_STDARG_H 1
+
+// Define to 1 if you have the <stddef.h> header file.
+#define HAVE_STDDEF_H 1
+
+// Define to 1 if you have the <stdint.h> header file.
+#define HAVE_STDINT_H 1
+
+// Define to 1 if you have the <stdio.h> header file.
+#define HAVE_STDIO_H 1
+
+// Define to 1 if you have the <stdlib.h> header file.
+#define HAVE_STDLIB_H 1
+
+// Define to 1 if you have the `strerror' function.
+#define HAVE_STRERROR 1
+
+// Define to 1 if you have the <strings.h> header file.
+#define HAVE_STRINGS_H 1
+
+// Define to 1 if you have the <string.h> header file.
+#define HAVE_STRING_H 1
+
+// Define to 1 if you have the `strrchr' function.
+#define HAVE_STRRCHR 1
+
+// Define to 1 if you have the `strsignal' function.
+#define HAVE_STRSIGNAL 1
+
+// Define to 1 if you have the `strtol' function.
+#define HAVE_STRTOL 1
+
+// Define to 1 if you have the <sys/stat.h> header file.
+#define HAVE_SYS_STAT_H 1
+
+// Define to 1 if you have the <sys/types.h> header file.
+#define HAVE_SYS_TYPES_H 1
+
+// Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible.
+#define HAVE_SYS_WAIT_H 1
+
+// Define to 1 if you have the <time.h> header file.
+#define HAVE_TIME_H 1
+
+// Define to 1 if you have the <unistd.h> header file.
+#define HAVE_UNISTD_H 1
+
+// Define to 1 if you have the <math.h> header file.
+#define HAVE_MATH_H 1
+
+// Define to 1 if you have the rintf function. Will use rint otherwise.
+#undef HAVE_RINTF
+
+// STDC_HEADERS is defined to 1 on sane systems.
+#if defined(HAVE_ASSERT_H) && defined(HAVE_CTYPE_H) &&\
+    defined(HAVE_ERRNO_H) && defined(HAVE_FLOAT_H) &&\
+    defined(HAVE_LIMITS_H) && defined(HAVE_LOCALE_H) &&\
+    defined(HAVE_MATH_H) && defined(HAVE_SIGNAL_H) &&\
+    defined(HAVE_STDARG_H) && defined(HAVE_STDDEF_H) &&\
+    defined(HAVE_STDIO_H) && defined(HAVE_STDLIB_H) &&\
+    defined(HAVE_STRING_H) && defined(HAVE_TIME_H)
+#define STDC_HEADERS 1
+#endif
+
+// STDC_HEADERS is defined to 1 on unix systems.
+#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_STAT_H) && defined(HAVE_UNISTD_H)
+#define STDUNIX_HEADERS 1
+#endif
+
+// Define to 1 if you have the <byteswap.h> header file.
+#if (__GNUC__ >= 3) // gcc 2.95 somehow doesn't recognize 'asm volatile' in libc byteswap.h
+#define HAVE_BYTESWAP_H 1
+#endif
+
+// Define to 1 if `lstat' dereferences a symlink specified with a trailing slash.
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+
+// Define to 1 if your compiler treats char as a separate type along with
+// signed char and unsigned char. This will create overloads for char.
+#define HAVE_THREE_CHAR_TYPES 1
+
+// Define as the return type of signal handlers (`int' or `void').
+#define RETSIGTYPE void
+
+// Define to 1 if you have 64 bit types available
+#define HAVE_INT64_T 1
+
+// Define to 1 if you have the long long type
+#define HAVE_LONG_LONG 1
+
+// Define to 1 if you want unrolled specializations for fill and copy
+#undef WANT_UNROLLED_COPY
+
+// Define to 1 if you want to use MMX/SSE/3dNow! processor instructions
+#undef WANT_MMX
+
+// Define to byte sizes of types
+#define SIZE_OF_CHAR 1
+#define SIZE_OF_SHORT 2
+#define SIZE_OF_INT 4
+#define SIZE_OF_LONG 4
+#define SIZE_OF_LONG_LONG 8
+#define SIZE_OF_POINTER 4
+#define SIZE_OF_SIZE_T 4
+#define SIZE_OF_BOOL SIZE_OF_CHAR
+#undef SIZE_T_IS_LONG
+
+// Byte order macros, converted in utypes.h
+#define USTL_LITTLE_ENDIAN     4321
+#define USTL_BIG_ENDIAN                1234
+#define USTL_BYTE_ORDER                USTL_LITTLE_ENDIAN
+
+// Extended CPU capabilities
+#define CPU_HAS_FPU 1
+#define CPU_HAS_EXT_DEBUG 1
+#define CPU_HAS_TIMESTAMPC 1
+#define CPU_HAS_MSR 1
+#define CPU_HAS_CMPXCHG8 1
+#define CPU_HAS_APIC 1
+#define CPU_HAS_SYSCALL 1
+#define CPU_HAS_MTRR 1
+#define CPU_HAS_CMOV 1
+#define CPU_HAS_FCMOV 1
+#if WANT_MMX
+#undef CPU_HAS_MMX 1
+#undef CPU_HAS_FXSAVE
+#undef CPU_HAS_SSE 1
+#undef CPU_HAS_SSE2 1
+#undef CPU_HAS_SSE3
+#undef CPU_HAS_EXT_3DNOW
+#undef CPU_HAS_3DNOW
+#endif
+
+// GCC vector extensions
+#if defined(CPU_HAS_MMX) || defined(CPU_HAS_SSE)
+    #undef HAVE_VECTOR_EXTENSIONS
+#endif
+
+#if CPU_HAS_SSE && defined(__GNUC__)
+    #define __sse_align        __attribute__((aligned(16)))
+#else
+    #define __sse_align        
+#endif
+
+// Define to empty if `const' does not conform to ANSI C.
+/* #define const */
+
+// Define as `__inline' if that's what the C compiler calls it, or to nothing
+// if it is not supported.
+/* #define inline __inline */
+
+// Define to `long' if <sys/types.h> does not define.
+/* typedef long off_t; */
+
+// Define to `unsigned' if <sys/types.h> does not define.
+/* typedef long size_t; */
+
+#endif // CONFIG_H_01E33670634DAAC779EE5FF41CCBB36F
+
diff --git a/libs/ustl/patches/001-install-DESTDIR.patch b/libs/ustl/patches/001-install-DESTDIR.patch
new file mode 100644 (file)
index 0000000..ec3a959
--- /dev/null
@@ -0,0 +1,56 @@
+diff -ruN ustl-0.8-old/Makefile ustl-0.8-new/Makefile
+--- ustl-0.8-old/Makefile      2005-11-10 21:06:53.000000000 +0100
++++ ustl-0.8-new/Makefile      2005-12-08 13:57:07.000000000 +0100
+@@ -39,35 +39,35 @@
+ .PHONY: install-static install-shared uninstall-static uninstall-shared
+ install-shared: ${LIBSOBLD} install-incs
+-      @echo "Installing ${LIBSOBLD} to ${LIBDIR} ..."
+-      @${INSTALLDIR} ${LIBDIR}
+-      @${INSTALLLIB} ${LIBSOBLD} ${LIBDIR}
+-      @(cd ${LIBDIR}; ${RM} ${LIBSO} ${LIBSOLNK}; ${LN} -sf ${LIBSOBLD} ${LIBSO}; ${LN} -sf ${LIBSOBLD} ${LIBSOLNK})
++      @echo "Installing ${LIBSOBLD} to ${DESTDIR}${LIBDIR} ..."
++      @${INSTALLDIR} ${DESTDIR}${LIBDIR}
++      @${INSTALLLIB} ${LIBSOBLD} ${DESTDIR}${LIBDIR}
++      @(cd ${DESTDIR}${LIBDIR}; ${RM} ${LIBSO} ${LIBSOLNK}; ${LN} -sf ${LIBSOBLD} ${LIBSO}; ${LN} -sf ${LIBSOBLD} ${LIBSOLNK})
+ uninstall-shared: uninstall-incs
+-      @echo "Removing ${LIBSOBLD} from ${LIBDIR} ..."
+-      @${RM} -f ${LIBDIR}/${LIBSO} ${LIBDIR}/${LIBSOLNK} ${LIBDIR}/${LIBSOBLD}
++      @echo "Removing ${LIBSOBLD} from ${DESTDIR}${LIBDIR} ..."
++      @${RM} -f ${DESTDIR}${LIBDIR}/${LIBSO} ${DESTDIR}${LIBDIR}/${LIBSOLNK} ${DESTDIR}${LIBDIR}/${LIBSOBLD}
+ install-static: ${LIBA} install-incs
+-      @echo "Installing ${LIBA} to ${LIBDIR} ..."
+-      @${INSTALLDIR} ${LIBDIR}
+-      @${INSTALLLIB} ${LIBA} ${LIBDIR}
++      @echo "Installing ${LIBA} to ${DESTDIR}${LIBDIR} ..."
++      @${INSTALLDIR} ${DESTDIR}${LIBDIR}
++      @${INSTALLLIB} ${LIBA} ${DESTDIR}${LIBDIR}
+ uninstall-static: uninstall-incs
+-      @echo "Removing ${LIBA} from ${LIBDIR} ..."
+-      @${RM} -f ${LIBDIR}/${LIBA}
++      @echo "Removing ${LIBA} from ${DESTDIR}${LIBDIR} ..."
++      @${RM} -f ${DESTDIR}${LIBDIR}/${LIBA}
+ install-incs: ${INCS}
+-      @echo "Installing headers to ${INCDIR} ..."
+-      @${INSTALLDIR} ${INCDIR}/${LIBNAME}
++      @echo "Installing headers to ${DESTDIR}${INCDIR} ..."
++      @${INSTALLDIR} ${DESTDIR}${INCDIR}/${LIBNAME}
+       @for i in $(filter-out ${LIBNAME}.h,${INCS}); do        \
+-          ${INSTALLDATA} $$i ${INCDIR}/${LIBNAME}/$$i;        \
++          ${INSTALLDATA} $$i ${DESTDIR}${INCDIR}/${LIBNAME}/$$i;      \
+       done;
+-      @${INSTALLDATA} ${LIBNAME}.h ${INCDIR}
++      @${INSTALLDATA} ${LIBNAME}.h ${DESTDIR}${INCDIR}
+ uninstall-incs:
+-      @echo "Removing headers from ${INCDIR} ..."
+-      @${RM} -rf ${INCDIR}/${LIBNAME} ${INCDIR}/${LIBNAME}.h
++      @echo "Removing headers from ${DESTDIR}${INCDIR} ..."
++      @${RM} -rf ${DESTDIR}${INCDIR}/${LIBNAME} ${DESTDIR}${INCDIR}/${LIBNAME}.h
+ %.o:  %.cc
diff --git a/libs/ustl/patches/002-install_path.patch b/libs/ustl/patches/002-install_path.patch
new file mode 100644 (file)
index 0000000..3a7cf8a
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN ustl.old/Common.mk.in ustl.dev/Common.mk.in
+--- ustl.old/Common.mk.in      2005-11-10 21:06:53.000000000 +0100
++++ ustl.dev/Common.mk.in      2006-03-23 16:12:05.000000000 +0100
+@@ -9,7 +9,7 @@
+ AR            = @AR@
+ RANLIB                = @RANLIB@
+ DOXYGEN               = @DOXYGEN@
+-INSTALL               = @INSTALL@
++INSTALL               = install
+ RM            = @RM@
+ LN            = @LN@
diff --git a/libs/ustl/patches/003-fix_stream_bounds_check_dep.patch b/libs/ustl/patches/003-fix_stream_bounds_check_dep.patch
new file mode 100644 (file)
index 0000000..6def743
--- /dev/null
@@ -0,0 +1,54 @@
+--- a/config.h.in
++++ b/config.h.in
+@@ -15,6 +15,9 @@
+ // Define to the address where bug reports for this package should be sent.
+ #define USTL_BUGREPORT        "@PACKAGE_BUGREPORT@"
++/// Define to 1 if you want to build without libstdc++
++#undef WITHOUT_LIBSTDCPP
++
+ /// Define to 1 if you want stream operations to throw exceptions on
+ /// insufficient data or insufficient space. All these errors should
+ /// be preventable in output code; the input code should verify the
+@@ -23,13 +26,10 @@
+ ///
+ #undef WANT_STREAM_BOUNDS_CHECKING
+-#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG)
++#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) && !defined(WITHOUT_LIBSTDCPP)
+     #define WANT_STREAM_BOUNDS_CHECKING 1
+ #endif
+-/// Define to 1 if you want to build without libstdc++
+-#undef WITHOUT_LIBSTDCPP
+-
+ /// Define to 1 if you don't want the standard streams.
+ /// You will not be able to run bvt tests if you do this.
+ ///
+--- a/mostream.h
++++ b/mostream.h
+@@ -11,7 +11,9 @@
+ #include "memlink.h"
+ #include "uexception.h"
+ #include "utf8.h"
++#ifdef WANT_STREAM_BOUNDS_CHECKING
+ #include <typeinfo>
++#endif
+ namespace ustl {
+--- a/uctrstrm.h
++++ b/uctrstrm.h
+@@ -109,8 +109,12 @@
+     size_type n;
+     is >> n;
+     const size_type expectedSize = n * stream_size_of(value_type());
++#ifdef WANT_STREAM_BOUNDS_CHECKING
+     if (expectedSize > is.remaining())
+       throw stream_bounds_exception ("read", typeid(v).name(), is.pos(), expectedSize, is.remaining());
++#else
++    assert(expectedSize <= is.remaining());
++#endif
+     v.resize (n);
+     nr_container_read (is, v);
+     is.align();
diff --git a/libs/vips/Makefile b/libs/vips/Makefile
new file mode 100644 (file)
index 0000000..69239ab
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2010-2012 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:=vips
+PKG_VERSION:=7.34.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.vips.ecs.soton.ac.uk/supported/7.34/
+PKG_MD5SUM:=520658fb5890103e446df629fb832795
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+PKG_INSTALL=1
+
+define Package/vips
+  $(call Package/vips/Default)
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=An image manipulation library
+  URL:=http://www.vips.ecs.soton.ac.uk/
+  DEPENDS:=+glib2 +libexif +libjpeg +libpng +libxml2 $(INTL_DEPENDS)
+endef
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+CONFIGURE_ARGS += \
+       --disable-cxx \
+       --disable-threads \
+       --without-cfitsio \
+       --without-fftw \
+       --without-lcms \
+       --without-magick \
+       --without-matio \
+       --without-OpenEXR \
+       --without-orc \
+       --without-pangoft2 \
+       --without-python \
+       --without-tiff \
+       --without-v4l \
+       --without-x \
+       --without-zip \
+       --with-jpeg \
+       --with-libexif \
+       --with-png \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/vips
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/vips/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,vips))
diff --git a/libs/vips/patches/001-no_cpp.patch b/libs/vips/patches/001-no_cpp.patch
new file mode 100644 (file)
index 0000000..0f60e97
--- /dev/null
@@ -0,0 +1,52 @@
+diff -u --recursive vips-7.34.0-vanilla/libvips/Makefile.in vips-7.34.0/libvips/Makefile.in
+--- vips-7.34.0-vanilla/libvips/Makefile.in    2013-06-18 12:41:41.166821516 -0500
++++ vips-7.34.0/libvips/Makefile.in    2013-06-18 12:45:16.591314640 -0500
+@@ -109,7 +109,7 @@
+       video/libvideo.la $(am__DEPENDENCIES_2)
+ am_libvips_la_OBJECTS =
+ libvips_la_OBJECTS = $(am_libvips_la_OBJECTS)
+-libvips_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
++libvips_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(libvips_la_LDFLAGS) $(LDFLAGS) -o $@
+ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+@@ -118,11 +118,11 @@
+ am__mv = mv -f
+ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
++LTCXXCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+ CXXLD = $(CXX)
+-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
++CXXLINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+ SOURCES = $(libvips_la_SOURCES) $(nodist_EXTRA_libvips_la_SOURCES)
+@@ -583,11 +583,11 @@
+ @am__fastdepCXX_FALSE@        $(LTCXXCOMPILE) -c -o $@ $<
+ dummy2.lo: cimg/dummy2.cc
+-@am__fastdepCXX_TRUE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dummy2.lo -MD -MP -MF $(DEPDIR)/dummy2.Tpo -c -o dummy2.lo `test -f 'cimg/dummy2.cc' || echo '$(srcdir)/'`cimg/dummy2.cc
++@am__fastdepCXX_TRUE@ $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dummy2.lo -MD -MP -MF $(DEPDIR)/dummy2.Tpo -c -o dummy2.lo `test -f 'cimg/dummy2.cc' || echo '$(srcdir)/'`cimg/dummy2.cc
+ @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/dummy2.Tpo $(DEPDIR)/dummy2.Plo
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@    source='cimg/dummy2.cc' object='dummy2.lo' libtool=yes @AMDEPBACKSLASH@
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@    DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+-@am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy2.lo `test -f 'cimg/dummy2.cc' || echo '$(srcdir)/'`cimg/dummy2.cc
++@am__fastdepCXX_FALSE@        $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy2.lo `test -f 'cimg/dummy2.cc' || echo '$(srcdir)/'`cimg/dummy2.cc
+ mostlyclean-libtool:
+       -rm -f *.lo
+diff -u --recursive vips-7.34.0-vanilla/libvips/resample/Makefile.in vips-7.34.0/libvips/resample/Makefile.in
+--- vips-7.34.0-vanilla/libvips/resample/Makefile.in   2013-06-18 12:41:41.170821358 -0500
++++ vips-7.34.0/libvips/resample/Makefile.in   2013-06-18 12:42:06.869807374 -0500
+@@ -415,7 +415,7 @@
+         rm -f "$${dir}/so_locations"; \
+       done
+ libresample.la: $(libresample_la_OBJECTS) $(libresample_la_DEPENDENCIES) $(EXTRA_libresample_la_DEPENDENCIES) 
+-      $(CXXLINK)  $(libresample_la_OBJECTS) $(libresample_la_LIBADD) $(LIBS)
++      $(LINK)  $(libresample_la_OBJECTS) $(libresample_la_LIBADD) $(LIBS)
+ mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
diff --git a/libs/wt/Makefile b/libs/wt/Makefile
new file mode 100644 (file)
index 0000000..7f4cf66
--- /dev/null
@@ -0,0 +1,166 @@
+#
+# Copyright (C) 2007-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:=wt
+PKG_VERSION:=3.1.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/witty/wt/$(PKG_VERSION)
+PKG_MD5SUM:=ee9490d5f24a47766e54f630ba0da2bb
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+PKG_INSTALL:=1
+
+define Package/wt/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  URL:=http://www.webtoolkit.eu/wt
+endef
+
+define Package/wt
+  $(call Package/wt/Default)
+  MENU:=1
+  DEPENDS:= +libstdcpp +boost-date_time +boost-system +boost-filesystem +boost-thread +boost-program_options +boost-signals +boost-regex +libpthread
+  TITLE:=C++ Web Toolkit
+endef
+
+define Package/wt-resources
+  $(call Package/wt/Default)
+  DEPENDS:=wt
+  TITLE:=Optional Resource Files
+endef
+
+define Package/wt-fcgi
+  $(call Package/wt/Default)
+  DEPENDS:=wt +fcgixx
+  TITLE:=FastCGI Connector
+endef
+
+define Package/wt-http
+  $(call Package/wt/Default)
+  DEPENDS:=wt +PACKAGE_wt_http_zlib:zlib +PACKAGE_wt_http_ssl:libopenssl
+  TITLE:=Built in HTTP Server
+endef
+
+define Package/wt-http/config
+config PACKAGE_wt_http_zlib
+    bool "Enable zlib compression option"
+    depends on PACKAGE_wt-http
+    default n
+config PACKAGE_wt_http_ssl
+    bool "Enable ssl option"
+    depends on PACKAGE_wt-http
+    default n
+endef
+
+define Package/wt-dbo
+  $(call Package/wt/Default)
+  DEPENDS:=wt
+  TITLE:=Object Relational Mapping
+endef
+
+define Package/wt-dbosqlite3
+  $(call Package/wt/Default)
+  DEPENDS:=wt +wt-dbo
+  TITLE:=Sqlite3 Dbo Backend
+endef
+
+define Package/wt-resources/conffiles
+/usr/share/Wt
+endef
+
+# TODO: some parts of the code show that -DHAVE_GNU_REGEX can be defined to avoid dependence or boost-regex
+# But that's turning out not to be the case (some portions still depend on boost-regex)
+TARGET_CFLAGS += $(FPIC)
+CMAKE_OPTIONS += \
+       -DCMAKE_BUILD_TYPE=MinSizeRel \
+       -DCMAKE_CXX_FLAGS_MINSIZEREL:STRING="-DNDEBUG -DWT_NO_SPIRIT -DWT_NO_XSS_FILTER" \
+       -DSHARED_LIBS:BOOL=ON \
+       -DBUILD_TESTS=OFF \
+       -DBUILD_EXAMPLES=OFF \
+       -DINSTALL_RESOURCES=ON \
+       -DENABLE_GM=OFF \
+       -DENABLE_HARU=OFF \
+       -DENABLE_PANGO=OFF \
+       -DENABLE_EXT=OFF \
+       -DENABLE_POSTGRES=OFF \
+       -DENABLE_QT4=OFF \
+       -DWT_NO_STD_LOCALE=ON \
+       -DWT_NO_STD_WSTRING=ON
+
+ifndef CONFIG_PACKAGE_wt-http
+CMAKE_OPTIONS += \
+       -DCONNECTOR_HTTP=OFF
+endif
+
+ifndef CONFIG_PACKAGE_wt_http_zlib
+CMAKE_OPTIONS += \
+       -DHTTP_WITH_ZLIB=OFF
+endif
+
+ifndef CONFIG_PACKAGE_wt_http_ssl
+CMAKE_OPTIONS += \
+       -DHTTP_WITH_SSL=OFF
+endif
+
+ifndef CONFIG_PACKAGE_wt-fcgi
+CMAKE_OPTIONS += \
+       -DCONNECTOR_FCGI=OFF
+endif
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) -a $(PKG_INSTALL_DIR)/usr/include/Wt $(1)/usr/include
+
+       $(INSTALL_DIR) $(1)/usr/share/cmake-2.4/Modules
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cmake-2.4/Modules/FindWt.cmake $(1)/usr/share/cmake-2.4/Modules
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwt*.so* $(1)/usr/lib
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib
+       for m in $(2); do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwt$$$$$$$${m}.so* $$(1)/usr/lib/ ; \
+       done
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+define Package/wt/install
+       $(INSTALL_DIR) $(1)/etc/wt
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/wt_config.xml $(1)/etc/wt
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwt.so* $(1)/usr/lib
+endef
+
+define Package/wt/conffiles
+/etc/wt
+endef
+
+define Package/wt-resources/install
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) -a $(PKG_INSTALL_DIR)/usr/share/Wt $(1)/usr/share
+endef
+
+$(eval $(call BuildPackage,wt))
+$(eval $(call BuildPackage,wt-resources))
+$(eval $(call BuildPlugin,wt-http,http))
+$(eval $(call BuildPlugin,wt-fcgi,fcgi))
+$(eval $(call BuildPlugin,wt-dbo,dbo))
+$(eval $(call BuildPlugin,wt-dbosqlite3,dbosqlite3))
diff --git a/libs/wt/patches/100-fix_random_dev.patch b/libs/wt/patches/100-fix_random_dev.patch
new file mode 100644 (file)
index 0000000..977611c
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/src/web/random_device.cpp
++++ b/src/web/random_device.cpp
+@@ -39,16 +39,6 @@
+ #endif
+ #ifdef USE_URANDOM
+-#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
+-//  A definition is required even for integral static constants
+-const bool boost::random_device::has_fixed_range;
+-const boost::random_device::result_type boost::random_device::min_value;
+-const boost::random_device::result_type boost::random_device::max_value;
+-#endif
+-
+-// the default is the unlimited capacity device, using some secure hash
+-// try "/dev/random" for blocking when the entropy pool has drained
+-const char * const boost::random_device::default_token = "/dev/urandom";
+ /*
+  * This uses the POSIX interface for unbuffered reading.
+@@ -119,7 +109,6 @@
+ #include <windows.h>
+ #include <wincrypt.h>
+ #include <stdexcept>
+-const char * const boost::random_device::default_token = "";
+ // Note about thread-safety: according to my reading of the MSDN page 
+ // 'Threading Issues with Cryptographic Service Providers', both the
+@@ -156,6 +145,10 @@
+ };
+ #endif
++BOOST_RANDOM_DECL boost::random::random_device::random_device()
++  : pimpl(new impl("/dev/urandom"))
++{}
++
+ boost::random_device::random_device(const std::string& token)
+   : pimpl(new impl(token))
+ {
diff --git a/libs/wt/patches/200-fix_boost_1_50_build.patch b/libs/wt/patches/200-fix_boost_1_50_build.patch
new file mode 100644 (file)
index 0000000..0ffcabf
--- /dev/null
@@ -0,0 +1,27 @@
+--- a/src/threadpool/threadpool/task_adaptors.hpp
++++ b/src/threadpool/threadpool/task_adaptors.hpp
+@@ -135,7 +135,11 @@
+         if(m_break_s > 0 || m_break_ns > 0)
+         { // Sleep some time before first execution
+           xtime xt;
++#if BOOST_VERSION >= 105000
++          xtime_get(&xt, TIME_UTC_);
++#else
+           xtime_get(&xt, TIME_UTC);
++#endif
+           xt.nsec += m_break_ns;
+           xt.sec += m_break_s;
+           thread::sleep(xt); 
+@@ -146,7 +150,11 @@
+           if(m_break_s > 0 || m_break_ns > 0)
+           {
+             xtime xt;
++#if BOOST_VERSION >= 105000
++            xtime_get(&xt, TIME_UTC_);
++#else
+             xtime_get(&xt, TIME_UTC);
++#endif
+             xt.nsec += m_break_ns;
+             xt.sec += m_break_s;
+             thread::sleep(xt);
+
diff --git a/libs/wxbase/Makefile b/libs/wxbase/Makefile
new file mode 100644 (file)
index 0000000..62db385
--- /dev/null
@@ -0,0 +1,133 @@
+#
+# Copyright (C) 2007-2009 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:=wxbase
+PKG_VERSION:=2.8.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=wxGTK-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/wxwindows
+PKG_MD5SUM:=08f81ab60647308058f6ce99712b14f8
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/wxGTK-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libwxbase
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Cross-platform C++ framework
+  URL:=http://www.wxwidgets.org/
+  DEPENDS:=+libexpat +libstdcpp +zlib +libpthread
+endef
+
+define Package/libwxbase/description
+ wxBase contains most of the non-GUI classes from the wxWindows cross-
+ -platform C++ framework. There are 2 categories: generally useful portable
+ code (date/time handling, command line parsing, regular expression support)
+ and wrappers for the OS objects (files, directories, sockets, threads,
+ etc.) allowing you to write portable programs easily.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+# XXX: aMule *needs* the following configure options to be enabled:
+#      --enable-intl
+#      --enable-largefile
+#      --disable-no_rtti
+#      --with-regex
+#      --enable-unicode
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --disable-rpath \
+       --with-gnu-ld \
+       --disable-gui \
+       --disable-monolithic \
+       --enable-plugins \
+       --disable-universal \
+       --disable-nanox \
+       --disable-gtk2 \
+       --disable-gpe \
+       --disable-optimise \
+       --disable-debug \
+       --disable-stl \
+       --disable-omf \
+       --disable-debug_flag \
+       --disable-debug_info \
+       --disable-debug_gdb \
+       --disable-debug_cntxt \
+       --disable-mem_tracing \
+       --disable-profile \
+       --disable-no_rtti \
+       --disable-no_exceptions \
+       --disable-compat22 \
+       --disable-compat24 \
+       --enable-intl \
+       --disable-backtrace \
+       --enable-exceptions \
+       --disable-sound \
+       --enable-largefile \
+       \
+       --without-gtk \
+       --without-motif \
+       --without-mac \
+       --without-cocoa \
+       --without-wine \
+       --without-msw \
+       --without-pm \
+       --without-mgl \
+       --without-microwin \
+       --without-x11 \
+       --without-libpng \
+       --without-libjpeg \
+       --without-libtiff \
+       --without-libxpm \
+       --without-libmspack \
+       --without-sdl \
+       --without-gnomeprint \
+       --without-opengl \
+       --without-dmalloc \
+       --with-regex="sys" \
+       --with-zlib="sys" \
+       --without-odbc \
+       --with-expat="sys" \
+       --without-gtk-prefix \
+       --without-x \
+       --without-libiconv-prefix \
+       --without-sdl-prefix \
+       --without-cppunit-prefix \
+
+UNICODE=yes
+
+ifeq ($(UNICODE),yes)
+  CONFIGURE_ARGS+= --enable-unicode
+  LIB_PFX:=u
+else
+  CONFIGURE_ARGS+= --disable-unicode
+  LIB_PFX:=
+endif
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
+       $(CP) -L $(PKG_BUILD_DIR)/wx-config $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wx-2.8 $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwx_base$(LIB_PFX){,_net,_xml}-*.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/wx $(1)/usr/lib/
+       $(SED) 's,-I$$$${includedir}/wx-2.8,-I$(STAGING_DIR)/usr/include/wx-2.8,g' $(1)/usr/bin/wx-config
+       $(SED) 's,-I$$$${libdir}/wx/include,-I$(STAGING_DIR)/usr/lib/wx/include,g' $(1)/usr/bin/wx-config
+endef
+
+define Package/libwxbase/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwx_base$(LIB_PFX){,_net,_xml}-*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libwxbase))
diff --git a/libs/xmlrpc-c/Makefile b/libs/xmlrpc-c/Makefile
new file mode 100644 (file)
index 0000000..08e4a1b
--- /dev/null
@@ -0,0 +1,218 @@
+#
+# Copyright (C) 2007-2012 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:=xmlrpc-c
+PKG_REV:=2233
+PKG_VERSION:=advanced_r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://svn.code.sf.net/p/xmlrpc-c/code/advanced
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=svn
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xmlrpc-c/Default
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=XML-RPC library
+  URL:=http://xmlrpc-c.sourceforge.net/
+endef
+
+define Package/xmlrpc-c-common
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - common
+endef
+
+define Package/xmlrpc-c-internal
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - (uses internal expat variant)
+  DEPENDS:=+xmlrpc-c-common
+#  PROVIDES:=xmlrpc-c
+  VARIANT:=internal
+endef
+
+define Package/xmlrpc-c
+  $(call Package/xmlrpc-c/Default)
+  DEPENDS:=+xmlrpc-c-internal
+endef
+
+define Package/xmlrpc-c-libxml2
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - (uses libxml2)
+  DEPENDS:=+xmlrpc-c-common +libxml2 @BROKEN
+#  PROVIDES:=xmlrpc-c
+  VARIANT:=libxml2
+endef
+
+define Package/xmlrpc-c-client
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - client
+  DEPENDS:=+xmlrpc-c +libcurl
+endef
+
+define Package/xmlrpc-c-server
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - server
+  DEPENDS:=+xmlrpc-c
+endef
+
+define Package/xmlrpc-c-abyss
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - abyss
+  DEPENDS:=+xmlrpc-c-common
+endef
+
+define Package/xmlrpc-c-server-abyss
+  $(call Package/xmlrpc-c/Default)
+  TITLE+= - abyss server
+  DEPENDS:=+xmlrpc-c-server +xmlrpc-c-abyss
+endef
+
+define Package/xmlrpc-c/description/Default
+    Programming library for writing an XML-RPC server or client in C or C++.
+    XML-RPC is a standard network protocol to allow a client program to make
+    a simple remote procedure call (RPC) type request of a server.
+endef
+
+Package/xmlrpc-c-common/description = $(Package/xmlrpc-c/description/Default)
+Package/xmlrpc-c-libxml2/description = $(Package/xmlrpc-c/description/Default)
+Package/xmlrpc-c-internal/description = $(Package/xmlrpc-c/description/Default)
+
+Package/xmlrpc-c-libxml2/description += Uses external libxml2 library (quite big)
+Package/xmlrpc-c-internal/description += Uses internal expat variant (stripped down)
+
+CONFIGURE_ARGS+= \
+       --disable-wininet-client \
+       --disable-libwww-client \
+       --enable-abyss-server \
+       --disable-cplusplus \
+       --disable-abyss-threads \
+       --disable-cgi-server
+
+ifeq ($(BUILD_VARIANT),libxml2)
+       CONFIGURE_ARGS += \
+               --enable-libxml2-backend
+endif
+
+ifeq ($(BUILD_VARIANT),internal)
+       CONFIGURE_ARGS += \
+               --disable-libxml2-backend
+endif
+
+define Build/Compile
+       ( cd $(PKG_BUILD_DIR)/lib/expat/gennmtab && cc -I$(PKG_BUILD_DIR) -c gennmtab.c -o gennmtab.o && cc -o gennmtab  gennmtab.o )
+       $(call Build/Compile/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) \
+               $(1)/usr/include \
+               $(1)/usr/lib \
+               $(1)/usr/bin \
+               $(2)/bin
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc*.{a,so*} \
+               $(1)/usr/lib/
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/xmlrpc-c-config \
+               $(2)/bin/
+       $(SED) \
+               's,HEADERINST_DIR="/usr/include",HEADERINST_DIR="$(STAGING_DIR)/usr/include",g' \
+               $(2)/bin/xmlrpc-c-config
+       $(SED) \
+               's,LIBINST_DIR="/usr/lib",LIBINST_DIR="$(STAGING_DIR)/usr/lib",g' \
+               $(2)/bin/xmlrpc-c-config
+endef
+
+define Package/xmlrpc-c-libxml2/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c-internal/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc.so* \
+               $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_xmltok.so* \
+               $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_xmlparse.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c-server/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_server.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c-abyss/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_abyss.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c-server-abyss/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_server_abyss.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c-client/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_client* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c-common/install
+       $(INSTALL_DIR) \
+               $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libxmlrpc_util.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/xmlrpc-c/install
+       true
+endef
+
+$(eval $(call BuildPackage,xmlrpc-c))
+$(eval $(call BuildPackage,xmlrpc-c-common))
+$(eval $(call BuildPackage,xmlrpc-c-libxml2))
+$(eval $(call BuildPackage,xmlrpc-c-internal))
+$(eval $(call BuildPackage,xmlrpc-c-server))
+$(eval $(call BuildPackage,xmlrpc-c-abyss))
+$(eval $(call BuildPackage,xmlrpc-c-server-abyss))
+$(eval $(call BuildPackage,xmlrpc-c-client))
diff --git a/libs/xmlrpc-c/patches/001-config.mk.in.patch b/libs/xmlrpc-c/patches/001-config.mk.in.patch
new file mode 100644 (file)
index 0000000..e190ebb
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/config.mk.in
++++ b/config.mk.in
+@@ -175,7 +175,7 @@ ifeq ($(patsubst linux-gnu%,linux-gnu,$(
+   shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+   shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+ #  SHLIB_CLIB = -lc
+-  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
++  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB) $(LDFLAGS)
+   CFLAGS_SHLIB=-fPIC
+ endif
diff --git a/libs/xmlrpc-c/patches/002-automake-compat.patch b/libs/xmlrpc-c/patches/002-automake-compat.patch
new file mode 100644 (file)
index 0000000..7503b7c
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/configure.in
++++ b/configure.in
+@@ -230,9 +230,7 @@ dnl Checks for programs.
+ dnl =======================================================================
+ AC_PROG_CC
+-if test x"$enable_cplusplus" != xno; then
+-    AC_PROG_CXX
+-fi
++AC_PROG_CXX
+ dnl =======================================================================
diff --git a/libs/xmpp4r/Makefile b/libs/xmpp4r/Makefile
new file mode 100644 (file)
index 0000000..b545963
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=xmpp4r
+PKG_VERSION:=0.5
+PKG_RELEASE:=0
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
+PKG_SOURCE_URL:=http://download.gna.org/xmpp4r
+PKG_MD5SUM:=70eafe960727d750a43ec77ffc1856e9
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xmpp4r
+       TITLE:=XMPP/Jabber library for Ruby
+       SECTION:=libs
+       CATEGORY:=Libraries
+       DEPENDS:=+ruby
+       MAINTAINER:=Giovanni Di Stasi <giovanni.distasi@unina.it>
+       URL:=http://home.gna.org/xmpp4r/
+endef
+
+define Package/xmpp4r/description
+       This package contains xmpp4r, an XMPP/Jabber library for Ruby.
+endef
+
+define Build/Compile
+       (cd $(PKG_BUILD_DIR); \
+               ruby $(PKG_BUILD_DIR)/setup.rb config \
+                       --rbconfig=$(wildcard $(STAGING_DIR)/usr/lib/ruby/*.*/*-linux/rbconfig.rb); \
+               ruby $(PKG_BUILD_DIR)/setup.rb install --prefix="$(PKG_INSTALL_DIR)"; \
+       )
+endef
+
+define Package/xmpp4r/install
+       $(INSTALL_DIR) $(1)/usr/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib $(1)/usr
+endef
+
+$(eval $(call BuildPackage,xmpp4r))
diff --git a/mail/alpine/Makefile b/mail/alpine/Makefile
new file mode 100644 (file)
index 0000000..acfc74b
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2013 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:=alpine
+PKG_VERSION:=2.11
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://patches.freeiz.com/alpine/release/src/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_MD5SUM:=a3bba218787691080d706b36215eec06
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/alpine
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libopenssl +libncurses +libpthread +libpam
+  TITLE:=Alternatively Licensed Program for Internet News and Email
+  URL:=http://www.washington.edu/alpine
+endef
+
+define Package/alpine/description
+ Alpine (Alternatively Licenced Program for Internet News and Email) is a
+ free software email client developed at the University of Washington.
+ It is suitable for both the inexperienced email user as well as for
+ the most demanding power user.
+endef
+
+CONFIGURE_ARGS += \
+       --with-ssl-include-dir=$(STAGING_DIR)/usr/include/openssl/. \
+       --with-ssl-lib-dir=$(STAGING_DIR)/usr/lib \
+       --without-tcl \
+       --without-ldap \
+       --without-krb5 \
+       --with-system-pinerc=/etc/pine.conf \
+       --with-system-fixed-pinerc=/etc/pine.conf.fixed \
+       --disable-debug \
+       --disable-mouse \
+       --with-c-client-target=slx \
+
+ifeq ($(CONFIG_IPV6),y)
+  DISABLE_IPV6:=
+else
+  DISABLE_IPV6:=--without-ipv6
+endif
+
+define Build/Compile
+       ( cd $(PKG_BUILD_DIR)/pith ; \
+               $(HOSTCC) help_h_gen.c -c -o help_h_gen.o ; \
+               $(HOSTCC) help_h_gen.o -o help_h_gen ; \
+               $(HOSTCC) help_c_gen.c -c -o help_c_gen.o ; \
+               $(HOSTCC) help_c_gen.o -o help_c_gen ; \
+       )
+       $(call Build/Compile/Default)
+endef
+
+define Package/alpine/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/alpine $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,alpine))
diff --git a/mail/fetchmail/Makefile b/mail/fetchmail/Makefile
new file mode 100644 (file)
index 0000000..97a3d49
--- /dev/null
@@ -0,0 +1,84 @@
+#
+# 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:=fetchmail
+PKG_VERSION:=6.3.26
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://download.berlios.de/fetchmail
+PKG_MD5SUM:=61b66faad044afa26e142bb1791aa2b3
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fetchmail/Default
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=Remote mail retriever
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+  URL:=http://fetchmail.berlios.de/
+endef
+
+define Package/fetchmail/Default/description
+ Retrieves remote mail via POP/IMAP.
+ Very useful in conjunction with mutt.
+endef
+
+define Package/fetchmail
+  $(call Package/fetchmail/Default)
+  DEPENDS+= +libopenssl
+  TITLE+= (with SSL support)
+  VARIANT:=ssl
+endef
+
+define Package/fetchmail/description
+ $(call Package/fetchmail/Default/description)
+ This package is built with SSL support.
+endef
+
+define Package/fetchmail-nossl
+  $(call Package/fetchmail/Default)
+  TITLE+= (without SSL support)
+  VARIANT:=nossl
+endef
+
+define Package/fetchmail-nossl/description
+ $(call Package/fetchmail/Default/description)
+ This package is built without SSL support.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-fallback=procmail \
+       --without-hesiod
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-ssl="$(STAGING_DIR)/usr"
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --without-ssl
+endif
+
+CONFIGURE_VARS += \
+       ac_cv_path_procmail=/usr/sbin/procmail
+
+define Package/fetchmail/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/fetchmail $(1)/usr/bin/
+endef
+
+Package/fetchmail-nossl/install = $(Package/fetchmail/install)
+
+$(eval $(call BuildPackage,fetchmail))
+$(eval $(call BuildPackage,fetchmail-nossl))
diff --git a/mail/imapfilter/Makefile b/mail/imapfilter/Makefile
new file mode 100644 (file)
index 0000000..19ee723
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2006-2010 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:=imapfilter
+PKG_VERSION:=2.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://imapfilter.hellug.gr/source/
+PKG_MD5SUM:=09c6ffb085a5a244dc9f3e798259f341
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/imapfilter
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+liblua +libopenssl +libpcre
+  TITLE:=IMAP server based email filtering
+  URL:=http://imapfilter.hellug.gr/
+endef
+
+define Package/imapfilter/description
+       IMAPFilter is a mail filtering utility. It connects to remote mail
+       servers using the Internet Message Access Protocol (IMAP), sends
+       searching queries to the server and processes mailboxes based on the
+       results. It can be used to delete, copy, move, flag, etc. messages
+       residing in mailboxes at the same or different mail servers. The 4rev1
+       and 4 versions of the IMAP protocol are supported.
+
+       IMAPFilter uses the Lua programming language as a configuration and
+       extension language.
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               ./configure \
+                       -d /usr \
+       );
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               INCDIRS="$(TARGET_CPPFLAGS)" \
+               LIBDIRS="$(TARGET_LDFLAGS)" \
+               MYCFLAGS="$(TARGET_CFLAGS) -std=gnu99" \
+               MYLDFLAGS="-lcrypt"
+endef
+
+define Package/imapfilter/conffiles
+/etc/imapfilter/config.lua
+endef
+
+define Package/imapfilter/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/imapfilter $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/imapfilter
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/sample.config.lua $(1)/etc/imapfilter/config.lua
+       $(INSTALL_DIR) $(1)/usr/share/imapfilter
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/{account,auxiliary,common,mailbox,message,options,regex,set,deprecated}.lua $(1)/usr/share/imapfilter/
+endef
+
+$(eval $(call BuildPackage,imapfilter))
diff --git a/mail/imapfilter/patches/010-pathnames.patch b/mail/imapfilter/patches/010-pathnames.patch
new file mode 100644 (file)
index 0000000..6e9a43f
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/pathnames.h
++++ b/pathnames.h
+@@ -3,7 +3,7 @@
+ /* Program's home directory. */
+-#define PATHNAME_HOME                 ".imapfilter"
++#define PATHNAME_HOME                 "/etc/imapfilter"
+ /* Program's configuration file. */
+ #define PATHNAME_CONFIG                       PATHNAME_HOME "/config.lua"
+@@ -39,7 +39,7 @@
+ #define PATHNAME_CERTS                        PATHNAME_HOME "/certificates"
+ /* Debug temporary file template. */
+-#define PATHNAME_DEBUG                        PATHNAME_HOME "/debug.XXXXXX"
++#define PATHNAME_DEBUG                        "/tmp/imapfilterdebug.XXXXXX"
+ #endif                                /* PATHNAMES_H */
+--- a/imapfilter.c
++++ b/imapfilter.c
+@@ -50,7 +50,7 @@
+       opts.config = NULL;
+       opts.oneline = NULL;
+-      env.home = getenv("HOME");
++      env.home = "";
+       env.pathmax = -1;
+       while ((c = getopt(argc, argv, "Vc:de:il:v?")) != -1) {
diff --git a/mail/mini_sendmail/Makefile b/mail/mini_sendmail/Makefile
new file mode 100644 (file)
index 0000000..8024f88
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2007-2010 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:=mini-sendmail
+PKG_VERSION:=1.3.6
+PKG_RELEASE:=4
+
+PKG_SOURCE:=mini_sendmail-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.acme.com/software/mini_sendmail/
+PKG_MD5SUM:=fb1585d2ad81c519a26d83bfd783dee8
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/mini_sendmail-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mini-sendmail
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=A small sendmail-compatible mail forwarder
+  URL:=http://www.acme.com/software/mini_sendmail/
+endef
+
+define Package/mini-sendmail/description
+ mini_sendmail reads its standard input up to an end-of-file and sends a
+ copy of the message found there to all of the addresses listed.
+ The message is sent by connecting to a local SMTP server. This means
+ mini_sendmail can be used to send email from inside a chroot(2) area.
+endef
+
+MAKE_FLAGS += \
+       OFLAGS="$(TARGET_CFLAGS)"
+
+define Package/mini-sendmail/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mini_sendmail $(1)/usr/sbin/
+endef
+
+define Package/mini-sendmail/postinst
+       ln -sf mini_sendmail $${IPKG_INSTROOT}/usr/sbin/sendmail
+endef
+
+$(eval $(call BuildPackage,mini-sendmail))
diff --git a/mail/mini_sendmail/patches/200-fullname.patch b/mail/mini_sendmail/patches/200-fullname.patch
new file mode 100644 (file)
index 0000000..95e19a7
--- /dev/null
@@ -0,0 +1,36 @@
+Index: mini_sendmail-1.3.6/mini_sendmail.c
+===================================================================
+--- mini_sendmail-1.3.6.orig/mini_sendmail.c   2007-08-28 17:58:37.000000000 +0200
++++ mini_sendmail-1.3.6/mini_sendmail.c        2007-08-28 17:58:37.000000000 +0200
+@@ -542,6 +542,7 @@
+       }
+     /* Strip off any angle brackets. */
++/*
+     while ( len > 0 && *recipient == '<' )
+       {
+       ++recipient;
+@@ -551,6 +552,23 @@
+       --len;
+     (void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
++*/
++    if (len > 0 && recipient[len-1] == '>' )
++    {
++        /* "<name@domain>" or: "Full Name <name@domain>" */
++        while (len > 0 && *recipient != '<' )
++          {
++          ++recipient;
++          --len;
++          }
++        (void) snprintf( buf, sizeof(buf), "RCPT TO:%.*s", len, recipient );
++    }
++    else
++    {
++        /* name@domain */
++        (void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
++    }
++             
+     send_command( buf );
+     status = read_response();
+     if ( status != 250  && status != 251 )
diff --git a/mail/mini_sendmail/patches/500-flags.patch b/mail/mini_sendmail/patches/500-flags.patch
new file mode 100644 (file)
index 0000000..39b42b4
--- /dev/null
@@ -0,0 +1,17 @@
+Index: mini_sendmail-1.3.6/Makefile
+===================================================================
+--- mini_sendmail-1.3.6.orig/Makefile  2007-08-28 17:58:37.000000000 +0200
++++ mini_sendmail-1.3.6/Makefile       2007-08-28 17:58:37.000000000 +0200
+@@ -7,9 +7,10 @@
+ BINDIR =      /usr/local/sbin
+ MANDIR =      /usr/local/man
+ CC =          gcc
+-CFLAGS =      -O
++OFLAGS =      -O
++CFLAGS =      $(OFLAGS)
+ #CFLAGS =     -g
+-LDFLAGS =     -s -static
++LDFLAGS =
+ #LDFLAGS =    -g -static
+ LDLIBS =      $(SYSV_LIBS)
diff --git a/mail/msmtp/Makefile b/mail/msmtp/Makefile
new file mode 100644 (file)
index 0000000..8392a3c
--- /dev/null
@@ -0,0 +1,122 @@
+#
+# Copyright (C) 2009 David Cooper <dave@kupesoft.com>
+# Copyright (C) 2009-2012 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:=msmtp
+PKG_VERSION:=1.4.27
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/msmtp
+PKG_MD5SUM:=2d6d10d9c59ed2b2635554ed35fb9226
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/msmtp/Default
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=Simple sendmail SMTP forwarding
+  URL:=http://msmtp.sourceforge.net/
+endef
+
+define Package/msmtp/Default/description
+ msmtp is an SMTP client. In the default mode, it transmits a mail to
+ an SMTP server (for example at a free mail provider) which does the
+ delivery. To use this program with your mail user agent (MUA), create
+ a configuration file with your mail account(s) and tell your MUA to
+ call msmtp instead of /usr/sbin/sendmail.
+endef
+
+define Package/msmtp
+$(call Package/msmtp/Default)
+  DEPENDS+= +libopenssl
+  TITLE+= (with SSL support)
+  VARIANT:=ssl
+endef
+
+define Package/msmtp/conffiles
+/etc/msmtprc
+endef
+
+define Package/msmtp/description
+$(call Package/msmtp/Default/description)
+ This package is built with SSL support.
+endef
+
+define Package/msmtp-nossl
+$(call Package/msmtp/Default)
+  TITLE+= (without SSL support)
+  VARIANT:=nossl
+endef
+
+define Package/msmtp-nossl/description
+$(call Package/msmtp/Default/description)
+ This package is built without SSL support.
+endef
+
+define Package/msmtp-queue
+$(call Package/msmtp/Default)
+  DEPENDS+= +bash
+  TITLE+= (queue scripts)
+endef
+
+define Package/msmtp-queue/description
+$(call Package/msmtp/Default/description)
+ This package contains the msmtp queue scripts.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-rpath \
+       --without-libintl-prefix \
+       --without-libgsasl \
+       --without-libidn
+
+MAKE_FLAGS :=
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-ssl=openssl
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --with-ssl=no
+endif
+
+define Package/msmtp/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/msmtprc-system.example \
+               $(1)/etc/msmtprc
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/msmtp $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+endef
+
+define Package/msmtp/postinst
+       ln -sf ../bin/msmtp $${IPKG_INSTROOT}/usr/sbin/sendmail
+endef
+
+Package/msmtp-nossl/conffiles = $(Package/msmtp/conffiles)
+Package/msmtp-nossl/install = $(Package/msmtp/install)
+Package/msmtp-nossl/postinst = $(Package/msmtp/postinst)
+
+define Package/msmtp-queue/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/msmtpq/msmtp{q,-queue} $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/msmtpqueue/msmtp-{en,list,run}queue.sh $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,msmtp))
+$(eval $(call BuildPackage,msmtp-nossl))
+$(eval $(call BuildPackage,msmtp-queue))
diff --git a/mail/mutt/Makefile b/mail/mutt/Makefile
new file mode 100644 (file)
index 0000000..eb7381d
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006-2010 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:=mutt
+PKG_VERSION:=1.5.21
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=@SF/mutt
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=a29db8f1d51e2f10c070bf88e8a553fd
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mutt
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libopenssl +libncursesw
+  TITLE:=Console mail client
+  URL:=http://www.mutt.org/
+endef
+
+define Package/mutt/description
+       Mutt is a small but very powerful text-based mail client for Unix
+       operating systems.
+endef
+
+CONFIGURE_ARGS += \
+       --includedir=$(PKG_BUILD_DIR)/. \
+       --oldincludedir=$(PKG_BUILD_DIR)/. \
+       --enable-pop \
+       --enable-imap \
+       --with-ssl \
+       --without-idn
+
+define Package/mutt/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mutt $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,mutt))
diff --git a/mail/mutt/patches/001-no_po_and_docs.patch b/mail/mutt/patches/001-no_po_and_docs.patch
new file mode 100644 (file)
index 0000000..a645993
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -342,7 +342,7 @@ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = 1.6 foreign
+ @BUILD_IMAP_TRUE@IMAP_SUBDIR = imap
+ @BUILD_IMAP_TRUE@IMAP_INCLUDES = -I$(top_srcdir)/imap
+-SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)
++SUBDIRS = m4 intl contrib $(IMAP_SUBDIR)
+ bin_SCRIPTS = muttbug flea @SMIMEAUX_TARGET@
+ @BUILD_HCACHE_TRUE@HCVERSION = hcversion.h
+ BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h $(HCVERSION)
diff --git a/mail/nullmailer/Makefile b/mail/nullmailer/Makefile
new file mode 100644 (file)
index 0000000..7416064
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2007-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:=nullmailer
+PKG_VERSION:=1.05
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://untroubled.org/nullmailer/
+PKG_MD5SUM:=35124cc05f893efba1310e2ec7c876ff
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nullmailer
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libstdcpp
+  TITLE:=A minimal MTA for hosts which relay to a fixed set of smart relays
+  URL:=http://untroubled.org/nullmailer/
+endef
+
+define Package/nullmailer/description
+ This is nullmailer, a sendmail/qmail/etc replacement MTA for hosts
+ which relay to a fixed set of smart relays.  It is designed to be
+ simple to configure, secure, and easily extendable.
+endef
+
+TARGET_CFLAGS += $(TARGET_CPPFLAGS)
+
+define Package/nullmailer/install
+       $(INSTALL_DIR) $(1)/etc/nullmailer
+       echo "# List of smart relays" > $(1)/etc/nullmailer/remotes
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mailq $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nullmailer-inject $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nullmailer-queue $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nullmailer-send $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sendmail $(1)/usr/sbin/nullmailer-sendmail
+       $(INSTALL_DIR) $(1)/usr/lib/nullmailer
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/protocols/qmqp $(1)/usr/lib/nullmailer/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/protocols/smtp $(1)/usr/lib/nullmailer/
+endef
+
+define Package/nullmailer/conffiles
+/etc/nullmailer/remotes
+endef
+
+define Package/nullmailer/postinst
+       ln -sf ../sbin/sendmail $${IPKG_INSTROOT}/usr/lib/sendmail
+       ln -sf nullmailer-sendmail $${IPKG_INSTROOT}/usr/sbin/sendmail
+endef
+
+$(eval $(call BuildPackage,nullmailer))
diff --git a/mail/procmail/Makefile b/mail/procmail/Makefile
new file mode 100644 (file)
index 0000000..c8beb4e
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2006-2008 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:=procmail
+PKG_VERSION:=3.22
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.procmail.org/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=1678ea99b973eb77eda4ecf6acae53f1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/procmail
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=Mail processing tool
+  URL:=http://www.procmail.org
+endef
+
+define Package/procmail/description
+ Procmail is able to process and classify incoming mail into
+ different mail boxes.
+ Very useful in conjunction with mutt.
+endef
+
+TARGET_CFLAGS += -DPROCMAIL
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src -f ../Makefile.openwrt  \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/procmail/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/src/procmail $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/src/formail $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,procmail))
diff --git a/mail/procmail/patches/001-procmail_openwrt.patch b/mail/procmail/patches/001-procmail_openwrt.patch
new file mode 100644 (file)
index 0000000..c33d826
--- /dev/null
@@ -0,0 +1,51 @@
+This patch is required to make procmail cross compile - it tries to run some automatic tests which
+obviously do not work in a cross compiled environment.
+
+
+diff -Naur procmail-3.22_orig/autoconf.h procmail-3.22/autoconf.h
+--- procmail-3.22_orig/autoconf.h      1970-01-01 10:00:00.000000000 +1000
++++ procmail-3.22/autoconf.h   2006-03-23 12:15:36.000000000 +1100
+@@ -0,0 +1,21 @@
++/* This file was automagically generated by autoconf */
++
++/* 5 moves in 64 steps of size 16384 when reallocing */
++#define NOpw_class
++#define NOstrlcat
++#define NOsetrgid
++#define MAX_argc 7588
++/* Your system's strstr() is 1.12 times FASTER than my C-routine */
++#define UDP_protocolno 17
++#define BIFF_serviceport "512"
++#define IP_localhost {127,0,0,1}
++#define MAILSPOOLDIR "/var/spool/mail/"
++#define SENDMAIL "/usr/sbin/sendmail"
++#define CF_no_procmail_yet
++#define buggy_SENDMAIL
++#define defPATH "PATH=$HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/bin/X11"
++#define defSPATH "PATH=/bin:/usr/bin:/usr/local/bin:/usr/bin/X11"
++#define PM_VERSION "3.22"
++/* Hotwire LOCKINGTEST=100 */
++/* Procmail will lock via: dotlocking, fcntl() */
++/* autoconf completed */
+diff -Naur procmail-3.22_orig/Makefile.openwrt procmail-3.22/Makefile.openwrt
+--- procmail-3.22_orig/Makefile.openwrt        1970-01-01 10:00:00.000000000 +1000
++++ procmail-3.22/Makefile.openwrt     2006-03-23 12:15:36.000000000 +1100
+@@ -0,0 +1,18 @@
++PM_OBJ=cstdio.o common.o exopen.o goodies.o locking.o \
++ mailfold.o foldinfo.o misc.o pipes.o regexp.o robust.o \
++ sublib.o acommon.o mcommon.o lastdirsep.o authenticate.o \
++ lmtp.o memblk.o variables.o from.o comsat.o
++
++FM_OBJ=common.o fields.o formisc.o sublib.o ecommon.o \
++ acommon.o
++
++LDFLAGS = -lm -lnsl -ldl -lc
++CFLAGS = -Os -DPROCMAIL
++
++all: procmail formail
++
++procmail: procmail.o $(PM_OBJ)
++      $(CC) $(CFLAGS) $@.o $(PM_OBJ) -o $@ $(LDFLAGS)
++
++formail: formail.o $(FM_OBJ)
++      $(CC) $(CFLAGS) $@.o $(FM_OBJ) -o $@ $(LDFLAGS)
diff --git a/mail/procmail/patches/100-rename_getline.patch b/mail/procmail/patches/100-rename_getline.patch
new file mode 100644 (file)
index 0000000..6cd359d
--- /dev/null
@@ -0,0 +1,52 @@
+--- a/src/fields.c
++++ b/src/fields.c
+@@ -110,16 +110,16 @@
+                   /* try and append one valid field to rdheader from stdin */
+ int readhead P((void))
+ { int idlen;
+-  getline();
++  __getline();
+   if((idlen=breakfield(buf,buffilled))<=0) /* not the start of a valid field */
+      return 0;
+   if(idlen==STRLEN(FROM)&&eqFrom_(buf))                       /* it's a From_ line */
+    { if(rdheader)
+       return 0;                              /* the From_ line was a fake! */
+-     for(;buflast=='>';getline());        /* gather continued >From_ lines */
++     for(;buflast=='>';__getline());      /* gather continued >From_ lines */
+    }
+   else
+-     for(;;getline())               /* get the rest of the continued field */
++     for(;;__getline())                     /* get the rest of the continued field */
+       { switch(buflast)                            /* will this line be continued? */
+        { case ' ':case '\t':                            /* yep, it sure is */
+             continue;
+--- a/src/formail.c
++++ b/src/formail.c
+@@ -819,7 +819,7 @@
+       { if(split)                    /* gobble up the next start separator */
+        { buffilled=0;
+ #ifdef sMAILBOX_SEPARATOR
+-         getline();buffilled=0;                /* but only if it's defined */
++         __getline();buffilled=0;              /* but only if it's defined */
+ #endif
+          if(buflast!=EOF)                                        /* if any */
+             goto splitit;
+--- a/src/formisc.c
++++ b/src/formisc.c
+@@ -115,7 +115,7 @@
+   buf[buffilled++]=c;
+ }
+-int getline P((void))                    /* read a newline-terminated line */
++int __getline P((void))                          /* read a newline-terminated line */
+ { if(buflast==EOF)                     /* at the end of our Latin already? */
+    { loadchar('\n');                                    /* fake empty line */
+      return EOF;                                        /* spread the word */
+--- a/src/formisc.h
++++ b/src/formisc.h
+@@ -17,4 +17,4 @@
+ char*
+  skipwords P((char*start));
+ int
+- getline P((void));
++ __getline P((void));
diff --git a/mail/ssmtp/Makefile b/mail/ssmtp/Makefile
new file mode 100644 (file)
index 0000000..0240ae0
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2007-2012 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:=ssmtp
+PKG_VERSION:=2.64
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.bz2
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/s/ssmtp
+PKG_MD5SUM:=65b4e0df4934a6cd08c506cabcbe584f
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(TARGET_CPPFLAGS)
+
+define Package/ssmtp
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libopenssl
+  TITLE:=A minimal and secure mail sender
+  URL:=http://packages.debian.org/ssmtp
+endef
+
+define Package/ssmtp/description
+ A secure, effective and simple way of getting mail off a system to your
+ mail hub. It contains no suid-binaries or other dangerous things - no
+ mail spool to poke around in, and no daemons running in the background.
+ mail is simply forwarded to the configured mailhost. Extremely easy
+ configuration.
+endef
+
+define Package/ssmtp/conffiles
+/etc/ssmtp/ssmtp.conf
+/etc/ssmtp/revaliases
+endef
+
+CONFIGURE_VARS += \
+       LIBS="$(TARGET_LDFLAGS) -lcrypto -lssl"
+
+CONFIGURE_ARGS += \
+       --enable-ssl
+
+define Package/ssmtp/install
+       $(INSTALL_DIR) $(1)/etc/ssmtp
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/ssmtp.conf $(1)/etc/ssmtp/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/revaliases $(1)/etc/ssmtp/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssmtp $(1)/usr/sbin/
+endef
+
+define Package/ssmtp/postinst
+#!/bin/sh
+ln -sf ssmtp $${IPKG_INSTROOT}/usr/sbin/sendmail
+endef
+
+$(eval $(call BuildPackage,ssmtp))
diff --git a/mail/xmail/Makefile b/mail/xmail/Makefile
new file mode 100644 (file)
index 0000000..7be560e
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007-2013 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:=xmail
+PKG_VERSION:=1.27
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.xmailserver.org/
+PKG_MD5SUM:=73c9d95012709d7b11511dfb6dd6ab3d
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xmail
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libopenssl +libpthread $(CXX_DEPENDS)
+  TITLE:=advanced, fast and reliable ESMTP/POP3 mail server
+  URL:=http://www.xmailserver.org/
+endef
+
+define Package/xmail/description
+ XMail is an Internet mail server featuring an SMTP, POP3 and finger server.
+ It's incredibly easy to set up and has lots of features including :
+ multiple domains, virtual users and spam protection.
+endef
+
+define Build/Compile
+       CFLAGS="$(TARGET_CFLAGS)" \
+       $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.lnx \
+               $(TARGET_CONFIGURE_OPTS) \
+               LD="$(TARGET_CXX)" \
+               all
+       tar -cjf $(PKG_BUILD_DIR)/MailRoot.tar.bz2 -C $(PKG_BUILD_DIR)/MailRoot --exclude bin .
+endef
+
+define Package/xmail/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/{CtrlClnt,MkUsers,XMCrypt,XMail,sendmail} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/MailRoot.tar.bz2 $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/xmail.config $(1)/etc/config/xmail
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/xmail.init $(1)/etc/init.d/xmail
+endef
+
+define Package/xmail/conffiles
+/etc/config/xmail
+endef
+
+$(eval $(call BuildPackage,xmail))
diff --git a/mail/xmail/files/xmail.config b/mail/xmail/files/xmail.config
new file mode 100644 (file)
index 0000000..b4d49a0
--- /dev/null
@@ -0,0 +1,111 @@
+# Configuration parameters for xmail
+#
+# To see what xmail command line parameters each parameter corresponds to,
+#      please see /etc/init.d/xmail
+#
+# The xmail configuration files are contained in /etc/MailRoot.tar.gz, and need
+#      to be installed in the MAIL_ROOT directory, set by default to
+#      /var/MailRoot below by:
+#      MAIL_ROOT=`grep "option.*mail_root.*'$" /etc/config/xmail | sed -e "s/'$//" -e "s/.*'//"`
+#      mkdir -p $MAIL_ROOT; cd $MAIL_ROOT; tar -xjf /etc/MailRoot.tar.bz2
+# NOTE: On OpenWRT /var is a temporary filesystem, so change mail_root below,
+#      but it is probably not a good idea to install on a device's internal
+#      flash due to the amount of writing of the flash that will ensue.
+#
+# To see what settings are appropriate, please refer to:
+#      http://www.xmailserver.org/Readme.html
+# which also documents the configuration files in mail_root
+# ( please note that the values commented out are not real values )
+# 
+
+config xmail
+       option  mail_root       '/var/MailRoot'
+#      option  debug           1
+#      option  log_rotate      '3600'
+#      option  split_level     'param-split_level'
+#      option  rx_buffer       'param-rx_buffer'
+#      option  tx_buffer       'param-tx_buffer'
+#      option  maildir_delivery        1
+#      option  mailbox_delivery        1
+#      option  dns_cache_dirs  'param-dns_cache_dirs'
+#      option  ipv4_only       1
+#      option  ipv6_only       1
+#      option  ipv4_then_ipv6  1
+#      option  ipv6_then_ipv4  1
+
+config pop3
+#      option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  session_timeout 'param-session_timeout'
+#      option  log     1
+#      option  delay_timeout   'param-delay_timeout'
+#      option  bad_login_hang  1
+#      option  local_address   'param-local_address'
+       option  num_threads     4
+
+config pop3s
+       option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  local_address   'param-local_address'
+
+config smtp
+#      option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  session_timeout 'param-session_timeout'
+#      option  log     1
+#      option  local_address   'param-local_address'
+       option  num_threads     4
+#      option  max_recipients  'param-max_recipients'
+#      option  expire_timeout  'param-expire_timeout'
+
+config smtps
+       option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  local_address   'param-local_address'
+
+config smail
+       option  num_threads     8
+#      option  next_try_timeout        'param-next_try_timeout'
+#      option  ratio   'param-ratio'
+#      option  retries 'param-retries'
+#      option  log     1
+#      option  filters_timeout 'param-filters_timeout'
+#      option  filter_log      1
+
+config psync
+       option  disable 1
+#      option  interval        'param-interval'
+#      option  num_threads     'param-num_threads'
+#      option  timeout 'param-timeout'
+#      option  log     1
+
+config finger
+       option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  log     1
+#      option  local_address   'param-local_address'
+
+config ctrl
+#      option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  session_timeout 'param-session_timeout'
+#      option  log     1
+#      option  local_address   'param-local_address'
+#      option  num_threads     'param-num_threads'
+
+config ctrls
+       option  disable 1
+#      option  ipv6    1
+#      option  server_port     'param-server_port'
+#      option  session_timeout 'param-session_timeout'
+
+config lmail
+       option  num_threads     4
+#      option  sleep_timeout   'param-sleep_timeout'
+#      option  log     1
diff --git a/mail/xmail/files/xmail.init b/mail/xmail/files/xmail.init
new file mode 100644 (file)
index 0000000..2b4990b
--- /dev/null
@@ -0,0 +1,221 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+
+START=90
+STOP=10
+
+MAIL_ROOT=
+DAEMON=/usr/bin/XMail
+NAME=XMail
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _loctmp
+       config_get_bool _loctmp "$section" "$option" 0
+       [ "$_loctmp" -le 0 ] && return 0
+       append args "$value"
+}
+
+append_parm() {
+       local section="$1"
+       local option="$2"
+       local switch="$3"
+       local _loctmp
+       config_get _loctmp "$section" "$option"
+       [ -z "$_loctmp" ] && return 0
+       append args "$switch $_loctmp"
+}
+
+xmail() {
+       local cfg="$1"
+
+       append_parm "$cfg" mail_root "-Ms"
+       append_bool "$cfg" debug "-Md"
+       append_parm "$cfg" log_rotate "-Mr"
+       append_parm "$cfg" split_level "-Mx"
+       append_parm "$cfg" rx_buffer "-MR"
+       append_parm "$cfg" tx_buffer "-MS"
+       append_bool "$cfg" maildir_delivery "-MM"
+       append_bool "$cfg" mailbox_delivery "-Mm"
+       append_parm "$cfg" dns_cache_dirs "-MD"
+       append_bool "$cfg" ipv4_only "-M4"
+       append_bool "$cfg" ipv6_only "-M6"
+       append_bool "$cfg" ipv4_then_ipv6 "-M5"
+       append_bool "$cfg" ipv6_then_ipv4 "-M7"
+
+       config_get mail_root $cfg mail_root
+       [ -n "$mail_root" ] || return 0
+       MAIL_ROOT=$mail_root
+}
+
+pop3() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-P-"
+       append_bool "$cfg" ipv6 "-P6"
+       append_parm "$cfg" server_port "-Pp"
+       append_parm "$cfg" session_timeout "-Pt"
+       append_bool "$cfg" log "-Pl"
+       append_parm "$cfg" delay_timeout "-Pw"
+       append_bool "$cfg" bad_login_hang "-Ph"
+       append_parm "$cfg" local_address "-PI"
+       append_parm "$cfg" num_threads "-PX"
+}
+
+pop3s() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-B-"
+       append_bool "$cfg" ipv6 "-B6"
+       append_parm "$cfg" server_port "-Bp"
+       append_parm "$cfg" local_address "-BI"
+}
+
+smtp() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-S-"
+       append_bool "$cfg" ipv6 "-S6"
+       append_parm "$cfg" server_port "-Sp"
+       append_parm "$cfg" session_timeout "-St"
+       append_bool "$cfg" log "-Sl"
+       append_parm "$cfg" local_address "-SI"
+       append_parm "$cfg" num_threads "-SX"
+       append_parm "$cfg" max_recipients "-Sr"
+       append_parm "$cfg" expire_timeout "-Se"
+}
+
+smtps() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-X-"
+       append_bool "$cfg" ipv6 "-X6"
+       append_parm "$cfg" server_port "-Xp"
+       append_parm "$cfg" local_address "-XI"
+}
+
+smail() {
+       local cfg="$1"
+
+       append_parm "$cfg" num_threads "-Qn"
+       append_parm "$cfg" next_try_timeout "-Qt"
+       append_parm "$cfg" ratio "-Qi"
+       append_parm "$cfg" retries "-Qr"
+       append_bool "$cfg" log "-Ql"
+       append_parm "$cfg" filters_timeout "-QT"
+       append_bool "$cfg" filter_log "-Qg"
+}
+
+psync() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-Y-"
+       append_parm "$cfg" interval "-Yi"
+       append_parm "$cfg" num_threads "-Yt"
+       append_parm "$cfg" timeout "-Yi"
+       append_bool "$cfg" log "-Yl"
+}
+
+finger() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-F-"
+       append_bool "$cfg" ipv6 "-F6"
+       append_parm "$cfg" server_port "-Fp"
+       append_bool "$cfg" log "-Fl"
+       append_parm "$cfg" local_address "-FI"
+}
+
+ctrl() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-C-"
+       append_bool "$cfg" ipv6 "-C6"
+       append_parm "$cfg" server_port "-Cp"
+       append_parm "$cfg" session_timeout "-Ct"
+       append_bool "$cfg" log "-Cl"
+       append_parm "$cfg" local_address "-CI"
+       append_parm "$cfg" num_threads "-CX"
+}
+
+ctrls() {
+       local cfg="$1"
+
+       append_bool "$cfg" disable "-W-"
+       append_bool "$cfg" ipv6 "-W6"
+       append_parm "$cfg" server_port "-Wp"
+       append_parm "$cfg" session_timeout "-Wt"
+}
+
+lmail() {
+       local cfg="$1"
+
+       append_parm "$cfg" num_threads "-Ln"
+       append_parm "$cfg" sleep_timeout "-Lt"
+       append_bool "$cfg" log "-Ll"
+}
+       
+start() {
+       test -f $DAEMON || exit 0
+       
+       set -e
+       ulimit -c 10000
+       ulimit -s 128
+
+       config_load xmail
+
+       args=""
+
+       config_foreach xmail xmail
+       config_foreach pop3 pop3
+       config_foreach pop3s pop3s
+       config_foreach smtp smtp
+       config_foreach smtps smtps
+       config_foreach smail smail
+       config_foreach psync psync
+       config_foreach finger finger
+       config_foreach ctrl ctrl
+       config_foreach ctrls ctrls
+       config_foreach lmail lmail
+
+       [ -z "$MAIL_ROOT" ] && exit 0
+       [ -d $MAIL_ROOT ] || exit 0
+
+       export MAIL_ROOT
+
+       rm -f /var/run/$NAME.pid
+
+       $DAEMON $args
+
+       MAX_WAIT=20
+       while [ ! -f /var/run/$NAME.pid -a $MAX_WAIT -gt 0 ]
+       do
+               sleep 1
+               MAX_WAIT=`expr $MAX_WAIT - 1`
+       done
+}
+
+stop() {
+       if [ -f /var/run/$NAME.pid ]
+       then
+               config_load xmail
+               config_foreach xmail xmail
+               [ -z "$MAIL_ROOT" ] || echo `date` > $MAIL_ROOT/.shutdown
+               kill -INT `cat /var/run/$NAME.pid`
+
+               MAX_WAIT=20
+               while [ -f $MAIL_ROOT/.shutdown -a $MAX_WAIT -gt 0 ]
+               do
+                       sleep 1
+                       MAX_WAIT=`expr $MAX_WAIT - 1`
+               done
+       fi
+}
+
+restart() {
+       stop
+       sleep 1
+       start
+}
diff --git a/mail/xmail/patches/010-Makefile.common.patch b/mail/xmail/patches/010-Makefile.common.patch
new file mode 100644 (file)
index 0000000..0417268
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/Makefile.common
++++ b/Makefile.common
+@@ -77,15 +77,15 @@ SENDMAILOBJS = $(addprefix $(OUTDIR)/, $
+ $(OUTDIR)/%.o: %.cpp
+-      ${CC} ${CPPFLAGS} ${CFLAGS} -o $(OUTDIR)/$*.o -c $*.cpp
++      ${CXX} ${CPPFLAGS} ${CFLAGS} -o $(OUTDIR)/$*.o -c $*.cpp
+ all: ${OUTDIR} ${MKMACHDEPINC} ${MAILSVR} ${CRTLCLNT} ${XMCRYPT} ${MKUSERS} ${SENDMAIL}
+ ${OUTDIR}:
+       @mkdir ${OUTDIR}
+-${MKMACHDEPINC}: ${MKMACHDEP}
+-      ./${MKMACHDEP} > ${MKMACHDEPINC}
++#${MKMACHDEPINC}: ${MKMACHDEP}
++#     ./${MKMACHDEP} > ${MKMACHDEPINC}
+ ${MKMACHDEP}: ${MKMACHDEPOBJS}
+       ${LD} -o ${MKMACHDEP} ${MKMACHDEPOBJS} ${LDFLAGS}
diff --git a/mail/xmail/patches/020-Makefile.lnx.patch b/mail/xmail/patches/020-Makefile.lnx.patch
new file mode 100644 (file)
index 0000000..bdc5223
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/Makefile.lnx
++++ b/Makefile.lnx
+@@ -19,9 +19,9 @@
+ #  Davide Libenzi <davidel@xmailserver.org>
+ #
+ SYSTYPE = linux
+-CC = g++
+-LD = g++
+-STRIP = strip
++CC = $(CXX)
++LD = $(CXX)
++#STRIP = strip
+ ifeq ("$(XMAIL_FILE_OFF_BITS)", "")
+     CFLAGS := $(CFLAGS) -D_FILE_OFFSET_BITS=64
diff --git a/mail/xmail/patches/030-sysmachine.patch b/mail/xmail/patches/030-sysmachine.patch
new file mode 100644 (file)
index 0000000..716c46b
--- /dev/null
@@ -0,0 +1,33 @@
+--- /dev/null
++++ b/SysMachine.h
+@@ -0,0 +1,30 @@
++#ifndef _MACHDEFS_H
++#define _MACHDEFS_H
++
++
++#include <endian.h>
++
++#if __BYTE_ORDER == __LITTLE_ENDIAN
++#undef MACH_BIG_ENDIAN_WORDS
++#undef MACH_BIG_ENDIAN_BITFIELD
++#elif __BYTE_ORDER == __BIG_ENDIAN
++#define MACH_BIG_ENDIAN_WORDS
++#define MACH_BIG_ENDIAN_BITFIELD
++#endif
++
++typedef signed char MachInt8;
++typedef unsigned char MachUInt8;
++#define MACH_TYPE_8BIT char
++
++typedef signed short MachInt16;
++typedef unsigned short MachUInt16;
++#define MACH_TYPE_16BIT short
++
++typedef signed int MachInt32;
++typedef unsigned int MachUInt32;
++#define MACH_TYPE_32BIT int
++
++
++
++#endif
++
diff --git a/mail/xmail/patches/040-honour_opt_flags.patch b/mail/xmail/patches/040-honour_opt_flags.patch
new file mode 100644 (file)
index 0000000..99cc46f
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/Makefile.common
++++ b/Makefile.common
+@@ -24,10 +24,10 @@ ifeq ($(DEBUG_OSSL), 1)
+ endif
+ ifeq ($(XMAIL_DEBUG), 1)
+-    CFLAGS := $(CFLAGS) -O0 -g
++    CFLAGS := -O0 -g $(CFLAGS)
+     STRIP = touch
+ else
+-    CFLAGS := $(CFLAGS) -O2
++    CFLAGS := -O2 $(CFLAGS)
+ endif
+ OUTDIR = bin
diff --git a/mail/xmail/patches/050-ctrlclnt_add_ipv6_support.patch b/mail/xmail/patches/050-ctrlclnt_add_ipv6_support.patch
new file mode 100644 (file)
index 0000000..505c0a9
--- /dev/null
@@ -0,0 +1,56 @@
+--- a/CTRLClient.cpp
++++ b/CTRLClient.cpp
+@@ -53,7 +53,7 @@ struct CClnChannelCfg {
+ /* Needed by library functions ( START ) */
+ bool bServerDebug = false;
+ int iLogRotateHours = 24;
+-int iAddrFamily = AF_INET;
++int iAddrFamily = SYS_INET64;
+ static char const * const pszCClnErrors[] = {
+       "Wrong command line usage",
+       "Either none or both private key and certificate file must be supplied"
+@@ -349,7 +349,7 @@ int CClnLogError(int iError)
+ void CClnShowUsage(char const *pszProgName)
+ {
+       fprintf(stderr,
+-              "use :  %s  [-snuptfSLcKCXHD]  ...\n"
++              "use :  %s  [-snuptfSLcKCXHD4657]  ...\n"
+               "options :\n"
+               "       -s server        = set server address\n"
+               "       -n port          = set server port [%d]\n"
+@@ -364,7 +364,11 @@ void CClnShowUsage(char const *pszProgNa
+               "       -X filename      = set the SSL certificate-list file\n"
+               "       -H dir           = set the SSL certificate-store directory\n"
+               "       -c               = disable MD5 authentication\n"
+-              "       -D               = enable debug\n",
++              "       -D               = enable debug\n"
++              "       -4               = connect only to IPv4 addresses\n"
++              "       -6               = connect only to IPv6 addresses\n"
++              "       -5               = prefer IPv4 addresses over IPv6 addresses\n"
++              "       -7               = prefer IPv6 addresses over IPv4 addresses\n",
+               pszProgName, STD_CTRL_PORT, STD_CTRL_TIMEOUT);
+ }
+@@ -467,6 +471,22 @@ int CClnExec(int iArgCount, char *pszArg
+                       bServerDebug = true;
+                       break;
++              case '4':
++                      iAddrFamily = AF_INET;
++                      break;
++
++              case '6':
++                      iAddrFamily = AF_INET6;
++                      break;
++
++              case '5':
++                      iAddrFamily = SYS_INET46;
++                      break;
++
++              case '7':
++                      iAddrFamily = SYS_INET64;
++                      break;
++
+               default:
+                       return CCLN_ERR_BAD_USAGE;
+               }
diff --git a/multimedia/darkice/Makefile b/multimedia/darkice/Makefile
new file mode 100644 (file)
index 0000000..453b847
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 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:=darkice
+PKG_VERSION:=1.0
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://darkice.googlecode.com/files/
+PKG_MD5SUM:= 1804e63d42a9703d01fe378c9a77c473
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/darkice
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  SUBMENU:=Streaming
+  TITLE:=DarkIce is a live audio streamer
+  DEPENDS:=+lame-lib +librt +libpthread +libstdcpp
+  MAINTAINER:=Artur Wronowski <arteqw@gmail.com>
+endef
+
+define Package/darkice/description
+DarkIce is a live audio streamer. It records audio from an audio interface (e.g. sound card), encodes it and sends it to a streaming server.
+endef
+
+CONFIGURE_ARGS += \
+       --with-lame \
+       --without-aacplus \
+       --without-alsa \
+       --without-faac \
+       --without-jack \
+       --without-samplerate \
+       --without-twolame \
+       --without-vorbis \
+       --with-lame-prefix="$(STAGING_DIR)/usr" \
+
+define Package/darkice/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/darkice $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/darkice.cfg $(1)/etc/
+endef
+
+define Package/darkice/conffiles
+/etc/darkice.cfg
+endef
+
+$(eval $(call BuildPackage,darkice))
diff --git a/multimedia/darkice/patches/001-upstream_svn_r494.patch b/multimedia/darkice/patches/001-upstream_svn_r494.patch
new file mode 100644 (file)
index 0000000..3f6b3f1
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/src/SerialUlaw.cpp
++++ b/src/SerialUlaw.cpp
+@@ -40,6 +40,12 @@
+ #include "config.h"
+ #endif
++#ifdef HAVE_STDIO_H
++#include <stdio.h>
++#else
++#error need stdio.h
++#endif
++
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #else
diff --git a/multimedia/fswebcam/Makefile b/multimedia/fswebcam/Makefile
new file mode 100644 (file)
index 0000000..98afbdc
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2010-2012 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:=fswebcam
+PKG_VERSION:=20110717
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://www.sanslogic.co.uk/fswebcam/files
+PKG_MD5SUM:=0b343a827771b7546cf4ede19a5ed000
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fswebcam
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=fswebcam
+  URL:=http://www.sanslogic.co.uk/fswebcam/
+  DEPENDS:=+libgd
+endef
+
+define Package/fswebcam/description
+  fswebcam is a neat and simple webcam app. It captures images from a V4L1/V4L2 compatible
+  device or file, averages them to reduce noise and draws a caption using the GD Graphics
+  Library which also handles compressing the image to PNG or JPEG. The resulting image
+  is saved to a file or sent to stdio where it can be piped to something like ncftpput or scp.
+endef
+
+EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
+EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/fswebcam/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/fswebcam $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,fswebcam))
diff --git a/multimedia/ftpd-topfield/Makefile b/multimedia/ftpd-topfield/Makefile
new file mode 100644 (file)
index 0000000..89d0198
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008-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:=ftpd-topfield
+PKG_VERSION:=0.7.4
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/puppy
+PKG_MD5SUM:=4a29f04fd41aaa5890e2f202d936e270
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ftpd-topfield
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=@USB_SUPPORT +libusb-compat
+  TITLE:=Topfield PVR access via FTP
+  URL:=http://puppy.sourceforge.net/
+endef
+
+define Package/ftpd-topfield/description
+FTP server to export the filesystem of a connected Topfield PVR
+endef
+
+define Build/Configure
+endef
+
+define Package/ftpd-topfield/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ftpd $(1)/usr/sbin/ftpd-topfield
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ftpd-topfield.init $(1)/etc/init.d/ftpd-topfield
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/ftpd-topfield.config $(1)/etc/config/ftpd-topfield
+endef
+
+define Package/ftpd-topfield/conffiles
+/etc/config/ftpd-topfield
+endef
+
+$(eval $(call BuildPackage,ftpd-topfield))
diff --git a/multimedia/ftpd-topfield/files/ftpd-topfield.config b/multimedia/ftpd-topfield/files/ftpd-topfield.config
new file mode 100644 (file)
index 0000000..ec5ef2e
--- /dev/null
@@ -0,0 +1,4 @@
+config 'ftpd-topfield'
+       option 'port' '21'
+       option 'turbo' 'disabled'
+       option 'elpf' 'disabled'
diff --git a/multimedia/ftpd-topfield/files/ftpd-topfield.init b/multimedia/ftpd-topfield/files/ftpd-topfield.init
new file mode 100644 (file)
index 0000000..27c4825
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=50
+
+config_cb() {
+       local cfg="$CONFIG_SECTION"
+       local cfgt
+       config_get cfgt "$cfg" TYPE
+
+       case "$cfgt" in
+               ftpd-topfield)
+                       config_get turbo $cfg turbo
+                       config_get port $cfg port
+                       config_get elpf $cfg elpf
+
+                       case "$turbo" in
+                               yes|on|enabled|1) turbo=1;;
+                       esac
+                       case "$elpf" in
+                               yes|on|enabled|1) elpf=1;;
+                       esac
+                       TOPFIELD_ARGS="-D ${turbo:+--turbo }${port:+-P $port }${elpf:+-E}"
+               ;;
+       esac
+}
+                                                                                                                                                                                                            
+start() {
+       config_load ftpd-topfield
+       /usr/sbin/ftpd-topfield $TOPFIELD_ARGS 
+}
+  
+stop() {
+    killall ftpd-topfield
+}
diff --git a/multimedia/ftpd-topfield/patches/001-kernel_header_rename.patch b/multimedia/ftpd-topfield/patches/001-kernel_header_rename.patch
new file mode 100644 (file)
index 0000000..dedfbba
--- /dev/null
@@ -0,0 +1,14 @@
+diff -up ftpd-topfield-0.7.4/libtopfield/usb_io.h.orig ftpd-topfield-0.7.4/libtopfield/usb_io.h
+--- ftpd-topfield-0.7.4/libtopfield/usb_io.h.orig      2008-11-24 10:19:56.000000000 +0100
++++ ftpd-topfield-0.7.4/libtopfield/usb_io.h   2008-11-24 10:22:27.000000000 +0100
+@@ -35,7 +35,9 @@
+ #include <linux/version.h>
+ /* linux/usb_ch9.h wasn't separated out until 2.4.23 */
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,23)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
++#include <linux/usb/ch9.h>
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,23)
+ #include <linux/usb_ch9.h>
+ #else
+ #include <linux/usb.h>
diff --git a/multimedia/gmediaserver/Makefile b/multimedia/gmediaserver/Makefile
new file mode 100644 (file)
index 0000000..5834a07
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2007-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:=gmediaserver
+PKG_VERSION:=0.13.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://savannah.nongnu.org/download/gmediaserver/
+PKG_MD5SUM:=c422de386331e2a1a859d45f6fa270a3
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gmediaserver
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=+id3lib +libmagic +file +libupnp +libuuid +zlib $(ICONV_DEPENDS)
+  TITLE:=An UPnP music media server
+  URL:=http://www.nongnu.org/gmediaserver/
+endef
+
+define Package/gmediaserver/description
+ GMediaServer is a server for UPnP media players like the
+ Netgear MP101, Linksys WMLS11B etc. It exports one or more
+ directories using the UPnP protocol so the mediaserver can
+ browse through them and play audio or video files.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-rpath \
+       --enable-threads=posix \
+       --with-libiconv-prefix="$(ICONV_PREFIX)" \
+       --without-libintl-prefix \
+       --with-id3lib="$(STAGING_DIR)/usr" \
+       --with-libupnp="$(STAGING_DIR)/usr" \
+       , \
+       LIBS="-lz" \
+
+MAKE_FLAGS += \
+       AR="$(TARGET_CROSS)ar" \
+       LTLIBICONV="" \
+       DESTDIR="$(PKG_INSTALL_DIR)"
+
+define Package/gmediaserver/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+define Package/gmediaserver/conffiles
+/etc/config/gmediaserver
+endef
+
+$(eval $(call BuildPackage,gmediaserver))
diff --git a/multimedia/gmediaserver/files/gmediaserver.config b/multimedia/gmediaserver/files/gmediaserver.config
new file mode 100644 (file)
index 0000000..ba1fc9f
--- /dev/null
@@ -0,0 +1,3 @@
+config gmediaserver
+       option content_directory '/tmp'
+       option interface         'br-lan'
diff --git a/multimedia/gmediaserver/files/gmediaserver.init b/multimedia/gmediaserver/files/gmediaserver.init
new file mode 100644 (file)
index 0000000..4fc6067
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+BIN=gmediaserver
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       mkdir -p $RUN_D
+       config_load gmediaserver
+       config_foreach start_service gmediaserver
+}
+
+start_service() {
+       local cfg="$1"
+       config_get content_directory "$cfg" content_directory
+       config_get interface         "$cfg" interface
+
+       $BIN --background --interface=${interface:-br-lan} --pid-file=$PID_F ${content_directory:-/tmp}
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
+
diff --git a/multimedia/gmediaserver/patches/010-compile-fixes.patch b/multimedia/gmediaserver/patches/010-compile-fixes.patch
new file mode 100644 (file)
index 0000000..3a11500
--- /dev/null
@@ -0,0 +1,144 @@
+--- a/src/upnp.c
++++ b/src/upnp.c
+@@ -36,6 +36,7 @@
+ #include <uuid/uuid.h>
+ #include "intutil.h"
+ #include "gmediaserver.h"
++#include "webserver.h"
+ #include "schemas/MediaServer.h"
+ #define GMEDIASERVER_SSDP_PAUSE 100
+@@ -265,7 +266,7 @@ handle_get_var_request(struct Upnp_State
+     say(3, _("Event device UDN: %s\n"), quotearg(request->DevUDN));
+     say(3, _("Event service ID: %s\n"), quotearg(request->ServiceID));
+     say(3, _("Event variable name: %s\n"), quotearg(request->StateVarName));
+-    say(3, _("Event source: %s\n"), inet_ntoa(request->CtrlPtIPAddr));
++    say(3, _("Event source: %s\n"), inet_ntoa((*(struct sockaddr_in *)&request->CtrlPtIPAddr).sin_addr));
+     if (strcmp(request->DevUDN, device_udn) != 0) {
+         say(1, _("Discarding event - event device UDN (%s) not recognized\n"), quotearg(request->DevUDN));
+@@ -306,7 +307,7 @@ handle_action_request(struct Upnp_Action
+     say(3, _("Event device UDN: %s\n"), quotearg(request->DevUDN));
+     say(3, _("Event service ID: %s\n"), quotearg(request->ServiceID));
+     say(3, _("Event action name: %s\n"), quotearg(request->ActionName));
+-    say(3, _("Event source: %s\n"), inet_ntoa(request->CtrlPtIPAddr));
++    say(3, _("Event source: %s\n"), inet_ntoa((*(struct sockaddr_in *)&request->CtrlPtIPAddr).sin_addr));
+     say_document(4, _("Event action request:\n"), request->ActionRequest);
+     if (strcmp(request->DevUDN, device_udn) != 0) {
+@@ -502,9 +503,24 @@ init_upnp(const char *listenip, uint16_t
+     res = UpnpEnableWebserver(TRUE);
+     if (res != UPNP_E_SUCCESS)
+         die(_("cannot enable UPnP web server - %s\n"), upnp_errmsg(res));
+-    res = UpnpSetVirtualDirCallbacks(&virtual_dir_callbacks);
+-    if (res != UPNP_E_SUCCESS)
+-        die(_("cannot set virtual directory callbacks - %s\n"), upnp_errmsg(res));
++
++#define upnp_set_callback(cb, func) \
++      do {                                                                                                                    \
++              res = UpnpVirtualDir_set_##cb##Callback(func);                          \
++              if (res != UPNP_E_SUCCESS)                                                                      \
++              {                                                                                                                       \
++                      die(_("cannot set virtual directory callbacks - %s\n"), \
++                              upnp_errmsg(res));                                                                      \
++              }                                                                                                                       \
++      } while(0)
++
++      upnp_set_callback(GetInfo, webserver_get_info);
++      upnp_set_callback(Open,    webserver_open);
++      upnp_set_callback(Read,    webserver_read);
++      upnp_set_callback(Seek,    webserver_seek);
++      upnp_set_callback(Write,   webserver_write);
++      upnp_set_callback(Close,   webserver_close);
++
+     res = UpnpAddVirtualDir("/files");
+     if (res != UPNP_E_SUCCESS)
+         die(_("cannot add virtual directory for web server - %s\n"), upnp_errmsg(res));
+--- a/src/webserver.c
++++ b/src/webserver.c
+@@ -83,7 +83,7 @@ get_entry_from_url(const char *filename)
+     return get_entry_by_id(id);
+ }
+-static int
++int
+ webserver_get_info(const char *filename, struct File_Info *info)
+ {
+     Entry *entry;
+@@ -180,7 +180,7 @@ webserver_get_info(const char *filename,
+     return -1;
+ }
+-static UpnpWebFileHandle
++UpnpWebFileHandle
+ webserver_open(const char *filename, enum UpnpOpenFileMode mode)
+ {
+     Entry *entry;
+@@ -277,7 +277,7 @@ webserver_open(const char *filename, enu
+     return NULL;
+ }
+-static int
++int
+ webserver_read(UpnpWebFileHandle fh, char *buf, size_t buflen)
+ {
+     WebServerFile *file = (WebServerFile *) fh;
+@@ -307,7 +307,7 @@ webserver_read(UpnpWebFileHandle fh, cha
+     return len;
+ }
+-static int
++int
+ webserver_write(UpnpWebFileHandle fh, char *buf, size_t buflen)
+ {
+     WebServerFile *file = (WebServerFile *) fh;
+@@ -317,7 +317,7 @@ webserver_write(UpnpWebFileHandle fh, ch
+     return -1;
+ }
+-static int
++int
+ webserver_seek(UpnpWebFileHandle fh, off_t offset, int origin)
+ {
+     WebServerFile *file = (WebServerFile *) fh;
+@@ -396,7 +396,7 @@ webserver_seek(UpnpWebFileHandle fh, off
+     return 0;
+ }
+-static int
++int
+ webserver_close(UpnpWebFileHandle fh)
+ {
+     WebServerFile *file = (WebServerFile *) fh;
+@@ -419,12 +419,3 @@ webserver_close(UpnpWebFileHandle fh)
+     return 0;
+ }
+-
+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks = {
+-    webserver_get_info,
+-    webserver_open,
+-    webserver_read,
+-    webserver_write,
+-    webserver_seek,
+-    webserver_close
+-};
+--- /dev/null
++++ b/src/webserver.h
+@@ -0,0 +1,6 @@
++int webserver_get_info(const char *filename, struct File_Info *info);
++UpnpWebFileHandle webserver_open(const char *filename, enum UpnpOpenFileMode mode);
++int webserver_read(UpnpWebFileHandle fh, char *buf, size_t buflen);
++int webserver_write(UpnpWebFileHandle fh, char *buf, size_t buflen);
++int webserver_seek(UpnpWebFileHandle fh, off_t offset, int origin);
++int webserver_close(UpnpWebFileHandle fh);
+--- a/src/contentdir.c
++++ b/src/contentdir.c
+@@ -22,6 +22,7 @@
+ #include <stdint.h>           /* Gnulib/C99 */
+ #include <inttypes.h>         /* ? */
+ #include <sys/stat.h>         /* POSIX */
++#include <assert.h>
+ #include "gettext.h"          /* Gnulib/gettext */
+ #define _(s) gettext(s)
+ #define N_(s) gettext_noop(s)
diff --git a/multimedia/gphoto2/Makefile b/multimedia/gphoto2/Makefile
new file mode 100644 (file)
index 0000000..d1a0545
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2012 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:=gphoto2
+PKG_VERSION:=2.4.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/gphoto
+PKG_MD5SUM:=2635075f702b40eb2e95a80658bd4773
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gphoto2
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=Gphoto Digital Camera Control
+  URL:=http://www.gphoto.org/
+  DEPENDS:=+libgphoto2 +libpopt +libpthread +libreadline +libncurses
+endef
+
+define Package/gphoto2/description
+ For downloading and controlling digital cameras
+endef
+
+CONFIGURE_ARGS += \
+       --without-aalib \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+
+CONFIGURE_VARS += \
+       LIBGPHOTO2_CFLAGS="$$$$CFLAGS -I$(STAGING_DIR)/usr/include/gphoto2 $$$$CPPFLAGS" \
+       LIBGPHOTO2_LIBS="$$$$LDFLAGS -lgphoto2 -lgphoto2_port -lltdl" \
+       LIBEXIF_CFLAGS="$$$$CFLAGS $$$$CPPFLAGS" \
+       LIBEXIF_LIBS="$$$$LDFLAGS -lexif" \
+       POPT_CFLAGS="$$$$CFLAGS $$$$CPPFLAGS" \
+       POPT_LIBS="$$$$LDFLAGS -lpopt" \
+
+define Package/gphoto2/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,gphoto2))
diff --git a/multimedia/gphoto2/patches/001-automake-compat.patch b/multimedia/gphoto2/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..89cad74
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -66,7 +66,6 @@ GP_GETTEXT_HACK([],[Lutz Müller and oth
+ ALL_LINGUAS="az cs da de en_GB es eu fi fr hu id it ja nl pa pl pt_BR ro ru rw sk sr sv uk vi zh_CN zh_TW"
+ AM_GNU_GETTEXT_VERSION([0.14.1])
+ AM_GNU_GETTEXT([external])
+-AM_PO_SUBDIRS()
+ AM_ICONV()
+ GP_GETTEXT_FLAGS()
diff --git a/multimedia/gphoto2/patches/002-disable-docs-translations.patch b/multimedia/gphoto2/patches/002-disable-docs-translations.patch
new file mode 100644 (file)
index 0000000..1def16a
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,12 +62,7 @@ GP_REFERENCES()dnl
+ dnl ---------------------------------------------------------------------------
+ dnl i18n support
+ dnl ---------------------------------------------------------------------------
+-GP_GETTEXT_HACK([],[Lutz Müller and others],[${MAIL_GPHOTO_TRANSLATION}])
+-ALL_LINGUAS="az cs da de en_GB es eu fi fr hu id it ja nl pa pl pt_BR ro ru rw sk sr sv uk vi zh_CN zh_TW"
+-AM_GNU_GETTEXT_VERSION([0.14.1])
+-AM_GNU_GETTEXT([external])
+ AM_ICONV()
+-GP_GETTEXT_FLAGS()
+ dnl We cannot use AC_DEFINE_UNQUOTED() for these definitions, as
+ dnl we require make to do insert the proper $(datadir) value
+@@ -352,11 +347,9 @@ AC_SUBST([AM_LDFLAGS])
+ # Create output files
+ # ---------------------------------------------------------------------------
+ AC_CONFIG_FILES([
+-po/Makefile.in 
+ Makefile
+ gphoto2/Makefile
+ m4m/Makefile
+-doc/Makefile
+ contrib/Makefile
+ packaging/Makefile
+ packaging/rpm/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,3 +1,3 @@
+-SUBDIRS = m4m contrib doc gphoto2 packaging po
++SUBDIRS = m4m contrib gphoto2 packaging
+ ACLOCAL_AMFLAGS = -I auto-m4 -I m4m
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -278,7 +278,7 @@ target_alias = @target_alias@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = m4m contrib doc gphoto2 packaging po
++SUBDIRS = m4m contrib gphoto2 packaging
+ ACLOCAL_AMFLAGS = -I auto-m4 -I m4m
+ all: config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/multimedia/gphoto2/patches/100-gpdebug.patch b/multimedia/gphoto2/patches/100-gpdebug.patch
new file mode 100644 (file)
index 0000000..177fc09
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gphoto2/foreach.c
++++ b/gphoto2/foreach.c
+@@ -31,6 +31,8 @@
+ #include <gphoto2/gphoto2-port-log.h>
++#define GP_DEBUG (void)
++
+ #define GP_ERROR_FRONTEND_BAD_ID -10000
+ #define CR(result) {int __r=(result); if(__r<0) return(__r);}
+ #define CL(result,list) {int __r=(result); if(__r<0) {gp_list_free(list);return(__r);}}
diff --git a/multimedia/graphicsmagick/Makefile b/multimedia/graphicsmagick/Makefile
new file mode 100644 (file)
index 0000000..eccd58a
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2009-2010 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:=GraphicsMagick
+PKG_VERSION:=1.3.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/graphicsmagick
+PKG_MD5SUM:=c0428886ea07736b0f1872d256ab7ebd
+
+include $(INCLUDE_DIR)/package.mk
+
+export PATH:=$(PKG_BUILD_DIR)/bin:$(TARGET_PATH)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+define Package/GraphicsMagick/Default
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=GraphicsMagick
+  URL:=http://www.graphicsmagick.org/
+  DEPENDS:=+libbz2 +libfreetype +libltdl +libpthread +libstdcpp +zlib
+endef
+
+define Package/GraphicsMagick
+  $(call Package/GraphicsMagick/Default)
+endef
+
+define Package/GraphicsMagick/description
+  An image manipulation library.
+endef
+
+define Package/GraphicsMagick-jpeg
+  $(call Package/GraphicsMagick/Default)
+  TITLE+= (jpeg)
+  DEPENDS:=+GraphicsMagick +libjpeg +zlib
+endef
+
+define Package/GraphicsMagick-jpeg/description
+  GraphicsMagick JPEG module
+endef
+
+CONFIGURE_ARGS += \
+         --with-modules \
+         --enable-shared \
+         --enable-static \
+         --without-xml \
+         --without-x \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/GraphicsMagick/magick
+       $(INSTALL_DIR) $(1)/usr/include/GraphicsMagick/wand
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/GraphicsMagick/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share/GraphicsMagick-$(PKG_VERSION)
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/GraphicsMagick-$(PKG_VERSION)/* \
+               $(1)/usr/share/GraphicsMagick-$(PKG_VERSION)
+endef
+
+define BuildPlugin
+  define Package/GraphicsMagick-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/GraphicsMagick-$(PKG_VERSION)/modules-Q8/coders
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/GraphicsMagick-$(PKG_VERSION)/modules-Q8/coders/$(1).{so,la} \
+               $$(1)/usr/lib/GraphicsMagick-$(PKG_VERSION)/modules-Q8/coders
+  endef
+
+  $$(eval $$(call BuildPackage,GraphicsMagick-$(1)))
+endef
+
+$(eval $(call BuildPackage,GraphicsMagick))
+$(eval $(call BuildPlugin,jpeg))
diff --git a/multimedia/gst-ffmpeg/Config.in b/multimedia/gst-ffmpeg/Config.in
new file mode 100644 (file)
index 0000000..3a0cfbb
--- /dev/null
@@ -0,0 +1,269 @@
+menu "Configuration"
+       depends on PACKAGE_gst-ffmpeg
+
+config GST_FFMPEG_IPV6
+       bool "Enable IPv6"
+       default IPV6
+
+config GST_FFMPEG_PATENTED
+       bool "Include patented codecs and technologies"
+       default BUILD_PATENTED
+
+config GET_FFMPEG_LIBDLNA_SUPPORT
+       bool "Include support for libdlna/ushare"
+       depends on GST_FFMPEG_PATENTED
+       select GST_FFMPEG_DECODER_ac3
+       select GST_FFMPEG_DECODER_atrac3
+       select GST_FFMPEG_DECODER_h264
+       select GST_FFMPEG_DECODER_jpegls
+       select GST_FFMPEG_DECODER_mp3
+       select GST_FFMPEG_DECODER_mpeg1video
+       select GST_FFMPEG_DECODER_mpeg2video
+       select GST_FFMPEG_DECODER_mpeg4
+       select GST_FFMPEG_DECODER_mpeg4aac
+       select GST_FFMPEG_DECODER_mpegvideo
+       select GST_FFMPEG_DECODER_wmav1
+       select GST_FFMPEG_DECODER_wmav2
+       select GST_FFMPEG_DECODER_png
+       select GST_FFMPEG_DEMUXER_ac3
+       select GST_FFMPEG_DEMUXER_h264
+       select GST_FFMPEG_DEMUXER_mp3
+       select GST_FFMPEG_DEMUXER_mpegvideo
+
+comment "Encoders ---"
+
+config GST_FFMPEG_ENCODER_ac3
+       bool "AC3"
+       depends on GST_FFMPEG_PATENTED
+       select GST_FFMPEG_PARSER_ac3
+
+config GST_FFMPEG_ENCODER_jpegls
+       bool "JPEG-LS"
+
+config GST_FFMPEG_ENCODER_mpeg1video
+       bool "MPEG-1 Video"
+
+config GST_FFMPEG_ENCODER_mpeg2video
+       bool "MPEG-2 Video"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_ENCODER_mpeg4
+       bool "MPEG-4"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_ENCODER_pcm_s16be
+       bool "PCM signed 16-bit big-endian"
+
+config GST_FFMPEG_ENCODER_pcm_s16le
+       bool "PCM signed 16-bit little-endian"
+
+config GST_FFMPEG_ENCODER_png
+       bool "PNG"
+       select GST_FFMPEG_ENCODER_zlib
+
+config GST_FFMPEG_ENCODER_vorbis
+       bool "Vorbis"
+
+config GST_FFMPEG_ENCODER_zlib
+       bool "Zlib"
+
+comment "Decoders ---"
+
+config GST_FFMPEG_DECODER_aac
+       bool "AAC (Advanced Audio Coding)"
+       depends on GST_FFMPEG_PATENTED
+       select GST_FFMPEG_PARSER_aac
+
+config GST_FFMPEG_DECODER_ac3
+       bool "AC3"
+       depends on GST_FFMPEG_PATENTED
+       select GST_FFMPEG_PARSER_ac3
+
+config GST_FFMPEG_DECODER_atrac3
+       bool "ATRAC3"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_gif
+       bool "GIF"
+
+config GST_FFMPEG_DECODER_h264
+       bool "H.264"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_jpegls
+       bool "JPEG-LS"
+
+config GST_FFMPEG_DECODER_mp2
+       bool "MP2 (MPEG Audio Layer 2)"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_mp3
+       bool "MP3 (MPEG Audio Layer 2)"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_mpegvideo
+       bool "MPEG Video"
+
+config GST_FFMPEG_DECODER_mpeg1video
+       bool "MPEG-1 Video"
+
+config GST_FFMPEG_DECODER_mpeg2video
+       bool "MPEG-2 Video"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_mpeg4
+       bool "MPEG-4"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_mpeg4aac
+       bool "MPEG-4 (AAC)"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_pcm_s16be
+       bool "PCM signed 16-bit big-endian"
+
+config GST_FFMPEG_DECODER_pcm_s16le
+       bool "PCM signed 16-bit little-endian"
+
+config GST_FFMPEG_DECODER_png
+       bool "PNG"
+       select GST_FFMPEG_DECODER_zlib
+
+config GST_FFMPEG_DECODER_vorbis
+       bool "Vorbis"
+
+config GST_FFMPEG_DECODER_wmav1
+       bool "WMAv1"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_wmav2
+       bool "WMAv2"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_DECODER_zlib
+       bool "Zlib"
+
+comment "Muxers ---"
+
+config GST_FFMPEG_MUXER_ac3
+       bool "AC3"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_MUXER_ffm
+       bool "FFM (ffserver live feed)"
+
+config GST_FFMPEG_MUXER_h264
+       bool "H.264"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_MUXER_mp3
+       bool "MP3 (MPEG Audio Layer 3)"
+
+config GST_FFMPEG_MUXER_mp4
+       bool "MP4"
+
+config GST_FFMPEG_MUXER_mpeg1video
+       bool "MPEG-1 Video"
+
+config GST_FFMPEG_MUXER_mpeg2video
+       bool "MPEG-2 Video"
+
+config GST_FFMPEG_MUXER_mpegts
+       bool "MPEG-2 (TS)"
+
+config GST_FFMPEG_MUXER_ogg
+       bool "Ogg"
+
+config GST_FFMPEG_MUXER_oss
+       bool "OSS (Open Sound System playback)"
+
+config GST_FFMPEG_MUXER_rtp
+       bool "RTP"
+
+comment "Demuxers ---"
+
+config GST_FFMPEG_DEMUXER_ac3
+       bool "AC3"
+
+config GST_FFMPEG_DEMUXER_ffm
+       bool "FFM (ffserver live feed)"
+
+config GST_FFMPEG_DEMUXER_h264
+       bool "H.264"
+       depends on FFMPEG_PATENTED
+
+config GST_FFMPEG_DEMUXER_mp3
+       bool "MP3 (MPEG Audio Layer 3)"
+
+config GST_FFMPEG_DEMUXER_mpegvideo
+       bool "MPEG Video"
+
+config GST_FFMPEG_DEMUXER_mpegps
+       bool "MPEG-2 (PS)"
+
+config GST_FFMPEG_DEMUXER_mpegts
+       bool "MPEG-2 (TS)"
+
+config GST_FFMPEG_DEMUXER_ogg
+       bool "Ogg"
+
+config GST_FFMPEG_DEMUXER_rm
+       bool "RM"
+       help
+         RealMedia format demuxer
+
+config GST_FFMPEG_DEMUXER_rtsp
+       bool "RTSP"
+       select GST_FFMPEG_DEMUXER_rm
+       select GST_FFMPEG_DEMUXER_sdp
+
+config GST_FFMPEG_DEMUXER_sdp
+       bool "SDP"
+       select GST_FFMPEG_DEMUXER_mpegts
+
+comment "Parsers ---"
+
+config GST_FFMPEG_PARSER_aac
+       bool "AAC (Advanced Audio Coding)"
+       depends on GST_FFMPEG_PATENTED
+
+config GST_FFMPEG_PARSER_ac3
+       bool "AC3"
+
+config GST_FFMPEG_PARSER_h264
+       bool "H.264"
+       depends on GST_FFMPEG_PATENTED
+       select GST_FFMPEG_DECODER_h264
+
+config GST_FFMPEG_PARSER_mpegaudio
+       bool "MPEG Audio"
+
+config GST_FFMPEG_PARSER_mpegvideo
+       bool "MPEG Video"
+
+config GST_FFMPEG_PARSER_mpeg4video
+       bool "MPEG-4 Video"
+
+comment "Protocols ---"
+
+config GST_FFMPEG_PROTOCOL_file
+       bool "file:"
+
+config GST_FFMPEG_PROTOCOL_http
+       bool "http:"
+
+config GST_FFMPEG_PROTOCOL_pipe
+       bool "pipe:"
+
+config GST_FFMPEG_PROTOCOL_rtp
+       bool "rtp:"
+       select GST_FFMPEG_PROTOCOL_udp
+
+config GST_FFMPEG_PROTOCOL_tcp
+       bool "tcp:"
+
+config GST_FFMPEG_PROTOCOL_udp
+       bool "udp:"
+
+endmenu
+
diff --git a/multimedia/gst-ffmpeg/Makefile b/multimedia/gst-ffmpeg/Makefile
new file mode 100644 (file)
index 0000000..7c1110d
--- /dev/null
@@ -0,0 +1,172 @@
+#
+# 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:=gst-ffmpeg
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-ffmpeg
+PKG_VERSION:=0.10.11
+PKG_MD5SUM:=0d23197ba7ac06ea34fa66d38469ebe5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_USE_MIPS16:=0
+
+FFMPEG_ENCODERS:= \
+       ac3 \
+       jpegls \
+       mpeg1video \
+       mpeg2video \
+       mpeg4 \
+       pcm_s16be \
+       pcm_s16le \
+       png \
+       vorbis \
+       zlib \
+
+FFMPEG_DECODERS:= \
+       aac \
+       ac3 \
+       atrac3 \
+       gif \
+       h264 \
+       jpegls \
+       mp2 \
+       mp3 \
+       mpeg1video \
+       mpeg2video \
+       mpeg4 \
+       mpeg4aac \
+       mpegvideo \
+       pcm_s16be \
+       pcm_s16le \
+       png \
+       vorbis \
+       wmav1 \
+       wmav2 \
+       zlib \
+
+FFMPEG_MUXERS:= \
+       ac3 \
+       ffm \
+       h264 \
+       mp3 \
+       mp4 \
+       mpeg1video \
+       mpeg2video \
+       mpegts \
+       ogg \
+       oss \
+       rtp \
+
+FFMPEG_DEMUXERS:= \
+       ac3 \
+       ffm \
+       h264 \
+       mp3 \
+       mpegps \
+       mpegts \
+       mpegvideo \
+       ogg \
+       rm \
+       rtsp \
+       sdp \
+       v4l2 \
+
+FFMPEG_PARSERS:= \
+       aac \
+       ac3 \
+       h264 \
+       mpegaudio \
+       mpegvideo \
+       mpeg4video \
+
+FFMPEG_PROTOCOLS:= \
+       file http pipe rtp tcp udp
+
+PKG_CONFIG_DEPENDS:= \
+       $(patsubst %,CONFIG_GST_FFMPEG_ENCODER_%,$(FFMPEG_ENCODERS)) \
+       $(patsubst %,CONFIG_GST_FFMPEG_DECODER_%,$(FFMPEG_DECODERS)) \
+       $(patsubst %,CONFIG_GST_FFMPEG_MUXER_%,$(FFMPEG_DEMUXERS)) \
+       $(patsubst %,CONFIG_GST_FFMPEG_DEMUXER_%,$(FFMPEG_DEMUXERS)) \
+       $(patsubst %,CONFIG_GST_FFMPEG_PARSER_%,$(FFMPEG_PARSERS)) \
+       $(patsubst %,CONFIG_GST_FFMPEG_PROTOCOL_%,$(FFMPEG_PROTOCOLS))
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gst-ffmpeg
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=GStreamer ffmpeg bindings
+  URL:=http://www.gstreamer.net/modules/gst-ffmpeg.html
+  MAINTAINER:=Okkel Klaver <info@vanhetland.nl>
+  DEPENDS:= +libgstreamer +gst-mod-alsa +libbz2 +libgstaudio
+endef
+
+define Package/gst-ffmpeg/description
+  GStreamer ffmpeg bindings
+endef
+
+define Package/gst-ffmpeg/config
+source "$(SOURCE)/Config.in"
+endef
+
+FILTER_CONFIG= \
+       $(foreach c, $(3), \
+               $(if $(CONFIG_GST_FFMPEG_$(1)_$(c)),--enable-$(2)='$(c)') \
+       )
+
+FFMPEG_CONFIGURE_ENCODERS:=$(call FILTER_CONFIG,ENCODER,encoder,$(FFMPEG_ENCODERS))
+FFMPEG_CONFIGURE_DECODERS:=$(call FILTER_CONFIG,DECODER,decoder,$(FFMPEG_DECODERS))
+FFMPEG_CONFIGURE_MUXERS:=$(call FILTER_CONFIG,MUXER,muxer,$(FFMPEG_MUXERS))
+FFMPEG_CONFIGURE_DEMUXERS:=$(call FILTER_CONFIG,DEMUXER,demuxer,$(FFMPEG_DEMUXERS))
+FFMPEG_CONFIGURE_PARSERS:=$(call FILTER_CONFIG,PARSER,parser,$(FFMPEG_PARSERS))
+FFMPEG_CONFIGURE_PROTOCOLS:=$(call FILTER_CONFIG,PROTOCOL,protocol,$(FFMPEG_PROTOCOLS))
+
+GST_VERSION:=0.10
+
+CONFIGURE_ARGS += \
+       --with-ffmpeg-extra-configure="--target-os=linux \
+               --disable-bsfs \
+               --disable-devices \
+               --disable-encoders \
+               $(FFMPEG_CONFIGURE_ENCODERS) \
+               --disable-decoders \
+               $(FFMPEG_CONFIGURE_DECODERS) \
+               --disable-muxers \
+               $(FFMPEG_CONFIGURE_MUXERS) \
+               --disable-demuxers \
+               $(FFMPEG_CONFIGURE_DEMUXERS) \
+               --disable-parsers \
+               $(FFMPEG_CONFIGURE_PARSERS) \
+               --disable-protocols \
+               $(FFMPEG_CONFIGURE_PROTOCOLS)"
+
+# XXX: trick to force use of embedded FFmpeg headers
+TARGET_CFLAGS += $(TARGET_CPPFLAGS)
+TARGET_CPPFLAGS :=
+
+TARGET_LDFLAGS += $(FPIC)
+
+define Build/Prepare
+$(call Build/Prepare/Default)
+endef
+
+define Package/gst-ffmpeg/install
+       $(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+                ./usr/lib/gstreamer-$(GST_VERSION)/libgstffmpeg.so* \
+                $(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+        )
+endef
+
+$(eval $(call BuildPackage,gst-ffmpeg))
diff --git a/multimedia/gst-plugins-bad/Makefile b/multimedia/gst-plugins-bad/Makefile
new file mode 100644 (file)
index 0000000..f7214b8
--- /dev/null
@@ -0,0 +1,245 @@
+#
+# Copyright (C) 2011-2012 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:=gst-plugins-bad
+PKG_VERSION:=0.10.23
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-bad/
+PKG_MD5SUM:=e4822fa2cc933768e2998311a1565979
+
+PKG_BUILD_DEPENDS:= gstreamer gst-plugins-base liboil
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gstreamer/Default
+  CATEGORY:=Multimedia
+  SECTION:=multimedia
+  TITLE:=GStreamer
+  URL:=http://gstreamer.freedesktop.org/
+endef
+
+define Package/gstreamer/description/Default
+ GStreamer open source multimedia framework
+endef
+
+
+define Package/gst-plugins-bad
+$(call Package/gstreamer/Default)
+  TITLE+= plugins collection (bad)
+  DEPENDS+= $(GST_DEPENDS)
+endef
+
+define Package/gts-plugins-bad/description
+$(call Package/gstreamer/description/Default)
+ .
+ This meta package contains only dependencies to the other plugins from
+ the bad plugins collection.
+endef
+
+
+GST_VERSION:=0.10
+
+CONFIGURE_ARGS += \
+       --disable-examples \
+       --disable-nls   \
+       \
+       --disable-directsound \
+       --disable-directdraw \
+       --disable-osx_video \
+       --disable-quicktime \
+       --disable-vcd \
+       --disable-alsa \
+       --disable-assrender \
+       --disable-amrwb \
+       --disable-apexsink \
+       --disable-bz2 \
+       --disable-cdaudio \
+       --disable-celt \
+       --disable-cog \
+       --disable-dc1394 \
+       --disable-directfb \
+       --disable-dirac \
+       --disable-dts \
+       --disable-divx \
+       --disable-resindvd \
+       --disable-metadata \
+       --disable-faac \
+       --disable-fbdev \
+       --disable-flite \
+       --disable-gsm \
+       --disable-jack \
+       --disable-jp2k \
+       --disable-kate \
+       --disable-ladspa \
+       --disable-lv2 \
+       --disable-modplug \
+       --disable-mimic \
+       --disable-mpeg2enc \
+       --disable-mplex \
+       --disable-musepack \
+       --disable-musicbrainz \
+       --disable-mythtv \
+       --disable-nas \
+       --disable-neon \
+       --disable-ofa \
+       --disable-rsvg \
+       --disable-timidity \
+       --disable-wildmidi \
+       --disable-sdl \
+       --disable-sdltest \
+       --disable-sndfile \
+       --disable-soundtouch \
+       --disable-spc \
+       --disable-gme \
+       --disable-swfdec \
+       --disable-theoradec \
+       --disable-xvid \
+       --disable-dvb \
+       --disable-wininet \
+       --disable-acm \
+       --disable-vdpau \
+       --disable-schro \
+       --disable-zbar \
+       --disable-vp8 \
+       --disable-librfb \
+       \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+       --without-x \
+
+EXTRA_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+
+
+define Package/gst-plugins-ugly/install
+       /bin/true
+endef
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other packages
+define GstBuildLibrary
+
+  GST_DEPENDS += +libgst$(1)
+
+  define Package/libgst$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) library (base)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $(4)
+  endef
+
+  define Package/libgst$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) library.
+  endef
+
+  define Package/libgst$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libgst$(1)-$(GST_VERSION).so.* \
+               $$(1)/usr/lib/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,libgst$(1)))
+endef
+$(eval $(call GstBuildLibrary,photography,photography,,))
+
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other gstreamer plugins (short name)
+# 5: dependencies on other packages
+define GstBuildPlugin
+
+  GST_DEPENDS += +gst-mod-$(1)
+
+  define Package/gst-mod-$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) plugin (bad)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $$(foreach p,$(4),+gst-mod-$$(p)) $(5)
+  endef
+
+  define Package/gst-mod-$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) plugin.
+  endef
+
+  define Package/gst-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \
+               $$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,gst-mod-$(1)))
+endef
+
+$(eval $(call GstBuildPlugin,adpcmdec,adpcm decoding support,,,))
+$(eval $(call GstBuildPlugin,adpcmenc,adpcm encoding support,,,))
+$(eval $(call GstBuildPlugin,aiff,aiff support,tag,,))
+$(eval $(call GstBuildPlugin,asfmux,asf muxing support,rtp,,))
+$(eval $(call GstBuildPlugin,autoconvert,autoconvert support,,,))
+$(eval $(call GstBuildPlugin,camerabin,camerabin support,interfaces photography tag,,))
+$(eval $(call GstBuildPlugin,legacyresample,legacyresample support,,,+liboil +librt))
+$(eval $(call GstBuildPlugin,bayer,bayer support,video,,))
+$(eval $(call GstBuildPlugin,cdxaparse,cdxaparse support,riff,,))
+$(eval $(call GstBuildPlugin,dataurisrc,dataurisrc support,,,))
+$(eval $(call GstBuildPlugin,dccp,dccp support,,,))
+$(eval $(call GstBuildPlugin,debugutilsbad,debugutils support,interfaces video,,))
+$(eval $(call GstBuildPlugin,dtmf,dtmf support,rtp,,))
+$(eval $(call GstBuildPlugin,dvdspu,dvdspu support,video,,))
+$(eval $(call GstBuildPlugin,faad,faad support,audio,,+libfaad2))
+$(eval $(call GstBuildPlugin,festival,festival support,audio,,))
+$(eval $(call GstBuildPlugin,freeze,freeze support,,,))
+$(eval $(call GstBuildPlugin,frei0r,frei0r support,controller video,,))
+$(eval $(call GstBuildPlugin,h264parse,h264parse support,,,))
+$(eval $(call GstBuildPlugin,hdvparse,hdvparse support,,,))
+$(eval $(call GstBuildPlugin,id3tag,id3tag support,tag,,))
+$(eval $(call GstBuildPlugin,jpegformat,jpegformat support,tag interfaces,,))
+$(eval $(call GstBuildPlugin,liveadder,liveadder support,audio,,))
+$(eval $(call GstBuildPlugin,mpegdemux,mpegdemux support,tag,,+liboil +librt))
+$(eval $(call GstBuildPlugin,mpegtsmux,mpegtsmux support,video,,))
+$(eval $(call GstBuildPlugin,mpegpsmux,mpegpsmux support,,,))
+$(eval $(call GstBuildPlugin,mpegvideoparse,mpegvideoparse support,,,))
+$(eval $(call GstBuildPlugin,mve,mve support,,,))
+$(eval $(call GstBuildPlugin,mxf,mxf support,video,,))
+$(eval $(call GstBuildPlugin,nsf,nsf support,,,))
+$(eval $(call GstBuildPlugin,nuvdemux,nuvdemux support,,,))
+$(eval $(call GstBuildPlugin,pcapparse,pcapparse support,,,))
+$(eval $(call GstBuildPlugin,pnm,pnm support,video,,))
+$(eval $(call GstBuildPlugin,rawparse,rawparse support,video audio,,))
+$(eval $(call GstBuildPlugin,rtpmux,rtpmux support,rtp,,))
+#$(eval $(call GstBuildPlugin,rfbsrc,rfb support,,,))
+$(eval $(call GstBuildPlugin,scaletempoplugin,scaletempo support,,,))
+$(eval $(call GstBuildPlugin,sdpelem,sdp support,interfaces rtp sdp,,))
+$(eval $(call GstBuildPlugin,segmentclip,segmentclip support,audio,,))
+$(eval $(call GstBuildPlugin,siren,siren support,rtp,,))
+#$(eval $(call GstBuildPlugin,soundtouch,soundtouch support,,,))
+$(eval $(call GstBuildPlugin,speed,speed support,,,))
+$(eval $(call GstBuildPlugin,subenc,subenc support,controller,,))
+$(eval $(call GstBuildPlugin,stereo,stereo support,audio controller,,))
+$(eval $(call GstBuildPlugin,tta,tta support,,,))
+$(eval $(call GstBuildPlugin,videomeasure,videomeasure support,video,,))
+$(eval $(call GstBuildPlugin,videosignal,videosignal support,video,,))
+$(eval $(call GstBuildPlugin,vmnc,vmnc support,,,))
+$(eval $(call GstBuildPlugin,mms,mms support,,,+libmms))
+
+$(eval $(call BuildPackage,gst-plugins-bad))
diff --git a/multimedia/gst-plugins-bad/patches/000-gettext.patch b/multimedia/gst-plugins-bad/patches/000-gettext.patch
new file mode 100644 (file)
index 0000000..b2c2d19
--- /dev/null
@@ -0,0 +1,23 @@
+diff -ur gst-plugins-bad-0.10.19.orig/configure.ac gst-plugins-bad-0.10.19/configure.ac
+--- gst-plugins-bad-0.10.19.orig/configure.ac  2011-01-07 01:44:21.000000000 +0100
++++ gst-plugins-bad-0.10.19/configure.ac       2011-01-07 01:45:31.000000000 +0100
+@@ -1772,7 +1772,6 @@
+ ext/vp8/Makefile
+ ext/xvid/Makefile
+ ext/zbar/Makefile
+-po/Makefile.in
+ docs/Makefile
+ docs/plugins/Makefile
+ docs/version.entities
+diff -ur gst-plugins-bad-0.10.19.orig/Makefile.am gst-plugins-bad-0.10.19/Makefile.am
+--- gst-plugins-bad-0.10.19.orig/Makefile.am   2011-01-07 01:44:21.000000000 +0100
++++ gst-plugins-bad-0.10.19/Makefile.am        2011-01-07 01:46:17.000000000 +0100
+@@ -2,7 +2,7 @@
+ SUBDIRS = \
+       gst-libs gst sys ext pkgconfig \
+-      m4 common docs tests po tools
++      m4 common docs tests tools
+ DIST_SUBDIRS = \
+       gst gst-libs sys ext pkgconfig \
diff --git a/multimedia/gst-plugins-base/Makefile b/multimedia/gst-plugins-base/Makefile
new file mode 100644 (file)
index 0000000..9c16586
--- /dev/null
@@ -0,0 +1,241 @@
+#
+# Copyright (C) 2008-2012 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:=gst-plugins-base
+PKG_VERSION:=0.10.36
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-base/
+PKG_MD5SUM:=776c73883e567f67b9c4a2847d8d041a
+
+PKG_BUILD_DEPENDS:= gstreamer liboil
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_PACKAGE_gst-mod-alsa \
+       CONFIG_PACKAGE_gst-mod-app \
+       CONFIG_PACKAGE_gst-mod-audioconvert \
+       CONFIG_PACKAGE_gst-mod-audiorate \
+       CONFIG_PACKAGE_gst-mod-audioresample \
+       CONFIG_PACKAGE_gst-mod-audiotestsrc \
+       CONFIG_PACKAGE_gst-mod-gio \
+       CONFIG_PACKAGE_gst-mod-ogg \
+       CONFIG_PACKAGE_gst-mod-tcp \
+       CONFIG_PACKAGE_gst-mod-theora \
+       CONFIG_PACKAGE_gst-mod-videotestsrc \
+       CONFIG_PACKAGE_gst-mod-volume \
+       CONFIG_PACKAGE_gst-mod-vorbis \
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+# -liconv crept in from pkg-config, to be revisited later
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gstreamer/Default
+  CATEGORY:=Multimedia
+  SECTION:=multimedia
+  TITLE:=GStreamer
+  URL:=http://gstreamer.freedesktop.org/
+endef
+
+define Package/gstreamer/description/Default
+ GStreamer open source multimedia framework
+endef
+
+
+define Package/gst-plugins-base
+$(call Package/gstreamer/Default)
+  TITLE+= plugins collection (base)
+  DEPENDS+= $(GST_DEPENDS)
+endef
+
+define Package/gts-plugins-base/description
+$(call Package/gstreamer/description/Default)
+ .
+ This meta package contains only dependencies to the other libraries and
+ plugins from the base plugins collection.
+endef
+
+
+GST_COND_SELECT = $(patsubst %,$(if $(CONFIG_PACKAGE_gst-mod-$(1)),--enable,--disable)-%,$(1))
+
+GST_VERSION:=0.10
+
+CONFIGURE_ARGS += \
+       --disable-examples \
+       \
+       $(call GST_COND_SELECT,alsa) \
+       --disable-alsa-test \
+       $(call GST_COND_SELECT,app) \
+       $(call GST_COND_SELECT,audioconvert) \
+       $(call GST_COND_SELECT,audiorate) \
+       $(call GST_COND_SELECT,audioresample) \
+       $(call GST_COND_SELECT,audiotestsrc) \
+       --disable-cdparanoia \
+       --disable-ffmpegcolorspace \
+       --disable-freetypetest \
+       $(call GST_COND_SELECT,gio) \
+       --disable-gnome_vfs \
+       --disable-gst_v4l \
+       --disable-libvisual \
+       $(call GST_COND_SELECT,ogg) \
+       --disable-oggtest \
+       --disable-pango \
+       --disable-subparse \
+       $(call GST_COND_SELECT,tcp) \
+       $(call GST_COND_SELECT,theora) \
+       --disable-videorate \
+       --disable-videoscale \
+       $(call GST_COND_SELECT,videotestsrc) \
+       $(call GST_COND_SELECT,volume) \
+       $(call GST_COND_SELECT,vorbis) \
+       --disable-vorbistest \
+       --disable-x \
+       --disable-xshm \
+       --disable-xvideo \
+       \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+       --without-x \
+       \
+       --with-audioresample-format=int \
+
+EXTRA_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/include/gstreamer-$(GST_VERSION)/* \
+               $(1)/usr/include/gstreamer-$(GST_VERSION)/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libgst*-$(GST_VERSION).{a,la,so*} \
+               $(1)/usr/lib/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst*.{la,so} \
+               $(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/pkgconfig/gstreamer*-$(GST_VERSION).pc \
+               $(1)/usr/lib/pkgconfig/ \
+       )
+endef
+
+
+define Package/gst-plugins-base/install
+       /bin/true
+endef
+
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other packages
+define GstBuildLibrary
+
+  GST_DEPENDS += +libgst$(1)
+
+  define Package/libgst$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) library (base)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $(4)
+  endef
+
+  define Package/libgst$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) library.
+  endef
+
+  define Package/libgst$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libgst$(1)-$(GST_VERSION).so.* \
+               $$(1)/usr/lib/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,libgst$(1)))
+endef
+
+$(eval $(call GstBuildLibrary,app,app,,))
+$(eval $(call GstBuildLibrary,audio,audio,interfaces pbutils,))
+$(eval $(call GstBuildLibrary,cdda,CDDA,tag,))
+$(eval $(call GstBuildLibrary,fft,FFT,,))
+$(eval $(call GstBuildLibrary,interfaces,interfaces,))
+$(eval $(call GstBuildLibrary,netbuffer,network buffer,,))
+$(eval $(call GstBuildLibrary,pbutils,utils,,))
+$(eval $(call GstBuildLibrary,riff,RIFF media,audio tag,,))
+$(eval $(call GstBuildLibrary,rtp,RTP,,))
+$(eval $(call GstBuildLibrary,rtsp,RTSP,,))
+$(eval $(call GstBuildLibrary,sdp,SDP,,))
+$(eval $(call GstBuildLibrary,tag,tag support,,))
+$(eval $(call GstBuildLibrary,video,video,,))
+
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other gstreamer plugins (short name)
+# 5: dependencies on other packages
+define GstBuildPlugin
+
+  GST_DEPENDS += +gst-mod-$(1)
+
+  define Package/gst-mod-$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) plugin (base)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $$(foreach p,$(4),+gst-mod-$$(p)) $(5)
+  endef
+
+  define Package/gst-mod-$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) plugin.
+  endef
+
+  define Package/gst-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \
+               $$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,gst-mod-$(1)))
+endef
+
+$(eval $(call GstBuildPlugin,alsa,ALSA,audio,,+alsa-lib))
+$(eval $(call GstBuildPlugin,app,app,app,,))
+$(eval $(call GstBuildPlugin,audioconvert,audio format conversion,audio,,))
+$(eval $(call GstBuildPlugin,audiorate,audio rate adjusting,,,))
+$(eval $(call GstBuildPlugin,audioresample,audio resampling,,,))
+$(eval $(call GstBuildPlugin,audiotestsrc,audio test,controller,,))
+$(eval $(call GstBuildPlugin,decodebin,media decoder,pbutils,,))
+$(eval $(call GstBuildPlugin,decodebin2,media decoder (v2),pbutils,,))
+$(eval $(call GstBuildPlugin,gio,GIO,,,))
+$(eval $(call GstBuildPlugin,ogg,Ogg,riff tag,,+libogg))
+$(eval $(call GstBuildPlugin,playbin,playback,video interfaces pbutils,,))
+$(eval $(call GstBuildPlugin,tcp,TCP,dataprotocol,,))
+$(eval $(call GstBuildPlugin,theora,Theora,video tag,ogg,+libtheora))
+$(eval $(call GstBuildPlugin,typefindfunctions,'typefind' functions,pbutils,,))
+$(eval $(call GstBuildPlugin,videotestsrc,video test,,,+liboil))
+$(eval $(call GstBuildPlugin,volume,volume,audio controller,,+liboil))
+$(eval $(call GstBuildPlugin,vorbis,Vorbis,audio tag,ogg,+libvorbis))
+
+$(eval $(call BuildPackage,gst-plugins-base))
diff --git a/multimedia/gst-plugins-base/patches/001-no_docs.patch b/multimedia/gst-plugins-base/patches/001-no_docs.patch
new file mode 100644 (file)
index 0000000..855076b
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -12,14 +12,12 @@ SUBDIRS =                  \
+       gst sys $(SUBDIRS_EXT)  \
+       tools                   \
+       tests                   \
+-      docs                    \
+       po                      \
+       common                  \
+       m4
+ DIST_SUBDIRS =                        \
+       pkgconfig               \
+-      docs                    \
+       gst-libs                \
+       gst sys ext             \
+       tools                   \
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -464,14 +464,12 @@ SUBDIRS = \
+       gst sys $(SUBDIRS_EXT)  \
+       tools                   \
+       tests                   \
+-      docs                    \
+       po                      \
+       common                  \
+       m4
+ DIST_SUBDIRS = \
+       pkgconfig               \
+-      docs                    \
+       gst-libs                \
+       gst sys ext             \
+       tools                   \
diff --git a/multimedia/gst-plugins-base/patches/002-no_tests.patch b/multimedia/gst-plugins-base/patches/002-no_tests.patch
new file mode 100644 (file)
index 0000000..2874dd1
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -11,7 +11,6 @@ SUBDIRS =                    \
+       gst-libs                \
+       gst sys $(SUBDIRS_EXT)  \
+       tools                   \
+-      tests                   \
+       po                      \
+       common                  \
+       m4
+@@ -21,7 +20,6 @@ DIST_SUBDIRS =                       \
+       gst-libs                \
+       gst sys ext             \
+       tools                   \
+-      tests                   \
+       po                      \
+       common                  \
+       m4
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -463,7 +463,6 @@ SUBDIRS = \
+       gst-libs                \
+       gst sys $(SUBDIRS_EXT)  \
+       tools                   \
+-      tests                   \
+       po                      \
+       common                  \
+       m4
+@@ -473,7 +472,6 @@ DIST_SUBDIRS = \
+       gst-libs                \
+       gst sys ext             \
+       tools                   \
+-      tests                   \
+       po                      \
+       common                  \
+       m4
diff --git a/multimedia/gst-plugins-base/patches/003-no_translations.patch b/multimedia/gst-plugins-base/patches/003-no_translations.patch
new file mode 100644 (file)
index 0000000..fd81058
--- /dev/null
@@ -0,0 +1,46 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -1031,7 +1031,6 @@ docs/design/Makefile
+ docs/libs/Makefile
+ docs/plugins/Makefile
+ docs/version.entities
+-po/Makefile.in
+ common/Makefile
+ common/m4/Makefile
+ m4/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -11,7 +11,6 @@ SUBDIRS =                    \
+       gst-libs                \
+       gst sys $(SUBDIRS_EXT)  \
+       tools                   \
+-      po                      \
+       common                  \
+       m4
+@@ -20,7 +19,6 @@ DIST_SUBDIRS =                       \
+       gst-libs                \
+       gst sys ext             \
+       tools                   \
+-      po                      \
+       common                  \
+       m4
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -463,7 +463,6 @@ SUBDIRS = \
+       gst-libs                \
+       gst sys $(SUBDIRS_EXT)  \
+       tools                   \
+-      po                      \
+       common                  \
+       m4
+@@ -472,7 +471,6 @@ DIST_SUBDIRS = \
+       gst-libs                \
+       gst sys ext             \
+       tools                   \
+-      po                      \
+       common                  \
+       m4
diff --git a/multimedia/gst-plugins-base/patches/004-vorbisdec-support_modern_Tremor_versions.patch b/multimedia/gst-plugins-base/patches/004-vorbisdec-support_modern_Tremor_versions.patch
new file mode 100644 (file)
index 0000000..1f82998
--- /dev/null
@@ -0,0 +1,131 @@
+From 787e896bdeb6c67d13a918ec55d3826fa010fb90 Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <jacmet@sunsite.dk>
+Date: Wed, 25 Jan 2012 22:53:04 +0000
+Subject: vorbisdec: support modern Tremor versions
+
+Tremor changed to use standard libogg rather than its own incompatible
+copy back in Aug 2010 (r17375), causing gst-plugin-base build to fail.
+
+Tremolo so far unfortunately hasn't been updated. Restructure
+vorbisdeclib.h so the int/float logic is seperate from the ogg handling,
+and only use the legacy _ogg_packet_wrapper code for Tremolo.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=668726
+---
+(limited to 'ext/vorbis/gstvorbisdeclib.h')
+
+--- a/ext/vorbis/gstvorbisdeclib.h
++++ b/ext/vorbis/gstvorbisdeclib.h
+@@ -29,11 +29,6 @@
+ #ifndef TREMOR
+-#include <vorbis/codec.h>
+-
+-typedef float                          vorbis_sample_t;
+-typedef ogg_packet                     ogg_packet_wrapper;
+-
+ #define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to float audio"
+ #define GST_VORBIS_DEC_SRC_CAPS \
+@@ -47,6 +42,42 @@ typedef ogg_packet                     o
+ #define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstVorbisDec
++#else /* TREMOR */
++
++#define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to integer audio"
++
++#define GST_VORBIS_DEC_SRC_CAPS \
++    GST_STATIC_CAPS ("audio/x-raw-int, "   \
++        "rate = (int) [ 1, MAX ], "        \
++        "channels = (int) [ 1, 6 ], "      \
++        "endianness = (int) BYTE_ORDER, "  \
++        "width = (int) { 16, 32 }, "       \
++        "depth = (int) 16, "               \
++        "signed = (boolean) true")
++
++#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH           (16)
++
++/* we need a different type name here */
++#define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstIVorbisDec
++
++/* and still have it compile */
++typedef struct _GstVorbisDec               GstIVorbisDec;
++typedef struct _GstVorbisDecClass          GstIVorbisDecClass;
++
++#endif /* TREMOR */
++
++#ifndef USE_TREMOLO
++
++#ifdef TREMOR
++ #include <tremor/ivorbiscodec.h>
++ typedef ogg_int32_t                    vorbis_sample_t;
++#else
++ #include <vorbis/codec.h>
++ typedef float                          vorbis_sample_t;
++#endif
++
++typedef ogg_packet                     ogg_packet_wrapper;
++
+ static inline guint8 *
+ gst_ogg_packet_data (ogg_packet * p)
+ {
+@@ -72,17 +103,11 @@ gst_ogg_packet_from_wrapper (ogg_packet_
+   return packet;
+ }
+-#else
+-
+-#ifdef USE_TREMOLO
+-  #include <Tremolo/ivorbiscodec.h>
+-  #include <Tremolo/codec_internal.h>
+-  typedef ogg_int16_t                    vorbis_sample_t;
+-#else
+-  #include <tremor/ivorbiscodec.h>
+-  typedef ogg_int32_t                    vorbis_sample_t;
+-#endif
++#else /* USE_TREMOLO */
++#include <Tremolo/ivorbiscodec.h>
++#include <Tremolo/codec_internal.h>
++typedef ogg_int16_t                    vorbis_sample_t;
+ typedef struct _ogg_packet_wrapper     ogg_packet_wrapper;
+ struct _ogg_packet_wrapper {
+@@ -91,26 +116,6 @@ struct _ogg_packet_wrapper {
+   ogg_buffer          buf;
+ };
+-#define GST_VORBIS_DEC_DESCRIPTION "decode raw vorbis streams to integer audio"
+-
+-#define GST_VORBIS_DEC_SRC_CAPS \
+-    GST_STATIC_CAPS ("audio/x-raw-int, "   \
+-        "rate = (int) [ 1, MAX ], "        \
+-        "channels = (int) [ 1, 6 ], "      \
+-        "endianness = (int) BYTE_ORDER, "  \
+-        "width = (int) { 16, 32 }, "       \
+-        "depth = (int) 16, "               \
+-        "signed = (boolean) true")
+-
+-#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH           (16)
+-
+-/* we need a different type name here */
+-#define GST_VORBIS_DEC_GLIB_TYPE_NAME      GstIVorbisDec
+-
+-/* and still have it compile */
+-typedef struct _GstVorbisDec               GstIVorbisDec;
+-typedef struct _GstVorbisDecClass          GstIVorbisDecClass;
+-
+ /* compensate minor variation */
+ #define vorbis_synthesis(a, b)             vorbis_synthesis (a, b, 1)
+@@ -154,7 +159,7 @@ gst_ogg_packet_from_wrapper (ogg_packet_
+   return &(packet->packet);
+ }
+-#endif
++#endif /* USE_TREMOLO */
+ typedef void (*CopySampleFunc)(vorbis_sample_t *out, vorbis_sample_t **in,
+                            guint samples, gint channels, gint width);
diff --git a/multimedia/gst-plugins-good/Makefile b/multimedia/gst-plugins-good/Makefile
new file mode 100644 (file)
index 0000000..cab463f
--- /dev/null
@@ -0,0 +1,175 @@
+#
+# Copyright (C) 2009-2012 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:=gst-plugins-good
+PKG_VERSION:=0.10.31
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-good/
+PKG_MD5SUM:=
+
+PKG_BUILD_DEPENDS:= gstreamer gst-plugins-base liboil
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gstreamer/Default
+  CATEGORY:=Multimedia
+  SECTION:=multimedia
+  TITLE:=GStreamer
+  URL:=http://gstreamer.freedesktop.org/
+endef
+
+define Package/gstreamer/description/Default
+ GStreamer open source multimedia framework
+endef
+
+
+define Package/gst-plugins-good
+$(call Package/gstreamer/Default)
+  TITLE+= plugins collection (good)
+  DEPENDS+= $(GST_DEPENDS)
+endef
+
+define Package/gts-plugins-good/description
+$(call Package/gstreamer/description/Default)
+ .
+ This meta package contains only dependencies to the other plugins from
+ the good plugins collection.
+endef
+
+
+GST_VERSION:=0.10
+
+CONFIGURE_ARGS += \
+       --disable-examples \
+       \
+       --disable-aalib \
+       --disable-alpha \
+       --disable-annodex \
+       --disable-apetag \
+       --disable-auparse \
+       --disable-avi \
+       --disable-bz2 \
+       --disable-cairo \
+       --disable-directsound \
+       --disable-dv1394 \
+       --disable-effectv \
+       --disable-esd \
+       --disable-flv \
+       --disable-flx \
+       --disable-gconf \
+       --disable-gconftool \
+       --disable-gdk_pixbuf \
+       --disable-goom \
+       --disable-goom2k1 \
+       --disable-gst_v4l2 \
+       --disable-hal \
+       --disable-jpeg \
+       --disable-law \
+       --disable-libcaca \
+       --disable-libdv \
+       --disable-libpng \
+       --disable-matroska \
+       --disable-monoscope \
+       --disable-osx_audio \
+       --disable-osx_video \
+       --disable-pulse \
+       --disable-qtdemux \
+       --disable-rtspmanager \
+       --disable-smpte \
+       --disable-shout2 \
+       --disable-speex \
+       --disable-sunaudio \
+       --disable-taglib \
+       --disable-videobox \
+       --disable-videocrop \
+       --disable-videofilter \
+       --disable-videomixer \
+       --disable-wavpack \
+       --disable-x \
+       --disable-xshm \
+       --disable-xvideo \
+       --disable-y4m \
+       --disable-zlib \
+       \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+       --without-x \
+
+EXTRA_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+
+
+define Package/gst-plugins-good/install
+       /bin/true
+endef
+
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other gstreamer plugins (short name)
+# 5: dependencies on other packages
+define GstBuildPlugin
+
+  GST_DEPENDS += +gst-mod-$(1)
+
+  define Package/gst-mod-$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) plugin (good)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $$(foreach p,$(4),+gst-mod-$$(p)) $(5)
+  endef
+
+  define Package/gst-mod-$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) plugin.
+  endef
+
+  define Package/gst-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \
+               $$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,gst-mod-$(1)))
+endef
+
+$(eval $(call GstBuildPlugin,audiofx,audio effects,audio fft controller,,))
+$(eval $(call GstBuildPlugin,autodetect,format auto-detection,,,))
+$(eval $(call GstBuildPlugin,audioparsers,audio parsers,audio tag,,))
+$(eval $(call GstBuildPlugin,cutter,audio cutter,audio,,))
+$(eval $(call GstBuildPlugin,debug,debugging,,,))
+$(eval $(call GstBuildPlugin,equalizer,audio equalizer,audio controller,,))
+$(eval $(call GstBuildPlugin,flac,FLAC codec,audio pbutils tag,,+libflac))
+$(eval $(call GstBuildPlugin,id3demux,ID3v1/v2 demuxer,pbutils tag,,))
+$(eval $(call GstBuildPlugin,icydemux,icy demuxer,audio tag,,))
+$(eval $(call GstBuildPlugin,interleave,audio interleave,audio,,))
+$(eval $(call GstBuildPlugin,isomp4,isomp4,riff rtp tag pbutils audio,,))
+$(eval $(call GstBuildPlugin,level,audio level,audio,,))
+$(eval $(call GstBuildPlugin,multifile,multiple files access,video,,))
+$(eval $(call GstBuildPlugin,multipart,multipart stream handling,,,))
+$(eval $(call GstBuildPlugin,ossaudio,OSS audio support,audio interfaces,,))
+$(eval $(call GstBuildPlugin,replaygain,volume normalization,pbutils,,))
+$(eval $(call GstBuildPlugin,rtp,RTP,audio rtp tag pbutils,,))
+$(eval $(call GstBuildPlugin,rtsp,RTSP,interfaces rtp rtsp sdp,,))
+$(eval $(call GstBuildPlugin,souphttpsrc,soup input,tag,,+libsoup))
+$(eval $(call GstBuildPlugin,spectrum,spectrum data output,audio fft,,))
+$(eval $(call GstBuildPlugin,udp,UDP,netbuffer,,))
+$(eval $(call GstBuildPlugin,wavenc,Wav encoder,riff,,))
+$(eval $(call GstBuildPlugin,wavparse,Wav parser,audio riff tag,,))
+
+$(eval $(call BuildPackage,gst-plugins-good))
diff --git a/multimedia/gst-plugins-good/patches/001-no_docs.patch b/multimedia/gst-plugins-good/patches/001-no_docs.patch
new file mode 100644 (file)
index 0000000..9a7f60b
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -9,7 +9,6 @@ endif
+ ALWAYS_SUBDIRS =              \
+       gst sys ext             \
+       tests                   \
+-      docs                    \
+       po                      \
+       common                  \
+       m4                      \
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -476,7 +476,6 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk
+ ALWAYS_SUBDIRS = \
+       gst sys ext             \
+       tests                   \
+-      docs                    \
+       po                      \
+       common                  \
+       m4                      \
diff --git a/multimedia/gst-plugins-good/patches/002-no_tests.patch b/multimedia/gst-plugins-good/patches/002-no_tests.patch
new file mode 100644 (file)
index 0000000..2b67186
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -8,7 +8,6 @@ endif
+ ALWAYS_SUBDIRS =              \
+       gst sys ext             \
+-      tests                   \
+       po                      \
+       common                  \
+       m4                      \
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -475,7 +475,6 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk
+ @USE_GCONFTOOL_TRUE@GCONF_DIR = gconf
+ ALWAYS_SUBDIRS = \
+       gst sys ext             \
+-      tests                   \
+       po                      \
+       common                  \
+       m4                      \
diff --git a/multimedia/gst-plugins-good/patches/003-no_translations.patch b/multimedia/gst-plugins-good/patches/003-no_translations.patch
new file mode 100644 (file)
index 0000000..453f6f1
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -1147,7 +1147,6 @@ sys/sunaudio/Makefile
+ sys/v4l2/Makefile
+ sys/waveform/Makefile
+ sys/ximage/Makefile
+-po/Makefile.in
+ tests/Makefile
+ tests/check/Makefile
+ tests/examples/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -8,7 +8,6 @@ endif
+ ALWAYS_SUBDIRS =              \
+       gst sys ext             \
+-      po                      \
+       common                  \
+       m4                      \
+       pkgconfig
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -475,7 +475,6 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk
+ @USE_GCONFTOOL_TRUE@GCONF_DIR = gconf
+ ALWAYS_SUBDIRS = \
+       gst sys ext             \
+-      po                      \
+       common                  \
+       m4                      \
+       pkgconfig
diff --git a/multimedia/gst-plugins-ugly/Makefile b/multimedia/gst-plugins-ugly/Makefile
new file mode 100644 (file)
index 0000000..e1b5847
--- /dev/null
@@ -0,0 +1,133 @@
+#
+# Copyright (C) 2009-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:=gst-plugins-ugly
+PKG_VERSION:=0.10.19
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-ugly/
+PKG_MD5SUM:=ba26045c8c8c91f0d48d327ccf53ac0c
+
+PKG_BUILD_DEPENDS:= gstreamer gst-plugins-base liboil
+PKG_CONFIG_Dba26045c8c8c91f0d48d327ccf53ac0cEPENDS:= \
+       CONFIG_PACKAGE_gst-mod-asf \
+       CONFIG_PACKAGE_gst-mod-lame \
+       CONFIG_PACKAGE_gst-mod-mad \
+       CONFIG_PACKAGE_gst-mod-mpeg2dec \
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gstreamer/Default
+  CATEGORY:=Multimedia
+  SECTION:=multimedia
+  TITLE:=GStreamer
+  URL:=http://gstreamer.freedesktop.org/
+endef
+
+define Package/gstreamer/description/Default
+ GStreamer open source multimedia framework
+endef
+
+
+define Package/gst-plugins-ugly
+$(call Package/gstreamer/Default)
+  TITLE+= plugins collection (ugly)
+  DEPENDS+= $(GST_DEPENDS)
+endef
+
+define Package/gts-plugins-ugly/description
+$(call Package/gstreamer/description/Default)
+ .
+ This meta package contains only dependencies to the other plugins from
+ the ugly plugins collection.
+endef
+
+
+GST_COND_SELECT = $(patsubst %,$(if $(CONFIG_PACKAGE_gst-mod-$(1)),--enable,--disable)-%,$(1))
+
+GST_VERSION:=0.10
+
+CONFIGURE_ARGS += \
+       --disable-examples \
+       \
+       --disable-a52dec \
+       --disable-amrnb \
+       --disable-amrwb \
+       $(call GST_COND_SELECT,asf) \
+       --disable-cdio \
+       --disable-dvdlpcmdec \
+       --disable-dvdread \
+       --disable-dvdsub \
+       --disable-iec958 \
+       $(call GST_COND_SELECT,lame) \
+       $(call GST_COND_SELECT,mad) \
+       $(call GST_COND_SELECT,mpeg2dec) \
+       --disable-mpegaudioparse \
+       --disable-mpegstream \
+       --disable-realmedia \
+       --disable-sidplay \
+       --disable-synaesthesia \
+       --disable-twolame \
+       --disable-x264 \
+       \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+
+EXTRA_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+
+
+define Package/gst-plugins-ugly/install
+       /bin/true
+endef
+
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other gstreamer plugins (short name)
+# 5: dependencies on other packages
+define GstBuildPlugin
+
+  GST_DEPENDS += +gst-mod-$(1)
+
+  define Package/gst-mod-$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) plugin (ugly)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $$(foreach p,$(4),+gst-mod-$$(p)) $(5)
+  endef
+
+  define Package/gst-mod-$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) plugin.
+  endef
+
+  define Package/gst-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst$(1).so* \
+               $$(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,gst-mod-$(1)))
+endef
+
+$(eval $(call GstBuildPlugin,asf,ASF demuxer,audio riff rtp rtsp sdp tag,,))
+$(eval $(call GstBuildPlugin,lame,MP3 encoder (using LAME),audio,,+lame-lib))
+$(eval $(call GstBuildPlugin,mad,MP3 decoder (using MAD),audio tag,,+libid3tag +libmad))
+$(eval $(call GstBuildPlugin,mpeg2dec,MPEG decoder,video,,+libmpeg2))
+
+$(eval $(call BuildPackage,gst-plugins-ugly))
diff --git a/multimedia/gst-plugins-ugly/patches/001-no_docs.patch b/multimedia/gst-plugins-ugly/patches/001-no_docs.patch
new file mode 100644 (file)
index 0000000..8bcb83b
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,7 +1,7 @@
+ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+ SUBDIRS = \
+-      gst-libs gst ext docs m4 tests common pkgconfig po
++      gst-libs gst ext m4 tests common pkgconfig po
+ # include before EXTRA_DIST for win32 assignment
+ include $(top_srcdir)/common/win32.mak
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -395,7 +395,7 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+ SUBDIRS = \
+-      gst-libs gst ext docs m4 tests common pkgconfig po
++      gst-libs gst ext m4 tests common pkgconfig po
+ # the MANIFEST contains all win32 related files that should be disted
diff --git a/multimedia/gst-plugins-ugly/patches/002-no_tests.patch b/multimedia/gst-plugins-ugly/patches/002-no_tests.patch
new file mode 100644 (file)
index 0000000..3a830ac
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,7 +1,7 @@
+ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+ SUBDIRS = \
+-      gst-libs gst ext m4 tests common pkgconfig po
++      gst-libs gst ext m4 common pkgconfig po
+ # include before EXTRA_DIST for win32 assignment
+ include $(top_srcdir)/common/win32.mak
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -395,7 +395,7 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+ SUBDIRS = \
+-      gst-libs gst ext m4 tests common pkgconfig po
++      gst-libs gst ext m4 common pkgconfig po
+ # the MANIFEST contains all win32 related files that should be disted
diff --git a/multimedia/gst-plugins-ugly/patches/003-no_translations.patch b/multimedia/gst-plugins-ugly/patches/003-no_translations.patch
new file mode 100644 (file)
index 0000000..71cc5c5
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -495,7 +495,6 @@ docs/version.entities
+ tests/Makefile
+ tests/check/Makefile
+ m4/Makefile
+-po/Makefile.in
+ pkgconfig/Makefile
+ pkgconfig/gstreamer-plugins-ugly-uninstalled.pc
+ gst-plugins-ugly.spec
+ )
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,7 +1,7 @@
+ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+ SUBDIRS = \
+-      gst-libs gst ext m4 common pkgconfig po
++      gst-libs gst ext m4 common pkgconfig
+ # include before EXTRA_DIST for win32 assignment
+ include $(top_srcdir)/common/win32.mak
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -395,7 +395,7 @@ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+ SUBDIRS = \
+-      gst-libs gst ext m4 common pkgconfig po
++      gst-libs gst ext m4 common pkgconfig
+ # the MANIFEST contains all win32 related files that should be disted
diff --git a/multimedia/gstreamer/Makefile b/multimedia/gstreamer/Makefile
new file mode 100644 (file)
index 0000000..d11e9f6
--- /dev/null
@@ -0,0 +1,192 @@
+#
+# Copyright (C) 2008-2013 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:=gstreamer
+PKG_VERSION:=0.10.36
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gstreamer/
+PKG_MD5SUM:=a0cf7d6877f694a1a2ad2b4d1ecb890b
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gstreamer/Default
+  CATEGORY:=Multimedia
+  SECTION:=multimedia
+  TITLE:=GStreamer
+  URL:=http://gstreamer.freedesktop.org/
+endef
+
+define Package/gstreamer/description/Default
+ GStreamer open source multimedia framework
+endef
+
+
+define Package/gstreamer
+$(call Package/gstreamer/Default)
+  TITLE+= framework
+  DEPENDS+= +libgstreamer \
+       +libgstcheck \
+       +libgstcontroller \
+       +libgstdataprotocol \
+       +libgstnet
+endef
+
+define Package/gstreamer/description
+$(call Package/gstreamer/description/Default)
+ .
+ This meta package contains only dependencies on the other GStreamer
+ componenents.
+endef
+
+
+define Package/gstreamer-utils
+$(call Package/gstreamer/Default)
+  TITLE+= utilities
+  DEPENDS+= +libgstreamer
+endef
+
+define Package/gstreamer-utils/description
+$(call Package/gstreamer/description/Default)
+ .
+ This package contains the GStreamer utilities.
+endef
+
+
+define Package/libgstreamer
+$(call Package/gstreamer/Default)
+  TITLE+= library (core)
+  DEPENDS+= +glib2 +libpthread +libxml2
+endef
+
+define Package/libgstreamer/description
+$(call Package/gstreamer/description/Default)
+ .
+ This package contains the GStreamer core library.
+endef
+
+
+GST_VERSION:=0.10
+
+CONFIGURE_ARGS += \
+       --disable-examples \
+       --disable-tests \
+       --disable-valgrind \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+       --without-x \
+
+EXTRA_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+       -L$(ICONV_PREFIX)/lib -L$(INTL_PREFIX)/lib
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/include/gstreamer-$(GST_VERSION)/* \
+               $(1)/usr/include/gstreamer-$(GST_VERSION)/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libgst*-$(GST_VERSION).{a,la,so*} \
+               $(1)/usr/lib/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst*.{la,so} \
+               $(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/pkgconfig/gstreamer*-$(GST_VERSION).pc \
+               $(1)/usr/lib/pkgconfig/ \
+       )
+       $(INSTALL_DIR) $(2)/share/aclocal
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/share/aclocal/* \
+               $(2)/share/aclocal/ \
+       )
+endef
+
+define Package/gstreamer/install
+       /bin/true
+endef
+
+define Package/gstreamer-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/bin/gst-feedback* \
+               ./usr/bin/gst-launch* \
+               ./usr/bin/gst-inspect* \
+               ./usr/bin/gst-typefind* \
+               ./usr/bin/gst-xmlinspect* \
+               ./usr/bin/gst-xmllaunch* \
+               $(1)/usr/bin/ \
+       )
+endef
+
+define Package/libgstreamer/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libgstbase-$(GST_VERSION).so.* \
+               ./usr/lib/libgstreamer-$(GST_VERSION).so.* \
+               $(1)/usr/lib/ \
+       )
+       $(INSTALL_DIR) $(1)/usr/lib/gstreamer-$(GST_VERSION)
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/gstreamer-$(GST_VERSION)/libgst*.so \
+               $(1)/usr/lib/gstreamer-$(GST_VERSION)/ \
+       )
+endef
+
+
+# 1: short name
+# 2: description
+# 3: dependencies on other gstreamer libraries (short name)
+# 4: dependencies on other packages
+define GstBuildLibrary
+
+  define Package/libgst$(1)
+    $(call Package/gstreamer/Default)
+    TITLE+= $(2) library (core)
+    DEPENDS+= +libgstreamer $$(foreach p,$(3),+libgst$$(p)) $(4)
+  endef
+
+  define Package/libgst$(1)/description
+   $(call Package/gstreamer/description/Default)
+   .
+   This package contains the GStreamer $(2) library.
+  endef
+
+  define Package/libgst$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib
+       ( cd $(PKG_INSTALL_DIR); $(CP) \
+               ./usr/lib/libgst$(1)-$(GST_VERSION).so.* \
+               $$(1)/usr/lib/ \
+       )
+  endef
+
+  $$(eval $$(call BuildPackage,libgst$(1)))
+endef
+
+$(eval $(call GstBuildLibrary,check,check unit testing))
+$(eval $(call GstBuildLibrary,controller,dynamic parameter control))
+$(eval $(call GstBuildLibrary,dataprotocol,data protocol))
+$(eval $(call GstBuildLibrary,net,network classes))
+
+$(eval $(call BuildPackage,gstreamer))
+$(eval $(call BuildPackage,gstreamer-utils))
+$(eval $(call BuildPackage,libgstreamer))
diff --git a/multimedia/gstreamer/patches/001-no_docs.patch b/multimedia/gstreamer/patches/001-no_docs.patch
new file mode 100644 (file)
index 0000000..3b7f017
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -8,7 +8,6 @@ aclocal_DATA = gst-element-check-@GST_MA
+ SUBDIRS = pkgconfig \
+       gst libs plugins tools tests \
+-      docs \
+       po \
+       m4 \
+       common
+@@ -16,7 +15,6 @@ SUBDIRS = pkgconfig \
+ # These are all the possible subdirs
+ DIST_SUBDIRS = pkgconfig \
+       gst libs plugins tools tests \
+-      docs \
+       po \
+       m4 \
+       common
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -469,7 +469,6 @@ aclocaldir = $(datadir)/aclocal
+ aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
+ SUBDIRS = pkgconfig \
+       gst libs plugins tools tests \
+-      docs \
+       po \
+       m4 \
+       common
+@@ -478,7 +477,6 @@ SUBDIRS = pkgconfig \
+ # These are all the possible subdirs
+ DIST_SUBDIRS = pkgconfig \
+       gst libs plugins tools tests \
+-      docs \
+       po \
+       m4 \
+       common
diff --git a/multimedia/gstreamer/patches/002-no_tests.patch b/multimedia/gstreamer/patches/002-no_tests.patch
new file mode 100644 (file)
index 0000000..7561f73
--- /dev/null
@@ -0,0 +1,39 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -7,14 +7,14 @@ aclocaldir = $(datadir)/aclocal
+ aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
+ SUBDIRS = pkgconfig \
+-      gst libs plugins tools tests \
++      gst libs plugins tools \
+       po \
+       m4 \
+       common
+ # These are all the possible subdirs
+ DIST_SUBDIRS = pkgconfig \
+-      gst libs plugins tools tests \
++      gst libs plugins tools \
+       po \
+       m4 \
+       common
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -468,7 +468,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk
+ aclocaldir = $(datadir)/aclocal
+ aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
+ SUBDIRS = pkgconfig \
+-      gst libs plugins tools tests \
++      gst libs plugins tools \
+       po \
+       m4 \
+       common
+@@ -476,7 +476,7 @@ SUBDIRS = pkgconfig \
+ # These are all the possible subdirs
+ DIST_SUBDIRS = pkgconfig \
+-      gst libs plugins tools tests \
++      gst libs plugins tools \
+       po \
+       m4 \
+       common
diff --git a/multimedia/gstreamer/patches/003-no_translations.patch b/multimedia/gstreamer/patches/003-no_translations.patch
new file mode 100644 (file)
index 0000000..1c64167
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -763,7 +763,6 @@ libs/gst/net/Makefile
+ plugins/Makefile
+ plugins/indexers/Makefile
+ plugins/elements/Makefile
+-po/Makefile.in
+ tests/Makefile
+ tests/benchmarks/Makefile
+ tests/check/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -8,14 +8,12 @@ aclocal_DATA = gst-element-check-@GST_MA
+ SUBDIRS = pkgconfig \
+       gst libs plugins tools \
+-      po \
+       m4 \
+       common
+ # These are all the possible subdirs
+ DIST_SUBDIRS = pkgconfig \
+       gst libs plugins tools \
+-      po \
+       m4 \
+       common
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -469,7 +469,6 @@ aclocaldir = $(datadir)/aclocal
+ aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
+ SUBDIRS = pkgconfig \
+       gst libs plugins tools \
+-      po \
+       m4 \
+       common
+@@ -477,7 +476,6 @@ SUBDIRS = pkgconfig \
+ # These are all the possible subdirs
+ DIST_SUBDIRS = pkgconfig \
+       gst libs plugins tools \
+-      po \
+       m4 \
+       common
diff --git a/multimedia/gstreamer/patches/004-add_gst_debug_log2_debug_symbol.patch b/multimedia/gstreamer/patches/004-add_gst_debug_log2_debug_symbol.patch
new file mode 100644 (file)
index 0000000..061ad5b
--- /dev/null
@@ -0,0 +1,42 @@
+--- a/gst/gstinfo.c
++++ b/gst/gstinfo.c
+@@ -462,6 +462,39 @@ gst_debug_log (GstDebugCategory * catego
+   va_end (var_args);
+ }
++typedef struct {
++  const gchar *file;
++  const gchar *function;
++  const gint   line;
++} GstDebugTraceLocation;
++
++
++/**
++ * gst_debug_log2:
++ *  <at> category: category to log
++ *  <at> level: level of the message is in
++ *  <at> location: the file, function name, and line number of the location that
++ *    emitted the message
++ *  <at> object: the object this message relates to or NULL if none
++ *  <at> format: a printf style format string
++ *  <at> ...: optional arguments for the format
++ *
++ * Logs the given message using the currently registered debugging handlers.
++ */
++void
++gst_debug_log2 (GstDebugCategory * category, GstDebugLevel level,
++    const GstDebugTraceLocation * location,
++    GObject * object, const gchar * format, ...)
++{
++#if 0
++  va_list var_args;
++
++  va_start (var_args, format);
++  gst_debug_log_valist2 (category, level, location, object, format, var_args);
++  va_end (var_args);
++#endif
++}
++
+ #ifdef _MSC_VER
+ /* based on g_basename(), which we can't use because it was deprecated */
+ static inline const gchar *
diff --git a/multimedia/gstreamer/patches/005-YYLEX_PARAM_to_lex-param.patch b/multimedia/gstreamer/patches/005-YYLEX_PARAM_to_lex-param.patch
new file mode 100644 (file)
index 0000000..f70f03e
--- /dev/null
@@ -0,0 +1,27 @@
+From 60516f4798894f958fc53b470e1283318d0f8706 Mon Sep 17 00:00:00 2001
+From: Kerrick Staley <kerrick@kerrickstaley.com>
+Date: Wed, 21 Aug 2013 06:59:29 +0000
+Subject: parse: make grammar.y work with Bison 3
+
+YYLEX_PARAM is no longer supported in Bison 3.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=706462
+---
+--- a/gst/parse/grammar.y
++++ b/gst/parse/grammar.y
+@@ -26,7 +26,6 @@
+  */
+ #define YYERROR_VERBOSE 1
+-#define YYLEX_PARAM scanner
+ #define YYENABLE_NLS 0
+@@ -648,6 +647,7 @@ static int yyerror (void *scanner, graph
+ %right '.'
+ %left '!' '='
++%lex-param { void *scanner }
+ %parse-param { void *scanner }
+ %parse-param { graph_t *graph }
+ %pure-parser
diff --git a/multimedia/hasciicam/Makefile b/multimedia/hasciicam/Makefile
new file mode 100644 (file)
index 0000000..a982281
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2009-2010 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:=hasciicam
+PKG_VERSION:=1.1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.dyne.org/hasciicam/releases/
+PKG_MD5SUM:=2c7393270e18ab913043683fa3390d8c
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hasciicam
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=Live ASCII video feeds
+  URL:=http://ascii.dyne.org/
+  DEPENDS:= +libaa +ftplib
+endef
+
+
+CONFIGURE_VARS += \
+       LIBS="-lncurses" \
+
+define Package/hasciicam/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/hasciicam $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,hasciicam))
diff --git a/multimedia/imagemagick/Makefile b/multimedia/imagemagick/Makefile
new file mode 100644 (file)
index 0000000..6b3111b
--- /dev/null
@@ -0,0 +1,159 @@
+#
+# Copyright (C) 2010-2012 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:=imagemagick
+PKG_VERSION:=6.7.8
+PKG_REVISION:=10
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/ImageMagick-$(PKG_VERSION)-$(PKG_REVISION)
+PKG_SOURCE:=ImageMagick-$(PKG_VERSION)-$(PKG_REVISION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.fifi.org/pub/ImageMagick/
+PKG_MD5SUM:=c66bea4710370b2e115aed512fbe4601
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 m4/libtool.m4
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/imagemagick/Default
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=imagemagick
+  URL:=http://image_magick.veidrodis.com/
+endef
+
+define Package/imagemagick
+  $(call Package/imagemagick/Default)
+  DEPENDS:=+libpthread +libltdl +libjpeg +libtiff +zlib
+endef
+
+define Package/imagemagick/description
+  An image manipulation library.
+endef
+
+define Package/imagemagick-jpeg
+  $(call Package/imagemagick/Default)
+  TITLE+= (jpeg)
+  DEPENDS:=+imagemagick
+endef
+
+define Package/imagemagick-jpeg/description
+  imagemagick JPEG module
+endef
+
+define Package/imagemagick-png
+  $(call Package/imagemagick/Default)
+  TITLE+= (png)
+  DEPENDS:=+imagemagick +libpng
+endef
+
+define Package/imagemagick-png/description
+  imagemagick PNG module
+endef
+
+define Package/imagemagick-tools
+  $(call Package/imagemagick/Default)
+  TITLE+= (tools)
+  DEPENDS:=+imagemagick
+endef
+
+define Package/imagemagick-png/description
+  imagemagick tools (mogrify,convert)
+endef
+
+define Package/imagemagick-tiff
+  $(call Package/imagemagick/Default)
+  TITLE+= (tiff)
+  DEPENDS:=+imagemagick
+endef
+
+define Package/imagemagick-tiff/description
+  imagemagick TIFF module
+endef
+
+
+CONFIGURE_ARGS += \
+       --with-modules \
+       --enable-shared \
+       --enable-static \
+       --without-pango \
+       --without-bzlib \
+       --without-freetype \
+       --without-fontconfig \
+       --without-rsvg \
+       --without-fftw \
+       --without-xml \
+       --without-x \
+       --without-magick-plus-plus \
+       --without-lzma
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -I$(PKG_BUILD_DIR)/include/linux -I$(PKG_BUILD_DIR)/include"
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/magick
+       $(INSTALL_DIR) $(1)/usr/include/wand
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/* \
+               $(1)/usr/include/
+
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/imagemagick/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/imagemagick-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin/mogrify \
+               $(1)/usr/bin/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin/convert \
+               $(1)/usr/bin/
+endef
+
+define BuildPlugin
+  define Package/imagemagick-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/ImageMagick-$(PKG_VERSION)/modules-Q16/coders
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ImageMagick-$(PKG_VERSION)/modules-Q16/coders/$(1).so \
+               $$(1)/usr/lib/ImageMagick-$(PKG_VERSION)/modules-Q16/coders
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ImageMagick-$(PKG_VERSION)/modules-Q16/coders/$(1).la \
+               $$(1)/usr/lib/ImageMagick-$(PKG_VERSION)/modules-Q16/coders
+  endef
+
+  $$(eval $$(call BuildPackage,imagemagick-$(1)))
+endef
+
+$(eval $(call BuildPackage,imagemagick))
+$(eval $(call BuildPackage,imagemagick-tools))
+$(eval $(call BuildPlugin,jpeg))
+$(eval $(call BuildPlugin,png))
+$(eval $(call BuildPlugin,tiff))
+
diff --git a/multimedia/kissdx/Makefile b/multimedia/kissdx/Makefile
new file mode 100644 (file)
index 0000000..1b787db
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2009-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:=kissdx
+PKG_REV:=193
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=3
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://www.famille-kahn.com/svn/kissdx/kissdx/trunk
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/kissdx
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=+libjpeg +libdvdread $(ICONV_DEPENDS)
+  TITLE:=PC-Link clone for KiSS media players
+  URL:=http://kissdx.vidartysse.net
+endef
+
+define Package/kissdx/description
+       kissdx is a PC-Link clone for KiSS media players, based for
+       the most part on kissd (which it now replaces), with added
+       features for media playback, management, flexibility and more.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) -DLinux -DUSE_INTERNAL_SENDFILE -std=gnu99 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DFILE_OFFSET_BITS=64 -D_GNU_SOURCE -I$(ICONV_PREFIX)/include -I$(STAGING_DIR)/usr/include/dvdread $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS) -L$(ICONV_PREFIX)/lib" \
+               LDFLAGS="-L$(ICONV_PREFIX)/lib $(TARGET_LDFLAGS)" \
+               STRIP=$(STRIP) \
+               IconvExternal=defined \
+               CC="$(TARGET_CROSS)gcc" all
+endef
+
+define Package/kissdx/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kissdx $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/kissdx.config $(1)/etc/config/kissdx
+       $(INSTALL_BIN) ./files/kissdx.init $(1)/etc/init.d/kissdx
+endef
+
+define Package/kissdx/conffiles
+/etc/config/kissdx
+endef
+
+$(eval $(call BuildPackage,kissdx))
diff --git a/multimedia/kissdx/files/kissdx.config b/multimedia/kissdx/files/kissdx.config
new file mode 100644 (file)
index 0000000..5cd2b17
--- /dev/null
@@ -0,0 +1,34 @@
+config 'kissdx' 'server'
+       option 'signature' 'kissdx {Version} ({VersionDate}) @ {ShortHostName} {ConfigReloadStatus}'
+       option 'pidfile' '/var/run/kissdx.pid'
+       option 'characterset' 'ISO-8859-1'
+       option 'picturetargetwidth' '1280'
+       option 'picturetargetheight' '720'
+       option 'picturemaxzoompercent' '20'
+       option 'enablehiddenfilestext' 'Show it all'
+       option 'enablehiddenfilesminutes' '5'
+       option 'listhiddenentries' 'no'
+       option 'displaysequencenumbers' 'no'
+       option 'loglevel' '4'
+       
+config 'kissdx' 'paths'
+       option 'audio' '/mnt/music'
+       option 'video' '/mnt/movies'
+       option 'picture' '/mnt/photos'
+
+config 'kissdx' 'files'
+       option 'audio' 'mp3,ogg,wma,wav'
+       option 'video' 'mpg,mpeg,vob,avi,wmv,ts,mp4,divx'
+       option 'picture' 'jpg,jpeg,png,bmp'
+       option 'iso' 'iso,img'
+       option 'renamefiletypes' 'ts:mpg,wav:mp3'
+
+config 'kissdx' 'subtitles'
+       option 'filemapping' '*:{name}*.*'
+
+config 'kissdx' 'recentfiles'
+       option 'foldername' '[Recently played]'
+       option 'max' '30'
+
+config 'kissdx' 'kml'
+       option 'forwardurl' 'http://tinystocks.com/k/kiss.php'
diff --git a/multimedia/kissdx/files/kissdx.init b/multimedia/kissdx/files/kissdx.init
new file mode 100755 (executable)
index 0000000..9f1a78e
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+
+START=65
+
+SERVICE_USE_PID=1
+
+CFGFILE=/tmp/kissdx.conf
+
+create_configfile() {
+       local signature pidfile characterset \
+               picturetargetwidth picturetargetheight picturemaxzoompercent \
+               enablehiddenfilestext enablehiddenfilesminutes \
+               listhiddenentries displaysequencenumbers loglevel
+       local path_audio path_video path_picture
+       local files_audio files_video files_picture files_iso files_renamefiletypes
+       local subtitles_filemapping
+       local recentfiles_foldername recentfiles_max
+       local kml_forwardurl
+
+       echo '### AUTOGENERATED CONFIGURATION FILE - DO NOT EDIT ###' > $CFGFILE
+       echo '### Edit /etc/config/kissdx to make changes to setup ###' >> $CFGFILE
+       echo '' >> $CFGFILE
+
+       config_get signature server signature
+       config_get pidfile server pidfile
+       config_get characterset server characterset
+       config_get picturetargetwidth server picturetargetwidth
+       config_get picturetargetheight server picturetargetheight
+       config_get picturemaxzoompercent server picturemaxzoompercent
+       config_get enablehiddenfilestext server enablehiddenfilestext
+       config_get enablehiddenfilesminutes server enablehiddenfilesminutes
+       config_get listhiddenentries server listhiddenentries
+       config_get displaysequencenumbers server displaysequencenumbers
+       config_get loglevel server loglevel
+
+       config_get path_audio paths audio
+       config_get path_video paths video
+       config_get path_picture paths picture
+
+       config_get files_audio files audio
+       config_get files_video files video
+       config_get files_picture files picture
+       config_get files_iso files iso
+       config_get files_renamefiletypes files renamefiletypes
+
+       config_get subtitles_filemapping subtitles filemapping
+
+       config_get recentfiles_foldername recentfiles foldername
+       config_get recentfiles_max recentfiles max
+
+       config_get kml_forwardurl kml forwardurl
+
+       echo 'serversignature           = ' $signature >> $CFGFILE
+       echo '#listenaddress            = 192.168.1.2' >> $CFGFILE
+       echo '#networktimeoutinterval   = 3600' >> $CFGFILE
+       echo '#adminserver_port = 8003' >> $CFGFILE
+       echo 'configautoload            = no' >> $CFGFILE
+       echo '#dvdaccessmethod  = libdvdnav' >> $CFGFILE
+       echo 'pidfilepath               = ' $pidfile >> $CFGFILE
+       echo '#persistentstoragepath    = /tmp/kissdx' >> $CFGFILE
+       echo '#server_character_set     = CP850' >> $CFGFILE
+       echo '#client_character_set     = ISO-8859-1' >> $CFGFILE
+       echo 'config_character_set      = ' $characterset >> $CFGFILE
+       echo 'playlist_character_set    = ' $characterset >> $CFGFILE
+       echo 'displaysequencenumbers    = ' $displaysequencenumbers >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo '# 0 = caching disabled, -1 = no limit or amount of pictures in cache' >> $CFGFILE
+       echo 'picturecachesize  = 0' >> $CFGFILE
+       echo '#picturecachetrimminginterval = 10' >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'audiopath         = ' $path_audio >> $CFGFILE
+       echo 'videopath         = ' $path_video >>  $CFGFILE
+       echo 'picturepath               = ' $path_picture >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'audiofileextensions       = ' $files_audio >> $CFGFILE
+       echo 'videofileextensions       = ' $files_video >> $CFGFILE
+       echo 'picturefileextensions     = ' $files_picture >> $CFGFILE
+       echo 'isofileextensions = ' $files_iso >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'renamefiletypes = ' $files_renamefiletypes >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'listhiddenentries = ' $listhiddenentries >> $CFGFILE
+       echo 'enablehiddenfilestext     = ' $enablehiddenfilestext >> $CFGFILE
+       echo 'enablehiddenfilesminutes = ' $enablehiddenfilesminutes >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'picturetargetwidth        = ' $picturetargetwidth >> $CFGFILE
+       echo 'picturetargetheight       = ' $picturetargetheight >> $CFGFILE
+       echo 'picturemaxzoompercent     = ' $picturemaxzoompercent >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'subtitlefilemapping       = ' $subtitles_filemapping >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'recentlyusedfoldername    = ' $recentfiles_foldername >> $CFGFILE
+       echo 'max_recent_files  = ' $recentfiles_max >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo 'kmlforwardurl             = ' $kml_forwardurl >> $CFGFILE
+       echo '' >> $CFGFILE
+       echo '#pretrigger               = /usr/bin/kissd-pretrigger' >> $CFGFILE
+       echo '#posttrigger              = /usr/bin/kissd-posttrigger' >> $CFGFILE
+       echo '#directorypretrigger      = /usr/bin/kissddirpretrigger' >> $CFGFILE
+       echo '#directoryposttrigger     = /usr/bin/kisdddirposttrigger' >> $CFGFILE     
+       echo '#Set logging level (1 to 5). 5 means no log. Loglevel can also be' >> $CFGFILE
+       echo '#specified as one of: Error, Warning, Protocol, Information, Debug.' >> $CFGFILE
+       echo 'loglevel                  = ' $loglevel >> $CFGFILE
+}
+
+start () {
+       config_load kissdx
+       create_configfile
+       service_start /usr/bin/kissdx -c $CFGFILE -d
+}
+
+stop() {
+       service_stop /usr/bin/kissdx
+}
diff --git a/multimedia/peercast/Makefile b/multimedia/peercast/Makefile
new file mode 100644 (file)
index 0000000..837b18c
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2006-2010 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:=peercast
+PKG_VERSION:=0.1214
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.cti.ecp.fr/~beauxir5/peercast
+PKG_MD5SUM:=4e8449cde7135ad97f788e67e1bd64ee
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 acinclude.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/peercast
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=+libpthread $(CXX_DEPENDS)
+  TITLE:=P2P audio and video streaming server
+  URL:=http://www.peercast.org/
+endef
+
+define Package/peercast/conffiles
+/etc/peercast.ini
+endef
+
+define Package/peercast/description
+ PeerCast is a fresh new P2P streaming server. It can stream music and
+ video from a broad variety of formats. Many audio players can listen to
+ peercast streams, as it's been built to remain compatible with Nullsoft
+ Shoutcast.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-staticbin \
+
+CONFIGURE_VARS += \
+       LIBS="-lpthread"
+
+TARGET_CFLAGS += -fpermissive
+
+define Package/peercast/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/peercast $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/share/peercast/html
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/peercast/html/en $(1)/usr/share/peercast/html/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/peercast.ini $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/peercast.init $(1)/etc/init.d/peercast
+endef
+
+$(eval $(call BuildPackage,peercast))
diff --git a/multimedia/peercast/files/peercast.ini b/multimedia/peercast/files/peercast.ini
new file mode 100644 (file)
index 0000000..f703c6e
--- /dev/null
@@ -0,0 +1,81 @@
+
+[Server]
+serverPort = 7144
+autoServe = Yes
+forceIP = 
+isRoot = No
+maxBitrateOut = 0
+maxRelays = 1
+maxDirect = 0
+maxRelaysPerChannel = 0
+firewallTimeout = 30
+forceNormal = No
+rootMsg = 
+authType = cookie
+cookiesExpire = session
+htmlPath = html/en
+minPGNUIncoming = 10
+maxPGNUIncoming = 20
+maxServIn = 50
+chanLog = 
+networkID = 00000000000000000000000000000000
+
+[Broadcast]
+broadcastMsgInterval = 10
+broadcastMsg = 
+icyMetaInterval = 8192
+broadcastID = 898145B5C0427118B595AF7D9E110000
+hostUpdateInterval = 180
+maxControlConnections = 3
+rootHost = yp.peercast.org
+
+[Client]
+refreshHTML = 5
+relayBroadcast = 30
+minBroadcastTTL = 1
+maxBroadcastTTL = 7
+pushTries = 5
+pushTimeout = 60
+maxPushHops = 8
+autoQuery = 0
+queryTTL = 7
+
+[Privacy]
+password = hackme
+maxUptime = 0
+
+[Filter]
+ip = 255.255.255.255
+private = No
+ban = No
+network = Yes
+direct = Yes
+[End]
+
+[Notify]
+PeerCast = Yes
+Broadcasters = Yes
+TrackInfo = Yes
+[End]
+
+[Server1]
+allowHTML = Yes
+allowBroadcast = Yes
+allowNetwork = Yes
+allowDirect = Yes
+[End]
+
+[Server2]
+allowHTML = No
+allowBroadcast = Yes
+allowNetwork = No
+allowDirect = No
+[End]
+
+[Debug]
+logDebug = No
+logErrors = No
+logNetwork = No
+logChannel = No
+pauseLog = No
+idleSleepTime = 10
diff --git a/multimedia/peercast/files/peercast.init b/multimedia/peercast/files/peercast.init
new file mode 100644 (file)
index 0000000..033beb0
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+PID_F=/var/run/peercast.pid
+
+start() {
+       peercast -d -i /etc/peercast.ini -l /var/log/peercast.log -p $PID_F
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F) >/dev/null 2>&1
+}
+
diff --git a/multimedia/puppy/Makefile b/multimedia/puppy/Makefile
new file mode 100644 (file)
index 0000000..c17434d
--- /dev/null
@@ -0,0 +1,36 @@
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=puppy
+PKG_VERSION:=1.14
+PKG_RELEASE:=1
+
+PKG_SOURCE:=puppy_$(PKG_VERSION)_src.tar.bz2
+PKG_SOURCE_URL:=@SF/puppy
+PKG_MD5SUM:=a7a53da5b8ba4fdb15e2fc8e1531b82c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/puppy_$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/puppy
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=@USB_SUPPORT
+  TITLE:=Topfield PVR file transfer client
+  URL:=http://puppy.sourceforge.net/
+endef
+
+define Package/puppy/description
+Client to access Topfield PVRs via the USB port
+endef
+
+define Build/Configure
+endef
+
+define Package/puppy/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/puppy $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,puppy))
diff --git a/multimedia/rygel/Makefile b/multimedia/rygel/Makefile
new file mode 100644 (file)
index 0000000..2ed445f
--- /dev/null
@@ -0,0 +1,195 @@
+#
+# Copyright (C) 2006-2012 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:=rygel
+PKG_VERSION:=0.14.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNOME/rygel/0.14/
+PKG_SHA256SUM:=c4f79fb30bc1a062a2ffdadc7a55dd91fa58240302f152fb070d8c674bdddd67
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_DEPENDS:=vala/host intltool/host vala gupnp-vala
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+        -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/rygel/Default
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=GNOME UPnP/DLNA services
+  URL:=http://live.gnome.org/Rygel
+endef
+
+define Package/rygel/description/Default
+ Rygel is a collection of DLNA (UPnP AV) services (devices in UPnP speak),
+ implemented through a plug-in mechanism.
+endef
+
+define Package/rygel
+$(call Package/rygel/Default)
+  DEPENDS:=+libgssdp +libgupnp +libgupnp-av +libgupnp-dlna +libgee \
+    +libsoup +gstreamer +libgstvideo +libgstpbutils
+endef
+
+define Package/rygel/conffiles
+/etc/config/rygel
+endef
+
+define Package/rygel/description
+$(call Package/rygel/description/Default)
+ .
+ This package contains the main rygel binary.
+endef
+
+define RemoveValaStamps
+       find $(PKG_BUILD_DIR) -name "*_vala.stamp" | xargs rm -f
+endef
+
+Hooks/Configure/Pre += RemoveValaStamps
+
+define Build/Configure
+       $(call Build/Configure/Default,--without-ui,)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/rygel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/rygel \
+               $(1)/usr/bin
+
+       $(INSTALL_DIR) $(1)/usr/share/rygel/xml
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/rygel/xml/*.xml \
+               $(1)/usr/share/rygel/xml
+
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) files/etc/rygel.conf $(1)/etc
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) files/etc/init.d/rygel $(1)/etc/init.d/rygel
+
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) files/etc/config/rygel $(1)/etc/config/rygel
+
+       $(INSTALL_DIR) $(1)/usr/share/icons/hicolor/{32x32,48x48,128x128}/apps
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/icons/hicolor/32x32/apps/rygel.png \
+               $(1)/usr/share/icons/hicolor/32x32/apps/rygel.png
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/icons/hicolor/48x48/apps/rygel.png \
+               $(1)/usr/share/icons/hicolor/48x48/apps/rygel.png
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/icons/hicolor/128x128/apps/rygel.png \
+               $(1)/usr/share/icons/hicolor/128x128/apps/rygel.png
+endef
+
+# 1: plugin name as used in shared library filename
+# 2: additional dependencies, if any
+define RygelBuildPlugin
+
+  define Package/rygel-$(1)
+    $(call Package/rygel/Default)
+    TITLE+= - $(1) plugin
+    DEPENDS:=+rygel $(2)
+  endef
+
+  define Package/rygel-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/rygel-1.0
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/rygel-1.0/librygel-$(1).so \
+               $$(1)/usr/lib/rygel-1.0
+  endef
+
+  $$(eval $$(call BuildPackage,rygel-$(1)))
+endef
+
+define Package/rygel-external/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the external plugin, a MediaServer plugin that exports
+  media provided by applications implementing the D-Bus MediaServer interface.
+endef
+$(eval $(call RygelBuildPlugin,external))
+
+define Package/rygel-media-export/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the media-export plugin, a MediaServer plugin that
+  recursively exports files and folders specified in the user configuration.
+endef
+$(eval $(call RygelBuildPlugin,media-export,+libsqlite3 +libgstapp +libgsttag))
+
+define Package/rygel-mpris/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the mpris plugin, a MediaServer plugin that exports
+  media provided by applications implementing the D-Bus MPRIS2 interface.
+endef
+$(eval $(call RygelBuildPlugin,mpris))
+
+define Package/rygel-tracker/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the tracker plugin, a MediaServer plugin that exports
+  media known to Tracker.
+endef
+$(eval $(call RygelBuildPlugin,tracker))
+
+define Package/rygel-playbin/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the playbin plugin, the MediaRenderer plugin.
+endef
+$(eval $(call RygelBuildPlugin,playbin))
+
+define Package/rygel-playbin-gst-suggested/description
+  $(call Package/rygel/description/Default)
+  .
+  This optional metapackage installs a suggested set of gstreamer plugins to
+  support audio playback in rygel-playbin.
+endef
+
+define Package/rygel-playbin-gst-suggested
+  $(call Package/rygel/Default)
+  TITLE:=Suggested GStreamer plugins for rygel-playbin
+  DEPENDS:= \
+    +gst-mod-alsa \
+    +gst-mod-audioconvert \
+    +gst-mod-audioparsers \
+    +gst-mod-audioresample \
+    +gst-mod-autodetect \
+    +gst-mod-decodebin2 \
+    +gst-mod-flac \
+    +gst-mod-icydemux \
+    +gst-mod-id3demux \
+    +gst-mod-isomp4 \
+    +gst-mod-ogg \
+    +gst-mod-playbin \
+    +gst-mod-souphttpsrc \
+    +gst-mod-typefindfunctions \
+    +gst-mod-volume \
+    +gst-mod-vorbis \
+    +BUILD_PATENTED:gst-mod-faad \
+    +BUILD_PATENTED:gst-mod-mad
+endef
+$(eval $(call BuildPackage,rygel-playbin-gst-suggested))
+
+$(eval $(call BuildPackage,rygel))
diff --git a/multimedia/rygel/files/etc/config/rygel b/multimedia/rygel/files/etc/config/rygel
new file mode 100644 (file)
index 0000000..3dd222e
--- /dev/null
@@ -0,0 +1,6 @@
+# This file is converted to the rygel config syntax.
+# Underscores in option names are changed to hyphens.
+
+config plugin Playbin
+       option enabled true
+       option title 'Audio/Video playback on @HOSTNAME@'
diff --git a/multimedia/rygel/files/etc/init.d/rygel b/multimedia/rygel/files/etc/init.d/rygel
new file mode 100755 (executable)
index 0000000..9d1ede4
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+START=90
+STOP=10
+SERVICE_DAEMONIZE=1
+
+cfgfile="/var/run/rygel.conf"
+rm -f $cfgfile
+
+config_cb() {
+       local section="$2"
+       [ -n "$section" ] && echo "[$section]" >> $cfgfile
+}
+
+option_cb() {
+       local name=$(echo "$1" | tr _ -)
+       local value="$2"
+       echo "$name=$value" >> $cfgfile
+}
+
+start() {        
+       config_load rygel
+       service_start /usr/bin/rygel -c $cfgfile
+}                 
+stop() {          
+       service_stop /usr/bin/rygel
+}
diff --git a/multimedia/rygel/files/etc/rygel.conf b/multimedia/rygel/files/etc/rygel.conf
new file mode 100644 (file)
index 0000000..7e86d5a
--- /dev/null
@@ -0,0 +1,9 @@
+# Rygel requires that /etc/rygel.conf exists in order to start properly.
+# This file contains some simple default configuration.
+# Configuration changes should be made in /etc/config/rygel.
+
+[general]
+upnp-enabled=true
+log-level=*:4
+interface=
+port=0
diff --git a/multimedia/rygel/patches/010-conftest-honor-cc.patch b/multimedia/rygel/patches/010-conftest-honor-cc.patch
new file mode 100644 (file)
index 0000000..3eab47c
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/m4/vala.m4
++++ b/m4/vala.m4
+@@ -28,7 +28,12 @@
+ void main(){}
+ _ACEOF
+-  AS_IF([vala_error=`$VALAC $1 -q -o conftest$ac_exeext conftest.vala 2>&1`],
++  unset vala_cc_args
++  for cflag in $CFLAGS $CPPFLAGS $LDFLAGS; do
++    vala_cc_args="${vala_cc_args:+$vala_cc_args }-X $cflag"
++  done
++
++  AS_IF([vala_error=`$VALAC $1 -q $VALAFLAGS --cc $CC $vala_cc_args -o conftest$ac_exeext conftest.vala 2>&1`],
+         [$2], [$3])
+ ])
diff --git a/multimedia/rygel/patches/010-identify-libs-by-suffix.patch b/multimedia/rygel/patches/010-identify-libs-by-suffix.patch
new file mode 100644 (file)
index 0000000..50df4fc
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/src/rygel/rygel-plugin-loader.vala
++++ b/src/rygel/rygel-plugin-loader.vala
+@@ -126,13 +126,12 @@
+         foreach (var info in infos) {
+             var file = dir.get_child (info.get_name ());
+             FileType file_type = info.get_file_type ();
+-            string content_type = info.get_content_type ();
+-            string mime = ContentType.get_mime_type (content_type);
++            string file_name = info.get_name ();
+             if (file_type == FileType.DIRECTORY) {
+                 // Recurse into directories
+                 this.load_modules_from_dir.begin (file);
+-            } else if (mime == "application/x-sharedlib") {
++            } else if (file_name.has_suffix (Module.SUFFIX)) {
+                 // Seems like we found a module
+                 this.load_module_from_file (file);
+             }
diff --git a/multimedia/rygel/patches/010-vapidirs-from-pkg-config.patch b/multimedia/rygel/patches/010-vapidirs-from-pkg-config.patch
new file mode 100644 (file)
index 0000000..70023c5
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/m4/rygel.m4      2012-04-12 08:47:08.000000000 -0700
++++ b/m4/rygel.m4      2012-06-15 11:55:36.000000000 -0700
+@@ -99,6 +99,25 @@
+           [dnl check for vala
+            AM_PROG_VALAC([$1])
++            dnl See where we should look for vapi files. If it's under
++            dnl $datadir, then assume it's one of the standard locations where
++            dnl vala will look. Otherwise, specify explicitly.
++            dnl
++            dnl Note the distinction between these directories (where we look
++            dnl for APIs when we do vala builds) and VAPIDIR, which is where we
++            dnl install our own vapi files.
++
++            for var in vapidir vapidir_versioned; do
++                AS_IF([dir=`$PKG_CONFIG --variable=$var vapigen`],
++                    [
++                        AC_MSG_NOTICE([got $var=$dir from pkg-config])
++                        AS_IF([expr "$dir" : "${datadir}"],
++                            [],
++                            [RYGEL_ADD_VALAFLAGS([--vapidir $dir])])
++                    ],
++                    [AC_MSG_NOTICE([pkg-config didn't return a value for $var, relying on valac built-in defaults])])
++            done
++
+             AS_IF([test x$VALAC = "x"],
+                 [AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH])],
+                 [
diff --git a/multimedia/rygel/patches/020-playbin-mime-types.patch b/multimedia/rygel/patches/020-playbin-mime-types.patch
new file mode 100644 (file)
index 0000000..7ef4333
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/plugins/playbin/rygel-playbin-player.vala
++++ b/src/plugins/playbin/rygel-playbin-player.vala
+@@ -37,6 +37,7 @@
+                                         "audio/x-wav",
+                                         "audio/x-ac3",
+                                         "audio/x-m4a",
++                                        "audio/mp4",
+                                         "image/jpeg",
+                                         "image/png",
+                                         "video/x-theora",
diff --git a/multimedia/rygel/patches/030-output-to-syslog.patch b/multimedia/rygel/patches/030-output-to-syslog.patch
new file mode 100644 (file)
index 0000000..0ed15cd
--- /dev/null
@@ -0,0 +1,35 @@
+Take all the output and send it to syslog.
+This isn't great, but it's better than sending it to the bitbucket, at least
+for troubleshooting.
+--- a/src/rygel/rygel-log-handler.vala
++++ b/src/rygel/rygel-log-handler.vala
+@@ -56,6 +56,29 @@
+     private LogHandler () {
+         this.log_level_hash = new HashMap<string,LogLevelFlags> ();
++        string[] argv = { "/usr/bin/logger", "-t", "rygel" };
++        int logger_fd;
++
++        try {
++            GLib.Process.spawn_async_with_pipes (null,          // working_directory
++                                                 argv,
++                                                 null,          // envp
++                                                 SpawnFlags.STDOUT_TO_DEV_NULL |
++                                                 SpawnFlags.STDERR_TO_DEV_NULL,
++                                                 null,         // child_setup
++                                                 null,         // child_pid
++                                                 out logger_fd, // standard_input
++                                                 null,          // standard_output
++                                                 null);         // standard_error
++
++            Posix.dup2 (logger_fd, Posix.STDOUT_FILENO);
++            Posix.dup2 (logger_fd, Posix.STDERR_FILENO);
++            Posix.close (logger_fd);
++        } catch (Error err) {
++            warning (_("Unable to send output to /usr/bin/logger: %s"),
++                     err.message);
++        }
++
+         // Get the allowed log levels from the config
+         var config = MetaConfig.get_default ();
+         string log_levels;
diff --git a/multimedia/tvheadend/Config.in b/multimedia/tvheadend/Config.in
new file mode 100644 (file)
index 0000000..e769aa8
--- /dev/null
@@ -0,0 +1,21 @@
+config TVHEADEND_CWC_SUPPORT
+       bool "NewCamD support"
+       default n
+
+config TVHEADEND_V4L_SUPPORT
+       bool "Video4Linux v2 support"
+       default n
+
+config TVHEADEND_LINUXDVB_SUPPORT
+       bool "Linux DVB support"
+       default n
+
+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..e76c589
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2012 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:=3.4patch1
+PKG_RELEASE:=0.1
+
+PKG_SOURCE:=$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/tvheadend/tvheadend/archive/
+PKG_MD5SUM:=86d1be0ad6e02bd2aecd3d529a026797
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tvheadend
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=Tvheadend is a TV streaming server for Linux
+  DEPENDS:=+libcurl +libopenssl +librt +zlib +TVHEADEND_AVAHI_SUPPORT:libavahi-client
+  URL:=https://tvheadend.org/
+endef
+
+define Package/tvheadend/description
+  Tvheadend is a TV streaming server for Linux supporting DVB, ATSC, IPTV,
+  and Analog video (V4L) as input sources.
+  Can be used as a backend to Showtime, XBMC and various other clients.
+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_V4L_SUPPORT),)
+  CONFIGURE_ARGS += --disable-v4l
+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 += \
+       --release \
+       --enable-bundle
+
+define Package/tvheadend/install
+       $(INSTALL_DIR) $(1)/etc/tvheadend
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tvheadend.init $(1)/etc/init.d/tvheadend
+       $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
+       $(INSTALL_DATA) ./files/tvheadend.upgrade $(1)/lib/upgrade/keep.d/tvheadend
+       $(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.init b/multimedia/tvheadend/files/tvheadend.init
new file mode 100644 (file)
index 0000000..45258a5
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+START=80
+
+start() {
+       service_start /usr/bin/tvheadend -f -c /etc/tvheadend
+}
+
+stop() {
+       service_stop /usr/bin/tvheadend
+}
diff --git a/multimedia/tvheadend/files/tvheadend.upgrade b/multimedia/tvheadend/files/tvheadend.upgrade
new file mode 100644 (file)
index 0000000..87b2b53
--- /dev/null
@@ -0,0 +1 @@
+/etc/tvheadend
diff --git a/multimedia/tvheadend/patches/001-fix_Makefile_VFP_CFLAGS.patch b/multimedia/tvheadend/patches/001-fix_Makefile_VFP_CFLAGS.patch
new file mode 100644 (file)
index 0000000..ba13c4c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -282,7 +282,7 @@ include support/${OSENV}.mk
+ # Bundle files
+ $(BUILDDIR)/bundle.o: $(BUILDDIR)/bundle.c
+       @mkdir -p $(dir $@)
+-      $(CC) -I${CURDIR}/src -c -o $@ $<
++      $(CC) $(CFLAGS) -I${CURDIR}/src -c -o $@ $<
+ $(BUILDDIR)/bundle.c:
+       @mkdir -p $(dir $@)
diff --git a/multimedia/ushare/Makefile b/multimedia/ushare/Makefile
new file mode 100644 (file)
index 0000000..794281f
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2008-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:=ushare
+PKG_VERSION:=1.1a
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://ushare.geexbox.org/releases/
+PKG_MD5SUM:=5bbcdbf1ff85a9710fa3d4e82ccaa251
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ushare
+ SECTION:=multimedia
+ CATEGORY:=Multimedia
+ TITLE:= UPnP A/V & DLNA Media Server
+ URL:=http://ushare.geexbox.org/
+ DEPENDS:=+libdlna +libupnp +libffmpeg
+endef
+
+define Package/ushare/description
+ uShare is a UPnP (TM) A/V & DLNA Media Server. It implements the server
+ component that provides UPnP media devices with information on available
+ multimedia files.
+endef
+
+MAKE_INSTALL_FLAGS+= \
+       INSTALL="install" \
+
+define Build/Configure
+       # this is *NOT* GNU configure
+       ( cd $(PKG_BUILD_DIR); \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib" \
+               PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
+               PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
+               ./configure \
+               --cross-compile \
+               --cross-prefix="$(TARGET_CROSS)" \
+               --prefix="/usr" \
+               --sysconfdir="/etc" \
+               --enable-dlna \
+               --disable-nls \
+               --disable-debug \
+               --disable-optimize \
+               --disable-strip \
+       )
+endef
+
+define Package/ushare/conffiles
+/etc/config/ushare
+/etc/ushare.conf
+endef
+
+define Package/ushare/install
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/ushare.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ushare $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,ushare))
diff --git a/multimedia/ushare/files/ushare.config b/multimedia/ushare/files/ushare.config
new file mode 100644 (file)
index 0000000..d7d0dce
--- /dev/null
@@ -0,0 +1,9 @@
+config 'ushare'
+       option 'enabled' '0'
+       option 'user' 'nobody'
+       option 'servername' 'OpenWrt'
+       option 'interface' 'br-lan'
+       option 'options' ''
+       option 'content_directories' '/tmp'
+       option 'disable_telnet' '1'
+       option 'disable_webif' '1'
diff --git a/multimedia/ushare/files/ushare.init b/multimedia/ushare/files/ushare.init
new file mode 100644 (file)
index 0000000..db661d1
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get_bool _val "$section" "$option" '0'
+       [ "$_val" -gt 0 ] && append args "$3"
+}
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3 $_val"
+}
+
+section_enabled() {
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+start_instance() {
+       local section="$1"
+
+       section_enabled "$section" || return 1
+
+       args=""
+       config_get uid "$section" 'user'
+       config_get servername "$section" 'servername'
+       config_get interface "$section" 'interface'
+       config_get options "$section" 'options'
+       config_get content_directories "$section" 'content_directories'
+       append_bool "$section" 'disable_webif' '-w'
+       append_bool "$section" 'disable_telnet' '-t'
+
+       SERVICE_UID="$uid" \
+       service_start /usr/bin/ushare -n "${servername:-OpenWrt}" -i "${interface:-br-lan}" -c "${content_directories:-/tmp}" $args ${options}
+}
+
+stop_instance() {
+       local section="$1"
+
+       section_enabled "$section" || return 1
+
+       config_get uid "$section" "user"
+
+       SERVICE_UID="$uid" \
+       service_stop /usr/bin/ushare
+}
+
+start() {
+       config_load 'ushare'
+       config_foreach start_instance 'ushare'
+}
+
+stop() {
+       config_load 'ushare'
+       config_foreach stop_instance 'ushare'
+}
diff --git a/multimedia/ushare/patches/100-configure_grep_fix.patch b/multimedia/ushare/patches/100-configure_grep_fix.patch
new file mode 100644 (file)
index 0000000..0bfb161
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ruN ushare-1.1a-orig/configure ushare-1.1a/configure
+--- ushare-1.1a-orig/configure 2007-12-09 14:03:36.000000000 +0100
++++ ushare-1.1a/configure      2008-04-19 22:48:35.000000000 +0200
+@@ -130,7 +130,7 @@
+     var=$1
+     shift
+     for f in $@; do
+-      if eval echo \$$var | grep -qv -e "$f"; then
++      if eval echo \$$var | grep -qv -e "$(echo $f | sed -e 's|\.|\\\.|g')"; then
+         eval "$var=\"\$$var $f\""
+       fi
+     done
diff --git a/multimedia/ushare/patches/200-compile-fixes.patch b/multimedia/ushare/patches/200-compile-fixes.patch
new file mode 100644 (file)
index 0000000..dc38465
--- /dev/null
@@ -0,0 +1,202 @@
+--- a/src/cds.c
++++ b/src/cds.c
+@@ -20,6 +20,8 @@
+  */
+ #include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
+ #include <upnp/upnp.h>
+ #include <upnp/upnptools.h>
+--- a/src/http.c
++++ b/src/http.c
+@@ -25,6 +25,7 @@
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <unistd.h>
+ #include <errno.h>
+@@ -77,8 +78,7 @@ set_info_file (struct File_Info *info, c
+   info->content_type = ixmlCloneDOMString (content_type);
+ }
+-static int
+-http_get_info (const char *filename, struct File_Info *info)
++int http_get_info (const char *filename, struct File_Info *info)
+ {
+   extern struct ushare_t *ut;
+   struct upnp_entry_t *entry = NULL;
+@@ -197,8 +197,7 @@ get_file_memory (const char *fullpath, c
+   return ((UpnpWebFileHandle) file);
+ }
+-static UpnpWebFileHandle
+-http_open (const char *filename, enum UpnpOpenFileMode mode)
++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode)
+ {
+   extern struct ushare_t *ut;
+   struct upnp_entry_t *entry = NULL;
+@@ -251,8 +250,7 @@ http_open (const char *filename, enum Up
+   return ((UpnpWebFileHandle) file);
+ }
+-static int
+-http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+   ssize_t len = -1;
+@@ -286,8 +284,7 @@ http_read (UpnpWebFileHandle fh, char *b
+   return len;
+ }
+-static int
+-http_write (UpnpWebFileHandle fh __attribute__((unused)),
++int http_write (UpnpWebFileHandle fh __attribute__((unused)),
+             char *buf __attribute__((unused)),
+             size_t buflen __attribute__((unused)))
+ {
+@@ -296,8 +293,7 @@ http_write (UpnpWebFileHandle fh __attri
+   return 0;
+ }
+-static int
+-http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+   off_t newpos = -1;
+@@ -371,8 +367,7 @@ http_seek (UpnpWebFileHandle fh, off_t o
+   return 0;
+ }
+-static int
+-http_close (UpnpWebFileHandle fh)
++int http_close (UpnpWebFileHandle fh)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+@@ -402,13 +397,3 @@ http_close (UpnpWebFileHandle fh)
+   return 0;
+ }
+-
+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks =
+-  {
+-    http_get_info,
+-    http_open,
+-    http_read,
+-    http_write,
+-    http_seek,
+-    http_close
+-  };
+--- a/src/http.h
++++ b/src/http.h
+@@ -25,6 +25,18 @@
+ #include <upnp/upnp.h>
+ #include <upnp/upnptools.h>
+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks;
++int http_get_info (const char *filename, struct File_Info *info);
++
++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode);
++
++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen);
++
++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin);
++
++int http_write (UpnpWebFileHandle fh __attribute__((unused)),
++      char *buf __attribute__((unused)),
++      size_t buflen __attribute__((unused)));
++
++int http_close (UpnpWebFileHandle fh);
+ #endif /* _HTTP_H_ */
+--- a/src/ushare.c
++++ b/src/ushare.c
+@@ -188,7 +188,7 @@ handle_action_request (struct Upnp_Actio
+   if (strcmp (request->DevUDN + 5, ut->udn))
+     return;
+-  ip = request->CtrlPtIPAddr.s_addr;
++  ip = (*(struct sockaddr_in *)&request->CtrlPtIPAddr).sin_addr.s_addr;
+   ip = ntohl (ip);
+   sprintf (val, "%d.%d.%d.%d",
+            (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
+@@ -348,13 +348,23 @@ init_upnp (struct ushare_t *ut)
+   UpnpEnableWebserver (TRUE);
+-  res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
+-  if (res != UPNP_E_SUCCESS)
+-  {
+-    log_error (_("Cannot set virtual directory callbacks\n"));
+-    free (description);
+-    return -1;
+-  }
++#define upnp_set_callback(cb, func) \
++  do {                                                            \
++    res = UpnpVirtualDir_set_##cb##Callback(func);                \
++    if (res != UPNP_E_SUCCESS)                                    \
++    {                                                             \
++      log_error (_("Cannot set virtual directory callbacks\n"));  \
++      free (description);                                         \
++      return -1;                                                  \
++    }                                                             \
++  } while(0)
++
++  upnp_set_callback(GetInfo, http_get_info);
++  upnp_set_callback(Open,    http_open);
++  upnp_set_callback(Read,    http_read);
++  upnp_set_callback(Seek,    http_seek);
++  upnp_set_callback(Write,   http_write);
++  upnp_set_callback(Close,   http_close);
+   res = UpnpAddVirtualDir (VIRTUAL_DIR);
+   if (res != UPNP_E_SUCCESS)
+--- a/src/cms.c
++++ b/src/cms.c
+@@ -20,6 +20,8 @@
+  */
+ #include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
+ #include <upnp/upnp.h>
+ #include <upnp/upnptools.h>
+--- a/src/mime.c
++++ b/src/mime.c
+@@ -20,6 +20,7 @@
+  */
+ #include <stdlib.h>
++#include <stdio.h>
+ #include <string.h>
+ #include "mime.h"
+--- a/src/presentation.c
++++ b/src/presentation.c
+@@ -19,6 +19,8 @@
+  */
+ #include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
+ #if HAVE_LANGINFO_CODESET
+ # include <langinfo.h>
+--- a/src/services.c
++++ b/src/services.c
+@@ -20,6 +20,8 @@
+  */
+ #include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
+ #include <upnp/upnp.h>
+ #include <upnp/upnptools.h>
diff --git a/net/aircrack-ng/Makefile b/net/aircrack-ng/Makefile
new file mode 100644 (file)
index 0000000..e912dfe
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# 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:=aircrack-ng
+PKG_VERSION:=1.1
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.aircrack-ng.org/ \
+       http://archive.aircrack-ng.org/aircrack-ng/$(PKG_VERSION)/
+PKG_MD5SUM:=f7a24ed8fad122c4187d06bfd6f998b4
+
+PKG_BUILD_PARALLEL:=0
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aircrack-ng
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +libopenssl +libpcap
+  TITLE:=next generation of aircrack with new features
+  URL:=http://www.aircrack-ng.org/
+  SUBMENU:=wireless
+endef
+
+define Package/aircrack-ng/description
+Aircrack-ng is the next generation of aircrack with new features
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -Wall -Iinclude/ $(TARGET_CPPFLAGS) -D_REVISION=0" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       OSNAME=Linux \
+       prefix="/usr" \
+       sqlite="false" \
+       unstable="true"
+
+define Package/aircrack-ng/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,aircrack-ng))
diff --git a/net/aircrack-ng/patches/100-add-ignore-channel-negative-1.patch b/net/aircrack-ng/patches/100-add-ignore-channel-negative-1.patch
new file mode 100644 (file)
index 0000000..394a300
--- /dev/null
@@ -0,0 +1,52 @@
+--- a/src/aireplay-ng.c
++++ b/src/aireplay-ng.c
+@@ -200,7 +200,9 @@ char usage[] =
+ "\n"
+ "  Miscellaneous options:\n"
+ "\n"
+-"      -R        : disable /dev/rtc usage\n"
++"      -R                    : disable /dev/rtc usage\n"
++"      --ignore-negative-one : if the interface's channel can't be determined,\n"
++"                              ignore the mismatch, needed for unpatched cfg80211\n"
+ "\n"
+ "  Attack modes (numbers can still be used):\n"
+ "\n"
+@@ -268,6 +270,7 @@ struct options
+     int bittest;
+     int nodetect;
++    int ignore_negative_one;
+     int rtc;
+ }
+ opt;
+@@ -715,6 +718,13 @@ int attack_check(uchar* bssid, char* ess
+     iface_chan = wi_get_channel(wi);
++    if(iface_chan == -1 && !opt.ignore_negative_one)
++    {
++        PCT; printf("Couldn't determine current channel for %s, you should either force the operation with --ignore-negative-one or apply a kernel patch\n",
++                wi_get_ifname(wi));
++        return -1;
++    }
++
+     if(bssid != NULL)
+     {
+         ap_chan = wait_for_beacon(bssid, capa, essid);
+@@ -723,7 +733,7 @@ int attack_check(uchar* bssid, char* ess
+             PCT; printf("No such BSSID available.\n");
+             return -1;
+         }
+-        if(ap_chan != iface_chan)
++        if((ap_chan != iface_chan) && (iface_chan != -1 || !opt.ignore_negative_one))
+         {
+             PCT; printf("%s is on channel %d, but the AP uses channel %d\n", wi_get_ifname(wi), iface_chan, ap_chan);
+             return -1;
+@@ -5765,6 +5775,7 @@ int main( int argc, char *argv[] )
+             {"help",        0, 0, 'H'},
+             {"fast",        0, 0, 'F'},
+             {"bittest",     0, 0, 'B'},
++            {"ignore-negative-one", 0, &opt.ignore_negative_one, 1},
+             {0,             0, 0,  0 }
+         };
diff --git a/net/aircrack-ptw/Makefile b/net/aircrack-ptw/Makefile
new file mode 100644 (file)
index 0000000..1aad95a
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=aircrack-ptw
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.cdc.informatik.tu-darmstadt.de/aircrack-ptw/download
+PKG_MD5SUM:=1d7d84d1e69189bc1397db3f565c183a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aircrack-ptw
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap
+  TITLE:=A tool using a new method for breaking WEP Keys
+  URL:=http://www.cdc.informatik.tu-darmstadt.de/aircrack-ptw/
+  SUBMENU:=wireless
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \
+               $(TARGET_LDFLAGS) \
+               -lpcap -o $(PKG_BUILD_DIR)/aircrack-ptw \
+               $(PKG_BUILD_DIR)/aircrack-ptw.c \
+               $(PKG_BUILD_DIR)/aircrack-ptw-lib.c
+endef
+
+define Package/aircrack-ptw/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/aircrack-ptw $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,aircrack-ptw))
diff --git a/net/aircrack-ptw/patches/001-smaller.patch b/net/aircrack-ptw/patches/001-smaller.patch
new file mode 100644 (file)
index 0000000..9dbf14b
--- /dev/null
@@ -0,0 +1,12 @@
+diff -purN aircrack-ptw-1.0.0/aircrack-ptw.c aircrack-ptw-1.0.0_patch/aircrack-ptw.c
+--- aircrack-ptw-1.0.0/aircrack-ptw.c  2007-04-03 08:50:42.000000000 -0400
++++ aircrack-ptw-1.0.0_patch/aircrack-ptw.c    2007-04-07 16:50:38.000000000 -0400
+@@ -6,7 +6,7 @@
+ #include "aircrack-ptw-lib.h"
+-#define KEYLIMIT (1000000)
++#define KEYLIMIT (10000)
+ #define BSSIDLEN (6)
+ typedef struct {
diff --git a/net/airpwn/Makefile b/net/airpwn/Makefile
new file mode 100644 (file)
index 0000000..9a47311
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2009-2010 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:=airpwn
+PKG_RELEASE:=1
+PKG_VERSION:=1.3
+
+PKG_SOURCE:=airpwn-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/airpwn
+PKG_MD5SUM:=15b6f1cd287b4bb20dd586bb6c83628d
+
+PKG_BUILD_DEPENDS:=libnet1 libopenssl libpcap libpcre
+
+PKG_FIXUP:=autoreconf
+PKG_LIBTOOL_PATHS:=. lorcon
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/airpwn
+       SECTION:=net
+       CATEGORY:=Network
+        SUBMENU:=wireless
+       TITLE:=Packet injection pwnage
+       DEPENDS:=+libnet1 +libopenssl +libpcap +libpcre +libpthread
+       URL:=http://airpwn.sourceforge.net/Airpwn.html
+endef
+
+define Package/airpwn/description
+  Airpwn is a framework for 802.11 (wireless) packet injection.
+  Airpwn listens to incoming wireless packets, and if the data
+  matches a pattern specified in the config files, custom content
+  is injected "spoofed" from the wireless access point. From the
+  perspective of the wireless client, airpwn becomes the server.
+endef
+
+CONFIGURE_VARS:= \
+       CC="$(TARGET_CC)" \
+       LD="$(TARGET_LD)" \
+       CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/lib/libnet-1.1.x/include -I$(STAGING_DIR)/usr/include -I$(PKG_BUILD_DIR)/lorcon" \
+       LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/libnet-1.1.x/lib -L$(PKG_BUILD_DIR)/lorcon/.libs -lcrypto -lssl" \
+       LIBTOOL="$(STAGING_DIR)/host/bin/libtool"
+
+define Build/Configure
+       ( cd $(PKG_BUILD_DIR); tar -xzf lorcon-current.tgz; cd lorcon; \
+       $(CONFIGURE_VARS) ./configure $(CONFIGURE_ARGS); \
+       $(MAKE) -C $(PKG_BUILD_DIR)/lorcon $(CONFIGURE_VARS); cd ..; \
+       $(CONFIGURE_VARS) ./configure $(CONFIGURE_ARGS) )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) $(CONFIGURE_VARS)
+endef
+
+define Package/airpwn/install
+       $(INSTALL_DIR) $(1)/etc/airpwn
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/* $(1)/etc/airpwn/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/airpwn $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lorcon/.libs/liborcon-1.0.0.so $(1)/usr/lib/
+       ( cd $(1)/usr/lib; ln -s liborcon-1.0.0.so liborcon.so )
+endef
+
+$(eval $(call BuildPackage,airpwn))
diff --git a/net/amule/Makefile b/net/amule/Makefile
new file mode 100644 (file)
index 0000000..dfb7eb8
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2007-2009 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:=aMule
+PKG_VERSION:=2.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/amule
+PKG_MD5SUM:=31724290a440943f5b05d4dca413fe02
+
+PKG_BUILD_DEPENDS:=libgd
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/amule
+  SUBMENU:=P2P
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A multi-platform eMule-like ed2k client
+  URL:=http://www.amule.org/
+  DEPENDS:=+libpng +libpthread +libncurses +libreadline +libwxbase +libcryptoxx
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-static \
+       --disable-rpath \
+       --with-gnu-ld \
+       --disable-ccache \
+       --disable-debug \
+       --disable-optimize \
+       --disable-profile \
+       --disable-monolithic \
+       --enable-amule-daemon \
+       --enable-amulecmd \
+       --enable-webserver \
+       --disable-amule-gui \
+       --disable-cas \
+       --disable-wxcas \
+       --disable-ed2k \
+       --disable-alc \
+       --disable-alcc \
+       --disable-fileview \
+       --disable-plasmamule \
+       --without-wxdebug \
+       \
+       --with-zlib="$(STAGING_DIR)/usr" \
+       --with-gdlib-prefix="$(STAGING_DIR)/usr" \
+       --with-libpng-prefix="$(STAGING_DIR)/usr" \
+       --with-wx-prefix="$(STAGING_DIR)/usr" \
+       --with-crypto-prefix="$(STAGING_DIR)/usr" \
+       --with-libiconv-prefix="$(ICONV_PREFIX)" \
+       --with-libintl-prefix="$(INTL_PREFIX)" \
+       --without-x \
+
+TARGET_LDFLAGS += \
+       -liconv
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               HOSTCC="$(HOSTCC)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/amule/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/amule{cmd,d,web} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/amule $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,amule))
diff --git a/net/amule/patches/001-gcc-fix.patch b/net/amule/patches/001-gcc-fix.patch
new file mode 100644 (file)
index 0000000..77b0bd7
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/src/ObservableQueue.h
++++ b/src/ObservableQueue.h
+@@ -331,14 +331,14 @@ CObservableQueue<ValueType>::~CObservabl
+ template <typename ValueType>
+ void CObservableQueue<ValueType>::ObserverAdded( ObserverType* o )
+ {
+-      NotifyObservers( EventType( EventType::STARTING ), o );
++      this->NotifyObservers( EventType( EventType::STARTING ), o );
+ }
+ template <typename ValueType>
+ void CObservableQueue<ValueType>::ObserverRemoved( ObserverType* o )
+ {
+-      NotifyObservers( EventType( EventType::STOPPING ), o );
++      this->NotifyObservers( EventType( EventType::STOPPING ), o );
+ }
diff --git a/net/amule/patches/001-no_backtrace.patch b/net/amule/patches/001-no_backtrace.patch
new file mode 100644 (file)
index 0000000..df3bee8
--- /dev/null
@@ -0,0 +1,69 @@
+--- a/configure
++++ b/configure
+@@ -13984,66 +13984,6 @@ fi
+-# Check for bfd.h (to have proper backtraces without using wxExecute)
+-
+-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd" >&5
+-$as_echo_n "checking for bfd... " >&6; }
+-      result=no
+-      for bfd_ldadd in "" "${LIBINTL}" "-ldl" "-ldl ${LIBINTL}"; do
+-              mule_backup_LIBS="$LIBS"
+-              mule_backup_LDFLAGS="$LDFLAGS"
+-              LIBS="-lbfd -liberty ${bfd_ldadd} ${ZLIB_LIBS} $LIBS"
+-              LDFLAGS="$LDFLAGS ${ZLIB_LDFLAGS}"
+-              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-
+-                              #include <ansidecl.h>
+-                              #include <bfd.h>
+-
+-int
+-main ()
+-{
+-
+-                              char *dummy = bfd_errmsg(bfd_get_error());
+-
+-  ;
+-  return 0;
+-}
+-
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+-
+-                      result=yes
+-                      BFD_CPPFLAGS="-DHAVE_BFD"
+-                      BFD_LIBS="-lbfd -liberty ${bfd_ldadd}"
+-                      LIBS="$mule_backup_LIBS"
+-                      LDFLAGS="$mule_backup_LDFLAGS"
+-                      break
+-
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
+-              LIBS="$mule_backup_LIBS"
+-              LDFLAGS="$mule_backup_LDFLAGS"
+-      done
+-
+-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
+-$as_echo "$result" >&6; }
+-
+-      if test $result = no; then :
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+-        bfd.h not found or unusable, please install binutils development
+-        package if you are a developer or want to help testing aMule" >&5
+-$as_echo "$as_me: WARNING:
+-        bfd.h not found or unusable, please install binutils development
+-        package if you are a developer or want to help testing aMule" >&2;}
+-_mule_warning_10=yes
+-_mule_has_warnings=yes
+-
+-fi
+-
+-
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for <execinfo.h> and backtrace()" >&5
+ $as_echo_n "checking for <execinfo.h> and backtrace()... " >&6; }
diff --git a/net/amwall/Makefile b/net/amwall/Makefile
new file mode 100644 (file)
index 0000000..c1cd29b
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006-2014 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:=amwall
+PKG_VERSION:=0.1.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.amselinux.net/source/
+PKG_MD5SUM:=a8b6438e7fd9ccadc9f68824ae62349c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/amwall
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libamsel
+  TITLE:=PF to iptables
+  URL:=http://www.amselinux.net/
+  SUBMENU:=Firewall
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               V= \
+               LDIR="$(PKG_BUILD_DIR)" \
+               AMSEL_INCLUDE="$(STAGING_DIR)/usr/include" \
+               OPT_CFLAGS="$(TARGET_CFLAGS)" \
+               OPT_LDFLAGS="$(TARGET_LDFLAGS)" \
+               PREFIX="/usr" \
+               CONFIG="$(PKG_BUILD_DIR)/etc/amsel" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               SHELL="/bin/bash" \
+               all install
+endef
+
+define Package/amwall/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/amsel
+       $(CP) $(PKG_INSTALL_DIR)/etc/amsel* $(1)/etc/
+endef
+
+define Package/amwall/conffiles
+/etc/amsel/firewall.conf
+endef
+
+$(eval $(call BuildPackage,amwall))
diff --git a/net/amwall/patches/010-compile_fix.patch b/net/amwall/patches/010-compile_fix.patch
new file mode 100644 (file)
index 0000000..caa0b42
--- /dev/null
@@ -0,0 +1,21 @@
+diff -ur amwall.old/grammar_en.y amwall.dev/grammar_en.y
+--- amwall.old/grammar_en.y    Sun May 23 17:17:54 2004
++++ amwall.dev/grammar_en.y    Sat Oct 14 17:21:28 2006
+@@ -651,7 +651,7 @@
+ {
+       AMWALL_ADD_RULE("CONTINUE");
+ }
+-
++                              ;
+ dnat            : DNAT
+ {
+       switch(chain_type) {
+@@ -667,7 +667,7 @@
+       AMWALL_ADD_RULE("DNAT");
+ }
+-
++                              ;
+ drop            : DROP
+ {
+       AMWALL_ADD_RULE("DROP");
diff --git a/net/aodv-uu/Makefile b/net/aodv-uu/Makefile
new file mode 100644 (file)
index 0000000..4a7cd96
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2006-2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=aodv-uu
+PKG_VERSION:=0.9.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://core.it.uu.se/core/files/
+PKG_MD5SUM:=05460543054449cb4b170252a7168c65
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aodv-uu/Default
+  TITLE:=Ad-hoc On-demand Distance Vector Routing
+  DEPENDS:=@BROKEN
+  URL:=http://core.it.uu.se/core/index.php/AODV-UU
+endef
+
+define Package/aodv-uu/Default/description
+ AODV is the Ad-hoc On-demand Distance Vector routing protocol
+ implementation created at Uppsala University.
+endef
+
+define Package/aodv-uu
+$(call Package/aodv-uu/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE+= (daemon)
+endef
+
+define Package/aodv-uu/description
+$(call Package/aodv-uu/Default/description)
+ This package contains the AODV userland daemon.
+endef
+
+define KernelPackage/aodv-uu
+$(call Package/aodv-uu/Default)
+  TITLE+= (kernel module)
+  FILES:=$(PKG_BUILD_DIR)/lnx/kaodv.$(LINUX_KMOD_SUFFIX)
+  SUBMENU:=Network Support
+  AUTOLOAD:=$(call AutoLoad,80,$(shell cat ./files/aodv-uu.modules))
+endef
+
+define KernelPackage/aodv-uu/description
+$(call Package/aodv-uu/Default/description)
+ This package contains the AODV kernel module.
+endef
+
+ifneq ($(CONFIG_LINUX_2_4),y)
+  define Build/Compile/linux26
+       $(MAKE) -C $(LINUX_DIR) \
+               ARCH="$(LINUX_KARCH)" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               PATCHLEVEL="$(LINUX_VERSION)" \
+               KERNDIR="$(LINUX_DIR)" \
+               SUBDIRS="$(PKG_BUILD_DIR)/lnx" \
+                modules
+  endef
+else
+  # We assume 2.4 builds are only for brcm-2.4 yet
+  define Build/Compile/linux24-brcm
+       $(call Build/Compile/Default,\
+               KERNEL_DIR="$(LINUX_DIR)" \
+               KCC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               kaodv-mips \
+       )
+       cp $(PKG_BUILD_DIR)/lnx/kaodv-mips.$(LINUX_KMOD_SUFFIX) $(PKG_BUILD_DIR)/lnx/kaodv.$(LINUX_KMOD_SUFFIX)
+  endef
+endif
+
+define Build/Compile
+       $(call Build/Compile/linux26)
+       $(call Build/Compile/linux24-brcm)
+       $(call Build/Compile/Default,\
+               KERNEL_DIR="$(LINUX_DIR)" \
+               KCC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               aodvd \
+       )
+endef
+
+define Package/aodv-uu/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/aodvd $(1)/usr/sbin
+endef
+
+define Package/kmod-aodv-uu/install
+       $(INSTALL_DIR) $(1)/etc/modules.d
+       $(INSTALL_DATA) ./files/aodv-uu.modules $(1)/etc/modules.d/80-aodv-uu
+       $(INSTALL_DIR) $(1)/lib/modules/$(LINUX_VERSION)
+       $(CP) $(PKG_BUILD_DIR)/lnx/kaodv.$(LINUX_KMOD_SUFFIX) $(1)/lib/modules/$(LINUX_VERSION)/
+endef
+
+$(eval $(call BuildPackage,aodv-uu))
+$(eval $(call KernelPackage,aodv-uu))
diff --git a/net/aodv-uu/files/aodv-uu.modules b/net/aodv-uu/files/aodv-uu.modules
new file mode 100644 (file)
index 0000000..809c4da
--- /dev/null
@@ -0,0 +1 @@
+kaodv
diff --git a/net/aodv-uu/patches/001-normalize.patch b/net/aodv-uu/patches/001-normalize.patch
new file mode 100644 (file)
index 0000000..bdc6fda
--- /dev/null
@@ -0,0 +1,64 @@
+Index: aodv-uu-0.9.3/lnx/Makefile
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/Makefile    2007-06-04 13:22:19.859836128 +0200
++++ aodv-uu-0.9.3/lnx/Makefile 2007-06-04 13:22:19.932825032 +0200
+@@ -30,7 +30,7 @@
+ KCFLAGS=-Wall -Wno-strict-aliasing -O2 $(KDEFS) $(KINC) $(XDEFS)
+ KCFLAGS_ARM=-Wall -O2 -D__KERNEL__ -DMODULE -nostdinc $(shell $(ARM_CC) -print-search-dirs | sed -ne 's/install: \(.*\)/-I \1include/gp') -I$(KERNEL_INC)
+ KCFLAGS_MIPS=-Wall -mips2 -O2 -fno-pic -mno-abicalls -mlong-calls -G0 -msoft-float -D__KERNEL__ -DMODULE -nostdinc $(shell $(MIPS_CC) -print-search-dirs | sed -ne 's/install: \(.*\)/-I \1include/gp') -I$(KERNEL_INC) $(XDEFS)
+-
++endif
+ .PHONY: clean clean-2.4 clean-2.6 indent default
+ # Check for kernel version
+@@ -89,5 +89,3 @@
+       etags *.c *.h
+ indent:
+       indent -kr -i8 -ts8 -sob -l80 -ss -ncs *.c *.h 
+-endif
+-
+Index: aodv-uu-0.9.3/Makefile
+===================================================================
+--- aodv-uu-0.9.3.orig/Makefile        2007-06-04 13:22:19.866835064 +0200
++++ aodv-uu-0.9.3/Makefile     2007-06-04 13:22:19.932825032 +0200
+@@ -87,7 +87,7 @@
+ mips: aodvd-mips kaodv-mips
+ endian.h:
+-      $(CC) $(CFLAGS) -o endian endian.c
++      gcc -o endian endian.c
+       ./endian > endian.h
+ $(OBJS): %.o: %.c Makefile
+@@ -143,19 +143,18 @@
+       @makedepend -Y./ -- $(DEFS) -- $(SRC) &>/dev/null
+       @makedepend -a -Y./ -- $(KDEFS) kaodv.c &>/dev/null
+-install: default
+-      install -s -m 755 aodvd /usr/sbin/aodvd
+-      @if [ ! -d /lib/modules/$(KERNEL)/aodv ]; then \
+-              mkdir /lib/modules/$(KERNEL)/aodv; \
+-      fi
+-
+-      @echo "Installing kernel module in /lib/modules/$(KERNEL)/aodv/";
+-      @if [ -f ./kaodv.ko ]; then \
+-              install -m 644 kaodv.ko /lib/modules/$(KERNEL)/aodv/kaodv.ko; \
+-      else \
+-              install -m 644 kaodv.o /lib/modules/$(KERNEL)/aodv/kaodv.o; \
+-      fi
+-      /sbin/depmod -a
++install: install-aodvd install-kaodv
++
++install-aodvd:
++      @echo "Installing aodv in $(DESTDIR)/usr/sbin";
++      install -d -m0755 $(DESTDIR)/usr/sbin/
++      install -m0755 aodvd $(DESTDIR)/usr/sbin/aodvd
++
++install-kaodv:
++      @echo "Installing kernel module in $(DESTDIR)/lib/modules/$(KERNEL)/";
++      install -d -m0644 $(DESTDIR)/lib/modules/$(KERNEL)/
++      install -m 644 lnx/kaodv.$(KMOD_SUFFIX) $(DESTDIR)/lib/modules/$(KERNEL)/kaodv.$(KMOD_SUFFIX);
++
+ uninstall:
+       rm -f /usr/sbin/aodvd
+       rm -rf /lib/modules/$(KERNEL)/aodv
diff --git a/net/aodv-uu/patches/002-linux_2.6.19_ip_route_me_harder_change.patch b/net/aodv-uu/patches/002-linux_2.6.19_ip_route_me_harder_change.patch
new file mode 100644 (file)
index 0000000..638de87
--- /dev/null
@@ -0,0 +1,49 @@
+Index: aodv-uu-0.9.3/lnx/kaodv-mod.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-mod.c 2007-06-04 13:22:19.830840536 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-mod.c      2007-06-04 13:22:20.130794936 +0200
+@@ -19,7 +19,7 @@
+  * Author: Erik Nordström, <erik.nordstrom@it.uu.se>
+  * 
+  *****************************************************************************/
+-#include <linux/config.h>
++#include <linux/autoconf.h>
+ #include <linux/version.h>
+ #ifdef KERNEL26
+@@ -258,7 +258,11 @@
+                       if (!(*skb))
+                               return NF_STOLEN;
+                       
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
++                      ip_route_me_harder(skb, RTN_UNSPEC);
++#else
+                       ip_route_me_harder(skb);
++#endif
+               }
+               break;
+       case NF_IP_POST_ROUTING:
+Index: aodv-uu-0.9.3/lnx/kaodv-queue.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-queue.c       2007-06-04 13:22:19.837839472 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-queue.c    2007-06-04 13:22:20.130794936 +0200
+@@ -29,6 +29,7 @@
+ #include <linux/spinlock.h>
+ #include <linux/sysctl.h>
+ #include <linux/proc_fs.h>
++#include <linux/version.h>
+ #include <net/sock.h>
+ #include <net/route.h>
+ #include <net/icmp.h>
+@@ -246,7 +247,11 @@
+                               if (!entry->skb)
+                                       goto next;
+                       }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
++                      ip_route_me_harder(&entry->skb, RTN_UNSPEC);
++#else
+                       ip_route_me_harder(&entry->skb);
++#endif
+                       pkts++;
diff --git a/net/aodv-uu/patches/003-linux_2.6.19_security_netlink_recv_change.patch b/net/aodv-uu/patches/003-linux_2.6.19_security_netlink_recv_change.patch
new file mode 100644 (file)
index 0000000..53d9064
--- /dev/null
@@ -0,0 +1,16 @@
+Index: aodv-uu-0.9.3/lnx/kaodv-netlink.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-netlink.c     2007-06-04 13:22:19.810843576 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-netlink.c  2007-06-04 13:22:20.326765144 +0200
+@@ -284,7 +284,11 @@
+ /*            RCV_SKB_FAIL(-EINVAL); */
+ #ifdef KERNEL26
++# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)     
++      if (security_netlink_recv(skb, CAP_NET_ADMIN))
++# else        
+       if (security_netlink_recv(skb))
++# endif
+               RCV_SKB_FAIL(-EPERM);
+ #endif
+       //write_lock_bh(&queue_lock);
diff --git a/net/aodv-uu/patches/004-linux_2.6.19_includes.patch b/net/aodv-uu/patches/004-linux_2.6.19_includes.patch
new file mode 100644 (file)
index 0000000..8dc1adf
--- /dev/null
@@ -0,0 +1,28 @@
+Index: aodv-uu-0.9.3/main.c
+===================================================================
+--- aodv-uu-0.9.3.orig/main.c  2007-06-04 13:22:19.782847832 +0200
++++ aodv-uu-0.9.3/main.c       2007-06-04 13:22:20.513736720 +0200
+@@ -26,6 +26,8 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/stat.h>
++#include <linux/types.h>
++#include <linux/if.h>
+ #include <linux/sockios.h>
+ #include <linux/wireless.h>
+ #include <getopt.h>
+Index: aodv-uu-0.9.3/nl.c
+===================================================================
+--- aodv-uu-0.9.3.orig/nl.c    2007-06-04 13:22:19.789846768 +0200
++++ aodv-uu-0.9.3/nl.c 2007-06-04 13:22:20.513736720 +0200
+@@ -33,6 +33,10 @@
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <linux/rtnetlink.h>
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
++#include <linux/if_addr.h>
++#endif
+ #include "defs.h"
+ #include "lnx/kaodv-netlink.h"
diff --git a/net/aodv-uu/patches/005-linux_2.6.22_skbuff.patch b/net/aodv-uu/patches/005-linux_2.6.22_skbuff.patch
new file mode 100644 (file)
index 0000000..0831c5f
--- /dev/null
@@ -0,0 +1,164 @@
+Index: aodv-uu-0.9.3/lnx/kaodv-compat.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ aodv-uu-0.9.3/lnx/kaodv-compat.h   2007-06-17 02:49:46.844217144 +0200
+@@ -0,0 +1,15 @@
++#ifndef __KAODV_COMPAT_H
++#define __KAODV_COMPAT_H
++
++#include <linux/version.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
++
++#define ip_hdr(_skb) (_skb)->nh.iph
++#define skb_reset_network_header(_skb) do { \
++              _skb->nh.iph = (struct iphdr *)_skb->data; \
++      } while (0);
++
++
++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) */
++
++#endif
+Index: aodv-uu-0.9.3/lnx/kaodv-ipenc.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-ipenc.c       2007-06-17 02:31:56.448941960 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-ipenc.c    2007-06-17 02:45:50.420159064 +0200
+@@ -64,7 +64,7 @@
+     if (skb->sk != NULL)
+       skb_set_owner_w(nskb, skb->sk);
+-    iph = skb->nh.iph;
++    iph = ip_hdr(skb);
+     skb_put(nskb, sizeof(struct min_ipenc_hdr));
+     
+@@ -78,7 +78,8 @@
+     skb = nskb;
+     
+     /* Update pointers */
+-    iph = skb->nh.iph = (struct iphdr *)skb->data;
++      skb_reset_network_header(skb);
++    iph = (struct iphdr *)skb->data;
+     ipe = (struct min_ipenc_hdr *)(skb->data + (iph->ihl << 2));
+     
+@@ -99,8 +100,8 @@
+     ip_send_check(iph);
+-    if (skb->nh.iph->id == 0)
+-      ip_select_ident(skb->nh.iph, skb->dst, NULL);
++    if (ip_hdr(skb)->id == 0)
++      ip_select_ident(ip_hdr(skb), skb->dst, NULL);
+         
+     return skb;
+ }
+@@ -108,9 +109,7 @@
+ struct sk_buff *ip_pkt_decapsulate(struct sk_buff *skb)
+ {
+     struct min_ipenc_hdr *ipe;
+-    /* skb->nh.iph is probably not set yet */
+-    struct iphdr *iph = skb->nh.iph;
+-
++    struct iphdr *iph = ip_hdr(skb);
+     ipe = (struct min_ipenc_hdr *)((char *)iph + (iph->ihl << 2));
+@@ -123,8 +122,9 @@
+           skb->len - (iph->ihl << 2) - sizeof(struct min_ipenc_hdr));
+     
+     skb_trim(skb, skb->len - sizeof(struct min_ipenc_hdr));
+-    
+-    skb->nh.iph = iph = (struct iphdr *)skb->data;
++
++      skb_reset_network_header(skb);
++    iph = (struct iphdr *)skb->data;
+     iph->tot_len = htons((ntohs(iph->tot_len) - sizeof(struct min_ipenc_hdr))); 
+     ip_send_check(iph);
+Index: aodv-uu-0.9.3/lnx/kaodv-ipenc.h
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-ipenc.h       2007-06-17 02:44:13.881835120 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-ipenc.h    2007-06-17 02:44:16.549429584 +0200
+@@ -27,6 +27,7 @@
+ #include <linux/ip.h>
+ #include <linux/skbuff.h>
+ #include <asm/byteorder.h>
++#include "kaodv-compat.h"
+ #define IPPROTO_MIPE 55
+Index: aodv-uu-0.9.3/lnx/kaodv-mod.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-mod.c 2007-06-17 02:43:33.776931992 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-mod.c      2007-06-17 02:43:39.008136728 +0200
+@@ -120,7 +120,7 @@
+                              const struct net_device *out,
+                              int (*okfn) (struct sk_buff *))
+ {
+-      struct iphdr *iph = (*skb)->nh.iph;
++      struct iphdr *iph = ip_hdr(*skb);
+       struct expl_entry e;
+       struct in_addr ifaddr, bcaddr;
+       int res = 0;
+@@ -188,7 +188,7 @@
+               if (is_gateway && iph->protocol == IPPROTO_MIPE &&
+                   iph->daddr == ifaddr.s_addr) {
+                       ip_pkt_decapsulate(*skb);
+-                      iph = (*skb)->nh.iph;
++                      iph = ip_hdr(*skb);
+                       return NF_ACCEPT;
+               }
+               /* Ignore packets generated locally or that are for this
+Index: aodv-uu-0.9.3/lnx/kaodv-mod.h
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-mod.h 2007-06-17 02:44:32.498005032 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-mod.h      2007-06-17 02:44:34.662675952 +0200
+@@ -5,6 +5,7 @@
+ #include <linux/inetdevice.h>
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
++#include "kaodv-compat.h"
+ /* Interface information */
+ struct if_info {
+Index: aodv-uu-0.9.3/lnx/kaodv-queue.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-queue.c       2007-06-17 02:45:01.513593992 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-queue.c    2007-06-17 02:45:11.534070648 +0200
+@@ -152,7 +152,7 @@
+ {
+       int status = -EINVAL;
+       struct kaodv_queue_entry *entry;
+-      struct iphdr *iph = skb->nh.iph;
++      struct iphdr *iph = ip_hdr(skb);
+       entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
+Index: aodv-uu-0.9.3/lnx/kaodv-queue.h
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-queue.h       2007-06-17 02:44:50.537262648 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-queue.h    2007-06-17 02:44:53.629792512 +0200
+@@ -21,6 +21,7 @@
+  *****************************************************************************/
+ #ifndef _KAODV_QUEUE_H
+ #define _KAODV_QUEUE_H
++#include "kaodv-compat.h"
+ #define KAODV_QUEUE_DROP 1
+ #define KAODV_QUEUE_SEND 2
+Index: aodv-uu-0.9.3/lnx/kaodv-netlink.c
+===================================================================
+--- aodv-uu-0.9.3.orig/lnx/kaodv-netlink.c     2007-06-17 02:47:48.927143264 +0200
++++ aodv-uu-0.9.3/lnx/kaodv-netlink.c  2007-06-17 02:49:11.604574384 +0200
+@@ -338,8 +338,10 @@
+       netlink_register_notifier(&kaodv_nl_notifier);
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14))
+       kaodvnl = netlink_kernel_create(NETLINK_AODV, kaodv_netlink_rcv_sk);
+-#else
++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
+       kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, THIS_MODULE);
++#else
++      kaodvnl = netlink_kernel_create(NETLINK_AODV, AODVGRP_MAX, kaodv_netlink_rcv_sk, NULL, THIS_MODULE);
+ #endif
+       if (kaodvnl == NULL) {
+               printk(KERN_ERR "kaodv_netlink: failed to create netlink socket\n");
diff --git a/net/aoetools/Makefile b/net/aoetools/Makefile
new file mode 100644 (file)
index 0000000..10aac87
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2007-2014 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:=aoetools
+PKG_VERSION:=32
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/aoetools
+PKG_MD5SUM:=62c8b5664d413019d0008f27ab5dc4d1
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aoetools
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=ATA over Ethernet tools
+  URL:=http://aoetools.sourceforge.net/
+  DEPENDS:=+kmod-aoe +libpthread
+endef
+
+define Package/aoetools/description
+       The aoetools are programs for users of the ATA over Ethernet (AoE)
+       network storage protocol, a simple protocol for using storage over an
+       ethernet LAN. The vblade program (storage target) exports a block
+       device using AoE.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)"
+
+define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/aoe-{discover,flush,interfaces,mkdevs,mkshelf,revalidate,sancheck,stat,version} \
+               $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/aoe{cfg,ping} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/net/apcupsd/Makefile b/net/apcupsd/Makefile
new file mode 100644 (file)
index 0000000..8816a7a
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# 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:=apcupsd
+PKG_VERSION:=3.14.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/apcupsd
+PKG_MD5SUM:=bb2f8e4fc6b2f5d7b3e236eb57b81640
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/apcupsd
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpthread +libusb-compat
+  TITLE:=UPS control software
+  URL:=http://www.apcupsd.org/
+endef
+
+define Build/Configure
+       $(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/
+       $(call Build/Configure/Default, \
+               --with-distname=unknown \
+               --sysconfdir=/etc/apcupsd \
+               --enable-usb \
+               --without-x \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               LD="$(TARGET_CC)" \
+               all install
+endef
+
+define Package/apcupsd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcupsd $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smtp $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apctest $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcaccess $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/apcupsd
+       $(INSTALL_CONF) ./files/apcupsd.conf $(1)/etc/apcupsd/
+       $(INSTALL_CONF) ./files/apcupsd_mail.conf $(1)/etc/apcupsd/
+       $(INSTALL_BIN) ./files/changeme $(1)/etc/apcupsd/
+       $(INSTALL_BIN) ./files/commfailure $(1)/etc/apcupsd/
+       $(INSTALL_BIN) ./files/commok $(1)/etc/apcupsd/
+       $(INSTALL_BIN) ./files/offbattery $(1)/etc/apcupsd/
+       $(INSTALL_BIN) ./files/onbattery $(1)/etc/apcupsd/
+       $(INSTALL_BIN) ./files/apccontrol $(1)/etc/apcupsd/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN)  ./files/apcupsd.init $(1)/etc/init.d/apcupsd
+endef
+
+define Package/apcupsd/conffiles
+/etc/apcupsd/apcupsd.conf
+/etc/apcupsd/apcupsd_mail.conf
+/etc/apcupsd/changeme
+/etc/apcupsd/commfailure
+/etc/apcupsd/commok
+/etc/apcupsd/offbattery
+/etc/apcupsd/onbattery
+endef
+
+$(eval $(call BuildPackage,apcupsd))
diff --git a/net/apcupsd/files/apccontrol b/net/apcupsd/files/apccontrol
new file mode 100644 (file)
index 0000000..2549354
--- /dev/null
@@ -0,0 +1,146 @@
+#!/bin/sh
+#
+# Copyright (C) 1999-2002 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
+#
+#  for apcupsd release 3.14.1 (04 May 2007) - unknown
+#
+# platforms/apccontrol.  Generated from apccontrol.in by configure.
+#
+#  Note, this is a generic file that can be used by most
+#   systems. If a particular system needs to have something
+#   special, start with this file, and put a copy in the
+#   platform subdirectory.
+#
+
+#
+# These variables are needed for set up the autoconf other variables.
+#
+prefix=/usr
+exec_prefix=/usr
+
+APCPID=/var/run/apcupsd.pid
+APCUPSD=/usr/sbin/apcupsd
+SHUTDOWN=/sbin/shutdown
+SCRIPTSHELL=/bin/sh
+SCRIPTDIR=/etc/apcupsd
+WALL=true
+
+#
+# Concatenate all output from this script to the events file
+#  Note, the following kills the script in a power fail situation
+#   where the disks are mounted read-only.
+# exec >>/var/log/apcupsd.events 2>&1
+
+#
+# This piece is to substitute the default behaviour with your own script,
+# perl, or C program.
+# You can customize every single command creating an executable file (may be a
+# script or a compiled program) and calling it the same as the $1 parameter
+# passed by apcupsd to this script.
+#
+# After executing your script, apccontrol continues with the default action.
+# If you do not want apccontrol to continue, exit your script with exit 
+# code 99. E.g. "exit 99".
+#
+# WARNING: the apccontrol file will be overwritten every time you update your
+# apcupsd, doing `make install'. Your own customized scripts will _not_ be
+# overwritten. If you wish to make changes to this file (discouraged), you
+# should change apccontrol.sh.in and then rerun the configure process.
+#
+if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ]
+then
+    ${SCRIPTDIR}/${1} ${2} ${3} ${4}
+    # exit code 99 means he does not want us to do default action
+    if [ $? = 99 ] ; then
+       exit 0
+    fi
+fi
+
+case "$1" in
+    killpower)
+       echo "Apccontrol doing: ${APCUPSD} --killpower on UPS ${2}"
+       sleep 10
+       ${APCUPSD} --killpower
+       echo "Apccontrol has done: ${APCUPSD} --killpower on UPS ${2}" | ${WALL}
+    ;;
+    commfailure)
+       echo "Warning communications lost with UPS ${2}" | ${WALL}
+    ;;
+    commok)
+       echo "Communications restored with UPS ${2}" | ${WALL}
+    ;;
+#
+# powerout, onbattery, offbattery, mainsback events occur
+#   in that order.
+#
+    powerout)
+       echo "Warning power loss detected on UPS ${2}" | ${WALL}
+    ;;
+    onbattery)
+       echo "Power failure on UPS ${2}. Running on batteries." | ${WALL}
+    ;;
+    offbattery)
+    ;;
+    mainsback)
+       echo "Power has returned on UPS ${2}..." | ${WALL}
+       if [ -f /etc/powerfail ] ; then
+          printf "Continuing with shutdown."  | ${WALL}
+       fi
+    ;;
+    failing)
+       echo "Battery power exhaused on UPS ${2}. Doing shutdown." | ${WALL}
+    ;;
+    timeout)
+       echo "Battery time limit exceeded on UPS ${2}. Doing shutdown." | ${WALL}
+    ;;
+    loadlimit)
+       echo "Remaining battery charge below limit on UPS ${2}. Doing shutdown." | ${WALL}
+    ;;
+    runlimit)
+       echo "Remaining battery runtime below limit on UPS ${2}. Doing shutdown." | ${WALL}
+    ;;
+    doreboot)
+       echo "UPS ${2} initiating Reboot Sequence" | ${WALL}
+       ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot"
+    ;;
+    doshutdown)
+       echo "UPS ${2} initiated Shutdown Sequence" | ${WALL}
+       ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown"
+    ;;
+    annoyme)
+       echo "Power problems with UPS ${2}. Please logoff." | ${WALL}
+    ;;
+    emergency)
+       echo "Emergency Shutdown. Possible battery failure on UPS ${2}." | ${WALL}
+    ;;
+    changeme)
+       echo "Emergency! Batteries have failed on UPS ${2}. Change them NOW" | ${WALL}
+    ;;
+    remotedown)
+       echo "Remote Shutdown. Beginning Shutdown Sequence." | ${WALL}
+    ;;
+    restartme)
+       echo -n "Restarting APCUPSD Power Management: "
+       THEPID=`cat ${APCPID}`
+       kill ${THEPID}
+       rm -f ${APCPID}
+       rm -f /etc/powerfail
+       rm -f /etc/nologin
+       sleep 5
+       `${APCUPSD}`
+       echo "apcupsd"
+    ;;
+    startselftest)
+    ;;
+    endselftest)
+    ;;
+    battdetach)
+    ;;
+    battattach)
+    ;;
+    *) echo "Usage: ${0##*/} command"
+       echo "       warning: this script is intended to be launched by"
+       echo "       apcupsd and should never be launched by users."
+       exit 1
+    ;;
+esac
diff --git a/net/apcupsd/files/apcupsd.conf b/net/apcupsd/files/apcupsd.conf
new file mode 100644 (file)
index 0000000..b9acd61
--- /dev/null
@@ -0,0 +1,322 @@
+## apcupsd.conf v1.1 ##
+# 
+#  for apcupsd release 3.14.1 (04 May 2007) - unknown
+#
+# "apcupsd" POSIX config file
+
+#
+# ========= General configuration parameters ============
+#
+
+# UPSNAME xxx
+#   Use this to give your UPS a name in log files and such. This
+#   is particulary useful if you have multiple UPSes. This does not
+#   set the EEPROM. It should be 8 characters or less.
+UPSNAME ups1
+
+# UPSCABLE <cable>
+#   Defines the type of cable connecting the UPS to your computer.
+#
+#   Possible generic choices for <cable> are:
+#     simple, smart, ether, usb
+#
+#   Or a specific cable model number may be used:
+#     940-0119A, 940-0127A, 940-0128A, 940-0020B,
+#     940-0020C, 940-0023A, 940-0024B, 940-0024C,
+#     940-1524C, 940-0024G, 940-0095A, 940-0095B,
+#     940-0095C, M-04-02-2000
+#
+UPSCABLE smart
+
+# To get apcupsd to work, in addition to defining the cable
+# above, you must also define a UPSTYPE, which corresponds to
+# the type of UPS you have (see the Description for more details).
+# You must also specify a DEVICE, sometimes referred to as a port.
+# For USB UPSes, please leave the DEVICE directive blank. For
+# other UPS types, you must specify an appropriate port or address.
+#
+# UPSTYPE   DEVICE           Description
+# apcsmart  /dev/tty**       Newer serial character device,
+#                            appropriate for SmartUPS models using
+#                            a serial cable (not USB).
+#
+# usb       <BLANK>          Most new UPSes are USB. A blank DEVICE
+#                            setting enables autodetection, which is
+#                            the best choice for most installations.
+#
+# net       hostname:port    Network link to a master apcupsd
+#                            through apcupsd's Network Information
+#                            Server. This is used if you don't have
+#                            a UPS directly connected to your computer.
+#
+# snmp      hostname:port:vendor:community
+#                            SNMP Network link to an SNMP-enabled
+#                            UPS device. Vendor is the MIB used by
+#                            the UPS device: can be "APC", "APC_NOTRAP"
+#                            or "RFC" where APC is the powernet MIB,
+#                            "APC_NOTRAP" is powernet with SNMP trap
+#                            catching disabled, and RFC is the IETF's 
+#                            rfc1628 UPS-MIB. You usually want "APC".
+#                            Port is usually 161. Community is usually
+#                            "private".
+#
+# dumb      /dev/tty**       Old serial character device for use 
+#                            with simple-signaling UPSes.
+#
+# pcnet    ipaddr:username:passphrase
+#                            PowerChute Network Shutdown protocol
+#                            which can be used as an alternative to SNMP
+#                            with AP9617 family of smart slot cards.
+#                            ipaddr is the IP address of the UPS mgmt
+#                            card. username and passphrase are the
+#                            credentials for which the card has been
+#                            configured.
+#
+UPSTYPE apcsmart
+DEVICE /dev/ttyS0
+
+
+# LOCKFILE <path to lockfile>
+#   Path for device lock file. Not used on Win32.
+LOCKFILE /var/lock
+
+# SCRIPTDIR <path to script directory>
+#   Directory in which apccontrol and event scripts are located.
+SCRIPTDIR /etc/apcupsd
+
+# PWRFAILDIR <path to powerfail directory>
+#   Directory in which to write the powerfail flag file. This file
+#   is created when apcupsd initiates a system shutdown and is
+#   checked in the OS halt scripts to determine if a killpower
+#   (turning off UPS output power) is required.
+PWRFAILDIR /etc
+
+# NOLOGINDIR <path to nologin directory>
+#   Directory in which to write the nologin file. The existence
+#   of this flag file tells the OS to disallow new logins.
+NOLOGINDIR /etc
+
+
+#
+# ======== Configuration parameters used during power failures ==========
+#
+
+# The ONBATTERYDELAY is the time in seconds from when a power failure
+#   is detected until we react to it with an onbattery event.
+#
+#   This means that, apccontrol will be called with the powerout argument
+#   immediately when a power failure is detected.  However, the
+#   onbattery argument is passed to apccontrol only after the 
+#   ONBATTERYDELAY time.  If you don't want to be annoyed by short
+#   powerfailures, make sure that apccontrol powerout does nothing
+#   i.e. comment out the wall.
+#ONBATTERYDELAY 6
+
+# 
+# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
+# the first that occurs will cause the initation of a shutdown.
+#
+
+# If during a power failure, the remaining battery percentage
+# (as reported by the UPS) is below or equal to BATTERYLEVEL, 
+# apcupsd will initiate a system shutdown.
+BATTERYLEVEL 5
+
+# If during a power failure, the remaining runtime in minutes 
+# (as calculated internally by the UPS) is below or equal to MINUTES,
+# apcupsd, will initiate a system shutdown.
+MINUTES 3
+
+# If during a power failure, the UPS has run on batteries for TIMEOUT
+# many seconds or longer, apcupsd will initiate a system shutdown.
+# A value of 0 disables this timer.
+#
+#  Note, if you have a Smart UPS, you will most likely want to disable
+#    this timer by setting it to zero. That way, you UPS will continue
+#    on batteries until either the % charge remaing drops to or below BATTERYLEVEL,
+#    or the remaining battery runtime drops to or below MINUTES.  Of course,
+#    if you are testing, setting this to 60 causes a quick system shutdown
+#    if you pull the power plug.   
+#  If you have an older dumb UPS, you will want to set this to less than
+#    the time you know you can run on batteries.
+TIMEOUT 0
+
+#  Time in seconds between annoying users to signoff prior to
+#  system shutdown. 0 disables.
+ANNOY 300
+
+# Initial delay after power failure before warning users to get
+# off the system.
+ANNOYDELAY 60
+
+# The condition which determines when users are prevented from
+# logging in during a power failure.
+# NOLOGON <string> [ disable | timeout | percent | minutes | always ]
+NOLOGON disable
+
+# If KILLDELAY is non-zero, apcupsd will continue running after a
+# shutdown has been requested, and after the specified time in
+# seconds attempt to kill the power. This is for use on systems
+# where apcupsd cannot regain control after a shutdown.
+# KILLDELAY <seconds>  0 disables
+KILLDELAY 0
+
+#
+# ==== Configuration statements for Network Information Server ====
+#
+
+# NETSERVER [ on | off ] on enables, off disables the network
+#  information server. If netstatus is on, a network information
+#  server process will be started for serving the STATUS and
+#  EVENT data over the network (used by CGI programs).
+NETSERVER on
+
+# NISIP <dotted notation ip address>
+#  IP address on which NIS server will listen for incoming connections.
+#  This is useful if your server is multi-homed (has more than one
+#  network interface and IP address). Default value is 0.0.0.0 which
+#  means any incoming request will be serviced. Alternatively, you can
+#  configure this setting to any specific IP address of your server and 
+#  NIS will listen for connections only on that interface. Use the
+#  loopback address (127.0.0.1) to accept connections only from the
+#  local machine.
+NISIP 0.0.0.0
+
+# NISPORT <port> default is 3551 as registered with the IANA
+#  port to use for sending STATUS and EVENTS data over the network.
+#  It is not used unless NETSERVER is on. If you change this port,
+#  you will need to change the corresponding value in the cgi directory
+#  and rebuild the cgi programs.
+NISPORT 3551
+
+# If you want the last few EVENTS to be available over the network
+# by the network information server, you must define an EVENTSFILE.
+EVENTSFILE /var/log/apcupsd.events
+
+# EVENTSFILEMAX <kilobytes>
+#  By default, the size of the EVENTSFILE will be not be allowed to exceed
+#  10 kilobytes.  When the file grows beyond this limit, older EVENTS will
+#  be removed from the beginning of the file (first in first out).  The
+#  parameter EVENTSFILEMAX can be set to a different kilobyte value, or set
+#  to zero to allow the EVENTSFILE to grow without limit.
+EVENTSFILEMAX 10
+
+#
+# ========== Configuration statements used if sharing =============
+#            a UPS with more than one machine
+
+# NETTIME <int>
+#   Interval (in seconds) at which the NIS client polls the server.
+#   Used only when this apcupsd is a network client (UPSTYPE net).
+#NETTIME 60
+
+#
+# Remaining items are for ShareUPS (APC expansion card) ONLY
+#
+
+# UPSCLASS [ standalone | shareslave | sharemaster ]
+#   Normally standalone unless you share an UPS using an APC ShareUPS
+#   card.
+UPSCLASS standalone
+
+# UPSMODE [ disable | share ]
+#   Normally disable unless you share an UPS using an APC ShareUPS card.
+UPSMODE disable
+
+#
+# ===== Configuration statements to control apcupsd system logging ========
+#
+
+# Time interval in seconds between writing the STATUS file; 0 disables
+STATTIME 0
+
+# Location of STATUS file (written to only if STATTIME is non-zero)
+STATFILE /var/log/apcupsd.status
+
+# LOGSTATS [ on | off ] on enables, off disables
+# Note! This generates a lot of output, so if         
+#       you turn this on, be sure that the
+#       file defined in syslog.conf for LOG_NOTICE is a named pipe.
+#  You probably do not want this on.
+LOGSTATS off
+
+# Time interval in seconds between writing the DATA records to
+#   the log file. 0 disables.
+DATATIME 0
+
+# FACILITY defines the logging facility (class) for logging to syslog. 
+#          If not specified, it defaults to "daemon". This is useful 
+#          if you want to separate the data logged by apcupsd from other
+#          programs.
+#FACILITY DAEMON
+
+#
+# ========== Configuration statements used in updating the UPS EPROM =========
+#
+
+#
+# These statements are used only by apctest when choosing "Set EEPROM with conf
+# file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD.
+#
+
+# UPS name, max 8 characters 
+#UPSNAME UPS_IDEN
+
+# Battery date - 8 characters
+#BATTDATE mm/dd/yy
+
+# Sensitivity to line voltage quality (H cause faster transfer to batteries)  
+# SENSITIVITY H M L        (default = H)
+#SENSITIVITY H
+
+# UPS delay after power return (seconds)
+# WAKEUP 000 060 180 300   (default = 0)
+#WAKEUP 60
+
+# UPS Grace period after request to power off (seconds)
+# SLEEP 020 180 300 600    (default = 20)
+#SLEEP 180
+
+# Low line voltage causing transfer to batteries
+# The permitted values depend on your model as defined by last letter 
+#  of FIRMWARE or APCMODEL. Some representative values are:
+#    D 106 103 100 097
+#    M 177 172 168 182
+#    A 092 090 088 086
+#    I 208 204 200 196     (default = 0 => not valid)
+#LOTRANSFER  208
+
+# High line voltage causing transfer to batteries
+# The permitted values depend on your model as defined by last letter 
+#  of FIRMWARE or APCMODEL. Some representative values are:
+#    D 127 130 133 136
+#    M 229 234 239 224
+#    A 108 110 112 114
+#    I 253 257 261 265     (default = 0 => not valid)
+#HITRANSFER 253
+
+# Battery charge needed to restore power
+# RETURNCHARGE 00 15 50 90 (default = 15)
+#RETURNCHARGE 15
+
+# Alarm delay 
+# 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never
+# BEEPSTATE 0 T L N        (default = 0)
+#BEEPSTATE T
+
+# Low battery warning delay in minutes
+# LOWBATT 02 05 07 10      (default = 02)
+#LOWBATT 2
+
+# UPS Output voltage when running on batteries
+# The permitted values depend on your model as defined by last letter 
+#  of FIRMWARE or APCMODEL. Some representative values are:
+#    D 115
+#    M 208
+#    A 100
+#    I 230 240 220 225     (default = 0 => not valid)
+#OUTPUTVOLTS 230
+
+# Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on
+# SELFTEST 336 168 ON OFF  (default = 336)
+#SELFTEST 336
diff --git a/net/apcupsd/files/apcupsd.init b/net/apcupsd/files/apcupsd.init
new file mode 100644 (file)
index 0000000..5454377
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+STOP=50
+
+start() {
+       /usr/sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
+}
+
+stop() {
+       kill $(cat /var/run/apcupsd.pid)
+}
diff --git a/net/apcupsd/files/apcupsd_mail.conf b/net/apcupsd/files/apcupsd_mail.conf
new file mode 100644 (file)
index 0000000..51206c7
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+MAILPROG="/usr/sbin/smtp"
+MAILHOST="mail:25"
+FROM="OpenWrt"
+TO="apcups@example.com"
+HOSTNAME="OpenWrt"
\ No newline at end of file
diff --git a/net/apcupsd/files/changeme b/net/apcupsd/files/changeme
new file mode 100644 (file)
index 0000000..bcf448a
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# This shell script if placed in /etc/apcupsd
+# will be called by /etc/apcupsd/apccontrol when apcupsd
+# detects that the battery should be replaced.
+# We send an email message to root to notify him.
+#
+. /etc/apcupsd/apcupsd_mail.conf
+
+MSG="$HOSTNAME UPS battery needs changing NOW."
+#
+(
+   echo "$MSG"
+   echo " "
+   /usr/sbin/apcaccess status
+) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO
+exit 0
diff --git a/net/apcupsd/files/commfailure b/net/apcupsd/files/commfailure
new file mode 100644 (file)
index 0000000..b899195
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# This shell script if placed in /etc/apcupsd
+# will be called by /etc/apcupsd/apccontrol when apcupsd
+# loses contact with the UPS (i.e. the serial connection is not responding).
+# We send an email message to root to notify him.
+#
+. /etc/apcupsd/apcupsd_mail.conf
+
+MSG="$HOSTNAME Communications with UPS lost"
+#
+(
+   echo "$MSG"
+   echo " "
+   /usr/sbin/apcaccess status
+) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO
+exit 0
diff --git a/net/apcupsd/files/commok b/net/apcupsd/files/commok
new file mode 100644 (file)
index 0000000..cd5d1c6
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# This shell script if placed in /etc/apcupsd
+# will be called by /etc/apcupsd/apccontrol when apcupsd
+# restores contact with the UPS (i.e. the serial connection is restored).
+# We send an email message to root to notify him.
+#
+. /etc/apcupsd/apcupsd_mail.conf
+
+MSG="$HOSTNAME Communications with UPS restored"
+#
+(
+   echo "$MSG"
+   echo " "
+   /usr/sbin/apcaccess status
+) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO
+exit 0
diff --git a/net/apcupsd/files/offbattery b/net/apcupsd/files/offbattery
new file mode 100644 (file)
index 0000000..22c0b98
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# This shell script if placed in /etc/apcupsd
+# will be called by /etc/apcupsd/apccontrol when the    
+# UPS goes back on to the mains after a power failure.
+# We send an email message to root to notify him.
+#
+. /etc/apcupsd/apcupsd_mail.conf
+
+MSG="$HOSTNAME Power has returned"
+#
+(
+   echo "$MSG"
+   echo " "
+   /usr/sbin/apcaccess status
+) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO
+exit 0
diff --git a/net/apcupsd/files/onbattery b/net/apcupsd/files/onbattery
new file mode 100644 (file)
index 0000000..ee5f653
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# This shell script if placed in /etc/apcupsd
+# will be called by /etc/apcupsd/apccontrol when the UPS
+# goes on batteries.
+# We send an email message to root to notify him.
+#
+. /etc/apcupsd/apcupsd_mail.conf
+
+MSG="$HOSTNAME Power Failure !!!"
+#
+(
+   echo "$MSG"
+   echo " "
+   /usr/sbin/apcaccess status
+) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO
+exit 0
diff --git a/net/apcupsd/patches/010-fix-include-paths.patch b/net/apcupsd/patches/010-fix-include-paths.patch
new file mode 100644 (file)
index 0000000..2151544
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/autoconf/variables.mak.in b/autoconf/variables.mak.in
+index b67e467..6022434 100644
+--- a/autoconf/variables.mak.in
++++ b/autoconf/variables.mak.in
+@@ -65,7 +65,7 @@ DRVLIBS = @PTHREAD_LFLAGS@ @DRVLIBS@
+ X_LIBS = @X_LIBS@
+ X_EXTRA_LIBS = @X_EXTRA_LIBS@
+-CPPFLAGS = @CPPFLAGS@ -I$(topdir)/include $(EXTRAINCS)
++CPPFLAGS = -I$(topdir)/include @CPPFLAGS@ $(EXTRAINCS)
+ CFLAGS = $(CPPFLAGS) @CFLAGS@ @PTHREAD_CFLAGS@
+ CXXFLAGS = $(CPPFLAGS) @CXXFLAGS@ @PTHREAD_CFLAGS@
+ LDFLAGS = @LDFLAGS@
diff --git a/net/apf/Makefile b/net/apf/Makefile
new file mode 100644 (file)
index 0000000..9e78677
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2011-2014 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:=apf
+PKG_VERSION:=0.8.4
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://gray-world.net/projects/af/
+PKG_MD5SUM:=4411785b05ec59e955152fe4e61705b1
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_VARS += \
+       LDFLAGS="$$$$LDFLAGS -lcrypto -lssl -lz"
+
+define Package/apf
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Active port forwarder
+  URL:=http://gray-world.net/pr_af.shtml
+  DEPENDS:=+libopenssl +libpthread
+endef
+
+define Package/apf/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/af{client,server} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/afclient_example.conf $(1)/etc/afclient.conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/afserver_example.conf $(1)/etc/afserver.conf
+endef
+
+define Package/apf/conffiles
+/etc/afclient.conf
+/etc/afserver.conf
+endef
+
+$(eval $(call BuildPackage,apf))
diff --git a/net/apf/patches/001-cflags_override.patch b/net/apf/patches/001-cflags_override.patch
new file mode 100644 (file)
index 0000000..80d85e9
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -28,8 +28,6 @@ AC_CONFIG_FILES([Makefile
+                  modules/Makefile
+                  src/Makefile])
+-CFLAGS="-pedantic -Wall -O2"
+-
+ # Enabling/disabling asserts and debugging
+ AC_MSG_CHECKING(whether to enable debugging)
+ AC_ARG_ENABLE(debug, [  --enable-debug=[no/yes] turn on debugging
diff --git a/net/appweb/Makefile b/net/appweb/Makefile
new file mode 100644 (file)
index 0000000..dc83165
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2009-2013 OpenWrt.org
+# Copyright (C) 2009 Embedthis Software
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Commercial and other licenses are available from http://www.embedthis.com/.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=appweb
+PKG_RELEASE:=2
+
+#
+#      Build stable
+#
+PKG_VERSION:=3.4.1-0
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tgz
+PKG_SOURCE_URL:=http://www.appwebserver.org/software/
+PKG_MD5SUM:=23540af5852e4b0f6789bc47013d311c
+
+#
+#      Build the latest snapshot from the default trunk
+#
+#PKG_VERSION:=default
+#PKG_SOURCE:=tip.tar.gz
+#PKG_SOURCE_URL:= http://hg.embedthis.com/appweb/archive/
+#PKG_MD5SUM:=
+
+include $(INCLUDE_DIR)/package.mk
+
+# The files in the .tar.gz are
+#    src/all/...
+#    src/build/...
+#    src/test/...
+# and so on
+#
+# What we want is
+#    $(PKG_BUILD_DIR)/all/...
+#    $(PKG_BUILD_DIR)/build/...
+#    $(PKG_BUILD_DIR)/test/...
+# and so on
+#
+# The following two lines make this happen
+#    1.  change tar option to strip out the top-level, src in
+#        this case
+#    2.  change the tar output to the build directory.  The
+#        original tar command was
+#        $(HOST_TAR) -C/.. $(1) $(TAR_OPTIONS)
+
+TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
+TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
+
+define Package/appweb
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=Appweb Web Server
+  URL:=http://www.appwebserver.org/
+  DEPENDS:=@!avr32 +libpthread +libpcre +libsqlite3
+endef
+
+define Package/appweb/description
+ Appweb is a powerful, compact embedded web server designed for dynamic web
+ applications.
+endef
+
+CONFIGURE_ARGS += \
+       -q \
+       --defaults=release \
+       --shared \
+       --tune=size \
+       --without-php \
+       --without-ssl \
+       --disable-angel \
+       --disable-samples \
+       --disable-access-log \
+       --disable-complete-native \
+       --disable-complete-cross \
+       --webdir=/www \
+       --logdir=/var/log \
+       --port=8000 \
+       --sslPort=8443 \
+       --config=flat
+
+define Build/Configure
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               BLD_CC_DYN_LOAD=1
+endef
+
+define Package/appweb/install
+       ( cd $(PKG_BUILD_DIR) ; $(PKG_BUILD_DIR)/build/bin/makeInstall \
+               --root=$(1) --install --with-openwrt=1 binary )
+       rm -rf $(1)/var
+endef
+
+$(eval $(call BuildPackage,appweb))
diff --git a/net/appweb/patches/001-add-ipv6-in-configure.patch b/net/appweb/patches/001-add-ipv6-in-configure.patch
new file mode 100644 (file)
index 0000000..c927cbf
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -2503,6 +2503,8 @@ while [ "${1#--}" != "$1" ] ; do
+     #
+     #   Ignored but provided for compatibility with autoconf
+     #
++    disable-ipv6|enable-ipv6)
++      ;;
+     bindir=*|libdir=*|libexecdir=*|moddir=*)
+         ;;
+     disable-nls|enable-nls)
diff --git a/net/aprx/Makefile b/net/aprx/Makefile
new file mode 100644 (file)
index 0000000..16e98ba
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2008-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:=aprx
+PKG_REV:=421
+PKG_VERSION:=2.00_r$(PKG_REV)
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://repo.ham.fi/svn/aprx/trunk/
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=svn
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aprx
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=APRS RX only I-gate
+  URL:=http://ham.zmailer.org/oh2mqk/aprx/
+endef
+
+define Package/aprx/description
+       This daemon listens for traffic on the specified serial interfaces.
+       It then forwards appropriate packets to APRS-IS servers.
+endef
+
+CONFIGURE_ARGS += \
+       --with-embedded \
+
+define Package/aprx/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/aprx.init $(1)/etc/init.d/aprx
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/aprx.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/aprx $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/aprx-stat $(1)/usr/sbin/
+endef
+
+define Package/aprx/conffiles
+/etc/aprx.conf
+endef
+
+$(eval $(call BuildPackage,aprx))
diff --git a/net/aprx/files/aprx.init b/net/aprx/files/aprx.init
new file mode 100644 (file)
index 0000000..9682eee
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=99
+
+SERVICE_USE_PID=1
+
+start() {
+       mkdir -m 0755 -p /var/log/aprx
+       service_start /usr/sbin/aprx
+}
+
+stop() {
+       service_stop /usr/sbin/aprx
+}
diff --git a/net/aprx/patches/100-Makefile_in.patch b/net/aprx/patches/100-Makefile_in.patch
new file mode 100644 (file)
index 0000000..cb06f79
--- /dev/null
@@ -0,0 +1,27 @@
+diff -ruN aprx-2.00_r421.orig/Makefile.in aprx-2.00_r421/Makefile.in
+--- aprx-2.00_r421.orig/Makefile.in    2010-06-19 15:13:47.000000000 +0000
++++ aprx-2.00_r421/Makefile.in 2010-08-22 00:14:35.000000000 +0000
+@@ -27,8 +27,9 @@
+ CFLAGS=               @CFLAGS@
+ # Linker and flags
+-LD=           @LD@
++LD=           @CC@
+ LDFLAGS=      @LDFLAGS@ $(PROF)
++datarootdir = @datarootdir@
+ INSTALL=      $(srcdir)/install-sh
+ INSTALL_PROGRAM=$(INSTALL)  -m 755
+@@ -89,10 +90,10 @@
+ $(PROGAPRX):  $(OBJSAPRX) VERSION Makefile
+-              $(LD) $(LDFLAGS) -o $@ $(OBJSAPRX) $(LIBS)
++              $(CC) $(CFLAGS) -o $@ $(OBJSAPRX) $(LIBS)
+ $(PROGSTAT):  $(OBJSSTAT) VERSION Makefile
+-              $(LD) $(LDFLAGS) -o $@ $(OBJSSTAT) $(LIBS)
++              $(CC) $(CFLAGS) -o $@ $(OBJSSTAT) $(LIBS)
+ .PHONY:               man
+ man:          $(MAN)
diff --git a/net/arpd/Makefile b/net/arpd/Makefile
new file mode 100644 (file)
index 0000000..c0cf110
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006-2014 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:=arpd
+PKG_VERSION:=0.2
+PKG_RELEASE:=3
+
+PKG_MD5SUM:=e2911fa9de1b92ef50deda1489ae944d
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://niels.xtdnet.nl/honeyd
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/arpd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libdnet +libevent2 +librt
+  TITLE:=A daemon to fake ARP replies
+  URL:=http://niels.xtdnet.nl/honeyd/
+endef
+
+define Build/Configure
+        (cd $(PKG_BUILD_DIR); touch \
+               stamp-h.in \
+               config.h.in \
+       );
+       $(call Build/Configure/Default, \
+               --with-libdnet="$(STAGING_DIR)/usr" \
+               --with-libevent="$(STAGING_DIR)/usr" \
+               --with-libpcap="$(STAGING_DIR)/usr" \
+       )
+endef
+
+MAKE_FLAGS += \
+       INCLUDES="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+       LIBS="$(TARGET_LDFLAGS) -lpcap -ldnet -levent"
+
+define Package/arpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/arpd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,arpd))
diff --git a/net/arpd/patches/001-configure_no_bpf.patch b/net/arpd/patches/001-configure_no_bpf.patch
new file mode 100644 (file)
index 0000000..7113b45
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/configure
++++ b/configure
+@@ -2258,8 +2258,7 @@ echo "${ECHO_T}$withval" >&6
+         if cd $withval; then withval=`pwd`; cd $owd; fi
+         PCAPINC="-I$withval -I$withval/bpf"
+         PCAPLIB="-L$withval -lpcap"
+-     elif test -f $withval/include/pcap.h -a \
+-               -f $withval/include/net/bpf.h; then
++     elif test -f $withval/include/pcap.h; then
+         owd=`pwd`
+         if cd $withval; then withval=`pwd`; cd $owd; fi
+         PCAPINC="-I$withval/include"
diff --git a/net/arpd/patches/002-function_string.patch b/net/arpd/patches/002-function_string.patch
new file mode 100644 (file)
index 0000000..c2a3b41
--- /dev/null
@@ -0,0 +1,42 @@
+--- a/arpd.c
++++ b/arpd.c
+@@ -265,7 +265,7 @@ arpd_send(eth_t *eth, int op,
+           spa->addr_ip, tha->addr_eth, tpa->addr_ip);
+       
+       if (op == ARP_OP_REQUEST) {
+-              syslog(LOG_DEBUG, __FUNCTION__ ": who-has %s tell %s",
++              syslog(LOG_DEBUG, "%s: who-has %s tell %s", __FUNCTION__,
+                   addr_ntoa(tpa), addr_ntoa(spa));
+       } else if (op == ARP_OP_REPLY) {
+               syslog(LOG_INFO, "arp reply %s is-at %s",
+@@ -282,7 +282,7 @@ arpd_lookup(struct addr *addr)
+       int error;
+       if (addr_cmp(addr, &arpd_ifent.intf_addr) == 0) {
+-              syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
++              syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
+                   addr_ntoa(addr), addr_ntoa(&arpd_ifent.intf_link_addr));
+               return (0);
+       }
+@@ -291,10 +291,10 @@ arpd_lookup(struct addr *addr)
+       error = arp_get(arpd_arp, &arpent);
+       
+       if (error == -1) {
+-              syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s",
++              syslog(LOG_DEBUG, "%s: no entry for %s", __FUNCTION__,
+                   addr_ntoa(addr));
+       } else {
+-              syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
++              syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
+                   addr_ntoa(addr), addr_ntoa(&arpent.arp_ha));
+       }
+       return (error);
+@@ -423,7 +423,7 @@ arpd_recv_cb(u_char *u, const struct pca
+               if ((req = SPLAY_FIND(tree, &arpd_reqs, &tmp)) != NULL) {
+                       addr_pack(&src.arp_ha, ADDR_TYPE_ETH, ETH_ADDR_BITS,
+                           ethip->ar_sha, ETH_ADDR_LEN);
+-                      syslog(LOG_DEBUG, __FUNCTION__ ": %s at %s",
++                      syslog(LOG_DEBUG, "%s: %s at %s", __FUNCTION__,
+                           addr_ntoa(&req->pa), addr_ntoa(&src.arp_ha));
+                       
+                       /* This address is claimed */
diff --git a/net/arpd/patches/003-pcap_and_arg.patch b/net/arpd/patches/003-pcap_and_arg.patch
new file mode 100644 (file)
index 0000000..c48b8f4
--- /dev/null
@@ -0,0 +1,76 @@
+--- a/arpd.c
++++ b/arpd.c
+@@ -70,7 +70,7 @@ static int                    arpd_sig;
+ static void
+ usage(void)
+ {
+-      fprintf(stderr, "Usage: arpd [-d] [-i interface] [net]\n");
++      fprintf(stderr, "Usage: arpd [-d] [-i interface] [-a 'pcap_expr'] [{host|net|range} ...]\n");
+       exit(1);
+ }
+@@ -182,7 +182,7 @@ arpd_expandips(int naddresses, char **ad
+ }
+ static void
+-arpd_init(char *dev, int naddresses, char **addresses)
++arpd_init(char *dev, char *and_pcap_exp, int naddresses, char **addresses)
+ {
+       struct bpf_program fcode;
+       char filter[1024], ebuf[PCAP_ERRBUF_SIZE], *dst;
+@@ -214,9 +214,13 @@ arpd_init(char *dev, int naddresses, cha
+               errx(1, "bad interface configuration: not IP or Ethernet");
+       arpd_ifent.intf_addr.addr_bits = IP_ADDR_BITS;
+       
+-      snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s",
++      snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s%s%s%s",
+           dst ? "and (" : "", dst ? dst : "", dst ? ")" : "",
+-          addr_ntoa(&arpd_ifent.intf_link_addr));
++          addr_ntoa(&arpd_ifent.intf_link_addr),
++          and_pcap_exp ? " and (" : "",
++          and_pcap_exp ? and_pcap_exp : "",
++          and_pcap_exp ? ")" : ""
++          );
+       
+       if ((arpd_pcap = pcap_open_live(dev, 128, 0, 500, ebuf)) == NULL)
+               errx(1, "pcap_open_live: %s", ebuf);
+@@ -465,14 +469,15 @@ main(int argc, char *argv[])
+ {
+       struct event recv_ev;
+       extern int (*event_sigcb)(void);
+-      char *dev;
++      char *dev, *and_pcap_exp;
+       int c, debug;
+       FILE *fp;
+       dev = NULL;
++      and_pcap_exp = NULL;
+       debug = 0;
+       
+-      while ((c = getopt(argc, argv, "di:h?")) != -1) {
++      while ((c = getopt(argc, argv, "a:di:h?")) != -1) {
+               switch (c) {
+               case 'd':
+                       debug = 1;
+@@ -480,6 +485,9 @@ main(int argc, char *argv[])
+               case 'i':
+                       dev = optarg;
+                       break;
++              case 'a':
++                      and_pcap_exp = optarg;
++                      break;
+               default:
+                       usage();
+                       break;
+@@ -489,9 +497,9 @@ main(int argc, char *argv[])
+       argv += optind;
+       if (argc == 0)
+-              arpd_init(dev, 0, NULL);
++              arpd_init(dev, and_pcap_exp, 0, NULL);
+       else
+-              arpd_init(dev, argc, argv);
++              arpd_init(dev, and_pcap_exp, argc, argv);
+       
+       if ((fp = fopen(PIDFILE, "w")) == NULL)
+               err(1, "fopen");
diff --git a/net/arpd/patches/004-no_dnet_config_check.patch b/net/arpd/patches/004-no_dnet_config_check.patch
new file mode 100644 (file)
index 0000000..c3ebc12
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/configure
++++ b/configure
+@@ -2170,8 +2170,7 @@ echo "${ECHO_T}$withval" >&6
+         DNETLIB="`$withval/bin/dnet-config --libs`"
+      else
+         { { echo "$as_me:2172: error: dnet-config not found in $withval/bin" >&5
+-echo "$as_me: error: dnet-config not found in $withval/bin" >&2;}
+-   { (exit 1); exit 1; }; }
++echo "$as_me: error: dnet-config not found in $withval/bin" >&2;} }
+      fi
+      ;;
+   esac
diff --git a/net/arpd/patches/005-remove-dropped-libevent-features.patch b/net/arpd/patches/005-remove-dropped-libevent-features.patch
new file mode 100644 (file)
index 0000000..0936345
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/arpd.c
++++ b/arpd.c
+@@ -449,9 +449,6 @@ arpd_recv(int fd, short type, void *ev)
+ void
+ terminate_handler(int sig)
+ {
+-      extern int event_gotsig;
+-
+-      event_gotsig = 1;
+       arpd_sig = sig;
+ }
+@@ -468,7 +465,6 @@ int
+ main(int argc, char *argv[])
+ {
+       struct event recv_ev;
+-      extern int (*event_sigcb)(void);
+       char *dev, *and_pcap_exp;
+       int c, debug;
+       FILE *fp;
+@@ -532,8 +528,6 @@ main(int argc, char *argv[])
+               perror("signal");
+               return (-1);
+       }
+-      event_sigcb = arpd_signal;
+-      
+       event_dispatch();
+       return (0);
diff --git a/net/arpwatch/Makefile b/net/arpwatch/Makefile
new file mode 100644 (file)
index 0000000..20b1959
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# 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:=arpwatch
+PKG_VERSION:=2.1a15
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.free.fr/.mirrors1/ftp.gentoo.org/distfiles/
+PKG_MD5SUM:=cebfeb99c4a7c2a6cee2564770415fe7
+
+# use a subdirectory to prevent configure for finding libpcap build dir
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/arpwatch
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap
+  TITLE:=Ethernet station activity monitor
+  URL:=http://www-nrg.ee.lbl.gov/
+endef
+
+define Package/arpwatch/description
+       Ethernet monitor program for keeping track of ethernet/ip address
+       pairings.
+endef
+
+define Package/arpwatch/conffiles
+/etc/arpwatch/arp.dat
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       chmod -R u+w $(PKG_BUILD_DIR)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               ARPDIR=/etc/arpwatch \
+               CCOPT="$(TARGET_CFLAGS)" \
+               INCLS="-I. $(TARGET_CPPFLAGS)" \
+               LIBS="$(TARGET_LDFLAGS) -lpcap"
+endef
+
+define Package/arpwatch/install
+       $(INSTALL_DIR) $(1)/etc/arpwatch
+       $(CP) $(PKG_BUILD_DIR)/arp.dat $(1)/etc/arpwatch/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/arp{watch,snmp} $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/arpwatch.init $(1)/etc/init.d/arpwatch
+endef
+
+$(eval $(call BuildPackage,arpwatch))
diff --git a/net/arpwatch/files/arpwatch.init b/net/arpwatch/files/arpwatch.init
new file mode 100644 (file)
index 0000000..b05692b
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=90
+
+start() {
+       service_start /usr/sbin/arpwatch -f /etc/arpwatch/arp.dat -i br-lan
+}
+
+stop() {
+       service_stop /usr/sbin/arpwatch
+}
diff --git a/net/atftp/Makefile b/net/atftp/Makefile
new file mode 100644 (file)
index 0000000..c33a99d
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2006-2014 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:=atftp
+PKG_VERSION:=0.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/distfiles/
+PKG_MD5SUM:=3b27365772d918050b2251d98a9c7c82
+
+PKG_BUILD_DEPENDS:=libncurses libpcre libreadline
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/atftp/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=TFTP
+  SUBMENU:=File Transfer
+endef
+
+define Package/atftp
+  $(call Package/atftp/Default)
+  DEPENDS:=+libreadline +libncurses
+  TITLE+= client
+endef
+
+define Package/atftpd
+  $(call Package/atftp/Default)
+  DEPENDS:=+libpcre +libpthread
+  TITLE+= server
+endef
+
+CONFIGURE_ARGS += \
+       --disable-libwrap
+CONFIGURE_VARS += \
+       LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_CFLAGS)"
+
+ifdef CONFIG_USE_EGLIBC
+  TARGET_CFLAGS += -DHAVE_ARGZ=1
+
+  define Build/Prepare
+       $(Build/Prepare/Default)
+       echo '#include_next <argz.h>' > $(PKG_BUILD_DIR)/argz.h
+  endef
+endif
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -Wall -D_REENTRANT" \
+       all
+
+define Package/atftp/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/atftp $(1)/usr/sbin/
+endef
+
+define Package/atftpd/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/atftpd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,atftp))
+$(eval $(call BuildPackage,atftpd))
diff --git a/net/atftp/patches/100-mconfig.patch b/net/atftp/patches/100-mconfig.patch
new file mode 100644 (file)
index 0000000..01c1e36
--- /dev/null
@@ -0,0 +1,21 @@
+Index: atftp-0.7/MCONFIG
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ atftp-0.7/MCONFIG  2007-08-02 23:04:23.000000000 +0200
+@@ -0,0 +1,16 @@
++# Generated by configure (confgen version 2) on Sun Jun 19 21:13:24 CEST 2005
++#
++
++BINDIR=/usr/bin
++SBINDIR=/usr/sbin
++MANDIR=/usr/man
++BINMODE=755
++DAEMONMODE=755
++MANMODE=644
++PREFIX=/usr
++EXECPREFIX=/usr
++INSTALLROOT=
++CC=
++CFLAGS=
++LDFLAGS=
++LIBS=
diff --git a/net/atftp/patches/110-services.patch b/net/atftp/patches/110-services.patch
new file mode 100644 (file)
index 0000000..ab3e1fb
--- /dev/null
@@ -0,0 +1,79 @@
+Index: atftp-0.7/tftp.c
+===================================================================
+--- atftp-0.7.orig/tftp.c      2007-08-02 23:04:23.000000000 +0200
++++ atftp-0.7/tftp.c   2007-08-02 23:04:23.000000000 +0200
+@@ -409,7 +409,7 @@
+ int set_peer(int argc, char **argv)
+ {
+      struct hostent *host;      /* for host name lookup */
+-     struct servent *sp;        /* server entry for tftp service */
++     int port = htons(69);
+      /* sanity check */
+      if ((argc < 2) || (argc > 3))
+@@ -418,13 +418,6 @@
+           return ERR;
+      }
+-     /* get the server entry */
+-     sp = getservbyname("tftp", "udp");
+-     if (sp == 0) {
+-          fprintf(stderr, "tftp: udp/tftp, unknown service.\n");
+-          return ERR;
+-     }
+-
+      /* look up the host */
+      host = gethostbyname(argv[1]);
+      /* if valid, update s_inn structure */
+@@ -437,7 +430,7 @@
+           Strncpy(data.hostname, host->h_name,
+                   sizeof(data.hostname));
+           data.hostname[sizeof(data.hostname)-1] = 0;
+-          data.sa_peer.sin_port = sp->s_port;
++          data.sa_peer.sin_port = port;
+      } 
+      else
+      {
+@@ -448,17 +441,17 @@
+      /* get the server port */
+      if (argc == 3)
+      {
+-          sp->s_port = htons(atoi(argv[2]));
+-          if (sp->s_port < 0)
++          port = htons(atoi(argv[2]));
++          if (port < 0)
+           {
+                fprintf(stderr, "%s: bad port number.\n", argv[2]);
+                data.connected = 0;
+                return ERR;
+           }
+-          data.sa_peer.sin_port = sp->s_port;
++          data.sa_peer.sin_port = port;
+      }
+      /* copy port number to data structure */
+-     data.port = ntohs(sp->s_port);
++     data.port = ntohs(port);
+      data.connected = 1;
+      return OK;
+Index: atftp-0.7/tftpd.c
+===================================================================
+--- atftp-0.7.orig/tftpd.c     2007-08-02 23:04:23.000000000 +0200
++++ atftp-0.7/tftpd.c  2007-08-02 23:04:23.000000000 +0200
+@@ -230,14 +230,8 @@
+           /* find the port */
+           if (tftpd_port == 0)
+-          {
+-               if ((serv = getservbyname("tftp", "udp")) == NULL)
+-               {
+-                    logger(LOG_ERR, "atftpd: udp/tftp, unknown service");
+-                    exit(1);
+-               }
+-               tftpd_port = ntohs(serv->s_port);
+-          }
++               tftpd_port = htons(69);
++
+           /* initialise sockaddr_in structure */
+           memset(&sa, 0, sizeof(sa));
+           sa.sin_family = AF_INET;
diff --git a/net/atftp/patches/120-retry_setting.patch b/net/atftp/patches/120-retry_setting.patch
new file mode 100644 (file)
index 0000000..548090c
--- /dev/null
@@ -0,0 +1,121 @@
+Index: atftp-0.7/tftp.c
+===================================================================
+--- atftp-0.7.orig/tftp.c      2007-08-02 23:04:23.000000000 +0200
++++ atftp-0.7/tftp.c   2007-08-02 23:04:23.000000000 +0200
+@@ -967,6 +967,7 @@
+           { "tftp-timeout", 1, NULL, 'T'},
+           { "mode", 1, NULL, 'M'},
+           { "option", 1, NULL, 'O'},
++                { "retry", 1, NULL, 'R'},
+ #if 1
+           { "timeout", 1, NULL, 't'},
+           { "blksize", 1, NULL, 'b'},
+@@ -986,11 +987,16 @@
+      };
+      /* Support old argument until 0.8 */
+-     while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
++     while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:",
+                              options, &option_index)) != EOF)
+      {
+           switch (c)
+           {
++                case 'R':
++               snprintf(string, sizeof(string), "option retry %s", optarg);
++               make_arg(string, &ac, &av);
++               process_cmd(ac, av);
++                     break;
+           case 'g':
+                interactive = 0;
+                if ((action == PUT) || (action == MGET))
+Index: atftp-0.7/tftp_def.c
+===================================================================
+--- atftp-0.7.orig/tftp_def.c  2007-08-02 23:04:23.000000000 +0200
++++ atftp-0.7/tftp_def.c       2007-08-02 23:04:23.000000000 +0200
+@@ -37,6 +37,7 @@
+      { "timeout", "5", 0, 1 },  /* 2348, 2349, 2090.  */
+      { "blksize", "512", 0, 1 }, /* This is the default option */
+      { "multicast", "", 0, 1 }, /* structure */
++       { "retry", "5", 0, 1 },
+      { "", "", 0, 0}
+ };
+Index: atftp-0.7/tftp_def.h
+===================================================================
+--- atftp-0.7.orig/tftp_def.h  2007-08-02 23:04:23.000000000 +0200
++++ atftp-0.7/tftp_def.h       2007-08-02 23:04:23.000000000 +0200
+@@ -40,7 +40,8 @@
+ #define OPT_TIMEOUT   3
+ #define OPT_BLKSIZE   4
+ #define OPT_MULTICAST 5
+-#define OPT_NUMBER    7
++#define OPT_RETRY     6
++#define OPT_NUMBER    8
+ #define OPT_SIZE     12
+ #define VAL_SIZE     MAXLEN
+Index: atftp-0.7/tftp_file.c
+===================================================================
+--- atftp-0.7.orig/tftp_file.c 2007-08-02 23:04:23.000000000 +0200
++++ atftp-0.7/tftp_file.c      2007-08-02 23:04:23.000000000 +0200
+@@ -123,6 +123,7 @@
+      struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
+      FILE *fp = NULL;           /* the local file pointer */
+      int number_of_timeout = 0;
++       int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
+      int convert = 0;           /* if true, do netascii convertion */
+      int oacks = 0;             /* count OACK for improved error checking */
+@@ -141,7 +142,7 @@
+      int prev_block_number = 0; /* needed to support netascii convertion */
+      int temp = 0;
+-
++       
+      data->file_size = 0;
+      tftp_cancel = 0;
+      from.sin_addr.s_addr = 0;
+@@ -288,7 +289,7 @@
+                case GET_TIMEOUT:
+                     number_of_timeout++;
+                     fprintf(stderr, "timeout: retrying...\n");
+-                    if (number_of_timeout > NB_OF_RETRY)
++                    if ((num_retry > 0) && (number_of_timeout > num_retry))
+                          state = S_ABORT;
+                     else
+                          state = timeout_state;
+@@ -325,7 +326,7 @@
+                     number_of_timeout++;
+                     fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
+                             inet_ntoa(from.sin_addr), ntohs(from.sin_port));
+-                    if (number_of_timeout > NB_OF_RETRY)
++                    if ((num_retry > 0) && (number_of_timeout > num_retry))
+                          state = S_ABORT;
+                     break;
+                case ERR:
+@@ -614,6 +615,7 @@
+      struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
+      FILE *fp;                  /* the local file pointer */
+      int number_of_timeout = 0;
++       int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
+      struct stat file_stat;
+      int convert = 0;           /* if true, do netascii convertion */
+      char string[MAXLEN];
+@@ -751,7 +753,7 @@
+                case GET_TIMEOUT:
+                     number_of_timeout++;
+                     fprintf(stderr, "timeout: retrying...\n");
+-                    if (number_of_timeout > NB_OF_RETRY)
++                    if ((num_retry > 0) && (number_of_timeout > num_retry))
+                          state = S_ABORT;
+                     else
+                          state = timeout_state;
+@@ -797,7 +799,7 @@
+                     number_of_timeout++;
+                     fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
+                             inet_ntoa(from.sin_addr), ntohs(from.sin_port));
+-                    if (number_of_timeout > NB_OF_RETRY)
++                    if ((num_retry > 0) && (number_of_timeout > num_retry))
+                          state = S_ABORT;
+                     break;
+                case ERR:
diff --git a/net/atftp/patches/130-missing_include.patch b/net/atftp/patches/130-missing_include.patch
new file mode 100644 (file)
index 0000000..d607d0e
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/stats.c
++++ b/stats.c
+@@ -18,6 +18,7 @@
+ #include <limits.h>
+ #include <string.h>
++#include <time.h>
+ #include "tftp_def.h"
+ #include "stats.h"
+ #include "logger.h"
+@@ -157,8 +158,8 @@
+      logger(LOG_INFO, "  Load measurements:");
+      logger(LOG_INFO, "   User: %8.3fs  Sys:%8.3fs",
+-            (double)(s_stats.tms.tms_utime) / CLK_TCK,
+-            (double)(s_stats.tms.tms_stime) / CLK_TCK);
++            (double)(s_stats.tms.tms_utime) / CLOCKS_PER_SEC,
++            (double)(s_stats.tms.tms_stime) / CLOCKS_PER_SEC);
+      logger(LOG_INFO, "   Total:%8.3fs  CPU:%8.3f%%", 
+             (double)(tmp.tv_sec + tmp.tv_usec * 1e-6),
+             (double)(s_stats.tms.tms_utime + s_stats.tms.tms_stime) /
diff --git a/net/autossh/Makefile b/net/autossh/Makefile
new file mode 100644 (file)
index 0000000..ec6e7eb
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006-2012 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:=autossh
+PKG_VERSION:=1.4b
+PKG_RELEASE:=6
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.harding.motd.ca/autossh/
+PKG_MD5SUM:=8f9aa006f6f69e912d3c2f504622d6f7
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/autossh
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Autossh client
+  URL:=http://www.harding.motd.ca/autossh/
+  SUBMENU:=SSH
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, -f Makefile \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -D\"SSH_PATH=\\\"\$$$$(SSH)\\\"\" -D\"VER=\\\"\$$$$(VER)\\\"\"" \
+               all \
+       )
+endef
+
+define Package/autossh/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/autossh $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/autossh.init $(1)/etc/init.d/autossh
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/autossh.config $(1)/etc/config/autossh
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/autossh.hotplug $(1)/etc/hotplug.d/iface/20-autossh
+endef
+
+define Package/autossh/conffiles
+/etc/config/autossh
+endef
+
+$(eval $(call BuildPackage,autossh))
diff --git a/net/autossh/files/autossh.config b/net/autossh/files/autossh.config
new file mode 100644 (file)
index 0000000..6ec3238
--- /dev/null
@@ -0,0 +1,5 @@
+config autossh
+       option ssh      '-i /etc/dropbear/id_rsa -N -T -R 2222:localhost:22 user@host'
+       option gatetime '0'
+       option monitorport      '20000'
+       option poll     '600'
diff --git a/net/autossh/files/autossh.hotplug b/net/autossh/files/autossh.hotplug
new file mode 100644 (file)
index 0000000..4f695f4
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+# Copyright (C) 2007 OpenWrt.org
+
+/etc/init.d/autossh enabled && {
+
+       [ "$ACTION" = "ifup" ] && {
+               /etc/init.d/autossh start
+       }
+
+       [ "$ACTION" = "ifdown" ] && {
+               /etc/init.d/autossh stop
+       }
+       
+}
diff --git a/net/autossh/files/autossh.init b/net/autossh/files/autossh.init
new file mode 100644 (file)
index 0000000..f81bf4d
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2011 OpenWrt.org
+
+START=80
+
+start_instance() {
+       local section="$1"
+
+       config_get ssh "$section" 'ssh'
+       config_get gatetime "$section" 'gatetime'
+       config_get monitorport "$section" 'monitorport'
+       config_get poll "$section" 'poll'
+
+       export AUTOSSH_GATETIME="${gatetime:-30}"
+       export AUTOSSH_POLL="${poll:-600}"
+       service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh}
+}
+
+boot() {
+       return
+}
+
+start() {
+       config_load 'autossh'
+       config_foreach start_instance 'autossh'
+}
+
+stop() {
+       service_stop /usr/sbin/autossh
+}
diff --git a/net/axel/Makefile b/net/axel/Makefile
new file mode 100644 (file)
index 0000000..415dc7e
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=axel
+PKG_VERSION:=2.4
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://alioth.debian.org/frs/download.php/3015
+PKG_MD5SUM:=a2a762fce0c96781965c8f9786a3d09d
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/axel
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  TITLE:=Axel Download Accelerator
+  DEPENDS:=+libpthread
+  URL:=http://axel.alioth.debian.org/
+  MAINTAINER:=Gianluigi Tiesi <sherpya@netfarm.it>
+endef
+
+define Package/axel/description
+  Axel tries to accelerate HTTP/FTP downloading process by using multiple connections for one file.
+  It can use multiple mirrors for a download. Axel has no dependencies and is lightweight,
+  so it might be useful as a wget clone on byte-critical systems.
+endef
+
+# notes:
+#  - I'm using := and not += because it is not a standard configure script
+#  - I ask not to strip, because it should be handled by the toolchain
+CONFIGURE_ARGS := \
+       --prefix=/usr \
+       --etcdir=/etc \
+       --debug=0 \
+       --i18n=0 \
+       --strip=0
+
+define Package/axel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/axel $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/axelrc.example $(1)/etc/axelrc
+       echo "alternate_output = 1" >> $(1)/etc/axelrc
+endef
+
+define Package/axel/conffiles
+/etc/axelrc
+endef
+
+$(eval $(call BuildPackage,axel))
diff --git a/net/bahamut/Makefile b/net/bahamut/Makefile
new file mode 100644 (file)
index 0000000..a0a8be4
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2008 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:=bahamut
+PKG_VERSION:=1.8.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-release.tar.gz
+PKG_SOURCE_URL:=http://bahamut.dal.net/download
+PKG_MD5SUM:=a814a4e0ff1fabcf026ea8574b4a1e20
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bahamut
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl +zlib
+  SUBMENU:=Instant Messaging
+  TITLE:=Bahamut IRC server
+  URL:=http://bahamut.dal.net
+endef
+
+TARGET_CFLAGS += \
+       -DSYS_ERRLIST_DECLARED
+
+define Build/Configure
+       $(call Build/Configure/Default,\
+               --with-maxconnections=64 \
+               --with-openssl="$(STAGING_DIR)/usr/lib" \
+               ,\
+               ac_cv_func_dn_skipname=yes \
+               ZLIB_HOME="$(STAGING_DIR)/usr" \
+       )
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default,\
+               prefix="$(PKG_INSTALL_DIR)/usr" \
+               INSTALL_DIR="$(PKG_INSTALL_DIR)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               all \
+       )
+endef
+
+define Package/bahamut/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ircd $(1)/usr/sbin
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/*.{txt,conf} $(1)/etc/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,bahamut))
diff --git a/net/bahamut/patches/001-cross_compile.patch b/net/bahamut/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..ee398b0
--- /dev/null
@@ -0,0 +1,71 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -22,8 +22,8 @@ MV=@MV@
+ ENGINE=@SENGINE@
+ SHELL=/bin/sh
+-SUBDIRS=src doc tools
+-INSTDIRS=src doc tools
++SUBDIRS=src
++INSTDIRS=src doc
+ CLEANSUBDIRS=src tools
+ CC=@CC@
+--- a/configure
++++ b/configure
+@@ -7057,8 +7057,7 @@ echo $ECHO_N "checking for epoll_create 
+   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+ echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&2;} }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -1,8 +1,8 @@
+ CC=@CC@
+ RM=@RM@
+ MV=@MV@
+-IRCDLIBS=@LIBS@ 
+-INCLUDEDIR=-I../include
++IRCDLIBS=-lresolv -lz @LIBS@ -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
++INCLUDEDIR=-I../include -I$(STAGING_DIR)/usr/include
+ OPENSSLINC=@SSL_INCLUDES@
+ ENGINE=@SENGINE@
+ CRYPTO=@ENCRYPT_SRC@
+@@ -11,10 +11,10 @@ INSTALL_BIN=@INSTALL_PROGRAM@
+ INSTALL_DIR=@INSTALL_DIR@
+ CFLAGS=@CFLAGS@ -fno-strict-aliasing
+-RES_SRC =
++#RES_SRC =
+ #This is only for very old systems that NEED this
+-#RES_SRC = res_mkquery.c res_init.c res_comp.c
++RES_SRC = res_mkquery.c res_init.c res_comp.c
+ SOURCES = blalloc.c bsd.c channel.c clientlist.c clones.c confparse.c \
+           fdlist.c fds.c hash.c hide.c inet_addr.c ircd.c ircsprintf.c \
+@@ -22,7 +22,7 @@ SOURCES = blalloc.c bsd.c channel.c clie
+           m_who.c match.c memcount.c modules.c packet.c parse.c pcre.c \
+           probability.c res.c s_auth.c s_bsd.c s_conf.c s_debug.c s_err.c \
+           s_misc.c s_numeric.c s_serv.c s_user.c sbuf.c scache.c send.c \
+-          struct.c support.c throttle.c userban.c whowas.c zlink.c \
++          struct.c support.c throttle.c userban.c whowas.c zlink.c $(RES_SRC) \
+           $(ENGINE) $(CRYPTO)
+ OBJECTS = $(SOURCES:.c=.o) version.o
+--- a/src/res_comp.c
++++ b/src/res_comp.c
+@@ -229,7 +229,7 @@ dn_skipname(u_char *comp_dn, u_char *eom
+  * the first name on the list, not the pointer to the start of the
+  * message.
+  */
+-int staticdn_find(u_char *exp_dn, u_char *msg, u_char **dnptrs, 
++static int dn_find(u_char *exp_dn, u_char *msg, u_char **dnptrs,
+                 u_char **lastdnptr)
+ {
+     u_char *dn, *cp, **cpp;
diff --git a/net/bahamut/patches/002-glibc_fix.patch b/net/bahamut/patches/002-glibc_fix.patch
new file mode 100644 (file)
index 0000000..400caed
--- /dev/null
@@ -0,0 +1,37 @@
+--- a/include/resolv.h
++++ b/include/resolv.h
+@@ -60,7 +60,7 @@
+ #if ((__GNU_LIBRARY__ == 6) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 3))
+ # define MAXRESOLVSORT                10      /* number of net to sort on */
+-struct __res_state {
++struct state {
+       int     retrans;                /* retransmition time interval */
+       int     retry;                  /* number of times to retransmit */
+       u_long  options;                /* option flags - see below. */
+@@ -79,12 +79,9 @@ struct __res_state {
+               struct in_addr  addr;
+               u_int32_t       mask;
+       } sort_list[MAXRESOLVSORT];
++    unsigned short order[MAXSERVICES + 1];    /* search service order */
+ };
+-typedef struct __res_state *res_state;
+-
+-extern struct __res_state *__res_state(void) __attribute__ ((__const__));
+-#define _res (*__res_state())
+ #else
+@@ -101,9 +98,10 @@ struct state {
+     unsigned short order[MAXSERVICES + 1];    /* search service order */
+ };
+-extern struct state _res;
+ #endif
++extern struct state _res;
++
+ extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
+ #if ((__GNU_LIBRARY__ == 6) && (__GLIBC__ >=2) && (__GLIBC_MINOR__ >= 2))
diff --git a/net/bahamut/patches/010-dont-use-host-zlib.patch b/net/bahamut/patches/010-dont-use-host-zlib.patch
new file mode 100644 (file)
index 0000000..ef8029c
--- /dev/null
@@ -0,0 +1,16 @@
+diff --git a/configure b/configure
+index 4ef7659..c774c65 100755
+--- a/configure
++++ b/configure
+@@ -8009,11 +8009,6 @@ fi
+ # zlib test
+ # ripped from http://autoconf-archive.cryp.to/check_zlib.html
+ #
+-ZLIB_HOME=/usr/local
+-if test ! -f "${ZLIB_HOME}/include/zlib.h"
+-then
+-        ZLIB_HOME=/usr
+-fi
+ if test -n "${ZLIB_HOME}"
+ then
+         ZLIB_OLD_LDFLAGS=$LDFLAGS
diff --git a/net/bind/Makefile b/net/bind/Makefile
new file mode 100644 (file)
index 0000000..7b1f8f7
--- /dev/null
@@ -0,0 +1,199 @@
+#
+# Copyright (C) 2006-2012 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:=bind
+PKG_VERSION:=9.9.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= \
+       ftp://ftp.isc.org/isc/bind9/$(PKG_VERSION) \
+       http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/$(PKG_VERSION)
+PKG_MD5SUM:=f69757adc86776daed8e5acb0ee7c0ca
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4 libtool.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bind/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+bind-libs
+  TITLE:=bind
+  URL:=https://www.isc.org/software/bind
+  SUBMENU:=IP Addresses and Names
+endef
+
+define Package/bind-libs
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libopenssl
+  TITLE:=bind shared libraries
+  URL:=https://www.isc.org/software/bind
+endef
+
+define Package/bind-server
+  $(call Package/bind/Default)
+  TITLE+= DNS server
+endef
+
+define Package/bind-client
+  $(call Package/bind/Default)
+  TITLE+= dynamic DNS client
+endef
+
+define Package/bind-tools
+  $(call Package/bind/Default)
+  TITLE+= administration tools (all)
+endef
+
+define Package/bind-rndc
+  $(call Package/bind/Default)
+  TITLE+= administration tools (rndc and rndc-confgen only)
+endef
+
+define Package/bind-check
+  $(call Package/bind/Default)
+  TITLE+= administration tools (named-checkconf and named-checkzone only)
+endef
+
+define Package/bind-dnssec
+  $(call Package/bind/Default)
+  TITLE+= administration tools (dnssec-keygen and dnssec-signzone only)
+endef
+
+define Package/bind-host
+  $(call Package/bind/Default)
+  TITLE+= simple DNS client
+endef
+
+define Package/bind-dig
+  $(call Package/bind/Default)
+  TITLE+= DNS excavation tool
+endef
+
+export BUILD_CC="$(TARGET_CC)"
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-randomdev="/dev/urandom" \
+       --disable-threads \
+       --disable-linux-caps \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --with-libtool \
+       --with-libxml2=no \
+       --enable-epoll=yes \
+       --with-gost=no \
+       --with-gssapi=no \
+       --with-ecdsa=no \
+       --with-readline=no
+
+CONFIGURE_VARS += \
+       BUILD_CC="$(TARGET_CC)" \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/lib/dns \
+               BUILD_CC="$(HOSTCC)" \
+               CC="$(HOSTCC)" \
+               CFLAGS="-O2" \
+               LIBS="" \
+               gen
+       $(call Build/Compile/Default)
+endef
+
+define Package/bind-libs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+endef
+
+define Package/bind-server/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/bind
+       $(CP) \
+               ./files/bind/db.0 \
+               ./files/bind/db.127 \
+               ./files/bind/db.255 \
+               ./files/bind/db.local \
+               ./files/bind/db.root \
+               $(1)/etc/bind/
+       $(CP) ./files/bind/named.conf.example $(1)/etc/bind/named.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/named.init $(1)/etc/init.d/named
+       find $(1)/etc/bind/ -name ".svn" | xargs rm -rf
+endef
+
+define Package/bind-server/conffiles
+/etc/bind/db.0
+/etc/bind/db.127
+/etc/bind/db.255
+/etc/bind/db.local
+/etc/bind/db.root
+/etc/bind/named.conf
+endef
+
+define Package/bind-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nsupdate $(1)/usr/bin/
+endef
+
+define Package/bind-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/
+endef
+
+define Package/bind-rndc/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/
+endef
+
+define Package/bind-check/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/
+endef
+
+define Package/bind-dnssec/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/
+endef
+
+define Package/bind-host/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/
+endef
+
+define Package/bind-dig/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bind-libs))
+$(eval $(call BuildPackage,bind-server))
+$(eval $(call BuildPackage,bind-client))
+$(eval $(call BuildPackage,bind-tools))
+$(eval $(call BuildPackage,bind-rndc))
+$(eval $(call BuildPackage,bind-check))
+$(eval $(call BuildPackage,bind-dnssec))
+$(eval $(call BuildPackage,bind-host))
+$(eval $(call BuildPackage,bind-dig))
diff --git a/net/bind/files/bind/db.0 b/net/bind/files/bind/db.0
new file mode 100644 (file)
index 0000000..e3aabdb
--- /dev/null
@@ -0,0 +1,12 @@
+;
+; BIND reverse data file for broadcast zone
+;
+$TTL   604800
+@      IN      SOA     localhost. root.localhost. (
+                             1         ; Serial
+                        604800         ; Refresh
+                         86400         ; Retry
+                       2419200         ; Expire
+                        604800 )       ; Negative Cache TTL
+;
+@      IN      NS      localhost.
diff --git a/net/bind/files/bind/db.127 b/net/bind/files/bind/db.127
new file mode 100644 (file)
index 0000000..cd05bef
--- /dev/null
@@ -0,0 +1,13 @@
+;
+; BIND reverse data file for local loopback interface
+;
+$TTL   604800
+@      IN      SOA     localhost. root.localhost. (
+                             1         ; Serial
+                        604800         ; Refresh
+                         86400         ; Retry
+                       2419200         ; Expire
+                        604800 )       ; Negative Cache TTL
+;
+@      IN      NS      localhost.
+1.0.0  IN      PTR     localhost.
diff --git a/net/bind/files/bind/db.255 b/net/bind/files/bind/db.255
new file mode 100644 (file)
index 0000000..e3aabdb
--- /dev/null
@@ -0,0 +1,12 @@
+;
+; BIND reverse data file for broadcast zone
+;
+$TTL   604800
+@      IN      SOA     localhost. root.localhost. (
+                             1         ; Serial
+                        604800         ; Refresh
+                         86400         ; Retry
+                       2419200         ; Expire
+                        604800 )       ; Negative Cache TTL
+;
+@      IN      NS      localhost.
diff --git a/net/bind/files/bind/db.local b/net/bind/files/bind/db.local
new file mode 100644 (file)
index 0000000..66b4892
--- /dev/null
@@ -0,0 +1,13 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL   604800
+@      IN      SOA     localhost. root.localhost. (
+                             1         ; Serial
+                        604800         ; Refresh
+                         86400         ; Retry
+                       2419200         ; Expire
+                        604800 )       ; Negative Cache TTL
+;
+@      IN      NS      localhost.
+@      IN      A       127.0.0.1
diff --git a/net/bind/files/bind/db.root b/net/bind/files/bind/db.root
new file mode 100644 (file)
index 0000000..0eb52af
--- /dev/null
@@ -0,0 +1,45 @@
+
+; <<>> DiG 9.2.3 <<>> ns . @a.root-servers.net.
+;; global options:  printcmd
+;; Got answer:
+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18944
+;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13
+
+;; QUESTION SECTION:
+;.                             IN      NS
+
+;; ANSWER SECTION:
+.                      518400  IN      NS      A.ROOT-SERVERS.NET.
+.                      518400  IN      NS      B.ROOT-SERVERS.NET.
+.                      518400  IN      NS      C.ROOT-SERVERS.NET.
+.                      518400  IN      NS      D.ROOT-SERVERS.NET.
+.                      518400  IN      NS      E.ROOT-SERVERS.NET.
+.                      518400  IN      NS      F.ROOT-SERVERS.NET.
+.                      518400  IN      NS      G.ROOT-SERVERS.NET.
+.                      518400  IN      NS      H.ROOT-SERVERS.NET.
+.                      518400  IN      NS      I.ROOT-SERVERS.NET.
+.                      518400  IN      NS      J.ROOT-SERVERS.NET.
+.                      518400  IN      NS      K.ROOT-SERVERS.NET.
+.                      518400  IN      NS      L.ROOT-SERVERS.NET.
+.                      518400  IN      NS      M.ROOT-SERVERS.NET.
+
+;; ADDITIONAL SECTION:
+A.ROOT-SERVERS.NET.    3600000 IN      A       198.41.0.4
+B.ROOT-SERVERS.NET.    3600000 IN      A       192.228.79.201
+C.ROOT-SERVERS.NET.    3600000 IN      A       192.33.4.12
+D.ROOT-SERVERS.NET.    3600000 IN      A       128.8.10.90
+E.ROOT-SERVERS.NET.    3600000 IN      A       192.203.230.10
+F.ROOT-SERVERS.NET.    3600000 IN      A       192.5.5.241
+G.ROOT-SERVERS.NET.    3600000 IN      A       192.112.36.4
+H.ROOT-SERVERS.NET.    3600000 IN      A       128.63.2.53
+I.ROOT-SERVERS.NET.    3600000 IN      A       192.36.148.17
+J.ROOT-SERVERS.NET.    3600000 IN      A       192.58.128.30
+K.ROOT-SERVERS.NET.    3600000 IN      A       193.0.14.129
+L.ROOT-SERVERS.NET.    3600000 IN      A       199.7.83.42
+M.ROOT-SERVERS.NET.    3600000 IN      A       202.12.27.33
+
+;; Query time: 81 msec
+;; SERVER: 198.41.0.4#53(a.root-servers.net.)
+;; WHEN: Sun Feb  1 11:27:14 2004
+;; MSG SIZE  rcvd: 436
+
diff --git a/net/bind/files/bind/named.conf.example b/net/bind/files/bind/named.conf.example
new file mode 100644 (file)
index 0000000..1624549
--- /dev/null
@@ -0,0 +1,45 @@
+// This is the primary configuration file for the BIND DNS server named.
+
+options {
+       directory "/tmp";
+
+       // If your ISP provided one or more IP addresses for stable 
+       // nameservers, you probably want to use them as forwarders.  
+       // Uncomment the following block, and insert the addresses replacing 
+       // the all-0's placeholder.
+
+       // forwarders {
+       //      0.0.0.0;
+       // };
+
+       auth-nxdomain no;    # conform to RFC1035
+};
+
+// prime the server with knowledge of the root servers
+zone "." {
+       type hint;
+       file "/etc/bind/db.root";
+};
+
+// be authoritative for the localhost forward and reverse zones, and for
+// broadcast zones as per RFC 1912
+
+zone "localhost" {
+       type master;
+       file "/etc/bind/db.local";
+};
+
+zone "127.in-addr.arpa" {
+       type master;
+       file "/etc/bind/db.127";
+};
+
+zone "0.in-addr.arpa" {
+       type master;
+       file "/etc/bind/db.0";
+};
+
+zone "255.in-addr.arpa" {
+       type master;
+       file "/etc/bind/db.255";
+};
diff --git a/net/bind/files/named.init b/net/bind/files/named.init
new file mode 100644 (file)
index 0000000..986e5fe
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+START=50
+
+config_file=/etc/bind/named.conf
+pid_file=/var/run/named/named.pid
+
+start() {
+  if [ -e $pid_file ]
+  then
+     echo "  named already running with PID `cat $pid_file`"
+     return 1
+  fi
+  echo Starting isc-bind
+
+  /usr/sbin/named -c $config_file
+
+  if [ $? -ne 0 ]
+  then
+    echo "  isc-bind failed to start"
+  fi
+}
+
+stop() {
+  echo "Stopping isc-bind"
+  if [ -e $pid_file ]
+  then
+    kill `cat $pid_file`
+
+    if [ $? -ne 0 ]
+    then
+      echo "  PID " `cat $pid_file` not found
+      echo "  Is the named server running?"
+    fi
+
+    rm -f $pid_file
+
+    else
+    echo "  $pid_file not found"
+  fi
+}
diff --git a/net/bind/patches/001-no-tests.patch b/net/bind/patches/001-no-tests.patch
new file mode 100644 (file)
index 0000000..c969c5e
--- /dev/null
@@ -0,0 +1,26 @@
+Index: bind-9.9.4/bin/Makefile.in
+===================================================================
+--- bind-9.9.4.orig/bin/Makefile.in
++++ bind-9.9.4/bin/Makefile.in
+@@ -19,7 +19,7 @@ srcdir =     @srcdir@
+ VPATH =               @srcdir@
+ top_srcdir =  @top_srcdir@
+-SUBDIRS =     named rndc dig dnssec tools tests nsupdate \
++SUBDIRS =     named rndc dig dnssec tools nsupdate \
+               check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@
+ TARGETS =
+Index: bind-9.9.4/lib/Makefile.in
+===================================================================
+--- bind-9.9.4.orig/lib/Makefile.in
++++ bind-9.9.4/lib/Makefile.in
+@@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
+ # Attempt to disable parallel processing.
+ .NOTPARALLEL:
+ .NO_PARALLEL:
+-SUBDIRS =     isc isccc dns isccfg bind9 lwres tests
++SUBDIRS =     isc isccc dns isccfg bind9 lwres
+ TARGETS =
+ @BIND9_MAKE_RULES@
diff --git a/net/bing/Makefile b/net/bing/Makefile
new file mode 100644 (file)
index 0000000..c271e8f
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2006-2008 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:=bing
+PKG_VERSION:=1.3.5
+PKG_RELEASE:=0
+
+PKG_SOURCE:=$(PKG_NAME)_src-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fgouget.free.fr/bing/
+PKG_MD5SUM:=60aaee55277672d0cc163bf3f0b3d53f
+TAR_OPTIONS += || true
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bing
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=bing bandwidth measuring utility
+  URL:=http://fgouget.free.fr/bing/
+endef
+
+define Package/bing/description
+       bing evaluates the raw bandwidth of a link (PSTN, xDSL, Cable ...)
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default,bing)
+endef
+
+define Package/bing/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bing $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,bing))
diff --git a/net/bitchx/Makefile b/net/bitchx/Makefile
new file mode 100644 (file)
index 0000000..87440e6
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2006-2009 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:=bitchx
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=ircii-pana-$(PKG_VERSION)-final.tar.gz
+PKG_SOURCE_URL:=http://bitchx.org/files/source/
+PKG_MD5SUM:=611d2dda222f00c10140236f4c331572
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/BitchX
+
+PKG_BUILD_DEPENDS:=libncurses
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bitchx
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=popular IRC client
+  URL:=http://www.bitchx.org
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+       mkdir -p $(PKG_INSTALL_DIR)/tmp
+       mkdir -p $(PKG_INSTALL_DIR)/etc/init.d
+       mkdir -p $(PKG_INSTALL_DIR)/usr/bin
+       mkdir -p $(PKG_INSTALL_DIR)/usr/lib/bx
+       mkdir -p $(PKG_INSTALL_DIR)/usr/share/man/man1
+       mkdir -p $(PKG_INSTALL_DIR)/usr/lib/bx/translation
+       mkdir -p $(PKG_INSTALL_DIR)/usr/lib/bx/plugins
+       mkdir -p $(PKG_INSTALL_DIR)/usr/lib/bx/help
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/BitchX $(PKG_INSTALL_DIR)/usr/bin/BitchX-1.1-final
+       rm -f $(PKG_INSTALL_DIR)/usr/bin/BitchX
+       ln -s /usr/bin/BitchX-1.1-final $(PKG_INSTALL_DIR)/usr/bin/BitchX
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/BitchX.help $(PKG_INSTALL_DIR)/usr/lib/bx/BitchX.help
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/BitchX.ircnames $(PKG_INSTALL_DIR)/usr/lib/bx/BitchX.ircnames
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/BitchX.quit $(PKG_INSTALL_DIR)/usr/lib/bx/BitchX.quit
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/BitchX.reasons $(PKG_INSTALL_DIR)/usr/lib/bx/BitchX.kick
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/source/wserv $(PKG_INSTALL_DIR)/usr/lib/bx/wserv
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/source/scr-bx $(PKG_INSTALL_DIR)/usr/bin/scr-bx
+       $(CP) $(PKG_BUILD_DIR)/script $(PKG_INSTALL_DIR)/usr/lib/bx/
+       $(CP) $(PKG_BUILD_DIR)/translation $(PKG_INSTALL_DIR)/usr/lib/bx/
+       bzip2 $(PKG_INSTALL_DIR)/usr/lib/bx/translation/*
+       $(CP) ./files/bitchxrc $(PKG_INSTALL_DIR)/tmp/.bitchxrc
+       $(CP) ./files/bitchxrc.init $(PKG_INSTALL_DIR)/etc/init.d/bitchxrc
+endef
+
+define Package/bitchx/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/etc/init.d $(1)/tmp
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/init.d/bitchxrc $(1)/etc/init.d/
+       $(CP) $(PKG_INSTALL_DIR)/tmp/.bitchxrc $(1)/tmp
+endef
+
+$(eval $(call BuildPackage,bitchx))
diff --git a/net/bitchx/files/bitchxrc b/net/bitchx/files/bitchxrc
new file mode 100644 (file)
index 0000000..6e2b271
--- /dev/null
@@ -0,0 +1,2 @@
+IRCUSER OpenWrt
+IRCNAME OpenWrt User!
diff --git a/net/bitchx/files/bitchxrc.init b/net/bitchx/files/bitchxrc.init
new file mode 100644 (file)
index 0000000..e5966d3
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+
+START=98
+start() {
+       # make /tmp/.bitchxrc as many servers ban root
+       if [ ! -e /tmp/.bitchxrc ]
+       then
+               echo "IRCUSER OpenWrt" >/tmp/.bitchxrc
+               echo "IRCNAME OpenWrt User!" >>/tmp/.bitchxrc
+       fi
+}
diff --git a/net/bitchx/patches/001-fix_declarations.patch b/net/bitchx/patches/001-fix_declarations.patch
new file mode 100644 (file)
index 0000000..b6766da
--- /dev/null
@@ -0,0 +1,24 @@
+diff -urN BitchX/include/ctcp.h BitchX.new/include/ctcp.h
+--- BitchX/include/ctcp.h      2003-04-11 03:09:07.000000000 +0200
++++ BitchX.new/include/ctcp.h  2006-03-29 13:19:21.170693168 +0200
+@@ -56,7 +56,7 @@
+ extern CtcpEntryDll *dll_ctcp;
+-extern                char    *ctcp_type[];
++//extern              char    *ctcp_type[]; /* already declared in ctcp.c
+ extern                int     sed;
+ extern                int     in_ctcp_flag;
+diff -urN BitchX/include/struct.h BitchX.new/include/struct.h
+--- BitchX/include/struct.h    2003-04-11 03:09:07.000000000 +0200
++++ BitchX.new/include/struct.h        2006-03-29 13:19:26.653859600 +0200
+@@ -1064,7 +1064,7 @@
+       int     delete;
+ }     TimerList;
+-extern TimerList *PendingTimers;
++//extern TimerList *PendingTimers;
+ typedef struct nicktab_stru
+ {
+       struct nicktab_stru *next;
diff --git a/net/bitchx/patches/002-tparm.patch b/net/bitchx/patches/002-tparm.patch
new file mode 100644 (file)
index 0000000..18bd7bf
--- /dev/null
@@ -0,0 +1,10 @@
+--- BitchX/source/term.c.orig  2006-03-05 15:01:46.000000000 +1000
++++ BitchX/source/term.c       2006-03-05 15:01:53.000000000 +1000
+@@ -92,7 +92,6 @@
+ #endif
+ extern  char    *getenv();
+-extern        char    *tparm();
+ /*
+  * The old code assumed termcap. termcap is almost always present, but on
diff --git a/net/bitlbee/Makefile b/net/bitlbee/Makefile
new file mode 100644 (file)
index 0000000..d3af024
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# 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:=bitlbee
+PKG_VERSION:=1.0.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://get.bitlbee.org/src \
+       http://get.bitlbee.be/src \
+       http://get.us.bitlbee.org/src \
+       http://ftp.snt.utwente.nl/pub/software/bitlbee/src
+PKG_MD5SUM:=a4d7daa9b64898dd41a3a6d104692d9a
+
+PKG_BUILD_DEPENDS:=libopenssl glib1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/bitlbee
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl +glib1 $(ICONV_DEPENDS)
+  TITLE:=IRC gateway to IM chat networks
+  URL:=http://www.bitlbee.org/
+endef
+
+define Package/bitlbee/conffiles
+/etc/bitlbee/motd.txt
+/etc/bitlbee/bitlbee.conf
+endef
+
+define Build/Configure
+       # it's not GNU autoconf stuff
+       (cd $(PKG_BUILD_DIR); \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               STRIP="$(STRIP)" \
+               ./configure \
+                       --prefix=/usr/ \
+                       --bindir=/usr/sbin/ \
+                       --etcdir=/etc/bitlbee/ \
+                       --datadir=/usr/share/bitlbee/ \
+                       --config=/var/lib/bitlbee/ \
+                       --arch=OpenWrt \
+                       --cpu="$(ARCH)" \
+                       --debug=0 \
+                       --strip=1 \
+                       --sizeopt=1 \
+                       --ipv6=1 \
+                       --ssl=openssl \
+                       --glib1=1 \
+                       --glib1prefix="$(STAGING_DIR)/usr" \
+       );
+       $(SED) 's,^CFLAGS=.*,CFLAGS=$(TARGET_CFLAGS),g'\
+               $(PKG_BUILD_DIR)/Makefile.settings
+       @echo 'CFLAGS+=-I$(ICONV_PREFIX)/include' >> \
+               $(PKG_BUILD_DIR)/Makefile.settings
+       @echo 'LFLAGS+=$(TARGET_LDFLAGS)' >> \
+               $(PKG_BUILD_DIR)/Makefile.settings
+       @echo 'LFLAGS+=-L$(ICONV_PREFIX)/lib' >> \
+               $(PKG_BUILD_DIR)/Makefile.settings
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/bitlbee/install
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(1)" install-etc install-bin
+       $(MAKE) -C $(PKG_BUILD_DIR)/doc/user-guide \
+               DESTDIR="$(1)" install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bitlbee.init $(1)/etc/init.d/bitlbee
+endef
+
+$(eval $(call BuildPackage,bitlbee))
diff --git a/net/bitlbee/files/bitlbee.init b/net/bitlbee/files/bitlbee.init
new file mode 100644 (file)
index 0000000..b85450b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       mkdir -m 0755 -p /var/lib/bitlbee
+       service_start /usr/sbin/bitlbee -D
+}
+
+stop() {
+       service_stop /usr/sbin/bitlbee
+}
diff --git a/net/bitlbee/patches/100-cross_compile_configure_fix b/net/bitlbee/patches/100-cross_compile_configure_fix
new file mode 100644 (file)
index 0000000..3ba17d2
--- /dev/null
@@ -0,0 +1,98 @@
+diff -Nur bitlbee-1.0.1-orig/configure bitlbee-1.0.1/configure
+--- bitlbee-1.0.1-orig/configure       2006-01-14 16:14:05.000000000 +0100
++++ bitlbee-1.0.1/configure    2006-03-06 18:30:19.000000000 +0100
+@@ -21,9 +21,12 @@
+ debug=0
+ strip=1
++sizeopt=0
+ ipv6=1
+ ssl=auto
++glib1=0
++
+ arch=`uname -s`
+ cpu=`uname -m`
+@@ -52,11 +55,18 @@
+ --debug=0/1   Disable/enable debugging                $debug
+ --strip=0/1   Disable/enable binary stripping         $strip
++--sizeopt=0/1 Disable/enable size optimization        $sizeopt
++
++--arch=...    Describe Operating System ?!            $arch
++--cpu=...     Describe CPU                            $cpu
+ --ipv6=0/1    IPv6 socket support                     $ipv6
+ --ssl=...     SSL library to use (gnutls, nss, openssl, bogus, auto)
+                                                       $ssl
++--glib1=0/1   Force usage of glib1 even if glib2 is present
++--glib1prefix=...
++
+ EOF
+               exit;
+       fi
+@@ -110,8 +120,13 @@
+       echo 'CFLAGS=-g' >> Makefile.settings
+       echo 'DEBUG=1' >> Makefile.settings
+       echo '#define DEBUG' >> config.h
++      if [ "$sizeopt" = "1" ]; then
++              echo "Warning: won't optimize for size since debug is on."
++      fi
++elif [ "$sizeopt" = "1" ]; then
++      echo 'CFLAGS=-Os' >> Makefile.settings
+ else
+-      echo 'CFLAGS=-O3' >> Makefile.settings
++      echo 'CFLAGS=-O2' >> Makefile.settings
+ fi
+ echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings
+@@ -138,24 +153,33 @@
+       exit 1;
+ fi
+-if type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then
++if [ "$glib1" != "1" ] && \
++   type pkg-config > /dev/null 2>/dev/null && pkg-config glib-2.0; then
+       cat<<EOF>>Makefile.settings
+ EFLAGS+=`pkg-config --libs glib-2.0`
+ CFLAGS+=`pkg-config --cflags glib-2.0`
+ EOF
+       echo '#define GLIB2' >> config.h
+-elif type glib-config > /dev/null 2> /dev/null; then
++elif [ "x$glib1prefix" = "x" ] && \
++     type glib-config > /dev/null 2> /dev/null; then
+       cat<<EOF>>Makefile.settings
+ EFLAGS+=`glib-config --libs`
+ CFLAGS+=`glib-config --cflags`
+ EOF
+       echo '#define GLIB1' >> config.h
++elif [ "x$glib1prefix" != "x" ] && \
++     type "$glib1prefix/bin/glib-config" > /dev/null 2> /dev/null; then
++      cat<<EOF>>Makefile.settings
++EFLAGS+=`$glib1prefix/bin/glib-config --prefix=$glib1prefix --libs`
++CFLAGS+=`$glib1prefix/bin/glib-config --prefix=$glib1prefix --cflags`
++EOF
++      echo '#define GLIB1' >> config.h
+ else
+       echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)'
+       exit 1;
+ fi
+-if [ -r /usr/include/iconv.h ]; then
++if [ -r "$STAGING_DIR/usr/include/iconv.h" ]; then
+       :;
+ elif [ -r /usr/local/include/iconv.h ]; then
+       echo CFLAGS+=-I/usr/local/include >> Makefile.settings;
+@@ -360,6 +384,10 @@
+ CYGWIN* )
+       echo 'Cygwin is not officially supported.'
+ ;;
++OpenWrt )
++      echo 'EFLAGS+=-liconv' >> Makefile.settings;
++      echo "CFLAGS+=\"-I$STAGING_DIR/usr/include\"" >> Makefile.settings;
++;;
+ * )
+       echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
+       echo 'Please report any problems at http://bugs.bitlbee.org/.'
diff --git a/net/bmon/Makefile b/net/bmon/Makefile
new file mode 100644 (file)
index 0000000..bf0b53e
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2007 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:=bmon
+PKG_VERSION:=2.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://people.suug.ch/~tgr/bmon/files/
+PKG_MD5SUM:=3111a027907016c0902d67350c619df6
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bmon
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=bmon is a portable bandwidth monitor
+  URL:=http://people.suug.ch/~tgr/bmon/
+endef
+
+define Package/bmon/description
+       bmon is a portable bandwidth monitor
+       and rate estimator running on various
+       operating systems. It supports various
+       input methods for different architectures.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-cnt-workaround \
+       --disable-dbi \
+       --disable-rrd \
+       --disable-asound \
+
+CONFIGURE_VARS += \
+       ac_cv_lib_nl_nl_connect=no \
+
+define Package/bmon/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bmon $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,bmon))
diff --git a/net/bmon/patches/001-bugfixes.patch b/net/bmon/patches/001-bugfixes.patch
new file mode 100644 (file)
index 0000000..fcb9306
--- /dev/null
@@ -0,0 +1,26 @@
+Index: bmon-2.1.0/src/out_audio.c
+===================================================================
+--- bmon-2.1.0.orig/src/out_audio.c    2007-11-20 17:25:54.000000000 +0100
++++ bmon-2.1.0/src/out_audio.c 2007-11-20 17:25:54.000000000 +0100
+@@ -141,7 +141,7 @@
+       .om_draw = audio_draw,
+       .om_set_opts = audio_set_opts,
+       .om_probe = audio_probe,
+-      .om_shutdown audio_shutdown,
++      .om_shutdown = audio_shutdown,
+ };
+ static void __init audio_init(void)
+Index: bmon-2.1.0/src/out_xml_event.c
+===================================================================
+--- bmon-2.1.0.orig/src/out_xml_event.c        2007-11-20 17:25:54.000000000 +0100
++++ bmon-2.1.0/src/out_xml_event.c     2007-11-20 17:25:54.000000000 +0100
+@@ -127,7 +127,7 @@
+       .om_draw = xml_event_draw,
+       .om_set_opts = xml_event_set_opts,
+       .om_probe = xml_event_probe,
+-      .om_shutdown xml_event_shutdown,
++      .om_shutdown = xml_event_shutdown,
+ };
+ static void __init xml_event_init(void)
diff --git a/net/bridge-utils/Makefile b/net/bridge-utils/Makefile
new file mode 100644 (file)
index 0000000..ad95b87
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=bridge-utils
+PKG_RELEASE:=2
+PKG_SOURCE_URL:=@SF/bridge
+PKG_VERSION:=1.5
+PKG_MD5SUM:=ec7b381160b340648dede58c31bb2238
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bridge
+  SECTION:=net
+  CATEGORY:=Base system
+  TITLE:=Ethernet bridging configuration utility
+  URL:=http://bridge.sourceforge.net/
+endef
+
+define Package/bridge/description
+ Manage ethernet bridging: a way to connect networks together to
+ form a larger network.
+endef
+
+CONFIGURE_ARGS += \
+       --with-linux-headers="$(LINUX_DIR)" \
+
+define Build/Prepare
+$(call Build/Prepare/Default)
+       ( cd $(PKG_BUILD_DIR) ; \
+               [ -f ./configure ] || { \
+                       ln -sf configure.in configure.ac ; \
+                       autoconf ; \
+               } \
+       )
+endef
+
+define Package/bridge/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin
+endef
+
+$(eval $(call BuildPackage,bridge))
diff --git a/net/bridge-utils/patches/001-libbridge_cflags.patch b/net/bridge-utils/patches/001-libbridge_cflags.patch
new file mode 100644 (file)
index 0000000..e35a649
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/libbridge/Makefile.in
++++ b/libbridge/Makefile.in
+@@ -5,7 +5,7 @@ AR=ar
+ RANLIB=@RANLIB@
+ CC=@CC@
+-CFLAGS = -Wall -g $(KERNEL_HEADERS)
++CFLAGS = -Wall -g @CFLAGS@ $(KERNEL_HEADERS)
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
diff --git a/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch b/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch
new file mode 100644 (file)
index 0000000..c2087e5
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/libbridge/libbridge.h
++++ b/libbridge/libbridge.h
+@@ -20,6 +20,7 @@
+ #define _LIBBRIDGE_H
+ #include <sys/socket.h>
++#include <netinet/in.h>
+ #include <linux/if.h>
+ #include <linux/if_bridge.h>
diff --git a/net/btpd/Makefile b/net/btpd/Makefile
new file mode 100644 (file)
index 0000000..351d46e
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2009-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:=btpd
+PKG_VERSION:=0.16
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/downloads/btpd/btpd
+PKG_MD5SUM:=fe042aae8d7c515ecd855673d1c2b33e
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/btpd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +librt
+  SUBMENU:=BitTorrent
+  TITLE:=btpd - BitTorrent Protocol Daemon
+  URL:=https://github.com/btpd/btpd/wiki/
+endef
+
+define Package/btpd/description
+       BTPD is a bittorrent client consisting of a daemon and client commands,
+       which can be used to read and/or manipulate the daemon state.
+       The daemon is capable of running several torrents simultaneously and
+       only uses one tcp port.
+       It's fairly low on resource usage and should be perfect for file
+       distribution sites.
+       Efficient downloads and ease of use makes this client a good choice for
+       the casual user as well.
+endef
+
+define Package/btpd/conffiles
+/etc/config/btpd
+endef
+
+CONFIGURE_ARGS += -C --with-evloop-method=poll
+
+define Package/btpd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/bt{cli,info,pd} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/btpd.init $(1)/etc/init.d/btpd
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/btpd.config $(1)/etc/config/btpd
+endef
+
+$(eval $(call BuildPackage,btpd))
diff --git a/net/btpd/files/btpd.config b/net/btpd/files/btpd.config
new file mode 100644 (file)
index 0000000..9650fc9
--- /dev/null
@@ -0,0 +1,7 @@
+config 'btpd'
+       option 'directory' '/usb/btpd'
+       option 'maxkbin' '1000'
+       option 'maxkbout' '40'
+       option 'maxpeers' '140'
+       option 'maxuploads' '50'
+       option 'port' '47194'
diff --git a/net/btpd/files/btpd.init b/net/btpd/files/btpd.init
new file mode 100644 (file)
index 0000000..867b553
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=99
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _loctmp
+       config_get_bool _loctmp "$section" "$option" 0
+       [ "$_loctmp" -gt 0 ] && append args "$value"
+}
+
+append_parm() {
+       local section="$1"
+       local option="$2"
+       local switch="$3"
+       local _loctmp
+       config_get _loctmp "$section" "$option"
+       [ -z "$_loctmp" ] && return 0
+       append args "$switch $_loctmp"
+}
+
+
+btpd() {
+       local cfg="$1"
+       args=""
+       directory=""
+       append_bool "$cfg" useipv4 "-4"
+       append_bool "$cfg" useipv6 "-6"
+       append_bool "$cfg" emptystart "--empty-start"
+       append_parm "$cfg" port "-p"
+       append_parm "$cfg" directory "-d"
+       append_parm "$cfg" maxpeers "--max-peers"
+       append_parm "$cfg" maxuploads "--max-uploads"
+       append_parm "$cfg" maxkbin "--bw-in"
+       append_parm "$cfg" maxkbout "--bw-out"
+       config_get directory "$cfg" directory
+}
+
+start() {
+       config_load btpd
+       config_foreach btpd btpd
+
+       service_start /usr/bin/btpd $args
+}
+
+stop() {
+       config_load btpd
+       config_foreach btpd btpd
+
+       [ -d $directory ] && args="-d $directory "
+
+       while btcli $args kill ; do
+               sleep 3
+       done 2>/dev/null
+
+       service_stop /usr/bin/btpd
+}
+
diff --git a/net/btpd/patches/000-sha1.diff b/net/btpd/patches/000-sha1.diff
new file mode 100644 (file)
index 0000000..a6d8640
--- /dev/null
@@ -0,0 +1,731 @@
+--- a/btpd/btpd.c
++++ b/btpd/btpd.c
+@@ -1,6 +1,6 @@
+ #include "btpd.h"
+-#include <openssl/sha.h>
++#include "sha1.h"
+ #include <signal.h>
+ static uint8_t m_peer_id[20];
+@@ -114,7 +114,7 @@ btpd_init(void)
+     idcon[sizeof(idcon) - 1] = '\0';
+     n = strlen(idcon);
+-    SHA1(idcon, n, m_peer_id);
++    sha1_buffer(idcon, n, m_peer_id);
+     bcopy(m_peer_id, &seed, sizeof(seed));
+     bcopy(BTPD_VERSION, m_peer_id, sizeof(BTPD_VERSION) - 1);
+     m_peer_id[sizeof(BTPD_VERSION) - 1] = '|';
+--- a/btpd/content.c
++++ b/btpd/content.c
+@@ -1,6 +1,6 @@
+ #include "btpd.h"
+-#include <openssl/sha.h>
++#include "sha1.h"
+ #include <stream.h>
+ struct content {
+@@ -60,16 +60,16 @@ static struct timeout m_workev;
+ static int
+ test_hash(struct torrent *tp, uint8_t *hash, uint32_t piece)
+ {
+-    char piece_hash[SHA_DIGEST_LENGTH];
++    char piece_hash[SHA1_DIGEST_SIZE];
+     tlib_read_hash(tp->tl, tp->pieces_off, piece, piece_hash);
+-    return bcmp(hash, piece_hash, SHA_DIGEST_LENGTH);
++    return bcmp(hash, piece_hash, SHA1_DIGEST_SIZE);
+ }
+ static int
+ test_piece(struct torrent *tp, uint32_t piece, int *ok)
+ {
+     int err;
+-    uint8_t hash[SHA_DIGEST_LENGTH];
++    uint8_t hash[SHA1_DIGEST_SIZE];
+     if ((err = bts_sha(tp->cm->rds, piece * tp->piece_length,
+              torrent_piece_size(tp, piece), hash)) != 0) {
+         btpd_log(BTPD_L_ERROR, "io error on '%s' (%s).\n",
+--- a/btpd/download_subr.c
++++ b/btpd/download_subr.c
+@@ -21,7 +21,7 @@
+ #include "btpd.h"
+-#include <openssl/sha.h>
++#include "sha1.h"
+ #include <stream.h>
+ static void
+@@ -42,7 +42,7 @@ piece_log_hashes(struct piece *pc)
+     for (unsigned i = 0; i < pc->nblocks; i++) {
+         uint32_t bsize = torrent_block_size(tp, pc->index, pc->nblocks, i);
+         cm_get_bytes(tp, pc->index, i * PIECE_BLOCKLEN, bsize, &buf);
+-        SHA1(buf, bsize, &log->hashes[i * 20]);
++        sha1_buffer(buf, bsize, &log->hashes[i * 20]);
+         free(buf);
+     }
+ }
+--- a/btpd/torrent.c
++++ b/btpd/torrent.c
+@@ -1,7 +1,5 @@
+ #include "btpd.h"
+-#include <openssl/sha.h>
+-
+ #define SAVE_INTERVAL 300
+ static unsigned m_nghosts;
+--- a/configure.ac
++++ b/configure.ac
+@@ -29,13 +29,6 @@ rm -f conftest.c conftest.$OBJEXT
+ rm -f conftest.c conftest.$OBJEXT
+ [$3]))
+-AC_ARG_WITH(openssl,
+-[  --with-openssl=dir      use openssl installed in dir],
+-[
+-    AC_SUBST(openssl_LDFLAGS,["-L${withval}/lib -Wl,-R,${withval}/lib"])
+-    AC_SUBST(openssl_CPPFLAGS,"-I${withval}/include")
+-])
+-
+ AC_ARG_WITH(evloop-method,
+ [  --with-evloop-method    select evloop method (epoll,poll,kqueue)],
+     evloop_methods=$withval,
+@@ -76,11 +69,6 @@ CC_ARGS_OK_IFELSE(-Wno-pointer-sign,
+ ,
+     AC_MSG_RESULT(no))
+-old_LDFLAGS="$LDFLAGS"
+-LDFLAGS="$LDFLAGS $openssl_LDFLAGS"
+-AC_CHECK_LIB(crypto, SHA1_Final,:,AC_MSG_FAILURE(btpd needs openssl's libraries and headers))
+-LDFLAGS=$old_LDFLAGS
+-
+ for m in $evloop_methods; do
+     case $m in
+     epoll)
+--- a/misc/metainfo.c
++++ b/misc/metainfo.c
+@@ -6,8 +6,7 @@
+ #include <string.h>
+ #include <strings.h>
+-#include <openssl/sha.h>
+-
++#include "sha1.h"
+ #include "benc.h"
+ #include "metainfo.h"
+ #include "subr.h"
+@@ -159,7 +158,7 @@ mi_info_hash(const char *p, uint8_t *has
+     if (hash == NULL)
+         if ((hash = malloc(20)) == NULL)
+             return NULL;
+-    return SHA1(info, benc_length(info), hash);
++    return (uint8_t *)sha1_buffer(info, benc_length(info), hash);
+ }
+ char *
+--- /dev/null
++++ b/misc/sha1.c
+@@ -0,0 +1,428 @@
++/* sha1.c - Functions to compute SHA1 message digest of files or
++   memory blocks according to the NIST specification FIPS-180-1.
++
++   Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free
++   Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify it
++   under the terms of the GNU General Public License as published by the
++   Free Software Foundation; either version 2, or (at your option) any
++   later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, write to the Free Software Foundation,
++   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
++
++/* Written by Scott G. Miller
++   Credits:
++      Robert Klep <robert@ilse.nl>  -- Expansion function fix
++*/
++
++#include <config.h>
++
++#include "sha1.h"
++
++#include <stddef.h>
++#include <stdlib.h>
++#include <string.h>
++
++#if USE_UNLOCKED_IO
++# include "unlocked-io.h"
++#endif
++
++#ifdef WORDS_BIGENDIAN
++# define SWAP(n) (n)
++#else
++# define SWAP(n) \
++    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
++#endif
++
++#define BLOCKSIZE 32768
++#if BLOCKSIZE % 64 != 0
++# error "invalid BLOCKSIZE"
++#endif
++
++/* This array contains the bytes used to pad the buffer to the next
++   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
++static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
++
++
++/* Take a pointer to a 160 bit block of data (five 32 bit ints) and
++   initialize it to the start constants of the SHA1 algorithm.  This
++   must be called before using hash in the call to sha1_hash.  */
++void
++sha1_init_ctx (struct sha1_ctx *ctx)
++{
++  ctx->A = 0x67452301;
++  ctx->B = 0xefcdab89;
++  ctx->C = 0x98badcfe;
++  ctx->D = 0x10325476;
++  ctx->E = 0xc3d2e1f0;
++
++  ctx->total[0] = ctx->total[1] = 0;
++  ctx->buflen = 0;
++}
++
++/* Copy the 4 byte value from v into the memory location pointed to by *cp,
++   If your architecture allows unaligned access this is equivalent to
++   * (uint32_t *) cp = v  */
++static inline void
++set_uint32 (char *cp, uint32_t v)
++{
++  memcpy (cp, &v, sizeof v);
++}
++
++/* Put result from CTX in first 20 bytes following RESBUF.  The result
++   must be in little endian byte order.  */
++void *
++sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
++{
++  char *r = resbuf;
++  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
++  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
++  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
++  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
++  set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E));
++
++  return resbuf;
++}
++
++/* Process the remaining bytes in the internal buffer and the usual
++   prolog according to the standard and write the result to RESBUF.  */
++void *
++sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
++{
++  /* Take yet unprocessed bytes into account.  */
++  uint32_t bytes = ctx->buflen;
++  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
++
++  /* Now count remaining bytes.  */
++  ctx->total[0] += bytes;
++  if (ctx->total[0] < bytes)
++    ++ctx->total[1];
++
++  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
++  ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
++  ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
++
++  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
++
++  /* Process last bytes.  */
++  sha1_process_block (ctx->buffer, size * 4, ctx);
++
++  return sha1_read_ctx (ctx, resbuf);
++}
++
++/* Compute SHA1 message digest for bytes read from STREAM.  The
++   resulting message digest number will be written into the 16 bytes
++   beginning at RESBLOCK.  */
++int
++sha1_stream (FILE *stream, void *resblock)
++{
++  struct sha1_ctx ctx;
++  size_t sum;
++
++  char *buffer = malloc (BLOCKSIZE + 72);
++  if (!buffer)
++    return 1;
++
++  /* Initialize the computation context.  */
++  sha1_init_ctx (&ctx);
++
++  /* Iterate over full file contents.  */
++  while (1)
++    {
++      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
++         computation function processes the whole buffer so that with the
++         next round of the loop another block can be read.  */
++      size_t n;
++      sum = 0;
++
++      /* Read block.  Take care for partial reads.  */
++      while (1)
++        {
++          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
++
++          sum += n;
++
++          if (sum == BLOCKSIZE)
++            break;
++
++          if (n == 0)
++            {
++              /* Check for the error flag IFF N == 0, so that we don't
++                 exit the loop after a partial read due to e.g., EAGAIN
++                 or EWOULDBLOCK.  */
++              if (ferror (stream))
++                {
++                  free (buffer);
++                  return 1;
++                }
++              goto process_partial_block;
++            }
++
++          /* We've read at least one byte, so ignore errors.  But always
++             check for EOF, since feof may be true even though N > 0.
++             Otherwise, we could end up calling fread after EOF.  */
++          if (feof (stream))
++            goto process_partial_block;
++        }
++
++      /* Process buffer with BLOCKSIZE bytes.  Note that
++                        BLOCKSIZE % 64 == 0
++       */
++      sha1_process_block (buffer, BLOCKSIZE, &ctx);
++    }
++
++ process_partial_block:;
++
++  /* Process any remaining bytes.  */
++  if (sum > 0)
++    sha1_process_bytes (buffer, sum, &ctx);
++
++  /* Construct result in desired memory.  */
++  sha1_finish_ctx (&ctx, resblock);
++  free (buffer);
++  return 0;
++}
++
++/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
++   result is always in little endian byte order, so that a byte-wise
++   output yields to the wanted ASCII representation of the message
++   digest.  */
++void *
++sha1_buffer (const char *buffer, size_t len, void *resblock)
++{
++  struct sha1_ctx ctx;
++
++  /* Initialize the computation context.  */
++  sha1_init_ctx (&ctx);
++
++  /* Process whole buffer but last len % 64 bytes.  */
++  sha1_process_bytes (buffer, len, &ctx);
++
++  /* Put result in desired memory area.  */
++  return sha1_finish_ctx (&ctx, resblock);
++}
++
++void
++sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
++{
++  /* When we already have some bits in our internal buffer concatenate
++     both inputs first.  */
++  if (ctx->buflen != 0)
++    {
++      size_t left_over = ctx->buflen;
++      size_t add = 128 - left_over > len ? len : 128 - left_over;
++
++      memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
++      ctx->buflen += add;
++
++      if (ctx->buflen > 64)
++        {
++          sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
++
++          ctx->buflen &= 63;
++          /* The regions in the following copy operation cannot overlap.  */
++          memcpy (ctx->buffer,
++                  &((char *) ctx->buffer)[(left_over + add) & ~63],
++                  ctx->buflen);
++        }
++
++      buffer = (const char *) buffer + add;
++      len -= add;
++    }
++
++  /* Process available complete blocks.  */
++  if (len >= 64)
++    {
++#if !_STRING_ARCH_unaligned
++# define alignof(type) offsetof (struct { char c; type x; }, x)
++# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
++      if (UNALIGNED_P (buffer))
++        while (len > 64)
++          {
++            sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
++            buffer = (const char *) buffer + 64;
++            len -= 64;
++          }
++      else
++#endif
++        {
++          sha1_process_block (buffer, len & ~63, ctx);
++          buffer = (const char *) buffer + (len & ~63);
++          len &= 63;
++        }
++    }
++
++  /* Move remaining bytes in internal buffer.  */
++  if (len > 0)
++    {
++      size_t left_over = ctx->buflen;
++
++      memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
++      left_over += len;
++      if (left_over >= 64)
++        {
++          sha1_process_block (ctx->buffer, 64, ctx);
++          left_over -= 64;
++          memcpy (ctx->buffer, &ctx->buffer[16], left_over);
++        }
++      ctx->buflen = left_over;
++    }
++}
++
++/* --- Code below is the primary difference between md5.c and sha1.c --- */
++
++/* SHA1 round constants */
++#define K1 0x5a827999
++#define K2 0x6ed9eba1
++#define K3 0x8f1bbcdc
++#define K4 0xca62c1d6
++
++/* Round functions.  Note that F2 is the same as F4.  */
++#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
++#define F2(B,C,D) (B ^ C ^ D)
++#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
++#define F4(B,C,D) (B ^ C ^ D)
++
++/* Process LEN bytes of BUFFER, accumulating context into CTX.
++   It is assumed that LEN % 64 == 0.
++   Most of this code comes from GnuPG's cipher/sha1.c.  */
++
++void
++sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
++{
++  const uint32_t *words = buffer;
++  size_t nwords = len / sizeof (uint32_t);
++  const uint32_t *endp = words + nwords;
++  uint32_t x[16];
++  uint32_t a = ctx->A;
++  uint32_t b = ctx->B;
++  uint32_t c = ctx->C;
++  uint32_t d = ctx->D;
++  uint32_t e = ctx->E;
++
++  /* First increment the byte count.  RFC 1321 specifies the possible
++     length of the file up to 2^64 bits.  Here we only compute the
++     number of bytes.  Do a double word increment.  */
++  ctx->total[0] += len;
++  if (ctx->total[0] < len)
++    ++ctx->total[1];
++
++#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
++
++#define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \
++                    ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
++               , (x[I&0x0f] = rol(tm, 1)) )
++
++#define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )     \
++                                      + F( B, C, D )  \
++                                      + K             \
++                                      + M;            \
++                                 B = rol( B, 30 );    \
++                               } while(0)
++
++  while (words < endp)
++    {
++      uint32_t tm;
++      int t;
++      for (t = 0; t < 16; t++)
++        {
++          x[t] = SWAP (*words);
++          words++;
++        }
++
++      R( a, b, c, d, e, F1, K1, x[ 0] );
++      R( e, a, b, c, d, F1, K1, x[ 1] );
++      R( d, e, a, b, c, F1, K1, x[ 2] );
++      R( c, d, e, a, b, F1, K1, x[ 3] );
++      R( b, c, d, e, a, F1, K1, x[ 4] );
++      R( a, b, c, d, e, F1, K1, x[ 5] );
++      R( e, a, b, c, d, F1, K1, x[ 6] );
++      R( d, e, a, b, c, F1, K1, x[ 7] );
++      R( c, d, e, a, b, F1, K1, x[ 8] );
++      R( b, c, d, e, a, F1, K1, x[ 9] );
++      R( a, b, c, d, e, F1, K1, x[10] );
++      R( e, a, b, c, d, F1, K1, x[11] );
++      R( d, e, a, b, c, F1, K1, x[12] );
++      R( c, d, e, a, b, F1, K1, x[13] );
++      R( b, c, d, e, a, F1, K1, x[14] );
++      R( a, b, c, d, e, F1, K1, x[15] );
++      R( e, a, b, c, d, F1, K1, M(16) );
++      R( d, e, a, b, c, F1, K1, M(17) );
++      R( c, d, e, a, b, F1, K1, M(18) );
++      R( b, c, d, e, a, F1, K1, M(19) );
++      R( a, b, c, d, e, F2, K2, M(20) );
++      R( e, a, b, c, d, F2, K2, M(21) );
++      R( d, e, a, b, c, F2, K2, M(22) );
++      R( c, d, e, a, b, F2, K2, M(23) );
++      R( b, c, d, e, a, F2, K2, M(24) );
++      R( a, b, c, d, e, F2, K2, M(25) );
++      R( e, a, b, c, d, F2, K2, M(26) );
++      R( d, e, a, b, c, F2, K2, M(27) );
++      R( c, d, e, a, b, F2, K2, M(28) );
++      R( b, c, d, e, a, F2, K2, M(29) );
++      R( a, b, c, d, e, F2, K2, M(30) );
++      R( e, a, b, c, d, F2, K2, M(31) );
++      R( d, e, a, b, c, F2, K2, M(32) );
++      R( c, d, e, a, b, F2, K2, M(33) );
++      R( b, c, d, e, a, F2, K2, M(34) );
++      R( a, b, c, d, e, F2, K2, M(35) );
++      R( e, a, b, c, d, F2, K2, M(36) );
++      R( d, e, a, b, c, F2, K2, M(37) );
++      R( c, d, e, a, b, F2, K2, M(38) );
++      R( b, c, d, e, a, F2, K2, M(39) );
++      R( a, b, c, d, e, F3, K3, M(40) );
++      R( e, a, b, c, d, F3, K3, M(41) );
++      R( d, e, a, b, c, F3, K3, M(42) );
++      R( c, d, e, a, b, F3, K3, M(43) );
++      R( b, c, d, e, a, F3, K3, M(44) );
++      R( a, b, c, d, e, F3, K3, M(45) );
++      R( e, a, b, c, d, F3, K3, M(46) );
++      R( d, e, a, b, c, F3, K3, M(47) );
++      R( c, d, e, a, b, F3, K3, M(48) );
++      R( b, c, d, e, a, F3, K3, M(49) );
++      R( a, b, c, d, e, F3, K3, M(50) );
++      R( e, a, b, c, d, F3, K3, M(51) );
++      R( d, e, a, b, c, F3, K3, M(52) );
++      R( c, d, e, a, b, F3, K3, M(53) );
++      R( b, c, d, e, a, F3, K3, M(54) );
++      R( a, b, c, d, e, F3, K3, M(55) );
++      R( e, a, b, c, d, F3, K3, M(56) );
++      R( d, e, a, b, c, F3, K3, M(57) );
++      R( c, d, e, a, b, F3, K3, M(58) );
++      R( b, c, d, e, a, F3, K3, M(59) );
++      R( a, b, c, d, e, F4, K4, M(60) );
++      R( e, a, b, c, d, F4, K4, M(61) );
++      R( d, e, a, b, c, F4, K4, M(62) );
++      R( c, d, e, a, b, F4, K4, M(63) );
++      R( b, c, d, e, a, F4, K4, M(64) );
++      R( a, b, c, d, e, F4, K4, M(65) );
++      R( e, a, b, c, d, F4, K4, M(66) );
++      R( d, e, a, b, c, F4, K4, M(67) );
++      R( c, d, e, a, b, F4, K4, M(68) );
++      R( b, c, d, e, a, F4, K4, M(69) );
++      R( a, b, c, d, e, F4, K4, M(70) );
++      R( e, a, b, c, d, F4, K4, M(71) );
++      R( d, e, a, b, c, F4, K4, M(72) );
++      R( c, d, e, a, b, F4, K4, M(73) );
++      R( b, c, d, e, a, F4, K4, M(74) );
++      R( a, b, c, d, e, F4, K4, M(75) );
++      R( e, a, b, c, d, F4, K4, M(76) );
++      R( d, e, a, b, c, F4, K4, M(77) );
++      R( c, d, e, a, b, F4, K4, M(78) );
++      R( b, c, d, e, a, F4, K4, M(79) );
++
++      a = ctx->A += a;
++      b = ctx->B += b;
++      c = ctx->C += c;
++      d = ctx->D += d;
++      e = ctx->E += e;
++    }
++}
+--- /dev/null
++++ b/misc/sha1.h
+@@ -0,0 +1,92 @@
++/* Declarations of functions and data types used for SHA1 sum
++   library functions.
++   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2009, 2010 Free Software
++   Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify it
++   under the terms of the GNU General Public License as published by the
++   Free Software Foundation; either version 2, or (at your option) any
++   later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, write to the Free Software Foundation,
++   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
++
++#ifndef SHA1_H
++# define SHA1_H 1
++
++# include <stdio.h>
++# include <stdint.h>
++
++# ifdef __cplusplus
++extern "C" {
++# endif
++
++#define SHA1_DIGEST_SIZE 20
++
++/* Structure to save state of computation between the single steps.  */
++struct sha1_ctx
++{
++  uint32_t A;
++  uint32_t B;
++  uint32_t C;
++  uint32_t D;
++  uint32_t E;
++
++  uint32_t total[2];
++  uint32_t buflen;
++  uint32_t buffer[32];
++};
++
++
++/* Initialize structure containing state of computation. */
++extern void sha1_init_ctx (struct sha1_ctx *ctx);
++
++/* Starting with the result of former calls of this function (or the
++   initialization function update the context for the next LEN bytes
++   starting at BUFFER.
++   It is necessary that LEN is a multiple of 64!!! */
++extern void sha1_process_block (const void *buffer, size_t len,
++                                struct sha1_ctx *ctx);
++
++/* Starting with the result of former calls of this function (or the
++   initialization function update the context for the next LEN bytes
++   starting at BUFFER.
++   It is NOT required that LEN is a multiple of 64.  */
++extern void sha1_process_bytes (const void *buffer, size_t len,
++                                struct sha1_ctx *ctx);
++
++/* Process the remaining bytes in the buffer and put result from CTX
++   in first 20 bytes following RESBUF.  The result is always in little
++   endian byte order, so that a byte-wise output yields to the wanted
++   ASCII representation of the message digest.  */
++extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
++
++
++/* Put result from CTX in first 20 bytes following RESBUF.  The result is
++   always in little endian byte order, so that a byte-wise output yields
++   to the wanted ASCII representation of the message digest.  */
++extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
++
++
++/* Compute SHA1 message digest for bytes read from STREAM.  The
++   resulting message digest number will be written into the 20 bytes
++   beginning at RESBLOCK.  */
++extern int sha1_stream (FILE *stream, void *resblock);
++
++/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The
++   result is always in little endian byte order, so that a byte-wise
++   output yields to the wanted ASCII representation of the message
++   digest.  */
++extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
++
++# ifdef __cplusplus
++}
++# endif
++
++#endif
+--- a/misc/stream.c
++++ b/misc/stream.c
+@@ -5,7 +5,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+-#include <openssl/sha.h>
++#include "sha1.h"
+ #include "metainfo.h"
+ #include "subr.h"
+@@ -161,21 +161,21 @@ bts_put(struct bt_stream *bts, off_t off
+ int
+ bts_sha(struct bt_stream *bts, off_t start, off_t length, uint8_t *hash)
+ {
+-    SHA_CTX ctx;
++    struct sha1_ctx ctx;
+     char buf[SHAFILEBUF];
+     size_t wantread;
+     int err = 0;
+-    SHA1_Init(&ctx);
++    sha1_init_ctx(&ctx);
+     while (length > 0) {
+         wantread = min(length, SHAFILEBUF);
+         if ((err = bts_get(bts, start, buf, wantread)) != 0)
+             break;
+         length -= wantread;
+         start += wantread;
+-        SHA1_Update(&ctx, buf, wantread);
++        sha1_process_bytes(buf, wantread, &ctx);
+     }
+-    SHA1_Final(hash, &ctx);
++    sha1_finish_ctx(&ctx, hash);
+     return err;
+ }
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,6 +1,6 @@
+ AM_CFLAGS=-std=c99 -Wall @WARNNPS@
+-AM_CPPFLAGS=-D_FILE_OFFSET_BITS=64 -D@EVLOOP_METHOD@ -I$(top_srcdir)/misc -I$(top_srcdir)/evloop @openssl_CPPFLAGS@
+-AM_LDFLAGS=@openssl_LDFLAGS@
++AM_CPPFLAGS=-D_FILE_OFFSET_BITS=64 -D@EVLOOP_METHOD@ -I$(top_srcdir)/misc -I$(top_srcdir)/evloop
++AM_LDFLAGS=
+ bin_PROGRAMS=btpd/btpd cli/btcli cli/btinfo
+ noinst_LIBRARIES=misc/libmisc.a evloop/libevloop.a
+@@ -25,15 +25,15 @@ btpd_btpd_SOURCES=\
+       btpd/upload.c btpd/upload.h\
+       btpd/util.c
+ btpd_btpd_CFLAGS=@TD_CFLAGS@ $(AM_CFLAGS)
+-btpd_btpd_LDADD=@TD_LIBS@ misc/libmisc.a evloop/libevloop.a -lcrypto -lm @CLOCKLIB@ @INETLIBS@
++btpd_btpd_LDADD=@TD_LIBS@ misc/libmisc.a evloop/libevloop.a -lm @CLOCKLIB@ @INETLIBS@
+ # btinfo
+ cli_btinfo_SOURCES=cli/btinfo.c
+-cli_btinfo_LDADD=misc/libmisc.a -lcrypto -lm
++cli_btinfo_LDADD=misc/libmisc.a -lm
+ # btcli
+ cli_btcli_SOURCES=cli/btcli.c cli/btcli.h cli/add.c cli/del.c cli/list.c cli/kill.c cli/start.c cli/stop.c cli/stat.c
+-cli_btcli_LDADD=misc/libmisc.a -lcrypto -lm @INETLIBS@
++cli_btcli_LDADD=misc/libmisc.a -lm @INETLIBS@
+ # libmisc
+ misc_libmisc_a_SOURCES=\
+@@ -45,7 +45,8 @@ misc_libmisc_a_SOURCES=\
+       misc/iobuf.c misc/iobuf.h\
+       misc/queue.h\
+       misc/stream.c misc/stream.h\
+-      misc/subr.c misc/subr.h
++      misc/subr.c misc/subr.h\
++      misc/sha1.c misc/sha1.h
+ # evloop
+ EXTRA_evloop_libevloop_a_SOURCES=evloop/epoll.c evloop/kqueue.c evloop/poll.c
diff --git a/net/btpd/patches/001-gettime.patch b/net/btpd/patches/001-gettime.patch
new file mode 100644 (file)
index 0000000..012b95d
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/evloop/timer.c
++++ b/evloop/timer.c
+@@ -14,7 +14,7 @@
+ int
+ evtimer_gettime(struct timespec *ts)
+ {
+-    return clock_gettime(TIMER_CLOCK, ts);
++    return clock_gettime(CLOCK_REALTIME, ts);
+ }
+ #elif defined(HAVE_MACH_ABSOLUTE_TIME)
diff --git a/net/btpd/patches/002-config.h.patch b/net/btpd/patches/002-config.h.patch
new file mode 100644 (file)
index 0000000..1950030
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/misc/sha1.c
++++ b/misc/sha1.c
+@@ -23,7 +23,9 @@
+       Robert Klep <robert@ilse.nl>  -- Expansion function fix
+ */
+-#include <config.h>
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
+ #include "sha1.h"
diff --git a/net/btpd/patches/100-clock.diff b/net/btpd/patches/100-clock.diff
new file mode 100644 (file)
index 0000000..223ef06
--- /dev/null
@@ -0,0 +1,4 @@
+--- /dev/null
++++ b/config.cache
+@@ -0,0 +1 @@
++ac_cv_func_clock_gettime=no
diff --git a/net/bwm/Makefile b/net/bwm/Makefile
new file mode 100644 (file)
index 0000000..17d2c30
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2006 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:=bwm
+PKG_VERSION:=1.1.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/b/bwm
+PKG_MD5SUM:=51021a036acb92d2bda0c0c0483f9552
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).orig
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bwm
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A very tiny bandwidth monitor
+  URL:=http://ftp.debian.org/debian/pool/main/b/bwm
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/bwm.c -o $(PKG_BUILD_DIR)/bwm
+endef
+
+define Package/bwm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bwm $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bwm))
diff --git a/net/bwm/patches/001-debian.patch b/net/bwm/patches/001-debian.patch
new file mode 100644 (file)
index 0000000..043d862
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/bwm.c
++++ b/bwm.c
+@@ -57,7 +57,8 @@ int main(int argc, char *argv[])
+   char buffer[256];
+   char *buffer_pointer;
+-  int inum;
++  int inum = -1;
++  int oldinum = -1;
+   int field_number;
+   int total_counter;
+   int sleep_time = 2;
+@@ -90,7 +91,13 @@ int main(int argc, char *argv[])
+   while(1)
+   {
+-    printf("%c[H",27);
++    if (inum==oldinum)
++    {
++      printf("%c[H",27);
++    } else {
++      printf("%c[H%c[J",27,27);
++      oldinum = inum;
++    }
+     printf("Bandwidth Monitor 1.1.0\n\n");
+     printf("       Iface        RX(KB/sec)   TX(KB/sec)   Total(KB/sec)\n\n");
+@@ -138,7 +145,7 @@ int main(int argc, char *argv[])
+               interface[inum].rx_kbytes_dif =
+                (interface[inum].rx_bytes_new -
+-                interface[inum].rx_bytes_old) * 1000 / 1024;
++                interface[inum].rx_bytes_old) / 1024 * 1000;
+               interface[inum].rx_rate_whole = 
+                interface[inum].rx_kbytes_dif / 
+@@ -157,7 +164,7 @@ int main(int argc, char *argv[])
+               interface[inum].tx_kbytes_dif =
+                (interface[inum].tx_bytes_new -
+-                interface[inum].tx_bytes_old) * 1000 / 1024;
++                interface[inum].tx_bytes_old) / 1024 * 1000;
+               interface[inum].tx_rate_whole = 
+                interface[inum].tx_kbytes_dif / 
diff --git a/net/bwping/Makefile b/net/bwping/Makefile
new file mode 100644 (file)
index 0000000..c63c46a
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 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:=bwping
+PKG_VERSION:=1.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/bwping
+PKG_MD5SUM:=e5d2de8cf61791ad16713bd86609368f
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bwping
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Open Source bandwidth measurement tool
+  URL:=http://bwping.sourceforge.net
+endef
+
+define Package/bwping/description
+  BWPing is a bandwidth measurement tool based on ICMP echo
+  request/reply.  It is especially well suited for lossy links. BWPing
+  does not not require any special software on the remote host (only
+  the ability to respond on ICMP echo request messages).
+endef
+
+define Package/bwping/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,bwping))
diff --git a/net/cbtt/Makefile b/net/cbtt/Makefile
new file mode 100644 (file)
index 0000000..19f259b
--- /dev/null
@@ -0,0 +1,84 @@
+# Copyright (C) 2006 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:=cbtt
+PKG_VERSION:=20060727
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)80-$(PKG_VERSION)-src.tar.gz
+PKG_SOURCE_URL:=@SF/bnbtusermods
+PKG_MD5SUM:=d6edf0a11d7e68fa3d121e91308f22f5
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)80-$(PKG_VERSION)-src
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cbtt/Default
+  SUBMENU:=BitTorrent
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread $(CXX_DEPENDS) +zlib
+  TITLE:=Bittorrent tracker
+  URL:=http://bnbtusermods.sourceforge.net/
+endef
+
+define Package/cbtt
+$(call Package/cbtt/Default)
+endef
+
+define Package/cbtt-mysql
+$(call Package/cbtt/Default)
+  DEPENDS+= +libmysqlclient
+  TITLE+= (with mysql support)
+endef
+
+
+define Build/Template
+
+$(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LFLAGS="$(TARGET_LDFLAGS) -L. $(4) -lz -lm -lpthread" \
+               $(3)
+       touch $$@
+
+$(STAMP_BUILT): $(STAMP_BUILT)-$(2)
+
+define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(3) $$(1)/usr/bin/
+endef
+
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_cbtt),)
+  define Build/without-mysql
+    $(call Build/Template,cbtt,without-mysql,bnbt,)
+  endef
+endif
+$(eval $(Build/without-mysql))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_cbtt-mysql),)
+  define Build/with-mysql
+    $(call Build/Template,cbtt-mysql,with-mysql,bnbtmysql, \
+       -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient \
+    )
+  endef
+endif
+$(eval $(Build/with-mysql))
+
+$(eval $(call BuildPackage,cbtt))
+$(eval $(call BuildPackage,cbtt-mysql))
diff --git a/net/cbtt/patches/100-compile.patch b/net/cbtt/patches/100-compile.patch
new file mode 100644 (file)
index 0000000..4181d8d
--- /dev/null
@@ -0,0 +1,35 @@
+Index: cbtt80-20060727-src/Makefile
+===================================================================
+--- cbtt80-20060727-src.orig/Makefile  2007-08-27 23:41:22.000000000 +0200
++++ cbtt80-20060727-src/Makefile       2007-08-27 23:41:22.000000000 +0200
+@@ -1,6 +1,5 @@
+ SHELL = /bin/sh
+ SYSTEM = $(shell uname)
+-C++ = g++
+ DFLAGS =
+ OFLAGS = -O2 -w
+ LFLAGS = -L. -lz
+@@ -42,19 +41,19 @@
+ all: $(OBJS) $(OBJS_BNBT) $(OBJS_BNBTMYSQL) $(PROGS)
+ ./bnbt: $(OBJS) $(OBJS_BNBT)
+-      $(C++) -o ./bnbt $(OBJS) $(OBJS_BNBT) $(LFLAGS)
++      $(CXX) -o ./bnbt $(OBJS) $(OBJS_BNBT) $(LFLAGS)
+ ./bnbtmysql: $(OBJS) $(OBJS_BNBTMYSQL)
+-      $(C++) -o ./bnbtmysql $(OBJS) $(OBJS_BNBTMYSQL) $(LFLAGS) -L/usr/lib/mysql -lmysqlclient
++      $(CXX) -o ./bnbtmysql $(OBJS) $(OBJS_BNBTMYSQL) $(LFLAGS)
+ clean:
+       rm -f $(OBJS) $(OBJS_BNBT) $(OBJS_BNBTMYSQL) $(PROGS)
+ %.o: %.cpp
+-      $(C++) -o $@ $(CFLAGS) -c $<
++      $(CXX) -o $@ $(CFLAGS) -c $<
+ %.mysql.o: %.cpp
+-      $(C++) -o $@ $(CFLAGS) -DBNBT_MYSQL -c $<
++      $(CXX) -o $@ $(CFLAGS) -DBNBT_MYSQL -c $<
+ ./bnbt: $(OBJS) $(OBJS_BNBT)
diff --git a/net/cdp/Makefile b/net/cdp/Makefile
new file mode 100644 (file)
index 0000000..2d05612
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2009 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:=cdp-tools
+PKG_VERSION:=20070302
+PKG_RELEASE:=1
+
+PKG_SOURCE:=cdp-tools.tar.gz
+PKG_SOURCE_URL:=http://gpl.internetconnection.net/files/
+PKG_MD5SUM:=94e3a355a5c82a2a5b14114d1f9b0599
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_BUILD_DEPENDS:=+libpcap +libnet1
+
+
+define Package/cdp-tools
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=CDP tools (CISCO)
+  URL:=http://gpl.internetconnection.net
+  DEPENDS:=+libpcap
+endef
+
+define Package/dhcpcd/description
+       Tools to work with the Cisco Discovery Protocol (CDP)
+endef
+
+define Build/Compile
+       CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/pcap -I$(STAGING_DIR)/usr/lib/libnet-1.1.x/include" \
+       LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/libnet-1.1.x/lib" \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       $(TARGET_CONFIGURE_OPTS) \
+       all
+endef
+
+
+define Package/cdp-tools/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/{cdp-send,cdp-listen,cdp-routemgr} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,cdp-tools))
diff --git a/net/cdp/patches/001-compile_fixes.patch b/net/cdp/patches/001-compile_fixes.patch
new file mode 100644 (file)
index 0000000..90be6df
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile.orig    2006-10-26 20:58:35.000000000 +0300
++++ b/Makefile 2009-05-22 18:20:44.000000000 +0300
+@@ -1,7 +1,6 @@
+-CFLAGS += $(shell libnet-config --cflags --defines)
+-all: cdp-listen cdp-send
++all: cdp-send cdp-listen
+-cdp-listen: cdp-listen.o -lpcap
+-cdp-send: cdp-send.o $(shell libnet-config --libs)
++cdp-listen: cdp-listen.o $(STAGING_DIR)/usr/lib/libpcap.so
++cdp-send: cdp-send.o $(STAGING_DIR)/usr/lib/libnet-1.1.x/lib/libnet.a
+ clean:; rm -f cdp-send.o cdp-send cdp-listen.o cdp-listen
diff --git a/net/chaosvpn/Makefile b/net/chaosvpn/Makefile
new file mode 100644 (file)
index 0000000..48e79a8
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2010-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:=chaosvpn
+PKG_VERSION:=2.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
+PKG_SOURCE_URL:=http://github.com/downloads/ryd/chaosvpn/
+PKG_MD5SUM:=4263202d65bf4ab0d1356b149d7c53af
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/chaosvpn
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Config generator for chaos vpn
+  SUBMENU:=VPN
+  DEPENDS:=+ip +tinc +kmod-tun +libopenssl
+  URL:=https://wiki.hamburg.ccc.de/index.php/ChaosVPN::DebianHowto
+  MAINTAINER:=Christopher J. Pilkington <cjp@0x1.net>
+endef
+
+define Package/chaosvpn/description
+       Configure tincd for the chaosvpn network
+endef
+
+MAKE_FLAGS += \
+       COPT="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)"
+
+define Package/chaosvpn/install
+       $(INSTALL_DIR) $(1)/etc/tinc/chaos/ $(1)/usr/sbin/ $(1)/etc/init.d/ $(1)/etc/hotplug.d/iface/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/chaosvpn $(1)/usr/sbin/
+       #$(INSTALL_DATA) $(PKG_BUILD_DIR)/chaosvpn.conf $(1)/etc/tinc/
+       sed -e 's/"\/sbin\/ip /"\/usr\/sbin\/ip /' <$(PKG_BUILD_DIR)/chaosvpn.conf >$(1)/etc/tinc/chaosvpn.conf
+       $(INSTALL_BIN) ./files/chaosvpn_config.sh $(1)/usr/sbin/
+       $(INSTALL_BIN) ./files/chaosvpn.init $(1)/etc/init.d/chaosvpn
+       $(INSTALL_BIN) ./files/chaosvpn.hotplug $(1)/etc/hotplug.d/iface/40-chaosvpn
+endef
+
+$(eval $(call BuildPackage,chaosvpn))
+
diff --git a/net/chaosvpn/files/chaosvpn.hotplug b/net/chaosvpn/files/chaosvpn.hotplug
new file mode 100644 (file)
index 0000000..3044e53
--- /dev/null
@@ -0,0 +1,3 @@
+[ "$INTERFACE" == "wan" ] || return
+[ "$ACTION" == "ifup" ] && /etc/init.d/chaosvpn restart
+
diff --git a/net/chaosvpn/files/chaosvpn.init b/net/chaosvpn/files/chaosvpn.init
new file mode 100644 (file)
index 0000000..d415f5d
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=99
+
+SERVICE_DAEMONIZE=1
+
+start()
+{
+       /usr/sbin/chaosvpn_config.sh
+       [ $? = 0 ] || {
+               logger "not starting chaosvpn, check your config"
+               exit 1
+       }
+       service_start /usr/sbin/chaosvpn -f -c /etc/tinc/chaosvpn.conf
+}
+
+stop()
+{
+       service_stop /usr/sbin/chaosvpn
+}
diff --git a/net/chaosvpn/files/chaosvpn_config.sh b/net/chaosvpn/files/chaosvpn_config.sh
new file mode 100644 (file)
index 0000000..6b3b273
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+[ -f "/etc/tinc/chaos/rsa_key.pub" -a -f "/etc/tinc/chaos/rsa_key.priv" ] || {
+       echo "please generate rsa key pair"
+       echo "tincd -n chaos --generate-keys=2048"
+       exit 1
+}
+
+C=`grep unconfigured_please_change_me /etc/tinc/chaosvpn.conf  | wc -l`
+[ "$C" = "0" ] || {
+       echo "/etc/tinc/chaosvpn.conf is not configured yet"
+       exit 1
+}
+exit 0
diff --git a/net/chaosvpn/patches/001-dist-makefile.patch b/net/chaosvpn/patches/001-dist-makefile.patch
new file mode 100644 (file)
index 0000000..00b1d88
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/Makefile 2010-07-17 14:20:07.000000000 -0400
++++ b/Makefile 2010-07-17 18:50:30.000000000 -0400
+@@ -1,10 +1,7 @@
+-CC?=gcc
+-INCLUDES?=-I/usr/local/include
+-LIBDIRS?=-L/usr/local/lib
+-CFLAGS?=-std=c99 -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall -g $(INCLUDES)
+-LIB?=-lz -lcrypto
+-LEX?=flex
+-YACC?=yacc
++CC := gcc
++LIBS := -lssl -lz -lcrypto
++LEX := flex
++YACC := yacc
+ PREFIX?=/usr
+ TINCDIR?=/etc/tinc
+@@ -21,10 +18,10 @@
+ GITDEBVERSION=$(shell debian/scripts/calcdebversion )
+ $(NAME): main.o $(OBJ) $(HEADERS)
+-      $(CC) -o $@ main.o $(OBJ) $(LIB) $(LIBDIRS)
++      $(CC) $(COPT) -o $@ main.o $(OBJ) $(LIBS) $(LIB)
+ %.o: %.c $(HEADERS)
+-      $(CC) $(CFLAGS) -o $(patsubst %.c,%.o,$<) -c $<
++      $(CC) $(COPT) -o $(patsubst %.c,%.o,$<) -c $<
+ lex.yy.o: lex.yy.c y.tab.h
diff --git a/net/chillispot/Makefile b/net/chillispot/Makefile
new file mode 100644 (file)
index 0000000..c296a23
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006-2012 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:=chillispot
+PKG_VERSION:=1.1.0
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.chillispot.info/download
+PKG_MD5SUM:=9d2597756af3fa14d7331b4a3651fc9b
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/chillispot
+  SUBMENU:=Captive Portals
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-tun
+  TITLE:=Wireless LAN HotSpot controller
+  URL:=http://www.chillispot.info/
+endef
+
+define Package/chillispot/description
+       ChilliSpot is an open source captive portal or wireless LAN
+       access point controller. It is used for authenticating users
+       of a wireless LAN. It supports web based login which is today's
+       standard for public HotSpots and it supports Wireless Protected
+       Access (WPA) which is the standard of the future. Authentication,
+       authorization and accounting (AAA) is handled by your favorite
+       radius server.
+endef
+
+define Package/chillispot/conffiles
+/etc/chilli.conf
+endef
+
+# uses GNU configure
+
+define Package/chillispot/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/chilli
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/chilli.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,chillispot))
diff --git a/net/chillispot/files/chillispot.init b/net/chillispot/files/chillispot.init
new file mode 100644 (file)
index 0000000..3fbba8d
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+SERVICE_PID_FILE=/var/run/chilli.pid
+
+start() {
+       . /lib/functions/network.sh
+
+       local ipaddr
+       network_get_ipaddr ipaddr lan && \
+               service_start /usr/sbin/chilli --dns1="$ipaddr"
+}
+
+stop() {
+       service_stop /usr/sbin/chilli
+}
diff --git a/net/chillispot/patches/001-endian_fix.patch b/net/chillispot/patches/001-endian_fix.patch
new file mode 100644 (file)
index 0000000..7bc100e
--- /dev/null
@@ -0,0 +1,135 @@
+Index: chillispot-1.1.0/src/dhcp.c
+===================================================================
+--- chillispot-1.1.0.orig/src/dhcp.c   2006-09-24 19:48:25.000000000 +0200
++++ chillispot-1.1.0/src/dhcp.c        2007-09-25 15:35:12.521055038 +0200
+@@ -116,6 +116,24 @@
+ #endif
++/*
++ *    BrainSlayer: 
++ *    wrapper for fixing the big endian bugs within dhcp server code.its surelly not the best.
++ *    all dhcp packet fields must be handled in little endian
++ */
++
++static uint16_t swap16(uint16_t word) {
++#if __BYTE_ORDER == __BIG_ENDIAN
++  unsigned char low = word>>8;
++  unsigned char high = word&0xff;
++  return ((uint16_t)(high<<8))|low;
++#elif __BYTE_ORDER == __LITTLE_ENDIAN
++  return word;
++#else
++#error "Could not determine the system's endianness"
++#endif
++}
++
+ /**
+  * dhcp_ip_check()
+  * Generates an IPv4 header checksum.
+@@ -125,11 +143,11 @@
+   uint32_t sum = 0;
+   pack->iph.check = 0;
+   for (i=0; i<(pack->iph.ihl * 2); i++) {
+-    sum += ((uint16_t*) &pack->iph)[i];
++    sum += swap16(((uint16_t*) &pack->iph)[i]); /* brainslayer */
+   }
+   while (sum>>16)
+     sum = (sum & 0xFFFF)+(sum >> 16);
+-  pack->iph.check = ~sum;
++  pack->iph.check = swap16(~sum); /* brainslayer */
+   return 0;
+ }
+@@ -152,27 +170,28 @@
+   }
+   /* Sum UDP header and payload */
++              
+   for (i=0; i<(udp_len/2); i++) {
+-    sum += ((uint16_t*) &pack->udph)[i];
++    sum += swap16(((uint16_t*) &pack->udph)[i]); /* brainslayer */
+   }
+-  /* Sum any uneven payload octet */
++
+   if (udp_len & 0x01) {
+     sum += ((uint8_t*) &pack->udph)[udp_len-1];
+   }
+   /* Sum both source and destination address */
+   for (i=0; i<4; i++) {
+-    sum += ((uint16_t*) &pack->iph.saddr)[i];
++    sum += swap16(((uint16_t*) &pack->iph.saddr)[i]); /* brainslayer */
+   }
+   /* Sum both protocol and udp_len (again) */
+-  sum = sum + pack->udph.len + ((pack->iph.protocol<<8)&0xFF00);
++  sum = sum + swap16(pack->udph.len) + ((pack->iph.protocol<<8)&0xFF00); /* brainslayer */
+   while (sum>>16)
+     sum = (sum & 0xFFFF)+(sum >> 16);
+-  pack->udph.check = ~sum;
++  pack->udph.check = swap16(~sum); /* brainslayer */
+   return 0;
+ }
+@@ -201,7 +220,7 @@
+   /* Sum TCP header and payload */
+   for (i=0; i<(tcp_len/2); i++) {
+-    sum += ((uint16_t*) pack->payload)[i];
++    sum += swap16(((uint16_t*) pack->payload)[i]); /* brainslayer */
+   }
+   /* Sum any uneven payload octet */
+@@ -211,16 +230,16 @@
+   /* Sum both source and destination address */
+   for (i=0; i<4; i++) {
+-    sum += ((uint16_t*) &pack->iph.saddr)[i];
++    sum += swap16(((uint16_t*) &pack->iph.saddr)[i]); /* brainslayer */
+   }
+   /* Sum both protocol and tcp_len */
+-  sum = sum + htons(tcp_len) + ((pack->iph.protocol<<8)&0xFF00);
++  sum = sum + swap16(htons(tcp_len)) + ((pack->iph.protocol<<8)&0xFF00); /* brainslayer */
+   while (sum>>16)
+     sum = (sum & 0xFFFF)+(sum >> 16);
+-  tcph->check = ~sum;
++  tcph->check = swap16(~sum); /* brainslayer */
+   return 0;
+ }
+Index: chillispot-1.1.0/src/dhcp.h
+===================================================================
+--- chillispot-1.1.0.orig/src/dhcp.h   2006-09-24 19:48:25.000000000 +0200
++++ chillispot-1.1.0/src/dhcp.h        2007-09-25 15:35:12.533055724 +0200
+@@ -119,6 +119,8 @@
+   uint16_t prot;
+ };
++#include <endian.h>
++
+ /* Constants for IP packet */
+ #define DHCP_IP_ALEN   4
+ #define DHCP_IP_HLEN  20
+@@ -127,8 +129,15 @@
+ #define DHCP_IP_UDP   17 /* UDP Protocol number */
+ struct dhcp_iphdr_t {
++#if __BYTE_ORDER == __LITTLE_ENDIAN  /* nbd fix for swapped version and length field */
+   uint8_t  ihl:4;
+   uint8_t  version:4;
++#elif __BYTE_ORDER == __BIG_ENDIAN
++  uint8_t  version:4;
++  uint8_t  ihl:4;
++#else
++#error "Could not determine the system's endianness"
++#endif
+   uint8_t  tos;
+   uint16_t tot_len;
+   uint16_t id;
diff --git a/net/chillispot/patches/102-less_memory-footprint.patch b/net/chillispot/patches/102-less_memory-footprint.patch
new file mode 100644 (file)
index 0000000..b0a6c9c
--- /dev/null
@@ -0,0 +1,12 @@
+diff -baurN --exclude='*~' --exclude='.#*' --exclude='.svn*' --exclude='.conf*' --exclude=dl --exclude=bin --exclude=build_mipsel --exclude=staging_dir_mipsel --exclude=toolchain_build_mipsel --exclude=package/config --exclude=autom4te.cache --exclude='*.tgz' --exclude='*.zip' --exclude='*.tar' --exclude='*.gz' --exclude='.tmp*' chillispot-1.1.0.orig/src/chilli.h chillispot-1.1.0/src/chilli.h
+--- chillispot-1.1.0.orig/src/chilli.h 2006-10-19 00:01:55.000000000 +0100
++++ chillispot-1.1.0/src/chilli.h      2006-12-19 00:02:16.000000000 +0100
+@@ -53,7 +53,7 @@
+ /* #define COUNT_DOWNLINK_DROP 1 */
+ /* #define COUNT_UPLINK_DROP 1 */
+-#define APP_NUM_CONN 1024
++#define APP_NUM_CONN 128
+ #define EAP_LEN 2048            /* TODO: Rather large */
+ #define MACOK_MAX 16
diff --git a/net/chillispot/patches/110-macallowed_fix.patch b/net/chillispot/patches/110-macallowed_fix.patch
new file mode 100644 (file)
index 0000000..8567fc8
--- /dev/null
@@ -0,0 +1,21 @@
+diff -r -u chillispot-1.1.0/src/chilli.c chillispot-1.1.0-macallowed/src/chilli.c
+--- chillispot-1.1.0/src/chilli.c       2006-09-24 19:48:25.000000000 +0200
++++ chillispot-1.1.0-macallowed/src/chilli.c    2008-07-18 07:58:03.000000000 +0200
+@@ -534,6 +534,8 @@
+     }
+   }
+   free(p3);
++
++  return 0;
+ }
+
+ int static process_options(int argc, char **argv, int firsttime) {
+@@ -2991,7 +2993,7 @@
+
+   /* Get Service Type */
+   if (!radius_getattr(pack, &stateattr, RADIUS_ATTR_SERVICE_TYPE, 0, 0, 0)) {
+-    if(ntohl(attr->v.i) == RADIUS_SERVICE_TYPE_CHILLISPOT_AUTHORIZE_ONLY) {
++    if(ntohl(stateattr->v.i) == RADIUS_SERVICE_TYPE_CHILLISPOT_AUTHORIZE_ONLY) {
+       sys_err(LOG_ERR, __FILE__, __LINE__, 0,
+              "Chillispot-Authorize-Only Service-Type in Access-Accept");
+       return dnprot_reject(appconn);
diff --git a/net/chillispot/patches/120-fix_bufferoverflow.patch b/net/chillispot/patches/120-fix_bufferoverflow.patch
new file mode 100644 (file)
index 0000000..abc293b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/radius.c
++++ b/src/radius.c
+@@ -1002,7 +1002,7 @@ int radius_pwencode(struct radius_t *thi
+   }
+   /* Copy first 128 octets of src into dst */
+-  if (srclen <= 128) 
++  if (srclen > 128)
+     memcpy(dst, src, 128);
+   else
+     memcpy(dst, src, srclen);
diff --git a/net/chillispot/patches/150-chillispot-rmtctrl.patch b/net/chillispot/patches/150-chillispot-rmtctrl.patch
new file mode 100644 (file)
index 0000000..db5df95
--- /dev/null
@@ -0,0 +1,1529 @@
+--- a/src/chilli.c
++++ b/src/chilli.c
+@@ -102,6 +102,7 @@
+ #include "dhcp.h"
+ #include "cmdline.h"
+ #include "chilli.h"
++#include "remotectrl.h"
+ struct options_t options;
+@@ -127,6 +128,12 @@ static int do_sighup = 0;
+ /* Forward declarations */
+ int static acct_req(struct app_conn_t *conn, int status_type);
+ int static config_radius();
++void admin_disconnect(struct app_conn_t *appconn, int terminateCause);
++void admin_authorize(struct app_conn_t *appconn);
++int send_acct_head( struct rmt_socket_t *client, struct app_conn_t *appconn);
++int send_Connection( struct rmt_socket_t *client, struct app_conn_t *appconn );
++int send_Acct_Setting ( struct rmt_socket_t *client, struct app_conn_t *appconn );
++int send_Accounting( struct rmt_socket_t *client, struct app_conn_t *appconn );
+ /* Fireman catches falling childs and eliminates zombies */
+ void static fireman(int signum) { 
+@@ -180,19 +187,18 @@ int static leaky_bucket(struct app_conn_
+   struct timeval timenow;
+   uint64_t timediff; /* In microseconds */
+   int result = 0;
+-
+  
+   gettimeofday(&timenow, NULL);
+   timediff = (timenow.tv_sec - conn->last_time.tv_sec) * ((uint64_t) 1000000);
+   timediff += (timenow.tv_usec - conn->last_time.tv_usec);
+-  /*  if (options.debug) printf("Leaky bucket timediff: %lld, bucketup: %d, bucketdown: %d %d %d\n", 
+-                          timediff, conn->bucketup, conn->bucketdown, 
+-                          octetsup, octetsdown);*/
+-
+-  if (conn->bandwidthmaxup) {
++/*    if (options.debug) 
++                      printf("Leaky bucket timediff: %lld, bucketup: %d, bucketdown: %d %d %d\n",
++                                      timediff, conn->bucketup, conn->bucketdown, octetsup, octetsdown);
++*/
++      if (conn->bandwidthmaxup) {
+     /* Subtract what the leak since last time we visited */
+     if (conn->bucketup > ((timediff * conn->bandwidthmaxup)/8000000)) {
+       conn->bucketup -= (timediff * conn->bandwidthmaxup) / 8000000;
+@@ -200,9 +206,9 @@ int static leaky_bucket(struct app_conn_
+     else {
+       conn->bucketup = 0;
+     }
+-    
++//    printf("octetsup: %d -> conn->bucketup+octetsup: %d > conn->bucketupsize: %d \n", octetsup, conn->bucketup + octetsup, conn->bucketupsize);
+     if ((conn->bucketup + octetsup) > conn->bucketupsize) {
+-      /*if (options.debug) printf("Leaky bucket deleting uplink packet\n");*/
++      if (options.debug) printf("Leaky bucket deleting uplink packet\n");
+       result = -1;
+     }
+     else {
+@@ -217,9 +223,10 @@ int static leaky_bucket(struct app_conn_
+     else {
+       conn->bucketdown = 0;
+     }
++//    printf("octetsdown: %d -> conn->bucketdown+octetsdown: %d > conn->bucketdownsize: %d \n", octetsdown, conn->bucketdown + octetsdown, conn->bucketdownsize);
+     
+     if ((conn->bucketdown + octetsdown) > conn->bucketdownsize) {
+-      /*if (options.debug) printf("Leaky bucket deleting downlink packet\n");*/
++      if (options.debug) printf("Leaky bucket deleting downlink packet\n");
+       result = -1;
+     }
+     else {
+@@ -233,6 +240,7 @@ int static leaky_bucket(struct app_conn_
+ }
+ #endif /* ifndef NO_LEAKY_BUCKET */
++
+ /* Run external script */
+ int set_env(char *name, char *value, int len, struct in_addr *addr,
+@@ -550,7 +558,7 @@ int static process_options(int argc, cha
+     return -1;
+   }
+-  if (cmdline_parser_configfile (args_info.conf_arg, &args_info, 0, 0, 0)) {
++      if (cmdline_parser_configfile (args_info.conf_arg, &args_info, 0, 0, 0)) {
+     sys_err(LOG_ERR, __FILE__, __LINE__, 0,
+           "Failed to parse configuration file: %s!", 
+           args_info.conf_arg);
+@@ -1056,7 +1064,21 @@ int static process_options(int argc, cha
+                      strlen(args_info.macallowed_arg[numargs]))) 
+       return -1;
+   }
+-
++  /* remote monitor                                                    */
++  /* Defaults to net plus 1                                       */
++  if (!args_info.rmtlisten_arg)
++    options.rmtlisten.s_addr = options.uamlisten.s_addr;
++  else 
++              if (!inet_aton(args_info.rmtlisten_arg, &options.rmtlisten)){
++                      sys_err(LOG_ERR, __FILE__, __LINE__, 0,
++          "Invalid Remote monitor IP address: %s!", args_info.rmtlisten_arg);
++                      return -1;
++              }
++  /* rmtport                                                      */
++  options.rmtport = args_info.rmtport_arg;
++  options.rmtpasswd = args_info.rmtpasswd_arg;
++  options.bandwidthmaxup = args_info.bandwidthmaxup_arg;
++  options.bandwidthmaxdown = args_info.bandwidthmaxdown_arg;
+   /* foreground                                                   */
+   /* If flag not given run as a daemon                            */
+@@ -1095,7 +1117,6 @@ void static reprocess_options(int argc, 
+     memcpy(&options, &options2, sizeof(options));
+     return;
+   }
+-
+   /* Options which we do not allow to be affected */
+   /* fg, conf and statedir are not stored in options */
+   options.net = options2.net; /* net */
+@@ -1123,6 +1144,13 @@ void static reprocess_options(int argc, 
+   options.eapolenable = options2.eapolenable; /* eapolenable */
+   options.pidfile = options2.pidfile; /* pidfile */
++  options.rmtlisten = options2.rmtlisten; /* remote listen */
++  options.rmtport = options2.rmtport; /* remote port */
++  options.rmtpasswd = options2.rmtpasswd; /* remote password */
++
++//  options.bandwidthmaxup = options2.bandwidthmaxup; /* remote password */
++//  options.bandwidthmaxdown = options2.bandwidthmaxdown; /* remote password */
++
+   /* Reinit DHCP parameters */
+   (void) dhcp_set(dhcp, (options.debug & DEBUG_DHCP),
+                 options.uamserver, options.uamserverlen, options.uamanydns,
+@@ -3099,9 +3127,8 @@ int cb_radius_auth_conf(struct radius_t 
+       appconn->bucketupsize = BUCKET_SIZE_MIN;
+ #endif
+   }
+-  else {
++  else
+     appconn->bandwidthmaxup = 0;
+-  }
+   
+   /* Bandwidth down */
+   if (!radius_getattr(pack, &attr, RADIUS_ATTR_VENDOR_SPECIFIC,
+@@ -3116,9 +3143,8 @@ int cb_radius_auth_conf(struct radius_t 
+       appconn->bucketdownsize = BUCKET_SIZE_MIN;
+ #endif
+   }
+-  else {
++  else
+     appconn->bandwidthmaxdown = 0;
+-  }
+ #ifdef RADIUS_ATTR_CHILLISPOT_BANDWIDTH_MAX_UP
+   /* Bandwidth up */
+@@ -3623,7 +3649,7 @@ int cb_dhcp_data_ind(struct dhcp_conn_t 
+     appconn->input_octets +=len;
+ #ifndef NO_LEAKY_BUCKET
+ #ifdef COUNT_UPLINK_DROP
+-    if (leaky_bucket(appconn, len, 0)) return 0;
++    if (leaky_bucket(appconn, len, 0)==-1) return 0;
+ #endif /* ifdef COUNT_UPLINK_DROP */
+ #endif /* ifndef NO_LEAKY_BUCKET */
+   }
+@@ -3889,6 +3915,10 @@ int main(int argc, char **argv)
+   struct sigaction act;
+   struct itimerval itval;
++      struct rmt_socket_t srv;
++      struct rmt_socket_t client[MAX_CLIENTS];
++      int activeClients = 0;                  /* Número clientes conectados */
++
+   /* open a connection to the syslog daemon */
+   /*openlog(PACKAGE, LOG_PID, LOG_DAEMON);*/
+   openlog(PACKAGE, (LOG_PID | LOG_PERROR), LOG_DAEMON);
+@@ -4046,6 +4076,8 @@ int main(int argc, char **argv)
+   if (options.debug) 
+     printf("Waiting for client request...\n");
++      
++      srv = rmtctrl_initSrv(options.rmtlisten, options.rmtport);
+   /******************************************************************/
+   /* Main select loop                                               */
+@@ -4053,6 +4085,8 @@ int main(int argc, char **argv)
+   while (keep_going) {
++              rmtctrl_srv(srv,client,&activeClients);
++
+     if (do_timeouts) {
+       /*if (options.debug) printf("Do timeouts!\n");*/
+       (void) radius_timeout(radius);
+@@ -4178,3 +4212,487 @@ int main(int argc, char **argv)
+   return 0;
+   
+ }
++
++void rmtctrl_msg_proccess(struct rmt_socket_t *client)
++{
++      msg_head_t header;
++      char *msg=NULL;
++      char *reg=NULL;
++      struct app_conn_t *appconn;
++      struct dhcp_conn_t *dhcpconn;
++      char str[2048];
++      int found=0;
++      int rslt=0;
++      int n;
++      uint64_t l;
++      rslt = rmtctrl_read_msg(client,&header,&msg);
++      if (rslt > 0)
++      {
++              switch (header.id)
++              {
++                      case QRY_CONNECTED_LIST:
++                              rslt += send_srvData(client);
++                              rslt += rmtctrl_write_msg(client,MSG_START,0, "\n" );
++                              rslt += rmtctrl_write_msg(client,MSG_PART,0, "Ord ---------- User Name ----------- -- MAC Address -- -- IP Address - -- Input - - Output - Sta\n" );
++                              for (n=0; n<APP_NUM_CONN; n++) {
++                                      appconn = &connection[n];
++                                      if ((appconn->inuse != 0)){
++                                              dhcpconn = (struct dhcp_conn_t*) appconn->dnlink;
++                                              found++;
++                                              l = found;
++                                              rslt += send_number(client, MSG_PART, 0, "%3s ", l);
++                                              rslt += send_line(client,MSG_PART,0, "%-32s ",appconn->proxyuser);
++                                              rslt += send_mac(client,MSG_PART,0, "%17s ",appconn->hismac);
++                                              rslt += send_line(client,MSG_PART,0, "%15s ",inet_ntoa(appconn->hisip));
++                                              rslt += send_number(client,MSG_PART,0, "%10s ",appconn->input_octets);
++                                              rslt += send_number(client,MSG_PART,0, "%10s ",appconn->output_octets);
++                                              rslt += send_number(client, MSG_PART, 0, " %s ",appconn->authenticated);
++                                              rslt += send_number(client, MSG_PART, 0, " %s \n",dhcpconn->authstate);
++                                      }
++                              }
++                              rslt += send_number(client,MSG_END,found, "Total of connected device(s) %s\n",found);
++                      break;
++                      case QRY_CONNECTED_FULL_LIST:
++                              rslt += send_srvData(client);
++                              rslt += rmtctrl_write_msg(client,MSG_START,0, "\n" );
++                              for (n=0; n<APP_NUM_CONN; n++) {
++                                      appconn = &connection[n];
++                                      if ((appconn->inuse != 0)){
++                                              found++;
++                                              l = found;
++                                              rslt += send_number(client, MSG_PART, 0, "Connection : %s\n{\n", l);
++                                              rslt += send_acct_head( client, appconn);
++                                              rslt += send_line(client, MSG_PART, 0, "%s\n", "}");
++                                      }
++                              }
++                              rslt += send_number(client, MSG_END, found, "Total of connected device(s) %s\n",found);
++                      break;
++                      case QRY_STATUS:
++                              ///
++                              rslt += send_Status(client, appconn);
++                      break;
++                      case CMD_AUTHORIZE:
++                              for (n=0; n<APP_NUM_CONN; n++)
++                              {
++                                      l = 0;
++                                      appconn = &connection[n];
++                                      if ((appconn->inuse != 0) && (appconn->authenticated == 0))
++                                      {
++                                              switch (header.extra)
++                                              {
++                                                      case EXTRA_MAC_OP:
++                                                              if ( strcmp(msg,mac2str(appconn->hismac)) == 0)
++                                                              {
++                                                                      found++;
++                                                                      l=1;
++                                                                      break;
++                                                              }
++                                                      break;
++                                                      case EXTRA_IP_OP:
++                                                              if ( strcmp(msg,inet_ntoa(appconn->hisip)) == 0)
++                                                              {
++                                                                      found++;
++                                                                      l=1;
++                                                                      break;
++                                                              }
++                                                      break;
++                                                      case EXTRA_USER_OP:
++                                                              if ( strcmp(msg,appconn->proxyuser) == 0)
++                                                              {
++                                                                      found++;
++                                                                      l=1;
++                                                                      break;
++                                                              }
++                                                      break;
++                                                      default:
++                                                              found++;
++                                                              l=1;
++                                                      break;
++                                              }
++                                              if ( l == 1 ){
++                                                      admin_authorize(appconn);
++                                                      rslt += send_srvData( client );
++                                                      rslt += rmtctrl_write_msg(client,MSG_PART,0, " \n" );
++                                                      rslt += send_acct_head( client, appconn);
++                                                      sys_err(LOG_NOTICE, __FILE__, __LINE__, 0,
++                                                              "Admin Authorize MAC=%s IP=%s",
++                                                              mac2str(appconn->hismac), inet_ntoa(appconn->hisip));
++                                              }
++                                      }
++                              }
++                              if (found == 0)
++                                      rslt += rmtctrl_write_msg(client,MSG_END,0, "Not device found to Authorze\n" );
++                              else 
++                              {
++                                      rslt += send_number(client, MSG_END, found, "Autorized %s device(s)\n",found);
++                              }
++                      break;
++                      case CMD_DISCONNECT:
++                              for (n=0; n<APP_NUM_CONN; n++)
++                              {
++                                      l = 0;
++                                      appconn = &connection[n];
++                                      if ((appconn->inuse != 0) && (appconn->authenticated == 1))
++                                      {
++                                              if (dhcpconn = (struct dhcp_conn_t*) appconn->dnlink) {
++                                                      switch (header.extra)
++                                                      {
++                                                              case EXTRA_MAC_OP:
++                                                                      if ( strcmp(msg,mac2str(appconn->hismac)) == 0)
++                                                                      {
++                                                                              found++;
++                                                                              l=1;
++                                                                              break;
++                                                                      }
++                                                              break;
++                                                              case EXTRA_IP_OP:
++                                                                      if ( strcmp(msg,inet_ntoa(appconn->hisip)) == 0)
++                                                                      {
++                                                                              found++;
++                                                                              l=1;
++                                                                              break;
++                                                                      }
++                                                              break;
++                                                              case EXTRA_USER_OP:
++                                                                      if ( strcmp(msg,appconn->proxyuser) == 0)
++                                                                      {
++                                                                              found++;
++                                                                              l=1;
++                                                                              break;
++                                                                      }
++                                                              break;
++                                                              default:
++                                                                      found++;
++                                                                      l=1;
++                                                              break;
++                                                      }
++                                                      if ( l == 1 ) {
++                                                              rslt += send_srvData( client );
++                                                              rslt += rmtctrl_write_msg(client,MSG_PART,0, " \n" );
++                                                              rslt += send_acct_head( client, appconn);
++                                                              admin_disconnect(appconn, RADIUS_TERMINATE_CAUSE_ADMIN_RESET);
++                                                              sys_err(LOG_NOTICE, __FILE__, __LINE__, 0,
++                                                                      "Admin Disconnect username=%s IP=%s",
++                                                                      appconn->user, inet_ntoa(appconn->hisip));
++                                                      }
++                                              }
++                                      }
++                              }
++                              if (found == 0)
++                                      rslt += rmtctrl_write_msg(client,MSG_END,0, "Not decice found to Disconnect\n" );
++                              else 
++                              {
++                                      rslt += send_number(client, MSG_END, found, "Disconnect %s device(s)\n",found);
++                              }
++                      break;
++                      default:
++                                      rslt += rmtctrl_write_msg(client,MSG_END,0, "Unknow command.\n" );
++                      break;
++              }
++      }
++      else
++      {
++              printf("Desde %s se recibieron %d bytes y se enviaron %d bytes\n",inet_ntoa(client->addr.sin_addr),client->Rx,client->Tx);
++              close(client->fd); /* cierra fd_rmt_client */
++              printf("Client cerro conexión desde %s\n",inet_ntoa(client->addr.sin_addr) ); 
++              client->fd = -1;
++      }
++      if(msg)
++              free(msg);
++}
++
++void admin_authorize(struct app_conn_t *appconn)
++{
++  struct radius_packet_t radius_pack;
++      strcpy(appconn->user,"Admin-Authorize");
++      strcpy(appconn->proxyuser,"Admin-Authorize");
++      appconn->proxyuserlen = strlen(appconn->proxyuser);
++      appconn->interim_interval = 600;
++      appconn->terminate_cause = 0;
++      appconn->idletimeout = 300;
++
++      radius_default_pack(radius, &radius_pack, RADIUS_CODE_ACCESS_REQUEST);
++  radius_pack.code = RADIUS_CODE_ACCESS_REQUEST;
++//  (void) radius_addattr(radius, &radius_pack, RADIUS_ATTR_USER_NAME, 0, 0, 0,
++//                    (uint8_t*) appconn->proxyuser, appconn->proxyuserlen);
++
++      if ( options.bandwidthmaxup > 0 ){
++              appconn->bandwidthmaxup = options.bandwidthmaxup * 1024;
++    appconn->bucketupsize = BUCKET_TIME * appconn->bandwidthmaxup / 8000;
++    if (appconn->bucketupsize < BUCKET_SIZE_MIN) 
++      appconn->bucketupsize = BUCKET_SIZE_MIN;
++      }
++      if ( options.bandwidthmaxdown > 0 ){
++              appconn->bandwidthmaxdown = options.bandwidthmaxdown * 1024;
++    appconn->bucketdownsize = BUCKET_TIME * appconn->bandwidthmaxdown / 8000;
++    if (appconn->bucketdownsize < BUCKET_SIZE_MIN) 
++      appconn->bucketdownsize = BUCKET_SIZE_MIN;
++      }
++      dnprot_accept(appconn);
++}
++
++void admin_disconnect(struct app_conn_t *appconn, int terminateCause)
++{
++      dnprot_terminate(appconn);
++      (void) acct_req(appconn, RADIUS_STATUS_TYPE_STOP);
++      set_sessionid(appconn);
++}
++
++int send_acct_head( struct rmt_socket_t *client, struct app_conn_t *appconn)
++{
++      int rslt;
++      rslt += send_Connection( client, appconn );
++      rslt += send_Acct_Setting( client, appconn );
++      rslt += send_Accounting( client, appconn );
++      return rslt;
++}
++
++int send_Connection( struct rmt_socket_t *client, struct app_conn_t *appconn )
++{
++      int rslt;
++      uint64_t l;
++      rslt += send_line(client, MSG_PART, 0, "\tSession-Id = %s\n",appconn->sessionid);
++      rslt += send_line(client, MSG_PART, 0, "\tUser-Name = %s\n",appconn->user);
++//    rslt = send_line(client, MSG_PART, 0, "\tnasip=%s\n",appconn->nasip);
++      rslt += send_mac(client, MSG_PART, 0, "\tClient-Mac-Address = %s\n",appconn->hismac);
++      rslt += send_mac(client, MSG_PART, 0, "\tNas-Mac-Address = %s\n",appconn->ourmac);
++//    rslt += send_line(client, MSG_PART, 0, "\tourip=%s\n",inet_ntoa(appconn->ourip));
++      rslt += send_line(client, MSG_PART, 0, "\tClient-Ip = %s\n",inet_ntoa(appconn->hisip));
++      rslt += send_line(client, MSG_PART, 0, "\tClient-Require-Ip = %s\n",inet_ntoa(appconn->reqip));
++      rslt += send_number(client, MSG_PART, 0, "\tAutheticated = %s\n",appconn->authenticated);
++      l = appconn->uamtime;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tUAM-Time = %s\n",l);
++      if (strlen(appconn->userurl)>0)
++              rslt = send_line(client, MSG_PART, 0, "\tUser-URL = %s\n",appconn->userurl);
++      return rslt;
++}
++
++int send_Acct_Setting ( struct rmt_socket_t *client, struct app_conn_t *appconn )
++{
++      int rslt = 0;
++      uint64_t l;
++      if (appconn->authenticated == 0 ) return 0;
++      /* Account Settings */
++      l = appconn->sessionterminatetime;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tSession-Terminate-Time = %s\n",l);
++      l = appconn->sessiontimeout;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tSession-Timeout = %s\n",l);
++      l = appconn->idletimeout;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tIdle-Timeout = %s\n",l);
++      l = appconn->bandwidthmaxup;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tBandwidth-Max-Up = %s\n",l);
++      l = appconn->bandwidthmaxdown;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tBandwidth-Max-Down = %s\n",l);
++      l = appconn->maxinputoctets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tMax-Input-Octets = %s\n",l);
++      l = appconn->maxoutputoctets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tMax-Output-Octets = %s\n",l);
++      l = appconn->maxtotaloctets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tMax-Total-Octets = %s\n",l);
++      return rslt;
++}
++
++int send_Accounting( struct rmt_socket_t *client, struct app_conn_t *appconn )
++{
++      if (appconn->authenticated == 0 ) return 0;
++      int rslt = 0;
++      uint64_t l;
++      l = appconn->start_time.tv_sec;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tStart-Time = %s\n",l);
++      l = appconn->interim_time.tv_sec;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tInterim-Time = %s\n",l);
++      l = appconn->interim_interval;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tInterim-Interval = %s\n",l);
++      l = appconn->last_time.tv_sec;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tLast-Time = %s\n",l);
++      l = appconn->input_packets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tInput-Packets = %s\n",l);
++      l = appconn->output_packets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tOutput-Packets = %s\n",l);
++      l = appconn->input_octets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tInput-Octets = %s\n",l);
++      l = appconn->output_octets;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tOutput-Octets = %s\n",l);
++      l = appconn->terminate_cause;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tTerminate-Cause = %s\n",l);
++      l = appconn->bucketup;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tBucket-Up = %s\n",l);
++      l = appconn->bucketdown;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tBucket-Down = %s\n",l);
++      l = appconn->bucketupsize;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tBucket-Up-Size = %s\n",l);
++      l = appconn->bucketdownsize;
++      if (l > 0)
++              rslt += send_number(client, MSG_PART, 0, "\tBucket-Down-Size = %s\n",l);
++      return rslt;
++}
++
++int send_srvData( struct rmt_socket_t *client)
++{
++      int rslt=0;
++      rslt += send_line(client, MSG_PART, 0, "%s\n",options.radiusnasid);
++      if (options.radiuslocationid)
++              rslt += send_line(client, MSG_PART, 0, "\tLOCATION ID:%s\n",options.radiuslocationid);
++      if (options.radiuslocationname)
++              rslt += send_line(client, MSG_PART, 0, "\tLOCATION NAME:%s\n",options.radiuslocationname);
++//    rslt += send_line(client, MSG_PART, 0, "\tDEVICE: %s ",tun->devname);
++//    rslt += send_line(client, MSG_PART, 0, "INTERFACE: %s\n",options.dhcpif);
++//    rslt += send_line(client, MSG_PART, 0, "\tIP ADDR: %s ",inet_ntoa(options.dhcplisten));
++//    rslt += send_line(client, MSG_PART, 0, "NETWORK: %s ",inet_ntoa(options.net));
++//    rslt += send_line(client, MSG_PART, 0, "MASK: %s\n",inet_ntoa(options.mask));
++      if (options.dns1.s_addr)
++              rslt += send_line(client, MSG_PART, 0, "\tDNS SERVERS: %s - ",inet_ntoa(options.dns1));
++      if (options.dns2.s_addr)
++              rslt += send_line(client, MSG_PART, 0, "%s\n",inet_ntoa(options.dns2));
++      rslt += send_line(client, MSG_PART, 0, "\tRADIUS SERVERS: %s - ",inet_ntoa(options.radiusserver1));
++      rslt += send_line(client, MSG_PART, 0, "%s\n",inet_ntoa(options.radiusserver2));
++      return rslt;
++}
++
++int send_Status( struct rmt_socket_t *client, struct app_conn_t *appconn )
++{
++      int rslt = 0;
++      int n;
++      uint64_t l;
++      l = options.debug;
++      rslt += send_number(client, MSG_PART, 0, "\tdebug=%s\n",l);
++      /* conf */
++      l = options.interval;
++      rslt += send_number(client, MSG_PART, 0, "\tinterval=%s\n",l);
++      rslt += send_line(client, MSG_PART, 0, "\tpidfile=%s\n",options.pidfile);
++      /* TUN parameters */
++      rslt += send_line(client, MSG_PART, 0, "\tnet=%s\n",inet_ntoa(options.net)); /* Network IP address */
++      rslt += send_line(client, MSG_PART, 0, "\tmask=%s\n",inet_ntoa(options.mask)); /* Network mask */
++      rslt += send_line(client, MSG_PART, 0, "\tnetc=%s\n",options.netc);
++      rslt += send_line(client, MSG_PART, 0, "\tmaskc=%s\n",options.maskc);
++      l = options.allowdyn;
++      rslt += send_number(client, MSG_PART, 0, "\tallowdyn=%s\n",l); /* Allow dynamic address allocation */
++      rslt += send_line(client, MSG_PART, 0, "\tdynip=%s\n",options.dynip); /* Dynamic IP address pool */
++
++      l = options.allowstat;
++      rslt += send_number(client, MSG_PART, 0, "\tallowstat=%s\n",l); /* Allow static address allocation */
++      rslt += send_line(client, MSG_PART, 0, "\tstatip=%s\n",options.statip); /* Static IP address pool */
++
++      rslt += send_line(client, MSG_PART, 0, "\tdns1=%s\n",inet_ntoa(options.dns1)); /* Primary DNS server IP address */
++      rslt += send_line(client, MSG_PART, 0, "\tdns2=%s\n",inet_ntoa(options.dns2)); /* Secondary DNS server IP address */
++      rslt += send_line(client, MSG_PART, 0, "\tdomain=%s\n",options.domain); /* Domain to use for DNS lookups */
++      rslt += send_line(client, MSG_PART, 0, "\tipup=%s\n",options.ipup); /* Script to run after link-up */
++      rslt += send_line(client, MSG_PART, 0, "\tipdown=%s\n",options.ipdown); /* Script to run after link-down */
++      rslt += send_line(client, MSG_PART, 0, "\tconup=%s\n",options.conup); /* Script to run after user logon */
++      rslt += send_line(client, MSG_PART, 0, "\tcondown=%s\n",options.condown); /* Script to run after user logoff */
++      /* Radius parameters */
++      rslt += send_line(client, MSG_PART, 0, "\tradiuslisten=%s\n",inet_ntoa(options.radiuslisten)); /* IP address to listen to */
++      rslt += send_line(client, MSG_PART, 0, "\tradiusserver1=%s\n",inet_ntoa(options.radiusserver1)); /* IP address of radius server 1 */
++      rslt += send_line(client, MSG_PART, 0, "\tradiusserver2=%s\n",inet_ntoa(options.radiusserver2)); /* IP address of radius server 2 */
++      l = options.radiusauthport;
++      rslt += send_number(client, MSG_PART, 0, "\tradiusauthport=%s\n",l); /* Authentication UDP port */
++      l = options.radiusacctport;
++      rslt += send_number(client, MSG_PART, 0, "\tradiusacctport=%s\n",l); /* Accounting UDP port */
++      rslt += send_line(client, MSG_PART, 0, "\tradiussecret=%s\n",options.radiussecret); /* Radius shared secret */
++      rslt += send_line(client, MSG_PART, 0, "\tradiusnasid=%s\n",options.radiusnasid); /* Radius NAS-Identifier */
++      rslt += send_line(client, MSG_PART, 0, "\tradiuscalled=%s\n",options.radiuscalled); /* Radius Called-Station-ID */
++      rslt += send_line(client, MSG_PART, 0, "\tradiusnasip=%s\n",inet_ntoa(options.radiusnasip)); /* Radius NAS-IP-Address */
++      rslt += send_line(client, MSG_PART, 0, "\tradiuslocationid=%s\n",options.radiuslocationid); /* WISPr location ID */
++      rslt += send_line(client, MSG_PART, 0, "\tradiuslocationname=%s\n",options.radiuslocationname); /* WISPr location name */
++      l = options.radiusnasporttype;
++      rslt += send_number(client, MSG_PART, 0, "\tradiusnasporttype=%s\n",l); /* NAS-Port-Type */
++      l = options.coaport;
++      rslt += send_number(client, MSG_PART, 0, "\tcoaport=%s\n",l); /* UDP port to listen to */
++      l = options.coanoipcheck;
++      rslt += send_number(client, MSG_PART, 0, "\tcoaipcheck=%s\n",l); /* Allow disconnect from any IP */
++      /* Radius proxy parameters */
++      rslt += send_line(client, MSG_PART, 0, "\tproxylisten=%s\n",inet_ntoa(options.proxylisten)); /* IP address to listen to */
++      l = options.proxyport;
++      rslt += send_number(client, MSG_PART, 0, "\tproxyport=%s\n",l); /* UDP port to listen to */
++      rslt += send_line(client, MSG_PART, 0, "\tproxyaddr=%s\n",inet_ntoa(options.proxyaddr)); /* IP address of proxy client(s) */
++      rslt += send_line(client, MSG_PART, 0, "\tproxymask=%s\n",inet_ntoa(options.proxymask)); /* IP mask of proxy client(s) */
++      rslt += send_line(client, MSG_PART, 0, "\tproxysecret=%s\n",options.proxysecret); /* Proxy shared secret */
++      /* Radius configuration management parameters */
++      rslt += send_line(client, MSG_PART, 0, "\tconfusername=%s\n",options.confusername); /* Username for remote config */
++      rslt += send_line(client, MSG_PART, 0, "\tconfpassword=%s\n",options.confpassword); /* Password for remote config */
++      /* DHCP parameters */
++      l = options.nodhcp;
++      rslt += send_number(client, MSG_PART, 0, "\tnodhcp=%s\n",l); /* Do not use DHCP */
++      rslt += send_line(client, MSG_PART, 0, "\tdhcpif=%s\n",options.dhcpif); /* Interface: eth0 */
++      rslt += send_mac(client, MSG_PART, 0, "\tdhcpmac=%s\n",options.dhcpmac); /* Interface MAC address */
++      l = options.dhcpusemac;
++      rslt += send_number(client, MSG_PART, 0, "\tdhcpusemac=%s\n",l); /* Use given MAC or interface default */
++      rslt += send_line(client, MSG_PART, 0, "\tdhcplisten=%s\n",inet_ntoa(options.dhcplisten)); /* IP address to listen to */
++      l = options.lease;
++      rslt += send_number(client, MSG_PART, 0, "\tlease=%s\n",l); /* DHCP lease time */
++      /* EAPOL parameters */
++      l = options.eapolenable;
++      rslt += send_number(client, MSG_PART, 0, "\teapolenable=%s\n",l); /* Use eapol */
++      /* UAM parameters */
++      l = options.uamserverlen;
++      rslt += send_number(client, MSG_PART, 0, "\tuamserverlen=%s\n",l); /* Number of UAM servers */
++      for (n = 0; n < options.uamserverlen; n++){
++              rslt += send_number(client, MSG_PART, 0, "\tuamokip[%s]=",n);
++              rslt += send_line(client, MSG_PART, 0, "%s\n",inet_ntoa(options.uamserver[n])); /* IP address of UAM server */
++      }
++      l = options.uamserverport;
++      rslt += send_number(client, MSG_PART, 0, "\tuamserverport=%s\n",l); /* Port of UAM server */
++      rslt += send_line(client, MSG_PART, 0, "\tuamsecret=%s\n",options.uamsecret); /* Shared secret */
++      rslt += send_line(client, MSG_PART, 0, "\tuamurl=%s\n",options.uamurl); /* URL of authentication server */
++      rslt += send_line(client, MSG_PART, 0, "\tuamhomepage=%s\n",options.uamhomepage); /* URL of redirection homepage */
++      l = options.uamhomepageport;
++      rslt += send_number(client, MSG_PART, 0, "\tuamhomepageport=%s\n",l); /* Port of redirection homepage */
++      rslt += send_line(client, MSG_PART, 0, "\tuamlisten=%s\n",inet_ntoa(options.uamlisten)); /* IP address of local authentication */
++      l = options.uamport;
++      rslt += send_number(client, MSG_PART, 0, "\tuamport=%s\n",l); /* TCP port to listen to */
++      l = options.uamokiplen;
++      rslt += send_number(client, MSG_PART, 0, "\tuamokiplen=%s\n",l); /* Number of allowed IP addresses */
++      for (n=0; n < options.uamokiplen; n++){
++              rslt += send_number(client, MSG_PART, 0, "\tuamokip[%s]=",n);
++              rslt = send_line(client, MSG_PART, 0, "%s\n",inet_ntoa(options.uamokip[n])); /* List of allowed IP addresses */
++      }
++      l = options.uamoknetlen;
++      rslt += send_number(client, MSG_PART, 0, "\tuamoknetlen=%s\n",l); /* Number of networks */
++      for (n=0; n < options.uamoknetlen; n++){
++              rslt += send_number(client, MSG_PART, 0, "\tuamoknet[%s]=",n);
++              rslt += send_line(client, MSG_PART, 0, "%s/",inet_ntoa(options.uamokaddr[n])); /* List of allowed network IP */
++              rslt += send_line(client, MSG_PART, 0, "%s\n",inet_ntoa(options.uamokmask[n])); /* List of allowed network mask */
++      }
++      l = options.uamanydns;
++      rslt += send_number(client, MSG_PART, 0, "\tuamanydns=%s\n",l); /* Allow client to use any DNS server */
++      /* MAC Authentication */
++      l = options.macauth;
++      rslt += send_number(client, MSG_PART, 0, "\tmacauth=%s\n",l); /* Use MAC authentication */
++      l = options.macoklen; 
++      rslt += send_number(client, MSG_PART, 0, "\tmacoklen=%s\n",l); /* Number of MAC addresses */
++      for (n=0; n < options.macoklen; n++){
++              rslt += send_number(client, MSG_PART, 0, "\tmacok[%s]=",n);
++              rslt += send_mac(client, MSG_PART, 0, "\%s\n",options.macok[n]); /* Allowed MACs */
++      }
++      rslt += send_line(client, MSG_PART, 0, "\tmacsuffix=%s\n",options.macsuffix);
++      rslt += send_line(client, MSG_PART, 0, "\tmacpasswd=%s\n",options.macpasswd);
++
++      rslt += send_line(client, MSG_PART, 0, "\trmtlisten=%s\n",inet_ntoa(options.rmtlisten));
++      l = options.rmtport; 
++      rslt += send_number(client, MSG_PART, 0, "\trmtport=%s\n",l); /* Number of MAC addresses */
++      rslt += send_line(client, MSG_PART, 0, "\trmtpasswd=%s\n",options.rmtpasswd);
++      rslt += send_number(client, MSG_PART, 0, "\tbandwidthmaxup=%s\n",options.bandwidthmaxup);
++      rslt += send_number(client, MSG_PART, 0, "\tbandwidthmaxdown=%s\n",options.bandwidthmaxdown);
++      rslt += rmtctrl_write_msg(client,MSG_END,0, "End of configuration\n");
++}
+--- a/src/chilli.h
++++ b/src/chilli.h
+@@ -50,8 +50,8 @@
+ /* If the constants below are defined packets which have been dropped
+    by the traffic shaper will be counted towards accounting and
+    volume limitation */
+-/* #define COUNT_DOWNLINK_DROP 1 */
+-/* #define COUNT_UPLINK_DROP 1 */
++#define COUNT_DOWNLINK_DROP 1 
++#define COUNT_UPLINK_DROP 1 
+ #define APP_NUM_CONN 128
+ #define EAP_LEN 2048            /* TODO: Rather large */
+@@ -68,7 +68,7 @@
+ #define CHALLENGESIZE 24 /* From chap.h MAX_CHALLENGE_LENGTH */
+ #define USERURLSIZE 256  /* Max length of URL requested by user */
+-#define BUCKET_SIZE  300000 /* Size of leaky bucket (~200 packets) */
++//#define BUCKET_SIZE  300000 /* Size of leaky bucket (~200 packets) */
+ /* Time length of leaky bucket in milliseconds */
+ /* Bucket size = BUCKET_TIME * Bandwidth-Max radius attribute */
+@@ -194,12 +194,14 @@ struct app_conn_t {
+   struct in_addr dns1;
+   struct in_addr dns2;
+   struct timeval last_time; /* Last time a packet was received or sent */
++  struct timeval last_up_time; /* Last time a packet was received or sent */
++  struct timeval last_down_time; /* Last time a packet was received or sent */
+   /* Leaky bucket */
+-  uint32_t bucketup;
+-  uint32_t bucketdown;
+-  uint32_t bucketupsize;
+-  uint32_t bucketdownsize;
++  uint64_t bucketup;
++  uint64_t bucketdown;
++  uint64_t bucketupsize;
++  uint64_t bucketdownsize;
+   /* UAM information */
+   uint8_t uamchal[REDIR_MD5LEN];
+@@ -305,6 +307,11 @@ struct options_t {
+   int macoklen;                   /* Number of MAC addresses */
+   char* macsuffix;               /* Suffix to add to MAC address */
+   char* macpasswd;               /* Password to use for MAC authentication */  
++  struct in_addr rmtlisten;      /* IP address of remote monitor and config */
++  int rmtport;                   /* TCP port to listen to monitor and config*/
++  char* rmtpasswd;               /* Password to use for MAC authentication */  
++      int bandwidthmaxup;            /* Default Max Up Bandwith setting */
++      int bandwidthmaxdown;          /* Default Max Up Bandwith setting */
+ };
+ extern struct app_conn_t connection[APP_NUM_CONN];
+--- a/src/cmdline.c
++++ b/src/cmdline.c
+@@ -113,6 +113,11 @@ void clear_given (struct gengetopt_args_
+   args_info->macallowed_given = 0 ;
+   args_info->macsuffix_given = 0 ;
+   args_info->macpasswd_given = 0 ;
++  args_info->rmtlisten_given = 0 ;
++  args_info->rmtport_given = 0 ;
++  args_info->rmtpasswd_given = 0 ;
++  args_info->bandwidthmaxup_given = 0 ;
++  args_info->bandwidthmaxdown_given = 0 ;
+ }
+ static
+@@ -216,7 +221,19 @@ void clear_args (struct gengetopt_args_i
+   args_info->macsuffix_orig = NULL;
+   args_info->macpasswd_arg = gengetopt_strdup ("password");
+   args_info->macpasswd_orig = NULL;
+-  
++  args_info->rmtport_arg = 3991;
++  args_info->rmtport_orig = NULL;
++  args_info->rmtlisten_arg = gengetopt_strdup("127.0.0.1");
++      args_info->rmtlisten_orig = NULL;
++  args_info->rmtport_orig = NULL;
++  args_info->rmtpasswd_arg = NULL;
++  args_info->rmtpasswd_orig = NULL;
++
++  args_info->bandwidthmaxup_arg = 0;
++  args_info->bandwidthmaxup_orig = NULL;
++  args_info->bandwidthmaxdown_arg = 0;
++  args_info->bandwidthmaxdown_orig = NULL;
++      
+ }
+ void
+@@ -284,7 +301,12 @@ cmdline_parser_print_help (void)
+   printf("%s\n","      --macauth                 Authenticate based on MAC address  \n                                  (default=off)");
+   printf("%s\n","      --macallowed=STRING       List of allowed MAC addresses");
+   printf("%s\n","      --macsuffix=STRING        Suffix to add to the MAC address");
+-  printf("%s\n","      --macpasswd=STRING        Password used when performing MAC \n                                  authentication  (default=`password')");
++  printf("%s\n","      --macpasswd=STRING        Password used when performing MAC       \n                                  authentication  (default='password')");
++  printf("%s\n","      --rmtlisten=STRING        IP address to listen to for monitor and \n                                  configuration (default=`127.0.0.1')");
++  printf("%s\n","      --rmtport=INT             TCP port to bind to for monitor and     \n                                  configuration (default=`3991')");
++  printf("%s\n","      --rmtpasswd=STRING        Password used for remote monitor and    \n                                  configuration\n");
++  printf("%s\n","      --bandwidthmaxup=INT      Deafaul Max Up Setting in Kilobits\n");
++  printf("%s\n","      --bandwidthmaxdown=INT    Deafaul Max Down Setting in Kilobits\n");
+   
+ }
+@@ -675,6 +697,11 @@ cmdline_parser_release (struct gengetopt
+       free (args_info->uamport_orig); /* free previous argument */
+       args_info->uamport_orig = 0;
+     }
++  if (args_info->macpasswd_orig)
++    {
++      free (args_info->macpasswd_orig); /* free previous argument */
++      args_info->macpasswd_orig = 0;
++    }
+   if (args_info->uamallowed_arg)
+     {
+       for (i = 0; i < args_info->uamallowed_given; ++i)
+@@ -739,6 +766,34 @@ cmdline_parser_release (struct gengetopt
+       free (args_info->macpasswd_orig); /* free previous argument */
+       args_info->macpasswd_orig = 0;
+     }
++  if (args_info->rmtlisten_orig)
++    {
++      free (args_info->rmtlisten_orig); /* free previous argument */
++      args_info->rmtlisten_orig = 0;
++    }
++  if (args_info->rmtport_orig)
++    {
++      free (args_info->rmtport_orig); /* free previous argument */
++      args_info->rmtport_orig = 0;
++    }
++
++  if (args_info->rmtpasswd_orig)
++    {
++      free (args_info->rmtpasswd_orig); // free previous argument 
++      args_info->rmtpasswd_orig = 0;
++    }
++  
++  if (args_info->bandwidthmaxup_orig)
++    {
++      free (args_info->bandwidthmaxup_orig); // free previous argument 
++      args_info->bandwidthmaxup_orig = 0;
++    }
++  
++  if (args_info->bandwidthmaxdown_orig)
++    {
++      free (args_info->bandwidthmaxdown_orig); // free previous argument 
++      args_info->bandwidthmaxdown_orig = 0;
++    }
+   
+   clear_given (args_info);
+ }
+@@ -1109,7 +1164,41 @@ cmdline_parser_file_save(const char *fil
+       fprintf(outfile, "%s\n", "macpasswd");
+     }
+   }
+-  
++  if (args_info->rmtlisten_given) {
++    if (args_info->rmtlisten_orig) {
++      fprintf(outfile, "%s=\"%s\"\n", "rmtlisten", args_info->rmtlisten_orig);
++    } else {
++      fprintf(outfile, "%s\n", "rmtlisten");
++    }
++  }
++  if (args_info->rmtport_given) {
++    if (args_info->rmtport_orig) {
++      fprintf(outfile, "%s=\"%s\"\n", "rmtport", args_info->rmtport_orig);
++    } else {
++      fprintf(outfile, "%s\n", "rmtport");
++    }
++  }
++  if (args_info->rmtpasswd_given) {
++    if (args_info->rmtpasswd_orig) {
++      fprintf(outfile, "%s=\"%s\"\n", "rmtpasswd", args_info->rmtpasswd_orig);
++    } else {
++      fprintf(outfile, "%s\n", "rmtpasswd");
++    }
++  }
++  if (args_info->bandwidthmaxup_given) {
++    if (args_info->bandwidthmaxup_orig) {
++      fprintf(outfile, "%s=\"%s\"\n", "bandwidthmaxup", args_info->bandwidthmaxup_orig);
++    } else {
++      fprintf(outfile, "%s\n", "bandwidthmaxup");
++    }
++  }
++  if (args_info->bandwidthmaxdown_given) {
++    if (args_info->bandwidthmaxdown_orig) {
++      fprintf(outfile, "%s=\"%s\"\n", "bandwidthmaxdown", args_info->bandwidthmaxdown_orig);
++    } else {
++      fprintf(outfile, "%s\n", "bandwidthmaxdown");
++    }
++  }
+   fclose (outfile);
+   i = EXIT_SUCCESS;
+@@ -1221,6 +1310,7 @@ cmdline_parser_internal (int argc, char 
+ {
+   int c;      /* Character of the parsed option.  */
+   char *multi_token, *multi_next; /* for multiple options */
++      char quehace[100];
+   int i;        /* Counter */
+@@ -1299,6 +1389,11 @@ cmdline_parser_internal (int argc, char 
+         { "macallowed",       1, NULL, 0 },
+         { "macsuffix",        1, NULL, 0 },
+         { "macpasswd",        1, NULL, 0 },
++        { "rmtport",  1, NULL, 0 },
++        { "rmtlisten",        1, NULL, 0 },
++        { "rmtpasswd",        1, NULL, 0 },
++        { "bandwidthmaxup",   1, NULL, 0 },
++        { "bandwidthmaxdown", 1, NULL, 0 },
+         { NULL,       0, NULL, 0 }
+       };
+@@ -1380,8 +1475,6 @@ cmdline_parser_internal (int argc, char 
+             free (args_info->net_orig); /* free previous string */
+           args_info->net_orig = gengetopt_strdup (optarg);
+           break;
+-
+-
+         case 0:       /* Long option with no short option */
+           /* Which modules to print debug messages for.  */
+           if (strcmp (long_options[option_index].name, "debugfacility") == 0)
+@@ -2273,7 +2366,93 @@ cmdline_parser_internal (int argc, char 
+               free (args_info->macpasswd_orig); /* free previous string */
+             args_info->macpasswd_orig = gengetopt_strdup (optarg);
+           }
+-          
++          /* IP address to listen to for remote monitor and config.  */
++          else if (strcmp (long_options[option_index].name, "rmtlisten") == 0)
++          {
++            if (local_args_info.rmtlisten_given)
++              {
++                fprintf (stderr, "%s: `--rmtlisten' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
++                goto failure;
++              }
++            if (args_info->rmtlisten_given && ! override)
++              continue;
++            local_args_info.rmtlisten_given = 1;
++            args_info->rmtlisten_given = 1;
++            if (args_info->rmtlisten_arg)
++              free (args_info->rmtlisten_arg); /* free previous string */
++            args_info->rmtlisten_arg = gengetopt_strdup (optarg);
++            if (args_info->rmtlisten_orig)
++              free (args_info->rmtlisten_orig); /* free previous string */
++            args_info->rmtlisten_orig = gengetopt_strdup (optarg);
++          }
++          /* TCP port to bind to for authentication requests.  */
++          else if (strcmp (long_options[option_index].name, "rmtport") == 0)
++          {
++            if (local_args_info.rmtport_given)
++              {
++                fprintf (stderr, "%s: `--rmtport' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
++                goto failure;
++              }
++            if (args_info->rmtport_given && ! override)
++              continue;
++            local_args_info.rmtport_given = 1;
++            args_info->rmtport_given = 1;
++            args_info->rmtport_arg = strtol (optarg,&stop_char,0);
++            if (args_info->rmtport_orig)
++              free (args_info->rmtport_orig); /* free previous string */
++            args_info->rmtport_orig = gengetopt_strdup (optarg);
++          }
++          /* Password used when performing remote config.  */
++          else if (strcmp (long_options[option_index].name, "rmtpasswd") == 0)
++          {
++            if (local_args_info.rmtpasswd_given)
++              {
++                fprintf (stderr, "%s: `--rmtpasswd' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
++                goto failure;
++              }
++            if (args_info->rmtpasswd_given && ! override)
++              continue;
++            local_args_info.rmtpasswd_given = 1;
++            args_info->rmtpasswd_given = 1;
++            if (args_info->rmtpasswd_arg)
++              free (args_info->rmtpasswd_arg); // free previous string 
++            args_info->rmtpasswd_arg = gengetopt_strdup (optarg);
++            if (args_info->rmtpasswd_orig)
++              free (args_info->rmtpasswd_orig); // free previous string 
++            args_info->rmtpasswd_orig = gengetopt_strdup (optarg);
++          }
++          else if (strcmp (long_options[option_index].name, "bandwidthmaxup") == 0)
++          {
++            if (local_args_info.bandwidthmaxup_given)
++              {
++                fprintf (stderr, "%s: `--bandwidthmaxup' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
++                goto failure;
++              }
++            if (args_info->bandwidthmaxup_given && ! override)
++              continue;
++            local_args_info.bandwidthmaxup_given = 1;
++            args_info->bandwidthmaxup_given = 1;
++            args_info->bandwidthmaxup_arg = strtol (optarg,&stop_char,0);
++            if (args_info->bandwidthmaxup_orig)
++              free (args_info->bandwidthmaxup_orig); /* free previous string */
++            args_info->bandwidthmaxup_orig = gengetopt_strdup (optarg);
++          }
++          else if (strcmp (long_options[option_index].name, "bandwidthmaxdown") == 0)
++          {
++            if (local_args_info.bandwidthmaxdown_given)
++              {
++                fprintf (stderr, "%s: `--bandwidthmaxdown' option given more than once%s\n", argv[0], (additional_error ? additional_error : ""));
++                goto failure;
++              }
++            if (args_info->bandwidthmaxdown_given && ! override)
++              continue;
++            local_args_info.bandwidthmaxdown_given = 1;
++            args_info->bandwidthmaxdown_given = 1;
++            args_info->bandwidthmaxdown_arg = strtol (optarg,&stop_char,0);
++            if (args_info->bandwidthmaxdown_orig)
++              free (args_info->bandwidthmaxdown_orig); /* free previous string */
++            args_info->bandwidthmaxdown_orig = gengetopt_strdup (optarg);
++          }
+           break;
+         case '?':     /* Invalid option.  */
+           /* `getopt_long' already printed an error message.  */
+--- a/src/cmdline.ggo
++++ b/src/cmdline.ggo
+@@ -119,3 +119,12 @@ option "macallowed"  - "List of allowed 
+ option "macsuffix"   - "Suffix to add to the MAC address" string no
+ option "macpasswd"   - "Password used when performing MAC authentication" string default="password" no
++# Remote Monitor and Config
++option "rmtlisten"   - "IP address to listen to for authentication requests" string default="127.0.0.1" no
++option "rmtport"     - "TCP port to bind to for authentication requests" int default="3991" no
++option "rmtpasswd"   - "Password used when performing MAC authentication" string no
++
++# Extra settings
++option "bandwidthmaxup" - "Default bandwidth control to apply when account don't have setting" int no
++option "bandwidthmaxdown" - "Default bandwidth control to apply when account don't have setting" int no
++
+--- a/src/cmdline.h
++++ b/src/cmdline.h
+@@ -122,6 +122,17 @@ struct gengetopt_args_info
+   char * macsuffix_orig;      /* Suffix to add to the MAC address original value given at command line.  */
+   char * macpasswd_arg;       /* Password used when performing MAC authentication (default='password').  */
+   char * macpasswd_orig;      /* Password used when performing MAC authentication original value given at command line.  */
++  int rmtport_arg;    /* TCP port to bind to for remote monitor and config (default='3991').  */
++  char * rmtport_orig;        /* TCP port to bind to for remote monitor and config original value given at command line.  */
++  char * rmtlisten_arg;       /* IP address to listen to for remote monitor and config.  */
++  char * rmtlisten_orig;      /* IP address to listen to for remote monitor and config original value given at command line.  */
++  char * rmtpasswd_arg;       /* Password for remote monitor and config.  */
++  char * rmtpasswd_orig;      /* Password for remote monitor and config original value given at command line.  */
++  int bandwidthmaxup_arg;     /* Default Bandwidth Max Up.  */
++  char *bandwidthmaxup_orig;  /* Default Bandwidth Max Up value given at command line.  */
++  int bandwidthmaxdown_arg;   /* Default Bandwidth Max Down.  */
++  char *bandwidthmaxdown_orig;        /* Default Bandwidth Max Down value given at command line.  */
++
+   
+   int help_given ;    /* Whether help was given.  */
+   int version_given ; /* Whether version was given.  */
+@@ -177,7 +188,11 @@ struct gengetopt_args_info
+   unsigned int macallowed_given ;     /* Whether macallowed was given.  */
+   int macsuffix_given ;       /* Whether macsuffix was given.  */
+   int macpasswd_given ;       /* Whether macpasswd was given.  */
+-
++  int rmtport_given ; /* Whether uamport was given.  */
++  int rmtlisten_given ;       /* Whether uamlisten was given.  */
++  int rmtpasswd_given ;       /* Whether confpassword was given.  */
++      int bandwidthmaxup_given ;
++      int bandwidthmaxdown_given ;
+ } ;
+ int cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info);
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -54,7 +54,7 @@ PROGRAMS = $(sbin_PROGRAMS)
+ am_chilli_OBJECTS = chilli.$(OBJEXT) tun.$(OBJEXT) cmdline.$(OBJEXT) \
+       ippool.$(OBJEXT) radius.$(OBJEXT) md5.$(OBJEXT) \
+       redir.$(OBJEXT) dhcp.$(OBJEXT) syserr.$(OBJEXT) \
+-      iphash.$(OBJEXT) lookup.$(OBJEXT)
++      iphash.$(OBJEXT) lookup.$(OBJEXT)  remotectrl.$(OBJEXT)
+ chilli_OBJECTS = $(am_chilli_OBJECTS)
+ chilli_LDADD = $(LDADD)
+ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+@@ -172,7 +172,7 @@ target_alias = 
+ # add -pg to enable gprof
+ AM_CFLAGS = -D_GNU_SOURCE -fno-builtin -DSBINDIR='"$(sbindir)"' 
+-chilli_SOURCES = chilli.c defs.h tun.c tun.h cmdline.c cmdline.h ippool.c ippool.h radius.h radius.c md5.c md5.h redir.h redir.c dhcp.c dhcp.h syserr.c syserr.h iphash.c iphash.h lookup.c lookup.h
++chilli_SOURCES = chilli.c defs.h tun.c tun.h cmdline.c cmdline.h ippool.c ippool.h radius.h radius.c md5.c md5.h redir.h redir.c dhcp.c dhcp.h syserr.c syserr.h iphash.c iphash.h lookup.c lookup.h remotectrl.c remotectrl.h
+ all: all-am
+ .SUFFIXES:
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -54,7 +54,7 @@ PROGRAMS = $(sbin_PROGRAMS)
+ am_chilli_OBJECTS = chilli.$(OBJEXT) tun.$(OBJEXT) cmdline.$(OBJEXT) \
+       ippool.$(OBJEXT) radius.$(OBJEXT) md5.$(OBJEXT) \
+       redir.$(OBJEXT) dhcp.$(OBJEXT) syserr.$(OBJEXT) \
+-      iphash.$(OBJEXT) lookup.$(OBJEXT)
++      iphash.$(OBJEXT) lookup.$(OBJEXT)  remotectrl.$(OBJEXT)
+ chilli_OBJECTS = $(am_chilli_OBJECTS)
+ chilli_LDADD = $(LDADD)
+ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+@@ -172,7 +172,7 @@ target_alias = @target_alias@
+ # add -pg to enable gprof
+ AM_CFLAGS = -D_GNU_SOURCE -fno-builtin -DSBINDIR='"$(sbindir)"' 
+-chilli_SOURCES = chilli.c defs.h tun.c tun.h cmdline.c cmdline.h ippool.c ippool.h radius.h radius.c md5.c md5.h redir.h redir.c dhcp.c dhcp.h syserr.c syserr.h iphash.c iphash.h lookup.c lookup.h
++chilli_SOURCES = chilli.c defs.h tun.c tun.h cmdline.c cmdline.h ippool.c ippool.h radius.h radius.c md5.c md5.h redir.h redir.c dhcp.c dhcp.h syserr.c syserr.h iphash.c iphash.h lookup.c lookup.h remotectrl.c remotectrl.h
+ all: all-am
+ .SUFFIXES:
+--- /dev/null
++++ b/src/remotectrl.c
+@@ -0,0 +1,340 @@
++#include <stdio.h>          
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <errno.h>
++
++#include "remotectrl.h"
++
++/*
++char *vstrcat(char *first, ...)
++{
++      size_t len = 0;
++      char *retbuf;
++      va_list argp;
++      char *p;
++      char *tmp="";
++      if(first == NULL)
++              first=tmp;
++//            return NULL;
++      
++      len = strlen(first);
++              
++      va_start(argp, first);
++
++      while((p = va_arg(argp, char *)) != NULL)
++              len += strlen(p);
++
++      va_end(argp);
++      retbuf = (char *)malloc(len + 1);       // +1 for trailing \0 
++
++      if(retbuf == NULL)
++              return NULL;            // error 
++
++      (void)strcpy(retbuf, first);
++
++      va_start(argp, first);
++
++      while((p = va_arg(argp, char *)) != NULL)
++              (void)strcat(retbuf, p);
++
++      va_end(argp);
++
++      return retbuf;
++}
++*/
++
++int rmtctrl_write_msg( struct rmt_socket_t *sckHnd, uint32_t id, uint32_t extra, char *message ){
++      msg_head_t header;
++      int rslt;
++      header.id    = id;
++      header.len   = strlen(message);
++      header.extra = extra;
++  rslt = send(sckHnd->fd,&header,sizeof(struct msg_head_t),0);
++      if (rslt != -1 && header.len > 0) {
++              sckHnd->Tx += rslt;
++              rslt = send(sckHnd->fd, message, header.len, 0);
++              if (rslt > 0)
++              {
++                      sckHnd->Tx += rslt;
++                      rslt += sizeof(struct msg_head_t);
++              }
++      }
++      return rslt;
++}
++
++int rmtctrl_read_msg( struct rmt_socket_t *sckHnd, msg_head_t *head, char **message )
++{
++//    msg_head_t header;
++      int rslt;
++      char *buffer;
++      int reading = 0;
++      int aux = 0;
++  rslt = recv(sckHnd->fd, head, sizeof(struct msg_head_t), 0);
++      if (rslt == sizeof(struct msg_head_t) ) {
++              sckHnd->Rx += rslt;
++              *message = (char *)malloc(head->len+1);
++              memset(*message,'\0', head->len+1);
++              while ( reading < head->len ){
++                      aux = recv(sckHnd->fd, *message, head->len, 0);
++                      switch ( aux ) 
++                      {
++                              case -1:
++                                      switch (errno)
++                                      {
++                                              case EINTR:
++                                              case EAGAIN:
++                                                      usleep (100);
++                                                      break;
++                                              default:
++                                                      return -1;
++                                      }
++                              break;
++                              case 0: // mean socket was closed
++                                      sckHnd->Rx += reading;
++                                      return reading;
++                                      break;
++                              break;
++                              default:
++                                      reading+=aux;
++                              break;
++                      }
++              }
++/*
++              buffer = (char *)malloc(head->len+1);
++              while ( reading < head->len ){
++                      memset(buffer,'\0', head->len+1);
++                      aux = recv(sckHnd->fd, buffer, head->len, 0);
++                      switch ( aux ) {
++                              case -1:
++                                      switch (errno){
++                                              case EINTR:
++                                              case EAGAIN:
++                                                      usleep (100);
++                                                      break;
++                                              default:
++                                                      return -1;
++                                      }
++                              break;
++                              case 0: // mean socket was closed
++                                      sckHnd->Rx += reading;
++                                      return reading;
++                                      break;
++                              break;
++                              default:
++                                      if (reading == 0) 
++                                              *message=(char *)malloc(aux+1);
++                                      else
++                                              *message=(char*)realloc(*message,(reading+aux+1)*sizeof(char));
++//                                            strcat(*message, buffer);
++                                      memcpy(*message+reading, buffer, aux);
++                                      reading += aux;
++                                      *message[reading]=0;
++                      }
++              }
++              free(buffer);
++*/
++              sckHnd->Rx += reading;
++              reading += rslt;
++              return reading;
++      }
++      return rslt;
++}
++
++void rmtctrl_newClient(struct rmt_socket_t srv, struct rmt_socket_t *client, int *activeClients)
++{
++      int rslt;
++      int cli = (*activeClients);
++      rmtctrl_accept(srv,&client[cli]);
++      if (client[(*activeClients)].fd != -1)
++      {
++              (*activeClients)++;
++      }
++      if ((*activeClients) >= MAX_CLIENTS)
++      {
++              (*activeClients)--;
++              rslt = rmtctrl_write_msg(&client[(*activeClients)],MSG_END,0, "Sorry Server is too Busy\n       Try more late\n" );
++              if (rslt > 0) client[(*activeClients)].Tx += rslt;
++              rmtctrl_close(&client[(*activeClients)]);
++      }
++}
++
++void rmtctrl_close ( struct rmt_socket_t *client )
++{
++      printf("Desde %s se recibieron %d bytes y se enviaron %d bytes\n",inet_ntoa(client->addr.sin_addr),client->Rx,client->Tx);
++      close(client->fd); /* cierra fd_rmt_client */
++      printf("Se cerro conexión desde %s\n",inet_ntoa(client->addr.sin_addr) ); 
++      client->fd = -1;
++}
++
++void rmtctrl_accept (struct rmt_socket_t srv, struct rmt_socket_t *client ) 
++{
++      int sin_size=sizeof(struct sockaddr_in);
++      int int_Send;
++      struct sockaddr_in addr;
++      
++      if ((client->fd = accept(srv.fd,(struct sockaddr *)&client->addr,&sin_size))!=-1) 
++      {
++              client->Rx = 0;
++              client->Tx = 0;
++              unsigned char c = sizeof(uint32_t);
++              int_Send = send(client->fd, &c, 1, 0);
++              if (int_Send > 0) client->Tx += int_Send;
++              printf("Se abrió una conexión desde %s\n", inet_ntoa(client->addr.sin_addr)); 
++      }
++}
++
++//void cleanClients (int *table, int *n)
++void rmtctrl_cleanClients (struct rmt_socket_t *client, int *n)
++{
++      int i,j;
++
++      if ((client == NULL) || ((*n) == 0))
++              return;
++
++      j=0;
++      for (i=0; i<(*n); i++)
++      {
++              if (client[i].fd != -1)
++              {
++                      client[j].fd = client[i].fd;
++                      client[j].addr = client[i].addr;
++                      client[j].Rx = client[i].Rx;
++                      client[j].Tx = client[i].Tx;
++                      j++;
++              }
++      }
++      
++      *n = j;
++}
++
++int rmtctrl_maxValue (struct rmt_socket_t *client, int n)
++{
++      int i;
++      int max;
++
++      if ((client == NULL) || (n<1))
++              return 0;
++              
++      max = client[0].fd;
++      for (i=0; i<n; i++)
++              if (client[i].fd > max)
++                      max = client[i].fd;
++
++      return max;
++}
++
++struct rmt_socket_t rmtctrl_initSrv(struct in_addr rmtlisten, int rmtport){
++      struct rmt_socket_t srv;
++      if ((srv.fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ) {  
++              printf("error en socket()\n");
++              exit(1);
++      }
++      srv.addr.sin_family = AF_INET;
++      srv.addr.sin_port = htons(rmtport); 
++      srv.addr.sin_addr.s_addr = rmtlisten.s_addr;
++      memset(&(srv.addr.sin_zero), 0, 8); 
++
++      if(bind(srv.fd,(struct sockaddr*)&srv.addr,sizeof(struct sockaddr))==-1) {
++              printf("error en bind() \n");
++              exit(-1);
++      }     
++
++      if(listen(srv.fd,BACKLOG) == -1) {
++              printf("error en listen()\n");
++              exit(-1);
++      }
++      return srv;
++}
++
++void rmtctrl_srv(struct rmt_socket_t srv, struct rmt_socket_t *client, int *activeClients)
++{
++      fd_set fdRead;
++      int maxHnd;
++      int i;
++      struct timeval  nowait; 
++      memset((char *)&nowait,0,sizeof(nowait)); 
++
++      rmtctrl_cleanClients(client, activeClients);
++      FD_ZERO (&fdRead);
++      FD_SET (srv.fd, &fdRead);
++
++      for (i=0; i<*activeClients; i++)
++              FD_SET (client[i].fd, &fdRead);
++
++      maxHnd = rmtctrl_maxValue (client, *activeClients);
++              
++      if (maxHnd < srv.fd)
++              maxHnd = srv.fd;
++
++      select (maxHnd + 1, &fdRead, NULL, NULL,&nowait);
++      for (i=0; i<*activeClients; i++)
++      {
++              if (FD_ISSET (client[i].fd, &fdRead))
++              {
++                              rmtctrl_msg_proccess(&client[i]);
++              }
++      }
++      if (FD_ISSET (srv.fd, &fdRead))
++              rmtctrl_newClient(srv,client, &(*activeClients));
++}
++
++int send_line( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, char *data)
++{
++      char str[2048];
++      memset(str,'\0',2048);
++      sprintf(str,fmt,data);
++      return rmtctrl_write_msg(client,msg_type,msg_extra, str);
++}
++
++int send_octets( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, uint64_t value)
++{
++      char *Buffer = (char *)octets2str(value);
++      int ret = send_line( client, msg_type, msg_extra, fmt, Buffer);
++      free(Buffer);
++      return ret;
++}
++
++int send_mac( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, uint8_t *value)
++{
++      char *Buffer = (char*)mac2str(value);
++      int ret = send_line( client, msg_type, msg_extra, fmt, Buffer);
++      free(Buffer);
++      return ret;
++}
++
++int send_number( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, uint64_t value)
++{
++      char Buffer[64];
++      sprintf(Buffer,"%d", value);
++      return send_line( client, msg_type, msg_extra, fmt, Buffer);
++}
++
++const char * mac2str(uint8_t *mac)
++{
++      char *buffer;
++      buffer=(char*)malloc(18*sizeof(char));
++      memset(buffer,'\0',18);
++      (void) sprintf(buffer,"%.2X-%.2X-%.2X-%.2X-%.2X-%.2X",
++                  mac[0], mac[1],
++                  mac[2], mac[3],
++                  mac[4], mac[5]);
++      return buffer;
++}
++
++const char * octets2str(uint64_t value)
++{
++      char *buffer;
++      buffer=(char*)malloc(13*sizeof(char));
++      memset(buffer,'\0',13);
++      if (value/8 > 1073741824){ // gigas
++              sprintf(buffer,"%.1f(GiB)",((value/8.0)/1073741824.0));
++      }else if (value/8 > 1048576){ // megas
++              sprintf(buffer,"%.1f(MiB)",((value/8.0)/1048576.0));
++      }else if (value/8 > 1024){ // KiloBytes
++              sprintf(buffer,"%.1f(KiB)",((value/8.0)/1024.0));
++      }else // Bytes
++              sprintf(buffer,"%.1f(B)",(value/8));
++      return buffer;
++}
++
+--- /dev/null
++++ b/src/remotectrl.h
+@@ -0,0 +1,86 @@
++#include <stdarg.h>
++#ifndef _RMTCTRL_H
++#define _RMTCTRL_H
++
++enum 
++{
++      MSG_OK              = 0,
++      MSG_START           = 1,
++      MSG_PART            = 2,
++      MSG_END             = 3,
++      QRY_STATUS          = 100,
++      QRY_CONNECTED_LIST      = 101,
++      QRY_CONNECTED_FULL_LIST = 102,
++      QRY_MACADDR         = 103,
++      QRY_IPADDR          = 104,
++      QRY_USERNAME        = 105,
++
++      CMD_AUTHORIZE                           = 200,
++      CMD_DISCONNECT                  = 201,
++      
++      EXTRA_ALL_OP                            = 300,
++      EXTRA_MAC_OP                            = 301,
++      EXTRA_IP_OP                                     = 302,
++      EXTRA_USER_OP                           = 303,
++};
++
++enum
++{
++      STRING,
++      IP_ADDR,
++      MAC_ADDR,
++      NUMBER,
++      OCTETS,
++};
++
++#define PORT 15557 /* El puerto que ser? abierto */
++#define BACKLOG 2 /* El n?mero de conexiones permitidas */
++#define MAX_CLIENTS 10
++static char CONVERT_BUFF[1024];
++
++typedef struct msg_head_t {
++      uint32_t id;
++      uint32_t extra;
++      uint32_t len;
++} msg_head_t;
++
++typedef struct rmt_socket_t {
++      int fd;
++      struct sockaddr_in addr;
++      int Rx;
++      int Tx;
++} rmt_socket_t;
++
++//char *vstrcat(char *first, ...);
++
++      
++int rmtctrl_write_msg( struct rmt_socket_t *sckHnd, uint32_t id, uint32_t extra, char *message );
++int rmtctrl_read_msg( struct rmt_socket_t *sckHnd, msg_head_t *head, char **message );
++void rmtctrl_newClient(struct rmt_socket_t srv, struct rmt_socket_t *client, int *activeClients);
++void rmtctrl_close ( struct rmt_socket_t *client );
++void rmtctrl_accept (struct rmt_socket_t srv, struct rmt_socket_t *client );
++void rmtctrl_cleanClients (struct rmt_socket_t *client, int *n);
++
++//inicializa las variables y arranca el servidor
++struct rmt_socket_t rmtctrl_initSrv(struct in_addr rmtlisten, int rmtport);
++//esta funcion es la que va dentro del loop del programa que lo utiliza
++void rmtctrl_srv(struct rmt_socket_t srv, struct rmt_socket_t *client, int *activeClients);
++//En esta funcion es donde se define como se procesan los mensajes
++void rmtctrl_msg_proccess(struct rmt_socket_t *client);
++
++//char * pepe(char *dest, char *sep, char *src);
++
++//char * send_value(char *name, char *value, int len, struct in_addr *addr,
++//        uint8_t *mac, long int *integer);
++//int addfield(char* reg, char *field, char sep);
++//int addfield1(char** reg,int rlen, char *field, int flen, char sep);
++//int sendConnectedInfo(struct app_conn_t *appconn, struct rmt_socket_t *client); 
++//const char * value2str( int type, void *value);
++const char * octets2str(uint64_t value);
++const char * mac2str(uint8_t *mac);
++int send_line( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, char *data);
++int send_octets( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, uint64_t value);
++int send_mac( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, uint8_t *value);
++int send_number( struct rmt_socket_t *client, int msg_type, int msg_extra, char *fmt, uint64_t value);
++
++#endif        /* !_RMTCTRL_H */
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -3,7 +3,7 @@ sbin_PROGRAMS = chilli
+ # add -pg to enable gprof
+ AM_CFLAGS = -D_GNU_SOURCE -fno-builtin -DSBINDIR='"$(sbindir)"' 
+-chilli_SOURCES = chilli.c defs.h tun.c tun.h cmdline.c cmdline.h ippool.c ippool.h radius.h radius.c md5.c md5.h redir.h redir.c dhcp.c dhcp.h syserr.c syserr.h iphash.c iphash.h lookup.c lookup.h
++chilli_SOURCES = chilli.c defs.h tun.c tun.h cmdline.c cmdline.h ippool.c ippool.h radius.h radius.c md5.c md5.h redir.h redir.c dhcp.c dhcp.h syserr.c syserr.h iphash.c iphash.h lookup.c lookup.h remotectrl.c remotectrl.h
+ # chilli_LDFLAGS = -lcrypt
diff --git a/net/chillispot/patches/200-gcc_fix.patch b/net/chillispot/patches/200-gcc_fix.patch
new file mode 100644 (file)
index 0000000..a819216
--- /dev/null
@@ -0,0 +1,57 @@
+diff -Naur chillispot-1.1.0/src/tun.c chillispot-1.1.0.patched/src/tun.c
+--- chillispot-1.1.0/src/tun.c 2006-09-24 20:48:25.000000000 +0300
++++ chillispot-1.1.0.patched/src/tun.c 2009-10-20 02:08:49.000000000 +0300
+@@ -366,7 +366,7 @@
+   this->addrs++;
+   return 0;
+-#elif defined (__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
++#elif defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
+   int fd;
+   struct ifaliasreq      areq;
+@@ -445,7 +445,7 @@
+ #if defined(__linux__)
+   ifr.ifr_netmask.sa_family = AF_INET;
+-#elif defined(__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
++#elif defined(__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
+   ((struct sockaddr_in *) &ifr.ifr_addr)->sin_len = 
+     sizeof (struct sockaddr_in);
+   ((struct sockaddr_in *) &ifr.ifr_dstaddr)->sin_len = 
+@@ -497,7 +497,7 @@
+     ((struct sockaddr_in *) &ifr.ifr_netmask)->sin_addr.s_addr = 
+       netmask->s_addr;
+-#elif defined(__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
++#elif defined(__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
+     ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr = 
+       netmask->s_addr;
+@@ -585,7 +585,7 @@
+   close(fd);
+   return 0;
+   
+-#elif defined(__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
++#elif defined(__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
+ struct {
+   struct rt_msghdr rt;
+@@ -674,7 +674,7 @@
+ #if defined(__linux__)
+   struct ifreq ifr;
+-#elif defined(__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
++#elif defined(__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
+   char devname[IFNAMSIZ+5]; /* "/dev/" + ifname */
+   int devnum;
+   struct ifaliasreq areq;
+@@ -722,7 +722,7 @@
+   ioctl((*tun)->fd, TUNSETNOCSUM, 1); /* Disable checksums */
+   return 0;
+   
+-#elif defined(__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
++#elif defined(__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
+   /* Find suitable device */
+   for (devnum = 0; devnum < 255; devnum++) { /* TODO 255 */ 
diff --git a/net/chrony/Makefile b/net/chrony/Makefile
new file mode 100644 (file)
index 0000000..55f81ca
--- /dev/null
@@ -0,0 +1,72 @@
+#
+# Copyright (C) 2006-2012 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:=chrony
+PKG_VERSION:=1.26
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= ftp://download.tuxfamily.org/projects/chrony/ \
+       http://download.tuxfamily.org/chrony/
+PKG_MD5SUM:=ad6dd619ff1986e4ff780363c64e2246
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/chrony
+  SUBMENU:=Time Synchronization
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libreadline +libncurses @!TARGET_avr32 @!powerpc
+  TITLE:=NTP client/server for on-demand connections
+  URL:=http://chrony.sunsite.dk/
+endef
+
+define Package/chrony/description
+       A NTP implementation that has been specifically written to work
+       well in the case of an intermittent (e.g. dial-on-demand)
+       connection to the network where your NTP servers are.
+endef
+
+define Package/chrony/conffiles
+/etc/chrony/chrony.conf
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+                       --target=$(GNU_TARGET_NAME) \
+                       --prefix=/usr \
+                       --with-readline-includes=$(STAGING_DIR)/usr/include \
+                       --with-readline-library=$(STAGING_DIR)/usr/lib \
+                       --disable-linuxcaps \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               prefix="$(PKG_INSTALL_DIR)/usr"
+endef
+
+define Package/chrony/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyd $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyc $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DIR) $(1)/etc/chrony
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
+       $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
+       $(INSTALL_CONF) ./files/ntpd.config $(1)/etc/config/ntpd
+       $(INSTALL_CONF) ./files/chrony.conf $(1)/etc/chrony/chrony.conf
+       $(INSTALL_CONF) ./files/chrony.keys $(1)/etc/chrony/chrony.keys
+endef
+
+$(eval $(call BuildPackage,chrony))
diff --git a/net/chrony/files/chrony.conf b/net/chrony/files/chrony.conf
new file mode 100644 (file)
index 0000000..508fdfb
--- /dev/null
@@ -0,0 +1,17 @@
+# Chrony configuration
+
+# Note: time servers and ntp client access is configured in /etc/config/ntpd 
+# and automatically set at startup
+
+# Log clock errors above 0.5 seconds
+logchange 0.5
+
+# Allow command access only from localhost
+cmdallow localhost
+cmddeny
+
+# Password config for chronyc
+# Note: Using a command key other than "1" will break 
+# /etc/init.d/ntpd and /etc/hotplug.d/iface/20-ntpd
+keyfile /etc/chrony/chrony.keys
+commandkey 1
diff --git a/net/chrony/files/chrony.keys b/net/chrony/files/chrony.keys
new file mode 100644 (file)
index 0000000..c2d429e
--- /dev/null
@@ -0,0 +1 @@
+1 chronyc
diff --git a/net/chrony/files/ntpd.config b/net/chrony/files/ntpd.config
new file mode 100644 (file)
index 0000000..7a3b6fd
--- /dev/null
@@ -0,0 +1,6 @@
+# Generic NTP configuration
+# Time servers and network(s) that may access the time service
+
+config ntpd
+       option TimeServers      "0.openwrt.pool.ntp.org 1.openwrt.pool.ntp.org 2.openwrt.pool.ntp.org 3.openwrt.pool.ntp.org"
+       option ClientAccessFrom "lan"
diff --git a/net/chrony/files/ntpd.hotplug b/net/chrony/files/ntpd.hotplug
new file mode 100644 (file)
index 0000000..e2e5adf
--- /dev/null
@@ -0,0 +1,21 @@
+COMMAND=/usr/bin/chronyc
+CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)
+
+chrony_control() {
+$COMMAND << EOF
+password $CHRONY_KEY
+$1
+EOF
+}
+
+[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
+       [ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{
+               chrony_control online
+       }
+}
+
+[ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && {
+       [ -x $COMMAND ] && [ -n "$CHRONY_KEY" ] &&{
+               chrony_control offline
+       }
+}
diff --git a/net/chrony/files/ntpd.init b/net/chrony/files/ntpd.init
new file mode 100644 (file)
index 0000000..6e742fa
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=60
+
+start() {
+       [ ! -f /var/run/chronyd.pid ] && (
+               /usr/sbin/chronyd -f /etc/chrony/chrony.conf
+
+               local NTP_SERVERS
+               local NTP_SERVER
+               local CLIENT_NETWORKS
+               local NETNAME
+               config_load ntpd
+               config_get NTP_SERVERS $CONFIG_SECTION TimeServers
+               config_get CLIENT_NETWORKS $CONFIG_SECTION ClientAccessFrom
+               CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)
+
+               . /lib/functions/network.sh
+
+               # Define servers and do a rapid series of time measurements
+               # to get up to date
+               (
+                       echo password $CHRONY_KEY
+                       for NTP_SERVER in $NTP_SERVERS; do
+                               echo add server $NTP_SERVER
+                       done
+                       echo burst 5/5
+               ) | chronyc > /dev/null 2>&1
+               # ... wait until a reference ID is found ...
+               while chronyc tracking | grep 'Reference ID.*0.0.0.0' >/dev/null ; do sleep 1; done
+               # ... and finally, adjust the time in a single step
+               # and allow clients to access the server
+               (
+                       echo password $CHRONY_KEY
+                       echo makestep
+                       for NETNAME in $CLIENT_NETWORKS; do
+                               local subnet
+                               if network_get_subnet subnet "$NETNAME"; then
+                                       echo allow $subnet
+                               fi
+                       done
+               ) | chronyc > /dev/null 2>&1
+       )
+}
+
+stop() {
+       [ -r /var/run/chronyd.pid ] && PID=$(cat /var/run/chronyd.pid)
+       [ -n "$PID" ] && kill $PID
+}
+
+restart() {
+       stop
+       while [ -r /var/run/chronyd.pid ] ; do sleep 1; done
+       start
+}
diff --git a/net/chrony/patches/001-crosscompile.patch b/net/chrony/patches/001-crosscompile.patch
new file mode 100644 (file)
index 0000000..d712e06
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/configure
++++ b/configure
+@@ -254,6 +254,13 @@ do
+     --host-machine=* )
+       MACHINE=`echo $option | sed -e 's/^.*=//;'`
+     ;;
++    --target=* )
++      TARGET=`echo $option | sed -e 's/[^=]*=//;'`
++      OPERATINGSYSTEM=`echo $TARGET | sed -e 's/.*-//;'`
++      MACHINE=`echo $TARGET | sed -e 's/-.*//;'`
++      VERSION=""
++      SYSTEM=${OPERATINGSYSTEM}-${MACHINE}
++    ;;
+     --help | -h )
+       usage
+       exit 0
+@@ -287,7 +294,7 @@ case $SYSTEM in
+         ;;
+     esac
+     ;;
+-    Linux* )
++    Linux* | linux* )
+         EXTRA_OBJECTS="sys_linux.o wrap_adjtimex.o"
+         try_linuxcaps=1
+         try_rtc=1
diff --git a/net/chrony/patches/002-ipv6_disabled_fixes.patch b/net/chrony/patches/002-ipv6_disabled_fixes.patch
new file mode 100644 (file)
index 0000000..629d2c7
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/ntp_io.c
++++ b/ntp_io.c
+@@ -355,6 +355,7 @@ read_from_socket(void *anything)
+       }
+ #endif
++#ifdef HAVE_IPV6
+ #ifdef IPV6_PKTINFO
+       if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) {
+         struct in6_pktinfo ipi;
+@@ -365,6 +366,7 @@ read_from_socket(void *anything)
+         remote_addr.local_ip_addr.family = IPADDR_INET6;
+       }
+ #endif
++#endif
+ #ifdef SO_TIMESTAMP
+       if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SO_TIMESTAMP) {
+@@ -466,6 +468,7 @@ send_packet(void *packet, int packetlen,
+   }
+ #endif
++#ifdef HAVE_IPV6
+ #ifdef IPV6_PKTINFO
+   if (remote_addr->local_ip_addr.family == IPADDR_INET6) {
+     struct cmsghdr *cmsg;
+@@ -484,6 +487,7 @@ send_packet(void *packet, int packetlen,
+         sizeof(ipi->ipi6_addr.s6_addr));
+   }
+ #endif
++#endif
+ #if 0
+     LOG(LOGS_INFO, LOGF_NtpIO, "sending to %s:%d from %s",
diff --git a/net/cifs-utils/Makefile b/net/cifs-utils/Makefile
new file mode 100644 (file)
index 0000000..743e12b
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2007-2012 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:=cifs-utils
+PKG_VERSION:=5.4
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://ftp.samba.org/pub/linux-cifs/cifs-utils
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=dde98336c833b59777114145cb8f3c64
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cifsmount
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=CIFS mount utilities
+  URL:=http://wiki.samba.org/index.php/LinuxCIFS_utils
+endef
+
+TARGET_CFLAGS += -Wno-error
+
+CONFIGURE_ARGS += \
+       --exec-prefix=/usr \
+       --prefix=/ \
+       --with-libcap-ng=no \
+       --with-libcap=no
+
+define Package/cifsmount/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mount.cifs $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,cifsmount))
diff --git a/net/click/Makefile b/net/click/Makefile
new file mode 100644 (file)
index 0000000..ef48d79
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2010 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:=click
+PKG_VERSION:=20101020
+PKG_RELEASE:=1
+PKG_REV:=8f521a2dcd58ea8205b3b6070be605a21fb9154b
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://read.cs.ucla.edu/git/click
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_MD5SUM:=c3cba1c923d0a034cc518720b5ba7b40
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/click
+       SECTION:=net
+       CATEGORY:=Network
+       DEPENDS:=@BROKEN
+       TITLE:=Click Modular Router
+       URL:=http://read.cs.ucla.edu/click
+endef
+
+define Package/click/Description
+       The Click Modular Router userspace package
+endef
+
+TARGET_CFLAGS += "-static -O2 -MD"
+TARGET_CXXFLAGS += "-static -O2 -MD"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               rm -rf config.{cache,status} ; \
+               ./configure \
+                       --prefix=/usr \
+                       --target=$(GNU_TARGET_NAME) \
+                       --host=$(GNU_HOST_NAME) \
+                       --build=$(GNU_BUILD_NAME) \
+                       --enable-tools=mixed \
+                       --enable-userlevel \
+                       --enable-wifi \
+                       --enable-fixincludes \
+                       --disable-linuxmodule \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               tools elementmap.xml
+       (cd $(PKG_BUILD_DIR)/userlevel; \
+               ../tools/click-mkmindriver/click-mkmindriver -p $(PKG_NAME) -C .. \
+               -f $(PKG_BUILD_DIR)/conf/wifi/dump.click \
+               -A --all -E Discard -E Print; \
+       )
+       $(MAKE) -C $(PKG_BUILD_DIR) MINDRIVER=$(PKG_NAME)
+endef
+
+define Package/click/install
+       $(INSTALL_DIR) $(1)/usr
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/share/click
+       $(CP) $(PKG_BUILD_DIR)/userlevel/$(PKG_NAME)click $(1)/usr/bin/click
+       $(CP) $(PKG_BUILD_DIR)/tools/click-align/click-align $(1)/usr/bin/click-align
+       $(CP) $(PKG_BUILD_DIR)/elementmap.xml $(1)/usr/share/click/elementmap.xml
+endef
+
+$(eval $(call BuildPackage,click))
diff --git a/net/click/files/roofnet.init b/net/click/files/roofnet.init
new file mode 100644 (file)
index 0000000..bc36394
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+start() {
+       killall -q click
+       cp /usr/bin/srcr.click /tmp
+       sh /usr/bin/gen_config_roofnet.sh > /tmp/unaligned.click
+       click-align /tmp/unaligned.click > /tmp/roofnet.click
+       /usr/bin/click /tmp/roofnet.click > /tmp/roofnet.log 2>&1 &
+}
+
+stop() {
+       killall click
+}
diff --git a/net/click/patches/100-compile_fix.patch b/net/click/patches/100-compile_fix.patch
new file mode 100644 (file)
index 0000000..f798254
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/tools/click-mkmindriver/Makefile.in
++++ b/tools/click-mkmindriver/Makefile.in
+@@ -60,7 +60,7 @@ DEPCFLAGS = @DEPCFLAGS@
+ DEFS = @DEFS@
+ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+       -I$(top_srcdir)/tools/lib -I$(srcdir)
+-LDFLAGS = @LDFLAGS@
++LDFLAGS = @LDFLAGS@ -lrt
+ LIBS = @LIBS@ @POSIX_CLOCK_LIBS@ $(DL_LIBS)
+ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) $(DEPCFLAGS)
+--- a/configure
++++ b/configure
+@@ -7135,7 +7135,7 @@ fi
+ $as_echo "$ac_cv_va_list_addr" >&6; }
+     if test "x$ac_cv_va_list_addr" = xyes; then
+-$as_echo "#define HAVE_ADDRESSABLE_VA_LIST 1" >>confdefs.h
++$as_echo "#define HAVE_ADDRESSABLE_VA_LIST 0" >>confdefs.h
+     fi
diff --git a/net/click/patches/110-multithread_fix.patch b/net/click/patches/110-multithread_fix.patch
new file mode 100644 (file)
index 0000000..b875758
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/lib/master.cc
++++ b/lib/master.cc
+@@ -409,7 +409,9 @@ Master::process_pending(RouterThread *th
+     while (Task *t = Task::pending_to_task(my_pending)) {
+       my_pending = t->_pending_nextptr;
+       t->_pending_nextptr = 0;
++# if HAVE_MULTITHREAD
+       click_master_mb();
++# endif
+       t->process_pending(thread);
+     }
+ }
diff --git a/net/cmdftp/Makefile b/net/cmdftp/Makefile
new file mode 100644 (file)
index 0000000..8e99238
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006 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:=cmdftp
+PKG_VERSION:=0.9.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.savannah.nongnu.org/releases/$(PKG_NAME)
+PKG_MD5SUM:=9bd0741bbb1f218be95c089dc06b2777
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cmdftp
+  SUBMENU:=File Transfer
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=cmdftp is a tiny command line FTP client for Unix systems
+  URL:=http://www.nongnu.org/cmdftp/
+endef
+
+define Package/cmdftp/description
+       Features include passive mode for all data transfers, shell
+       like transparent syntax for local and remote modes, multiple
+       and recursive file transfers using wildcards, recursive copy and
+       move commands, remote and local text file viewing and editing,
+       network errors detection and resuming of currently executing
+       command, partial download resuming (if server accepts REST
+       command), tab completion for both local and remote names,
+       autologin using classic ~/.netrc approach, large file support.
+
+       cmdftp is aimed at being small and simple.
+endef
+
+define Package/cmdftp/install  
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,cmdftp))
diff --git a/net/coova-chilli/Config.in b/net/coova-chilli/Config.in
new file mode 100644 (file)
index 0000000..79171f3
--- /dev/null
@@ -0,0 +1,48 @@
+# CoovaChilli avanced configuration
+
+menu "Configuration"
+       depends on PACKAGE_coova-chilli
+
+config COOVACHILLI_REDIR
+       bool "Enable support for redir server. Required for uamregex"
+       default n
+
+config COOVACHILLI_MINIPORTAL
+       bool "Enable support Coova miniportal"
+       default n
+
+config COOVACHILLI_USERAGENT
+       bool "Enable recording user-agent"
+       default n
+
+config COOVACHILLI_DNSLOG
+       bool "Enable support to log DNS name queries"
+       default n
+
+config COOVACHILLI_UAMDOMAINFILE
+       bool "Enable loading of mass uamdomains from file"
+       default n
+
+config COOVACHILLI_LARGELIMITS
+       bool "Enable larger limits for use with non-embedded systems"
+       default n
+
+choice
+       prompt "SSL library"
+       default COOVACHILLI_NOSSL
+
+config COOVACHILLI_NOSSL
+       bool "No SSL support"
+
+config COOVACHILLI_MATRIXSSL
+       bool "MatrixSSL"
+
+config COOVACHILLI_CYASSL
+       bool "CyaSSL"
+
+config COOVACHILLI_OPENSSL
+       bool "OpenSSL"
+
+endchoice
+
+endmenu
diff --git a/net/coova-chilli/Makefile b/net/coova-chilli/Makefile
new file mode 100644 (file)
index 0000000..fc9c8fa
--- /dev/null
@@ -0,0 +1,90 @@
+#
+# Copyright (C) 2007-2014 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:=coova-chilli
+PKG_VERSION:=1.3.0
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ap.coova.org/chilli
+PKG_MD5SUM:=dc0037e3cdebcb60508081b4e42e984a
+
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS := \
+  COOVACHILLI_MINIPORTAL \
+  COOVACHILLI_REDIR \
+  COOVACHILLI_USERAGENT \
+  COOVACHILLI_DNSLOG \
+  COOVACHILLI_UAMDOMAINFILE \
+  COOVACHILLI_LARGELIMITS \
+  COOVACHILLI_NOSSL \
+  COOVACHILLI_MATRIXSSL \
+  COOVACHILLI_CYASSL \
+  COOVACHILLI_OPENSSL
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/coova-chilli
+  SUBMENU:=Captive Portals
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-tun +librt +COOVACHILLI_MATRIXSSL:libmatrixssl +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl
+  TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
+  URL:=http://www.coova.org/CoovaChilli
+  MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
+  MENU:=1
+endef
+
+define Package/coova-chilli/description
+       CoovaChilli is an open source access controller for wireless LAN
+       access points and is based on ChilliSpot. It is used for authenticating
+       users of a wireless (or wired) LAN. It supports web based login (UAM)
+       which is today's standard for public HotSpots and it supports Wireless
+       Protected Access (WPA) which is the standard of the future.
+       Authentication, authorization and accounting (AAA) is handled by your
+       favorite radius server.
+endef
+
+define Package/coova-chilli/config
+  source "$(SOURCE)/Config.in"
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+       $(if $(CONFIG_COOVACHILLI_REDIR),--enable,--disable)-chilliredir \
+       $(if $(CONFIG_COOVACHILLI_DNSLOG),--enable,--disable)-dnslog \
+       $(if $(CONFIG_COOVACHILLI_MINIPORTAL),--enable,--disable)-miniportal \
+       $(if $(CONFIG_COOVACHILLI_USERAGENT),--enable,--disable)-useragent \
+       $(if $(CONFIG_COOVACHILLI_LARGELIMITS),--enable,--disable)-largelimits \
+       $(if $(CONFIG_COOVACHILLI_UAMDOMAINFILE),--enable,--disable)-uamdomainfile \
+       $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \
+       $(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyaxssl \
+       $(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \
+       )
+endef
+
+define Package/coova-chilli/conffiles
+/etc/chilli.conf
+endef
+
+define Package/coova-chilli/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/chilli
+       $(CP) $(PKG_INSTALL_DIR)/etc/chilli/* $(1)/etc/chilli/
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/chilli.hotplug $(1)/etc/hotplug.d/iface/30-chilli
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,coova-chilli))
diff --git a/net/coova-chilli/files/chilli.hotplug b/net/coova-chilli/files/chilli.hotplug
new file mode 100644 (file)
index 0000000..e12812b
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+[ "$ACTION" == "ifup" ] || exit 0
+
+[ "$INTERFACE" = "wan" ] && {
+       /etc/init.d/chilli restart
+}
diff --git a/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
new file mode 100644 (file)
index 0000000..446eb63
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/src/system.h
++++ b/src/system.h
+@@ -76,10 +76,6 @@
+ #include <sys/stat.h>
+ #endif
+-#ifdef HAVE_SYS_SYSINFO_H
+-#include <sys/sysinfo.h>
+-#endif
+-
+ #ifdef HAVE_TIME_H
+ #include <time.h>
+ #endif
+@@ -132,6 +128,10 @@
+ #include <linux/un.h>
+ #endif
++#ifdef HAVE_SYS_SYSINFO_H
++#include <sys/sysinfo.h>
++#endif
++
+ #elif defined (__FreeBSD__)  || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) 
+ #include <net/if.h>
+ #include <net/bpf.h>
diff --git a/net/corkscrew/Makefile b/net/corkscrew/Makefile
new file mode 100644 (file)
index 0000000..3125fbf
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2010 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:=corkscrew
+PKG_VERSION:=2.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.agroman.net/corkscrew/
+PKG_MD5SUM:=35df77e7f0e59c0ec4f80313be52c10a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/corkscrew
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=SSH
+  TITLE:=Tunneling SSH through HTTP proxies.
+  URL:=http://www.agroman.net/corkscrew/
+endef
+
+define Build/Configure
+  $(call Build/Configure/Default,)
+endef
+
+define Package/corkscrew/install
+        $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/corkscrew $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,corkscrew))
diff --git a/net/crda/Makefile b/net/crda/Makefile
new file mode 100644 (file)
index 0000000..0d075f1
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2009-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=crda
+PKG_RELEASE:=1
+PKG_VERSION:=1.1.2
+PKG_SOURCE_URL:=http://wireless.kernel.org/download/crda
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=5226f65aebacf94baaf820f8b4e06df4
+
+PKG_REGULATORY_NAME:=regulatory
+PKG_REGULATORY_VERSION:=2011.04.28
+PKG_REGULATORY_SOURCE_URL:=http://wireless.kernel.org/download/wireless-regdb/regulatory.bins
+PKG_REGULATORY_SOURCE:=$(PKG_REGULATORY_VERSION)-$(PKG_REGULATORY_NAME).bin
+PKG_REGULATORY_MD5SUM:=1535e98bcaba732e2f8e8f62dac6f369
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/crda
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Central Regulatory Domain Agent (CRDA)
+  DEPENDS:=+libnl-tiny
+  URL:=http://wireless.kernel.org/en/developers/Regulatory/CRDA
+endef
+
+define Download/wireless-regdb
+  FILE:=$(PKG_REGULATORY_SOURCE)
+  URL:=$(PKG_REGULATORY_SOURCE_URL)
+  VERSION:=$(PKG_REGULATORY_VERSION)
+  MD5SUM:=$(PKG_REGULATORY_MD5SUM)
+endef
+$(eval $(call Download,wireless-regdb))
+
+define Package/crda/description
+ This is the Central Regulatory Domain Agent for Linux. It serves one
+ purpose: tell Linux kernel what to enforce. In essence it is a udev
+ helper for communication between the kernel and userspace. You only
+ need to run this manually for debugging purposes. For manual changing
+ of regulatory domains use iw (iw reg set) or wpa_supplicant (feature
+ yet to be added).
+endef
+
+TARGET_CPPFLAGS := \
+       -I$(STAGING_DIR)/usr/include/libnl-tiny \
+       -D_GNU_SOURCE \
+       $(TARGET_CPPFLAGS)
+
+MAKE_FLAGS += \
+       NL1FOUND="" NL2FOUND=Y \
+       NLLIBNAME="libnl-tiny" \
+       NLLIBS="-lnl-tiny -lm" \
+       REG_BIN="$(DL_DIR)/$(PKG_REGULATORY_SOURCE)" \
+       crda
+
+define Package/crda/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_DIR) $(1)/etc/hotplug.d
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/platform
+       $(INSTALL_DIR) $(1)/usr/lib/crda
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/crda $(1)/sbin/
+       $(INSTALL_DATA) ./files/hotplug.rule $(1)/etc/hotplug.d/platform/10-regulatory
+       $(INSTALL_DATA) $(DL_DIR)/$(PKG_REGULATORY_SOURCE) $(1)/usr/lib/crda/regulatory.bin
+endef
+
+$(eval $(call BuildPackage,crda))
+
diff --git a/net/crda/files/hotplug.rule b/net/crda/files/hotplug.rule
new file mode 100644 (file)
index 0000000..1ec033f
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Copyright (C) 2009 OpenWrt.org
+
+[ change = "$ACTION" -a regulatory.0 = "$DEVICENAME" ] && {
+       /sbin/crda
+}
diff --git a/net/crda/patches/101-make_crypto_use_optional.patch b/net/crda/patches/101-make_crypto_use_optional.patch
new file mode 100644 (file)
index 0000000..c7ace42
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -35,7 +35,9 @@ LDLIBS += `pkg-config --libs openssl`
+ reglib.o: keys-ssl.c
+-else
++endif
++
++ifeq ($(USE_GCRYPT),1)
+ CFLAGS += -DUSE_GCRYPT
+ LDLIBS += -lgcrypt
diff --git a/net/crowdcontrol/Makefile b/net/crowdcontrol/Makefile
new file mode 100644 (file)
index 0000000..036b901
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# 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:=crowdcontrol
+PKG_VERSION:=0.4b
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
+PKG_MD5SUM:=a0991ae3d1f1a361558bed1a4aa66a9c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/crowdcontrol
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=The extra-light http proxy server
+  URL:=http://sourceforge.net/projects/crowdcontrol/
+endef
+
+define Package/crowdcontrol/description
+       Crowd Control is an small, cross-platform HTTP proxy (a fork of the elhttp project)
+       designed for systems with little RAM, such as a home router. It can filter URLs using
+       SquidGuard blocklists, and has the unique ability to filter HTTPS domains as well.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/crowdcontrol $(PKG_BUILD_DIR)/crowdcontrol.c
+endef
+
+define Package/crowdcontrol/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/crowdcontrol
+       $(CP) $(PKG_BUILD_DIR)/crowdcontrol $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/*-{domains,expressions,urls} $(1)/etc/crowdcontrol/
+endef
+
+define Package/crowdcontrol/conffiles
+/etc/crowdcontrol/blocked-domains
+/etc/crowdcontrol/blocked-expressions
+/etc/crowdcontrol/blocked-urls
+/etc/crowdcontrol/permitted-domains
+/etc/crowdcontrol/permitted-expressions
+/etc/crowdcontrol/permitted-urls
+endef
+
+$(eval $(call BuildPackage,crowdcontrol))
diff --git a/net/cups-bjnp/Makefile b/net/cups-bjnp/Makefile
new file mode 100644 (file)
index 0000000..4821a18
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2010 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:=cups-bjnp
+PKG_VERSION:=1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/cups-bjnp
+PKG_MD5SUM:=8672b4585b71dee6dcefa00fbbbe7698
+
+PKG_BUILD_DEPENDS:=cups
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cups-bjnp
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Printing
+  TITLE:=BJNP protocol backend for CUPS
+  URL:=http://sourceforge.net/projects/cups-bjnp/
+  DEPENDS:=cups
+endef
+
+define Package/cups-bjnp/description
+CUPS backend for the canon printers using the proprietary USB over
+IP BJNP protocol. This backend allows Cups to print over the network
+to a Canon printer. It currently supports Cups 1.2 and Cups 1.3 and
+is designed by reverse engineering.
+endef
+
+CONFIGURE_ARGS += --with-cupsbackenddir=$(STAGING_DIR)/usr/include/cups
+
+TARGET_CFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/cups-bjnp/install
+       $(INSTALL_DIR) $(1)/usr/lib/cups/backend
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bjnp $(1)/usr/lib/cups/backend
+endef
+
+
+$(eval $(call BuildPackage,cups-bjnp))
diff --git a/net/cups/Makefile b/net/cups/Makefile
new file mode 100644 (file)
index 0000000..a8d6425
--- /dev/null
@@ -0,0 +1,700 @@
+#
+# Copyright (C) 2006-2012 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:=cups
+PKG_VERSION:=1.5.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source.tar.bz2
+PKG_SOURCE_URL:= http://www.cups.org/software/$(PKG_VERSION)
+PKG_MD5SUM:=de3006e5cf1ee78a9c6145ce62c4e982
+
+TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cups/Default
+  URL:=http://www.cups.org/
+  SUBMENU:=Printing
+endef
+
+define Package/cups
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcups +libcupsmime +libcupscgi +libcupsppdc +libusb-1.0
+  TITLE:=Common UNIX Printing System (daemon)
+endef
+
+define Package/cups/description
+       Common UNIX Printing System (daemon)
+endef
+
+define Package/cups/conffiles
+/etc/cups/classes.conf
+/etc/cups/cupsd.conf
+/etc/cups/printers.conf
+endef
+
+define Package/cups-bsd
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcups
+  TITLE:=Common UNIX Printing System - BSD commands (old)
+endef
+
+define Package/cups-bsd/description
+       Common UNIX Printing System - BSD commands (old)
+endef
+
+define Package/cups-client
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcups +libcupsimage +libcupsmime
+  TITLE:=Common UNIX Printing System - Client commands
+endef
+
+define Package/cups-client/conffiles
+/etc/cups/client.conf
+endef
+
+define Package/cups-client/description
+       Common UNIX Printing System - Client commands
+endef
+
+define Package/cups-filters
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcupsimage +libcupsdriver
+  TITLE:=Common UNIX Printing System - Filter
+endef
+
+define Package/cups-filters/description
+       Common UNIX Printing System - Filter
+endef
+
+define Package/cups-ppdc
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcupsppdc
+  TITLE:=Common UNIX Printing System - PPDC utils
+endef
+
+define Package/cups-ppdc/description
+       Common UNIX Printing System - PPDC utils
+endef
+
+define Package/libcups
+$(call Package/cups/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+zlib +libpthread +libpng +libjpeg
+  TITLE:=Common UNIX Printing System - Core library
+endef
+
+define Package/libcups/description
+       Common UNIX Printing System - Core library
+endef
+
+define Package/libcupscgi
+$(call Package/cups/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libcups
+  TITLE:=Common UNIX Printing System - CGI library
+endef
+
+define Package/libcupscgi/description
+       Common UNIX Printing System - CGI library
+endef
+
+define Package/libcupsdriver
+$(call Package/cups/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libcups
+  TITLE:=Common UNIX Printing System - Driver library
+endef
+
+define Package/libcupsdriver/description
+       Common UNIX Printing System - Driver library
+endef
+
+define Package/libcupsimage
+$(call Package/cups/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libcups +libpng +libjpeg
+  TITLE:=Common UNIX Printing System - Image library
+endef
+
+define Package/libcupsimage/description
+       Common UNIX Printing System - Image library
+endef
+
+define Package/libcupsmime
+$(call Package/cups/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libcups
+  TITLE:=Common UNIX Printing System - MIME library
+endef
+
+define Package/libcupsmime/description
+       Common UNIX Printing System - MIME library
+endef
+
+define Package/libcupsppdc
+$(call Package/cups/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libcups +libstdcpp
+  TITLE:=Common UNIX Printing System - PPDC library
+endef
+
+define Package/libcupsppdc/description
+       Common UNIX Printing System - PPDC library
+endef
+
+define Package/cups-locale-de
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale de
+endef
+
+define Package/cups-locale-de/description
+       Common UNIX Printing System - Locale de
+endef
+
+define Package/cups-locale-nl
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale nl
+endef
+
+define Package/cups-locale-nl/description
+       Common UNIX Printing System - Locale nl
+endef
+
+define Package/cups-locale-hu
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale hu
+endef
+
+define Package/cups-locale-hu/description
+       Common UNIX Printing System - Locale hu
+endef
+
+define Package/cups-locale-pt
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale pt
+endef
+
+define Package/cups-locale-pt/description
+       Common UNIX Printing System - Locale pt
+endef
+
+define Package/cups-locale-pt_BR
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale pt_BR
+endef
+
+define Package/cups-locale-pt_BR/description
+       Common UNIX Printing System - Locale pt_BR
+endef
+
+define Package/cups-locale-fi
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale fi
+endef
+
+define Package/cups-locale-fi/description
+       Common UNIX Printing System - Locale fi
+endef
+
+define Package/cups-locale-sv
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale sv
+endef
+
+define Package/cups-locale-sv/description
+       Common UNIX Printing System - Locale sv
+endef
+
+define Package/cups-locale-da
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale da
+endef
+
+define Package/cups-locale-da/description
+       Common UNIX Printing System - Locale da
+endef
+
+define Package/cups-locale-ko
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale ko
+endef
+
+define Package/cups-locale-ko/description
+       Common UNIX Printing System - Locale ko
+endef
+
+define Package/cups-locale-zh
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale zh
+endef
+
+define Package/cups-locale-zh/description
+       Common UNIX Printing System - Locale zh
+endef
+
+define Package/cups-locale-ja
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale ja
+endef
+
+define Package/cups-locale-ja/description
+       Common UNIX Printing System - Locale ja
+endef
+
+define Package/cups-locale-es
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale es
+endef
+
+define Package/cups-locale-es/description
+       Common UNIX Printing System - Locale es
+endef
+
+define Package/cups-locale-zh_TW
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale zh_TW
+endef
+
+define Package/cups-locale-zh_TW/description
+       Common UNIX Printing System - Locale zh_TW
+endef
+
+define Package/cups-locale-pl
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale pl
+endef
+
+define Package/cups-locale-pl/description
+       Common UNIX Printing System - Locale pl
+endef
+
+define Package/cups-locale-no
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale no
+endef
+
+define Package/cups-locale-no/description
+       Common UNIX Printing System - Locale no
+endef
+
+define Package/cups-locale-ru
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale ru
+endef
+
+define Package/cups-locale-ru/description
+       Common UNIX Printing System - Locale ru
+endef
+
+define Package/cups-locale-eu
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale eu
+endef
+
+define Package/cups-locale-eu/description
+       Common UNIX Printing System - Locale eu
+endef
+
+define Package/cups-locale-fr
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale fr
+endef
+
+define Package/cups-locale-fr/description
+       Common UNIX Printing System - Locale fr
+endef
+
+define Package/cups-locale-it
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale it
+endef
+
+define Package/cups-locale-it/description
+       Common UNIX Printing System - Locale it
+endef
+
+define Package/cups-locale-id
+$(call Package/cups/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Common UNIX Printing System - Locale id
+endef
+
+define Package/cups-locale-id/description
+       Common UNIX Printing System - Locale id
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-cups-user="nobody" \
+               --with-cups-group="nogroup" \
+               --with-components="embedded" \
+               --with-pdftops="none" \
+               --without-perl \
+               --without-python \
+               --without-php \
+               --enable-shared \
+               --enable-image \
+               --enable-libusb \
+               --disable-dbus \
+               --disable-dnssd \
+               --disable-launchd \
+               --disable-ldap \
+               --disable-pam \
+               --disable-slp \
+               --disable-gnutls \
+               --disable-openssl \
+               --disable-cdsassl \
+               --disable-ssl \
+               --disable-gssapi \
+               --disable-tiff, \
+               UNAME="Linux" \
+               LIBS="$(TARGET_LDFLAGS) -lz -lpng -ljpeg" \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               DSTROOT="$(PKG_INSTALL_DIR)" \
+               STRIP="/bin/true" \
+               all install
+endef
+
+define Package/cups/install
+       rm -rf $(1)/etc/cups
+       $(INSTALL_DIR) $(1)/etc/cups
+       $(CP) $(PKG_INSTALL_DIR)/etc/cups/* $(1)/etc/cups/
+       rm -rf $(1)/etc/cups/certs
+       ln -sf /tmp $(1)/etc/cups/certs
+       rm -f $(1)/usr/bin/cups-config
+       $(INSTALL_DIR) $(1)/usr/lib/cups
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/backend $(1)/usr/lib/cups
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/cgi-bin $(1)/usr/lib/cups
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/daemon $(1)/usr/lib/cups
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/driver $(1)/usr/lib/cups
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/monitor $(1)/usr/lib/cups
+       $(INSTALL_DIR) $(1)/usr/lib/cups/filter
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/filter/{commandtops,pstops} \
+               $(PKG_INSTALL_DIR)/usr/lib/cups/filter/gziptoany \
+               $(1)/usr/lib/cups/filter
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/*.tmpl \
+               $(1)/usr/share/cups/templates/
+       $(INSTALL_DIR) $(1)/usr/share/cups/mime
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/mime/* $(1)/usr/share/cups/mime/
+       $(INSTALL_DIR) $(1)/usr/share/doc/cups
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/cups/index.html \
+               $(1)/usr/share/doc/cups/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/cups/*.css \
+               $(1)/usr/share/doc/cups/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/cups/images \
+               $(1)/usr/share/doc/cups/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       # overwrite default config with our own
+       $(CP) ./files/etc/cups/* $(1)/etc/cups/
+       # install initscript with priority 60
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/cupsd.init $(1)/etc/init.d/cupsd
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/{cupsctl,cupsd} \
+               $(1)/usr/sbin/
+endef
+
+define Package/cups-bsd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{lprm,lpq,lpr} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lpc $(1)/usr/sbin/
+endef
+
+define Package/cups-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/{lp,cancel,cupstestppd,cupstestdsc} \
+               $(PKG_INSTALL_DIR)/usr/bin/{ipptool,lpoptions,lpstat,lppasswd} \
+               $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/{cupsaccept,cupsaddsmb,cupsfilter} \
+               $(PKG_INSTALL_DIR)/usr/sbin/{lpadmin,lpinfo,lpmove} \
+               $(1)/usr/sbin/
+       (cd $(1)/usr/sbin; ln -sf cupsaccept accept; ln -sf cupsaccept cupsenable; ln -sf cupsaccept cupsdisable; ln -sf cupsaccept reject; ln -sf cupsaccept cupsreject;)
+endef
+
+define Package/cups-filters/install
+       $(INSTALL_DIR) $(1)/usr/lib/cups/filter
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/filter/{bannertops,commandtoescpx,commandtopclx,imagetops,imagetoraster,rastertoepson,rastertopwg,rastertohp,rastertoescpx,rastertopclx,rastertolabel,texttops} \
+               $(1)/usr/lib/cups/filter
+       (cd $(1)/usr/lib/cups/filter; ln -sf rastertolabel rastertodymo;)
+endef
+
+define Package/cups-ppdc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/{ppdc,ppdhtml,ppdi,ppdmerge,ppdpo} \
+               $(1)/usr/bin/
+endef
+
+define Package/libcups/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcups.so* $(1)/usr/lib/
+endef
+
+define Package/libcupscgi/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcupscgi.so* $(1)/usr/lib/
+endef
+
+define Package/libcupsdriver/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcupsdriver.so* $(1)/usr/lib/
+endef
+
+define Package/libcupsimage/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcupsimage.so* $(1)/usr/lib/
+endef
+
+define Package/libcupsmime/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcupsmime.so* $(1)/usr/lib/
+endef
+
+define Package/libcupsppdc/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcupsppdc.so* $(1)/usr/lib/
+endef
+
+define Package/cups-locale-de/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/de $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/de \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-nl/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/nl $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-hu/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/hu $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/hu \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-pt/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/pt $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-pt_BR/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/pt_BR $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-fi/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/fi $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-sv/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/sv $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-da/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/da $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-ko/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/ko $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-zh/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/zh $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-ja/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/ja $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/ja \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-es/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/es $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/es \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-zh_TW/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/zh_TW $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-pl/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/pl $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/pl \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-no/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/no $(1)/usr/share/locale/
+endef
+
+define Package/cups-locale-ru/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/ru $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/ru \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-eu/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/eu $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/eu \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-fr/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/fr $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/fr \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-it/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/it $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/it \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Package/cups-locale-id/install
+       $(INSTALL_DIR) $(1)/usr/share/locale
+       $(INSTALL_DIR) $(1)/usr/share/cups/templates
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/locale/id $(1)/usr/share/locale/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/id \
+               $(1)/usr/share/cups/templates/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cups-config $(2)/bin/
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/cups $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcups*.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,cups))
+$(eval $(call BuildPackage,libcups))
+$(eval $(call BuildPackage,libcupscgi))
+$(eval $(call BuildPackage,libcupsdriver))
+$(eval $(call BuildPackage,libcupsimage))
+$(eval $(call BuildPackage,libcupsmime))
+$(eval $(call BuildPackage,libcupsppdc))
+$(eval $(call BuildPackage,cups-bsd))
+$(eval $(call BuildPackage,cups-client))
+$(eval $(call BuildPackage,cups-filters))
+$(eval $(call BuildPackage,cups-ppdc))
+$(eval $(call BuildPackage,cups-locale-de))
+$(eval $(call BuildPackage,cups-locale-nl))
+$(eval $(call BuildPackage,cups-locale-hu))
+$(eval $(call BuildPackage,cups-locale-pt))
+$(eval $(call BuildPackage,cups-locale-pt_BR))
+$(eval $(call BuildPackage,cups-locale-fi))
+$(eval $(call BuildPackage,cups-locale-sv))
+$(eval $(call BuildPackage,cups-locale-da))
+$(eval $(call BuildPackage,cups-locale-ko))
+$(eval $(call BuildPackage,cups-locale-zh))
+$(eval $(call BuildPackage,cups-locale-ja))
+$(eval $(call BuildPackage,cups-locale-es))
+$(eval $(call BuildPackage,cups-locale-zh_TW))
+$(eval $(call BuildPackage,cups-locale-pl))
+$(eval $(call BuildPackage,cups-locale-no))
+$(eval $(call BuildPackage,cups-locale-ru))
+$(eval $(call BuildPackage,cups-locale-eu))
+$(eval $(call BuildPackage,cups-locale-fr))
+$(eval $(call BuildPackage,cups-locale-it))
+$(eval $(call BuildPackage,cups-locale-id))
diff --git a/net/cups/files/cupsd.init b/net/cups/files/cupsd.init
new file mode 100644 (file)
index 0000000..e5f00da
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       mkdir -m 0755 -p /var/cache/cups
+       mkdir -m 0755 -p /var/cups
+       mkdir -m 0755 -p /var/spool/cups/tmp
+       service_start /usr/sbin/cupsd
+}
+
+stop() {
+       service_stop /usr/sbin/cupsd
+}
+
+reload() {
+       service_reload /usr/sbin/cupsd
+}
diff --git a/net/cups/files/etc/cups/classes.conf b/net/cups/files/etc/cups/classes.conf
new file mode 100644 (file)
index 0000000..15afda7
--- /dev/null
@@ -0,0 +1,7 @@
+########################################################################
+#                                                                      #
+# This is a sample class configuration file.  This file is included    #
+# from the main configuration file (cups.conf) and lists all of the    #
+# printer classes known to the system.                                 #
+#                                                                      #
+########################################################################
diff --git a/net/cups/files/etc/cups/client.conf b/net/cups/files/etc/cups/client.conf
new file mode 100644 (file)
index 0000000..c8d9f91
--- /dev/null
@@ -0,0 +1,9 @@
+########################################################################
+#                                                                      #
+# This is the CUPS client configuration file.  This file is used to    #
+# define client-specific parameters, such as the default server or     #
+# default encryption settings.                                         #
+#                                                                      #
+########################################################################
+
+Encryption Never
diff --git a/net/cups/files/etc/cups/cupsd.conf b/net/cups/files/etc/cups/cupsd.conf
new file mode 100644 (file)
index 0000000..79ad944
--- /dev/null
@@ -0,0 +1,47 @@
+########################################################################
+#                                                                      #
+# This is the CUPS configuration file.  If you are familiar with       #
+# Apache or any of the other popular web servers, we've followed the   #
+# same format.  Any configuration variable used here has the same      #
+# semantics as the corresponding variable in Apache.  If we need       #
+# different functionality then a different name is used to avoid       #
+# confusion...                                                         #
+#                                                                      #
+########################################################################
+
+
+AccessLog syslog
+ErrorLog syslog
+LogLevel info
+PageLog syslog
+PreserveJobHistory No
+PreserveJobFiles No
+AutoPurgeJobs Yes
+MaxJobs 25
+MaxPrinterHistory 10
+#Printcap /etc/printcap
+#PrintcapFormat BSD
+RequestRoot /var/cups
+#RemoteRoot remroot
+User nobody
+Group nogroup
+RIPCache 512k
+TempDir /var/cups
+Port 631
+HostNameLookups Off
+KeepAlive On
+Browsing On
+BrowseProtocols cups
+
+<Location />
+Order Deny,Allow
+Allow From 127.0.0.1
+Allow From 192.168.1.0/24
+</Location>
+
+<Location /admin>
+AuthType Basic
+AuthClass System
+Order Allow,Deny
+Allow From All
+</Location>
diff --git a/net/cups/files/etc/cups/printers.conf b/net/cups/files/etc/cups/printers.conf
new file mode 100644 (file)
index 0000000..88bba1b
--- /dev/null
@@ -0,0 +1,23 @@
+<DefaultPrinter USB>
+Info USB Printer
+Location
+DeviceURI usb:/dev/usb/lp0
+State Idle
+Accepting Yes
+JobSheets none none
+QuotaPeriod 0
+PageLimit 0
+KLimit 0
+</Printer>
+
+<Printer LP>
+Info Parallel Port Printer
+Location
+DeviceURI parallel:/dev/printers/0
+State Idle
+Accepting Yes
+JobSheets none none
+QuotaPeriod 0
+PageLimit 0
+KLimit 0
+</Printer>
diff --git a/net/cups/patches/100-components.patch b/net/cups/patches/100-components.patch
new file mode 100644 (file)
index 0000000..c4d6350
--- /dev/null
@@ -0,0 +1,42 @@
+--- cups-1.5.4/configure       2012-10-09 09:22:45.000000000 +0200
++++ cups-1.5.4/configure       2012-10-09 09:24:30.000000000 +0200
+@@ -1619,6 +1619,7 @@
+   --with-operkey          set the default operator @AUTHKEY value
+   --with-components       set components to build:
+                           - "all" (default) builds everything
++                          - "embedded" builds everything except man and notifier
+                           - "core" builds libcups and ipptool
+   --with-privateinclude   set path for private include files, default=none
+   --with-rcdir            set path for rc scripts
+@@ -5861,6 +5862,10 @@
+               BUILDDIRS="filter backend berkeley cgi-bin driver monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
+               ;;
+
++      embedded)
++              BUILDDIRS="filter backend berkeley cgi-bin driver monitor ppdc scheduler systemv conf data locale doc examples templates"
++              ;;
++
+       core)
+               BUILDDIRS="data locale"
+               ;;
+--- cups-1.5.4/config-scripts/cups-common.m4.orig      2012-10-09 09:17:08.000000000 +0200
++++ cups-1.5.4/config-scripts/cups-common.m4   2012-10-09 09:24:42.000000000 +0200
+@@ -414,6 +414,7 @@
+
+ AC_ARG_WITH(components, [  --with-components       set components to build:
+                           - "all" (default) builds everything
++                          - "embedded" builds everything except locale, man and notifier
+                           - "core" builds libcups and ipptool],
+       COMPONENTS="$withval")
+
+@@ -422,6 +423,10 @@
+               BUILDDIRS="filter backend berkeley cgi-bin driver monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
+               ;;
+
++      embedded)
++              BUILDDIRS="filter backend berkeley cgi-bin driver monitor ppdc scheduler systemv conf data locale doc examples templates"
++              ;;
++
+       core)
+               BUILDDIRS="data locale"
+               ;;
diff --git a/net/cups/patches/140-uname.patch b/net/cups/patches/140-uname.patch
new file mode 100644 (file)
index 0000000..3261de6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -1966,7 +1966,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-uname=`uname`
++uname=${UNAME:-`uname`}
+ uversion=`uname -r | sed -e '1,$s/^[^0-9]*\([0-9]*\)\.\([0-9]*\).*/\1\2/'`
+ uarch=`uname -m`
diff --git a/net/cups/patches/150-64bit_host_fix.patch b/net/cups/patches/150-64bit_host_fix.patch
new file mode 100644 (file)
index 0000000..5cfdba5
--- /dev/null
@@ -0,0 +1,64 @@
+--- a/cups-config.in
++++ b/cups-config.in
+@@ -54,7 +54,7 @@ else
+       CFLAGS="$CFLAGS -I$includedir"
+     fi
+-    if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib64; then
++    if test $libdir != /usr/lib -a $libdir != /usr/lib -a $libdir != /usr/lib; then
+       LDFLAGS="$LDFLAGS -L$libdir"
+     fi
+ fi
+--- a/config-scripts/cups-3264.m4
++++ b/config-scripts/cups-3264.m4
+@@ -108,7 +108,7 @@ case "$uname" in
+                       LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
+                       LIB64DIR="$exec_prefix/lib"
+                       if test -d /usr/lib64; then
+-                              LIB64DIR="${LIB64DIR}64"
++                              LIB64DIR="${LIB64DIR}"
+                       fi
+                       UNINSTALL64="uninstall64bit"
+               fi
+--- a/config-scripts/cups-directories.m4
++++ b/config-scripts/cups-directories.m4
+@@ -107,7 +107,7 @@ if test "$libdir" = "\${exec_prefix}/lib
+                       ;;
+               Linux*)
+                       if test -d /usr/lib64; then
+-                              libdir="$exec_prefix/lib64"
++                              libdir="$exec_prefix/lib"
+                       fi
+                       ;;
+               HP-UX*)
+--- a/configure
++++ b/configure
+@@ -10003,7 +10003,7 @@ if test "$libdir" = "\${exec_prefix}/lib
+                       ;;
+               Linux*)
+                       if test -d /usr/lib64; then
+-                              libdir="$exec_prefix/lib64"
++                              libdir="$exec_prefix/lib"
+                       fi
+                       ;;
+               HP-UX*)
+@@ -10626,9 +10626,6 @@ case "$uname" in
+                       LIB32CUPS="32bit/libcups.so.2"
+                       LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
+                       LIB32DIR="$exec_prefix/lib"
+-                      if test -d /usr/lib32; then
+-                              LIB32DIR="${LIB32DIR}32"
+-                      fi
+                       UNINSTALL32="uninstall32bit"
+               fi
+@@ -10638,9 +10635,6 @@ case "$uname" in
+                       LIB64CUPS="64bit/libcups.so.2"
+                       LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
+                       LIB64DIR="$exec_prefix/lib"
+-                      if test -d /usr/lib64; then
+-                              LIB64DIR="${LIB64DIR}64"
+-                      fi
+                       UNINSTALL64="uninstall64bit"
+               fi
+               ;;
diff --git a/net/cups/patches/160-ppdc.patch b/net/cups/patches/160-ppdc.patch
new file mode 100644 (file)
index 0000000..499ed28
--- /dev/null
@@ -0,0 +1,16 @@
+--- cups-1.5.4/ppdc/Makefile   2012-10-09 09:36:00.000000000 +0200
++++ cups-1.5.4/ppdc/Makefile   2012-10-09 09:36:34.000000000 +0200
+@@ -239,12 +239,7 @@
+ genstrings:           genstrings.o libcupsppdc.a ../cups/$(LIBCUPSSTATIC) \
+                       sample.drv ../data/media.defs
+-      echo Linking $@...
+-      $(CXX) $(ARCHFLAGS) $(LDFLAGS) -o genstrings genstrings.o \
+-              libcupsppdc.a ../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) \
+-              $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
+-      echo Generating localization strings...
+-      ./genstrings >sample.c
++      echo Not Linking $@...
+ #
diff --git a/net/cups/patches/200-str4181.patch b/net/cups/patches/200-str4181.patch
new file mode 100644 (file)
index 0000000..c8e73f7
--- /dev/null
@@ -0,0 +1,13 @@
+--- cups-1.5.4/backend/ipp.c   (revision 10596)
++++ cups-1.5.4/backend/ipp.c   (working copy)
+@@ -1578,6 +1578,10 @@
+         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
+                      "document-format", NULL, document_format);
+
++        if (compression)
++        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
++                     "compression", NULL, compression);
++
+       fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1);
+       http_status = cupsSendRequest(http, request, resource, 0);
+       if (http_status == HTTP_CONTINUE && request->state == IPP_DATA)
diff --git a/net/cups/patches/210-str4194.patch b/net/cups/patches/210-str4194.patch
new file mode 100644 (file)
index 0000000..6784213
--- /dev/null
@@ -0,0 +1,11 @@
+--- cups-1.5.4/backend/ipp.c   (revision 10619)
++++ cups-1.5.4/backend/ipp.c   (working copy)
+@@ -952,6 +952,8 @@
+       _cupsLangPrintFilter(stderr, "ERROR",
+                            _("Unable to get printer status."));
+         sleep(10);
++
++      httpReconnect(http);
+       }
+
+       ippDelete(supported);
diff --git a/net/curlftpfs/Makefile b/net/curlftpfs/Makefile
new file mode 100644 (file)
index 0000000..cdeaa6a
--- /dev/null
@@ -0,0 +1,50 @@
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=curlftpfs
+PKG_VERSION:=0.9.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/curlftpfs
+PKG_MD5SUM:=b452123f755114cd4461d56c648d9f12
+
+PKG_BUILD_DEPENDS:=libiconv
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/curlftpfs
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  DEPENDS:=+libcurl +libfuse +glib2
+  TITLE:=CurlFtpFS
+  URL:=http://curlftpfs.sourceforge.net/
+endef
+
+define Package/curlftpfs/description
+  CurlFtpFS is a filesystem for accessing FTP hosts
+  based on FUSE and libcurl.
+endef
+
+EXTRA_CFLAGS += \
+       -I$(ICONV_PREFIX)/include \
+       -I$(STAGING_DIR)/usr/include/fuse \
+       -DICONV_CONST=const
+
+EXTRA_LDFLAGS += \
+       -L$(INTL_PREFIX)/lib \
+       -L$(ICONV_PREFIX)/lib \
+       -lpthread
+
+define Package/curlftpfs/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/curlftpfs $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,curlftpfs))
+
diff --git a/net/curlftpfs/patches/001-uclibc_mod.patch b/net/curlftpfs/patches/001-uclibc_mod.patch
new file mode 100644 (file)
index 0000000..8eb1556
--- /dev/null
@@ -0,0 +1,37 @@
+diff -cr curlftpfs-0.9.2/ftpfs-ls.c curlftpfs-0.9.2-1/ftpfs-ls.c
+*** curlftpfs-0.9.2/ftpfs-ls.c 2008-04-23 12:55:41.000000000 +0200
+--- curlftpfs-0.9.2-1/ftpfs-ls.c       2009-09-24 23:19:03.000000000 +0200
+***************
+*** 58,64 ****
+                 "%5s"  "%*c"
+                 "%1023c",
+                 mode, &nlink, user, group, &size, month, day, year, file);
+!   if (res < 9) {
+      res = sscanf(line,
+                   "%11s"
+                   "%32s" SPACES
+--- 58,64 ----
+                 "%5s"  "%*c"
+                 "%1023c",
+                 mode, &nlink, user, group, &size, month, day, year, file);
+!   if (res < 8) {
+      res = sscanf(line,
+                   "%11s"
+                   "%32s" SPACES
+***************
+*** 69,75 ****
+                   "%5s"  "%*c"
+                   "%1023c",
+                   mode, user, group, &size, month, day, year, file);
+!     if (res < 8) {
+        return 0;
+      }
+    }
+--- 69,75 ----
+                   "%5s"  "%*c"
+                   "%1023c",
+                   mode, user, group, &size, month, day, year, file);
+!     if (res < 7) {
+        return 0;
+      }
+    }
diff --git a/net/cutter/Makefile b/net/cutter/Makefile
new file mode 100644 (file)
index 0000000..95b14d9
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006 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:=cutter
+PKG_VERSION:=1.03
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.lowth.com/cutter/software/
+PKG_MD5SUM:=50093db9b64277643969ee75b83ebbd1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cutter
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=allows an user to abort TCP/IP connections
+  URL:=http://www.lowth.com/cutter/
+endef
+
+define Package/cutter/description
+       Cutter is an open source program that allows Linux firewall
+       administrators to abort TCP/IP connections routed over the
+       firewall or router on which it is run.
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/cutter.c -o $(PKG_BUILD_DIR)/cutter
+endef
+
+define Package/cutter/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cutter $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,cutter))
diff --git a/net/cutter/patches/001-nf_conntrack.patch b/net/cutter/patches/001-nf_conntrack.patch
new file mode 100644 (file)
index 0000000..06febe7
--- /dev/null
@@ -0,0 +1,39 @@
+--- a/cutter.c.orig    2005-04-30 09:01:03.000000000 +0200
++++ b/cutter.c 2007-10-26 16:10:04.000000000 +0200
+@@ -476,7 +476,7 @@
+ int scan_conntrack(in_addr_t ip1, int port1, in_addr_t ip2, int port2)
+ {
+-      FILE *id = fopen( "/proc/net/ip_conntrack", "r" );
++      FILE *id = fopen( "/proc/net/nf_conntrack", "r" );
+       char src1[32], dst1[32], src2[32], dst2[32];
+       int sport1, dport1, sport2, dport2, i;
+       int packets1, packets2, bytes1, bytes2;
+@@ -486,12 +486,12 @@
+       int ok = TRUE;
+       if (id == NULL) {
+-              perror( "openning /proc/net/ip_conntrack" );
++              perror( "openning /proc/net/nf_conntrack" );
+               return FALSE;
+       }
+       while (fgets(buff, sizeof(buff), id) != NULL) {
+-              if (memcmp(buff, "tcp ", 4) != 0 || strstr(buff, " ESTABLISHED ") == NULL)
++              if (memcmp(buff, "ipv4     2 tcp ", 15) != 0 || strstr(buff, " ESTABLISHED ") == NULL)
+                       continue;
+               p = buff;
+@@ -537,6 +537,12 @@
+                               ok = send_rst(dst1,dport1,src1,sport1) && ok;
+                               ok = send_rst(dst2,dport2,src2,sport2) && ok;
+                       }
++                      else {
++                              found ++;
++                              printf("For connection %s:%d -> %s:%d\n", dst2, dport2, src2, sport2);
++                              ok = send_rst(dst1,dport1,src1,sport1) && ok;
++                              ok = send_rst(dst2,dport2,src2,sport2) && ok;
++                      }
+               }
+       }
diff --git a/net/daemonlogger/Makefile b/net/daemonlogger/Makefile
new file mode 100644 (file)
index 0000000..3d7a9bf
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2007-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:=daemonlogger
+PKG_VERSION:=1.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=463
+PKG_SOURCE_URL:=http://www.snort.org/downloads/
+PKG_CAT:=zcat
+PKG_MD5SUM:=acb64aa6cd5777e297569f100b5c39ee
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/daemonlogger
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libdnet
+  TITLE:=Software Network Tap
+  URL:=http://www.snort.org/snort-downloads/additional-downloads
+endef
+
+CONFIGURE_VARS += \
+       BUILD_CC="$(TARGET_CC)" \
+       HOSTCC="$(HOSTCC)"
+
+MAKE_FLAGS := CCOPT="$(TARGET_CFLAGS)" INCLS="-I. $(TARGET_CPPFLAGS)"
+
+define Package/daemonlogger/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daemonlogger $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,daemonlogger))
diff --git a/net/dansguardian/Makefile b/net/dansguardian/Makefile
new file mode 100644 (file)
index 0000000..bba2d8b
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2008-2009 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:=dansguardian
+PKG_VERSION:=2.10.1.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://dansguardian.org/downloads/2/Stable
+PKG_MD5SUM:=0987a1c9bfbdf398118386f10279611a
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dansguardian
+  SECTION:=net
+  DEPENDS:=+libpthread $(CXX_DEPENDS) +zlib
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=DansGuardian
+  URL:=http://dansguardian.org
+endef
+
+define Package/dansguardian/conffiles
+/etc/dansguardian/dansguardian.conf
+endef
+
+CONFIGURE_VARS += \
+       INCLUDES="" \
+       CXXFLAGS="$$$$CXXFLAGS -fno-rtti"  \
+       LIBS="-lpthread" \
+
+define Build/Configure
+       $(call Build/Configure/Default,\
+               --disable-clamav \
+               --with-sysconfsubdir=dansguardian \
+               --with-proxyuser=root \
+               --with-proxygroup=root \
+               --disable-pcre \
+       )
+endef
+
+define Package/dansguardian/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dansguardian $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/dansguardian $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/share/dansguardian
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/dansguardian/transparent1x1.gif $(1)/usr/share/dansguardian/
+       $(INSTALL_DIR) $(1)/usr/share/dansguardian/languages/ukenglish
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/dansguardian/languages/ukenglish/* $(1)/usr/share/dansguardian/languages/ukenglish/
+endef
+
+$(eval $(call BuildPackage,dansguardian))
diff --git a/net/dansguardian/patches/001-include_dir.patch b/net/dansguardian/patches/001-include_dir.patch
new file mode 100644 (file)
index 0000000..8a619f0
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/configure
++++ b/configure
+@@ -861,7 +861,7 @@ sysconfdir='${prefix}/etc'
+ sharedstatedir='${prefix}/com'
+ localstatedir='${prefix}/var'
+ includedir='${prefix}/include'
+-oldincludedir='/usr/include'
++oldincludedir='${prefix}/usr/include'
+ docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+ infodir='${datarootdir}/info'
+ htmldir='${docdir}'
+@@ -6317,7 +6317,7 @@ $as_echo_n "checking for zlib... " >&6; 
+ # Check whether --with-zlib was given.
+ if test "${with_zlib+set}" = set; then
+   withval=$with_zlib;  # check for header & func (in library) in given prefix
+-      CPPFLAGS="${CPPFLAGS} -I${withval}/include"
++      CPPFLAGS="${CPPFLAGS}"
+       if test "x$staticzlib" = "xtrue"; then
+               LIBS="-Bstatic -L${withval} -lz -Bdynamic ${LIBS}"
+       else
+@@ -10042,7 +10042,7 @@ _ACEOF
+ if test "${with_libiconv+set}" = set; then
+   withval=$with_libiconv;  # check for header & func (in library) in given prefix
+                       if test "x$withval" != "x"; then
+-                              CPPFLAGS="${CPPFLAGS} -I${withval}/include"
++                              CPPFLAGS="${CPPFLAGS}"
+                               LIBS="-L${withval}/lib -liconv ${LIBS}"
+                       else
+                               LIBS="-liconv ${LIBS}"
diff --git a/net/darkstat/Makefile b/net/darkstat/Makefile
new file mode 100644 (file)
index 0000000..00e4da6
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2007-2013 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:=darkstat
+PKG_VERSION:=3.0.715
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://unix4lyfe.org/darkstat
+PKG_MD5SUM:=5b7abc7538dcd8e30667dac150e81d77
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/darkstat
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +zlib
+  TITLE:=Network bandwidth monitor
+  URL:=http://unix4lyfe.org/darkstat/
+endef
+
+define Package/darkstat/description
+darkstat is a packet sniffer that runs as a background process on a cable/DSL
+router, gathers all sorts of statistics about network usage, and serves them
+over HTTP.
+endef
+
+define Package/darkstat/conffiles
+/etc/config/darkstat
+endef
+
+CONFIGURE_ARGS += \
+       --disable-debug \
+       --with-chroot-dir=/var/empty
+
+TARGET_CFLAGS += -std=gnu99
+
+define Build/Compile
+       $(HOSTCC) $(PKG_BUILD_DIR)/static/c-ify.c \
+               -o $(PKG_BUILD_DIR)/c-ify
+       $(call Build/Compile/Default)
+endef
+
+define Package/darkstat/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/darkstat $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/darkstat.init $(1)/etc/init.d/darkstat
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/darkstat.config $(1)/etc/config/darkstat
+endef
+
+$(eval $(call BuildPackage,darkstat))
diff --git a/net/darkstat/files/darkstat.config b/net/darkstat/files/darkstat.config
new file mode 100644 (file)
index 0000000..f83760e
--- /dev/null
@@ -0,0 +1,4 @@
+config darkstat
+       option interface 'lan'
+#      option httpaddr  '0.0.0.0'
+#      option httpport  '667'
diff --git a/net/darkstat/files/darkstat.init b/net/darkstat/files/darkstat.init
new file mode 100644 (file)
index 0000000..8499e3e
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+
+START=60
+RUN_D=/var/empty
+PID_F=$RUN_D/darkstat.pid
+
+start() {
+       mkdir -p $RUN_D
+       . /lib/functions/network.sh
+       config_load darkstat
+       config_foreach start_darkstat darkstat
+}
+
+start_darkstat() {
+       local cfg="$1"
+       config_get interface "$cfg" interface
+       config_get httpaddr "$cfg" httpaddr
+       config_get httpport "$cfg" httpport
+
+       network_get_device ifname "$interface" && {
+               /usr/sbin/darkstat --verbose \
+                       -i "$ifname" \
+                       ${httpaddr:+-b "$httpaddr"} \
+                       ${httpport:+-p "$httpport"} \
+                       --chroot $RUN_D \
+                       --pidfile $PID_F
+       }
+}
+
+stop() {
+       service_kill darkstat $PID_F
+       rm -f $PID_F
+}
diff --git a/net/darkstat/patches/100-do-not-use-NI_IDN.patch b/net/darkstat/patches/100-do-not-use-NI_IDN.patch
new file mode 100644 (file)
index 0000000..35133a3
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/dns.c
++++ b/dns.c
+@@ -346,9 +346,6 @@ dns_main(void)
+          reply.addr = ip;
+          flags = NI_NAMEREQD;
+-#  ifdef NI_IDN
+-         flags |= NI_IDN;
+-#  endif
+          switch (ip.family) {
+             case IPv4:
+                sin.sin_family = AF_INET;
diff --git a/net/deluge/Makefile b/net/deluge/Makefile
new file mode 100644 (file)
index 0000000..6e658d3
--- /dev/null
@@ -0,0 +1,111 @@
+#
+# Copyright (C) 2008-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:=deluge
+PKG_VERSION:=1.2.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.deluge-torrent.org/source/
+PKG_MD5SUM:=cec6b48f0abd79ea2cff3815a1124192
+
+PKG_BUILD_DEPENDS:=distribute/host
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/deluge/Default
+  SUBMENU:=BitTorrent
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A lightweight BitTorrent client
+  URL:=http://deluge-torrent.org/
+endef
+
+define Package/deluge
+$(call Package/deluge/Default)
+  TITLE+= (console UI & daemon)
+  DEPENDS+=+python +rblibtorrent +python2-chardet +pyxdg +twisted +twisted-web +pyopenssl
+endef
+
+define Package/deluge-ui-gtk
+$(call Package/deluge/Default)
+  TITLE+= (GTK+ UI)
+  DEPENDS+=deluge +python-gtk
+endef
+
+define Package/deluge-ui-web
+$(call Package/deluge/Default)
+  TITLE+= (Web UI)
+  DEPENDS+=deluge +mako
+endef
+
+define Package/deluge/description
+  BitTorrent client with a client/server model.
+endef
+
+define Package/deluge/conffiles
+/etc/config/deluge
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+
+       $(SED) 's,#!$(STAGING_DIR)/host/bin/$(PYTHON),#!/usr/bin/$(PYTHON),' $(PKG_INSTALL_DIR)/usr/bin/*
+endef
+
+define Package/deluge/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)/
+       rm -rf $(1)$(PYTHON_PKG_DIR)/deluge/ui/gtkui
+       rm -rf $(1)$(PYTHON_PKG_DIR)/deluge/ui/web
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) \
+           $(PKG_INSTALL_DIR)/usr/bin/* \
+           $(1)/usr/bin/
+       rm -rf $(1)/usr/bin/deluge-gtk
+       rm -rf $(1)/usr/bin/deluge-web
+
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/deluge.config $(1)/etc/config/deluge
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/deluge.init $(1)/etc/init.d/deluge
+endef
+
+define Package/deluge-ui-gtk/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/deluge/ui
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/deluge/ui/gtkui \
+           $(1)$(PYTHON_PKG_DIR)/deluge/ui/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) \
+           $(PKG_INSTALL_DIR)/usr/bin/deluge-gtk \
+           $(1)/usr/bin/
+endef
+
+define Package/deluge-ui-web/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/deluge/ui
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/deluge/ui/web \
+           $(1)$(PYTHON_PKG_DIR)/deluge/ui/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) \
+           $(PKG_INSTALL_DIR)/usr/bin/deluge-web \
+           $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,deluge))
+$(eval $(call BuildPackage,deluge-ui-gtk))
+$(eval $(call BuildPackage,deluge-ui-web))
diff --git a/net/deluge/files/deluge.config b/net/deluge/files/deluge.config
new file mode 100644 (file)
index 0000000..3d41776
--- /dev/null
@@ -0,0 +1,6 @@
+config global deluged
+       option 'user' 'deluge'
+       option 'group' 'deluge'
+       option 'home' ''
+       option 'options' ''
+       option 'enabled' 1
diff --git a/net/deluge/files/deluge.init b/net/deluge/files/deluge.init
new file mode 100644 (file)
index 0000000..50afc26
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010 Alexander Sulfrian
+
+START=50
+STOP=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+SERVICE_PID_FILE="/var/run/deluged.pid"
+
+error() {
+       echo "${initscript}:" "$@" 1>&2
+}
+
+section_enabled() {
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+start_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       config_get uid "$s" 'user'
+       [ -n "$uid" ] || {
+               error "user is not set"
+               return 1
+       }
+       user_exists $uid || {
+               error "user '$uid' dos not exist"
+               return 1
+       }
+
+       config_get gid "$s" 'group'
+       [ -n "$gid" ] || {
+               error "group is not set"
+               return 1
+       }
+       group_exists $gid || {
+               error "group '$gid' dos not exist"
+               return 1
+       }
+
+       config_get home "$s" 'home'
+       [ -n "$home" ] || {
+               home=$(grep "^${user}:" /etc/passwd | cut -d ':' -f 6)
+       fi
+       [ -d "$home" ] || {
+               error "home directory '$home' for user '$uid' dos not exist"
+               return 1
+       }
+
+       config_get options "$s" 'options'
+
+       HOME="$home" \
+       SERVICE_UID="$uid" \
+       SERVICE_GID="$gid" \
+       service_start /usr/bin/python2.6 /usr/bin/deluged --do-not-daemonize $options
+}
+
+stop_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       config_get uid "$s" 'user'
+       config_get gid "$s" 'group'
+
+       SERVICE_UID="$uid" \
+       SERVICE_GID="$gid" \
+       service_stop /usr/bin/python2.6
+}
+
+start()
+{
+       config_load 'deluged'
+       config_foreach start_instance 'deluged'
+}
+
+stop()
+{
+       config_load 'deluged'
+       config_foreach stop_instance 'deluged'
+}
diff --git a/net/dhcp-forwarder/Makefile b/net/dhcp-forwarder/Makefile
new file mode 100644 (file)
index 0000000..aa6dc3d
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2006-2012 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:=dhcp-forwarder
+PKG_VERSION:=0.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://savannah.nongnu.org/download/dhcp-fwd
+PKG_MD5SUM:=3b96dd27f6d05502d4048acab453808d
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_ARGS += \
+       --disable-dietlibc
+
+define Package/dhcp-forwarder
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=DHCP relay agent
+  URL:=http://www.nongnu.org/dhcp-fwd/
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               cfg_filename="/etc/dhcp-fwd.conf" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/dhcp-forwarder/conffiles
+/etc/dhcp-fwd.conf
+endef
+
+define Package/dhcp-forwarder/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/etc $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhcp-fwd $(1)/usr/bin/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/contrib/dhcp-fwd.conf $(1)/etc/
+       $(INSTALL_BIN) ./files/dhcp-fwd.init $(1)/etc/init.d/dhcp-fwd
+endef
+
+$(eval $(call BuildPackage,dhcp-forwarder))
diff --git a/net/dhcp-forwarder/files/dhcp-fwd.init b/net/dhcp-forwarder/files/dhcp-fwd.init
new file mode 100644 (file)
index 0000000..b3d2375
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+
+LOG_D=/var/log
+RUN_D=/var/run
+PID_F=$RUN_D/dhcp-fwd.pid
+
+start() {
+       [ -d $LOG_D ] || mkdir -p $LOG_D
+       [ -d $RUN_D ] || mkdir -p $RUN_D
+       dhcp-fwd
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
diff --git a/net/dhcpcd/Makefile b/net/dhcpcd/Makefile
new file mode 100644 (file)
index 0000000..3828b1f
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2007-2013 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:=dhcpcd
+PKG_VERSION:=6.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://roy.marples.name/pub/dhcpcd
+PKG_MD5SUM:=6070040c57492925af9ac6aed980de2a
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dhcpcd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=DHCP client for automatically configuring IPv4 networking
+  DEPENDS:=+librt
+  URL:=http://roy.marples.name/projects/dhcpcd
+endef
+
+define Package/dhcpcd/description
+       Simple configuration: supports executions of a script when the
+       IP address changes.
+endef
+
+define Package/dhcpcd/install
+       $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/etc/dhcpcd.enter-hook
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhcpcd $(1)/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dhcpcd-run-hooks $(1)/sbin/
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/dhcpcd.conf $(1)/etc/dhcpcd.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/lib/dhcpcd-hooks/* $(1)/etc/dhcpcd.enter-hook/
+endef
+
+$(eval $(call BuildPackage,dhcpcd))
+
diff --git a/net/dhcpcd/patches/001-configure_add_cflags_to_getifaddrs_test.patch b/net/dhcpcd/patches/001-configure_add_cflags_to_getifaddrs_test.patch
new file mode 100644 (file)
index 0000000..a413377
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -369,7 +369,7 @@ int main(void) {
+       return getifaddrs(&ifap);
+ }
+ EOF
+-if $XCC _getifaddrs.c -o _getifaddrs 2>/dev/null; then
++if $XCC $CFLAGS _getifaddrs.c -o _getifaddrs 2>/dev/null; then
+       echo "yes"
+ else
+       echo "no"
diff --git a/net/dircproxy/Makefile b/net/dircproxy/Makefile
new file mode 100644 (file)
index 0000000..6896637
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2006,2007 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:=dircproxy
+PKG_VERSION:=1.2.0-RC1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://dircproxy.googlecode.com/files/
+PKG_MD5SUM:=4fe2e82619c7b575599bfb236adbd872
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dircproxy
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=An IRC proxy server
+  URL:=http://dircproxy.googlecode.com/
+endef
+
+# uses Build/Configure/Default
+
+define Package/dircproxy/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dircproxy{,-crypt} $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,dircproxy))
diff --git a/net/ditg/Makefile b/net/ditg/Makefile
new file mode 100644 (file)
index 0000000..4470672
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2010-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:=ditg
+PKG_VERSION:=2.8.0-rc1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=D-ITG-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.grid.unina.it/software/ITG/codice
+PKG_MD5SUM:=609736113de729df833ac691d1c44ead
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/D-ITG-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ditg
+  TITLE:=D-ITG (Distributed Internet Traffic Generator)
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://www.grid.unina.it/software/ITG/
+  MAINTAINER:=Giovanni Di Stasi <giovanni.distasi@unina.it>
+  DEPENDS:=+libpthread $(CXX_DEPENDS)
+endef
+
+define Package/ditg/description
+  D-ITG (Distributed Internet Traffic Generator) is a platform capable
+  to produce traffic at packet level accurately replicating appropriate
+  stochastic processes for both IDT (Inter Departure Time) and PS
+  (Packet Size) random variables (exponential, uniform, cauchy, normal,
+  pareto, ...). D-ITG supports both IPv4 and IPv6 traffic generation and
+  it is capable to generate traffic at network, transport, and
+  application layer. We believe that D-ITG shows interesting properties
+  when compared to other traffic generators.
+endef
+
+MAKE_PATH := src
+
+MAKE_FLAGS += \
+       CXXOPT="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -DMULTIPORT -DARM"
+
+define Package/ditg/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/ITG{Send,Recv,Log,Dec} $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ditg))
diff --git a/net/djbdns/Changelog b/net/djbdns/Changelog
new file mode 100644 (file)
index 0000000..2fcd471
--- /dev/null
@@ -0,0 +1,43 @@
+#Changelog for the djbdns port for OpenWRT
+
+5 20090522 jhalfmoon
+enhancement - added patch: dnsroots_updated
+enhancement - added patch: tinydns_one_second
+enhancement - added patch: srv-records-and-axfrget
+enhancement - added patch: dnscache_less_chatty_log
+enhancement - added patch: tinydns_mmap_leak
+enhancement - added patch: dnscache_dpos_tcp_servfail
+enhancement - added patch: dnscache_negative_ttls
+enhancement - added patch: dnscache_sigpipe_fix
+enhancement - added patch: dnscache_big_udp_packets
+enhancement - added patch: dnscache_ignoreip2 (Note: disabled in config by default!)
+enhancement - added HIDETTL config option
+change - Corrected a typo in the axfrdns description in the Makefile.
+change - Cleaned up some lines in the Makefile
+change - dnsroots.global now gets copied from the djbdns source folder instead of from the package/files folder.
+change - The dnscache-multiple-ip patch was removed as it served no purpose
+change - Renamed a few patches to be more consistent with the other patches
+change - Updated the README file to reflect the changes 
+
+4 20090418 jhalfmoon
+bugfix - The dnscache postinst script had a bug that prevented djbdns from being compiled into a firmware image.
+bugfix - The dnscache startup script now uses /dev/urandom instead of /dev/random as a source of randomness. Using /dev/random does not work on 2.6 kernels.
+bugfix - dnscache no longer tries to use /tmp/resolv.conf.auto but /etc/resolv.conf instead. This only applies when useresolvconf==1.
+change - In menuconfig: djbdns moved from network to network/DNS 
+change - Removed the dnscache postinst script to the dnscache startup script. The script configures dnscache to accept connections from certain local network adresses.
+change - The dnscache startup script was cleaned up a bit. 
+change - default logging level is now info instead of notice.
+enhancement - Added option to add list of resolvers to UCI config for use in forwardonly mode. Two OpenDNS example addresses are added as a default.
+
+3 20090409 jhalfmoon
+bugfix - The restart routines of all scripts were broken causing restart to fail
+bugfix - dnsqrx was broken, script accidentally relied on bash instead of sh
+
+2 20090406 jhalfmoon
+bugfix - dnscache init script did not correctly handle /tmp/resolv.conf.auto
+enhancement - Addded the dnsqr command from http://homepages.tesco.net/~J.deBoynePollard/Softwares/djbdns/dnsqrx
+change - Default dnscache CACHESIZE was set too low, was 200KB, is now 1MB
+change - Added list of patches and made some overall adjustments to the README
+
+1 20090404 jhalfmoon
+Initial release
diff --git a/net/djbdns/Makefile b/net/djbdns/Makefile
new file mode 100644 (file)
index 0000000..04d60b2
--- /dev/null
@@ -0,0 +1,208 @@
+#
+# Copyright (C) 2007-2012 OpenWrt.org
+# Original port by FreeWRT project.
+#
+# 2007     Alexander Tsvyashchenko  Adapted FreeWRT port for OpenWRT (Trac ticket 2497)
+# 2008     Some Danish guy          Created a port for OpenWRT 7.09
+# 20090403 jhalfmoon                Modified and augmented existing packages to work on OpenWRT buildroot (v8.09)
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=djbdns
+PKG_VERSION:=1.05
+PKG_RELEASE:=7
+
+PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
+PKG_SOURCE_URL:=http://cr.yp.to/djbdns/
+PKG_MD5SUM:=3147c5cd56832aa3b41955c7a51cbeb2
+PKG_BUILD_DEPENDS:=daemontools ucspi-tcp
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/djbdns/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://cr.yp.to/djbdns.html
+  SUBMENU:=IP Addresses and Names
+#  SUBMENU:=djbdns
+endef
+
+define Package/djbdns-base
+  $(call Package/djbdns/Default)
+  TITLE:=djbdns base configuration file
+endef
+
+define Package/djbdns-dnscache
+  $(call Package/djbdns/Default)
+  TITLE:=Recursive and forwarding caching name server
+  DEPENDS:= +djbdns-base
+endef
+
+define Package/djbdns-tinydns
+  $(call Package/djbdns/Default)
+  TITLE:=Authoritative name server
+  DEPENDS:= +djbdns-base
+endef
+
+define Package/djbdns-axfrdns
+  $(call Package/djbdns/Default)
+  TITLE:=Zone transfer server
+  DEPENDS:= +djbdns-base +djbdns-tinydns +ucspi-tcp
+endef
+
+define Package/djbdns-rbldns
+  $(call Package/djbdns/Default)
+  TITLE:=Real-time Block List name server
+  DEPENDS:= +djbdns-base
+endef
+
+define Package/djbdns-walldns
+  $(call Package/djbdns/Default)
+  TITLE:=Reverse DNS wall
+  DEPENDS:= +djbdns-base
+endef
+
+define Package/djbdns-tools
+  $(call Package/djbdns/Default)
+  TITLE:=Tools for testing and debugging DNS issues
+endef
+
+define Package/djdbns/description
+       djbdns is a collection of Domain Name System tools.
+       It includes software for all the fundamental DNS operations:
+       * DNS server: publishing addresses of Internet hosts.
+       * DNS cache: finding addresses of Internet hosts.
+       * DNS client: talking to a DNS cache.
+
+       Also included is a DNS client C library, several command-line
+       DNS client utilities, several DNS debugging tools.
+endef
+
+define Package/djbdns-base/description
+       The shared config file for the djbdns daemons.
+endef
+
+define Package/djbdns-dnscache/description
+       dnscache is a DNS cache.
+       It accepts recursive DNS queries from local clients such as web
+       browsers and mail transfer agents. It collects responses from
+       remote DNS servers. It caches the responses to save time later.
+endef
+
+define Package/djbdns-tinydns/description
+       tinydns is a DNS server.
+       It accepts iterative DNS queries from hosts around the Internet
+       and responds with locally configured information.
+endef
+
+define Package/djbdns-axfrdns/description
+       axfrdns is a DNS zone-transfer server.
+       It reads a zone-transfer request in DNS-over-TCP format
+       from its standard input and responds with locally configured
+       information.
+endef
+
+define Package/djbdns-rbldns/description
+       rbldns is an IP-address-listing DNS server.
+       It accepts iterative DNS queries from hosts around the Internet asking
+       about various IP addresses. It provides responses showing whether the
+       addresses are on a locally configured list, such as RBL or DUL.
+endef
+
+define Package/djbdns-walldns/description
+       walldns is a reverse DNS wall.
+       It accepts iterative DNS queries for in-addr.arpa domains from hosts
+       around the Internet and supplies generic responses that avoid
+       revealing local host information.
+endef
+
+define Package/djbdns-tools/description
+       Several command-line DNS client utilities and DNS debugging tools.
+endef
+
+define Build/Compile
+       TARGET_CC="$(TARGET_CC)" \
+       TARGET_CFLAGS="$(TARGET_CFLAGS)" \
+       TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
+       TARGET_RANLIB="$(TARGET_CROSS)ranlib" \
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/djbdns-base/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/djbdns.conf $(1)/etc/config/djbdns
+endef
+
+define Package/djbdns-base/conffiles
+/etc/config/djbdns
+endef
+
+define Package/djbdns-dnscache/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) dnscache pickdns pickdns-data $(1)/usr/bin)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/dnscache.init $(1)/etc/init.d/dnscache
+       $(CP) -r ./files/dnscache $(1)/etc/
+       $(CP) $(PKG_BUILD_DIR)/dnsroots.global $(1)/etc/dnscache/
+       $(INSTALL_DIR) $(1)/etc/dnscache/ip
+       $(INSTALL_DIR) $(1)/etc/dnscache/servers
+       $(CP) $(PKG_BUILD_DIR)/dnsroots.global $(1)/etc/dnscache/servers/@
+endef
+
+define Package/djbdns-tinydns/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) tinydns tinydns-data tinydns-edit tinydns-get $(1)/usr/bin)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tinydns.init $(1)/etc/init.d/tinydns
+       $(CP) -r ./files/tinydns $(1)/etc/
+endef
+
+define Package/djbdns-axfrdns/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) axfrdns axfr-get $(1)/usr/bin)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/axfrdns.init $(1)/etc/init.d/axfrdns
+       $(CP) -r ./files/axfrdns $(1)/etc/
+endef
+
+define Package/djbdns-rbldns/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) rbldns rbldns-data $(1)/usr/bin)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rbldns.init $(1)/etc/init.d/rbldns
+       $(CP) -r ./files/rbldns $(1)/etc/
+endef
+
+define Package/djbdns-walldns/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) walldns $(1)/usr/bin)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/walldns.init $(1)/etc/init.d/walldns
+endef
+
+define Package/djbdns-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) dnsfilter dnsip dnsipq dnsmx dnsname dnsnamex dnsq \
+                       dnsqr dnstrace dnstracesort dnstxt random-ip \
+       $(1)/usr/bin)
+       $(INSTALL_BIN) ./files/dnsroots-update $(1)/usr/bin/
+       $(INSTALL_BIN) ./files/dnsqrx $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,djbdns-base))
+$(eval $(call BuildPackage,djbdns-tinydns))
+$(eval $(call BuildPackage,djbdns-dnscache))
+$(eval $(call BuildPackage,djbdns-axfrdns))
+$(eval $(call BuildPackage,djbdns-rbldns))
+$(eval $(call BuildPackage,djbdns-walldns))
+$(eval $(call BuildPackage,djbdns-tools))
diff --git a/net/djbdns/README b/net/djbdns/README
new file mode 100644 (file)
index 0000000..a6e5921
--- /dev/null
@@ -0,0 +1,319 @@
+
+# 20090409 jhalfmoon@milksnot.com - Don't hesitate to let me know if you decide to use it and/or what you think of it.
+
+This is a port of djbdns for OpenWRT (>= v8.09). Features:
+
+- works with the most current buildroot
+- makes use of the UCI configuration system
+- components are seperately packaged to minimize package footprint
+- most of the popular and necessary available patches are applied
+- documentation available (you're reading it)
+
+The djbdns package is a set of compact, reliable and fast DNS daemons and tools. This port is based on the work done by a few other people:
+
+- The FreeWRT project
+- Alexander Tsvyashchenko - https://dev.openwrt.org/ticket/2497
+- Some anonymous (Danish?) person - https://dev.openwrt.org/ticket/3837
+
+Using the previous work as a base, time went into rewriting the Make file, adding patches, adding the config system and writing this documentation. The ucspi-tcp and daemontools packages were not touched; they work just fine in the state they were found on OpenWRT TRAC.
+
+The following document meant to give some useful information about this package. You do not need to know all of the following to install or compile this package; it is only meant as an addition to help potential users on their way. An installation could theoretically be as simple as: "opkg install dnscache.ipk ; /etc/init.d/dnscache start". To find more about the workings of djbdns, visit:
+
+http://cr.yp.to/djbdns.html
+
+On the following sites you can find even more info, including text about the patches included in this package:
+
+http://www.lifewithdjbdns.com/
+http://www.thedjbway.org/djbdns/resources.html
+http://www.fefe.de/djbdns/
+http://homepages.tesco.net/~J.deBoynePollard/FGA/#DNS
+http://binarios.com/miscnotes/djbdns.html
+http://web.archive.org/web/20061013054303/http://ezine.daemonnews.org/200210/ezdjbdns.html
+
+Some info about the bugfixes:
+
+http://www.securityfocus.com/archive/1/501294/30/0/threaded
+http://www.your.org/dnscache/
+
+How to build
+============
+- copy the folders djbdns, ucspi-tcp (and optionally daemontools) to your buildroot/package directory 
+- make menuconfig
+- select the packages under network/DNS/djbdns and network/ucspi-tcp (and optionally network/daemontools)
+- make
+- after compilation, the package can be found at bin/packages/<targetname>
+- now do what you normally do to install self-compiled packages on your OpenWRT machine
+
+If you wish to tinker with the code, then here are some useful commands to run in the buildroot:
+    rm -rf build_dir/<targetname>/djbdns-1.05
+    make package/cleanup
+    make package/djbdns/compile V=99
+    make package/index
+Once you have done a "make menuconfig;make" you can use these commands to quickly rebuild only the djbdns package.
+
+Usage pointers
+==============
+- After installation, you can make the servers start automatically on boot by running "/etc/init.d/<servicename> enable" . The script will then appear in the /etc/rc.d directory. This is standard OpenWRT functionality.
+- All djbdns parameters are stored in the UCI configuration system. Run "uci show djbdns" to see the settings. Data files are not implemented in the UCI system, so these files must be manually backed up when and if you intend to do a sysupgrade (=reflash the firmware). Those files include: dnscache dnsroot.global, dnscache @ file, tinydns data file, axfrdns tcp file, rbldns data file, each in their individual directories in /etc.
+- Each package is ready to run out-of-the-box, once installed. The default settings allow you to start playing immediately. The defaults are reasonably secure, but do not take my word for it. Verify it. Note: dnscache has two default example resolver IP addresses. The two default addresses are the OpenDNS resolvers, which might work at the moment, but this may change in the future.
+- You will most likely want to customize the settings for each seperate service you wish to use. Read the docs on the weblinks listed above for pointers on how to do so.
+- The ucspi-tcp package is only needed if you wish to install and run axfrdns.
+- The daemontools package is strictly optional. It is in no way linked to the djbdns package (yet). It is just there for you to play with.
+- Starting the init.d scripts from the command line with the environment variable DEBUG set to 1 will prevent the servers from daemonizing and show the servers's log dumped to stdout / stderr instead of /dev/null. Example: "DEBUG=1 /etc/init.d/dnscache start"
+- By default, all logging is disabled. Each daemon has a seperate option to activate logging. When logging activated the daemon logs to syslog using facility local1.info.
+- Each djbdns server requires an IP address on which to listen on. This port of djbdns allows you to define an interface on which to listen instead of an IP address. The advantage of this is that an interface can get a different IP address assigned, the djbdns stuff will not break. The dnscache server has a patch applied so that it is possible to define multiple interfaces on which to listen, separated by slashes. Example: wan/lan .
+- By default, dnscache acts as a recursive name server. If you wish to operate in forwardonly mode, then you need to set the forwardonly flag to '1'. Then you need to do either one of the following: Put the ip addresses of the name servers you wish to use as resolvers in the UCI config (djbdns.dnscache.resolver) or alternatively you can set the useresolvconf flag which will cause the dns servers assigned by dhcp to be used. That last option is a so called set-and-forget mode which will work quite well in most home environments.
+- If you want your OpenWRT machine to make use of its own dnscache, then you must make /etc/resolv.conf reflect this. One way of doin this is as follows: uci set network.wan.dns=127.0.0.1 . If you have dnscache listening on some other interface, you would naturally replace 127.0.0.1 by the address of that interface.
+- OpenWRT has several applications that can do DNS serving in one way or another (dnsmasq, Maradns, Bind). Make sure you have none of these apps running when you start running a djbdns name server because having two DNS apps listening on the same address is not something you would usually want. A patch for the dnsmasq configuration script and its config file is included with this package. The patch will allow you to configure dnsmasq to listen only on certain interfaces, instead of on all them as it does by default on OpenWRT. Alternatively, you could completely disable and / or remove dnsmasq, if you do not intend to use any of its functionality (which is serving DNS and DHCP).
+- The ignoreip patch also has a script supplied along with it, with which you can update the ignorelist. The script contains an explanation of why you might want to do this.
+- The ignoreip functionality is disabled by default. If you want to activate it, you need to set the flag 'useignore' flag to '1' in the config. You might also want to check if you are really blocking what you want to block. Be careful with this feature. Think twice before using it.
+
+To apply the dnsmasq patch
+==========================
+NOTE: This patch has been incorporated into OpenWRT trunk per 20090409 as seen in https://dev.openwrt.org/ticket/4900 and https://dev.openwrt.org/changeset/15172.
+
+This is a patch to allow you to use dnsmasq alongside dnscache. It will allow you to configure dnsmasq to listen only on certain interfaces, instead of on all them as it does by default on OpenWRT. It only patches the startup script and configuration file of dnsmasq, not dnsmasq itself. If you need or desire to apply the patch yourself, then there are two possible ways to go about it:
+
+Patch the dnsmasq package source:
+- cd to svn/openwrt/branches/8.09/packages/dnsmasq/files
+- do 'patch < dnsmasq.patch
+- if all went well you can now compile the package as you nomally would
+- you can now either reinstall dnsmasq on your router or re-flash the firmware image. If you reinstall the dnsmasq package then you waste some flash memory, as dnsmasq is usually already included as a part of the firmware image. One way to reinstall the dnsmasq package is to use SSH to upload the image to the router and do: opkg update ; opgk install -force-reinstall dnsmasq.ipk . Or you could configure your OpenWRT build machine as an http server that serves OpenWRT packages and then configure opkg to use your server as an ipkg repository. This is generally a pretty good idea if you are building your own firmware and packages.
+
+Alternatively, you can patch the dnsmasq files on the router itself:
+Look at the patch file and manually patch the files on the router. There are only four lines to modify, so it is not hard.
+
+NOTE: The dnsmasq paramaters added by this patch are not shown on the Luci webinterface. You will manually have to configure dnsmasq. An example of how to make dnsmasq serve DNS and DHCP only on the lan:
+uci set dhcp.@dnsmasq[0].nonwildcard=1
+uci set dhcp.@dnsmasq[0].interfaces=br-lan
+uci commit
+This will prevent dnsmasq from binding to the wildcard IP address and instead make it listen on the designated (lan) interface. You are then free to run a DNS server on, for example, the loopback and/or the wan interface.
+
+Assorted notes
+==============
+- This port was put together with reasonable care. It is not a dirty hack, but that is ofcourse a very subjective statement.
+- It was created on and for Kamikaze 8.09 with both a 2.4 and a 2.6 kernel. It was not tested to work on older versions of OpenWRT, but it might.
+- This package will build into several packages. Most of the packages rely on the package djbdnsbase. It contains the shared config data for all daemons. It should automatically get installed along with the daemons by opkg.
+- The ucspi-tcp package is a requirement for installing axfrdns. If you don't user afrxdns, you won't need to install ucspi-tcp.
+- The daemontool package is supplied as a part of this port, but it is not needed or used by anything in the djbdns packages. It is included in case anyone feels the want or need to make use of it.
+- Among the applied patches are the latest (as of the 2nd of april 2009) notorious bug fixes for dnscache.
+- Most patches are vanilla, ie. unmodified as they can be found on the net. The only patch modified is the djbdns-1.05-slogging patch, which was merged with the server-1.05-nxdomain-logging patch.
+- The dnscache gets a patch applied to be able to listen on multiple IP addresses. Tinydns is not patched to have that functionality, although the patch for that is available on the net.
+- dnscache is also patched to deliver additional statistics in its log files, including hits/misses and what types of records were queried. These can be used to monitor and/or graph the behaviour of your dnscache server.
+- The dnscache package gets configured to listen to 127.0.0.1 and the lan subnet by default. See "ls /etc/dnscache/ip" and  "uci show djbdns|grep dnscache" .
+- tinydns, axfrdns and rbldns include example data files that are installed by default. Their purpose is to ease installation and testing of the packages and to act as a guide to people who are not familiar with these applications. 
+- The dnstools part of this package contains a script called dnsroots-update with which you can update the global root file. This is quite useful because IP addresses of the root servers change now and then, although not very often. I seems that few people actually bother to update the global roots file once they have installed dnscache. It is important to run the update script every now and them, or at least at installation time. Do the following to update the list: dnsroots-update > /etc/dnscache/dnsroots.global and then copy the file dnsroots.global to /etc/dnscache/server/@ . The dnstools package is quite large (400K installed) for an embedded system. What you could do instead of running the update script on the router, is to install the djbdns package on some big machine and run the script on there and then copy the output to the dnsroots file on the router. The dnsroots.global file included in this package is up to date as per the date of this writing (2nd of april 2009).
+
+Testing the installation
+========================
+The following may ease any debugging you might wish/need to do:
+- Set the syslog buffer to something like 64K or more and make it log to IP address localhost (reboot to activate the changes):
+    uci set system.@system[0].log_ip=127.0.0.1
+    uci set system.@system[0].log_size=64
+    uci commit
+- Use "logread|less" to browse through the buffered syslog output.
+- For realtime log monitoring: Install netcat and make it listen to the syslog output:
+    opkg install netcat
+    netcat -ulp 514
+
+This paragraph gives a few brief pointers on how to test your installation. The general idea is as follows: Log in to the OpenWRT machine using two seperate SSH sessions or a single session and then use 'screen' to gain multiple sessions. In the first session you have to start the daemon you wish to test. In the second session you run the diagnostic commands. In the following examples, for each daemon and each diagnostic tool, I have supplied the commandline and the expected, approximate output.
+
+NOTE1: Make sure no other DNS servers are running. Check with "netstat -an|grep 53" and/or do a "killall dnsmasq" just to be sure.
+NOTE2: dnscache requires an active internet connection it to work
+NOTE3: In the following examples, the servers were running on IP address 10.1.1.2
+NOTE4: Most of these tests require the dnstools package to be installed
+
+-dnscache
+session1 "DEBUG=1 /etc/init.d/dnscache start"
+        Starting Caching nameserver: dnscachelistening on 0a010102
+        starting
+        <a whole truckload of log data will follow>
+session2 "DNSCACHEIP=$yourwanip dnsqr a example.com"  (note: you do no have to modify /etc/resolv.conf to use this command)
+        1 example.com:
+        45 bytes, 1+1+0+0 records, response, noerror
+        query: 1 example.com
+        answer: example.com 172800 A 208.77.188.166
+session2 "dnsip example.com" (note: /etc/resolv.conf must point to the address on which dnscache is listening)
+        208.77.188.166
+session2 "nslookup example.com" (note: /etc/resolv.conf must point to the address on which dnscache is listening)
+        Server:    10.1.1.2
+        Address 1: 10.1.1.2
+        Name:      example.com
+        Address 1: 208.77.188.166 www.example.com
+
+-tinydns
+session1 "DEBUG=1 /etc/init.d/tinydns start"
+        Starting Authoritative nameserver: tinydnsstarting tinydns
+        0a010102:4eee:fdd8 + 0001 example.net
+        stats 1 1 0 0 0 0 0
+session2 "dnsq a example.net $yourwanip"
+        1 example.net:
+        79 bytes, 1+0+1+0 records, response, authoritative, noerror
+        query: 1 example.net
+        authority: example.net 2560 SOA ns.example.net hostmaster.example.net 1238703484 16384 2048 1048576 2560
+
+-axfrdns
+session1 "DEBUG=1 /etc/init.d/axfrdns start"
+        Starting Zone transfer name server: tcpservertcpserver: status: 0/10
+        tcpserver: status: 1/10
+        tcpserver: pid 1140 from 10.1.1.2
+        tcpserver: ok 1140 0:10.1.1.2:53 :10.1.1.2::1034
+        0a010102:040a:0000 0006 example.net
+        tcpserver: end 1140 status 0
+        tcpserver: status: 0/10
+session2 "tcpclient -RHl0 $yourwanip 53 axfr-get example.net /tmp/zone /tmp/zone.tmp"
+        The file /tmp/zone should now contain the example.net zone in tinydns-data format.
+
+-rbldns
+session1 "DEBUG=1 /etc/init.d/rbldns start"
+        Starting Reverse DNS wall: rbldnsstarting rbldns
+        0a010102:881d:01ca + 0010 8.4.2.1.test
+        stats 1 1 0 0 0 0 0
+        0a010102:674a:e70f N 0010 9.4.2.1.test
+session2 "dnsq txt 8.4.2.1.test $yourwanip"
+        16 8.4.2.1.test:
+        59 bytes, 1+1+0+0 records, response, authoritative, noerror
+        query: 16 8.4.2.1.test
+        answer: 8.4.2.1.test 2048 16 \020www.somesite.com
+session2 "dnsq txt 9.4.2.1.test $yourwanip"
+        16 9.4.2.1.test:
+        30 bytes, 1+0+0+0 records, response, authoritative, nxdomain
+        query: 16 9.4.2.1.test
+
+-walldns
+session1 "DEBUG=1 /etc/init.d/walldns start"
+        Starting Reverse DNS wall: walldnsstarting walldns
+        0a010102:7b76:3d97 + 0001 4.3.2.1.in-addr.arpa
+        stats 1 1 0 0 0 0 0
+session2 "dnsq a 4.3.2.1.in-addr.arpa $yourwanip"
+        1 4.3.2.1.in-addr.arpa:
+        54 bytes, 1+1+0+0 records, response, authoritative, noerror
+        query: 1 4.3.2.1.in-addr.arpa
+        answer: 4.3.2.1.in-addr.arpa 655360 A 1.2.3.4
+
+axfrdns defaults
+================
+axfrdns is run using tcpserver from the ucspi-tcp package. The following parameters are used to start the tcpserver daemon (which runs as root BTW):
+-D: Never delay sending data; enable TCP_NODELAY.
+-R: Do not attempt to obtain $TCPREMOTEINFO from the remote host. To avoid loops, you must use this option for servers on TCP ports 53 and 113.
+-H: Do not look up the remote host name in DNS; remove the environment variable $TCPREMOTEHOST. To avoid loops, you must use this option for servers on TCP port 53. 
+-l localname: Do not look up the local host name in DNS; use localname for the environment variable $TCPLOCALHOST. A common choice for localname is 0. To avoid loops, you must use this option for servers on TCP port 53. 
+-c n (=40): Do not handle more than n simultaneous connections. If there are n simultaneous copies of prog running, defer acceptance of a new connection until one copy finishes. n must be a positive integer. Default: 40. 
+-b n (=10): Allow a backlog of approximately n TCP SYNs. On some systems, n is silently limited to 5. On systems supporting SYN cookies, the backlog is irrelevant. 
+
+In debug mode and when logging is activated, the following parameter is also active:
+-v: Verbose. Print error messages and status messages.
+
+Applied patches
+===============
+crosscompile.patch
+https://dev.openwrt.org/ticket/2497
+Patch to make djbdns compile correctly for OpenWRT. I understand that the original patch comes from FreeWRT and was adapted for OpenWRT by Alexander Tsvyashchenko.
+
+dnsroots-update.patch
+Update the dnsroots.global file to be current.
+
+srv-records-and-axfrget.patch
+http://sol.truespace.ca/Files/djbdns/srv.patch
+Adds native support for srv records (not really necessary) and also patches axfr-get to decompose SRV and PTR records and write them out in native format, rather than opaque. This last thing is needed to fix a possible problem with tinydns-data.
+
+dnscache_less_chatty_log
+http://sol.truespace.ca/Files/djbdns/log.patch
+Makes dnscache log "stat" entries no more than once per 5 seconds.
+
+tinydns_mmap_leak
+http://marc.info/?l=djbdns&m=116399640808774&w=2
+This fixes the following: In the original code if cdb_read encountered an error it returned an error code and the calling function exited without closing the cdb data file resulting in an fd leak, eventually leading to a 'too many files open' error.
+
+dnscache_big_udp_packets
+http://marc.info/?l=djbdns&m=122368590802063&w=2
+Patch to support oversized UDP packets up to 4096 bytes in length, while still correctly truncating responses over 512 bytes when sending them to stub resolvers.
+
+dnscache_dpos_tcp_servfail
+http://marc.info/?l=djbdns&m=119998909915985&w=3
+Fixes broken tcp dns queries in certain situations. For example: A vanilla 1.05 will fail on "dnstxt aol.com aol.com".
+
+dnscache-cache-negatives
+http://sol.truespace.ca/Files/djbdns/nxdomain.patch
+Add support for caching of unsuccessful lookup results.
+
+tinydns_one_second
+http://www.tinydns.org/one-second.patch
+Causes tinydns to keep its mmap() of the data.cdb file open for at most one second, instead of the default one hundred queries. This improves throughput on high traffic machines.
+
+dnscache-cachestats.patch
+http://romana.now.ie/#djbdns-cachestats
+This patch modifies the dnscache program to keep a counter of cache hits and cache misses. Two new fields are added to the stats output line: the fifth number is the number of cache hits; the sixth number is the number of cache misses.
+
+compiler-temporary-filename.patch
+http://homepages.tesco.net/~J.deBoynePollard/Softwares/djbdns/#compiler-temporary-filename
+A bit of a nit-picky patch that adjusts the names of generated temorary files to be more 'correct'. A bit silly really.
+
+dnscache-multiple-ip.patch
+http://danp.net/djbdns/patches.html
+When applied, dnscache will accept a /-delimited list of IP address in $IP and bind to each in turn. NOTE: This patch is only really useful on embedded systems with very limited memory. On big systems, ther are other ways to achieve listening on multiple IP adresses. You can read more on that over here: http://www.faqts.com/knowledge_base/view.phtml/aid/9644/fid/699
+
+dnsnamex-extra-command.patch
+http://homepages.tesco.net/~J.deBoynePollard/Softwares/djbdns/#dnsnamex
+Not really a patch, but an extra command. dnsnamex prints all of the domain names that the IP address supplied to it maps to, on a single line.
+
+dnscache-cname-handling.patch
+http://homepages.tesco.net/~J.deBoynePollard/FGA/#DNS
+Fixes mis-handling of client-side aliases
+
+dnscache-strict-forwardonly.patch
+http://homepages.tesco.net/~J.deBoynePollard/Softwares/djbdns/#dnscache-strict-forwardonly
+This patch modifies the behaviour of dnscache such that "forwardonly" mode is fully enforced.
+
+dnscacheip-space-separator.patch
+http://homepages.tesco.net/~J.deBoynePollard/FGA/djbdns-problems.html#dnscacheip-separator-character
+Patch to change the separator in ${DNSCACHEIP} to the space character
+
+tinydns-data-semantic-error.patch
+http://homepages.tesco.net/~J.deBoynePollard/FGA/djbdns-problems.html#tinydns-data-semantic-error
+Fixes the fact that stock tinydns-data doesn't handle semantic errors in its input
+
+tinydns-alias-chain-truncation.patch
+http://homepages.tesco.net/~J.deBoynePollard/FGA/djbdns-problems.html#tinydns-alias-chain-truncation
+Fixes truncation of alias chains by tinydns and axfrdns
+
+dnscache-slogging.patch
+http://www.ohse.de/uwe/patches.html
+Patch to enable statistics logging of queried resource records.
+This patch is merged with the patch server-1.05-nxdomain-logging.patch that logs nxdomain queries.
+http://danp.net/djbdns/
+
+dnsfilter-replace.patch
+http://www.ohse.de/uwe/patches.html
+This patch adds an option to the dnsfilter program (-r). It's use makes dnsfilter simply replace the IP address by the host name if possible. If the IP address cannot be determined for whatever reason then it will be left alone. -r stands for replace. 
+
+dnscache_sigpipe_fix
+http://marc.info/?l=djbdns&m=104804013229536&w=2
+This patch tells dnscache to ignore the SIGPIPE signal.
+
+ignoreip2.patch
+http://tinydns.org/djbdns-1.05-ignoreip2.patch
+This patch change djbdns's dnscache so that it will ignore thex IP addresses given in the ignoreip file. This patch was made to boycott Verisign, amongst others, who decided to start supplying replies to non-existant and wildcard domains. NOTE: This feature is disabled in the config file by default. Be careful with this one.
+
+bugfix-dnscache-dempsky-poison.patch
+http://www.securityfocus.com/archive/1/501294/30/0/threaded
+Patch to fix a potential cache-poisoning attack. This bug only affects domains that serve DNS content using tinydns and axfrdns (only for DNS queries over TCP; clients do not need AXFR permissions) from djbdns 1.05 and allow untrusted users to include arbitrary records.
+
+bugfix-dnscache-merge-outgoing-requests.patch
+http://www.your.org/dnscache/
+This patch prevents a class of poisoning attack by combining identical requests from clients into one outgoing query. Without this patch, an attacker can coerce dnscache into launching hundreds of identical queries at once, making a specific type of attack several orders of magnitude easier. 
+
+bugfix-dnscache-cache-soa-records.patch
+http://www.your.org/dnscache/
+This patch allows dnscache to store the responses of "SOA" type queries in its cache. SOA responses are the only type of response unconditionally uncached. dnscache uses its internal cache to prevent certain classes of poisoning attack. Attackers may choose to send floods of SOA requests to bypass these protections. 
+
+dnrqx
+http://homepages.tesco.net/~J.deBoynePollard/Softwares/djbdns/dnsqrx
+Not really a patch, but a handy script to make dnsq query a given name server instead of the one in /etc/resolv.conf.
+
+Possible future enhancements to this package
+============================================
+- add a Luci webinterface
+- add scripts to make the DNS daemons run using daemontools to increase the reliability of the services
+- ipv6 support
diff --git a/net/djbdns/files/axfrdns.init b/net/djbdns/files/axfrdns.init
new file mode 100644 (file)
index 0000000..a40f93a
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+#
+# version 20090401 jhalfmoon
+
+START=47
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/tcpserver
+NAME=tcpserver
+DESC="Zone transfer name server"
+
+APP=/usr/bin/axfrdns
+ROOT=/tmp/tinydns
+
+if [ ! -e /etc/tinydns/data ] ; then
+    echo Error: Dependency tinydns not found.
+    exit 111
+fi
+
+start() {
+    echo "Starting $DESC: $NAME"
+    config_load djbdns
+    mkdir -p $ROOT
+    ln -sf /etc/tinydns/data $ROOT/data
+    cd $ROOT
+    tinydns-data
+    chown -R $UID:$GID $ROOT
+    tcprules $ROOT/tcp.cdb $ROOT/tcp.cdb.tmp < /etc/axfrdns/tcp
+    config_foreach get_userids global
+    config_foreach start_daemon axfrdns
+}
+
+get_userids() {
+    local cfg="$1"
+    config_get UID "$cfg" runasuser
+    config_get GID "$cfg" runasgroup
+    UID=`id -u $UID`
+    GID=`id -g $GID`
+}
+
+start_daemon() {
+    local cfg="$1"
+    config_get logging  "$cfg" logging
+    config_get iface    "$cfg" interface
+    config_get AXFR     "$cfg" allowedzones
+# Unset AXFR if it is empty
+    [ -z $AXFR ] && export -n AXFR
+# Translate listening interfaces to ip addresses
+    . /lib/functions/network.sh
+    network_get_ipaddr IP "$iface" || return 1
+    export ROOT
+    if [ "$DEBUG" == 1 ] ; then
+        $DAEMON -vDRHl0 -c40 -b10 -x $ROOT/tcp.cdb -- $IP 53 $APP
+    elif [ "$logging" == '1' ] ; then
+        $DAEMON -vDRHl0 -c40 -b10 -x $ROOT/tcp.cdb -- $IP 53 $APP 2>&1 | logger -p local1.info -t $NAME &    
+    else
+        $DAEMON -DRHl0 -c40 -b10 -x $ROOT/tcp.cdb -- $IP 53 $APP > /dev/null 2>&1 &
+    fi
+}
+
+stop() {
+    echo -n "Stopping $DESC: $NAME"
+    kill `pidof $NAME|sed "s/$$//g"` > /dev/null 2>&1
+    echo " ."
+}
+
+restart() {
+    echo "Restarting $DESC: $NAME... "
+    stop
+    sleep 2
+    start
+}
+
diff --git a/net/djbdns/files/axfrdns/tcp b/net/djbdns/files/axfrdns/tcp
new file mode 100644 (file)
index 0000000..1dc715b
--- /dev/null
@@ -0,0 +1,5 @@
+#Example rules for djb's tcpserver
+127.0.0.:allow
+10.1.1.:allow
+192.168.1.:allow
+:deny
diff --git a/net/djbdns/files/djbdns.conf b/net/djbdns/files/djbdns.conf
new file mode 100644 (file)
index 0000000..9541142
--- /dev/null
@@ -0,0 +1,41 @@
+
+config 'global'
+       option 'runasuser' 'nobody'
+       option 'runasgroup' 'nobody'
+
+config 'dnscache'
+       option 'interface' 'wan'
+       option 'interfacesend' 'wan'
+       option 'defaultallowif' 'lan wan'
+       option 'cachesize' '1000000'
+       option 'hidettl' '0'
+       option 'forwardonly' '1'
+       option 'useresolvconf' '1'
+       list 'resolver' '208.67.222.222'
+       list 'resolver' '208.67.220.220'
+       option 'useignore' '0'
+       list 'ignoreip' '203.119.4.28'
+       list 'ignoreip' '212.181.91.6'
+       list 'ignoreip' '62.4.64.119'
+       list 'ignoreip' '64.70.19.33'
+       list 'ignoreip' '69.25.75.72'
+       option 'logging' '0'
+
+config 'tinydns'
+       option 'interface' 'wan'
+       option 'logging' '0'
+
+config 'axfrdns'
+       option 'interface' 'wan'
+       option 'allowedzones' ''
+       option 'logging' '0'
+
+config 'rbldns'
+       option 'interface' 'wan'
+       option 'base' 'test'
+       option 'logging' '0'
+
+config 'walldns'
+       option 'interface' 'wan'
+       option 'logging' '0'
+
diff --git a/net/djbdns/files/dnscache.init b/net/djbdns/files/dnscache.init
new file mode 100644 (file)
index 0000000..97f8ee9
--- /dev/null
@@ -0,0 +1,122 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+
+# Preferably start dnscache after udhcpd/dnsmasq, to be sure /etc/resolv.conf is set correctly. dnsmasq is at S60, so dnscache is put at S65 as seen below. If /etc/resolv.conf is not used, then dnscache may be started at S47, just after the firewall has been set up.
+START=65
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/dnscache
+NAME=dnscache
+DESC="Caching name server"
+
+ROOT="/tmp/dnscache"
+resolvfile="/etc/resolv.conf"
+
+start() {
+    echo "Starting $DESC: $NAME"
+    config_load djbdns
+    config_foreach get_userids global
+    mkdir -p $ROOT
+    cp -fa /etc/dnscache/* $ROOT
+    rm -f $ROOT/resolvers
+    rm -f $ROOT/ignoreip
+    chown -R $UID:$GID $ROOT
+    config_foreach start_dnscache dnscache
+}
+
+get_userids() {
+    local cfg="$1"
+    config_get UID "$cfg" runasuser
+    config_get GID "$cfg" runasgroup
+    UID=`id -u $UID`
+    GID=`id -g $GID`
+}
+
+append_server() {
+    echo $1 >> $ROOT/resolvers
+}
+
+append_ignore() {
+    echo $1 >> $ROOT/ignoreip
+}
+
+start_dnscache() {
+    local cfg="$1"
+    config_get logging        "$cfg" logging
+    config_get useresolvconf  "$cfg" useresolvconf
+    config_get iface          "$cfg" interface
+    config_get ifacesend      "$cfg" interfacesend
+    config_get defaultallowif "$cfg" defaultallowif
+    config_get CACHESIZE      "$cfg" cachesize
+    config_get FORWARDONLY    "$cfg" forwardonly
+    config_get HIDETTL        "$cfg" hidettl
+    config_list_foreach       "$cfg" "resolver" append_server
+    config_get useignore      "$cfg" useignore
+    if [ "$useignore" == "1" ] ; then
+        config_list_foreach   "$cfg" "ignoreip" append_ignore
+    fi
+# Add some interface network addresses to list of allowed IP addresses (assumes /24 networks)
+    . /lib/functions/network.sh
+    if [ -n "$defaultallowif" ] ; then
+        for myinterface in `echo $defaultallowif`; do
+            network_get_ipaddr addr $myinterface || continue
+            # the next line strips the last octet from the ip address
+            addr=`echo $addr|sed 's/.[0-9]\+$//'`
+            touch $ROOT/ip/$addr
+            echo Adding $ROOT/ip/$addr
+        done
+    fi
+# Translate listen interface names to IP addresses
+    network_get_ipaddr IP "$iface"
+# Translate send interface name to an IP address
+    network_get_ipaddr IPSEND "$ifacesend"
+# Unset HIDETTL if equal to 0
+    if [ "$HIDETTL" == "0" ] ; then
+        export -n HIDETTL
+    fi
+# If forwardingonly set then activate list of resolvers
+    if [ "$FORWARDONLY" == "0" ] ; then
+        # Unset FORWARDONLY if equal to '0'
+        export -n FORWARDONLY
+    else
+# Use either fixed list of dnsservers or resolv.conf data
+        if [ "$useresolvconf" == "1" ] ; then
+            if [ -s "$resolvfile" ] ; then
+               cat $resolvfile|grep nameserver|sed 's/nameserver //g' > $ROOT/resolvers
+            else
+               echo Error: $resolvfile does not exist.
+               exit 1
+            fi
+        fi
+        if [ ! "`cat $ROOT/resolvers|wc -L`" == "0" ] ; then
+            cp -f $ROOT/resolvers $ROOT/servers/@ > /dev/null 2>&1
+        else
+            echo Error: No resolvers are defined.
+            exit 1
+        fi
+     fi
+    export IP 
+    export ROOT
+# dnscache likes to receive a 128 byte random seed
+    dd if=/dev/urandom of=$ROOT/randomseed bs=128 count=1  > /dev/null 2>&1
+    if [ "$DEBUG" == 1 ] ; then
+        $DAEMON < /$ROOT/randomseed
+    elif [ "$logging" == '1' ] ; then
+        $DAEMON 2>&1 < /$ROOT/randomseed | logger -p local1.info -t $NAME &
+    else
+        $DAEMON > /dev/null 2>&1 < /$ROOT/randomseed &
+    fi
+}
+
+stop() {
+    echo -n "Stopping $DESC: $NAME"
+    kill `pidof $NAME|sed "s/$$//g"` > /dev/null 2>&1
+    echo " ."
+}
+
+restart() {
+    echo "Restarting $DESC: $NAME... "
+    stop
+    sleep 2
+    start
+}
+
diff --git a/net/djbdns/files/dnscache/dnsroots.global b/net/djbdns/files/dnscache/dnsroots.global
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/net/djbdns/files/dnscache/ignoreip-update b/net/djbdns/files/dnscache/ignoreip-update
new file mode 100644 (file)
index 0000000..98a2c38
--- /dev/null
@@ -0,0 +1,95 @@
+#!/bin/sh
+# 
+# update-ignoreip version 0.1
+# Written by J.P. Larocque, <piranha@thoughtcrime.us>, OpenPGP 0x0c14cdda
+# This software is in the public domain.
+# 
+# This script is intended for djbdns users that have applied Russell
+# Nelson's patch to circumvent wildcard A records in TLDs:
+#
+#     http://tinydns.org/djbdns-1.05-ignoreip2.patch
+#
+# This script will try the wildcard name for each TLD in the
+# 'stupid_tlds' variable (eg, '*.com', '*.cx', etc.).  For those
+# addresses that resolve, they get added to your dnscache
+# 'root/ignoreip' file, and dnscache is restarted.
+# 
+# Run this script from your dnscache directory.  This script depends
+# on a proper PATH.  Old 'root/ignoreips' entries are kept (and dups
+# removed), so you can add this program to a cron job to keep ahead
+# of new bogus redirection addresses added by Verisign and other TLD
+# operators.
+# 
+# Adding this script to a cron job was its intended purpose, but
+# please don't do so without understanding how it works and what could
+# happen if it breaks.
+# 
+# The latest version of this program can be found at the URL:
+#       http://ely.ath.cx/~piranha/software/ignoreip-update/
+# This program has been signed with my public key.  Its fingerprint is:
+#       810B A0AC A7F7 2899 46D2  F2F6 3E7D 5279 0C14 CDDA
+# The detached signature can be found at the URL:
+#       http://ely.ath.cx/~piranha/software/ignoreip-update/ignoreip-update-0.1.asc
+# 
+# Changelog:
+#   version 0.1 (2003/Sep/17)
+#       Initially written and released.
+
+stupid_tlds='ac cc com cx museum net nu ph sh tm ws'
+ignoreip='root/ignoreip'
+
+set -e
+
+me="`basename "$0"`"
+
+if [ ! -d 'root' ]; then
+       echo "$me: run me from the dnscache directory" >&2
+       exit 1
+fi
+
+# I originally implemented this with random names, then realized all
+# the current $stupid_tlds answer to "*.$stupid_tld" just like any
+# other random name.  This code may be useful in the future, if an
+# arms race of sorts develops.  (Sigh.)
+
+if which md5sum > /dev/null 2>&1; then
+       hash_prog=md5sum
+elif which md5 > /dev/null 2>&1; then
+       hash_prog=md5
+else    
+       echo "$me: can't find a suitable hash program" >&2
+       exit 1
+fi
+
+[ "$1" = '-v' ] && verbose=1 || verbose=''
+
+temp1="`mktemp "ignoreip-update-$$-1-XXXXXX"`"
+temp2="`mktemp "ignoreip-update-$$-2-XXXXXX"`"
+trap 'rm -f "$temp1" "$temp2"' EXIT
+
+## Generate random name
+#rand="`dd if=/dev/urandom bs=16 count=1 2> /dev/null | "$hash_prog"`"
+
+# Do lookups on random addresses; break into one addres/line; remove
+# empty lines
+for stupid_tld in $stupid_tlds; do
+       dnsip "$rand.$stupid_tld"
+       #dnsip "*.$stupid_tld"
+done | xargs -n 1 echo | grep '.' > "$temp1"
+
+# Abort if there were no new bogus addresses
+[ ! -s "$temp1" ] && exit
+
+# Remove duplicates (from old list and, eg, .sh/.tm)
+touch "$ignoreip"
+sort "$ignoreip" "$temp1" | uniq > "$temp2"
+
+if [ "$verbose" ]; then
+       diff -u "$ignoreip" "$temp2" || true
+fi
+
+# Update list and restart dnscache
+chmod 644 "$temp2"
+mv "$temp2" "$ignoreip"
+#svc -t .
+
diff --git a/net/djbdns/files/dnscache/servers/@ b/net/djbdns/files/dnscache/servers/@
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/net/djbdns/files/dnsqrx b/net/djbdns/files/dnsqrx
new file mode 100644 (file)
index 0000000..3202e94
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+# (c) Copyright 2003-2003 Jonathan de Boyne Pollard. All rights reserved. "Moral" rights asserted.
+# Permission is hereby granted to distribute this script unmodified.
+# This script requires the patch that changes the ${DNSCACHEIP} separator, which can be found at <URL:http://homepages.tesco.net./~J.deBoynePollard/Softwares/djbdns.html>.
+t=${1?Missing type}
+n=${2?Missing name}
+s=${3?Missing server}
+i=`dnsip $s`
+DNSCACHEIP=${i:?Bad server name} dnsqr $t $n
diff --git a/net/djbdns/files/dnsroots-update b/net/djbdns/files/dnsroots-update
new file mode 100644 (file)
index 0000000..29ffc16
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# This is a script that outputs the current list of active DNS
+# root servers. To run, it requires an active internet connection
+# and a working resolving DNS server. It also requires that the
+# djbdns dnstools be installed, or at least the tools dnsqr and
+# dnsip.
+
+dnsqr ns .|grep answer|cut -f 5 -d " "|sort|while read server; do dnsip $server; done
diff --git a/net/djbdns/files/rbldns.init b/net/djbdns/files/rbldns.init
new file mode 100644 (file)
index 0000000..dfe98f4
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+#
+# version 20090401 jhalfmoon
+
+START=46
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/rbldns
+NAME=rbldns
+DESC="Reverse DNS wall"
+
+ROOT=/tmp/rbldns
+
+start() {
+    echo "Starting $DESC: $NAME"
+    config_load djbdns
+    config_foreach get_userids global
+    rm -rf $ROOT
+    mkdir -p $ROOT
+    ln -fs /etc/rbldns/data $ROOT/data
+    cd $ROOT
+    rbldns-data
+    chown -R $UID:$GID $ROOT
+    config_foreach start_daemon rbldns
+}
+
+get_userids() {
+    local cfg="$1"
+    config_get UID "$cfg" runasuser
+    config_get GID "$cfg" runasgroup
+    UID=`id -u $UID`
+    GID=`id -g $GID`
+}
+
+start_daemon() {
+    local cfg="$1"
+    config_get logging "$cfg" logging
+    config_get iface   "$cfg" interface
+    config_get BASE    "$cfg" base
+# Unset BASE if it is empty
+    [ -z $BASE ] && export -n BASE
+# Translate listening interfaces to ip addresses
+    . /lib/functions/network.sh
+    network_get_ipaddr IP "$iface"
+    export ROOT
+    if [ "$DEBUG" == 1 ] ; then
+            $DAEMON
+    elif [ "$logging" == '1' ] ; then
+        $DAEMON 2>&1 | logger -p local1.info -t $NAME &
+    else
+        $DAEMON > /dev/null 2>&1 &
+    fi
+}
+
+stop() {
+    echo -n "Stopping $DESC: $NAME"
+    kill `pidof $NAME|sed "s/$$//g"` > /dev/null 2>&1
+    echo " ."
+}
+
+restart() {
+    echo "Restarting $DESC: $NAME... "
+    stop
+    sleep 2
+    start
+}
+
diff --git a/net/djbdns/files/rbldns/data b/net/djbdns/files/rbldns/data
new file mode 100644 (file)
index 0000000..85aae01
--- /dev/null
@@ -0,0 +1,5 @@
+#example rdldns data file
+1.2.4.8
+10.0.0.1
+192.168.0.0/16
+:127.0.0.1:www.somesite.com
diff --git a/net/djbdns/files/tinydns.init b/net/djbdns/files/tinydns.init
new file mode 100644 (file)
index 0000000..bff119d
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+#
+# version 20090401 jhalfmoon
+
+START=46
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/tinydns
+NAME=tinydns
+DESC="Authoritative nameserver"
+
+ROOT=/tmp/tinydns
+
+start() {
+    echo "Starting $DESC: $NAME"
+    config_load djbdns
+    config_foreach get_userids global
+    mkdir -p $ROOT
+    ln -sf /etc/tinydns/data $ROOT/data
+    cd $ROOT
+    tinydns-data
+    chown -R $UID:$GID $ROOT
+    config_foreach start_daemon tinydns
+}
+
+get_userids() {
+    local cfg="$1"
+    config_get UID "$cfg" runasuser
+    config_get GID "$cfg" runasgroup
+    UID=`id -u $UID`
+    GID=`id -g $GID`
+}
+
+start_daemon() {
+    local cfg="$1"
+    config_get logging "$cfg" logging
+    config_get iface   "$cfg" interface
+# Translate listening interfaces to ip addresses
+    . /lib/functions/network.sh
+    network_get_ipaddr IP "$iface"
+    export ROOT
+    if [ "$DEBUG" == 1 ] ; then
+        $DAEMON
+    elif [ "$logging" == '1' ] ; then
+        $DAEMON 2>&1 | logger -p local1.info -t $NAME &
+    else
+        $DAEMON > /dev/null 2>&1 &
+    fi
+}
+
+stop() {
+    echo -n "Stopping $DESC: $NAME"
+    kill `pidof $NAME|sed "s/$$//g"` > /dev/null 2>&1
+    echo " ."
+}
+
+restart() {
+    echo "Restarting $DESC: $NAME... "
+    stop
+    sleep 2
+    start
+}
+
diff --git a/net/djbdns/files/tinydns/add-alias b/net/djbdns/files/tinydns/add-alias
new file mode 100644 (file)
index 0000000..eada7a0
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/local/bin/tinydns-edit data data.new add alias ${1+"$@"}
diff --git a/net/djbdns/files/tinydns/add-childns b/net/djbdns/files/tinydns/add-childns
new file mode 100644 (file)
index 0000000..4114b3e
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/local/bin/tinydns-edit data data.new add childns ${1+"$@"}
diff --git a/net/djbdns/files/tinydns/add-host b/net/djbdns/files/tinydns/add-host
new file mode 100644 (file)
index 0000000..9c61b4e
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/local/bin/tinydns-edit data data.new add host ${1+"$@"}
diff --git a/net/djbdns/files/tinydns/add-mx b/net/djbdns/files/tinydns/add-mx
new file mode 100644 (file)
index 0000000..c31a37f
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/local/bin/tinydns-edit data data.new add mx ${1+"$@"}
diff --git a/net/djbdns/files/tinydns/add-ns b/net/djbdns/files/tinydns/add-ns
new file mode 100644 (file)
index 0000000..b35d2b0
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/local/bin/tinydns-edit data data.new add ns ${1+"$@"}
diff --git a/net/djbdns/files/tinydns/data b/net/djbdns/files/tinydns/data
new file mode 100644 (file)
index 0000000..001311e
--- /dev/null
@@ -0,0 +1,59 @@
+# example verbose tinydns data file
+# from http://www.pjvenda.org/linux/doc/tinydns/
+# Copyright (C) 2001-2009 by Pedro Venda
+# licensed under a Creative Commons Attribution 2.5 License
+#
+# REVERSE ZONE
+#
+# (reverse) dns servers: primary and secondary
+Z45.168.192.in-addr.arpa:ns.example.net:hostmaster.example.net::::::::
+
+# NS records
+&45.168.192.in-addr.arpa::ns.example.net:::
+&45.168.192.in-addr.arpa::ns2.example.net:::
+
+# MX handlers
+@45.168.192.in-addr.arpa::relay.example.net:10
+@45.168.192.in-addr.arpa::relay2.example.net:20
+
+#
+# FORWARD ZONE:
+#
+# SOA record: primary nameserver is ns.example.net and hostmaster
+#             mail address is hostmaster@example.net
+#             (the 'Z' configuration line is the only one that
+#             allows specifying the hostmaster mail address)
+Zexample.net:ns.example.net:hostmaster.example.net::::::::
+
+# NS records: primary and secondary nameservers
+&example.net::ns.example.net:::
+&example.net::ns2.example.net:::
+
+# MX records: relay.example.net, distance = 10
+#             relay2.example.net, distance = 20
+@example.net::relay.example.net:10
+@example.net::relay2.example.net:20
+
+# A records: ns.example.net, ns2.example.net
+=ns.example.net:192.168.45.1:::
+=ns2.example.net:192.168.45.2:::
+
+# PTR records: relays are in the same hosts as dns servers
++relay.example.net:192.168.45.1:::
++relay2.example.net:192.168.45.2:::
+
+# more A records: gateway.example.net
+=gateway.example.net:192.168.45.254:::
+
+# CNAME record: nscache.example.net is alias to gateway.example.net
+Cnscache.example.net:gateway.example.net:::
+
+#
+# SUB DOMAIN DELEGATION
+#
+
+# NS record
+&dmz.example.net::ns.dmz.example.net:::
+
+# A/PTR record for nameserver
+=ns.dmz.example.net:192.168.90.1:::
diff --git a/net/djbdns/files/walldns.init b/net/djbdns/files/walldns.init
new file mode 100644 (file)
index 0000000..9d4f773
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+#
+# version 20090401 jhalfmoon
+
+START=46
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/walldns
+NAME=walldns
+DESC="Reverse DNS wall"
+
+ROOT=/tmp/walldns
+
+start() {
+    echo "Starting $DESC: $NAME"
+    config_load djbdns
+    config_foreach get_userids global
+    rm -rf $ROOT
+    mkdir -p $ROOT
+    chown -R $UID:$GID $ROOT
+    config_foreach start_daemon walldns
+}
+
+get_userids() {
+    local cfg="$1"
+    config_get UID "$cfg" runasuser
+    config_get GID "$cfg" runasgroup
+    UID=`id -u $UID`
+    GID=`id -g $GID`
+}
+
+start_daemon() {
+    local cfg="$1"
+    config_get logging "$cfg" logging
+    config_get iface   "$cfg" interface
+# Translate listening interfaces to ip addresses
+    . /lib/functions/network.sh
+    network_get_ipaddr IP "$iface"
+    export ROOT
+    if [ "$DEBUG" == 1 ] ; then
+        $DAEMON
+    elif [ "$logging" == '1' ] ; then
+        $DAEMON 2>&1 | logger -p local1.info -t $NAME &
+    else
+        $DAEMON > /dev/null 2>&1 &
+    fi
+}
+
+stop() {
+    echo -n "Stopping $DESC: $NAME"
+    kill `pidof $NAME|sed "s/$$//g"` > /dev/null 2>&1
+    echo " ."
+}
+
+restart() {
+    echo "Restarting $DESC: $NAME... "
+    stop
+    sleep 2
+    start
+}
+
diff --git a/net/djbdns/patches/010-crosscompile.patch b/net/djbdns/patches/010-crosscompile.patch
new file mode 100644 (file)
index 0000000..68ce1c3
--- /dev/null
@@ -0,0 +1,170 @@
+--- a/Makefile
++++ b/Makefile
+@@ -29,10 +29,6 @@ auto-str.o: \
+ compile auto-str.c buffer.h exit.h
+       ./compile auto-str.c
+-auto_home.c: \
+-auto-str conf-home
+-      ./auto-str auto_home `head -1 conf-home` > auto_home.c
+-
+ auto_home.o: \
+ compile auto_home.c
+       ./compile auto_home.c
+@@ -221,10 +217,6 @@ compile dd.c dns.h stralloc.h gen_alloc.
+ uint64.h taia.h dd.h
+       ./compile dd.c
+-direntry.h: \
+-choose compile trydrent.c direntry.h1 direntry.h2
+-      ./choose c trydrent direntry.h1 direntry.h2 > direntry.h
+-
+ dns.a: \
+ makelib dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o dns_ipq.o dns_mx.o \
+ dns_name.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o dns_rcrw.o \
+@@ -508,12 +500,6 @@ systype hasdevtcp.h1 hasdevtcp.h2
+         *) cat hasdevtcp.h1 ;; \
+       esac ) > hasdevtcp.h
+-hasshsgr.h: \
+-choose compile load tryshsgr.c hasshsgr.h1 hasshsgr.h2 chkshsgr \
+-warn-shsgr
+-      ./chkshsgr || ( cat warn-shsgr; exit 1 )
+-      ./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h
+-
+ hier.o: \
+ compile hier.c auto_home.h
+       ./compile hier.c
+@@ -534,10 +520,6 @@ instcheck.o: \
+ compile instcheck.c strerr.h error.h exit.h
+       ./compile instcheck.c
+-iopause.h: \
+-choose compile load trypoll.c iopause.h1 iopause.h2
+-      ./choose clr trypoll iopause.h1 iopause.h2 > iopause.h
+-
+ iopause.o: \
+ compile iopause.c taia.h tai.h uint64.h select.h iopause.h taia.h
+       ./compile iopause.c
+@@ -590,7 +572,7 @@ warn-auto.sh systype
+       dgux-*) ;; \
+       hp-ux-*) ;; \
+       sco*) ;; \
+-      *) echo 'ranlib "$$main"' ;; \
++      *) echo '$(if $(TARGET_RANLIB),$(TARGET_RANLIB),ranlib) "$$main"' ;; \
+       esac \
+       ) > makelib
+       chmod 755 makelib
+@@ -766,10 +748,6 @@ seek_set.o: \
+ compile seek_set.c seek.h
+       ./compile seek_set.c
+-select.h: \
+-choose compile trysysel.c select.h1 select.h2
+-      ./choose c trysysel select.h1 select.h2 > select.h
+-
+ server.o: \
+ compile server.c byte.h case.h env.h buffer.h strerr.h ip4.h uint16.h \
+ ndelay.h socket.h uint16.h droproot.h qlog.h uint16.h response.h \
+@@ -1060,10 +1038,6 @@ uint32_unpack.o: \
+ compile uint32_unpack.c uint32.h
+       ./compile uint32_unpack.c
+-uint64.h: \
+-choose compile load tryulong64.c uint64.h1 uint64.h2
+-      ./choose clr tryulong64 uint64.h1 uint64.h2 > uint64.h
+-
+ unix.a: \
+ makelib buffer_read.o buffer_write.o error.o error_str.o ndelay_off.o \
+ ndelay_on.o open_read.o open_trunc.o openreadclose.o readclose.o \
+--- /dev/null
++++ b/auto_home.c
+@@ -0,0 +1,3 @@
++const char auto_home[] = "\
++\057\165\163\162\
++";
+--- a/conf-cc
++++ b/conf-cc
+@@ -1,3 +1,3 @@
+-gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings
++$TARGET_CC $TARGET_CFLAGS -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -include errno.h
+ This will be used to compile .c files.
+--- a/conf-home
++++ b/conf-home
+@@ -1,4 +1,4 @@
+-/usr/local
++/usr
+ This is the dnscache home directory. Programs will be installed in
+ .../bin.
+--- a/conf-ld
++++ b/conf-ld
+@@ -1,3 +1,3 @@
+-gcc -s
++$TARGET_CC -s $TARGET_LDFLAGS
+ This will be used to link .o files into an executable.
+--- /dev/null
++++ b/direntry.h
+@@ -0,0 +1,10 @@
++#ifndef DIRENTRY_H
++#define DIRENTRY_H
++
++/* sysdep: +dirent */
++
++#include <sys/types.h>
++#include <dirent.h>
++#define direntry struct dirent
++
++#endif
+--- /dev/null
++++ b/hasshsgr.h
+@@ -0,0 +1 @@
++/* sysdep: -shortsetgroups */
+--- /dev/null
++++ b/iopause.h
+@@ -0,0 +1,18 @@
++#ifndef IOPAUSE_H
++#define IOPAUSE_H
++
++/* sysdep: +poll */
++#define IOPAUSE_POLL
++
++#include <sys/types.h>
++#include <poll.h>
++
++typedef struct pollfd iopause_fd;
++#define IOPAUSE_READ POLLIN
++#define IOPAUSE_WRITE POLLOUT
++
++#include "taia.h"
++
++extern void iopause(iopause_fd *,unsigned int,struct taia *,struct taia *);
++
++#endif
+--- /dev/null
++++ b/select.h
+@@ -0,0 +1,11 @@
++#ifndef SELECT_H
++#define SELECT_H
++
++/* sysdep: +sysselect */
++
++#include <sys/types.h>
++#include <sys/time.h>
++#include <sys/select.h>
++extern int select();
++
++#endif
+--- /dev/null
++++ b/uint64.h
+@@ -0,0 +1,8 @@
++#ifndef UINT64_H
++#define UINT64_H
++
++/* sysdep: -ulong64 */
++
++typedef unsigned long long uint64;
++
++#endif
diff --git a/net/djbdns/patches/020-dnsroots-update.patch b/net/djbdns/patches/020-dnsroots-update.patch
new file mode 100644 (file)
index 0000000..ce5b863
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/dnsroots.global
++++ b/dnsroots.global
+@@ -1,5 +1,5 @@
+ 198.41.0.4
+-128.9.0.107
++192.228.79.201
+ 192.33.4.12
+ 128.8.10.90
+ 192.203.230.10
+@@ -7,7 +7,7 @@
+ 192.112.36.4
+ 128.63.2.53
+ 192.36.148.17
+-198.41.0.10
++192.58.128.30
+ 193.0.14.129
+-198.32.64.12
++199.7.83.42
+ 202.12.27.33
diff --git a/net/djbdns/patches/030-srv-records-and-axfrget.patch b/net/djbdns/patches/030-srv-records-and-axfrget.patch
new file mode 100644 (file)
index 0000000..1d16380
--- /dev/null
@@ -0,0 +1,135 @@
+From: Michael Handler <handler@sub-rosa.com>
+To: dns@list.cr.yp.to
+Subject: tinydns-data SRV & axfr-get SRV/PTR patches
+Date: Thu, 14 Sep 2000 20:37:50 -0400
+
+Here's a combined patch that:
+
+a) adds a native SRV type to tinydns-data
+
+Sfqdn:ip:x:port:weight:priority:ttl:timestamp
+
+Standard rules for ip, x, ttl, and timestamp apply. Port, weight, and
+priority all range from 0-65535. Weight and priority are optional; they
+default to zero if not provided.
+
+Sconsole.zoinks.example.com:1.2.3.4:rack102-con1:2001:69:7:300:
+
+b) makes axfr-get decompose SRV and PTR records and write them out in
+native format, rather than opaque. Again, this is necessary because if the
+DNAME fields in the records reference the same zone as fqdn, they can have
+compression pointers that are bogus outside the context of that specific
+packet, and which can't be correctly loaded into data.cdb by tinydns-data.
+
+--michael
+
+Laurent G. Bercot <ska-djbdns@skarnet.org> updated it for djbdns-1.05:
+
+--- a/axfr-get.c
++++ b/axfr-get.c
+@@ -209,6 +209,26 @@ unsigned int doit(char *buf,unsigned int
+     if (!stralloc_cats(&line,".:")) return 0;
+     if (!stralloc_catulong0(&line,dist,0)) return 0;
+   }
++  else if (byte_equal(data,2,DNS_T_SRV)) {
++    uint16 dist, weight, port;
++    if (!stralloc_copys(&line,"S")) return 0;
++    if (!dns_domain_todot_cat(&line,d1)) return 0;
++    if (!stralloc_cats(&line,"::")) return 0;
++    pos = x_copy(buf,len,pos,data,2);
++    uint16_unpack_big(data,&dist);
++    pos = x_copy(buf,len,pos,data,2);
++    uint16_unpack_big(data,&weight);
++    pos = x_copy(buf,len,pos,data,2);
++    uint16_unpack_big(data,&port);
++    x_getname(buf,len,pos,&d1);
++    if (!dns_domain_todot_cat(&line,d1)) return 0;
++    if (!stralloc_cats(&line,".:")) return 0;
++    if (!stralloc_catulong0(&line,dist,0)) return 0;
++    if (!stralloc_cats(&line,":")) return 0;
++    if (!stralloc_catulong0(&line,weight,0)) return 0;
++    if (!stralloc_cats(&line,":")) return 0;
++    if (!stralloc_catulong0(&line,port,0)) return 0;
++  }
+   else if (byte_equal(data,2,DNS_T_A) && (dlen == 4)) {
+     char ipstr[IP4_FMT];
+     if (!stralloc_copys(&line,"+")) return 0;
+@@ -217,6 +237,14 @@ unsigned int doit(char *buf,unsigned int
+     x_copy(buf,len,pos,data,4);
+     if (!stralloc_catb(&line,ipstr,ip4_fmt(ipstr,data))) return 0;
+   }
++  else if (byte_equal(data,2,DNS_T_PTR)) {
++    if (!stralloc_copys(&line,"^")) return 0;
++    if (!dns_domain_todot_cat(&line,d1)) return 0;
++    if (!stralloc_cats(&line,":")) return 0;
++    x_getname(buf,len,pos,&d1);
++    if (!dns_domain_todot_cat(&line,d1)) return 0;
++    if (!stralloc_cats(&line,".")) return 0;
++  }
+   else {
+     unsigned char ch;
+     unsigned char ch2;
+--- a/dns.h
++++ b/dns.h
+@@ -20,6 +20,7 @@
+ #define DNS_T_SIG "\0\30"
+ #define DNS_T_KEY "\0\31"
+ #define DNS_T_AAAA "\0\34"
++#define DNS_T_SRV "\0\41"
+ #define DNS_T_AXFR "\0\374"
+ #define DNS_T_ANY "\0\377"
+--- a/tinydns-data.c
++++ b/tinydns-data.c
+@@ -196,6 +196,7 @@ int main()
+   char type[2];
+   char soa[20];
+   char buf[4];
++  char srv[6];
+   umask(022);
+@@ -369,6 +370,43 @@ int main()
+         rr_finish(d2);
+       }
+       break;
++      
++      case 'S':
++      if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
++      if (!stralloc_0(&f[6])) nomem();
++      if (!scan_ulong(f[6].s,&ttl)) ttl = TTL_POSITIVE;
++      ttdparse(&f[7],ttd);
++      locparse(&f[8],loc);
++
++      if (!stralloc_0(&f[1])) nomem();
++
++      if (byte_chr(f[2].s,f[2].len,'.') >= f[2].len) {
++        if (!stralloc_cats(&f[2],".srv.")) nomem();
++        if (!stralloc_catb(&f[2],f[0].s,f[0].len)) nomem();
++      }
++      if (!dns_domain_fromdot(&d2,f[2].s,f[2].len)) nomem();
++
++      if (!stralloc_0(&f[4])) nomem();
++      if (!scan_ulong(f[4].s,&u)) u = 0;
++      uint16_pack_big(srv,u);
++      if (!stralloc_0(&f[5])) nomem();
++      if (!scan_ulong(f[5].s,&u)) u = 0;
++      uint16_pack_big(srv + 2,u);
++      if (!stralloc_0(&f[3])) nomem();
++      if (!scan_ulong(f[3].s,&u)) nomem();
++      uint16_pack_big(srv + 4,u);
++
++      rr_start(DNS_T_SRV,ttl,ttd,loc);
++      rr_add(srv,6);
++      rr_addname(d2);
++      rr_finish(d1);
++
++      if (ip4_scan(f[1].s,ip)) {
++        rr_start(DNS_T_A,ttl,ttd,loc);
++        rr_add(ip,4);
++        rr_finish(d2);
++      }
++      break;
+       case '^': case 'C':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
diff --git a/net/djbdns/patches/040-dnscache-less-chatty-log.patch b/net/djbdns/patches/040-dnscache-less-chatty-log.patch
new file mode 100644 (file)
index 0000000..9a881c9
--- /dev/null
@@ -0,0 +1,39 @@
+--- a/log.h
++++ b/log.h
+@@ -1,6 +1,8 @@
+ #ifndef LOG_H
+ #define LOG_H
++#define STATS_DISPLAY_INTERVAL 5
++
+ #include "uint64.h"
+ extern void log_startup(void);
+--- a/log.c
++++ b/log.c
+@@ -1,6 +1,7 @@
+ #include "buffer.h"
+ #include "uint32.h"
+ #include "uint16.h"
++#include "time.h"
+ #include "error.h"
+ #include "byte.h"
+ #include "log.h"
+@@ -274,11 +275,17 @@ void log_rrsoa(const char server[4],cons
+ void log_stats(void)
+ {
++  static time_t prev = 0;
++  time_t cur = time(NULL);
+   extern uint64 numqueries;
+   extern uint64 cache_motion;
+   extern int uactive;
+   extern int tactive;
++  if(prev == 0) prev = time(NULL);
++  if(cur - prev < STATS_DISPLAY_INTERVAL) return;
++  prev = cur;
++
+   string("stats ");
+   number(numqueries); space();
+   number(cache_motion); space();
diff --git a/net/djbdns/patches/050-tinydns-mmap-leak.patch b/net/djbdns/patches/050-tinydns-mmap-leak.patch
new file mode 100644 (file)
index 0000000..1885612
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/tdlookup.c
++++ b/tdlookup.c
+@@ -298,9 +298,17 @@ int respond(char *q,char qtype[2],char i
+   if (!r) r = cdb_find(&c,key,4);
+   if (!r) r = cdb_find(&c,key,3);
+   if (!r) r = cdb_find(&c,key,2);
+-  if (r == -1) return 0;
++  if (r == -1) {
++    cdb_free(&c);
++    close(fd);
++    return 0;
++  }
+   if (r && (cdb_datalen(&c) == 2))
+-    if (cdb_read(&c,clientloc,2,cdb_datapos(&c)) == -1) return 0;
++    if (cdb_read(&c,clientloc,2,cdb_datapos(&c)) == -1) {
++      cdb_free(&c);
++      close(fd);
++      return 0;
++    }
+   r = doit(q,qtype);
diff --git a/net/djbdns/patches/060-dnscache-big-udp-packets.patch b/net/djbdns/patches/060-dnscache-big-udp-packets.patch
new file mode 100644 (file)
index 0000000..8f2c142
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/dns_transmit.c
++++ b/dns_transmit.c
+@@ -240,7 +240,7 @@ void dns_transmit_io(struct dns_transmit
+ int dns_transmit_get(struct dns_transmit *d,const iopause_fd *x,const struct taia *when)
+ {
+-  char udpbuf[513];
++  char udpbuf[4097];
+   unsigned char ch;
+   int r;
+   int fd;
diff --git a/net/djbdns/patches/070-dnscache-dpos-tcp-servfail.patch b/net/djbdns/patches/070-dnscache-dpos-tcp-servfail.patch
new file mode 100644 (file)
index 0000000..8d30d5e
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/dns_transmit.c
++++ b/dns_transmit.c
+@@ -166,6 +166,7 @@ static int thistcp(struct dns_transmit *
+       taia_uint(&d->deadline,10);
+       taia_add(&d->deadline,&d->deadline,&now);
+       if (socket_connect4(d->s1 - 1,ip,53) == 0) {
++        d->pos = 0;
+         d->tcpstate = 2;
+         return 0;
+       }
diff --git a/net/djbdns/patches/080-dnscache-cache-negatives.patch b/net/djbdns/patches/080-dnscache-cache-negatives.patch
new file mode 100644 (file)
index 0000000..793ac87
--- /dev/null
@@ -0,0 +1,41 @@
+--- a/query.c
++++ b/query.c
+@@ -193,6 +193,7 @@ static int doit(struct query *z,int stat
+   int k;
+   int p;
+   int q;
++  uint32 cachettl;
+   errno = error_io;
+   if (state == 1) goto HAVEPACKET;
+@@ -470,6 +471,7 @@ static int doit(struct query *z,int stat
+   rcode = header[3] & 15;
+   if (rcode && (rcode != 3)) goto DIE; /* impossible; see irrelevant() */
++  cachettl = 0;
+   flagout = 0;
+   flagcname = 0;
+   flagreferral = 0;
+@@ -512,6 +514,11 @@ static int doit(struct query *z,int stat
+     uint16_unpack_big(header + 8,&datalen);
+     pos += datalen;
++
++    if (flagsoa && (pos <= len)) {
++      cachettl = ttlget(buf + pos - 4);
++      if (soattl < cachettl) cachettl = soattl;
++    }
+   }
+   posglue = pos;
+@@ -689,8 +696,8 @@ static int doit(struct query *z,int stat
+   }
+   if (rcode == 3) {
+-    log_nxdomain(whichserver,d,soattl);
+-    cachegeneric(DNS_T_ANY,d,"",0,soattl);
++    log_nxdomain(whichserver,d,cachettl);
++    cachegeneric(DNS_T_ANY,d,"",0,cachettl);
+     NXDOMAIN:
+     if (z->level) goto LOWERLEVEL;
diff --git a/net/djbdns/patches/090-tinydns-one-second.patch b/net/djbdns/patches/090-tinydns-one-second.patch
new file mode 100644 (file)
index 0000000..660bbcb
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/tdlookup.c
++++ b/tdlookup.c
+@@ -280,15 +280,24 @@ static int doit(char *q,char qtype[2])
+ int respond(char *q,char qtype[2],char ip[4])
+ {
+-  int fd;
++  static struct tai cdb_valid = { 0 };
++  static int fd = -1;
++  struct tai one_second;
+   int r;
+   char key[6];
+   tai_now(&now);
+-  fd = open_read("data.cdb");
+-  if (fd == -1) return 0;
+-  cdb_init(&c,fd);
+-
++  if (tai_less(&cdb_valid, &now)) {
++    if (fd != -1) {
++      cdb_free(&c);
++      close(fd);
++    }
++    fd = open_read("data.cdb");
++    if (fd == -1) return 0;
++    cdb_init(&c,fd);
++    tai_uint(&one_second, 1);
++    tai_add(&cdb_valid, &now, &one_second);
++  }
+   byte_zero(clientloc,2);
+   key[0] = 0;
+   key[1] = '%';
+@@ -312,7 +321,5 @@ int respond(char *q,char qtype[2],char i
+   r = doit(q,qtype);
+-  cdb_free(&c);
+-  close(fd);
+   return r;
+ }
diff --git a/net/djbdns/patches/110-dnscache-cachestats.patch b/net/djbdns/patches/110-dnscache-cachestats.patch
new file mode 100644 (file)
index 0000000..5404719
--- /dev/null
@@ -0,0 +1,89 @@
+#
+# This patch to djbdns 1.05 modifies the dnscache program to keep a
+# counter of cache hits and cache misses.
+#
+# Two new fields are added to the ``stats'' output line:
+#  . the fifth number is the number of cache hits
+#  . the sixth number is the number of cache misses
+# e.g.
+#  @400000003fa92ccc317d70f4 stats 3 1201 1 0 21 49
+# indicates 21 hits and 49 misses.
+#
+# James Raftery <james@now.ie>  6 Nov. 2003
+#
+--- a/cache.c
++++ b/cache.c
+@@ -7,6 +7,11 @@
+ uint64 cache_motion = 0;
++/* record cache stats */
++/* James Raftery <james@now.ie> 6 Nov. 2003 */
++uint64 cache_hit = 0;
++uint64 cache_miss = 0;
++
+ static char *x = 0;
+ static uint32 size;
+ static uint32 hsize;
+@@ -112,15 +117,20 @@ char *cache_get(const char *key,unsigned
+         if (u > size - pos - 20 - keylen) cache_impossible();
+         *datalen = u;
++        cache_hit++;
+         return x + pos + 20 + keylen;
+       }
+     }
+     nextpos = prevpos ^ get4(pos);
+     prevpos = pos;
+     pos = nextpos;
+-    if (++loop > 100) return 0; /* to protect against hash flooding */
++    if (++loop > 100) { /* to protect against hash flooding */
++      cache_miss++;
++      return 0;
++    }
+   }
++  cache_miss++;
+   return 0;
+ }
+--- a/cache.h
++++ b/cache.h
+@@ -5,6 +5,12 @@
+ #include "uint64.h"
+ extern uint64 cache_motion;
++
++/* record cache stats */
++/* James Raftery <james@now.ie> 6 Nov. 2003 */
++extern uint64 cache_hit;
++extern uint64 cache_miss;
++
+ extern int cache_init(unsigned int);
+ extern void cache_set(const char *,unsigned int,const char *,unsigned int,uint32);
+ extern char *cache_get(const char *,unsigned int,unsigned int *,uint32 *);
+--- a/log.c
++++ b/log.c
+@@ -279,6 +279,12 @@ void log_stats(void)
+   time_t cur = time(NULL);
+   extern uint64 numqueries;
+   extern uint64 cache_motion;
++
++  /* record cache stats */
++  /* James Raftery <james@now.ie> 6 Nov. 2003 */
++  extern uint64 cache_hit;
++  extern uint64 cache_miss;
++
+   extern int uactive;
+   extern int tactive;
+@@ -290,6 +296,8 @@ void log_stats(void)
+   number(numqueries); space();
+   number(cache_motion); space();
+   number(uactive); space();
+-  number(tactive);
++  number(tactive); space();
++  number(cache_hit); space();
++  number(cache_miss);
+   line();
+ }
diff --git a/net/djbdns/patches/120-compiler-temporary-filename.patch b/net/djbdns/patches/120-compiler-temporary-filename.patch
new file mode 100644 (file)
index 0000000..324116d
--- /dev/null
@@ -0,0 +1,93 @@
+--- a/pickdns-data.c
++++ b/pickdns-data.c
+@@ -123,7 +123,7 @@ void syntaxerror(const char *why)
+ }
+ void die_datatmp(void)
+ {
+-  strerr_die2sys(111,FATAL,"unable to create data.tmp: ");
++  strerr_die2sys(111,FATAL,"unable to create data.cdb.tmp: ");
+ }
+ int main()
+@@ -142,7 +142,7 @@ int main()
+   if (fd == -1) strerr_die2sys(111,FATAL,"unable to open data: ");
+   buffer_init(&b,buffer_unixread,fd,bspace,sizeof bspace);
+-  fdcdb = open_trunc("data.tmp");
++  fdcdb = open_trunc("data.cdb.tmp");
+   if (fdcdb == -1) die_datatmp();
+   if (cdb_make_start(&cdb,fdcdb) == -1) die_datatmp();
+@@ -223,8 +223,8 @@ int main()
+   if (cdb_make_finish(&cdb) == -1) die_datatmp();
+   if (fsync(fdcdb) == -1) die_datatmp();
+   if (close(fdcdb) == -1) die_datatmp(); /* NFS stupidity */
+-  if (rename("data.tmp","data.cdb") == -1)
+-    strerr_die2sys(111,FATAL,"unable to move data.tmp to data.cdb: ");
++  if (rename("data.cdb.tmp","data.cdb") == -1)
++    strerr_die2sys(111,FATAL,"unable to move data.cdb.tmp to data.cdb: ");
+   _exit(0);
+ }
+--- a/rbldns-data.c
++++ b/rbldns-data.c
+@@ -42,7 +42,7 @@ void syntaxerror(const char *why)
+ }
+ void die_datatmp(void)
+ {
+-  strerr_die2sys(111,FATAL,"unable to create data.tmp: ");
++  strerr_die2sys(111,FATAL,"unable to create data.cdb.tmp: ");
+ }
+ int main()
+@@ -59,7 +59,7 @@ int main()
+   if (fd == -1) strerr_die2sys(111,FATAL,"unable to open data: ");
+   buffer_init(&b,buffer_unixread,fd,bspace,sizeof bspace);
+-  fdcdb = open_trunc("data.tmp");
++  fdcdb = open_trunc("data.cdb.tmp");
+   if (fdcdb == -1) die_datatmp();
+   if (cdb_make_start(&cdb,fdcdb) == -1) die_datatmp();
+@@ -121,8 +121,8 @@ int main()
+   if (cdb_make_finish(&cdb) == -1) die_datatmp();
+   if (fsync(fdcdb) == -1) die_datatmp();
+   if (close(fdcdb) == -1) die_datatmp(); /* NFS stupidity */
+-  if (rename("data.tmp","data.cdb") == -1)
+-    strerr_die2sys(111,FATAL,"unable to move data.tmp to data.cdb: ");
++  if (rename("data.cdb.tmp","data.cdb") == -1)
++    strerr_die2sys(111,FATAL,"unable to move data.cdb.tmp to data.cdb: ");
+   _exit(0);
+ }
+--- a/tinydns-data.c
++++ b/tinydns-data.c
+@@ -27,7 +27,7 @@
+ void die_datatmp(void)
+ {
+-  strerr_die2sys(111,FATAL,"unable to create data.tmp: ");
++  strerr_die2sys(111,FATAL,"unable to create data.cdb.tmp: ");
+ }
+ void nomem(void)
+ {
+@@ -207,7 +207,7 @@ int main()
+   buffer_init(&b,buffer_unixread,fddata,bspace,sizeof bspace);
+-  fdcdb = open_trunc("data.tmp");
++  fdcdb = open_trunc("data.cdb.tmp");
+   if (fdcdb == -1) die_datatmp();
+   if (cdb_make_start(&cdb,fdcdb) == -1) die_datatmp();
+@@ -487,8 +487,8 @@ int main()
+   if (cdb_make_finish(&cdb) == -1) die_datatmp();
+   if (fsync(fdcdb) == -1) die_datatmp();
+   if (close(fdcdb) == -1) die_datatmp(); /* NFS stupidity */
+-  if (rename("data.tmp","data.cdb") == -1)
+-    strerr_die2sys(111,FATAL,"unable to move data.tmp to data.cdb: ");
++  if (rename("data.cdb.tmp","data.cdb") == -1)
++    strerr_die2sys(111,FATAL,"unable to move data.cdb.tmp to data.cdb: ");
+   _exit(0);
+ }
diff --git a/net/djbdns/patches/140-dnsnamex-extra-command.patch b/net/djbdns/patches/140-dnsnamex-extra-command.patch
new file mode 100644 (file)
index 0000000..6a8cafe
--- /dev/null
@@ -0,0 +1,156 @@
+--- /dev/null
++++ b/dnsnamex.c
+@@ -0,0 +1,34 @@
++#include "buffer.h"
++#include "exit.h"
++#include "strerr.h"
++#include "ip4.h"
++#include "dns.h"
++
++#define FATAL "dnsnamex: fatal: "
++
++static char seed[128];
++
++char ip[4];
++static stralloc out;
++
++int main(int argc,char **argv)
++{
++  dns_random_init(seed);
++
++  if (*argv) ++argv;
++
++  while (*argv) {
++    if (!ip4_scan(*argv,ip))
++      strerr_die3x(111,FATAL,"unable to parse IP address ",*argv);
++    if (dns_name4_multi(&out,ip) == -1)
++      strerr_die4sys(111,FATAL,"unable to find host name for ",*argv,": ");
++
++    buffer_put(buffer_1,out.s,out.len);
++    buffer_puts(buffer_1,"\n");
++
++    ++argv;
++  }
++
++  buffer_flush(buffer_1);
++  _exit(0);
++}
+--- /dev/null
++++ b/dns_namex.c
+@@ -0,0 +1,48 @@
++#include "stralloc.h"
++#include "uint16.h"
++#include "byte.h"
++#include "dns.h"
++
++static char *q = 0;
++
++int dns_name_packet_multi(stralloc *out,const char *buf,unsigned int len)
++{
++  unsigned int pos;
++  char header[12];
++  uint16 numanswers;
++  uint16 datalen;
++
++  if (!stralloc_copys(out,"")) return -1;
++
++  pos = dns_packet_copy(buf,len,0,header,12); if (!pos) return -1;
++  uint16_unpack_big(header + 6,&numanswers);
++  pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1;
++  pos += 4;
++
++  while (numanswers--) {
++    pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1;
++    pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) return -1;
++    uint16_unpack_big(header + 8,&datalen);
++    if (byte_equal(header,2,DNS_T_PTR))
++      if (byte_equal(header + 2,2,DNS_C_IN)) {
++      if (!dns_packet_getname(buf,len,pos,&q)) return -1;
++      if (!dns_domain_todot_cat(out,q)) return -1;
++      if (!stralloc_cats(out, " ")) return -1 ; 
++      }
++    pos += datalen;
++  }
++
++  return 0;
++}
++
++int dns_name4_multi(stralloc *out,const char ip[4])
++{
++  char name[DNS_NAME4_DOMAIN];
++
++  dns_name4_domain(name,ip);
++  if (dns_resolve(name,DNS_T_PTR) == -1) return -1;
++  if (dns_name_packet_multi(out,dns_resolve_tx.packet,dns_resolve_tx.packetlen) == -1) return -1;
++  dns_transmit_free(&dns_resolve_tx);
++  dns_domain_free(&q);
++  return 0;
++}
+--- a/dns.h
++++ b/dns.h
+@@ -70,9 +70,11 @@ extern struct dns_transmit dns_resolve_t
+ extern int dns_ip4_packet(stralloc *,const char *,unsigned int);
+ extern int dns_ip4(stralloc *,const stralloc *);
+ extern int dns_name_packet(stralloc *,const char *,unsigned int);
++extern int dns_name_packet_multi(stralloc *,const char *,unsigned int);
+ extern void dns_name4_domain(char *,const char *);
+ #define DNS_NAME4_DOMAIN 31
+ extern int dns_name4(stralloc *,const char *);
++extern int dns_name4_multi(stralloc *,const char *);
+ extern int dns_txt_packet(stralloc *,const char *,unsigned int);
+ extern int dns_txt(stralloc *,const stralloc *);
+ extern int dns_mx_packet(stralloc *,const char *,unsigned int);
+--- a/Makefile
++++ b/Makefile
+@@ -219,10 +219,10 @@ uint64.h taia.h dd.h
+ dns.a: \
+ makelib dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o dns_ipq.o dns_mx.o \
+-dns_name.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o dns_rcrw.o \
++dns_name.o dns_namex.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o dns_rcrw.o \
+ dns_resolve.o dns_sortip.o dns_transmit.o dns_txt.o
+       ./makelib dns.a dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o \
+-      dns_ipq.o dns_mx.o dns_name.o dns_nd.o dns_packet.o \
++      dns_ipq.o dns_mx.o dns_name.o dns_namex.o dns_nd.o dns_packet.o \
+       dns_random.o dns_rcip.o dns_rcrw.o dns_resolve.o \
+       dns_sortip.o dns_transmit.o dns_txt.o
+@@ -261,6 +261,11 @@ compile dns_name.c stralloc.h gen_alloc.
+ stralloc.h iopause.h taia.h tai.h uint64.h taia.h
+       ./compile dns_name.c
++dns_namex.o: \
++compile dns_namex.c stralloc.h gen_alloc.h uint16.h byte.h dns.h \
++stralloc.h iopause.h taia.h tai.h uint64.h taia.h
++      ./compile dns_namex.c
++
+ dns_nd.o: \
+ compile dns_nd.c byte.h fmt.h dns.h stralloc.h gen_alloc.h iopause.h \
+ taia.h tai.h uint64.h taia.h
+@@ -394,6 +399,17 @@ compile dnsname.c buffer.h exit.h strerr
+ gen_alloc.h iopause.h taia.h tai.h uint64.h taia.h
+       ./compile dnsname.c
++dnsnamex: \
++load dnsnamex.o iopause.o dns.a env.a libtai.a alloc.a buffer.a unix.a \
++byte.a socket.lib
++      ./load dnsnamex iopause.o dns.a env.a libtai.a alloc.a \
++      buffer.a unix.a byte.a  `cat socket.lib`
++
++dnsnamex.o: \
++compile dnsnamex.c buffer.h exit.h strerr.h ip4.h dns.h stralloc.h \
++gen_alloc.h iopause.h taia.h tai.h uint64.h taia.h
++      ./compile dnsnamex.c
++
+ dnsq: \
+ load dnsq.o iopause.o printrecord.o printpacket.o parsetype.o dns.a \
+ env.a libtai.a buffer.a alloc.a unix.a byte.a socket.lib
+@@ -658,7 +674,7 @@ prog: \
+ dnscache-conf dnscache walldns-conf walldns rbldns-conf rbldns \
+ rbldns-data pickdns-conf pickdns pickdns-data tinydns-conf tinydns \
+ tinydns-data tinydns-get tinydns-edit axfr-get axfrdns-conf axfrdns \
+-dnsip dnsipq dnsname dnstxt dnsmx dnsfilter random-ip dnsqr dnsq \
++dnsip dnsipq dnsname dnsnamex dnstxt dnsmx dnsfilter random-ip dnsqr dnsq \
+ dnstrace dnstracesort cachetest utime rts
+ prot.o: \
diff --git a/net/djbdns/patches/200-dnscache-cname-handling.patch b/net/djbdns/patches/200-dnscache-cname-handling.patch
new file mode 100644 (file)
index 0000000..ed96ac9
--- /dev/null
@@ -0,0 +1,226 @@
+--- a/query.c
++++ b/query.c
+@@ -91,6 +91,21 @@ static void cleanup(struct query *z)
+   }
+ }
++static int move_name_to_alias(struct query *z,uint32 ttl)
++{
++  int j ;
++
++  if (z->alias[QUERY_MAXALIAS - 1]) return 0 ;
++  for (j = QUERY_MAXALIAS - 1;j > 0;--j)
++    z->alias[j] = z->alias[j - 1];
++  for (j = QUERY_MAXALIAS - 1;j > 0;--j)
++    z->aliasttl[j] = z->aliasttl[j - 1];
++  z->alias[0] = z->name[0];
++  z->aliasttl[0] = ttl;
++  z->name[0] = 0;
++  return 1 ;
++}
++
+ static int rqa(struct query *z)
+ {
+   int i;
+@@ -123,7 +138,6 @@ static int globalip(char *d,char ip[4])
+ static char *t1 = 0;
+ static char *t2 = 0;
+ static char *t3 = 0;
+-static char *cname = 0;
+ static char *referral = 0;
+ static unsigned int *records = 0;
+@@ -179,15 +193,14 @@ static int doit(struct query *z,int stat
+   uint16 datalen;
+   char *control;
+   char *d;
++  char *owner_name = 0 ;
+   const char *dtype;
+   unsigned int dlen;
+   int flagout;
+-  int flagcname;
+   int flagreferral;
+   int flagsoa;
+   uint32 ttl;
+   uint32 soattl;
+-  uint32 cnamettl;
+   int i;
+   int j;
+   int k;
+@@ -253,7 +266,10 @@ static int doit(struct query *z,int stat
+     byte_copy(key,2,DNS_T_CNAME);
+     cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
+-    if (cached) {
++    /* A previous explicit query might have caused an empty RRSet to have been
++    ** cached.  Take care to ignore such a thing. 
++    */
++    if (cached && cachedlen) {
+       if (typematch(DNS_T_CNAME,dtype)) {
+         log_cachedanswer(d,DNS_T_CNAME);
+         if (!rqa(z)) goto DIE;
+@@ -262,8 +278,11 @@ static int doit(struct query *z,int stat
+       return 1;
+       }
+       log_cachedcname(d,cached);
+-      if (!dns_domain_copy(&cname,cached)) goto DIE;
+-      goto CNAME;
++      if (!z->level) {
++      if (!move_name_to_alias(z,ttl)) goto DIE ;
++      }
++      if (!dns_domain_copy(&z->name[z->level],cached)) goto DIE;
++      goto NEWNAME;
+     }
+     if (typematch(DNS_T_NS,dtype)) {
+@@ -352,7 +371,7 @@ static int doit(struct query *z,int stat
+       }
+     }
+-    if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_CNAME,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype)) {
++    if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype)) {
+       byte_copy(key,2,dtype);
+       cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
+       if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
+@@ -473,29 +492,31 @@ static int doit(struct query *z,int stat
+   cachettl = 0;
+   flagout = 0;
+-  flagcname = 0;
+   flagreferral = 0;
+   flagsoa = 0;
+   soattl = 0;
+-  cnamettl = 0;
++  if (!dns_domain_copy(&owner_name,d)) goto DIE;
++  /* This code assumes that the CNAME chain is presented in the correct 
++  ** order.  The example algorithm in RFC 1034 will actually result in this
++  ** being the case, but the words do not require it to be so.
++  */
+   for (j = 0;j < numanswers;++j) {
+     pos = dns_packet_getname(buf,len,pos,&t1); if (!pos) goto DIE;
+     pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) goto DIE;
+-    if (dns_domain_equal(t1,d))
++    if (dns_domain_equal(t1,owner_name))
+       if (byte_equal(header + 2,2,DNS_C_IN)) { /* should always be true */
+         if (typematch(header,dtype))
+           flagout = 1;
+         else if (typematch(header,DNS_T_CNAME)) {
+-          if (!dns_packet_getname(buf,len,pos,&cname)) goto DIE;
+-          flagcname = 1;
+-        cnamettl = ttlget(header + 4);
++          if (!dns_packet_getname(buf,len,pos,&owner_name)) goto DIE;
+         }
+       }
+   
+     uint16_unpack_big(header + 8,&datalen);
+     pos += datalen;
+   }
++  dns_domain_free(&owner_name) ;
+   posauthority = pos;
+   for (j = 0;j < numauthority;++j) {
+@@ -522,15 +543,6 @@ static int doit(struct query *z,int stat
+   }
+   posglue = pos;
+-
+-  if (!flagcname && !rcode && !flagout && flagreferral && !flagsoa)
+-    if (dns_domain_equal(referral,control) || !dns_domain_suffix(referral,control)) {
+-      log_lame(whichserver,control,referral);
+-      byte_zero(whichserver,4);
+-      goto HAVENS;
+-    }
+-
+-
+   if (records) { alloc_free(records); records = 0; }
+   k = numanswers + numauthority + numglue;
+@@ -677,24 +689,36 @@ static int doit(struct query *z,int stat
+   alloc_free(records); records = 0;
++  if (byte_diff(DNS_T_CNAME,2,dtype)) {
++    /* This code assumes that the CNAME chain is presented in the correct 
++    ** order.  The example algorithm in RFC 1034 will actually result in this
++    ** being the case, but the words do not require it to be so.
++    */
++    pos = posanswers;
++    for (j = 0;j < numanswers;++j) {
++      pos = dns_packet_getname(buf,len,pos,&t1); if (!pos) goto DIE;
++      pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) goto DIE;
++
++      if (dns_domain_equal(t1,d))
++      if (byte_equal(header + 2,2,DNS_C_IN)) { /* should always be true */
++        if (typematch(header,DNS_T_CNAME)) {
++          ttl = ttlget(header + 4);
++          if (z->level == 0) {
++            if (!move_name_to_alias(z,ttl)) goto DIE ;
++          }
++          if (!dns_packet_getname(buf,len,pos,&z->name[z->level])) goto DIE;
++          d = z->name[z->level];
++          if (!dns_domain_suffix(d,control) || !roots_same(d,control))
++            goto NEWNAME ;  /* Cannot trust the chain further - restart using current name */
++        }
++      }
+-  if (flagcname) {
+-    ttl = cnamettl;
+-    CNAME:
+-    if (!z->level) {
+-      if (z->alias[QUERY_MAXALIAS - 1]) goto DIE;
+-      for (j = QUERY_MAXALIAS - 1;j > 0;--j)
+-        z->alias[j] = z->alias[j - 1];
+-      for (j = QUERY_MAXALIAS - 1;j > 0;--j)
+-        z->aliasttl[j] = z->aliasttl[j - 1];
+-      z->alias[0] = z->name[0];
+-      z->aliasttl[0] = ttl;
+-      z->name[0] = 0;
++      uint16_unpack_big(header + 8,&datalen);
++      pos += datalen;
+     }
+-    if (!dns_domain_copy(&z->name[z->level],cname)) goto DIE;
+-    goto NEWNAME;
+   }
++  /* A "no such name" error applies to the end of any CNAME chain, not to the start. */
+   if (rcode == 3) {
+     log_nxdomain(whichserver,d,cachettl);
+     cachegeneric(DNS_T_ANY,d,"",0,cachettl);
+@@ -707,10 +731,26 @@ static int doit(struct query *z,int stat
+     return 1;
+   }
++  /* We check for a lame server _after_ we have cached any records that it
++  ** might have returned to us.  This copes better with the incorrect
++  ** behaviour of one content DNS server software that doesn't return
++  ** complete CNAME chains but instead returns only the first link in a
++  ** chain followed by a lame delegation to the same server.
++  ** Also: We check for a lame server _after_ following the CNAME chain.  The
++  ** delegation in a referral answer applies to the _end_ of the chain, not
++  ** to the beginning.
++  */
++  if (!rcode && !flagout && flagreferral && !flagsoa)
++    if (dns_domain_equal(referral,control) || !dns_domain_suffix(referral,control)) {
++      log_lame(whichserver,control,referral);
++      byte_zero(whichserver,4);
++      goto HAVENS;
++    }
++
+   if (!flagout && flagsoa)
++    /* Don't save empty RRSets for those types that we use as special markers. */
+     if (byte_diff(DNS_T_ANY,2,dtype))
+-      if (byte_diff(DNS_T_AXFR,2,dtype))
+-        if (byte_diff(DNS_T_CNAME,2,dtype)) {
++      if (byte_diff(DNS_T_AXFR,2,dtype)) {
+           save_start();
+           save_finish(dtype,d,soattl);
+         log_nodata(whichserver,d,dtype,soattl);
+@@ -822,6 +862,7 @@ static int doit(struct query *z,int stat
+   DIE:
+   cleanup(z);
+   if (records) { alloc_free(records); records = 0; }
++  dns_domain_free(&owner_name) ;
+   return -1;
+ }
diff --git a/net/djbdns/patches/210-dnscache-strict-forwardonly.patch b/net/djbdns/patches/210-dnscache-strict-forwardonly.patch
new file mode 100644 (file)
index 0000000..b64e4a4
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/log.h
++++ b/log.h
+@@ -25,6 +25,7 @@ extern void log_nxdomain(const char *,co
+ extern void log_nodata(const char *,const char *,const char *,unsigned int);
+ extern void log_servfail(const char *);
+ extern void log_lame(const char *,const char *,const char *);
++extern void log_ignore_referral(const char *,const char *,const char *);
+ extern void log_rr(const char *,const char *,const char *,const char *,unsigned int,unsigned int);
+ extern void log_rrns(const char *,const char *,const char *,unsigned int);
+--- a/log.c
++++ b/log.c
+@@ -197,6 +197,13 @@ void log_lame(const char server[4],const
+   line();
+ }
++void log_ignore_referral(const char server[4],const char * control, const char *referral)
++{
++  string("ignored referral "); ip(server); space();
++  name(control); space(); name(referral);
++  line();
++}
++
+ void log_servfail(const char *dn)
+ {
+   const char *x = error_str(errno);
+--- a/query.c
++++ b/query.c
+@@ -828,6 +828,18 @@ static int doit(struct query *z,int stat
+   if (!dns_domain_suffix(d,referral)) goto DIE;
++
++  /* In strict "forwardonly" mode, we don't, as the manual states,
++  ** contact a chain of servers according to "NS" resource records.
++  ** We don't obey any referral responses, therefore.  Instead, we
++  ** eliminate the server from the list and try the next one.
++  */
++  if (flagforwardonly) {
++      log_ignore_referral(whichserver,control,referral);
++      byte_zero(whichserver,4);
++      goto HAVENS;
++  }
++
+   control = d + dns_domain_suffixpos(d,referral);
+   z->control[z->level] = control;
+   byte_zero(z->servers[z->level],64);
diff --git a/net/djbdns/patches/220-dnscacheip-space-separator.patch b/net/djbdns/patches/220-dnscacheip-space-separator.patch
new file mode 100644 (file)
index 0000000..2e73ffe
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/dns_rcip.c
++++ b/dns_rcip.c
+@@ -17,7 +17,7 @@ static int init(char ip[64])
+   x = env_get("DNSCACHEIP");
+   if (x)
+     while (iplen <= 60) {
+-      if (*x == '.')
++      if (*x == ' ' || *x == '\t' || *x == '\n')
+       ++x;
+       else {
+         i = ip4_scan(x,ip + iplen);
diff --git a/net/djbdns/patches/230-tinydns-data-semantic-error.patch b/net/djbdns/patches/230-tinydns-data-semantic-error.patch
new file mode 100644 (file)
index 0000000..69b9441
--- /dev/null
@@ -0,0 +1,194 @@
+--- a/tinydns-data.c
++++ b/tinydns-data.c
+@@ -25,6 +25,14 @@
+ #define FATAL "tinydns-data: fatal: "
++void die_semantic2(const char * s1, const char * s2)
++{
++  strerr_die3x(111,FATAL,s1,s2) ;
++}
++void die_semantic4(const char * s1, const char * s2,const char * s3, const char * s4)
++{
++  strerr_die5x(111,FATAL,s1,s2,s3,s4) ;
++}
+ void die_datatmp(void)
+ {
+   strerr_die2sys(111,FATAL,"unable to create data.cdb.tmp: ");
+@@ -34,20 +42,39 @@ void nomem(void)
+   strerr_die1sys(111,FATAL);
+ }
++void ttlparse(stralloc *sa,unsigned long * ttl, unsigned long defttl, const char * ltype)
++{
++    int ttllen ;
++
++    if (sa->len > 0) {
++      if (!stralloc_0(sa)) nomem();
++      ttllen = scan_ulong(sa->s,ttl) ;
++      if (ttllen + 1 != sa->len)
++          die_semantic4("unparseable TTL in ",ltype," line: ", sa->s) ;
++    } else
++      *ttl = defttl;
++}
++
+ void ttdparse(stralloc *sa,char ttd[8])
+ {
+   unsigned int i;
+   char ch;
+   byte_zero(ttd,8);
+-  for (i = 0;(i < 16) && (i < sa->len);++i) {
++  for (i = 0;i < sa->len;++i) {
++    if (i >= 16) {
++      if (!stralloc_0(sa)) nomem() ;
++      die_semantic2("timestamp is too long: ", sa->s) ;
++    }
+     ch = sa->s[i];
+     if ((ch >= '0') && (ch <= '9'))
+       ch -= '0';
+     else if ((ch >= 'a') && (ch <= 'f'))
+       ch -= 'a' - 10;
+-    else
+-      ch = 0;
++    else {
++      if (!stralloc_0(sa)) nomem() ;
++      die_semantic2("timestamp contains an invalid character: ", sa->s) ;
++    }
+     if (!(i & 1)) ch <<= 4;
+     ttd[i >> 1] |= ch;
+   }
+@@ -55,6 +82,10 @@ void ttdparse(stralloc *sa,char ttd[8])
+ void locparse(stralloc *sa,char loc[2])
+ {
++  if (sa->len > 2) {
++    if (!stralloc_0(sa)) nomem() ;
++    die_semantic2("location code longer than two characters: ", sa->s) ;
++  }
+   loc[0] = (sa->len > 0) ? sa->s[0] : 0;
+   loc[1] = (sa->len > 1) ? sa->s[1] : 0;
+ }
+@@ -187,6 +218,7 @@ int main()
+   int i;
+   int j;
+   int k;
++  int iplen ;
+   char ch;
+   unsigned long ttl;
+   char ttd[8];
+@@ -267,8 +299,7 @@ int main()
+       if (!scan_ulong(f[7].s,&u)) uint32_unpack_big(defaultsoa + 16,&u);
+       uint32_pack_big(soa + 16,u);
+-      if (!stralloc_0(&f[8])) nomem();
+-      if (!scan_ulong(f[8].s,&ttl)) ttl = TTL_NEGATIVE;
++      ttlparse(&f[8],&ttl,TTL_NEGATIVE,"Z");
+       ttdparse(&f[9],ttd);
+       locparse(&f[10],loc);
+@@ -283,8 +314,7 @@ int main()
+       case '.': case '&':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
+-      if (!stralloc_0(&f[3])) nomem();
+-      if (!scan_ulong(f[3].s,&ttl)) ttl = TTL_NS;
++      ttlparse(&f[3],&ttl,TTL_NS,". or &");
+       ttdparse(&f[4],ttd);
+       locparse(&f[5],loc);
+@@ -309,24 +339,26 @@ int main()
+       rr_addname(d2);
+       rr_finish(d1);
+-      if (ip4_scan(f[1].s,ip)) {
++      iplen = ip4_scan(f[1].s,ip) ;
++      if (iplen != 0 && iplen + 1 == f[1].len) {
+         rr_start(DNS_T_A,ttl,ttd,loc);
+         rr_add(ip,4);
+         rr_finish(d2);
+-      }
++      } else if (f[1].len > 1)
++        die_semantic4("unparseable IP address in ","& or ."," line: ", f[1].s) ;
+       break;
+       case '+': case '=':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
+-      if (!stralloc_0(&f[2])) nomem();
+-      if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
++      ttlparse(&f[2],&ttl,TTL_POSITIVE,"+ or =");
+       ttdparse(&f[3],ttd);
+       locparse(&f[4],loc);
+       if (!stralloc_0(&f[1])) nomem();
+-      if (ip4_scan(f[1].s,ip)) {
++      iplen = ip4_scan(f[1].s,ip) ;
++      if (iplen != 0 && iplen + 1 == f[1].len) {
+         rr_start(DNS_T_A,ttl,ttd,loc);
+         rr_add(ip,4);
+         rr_finish(d1);
+@@ -337,13 +369,15 @@ int main()
+           rr_addname(d1);
+           rr_finish(dptr);
+         }
+-      }
++      } else if (f[1].len > 1)
++        die_semantic4("unparseable IP address in ","+ or ="," line: ", f[1].s) ;
++      else
++        die_semantic4("missing IP address in ","+ or ="," line: ", f[1].s) ;
+       break;
+       case '@':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
+-      if (!stralloc_0(&f[4])) nomem();
+-      if (!scan_ulong(f[4].s,&ttl)) ttl = TTL_POSITIVE;
++      ttlparse(&f[4],&ttl,TTL_POSITIVE,"@");
+       ttdparse(&f[5],ttd);
+       locparse(&f[6],loc);
+@@ -401,18 +435,19 @@ int main()
+       rr_addname(d2);
+       rr_finish(d1);
+-      if (ip4_scan(f[1].s,ip)) {
++      iplen = ip4_scan(f[1].s,ip) ;
++      if (iplen != 0 && iplen + 1 == f[1].len) {
+         rr_start(DNS_T_A,ttl,ttd,loc);
+         rr_add(ip,4);
+         rr_finish(d2);
+-      }
++      } else if (f[1].len > 1)
++        die_semantic4("unparseable IP address in ","@"," line: ", f[1].s) ;
+       break;
+       case '^': case 'C':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
+       if (!dns_domain_fromdot(&d2,f[1].s,f[1].len)) nomem();
+-      if (!stralloc_0(&f[2])) nomem();
+-      if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
++      ttlparse(&f[2],&ttl,TTL_POSITIVE,"^ or C");
+       ttdparse(&f[3],ttd);
+       locparse(&f[4],loc);
+@@ -426,8 +461,7 @@ int main()
+       case '\'':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
+-      if (!stralloc_0(&f[2])) nomem();
+-      if (!scan_ulong(f[2].s,&ttl)) ttl = TTL_POSITIVE;
++      ttlparse(&f[2],&ttl,TTL_POSITIVE,"\'");
+       ttdparse(&f[3],ttd);
+       locparse(&f[4],loc);
+@@ -449,8 +483,7 @@ int main()
+       case ':':
+       if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem();
+-      if (!stralloc_0(&f[3])) nomem();
+-      if (!scan_ulong(f[3].s,&ttl)) ttl = TTL_POSITIVE;
++      ttlparse(&f[3],&ttl,TTL_POSITIVE,":");
+       ttdparse(&f[4],ttd);
+       locparse(&f[5],loc);
diff --git a/net/djbdns/patches/240-tinydns-alias-chain-truncation.patch b/net/djbdns/patches/240-tinydns-alias-chain-truncation.patch
new file mode 100644 (file)
index 0000000..f94399e
--- /dev/null
@@ -0,0 +1,87 @@
+--- a/tdlookup.c
++++ b/tdlookup.c
+@@ -103,12 +103,13 @@ static int doname(void)
+   return response_addname(d1);
+ }
+-static int doit(char *q,char qtype[2])
++static int doit1(char **pqname,char qtype[2])
+ {
+   unsigned int bpos;
+   unsigned int anpos;
+   unsigned int aupos;
+   unsigned int arpos;
++  char *q;
+   char *control;
+   char *wild;
+   int flaggavesoa;
+@@ -122,6 +123,12 @@ static int doit(char *q,char qtype[2])
+   int addrnum;
+   uint32 addrttl;
+   int i;
++  int loop = 0 ;
++
++RESTART:
++  if (loop++ >= 100) return 0 ;
++
++  q = *pqname ;
+   anpos = response_len;
+@@ -136,7 +143,14 @@ static int doit(char *q,char qtype[2])
+       if (byte_equal(type,2,DNS_T_NS)) flagns = 1;
+     }
+     if (flagns) break;
+-    if (!*control) return 0; /* q is not within our bailiwick */
++    if (!*control) { /* q is not within our bailiwick */
++      if (loop <= 1)
++        return 0 ;
++      else {
++        response[2] &= ~4;
++        goto DONE; /* The administrator has issued contradictory instructions */
++      }
++    }
+     control += *control;
+     control += 1;
+   }
+@@ -172,9 +186,17 @@ static int doit(char *q,char qtype[2])
+       continue;
+       }
+       if (!response_rstart(q,type,ttl)) return 0;
+-      if (byte_equal(type,2,DNS_T_NS) || byte_equal(type,2,DNS_T_CNAME) || byte_equal(type,2,DNS_T_PTR)) {
++      if (byte_equal(type,2,DNS_T_NS) || byte_equal(type,2,DNS_T_PTR)) {
+       if (!doname()) return 0;
+       }
++      else if (byte_equal(type,2,DNS_T_CNAME)) {
++      if (!doname()) return 0;
++        if (byte_diff(type,2,qtype)) {
++        response_rfinish(RESPONSE_ANSWER);
++        if (!dns_domain_copy(pqname,d1)) return 0 ;
++        goto RESTART ;
++      }
++      }
+       else if (byte_equal(type,2,DNS_T_MX)) {
+       if (!dobytes(2)) return 0;
+       if (!doname()) return 0;
+@@ -275,9 +297,21 @@ static int doit(char *q,char qtype[2])
+     }
+   }
++DONE:
+   return 1;
+ }
++static int doit(char *qname,char qtype[2])
++{
++  int r ;
++  char * q = 0 ;
++
++  if (!dns_domain_copy(&q, qname)) return 0 ;
++  r = doit1(&q, qtype) ;
++  dns_domain_free(&q) ;
++  return r ;
++}
++
+ int respond(char *q,char qtype[2],char ip[4])
+ {
+   static struct tai cdb_valid = { 0 };
diff --git a/net/djbdns/patches/250-dnscache-slogging.patch b/net/djbdns/patches/250-dnscache-slogging.patch
new file mode 100644 (file)
index 0000000..5a2eaa1
--- /dev/null
@@ -0,0 +1,122 @@
+--- a/server.c
++++ b/server.c
+@@ -25,12 +25,63 @@ static int len;
+ static char *q;
++static uint64 stats_numq;
++static uint64 stats_plus;
++static uint64 stats_minus;
++static uint64 stats_nx;
++static uint64 stats_notimp;
++static uint64 stats_weird;
++static uint64 stats_noq;
++
++/* work around gcc 2.95.2 bug */
++#define number(x) ( (u64 = (x)), u64_print() )
++static uint64 u64;
++static void u64_print(void)
++{
++  char ubuf[20];
++  unsigned int pos;
++
++  pos = sizeof ubuf;
++  do {
++    if (!pos) break;
++    ubuf[--pos] = '0' + (u64 % 10);
++    u64 /= 10;
++  } while(u64);
++
++  buffer_put(buffer_2,ubuf + pos,sizeof ubuf - pos);
++}
++
++static void string(const char *s)
++{
++  buffer_puts(buffer_2,s);
++}
++
++static void line(void)
++{
++  string("\n");
++  buffer_flush(buffer_2);
++}
++
++static void log_stats(void)
++{
++  string("stats ");
++  number(stats_numq); string(" ");
++  number(stats_plus); string(" ");
++  number(stats_minus); string(" ");
++  number(stats_nx); string(" ");
++  number(stats_notimp); string(" ");
++  number(stats_weird); string(" ");
++  number(stats_noq);
++  line();
++}
++
+ static int doit(void)
+ {
+   unsigned int pos;
+   char header[12];
+   char qtype[2];
+   char qclass[2];
++  stats_numq++;
+   if (len >= sizeof buf) goto NOQ;
+   pos = dns_packet_copy(buf,len,0,header,12); if (!pos) goto NOQ;
+@@ -56,25 +107,37 @@ static int doit(void)
+   case_lowerb(q,dns_domain_length(q));
+   if (!respond(q,qtype,ip)) {
++    stats_minus++;
+     qlog(ip,port,header,q,qtype," - ");
+     return 0;
+   }
+-  qlog(ip,port,header,q,qtype," + ");
++
++  if ((response[2] & 4) && (response[3] & 3)) {
++    stats_nx++;
++    qlog(ip,port,header,q,qtype," N ");
++  }
++  else {
++    stats_plus++;
++    qlog(ip,port,header,q,qtype," + ");
++  }
+   return 1;
+   NOTIMP:
++  stats_notimp++;
+   response[3] &= ~15;
+   response[3] |= 4;
+   qlog(ip,port,header,q,qtype," I ");
+   return 1;
+   WEIRDCLASS:
++  stats_weird++;
+   response[3] &= ~15;
+   response[3] |= 1;
+   qlog(ip,port,header,q,qtype," C ");
+   return 1;
+   NOQ:
++  stats_noq++;
+   qlog(ip,port,"\0\0","","\0\0"," / ");
+   return 0;
+ }
+@@ -83,6 +146,7 @@ int main()
+ {
+   char *x;
+   int udp53;
++  unsigned char flag=0;
+   x = env_get("IP");
+   if (!x)
+@@ -106,6 +170,8 @@ int main()
+   buffer_putsflush(buffer_2,starting);
+   for (;;) {
++    if ((flag++)%32==1)
++      log_stats();
+     len = socket_recv4(udp53,buf,sizeof buf,ip,&port);
+     if (len < 0) continue;
+     if (!doit()) continue;
diff --git a/net/djbdns/patches/260-dnsfilter-replace.patch b/net/djbdns/patches/260-dnsfilter-replace.patch
new file mode 100644 (file)
index 0000000..b352f1c
--- /dev/null
@@ -0,0 +1,71 @@
+--- a/dnsfilter.c
++++ b/dnsfilter.c
+@@ -41,6 +41,7 @@ int inbuflen = 0;
+ iopause_fd *inio;
+ int flag0 = 1;
++int opt_replace = 0;
+ iopause_fd *io;
+ int iolen;
+@@ -51,12 +52,16 @@ char name[DNS_NAME4_DOMAIN];
+ void errout(int i)
+ {
+   int j;
+-
+-  if (!stralloc_copys(&x[i].middle,":")) nomem();
+-  if (!stralloc_cats(&x[i].middle,error_str(errno))) nomem();
+-  for (j = 0;j < x[i].middle.len;++j)
+-    if (x[i].middle.s[j] == ' ')
+-      x[i].middle.s[j] = '-';
++ 
++  if (opt_replace) 
++    x[i].middle.len=0;
++  else {
++    if (!stralloc_copys(&x[i].middle,":")) nomem();
++    if (!stralloc_cats(&x[i].middle,error_str(errno))) nomem();
++    for (j = 0;j < x[i].middle.len;++j)
++      if (x[i].middle.s[j] == ' ')
++        x[i].middle.s[j] = '-';
++  }
+ }
+ int main(int argc,char **argv)
+@@ -69,7 +74,7 @@ int main(int argc,char **argv)
+   int j;
+   int r;
+-  while ((opt = getopt(argc,argv,"c:l:")) != opteof)
++  while ((opt = getopt(argc,argv,"c:l:r")) != opteof)
+     switch(opt) {
+       case 'c':
+       scan_ulong(optarg,&u);
+@@ -83,8 +88,11 @@ int main(int argc,char **argv)
+       if (u > 1000000) u = 1000000;
+       xmax = u;
+       break;
++      case 'r':
++      opt_replace = 1;          
++      break;
+       default:
+-      strerr_die1x(111,"dnsfilter: usage: dnsfilter [ -c concurrency ] [ -l lines ]");
++      strerr_die1x(111,"dnsfilter: usage: dnsfilter [ -c concurrency ] [ -l lines ] [-r]");
+     }
+   x = (struct line *) alloc(xmax * sizeof(struct line));
+@@ -140,8 +148,13 @@ int main(int argc,char **argv)
+       else if (r == 1) {
+         if (dns_name_packet(&x[i].middle,x[i].dt.packet,x[i].dt.packetlen) == -1)
+           errout(i);
+-        if (x[i].middle.len)
+-          if (!stralloc_cats(&x[i].left,"=")) nomem();
++        if (x[i].middle.len) {
++          if (opt_replace) {
++            if (!stralloc_copys(&x[i].left, "")) nomem();
++          } else {
++            if (!stralloc_cats(&x[i].left, "=")) nomem();
++          }
++        }
+         x[i].flagactive = 0;
+         --numactive;
+       }
diff --git a/net/djbdns/patches/270-dnscache-sigpipe-fix.patch b/net/djbdns/patches/270-dnscache-sigpipe-fix.patch
new file mode 100644 (file)
index 0000000..17a739a
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/dnscache.c
++++ b/dnscache.c
+@@ -1,4 +1,5 @@
+ #include <unistd.h>
++#include <signal.h>
+ #include "env.h"
+ #include "exit.h"
+ #include "scan.h"
+@@ -391,6 +392,7 @@ int main()
+   char *x;
+   unsigned long cachesize;
++  signal(SIGPIPE, SIG_IGN);
+   x = env_get("IP");
+   if (!x)
+     strerr_die2x(111,FATAL,"$IP not set");
diff --git a/net/djbdns/patches/280-dnscache-ignoreip2.patch b/net/djbdns/patches/280-dnscache-ignoreip2.patch
new file mode 100644 (file)
index 0000000..0a8bfad
--- /dev/null
@@ -0,0 +1,117 @@
+This patch change djbdns's dnscache program so that it will ignore the
+IP address given in the ignoreip file.  I wrote this patch because of
+Verisign's oh-so helpful wildcard A record for *.COM and *.NET.
+
+If you have djbdns-1.05-ignoreip.patch installed, back it out like this:
+    cd /usr/local/src/djbdns-1.05
+    patch -R <djbdns-1.05-ignoreip.patch
+
+Install the patch like this:
+    cd /usr/local/src/djbdns-1.05
+    patch <djbdns-1.05-ignoreip2.patch
+    svc -d /service/dnscache
+    make setup check
+    svc -u /service/dnscache
+
+Configure it to ignore Verisign's wildcard record like this:
+    echo 64.94.110.11 >/service/dnscache/root/ignoreip
+    svc -t /service/dnscache
+
+Configure it to ignore all the cretins like this:
+awk '{print $2}' <<EOF >/service/dnscache/root/ignoreip
+         *.ac            194.205.62.122
+         *.cc            206.253.214.102
+         *.com           64.94.110.11
+         *.cx            219.88.106.80
+         *.museum        195.7.77.20
+         *.net           64.94.110.11
+         *.nu            64.55.105.9
+                   and   212.181.91.6
+         *.ph            203.119.4.6
+         *.sh            194.205.62.62
+         *.tm            194.205.62.62
+         *.ws            216.35.187.246
+EOF
+    svc -t /service/dnscache
+
+J.P. Larocque contributes a script which updates root/ignoreip:
+    http://ely.ath.cx/~piranha/software/ignoreip-update/ignoreip-update-0.1
+
+If root/ignoreip is not present, no addresses will be ignored.
+
+--
+--My blog is at angry-economist.russnelson.com  | Free markets express in the
+Crynwr sells support for free software  | PGPok | practical world our belief
+521 Pleasant Valley Rd. | +1 315 268 1925 voice | that there is that of God
+Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | in all people. -Chris V.
+
+
+--- a/dnscache.c
++++ b/dnscache.c
+@@ -24,6 +24,8 @@
+ #include "okclient.h"
+ #include "droproot.h"
++stralloc ignoreip = {0};
++
+ static int packetquery(char *buf,unsigned int len,char **q,char qtype[2],char qclass[2],char id[2])
+ {
+   unsigned int pos;
+@@ -390,6 +392,7 @@ char seed[128];
+ int main()
+ {
+   char *x;
++  unsigned int i, j, k;
+   unsigned long cachesize;
+   signal(SIGPIPE, SIG_IGN);
+@@ -433,6 +436,20 @@ int main()
+   if (!cache_init(cachesize))
+     strerr_die3x(111,FATAL,"not enough memory for cache of size ",x);
++  if (openreadclose("ignoreip",&ignoreip,64) < 0) 
++    strerr_die2x(111,FATAL,"trouble reading ignoreip");
++  for(j = k = i = 0; i < ignoreip.len; i++)
++    if (ignoreip.s[i] == '\n')  {
++      ignoreip.s[i] = '\0';
++      if (j + 4 > i)
++        strerr_die3x(111,FATAL,"badly malformed ip4 address ",ignoreip.s+k);
++      if (!ip4_scan(ignoreip.s+k,ignoreip.s+j))
++        strerr_die3x(111,FATAL,"unable to parse address in ignoreip ",ignoreip.s+k);
++      j += 4;
++      k = i + 1;
++    }
++  ignoreip.len = j;
++
+   if (env_get("HIDETTL"))
+     response_hidettl();
+   if (env_get("FORWARDONLY"))
+--- a/query.c
++++ b/query.c
+@@ -13,6 +13,8 @@
+ #include "response.h"
+ #include "query.h"
++extern stralloc ignoreip;
++
+ static int flagforwardonly = 0;
+ void query_forwardonly(void)
+@@ -173,6 +175,7 @@ static int smaller(char *buf,unsigned in
+ static int doit(struct query *z,int state)
+ {
++  unsigned int ii;
+   char key[257];
+   char *cached;
+   unsigned int cachedlen;
+@@ -662,6 +665,9 @@ static int doit(struct query *z,int stat
+         pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) goto DIE;
+         if (byte_equal(header + 8,2,"\0\4")) {
+           pos = dns_packet_copy(buf,len,pos,header,4); if (!pos) goto DIE;
++          if (ignoreip.len)
++          for(ii = 0; ii < ignoreip.len; ii+= 4)
++            if (byte_equal(header,4,ignoreip.s+ii)) goto NXDOMAIN;
+           save_data(header,4);
+           log_rr(whichserver,t1,DNS_T_A,header,4,ttl);
+         }
diff --git a/net/djbdns/patches/300-bugfix-dnscache-dempsky-poison.patch b/net/djbdns/patches/300-bugfix-dnscache-dempsky-poison.patch
new file mode 100644 (file)
index 0000000..23d8e9f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/response.c
++++ b/response.c
+@@ -34,7 +34,7 @@ int response_addname(const char *d)
+         uint16_pack_big(buf,49152 + name_ptr[i]);
+         return response_addbytes(buf,2);
+       }
+-    if (dlen <= 128)
++    if ((dlen <= 128) && (response_len < 16384))
+       if (name_num < NAMES) {
+       byte_copy(name[name_num],dlen,d);
+       name_ptr[name_num] = response_len;
diff --git a/net/djbdns/patches/310-bugfix-dnscache-merge-outgoing-requests.patch b/net/djbdns/patches/310-bugfix-dnscache-merge-outgoing-requests.patch
new file mode 100644 (file)
index 0000000..bb3a4e2
--- /dev/null
@@ -0,0 +1,328 @@
+--- a/Makefile
++++ b/Makefile
+@@ -315,11 +315,11 @@ stralloc.h iopause.h taia.h tai.h uint64
+       ./compile dns_txt.c
+ dnscache: \
+-load dnscache.o droproot.o okclient.o log.o cache.o query.o \
++load dnscache.o droproot.o okclient.o log.o cache.o query.o qmerge.o \
+ response.o dd.o roots.o iopause.o prot.o dns.a env.a alloc.a buffer.a \
+ libtai.a unix.a byte.a socket.lib
+       ./load dnscache droproot.o okclient.o log.o cache.o \
+-      query.o response.o dd.o roots.o iopause.o prot.o dns.a \
++      query.o qmerge.o response.o dd.o roots.o iopause.o prot.o dns.a \
+       env.a alloc.a buffer.a libtai.a unix.a byte.a  `cat \
+       socket.lib`
+@@ -340,7 +340,7 @@ compile dnscache.c env.h exit.h scan.h s
+ uint16.h uint64.h socket.h uint16.h dns.h stralloc.h gen_alloc.h \
+ iopause.h taia.h tai.h uint64.h taia.h taia.h byte.h roots.h fmt.h \
+ iopause.h query.h dns.h uint32.h alloc.h response.h uint32.h cache.h \
+-uint32.h uint64.h ndelay.h log.h uint64.h okclient.h droproot.h
++uint32.h uint64.h ndelay.h log.h uint64.h okclient.h droproot.h maxclient.h
+       ./compile dnscache.c
+ dnsfilter: \
+@@ -685,11 +685,16 @@ qlog.o: \
+ compile qlog.c buffer.h qlog.h uint16.h
+       ./compile qlog.c
++qmerge.o: \
++compile qmerge.c qmerge.h dns.h stralloc.h gen_alloc.h iopause.h \
++taia.h tai.h uint64.h log.h maxclient.h
++      ./compile qmerge.c
++
+ query.o: \
+ compile query.c error.h roots.h log.h uint64.h case.h cache.h \
+ uint32.h uint64.h byte.h dns.h stralloc.h gen_alloc.h iopause.h \
+ taia.h tai.h uint64.h taia.h uint64.h uint32.h uint16.h dd.h alloc.h \
+-response.h uint32.h query.h dns.h uint32.h
++response.h uint32.h query.h dns.h uint32.h qmerge.h
+       ./compile query.c
+ random-ip: \
+--- a/dnscache.c
++++ b/dnscache.c
+@@ -20,6 +20,7 @@
+ #include "response.h"
+ #include "cache.h"
+ #include "ndelay.h"
++#include "maxclient.h"
+ #include "log.h"
+ #include "okclient.h"
+ #include "droproot.h"
+@@ -57,7 +58,6 @@ uint64 numqueries = 0;
+ static int udp53;
+-#define MAXUDP 200
+ static struct udpclient {
+   struct query q;
+   struct taia start;
+@@ -134,7 +134,6 @@ void u_new(void)
+ static int tcp53;
+-#define MAXTCP 20
+ struct tcpclient {
+   struct query q;
+   struct taia start;
+--- a/log.c
++++ b/log.c
+@@ -151,6 +151,13 @@ void log_tx(const char *q,const char qty
+   line();
+ }
++void log_tx_piggyback(const char *q, const char qtype[2], const char *control)
++{
++  string("txpb ");
++  logtype(qtype); space(); name(q); space(); name(control);
++  line();
++}
++
+ void log_cachedanswer(const char *q,const char type[2])
+ {
+   string("cached "); logtype(type); space();
+--- a/log.h
++++ b/log.h
+@@ -20,6 +20,7 @@ extern void log_cachednxdomain(const cha
+ extern void log_cachedns(const char *,const char *);
+ extern void log_tx(const char *,const char *,const char *,const char *,unsigned int);
++extern void log_tx_piggyback(const char *,const char *,const char *);
+ extern void log_nxdomain(const char *,const char *,unsigned int);
+ extern void log_nodata(const char *,const char *,const char *,unsigned int);
+--- /dev/null
++++ b/maxclient.h
+@@ -0,0 +1,7 @@
++#ifndef MAXCLIENT_H
++#define MAXCLIENT_H
++
++#define MAXUDP 200
++#define MAXTCP 20
++
++#endif /* MAXCLIENT_H */
+--- /dev/null
++++ b/qmerge.c
+@@ -0,0 +1,115 @@
++#include "qmerge.h"
++#include "byte.h"
++#include "log.h"
++#include "maxclient.h"
++
++#define QMERGE_MAX (MAXUDP+MAXTCP)
++struct qmerge inprogress[QMERGE_MAX];
++
++static
++int qmerge_key_init(struct qmerge_key *qmk, const char *q, const char qtype[2],
++    const char *control)
++{
++  if (!dns_domain_copy(&qmk->q, q)) return 0;
++  byte_copy(qmk->qtype, 2, qtype);
++  if (!dns_domain_copy(&qmk->control, control)) return 0;
++  return 1;
++}
++
++static
++int qmerge_key_equal(struct qmerge_key *a, struct qmerge_key *b)
++{
++  return
++    byte_equal(a->qtype, 2, b->qtype) &&
++    dns_domain_equal(a->q, b->q) &&
++    dns_domain_equal(a->control, b->control);
++}
++
++static
++void qmerge_key_free(struct qmerge_key *qmk)
++{
++  dns_domain_free(&qmk->q);
++  dns_domain_free(&qmk->control);
++}
++
++void qmerge_free(struct qmerge **x)
++{
++  struct qmerge *qm;
++
++  qm = *x;
++  *x = 0;
++  if (!qm || !qm->active) return;
++
++  qm->active--;
++  if (!qm->active) {
++    qmerge_key_free(&qm->key);
++    dns_transmit_free(&qm->dt);
++  }
++}
++
++int qmerge_start(struct qmerge **qm, const char servers[64], int flagrecursive,
++    const char *q, const char qtype[2], const char localip[4],
++    const char *control)
++{
++  struct qmerge_key k;
++  int i;
++  int r;
++
++  qmerge_free(qm);
++
++  byte_zero(&k, sizeof k);
++  if (!qmerge_key_init(&k, q, qtype, control)) return -1;
++  for (i = 0; i < QMERGE_MAX; i++) {
++    if (!inprogress[i].active) continue;
++    if (!qmerge_key_equal(&k, &inprogress[i].key)) continue;
++    log_tx_piggyback(q, qtype, control);
++    inprogress[i].active++;
++    *qm = &inprogress[i];
++    qmerge_key_free(&k);
++    return 0;
++  }
++
++  for (i = 0; i < QMERGE_MAX; i++)
++    if (!inprogress[i].active)
++      break;
++  if (i == QMERGE_MAX) return -1;
++
++  log_tx(q, qtype, control, servers, 0);
++  r = dns_transmit_start(&inprogress[i].dt, servers, flagrecursive, q, qtype, localip);
++  if (r == -1) { qmerge_key_free(&k); return -1; }
++  inprogress[i].active++;
++  inprogress[i].state = 0;
++  qmerge_key_free(&inprogress[i].key);
++  byte_copy(&inprogress[i].key, sizeof k, &k);
++  *qm = &inprogress[i];
++  return 0;
++}
++
++void qmerge_io(struct qmerge *qm, iopause_fd *io, struct taia *deadline)
++{
++  if (qm->state == 0) {
++    dns_transmit_io(&qm->dt, io, deadline);
++    qm->state = 1;
++  }
++  else {
++    io->fd = -1;
++    io->events = 0;
++  }
++}
++
++int qmerge_get(struct qmerge **x, const iopause_fd *io, const struct taia *when)
++{
++  int r;
++  struct qmerge *qm;
++
++  qm = *x;
++  if (qm->state == -1) return -1; /* previous error */
++  if (qm->state == 0) return 0; /* no packet */
++  if (qm->state == 2) return 1; /* already got packet */
++
++  r = dns_transmit_get(&qm->dt, io, when);
++  if (r == -1) { qm->state = -1; return -1; } /* error */
++  if (r == 0) { qm->state = 0; return 0; } /* must wait for i/o */
++  if (r == 1) { qm->state = 2; return 1; } /* got packet */
++  return -1; /* bug */
++}
+--- /dev/null
++++ b/qmerge.h
+@@ -0,0 +1,24 @@
++#ifndef QMERGE_H
++#define QMERGE_H
++
++#include "dns.h"
++
++struct qmerge_key {
++  char *q;
++  char qtype[2];
++  char *control;
++};
++
++struct qmerge {
++  int active;
++  struct qmerge_key key;
++  struct dns_transmit dt;
++  int state; /* -1 = error, 0 = need io, 1 = need get, 2 = got packet */
++};
++
++extern int qmerge_start(struct qmerge **,const char *,int,const char *,const char *,const char *,const char *);
++extern void qmerge_io(struct qmerge *,iopause_fd *,struct taia *);
++extern int qmerge_get(struct qmerge **,const iopause_fd *,const struct taia *);
++extern void qmerge_free(struct qmerge **);
++
++#endif /* QMERGE_H */
+--- a/query.c
++++ b/query.c
+@@ -83,7 +83,7 @@ static void cleanup(struct query *z)
+   int j;
+   int k;
+-  dns_transmit_free(&z->dt);
++  qmerge_free(&z->qm);
+   for (j = 0;j < QUERY_MAXALIAS;++j)
+     dns_domain_free(&z->alias[j]);
+   for (j = 0;j < QUERY_MAXLEVEL;++j) {
+@@ -452,14 +452,8 @@ static int doit(struct query *z,int stat
+   if (j == 64) goto SERVFAIL;
+   dns_sortip(z->servers[z->level],64);
+-  if (z->level) {
+-    log_tx(z->name[z->level],DNS_T_A,z->control[z->level],z->servers[z->level],z->level);
+-    if (dns_transmit_start(&z->dt,z->servers[z->level],flagforwardonly,z->name[z->level],DNS_T_A,z->localip) == -1) goto DIE;
+-  }
+-  else {
+-    log_tx(z->name[0],z->type,z->control[0],z->servers[0],0);
+-    if (dns_transmit_start(&z->dt,z->servers[0],flagforwardonly,z->name[0],z->type,z->localip) == -1) goto DIE;
+-  }
++  dtype = z->level ? DNS_T_A : z->type;
++  if (qmerge_start(&z->qm,z->servers[z->level],flagforwardonly,z->name[z->level],dtype,z->localip,z->control[z->level]) == -1) goto DIE;
+   return 0;
+@@ -473,10 +467,10 @@ static int doit(struct query *z,int stat
+   HAVEPACKET:
+   if (++z->loop == 100) goto DIE;
+-  buf = z->dt.packet;
+-  len = z->dt.packetlen;
++  buf = z->qm->dt.packet;
++  len = z->qm->dt.packetlen;
+-  whichserver = z->dt.servers + 4 * z->dt.curserver;
++  whichserver = z->qm->dt.servers + 4 * z->qm->dt.curserver;
+   control = z->control[z->level];
+   d = z->name[z->level];
+   dtype = z->level ? DNS_T_A : z->type;
+@@ -902,7 +896,7 @@ int query_start(struct query *z,char *dn
+ int query_get(struct query *z,iopause_fd *x,struct taia *stamp)
+ {
+-  switch(dns_transmit_get(&z->dt,x,stamp)) {
++  switch(qmerge_get(&z->qm,x,stamp)) {
+     case 1:
+       return doit(z,1);
+     case -1:
+@@ -913,5 +907,5 @@ int query_get(struct query *z,iopause_fd
+ void query_io(struct query *z,iopause_fd *x,struct taia *deadline)
+ {
+-  dns_transmit_io(&z->dt,x,deadline);
++  qmerge_io(z->qm,x,deadline);
+ }
+--- a/query.h
++++ b/query.h
+@@ -1,7 +1,7 @@
+ #ifndef QUERY_H
+ #define QUERY_H
+-#include "dns.h"
++#include "qmerge.h"
+ #include "uint32.h"
+ #define QUERY_MAXLEVEL 5
+@@ -20,7 +20,7 @@ struct query {
+   char localip[4];
+   char type[2];
+   char class[2];
+-  struct dns_transmit dt;
++  struct qmerge *qm;
+ } ;
+ extern int query_start(struct query *,char *,char *,char *,char *);
diff --git a/net/djbdns/patches/320-bugfix-dnscache-cache-soa-records.patch b/net/djbdns/patches/320-bugfix-dnscache-cache-soa-records.patch
new file mode 100644 (file)
index 0000000..f2b72a3
--- /dev/null
@@ -0,0 +1,67 @@
+--- a/query.c
++++ b/query.c
+@@ -342,6 +342,29 @@ static int doit(struct query *z,int stat
+       }
+     }
++    if (typematch(DNS_T_SOA,dtype)) {
++      byte_copy(key,2,DNS_T_SOA);
++      cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
++      if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
++        log_cachedanswer(d,DNS_T_SOA);
++        if (!rqa(z)) goto DIE;
++        pos = 0;
++        while (pos = dns_packet_copy(cached,cachedlen,pos,misc,20)) {
++          pos = dns_packet_getname(cached,cachedlen,pos,&t2);
++          if (!pos) break;
++          pos = dns_packet_getname(cached,cachedlen,pos,&t3);
++          if (!pos) break;
++          if (!response_rstart(d,DNS_T_SOA,ttl)) goto DIE;
++          if (!response_addname(t2)) goto DIE;
++          if (!response_addname(t3)) goto DIE;
++          if (!response_addbytes(misc,20)) goto DIE;
++          response_rfinish(RESPONSE_ANSWER);
++        }
++        cleanup(z);
++        return 1;
++      }
++    }
++
+     if (typematch(DNS_T_A,dtype)) {
+       byte_copy(key,2,DNS_T_A);
+       cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
+@@ -374,7 +397,7 @@ static int doit(struct query *z,int stat
+       }
+     }
+-    if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype)) {
++    if (!typematch(DNS_T_ANY,dtype) && !typematch(DNS_T_AXFR,dtype) && !typematch(DNS_T_NS,dtype) && !typematch(DNS_T_PTR,dtype) && !typematch(DNS_T_A,dtype) && !typematch(DNS_T_MX,dtype) && !typematch(DNS_T_SOA,dtype)) {
+       byte_copy(key,2,dtype);
+       cached = cache_get(key,dlen + 2,&cachedlen,&ttl);
+       if (cached && (cachedlen || byte_diff(dtype,2,DNS_T_ANY))) {
+@@ -601,15 +624,24 @@ static int doit(struct query *z,int stat
+     else if (byte_equal(type,2,DNS_T_AXFR))
+       ;
+     else if (byte_equal(type,2,DNS_T_SOA)) {
++      int non_authority = 0;
++      save_start();
+       while (i < j) {
+         pos = dns_packet_skipname(buf,len,records[i]); if (!pos) goto DIE;
+         pos = dns_packet_getname(buf,len,pos + 10,&t2); if (!pos) goto DIE;
+         pos = dns_packet_getname(buf,len,pos,&t3); if (!pos) goto DIE;
+         pos = dns_packet_copy(buf,len,pos,misc,20); if (!pos) goto DIE;
+-        if (records[i] < posauthority)
++        if (records[i] < posauthority) {
+           log_rrsoa(whichserver,t1,t2,t3,misc,ttl);
++          save_data(misc,20);
++          save_data(t2,dns_domain_length(t2));
++          save_data(t3,dns_domain_length(t3));
++          non_authority++;
++        }
+         ++i;
+       }
++      if (non_authority)
++        save_finish(DNS_T_SOA,t1,ttl);
+     }
+     else if (byte_equal(type,2,DNS_T_CNAME)) {
+       pos = dns_packet_skipname(buf,len,records[j - 1]); if (!pos) goto DIE;
diff --git a/net/dmapd/Makefile b/net/dmapd/Makefile
new file mode 100644 (file)
index 0000000..5dd12df
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2009-2012 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:=dmapd
+PKG_VERSION:=0.0.50
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.flyn.org/projects/dmapd
+PKG_MD5SUM:=2e04d7fb8437f9e7bd370dc3af450aae
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=2
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/dmapd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libdmapsharing +libdb47 +vips +GraphicsMagick
+  TITLE:= dmapd
+  URL:=http://www.flyn.org/projects/dmapd/
+  MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+endef
+
+define Package/dmapd/decription
+       Dmapd is a DMAP server
+endef
+
+define Package/dmapd/conffiles
+/etc/dmapd.conf
+endef
+
+TARGET_LDFLAGS+=\
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
+
+define Package/dmapd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/distro/dmapd.conf $(1)/etc/
+       $(INSTALL_BIN) ./files/dmapd.init $(1)/etc/init.d/dmapd
+       $(INSTALL_DIR) $(1)/usr/lib/dmapd/$(PKG_VERSION)/modules
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/sbin/dmapd \
+               $(1)/usr/sbin/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libdmapd.so* \
+               $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/dmapd/$(PKG_VERSION)/modules/*.so \
+               $(1)/usr/lib/dmapd/$(PKG_VERSION)/modules/
+endef
+
+$(eval $(call BuildPackage,dmapd))
diff --git a/net/dmapd/files/dmapd.init b/net/dmapd/files/dmapd.init
new file mode 100644 (file)
index 0000000..e76b0ef
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2012 OpenWrt.org
+
+START=60
+
+start() {
+       user_exists dmapd 56 || user_add dmapd 56
+       group_exists dmapd 56 || group_add dmapd 56
+       [ -d /var/run/dmapd ] || {
+               mkdir -m 0755 -p /var/run/dmapd
+               chown dmapd:dmapd /var/run/dmapd
+       }
+       [ -d /var/db/dmapd/DAAP ] || {
+               mkdir -m 0755 -p /var/db/dmapd/DAAP
+               chown dmapd:dmapd /var/db/dmapd/DAAP
+       }
+       [ -d /var/db/dmapd/DPAP ] || {
+               mkdir -m 0755 -p /var/db/dmapd/DPAP
+               chown dmapd:dmapd /var/db/dmapd/DPAP
+       }
+       mkdir -m 0755 -p /var/lock/subsys
+       mkdir -m 0755 -p /var/media/music
+       mkdir -m 0755 -p /var/media/pictures
+
+       service_start /usr/sbin/dmapd -m /var/media/music -p /var/media/pictures --vips-disc-threshold 64k
+}
+
+stop() {
+       service_stop /usr/sbin/dmapd
+}
diff --git a/net/dmapd/patches/001-dmapd_conf.patch b/net/dmapd/patches/001-dmapd_conf.patch
new file mode 100644 (file)
index 0000000..9c1e60a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/distro/dmapd.conf
++++ b/distro/dmapd.conf
+@@ -3,7 +3,7 @@
+ Database-Dir=/var/db/dmapd
+ # Name that will be used to identify share:
+-Share-Name=dmapd
++Share-Name=OpenWrt
+ # User that dmapd will run as, current user if undefined:
+ User=dmapd
diff --git a/net/dns2tcp/Makefile b/net/dns2tcp/Makefile
new file mode 100644 (file)
index 0000000..4f038e8
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2012 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:=dns2tcp
+PKG_VERSION:=0.5.2
+PKG_RELEASE:=1
+PKG_MD5SUM:=51c5dc69f5814c2936ce6832217d292d
+
+PKG_SOURCE_URL:=http://www.hsc.fr/ressources/outils/dns2tcp/download/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dns2tcp/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=TCP over DNS tunnel
+  URL:=http://www.hsc.fr/ressources/outils/dns2tcp/
+endef
+
+define Package/dns2tcp
+  $(call Package/dns2tcp/Default)
+  TITLE+= (client)
+endef
+
+define Package/dns2tcpd
+  $(call Package/dns2tcp/Default)
+  TITLE+= (server)
+endef
+
+define Package/dns2tcp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/dns2tcpc $(1)/usr/bin
+endef
+
+define Package/dns2tcpd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/dns2tcpd $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,dns2tcp))
+$(eval $(call BuildPackage,dns2tcpd))
diff --git a/net/dsniff/Makefile b/net/dsniff/Makefile
new file mode 100644 (file)
index 0000000..e4bc85a
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2006 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:=dsniff
+PKG_VERSION:=2.4b1
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.monkey.org/~dugsong/dsniff/beta
+PKG_MD5SUM:=2f761fa3475682a7512b0b43568ee7d6
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-2.4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dsniff
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libnids +libnet0 +libopenssl +libgdbm $(LIBRPC_DEPENDS)
+  TITLE:=A collection of tools for network auditing and penetration testing
+  URL:=http://www.monkey.org/~dugsong/dsniff/
+endef
+
+define Package/dsniff/description
+       A collection of tools for network auditing and penetration testing.
+endef
+
+TARGET_LDFLAGS += $(LIBRPC)
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-gdbm="$(STAGING_DIR)/usr" \
+               --with-libnids="$(STAGING_DIR)/usr" \
+               --with-libpcap="$(STAGING_DIR)/usr" \
+               --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.0.x" \
+               --with-openssl="$(STAGING_DIR)/usr" \
+               --without-db \
+               --without-x \
+       )
+endef
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               install_prefix="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/dsniff/install  
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP)  $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,dsniff))
diff --git a/net/dsniff/patches/001-arpspoof_fix.patch b/net/dsniff/patches/001-arpspoof_fix.patch
new file mode 100644 (file)
index 0000000..fd29227
--- /dev/null
@@ -0,0 +1,53 @@
+diff -urN dsniff.old/arp.c dsniff.dev/arp.c
+--- dsniff.old/arp.c   2001-03-15 09:32:58.000000000 +0100
++++ dsniff.dev/arp.c   2006-03-03 01:41:10.000000000 +0100
+@@ -39,7 +39,7 @@
+ #ifdef BSD
+ int
+-arp_cache_lookup(in_addr_t ip, struct ether_addr *ether)
++arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char *lif)
+ {
+       int mib[6];
+       size_t len;
+@@ -91,7 +91,7 @@
+ #endif
+ int
+-arp_cache_lookup(in_addr_t ip, struct ether_addr *ether)
++arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char *lif)
+ {
+       int sock;
+       struct arpreq ar;
+@@ -99,7 +99,7 @@
+       
+       memset((char *)&ar, 0, sizeof(ar));
+ #ifdef __linux__
+-      strncpy(ar.arp_dev, "eth0", sizeof(ar.arp_dev));   /* XXX - *sigh* */
++      strncpy(ar.arp_dev, lif, strlen(lif));
+ #endif
+       sin = (struct sockaddr_in *)&ar.arp_pa;
+       sin->sin_family = AF_INET;
+diff -urN dsniff.old/arp.h dsniff.dev/arp.h
+--- dsniff.old/arp.h   2001-03-15 09:27:08.000000000 +0100
++++ dsniff.dev/arp.h   2006-03-03 01:42:23.000000000 +0100
+@@ -11,6 +11,6 @@
+ #ifndef _ARP_H_
+ #define _ARP_H_
+-int   arp_cache_lookup(in_addr_t ip, struct ether_addr *ether);
++int   arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char *lif);
+ #endif /* _ARP_H_ */
+diff -urN dsniff.old/arpspoof.c dsniff.dev/arpspoof.c
+--- dsniff.old/arpspoof.c      2001-03-15 09:32:58.000000000 +0100
++++ dsniff.dev/arpspoof.c      2006-03-03 01:42:00.000000000 +0100
+@@ -113,7 +113,7 @@
+       int i = 0;
+       do {
+-              if (arp_cache_lookup(ip, mac) == 0)
++              if (arp_cache_lookup(ip, mac, intf) == 0)
+                       return (1);
+ #ifdef __linux__
+               /* XXX - force the kernel to arp. feh. */
diff --git a/net/dsniff/patches/001-decode_pop.patch b/net/dsniff/patches/001-decode_pop.patch
new file mode 100644 (file)
index 0000000..24e1a47
--- /dev/null
@@ -0,0 +1,122 @@
+diff --git a/decode_pop.c b/decode_pop.c
+index 04044f5..767da41 100644
+--- a/decode_pop.c
++++ b/decode_pop.c
+@@ -6,6 +6,8 @@
+  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
+  *
+  * $Id: decode_pop.c,v 1.4 2001/03/15 08:33:02 dugsong Exp $
++ *
++ * Rewritten by Stefan Tomanek 2011 <stefan@pico.ruhr.de>
+  */
+ #include "config.h"
+@@ -45,32 +47,88 @@ int
+ decode_pop(u_char *buf, int len, u_char *obuf, int olen)
+ {
+       char *p;
++      char *s;
++      int n;
+       int i, j;
++      char *user;
++      char *password;
++      enum {
++              NONE,
++              AUTHPLAIN,
++              AUTHLOGIN,
++              USERPASS
++      } mode = NONE;
++
+       
+       obuf[0] = '\0';
+       
+       for (p = strtok(buf, "\r\n"); p != NULL; p = strtok(NULL, "\r\n")) {
+-              if (strncasecmp(p, "AUTH PLAIN", 10) == 0 ||
+-                  strncasecmp(p, "AUTH LOGIN", 10) == 0) {
+-                      strlcat(obuf, p, olen);
+-                      strlcat(obuf, "\n", olen);
+-                      
+-                      /* Decode SASL auth. */
+-                      for (i = 0; i < 2 && (p = strtok(NULL, "\r\n")); i++) {
+-                              strlcat(obuf, p, olen);
+-                              j = base64_pton(p, p, strlen(p));
+-                              p[j] = '\0';
+-                              strlcat(obuf, " [", olen);
+-                              strlcat(obuf, p, olen);
+-                              strlcat(obuf, "]\n", olen);
++              if (mode == NONE) {
++                      user = NULL;
++                      password = NULL;
++                      if (strncasecmp(p, "AUTH PLAIN", 10) == 0) {
++                              mode = AUTHPLAIN;
++                              continue;
++                      }
++                      if (strncasecmp(p, "AUTH LOGIN", 10) == 0) {
++                              mode = AUTHLOGIN;
++                              continue;
++                      }
++                      if (strncasecmp(p, "USER ", 5) == 0) {
++                              mode = USERPASS;
++                              /* the traditional login cuts right to the case,
++                               * so no continue here
++                               */
+                       }
+               }
+-              /* Save regular POP2, POP3 auth info. */
+-              else if (strncasecmp(p, "USER ", 5) == 0 ||
+-                       strncasecmp(p, "PASS ", 5) == 0 ||
+-                       strncasecmp(p, "HELO ", 5) == 0) {
+-                      strlcat(obuf, p, olen);
+-                      strlcat(obuf, "\n", olen);
++              printf("(%d) %s\n", mode, p);
++              if (mode == USERPASS) {
++                      if (strncasecmp(p, "USER ", 5) == 0) {
++                              user = &p[5];
++                      } else if (strncasecmp(p, "PASS ", 5) == 0) {
++                              password = &p[5];
++                      }
++              }
++
++              if (mode == AUTHPLAIN) {
++                      j = base64_pton(p, p, strlen(p));
++                      p[j] = '\0';
++                      n = 0;
++                      s = p;
++                      /* p consists of three parts, divided by \0 */
++                      while (s <= &p[j] && n<=3) {
++                              if (n == 0) {
++                                      /* we do not process this portion yet */
++                              } else if (n == 1) {
++                                      user = s;
++                              } else if (n == 2) {
++                                      password = s;
++                              }
++                              n++;
++                              while (*s) s++;
++                              s++;
++                      }
++              }
++
++              if (mode == AUTHLOGIN) {
++                      j = base64_pton(p, p, strlen(p));
++                      p[j] = '\0';
++                      if (! user) {
++                              user = p;
++                      } else {
++                              password = p;
++                              /* got everything we need :-) */
++                      }
++              }
++
++              if (user && password) {
++                      strlcat(obuf, "\nusername [", olen);
++                      strlcat(obuf, user, olen);
++                      strlcat(obuf, "] password [", olen);
++                      strlcat(obuf, password, olen);
++                      strlcat(obuf, "]\n", olen);
++
++                      mode = NONE;
+               }
+       }
+       return (strlen(obuf));
+
diff --git a/net/dsniff/patches/001-dns.patch b/net/dsniff/patches/001-dns.patch
new file mode 100644 (file)
index 0000000..e5cf8b2
--- /dev/null
@@ -0,0 +1,704 @@
+diff -Nur dsniff-2.3/dns.c dsniff-2.3.patched/dns.c
+--- dsniff-2.3/dns.c   1970-01-01 01:00:00.000000000 +0100
++++ dsniff-2.3.patched/dns.c   2005-06-09 14:06:36.000000000 +0200
+@@ -0,0 +1,677 @@
++/*
++ * Copyright (c) 1985, 1993
++ *    The Regents of the University of California.  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.
++ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
++ */
++
++/*
++ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
++ * 
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies, and that
++ * the name of Digital Equipment Corporation not be used in advertising or
++ * publicity pertaining to distribution of the document or software without
++ * specific, written prior permission.
++ * 
++ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
++ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
++ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ * SOFTWARE.
++ */
++
++/*
++ * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
++ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
++ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ * SOFTWARE.
++ */
++
++/*
++ * Copyright (c) 1996,1999 by Internet Software Consortium.
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
++ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
++ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ * SOFTWARE.
++ */
++
++/*
++ *
++ * DNS helper functions not implemented in uclibc
++ *
++ */
++
++
++#include <sys/types.h>
++#include <sys/param.h>
++#include <netinet/in.h>
++#include <arpa/nameser.h>
++#include <ctype.h>
++#include <resolv.h>
++#include <stdio.h>
++#include <string.h>
++#include <unistd.h>
++
++static const char     digits[] = "0123456789";
++
++/* Forward. */
++
++static int            special(int);
++static int            printable(int);
++static int            dn_find(const u_char *, const u_char *,
++                              const u_char * const *,
++                              const u_char * const *);
++
++
++/*
++ * ns_name_ntop(src, dst, dstsiz)
++ *    Convert an encoded domain name to printable ascii as per RFC1035.
++ * return:
++ *    Number of bytes written to buffer, or -1 (with errno set)
++ * notes:
++ *    The root is returned as "."
++ *    All other domains are returned in non absolute form
++ */
++int
++ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
++      const u_char *cp;
++      char *dn, *eom;
++      u_char c;
++      u_int n;
++
++      cp = src;
++      dn = dst;
++      eom = dst + dstsiz;
++
++      while ((n = *cp++) != 0) {
++              if ((n & NS_CMPRSFLGS) != 0) {
++                      /* Some kind of compression pointer. */
++                      return (-1);
++              }
++              if (dn != dst) {
++                      if (dn >= eom) {
++                              return (-1);
++                      }
++                      *dn++ = '.';
++              }
++              if (dn + n >= eom) {
++                      return (-1);
++              }
++              for ((void)NULL; n > 0; n--) {
++                      c = *cp++;
++                      if (special(c)) {
++                              if (dn + 1 >= eom) {
++                                      return (-1);
++                              }
++                              *dn++ = '\\';
++                              *dn++ = (char)c;
++                      } else if (!printable(c)) {
++                              if (dn + 3 >= eom) {
++                                      return (-1);
++                              }
++                              *dn++ = '\\';
++                              *dn++ = digits[c / 100];
++                              *dn++ = digits[(c % 100) / 10];
++                              *dn++ = digits[c % 10];
++                      } else {
++                              if (dn >= eom) {
++                                      return (-1);
++                              }
++                              *dn++ = (char)c;
++                      }
++              }
++      }
++      if (dn == dst) {
++              if (dn >= eom) {
++                      return (-1);
++              }
++              *dn++ = '.';
++      }
++      if (dn >= eom) {
++              return (-1);
++      }
++      *dn++ = '\0';
++      return (dn - dst);
++}
++
++/*
++ * ns_name_pton(src, dst, dstsiz)
++ *    Convert a ascii string into an encoded domain name as per RFC1035.
++ * return:
++ *    -1 if it fails
++ *    1 if string was fully qualified
++ *    0 is string was not fully qualified
++ * notes:
++ *    Enforces label and domain length limits.
++ */
++
++int
++ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
++      u_char *label, *bp, *eom;
++      int c, n, escaped;
++      char *cp;
++
++      escaped = 0;
++      bp = dst;
++      eom = dst + dstsiz;
++      label = bp++;
++
++      while ((c = *src++) != 0) {
++              if (escaped) {
++                      if ((cp = strchr(digits, c)) != NULL) {
++                              n = (cp - digits) * 100;
++                              if ((c = *src++) == 0 ||
++                                  (cp = strchr(digits, c)) == NULL) {
++                                      return (-1);
++                              }
++                              n += (cp - digits) * 10;
++                              if ((c = *src++) == 0 ||
++                                  (cp = strchr(digits, c)) == NULL) {
++                                      return (-1);
++                              }
++                              n += (cp - digits);
++                              if (n > 255) {
++                                      return (-1);
++                              }
++                              c = n;
++                      }
++                      escaped = 0;
++              } else if (c == '\\') {
++                      escaped = 1;
++                      continue;
++              } else if (c == '.') {
++                      c = (bp - label - 1);
++                      if ((c & NS_CMPRSFLGS) != 0) {  /* Label too big. */
++                              return (-1);
++                      }
++                      if (label >= eom) {
++                              return (-1);
++                      }
++                      *label = c;
++                      /* Fully qualified ? */
++                      if (*src == '\0') {
++                              if (c != 0) {
++                                      if (bp >= eom) {
++                                              return (-1);
++                                      }
++                                      *bp++ = '\0';
++                              }
++                              if ((bp - dst) > MAXCDNAME) {
++                                      return (-1);
++                              }
++                              return (1);
++                      }
++                      if (c == 0 || *src == '.') {
++                              return (-1);
++                      }
++                      label = bp++;
++                      continue;
++              }
++              if (bp >= eom) {
++                      return (-1);
++              }
++              *bp++ = (u_char)c;
++      }
++      c = (bp - label - 1);
++      if ((c & NS_CMPRSFLGS) != 0) {          /* Label too big. */
++              return (-1);
++      }
++      if (label >= eom) {
++              return (-1);
++      }
++      *label = c;
++      if (c != 0) {
++              if (bp >= eom) {
++                      return (-1);
++              }
++              *bp++ = 0;
++      }
++      if ((bp - dst) > MAXCDNAME) {   /* src too big */
++              return (-1);
++      }
++      return (0);
++}
++
++/*
++ * ns_name_ntol(src, dst, dstsiz)
++ *    Convert a network strings labels into all lowercase.
++ * return:
++ *    Number of bytes written to buffer, or -1 (with errno set)
++ * notes:
++ *    Enforces label and domain length limits.
++ */
++
++int
++ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) {
++      const u_char *cp;
++      u_char *dn, *eom;
++      u_char c;
++      u_int n;
++
++      cp = src;
++      dn = dst;
++      eom = dst + dstsiz;
++
++      while ((n = *cp++) != 0) {
++              if ((n & NS_CMPRSFLGS) != 0) {
++                      /* Some kind of compression pointer. */
++                      return (-1);
++              }
++              *dn++ = n;
++              if (dn + n >= eom) {
++                      return (-1);
++              }
++              for ((void)NULL; n > 0; n--) {
++                      c = *cp++;
++                      if (isupper(c))
++                              *dn++ = tolower(c);
++                      else
++                              *dn++ = c;
++              }
++      }
++      *dn++ = '\0';
++      return (dn - dst);
++}
++
++/*
++ * ns_name_unpack(msg, eom, src, dst, dstsiz)
++ *    Unpack a domain name from a message, source may be compressed.
++ * return:
++ *    -1 if it fails, or consumed octets if it succeeds.
++ */
++int
++ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
++             u_char *dst, size_t dstsiz)
++{
++      const u_char *srcp, *dstlim;
++      u_char *dstp;
++      int n, len, checked;
++
++      len = -1;
++      checked = 0;
++      dstp = dst;
++      srcp = src;
++      dstlim = dst + dstsiz;
++      if (srcp < msg || srcp >= eom) {
++              return (-1);
++      }
++      /* Fetch next label in domain name. */
++      while ((n = *srcp++) != 0) {
++              /* Check for indirection. */
++              switch (n & NS_CMPRSFLGS) {
++              case 0:
++                      /* Limit checks. */
++                      if (dstp + n + 1 >= dstlim || srcp + n >= eom) {
++                              return (-1);
++                      }
++                      checked += n + 1;
++                      *dstp++ = n;
++                      memcpy(dstp, srcp, n);
++                      dstp += n;
++                      srcp += n;
++                      break;
++
++              case NS_CMPRSFLGS:
++                      if (srcp >= eom) {
++                              return (-1);
++                      }
++                      if (len < 0)
++                              len = srcp - src + 1;
++                      srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
++                      if (srcp < msg || srcp >= eom) {  /* Out of range. */
++                              return (-1);
++                      }
++                      checked += 2;
++                      /*
++                       * Check for loops in the compressed name;
++                       * if we've looked at the whole message,
++                       * there must be a loop.
++                       */
++                      if (checked >= eom - msg) {
++                              return (-1);
++                      }
++                      break;
++
++              default:
++                      return (-1);                    /* flag error */
++              }
++      }
++      *dstp = '\0';
++      if (len < 0)
++              len = srcp - src;
++      return (len);
++}
++
++/*
++ * ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr)
++ *    Pack domain name 'domain' into 'comp_dn'.
++ * return:
++ *    Size of the compressed name, or -1.
++ * notes:
++ *    'dnptrs' is an array of pointers to previous compressed names.
++ *    dnptrs[0] is a pointer to the beginning of the message. The array
++ *    ends with NULL.
++ *    'lastdnptr' is a pointer to the end of the array pointed to
++ *    by 'dnptrs'.
++ * Side effects:
++ *    The list of pointers in dnptrs is updated for labels inserted into
++ *    the message as we compress the name.  If 'dnptr' is NULL, we don't
++ *    try to compress names. If 'lastdnptr' is NULL, we don't update the
++ *    list.
++ */
++int
++ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
++           const u_char **dnptrs, const u_char **lastdnptr)
++{
++      u_char *dstp;
++      const u_char **cpp, **lpp, *eob, *msg;
++      const u_char *srcp;
++      int n, l, first = 1;
++
++      srcp = src;
++      dstp = dst;
++      eob = dstp + dstsiz;
++      lpp = cpp = NULL;
++      if (dnptrs != NULL) {
++              if ((msg = *dnptrs++) != NULL) {
++                      for (cpp = dnptrs; *cpp != NULL; cpp++)
++                              (void)NULL;
++                      lpp = cpp;      /* end of list to search */
++              }
++      } else
++              msg = NULL;
++
++      /* make sure the domain we are about to add is legal */
++      l = 0;
++      do {
++              n = *srcp;
++              if ((n & NS_CMPRSFLGS) != 0) {
++                      return (-1);
++              }
++              l += n + 1;
++              if (l > MAXCDNAME) {
++                      return (-1);
++              }
++              srcp += n + 1;
++      } while (n != 0);
++
++      /* from here on we need to reset compression pointer array on error */
++      srcp = src;
++      do {
++              /* Look to see if we can use pointers. */
++              n = *srcp;
++              if (n != 0 && msg != NULL) {
++                      l = dn_find(srcp, msg, (const u_char * const *)dnptrs,
++                                  (const u_char * const *)lpp);
++                      if (l >= 0) {
++                              if (dstp + 1 >= eob) {
++                                      goto cleanup;
++                              }
++                              *dstp++ = (l >> 8) | NS_CMPRSFLGS;
++                              *dstp++ = l % 256;
++                              return (dstp - dst);
++                      }
++                      /* Not found, save it. */
++                      if (lastdnptr != NULL && cpp < lastdnptr - 1 &&
++                          (dstp - msg) < 0x4000 && first) {
++                              *cpp++ = dstp;
++                              *cpp = NULL;
++                              first = 0;
++                      }
++              }
++              /* copy label to buffer */
++              if (n & NS_CMPRSFLGS) {         /* Should not happen. */
++                      goto cleanup;
++              }
++              if (dstp + 1 + n >= eob) {
++                      goto cleanup;
++              }
++              memcpy(dstp, srcp, n + 1);
++              srcp += n + 1;
++              dstp += n + 1;
++      } while (n != 0);
++
++      if (dstp > eob) {
++cleanup:
++              if (msg != NULL)
++                      *lpp = NULL;
++              return (-1);
++      } 
++      return (dstp - dst);
++}
++
++/*
++ * ns_name_uncompress(msg, eom, src, dst, dstsiz)
++ *    Expand compressed domain name to presentation format.
++ * return:
++ *    Number of bytes read out of `src', or -1 (with errno set).
++ * note:
++ *    Root domain returns as "." not "".
++ */
++int
++ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
++                 char *dst, size_t dstsiz)
++{
++      u_char tmp[NS_MAXCDNAME];
++      int n;
++      
++      if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1)
++              return (-1);
++      if (ns_name_ntop(tmp, dst, dstsiz) == -1)
++              return (-1);
++      return (n);
++}
++
++/*
++ * ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr)
++ *    Compress a domain name into wire format, using compression pointers.
++ * return:
++ *    Number of bytes consumed in `dst' or -1 (with errno set).
++ * notes:
++ *    'dnptrs' is an array of pointers to previous compressed names.
++ *    dnptrs[0] is a pointer to the beginning of the message.
++ *    The list ends with NULL.  'lastdnptr' is a pointer to the end of the
++ *    array pointed to by 'dnptrs'. Side effect is to update the list of
++ *    pointers for labels inserted into the message as we compress the name.
++ *    If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
++ *    is NULL, we don't update the list.
++ */
++int
++ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
++               const u_char **dnptrs, const u_char **lastdnptr)
++{
++      u_char tmp[NS_MAXCDNAME];
++
++      if (ns_name_pton(src, tmp, sizeof tmp) == -1)
++              return (-1);
++      return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
++}
++
++/*
++ * special(ch)
++ *    Thinking in noninternationalized USASCII (per the DNS spec),
++ *    is this characted special ("in need of quoting") ?
++ * return:
++ *    boolean.
++ */
++static int
++special(int ch) {
++      switch (ch) {
++      case 0x22: /* '"' */
++      case 0x2E: /* '.' */
++      case 0x3B: /* ';' */
++      case 0x5C: /* '\\' */
++      /* Special modifiers in zone files. */
++      case 0x40: /* '@' */
++      case 0x24: /* '$' */
++              return (1);
++      default:
++              return (0);
++      }
++}
++
++/*
++ * printable(ch)
++ *    Thinking in noninternationalized USASCII (per the DNS spec),
++ *    is this character visible and not a space when printed ?
++ * return:
++ *    boolean.
++ */
++static int
++printable(int ch) {
++      return (ch > 0x20 && ch < 0x7f);
++}
++
++/*
++ *    Thinking in noninternationalized USASCII (per the DNS spec),
++ *    convert this character to lower case if it's upper case.
++ */
++static int
++mklower(int ch) {
++      if (ch >= 0x41 && ch <= 0x5A)
++              return (ch + 0x20);
++      return (ch);
++}
++
++/*
++ * dn_find(domain, msg, dnptrs, lastdnptr)
++ *    Search for the counted-label name in an array of compressed names.
++ * return:
++ *    offset from msg if found, or -1.
++ * notes:
++ *    dnptrs is the pointer to the first name on the list,
++ *    not the pointer to the start of the message.
++ */
++static int
++dn_find(const u_char *domain, const u_char *msg,
++      const u_char * const *dnptrs,
++      const u_char * const *lastdnptr)
++{
++      const u_char *dn, *cp, *sp;
++      const u_char * const *cpp;
++      u_int n;
++
++      for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
++              sp = *cpp;
++              /*
++               * terminate search on:
++               * root label
++               * compression pointer
++               * unusable offset
++               */
++              while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 &&
++                     (sp - msg) < 0x4000) {
++                      dn = domain;
++                      cp = sp;
++                      while ((n = *cp++) != 0) {
++                              /*
++                               * check for indirection
++                               */
++                              switch (n & NS_CMPRSFLGS) {
++                              case 0:         /* normal case, n == len */
++                                      if (n != *dn++)
++                                              goto next;
++                                      for ((void)NULL; n > 0; n--)
++                                              if (mklower(*dn++) !=
++                                                  mklower(*cp++))
++                                                      goto next;
++                                      /* Is next root for both ? */
++                                      if (*dn == '\0' && *cp == '\0')
++                                              return (sp - msg);
++                                      if (*dn)
++                                              continue;
++                                      goto next;
++
++                              case NS_CMPRSFLGS:      /* indirection */
++                                      cp = msg + (((n & 0x3f) << 8) | *cp);
++                                      break;
++
++                              default:        /* illegal type */
++                                      return (-1);
++                              }
++                      }
++ next:
++                      sp += *sp + 1;
++              }
++      }
++      return (-1);
++}
++
++/*
++ * Expand compressed domain name 'comp_dn' to full domain name.
++ * 'msg' is a pointer to the begining of the message,
++ * 'eomorig' points to the first location after the message,
++ * 'exp_dn' is a pointer to a buffer of size 'length' for the result.
++ * Return size of compressed name or -1 if there was an error.
++ */
++int
++dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
++        char *dst, int dstsiz)
++{
++      int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz);
++
++      if (n > 0 && dst[0] == '.')
++              dst[0] = '\0';
++      return (n);
++}
++
++/*
++ * Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
++ * Return the size of the compressed name or -1.
++ * 'length' is the size of the array pointed to by 'comp_dn'.
++ */
++int
++dn_comp(const char *src, u_char *dst, int dstsiz,
++      u_char **dnptrs, u_char **lastdnptr)
++{
++      return (ns_name_compress(src, dst, (size_t)dstsiz,
++                               (const u_char **)dnptrs,
++                               (const u_char **)lastdnptr));
++}
++
+diff -Nur dsniff-2.3/Makefile.in dsniff-2.3.patched/Makefile.in
+--- dsniff-2.3/Makefile.in     2000-12-15 21:03:26.000000000 +0100
++++ dsniff-2.3.patched/Makefile.in     2005-06-09 14:03:18.000000000 +0200
+@@ -51,7 +51,7 @@
+         pathnames.h pcaputil.h record.h rpc.h tcp_raw.h trigger.h \
+         version.h vroot.h
+-SRCS  = asn1.c base64.c buf.c hex.c magic.c mount.c pcaputil.c rpc.c \
++SRCS  = asn1.c base64.c buf.c dns.c hex.c magic.c mount.c pcaputil.c rpc.c \
+         tcp_raw.c trigger.c record.c dsniff.c decode.c decode_aim.c \
+         decode_citrix.c decode_cvs.c decode_ftp.c decode_hex.c \
+         decode_http.c decode_icq.c decode_imap.c decode_irc.c \
+@@ -99,8 +99,8 @@
+ arpspoof: arpspoof.o arp.o
+       $(CC) $(LDFLAGS) -o $@ arpspoof.o arp.o $(LIBS) $(PCAPLIB) $(LNETLIB)
+-dnsspoof: dnsspoof.o pcaputil.o
+-      $(CC) $(LDFLAGS) -o $@ dnsspoof.o pcaputil.o $(LIBS) $(PCAPLIB) $(LNETLIB)
++dnsspoof: dnsspoof.o pcaputil.o dns.o
++      $(CC) $(LDFLAGS) -o $@ dnsspoof.o pcaputil.o dns.o $(LIBS) $(PCAPLIB) $(LNETLIB)
+ filesnarf: nfs_prot.o filesnarf.o pcaputil.o rpc.o
+       $(CC) $(LDFLAGS) -o $@ filesnarf.o nfs_prot.o pcaputil.o rpc.o $(LIBS) $(NIDSLIB) $(PCAPLIB) $(LNETLIB)
diff --git a/net/dsniff/patches/003-gdbm.patch b/net/dsniff/patches/003-gdbm.patch
new file mode 100644 (file)
index 0000000..67be3e5
--- /dev/null
@@ -0,0 +1,206 @@
+Index: dsniff-2.4/configure
+===================================================================
+--- dsniff-2.4.orig/configure  2010-11-03 23:42:49.466000001 +0100
++++ dsniff-2.4/configure       2010-11-03 23:42:52.921000006 +0100
+@@ -16,6 +16,8 @@
+ ac_help="$ac_help
+   --with-db=DIR           use Berkeley DB (with --enable-compat185) in DIR"
+ ac_help="$ac_help
++  --with-gdbm=DIR         use GNU DBM in DIR"
++ac_help="$ac_help
+   --with-libpcap=DIR      use libpcap in DIR"
+ ac_help="$ac_help
+   --with-libnet=DIR       use libnet in DIR"
+@@ -3059,7 +3061,40 @@
+ fi
++echo $ac_n "checking for libgdbm""... $ac_c" 1>&6
++echo "configure:3059: checking for libgdbm" >&5
++# Check whether --with-gdbm or --without-gdbm was given.
++if test "${with_gdbm+set}" = set; then
++  withval="$with_gdbm"
++   case "$withval" in
++  yes|no)
++     echo "$ac_t""no" 1>&6
++     ;;
++  *)
++     echo "$ac_t""$withval" 1>&6
++     if test -f $withval/include/gdbm.h -a -f $withval/lib/libgdbm.a; then
++        owd=`pwd`
++        if cd $withval; then withval=`pwd`; cd $owd; fi
++      DBINC="-I$withval/include"
++      DBLIB="-L$withval/lib -lgdbm"
++     else
++        { echo "configure: error: gdbm.h or libgdbm.a not found in $withval" 1>&2; exit 1; }
++     fi
++     ;;
++  esac 
++else
++   if test -f ${prefix}/include/gdbm.h; then
++     LNETINC="-I${prefix}/include"
++     LNETLIB="-L${prefix}/lib -lgdbm"
++  elif test -f /usr/include/gdbm.h; then
++     LNETLIB="-lgdbm"
++  else
++     echo "$ac_t""no" 1>&6
++     { echo "configure: error: libgdbm not found" 1>&2; exit 1; }
++  fi
++  echo "$ac_t""yes" 1>&6 
++fi
+ echo $ac_n "checking for libnet""... $ac_c" 1>&6
+Index: dsniff-2.4/record.c
+===================================================================
+--- dsniff-2.4.orig/record.c   2010-11-03 23:42:49.471000001 +0100
++++ dsniff-2.4/record.c        2010-11-03 23:42:52.922000005 +0100
+@@ -15,12 +15,7 @@
+ #include <stdio.h>
+ #include <time.h>
+ #include <md5.h>
+-#ifdef HAVE_DB_185_H
+-#define DB_LIBRARY_COMPATIBILITY_API
+-#include <db_185.h>
+-#elif HAVE_DB_H
+-#include <db.h>
+-#endif
++#include <gdbm.h>
+ #include <libnet.h>
+ #include "options.h"
+@@ -37,7 +32,7 @@
+       struct netobj   data;
+ };
+       
+-static DB *db;
++GDBM_FILE dbf;
+ static int
+ xdr_rec(XDR *xdrs, struct rec *rec)
+@@ -64,7 +59,6 @@
+       
+       tm = localtime(&rec->time);
+       strftime(tstr, sizeof(tstr), "%x %X", tm);
+-      
+       srcp = libnet_host_lookup(rec->src, Opt_dns);
+       dstp = libnet_host_lookup(rec->dst, Opt_dns);
+@@ -89,10 +83,10 @@
+       fflush(stdout);
+ }
+-static DBT *
++static datum
+ record_hash(struct rec *rec)
+ {
+-      static DBT key;
++      static datum key;
+       static u_char hash[16];
+       MD5_CTX ctx;
+@@ -105,16 +99,16 @@
+       MD5Update(&ctx, rec->data.n_bytes, rec->data.n_len);
+       MD5Final(hash, &ctx);
+-      key.data = hash;
+-      key.size = sizeof(hash);
++      key.dptr = hash;
++      key.dsize = sizeof(hash);
+       
+-      return (&key);
++      return (key);
+ }
+ static int
+ record_save(struct rec *rec)
+ {
+-      DBT *key, data;
++      datum key, data;
+       XDR xdrs;
+       u_char buf[2048];
+       
+@@ -123,15 +117,15 @@
+       if (!xdr_rec(&xdrs, rec))
+               return (0);
+       
+-      data.data = buf;
+-      data.size = xdr_getpos(&xdrs);
++      data.dptr = buf;
++      data.dsize = xdr_getpos(&xdrs);
+       
+       xdr_destroy(&xdrs);
+       key = record_hash(rec);
+       
+-      if (db->put(db, key, &data, R_NOOVERWRITE) == 0)
+-              db->sync(db, 0);
++      if (gdbm_store(dbf, key, data, GDBM_INSERT) == 0)
++              gdbm_sync(dbf);
+       
+       return (1);
+ }
+@@ -139,18 +133,22 @@
+ void
+ record_dump(void)
+ {
+-      DBT key, data;
++      datum nextkey, key, content;
+       XDR xdrs;
+       struct rec rec;
+       
+-      while (db->seq(db, &key, &data, R_NEXT) == 0) { 
++      key = gdbm_firstkey(dbf);
++      while (key.dptr) {      
++              nextkey = gdbm_nextkey(dbf, key);
++              content = gdbm_fetch(dbf, key);
+               memset(&rec, 0, sizeof(rec));
+-              xdrmem_create(&xdrs, data.data, data.size, XDR_DECODE);
+-              
++              xdrmem_create(&xdrs, content.dptr, content.dsize, XDR_DECODE);
+               if (xdr_rec(&xdrs, &rec)) {
+                       record_print(&rec);
+               }
+               xdr_destroy(&xdrs);
++              free(key.dptr);
++              key = nextkey;
+       }
+ }
+@@ -158,16 +156,23 @@
+ record_init(char *file)
+ {
+       int flags, mode;
+-      
++      // needed for gdbm_open, which does not have the option to create
++      // a database in memory
++      if(file == NULL) {
++              char *record_file = "/tmp/.dsniff.db";
++              file = record_file;
++      }
++
+       if (Opt_read) {
+-              flags = O_RDONLY;
++              flags = GDBM_READER;
+               mode = 0;
+       }
+       else {
+-              flags = O_RDWR|O_CREAT;
++              flags = GDBM_WRCREAT;
+               mode = S_IRUSR|S_IWUSR;
+       }
+-      if ((db = dbopen(file, flags, mode, DB_BTREE, NULL)) == NULL)
++
++      if ((dbf = gdbm_open(file, 1024, flags, mode, NULL)) == NULL)
+               return (0);
+       return (1);
+@@ -206,6 +211,6 @@
+ void
+ record_close(void)
+ {
+-      db->close(db);
++      gdbm_close(dbf);
+ }
diff --git a/net/dsniff/patches/004-no_yp.patch b/net/dsniff/patches/004-no_yp.patch
new file mode 100644 (file)
index 0000000..774e04e
--- /dev/null
@@ -0,0 +1,45 @@
+Index: dsniff-2.4/decode.c
+===================================================================
+--- dsniff-2.4.orig/decode.c   2010-11-03 23:42:49.419000001 +0100
++++ dsniff-2.4/decode.c        2010-11-03 23:42:56.481000002 +0100
+@@ -51,8 +51,6 @@
+ extern int decode_portmap(u_char *, int, u_char *, int);
+ extern int decode_mountd(u_char *, int, u_char *, int);
+ extern int decode_vrrp(u_char *, int, u_char *, int);
+-extern int decode_ypserv(u_char *, int, u_char *, int);
+-extern int decode_yppasswd(u_char *, int, u_char *, int);
+ static struct decode decodes[] = {
+       { "hex",        decode_hex },
+@@ -88,8 +86,6 @@
+       { "irc",        decode_irc },
+       { "portmap",    decode_portmap },
+       { "mountd",     decode_mountd },
+-      { "ypserv",     decode_ypserv },
+-      { "yppasswd",   decode_yppasswd },
+       { NULL }
+ };
+Index: dsniff-2.4/dsniff.services
+===================================================================
+--- dsniff-2.4.orig/dsniff.services    2010-11-03 23:42:49.429000001 +0100
++++ dsniff-2.4/dsniff.services 2010-11-03 23:42:56.481000002 +0100
+@@ -66,5 +66,3 @@
+ aim           9898/tcp
+ pcanywhere    65301/tcp
+ mountd                100005/rpc
+-ypserv                100004/rpc
+-yppasswd      100009/rpc
+Index: dsniff-2.4/Makefile.in
+===================================================================
+--- dsniff-2.4.orig/Makefile.in        2010-11-03 23:42:51.736998874 +0100
++++ dsniff-2.4/Makefile.in     2010-11-03 23:42:56.481000002 +0100
+@@ -60,7 +60,7 @@
+         decode_pop.c decode_portmap.c decode_postgresql.c decode_pptp.c \
+         decode_rip.c decode_rlogin.c decode_smb.c decode_smtp.c \
+         decode_sniffer.c decode_snmp.c decode_socks.c decode_tds.c \
+-        decode_telnet.c decode_vrrp.c decode_yp.c decode_x11.c
++        decode_telnet.c decode_vrrp.c decode_x11.c
+ GEN   = mount.h mount.c nfs_prot.h nfs_prot.c
diff --git a/net/dsniff/patches/005-openssl_fix.patch b/net/dsniff/patches/005-openssl_fix.patch
new file mode 100644 (file)
index 0000000..1b2f9e7
--- /dev/null
@@ -0,0 +1,11 @@
+--- dsniff-2.4b1.orig/sshcrypto.c
++++ dsniff-2.4b1/sshcrypto.c
+@@ -14,6 +14,8 @@
+ #include <sys/types.h>
+ #include <openssl/ssl.h>
++#include <openssl/blowfish.h>
++#include <openssl/des.h>
+ #include <err.h>
+ #include <stdio.h>
diff --git a/net/dsniff/patches/006-pcap_header.patch b/net/dsniff/patches/006-pcap_header.patch
new file mode 100644 (file)
index 0000000..6836557
--- /dev/null
@@ -0,0 +1,13 @@
+Index: dsniff-2.4/configure
+===================================================================
+--- dsniff-2.4.orig/configure  2010-11-03 23:42:52.921000006 +0100
++++ dsniff-2.4/configure       2010-11-03 23:43:00.504000001 +0100
+@@ -3033,7 +3033,7 @@
+       PCAPINC="-I$withval -I$withval/bpf"
+       PCAPLIB="-L$withval -lpcap"
+      elif test -f $withval/include/pcap.h -a \
+-             -f $withval/include/net/bpf.h -a \
++             -f $withval/include/pcap-bpf.h -a \
+              -f $withval/lib/libpcap.a; then
+       owd=`pwd`
+       if cd $withval; then withval=`pwd`; cd $owd; fi
diff --git a/net/dsniff/patches/007-time_h.patch b/net/dsniff/patches/007-time_h.patch
new file mode 100644 (file)
index 0000000..280b8c1
--- /dev/null
@@ -0,0 +1,22 @@
+diff -urNad --exclude=CVS --exclude=.svn dsniff-2.4b1/msgsnarf.c dsniff-2.4b1/msgsnarf.c
+--- dsniff-2.4b1/msgsnarf.c    2001-03-15 08:33:04.000000000 +0000
++++ dsniff-2.4b1/msgsnarf.c    2005-07-11 20:15:50.000000000 +0000
+@@ -23,6 +23,7 @@
+ #include <nids.h>
+ #include <pcap.h>
+ #include <pcaputil.h>
++#include <time.h>
+ #include "buf.h"
+ #include "decode.h"
+diff -urNad --exclude=CVS --exclude=.svn dsniff-2.4b1/sshow.c dsniff-2.4b1/sshow.c
+--- dsniff-2.4b1/sshow.c       2005-07-11 20:14:19.000000000 +0000
++++ dsniff-2.4b1/sshow.c       2005-07-11 20:15:26.000000000 +0000
+@@ -15,6 +15,7 @@
+ #include <sys/types.h>
+ #include <sys/times.h>
++#include <time.h>
+ #include <netinet/in_systm.h>
+ #include <netinet/in.h>
diff --git a/net/dsniff/patches/008-md5_include.patch b/net/dsniff/patches/008-md5_include.patch
new file mode 100644 (file)
index 0000000..f8d3829
--- /dev/null
@@ -0,0 +1,13 @@
+Index: dsniff-2.4/record.c
+===================================================================
+--- dsniff-2.4.orig/record.c   2010-11-03 23:43:14.268000004 +0100
++++ dsniff-2.4/record.c        2010-11-03 23:43:16.947000004 +0100
+@@ -14,7 +14,7 @@
+ #include <stdio.h>
+ #include <time.h>
+-#include <md5.h>
++#include "missing/md5.h"
+ #include <gdbm.h>
+ #include <libnet.h>
diff --git a/net/dsniff/patches/010-clk-tck-fix.patch b/net/dsniff/patches/010-clk-tck-fix.patch
new file mode 100644 (file)
index 0000000..cc15bef
--- /dev/null
@@ -0,0 +1,15 @@
+Index: dsniff-2.4/sshow.c
+===================================================================
+--- dsniff-2.4.orig/sshow.c    2010-11-03 23:41:56.335999997 +0100
++++ dsniff-2.4/sshow.c 2010-11-03 23:42:10.981000001 +0100
+@@ -42,6 +42,10 @@
+ #define HISTORY_SIZE                  16
++#ifndef CLK_TCK
++# define CLK_TCK      CLOCKS_PER_SEC
++#endif
++
+ typedef struct {
+       u_int min, max;
+ } range;
diff --git a/net/dsniff/patches/011-noint32.patch b/net/dsniff/patches/011-noint32.patch
new file mode 100644 (file)
index 0000000..4fef5a8
--- /dev/null
@@ -0,0 +1,12 @@
+diff --git a/nfs_prot.x b/nfs_prot.x
+index 1111dcc..f7392eb 100644
+--- a/nfs_prot.x
++++ b/nfs_prot.x
+@@ -193,7 +193,6 @@ const NFS3_WRITEVERFSIZE  = 8;
+ typedef u_int64_t     uint64;
+ typedef int64_t               int64;
+ typedef unsigned int  uint32;
+-typedef int           int32;
+ typedef string                filename3<>;
+ typedef string                nfspath3<>;
+ typedef uint64                fileid3;
diff --git a/net/dudders/Makefile b/net/dudders/Makefile
new file mode 100644 (file)
index 0000000..02549d8
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2010-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:=dudders
+PKG_VERSION:=1.04
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=1d368a86f3c284e95d260a94767a8ded
+
+PKG_BUILD_DEPENDS:=+libopenssl +libgcrypt
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dudders
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=+libopenssl +libgcrypt +libgpg-error
+  TITLE:=DNS Update SIG(0) client
+  MAINTAINER:=Dean Scarff <dos@scarff.id.au>
+  URL:=http://dudders.sourceforge.net/
+endef
+
+define Package/dudders/description
+  Dudders is a utility for updating DNS records.  It points
+  a domain name to a given IP address, using the RFC2136 DNS
+  UPDATE protocol and a SIG(0) signature.  It is designed with
+  embedded systems in mind.
+
+  You must have either libopenssl or libgcrypt installed to
+  use this package.
+endef
+
+define Package/dudders/conffiles
+/etc/config/dudders
+endef
+
+EXTRA_CFLAGS:= -DNDEBUG -std=gnu99
+
+CONFIGURE_ARGS+= \
+       --with-libgcrypt-prefix="$(STAGING_DIR)/usr"
+
+define Package/dudders/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dudders $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/dudders
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dudders/crypt_gcrypt.so \
+                      $(1)/usr/lib/dudders/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/dudders/crypt_openssl.so \
+                      $(1)/usr/lib/dudders/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/dudders.config $(1)/etc/config/dudders
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/dudders.hotplug $(1)/etc/hotplug.d/iface/50-dudders
+endef
+
+$(eval $(call BuildPackage,dudders))
diff --git a/net/dudders/files/dudders.config b/net/dudders/files/dudders.config
new file mode 100644 (file)
index 0000000..27dc4b6
--- /dev/null
@@ -0,0 +1,7 @@
+config dudders
+        option enabled  'no'
+        option tcp      'yes'
+        option keyfile '/tmp/dudders.private'
+        option keyname  'owner.example.com'
+        option hostname 'test.example.com'
+       option ttl       86400
diff --git a/net/dudders/files/dudders.hotplug b/net/dudders/files/dudders.hotplug
new file mode 100644 (file)
index 0000000..7e3026f
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+config_cb() {
+       local cfg="$CONFIG_SECTION"
+       local cfgtype
+       config_get cfgtype "$cfg" TYPE
+       dudders=/usr/bin/dudders
+
+       case "$cfgtype" in
+               dudders)
+                       config_get enabled  $cfg enabled
+                       [ "$enabled" = "yes" ] || return 0
+
+                       config_get tcp      $cfg tcp
+                       config_get keyname  $cfg keyname
+                       config_get mname    $cfg mname
+                       config_get zone     $cfg zone
+                       config_get keyfile  $cfg keyfile
+                       config_get hostname $cfg hostname
+                       config_get ttl      $cfg ttl
+
+                       [ -r "$keyfile" ] || return 1
+                       sleep 1
+                       interface=$(route -n 2>&- \
+                         |grep '^0.0.0.0' \
+                         |sed -e 's/.* \([^ ]\+\)$/\1/')
+                       [ -z "$interface" ] && return 0
+                       [ "$DEVICE" = "$interface" -o \
+                         "$IFNAME" = "$interface" -o \
+                         "$PPP_IFACE" = "$interface" ] || return 0
+                       ipaddr=${PPP_LOCAL:-${IPLOCAL:-$(ifconfig "$interface" \
+                           |grep -o 'addr:[^ ]\+' \
+                           |sed -e 's/addr://')}}
+                       OPTS=${keyname:+" -k '$keyname'"}
+                       [ "$tcp" = "yes" ] && OPTS=$OPTS" -T"
+                       OPTS=$OPTS${mname:+" -m '$mname'"}
+                       OPTS=$OPTS${zone:+" -z '$zone'"}
+                       eval $dudders -k $keyfile $OPTS $hostname $ttl $ipaddr
+               ;;
+       esac
+}
+case "${ACTION:-ifup}" in
+       ifup) config_load dudders ;;
+esac
diff --git a/net/e169-stats/Makefile b/net/e169-stats/Makefile
new file mode 100644 (file)
index 0000000..b72f182
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2010-2014 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:=e169-stats
+PKG_VERSION:=0.6
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.mavetju.org/download
+PKG_MD5SUM:=2f6f5b984faeec368a867e59cd2cc36d
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/e169-stats
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Huawei USB modem statistics
+  URL:=http://www.mavetju.org/weblog/html/00282.html
+  DEPENDS:=+libncurses
+endef
+
+define Package/e169-stats/description
+  Huawei E169 statistics, works with other Huawei's devices.
+endef
+
+MAKE_FLAGS += \
+       LDFLAGS="$(TARGET_LDFLAGS) -lncurses"
+
+define Package/e169-stats/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/e169-stats $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,e169-stats))
diff --git a/net/e169-stats/patches/01-make.patch b/net/e169-stats/patches/01-make.patch
new file mode 100644 (file)
index 0000000..e524efb
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ all: e169-stats
+ e169-stats: e169-stats.c
+-      gcc -Wall -o e169-stats e169-stats.c -lcurses
++      $(CC) $(CFLAGS) -Wall -o e169-stats e169-stats.c $(CPPFLAGS) $(LDFLAGS)
+ clean:
+       -rm e169-stats *.core
diff --git a/net/ekg/Makefile b/net/ekg/Makefile
new file mode 100644 (file)
index 0000000..772e811
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2009-2010 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:=ekg
+PKG_VERSION:=1.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ekg.chmurka.net/
+PKG_MD5SUM:=2aa92b56517fdf09d75519a105772b74
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ekg
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Instant Messaging
+  TITLE:=Eksperymentalny Klient Gadu-Gadu (Polish IM)
+  URL:=http://ekg.chmurka.net
+  DEPENDS:=+zlib +libncurses
+endef
+
+CONFIGURE_ARGS+= \
+       --without-c99-vsnprintf \
+       --without-bind \
+       --without-libgsm \
+       --without-libjpeg \
+       --without-libungif \
+       --without-openssl \
+       --disable-libgadu-openssl \
+       --enable-ui-ncurses \
+       --disable-ui-readline \
+
+CONFIGURE_VARS+= \
+       CFLAGS="$$$$CFLAGS $(TARGET_CPPFLAGS)" \
+       CFLAGS_LIBGADU="$$$$CFLAGS $(TARGET_CPPFLAGS)" \
+
+define Package/ekg/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ekg $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ekg))
diff --git a/net/ekg/patches/100-compile-fixes.patch b/net/ekg/patches/100-compile-fixes.patch
new file mode 100644 (file)
index 0000000..2f9ccbd
--- /dev/null
@@ -0,0 +1,62 @@
+Index: ekg-1.7/Makefile.in
+===================================================================
+--- ekg-1.7.orig/Makefile.in   2010-11-02 16:55:11.021994526 +0100
++++ ekg-1.7/Makefile.in        2010-11-02 16:59:57.189994991 +0100
+@@ -15,29 +15,31 @@
+ #
+-all:  configure libgadu @ekg@ @make_ekgwap@
++libgadu:=lib/libgadu.a
+-libgadu:
+-      cd lib && $(MAKE) all
++all: @ekg@ @make_ekgwap@
+-ekg:  
+-      cd src && $(MAKE) all
++$(libgadu): dep
++      $(MAKE) -C lib
+-make-ekgwap:
+-      cd ekgwap && $(MAKE) all
++ekg: $(libgadu)
++      $(MAKE) -C src
+-examples:
+-      cd examples && $(MAKE) all
++make-ekgwap: $(libgadu)
++      $(MAKE) -C ekgwap
++
++examples: $(libgadu)
++      $(MAKE) -C examples
+ #
+ dep:  dep-libgadu @dep_ekg@
+-dep-libgadu:
+-      cd lib && $(MAKE) dep
++dep-libgadu: configure
++      $(MAKE) -C lib dep
+-dep-ekg:
+-      cd src && $(MAKE) dep
++dep-ekg: configure
++      $(MAKE) -C src dep
+ #
+@@ -49,10 +51,10 @@
+ install:      all install-libgadu @install_ekg@ @install_ekgwap@
+ install-libgadu:
+-      cd lib && $(MAKE) install
++      $(MAKE) -C lib install
+ install-ekg:  install-ekg-data install-ekg-man
+-      cd src && $(MAKE) install
++      $(MAKE) -C src install
+ install-ekg-data:
+       $(INSTALL) -d $(DESTDIR)$(datadir)/ekg/themes
diff --git a/net/elinks/Makefile b/net/elinks/Makefile
new file mode 100644 (file)
index 0000000..af26ac1
--- /dev/null
@@ -0,0 +1,92 @@
+#
+# Copyright (C) 2006-2009 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:=elinks
+PKG_VERSION:=0.11.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://elinks.or.cz/download
+PKG_MD5SUM:=fcd087a6d2415cd4c6fd1db53dceb646
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/elinks
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl
+  TITLE:=A text based web browser
+  URL:=http://elinks.or.cz/
+endef
+
+define Package/elinks/description
+An advanced text based web browser
+endef
+
+SHVAR_TRANS:= \
+       $(STAGING_DIR_HOST)/bin/sed -e \
+       'y%*+%pp%;s%[^_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]%_%g'
+
+define Build/Configure
+ (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
+                x=`echo ac_cv_file_./features.conf | $(SHVAR_TRANS)` && export $$$${x}=yes && \
+                x=`echo ac_cv_file_$(abspath $(PKG_BUILD_DIR)/features.conf) | $(SHVAR_TRANS)` && export $$$${x}=yes && \
+                $(TARGET_CONFIGURE_OPTS) \
+                CFLAGS="$(TARGET_CFLAGS)" \
+                CPPFLAGS="$(TARGET_CPPFLAGS)" \
+                LDFLAGS="$(TARGET_LDFLAGS)" \
+                ./configure \
+                        --target=$(GNU_TARGET_NAME) \
+                        --host=$(GNU_TARGET_NAME) \
+                        --build=$(GNU_HOST_NAME) \
+                        --program-prefix="" \
+                        --program-suffix="" \
+                        --prefix=/usr \
+                        --exec-prefix=/usr \
+                        --bindir=/usr/bin \
+                        --datadir=/usr/share \
+                        --includedir=/usr/include \
+                        --infodir=/usr/share/info \
+                        --libdir=/usr/lib \
+                        --libexecdir=/usr/lib \
+                        --localstatedir=/var \
+                        --mandir=/usr/share/man \
+                        --sbindir=/usr/sbin \
+                        --sysconfdir=/etc \
+                        $(DISABLE_NLS) \
+                        --enable-small\
+                        --enable-256-colors\
+                        --disable-backtrace\
+                        --disable-data\
+                        --disable-formhist\
+                        --disable-leds \
+                        --disable-mailcap\
+                        --disable-mouse \
+                        --disable-smb \
+                        --disable-uri-rewrite\
+                        --disable-xbel \
+                        --without-bzlib \
+                        --without-gpm \
+                        --without-idn \
+                        --without-gnutls \
+                        --without-libiconv \
+                        --without-lua \
+                        --with-openssl="$(STAGING_DIR)/usr" \
+                        --without-spidermonkey\
+                        --without-x\
+                        --without-zlib \
+       );
+endef
+
+define Package/elinks/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/elinks $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,elinks))
diff --git a/net/elinks/patches/002-fix_avr32_compile b/net/elinks/patches/002-fix_avr32_compile
new file mode 100644 (file)
index 0000000..99a8874
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/config/config.sub
++++ b/config/config.sub
+@@ -239,7 +239,7 @@ case $basic_machine in
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+-      | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++      | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+@@ -313,7 +313,7 @@ case $basic_machine in
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+-      | avr-* \
++      | avr-* | avr32-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
diff --git a/net/etherpuppet/Makefile b/net/etherpuppet/Makefile
new file mode 100644 (file)
index 0000000..0851f84
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# 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:=etherpuppet
+PKG_REV:=90decf83d1d4
+PKG_VERSION:=0.3_r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://bitbucket.org/secdev/etherpuppet
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=hg
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/etherpuppet
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-tun
+  TITLE:=A voodoo doll for an Ethernet interface
+  URL:=http://www.secdev.org/projects/etherpuppet/
+  SUBMENU:=VPN
+endef
+
+define Package/etherpuppet/description
+  Etherpuppet is a small program for Linux that will create a virtual interface
+  (TUN/TAP) on one machine from the ethernet interface of another machine
+  through a TCP connection.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+  $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/$(PKG_NAME).c -o $(PKG_BUILD_DIR)/$(PKG_NAME)
+endef
+
+define Package/etherpuppet/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,etherpuppet))
diff --git a/net/ettercap/Makefile b/net/ettercap/Makefile
new file mode 100644 (file)
index 0000000..92b06e1
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2010 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:=ettercap
+PKG_VERSION:=NG-0.7.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ettercap
+PKG_MD5SUM:=28fb15cd024162c55249888fe1b97820
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/ettercap
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libnet1 +libopenssl +libpcre +libncurses +libltdl +libpthread +zlib
+  TITLE:=Ettercap is a suite for man in the middle attacks on LAN.
+  URL:=http://ettercap.sourceforge.net
+endef
+
+define Package/ettercap/description
+       It features sniffing of live connections, content filtering on the fly
+       and many other interesting tricks.
+       It supports active and passive dissection of many protocols (even
+       ciphered ones) and includes many feature for network and host analysis.
+endef
+
+define Package/ettercap/conffiles
+/etc/etter.conf
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       # remove default optimization flags set by configure
+       $(SED) 's,DEBUG_FLAGS=.*,DEBUG_FLAGS=,g' $(PKG_BUILD_DIR)/configure
+endef
+
+CONFIGURE_ARGS += \
+       --with-libpcap="$(STAGING_DIR)/usr" \
+       --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.1.x" \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --with-libpcre="$(STAGING_DIR)/usr" \
+       --with-iconv="$(ICONV_PREFIX)" \
+       --with-libncurses="$(STAGING_DIR)/usr" \
+       --disable-gtk \
+       --disable-debug \
+       --enable-plugins
+
+MAKE_FLAGS += \
+       DESTDIR="$(PKG_INSTALL_DIR)"
+
+define Package/ettercap/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/etter.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/etter{cap,filter,log} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ettercap
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ettercap/*.so $(1)/usr/lib/ettercap/
+       $(INSTALL_DIR) $(1)/usr/share/ettercap
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/ettercap/* $(1)/usr/share/ettercap/
+endef
+
+$(eval $(call BuildPackage,ettercap))
diff --git a/net/ettercap/patches/001-cross_compiling.patch b/net/ettercap/patches/001-cross_compiling.patch
new file mode 100644 (file)
index 0000000..8c95397
--- /dev/null
@@ -0,0 +1,23 @@
+diff -urN ettercap-NG-0.7.3/configure ettercap-NG-0.7.3.new/configure
+--- ettercap-NG-0.7.3/configure        2005-05-27 17:11:45.000000000 +0200
++++ ettercap-NG-0.7.3.new/configure    2006-08-21 20:15:07.000000000 +0200
+@@ -27354,6 +27354,7 @@
+    echo "$as_me:$LINENO: checking for NS_GET32" >&5
+ echo $ECHO_N "checking for NS_GET32... $ECHO_C" >&6
++cross_compiling=no
+    if test "$cross_compiling" = yes; then
+   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+diff -urN ettercap-NG-0.7.3/configure.in ettercap-NG-0.7.3.new/configure.in
+--- ettercap-NG-0.7.3/configure.in     2005-01-13 10:24:28.000000000 +0100
++++ ettercap-NG-0.7.3.new/configure.in 2006-08-21 20:13:29.000000000 +0200
+@@ -236,7 +236,7 @@
+ AC_CHECK_HEADERS(sys/poll.h poll.h sys/select.h)
+ AC_CHECK_HEADERS(sys/cdefs.h)
+ dnl nameser NS_GET32 and so on...
+-EC_NS_GET()
++#EC_NS_GET()
+ dnl ==================================================================
+ dnl   Checks for typedefs, structures, and compiler characteristics.
diff --git a/net/ettercap/patches/002-libnet_check_honor_ldflags.patch b/net/ettercap/patches/002-libnet_check_honor_ldflags.patch
new file mode 100644 (file)
index 0000000..55b00a7
--- /dev/null
@@ -0,0 +1,24 @@
+diff -ruN ettercap-NG-0.7.3-old/configure ettercap-NG-0.7.3-new/configure
+--- ettercap-NG-0.7.3-old/configure    2006-10-03 18:24:09.000000000 +0200
++++ ettercap-NG-0.7.3-new/configure    2006-10-03 18:28:57.000000000 +0200
+@@ -31759,7 +31759,7 @@
+    OLDLDFLAGS="${LDFLAGS}"
+    OLDLIBS="${LIBS}"
+-   LDFLAGS="$LNETLIB"
++   LDFLAGS="$LDFLAGS $LNETLIB"
+    LIBS="$LIBS"
+ echo "$as_me:$LINENO: checking for libnet_adv_free_packet in -lnet" >&5
+diff -ruN ettercap-NG-0.7.3-old/configure.in ettercap-NG-0.7.3-new/configure.in
+--- ettercap-NG-0.7.3-old/configure.in 2006-10-03 18:24:09.000000000 +0200
++++ ettercap-NG-0.7.3-new/configure.in 2006-10-03 18:26:45.000000000 +0200
+@@ -500,7 +500,7 @@
+ ]
+ )
+-EC_CHECK_FUNC(net, libnet_adv_free_packet, $LNETLIB, $LIBS,, AC_MSG_ERROR([Incorrect libnet version. libnet >= 1.1.2.1 required]))
++EC_CHECK_FUNC(net, libnet_adv_free_packet, $LDFLAGS $LNETLIB, $LIBS,, AC_MSG_ERROR([Incorrect libnet version. libnet >= 1.1.2.1 required]))
+ dnl ------------------
+ dnl Checks for openssl
diff --git a/net/ettercap/patches/003-automake-compat.patch b/net/ettercap/patches/003-automake-compat.patch
new file mode 100644 (file)
index 0000000..eea45f2
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/configure.in
++++ b/configure.in
+@@ -197,6 +197,9 @@ dnl ========================
+ dnl   Libtool related...
+ dnl ========================
++LT_INIT
++LTDL_INIT
++LT_CONFIG_LTDL_DIR([libltdl])
+ AC_DISABLE_STATIC
+ AC_LIBTOOL_WIN32_DLL
+ AC_LIBTOOL_DLOPEN
+--- a/include/ec_os_mingw.h
++++ b/include/ec_os_mingw.h
+@@ -163,7 +163,7 @@ EC_API_EXTERN const char *ec_win_get_ec_
+  */
+ #if !defined(HAVE_DLOPEN)
+    #define RTLD_NOW 0
+-   #define LTDL_SHLIB_EXT       "*.dll"
++   #define LT_MODULE_EXT       ".dll"
+    #define dlopen(dll,flg)      ec_win_dlopen (dll, flg)
+    #define lt_dlopen(dll)       ec_win_dlopen (dll, 0)
+--- a/src/ec_plugins.c
++++ b/src/ec_plugins.c
+@@ -131,7 +131,7 @@ int plugin_filter(struct dirent *d)
+ int plugin_filter(const struct dirent *d)
+ #endif
+ {
+-   if ( match_pattern(d->d_name, PLUGIN_PATTERN LTDL_SHLIB_EXT) )
++   if ( match_pattern(d->d_name, PLUGIN_PATTERN LT_MODULE_EXT) )
+       return 1;
+    return 0;
diff --git a/net/ez-ipupdate/Makefile b/net/ez-ipupdate/Makefile
new file mode 100644 (file)
index 0000000..7fb6840
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006-2012 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:=ez-ipupdate
+PKG_VERSION:=3.0.11b8
+PKG_RELEASE:=8
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/e/ez-ipupdate \
+       http://ftp.de.debian.org/debian/pool/main/e/ez-ipupdate
+PKG_MD5SUM:=000211add4c4845ffa4211841bff4fb0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ez-ipupdate
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=Dynamic DNS services client
+  URL:=http://ez-ipupdate.com/
+endef
+
+# uses GNU configure
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/ez-ipupdate/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ez-ipupdate $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config/
+       $(INSTALL_CONF) ./files/ez-ipupdate.config $(1)/etc/config/ddns
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/ez-ipupdate.hotplug $(1)/etc/hotplug.d/iface/30-ez-ipupdate
+endef
+
+define Package/ez-ipupdate/conffiles
+/etc/config/ddns
+endef
+
+$(eval $(call BuildPackage,ez-ipupdate))
diff --git a/net/ez-ipupdate/files/ez-ipupdate.config b/net/ez-ipupdate/files/ez-ipupdate.config
new file mode 100644 (file)
index 0000000..bc9ee6f
--- /dev/null
@@ -0,0 +1,14 @@
+
+config ddns
+       option enabled 0
+       option interface wan
+       option program ez-ipupdate
+       option service zoneedit
+       option username myname
+       option password mypassword
+       option hostname mydomain.com       
+
+# config ddns
+#       option interface wan
+#       option program ez-ipupdate
+#       option config /etc/ez-ipupdate.conf
diff --git a/net/ez-ipupdate/files/ez-ipupdate.hotplug b/net/ez-ipupdate/files/ez-ipupdate.hotplug
new file mode 100644 (file)
index 0000000..3359c6a
--- /dev/null
@@ -0,0 +1,81 @@
+NAME=ez-ipupdate
+COMMAND=/usr/sbin/$NAME
+
+case "$ACTION" in
+    ifup|ifdown)
+       cleanup() {
+           [ -e $1 ] && {
+               kill -9 $(cat $1)
+               rm $1
+           }
+       }
+
+       ddns() {
+           local cfg="$1"
+           config_get program $cfg program
+           [ "$program" = "$NAME" ] && {
+               config_get interface $cfg interface
+               [ "$interface" = "$INTERFACE" ] && {
+                   network_get_device dev "$INTERFACE" || return
+
+                   config_get enabled $cfg enabled
+                   enabled=${enabled:-1}
+
+                   config_get service  $cfg service
+
+                   config_get pidfile $cfg pidfile
+                   pidfile=${pidfile:-/var/run/$NAME-$service-$dev.pid}
+
+                   case "$ACTION" in
+                       ifdown)
+                           cleanup $pidfile
+                           ;;
+                       *)
+                           case "$enabled" in
+                               1|yes|true)
+                                   [ ! -e $pidfile ] && {
+                                       config_get cache $cfg cache
+                                       [ -z "$cache" ] && cache=/tmp/$NAME-$service-$dev.cache
+
+                                       config_get config $cfg config
+                                       [ -z "$config" ] && {
+                                           config=/var/run/$NAME-$service-$dev.conf
+                                           config_get username $cfg username
+                                           config_get password $cfg password
+                                           config_get hostname $cfg hostname
+                                           service=${service:-"dyndns"}
+                                           config_get server   $cfg server
+                                           server_line=""
+                                           [ -n "$server" ] && {
+                                               server_line="server=$server"
+                                           }
+                                           cat > $config <<EOF
+service-type=$service
+$server_line
+user=$username:$password
+host=$hostname
+cache-file=$cache
+pid-file=$pidfile
+interface=$dev
+quiet
+EOF
+                                       }
+
+                                       $COMMAND -c $config 2>&1 | logger -t $NAME &
+                                   }
+                                   ;;
+                               *)
+                                   cleanup $pidfile
+                                   ;;
+                           esac
+                   esac
+               }
+           }
+       }
+
+       . /lib/functions/network.sh
+
+       config_load ddns
+       config_foreach ddns ddns
+       ;;
+esac
diff --git a/net/ez-ipupdate/files/ez-ipupdate.init b/net/ez-ipupdate/files/ez-ipupdate.init
new file mode 100644 (file)
index 0000000..0cea301
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+BIN=ez-ipupdate
+CONF=/etc/$BIN.conf
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $CONF ] || exit
+       mkdir -p $RUN_D
+       $BIN -c $CONF
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
diff --git a/net/ez-ipupdate/patches/001-debian_subset.patch b/net/ez-ipupdate/patches/001-debian_subset.patch
new file mode 100644 (file)
index 0000000..c24b3ea
--- /dev/null
@@ -0,0 +1,568 @@
+--- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c
++++ ez-ipupdate-3.0.11b8/ez-ipupdate.c
+@@ -139,6 +139,9 @@
+ #if HAVE_SIGNAL_H
+ #  include <signal.h>
+ #endif
++#if HAVE_TIME_H
++#  include <time.h>
++#endif
+ #if HAVE_SYS_TIME_H
+ #  include <sys/time.h>
+ #endif
+@@ -165,7 +168,7 @@
+ #endif
+-#if __linux__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
++#if __GLIBC__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__
+ #  define IF_LOOKUP 1
+ #  include <sys/ioctl.h>
+ #  include <net/if.h>
+@@ -640,7 +643,7 @@
+   fprintf(stdout, "  -q, --quiet \t\t\tbe quiet\n");
+   fprintf(stdout, "  -r, --retrys <num>\t\tnumber of trys (default: 1)\n");
+   fprintf(stdout, "  -R, --run-as-user <user>\tchange to <user> for running, be ware\n\t\t\t\tthat this can cause problems with handeling\n\t\t\t\tSIGHUP properly if that user can't read the\n\t\t\t\tconfig file. also it can't write it's pid file \n\t\t\t\tto a root directory\n");
+-  fprintf(stdout, "  -Q, --run-as-euser <user>\tchange to effective <user> for running, \n\t\t\t\tthis is NOT secure but it does solve the \n\t\t\t\tproblems with run-as-user and config files and \n\t\t\t\tpid files.\n");
++  fprintf(stdout, "  -Q, --run-as-euser <user>\tchange to effective <user> for running, \n\t\t\t\tthis is NOT secure but it does solve the \n\t\t\t\tproblems with run-as-user and config files and \n\t\t\t\tpid files\n");
+   fprintf(stdout, "  -s, --server <server[:port]>\tthe server to connect to\n");
+   fprintf(stdout, "  -S, --service-type <server>\tthe type of service that you are using\n");
+   width = fprintf(stdout, "\t\t\t\ttry one of: ") + 4*7;
+@@ -682,7 +685,7 @@
+ void print_signalhelp( void )
+ {
+-  fprintf(stdout, "\nsignals are only really used when in daemon mode.\n\n");
++  fprintf(stdout, "\nsignals are only really used when in daemon mode\n\n");
+   fprintf(stdout, "signals: \n");
+   fprintf(stdout, "  HUP\t\tcauses it to re-read its config file\n");
+   fprintf(stdout, "  TERM\t\twake up and possibly perform an update\n");
+@@ -693,7 +696,7 @@
+ #if HAVE_SIGNAL_H
+ RETSIGTYPE sigint_handler(int sig)
+ {
+-  char message[] = "interupted.\n";
++  char message[] = "interrupted\n";
+   close(client_sockfd);
+   write(2, message, sizeof(message)-1);
+@@ -704,6 +707,10 @@
+   }
+ #endif
++#if HAVE_SYSLOG_H
++  closelog();
++#endif
++
+   exit(1);
+ }
+ RETSIGTYPE generic_sig_handler(int sig)
+@@ -798,7 +805,7 @@
+     sprintf(buf, "message incomplete because your OS sucks: %s\n", fmt);
+ #endif
+-    syslog(LOG_NOTICE, buf);
++    syslog(LOG_NOTICE, "%s", buf);
+   }
+   else
+   {
+@@ -1439,7 +1446,7 @@
+   if(!(options & OPT_QUIET))
+   {
+     fprintf(stderr,
+-        "connected to %s (%s) on port %d.\n",
++        "connected to %s (%s) on port %d\n",
+         host,
+         inet_ntoa(address.sin_addr),
+         ntohs(address.sin_port));
+@@ -1683,7 +1690,7 @@
+       close(client_sockfd);
+       return(-1);
+     }
+-    if(strstr(buf, "\r\n") > 0)
++    if(strstr(buf, "\n") != NULL)
+     {
+       break;
+     }
+@@ -1702,8 +1709,8 @@
+   if(options & OPT_DAEMON)
+   {
+-    fprintf(stderr, "no compile time default service was set therefor you must "
+-        "specify a service type.\n");
++    fprintf(stderr, "no compile time default service was set, you must "
++        "specify a service type\n");
+     return(-1);
+   }
+@@ -2039,7 +2046,7 @@
+         }
+         else if(strstr(buf, "\nnumhost") != NULL)
+         {
+-          show_message("Too many or too few hosts found\n");
++          show_message("too many or too few hosts found\n");
+           retval = UPDATERES_SHUTDOWN;
+         }
+         else if(strstr(buf, "\ndnserr") != NULL)
+@@ -2051,17 +2058,17 @@
+         }
+         else if(strstr(buf, "\n911") != NULL)
+         {
+-          show_message("Ahhhh! call 911!\n");
++          show_message("ahhhh! call 911!\n");
+           retval = UPDATERES_SHUTDOWN;
+         }
+         else if(strstr(buf, "\n999") != NULL)
+         {
+-          show_message("Ahhhh! call 999!\n");
++          show_message("ahhhh! call 999!\n");
+           retval = UPDATERES_SHUTDOWN;
+         }
+         else if(strstr(buf, "\n!donator") != NULL)
+         {
+-          show_message("a feature requested is only available to donators, please donate.\n", host);
++          show_message("a feature requested is only available to donators, please donate\n", host);
+           retval = UPDATERES_OK;
+         }
+         // this one should be last as it is a stupid string to signify waits
+@@ -2095,9 +2102,9 @@
+             sprintf(reason, "problem parsing reason for wait response");
+           }
+-          show_message("Wait response received, waiting for %s before next update.\n",
++          show_message("wait response received, waiting for %s before next update\n",
+               format_time(howlong));
+-          show_message("Wait response reason: %d\n", N_STR(reason));
++          show_message("wait response reason: %d\n", N_STR(reason));
+           sleep(howlong);
+           retval = UPDATERES_ERROR;
+         }
+@@ -3370,7 +3377,7 @@
+   {
+     if(!(options & OPT_QUIET))
+     {
+-      fprintf(stderr, "warning: for GNUDIP the \"address\" parpameter is only used if set to \"0.0.0.0\" thus making an offline request.\n");
++      fprintf(stderr, "warning: for GNUDIP the \"address\" parameter is only used if set to \"0.0.0.0\" thus making an offline request\n");
+     }
+   }
+@@ -3392,7 +3399,7 @@
+   // send an offline request if address 0.0.0.0 is used
+   // otherwise, we ignore the address and send an update request
+-  gnudip_request[0] = strcmp(address, "0.0.0.0") == 0 ? '1' : '0';
++  gnudip_request[0] = address && strcmp(address, "0.0.0.0") == 0 ? '1' : '0';
+   gnudip_request[1] = '\0';
+   // find domainname
+@@ -3943,22 +3950,22 @@
+           break;
+         case 201:
+-          show_message("Last update was less than %d seconds ago.\n", 300);
++          show_message("last update was less than %d seconds ago\n", 300);
+           return(UPDATERES_ERROR);
+           break;
+         case 202:
+-          show_message("Server error.\n");
++          show_message("server error\n");
+           return(UPDATERES_ERROR);
+           break;
+         case 203:
+-          show_message("Failure because account is frozen (by admin).\n");
++          show_message("failure because account is frozen (by admin)\n");
+           return(UPDATERES_SHUTDOWN);
+           break;
+         case 204:
+-          show_message("Failure because account is locked (by user).\n");
++          show_message("failure because account is locked (by user)\n");
+           return(UPDATERES_SHUTDOWN);
+           break;
+@@ -4215,8 +4222,6 @@
+   switch(ret)
+   {
+-    char *p;
+-
+     case -1:
+       if(!(options & OPT_QUIET))
+       {
+@@ -4349,7 +4354,7 @@
+     case SIGHUP:
+       if(config_file)
+       {
+-        show_message("SIGHUP recieved, re-reading config file\n");
++        show_message("SIGHUP received, re-reading config file\n");
+         if(parse_conf_file(config_file, conf_commands) != 0)
+         {
+           show_message("error parsing config file \"%s\"\n", config_file);
+@@ -4384,6 +4389,7 @@
+ int main(int argc, char **argv)
+ {
++  char *tmp;
+   int ifresolve_warned = 0;
+   int i;
+   int retval = 1;
+@@ -4395,9 +4401,10 @@
+   mcheck(NULL);
+ #endif
+-  dprintf((stderr, "staring...\n"));
++  dprintf((stderr, "starting...\n"));
+-  program_name = argv[0];
++  tmp = strrchr(argv[0], '/');
++  program_name = tmp ? tmp + 1 : argv[0];
+   options = 0;
+   *user = '\0';
+   timeout.tv_sec = DEFAULT_TIMEOUT;
+@@ -4417,7 +4424,7 @@
+   if(!(options & OPT_QUIET) && !(options & OPT_DAEMON))
+   {
+-    fprintf(stderr, "ez-ipupdate Version %s\nCopyright (C) 1998-2001 Angus Mackay.\n", VERSION);
++    fprintf(stderr, "%s Version %s\nCopyright (C) 1998-2001 Angus Mackay\n", program_name, VERSION);
+   }
+   dprintf((stderr, "options: 0x%04X\n", options));
+@@ -4434,7 +4441,7 @@
+   {
+     if(service->check_info() != 0)
+     {
+-      fprintf(stderr, "invalid data to perform requested action.\n");
++      fprintf(stderr, "invalid data to perform requested action\n");
+       exit(1);
+     }
+   }
+@@ -4456,13 +4463,13 @@
+     dprintf((stderr, "user_name: %s\n", user_name));
+     dprintf((stderr, "password: %s\n", password));
+   }
+-  if(*user_name == '\0')
++  if(*user_name == '\0' && !(options & OPT_DAEMON))
+   {
+     printf("user name: ");
+     fgets(user_name, sizeof(user_name), stdin);
+     chomp(user_name);
+   }
+-  if(*password == '\0')
++  if(*password == '\0' && !(options & OPT_DAEMON))
+   {
+     strncpy(password, getpass("password: "), sizeof(password));
+   }
+@@ -4480,7 +4487,7 @@
+   if(service->check_info() != 0)
+   {
+-    fprintf(stderr, "invalid data to perform requested action.\n");
++    fprintf(stderr, "invalid data to perform requested action\n");
+     exit(1);
+   }
+@@ -4503,7 +4510,7 @@
+     if(interface == NULL) 
+     { 
+-      fprintf(stderr, "invalid data to perform requested action.\n");
++      fprintf(stderr, "invalid data to perform requested action\n");
+       fprintf(stderr, "you must provide an interface for daemon mode");
+       exit(1);
+     }
+@@ -4519,23 +4526,25 @@
+       if(fork() > 0) { exit(0); } /* parent */
+     }
++#  if HAVE_SYSLOG_H
++    openlog(program_name, LOG_PID, LOG_DAEMON );
++    //options |= OPT_QUIET;
++#  endif
++    show_message("version %s, interface %s, host %s, server %s, service %s\n",
++        VERSION, N_STR(interface), N_STR(host), server, service->title);
++
+ #if HAVE_GETPID
+     if(pid_file && pid_file_create(pid_file) != 0)
+     {
+-      fprintf(stderr, "exiting...\n");
++      show_message("could not create pid file %s (%s), exiting\n",
++                   pid_file, strerror(errno));
++#if HAVE_SYSLOG_H
++      closelog();
++#endif
+       exit(1);
+     }
+ #endif
+-#  if HAVE_SYSLOG_H
+-    openlog(program_name, LOG_PID, LOG_USER );
+-    options |= OPT_QUIET;
+-#  endif
+-    show_message("ez-ipupdate Version %s, Copyright (C) 1998-2001 Angus Mackay.\n", 
+-        VERSION);
+-    show_message("%s started for interface %s host %s using server %s and service %s\n",
+-        program_name, N_STR(interface), N_STR(host), server, service->title);
+-
+     memset(&sin, 0, sizeof(sin));
+     if(cache_file)
+@@ -4560,7 +4569,7 @@
+           strftime(timebuf, sizeof(timebuf), "%Y/%m/%d %H:%M", ts);
+           show_message("got last update %s on %s from cache file\n", ipstr, timebuf);
+         }
+-        else
++        else if(ipstr||ipdate)
+         {
+           show_message("malformed cache file: %s\n", cache_file);
+         }
+@@ -4647,7 +4656,7 @@
+           }
+           else
+           {
+-            show_message("failure to update %s->%s (%s)\n",
++            show_message("failed to update %s->%s (%s)\n",
+                 interface, inet_ntoa(sin.sin_addr), N_STR(host));
+             memset(&sin, 0, sizeof(sin));
+@@ -4671,7 +4680,7 @@
+             dprintf((stderr, "updateres: %d\n", updateres));
+             if(updateres == UPDATERES_SHUTDOWN)
+             {
+-              show_message("shuting down updater for %s due to fatal error\n", 
++              show_message("shutting down updater for %s due to fatal error\n",
+                   N_STR(host));
+               if(notify_email && *notify_email != '\0')
+@@ -4711,7 +4720,7 @@
+ #endif
+ #else
+-    fprintf(stderr, "sorry, this mode is only available on platforms that the ");
++    fprintf(stderr, "sorry, this mode is only available on platforms where the ");
+     fprintf(stderr, "IP address \ncan be determined. feel free to hack the code");
+     fprintf(stderr, " though.\n");
+     exit(1);
+@@ -4799,7 +4808,7 @@
+         }
+         else
+         {
+-          show_message("could not resolve ip address for %s.\n", interface);
++          show_message("could not resolve ip address for %s\n", interface);
+           exit(1);
+         }
+         close(sock);
+--- ez-ipupdate-3.0.11b8.orig/example.conf
++++ ez-ipupdate-3.0.11b8/example.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+--- ez-ipupdate-3.0.11b8.orig/example-pgpow.conf
++++ ez-ipupdate-3.0.11b8/example-pgpow.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -10,8 +10,8 @@
+ host=mydomain.penguinpowered.com
+ interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-dhs.conf
++++ ez-ipupdate-3.0.11b8/example-dhs.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -10,8 +10,8 @@
+ host=mydomain.whatever.com
+ interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-dyndns.conf
++++ ez-ipupdate-3.0.11b8/example-dyndns.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -12,14 +12,9 @@
+ interface=eth1
+ max-interval=2073600
+-# please create this file and ensure that the user that ez-ipupdate is running
+-# as has write permissions to it then uncomment this line, if you don't your
+-# dyndns account will probably get banned. if you run ez-ipupdate as root (bad
+-# idea, use "run-as-user") then you can just uncomment this line.
+-#cache-file=/etc/ez-ipupdate.cache.eth1
+-
+-# for the mean time we'll just use a cache file in the temp directory
+-cache-file=/tmp/ez-ipupdate.cache
++# if you don't use a cache file your dyndns account will probably get banned.
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-ods.conf
++++ ez-ipupdate-3.0.11b8/example-ods.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -10,8 +10,8 @@
+ host=mydomain.ods.org
+ interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-tzo.conf
++++ ez-ipupdate-3.0.11b8/example-tzo.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -14,8 +14,8 @@
+ max-interval=2073600
+ interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-gnudip.conf
++++ ez-ipupdate-3.0.11b8/example-gnudip.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -14,8 +14,8 @@
+ # any other value is ignored
+ #address=0.0.0.0
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-easydns.conf
++++ ez-ipupdate-3.0.11b8/example-easydns.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -10,8 +10,8 @@
+ host=mydomain.whatever.com
+ interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-justlinux.conf
++++ ez-ipupdate-3.0.11b8/example-justlinux.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -10,8 +10,8 @@
+ host=mydomain.penguinpowered.com
+ interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-dyns.conf
++++ ez-ipupdate-3.0.11b8/example-dyns.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -10,8 +10,8 @@
+ host=myhost
+ #interface=eth1
+-# if you use run-as ensure the user has permission to write this file
+-#cache-file=/tmp/ez-ipupdate.cache
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
+--- ez-ipupdate-3.0.11b8.orig/example-heipv6tb.conf
++++ ez-ipupdate-3.0.11b8/example-heipv6tb.conf
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/ez-ipupdate -c
++#!/usr/sbin/ez-ipupdate -c
+ #
+ # example config file for ez-ipupdate
+ #
+@@ -11,14 +11,9 @@
+ interface=eth1
+ max-interval=2073600
+-# please create this file and ensure that the user that ez-ipupdate is running
+-# as has write permissions to it then uncomment this line, if you don't your
+-# dyndns account will probably get banned. if you run ez-ipupdate as root (bad
+-# idea, use "run-as-user") then you can just uncomment this line.
+-#cache-file=/etc/ez-ipupdate.cache.eth1
+-
+-# for the mean time we'll just use a cache file in the temp directory
+-cache-file=/tmp/ez-ipupdate.cache
++# if you don't use a cache file your account will probably get banned.
++run-as-user=ez-ipupd
++cache-file=/var/cache/ez-ipupdate/default-cache
+ # uncomment this once you have everything working how you want and you are
+ # ready to have ez-ipupdate running in the background all the time. to stop it
diff --git a/net/ez-ipupdate/patches/002-ez_ipupdate_everydns.patch b/net/ez-ipupdate/patches/002-ez_ipupdate_everydns.patch
new file mode 100644 (file)
index 0000000..74bce56
--- /dev/null
@@ -0,0 +1,209 @@
+diff -ur ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c ez-ipupdate-3.0.11b8/ez-ipupdate.c
+--- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c    2009-03-29 22:37:09.000000000 +0200
++++ ez-ipupdate-3.0.11b8/ez-ipupdate.c 2009-03-29 22:37:20.000000000 +0200
+@@ -103,6 +103,11 @@
+ #define HEIPV6TB_DEFAULT_PORT "80"
+ #define HEIPV6TB_REQUEST "/index.cgi"
++#define EVERYDNS_DEFAULT_SERVER "dyn.everydns.net"
++#define EVERYDNS_DEFAULT_PORT "80"
++#define EVERYDNS_REQUEST "/index.php"
++#define EVERYDNS_VERSION "0.1"
++
+ #define DEFAULT_TIMEOUT 120
+ #define DEFAULT_UPDATE_PERIOD 120
+ #define DEFAULT_RESOLV_PERIOD 30
+@@ -344,6 +349,10 @@
+ int HEIPV6TB_check_info(void);
+ static char *HEIPV6TB_fields_used[] = { "server", "user", NULL };
++int EVERYDNS_update_entry(void);
++int EVERYDNS_check_info(void);
++static char *EVERYDNS_fields_used[] = { "server", "user", "host", "address", NULL };
++
+ struct service_t services[] = {
+   { "NULL",
+     { "null", "NULL", 0, },
+@@ -517,6 +526,16 @@
+     HEIPV6TB_DEFAULT_PORT,
+     HEIPV6TB_REQUEST
+   },
++  { "everydns",
++    { "everydns", 0, 0, },
++    NULL,
++    EVERYDNS_update_entry,
++    EVERYDNS_check_info,
++    EVERYDNS_fields_used,
++    EVERYDNS_DEFAULT_SERVER,
++    EVERYDNS_DEFAULT_PORT,
++    EVERYDNS_REQUEST
++  },
+ };
+ static struct service_t *service = NULL;
+@@ -4251,6 +4270,165 @@
+   return(UPDATERES_OK);
+ }
++int EVERYDNS_check_info(void)
++{
++  warn_fields(service->fields_used);
++
++  return 0;
++}
++
++int EVERYDNS_update_entry(void)
++{
++  char buf[BUFFER_SIZE+1];
++  char *bp = buf;
++  int bytes;
++  int btot;
++  int ret;
++
++  buf[BUFFER_SIZE] = '\0';
++
++  if(do_connect((int*)&client_sockfd, server, port) != 0)
++  {
++    if(!(options & OPT_QUIET))
++    {
++      show_message("error connecting to %s:%s\n", server, port);
++    }
++    return(UPDATERES_ERROR);
++  }
++
++  snprintf(buf, BUFFER_SIZE, "GET %s?ver=%s&", request, EVERYDNS_VERSION);
++  output(buf);
++  if(address)
++  {
++    snprintf(buf, BUFFER_SIZE, "%s=%s&", "ip", address);
++    output(buf);
++  }
++  if((host != NULL) && (*host == '\0'))
++  {
++    snprintf(buf, BUFFER_SIZE, "%s=%s&", "domain", host);
++    output(buf);
++  }
++  snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012");
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "Authorization: Basic %s\015\012", auth);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "User-Agent: %s-%s %s [%s] (%s)\015\012", 
++      "ez-update", VERSION, OS, (options & OPT_DAEMON) ? "daemon" : "", "by Angus Mackay");
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "Host: %s\015\012", server);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "\015\012");
++  output(buf);
++
++  bp = buf;
++  bytes = 0;
++  btot = 0;
++  while((bytes=read_input(bp, BUFFER_SIZE-btot)) > 0)
++  {
++    bp += bytes;
++    btot += bytes;
++    dprintf((stderr, "btot: %d\n", btot));
++  }
++  close(client_sockfd);
++  buf[btot] = '\0';
++
++  dprintf((stderr, "server output: %s\n", buf));
++
++  if(sscanf(buf, " HTTP/1.%*c %3d", &ret) != 1)
++  {
++    ret = -1;
++  }
++
++  switch(ret)
++  {
++    char *p;
++
++    case -1:
++      if(!(options & OPT_QUIET))
++      {
++        show_message("strange server response, are you connecting to the right server?\n");
++      }
++      return(UPDATERES_ERROR);
++      break;
++
++    case 200:
++      ret = -1;
++      if((p=strstr(buf, "Exit code: ")) != NULL)
++      {
++         sscanf(p, "Exit code: %d", &ret);
++      }
++
++      /*
++       * 0 - Successfully Updated
++       */
++      switch(ret)
++      {
++        case -1:
++          if(!(options & OPT_QUIET))
++          {
++            show_message("strange server response, are you connecting to the right server?\n");
++          }
++          return(UPDATERES_ERROR);
++          break;
++
++        case 0:
++          if(!(options & OPT_QUIET))
++          {
++            printf("request successful\n");
++          }
++          break;
++
++        case 2:
++          if(!(options & OPT_QUIET))
++          {
++            show_message("Bad Username/password\n");
++          }
++          return(UPDATERES_SHUTDOWN);
++          break;
++          
++        case 5:
++          if(!(options & OPT_QUIET))
++          {
++            show_message("Last update too recent, please wait...\n");
++          }
++          return(UPDATERES_ERROR);
++          break;
++          
++        default:
++          if(!(options & OPT_QUIET))
++          {
++            show_message("unknown return code: %d\n", ret);
++            fprintf(stderr, "server response: %s\n", buf);
++          }
++          return(UPDATERES_ERROR);
++          break;
++      }
++      break;
++
++    case 401:
++      if(!(options & OPT_QUIET))
++      {
++        show_message("authentication failure\n");
++      }
++      return(UPDATERES_SHUTDOWN);
++      break;
++
++    default:
++      if(!(options & OPT_QUIET))
++      {
++        // reuse the auth buffer
++        *auth = '\0';
++        sscanf(buf, " HTTP/1.%*c %*3d %255[^\r\n]", auth);
++        show_message("unknown return code: %d\n", ret);
++        fprintf(stderr, "server response: %s\n", auth);
++      }
++      return(UPDATERES_ERROR);
++      break;
++  }
++
++  return(UPDATERES_OK);
++}
++
+ static int is_in_list(char *needle, char **haystack)
+ {
+   char **p;
diff --git a/net/ez-ipupdate/patches/003-dnsexit.patch b/net/ez-ipupdate/patches/003-dnsexit.patch
new file mode 100644 (file)
index 0000000..edfd61d
--- /dev/null
@@ -0,0 +1,263 @@
+diff -Nur ez-ipupdate-3.0.11b8.orig/example-dnsexit.conf ez-ipupdate-3.0.11b8/example-dnsexit.conf
+--- ez-ipupdate-3.0.11b8.orig/example-dnsexit.conf     1970-01-01 01:00:00.000000000 +0100
++++ ez-ipupdate-3.0.11b8/example-dnsexit.conf  2009-03-29 22:40:07.000000000 +0200
+@@ -0,0 +1,20 @@
++#!/usr/sbin/ez-ipupdate -c
++#
++# example config file for ez-ipupdate
++#
++# this file is actually executable!
++#
++
++service-type=dnsexit
++user=loginname:password
++host=www.yourdomain.com
++interface=eth0
++
++# please ensure the user has permission to write this file
++cache-file=/tmp/ez-ipupdate.cache
++
++run-as-user=ez-ipupd
++# uncomment this once you have everything working how you want and you are
++# ready to have ez-ipupdate running in the background all the time. to stop it
++# you can use "killall -QUIT ez-ipupdate" under linux.
++#daemon
+diff -Nur ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c ez-ipupdate-3.0.11b8/ez-ipupdate.c
+--- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c    2009-03-29 22:39:46.000000000 +0200
++++ ez-ipupdate-3.0.11b8/ez-ipupdate.c 2009-03-29 22:40:07.000000000 +0200
+@@ -108,6 +108,10 @@
+ #define EVERYDNS_REQUEST "/index.php"
+ #define EVERYDNS_VERSION "0.1"
++#define DNSEXIT_DEFAULT_SERVER "www.dnsexit.com"
++#define DNSEXIT_DEFAULT_PORT "80"
++#define DNSEXIT_REQUEST "/RemoteUpdate.sv"
++
+ #define DEFAULT_TIMEOUT 120
+ #define DEFAULT_UPDATE_PERIOD 120
+ #define DEFAULT_RESOLV_PERIOD 30
+@@ -353,6 +357,11 @@
+ int EVERYDNS_check_info(void);
+ static char *EVERYDNS_fields_used[] = { "server", "user", "host", "address", NULL };
++int DNSEXIT_update_entry(void);
++int DNSEXIT_check_info(void);
++static char *DNSEXIT_fields_used[] = { "server", "user", "address", "wildcard", "mx", "host", NULL };
++
++
+ struct service_t services[] = {
+   { "NULL",
+     { "null", "NULL", 0, },
+@@ -536,6 +545,16 @@
+     EVERYDNS_DEFAULT_PORT,
+     EVERYDNS_REQUEST
+   },
++  { "dnsexit",
++      { "dnsexit", 0, 0, },
++      NULL,
++      DNSEXIT_update_entry,
++      DNSEXIT_check_info,
++      DNSEXIT_fields_used,
++      DNSEXIT_DEFAULT_SERVER,
++      DNSEXIT_DEFAULT_PORT,
++      DNSEXIT_REQUEST
++  },    
+ };
+ static struct service_t *service = NULL;
+@@ -4429,6 +4448,195 @@
+   return(UPDATERES_OK);
+ }
++int DNSEXIT_check_info(void)
++{
++  char buf[BUFSIZ+1];
++
++  if((host == NULL) || (*host == '\0'))
++  {
++    if(options & OPT_DAEMON)
++    {
++      return(-1);
++    }
++    if(host) { free(host); }
++    printf("host: ");
++    *buf = '\0';
++    fgets(buf, BUFSIZ, stdin);
++    host = strdup(buf);
++    chomp(host);
++  }
++
++  if(interface == NULL && address == NULL)
++  {
++    if(options & OPT_DAEMON)
++    {
++      fprintf(stderr, "you must provide either an interface or an address\n");
++      return(-1);
++    }
++    if(interface) { free(interface); }
++    printf("interface: ");
++    *buf = '\0';
++    fgets(buf, BUFSIZ, stdin);
++    chomp(buf);
++    option_handler(CMD_interface, buf);
++  }
++
++  warn_fields(service->fields_used);
++
++  return 0;
++}
++
++int DNSEXIT_update_entry(void)
++{
++  char buf[BUFFER_SIZE+1];
++  char *bp = buf;
++  int bytes;
++  int btot;
++  int ret;
++
++  buf[BUFFER_SIZE] = '\0';
++
++  if(do_connect((int*)&client_sockfd, server, port) != 0)
++  {
++    if(!(options & OPT_QUIET))
++    {
++      show_message("error connecting to %s:%s\n", server, port);
++    }
++    return(UPDATERES_ERROR);
++  }
++
++  snprintf(buf, BUFFER_SIZE, "GET %s?action=edit&", request);
++  output(buf);
++  if(address != NULL && *address != '\0')
++  {
++    snprintf(buf, BUFFER_SIZE, "%s=%s&", "myip", address);
++    output(buf);
++  }
++  snprintf(buf, BUFFER_SIZE, "%s=%s&", "wildcard", wildcard ? "ON" : "OFF");
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "%s=%s&", "mx", mx);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "%s=%s&", "backmx", *mx == '\0' ? "NO" : "YES");
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "%s=%s&", "host", host);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "%s=%s&", "login", user_name);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "%s=%s&", "password", password);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012");
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "Authorization: Basic %s\015\012", auth);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "User-Agent: %s-%s %s [%s] (%s)\015\012",
++      "ez-update", VERSION, OS, (options & OPT_DAEMON) ? "daemon" : "", "by Angus Mackay");
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "Host: %s\015\012", server);
++  output(buf);
++  snprintf(buf, BUFFER_SIZE, "\015\012");
++  output(buf);
++
++  bp = buf;
++  bytes = 0;
++  btot = 0;
++  while((bytes=read_input(bp, BUFFER_SIZE-btot)) > 0)
++  {
++    bp += bytes;
++    btot += bytes;
++    dprintf((stderr, "btot: %d\n", btot));
++  }
++  close(client_sockfd);
++  buf[btot] = '\0';
++
++  dprintf((stderr, "server output: %s\n", buf));
++
++  if(sscanf(buf, " HTTP/1.%*c %3d", &ret) != 1)
++  {
++    ret = -1;
++  }
++
++  switch(ret)
++  {
++    case -1:
++      if(!(options & OPT_QUIET))
++      {
++        show_message("strange server response, are you connecting to the right server?\n");
++      }
++      return(UPDATERES_ERROR);
++      break;
++
++    case 200:
++
++      if(strstr(buf, "0=Success") != NULL)
++      {
++        if(!(options & OPT_QUIET))
++        {
++          printf("Request successful\n");
++        }
++      }
++      else if(strstr(buf, "1=IP is the same as the IP on the system") != NULL)
++      {
++        if(!(options & OPT_QUIET))
++        {
++          printf("Request successful but the IP is the same as previous update\n");
++        }
++      }
++      else if(strstr(buf, "2=Invalid passwords") != NULL)
++      {
++        if(!(options & OPT_QUIET))
++        {
++          printf("Invalid Password\n");
++        }
++      }
++      else if(strstr(buf, "3=User not found") != NULL)
++      {
++        if(!(options & OPT_QUIET))
++        {
++          printf("Username not found\n");
++        }
++      }
++      else if(strstr(buf, "4=Update too often") != NULL)
++      {
++        if(!(options & OPT_QUIET))
++        {
++          printf("Updatting too often\n");
++        }
++      }
++      else
++      {
++        show_message("Errors return from server\n");
++        if(!(options & OPT_QUIET))
++        {
++          fprintf(stderr, "server output: %s\n", buf);
++        }
++        return(UPDATERES_ERROR);
++      }
++      break;
++
++    case 401:
++      if(!(options & OPT_QUIET))
++      {
++        show_message("authentication failure\n");
++      }
++      return(UPDATERES_SHUTDOWN);
++      break;
++
++    default:
++      if(!(options & OPT_QUIET))
++      {
++        // reuse the auth buffer
++        *auth = '\0';
++        sscanf(buf, " HTTP/1.%*c %*3d %255[^\r\n]", auth);
++        show_message("unknown return code: %d\n", ret);
++        show_message("server response: %s\n", auth);
++      }
++      return(UPDATERES_ERROR);
++      break;
++  }
++
++  return(UPDATERES_OK);
++}
++
+ static int is_in_list(char *needle, char **haystack)
+ {
+   char **p;
diff --git a/net/ez-ipupdate/patches/004-zoneedit.patch b/net/ez-ipupdate/patches/004-zoneedit.patch
new file mode 100644 (file)
index 0000000..acc2b5f
--- /dev/null
@@ -0,0 +1,12 @@
+--- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c
++++ ez-ipupdate-3.0.11b8/ez-ipupdate.c
+@@ -95,7 +95,7 @@
+ #define HN_DEFAULT_PORT "80"
+ #define HN_REQUEST "/vanity/update"
+
+-#define ZONEEDIT_DEFAULT_SERVER "www.zoneedit.com"
++#define ZONEEDIT_DEFAULT_SERVER "dynamic.zoneedit.com"
+ #define ZONEEDIT_DEFAULT_PORT "80"
+ #define ZONEEDIT_REQUEST "/auth/dynamic.html"
+
+
diff --git a/net/ez-ipupdate/patches/005-endian-detection.patch b/net/ez-ipupdate/patches/005-endian-detection.patch
new file mode 100644 (file)
index 0000000..9efabc6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/md5.c
++++ b/md5.c
+@@ -35,7 +35,7 @@
+ #include "md5.h"
+-#ifdef _LIBC
++#if defined(_LIBC) || defined(__UCLIBC__)
+ # include <endian.h>
+ # if __BYTE_ORDER == __BIG_ENDIAN
+ #  define WORDS_BIGENDIAN 1
diff --git a/net/faifa/Makefile b/net/faifa/Makefile
new file mode 100644 (file)
index 0000000..b36e98b
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2006-2012 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:=faifa
+PKG_VERSION:=2012-09-13
+PKG_RELEASE:=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/ffainelli/faifa.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=2842afc90bd9ca08ed2a6c83c04f4015982e6007
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/faifa/Default
+  TITLE:=configure HomePlug 1.0/AV PLC devices
+  URL:=http://open-plc.org/
+endef
+
+define Package/libfaifa
+  $(call Package/faifa/Default)
+  TITLE+= (library)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpcap +libpthread
+endef
+
+define Package/libfaifa/description
+  Faifa companion library.
+endef
+
+define Package/faifa
+  $(call Package/faifa/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +libpcap +libfaifa
+  TITLE+= (command line)
+endef
+
+define Package/faifa/description
+  Faifa can configure any Intellon-based Power Line Communication device using
+  Intellon INT5000 and INT6000 series chips (6000 and 6300 chips). It supports all
+  Intellon-specific management and control frames as well as standard management
+  frames.
+endef
+
+define Package/hpavcfg
+  $(call Package/faifa/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=HomePlug AV lightweight configurator
+endef
+
+define Package/hpavcfg/description
+   Lightweight configuration tool, only capable of setting a local device key (NMK)
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_FLAGS += \
+       OS=LINUX \
+       CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); ./autogen.sh)
+       $(call Build/Configure/Default)
+endef
+
+define Package/faifa/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/faifa $(1)/usr/bin/
+endef
+
+define Package/libfaifa/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfaifa.so* $(1)/usr/lib
+endef
+
+define Package/hpavcfg/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/hpav_cfg $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,faifa))
+$(eval $(call BuildPackage,libfaifa))
+$(eval $(call BuildPackage,hpavcfg))
diff --git a/net/fakeidentd/Makefile b/net/fakeidentd/Makefile
new file mode 100644 (file)
index 0000000..0a852de
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006-2012 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:=fakeidentd
+PKG_VERSION:=2.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).c
+PKG_SOURCE_URL:=http://distfiles.gentoo.org/distfiles/
+PKG_MD5SUM:=d26693c1a7c883d1432e05fb6f7ead6e
+UNPACK_CMD=$(CP) $(DL_DIR)/$(PKG_SOURCE) $(1)/
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fakeidentd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A static, secure identd.
+  URL:=http://www.guru-group.fi/~too/sw/releases/
+endef
+
+define Package/fakeidentd/description
+       A static secure identd, only one source file.
+endef
+
+define Build/Compile
+       $(SHELL) "$(PKG_BUILD_DIR)/$(MAKE_PATH)/$(PKG_SOURCE)" \
+       CC="$(TARGET_CC)" TRG="$(PKG_BUILD_DIR)/$(MAKE_PATH)/$(PKG_NAME)" \
+       $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS) \
+       $(TARGET_LDFLAGS) $(EXTRA_LDFLAGS) -DUSE_UNIX_OS
+endef
+
+define Package/fakeidentd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,fakeidentd))
diff --git a/net/fakeidentd/files/fakeidentd.init b/net/fakeidentd/files/fakeidentd.init
new file mode 100644 (file)
index 0000000..4959ef2
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=85
+
+start() {
+       service_start /usr/sbin/fakeidentd -r
+}
+
+stop() {
+       service_stop /usr/sbin/fakeidentd
+}
diff --git a/net/flow-tools/Makefile b/net/flow-tools/Makefile
new file mode 100644 (file)
index 0000000..3f80d71
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2007-2014 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:=flow-tools
+PKG_VERSION:=0.68
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.eng.oar.net/pub/flow-tools/
+PKG_MD5SUM:=c9e0a8b53c79611b6bffcb9d510a5a38
+
+PKG_BUILD_DEPENDS:=+zlib
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/flow-tools
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=flow-tools
+  URL:=http://www.splintered.net/sw/flow-tools/
+  DEPENDS:=+zlib
+endef
+
+define Package/flow-tools/description
+       Flow-tools is a software package for collecting and processing
+       NetFlow data from Cisco and Juniper routers.
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default,all)
+endef
+
+define Package/flow-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/src/flow-* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,flow-tools))
diff --git a/net/flow-tools/patches/001-cross_compile_configure_fix.patch b/net/flow-tools/patches/001-cross_compile_configure_fix.patch
new file mode 100644 (file)
index 0000000..01a3724
--- /dev/null
@@ -0,0 +1,11 @@
+-- flow-tools-0.68.orig/configure      2007-02-08 07:21:42.000000000 -0500
++++ flow-tools-0.68/configure   2007-02-08 07:53:42.000000000 -0500
+@@ -6308,7 +6308,7 @@
+ See \`config.log' for more details." >&5
+ echo "$as_me: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++}
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
diff --git a/net/flow-tools/patches/002-flex_lib.patch b/net/flow-tools/patches/002-flex_lib.patch
new file mode 100644 (file)
index 0000000..f6b9877
--- /dev/null
@@ -0,0 +1,46 @@
+--- flow-tools-0.68.orig/Makefile.in   2007-02-08 07:21:42.000000000 -0500
++++ flow-tools-0.68/Makefile.in        2007-02-08 08:18:36.000000000 -0500
+@@ -70,7 +70,7 @@
+ DEPDIR = @DEPDIR@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LEX = @LEX@
+-LEXLIB = @LEXLIB@
++LEXLIB =
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ MYSQLCFLAGS = @MYSQLCFLAGS@
+ MYSQLINCLUDE = @MYSQLINCLUDE@
+--- flow-tools-0.68.orig/src/Makefile.in       2007-02-08 07:21:42.000000000 -0500
++++ flow-tools-0.68/src/Makefile.in    2007-02-08 08:18:31.000000000 -0500
+@@ -70,7 +70,7 @@
+ DEPDIR = @DEPDIR@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LEX = @LEX@
+-LEXLIB = @LEXLIB@
++LEXLIB =
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ MYSQLCFLAGS = @MYSQLCFLAGS@
+ MYSQLINCLUDE = @MYSQLINCLUDE@
+--- flow-tools-0.68.orig/src/acllex.c  2007-02-08 07:21:42.000000000 -0500
++++ flow-tools-0.68/src/acllex.c       2007-02-08 08:25:10.000000000 -0500
+@@ -503,7 +503,9 @@
+ #ifdef __cplusplus
+ extern "C" int yywrap YY_PROTO(( void ));
+ #else
+-extern int yywrap YY_PROTO(( void ));
++int yywrap (void ) {
++    return 1;
++}
+ #endif
+ #endif
+--- flow-tools-0.68.orig/configure     2007-02-08 07:21:42.000000000 -0500
++++ flow-tools-0.68/configure  2007-02-08 08:19:30.000000000 -0500
+@@ -2952,7 +2952,7 @@
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lfl  $LIBS"
++LIBS="$LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ /* confdefs.h.  */
diff --git a/net/flow-tools/patches/010-python_script_location_fix.patch b/net/flow-tools/patches/010-python_script_location_fix.patch
new file mode 100644 (file)
index 0000000..5806732
--- /dev/null
@@ -0,0 +1,30 @@
+diff --git a/bin/flow-log2rrd b/bin/flow-log2rrd
+index 0567ba5..db4fdda 100755
+--- a/bin/flow-log2rrd
++++ b/bin/flow-log2rrd
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/python
++#!/bin/env python
+ import getopt
+ import os
+diff --git a/bin/flow-rpt2rrd b/bin/flow-rpt2rrd
+index 72a74c7..7698f2b 100755
+--- a/bin/flow-rpt2rrd
++++ b/bin/flow-rpt2rrd
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/python
++#!/bin/env python
+ import getopt
+ import os
+diff --git a/bin/flow-rptfmt b/bin/flow-rptfmt
+index 047d1ba..f663fae 100755
+--- a/bin/flow-rptfmt
++++ b/bin/flow-rptfmt
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/python
++#!/bin/env python
+ import sys
+ import string
diff --git a/net/flow-tools/patches/020-invalid_lvalue_in_assignment.patch b/net/flow-tools/patches/020-invalid_lvalue_in_assignment.patch
new file mode 100644 (file)
index 0000000..aeda139
--- /dev/null
@@ -0,0 +1,171 @@
+diff --git a/lib/ftchash.c b/lib/ftchash.c
+index 9cc7efa..28bafbf 100644
+--- a/lib/ftchash.c
++++ b/lib/ftchash.c
+@@ -326,7 +326,7 @@ void *ftchash_foreach(struct ftchash *ft
+       (char*)ftch->traverse_chunk->base+ftch->traverse_chunk->next) {
+       ret = ftch->traverse_rec;
+-      (char*)ftch->traverse_rec += ftch->d_size;
++      ftch->traverse_rec = vpadd(ftch->traverse_rec, ftch->d_size);
+       return ret;
+     } else {
+diff --git a/lib/ftio.c b/lib/ftio.c
+index f6c739c..1082416 100644
+--- a/lib/ftio.c
++++ b/lib/ftio.c
+@@ -2267,7 +2267,7 @@ int readn(register int fd, register void
+         break;
+       nleft -= nread;
+-      (char*)ptr += nread;
++      ptr = vpadd(ptr, nread);
+   }
+   return (nbytes - nleft);
+ } /* readn */
+@@ -2292,7 +2292,7 @@ int writen(register int fd, register voi
+       return(nwritten); /* error */
+     nleft -= nwritten;
+-    (char*)ptr += nwritten;
++    ptr =  vpadd(ptr,nwritten);
+   }
+   return(nbytes - nleft);
+ } /* writen */
+diff --git a/lib/ftlib.h b/lib/ftlib.h
+index f91ad0a..66bf2f3 100644
+--- a/lib/ftlib.h
++++ b/lib/ftlib.h
+@@ -152,7 +152,6 @@ #define FT_PDU_V8_11_MAXFLOWS 44  /* max
+ #define FT_PDU_V8_12_MAXFLOWS 44  /* max records in V8 DST_PREFIX_TOS packet */
+ #define FT_PDU_V8_13_MAXFLOWS 35  /* max records in V8 PREFIX_TOS packet */
+ #define FT_PDU_V8_14_MAXFLOWS 35  /* max records in V8 PREFIX_PORT_TOS packet */
+-
+ #define FT_PDU_V8_1_VERSION    2  /* version of AS packet */
+ #define FT_PDU_V8_2_VERSION    2  /* version of PROTO PORT packet */
+ #define FT_PDU_V8_3_VERSION    2  /* version of SRC PREFIX packet */
+@@ -3029,6 +3028,8 @@ #ifndef IN_CLASSD_SSM
+ #define IN_CLASSD_SSM(i) (((u_int32_t)(i) & 0xff000000) == 0xe8000000)
+ #endif /* IN_CLASSD_SSM */
++void *vpadd(const void* v, const int change);
++
+ /* MACHINE DEPENDANT */
+ #define fmt_uint fmt_uint32
+diff --git a/lib/fttlv.c b/lib/fttlv.c
+index 7035813..330a783 100644
+--- a/lib/fttlv.c
++++ b/lib/fttlv.c
+@@ -68,10 +68,10 @@ int fttlv_enc_uint32(void *buf, int buf_
+   }
+   bcopy(&t, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&len, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&v, buf, 4);
+@@ -107,10 +107,10 @@ int fttlv_enc_uint16(void *buf, int buf_
+   }
+   bcopy(&t, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&len, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&v, buf, 2);
+@@ -145,10 +145,10 @@ int fttlv_enc_uint8(void *buf, int buf_s
+   }
+   bcopy(&t, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&len, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&v, buf, 1);
+@@ -183,10 +183,10 @@ int fttlv_enc_str(void *buf, int buf_siz
+   }
+   bcopy(&t, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&len, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(v, buf, len);
+@@ -230,16 +230,16 @@ int fttlv_enc_ifname(void *buf, int buf_
+     return -1;
+   bcopy(&t, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&len, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&ip, buf, 4);
+-  (char*)buf += 4;
++  buf = vpadd(buf, 4);
+   bcopy(&ifIndex, buf, 2);
+-  (char*)buf += 2;
++  buf = vpadd(buf, 2);
+   bcopy(name, buf, n);
+@@ -287,19 +287,19 @@ int fttlv_enc_ifalias(void *buf, int buf
+   }
+   bcopy(&t, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&len, buf, 2);
+-  (char*)buf+= 2;
++  buf = vpadd(buf, 2);
+   bcopy(&ip, buf, 4);
+-  (char*)buf += 4;
++  buf = vpadd(buf, 4);
+   bcopy(&entries, buf, 2);
+-  (char*)buf += 2;
++  buf = vpadd(buf, 2);
+   bcopy(ifIndex_list, buf, esize);
+-  (char*)buf += esize;
++  buf = vpadd(buf, esize);
+   bcopy(name, buf, n);
+diff --git a/lib/support.c b/lib/support.c
+index a32ffe7..2e1db9f 100644
+--- a/lib/support.c
++++ b/lib/support.c
+@@ -736,3 +736,8 @@ int udp_cksum(struct ip *ip, struct udph
+   return sum;
+ } /* udp_cksum */
++// void pointer add
++
++void * vpadd(const void *v, const int change) {
++  return (void *) (((char*) v) + change);
++}
diff --git a/net/flow-tools/patches/030-avoid_external_debug_var.patch b/net/flow-tools/patches/030-avoid_external_debug_var.patch
new file mode 100644 (file)
index 0000000..6ca5740
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/lib/ftfile.c b/lib/ftfile.c
+index 2f3ae76..f25e849 100644
+--- a/lib/ftfile.c
++++ b/lib/ftfile.c
+@@ -53,7 +53,7 @@ #endif
+ int load_dir(char *prefix, struct ftfile_entries *fte, int flags, int *depth);
+-extern int debug;
++#define debug 0
+ /*
+  * function: ftfile_entry_new
diff --git a/net/flow-tools/patches/050-fix-64bit_temp_time_t.patch b/net/flow-tools/patches/050-fix-64bit_temp_time_t.patch
new file mode 100644 (file)
index 0000000..99a06f7
--- /dev/null
@@ -0,0 +1,41 @@
+diff --git a/lib/ftfile.c b/lib/ftfile.c
+index f25e849..ec17771 100644
+--- a/lib/ftfile.c
++++ b/lib/ftfile.c
+@@ -413,16 +413,17 @@ void ftfile_pathname(char *buf, int bsiz
+  int done, u_int32 ftime)
+ {
+   struct tm *tm;
++  time_t _t = (time_t) ftime;
+   char *prefix, dbuf[64];
+   long gmt_val;
+   char gmt_sign;
+   int tm_gmtoff;
+   
+-  if (!(tm = localtime ((time_t*)&ftime))) {
++  if (!(tm = localtime (&_t))) {
+     snprintf(buf, bsize, ".");
+   }
+-  tm_gmtoff = get_gmtoff(ftime);
++  tm_gmtoff = get_gmtoff(_t);
+   /* compute GMT offset */
+   if (tm_gmtoff >= 0) {
+@@ -502,6 +503,7 @@ void ftfile_pathname(char *buf, int bsiz
+ int ftfile_mkpath(u_int32 ftime, int nest)
+ {
+   struct tm *tm;
++  time_t _t = (time_t) ftime;
+   char buf[32];
+   /* no directories */
+@@ -512,7 +514,7 @@ int ftfile_mkpath(u_int32 ftime, int nes
+   if ((nest > 3) || (nest < -3))
+     return -1;
+-  if (!(tm = localtime ((time_t*)&ftime)))
++  if (!(tm = localtime (&_t)))
+     return -1;
+   if (nest == -1)
diff --git a/net/flow-tools/patches/060-fix_uninitialized_var_in_flow_send.patch b/net/flow-tools/patches/060-fix_uninitialized_var_in_flow_send.patch
new file mode 100644 (file)
index 0000000..2240537
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/src/flow-send.c b/src/flow-send.c
+index 83ca926..ad87024 100644
+--- a/src/flow-send.c
++++ b/src/flow-send.c
+@@ -76,7 +76,7 @@ int main(int argc, char **argv)
+   u_int32 privacy_mask;
+   unsigned int v1, v2, one;
+   int i, n, ret, tx_delay, udp_sock;
+-  int src_ip_spoof, hdr_len;
++  int src_ip_spoof, hdr_len = 0;
+   void *rec;
+   /* init fterr */
diff --git a/net/flow-tools/patches/070-extra_ftpdu_verify_debugging.patch b/net/flow-tools/patches/070-extra_ftpdu_verify_debugging.patch
new file mode 100644 (file)
index 0000000..911d369
--- /dev/null
@@ -0,0 +1,49 @@
+diff --git a/lib/ftdecode.c b/lib/ftdecode.c
+index ff6b0cf..8884db9 100644
+--- a/lib/ftdecode.c
++++ b/lib/ftdecode.c
+@@ -122,8 +122,10 @@ int ftpdu_verify(struct ftpdu *ftpdu)
+   ret = -1;
+   /* enough bytes to decode the count and version? */
+-  if (ftpdu->bused < 4)
++  if (ftpdu->bused < 4) {
++    fterr_warnx("not enough bytes to decode the count and version.");
+     goto ftpdu_verify_out_quick;
++  }
+   ph = (struct ftpdu_header*)&ftpdu->buf;
+@@ -158,15 +160,22 @@ #endif /* LITTLE_ENDIAN */
+     case 5:
+       /* max PDU's in record */
+-      if (ph->count > FT_PDU_V5_MAXFLOWS)
++      if (ph->count > FT_PDU_V5_MAXFLOWS) {
++      fterr_warnx("too many pdus (%d) in record, max %d", ph->count,
++              FT_PDU_V5_MAXFLOWS);
+         goto ftpdu_verify_out;
++      }
++
+       size = offsetof(struct ftpdu_v5, records) +
+              ph->count * sizeof (struct ftrec_v5);
+       /* PDU received size == PDU expected size? */
+-      if (size != ftpdu->bused)
++      if (size != ftpdu->bused) {
++        fterr_warnx("pdu received size was wrong.  expected %d got %d",
++                ftpdu->bused, size);
+         goto ftpdu_verify_out;
++      }
+       ftpdu->ftv.d_version = 5;
+       ftpdu->decodef = fts3rec_pdu_v5_decode;
+@@ -516,6 +525,7 @@ #endif /* LITTLE_ENDIAN */
+       break; /* 8 */
+       default:
++        fterr_warnx("ftpdu version not set.");
+           goto ftpdu_verify_out;
+   } /* switch ph->version */
diff --git a/net/flow-tools/patches/080-fix_uninitialized_var_in_flow_export.patch b/net/flow-tools/patches/080-fix_uninitialized_var_in_flow_export.patch
new file mode 100644 (file)
index 0000000..bd88403
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/src/flow-export.c b/src/flow-export.c
+index 52ae4d2..22b0330 100644
+--- a/src/flow-export.c
++++ b/src/flow-export.c
+@@ -961,7 +961,7 @@ #endif /* PGSQL */
+ int fmt_xfields_type(char *buf, u_int64 xfield)
+ {
+-  int comma;
++  int comma = 0;
+   buf[0] = 0;
diff --git a/net/flow-tools/patches/090-configure_cflags_override.patch b/net/flow-tools/patches/090-configure_cflags_override.patch
new file mode 100644 (file)
index 0000000..695d8b7
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -1662,7 +1662,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(inst
+-CFLAGS="-g -Wall"
++CFLAGS="${CFLAGS} -g -Wall"
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
diff --git a/net/fping/Makefile b/net/fping/Makefile
new file mode 100644 (file)
index 0000000..fed932b
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2006 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:=fping
+PKG_VERSION:=2.4b2_to-ipv6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.fping.com/download/
+PKG_MD5SUM:=3ad516765514249a40d3c5b6caab812a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fping
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A program to ping multiple hosts in parallel
+  URL:=http://www.fping.com
+endef
+
+define Package/fping/description
+       fping is a ping(1) like program which uses the Internet Control Message Protocol
+       (ICMP) echo request to determine if a host is up. fping is different from ping in
+       that you can specify any number of hosts on the command line, or specify a file
+       containing the lists of hosts to ping. Instead of trying one host until it timeouts
+       or replies, fping will send out a ping packet and move on to the next host in a
+       round-robin fashion. If a host replies, it is noted and removed from the list of
+       hosts to check. If a host does not respond within a certain time limit and/or retry
+       limit it will be considered unreachable.
+endef
+
+define Build/Configure
+        (cd $(PKG_BUILD_DIR); touch \
+               configure \
+               stamp-h.in \
+               config.h.in \
+       );
+       $(call Build/Configure/Default,)
+endef
+
+define Build/Compile
+       $(MAKE) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" -C $(PKG_BUILD_DIR) clean $(PKG_NAME)
+       mv $(PKG_BUILD_DIR)/$(PKG_NAME) $(PKG_BUILD_DIR)/$(PKG_NAME)4
+       $(MAKE) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS) -DIPV6=1" -C $(PKG_BUILD_DIR) clean $(PKG_NAME)
+       mv $(PKG_BUILD_DIR)/$(PKG_NAME) $(PKG_BUILD_DIR)/$(PKG_NAME)6
+endef
+
+define Package/fping/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/fping4 $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/fping6 $(1)/usr/bin/
+       ln -sf fping4 $(1)/usr/bin/fping
+endef
+
+$(eval $(call BuildPackage,fping))
diff --git a/net/fping/patches/001-debian.patch b/net/fping/patches/001-debian.patch
new file mode 100644 (file)
index 0000000..a24dabb
--- /dev/null
@@ -0,0 +1,165 @@
+--- fping-2.4b2-to-ipv6.orig/fping.8
++++ fping-2.4b2-to-ipv6/fping.8
+@@ -1,4 +1,4 @@
+-.TH fping l\r
++.TH fping 8\r
+ .SH NAME\r
+ fping \- send ICMP ECHO_REQUEST packets to network hosts\r
+ .SH SYNOPSIS\r
+@@ -152,7 +152,7 @@
+ example none the less. \r
+ .nf\r
\r
+-#!/usr/local/bin/perl\r
++#!/usr/bin/perl\r
+ require 'open2.pl';\r
\r
+ $MAILTO = "root";\r
+@@ -178,7 +178,7 @@
+ that are currently reachable.\r
+ .nf\r
\r
+-#!/usr/local/bin/perl\r
++#!/usr/bin/perl\r
\r
+ $hosts_to_backup = `cat /etc/hosts.backup | fping -a`;\r
\r
+--- fping-2.4b2-to-ipv6.orig/fping.c
++++ fping-2.4b2-to-ipv6/fping.c
+@@ -42,7 +42,6 @@
+  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+  */
+-#define IPV6 1                                                /* This should be a compiler option, or even better be done from the Makefile... ;) */
+ #ifndef _NO_PROTO
+ #if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \
+@@ -101,13 +100,8 @@
+ #endif
+ #include <netinet/in_systm.h>
+-/* Linux has bizarre ip.h and ip_icmp.h */
+-#if defined( __linux__ )
+-#include "linux.h"
+-#else
+ #include <netinet/ip.h>
+ #include <netinet/ip_icmp.h>
+-#endif /* defined(__linux__) */
+ #include <arpa/inet.h>
+ #include <netdb.h>
+@@ -150,7 +144,11 @@
+ #define MIN_PING_DATA sizeof( PING_DATA )
+ #define       MAX_IP_PACKET   65536   /* (theoretical) max IP packet size */
+ #define SIZE_IP_HDR           20
++#ifndef IPV6
+ #define SIZE_ICMP_HDR ICMP_MINLEN             /* from ip_icmp.h */
++#else
++#define SIZE_ICMP_HDR sizeof(FPING_ICMPHDR)
++#endif
+ #define MAX_PING_DATA ( MAX_IP_PACKET - SIZE_IP_HDR - SIZE_ICMP_HDR )
+ /* sized so as to be like traditional ping */
+@@ -474,6 +472,35 @@
+                   sizeof(opton)))
+                       err(1, "setsockopt(IPV6_RTHDR)");
+ #endif
++#ifndef USE_SIN6_SCOPE_ID
++#ifdef IPV6_RECVPKTINFO
++              if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &opton,
++                  sizeof(opton)))
++                      err(1, "setsockopt(IPV6_RECVPKTINFO)");
++#else  /* old adv. API */
++              if (setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, &opton,
++                  sizeof(opton)))
++                      err(1, "setsockopt(IPV6_PKTINFO)");
++#endif
++#endif /* USE_SIN6_SCOPE_ID */
++#ifdef IPV6_RECVHOPLIMIT
++              if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &opton,
++                  sizeof(opton)))
++                      err(1, "setsockopt(IPV6_RECVHOPLIMIT)");
++#else  /* old adv. API */
++              if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &opton,
++                  sizeof(opton)))
++                      err(1, "setsockopt(IPV6_HOPLIMIT)");
++#endif
++#ifdef IPV6_CHECKSUM
++#ifndef SOL_RAW
++#define SOL_RAW IPPROTO_IPV6
++#endif
++              opton = 2;
++              if (setsockopt(s, SOL_RAW, IPV6_CHECKSUM, &opton,
++                  sizeof(opton)))
++                      err(1, "setsockopt(SOL_RAW,IPV6_CHECKSUM)");
++#endif
+ #endif
+       if( ( uid = getuid() ) )
+@@ -1112,7 +1139,7 @@
+               /* but allow time for the last one to come in */
+               if( count_flag )
+               {
+-                      if( ( cursor->num_sent >= count ) && ( ht > cursor->timeout ) )
++                      if( ( cursor->num_sent >= count ) && ( cursor->num_recv >= count || ht > cursor->timeout ) )
+                       {
+                               remove_job( cursor );
+                               continue;
+@@ -1382,15 +1409,15 @@
+               if( h->num_recv_i <= h->num_sent_i )
+               {
+                       fprintf( stderr, " xmt/rcv/%%loss = %d/%d/%d%%",
+-                              h->num_sent_i, h->num_recv_i,
+-                              ( ( h->num_sent_i - h->num_recv_i ) * 100 ) / h->num_sent_i );
++                              h->num_sent_i, h->num_recv_i, h->num_sent_i > 0 ?
++                              ( ( h->num_sent_i - h->num_recv_i ) * 100 ) / h->num_sent_i : 0 );
+               }/* IF */
+               else
+               {
+                       fprintf( stderr, " xmt/rcv/%%return = %d/%d/%d%%",
+-                              h->num_sent_i, h->num_recv_i,
+-                              ( ( h->num_recv_i * 100 ) / h->num_sent_i ) );
++                              h->num_sent_i, h->num_recv_i, h->num_sent_i > 0 ?
++                              ( ( h->num_recv_i * 100 ) / h->num_sent_i ) : 0 );
+               }/* ELSE */
+@@ -2165,20 +2192,33 @@
+       struct addrinfo         *res, hints;
+       int                                             ret_ga;
+       char                                            *hostname;
++      size_t len;
+       /* getaddrinfo */
+       bzero(&hints, sizeof(struct addrinfo));
+-      hints.ai_flags = AI_CANONNAME;
++      hints.ai_flags = name_flag ? AI_CANONNAME : 0;
+       hints.ai_family = AF_INET6;
+       hints.ai_socktype = SOCK_RAW;
+       hints.ai_protocol = IPPROTO_ICMPV6;
+       ret_ga = getaddrinfo(name, NULL, &hints, &res);
+-      if (ret_ga) errx(1, "%s", gai_strerror(ret_ga));
++      if (ret_ga) {
++              if(!quiet_flag)
++                      warnx("%s", gai_strerror(ret_ga));
++              num_noaddress++;
++              return; 
++      }
+       if (res->ai_canonname) hostname = res->ai_canonname;
+       else hostname = name;
+-      if (!res->ai_addr) errx(1, "getaddrinfo failed");
+-      (void)memcpy(&dst, res->ai_addr, sizeof(FPING_SOCKADDR)); /*res->ai_addrlen);*/
++      if (!res->ai_addr) {
++              if(!quiet_flag)
++                      warnx("getaddrinfo failed");
++              num_noaddress++;
++              return; 
++      }
++      len = res->ai_addrlen;
++      if (len > sizeof(FPING_SOCKADDR)) len = sizeof(FPING_SOCKADDR);
++      (void)memcpy(&dst, res->ai_addr, len);
+       add_addr(name, name, &dst);
+ #endif
+ } /* add_name() */
diff --git a/net/fprobe-ulog/Makefile b/net/fprobe-ulog/Makefile
new file mode 100644 (file)
index 0000000..11afb5b
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006 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:=fprobe-ulog
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/fprobe
+PKG_MD5SUM:=cdb2e4edc47e8a3d5479eeabfb979ebc
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fprobe-ulog
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread
+  TITLE:=NetFlow probe (ulog-based)
+  URL:=http://fprobe.sourceforge.net
+endef
+
+define Package/fprobe-ulog/description
+       A NetFlow probe obtaining packets through linux netfilter code
+       (iptables ULOG target).
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-piddir=/var \
+               --with-membulk=index8 \
+               --with-hash=xor8 \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/fprobe-ulog/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/fprobe-ulog $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,fprobe-ulog))
diff --git a/net/fprobe/Makefile b/net/fprobe/Makefile
new file mode 100644 (file)
index 0000000..f6be152
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2006 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:=fprobe
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/fprobe
+PKG_MD5SUM:=65850d0470078269b33eee58cba77ac2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fprobe
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libpthread
+  TITLE:=NetFlow probe (libpcap-based)
+  URL:=http://fprobe.sourceforge.net/
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-piddir=/var \
+               --with-pcap="$(STAGING_DIR)/usr/include" \
+               --with-libpcap="$(STAGING_DIR)/usr/lib" \
+               --with-membulk=index8 \
+               --with-hash=xor8 \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/fprobe/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/fprobe $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,fprobe))
diff --git a/net/freepops/Makefile b/net/freepops/Makefile
new file mode 100644 (file)
index 0000000..3bad4a5
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=freepops
+PKG_VERSION:=0.2.4
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/freepops
+PKG_MD5SUM:=d18848b903ceb68a53ded6b6d9e33047
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/freepops
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=POP3 interface to several webmails
+  DEPENDS:=+libpthread +liblua +luafilesystem +luaexpat @BROKEN # +luacurl
+  URL:=http://www.freepops.org
+endef
+
+define Package/freepops/description
+       FreePOPs is a POP3 daemon that translates local POP3 commands
+       to remote HTTP requests to the supported webmail sites.
+
+       FreePOPs can also be used as RSS aggregator and POP3 forwarder.
+endef
+
+define Build/Configure
+       cd $(PKG_BUILD_DIR) && \
+       $(TARGET_CONFIGURE_OPTS) \
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) -DHAVE_CONFIG_H -I$(PKG_BUILD_DIR)" \
+       LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS) -llua -llua-filesystem -llua-curl -llua-expat" \
+       PKGCONFIG=true \
+       ./configure.sh openwrt -lua -luafilesystem -luacurl -luaexpat
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) WHERE=/usr/ all
+       $(TARGET_CROSS)strip $(PKG_BUILD_DIR)/src/freepopsd
+endef
+
+define Package/freepops/install
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR=$(PKG_INSTALL_DIR)/ WHERE=/usr/ install
+       mkdir -p $(PKG_INSTALL_DIR)/etc/init.d
+       $(CP) $(PKG_BUILD_DIR)/buildfactory/openwrt/S50freepopsd \
+               $(PKG_INSTALL_DIR)/etc/init.d
+       chmod a+x $(PKG_INSTALL_DIR)/etc/init.d/*
+       rm -rf $(PKG_INSTALL_DIR)/usr/share/doc
+       rm -rf $(PKG_INSTALL_DIR)/usr/share/man
+       rm -rf $(PKG_INSTALL_DIR)/usr/bin/freepops-updater-dialog
+       rm -rf $(PKG_INSTALL_DIR)/usr/share/freepops/lua/foo.lua
+       rm -rf $(PKG_INSTALL_DIR)/usr/share/freepops/lua/skeleton.lua
+       cp -r $(PKG_INSTALL_DIR)/* $(1)
+endef
+
+$(eval $(call BuildPackage,freepops))
diff --git a/net/frickin/Makefile b/net/frickin/Makefile
new file mode 100644 (file)
index 0000000..e1ea5d4
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2006-2012 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:=frickin
+PKG_VERSION:=1.3
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/frickin
+PKG_MD5SUM:=5b2e98da2310c71c703d4617b88a173f
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/frickin
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=PPTP (Point-to-Point Tunneling Protocol) proxy
+  URL:=http://sourceforge.net/projects/frickin/
+  SUBMENU:=VPN
+endef
+
+define Package/frickin/description
+       Frickin PPTP Proxy allows a Point-to-Point Tunneling Protocol (PPTP)
+       client to connect to a PPTP server through Network Address
+       Translation (NAT).
+endef
+
+define Build/Configure
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               all
+endef
+
+define Package/frickin/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/frickin.config $(1)/etc/config/frickin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/frickin.init $(1)/etc/init.d/frickin
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/frickin $(1)/usr/sbin/
+endef
+
+define Package/frickin/conffiles
+/etc/config/frickin
+endef
+
+$(eval $(call BuildPackage,frickin))
diff --git a/net/frickin/files/frickin.config b/net/frickin/files/frickin.config
new file mode 100644 (file)
index 0000000..32141cd
--- /dev/null
@@ -0,0 +1,13 @@
+package 'frickin'
+
+config 'frickin'
+       option enabled 0
+
+       # listen on the specified IP address
+       option listen_ip '192.168.1.1'
+
+       # connect to the specified IP address
+       option server_ip '192.168.1.253'
+
+       # set the maximum number of simultaneous connections
+#      option conn_limit 20
diff --git a/net/frickin/files/frickin.init b/net/frickin/files/frickin.init
new file mode 100644 (file)
index 0000000..7f96acf
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+append_string() {
+       local var="$1"
+       local section="$2"
+       local option="$3"
+       local val="$4"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append "$var" "$val $_val"
+}
+
+section_enabled() {
+       local enabled
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+start_instance() {
+       local section="$1"
+       local args
+
+       section_enabled "$section" || return 1
+
+       append_string args "$section" 'listen_ip' '-l'
+       append_string args "$section" 'server_ip' '-s'
+       append_string args "$section" 'conn_limit' '-c'
+
+       SERVICE_PID_FILE="/var/run/frickin-${section}.pid"
+       service_start /usr/sbin/frickin $args
+}
+
+stop_instance() {
+       local section="$1"
+       local id
+       local if
+
+       section_enabled "$section" || return 1
+
+       SERVICE_PID_FILE="/var/run/frickin-${section}.pid"
+       service_stop /usr/sbin/frickin
+}
+
+start() {
+       config_load 'frickin'
+       config_foreach start_instance 'frickin'
+}
+
+stop() {
+       config_load 'frickin'
+       config_foreach stop_instance 'frickin'
+}
diff --git a/net/gatling/Makefile b/net/gatling/Makefile
new file mode 100644 (file)
index 0000000..0f5e083
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2010 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:=gatling
+PKG_VERSION:=0.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://dl.fefe.de
+PKG_MD5SUM:=a0fb49ccb6b910bdbd7e76a9960394e3
+
+include $(INCLUDE_DIR)/nls.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gatling
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=gatling - a high performance web server
+  VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
+  URL:=http://www.fefe.de/gatling/
+  DEPENDS:=$(ICONV_DEPENDS) +zlib +libowfat +libopenssl
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libowfat \
+                -I$(ICONV_PREFIX)/include
+
+TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib \
+                 -L$(ICONV_PREFIX)/lib \
+                 -Wl,-Bdynamic,$(LIBGCC_S)
+
+define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/gatling $(1)/bin
+endef
+
+$(eval $(call BuildPackage,gatling))
diff --git a/net/gatling/patches/001-fix_ld_libs.patch b/net/gatling/patches/001-fix_ld_libs.patch
new file mode 100644 (file)
index 0000000..3112f9f
--- /dev/null
@@ -0,0 +1,11 @@
+--- gatling-0.11/GNUmakefile   2010-02-09 21:49:18.448989774 +0000
++++ gatling-0.11_new/GNUmakefile       2010-02-09 21:52:44.821469886 +0000
+@@ -151,7 +151,7 @@
+       ar q $@ dummy.o
+       -ranlib $@
+-LDLIBS+=`cat libsocket libiconv libcrypt`
++LDLIBS+=-lcrypto -liconv -lcrypt
+ $(TARGETS): libsocketkludge.a libsocket libiconv libcrypt md5lib
diff --git a/net/gatling/patches/002-fix_flags.patch b/net/gatling/patches/002-fix_flags.patch
new file mode 100644 (file)
index 0000000..b956664
--- /dev/null
@@ -0,0 +1,14 @@
+diff -ruN gatling-0.11/GNUmakefile gatling-0.11_new/GNUmakefile
+--- gatling-0.11/GNUmakefile   2008-12-05 12:31:01.000000000 +0000
++++ gatling-0.11_new/GNUmakefile       2010-02-05 23:33:08.242872096 +0000
+@@ -16,8 +16,8 @@
+ CROSS=
+ #CROSS=i686-mingw32-
+ CC=$(CROSS)gcc
+-CFLAGS=-pipe -Wall
+-LDFLAGS=
++CFLAGS+=-pipe -Wall
++LDFLAGS+=
+ path = $(subst :, ,$(PATH))
+ diet_path = $(foreach dir,$(path),$(wildcard $(dir)/diet))
diff --git a/net/gatling/patches/010-add_semicolon.patch b/net/gatling/patches/010-add_semicolon.patch
new file mode 100644 (file)
index 0000000..cbc943c
--- /dev/null
@@ -0,0 +1,11 @@
+--- gatling-0.11/acc.c 2010-02-05 23:47:29.252861541 +0000
++++ gatling-0.11_new/acc.c     2010-02-05 23:47:54.025348536 +0000
+@@ -47,7 +47,7 @@
+ #if defined(__i386__) || defined(__x86_64__)
+   return a[0]==b[0] && a[1]==b[1] && a[2]==b[2];
+ #else
+-  return ((*(uint32_t*)a ^ *(uint32_t*)b) & 0xffffff) == 0
++  return ((*(uint32_t*)a ^ *(uint32_t*)b) & 0xffffff) == 0;
+ #endif
+ }
diff --git a/net/gesftpserver/Makefile b/net/gesftpserver/Makefile
new file mode 100644 (file)
index 0000000..eb5b830
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2010 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:=sftpserver
+PKG_REV:=228
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.greenend.org.uk/rjk/bzr/sftpserver.dev
+PKG_SOURCE_PROTO:=bzr
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/gesftpserver
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=SSH
+  DEPENDS:=+libpthread $(ICONV_DEPENDS)
+  TITLE:=SFTP server
+  URL:=http://www.greenend.org.uk/rjk/sftpserver/
+endef
+
+define Package/gesftpserver/description
+This is an experimental free SFTP server. It is currently still under development
+(so don't trust it with critical data). It should be possible to use it as a
+drop-in replacement for the widely-used OpenSSH SFTP server. It does not include
+an SSH server, but rather runs as a subsystem of one.
+endef
+
+CONFIGURE_CMD:=./prepare
+
+TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components 1 $(TAR_OPTIONS)
+
+TARGET_LDFLAGS+=-lpthread
+
+define Package/gesftpserver/install    
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gesftpserver $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,gesftpserver))
diff --git a/net/gpsd/Makefile b/net/gpsd/Makefile
new file mode 100644 (file)
index 0000000..9195b25
--- /dev/null
@@ -0,0 +1,159 @@
+#
+# Copyright (C) 2006-2012 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:=gpsd
+PKG_VERSION:=3.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download-mirror.savannah.gnu.org/releases/gpsd/
+PKG_MD5SUM:=fc5b03aae38b9b5b6880b31924d0ace3
+
+PKG_BUILD_DEPENDS:=libncurses libusb-1.0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/scons.mk
+
+define Package/gpsd/Default
+  DEPENDS:=+librt
+  URL:=http://catb.org/gpsd/
+endef
+
+define Package/gpsd/Default/description
+  gpsd is a userland daemon acting as a translator between GPS and AIS receivers
+  and their clients. gpsd listens on port 2947 for clients requesting
+  position/time/velocity information.  The receivers are expected to generate
+  position information in a well-known format -- as NMEA-0183 sentences, SiRF
+  binary, Rockwell binary, Garmin binary format, or other vendor binary
+  protocols.  gpsd takes this information from the GPS and translates it into
+  something uniform and easier to understand for clients.
+endef
+
+define Package/gpsd
+  $(call Package/gpsd/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS+= +libgps +libgpsd
+  TITLE:=An interface daemon for GPS receivers
+endef
+
+define Package/gpsd/conffiles
+/etc/config/gpsd
+endef
+
+define Package/gpsd/description
+  $(call Package/gpsd/Default/description)
+  This package contains the GPS daemon.
+endef
+
+define Package/gpsd-clients
+  $(call Package/gpsd/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS+= +libgps +libgpsd +libncurses
+  TITLE:=GPS tools and clients
+endef
+
+define Package/gpsd-clients/description
+  $(call Package/gpsd/Default/description)
+  This package contains auxiliary tools and example clients for monitoring and
+  testing the GPS daemon.
+endef
+
+define Package/libgps
+  $(call Package/gpsd/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS+= +libcap
+  TITLE:=C service library for communicating with the GPS daemon
+endef
+
+define Package/libgps/description
+  $(call Package/gpsd/Default/description)
+  This package contains the libgps library.
+endef
+
+define Package/libgpsd
+  $(call Package/gpsd/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS+= +libcap +libusb-1.0
+  TITLE:=C service library for GPS applications
+endef
+
+define Package/libgpsd/description
+  $(call Package/gpsd/Default/description)
+  This package contains the libgpsd library.
+endef
+
+SCONS_OPTIONS += \
+       dbus_export=no \
+       tsip=no \
+       fv18=no \
+       tripmate=no \
+       earthmate=no \
+       itrax=no \
+       navcom=no \
+       ubx=no \
+       evermore=no \
+       ntrip=no \
+       libgpsmm=no \
+       libQgpsmm=no \
+       bluez=no \
+       strip=no \
+       python=no \
+       implicit_link=no \
+       chrpath=no
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gps.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps*.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgps*.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/gpsd/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/gpsd.config $(1)/etc/config/gpsd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/gpsd.init $(1)/etc/init.d/gpsd
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
+       $(INSTALL_DATA) ./files/gpsd.hotplug $(1)/etc/hotplug.d/usb/20-gpsd
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/gpsd $(1)/usr/sbin/
+endef
+
+define Package/gpsd-clients/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/cgps \
+               $(PKG_INSTALL_DIR)/usr/bin/gps{ctl,decode,mon,pipe} \
+               $(PKG_INSTALL_DIR)/usr/bin/gpxlogger \
+               $(PKG_INSTALL_DIR)/usr/bin/lcdgps \
+               $(1)/usr/bin/
+endef
+
+define Package/libgps/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgps.so.* $(1)/usr/lib/
+endef
+
+define Package/libgpsd/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpsd.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,gpsd))
+$(eval $(call BuildPackage,gpsd-clients))
+$(eval $(call BuildPackage,libgps))
+$(eval $(call BuildPackage,libgpsd))
diff --git a/net/gpsd/files/gpsd.config b/net/gpsd/files/gpsd.config
new file mode 100644 (file)
index 0000000..ef19202
--- /dev/null
@@ -0,0 +1,5 @@
+config gpsd core
+    option device    "/dev/ttyUSB0"
+    option port    "2947"
+    option listen_globally    "false"
+    option enabled    "true"
diff --git a/net/gpsd/files/gpsd.hotplug b/net/gpsd/files/gpsd.hotplug
new file mode 100644 (file)
index 0000000..fc15dda
--- /dev/null
@@ -0,0 +1,16 @@
+case "$ACTION" in
+    add)
+        # start process
+        # only pl2303 devices are handled
+        if [ "$PRODUCT" = "67b/2303/300" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then
+            sleep 3 && /etc/init.d/gpsd start
+        fi
+        ;;
+    remove)
+        # stop process
+        # only pl2303 devices are handled
+        if [ "$PRODUCT" = "67b/2303/300" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then
+            /etc/init.d/gpsd stop
+        fi
+        ;;
+esac
diff --git a/net/gpsd/files/gpsd.init b/net/gpsd/files/gpsd.init
new file mode 100644 (file)
index 0000000..96cee78
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+START=50
+
+NAME=gpsd
+PIDF=/var/run/$NAME.pid
+PROG=/usr/sbin/$NAME
+
+start() {
+    config_load gpsd
+    config_get device core device
+    config_get port core port
+    config_get_bool listen_globally core listen_globally
+    config_get_bool enabled core enabled
+    [ "$enabled" != "1" ] && exit
+    logger -t "$NAME" "Starting..."
+    [ ! -c "$device" ] && {
+        logger -t "$NAME" "Unable to find device $device. Exiting."
+        exit 1
+    }
+    [ "$listen_globally" != "0" ] && append args "-G"
+    $PROG -n -P $PIDF -S $port $args $device
+}
+
+stop() {
+    logger -t "$NAME" "Stopping..."
+    [ -f "$PIDF" ] && {
+        read PID < "$PIDF"
+        kill -9 $PID
+        rm $PIDF
+    }
+}
diff --git a/net/hiawatha/Makefile b/net/hiawatha/Makefile
new file mode 100644 (file)
index 0000000..943a57c
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# 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:=hiawatha
+PKG_VERSION:=7.8.2
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.hiawatha-webserver.org/files/
+PKG_MD5SUM:=8aff3f8c759871ea1d1ff22e98030332
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_IPV6 \
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hiawatha
+  CATEGORY:=Network
+  SECTION:=net
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=A very lightweight web server
+  URL:=http://www.hiawatha-webserver.org/
+  MAINTAINER:=Raphaël HUCK <rhk@cksum.org>
+  DEPENDS:=+libpthread +zlib
+endef
+
+define Package/hiawatha/description
+  Hiawatha is an open source webserver with a focus on security.
+endef
+
+CONFIGURE_ARGS+= \
+       $(call autoconf_bool,CONFIG_IPV6,ipv6) \
+       --disable-cache \
+       --disable-monitor \
+       --disable-ssl \
+       --disable-xslt
+
+CONFIGURE_VARS+= \
+       ac_cv_file__dev_urandom=yes \
+       webrootdir=/www
+
+define Package/hiawatha/conffiles
+/etc/hiawatha/hiawatha.conf
+/etc/hiawatha/mimetype.conf
+endef
+
+define Package/hiawatha/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hiawatha $(1)/usr/sbin/
+
+       $(INSTALL_DIR) $(1)/etc/hiawatha
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/hiawatha/{hiawatha,mimetype}.conf $(1)/etc/hiawatha/
+endef
+
+$(eval $(call BuildPackage,hiawatha))
diff --git a/net/horst/Makefile b/net/horst/Makefile
new file mode 100644 (file)
index 0000000..a8a6028
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2006 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:=horst
+PKG_VERSION:=3.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://br1.einfach.org/horst_dl/
+PKG_MD5SUM:=076d836733fb6ce53a590eddf92ad358
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/horst
+       SECTION:=net
+       CATEGORY:=Network
+        SUBMENU:=wireless
+       DEPENDS:=+libncurses
+       MAINTAINER:=Bruno Randolf <br1@einfach.org>
+       TITLE:=Highly Optimized 802.11 Radio Scanning Tool
+       URL:=http://br1.einfach.org/horst/
+endef
+
+define Package/horst/description
+       [horst] is a scanning and analysis tool for 802.11 wireless networks
+       and especially IBSS (ad-hoc) mode and mesh networks (OLSR).
+endef
+
+define Package/horst/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/horst $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/horst.sh $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,horst))
diff --git a/net/horst/patches/100-compile-fixes.patch b/net/horst/patches/100-compile-fixes.patch
new file mode 100644 (file)
index 0000000..29295b0
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/Makefile
++++ b/Makefile
+@@ -34,9 +34,7 @@ CFLAGS+=-DPCAP
+ LIBS+=-lpcap
+ endif
+-buildstamp=.build_debug$(DEBUG)pcap$(PCAP)
+-
+-all: $(buildstamp) $(NAME)
++all: $(NAME)
+ # include dependencies
+ average.o: average.h util.h
+@@ -73,7 +71,3 @@ clean:
+       -rm -f *.o *~
+       -rm -f $(NAME)
+       -rm -f .build_*
+-
+-$(buildstamp):
+-      make clean
+-      touch $@
diff --git a/net/hping3/Makefile b/net/hping3/Makefile
new file mode 100644 (file)
index 0000000..9d62db2
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2009 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:=hping3
+PKG_VERSION:=20051105
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.hping.org/
+PKG_MD5SUM:=ca4ea4e34bcc2162aedf25df8b2d1747
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hping3
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=TCP/IP packet assembler/analyzer
+  URL:=http://www.hping.org/
+  DEPENDS:=+libpcap +libpthread
+endef
+
+define Package/hping3/description
+        hping is a command-line oriented TCP/IP packet assembler/analyzer. The interface is
+        inspired to the ping(8) unix command, but hping isn't only able to send ICMP echo
+        requests. It supports TCP, UDP, ICMP and RAW-IP protocols, has a traceroute mode, the
+        ability to send files between a covered channel, and many other features.
+endef
+
+define Build/Configure
+endef
+
+define Package/hping3/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/hping3 $(1)/usr/sbin/hping3
+endef
+
+$(eval $(call BuildPackage,hping3))
diff --git a/net/hping3/patches/100-makefile.patch b/net/hping3/patches/100-makefile.patch
new file mode 100644 (file)
index 0000000..abf3a0d
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/Makefile
++++ b/Makefile
+@@ -6,15 +6,15 @@
+ # $date: Sun Jul 25 17:56:15 MET DST 1999$ 
+ # $rev: 3$ 
+-CC= gcc
+-AR=/usr/bin/ar
+-RANLIB=/usr/bin/ranlib
+-CCOPT= -O2 -Wall  -I/usr/include/tcl8.4 -DUSE_TCL
+-DEBUG= -g
++#CC= gcc
++#AR=/usr/bin/ar
++#RANLIB=/usr/bin/ranlib
++#CCOPT= -O2 -Wall   
++#DEBUG= -g
+ #uncomment the following if you need libpcap based build under linux
+ #(not raccomanded)
+ COMPILE_TIME=
+-INSTALL_MANPATH=/usr/local/man
++#INSTALL_MANPATH=/usr/local/man
+ PCAP=-lpcap
+ ARSOBJ = ars.o apd.o split.o rapd.o
+@@ -50,20 +50,16 @@ libars.a: $(ARSOBJ)
+       $(RANLIB) $@
+ hping3: byteorder.h $(OBJ)
+-      $(CC) -o hping3 $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP)  -ltcl8.4 -lm -lpthread
+-      @echo
+-      ./hping3 -v
+-      @echo "use \`make strip' to strip hping3 binary"
+-      @echo "use \`make install' to install hping3"
++      $(CC) -o hping3 $(CFLAGS) $(LDFLAGS) $(DEBUG) $(OBJ) $(PCAP) -lm -lpthread
+ hping3-static: byteorder.h $(OBJ)
+-      $(CC) -static -o hping3-static $(CCOPT) $(DEBUG) $(OBJ) -L/usr/local/lib $(PCAP)  -ltcl8.4 -lm -lpthread -ldl
++      $(CC) -static -o hping3-static $(CFLAGS) $(LDFLAGS) $(DEBUG) $(OBJ) $(PCAP) -lm -lpthread -ldl
+ byteorder.h:
+       ./configure
+ .c.o:
+-      $(CC) -c $(CCOPT) $(DEBUG) $(COMPILE_TIME) $<
++      $(CC) -c $(CFLAGS) $(LDFLAGS) $(DEBUG) $(COMPILE_TIME) $<
+ clean:
+       rm -rf hping3 *.o libars.a
diff --git a/net/hping3/patches/101-endianness.patch b/net/hping3/patches/101-endianness.patch
new file mode 100644 (file)
index 0000000..2666647
--- /dev/null
@@ -0,0 +1,52 @@
+--- a/hping2.h
++++ b/hping2.h
+@@ -13,6 +13,7 @@
+ #ifndef _HPING2_H
+ #define _HPING2_H
++#include <endian.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+@@ -248,10 +249,10 @@
+  * IP header
+  */
+ struct myiphdr {
+-#if defined(__LITTLE_ENDIAN_BITFIELD)
++#if __BYTE_ORDER == __LITTLE_ENDIAN
+         __u8    ihl:4,
+                 version:4;
+-#elif defined (__BIG_ENDIAN_BITFIELD)
++#elif __BYTE_ORDER == __BIG_ENDIAN
+         __u8    version:4,
+                 ihl:4;
+ #else
+@@ -287,10 +288,10 @@ struct mytcphdr {
+       __u16   th_dport;               /* destination port */
+       __u32   th_seq;                 /* sequence number */
+       __u32   th_ack;                 /* acknowledgement number */
+-#if defined (__LITTLE_ENDIAN_BITFIELD)
++#if __BYTE_ORDER == __LITTLE_ENDIAN
+       __u8    th_x2:4,                /* (unused) */
+               th_off:4;               /* data offset */
+-#elif defined (__BIG_ENDIAN_BITFIELD)
++#elif __BYTE_ORDER == __BIG_ENDIAN
+       __u8    th_off:4,               /* data offset */
+               th_x2:4;                /* (unused) */
+ #else
+--- a/bytesex.h
++++ b/bytesex.h
+@@ -9,9 +9,12 @@
+ #if   defined(__i386__) \
+       || defined(__alpha__) \
++      || (defined(__arm__) && (defined(ARMEL) || defined(__ARMEL__)))  \
+       || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__)))
+ #define BYTE_ORDER_LITTLE_ENDIAN
+-#elif         defined(__mc68000__) \
++#elif defined(__mc68000__) \
++      || (defined(__arm__) && (defined(ARMEB) || defined(__ARMEB__))) \
++      || defined (__avr32__) \
+       || defined (__sparc__) \
+       || defined (__sparc) \
+       || defined (__PPC__) \
diff --git a/net/hping3/patches/102-lib_rename.patch b/net/hping3/patches/102-lib_rename.patch
new file mode 100644 (file)
index 0000000..c5d102c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/libpcap_stuff.c
++++ b/libpcap_stuff.c
+@@ -17,7 +17,7 @@
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+ #include <pcap.h>
+-#include <net/bpf.h>
++#include <pcap-bpf.h>
+ #include "globals.h"
diff --git a/net/hsflowd/Makefile b/net/hsflowd/Makefile
new file mode 100644 (file)
index 0000000..92835a5
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=hsflowd
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=@SF/host-sflow
+PKG_VERSION:=1.20
+PKG_MD5SUM:=0bfc0b05fbab27a80557c5efb5e66693
+
+PKG_USE_MIPS16:=0
+
+PKG_SOURCE:=hsflowd-$(PKG_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hsflowd
+  SECTION:=net
+  CATEGORY:=Base system
+  DEPENDS:=+libpthread
+  TITLE:=Host sFlow export agent
+  URL:=http://host-sflow.sourceforge.net/
+endef
+
+define Package/sflowovsd
+  SECTION:=net
+  CATEGORY:=Base system
+  DEPENDS:=+hsflowd
+  TITLE:=Host sFlow Open vSwitch agent
+  URL:=http://host-sflow.sourceforge.net/
+endef
+
+
+define Package/hsflowd/description
+ The Host sFlow agent exports server performance metrics using the sFlow
+ protocol. The agent is intended to provide scalable, multi-vendor,
+ multi-OS performance monitoring with minimal impact on the systems being
+ monitored.
+endef
+
+define Package/sflowovsd/description
+ The Host sFlow agent can automatically configure the sFlow settings in
+ the Open vSwitch.
+endef
+
+MAKE_VARS += \
+       LIBVIRT=no \
+       XEN_DDK=no \
+       DEBIAN=no \
+       PLATFORM=Linux \
+       OPT="$(TARGET_CFLAGS) -std=c99"
+
+define Package/hsflowd/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/Linux/hsflowd $(1)/usr/sbin
+       $(INSTALL_BIN) ./files/hsflowd.init $(1)/etc/init.d/hsflowd
+       $(INSTALL_CONF) ./files/hsflowd.config $(1)/etc/config/hsflowd
+
+endef
+
+define Package/sflowovsd/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/Linux/sflowovsd $(1)/usr/sbin
+       $(INSTALL_BIN) ./files/sflowovsd.init $(1)/etc/init.d/sflowovsd
+endef
+
+$(eval $(call BuildPackage,hsflowd))
+$(eval $(call BuildPackage,sflowovsd))
diff --git a/net/hsflowd/files/hsflowd.config b/net/hsflowd/files/hsflowd.config
new file mode 100644 (file)
index 0000000..77262f8
--- /dev/null
@@ -0,0 +1,11 @@
+config hsflowd config
+       option enabled  '0'
+       option dnssd    '0'
+       option polling  '30'
+       option sampling '512'
+       option uuid     ''
+
+config collector
+       option ip       '192.168.123.123'
+       option port     '6343'
+
diff --git a/net/hsflowd/files/hsflowd.init b/net/hsflowd/files/hsflowd.init
new file mode 100644 (file)
index 0000000..7212826
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       config_load hsflowd
+       local args agent conffile dnssd polling sampling uuid
+
+       getcollectors() {
+               echo " collector {" >> $tmpconf
+
+               config_get ip "$1" ip
+               [ -n "$ip" ] && echo "  ip=${ip}" >> $tmpconf
+               config_get port "$1" port
+               [ -n "$port" ] && echo "  udpport=${port}" >> $tmpconf
+               
+               echo " }" >> $tmpconf
+       }
+
+       config_get agent config agent_iface "br-lan"
+       config_get conffile config config_file
+       config_get_bool dnssd config dnssd 1
+       config_get polling config polling 30
+       config_get sampling config sampling 512
+       config_get uuid config uuid
+
+       [ -z "$uuid" ] && {
+               uuid="$(cat /proc/sys/kernel/random/uuid)"
+               uci set hsflowd.config.uuid=$uuid
+               uci commit hsflowd
+       }
+
+       args=""
+       append args "-u $uuid"
+
+       if [ -n "$conffile" ]; then
+               append args "-f $conffile"
+       else
+               tmpconf="/var/etc/hsflowd.conf"
+               append args "-f $tmpconf"
+               mkdir -p /var/etc
+
+               echo "sFlow {" > $tmpconf
+               echo " agent=${agent}" >> $tmpconf
+               
+               if [ "$dnssd" -eq 1 ]; then
+                       echo " DNSSD=on" >> $tmpconf    
+               else
+                       echo " DNSSD=off" >> $tmpconf
+                       echo " polling=${polling}" >> $tmpconf
+                       echo " sampling=${sampling}" >> $tmpconf
+
+                       config_foreach getcollectors collector
+               fi
+               
+               echo "}" >> $tmpconf
+
+       fi
+
+
+       service_start /usr/sbin/hsflowd $args
+}
+
+stop() {
+       service_stop /usr/sbin/hsflowd
+
+       pid_file="/var/run/hsflowd.pid"
+       [ -f "$pid_file" ] && rm -f "$pid_file"
+}
diff --git a/net/hsflowd/files/sflowovsd.init b/net/hsflowd/files/sflowovsd.init
new file mode 100644 (file)
index 0000000..ab9bac9
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/sflowovsd -f /var/run/hsflowd.auto
+}
+
+stop() {
+       service_stop /usr/sbin/sflowovsd
+
+       pid_file="/var/run/sflowovsd.pid"
+       [ -f "$pid_file" ] && rm -f "$pid_file"
+}
diff --git a/net/hsflowd/patches/100-crosscompile.patch b/net/hsflowd/patches/100-crosscompile.patch
new file mode 100644 (file)
index 0000000..b677182
--- /dev/null
@@ -0,0 +1,91 @@
+--- a/src/Linux/Makefile
++++ b/src/Linux/Makefile
+@@ -74,7 +74,7 @@ HEADERS= hsflowd.h hsflowtokens.h sflowo
+ SFLOWDIR=../sflow
+ #CC= g++
+-CC= gcc -std=gnu99
++CC?= gcc -std=gnu99
+ OPT_FULL = -O3 -DNDEBUG
+ OPT_DEBUG = -g -ggdb
+--- a/src/sflow/Makefile
++++ b/src/sflow/Makefile
+@@ -3,7 +3,7 @@
+ HEADERS= sflow_api.h sflow.h Makefile
+-OPT = -O3 -DNDEBUG
++OPT ?= -O3 -DNDEBUG
+ #OPT = -g -ggdb -O2
+ #OPT= -g -ggdb
+@@ -12,7 +12,7 @@ LDFLAGS=
+ #CC= g++
+ #CC= gcc -std=c99
+-CC= gcc
++CC?= gcc
+ OBJS= sflow_agent.o \
+       sflow_sampler.o \
+@@ -20,8 +20,8 @@ OBJS= sflow_agent.o \
+       sflow_receiver.o
+ libsflow.a: $(OBJS)
+-      ar cru $@ $(OBJS)
+-      ranlib $@
++      $(AR) cru $@ $(OBJS)
++      $(RANLIB) $@
+ all: libsflow.a
+--- a/Makefile
++++ b/Makefile
+@@ -11,32 +11,32 @@ all: $(PROG) 
+ $(PROG):
+       cd src/sflow; $(MAKE)
+-      PLATFORM=`uname`; \
++      PLATFORM?=`uname`; \
+       MYVER=`./getVersion`; \
+         MYREL=`./getRelease`; \
+         cd src/$$PLATFORM; $(MAKE) VERSION=$$MYVER RELEASE=$$MYREL
+ clean:
+       cd src/sflow; $(MAKE) clean
+-      PLATFORM=`uname`; \
++      PLATFORM?=`uname`; \
+       MYVER=`./getVersion`; \
+         MYREL=`./getRelease`; \
+         cd src/$$PLATFORM; $(MAKE) VERSION=$$MYVER RELEASE=$$MYREL clean
+ install:
+-      PLATFORM=`uname`; \
++      PLATFORM?=`uname`; \
+       MYVER=`./getVersion`; \
+         MYREL=`./getRelease`; \
+         cd src/$$PLATFORM; $(MAKE) VERSION=$$MYVER RELEASE=$$MYREL install
+ schedule:
+-      PLATFORM=`uname`; \
++      PLATFORM?=`uname`; \
+       MYVER=`./getVersion`; \
+         MYREL=`./getRelease`; \
+         cd src/$$PLATFORM; $(MAKE) VERSION=$$MYVER RELEASE=$$MYREL schedule
+ rpm:
+-      PLATFORM=`uname`; \
++      PLATFORM?=`uname`; \
+       MYVER=`./getVersion`; \
+         MYREL=`./getRelease`; \
+       MYSRCDIR=$(RPM_SOURCES_DIR)/$(PROG)-$$MYVER; \
+@@ -46,7 +46,7 @@ rpm:
+       rpmbuild -ba $(PROG).spec
+ deb: $(PROG)
+-      PLATFORM=`uname`; \
++      PLATFORM?=`uname`; \
+       MYARCH=`uname -m`; \
+       MYVER=`./getVersion`; \
+         MYREL=`./getRelease`; \
diff --git a/net/hsflowd/patches/200-uclibc-compat.patch b/net/hsflowd/patches/200-uclibc-compat.patch
new file mode 100644 (file)
index 0000000..4c0a82e
--- /dev/null
@@ -0,0 +1,63 @@
+--- a/src/Linux/hsflowd.c
++++ b/src/Linux/hsflowd.c
+@@ -1408,13 +1408,12 @@ extern "C" {
+       signal(SIGXFSZ, SIG_DFL);
+       // ask for the backtrace pointers
+-      size_t siz = backtrace(backtracePtrs, HSP_NUM_BACKTRACE_PTRS);
++      size_t siz = 0;
+       if(f_crash == NULL) {
+         f_crash = stderr;
+       }
+-      backtrace_symbols_fd(backtracePtrs, siz, fileno(f_crash));
+       fflush(f_crash);
+       // Do something useful with siginfo_t 
+       if (sig == SIGSEGV) {
+@@ -1430,7 +1429,6 @@ extern "C" {
+       // overwrite sigaction with caller's address
+       backtracePtrs[1] = (void *)(((ucontext_t *)secret)->uc_mcontext.gregs[REG_EIP]);
+       // then write again:
+-      backtrace_symbols_fd(backtracePtrs, siz, fileno(f_crash));
+       fflush(f_crash);
+ #endif
+       // exit with the original signal so we get the right idea
+@@ -2005,7 +2003,6 @@ extern "C" {
+             if(debug) {
+               myLog(LOG_INFO, "initAgent suceeded");
+               // print some stats to help us size HSP_RLIMIT_MEMLOCK etc.
+-              malloc_stats();
+             }
+             if(sp->dropPriv) {
+--- a/src/Linux/hsflowd.h
++++ b/src/Linux/hsflowd.h
+@@ -34,9 +34,7 @@ extern "C" {
+ #include <limits.h> // for UINT_MAX
+ // for signal backtrace
+-#include <execinfo.h>
+ #include <signal.h>
+-#include <ucontext.h>
+ #include <stdarg.h> // for va_start()
+ #include "util.h"
+--- a/src/Linux/util.c
++++ b/src/Linux/util.c
+@@ -39,7 +39,6 @@ extern "C" {
+     void *mem = SYS_CALLOC(1, bytes);
+     if(mem == NULL) {
+       myLog(LOG_ERR, "calloc() failed : %s", strerror(errno));
+-      if(debug) malloc_stats();
+       exit(EXIT_FAILURE);
+     }
+     return mem;
+@@ -51,7 +50,6 @@ extern "C" {
+     void *mem = SYS_REALLOC(ptr, bytes);
+     if(mem == NULL) {
+       myLog(LOG_ERR, "realloc() failed : %s", strerror(errno));
+-      if(debug) malloc_stats();
+       exit(EXIT_FAILURE);
+     }
+     return mem;
diff --git a/net/hsflowd/patches/300-config_files_path.patch b/net/hsflowd/patches/300-config_files_path.patch
new file mode 100644 (file)
index 0000000..fe85a8e
--- /dev/null
@@ -0,0 +1,16 @@
+diff -Nurb a/src/Linux/hsflowd.h b/src/Linux/hsflowd.h
+--- a/src/Linux/hsflowd.h      2012-03-01 18:16:09.000000000 +0100
++++ b/src/Linux/hsflowd.h      2012-03-18 18:56:58.689852282 +0100
+@@ -72,9 +72,9 @@
+ #define HSP_DAEMON_NAME "hsflowd"
+ #define HSP_DEFAULT_PIDFILE "/var/run/hsflowd.pid"
+ #define HSP_DEFAULT_CONFIGFILE "/etc/hsflowd.conf"
+-#define HSP_DEFAULT_OUTPUTFILE "/etc/hsflowd.auto"
+-#define HSP_DEFAULT_VMSTORE_FILE "/etc/hsflowd.data"
+-#define HSP_DEFAULT_CRASH_FILE "/etc/hsflowd.crash"
++#define HSP_DEFAULT_OUTPUTFILE "/var/run/hsflowd.auto"
++#define HSP_DEFAULT_VMSTORE_FILE "/var/run/hsflowd.data"
++#define HSP_DEFAULT_CRASH_FILE "/var/run/hsflowd.crash"
+ /* Numbering to avoid clash. See http://www.sflow.org/developers/dsindexnumbers.php */
+ #define HSP_DEFAULT_PHYSICAL_DSINDEX 1
diff --git a/net/hsflowd/patches/400-sflowovsd_assert.patch b/net/hsflowd/patches/400-sflowovsd_assert.patch
new file mode 100644 (file)
index 0000000..dec63b1
--- /dev/null
@@ -0,0 +1,12 @@
+diff -Nurb a/src/Linux/Makefile b/src/Linux/Makefile
+--- a/src/Linux/Makefile       2011-09-07 01:15:22.000000000 +0200
++++ b/src/Linux/Makefile       2012-03-21 01:55:40.468569332 +0100
+@@ -97,7 +97,7 @@
+ SFLOWOVS_OBJS=sflowovsd.o util.o
+-CFLAGS+= -I. -I$(SFLOWDIR) $(OPT) -Wall -D_GNU_SOURCE -DHSP_VERSION=$(VERSION) -DUTHEAP
++CFLAGS+= -I. -I$(SFLOWDIR) $(OPT) -Wall -D_GNU_SOURCE -DHSP_VERSION=$(VERSION)
+ LIBS+= $(SFLOWDIR)/libsflow.a -lresolv -lpthread
+ #### BUILD ####
diff --git a/net/htpdate/Makefile b/net/htpdate/Makefile
new file mode 100644 (file)
index 0000000..8c1e9e3
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006 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:=htpdate
+PKG_VERSION:=1.0.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.clevervest.com/htp/archive/c/
+PKG_MD5SUM:=a13ec89839c33965794ebf53c4e690db
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/htpdate
+  SUBMENU:=Time Synchronization
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=an HTP (Hypertext Time Protocol) implementation
+  URL:=http://www.clevervest.com/htp/
+endef
+
+define Package/htpdate/description
+       The HTTP Time Protocol (HTP) is used to synchronize a computer's time
+       with web servers as reference time source. Htpdate will synchronize your
+       computer's time by extracting timestamps from HTTP headers found
+       in web server responses. Htpdate can be used as a daemon, to keep your
+       computer synchronized.
+endef
+
+define Package/htpdate/conffiles
+/etc/default/htpdate
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/htpdate/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/htpdate $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/default/
+       $(INSTALL_CONF) ./files/htpdate.default $(1)/etc/default/htpdate
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/htpdate.init $(1)/etc/init.d/htpdate
+endef
+
+$(eval $(call BuildPackage,htpdate))
+
diff --git a/net/htpdate/files/htpdate.default b/net/htpdate/files/htpdate.default
new file mode 100644 (file)
index 0000000..94674fd
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="www.google.com www.yahoo.com www.linux.org www.freebsd.org"
diff --git a/net/htpdate/files/htpdate.init b/net/htpdate/files/htpdate.init
new file mode 100644 (file)
index 0000000..1409321
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=49
+BIN=htpdate
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       mkdir -p $RUN_D
+       $BIN -l -s -t $OPTIONS && $BIN -D $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
+
diff --git a/net/htpdate/patches/100-adjtimex.patch b/net/htpdate/patches/100-adjtimex.patch
new file mode 100644 (file)
index 0000000..ec7c8a9
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/htpdate.c
++++ b/htpdate.c
+@@ -359,7 +359,7 @@ static int htpdate_adjtimex( double drif
+       /* Read current kernel frequency */
+       tmx.modes = 0;
+-      ntp_adjtime(&tmx);
++      adjtimex(&tmx);
+       /* Calculate new frequency */
+       freq = (long)(65536e6 * drift);
+@@ -377,7 +377,7 @@ static int htpdate_adjtimex( double drif
+               printlog( 1, "seteuid()" );
+               exit(1);
+       } else {
+-              return( ntp_adjtime(&tmx) );
++              return( adjtimex(&tmx) );
+       }
+ }
diff --git a/net/httping/Makefile b/net/httping/Makefile
new file mode 100644 (file)
index 0000000..b0b41b1
--- /dev/null
@@ -0,0 +1,84 @@
+#
+# Copyright (C) 2006-2014 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:=httping
+PKG_VERSION:=2.3.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.vanheusden.com/httping
+PKG_MD5SUM:=7a71ed513f9f22fe331b783a3d36767e
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/httping/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Httping is like 'ping' but for http-requests
+  URL:=http://www.vanheusden.com/httping/
+  DEPENDS:=$(INTL_DEPENDS)
+endef
+
+define Package/httping/Default/description
+       Give it an url, and it'll show you how long it takes to connect, send a
+       request and retrieve the reply (only the headers). Be aware that the
+       transmission across the network also takes time!
+endef
+
+define Package/httping
+  $(call Package/httping/Default)
+  DEPENDS+= +libopenssl
+  TITLE+= (with SSL support)
+  VARIANT:=ssl
+endef
+
+define Package/httping/description
+       $(call Package/httping/Default/description)
+       This package is built with SSL support.
+endef
+
+define Package/httping-nossl
+  $(call Package/httping/Default)
+  TITLE+= (without SSL support)
+  VARIANT:=nossl
+endef
+
+define Package/httping-nossl/description
+       $(call Package/httping/Default/description)
+       This package is built without SSL support.
+endef
+
+define Build/Configure
+endef
+
+TARGET_LDFLAGS += $(INTL_LDFLAGS) $(if $(INTL_FULL),-lintl)
+
+MAKE_FLAGS += \
+       DEBUG="no" \
+       FW="no" \
+       NC="no" \
+       TFO="no"
+
+ifeq ($(BUILD_VARIANT),nossl)
+       MAKE_FLAGS += SSL="no"
+endif
+
+define Package/httping/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/httping $(1)/usr/bin/
+endef
+
+Package/httping-nossl/install = $(Package/httping/install)
+
+$(eval $(call BuildPackage,httping))
+$(eval $(call BuildPackage,httping-nossl))
diff --git a/net/httping/patches/001-no_strip.patch b/net/httping/patches/001-no_strip.patch
new file mode 100644 (file)
index 0000000..8f3bb29
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile
++++ b/Makefile
+@@ -113,9 +113,6 @@ install: $(TARGET) $(TRANSLATIONS)
+       $(INSTALLMAN) $(MAN_NL) $(DESTDIR)/$(MANDIR)/nl/man1
+       $(INSTALLDIR) $(DESTDIR)/$(DOCDIR)
+       $(INSTALLDOC) $(DOCS) $(DESTDIR)/$(DOCDIR)
+-ifneq ($(DEBUG),yes)
+-      $(STRIP) $(DESTDIR)/$(BINDIR)/$(TARGET)
+-endif
+       mkdir -p $(DESTDIR)/$(PREFIX)/share/locale/nl/LC_MESSAGES
+       cp nl.mo $(DESTDIR)/$(PREFIX)/share/locale/nl/LC_MESSAGES/httping.mo
diff --git a/net/httptunnel/Makefile b/net/httptunnel/Makefile
new file mode 100644 (file)
index 0000000..ba753ee
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# 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:=httptunnel
+PKG_VERSION:=3.3
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.nocrew.org/pub/nocrew/unix/
+PKG_MD5SUM:=493cc0f5f21e9955db27ee9cd9a976d5
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/httptunnel
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl
+  SUBMENU:=Firewall Tunnel
+  TITLE:=bidirectional tunnel in HTTP requests
+  URL:=http://www.nocrew.org/software/httptunnel.html
+endef
+
+define Package/httptunnel/description
+       httptunnel creates a bidirectional virtual data connection tunnelled in HTTP requests.
+       The HTTP requests can be sent via an HTTP proxy if so desired.
+endef
+
+define Package/httptunnel/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/hts $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/htc $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/httptunnel.init $(1)/etc/init.d/httptunnel
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/httptunnel.config $(1)/etc/config/httptunnel
+endef
+
+define Package/httptunnel/conffiles
+/etc/config/httptunnel
+endef
+
+$(eval $(call BuildPackage,httptunnel))
diff --git a/net/httptunnel/files/httptunnel.config b/net/httptunnel/files/httptunnel.config
new file mode 100644 (file)
index 0000000..fb5a5dd
--- /dev/null
@@ -0,0 +1,4 @@
+config httptunnel
+        option destination 'localhost:443'
+       option sourceport '80'
+
diff --git a/net/httptunnel/files/httptunnel.init b/net/httptunnel/files/httptunnel.init
new file mode 100644 (file)
index 0000000..6c84618
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+START=70
+BIN=hts
+
+start_httptunnel() {
+    local section="$1"    
+    
+    config_get destination "$section" destination
+    config_get sourceport "$section" sourceport 
+    
+    echo start httptunnel: dest: "$destination", src: "$sourceport"
+    
+    $BIN --forward-port "$destination" "$sourceport"
+}
+
+
+start() {
+    config_load httptunnel
+    config_foreach start_httptunnel httptunnel
+}
+
+stop() {
+        ps aux | grep hts |  awk '{print }' | \
+            xargs kill 2> /dev/null
+}
+                                                                       
\ No newline at end of file
diff --git a/net/icmptx/Makefile b/net/icmptx/Makefile
new file mode 100644 (file)
index 0000000..73e4c9f
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006-2010 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:=icmptx
+PKG_REV:=33e0b826f99df290ee792f6aa587af273d674309
+PKG_VERSION:=0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/jakkarth/icmptx.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/icmptx
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall Tunnel
+  TITLE:=IP-over-ICMP tunnel
+  URL:=http://github.com/jakkarth/icmptx
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               OPT_FLAGS="$(TARGET_CFLAGS)" \
+               icmptx
+endef
+
+define Package/icmptx/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/icmptx $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,icmptx))
diff --git a/net/icmptx/patches/001-cross_compile.patch b/net/icmptx/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..c048d56
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,15 +1,17 @@
+-flags=-g3 -Wall -ansi -pedantic -D_GNU_SOURCE
++OPT_FLAGS=-g3
++
++flags=$(OPT_FLAGS) -Wall -ansi -pedantic -D_GNU_SOURCE
+ all: icmptx
+ icmptx: it.o icmptx.c tun_dev.o
+-      gcc $(flags) -o icmptx icmptx.c it.o tun_dev.o
++      $(CC) $(flags) -o icmptx icmptx.c it.o tun_dev.o
+ it.o: it.c tun_dev.h
+-      gcc $(flags) -c it.c
++      $(CC) $(flags) -c it.c
+ tun_dev.o: tun_dev.c
+-      gcc $(flags) -c tun_dev.c
++      $(CC) $(flags) -c tun_dev.c
+ clean:
+       rm -f tun_dev.o it.o icmptx
diff --git a/net/ifstat/Makefile b/net/ifstat/Makefile
new file mode 100644 (file)
index 0000000..ca49877
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2007 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:=ifstat
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://gael.roualland.free.fr/ifstat
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=b655642c33a626cfe976792fbcd9b6e1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ifstat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Network interface bandwidth usage
+  URL:=http://gael.roualland.free.fr/ifstat/
+endef
+
+define Package/ifstat/description
+ Network interface bandwidth usage, with support for snmp targets
+endef
+
+CONFIGURE_ARGS += \
+       --with-proc=yes \
+       --with-snmp=no \
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               config.h.in \
+               configure \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) all
+endef
+
+define Package/ifstat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ifstat $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ifstat))
diff --git a/net/ifstat/patches/001-configure_cross.patch b/net/ifstat/patches/001-configure_cross.patch
new file mode 100644 (file)
index 0000000..053b055
--- /dev/null
@@ -0,0 +1,913 @@
+diff -ruN ifstat-1.1-old/configure ifstat-1.1-new/configure
+--- ifstat-1.1-old/configure   2004-01-01 20:18:14.000000000 +0100
++++ ifstat-1.1-new/configure   2007-09-06 12:20:40.000000000 +0200
+@@ -1387,34 +1387,39 @@
+   esac
+   echo $ac_n "checking for proc interface in $file""... $ac_c" 1>&6
+ echo "configure:1390: checking for proc interface in $file" >&5
+-  if grep -q Inter- $file 2>/dev/null; then
+-    cat >> confdefs.h <<\EOF
++  if test "$cross_compiling" = yes; then
++    with_proc=cross
++  elif grep -q Inter- $file 2>/dev/null; then
++    with_proc=yes
++  else
++    with_proc=no
++  fi
++  echo "$ac_t""$with_proc" 1>&6
++fi
++if test "x$with_proc" != "xno"; then
++  cat >> confdefs.h <<\EOF
+ #define USE_PROC 1
+ EOF
+-    cat >> confdefs.h <<EOF
++  cat >> confdefs.h <<EOF
+ #define PROC_FILE "$file"
+ EOF
+-    with_proc=yes
+-    with_ioctl=yes
+-    local=yes
+-  else
+-    with_proc=no
+-  fi
+-  echo "$ac_t""$with_proc" 1>&6
++  with_proc=yes
++  with_ioctl=yes
++  local=yes
+ fi
+ # checking for kstat (Solaris)
+ test "x$with_kstat" = "xauto" -a "x$local" = "xyes" && with_kstat=no
+ if test "x$with_kstat" != "xno"; then
+   echo $ac_n "checking for kstat_open""... $ac_c" 1>&6
+-echo "configure:1413: checking for kstat_open" >&5
++echo "configure:1418: checking for kstat_open" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_kstat_open'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1418 "configure"
++#line 1423 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char kstat_open(); below.  */
+@@ -1437,7 +1442,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_kstat_open=yes"
+ else
+@@ -1461,7 +1466,7 @@
+     case "x$LIBS" in
+       *-lkstat*) ;;
+       *) echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6
+-echo "configure:1465: checking for kstat_open in -lkstat" >&5
++echo "configure:1470: checking for kstat_open in -lkstat" >&5
+ ac_lib_var=`echo kstat'_'kstat_open | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -1469,7 +1474,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lkstat  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 1473 "configure"
++#line 1478 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -1480,7 +1485,7 @@
+ kstat_open()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -1507,17 +1512,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1511: checking for $ac_hdr" >&5
++echo "configure:1516: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1516 "configure"
++#line 1521 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1521: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1557,17 +1562,17 @@
+ if test "x$with_ifmib" != "xno"; then
+   ac_safe=`echo "net/if_mib.h" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for net/if_mib.h""... $ac_c" 1>&6
+-echo "configure:1561: checking for net/if_mib.h" >&5
++echo "configure:1566: checking for net/if_mib.h" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1566 "configure"
++#line 1571 "configure"
+ #include "confdefs.h"
+ #include <net/if_mib.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1571: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1584,12 +1589,12 @@
+ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   echo $ac_n "checking for sysctl""... $ac_c" 1>&6
+-echo "configure:1588: checking for sysctl" >&5
++echo "configure:1593: checking for sysctl" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysctl'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1593 "configure"
++#line 1598 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char sysctl(); below.  */
+@@ -1612,7 +1617,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_sysctl=yes"
+ else
+@@ -1642,17 +1647,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1646: checking for $ac_hdr" >&5
++echo "configure:1651: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1651 "configure"
++#line 1656 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1679,13 +1684,13 @@
+ done
+     echo $ac_n "checking for working ifmib sysctl""... $ac_c" 1>&6
+-echo "configure:1683: checking for working ifmib sysctl" >&5
++echo "configure:1688: checking for working ifmib sysctl" >&5
+     # try run since interface is available on darwin but doesn't work
+     if test "$cross_compiling" = yes; then
+   with_ifmib=maybe
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1689 "configure"
++#line 1694 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+               #include <sys/socket.h>
+@@ -1706,7 +1711,7 @@
+               int size;
+               int main() { return sysctl(ifcount, 5, NULL, &size, NULL, NULL); }
+ EOF
+-if { (eval echo configure:1710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
++if { (eval echo configure:1715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+ then
+   with_ifmib=yes
+ else
+@@ -1733,9 +1738,9 @@
+ test "x$with_ifdata" = "xauto" -a "x$local" = "xyes" && with_ifdata=no
+ if test "x$with_ifdata" != "xno"; then
+   echo $ac_n "checking for SIOCGIFDATA and ifdatareq""... $ac_c" 1>&6
+-echo "configure:1737: checking for SIOCGIFDATA and ifdatareq" >&5
++echo "configure:1742: checking for SIOCGIFDATA and ifdatareq" >&5
+   cat > conftest.$ac_ext <<EOF
+-#line 1739 "configure"
++#line 1744 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                 #include <sys/socket.h>
+@@ -1753,7 +1758,7 @@
+                 ifd.ifd_ifd.ifi_ibytes = ifd.ifd_ifd.ifi_obytes;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   with_ifdata=yes
+ else
+@@ -1768,9 +1773,9 @@
+ fi
+ if test "x$with_ifdata" = "xcheckifr"; then
+   echo $ac_n "checking for SIOCGIFDATA and ifreq.ifr_data""... $ac_c" 1>&6
+-echo "configure:1772: checking for SIOCGIFDATA and ifreq.ifr_data" >&5
++echo "configure:1777: checking for SIOCGIFDATA and ifreq.ifr_data" >&5
+   cat > conftest.$ac_ext <<EOF
+-#line 1774 "configure"
++#line 1779 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                 #include <sys/socket.h>
+@@ -1789,7 +1794,7 @@
+                 ifd.ifi_ibytes = ifd.ifi_obytes;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   with_ifdata=yes
+                    cat >> confdefs.h <<\EOF
+@@ -1821,17 +1826,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:1825: checking for $ac_hdr" >&5
++echo "configure:1830: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1830 "configure"
++#line 1835 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:1835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:1840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -1858,12 +1863,12 @@
+ done
+   echo $ac_n "checking for sysctl""... $ac_c" 1>&6
+-echo "configure:1862: checking for sysctl" >&5
++echo "configure:1867: checking for sysctl" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_sysctl'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1867 "configure"
++#line 1872 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char sysctl(); below.  */
+@@ -1886,7 +1891,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_sysctl=yes"
+ else
+@@ -1908,9 +1913,9 @@
+   if test "x$with_route" = "xyes"; then
+     echo $ac_n "checking for route info sysctl""... $ac_c" 1>&6
+-echo "configure:1912: checking for route info sysctl" >&5
++echo "configure:1917: checking for route info sysctl" >&5
+     cat > conftest.$ac_ext <<EOF
+-#line 1914 "configure"
++#line 1919 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                   #include <sys/socket.h>
+@@ -1935,7 +1940,7 @@
+                   ifm.ifm_data.ifi_ibytes;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:1944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   with_route=yes
+ else
+@@ -1960,12 +1965,12 @@
+ test "x$with_kvm" = "xauto" -a "x$local" = "xyes" && with_kvm=no
+ if test "x$with_kvm" != "xno"; then
+   echo $ac_n "checking for kvm_openfiles""... $ac_c" 1>&6
+-echo "configure:1964: checking for kvm_openfiles" >&5
++echo "configure:1969: checking for kvm_openfiles" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_kvm_openfiles'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 1969 "configure"
++#line 1974 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char kvm_openfiles(); below.  */
+@@ -1988,7 +1993,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:1992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:1997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_kvm_openfiles=yes"
+ else
+@@ -2012,7 +2017,7 @@
+     case "x$LIBS" in
+      *-lkvm*) ;;
+      *) echo $ac_n "checking for kvm_openfiles in -lkvm""... $ac_c" 1>&6
+-echo "configure:2016: checking for kvm_openfiles in -lkvm" >&5
++echo "configure:2021: checking for kvm_openfiles in -lkvm" >&5
+ ac_lib_var=`echo kvm'_'kvm_openfiles | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -2020,7 +2025,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lkvm  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2024 "configure"
++#line 2029 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -2031,7 +2036,7 @@
+ kvm_openfiles()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -2059,17 +2064,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:2063: checking for $ac_hdr" >&5
++echo "configure:2068: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2068 "configure"
++#line 2073 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:2073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:2078: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -2093,12 +2098,12 @@
+       for ac_func in knlist
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:2097: checking for $ac_func" >&5
++echo "configure:2102: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2102 "configure"
++#line 2107 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+@@ -2121,7 +2126,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2142,16 +2147,16 @@
+  
+         with_kvm=yes
+         echo $ac_n "checking whether knlist takes 3 arguments""... $ac_c" 1>&6
+-echo "configure:2146: checking whether knlist takes 3 arguments" >&5
++echo "configure:2151: checking whether knlist takes 3 arguments" >&5
+         cat > conftest.$ac_ext <<EOF
+-#line 2148 "configure"
++#line 2153 "configure"
+ #include "confdefs.h"
+ #include <nlist.h>
+ int main() {
+ knlist((struct nlist *) 0, 0, 10);
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   knlist3=yes
+ else
+@@ -2172,12 +2177,12 @@
+ else
+   echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for nlist""... $ac_c" 1>&6
+-echo "configure:2176: checking for nlist" >&5
++echo "configure:2181: checking for nlist" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_nlist'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2181 "configure"
++#line 2186 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char nlist(); below.  */
+@@ -2200,7 +2205,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_nlist=yes"
+ else
+@@ -2232,12 +2237,12 @@
+       for ac_func in readx
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:2236: checking for $ac_func" >&5
++echo "configure:2241: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2241 "configure"
++#line 2246 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+@@ -2260,7 +2265,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2288,17 +2293,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:2292: checking for $ac_hdr" >&5
++echo "configure:2297: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2297 "configure"
++#line 2302 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:2302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:2307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -2330,17 +2335,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:2334: checking for $ac_hdr" >&5
++echo "configure:2339: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2339 "configure"
++#line 2344 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:2344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:2349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -2373,9 +2378,9 @@
+   fi
+   if test "x$with_kvm" = "xyes"; then
+     echo $ac_n "checking whether struct ifnet has needed interface data""... $ac_c" 1>&6
+-echo "configure:2377: checking whether struct ifnet has needed interface data" >&5
++echo "configure:2382: checking whether struct ifnet has needed interface data" >&5
+     cat > conftest.$ac_ext <<EOF
+-#line 2379 "configure"
++#line 2384 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                     #include <sys/socket.h>
+@@ -2388,7 +2393,7 @@
+                              in.if_type = in.if_flags
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   with_kvm=yes
+ else
+@@ -2402,9 +2407,9 @@
+   fi
+   if test "x$with_kvm" = "xyes"; then
+     echo $ac_n "checking for struct ifnet if_xname member""... $ac_c" 1>&6
+-echo "configure:2406: checking for struct ifnet if_xname member" >&5
++echo "configure:2411: checking for struct ifnet if_xname member" >&5
+     cat > conftest.$ac_ext <<EOF
+-#line 2408 "configure"
++#line 2413 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                     #include <sys/socket.h>
+@@ -2416,7 +2421,7 @@
+ struct ifnet in; in.if_xname[0] = 'a';
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ifxname=yes
+ else
+@@ -2433,9 +2438,9 @@
+     echo "$ac_t""$ifxname" 1>&6
+     echo $ac_n "checking for struct ifnet if_next member""... $ac_c" 1>&6
+-echo "configure:2437: checking for struct ifnet if_next member" >&5
++echo "configure:2442: checking for struct ifnet if_next member" >&5
+     cat > conftest.$ac_ext <<EOF
+-#line 2439 "configure"
++#line 2444 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                     #include <sys/socket.h>
+@@ -2447,7 +2452,7 @@
+ struct ifnet in; in.if_next;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   ifnext=yes
+ else
+@@ -2465,9 +2470,9 @@
+     else 
+       echo $ac_n "checking for struct ifnet if_link member""... $ac_c" 1>&6
+-echo "configure:2469: checking for struct ifnet if_link member" >&5
++echo "configure:2474: checking for struct ifnet if_link member" >&5
+       cat > conftest.$ac_ext <<EOF
+-#line 2471 "configure"
++#line 2476 "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+                       #include <sys/socket.h>
+@@ -2479,7 +2484,7 @@
+ struct ifnet in; in.if_link;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2483: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   iflink=yes
+ else
+@@ -2512,17 +2517,17 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+-echo "configure:2516: checking for $ac_hdr" >&5
++echo "configure:2521: checking for $ac_hdr" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2521 "configure"
++#line 2526 "configure"
+ #include "confdefs.h"
+ #include <$ac_hdr>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:2526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:2531: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -2549,9 +2554,9 @@
+ done
+   echo $ac_n "checking for dlpi streams interface""... $ac_c" 1>&6
+-echo "configure:2553: checking for dlpi streams interface" >&5
++echo "configure:2558: checking for dlpi streams interface" >&5
+   cat > conftest.$ac_ext <<EOF
+-#line 2555 "configure"
++#line 2560 "configure"
+ #include "confdefs.h"
+ #ifdef HAVE_UNISTD_H
+                 #include <unistd.h>
+@@ -2573,7 +2578,7 @@
+                   struct strbuf ctlptr; putmsg(0, &ctlptr, NULL, 0);
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   with_dlpi=yes
+ else
+@@ -2596,11 +2601,11 @@
+ test "x$with_win32" = "xauto" -a "x$local" = "xyes" && with_win32=no
+ if test "x$with_win32" != "xno"; then
+   echo $ac_n "checking for win32 GetIfTable interface""... $ac_c" 1>&6
+-echo "configure:2600: checking for win32 GetIfTable interface" >&5
++echo "configure:2605: checking for win32 GetIfTable interface" >&5
+   OLIBS="$LIBS"
+   LIBS="$LIBS -liphlpapi"
+   cat > conftest.$ac_ext <<EOF
+-#line 2604 "configure"
++#line 2609 "configure"
+ #include "confdefs.h"
+ #include <windows.h>
+                #include <iphlpapi.h>
+@@ -2608,7 +2613,7 @@
+ GetIfTable(NULL, NULL, 0);
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   with_win32=yes
+ else
+@@ -2636,12 +2641,12 @@
+ EOF
+   echo $ac_n "checking for socket""... $ac_c" 1>&6
+-echo "configure:2640: checking for socket" >&5
++echo "configure:2645: checking for socket" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2645 "configure"
++#line 2650 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char socket(); below.  */
+@@ -2664,7 +2669,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_socket=yes"
+ else
+@@ -2688,7 +2693,7 @@
+     case "x$LIBS" in
+       *-lsocket*);;
+       *) echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
+-echo "configure:2692: checking for socket in -lsocket" >&5
++echo "configure:2697: checking for socket in -lsocket" >&5
+ ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -2696,7 +2701,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lsocket  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2700 "configure"
++#line 2705 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -2707,7 +2712,7 @@
+ socket()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -2737,12 +2742,12 @@
+     esac
+   fi
+   echo $ac_n "checking for if_nameindex""... $ac_c" 1>&6
+-echo "configure:2741: checking for if_nameindex" >&5
++echo "configure:2746: checking for if_nameindex" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_if_nameindex'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2746 "configure"
++#line 2751 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char if_nameindex(); below.  */
+@@ -2765,7 +2770,7 @@
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_if_nameindex=yes"
+ else
+@@ -2789,7 +2794,7 @@
+     case "x$LIBS" in
+       *-lnsl*);;
+       *) echo $ac_n "checking for if_nameindex in -lnsl""... $ac_c" 1>&6
+-echo "configure:2793: checking for if_nameindex in -lnsl" >&5
++echo "configure:2798: checking for if_nameindex in -lnsl" >&5
+ ac_lib_var=`echo nsl'_'if_nameindex | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+@@ -2797,7 +2802,7 @@
+   ac_save_LIBS="$LIBS"
+ LIBS="-lnsl  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+-#line 2801 "configure"
++#line 2806 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+@@ -2808,7 +2813,7 @@
+ if_nameindex()
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+@@ -2832,9 +2837,9 @@
+   fi
+   if test "x$ifnameindex" != "xyes"; then
+     echo $ac_n "checking for sockaddr sa_len member""... $ac_c" 1>&6
+-echo "configure:2836: checking for sockaddr sa_len member" >&5
++echo "configure:2841: checking for sockaddr sa_len member" >&5
+     cat > conftest.$ac_ext <<EOF
+-#line 2838 "configure"
++#line 2843 "configure"
+ #include "confdefs.h"
+     #include <sys/types.h>
+@@ -2843,7 +2848,7 @@
+ struct sockaddr sa; sa.sa_len = 1;
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++if { (eval echo configure:2852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+   rm -rf conftest*
+   salen=yes
+ else
+@@ -2875,7 +2880,7 @@
+   # Extract the first word of "net-snmp-config", so it can be a program name with args.
+ set dummy net-snmp-config; ac_word=$2
+ echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-echo "configure:2879: checking for $ac_word" >&5
++echo "configure:2884: checking for $ac_word" >&5
+ if eval "test \"`echo '$''{'ac_cv_path_netsnmpconfig'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+@@ -2912,16 +2917,16 @@
+     CPPFLAGS="$CPPFLAGS `$netsnmpconfig --base-cflags 2>/dev/null`"
+     LDFLAGS="$LDFLAGS `$netsnmpconfig --libs 2>/dev/null`"
+     echo $ac_n "checking whether net-snmp-config hints compiles and links fine""... $ac_c" 1>&6
+-echo "configure:2916: checking whether net-snmp-config hints compiles and links fine" >&5
++echo "configure:2921: checking whether net-snmp-config hints compiles and links fine" >&5
+     cat > conftest.$ac_ext <<EOF
+-#line 2918 "configure"
++#line 2923 "configure"
+ #include "confdefs.h"
+ #include<net-snmp/net-snmp-config.h>
+ int main() {
+ snmp_sess_init((void *) 0);
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   snmp_ok=yes
+ else
+@@ -2948,17 +2953,17 @@
+     fi
+     ac_safe=`echo "net-snmp/net-snmp-config.h" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for net-snmp/net-snmp-config.h""... $ac_c" 1>&6
+-echo "configure:2952: checking for net-snmp/net-snmp-config.h" >&5
++echo "configure:2957: checking for net-snmp/net-snmp-config.h" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2957 "configure"
++#line 2962 "configure"
+ #include "confdefs.h"
+ #include <net-snmp/net-snmp-config.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:2962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:2967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -2979,17 +2984,17 @@
+   echo "$ac_t""no" 1>&6
+ ac_safe=`echo "ucd-snmp/ucd-snmp-config.h" | sed 'y%./+-%__p_%'`
+ echo $ac_n "checking for ucd-snmp/ucd-snmp-config.h""... $ac_c" 1>&6
+-echo "configure:2983: checking for ucd-snmp/ucd-snmp-config.h" >&5
++echo "configure:2988: checking for ucd-snmp/ucd-snmp-config.h" >&5
+ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+-#line 2988 "configure"
++#line 2993 "configure"
+ #include "confdefs.h"
+ #include <ucd-snmp/ucd-snmp-config.h>
+ EOF
+ ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+-{ (eval echo configure:2993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
++{ (eval echo configure:2998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+ if test -z "$ac_err"; then
+   rm -rf conftest*
+@@ -3040,18 +3045,18 @@
+       for lib in $SNMPLIBALONE "$libsnmp -lcrypto" ; do
+         if test "x$with_snmp" != "xyes" ; then
+           echo $ac_n "checking for snmp support in $lib""... $ac_c" 1>&6
+-echo "configure:3044: checking for snmp support in $lib" >&5
++echo "configure:3049: checking for snmp support in $lib" >&5
+           OLIBS="$LIBS"
+           LIBS="$LIBS $lib"
+           cat > conftest.$ac_ext <<EOF
+-#line 3048 "configure"
++#line 3053 "configure"
+ #include "confdefs.h"
+ int main() {
+ snmp_sess_init();
+ ; return 0; }
+ EOF
+-if { (eval echo configure:3055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:3060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   with_snmp=yes
+ else
+diff -ruN ifstat-1.1-old/configure.in ifstat-1.1-new/configure.in
+--- ifstat-1.1-old/configure.in        2003-11-22 02:27:51.000000000 +0100
++++ ifstat-1.1-new/configure.in        2007-09-06 12:20:21.000000000 +0200
+@@ -59,17 +59,22 @@
+      *) file=/proc/net/dev ;;
+   esac
+   AC_MSG_CHECKING([for proc interface in $file])
+-  if grep -q Inter- $file 2>/dev/null; then
+-    AC_DEFINE([USE_PROC], 1, [Define if you want to use /proc to get stats])
+-    AC_DEFINE_UNQUOTED([PROC_FILE], ["$file"], [Proc file to poll for stats])
++  if test "$cross_compiling" = yes; then
++    with_proc=cross
++  elif grep -q Inter- $file 2>/dev/null; then
+     with_proc=yes
+-    with_ioctl=yes
+-    local=yes
+   else
+     with_proc=no
+   fi
+   AC_MSG_RESULT([$with_proc])
+ fi
++if test "x$with_proc" != "xno"; then
++  AC_DEFINE([USE_PROC], 1, [Define if you want to use /proc to get stats])
++  AC_DEFINE_UNQUOTED([PROC_FILE], ["$file"], [Proc file to poll for stats])
++  with_proc=yes
++  with_ioctl=yes
++  local=yes
++fi
+ # checking for kstat (Solaris)
+ test "x$with_kstat" = "xauto" -a "x$local" = "xyes" && with_kstat=no
diff --git a/net/imsnif/Makefile b/net/imsnif/Makefile
new file mode 100644 (file)
index 0000000..6ac4c50
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2008-2014 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:=imsnif
+PKG_VERSION:=0.04
+PKG_RELEASE:=5
+
+PKG_SOURCE_URL:=@SF/im-snif
+PKG_SOURCE:=$(PKG_NAME)f_$(PKG_VERSION).tgz
+PKG_MD5SUM:=689c456f8edb77b9b4199a25514ac683
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) -xvf -
+
+define Package/imsnif
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Instant Messaging
+  DEPENDS:=+libpcap $(CXX_DEPENDS)
+  TITLE:=MSN Messenger sniffer
+  URL:=http://sourceforge.net/projects/im-snif
+endef
+
+define Package/imsnif/description
+  IMsnif is a simple program to log Instant Message activity
+  on the network. It uses libpcap to capture packets and
+  analyzes them, logging conversation, contact lists, etc.
+endef
+
+define Build/Compile
+       $(TARGET_CXX) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -fno-rtti -I$(LINUX_DIR)/include \
+               -o $(PKG_BUILD_DIR)/src/imsnif \
+                       $(PKG_BUILD_DIR)/src/imsniff.cpp \
+                       $(PKG_BUILD_DIR)/src/util.cpp \
+                       $(PKG_BUILD_DIR)/src/msn_conntrack.cpp \
+                       $(PKG_BUILD_DIR)/src/msn_handlers.cpp \
+               -L$(STAGING_DIR)/usr/lib -lpcap \
+                       $(PKG_BUILD_DIR)/src/pcap_stuff.cpp
+endef
+
+define Package/imsnif/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/docs/imsniff.conf.sample $(1)/etc/imsnif.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/imsnif $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/imsnif $(1)/usr/bin
+endef
+
+define Package/imsnif/conffiles
+/etc/imsnif.conf
+endef
+
+$(eval $(call BuildPackage,imsnif))
diff --git a/net/imsnif/files/imsnif b/net/imsnif/files/imsnif
new file mode 100755 (executable)
index 0000000..12c2f28
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+#Copyright (C) 2007 RoadRunner.cx
+START=85
+
+start() {
+    [ -f /etc/imsnif.conf ] && /usr/bin/imsnif || {
+       cat <<EOF
+You have not created configuration file.
+Store your configuration as /etc/imsnif.conf
+EOF
+    }
+}
+
+stop() {
+    [ `ps ax|grep -v grep|grep -c imsnif` != "0" ] && killall imsnif
+}
\ No newline at end of file
diff --git a/net/imsnif/patches/001-openwrt_paths.patch b/net/imsnif/patches/001-openwrt_paths.patch
new file mode 100644 (file)
index 0000000..21d9a11
--- /dev/null
@@ -0,0 +1,62 @@
+diff -Naur imsniff.orig/docs/imsniff.conf.sample imsniff/docs/imsniff.conf.sample
+--- imsniff.orig/docs/imsniff.conf.sample      2005-05-23 21:14:06.000000000 +0300
++++ imsniff/docs/imsniff.conf.sample   2007-07-25 04:20:31.000000000 +0300
+@@ -1,7 +1,7 @@
+-daemonize = 0
++daemonize = 1
+ promisc = 0
+-verbose = 2
+-chatdir = /tmp/chats
+-debugdir = /tmp/debug
+-interface eth0
++verbose = 1
++chatdir = /var/log/imsnif
++debugdir = /var/log
++interface = eth0.1
+diff -Naur imsniff.orig/src/imsniff.cpp imsniff/src/imsniff.cpp
+--- imsniff.orig/src/imsniff.cpp       2005-09-02 15:52:28.000000000 +0300
++++ imsniff/src/imsniff.cpp    2007-07-25 03:14:00.000000000 +0300
+@@ -4,8 +4,8 @@
+ //char debuglogdir[1024]="/var/log";
+-char chatlogdir[MAX_DIR_LENGTH+1]="";
+-char debuglogdir[MAX_DIR_LENGTH+1]="";
++char chatlogdir[MAX_DIR_LENGTH+1]="/var/log/imsnif";
++char debuglogdir[MAX_DIR_LENGTH+1]="/var/log";
+ int daemonize=0;
+ char *currentversion = "0.04";
+ int data_offset = -1;
+@@ -652,7 +652,14 @@
+               c--;
+       c++; /* Start of real name */
+       if (strlen (c) == 0) /* Uh? */
++      { //Jake's hack to read default configuration file if it exists.
++              f = fopen("/etc/imsnif.conf", "r");
++              if (f!=NULL)
++              {
++                  read_file (f);
++              }
+               return 0;
++      }
+       if (strchr (c, '%')!=NULL) /* Prevent strange things */
+               return -1;
+       fn = (char *) malloc (strlen (c) + 11);
+diff -Naur imsniff.orig/src/util.cpp imsniff/src/util.cpp
+--- imsniff.orig/src/util.cpp  2005-09-02 15:27:58.000000000 +0300
++++ imsniff/src/util.cpp       2007-07-25 04:17:36.000000000 +0300
+@@ -254,11 +254,11 @@
+ #ifdef WIN32
+                       struct tm *stm;
+                       stm= localtime (&now);
+-                      sprintf (fn, "%s/imsniff_%04d-%02d-%02d.log", debuglogdir, stm->tm_year, stm->tm_mon, stm->tm_mday);
++                      sprintf (fn, "%s/imsnif_%04d-%02d-%02d.log", debuglogdir, stm->tm_year, stm->tm_mon, stm->tm_mday);
+ #else
+                       struct tm stm;
+                       localtime_r (&now, &stm);
+-                      sprintf (fn, "%s/imsniff_%04d-%02d-%02d.log", debuglogdir, stm.tm_year, stm.tm_mon, stm.tm_mday);
++                      sprintf (fn, "%s/imsnif_%04d-%02d-%02d.log", debuglogdir, stm.tm_year, stm.tm_mon, stm.tm_mday);
+ #endif
+                       FILE *o=fopen (fn, "a+t");
+                       if (o!=NULL)
diff --git a/net/imspector/Makefile b/net/imspector/Makefile
new file mode 100644 (file)
index 0000000..9990872
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2007-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Author: Carlos Cesario
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=imspector
+PKG_VERSION:=0.9
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.imspector.org/downloads
+PKG_MD5SUM:=626abf7c2b8f15d56df679ad66624575
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/imspector
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Instant Messaging
+  TITLE:=IMSpector is an Instant Messenger proxy
+  URL:=http://www.imspector.org
+  DEPENDS:=+libopenssl +libstdcpp +libmysqlclient +libsqlite3 +libpq \
+       +libpthread $(ICONV_DEPENDS)
+endef
+
+define Package/imspector/description
+       IMSpector is an Instant Messenger proxy with monitoring and blocking,
+       and content-filtering capabilities.
+endef
+
+define Package/imspector/conffiles
+/etc/config/imspector
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               sed -ie 's/#ADD_PLUGINS/ADD_PLUGINS/' Makefile \
+       );
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+           DESTDIR="$(PKG_INSTALL_DIR)" \
+           $(TARGET_CONFIGURE_OPTS) \
+           SSL_DIR="$(STAGING_DIR)/usr" \
+           SSL_LIBS="$(TARGET_LDFLAGS) -lssl -lcrypto" \
+           SSL_FLAGS="$(TARGET_CPPFLAGS) -DHAVE_SSL" \
+           SSL_OBJS=sslstate.o \
+           PREFIX="$(STAGING_DIR)/usr" \
+           CXX=$(TARGET_CXX) \
+           CXXFLAGS="$(TARGET_CXXFLAGS) $(TARGET_CFLAGS) $(FPIC) $(TARGET_CPPFLAGS) \
+                       -I$(ICONV_PREFIX)/include \
+                       $(TARGET_LDFLAGS) -DHAVE_SSL" \
+           all
+endef
+
+define Build/Install
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+           DESTDIR="$(PKG_INSTALL_DIR)" \
+           install
+endef
+
+define Package/imspector/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/imspector $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libimspector.so $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/$(PKG_NAME)
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/$(PKG_NAME)/*.so $(1)/usr/lib/$(PKG_NAME)/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/imspector.config $(1)/etc/config/imspector
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/imspector.init $(1)/etc/init.d/imspector
+       $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/etc/$(PKG_NAME)/badwords.txt $(1)/etc/$(PKG_NAME)/
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/etc/$(PKG_NAME)/acl.txt $(1)/etc/$(PKG_NAME)/
+endef
+
+$(eval $(call BuildPackage,imspector))
diff --git a/net/imspector/files/imspector.config b/net/imspector/files/imspector.config
new file mode 100644 (file)
index 0000000..571cd64
--- /dev/null
@@ -0,0 +1,112 @@
+config imspector
+       # Enable the proxy
+       option enabled 1
+
+       # The listening ip address for redirected connections
+       option listenaddr 0.0.0.0
+
+       # The listening port for redirected connections
+       option port 16667
+
+       # The HTTP CONNECT proxy port
+       option http_port 18080
+
+       #Sets the PID filename. The PID file is created before optionally dropping privs.
+       option pidfilename /var/run/imspector.pid
+
+       # This is the default location of protocol and logging plugins.
+       option plugin_dir /usr/lib/imspector/
+
+       # For dropping privs - you probably want to do this.
+       option user root
+       option group root
+
+       # SSL support?
+       # Create SSL Certs with the following command
+       # openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 \
+       #       -keyout /etc/imspector/serverkey.pem \
+       #       -out /etc/imspector/servercert.pem
+
+       #option ssl on
+       #option ssl_key "/etc/imspector/serverkey.pem"
+
+       # Fixed cert?
+       #option ssl_cert "/etc/imspector/servercert.pem"
+
+       # Or certs created on-the-fly and signed against a CA
+       #option ssl_ca_key "/etc/imspector/cakey.pem"
+       #option ssl_ca_cert "/etc/imspector/cacert.pem"
+
+       # And finally a directory to store the created certs
+       #option ssl_cert_dir "/usr/lib/imspector"
+
+       # Directory of CA certs for IM server cert validation
+       #option ssl_verify_dir "/usr/lib/ssl/certs"
+
+       # Drop connection when the IM server has a bad cert
+       #option ssl_verify "block"
+
+       # Prefix and postfix to all responses using all responder plugins
+       #option response_prefix "Message from IMSpector: -="
+       #option response_postfix "=-"
+
+       # SQLite DB filename for automated responses
+       #option responder_filename "/etc/imspector/sqlitedb_responder"
+       # Inform parties that chats are monitored every N days (default is never)
+       #option notice_days 7
+       # Customised notice text
+       #option notice_response "Your activities are being logged"
+       # Inform of a blocked event, but upto a max of every N mins (default is never)
+       #option filtered_mins 15
+       # Customised filtered text (message text or filename follows in response)
+       #option filtered_response "The message or action was blocked"
+
+       # Will load enabled plugins in plugin_dir
+       option icq_protocol on
+       option irc_protocol on
+       option msn_protocol on
+       option yahoo_protocol on
+       option gg_protocol on
+       option jabber_protocol on
+
+       # MSN via HTTP proxy needs https
+       option https_protocol on
+
+       # Log typing events?
+       option log_typing_events off
+
+       # Location where the file logging plugin will start from.
+       option file_logging_dir "/var/log/imspector"
+
+       # MySQL logging plugin stuff
+       #option mysql_server "localhost"
+       #option mysql_database "imspector"
+       #option mysql_username "imspector"
+       #option mysql_password "password"
+
+       # SQLite logging plugin stuff
+       #option sqlite_file "/etc/imspector/sqlitedb"
+
+       # PostgreSQL logging plugin stuff
+       #option pgsql_connect "host=localhost dbname=imspector user=dbuser password=Password"
+
+       # Bad words filtering
+       option badwords_filename "/etc/imspector/badwords.txt"
+       option badwords_replace_character "*"
+       option badwords_block_count 1
+
+       # ACL
+       option acl_filename "/etc/imspector/acl.txt"
+
+       # SQLite-backed filter
+       #option db_filter_filename "/etc/imspector/sqlitedb_filter"
+
+       # Block all filetransfers?
+       option block_files off
+
+       # Block webcams?
+       option block_webcams off
+
+       # Socket-API for filtering
+       #option censord off
+
diff --git a/net/imspector/files/imspector.init b/net/imspector/files/imspector.init
new file mode 100644 (file)
index 0000000..8c0b991
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=50
+
+CFGFILE=/var/etc/imspector.conf
+
+atom() {
+       local section="$1"
+       local option="$2"
+
+       config_get _value "$section" "$option"
+       [ -n "$_value" ] && echo "$option=${_value}"
+}
+
+start_instance() {
+       local section="$1"
+
+       config_get_bool enabled "$section" enabled '0'
+       [ $enabled -gt 0 ] || return 1
+
+       echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
+       echo '### DO NOT EDIT' >> $CFGFILE
+       echo '### SEE /etc/config/imspector INSTEAD' >> $CFGFILE
+       echo '' >> $CFGFILE
+
+       options='listenaddr port http_port pidfilename plugin_dir
+               user group ssl ssl_key ssl_cert ssl_ca_key ssl_ca_cert
+               ssl_cert_dir ssl_verify_dir ssl_verify response_prefix
+               response_postfix responder_filename notice_days notice_response
+               filtered_mins filtered_response icq_protocol irc_protocol
+               msn_protocol yahoo_protocol gg_protocol jabber_protocol
+               https_protocol log_typing_events file_logging_dir mysql_server
+               mysql_database mysql_username mysql_password sqlite_file
+               pgsql_connect badwords_filename badwords_replace_character
+               badwords_block_count acl_filename db_filter_filename
+               block_files block_webcams censord'
+       
+       for option in $options; do
+               atom "$section" "$option" '"' >> $CFGFILE
+       done
+
+       service_start /usr/sbin/imspector -c "$CFGFILE"
+}
+
+start() {
+       mkdir -m 0755 -p /var/etc
+       mkdir -m 0755 -p /var/log/imspector
+
+       config_load 'imspector'
+       config_foreach start_instance 'imspector'
+}
+
+stop() {
+       service_stop /usr/sbin/imspector
+}
diff --git a/net/imspector/patches/010-openssl-1.0.0-compat.patch b/net/imspector/patches/010-openssl-1.0.0-compat.patch
new file mode 100644 (file)
index 0000000..d8002a1
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/sslstate.h
++++ b/sslstate.h
+@@ -29,7 +29,11 @@ class SSLState
+               int sslverify;
+               
+               bool localdebugmode;
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++              const SSL_METHOD *method;
++#else
+               SSL_METHOD *method;
++#endif
+               SSL_CTX *connectctx;
+               SSL_CTX *ctx;
diff --git a/net/ipcad/Makefile b/net/ipcad/Makefile
new file mode 100644 (file)
index 0000000..14143a1
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006-2009 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:=ipcad
+PKG_VERSION:=3.7.3
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ipcad
+PKG_MD5SUM:=125605249958894148ec26d3c88189f5
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipcad
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap $(LIBRPC_DEPENDS) +libpthread
+  TITLE:=listens for traffic on the specified interfaces
+  URL:=http://lionet.info/ipcad/
+endef
+
+define Package/ipcad/description
+       This daemon listens for traffic on the specified interfaces.
+       It has the built-in RSH and NetFlow engines to allow exporting
+       the accounting data the same way as Cisco routers do.
+endef
+
+define Package/ipcad/conffiles/
+/etc/ipcad.conf
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --disable-static \
+       --with-psrc=pcap \
+       --with-pcap-include="$(STAGING_DIR)/usr/include" \
+       --with-pcap-libraries="$(STAGING_DIR)/usr/lib" \
+
+# XXX: don't detect/use netfilter QUEUE/ULOG captures
+CONFIGURE_VARS += \
+       ac_cv_func_getifaddrs=no \
+       ac_cv_header_ifaddrs_h=no \
+       ac_cv_header_linux_netfilter_ipv4_ip_queue_h=no \
+       ac_cv_header_linux_netfilter_ipv4_ipt_ULOG_h=no \
+
+TARGET_LDFLAGS += $(LIBRPC)
+
+define Package/ipcad/install
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/ipcad.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ipcad $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ipcad))
diff --git a/net/ipcad/patches/001-honor_cppflags.patch b/net/ipcad/patches/001-honor_cppflags.patch
new file mode 100644 (file)
index 0000000..41d532d
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -9,6 +9,7 @@
+ LDFLAGS+= @LDFLAGS@
+ LIBS+= @LIBS@
+ CFLAGS+= @CFLAGS@ @DEFS@ -W -Wall
++CPPFLAGS+= @CPPFLAGS@
+ CPPFLAGS+=-DIPCAD_VERSION=\"@IPCAD_VERSION@\"
+ CPPFLAGS+=-DCONFIG_FILE=\"${sysconfdir}/ipcad.conf\"
+ CPPFLAGS+=@DEFS@ -D_REENTRANT -D_THREAD_SAFE
diff --git a/net/ipcad/patches/010-no-host-includes.patch b/net/ipcad/patches/010-no-host-includes.patch
new file mode 100644 (file)
index 0000000..4cac2ce
--- /dev/null
@@ -0,0 +1,16 @@
+diff --git a/configure b/configure
+index b2ef966..b675ca8 100755
+--- a/configure
++++ b/configure
+@@ -2691,11 +2691,6 @@ fi
+ fi
+-LDFLAGS="$LDFLAGS -L${ac_default_prefix}/lib"
+-CFLAGS="$CFLAGS -I${ac_default_prefix}/include"
+-CPPFLAGS="$CPPFLAGS -I${ac_default_prefix}/include"
+-
+-
+ for ac_func in pthread_detach
+ do
+ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
diff --git a/net/ipkungfu/Makefile b/net/ipkungfu/Makefile
new file mode 100644 (file)
index 0000000..867a732
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2006 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:=ipkungfu
+PKG_VERSION:=0.6.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.linuxkungfu.org/ipkungfu
+PKG_MD5SUM:=89f6bc0df356dd4ee650882c54ec9074
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipkungfu
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=IPKungFu is an iptables-based Linux firewall
+  URL:=http://www.linuxkungfu.org/
+  SUBMENU:=Firewall
+  DEPENDS:=+bash
+endef
+
+define Package/ipkungfu/description
+       IPKungFu is an iptables-based Linux firewall.
+       It aims to simplify the configuration of Internet
+       connection sharing, port forwarding, and packet filtering.
+endef
+
+define Package/ipkungfu/conffiles
+/etc/ipkungfu/accept_hosts.conf
+/etc/ipkungfu/custom.conf
+/etc/ipkungfu/forward.conf
+/etc/ipkungfu/log.conf
+/etc/ipkungfu/pre.conf
+/etc/ipkungfu/services.conf
+/etc/ipkungfu/advanced.conf
+/etc/ipkungfu/deny_hosts.conf
+/etc/ipkungfu/ipkungfu.conf
+/etc/ipkungfu/post.conf
+/etc/ipkungfu/redirect.conf
+/etc/ipkungfu/vhosts.conf
+endef
+
+define Package/ipkungfu/postrm
+#!/bin/sh
+rm -rf /etc/ipkungfu/cache
+rmdir /etc/ipkungfu 2>/dev/null || true
+endef
+
+# uses GNU configure
+CONFIGURE_VARS+= \
+                ac_cv_path_IPTABLES="/usr/sbin/iptables" \
+                ac_cv_path_MD5SUM="/usr/bin/md5sum" \
+                ac_cv_path_MODPROBE="/sbin/insmod" \
+                ac_cv_path_RMMOD="/sbin/rmmode" \
+                ac_cv_path_DEPMOD="/bin/true" \
+                ac_cv_path_LSMOD="/sbin/lsmod" \
+                ac_cv_path_CUT="/usr/bincut" \
+                ac_cv_path_TR="/usr/bintr" \
+                ac_cv_path_GREP="/bin/grep" \
+                ac_cv_path_SED="/bin/sed" \
+                ac_cv_path_AWK="/usr/bin/awk" \
+
+define Package/ipkungfu/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dummy_server $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipkungfu $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/ipkungfu/
+       $(CP) $(PKG_BUILD_DIR)/files/conf/* $(1)/etc/ipkungfu/
+endef
+
+$(eval $(call BuildPackage,ipkungfu))
diff --git a/net/ipkungfu/patches/001-replace-modprobe-with-insmod.patch b/net/ipkungfu/patches/001-replace-modprobe-with-insmod.patch
new file mode 100644 (file)
index 0000000..477c258
--- /dev/null
@@ -0,0 +1,22 @@
+Index: ipkungfu-0.6.1/ipkungfu.in
+===================================================================
+--- ipkungfu-0.6.1.orig/ipkungfu.in    2007-01-21 19:47:04.000000000 -0800
++++ ipkungfu-0.6.1/ipkungfu.in 2008-08-03 11:41:13.000000000 -0700
+@@ -618,7 +618,7 @@
+       # they're built in.
+       DEFAULT_MODULES_LIST="ip_nat_irc ip_conntrack_ftp ip_nat_ftp ip_conntrack_irc"
+       for default_module in $DEFAULT_MODULES_LIST; do
+-              if [ -f $($MODPROBE -la | grep ${default_module}) ]; then
++              if [ -f $(find /lib/modules/$(uname -r) -name "${default_module}*") ]; then
+                       $MODPROBE ${default_module} 2>&1 | logError
+               fi
+       done
+@@ -627,7 +627,7 @@
+               MODULES_ARRAY=(${MODULES_LIST})
+               for module in ${MODULES_ARRAY[@]}; do
+-                      if [ -e /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/${module}* ]; then
++                      if [ -e /lib/modules/`uname -r`/${module}* ]; then
+                               if [ -z "`${LSMOD} | grep ${module}`" ] ; then                  
+                                       if [ $INIT != 1 ] ; then
+                                               echo -n -e "Loading ${BRIGHT_COLOUR}${module}${CLOSE_COLOUR} module..."
diff --git a/net/ipsec-tools/Makefile b/net/ipsec-tools/Makefile
new file mode 100644 (file)
index 0000000..fdbf06d
--- /dev/null
@@ -0,0 +1,95 @@
+#
+# 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
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=ipsec-tools
+PKG_VERSION:=0.8.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/ipsec-tools
+PKG_MD5SUM:=d38b39f291ba2962387c3232e7335dd8
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipsec-tools
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=VPN
+  DEPENDS:=+libopenssl +kmod-ipsec
+  TITLE:=IPsec management tools
+  URL:=http://ipsec-tools.sourceforge.net/
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-kernel-headers="$(LINUX_DIR)/include" \
+       --without-readline \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --without-libradius \
+       --without-libpam \
+       --enable-dpd \
+       --enable-hybrid \
+       --enable-security-context=no \
+       --enable-natt \
+       --enable-adminport \
+       --enable-frag \
+        $(call autoconf_bool,CONFIG_IPV6,ipv6)
+
+# override CFLAGS holding "-Werror" that break builds on compile warnings
+MAKE_FLAGS+=\
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)"
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       chmod -R u+w $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.ac \
+               aclocal.m4 \
+               Makefile.in \
+               config.h.in \
+               configure \
+       );
+       $(call Build/Configure/Default)
+       echo "#undef HAVE_SHADOW_H" >> $(PKG_BUILD_DIR)/config.h
+endef
+
+define Package/ipsec-tools/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/racoon/samples/racoon.conf $(1)/etc/
+       $(SED) 's|@sysconfdir_x@|/etc|g' $(1)/etc/racoon.conf
+       $(INSTALL_DIR) $(1)/etc/racoon
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/racoon/samples/psk.txt $(1)/etc/racoon/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/racoon.init $(1)/etc/init.d/racoon
+       $(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/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/plainrsa-gen $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/racoon $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/racoonctl $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/setkey $(1)/usr/sbin/
+endef
+
+define Package/ipsec-tools/conffiles
+/etc/racoon.conf
+/etc/racoon/psk.txt
+endef
+
+$(eval $(call BuildPackage,ipsec-tools))
diff --git a/net/ipsec-tools/files/racoon.init b/net/ipsec-tools/files/racoon.init
new file mode 100644 (file)
index 0000000..d539b36
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+# Copyright (C) 2011 Artem Makhutov
+
+START=49
+
+SERVICE_USE_PID=1
+
+start() {
+       mkdir -m 0700 -p /var/racoon
+       [ -f /etc/ipsec.conf ] && /usr/sbin/setkey -f /etc/ipsec.conf
+       service_start /usr/sbin/racoon -f /etc/racoon.conf
+}
+
+stop() {
+       service_stop /usr/sbin/racoon
+}
diff --git a/net/ipsec-tools/patches/001-ipsec-tools-def-psk.patch b/net/ipsec-tools/patches/001-ipsec-tools-def-psk.patch
new file mode 100644 (file)
index 0000000..db5b306
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/src/racoon/oakley.c
++++ b/src/racoon/oakley.c
+@@ -2424,8 +2424,21 @@ oakley_skeyid(iph1)
+                               plog(LLV_ERROR, LOCATION, iph1->remote,
+                                       "couldn't find the pskey for %s.\n",
+                                       saddrwop2str(iph1->remote));
++                      }
++              }
++              if (iph1->authstr == NULL) {
++                      /*
++                       * If we could not locate a psk above try and locate
++                       * the default psk, ie, "*".
++                       */
++                      iph1->authstr = privsep_getpsk("*", 1);
++                      if (iph1->authstr == NULL) {
++                              plog(LLV_ERROR, LOCATION, iph1->remote,
++                                      "couldn't find the the default pskey either.\n");
+                               goto end;
+                       }
++                      plog(LLV_NOTIFY, LOCATION, iph1->remote,
++                                      "Using default PSK.\n");
+               }
+               plog(LLV_DEBUG, LOCATION, NULL, "the psk found.\n");
+               /* should be secret PSK */
diff --git a/net/ipsec-tools/patches/001-no_libfl.patch b/net/ipsec-tools/patches/001-no_libfl.patch
new file mode 100644 (file)
index 0000000..b56b596
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/src/racoon/cftoken.l
++++ b/src/racoon/cftoken.l
+@@ -104,6 +104,8 @@ static struct include_stack {
+ static int incstackp = 0;
+ static int yy_first_time = 1;
++
++int yywrap(void) { return 1; }
+ %}
+ /* common seciton */
+--- a/src/setkey/token.l
++++ b/src/setkey/token.l
+@@ -86,6 +86,8 @@
+ #if defined(SADB_X_EALG_AES) && ! defined(SADB_X_EALG_AESCBC)
+ #define SADB_X_EALG_AESCBC  SADB_X_EALG_AES
+ #endif
++
++int yywrap(void) { return 1; }
+ %}
+ /* common section */
diff --git a/net/ipsec-tools/patches/002-patch8-utmp.patch b/net/ipsec-tools/patches/002-patch8-utmp.patch
new file mode 100644 (file)
index 0000000..16dc923
--- /dev/null
@@ -0,0 +1,72 @@
+--- a/src/racoon/isakmp_cfg.c
++++ b/src/racoon/isakmp_cfg.c
+@@ -38,7 +38,7 @@
+ #include <sys/socket.h>
+ #include <sys/queue.h>
+-#include <utmpx.h>
++#include <utmp.h>
+ #if defined(__APPLE__) && defined(__MACH__)
+ #include <util.h>
+ #endif
+@@ -1661,7 +1661,8 @@ isakmp_cfg_accounting_system(port, raddr
+       int inout;
+ {
+       int error = 0;
+-      struct utmpx ut;
++      struct utmp ut;
++      char term[UT_LINESIZE];
+       char addr[NI_MAXHOST];
+       
+       if (usr == NULL || usr[0]=='\0') {
+@@ -1670,34 +1671,37 @@ isakmp_cfg_accounting_system(port, raddr
+               return -1;
+       }
+-      memset(&ut, 0, sizeof ut);
+-      gettimeofday((struct timeval *)&ut.ut_tv, NULL);
+-      snprintf(ut.ut_id, sizeof ut.ut_id, TERMSPEC, port);
++      sprintf(term, TERMSPEC, port);
+       switch (inout) {
+       case ISAKMP_CFG_LOGIN:
+-              ut.ut_type = USER_PROCESS;
+-              strncpy(ut.ut_user, usr, sizeof ut.ut_user);
++              strncpy(ut.ut_name, usr, UT_NAMESIZE);
++              ut.ut_name[UT_NAMESIZE - 1] = '\0';
++              
++              strncpy(ut.ut_line, term, UT_LINESIZE);
++              ut.ut_line[UT_LINESIZE - 1] = '\0';
+               GETNAMEINFO_NULL(raddr, addr);
+-              strncpy(ut.ut_host, addr, sizeof ut.ut_host);
++              strncpy(ut.ut_host, addr, UT_HOSTSIZE);
++              ut.ut_host[UT_HOSTSIZE - 1] = '\0';
++
++              ut.ut_time = time(NULL);
+               plog(LLV_INFO, LOCATION, NULL,
+                       "Accounting : '%s' logging on '%s' from %s.\n",
+-                      ut.ut_user, ut.ut_id, addr);
+-
+-              pututxline(&ut);
++                      ut.ut_name, ut.ut_line, ut.ut_host);
++              login(&ut);
++              
+               break;
+       case ISAKMP_CFG_LOGOUT: 
+-              ut.ut_type = DEAD_PROCESS;
+               plog(LLV_INFO, LOCATION, NULL,
+                       "Accounting : '%s' unlogging from '%s'.\n",
+-                      usr, ut.ut_id);
+-
+-              pututxline(&ut);
++                      usr, term);
++              logout(term);
++              
+               break;
+       default:
+               plog(LLV_ERROR, LOCATION, NULL, "Unepected inout\n");
diff --git a/net/ipsec-tools/patches/003-microsoft-fqdn-in-main.patch b/net/ipsec-tools/patches/003-microsoft-fqdn-in-main.patch
new file mode 100644 (file)
index 0000000..443d38d
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/src/racoon/ipsec_doi.c
++++ b/src/racoon/ipsec_doi.c
+@@ -3582,8 +3582,8 @@ ipsecdoi_checkid1(iph1)
+           iph1->approval->authmethod == OAKLEY_ATTR_AUTH_METHOD_PSKEY) {
+                if (id_b->type != IPSECDOI_ID_IPV4_ADDR
+                 && id_b->type != IPSECDOI_ID_IPV6_ADDR) {
+-                      plog(LLV_ERROR, LOCATION, NULL,
+-                              "Expecting IP address type in main mode, "
++                      plog(LLV_WARNING, LOCATION, NULL,
++                              "Expecting IP address type in main mode (RFC2409) , "
+                               "but %s.\n", s_ipsecdoi_ident(id_b->type));
+                       return ISAKMP_NTYPE_INVALID_ID_INFORMATION;
+               }
diff --git a/net/ipsec-tools/patches/005-isakmp-fix.patch b/net/ipsec-tools/patches/005-isakmp-fix.patch
new file mode 100644 (file)
index 0000000..f7aa3c2
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/racoon/isakmp.c
++++ b/src/racoon/isakmp.c
+@@ -31,6 +31,8 @@
+  * SUCH DAMAGE.
+  */
++#define __packed __attribute__((__packed__))
++
+ #include "config.h"
+ #include <sys/types.h>
diff --git a/net/ipsec-tools/patches/006-linux-3.7-compat.patch b/net/ipsec-tools/patches/006-linux-3.7-compat.patch
new file mode 100644 (file)
index 0000000..46b11ee
--- /dev/null
@@ -0,0 +1,50 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -74,9 +74,10 @@ case "$host_os" in
+           [ KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include" ])
+     AC_CHECK_HEADER($KERNEL_INCLUDE/linux/pfkeyv2.h, ,
+-      [ AC_CHECK_HEADER(/usr/src/linux/include/linux/pfkeyv2.h,
+-        KERNEL_INCLUDE=/usr/src/linux/include ,
+-        [ AC_MSG_ERROR([Unable to find linux-2.6 kernel headers. Aborting.]) ] ) ] )
++      [ AC_CHECK_HEADER($KERNEL_INCLUDE/uapi/linux/pfkeyv2.h, ,
++        [ AC_CHECK_HEADER(/usr/src/linux/include/linux/pfkeyv2.h,
++          KERNEL_INCLUDE=/usr/src/linux/include ,
++          [ AC_MSG_ERROR([Unable to find linux-2.6 kernel headers. Aborting.]) ] ) ] ) ] )
+     AC_SUBST(KERNEL_INCLUDE)
+     # We need the configure script to run with correct kernel headers.
+     # However we don't want to point to kernel source tree in compile time,
+@@ -643,7 +644,14 @@ AC_EGREP_CPP(yes,
+ #ifdef SADB_X_EXT_NAT_T_TYPE
+ yes
+ #endif
+-], [kernel_natt="yes"])
++], [kernel_natt="yes"], [
++  AC_EGREP_CPP(yes,
++  [#include <uapi/linux/pfkeyv2.h>
++  #ifdef SADB_X_EXT_NAT_T_TYPE
++  yes
++  #endif
++  ], [kernel_natt="yes"])
++])
+       ;;
+ freebsd*|netbsd*)
+ # NetBSD case
+--- a/src/include-glibc/Makefile.am
++++ b/src/include-glibc/Makefile.am
+@@ -1,14 +1,7 @@
+-
+-.includes: ${top_builddir}/config.status
+-      ln -snf $(KERNEL_INCLUDE)/linux
+-      touch .includes
+-
+-all: .includes
+-
+ EXTRA_DIST = \
+   glibc-bugs.h \
+   net/pfkeyv2.h \
+   netinet/ipsec.h \
+   sys/queue.h
+-DISTCLEANFILES = .includes linux
++DISTCLEANFILES = linux
diff --git a/net/iptables-snmp/Makefile b/net/iptables-snmp/Makefile
new file mode 100644 (file)
index 0000000..3e48bc1
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006 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:=iptables-snmp
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.nobiscuit.com/iptables-snmp
+PKG_MD5SUM:=8370d2f0c899461a053da491400119d1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/iptables-snmp
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+snmpd +libiptc
+  TITLE:=An snmpd plugin to access iptables rules
+  URL:=http://www.nobiscuit.com/iptables-snmp/
+  SUBMENU:=Firewall
+endef
+
+define Package/iptables-snmp/description
+       This is a plugin that makes iptables rules accessable from snmpd.
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               all install \
+       )
+endef
+
+define Package/iptables-snmp/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables-snmp.so $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,iptables-snmp))
diff --git a/net/iptables-snmp/patches/001-use_libiptc.patch b/net/iptables-snmp/patches/001-use_libiptc.patch
new file mode 100644 (file)
index 0000000..a142237
--- /dev/null
@@ -0,0 +1,25 @@
+diff -urN iptables-snmp-0.1/Makefile.in iptables-snmp-0.1.new/Makefile.in
+--- iptables-snmp-0.1/Makefile.in      2005-11-02 13:00:10.000000000 +0100
++++ iptables-snmp-0.1.new/Makefile.in  2009-08-02 01:13:40.000000000 +0200
+@@ -67,7 +67,7 @@
+ all: iptables-snmp.so
+-iptables-snmp.so: $(OBJS) libiptc.a Makefile
++iptables-snmp.so: $(OBJS) Makefile
+       $(CC) $(CFLAGS) $(OTHER) $(DFLAGS) -shared  -o $@ $(OBJS) $(LDFLAGS)
+ libiptc.a: $(LIBIPTC_OBJS) Makefile
+diff -urN iptables-snmp-0.1/iptables-snmp.c iptables-snmp-0.1.new/iptables-snmp.c
+--- iptables-snmp-0.1/iptables-snmp.c  2005-11-02 12:10:54.000000000 +0100
++++ iptables-snmp-0.1.new/iptables-snmp.c      2009-08-02 01:13:30.000000000 +0200
+@@ -37,6 +37,9 @@
+ #include "libiptc/libiptc.h"
++/* For backward compatibility */
++typedef struct iptc_handle *iptc_handle_t;
++
+ static oid agent_version_oid[] = {
+     BASE_OID, 1, 0, AGENT_VERSION_INDEX
+ };
diff --git a/net/iptraf/Makefile b/net/iptraf/Makefile
new file mode 100644 (file)
index 0000000..a062b8f
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2006-2009 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:=iptraf
+PKG_VERSION:=3.0.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://iptraf.seul.org/pub/iptraf/ \
+       ftp://the.wiretapped.net/pub/security/network-monitoring/iptraf/
+PKG_MD5SUM:=004c2c005a1b78739e22bc49d33e244d
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/iptraf
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=A console-based network monitoring program
+  URL:=http://iptraf.seul.org/
+endef
+
+define Package/iptraf/description
+  IPTraf is a console-based network statistics utility for Linux. It gathers a
+  variety of figures such as TCP connection packet and byte counts, interface
+  statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN
+  station packet and byte counts.
+endef
+
+define Package/iptraf/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       mkdir -p $${IPKG_INSTROOT}/var/log/iptraf \
+                $${IPKG_INSTROOT}/var/run/iptraf \
+                $${IPKG_INSTROOT}/var/lib/iptraf
+fi
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               DEBUG="" \
+               INCLUDEDIR="-I../support $(TARGET_CPPFLAGS)" \
+               LDOPTS="$(TARGET_LDFLAGS)" \
+               PLATFORM="-DPLATFORM=\\\"Linux/$(ARCH)\\\"" \
+               TARGET="/usr/bin" \
+               WORKDIR="/var/lib/iptraf" \
+               all
+endef
+
+define Package/iptraf/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/iptraf $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rvnamed $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,iptraf))
diff --git a/net/iptraf/patches/001-cross_compile.patch b/net/iptraf/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..3be7570
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/support/Makefile
++++ b/support/Makefile
+@@ -3,16 +3,14 @@ INCLUDEDIR           = -I/usr/include/ncurses
+ OBJS                  = input.o menurt.o listbox.o winops.o labels.o \
+                               msgboxes.o txbox.o
+-all: libtextbox.a
+-
+ libtextbox.a: $(OBJS)
+       rm -rf libtextbox.a
+-      ar cq libtextbox.a $(OBJS)
+-      ranlib libtextbox.a
+-#     gcc -shared -o libtextbox.so $(OBJS)
++      $(AR) cq libtextbox.a $(OBJS)
++      $(RANLIB) libtextbox.a
++#     $(CC) -shared -o libtextbox.so $(OBJS)
+ %.o: %.c *.h
+-      gcc -O2 -g -Wall -fPIC $(INCLUDEDIR) -c -o $*.o $<
++      $(CC) $(CFLAGS) -Wall -fPIC $(INCLUDEDIR) -c -o $*.o $<
+ clean:
+       rm -rf *.o *~ libtextbox.a libtextbox.so
diff --git a/net/iptraf/patches/002-ifaces.patch b/net/iptraf/patches/002-ifaces.patch
new file mode 100644 (file)
index 0000000..e4b0b1c
--- /dev/null
@@ -0,0 +1,281 @@
+--- a/src/dirs.h
++++ b/src/dirs.h
+@@ -155,7 +155,6 @@
+  */
+ #define ETHFILE               get_path(T_WORKDIR, "ethernet.desc")
+-#define FDDIFILE      get_path(T_WORKDIR, "fddi.desc")
+ /*
+  * The rvnamed program file
+--- a/src/hostmon.c
++++ b/src/hostmon.c
+@@ -31,7 +31,6 @@ details.
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_fddi.h>
+ #include <linux/if_tr.h>
+ #include <net/if_arp.h>
+ #include <stdlib.h>
+@@ -294,8 +293,6 @@ void printethent(struct ethtab *table, s
+             wprintw(table->tabwin, "Ethernet");
+         else if (entry->un.desc.linktype == LINK_PLIP)
+             wprintw(table->tabwin, "PLIP");
+-        else if (entry->un.desc.linktype == LINK_FDDI)
+-            wprintw(table->tabwin, "FDDI");
+         wprintw(table->tabwin, " HW addr: %s", entry->un.desc.ascaddr);
+@@ -723,7 +720,7 @@ void hostmon(const struct OPTIONS *optio
+     unsigned long long updtime_usec = 0;
+     struct desclist elist;      /* Ethernet description list */
+-    struct desclist flist;      /* FDDI description list */
++    struct desclist flist;      /* Other links description list */
+     struct desclist *list = NULL;
+     FILE *logfile = NULL;
+@@ -787,7 +784,6 @@ void hostmon(const struct OPTIONS *optio
+     initethtab(&table, options->actmode);
+     loaddesclist(&elist, LINK_ETHERNET, WITHETCETHERS);
+-    loaddesclist(&flist, LINK_FDDI, WITHETCETHERS);
+     if (logging) {
+         if (strcmp(current_logfile, "") == 0) {
+@@ -901,9 +897,7 @@ void hostmon(const struct OPTIONS *optio
+             if (pkt_result != PACKET_OK)
+                 continue;
+-            if ((linktype == LINK_ETHERNET) || (linktype == LINK_FDDI)
+-                || (linktype == LINK_PLIP) || (linktype == LINK_TR) ||
+-                (linktype == LINK_VLAN)) {
++            if ((linktype == LINK_ETHERNET) || (linktype == LINK_PLIP) || (linktype == LINK_TR) || (linktype == LINK_VLAN)) {
+                 if (fromaddr.sll_protocol == htons(ETH_P_IP))
+                     is_ip = 1;
+@@ -921,12 +915,6 @@ void hostmon(const struct OPTIONS *optio
+                     memcpy(scratch_daddr, ((struct ethhdr *) buf)->h_dest,
+                            ETH_ALEN);
+                     list = &elist;
+-                } else if (linktype == LINK_FDDI) {
+-                    memcpy(scratch_saddr, ((struct fddihdr *) buf)->saddr,
+-                           FDDI_K_ALEN);
+-                    memcpy(scratch_daddr, ((struct fddihdr *) buf)->daddr,
+-                           FDDI_K_ALEN);
+-                    list = &flist;
+                 } else if (linktype == LINK_TR) {
+                     memcpy(scratch_saddr, ((struct trh_hdr *) buf)->saddr,
+                            TR_ALEN);
+--- a/src/ifaces.c
++++ b/src/ifaces.c
+@@ -37,7 +37,7 @@ extern int accept_unsupported_interfaces
+ extern int daemonized;
+ char ifaces[][6] =
+-    { "lo", "eth", "sl", "ppp", "ippp", "plip", "fddi", "isdn", "dvb",
++    { "lo", "eth", "sl", "ppp", "ippp", "plip", "isdn", "dvb",
+     "pvc", "hdlc", "ipsec", "sbni", "tr", "wvlan", "wlan", "sm2", "sm3",
+     "pent", "lec", "brg", "tun", "tap", "cipcb", "tunl", "vlan"
+ };
+--- a/src/landesc.c
++++ b/src/landesc.c
+@@ -83,8 +83,6 @@ void loaddesclist(struct desclist *list,
+     if (linktype == LINK_ETHERNET)
+         fd = fopen(ETHFILE, "r");
+-    else if (linktype == LINK_FDDI)
+-        fd = fopen(FDDIFILE, "r");
+     if (fd == NULL) {
+         return;
+@@ -205,8 +203,6 @@ void savedesclist(struct desclist *list,
+     if (linktype == LINK_ETHERNET)
+         fd = fopen(ETHFILE, "w");
+-    else if (linktype == LINK_FDDI)
+-        fd = fopen(FDDIFILE, "w");
+     if (fd < 0) {
+         etherr();
+--- a/src/links.h
++++ b/src/links.h
+@@ -6,7 +6,6 @@
+ #define LINK_ISDN_RAWIP               6
+ #define LINK_ISDN_CISCOHDLC   7
+ #define LINK_CISCOHDLC  7
+-#define LINK_FDDI             8
+ #define LINK_FRAD             9
+ #define LINK_DLCI             10
+ #define LINK_TR                       11
+--- a/src/log.c
++++ b/src/log.c
+@@ -491,8 +491,6 @@ void writeethlog(struct ethtabent *list,
+                         ptmp->un.desc.ascaddr);
+             else if (ptmp->un.desc.linktype == LINK_PLIP)
+                 fprintf(fd, "\nPLIP address: %s", ptmp->un.desc.ascaddr);
+-            else if (ptmp->un.desc.linktype == LINK_FDDI)
+-                fprintf(fd, "\nFDDI address: %s", ptmp->un.desc.ascaddr);
+             if (ptmp->un.desc.withdesc)
+                 fprintf(fd, " (%s)", ptmp->un.desc.desc);
+--- a/src/options.c
++++ b/src/options.c
+@@ -68,8 +68,6 @@ void makeoptionmenu(struct MENU *menu)
+     tx_additem(menu, NULL, NULL);
+     tx_additem(menu, " ^E^thernet/PLIP host descriptions...",
+                "Manages descriptions for Ethernet and PLIP addresses");
+-    tx_additem(menu, " ^F^DDI/Token Ring host descriptions...",
+-               "Manages descriptions for FDDI and FDDI addresses");
+     tx_additem(menu, NULL, NULL);
+     tx_additem(menu, " E^x^it configuration", "Returns to main menu");
+ }
+@@ -371,9 +369,6 @@ void setoptions(struct OPTIONS *options,
+         case 14:
+             ethdescmgr(LINK_ETHERNET);
+             break;
+-        case 15:
+-            ethdescmgr(LINK_FDDI);
+-            break;
+         }
+         indicatesetting(row, options, statwin);
+--- a/src/othptab.c
++++ b/src/othptab.c
+@@ -22,7 +22,6 @@ details.
+ #include <linux/if_ether.h>
+ #include <linux/if_tr.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_fddi.h>
+ #include <winops.h>
+ #include "arphdr.h"
+ #include "options.h"
+@@ -142,11 +141,6 @@ struct othptabent *add_othp_entry(struct
+                         new_entry->smacaddr);
+             convmacaddr(((struct ethhdr *) packet)->h_dest,
+                         new_entry->dmacaddr);
+-        } else if (linkproto == LINK_FDDI) {
+-            convmacaddr(((struct fddihdr *) packet)->saddr,
+-                        new_entry->smacaddr);
+-            convmacaddr(((struct fddihdr *) packet)->daddr,
+-                        new_entry->dmacaddr);
+         } else if (linkproto == LINK_TR) {
+             convmacaddr(((struct trh_hdr *) packet)->saddr,
+                         new_entry->smacaddr);
+@@ -376,8 +370,7 @@ void printothpentry(struct othptable *ta
+         strcat(msgstring, scratchpad);
+         if ((entry->linkproto == LINK_ETHERNET) ||
+-            (entry->linkproto == LINK_PLIP) ||
+-            (entry->linkproto == LINK_FDDI)) {
++            (entry->linkproto == LINK_PLIP)) {
+             sprintf(scratchpad, " from %s to %s on %s",
+                     entry->smacaddr, entry->dmacaddr, entry->iface);
+--- a/src/packet.c
++++ b/src/packet.c
+@@ -35,7 +35,6 @@ details.
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_fddi.h>
+ #include <linux/if_tr.h>
+ #include <linux/isdn.h>
+ #include <linux/sockios.h>
+@@ -81,8 +80,6 @@ unsigned short getlinktype(unsigned shor
+             result = LINK_ETHERNET;
+         else if (strncmp(ifname, "plip", 4) == 0)
+             result = LINK_PLIP;
+-        else if (strncmp(ifname, "fddi", 4) == 0)       /* For some Ethernet- */
+-            result = LINK_ETHERNET;     /* emulated FDDI ifaces */
+         else if (strncmp(ifname, "dvb", 3) == 0)
+             result = LINK_ETHERNET;
+         else if (strncmp(ifname, "sbni", 4) == 0)
+@@ -136,9 +133,6 @@ unsigned short getlinktype(unsigned shor
+     case ARPHRD_PPP:
+         result = LINK_PPP;
+         break;
+-    case ARPHRD_FDDI:
+-        result = LINK_FDDI;
+-        break;
+     case ARPHRD_IEEE802:
+     case ARPHRD_IEEE802_TR:
+         result = LINK_TR;
+@@ -194,19 +188,6 @@ void adjustpacket(char *tpacket, unsigne
+         *packet = tpacket + 4;
+         *readlen -= 4;
+         break;
+-    case LINK_FDDI:
+-        *packet = tpacket + sizeof(struct fddihdr);
+-        *readlen -= sizeof(struct fddihdr);
+-
+-        /*
+-         * Move IP data into an aligned buffer.  96 bytes should be sufficient
+-         * for IP and TCP headers with reasonable numbers of options and some
+-         * data.
+-         */
+-
+-        memmove(aligned_buf, *packet, min(SNAPSHOT_LEN, *readlen));
+-        *packet = aligned_buf;
+-        break;
+     case LINK_TR:
+         /*
+          * Token Ring patch supplied by Tomas Dvorak 
+--- a/src/promisc.c
++++ b/src/promisc.c
+@@ -81,8 +81,8 @@ void init_promisc_list(struct promisc_st
+              */
+             if ((strncmp(buf, "eth", 3) == 0) ||
+-                (strncmp(buf, "fddi", 4) == 0) ||
+                 (strncmp(buf, "tr", 2) == 0) ||
++                (strncmp(buf, "vlan", 4) == 0) ||
+                 (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
+                 (strncmp(ptmp->params.ifname, "lec", 3) == 0) ||
+                 (accept_unsupported_interfaces)) {
+@@ -195,7 +195,7 @@ void srpromisc(int mode, struct promisc_
+     while (ptmp != NULL) {
+         if (((strncmp(ptmp->params.ifname, "eth", 3) == 0) ||
+-             (strncmp(ptmp->params.ifname, "fddi", 4) == 0) ||
++             (strncmp(ptmp->params.ifname, "vlan", 4) == 0) ||
+              (strncmp(ptmp->params.ifname, "tr", 2) == 0) ||
+              (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
+              (strncmp(ptmp->params.ifname, "lec", 3) == 0)) &&
+--- a/src/rvnamed.h
++++ b/src/rvnamed.h
+@@ -1,9 +1,9 @@
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+-#define CHILDSOCKNAME "/dev/rvndcldcomsk"
+-#define PARENTSOCKNAME "/dev/rvndpntcomsk"
+-#define IPTSOCKNAME "/dev/rvndiptcomsk"
++#define CHILDSOCKNAME "/tmp/rvndcldcomsk"
++#define PARENTSOCKNAME "/tmp/rvndpntcomsk"
++#define IPTSOCKNAME "/tmp/rvndiptcomsk"
+ #define SOCKET_PREFIX "isock"
+--- a/src/tcptable.c
++++ b/src/tcptable.c
+@@ -600,8 +600,6 @@ void updateentry(struct tcptable *table,
+         if ((linkproto == LINK_ETHERNET) || (linkproto == LINK_PLIP)) {
+             convmacaddr(((struct ethhdr *) packet)->h_source, newmacaddr);
+-        } else if (linkproto == LINK_FDDI) {
+-            convmacaddr(((struct fddihdr *) packet)->saddr, newmacaddr);
+         } else if (linkproto == LINK_TR) {
+             convmacaddr(((struct trh_hdr *) packet)->saddr, newmacaddr);
+         }
+--- a/src/tcptable.h
++++ b/src/tcptable.h
+@@ -23,7 +23,6 @@
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_fddi.h>
+ #include <linux/if_tr.h>
+ // #include <net/if.h>
+ #include <netinet/ip.h>
diff --git a/net/iptraf/patches/003-exit_menu.patch b/net/iptraf/patches/003-exit_menu.patch
new file mode 100644 (file)
index 0000000..6429a95
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/options.c
++++ b/src/options.c
+@@ -372,7 +372,7 @@ void setoptions(struct OPTIONS *options,
+         }
+         indicatesetting(row, options, statwin);
+-    } while (row != 17);
++    } while (row != 16);
+     tx_destroymenu(&menu);
+     del_panel(statpanel);
diff --git a/net/iptraf/patches/004-includes_fix.patch b/net/iptraf/patches/004-includes_fix.patch
new file mode 100644 (file)
index 0000000..439c2d7
--- /dev/null
@@ -0,0 +1,59 @@
+--- a/src/othptab.c
++++ b/src/othptab.c
+@@ -18,9 +18,10 @@ details.
+ #include <stdlib.h>
+ #include <asm/types.h>
++#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <linux/if_ether.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <linux/netdevice.h>
+ #include <winops.h>
+ #include "arphdr.h"
+--- a/src/tr.c
++++ b/src/tr.c
+@@ -7,7 +7,8 @@
+  */
+ #include <asm/types.h>
+-#include <linux/if_tr.h>
++#include <sys/types.h>
++#include <netinet/if_tr.h>
+ #include <netinet/in.h>
+ unsigned int get_tr_ip_offset(unsigned char *pkt)
+--- a/src/tcptable.h
++++ b/src/tcptable.h
+@@ -23,7 +23,7 @@
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ // #include <net/if.h>
+ #include <netinet/ip.h>
+ #include <netinet/udp.h>
+--- a/src/hostmon.c
++++ b/src/hostmon.c
+@@ -31,7 +31,7 @@ details.
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <net/if_arp.h>
+ #include <stdlib.h>
+ #include <time.h>
+--- a/src/packet.c
++++ b/src/packet.c
+@@ -35,7 +35,7 @@ details.
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ #include <linux/netdevice.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <linux/isdn.h>
+ #include <linux/sockios.h>
+ #include <msgboxes.h>
diff --git a/net/iptraf/patches/005-atheros.patch b/net/iptraf/patches/005-atheros.patch
new file mode 100644 (file)
index 0000000..7e9bcc9
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/src/ifaces.c     2009-11-28 18:45:44.000000000 +0000
++++ b/src/ifaces.c     2009-11-28 18:47:46.000000000 +0000
+@@ -32,14 +32,14 @@
+ #include "error.h"
+ extern int accept_unsupported_interfaces;
+-#define NUM_SUPPORTED_IFACES 26
++#define NUM_SUPPORTED_IFACES 27
+ extern int daemonized;
+ char ifaces[][6] =
+     { "lo", "eth", "sl", "ppp", "ippp", "plip", "isdn", "dvb",
+     "pvc", "hdlc", "ipsec", "sbni", "tr", "wvlan", "wlan", "sm2", "sm3",
+-    "pent", "lec", "brg", "tun", "tap", "cipcb", "tunl", "vlan"
++    "pent", "lec", "brg", "tun", "tap", "cipcb", "tunl", "vlan", "ath"
+ };
+ char *ltrim(char *buf)
+--- a/src/packet.c     2009-11-28 18:45:44.000000000 +0000
++++ b/src/packet.c     2009-11-28 18:48:06.000000000 +0000
+@@ -104,6 +104,8 @@
+             result = LINK_ETHERNET;
+         else if (strncmp(ifname, "tap", 3) == 0)
+             result = LINK_ETHERNET;
++        else if (strncmp(ifname, "ath", 3) == 0)
++            result = LINK_ETHERNET;
+         else if ((strncmp(ifname, "isdn", 4) == 0) && (isdn_fd != -1)) {
+             isdnent = isdn_table_lookup(isdnlist, ifname, isdn_fd);
+--- a/src/promisc.c    2009-11-28 18:45:44.000000000 +0000
++++ b/src/promisc.c    2009-11-28 18:48:28.000000000 +0000
+@@ -82,6 +82,7 @@
+             if ((strncmp(buf, "eth", 3) == 0) ||
+                 (strncmp(buf, "tr", 2) == 0) ||
++                (strncmp(buf, "ath", 3) == 0) ||
+                 (strncmp(buf, "vlan", 4) == 0) ||
+                 (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
+                 (strncmp(ptmp->params.ifname, "lec", 3) == 0) ||
diff --git a/net/iptraf/patches/005-no_size_cmd.patch b/net/iptraf/patches/005-no_size_cmd.patch
new file mode 100644 (file)
index 0000000..1307835
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -106,8 +106,6 @@ error.o log.o mode.o getpath.o bar.o par
+ BINS = iptraf rvnamed rawtime
+ all: $(BINS)
+-      @echo
+-      @size $(BINS)
+ iptraf: $(OBJS) textlib
+       $(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) $(LIBS)
diff --git a/net/ipupdate/Makefile b/net/ipupdate/Makefile
new file mode 100644 (file)
index 0000000..7651a62
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# 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:=ipupdate
+PKG_VERSION:=1.1.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ipupdate
+PKG_MD5SUM:=88ad3ac097190055db4ba816b9d26d13
+
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipupdate
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=IPUpdate-Daemon
+  URL:=http://ipupdate.sourceforge.net
+endef
+
+define Package/ipupdate/description
+  Lightweight remote DNS update-daemon which implements RFC 2136 dynamic updates.
+  Compatible with BIND, Simple DNS, and Microsoft DNS Server.
+endef
+
+
+define Build/Configure
+$(call Build/Configure/Default,, \
+       UNAME_S="Linux" \
+       UNAME_R="$(LINUX_VERSION)" \
+       UNAME_M="$(ARCH)" \
+)
+endef
+
+define Build/Compile
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)/usr
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+                $(TARGET_CONFIGURE_OPTS) \
+                CC="$(TARGET_CC) $(TARGET_CFLAGS) -s" \
+                PRECOMPILED_FILTER=1 \
+                STAGING_DIR="$(STAGING_DIR)" \
+                DESTDIR="$(PKG_INSTALL_DIR)/usr" \
+                all
+endef
+
+define Package/ipupdate/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipupdate $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/ipupdate
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dollardns $(1)/etc/ipupdate/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/failover $(1)/etc/ipupdate/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ifip $(1)/etc/ipupdate/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/whatismyip $(1)/etc/ipupdate/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/ipupdate.conf $(1)/etc/
+endef
+
+define Package/ipupdate/conffiles
+/etc/ipupdate.conf
+endef
+
+$(eval $(call BuildPackage,ipupdate))
diff --git a/net/ipupdate/patches/100-name_conflict.patch b/net/ipupdate/patches/100-name_conflict.patch
new file mode 100644 (file)
index 0000000..b0b1c93
--- /dev/null
@@ -0,0 +1,115 @@
+--- a/include/array.c
++++ b/include/array.c
+@@ -1,7 +1,7 @@
+ #include "array.h"
+ /*
+-** split
++** array_split
+ **
+ ** Accepts a string argument converting all delimeters to nulls
+ ** Returns an allocated array pointer or NULL
+@@ -14,7 +14,7 @@
+ ** str is not to be deallocated while using this array
+ */
+-char** split(char* str, const char* del, int* cnt)
++char** array_split(char* str, const char* del, int* cnt)
+ {
+       char** args = NULL;
+       int inc;
+@@ -53,7 +53,7 @@ char** split(char* str, const char* del,
+ }
+ /*
+-** splice
++** array_splice
+ **
+ ** remove length elements from array starting at offset
+ ** All trailing elements will be left aligned
+@@ -70,7 +70,7 @@ char** split(char* str, const char* del,
+ ** Returns the number of elements removed
+ */
+-int splice(void** array, int cnt, int offset, int length)
++int array_splice(void** array, int cnt, int offset, int length)
+ {
+       int t;
+--- a/include/array.h
++++ b/include/array.h
+@@ -1,5 +1,5 @@
+ #include <string.h>
+ #include <stdlib.h>
+-char** split(char*, const char*, int*);
+-int splice(void**, int, int, int);
++char** array_split(char*, const char*, int*);
++int array_splice(void**, int, int, int);
+--- a/ipupdate.c
++++ b/ipupdate.c
+@@ -295,7 +295,7 @@ int DoUpdate(int check)
+                               free(zone->keyname);
+                               free(server->zones[j]);
+-                              server->zonec -= splice((void**)server->zones, server->zonec, j, 1);
++                              server->zonec -= array_splice((void**)server->zones, server->zonec, j, 1);
+                               continue;
+                       }
+@@ -317,7 +317,7 @@ int DoUpdate(int check)
+                       free(server->zones);
+                       free(cfg.servers[i]);
+-                      cfg.serverc -= splice((void**)cfg.servers, cfg.serverc, i, 1);
++                      cfg.serverc -= array_splice((void**)cfg.servers, cfg.serverc, i, 1);
+                       continue;
+               }
+               i++;
+@@ -414,7 +414,7 @@ int checkcname(int *s, struct server *se
+                       asprintf(&msg, "checkcname: server %s: zone %s: host %s: host disabled", server->name, zone->name, zone->hosts[i]);
+                       PostMsgFree(msg);
+-                      zone->hostc -= splice((void**)zone->hosts, zone->hostc, i, 1);
++                      zone->hostc -= array_splice((void**)zone->hosts, zone->hostc, i, 1);
+                       continue;
+               }
+@@ -446,7 +446,7 @@ int checkcname(int *s, struct server *se
+                       asprintf(&msg, "checkcname: server %s: zone %s: host %s: host disabled", server->name, zone->name, zone->hosts[i]);
+                       PostMsgFree(msg);
+       
+-                      zone->hostc -= splice((void**)zone->hosts, zone->hostc, i, 1);
++                      zone->hostc -= array_splice((void**)zone->hosts, zone->hostc, i, 1);
+                       continue;
+               }
+               //append the record to the packet
+@@ -488,7 +488,7 @@ int checkcname(int *s, struct server *se
+                       asprintf(&msg, "checkcname: server %s: zone %s: host %s: host disabled", server->name, zone->name, zone->hosts[i]);
+                       PostMsgFree(msg);
+-                      zone->hostc -= splice((void**)zone->hosts, zone->hostc, i, 1);
++                      zone->hostc -= array_splice((void**)zone->hosts, zone->hostc, i, 1);
+                       continue;
+               }
+@@ -561,7 +561,7 @@ int checkip(int *s, struct server *serve
+                       asprintf(&msg, "checkip: server %s: zone %s: host %s: host disabled", server->name, zone->name, zone->hosts[i]);
+                       PostMsgFree(msg);
+-                      if (zone->hostc -= splice((void**)zone->hosts, zone->hostc, i, 1))
++                      if (zone->hostc -= array_splice((void**)zone->hosts, zone->hostc, i, 1))
+                       {
+                               *((unsigned short*)&pkt.data[8]) = htons(zone->hostc);
+                               continue;
+--- a/config.c
++++ b/config.c
+@@ -873,7 +873,7 @@ void cfg_zone(struct server *server, str
+                               switch (cfg_readblock(data, &term, &ptr)) {
+                               case CFG_QUOTED:
+                                       zone->hostp = term;
+-                                      zone->hosts = split(zone->hostp, ", \t\r\n", &zone->hostc);
++                                      zone->hosts = array_split(zone->hostp, ", \t\r\n", &zone->hostc);
+                                       if (zone->hostc > 32767)
+                                       {
+                                                       asprintf(&msg, "getconfig: zone \"%s\": there may not be more than 32767 hosts", zone->name);
diff --git a/net/ipupdate/patches/200-byteorder.patch b/net/ipupdate/patches/200-byteorder.patch
new file mode 100644 (file)
index 0000000..48cb9c6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/include/dns.c
++++ b/include/dns.c
+@@ -127,7 +127,7 @@ int dns_t2wtsig(char *pktdata, unsigned
+       tsig.hitime = 0;
+       tsig.lotime = htonl(signtime);
+       tsig.fudge = htons(fudge);
+-      tsig.macsize = 0x1000;  //16
++      tsig.macsize = htons(16);
+       memset(tsig.mac, 0, 16);
+       memcpy(&tsig.id, pktdata, 2);
+       tsig.error = 0;
diff --git a/net/isakmpd/Makefile b/net/isakmpd/Makefile
new file mode 100644 (file)
index 0000000..149fa80
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006 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:=isakmpd
+PKG_VERSION:=20041012
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/i/isakmpd/
+PKG_MD5SUM:=e6d25a9e232fb186e1a48dc06453bd57
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).orig
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/isakmpd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=VPN
+  DEPENDS:=+libopenssl +keynote +libgmp
+  TITLE:=IPsec management tools
+  URL:=http://isakmpd.sourceforge.net/
+endef
+
+define Build/Compile
+       CFLAGS="$(TARGET_CFLAGS)" \
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               LINUX_DIR="$(LINUX_DIR)" \
+               EXTRA_CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include/openssl -I$(STAGING_DIR)/usr/include/keynote" \
+               EXTRA_LDFLAGS="$(TARGET_LDFLAGS)"
+
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               INSTALL="install -c" \
+               install-bin
+endef
+
+define Package/isakmpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,isakmpd))
diff --git a/net/isakmpd/patches/010-debian_3.patch b/net/isakmpd/patches/010-debian_3.patch
new file mode 100644 (file)
index 0000000..0f50cf9
--- /dev/null
@@ -0,0 +1,1753 @@
+Index: isakmpd-20041012.orig/dpd.c
+===================================================================
+--- isakmpd-20041012.orig.orig/dpd.c   2007-06-04 13:22:39.088912864 +0200
++++ isakmpd-20041012.orig/dpd.c        2007-06-04 13:22:39.282883376 +0200
+@@ -26,6 +26,7 @@
+ #include <sys/types.h>
+ #include <stdlib.h>
++#include <memory.h>
+ #include "sysdep.h"
+@@ -174,6 +175,7 @@
+               }
+               break;
+       default:
++      ;
+       }
+       /* Mark handled.  */
+@@ -223,6 +225,7 @@
+                   dpd_check_event, sa, &tv);
+               break;
+       default:
++      ;
+       }
+       if (!sa->dpd_event) 
+               log_print("dpd_timer_reset: timer_add_event failed");
+Index: isakmpd-20041012.orig/ipsec.c
+===================================================================
+--- isakmpd-20041012.orig.orig/ipsec.c 2007-06-04 13:22:39.093912104 +0200
++++ isakmpd-20041012.orig/ipsec.c      2007-06-04 13:22:39.283883224 +0200
+@@ -1020,6 +1020,52 @@
+       }
+ }
++/*
++ * deal with a NOTIFY of INVALID_SPI
++ */
++static void
++ipsec_invalid_spi (struct message *msg, struct payload *p)
++{
++  struct sockaddr *dst;
++  int invspisz, off;
++  u_int32_t spi;
++  u_int16_t totsiz;
++  u_int8_t spisz;
++
++  /* Any notification that make us do something should be protected */
++  if(!TAILQ_FIRST (&msg->payload[ISAKMP_PAYLOAD_HASH]))
++    {
++      LOG_DBG ((LOG_SA, 40,
++                     "ipsec_invalid_spi: missing HASH payload in INVALID_SPI"
++                     " notification"));
++      return;
++    }
++
++  /*
++   * get the invalid spi out of the variable sized notification data
++   * field, which is after the variable sized SPI field [which specifies
++   * the receiving entity's phase-1 SPI, not the invalid spi]
++   */
++  totsiz = GET_ISAKMP_GEN_LENGTH (p->p);
++  spisz = GET_ISAKMP_NOTIFY_SPI_SZ (p->p);
++  off = ISAKMP_NOTIFY_SPI_OFF + spisz;
++  invspisz = totsiz - off;
++
++  if (invspisz != sizeof spi)
++    {
++      LOG_DBG ((LOG_SA, 40,
++             "ipsec_invalid_spi: SPI size %d in INVALID_SPI "
++             "payload unsupported", spisz));
++       return;
++    }
++  memcpy (&spi, p->p + off, sizeof spi);
++
++  msg->transport->vtbl->get_dst (msg->transport, &dst);
++
++  /* delete matching SPI's from this peer */
++  ipsec_delete_spi_list (dst, 0, (u_int8_t *)&spi, 1, "INVALID_SPI");
++}
++
+ static int
+ ipsec_responder(struct message *msg)
+ {
+@@ -1205,7 +1251,9 @@
+                       return dv != IPSEC_ENCAP_TUNNEL
+                           && dv != IPSEC_ENCAP_TRANSPORT
+                           && dv != IPSEC_ENCAP_UDP_ENCAP_TUNNEL
+-                          && dv != IPSEC_ENCAP_UDP_ENCAP_TRANSPORT;
++                          && dv != IPSEC_ENCAP_UDP_ENCAP_TRANSPORT
++                          && dv != IPSEC_ENCAP_UDP_ENCAP_TUNNEL_DRAFT
++                          && dv != IPSEC_ENCAP_UDP_ENCAP_TRANSPORT_DRAFT;
+ #else
+                       return dv < IPSEC_ENCAP_TUNNEL
+                           || dv > IPSEC_ENCAP_TRANSPORT;
+@@ -1837,7 +1885,7 @@
+ ipsec_get_id(char *section, int *id, struct sockaddr **addr,
+     struct sockaddr **mask, u_int8_t *tproto, u_int16_t *port)
+ {
+-      char    *type, *address, *netmask;
++    char      *type, *address, *netmask;
+       type = conf_get_str(section, "ID-type");
+       if (!type) {
+Index: isakmpd-20041012.orig/GNUmakefile
+===================================================================
+--- isakmpd-20041012.orig.orig/GNUmakefile     2007-06-04 13:22:39.099911192 +0200
++++ isakmpd-20041012.orig/GNUmakefile  2007-06-04 13:22:39.283883224 +0200
+@@ -40,12 +40,12 @@
+ # integrated, freebsd/netbsd means FreeBSD/NetBSD with KAME IPsec.
+ # darwin means MacOS X 10.2 and later with KAME IPsec. linux means Linux-2.5
+ # and later with native IPSec support.
+-OS=           openbsd
++#OS=          openbsd
+ #OS=          netbsd
+ #OS=          freebsd
+ #OS=          freeswan
+ #OS=          darwin
+-#OS=          linux
++OS=           linux
+ .CURDIR:=     $(shell pwd)
+ VPATH=                ${.CURDIR}/sysdep/${OS}
+@@ -55,9 +55,10 @@
+ ifndef BINDIR
+ BINDIR=               /sbin
+ endif
+-ifndef LDSTATIC
+-LDSTATIC=     -static
+-endif
++
++#ifndef LDSTATIC
++#LDSTATIC=    -static
++#endif
+ SRCS=         app.c attribute.c cert.c connection.c \
+               constants.c conf.c cookie.c crypto.c dh.c doi.c exchange.c \
+@@ -131,11 +132,14 @@
+ ifneq ($(findstring install,$(MAKECMDGOALS)),install)
+ # Skip 'regress' until the regress/ structure has gmake makefiles for it.
+ #SUBDIR:=     regress
+-SUBDIR:=
++#SUBDIR:=     apps/certpatch
+ mksubdirs:
+       $(foreach DIR, ${SUBDIR}, \
+-              cd ${DIR}; ${MAKE} ${MAKEFLAGS} CFLAGS="${CFLAGS}" \
+-                      MKDEP="${MKDEP}" ${MAKECMDGOALS})
++              cd ${.CURDIR}/${DIR}; ${MAKE} ${MAKECMDGOALS};)
++              
++#     $(foreach DIR, ${SUBDIR}, \
++#             cd ${DIR}; ${MAKE} CFLAGS="${CFLAGS}" \
++#                     MKDEP="${MKDEP}" ${MAKECMDGOALS})
+ else
+ mksubdirs:
+ endif
+@@ -173,7 +177,7 @@
+ endif
+ SRCS+=                ${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \
+-              $(ISAKMP_CFG)
++                      $(ISAKMP_CFG) ${DPD} ${NAT_TRAVERSAL}
+ CFLAGS+=      ${IPSEC_CFLAGS}
+ LDADD+=               ${DESLIB}
+ DPADD+=               ${DESLIBDEP}
+Index: isakmpd-20041012.orig/exchange.h
+===================================================================
+--- isakmpd-20041012.orig.orig/exchange.h      2007-06-04 13:22:39.104910432 +0200
++++ isakmpd-20041012.orig/exchange.h   2007-06-04 13:22:39.283883224 +0200
+@@ -221,6 +221,8 @@
+ #define EXCHANGE_FLAG_NAT_T_ENABLE    0x10    /* We are doing NAT-T.  */
+ #define EXCHANGE_FLAG_NAT_T_KEEPALIVE 0x20    /* We are the NAT:ed peer.  */
+ #define EXCHANGE_FLAG_DPD_CAP_PEER    0x40    /* Peer is DPD capable.  */
++#define EXCHANGE_FLAG_NAT_T_RFC               0x0080  /* Peer does RFC NAT-T. */
++#define EXCHANGE_FLAG_NAT_T_DRAFT     0x0100  /* Peer does draft NAT-T.*/
+ extern int      exchange_add_certs(struct message *);
+ extern void     exchange_finalize(struct message *);
+Index: isakmpd-20041012.orig/log.c
+===================================================================
+--- isakmpd-20041012.orig.orig/log.c   2007-06-04 13:22:39.110909520 +0200
++++ isakmpd-20041012.orig/log.c        2007-06-04 13:22:39.284883072 +0200
+@@ -79,7 +79,6 @@
+ struct packhdr {
+       struct pcap_pkthdr pcap;/* pcap file packet header */
+-      u_int32_t sa_family;    /* address family */
+       union {
+               struct ip       ip4;    /* IPv4 header (w/o options) */
+               struct ip6_hdr  ip6;    /* IPv6 header */
+@@ -97,7 +96,7 @@
+ static u_int8_t *packet_buf = NULL;
+ static int      udp_cksum(struct packhdr *, const struct udphdr *,
+-    u_int16_t *);
++    u_int16_t *, int);
+ static u_int16_t in_cksum(const u_int16_t *, int);
+ #endif                                /* USE_DEBUG */
+@@ -539,11 +538,9 @@
+       udp.uh_ulen = htons(datalen);
+       /* ip */
+-      hdr.sa_family = htonl(src->sa_family);
+       switch (src->sa_family) {
+       default:
+               /* Assume IPv4. XXX Can 'default' ever happen here?  */
+-              hdr.sa_family = htonl(AF_INET);
+               hdr.ip.ip4.ip_src.s_addr = 0x02020202;
+               hdr.ip.ip4.ip_dst.s_addr = 0x01010101;
+               /* The rest of the setup is common to AF_INET.  */
+@@ -584,9 +581,7 @@
+       }
+       /* Calculate UDP checksum.  */
+-      udp.uh_sum = udp_cksum(&hdr, &udp, (u_int16_t *) packet_buf);
+-      hdrlen += sizeof hdr.sa_family;
+-
++      udp.uh_sum = udp_cksum(&hdr, &udp, (u_int16_t *) packet_buf, src->sa_family);
+       /* pcap file packet header */
+       gettimeofday(&tv, 0);
+       hdr.pcap.ts.tv_sec = tv.tv_sec;
+@@ -610,7 +605,7 @@
+ /* Copied from tcpdump/print-udp.c, mostly rewritten.  */
+ static int
+-udp_cksum(struct packhdr *hdr, const struct udphdr *u, u_int16_t *d)
++udp_cksum(struct packhdr *hdr, const struct udphdr *u, u_int16_t *d, int af)
+ {
+       struct ip       *ip4;
+       struct ip6_hdr  *ip6;
+@@ -639,7 +634,7 @@
+       /* Setup pseudoheader.  */
+       memset(phu.pa, 0, sizeof phu);
+-      switch (ntohl(hdr->sa_family)) {
++      switch (af) {
+       case AF_INET:
+               ip4 = &hdr->ip.ip4;
+               memcpy(&phu.ip4p.src, &ip4->ip_src, sizeof(struct in_addr));
+@@ -664,7 +659,7 @@
+       /* IPv6 wants a 0xFFFF checksum "on error", not 0x0.  */
+       if (tlen < 0)
+-              return (ntohl(hdr->sa_family) == AF_INET ? 0 : 0xFFFF);
++              return (af == AF_INET ? 0 : 0xFFFF);
+       sum = 0;
+       for (i = 0; i < hdrlen; i += 2)
+Index: isakmpd-20041012.orig/nat_traversal.c
+===================================================================
+--- isakmpd-20041012.orig.orig/nat_traversal.c 2007-06-04 13:22:39.115908760 +0200
++++ isakmpd-20041012.orig/nat_traversal.c      2007-06-04 13:22:39.284883072 +0200
+@@ -1,4 +1,4 @@
+-/*    $OpenBSD: nat_traversal.c,v 1.7 2004/08/08 19:11:06 deraadt Exp $       */
++/*    $OpenBSD: nat_traversal.c,v 1.17 2006/06/14 14:03:33 hshoexer Exp $     */
+ /*
+  * Copyright (c) 2004 HÃ¥kan Olsson.  All rights reserved.
+@@ -48,40 +48,40 @@
+ #include "util.h"
+ #include "virtual.h"
++int   disable_nat_t = 0;
++
+ /*
+- * XXX According to draft-ietf-ipsec-nat-t-ike-07.txt, the NAT-T
+- * capability of the other peer is determined by a particular vendor ID
+- * sent as the first message. This vendor ID string is supposed to be a
+- * MD5 hash of "RFC XXXX", where XXXX is the future RFC number.
++ * NAT-T capability of the other peer is determined by a particular vendor
++ * ID sent in the first message. This vendor ID string is supposed to be a
++ * MD5 hash of "RFC 3947".
+  *
+  * These seem to be the "well" known variants of this string in use by
+  * products today.
+  */
+-static const char *isakmp_nat_t_cap_text[] = {
+-      "draft-ietf-ipsec-nat-t-ike-00",        /* V1 (XXX: may be obsolete) */
+-      "draft-ietf-ipsec-nat-t-ike-02\n",      /* V2 */
+-      "draft-ietf-ipsec-nat-t-ike-03",        /* V3 */
+-#ifdef notyet
+-      "RFC XXXX",
+-#endif
++
++static struct nat_t_cap isakmp_nat_t_cap[] = {
++      { VID_DRAFT_V2_N, EXCHANGE_FLAG_NAT_T_DRAFT,
++        "draft-ietf-ipsec-nat-t-ike-02\n", NULL, 0 },
++      { VID_DRAFT_V3, EXCHANGE_FLAG_NAT_T_DRAFT,
++        "draft-ietf-ipsec-nat-t-ike-03", NULL, 0 },
++      { VID_RFC3947, EXCHANGE_FLAG_NAT_T_RFC,
++        "RFC 3947", NULL, 0 },
+ };
++#define NUMNATTCAP    (sizeof isakmp_nat_t_cap / sizeof isakmp_nat_t_cap[0])
++
+ /* In seconds. Recommended in draft-ietf-ipsec-udp-encaps-09.  */
+ #define NAT_T_KEEPALIVE_INTERVAL      20
+-/* The MD5 hashes of the above strings is put in this array.  */
+-static char   **nat_t_hashes;
+-static size_t   nat_t_hashsize;
+-
+ static int    nat_t_setup_hashes(void);
+-static int    nat_t_add_vendor_payload(struct message *, char *);
++static int    nat_t_add_vendor_payload(struct message *, struct nat_t_cap *);
+ static int    nat_t_add_nat_d(struct message *, struct sockaddr *);
+ static int    nat_t_match_nat_d_payload(struct message *, struct sockaddr *);
+ void
+ nat_t_init(void)
+ {
+-      nat_t_hashes = (char **)NULL;
++      nat_t_setup_hashes();
+ }
+ /* Generate the NAT-T capability marker hashes. Executed only once.  */
+@@ -89,7 +89,7 @@
+ nat_t_setup_hashes(void)
+ {
+       struct hash *hash;
+-      int n = sizeof isakmp_nat_t_cap_text / sizeof isakmp_nat_t_cap_text[0];
++      int n = NUMNATTCAP;
+       int i;
+       /* The draft says to use MD5.  */
+@@ -100,56 +100,49 @@
+                   "could not find MD5 hash structure!");
+               return -1;
+       }
+-      nat_t_hashsize = hash->hashsize;
+-      /* Allocate one more than is necessary, i.e NULL terminated.  */
+-      nat_t_hashes = (char **)calloc((size_t)(n + 1), sizeof(char *));
+-      if (!nat_t_hashes) {
+-              log_error("nat_t_setup_hashes: calloc (%lu,%lu) failed",
+-                  (unsigned long)n, (unsigned long)sizeof(char *));
+-              return -1;
+-      }
+-
+-      /* Populate with hashes.  */
++      /* Populate isakmp_nat_t_cap with hashes.  */
+       for (i = 0; i < n; i++) {
+-              nat_t_hashes[i] = (char *)malloc(nat_t_hashsize);
+-              if (!nat_t_hashes[i]) {
++              isakmp_nat_t_cap[i].hashsize = hash->hashsize;
++              isakmp_nat_t_cap[i].hash = (char *)malloc(hash->hashsize);
++              if (!isakmp_nat_t_cap[i].hash) {
+                       log_error("nat_t_setup_hashes: malloc (%lu) failed",
+-                          (unsigned long)nat_t_hashsize);
++                          (unsigned long)hash->hashsize);
+                       goto errout;
+               }
+               hash->Init(hash->ctx);
+               hash->Update(hash->ctx,
+-                  (unsigned char *)isakmp_nat_t_cap_text[i],
+-                  strlen(isakmp_nat_t_cap_text[i]));
+-              hash->Final(nat_t_hashes[i], hash->ctx);
++                  (unsigned char *)isakmp_nat_t_cap[i].text,
++                  strlen(isakmp_nat_t_cap[i].text));
++              hash->Final(isakmp_nat_t_cap[i].hash, hash->ctx);
+               LOG_DBG((LOG_EXCHANGE, 50, "nat_t_setup_hashes: "
+-                  "MD5(\"%s\") (%lu bytes)", isakmp_nat_t_cap_text[i],
+-                  (unsigned long)nat_t_hashsize));
++                  "MD5(\"%s\") (%lu bytes)", isakmp_nat_t_cap[i].text,
++                  (unsigned long)hash->hashsize));
+               LOG_DBG_BUF((LOG_EXCHANGE, 50, "nat_t_setup_hashes",
+-                  nat_t_hashes[i], nat_t_hashsize));
++                  isakmp_nat_t_cap[i].hash, hash->hashsize));
+       }
+       return 0;
+-  errout:
++errout:
+       for (i = 0; i < n; i++)
+-              if (nat_t_hashes[i])
+-                      free(nat_t_hashes[i]);
+-      free(nat_t_hashes);
+-      nat_t_hashes = NULL;
++              if (isakmp_nat_t_cap[i].hash)
++                      free(isakmp_nat_t_cap[i].hash);
+       return -1;
+ }
+ /* Add one NAT-T VENDOR payload.  */
+ static int
+-nat_t_add_vendor_payload(struct message *msg, char *hash)
++nat_t_add_vendor_payload(struct message *msg, struct nat_t_cap *cap)
+ {
+-      size_t   buflen = nat_t_hashsize + ISAKMP_GEN_SZ;
++      size_t    buflen = cap->hashsize + ISAKMP_GEN_SZ;
+       u_int8_t *buf;
++      if (disable_nat_t)
++              return 0;
++
+       buf = malloc(buflen);
+       if (!buf) {
+               log_error("nat_t_add_vendor_payload: malloc (%lu) failed",
+@@ -158,12 +151,11 @@
+       }
+       SET_ISAKMP_GEN_LENGTH(buf, buflen);
+-      memcpy(buf + ISAKMP_VENDOR_ID_OFF, hash, nat_t_hashsize);
++      memcpy(buf + ISAKMP_VENDOR_ID_OFF, cap->hash, cap->hashsize);
+       if (message_add_payload(msg, ISAKMP_PAYLOAD_VENDOR, buf, buflen, 1)) {
+               free(buf);
+               return -1;
+       }
+-
+       return 0;
+ }
+@@ -171,16 +163,14 @@
+ int
+ nat_t_add_vendor_payloads(struct message *msg)
+ {
+-      int i = 0;
++      int i;
+-      if (!nat_t_hashes)
+-              if (nat_t_setup_hashes())
+-                      return 0;  /* XXX should this be an error?  */
++      if (disable_nat_t)
++              return 0;
+-      while (nat_t_hashes[i])
+-              if (nat_t_add_vendor_payload(msg, nat_t_hashes[i++]))
++      for (i = 0; i < NUMNATTCAP; i++)
++              if (nat_t_add_vendor_payload(msg, &isakmp_nat_t_cap[i]))
+                       return -1;
+-
+       return 0;
+ }
+@@ -192,36 +182,31 @@
+ {
+       u_int8_t *pbuf = p->p;
+       size_t    vlen;
+-      int       i = 0;
++      int       i;
+-      /* Already checked? */
+-      if (p->flags & PL_MARK ||
+-          msg->exchange->flags & EXCHANGE_FLAG_NAT_T_CAP_PEER)
++      if (disable_nat_t)
+               return;
+-      if (!nat_t_hashes)
+-              if (nat_t_setup_hashes())
+-                      return;
+-
+       vlen = GET_ISAKMP_GEN_LENGTH(pbuf) - ISAKMP_GEN_SZ;
+-      if (vlen != nat_t_hashsize) {
+-              LOG_DBG((LOG_EXCHANGE, 50, "nat_t_check_vendor_payload: "
+-                  "bad size %lu != %lu", (unsigned long)vlen,
+-                  (unsigned long)nat_t_hashsize));
+-              return;
+-      }
+-      while (nat_t_hashes[i])
+-              if (memcmp(nat_t_hashes[i++], pbuf + ISAKMP_GEN_SZ,
++      for (i = 0; i < NUMNATTCAP; i++) {
++              if (vlen != isakmp_nat_t_cap[i].hashsize) {
++                      LOG_DBG((LOG_EXCHANGE, 50, "nat_t_check_vendor_payload: "
++                          "bad size %lu != %lu", (unsigned long)vlen,
++                          (unsigned long)isakmp_nat_t_cap[i].hashsize));
++                      continue;
++              }
++              if (memcmp(isakmp_nat_t_cap[i].hash, pbuf + ISAKMP_GEN_SZ,
+                   vlen) == 0) {
+                       /* This peer is NAT-T capable.  */
+                       msg->exchange->flags |= EXCHANGE_FLAG_NAT_T_CAP_PEER;
++                      msg->exchange->flags |= isakmp_nat_t_cap[i].flags;
+                       LOG_DBG((LOG_EXCHANGE, 10,
+                           "nat_t_check_vendor_payload: "
+                           "NAT-T capable peer detected"));
+                       p->flags |= PL_MARK;
+-                      return;
+               }
++      }
+       return;
+ }
+@@ -233,10 +218,8 @@
+ {
+       struct ipsec_exch *ie = (struct ipsec_exch *)msg->exchange->data;
+       struct hash      *hash;
+-      struct prf       *prf;
+       u_int8_t         *res;
+       in_port_t         port;
+-      int               prf_type = PRF_HMAC; /* XXX */
+       hash = hash_get(ie->hash->type);
+       if (hash == NULL) {
+@@ -244,31 +227,25 @@
+               return NULL;
+       }
+-      prf = prf_alloc(prf_type, hash->type, msg->exchange->cookies,
+-          ISAKMP_HDR_COOKIES_LEN);
+-      if(!prf) {
+-              log_print("nat_t_generate_nat_d_hash: prf_alloc failed");
+-              return NULL;
+-      }
++      *hashlen = hash->hashsize;
+-      *hashlen = prf->blocksize;
+       res = (u_int8_t *)malloc((unsigned long)*hashlen);
+       if (!res) {
+               log_print("nat_t_generate_nat_d_hash: malloc (%lu) failed",
+                   (unsigned long)*hashlen);
+-              prf_free(prf);
+               *hashlen = 0;
+               return NULL;
+       }
+       port = sockaddr_port(sa);
+-      memset(res, 0, *hashlen);
+-
+-      prf->Update(prf->prfctx, sockaddr_addrdata(sa), sockaddr_addrlen(sa));
+-      prf->Update(prf->prfctx, (unsigned char *)&port, sizeof port);
+-      prf->Final(res, prf->prfctx);
+-      prf_free (prf);
++      bzero(res, *hashlen);
++      hash->Init(hash->ctx);
++      hash->Update(hash->ctx, msg->exchange->cookies,
++          sizeof msg->exchange->cookies);
++      hash->Update(hash->ctx, sockaddr_addrdata(sa), sockaddr_addrlen(sa));
++      hash->Update(hash->ctx, (unsigned char *)&port, sizeof port);
++      hash->Final(res, hash->ctx);
+       return res;
+ }
+@@ -276,6 +253,7 @@
+ static int
+ nat_t_add_nat_d(struct message *msg, struct sockaddr *sa)
+ {
++      int       ret;
+       u_int8_t *hbuf, *buf;
+       size_t    hbuflen, buflen;
+@@ -298,11 +276,19 @@
+       memcpy(buf + ISAKMP_NAT_D_DATA_OFF, hbuf, hbuflen);
+       free(hbuf);
+-      if (message_add_payload(msg, ISAKMP_PAYLOAD_NAT_D, buf, buflen, 1)) {
++      if (msg->exchange->flags & EXCHANGE_FLAG_NAT_T_RFC)
++              ret = message_add_payload(msg, ISAKMP_PAYLOAD_NAT_D, buf,
++                  buflen, 1);
++      else if (msg->exchange->flags & EXCHANGE_FLAG_NAT_T_DRAFT)
++              ret = message_add_payload(msg, ISAKMP_PAYLOAD_NAT_D_DRAFT,
++                  buf, buflen, 1);
++      else
++              ret = -1;
++              
++      if (ret) {
+               free(buf);
+               return -1;
+       }
+-
+       return 0;
+ }
+@@ -312,14 +298,14 @@
+ {
+       struct sockaddr *sa;
+-      msg->transport->vtbl->get_src(msg->transport, &sa);
++      /* Remote address first. */
++      msg->transport->vtbl->get_dst(msg->transport, &sa);
+       if (nat_t_add_nat_d(msg, sa))
+               return -1;
+-      msg->transport->vtbl->get_dst(msg->transport, &sa);
++      msg->transport->vtbl->get_src(msg->transport, &sa);
+       if (nat_t_add_nat_d(msg, sa))
+               return -1;
+-
+       return 0;
+ }
+@@ -336,8 +322,8 @@
+        * If there are no NAT-D payloads in the message, return "found"
+        * as this will avoid NAT-T (see nat_t_exchange_check_nat_d()).
+        */
+-      p = payload_first(msg, ISAKMP_PAYLOAD_NAT_D);
+-      if (!p)
++      if ((p = payload_first(msg, ISAKMP_PAYLOAD_NAT_D_DRAFT)) == NULL &&
++          (p = payload_first(msg, ISAKMP_PAYLOAD_NAT_D)) == NULL)
+               return 1;
+       hbuf = nat_t_generate_nat_d_hash(msg, sa, &hbuflen);
+Index: isakmpd-20041012.orig/udp_encap.c
+===================================================================
+--- isakmpd-20041012.orig.orig/udp_encap.c     2007-06-04 13:22:39.121907848 +0200
++++ isakmpd-20041012.orig/udp_encap.c  2007-06-04 13:22:39.284883072 +0200
+@@ -61,6 +61,11 @@
+ #define UDP_SIZE 65536
++#if defined(USE_NAT_TRAVERSAL) && defined (LINUX_IPSEC)
++#include <linux/socket.h>
++#include <linux/udp.h>
++#endif
++
+ /* If a system doesn't have SO_REUSEPORT, SO_REUSEADDR will have to do.  */
+ #ifndef SO_REUSEPORT
+ #define SO_REUSEPORT SO_REUSEADDR
+@@ -134,6 +139,18 @@
+       if (sysdep_cleartext(s, laddr->sa_family) == -1)
+               goto err;
++#if defined(USE_NAT_TRAVERSAL) && defined (LINUX_IPSEC)
++    {
++#ifndef SOL_UDP
++#define SOL_UDP 17
++#endif
++        int option = UDP_ENCAP_ESPINUDP;
++        if(setsockopt(s, SOL_UDP, UDP_ENCAP, &option,
++                      sizeof (option)) < 0)
++            goto err;
++    }
++#endif
++
+       /* Wildcard address ?  */
+       switch (laddr->sa_family) {
+       case AF_INET:
+Index: isakmpd-20041012.orig/apps/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/apps/Makefile   2007-06-04 13:22:39.126907088 +0200
++++ isakmpd-20041012.orig/apps/Makefile        2007-06-04 13:22:39.285882920 +0200
+@@ -31,4 +31,4 @@
+ SUBDIR= certpatch
+-.include <bsd.subdir.mk>
++#.include <bsd.subdir.mk>
+Index: isakmpd-20041012.orig/apps/certpatch/GNUmakefile
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ isakmpd-20041012.orig/apps/certpatch/GNUmakefile   2007-06-04 13:22:39.285882920 +0200
+@@ -0,0 +1,55 @@
++#     $OpenBSD: Makefile,v 1.7 2003/06/03 14:35:00 ho Exp $
++#     $EOM: Makefile,v 1.6 2000/03/28 21:22:06 ho Exp $
++
++#
++# Copyright (c) 1999 Niels Provos.  All rights reserved.
++# Copyright (c) 2001 Niklas Hallqvist.  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.
++#
++# 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 code was written under funding by Ericsson Radio Systems.
++#
++
++PROG=         certpatch
++SRCS=         certpatch.c
++BINDIR?=      /usr/sbin
++TOPSRC=               ${.CURDIR}../..
++TOPOBJ!=      cd ${TOPSRC}; printf "all:\n\t@pwd\n" |${MAKE} -f-
++OS=                   linux
++FEATURES!=    awk '/^FEATURES=/ { print $$0 }' ${.CURDIR}/../../Makefile | sed 's/FEATURES=.//'
++.PATH:                ${TOPSRC} ${TOPSRC}/sysdep/${OS} ${TOPOBJ}
++CFLAGS+=      -I${TOPSRC} -I${TOPSRC}/sysdep/${OS} -I${TOPOBJ} -Wall
++LDFLAGS+=     -lcrypto -lssl -lgmp
++MAN=          certpatch.8
++
++CFLAGS+=      -DMP_FLAVOUR=MP_FLAVOUR_GMP
++LDADD+=               -lgmp
++DPADD+=               ${LIBGMP}
++
++# Override LIBSYSDEPDIR definition from Makefile.sysdep
++LIBSYSDEPDIR= ${TOPSRC}/sysdep/common/libsysdep
++
++all:  ${PROG}
++
++clean:        
++      rm -f ${PROG}
+Index: isakmpd-20041012.orig/pf_key_v2.c
+===================================================================
+--- isakmpd-20041012.orig.orig/pf_key_v2.c     2007-06-04 13:22:39.137905416 +0200
++++ isakmpd-20041012.orig/pf_key_v2.c  2007-06-04 13:22:39.287882616 +0200
+@@ -1055,6 +1055,10 @@
+ #endif
+ #if defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_UDPENCAP)
+       struct sadb_x_udpencap udpencap;
++#elif defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_NAT_T_TYPE)
++      struct sadb_x_nat_t_type nat_t_type;
++      struct sadb_x_nat_t_port nat_t_sport;
++      struct sadb_x_nat_t_port nat_t_dport;
+ #endif
+ #ifdef USE_DEBUG
+       char           *addr_str;
+@@ -1273,10 +1277,15 @@
+               log_print("pf_key_v2_set_spi: invalid proto %d", proto->proto);
+               goto cleanup;
+       }
+-      if (incoming)
++      if (incoming) {
+               sa->transport->vtbl->get_src(sa->transport, &dst);
+-      else
++              sa->transport->vtbl->get_dst(sa->transport, &src);
++      }
++      else {
+               sa->transport->vtbl->get_dst(sa->transport, &dst);
++              sa->transport->vtbl->get_src(sa->transport, &src);
++      }
++
+ #ifdef KAME
+       msg.sadb_msg_seq = (incoming ?
+           pf_key_v2_seq_by_sa(proto->spi[incoming], sizeof ssa.sadb_sa_spi,
+@@ -1319,12 +1328,13 @@
+       ssa.sadb_sa_flags = 0;
+ #ifdef SADB_X_SAFLAGS_TUNNEL
+       if (iproto->encap_mode == IPSEC_ENCAP_TUNNEL ||
+-          iproto->encap_mode == IPSEC_ENCAP_UDP_ENCAP_TUNNEL)
++          iproto->encap_mode == IPSEC_ENCAP_UDP_ENCAP_TUNNEL ||
++          iproto->encap_mode == IPSEC_ENCAP_UDP_ENCAP_TUNNEL_DRAFT)
+               ssa.sadb_sa_flags = SADB_X_SAFLAGS_TUNNEL;
+ #endif
+-#if defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_UDPENCAP)
+       if (isakmp_sa->flags & SA_FLAG_NAT_T_ENABLE) {
++#if defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_UDPENCAP)
+               memset(&udpencap, 0, sizeof udpencap);
+               ssa.sadb_sa_flags |= SADB_X_SAFLAGS_UDPENCAP;
+               udpencap.sadb_x_udpencap_exttype = SADB_X_EXT_UDPENCAP;
+@@ -1334,8 +1344,40 @@
+               if (pf_key_v2_msg_add(update, (struct sadb_ext *)&udpencap, 0)
+                   == -1)
+                       goto cleanup;
+-      }
++#elif defined (USE_NAT_TRAVERSAL) && defined (SADB_X_EXT_NAT_T_TYPE)
++#ifndef UDP_ENCAP_ESPINUDP
++#define UDP_ENCAP_ESPINUDP    2
++#endif
++              memset(&nat_t_type, 0, sizeof nat_t_type);
++              memset(&nat_t_sport, 0, sizeof nat_t_sport);
++              memset(&nat_t_dport, 0, sizeof nat_t_dport);
++
++              /* type = draft-udp-encap-06 */
++              nat_t_type.sadb_x_nat_t_type_len = sizeof nat_t_type / PF_KEY_V2_CHUNK;
++              nat_t_type.sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE;
++              nat_t_type.sadb_x_nat_t_type_type = UDP_ENCAP_ESPINUDP;
++              if(pf_key_v2_msg_add(update, (struct sadb_ext *)&nat_t_type, 0) == -1)
++                      goto cleanup;
++
++              /* source port */
++              nat_t_sport.sadb_x_nat_t_port_len = sizeof nat_t_sport / 
++                                                         PF_KEY_V2_CHUNK;
++              nat_t_sport.sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT;
++              nat_t_sport.sadb_x_nat_t_port_port = sockaddr_port(src);
++              if(pf_key_v2_msg_add(update, (struct sadb_ext *)&nat_t_sport, 0) == -1)
++                      goto cleanup;
++
++              /* destination port */
++              nat_t_dport.sadb_x_nat_t_port_len = sizeof nat_t_dport / 
++                                                         PF_KEY_V2_CHUNK;
++              nat_t_dport.sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT;
++              nat_t_dport.sadb_x_nat_t_port_port = sockaddr_port(dst);
++              if(pf_key_v2_msg_add(update, (struct sadb_ext *)&nat_t_dport, 0) == -1)
++                      goto cleanup;
++
++              /* original address (transport mode checksum missing info) goes here */
+ #endif
++    }
+       if (pf_key_v2_msg_add(update, (struct sadb_ext *)&ssa, 0) == -1)
+               goto cleanup;
+@@ -1395,10 +1437,6 @@
+       /*
+        * Setup the ADDRESS extensions.
+          */
+-      if (incoming)
+-              sa->transport->vtbl->get_dst(sa->transport, &src);
+-      else
+-              sa->transport->vtbl->get_src(sa->transport, &src);
+       len = sizeof *addr + PF_KEY_V2_ROUND(sysdep_sa_len(src));
+       addr = calloc(1, len);
+       if (!addr)
+@@ -2167,7 +2205,7 @@
+               pf_key_v2_msg_free(ret);
+       return -1;
+-#elif defined (SADB_X_SPDADD) && defined (SADB_X_SPDDELETE)
++#elif defined (SADB_X_SPDUPDATE) && defined (SADB_X_SPDDELETE)
+       struct sadb_msg msg;
+       struct sadb_x_policy *policy = 0;
+       struct sadb_x_ipsecrequest *ipsecrequest;
+@@ -2181,7 +2219,7 @@
+       struct sockaddr_in *ip4_sa;
+       struct sockaddr_in6 *ip6_sa;
+-      msg.sadb_msg_type = delete ? SADB_X_SPDDELETE : SADB_X_SPDADD;
++      msg.sadb_msg_type = delete ? SADB_X_SPDDELETE : SADB_X_SPDUPDATE;
+       msg.sadb_msg_satype = SADB_SATYPE_UNSPEC;
+       msg.sadb_msg_seq = 0;
+       flow = pf_key_v2_msg_new(&msg, 0);
+Index: isakmpd-20041012.orig/isakmp_num.cst
+===================================================================
+--- isakmpd-20041012.orig.orig/isakmp_num.cst  2007-06-04 13:22:39.143904504 +0200
++++ isakmpd-20041012.orig/isakmp_num.cst       2007-06-04 13:22:39.287882616 +0200
+@@ -57,15 +57,18 @@
+   KD                          17      # RFC 3547, Key Download
+   SEQ                         18      # RFC 3547, Sequence Number
+   POP                         19      # RFC 3547, Proof of possession
+-  RESERVED_MIN                        20
++  NAT_D                               20      # RFC 3947, NAT Discovery payload
++  NAT_OA                      21      # RFC 3947, NAT Original Address payload
++  RESERVED_MIN                        22
+   RESERVED_MAX                        127
+   PRIVATE_MIN                 128
+ # XXX values from draft-ietf-ipsec-nat-t-ike-01,02,03. Later drafts specify
+ # XXX NAT_D as payload 15 and NAT_OA as 16, but these are allocated by RFC
+ # XXX 3547 as seen above.
+-  NAT_D                               130     # NAT Discovery payload
+-  NAT_OA                      131     # NAT Original Address payload
++  NAT_D_DRAFT                 130     # NAT Discovery payload
++  NAT_OA_DRAFT                        131     # NAT Original Address payload
+   PRIVATE_MAX                 255
++  MAX                         255
+ .
+ # ISAKMP exchange types.
+Index: isakmpd-20041012.orig/ipsec_num.cst
+===================================================================
+--- isakmpd-20041012.orig.orig/ipsec_num.cst   2007-06-04 13:22:39.149903592 +0200
++++ isakmpd-20041012.orig/ipsec_num.cst        2007-06-04 13:22:39.287882616 +0200
+@@ -62,10 +62,10 @@
+ IPSEC_ENCAP
+   TUNNEL                              1
+   TRANSPORT                           2
+-  FUTURE_UDP_ENCAP_TUNNEL             3       # XXX Not yet assigned
+-  FUTURE_UDP_ENCAP_TRANSPORT          4       # XXX Not yet assigned
+-  UDP_ENCAP_TUNNEL                    61443   # draft-ietf-ipsec-nat-t-ike
+-  UDP_ENCAP_TRANSPORT                 61443   # draft-ietf-ipsec-nat-t-ike
++  UDP_ENCAP_TUNNEL                    3
++  UDP_ENCAP_TRANSPORT                 4
++  UDP_ENCAP_TUNNEL_DRAFT              61443   # draft-ietf-ipsec-nat-t-ike
++  UDP_ENCAP_TRANSPORT_DRAFT           61443   # draft-ietf-ipsec-nat-t-ike
+ .
+ # IPSEC authentication algorithm.
+Index: isakmpd-20041012.orig/nat_traversal.h
+===================================================================
+--- isakmpd-20041012.orig.orig/nat_traversal.h 2007-06-04 13:22:39.154902832 +0200
++++ isakmpd-20041012.orig/nat_traversal.h      2007-06-04 13:22:39.287882616 +0200
+@@ -1,4 +1,4 @@
+-/*    $OpenBSD: nat_traversal.h,v 1.2 2004/06/21 23:27:10 ho Exp $    */
++/*    $OpenBSD: nat_traversal.h,v 1.4 2005/07/25 15:03:47 hshoexer Exp $      */
+ /*
+  * Copyright (c) 2004 HÃ¥kan Olsson.  All rights reserved.
+@@ -27,6 +27,24 @@
+ #ifndef _NAT_TRAVERSAL_H_
+ #define _NAT_TRAVERSAL_H_
++#define VID_DRAFT_V2  0
++#define VID_DRAFT_V2_N        1
++#define VID_DRAFT_V3  2
++#define VID_RFC3947   3
++
++struct nat_t_cap {
++      int              id;
++      u_int32_t        flags;
++      const char      *text;
++      char            *hash;
++      size_t           hashsize;
++};
++
++/*
++ * Set if -T is given on the command line to disable NAT-T support.
++ */
++extern int    disable_nat_t;
++
+ void  nat_t_init(void);
+ int   nat_t_add_vendor_payloads(struct message *);
+ void  nat_t_check_vendor_payload(struct message *, struct payload *);
+Index: isakmpd-20041012.orig/message.c
+===================================================================
+--- isakmpd-20041012.orig.orig/message.c       2007-06-04 13:22:39.160901920 +0200
++++ isakmpd-20041012.orig/message.c    2007-06-04 13:22:39.288882464 +0200
+@@ -112,6 +112,7 @@
+       message_validate_hash, message_validate_sig, message_validate_nonce,
+       message_validate_notify, message_validate_delete,
+       message_validate_vendor, message_validate_attribute,
++      message_validate_nat_d, message_validate_nat_oa,
+       message_validate_nat_d, message_validate_nat_oa
+ };
+@@ -120,7 +121,7 @@
+       isakmp_id_fld, isakmp_cert_fld, isakmp_certreq_fld, isakmp_hash_fld,
+       isakmp_sig_fld, isakmp_nonce_fld, isakmp_notify_fld, isakmp_delete_fld,
+       isakmp_vendor_fld, isakmp_attribute_fld, isakmp_nat_d_fld,
+-      isakmp_nat_oa_fld
++      isakmp_nat_oa_fld, isakmp_nat_d_fld, isakmp_nat_oa_fld
+ };
+ /*
+@@ -138,7 +139,8 @@
+       ISAKMP_PAYLOAD_SAK, ISAKMP_PAYLOAD_SAT, ISAKMP_PAYLOAD_KD,
+       ISAKMP_PAYLOAD_SEQ, ISAKMP_PAYLOAD_POP
+ #endif
+-      ISAKMP_PAYLOAD_NAT_D, ISAKMP_PAYLOAD_NAT_OA
++      ISAKMP_PAYLOAD_NAT_D, ISAKMP_PAYLOAD_NAT_OA, 
++      ISAKMP_PAYLOAD_NAT_D_DRAFT, ISAKMP_PAYLOAD_NAT_OA_DRAFT
+ };
+ static u_int8_t payload_map[256];
+@@ -347,8 +349,8 @@
+               }
+               /* Ignore most private payloads.  */
+               if (next >= ISAKMP_PAYLOAD_PRIVATE_MIN &&
+-                  next != ISAKMP_PAYLOAD_NAT_D &&
+-                  next != ISAKMP_PAYLOAD_NAT_OA) {
++                  next != ISAKMP_PAYLOAD_NAT_D_DRAFT &&
++                  next != ISAKMP_PAYLOAD_NAT_OA_DRAFT) {
+                       LOG_DBG((LOG_MESSAGE, 30, "message_parse_payloads: "
+                           "private next payload type %s in payload of "
+                           "type %d ignored",
+@@ -460,8 +462,10 @@
+               return ISAKMP_ATTRIBUTE_SZ;
+ #if defined (USE_NAT_TRAVERSAL)
+       case ISAKMP_PAYLOAD_NAT_D:
++      case ISAKMP_PAYLOAD_NAT_D_DRAFT:
+               return ISAKMP_NAT_D_SZ;
+       case ISAKMP_PAYLOAD_NAT_OA:
++      case ISAKMP_PAYLOAD_NAT_OA_DRAFT:
+               return ISAKMP_NAT_OA_SZ;
+ #endif
+       /* Not yet supported and any other unknown payloads. */
+Index: isakmpd-20041012.orig/policy.c
+===================================================================
+--- isakmpd-20041012.orig.orig/policy.c        2007-06-04 13:22:39.165901160 +0200
++++ isakmpd-20041012.orig/policy.c     2007-06-04 13:22:39.289882312 +0200
+@@ -511,7 +511,10 @@
+                                                       break;
+                                               }
+ #if defined (USE_NAT_TRAVERSAL)
+-                                      else if (decode_16(value) == IPSEC_ENCAP_UDP_ENCAP_TUNNEL)
++                                      else if (decode_16(value) ==
++                                          IPSEC_ENCAP_UDP_ENCAP_TUNNEL ||
++                                          decode_16(value) ==
++                                          IPSEC_ENCAP_UDP_ENCAP_TUNNEL_DRAFT)
+                                               switch (proto->proto) {
+                                               case IPSEC_PROTO_IPSEC_AH:
+                                                       ah_encapsulation = "udp-encap-tunnel";
+@@ -1932,7 +1935,7 @@
+ void
+ policy_init(void)
+ {
+-      char           *ptr, *policy_file;
++      char           *ptr, *policy_file, *use_keynote;
+       char          **asserts;
+       size_t          sz, len;
+       int             fd, i;
+@@ -1940,10 +1943,11 @@
+       LOG_DBG((LOG_POLICY, 30, "policy_init: initializing"));
+       /* Do we want to use the policy modules?  */
+-      if (ignore_policy ||
+-          strncmp("yes", conf_get_str("General", "Use-Keynote"), 3))
+-              return;
+-
++      use_keynote = conf_get_str("General", "Use-Keynote");
++      if (ignore_policy || 
++              (use_keynote && strncmp("yes", use_keynote, 3)))
++               return;
++ 
+       /* Get policy file from configuration.  */
+       policy_file = conf_get_str("General", "Policy-file");
+       if (!policy_file)
+Index: isakmpd-20041012.orig/ike_phase_1.c
+===================================================================
+--- isakmpd-20041012.orig.orig/ike_phase_1.c   2007-06-04 13:22:39.170900400 +0200
++++ isakmpd-20041012.orig/ike_phase_1.c        2007-06-04 13:22:39.290882160 +0200
+@@ -1040,9 +1040,9 @@
+               /* Compare expected/desired and received remote ID */
+               if (bcmp(rid, payload->p + ISAKMP_ID_DATA_OFF, sz)) {
+-                      free(rid);
+                       log_print("ike_phase_1_recv_ID: "
+-                          "received remote ID other than expected %s", p);
++                          "received remote ID other than expected %s - %s", p, payload->p);
++                      free(rid);
+                       return -1;
+               }
+               free(rid);
+Index: isakmpd-20041012.orig/x509.c
+===================================================================
+--- isakmpd-20041012.orig.orig/x509.c  2007-06-04 13:22:39.176899488 +0200
++++ isakmpd-20041012.orig/x509.c       2007-06-04 13:22:39.290882160 +0200
+@@ -910,7 +910,11 @@
+       X509_STORE_CTX_init(&csc, x509_cas, cert, NULL);
+ #if OPENSSL_VERSION_NUMBER >= 0x00907000L
+       /* XXX See comment in x509_read_crls_from_dir.  */
++#if OPENSSL_VERSION_NUMBER >= 0x00908000L
++      if (x509_cas->param->flags & X509_V_FLAG_CRL_CHECK) {
++#else
+       if (x509_cas->flags & X509_V_FLAG_CRL_CHECK) {
++#endif
+               X509_STORE_CTX_set_flags(&csc, X509_V_FLAG_CRL_CHECK);
+               X509_STORE_CTX_set_flags(&csc, X509_V_FLAG_CRL_CHECK_ALL);
+       }
+Index: isakmpd-20041012.orig/sysdep/linux/sysdep.c
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/linux/sysdep.c   2007-06-04 13:22:39.182898576 +0200
++++ isakmpd-20041012.orig/sysdep/linux/sysdep.c        2007-06-04 13:22:39.291882008 +0200
+@@ -169,22 +169,22 @@
+     return 0;
+   if (!(af == AF_INET || af == AF_INET6))
+-    {
++    { 
+       log_print ("sysdep_cleartext: unsupported protocol family %d", af);
+       return -1;
+     }
+   if (setsockopt (fd, af == AF_INET ? IPPROTO_IP : IPPROTO_IPV6,
+-                af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY,
+-                &pol_in, sizeof pol_in) < 0 ||
++          af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY,
++          &pol_in, sizeof pol_in) < 0 ||
+       setsockopt (fd, af == AF_INET ? IPPROTO_IP : IPPROTO_IPV6,
+-                af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY,
+-                &pol_out, sizeof pol_out) < 0)
+-    {
++          af == AF_INET ? IP_IPSEC_POLICY : IPV6_IPSEC_POLICY,
++          &pol_out, sizeof pol_out) < 0)
++    { 
+       log_error ("sysdep_cleartext: "
+-               "setsockopt (%d, IPPROTO_IP%s, IP%s_IPSEC_POLICY, ...) "
+-               "failed", fd, af == AF_INET ? "" : "V6",
+-               af == AF_INET ? "" : "V6");
++         "setsockopt (%d, IPPROTO_IP%s, IP%s_IPSEC_POLICY, ...) "
++         "failed", fd, af == AF_INET ? "" : "V6",
++         af == AF_INET ? "" : "V6");
+       return -1;
+     }
+   return 0;
+Index: isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/linux/GNUmakefile.sysdep 2007-06-04 13:22:39.187897816 +0200
++++ isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep      2007-06-04 13:22:39.291882008 +0200
+@@ -33,13 +33,13 @@
+ LDADD+=               -lgmp ${LIBSYSDEP} ${LIBCRYPTO}
+ DPADD+=               ${LIBGMP} ${LIBSYSDEP}
+-CFLAGS+=      -DUSE_OLD_SOCKADDR -DHAVE_PCAP \
+-              -DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP \
+-              -I/usr/src/linux/include -I${.CURDIR}/sysdep/common \
++CFLAGS+=      -DHAVE_GETNAMEINFO -DUSE_OLD_SOCKADDR -DHAVE_PCAP \
++              -DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP -DUSE_AES \
++              -I${.CURDIR}/sysdep/linux/include -I${.CURDIR}/sysdep/common \
+               -I/usr/include/openssl
+ FEATURES=     debug tripledes blowfish cast ec aggressive x509 policy
+-FEATURES+=    des aes
++FEATURES+=    dpd nat_traversal isakmp_cfg des aes
+ IPSEC_SRCS=   pf_key_v2.c
+ IPSEC_CFLAGS= -DUSE_PF_KEY_V2
+@@ -51,7 +51,7 @@
+ # hack libsysdep.a dependenc
+ ${LIBSYSDEPDIR}/.depend ${LIBSYSDEP}:
+       cd ${LIBSYSDEPDIR} && \
+-              ${MAKE} --no-print-directory ${MAKEFLAGS} \
++              ${MAKE} --no-print-directory \
+                       CFLAGS="${CFLAGS}" MKDEP="${MKDEP}" ${MAKECMDGOALS}
+ ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
+Index: isakmpd-20041012.orig/sysdep/linux/include/bitstring.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ isakmpd-20041012.orig/sysdep/linux/include/bitstring.h     2007-06-04 13:22:39.291882008 +0200
+@@ -0,0 +1,132 @@
++/*    $OpenBSD: bitstring.h,v 1.4 2002/06/19 02:50:10 millert Exp $   */
++/*    $NetBSD: bitstring.h,v 1.5 1997/05/14 15:49:55 pk Exp $ */
++
++/*
++ * Copyright (c) 1989, 1993
++ *    The Regents of the University of California.  All rights reserved.
++ *
++ * This code is derived from software contributed to Berkeley by
++ * Paul Vixie.
++ *
++ * 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. All advertising materials mentioning features or use of this software
++ *    must display the following acknowledgement:
++ *    This product includes software developed by the University of
++ *    California, Berkeley and its contributors.
++ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
++ *
++ *    @(#)bitstring.h 8.1 (Berkeley) 7/19/93
++ */
++
++#ifndef _BITSTRING_H_
++#define       _BITSTRING_H_
++
++/* modified for SV/AT and bitstring bugfix by M.R.Murphy, 11oct91
++ * bitstr_size changed gratuitously, but shorter
++ * bit_alloc   spelling error fixed
++ * the following were efficient, but didn't work, they've been made to
++ * work, but are no longer as efficient :-)
++ * bit_nclear, bit_nset, bit_ffc, bit_ffs
++ */
++typedef       unsigned char bitstr_t;
++
++/* internal macros */
++                              /* byte of the bitstring bit is in */
++#define       _bit_byte(bit) \
++      ((bit) >> 3)
++
++                              /* mask for the bit within its byte */
++#define       _bit_mask(bit) \
++      (1 << ((bit)&0x7))
++
++/* external macros */
++                              /* bytes in a bitstring of nbits bits */
++#define       bitstr_size(nbits) \
++      (((nbits) + 7) >> 3)
++
++                              /* allocate a bitstring */
++#define       bit_alloc(nbits) \
++      (bitstr_t *)calloc((size_t)bitstr_size(nbits), sizeof(bitstr_t))
++
++                              /* allocate a bitstring on the stack */
++#define       bit_decl(name, nbits) \
++      ((name)[bitstr_size(nbits)])
++
++                              /* is bit N of bitstring name set? */
++#define       bit_test(name, bit) \
++      ((name)[_bit_byte(bit)] & _bit_mask(bit))
++
++                              /* set bit N of bitstring name */
++#define       bit_set(name, bit) \
++      ((name)[_bit_byte(bit)] |= _bit_mask(bit))
++
++                              /* clear bit N of bitstring name */
++#define       bit_clear(name, bit) \
++      ((name)[_bit_byte(bit)] &= ~_bit_mask(bit))
++
++                              /* clear bits start ... stop in bitstring */
++#define       bit_nclear(name, start, stop) do { \
++      register bitstr_t *_name = name; \
++      register int _start = start, _stop = stop; \
++      while (_start <= _stop) { \
++              bit_clear(_name, _start); \
++              _start++; \
++              } \
++} while(0)
++
++                              /* set bits start ... stop in bitstring */
++#define       bit_nset(name, start, stop) do { \
++      register bitstr_t *_name = name; \
++      register int _start = start, _stop = stop; \
++      while (_start <= _stop) { \
++              bit_set(_name, _start); \
++              _start++; \
++              } \
++} while(0)
++
++                              /* find first bit clear in name */
++#define       bit_ffc(name, nbits, value) do { \
++      register bitstr_t *_name = name; \
++      register int _bit, _nbits = nbits, _value = -1; \
++      for (_bit = 0; _bit < _nbits; ++_bit) \
++              if (!bit_test(_name, _bit)) { \
++                      _value = _bit; \
++                      break; \
++              } \
++      *(value) = _value; \
++} while(0)
++
++                              /* find first bit set in name */
++#define       bit_ffs(name, nbits, value) do { \
++      register bitstr_t *_name = name; \
++      register int _bit, _nbits = nbits, _value = -1; \
++      for (_bit = 0; _bit < _nbits; ++_bit) \
++              if (bit_test(_name, _bit)) { \
++                      _value = _bit; \
++                      break; \
++              } \
++      *(value) = _value; \
++} while(0)
++
++#endif /* !_BITSTRING_H_ */
+Index: isakmpd-20041012.orig/sysdep/linux/include/sys/queue.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ isakmpd-20041012.orig/sysdep/linux/include/sys/queue.h     2007-06-04 13:22:39.292881856 +0200
+@@ -0,0 +1,453 @@
++/*
++ * Copyright (c) 1991, 1993
++ *    The Regents of the University of California.  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. All advertising materials mentioning features or use of this software
++ *    must display the following acknowledgement:
++ *    This product includes software developed by the University of
++ *    California, Berkeley and its contributors.
++ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
++ *
++ *    @(#)queue.h     8.5 (Berkeley) 8/20/94
++ * $FreeBSD: src/sys/sys/queue.h,v 1.45 2001/12/11 11:49:58 sheldonh Exp $
++ */
++
++#ifndef _SYS_QUEUE_H_
++#define       _SYS_QUEUE_H_
++
++//#include <machine/ansi.h>   /* for __offsetof */
++
++/*
++ * This file defines four types of data structures: singly-linked lists,
++ * singly-linked tail queues, lists and tail queues.
++ *
++ * A singly-linked list is headed by a single forward pointer. The elements
++ * are singly linked for minimum space and pointer manipulation overhead at
++ * the expense of O(n) removal for arbitrary elements. New elements can be
++ * added to the list after an existing element or at the head of the list.
++ * Elements being removed from the head of the list should use the explicit
++ * macro for this purpose for optimum efficiency. A singly-linked list may
++ * only be traversed in the forward direction.  Singly-linked lists are ideal
++ * for applications with large datasets and few or no removals or for
++ * implementing a LIFO queue.
++ *
++ * A singly-linked tail queue is headed by a pair of pointers, one to the
++ * head of the list and the other to the tail of the list. The elements are
++ * singly linked for minimum space and pointer manipulation overhead at the
++ * expense of O(n) removal for arbitrary elements. New elements can be added
++ * to the list after an existing element, at the head of the list, or at the
++ * end of the list. Elements being removed from the head of the tail queue
++ * should use the explicit macro for this purpose for optimum efficiency.
++ * A singly-linked tail queue may only be traversed in the forward direction.
++ * Singly-linked tail queues are ideal for applications with large datasets
++ * and few or no removals or for implementing a FIFO queue.
++ *
++ * A list is headed by a single forward pointer (or an array of forward
++ * pointers for a hash table header). The elements are doubly linked
++ * so that an arbitrary element can be removed without a need to
++ * traverse the list. New elements can be added to the list before
++ * or after an existing element or at the head of the list. A list
++ * may only be traversed in the forward direction.
++ *
++ * A tail queue is headed by a pair of pointers, one to the head of the
++ * list and the other to the tail of the list. The elements are doubly
++ * linked so that an arbitrary element can be removed without a need to
++ * traverse the list. New elements can be added to the list before or
++ * after an existing element, at the head of the list, or at the end of
++ * the list. A tail queue may be traversed in either direction.
++ *
++ * For details on the use of these macros, see the queue(3) manual page.
++ *
++ *
++ *                    SLIST   LIST    STAILQ  TAILQ
++ * _HEAD              +       +       +       +
++ * _HEAD_INITIALIZER  +       +       +       +
++ * _ENTRY             +       +       +       +
++ * _INIT              +       +       +       +
++ * _EMPTY             +       +       +       +
++ * _FIRST             +       +       +       +
++ * _NEXT              +       +       +       +
++ * _PREV              -       -       -       +
++ * _LAST              -       -       +       +
++ * _FOREACH           +       +       +       +
++ * _FOREACH_REVERSE   -       -       -       +
++ * _INSERT_HEAD               +       +       +       +
++ * _INSERT_BEFORE     -       +       -       +
++ * _INSERT_AFTER      +       +       +       +
++ * _INSERT_TAIL               -       -       +       +
++ * _REMOVE_HEAD               +       -       +       -
++ * _REMOVE            +       +       +       +
++ *
++ */
++
++/*
++ * Singly-linked List declarations.
++ */
++#define       SLIST_HEAD(name, type)                                          \
++struct name {                                                         \
++      struct type *slh_first; /* first element */                     \
++}
++
++#define       SLIST_HEAD_INITIALIZER(head)                                    \
++      { NULL }
++ 
++#define       SLIST_ENTRY(type)                                               \
++struct {                                                              \
++      struct type *sle_next;  /* next element */                      \
++}
++ 
++/*
++ * Singly-linked List functions.
++ */
++#define       SLIST_EMPTY(head)       ((head)->slh_first == NULL)
++
++#define       SLIST_FIRST(head)       ((head)->slh_first)
++
++#define       SLIST_FOREACH(var, head, field)                                 \
++      for ((var) = SLIST_FIRST((head));                               \
++          (var);                                                      \
++          (var) = SLIST_NEXT((var), field))
++
++#define       SLIST_INIT(head) do {                                           \
++      SLIST_FIRST((head)) = NULL;                                     \
++} while (0)
++
++#define       SLIST_INSERT_AFTER(slistelm, elm, field) do {                   \
++      SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);       \
++      SLIST_NEXT((slistelm), field) = (elm);                          \
++} while (0)
++
++#define       SLIST_INSERT_HEAD(head, elm, field) do {                        \
++      SLIST_NEXT((elm), field) = SLIST_FIRST((head));                 \
++      SLIST_FIRST((head)) = (elm);                                    \
++} while (0)
++
++#define       SLIST_NEXT(elm, field)  ((elm)->field.sle_next)
++
++#define       SLIST_REMOVE(head, elm, type, field) do {                       \
++      if (SLIST_FIRST((head)) == (elm)) {                             \
++              SLIST_REMOVE_HEAD((head), field);                       \
++      }                                                               \
++      else {                                                          \
++              struct type *curelm = SLIST_FIRST((head));              \
++              while (SLIST_NEXT(curelm, field) != (elm))              \
++                      curelm = SLIST_NEXT(curelm, field);             \
++              SLIST_NEXT(curelm, field) =                             \
++                  SLIST_NEXT(SLIST_NEXT(curelm, field), field);       \
++      }                                                               \
++} while (0)
++
++#define       SLIST_REMOVE_HEAD(head, field) do {                             \
++      SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);   \
++} while (0)
++
++/*
++ * Singly-linked Tail queue declarations.
++ */
++#define       STAILQ_HEAD(name, type)                                         \
++struct name {                                                         \
++      struct type *stqh_first;/* first element */                     \
++      struct type **stqh_last;/* addr of last next element */         \
++}
++
++#define       STAILQ_HEAD_INITIALIZER(head)                                   \
++      { NULL, &(head).stqh_first }
++
++#define       STAILQ_ENTRY(type)                                              \
++struct {                                                              \
++      struct type *stqe_next; /* next element */                      \
++}
++
++/*
++ * Singly-linked Tail queue functions.
++ */
++#define       STAILQ_EMPTY(head)      ((head)->stqh_first == NULL)
++
++#define       STAILQ_FIRST(head)      ((head)->stqh_first)
++
++#define       STAILQ_FOREACH(var, head, field)                                \
++      for((var) = STAILQ_FIRST((head));                               \
++         (var);                                                       \
++         (var) = STAILQ_NEXT((var), field))
++
++#define       STAILQ_INIT(head) do {                                          \
++      STAILQ_FIRST((head)) = NULL;                                    \
++      (head)->stqh_last = &STAILQ_FIRST((head));                      \
++} while (0)
++
++#define       STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {               \
++      if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
++              (head)->stqh_last = &STAILQ_NEXT((elm), field);         \
++      STAILQ_NEXT((tqelm), field) = (elm);                            \
++} while (0)
++
++#define       STAILQ_INSERT_HEAD(head, elm, field) do {                       \
++      if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
++              (head)->stqh_last = &STAILQ_NEXT((elm), field);         \
++      STAILQ_FIRST((head)) = (elm);                                   \
++} while (0)
++
++#define       STAILQ_INSERT_TAIL(head, elm, field) do {                       \
++      STAILQ_NEXT((elm), field) = NULL;                               \
++      *(head)->stqh_last = (elm);                                     \
++      (head)->stqh_last = &STAILQ_NEXT((elm), field);                 \
++} while (0)
++
++#define       STAILQ_LAST(head, type, field)                                  \
++      (STAILQ_EMPTY(head) ?                                           \
++              NULL :                                                  \
++              ((struct type *)                                        \
++              ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
++
++#define       STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
++
++#define       STAILQ_REMOVE(head, elm, type, field) do {                      \
++      if (STAILQ_FIRST((head)) == (elm)) {                            \
++              STAILQ_REMOVE_HEAD(head, field);                        \
++      }                                                               \
++      else {                                                          \
++              struct type *curelm = STAILQ_FIRST((head));             \
++              while (STAILQ_NEXT(curelm, field) != (elm))             \
++                      curelm = STAILQ_NEXT(curelm, field);            \
++              if ((STAILQ_NEXT(curelm, field) =                       \
++                   STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
++                      (head)->stqh_last = &STAILQ_NEXT((curelm), field);\
++      }                                                               \
++} while (0)
++
++#define       STAILQ_REMOVE_HEAD(head, field) do {                            \
++      if ((STAILQ_FIRST((head)) =                                     \
++           STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)         \
++              (head)->stqh_last = &STAILQ_FIRST((head));              \
++} while (0)
++
++#define       STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do {                 \
++      if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
++              (head)->stqh_last = &STAILQ_FIRST((head));              \
++} while (0)
++
++/*
++ * List declarations.
++ */
++#define       LIST_HEAD(name, type)                                           \
++struct name {                                                         \
++      struct type *lh_first;  /* first element */                     \
++}
++
++#define       LIST_HEAD_INITIALIZER(head)                                     \
++      { NULL }
++
++#define       LIST_ENTRY(type)                                                \
++struct {                                                              \
++      struct type *le_next;   /* next element */                      \
++      struct type **le_prev;  /* address of previous next element */  \
++}
++
++/*
++ * List functions.
++ */
++
++#define       LIST_EMPTY(head)        ((head)->lh_first == NULL)
++
++#define       LIST_FIRST(head)        ((head)->lh_first)
++
++#define       LIST_FOREACH(var, head, field)                                  \
++      for ((var) = LIST_FIRST((head));                                \
++          (var);                                                      \
++          (var) = LIST_NEXT((var), field))
++
++#define       LIST_INIT(head) do {                                            \
++      LIST_FIRST((head)) = NULL;                                      \
++} while (0)
++
++#define       LIST_INSERT_AFTER(listelm, elm, field) do {                     \
++      if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
++              LIST_NEXT((listelm), field)->field.le_prev =            \
++                  &LIST_NEXT((elm), field);                           \
++      LIST_NEXT((listelm), field) = (elm);                            \
++      (elm)->field.le_prev = &LIST_NEXT((listelm), field);            \
++} while (0)
++
++#define       LIST_INSERT_BEFORE(listelm, elm, field) do {                    \
++      (elm)->field.le_prev = (listelm)->field.le_prev;                \
++      LIST_NEXT((elm), field) = (listelm);                            \
++      *(listelm)->field.le_prev = (elm);                              \
++      (listelm)->field.le_prev = &LIST_NEXT((elm), field);            \
++} while (0)
++
++#define       LIST_INSERT_HEAD(head, elm, field) do {                         \
++      if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)     \
++              LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
++      LIST_FIRST((head)) = (elm);                                     \
++      (elm)->field.le_prev = &LIST_FIRST((head));                     \
++} while (0)
++
++#define       LIST_NEXT(elm, field)   ((elm)->field.le_next)
++
++#define       LIST_REMOVE(elm, field) do {                                    \
++      if (LIST_NEXT((elm), field) != NULL)                            \
++              LIST_NEXT((elm), field)->field.le_prev =                \
++                  (elm)->field.le_prev;                               \
++      *(elm)->field.le_prev = LIST_NEXT((elm), field);                \
++} while (0)
++
++/*
++ * Tail queue declarations.
++ */
++#define       TAILQ_HEAD(name, type)                                          \
++struct name {                                                         \
++      struct type *tqh_first; /* first element */                     \
++      struct type **tqh_last; /* addr of last next element */         \
++}
++
++#define       TAILQ_HEAD_INITIALIZER(head)                                    \
++      { NULL, &(head).tqh_first }
++
++#define       TAILQ_ENTRY(type)                                               \
++struct {                                                              \
++      struct type *tqe_next;  /* next element */                      \
++      struct type **tqe_prev; /* address of previous next element */  \
++}
++
++/*
++ * Tail queue functions.
++ */
++#define       TAILQ_EMPTY(head)       ((head)->tqh_first == NULL)
++
++#define       TAILQ_FIRST(head)       ((head)->tqh_first)
++
++#define       TAILQ_FOREACH(var, head, field)                                 \
++      for ((var) = TAILQ_FIRST((head));                               \
++          (var);                                                      \
++          (var) = TAILQ_NEXT((var), field))
++
++#define       TAILQ_FOREACH_REVERSE(var, head, headname, field)               \
++      for ((var) = TAILQ_LAST((head), headname);                      \
++          (var);                                                      \
++          (var) = TAILQ_PREV((var), headname, field))
++
++#define       TAILQ_INIT(head) do {                                           \
++      TAILQ_FIRST((head)) = NULL;                                     \
++      (head)->tqh_last = &TAILQ_FIRST((head));                        \
++} while (0)
++
++#define       TAILQ_INSERT_AFTER(head, listelm, elm, field) do {              \
++      if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
++              TAILQ_NEXT((elm), field)->field.tqe_prev =              \
++                  &TAILQ_NEXT((elm), field);                          \
++      else                                                            \
++              (head)->tqh_last = &TAILQ_NEXT((elm), field);           \
++      TAILQ_NEXT((listelm), field) = (elm);                           \
++      (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);          \
++} while (0)
++
++#define       TAILQ_INSERT_BEFORE(listelm, elm, field) do {                   \
++      (elm)->field.tqe_prev = (listelm)->field.tqe_prev;              \
++      TAILQ_NEXT((elm), field) = (listelm);                           \
++      *(listelm)->field.tqe_prev = (elm);                             \
++      (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);          \
++} while (0)
++
++#define       TAILQ_INSERT_HEAD(head, elm, field) do {                        \
++      if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)   \
++              TAILQ_FIRST((head))->field.tqe_prev =                   \
++                  &TAILQ_NEXT((elm), field);                          \
++      else                                                            \
++              (head)->tqh_last = &TAILQ_NEXT((elm), field);           \
++      TAILQ_FIRST((head)) = (elm);                                    \
++      (elm)->field.tqe_prev = &TAILQ_FIRST((head));                   \
++} while (0)
++
++#define       TAILQ_INSERT_TAIL(head, elm, field) do {                        \
++      TAILQ_NEXT((elm), field) = NULL;                                \
++      (elm)->field.tqe_prev = (head)->tqh_last;                       \
++      *(head)->tqh_last = (elm);                                      \
++      (head)->tqh_last = &TAILQ_NEXT((elm), field);                   \
++} while (0)
++
++#define       TAILQ_LAST(head, headname)                                      \
++      (*(((struct headname *)((head)->tqh_last))->tqh_last))
++
++#define       TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
++
++#define       TAILQ_PREV(elm, headname, field)                                \
++      (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
++
++#define       TAILQ_REMOVE(head, elm, field) do {                             \
++      if ((TAILQ_NEXT((elm), field)) != NULL)                         \
++              TAILQ_NEXT((elm), field)->field.tqe_prev =              \
++                  (elm)->field.tqe_prev;                              \
++      else                                                            \
++              (head)->tqh_last = (elm)->field.tqe_prev;               \
++      *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);              \
++} while (0)
++
++
++#ifdef _KERNEL
++
++/*
++ * XXX insque() and remque() are an old way of handling certain queues.
++ * They bogusly assumes that all queue heads look alike.
++ */
++
++struct quehead {
++      struct quehead *qh_link;
++      struct quehead *qh_rlink;
++};
++
++#ifdef        __GNUC__
++
++static __inline void
++insque(void *a, void *b)
++{
++      struct quehead *element = (struct quehead *)a,
++               *head = (struct quehead *)b;
++
++      element->qh_link = head->qh_link;
++      element->qh_rlink = head;
++      head->qh_link = element;
++      element->qh_link->qh_rlink = element;
++}
++
++static __inline void
++remque(void *a)
++{
++      struct quehead *element = (struct quehead *)a;
++
++      element->qh_link->qh_rlink = element->qh_rlink;
++      element->qh_rlink->qh_link = element->qh_link;
++      element->qh_rlink = 0;
++}
++
++#else /* !__GNUC__ */
++
++void  insque __P((void *a, void *b));
++void  remque __P((void *a));
++
++#endif /* __GNUC__ */
++
++#endif /* _KERNEL */
++
++#endif /* !_SYS_QUEUE_H_ */
+Index: isakmpd-20041012.orig/sysdep/common/pcap.h
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/pcap.h    2007-06-04 13:22:39.203895384 +0200
++++ isakmpd-20041012.orig/sysdep/common/pcap.h 2007-06-04 13:22:39.292881856 +0200
+@@ -55,8 +55,13 @@
+       u_int32_t linktype;     /* data link type (DLT_*) */
+ };
++struct pcap_timeval {
++      int32_t tv_sec;         /* seconds */
++      int32_t tv_usec;        /* microseconds */
++};
++
+ struct pcap_pkthdr {
+-      struct timeval ts;      /* time stamp */
++      struct pcap_timeval ts; /* time stamp */
+       u_int32_t caplen;       /* length of portion present */
+       u_int32_t len;          /* length this packet (off wire) */
+ };
+Index: isakmpd-20041012.orig/sysdep/common/libsysdep/arc4random.c
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/arc4random.c    2007-06-04 13:22:39.211894168 +0200
++++ isakmpd-20041012.orig/sysdep/common/libsysdep/arc4random.c 2007-06-04 13:22:39.292881856 +0200
+@@ -78,7 +78,7 @@
+ static void
+ arc4_stir(struct arc4_stream *as)
+ {
+-      int     fd;
++      int     fd, i;
+       struct {
+               struct timeval tv;
+               u_int8_t rnd[128 - sizeof(struct timeval)];
+Index: isakmpd-20041012.orig/x509v3.cnf
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ isakmpd-20041012.orig/x509v3.cnf   2007-06-04 13:22:39.293881704 +0200
+@@ -0,0 +1,26 @@
++# default settings
++CERTPATHLEN             = 1
++CERTUSAGE               = digitalSignature,keyCertSign
++CERTIP                  = 0.0.0.0
++CERTFQDN                = nohost.nodomain
++
++# This section should be referenced when building an x509v3 CA
++# Certificate.
++# The default path length and the key usage can be overriden
++# modified by setting the CERTPATHLEN and CERTUSAGE environment 
++# variables.
++[x509v3_CA]
++basicConstraints=critical,CA:true,pathlen:$ENV::CERTPATHLEN
++keyUsage=$ENV::CERTUSAGE
++
++# This section should be referenced to add an IP Address
++# as an alternate subject name, needed by isakmpd
++# The address must be provided in the CERTIP environment variable
++[x509v3_IPAddr]
++subjectAltName=IP:$ENV::CERTIP
++
++# This section should be referenced to add a FQDN hostname
++# as an alternate subject name, needed by isakmpd
++# The address must be provided in the CERTFQDN environment variable
++[x509v3_FQDN]
++subjectAltName=DNS:$ENV::CERTFQDN
diff --git a/net/isakmpd/patches/020-standardize.patch b/net/isakmpd/patches/020-standardize.patch
new file mode 100644 (file)
index 0000000..435782b
--- /dev/null
@@ -0,0 +1,154 @@
+Index: isakmpd-20041012.orig/GNUmakefile
+===================================================================
+--- isakmpd-20041012.orig.orig/GNUmakefile     2007-06-04 13:22:39.283883224 +0200
++++ isakmpd-20041012.orig/GNUmakefile  2007-06-04 13:22:39.722816496 +0200
+@@ -168,7 +168,6 @@
+ X509=         x509.c
+ CFLAGS+=      -DUSE_LIBCRYPTO
+ LDADD+=               -lcrypto
+-DPADD+=               ${LIBCRYPTO}
+ endif
+ ifdef USE_RAWKEY
+@@ -242,3 +241,16 @@
+ realcleandepend:
+       rm -f .depend tags
++
++# Install rules
++install: install-bin install-man
++
++install-bin: isakmpd
++      -mkdir -p $(DESTDIR)$(BINDIR)
++      $(INSTALL) $(INSTALL_OPTS) -m 755 isakmpd $(DESTDIR)$(BINDIR)
++
++install-man:
++      -mkdir -p $(DESTDIR)$(MANDIR)/man8
++      $(INSTALL) $(INSTALL_OPTS) -m 444 isakmpd.8 $(DESTDIR)$(MANDIR)/man8
++      -mkdir -p $(DESTDIR)$(MANDIR)/man5
++      $(INSTALL) $(INSTALL_OPTS) -m 444 isakmpd.conf.5 isakmpd.policy.5 $(DESTDIR)$(MANDIR)/man5
+Index: isakmpd-20041012.orig/samples/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/samples/Makefile        2007-06-04 13:22:39.015923960 +0200
++++ isakmpd-20041012.orig/samples/Makefile     2007-06-04 13:22:39.722816496 +0200
+@@ -26,7 +26,7 @@
+ #
+ FILES=                VPN-* policy singlehost-*
+-TARGETDIR=    /usr/share/ipsec/isakmpd
++TARGETDIR=    /usr/share/isakmpd/samples
+ # The mkdir below is for installation on OpenBSD pre 2.7
+ install:
+Index: isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/linux/GNUmakefile.sysdep 2007-06-04 13:22:39.291882008 +0200
++++ isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep      2007-06-04 13:22:39.722816496 +0200
+@@ -25,18 +25,18 @@
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #
+-LIBGMP:=      /usr/lib/libgmp.a
+-LIBCRYPTO:=   /usr/lib/libcrypto.a
++LIBGMP:=
++LIBCRYPTO:=   -lcrypto
+ LIBSYSDEPDIR:=        ${.CURDIR}/sysdep/common/libsysdep
+ LIBSYSDEP:=   ${LIBSYSDEPDIR}/libsysdep.a
+-LDADD+=               -lgmp ${LIBSYSDEP} ${LIBCRYPTO}
++LDADD+=               $(EXTRA_LDFLAGS) -lgmp ${LIBSYSDEP} ${LIBCRYPTO}
+ DPADD+=               ${LIBGMP} ${LIBSYSDEP}
+ CFLAGS+=      -DHAVE_GETNAMEINFO -DUSE_OLD_SOCKADDR -DHAVE_PCAP \
+               -DNEED_SYSDEP_APP -DMP_FLAVOUR=MP_FLAVOUR_GMP -DUSE_AES \
+               -I${.CURDIR}/sysdep/linux/include -I${.CURDIR}/sysdep/common \
+-              -I/usr/include/openssl
++              $(EXTRA_CPPFLAGS)
+ FEATURES=     debug tripledes blowfish cast ec aggressive x509 policy
+ FEATURES+=    dpd nat_traversal isakmp_cfg des aes
+Index: isakmpd-20041012.orig/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/Makefile        2007-06-04 13:22:39.028921984 +0200
++++ isakmpd-20041012.orig/Makefile     2007-06-04 13:22:39.723816344 +0200
+@@ -147,7 +147,6 @@
+ .ifdef USE_LIBCRYPTO
+ CFLAGS+=      -DUSE_LIBCRYPTO
+ LDADD+=               -lcrypto
+-DPADD+=               ${LIBCRYPTO}
+ .endif
+ .ifdef USE_LIBDES
+Index: isakmpd-20041012.orig/apps/certpatch/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/apps/certpatch/Makefile 2007-06-04 13:22:39.035920920 +0200
++++ isakmpd-20041012.orig/apps/certpatch/Makefile      2007-06-04 13:22:39.723816344 +0200
+@@ -40,7 +40,6 @@
+ .PATH:                ${TOPSRC} ${TOPSRC}/sysdep/${OS} ${TOPOBJ}
+ CFLAGS+=      -I${TOPSRC} -I${TOPSRC}/sysdep/${OS} -I${TOPOBJ} -Wall
+ LDADD+=               -lcrypto
+-DPADD+=               ${LIBCRYPTO}
+ MAN=          certpatch.8
+ .if ${FEATURES:Mgmp} == "gmp"
+Index: isakmpd-20041012.orig/regress/crypto/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/regress/crypto/Makefile 2007-06-04 13:22:39.041920008 +0200
++++ isakmpd-20041012.orig/regress/crypto/Makefile      2007-06-04 13:22:39.723816344 +0200
+@@ -13,7 +13,7 @@
+               -DUSE_TRIPLEDES -DUSE_CAST -DUSE_BLOWFISH -DUSE_DES \
+               -DUSE_AES
+ LDADD+=               -lcrypto -ldes
+-DPADD+=               ${LIBCRYPTO} ${LIBDES}
++DPADD+=               ${LIBDES}
+ NOMAN=
+ DEBUG=                -g
+Index: isakmpd-20041012.orig/regress/dh/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/regress/dh/Makefile     2007-06-04 13:22:39.048918944 +0200
++++ isakmpd-20041012.orig/regress/dh/Makefile  2007-06-04 13:22:39.726815888 +0200
+@@ -15,7 +15,6 @@
+               -DUSE_EC
+ NOMAN=
+ LDADD+=               -lcrypto
+-DPADD+=               ${LIBCRYPTO}
+ DEBUG=                -g
+ .if ${FEATURES:Mgmp} == "gmp"
+Index: isakmpd-20041012.orig/regress/group/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/regress/group/Makefile  2007-06-04 13:22:39.054918032 +0200
++++ isakmpd-20041012.orig/regress/group/Makefile       2007-06-04 13:22:39.727815736 +0200
+@@ -15,7 +15,6 @@
+               -DUSE_EC
+ NOMAN=
+ LDADD+=               -lcrypto
+-DPADD+=               ${LIBCRYPTO}
+ DEBUG=                -g
+ .if ${FEATURES:Mgmp} == "gmp"
+Index: isakmpd-20041012.orig/regress/rsakeygen/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/regress/rsakeygen/Makefile      2007-06-04 13:22:39.060917120 +0200
++++ isakmpd-20041012.orig/regress/rsakeygen/Makefile   2007-06-04 13:22:39.727815736 +0200
+@@ -62,7 +62,6 @@
+ .ifdef USE_LIBCRYPTO
+ CFLAGS+=      -DUSE_LIBCRYPTO
+ LDADD+=               -lcrypto
+-DPADD+=               ${LIBCRYPTO}
+ .endif
+ .if !defined (HAVE_DLOPEN) && !defined (USE_LIBCRYPTO)
+Index: isakmpd-20041012.orig/regress/x509/Makefile
+===================================================================
+--- isakmpd-20041012.orig.orig/regress/x509/Makefile   2007-06-04 13:22:39.068915904 +0200
++++ isakmpd-20041012.orig/regress/x509/Makefile        2007-06-04 13:22:39.727815736 +0200
+@@ -78,7 +78,6 @@
+ X509=         x509.c
+ CFLAGS+=      -DUSE_LIBCRYPTO
+ LDADD+=               -lcrypto ${LIBLWRES}
+-DPADD+=               ${LIBCRYPTO}
+ .endif
+ .if !defined (HAVE_DLOPEN) && !defined (USE_LIBCRYPTO) || !defined (USE_KEYNOTE)
diff --git a/net/isakmpd/patches/030-openssl_hashes.patch b/net/isakmpd/patches/030-openssl_hashes.patch
new file mode 100644 (file)
index 0000000..f50afc5
--- /dev/null
@@ -0,0 +1,161 @@
+Index: isakmpd-20041012.orig/GNUmakefile
+===================================================================
+--- isakmpd-20041012.orig.orig/GNUmakefile     2007-06-04 13:22:39.722816496 +0200
++++ isakmpd-20041012.orig/GNUmakefile  2007-06-04 13:22:40.000774240 +0200
+@@ -76,13 +76,14 @@
+               isakmp_fld.c isakmp_fld.h
+ MAN=          isakmpd.8 isakmpd.conf.5 isakmpd.policy.5
+-CFLAGS+=      -O2 ${DEBUG} -Wall -DNEED_SYSDEP_APP \
++CFLAGS+=      ${DEBUG} -Wall -DNEED_SYSDEP_APP \
+               -I${.CURDIR} -I${.CURDIR}/sysdep/${OS} -I. \
+ # Different debugging & profiling suggestions
+ # Include symbolic debugging info
+ DEBUG=                -g
++CFLAGS+=      -g
+ # Do execution time profiles
+ #CFLAGS+=     -pg
+@@ -175,6 +176,14 @@
+ CFLAGS+=        -DUSE_RAWKEY
+ endif
++ifdef USE_OPENSSL_MD5
++CFLAGS+=      -DUSE_OPENSSL_MD5
++endif
++
++ifdef USE_OPENSSL_SHA1
++CFLAGS+=      -DUSE_OPENSSL_SHA1
++endif
++
+ SRCS+=                ${IPSEC_SRCS} ${X509} ${POLICY} ${EC} ${AGGRESSIVE} ${DNSSEC} \
+                       $(ISAKMP_CFG) ${DPD} ${NAT_TRAVERSAL}
+ CFLAGS+=      ${IPSEC_CFLAGS}
+Index: isakmpd-20041012.orig/sysdep/common/libsysdep/GNUmakefile
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/GNUmakefile     2007-06-04 13:22:38.959932472 +0200
++++ isakmpd-20041012.orig/sysdep/common/libsysdep/GNUmakefile  2007-06-04 13:22:40.000774240 +0200
+@@ -31,10 +31,18 @@
+ .CURDIR:=     $(shell pwd)
+ LIB=          sysdep
+-SRCS=         arc4random.c blowfish.c cast.c md5.c sha1.c strlcat.c strlcpy.c
++SRCS=         arc4random.c blowfish.c cast.c strlcat.c strlcpy.c
+ NOMAN=
+ CFLAGS+=      -I${.CURDIR}/.. -I/usr/include/machine
++ifeq (,$(findstring USE_OPENSSL_MD5,$(CFLAGS)))
++SRCS+=md5.c
++endif
++
++ifeq (,$(findstring USE_OPENSSL_SHA1,$(CFLAGS)))
++SRCS+=sha1.c
++endif
++
+ lib${LIB}.a: ${SRCS:%.c=%.o}
+       ar cq $@ ${SRCS:%.c=%.o}
+Index: isakmpd-20041012.orig/sysdep/common/libsysdep/md5.c
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/md5.c   2007-06-04 13:22:38.964931712 +0200
++++ isakmpd-20041012.orig/sysdep/common/libsysdep/md5.c        2007-06-04 13:22:40.000774240 +0200
+@@ -5,6 +5,8 @@
+  * changes to accommodate it in the kernel by ji.
+  */
++#ifndef USE_OPENSSL_MD5
++
+ /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
+  */
+@@ -390,3 +392,4 @@
+ #endif
+ #endif
++#endif /* USE_OPENSSL_MD5 */
+Index: isakmpd-20041012.orig/sysdep/common/libsysdep/sha1.c
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/sha1.c  2007-06-04 13:22:38.970930800 +0200
++++ isakmpd-20041012.orig/sysdep/common/libsysdep/sha1.c       2007-06-04 13:22:40.001774088 +0200
+@@ -1,5 +1,7 @@
+ /*    $OpenBSD: sha1.c,v 1.2 2001/01/28 22:38:48 niklas Exp $ */
++#ifndef USE_OPENSSL_SHA1
++
+ /*
+ SHA-1 in C
+ By Steve Reid <steve@edmweb.com>
+@@ -171,3 +173,5 @@
+     SHA1Transform(context->state, context->buffer);
+ #endif
+ }
++
++#endif /* USE_OPENSSL_SHA1 */
+Index: isakmpd-20041012.orig/sysdep/common/md5.h
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/md5.h     2007-06-04 13:22:38.976929888 +0200
++++ isakmpd-20041012.orig/sysdep/common/md5.h  2007-06-04 13:22:40.001774088 +0200
+@@ -1,5 +1,15 @@
+ /*    $OpenBSD: md5.h,v 1.2 2001/01/28 22:38:47 niklas Exp $  */
++#ifdef USE_OPENSSL_MD5
++
++#include <openssl/md5.h>
++
++#define MD5Init               MD5_Init
++#define       MD5Update       MD5_Update
++#define       MD5Final        MD5_Final
++
++#else /* USE_OPENSSL_MD5 */
++
+ /* GLOBAL.H - RSAREF types and constants
+  */
+@@ -71,3 +81,5 @@
+ void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
+ #define _MD5_H_
++
++#endif        /* USE_OPENSSL_MD5 */
+Index: isakmpd-20041012.orig/sysdep/common/sha1.h
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/sha1.h    2007-06-04 13:22:38.982928976 +0200
++++ isakmpd-20041012.orig/sysdep/common/sha1.h 2007-06-04 13:22:40.001774088 +0200
+@@ -1,5 +1,16 @@
+ /*    $OpenBSD: sha1.h,v 1.2 2001/01/28 22:38:47 niklas Exp $ */
++#ifdef USE_OPENSSL_SHA1
++
++#include <openssl/sha.h>
++
++typedef SHA_CTX SHA1_CTX;
++#define       SHA1Init        SHA1_Init
++#define       SHA1Update      SHA1_Update
++#define       SHA1Final       SHA1_Final
++
++#else /* USE_OPENSSL_SHA1 */
++
+ /*
+ SHA-1 in C
+ By Steve Reid <steve@edmweb.com>
+@@ -16,3 +27,5 @@
+ void SHA1Init(SHA1_CTX* context);
+ void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len);
+ void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
++
++#endif        /* USE_OPENSSL_SHA1 */
+Index: isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/linux/GNUmakefile.sysdep 2007-06-04 13:22:39.722816496 +0200
++++ isakmpd-20041012.orig/sysdep/linux/GNUmakefile.sysdep      2007-06-04 13:22:40.001774088 +0200
+@@ -47,6 +47,8 @@
+ USE_LIBCRYPO= defined
+ HAVE_DLOPEN=  defined
+ USE_KEYNOTE=  defined
++USE_OPENSSL_MD5=      defined
++USE_OPENSSL_SHA1=     defined
+ # hack libsysdep.a dependenc
+ ${LIBSYSDEPDIR}/.depend ${LIBSYSDEP}:
diff --git a/net/isakmpd/patches/040-security_fix.patch b/net/isakmpd/patches/040-security_fix.patch
new file mode 100644 (file)
index 0000000..d70a722
--- /dev/null
@@ -0,0 +1,18 @@
+Index: isakmpd-20041012.orig/ipsec.c
+===================================================================
+--- isakmpd-20041012.orig.orig/ipsec.c 2007-06-04 13:22:39.283883224 +0200
++++ isakmpd-20041012.orig/ipsec.c      2007-06-04 13:22:40.247736696 +0200
+@@ -2176,9 +2176,10 @@
+ {
+       struct ipsec_proto *iproto = proto->data;
+-      if (proto->sa->phase == 2 && section)
+-              iproto->replay_window = conf_get_num(section, "ReplayWindow",
+-                  DEFAULT_REPLAY_WINDOW);
++      if (proto->sa->phase == 2)
++              iproto->replay_window = section ? conf_get_num(section,
++                  "ReplayWindow", DEFAULT_REPLAY_WINDOW) :
++                  DEFAULT_REPLAY_WINDOW;
+ }
+ /*
diff --git a/net/isakmpd/patches/050-ar_cross.patch b/net/isakmpd/patches/050-ar_cross.patch
new file mode 100644 (file)
index 0000000..2bac048
--- /dev/null
@@ -0,0 +1,13 @@
+Index: isakmpd-20041012.orig/sysdep/common/libsysdep/GNUmakefile
+===================================================================
+--- isakmpd-20041012.orig.orig/sysdep/common/libsysdep/GNUmakefile     2007-06-04 13:22:40.000774240 +0200
++++ isakmpd-20041012.orig/sysdep/common/libsysdep/GNUmakefile  2007-06-04 13:22:40.431708728 +0200
+@@ -44,7 +44,7 @@
+ endif
+ lib${LIB}.a: ${SRCS:%.c=%.o}
+-      ar cq $@ ${SRCS:%.c=%.o}
++      $(AR) cq $@ ${SRCS:%.c=%.o}
+ clean:
+       rm -f lib${LIB}.a ${SRCS:%.c=%.o}
diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile
new file mode 100644 (file)
index 0000000..5e5471f
--- /dev/null
@@ -0,0 +1,227 @@
+#
+# Copyright (C) 2006-2012 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:=isc-dhcp
+UPSTREAM_NAME:=dhcp
+PKG_VERSION:=4.2.4
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(UPSTREAM_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/$(PKG_VERSION)
+PKG_MD5SUM:=c244cefe663d43100af757d8ff625a1f
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(UPSTREAM_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/isc-dhcp/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=ISC's DHCP
+  URL:=https://www.isc.org/software/dhcp
+endef
+
+define Package/isc-dhcp-relay-ipv4
+  $(call Package/isc-dhcp/Default)
+  TITLE+= relay (without IPv6)
+  VARIANT:=ipv4
+endef
+
+define Package/isc-dhcp-relay-ipv6
+  $(call Package/isc-dhcp/Default)
+  DEPENDS:= @IPV6
+  TITLE+= relay (with IPv6)
+  VARIANT:=ipv6
+endef
+
+define Package/isc-dhcp-relay/description
+ provides a means for relaying DHCP and BOOTP requests from a subnet to which
+ no DHCP server is directly connected to one or more DHCP servers on other
+ subnets.
+endef
+
+define Package/isc-dhcp-relay-ipv4/description
+$(call Package/isc-dhcp-relay-ipv6/description)
+ This package is compiled with IPv4 support only.
+endef
+
+define Package/isc-dhcp-relay-ipv4/conffiles
+/etc/config/dhcrelay
+endef
+
+define Package/isc-dhcp-relay-ipv6/description
+$(call Package/isc-dhcp-relay/description)
+ This package is compiled with IPv4 and IPv6 support.
+endef
+
+define Package/isc-dhcp-relay-ipv6/conffiles
+/etc/config/dhcrelay
+endef
+
+define Package/isc-dhcp-client-ipv4
+  $(call Package/isc-dhcp/Default)
+  TITLE+= client (without IPv6)
+  VARIANT:=ipv4
+endef
+
+define Package/isc-dhcp-client-ipv6
+  $(call Package/isc-dhcp/Default)
+  DEPENDS:= @IPV6
+  TITLE+= client (with IPv6)
+  VARIANT:=ipv6
+endef
+
+define Package/isc-dhcp-client/description
+ provides a means for configuring one or more network interfaces using the
+ Dynamic Host Configuration Protocol, BOOTP protocol, or if these protocols
+ fail, by statically assigning an address.
+endef
+
+define Package/isc-dhcp-client-ipv4/description
+$(call Package/isc-dhcp-client/description)
+ This package is compiled with IPv4 support only.
+endef
+
+define Package/isc-dhcp-client-ipv6/description
+$(call Package/isc-dhcp-client/description)
+ This package is compiled with IPv4 and IPv6 support.
+endef
+
+define Package/isc-dhcp-server-ipv4
+  $(call Package/isc-dhcp/Default)
+  TITLE+= server (without IPv6)
+  VARIANT:=ipv4
+endef
+
+define Package/isc-dhcp-server-ipv6
+  $(call Package/isc-dhcp/Default)
+  DEPENDS:= @IPV6
+  TITLE+= server (with IPv6)
+  VARIANT:=ipv6
+endef
+
+define Package/isc-dhcp-server/description
+ implements the Dynamic Host Configuration Protocol (DHCP) and the Internet
+ Bootstrap Protocol (BOOTP).
+endef
+
+define Package/isc-dhcp-server-ipv4/description
+$(call Package/isc-dhcp-server/description)
+ This package is compiled with IPv4 support only.
+endef
+
+define Package/isc-dhcp-server-ipv6/description
+$(call Package/isc-dhcp-server/description)
+ This package is compiled with IPv4 and IPv6 support.
+endef
+
+define Package/isc-dhcp-omshell-ipv4
+  $(call Package/isc-dhcp/Default)
+  DEPENDS:= +isc-dhcp-server-ipv4
+  TITLE+= omshell (without IPv6)
+  VARIANT:=ipv4
+endef
+
+define Package/isc-dhcp-omshell-ipv6
+  $(call Package/isc-dhcp/Default)
+  DEPENDS:= @IPV6 +isc-dhcp-server-ipv6
+  TITLE+= omshell (with IPv6)
+  VARIANT:=ipv6
+endef
+
+define Package/isc-dhcp-omshell/description
+ provides an interactive way to connect to, query, and possibly change, the ISC
+ DHCP Server's state via OMAPI, the Object Management API.
+endef
+
+define Package/isc-dhcp-omshell-ipv4/description
+$(call Package/isc-dhcp-omshell/description)
+ This package is compiled with IPv4 support only.
+endef
+
+define Package/isc-dhcp-omshell-ipv6/description
+$(call Package/isc-dhcp-omshell/description)
+ This package is compiled with IPv4 and IPv6 support.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-tracing               \
+       --enable-paranoia               \
+       --disable-dependency-tracking   \
+       ac_cv_file__dev_random=yes
+
+ifeq ($(BUILD_VARIANT),ipv4)
+  CONFIGURE_ARGS += --disable-dhcpv6
+endif
+ifeq ($(BUILD_VARIANT),ipv6)
+  CONFIGURE_ARGS += --enable-dhcpv6
+endif
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)                     \
+               DESTDIR="$(PKG_INSTALL_DIR)"            \
+               BUILD_CC="$(HOSTCC_NOCACHE)"            \
+               host_alias="$(GNU_TARGET_NAME)"         \
+               target_alias="$(GNU_TARGET_NAME)"       \
+               build_alias="$(GNU_HOST_NAME)"          \
+               ac_cv_file__dev_random=yes              \
+               all install-exec
+endef
+
+define Package/isc-dhcp-relay-$(BUILD_VARIANT)/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhcrelay $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/etc/config/dhcrelay $(1)/etc/config
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/dhcrelay4.init $(1)/etc/init.d/dhcrelay4
+ifeq ($(BUILD_VARIANT),ipv6)
+       $(INSTALL_BIN) ./files/dhcrelay6.init $(1)/etc/init.d/dhcrelay6
+endif
+endef
+
+define Package/isc-dhcp-server-$(BUILD_VARIANT)/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhcpd $(1)/usr/sbin
+       $(INSTALL_BIN) ./files/dhcpd.init $(1)/etc/init.d/dhcpd
+       $(INSTALL_BIN) ./files/dhcpd.conf $(1)/etc
+ifeq ($(BUILD_VARIANT),ipv6)
+       $(INSTALL_BIN) ./files/dhcpd6.init $(1)/etc/init.d/dhcpd6
+       $(INSTALL_BIN) ./files/dhcpd6.conf $(1)/etc
+endif
+endef
+
+define Package/isc-dhcp-client-$(BUILD_VARIANT)/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhclient $(1)/usr/sbin
+       $(INSTALL_BIN) ./files/dhclient-script $(1)/usr/sbin/
+       $(INSTALL_BIN) ./files/dhclient.init $(1)/etc/init.d/dhclient
+ifeq ($(BUILD_VARIANT),ipv6)
+       $(INSTALL_BIN) ./files/dhclient6.init $(1)/etc/init.d/dhclient6
+       $(INSTALL_BIN) ./files/dhclient6.conf $(1)/etc
+endif
+endef
+
+define Package/isc-dhcp-omshell-$(BUILD_VARIANT)/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/omshell $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,isc-dhcp-relay-ipv4))
+$(eval $(call BuildPackage,isc-dhcp-server-ipv4))
+$(eval $(call BuildPackage,isc-dhcp-client-ipv4))
+$(eval $(call BuildPackage,isc-dhcp-omshell-ipv4))
+$(eval $(call BuildPackage,isc-dhcp-relay-ipv6))
+$(eval $(call BuildPackage,isc-dhcp-server-ipv6))
+$(eval $(call BuildPackage,isc-dhcp-client-ipv6))
+$(eval $(call BuildPackage,isc-dhcp-omshell-ipv6))
diff --git a/net/isc-dhcp/files/dhclient-script b/net/isc-dhcp/files/dhclient-script
new file mode 100644 (file)
index 0000000..4afebc0
--- /dev/null
@@ -0,0 +1,281 @@
+#!/bin/sh
+
+make_resolv_conf() {
+  if [ x"$new_domain_name_servers" != x ]; then
+    cat /dev/null > /etc/resolv.conf.dhclient
+    chmod 644 /etc/resolv.conf.dhclient
+    if [ x"$new_domain_search" != x ]; then
+      echo search $new_domain_search >> /etc/resolv.conf.dhclient
+    elif [ x"$new_domain_name" != x ]; then
+      # Note that the DHCP 'Domain Name Option' is really just a domain
+      # name, and that this practice of using the domain name option as
+      # a search path is both nonstandard and deprecated.
+      echo search $new_domain_name >> /etc/resolv.conf.dhclient
+    fi
+    for nameserver in $new_domain_name_servers; do
+      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
+    done
+
+  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
+    cat /dev/null > /etc/resolv.conf.dhclient6
+    chmod 644 /etc/resolv.conf.dhclient6
+
+    if [ "x${new_dhcp6_domain_search}" != x ] ; then
+      echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
+    fi
+    for nameserver in ${new_dhcp6_name_servers} ; do
+      echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
+    done
+  fi
+
+  # if both v4 and v6 clients are running, concatenate results
+  cat /etc/resolv.conf.* > /etc/resolv.conf
+}
+
+# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
+exit_with_hooks() {
+  exit_status=$1
+  if [ -f /etc/dhclient-exit-hooks ]; then
+    . /etc/dhclient-exit-hooks
+  fi
+# probably should do something with exit status of the local script
+  exit $exit_status
+}
+
+# Invoke the local dhcp client enter hooks, if they exist.
+if [ -f /etc/dhclient-enter-hooks ]; then
+  exit_status=0
+  . /etc/dhclient-enter-hooks
+  # allow the local script to abort processing of this state
+  # local script must set exit_status variable to nonzero.
+  if [ $exit_status -ne 0 ]; then
+    exit $exit_status
+  fi
+fi
+
+###
+### DHCPv4 Handlers
+###
+
+if [ x$new_broadcast_address != x ]; then
+  new_broadcast_arg="broadcast $new_broadcast_address"
+fi
+if [ x$new_subnet_mask != x ]; then
+  new_subnet_arg="netmask $new_subnet_mask"
+fi
+if [ x$alias_subnet_mask != x ]; then
+  alias_subnet_arg="netmask $alias_subnet_mask"
+fi
+
+if [ x$reason = xMEDIUM ]; then
+  # Linux doesn't do mediums (ok, ok, media).
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xPREINIT ]; then
+  if [ x$alias_ip_address != x ]; then
+    # Bring down alias interface. Its routes will disappear too.
+    ifconfig $interface:0- 0.0.0.0
+  fi
+  ifconfig $interface 0.0.0.0 up
+
+  # We need to give the kernel some time to get the interface up.
+  sleep 1
+
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
+  exit_with_hooks 0
+fi
+  
+if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
+   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
+  current_hostname=`hostname`
+  if [ x$current_hostname = x ] || \
+     [ x$current_hostname = x$old_host_name ]; then
+    if [ x$current_hostname = x ] || \
+       [ x$new_host_name != x$old_host_name ]; then
+      hostname $new_host_name
+    fi
+  fi
+    
+  if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
+               [ x$alias_ip_address != x$old_ip_address ]; then
+    # Possible new alias. Remove old alias.
+    ifconfig $interface:0- 0.0.0.0
+  fi
+  if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
+    # IP address changed. Bringing down the interface will delete all routes,
+    # and clear the ARP cache.
+    ifconfig $interface 0.0.0.0 down
+
+  fi
+  if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+     [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+
+    ifconfig $interface $new_ip_address $new_subnet_arg \
+                                                       $new_broadcast_arg
+    for router in $new_routers; do
+      if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+       route add -host $router dev $interface
+      fi
+      route add default gw $router
+    done
+  fi
+  if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
+   then
+    ifconfig $interface:0- 0.0.0.0
+    ifconfig $interface:0 $alias_ip_address $alias_subnet_arg
+    route add -host $alias_ip_address $interface:0
+  fi
+  make_resolv_conf
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
+   || [ x$reason = xSTOP ]; then
+  if [ x$alias_ip_address != x ]; then
+    # Turn off alias interface.
+    ifconfig $interface:0- 0.0.0.0
+  fi
+  if [ x$old_ip_address != x ]; then
+    # Shut down interface, which will delete routes and clear arp cache.
+    ifconfig $interface 0.0.0.0 down
+  fi
+  if [ x$alias_ip_address != x ]; then
+    ifconfig $interface:0 $alias_ip_address $alias_subnet_arg
+    route add -host $alias_ip_address $interface:0
+  fi
+
+  # remove v4 dns configuration for this interface
+  rm /etc/resolv.conf.dhclient
+  cat /etc/resolv.conf.* > /etc/resolv.conf
+
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xTIMEOUT ]; then
+  if [ x$alias_ip_address != x ]; then
+    ifconfig $interface:0- 0.0.0.0
+  fi
+  ifconfig $interface $new_ip_address $new_subnet_arg \
+                                       $new_broadcast_arg
+  set $new_routers
+  if ping -q -c 1 $1; then
+    if [ x$new_ip_address != x$alias_ip_address ] && \
+                       [ x$alias_ip_address != x ]; then
+      ifconfig $interface:0 $alias_ip_address $alias_subnet_arg
+      route add -host $alias_ip_address dev $interface:0
+    fi
+    for router in $new_routers; do
+      if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+       route add -host $router dev $interface
+      fi
+      route add default gw $router
+    done
+    make_resolv_conf
+    exit_with_hooks 0
+  fi
+  ifconfig $interface 0.0.0.0 down
+  exit_with_hooks 1
+fi
+
+###
+### DHCPv6 Handlers
+###
+
+if [ x$reason = xPREINIT6 ]; then
+  # Ensure interface is up.
+  ifconfig ${interface} up
+
+  # Remove any stale addresses from aborted clients.
+  ip -f inet6 addr flush dev ${interface} scope global
+
+  exit_with_hooks 0
+fi
+
+if [ x${old_ip6_prefix} != x ] || [ x${new_ip6_prefix} != x ] ; then
+    echo Prefix ${reason} old=${old_ip6_prefix} new=${new_ip6_prefix}
+
+    exit_with_hooks 0
+fi
+
+if [ x$reason = xBOUND6 ]; then
+  if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
+    exit_with_hooks 2;
+  fi
+
+  ifconfig ${interface} add ${new_ip6_address}/${new_ip6_prefixlen}
+
+  # Check for nameserver options.
+  make_resolv_conf
+
+### <<
+  # Set up softwire tunnel
+  if [ x${new_dhcp6_softwire} != x ] ; then
+    /etc/init.d/dhclient stop
+    ifconfig ${interface} 0.0.0.0
+    ip -6 tunnel add tun0 mode ipip6 \
+       remote ${new_dhcp6_softwire} \
+       local ${new_ip6_address} \
+       dev ${interface} encaplimit none
+    ip link set tun0 up
+    ip route add default dev tun0
+  fi
+### >>
+
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xRENEW6 ] || [ x$reason = xREBIND6 ]; then
+  if [ x${new_ip6_address} = x ] || [ x${new_ip6_prefixlen} = x ] ; then
+    exit_with_hooks 2;
+  fi
+
+  ifconfig ${interface} add ${new_ip6_address}/${new_ip6_prefixlen}
+
+  # Make sure nothing has moved around on us.
+
+  # Nameservers/domains/etc.
+  if [ "x${new_dhcp6_name_servers}" != "x${old_dhcp6_name_servers}" ] ||
+     [ "x${new_dhcp6_domain_search}" != "x${old_dhcp6_domain_search}" ] ; then
+    make_resolv_conf
+  fi
+
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xDEPREF6 ]; then
+  if [ x${new_ip6_address} = x ] ; then
+    exit_with_hooks 2;
+  fi
+
+  # Busybox ifconfig has no way to communicate this to the kernel, so ignore it
+
+  exit_with_hooks 0
+fi
+
+if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ]; then
+  if [ x${old_ip6_address} = x ] || [ x${old_ip6_prefixlen} = x ] ; then
+    exit_with_hooks 2;
+  fi
+
+  ifconfig ${interface} del ${old_ip6_address}/${old_ip6_prefixlen}
+
+  # remove v6 dns configuration for this interface
+  rm /etc/resolv.conf.dhclient6
+  cat /etc/resolv.conf.* > /etc/resolv.conf
+
+### <<
+  # Tear down softwire tunnel
+  if [ x${old_dhcp6_softwire} != x ] ; then
+    ip link set tun0 down
+    ip tunnel del tun0
+  fi
+### >>
+
+  exit_with_hooks 0
+fi
+
+exit_with_hooks 0
diff --git a/net/isc-dhcp/files/dhclient.init b/net/isc-dhcp/files/dhclient.init
new file mode 100644 (file)
index 0000000..b5ffb41
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+
+START=60
+
+lease_file=/var/dhclient.leases
+config_file=/etc/dhclient.conf
+pid_file=/var/run/dhclient.pid
+script_file=/usr/sbin/dhclient-script
+
+start() {
+       /usr/sbin/dhclient -q -nw -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname`
+       
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+}
+
+stop() {
+       if [ ! -e $pid_file ]; then
+               return 1
+       fi
+
+       kill -9 `cat $pid_file`
+
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+
+       rm $pid_file
+}
diff --git a/net/isc-dhcp/files/dhclient6.conf b/net/isc-dhcp/files/dhclient6.conf
new file mode 100644 (file)
index 0000000..ab44699
--- /dev/null
@@ -0,0 +1,2 @@
+option dhcp6.softwire code 54 = ip6-address;
+also request dhcp6.softwire;
diff --git a/net/isc-dhcp/files/dhclient6.init b/net/isc-dhcp/files/dhclient6.init
new file mode 100644 (file)
index 0000000..630c3f2
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+
+START=60
+
+lease_file=/var/dhclient6.leases
+config_file=/etc/dhclient6.conf
+pid_file=/var/run/dhclient6.pid
+script_file=/usr/sbin/dhclient-script
+
+start() {
+       /usr/sbin/dhclient -q -nw -6 -cf $config_file -lf $lease_file -pf $pid_file -sf $script_file `/sbin/uci get network.wan.ifname`
+       
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+}
+
+stop() {
+       if [ ! -e $pid_file ]; then
+               return 1
+       fi
+
+       kill -9 `cat $pid_file`
+
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+       
+       rm $pid_file
+}
diff --git a/net/isc-dhcp/files/dhcpd.conf b/net/isc-dhcp/files/dhcpd.conf
new file mode 100644 (file)
index 0000000..11985ce
--- /dev/null
@@ -0,0 +1,13 @@
+# dhcpd.conf
+
+authoritative;
+
+default-lease-time 3600;
+max-lease-time 86400;
+
+option domain-name-servers 192.168.1.1;
+
+subnet 192.168.1.0 netmask 255.255.255.0 {
+  range 192.168.1.10 192.168.1.50;
+  option routers 192.168.1.1;
+}
diff --git a/net/isc-dhcp/files/dhcpd.init b/net/isc-dhcp/files/dhcpd.init
new file mode 100644 (file)
index 0000000..16ef6ae
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+
+lease_file=/var/dhcpd.leases
+config_file=/etc/dhcpd.conf
+pid_file=/var/run/dhcpd.pid
+
+start() {
+       if [ ! -e $lease_file ]; then
+               touch $lease_file
+       fi
+
+       /usr/sbin/dhcpd -q -cf $config_file -lf $lease_file -pf $pid_file $dhcp_ifs
+
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+}
+
+stop() {
+       if [ ! -e $pid_file ]; then
+               return 1
+       fi
+
+       kill -9 `cat $pid_file`
+
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+
+       rm $pid_file
+}
diff --git a/net/isc-dhcp/files/dhcpd6.conf b/net/isc-dhcp/files/dhcpd6.conf
new file mode 100644 (file)
index 0000000..1c0baae
--- /dev/null
@@ -0,0 +1,30 @@
+# dhcpd6.conf
+
+authoritative;
+
+default-lease-time 3600;
+max-lease-time 86400;
+
+# Enable RFC 5007 support
+#allow leasequery;
+
+# Global definitions for name server address(es) and domain search list
+#option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;
+#option dhcp6.domain-search "test.example.com","example.com";
+
+# Set preference to 255 (maximum) in order to avoid waiting for
+# additional servers when there is only one
+#option dhcp6.preference 255;
+
+# Server side command to enable rapid-commit (2 packet exchange)
+#option dhcp6.rapid-commit;
+
+# The delay before information-request refresh
+#  (minimum is 10 minutes, maximum one day, default is to not refresh)
+#  (set to 6 hours)
+#option dhcp6.info-refresh-time 3600;
+
+subnet6 3ffe:501:ffff:101::/64 {
+       # Use the whole /64 prefix for clients
+       range6 3ffe:501:ffff:101:: /64;
+}
diff --git a/net/isc-dhcp/files/dhcpd6.init b/net/isc-dhcp/files/dhcpd6.init
new file mode 100644 (file)
index 0000000..e38e38b
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+
+lease_file=/var/dhcpd6.leases
+config_file=/etc/dhcpd6.conf
+pid_file=/var/run/dhcpd6.pid
+
+start() {
+       if [ ! -e $lease_file ]; then
+               touch $lease_file
+       fi
+
+       /usr/sbin/dhcpd -q -6 -cf $config_file -lf $lease_file -pf $pid_file $dhcp_ifs
+
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+}
+
+stop() {
+       if [ ! -e $pid_file ]; then
+               return 1
+       fi
+
+       kill -9 `cat $pid_file`
+
+       if [ $? -ne 0 ]; then
+               return 1
+       fi
+
+       rm $pid_file
+}
diff --git a/net/isc-dhcp/files/dhcrelay4.init b/net/isc-dhcp/files/dhcrelay4.init
new file mode 100644 (file)
index 0000000..9af0f84
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+
+START=91
+
+SERVICE_SIG="KILL"
+SERVICE_PID_FILE="/var/run/dhcrelay4.pid"
+SERVICE_USE_PID=1
+
+start() {
+       . /lib/functions/network.sh
+       config_load dhcrelay
+       local args=""
+
+       local enabled
+       config_get_bool enabled ipv4 enabled 0
+       [ "$enabled" -eq 0 ] && return 0
+
+       # listen interfaces
+       local interfaces
+       local ifname
+       config_get interfaces ipv4 interfaces
+       for net in $interfaces; do
+               if network_get_device ifname "$net"; then
+                       append args "-i $ifname"
+               fi
+       done
+
+       # link selection sub-option (RFC3527)
+       local link_selection
+       config_get link_selection ipv4 link_selection
+       if network_get_device ifname "$link_selection"; then
+               append args "-l $ifname"
+       fi
+
+       # relay mode
+       local relay_mode
+       config_get relay_mode ipv4 relay_mode
+       [ -n "$relay_mode" ] && append args "-m $relay_mode"
+
+       # dhcp server address
+       local server
+       config_get server ipv4 dhcpserver
+       [ -n "$server" ] || return 0
+       append args "$server"
+
+       service_start /usr/sbin/dhcrelay -4 -q \
+               -pf $SERVICE_PID_FILE $args
+}
+
+stop() {
+       service_stop /usr/sbin/dhcrelay
+}
diff --git a/net/isc-dhcp/files/dhcrelay6.init b/net/isc-dhcp/files/dhcrelay6.init
new file mode 100644 (file)
index 0000000..0c6f756
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+
+START=91
+
+SERVICE_SIG="KILL"
+SERVICE_PID_FILE="/var/run/dhcrelay6.pid"
+SERVICE_USE_PID=1
+
+start() {
+    local relay_dhcpserver
+    local relay_upper
+    local relay_lowers
+    local relay_lower_args
+
+    config_load dhcrelay
+    config_get relay_dhcpserver ipv6 dhcpserver
+    config_get relay_upper ipv6 upper
+    config_get relay_lowers ipv6 lower
+
+    # If a specific DHCP server is specified,
+    # add it to the upper interface.
+    if [ -n "$relay_dhcpserver" ]; then
+        relay_upper="${relay_dhcpserver}%$relay_upper"
+    fi
+
+    # Add all lower interfaces at the end.
+    if [ -n "$relay_lowers" ]; then
+        local relay_lower
+        for relay_lower in $relay_lowers; do
+            append relay_lower_args "-l $relay_lower"
+        done
+    fi
+
+    service_start /usr/sbin/dhcrelay -6 -q \
+        -pf $SERVICE_PID_FILE \
+        -u $relay_upper $relay_lower_args
+}
+
+stop() {
+    service_stop /usr/sbin/dhcrelay
+}
diff --git a/net/isc-dhcp/files/etc/config/dhcrelay b/net/isc-dhcp/files/etc/config/dhcrelay
new file mode 100644 (file)
index 0000000..b3b53b5
--- /dev/null
@@ -0,0 +1,27 @@
+
+config dhcrelay ipv4
+       option 'enabled' '0'
+
+       # IP address of the server
+       option 'dhcpserver' '192.0.2.10'
+
+       # network interfaces to listen on (e.g. lan or wan)
+       option 'interfaces' ''
+
+       # What to do about packets that already have a relay option:
+       # 'append': Forward and append our own relay option
+       # 'replace': Forward, but replace theirs with ours (default)
+       # 'forward': Forward without changes
+       # 'discard': Don't forward
+       option 'relay_mode' ''
+
+       # enable RFC3527 link selection sub-option and use the IP address of
+       # the specified network interface as "uplink" IP address (e.g. wan)
+       option 'link_selection' ''
+
+config dhcrelay ipv6
+#      option dhcpserver '2001:db8:1::1'
+       option upper 'eth1'
+       list lower 'eth0.2'
+       list lower 'eth0.3'
+
diff --git a/net/isc-dhcp/patches/000-compile.patch b/net/isc-dhcp/patches/000-compile.patch
new file mode 100644 (file)
index 0000000..7f96ce0
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/bind/Makefile
++++ b/bind/Makefile
+@@ -61,9 +61,12 @@ all:
+               echo Bind export libraries already installed ;               \
+       else                                                                 \
+               echo Building BIND Export libraries - this takes some time. ;\
++              (cd ${bindsrcdir}/lib/export/dns ;                           \
++                echo building gen using ${BUILD_CC} in `pwd` ;             \
++                $(MAKE) CC=${BUILD_CC} CFLAGS="-O2" LIBS="" gen) ;         \
+               (cd ${bindsrcdir}/lib/export ;                               \
+                 echo building in `pwd` ;                                   \
+-                MAKE=${GMAKE} ${GMAKE} > ${binddir}/build.log) ;           \
++                $(MAKE) DESTDIR="" install > ${binddir}/build.log) ;       \
+                                                                              \
+               echo Installing BIND Export libraries to ${binddir}. ;       \
+               (cd ${bindsrcdir}/lib/export ;                               \
+@@ -77,6 +80,7 @@ clean:
+ # Include the following so that this Makefile is happy when the parent
+ # tries to use them.
++install-exec:
+ distdir:
diff --git a/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch b/net/isc-dhcp/patches/100-relay-rfc3527-link-selection.patch
new file mode 100644 (file)
index 0000000..1f593ee
--- /dev/null
@@ -0,0 +1,100 @@
+--- a/relay/dhcrelay.c
++++ b/relay/dhcrelay.c
+@@ -65,6 +65,7 @@ int server_packets_relayed = 0;      /* Packe
+ int client_packet_errors = 0; /* Errors sending packets to clients. */
+ int add_agent_options = 0;    /* If nonzero, add relay agent options. */
++int add_rfc3527_suboption = 0;        /* If nonzero, add RFC3527 link selection sub-option. */
+ int agent_option_errors = 0;    /* Number of packets forwarded without
+                                  agent options because there was no room. */
+@@ -104,6 +105,8 @@ struct server_list {
+       struct sockaddr_in to;
+ } *servers;
++struct interface_info *uplink;
++
+ #ifdef DHCPv6
+ struct stream_list {
+       struct stream_list *next;
+@@ -144,6 +147,7 @@ static const char url[] =
+ "                     [-pf <pid-file>] [--no-pid]\n"\
+ "                     [-m append|replace|forward|discard]\n" \
+ "                     [-i interface0 [ ... -i interfaceN]\n" \
++"                     [-l interface]\n" \
+ "                     server0 [ ... serverN]\n\n" \
+ "       dhcrelay -6   [-d] [-q] [-I] [-c <hops>] [-p <port>]\n" \
+ "                     [-pf <pid-file>] [--no-pid]\n"\
+@@ -157,6 +161,7 @@ static const char url[] =
+ "                [-pf <pid-file>] [--no-pid]\n"\
+ "                [-m append|replace|forward|discard]\n" \
+ "                [-i interface0 [ ... -i interfaceN]\n" \
++"                [-l interface]\n" \
+ "                server0 [ ... serverN]\n\n"
+ #endif
+@@ -314,6 +319,20 @@ main(int argc, char **argv) {
+                               agent_relay_mode = discard;
+                       } else
+                               usage();
++              } else if (!strcmp (argv [i], "-l")) {
++                      add_agent_options = 1;
++                      add_rfc3527_suboption = 1;
++                      if (++i == argc)
++                              usage();
++
++                      status = interface_allocate(&uplink, MDL);
++                      if (status != ISC_R_SUCCESS)
++                              log_fatal("%s: interface_allocate: %s",
++                                        argv[i],
++                                        isc_result_totext(status));
++                      strcpy(uplink->name, argv[i]);
++                      interface_snorf(uplink, INTERFACE_REQUESTED);
++                      //interface_dereference(&uplink, MDL);
+               } else if (!strcmp(argv[i], "-D")) {
+ #ifdef DHCPv6
+                       if (local_family_set && (local_family == AF_INET6)) {
+@@ -685,12 +704,17 @@ do_relay4(struct interface_info *ip, str
+                                              ip->addresses[0])))
+               return;
++      /* RFC3527: Replace giaddr address by uplink address. The original
++       * giaddr will be used in the link selection sub-option */
++      if (add_rfc3527_suboption)
++              packet->giaddr = uplink->addresses[0];
++
+       /* If giaddr is not already set, Set it so the server can
+          figure out what net it's from and so that we can later
+          forward the response to the correct net.    If it's already
+          set, the response will be sent directly to the relay agent
+          that set giaddr, so we won't see it. */
+-      if (!packet->giaddr.s_addr)
++      else if (!packet->giaddr.s_addr)
+               packet->giaddr = ip->addresses[0];
+       if (packet->hops < max_hop_count)
+               packet->hops = packet->hops + 1;
+@@ -1062,6 +1086,9 @@ add_relay_agent_options(struct interface
+               optlen += ip->remote_id_len + 2;    /* RAI_REMOTE_ID + len */
+       }
++      if (add_rfc3527_suboption)
++              optlen += 6;
++
+       /* We do not support relay option fragmenting(multiple options to
+        * support an option data exceeding 255 bytes).
+        */
+@@ -1093,6 +1120,14 @@ add_relay_agent_options(struct interface
+                       memcpy(sp, ip->remote_id, ip->remote_id_len);
+                       sp += ip->remote_id_len;
+               }
++
++              if (add_rfc3527_suboption) {
++                      *sp++ = RAI_LINK_SELECT;
++                      *sp++ = 4u;
++                      memcpy(sp, &giaddr.s_addr, 4);
++                      sp += 4;
++                      log_debug ("RFC3527 link selection sub-option added: %s", inet_ntoa(giaddr));
++              }
+       } else {
+               ++agent_option_errors;
+               log_error("No room in packet (used %d of %d) "
diff --git a/net/jtg/Makefile b/net/jtg/Makefile
new file mode 100644 (file)
index 0000000..d156f78
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006-2014 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:=jtg
+PKG_VERSION:=1.95
+PKG_RELEASE:=2
+PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.netlab.tkk.fi/~jmanner/jtg
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/jtg
+  TITLE:=Jugi's Traffic Generator
+  SECTION:=net
+  CATEGORY:=Network
+  MAINTAINER:=Roberto Riggio <roberto.riggio@create-net.org>
+  URL:=https://hoslab.cs.helsinki.fi/savane/projects/jtg/
+endef
+
+define Package/jtg/Description
+       The JTG generator is a simple, yet powerful and, if required, accurate
+       traffic generator. jtg differs from other traffic generators in that one
+       instance of a jtg process only sends one stream (e.g. MGEN can send tens
+       of streams) and the characteristics of the stream are given only with
+       command line arguments. On the other hand, a receiving jtg process can
+       be set to loop and receive several streams but, again, only one at a
+       time. The received packets can be logged and the log files can be
+       analyzed with jtg_calc (see later in this file for instructions). jtg6
+       is the binary for IPv6 networks.
+endef
+
+MAKE_VARS += \
+       CFLAGS="$(TARGET_CFLAGS) -DLinuxTCP"
+
+define Package/jtg/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/jtg $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,jtg))
diff --git a/net/jtg/patches/001-Makefile_honor_CFLAGS_for_VFP.patch b/net/jtg/patches/001-Makefile_honor_CFLAGS_for_VFP.patch
new file mode 100644 (file)
index 0000000..11e4d6c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -2,7 +2,7 @@ BINDIR= $(HOME)/bin
+ VERSION=1.95
+ CC = gcc
+-CFLAGS= -O3 -Wall -Winline -pedantic
++CFLAGS+= -O3 -Wall -Winline -pedantic
+ CFLAGS+= -g
+ # The "-DLinuxTCP" controls which TCP options are in use
diff --git a/net/karma/Makefile b/net/karma/Makefile
new file mode 100644 (file)
index 0000000..ad8f05d
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2007-2009 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:=karma
+PKG_VERSION:=20060124
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://theta44.org/software/
+PKG_MD5SUM:=e9d4ccbda89b4b1cd70eefb1db339d0a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/karma
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=wireless
+  DEPENDS:=+kmod-madwifi +ruby +libpcap +libncurses
+  TITLE:=set of tools for assessing the security of wireless clients
+  URL:=http://theta44.org/karma/index.html
+endef
+
+define Package/karma/description
+  KARMA is a set of tools for assessing the security of wireless clients
+  at multiple layers. Wireless sniffing tools discover clients and their
+  preferred/trusted networks by passively listening for 802.11 Probe Request
+  frames.
+endef
+
+define Package/karma/conffiles
+/etc/karma-lan.xml
+/etc/karma-scan.xml
+/etc/karma.xml
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src/ \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDLIBS="$(TARGET_LDFLAGS) -lpcap -lncurses"
+endef
+
+define Package/karma/install   
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/karma $(1)/usr/sbin/karma-ruby
+       $(CP) $(PKG_BUILD_DIR)/src/karma $(1)/usr/sbin/karma
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/etc/* $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,karma))
diff --git a/net/keepalived/Makefile b/net/keepalived/Makefile
new file mode 100644 (file)
index 0000000..3a0e430
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# 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:=keepalived
+PKG_VERSION:=1.1.19
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= http://www.keepalived.org/software
+PKG_MD5SUM:=a35b8d9d462810f7650d292bd7457523
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/keepalived
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Failover and monitoring daemon for LVS clusters
+  URL:=http://www.keepalived.org/
+  DEPENDS:=+libpopt +libopenssl
+endef
+
+define Package/keepalived/description
+ Failover and monitoring daemon for Linux Virtual Server (LVS) clusters.
+endef
+
+define Package/keepalived/conffiles
+/etc/keepalived/keepalived.conf
+endef
+
+acvar=$(subst -,_,$(subst .,_,$(subst /,_,$(1))))
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --disable-static \
+       --disable-debug \
+       --disable-strip \
+       --disable-lvs \
+       --disable-lvs-syncd \
+       --with-kernel-dir="$(LINUX_DIR)/$(LINUX_UAPI_DIR)"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               STRIP="/bin/true" \
+               all install
+endef
+
+define Package/keepalived/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/keepalived $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/genhash $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/keepalived
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/keepalived/keepalived.conf $(1)/etc/keepalived/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/keepalived.init $(1)/etc/init.d/keepalived
+endef
+
+$(eval $(call BuildPackage,keepalived))
diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init
new file mode 100644 (file)
index 0000000..2807f92
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2011 OpenWrt.org
+
+START=70
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/keepalived
+}
+
+stop() {
+       service_stop /usr/sbin/keepalived
+}
diff --git a/net/kismet/Makefile b/net/kismet/Makefile
new file mode 100644 (file)
index 0000000..c051b67
--- /dev/null
@@ -0,0 +1,125 @@
+#
+# Copyright (C) 2006-2010 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:=kismet
+PKG_VERSION:=2010-07-R1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.kismetwireless.net/code
+PKG_MD5SUM:=85e59186eb529889118b5635f35cf57d
+
+PKG_BUILD_DEPENDS:=libpcap libncurses libpcre
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/kismet/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Kismet
+  DEPENDS:= $(CXX_DEPENDS) +libnl
+  URL:=http://www.kismetwireless.net/
+  SUBMENU:=wireless
+endef
+
+define Package/kismet/Default/description
+ An 802.11 layer2 wireless network detector, sniffer, and intrusion
+ detection system.
+endef
+
+define Package/kismet-client
+$(call Package/kismet/Default)
+  TITLE+= client
+  DEPENDS+= +libncurses
+endef
+
+define Package/kismet-client/conffiles
+/etc/kismet/kismet.conf
+endef
+
+define Package/kismet-client/description
+$(call Package/kismet/Default/description)
+ This package contains the kismet text interface client.
+endef
+
+define Package/kismet-drone
+$(call Package/kismet/Default)
+  DEPENDS+= +libpcap +libpcre +libcap
+  TITLE+= drone
+endef
+
+define Package/kismet-drone/conffiles
+/etc/kismet/kismet_drone.conf
+endef
+
+define Package/kismet-drone/description
+$(call Package/kismet/Default/description)
+ This package contains the kismet remote sniffing.and monitoring drone.
+endef
+
+define Package/kismet-server
+$(call Package/kismet/Default)
+  DEPENDS+= +libpcap +libpcre +libcap
+  TITLE+= server
+endef
+
+define Package/kismet-server/conffiles
+/etc/kismet/kismet.conf
+endef
+
+define Package/kismet-server/description
+$(call Package/kismet/Default/description)
+ This package contains the kismet server.
+endef
+
+CONFIGURE_ARGS += \
+       --sysconfdir=/etc/kismet \
+
+CONFIGURE_VARS += \
+       CXXFLAGS="$$$$CXXFLAGS -fno-rtti"  \
+       LIBS="-lm" \
+       CLIENTCLIBS="-lm"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               LD="$(TARGET_CXX)" \
+               all
+endef
+
+#FIXME: remove this package?
+define Package/kismet/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/kismet $(1)/usr/bin/kismet
+endef
+
+define Package/kismet-client/install
+       $(INSTALL_DIR) $(1)/etc/kismet/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet.conf $(1)/etc/kismet/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_client $(1)/usr/bin/
+endef
+
+define Package/kismet-drone/install
+       $(INSTALL_DIR) $(1)/etc/kismet/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet_drone.conf $(1)/etc/kismet/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_drone $(1)/usr/bin/
+endef
+
+define Package/kismet-server/install
+       $(INSTALL_DIR) $(1)/etc/kismet/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/kismet.conf $(1)/etc/kismet/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kismet_server $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,kismet-client))
+$(eval $(call BuildPackage,kismet-drone))
+$(eval $(call BuildPackage,kismet-server))
diff --git a/net/kismet/files/ap_manuf b/net/kismet/files/ap_manuf
new file mode 100644 (file)
index 0000000..c77edfa
--- /dev/null
@@ -0,0 +1,240 @@
+00:00:0C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:00:74:00:00:00/FF:FF:FF:00:00:00    Ricoh   Unknown 0
+00:00:92:00:00:00/FF:FF:FF:00:00:00    Cogent  Unknown 0
+00:00:AA:00:00:00/FF:FF:FF:00:00:00    Xerox   Unknown 0
+00:00:C5:00:00:00/FF:FF:FF:00:00:00    FarallonCo      Unknown 0
+00:00:CE:00:00:00/FF:FF:FF:00:00:00    Megadata        Unknown 0
+00:00:DE:00:00:00/FF:FF:FF:00:00:00    Unigraph        Unknown 0
+00:01:03:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:01:24:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown default 6       192.168.2.1
+00:01:24:24:00:00/FF:FF:FF:FF:00:00    SMC     SMC7004AWBR     default 6       192.168.2.1
+00:01:38:00:00:00/FF:FF:FF:00:00:00    XaviTechno      Unknown 0
+00:01:95:00:00:00/FF:FF:FF:00:00:00    Sena    Unknown 0
+00:01:E6:00:00:00/FF:FF:FF:00:00:00    Hewlett-Pa      Unknown 0
+00:01:F4:00:00:00/FF:FF:FF:00:00:00    EnterasysN      Unknown 0
+00:02:2D:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:02:44:00:00:00/FF:FF:FF:00:00:00    Surecom Unknown 0
+00:02:6F:00:00:00/FF:FF:FF:00:00:00    Senao   Unknown         0       
+00:02:72:00:00:00/FF:FF:FF:00:00:00    Cc&C    Unknown 0
+00:02:8A:00:00:00/FF:FF:FF:00:00:00    AmbitMicro      Unknown 0
+00:02:A5:00:00:00/FF:FF:FF:00:00:00    Compaq  Unknown         0       
+00:02:B3:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:03:0A:00:00:00/FF:FF:FF:00:00:00    Argus   Unknown 0
+00:03:2F:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown         0       
+00:03:52:00:00:00/FF:FF:FF:00:00:00    Colubris        Unknown 0
+00:03:93:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:04:23:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:04:3A:3A:00:00/FF:FF:FF:FF:00:00    Avaya   ad-01444                0       
+00:04:5A:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:04:5A:0E:00:00/FF:FF:FF:FF:00:00    Linksys WAP11   linksys 6       192.168.1.1
+00:04:5A:2E:00:00/FF:FF:FF:FF:00:00    Linksys BEFW11S4        linksys 6       192.168.1.1
+00:04:5A:5A:00:00/FF:FF:FF:FF:00:00    Linksys BEFW11S4        linksys 6       192.168.1.1
+00:04:75:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:04:75:75:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE20096A AP2000 Version 1    3Com    0       169.254.0.1
+00:04:76:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown 0
+00:04:DB:00:00:00/FF:FF:FF:00:00:00    TellusGrou      Unknown 0
+00:04:E2:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown         0       
+00:04:E2:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown SMC     6       192.168.2.1
+00:04:E2:E2:00:00/FF:FF:FF:FF:00:00    SMC     7004AWBR        default 6       192.168.2.1
+00:05:3C:00:00:00/FF:FF:FF:00:00:00    Xircom  Unknown 0
+00:05:4E:00:00:00/FF:FF:FF:00:00:00    PhilipsCom      Unknown 0
+00:05:5D:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-1000AP      default 6       
+00:05:87:00:00:00/FF:FF:FF:00:00:00    Locus   Unknown 0
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys-g       6       192.168.1.1
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys BEFW11S4 v2     linksys 6       192.168.1.1
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WET11   linksys 6       192.168.1.225
+00:06:B1:00:00:00/FF:FF:FF:00:00:00    Sonicwall       Unknown 0
+00:07:0E:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:07:13:00:00:00/FF:FF:FF:00:00:00    IpOne   Unknown 0
+00:07:40:00:00:00/FF:FF:FF:00:00:00    Melco   Unknown 0
+00:07:50:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:07:85:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:07:EB:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:08:21:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:08:A1:00:00:00/FF:FF:FF:00:00:00    CnetTechno      Unknown 0
+00:09:43:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown Wireless        11  192.168.0.2
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:09:7C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:92:92:00:00/FF:FF:FF:FF:00:00    Sweex   LC000010        wireless        11      192.168.0.1
+00:09:B7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:09:E8:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:04:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0A:41:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:8A:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:8A:8A:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-AP1200              0       
+00:0A:95:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:0A:B7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0A:E9:00:00:00/FF:FF:FF:00:00:00    Airvast Unknown 0
+00:0B:5F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0B:6B:00:00:00/FF:FF:FF:00:00:00    WistronNew      Unknown 0
+00:0B:6C:00:00:00/FF:FF:FF:00:00:00    Sychip  Unknown 0
+00:0B:7D:00:00:00/FF:FF:FF:00:00:00    SolomonExt      Unknown 0
+00:0B:85:00:00:00/FF:FF:FF:00:00:00    Airespace       Unknown 0
+00:0B:86:00:00:00/FF:FF:FF:00:00:00    Aruba   Unknown 0
+00:0B:AC:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0B:BE:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0B:CD:00:00:00/FF:FF:FF:00:00:00    CompaqHp        Unknown 0
+00:0B:FD:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:30:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:41:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:0C:85:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:CE:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:E5:00:00:00/FF:FF:FF:00:00:00    MotorolaBc      Unknown 0
+00:0C:F1:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:0D:0B:00:00:00/FF:FF:FF:00:00:00    Melco   Unknown 0
+00:0D:14:00:00:00/FF:FF:FF:00:00:00    VtechInnov      Unknown 0
+00:0D:28:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:29:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:3A:00:00:00/FF:FF:FF:00:00:00    Microsoft       Unknown 0
+00:0D:54:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0D:65:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:72:00:00:00/FF:FF:FF:00:00:00    2wire   Unknown 0
+00:0D:88:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       192.168.0.1
+00:0D:93:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:0D:97:00:00:00/FF:FF:FF:00:00:00    Tropos  Unknown 0
+00:0D:9D:00:00:00/FF:FF:FF:00:00:00    HewlettPac      Unknown 0
+00:0D:BD:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:ED:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:35:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:0E:38:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:3B:00:00:00/FF:FF:FF:00:00:00    HawkingTec      Unknown 0
+00:0E:58:00:00:00/FF:FF:FF:00:00:00    RinconNetw      Unknown 0
+00:0E:6A:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0E:7F:00:00:00/FF:FF:FF:00:00:00    HewlettPac      Unknown 0
+00:0E:83:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:84:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:9B:00:00:00/FF:FF:FF:00:00:00    Private Unknown 0
+00:0E:A6:00:00:00/FF:FF:FF:00:00:00    AsustekCom      Unknown 0
+00:0E:D7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:23:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:24:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:34:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:3D:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       192.168.0.1
+00:0F:66:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:0F:8F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:90:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:B5:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:0F:EA:00:00:00/FF:FF:FF:00:00:00    GigaByte        Unknown 0
+00:0F:F7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:F8:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:10:C6:00:00:00/FF:FF:FF:00:00:00    Usi     Unknown 0
+00:10:E7:00:00:00/FF:FF:FF:00:00:00    Breezecom       Unknown 0
+00:11:09:00:00:00/FF:FF:FF:00:00:00    Micro-Star      Unknown 0
+00:11:0A:00:00:00/FF:FF:FF:00:00:00    HewlettPac      Unknown 0
+00:11:20:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:21:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:24:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:11:2F:00:00:00/FF:FF:FF:00:00:00    AsustekCom      Unknown 0
+00:11:50:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown 0
+00:17:3F:00:00:00/FF:FF:FF:00:00:00    Belkin54g       Unknown 0
+00:11:5C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:88:00:00:00/FF:FF:FF:00:00:00    Enterasys       Unknown 0
+00:11:92:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:93:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:95:00:00:00/FF:FF:FF:00:00:00    AlphaNetwo      Unknown 0
+00:11:BB:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:D8:00:00:00/FF:FF:FF:00:00:00    AsustekCom      Unknown 0
+00:11:F5:00:00:00/FF:FF:FF:00:00:00    Askey   Unknown 0
+00:12:00:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:01:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:17:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:12:25:00:00:00/FF:FF:FF:00:00:00    MotorolaBc      Unknown 0
+00:12:43:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:7F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:80:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:88:00:00:00/FF:FF:FF:00:00:00    2wire   Unknown 0
+00:12:D9:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:DA:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:F0:00:00:00/FF:FF:FF:00:00:00    IntelCorpo      Unknown 0
+00:13:10:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:13:19:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:1A:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:46:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown 0
+00:13:60:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:7F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:80:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:C4:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:20:00:00:00:00/FF:FF:FF:00:00:00    LexmarkInt      Unknown 0
+00:20:A6:00:00:00/FF:FF:FF:00:00:00    Proxim  Unknown 0
+00:20:D8:00:00:00/FF:FF:FF:00:00:00    Nortel  Unknown 0
+00:20:E0:00:00:00/FF:FF:FF:00:00:00    Actiontec       Unknown 0
+00:30:1A:00:00:00/FF:FF:FF:00:00:00    Smartbridge     Unknown 0
+00:30:65:00:00:00/FF:FF:FF:00:00:00    Apple   Unknown         0       
+00:30:65:65:00:00/FF:FF:FF:FF:00:00    Apple   Snow Base Station               1       
+00:30:6E:00:00:00/FF:FF:FF:00:00:00    HP      Unknown 0
+00:30:AB:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MR314NA Wireless        1       192.168.0.1
+00:18:4D:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown         0       
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown WLAN    11      0.0.0.0
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown belkin54g       11  0.0.0.0
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6230-3               0       
+00:30:F1:00:00:00/FF:FF:FF:00:00:00    AcctonTech      Unknown 0
+00:40:01:00:00:00/FF:FF:FF:00:00:00    Zyxel   Unknown 0
+00:40:05:00:00:00/FF:FF:FF:00:00:00    ANI     Unknown default 6       192.168.0.1
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DI-614+ default 6       192.168.0.1
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-900AP+      default 6       192.168.0.50
+00:40:26:00:00:00/FF:FF:FF:00:00:00    Buffalo Unknown         0       
+00:40:26:26:00:00/FF:FF:FF:FF:00:00    Buffalo WLAR-L11G-L             0       
+00:40:33:00:00:00/FF:FF:FF:00:00:00    Addtron Unknown 0
+00:40:36:00:00:00/FF:FF:FF:00:00:00    TribeCompu      Unknown 0
+00:40:96:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown tsunami 6       
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-AP342E2R    tsunami 6       192.168.1.1
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AP-350  tsunami 7       
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   Aironet 350     tsunami 6       
+00:50:08:00:00:00/FF:FF:FF:00:00:00    Compaq  Unknown         0       
+00:50:18:00:00:00/FF:FF:FF:00:00:00    Amit    Unknown 0
+00:50:8B:8B:00:00/FF:FF:FF:FF:00:00    Compaq  WL400 - ETSI region     compaq  11      
+00:50:DA:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:50:DA:DA:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE747A               0       
+00:50:F2:00:00:00/FF:FF:FF:00:00:00    Microsoft       Unknown MSHOME  6       192.168.2.1
+00:50:F2:F2:00:00/FF:FF:FF:FF:00:00    Microsoft       MN-500  MSHOME  6       192.168.0.1
+00:50:FC:00:00:00/FF:FF:FF:00:00:00    Edimax  Unknown 0
+00:60:01:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:60:1D:00:00:00/FF:FF:FF:00:00:00    Orinoco Unknown         0       
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Orinoco RG1000          0       
+00:60:6D:00:00:00/FF:FF:FF:00:00:00    Cabletron       Unknown         0       
+00:60:B3:00:00:00/FF:FF:FF:00:00:00    Proxim  Unknown         0       
+00:80:37:37:00:00/FF:FF:FF:FF:00:00    Ericsson        A11 (AP-4121-105M-ER-EU)                0       
+00:80:48:00:00:00/FF:FF:FF:00:00:00    Compex  Unknown 0
+00:80:C6:00:00:00/FF:FF:FF:00:00:00    SOHOware        Unknown 
+00:80:C6:C6:00:00/FF:FF:FF:FF:00:00    SOHOware        NetBlaster II
+00:80:C8:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       192.168.0.1
+00:90:0E:00:00:00/FF:FF:FF:00:00:00    Handlink        Unknown 0
+00:90:4B:4B:00:00/FF:FF:FF:FF:00:00    Linksys BEFW11S4        linksys 6        192.168.1.1
+00:90:4B:00:00:00/FF:FF:FF:00:00:00    Motorola        Unknown 0
+00:90:4C:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:90:96:00:00:00/FF:FF:FF:00:00:00    Askey   Unknown 0
+00:90:D1:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown WLAN    11      
+00:90:D1:D1:00:00/FF:FF:FF:FF:00:00    SMC     SMC2652W        WLAN    11      
+00:90:D1:D1:00:00/FF:FF:FF:FF:00:00    SMC     SMC2682W        BRIDGE  11      
+00:A0:04:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown 
+00:A0:04:04:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE51196
+00:A0:C5:00:00:00/FF:FF:FF:00:00:00    Zyxel   Unknown 0
+00:A0:F8:00:00:00/FF:FF:FF:00:00:00    Symbol  Unknown 
+00:B0:64:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:C0:02:00:00:00/FF:FF:FF:00:00:00    Sercomm Unknown 0
+00:C0:49:00:00:00/FF:FF:FF:00:00:00    USRobotics      Unknown 0
+00:D0:59:00:00:00/FF:FF:FF:00:00:00    AmbitMicro      Unknown 0
+00:E0:00:00:00:00/FF:FF:FF:00:00:00    Fujitsu Unknown 0
+00:E0:29:00:00:00/FF:FF:FF:00:00:00    OEM     Unknown 
+00:E0:63:00:00:00/FF:FF:FF:00:00:00    Cabletron       Unknown 0
+00:E0:98:00:00:00/FF:FF:FF:00:00:00    Trend   Unknown 0
+00:E0:B8:00:00:00/FF:FF:FF:00:00:00    Gateway2000     Unknown 0
+08:00:46:00:00:00/FF:FF:FF:00:00:00    Sony    Unknown 
+00:14:BF:00:00:00/FF:FF:FF:00:00:00    linksys Unknown linksys 6       192.168.1.1
+00:14:6C:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:16:B6:00:00:00/FF:FF:FF:00:00:00    linksys Unknown linksys 6       192.168.1.1
+00:18:39:00:00:00/FF:FF:FF:00:00:00    linksys Unknown linksys 6       192.168.1.1
+00:18:F8:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown         0       
+02:13:CE:00:00:00/FF:FF:FF:00:00:00    hpsetup Unknown 0
+00:15:E9:00:00:00/FF:FF:FF:00:00:00     dlink     Unknown 0
+00:14:51:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:C0:A8:00:00:00/FF:FF:FF:00:00:00    AMX     Unknown 0
+00:16:CB:00:00:00/FF:FF:FF:00:00:00    Apple   Macbook Pro             0       
diff --git a/net/kismet/files/client_manuf b/net/kismet/files/client_manuf
new file mode 100644 (file)
index 0000000..07a9bec
--- /dev/null
@@ -0,0 +1,455 @@
+00:00:22:22:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Silver          0       
+00:00:8F:8F:00:00/FF:FF:FF:FF:00:00    BreezeCOM       Breezenet Pro SA-PC             0       
+00:01:03:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:01:03:03:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE62092A
+00:01:03:03:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE777A               0       
+00:01:24:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown default 6       192.168.2.1
+00:01:F4:F4:00:00/FF:FF:FF:FF:00:00    Entrasys        CSIBD-AB-S Roamabout            0       
+00:02:2D:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Agere   Orinoco Gold
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Agere   PC24E-H-FC              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Avaya   PC24E-H-ET
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Avaya   PC24E-H-FC              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Avaya   World Card Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Buffalo WLI-PCM-L11
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Buffalo WLI-PCM-L11
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Buffalo WLI-PCM-L11GP           0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Dell    TrueMobile 1150
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Dell    TrueMobile 1150 Mini-PCI                0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Dell    Truemobile 1150         0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Dell    true mobile 1150                0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Gold
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  PC24E-H-FC              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  PC24E-H-FC              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  PC24E-H-FC              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN Silver          0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN Silver (PC24E-H-FC)             0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN-Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN/IEEE Version 01.01              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco MiniPCI Card (embedded in Sony Laptop)          0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Orinoco Gold    wireless        3       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Orinoco Gold
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Orinoco Mini PCI Card           0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco PC Card T2 Extended ORiNOCO Europe 128RC4 Kit Gold              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco PC24E-H-ET
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco PC24E-H-FC              0       
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Silver
+00:02:2D:2D:00:00/FF:FF:FF:FF:00:00    Orinoco Silver
+00:02:6F:00:00:00/FF:FF:FF:00:00:00    Senao   Unknown         0       
+00:02:6F:6F:00:00/FF:FF:FF:FF:00:00    Senao   SL-2011 CD
+00:02:6F:6F:00:00/FF:FF:FF:FF:00:00    Senao   SL-2011CD               0       
+00:02:6F:6F:00:00/FF:FF:FF:FF:00:00    Senao   SL-2011CD
+00:02:6F:6F:00:00/FF:FF:FF:FF:00:00    Senao   SL-2511CD PLUS EXT2(F200)               0       
+00:02:A5:00:00:00/FF:FF:FF:00:00:00    Compaq  Unknown         0       
+00:02:A5:A5:00:00/FF:FF:FF:FF:00:00    Compaq  WL110
+00:02:A5:A5:00:00/FF:FF:FF:FF:00:00    Compaq  WL110 REV.0A            0       
+00:02:B3:B3:00:00/FF:FF:FF:FF:00:00    Intel   WPC-2011BWW             0       
+00:03:2F:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown         0       
+00:03:2F:2F:00:00/FF:FF:FF:FF:00:00    Linksys WPC11           0       
+00:03:2F:2F:00:00/FF:FF:FF:FF:00:00    Linksys WPC11
+00:03:2F:2F:00:00/FF:FF:FF:FF:00:00    Repotec GL241101
+00:04:5A:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown         0       
+00:04:5A:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown Linksys 6       192.168.1.1
+00:04:5A:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:04:5A:5A:00:00/FF:FF:FF:FF:00:00    Linksys BEFW11S4        linksys 0       
+00:04:5A:5A:00:00/FF:FF:FF:FF:00:00    Linksys WPC11
+00:04:5A:5A:00:00/FF:FF:FF:FF:00:00    Linksys WPC11
+00:04:5A:5A:00:00/FF:FF:FF:FF:00:00    Linksys WPC11
+00:04:5A:5A:00:00/FF:FF:FF:FF:00:00    Linksys WUSB11
+00:04:75:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:04:75:75:00:00/FF:FF:FF:FF:00:00    3Com    3CRSHPW696              0       
+00:04:75:75:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE62092B             0       
+00:04:75:75:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE62092B
+00:04:DB:DB:00:00/FF:FF:FF:FF:00:00    Tellus  TWL-C11         0       
+00:04:E2:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown         0       
+00:04:E2:E2:00:00/FF:FF:FF:FF:00:00    SMC     SMC2632W                0       
+00:04:E2:E2:00:00/FF:FF:FF:FF:00:00    SMC     SMC2632W
+00:04:E2:E2:00:00/FF:FF:FF:FF:00:00    SMC     SMC2632W
+00:04:E2:E2:00:00/FF:FF:FF:FF:00:00    SMC     SMC2632W
+00:04:E2:E2:00:00/FF:FF:FF:FF:00:00    SMC     SMC2632W
+00:05:3C:3C:00:00/FF:FF:FF:FF:00:00    Intel   Intel MiniPCI High Rate Wireless (ISL3874A)             0       
+00:05:5D:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown         0       
+00:05:5D:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    Compaq  HNW-100         0       
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DCF-650W
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650         0       
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650         0       
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650         0       
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650H
+00:05:5D:5D:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-660 H/W:A1 F/W:4.04         0       
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown         0       
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340              0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    D-Link  DCF-650W
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Dell    True Mobile 1150                6       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys BEFW11S4 v2     linksys 6       192.168.1.1
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WCF11           0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WCF11
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WCF12           0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WCF12
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WCF12
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WMP11           0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WMP11 v2.5              0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 V.3               0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v2.5
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v2.5
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3                0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3                0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 v3.0              0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WPC11 ver.3 (FCC-ID: PKW-WPC11-V31[suggests V3.1])              0       
+00:06:25:25:00:00/FF:FF:FF:FF:00:00    Linksys WUSB11 v2.6             0       
+00:07:0E:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:07:0E:0E:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:07:0E:0E:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:07:50:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:07:50:50:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:07:50:50:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM350              0       
+00:08:21:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:08:21:21:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:08:21:21:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:08:21:21:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:08:21:21:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:09:43:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:43:43:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear MA401           0       
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear MA401RA         0       
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear MA401RA
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear MA701           0       
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear MA701
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear ma101           0       
+00:09:5B:5B:00:00/FF:FF:FF:FF:00:00    Netgear wab501          0       
+00:09:7C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:7C:7C:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:09:7C:7C:00:00/FF:FF:FF:FF:00:00    Cisco   Cisco Aironet 352 802.11b pcmcia card           0       
+00:09:92:92:00:00/FF:FF:FF:FF:00:00    Sweex   LC500010 ATMEL PCMCIA FastVNET (502A-D)         0       
+00:09:B7:B7:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352              0       
+00:09:B7:B7:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352              0       
+00:09:E8:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:E8:E8:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352
+00:0A:41:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:41:41:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-LMC352              0       
+00:0A:41:41:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352              0       
+00:0A:41:41:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352              0       
+00:0A:41:41:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:0A:41:41:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:0A:8A:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:8A:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:8A:8A:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:0B:5F:5F:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-CB20A-A-K9          0       
+00:20:A6:A6:00:00/FF:FF:FF:FF:00:00    Proxim  Symphony (PC Card 4430)         0       
+00:20:D6:D6:00:00/FF:FF:FF:FF:00:00    BreezeCOM       Breezenet Pro.11 SA-PCR         0       
+00:30:65:00:00:00/FF:FF:FF:00:00:00    Apple   Unknown         0       
+00:30:65:00:00:00/FF:FF:FF:00:00:00    Apple   Unknown         0       
+00:30:65:65:00:00/FF:FF:FF:FF:00:00    Apple   Airport Card 2002
+00:16:CB:00:00:00/FF:FF:FF:00:00:00    Apple   Macbook Pro             0       
+00:30:AB:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MA401           0       
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MA401
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MA401
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MA401
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MA401
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear MR314   Wireless        1       192.168.0.1
+00:30:AB:AB:00:00/FF:FF:FF:FF:00:00    Netgear Netgear ma401           0       
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown         0       
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown         0       
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6020         0       
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6020         0       
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6020
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6020
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6020 (Version 01.02)         0       
+00:30:BD:BD:00:00/FF:FF:FF:FF:00:00    Belkin  F5D6020u                0       
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DI-614+ default 6       192.168.0.1
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DI-614+ 22Mbps router/AP/switch default 6       192.168.0.1
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-520+                0       
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650         0       
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650 internet        8       
+00:40:05:05:00:00/FF:FF:FF:FF:00:00    D-Link  DWL-650+        wireless        6       192.168.0.1
+00:40:26:00:00:00/FF:FF:FF:00:00:00    Buffalo Unknown         0       
+00:40:96:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:40:96:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown tsunami 6       
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   350
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PC4800
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340              0       
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340              0       
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM340 (Dell Rebrand)               0       
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   AIR-PCM352
+00:40:96:96:00:00/FF:FF:FF:FF:00:00    Cisco   PC 4800 DS PCI Adapter          0       
+00:50:08:00:00:00/FF:FF:FF:00:00:00    Compaq  Unknown         0       
+00:50:08:08:00:00/FF:FF:FF:FF:00:00    Compaq  WL100           0       
+00:50:08:08:00:00/FF:FF:FF:FF:00:00    Compaq  WL100
+00:50:8B:8B:00:00/FF:FF:FF:FF:00:00    Compaq  Compaq WL100    compaq  0       
+00:50:8B:8B:00:00/FF:FF:FF:FF:00:00    Compaq  WL200 - ETSI region             0       
+00:50:DA:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:50:DA:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:50:DA:DA:00:00/FF:FF:FF:FF:00:00    3Com    3CRWE73796B
+00:50:F2:F2:00:00/FF:FF:FF:FF:00:00    Microsoft       MN-510          0       
+00:50:F2:F2:00:00/FF:FF:FF:FF:00:00    Microsoft       Wireless Notebook Adapter MN-520                0       
+00:60:01:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:60:01:01:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN Silver
+00:60:1D:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:60:1D:00:00:00/FF:FF:FF:00:00:00    Orinoco Unknown         0       
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  Lucent WaveLAN Turbo - Bronze, P/N: 011498/A            0       
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  Orinoco Gold
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  PC24E-00-FC             0       
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  Silver
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN Bronze
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  WaveLAN Gold
+00:60:1D:1D:00:00/FF:FF:FF:FF:00:00    Lucent  Wavelan Turbo Bronze            0       
+00:60:6D:00:00:00/FF:FF:FF:00:00:00    Cabletron       Unknown         0       
+00:60:6D:6D:00:00/FF:FF:FF:FF:00:00    Cabletron       CSIBB-AA
+00:60:6D:6D:00:00/FF:FF:FF:FF:00:00    Cabletron       CSIBB-AA
+00:60:6D:6D:00:00/FF:FF:FF:FF:00:00    Cabletron       RoamAbout 802.11DS              0       
+00:60:B3:00:00:00/FF:FF:FF:00:00:00    Proxim  Unknown         0       
+00:60:B3:6F:00:00/FF:FF:FF:FF:00:00    WMATA   WashingtonMetroAreaTA           0       
+00:60:B3:B3:00:00/FF:FF:FF:FF:00:00    3Com    XI-815          0       
+00:60:B3:B3:00:00/FF:FF:FF:FF:00:00    3Com    Zcom WL2000D            0       
+00:60:B3:B3:00:00/FF:FF:FF:FF:00:00    Proxim  RangeLAN DS             0       
+00:60:B3:B3:00:00/FF:FF:FF:FF:00:00    Proxim  RangeLan DS 8430
+00:60:B3:B3:00:00/FF:FF:FF:FF:00:00    SMC     SMC2642W
+00:80:37:37:00:00/FF:FF:FF:FF:00:00    Ericsson        C11 (LA-4121-102M-ER-EU)                0       
+00:80:C6:00:00:00/FF:FF:FF:00:00:00    SOHOware        Unknown         0       
+00:90:4B:4B:00:00/FF:FF:FF:FF:00:00    Dell    1180 True Mobile PCI            0       
+00:90:96:96:00:00/FF:FF:FF:FF:00:00    Yakumo  WLAN PCMCIA Card 11 Mbps                0       
+00:90:D1:00:00:00/FF:FF:FF:00:00:00    LeArtery        Unknown         0       
+00:90:D1:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown WLAN    11      
+00:90:D1:D1:00:00/FF:FF:FF:FF:00:00    LeArtery        SyncByAir LN101
+00:90:D1:D1:00:00/FF:FF:FF:FF:00:00    SMC     2662W           0       
+00:90:D1:D1:00:00/FF:FF:FF:FF:00:00    SMC     SMC2632W                0       
+00:A0:04:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:A0:65:65:00:00/FF:FF:FF:FF:00:00    Nexland Zcom XI-300             0       
+00:A0:F8:00:00:00/FF:FF:FF:00:00:00    Symbol  Unknown         0       
+00:A0:F8:F8:00:00/FF:FF:FF:FF:00:00    Symbol  Spectrum 24 High Rate 11MBps wireless LAN adapter               0       
+00:A0:F8:F8:00:00/FF:FF:FF:FF:00:00    Symbol  Spectrum24
+00:C0:49:49:00:00/FF:FF:FF:FF:00:00    US Robotics     USR1120         0       
+00:E0:29:00:00:00/FF:FF:FF:00:00:00    OEM     Unknown         0       
+00:E0:29:29:00:00/FF:FF:FF:FF:00:00    OEM     OEM
+00:E0:29:29:00:00/FF:FF:FF:FF:00:00    SMC     2632W           0       
+00:E0:29:29:00:00/FF:FF:FF:FF:00:00    SMC     EZ-Connect Wireless             0       
+08:00:46:00:00:00/FF:FF:FF:00:00:00    Sony    Unknown         0       
+08:00:46:46:00:00/FF:FF:FF:FF:00:00    Sony    PCWA-C100
+00:00:0C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:00:74:00:00:00/FF:FF:FF:00:00:00    Ricoh   Unknown 0
+00:00:92:00:00:00/FF:FF:FF:00:00:00    Cogent  Unknown 0
+00:00:AA:00:00:00/FF:FF:FF:00:00:00    Xerox   Unknown 0
+00:00:C5:00:00:00/FF:FF:FF:00:00:00    FarallonCo      Unknown 0
+00:00:CE:00:00:00/FF:FF:FF:00:00:00    Megadata        Unknown 0
+00:00:DE:00:00:00/FF:FF:FF:00:00:00    Unigraph        Unknown 0
+00:01:03:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:01:24:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown default 6       192.168.2.1
+00:01:38:00:00:00/FF:FF:FF:00:00:00    XaviTechno      Unknown 0
+00:01:95:00:00:00/FF:FF:FF:00:00:00    Sena    Unknown 0
+00:01:E6:00:00:00/FF:FF:FF:00:00:00    Hewlett-Pa      Unknown 0
+00:01:F4:00:00:00/FF:FF:FF:00:00:00    EnterasysN      Unknown 0
+00:02:2D:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:02:44:00:00:00/FF:FF:FF:00:00:00    Surecom Unknown 0
+00:02:6F:00:00:00/FF:FF:FF:00:00:00    Senao   Unknown         0       
+00:02:72:00:00:00/FF:FF:FF:00:00:00    Cc&C    Unknown 0
+00:02:8A:00:00:00/FF:FF:FF:00:00:00    AmbitMicro      Unknown 0
+00:02:A5:00:00:00/FF:FF:FF:00:00:00    Compaq  Unknown         0       
+00:02:B3:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:03:0A:00:00:00/FF:FF:FF:00:00:00    Argus   Unknown 0
+00:03:2F:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown         0       
+00:03:52:00:00:00/FF:FF:FF:00:00:00    Colubris        Unknown 0
+00:03:93:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:04:23:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:04:5A:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:04:75:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:04:76:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown 0
+00:04:DB:00:00:00/FF:FF:FF:00:00:00    TellusGrou      Unknown 0
+00:04:E2:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown         0       
+00:04:E2:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown SMC     6       192.168.2.1
+00:05:3C:00:00:00/FF:FF:FF:00:00:00    Xircom  Unknown 0
+00:05:4E:00:00:00/FF:FF:FF:00:00:00    PhilipsCom      Unknown 0
+00:05:5D:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       
+00:05:87:00:00:00/FF:FF:FF:00:00:00    Locus   Unknown 0
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:06:25:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys-g       6       192.168.1.1
+00:06:B1:00:00:00/FF:FF:FF:00:00:00    Sonicwall       Unknown 0
+00:07:0E:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:07:13:00:00:00/FF:FF:FF:00:00:00    IpOne   Unknown 0
+00:07:40:00:00:00/FF:FF:FF:00:00:00    Melco   Unknown 0
+00:07:50:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:07:85:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:07:EB:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:08:21:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:08:A1:00:00:00/FF:FF:FF:00:00:00    CnetTechno      Unknown 0
+00:09:43:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown Wireless        11  192.168.0.2
+00:09:5B:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:09:7C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:09:B7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:09:E8:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:04:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0A:41:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:8A:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown         0       
+00:0A:95:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:0A:B7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0A:E9:00:00:00/FF:FF:FF:00:00:00    Airvast Unknown 0
+00:0B:5F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0B:6B:00:00:00/FF:FF:FF:00:00:00    WistronNew      Unknown 0
+00:0B:6C:00:00:00/FF:FF:FF:00:00:00    Sychip  Unknown 0
+00:0B:7D:00:00:00/FF:FF:FF:00:00:00    SolomonExt      Unknown 0
+00:0B:85:00:00:00/FF:FF:FF:00:00:00    Airespace       Unknown 0
+00:0B:86:00:00:00/FF:FF:FF:00:00:00    Aruba   Unknown 0
+00:0B:AC:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0B:BE:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0B:CD:00:00:00/FF:FF:FF:00:00:00    CompaqHp        Unknown 0
+00:0B:FD:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:30:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:41:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:0C:85:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:CE:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0C:E5:00:00:00/FF:FF:FF:00:00:00    MotorolaBc      Unknown 0
+00:0C:F1:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:0D:0B:00:00:00/FF:FF:FF:00:00:00    Melco   Unknown 0
+00:0D:14:00:00:00/FF:FF:FF:00:00:00    VtechInnov      Unknown 0
+00:0D:28:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:29:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:3A:00:00:00/FF:FF:FF:00:00:00    Microsoft       Unknown 0
+00:0D:54:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0D:65:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:72:00:00:00/FF:FF:FF:00:00:00    2wire   Unknown 0
+00:0D:88:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       192.168.0.1
+00:0D:93:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:0D:97:00:00:00/FF:FF:FF:00:00:00    Tropos  Unknown 0
+00:0D:9D:00:00:00/FF:FF:FF:00:00:00    HewlettPac      Unknown 0
+00:0D:BD:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0D:ED:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:35:00:00:00/FF:FF:FF:00:00:00    Intel   Unknown 0
+00:0E:38:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:3B:00:00:00/FF:FF:FF:00:00:00    HawkingTec      Unknown 0
+00:0E:58:00:00:00/FF:FF:FF:00:00:00    RinconNetw      Unknown 0
+00:0E:6A:00:00:00/FF:FF:FF:00:00:00    3comEurope      Unknown 0
+00:0E:7F:00:00:00/FF:FF:FF:00:00:00    HewlettPac      Unknown 0
+00:0E:83:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:84:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0E:9B:00:00:00/FF:FF:FF:00:00:00    Private Unknown 0
+00:0E:A6:00:00:00/FF:FF:FF:00:00:00    AsustekCom      Unknown 0
+00:0E:D7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:23:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:24:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:34:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:3D:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       192.168.0.1
+00:0F:66:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:0F:8F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:90:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:B5:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown NETGEAR 11      192.168.0.1
+00:0F:EA:00:00:00/FF:FF:FF:00:00:00    GigaByte        Unknown 0
+00:0F:F7:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:0F:F8:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:10:C6:00:00:00/FF:FF:FF:00:00:00    Usi     Unknown 0
+00:10:E7:00:00:00/FF:FF:FF:00:00:00    Breezecom       Unknown 0
+00:11:09:00:00:00/FF:FF:FF:00:00:00    Micro-Star      Unknown 0
+00:11:0A:00:00:00/FF:FF:FF:00:00:00    HewlettPac      Unknown 0
+00:11:20:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:21:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:24:00:00:00/FF:FF:FF:00:00:00    AppleCompu      Unknown 0
+00:11:2F:00:00:00/FF:FF:FF:00:00:00    AsustekCom      Unknown 0
+00:11:50:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown 0
+00:11:5C:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:88:00:00:00/FF:FF:FF:00:00:00    Enterasys       Unknown 0
+00:11:92:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:93:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:95:00:00:00/FF:FF:FF:00:00:00    AlphaNetwo      Unknown 0
+00:11:BB:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:11:D8:00:00:00/FF:FF:FF:00:00:00    AsustekCom      Unknown 0
+00:11:F5:00:00:00/FF:FF:FF:00:00:00    Askey   Unknown 0
+00:12:00:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:01:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:17:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:12:25:00:00:00/FF:FF:FF:00:00:00    MotorolaBc      Unknown 0
+00:12:43:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:7F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:80:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:88:00:00:00/FF:FF:FF:00:00:00    2wire   Unknown 0
+00:12:D9:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:DA:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:12:F0:00:00:00/FF:FF:FF:00:00:00    IntelCorpo      Unknown 0
+00:13:10:00:00:00/FF:FF:FF:00:00:00    Linksys Unknown linksys 6       192.168.1.1
+00:13:19:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:1A:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:46:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown 0
+00:13:60:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:7F:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:80:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:13:C4:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:20:00:00:00:00/FF:FF:FF:00:00:00    LexmarkInt      Unknown 0
+00:20:A6:00:00:00/FF:FF:FF:00:00:00    Proxim  Unknown 0
+00:20:D8:00:00:00/FF:FF:FF:00:00:00    Nortel  Unknown 0
+00:20:E0:00:00:00/FF:FF:FF:00:00:00    Actiontec       Unknown 0
+00:30:1A:00:00:00/FF:FF:FF:00:00:00    Smartbridge     Unknown 0
+00:30:65:00:00:00/FF:FF:FF:00:00:00    Apple   Unknown         0       
+00:30:6E:00:00:00/FF:FF:FF:00:00:00    HP      Unknown 0
+00:30:AB:00:00:00/FF:FF:FF:00:00:00    Netgear Unknown         0       
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown         0       
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown WLAN    11      0.0.0.0
+00:30:BD:00:00:00/FF:FF:FF:00:00:00    Belkin  Unknown belkin54g       11  0.0.0.0
+00:30:F1:00:00:00/FF:FF:FF:00:00:00    AcctonTech      Unknown 0
+00:40:01:00:00:00/FF:FF:FF:00:00:00    Zyxel   Unknown 0
+00:40:05:00:00:00/FF:FF:FF:00:00:00    ANI     Unknown default 6       192.168.0.1
+00:40:26:00:00:00/FF:FF:FF:00:00:00    Buffalo Unknown         0       
+00:40:33:00:00:00/FF:FF:FF:00:00:00    Addtron Unknown 0
+00:40:36:00:00:00/FF:FF:FF:00:00:00    TribeCompu      Unknown 0
+00:40:96:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown tsunami 6       
+00:50:08:00:00:00/FF:FF:FF:00:00:00    Compaq  Unknown         0       
+00:50:18:00:00:00/FF:FF:FF:00:00:00    Amit    Unknown 0
+00:50:DA:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown         0       
+00:50:F2:00:00:00/FF:FF:FF:00:00:00    Microsoft       Unknown MSHOME  6       192.168.2.1
+00:50:FC:00:00:00/FF:FF:FF:00:00:00    Edimax  Unknown 0
+00:60:01:00:00:00/FF:FF:FF:00:00:00    Lucent  Unknown         0       
+00:60:1D:00:00:00/FF:FF:FF:00:00:00    Orinoco Unknown         0       
+00:60:6D:00:00:00/FF:FF:FF:00:00:00    Cabletron       Unknown         0       
+00:60:B3:00:00:00/FF:FF:FF:00:00:00    Proxim  Unknown         0       
+00:80:48:00:00:00/FF:FF:FF:00:00:00    Compex  Unknown 0
+00:80:C6:00:00:00/FF:FF:FF:00:00:00    SOHOware        Unknown 
+00:80:C8:00:00:00/FF:FF:FF:00:00:00    D-Link  Unknown default 6       192.168.0.1
+00:90:0E:00:00:00/FF:FF:FF:00:00:00    Handlink        Unknown 0
+00:90:4C:00:00:00/FF:FF:FF:00:00:00    Netgear/Epigram Unknown NETGEAR 11      192.168.0.1
+00:90:96:00:00:00/FF:FF:FF:00:00:00    Askey   Unknown 0
+00:90:D1:00:00:00/FF:FF:FF:00:00:00    SMC     Unknown WLAN    11      
+00:A0:04:00:00:00/FF:FF:FF:00:00:00    3Com    Unknown 
+00:A0:C5:00:00:00/FF:FF:FF:00:00:00    Zyxel   Unknown 0
+00:A0:F8:00:00:00/FF:FF:FF:00:00:00    Symbol  Unknown 
+00:B0:64:00:00:00/FF:FF:FF:00:00:00    Cisco   Unknown 0
+00:C0:02:00:00:00/FF:FF:FF:00:00:00    Sercomm Unknown 0
+00:C0:49:00:00:00/FF:FF:FF:00:00:00    USRobotics      Unknown 0
+00:D0:59:00:00:00/FF:FF:FF:00:00:00    AmbitMicro      Unknown 0
+00:E0:00:00:00:00/FF:FF:FF:00:00:00    Fujitsu Unknown 0
+00:E0:29:00:00:00/FF:FF:FF:00:00:00    OEM     Unknown 
+00:E0:63:00:00:00/FF:FF:FF:00:00:00    Cabletron       Unknown 0
+00:E0:98:00:00:00/FF:FF:FF:00:00:00    Trend   Unknown 0
+00:E0:B8:00:00:00/FF:FF:FF:00:00:00    Gateway2000     Unknown 0
+08:00:46:00:00:00/FF:FF:FF:00:00:00    Sony    Unknown 
+00:14:BF:00:00:00/FF:FF:FF:00:00:00    linksys Unknown 0
+00:14:6C:00:00:00/FF:FF:FF:00:00:00    NETGEAR Unknown 0
+00:16:B6:00:00:00/FF:FF:FF:00:00:00    linksys Unknown linksys 6       192.168.1.1
+02:12:F0:00:00:00/FF:FF:FF:00:00:00    hpsetup Unknown 0
+02:13:CE:00:00:00/FF:FF:FF:00:00:00    hpsetup Unknown 0
+00:15:E9:00:00:00/FF:FF:FF:00:00:00     dlink     Unknown 0
+00:17:9A:00:00:00/FF:FF:FF:00:00:00     dlink     Unknown 0
+00:13:F7:00:00:00/FF:FF:FF:00:00:00     SMC     Unknown 0
diff --git a/net/kismet/files/kismet.conf b/net/kismet/files/kismet.conf
new file mode 100644 (file)
index 0000000..3a11720
--- /dev/null
@@ -0,0 +1,287 @@
+# Kismet config file
+# Most of the "static" configs have been moved to here -- the command line
+# config was getting way too crowded and cryptic.  We want functionality,
+# not continually reading --help!
+
+# Version of Kismet config
+version=2005.01.R1
+
+# Name of server (Purely for organiational purposes)
+servername=Kismet
+
+# User to setid to (should be your normal user)
+suiduser=nobody
+
+# Sources are defined as:
+# source=cardtype,interface,name[,initialchannel]
+# Card types and required drivers are listed in the README.
+# The initial channel is optional, if hopping is not enabled it can be used
+# to set the channel the interface listens on.
+# YOU MUST CHANGE THIS TO BE THE SOURCE YOU WANT TO USE
+source=wrt54g,eth1,wireless
+# For v1 hardware uncomment this:
+# source=wrt54g,eth2,wireless
+
+# Comma-separated list of sources to enable.  This is only needed if you defined
+# multiple sources and only want to enable some of them.  By default, all defined
+# sources are enabled.
+# For example:
+# enablesources=prismsource,ciscosource
+
+# Do we channelhop?
+channelhop=true
+
+# How many channels per second do we hop?  (1-10)
+channelvelocity=5
+
+# By setting the dwell time for channel hopping we override the channelvelocity
+# setting above and dwell on each channel for the given number of seconds.
+#channeldwell=10
+
+# Do we split channels between cards on the same spectrum?  This means if 
+# multiple 802.11b capture sources are defined, they will be offset to cover
+# the most possible spectrum at a given time.  This also controls splitting
+# fine-tuned sourcechannels lines which cover multiple interfaces (see below)
+channelsplit=true
+
+# Basic channel hopping control:
+# These define the channels the cards hop through for various frequency ranges
+# supported by Kismet.   More finegrain control is available via the 
+# "sourcechannels" configuration option.
+# 
+# Don't change the IEEE80211<x> identifiers or channel hopping won't work.
+
+# Users outside the US might want to use this list:
+# defaultchannels=IEEE80211b:1,7,13,2,8,3,14,9,4,10,5,11,6,12
+defaultchannels=IEEE80211b:1,6,11,2,7,3,8,4,9,5,10
+
+# 802.11g uses the same channels as 802.11b...
+defaultchannels=IEEE80211g:1,6,11,2,7,3,8,4,9,5,10
+
+# 802.11a channels are non-overlapping so sequential is fine.  You may want to
+# adjust the list depending on the channels your card actually supports.
+# defaultchannels=IEEE80211a:36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,184,188,192,196,200,204,208,212,216 
+defaultchannels=IEEE80211a:36,40,44,48,52,56,60,64
+
+# Combo cards like Atheros use both 'a' and 'b/g' channels.  Of course, you
+# can also explicitly override a given source.  You can use the script 
+# extras/listchan.pl to extract all the channels your card supports.
+defaultchannels=IEEE80211ab:1,6,11,2,7,3,8,4,9,5,10,36,40,44,48,52,56,60,64
+
+# Fine-tuning channel hopping control:
+# The sourcechannels option can be used to set the channel hopping for 
+# specific interfaces, and to control what interfaces share a list of 
+# channels for split hopping.  This can also be used to easily lock
+# one card on a single channel while hopping with other cards.
+# Any card without a sourcechannel definition will use the standard hopping
+# list.
+# sourcechannels=sourcename[,sourcename]:ch1,ch2,ch3,...chN
+
+# ie, for us channels on the source 'prism2source' (same as normal channel
+# hopping behavior):
+# sourcechannels=prism2source:1,6,11,2,7,3,8,4,9,5,10
+
+# Given two capture sources, "prism2a" and "prism2b", we want prism2a to stay
+# on channel 6 and prism2b to hop normally.  By not setting a sourcechannels 
+# line for prism2b, it will use the standard hopping.
+# sourcechannels=prism2a:6
+
+# To assign the same custom hop channel to multiple sources, or to split the 
+# same custom hop channel over two sources (if splitchannels is true), list
+# them all on the same sourcechannels line:
+# sourcechannels=prism2a,prism2b,prism2c:1,6,11
+
+# Port to serve GUI data
+tcpport=2501
+# People allowed to connect, comma seperated IP addresses or network/mask
+# blocks.  Netmasks can be expressed as dotted quad (/255.255.255.0) or as
+# numbers (/24)
+allowedhosts=127.0.0.1
+# Maximum number of concurrent GUI's
+maxclients=5
+
+# Do we have a GPS?
+gps=false
+# Host:port that GPSD is running on.  This can be localhost OR remote!
+gpshost=localhost:2947
+# Do we lock the mode?  This overrides coordinates of lock "0", which will
+# generate some bad information until you get a GPS lock, but it will 
+# fix problems with GPS units with broken NMEA that report lock 0
+gpsmodelock=false
+
+# Packet filtering options:
+# filter_tracker - Packets filtered from the tracker are not processed or
+#                  recorded in any way.
+# filter_dump    - Packets filtered at the dump level are tracked, displayed,
+#                  and written to the csv/xml/network/etc files, but not 
+#                  recorded in the packet dump
+# filter_export  - Controls what packets influence the exported CSV, network,
+#                  xml, gps, etc files.
+# All filtering options take arguments containing the type of address and
+# addresses to be filtered.  Valid address types are 'ANY', 'BSSID',
+# 'SOURCE', and 'DEST'.  Filtering can be inverted by the use of '!' before
+# the address.  For example,
+# filter_tracker=ANY(!00:00:DE:AD:BE:EF)
+# has the same effect as the previous mac_filter config file option.
+# filter_tracker=...
+# filter_dump=...
+# filter_export=...
+
+# Alerts to be reported and the throttling rates.
+# alert=name,throttle/unit,burst
+# The throttle/unit describes the number of alerts of this type that are
+# sent per time unit.  Valid time units are second, minute, hour, and day.
+# Burst describes the number of alerts sent before throttling takes place.
+# For example:
+# alert=FOO,10/min,5
+# Would allow 5 alerts through before throttling is enabled, and will then
+# limit the number of alerts to 10 per minute.
+# A throttle rate of 0 disables throttling of the alert.
+# See the README for a list of alert types.
+alert=NETSTUMBLER,5/min,2
+alert=WELLENREITER,5/min,2
+alert=LUCENTTEST,5/min,2
+alert=DEAUTHFLOOD,5/min,4
+alert=BCASTDISCON,5/min,4
+alert=CHANCHANGE,5/min,4
+alert=AIRJACKSSID,5/min,2
+alert=PROBENOJOIN,5/min,2
+alert=DISASSOCTRAFFIC,5/min,2
+alert=NULLPROBERESP,5/min,5
+alert=BSSTIMESTAMP,5/min,5
+alert=MSFBCOMSSID,10/min,1/sec
+alert=LONGSSID,10/min,1/sec
+alert=MSFDLINKRATE,10/min,1/sec
+alert=MSFNETGEARBEACON,10/min,1/sec
+alert=DISCONCODEINVALID,10/min,1/sec
+alert=DEAUTHCODEINVALID,10/min,1/sec
+
+# Known WEP keys to decrypt, bssid,hexkey.  This is only for networks where
+# the keys are already known, and it may impact throughput on slower hardware.
+# Multiple wepkey lines may be used for multiple BSSIDs.
+# wepkey=00:DE:AD:C0:DE:00,FEEDFACEDEADBEEF01020304050607080900
+
+# Is transmission of the keys to the client allowed?  This may be a security
+# risk for some.  If you disable this, you will not be able to query keys from
+# a client.
+allowkeytransmit=true
+
+# How often (in seconds) do we write all our data files (0 to disable)
+writeinterval=300
+
+# Where do we get our manufacturer fingerprints from?  Assumed to be in the
+# default config directory if an absolute path is not given.
+ap_manuf=ap_manuf
+client_manuf=client_manuf
+
+# Use metric measurements in the output?
+metric=false
+
+# Do we write waypoints for gpsdrive to load?  Note:  This is NOT related to
+# recent versions of GPSDrive's native support of Kismet.
+waypoints=false
+# GPSMap waypoint file.  This WILL be truncated.
+waypointdata=%h/.gpsdrive/way_kismet.txt
+
+# How many alerts do we backlog for new clients?  Only change this if you have
+# a -very- low memory system and need those extra bytes, or if you have a high
+# memory system and a huge number of alert conditions.
+alertbacklog=50
+
+# File types to log, comma seperated
+# dump    - raw packet dump
+# network - plaintext detected networks
+# csv     - plaintext detected networks in CSV format
+# xml     - XML formatted network and cisco log
+# weak    - weak packets (in airsnort format)
+# cisco   - cisco equipment CDP broadcasts
+# gps     - gps coordinates
+logtypes=dump,network,csv,xml,weak,cisco,gps
+
+# Do we track probe responses and merge probe networks into their owners?
+# This isn't always desireable, depending on the type of monitoring you're
+# trying to do.
+trackprobenets=true
+
+# Do we log "noise" packets that we can't decipher?  I tend to not, since 
+# they don't have anything interesting at all in them.
+noiselog=false
+
+# Do we log corrupt packets?  Corrupt packets have enough header information
+# to see what they are, but someting is wrong with them that prevents us from
+# completely dissecting them.  Logging these is usually not a bad idea.
+corruptlog=true
+
+# Do we log beacon packets or do we filter them out of the dumpfile
+beaconlog=true
+
+# Do we log PHY layer packets or do we filter them out of the dumpfile
+phylog=true
+
+# Do we mangle packets if we can decrypt them or if they're fuzzy-detected
+mangledatalog=true
+
+# Do we do "fuzzy" crypt detection?  (byte-based detection instead of 802.11
+# frame headers)
+# valid option: Comma seperated list of card types to perform fuzzy detection 
+#  on, or 'all'
+fuzzycrypt=wtapfile,wlanng,wlanng_legacy,wlanng_avs,hostap,wlanng_wext
+
+# What type of dump do we generate? 
+# valid option: "wiretap" 
+dumptype=wiretap
+# Do we limit the size of dump logs?  Sometimes ethereal can't handle big ones.
+# 0 = No limit
+# Anything else = Max number of packets to log to a single file before closing
+# and opening a new one.
+dumplimit=0
+
+# Do we write data packets to a FIFO for an external data-IDS (such as Snort)?
+# See the docs before enabling this.
+#fifo=/tmp/kismet_dump
+
+# Default log title
+logdefault=Kismet
+
+# logtemplate - Filename logging template.
+# This is, at first glance, really nasty and ugly, but you'll hardly ever
+# have to touch it so don't complain too much.
+#
+# %n is replaced by the logging instance name
+# %d is replaced by the current date as Mon-DD-YYYY
+# %D is replaced by the current date as YYYYMMDD
+# %t is replaced by the starting log time
+# %i is replaced by the increment log in the case of multiple logs
+# %l is replaced by the log type (dump, status, crypt, etc)
+# %h is replaced by the home directory
+# ie, "netlogs/%n-%d-%i.dump" called with a logging name of "Pok" could expand
+# to something like "netlogs/Pok-Dec-20-01-1.dump" for the first instance and 
+# "netlogs/Pok-Dec-20-01-2.%l" for the second logfile generated.
+# %h/netlots/%n-%d-%i.dump could expand to
+# /home/foo/netlogs/Pok-Dec-20-01-2.dump
+#
+# Other possibilities:  Sorting by directory
+# logtemplate=%l/%n-%d-%i
+# Would expand to, for example,
+# dump/Pok-Dec-20-01-1
+# crypt/Pok-Dec-20-01-1
+# and so on.  The "dump", "crypt", etc, dirs must exist before kismet is run
+# in this case.
+logtemplate=%n-%d-%i.%l
+
+# Where do we store the pid file of the server?
+piddir=/var/run/
+
+# Where state info, etc, is stored.  You shouldnt ever need to change this.
+# This is a directory.
+configdir=%h/.kismet/
+
+# cloaked SSID file.  You shouldn't ever need to change this.
+ssidmap=ssid_map
+
+# Group map file.  You shouldn't ever need to change this.
+groupmap=group_map
+
+# IP range map file.  You shouldn't ever need to change this.
+ipmap=ip_map
+
diff --git a/net/kismet/files/kismet_drone.conf b/net/kismet/files/kismet_drone.conf
new file mode 100644 (file)
index 0000000..901b5b8
--- /dev/null
@@ -0,0 +1,121 @@
+# Kismet drone config file
+
+version=2005.04.R1
+
+# Name of server (Purely for organiational purposes)
+servername=Kismet
+
+# User to setid to (should be your normal user)
+suiduser=nobody
+
+# Port to serve packet data... This probably shouldn't be the same as the port
+# you configured kismet_server for, or else you'll have problems running them 
+# on the same system.
+tcpport=3501
+# People allowed to connect, comma seperated IP addresses or network/mask
+# blocks.  Netmasks can be expressed as dotted quad (/255.255.255.0) or as
+# numbers (/24)
+allowedhosts=127.0.0.1
+# Maximum number of concurrent stream attachments
+maxclients=5
+
+# Packet sources:
+# source=capture_cardtype,capture_interface,capture_name
+# Card type - Specifies the type of device. It can be one of:
+#     cisco         - Cisco card with Linux Kernel drivers 
+#     cisco_cvs     - Cisco card with CVS Linux drivers
+#     cisco_bsd     - Cisco on *BSD
+#     prism2        - Prism2 using wlan-ng drivers with pcap support (all 
+#                      current versions support pcap)
+#     prism2_hostap - Prism2 using hostap drivers
+#     prism2_legacy - Prism2 using wlan-ng drivers without pcap support (0.1.9)
+#     prism2_bsd    - Prism2 on *BSD
+#     orinoco       - Orinoco cards using Snax's patched driers
+#     generic       - Generic card with no specific support.  You will have 
+#                      to put this into monitor mode yourself!
+#     wsp100        - WSP100 embedded remote sensor.  
+#     wtapfile      - Saved file of packets readable by libwiretap
+#     ar5k          - ar5k 802.11a using the vt_ar5k drivers
+# Capture interface - Specifies the network interface Kismet will watch for
+#  packets to come in on.  Typically "ethX" or "wlanX".  For the WSP100 capture
+#  engine, the WSP100 device sends packets via a UDP stream, so the capture
+#  interface should be in the form of host:port where 'host' is the WSP100 and 
+#  'port' is the local UDP port that it will send data to.
+# Capture Name      - The name Kismet uses for this capture source.  This is the 
+#   name used to specify what sources to enable.
+# 
+# To enable multiple sources, specify a source line for each and then use the
+# enablesources line to enable them.  For example:
+# source=prism2,wlan0,prism
+# source=cisco,eth0,cisco
+source=wrt54g,eth1,wireless
+# For v1 hardware uncomment this:
+# source=wrt54g,eth2,wireless
+
+# Comma-separated list of sources to enable.  This is only needed if you wish 
+# to selectively enable multiple sources.
+# enablesources=prism,cisco
+
+# Do we channelhop?
+channelhop=true
+
+# How many channels per second do we hop?  (1-10)
+channelvelocity=5
+
+# By setting the dwell time for channel hopping we override the channelvelocity
+# setting above and dwell on each channel for the given number of seconds.
+#channeldwell=10
+
+# Do we split channels between cards on the same spectrum?  This means if 
+# multiple 802.11b capture sources are defined, they will be offset to cover
+# the most possible spectrum at a given time.  This also controls splitting
+# fine-tuned sourcechannels lines which cover multiple interfaces (see below)
+splitchannels=true
+
+# Basic channel hopping control:
+# These define the channels the cards hop through for various frequency ranges
+# supported by Kismet.   More finegrain control is available via the 
+# "sourcechannels" configuration option.
+# 
+# Don't change the IEEE80211<x> identifiers or channel hopping won't work.
+
+# Users outside the US might want to use this list:
+# defaultchannels=IEEE80211b:1,7,13,2,8,3,14,9,4,10,5,11,6,12
+defaultchannels=IEEE80211b:1,6,11,2,7,3,8,4,9,5,10
+
+# 802.11g uses the same channels as 802.11b...
+defaultchannels=IEEE80211g:1,6,11,2,7,3,8,4,9,5,10
+
+# 802.11a channels are non-overlapping so sequential is fine.  You may want to
+# adjust the list depending on the channels your card actually supports.
+# defaultchannels=IEEE80211a:36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140,149,153,157,161,184,188,192,196,200,204,208,212,216 
+defaultchannels=IEEE80211a:36,40,44,48,52,56,60,64
+
+# Combo cards like Atheros use both 'a' and 'b/g' channels.  Of course, you
+# can also explicitly override a given source.  You can use the script 
+# extras/listchan.pl to extract all the channels your card supports.
+defaultchannels=IEEE80211ab:1,6,11,2,7,3,8,4,9,5,10,36,40,44,48,52,56,60,64
+
+# Fine-tuning channel hopping control:
+# The sourcechannels option can be used to set the channel hopping for 
+# specific interfaces, and to control what interfaces share a list of 
+# channels for split hopping.  This can also be used to easily lock
+# one card on a single channel while hopping with other cards.
+# Any card without a sourcechannel definition will use the standard hopping
+# list.
+# sourcechannels=sourcename[,sourcename]:ch1,ch2,ch3,...chN
+
+# ie, for us channels on the source 'prism2source' (same as normal channel
+# hopping behavior):
+# sourcechannels=prism2source:1,6,11,2,7,3,8,4,9,5,10
+
+# Given two capture sources, "prism2a" and "prism2b", we want prism2a to stay
+# on channel 6 and prism2b to hop normally.  By not setting a sourcechannels 
+# line for prism2b, it will use the standard hopping.
+# sourcechannels=prism2a:6
+
+# To assign the same custom hop channel to multiple sources, or to split the 
+# same custom hop channel over two sources (if splitchannels is true), list
+# them all on the same sourcechannels line:
+# sourcechannels=prism2a,prism2b,prism2c:1,6,11
+
diff --git a/net/kismet/files/kismet_ui.conf b/net/kismet/files/kismet_ui.conf
new file mode 100644 (file)
index 0000000..e704b37
--- /dev/null
@@ -0,0 +1,61 @@
+# Kismet GUI config file
+
+# Version of Kismet config
+version=2005.04.R1
+
+# Do we show the intro window?
+showintro=false
+
+# Gui type to use
+# Valid types: curses, panel
+gui=panel
+# Server to connect to (host:port)
+host=localhost:2501
+# Network traffic decay (active/recent/inactive) and packet click rate - increase
+# this if you are doing prism2 channel hopping.
+decay=3
+# What columns do we display?  Comma seperated.  Read the documentation for what 
+# columns are valid.
+columns=decay,name,type,wep,channel,packets,flags,ip,size
+# What columns do we display for clients?  Comma seperated.
+clientcolumns=decay,type,mac,manuf,data,crypt,size,ip,signal,quality,noise
+
+# Do we auotmatically make a group for probed networks or do we show them
+# amidst other networks?
+autogroup_probe=true
+# Do we autogroup data-only networks?
+autogroup_data=true
+
+# Display battery status?
+apm=false
+
+# Simple borders (use - and | instead of smooth vertical and horizontal
+# lines.  This is required on Zaurus, and might be needed elsewhere if your
+# terminal doesn't display the border characters correctly.
+simpleborders=false
+
+# Colors (front, back) of text in the panel front.  Valid colors are:
+# black, red, yellow, green, blue, magenta, cyan, white
+# optionally prefixed with "hi-" for bold/bright colors, ie
+# hi-red, hi-yellow, hi-green, etc.
+
+# Enable colors?  
+color=true
+# Background
+backgroundcolor=black
+# Default text
+textcolor=white
+# Window borders
+bordercolor=green
+# Titles
+titlecolor=hi-white
+# GPS and APM info
+monitorcolor=hi-white
+# WEP network color
+wepcolor=hi-green
+# Factory network color
+factorycolor=hi-red
+# Open color
+opencolor=hi-yellow
+# Decloaked network color
+cloakcolor=hi-blue
diff --git a/net/kismet/patches/010-dont-add-host-include-paths.patch b/net/kismet/patches/010-dont-add-host-include-paths.patch
new file mode 100644 (file)
index 0000000..23a87bd
--- /dev/null
@@ -0,0 +1,14 @@
+diff --git a/configure b/configure
+index 6936a47..9a85269 100755
+--- a/configure
++++ b/configure
+@@ -6980,9 +6980,6 @@ else
+ fi
+-# Add additional cflags since some distros bury panel.h
+-CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses"
+-
+ termcontrol="none";
+ if test "$wantclient" = "yes"; then
diff --git a/net/knock/Makefile b/net/knock/Makefile
new file mode 100644 (file)
index 0000000..62866fd
--- /dev/null
@@ -0,0 +1,92 @@
+#
+# Copyright (C) 2006 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:=knock
+PKG_VERSION:=0.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.zeroflux.org/proj/knock/files/
+PKG_MD5SUM:=ca09d61458974cff90a700aba6120891
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/knock/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall
+  DEPENDS:=+libpcap
+  TITLE:=Port-knocking
+  URL:=http://www.zeroflux.org/projects/knock
+endef
+
+define Package/knock
+  $(call Package/knock/Default)
+  TITLE+= (client)
+endef
+
+define Package/knock/Default/description
+       It listens to all traffic on an ethernet (or PPP) interface,
+       looking for special "knock" sequences of port-hits. A client
+       makes these port-hits by sending a TCP (or UDP) packet to a
+       port on the server. This port need not be open -- since
+       knockd listens at the link-layer level, it sees all traffic
+       even if it's destined for a closed port. When the server
+       detects a specific sequence of port-hits, it runs a command
+       defined in its configuration file. This can be used to open
+       up holes in a firewall for quick access.
+endef
+
+define Package/knock/description
+  $(call Package/knock/Default/description)
+  This package contains the port-knocking client.
+endef
+
+define Package/knockd
+  $(call Package/knock/Default)
+  TITLE+= (server)
+endef
+
+define Package/knockd/description
+  $(call Package/knock/Default/description)
+  This package contains the port-knocking server.
+endef
+
+define Package/knockd/conffiles
+/etc/knockd.conf
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               , \
+               CFLAGS="$$$$CFLAGS $$$$CPPFLAGS" \
+                ac_cv_lib_pcap_pcap_open_live=yes \
+        )
+endef
+       
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+       
+define Package/knock/install   
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/knock $(1)/usr/bin/
+endef
+
+define Package/knockd/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/knockd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/knockd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,knock))
+$(eval $(call BuildPackage,knockd))
diff --git a/net/knock/patches/010_eglibc_define_PATH_MAX.patch b/net/knock/patches/010_eglibc_define_PATH_MAX.patch
new file mode 100644 (file)
index 0000000..0e7f56e
--- /dev/null
@@ -0,0 +1,11 @@
+diff -Naur knock-0.5/src/knockd.c knock-0.5-new/src/knockd.c
+--- knock-0.5/src/knockd.c     2005-06-27 08:11:34.000000000 +0300
++++ knock-0.5-new/src/knockd.c 2012-07-31 22:49:13.670323836 +0300
+@@ -46,6 +46,7 @@
+ #include <syslog.h>
+ #include <pcap.h>
+ #include <errno.h>
++#include <limits.h> /* PATH_MAX in eglibc env */
+ #include "list.h"
+
+ static char version[] = "0.5";
diff --git a/net/l2tpd/Makefile b/net/l2tpd/Makefile
new file mode 100644 (file)
index 0000000..0ca884f
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2006 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:=l2tpd
+PKG_VERSION:=0.70pre
+PKG_UPSTREAM_VERSION:=0.70-pre20031121
+PKG_RELEASE:=4.1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_UPSTREAM_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/l/l2tpd
+PKG_MD5SUM:=3f2707b6e16a8cb72e7bf64f574202fa
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).orig
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/l2tpd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon
+  URL:=http://l2tpd.sourceforge.net/
+  SUBMENU:=VPN
+endef
+
+define Package/l2tpd/description
+       l2tpd is the open source implementation of the L2TP tunneling
+       protocol (RFC2661). It does implement both LAC and LNS role
+       in a L2TP networking architecture. The main goal of this protocol is
+       to tunnel PPP frame trough an ip network.
+endef
+
+define Package/l2tpd/conffiles
+/etc/l2tpd/l2tpd.conf
+/etc/ppp/options.l2tpd
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CFLAGS="$(TARGET_CFLAGS) -I. -DLINUX -DSANITY -DIP_ALLOCATION" \
+       )
+endef
+
+define Package/l2tpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/l2tpd
+       $(INSTALL_DATA) ./files/l2tpd.conf $(1)/etc/l2tpd/
+       $(INSTALL_DIR) $(1)/etc/ppp
+       $(INSTALL_DATA) ./files/options.l2tpd $(1)/etc/ppp/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/l2tpd.init $(1)/etc/init.d/l2tpd
+endef
+
+$(eval $(call BuildPackage,l2tpd))
diff --git a/net/l2tpd/files/l2tpd.conf b/net/l2tpd/files/l2tpd.conf
new file mode 100644 (file)
index 0000000..2a9ba1c
--- /dev/null
@@ -0,0 +1,29 @@
+;
+; This is a minimal sample l2tpd configuration file for use
+; with L2TP over IPsec.
+;
+; The idea is to provide an L2TP daemon to which remote Windows L2TP/IPsec
+; clients connect. In this example, the internal (protected) network 
+; is 192.168.1.0/24.  A special IP range within this network is reserved
+; for the remote clients: 192.168.1.128/25
+; (i.e. 192.168.1.128 ... 192.168.1.254)
+;
+; The listen-addr parameter can be used if you want to bind the L2TP daemon
+; to a specific IP address instead of to all interfaces. For instance,
+; you could bind it to the interface of the internal LAN (e.g. 192.168.1.98
+; in the example below). Yet another IP address (local ip, e.g. 192.168.1.99)
+; will be used by l2tpd as its address on pppX interfaces.
+
+[global]
+; listen-addr = 192.168.1.98
+
+[lns default]
+ip range = 192.168.1.128-192.168.1.254
+local ip = 192.168.1.99
+require chap = yes
+refuse pap = yes
+require authentication = yes
+name = LinuxVPNserver
+ppp debug = yes
+pppoptfile = /etc/ppp/options.l2tpd
+length bit = yes
diff --git a/net/l2tpd/files/l2tpd.init b/net/l2tpd/files/l2tpd.init
new file mode 100644 (file)
index 0000000..7549c19
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=60
+BIN=l2tpd
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       $BIN $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
+
diff --git a/net/l2tpd/files/options.l2tpd b/net/l2tpd/files/options.l2tpd
new file mode 100644 (file)
index 0000000..425a56e
--- /dev/null
@@ -0,0 +1,17 @@
+ipcp-accept-local
+ipcp-accept-remote
+ms-dns  192.168.1.1
+ms-dns  192.168.1.3
+ms-wins 192.168.1.2
+ms-wins 192.168.1.4
+noccp
+auth
+crtscts
+idle 1800
+mtu 1410
+mru 1410
+nodefaultroute
+debug
+lock
+proxyarp
+connect-delay 5000
diff --git a/net/l2tpd/patches/001-debian-2.patch b/net/l2tpd/patches/001-debian-2.patch
new file mode 100644 (file)
index 0000000..8a6e204
--- /dev/null
@@ -0,0 +1,3394 @@
+--- l2tpd-0.70-pre20031121.orig/Makefile
++++ l2tpd-0.70-pre20031121/Makefile
+@@ -28,7 +28,8 @@
+ # become runtime options) debugging flags
+ #
+ #DFLAGS= -g -O2 -DDEBUG_PPPD
+-DFLAGS= -g -O2 -DDEBUG_PPPD -DDEBUG_CONTROL -DDEBUG_ENTROPY
++#DFLAGS= -g -O2 -Wall -DDEBUG_PPPD -DDEBUG_CONTROL -DDEBUG_ENTROPY
++DFLAGS= -ggdb -Wall -DDEBUG_PPPD -DDEBUG_CONTROL -DDEBUG_ENTROPY
+ #
+ # Uncomment the next line for Linux
+ #
+@@ -58,7 +59,7 @@
+ FFLAGS= -DIP_ALLOCATION 
+-CFLAGS= $(DFLAGS) -Wall -DSANITY $(OSFLAGS) $(FFLAGS)
++CFLAGS= $(DFLAGS) -Wall -DSANITY $(OSFLAGS) $(FFLAGS) 
+ HDRS=l2tp.h avp.h misc.h control.h call.h scheduler.h file.h aaa.h md5.h
+ OBJS=l2tpd.o pty.o misc.o control.o avp.o call.o network.o avpsend.o scheduler.o file.o aaa.o md5.o
+ LIBS= $(OSLIB) # -lefence # efence for malloc checking
+--- l2tpd-0.70-pre20031121.orig/control.c
++++ l2tpd-0.70-pre20031121/control.c
+@@ -227,7 +227,7 @@
+             add_bearer_caps_avp (buf, t->ourbc);
+             /* FIXME:  Tie breaker */
+             add_firmware_avp (buf);
+-            add_hostname_avp (buf);
++            add_hostname_avp (buf, t);
+             add_vendor_avp (buf);
+             add_tunnelid_avp (buf, t->ourtid);
+             if (t->ourrws >= 0)
+@@ -346,7 +346,6 @@
+                      "%s: Peer did not specify assigned tunnel ID.  Closing.\n",
+                      __FUNCTION__);
+             set_error (c, VENDOR_ERROR, "Specify your assigned tunnel ID");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         if (!(t->lns = get_lns (t)))
+@@ -356,7 +355,6 @@
+                      "%s: Denied connection to unauthorized peer %s\n",
+                      __FUNCTION__, IPADDY (t->peer.sin_addr));
+             set_error (c, VENDOR_ERROR, "No Authorization");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         t->ourrws = t->lns->tun_rws;
+@@ -368,7 +366,6 @@
+                      "%s: Peer did not specify framing capability.  Closing.\n",
+                      __FUNCTION__);
+             set_error (c, VENDOR_ERROR, "Specify framing capability");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         /* FIXME: Do we need to be sure they specified a version number?
+@@ -380,7 +377,6 @@
+          if (DEBUG) log(LOG_DEBUG,
+          "%s: Peer did not specify bearer capability.  Closing.\n",__FUNCTION__);
+          set_error(c, VENDOR_ERROR, "Specify bearer capability");
+-         c->needclose = -1;
+          return -EINVAL;
+          }  */
+         if ((!strlen (t->hostname)) && ((t->chal_us.state) || ((t->lns->challenge))))
+@@ -390,7 +386,6 @@
+                      "%s: Peer did not specify hostname.  Closing.\n",
+                      __FUNCTION__);
+             set_error (c, VENDOR_ERROR, "Specify your hostname");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         y = tunnels.head;
+@@ -427,7 +422,7 @@
+         add_frame_caps_avp (buf, t->ourfc);
+         add_bearer_caps_avp (buf, t->ourbc);
+         add_firmware_avp (buf);
+-        add_hostname_avp (buf);
++        add_hostname_avp (buf, t);
+         add_vendor_avp (buf);
+         add_tunnelid_avp (buf, t->ourtid);
+         if (t->ourrws >= 0)
+@@ -481,7 +476,6 @@
+                      "%s: Peer did not specify framing capability.  Closing.\n",
+                      __FUNCTION__);
+             set_error (c, VENDOR_ERROR, "Specify framing capability");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         /* FIXME: Do we need to be sure they specified a version number?
+@@ -493,7 +487,6 @@
+          if (DEBUG) log(LOG_DEBUG,
+          "%s: Peer did not specify bearer capability.  Closing.\n",__FUNCTION__);
+          set_error(c, VENDOR_ERROR, "Specify bearer capability");
+-         c->needclose = -1;
+          return -EINVAL;
+          } */
+         if ((!strlen (t->hostname)) && ((t->chal_them.state) || ((t->chal_us.state))))
+@@ -503,7 +496,6 @@
+                      "%s: Peer did not specify hostname.  Closing.\n",
+                      __FUNCTION__);
+             set_error (c, VENDOR_ERROR, "Specify your hostname");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         if (t->tid <= 0)
+@@ -513,7 +505,6 @@
+                      "%s: Peer did not specify assigned tunnel ID.  Closing.\n",
+                      __FUNCTION__);
+             set_error (c, VENDOR_ERROR, "Specify your assigned tunnel ID");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+         if (t->chal_them.state)
+@@ -524,7 +515,6 @@
+                 set_error (c, VENDOR_ERROR, "No secret key on our side");
+                 log (LOG_WARN, "%s: No secret key for authenticating '%s'\n",
+                      __FUNCTION__, t->hostname);
+-                c->needclose = -1;
+                 return -EINVAL;
+             }
+             if (memcmp
+@@ -534,7 +524,6 @@
+                            "Invalid challenge authentication");
+                 log (LOG_DEBUG, "%s: Invalid authentication for host '%s'\n",
+                      __FUNCTION__, t->hostname);
+-                c->needclose = -1;
+                 return -EINVAL;
+             }
+         }
+@@ -546,7 +535,6 @@
+                 log (LOG_WARN, "%s: No secret for authenticating to '%s'\n",
+                      __FUNCTION__, t->hostname);
+                 set_error (c, VENDOR_ERROR, "No secret key on our end");
+-                c->needclose = -1;
+                 return -EINVAL;
+             };
+         }
+@@ -606,7 +594,6 @@
+                            "Invalid challenge authentication");
+                 log (LOG_DEBUG, "%s: Invalid authentication for host '%s'\n",
+                      __FUNCTION__, t->hostname);
+-                c->needclose = -1;
+                 return -EINVAL;
+             }
+         }
+@@ -1584,6 +1571,14 @@
+     wbuf[pos++] = e;
+     for (x = 0; x < buf->len; x++)
+     {
++              // we must at least still have 4 bytes left in the worst case scenario:
++              // 1 for a possible escape, 1 for the value and 1 to end the PPP stream.
++              if(pos >= (sizeof(wbuf) - 4)) {
++                      if(DEBUG)
++                              log(LOG_CRIT, "%s: rx packet is too big after PPP encoding (size %u, max is %u)\n", 
++                                                      __FUNCTION__, buf->len, MAX_RECV_SIZE);
++                      return -EINVAL;
++              }
+         e = *((char *) buf->start + x);
+         if ((e < 0x20) || (e == PPP_ESCAPE) || (e == PPP_FLAG))
+         {
+@@ -1592,7 +1587,6 @@
+             wbuf[pos++] = PPP_ESCAPE;
+         }
+         wbuf[pos++] = e;
+-
+     }
+     wbuf[pos++] = PPP_FLAG;
+     x = write (c->fd, wbuf, pos);
+--- l2tpd-0.70-pre20031121.orig/misc.h
++++ l2tpd-0.70-pre20031121/misc.h
+@@ -80,4 +80,11 @@
+ extern void safe_copy (char *, char *, int);
+ extern void opt_destroy (struct ppp_opts *);
+ extern struct ppp_opts *add_opt (struct ppp_opts *, char *, ...);
++extern u_int16_t get16(u_int8_t *);
++extern u_int32_t get32(u_int8_t *);
++extern u_int64_t get64(u_int8_t *);
++extern void set16(u_int8_t *, u_int16_t);
++extern void set32(u_int8_t *, u_int32_t);
++extern void set64(u_int8_t *, u_int64_t);
++
+ #endif
+--- l2tpd-0.70-pre20031121.orig/avp.h
++++ l2tpd-0.70-pre20031121/avp.h
+@@ -19,22 +19,35 @@
+ struct avp_hdr
+ {
+-    _u16 length;
+-    _u16 vendorid;
+-    _u16 attr;
++    u_int16_t length;
++    u_int16_t vendorid;
++    u_int16_t attr;
+ };
++#define AVP_F_MANDATORY       0x1
++#define AVP_F_FIXLEN  0x2
++#define AVP_F_ASCII           0x4
++
+ struct avp
+ {
+-    int num;                    /* Number of AVP */
+-    int m;                      /* Set M? */
+-    int (*handler) (struct tunnel *, struct call *, void *, int);
+-    /* This should handle the AVP
+-       taking a tunnel, call, the data,
+-       and the length of the AVP as
+-       parameters.  Should return 0
+-       upon success */
+-    char *description;          /* A name, for debugging */
++    u_int32_t         num;                            /* Number of AVP */
++    u_int32_t flags;
++      u_int32_t       sz;                                     /* expected avp payload size as
++                                                                       * (AVP_F_FIXLEN) ? (==) : (!>=)
++                                                                       * note: size checked is performed 
++                                                                       * after unhiding */
++      u_int8_t        allowed_states[8];      /* List of allowed message types for
++                                                                       * a particular avp. Fixed len for
++                                                                       * alignement issues. */
++
++    /* This should handle the AVP taking a tunnel, call, 
++       * the data, and the length of the AVP as parameters.  
++       * Should return 0 upon success */
++    int (*handle) (struct tunnel *, struct call *, void *, int);
++
++      /* This should handle avp specifics sanity checks */
++      int (*validate) (int, struct tunnel *, struct call *, void *, int);
++    char *description;                /* A name, for debugging */
+ };
+ extern int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c);
+@@ -84,8 +97,56 @@
+ #define RESULT_CLEAR 1
+ #define RESULT_ERROR 2
+ #define RESULT_EXISTS 3
++
++/* avp id's */
++#define       MESSAGE_TYPE_AVP                0
++#define RESULT_CODE_AVP                       1
++#define PROTOCOL_VERSION_AVP  2
++#define       FRAMING_CAP_AVP                 3
++#define       BEARER_CAP_AVP                  4
++#define TIE_BREAKER_AVP                       5
++#define       FIRMWARE_REV_AVP                6
++#define       HOSTNAME_AVP                    7
++#define VENDOR_NAME_AVP                       8
++#define ASSIGNED_TUN_ID_AVP           9
++#define       RX_WIN_SIZE_AVP                 10
++#define       CHALLENGE_AVP                   11
++#define       CHALLENGE_RESP_AVP              12
++#define       CAUSE_ERROR_AVP                 13
++#define       ASSIGNED_SES_ID_AVP             14
++#define       SERIAL_NUMBER_AVP               15
++#define       MIN_BPS_AVP                             16
++#define       MAX_BPS_AVP                             17
++#define       BEARER_TYPE_AVP                 18
++#define       FRAMING_TYPE_AVP                19
++#define       PACKET_DELAY_AVP                20
++#define       CALLED_NUMBER_AVP               21
++#define CALLING_NUMBER_AVP            22
++#define       SUB_ADDRESS_AVP                 23
++#define       TX_CONNECT_SPEED_AVP    24
++#define       PHYS_CHAN_ID_AVP                25
++#define       INIT_RX_LCP_AVP                 26
++#define       LAST_TX_LCP_AVP                 27
++#define       LAST_RX_LCP_AVP                 28
++#define       PROXY_AUTH_TYPE_AVP             29
++#define       PROXY_AUTH_NAME_AVP             30
++#define       PROXY_AUTH_CHAL_AVP             31
++#define       PROXY_AUTH_ID_AVP               32
++#define       PROXY_AUTH_CHAL_RESP_AVP        33
++#define CALL_ERROR_AVP                        34
++#define       ACCM_AVP                                35
++#define RANDOM_VECTOR_AVP             36
++#define       PRIV_GROUP_ID_AVP               37
++#define       RX_CONNECT_SPEED_AVP    38
++#define       SEQ_REQUIRED_AVP                39
++#define AVP_MAX                               SEQ_REQUIRED_AVP
++
++extern int validate_msgtype_avp(int, struct tunnel *, struct call *, void *, int);
++extern int validate_gen_avp(int, struct tunnel *, struct call *, void *, int);
++
+ extern void encrypt_avp (struct buffer *, _u16, struct tunnel *);
+ extern int decrypt_avp (char *, struct tunnel *);
++
+ extern int message_type_avp (struct tunnel *, struct call *, void *, int);
+ extern int protocol_version_avp (struct tunnel *, struct call *, void *, int);
+ extern int framing_caps_avp (struct tunnel *, struct call *, void *, int);
+@@ -97,12 +158,12 @@
+ extern int receive_window_size_avp (struct tunnel *, struct call *, void *,
+                                     int);
+ extern int result_code_avp (struct tunnel *, struct call *, void *, int);
+-extern int assigned_call_avp (struct tunnel *, struct call *, void *, int);
++extern int assigned_session_avp (struct tunnel *, struct call *, void *, int);
+ extern int call_serno_avp (struct tunnel *, struct call *, void *, int);
+ extern int bearer_type_avp (struct tunnel *, struct call *, void *, int);
+ extern int call_physchan_avp (struct tunnel *, struct call *, void *, int);
+-extern int dialed_number_avp (struct tunnel *, struct call *, void *, int);
+-extern int dialing_number_avp (struct tunnel *, struct call *, void *, int);
++extern int called_number_avp (struct tunnel *, struct call *, void *, int);
++extern int calling_number_avp (struct tunnel *, struct call *, void *, int);
+ extern int sub_address_avp (struct tunnel *, struct call *, void *, int);
+ extern int frame_type_avp (struct tunnel *, struct call *, void *, int);
+ extern int rx_speed_avp (struct tunnel *, struct call *, void *, int);
+@@ -118,7 +179,7 @@
+ extern int add_avp_rws (struct buffer *, _u16);
+ extern int add_tunnelid_avp (struct buffer *, _u16);
+ extern int add_vendor_avp (struct buffer *);
+-extern int add_hostname_avp (struct buffer *);
++extern int add_hostname_avp (struct buffer *, struct tunnel*);
+ extern int add_firmware_avp (struct buffer *);
+ extern int add_bearer_caps_avp (struct buffer *buf, _u16 caps);
+ extern int add_frame_caps_avp (struct buffer *buf, _u16 caps);
+--- l2tpd-0.70-pre20031121.orig/network.c
++++ l2tpd-0.70-pre20031121/network.c
+@@ -214,6 +214,8 @@
+                 t->self->needclose = -1;
+             }
+         }
++              free(buf->rstart);
++              free(buf);
+     }
+     else
+     {
+@@ -371,7 +373,9 @@
+                 if (debug_network)
+                 {
+                     log (LOG_DEBUG, "%s: recv packet from %s, size = %d," \
+-"tunnel = %d, call = %d\n", __FUNCTION__, inet_ntoa (from.sin_addr), recvsize, tunnel, call);
++                                                                      "tunnel = %d, call = %d\n", __func__, 
++                                                                      inet_ntoa (from.sin_addr), recvsize, 
++                                                                      tunnel, call);
+                 }
+                 if (packet_dump)
+                 {
+--- l2tpd-0.70-pre20031121.orig/aaa.c
++++ l2tpd-0.70-pre20031121/aaa.c
+@@ -209,9 +209,11 @@
+                  __FUNCTION__, u, t, s);
+ #endif
+             strncpy (secret, s, size);
++                      fclose(f);
+             return -1;
+         }
+     }
++      fclose(f);
+     return 0;
+ }
+--- l2tpd-0.70-pre20031121.orig/l2tpd.c
++++ l2tpd-0.70-pre20031121/l2tpd.c
+@@ -266,6 +266,9 @@
+     /* erase pid file */
+       unlink (gconfig.pidfile);
++      /* erase control pipe */
++      unlink(CONTROL_PIPE);
++
+     exit (1);
+ }
+@@ -333,13 +336,17 @@
+         tcgetattr (c->fd, &ptyconf);
+         *(c->oldptyconf) = ptyconf;
+         ptyconf.c_cflag &= ~(ICANON | ECHO);
+-        ptyconf.c_lflag &= ~ECHO;
++              ptyconf.c_lflag &= ~ECHO;
+         tcsetattr (c->fd, TCSANOW, &ptyconf);
+         snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
+         fd2 = open (tty, O_RDWR);
+-      stropt[pos++] = strdup(tty);
+-      stropt[pos] = NULL;
++              if(!fd2)
++                      log(LOG_WARN, "unable to open tty %s", tty);
++
++              /* XXX JEF: CHECK ME */
++              stropt[pos++] = strdup(tty);
++              stropt[pos] = NULL;
+ #ifdef USE_KERNEL
+     }
+@@ -623,7 +630,13 @@
+ {
+     struct lac *lac;
+     lac = (struct lac *) data;
+-    if (!lac->active)
++
++    if (!lac)
++    {
++        log (LOG_WARN, "%s : called on NULL lac!\n", __FUNCTION__);
++        return;
++    }
++      if (!lac->active)
+     {
+         log (LOG_DEBUG, "%s: LAC %s not active", __FUNCTION__, lac->entname);
+         return;
+@@ -635,11 +648,6 @@
+         log (LOG_LOG, "%s: maximum retries exceeded.\n", __FUNCTION__);
+         return;
+     }
+-    if (!lac)
+-    {
+-        log (LOG_WARN, "%s : called on NULL lac!\n", __FUNCTION__);
+-        return;
+-    }
+     if (!lac->t)
+     {
+ #ifdef DEGUG_MAGIC
+@@ -774,12 +782,7 @@
+ void do_control ()
+ {
+     char buf[1024];
+-    char *host;
+-    char *tunstr;
+-    char *callstr;
+-
+-    char *sub_str;              /* jz: use by the strtok function */
+-    char *tmp_ptr;              /* jz: use by the strtok function */
++    char *host, *tunstr, *callstr, *tmpstr;
+     struct lac *lac;
+     int call;
+     int tunl;
+@@ -792,24 +795,39 @@
+             if (buf[cnt - 1] == '\n')
+                 buf[--cnt] = 0;
+ #ifdef DEBUG_CONTROL
+-            log (LOG_DEBUG, "%s: Got message %s (%d bytes long)\n",
++            log (LOG_DEBUG, "%s: Got message \"%s\" (%d bytes long)\n",
+                  __FUNCTION__, buf, cnt);
+ #endif
+             switch (buf[0])
+             {
+             case 't':
+-                host = strchr (buf, ' ') + 1;
++                host = strchr (buf, ' ');
++                              if(!host)
++                                      goto out;
++                              host++;
+ #ifdef DEBUG_CONTROL
+                 log (LOG_DEBUG, "%s: Attempting to tunnel to %s\n",
+                      __FUNCTION__, host);
+ #endif
+                 l2tp_call (host, UDP_LISTEN_PORT, NULL, NULL);
+                 break;
+-            case 'c':
+-
+-                switch_io = 1;  /* jz: Switch for Incoming - Outgoing Calls */
+-
+-                tunstr = strchr (buf, ' ') + 1;
++            case 'c':            /* option 'c' for incoming call */
++            case 'o':          /* option 'o' for outgoing call */
++                              tunstr = strchr (buf, ' ');
++                              if(!tunstr)
++                                      goto out;
++                              tunstr++;
++
++                              if(buf[0] == 'c')
++                      switch_io = 1;  /* Switch for Incoming Calls */
++                              else {
++                      switch_io = 0;  /* Switch for Outgoing Calls */
++                                      tmpstr = strchr(tunstr, ' ');
++                                      if(!tmpstr)
++                                              goto out;
++                                      strncpy(dial_no_tmp,tmpstr, sizeof(*dial_no_tmp));
++                              }
++                
+                 lac = laclist;
+                 while (lac)
+                 {
+@@ -842,52 +860,12 @@
+ #endif
+                 lac_call (tunl, NULL, NULL);
+                 break;
+-
+-            case 'o':          /* jz: option 'o' for doing a outgoing call */
+-
+-                switch_io = 0;  /* jz: Switch for incoming - outgoing Calls */
+-
+-                sub_str = strchr (buf, ' ') + 1;
+-
+-                tunstr = strtok (sub_str, " "); /* jz: using strtok function to get */
+-                tmp_ptr = strtok (NULL, " ");   /*     params out of the pipe       */
+-                strcpy (dial_no_tmp, tmp_ptr);
+-
+-                lac = laclist;
+-                while (lac)
+-                {
+-                    if (!strcasecmp (lac->entname, tunstr))
+-                    {
+-                        lac->active = -1;
+-                        lac->rtries = 0;
+-                        if (!lac->c)
+-                            magic_lac_dial (lac);
+-                        else
+-                            log (LOG_DEBUG,
+-                                 "%s: Session '%s' already active!\n",
+-                                 __FUNCTION__, lac->entname);
+-                        break;
+-                    }
+-                    lac = lac->next;
+-                }
+-                if (lac)
+-                    break;
+-                tunl = atoi (tunstr);
+-                if (!tunl)
+-                {
+-                    log (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
+-                         tunstr);
+-                    break;
+-                }
+-#ifdef DEBUG_CONTROL
+-                log (LOG_DEBUG, "%s: Attempting to call on tunnel %d\n",
+-                     __FUNCTION__, tunl);
+-#endif
+-                lac_call (tunl, NULL, NULL);
+-                break;
+-
+             case 'h':
+-                callstr = strchr (buf, ' ') + 1;
++                callstr = strchr (buf, ' ');
++                if(!callstr)
++                                      goto out;
++                              callstr++;
++
+                 call = atoi (callstr);
+ #ifdef DEBUG_CONTROL
+                 log (LOG_DEBUG, "%s: Attempting to call %d\n", __FUNCTION__,
+@@ -896,7 +874,11 @@
+                 lac_hangup (call);
+                 break;
+             case 'd':
+-                tunstr = strchr (buf, ' ') + 1;
++                tunstr = strchr (buf, ' ');
++                if(!tunstr)
++                                      goto out;
++                              tunstr++;
++
+                 lac = laclist;
+                 while (lac)
+                 {
+@@ -937,6 +919,8 @@
+             }
+         }
+     }
++
++out:
+     /* Otherwise select goes nuts */
+     close (control_fd);
+     control_fd = open (CONTROL_PIPE, O_RDONLY | O_NONBLOCK, 0600);
+@@ -1002,7 +986,6 @@
+     int pid=0;
+     int i,l;
+     char buf[STRLEN];
+-    int pidfilewritten=0;
+     if((pid = fork()) < 0) {
+         log(LOG_LOG, "%s: Unable to fork ()\n",__FUNCTION__);
+@@ -1012,56 +995,52 @@
+     else if (pid)
+         exit(0);
+-    close(0);
+-    close(1);
+-    close(2);
++
++      close(0);
++      close(1);
++      close(2);
++      dup2(open("/dev/null", O_RDONLY), 0);
++      dup2(open("/dev/null", O_RDONLY), 1);
++      dup2(open("/dev/null", O_RDONLY), 2);
+     /* Read previous pid file. */
+-    if ((i = open(gconfig.pidfile,O_RDONLY)) > 0) {
+-        l=read(i,buf,sizeof(buf)-1);
+-        if (i < 0) {
+-            log(LOG_LOG, "%s: Unable to read pid file [%s]\n",
+-                    __FUNCTION__, gconfig.pidfile);
+-        }
+-        buf[i] = '\0';
+-        pid = atoi(buf);
+-
+-        /* If the previous server process is not still running,
+-           write a new pid file immediately. */
+-        if (pid && (pid == getpid () || kill (pid, 0) < 0)) {
+-            unlink (gconfig.pidfile);
+-            if ((i = open (gconfig.pidfile, O_WRONLY | O_CREAT, 0640)) >= 0)
+-            {
+-                snprintf (buf, sizeof(buf), "%d\n", (int)getpid());
+-                write (i, buf, strlen(buf));
+-                close (i);
+-                pidfilewritten = 1;
+-            }
++    if((i = open(gconfig.pidfile,O_RDONLY)) > 0) {
++              l=read(i,buf,sizeof(buf)-1);                                                             
++        if (l >= 0) {
++              buf[l] = '\0';                                                                       
++              pid = atoi(buf);                                                                     
+         }
+-        else
+-        {
++              close(i);
++
++              /* if pid is read and process exist exit */
++        if(pid && !kill(pid, 0)) {
+             log(LOG_LOG, "%s: There's already a l2tpd server running.\n",
+                     __FUNCTION__);
+             close(server_socket);
+             exit(1);
+         }
++
++              /* remove stalled pid file */
++              unlink(gconfig.pidfile);
+     }
+     pid = setsid();
+-    if(! pidfilewritten) {
+-        unlink(gconfig.pidfile);
+-        if ((i = open (gconfig.pidfile, O_WRONLY | O_CREAT, 0640)) >= 0) {
+-            snprintf (buf, strlen(buf), "%d\n", (int)getpid());
+-            write (i, buf, strlen(buf));
+-            close (i);
+-            pidfilewritten = 1;
+-        }
+-    }
++      /* create new pid file */
++      if ((i = open (gconfig.pidfile, O_WRONLY | O_CREAT, 0644)) >= 0) {
++              snprintf (buf, sizeof(buf), "%d", (int)getpid());
++              write (i, buf, strlen(buf));
++              close (i);
++      }
++      else {
++              log(LOG_LOG, "%s: could not write pid file %s error %d",
++                              __FUNCTION__, gconfig.pidfile, i);
++              close(server_socket);
++              exit(1);
++      }
+ }
+-
+ void init (int argc,char *argv[])
+ {
+     struct lac *lac;
+@@ -1103,10 +1082,6 @@
+     }
+     log (LOG_LOG, "l2tpd version " SERVER_VERSION " started on %s PID:%d\n",
+          hostname, getpid ());
+-    log (LOG_LOG,
+-         "Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.\n");
+-    log (LOG_LOG, "Forked by Scott Balmos and David Stipp, (C) 2001\n");
+-    log (LOG_LOG, "Inherited by Jeff McAdams, (C) 2002\n");
+     listenaddr.s_addr = gconfig.listenaddr;
+     log (LOG_LOG, "%s version %s on a %s, listening on IP address %s, port %d\n", uts.sysname,
+        uts.release, uts.machine, inet_ntoa(listenaddr), gconfig.port);
+--- l2tpd-0.70-pre20031121.orig/misc.c
++++ l2tpd-0.70-pre20031121/misc.c
+@@ -301,3 +301,42 @@
+         return -1;
+     }
+ }
++
++u_int16_t get16(u_int8_t *p) {
++      return p[0] << 8 | p[1];
++}
++
++u_int32_t get32(u_int8_t *p) {
++      return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
++}
++
++u_int64_t get64(u_int8_t *p) {
++      return (u_int64_t)p[0] << 56 | (u_int64_t)p[1] << 48 |
++             (u_int64_t)p[2] << 40 | (u_int64_t)p[3] << 32 |
++             (u_int64_t)p[4] << 24 | (u_int64_t)p[5] << 16 | 
++                 (u_int64_t)p[6] << 8  | (u_int64_t)p[7];
++}
++
++void set16(u_int8_t *cp, u_int16_t x) {
++      *cp++ = x >> 8;
++    *cp = x & 0xff;
++} 
++
++void set32(u_int8_t *cp, u_int32_t x) {
++      *cp++ = x >> 24;
++    *cp++ = (x >> 16) & 0xff;
++      *cp++ = (x >> 8) & 0xff;
++      *cp = x & 0xff;
++}
++
++void set64(u_int8_t *cp, u_int64_t x) {   
++      *cp++ = x >> 56;
++      *cp++ = (x >> 48) & 0xff;
++      *cp++ = (x >> 40) & 0xff;
++      *cp++ = (x >> 32) & 0xff;
++      *cp++ = (x >> 24) & 0xff;
++      *cp++ = (x >> 16) & 0xff;
++      *cp++ = (x >> 8) & 0xff;
++      *cp = x & 0xff;
++}
++
+--- l2tpd-0.70-pre20031121.orig/avp.c
++++ l2tpd-0.70-pre20031121/avp.c
+@@ -4,9 +4,12 @@
+  * Layer Two Tunnelling Protocol Daemon
+  * Copyright (C) 1998 Adtran, Inc.
+  * Copyright (C) 2002 Jeff McAdams
++ * Copyright (C) 2003 Jean-Francois Dive
+  *
+  * Mark Spencer
+  *
++ * 12/2003    parsing sanitization, Jean-Francois Dive
++ *
+  * This software is distributed under the terms
+  * of the GPL, which you should have received
+  * along with this source.
+@@ -20,50 +23,53 @@
+ #include <netinet/in.h>
+ #include "l2tp.h"
+-#define AVP_MAX 39
++/* TODO: 
++ * - Tie breaker.
++ * - Clean Proxy Authentication solution.
++ */
++/*****************************************************************************/
+ struct avp avps[] = {
+-
+-    {0, 1, &message_type_avp, "Message Type"},
+-    {1, 1, &result_code_avp, "Result Code"},
+-    {2, 1, &protocol_version_avp, "Protocol Version"},
+-    {3, 1, &framing_caps_avp, "Framing Capabilities"},
+-    {4, 1, &bearer_caps_avp, "Bearer Capabilities"},
+-    {5, 0, NULL, "Tie Breaker"},
+-    {6, 0, &firmware_rev_avp, "Firmware Revision"},
+-    {7, 0, &hostname_avp, "Host Name"},
+-    {8, 1, &vendor_avp, "Vendor Name"},
+-    {9, 1, &assigned_tunnel_avp, "Assigned Tunnel ID"},
+-    {10, 1, &receive_window_size_avp, "Receive Window Size"},
+-    {11, 1, &challenge_avp, "Challenge"},
+-    {12, 0, NULL, "Q.931 Cause Code"},
+-    {13, 1, &chalresp_avp, "Challenge Response"},
+-    {14, 1, &assigned_call_avp, "Assigned Call ID"},
+-    {15, 1, &call_serno_avp, "Call Serial Number"},
+-    {16, 1, NULL, "Minimum BPS"},
+-    {17, 1, NULL, "Maximum BPS"},
+-    {18, 1, &bearer_type_avp, "Bearer Type"},
+-    {19, 1, &frame_type_avp, "Framing Type"},
+-    {20, 1, &packet_delay_avp, "Packet Processing Delay"},
+-    {21, 1, &dialed_number_avp, "Dialed Number"},
+-    {22, 1, &dialing_number_avp, "Dialing Number"},
+-    {23, 1, &sub_address_avp, "Sub-Address"},
+-    {24, 1, &tx_speed_avp, "Transmit Connect Speed"},
+-    {25, 1, &call_physchan_avp, "Physical channel ID"},
+-    {26, 0, NULL, "Initial Received LCP Confreq"},
+-    {27, 0, NULL, "Last Sent LCP Confreq"},
+-    {28, 0, NULL, "Last Received LCP Confreq"},
+-    {29, 1, &ignore_avp, "Proxy Authen Type"},
+-    {30, 0, &ignore_avp, "Proxy Authen Name"},
+-    {31, 0, &ignore_avp, "Proxy Authen Challenge"},
+-    {32, 0, &ignore_avp, "Proxy Authen ID"},
+-    {33, 1, &ignore_avp, "Proxy Authen Response"},
+-    {34, 1, NULL, "Call Errors"},
+-    {35, 1, &ignore_avp, "ACCM"},
+-    {36, 1, &rand_vector_avp, "Random Vector"},
+-    {37, 1, NULL, "Private Group ID"},
+-    {38, 0, &rx_speed_avp, "Receive Connect Speed"},
+-    {39, 1, &seq_reqd_avp, "Sequencing Required"}
++    {0, AVP_F_MANDATORY|AVP_F_FIXLEN, 2, {0}, &message_type_avp, &validate_msgtype_avp, "Message Type"},
++    {1, AVP_F_MANDATORY, MAXSTRLEN, {CDN, StopCCN}, &result_code_avp, &validate_gen_avp, "Result Code"},
++    {2, AVP_F_MANDATORY|AVP_F_FIXLEN, 2, {SCCRP, SCCRQ}, &protocol_version_avp, &validate_gen_avp, "Protocol Version"},
++    {3, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {SCCRP, SCCRQ}, &framing_caps_avp, &validate_gen_avp, "Framing Capabilities"},
++    {4, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {SCCRP, SCCRQ}, &bearer_caps_avp, &validate_gen_avp, "Bearer Capabilities"},
++    {5, 0, 0, {0}, NULL, NULL, "Tie Breaker"},
++    {6, AVP_F_FIXLEN, 2, {SCCRP, SCCRQ}, &firmware_rev_avp, &validate_gen_avp, "Firmware Revision"},
++    {7, AVP_F_ASCII, MAXSTRLEN, {SCCRP, SCCRQ}, &hostname_avp, &validate_gen_avp, "Host Name"},
++    {8, AVP_F_MANDATORY|AVP_F_ASCII, MAXSTRLEN, {SCCRP, SCCRQ}, &vendor_avp, &validate_gen_avp, "Vendor Name"},
++    {9, AVP_F_MANDATORY|AVP_F_FIXLEN, 2, {SCCRP, SCCRQ, StopCCN}, &assigned_tunnel_avp, &validate_gen_avp, "Assigned Tunnel ID"},
++    {10, AVP_F_MANDATORY|AVP_F_FIXLEN, 2,{SCCRP, SCCRQ, OCRP, OCCN, StopCCN}, &receive_window_size_avp, &validate_gen_avp, "Receive Window Size"},
++    {11, AVP_F_MANDATORY, 128, {SCCRP, SCCRQ}, &challenge_avp, &validate_gen_avp, "Challenge"},
++    {12, 0, 0, {0}, NULL, NULL, "Q.931 Cause Code"},
++    {13, AVP_F_MANDATORY, MD_SIG_SIZE, {SCCRP, SCCCN}, &chalresp_avp, &validate_gen_avp, "Challenge Response"},
++    {14, AVP_F_MANDATORY|AVP_F_FIXLEN, 2, {CDN, ICRP, ICRQ, OCRP, OCRQ}, &assigned_session_avp, &validate_gen_avp, "Assigned Session ID"},
++    {15, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {ICRQ, OCRQ}, &call_serno_avp, &validate_gen_avp, "Call Serial Number"},
++    {16, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {0}, NULL, NULL, "Minimum BPS"},
++    {17, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {0}, NULL, NULL, "Maximum BPS"},
++    {18, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {ICRQ, OCRQ}, &bearer_type_avp, &validate_gen_avp, "Bearer Type"},
++    {19, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {ICCN, OCRQ, OCCN}, &frame_type_avp, &validate_gen_avp, "Framing Type"},
++    {20, AVP_F_MANDATORY|AVP_F_FIXLEN, 2, {ICRP, OCRQ, ICCN, OCRP, OCCN}, &packet_delay_avp, &validate_gen_avp, "Packet Processing Delay"},
++    {21, AVP_F_MANDATORY|AVP_F_ASCII, MAXSTRLEN, {ICRQ, OCRQ}, &called_number_avp, &validate_gen_avp, "Called Number"},
++    {22, AVP_F_MANDATORY|AVP_F_ASCII, MAXSTRLEN, {ICRQ}, &calling_number_avp, &validate_gen_avp, "Calling Number"},
++    {23, AVP_F_MANDATORY|AVP_F_ASCII, MAXSTRLEN, {OCRP, ICRQ}, &sub_address_avp, &validate_gen_avp, "Sub-Address"},
++    {24, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {ICCN, OCCN, OCRP}, &tx_speed_avp, &validate_gen_avp, "Transmit Connect Speed"},
++    {25, AVP_F_MANDATORY|AVP_F_FIXLEN, 4, {ICRQ, OCRQ, OCRP, OCCN}, &call_physchan_avp, &validate_gen_avp, "Physical channel ID"},
++    {26, 0, 0, {0}, NULL, NULL, "Initial Received LCP Confreq"},
++    {27, 0, 0, {0}, NULL, NULL, "Last Sent LCP Confreq"},
++    {28, 0, 0, {0}, NULL, NULL, "Last Received LCP Confreq"},
++    {29, AVP_F_MANDATORY, 0, {0}, &ignore_avp, NULL, "Proxy Authen Type"},
++    {30, 0, 0, {0}, &ignore_avp, NULL, "Proxy Authen Name"},
++    {31, 0, 0, {0}, &ignore_avp, NULL, "Proxy Authen Challenge"},
++    {32, 0, 0, {0}, &ignore_avp, NULL, "Proxy Authen ID"},
++    {33, AVP_F_MANDATORY, 0, {0}, &ignore_avp, NULL, "Proxy Authen Response"},
++    {34, AVP_F_MANDATORY|AVP_F_FIXLEN, 26, {0}, NULL, NULL, "Call Errors"},
++    {35, AVP_F_MANDATORY|AVP_F_FIXLEN, 10, {0}, &ignore_avp, NULL, "ACCM"},
++    {36, AVP_F_MANDATORY, 1024, {0}, &rand_vector_avp, &validate_gen_avp, "Random Vector"},
++    {37, AVP_F_MANDATORY, 0, {0}, NULL, NULL, "Private Group ID"},
++    {38, AVP_F_FIXLEN, 4, {ICCN, OCCN, OCRP}, &rx_speed_avp, &validate_gen_avp, "Receive Connect Speed"},
++    {39, AVP_F_MANDATORY, 0, {ICCN, OCCN, OCRP}, &seq_reqd_avp, &validate_gen_avp, "Sequencing Required"}
+ };
+ char *msgtypes[] = {
+@@ -111,6 +117,7 @@
+     "Call was connected but no appropriate framing was detect"
+ };
++/*****************************************************************************/
+ void wrong_length (struct call *c, char *field, int expected, int found,
+                    int min)
+ {
+@@ -126,12 +133,9 @@
+     c->needclose = -1;
+ }
+-/*
+- * t, c, data, and datalen may be assumed to be defined for all avp's
+- */
+-
+-int message_type_avp (struct tunnel *t, struct call *c, void *data,
+-                      int datalen)
++/*****************************************************************************/
++int validate_msgtype_avp(int attr,  struct tunnel *t, struct call *c, 
++                                               void *data, int datalen)
+ {
+     /*
+      * This will be with every control message.  It is critical that this
+@@ -139,28 +143,9 @@
+      * (assuming sanity check)
+      */
+-    _u16 *raw = data;
+-    c->msgtype = ntohs (raw[3]);
+-    if (datalen != 8)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s: wrong size (%d != 8)\n", __FUNCTION__,
+-                 datalen);
+-        wrong_length (c, "Message Type", 8, datalen, 0);
+-        return -EINVAL;
+-    }
+-    if ((c->msgtype > MAX_MSG) || (!msgtypes[c->msgtype]))
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s: unknown message type %d\n", __FUNCTION__,
+-                 c->msgtype);
+-        return -EINVAL;
+-    }
+-    if (debug_avp)
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s: message type %d (%s)\n", __FUNCTION__,
+-                 c->msgtype, msgtypes[c->msgtype]);
+-#ifdef SANITY
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      c->msgtype = get16(p);
++
+     if (t->sanity)
+     {
+         /*
+@@ -172,11 +157,11 @@
+             if (DEBUG)
+                 log (LOG_DEBUG,
+                      "%s: attempting to negotiate tunnel inside a call!\n",
+-                     __FUNCTION__);
++                     __func__);
+             return -EINVAL;
+         }
+-        switch (c->msgtype)
++        switch (get16(p))
+         {
+         case SCCRQ:
+             if ((t->state != 0) && (t->state != SCCRQ))
+@@ -189,7 +174,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate SCCRQ with state != 0\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -199,7 +184,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate SCCRP with state != SCCRQ!\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -209,7 +194,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate SCCCN with state != SCCRP!\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -219,7 +204,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate ICRQ when state != SCCCN\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             if (c != t->self)
+@@ -227,7 +212,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate ICRQ on a call!\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -237,7 +222,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate ICRP on tunnel!=SCCCN\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             if (c->state != ICRQ)
+@@ -245,7 +230,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate ICRP when state != ICRQ\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -255,7 +240,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate ICCN when state != ICRP\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -265,7 +250,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate SLI when state != ICCN\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -275,7 +260,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate OCRP on tunnel!=SCCCN\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             if (c->state != OCRQ)
+@@ -283,7 +268,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate OCRP when state != OCRQ\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -294,7 +279,7 @@
+                 if (DEBUG)
+                     log (LOG_DEBUG,
+                          "%s: attempting to negotiate OCCN when state != OCRQ\n",
+-                         __FUNCTION__);
++                         __func__);
+                 return -EINVAL;
+             }
+             break;
+@@ -303,72 +288,33 @@
+         case Hello:
+             break;
+         default:
+-            log (LOG_WARN, "%s: i don't know how to handle %s messages\n",
+-                 __FUNCTION__, msgtypes[c->msgtype]);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    if (c->msgtype == ICRQ)
+-    {
+-        struct call *tmp;
+-        if (debug_avp)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG, "%s: new incoming call\n", __FUNCTION__);
+-        }
+-        tmp = new_call (t);
+-        if (!tmp)
+-        {
+-            log (LOG_WARN, "%s: unable to create new call\n", __FUNCTION__);
++            log (LOG_WARN, "%s: unknown messages type %d\n",
++                 __func__, get16(p));
+             return -EINVAL;
+         }
+-        tmp->next = t->call_head;
+-        t->call_head = tmp;
+-        t->count++;
+-        /*
+-           * Is this still safe to assume that the head will always
+-           * be the most recent call being negotiated?
+-           * Probably...  FIXME anyway...
+-         */
+-
+     }
+-    return 0;
++      return 0;
+ }
+-int rand_vector_avp (struct tunnel *t, struct call *c, void *data,
+-                     int datalen)
+-{
+-    int size;
+-    _u16 *raw = (_u16 *) data;
+-    size = (raw[0] & 0x0FFF) - 6;
+-    if (t->sanity)
+-    {
+-        if (size < 0)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG, "%s: Random vector too small (%d < 0)\n",
+-                     __FUNCTION__, size);
+-            wrong_length (c, "Random Vector", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-        if (size > MAX_VECTOR_SIZE)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG, "%s: Random vector too large (%d > %d)\n",
+-                     __FUNCTION__, datalen, MAX_VECTOR_SIZE);
+-            wrong_length (c, "Random Vector", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-    if (debug_avp)
+-        log (LOG_DEBUG, "%s: Random Vector of %d octets\n", __FUNCTION__,
+-             size);
+-    t->chal_us.vector = (unsigned char *) &raw[3];
+-    t->chal_us.vector_len = size;
+-    return 0;
++/*****************************************************************************/
++int validate_gen_avp(int attr,  struct tunnel *t, struct call *c, 
++                                       void *data, int datalen) {
++      (void)data; (void)datalen;
++      int i = 0, found = 0;
++
++    if(t->sanity) {
++              for(i = 0; i < 8; i++) {
++                      if(c->msgtype == avps[attr].allowed_states[i])
++                              found++;
++              }
++              if(!found) 
++                      return -EINVAL;
++      }
++      return 0;
+ }
++/* t, c, data, and datalen may be assumed to be defined for all avp's        */
++/*****************************************************************************/
+ int ignore_avp (struct tunnel *t, struct call *c, void *data, int datalen)
+ {
+     /*
+@@ -383,94 +329,88 @@
+      *
+      */
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s : Ignoring AVP\n", __FUNCTION__);
+-    }
++      log (LOG_DEBUG, "%s : Ignoring AVP\n", __func__);
+     return 0;
+ }
+-int seq_reqd_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int message_type_avp (struct tunnel *t, struct call *c, void *data,
++                      int avplen)
+ {
+-#ifdef SANITY
+-    if (t->sanity)
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      
++      if(!c->msgtype)
++              c->msgtype = get16(p);
++
++    if ((c->msgtype > MAX_MSG) || (!msgtypes[c->msgtype]))
+     {
+-        if (datalen != 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Sequencing Required", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-        switch (c->msgtype)
++        log (LOG_DEBUG, "%s: unknown message type %d\n", __func__,
++             c->msgtype);
++        return -EINVAL;
++    }
++    if (debug_avp)
++        log (LOG_DEBUG, "%s: message type %d (%s)\n", __func__,
++             c->msgtype, msgtypes[c->msgtype]);
++    if (c->msgtype == ICRQ)
++    {
++        struct call *tmp;
++        if (debug_avp)
++              log (LOG_DEBUG, "%s: new incoming call\n", __func__);
++        tmp = new_call (t);
++        if (!tmp)
+         {
+-        case ICCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: sequencing required not appropriate for %s!\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
++            log (LOG_WARN, "%s: unable to create new call\n", __func__);
+             return -EINVAL;
+         }
++        tmp->next = t->call_head;
++        t->call_head = tmp;
++        t->count++;
++        /*
++         * Is this still safe to assume that the head will always
++         * be the most recent call being negotiated?
++         * Probably...  FIXME anyway...
++         */
+     }
+-#endif
++    return 0;
++}
++
++/*****************************************************************************/
++int rand_vector_avp (struct tunnel *t, struct call *c, void *data,
++                     int avplen)
++{
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s: peer requires sequencing.\n", __FUNCTION__);
+-    }
++        log (LOG_DEBUG, "%s: random vector len %d\n", __func__, datalen);
++    t->chal_us.vector = (unsigned char *)p;
++    t->chal_us.vector_len = datalen;
++    return 0;
++}
++
++/*****************************************************************************/
++int seq_reqd_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++{
++    if (debug_avp)
++      log (LOG_DEBUG, "%s: peer requires sequencing.\n", __func__);
+     c->seq_reqd = -1;
+     return 0;
+ }
++/*****************************************************************************/
+ int result_code_avp (struct tunnel *t, struct call *c, void *data,
+-                     int datalen)
++                     int avplen)
+ {
+-    /*
+-     * Find out what version of l2tp the other side is using.
+-     * I'm not sure what we're supposed to do with this but whatever..
+-     */
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++    u_int16_t result = get16(p);
++    u_int16_t error = get16(p + 2);
+-    int error;
+-    int result;
+-    _u16 *raw = data;
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        if (datalen < 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d < 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Result Code", 10, datalen, 1);
+-            return -EINVAL;
+-        }
+-        switch (c->msgtype)
+-        {
+-        case CDN:
+-        case StopCCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: result code not appropriate for %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-    }
+-#endif
+-    result = ntohs (raw[3]);
+-    error = ntohs (raw[4]);
+     if ((c->msgtype == StopCCN) && ((result > 7) || (result < 1)))
+     {
+         if (DEBUG)
+             log (LOG_DEBUG,
+-                 "%s: result code out of range (%d %d %d).  Ignoring.\n",
+-                 __FUNCTION__, result, error, datalen);
++                 "%s: (StopCCN) result code out of range ! (1 < %d < 7)\n",
++                 __func__, result);
+         return 0;
+     }
+@@ -478,1112 +418,348 @@
+     {
+         if (DEBUG)
+             log (LOG_DEBUG,
+-                 "%s: result code out of range (%d %d %d).  Ignoring.\n",
+-                 __FUNCTION__, result, error, datalen);
++                 "%s: (CDN) result code out of range !(1 < %d < 11)\n",
++                 __func__, result);
+         return 0;
+     }
+     c->error = error;
+     c->result = result;
+-    safe_copy (c->errormsg, (char *) &raw[5], datalen - 10);
++      memcpy(c->errormsg, (char*)p + 4, datalen - 4);
++      c->errormsg[datalen - 4] = '\0';
++
+     if (debug_avp)
+     {
+-        if (DEBUG && (c->msgtype == StopCCN))
++        if(c->msgtype == StopCCN)
+         {
+             log (LOG_DEBUG,
+                  "%s: peer closing for reason %d (%s), error = %d (%s)\n",
+-                 __FUNCTION__, result, stopccn_result_codes[result], error,
++                 __func__, result, stopccn_result_codes[result], error,
+                  c->errormsg);
+         }
+         else
+         {
+             log (LOG_DEBUG,
+                  "%s: peer closing for reason %d (%s), error = %d (%s)\n",
+-                 __FUNCTION__, result, cdn_result_codes[result], error,
++                 __func__, result, cdn_result_codes[result], error,
+                  c->errormsg);
+         }
+     }
+     return 0;
+ }
++/*****************************************************************************/
+ int protocol_version_avp (struct tunnel *t, struct call *c, void *data,
+-                          int datalen)
++                          int avplen)
+ {
+-    /*
+-     * Find out what version of l2tp the other side is using.
+-     * I'm not sure what we're supposed to do with this but whatever..
+-     */
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-    int ver;
+-    _u16 *raw = data;
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        if (datalen != 8)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 8\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Protocol Version", 8, datalen, 1);
+-            return -EINVAL;
+-        }
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: protocol version not appropriate for %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-    }
+-#endif
+-    ver = ntohs (raw[3]);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer is using version %d, revision %d.\n", __FUNCTION__,
+-                 (ver >> 8), ver & 0xFF);
+-    }
++      log (LOG_DEBUG, "%s: peer is using version %d, revision %d.\n", 
++                       __func__,*p, *(p+1));
+     return 0;
+ }
++/*****************************************************************************/
+ int framing_caps_avp (struct tunnel *t, struct call *c, void *data,
+-                      int datalen)
++                      int avplen)
+ {
+-    /*
+-     * Retrieve the framing capabilities
+-     * from the peer
+-     */
+-
+-    int caps;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++    u_int16_t caps = get16(p + 2);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: framing capabilities not appropriate for %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Framming Capabilities", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    caps = ntohs (raw[4]);
+     if (debug_avp)
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: supported peer frames:%s%s\n", __FUNCTION__,
+-                 caps & ASYNC_FRAMING ? " async" : "",
+-                 caps & SYNC_FRAMING ? " sync" : "");
++      log (LOG_DEBUG, "%s: supported peer frames:%s %s\n", __func__,
++             caps & ASYNC_FRAMING ? "async" : "",
++             caps & SYNC_FRAMING ? "sync" : "");
++
+     t->fc = caps & (ASYNC_FRAMING | SYNC_FRAMING);
+     return 0;
+ }
++/*****************************************************************************/
+ int bearer_caps_avp (struct tunnel *t, struct call *c, void *data,
+-                     int datalen)
++                     int avplen)
+ {
+-    /*
+-     * What kind of bearer channels does our peer support?
+-     */
+-    int caps;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++    u_int16_t caps = get16(p + 2);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: bearer capabilities not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Bearer Capabilities", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    caps = ntohs (raw[4]);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-        {
+-            log (LOG_DEBUG,
+-                 "%s: supported peer bearers:%s%s\n",
+-                 __FUNCTION__,
+-                 caps & ANALOG_BEARER ? " analog" : "",
+-                 caps & DIGITAL_BEARER ? " digital" : "");
+-        }
++      log (LOG_DEBUG, "%s: supported peer bearers:%s %s\n",
++              __func__,
++              caps & ANALOG_BEARER ? "analog" : "",
++              caps & DIGITAL_BEARER ? "digital" : "");
+-    }
+     t->bc = caps & (ANALOG_BEARER | DIGITAL_BEARER);
+     return 0;
+ }
+-
+-/* FIXME: I need to handle tie breakers eventually */
+-
++/*****************************************************************************/
+ int firmware_rev_avp (struct tunnel *t, struct call *c, void *data,
+-                      int datalen)
++                      int avplen)
+ {
+-    /*
+-     * Report and record remote firmware version
+-     */
+-    int ver;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: firmware revision not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 8)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 8\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Firmware Revision", 8, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    ver = ntohs (raw[3]);
++    t->firmware = get16(p);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer reports firmware version %d (0x%.4x)\n",
+-                 __FUNCTION__, ver, ver);
+-    }
+-    t->firmware = ver;
++      log (LOG_DEBUG, "%s: peer reports firmware version %d (0x%.4X)\n",
++              __func__, t->firmware, t->firmware);
+     return 0;
+ }
++/*****************************************************************************/
+ int bearer_type_avp (struct tunnel *t, struct call *c, void *data,
+-                     int datalen)
++                     int avplen)
+ {
+-    /*
+-     * What kind of bearer channel is the call on?
+-     */
+-    int b;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICRQ:
+-        case OCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: bearer type not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Bearer Type", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    b = ntohs (raw[4]);
++      t->call_head->bearer = get16(p + 2);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer bears:%s\n", __FUNCTION__,
+-                 b & ANALOG_BEARER ? " analog" : "digital");
+-    }
+-    t->call_head->bearer = b;
++      log (LOG_DEBUG, "%s: peer bears: %s\n", __func__,
++             (t->call_head->bearer & ANALOG_BEARER) ? "analog" : "digital");
+     return 0;
+ }
+-int frame_type_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int frame_type_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * What kind of frame channel is the call on?
+-     */
+-    int b;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICCN:
+-        case OCRQ:
+-        case OCCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: frame type not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is incorrect size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Frame Type", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    b = ntohs (raw[4]);
++      c->frame = get16(p + 2);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer uses:%s frames\n", __FUNCTION__,
+-                 b & ASYNC_FRAMING ? " async" : "sync");
+-    }
+-    c->frame = b;
++      log (LOG_DEBUG, "%s: peer uses:%s frames\n", __func__,
++             (c->frame & ASYNC_FRAMING) ? "async" : "sync");
+     return 0;
+ }
+-int hostname_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int hostname_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * What is the peer's name?
+-     */
+-    int size;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++
++    memcpy(t->hostname, p, datalen);
++      t->hostname[datalen] = '\0';
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: hostname not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Hostname", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    size = raw[0] & 0x0FFF;
+-    if (size > MAXSTRLEN - 1)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s: truncating reported hostname (size is %d)\n",
+-                 __FUNCTION__, size);
+-        size = MAXSTRLEN - 1;
+-    }
+-    safe_copy (t->hostname, (char *) &raw[3], size - 6);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer reports hostname '%s'\n", __FUNCTION__,
+-                 t->hostname);
+-    }
++      log (LOG_DEBUG, "%s: peer reports hostname '%s'\n", __func__,
++             t->hostname);
++
+     return 0;
+ }
+-int dialing_number_avp (struct tunnel *t, struct call *c, void *data,
+-                        int datalen)
++/*****************************************************************************/
++int calling_number_avp (struct tunnel *t, struct call *c, void *data,
++                        int avplen)
+ {
+-    /*
+-     * What is the peer's name?
+-     */
+-    int size;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++
++    memcpy(t->call_head->dialing, p, datalen);
++      t->call_head->dialing[datalen] = '\0';
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: dialing number not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Dialing Number", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    size = raw[0] & 0x0FFF;
+-    if (size > MAXSTRLEN - 1)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: truncating reported dialing number (size is %d)\n",
+-                 __FUNCTION__, size);
+-        size = MAXSTRLEN - 1;
+-    }
+-    safe_copy (t->call_head->dialing, (char *) &raw[3], size);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer reports dialing number '%s'\n", __FUNCTION__,
+-                 t->call_head->dialing);
+-    }
++      log (LOG_DEBUG, "%s: peer reports dialing number '%s'\n", __func__,
++             t->call_head->dialing);
++
+     return 0;
+ }
+-int dialed_number_avp (struct tunnel *t, struct call *c, void *data,
+-                       int datalen)
++/*****************************************************************************/
++int called_number_avp (struct tunnel *t, struct call *c, void *data,
++                       int avplen)
+ {
+-    /*
+-     * What is the peer's name?
+-     */
+-    int size;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++
++    memcpy(t->call_head->dialed, p, datalen);
++      t->call_head->dialed[datalen] = '\0';
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case OCRQ:
+-        case ICRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: dialed number not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Dialed Number", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    size = raw[0] & 0x0FFF;
+-    if (size > MAXSTRLEN - 1)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: truncating reported dialed number (size is %d)\n",
+-                 __FUNCTION__, size);
+-        size = MAXSTRLEN - 1;
+-    }
+-    safe_copy (t->call_head->dialed, (char *) &raw[3], size);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer reports dialed number '%s'\n", __FUNCTION__,
+-                 t->call_head->dialed);
+-    }
++      log (LOG_DEBUG, "%s: peer reports dialed number '%s'\n", __func__,
++             t->call_head->dialed);
++
+     return 0;
+ }
++/*****************************************************************************/
+ int sub_address_avp (struct tunnel *t, struct call *c, void *data,
+-                     int datalen)
++                     int avplen)
+ {
+-    /*
+-     * What is the peer's name?
+-     */
+-    int size;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++
++      memcpy(t->call_head->subaddy, p, datalen);
++      t->call_head->subaddy[datalen] = '\0';
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case OCRP:
+-        case ICRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: sub_address not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Sub-address", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    size = raw[0] & 0x0FFF;
+-    if (size > MAXSTRLEN - 1)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: truncating reported sub address (size is %d)\n",
+-                 __FUNCTION__, size);
+-        size = MAXSTRLEN - 1;
+-    }
+-    safe_copy (t->call_head->subaddy, (char *) &raw[3], size);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer reports subaddress '%s'\n", __FUNCTION__,
+-                 t->call_head->subaddy);
+-    }
++      log (LOG_DEBUG, "%s: peer reports subaddress '%s'\n", __func__,
++             t->call_head->subaddy);
+     return 0;
+ }
+-int vendor_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int vendor_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * What vendor makes the other end?
+-     */
+-    int size;
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++
++      memcpy(t->vendor, p, datalen);
++      t->vendor[datalen] = '\0';
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: vendor not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Vendor", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    size = raw[0] & 0x0FFF;
+-    if (size > MAXSTRLEN - 1)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG, "%s: truncating reported vendor (size is %d)\n",
+-                 __FUNCTION__, size);
+-        size = MAXSTRLEN - 1;
+-    }
+-    safe_copy (t->vendor, (char *) &raw[3], size);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer reports vendor '%s'\n", __FUNCTION__, t->vendor);
+-    }
++      log (LOG_DEBUG, "%s: peer reports vendor '%s'\n", __func__, t->vendor);
+     return 0;
+ }
+-int challenge_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int challenge_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * We are sent a challenge
+-     */
+-    _u16 *raw = data;
+-    int size;
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: challenge not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "challenge", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    /* size = raw[0] & 0x0FFF; */
+-    /* length field of AVP's is only 10 bits long, not 12 */
+-    size = raw[0] & 0x03FF;
+-    size -= sizeof (struct avp_hdr);
+-    /* if (size != MD_SIG_SIZE)
+-    {
+-        log (LOG_DEBUG, "%s: Challenge is not the right length (%d != %d)\n",
+-             __FUNCTION__, size, MD_SIG_SIZE);
+-        return -EINVAL;
+-    } */
+-    t->chal_us.challenge = malloc(size+1);
+-    if (t->chal_us.challenge == NULL)
+-    {
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      int datalen = avplen - sizeof(struct avp_hdr);
++
++    t->chal_us.challenge = calloc(datalen, 1);
++    if (!t->chal_us.challenge)
+         return -ENOMEM;
+-    }
+-    memset(t->chal_us.challenge, 0, size+1);
+-    bcopy (&raw[3], (t->chal_us.challenge), size);
++    memcpy(t->chal_us.challenge, p, datalen);
+     t->chal_us.state = STATE_CHALLENGED;
++
+     if (debug_avp)
+-    {
+-        log (LOG_DEBUG, "%s: challenge avp found\n", __FUNCTION__);
+-    }
++      log (LOG_DEBUG, "%s: challenge avp found\n", __func__);
++
+     return 0;
+ }
+-int chalresp_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int chalresp_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * We are sent a challenge
+-     */
+-    _u16 *raw = data;
+-    int size;
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: challenge response not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen < 6)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is too small.  %d < 6\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "challenge", 6, datalen, 1);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    size = raw[0] & 0x0FFF;
+-    size -= sizeof (struct avp_hdr);
+-    if (size != MD_SIG_SIZE)
+-    {
+-        log (LOG_DEBUG, "%s: Challenge is not the right length (%d != %d)\n",
+-             __FUNCTION__, size, MD_SIG_SIZE);
+-        return -EINVAL;
+-    }
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-    bcopy (&raw[3], t->chal_them.reply, MD_SIG_SIZE);
+-    if (debug_avp)
+-    {
+-        log (LOG_DEBUG, "%s: Challenge reply found\n", __FUNCTION__);
+-    }
++    memcpy(t->chal_them.reply, p, MD_SIG_SIZE);
++    if(debug_avp)
++      log(LOG_DEBUG, "%s: Challenge reply found\n", __func__);
+     return 0;
+ }
++/*****************************************************************************/
+ int assigned_tunnel_avp (struct tunnel *t, struct call *c, void *data,
+-                         int datalen)
++                         int avplen)
+ {
+-    /*
+-     * What is their TID that we must use from now on?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      u_int16_t id = get16(p);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-        case StopCCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: tunnel ID not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 8)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Assigned Tunnel ID", 8, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+     if (c->msgtype == StopCCN)
+-    {
+-        t->qtid = ntohs (raw[3]);
+-    }
++        t->qtid = id;
+     else
+-    {
+-        t->tid = ntohs (raw[3]);
+-    }
++        t->tid = id;
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: using peer's tunnel %d\n", __FUNCTION__,
+-                 ntohs (raw[3]));
+-    }
++      log (LOG_DEBUG, "%s: using peer's tunnel %d\n", __func__, id);
+     return 0;
+ }
+-int assigned_call_avp (struct tunnel *t, struct call *c, void *data,
+-                       int datalen)
++/*****************************************************************************/
++int assigned_session_avp (struct tunnel *t, struct call *c, void *data,
++                       int avplen)
+ {
+-    /*
+-     * What is their CID that we must use from now on?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
++      u_int16_t id = get16(p);
++
++      switch(c->msgtype) {
++              case CDN:
++              case ICRP:
++              case OCRP:
++                      c->cid = id;
++                      break;
++              case ICRQ:
++                      t->call_head->cid = id;
++                      break;
++      };
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case CDN:
+-        case ICRP:
+-        case ICRQ:
+-        case OCRP:             /* jz: deleting the debug message */
+-            break;
+-        case OCRQ:
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: call ID not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 8)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Assigned Call ID", 8, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    if (c->msgtype == CDN)
+-    {
+-        c->qcid = ntohs (raw[3]);
+-    }
+-    else if (c->msgtype == ICRQ)
+-    {
+-        t->call_head->cid = ntohs (raw[3]);
+-    }
+-    else if (c->msgtype == ICRP)
+-    {
+-        c->cid = ntohs (raw[3]);
+-    }
+-    else if (c->msgtype == OCRP)
+-    {                           /* jz: copy callid to c->cid */
+-        c->cid = ntohs (raw[3]);
+-    }
+-    else
+-    {
+-        log (LOG_DEBUG, "%s:  Dunno what to do when it's state %s!\n",
+-             __FUNCTION__, msgtypes[c->msgtype]);
+-    }
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: using peer's call %d\n", __FUNCTION__, ntohs (raw[3]));
+-    }
++      log (LOG_DEBUG, "%s: assigned session id: %d\n", __func__, id);
+     return 0;
+ }
++/*****************************************************************************/
+ int packet_delay_avp (struct tunnel *t, struct call *c, void *data,
+-                      int datalen)
++                      int avplen)
+ {
+-    /*
+-     * What is their CID that we must use from now on?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICRP:
+-        case OCRQ:
+-        case ICCN:
+-        case OCRP:
+-        case OCCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: packet delay not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 8)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Assigned Call ID", 8, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    c->ppd = ntohs (raw[3]);
++    c->ppd = get16(p);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer's delay is %d 1/10's of a second\n", __FUNCTION__,
+-                 ntohs (raw[3]));
+-    }
++      log (LOG_DEBUG, "%s: peer's delay is %d 1/10's of a second\n", __func__,
++             c->ppd);
+     return 0;
+ }
+-int call_serno_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int call_serno_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+     /*
+      * What is the serial number of the call?
+      */
+-    _u16 *raw = data;
+-
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICRQ:
+-        case OCRQ:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: call ID not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-#ifdef STRICT
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Serial Number", 10, datalen, 0);
+-            return -EINVAL;
+-#else
+-            log (LOG_DEBUG,
+-                 "%s: peer is using old style serial number.  Will be invalid.\n",
+-                 __FUNCTION__);
+-#endif
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-        }
+-    }
+-#endif
+-    t->call_head->serno = (((unsigned int) ntohs (raw[3])) << 16) |
+-        ((unsigned int) ntohs (raw[4]));
++    t->call_head->serno = get32(p);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: serial number is %d\n", __FUNCTION__,
+-                 t->call_head->serno);
+-    }
++      log (LOG_DEBUG, "%s: serial number is %d\n", __func__, 
++                       t->call_head->serno);
+     return 0;
+ }
+-int rx_speed_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int rx_speed_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * What is the received baud rate of the call?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICCN:
+-        case OCCN:
+-        case OCRP:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: rx connect speed not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Connect Speed (RX)", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    c->rxspeed = (((unsigned int) ntohs (raw[3])) << 16) |
+-        ((unsigned int) ntohs (raw[4]));
+-    if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: receive baud rate is %d\n", __FUNCTION__, c->rxspeed);
+-    }
++    c->rxspeed = get32(p);
++    if(debug_avp)
++      log(LOG_DEBUG, "%s: receive baud rate is %d\n", __func__, c->rxspeed);
+     return 0;
+ }
+-int tx_speed_avp (struct tunnel *t, struct call *c, void *data, int datalen)
++/*****************************************************************************/
++int tx_speed_avp (struct tunnel *t, struct call *c, void *data, int avplen)
+ {
+-    /*
+-     * What is the tranmsit baud rate of the call?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICCN:
+-        case OCCN:
+-        case OCRP:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: tx connect speed not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Connect Speed (tx)", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    c->txspeed = (((unsigned int) ntohs (raw[3])) << 16) |
+-        ((unsigned int) ntohs (raw[4]));
++    c->txspeed = get32(p);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: transmit baud rate is %d\n", __FUNCTION__, c->txspeed);
+-    }
++      log (LOG_DEBUG, "%s: transmit baud rate is %d\n", 
++                       __func__, c->txspeed);
+     return 0;
+ }
++
++/*****************************************************************************/
+ int call_physchan_avp (struct tunnel *t, struct call *c, void *data,
+-                       int datalen)
++                       int avplen)
+ {
+-    /*
+-     * What is the physical channel?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case ICRQ:
+-        case OCRQ:
+-        case OCRP:
+-        case OCCN:
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: physical channel not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 10)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 10\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Physical Channel", 10, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    t->call_head->physchan = (((unsigned int) ntohs (raw[3])) << 16) |
+-        ((unsigned int) ntohs (raw[4]));
++    t->call_head->physchan = get32(p);
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: physical channel is %d\n", __FUNCTION__,
+-                 t->call_head->physchan);
+-    }
++      log(LOG_DEBUG, "%s: physical channel is %d\n", __func__,
++                      t->call_head->physchan);
+     return 0;
+ }
++/*****************************************************************************/
+ int receive_window_size_avp (struct tunnel *t, struct call *c, void *data,
+-                             int datalen)
++                             int avplen)
+ {
+-    /*
+-     * What is their RWS?
+-     */
+-    _u16 *raw = data;
++      u_int8_t *p = data + sizeof(struct avp_hdr);
+-#ifdef SANITY
+-    if (t->sanity)
+-    {
+-        switch (c->msgtype)
+-        {
+-        case SCCRP:
+-        case SCCRQ:
+-        case OCRP:             /* jz */
+-        case OCCN:             /* jz */
+-        case StopCCN:
+-/*            case ICRP:
+-              case ICCN: */
+-            break;
+-        default:
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: RWS not appropriate for message %s.  Ignoring.\n",
+-                     __FUNCTION__, msgtypes[c->msgtype]);
+-            return 0;
+-        }
+-        if (datalen != 8)
+-        {
+-            if (DEBUG)
+-                log (LOG_DEBUG,
+-                     "%s: avp is wrong size.  %d != 8\n", __FUNCTION__,
+-                     datalen);
+-            wrong_length (c, "Receive Window Size", 8, datalen, 0);
+-            return -EINVAL;
+-        }
+-    }
+-#endif
+-    t->rws = ntohs (raw[3]);
++    t->rws = get16(p);
+ /*    if (c->rws >= 0)
+               c->fbit = FBIT; */
+     if (debug_avp)
+-    {
+-        if (DEBUG)
+-            log (LOG_DEBUG,
+-                 "%s: peer wants RWS of %d.  Will use flow control.\n",
+-                 __FUNCTION__, t->rws);
+-    }
++              log (LOG_DEBUG, "%s: peer wants RWS of %d.  Will use flow control.\n",
++             __func__, t->rws);
+     return 0;
+ }
++/*****************************************************************************/
+ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
+ {
+     /*
+@@ -1594,82 +770,100 @@
+     struct avp_hdr *avp;
+     int len = buf->len - sizeof (struct control_hdr);
++      u_int16_t rlen = 0;
++      u_int16_t attr = 0;
+     int firstavp = -1;
+-    int hidlen;
++    int hidlen = 0;
+     char *data = buf->start + sizeof (struct control_hdr);
+     avp = (struct avp_hdr *) data;
++
+     if (debug_avp)
+         log (LOG_DEBUG, "%s: handling avp's for tunnel %d, call %d\n",
+-             __FUNCTION__, t->ourtid, c->ourcid);
++             __func__, t->ourtid, c->ourcid);
++
++      if(len < 6) {
++      log (LOG_WARN, "%s: packet too small\n", __func__);
++        set_error(c, ERROR_LENGTH, "Invalid message length");
++        return -EINVAL;
++      }
++
+     while (len > 0)
+     {
+-        /* Go ahead and byte-swap the header */
+-        swaps (avp, sizeof (struct avp_hdr));
+-        if (avp->attr > AVP_MAX)
++              rlen = get16((u_int8_t*)&avp->length);
++              attr = get16((u_int8_t*)&avp->attr);
++
++              /* AVP header checks */
++        if (attr > AVP_MAX)
+         {
+-            if (AMBIT (avp->length))
++            if (AMBIT(rlen))
+             {
+                 log (LOG_WARN,
+-                     "%s:  dont know how to handle mandatory attribute %d.  Closing %s.\n"
+-                     __FUNCTION__, avp->attr,
+-                     (c != t->self) ? "call" : "tunnel");
+-                set_error (c, VENDOR_ERROR,
+-                           "mandatory attribute %d cannot be handled",
+-                           avp->attr);
+-                c->needclose = -1;
++                     "%s:  unhandeled mandatory attribute %d.  Closing %s.\n", 
++                     __func__, attr, (c != t->self) ? "call" : "tunnel");
++                set_error (c, VENDOR_ERROR, 
++                                                 "mandatory attribute %d cannot be handled", attr);
+                 return -EINVAL;
+             }
+             else
+             {
+                 if (DEBUG)
+                     log (LOG_WARN,
+-                         "%s:  dont know how to handle atribute %d.\n",
+-                         __FUNCTION__, avp->attr);
++                         "%s: handeled attribute %d.\n",
++                         __func__, attr);
+                 goto next;
+             }
+         }
+-        if (ALENGTH (avp->length) > len)
++        if (ALENGTH (rlen) > len)
+         {
+             log (LOG_WARN,
+-                 "%s: AVP received with length > remaining packet length!\n",
+-                 __FUNCTION__);
++                 "%s: AVP reported length > remaining packet length\n",
++                 __func__);
+             set_error (c, ERROR_LENGTH, "Invalid AVP length");
+-            c->needclose = -1;
+             return -EINVAL;
+         }
+-        if (avp->attr && firstavp)
++              if (ALENGTH (rlen) < sizeof (struct avp_hdr))
+         {
+-            log (LOG_WARN, "%s: First AVP was not message type.\n",
+-                 __FUNCTION__);
+-            set_error (c, VENDOR_ERROR, "First AVP must be message type");
+-            c->needclose = -1;
++            log (LOG_WARN, "%s: AVP reported length too small (%d).\n",
++                 __func__, ALENGTH (rlen));
++            set_error (c, ERROR_LENGTH, "AVP too small");
+             return -EINVAL;
+         }
+-        if (ALENGTH (avp->length) < sizeof (struct avp_hdr))
++              if (avps[attr].sz) {
++                      if((avps[attr].flags & AVP_F_FIXLEN) ?  
++                         (ALENGTH(rlen) - sizeof(struct avp_hdr)) != avps[attr].sz :
++                         (ALENGTH(rlen) - sizeof(struct avp_hdr)) > avps[attr].sz) {
++                              log (LOG_DEBUG, "%s: %s avp size mismatch  (%d %s %d)\n", 
++                                      __func__,
++                                      avps[attr].description, 
++                                      (avps[attr].flags & AVP_F_FIXLEN) ? "!=" : "<", 
++                                      ALENGTH(rlen), avps[attr].sz);
++                              set_error (c, ERROR_LENGTH, "AVP size check failed");
++                              return -EINVAL;
++                      }
++              }
++        if (attr && firstavp)
+         {
+-            log (LOG_WARN, "%s: AVP with too small of size (%d).\n",
+-                 __FUNCTION__, ALENGTH (avp->length));
+-            set_error (c, ERROR_LENGTH, "AVP too small");
+-            c->needclose = -1;
++            log (LOG_WARN, "%s: First AVP was not message type.\n",
++                 __func__);
++            set_error (c, VENDOR_ERROR, "First AVP must be message type");
+             return -EINVAL;
+         }
+-        if (AZBITS (avp->length))
++        if (AZBITS (rlen))
+         {
+-            log (LOG_WARN, "%s: %sAVP has reserved bits set.\n", __FUNCTION__,
+-                 AMBIT (avp->length) ? "Mandatory " : "");
+-            if (AMBIT (avp->length))
++            log (LOG_WARN, "%s: %sAVP has reserved bits set.\n", __func__,
++                 AMBIT (rlen) ? "Mandatory " : "");
++            if (AMBIT (rlen))
+             {
+                 set_error (c, ERROR_RESERVED, "reserved bits set in AVP");
+-                c->needclose = -1;
+                 return -EINVAL;
+             }
+             goto next;
+         }
+-        if (AHBIT (avp->length))
++
++              /* decryption */
++        if (AHBIT (rlen))
+         {
+-#ifdef DEBUG_HIDDEN
+-            log (LOG_DEBUG, "%s: Hidden bit set on AVP.\n", __FUNCTION__);
+-#endif
++            log (LOG_DEBUG, "%s: Hidden bit set on AVP.\n", __func__);
+             /* We want to rewrite the AVP as an unhidden AVP
+                and then pass it along as normal.  Remeber how
+                long the AVP was in the first place though! */
+@@ -1678,12 +872,11 @@
+             {
+                 if (debug_avp)
+                     log (LOG_WARN, "%s: Unable to handle hidden %sAVP\n:",
+-                         __FUNCTION__,
+-                         (AMBIT (avp->length) ? "mandatory " : ""));
+-                if (AMBIT (avp->length))
++                         __func__,
++                         (AMBIT (rlen) ? "mandatory " : ""));
++                if (AMBIT (rlen))
+                 {
+                     set_error (c, VENDOR_ERROR, "Invalid Hidden AVP");
+-                    c->needclose = -1;
+                     return -EINVAL;
+                 }
+                 goto next;
+@@ -1696,17 +889,43 @@
+         }
+         else
+             hidlen = 0;
+-        if (avps[avp->attr].handler)
++
++              /* validate */
++              if (avps[attr].validate) 
++              {
++                      if(avps[attr].validate(attr, t, c, avp, ALENGTH (rlen))) {
++                               if (AMBIT (rlen))
++                {
++                    log (LOG_WARN,
++                         "%s: verification of AVP %d (%s) failed.\n",
++                         __func__, attr,
++                         avps[attr].description);
++                                      set_error (c, VENDOR_ERROR, "processing failed on mandatory AVP");
++                    return -EINVAL;
++                }
++                else
++                {
++                    if (DEBUG)
++                        log (LOG_DEBUG,
++                             "%s: Bad exit status handling attribute %d (%s).\n",
++                             __func__, attr,
++                             avps[attr].description);
++                }
++                      }
++              }
++
++              /* handling */
++        if (avps[attr].handle)
+         {
+-            if (avps[avp->attr].handler (t, c, avp, ALENGTH (avp->length)))
++            if (avps[attr].handle(t, c, avp, ALENGTH (rlen)))
+             {
+-                if (AMBIT (avp->length))
++                if (AMBIT (rlen))
+                 {
+                     log (LOG_WARN,
+-                         "%s: Bad exit status handling attribute %d (%s) on mandatory packet.\n",
+-                         __FUNCTION__, avp->attr,
+-                         avps[avp->attr].description);
+-                    c->needclose = -1;
++                         "%s: Bad exit status handling mandatory attribute %d (%s).\n",
++                         __func__, attr,
++                         avps[attr].description);
++                                      set_error (c, VENDOR_ERROR, "processing failed on mandatory AVP");
+                     return -EINVAL;
+                 }
+                 else
+@@ -1714,29 +933,31 @@
+                     if (DEBUG)
+                         log (LOG_DEBUG,
+                              "%s: Bad exit status handling attribute %d (%s).\n",
+-                             __FUNCTION__, avp->attr,
+-                             avps[avp->attr].description);
++                             __func__, attr,
++                             avps[attr].description);
+                 }
+             }
+         }
+         else
+         {
+-            if (AMBIT (avp->length))
++            if (AMBIT (rlen))
+             {
+                 log (LOG_WARN,
+                      "%s:  No handler for mandatory attribute %d (%s).  Closing %s.\n",
+-                     __FUNCTION__, avp->attr, avps[avp->attr].description,
++                     __func__, attr, 
++                                       avps[attr].description,
+                      (c != t->self) ? "call" : "tunnel");
+                 set_error (c, VENDOR_ERROR, "No handler for attr %d (%s)\n",
+-                           avp->attr, avps[avp->attr].description);
++                           attr, 
++                                                 avps[attr].description);
+                 return -EINVAL;
+             }
+             else
+             {
+                 if (DEBUG)
+                     log (LOG_WARN, "%s:  no handler for atribute %d (%s).\n",
+-                         __FUNCTION__, avp->attr,
+-                         avps[avp->attr].description);
++                         __func__, attr,
++                         avps[attr].description);
+             }
+         }
+       next:
+@@ -1748,16 +969,17 @@
+         }
+         else
+         {
+-            len -= ALENGTH (avp->length);
+-            data += ALENGTH (avp->length);      /* Next AVP, please */
++            len -= ALENGTH (rlen);
++            data += ALENGTH (rlen);      /* Next AVP, please */
+         }
+         avp = (struct avp_hdr *) data;
+         firstavp = 0;
+     }
+     if (len != 0)
+     {
+-        log (LOG_WARN, "%s: negative overall packet length\n", __FUNCTION__);
++        log (LOG_WARN, "%s: negative overall packet length\n", __func__);
+         return -EINVAL;
+     }
++
+     return 0;
+ }
+--- l2tpd-0.70-pre20031121.orig/avpsend.c
++++ l2tpd-0.70-pre20031121/avpsend.c
+@@ -1,11 +1,5 @@
+ /*
+- * $Id$
+- *
+- * Layer Two Tunnelling Protocol Daemon
+- * Copyright (C) 1998 Adtran, Inc.
+- * Copyright (C) 2002 Jeff McAdams
+- *
+- * Mark Spencer
++ * Copyright (C) 2004 Jean-Francois Dive
+  *
+  * This software is distributed under the terms
+  * of the GPL, which you should have received
+@@ -14,337 +8,288 @@
+  * Attribute Value Pair creating routines
+  */
++/* TODO: Handle Tie break */
++/* TODO: Get real hostname / config */
++/* TODO: There should be an overflow check on
++ *             the buffer size. (safe for now as 
++ *             packet size = 4k
++ */
++
+ #include <stdlib.h>
+ #include <string.h>
+-#include <netinet/in.h>
++#include <unistd.h>
+ #include "l2tp.h"
+-/* 
+- * These routines should add avp's to a buffer
+- * to be sent
+- */
++extern struct avp avps[];
++/* We could add here padding support which would allow
++ * to keep alignemnt straight <jdive> */
++static int add_avp(struct buffer *buf, u_int32_t avpid, unsigned char *v, 
++                             u_int32_t sz, u_int8_t setpayload) {
++      u_int8_t *p = buf->start + buf->len;
++
++      if(avpid > AVP_MAX  || !avps[avpid].flags) {
++              log(LOG_DEBUG, "%s: invalid avp id %d\n", __func__, avpid);
++              return 1;
++      }
++
++      set16(p, (sz + 6) | (avps[avpid].flags & AVP_F_MANDATORY ? MBIT : 0));
++      set16(p + 2, VENDOR_ID);
++      set16(p + 4, avpid);
++      if(setpayload) 
++              memcpy(p + 6, v, sz);
+-/* FIXME:  If SANITY is on, we should check for buffer overruns */
++      buf->len += (sz + 6);
++      return 0;
++}
+-/* FIXME: Can't this be condensed alot? */
++/*****************************************************************************/
++int add_message_type_avp(struct buffer *buf, _u16 type) {
++      u_int8_t t[2];
++      set16(t, type);
++      if(add_avp(buf, MESSAGE_TYPE_AVP, t, 2, 1))
++              return 1;
++    return 0;
++}
+-int add_message_type_avp (struct buffer *buf, _u16 type)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = 0;
+-    raw[3] = htons (type);
+-    buf->len += 8;
++/*****************************************************************************/
++int add_protocol_avp(struct buffer *buf) {
++      u_int8_t t[2];
++      set16(t, OUR_L2TP_VERSION);
++      if(add_avp(buf, PROTOCOL_VERSION_AVP, t, 2, 1))
++              return 1;
+     return 0;
+ }
+-int add_protocol_avp (struct buffer *buf)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8 | MBIT);        /* Length and M bit */
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x2);       /* Value of our AVP */
+-    raw[3] = htons (OUR_L2TP_VERSION);
+-    buf->len += 8;
++/*****************************************************************************/
++int add_frame_caps_avp(struct buffer *buf, _u16 caps) {
++      u_int8_t t[4];
++      t[0] = 0; 
++      t[1] = 0;
++      set16(&t[2], caps);
++      if(add_avp(buf, FRAMING_CAP_AVP, t, 4, 1))
++              return 1;
+     return 0;
+ }
+-int add_frame_caps_avp (struct buffer *buf, _u16 caps)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x3);
+-    raw[3] = 0;
+-    raw[4] = htons (caps);
+-    buf->len += 10;
++/*****************************************************************************/
++int add_bearer_caps_avp(struct buffer *buf, _u16 caps) {
++      u_int8_t t[4];
++      t[0] = 0; 
++      t[1] = 0;
++      set16(&t[2], caps);
++      if(add_avp(buf, BEARER_CAP_AVP, t, 4, 1))
++              return 1;
+     return 0;
+ }
+-int add_bearer_caps_avp (struct buffer *buf, _u16 caps)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x4);
+-    raw[3] = 0;
+-    raw[4] = htons (caps);
+-    buf->len += 10;
++/*****************************************************************************/
++int add_firmware_avp(struct buffer *buf) {
++      u_int8_t t[2];
++      set16(t, OUR_L2TP_VERSION);
++      if(add_avp(buf, FIRMWARE_REV_AVP, t, 2, 1))
++              return 1;
+     return 0;
+ }
+-/* FIXME: I need to send tie breaker AVP's */
+-
+-int add_firmware_avp (struct buffer *buf)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x6);
+-    raw[3] = htons (FIRMWARE_REV);
+-    buf->len += 8;
++/*****************************************************************************/
++int add_hostname_avp(struct buffer *buf, struct tunnel *t) {
++      char n[STRLEN];
++      int sz = 0;
++      if(t->lac && t->lac->hostname[0]) {
++              strncpy(n,t->lac->hostname, sizeof(n));
++              sz = strnlen(t->lac->hostname, sizeof(t->lac->hostname));
++      }
++      else if(t->lns && t->lns->hostname[0]) {
++              strncpy(n,t->lns->hostname, sizeof(n));
++              sz = strnlen(t->lns->hostname, sizeof(t->lns->hostname));
++      }
++      else {
++              if(gethostname(n, STRLEN)) {
++                      strcpy(n,"eriwan");
++                      sz = 6;
++              }
++              else
++                      sz = strnlen(n, sizeof(n));
++      }
++      if(add_avp(buf, HOSTNAME_AVP, n, sz, 1))
++              return 1;
+     return 0;
+ }
+-/*
+-int add_hostname_avp(struct buffer *buf) {
+-      _u16 *raw = (_u16 *)(buf->start + buf->len);
+-      raw[0] = htons((0x6 + strlen(hostname)) | MBIT);
+-      raw[1] = htons(VENDOR_ID);
+-      raw[2] = htons(0x7);
+-      strcpy((char *)(&raw[3]), hostname);
+-      buf->len += 6 + strlen(hostname);
+-      return 0;
++/*****************************************************************************/
++int add_vendor_avp(struct buffer *buf) {
++      if(add_avp(buf, VENDOR_NAME_AVP, VENDOR_NAME, strlen(VENDOR_NAME), 1))
++              return 1;
++    return 0;
+ }
+-*/
+-int add_hostname_avp (struct buffer *buf)
+-{
+-    char names[6] = "eriwan";
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xC | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x7);
+-    strcpy ((char *) (&raw[3]), names);
+-    buf->len += 12;
+-    return 0;
+-}
+-
+-int add_vendor_avp (struct buffer *buf)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x6 + strlen (VENDOR_NAME));
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x8);
+-    strcpy ((char *) (&raw[3]), VENDOR_NAME);
+-    buf->len += 6 + strlen (VENDOR_NAME);
+-    return 0;
+-}
+-
+-int add_tunnelid_avp (struct buffer *buf, _u16 tid)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x9);
+-    raw[3] = htons (tid);
+-    buf->len += 8;
+-    return 0;
+-}
+-
+-int add_avp_rws (struct buffer *buf, _u16 rws)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0xA);
+-    raw[3] = htons (rws);
+-    buf->len += 8;
+-    return 0;
+-}
+-
+-int add_challenge_avp (struct buffer *buf, char *c, int len)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons ((0x6 + len) | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0xB);
+-    bcopy (c, (char *) (&raw[3]), len);
+-    buf->len += 6 + len;
+-    return 0;
+-}
+-
+-int add_chalresp_avp (struct buffer *buf, char *c, int len)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons ((0x6 + len) | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0xD);
+-    bcopy (c, (char *) (&raw[3]), len);
+-    buf->len += 6 + len;
+-    return 0;
+-}
+-
+-int add_randvect_avp (struct buffer *buf, char *c, int len)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons ((0x6 + len) | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x24);
+-    bcopy (c, (char *) (&raw[3]), len);
+-    buf->len += 6 + len;
+-    return 0;
+-}
+-
+-int add_result_code_avp (struct buffer *buf, _u16 result, _u16 error,
+-                         char *msg, int len)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons ((0xA + len) | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x1);
+-    raw[3] = htons (result);
+-    raw[4] = htons (error);
+-    bcopy (msg, (char *) &raw[5], len);
+-    buf->len += (10 + len);
++/*****************************************************************************/
++int add_tunnelid_avp(struct buffer *buf, _u16 tid) {
++      u_int8_t t[2];
++      set16(t, tid);
++      if(add_avp(buf, ASSIGNED_TUN_ID_AVP, t, 2, 1))
++              return 1;
+     return 0;
+ }
++/*****************************************************************************/
++int add_avp_rws(struct buffer *buf, _u16 rws) {
++      u_int8_t t[2];
++      set16(t, rws);
++      if(add_avp(buf, RX_WIN_SIZE_AVP, t, 2, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_challenge_avp(struct buffer *buf, char *c, int len) {
++      if(add_avp(buf, CHALLENGE_AVP, c, len, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_chalresp_avp(struct buffer *buf, char *c, int len) {
++      if(add_avp(buf, CHALLENGE_RESP_AVP, c, len, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_randvect_avp(struct buffer *buf, char *c, int len) {
++      if(add_avp(buf, RANDOM_VECTOR_AVP, c, len, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_result_code_avp(struct buffer *buf, _u16 result, _u16 error,
++                        char *msg, int len) {
++      u_int8_t t[4];
++      set16(t, result);
++      set16(&t[2], error);
++      memcpy((u_int8_t*)(buf->start + buf->len + 10), msg, len);
++      memcpy((u_int8_t*)(buf->start + buf->len + 6), t, 4);
++      if(add_avp(buf, RESULT_CODE_AVP, 0, 4 + len, 0))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
+ #ifdef TEST_HIDDEN
+-int add_callid_avp (struct buffer *buf, _u16 callid, struct tunnel *t)
+-{
+-#else
+-int add_callid_avp (struct buffer *buf, _u16 callid)
+-{
+-#endif
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-#ifdef TEST_HIDDEN
++int add_callid_avp(struct buffer *buf, _u16 callid, struct tunnel *t) {
++      u_int8_t t[2];
+     if (t->hbit)
+         raw++;
+-#endif
+-    raw[0] = htons (0x8 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0xE);
+-    raw[3] = htons (callid);
+-    buf->len += 8;
+-#ifdef TEST_HIDDEN
++      set16(t, callid);
++      if(add_avp(buf, ASSIGNED_SES_ID_AVP, t, 2, 1))
++              return 1;
+     if (t->hbit)
+         encrypt_avp (buf, 8, t);
++    return 0;
++}
++#else
++int add_callid_avp(struct buffer *buf, _u16 callid) {
++      u_int8_t t[2];
++      set16(t, callid);
++      if(add_avp(buf, ASSIGNED_SES_ID_AVP, t, 2, 1))
++              return 1;
++    return 0;
++}
+ #endif
++
++/*****************************************************************************/
++int add_serno_avp(struct buffer *buf, unsigned int serno) {
++      u_int8_t t[4];
++      set32(t, serno);
++      if(add_avp(buf, SERIAL_NUMBER_AVP, t, 4, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_bearer_avp(struct buffer *buf, int bearer) {
++      u_int8_t t[4];
++      set32(t, bearer);
++      if(add_avp(buf, BEARER_TYPE_AVP, t, 4, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_frame_avp(struct buffer *buf, int frame) {
++      u_int8_t t[4];
++      set32(t, frame);
++      if(add_avp(buf, FRAMING_TYPE_AVP, t, 4, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_txspeed_avp(struct buffer *buf, int speed) {
++      u_int8_t t[4];
++      set32(t, speed);
++      if(add_avp(buf, TX_CONNECT_SPEED_AVP, t, 4, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_rxspeed_avp(struct buffer *buf, int speed) {
++      u_int8_t t[4];
++      set32(t, speed);
++      if(add_avp(buf, RX_CONNECT_SPEED_AVP, t, 4, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_physchan_avp(struct buffer *buf, unsigned int physchan) {
++      u_int8_t t[4];
++      set32(t, physchan);
++      if(add_avp(buf, PHYS_CHAN_ID_AVP, t, 4, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_ppd_avp(struct buffer *buf, _u16 ppd) {
++      u_int8_t t[2];
++      set16(t, ppd);
++      if(add_avp(buf, PACKET_DELAY_AVP, t, 2, 1))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_seqreqd_avp(struct buffer *buf) {
++      if(add_avp(buf, SEQ_REQUIRED_AVP, 0, 0, 0))
++              return 1;
++    return 0;
++}
++
++/*****************************************************************************/
++int add_minbps_avp(struct buffer *buf, int speed) {
++      u_int8_t t[4];
++      set32(t, speed);
++      if(add_avp(buf, MIN_BPS_AVP, t, 4, 1))
++              return 1;
+     return 0;
+ }
+-int add_serno_avp (struct buffer *buf, unsigned int serno)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0xF);
+-    raw[3] = htons ((serno >> 16) & 0xFFFF);
+-    raw[4] = htons (serno & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-int add_bearer_avp (struct buffer *buf, int bearer)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x12);
+-    raw[3] = htons ((bearer >> 16) & 0xFFFF);
+-    raw[4] = htons (bearer & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-int add_frame_avp (struct buffer *buf, int frame)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x13);
+-    raw[3] = htons ((frame >> 16) & 0xFFFF);
+-    raw[4] = htons (frame & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-int add_txspeed_avp (struct buffer *buf, int speed)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x18);
+-    raw[3] = htons ((speed >> 16) & 0xFFFF);
+-    raw[4] = htons (speed & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-int add_rxspeed_avp (struct buffer *buf, int speed)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x26);
+-    raw[3] = htons ((speed >> 16) & 0xFFFF);
+-    raw[4] = htons (speed & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-int add_physchan_avp (struct buffer *buf, unsigned int physchan)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x19);
+-    raw[3] = htons ((physchan >> 16) & 0xFFFF);
+-    raw[4] = htons (physchan & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-int add_ppd_avp (struct buffer *buf, _u16 ppd)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x8 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x14);
+-    raw[3] = htons (ppd);
+-    buf->len += 8;
+-    return 0;
+-}
+-
+-int add_seqreqd_avp (struct buffer *buf)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0x6 | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x27);
+-    buf->len += 6;
+-    return 0;
+-}
+-
+-/* jz: options dor the outgoing call */
+-
+-/* jz: Minimum BPS - 16 */
+-int add_minbps_avp (struct buffer *buf, int speed)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x10);
+-    raw[3] = htons ((speed >> 16) & 0xFFFF);
+-    raw[4] = htons (speed & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-/* jz: Maximum BPS - 17 */
+-int add_maxbps_avp (struct buffer *buf, int speed)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons (0xA | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x11);
+-    raw[3] = htons ((speed >> 16) & 0xFFFF);
+-    raw[4] = htons (speed & 0xFFFF);
+-    buf->len += 10;
+-    return 0;
+-}
+-
+-/* jz: Dialed Number 21 */
+-int add_number_avp (struct buffer *buf, char *no)
+-{
+-    _u16 *raw = (_u16 *) (buf->start + buf->len);
+-    raw[0] = htons ((0x6 + strlen (no)) | MBIT);
+-    raw[1] = htons (VENDOR_ID);
+-    raw[2] = htons (0x15);
+-    strncpy ((char *) (&(raw[3])), no, strlen (no));
+-    buf->len += 6 + strlen (no);
++/*****************************************************************************/
++int add_maxbps_avp(struct buffer *buf, int speed) {
++      u_int8_t t[4];
++      set32(t, speed);
++      if(add_avp(buf, MAX_BPS_AVP, t, 4, 1))
++              return 1;
+     return 0;
+ }
++
++/*****************************************************************************/
++int add_number_avp(struct buffer *buf, char *no) {
++      if(add_avp(buf, CALLED_NUMBER_AVP, no, strlen(no), 1))
++              return 1;
++      return 0;
++}
diff --git a/net/l2tpd/patches/002-debian-2-pty-rev.patch b/net/l2tpd/patches/002-debian-2-pty-rev.patch
new file mode 100644 (file)
index 0000000..135e17e
--- /dev/null
@@ -0,0 +1,21 @@
+diff -ruN l2tpd-0.70pre-old/l2tpd.c l2tpd-0.70pre-new/l2tpd.c
+--- l2tpd-0.70pre-old/l2tpd.c  2005-12-16 12:02:02.000000000 +0100
++++ l2tpd-0.70pre-new/l2tpd.c  2005-12-16 12:14:24.000000000 +0100
+@@ -336,17 +336,10 @@
+         tcgetattr (c->fd, &ptyconf);
+         *(c->oldptyconf) = ptyconf;
+         ptyconf.c_cflag &= ~(ICANON | ECHO);
+-              ptyconf.c_lflag &= ~ECHO;
+         tcsetattr (c->fd, TCSANOW, &ptyconf);
+         snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
+         fd2 = open (tty, O_RDWR);
+-              if(!fd2)
+-                      log(LOG_WARN, "unable to open tty %s", tty);
+-
+-              /* XXX JEF: CHECK ME */
+-              stropt[pos++] = strdup(tty);
+-              stropt[pos] = NULL;
+ #ifdef USE_KERNEL
+     }
diff --git a/net/l2tpd/patches/003-jacco-pty.patch b/net/l2tpd/patches/003-jacco-pty.patch
new file mode 100644 (file)
index 0000000..67169b8
--- /dev/null
@@ -0,0 +1,1194 @@
+diff -ruN l2tpd-0.70pre-old/l2tpd.c l2tpd-0.70pre-new/l2tpd.c
+--- l2tpd-0.70pre-old/l2tpd.c  2005-12-16 12:34:12.000000000 +0100
++++ l2tpd-0.70pre-new/l2tpd.c  2005-12-16 12:34:54.000000000 +0100
+@@ -16,6 +16,7 @@
+  */
+ #include <stdlib.h>
++#include <sys/types.h>
+ #include <sys/utsname.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
+@@ -274,8 +275,8 @@
+ int start_pppd (struct call *c, struct ppp_opts *opts)
+ {
+-    char a, b;
+-    char tty[80];
++    /* char a, b; */
++    char *tty;
+     char *stropt[80];
+     struct ppp_opts *p;
+ #ifdef USE_KERNEL
+@@ -324,12 +325,45 @@
+     else
+     {
+ #endif
+-        if ((c->fd = getPtyMaster (&a, &b)) < 0)
++      c->fd = open("/dev/ptmx", O_RDWR);
++      if (c->fd == -1)
++      {
++              log (LOG_WARN, "%s: unable to open /dev/ptmx to allocate pty\n",
++                              __FUNCTION__);
++              return -EINVAL;
++      } else
++      {
++          if (grantpt(c->fd))
++          {
++              log (LOG_WARN, "%s: unable to grantpt() on pty\n",
++                              __FUNCTION__);
++              close(c->fd);
++              return -EINVAL;
++          }
++          if (unlockpt(c->fd))
++          {
++              log (LOG_WARN, "%s: unable to unlockpt() on pty\n",
++                      __FUNCTION__);
++              close(c->fd);
++              return -EINVAL;
++          }
++          tty = ptsname(c->fd);
++          if (tty == NULL)
++          {
++              log (LOG_WARN, "%s: unable to obtain name of slave tty\n",
++                      __FUNCTION__);
++              close(c->fd);
++              return -EINVAL;
++          }
++      }
++      
++      
++ /*   if ((c->fd = getPtyMaster (&a, &b)) < 0)
+         {
+             log (LOG_WARN, "%s: unable to allocate pty, abandoning!\n",
+                  __FUNCTION__);
+             return -EINVAL;
+-        }
++        } */
+         /* set fd opened above to not echo so we don't see read our own packets
+            back of the file descriptor that we just wrote them to */
+@@ -338,8 +372,14 @@
+         ptyconf.c_cflag &= ~(ICANON | ECHO);
+         tcsetattr (c->fd, TCSANOW, &ptyconf);
+-        snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
++/*        snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b); */
+         fd2 = open (tty, O_RDWR);
++      if (fd2 == -1)
++      {
++              log (LOG_WARN, "%s: unable to open slave tty %s\n", __FUNCTION__, tty);
++              close(c->fd);
++              return -EINVAL;
++      }
+ #ifdef USE_KERNEL
+     }
+diff -ruN l2tpd-0.70pre-old/l2tpd.c.orig l2tpd-0.70pre-new/l2tpd.c.orig
+--- l2tpd-0.70pre-old/l2tpd.c.orig     1970-01-01 01:00:00.000000000 +0100
++++ l2tpd-0.70pre-new/l2tpd.c.orig     2005-12-16 12:14:24.000000000 +0100
+@@ -0,0 +1,1104 @@
++/*
++ * $Id$
++ *
++ * Layer Two Tunnelling Protocol Daemon
++ * Copyright (C) 1998 Adtran, Inc.
++ * Copyright (C) 2002 Jeff McAdams
++ *
++ * Mark Spencer
++ *
++ * This software is distributed under the terms
++ * of the GPL, which you should have received
++ * along with this source.
++ *
++ * Main Daemon source.
++ *
++ */
++
++#include <stdlib.h>
++#include <sys/utsname.h>
++#include <sys/stat.h>
++#include <sys/wait.h>
++#include <stdio.h>
++#include <errno.h>
++#include <unistd.h>
++#include <time.h>
++#if (__GLIBC__ < 2)
++# if defined(FREEBSD)
++#  include <sys/signal.h>
++# elif defined(LINUX)
++#  include <bsd/signal.h>
++# elif defined(SOLARIS)
++#  include <signal.h>
++# endif
++#else
++# include <signal.h>
++#endif
++#include <netdb.h>
++#include <string.h>
++#include <fcntl.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++#ifdef USE_KERNEL
++#include <sys/ioctl.h>
++#endif
++#include "l2tp.h"
++
++struct tunnel_list tunnels;
++int max_tunnels = DEF_MAX_TUNNELS;
++struct utsname uts;
++int ppd = 1;                    /* Packet processing delay */
++int control_fd;                 /* descriptor of control area */
++char *args;
++
++char *dial_no_tmp;              /* jz: Dialnumber for Outgoing Call */
++int switch_io = 0;              /* jz: Switch for Incoming or Outgoing Call */
++
++void init_tunnel_list (struct tunnel_list *t)
++{
++    t->head = NULL;
++    t->count = 0;
++    t->calls = 0;
++}
++
++/* Now sends to syslog instead - MvO */
++void show_status (void)
++{
++    struct schedule_entry *se;
++    struct tunnel *t;
++    struct call *c;
++    struct lns *tlns;
++    struct lac *tlac;
++    struct host *h;
++    int s = 0;
++    log (LOG_WARN, "====== l2tpd statistics ========\n");
++    log (LOG_WARN, " Scheduler entries:\n");
++    se = events;
++    while (se)
++    {
++        s++;
++        t = (struct tunnel *) se->data;
++        tlac = (struct lac *) se->data;
++        c = (struct call *) se->data;
++        if (se->func == &hello)
++        {
++            log (LOG_WARN, "%d: HELLO to %d\n", s, t->tid);
++        }
++        else if (se->func == &magic_lac_dial)
++        {
++            log (LOG_WARN, "%d: Magic dial on %s\n", s, tlac->entname);
++        }
++        else if (se->func == &send_zlb)
++        {
++            log (LOG_WARN, "%d: Send payload ZLB on call %d:%d\n", s,
++                     c->container->tid, c->cid);
++        }
++        else if (se->func == &dethrottle)
++        {
++            log (LOG_WARN, "%d: Dethrottle call %d:%d\n", s, c->container->tid,
++                     c->cid);
++        }
++        else
++            log (LOG_WARN, "%d: Unknown event\n", s);
++        se = se->next;
++    };
++    log (LOG_WARN, "Total Events scheduled: %d\n", s);
++    log (LOG_WARN, "Number of tunnels open: %d\n", tunnels.count);
++    t = tunnels.head;
++    while (t)
++    {
++        log (LOG_WARN, "Tunnel %s, ID = %d (local), %d (remote) to %s:%d\n"
++                 "   control_seq_num = %d, control_rec_seq_num = %d,\n"
++                 "   cLr = %d\n",
++                 (t->lac ? t->lac->entname : (t->lns ? t->lns->entname : "")),
++                 t->ourtid, t->tid, IPADDY (t->peer.sin_addr),
++                 ntohs (t->peer.sin_port), t->control_seq_num,
++                 t->control_rec_seq_num, t->cLr);
++        c = t->call_head;
++        while (c)
++        {
++            log (LOG_WARN, 
++                     "Call %s, ID = %d (local), %d (remote), serno = %u,\n"
++                     "      data_seq_num = %d, data_rec_seq_num = %d,\n"
++                     "      pLr = %d, tx = %u bytes (%u), rx= %u bytes (%u)\n",
++                     (c->lac ? c->lac->
++                      entname : (c->lns ? c->lns->entname : "")), c->ourcid,
++                     c->cid, c->serno, c->data_seq_num, c->data_rec_seq_num,
++                     c->pLr, c->tx_bytes, c->tx_pkts, c->rx_bytes, c->rx_pkts);
++            c = c->next;
++        }
++        t = t->next;
++    }
++    log (LOG_WARN, "==========Config File===========\n");
++    tlns = lnslist;
++    while (tlns)
++    {
++        log (LOG_WARN, "LNS entry %s\n",
++                 tlns->entname[0] ? tlns->entname : "(unnamed)");
++        tlns = tlns->next;
++    };
++    tlac = laclist;
++    while (tlac)
++    {
++        log (LOG_WARN, "LAC entry %s, LNS is/are:",
++                 tlac->entname[0] ? tlac->entname : "(unnamed)");
++        h = tlac->lns;
++        if (h)
++        {
++            while (h)
++            {
++                log (LOG_WARN, " %s", h->hostname);
++                h = h->next;
++            }
++        }
++        else
++            log (LOG_WARN, " [none]");
++        log (LOG_WARN, "\n");
++        tlac = tlac->next;
++    };
++    log (LOG_WARN, "================================\n");
++}
++
++void null_handler(int sig)
++{
++       /* FIXME 
++        * A sighup is received when a call is terminated, unknown origine .. 
++        * I catch it and ll looks good, but .. 
++      */
++}
++
++void status_handler (int sig)
++{
++    show_status ();
++}
++
++void child_handler (int signal)
++{
++    /*
++     * Oops, somebody we launched was killed.
++     * It's time to reap them and close that call.
++     * But first, we have to find out what PID died.
++     * unfortunately, pppd will 
++     */
++    struct tunnel *t;
++    struct call *c;
++    pid_t pid;
++    int status;
++    t = tunnels.head;
++    /* Keep looping until all are cleared */
++    for(;;)
++    {
++        pid = waitpid (-1, &status, WNOHANG);
++        if (pid < 1)
++        {
++            /*
++             * Oh well, nobody there.  Maybe we reaped it
++             * somewhere else already
++             */
++            return;
++        }
++        while (t)
++        {
++            c = t->call_head;
++            while (c)
++            {
++                if (c->pppd == pid)
++                {
++                    if ( WIFEXITED( status ) )
++                    {
++                        log (LOG_DEBUG, "%s : pppd exited for call %d with code %d\n", __FUNCTION__,
++                         c->cid, WEXITSTATUS( status ) );
++                    }
++                    else if( WIFSIGNALED( status ) )
++                    {
++                        log (LOG_DEBUG, "%s : pppd terminated for call %d by signal %d\n", __FUNCTION__,
++                         c->cid, WTERMSIG( status ) );
++                    }
++                    else
++                    {
++                        log (LOG_DEBUG, "%s : pppd exited for call %d for unknown reason\n", __FUNCTION__,
++                         c->cid );
++                    }
++                    c->needclose = -1;
++                    /* 
++                     * OK...pppd died, we can go ahead and close the pty for
++                     * it
++                     */
++                    close (c->fd);
++                    c->fd = -1;
++                    return;
++                }
++                c = c->next;
++            }
++            t = t->next;
++        }
++    }
++}
++
++void death_handler (int signal)
++{
++    /*
++       * If we get here, somebody terminated us with a kill or a control-c.
++       * we call call_close on each tunnel twice to get a StopCCN out
++       * for each one (we can't pause to make sure it's received.
++       * Then we close the connections
++     */
++    struct tunnel *st, *st2;
++    int sec;
++    log (LOG_CRIT, "%s: Fatal signal %d received\n", __FUNCTION__, signal);
++    st = tunnels.head;
++    while (st)
++    {
++        st2 = st->next;
++        strcpy (st->self->errormsg, "Server closing");
++        sec = st->self->closing;
++        if (st->lac)
++            st->lac->redial = 0;
++        call_close (st->self);
++        if (!sec)
++        {
++            st->self->closing = -1;
++            call_close (st->self);
++        }
++        st = st2;
++    }
++
++    /* erase pid file */
++      unlink (gconfig.pidfile);
++
++      /* erase control pipe */
++      unlink(CONTROL_PIPE);
++
++    exit (1);
++}
++
++int start_pppd (struct call *c, struct ppp_opts *opts)
++{
++    char a, b;
++    char tty[80];
++    char *stropt[80];
++    struct ppp_opts *p;
++#ifdef USE_KERNEL
++    struct l2tp_call_opts co;
++#endif
++    int pos = 1;
++    int fd2;
++#ifdef DEBUG_PPPD
++    int x;
++#endif
++    struct termios ptyconf;
++    char *str;
++    p = opts;
++    stropt[0] = strdup (PPPD);
++    while (p)
++    {
++        stropt[pos] = (char *) malloc (strlen (p->option) + 1);
++        strncpy (stropt[pos], p->option, strlen (p->option) + 1);
++        pos++;
++        p = p->next;
++    }
++    stropt[pos] = NULL;
++    if (c->pppd > 0)
++    {
++        log (LOG_WARN, "%s: PPP already started on call!\n", __FUNCTION__);
++        return -EINVAL;
++    }
++    if (c->fd > -1)
++    {
++        log (LOG_WARN, "%s: file descriptor already assigned!\n",
++             __FUNCTION__);
++        return -EINVAL;
++    }
++#ifdef USE_KERNEL
++    if (kernel_support)
++    {
++        co.ourtid = c->container->ourtid;
++        co.ourcid = c->ourcid;
++        ioctl (server_socket, L2TPIOCGETCALLOPTS, &co);
++        stropt[pos++] = strdup ("channel");
++        stropt[pos] = (char *) malloc (10);
++        snprintf (stropt[pos], 10, "%d", co.id);
++        pos++;
++        stropt[pos] = NULL;
++    }
++    else
++    {
++#endif
++        if ((c->fd = getPtyMaster (&a, &b)) < 0)
++        {
++            log (LOG_WARN, "%s: unable to allocate pty, abandoning!\n",
++                 __FUNCTION__);
++            return -EINVAL;
++        }
++
++        /* set fd opened above to not echo so we don't see read our own packets
++           back of the file descriptor that we just wrote them to */
++        tcgetattr (c->fd, &ptyconf);
++        *(c->oldptyconf) = ptyconf;
++        ptyconf.c_cflag &= ~(ICANON | ECHO);
++        tcsetattr (c->fd, TCSANOW, &ptyconf);
++
++        snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
++        fd2 = open (tty, O_RDWR);
++
++#ifdef USE_KERNEL
++    }
++#endif
++    str = stropt[0];
++#ifdef DEBUG_PPPD
++    log (LOG_DEBUG, "%s: I'm running:  ", __FUNCTION__);
++    for (x = 0; stropt[x]; x++)
++    {
++        log (LOG_DEBUG, "\"%s\" ", stropt[x]);
++    };
++    log (LOG_DEBUG, "\n");
++#endif
++    c->pppd = fork ();
++    if (c->pppd < 0)
++    {
++        log (LOG_WARN, "%s: unable to fork(), abandoning!\n", __FUNCTION__);
++        return -EINVAL;
++    }
++    else if (!c->pppd)
++    {
++        struct call *sc;
++        struct tunnel *st;
++
++        close (0);
++        close (1);
++        close (2);
++#ifdef USE_KERNEL
++        if (!kernel_support && (fd2 < 0))
++#else
++        if (fd2 < 0)
++#endif
++        {
++            log (LOG_WARN, "%s: Unable to open %s to launch pppd!\n",
++                 __FUNCTION__, tty);
++            exit (1);
++        }
++        dup2 (fd2, 0);
++        dup2 (fd2, 1);
++
++
++        /* close all the calls pty fds */
++        st = tunnels.head;
++        while (st)
++        {
++            sc = st->call_head;
++            while (sc)
++            {
++                close (sc->fd);
++                sc = sc->next;
++            }
++            st = st->next;
++        }
++
++        /* close the UDP socket fd */
++        close (server_socket);
++
++        /* close the control pipe fd */
++        close (control_fd);
++
++        if( c->dialing[0] )
++        {
++            setenv( "CALLER_ID", c->dialing, 1 );
++        }
++        execv (PPPD, stropt);
++        log (LOG_WARN, "%s: Exec of %s failed!\n", __FUNCTION__, PPPD);
++        exit (1);
++    };
++    close (fd2);
++    pos = 0;
++    while (stropt[pos])
++    {
++        free (stropt[pos]);
++        pos++;
++    };
++    return 0;
++}
++
++void destroy_tunnel (struct tunnel *t)
++{
++    /*
++     * Immediately destroy a tunnel (and all its calls)
++     * and free its resources.  This may be called
++     * by the tunnel itself,so it needs to be
++     * "suicide safe"
++     */
++
++    struct call *c, *me;
++    struct tunnel *p;
++    struct timeval tv;
++    if (!t)
++        return;
++
++    /*
++     * Save ourselves until the very
++     * end, since we might be calling this ourselves.
++     * We must divorce ourself from the tunnel
++     * structure, however, to avoid recursion
++     * because of the logic of the destroy_call
++     */
++    me = t->self;
++
++    /*
++     * Destroy all the member calls
++     */
++    c = t->call_head;
++    while (c)
++    {
++        destroy_call (c);
++        c = c->next;
++    };
++    /*
++     * Remove ourselves from the list of tunnels
++     */
++
++    if (tunnels.head == t)
++    {
++        tunnels.head = t->next;
++        tunnels.count--;
++    }
++    else
++    {
++        p = tunnels.head;
++        if (p)
++        {
++            while (p->next && (p->next != t))
++                p = p->next;
++            if (p->next)
++            {
++                p->next = t->next;
++                tunnels.count--;
++            }
++            else
++            {
++                log (LOG_WARN,
++                     "%s: unable to locate tunnel in tunnel list\n",
++                     __FUNCTION__);
++            }
++        }
++        else
++        {
++            log (LOG_WARN, "%s: tunnel list is empty!\n", __FUNCTION__);
++        }
++    }
++    if (t->lac)
++    {
++        t->lac->t = NULL;
++        if (t->lac->redial && (t->lac->rtimeout > 0) && !t->lac->rsched &&
++            t->lac->active)
++        {
++            log (LOG_LOG, "%s: Will redial in %d seconds\n", __FUNCTION__,
++                 t->lac->rtimeout);
++            tv.tv_sec = t->lac->rtimeout;
++            tv.tv_usec = 0;
++            t->lac->rsched = schedule (tv, magic_lac_dial, t->lac);
++        }
++    }
++    /* XXX L2TP/IPSec: remove relevant SAs here?  NTB 20011010
++     * XXX But what if another tunnel is using same SA?
++     */
++    if (t->lns)
++        t->lns->t = NULL;
++    free (t);
++    free (me);
++}
++
++struct tunnel *l2tp_call (char *host, int port, struct lac *lac,
++                          struct lns *lns)
++{
++    /*
++     * Establish a tunnel from us to host
++     * on port port
++     */
++    struct call *tmp = NULL;
++    struct hostent *hp;
++    unsigned int addr;
++    port = htons (port);
++    hp = gethostbyname (host);
++    if (!hp)
++    {
++        log (LOG_WARN, "%s: gethostbyname() failed for %s.\n", __FUNCTION__,
++             host);
++        return NULL;
++    }
++    bcopy (hp->h_addr, &addr, hp->h_length);
++    /* Force creation of a new tunnel
++       and set it's tid to 0 to cause
++       negotiation to occur */
++    /* XXX L2TP/IPSec: Set up SA to addr:port here?  NTB 20011010
++     */
++    tmp = get_call (0, 0, addr, port);
++    if (!tmp)
++    {
++        log (LOG_WARN, "%s: Unable to create tunnel to %s.\n", __FUNCTION__,
++             host);
++        return NULL;
++    }
++    tmp->container->tid = 0;
++    tmp->container->lac = lac;
++    tmp->container->lns = lns;
++    tmp->lac = lac;
++    tmp->lns = lns;
++    if (lac)
++        lac->t = tmp->container;
++    if (lns)
++        lns->t = tmp->container;
++    /*
++     * Since our state is 0, we will establish a tunnel now
++     */
++    log (LOG_LOG, "%s:Connecting to host %s, port %d\n", __FUNCTION__, host,
++         ntohs (port));
++    control_finish (tmp->container, tmp);
++    return tmp->container;
++}
++
++void magic_lac_tunnel (void *data)
++{
++    struct lac *lac;
++    lac = (struct lac *) data;
++    if (!lac)
++    {
++        log (LOG_WARN, "%s: magic_lac_tunnel: called on NULL lac!\n",
++             __FUNCTION__);
++        return;
++    }
++    if (lac->lns)
++    {
++        /* FIXME: I should try different LNS's if I get failures */
++        l2tp_call (lac->lns->hostname, lac->lns->port, lac, NULL);
++        return;
++    }
++    else if (deflac && deflac->lns)
++    {
++        l2tp_call (deflac->lns->hostname, deflac->lns->port, lac, NULL);
++        return;
++    }
++    else
++    {
++        log (LOG_WARN, "%s: Unable to find hostname to dial for '%s'\n",
++             __FUNCTION__, lac->entname);
++        return;
++    }
++}
++
++struct call *lac_call (int tid, struct lac *lac, struct lns *lns)
++{
++    struct tunnel *t = tunnels.head;
++    struct call *tmp;
++    while (t)
++    {
++        if (t->ourtid == tid)
++        {
++            tmp = new_call (t);
++            if (!tmp)
++            {
++                log (LOG_WARN, "%s: unable to create new call\n",
++                     __FUNCTION__);
++                return NULL;
++            }
++            tmp->next = t->call_head;
++            t->call_head = tmp;
++            t->count++;
++            tmp->cid = 0;
++            tmp->lac = lac;
++            tmp->lns = lns;
++            if (lac)
++                lac->c = tmp;
++            log (LOG_LOG, "%s: Calling on tunnel %d\n", __FUNCTION__, tid);
++            strcpy (tmp->dial_no, dial_no_tmp); /*  jz: copy dialnumber to tmp->dial_no  */
++            control_finish (t, tmp);
++            return tmp;
++        }
++        t = t->next;
++    };
++    log (LOG_DEBUG, "%s: No such tunnel %d to generate call.\n", __FUNCTION__,
++         tid);
++    return NULL;
++}
++
++void magic_lac_dial (void *data)
++{
++    struct lac *lac;
++    lac = (struct lac *) data;
++
++    if (!lac)
++    {
++        log (LOG_WARN, "%s : called on NULL lac!\n", __FUNCTION__);
++        return;
++    }
++      if (!lac->active)
++    {
++        log (LOG_DEBUG, "%s: LAC %s not active", __FUNCTION__, lac->entname);
++        return;
++    }
++    lac->rsched = NULL;
++    lac->rtries++;
++    if (lac->rmax && (lac->rtries > lac->rmax))
++    {
++        log (LOG_LOG, "%s: maximum retries exceeded.\n", __FUNCTION__);
++        return;
++    }
++    if (!lac->t)
++    {
++#ifdef DEGUG_MAGIC
++        log (LOG_DEBUG, "%s : tunnel not up!  Connecting!\n", __FUNCTION__);
++#endif
++        magic_lac_tunnel (lac);
++        return;
++    }
++    lac_call (lac->t->ourtid, lac, NULL);
++}
++
++void lac_hangup (int cid)
++{
++    struct tunnel *t = tunnels.head;
++    struct call *tmp;
++    while (t)
++    {
++        tmp = t->call_head;
++        while (tmp)
++        {
++            if (tmp->ourcid == cid)
++            {
++                log (LOG_LOG,
++                     "%s :Hanging up call %d, Local: %d, Remote: %d\n",
++                     __FUNCTION__, tmp->serno, tmp->ourcid, tmp->cid);
++                strcpy (tmp->errormsg, "Goodbye!");
++/*                            tmp->needclose = -1; */
++                kill (tmp->pppd, SIGTERM);
++                return;
++            }
++            tmp = tmp->next;
++        }
++        t = t->next;
++    };
++    log (LOG_DEBUG, "%s : No such call %d to hang up.\n", __FUNCTION__, cid);
++    return;
++}
++
++void lac_disconnect (int tid)
++{
++    struct tunnel *t = tunnels.head;
++    while (t)
++    {
++        if (t->ourtid == tid)
++        {
++            log (LOG_LOG,
++                 "%s: Disconnecting from %s, Local: %d, Remote: %d\n",
++                 __FUNCTION__, IPADDY (t->peer.sin_addr), t->ourtid, t->tid);
++            t->self->needclose = -1;
++            strcpy (t->self->errormsg, "Goodbye!");
++            call_close (t->self);
++            return;
++        }
++        t = t->next;
++    };
++    log (LOG_DEBUG, "%s: No such tunnel %d to hang up.\n", __FUNCTION__, tid);
++    return;
++}
++
++struct tunnel *new_tunnel ()
++{
++    struct tunnel *tmp = malloc (sizeof (struct tunnel));
++    char entropy_buf[2] = "\0";
++    if (!tmp)
++        return NULL;
++    tmp->control_seq_num = 0;
++    tmp->control_rec_seq_num = 0;
++    tmp->cLr = 0;
++    tmp->call_head = NULL;
++    tmp->next = NULL;
++    tmp->debug = -1;
++    tmp->tid = -1;
++    tmp->hello = NULL;
++#ifndef TESTING
++/*    while(get_call((tmp->ourtid = rand() & 0xFFFF),0,0,0)); */
++#ifdef USE_KERNEL
++    if (kernel_support)
++        tmp->ourtid = ioctl (server_socket, L2TPIOCADDTUNNEL, 0);
++    else
++#endif
++/*        tmp->ourtid = rand () & 0xFFFF; */
++        /* get_entropy((char *)&tmp->ourtid, 2); */
++        get_entropy(entropy_buf, 2);
++        {
++            int *temp;
++            temp = (int *)entropy_buf;
++            tmp->ourtid = *temp & 0xFFFF;
++#ifdef DEBUG_ENTROPY
++            log(LOG_DEBUG, "ourtid = %u, entropy_buf = %hx\n", tmp->ourtid, *temp);
++#endif
++        }
++#else
++    tmp->ourtid = 0x6227;
++#endif
++    tmp->nego = 0;
++    tmp->count = 0;
++    tmp->state = 0;             /* Nothing */
++    tmp->peer.sin_family = AF_INET;
++    tmp->peer.sin_port = 0;
++    bzero (&(tmp->peer.sin_addr), sizeof (tmp->peer.sin_addr));
++    tmp->sanity = -1;
++    tmp->qtid = -1;
++    tmp->ourfc = ASYNC_FRAMING | SYNC_FRAMING;
++    tmp->ourbc = 0;
++    tmp->ourtb = (((_u64) rand ()) << 32) | ((_u64) rand ());
++    tmp->fc = -1;               /* These really need to be specified by the peer */
++    tmp->bc = -1;               /* And we want to know if they forgot */
++    tmp->hostname[0] = 0;
++    tmp->vendor[0] = 0;
++    tmp->secret[0] = 0;
++    if (!(tmp->self = new_call (tmp)))
++    {
++        free (tmp);
++        return NULL;
++    };
++    tmp->ourrws = DEFAULT_RWS_SIZE;
++    tmp->self->ourfbit = FBIT;
++    tmp->lac = NULL;
++    tmp->lns = NULL;
++    tmp->chal_us.state = 0;
++    tmp->chal_us.secret[0] = 0;
++    memset (tmp->chal_us.reply, 0, MD_SIG_SIZE);
++    tmp->chal_them.state = 0;
++    tmp->chal_them.secret[0] = 0;
++    memset (tmp->chal_them.reply, 0, MD_SIG_SIZE);
++    tmp->chal_them.vector = (unsigned char *) malloc (VECTOR_SIZE);
++    tmp->chal_us.vector = NULL;
++    tmp->hbit = 0;
++    return tmp;
++}
++
++void do_control ()
++{
++    char buf[1024];
++    char *host, *tunstr, *callstr, *tmpstr;
++    struct lac *lac;
++    int call;
++    int tunl;
++    int cnt = -1;
++    while (cnt)
++    {
++        cnt = read (control_fd, buf, sizeof (buf));
++        if (cnt > 0)
++        {
++            if (buf[cnt - 1] == '\n')
++                buf[--cnt] = 0;
++#ifdef DEBUG_CONTROL
++            log (LOG_DEBUG, "%s: Got message \"%s\" (%d bytes long)\n",
++                 __FUNCTION__, buf, cnt);
++#endif
++            switch (buf[0])
++            {
++            case 't':
++                host = strchr (buf, ' ');
++                              if(!host)
++                                      goto out;
++                              host++;
++#ifdef DEBUG_CONTROL
++                log (LOG_DEBUG, "%s: Attempting to tunnel to %s\n",
++                     __FUNCTION__, host);
++#endif
++                l2tp_call (host, UDP_LISTEN_PORT, NULL, NULL);
++                break;
++            case 'c':            /* option 'c' for incoming call */
++            case 'o':          /* option 'o' for outgoing call */
++                              tunstr = strchr (buf, ' ');
++                              if(!tunstr)
++                                      goto out;
++                              tunstr++;
++
++                              if(buf[0] == 'c')
++                      switch_io = 1;  /* Switch for Incoming Calls */
++                              else {
++                      switch_io = 0;  /* Switch for Outgoing Calls */
++                                      tmpstr = strchr(tunstr, ' ');
++                                      if(!tmpstr)
++                                              goto out;
++                                      strncpy(dial_no_tmp,tmpstr, sizeof(*dial_no_tmp));
++                              }
++                
++                lac = laclist;
++                while (lac)
++                {
++                    if (!strcasecmp (lac->entname, tunstr))
++                    {
++                        lac->active = -1;
++                        lac->rtries = 0;
++                        if (!lac->c)
++                            magic_lac_dial (lac);
++                        else
++                            log (LOG_DEBUG,
++                                 "%s: Session '%s' already active!\n",
++                                 __FUNCTION__, lac->entname);
++                        break;
++                    }
++                    lac = lac->next;
++                }
++                if (lac)
++                    break;
++                tunl = atoi (tunstr);
++                if (!tunl)
++                {
++                    log (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
++                         tunstr);
++                    break;
++                }
++#ifdef DEBUG_CONTROL
++                log (LOG_DEBUG, "%s: Attempting to call on tunnel %d\n",
++                     __FUNCTION__, tunl);
++#endif
++                lac_call (tunl, NULL, NULL);
++                break;
++            case 'h':
++                callstr = strchr (buf, ' ');
++                if(!callstr)
++                                      goto out;
++                              callstr++;
++
++                call = atoi (callstr);
++#ifdef DEBUG_CONTROL
++                log (LOG_DEBUG, "%s: Attempting to call %d\n", __FUNCTION__,
++                     call);
++#endif
++                lac_hangup (call);
++                break;
++            case 'd':
++                tunstr = strchr (buf, ' ');
++                if(!tunstr)
++                                      goto out;
++                              tunstr++;
++
++                lac = laclist;
++                while (lac)
++                {
++                    if (!strcasecmp (lac->entname, tunstr))
++                    {
++                        lac->active = 0;
++                        lac->rtries = 0;
++                        if (lac->t)
++                            lac_disconnect (lac->t->ourtid);
++                        else
++                            log (LOG_DEBUG, "%s: Session '%s' not up\n",
++                                 __FUNCTION__, lac->entname);
++                        break;
++                    }
++                    lac = lac->next;
++                }
++                if (lac)
++                    break;
++                tunl = atoi (tunstr);
++                if (!tunl)
++                {
++                    log (LOG_DEBUG, "%s: No such tunnel '%s'\n", __FUNCTION__,
++                         tunstr);
++                    break;
++                }
++#ifdef DEBUG_CONTROL
++                log (LOG_DEBUG, "%s: Attempting to disconnect tunnel %d\n",
++                     __FUNCTION__, tunl);
++#endif
++                lac_disconnect (tunl);
++                break;
++            case 's':
++                show_status ();
++                break;
++            default:
++                log (LOG_DEBUG, "%s: Unknown command %c\n", __FUNCTION__,
++                     buf[0]);
++            }
++        }
++    }
++
++out:
++    /* Otherwise select goes nuts */
++    close (control_fd);
++    control_fd = open (CONTROL_PIPE, O_RDONLY | O_NONBLOCK, 0600);
++}
++
++void usage(void) {
++    printf("Usage: l2tpd -D -c [config file] -s [secret file] -p [pid file]\n");
++    printf("\n");
++    exit(1);
++}
++
++void init_args(int argc, char *argv[]) {
++    int i=0;
++    gconfig.daemon=1;
++    memset(gconfig.altauthfile,0,STRLEN);
++    memset(gconfig.altconfigfile,0,STRLEN);
++    memset(gconfig.authfile,0,STRLEN);
++    memset(gconfig.configfile,0,STRLEN);
++    memset(gconfig.pidfile,0,STRLEN);
++    strncpy(gconfig.altauthfile,ALT_DEFAULT_AUTH_FILE,
++            sizeof(gconfig.altauthfile) - 1);
++    strncpy(gconfig.altconfigfile,ALT_DEFAULT_CONFIG_FILE,
++            sizeof(gconfig.altconfigfile) - 1);
++    strncpy(gconfig.authfile,DEFAULT_AUTH_FILE,
++            sizeof(gconfig.authfile) - 1);
++    strncpy(gconfig.configfile,DEFAULT_CONFIG_FILE,
++            sizeof(gconfig.configfile) - 1);
++    strncpy(gconfig.pidfile,DEFAULT_PID_FILE,
++            sizeof(gconfig.pidfile) - 1);
++    for (i = 1; i < argc; i++) {
++        if(! strncmp(argv[i],"-c",2)) {
++            if(++i == argc)
++                usage();
++            else
++                strncpy(gconfig.configfile,argv[i],
++                        sizeof(gconfig.configfile) - 1);
++        }
++        else if (! strncmp(argv[i],"-D",2)) {
++            gconfig.daemon=0;
++        }
++        else if (! strncmp(argv[i],"-s",2)) {
++            if(++i == argc)
++                usage();
++            else
++                strncpy(gconfig.authfile,argv[i],
++                        sizeof(gconfig.authfile) - 1);
++        }
++        else if (! strncmp(argv[i],"-p",2)) {
++            if(++i == argc)
++                usage();
++            else
++                strncpy(gconfig.pidfile,argv[i],
++                        sizeof(gconfig.pidfile) - 1);
++        }
++        else {
++            usage();
++        }
++    }
++}
++
++
++void daemonize() {
++    int pid=0;
++    int i,l;
++    char buf[STRLEN];
++
++    if((pid = fork()) < 0) {
++        log(LOG_LOG, "%s: Unable to fork ()\n",__FUNCTION__);
++        close(server_socket);
++        exit(1);
++    }
++    else if (pid)
++        exit(0);
++
++
++      close(0);
++      close(1);
++      close(2);
++      dup2(open("/dev/null", O_RDONLY), 0);
++      dup2(open("/dev/null", O_RDONLY), 1);
++      dup2(open("/dev/null", O_RDONLY), 2);
++
++    /* Read previous pid file. */
++    if((i = open(gconfig.pidfile,O_RDONLY)) > 0) {
++              l=read(i,buf,sizeof(buf)-1);                                                             
++        if (l >= 0) {
++              buf[l] = '\0';                                                                       
++              pid = atoi(buf);                                                                     
++        }
++              close(i);
++
++              /* if pid is read and process exist exit */
++        if(pid && !kill(pid, 0)) {
++            log(LOG_LOG, "%s: There's already a l2tpd server running.\n",
++                    __FUNCTION__);
++            close(server_socket);
++            exit(1);
++        }
++
++              /* remove stalled pid file */
++              unlink(gconfig.pidfile);
++    }
++
++    pid = setsid();
++
++      /* create new pid file */
++      if ((i = open (gconfig.pidfile, O_WRONLY | O_CREAT, 0644)) >= 0) {
++              snprintf (buf, sizeof(buf), "%d", (int)getpid());
++              write (i, buf, strlen(buf));
++              close (i);
++      }
++      else {
++              log(LOG_LOG, "%s: could not write pid file %s error %d",
++                              __FUNCTION__, gconfig.pidfile, i);
++              close(server_socket);
++              exit(1);
++      }
++}
++
++
++void init (int argc,char *argv[])
++{
++    struct lac *lac;
++    struct in_addr listenaddr;
++
++    init_args (argc,argv);
++    srand( time(NULL) );
++    rand_source = 0;
++    init_addr ();
++    if (init_config ())
++    {
++        log (LOG_CRIT, "%s: Unable to load config file\n", __FUNCTION__);
++        exit (1);
++    }
++    if (uname (&uts))
++    {
++        log (LOG_CRIT, "%s : Unable to determine host system\n",
++             __FUNCTION__);
++        exit (1);
++    }
++    init_tunnel_list (&tunnels);
++    if (init_network ())
++        exit (1);
++    if (gconfig.daemon)
++      daemonize ();
++    signal (SIGTERM, &death_handler);
++    signal (SIGINT, &death_handler);
++    signal (SIGCHLD, &child_handler);
++    signal (SIGUSR1, &status_handler);
++    signal (SIGHUP, &null_handler);
++    init_scheduler ();
++    mkfifo (CONTROL_PIPE, 0600);
++    control_fd = open (CONTROL_PIPE, O_RDONLY | O_NONBLOCK, 0600);
++    if (control_fd < 0)
++    {
++        log (LOG_CRIT, "%s: Unable to open " CONTROL_PIPE " for reading.",
++             __FUNCTION__);
++        exit (1);
++    }
++    log (LOG_LOG, "l2tpd version " SERVER_VERSION " started on %s PID:%d\n",
++         hostname, getpid ());
++    listenaddr.s_addr = gconfig.listenaddr;
++    log (LOG_LOG, "%s version %s on a %s, listening on IP address %s, port %d\n", uts.sysname,
++       uts.release, uts.machine, inet_ntoa(listenaddr), gconfig.port);
++    lac = laclist;
++    while (lac)
++    {
++        if (lac->autodial)
++        {
++#ifdef DEBUG_MAGIC
++            log (LOG_DEBUG, "%s: Autodialing '%s'\n", __FUNCTION__,
++                 lac->entname[0] ? lac->entname : "(unnamed)");
++#endif
++            lac->active = -1;
++            switch_io = 1;      /* If we're a LAC, autodials will be ICRQ's */
++            magic_lac_dial (lac);
++        }
++        lac = lac->next;
++    }
++}
++
++int main (int argc, char *argv[])
++{
++    init(argc,argv);
++    dial_no_tmp = calloc (128, sizeof (char));
++    network_thread ();
++    return 0;
++}
diff --git a/net/l2tpd/patches/004-gcc4.patch b/net/l2tpd/patches/004-gcc4.patch
new file mode 100644 (file)
index 0000000..c4a906e
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN ../tmp-orig/l2tpd-0.70-pre20031121/aaa.c ./aaa.c
+--- ../tmp-orig/l2tpd-0.70-pre20031121/aaa.c   2004-12-09 09:54:10.159417376 +0100
++++ ./aaa.c    2004-12-09 09:54:01.918670160 +0100
+@@ -27,7 +27,7 @@
+ /* FIXME: Accounting? */
+-static struct addr_ent *uaddr[ADDR_HASH_SIZE];
++struct addr_ent *uaddr[ADDR_HASH_SIZE];
+ void init_addr ()
+ {
diff --git a/net/l2tpd/patches/004-nonblock.patch b/net/l2tpd/patches/004-nonblock.patch
new file mode 100644 (file)
index 0000000..7fc2226
--- /dev/null
@@ -0,0 +1,26 @@
+--- l2tpd-0.70-pre20031121.orig/l2tpd.c.orig   2006-04-05 13:28:36.000000000 +0100
++++ l2tpd-0.70-pre20031121.orig/l2tpd.c        2006-04-05 13:33:39.000000000 +0100
+@@ -289,6 +289,8 @@
+ #endif
+     struct termios ptyconf;
+     char *str;
++    int flags;
++
+     p = opts;
+     stropt[0] = strdup (PPPD);
+     while (p)
+@@ -347,6 +349,14 @@
+               close(c->fd);
+               return -EINVAL;
+           }
++          flags = fcntl(c->fd, F_GETFL);
++          if (flags < 0 || fcntl(c->fd, F_SETFL, flags | O_NONBLOCK) < 0)
++          {
++              log (LOG_WARN, "%s: unable to fcntl(O_NONBLOCK) on pty\n",
++                      __FUNCTION__);
++              close(c->fd);
++              return -EINVAL;
++          }
+           tty = ptsname(c->fd);
+           if (tty == NULL)
+           {
diff --git a/net/l2tpd/patches/005-df-disable.patch b/net/l2tpd/patches/005-df-disable.patch
new file mode 100644 (file)
index 0000000..806c48d
--- /dev/null
@@ -0,0 +1,25 @@
+Patch to stop l2tpd setting the DF bit on each of the packets it sends.
+Apart from not being useful with L2TP, this also prevents interoperating
+with Cisco IOS over IPSEC.
+
+--- l2tpd-0.70-pre20031121.orig/network.c.orig 2006-04-11 08:50:38.000000000 +0100
++++ l2tpd-0.70-pre20031121.orig/network.c      2006-04-11 08:58:18.000000000 +0100
+@@ -56,6 +56,18 @@
+              __FUNCTION__);
+         return -EINVAL;
+     };
++#ifdef IP_MTU_DISCOVER
++#ifdef IP_PMTUDISC_DONT
++    {
++        /* Don't set DF bit on outbound packets */
++        int val = IP_PMTUDISC_DONT;
++        if (setsockopt(server_socket, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val)) < 0)
++        {
++            log (LOG_LOG, "Failed to disable PMTU discovery\n");
++        }
++    }
++#endif
++#endif
+     /* L2TP/IPSec: Set up SA for listening port here?  NTB 20011015
+      */
+     if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
diff --git a/net/l2tpns/Makefile b/net/l2tpns/Makefile
new file mode 100644 (file)
index 0000000..c64378d
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2006 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:=l2tpns
+PKG_VERSION:=2.1.21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/l2tpns
+PKG_MD5SUM:=385c58055723ebc6c38062acd2db9c2c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/l2tpns
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libcli
+  TITLE:=An L2TP enhanced server
+  URL:=http://sourceforge.net/projects/l2tpns
+  SUBMENU:=VPN
+endef
+
+define Package/l2tpns/description
+       l2tpns is a layer 2 tunneling protocol network server (LNS).
+       it supports up to 65535 concurrent sessions per server/cluster
+       plus ISP features such as rate limiting, walled garden, usage
+       accounting, and more.
+endef
+
+define Package/l2tpns/conffiles
+/etc/l2tpns/ip_pool
+/etc/l2tpns/startup-config
+/etc/l2tpns/users
+endef
+       
+define Build/Compile
+       $(call Build/Compile/Default, \
+               LD="$(TARGET_CC)" \
+               OPTIM="$(TARGET_CFLAGS)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install \
+       )
+endef
+
+define Package/l2tpns/install  
+       $(INSTALL_DIR) $(1)/etc/l2tpns
+       $(CP) $(PKG_INSTALL_DIR)/etc/l2tpns/* $(1)/etc/l2tpns/
+       $(INSTALL_DIR) $(1)/usr/lib/l2tpns
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/l2tpns/* $(1)/usr/lib/l2tpns/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,l2tpns))
diff --git a/net/l2tpns/patches/001-honor_includes_no_fifo_scheduler.patch b/net/l2tpns/patches/001-honor_includes_no_fifo_scheduler.patch
new file mode 100644 (file)
index 0000000..470538b
--- /dev/null
@@ -0,0 +1,51 @@
+--- a/Makefile
++++ b/Makefile
+@@ -11,17 +11,14 @@
+ DEFINES += -DETCDIR='"$(etcdir)"'
+ OPTIM =
+-OPTIM += -g
+ OPTIM += -O3
+-CC = gcc
+-LD = gcc
+-INCLUDES = -I.
++INCLUDES = -I. -I$(STAGING_DIR)/usr/include
+ CPPFLAGS = $(INCLUDES) $(DEFINES)
+ CFLAGS = -Wall -Wformat-security -Wno-format-zero-length $(OPTIM)
+-LDFLAGS =
++LDFLAGS = -L$(STAGING_DIR)/usr/lib
+ LDLIBS =
+-INSTALL = install -c -D -o root -g root
++INSTALL = install -c -D
+ l2tpns.LIBS = -lm -lcli -ldl
+--- a/l2tpns.c
++++ b/l2tpns.c
+@@ -4239,23 +4239,8 @@
+               struct sched_param params = {0};
+               params.sched_priority = 1;
+-              if (get_nprocs() < 2)
+-              {
+-                      LOG(0, 0, 0, "Not using FIFO scheduler, there is only 1 processor in the system.\n");
+-                      config->scheduler_fifo = 0;
+-              }
+-              else
+-              {
+-                      if ((ret = sched_setscheduler(0, SCHED_FIFO, &params)) == 0)
+-                      {
+-                              LOG(1, 0, 0, "Using FIFO scheduler.  Say goodbye to any other processes running\n");
+-                      }
+-                      else
+-                      {
+-                              LOG(0, 0, 0, "Error setting scheduler to FIFO: %s\n", strerror(errno));
+-                              config->scheduler_fifo = 0;
+-                      }
+-              }
++              LOG(0, 0, 0, "Not using FIFO scheduler, there is only 1 processor in the system.\n");
++              config->scheduler_fifo = 0;
+       }
+       /* Set up the cluster communications port. */
diff --git a/net/l2tpv3tun/Makefile b/net/l2tpv3tun/Makefile
new file mode 100644 (file)
index 0000000..f72d8d4
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2009-2010 Thomas Heil <heil@terminal-consulting.de>
+# Copyright (C) 2010-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:=l2tpv3tun
+PKG_VERSION:=0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://www.openl2tp.org/releases
+PKG_MD5SUM:=d3b4a9af652cca9f34d3eea4a7ff6041
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/kernel.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/l2tpv3tun
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libnl-tiny +ip +kmod-l2tp +kmod-l2tp-ip +kmod-l2tp-eth
+  TITLE:=Control utility for static L2TP v3 (Pseudowire) tunnels
+  MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
+  URL:=http://www.openl2tp.org
+endef
+
+define Package/l2tpv3tun/description
+  The l2tpv3tun utility is a command line frontend for configuring static
+  L2TP v3 pseudowire tunnels.
+endef
+
+MAKE_FLAGS += \
+       CC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/usr/include/libnl-tiny/" \
+       LD="$(TARGET_CC)" \
+       LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/ -lnl-tiny"
+
+define Package/l2tpv3tun/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/l2tpv3tun $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/lib/network
+       $(INSTALL_BIN) ./files/l2tp.sh $(1)/lib/network/
+endef
+
+$(eval $(call BuildPackage,l2tpv3tun))
diff --git a/net/l2tpv3tun/files/l2tp.sh b/net/l2tpv3tun/files/l2tp.sh
new file mode 100644 (file)
index 0000000..a3eeb1d
--- /dev/null
@@ -0,0 +1,213 @@
+# l2tp.sh - L2TPv3 tunnel backend
+# Copyright (c) 2010 OpenWrt.org
+
+l2tp_next_tunnel_id() {
+       local max=0
+       local val
+       for val in $(
+               local l
+               l2tpv3tun show tunnel | while read l; do
+                       case "$l" in
+                               Tunnel*,*encap*) l="${l#Tunnel }"; echo "${l%%,*}";;
+                       esac
+               done
+       ); do
+               [ "$val" -gt "$max" ] && max="$val"
+       done
+       echo $((max + 1))
+}
+
+l2tp_next_session_id() {
+       local tunnel="$1"
+       local max=0
+       local val
+       for val in $(
+               local l
+               l2tpv3tun show session${tunnel:+ tunnel_id "$tunnel"} | while read l; do
+                       case "$l" in
+                               Session*in*) l="${l#Session }"; echo "${l%% *}";;
+                       esac
+               done
+       ); do
+               [ "$val" -gt "$max" ] && max="$val"
+       done
+       echo $((max + 1))
+}
+
+l2tp_tunnel_exists() {
+       test -n "$(l2tpv3tun show tunnel tunnel_id "$1" 2>/dev/null)"
+}
+
+l2tp_session_exists() {
+       test -n "$(l2tpv3tun show session tunnel_id "$1" session_id "$2" 2>/dev/null)"
+}
+
+l2tp_ifname() {
+       l2tpv3tun show session tunnel_id "$1" session_id "$2" 2>/dev/null | \
+               sed -ne 's/^.*interface name: //p'
+}
+
+l2tp_lock() {
+       lock /var/lock/l2tp-setup
+}
+
+l2tp_unlock() {
+       lock -u /var/lock/l2tp-setup
+}
+
+l2tp_log() {
+       logger -t "ifup-l2tp" "$@"
+}
+
+
+# Hook into scan_interfaces() to synthesize a .device option
+# This is needed for /sbin/ifup to properly dispatch control
+# to setup_interface_l2tp() even if no .ifname is set in
+# the configuration.
+scan_l2tp() {
+       local dev
+       config_get dev "$1" device
+       config_set "$1" device "${dev:+$dev }l2tp-$1"
+}
+
+coldplug_interface_l2tp() {
+       setup_interface_l2tp "l2tp-$1" "$1"
+}
+
+setup_interface_l2tp() {
+       local iface="$1"
+       local cfg="$2"
+       local link="l2tp-$cfg"
+
+       l2tp_lock
+
+       # prevent recursion
+       local up="$(uci_get_state network "$cfg" up 0)"
+       [ "$up" = 0 ] || {
+               l2tp_unlock
+               return 0
+       }
+
+       local tunnel_id
+       config_get tunnel_id "$cfg" tunnel_id
+       [ -n "$tunnel_id" ] || {
+               tunnel_id="$(l2tp_next_tunnel_id)"
+               uci_set_state network "$cfg" tunnel_id "$tunnel_id"
+               l2tp_log "No tunnel ID specified, assuming $tunnel_id"
+       }
+
+       local peer_tunnel_id
+       config_get peer_tunnel_id "$cfg" peer_tunnel_id
+       [ -n "$peer_tunnel_id" ] || {
+               peer_tunnel_id="$tunnel_id"
+               uci_set_state network "$cfg" peer_tunnel_id "$peer_tunnel_id"
+               l2tp_log "No peer tunnel ID specified, assuming $peer_tunnel_id"
+       }
+
+       local encap
+       config_get encap "$cfg" encap udp
+
+       local sport dport
+       [ "$encap" = udp ] && {
+               config_get sport "$cfg" sport 1701
+               config_get dport "$cfg" dport 1701
+       }
+
+       local peeraddr
+       config_get peeraddr "$cfg" peeraddr
+       [ -z "$peeraddr" ] && config_get peeraddr "$cfg" peer6addr
+
+       local localaddr
+       case "$peeraddr" in
+               *:*) config_get localaddr "$cfg" local6addr ;;
+               *)   config_get localaddr "$cfg" localaddr  ;;
+       esac
+
+       [ -n "$localaddr" -a -n "$peeraddr" ] || {
+               l2tp_log "Missing local or peer address for tunnel $cfg - skipping"
+               return 1
+       }
+
+       (
+               while ! l2tp_tunnel_exists "$tunnel_id"; do
+                       [ -n "$sport" ] && l2tpv3tun show tunnel 2>/dev/null | grep -q "ports: $sport/" && {
+                               l2tp_log "There already is a tunnel with src port $sport - skipping"
+                               l2tp_unlock
+                               return 1
+                       }
+
+                       l2tpv3tun add tunnel tunnel_id "$tunnel_id" peer_tunnel_id "$peer_tunnel_id" \
+                               encap "$encap" local "$localaddr" remote "$peeraddr" \
+                               ${sport:+udp_sport "$sport"} ${dport:+udp_dport "$dport"}
+
+                       # Wait for tunnel
+                       sleep 1
+               done
+
+
+               local session_id
+               config_get session_id "$cfg" session_id
+               [ -n "$session_id" ] || {
+                       session_id="$(l2tp_next_session_id "$tunnel_id")"
+                       uci_set_state network "$cfg" session_id "$session_id"
+                       l2tp_log "No session ID specified, assuming $session_id"
+               }
+
+               local peer_session_id
+               config_get peer_session_id "$cfg" peer_session_id
+               [ -n "$peer_session_id" ] || {
+                       peer_session_id="$session_id"
+                       uci_set_state network "$cfg" peer_session_id "$peer_session_id"
+                       l2tp_log "No peer session ID specified, assuming $peer_session_id"
+               }
+
+
+               while ! l2tp_session_exists "$tunnel_id" "$session_id"; do
+                       l2tpv3tun add session ifname "$link" tunnel_id "$tunnel_id" \
+                               session_id "$session_id" peer_session_id "$peer_session_id"
+
+                       # Wait for session
+                       sleep 1
+               done
+
+
+               local dev
+               config_get dev "$cfg" device
+
+               local ifn
+               config_get ifn "$cfg" ifname
+
+               uci_set_state network "$cfg" ifname "${ifn:-$dev}"
+               uci_set_state network "$cfg" device "$dev"
+
+               local mtu
+               config_get mtu "$cfg" mtu 1462
+
+               local ttl
+               config_get ttl "$cfg" ttl
+
+               ip link set mtu "$mtu" ${ttl:+ ttl "$ttl"} dev "$link"
+
+               # IP setup inherited from proto static
+               prepare_interface "$link" "$cfg"
+               setup_interface_static "${ifn:-$dev}" "$cfg"
+
+               ip link set up dev "$link"
+
+               uci_set_state network "$cfg" up 1
+               l2tp_unlock
+       ) &
+}
+
+stop_interface_l2tp() {
+       local cfg="$1"
+       local link="l2tp-$cfg"
+
+       local tunnel=$(uci_get_state network "$cfg" tunnel_id)
+       local session=$(uci_get_state network "$cfg" session_id)
+
+       [ -n "$tunnel" ] && [ -n "$session" ] && {
+               l2tpv3tun del session tunnel_id "$tunnel" session_id "$session"
+               l2tpv3tun del tunnel tunnel_id "$tunnel"
+       }
+}
diff --git a/net/l2tpv3tun/patches/010-custom_ifname.patch b/net/l2tpv3tun/patches/010-custom_ifname.patch
new file mode 100644 (file)
index 0000000..14a085f
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/main.c
++++ b/main.c
+@@ -560,6 +560,7 @@ static void usage(void)
+       fprintf(stderr, "          session_id ID peer_session_id ID\n");
+       fprintf(stderr, "          [ cookie HEXSTR ] [ peer_cookie HEXSTR ]\n");
+       fprintf(stderr, "          [ offset OFFSET ] [ peer_offset OFFSET ]\n");
++      fprintf(stderr, "          [ ifname IFNAME ]\n");
+       fprintf(stderr, "       %s del tunnel tunnel_id ID\n", L2TP_CMD_ROOT);
+       fprintf(stderr, "       %s del session tunnel_id ID session_id ID\n", L2TP_CMD_ROOT);
+       fprintf(stderr, "       %s show tunnel [ tunnel_id ID ]\n", L2TP_CMD_ROOT);
+@@ -671,6 +672,9 @@ static int parse_args(int argc, char **a
+                       p->peer_cookie_len = slen / 2;
+                       if (hex2mem(*argv, p->peer_cookie, p->peer_cookie_len) < 0)
+                               invarg("cookie must be a hex string\n", *argv);
++              } else if (strcmp(*argv, "ifname") == 0) {
++                      NEXT_ARG();
++                      p->ifname = *argv;
+               } else if (strcmp(*argv, "tunnel") == 0) {
+                       p->tunnel = 1;
+               } else if (strcmp(*argv, "session") == 0) {
diff --git a/net/l2tpv3tun/patches/100-nl_handle_alloc.patch b/net/l2tpv3tun/patches/100-nl_handle_alloc.patch
new file mode 100644 (file)
index 0000000..f245468
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/main.c
++++ b/main.c
+@@ -100,7 +100,7 @@ struct l2tp_data {
+ };
+ /* netlink socket */
+-static struct nl_handle *nl_sock;
++static struct nl_sock *nl_sock;
+ static int nl_family;
+ /*****************************************************************************
+@@ -788,9 +788,9 @@ static int do_show(int argc, char **argv
+ int do_ipl2tp(int argc, char **argv)
+ {
+-      nl_sock = nl_handle_alloc();
++      nl_sock = nl_socket_alloc();
+       if (!nl_sock) {
+-              perror("nl_handle_alloc");
++              perror("nl_socket_alloc");
+               return 1;
+       }
diff --git a/net/l7-protocols/Makefile b/net/l7-protocols/Makefile
new file mode 100644 (file)
index 0000000..ff095cb
--- /dev/null
@@ -0,0 +1,78 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=l7-protocols
+PKG_VERSION:=2009-05-28
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/l7-filter
+PKG_MD5SUM:=91be154d12134dcdbc560cc7aa7fe4ce
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/l7-protocols
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Protocols for layer7 filtering
+  URL:=http://l7-filter.sourceforge.net/
+  SUBMENU:=Firewall
+  DEPENDS:=iptables-mod-filter
+endef
+
+define Package/l7-protocols/description
+       l7-filter classifies packets based on patterns in application
+       layer data. This allows correct classification of P2P traffic that
+       uses unpredictable ports as well as standard protocols running on
+       non-standard ports.
+endef
+
+define Package/l7-protocols-testing
+       $(call Package/l7-protocols)
+       TITLE:=testing utilities for layer7
+       DEPENDS+=l7-protocols $(CXX_DEPENDS)
+endef
+
+define Package/l7-protocols-testing/description
+       testing utilities for layer 7 patterns
+endef
+
+define Build/Configure
+endef
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_l7-protocols-testing),)
+  define Build/Compile
+       cd $(PKG_BUILD_DIR)/testing && $(MAKE) $(CONFIGURE_VARS)
+  endef
+else
+  define Build/Compile
+  endef
+endif
+
+define Package/l7-protocols/install
+       $(INSTALL_DIR) $(1)/etc/l7-protocols
+       $(CP) $(PKG_BUILD_DIR)/example_traffic \
+               $(PKG_BUILD_DIR)/extra \
+               $(PKG_BUILD_DIR)/file_types \
+               $(PKG_BUILD_DIR)/groups.sh \
+               $(PKG_BUILD_DIR)/malware \
+               $(PKG_BUILD_DIR)/protocols \
+               $(1)/etc/l7-protocols
+endef
+
+define Package/l7-protocols-testing/install
+       $(INSTALL_DIR) $(1)/etc/l7-protocols/testing
+       $(CP) $(PKG_BUILD_DIR)/testing/data \
+               $(1)/etc/l7-protocols/testing
+       $(INSTALL_BIN) \
+               $(PKG_BUILD_DIR)/testing/rand{chars,printable} \
+               $(PKG_BUILD_DIR)/testing/test_speed-{kernel,userspace} \
+               $(PKG_BUILD_DIR)/testing/match_kernel \
+               $(PKG_BUILD_DIR)/testing/doallspeeds.sh \
+               $(PKG_BUILD_DIR)/testing/test_match.sh \
+               $(PKG_BUILD_DIR)/testing/timeit.sh \
+               $(1)/etc/l7-protocols/testing
+endef
+
+$(eval $(call BuildPackage,l7-protocols))
+$(eval $(call BuildPackage,l7-protocols-testing))
diff --git a/net/l7-protocols/patches/100-testing_crosscompile.patch b/net/l7-protocols/patches/100-testing_crosscompile.patch
new file mode 100644 (file)
index 0000000..b5d3953
--- /dev/null
@@ -0,0 +1,27 @@
+--- a/testing/Makefile
++++ b/testing/Makefile
+@@ -1,19 +1,19 @@
+ all: randchars randprintable test_speed-kernel test_speed-userspace match_kernel
+ randchars: randchars.c
+-      gcc -O2 -o randchars randchars.c
++      $(CC) $(CFLAGS) -o randchars randchars.c
+ randprintable: randprintable.c
+-      gcc -O2 -o randprintable randprintable.c
++      $(CC) $(CFLAGS) -o randprintable randprintable.c
+ test_speed-kernel: test_speed-kernel.c
+-      gcc -o test_speed-kernel test_speed-kernel.c
++      $(CC) $(CFLAGS) -o test_speed-kernel test_speed-kernel.c
+ test_speed-userspace: test_speed-userspace.cpp l7-parse-patterns.cpp l7-parse-patterns.h
+-      g++ -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
++      $(CXX) $(CXXFLAGS) -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
+ match_kernel: match-kernel.c
+-      gcc -O2 -o match_kernel match-kernel.c
++      $(CC) $(CFLAGS) -o match_kernel match-kernel.c
+ clean:
+       rm -f randprintable randchars test_speed-kernel test_speed-userspace match_kernel
diff --git a/net/l7-protocols/patches/101-testing-timeit.patch b/net/l7-protocols/patches/101-testing-timeit.patch
new file mode 100644 (file)
index 0000000..6656889
--- /dev/null
@@ -0,0 +1,102 @@
+--- a/testing/timeit.sh
++++ b/testing/timeit.sh
+@@ -1,11 +1,8 @@
+ #!/bin/bash
+-# "man 1 time" for details
+-export TIME="%U seconds"
+-
+ add()
+ {
+-      if ! dc -e ""; then
++      if ! dc p >/dev/null 2>&1; then
+               echo you do not have dc, so I cannot add these numbers...
+               exit 1
+       fi
+@@ -14,7 +11,7 @@ add()
+       tot=0
+       while read n; do
+-              tot=`dc -e "$n $tot + pop" 2> /dev/null`
++              tot=`dc $n $tot + p 2> /dev/null`
+       done
+       echo $tot seconds
+@@ -34,7 +31,7 @@ extract()
+ if [ ! $3 ] || [ $2 == "-h" ] || [ $2 == "--help" ]; then
+       echo
+-      echo Syntax: ./timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
++      echo Syntax: .//usr/bin/timeit.sh patternfile kernel\|userspace all\|print\|real [data_files]
+       echo
+       echo \"kernel\" uses the kernel pattern and library
+       echo \"userspace\" uses userspace pattern and library
+@@ -72,12 +69,12 @@ echo Timing $1
+ if [ $3 == "all" ]; then
+       echo Using all characters
+       if [ $2 == "kernel" ]; then
+-              if ! ./randchars | time $speedprog "`extract $1`" verbose; then
++              if ! ./randchars | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\  -f2; then
+                       echo $speedprog failed. > /dev/stderr
+                       exit 1
+               fi
+       else
+-              if ! ./randchars | time $speedprog -f "$1" -v; then
++              if ! ./randchars | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\  -f2; then
+                       echo $speedprog failed. > /dev/stderr
+                       exit 1
+               fi
+@@ -85,12 +82,12 @@ if [ $3 == "all" ]; then
+ elif [ $3 == "print" ]; then
+       echo Using only printable characters
+       if [ $2 == "kernel" ]; then
+-              if ! ./randprintable | time $speedprog "`extract $1`" verbose; then
++              if ! ./randprintable | /usr/bin/time $speedprog "`extract $1`" verbose 2>&1 >/dev/null | grep user | cut -d\  -f2; then
+                       echo $speedprog failed. > /dev/stderr
+                       exit 1
+               fi
+       else
+-              if ! ./randprintable | time $speedprog -f "$1" -v; then
++              if ! ./randprintable | /usr/bin/time $speedprog -f "$1" -v 2>&1 >/dev/null | grep user | cut -d\  -f2; then
+                       echo $speedprog failed. > /dev/stderr
+                       exit 1
+               fi
+@@ -107,12 +104,12 @@ elif [ $3 == "real" ]; then
+                               printf $f\\t
+                               #echo `extract $1`
+                               if [ $2 == "kernel" ]; then
+-                                      if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
++                                      if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
+                                               echo $speedprog failed. > /dev/stderr
+                                               exit 1
+                                       fi
+                               else
+-                                      if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
++                                      if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
+                                               echo $speedprog failed. > /dev/stderr
+                                               exit 1
+                                       fi
+@@ -123,12 +120,12 @@ elif [ $3 == "real" ]; then
+               for f in data/*; do
+                       printf $f\\t
+                       if [ $2 == "kernel" ]; then
+-                              if ! cat $f | time $speedprog "`extract $1`" 2> /dev/stdout | tee -a tmp.$$; then
++                              if ! cat $f | /usr/bin/time $speedprog "`extract $1`" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
+                                       echo $speedprog failed. > /dev/stderr
+                                       exit 1
+                               fi
+                       else
+-                              if ! cat $f | time $speedprog -f "$1" 2> /dev/stdout | tee -a tmp.$$; then
++                              if ! cat $f | /usr/bin/time $speedprog -f "$1" 2>&1 >/dev/null | grep user | cut -d\  -f2 | tee -a tmp.$$; then
+                                       echo $speedprog failed. > /dev/stderr
+                                       exit 1
+                               fi
+@@ -137,7 +134,7 @@ elif [ $3 == "real" ]; then
+       fi
+       printf Total:\ 
+-      cat tmp.$$ | cut -d\  -f 2 | add
++      cat tmp.$$ | cut -ds -f 1| add
+       rm tmp.$$
+ else
diff --git a/net/l7-protocols/patches/102-testing-doallspeeds.patch b/net/l7-protocols/patches/102-testing-doallspeeds.patch
new file mode 100644 (file)
index 0000000..850a1d6
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/testing/doallspeeds.sh
++++ b/testing/doallspeeds.sh
+@@ -25,11 +25,11 @@ for f in ../*/*.pat; do 
+       printf `basename $f .pat`
+       if [ $userspace ]; then 
+-              gtime=`./timeit.sh $f userspace   real | grep Total | cut -d\  -f 2`
++              gtime=`./timeit.sh $f userspace   real | grep Total | cut -d\  -f 2 | awk '{print $1}'`
+               printf \\t$gtime
+       fi
+       if [ $kernel ]; then 
+-              htime=`./timeit.sh $f kernel real | grep Total | cut -d\  -f 2`
++              htime=`./timeit.sh $f kernel real | grep Total | cut -d\  -f 2 | awk '{print $1}'`
+               printf \\t$htime
+       fi
+       printf \\n
diff --git a/net/leafnode/Makefile b/net/leafnode/Makefile
new file mode 100644 (file)
index 0000000..8532dd1
--- /dev/null
@@ -0,0 +1,90 @@
+#
+# Copyright (C) 2009-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:=leafnode
+PKG_VERSION:=1.11.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/leafnode
+PKG_MD5SUM:=a3edafeb854efaa3fbb0f7951d02160f
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_ARGS+=--sysconfdir=/etc/leafnode
+CONFIGURE_VARS+=LIBS=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
+
+EXTRA_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/leafnode/Default
+  SUBMENU:=NNTP
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://leafnode.sourceforge.net
+endef
+
+define Package/leafnode
+  $(call Package/leafnode/Default)
+  DEPENDS:=+libpcre +xinetd
+  TITLE:=Leafnode store-and-forward NNTP proxy
+endef
+
+define Package/leafnode/description
+       This package contains the "leafnode", "fetchnews" and
+       "texpire" programs and the necessary configuration files
+       for the leafnode proxy
+endef
+
+define Package/leafnode-extra
+  $(call Package/leafnode/Default)
+  DEPENDS:=leafnode
+  TITLE:=Leafnode extra programs
+endef
+
+define Package/leafnode-extra/description
+       This package contains the more rarely used "checkgroups",
+       "applyfilter" and "leafnode-version" programs from the
+       leafnode suite
+endef
+
+define Package/leafnode/conffiles
+/etc/leafnode/config.example
+/etc/xinetd.d/nntp
+/etc/crontabs/news
+endef
+
+define Package/leafnode/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/leafnode $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fetchnews $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/texpire $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/leafnode
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/leafnode/config.example $(1)/etc/leafnode/
+       $(INSTALL_DIR) $(1)/etc/xinetd.d
+       $(INSTALL_DATA) ./files/nntp $(1)/etc/xinetd.d/
+       $(INSTALL_DIR) $(1)/etc/crontabs
+       $(INSTALL_DATA) ./files/news $(1)/etc/crontabs/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/leafnode.init $(1)/etc/init.d/leafnode
+endef
+
+define Package/leafnode-extra/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/checkgroups $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/applyfilter $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/leafnode-version $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,leafnode))
+$(eval $(call BuildPackage,leafnode-extra))
diff --git a/net/leafnode/files/leafnode.init b/net/leafnode/files/leafnode.init
new file mode 100644 (file)
index 0000000..8a54cdf
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=49
+
+start() {
+       user_exists news 31 || user_add news 31 "" /var/spool/news
+       group_exists news 31 || group_add news 31
+       [ -d /var/spool/news ] || {
+               mkdir -m 0755 -p /var/spool/news
+               chown news:news /var/spool/news
+       }
+}
diff --git a/net/leafnode/files/news b/net/leafnode/files/news
new file mode 100644 (file)
index 0000000..7e1fd79
--- /dev/null
@@ -0,0 +1,2 @@
+45 * * * * fetchnews
+15 3 * * * texpire
diff --git a/net/leafnode/files/nntp b/net/leafnode/files/nntp
new file mode 100644 (file)
index 0000000..7f0c4bd
--- /dev/null
@@ -0,0 +1,10 @@
+service nntp
+{
+       disable = no
+       flags = REUSE
+       socket_type = stream
+       wait = no
+       user = news
+       server = /usr/sbin/leafnode
+       log_on_failure += USERID
+}
diff --git a/net/lft/Makefile b/net/lft/Makefile
new file mode 100644 (file)
index 0000000..1c946b2
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# 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:=lft
+PKG_VERSION:=3.32
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pwhois.org/get
+PKG_MD5SUM:=5f09c9ad2475cb237b8277a2d69c569c
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lft/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap
+  TITLE:=The alternative traceroute and whois tools for network engineers
+  URL:=http://pwhois.org/lft
+endef
+
+define Package/lft/Default/description
+       LFT, short for Layer Four Traceroute, is a sort of 'traceroute' that
+       often works much faster (than the commonly-used Van Jacobson method)
+       and goes through many configurations of packet-filters (firewalls).
+       More importantly, LFT implements numerous other features including AS
+       number lookups through several reliable sources, loose source routing,
+       netblock name lookups, et al.
+endef
+
+define Package/lft
+  $(call Package/lft/Default)
+endef
+
+define Package/lft/description
+       $(call Package/lft/Default/description)
+       This package contains the lft 'traceroute' program.
+endef
+
+define Package/whob
+  $(call Package/lft/Default)
+endef
+
+define Package/whob/description
+       $(call Package/lft/Default/description)
+       This package contains the whob 'whois' program.
+endef
+
+CONFIGURE_ARGS += \
+       --with-pcap="$(STAGING_DIR)/usr"
+
+define Package/lft/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lft $(1)/usr/bin/
+endef
+
+define Package/whob/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/whob $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,lft))
+$(eval $(call BuildPackage,whob))
diff --git a/net/lft/patches/001-no_strip.patch b/net/lft/patches/001-no_strip.patch
new file mode 100644 (file)
index 0000000..f58fbda
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -50,8 +50,6 @@ whob: whois.o
+ install: lft lft.8 whob whob.8
+       @echo "LFT and WhoB"
+-      @echo "  \_Stripping binaries"
+-      @strip lft whob
+       @echo "  \_Copying files to their intended destinations"
+       @test -d $(DESTDIR)$(bindir)/. || $(MKDIR) $(DESTDIR)$(bindir)
+       $(INSTALL) lft $(DESTDIR)$(bindir)/lft
diff --git a/net/lftp/Makefile b/net/lftp/Makefile
new file mode 100644 (file)
index 0000000..9503f70
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2008-2012 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:=lftp
+PKG_VERSION:=4.3.6
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://lftp.cybermirror.org \
+  http://lftp.cybermirror.org/old
+PKG_MD5SUM:=ffcdbaec5d1416cb6dd754efd43fa61a
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lftp
+  SUBMENU:=File Transfer
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses +libopenssl +libreadline $(CXX_DEPENDS) +libexpat
+  TITLE:=Sophisticated file transfer program
+  URL:=http://lftp.yar.ru/
+endef
+
+define Package/lftp/description
+  lftp is sophisticated file transfer program with command line interface. It
+  supports FTP, HTTP, FISH, SFTP and FILE (local FS) protocols. GNU Readline
+  library is used for input. BitTorrent protocol is supported as built-in
+  `torrent' command.
+endef
+
+CONFIGURE_ARGS += \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+       --without-gnutls \
+       --without-libresolv \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --disable-static
+
+CONFIGURE_VARS += \
+       LIBS="-lz -lutil -lcurses -ldl" \
+       i_cv_posix_fallocate_works=no
+
+MAKE_VARS += \
+       LD="$(TARGET_CXX)"
+
+define Package/lftp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lftp $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,lftp))
diff --git a/net/lftp/patches/001-libintl.patch b/net/lftp/patches/001-libintl.patch
new file mode 100644 (file)
index 0000000..13b3961
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/lib/gettext.h
++++ b/lib/gettext.h
+@@ -22,7 +22,6 @@
+ #if ENABLE_NLS
+ /* Get declarations of GNU message catalog functions.  */
+-# include <libintl.h>
+ /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
+    the gettext() and ngettext() macros.  This is an alternative to calling
+@@ -54,7 +53,6 @@
+ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
+ # include <cstdlib>
+ # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
+-#  include <libintl.h>
+ # endif
+ #endif
diff --git a/net/linuxigd/Makefile b/net/linuxigd/Makefile
new file mode 100644 (file)
index 0000000..257f50a
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+# Copyright (C) 2006 loswillios
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=linuxigd
+PKG_VERSION:=1.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/linux-igd
+PKG_MD5SUM:=929f5c4878c91d534613b7c7070215d9
+
+PKG_BUILD_DEPENDS:=iptables libupnp
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/linuxigd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=UPnP daemon
+  SUBMENU:=Firewall
+  DEPENDS:=+libip4tc +libupnp +libpthread @BROKEN
+  URL:=http://linux-igd.sourceforge.net/
+endef
+
+define Package/linuxigd/description
+       It implements the UPnP Internet Gateway Device specification (IGD)
+       and allows UPnP aware clients, such as MSN Messenger, Azureus or
+       Miranda to work properly from behind a NAT firewall.
+
+       Please edit /etc/upnpd.conf before using upnpd!
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)  \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -DIPTABLES_143 -Wl,-rpath-link=$(STAGING_DIR)/usr/lib" \
+               BINDIR="/usr/sbin" \
+               MANDIR="/usr/man" \
+               HAVE_LIBIPTC=1 \
+               LIBIPTC_PREFIX="$(STAGING_DIR)/usr" \
+               LIBUPNP_PREFIX="$(STAGING_DIR)/usr" \
+               LIBS="-lpthread -lupnp -lixml -lthreadutil -lip4tc -L../lib" \
+               all
+endef
+
+define Package/linuxigd/conffiles
+/etc/upnpd.conf
+endef
+
+define Package/linuxigd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/upnpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/linuxigd
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/*.gif $(1)/etc/linuxigd/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/*.xml $(1)/etc/linuxigd/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/upnpd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/upnpd.init $(1)/etc/init.d/upnpd
+endef
+
+$(eval $(call BuildPackage,linuxigd))
diff --git a/net/linuxigd/files/upnpd.conf b/net/linuxigd/files/upnpd.conf
new file mode 100644 (file)
index 0000000..4d67407
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# The full path and name of the iptables executable,
+# (enclosed in quotes).
+#
+iptables_location = "/usr/sbin/iptables"
+
+#
+# Daemon debug level. Messages are logged via syslog to debug.
+# 0 - no debug messages
+# 1 - log errors
+# 2 - log errors and basic info
+# 3 - log errors and verbose info
+# default = 0
+debug_mode = 2
+
+#
+# Should the daemon insert rules in the forward chain
+# This is necessary if your firewall has a drop or reject
+# policy in your forward chain.
+# allowed values: yes,no
+# default = no
+insert_forward_rules = yes
+
+#
+# The name of the chain to put the forward rules in.
+# This directive is only activ if "insert_forward_rules = yes"
+# above.
+# allowed values: a-z, A-Z, _, -
+# default = FORWARD
+forward_chain_name = forwarding_wan
+
+#
+# The name of the chain to put prerouting rules in.
+# allowed values: a-z, A-Z, _, -
+# default = PREROUTING
+prerouting_chain_name = prerouting_wan 
+
+#
+# The internet line upstream bit rate reported from
+# the daemon. Value in bits per second
+# default = 0
+upstream_bitrate = 512000
+
+#
+# The internet line downstream bit rate reported from
+# the daemon. Value in bits per second
+# default = 0
+downstream_bitrate = 512000
+
+#
+# The default duration of port mappings, used when the client
+# doesn't specify a duration.
+# Can have the following values:
+# 0 - no default duration specified
+# seconds | HH:MM - duration from the time of addition
+# @seconds | @HH:MM - expire mapping at the specified time of day
+# default = 0
+duration = 0
+
+# The name of the igd device xml description document
+# default = gatedesc.xml
+description_document_name = gatedesc.xml
+
+# The path to the xml documents
+# Do not include the trailing "/"
+# default = /etc/linuxigd
+# WARNING! The make install does put the xml files
+# in /etc/linuxigd, if you change this variable
+# you have to make sure the xml docs are in the
+# right place
+xml_document_path = /etc/linuxigd
diff --git a/net/linuxigd/files/upnpd.init b/net/linuxigd/files/upnpd.init
new file mode 100644 (file)
index 0000000..fd627c4
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+# Copyright (C) 2006 loswillios
+
+START=65
+
+start() {
+       . /lib/functions/network.sh
+
+       network_get_device wan_if 'wan' || return 1
+       network_get_device lan_if 'lan' || return 1
+
+       route add -net 239.0.0.0 netmask 255.0.0.0 $lan_if
+       service_start /usr/sbin/upnpd $wan_if $lan_if
+}
+
+stop() {
+       . /lib/functions/network.sh
+
+       service_stop /usr/sbin/upnpd
+
+       network_get_device lan_if 'lan' && \
+               route del -net 239.0.0.0 netmask 255.0.0.0 $lan_if
+}
diff --git a/net/linuxigd/patches/001-iptables_defs.patch b/net/linuxigd/patches/001-iptables_defs.patch
new file mode 100644 (file)
index 0000000..0cee3c0
--- /dev/null
@@ -0,0 +1,73 @@
+diff -urN linuxigd-1.0/iptc.c linuxigd-1.0.new/iptc.c
+--- linuxigd-1.0/iptc.c        2006-09-11 17:55:48.000000000 +0200
++++ linuxigd-1.0.new/iptc.c    2007-06-02 12:24:34.000000000 +0200
+@@ -22,9 +22,9 @@
+ struct ipt_entry_match *get_udp_match(const char *sports, const char *dports, unsigned int *nfcache);
+ struct ipt_entry_target *get_dnat_target(const char *input, unsigned int *nfcache);
+-static u_int16_t parse_port(const char *port);
+-static void parse_ports(const char *portstring, u_int16_t *ports);
+-static int service_to_port(const char *name);
++static u_int16_t igd_parse_port(const char *port);
++void parse_ports(const char *portstring, u_int16_t *ports);
++static int igd_service_to_port(const char *name);
+ static void parse_range(const char *input, struct ip_nat_range *range);
+ static struct ipt_natinfo *append_range(struct ipt_natinfo *info, const struct ip_nat_range *range);
+@@ -336,13 +336,12 @@
+ }
+ /* Copied and modified from libipt_tcp.c and libipt_udp.c */
+-
+ static u_int16_t
+-parse_port(const char *port)
++igd_parse_port(const char *port)
+ {
+       unsigned int portnum;
+-      if ((portnum = service_to_port(port)) != -1) {
++      if ((portnum = igd_service_to_port(port)) != -1) {
+               return (u_int16_t)portnum;
+       }
+       else {
+@@ -350,7 +349,7 @@
+       }
+ }
+-static void
++void
+ parse_ports(const char *portstring, u_int16_t *ports)
+ {
+       char *buffer;
+@@ -358,19 +357,18 @@
+       buffer = strdup(portstring);
+       if ((cp = strchr(buffer, ':')) == NULL)
+-              ports[0] = ports[1] = parse_port(buffer);
++              ports[0] = ports[1] = igd_parse_port(buffer);
+       else {
+               *cp = '\0';
+               cp++;
+-              ports[0] = buffer[0] ? parse_port(buffer) : 0;
+-              ports[1] = cp[0] ? parse_port(cp) : 0xFFFF;
++              ports[0] = buffer[0] ? igd_parse_port(buffer) : 0;
++              ports[1] = cp[0] ? igd_parse_port(cp) : 0xFFFF;
+       }
+       free(buffer);
+ }
+-
+ static int
+-service_to_port(const char *name)
++igd_service_to_port(const char *name)
+ {
+       struct servent *service;
+@@ -382,7 +380,6 @@
+-
+ /* Copied and modified from libipt_DNAT.c */
+ static void
diff --git a/net/linuxigd/patches/002-netfilter_nat_headers.patch b/net/linuxigd/patches/002-netfilter_nat_headers.patch
new file mode 100644 (file)
index 0000000..abbc11e
--- /dev/null
@@ -0,0 +1,16 @@
+diff -urN linuxigd-1.0/iptc.c linuxigd-1.0.new/iptc.c
+--- linuxigd-1.0/iptc.c        2006-09-11 17:55:48.000000000 +0200
++++ linuxigd-1.0.new/iptc.c    2007-07-13 14:50:23.000000000 +0200
+@@ -6,7 +6,12 @@
+ #include <string.h>
+ #include <iptables.h>
+ #include <libiptc/libiptc.h>
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#include <linux/netfilter/nf_nat.h>
++#else
+ #include <linux/netfilter_ipv4/ip_nat.h>
++#endif
+ #include <arpa/inet.h> /* inet_addr */
+ #include "globals.h"
+ #include "util.h"
diff --git a/net/linuxigd/patches/003-Makefile-fix.patch b/net/linuxigd/patches/003-Makefile-fix.patch
new file mode 100644 (file)
index 0000000..25a1c54
--- /dev/null
@@ -0,0 +1,13 @@
+Index: linuxigd-1.0/Makefile
+===================================================================
+--- linuxigd-1.0.orig/Makefile 2008-02-27 10:45:26.000000000 +0100
++++ linuxigd-1.0/Makefile      2008-02-27 10:45:54.000000000 +0100
+@@ -27,7 +27,7 @@
+       @echo "make $@ finished on `date`"
+ %.o:  %.c
+-      $(CC) $(CFLAGS) $(INCLUDES) -c $<
++      $(CC) $(CFLAGS) $(INCLUDES) -D_GNU_SOURCE -c $<
+ clean:
+       rm -f *.o upnpd
diff --git a/net/linuxigd/patches/004-iptables-1.4.3.2-compat.patch b/net/linuxigd/patches/004-iptables-1.4.3.2-compat.patch
new file mode 100644 (file)
index 0000000..b982761
--- /dev/null
@@ -0,0 +1,101 @@
+diff -ur linuxigd-1.0.orig/iptc.c linuxigd-1.0/iptc.c
+--- linuxigd-1.0.orig/iptc.c   2009-05-05 14:01:59.000000000 +0200
++++ linuxigd-1.0/iptc.c        2009-05-05 14:05:48.000000000 +0200
+@@ -7,16 +7,24 @@
+ #include <iptables.h>
+ #include <libiptc/libiptc.h>
+ #include <linux/version.h>
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
+-#include <linux/netfilter/nf_nat.h>
++#ifdef IPTABLES_143
++#  include <net/netfilter/nf_nat.h>
++#  define ip_nat_multi_range nf_nat_multi_range_compat
++#  define ip_nat_range nf_nat_range
+ #else
+-#include <linux/netfilter_ipv4/ip_nat.h>
++#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++#    include <linux/netfilter/nf_nat.h>
++#  else
++#    include <linux/netfilter_ipv4/ip_nat.h>
++#  endif
+ #endif
+ #include <arpa/inet.h> /* inet_addr */
+ #include "globals.h"
+ #include "util.h"
+ #include "iptc.h"
++#define IPTC_HANDLE struct iptc_handle *
++
+ struct ipt_natinfo
+ {
+       struct ipt_entry_target t;
+@@ -49,7 +57,7 @@
+                    const char *dnat_to,
+                    const int append)
+ {
+-      iptc_handle_t handle;
++      IPTC_HANDLE handle;
+       struct ipt_entry *chain_entry;
+       struct ipt_entry_match *entry_match = NULL;
+       struct ipt_entry_target *entry_target = NULL;
+@@ -126,15 +134,15 @@
+               return;
+       }
+       if (append)
+-              result = iptc_append_entry(labelit, chain_entry, &handle);
++              result = iptc_append_entry(labelit, chain_entry, handle);
+       else
+-              result = iptc_insert_entry(labelit, chain_entry, 0, &handle);
++              result = iptc_insert_entry(labelit, chain_entry, 0, handle);
+       if (!result) {
+               trace(1, "libiptc error: Can't add, %s", iptc_strerror(errno));
+               return;
+       }
+-      result = iptc_commit(&handle);
++      result = iptc_commit(handle);
+       if (!result) {
+         trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
+               return;
+@@ -159,7 +167,7 @@
+                       const char *target,
+                       const char *dnat_to)
+ {
+-      iptc_handle_t handle;
++      IPTC_HANDLE handle;
+       const struct ipt_entry *e;
+       ipt_chainlabel labelit;
+       int i, result;
+@@ -182,7 +190,7 @@
+       }
+       
+       /* check through rules to find match */
+-      for (e = iptc_first_rule(chain, &handle), i=0; e; e = iptc_next_rule(e, &handle), i++)  {
++      for (e = iptc_first_rule(chain, handle), i=0; e; e = iptc_next_rule(e, handle), i++)  {
+               if (s_src != INADDR_NONE && e->ip.src.s_addr != s_src) continue;
+               if (s_dest != INADDR_NONE && e->ip.dst.s_addr != s_dest) continue;
+               if (iniface && strcmp(e->ip.iniface, iniface) != 0) continue;
+@@ -190,7 +198,7 @@
+               if (protocol && strcmp(protocol, "TCP") == 0 && e->ip.proto != IPPROTO_TCP) continue;
+               if (protocol && strcmp(protocol, "UDP") == 0 && e->ip.proto != IPPROTO_UDP) continue;
+               if ((srcports || destports) && IPT_MATCH_ITERATE(e, matchcmp, srcports, destports) == 0) continue;
+-              if (target && strcmp(target, iptc_get_target(e, &handle)) != 0) continue;
++              if (target && strcmp(target, iptc_get_target(e, handle)) != 0) continue;
+               if (dnat_to && strcmp(target, "DNAT") == 0) {
+                       struct ipt_entry_target *t;
+                       struct ip_nat_multi_range *mr;
+@@ -214,12 +222,12 @@
+               break;
+       }
+       if (!e) return;
+-      result = iptc_delete_num_entry(chain, i, &handle);
++      result = iptc_delete_num_entry(chain, i, handle);
+       if (!result) {
+         trace(1, "libiptc error: Delete error, %s", iptc_strerror(errno));
+               return;
+       }
+-      result = iptc_commit(&handle);
++      result = iptc_commit(handle);
+       if (!result) {
+         trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
+               return;
diff --git a/net/linuxigd/patches/005-includes.patch b/net/linuxigd/patches/005-includes.patch
new file mode 100644 (file)
index 0000000..586f650
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/gatedevice.c
++++ b/gatedevice.c
+@@ -1,5 +1,6 @@
+ #include <syslog.h>
+ #include <stdlib.h>
++#include <stdio.h>
+ #include <upnp/ixml.h>
+ #include <string.h>
+ #include <time.h>
+--- a/main.c
++++ b/main.c
+@@ -10,6 +10,7 @@
+ #include <time.h>
+ #include <net/if.h>
+ #include <upnp/upnp.h>
++#include <string.h>
+ #include "globals.h"
+ #include "config.h"
+ #include "gatedevice.h"
+--- a/pmlist.c
++++ b/pmlist.c
+@@ -2,6 +2,8 @@
+ #include <sys/wait.h>
+ #include <unistd.h>
+ #include <upnp/upnp.h>
++#include <stdio.h>
++#include <string.h>
+ #include "globals.h"
+ #include "config.h"
+ #include "pmlist.h"
diff --git a/net/lispmob/Makefile b/net/lispmob/Makefile
new file mode 100644 (file)
index 0000000..ecc82d3
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2012-2013 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:=lispmob
+PKG_REV:=79d14028286c3f3a84283c461c85916a10dff4cb
+PKG_VERSION:=0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=git://github.com/LISPmob/lispmob.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lispd/default
+  MAINTAINER:=Vasileios Lakafosis <lakafv@gmail.com>
+  URL:=http://lisp.cisco.com/
+endef
+
+define Package/lispd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Locator/ID separation protocol (using TUN)
+  URL:=https://github.com/LISPmob
+  DEPENDS:= +librt +libopenssl +confuse +kmod-tun +uci +kmod-ipv6
+  $(call Package/lispd/default)
+endef
+
+define Package/lispd/description
+  This packet provides support for the Locator-ID Seperation Protocol.
+endef
+
+MAKE_FLAGS += \
+       platform=openwrt
+
+define Package/lispd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lispd/lispd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/openWRT/lispd.uci.example $(1)/etc/config/lispd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openWRT/openwrt.init.script $(1)/etc/init.d/lisp
+endef
+
+$(eval $(call BuildPackage,lispd))
diff --git a/net/live/Makefile b/net/live/Makefile
new file mode 100644 (file)
index 0000000..16a2ec8
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 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:=live
+PKG_VERSION:=2012.02.04
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.live555.com/liveMedia/public/
+PKG_MD5SUM:=5c9753e027af08c065f156e2a0bec023
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openrtsp
+  SECTION:=video
+  CATEGORY:=Video Streaming
+  TITLE:=live555 streaming libraries and testProgs
+  URL:=http://www.live555.com/
+  DEPENDS:=+libstdcpp
+endef
+
+define Build/Configure
+       ( cd $(PKG_BUILD_DIR); \
+               $(SED) 's/@CROSS_COMPILE@/$(TARGET_CROSS)/g' \
+                   -e 's/@CFLAGS@/$(TARGET_CFLAGS)/g' \
+                   config.OpenWrt; \
+               ./genMakefiles OpenWrt; \
+       )
+endef
+
+define Package/openrtsp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/testProgs/openRTSP $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,openrtsp))
diff --git a/net/live/patches/101-openwrt.patch b/net/live/patches/101-openwrt.patch
new file mode 100644 (file)
index 0000000..dffedbc
--- /dev/null
@@ -0,0 +1,23 @@
+--- /dev/null
++++ b/config.OpenWrt
+@@ -0,0 +1,20 @@
++CROSS_COMPILE=        @CROSS_COMPILE@
++COMPILE_OPTS =        $(INCLUDES) -I. @CFLAGS@ -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLOCALE_NOT_USED
++C =            c
++C_COMPILER =        $(CROSS_COMPILE)gcc
++CFLAGS +=        $(COMPILE_OPTS)
++C_FLAGS = $(CFLAGS)
++CPP =            cpp
++CPLUSPLUS_COMPILER =    $(CROSS_COMPILE)g++
++CPLUSPLUS_FLAGS =    $(COMPILE_OPTS) -Wall -DBSD=1
++CPLUSPLUS_FLAGS += $(CPPFLAGS) -fexceptions
++OBJ =            o
++LINK =            $(CROSS_COMPILE)g++ -o
++LINK_OPTS =        -L. $(LDFLAGS)
++CONSOLE_LINK_OPTS =    $(LINK_OPTS)
++LIBRARY_LINK =        $(CROSS_COMPILE)ar cr 
++LIBRARY_LINK_OPTS =    
++LIB_SUFFIX =            a
++LIBS_FOR_CONSOLE_APPLICATION = $(CXXLIBS)
++LIBS_FOR_GUI_APPLICATION = $(LIBS_FOR_CONSOLE_APPLICATION)
++EXE =
diff --git a/net/lsm/Makefile b/net/lsm/Makefile
new file mode 100644 (file)
index 0000000..d360d7e
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2010-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:=lsm
+PKG_VERSION:=0.131
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://lsm.foobar.fi/download
+PKG_MD5SUM:=c3ff15f5e0d3988a1a45f35392639d40
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lsm
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ssmtp
+  TITLE:=A link state monitor
+  URL:=http://lsm.foobar.fi/
+endef
+
+define Package/lsm/description
+       lsm is a link state monitor for carrying out actions when a link
+       transistions from the up to down state or vice versa.
+endef
+
+define Package/lsm/conffiles
+/etc/lsm/lsm.conf
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/lsm/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lsm $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/lsm
+       $(INSTALL_DIR) $(1)/etc/lsm/script.d
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/connections.conf $(1)/etc/lsm/connections.conf
+       $(INSTALL_DATA) ./files/lsm.conf $(1)/etc/lsm/lsm.conf
+       $(INSTALL_BIN) ./files/lsm_script $(1)/etc/lsm/script
+       $(INSTALL_BIN) ./files/lsm.init $(1)/etc/init.d/lsm
+endef
+
+define Package/lsm/conffiles
+/etc/lsm/connections.conf
+/etc/lsm/lsm.conf
+endef
+
+$(eval $(call BuildPackage,lsm))
diff --git a/net/lsm/files/connections.conf b/net/lsm/files/connections.conf
new file mode 100644 (file)
index 0000000..087a895
--- /dev/null
@@ -0,0 +1,13 @@
+connection {
+   name=Provider1
+   checkip=1.1.1.1
+   device=pppoe-wan
+   ttl=2
+}
+
+connection {
+   name=Provider2
+   checkip=2.2.2.2
+   device=eth0.2
+   ttl=1
+}
diff --git a/net/lsm/files/lsm.conf b/net/lsm/files/lsm.conf
new file mode 100644 (file)
index 0000000..ca73372
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# (C) 2009 Mika Ilmaranta <ilmis at nullnet.fi>
+#
+# License: GPLv2
+#
+
+#
+# Debug level: 0 .. 8 are normal, 9 gives lots of stuff and 100 doesn't
+# bother to detach
+#
+#debug=10
+#debug=9
+debug=8
+# reopen_on_enodev=1
+
+#
+# Defaults for the connection entries
+#
+defaults {
+  name=defaults
+  checkip=127.0.0.1
+  eventscript=/etc/lsm/script
+  max_packet_loss=20
+  max_successive_pkts_lost=7
+  min_packet_loss=5
+  min_successive_pkts_rcvd=10
+  interval_ms=2000
+  timeout_ms=2000
+  warn_email=root
+  check_arp=0
+  sourceip=
+# if using ping probes for monitoring only then defaults should
+# not define a default device for packets to autodiscover their path
+# to destination
+#  device=eth0
+# use system default ttl
+  ttl=0
+}
+
+include /etc/lsm/connections.conf
+
+#EOF
diff --git a/net/lsm/files/lsm.init b/net/lsm/files/lsm.init
new file mode 100644 (file)
index 0000000..a018fa5
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=45
+
+SERVICE_USE_PID=1
+SERVICE_PID_FILE=/var/run/lsm.pid
+
+start() {
+       service_start /usr/sbin/lsm /etc/lsm/lsm.conf $SERVICE_PID_FILE
+}
+
+stop() {
+       service_stop /usr/sbin/lsm
+}
+
+reload() {
+       service_reload /usr/sbin/lsm
+}
diff --git a/net/lsm/files/lsm_script b/net/lsm/files/lsm_script
new file mode 100644 (file)
index 0000000..a373b31
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# (C) 2009 Mika Ilmaranta <ilmis@nullnet.fi>
+# (C) 2009 Tom Eastep <teastep@shorewall.net>
+#
+# License: GPLv2
+#
+
+DATE=$(/bin/date)
+
+STATE=${1}
+NAME=${2}
+CHECKIP=${3}
+DEVICE=${4}
+WARN_EMAIL=${5}
+REPLIED=${6}
+WAITING=${7}
+TIMEOUT=${8}
+REPLY_LATE=${9}
+CONS_RCVD=${10}
+CONS_WAIT=${11}
+CONS_MISS=${12}
+AVG_RTT=${13}
+
+if [ -f /usr/share/shorewall-lite/lib.base ]; then
+    VARDIR=/etc/shorewall-lite/state
+    STATEDIR=/etc/shorewall-lite
+else
+    VARDIR=/var/lib/shorewall
+    STATEDIR=/etc/shorewall
+fi
+
+[ -f ${STATEDIR}/vardir ] && . ${STATEDIR}/vardir
+
+cat <<EOM | ssmtp ${WARN_EMAIL}
+Subject: "LSM: ${NAME} ${STATE}, DEV ${DEVICE}"
+
+Hi,
+
+Your connection ${NAME} has changed it's state to ${STATE} at ${DATE}.
+
+Following parameters were passed:
+
+newstate     = ${STATE}
+name         = ${NAME}
+checkip      = ${CHECKIP}
+device       = ${DEVICE}
+warn_email   = ${WARN_EMAIL}
+
+Packet counters:
+
+replied      = ${REPLIED} packets replied
+waiting      = ${WAITING} packets waiting for reply
+timeout      = ${TIMEOUT} packets that have timed out (= packet loss)
+reply_late   = ${REPLY_LATE} packets that received a reply after timeout
+cons_rcvd    = ${CONS_RCVD} consecutively received replies in sequence
+cons_wait    = ${CONS_WAIT} consecutive packets waiting for reply
+cons_miss    = ${CONS_MISS} consecutive packets that have timed out
+avg_rtt      = ${AVG_RTT} average rtt, notice that waiting and timed out packets have rtt = 0 when calculating this
+
+Your LSM Daemon
+
+EOM
+
+if [ ${STATE} = up ]; then
+    echo 0 > ${VARDIR}/${DEVICE}.status # Uncomment this line if you are running Shorewall 4.4.x or earlier
+    ${VARDIR}/firewall enable ${DEVICE}
+else
+    echo 1 > ${VARDIR}/${DEVICE}.status # Uncomment this line if you are running Shorewall 4.4.x or earlier
+    ${VARDIR}/firewall disable ${DEVICE}
+fi
+
+/sbin/shorewall-lite show routing > /var/log/lsm
+
+exit 0
+
+#EOF
diff --git a/net/mac-to-devinfo/Makefile b/net/mac-to-devinfo/Makefile
new file mode 100644 (file)
index 0000000..8b512f1
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2009 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:=mac-to-devinfo
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=2
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mac-to-devinfo
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=MAC Address to Device Information
+  MAINTAINER:=Daniel Dickinson <openwrt@cshore.neomailbox.net>
+endef
+
+define Package/mac-to-devinfo/description
+  Scripts to take a mac address (or ip if the ip is in the arp cache)
+  and translate it into device information (mostly OUI owner, from the
+  IEEE data files, but more information may be available for specific
+  devices/vendors).
+endef
+
+define Package/smap-to-devinfo
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Telephony
+  DEPENDS:=+mac-to-devinfo +smap +httping
+  TITLE:=SIP Device Information from Scan
+endef
+
+define Package/smap-to-devinfo/description
+  A script to use smap to discover all SIP devices on the networks
+  (provided ICMP and SIP are allowed to the network from the host) and
+  translate (through the ip then mac) into the device information.
+endef
+
+define Package/netdiscover-to-devinfo
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+mac-to-devinfo +netdiscover
+  TITLE:=Device Information from Scan for MAC addresses
+endef
+
+define Package/netdiscover-to-devinfo/description
+  A script to use netdiscover to discover all devices on the specified
+  arp-able networks and translate into the device information.
+endef
+
+define Build/Prepare
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/mac-to-devinfo/conffiles
+/etc/config/mactodevinfo
+endef
+
+define Package/mac-to-devinfo/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/mac-to-devinfo $(1)/usr/bin
+       $(INSTALL_BIN) ./files/ip-to-devinfo $(1)/usr/bin
+       $(INSTALL_BIN) ./files/prep-devinfo $(1)/usr/bin
+       $(INSTALL_BIN) ./files/clean-devinfo $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib/mac-to-devinfo
+       $(INSTALL_BIN) ./files/devinfo-functions.sh $(1)/usr/lib/mac-to-devinfo
+       $(INSTALL_DIR) $(1)/usr/share/mac-to-devinfo
+       $(CP) ./files/macdevdb $(1)/usr/share/mac-to-devinfo
+       $(INSTALL_DIR) $(1)/etc/config
+       $(CP) ./files/mactodevinfo $(1)/etc/config
+endef
+
+define Package/smap-to-devinfo/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/smap-to-devinfo $(1)/usr/bin
+       $(INSTALL_BIN) ./files/netsmap-to-devinfo $(1)/usr/bin
+endef
+
+define Package/netdiscover-to-devinfo/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/netdiscover-to-devinfo $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,mac-to-devinfo))
+$(eval $(call BuildPackage,smap-to-devinfo))
+$(eval $(call BuildPackage,netdiscover-to-devinfo))
diff --git a/net/mac-to-devinfo/files/clean-devinfo b/net/mac-to-devinfo/files/clean-devinfo
new file mode 100644 (file)
index 0000000..a34411a
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+#    clean-devinfo - clean up after MAC IEEE and custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+OUIDIR=/var/cache/mac-to-devinfo
+
+rm -rf $OUIDIR
+#!/bin/sh
+
+OUIDIR=/var/cache/mac-to-devinfo
+
+rm -rf $OUIDIR
diff --git a/net/mac-to-devinfo/files/devinfo-functions.sh b/net/mac-to-devinfo/files/devinfo-functions.sh
new file mode 100644 (file)
index 0000000..fc29334
--- /dev/null
@@ -0,0 +1,122 @@
+#!/bin/sh
+# Shell script compatibility wrappers for /sbin/uci
+#
+# Copyright (C) 2008  Felix Fietkau <nbd@openwrt.org>
+# Copyright (C) 2009  Daniel Dickinson
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# $UCI and $UCISTATE must be set
+
+CONFIG_APPEND=
+_C=0
+LOAD_STATE=1
+LIST_SEP=" "
+
+config_load() {
+    local PACKAGE="$1"
+    local DATA
+    local RET
+
+    _C=0
+
+    if [ -z "$CONFIG_APPEND" ]; then
+       CONFIG_SECTIONS=
+       CONFIG_NUM_SECTIONS=0
+       CONFIG_SECTION=
+    fi
+    export NO_EXPORT=
+    DATA="$($UCI -P $UCISTATE -S -n export "$PACKAGE" 2>/dev/null)"
+       RET="$?"
+       [ "$RET" != 0 -o -z "$DATA" ] || eval "$DATA"
+       unset DATA
+
+       ${CONFIG_SECTION:+config_cb}
+       return "$RET"
+}
+
+reset_cb() {
+       config_cb() { return 0; }
+       option_cb() { return 0; }
+       list_cb() { return 0; }
+}
+reset_cb
+config () {
+       local cfgtype="$1"
+       local name="$2"
+       
+       CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1))
+       name="${name:-cfg$CONFIG_NUM_SECTIONS}"
+       append CONFIG_SECTIONS "$name"
+       [ -n "$NO_CALLBACK" ] || config_cb "$cfgtype" "$name"
+       CONFIG_SECTION="$name"
+       eval "CONFIG_${CONFIG_SECTION}_TYPE=\"$cfgtype\""
+}
+
+option () {
+       local varname="$1"; shift
+       local value="$*"
+
+       eval "CONFIG_${CONFIG_SECTION}_${varname}=\"$value\""
+       [ -n "$NO_CALLBACK" ] || option_cb "$varname" "$*"
+}
+
+list() {
+       local varname="$1"; shift
+       local value="$*"
+       local len
+
+       config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 
+       len="$((${len:-0} + 1))"
+       config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value"
+       config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len"
+       append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP"
+       list_cb "$varname" "$*"
+}
+
+config_get() {
+       case "$3" in
+               "") eval "echo \"\${CONFIG_${1}_${2}}\"";;
+               *)  eval "$1=\${CONFIG_${2}_${3}}";;
+       esac
+}
+
+config_foreach() {
+       local function="$1"
+       [ "$#" -ge 1 ] && shift
+       local type="$1"
+       [ "$#" -ge 1 ] && shift
+       local section cfgtype
+       
+       [ -z "$CONFIG_SECTIONS" ] && return 0
+       for section in ${CONFIG_SECTIONS}; do
+               config_get cfgtype "$section" TYPE
+               [ -n "$type" -a "x$cfgtype" != "x$type" ] && continue
+               $function "$section" "$@"
+       done
+}
+
+package() {
+       return 0
+}
+
+append() {
+       local var="$1"
+       local value="$2"
+       local sep="${3:- }"
+       
+       eval "$var=\${$var:+\${$var}\${value:+\$sep}}\$value"
+}
+
diff --git a/net/mac-to-devinfo/files/ip-to-devinfo b/net/mac-to-devinfo/files/ip-to-devinfo
new file mode 100644 (file)
index 0000000..eb4d851
--- /dev/null
@@ -0,0 +1,80 @@
+#!/bin/sh
+#    ip-to-devinfo - IP (through arping or ping and arp cache) to MAC IEEE and 
+#    custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ARP=arp
+MACTODEV=mac-to-devinfo
+
+usage() {
+    echo "Usage: $0 [-i interface] [-x port] IP-address"
+}
+
+if [ "$1" == "-i" ]; then
+    INTERFACE="$2"
+    if [ -z "$INTERFACE" ]; then
+       echo "-i without interface"
+       usage
+       exit 1
+    fi
+    shift
+    shift
+fi
+
+if [ "$1" == "-x" ]; then
+    PORT="-x $2"
+    if [ -z "$PORT" ]; then
+       echo "-x without the port"
+       usage
+       exit 1
+    fi
+    shift
+    shift
+fi
+
+IP="$1"
+shift
+
+if [ -z "$IP" ]; then
+       echo "Must specify IP address"
+       usage
+       exit 1
+fi
+
+
+if [ ! -x "$(which $ARP)" ]; then
+    do_arp() {
+       cat /proc/net/arp
+    }
+    ARPMACFIELD=4
+else
+    do_arp() {
+       $ARP -n
+    }
+    ARPMACFIELD=3
+fi
+
+if [ -z "$INTERFACE" ]; then
+    ping -q -c 2 $IP >/dev/null
+    MAC=$(do_arp|grep "$IP "|tr -s \  | cut -f$ARPMACFIELD -d\  )
+else
+    MAC=$(arping -f -c 5 -I $INTERFACE $IP | grep 'Unicast reply from' | cut -f2 -d \[ | cut -f1 -d\])
+fi
+
+$MACTODEV $PORT $MAC
+
+
diff --git a/net/mac-to-devinfo/files/mac-to-devinfo b/net/mac-to-devinfo/files/mac-to-devinfo
new file mode 100644 (file)
index 0000000..cce253a
--- /dev/null
@@ -0,0 +1,197 @@
+#!/bin/sh
+#    mac-to-devinfo - MAC IEEE and custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+UCIBIN=uci
+UCIFUNC=/usr/lib/mac-to-devinfo/devinfo-functions.sh
+OVERRIDETABLE=mactodevinfo
+DEVDB=macdevdb
+UCICONFIG=/etc/config
+
+OUIURL=http://standards.ieee.org/regauth/oui/oui.txt
+IABURL=http://standards.ieee.org/regauth/oui/iab.txt
+
+OUIDIR=/var/cache/mac-to-devinfo
+
+OUIFILE=$OUIDIR/oui.txt
+IABFILE=$OUIDIR/iab.txt
+
+UCIDEVDB=/usr/share/mac-to-devinfo
+UCISTATE="$(mktemp -t)"
+
+. $UCIFUNC
+
+
+if [ "$1" == "-x" ]; then
+    PORT="$2"
+    if [ -z "$PORT" ]; then
+       echo "-x without the port"
+       echo "Usage: $0 [-x port] MAC-address"
+       exit 1
+    fi
+    shift
+    shift
+fi
+
+MAC="$1"
+
+if [ -z "$MAC" ]; then
+       echo "Unknown MAC address | Unknown | unknown | unknown | unknown"
+       exit 1
+fi
+
+MAC=$(echo $MAC | sed -e 's/^\([0-9]\):/0\1:/g' | sed -e 's/:\([0-9]\)$/:0\1/g' | sed -e 's/:\([0-9]\):/:0\1:/g')
+
+parse_override() {
+       local cfg="$1"
+       config_get name "$cfg" name
+       config_get maclow "$cfg" maclow
+       config_get machigh "$cfg" machigh
+       config_get vendor "$cfg" vendor
+       config_get devtype "$cfg" devtype
+       config_get model "$cfg" model
+       config_get ouiowneroverride "$cfg" ouiowner
+       LOW=$(echo $maclow | sed -e 's/://g')
+       HIGH=$(echo $machigh | sed -e 's/://g')
+       if [ -z "$LOW" ] || [ -z "$HIGH" ] || [ -n "$(echo $LOW | grep -E -v '^[0-9A-Fa-f]{12}$')" ] || [ -n "$(echo $HIGH | grep -E -v '^[0-9A-Fa-f]{12}$')" ]; then
+               echo "Invalid mac range for $name: $ouiowneroverride $vendor $devtype $model : $LOW-$HIGH" >&2
+               return 1
+       fi
+
+       LOWMSB=$(expr substr "$LOW" 1 6)
+       LOWLSB=$(expr substr "$LOW" 7 6)
+       HIGHMSB=$(expr substr "$HIGH" 1 6)
+       HIGHLSB=$(expr substr "$HIGH" 7 6)
+
+       if [ -z "$LOWMSB" ] || [ -z "$LOWLSB" ] || [ -z "$HIGHMSB" ] || [ -z "$HIGHLSB" ]; then
+               echo "Error splitting database address strings"
+               return 1
+       fi
+
+       MACMSB=$(expr substr "$MACNUM" 1 6)
+       MACLSB=$(expr substr "$MACNUM" 7 6)
+
+       if [ -z "$MACMSB" ] || [ -z "$MACLSB" ]; then
+               echo "Error spliiting mac address string"
+               return 1
+       fi
+
+       if [ -n "$ouiowneroverride" ]; then
+           OUIOWNER="$ouiowneroverride"
+       fi
+       if [ $((0x$MACMSB)) -ge $((0x$LOWMSB)) ] && [ $((0x$MACMSB)) -le $((0x$HIGHMSB)) ]; then
+               if [ $((0x$MACLSB)) -ge $((0x$LOWLSB)) ] && [ $((0x$MACLSB)) -le $((0x$HIGHLSB)) ]; then
+                       if [ "$PORT" == "5060" ]; then
+                           if [ "$vendor" == "Vertical Communications" ]; then
+                               devtype="VoIP Phone"
+                               model="IP200x"
+                           fi
+                       fi
+                       if [ "$PORT" == "6060" ]; then
+                           if [ "$vendor" == "Vertical Communications" ]; then
+                               devtype="VoIP PBX"
+                               model="Xcelerator IP"
+                           fi
+                       fi
+                       if [ -n "$OUTSTRING" ]; then    
+                               echo "ERROR: We already have found information '$OUTSTRING'" >&2
+                               echo -n "and now we have: " >&2
+                               echo "$MAC | $OUIOWNER | $vendor | $devtype | $model" >&2
+                               return 1
+                       else
+                               echo "$MAC | $OUIOWNER | $vendor | $devtype | $model"
+                               return 0
+                       fi
+               fi
+       fi
+       return 0
+}
+
+if [ ! -r "$OUIFILE" ] || [ ! -r "$IABFILE" ]; then
+       echo "Missing IEEE Registration Authority Database.  Please run prep-devinfo"
+       exit 1
+fi     
+
+OUI="$(echo $MAC | cut -f1-3 -d:  | sed -e 's/:/-/g' | tr abcdef ABCDEF )"
+
+OUIOWNER="$(cat $OUIFILE | grep $OUI | tr -s '\t' | cut -f2- -d"$(printf '\t')" )"
+
+if [ -z "$OUIOWNER" ] || [ "$OUIOWNER" = "IEEE REGISTRATION AUTHORITY" ]; then
+       if [ -n "$(cat $IABFILE | grep $OUI)" ]; then
+               LOWRANGE="$(echo $MAC | cut -f4-6 -d:  | sed -e 's/://g' | tr abcdef ABCDEF )"
+               for range in $(cat $IABFILE |grep -E '[0-9A-F]{6}\-[0-9A-F]{6}' |cut -f1 -d"$(printf '\t')"  ); do
+                       LOW="$(echo $range | cut -f1 -d- )"
+                       HIGH="$(echo $range | cut -f2 -d- )"
+                       if [ -z "$LOW" ] || [ -z "$HIGH" ]; then
+                               echo "Error parsing IAB table"
+                               exit 1
+
+                       fi
+                       LOWMSB=$(expr substr "$LOW" 1 6)
+                       LOWLSB=$(expr substr "$LOW" 7 6)
+                       HIGHMSB=$(expr substr "$HIGH" 1 6)
+                       HIGHLSB=$(expr substr "$HIGH" 7 6)
+
+                       if [ -z "$LOWMSB" ] || [ -z "$LOWLSB" ] || [ -z "$HIGHMSB" ] || [ -z "$HIGHLSB" ]; then
+                               echo "Error splitting registration authority IAB address strings"
+                               exit 1
+                       fi
+
+                       MACMSB=$(expr substr "$LOWRANGE" 1 6)
+                       MACLSB=$(expr substr "$LOWRANGE" 7 6)
+                       
+                       if [ -z "$MACMSB" ] || [ -z "$MACLSB" ]; then
+                               echo "Error splitting mac address string"
+                               exit 1
+                       fi
+                       if [ $((0x$MACMSB)) -ge $((0x$LOWMSB)) ] && [ $((0x$MACMSB)) -le $((0x$HIGHMSB)) ]; then
+                               if [ $((0x$MACLSB)) -ge $((0x$LOWLSB)) ] && [ $((0x$MACLSB)) -le $((0x$HIGHLSB)) ]; then
+                                       OUIOWNER="$(cat $IABFILE | grep "$LOW-$HIGH" | tr -s '\t' | cut -f3- -d"$(printf '\t')" )"
+                                       break;
+                               fi
+                       fi
+               done
+       fi
+fi
+
+if [ -z "$OUIOWNER" ]; then
+    OUIOWNER="Unknown Organization"
+fi
+
+MACNUM="$(echo $MAC |sed -e 's/://g' | tr ABCDEF abcdef )"
+
+UCI="$UCIBIN -c $UCIDEVDB"
+config_load $DEVDB
+DEVSTRING=$(config_foreach parse_override mactodevinfo)
+
+SAVEDEVSTRING="$DEVSTRING"
+
+UCI="$UCIBIN -c $UCICONFIG"
+config_load $OVERRIDETABLE
+DEVSTRING=$(config_foreach parse_override mactodevinfo)
+
+if [ -z "$DEVSTRING" ]; then
+    if [ -z "$SAVEDEVSTRING" ]; then
+       echo "$MAC | $OUIOWNER | unknown | unknown | unknown"
+    else
+       echo "$SAVEDEVSTRING"
+    fi
+else
+    echo "$DEVSTRING"
+fi
+
+rm -f $UCISTATE
diff --git a/net/mac-to-devinfo/files/macdevdb b/net/mac-to-devinfo/files/macdevdb
new file mode 100644 (file)
index 0000000..8bb8873
--- /dev/null
@@ -0,0 +1,8 @@
+
+config 'mactodevinfo'
+       option 'maclow' '00:19:15:00:00:00'
+       option 'machigh' '00:19:15:ff:ff:ff'
+       option 'vendor' 'Vertical Communications'
+       option 'devtype' 'SIP devices'
+       option 'model' 'varies'
+
diff --git a/net/mac-to-devinfo/files/mactodevinfo b/net/mac-to-devinfo/files/mactodevinfo
new file mode 100644 (file)
index 0000000..9cd0e5e
--- /dev/null
@@ -0,0 +1,2 @@
+package mactodevinfo
+
diff --git a/net/mac-to-devinfo/files/netdiscover-to-devinfo b/net/mac-to-devinfo/files/netdiscover-to-devinfo
new file mode 100644 (file)
index 0000000..c460dc1
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+#    netdiscover-to-devinfo - netdiscover to MAC IEEE and custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+MACTODEV=mac-to-devinfo
+
+if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
+    echo "Usage: netdiscover-to-devinfo IP-range Interface Timeout [-r repeats] [-s sleep_between_arp_requests]"
+    exit 1
+fi
+
+prep-devinfo
+IFS='
+'
+
+IPRANGE=$1
+IFACE=$2
+TIMEOUT=$3
+
+shift 3
+
+while getopts "r:s:h" param; do
+    case "$param" in
+       h)
+           usage
+           exit 1
+           ;;
+       r)
+           REPEATS=" -c $OPTARG"
+           ;;
+       s)
+           SLEEPREQ="-s $OPTARG"
+           ;;
+       ?|*)
+           usage
+           exit 1
+           break
+           ;;
+
+    esac
+done
+
+
+for line in $(sh -c "netdiscover -t $TIMEOUT-k -m -i $IFACE -r $IPRANGE $REPEATS $SLEEPREQ 2>/dev/null" | grep -E '[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?'); do
+    unset IFS
+    IP=$(echo $line | tr -s \  |  cut -f1 -d\  )
+    MAC=$(echo $line | tr -s \  |  cut -f2 -d\  )
+    echo "$IP"" | ""$($MACTODEV $MAC)"
+    IFS='
+'
+done
+
+unset IFS
diff --git a/net/mac-to-devinfo/files/netsmap-to-devinfo b/net/mac-to-devinfo/files/netsmap-to-devinfo
new file mode 100644 (file)
index 0000000..11a7e41
--- /dev/null
@@ -0,0 +1,156 @@
+#!/bin/sh
+#    netsmap-to-devinfo - netdisovered then smap'ed IP addresses to  MAC IEEE 
+#    and custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+MACTODEV=mac-to-devinfo
+IPTODEV=ip-to-devinfo
+
+usage() {
+    echo "$0: -i interferace -r ip-range [options]"
+    echo ""
+    echo "-r ip-range       range to probe (CIDR, e.g. 192.168.2.0/24)"
+    echo "-i interface      interface to use in scan"
+    echo "-t timeout        time to rate for arp responses for device detection"
+    echo "-p port[,port...] command-separated lists of ports to scan for SIP responses"
+    echo "-c repeat_count   Number of times to send each request (default 1)"
+    echo "-s sleepreq       ms to wait between sending arp requests"
+    echo "-x                Assume we're running on an Xcelerator IP"
+    echo "-h                help"
+}
+
+
+while getopts "r:i:t:p:c:s:xh" param; do
+    case "$param" in
+       h)
+           usage
+           exit 1
+           ;;
+       r)
+           IPRANGE=$OPTARG
+           ;;
+       i)
+           INTERFACE=$OPTARG
+           ;;
+       t)
+           TIMEOUT=$OPTARG
+           ;;
+       p)
+           PORTARG=$OPTARG
+           ;;
+       c)
+           REPEATCOUNT=$OPTARG
+           ;;
+       s)
+           SLEEPREQ="-s $OPTARG"
+           ;;
+       x)
+           XIP=TRUE
+           ;;
+       ?|*)
+           usage
+           exit 1
+           break
+           ;;
+
+    esac
+done
+
+if [ "$IPRANGE" = "" ]; then
+    echo "Must specify an ip range"
+    usage
+    exit 1
+fi
+
+if [ "$INTERFACE" = "" ]; then
+    echo "Must speciy the interface"
+    usage
+    exit 1
+fi
+
+if [ "$TIMEOUT" = "" ]; then
+    TIMEOUT=20
+    usage
+fi
+
+unset PORTS
+
+if [ -n "$PORTARG" ]; then
+    PORTLIST="$PORTARG"
+    
+    if [ -z "$(echo $PORTLIST | grep ',')" ]; then
+       PORTS="$PORTLIST"
+    else
+       FIELD=1
+       oldcurport=""
+       curport="$(echo $PORTLIST | cut -f$FIELD -d, )"
+       while [ "$curport" != "$oldcurport" ]; do
+           PORTS="$curport $PORTS"
+           FIELD=$(($FIELD + 1))
+           oldcurport="$(echo $PORTLIST | cut -f$FIELD -d, )"
+           curport="$(echo $PORTLIST | cut -f$FIELD -d, )"
+       done
+    fi
+fi
+
+
+prep-devinfo
+
+IFS='
+'
+
+if [ -n "$REPEATCOUNT" ]; then
+    REPEAT="-c $REPEATCOUNT"
+fi
+
+for line in $(sh -c "netdiscover -t $TIMEOUT -k -m -i $INTERFACE -r $IPRANGE $REPEAT $SLEEPREQ 2>/dev/null" | grep -E '[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?.[0-9]([0-9]?[0-9])?'); do
+    unset IFS
+    IP=$(echo $line | tr -s \  |  cut -f1 -d\  )
+    MAC=$(echo $line | tr -s \  |  cut -f2 -d\  )
+
+    if [ -n "$PORTS" ]; then
+       for port in $PORTS; do
+           
+           if [ "$XIP" = "TRUE" ]; then
+               XIP_PORT="-x $port"
+           fi
+           for sip_device in $(smap -p $port $IP </dev/null | grep -E -v 'host.? scanned' | grep 'SIP enabled' | cut -f1 -d:  ); do
+               if [ -x "$(which httping)" ]; then
+                   if httping -G -q -o 401,200 -c 2 -h $sip_device; then
+                       echo "$sip_device"" | ""$($MACTODEV $XIP_PORT $MAC)"" | ""http://$sip_device/"
+                       continue
+                   fi
+               fi
+               echo "$sip_device"" | ""$(MACTODEV $XIP_PORT $MAC)"" | "" - "
+           done
+       done
+    else
+       for sip_device in $(smap $IP </dev/null | grep -E -v 'host.? scanned' | grep 'SIP enabled' | cut -f1 -d:  ); do
+           if [ -x "$(which httping)" ]; then
+               if httping -G -q -o 401,200 -c 2 -h $sip_device; then
+                   echo "$sip_device"" | ""$($MACTODEV $MAC $XIP_PORT)"" | ""http://$sip_device/"
+                   continue
+               fi
+           fi
+           echo "$sip_device"" | ""$($MACTODEV $MAC $XIP_PORT)"" | "" - "
+       done
+    fi
+    IFS='
+'
+done
+
+unset IFS
diff --git a/net/mac-to-devinfo/files/prep-devinfo b/net/mac-to-devinfo/files/prep-devinfo
new file mode 100644 (file)
index 0000000..f35c6db
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+#    prev-devinfo - prep MAC IEEE and custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+OUIURL=http://standards.ieee.org/regauth/oui/oui.txt
+IABURL=http://standards.ieee.org/regauth/oui/iab.txt
+
+OUIDIR=/var/cache/mac-to-devinfo
+
+OUIFILE=$OUIDIR/oui.txt
+IABFILE=$OUIDIR/iab.txt
+
+[ -d $OUIDIR ] || mkdir -p $OUIDIR
+
+[ -r $OUIFILE ] || wget -q -O $OUIFILE $OUIURL
+[ -r $IABFILE ] || wget -q -O $IABFILE $IABURL
+
diff --git a/net/mac-to-devinfo/files/smap-to-devinfo b/net/mac-to-devinfo/files/smap-to-devinfo
new file mode 100644 (file)
index 0000000..0368074
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+#    smap-to-devinfo - smap to MAC IEEE and custom information
+#    Copyright (C) 2009  Daniel Dickinson
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+IPTODEV=ip-to-devinfo
+SMAP=smap
+OUIDIR=/var/cache/mac-to-devinfo
+
+XIP_SCANS=FALSE
+
+usage() {
+    echo "Usage: $0 IP-Range [-r ratelimit] [-i interface] [-x] [port,port,...]"
+}
+if [ "$1" == "-h" ] || [ "$2" == "-h" ] || [ "$3" == "-h" ] || [ -z "$1" ]; then
+    usage
+    exit 1
+fi
+
+IPRANGE="$1"
+shift
+
+if [ "$1" == "-r" ]; then
+    RATELIMIT="-r $2"
+    if [ -z "$RATELIMIT" ]; then
+       echo "-r without a ratelimit"
+       usage
+        exit 1
+    fi
+    shift
+    shift
+fi
+
+if [ "$1" == "-i" ]; then
+    INTERFACE="-i $2"
+    if [ -z "$INTERFACE" ]; then
+       echo "-i without interface"
+       usage
+       exit 1
+    fi
+    shift
+    shift
+fi
+
+if [ "$1" == "-x" ]; then
+    XIP_SCANS=TRUE
+    shift
+fi
+
+if [ -n "$1" ]; then
+    PORTLIST="$1"
+    
+    if [ -z "$(echo $PORTLIST | grep ',')" ]; then
+       PORTS="$PORTLIST"
+    else
+       FIELD=1
+       oldcurport=""
+       curport="$(echo $PORTLIST | cut -f$FIELD -d, )"
+       while [ "$curport" != "$oldcurport" ]; do
+           PORTS="$curport $PORTS"
+           FIELD=$(($FIELD + 1))
+           oldcurport="$(echo $PORTLIST | cut -f$FIELD -d, )"
+           curport="$(echo $PORTLIST | cut -f$FIELD -d, )"
+       done
+    fi
+fi
+
+prep-devinfo
+
+if [ -z "$PORTS" ]; then
+    PORTS=5060
+fi
+
+for port in $PORTS; do
+
+    if [ "$XIP_SCANS" == "TRUE" ]; then
+       XIP_PORT="-x $port"
+    fi
+    for sip_device in $($SMAP $RATELIMIT -p $port $IPRANGE | grep -E -v 'host.? scanned' | grep 'SIP enabled' | cut -f1 -d:  ); do
+       if [ -x "$(which httping)" ]; then
+           if httping -G -q -o 401,200 -c 2 -h $sip_device; then
+               echo "$sip_device"" | ""$($IPTODEV $INTERFACE $XIP_PORT $sip_device)"" | ""http://$sip_device/"
+               continue
+           fi
+       fi
+       echo "$sip_device"" | ""$(IPTODEV $XIP_PORT $sip_device)"" | "" - "
+    done
+done
+
diff --git a/net/madwifi/Config.in b/net/madwifi/Config.in
new file mode 100644 (file)
index 0000000..e9f93d7
--- /dev/null
@@ -0,0 +1,55 @@
+menu "Configuration"
+       depends on PACKAGE_kmod-madwifi
+
+config MADWIFI_DEBUG
+       bool "Enable compilation of debugging features"
+       depends on DEVEL
+       default n
+
+config MADWIFI_COMPRESSION
+       bool "Enable Atheros Super A/G Compression"
+       depends on !TARGET_ar71xx
+       default n
+       help
+         Enables Atheros Super A/G Hardware Compression Engine.
+
+config MADWIFI_SINGLE_MODULE
+       bool "Combine driver and net80211 into a single module"
+       default y
+       help
+         This option combines all driver and stack related code (except for HAL)
+         into a single module, thus saving space and removing unnecessary kernel
+         exports
+
+choice
+       prompt "Rate control algorithm selection"
+       default MADWIFI_RCA_MINSTREL
+       help
+         This option controls how MadWifi chooses its bitrate.
+
+config MADWIFI_RCA_MINSTREL
+       bool "Use the Minstrel rate control algorithm"
+       help
+         This code is takes a wandering minstrel approach. Wander around the
+         different rates, singing wherever you can. And then, look at the
+         performance, and make a choice. Note that the wandering minstrel will
+         always wander in directions where he/she feels he/she will get paid
+         the best for his/her work.
+
+config MADWIFI_RCA_SAMPLERATE
+       bool "Use the SampleRate rate control algorithm"
+       help
+         SampleRate decides on the transmission bit-rate based on the past
+         history of performance; it keeps a record of the number of successive
+         failures, the number of successful transmits and the total transmission
+         time along with the destination for that bit-rate. Stale samples are
+         removed based on a EWMA windowing mechanism. If in the sampling
+         process, no successful acknowledgment is received or the number of
+         packets sent is multiple of 10 on a specific link, it transmits the
+         packet with the highest rate which has not failed 4 successive times.
+         Other than that it transmits packets at the rate which has the lowest
+         average transmission time.
+
+endchoice
+
+endmenu
diff --git a/net/madwifi/Makefile b/net/madwifi/Makefile
new file mode 100644 (file)
index 0000000..1607946
--- /dev/null
@@ -0,0 +1,271 @@
+#
+# Copyright (C) 2006-2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=madwifi
+
+PKG_REV:=3314
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=6
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://madwifi-project.org/svn/madwifi/$(if $(PKG_BRANCH),branches/$(PKG_BRANCH),trunk)
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_MIRROR_MD5SUM:=086b026d1c1561be8a949b79b0931404
+
+PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(PKG_BRANCH),$(PKG_BRANCH),madwifi-trunk)-$(PKG_VERSION)
+
+HAL_VERSION:=20090508
+HAL_FILE:=ath_hal-$(HAL_VERSION).tgz
+HAL_MD5SUM:=4ab7ae8bdb96c0be388c98bf8f92d5ca
+
+PKG_BUILD_DEPENDS:=wprobe
+
+include $(INCLUDE_DIR)/package.mk
+
+ifdef CONFIG_MADWIFI_COMPRESSION
+  COMPRESSION:=1
+else
+  COMPRESSION:=0
+endif
+
+define Download/hal
+  FILE:=$(HAL_FILE)
+  URL:=http://mirror2.openwrt.org/sources
+  MD5SUM:=$(HAL_MD5SUM)
+endef
+$(eval $(call Download,hal))
+
+
+ifneq ($(CONFIG_TARGET_atheros),)
+  BUS:=AHB
+else
+  ifneq ($(CONFIG_PCI_SUPPORT),)
+    BUS:=PCI
+  endif
+endif
+
+ifneq ($(CONFIG_CPU_MIPS32_R2),)
+  ifeq ($(ARCH),mips)
+    HAL_TARGET:=mips32r2-be-elf
+  endif
+  ifeq ($(ARCH),mipsel)
+    HAL_TARGET:=mips32r2-le-elf
+  endif
+else
+  ifeq ($(ARCH),mips)
+    HAL_TARGET:=mips32-be-elf
+  endif
+  ifeq ($(ARCH),mipsel)
+    HAL_TARGET:=mips32-le-elf
+  endif
+endif
+ifeq ($(ARCH),i386)
+  HAL_TARGET:=i386-elf
+endif
+ifeq ($(ARCH),i686)
+  HAL_TARGET:=i386-elf
+endif
+ifeq ($(ARCH),armeb)
+  HAL_TARGET:=xscale-be-elfgnueabi
+endif
+ifeq ($(ARCH),arm)
+  HAL_TARGET:=xscale-le-elfgnueabi
+  ifeq ($(BOARD),cns21xx)
+    HAL_TARGET:=armv4-le-elfgnueabi
+  endif
+  ifeq ($(BOARD),cns3xxx)
+    HAL_TARGET:=arm11-le-elfgnueabi
+  endif
+  ifeq ($(BOARD),gemini)
+    HAL_TARGET:=armv4-le-elfgnueabi
+  endif
+endif
+ifeq ($(ARCH),powerpc)
+  HAL_TARGET:=powerpc-be-elf
+endif
+ifneq ($(CONFIG_TARGET_atheros),)
+  HAL_TARGET:=wisoc
+endif
+
+ifdef CONFIG_MADWIFI_RCA_MINSTREL
+  RATE_CONTROL:=minstrel
+endif
+
+ifdef CONFIG_MADWIFI_RCA_ONOE
+  RATE_CONTROL:=onoe
+endif
+
+ifdef CONFIG_MADWIFI_RCA_AMRR
+  RATE_CONTROL:=amrr
+endif
+
+ifdef CONFIG_MADWIFI_RCA_SAMPLERATE
+  RATE_CONTROL:=sample
+endif
+
+ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE),)
+MADWIFI_FILES:= $(PKG_BUILD_DIR)/ath_hal/ath_hal.ko
+else
+MADWIFI_FILES:= \
+       $(PKG_BUILD_DIR)/net80211/wlan.ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_scan_ap.ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_scan_sta.ko \
+       $(PKG_BUILD_DIR)/ath_hal/ath_hal.ko \
+       $(PKG_BUILD_DIR)/ath_rate/$(RATE_CONTROL)/ath_rate_$(RATE_CONTROL).ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_acl.ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_ccmp.ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_tkip.ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_wep.ko \
+       $(PKG_BUILD_DIR)/net80211/wlan_xauth.ko
+endif
+
+ifneq ($(CONFIG_MADWIFI_SINGLE_MODULE),)
+  MADWIFI_AUTOLOAD:= ath_hal
+else
+  MADWIFI_AUTOLOAD:= \
+       wlan \
+       wlan_scan_ap \
+       wlan_scan_sta \
+       ath_hal \
+       ath_rate_$(RATE_CONTROL) \
+       wlan_acl \
+       wlan_ccmp \
+       wlan_tkip \
+       wlan_wep \
+       wlan_xauth
+endif
+
+ifeq ($(findstring AHB,$(BUS)),AHB)
+  MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_ahb.ko
+  MADWIFI_AUTOLOAD+= ath_ahb
+endif
+ifeq ($(findstring PCI,$(BUS)),PCI)
+  MADWIFI_FILES+= $(PKG_BUILD_DIR)/ath/ath_pci.ko
+  MADWIFI_AUTOLOAD+= ath_pci
+endif
+
+MADWIFI_APPLETS:=80211stats athchans athkey athstats wlanconfig ath_info madwifi_multi
+ifdef CONFIG_MADWIFI_DEBUG
+  MADWIFI_APPLETS += athdebug 80211debug
+endif
+
+define KernelPackage/madwifi
+  SUBMENU:=Wireless Drivers
+  TITLE:=Driver for Atheros wireless chipsets
+  URL:=http://madwifi-project.org/
+  DEPENDS:=+wireless-tools @PCI_SUPPORT @(!(TARGET_avr32||TARGET_brcm63xx||TARGET_cobalt||TARGET_ep93xx||TARGET_etrax||TARGET_octeon||TARGET_pxcab||TARGET_sibyte)||BROKEN) +@DRIVER_WEXT_SUPPORT +hostapd-common-old
+  FILES:=$(MADWIFI_FILES)
+  AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
+  MENU:=1
+endef
+
+define KernelPackage/madwifi/description
+ This package contains a driver for Atheros 802.11a/b/g chipsets.
+endef
+
+define KernelPackage/madwifi/config
+       source "$(SOURCE)/Config.in"
+endef
+
+MADWIFI_INC = \
+       -I$(PKG_BUILD_DIR) \
+       -I$(PKG_BUILD_DIR)/include \
+       -I$(PKG_BUILD_DIR)/hal \
+       -I$(PKG_BUILD_DIR)/ath \
+       -I$(PKG_BUILD_DIR)/ath_hal \
+       -I$(PKG_BUILD_DIR)/net80211 \
+       -I$(STAGING_DIR)/usr/include/wprobe \
+       -include $(PKG_BUILD_DIR)/include/compat.h
+
+MAKE_ARGS:= \
+       PATH="$(TARGET_PATH)" \
+       ARCH="$(LINUX_KARCH)" \
+       ARCH-y="$(LINUX_KARCH)" \
+       CROSS_COMPILE="$(TARGET_CROSS)" \
+       TARGET="$(HAL_TARGET)" \
+       TOOLPREFIX="$(KERNEL_CROSS)" \
+       TOOLPATH="$(KERNEL_CROSS)" \
+       KERNELPATH="$(LINUX_DIR)" \
+       KERNELRELEASE="$(LINUX_VERSION)" \
+       LDOPTS="--no-warn-mismatch " \
+       ATH_RATE="$(RATE_CONTROL)" \
+       ATH_CAP_SUPERG_COMP="$(COMPRESSION)" \
+       DO_MULTI=1 \
+       SINGLE_MODULE=$(if $(CONFIG_MADWIFI_SINGLE_MODULE),1) \
+       INCS="$(MADWIFI_INC)" \
+       $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG=) WARNINGS="-Wno-unused"
+
+MAKE_VARS:= \
+       COPTS="-DATH_REVERSE_ENGINEERING=1" \
+
+define Build/Prepare/HAL
+       rm -rf $(PKG_BUILD_DIR)/tmp
+       mkdir -p $(PKG_BUILD_DIR)/tmp
+       tar xvzf $(DL_DIR)/$(HAL_FILE) -C $(PKG_BUILD_DIR)/tmp
+       $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
+       rm -rf $(PKG_BUILD_DIR)/tmp
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(call Build/Prepare/HAL)
+       # patch cflags
+       $(SED) 's, -E[LB],,' \
+               -e 's, -mips2,,' \
+               -e 's, -mapcs-32,,' \
+               -e 's, -mlong-calls,,' \
+               $(PKG_BUILD_DIR)/hal/public/*.inc
+       $(SED) 's,march=armv4,march=armv5te,' \
+               $(PKG_BUILD_DIR)/hal/public/xscale*.inc
+       $(SED) 's,march=armv6j,march=armv6k,' \
+               $(PKG_BUILD_DIR)/hal/public/arm11*.inc
+       $(SED) 's,mtune=arm1136j-s,mtune=mpcore,' \
+               $(PKG_BUILD_DIR)/hal/public/arm11*.inc
+endef
+
+ifeq ($(findstring AHB,$(BUS)),AHB)
+  define Build/Compile/ahb
+       $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="AHB" modules
+       $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
+  endef
+endif
+
+ifeq ($(findstring PCI,$(BUS)),PCI)
+  define Build/Compile/pci
+       $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) BUS="PCI" modules
+       $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS) CFLAGS="$(TARGET_CFLAGS)" tools
+  endef
+endif
+
+define Build/Configure
+       $(SED) 's,-E[LB] ,,g' $(PKG_BUILD_DIR)/hal/public/*.inc
+endef
+
+define Build/Compile
+       $(call Build/Compile/ahb)
+       $(call Build/Compile/pci)
+endef
+
+define Build/InstallDev
+       mkdir -p $(1)/usr/include/madwifi
+       $(CP) $(PKG_BUILD_DIR)/include $(1)/usr/include/madwifi/
+       mkdir -p $(1)/usr/include/madwifi/net80211
+       $(CP) $(PKG_BUILD_DIR)/net80211/*.h $(1)/usr/include/madwifi/net80211/
+endef
+
+define KernelPackage/madwifi/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) ./files/* $(1)/
+       $(CP) $(foreach applet,$(MADWIFI_APPLETS),$(PKG_BUILD_DIR)/tools/$(applet)) $(1)/usr/sbin/
+endef
+
+$(eval $(call KernelPackage,madwifi))
diff --git a/net/madwifi/files/etc/hotplug.d/net/10-madwifi b/net/madwifi/files/etc/hotplug.d/net/10-madwifi
new file mode 100644 (file)
index 0000000..f5afce3
--- /dev/null
@@ -0,0 +1,12 @@
+if [ "$ACTION" = "add" -o "$ACTION" = "register" ]; then
+       case "$INTERFACE" in
+               ath*.sta*)
+                       local BASEIF="${INTERFACE%%\.*}"
+
+                       include /lib/network
+                       scan_interfaces
+                       local CONFIG="$(find_config "$BASEIF")" 
+                       [ -n "$CONFIG" ] && setup_interface "$INTERFACE" "$CONFIG"
+               ;;
+       esac
+fi
diff --git a/net/madwifi/files/lib/wifi/madwifi.sh b/net/madwifi/files/lib/wifi/madwifi.sh
new file mode 100755 (executable)
index 0000000..eb68769
--- /dev/null
@@ -0,0 +1,499 @@
+#!/bin/sh
+append DRIVERS "atheros"
+
+find_atheros_phy() {
+       local device="$1"
+
+       local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
+       config_get phy "$device" phy
+       [ -z "$phy" -a -n "$macaddr" ] && {
+               cd /proc/sys/dev
+               for phy in $(ls -d wifi* 2>&-); do
+                       [ "$macaddr" = "$(cat /sys/class/net/${phy}/address)" ] || continue
+                       config_set "$device" phy "$phy"
+                       break
+               done
+               config_get phy "$device" phy
+       }
+       [ -n "$phy" -a -d "/proc/sys/dev/$phy" ] || {
+               echo "phy for wifi device $1 not found"
+               return 1
+       }
+       [ -z "$macaddr" ] && {
+               config_set "$device" macaddr "$(cat /sys/class/net/${phy}/address)"
+       }
+       return 0
+}
+
+scan_atheros() {
+       local device="$1"
+       local wds
+       local adhoc ahdemo sta ap monitor disabled
+
+       [ ${device%[0-9]} = "wifi" ] && config_set "$device" phy "$device"
+
+       local ifidx=0
+       
+       config_get vifs "$device" vifs
+       for vif in $vifs; do
+               config_get_bool disabled "$vif" disabled 0
+               [ $disabled = 0 ] || continue
+
+               local vifname
+               [ $ifidx -gt 0 ] && vifname="ath${device#radio}-$ifidx" || vifname="ath${device#radio}"
+
+               config_get ifname "$vif" ifname
+               config_set "$vif" ifname "${ifname:-$vifname}"
+               
+               config_get mode "$vif" mode
+               case "$mode" in
+                       adhoc|ahdemo|sta|ap|monitor)
+                               append $mode "$vif"
+                       ;;
+                       wds)
+                               config_get ssid "$vif" ssid
+                               [ -z "$ssid" ] && continue
+
+                               config_set "$vif" wds 1
+                               config_set "$vif" mode sta
+                               mode="sta"
+                               addr="$ssid"
+                               ${addr:+append $mode "$vif"}
+                       ;;
+                       *) echo "$device($vif): Invalid mode, ignored."; continue;;
+               esac
+
+               ifidx=$(($ifidx + 1))
+       done
+
+       case "${adhoc:+1}:${sta:+1}:${ap:+1}" in
+               # valid mode combinations
+               1::) wds="";;
+               1::1);;
+               :1:1)config_set "$device" nosbeacon 1;; # AP+STA, can't use beacon timers for STA
+               :1:);;
+               ::1);;
+               ::);;
+               *) echo "$device: Invalid mode combination in config"; return 1;;
+       esac
+
+       config_set "$device" vifs "${sta:+$sta }${ap:+$ap }${adhoc:+$adhoc }${ahdemo:+$ahdemo }${wds:+$wds }${monitor:+$monitor}"
+}
+
+
+disable_atheros() (
+       local device="$1"
+
+       find_atheros_phy "$device" || return 0
+       config_get phy "$device" phy
+
+       set_wifi_down "$device"
+
+       include /lib/network
+       cd /proc/sys/net
+       for dev in *; do
+               grep "$phy" "$dev/%parent" >/dev/null 2>/dev/null && {
+                       [ -f "/var/run/wifi-${dev}.pid" ] &&
+                               kill "$(cat "/var/run/wifi-${dev}.pid")"
+                       ifconfig "$dev" down
+                       unbridge "$dev"
+                       wlanconfig "$dev" destroy
+               }
+       done
+       return 0
+)
+
+enable_atheros() {
+       local device="$1"
+
+       find_atheros_phy "$device" || return 0
+       config_get phy "$device" phy
+
+       config_get regdomain "$device" regdomain
+       [ -n "$regdomain" ] && echo "$regdomain" > /proc/sys/dev/$phy/regdomain
+
+       config_get country "$device" country
+       case "$country" in
+               [A-Za-z]*) country=`grep -i "$country" /lib/wifi/madwifi_countrycodes.txt |cut -d " " -f 2`;;
+               [0-9]*) ;;
+               *) country="" ;;
+       esac
+       [ -n "$country" ] && echo "$country" > /proc/sys/dev/$phy/countrycode
+
+       config_get_bool outdoor "$device" outdoor "0"
+       echo "$outdoor" > /proc/sys/dev/$phy/outdoor
+
+       config_get channel "$device" channel
+       config_get vifs "$device" vifs
+       config_get txpower "$device" txpower
+
+       [ auto = "$channel" ] && channel=0
+
+       config_get_bool antdiv "$device" diversity
+       config_get antrx "$device" rxantenna
+       config_get anttx "$device" txantenna
+       config_get_bool softled "$device" softled
+       config_get antenna "$device" antenna
+
+       devname="$(cat /proc/sys/dev/$phy/dev_name)"
+       local antgpio=
+       local invert=
+       case "$devname" in
+               NanoStation2) antgpio=7; invert=1;;
+               NanoStation5) antgpio=1; invert=1;;
+               "NanoStation Loco2") antgpio=2;;
+               "NanoStation Loco5")
+                       case "$antenna" in
+                               horizontal) antdiv=0; anttx=1; antrx=1;;
+                               vertical) antdiv=0; anttx=2; antrx=2;;
+                               *) antdiv=1; anttx=0; antrx=0;;
+                       esac
+               ;;
+       esac
+       if [ -n "$invert" ]; then
+               _set="clear"
+               _clear="set"
+       else
+               _set="set"
+               _clear="clear"
+       fi
+       if [ -n "$antgpio" ]; then
+               softled=0
+               case "$devname" in
+                       "NanoStation Loco2")
+                               antdiv=0
+                               antrx=1
+                               anttx=1
+                               case "$antenna" in
+                                       horizontal) gpioval=0;;
+                                       *) gpioval=1;;
+                               esac
+                       ;;
+                       *)
+                               case "$antenna" in
+                                       external) antdiv=0; antrx=1; anttx=1; gpioval=1;;
+                                       horizontal) antdiv=0; antrx=1; anttx=1; gpioval=0;;
+                                       vertical) antdiv=0; antrx=2; anttx=2; gpioval=0;;
+                                       auto) antdiv=1; antrx=0; anttx=0; gpioval=0;;
+                               esac
+                       ;;
+               esac
+
+               [ -x "$(which gpioctl 2>/dev/null)" ] || antenna=
+               gpioctl "dirout" "$antgpio" >/dev/null 2>&1
+               case "$gpioval" in
+                       0)
+                               gpioctl "$_clear" "$antgpio" >/dev/null 2>&1
+                       ;;
+                       1)
+                               gpioctl "$_set" "$antgpio" >/dev/null 2>&1
+                       ;;
+               esac
+       fi
+
+       [ -n "$antdiv" ] && sysctl -w dev."$phy".diversity="$antdiv" >&-
+       [ -n "$antrx" ] && sysctl -w dev."$phy".rxantenna="$antrx" >&-
+       [ -n "$anttx" ] && sysctl -w dev."$phy".txantenna="$anttx" >&-
+       [ -n "$softled" ] && sysctl -w dev."$phy".softled="$softled" >&-
+
+       config_get distance "$device" distance
+       [ -n "$distance" ] && sysctl -w dev."$phy".distance="$distance" >&-
+
+       for vif in $vifs; do
+               local start_hostapd= vif_txpower= nosbeacon=
+               config_get ifname "$vif" ifname
+               config_get enc "$vif" encryption
+               config_get eap_type "$vif" eap_type
+               config_get mode "$vif" mode
+
+               case "$mode" in
+                       sta) config_get_bool nosbeacon "$device" nosbeacon;;
+                       adhoc) config_get_bool nosbeacon "$vif" sw_merge 1;;
+               esac
+
+               [ "$nosbeacon" = 1 ] || nosbeacon=""
+               ifname=$(wlanconfig "$ifname" create nounit wlandev "$phy" wlanmode "$mode" ${nosbeacon:+nosbeacon})
+               [ $? -ne 0 ] && {
+                       echo "enable_atheros($device): Failed to set up $mode vif $ifname" >&2
+                       continue
+               }
+               config_set "$vif" ifname "$ifname"
+
+               config_get hwmode "$device" hwmode
+               [ -z "$hwmode" ] && config_get hwmode "$device" mode
+
+               pureg=0
+               case "$hwmode" in
+                       *b) hwmode=11b;;
+                       *bg) hwmode=11g;;
+                       *g) hwmode=11g; pureg=1;;
+                       *gdt) hwmode=11gdt;;
+                       *a) hwmode=11a;;
+                       *adt) hwmode=11adt;;
+                       *ast) hwmode=11ast;;
+                       *fh) hwmode=fh;;
+                       *) hwmode=auto;;
+               esac
+               iwpriv "$ifname" mode "$hwmode"
+               iwpriv "$ifname" pureg "$pureg"
+
+               iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null 
+
+               config_get_bool hidden "$vif" hidden 0
+               iwpriv "$ifname" hide_ssid "$hidden"
+
+               config_get ff "$vif" ff
+               if [ -n "$ff" ]; then
+                       iwpriv "$ifname" ff "$ff"
+               fi
+
+               config_get wds "$vif" wds
+               case "$wds" in
+                       1|on|enabled) wds=1;;
+                       *) wds=0;;
+               esac
+               iwpriv "$ifname" wds "$wds" >/dev/null 2>&1
+
+               [ "$mode" = ap -a "$wds" = 1 ] && {
+                       config_get_bool wdssep "$vif" wdssep 1
+                       [ -n "$wdssep" ] && iwpriv "$ifname" wdssep "$wdssep"
+               }
+
+               case "$enc" in
+                       wep*)
+                               case "$enc" in
+                                       *shared*) iwpriv "$ifname" authmode 2;;
+                                       *)        iwpriv "$ifname" authmode 1;;
+                               esac
+                               for idx in 1 2 3 4; do
+                                       config_get key "$vif" "key${idx}"
+                                       iwconfig "$ifname" enc "[$idx]" "${key:-off}"
+                               done
+                               config_get key "$vif" key
+                               key="${key:-1}"
+                               case "$key" in
+                                       [1234]) iwconfig "$ifname" enc "[$key]";;
+                                       *) iwconfig "$ifname" enc "$key";;
+                               esac
+                       ;;
+                       psk*|wpa*)
+                               start_hostapd=1
+                               config_get key "$vif" key
+                       ;;
+               esac
+
+               case "$mode" in
+                       sta|adhoc|ahdemo)
+                               config_get addr "$vif" bssid
+                               [ -z "$addr" ] || { 
+                                       iwconfig "$ifname" ap "$addr"
+                               }
+                       ;;
+               esac
+
+               config_get_bool uapsd "$vif" uapsd 0
+               iwpriv "$ifname" uapsd "$uapsd"
+
+               config_get_bool bgscan "$vif" bgscan
+               [ -n "$bgscan" ] && iwpriv "$ifname" bgscan "$bgscan"
+
+               config_get rate "$vif" rate
+               [ -n "$rate" ] && iwconfig "$ifname" rate "${rate%%.*}"
+
+               config_get mcast_rate "$vif" mcast_rate
+               [ -n "$mcast_rate" ] && iwpriv "$ifname" mcast_rate "${mcast_rate%%.*}"
+
+               config_get frag "$vif" frag
+               [ -n "$frag" ] && iwconfig "$ifname" frag "${frag%%.*}"
+
+               config_get rts "$vif" rts
+               [ -n "$rts" ] && iwconfig "$ifname" rts "${rts%%.*}"
+
+               config_get_bool comp "$vif" compression 0
+               iwpriv "$ifname" compression "$comp" >/dev/null 2>&1
+
+               config_get minrate "$vif" minrate
+               [ -n "$minrate" ] && iwpriv "$ifname" minrate "$minrate"
+
+               config_get maxrate "$vif" maxrate
+               [ -n "$maxrate" ] && iwpriv "$ifname" maxrate "$maxrate"
+
+               config_get_bool burst "$vif" bursting
+               [ -n "$burst" ] && iwpriv "$ifname" burst "$burst"
+
+               config_get_bool wmm "$vif" wmm
+               [ -n "$wmm" ] && iwpriv "$ifname" wmm "$wmm"
+
+               config_get_bool xr "$vif" xr
+               [ -n "$xr" ] && iwpriv "$ifname" xr "$xr"
+
+               config_get_bool ar "$vif" ar
+               [ -n "$ar" ] && iwpriv "$ifname" ar "$ar"
+
+               config_get_bool beacon_power "$vif" beacon_power
+               [ -n "$beacon_power" ] && iwpriv "$ifname" beacon_pwr "$beacon_power"
+
+               config_get_bool doth "$vif" doth 0
+               [ -n "$doth" ] && iwpriv "$ifname" doth "$doth"
+
+               config_get_bool probereq "$vif" probereq
+               [ -n "$probereq" ] && iwpriv "$ifname" probereq "$probereq"
+
+               config_get maclist "$vif" maclist
+               [ -n "$maclist" ] && {
+                       # flush MAC list
+                       iwpriv "$ifname" maccmd 3
+                       for mac in $maclist; do
+                               iwpriv "$ifname" addmac "$mac"
+                       done
+               }
+
+               config_get macpolicy "$vif" macpolicy
+               case "$macpolicy" in
+                       allow)
+                               iwpriv "$ifname" maccmd 1
+                       ;;
+                       deny)
+                               iwpriv "$ifname" maccmd 2
+                       ;;
+                       *)
+                               # default deny policy if mac list exists
+                               [ -n "$maclist" ] && iwpriv "$ifname" maccmd 2
+                       ;;
+               esac
+
+               ifconfig "$ifname" up
+
+               local net_cfg bridge
+               net_cfg="$(find_net_config "$vif")"
+               [ -z "$net_cfg" ] || {
+                       bridge="$(bridge_interface "$net_cfg")"
+                       config_set "$vif" bridge "$bridge"
+                       start_net "$ifname" "$net_cfg"
+               }
+
+               config_get ssid "$vif" ssid
+               [ -n "$ssid" ] && {
+                       iwconfig "$ifname" essid on
+                       iwconfig "$ifname" essid ${ssid:+-- }"$ssid"
+               }
+
+               set_wifi_up "$vif" "$ifname"
+
+               # TXPower settings only work if device is up already
+               # while atheros hardware theoretically is capable of per-vif (even per-packet) txpower
+               # adjustment it does not work with the current atheros hal/madwifi driver
+
+               config_get vif_txpower "$vif" txpower
+               # use vif_txpower (from wifi-iface) instead of txpower (from wifi-device) if
+               # the latter doesn't exist
+               txpower="${txpower:-$vif_txpower}"
+               [ -z "$txpower" ] || iwconfig "$ifname" txpower "${txpower%%.*}"
+
+               case "$mode:$enc" in
+                       ap:*)
+                               config_get_bool isolate "$vif" isolate 0
+                               iwpriv "$ifname" ap_bridge "$((isolate^1))"
+
+                               if [ -n "$start_hostapd" ] && eval "type hostapd_setup_vif" 2>/dev/null >/dev/null; then
+                                       hostapd_setup_vif "$vif" madwifi || {
+                                               echo "enable_atheros($device): Failed to set up hostapd for interface $ifname" >&2
+                                               # make sure this wifi interface won't accidentally stay open without encryption
+                                               ifconfig "$ifname" down
+                                               wlanconfig "$ifname" destroy
+                                               continue
+                                       }
+                               fi
+                       ;;
+                       wds:*|sta:*)
+                               if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
+                                       wpa_supplicant_setup_vif "$vif" wext || {
+                                               echo "enable_atheros($device): Failed to set up wpa_supplicant for interface $ifname" >&2
+                                               ifconfig "$ifname" down
+                                               wlanconfig "$ifname" destroy
+                                               continue
+                                       }
+                               fi
+                       ;;
+                       adhoc:wep*|adhoc:psk*|adhoc:wpa*)
+                               if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
+                                       wpa_supplicant_setup_vif "$vif" madwifi || {
+                                               echo "enable_atheros($device): Failed to set up wpa"
+                                               ifconfig "$ifname" down
+                                               wlanconfig "$ifname" destroy
+                                               continue
+                                       }
+                               fi
+                       ;;
+               esac
+       done
+}
+
+check_atheros_device() {
+       [ ${1%[0-9]} = "wifi" ] && config_set "$1" phy "$1"
+       config_get phy "$1" phy
+       [ -z "$phy" ] && {
+               find_atheros_phy "$1" >/dev/null || return 0
+               config_get phy "$1" phy
+       }
+       [ "$phy" = "$dev" ] && found=1
+}
+
+
+detect_atheros() {
+       devidx=0
+       config_load wireless
+       while :; do
+               config_get type "radio$devidx" type
+               [ -n "$type" ] || break
+               devidx=$(($devidx + 1))
+       done
+       cd /proc/sys/dev
+       [ -d ath ] || return
+       for dev in $(ls -d wifi* 2>&-); do
+               found=0
+               config_foreach check_atheros_device wifi-device
+               [ "$found" -gt 0 ] && continue
+
+               devname="$(cat /proc/sys/dev/$dev/dev_name)"
+               case "$devname" in
+                       "NanoStation Loco2")
+                               EXTRA_DEV="
+# Ubiquiti NanoStation Loco2 features
+       option antenna  vertical # (horizontal|vertical)
+"
+                       ;;
+                       "NanoStation Loco5")
+                               EXTRA_DEV="
+# Ubiquiti NanoStation Loco5 features
+       option antenna  auto # (auto|horizontal|vertical)
+"
+                       ;;
+                       NanoStation*)
+                               EXTRA_DEV="
+# Ubiquiti NanoStation features
+       option antenna  auto # (auto|horizontal|vertical|external)
+"
+                       ;;
+               esac
+
+               cat <<EOF
+config wifi-device  radio$devidx
+       option type     atheros
+       option channel  auto
+       option macaddr  $(cat /sys/class/net/${dev}/address)
+$EXTRA_DEV
+       # REMOVE THIS LINE TO ENABLE WIFI:
+       option disabled 1
+
+config wifi-iface
+       option device   radio$devidx
+       option network  lan
+       option mode     ap
+       option ssid     OpenWrt
+       option encryption none
+
+EOF
+       devidx=$(($devidx + 1))
+       done
+}
diff --git a/net/madwifi/files/lib/wifi/madwifi_countrycodes.txt b/net/madwifi/files/lib/wifi/madwifi_countrycodes.txt
new file mode 100644 (file)
index 0000000..624048b
--- /dev/null
@@ -0,0 +1,239 @@
+AF 4
+AL 8
+DZ 12
+AS 16
+AD 20
+AO 24
+AI 660
+AQ 10
+AG 28
+AR 32
+AM 51
+AW 533
+AU 36
+AT 40
+AZ 31
+BS 44
+BH 48
+BD 50
+BB 52
+BY 112
+BE 56
+BZ 84
+BJ 204
+BM 60
+BT 64
+BO 68
+BA 70
+BW 72
+BV 74
+BR 76
+IO 86
+VG 92
+BN 96
+BG 100
+BF 854
+BI 108
+KH 116
+CM 120
+CA 124
+CV 132
+KY 136
+CF 140
+TD 148
+CL 152
+CN 156
+CX 162
+CC 166
+CO 170
+KM 174
+CD 180
+CG 178
+CK 184
+CR 188
+CI 384
+CU 192
+CY 196
+CZ 203
+DK 208
+DJ 262
+DM 212
+DO 214
+EC 218
+EG 818
+SV 222
+GQ 226
+ER 232
+EE 233
+ET 231
+FO 234
+FK 238
+FJ 242
+FI 246
+FR 250
+GF 254
+PF 258
+TF 260
+GA 266
+GM 270
+GE 268
+DE 276
+GH 288
+GI 292
+GR 300
+GL 304
+GD 308
+GP 312
+GU 316
+GT 320
+GN 324
+GW 624
+GY 328
+HT 332
+HM 334
+VA 336
+HN 340
+HK 344
+HR 191
+HU 348
+IS 352
+IN 356
+ID 360
+IR 364
+IQ 368
+IE 372
+IL 376
+IT 380
+JM 388
+JP 392
+JO 400
+KZ 398
+KE 404
+KI 296
+KP 408
+KR 410
+KW 414
+KG 417
+LA 418
+LV 428
+LB 422
+LS 426
+LR 430
+LY 434
+LI 438
+LT 440
+LU 442
+MO 446
+MK 807
+MG 450
+MW 454
+MY 458
+MV 462
+ML 466
+MT 470
+MH 584
+MQ 474
+MR 478
+MU 480
+YT 175
+MX 484
+FM 583
+MD 498
+MC 492
+MN 496
+MS 500
+MA 504
+MZ 508
+MM 104
+NA 516
+NR 520
+NP 524
+AN 530
+NL 528
+NC 540
+NZ 554
+NI 558
+NE 562
+NG 566
+NU 570
+NF 574
+MP 580
+NO 578
+OM 512
+PK 586
+PW 585
+PS 275
+PA 591
+PG 598
+PY 600
+PE 604
+PH 608
+PN 612
+PL 616
+PT 620
+PR 630
+QA 634
+RE 638
+RO 642
+RU 643
+RW 646
+SH 654
+KN 659
+LC 662
+PM 666
+VC 670
+WS 882
+SM 674
+ST 678
+SA 682
+SN 686
+CS 891
+SC 690
+SL 694
+SG 702
+SK 703
+SI 705
+SB 90
+SO 706
+ZA 710
+GS 239
+ES 724
+LK 144
+SD 736
+SR 740
+SJ 744
+SZ 748
+SE 752
+CH 756
+SY 760
+TW 158
+TJ 762
+TZ 834
+TH 764
+TL 626
+TG 768
+TK 772
+TO 776
+TT 780
+TN 788
+TR 792
+TM 795
+TC 796
+TV 798
+VI 850
+UG 800
+UA 804
+AE 784
+GB 826
+UM 581
+US 840
+UY 858
+UZ 860
+VU 548
+VE 862
+VN 704
+WF 876
+EH 732
+YE 887
+ZM 894
+ZW 716
diff --git a/net/madwifi/patches/102-multicall_binary.patch b/net/madwifi/patches/102-multicall_binary.patch
new file mode 100644 (file)
index 0000000..887a462
--- /dev/null
@@ -0,0 +1,315 @@
+--- a/tools/80211debug.c
++++ b/tools/80211debug.c
+@@ -48,6 +48,7 @@
+ #include <ctype.h>
+ #include <getopt.h>
+ #include <err.h>
++#include "do_multi.h"
+ #undef ARRAY_SIZE
+ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+@@ -185,7 +186,7 @@ sysctlbyname(const char *oid0, void *old
+ #endif /* __linux__ */
+ int
+-main(int argc, char *argv[])
++CMD(a80211debug)(int argc, char *argv[])
+ {
+       const char *ifname = "ath0";
+       const char *cp, *tp;
+--- a/tools/80211stats.c
++++ b/tools/80211stats.c
+@@ -59,6 +59,7 @@
+ #include "net80211/ieee80211.h"
+ #include "net80211/ieee80211_crypto.h"
+ #include "net80211/ieee80211_ioctl.h"
++#include "do_multi.h"
+ #ifndef SIOCG80211STATS
+ #define       SIOCG80211STATS (SIOCDEVPRIVATE + 2)
+@@ -240,7 +241,7 @@ print_sta_stats(FILE *fd, const u_int8_t
+ }
+ int
+-main(int argc, char *argv[])
++CMD(a80211stats)(int argc, char *argv[])
+ {
+       int c, len;
+       struct ieee80211req_sta_info *si;
+--- a/tools/athchans.c
++++ b/tools/athchans.c
+@@ -58,6 +58,7 @@
+ #include "net80211/ieee80211.h"
+ #include "net80211/ieee80211_crypto.h"
+ #include "net80211/ieee80211_ioctl.h"
++#include "do_multi.h"
+ static        int s = -1;
+ static const char *progname;
+@@ -140,8 +141,9 @@ usage(void)
+ }
+ #define       MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
++
+ int
+-main(int argc, char *argv[])
++CMD(athchans)(int argc, char *argv[])
+ {
+       const char *ifname = "wifi0";
+       struct ieee80211req_chanlist chanlist;
+--- a/tools/athctrl.c
++++ b/tools/athctrl.c
+@@ -52,6 +52,7 @@
+ #include <err.h>
+ #include <net/if.h>
++#include "do_multi.h"
+ static int
+ setsysctrl(const char *dev, const char *control , u_long value)
+@@ -88,7 +89,7 @@ static void usage(void)
+ }
+ int
+-main(int argc, char *argv[])
++CMD(athctrl)(int argc, char *argv[])
+ {
+       char device[IFNAMSIZ + 1];
+       int distance = -1;
+--- a/tools/athdebug.c
++++ b/tools/athdebug.c
+@@ -51,6 +51,7 @@
+ #include <ctype.h>
+ #include <getopt.h>
+ #include <err.h>
++#include "do_multi.h"
+ #undef ARRAY_SIZE
+ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+@@ -194,7 +195,7 @@ sysctlbyname(const char *oid0, void *old
+ #endif /* __linux__ */
+ int
+-main(int argc, char *argv[])
++CMD(athdebug)(int argc, char *argv[])
+ {
+ #ifdef __linux__
+       const char *ifname = "wifi0";
+--- a/tools/athkey.c
++++ b/tools/athkey.c
+@@ -58,6 +58,7 @@
+ #include "net80211/ieee80211.h"
+ #include "net80211/ieee80211_crypto.h"
+ #include "net80211/ieee80211_ioctl.h"
++#include "do_multi.h"
+ static int s = -1;
+ static const char *progname;
+@@ -213,8 +214,7 @@ usage(void)
+       exit(-1);
+ }
+-int
+-main(int argc, char *argv[])
++int CMD(athkey)(int argc, char *argv[])
+ {
+       const char *ifname = "wifi0";
+       struct ieee80211req_key setkey;
+--- a/tools/athstats.c
++++ b/tools/athstats.c
+@@ -65,6 +65,7 @@
+ #undef ARRAY_SIZE
+ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
++#include "do_multi.h"
+ static const struct {
+       u_int           phyerr;
+@@ -228,7 +229,7 @@ catchalarm(int signo)
+ }
+ int
+-main(int argc, char *argv[])
++CMD(athstats)(int argc, char *argv[])
+ {
+ #ifdef __linux__
+       const char *ifname = "wifi0";
+--- /dev/null
++++ b/tools/do_multi.c
+@@ -0,0 +1,33 @@
++#include <string.h>
++#include <libgen.h>
++#include "do_multi.h"
++
++int
++main(int argc, char *argv[])
++{
++    char *progname;
++    int ret = 0;
++
++    progname = basename(argv[0]);
++
++    if(strcmp(progname, "80211debug") == 0)
++      ret = a80211debug_init(argc, argv);
++    if(strcmp(progname, "80211stats") == 0)
++      ret = a80211stats_init(argc, argv);
++    if(strcmp(progname, "athchans") == 0)
++      ret = athchans_init(argc, argv);
++    if(strcmp(progname, "athctrl") == 0)
++      ret =  athctrl_init(argc, argv);
++    if(strcmp(progname, "athdebug") == 0)
++      ret =  athdebug_init(argc, argv);
++    if(strcmp(progname, "athkey") == 0)
++      ret =  athkey_init(argc, argv);
++    if(strcmp(progname, "athstats") == 0)
++      ret =  athstats_init(argc, argv);
++    if(strcmp(progname, "wlanconfig") == 0)
++      ret =  wlanconfig_init(argc, argv);
++    if(strcmp(progname, "ath_info") == 0)
++      ret =  athinfo_init(argc, argv);
++
++    return ret;
++}
+--- /dev/null
++++ b/tools/do_multi.h
+@@ -0,0 +1,15 @@
++#ifdef DO_MULTI
++int a80211debug_init(int argc, char *argv[]);
++int a80211stats_init(int argc, char *argv[]);
++int athchans_init(int argc, char *argv[]);
++int athctrl_init(int argc, char *argv[]);
++int athdebug_init(int argc, char *argv[]);
++int athkey_init(int argc, char *argv[]);
++int athstats_init(int argc, char *argv[]);
++int wlanconfig_init(int argc, char *argv[]);
++int athinfo_init(int argc, char *argv[]);
++
++#define CMD(name) name##_init
++#else
++#define CMD(name) main
++#endif
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -46,56 +46,55 @@ ifeq ($(HAL),)
+ HAL=   $(TOP)/hal
+ endif
++all: compile
+-ALL=  athstats 80211stats athkey athchans athctrl \
++ALLPROGS=     athstats 80211stats athkey athchans athctrl \
+       athdebug 80211debug wlanconfig ath_info
+-all:  $(ALL)
++OBJS= $(patsubst %,%.o,$(ALLPROGS))
+-INCS= -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL)
++INCS= -I. -I../ath -I$(HAL) -I$(TOP) -I$(ATH_HAL)
+ CFLAGS=       -g -O2 -Wall
+ ALL_CFLAGS= $(CFLAGS) $(INCS)
+ LDFLAGS=
+-all:  $(ALL)
+-athstats: athstats.c
+-      $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
+-80211stats: 80211stats.c
+-      $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
+-athkey: athkey.c
+-      $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
+-athchans: athchans.c
+-      $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
+-athctrl: athctrl.c
+-      $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
+-athdebug: athdebug.c
+-      $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
+-wlanconfig: wlanconfig.c
+-      $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
+-80211debug: 80211debug.c
+-      $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
+-ath_info: ath_info.c
+-      $(CC) -o ath_info $(CFLAGS) ath_info.c
++ifneq ($(DO_MULTI),)
++ALL_CFLAGS += -DDO_MULTI=1
++%.o: %.c
++      ${CC} $(ALL_CFLAGS) -c -o $@  $<
++
++madwifi_multi: $(OBJS) do_multi.o
++      $(CC) -o $@ $^
++
++compile: madwifi_multi
++      for i in $(ALLPROGS); do \
++              ln -s -f madwifi_multi $$i; \
++      done
++else
++$(ALLPROGS):
++      $(CC) $(ALL_CFLAGS) -o $@ $@.c
++
++compile: $(ALLPROGS)
++endif
+ install: $(ALL) 
+       install -d $(DESTDIR)$(BINDIR)
+-      for i in $(ALL); do \
++      for i in $(ALLPROGS) $(if $(DO_MULTI),madwifi_multi); do \
+               install $$i $(DESTDIR)$(BINDIR)/$$i; \
+-              $(STRIP) $(DESTDIR)$(BINDIR)/$$i; \
+       done
+       install -d $(DESTDIR)$(MANDIR)/man8
+       install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8
+       install $(TOP)/scripts/madwifi-unload $(DESTDIR)$(BINDIR)/madwifi-unload
+ uninstall:
+-      for i in $(ALL); do \
++      for i in $(ALLPROGS) $(if $(DO_MULTI),madwifi_multi); do \
+               rm -f $(DESTDIR)$(BINDIR)/$$i; \
+       done
+-      for i in $(ALL:=.8); do \
+-              rm -f $(DESTDIR)$(MANDIR)/man8/$$i; \
++      for i in $(ALLPROGS); do \
++              rm -f $(DESTDIR)$(MANDIR)/man8/$$i.8; \
+       done
+ clean:
+-      rm -f $(ALL) core a.out
++      rm -f $(ALLPROGS) madwifi_multi *.o core a.out
+--- a/tools/wlanconfig.c
++++ b/tools/wlanconfig.c
+@@ -61,6 +61,7 @@
+ #include "net80211/ieee80211.h"
+ #include "net80211/ieee80211_crypto.h"
+ #include "net80211/ieee80211_ioctl.h"
++#include "do_multi.h"
+ /*
+  * These are taken from ieee80211_node.h
+@@ -100,7 +101,7 @@ size_t strlcat(char *, const char *, siz
+ static int verbose = 0;
+ int
+-main(int argc, char *argv[])
++CMD(wlanconfig)(int argc, char *argv[])
+ {
+       const char *ifname, *cmd;
+       unsigned char bnounit = 0;
+--- a/tools/ath_info.c
++++ b/tools/ath_info.c
+@@ -98,6 +98,7 @@
+ #include <sys/mman.h>
+ #include <endian.h>
+ #include <byteswap.h>
++#include "do_multi.h"
+ #undef ARRAY_SIZE
+ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+@@ -738,7 +739,8 @@ static void usage(const char *n)
+               "unlawful radio transmissions!\n\n");
+ }
+-int main(int argc, char *argv[])
++int
++CMD(athinfo)(int argc, char *argv[])
+ {
+       u_int32_t dev_addr;
+       u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;
diff --git a/net/madwifi/patches/104-autocreate_none.patch b/net/madwifi/patches/104-autocreate_none.patch
new file mode 100644 (file)
index 0000000..b2181b6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -516,7 +516,7 @@ ath_attach(u_int16_t devid, struct net_d
+       HAL_STATUS status;
+       int error = 0;
+       unsigned int i;
+-      int autocreatemode = IEEE80211_M_STA;
++      int autocreatemode = -1;
+       u_int8_t csz;
+       sc->devid = devid;
diff --git a/net/madwifi/patches/105-ratectl_attach.patch b/net/madwifi/patches/105-ratectl_attach.patch
new file mode 100644 (file)
index 0000000..80aad83
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/net80211/ieee80211_rate.c
++++ b/net80211/ieee80211_rate.c
+@@ -100,8 +100,18 @@ struct ath_ratectrl *ieee80211_rate_atta
+               ieee80211_load_module(buf);
+       if (!ratectls[id].attach) {
+-              printk(KERN_ERR "Error loading module \"%s\"\n", buf);
+-              return NULL;
++              /* pick the first available rate control module */
++              printk(KERN_INFO "Rate control module \"%s\" not available\n", buf);
++              for (id = 0; id < IEEE80211_RATE_MAX - 1; id++) {
++                      if (ratectls[id].attach)
++                              break;
++              }
++              if (!ratectls[id].attach) {
++                      printk(KERN_ERR "No rate control module available");
++                      return NULL;
++              } else {
++                      printk(KERN_INFO "Using \"%s\" instead.\n", module_names[id]);
++              }
+       }
+       ctl = ratectls[id].attach(sc);
diff --git a/net/madwifi/patches/106-get_arch.patch b/net/madwifi/patches/106-get_arch.patch
new file mode 100644 (file)
index 0000000..3140f36
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/scripts/get_arch.mk
++++ b/scripts/get_arch.mk
+@@ -36,11 +36,14 @@ ifeq (,$(ARCH-y))
+ $(Cannot determine ARCH)
+ endif
++# Allow ARCH to be x86
++ifneq (,$(CONFIG_X86))
++ifeq (x86,$(ARCH))
++ARCH-y = $(ARCH)
++endif
++endif
++
+ # Don't allow ARCH to be overridden by a different value.
+ ifeq (,$(ARCH))
+ ARCH = $(ARCH-y)
+-else
+-ifneq ($(ARCH),$(ARCH-y))
+-$(error ARCH mismatch: supplied "$(ARCH)", determined "$(ARCH-y)")
+-endif
+ endif
diff --git a/net/madwifi/patches/111-minstrel_crash.patch b/net/madwifi/patches/111-minstrel_crash.patch
new file mode 100644 (file)
index 0000000..975bc4e
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -393,6 +393,9 @@ ath_rate_get_mrr(struct ath_softc *sc, s
+               struct minstrel_node *sn = ATH_NODE_MINSTREL(an);
+               int rc1, rc2, rc3;         /* Index into the rate table, so for example, it is  0..11 */
++              if (sn->num_rates <= 0)
++                      return;
++
+               if (sn->is_sampling) {
+                       sn->is_sampling = 0;
+                       if (sn->rs_sample_rate_slower)
diff --git a/net/madwifi/patches/113-no_ibss_pwrsave.patch b/net/madwifi/patches/113-no_ibss_pwrsave.patch
new file mode 100644 (file)
index 0000000..af23ceb
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -291,7 +291,8 @@ scan_restart_pwrsav(unsigned long arg)
+       struct ieee80211com *ic = vap->iv_ic;
+       int delay;
+-      ieee80211_sta_pwrsave(vap, 1);
++      if (vap->iv_opmode != IEEE80211_M_IBSS)
++          ieee80211_sta_pwrsave(vap, 1);
+       /*
+        * Use an initial 1ms delay to ensure the null
+        * data frame has a chance to go out.
diff --git a/net/madwifi/patches/122-replayfail_workaround.patch b/net/madwifi/patches/122-replayfail_workaround.patch
new file mode 100644 (file)
index 0000000..c4eb28c
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -331,6 +331,9 @@ ieee80211_notify_replay_failure(struct i
+               k->wk_cipher->ic_name, k->wk_keyix,
+               (unsigned long long)rsc);
++      /* disabled for now due to bogus events for unknown reasons */
++      return;
++
+       /* TODO: needed parameters: count, keyid, key type, src address, TSC */
+       snprintf(buf, sizeof(buf), "%s(keyid=%d %scast addr=" MAC_FMT ")", tag,
+               k->wk_keyix,
diff --git a/net/madwifi/patches/123-ccmp_checks.patch b/net/madwifi/patches/123-ccmp_checks.patch
new file mode 100644 (file)
index 0000000..d9a0ad4
--- /dev/null
@@ -0,0 +1,95 @@
+--- a/net80211/ieee80211_crypto_ccmp.c
++++ b/net80211/ieee80211_crypto_ccmp.c
+@@ -115,6 +115,7 @@ ccmp_attach(struct ieee80211vap *vap, st
+ /* This function (crypto_alloc_foo might sleep. Therefore:
+  * Context: process
+  */
++#ifdef CONFIG_CRYPTO
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+       ctx->cc_tfm = crypto_alloc_tfm("aes", 0);
+ #else
+@@ -123,7 +124,8 @@ ccmp_attach(struct ieee80211vap *vap, st
+       if (IS_ERR(ctx->cc_tfm))
+               ctx->cc_tfm = NULL;
+ #endif
+-      
++#endif
++
+       if (ctx->cc_tfm == NULL) {
+               IEEE80211_DPRINTF(vap, IEEE80211_MSG_CRYPTO,
+                               "%s: unable to load kernel AES crypto support\n",
+@@ -138,12 +140,14 @@ ccmp_detach(struct ieee80211_key *k)
+ {
+       struct ccmp_ctx *ctx = k->wk_private;
++#ifdef CONFIG_CRYPTO
+       if (ctx->cc_tfm != NULL)
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+               crypto_free_tfm(ctx->cc_tfm);
+ #else
+               crypto_free_cipher(ctx->cc_tfm);
+ #endif
++#endif
+       FREE(ctx, M_DEVBUF);
+       _MOD_DEC_USE(THIS_MODULE);
+@@ -169,7 +173,9 @@ ccmp_setkey(struct ieee80211_key *k)
+                       return 0;
+               }
++#ifdef CONFIG_CRYPTO
+               crypto_cipher_setkey(ctx->cc_tfm, k->wk_key, k->wk_keylen);
++#endif
+       }
+       return 1;
+@@ -324,6 +330,7 @@ xor_block(u8 *b, const u8 *a, size_t len
+ static void
+ rijndael_encrypt(struct crypto_cipher *tfm, const void *src, void *dst)
+ {
++#ifdef CONFIG_CRYPTO
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+       crypto_cipher_encrypt_one(tfm, dst, src);
+ #else
+@@ -339,6 +346,7 @@ rijndael_encrypt(struct crypto_cipher *t
+       sg_dst.length = AES_BLOCK_LEN;
+       crypto_cipher_encrypt(tfm, &sg_dst, &sg_src, AES_BLOCK_LEN);
+ #endif
++#endif
+ }
+ /*
+@@ -475,6 +483,9 @@ ccmp_encrypt(struct ieee80211_key *key, 
+       uint8_t *mic, *pos;
+       u_int space;
++      if (ctx->cc_tfm == NULL)
++              return 0;
++
+       ctx->cc_vap->iv_stats.is_crypto_ccmp++;
+       skb = skb0;
+@@ -589,6 +600,9 @@ ccmp_decrypt(struct ieee80211_key *key, 
+       uint8_t *pos, *mic;
+       u_int space;
++      if (ctx->cc_tfm == NULL)
++              return 0;
++
+       ctx->cc_vap->iv_stats.is_crypto_ccmp++;
+       skb = skb0;
+--- a/Makefile
++++ b/Makefile
+@@ -192,11 +192,4 @@ endif
+           exit 1; \
+       fi
+       
+-      @# check crypto support is enabled
+-      @if [ -z "$(CONFIG_CRYPTO)" ]; then \
+-          echo "FAILED"; \
+-          echo "Please enable crypto API."; \
+-          exit 1; \
+-      fi
+-      
+       @echo "ok."
diff --git a/net/madwifi/patches/124-linux24_compat.patch b/net/madwifi/patches/124-linux24_compat.patch
new file mode 100644 (file)
index 0000000..88601a4
--- /dev/null
@@ -0,0 +1,202 @@
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -126,6 +126,11 @@ typedef void irqreturn_t;
+ #define ATH_GET_NETDEV_DEV(ndev)      ((ndev)->class_dev.dev)
+ #endif
++#ifndef NETDEV_TX_OK
++#define NETDEV_TX_OK    0
++#define NETDEV_TX_BUSY  1
++#endif
++
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
+ static inline struct net_device *_alloc_netdev(int sizeof_priv, const char *mask,
+                                              void (*setup)(struct net_device *))
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
+@@ -92,6 +92,13 @@
+ #define nofloat_pct(_value, _pct) \
+       ( (_value * (1000 + _pct)) / 1000 )
++#ifndef list_for_each_entry_reverse
++#define list_for_each_entry_reverse(pos, head, member)                        \
++      for (pos = list_entry((head)->prev, typeof(*pos), member);      \
++           prefetch(pos->member.prev), &pos->member != (head);        \
++           pos = list_entry(pos->member.prev, typeof(*pos), member))
++#endif
++
+ struct radar_pattern_specification {
+       /* The name of the rule/specification (i.e. what did we detect) */
+       const char *name;
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -4705,6 +4705,46 @@ ath_beacon_setup(struct ath_softc *sc, s
+ #undef USE_SHPREAMBLE
+ }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
++static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
++{
++      int ret;
++      unsigned long flags;
++
++      local_irq_save(flags);
++      ret = v->counter;
++      if (likely(ret == old))
++              v->counter = new;
++      local_irq_restore(flags);
++
++      return ret;
++}
++
++/**
++ * atomic_add_unless - add unless the number is a given value
++ * @v: pointer of type atomic_t
++ * @a: the amount to add to v...
++ * @u: ...unless v is equal to u.
++ *
++ * Atomically adds @a to @v, so long as it was not @u.
++ * Returns non-zero if @v was not @u, and zero otherwise.
++ */
++static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
++{
++      int c, old;
++      c = atomic_read(v);
++      for (;;) {
++              if (unlikely(c == (u)))
++                      break;
++              old = atomic_cmpxchg((v), c, c + (a));
++              if (likely(old == c))
++                      break;
++              c = old;
++      }
++      return c != (u);
++}
++#endif
++
+ /*
+  * Generate beacon frame and queue cab data for a VAP.
+  */
+--- /dev/null
++++ b/net80211/sort.c
+@@ -0,0 +1,120 @@
++/*
++ * A fast, small, non-recursive O(nlog n) sort for the Linux kernel
++ *
++ * Jan 23 2005  Matt Mackall <mpm@selenic.com>
++ */
++
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/slab.h>
++
++static void u32_swap(void *a, void *b, int size)
++{
++      u32 t = *(u32 *)a;
++      *(u32 *)a = *(u32 *)b;
++      *(u32 *)b = t;
++}
++
++static void generic_swap(void *a, void *b, int size)
++{
++      char t;
++
++      do {
++              t = *(char *)a;
++              *(char *)a++ = *(char *)b;
++              *(char *)b++ = t;
++      } while (--size > 0);
++}
++
++/**
++ * sort - sort an array of elements
++ * @base: pointer to data to sort
++ * @num: number of elements
++ * @size: size of each element
++ * @cmp: pointer to comparison function
++ * @swap: pointer to swap function or NULL
++ *
++ * This function does a heapsort on the given array. You may provide a
++ * swap function optimized to your element type.
++ *
++ * Sorting time is O(n log n) both on average and worst-case. While
++ * qsort is about 20% faster on average, it suffers from exploitable
++ * O(n*n) worst-case behavior and extra memory requirements that make
++ * it less suitable for kernel use.
++ */
++
++static void sort(void *base, size_t num, size_t size,
++        int (*cmp)(const void *, const void *),
++        void (*swap)(void *, void *, int size))
++{
++      /* pre-scale counters for performance */
++      int i = (num/2 - 1) * size, n = num * size, c, r;
++
++      if (!swap)
++              swap = (size == 4 ? u32_swap : generic_swap);
++
++      /* heapify */
++      for ( ; i >= 0; i -= size) {
++              for (r = i; r * 2 + size < n; r  = c) {
++                      c = r * 2 + size;
++                      if (c < n - size && cmp(base + c, base + c + size) < 0)
++                              c += size;
++                      if (cmp(base + r, base + c) >= 0)
++                              break;
++                      swap(base + r, base + c, size);
++              }
++      }
++
++      /* sort */
++      for (i = n - size; i >= 0; i -= size) {
++              swap(base, base + i, size);
++              for (r = 0; r * 2 + size < i; r = c) {
++                      c = r * 2 + size;
++                      if (c < i - size && cmp(base + c, base + c + size) < 0)
++                              c += size;
++                      if (cmp(base + r, base + c) >= 0)
++                              break;
++                      swap(base + r, base + c, size);
++              }
++      }
++}
++
++EXPORT_SYMBOL(sort);
++
++#if 0
++/* a simple boot-time regression test */
++
++int cmpint(const void *a, const void *b)
++{
++      return *(int *)a - *(int *)b;
++}
++
++static int sort_test(void)
++{
++      int *a, i, r = 1;
++
++      a = kmalloc(1000 * sizeof(int), GFP_KERNEL);
++      BUG_ON(!a);
++
++      printk("testing sort()\n");
++
++      for (i = 0; i < 1000; i++) {
++              r = (r * 725861) % 6599;
++              a[i] = r;
++      }
++
++      sort(a, 1000, sizeof(int), cmpint, NULL);
++
++      for (i = 0; i < 999; i++)
++              if (a[i] > a[i+1]) {
++                      printk("sort() failed!\n");
++                      break;
++              }
++
++      kfree(a);
++
++      return 0;
++}
++
++module_init(sort_test);
++#endif
diff --git a/net/madwifi/patches/126-rxerr_frames.patch b/net/madwifi/patches/126-rxerr_frames.patch
new file mode 100644 (file)
index 0000000..762a7bc
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6474,8 +6474,9 @@ ath_rx_tasklet(TQUEUE_ARG data)
+                       /*
+                        * Reject error frames if we have no vaps that
+                        * are operating in monitor mode.
++                       * Reject empty frames as well
+                        */
+-                      if (sc->sc_nmonvaps == 0)
++                      if ((sc->sc_nmonvaps == 0) || (rs->rs_datalen == 0))
+                               goto rx_next;
+               }
+ rx_accept:
diff --git a/net/madwifi/patches/200-no_debug.patch b/net/madwifi/patches/200-no_debug.patch
new file mode 100644 (file)
index 0000000..d5f285c
--- /dev/null
@@ -0,0 +1,408 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -42,7 +42,6 @@
+  * This software is derived from work of Atsushi Onoe; his contribution
+  * is greatly appreciated.
+  */
+-#define       AR_DEBUG
+ #include "if_ath_debug.h"
+ #include "opt_ah.h"
+@@ -368,8 +367,10 @@ static unsigned int ath_get_dfs_cac_time
+ static void ath_set_dfs_cac_time(struct ieee80211com *, unsigned int seconds);
+ static unsigned int ath_test_radar(struct ieee80211com *);
+-static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
++#ifdef AR_DEBUG
++static unsigned int ath_dump_hal_map(struct ieee80211com *ic);
++#endif
+ static u_int32_t ath_get_clamped_maxtxpower(struct ath_softc *sc);
+ static u_int32_t ath_set_clamped_maxtxpower(struct ath_softc *sc, 
+               u_int32_t new_clamped_maxtxpower);
+@@ -520,9 +521,11 @@ ath_attach(u_int16_t devid, struct net_d
+       u_int8_t csz;
+       sc->devid = devid;
++#ifdef AR_DEBUG
+       ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
+       sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
+       DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
++#endif
+       /* Allocate space for dynamically determined maximum VAP count */
+       sc->sc_bslot = 
+@@ -1038,8 +1041,9 @@ ath_attach(u_int16_t devid, struct net_d
+       ic->ic_vap_delete = ath_vap_delete;
+       ic->ic_test_radar           = ath_test_radar;
++#ifdef AR_DEBUG
+       ic->ic_dump_hal_map         = ath_dump_hal_map;
+-
++#endif
+       ic->ic_set_dfs_testmode     = ath_set_dfs_testmode;
+       ic->ic_get_dfs_testmode     = ath_get_dfs_testmode;
+@@ -1297,12 +1301,14 @@ ath_vap_create(struct ieee80211com *ic, 
+               /* If no default VAP debug flags are passed, allow a few to
+                * transfer down from the driver to new VAPs so we can have load
+                * time debugging for VAPs too. */
++#ifdef AR_DEBUG
+               vap->iv_debug = 0 |
+                       ((sc->sc_debug & ATH_DEBUG_RATE) ? IEEE80211_MSG_XRATE  : 0) | 
+                       ((sc->sc_debug & ATH_DEBUG_XMIT) ? IEEE80211_MSG_OUTPUT : 0) | 
+                       ((sc->sc_debug & ATH_DEBUG_RECV) ? IEEE80211_MSG_INPUT  : 0) |
+                       0
+                       ;
++#endif
+       }
+       ic->ic_debug = (sc->sc_default_ieee80211_debug & IEEE80211_MSG_IC);
+@@ -10496,9 +10502,11 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                               /* XXX validate? */
+                               sc->sc_ledpin = val;
+                               break;
++#ifdef AR_DEBUG
+                       case ATH_DEBUG:
+                               sc->sc_debug     = (val & ~ATH_DEBUG_GLOBAL);
+                               ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
++#endif
+                               break;
+                       case ATH_TXANTENNA:
+                               /*
+@@ -10918,9 +10926,11 @@ ath_dynamic_sysctl_register(struct ath_s
+       }
+       /* initialize values */
++#ifdef AR_DEBUG
+       ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
+       sc->sc_debug     = (ath_debug & ~ATH_DEBUG_GLOBAL);
+       sc->sc_default_ieee80211_debug = ieee80211_debug;
++#endif
+       sc->sc_txantenna = 0;           /* default to auto-selection */
+       sc->sc_txintrperiod = ATH_TXQ_INTR_PERIOD;
+ }
+@@ -11762,6 +11772,7 @@ ath_test_radar(struct ieee80211com *ic)
+ }
+ /* This is called by a private ioctl (iwpriv) to dump the HAL obfuscation table */
++#ifdef AR_DEBUG
+ static unsigned int
+ ath_dump_hal_map(struct ieee80211com *ic)
+ {
+@@ -11770,7 +11781,7 @@ ath_dump_hal_map(struct ieee80211com *ic
+       ath_hal_dump_map(sc->sc_ah);
+       return 0;
+ }
+-
++#endif
+ /* If we are shutting down or blowing off the DFS channel availability check
+  * then we call this to stop the behavior before we take the rest of the
+  * necessary actions (such as a DFS reaction to radar). */
+--- a/ath_rate/amrr/amrr.c
++++ b/ath_rate/amrr/amrr.c
+@@ -70,7 +70,9 @@
+ #include "amrr.h"
++#ifdef AR_DEBUG
+ #define       AMRR_DEBUG
++#endif
+ #ifdef AMRR_DEBUG
+ #define       DPRINTF(sc, _fmt, ...) do {                                     \
+       if (sc->sc_debug & 0x10)                                        \
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -117,7 +117,9 @@
+ #include "minstrel.h"
++#ifdef AR_DEBUG
+ #define       MINSTREL_DEBUG
++#endif
+ #ifdef MINSTREL_DEBUG
+ enum {
+               ATH_DEBUG_RATE          = 0x00000010    /* rate control */
+--- a/ath_rate/onoe/onoe.c
++++ b/ath_rate/onoe/onoe.c
+@@ -66,7 +66,9 @@
+ #include "onoe.h"
++#ifdef AR_DEBUG
+ #define       ONOE_DEBUG
++#endif
+ #ifdef ONOE_DEBUG
+ enum {
+       ATH_DEBUG_RATE  = 0x00000010,   /* rate control */
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -68,7 +68,9 @@
+ #include "sample.h"
+-#define       SAMPLE_DEBUG
++#ifdef AR_DEBUG
++#define SAMPLE_DEBUG
++#endif
+ #ifdef SAMPLE_DEBUG
+ enum {
+       ATH_DEBUG_RATE          = 0x00000010,   /* rate control */
+--- a/tools/do_multi.c
++++ b/tools/do_multi.c
+@@ -10,16 +10,20 @@ main(int argc, char *argv[])
+     progname = basename(argv[0]);
++#ifdef AR_DEBUG
+     if(strcmp(progname, "80211debug") == 0)
+       ret = a80211debug_init(argc, argv);
++#endif
+     if(strcmp(progname, "80211stats") == 0)
+       ret = a80211stats_init(argc, argv);
+     if(strcmp(progname, "athchans") == 0)
+       ret = athchans_init(argc, argv);
+     if(strcmp(progname, "athctrl") == 0)
+       ret =  athctrl_init(argc, argv);
++#ifdef AR_DEBUG
+     if(strcmp(progname, "athdebug") == 0)
+       ret =  athdebug_init(argc, argv);
++#endif
+     if(strcmp(progname, "athkey") == 0)
+       ret =  athkey_init(argc, argv);
+     if(strcmp(progname, "athstats") == 0)
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -48,14 +48,16 @@ endif
+ all: compile
++DEBUG = -DAR_DEBUG
++
+ ALLPROGS=     athstats 80211stats athkey athchans athctrl \
+-      athdebug 80211debug wlanconfig ath_info
++      $(if $(DEBUG),athdebug 80211debug) wlanconfig ath_info
+ OBJS= $(patsubst %,%.o,$(ALLPROGS))
+ INCS= -I. -I../ath -I$(HAL) -I$(TOP) -I$(ATH_HAL)
+ CFLAGS=       -g -O2 -Wall
+-ALL_CFLAGS= $(CFLAGS) $(INCS)
++ALL_CFLAGS= $(CFLAGS) $(INCS) $(DEBUG)
+ LDFLAGS=
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -29,8 +29,6 @@
+ #ifndef _NET80211_IEEE80211_LINUX_H_
+ #define _NET80211_IEEE80211_LINUX_H_
+-#define       IEEE80211_DEBUG
+-#define       IEEE80211_DEBUG_REFCNT                  /* Node reference count debugging */
+ /* #define ATH_DEBUG_SPINLOCKS */             /* announce before spinlocking */
+ #include <linux/wireless.h>
+--- a/Makefile.inc
++++ b/Makefile.inc
+@@ -147,8 +147,9 @@ ATH_RATE=  $(TOP)/ath_rate
+ # 
+ TOOLS=  $(TOP)/tools 
+-WARNINGS = -Werror
+-COPTS+= $(WARNINGS)
++WARNINGS = -Wno-unused
++# DEBUG = -DAR_DEBUG -DIEEE80211_DEBUG
++COPTS+= $(WARNINGS) $(DEBUG)
+ INCS= -include $(TOP)/include/compat.h -I$(TOP)/include
+ # TARGET defines the target platform architecture. It must match one of
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
+@@ -19,8 +19,6 @@
+  * $Id: if_ath_radar.c 2464 2007-06-15 22:51:56Z mtaylor $
+  */
+ #include "opt_ah.h"
+-
+-#define       AR_DEBUG
+ #include "if_ath_debug.h"
+ #ifndef AUTOCONF_INCLUDED
+@@ -56,8 +54,6 @@
+ #include <net80211/if_llc.h>
+ #endif
+-#define       AR_DEBUG
+-
+ #include "net80211/if_athproto.h"
+ #include "if_athvar.h"
+--- a/ath/if_ath_hal.h
++++ b/ath/if_ath_hal.h
+@@ -1081,6 +1081,7 @@ static inline HAL_BOOL ath_hal_disable(s
+            tail -f /var/log/messages | sed -f hal_unmangle.sed 
+  */
++#ifdef AR_DEBUG
+ static inline void ath_hal_dump_map(struct ath_hal *ah)
+ {
+ #ifdef CONFIG_KALLSYMS
+@@ -1345,7 +1346,7 @@ static inline void ath_hal_dump_map(stru
+ #endif                                /* #ifndef CONFIG_KALLSYMS */
+ }
+-
++#endif
+ #include "if_ath_hal_wrappers.h"
+ #endif                                /* #ifndef _IF_ATH_HAL_H_ */
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -492,9 +492,10 @@ struct ieee80211com {
+       /* inject a fake radar signal -- used while on a 802.11h DFS channels */
+       unsigned int (*ic_test_radar)(struct ieee80211com *);
++#ifdef AR_DEBUG
+       /* dump HAL */
+       unsigned int (*ic_dump_hal_map)(struct ieee80211com *);
+-
++#endif
+       /* DFS channel availability check time (in seconds) */
+       void (*ic_set_dfs_cac_time)(struct ieee80211com *, unsigned int);
+       unsigned int (*ic_get_dfs_cac_time)(struct ieee80211com *);
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -1548,6 +1548,7 @@ ieee80211_get_txcont_power(struct net_de
+       return 0;
+ }
++#ifdef AR_DEBUG
+ static int 
+ ieee80211_ioctl_hal_map(struct net_device *dev, struct iw_request_info *info,
+        void *w, char *extra)
+@@ -1558,7 +1559,7 @@ ieee80211_ioctl_hal_map(struct net_devic
+        params[0] = ic->ic_dump_hal_map(ic);
+        return 0;
+ }
+-
++#endif
+ static int
+ ieee80211_ioctl_radar(struct net_device *dev, struct iw_request_info *info,
+@@ -5258,8 +5259,10 @@ static const struct iw_priv_args ieee802
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,   "getwmmparams" },
+       { IEEE80211_IOCTL_RADAR,
+         0, 0, "doth_radar" },
++#ifdef AR_DEBUG
+       { IEEE80211_IOCTL_HALMAP,
+         0, 0, "dump_hal_map" },
++#endif
+       /*
+        * These depends on sub-ioctl support which added in version 12.
+        */
+@@ -5695,7 +5698,9 @@ static const iw_handler ieee80211_priv_h
+       set_priv(IEEE80211_IOCTL_SETMLME, ieee80211_ioctl_setmlme),
+       set_priv(IEEE80211_IOCTL_SETKEY, ieee80211_ioctl_setkey),
+       set_priv(IEEE80211_IOCTL_DELKEY, ieee80211_ioctl_delkey),
++#ifdef AR_DEBUG
+       set_priv(IEEE80211_IOCTL_HALMAP, ieee80211_ioctl_hal_map),
++#endif
+       set_priv(IEEE80211_IOCTL_ADDMAC, ieee80211_ioctl_addmac),
+       set_priv(IEEE80211_IOCTL_DELMAC, ieee80211_ioctl_delmac),
+       set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
+--- a/ath/if_ath_debug.h
++++ b/ath/if_ath_debug.h
+@@ -54,6 +54,10 @@ enum {
+       ATH_DEBUG_GLOBAL        = (ATH_DEBUG_SKB|ATH_DEBUG_SKB_REF)
+ };
++#define       EPRINTF(_sc, _fmt, ...) \
++              printk(KERN_ERR "%s: %s: " _fmt, \
++                      SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
++
+ #ifdef AR_DEBUG
+ /* DEBUG-ONLY DEFINITIONS */
+@@ -68,20 +72,9 @@ enum {
+               ath_keyprint((_sc), __func__, _ix, _hk, _mac);          \
+ } while (0)
+-#else /* #ifdef AR_DEBUG */
+-
+-#define       DFLAG_ISSET(sc, _m)             0
+-#define       DPRINTF(sc, _m, _fmt, ...)
+-#define       KEYPRINTF(sc, k, ix, mac)
+-
+-#endif /* #ifdef AR_DEBUG */
+ #define       IFF_DUMPPKTS(_sc, _m)   DFLAG_ISSET((_sc), (_m))
+-#define       EPRINTF(_sc, _fmt, ...) \
+-              printk(KERN_ERR "%s: %s: " _fmt, \
+-                      SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
+-
+ #define       WPRINTF(_sc, _fmt, ...) \
+               printk(KERN_WARNING "%s: %s: " _fmt, \
+                       SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
+@@ -89,5 +82,14 @@ enum {
+ #define       IPRINTF(_sc, _fmt, ...) \
+               printk(KERN_INFO "%s: %s: " _fmt, \
+                       SC_DEV_NAME(_sc), __func__, ## __VA_ARGS__)
++#else
++#define       DFLAG_ISSET(sc, _m)             0
++#define       DPRINTF(sc, _m, _fmt, ...)
++#define       KEYPRINTF(sc, k, ix, mac)
++#define WPRINTF(...)
++#define IPRINTF(...)
++#define IFF_DUMPPKTS(...) 0
++
++#endif
+ #endif /* #ifndef _IF_ATH_DEBUG_H_ */
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -920,6 +920,9 @@ node_cleanup(struct ieee80211_node *ni)
+       ni->ni_rxkeyoff = 0;
+ }
++#ifndef IEEE80211_DEBUG
++#define node_print_message(...) do {} while(0)
++#else
+ static void node_print_message(
+               u_int32_t flags,
+               int show_counter, 
+@@ -972,7 +975,7 @@ static void node_print_message(
+                       adjusted_refcount);
+       va_end(args);
+ }
+-EXPORT_SYMBOL(node_print_message);
++#endif
+ static void
+ #ifdef IEEE80211_DEBUG_REFCNT
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -134,8 +134,10 @@ ath_pci_probe(struct pci_dev *pdev, cons
+       u16 vdevice;
+       int i;
+-      if (pci_enable_device(pdev))
++      if (pci_enable_device(pdev)) {
++              printk(KERN_ERR "%s: failed to enable PCI device\n", dev_info);
+               return -EIO;
++      }
+       /* XXX 32-bit addressing only */
+       if (pci_set_dma_mask(pdev, 0xffffffff)) {
+@@ -244,8 +246,10 @@ ath_pci_probe(struct pci_dev *pdev, cons
+               sc->aps_sc.sc_ledpin = 1;
+       }
+-      if (ath_attach(vdevice, dev, NULL) != 0)
++      if ((i = ath_attach(vdevice, dev, NULL)) != 0) {
++              printk(KERN_ERR "%s: ath_attach failed: %d\n", dev_info, i);
+               goto bad4;
++      }
+       athname = ath_hal_probe(id->vendor, vdevice);
+       printk(KERN_INFO "%s: %s: %s: mem=0x%lx, irq=%d\n",
diff --git a/net/madwifi/patches/201-debug_fix.patch b/net/madwifi/patches/201-debug_fix.patch
new file mode 100644 (file)
index 0000000..bcfbba8
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
+@@ -65,7 +65,7 @@
+ #include <ah_os.h>
+ #ifdef AH_DEBUG
+-static        int ath_hal_debug = 0;
++static        int ath_hal_debug = 99;
+ #endif
+ int   ath_hal_dma_beacon_response_time = 2;   /* in TUs */
+@@ -327,6 +327,8 @@ EXPORT_SYMBOL(OS_MARK);
+  * useful for debugging and figuring out, which hal function sets which 
+  * registers */
+ char *ath_hal_func = NULL;
++EXPORT_SYMBOL(ath_hal_func);
++
+ #endif
+ /*
diff --git a/net/madwifi/patches/202-debug_variables.patch b/net/madwifi/patches/202-debug_variables.patch
new file mode 100644 (file)
index 0000000..041344f
--- /dev/null
@@ -0,0 +1,204 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -453,8 +453,8 @@ MODULE_PARM_DESC(autocreate, "Create ath
+ MODULE_PARM_DESC(ratectl, "Rate control algorithm [amrr|minstrel|onoe|sample], "
+               "defaults to '" DEF_RATE_CTL "'");
+-static int    ath_debug = 0;
+ #ifdef AR_DEBUG
++static int    ath_debug = 0;
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+ MODULE_PARM(ath_debug, "i");
+ #else
+@@ -465,8 +465,8 @@ static void ath_printrxbuf(const struct 
+ static void ath_printtxbuf(const struct ath_buf *, int);
+ #endif /* defined(AR_DEBUG) */
+-static int    ieee80211_debug = 0;
+ #ifdef AR_DEBUG
++static int    ieee80211_debug = 0;
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+ MODULE_PARM(ieee80211_debug, "i");
+ #else
+@@ -1565,7 +1565,9 @@ ath_vap_delete(struct ieee80211vap *vap)
+ void
+ ath_suspend(struct net_device *dev)
+ {
++#ifdef AR_DEBUG
+       struct ath_softc *sc = dev->priv;
++#endif
+       DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
+       ath_stop(dev);
+@@ -1574,7 +1576,9 @@ ath_suspend(struct net_device *dev)
+ void
+ ath_resume(struct net_device *dev)
+ {
++#ifdef AR_DEBUG
+       struct ath_softc *sc = dev->priv;
++#endif
+       DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
+       ath_init(dev);
+@@ -4019,7 +4023,9 @@ static void
+ ath_key_update_begin(struct ieee80211vap *vap)
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
++#ifdef AR_DEBUG
+       struct ath_softc *sc = dev->priv;
++#endif
+       DPRINTF(sc, ATH_DEBUG_KEYCACHE, "Begin\n");
+       /*
+@@ -4040,7 +4046,9 @@ static void
+ ath_key_update_end(struct ieee80211vap *vap)
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
++#ifdef AR_DEBUG
+       struct ath_softc *sc = dev->priv;
++#endif
+       DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
+       netif_wake_queue(dev);
+@@ -6218,7 +6226,9 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+       struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf)
+ {
+       struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
++#ifdef AR_DEBUG
+         struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
++#endif
+       struct ieee80211_node * ni = ni_or_null;
+       u_int64_t hw_tsf, beacon_tsf;
+       u_int32_t hw_tu, beacon_tu, intval;
+@@ -8382,7 +8392,9 @@ ath_tx_timeout(struct net_device *dev)
+ static void
+ ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
+ {
++#ifdef AR_DEBUG
+       struct ath_hal *ah = sc->sc_ah;
++#endif
+       struct ath_buf *bf;
+       /*
+        * NB: this assumes output has been stopped and
+@@ -11002,6 +11014,7 @@ ath_announce(struct net_device *dev)
+               strncat(m, b, MLEN);
+       }
+       strncat(m, "\n", MLEN);
++#ifdef AR_DEBUG
+       if (1 /* bootverbose */) {
+               unsigned int i;
+               for (i = 0; i <= WME_AC_VO; i++) {
+@@ -11014,6 +11027,7 @@ ath_announce(struct net_device *dev)
+                       sc->sc_cabq->axq_qnum);
+               IPRINTF(sc, "Use hw queue %u for beacons\n", sc->sc_bhalq);
+       }
++#endif
+ #undef HAL_MODE_DUALBAND
+ }
+  
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
+@@ -156,7 +156,9 @@ static struct radar_pattern_specificatio
+ #endif
+ };
++#ifdef AR_DEBUG
+ static u_int32_t interval_to_frequency(u_int32_t pri);
++#endif
+ /* Returns true if radar detection is enabled. */
+ int ath_radar_is_enabled(struct ath_softc *sc)
+@@ -229,7 +231,9 @@ int ath_radar_update(struct ath_softc *s
+ {
+       struct ath_hal *ah = sc->sc_ah;
++#ifdef AR_DEBUG
+       struct net_device *dev = sc->sc_dev;
++#endif
+       struct ieee80211com *ic = &sc->sc_ic;
+       int required = 0;
+@@ -366,6 +370,7 @@ static struct ath_rp *pulse_prev(struct 
+ #define MR_FAIL_MIN_PERIOD    4
+ #define MR_FAIL_MAX_PERIOD    5
++#ifdef AR_DEBUG
+ static const char* get_match_result_desc(u_int32_t code) {
+       switch (code) {
+       case MR_MATCH:
+@@ -384,6 +389,7 @@ static const char* get_match_result_desc
+               return "unknown";
+       }
+ }
++#endif
+ static int32_t match_radar(
+       u_int32_t matched, 
+@@ -775,7 +781,10 @@ static HAL_BOOL rp_analyse_short_pulse(
+       struct ath_softc *sc, struct ath_rp *last_pulse, 
+       u_int32_t *index, u_int32_t *pri, u_int32_t *matching_pulses, 
+       u_int32_t *missed_pulses, u_int32_t *noise_pulses)
+-{ struct net_device *dev = sc->sc_dev;
++{
++#ifdef AR_DEBUG
++      struct net_device *dev = sc->sc_dev;
++#endif
+       int i;
+       int best_index = -1;
+       unsigned int best_matched = 0;
+@@ -1217,6 +1226,7 @@ static HAL_BOOL rp_analyse_short_pulse(
+       return (-1 != best_index) ? AH_TRUE : AH_FALSE;
+ }
++#ifdef AR_DEBUG
+ static u_int32_t interval_to_frequency(u_int32_t interval)
+ {
+       /* Calculate BRI from PRI */
+@@ -1224,6 +1234,7 @@ static u_int32_t interval_to_frequency(u
+       /* Round to nearest multiple of 50 */
+       return frequency + ((frequency % 50) >= 25 ? 50 : 0) - (frequency % 50);
+ }
++#endif
+ #ifdef ATH_RADAR_LONG_PULSE
+ static const char* get_longpulse_desc(int lp) {
+@@ -1580,7 +1591,9 @@ void ath_rp_done(struct ath_softc *sc)
+ void ath_rp_record(struct ath_softc *sc, u_int64_t tsf, u_int8_t rssi, 
+                           u_int8_t width, HAL_BOOL is_simulated)
+ {
++#ifdef AR_DEBUG
+       struct net_device *dev = sc->sc_dev;
++#endif
+       struct ath_rp *pulse;
+       DPRINTF(sc, ATH_DEBUG_DOTHPULSES, "%s: ath_rp_record: "
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -931,7 +931,9 @@ ath_proc_read_nodes(struct ieee80211vap 
+                           (struct ieee80211_node_table *) &vap->iv_ic->ic_sta;
+               unsigned int x = 0;
+               unsigned int this_tp, this_prob, this_eprob;
++#ifdef AR_DEBUG
+                       struct ath_softc *sc = vap->iv_ic->ic_dev->priv;;
++#endif
+               IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+               TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -731,6 +731,7 @@ pick_channel(struct ieee80211_scan_state
+       sort(chans, ss_last, sizeof(*chans), pc_cmp, pc_swap);
++#ifdef IEEE80211_DEBUG
+       for (i = 0; i < ss_last; i++) {
+               int chan = ieee80211_chan2ieee(ic, chans[i].chan);
+@@ -742,6 +743,7 @@ pick_channel(struct ieee80211_scan_state
+                               !!IEEE80211_ARE_CHANS_SAME_MODE(chans[i].chan, 
+                                       ic->ic_bsschan));
+       }
++#endif
+       best = NULL;
+       best_rssi = 0xff; /* If signal is bigger than 0xff, we'd be melting. */
diff --git a/net/madwifi/patches/300-napi_polling.patch b/net/madwifi/patches/300-napi_polling.patch
new file mode 100644 (file)
index 0000000..bc62d7b
--- /dev/null
@@ -0,0 +1,536 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -184,7 +184,11 @@ static void ath_recv_mgmt(struct ieee802
+       struct sk_buff *, int, int, u_int64_t);
+ static void ath_setdefantenna(struct ath_softc *, u_int);
+ static struct ath_txq *ath_txq_setup(struct ath_softc *, int, int);
+-static void ath_rx_tasklet(TQUEUE_ARG);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++static int ath_rx_poll(struct napi_struct *napi, int budget);
++#else
++static int ath_rx_poll(struct net_device *dev, int *budget);
++#endif
+ static int ath_hardstart(struct sk_buff *, struct net_device *);
+ static int ath_mgtstart(struct ieee80211com *, struct sk_buff *);
+ #ifdef ATH_SUPERG_COMP
+@@ -376,6 +380,9 @@ static u_int32_t ath_set_clamped_maxtxpo
+               u_int32_t new_clamped_maxtxpower);
+ static u_int32_t ath_get_real_maxtxpower(struct ath_softc *sc);
++static void ath_poll_disable(struct net_device *dev);
++static void ath_poll_enable(struct net_device *dev);
++
+ /* calibrate every 30 secs in steady state but check every second at first. */
+ static int ath_calinterval = ATH_SHORT_CALINTERVAL;
+ static int ath_countrycode = CTRY_DEFAULT;    /* country code */
+@@ -547,7 +554,6 @@ ath_attach(u_int16_t devid, struct net_d
+       atomic_set(&sc->sc_txbuf_counter, 0);
+-      ATH_INIT_TQUEUE(&sc->sc_rxtq,     ath_rx_tasklet,       dev);
+       ATH_INIT_TQUEUE(&sc->sc_txtq,     ath_tx_tasklet,       dev);
+       ATH_INIT_TQUEUE(&sc->sc_bmisstq,  ath_bmiss_tasklet,    dev);
+       ATH_INIT_TQUEUE(&sc->sc_bstucktq, ath_bstuck_tasklet,   dev);
+@@ -821,6 +827,12 @@ ath_attach(u_int16_t devid, struct net_d
+       dev->set_mac_address = ath_set_mac_address;
+       dev->change_mtu = ath_change_mtu;
+       dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++      netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
++#else
++      dev->poll = ath_rx_poll;
++      dev->weight = 64;
++#endif
+ #ifdef USE_HEADERLEN_RESV
+       dev->hard_header_len += sizeof(struct ieee80211_qosframe) +
+                               sizeof(struct llc) +
+@@ -2220,6 +2232,7 @@ ath_intr(int irq, void *dev_id, struct p
+               (status & HAL_INT_GLOBAL)       ? " HAL_INT_GLOBAL"     : ""
+               );
++      sc->sc_isr = status;
+       status &= sc->sc_imask;                 /* discard unasked for bits */
+       /* As soon as we know we have a real interrupt we intend to service, 
+        * we will check to see if we need an initial hardware TSF reading. 
+@@ -2277,7 +2290,21 @@ ath_intr(int irq, void *dev_id, struct p
+               }
+               if (status & (HAL_INT_RX | HAL_INT_RXPHY)) {
+                       ath_uapsd_processtriggers(sc, hw_tsf);
+-                      ATH_SCHEDULE_TQUEUE(&sc->sc_rxtq, &needmark);
++                      sc->sc_isr &= ~HAL_INT_RX;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++                      if (netif_rx_schedule_prep(dev, &sc->sc_napi))
++#else
++                      if (netif_rx_schedule_prep(dev))
++#endif
++                      {
++                              sc->sc_imask &= ~HAL_INT_RX;
++                              ath_hal_intrset(ah, sc->sc_imask);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++                              __netif_rx_schedule(dev, &sc->sc_napi);
++#else
++                              __netif_rx_schedule(dev);
++#endif
++                      }
+               }
+               if (status & HAL_INT_TX) {
+ #ifdef ATH_SUPERG_DYNTURBO
+@@ -2303,6 +2330,11 @@ ath_intr(int irq, void *dev_id, struct p
+                               }
+                       }
+ #endif
++                      /* disable transmit interrupt */
++                      sc->sc_isr &= ~HAL_INT_TX;
++                      ath_hal_intrset(ah, sc->sc_imask & ~HAL_INT_TX);
++                      sc->sc_imask &= ~HAL_INT_TX;
++
+                       ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, &needmark);
+               }
+               if (status & HAL_INT_BMISS) {
+@@ -2515,6 +2547,7 @@ ath_init(struct net_device *dev)
+       if (sc->sc_tx99 != NULL)
+               sc->sc_tx99->start(sc->sc_tx99);
+ #endif
++      ath_poll_enable(dev);
+ done:
+       ATH_UNLOCK(sc);
+@@ -2555,6 +2588,9 @@ ath_stop_locked(struct net_device *dev)
+               if (sc->sc_tx99 != NULL)
+                       sc->sc_tx99->stop(sc->sc_tx99);
+ #endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++              ath_poll_disable(dev);
++#endif
+               netif_stop_queue(dev);  /* XXX re-enabled by ath_newstate */
+               dev->flags &= ~IFF_RUNNING;     /* NB: avoid recursion */
+               ieee80211_stop_running(ic);     /* stop all VAPs */
+@@ -4013,12 +4049,47 @@ ath_key_set(struct ieee80211vap *vap, co
+       return ath_keyset(sc, k, mac, vap->iv_bss);
+ }
++static void ath_poll_disable(struct net_device *dev)
++{
++      struct ath_softc *sc = dev->priv;
++
++      /*
++       * XXX Using in_softirq is not right since we might
++       * be called from other soft irq contexts than
++       * ath_rx_poll
++       */
++      if (!in_softirq()) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++              napi_disable(&sc->sc_napi);
++#else
++              netif_poll_disable(dev);
++#endif
++      }
++}
++
++static void ath_poll_enable(struct net_device *dev)
++{
++      struct ath_softc *sc = dev->priv;
++
++      /* NB: see above */
++      if (!in_softirq()) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++              napi_enable(&sc->sc_napi);
++#else
++              netif_poll_enable(dev);
++#endif
++      }
++}
++
++
+ /*
+  * Block/unblock tx+rx processing while a key change is done.
+  * We assume the caller serializes key management operations
+  * so we only need to worry about synchronization with other
+  * uses that originate in the driver.
+  */
++#define       IS_UP(_dev) \
++      (((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
+ static void
+ ath_key_update_begin(struct ieee80211vap *vap)
+ {
+@@ -4032,14 +4103,9 @@ ath_key_update_begin(struct ieee80211vap
+        * When called from the rx tasklet we cannot use
+        * tasklet_disable because it will block waiting
+        * for us to complete execution.
+-       *
+-       * XXX Using in_softirq is not right since we might
+-       * be called from other soft irq contexts than
+-       * ath_rx_tasklet.
+        */
+-      if (!in_softirq())
+-              tasklet_disable(&sc->sc_rxtq);
+-      netif_stop_queue(dev);
++      if (IS_UP(vap->iv_dev))
++              netif_stop_queue(dev);
+ }
+ static void
+@@ -4051,9 +4117,9 @@ ath_key_update_end(struct ieee80211vap *
+ #endif
+       DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
+-      netif_wake_queue(dev);
+-      if (!in_softirq())              /* NB: see above */
+-              tasklet_enable(&sc->sc_rxtq);
++
++      if (IS_UP(vap->iv_dev))
++              netif_wake_queue(dev);
+ }
+ /*
+@@ -6360,15 +6426,25 @@ ath_setdefantenna(struct ath_softc *sc, 
+       sc->sc_rxotherant = 0;
+ }
+-static void
+-ath_rx_tasklet(TQUEUE_ARG data)
++static int
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++ath_rx_poll(struct napi_struct *napi, int budget)
++#else
++ath_rx_poll(struct net_device *dev, int *budget)
++#endif
+ {
+ #define       PA2DESC(_sc, _pa) \
+       ((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
+               ((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
+-      struct net_device *dev = (struct net_device *)data;
+-      struct ath_buf *bf;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++      struct ath_softc *sc = container_of(napi, struct ath_softc, sc_napi);
++      struct net_device *dev = sc->sc_dev;
++      u_int rx_limit = budget;
++#else
+       struct ath_softc *sc = dev->priv;
++      u_int rx_limit = min(dev->quota, *budget);
++#endif
++      struct ath_buf *bf;
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc ? sc->sc_ah : NULL;
+       struct ath_desc *ds;
+@@ -6378,8 +6454,10 @@ ath_rx_tasklet(TQUEUE_ARG data)
+       unsigned int len;
+       int type;
+       u_int phyerr;
++      u_int processed = 0, early_stop = 0;
+       DPRINTF(sc, ATH_DEBUG_RX_PROC, "invoked\n");
++process_rx_again:
+       do {
+               bf = STAILQ_FIRST(&sc->sc_rxbuf);
+               if (bf == NULL) {               /* XXX ??? can this happen */
+@@ -6403,6 +6481,15 @@ ath_rx_tasklet(TQUEUE_ARG data)
+                       /* NB: never process the self-linked entry at the end */
+                       break;
+               }
++
++              if (rx_limit-- < 2) {
++                      early_stop = 1;
++                      break;
++              }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++              processed++;
++#endif
++
+               skb = bf->bf_skb;
+               if (skb == NULL) {
+                       EPRINTF(sc, "Dropping; buffer contains NULL skbuff.\n");
+@@ -6450,6 +6537,7 @@ ath_rx_tasklet(TQUEUE_ARG data)
+                               sc->sc_stats.ast_rx_phyerr++;
+                               phyerr = rs->rs_phyerr & 0x1f;
+                               sc->sc_stats.ast_rx_phy[phyerr]++;
++                              goto rx_next;
+                       }
+                       if (rs->rs_status & HAL_RXERR_DECRYPT) {
+                               /*
+@@ -6645,9 +6733,39 @@ rx_next:
+               STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list);
+               ATH_RXBUF_UNLOCK_IRQ(sc);
+       } while (ath_rxbuf_init(sc, bf) == 0);
++      if (!early_stop) {
++              unsigned long flags;
++              /* Check if more data is received while we were
++               * processing the descriptor chain.
++               */
++              local_irq_save(flags);
++              if (sc->sc_isr & HAL_INT_RX) {
++                      u_int64_t hw_tsf = ath_hal_gettsf64(ah);
++                      sc->sc_isr &= ~HAL_INT_RX;
++                      local_irq_restore(flags);
++                      ath_uapsd_processtriggers(sc, hw_tsf);
++                      goto process_rx_again;
++              }
++              local_irq_restore(flags);
++      }
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++      netif_rx_complete(dev, napi);
++#else
++      netif_rx_complete(dev);
++      *budget -= processed;
++      dev->quota -= processed;
++#endif
++      sc->sc_imask |= HAL_INT_RX;
++      ath_hal_intrset(ah, sc->sc_imask);
+       /* rx signal state monitoring */
+       ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++      return processed;
++#else
++      return early_stop;
++#endif
+ #undef PA2DESC
+ }
+@@ -8298,12 +8416,24 @@ ath_tx_tasklet_q0(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+       struct ath_softc *sc = dev->priv;
++      unsigned long flags;
++process_tx_again:
+       if (txqactive(sc->sc_ah, 0))
+               ath_tx_processq(sc, &sc->sc_txq[0]);
+       if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum))
+               ath_tx_processq(sc, sc->sc_cabq);
++      local_irq_save(flags);
++      if (sc->sc_isr & HAL_INT_TX) {
++              sc->sc_isr &= ~HAL_INT_TX;
++              local_irq_restore(flags);
++              goto process_tx_again;
++      }
++      sc->sc_imask |= HAL_INT_TX;
++      ath_hal_intrset(sc->sc_ah, sc->sc_imask);
++      local_irq_restore(flags);
++
+       netif_wake_queue(dev);
+       if (sc->sc_softled)
+@@ -8319,7 +8449,9 @@ ath_tx_tasklet_q0123(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+       struct ath_softc *sc = dev->priv;
++      unsigned long flags;
++process_tx_again:
+       /*
+        * Process each active queue.
+        */
+@@ -8340,6 +8472,16 @@ ath_tx_tasklet_q0123(TQUEUE_ARG data)
+       if (sc->sc_uapsdq && txqactive(sc->sc_ah, sc->sc_uapsdq->axq_qnum))
+               ath_tx_processq(sc, sc->sc_uapsdq);
++      local_irq_save(flags);
++      if (sc->sc_isr & HAL_INT_TX) {
++              sc->sc_isr &= ~HAL_INT_TX;
++              local_irq_restore(flags);
++              goto process_tx_again;
++      }
++      sc->sc_imask |= HAL_INT_TX;
++      ath_hal_intrset(sc->sc_ah, sc->sc_imask);
++      local_irq_restore(flags);
++
+       netif_wake_queue(dev);
+       if (sc->sc_softled)
+@@ -8355,13 +8497,25 @@ ath_tx_tasklet(TQUEUE_ARG data)
+       struct net_device *dev = (struct net_device *)data;
+       struct ath_softc *sc = dev->priv;
+       unsigned int i;
++      unsigned long flags;
+       /* Process each active queue. This includes sc_cabq, sc_xrtq and
+        * sc_uapsdq */
++process_tx_again:
+       for (i = 0; i < HAL_NUM_TX_QUEUES; i++)
+               if (ATH_TXQ_SETUP(sc, i) && txqactive(sc->sc_ah, i))
+                       ath_tx_processq(sc, &sc->sc_txq[i]);
++      local_irq_save(flags);
++      if (sc->sc_isr & HAL_INT_TX) {
++              sc->sc_isr &= ~HAL_INT_TX;
++              local_irq_restore(flags);
++              goto process_tx_again;
++      }
++      sc->sc_imask |= HAL_INT_TX;
++      ath_hal_intrset(sc->sc_ah, sc->sc_imask);
++      local_irq_restore(flags);
++
+       netif_wake_queue(dev);
+       if (sc->sc_softled)
+@@ -10296,9 +10450,9 @@ ath_change_mtu(struct net_device *dev, i
+       dev->mtu = mtu;
+       if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
+               /* NB: the rx buffers may need to be reallocated */
+-              tasklet_disable(&sc->sc_rxtq);
++              ath_poll_disable(dev);
+               error = ath_reset(dev);
+-              tasklet_enable(&sc->sc_rxtq);
++              ath_poll_enable(dev);
+       }
+       ATH_UNLOCK(sc);
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -53,6 +53,10 @@
+ # include     <asm/bitops.h>
+ #endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
++#define irqs_disabled()                       0
++#endif
++
+ /*
+  * Deduce if tasklets are available.  If not then
+  * fall back to using the immediate work queue.
+@@ -616,6 +620,9 @@ struct ath_rp {
+ struct ath_softc {
+       struct ieee80211com sc_ic;              /* NB: must be first */
+       struct net_device *sc_dev;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++      struct napi_struct sc_napi;
++#endif
+       void __iomem *sc_iobase;                /* address of the device */
+       struct semaphore sc_lock;               /* dev-level lock */
+       struct net_device_stats sc_devstats;    /* device statistics */
+@@ -730,7 +737,6 @@ struct ath_softc {
+       struct ath_buf *sc_rxbufcur;            /* current rx buffer */
+       u_int32_t *sc_rxlink;                   /* link ptr in last RX desc */
+       spinlock_t sc_rxbuflock;
+-      struct ATH_TQ_STRUCT sc_rxtq;           /* rx intr tasklet */
+       struct ATH_TQ_STRUCT sc_rxorntq;        /* rxorn intr tasklet */
+       u_int8_t sc_defant;                     /* current default antenna */
+       u_int8_t sc_rxotherant;                 /* RXs on non-default antenna */
+@@ -745,6 +751,7 @@ struct ath_softc {
+       u_int sc_txintrperiod;                  /* tx interrupt batching */
+       struct ath_txq sc_txq[HAL_NUM_TX_QUEUES];
+       struct ath_txq *sc_ac2q[WME_NUM_AC];    /* WME AC -> h/w qnum */
++      HAL_INT sc_isr;                         /* unmasked ISR state */
+       struct ATH_TQ_STRUCT sc_txtq;           /* tx intr tasklet */
+       u_int8_t sc_grppoll_str[GRPPOLL_RATE_STR_LEN];
+       struct ath_descdma sc_bdma;             /* beacon descriptors */
+@@ -858,6 +865,8 @@ typedef void (*ath_callback) (struct ath
+ #define       ATH_TXBUF_LOCK_CHECK(_sc)
+ #endif
++#define ATH_DISABLE_INTR              local_irq_disable
++#define ATH_ENABLE_INTR               local_irq_enable
+ #define       ATH_RXBUF_LOCK_INIT(_sc)        spin_lock_init(&(_sc)->sc_rxbuflock)
+ #define       ATH_RXBUF_LOCK_DESTROY(_sc)
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1198,7 +1198,7 @@ ieee80211_deliver_data(struct ieee80211_
+                       /* attach vlan tag */
+                       struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
+                       if (vlan_hwaccel_receive_skb(skb, vap->iv_vlgrp, ni->ni_vlan) == NET_RX_DROP) {
+-                              /* If netif_rx dropped the packet because 
++                              /* If netif_receive_skb dropped the packet because
+                                * device was too busy */
+                               if (ni_tmp != NULL) {
+                                       /* node reference was leaked */
+@@ -1209,8 +1209,8 @@ ieee80211_deliver_data(struct ieee80211_
+                       skb = NULL; /* SKB is no longer ours */
+               } else {
+                       struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
+-                      if (netif_rx(skb) == NET_RX_DROP) {
+-                              /* If netif_rx dropped the packet because 
++                      if (netif_receive_skb(skb) == NET_RX_DROP) {
++                              /* If netif_receive_skb dropped the packet because
+                                * device was too busy */
+                               if (ni_tmp != NULL) {
+                                       /* node reference was leaked */
+@@ -2322,8 +2322,8 @@ forward_mgmt_to_app(struct ieee80211vap 
+               skb1->protocol = __constant_htons(0x0019);  /* ETH_P_80211_RAW */
+               ni_tmp = SKB_CB(skb1)->ni;
+-              if (netif_rx(skb1) == NET_RX_DROP) {
+-                      /* If netif_rx dropped the packet because 
++              if (netif_receive_skb(skb1) == NET_RX_DROP) {
++                      /* If netif_receive_skb dropped the packet because
+                        * device was too busy */
+                       if (ni_tmp != NULL) {
+                               /* node reference was leaked */
+--- a/net80211/ieee80211_monitor.c
++++ b/net80211/ieee80211_monitor.c
+@@ -584,8 +584,8 @@ ieee80211_input_monitor(struct ieee80211
+                       skb1->protocol = 
+                               __constant_htons(0x0019); /* ETH_P_80211_RAW */
+-                      if (netif_rx(skb1) == NET_RX_DROP) {
+-                              /* If netif_rx dropped the packet because 
++                      if (netif_receive_skb(skb1) == NET_RX_DROP) {
++                              /* If netif_receive_skb dropped the packet because
+                                * device was too busy, reclaim the ref. in 
+                                * the skb. */
+                               if (SKB_CB(skb1)->ni != NULL)
+--- a/net80211/ieee80211_skb.c
++++ b/net80211/ieee80211_skb.c
+@@ -73,7 +73,7 @@
+ #undef dev_queue_xmit
+ #undef kfree_skb
+ #undef kfree_skb_fast
+-#undef netif_rx
++#undef netif_receive_skb
+ #undef pskb_copy
+ #undef skb_clone
+ #undef skb_copy
+@@ -638,8 +638,8 @@ int  vlan_hwaccel_receive_skb_debug(stru
+               grp, vlan_tag);
+ }
+-int netif_rx_debug(struct sk_buff *skb, const char* func, int line) {
+-      return netif_rx(untrack_skb(skb, 0, func, line, __func__, __LINE__));
++int netif_receive_skb_debug(struct sk_buff *skb, const char* func, int line) {
++      return netif_receive_skb(untrack_skb(skb, 0, func, line, __func__, __LINE__));
+ }
+ struct sk_buff * alloc_skb_debug(unsigned int length, gfp_t gfp_mask,
+@@ -760,7 +760,7 @@ struct sk_buff * skb_copy_expand_debug(c
+ }
+ EXPORT_SYMBOL(vlan_hwaccel_receive_skb_debug);
+-EXPORT_SYMBOL(netif_rx_debug);
++EXPORT_SYMBOL(netif_receive_skb_debug);
+ EXPORT_SYMBOL(alloc_skb_debug);
+ EXPORT_SYMBOL(dev_alloc_skb_debug);
+ EXPORT_SYMBOL(skb_clone_debug);
+--- a/net80211/ieee80211_skb.h
++++ b/net80211/ieee80211_skb.h
+@@ -116,7 +116,7 @@ int ieee80211_skb_references(void);
+ int  vlan_hwaccel_receive_skb_debug(struct sk_buff *skb, 
+                                   struct vlan_group *grp, unsigned short vlan_tag, 
+                                   const char* func, int line);
+-int netif_rx_debug(struct sk_buff *skb, const char* func, int line);
++int netif_receive_skb_debug(struct sk_buff *skb, const char* func, int line);
+ struct sk_buff * alloc_skb_debug(unsigned int length, gfp_t gfp_mask,
+                                const char *func, int line);
+ struct sk_buff * dev_alloc_skb_debug(unsigned int length,
+@@ -151,7 +151,7 @@ struct sk_buff * skb_copy_expand_debug(c
+ #undef dev_queue_xmit
+ #undef kfree_skb
+ #undef kfree_skb_fast
+-#undef netif_rx
++#undef netif_receive_skb
+ #undef pskb_copy
+ #undef skb_clone
+ #undef skb_copy
+@@ -168,8 +168,8 @@ struct sk_buff * skb_copy_expand_debug(c
+       skb_copy_expand_debug(_skb, _newheadroom, _newtailroom, _gfp_mask, __func__, __LINE__)
+ #define vlan_hwaccel_receive_skb(_skb, _grp, _tag) \
+       vlan_hwaccel_receive_skb_debug(_skb, _grp, _tag, __func__, __LINE__)
+-#define netif_rx(_skb) \
+-      netif_rx_debug(_skb, __func__, __LINE__)
++#define netif_receive_skb(_skb) \
++      netif_receive_skb_debug(_skb, __func__, __LINE__)
+ #define       alloc_skb(_length, _gfp_mask) \
+       alloc_skb_debug(_length, _gfp_mask, __func__, __LINE__)
+ #define       dev_alloc_skb(_length) \
diff --git a/net/madwifi/patches/305-pureg_fix.patch b/net/madwifi/patches/305-pureg_fix.patch
new file mode 100644 (file)
index 0000000..231ab08
--- /dev/null
@@ -0,0 +1,168 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -4158,7 +4158,9 @@ ath_calcrxfilter(struct ath_softc *sc)
+               rfilt |= HAL_RX_FILTER_PROM;
+       if (ic->ic_opmode == IEEE80211_M_STA ||
+           sc->sc_opmode == HAL_M_IBSS ||      /* NB: AHDEMO too */
+-          (sc->sc_nostabeacons) || sc->sc_scanning)
++          (sc->sc_nostabeacons) || sc->sc_scanning ||
++              ((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
++               (ic->ic_protmode != IEEE80211_PROT_NONE)))
+               rfilt |= HAL_RX_FILTER_BEACON;
+       if (sc->sc_nmonvaps > 0)
+               rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -346,11 +346,12 @@ ieee80211_input(struct ieee80211vap * va
+                               bssid = wh->i_addr3;
+                       }
+                       /*
+-                       * Validate the bssid.
++                       * Validate the bssid. Let beacons get through though for 11g protection mode.
+                        */
+-#ifdef ATH_SUPERG_XR
+                       if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bssid) &&
+-                          !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
++                          !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
++                              (subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
++#ifdef ATH_SUPERG_XR
+                               /*
+                                * allow MGT frames to vap->iv_xrvap.
+                                * this will allow roaming between  XR and normal vaps
+@@ -366,18 +367,14 @@ ieee80211_input(struct ieee80211vap * va
+                                       vap->iv_stats.is_rx_wrongbss++;
+                                       goto out;
+                               }
+-                      }
+ #else
+-                      if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bssid) &&
+-                          !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
+                               /* not interested in */
+                               IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
+                                       bssid, NULL, "%s", "not to bss");
+                               vap->iv_stats.is_rx_wrongbss++;
+                               goto out;
+-                      }
+-
+ #endif
++                      }
+                       break;
+               case IEEE80211_M_WDS:
+                       if (skb->len < sizeof(struct ieee80211_frame_addr4)) {
+@@ -3066,7 +3063,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+       u_int8_t *frm, *efrm;
+       u_int8_t *ssid, *rates, *xrates, *suppchan, *wpa, *rsn, *wme, *ath;
+       u_int8_t rate;
+-      int reassoc, resp, allocbs = 0;
++      int reassoc, resp, allocbs = 0, has_erp = 0;
+       u_int8_t qosinfo;
+       if (ni_or_null == NULL)
+@@ -3096,11 +3093,15 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                *    o station mode when associated (to collect state
+                *      updates such as 802.11g slot time), or
+                *    o adhoc mode (to discover neighbors)
++               *    o ap mode in protection mode (beacons only)
+                * Frames otherwise received are discarded.
+                */
+               if (!((ic->ic_flags & IEEE80211_F_SCAN) ||
+                   (vap->iv_opmode == IEEE80211_M_STA && ni->ni_associd) ||
+-                  vap->iv_opmode == IEEE80211_M_IBSS)) {
++                  (vap->iv_opmode == IEEE80211_M_IBSS) ||
++                      ((subtype == IEEE80211_FC0_SUBTYPE_BEACON) &&
++                       (vap->iv_opmode == IEEE80211_M_HOSTAP) &&
++                       (ic->ic_protmode != IEEE80211_PROT_NONE)))) {
+                       vap->iv_stats.is_rx_mgtdiscard++;
+                       return;
+               }
+@@ -3184,6 +3185,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                                       break;
+                               }
+                               scan.erp = frm[2];
++                              has_erp = 1;
+                               break;
+                       case IEEE80211_ELEMID_RSN:
+                               scan.rsn = frm;
+@@ -3421,6 +3423,20 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                               ieee80211_bg_scan(vap);
+                       return;
+               }
++
++              /* Update AP protection mode when in 11G mode */
++              if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
++                      IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
++
++                      /* Assume no ERP IE == 11b AP */
++                      if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
++                              !(ic->ic_flags & IEEE80211_F_USEPROT)) {
++
++                              ic->ic_flags |= IEEE80211_F_USEPROT;
++                              ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                      }
++              }
++
+               /*
+                * If scanning, just pass information to the scan module.
+                */
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -383,10 +383,16 @@ ieee80211_create_ibss(struct ieee80211va
+       /* Update country ie information */
+       ieee80211_build_countryie(ic);
+-      if (IEEE80211_IS_CHAN_HALF(chan))
++      if (IEEE80211_IS_CHAN_HALF(chan)) {
+               ni->ni_rates = ic->ic_sup_half_rates;
+-      else if (IEEE80211_IS_CHAN_QUARTER(chan))
++      } else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
+               ni->ni_rates = ic->ic_sup_quarter_rates;
++      }
++
++      if ((vap->iv_flags & IEEE80211_F_PUREG) &&
++              IEEE80211_IS_CHAN_ANYG(chan)) {
++              ieee80211_setpuregbasicrates(&ni->ni_rates);
++      }
+       (void) ieee80211_sta_join1(PASS_NODE(ni));
+ }
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -595,6 +595,28 @@ static const struct ieee80211_rateset ba
+       { 4, { 2, 4, 11, 22 } },        /* IEEE80211_MODE_TURBO_G (mixed b/g) */
+ };
++static const struct ieee80211_rateset basicpureg[] = {
++    { 7, {2, 4, 11, 22, 12, 24, 48 } },
++};
++
++/*
++ * Mark basic rates for the 11g rate table based on the pureg setting
++ */
++void
++ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs)
++{
++      int i, j;
++
++      for (i = 0; i < rs->rs_nrates; i++) {
++              rs->rs_rates[i] &= IEEE80211_RATE_VAL;
++              for (j = 0; j < basicpureg[0].rs_nrates; j++)
++                      if (basicpureg[0].rs_rates[j] == rs->rs_rates[i]) {
++                              rs->rs_rates[i] |= IEEE80211_RATE_BASIC;
++                              break;
++                      }
++      }
++}
++
+ /*
+  * Mark the basic rates for the 11g rate table based on the
+  * specified mode.  For 11b compatibility we mark only 11b
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -708,6 +708,7 @@ int ieee80211_media_setup(struct ieee802
+ void ieee80211_build_sc_ie(struct ieee80211com *);
+ void ieee80211_dfs_action(struct ieee80211com *);
+ void ieee80211_expire_channel_excl_restrictions(struct ieee80211com *);
++void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
+ /*
+  * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.
diff --git a/net/madwifi/patches/309-micfail_detect.patch b/net/madwifi/patches/309-micfail_detect.patch
new file mode 100644 (file)
index 0000000..d74a390
--- /dev/null
@@ -0,0 +1,321 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6457,6 +6457,7 @@ ath_rx_poll(struct net_device *dev, int 
+       int type;
+       u_int phyerr;
+       u_int processed = 0, early_stop = 0;
++      u_int mic_fail = 0;
+       DPRINTF(sc, ATH_DEBUG_RX_PROC, "invoked\n");
+ process_rx_again:
+@@ -6558,24 +6559,8 @@ process_rx_again:
+                       }
+                       if (rs->rs_status & HAL_RXERR_MIC) {
+                               sc->sc_stats.ast_rx_badmic++;
+-                              /*
+-                               * Do minimal work required to hand off
+-                               * the 802.11 header for notification.
+-                               */
+-                              /* XXX frag's and QoS frames */
+-                              if (len >= sizeof (struct ieee80211_frame)) {
+-                                      bus_dma_sync_single(sc->sc_bdev,
+-                                          bf->bf_skbaddr, len,
+-                                          BUS_DMA_FROMDEVICE);
+-#if 0
+-/* XXX revalidate MIC, lookup ni to find VAP */
+-                                      ieee80211_notify_michael_failure(ic,
+-                                          (struct ieee80211_frame *)skb->data,
+-                                          sc->sc_splitmic ?
+-                                              rs->rs_keyix - 32 : rs->rs_keyix
+-                                      );
+-#endif
+-                              }
++                              mic_fail = 1;
++                              goto rx_accept;
+                       }
+                       /*
+                        * Reject error frames if we have no vaps that
+@@ -6614,8 +6599,9 @@ rx_accept:
+               /*
+                * Finished monitor mode handling, now reject
+                * error frames before passing to other vaps
++               * Ignore MIC failures here, as we need to recheck them
+                */
+-              if (rs->rs_status != 0) {
++              if (rs->rs_status & ~(HAL_RXERR_MIC | HAL_RXERR_DECRYPT)) {
+                       ieee80211_dev_kfree_skb(&skb);
+                       goto rx_next;
+               }
+@@ -6623,6 +6609,26 @@ rx_accept:
+               /* remove the CRC */
+               skb_trim(skb, skb->len - IEEE80211_CRC_LEN);
++              if (mic_fail) {
++                      /* Ignore control frames which are reported with mic error */
++                  if ((((struct ieee80211_frame *)skb->data)->i_fc[0] &
++                                      IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
++                              goto drop_micfail;
++
++                      ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
++
++                      if (ni && ni->ni_table) {
++                              ieee80211_check_mic(ni, skb);
++                              ieee80211_unref_node(&ni);
++                      }
++
++drop_micfail:
++                      dev_kfree_skb_any(skb);
++                      skb = NULL;
++                      mic_fail = 0;
++                      goto rx_next;
++              }
++
+               /*
+                * From this point on we assume the frame is at least
+                * as large as ieee80211_frame_min; verify that.
+@@ -6635,6 +6641,7 @@ rx_accept:
+                       goto rx_next;
+               }
++              /* MIC failure. Drop the packet in any case */
+               /*
+                * Normal receive.
+                */
+--- a/net80211/ieee80211_crypto_ccmp.c
++++ b/net80211/ieee80211_crypto_ccmp.c
+@@ -73,7 +73,7 @@ static int ccmp_setkey(struct ieee80211_
+ static int ccmp_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
+ static int ccmp_decap(struct ieee80211_key *, struct sk_buff *, int);
+ static int ccmp_enmic(struct ieee80211_key *, struct sk_buff *, int);
+-static int ccmp_demic(struct ieee80211_key *, struct sk_buff *, int);
++static int ccmp_demic(struct ieee80211_key *, struct sk_buff *, int, int);
+ static const struct ieee80211_cipher ccmp = {
+       .ic_name        = "AES-CCM",
+@@ -314,7 +314,7 @@ ccmp_decap(struct ieee80211_key *k, stru
+  * Verify and strip MIC from the frame.
+  */
+ static int
+-ccmp_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen)
++ccmp_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen, int force)
+ {
+       return 1;
+ }
+--- a/net80211/ieee80211_crypto.h
++++ b/net80211/ieee80211_crypto.h
+@@ -145,7 +145,7 @@ struct ieee80211_cipher {
+       int (*ic_encap)(struct ieee80211_key *, struct sk_buff *, u_int8_t);
+       int (*ic_decap)(struct ieee80211_key *, struct sk_buff *, int);
+       int (*ic_enmic)(struct ieee80211_key *, struct sk_buff *, int);
+-      int (*ic_demic)(struct ieee80211_key *, struct sk_buff *, int);
++      int (*ic_demic)(struct ieee80211_key *, struct sk_buff *, int, int);
+ };
+ extern const struct ieee80211_cipher ieee80211_cipher_none;
+@@ -163,10 +163,10 @@ struct ieee80211_key *ieee80211_crypto_d
+  */
+ static __inline int
+ ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k,
+-      struct sk_buff *skb, int hdrlen)
++      struct sk_buff *skb, int hdrlen, int force)
+ {
+       const struct ieee80211_cipher *cip = k->wk_cipher;
+-      return (cip->ic_miclen > 0 ? cip->ic_demic(k, skb, hdrlen) : 1);
++      return (cip->ic_miclen > 0 ? cip->ic_demic(k, skb, hdrlen, force) : 1);
+ }
+ /*
+--- a/net80211/ieee80211_crypto_none.c
++++ b/net80211/ieee80211_crypto_none.c
+@@ -52,7 +52,7 @@ static int none_setkey(struct ieee80211_
+ static int none_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
+ static int none_decap(struct ieee80211_key *, struct sk_buff *, int);
+ static int none_enmic(struct ieee80211_key *, struct sk_buff *, int);
+-static int none_demic(struct ieee80211_key *, struct sk_buff *, int);
++static int none_demic(struct ieee80211_key *, struct sk_buff *, int, int);
+ const struct ieee80211_cipher ieee80211_cipher_none = {
+       .ic_name        = "NONE",
+@@ -137,7 +137,7 @@ none_enmic(struct ieee80211_key *k, stru
+ }
+ static int
+-none_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen)
++none_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen, int force)
+ {
+       struct ieee80211vap *vap = k->wk_private;
+--- a/net80211/ieee80211_crypto_tkip.c
++++ b/net80211/ieee80211_crypto_tkip.c
+@@ -57,7 +57,7 @@ static int tkip_setkey(struct ieee80211_
+ static int tkip_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
+ static int tkip_enmic(struct ieee80211_key *, struct sk_buff *, int);
+ static int tkip_decap(struct ieee80211_key *, struct sk_buff *, int);
+-static int tkip_demic(struct ieee80211_key *, struct sk_buff *, int);
++static int tkip_demic(struct ieee80211_key *, struct sk_buff *, int, int);
+ static const struct ieee80211_cipher tkip  = {
+       .ic_name        = "TKIP",
+@@ -339,7 +339,7 @@ tkip_decap(struct ieee80211_key *k, stru
+  * Verify and strip MIC from the frame.
+  */
+ static int
+-tkip_demic(struct ieee80211_key *k, struct sk_buff *skb0, int hdrlen)
++tkip_demic(struct ieee80211_key *k, struct sk_buff *skb0, int hdrlen, int force)
+ {
+       struct tkip_ctx *ctx = k->wk_private;
+       struct sk_buff *skb;
+@@ -355,7 +355,7 @@ tkip_demic(struct ieee80211_key *k, stru
+       }
+       wh = (struct ieee80211_frame *) skb0->data;
+       /* NB: skb left pointing at last in chain */
+-      if (k->wk_flags & IEEE80211_KEY_SWMIC) {
++      if ((k->wk_flags & IEEE80211_KEY_SWMIC) || force) {
+               struct ieee80211vap *vap = ctx->tc_vap;
+               u8 mic[IEEE80211_WEP_MICLEN];
+               u8 mic0[IEEE80211_WEP_MICLEN];
+--- a/net80211/ieee80211_crypto_wep.c
++++ b/net80211/ieee80211_crypto_wep.c
+@@ -54,7 +54,7 @@ static int wep_setkey(struct ieee80211_k
+ static int wep_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
+ static int wep_decap(struct ieee80211_key *, struct sk_buff *, int);
+ static int wep_enmic(struct ieee80211_key *, struct sk_buff *, int);
+-static int wep_demic(struct ieee80211_key *, struct sk_buff *, int);
++static int wep_demic(struct ieee80211_key *, struct sk_buff *, int, int);
+ static const struct ieee80211_cipher wep = {
+       .ic_name        = "WEP",
+@@ -244,7 +244,7 @@ wep_decap(struct ieee80211_key *k, struc
+  * Verify and strip MIC from the frame.
+  */
+ static int
+-wep_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen)
++wep_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen, int force)
+ {
+       return 1;
+ }
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -669,7 +669,7 @@ ieee80211_input(struct ieee80211vap * va
+                * Next strip any MSDU crypto bits.
+                */
+               if (key != NULL &&
+-                  !ieee80211_crypto_demic(vap, key, skb, hdrspace)) {
++                  !ieee80211_crypto_demic(vap, key, skb, hdrspace, 0)) {
+                       IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
+                               ni->ni_macaddr, "data", "%s", "demic error");
+                       IEEE80211_NODE_STAT(ni, rx_demicfail);
+@@ -4293,6 +4293,47 @@ ath_eth_type_trans(struct sk_buff *skb, 
+ }
+ #endif
++/*
++ * Process a frame w/ hw detected MIC failure.
++ * The frame will be dropped in any case.
++ */
++void
++ieee80211_check_mic(struct ieee80211_node *ni, struct sk_buff *skb)
++{
++      struct ieee80211vap *vap = ni->ni_vap;
++
++      struct ieee80211_frame *wh;
++      struct ieee80211_key *key;
++      int hdrspace;
++      struct ieee80211com *ic = vap->iv_ic;
++
++      if (skb->len < sizeof(struct ieee80211_frame_min)) {
++              IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
++                  ni->ni_macaddr, NULL,
++                  "too short (1): len %u", skb->len);
++              vap->iv_stats.is_rx_tooshort++;
++              return;
++      }
++
++      wh = (struct ieee80211_frame *)skb->data;
++
++      hdrspace = ieee80211_hdrspace(ic, wh);
++      key = ieee80211_crypto_decap(ni, skb, hdrspace);
++      if (key == NULL) {
++              /* NB: stats+msgs handled in crypto_decap */
++              IEEE80211_NODE_STAT(ni, rx_wepfail);
++              return;
++      }
++
++      if (!ieee80211_crypto_demic(vap, key, skb, hdrspace, 1)) {
++              IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
++                      ni->ni_macaddr, "data", "%s", "demic error");
++                      IEEE80211_NODE_STAT(ni, rx_demicfail);
++      }
++      return;
++}
++EXPORT_SYMBOL(ieee80211_check_mic);
++
+ #ifdef IEEE80211_DEBUG
+ /*
+  * Debugging support.
+--- a/net80211/ieee80211_proto.h
++++ b/net80211/ieee80211_proto.h
+@@ -90,6 +90,7 @@ int ieee80211_iserp_rateset(struct ieee8
+ void ieee80211_set11gbasicrates(struct ieee80211_rateset *, enum ieee80211_phymode);
+ enum ieee80211_phymode ieee80211_get11gbasicrates(struct ieee80211_rateset *);
+ void ieee80211_send_pspoll(struct ieee80211_node *);
++void ieee80211_check_mic(struct ieee80211_node *, struct sk_buff *);
+ /*
+  * Return the size of the 802.11 header for a management or data frame.
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -337,8 +337,8 @@ ieee80211_notify_replay_failure(struct i
+       /* TODO: needed parameters: count, keyid, key type, src address, TSC */
+       snprintf(buf, sizeof(buf), "%s(keyid=%d %scast addr=" MAC_FMT ")", tag,
+               k->wk_keyix,
+-              IEEE80211_IS_MULTICAST(wh->i_addr1) ?  "broad" : "uni",
+-              MAC_ADDR(wh->i_addr1));
++              IEEE80211_IS_MULTICAST(wh->i_addr2) ?  "broad" : "uni",
++              MAC_ADDR(wh->i_addr2));
+       memset(&wrqu, 0, sizeof(wrqu));
+       wrqu.data.length = strlen(buf);
+       wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -1074,13 +1074,16 @@ ieee80211_encap(struct ieee80211_node *n
+                       cip = (struct ieee80211_cipher *) key->wk_cipher;
+                       ciphdrsize = cip->ic_header;
+                       tailsize += (cip->ic_trailer + cip->ic_miclen);
++
++                      /* add the 8 bytes MIC length */
++                      if (cip->ic_cipher == IEEE80211_CIPHER_TKIP)
++                              pktlen += IEEE80211_WEP_MICLEN;
+               }
+               pdusize = vap->iv_fragthreshold - (hdrsize_nopad + ciphdrsize);
+               fragcnt = *framecnt =
+-                      ((pktlen - (hdrsize_nopad + ciphdrsize)) / pdusize) +
+-                      (((pktlen - (hdrsize_nopad + ciphdrsize)) %
+-                              pdusize == 0) ? 0 : 1);
++                      ((pktlen - hdrsize_nopad) / pdusize) +
++                      (((pktlen - hdrsize_nopad) % pdusize == 0) ? 0 : 1);
+               /*
+                * Allocate sk_buff for each subsequent fragment; First fragment
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -2264,11 +2264,13 @@ ieee80211_node_leave(struct ieee80211_no
+       /* From this point onwards we can no longer find the node,
+        * so no more references are generated
+        */
+-      ieee80211_remove_wds_addr(nt, ni->ni_macaddr);
+-      ieee80211_del_wds_node(nt, ni);
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-      node_table_leave_locked(nt, ni);
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
++      if (nt) {
++              ieee80211_remove_wds_addr(nt, ni->ni_macaddr);
++              ieee80211_del_wds_node(nt, ni);
++              IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
++              node_table_leave_locked(nt, ni);
++              IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
++      }
+       /*
+        * If node wasn't previously associated all
diff --git a/net/madwifi/patches/310-noise_get.patch b/net/madwifi/patches/310-noise_get.patch
new file mode 100644 (file)
index 0000000..d882158
--- /dev/null
@@ -0,0 +1,55 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1699,8 +1699,6 @@ ath_uapsd_processtriggers(struct ath_sof
+        * get to reality.  This value is used in monitor mode and by tools like
+        * Wireshark and Kismet.
+        */
+-      ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
+-
+       ATH_RXBUF_LOCK_IRQ(sc);
+       if (sc->sc_rxbufcur == NULL)
+               sc->sc_rxbufcur = STAILQ_FIRST(&sc->sc_rxbuf);
+@@ -8975,6 +8973,7 @@ ath_calibrate(unsigned long arg)
+                       sc->sc_curchan.channel);
+               sc->sc_stats.ast_per_calfail++;
+       }
++      ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
+       ath_hal_process_noisefloor(ah);
+       if (isIQdone == AH_TRUE) {
+@@ -9043,6 +9042,7 @@ ath_set_channel(struct ieee80211com *ic)
+       struct ath_softc *sc = dev->priv;
+       (void) ath_chan_set(sc, ic->ic_curchan);
++      ic->ic_channoise = ath_hal_get_channel_noise(sc->sc_ah, &(sc->sc_curchan));
+       /*
+        * If we are returning to our bss channel then mark state
+        * so the next recv'd beacon's TSF will be used to sync the
+@@ -9311,6 +9311,7 @@ ath_newstate(struct ieee80211vap *vap, e
+               }
+               ath_hal_process_noisefloor(ah);
++              ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
+               /*
+                * Reset rssi stats; maybe not the best place...
+                */
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -4358,6 +4358,7 @@ get_sta_info(void *arg, struct ieee80211
+       si->isi_state = ni->ni_flags;
+       si->isi_authmode = ni->ni_authmode;
+       si->isi_rssi = ic->ic_node_getrssi(ni);
++      si->isi_noise = ic->ic_channoise;
+       si->isi_capinfo = ni->ni_capinfo;
+       si->isi_athflags = ni->ni_ath_flags;
+       si->isi_erp = ni->ni_erp;
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -311,6 +311,7 @@ struct ieee80211req_sta_info {
+       u_int16_t isi_state;            /* state flags */
+       u_int8_t isi_authmode;          /* authentication algorithm */
+       u_int8_t isi_rssi;
++      int8_t isi_noise;
+       u_int16_t isi_capinfo;          /* capabilities */
+       u_int8_t isi_athflags;          /* Atheros capabilities */
+       u_int8_t isi_erp;               /* ERP element */
diff --git a/net/madwifi/patches/311-bssid_alloc.patch b/net/madwifi/patches/311-bssid_alloc.patch
new file mode 100644 (file)
index 0000000..8059b99
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1354,7 +1354,7 @@ ath_vap_create(struct ieee80211com *ic, 
+               TAILQ_FOREACH(v, &ic->ic_vaps, iv_next)
+                       id_mask |= (1 << ATH_GET_VAP_ID(v->iv_myaddr));
+-              for (id = 1; id < ath_maxvaps; id++) {
++              for (id = 0; id < ath_maxvaps; id++) {
+                       /* get the first available slot */
+                       if ((id_mask & (1 << id)) == 0) {
+                               ATH_SET_VAP_BSSID(vap->iv_myaddr, id);
diff --git a/net/madwifi/patches/312-erpupdate.patch b/net/madwifi/patches/312-erpupdate.patch
new file mode 100644 (file)
index 0000000..34fae68
--- /dev/null
@@ -0,0 +1,68 @@
+--- a/net80211/ieee80211_beacon.c
++++ b/net80211/ieee80211_beacon.c
+@@ -542,10 +542,10 @@ ieee80211_beacon_update(struct ieee80211
+                       vap->iv_flags &= ~IEEE80211_F_XRUPDATE;
+               }
+ #endif
+-              if ((ic->ic_flags_ext & IEEE80211_FEXT_ERPUPDATE) && 
++              if ((vap->iv_flags_ext & IEEE80211_FEXT_ERPUPDATE) &&
+                               (bo->bo_erp != NULL)) {
+                       (void)ieee80211_add_erp(bo->bo_erp, ic);
+-                      ic->ic_flags_ext &= ~IEEE80211_FEXT_ERPUPDATE;
++                      vap->iv_flags_ext &= ~IEEE80211_FEXT_ERPUPDATE;
+               }
+       }
+       /* if it is a mode change beacon for dynamic turbo case */
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3431,9 +3431,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       /* Assume no ERP IE == 11b AP */
+                       if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
+                               !(ic->ic_flags & IEEE80211_F_USEPROT)) {
++                              struct ieee80211vap *tmpvap;
+                               ic->ic_flags |= IEEE80211_F_USEPROT;
+-                              ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                              TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++                                      tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                              }
+                       }
+               }
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -2025,8 +2025,12 @@ ieee80211_node_join_11g(struct ieee80211
+               }
+               /* Update ERP element if this is first non ERP station */
+-              if (ic->ic_nonerpsta == 1)
+-                      ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++              if (ic->ic_nonerpsta == 1) {
++                      struct ieee80211vap *tmpvap;
++                      TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++                              tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                      }
++              }
+       } else
+               ni->ni_flags |= IEEE80211_NODE_ERP;
+ }
+@@ -2229,6 +2233,8 @@ ieee80211_node_leave_11g(struct ieee8021
+               IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni,
+                       "non-ERP station leaves, count now %d", ic->ic_nonerpsta);
+               if (ic->ic_nonerpsta == 0) {
++                      struct ieee80211vap *tmpvap;
++
+                       IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
+                               "%s: disable use of protection\n", __func__);
+                       ic->ic_flags &= ~IEEE80211_F_USEPROT;
+@@ -2240,7 +2246,9 @@ ieee80211_node_leave_11g(struct ieee8021
+                               ic->ic_flags |= IEEE80211_F_SHPREAMBLE;
+                               ic->ic_flags &= ~IEEE80211_F_USEBARKER;
+                       }
+-                      ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                      TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++                              tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                      }
+               }
+       }
+ }
diff --git a/net/madwifi/patches/317-bmask.patch b/net/madwifi/patches/317-bmask.patch
new file mode 100644 (file)
index 0000000..3355dc7
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8689,6 +8689,10 @@ ath_startrecv(struct ath_softc *sc)
+       sc->sc_rxbufcur = NULL;
++      /* configure bssid mask */
++      if (sc->sc_hasbmask)
++              ath_hal_setbssidmask(ah, sc->sc_bssidmask);
++
+       bf = STAILQ_FIRST(&sc->sc_rxbuf);
+       ath_hal_putrxbuf(ah, bf->bf_daddr);
+       ath_hal_rxena(ah);              /* enable recv descriptors */
diff --git a/net/madwifi/patches/323-dfs_optional.patch b/net/madwifi/patches/323-dfs_optional.patch
new file mode 100644 (file)
index 0000000..2336d74
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1778,17 +1778,14 @@ ath_uapsd_processtriggers(struct ath_sof
+                        * may have occurred in the intervening timeframe. */
+                       bf->bf_channoise = ic->ic_channoise;
+-                      if (rs->rs_status) {
+-                              if ((HAL_RXERR_PHY == rs->rs_status) &&
+-                                  (HAL_PHYERR_RADAR ==
+-                                   (rs->rs_phyerr & 0x1f)) &&
+-                                  (0 == (bf->bf_status &
+-                                         ATH_BUFSTATUS_RADAR_DONE))) {
+-                                      check_for_radar = 1;
+-                              }
+-                              /* Skip past the error now */
++                      if ((HAL_RXERR_PHY == rs->rs_status) &&
++                          (HAL_PHYERR_RADAR == (rs->rs_phyerr & 0x1f)) &&
++                          (0 == (bf->bf_status & ATH_BUFSTATUS_RADAR_DONE)) &&
++                          (ic->ic_flags & IEEE80211_F_DOTH))
++                              check_for_radar = 1;
++
++                      if (rs->rs_status) /* Skip past the error now */
+                               continue;
+-                      }
+                       /* Prepare wireless header for examination */
+                       bus_dma_sync_single(sc->sc_bdev, bf->bf_skbaddr,
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
+@@ -265,7 +265,7 @@ int ath_radar_update(struct ath_softc *s
+               unsigned int new_rxfilt = old_rxfilt;
+               ath_hal_intrset(ah, old_ier & ~HAL_INT_GLOBAL);
+-              if (required) {
++              if ((required) && (ic->ic_flags & IEEE80211_F_DOTH)) {
+                       new_radar |= AR5K_PHY_RADAR_ENABLE;
+                       new_filter |= AR5K_AR5212_PHY_ERR_FIL_RADAR;
+                       new_rxfilt |= (HAL_RX_FILTER_PHYERR | 
diff --git a/net/madwifi/patches/324-alignment.patch b/net/madwifi/patches/324-alignment.patch
new file mode 100644 (file)
index 0000000..c01135f
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1275,14 +1275,8 @@ ieee80211_decap(struct ieee80211vap *vap
+               eh->ether_type = ether_type;
+       if (!ALIGNED_POINTER(skb->data + sizeof(*eh), u_int32_t)) {
+-              struct sk_buff *tskb;
+-
+-              /* XXX: does this always work? */
+-              tskb = skb_copy(skb, GFP_ATOMIC);
+-              if (tskb)
+-                      ieee80211_skb_copy_noderef(skb, tskb);
+-              ieee80211_dev_kfree_skb(&skb);
+-              skb = tskb;
++              memmove(skb->data - 2, skb->data, skb->len);
++              skb->data -= 2;
+       }
+       return skb;
+ }
diff --git a/net/madwifi/patches/325-channel_spam.patch b/net/madwifi/patches/325-channel_spam.patch
new file mode 100644 (file)
index 0000000..a4b9463
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -9792,7 +9792,9 @@ ath_getchannels(struct net_device *dev, 
+       /*
+        * Convert HAL channels to ieee80211 ones.
+        */
++#ifdef AR_DEBUG
+       IPRINTF(sc, "HAL returned %d channels.\n", nchan);
++#endif
+       for (i = 0; i < nchan; i++) {
+               HAL_CHANNEL *c = &chans[i];
+               struct ieee80211_channel *ichan = &ic->ic_channels[i];
+@@ -9819,6 +9821,7 @@ ath_getchannels(struct net_device *dev, 
+               ic->ic_chan_non_occupy[i].tv_sec  = 0;
+               ic->ic_chan_non_occupy[i].tv_usec = 0;
++#ifdef AR_DEBUG
+               IPRINTF(sc, "Channel %3d (%4d MHz) Max Tx Power %d dBm%s "
+                               "[%d hw %d reg] Flags%s%s%s%s%s%s%s%s%s%s%s%s%"
+                               "s%s%s%s%s%s%s%s%s%s%s%s\n",
+@@ -9907,6 +9910,7 @@ ath_getchannels(struct net_device *dev, 
+                               (c->privFlags & 0x0080 ? 
+                                " PF & (1 << 7)" : "")
+                               );
++#endif
+       }
+       ic->ic_nchans = nchan;
+       kfree(chans);
diff --git a/net/madwifi/patches/327-queue.patch b/net/madwifi/patches/327-queue.patch
new file mode 100644 (file)
index 0000000..228aae3
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8438,8 +8438,6 @@ process_tx_again:
+       ath_hal_intrset(sc->sc_ah, sc->sc_imask);
+       local_irq_restore(flags);
+-      netif_wake_queue(dev);
+-
+       if (sc->sc_softled)
+               ath_led_event(sc, ATH_LED_TX);
+ }
+@@ -8486,8 +8484,6 @@ process_tx_again:
+       ath_hal_intrset(sc->sc_ah, sc->sc_imask);
+       local_irq_restore(flags);
+-      netif_wake_queue(dev);
+-
+       if (sc->sc_softled)
+               ath_led_event(sc, ATH_LED_TX);
+ }
+@@ -8520,8 +8516,6 @@ process_tx_again:
+       ath_hal_intrset(sc->sc_ah, sc->sc_imask);
+       local_irq_restore(flags);
+-      netif_wake_queue(dev);
+-
+       if (sc->sc_softled)
+               ath_led_event(sc, ATH_LED_TX);
+ }
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1132,7 +1132,7 @@ ieee80211_deliver_data(struct ieee80211_
+           (vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0) {
+               struct sk_buff *skb1 = NULL;
+-              if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
++              if (ETHER_IS_MULTICAST(eh->ether_dhost) && !netif_queue_stopped(dev)) {
+                       /* Create a SKB for the BSS to send out. */
+                       skb1 = skb_copy(skb, GFP_ATOMIC);
+                       if (skb1)
diff --git a/net/madwifi/patches/330-beaconcal.patch b/net/madwifi/patches/330-beaconcal.patch
new file mode 100644 (file)
index 0000000..2b4895f
--- /dev/null
@@ -0,0 +1,166 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -397,6 +397,7 @@ static int countrycode = -1;
+ static int maxvaps = -1;
+ static int outdoor = -1;
+ static int xchanmode = -1;
++static int beacon_cal = 1;
+ static const char *hal_status_desc[] = {
+       "No error",
+@@ -422,6 +423,7 @@ static struct notifier_block ath_event_b
+ };
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
++MODULE_PARM(beacon_cal, "i");
+ MODULE_PARM(countrycode, "i");
+ MODULE_PARM(maxvaps, "i");
+ MODULE_PARM(outdoor, "i");
+@@ -434,6 +436,7 @@ MODULE_PARM(autocreate, "s");
+ MODULE_PARM(ratectl, "s");
+ #else
+ #include <linux/moduleparam.h>
++module_param(beacon_cal, int, 0600);
+ module_param(countrycode, int, 0600);
+ module_param(maxvaps, int, 0600);
+ module_param(outdoor, int, 0600);
+@@ -2600,7 +2603,8 @@ ath_stop_locked(struct net_device *dev)
+               }
+               if (!sc->sc_invalid) {
+                       del_timer_sync(&sc->sc_dfs_cac_timer);
+-                      del_timer_sync(&sc->sc_cal_ch);
++                      if (!sc->sc_beacon_cal)
++                              del_timer_sync(&sc->sc_cal_ch);
+               }
+               ath_draintxq(sc);
+               if (!sc->sc_invalid) {
+@@ -2617,6 +2621,20 @@ ath_stop_locked(struct net_device *dev)
+       return 0;
+ }
++static void ath_set_beacon_cal(struct ath_softc *sc, int val)
++{
++      if (sc->sc_beacon_cal == !!val)
++              return;
++
++      if (val) {
++              del_timer_sync(&sc->sc_cal_ch);
++      } else {
++              sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
++              add_timer(&sc->sc_cal_ch);
++      }
++      sc->sc_beacon_cal = !!val && beacon_cal;
++}
++
+ /*
+  * Stop the device, grabbing the top-level lock to protect
+  * against concurrent entry through ath_init (which can happen
+@@ -2742,6 +2760,12 @@ ath_reset(struct net_device *dev)
+       HAL_STATUS status;
+       /*
++       * XXX: starting the calibration too early seems to lead to
++       * problems with the beacons.
++       */
++      sc->sc_lastcal = jiffies;
++
++      /*
+        * Convert to a HAL channel description with the flags
+        * constrained to reflect the current operating mode.
+        */
+@@ -5154,6 +5178,10 @@ ath_beacon_send(struct ath_softc *sc, in
+                       "Invoking ath_hal_txstart with sc_bhalq: %d\n",
+                       sc->sc_bhalq);
+               ath_hal_txstart(ah, sc->sc_bhalq);
++              if (sc->sc_beacon_cal && (jiffies > sc->sc_lastcal + (ath_calinterval * HZ))) {
++                      sc->sc_cal_ch.expires = jiffies + msecs_to_jiffies(10);
++                      add_timer(&sc->sc_cal_ch);
++              }
+               sc->sc_stats.ast_be_xmit++;             /* XXX per-VAP? */
+       }
+@@ -5403,6 +5431,7 @@ ath_beacon_config(struct ath_softc *sc, 
+               ath_hal_beacontimers(ah, &bs);
+               sc->sc_imask |= HAL_INT_BMISS;
+               ath_hal_intrset(ah, sc->sc_imask);
++              ath_set_beacon_cal(sc, 0);
+       } else {
+               ath_hal_intrset(ah, 0);
+               if (reset_tsf)
+@@ -5414,8 +5443,11 @@ ath_beacon_config(struct ath_softc *sc, 
+                        */
+                       intval |= HAL_BEACON_ENA;
+                       sc->sc_imask |= HAL_INT_SWBA;
++                      ath_set_beacon_cal(sc, 1);
+                       ath_beaconq_config(sc);
+-              }
++              } else
++                      ath_set_beacon_cal(sc, 0);
++
+ #ifdef ATH_SUPERG_DYNTURBO
+               ath_beacon_dturbo_config(vap, intval &
+                               ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
+@@ -8879,6 +8911,9 @@ ath_chan_set(struct ath_softc *sc, struc
+                       /* Enter DFS wait period */
+                       mod_timer(&sc->sc_dfs_cac_timer,
+                               jiffies + (sc->sc_dfs_cac_period * HZ));
++
++                      /* This is a good time to start a calibration */
++                      ath_set_beacon_cal(sc, 1);
+               }
+               /*
+                * re configure beacons when it is a turbo mode switch.
+@@ -8988,8 +9023,11 @@ ath_calibrate(unsigned long arg)
+               sc->sc_curchan.channel, sc->sc_curchan.channelFlags,
+               isIQdone ? "done" : "not done");
+-      sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
+-      add_timer(&sc->sc_cal_ch);
++      sc->sc_lastcal = jiffies;
++      if (!sc->sc_beacon_cal) {
++              sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
++              add_timer(&sc->sc_cal_ch);
++      }
+ }
+ static void
+@@ -9096,7 +9134,8 @@ ath_newstate(struct ieee80211vap *vap, e
+               ieee80211_state_name[vap->iv_state],
+               ieee80211_state_name[nstate]);
+-      del_timer(&sc->sc_cal_ch);              /* periodic calibration timer */
++      if (!sc->sc_beacon_cal)
++              del_timer(&sc->sc_cal_ch);              /* periodic calibration timer */
+       ath_hal_setledstate(ah, leds[nstate]);  /* set LED */
+       netif_stop_queue(dev);                  /* before we do anything else */
+@@ -9321,7 +9360,8 @@ ath_newstate(struct ieee80211vap *vap, e
+                               "VAP -> DFSWAIT_PENDING \n");
+                       /* start calibration timer with a really small value 
+                        * 1/10 sec */
+-                      mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
++                      if (!sc->sc_beacon_cal)
++                              mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
+                       /* wake the receiver */
+                       netif_wake_queue(dev);
+                       /* don't do the other usual stuff... */
+@@ -9364,7 +9404,7 @@ done:
+       error = avp->av_newstate(vap, nstate, arg);
+       /* Finally, start any timers. */
+-      if (nstate == IEEE80211_S_RUN) {
++      if (nstate == IEEE80211_S_RUN && !sc->sc_beacon_cal) {
+               /* start periodic recalibration timer */
+               mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
+       }
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -778,6 +778,8 @@ struct ath_softc {
+       struct ieee80211vap **sc_bslot;         /* beacon xmit slots */
+       int sc_bnext;                           /* next slot for beacon xmit */
++      int sc_beacon_cal;                      /* use beacon timer for calibration */
++      u_int64_t sc_lastcal;                   /* last time the calibration was performed */
+       struct timer_list sc_cal_ch;            /* calibration timer */
+       HAL_NODE_STATS sc_halstats;             /* station-mode rssi stats */
diff --git a/net/madwifi/patches/331-memory_alloc.patch b/net/madwifi/patches/331-memory_alloc.patch
new file mode 100644 (file)
index 0000000..6b01d79
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -3320,17 +3320,18 @@ ath_hardstart(struct sk_buff *skb, struc
+        * without affecting any other bridge ports. */
+       if (skb_cloned(skb)) {
+               /* Remember the original SKB so we can free up our references */
+-              struct sk_buff *skb_orig = skb;
+-              skb = skb_copy(skb, GFP_ATOMIC);
+-              if (skb == NULL) {
++              struct sk_buff *skb_new;
++              skb_new = skb_copy(skb, GFP_ATOMIC);
++              if (skb_new == NULL) {
+                       DPRINTF(sc, ATH_DEBUG_XMIT,
+                               "Dropping; skb_copy failure.\n");
+                       /* No free RAM, do not requeue! */
+                       goto hardstart_fail;
+               }
+-              ieee80211_skb_copy_noderef(skb_orig, skb);
+-              ieee80211_dev_kfree_skb(&skb_orig);
+-      } 
++              ieee80211_skb_copy_noderef(skb, skb_new);
++              ieee80211_dev_kfree_skb(&skb);
++              skb = skb_new;
++      }
+       eh = (struct ether_header *)skb->data;
+ #ifdef ATH_SUPERG_FF
+@@ -3601,6 +3602,8 @@ ath_mgtstart(struct ieee80211com *ic, st
+       sc->sc_stats.ast_tx_mgmt++;
+       return 0;
+ bad:
++      if (skb)
++              ieee80211_dev_kfree_skb(&skb);
+       ath_return_txbuf(sc, &bf);
+       return error;
+ }
diff --git a/net/madwifi/patches/332-reset_beacons.patch b/net/madwifi/patches/332-reset_beacons.patch
new file mode 100644 (file)
index 0000000..b776426
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8922,7 +8922,7 @@ ath_chan_set(struct ath_softc *sc, struc
+                * re configure beacons when it is a turbo mode switch.
+                * HW seems to turn off beacons during turbo mode switch.
+                */
+-              if (sc->sc_beacons && tswitch && !sc->sc_dfs_cac)
++              if (sc->sc_beacons && !sc->sc_dfs_cac)
+                       ath_beacon_config(sc, NULL);
+               /*
+                * Re-enable interrupts.
diff --git a/net/madwifi/patches/333-apscan_mode.patch b/net/madwifi/patches/333-apscan_mode.patch
new file mode 100644 (file)
index 0000000..877eea6
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -783,12 +783,6 @@ pick_channel(struct ieee80211_scan_state
+                               /* break the loop as the subsequent chans won't be 
+                                * better */
+                               break;
+-
+-                      if (!IEEE80211_ARE_CHANS_SAME_MODE(c->chan,
+-                              ic->ic_bsschan))
+-                              /* break the loop as the subsequent chans won't be 
+-                               * better */
+-                              break;
+               }
+               if (sta_assoc != 0) {
diff --git a/net/madwifi/patches/334-input.patch b/net/madwifi/patches/334-input.patch
new file mode 100644 (file)
index 0000000..1e1b276
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -950,6 +950,9 @@ ieee80211_input_all(struct ieee80211com 
+       TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+               struct sk_buff *skb1;
++              if ((vap->iv_dev->flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
++                      continue;
++
+               if (TAILQ_NEXT(vap, iv_next) != NULL) {
+                       skb1 = skb_copy(skb, GFP_ATOMIC);
+                       if (skb1 == NULL) {
diff --git a/net/madwifi/patches/340-maxrate.patch b/net/madwifi/patches/340-maxrate.patch
new file mode 100644 (file)
index 0000000..4613ed3
--- /dev/null
@@ -0,0 +1,98 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1307,6 +1307,7 @@ ath_vap_create(struct ieee80211com *ic, 
+       vap->iv_key_set = ath_key_set;
+       vap->iv_key_update_begin = ath_key_update_begin;
+       vap->iv_key_update_end = ath_key_update_end;
++      vap->iv_maxrateindex = 0;
+       if (sc->sc_default_ieee80211_debug) {
+               /* User specified defaults for new VAPs were provided, so
+                * use those (only). */
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -622,8 +622,12 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+                       return;
+               }
+               sn->static_rate_ndx = -1;
++              if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
++                  || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
++                      sn->num_rates = ni->ni_rates.rs_nrates;
++              else
++                      sn->num_rates = vap->iv_maxrateindex;
+-              sn->num_rates = ni->ni_rates.rs_nrates;
+               for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
+                       sn->rs_rateattempts     [x] = 0;
+                       sn->rs_thisprob         [x] = 0;
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -835,7 +835,12 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+       }
+       sn->static_rate_ndx = -1;
+-      sn->num_rates = ni->ni_rates.rs_nrates;
++      if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
++          || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
++              sn->num_rates = ni->ni_rates.rs_nrates;
++      else
++              sn->num_rates = vap->iv_maxrateindex;
++
+       for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
+               sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
+               sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -641,6 +641,7 @@ enum {
+                                                          FCC requires 30m, so that is the default. */
+       IEEE80211_PARAM_BEACON_MISS_THRESH      = 73,   /* Beacon miss threshold (in beacons) */
+       IEEE80211_PARAM_BEACON_MISS_THRESH_MS   = 74,   /* Beacon miss threshold (in ms) */
++      IEEE80211_PARAM_MAXRATE                 = 75,   /* Maximum rate (by table index) */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -281,6 +281,7 @@ struct ieee80211vap {
+       struct ieee80211_spy iv_spy;                    /* IWSPY support */
+       struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
+       u_int32_t app_filter;                           /* filters which management frames are forwarded to app */
++      u_int iv_maxrateindex;
+ };
+ /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2839,6 +2839,12 @@ ieee80211_ioctl_setparam(struct net_devi
+               else
+                       ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
+               break;
++      case IEEE80211_PARAM_MAXRATE:
++              if (value > 0)
++                      vap->iv_maxrateindex = value;
++              else
++                      vap->iv_maxrateindex = 0;
++              break;
+ #ifdef ATH_REVERSE_ENGINEERING
+       case IEEE80211_PARAM_DUMPREGS:
+               ieee80211_dump_registers(dev, info, w, extra);
+@@ -3174,6 +3180,9 @@ ieee80211_ioctl_getparam(struct net_devi
+               else
+                       param[0] = 0;
+               break;
++      case IEEE80211_PARAM_MAXRATE:
++              param[0] = vap->iv_maxrateindex;
++              break;
+       default:
+               return -EOPNOTSUPP;
+       }
+@@ -5610,6 +5619,10 @@ static const struct iw_priv_args ieee802
+         0, IW_PRIV_TYPE_APPIEBUF, "getiebuf" },
+       { IEEE80211_IOCTL_FILTERFRAME,
+         IW_PRIV_TYPE_FILTER , 0, "setfilter" },
++      {IEEE80211_PARAM_MAXRATE,
++       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxrate"},
++      {IEEE80211_PARAM_MAXRATE,
++       0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxrate"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
diff --git a/net/madwifi/patches/341-minrate.patch b/net/madwifi/patches/341-minrate.patch
new file mode 100644 (file)
index 0000000..53567e2
--- /dev/null
@@ -0,0 +1,114 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1308,6 +1308,7 @@ ath_vap_create(struct ieee80211com *ic, 
+       vap->iv_key_update_begin = ath_key_update_begin;
+       vap->iv_key_update_end = ath_key_update_end;
+       vap->iv_maxrateindex = 0;
++      vap->iv_minrateindex = 0;
+       if (sc->sc_default_ieee80211_debug) {
+               /* User specified defaults for new VAPs were provided, so
+                * use those (only). */
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -638,9 +638,15 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+                       sn->rs_succ_hist        [x] = 0;
+                       sn->rs_att_hist         [x] = 0;
+                       sn->rs_this_tp          [x] = 0;
+-
++                      if (vap->iv_minrateindex && vap->iv_minrateindex<ni->ni_rates.rs_nrates)
++                      {
++                      int idx = vap->iv_minrateindex; 
++                      sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
++                      sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
++                      }else{
+                       sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
+                       sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
++                      }
+                       if (sn->rates[x].rix == 0xff) {
+                               DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
+                                       dev_info, __func__, x);
+@@ -649,7 +655,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+                       sn->rates[x].rateCode = rt->info[sn->rates[x].rix].rateCode;
+                       sn->rates[x].shortPreambleRateCode =
+                               rt->info[sn->rates[x].rix].rateCode |
+-                              rt->info[sn->rates[x].rix].shortPreamble;
++                              rt->info[sn->rates[x].rix].shortPreamble;                       
+               }
+               ath_fill_sample_table(sn);
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -842,8 +842,15 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+               sn->num_rates = vap->iv_maxrateindex;
+       for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
+-              sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
+-              sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
++              if (vap->iv_minrateindex && vap->iv_minrateindex<ni->ni_rates.rs_nrates)
++                      {
++                      int idx = vap->iv_minrateindex; 
++                      sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
++                      sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
++                      }else{
++                      sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
++                      sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
++                      }
+               if (sn->rates[x].rix == 0xff) {
+                       DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %u\n",
+                               dev_info, __func__, x);
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -642,6 +642,7 @@ enum {
+       IEEE80211_PARAM_BEACON_MISS_THRESH      = 73,   /* Beacon miss threshold (in beacons) */
+       IEEE80211_PARAM_BEACON_MISS_THRESH_MS   = 74,   /* Beacon miss threshold (in ms) */
+       IEEE80211_PARAM_MAXRATE                 = 75,   /* Maximum rate (by table index) */
++      IEEE80211_PARAM_MINRATE                 = 76,   /* Minimum rate (by table index) */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -282,6 +282,7 @@ struct ieee80211vap {
+       struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
+       u_int32_t app_filter;                           /* filters which management frames are forwarded to app */
+       u_int iv_maxrateindex;
++      u_int iv_minrateindex;
+ };
+ /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2845,6 +2845,12 @@ ieee80211_ioctl_setparam(struct net_devi
+               else
+                       vap->iv_maxrateindex = 0;
+               break;
++      case IEEE80211_PARAM_MINRATE:
++              if (value > 0)
++                      vap->iv_minrateindex = value;
++              else
++                      vap->iv_minrateindex = 0;
++              break;
+ #ifdef ATH_REVERSE_ENGINEERING
+       case IEEE80211_PARAM_DUMPREGS:
+               ieee80211_dump_registers(dev, info, w, extra);
+@@ -3183,6 +3189,9 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_MAXRATE:
+               param[0] = vap->iv_maxrateindex;
+               break;
++      case IEEE80211_PARAM_MINRATE:
++              param[0] = vap->iv_minrateindex;
++              break;
+       default:
+               return -EOPNOTSUPP;
+       }
+@@ -5623,6 +5632,10 @@ static const struct iw_priv_args ieee802
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxrate"},
+       {IEEE80211_PARAM_MAXRATE,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxrate"},
++      {IEEE80211_PARAM_MINRATE,
++       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "minrate"},
++      {IEEE80211_PARAM_MINRATE,
++       0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
diff --git a/net/madwifi/patches/342-performance.patch b/net/madwifi/patches/342-performance.patch
new file mode 100644 (file)
index 0000000..8015643
--- /dev/null
@@ -0,0 +1,263 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -3239,7 +3239,6 @@ ath_hardstart(struct sk_buff *skb, struc
+       struct ath_softc *sc = dev->priv;
+       struct ieee80211_node *ni = NULL;
+       struct ath_buf *bf = NULL;
+-      struct ether_header *eh;
+       ath_bufhead bf_head;
+       struct ath_buf *tbf, *tempbf;
+       struct sk_buff *tskb;
+@@ -3251,6 +3250,7 @@ ath_hardstart(struct sk_buff *skb, struc
+       */
+       int requeue = 0;
+ #ifdef ATH_SUPERG_FF
++      struct ether_header *eh;
+       unsigned int pktlen;
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_node *an;
+@@ -3316,27 +3316,9 @@ ath_hardstart(struct sk_buff *skb, struc
+               requeue = 1;
+               goto hardstart_fail;
+       }
+-#endif
+-      /* If the skb data is shared, we will copy it so we can strip padding
+-       * without affecting any other bridge ports. */
+-      if (skb_cloned(skb)) {
+-              /* Remember the original SKB so we can free up our references */
+-              struct sk_buff *skb_new;
+-              skb_new = skb_copy(skb, GFP_ATOMIC);
+-              if (skb_new == NULL) {
+-                      DPRINTF(sc, ATH_DEBUG_XMIT,
+-                              "Dropping; skb_copy failure.\n");
+-                      /* No free RAM, do not requeue! */
+-                      goto hardstart_fail;
+-              }
+-              ieee80211_skb_copy_noderef(skb, skb_new);
+-              ieee80211_dev_kfree_skb(&skb);
+-              skb = skb_new;
+-      }
+       eh = (struct ether_header *)skb->data;
+-#ifdef ATH_SUPERG_FF
+       /* NB: use this lock to protect an->an_tx_ffbuf (and txq->axq_stageq)
+        *     in athff_can_aggregate() call too. */
+       ATH_TXQ_LOCK_IRQ(txq);
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -283,7 +283,7 @@ ieee80211_hardstart(struct sk_buff *skb,
+        * normal vap. */
+       if (vap->iv_xrvap && (ni == vap->iv_bss) &&
+           vap->iv_xrvap->iv_sta_assoc) {
+-              struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
++              struct sk_buff *skb1 = skb_clone(skb, GFP_ATOMIC);
+               if (skb1) {
+                       memset(SKB_CB(skb1), 0, sizeof(struct ieee80211_cb));
+ #ifdef IEEE80211_DEBUG_REFCNT
+@@ -566,7 +566,7 @@ ieee80211_skbhdr_adjust(struct ieee80211
+       struct ieee80211_key *key, struct sk_buff *skb, int ismulticast)
+ {
+       /* XXX pre-calculate per node? */
+-      int need_headroom = LLC_SNAPFRAMELEN + hdrsize + IEEE80211_ADDR_LEN;
++      int need_headroom = LLC_SNAPFRAMELEN + hdrsize;
+       int need_tailroom = 0;
+ #ifdef ATH_SUPERG_FF
+       int isff = ATH_FF_MAGIC_PRESENT(skb);
+@@ -608,109 +608,56 @@ ieee80211_skbhdr_adjust(struct ieee80211
+                               need_tailroom += cip->ic_miclen;
+       }
+-      if (skb_shared(skb)) {
+-              /* Take our own reference to the node in the clone */
+-              ieee80211_ref_node(SKB_CB(skb)->ni);
+-              /* Unshare the node, decrementing users in the old skb */
+-              skb = skb_unshare(skb, GFP_ATOMIC);
++      need_headroom -= skb_headroom(skb);
++      if (isff)
++              need_tailroom -= skb_tailroom(skb2);
++      else
++              need_tailroom -= skb_tailroom(skb);
++
++      if (need_headroom < 0)
++              need_headroom = 0;
++      if (need_tailroom < 0)
++              need_tailroom = 0;
++
++      if (skb_cloned(skb) || (need_headroom > 0) ||
++              (!isff && (need_tailroom > 0))) {
++
++              if (pskb_expand_head(skb, need_headroom, need_tailroom, GFP_ATOMIC)) {
++                      IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
++                              "%s: cannot expand storage (tail)\n", __func__);
++                      goto error;
++              }
+       }
+ #ifdef ATH_SUPERG_FF
+       if (isff) {
+-              if (skb == NULL) {
+-                      IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                              "%s: cannot unshare for encapsulation\n",
+-                              __func__);
+-                      vap->iv_stats.is_tx_nobuf++;
+-                      ieee80211_dev_kfree_skb(&skb2);
+-
+-                      return NULL;
+-              }
++              inter_headroom -= skb_headroom(skb2);
++              if (inter_headroom < 0)
++                      inter_headroom = 0;
++              if ((skb_cloned(skb2) ||
++                      (inter_headroom > 0) || (need_tailroom > 0))) {
+-              /* first skb header */
+-              if (skb_headroom(skb) < need_headroom) {
+-                      struct sk_buff *tmp = skb;
+-                      skb = skb_realloc_headroom(skb, need_headroom);
+-                      if (skb == NULL) {
++                      if (pskb_expand_head(skb2, inter_headroom,
++                              need_tailroom, GFP_ATOMIC)) {
+                               IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                                      "%s: cannot expand storage (head1)\n",
+-                                      __func__);
+-                              vap->iv_stats.is_tx_nobuf++;
+-                              ieee80211_dev_kfree_skb(&skb2);
+-                              return NULL;
+-                      } else
+-                              ieee80211_skb_copy_noderef(tmp, skb);
+-                      ieee80211_dev_kfree_skb(&tmp);
+-                      /* NB: cb[] area was copied, but not next ptr. must do that
+-                       *     prior to return on success. */
+-              }
+-
+-              /* second skb with header and tail adjustments possible */
+-              if (skb_tailroom(skb2) < need_tailroom) {
+-                      int n = 0;
+-                      if (inter_headroom > skb_headroom(skb2))
+-                              n = inter_headroom - skb_headroom(skb2);
+-                      if (pskb_expand_head(skb2, n,
+-                          need_tailroom - skb_tailroom(skb2), GFP_ATOMIC)) {
+-                              ieee80211_dev_kfree_skb(&skb2);
+-                              IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                                      "%s: cannot expand storage (tail2)\n",
+-                                      __func__);
+-                              vap->iv_stats.is_tx_nobuf++;
+-                              /* this shouldn't happen, but don't send first ff either */
+-                              ieee80211_dev_kfree_skb(&skb);
++                                      "%s: cannot expand storage (tail)\n", __func__);
++                              goto error;
+                       }
+-              } else if (skb_headroom(skb2) < inter_headroom) {
+-                      struct sk_buff *tmp = skb2;
+-
+-                      skb2 = skb_realloc_headroom(skb2, inter_headroom);
+-                      if (skb2 == NULL) {
+-                              IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                                      "%s: cannot expand storage (head2)\n",
+-                                      __func__);
+-                              vap->iv_stats.is_tx_nobuf++;
+-                              /* this shouldn't happen, but don't send first ff either */
+-                              ieee80211_dev_kfree_skb(&skb);
+-                              skb = NULL;
+-                      } else
+-                              ieee80211_skb_copy_noderef(tmp, skb);
+-                      ieee80211_dev_kfree_skb(&tmp);
+               }
+-              if (skb) {
+-                      skb->next = skb2;
+-              }
+-              return skb;
++              skb->next = skb2;
+       }
+ #endif /* ATH_SUPERG_FF */
+-      if (skb == NULL) {
+-              IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                      "%s: cannot unshare for encapsulation\n", __func__);
+-              vap->iv_stats.is_tx_nobuf++;
+-      } else if (skb_tailroom(skb) < need_tailroom) {
+-              int n = 0;
+-              if (need_headroom > skb_headroom(skb))
+-                      n = need_headroom - skb_headroom(skb);
+-              if (pskb_expand_head(skb, n, need_tailroom - 
+-                                      skb_tailroom(skb), GFP_ATOMIC)) {
+-                      IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                              "%s: cannot expand storage (tail)\n", __func__);
+-                      vap->iv_stats.is_tx_nobuf++;
+-                      ieee80211_dev_kfree_skb(&skb);
+-              }
+-      } else if (skb_headroom(skb) < need_headroom) {
+-              struct sk_buff *tmp = skb;
+-              skb = skb_realloc_headroom(skb, need_headroom);
+-              /* Increment reference count after copy */
+-              if (skb == NULL) {
+-                      IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+-                              "%s: cannot expand storage (head)\n", __func__);
+-                      vap->iv_stats.is_tx_nobuf++;
+-              } else
+-                      ieee80211_skb_copy_noderef(tmp, skb);
+-              ieee80211_dev_kfree_skb(&tmp);
+-      }
+       return skb;
++
++error:
++      vap->iv_stats.is_tx_nobuf++;
++      ieee80211_dev_kfree_skb(&skb);
++#ifdef ATH_SUPERG_FF
++      if (skb2)
++              ieee80211_dev_kfree_skb(&skb2);
++#endif
++      return NULL;
+ }
+ #define       KEY_UNDEFINED(k)        ((k).wk_cipher == &ieee80211_cipher_none)
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -204,7 +204,6 @@ ieee80211_input(struct ieee80211vap * va
+       struct ieee80211_frame *wh;
+       struct ieee80211_key *key;
+       struct ether_header *eh;
+-      struct sk_buff *skb2;
+ #ifdef ATH_SUPERG_FF
+       struct llc *llc;
+ #endif
+@@ -244,20 +243,6 @@ ieee80211_input(struct ieee80211vap * va
+               vap->iv_stats.is_rx_tooshort++;
+               goto out;
+       }
+-      /* Clone the SKB... we assume somewhere in this driver that we 'own'
+-       * the skbuff passed into hard start and we do a lot of messing with it
+-       * but bridges under some cases will not clone for the first pass of skb
+-       * to a bridge port, but will then clone for subsequent ones.  This is 
+-       * odd behavior but it means that if we have trashed the skb we are given
+-       * then other ports get clones of the residual garbage.
+-       */
+-      if ((skb2 = skb_copy(skb, GFP_ATOMIC)) == NULL) {
+-              vap->iv_devstats.tx_dropped++;
+-              goto out;
+-      }
+-      ieee80211_skb_copy_noderef(skb, skb2);
+-      ieee80211_dev_kfree_skb(&skb);
+-      skb = skb2;
+       /*
+        * Bit of a cheat here, we use a pointer for a 3-address
+@@ -738,7 +723,7 @@ ieee80211_input(struct ieee80211vap * va
+                       /* ether_type must be length as FF frames are always LLC/SNAP encap'd */ 
+                       frame_len = ntohs(eh_tmp->ether_type); 
+-                      skb1 = skb_copy(skb, GFP_ATOMIC);
++                      skb1 = skb_clone(skb, GFP_ATOMIC);
+                       if (skb1 == NULL)
+                               goto err;
+                       ieee80211_skb_copy_noderef(skb, skb1);
+@@ -1137,7 +1122,7 @@ ieee80211_deliver_data(struct ieee80211_
+               if (ETHER_IS_MULTICAST(eh->ether_dhost) && !netif_queue_stopped(dev)) {
+                       /* Create a SKB for the BSS to send out. */
+-                      skb1 = skb_copy(skb, GFP_ATOMIC);
++                      skb1 = skb_clone(skb, GFP_ATOMIC);
+                       if (skb1)
+                               SKB_CB(skb1)->ni = ieee80211_ref_node(vap->iv_bss); 
+               }
diff --git a/net/madwifi/patches/343-txqueue_races.patch b/net/madwifi/patches/343-txqueue_races.patch
new file mode 100644 (file)
index 0000000..a2b14d6
--- /dev/null
@@ -0,0 +1,34 @@
+Merged from madwifi trunk r3551, r3552
+
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8253,6 +8253,17 @@ ath_tx_processq(struct ath_softc *sc, st
+                       goto bf_fail;
+               }
++              /* We make sure we don't remove the TX descriptor on
++               * which the HW is pointing since it contains the
++               * ds_link field, except if this is the last TX
++               * descriptor in the queue */
++
++              if ((txq->axq_depth > 1) &&
++                  (bf->bf_daddr == ath_hal_gettxbuf(ah, txq->axq_qnum))) {
++                      ATH_TXQ_UNLOCK_IRQ_EARLY(txq);
++                      goto bf_fail;
++              }
++
+               ATH_TXQ_REMOVE_HEAD(txq, bf_list);
+               ATH_TXQ_UNLOCK_IRQ(txq);
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -586,7 +586,8 @@ struct ath_vap {
+ } while (0)
+ #define ATH_TXQ_REMOVE_HEAD(_tq, _field) do { \
+       STAILQ_REMOVE_HEAD(&(_tq)->axq_q, _field); \
+-      (_tq)->axq_depth--; \
++      if (--(_tq)->axq_depth <= 0) \
++              (_tq)->axq_link = NULL; \
+ } while (0)
+ /* move buffers from MCASTQ to CABQ */
+ #define ATH_TXQ_MOVE_MCASTQ(_tqs,_tqd) do { \
diff --git a/net/madwifi/patches/344-minstrel_failcnt.patch b/net/madwifi/patches/344-minstrel_failcnt.patch
new file mode 100644 (file)
index 0000000..ea92dc4
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -475,7 +475,7 @@ ath_rate_tx_complete(struct ath_softc *s
+               /* 'tries' is the total number of times we have endeavoured to
+                * send this packet, and is a sum of the #attempts at each
+                * level in the multi-rate retry chain */
+-              tries = ts->ts_shortretry + ts->ts_longretry + 1;
++              tries = ts->ts_longretry + 1;
+               if (sn->num_rates <= 0) {
+                       DPRINTF(sc, "%s: " MAC_FMT " %s no rates yet\n", dev_info,
diff --git a/net/madwifi/patches/345-minstrel_sampling.patch b/net/madwifi/patches/345-minstrel_sampling.patch
new file mode 100644 (file)
index 0000000..d89990c
--- /dev/null
@@ -0,0 +1,80 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8103,6 +8103,7 @@ ath_tx_start(struct net_device *dev, str
+               ath_hal_setupxtxdesc(sc->sc_ah, ds, mrr.rate1, mrr.retries1,
+                                    mrr.rate2, mrr.retries2,
+                                    mrr.rate3, mrr.retries3);
++              bf->rcflags = mrr.privflags;
+       }
+ #ifndef ATH_SUPERG_FF
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -446,6 +446,7 @@ struct ath_buf {
+       u_int16_t bf_flags;                             /* tx descriptor flags */
+       u_int64_t bf_tsf;
+       int16_t bf_channoise;
++      unsigned int rcflags;
+ #ifdef ATH_SUPERG_FF
+       /* XXX: combine this with bf_skbaddr if it ever changes to accommodate
+        *      multiple segments.
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -333,15 +333,19 @@ ath_rate_findrate(struct ath_softc *sc, 
+               if (sn->static_rate_ndx >= 0) {
+                           ndx = sn->static_rate_ndx;
+               } else {
++                      int delta;
+                       sn->packet_count++;
+                       sn->random_n = (sn->a * sn->random_n) + sn->b;
+                       offset = sn->random_n & 0xf;
+-                      if ((((100 * sn->sample_count) / (sn->sample_count + sn->packet_count)) < ath_lookaround_rate) && (offset < 2)) {
++                      delta = (sn->packet_count * ath_lookaround_rate / 100) - sn->sample_count;
++                      if ((delta > 0) && (offset < 2)) {
+                               sn->sample_count++;
+                               sn->is_sampling = 1;
+                               if (sn->packet_count >= 10000) {
+                                       sn->sample_count = 0;
+                                       sn->packet_count = 0;
++                              } else if (delta > sn->num_rates * 2) {
++                                      sn->sample_count += ((delta - sn->num_rates * 2) * ath_lookaround_rate) / 100;
+                               }
+                               /* Don't look for slowest rate (i.e. slowest
+@@ -398,11 +402,14 @@ ath_rate_get_mrr(struct ath_softc *sc, s
+               if (sn->num_rates <= 0)
+                       return;
++              mrr->privflags = sn->is_sampling;
+               if (sn->is_sampling) {
+                       sn->is_sampling = 0;
+-                      if (sn->rs_sample_rate_slower)
++                      if (sn->rs_sample_rate_slower) {
+                               rc1 = sn->rs_sample_rate;
+-                      else
++                              if (sn->sample_count > 0)
++                                      sn->sample_count--;
++                      } else
+                               rc1 = sn->max_tp_rate;
+               } else {
+                       rc1 = sn->max_tp_rate2;
+@@ -525,6 +532,9 @@ ath_rate_tx_complete(struct ath_softc *s
+               if (tries <= tries1)
+                       return;
++              if (bf->rcflags)
++                      sn->sample_count++;
++
+               if  (tries2 < 0)
+                       return;
+               tries = tries - tries1;
+--- a/net80211/ieee80211_rate.h
++++ b/net80211/ieee80211_rate.h
+@@ -87,6 +87,7 @@ struct ieee80211_mrr {
+       int retries2;
+       int rate3;
+       int retries3;
++      int privflags;
+ };
+ struct ieee80211_rate_ops {
diff --git a/net/madwifi/patches/346-protmode_trig.patch b/net/madwifi/patches/346-protmode_trig.patch
new file mode 100644 (file)
index 0000000..830a6a8
--- /dev/null
@@ -0,0 +1,135 @@
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -333,7 +333,9 @@ ieee80211_ifattach(struct ieee80211com *
+                       IEEE80211_MS_TO_TU(IEEE80211_BMISSTHRESH_DEFAULT_MS), 
+                       ic->ic_lintval), ic->ic_lintval);
+       }
+-              
++      ic->ic_protmode_timeout = IEEE80211_PROTMODE_TIMEOUT;
++      ic->ic_protmode_rssi = IEEE80211_PROTMODE_RSSITHR;
++
+       IEEE80211_LOCK_INIT(ic, "ieee80211com");
+       IEEE80211_VAPS_LOCK_INIT(ic, "ieee80211com_vaps");
+       TAILQ_INIT(&ic->ic_vaps);
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3411,14 +3411,18 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
+                       /* Assume no ERP IE == 11b AP */
+-                      if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
+-                              !(ic->ic_flags & IEEE80211_F_USEPROT)) {
++                      if ((!has_erp || (has_erp &&
++                              (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
++                              (rssi > ic->ic_protmode_rssi)) {
+                               struct ieee80211vap *tmpvap;
+-                              ic->ic_flags |= IEEE80211_F_USEPROT;
+-                              TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
+-                                      tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                              if (!(ic->ic_flags & IEEE80211_F_USEPROT)) {
++                                      ic->ic_flags |= IEEE80211_F_USEPROT;
++                                      TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++                                              tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++                                      }
+                               }
++                              ic->ic_protmode_lasttrig = jiffies;
+                       }
+               }
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -643,6 +643,8 @@ enum {
+       IEEE80211_PARAM_BEACON_MISS_THRESH_MS   = 74,   /* Beacon miss threshold (in ms) */
+       IEEE80211_PARAM_MAXRATE                 = 75,   /* Maximum rate (by table index) */
+       IEEE80211_PARAM_MINRATE                 = 76,   /* Minimum rate (by table index) */
++      IEEE80211_PARAM_PROTMODE_RSSI           = 77,   /* RSSI Threshold for enabling protection mode */
++      IEEE80211_PARAM_PROTMODE_TIMEOUT        = 78,   /* Timeout for expiring protection mode */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -128,6 +128,9 @@
+ #define       IEEE80211_APPIE_MAX     1024
++#define IEEE80211_PROTMODE_RSSITHR    15      /* default rssi threshold for protection mode trigger */
++#define IEEE80211_PROTMODE_TIMEOUT    30      /* timeout for keeping protection mode alive */
++
+ #define IEEE80211_PWRCONSTRAINT_VAL(ic) \
+       (((ic)->ic_bsschan->ic_maxregpower > (ic)->ic_curchanmaxpwr) ? \
+           (ic)->ic_bsschan->ic_maxregpower - (ic)->ic_curchanmaxpwr : 0)
+@@ -324,6 +327,9 @@ struct ieee80211com {
+       u_int16_t ic_newtxpowlimit;             /* tx power limit to change to (in 0.5 dBm) */
+       u_int16_t ic_uapsdmaxtriggers;          /* max triggers that could arrive */
+       u_int8_t ic_coverageclass;              /* coverage class */
++      u_int8_t ic_protmode_rssi;                      /* rssi threshold for protection mode */
++      u_int64_t ic_protmode_lasttrig;         /* last trigger for protection mode */
++      u_int16_t ic_protmode_timeout;          /* protection mode timeout */
+       /* Channel state:
+        *
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2312,6 +2312,12 @@ ieee80211_ioctl_setparam(struct net_devi
+                   IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan))
+                       retv = ENETRESET;
+               break;
++      case IEEE80211_PARAM_PROTMODE_TIMEOUT:
++              ic->ic_protmode_timeout = value;
++              break;
++      case IEEE80211_PARAM_PROTMODE_RSSI:
++              ic->ic_protmode_rssi = value;
++              break;
+       case IEEE80211_PARAM_MCASTCIPHER:
+               if ((vap->iv_caps & cipher2cap(value)) == 0 &&
+                   !ieee80211_crypto_available(vap, value))
+@@ -2955,6 +2961,12 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_PROTMODE:
+               param[0] = ic->ic_protmode;
+               break;
++      case IEEE80211_PARAM_PROTMODE_TIMEOUT:
++              param[0] = ic->ic_protmode_timeout;
++              break;
++      case IEEE80211_PARAM_PROTMODE_RSSI:
++              param[0] = ic->ic_protmode_rssi;
++              break;
+       case IEEE80211_PARAM_MCASTCIPHER:
+               param[0] = rsn->rsn_mcastcipher;
+               break;
+@@ -5346,6 +5358,14 @@ static const struct iw_priv_args ieee802
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "protmode" },
+       { IEEE80211_PARAM_PROTMODE,
+         0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_protmode" },
++      { IEEE80211_PARAM_PROTMODE_RSSI,
++        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "protrssi" },
++      { IEEE80211_PARAM_PROTMODE_RSSI,
++        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_protrssi" },
++      { IEEE80211_PARAM_PROTMODE_TIMEOUT,
++        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "prottime" },
++      { IEEE80211_PARAM_PROTMODE_TIMEOUT,
++        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_prottime" },
+       { IEEE80211_PARAM_MCASTCIPHER,
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "mcastcipher" },
+       { IEEE80211_PARAM_MCASTCIPHER,
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -1877,6 +1877,17 @@ ieee80211_node_timeout(unsigned long arg
+       ieee80211_scan_timeout(ic);
+       ieee80211_timeout_stations(&ic->ic_sta);
++      if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
++              (ic->ic_protmode_lasttrig + ic->ic_protmode_timeout * HZ <
++                      jiffies)) {
++              struct ieee80211vap *tmpvap;
++
++              /* expire protection mode */
++              ic->ic_flags &= ~IEEE80211_F_USEPROT;
++              TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++                      tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++              }
++      }
+       ic->ic_inact.expires = jiffies + IEEE80211_INACT_WAIT * HZ;
+       add_timer(&ic->ic_inact);
diff --git a/net/madwifi/patches/347-tuning.patch b/net/madwifi/patches/347-tuning.patch
new file mode 100644 (file)
index 0000000..1a73c42
--- /dev/null
@@ -0,0 +1,99 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -10276,11 +10276,11 @@ ath_setcurmode(struct ath_softc *sc, enu
+       sc->sc_currates = rt;
+       sc->sc_curmode = mode;
+       /*
+-       * All protection frames are transmitted at 2Mb/s for
+-       * 11g, otherwise at 1Mb/s.
++       * All protection frames are transmitted at 11Mb/s for
++       * 11g, otherwise at 2Mb/s.
+        * XXX select protection rate index from rate table.
+        */
+-      sc->sc_protrix = (mode == IEEE80211_MODE_11G ? 1 : 0);
++      sc->sc_protrix = (mode == IEEE80211_MODE_11G ? 3 : 1);
+       /* rate index used to send mgt frames */
+       sc->sc_minrateix = 0;
+ }
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -272,6 +272,10 @@ static inline struct net_device *_alloc_
+ #define AES_ICV_FIELD_SIZE      8       /* AES ICV field size */
+ #define EXT_IV_FIELD_SIZE       4       /* ext IV field size */
++/* This is what the HAL uses by default for 11a+g */
++#define ATH_DEFAULT_CWMIN     15
++#define ATH_DEFAULT_CWMAX     1023
++
+ /* XR specific macros */
+ #define XR_DEFAULT_GRPPOLL_RATE_STR   "0.25 1 1 3 3 6 6 20"
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -197,7 +197,7 @@ calc_usecs_unicast_packet(struct ath_sof
+               unsigned int x = 0, tt = 0;
+               unsigned int cix = rt->info[rix].controlRate;
+               int rts = 0, cts = 0;
+-              int cw = WIFI_CW_MIN;
++              int cw = ATH_DEFAULT_CWMIN;
+               KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+@@ -281,7 +281,7 @@ calc_usecs_unicast_packet(struct ath_sof
+               tt += (long_retries + 1) * ath_hal_computetxtime(sc->sc_ah, rt, length,
+                                                       rix, AH_TRUE);
+               for (x = 0; x <= short_retries + long_retries; x++) {
+-                      cw = MIN(WIFI_CW_MAX, (cw + 1) * 2);
++                      cw = MIN(ATH_DEFAULT_CWMAX, (cw + 1) * 2);
+                       tt += (t_slot * cw / 2);
+               }
+               return tt;
+--- a/ath_rate/minstrel/minstrel.h
++++ b/ath_rate/minstrel/minstrel.h
+@@ -180,14 +180,6 @@ struct minstrel_node {
+ #define MAX(a,b)        ((a) > (b) ? (a) : (b))
+ #endif
+-#if 0
+-#define WIFI_CW_MIN 31
+-#define WIFI_CW_MAX 1023
+-#else
+-#define WIFI_CW_MIN 3
+-#define WIFI_CW_MAX 10
+-#endif
+-
+ /*
+  * Definitions for pulling the rate and trie counts from
+  * a 5212 h/w descriptor. These Don't belong here; the
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -170,7 +170,7 @@ calc_usecs_unicast_packet(struct ath_sof
+       struct ieee80211com *ic = &sc->sc_ic;
+       unsigned int tt = 0;
+       unsigned int x;
+-      unsigned int cw = WIFI_CW_MIN;
++      unsigned int cw = ATH_DEFAULT_CWMIN;
+       unsigned int cix = rt->info[rix].controlRate;
+       KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+@@ -254,7 +254,7 @@ calc_usecs_unicast_packet(struct ath_sof
+       tt += (long_retries+1)*ath_hal_computetxtime(sc->sc_ah, rt, length,
+                                               rix, AH_TRUE);
+       for (x = 0; x <= short_retries + long_retries; x++) {
+-              cw = MIN(WIFI_CW_MAX, (cw + 1) * 2);
++              cw = MIN(ATH_DEFAULT_CWMAX, (cw + 1) * 2);
+               tt += (t_slot * cw / 2);
+       }
+       return tt;
+--- a/ath_rate/sample/sample.h
++++ b/ath_rate/sample/sample.h
+@@ -106,9 +106,6 @@ struct sample_node {
+ #define MAX(a,b)        ((a) > (b) ? (a) : (b))
+ #endif
+-#define WIFI_CW_MIN 31
+-#define WIFI_CW_MAX 1023
+-
+ /*
+  * Definitions for pulling the rate and trie counts from
+  * a 5212 h/w descriptor. These Don't belong here; the
diff --git a/net/madwifi/patches/348-ackcts.patch b/net/madwifi/patches/348-ackcts.patch
new file mode 100644 (file)
index 0000000..42b6fe2
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2723,6 +2723,9 @@ ar_device(int devid)
+ static int
+ ath_set_ack_bitrate(struct ath_softc *sc, int high)
+ {
++      if (!sc->sc_ackrate_override)
++              return 0;
++
+       if (ar_device(sc->devid) == 5212 || ar_device(sc->devid) == 5213) {
+               /* set ack to be sent at low bit-rate */
+               /* registers taken from the OpenBSD 5212 HAL */
+@@ -10791,8 +10794,13 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                               break;
+ #endif
+                       case ATH_ACKRATE:
+-                              sc->sc_ackrate = val;
+-                              ath_set_ack_bitrate(sc, sc->sc_ackrate);
++                              if (val == -1)
++                                      sc->sc_ackrate_override = 0;
++                              else {
++                                      sc->sc_ackrate_override = 1;
++                                      sc->sc_ackrate = val;
++                                      ath_set_ack_bitrate(sc, sc->sc_ackrate);
++                              }
+                               break;
+                       case ATH_RP:
+                               ath_rp_record(sc,
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -681,6 +681,7 @@ struct ath_softc {
+       unsigned int    sc_devstopped:1;        /* stopped due to of no tx bufs */
+       unsigned int    sc_stagbeacons:1;       /* use staggered beacons */
+       unsigned int    sc_dfswait:1;           /* waiting on channel for radar detect */
++      unsigned int    sc_ackrate_override:1;  /* override ack rate */
+       unsigned int    sc_ackrate:1;           /* send acks at high bitrate */
+       unsigned int    sc_dfs_cac:1;           /* waiting on channel for radar detect */
+       unsigned int    sc_hasintmit:1;         /* Interference mitigation */
diff --git a/net/madwifi/patches/349-reset.patch b/net/madwifi/patches/349-reset.patch
new file mode 100644 (file)
index 0000000..06e3fa8
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8864,8 +8864,7 @@ ath_chan_set(struct ath_softc *sc, struc
+                * needed to do the reset with chanchange = AH_FALSE in order
+                * to receive traffic when peforming high velocity channel
+                * changes. */
+-              if (!ath_hal_reset(ah, sc->sc_opmode, &hchan, AH_TRUE, &status)   ||
+-                  !ath_hal_reset(ah, sc->sc_opmode, &hchan, AH_FALSE, &status)) {
++              if (!ath_hal_reset(ah, sc->sc_opmode, &hchan, AH_TRUE, &status)) {
+                       EPRINTF(sc, "Unable to reset channel %u (%u MHz) "
+                               "flags 0x%x '%s' (HAL status %u)\n",
+                               ieee80211_chan2ieee(ic, chan), chan->ic_freq,
diff --git a/net/madwifi/patches/350-wisoc_softled.patch b/net/madwifi/patches/350-wisoc_softled.patch
new file mode 100644 (file)
index 0000000..dae9f21
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
+@@ -245,6 +245,8 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+       num_activesc++;
+       /* Ready to process interrupts */
++      sc->aps_sc.sc_softled = 1; /* SoftLED over GPIO */
++      sc->aps_sc.sc_ledpin = config->board->sysLedGpio;
+       sc->aps_sc.sc_invalid = 0;
+       return 0;
diff --git a/net/madwifi/patches/351-scanlist.patch b/net/madwifi/patches/351-scanlist.patch
new file mode 100644 (file)
index 0000000..c11f28e
--- /dev/null
@@ -0,0 +1,904 @@
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -317,147 +317,6 @@ found:
+ #undef ISPROBE
+ }
+-static struct ieee80211_channel *
+-find11gchannel(struct ieee80211com *ic, int i, int freq)
+-{
+-      struct ieee80211_channel *c;
+-      int j;
+-
+-      /*
+-       * The normal ordering in the channel list is b channel
+-       * immediately followed by g so optimize the search for
+-       * this.  We'll still do a full search just in case.
+-       */
+-      for (j = i+1; j < ic->ic_nchans; j++) {
+-              c = &ic->ic_channels[j];
+-              if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
+-                      return c;
+-      }
+-      for (j = 0; j < i; j++) {
+-              c = &ic->ic_channels[j];
+-              if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
+-                      return c;
+-      }
+-      return NULL;
+-}
+-static const u_int chanflags[] = {
+-      IEEE80211_CHAN_B,       /* IEEE80211_MODE_AUTO */
+-      IEEE80211_CHAN_A,       /* IEEE80211_MODE_11A */
+-      IEEE80211_CHAN_B,       /* IEEE80211_MODE_11B */
+-      IEEE80211_CHAN_PUREG,   /* IEEE80211_MODE_11G */
+-      IEEE80211_CHAN_FHSS,    /* IEEE80211_MODE_FH */
+-      IEEE80211_CHAN_A,       /* IEEE80211_MODE_TURBO_A */ /* for turbo mode look for AP in normal channel */
+-      IEEE80211_CHAN_PUREG,   /* IEEE80211_MODE_TURBO_G */
+-      IEEE80211_CHAN_ST,      /* IEEE80211_MODE_TURBO_STATIC_A */
+-};
+-
+-static void
+-add_channels(struct ieee80211com *ic,
+-      struct ieee80211_scan_state *ss,
+-      enum ieee80211_phymode mode, const u_int16_t freq[], int nfreq)
+-{
+-      struct ieee80211_channel *c, *cg;
+-      u_int modeflags;
+-      int i;
+-
+-      KASSERT(mode < ARRAY_SIZE(chanflags), ("Unexpected mode %u", mode));
+-      modeflags = chanflags[mode];
+-      for (i = 0; i < nfreq; i++) {
+-              c = ieee80211_find_channel(ic, freq[i], modeflags);
+-              if (c == NULL || isclr(ic->ic_chan_active, c->ic_ieee))
+-                      continue;
+-              if (mode == IEEE80211_MODE_AUTO) {
+-                      /*
+-                       * XXX special-case 11b/g channels so we select
+-                       *     the g channel if both are present.
+-                       */
+-                      if (IEEE80211_IS_CHAN_B(c) &&
+-                          (cg = find11gchannel(ic, i, c->ic_freq)) != NULL)
+-                              c = cg;
+-              }
+-              if (ss->ss_last >= IEEE80211_SCAN_MAX)
+-                      break;
+-              ss->ss_chans[ss->ss_last++] = c;
+-      }
+-}
+-
+-static const u_int16_t rcl1[] =               /* 8 FCC channel: 52, 56, 60, 64, 36, 40, 44, 48 */
+-{ 5260, 5280, 5300, 5320, 5180, 5200, 5220, 5240 };
+-static const u_int16_t rcl2[] =               /* 4 MKK channels: 34, 38, 42, 46 */
+-{ 5170, 5190, 5210, 5230 };
+-static const u_int16_t rcl3[] =               /* 2.4Ghz ch: 1,6,11,7,13 */
+-{ 2412, 2437, 2462, 2442, 2472 };
+-static const u_int16_t rcl4[] =               /* 5 FCC channel: 149, 153, 161, 165 */
+-{ 5745, 5765, 5785, 5805, 5825 };
+-static const u_int16_t rcl7[] =               /* 11 ETSI channel: 100,104,108,112,116,120,124,128,132,136,140 */
+-{ 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700 };
+-static const u_int16_t rcl8[] =               /* 2.4Ghz ch: 2,3,4,5,8,9,10,12 */
+-{ 2417, 2422, 2427, 2432, 2447, 2452, 2457, 2467 };
+-static const u_int16_t rcl9[] =               /* 2.4Ghz ch: 14 */
+-{ 2484 };
+-static const u_int16_t rcl10[] =      /* Added Korean channels 2312-2372 */
+-{ 2312, 2317, 2322, 2327, 2332, 2337, 2342, 2347, 2352, 2357, 2362, 2367, 2372 };
+-static const u_int16_t rcl11[] =      /* Added Japan channels in 4.9/5.0 spectrum */
+-{ 5040, 5060, 5080, 4920, 4940, 4960, 4980 };
+-#ifdef ATH_TURBO_SCAN
+-static const u_int16_t rcl5[] =               /* 3 static turbo channels */
+-{ 5210, 5250, 5290 };
+-static const u_int16_t rcl6[] =               /* 2 static turbo channels */
+-{ 5760, 5800 };
+-static const u_int16_t rcl6x[] =              /* 4 FCC3 turbo channels */
+-{ 5540, 5580, 5620, 5660 };
+-static const u_int16_t rcl12[] =              /* 2.4Ghz Turbo channel 6 */
+-{ 2437 };
+-static const u_int16_t rcl13[] =              /* dynamic Turbo channels */
+-{ 5200, 5240, 5280, 5765, 5805 };
+-#endif /* ATH_TURBO_SCAN */
+-
+-struct scanlist {
+-      u_int16_t       mode;
+-      u_int16_t       count;
+-      const u_int16_t *list;
+-};
+-
+-#define       IEEE80211_MODE_TURBO_STATIC_A   IEEE80211_MODE_MAX
+-#define       X(a)    .count = sizeof(a)/sizeof(a[0]), .list = a
+-
+-static const struct scanlist staScanTable[] = {
+-      { IEEE80211_MODE_11B,                   X(rcl3) },
+-      { IEEE80211_MODE_11A,                   X(rcl1) },
+-      { IEEE80211_MODE_11A,                   X(rcl2) },
+-      { IEEE80211_MODE_11B,                   X(rcl8) },
+-      { IEEE80211_MODE_11B,                   X(rcl9) },
+-      { IEEE80211_MODE_11A,                   X(rcl4) },
+-#ifdef ATH_TURBO_SCAN
+-      { IEEE80211_MODE_TURBO_STATIC_A,        X(rcl5) },
+-      { IEEE80211_MODE_TURBO_STATIC_A,        X(rcl6) },
+-      { IEEE80211_MODE_TURBO_A,               X(rcl6x) },
+-      { IEEE80211_MODE_TURBO_A,               X(rcl13) },
+-#endif /* ATH_TURBO_SCAN */
+-      { IEEE80211_MODE_11A,                   X(rcl7) },
+-      { IEEE80211_MODE_11B,                   X(rcl10) },
+-      { IEEE80211_MODE_11A,                   X(rcl11) },
+-#ifdef ATH_TURBO_SCAN
+-      { IEEE80211_MODE_TURBO_G,               X(rcl12) },
+-#endif /* ATH_TURBO_SCAN */
+-      { .list = NULL }
+-};
+-
+-#undef X
+-
+-static int
+-checktable(const struct scanlist *scan, const struct ieee80211_channel *c)
+-{
+-      int i;
+-
+-      for (; scan->list != NULL; scan++) {
+-              for (i = 0; i < scan->count; i++)
+-                      if (scan->list[i] == c->ic_freq)
+-                              return 1;
+-      }
+-      return 0;
+-}
+-
+ /*
+  * Start a station-mode scan by populating the channel list.
+  */
+@@ -466,81 +325,14 @@ sta_start(struct ieee80211_scan_state *s
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+       struct sta_table *st = ss->ss_priv;
+-      const struct scanlist *scan;
+       enum ieee80211_phymode mode;
+       struct ieee80211_channel *c;
+       int i;
+       ss->ss_last = 0;
+-      /*
+-       * Use the table of ordered channels to construct the list
+-       * of channels for scanning.  Any channels in the ordered
+-       * list not in the master list will be discarded.
+-       */
+-      for (scan = staScanTable; scan->list != NULL; scan++) {
+-              mode = scan->mode;
+-              if (vap->iv_des_mode != IEEE80211_MODE_AUTO) {
+-                      /*
+-                       * If a desired mode was specified, scan only 
+-                       * channels that satisfy that constraint.
+-                       */
+-                      if (vap->iv_des_mode != mode) {
+-                              /*
+-                               * The scan table marks 2.4Ghz channels as b
+-                               * so if the desired mode is 11g, then use
+-                               * the 11b channel list but upgrade the mode.
+-                               */
+-                              if (vap->iv_des_mode != IEEE80211_MODE_11G ||
+-                                  mode != IEEE80211_MODE_11B)
+-                                      continue;
+-                              mode = IEEE80211_MODE_11G;      /* upgrade */
+-                      }
+-              } else {
+-                      /*
+-                       * This lets ieee80211_scan_add_channels
+-                       * upgrade an 11b channel to 11g if available.
+-                       */
+-                      if (mode == IEEE80211_MODE_11B)
+-                              mode = IEEE80211_MODE_AUTO;
+-              }
+-              /* XR does not operate on turbo channels */
+-              if ((vap->iv_flags & IEEE80211_F_XR) &&
+-                  (mode == IEEE80211_MODE_TURBO_A ||
+-                   mode == IEEE80211_MODE_TURBO_G))
+-                      continue;
+-              /*
+-               * Add the list of the channels; any that are not
+-               * in the master channel list will be discarded.
+-               */
+-              add_channels(ic, ss, mode, scan->list, scan->count);
+-      }
+-
+-      /*
+-       * Add the channels from the ic (from HAL) that are not present
+-       * in the staScanTable.
+-       */
+-      for (i = 0; i < ic->ic_nchans; i++) {
+-              c = &ic->ic_channels[i];
+-              /*
+-               * scan dynamic turbo channels in normal mode.
+-               */
+-              if (IEEE80211_IS_CHAN_DTURBO(c))
+-                      continue;
+-              mode = ieee80211_chan2mode(c);
+-              if (vap->iv_des_mode != IEEE80211_MODE_AUTO) {
+-                      /*
+-                       * If a desired mode was specified, scan only 
+-                       * channels that satisfy that constraint.
+-                       */
+-                      if (vap->iv_des_mode != mode)
+-                              continue;
+-
+-              }
+-              if (!checktable(staScanTable, c))
+-                      ss->ss_chans[ss->ss_last++] = c;
+-      }
+-
++      ieee80211_scan_add_channels(ic, ss, vap->iv_des_mode);
+       ss->ss_next = 0;
++
+       /* XXX tunables */
+       /* 
+        * The scanner will stay on station for ss_maxdwell ms (using a 
+@@ -749,17 +541,7 @@ match_bss(struct ieee80211vap *vap,
+       fail = 0;
+       if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, se->se_chan)))
+               fail |= 0x01;
+-      /*
+-       * NB: normally the desired mode is used to construct
+-       * the channel list, but it's possible for the scan
+-       * cache to include entries for stations outside this
+-       * list so we check the desired mode here to weed them
+-       * out.
+-       */
+-      if (vap->iv_des_mode != IEEE80211_MODE_AUTO &&
+-          (se->se_chan->ic_flags & IEEE80211_CHAN_ALLTURBO) !=
+-          chanflags[vap->iv_des_mode])
+-              fail |= 0x01;
++
+       if (vap->iv_opmode == IEEE80211_M_IBSS) {
+               if ((se->se_capinfo & IEEE80211_CAPINFO_IBSS) == 0)
+                       fail |= 0x02;
+@@ -1168,78 +950,6 @@ static const struct ieee80211_scanner st
+       .scan_default           = ieee80211_sta_join,
+ };
+-/*
+- * Start an adhoc-mode scan by populating the channel list.
+- */
+-static int
+-adhoc_start(struct ieee80211_scan_state *ss, struct ieee80211vap *vap)
+-{
+-      struct ieee80211com *ic = vap->iv_ic;
+-      struct sta_table *st = ss->ss_priv;
+-      const struct scanlist *scan;
+-      enum ieee80211_phymode mode;
+-
+-      ss->ss_last = 0;
+-      /*
+-       * Use the table of ordered channels to construct the list
+-       * of channels for scanning.  Any channels in the ordered
+-       * list not in the master list will be discarded.
+-       */
+-      for (scan = staScanTable; scan->list != NULL; scan++) {
+-              mode = scan->mode;
+-              if (vap->iv_des_mode != IEEE80211_MODE_AUTO) {
+-                      /*
+-                       * If a desired mode was specified, scan only 
+-                       * channels that satisfy that constraint.
+-                       */
+-                      if (vap->iv_des_mode != mode) {
+-                              /*
+-                               * The scan table marks 2.4Ghz channels as b
+-                               * so if the desired mode is 11g, then use
+-                               * the 11b channel list but upgrade the mode.
+-                               */
+-                              if (vap->iv_des_mode != IEEE80211_MODE_11G ||
+-                                  mode != IEEE80211_MODE_11B)
+-                                      continue;
+-                              mode = IEEE80211_MODE_11G;      /* upgrade */
+-                      }
+-              } else {
+-                      /*
+-                       * This lets ieee80211_scan_add_channels
+-                       * upgrade an 11b channel to 11g if available.
+-                       */
+-                      if (mode == IEEE80211_MODE_11B)
+-                              mode = IEEE80211_MODE_AUTO;
+-              }
+-              /* XR does not operate on turbo channels */
+-              if ((vap->iv_flags & IEEE80211_F_XR) &&
+-                  (mode == IEEE80211_MODE_TURBO_A ||
+-                   mode == IEEE80211_MODE_TURBO_G))
+-                      continue;
+-              /*
+-               * Add the list of the channels; any that are not
+-               * in the master channel list will be discarded.
+-               */
+-              add_channels(ic, ss, mode, scan->list, scan->count);
+-      }
+-      ss->ss_next = 0;
+-      /* XXX tunables */
+-      ss->ss_mindwell = msecs_to_jiffies(200);        /* 200ms */
+-      ss->ss_maxdwell = msecs_to_jiffies(200);        /* 200ms */
+-
+-#ifdef IEEE80211_DEBUG
+-      if (ieee80211_msg_scan(vap)) {
+-              printk("%s: scan set ", vap->iv_dev->name);
+-              ieee80211_scan_dump_channels(ss);
+-              printk(" dwell min %ld max %ld\n",
+-                      ss->ss_mindwell, ss->ss_maxdwell);
+-      }
+-#endif /* IEEE80211_DEBUG */
+-
+-      st->st_newscan = 1;
+-
+-      return 0;
+-}
+ /*
+  * Select a channel to start an adhoc network on.
+@@ -1405,7 +1115,7 @@ static const struct ieee80211_scanner ad
+       .scan_name              = "default",
+       .scan_attach            = sta_attach,
+       .scan_detach            = sta_detach,
+-      .scan_start             = adhoc_start,
++      .scan_start             = sta_start,
+       .scan_restart           = sta_restart,
+       .scan_cancel            = sta_cancel,
+       .scan_end               = adhoc_pick_bss,
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -278,6 +278,11 @@ ieee80211_ifattach(struct ieee80211com *
+                       ("channel with bogus ieee number %u", c->ic_ieee));
+               setbit(ic->ic_chan_avail, c->ic_ieee);
++              if (c->ic_scanflags & IEEE80211_NOSCAN_DEFAULT)
++                      c->ic_scanflags |= IEEE80211_NOSCAN_SET;
++              else
++                      c->ic_scanflags &= ~IEEE80211_NOSCAN_SET;
++
+               /* Identify mode capabilities. */
+               if (IEEE80211_IS_CHAN_A(c))
+                       ic->ic_modecaps |= 1 << IEEE80211_MODE_11A;
+@@ -1447,10 +1452,6 @@ ieee80211_media_change(struct net_device
+               vap->iv_fixed_rate = newrate;           /* fixed TX rate */
+               error = -ENETRESET;
+       }
+-      if (vap->iv_des_mode != newmode) {
+-              vap->iv_des_mode = newmode;             /* desired PHY mode */
+-              error = -ENETRESET;
+-      }
+       return error;
+ }
+ EXPORT_SYMBOL(ieee80211_media_change);
+--- a/net80211/_ieee80211.h
++++ b/net80211/_ieee80211.h
+@@ -132,6 +132,11 @@ enum ieee80211_scanmode {
+       IEEE80211_SCAN_FIRST    = 2,    /* take first suitable candidate */
+ };
++enum ieee80211_scanflags {
++      IEEE80211_NOSCAN_DEFAULT = (1 << 0),
++      IEEE80211_NOSCAN_SET     = (1 << 1),
++};
++
+ /*
+  * Channels are specified by frequency and attributes.
+  */
+@@ -142,6 +147,7 @@ struct ieee80211_channel {
+       int8_t ic_maxregpower;  /* maximum regulatory tx power in dBm */
+       int8_t ic_maxpower;     /* maximum tx power in dBm */
+       int8_t ic_minpower;     /* minimum tx power in dBm */
++      u_int8_t ic_scanflags;
+ };
+ #define       IEEE80211_CHAN_MAX      255
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -555,6 +555,7 @@ struct ieee80211req_scan_result {
+ #define       IEEE80211_IOCTL_WDSADDMAC       (SIOCIWFIRSTPRIV+26)
+ #define       IEEE80211_IOCTL_WDSDELMAC       (SIOCIWFIRSTPRIV+28)
+ #define       IEEE80211_IOCTL_KICKMAC         (SIOCIWFIRSTPRIV+30)
++#define       IEEE80211_IOCTL_SETSCANLIST     (SIOCIWFIRSTPRIV+31)
+ enum {
+       IEEE80211_WMMPARAMS_CWMIN       = 1,
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -105,11 +105,6 @@ struct scan_entry {
+ };
+ struct ap_state {
+-      unsigned int as_vap_desired_mode;       /* Used for channel selection, 
+-                                               * vap->iv_des_mode */
+-      unsigned int as_required_mode;          /* Used for channel selection, 
+-                                               * filtered version of 
+-                                               * as_vap_desired_mode */
+       int as_maxrssi[IEEE80211_CHAN_MAX];     /* Used for channel selection */
+       /* These fields are just for scan caching for returning responses to
+@@ -129,131 +124,7 @@ struct ap_state {
+ static int ap_flush(struct ieee80211_scan_state *);
+ static void action_tasklet(IEEE80211_TQUEUE_ARG);
+-static struct ieee80211_channel *find11gchannel(struct ieee80211com *ic, 
+-              int i, int freq);
+-static const u_int chanflags[] = {
+-      IEEE80211_CHAN_B,       /* IEEE80211_MODE_AUTO */
+-      IEEE80211_CHAN_A,       /* IEEE80211_MODE_11A */
+-      IEEE80211_CHAN_B,       /* IEEE80211_MODE_11B */
+-      IEEE80211_CHAN_PUREG,   /* IEEE80211_MODE_11G */
+-      IEEE80211_CHAN_FHSS,    /* IEEE80211_MODE_FH */
+-      IEEE80211_CHAN_A,       /* IEEE80211_MODE_TURBO_A */ /* for turbo mode 
+-                                                            * look for AP in 
+-                                                            * normal channel 
+-                                                            */
+-      IEEE80211_CHAN_PUREG,   /* IEEE80211_MODE_TURBO_G */
+-      IEEE80211_CHAN_ST,      /* IEEE80211_MODE_TURBO_STATIC_A */
+-};
+-
+-static const u_int16_t rcl1[] =               /* 8 FCC channel: 52, 56, 60, 64, 
+-                                       *                36, 40, 44, 48 */
+-{ 5260, 5280, 5300, 5320, 5180, 5200, 5220, 5240 };
+-static const u_int16_t rcl2[] =               /* 4 MKK channels: 34, 38, 42, 46 */
+-{ 5170, 5190, 5210, 5230 };
+-static const u_int16_t rcl3[] =               /* 2.4Ghz ch: 1,6,11,7,13 */
+-{ 2412, 2437, 2462, 2442, 2472 };
+-static const u_int16_t rcl4[] =               /* 5 FCC channel: 149, 153, 161, 165 */
+-{ 5745, 5765, 5785, 5805, 5825 };
+-static const u_int16_t rcl7[] =               /* 11 ETSI channel: 100, 104, 108, 112,
+-                                       *                  116, 120, 124, 128, 
+-                                       *                  132, 136, 140 */
+-{ 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700 };
+-static const u_int16_t rcl8[] =               /* 2.4Ghz ch: 2,3,4,5,8,9,10,12 */
+-{ 2417, 2422, 2427, 2432, 2447, 2452, 2457, 2467 };
+-static const u_int16_t rcl9[] =               /* 2.4Ghz ch: 14 */
+-{ 2484 };
+-static const u_int16_t rcl10[] =      /* Added Korean channels 2312-2372 */
+-{ 2312, 2317, 2322, 2327, 2332, 2337, 2342, 2347, 2352, 2357, 2362, 2367, 2372 };
+-static const u_int16_t rcl11[] =      /* Added Japan channels in 4.9/5.0 spectrum */
+-{ 5040, 5060, 5080, 4920, 4940, 4960, 4980 };
+-#ifdef ATH_TURBO_SCAN
+-static const u_int16_t rcl5[] =               /* 3 static turbo channels */
+-{ 5210, 5250, 5290 };
+-static const u_int16_t rcl6[] =               /* 2 static turbo channels */
+-{ 5760, 5800 };
+-static const u_int16_t rcl6x[] =              /* 4 FCC3 turbo channels */
+-{ 5540, 5580, 5620, 5660 };
+-static const u_int16_t rcl12[] =              /* 2.4Ghz Turbo channel 6 */
+-{ 2437 };
+-static const u_int16_t rcl13[] =              /* dynamic Turbo channels */
+-{ 5200, 5240, 5280, 5765, 5805 };
+-#endif /* ATH_TURBO_SCAN */
+-
+-struct scanlist {
+-      u_int16_t       mode;
+-      u_int16_t       count;
+-      const u_int16_t *list;
+-};
+-
+-#define       IEEE80211_MODE_TURBO_STATIC_A   IEEE80211_MODE_MAX
+-#define       X(a)    .count = ARRAY_SIZE(a), .list = a
+-
+-static const struct scanlist staScanTable[] = {
+-      { IEEE80211_MODE_11B,                   X(rcl3)  },
+-      { IEEE80211_MODE_11A,                   X(rcl1)  },
+-      { IEEE80211_MODE_11A,                   X(rcl2)  },
+-      { IEEE80211_MODE_11B,                   X(rcl8)  },
+-      { IEEE80211_MODE_11B,                   X(rcl9)  },
+-      { IEEE80211_MODE_11A,                   X(rcl4)  },
+-#ifdef ATH_TURBO_SCAN
+-      { IEEE80211_MODE_TURBO_STATIC_A,        X(rcl5)  },
+-      { IEEE80211_MODE_TURBO_STATIC_A,        X(rcl6)  },
+-      { IEEE80211_MODE_TURBO_A,               X(rcl6x) },
+-      { IEEE80211_MODE_TURBO_A,               X(rcl13) },
+-#endif /* ATH_TURBO_SCAN */
+-      { IEEE80211_MODE_11A,                   X(rcl7)  },
+-      { IEEE80211_MODE_11B,                   X(rcl10) },
+-      { IEEE80211_MODE_11A,                   X(rcl11) },
+-#ifdef ATH_TURBO_SCAN
+-      { IEEE80211_MODE_TURBO_G,               X(rcl12) },
+-#endif /* ATH_TURBO_SCAN */
+-      { .list = NULL }
+-};
+-
+-#undef X
+-/* This function must be invoked with locks acquired */
+-static void
+-add_channels(struct ieee80211com *ic,
+-      struct ieee80211_scan_state *ss,
+-      enum ieee80211_phymode mode, const u_int16_t freq[], int nfreq)
+-{
+-      struct ieee80211_channel *c, *cg;
+-      u_int modeflags;
+-      int i;
+-
+-      KASSERT(mode < ARRAY_SIZE(chanflags), ("Unexpected mode %u", mode));
+-      modeflags = chanflags[mode];
+-      for (i = 0; i < nfreq; i++) {
+-              c = ieee80211_find_channel(ic, freq[i], modeflags);
+-              if ((c == NULL) || isclr(ic->ic_chan_active, c->ic_ieee))
+-                      continue;
+-              if (mode == IEEE80211_MODE_AUTO) {
+-                      /* XXX special-case 11b/g channels so we select
+-                       *     the g channel if both are present. */
+-                      if (IEEE80211_IS_CHAN_B(c) &&
+-                          (cg = find11gchannel(ic, i, c->ic_freq)) != NULL)
+-                              c = cg;
+-              }
+-              if (ss->ss_last >= IEEE80211_SCAN_MAX)
+-                      break;
+-              ss->ss_chans[ss->ss_last++] = c;
+-      }
+-}
+-
+-/* This function must be invoked with locks acquired */
+-static int
+-checktable(const struct scanlist *scan, const struct ieee80211_channel *c)
+-{
+-      int i;
+-
+-      for (; scan->list != NULL; scan++) {
+-              for (i = 0; i < scan->count; i++)
+-                      if (scan->list[i] == c->ic_freq)
+-                              return 1;
+-      }
+-      return 0;
+-}
+ /*
+  * Attach prior to any scanning work.
+@@ -327,29 +198,6 @@ saveie(u_int8_t **iep, const u_int8_t *i
+               ieee80211_saveie(iep, ie);
+ }
+-/* This function must be invoked with locks acquired */
+-static struct ieee80211_channel *
+-find11gchannel(struct ieee80211com *ic, int i, int freq)
+-{
+-      struct ieee80211_channel *c;
+-      int j;
+-
+-      /* The normal ordering in the channel list is b channel
+-       * immediately followed by g so optimize the search for
+-       * this.  We'll still do a full search just in case. */
+-      for (j = i + 1; j < ic->ic_nchans; j++) {
+-              c = &ic->ic_channels[j];
+-              if ((c->ic_freq == freq) && IEEE80211_IS_CHAN_ANYG(c))
+-                      return c;
+-      }
+-      for (j = 0; j < i; j++) {
+-              c = &ic->ic_channels[j];
+-              if ((c->ic_freq == freq) && IEEE80211_IS_CHAN_ANYG(c))
+-                      return c;
+-      }
+-      return NULL;
+-}
+-
+ /*
+  * Start an ap scan by populating the channel list.
+  */
+@@ -358,90 +206,15 @@ ap_start(struct ieee80211_scan_state *ss
+ {
+       struct ap_state *as         = ss->ss_priv;
+       struct ieee80211com *ic     = NULL;
+-      const struct scanlist *sl   = NULL;
+-      struct ieee80211_channel *c = NULL;
+       int i;
+       unsigned int mode = 0;
+       SCAN_AP_LOCK_IRQ(as);
+       ic = vap->iv_ic;
+       /* Determine mode flags to match, or leave zero for auto mode */
+-      as->as_vap_desired_mode = vap->iv_des_mode;
+-      as->as_required_mode    = 0;
+-      if (as->as_vap_desired_mode != IEEE80211_MODE_AUTO) {
+-              as->as_required_mode = chanflags[as->as_vap_desired_mode];
+-              if ((vap->iv_ath_cap & IEEE80211_ATHC_TURBOP) && 
+-                  (as->as_required_mode != IEEE80211_CHAN_ST)) {
+-                      /* Fixup for dynamic turbo flags */
+-                      if (as->as_vap_desired_mode == IEEE80211_MODE_11G)
+-                              as->as_required_mode = IEEE80211_CHAN_108G;
+-                      else
+-                              as->as_required_mode = IEEE80211_CHAN_108A;
+-              }
+-      }
+-
+       ss->ss_last = 0;
+-      /* Use the table of ordered channels to construct the list
+-       * of channels for scanning.  Any channels in the ordered
+-       * list not in the master list will be discarded. */
+-      for (sl = staScanTable; sl->list != NULL; sl++) {
+-              mode = sl->mode;
+-
+-              /* The scan table marks 2.4Ghz channels as b
+-               * so if the desired mode is 11g, then use
+-               * the 11b channel list but upgrade the mode. */
+-              if (as->as_vap_desired_mode &&
+-                  (as->as_vap_desired_mode != mode) && 
+-                  (as->as_vap_desired_mode == IEEE80211_MODE_11G) && 
+-                  (mode == IEEE80211_MODE_11B))
+-                      mode = IEEE80211_MODE_11G;
+-
+-              /* If we are in "AUTO" mode, upgrade the mode to auto. 
+-               * This lets add_channels upgrade an 11b channel to 
+-               * 11g if available. */
+-              if (!as->as_vap_desired_mode && (mode == IEEE80211_MODE_11B))
+-                      mode = IEEE80211_MODE_AUTO;
+-
+-              /* Add the list of the channels; any that are not
+-               * in the master channel list will be discarded. */
+-              add_channels(ic, ss, mode, sl->list, sl->count);
+-      }
+-
+-      /* Add the channels from the ic (from HAL) that are not present
+-       * in the staScanTable, assuming they pass the sanity checks... */
+-      for (i = 0; i < ic->ic_nchans; i++) {
+-              c = &ic->ic_channels[i];
+-
+-              /* XR is not supported on turbo channels */
+-              if (IEEE80211_IS_CHAN_TURBO(c) && vap->iv_flags & IEEE80211_F_XR)
+-                      continue;
+-
+-              /* Dynamic channels are scanned in base mode */
+-              if (!as->as_required_mode && !IEEE80211_IS_CHAN_ST(c))
+-                      continue;
+-
+-              /* Use any 11g channel instead of 11b one. */
+-              if (vap->iv_des_mode == IEEE80211_MODE_AUTO && 
+-                  IEEE80211_IS_CHAN_B(c) &&
+-                  find11gchannel(ic, i, c->ic_freq))
+-                      continue;
+-
+-              /* Do not add channels already put into the scan list by the
+-               * scan table - these have already been filtered by mode
+-               * and for whether they are in the active channel list. */
+-              if (checktable(staScanTable, c))
+-                      continue;
+-
+-              /* Make sure the channel is active */
+-              if ((c == NULL) || isclr(ic->ic_chan_active, c->ic_ieee))
+-                      continue;
++      ieee80211_scan_add_channels(ic, ss, vap->iv_des_mode);
+-              /* Don't overrun */
+-              if (ss->ss_last >= IEEE80211_SCAN_MAX)
+-                      break;
+-
+-              ss->ss_chans[ss->ss_last++] = c;
+-      }
+       ss->ss_next = 0;
+       /* XXX tunables */
+       ss->ss_mindwell = msecs_to_jiffies(200);        /* 200ms */
+@@ -761,18 +534,6 @@ pick_channel(struct ieee80211_scan_state
+               if (IEEE80211_IS_CHAN_RADAR(c->chan))
+                       continue;
+-              /* Do not select 802.11a ST if mode is specified and is not 
+-               * 802.11a ST */
+-              if (as->as_required_mode &&
+-                  IEEE80211_IS_CHAN_STURBO(c->chan) &&
+-                  (as->as_vap_desired_mode != IEEE80211_MODE_TURBO_STATIC_A))
+-                      continue;
+-
+-              /* Verify mode matches any fixed mode specified */
+-              if((c->chan->ic_flags & as->as_required_mode) != 
+-                              as->as_required_mode)
+-                      continue;
+-
+               if ((ic->ic_bsschan != NULL) &&
+                       (ic->ic_bsschan != IEEE80211_CHAN_ANYC)) {
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -958,6 +958,80 @@ ieee80211_scan_flush(struct ieee80211com
+       }
+ }
++static const u_int chanflags[] = {
++      0,      /* IEEE80211_MODE_AUTO */
++      IEEE80211_CHAN_A,       /* IEEE80211_MODE_11A */
++      IEEE80211_CHAN_B,       /* IEEE80211_MODE_11B */
++      IEEE80211_CHAN_PUREG,   /* IEEE80211_MODE_11G */
++      IEEE80211_CHAN_FHSS,    /* IEEE80211_MODE_FH */
++      IEEE80211_CHAN_A,       /* IEEE80211_MODE_TURBO_A */ /* for turbo mode look for AP in normal channel */
++      IEEE80211_CHAN_PUREG,   /* IEEE80211_MODE_TURBO_G */
++      IEEE80211_CHAN_ST,      /* IEEE80211_MODE_TURBO_STATIC_A */
++};
++
++static struct ieee80211_channel *
++find11gchannel(struct ieee80211com *ic, int i, int freq)
++{
++      struct ieee80211_channel *c;
++      int j;
++
++      /*
++       * The normal ordering in the channel list is b channel
++       * immediately followed by g so optimize the search for
++       * this.  We'll still do a full search just in case.
++       */
++      for (j = i+1; j < ic->ic_nchans; j++) {
++              c = &ic->ic_channels[j];
++              if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
++                      return c;
++      }
++      for (j = 0; j < i; j++) {
++              c = &ic->ic_channels[j];
++              if (c->ic_freq == freq && IEEE80211_IS_CHAN_ANYG(c))
++                      return c;
++      }
++      return NULL;
++}
++
++
++void
++ieee80211_scan_add_channels(struct ieee80211com *ic,
++      struct ieee80211_scan_state *ss,
++      enum ieee80211_phymode mode)
++{
++      struct ieee80211_channel *c, *cg;
++      u_int modeflags;
++      int i;
++
++      KASSERT(mode < ARRAY_SIZE(chanflags), ("Unexpected mode %u", mode));
++      modeflags = chanflags[mode];
++      for (i = 0; i < ic->ic_nchans; i++) {
++              c = &ic->ic_channels[i];
++              if (c == NULL || isclr(ic->ic_chan_active, c->ic_ieee))
++                      continue;
++              if (c->ic_scanflags & IEEE80211_NOSCAN_SET)
++                      continue;
++              if (modeflags &&
++                      ((c->ic_flags & IEEE80211_CHAN_ALLTURBO) !=
++                       (modeflags & IEEE80211_CHAN_ALLTURBO)))
++                      continue;
++              if (mode == IEEE80211_MODE_AUTO) {
++                      /*
++                       * XXX special-case 11b/g channels so we select
++                       *     the g channel if both are present.
++                       */
++                      if (IEEE80211_IS_CHAN_B(c) &&
++                          (cg = find11gchannel(ic, i, c->ic_freq)) != NULL)
++                              continue;
++              }
++              if (ss->ss_last >= IEEE80211_SCAN_MAX)
++                      break;
++              ss->ss_chans[ss->ss_last++] = c;
++      }
++}
++EXPORT_SYMBOL(ieee80211_scan_add_channels);
++
++
+ /*
+  * Execute radar channel change. This is called when a radar/dfs
+  * signal is detected.  AP mode only.  Return 1 on success, 0 on
+--- a/net80211/ieee80211_scan.h
++++ b/net80211/ieee80211_scan.h
+@@ -219,4 +219,7 @@ void ieee80211_scanner_register(enum iee
+ void ieee80211_scanner_unregister(enum ieee80211_opmode,
+       const struct ieee80211_scanner *);
+ void ieee80211_scanner_unregister_all(const struct ieee80211_scanner *);
++void ieee80211_scan_add_channels(struct ieee80211com *ic,
++      struct ieee80211_scan_state *ss,
++      enum ieee80211_phymode mode);
+ #endif /* _NET80211_IEEE80211_SCAN_H_ */
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -3873,6 +3873,106 @@ ieee80211_ioctl_kickmac(struct net_devic
+       return ieee80211_ioctl_setmlme(dev, info, w, (char *)&mlme);
+ }
++static inline void setflag(struct ieee80211_channel *c, int flag)
++{
++      if (flag)
++              c->ic_scanflags |= IEEE80211_NOSCAN_SET;
++      else
++              c->ic_scanflags &= ~IEEE80211_NOSCAN_SET;
++}
++
++static void setscanflag(struct ieee80211com *ic, int min, int max, int set)
++{
++      int i;
++
++      for (i = 0; i < ic->ic_nchans; i++) {
++              struct ieee80211_channel *c = &ic->ic_channels[i];
++
++              if (min == -1) {
++                      if (!(c->ic_scanflags & IEEE80211_NOSCAN_DEFAULT))
++                              setflag(c, set);
++              } else if ((c->ic_freq >= min) && (c->ic_freq <= max)) {
++                      setflag(c, set);
++              }
++      }
++}
++
++static int
++ieee80211_ioctl_setscanlist(struct net_device *dev,
++      struct iw_request_info *info,
++      struct iw_point *data, char *extra)
++{
++      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211com *ic = vap->iv_ic;
++      char *s, *next;
++      int val = 1;
++
++      if (data->length <= 0)
++              return -EINVAL;
++
++      s = kmalloc(data->length + 1, GFP_KERNEL);
++      if (!s)
++              return -ENOMEM;
++
++      memset(s, 0, data->length + 1);
++      if (copy_from_user(s, data->pointer, data->length))
++              return -EFAULT;
++
++      s[data->length - 1] = '\0';             /* ensure null termination */
++
++      switch(*s) {
++              case '-':
++                      val = 1;
++                      break;
++              case '+':
++                      val = 0;
++                      break;
++              default:
++                      goto error;
++      }
++      s++;
++      next = s;
++      do {
++              next = strchr(s, ',');
++              if (next) {
++                      *next = 0;
++                      next++;
++              }
++              if (!strcmp(s, "ALL")) {
++                      setscanflag(ic, 0, 10000, val);
++              } else if (!strcmp(s, "REG")) {
++                      setscanflag(ic, -1, -1, val);
++              } else {
++                      int min, max;
++                      char *n, *end = NULL;
++
++                      n = strchr(s, '-');
++                      if (n) {
++                              *n = 0;
++                              n++;
++                      }
++                      min = simple_strtoul(s, &end, 10);
++                      if (end && *end)
++                              goto error;
++                      if (n) {
++                              max = simple_strtoul(n, &end, 10);
++                              if (end && *end)
++                                      goto error;
++                      } else {
++                              max = min;
++                      }
++                      setscanflag(ic, min, max, val);
++              }
++              s = next;
++      } while (next);
++      return 0;
++
++error:
++      if (s)
++              kfree(s);
++      return -EINVAL;
++}
++
+ static int
+ ieee80211_ioctl_addmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+@@ -5656,6 +5756,8 @@ static const struct iw_priv_args ieee802
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "minrate"},
+       {IEEE80211_PARAM_MINRATE,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
++      { IEEE80211_IOCTL_SETSCANLIST,
++       IW_PRIV_TYPE_CHAR | 255, 0, "setscanlist"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
+@@ -5753,6 +5855,7 @@ static const iw_handler ieee80211_priv_h
+       set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
+       set_priv(IEEE80211_IOCTL_WDSDELMAC, ieee80211_ioctl_wdsdelmac),
+       set_priv(IEEE80211_IOCTL_KICKMAC, ieee80211_ioctl_kickmac),
++      set_priv(IEEE80211_IOCTL_SETSCANLIST, ieee80211_ioctl_setscanlist),
+ #ifdef ATH_REVERSE_ENGINEERING
+       set_priv(IEEE80211_IOCTL_READREG, ieee80211_ioctl_readreg),
+       set_priv(IEEE80211_IOCTL_WRITEREG, ieee80211_ioctl_writereg),
diff --git a/net/madwifi/patches/352-ani_fix.patch b/net/madwifi/patches/352-ani_fix.patch
new file mode 100644 (file)
index 0000000..e8dce0c
--- /dev/null
@@ -0,0 +1,265 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1014,9 +1014,7 @@ ath_attach(u_int16_t devid, struct net_d
+        */
+       sc->sc_hasveol = ath_hal_hasveol(ah);
+-      /* Interference mitigation/ambient noise immunity (ANI).
+-       * In modes other than HAL_M_STA, it causes receive sensitivity
+-       * problems for OFDM. */
++      /* Interference mitigation/ambient noise immunity (ANI). */
+       sc->sc_hasintmit = ath_hal_hasintmit(ah);
+       /* get mac address from hardware */
+@@ -1144,6 +1142,11 @@ ath_attach(u_int16_t devid, struct net_d
+       sc->sc_rp_lasttsf       = 0;
+       sc->sc_last_tsf         = 0;
++      /* set all 3 to auto */
++      sc->sc_intmit = -1;
++      sc->sc_noise_immunity = -1;
++      sc->sc_ofdm_weak_det = -1;
++
+       return 0;
+ bad3:
+       ieee80211_ifdetach(ic);
+@@ -2428,6 +2431,43 @@ ath_chan2flags(struct ieee80211_channel 
+       return flags;
+ }
++static int ath_setintmit(struct ath_softc *sc)
++{
++      struct ath_hal *ah = sc->sc_ah;
++      int ret;
++      int val;
++
++      if (!sc->sc_hasintmit)
++              return 0;
++
++      switch(sc->sc_intmit) {
++              case -1:
++                      if (sc->sc_opmode != IEEE80211_M_MONITOR)
++                              val = 1;
++                      else
++                              val = 0;
++                      break;
++              case 0: /* disabled */
++              case 1: /* enabled */
++                      val = sc->sc_intmit;
++                      break;
++              default:
++                      return 0;
++      }
++      ret = ath_hal_setintmit(ah, val);
++      if (val)
++              goto done;
++
++      /* manual settings */
++      if ((sc->sc_noise_immunity >= 0) && (sc->sc_noise_immunity <= 5))
++              ath_hal_setcapability(ah, HAL_CAP_INTMIT, 2, sc->sc_noise_immunity, NULL);
++      if ((sc->sc_ofdm_weak_det == 0) || (sc->sc_ofdm_weak_det == 1))
++              ath_hal_setcapability(ah, HAL_CAP_INTMIT, 3, sc->sc_ofdm_weak_det, NULL);
++
++done:
++      return ret;
++}
++
+ /*
+  * Context: process context
+  */
+@@ -2493,8 +2533,7 @@ ath_init(struct net_device *dev)
+       if (sc->sc_softled)
+               ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
+-      if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
+-              ath_hal_setintmit(ah, 0);
++      ath_setintmit(sc);
+       /*
+        * This is needed only to setup initial state
+@@ -2530,7 +2569,7 @@ ath_init(struct net_device *dev)
+        * Enable MIB interrupts when there are hardware phy counters.
+        * Note we only do this (at the moment) for station mode.
+        */
+-      if (sc->sc_needmib && ic->ic_opmode == IEEE80211_M_STA)
++      if (sc->sc_needmib && ath_hal_getintmit(ah, NULL))
+               sc->sc_imask |= HAL_INT_MIB;
+       ath_hal_intrset(ah, sc->sc_imask);
+@@ -2787,9 +2826,7 @@ ath_reset(struct net_device *dev)
+               EPRINTF(sc, "Unable to reset hardware: '%s' (HAL status %u)\n",
+                       ath_get_hal_status_desc(status), status);
+-      if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
+-              ath_hal_setintmit(ah, 0);
+-
++      ath_setintmit(sc);
+       ath_update_txpow(sc);           /* update tx power state */
+       ath_radar_update(sc);
+       ath_setdefantenna(sc, sc->sc_defant);
+@@ -4174,6 +4211,8 @@ ath_calcrxfilter(struct ath_softc *sc)
+       if (sc->sc_nmonvaps > 0)
+               rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
+                         HAL_RX_FILTER_PROBEREQ | HAL_RX_FILTER_PROM);
++      if (sc->sc_hasintmit && !sc->sc_needmib && ath_hal_getintmit(ah, NULL))
++              rfilt |= HAL_RX_FILTER_PHYERR;
+       if (sc->sc_curchan.privFlags & CHANNEL_DFS)
+               rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR);
+       return rfilt;
+@@ -6526,9 +6565,6 @@ process_rx_again:
+                       rs->rs_rssi = 0;
+               len = rs->rs_datalen;
+-              /* DMA sync. dies spectacularly if len == 0 */
+-              if (len == 0)
+-                      goto rx_next;
+               if (rs->rs_more) {
+                       /*
+@@ -8876,9 +8912,7 @@ ath_chan_set(struct ath_softc *sc, struc
+               if (sc->sc_softled)
+                       ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
+-              if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
+-                      ath_hal_setintmit(ah, 0);
+-
++              ath_setintmit(sc);
+               sc->sc_curchan = hchan;
+               ath_update_txpow(sc);           /* update tx power state */
+               ath_radar_update(sc);
+@@ -10655,9 +10689,54 @@ enum {
+       ATH_RP_IGNORED          = 24,
+       ATH_RADAR_IGNORED       = 25,
+       ATH_MAXVAPS             = 26,
++      ATH_INTMIT                      = 27,
++      ATH_NOISE_IMMUNITY      = 28,
++      ATH_OFDM_WEAK_DET       = 29
+ };
+ static int
++ath_sysctl_set_intmit(struct ath_softc *sc, long ctl, u_int val)
++{
++      int ret;
++
++      switch(ctl) {
++      case ATH_INTMIT:
++              sc->sc_intmit = val;
++              break;
++      case ATH_NOISE_IMMUNITY:
++              sc->sc_noise_immunity = val;
++              break;
++      case ATH_OFDM_WEAK_DET:
++              sc->sc_ofdm_weak_det = val;
++              break;
++      default:
++              return -EINVAL;
++      }
++      ret = ath_setintmit(sc);
++      ath_calcrxfilter(sc);
++      return ret;
++}
++
++static int
++ath_sysctl_get_intmit(struct ath_softc *sc, long ctl, u_int *val)
++{
++      struct ath_hal *ah = sc->sc_ah;
++
++      switch(ctl) {
++      case ATH_INTMIT:
++              *val = (ath_hal_getcapability(ah, HAL_CAP_INTMIT, 1, NULL) == HAL_OK);
++              break;
++      case ATH_NOISE_IMMUNITY:
++              return ath_hal_getcapability(ah, HAL_CAP_INTMIT, 2, val);
++      case ATH_OFDM_WEAK_DET:
++              return ath_hal_getcapability(ah, HAL_CAP_INTMIT, 3, val);
++      default:
++              return -EINVAL;
++      }
++      return 0;
++}
++
++static int
+ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
+ {
+       struct ath_softc *sc = ctl->extra1;
+@@ -10843,6 +10922,11 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                       case ATH_RADAR_IGNORED:
+                               sc->sc_radar_ignored = val;
+                               break;
++                      case ATH_INTMIT:
++                      case ATH_NOISE_IMMUNITY:
++                      case ATH_OFDM_WEAK_DET:
++                              ret = ath_sysctl_set_intmit(sc, (long)ctl->extra2, val);
++                              break;
+                       default:
+                               ret = -EINVAL;
+                               break;
+@@ -10909,6 +10993,11 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_RADAR_IGNORED:
+                       val = sc->sc_radar_ignored;
+                       break;
++              case ATH_INTMIT:
++              case ATH_NOISE_IMMUNITY:
++              case ATH_OFDM_WEAK_DET:
++                      ret = ath_sysctl_get_intmit(sc, (long)ctl->extra2, &val);
++                      break;
+               default:
+                       ret = -EINVAL;
+                       break;
+@@ -11086,6 +11175,24 @@ static const ctl_table ath_sysctl_templa
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RADAR_IGNORED,
+       },
++      { .ctl_name     = CTL_AUTO,
++        .procname     = "intmit",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_INTMIT,
++      },
++      { .ctl_name     = CTL_AUTO,
++        .procname     = "noise_immunity",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_NOISE_IMMUNITY,
++      },
++      { .ctl_name     = CTL_AUTO,
++        .procname     = "ofdm_weak_det",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_OFDM_WEAK_DET,
++      },
+       { 0 }
+ };
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -693,6 +693,10 @@ struct ath_softc {
+       unsigned int sc_txcont_power; /* Continuous transmit power in 0.5dBm units */
+       unsigned int sc_txcont_rate;  /* Continuous transmit rate in Mbps */
++      int8_t sc_intmit; /* Interference mitigation enabled, -1 = auto, based on mode, 0/1 = off/on */
++      int8_t sc_noise_immunity; /* Noise immunity level, 0-4, -1 == auto) */
++      int8_t sc_ofdm_weak_det; /* OFDM weak frames detection, -1 == auto */
++
+       /* rate tables */
+       const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX];
+       const HAL_RATE_TABLE *sc_currates;      /* current rate table */
+--- a/ath/if_ath_hal.h
++++ b/ath/if_ath_hal.h
+@@ -67,14 +67,14 @@ static inline HAL_POWER_MODE ath_hal_get
+ static inline HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request,
+                                           const void *args, u_int32_t argsize,
+-                                          void **result,
++                                          void *result,
+                                           u_int32_t *resultsize)
+ {
+       HAL_BOOL ret;
+       ATH_HAL_LOCK_IRQ(ah->ah_sc);
+       ath_hal_set_function(__func__);
+       ret =
+-          ah->ah_getDiagState(ah, request, args, argsize, *result,
++          ah->ah_getDiagState(ah, request, args, argsize, result,
+                               resultsize);
+       ath_hal_set_function(NULL);
+       ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
diff --git a/net/madwifi/patches/353-devid.patch b/net/madwifi/patches/353-devid.patch
new file mode 100644 (file)
index 0000000..ee149ff
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -114,11 +114,15 @@ static struct pci_device_id ath_pci_id_t
+       { 0x168c, 0x0023, PCI_ANY_ID, PCI_ANY_ID },
+       { 0x168c, 0x0024, PCI_ANY_ID, PCI_ANY_ID },
+       { 0x168c, 0x9013, PCI_ANY_ID, PCI_ANY_ID }, /* sonicwall */
++      { 0x168c, 0xff16, PCI_ANY_ID, PCI_ANY_ID },
++      { 0x168c, 0xff1a, PCI_ANY_ID, PCI_ANY_ID },
+       { 0 }
+ };
+ static u16 ath_devidmap[][2] = {
+-      { 0x9013, 0x0013 }
++      { 0x9013, 0x0013 },
++      { 0xff16, 0x0013 },
++      { 0xff1a, 0x001a }
+ };
+ static int
diff --git a/net/madwifi/patches/354-lantiq_eeprom.patch b/net/madwifi/patches/354-lantiq_eeprom.patch
new file mode 100644 (file)
index 0000000..59036b1
--- /dev/null
@@ -0,0 +1,95 @@
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
+@@ -343,6 +343,46 @@ EXPORT_SYMBOL(ath_hal_func);
+  * NB: see the comments in ah_osdep.h about byte-swapping register
+  *     reads and writes to understand what's going on below.
+  */
++
++#ifdef CONFIG_LANTIQ
++extern int lantiq_emulate_madwifi_eep;
++extern unsigned long long lantiq_madwifi_eep_addr;
++#define EEPROM_EMULATION 1
++#endif
++
++#ifdef EEPROM_EMULATION
++static int ath_hal_eeprom(struct ath_hal *ah, unsigned long addr, int val, int write)
++{
++      static int addrsel = 0;
++      static int rc = 0;
++
++      if (write) {
++              if(addr == 0x6000) {
++                      addrsel = val * 2;
++                      rc = 0;
++              }
++      } else {
++              switch(addr)
++              {
++              case 0x600c:
++                      if(rc++ < 2)
++                              val = 0x00000000;
++                      else
++                              val = 0x00000002;
++                      break;
++              case 0x6004:
++                      val = cpu_to_le16(__raw_readw((u16 *) KSEG1ADDR(lantiq_madwifi_eep_addr + addrsel)));
++                      /* this forces the regdomain to 0x00 (worldwide), as the original setting
++                       * causes issues with the HAL */
++                      if (addrsel == 0x17e)
++                              val = 0;
++                      break;
++              }
++      }
++      return val;
++}
++#endif
++
+ void __ahdecl
+ ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val)
+ {
+@@ -351,20 +391,33 @@ ath_hal_reg_write(struct ath_hal *ah, u_
+               ath_hal_printf(ah, "%s: WRITE 0x%x <= 0x%x\n", 
+                               (ath_hal_func ?: "unknown"), reg, val);
+ #endif
+-      _OS_REG_WRITE(ah, reg, val);
++#ifdef EEPROM_EMULATION
++      if((reg >= 0x6000) && (reg <= 0x6010) && lantiq_emulate_madwifi_eep)
++      {
++              val = ath_hal_eeprom(ah, reg, val, 1);
++      } else
++#endif
++              _OS_REG_WRITE(ah, reg, val);
+ }
+ EXPORT_SYMBOL(ath_hal_reg_write);
++
+ /* This should only be called while holding the lock, sc->sc_hal_lock. */
+ u_int32_t __ahdecl
+ ath_hal_reg_read(struct ath_hal *ah, u_int reg)
+ {
+-      u_int32_t val;
++      u_int32_t val;
++#ifdef EEPROM_EMULATION
++      if((reg >= 0x6000) && (reg <= 0x6010) && lantiq_emulate_madwifi_eep)
++      {
++              val = ath_hal_eeprom(ah, reg, 0, 0);
++      } else
++#endif
++              val = _OS_REG_READ(ah, reg);
+-      val = _OS_REG_READ(ah, reg);
+ #ifdef AH_DEBUG
+       if (ath_hal_debug > 1)
+-              ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n", 
++              ath_hal_printf(ah, "%s: READ 0x%x => 0x%x\n",
+                               (ath_hal_func ?: "unknown"), reg, val);
+ #endif
+       return val;
+@@ -581,7 +634,6 @@ init_ath_hal(void)
+ {
+       const char *sep;
+       int i;
+-
+       printk(KERN_INFO "%s: %s (", dev_info, ath_hal_version);
+       sep = "";
+       for (i = 0; ath_hal_buildopts[i] != NULL; i++) {
diff --git a/net/madwifi/patches/355-eap_auth_disassoc.patch b/net/madwifi/patches/355-eap_auth_disassoc.patch
new file mode 100644 (file)
index 0000000..8bb1e93
--- /dev/null
@@ -0,0 +1,77 @@
+This patch causes STA mode interfaces to disassociate if transmission of assoc/auth
+critical packets failed.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8334,6 +8334,14 @@ ath_tx_processq(struct ath_softc *sc, st
+ #endif
+                               if (ts->ts_status & HAL_TXERR_XRETRY) {
+                                       sc->sc_stats.ast_tx_xretries++;
++                                      if (SKB_CB(bf->bf_skb)->auth_pkt &&
++                                              (ni->ni_vap->iv_opmode == IEEE80211_M_STA)) {
++                                              struct ieee80211vap *vap = ni->ni_vap;
++
++                                              /* if roaming is enabled, try reassociating, otherwise
++                                               * disassociate and go back to the scan state */
++                                              vap->iv_mgtsend.function(vap->iv_mgtsend.data);
++                                      }
+                                       if (ni->ni_flags & IEEE80211_NODE_UAPSD_TRIG) {
+                                               ni->ni_stats.ns_tx_eosplost++;
+                                               DPRINTF(sc, ATH_DEBUG_UAPSD,
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -156,6 +156,7 @@ ieee80211_getmgtframe(u_int8_t **frm, u_
+               if (off != 0)
+                       skb_reserve(skb, align - off);
++              SKB_CB(skb)->auth_pkt = 0;
+               SKB_CB(skb)->ni = NULL;
+               SKB_CB(skb)->flags = 0;
+               SKB_CB(skb)->next = NULL;
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -393,6 +393,7 @@ typedef spinlock_t acl_lock_t;
+       void            (*next_destructor)(struct sk_buff *skb);
+ #endif
+       struct sk_buff *next;                   /* fast frame sk_buf chain */
++      u_int8_t auth_pkt;
+ };
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -778,6 +778,8 @@ ieee80211_encap(struct ieee80211_node *n
+       else
+               hdrsize = sizeof(struct ieee80211_frame);
++      SKB_CB(skb)->auth_pkt = (eh.ether_type == __constant_htons(ETHERTYPE_PAE));
++
+       switch (vap->iv_opmode) {
+       case IEEE80211_M_IBSS:
+       case IEEE80211_M_AHDEMO:
+@@ -1622,6 +1624,7 @@ ieee80211_add_xr_param(u_int8_t *frm, st
+       ie->param_len = frm - &ie->param_oui[0];
+       return frm;
+ }
++
+ #endif
+ /*
+  * Send a probe request frame with the specified ssid
+@@ -1886,6 +1889,7 @@ ieee80211_send_mgmt(struct ieee80211_nod
+                               sizeof(u_int16_t)+IEEE80211_CHALLENGE_LEN : 0));
+               if (skb == NULL)
+                       senderr(ENOMEM, is_tx_nobuf);
++              SKB_CB(skb)->auth_pkt = 1;
+               ((__le16 *)frm)[0] =
+                       (is_shared_key) ? htole16(IEEE80211_AUTH_ALG_SHARED)
+@@ -1960,6 +1964,7 @@ ieee80211_send_mgmt(struct ieee80211_nod
+                       vap->app_ie[IEEE80211_APPIE_FRAME_ASSOC_REQ].length);
+               if (skb == NULL)
+                       senderr(ENOMEM, is_tx_nobuf);
++              SKB_CB(skb)->auth_pkt = 1;
+               capinfo = 0;
+               if (vap->iv_opmode == IEEE80211_M_IBSS)
diff --git a/net/madwifi/patches/356-hidden_ssid.patch b/net/madwifi/patches/356-hidden_ssid.patch
new file mode 100644 (file)
index 0000000..b87569e
--- /dev/null
@@ -0,0 +1,49 @@
+This patch fixes the detection of hidden SSIDs as transmitted
+by some cisco systems.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -209,6 +209,19 @@ saveie(u_int8_t **iep, const u_int8_t *i
+               ieee80211_saveie(iep, ie);
+ }
++
++static inline int is_empty_ssid(u_int8_t *ssid)
++{
++      if (!ssid)
++              return 1;
++      if (ssid[1] == 0)
++              return 1;
++      if ((ssid[1] == 1) && (ssid[2] == 0))
++              return 1;
++      return 0;
++}
++
++
+ /*
+  * Process a beacon or probe response frame; create an
+  * entry in the scan cache or update any previous entry.
+@@ -233,8 +246,8 @@ sta_add(struct ieee80211_scan_state *ss,
+       SCAN_STA_LOCK_IRQ(st);
+       LIST_FOREACH(se, &st->st_hash[hash], se_hash)
+               if (IEEE80211_ADDR_EQ(se->base.se_macaddr, macaddr) &&
+-                  sp->ssid[1] == se->base.se_ssid[1] &&
+-                  !memcmp(se->base.se_ssid+2, sp->ssid+2, se->base.se_ssid[1]))
++                  (is_empty_ssid(sp->ssid) || (sp->ssid[1] == se->base.se_ssid[1] &&
++                  !memcmp(se->base.se_ssid+2, sp->ssid+2, se->base.se_ssid[1]))))
+                       goto found;
+       MALLOC(se, struct sta_entry *, sizeof(struct sta_entry),
+@@ -252,8 +265,8 @@ found:
+       ise = &se->base;
+       /* XXX ap beaconing multiple ssid w/ same bssid */
+-      if (sp->ssid[1] != 0 &&
+-          (ISPROBE(subtype) || ise->se_ssid[1] == 0))
++      if (!is_empty_ssid(sp->ssid) &&
++          (ISPROBE(subtype) || is_empty_ssid(ise->se_ssid)))
+               memcpy(ise->se_ssid, sp->ssid, 2 + sp->ssid[1]);
+       memcpy(ise->se_rates, sp->rates, 
diff --git a/net/madwifi/patches/357-bgscan_thresh.patch b/net/madwifi/patches/357-bgscan_thresh.patch
new file mode 100644 (file)
index 0000000..df0a6c2
--- /dev/null
@@ -0,0 +1,160 @@
+Add an optional background scanning threshold triggered by low rssi
+(useful for passing updated scan results to the supplicant ahead of
+time, before losing connectivity entirely)
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -646,6 +646,7 @@ enum {
+       IEEE80211_PARAM_MINRATE                 = 76,   /* Minimum rate (by table index) */
+       IEEE80211_PARAM_PROTMODE_RSSI           = 77,   /* RSSI Threshold for enabling protection mode */
+       IEEE80211_PARAM_PROTMODE_TIMEOUT        = 78,   /* Timeout for expiring protection mode */
++      IEEE80211_PARAM_BGSCAN_THRESH           = 79,   /* bg scan rssi threshold */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -92,6 +92,8 @@
+ #define       IEEE80211_BGSCAN_IDLE_MIN       100     /* min idle time (ms) */
+ #define       IEEE80211_BGSCAN_IDLE_DEFAULT   250     /* default idle time (ms) */
++#define IEEE80211_BGSCAN_TRIGGER_INTVL 20 /* min trigger interval for thresh based bgscan (secs) */
++
+ #define IEEE80211_COVERAGE_CLASS_MAX  31      /* max coverage class */
+ #define IEEE80211_REGCLASSIDS_MAX     10      /* max regclass id list */
+@@ -219,6 +221,10 @@ struct ieee80211vap {
+       u_int8_t iv_nickname[IEEE80211_NWID_LEN];
+       u_int iv_bgscanidle;                            /* bg scan idle threshold */
+       u_int iv_bgscanintvl;                           /* bg scan min interval */
++      u_int iv_bgscanthr;                                     /* bg scan rssi threshold */
++      u_int iv_bgscantrintvl;                         /* bg scan trigger interval */
++      unsigned long iv_bgscanthr_next;                /* last trigger for bgscan */
++      unsigned long iv_lastconnect;   /* time of last connect attempt */
+       u_int iv_scanvalid;                             /* scan cache valid threshold */
+       struct ieee80211_roam iv_roam;                  /* sta-mode roaming state */
+@@ -608,6 +614,7 @@ MALLOC_DECLARE(M_80211_VAP);
+ #define IEEE80211_FEXT_SWBMISS                0x00000400      /* CONF: use software beacon timer */
+ #define IEEE80211_FEXT_DROPUNENC_EAPOL        0x00000800      /* CONF: drop unencrypted eapol frames */
+ #define IEEE80211_FEXT_APPIE_UPDATE   0x00001000      /* STATE: beacon APP IE updated */
++#define IEEE80211_FEXT_BGSCAN_THR     0x00002000      /* bgscan due to low rssi */
+ #define IEEE80211_COM_UAPSD_ENABLE(_ic)               ((_ic)->ic_flags_ext |= IEEE80211_FEXT_UAPSD)
+ #define IEEE80211_COM_UAPSD_DISABLE(_ic)      ((_ic)->ic_flags_ext &= ~IEEE80211_FEXT_UAPSD)
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2744,6 +2744,9 @@ ieee80211_ioctl_setparam(struct net_devi
+               else
+                       retv = EINVAL;
+               break;
++      case IEEE80211_PARAM_BGSCAN_THRESH:
++              vap->iv_bgscanthr = value;
++              break;
+       case IEEE80211_PARAM_MCAST_RATE:
+               /* units are in KILObits per second */
+               if (value >= 256 && value <= 54000)
+@@ -3144,6 +3147,9 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_BGSCAN_INTERVAL:
+               param[0] = vap->iv_bgscanintvl / HZ;    /* seconds */
+               break;
++      case IEEE80211_PARAM_BGSCAN_THRESH:
++              param[0] = vap->iv_bgscanthr;   /* rssi */
++              break;
+       case IEEE80211_PARAM_MCAST_RATE:
+               param[0] = vap->iv_mcast_rate;  /* seconds */
+               break;
+@@ -5666,6 +5672,10 @@ static const struct iw_priv_args ieee802
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "bgscanintvl" },
+       { IEEE80211_PARAM_BGSCAN_INTERVAL,
+         0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_bgscanintvl" },
++      { IEEE80211_PARAM_BGSCAN_THRESH,
++        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "bgscanthr" },
++      { IEEE80211_PARAM_BGSCAN_THRESH,
++        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_bgscanthr" },
+       { IEEE80211_PARAM_MCAST_RATE,
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "mcast_rate" },
+       { IEEE80211_PARAM_MCAST_RATE,
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3013,8 +3013,10 @@ contbgscan(struct ieee80211vap *vap)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
++      vap->iv_bgscantrintvl = (vap->iv_bgscantrintvl + 1) % 4;
+       return ((ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN) &&
+-              time_after(jiffies, ic->ic_lastdata + vap->iv_bgscanidle));
++              (((ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN_THR) && !vap->iv_bgscantrintvl) ||
++                      time_after(jiffies, ic->ic_lastdata + vap->iv_bgscanidle)));
+ }
+ static __inline int
+@@ -3258,6 +3260,25 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       /* record tsf of last beacon */
+                       memcpy(ni->ni_tstamp.data, scan.tstamp,
+                               sizeof(ni->ni_tstamp));
++
++                      /* When rssi is low, start doing bgscans more frequently to allow
++                       * the supplicant to make a better switching decision */
++                      if (!(ic->ic_flags & IEEE80211_F_SCAN) && (rssi < vap->iv_bgscanthr) &&
++                                      (!vap->iv_bgscanthr_next ||
++                                              !time_before(jiffies, vap->iv_bgscanthr_next)) &&
++                                      (vap->iv_state == IEEE80211_S_RUN) &&
++                                      time_after(jiffies, vap->iv_lastconnect +
++                                              msecs_to_jiffies(IEEE80211_BGSCAN_INTVAL_MIN * 1000))) {
++                              int ret;
++
++                              ic->ic_lastdata = 0;
++                              ic->ic_lastscan = 0;
++                              ic->ic_flags_ext |= IEEE80211_FEXT_BGSCAN_THR;
++                              ret = ieee80211_bg_scan(vap);
++                              if (ret)
++                                      vap->iv_bgscanthr_next = jiffies + msecs_to_jiffies(IEEE80211_BGSCAN_TRIGGER_INTVL * 1000);
++                      }
++
+                       if (ni->ni_intval != scan.bintval) {
+                               IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni,
+                                               "beacon interval divergence: "
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -616,6 +616,7 @@ ieee80211_cancel_scan(struct ieee80211va
+               /* clear bg scan NOPICK and mark cancel request */
+               ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
++              ic->ic_flags_ext &= ~IEEE80211_FEXT_BGSCAN_THR;
+               SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_CANCEL;
+               ss->ss_ops->scan_cancel(ss, vap);
+               /* force it to fire asap */
+@@ -782,7 +783,7 @@ again:
+                               ieee80211_sta_pwrsave(vap, 0);
+                               if (ss->ss_next >= ss->ss_last) {
+                                       ieee80211_notify_scan_done(vap);
+-                                      ic->ic_flags_ext &= ~IEEE80211_FEXT_BGSCAN;
++                                      ic->ic_flags_ext &= ~(IEEE80211_FEXT_BGSCAN|IEEE80211_FEXT_BGSCAN_THR);
+                               }
+                       }
+                       SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_CANCEL;
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -1450,6 +1450,7 @@ __ieee80211_newstate(struct ieee80211vap
+               }
+               break;
+       case IEEE80211_S_AUTH:
++              vap->iv_lastconnect = jiffies;
+               /* auth frames are possible between IBSS nodes, 
+                * see 802.11-1999, chapter 5.7.6 */
+               KASSERT(vap->iv_opmode == IEEE80211_M_STA || 
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -238,7 +238,8 @@ ieee80211_hardstart(struct sk_buff *skb,
+       }
+       
+       /* Cancel any running BG scan */
+-      ieee80211_cancel_scan(vap);
++      if (!(ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN_THR) && (vap->iv_state == IEEE80211_S_RUN))
++              ieee80211_cancel_scan(vap);
+       /* 
+        * Find the node for the destination so we can do
diff --git a/net/madwifi/patches/358-ignore_broken_bssid.patch b/net/madwifi/patches/358-ignore_broken_bssid.patch
new file mode 100644 (file)
index 0000000..b549272
--- /dev/null
@@ -0,0 +1,18 @@
+Some misconfigured APs broadcast NULL BSSIDs, which can confuse the STA
+Ignore those when scanning.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -242,6 +242,10 @@ sta_add(struct ieee80211_scan_state *ss,
+       struct ieee80211_scan_entry *ise;
+       int hash;
++      /* workaround for broken APs that broadcast NULL BSSIDs */
++      if (memcmp(wh->i_addr3, "\x00\x00\x00\x00\x00\x00", 6) == 0)
++              return 0;
++
+       hash = STA_HASH(macaddr);
+       SCAN_STA_LOCK_IRQ(st);
+       LIST_FOREACH(se, &st->st_hash[hash], se_hash)
diff --git a/net/madwifi/patches/359-disable_reassoc.patch b/net/madwifi/patches/359-disable_reassoc.patch
new file mode 100644 (file)
index 0000000..8d25dc2
--- /dev/null
@@ -0,0 +1,31 @@
+Add a preliminary fix for the reassoc check, but disable reassoc entirely for now
+until we've figured out why it fails frequently.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -599,10 +599,9 @@ ieee80211_ibss_merge(struct ieee80211_no
+ EXPORT_SYMBOL(ieee80211_ibss_merge);
+ static __inline int
+-ssid_equal(const struct ieee80211_node *a, const struct ieee80211_node *b)
++bssid_equal(const struct ieee80211_node *a, const struct ieee80211_node *b)
+ {
+-      return (a->ni_esslen == b->ni_esslen &&
+-              memcmp(a->ni_essid, b->ni_essid, a->ni_esslen) == 0);
++      return (memcmp(a->ni_bssid, b->ni_bssid, IEEE80211_ADDR_LEN) == 0);
+ }
+ /*
+@@ -634,8 +633,8 @@ ieee80211_sta_join1(struct ieee80211_nod
+        * Check if old+new node have the same ssid in which
+        * case we can reassociate when operating in sta mode.
+        */
+-      canreassoc = ((obss != NULL) &&
+-              (vap->iv_state == IEEE80211_S_RUN) && ssid_equal(obss, selbs));
++      canreassoc = 0; /* ((obss != NULL) &&
++              (vap->iv_state == IEEE80211_S_RUN) && bssid_equal(obss, selbs)); */
+       vap->iv_bss = selbs;
+       IEEE80211_ADDR_COPY(vap->iv_bssid, selbs->ni_bssid);
+       if (obss != NULL)
diff --git a/net/madwifi/patches/360-sta_nodes.patch b/net/madwifi/patches/360-sta_nodes.patch
new file mode 100644 (file)
index 0000000..2060001
--- /dev/null
@@ -0,0 +1,242 @@
+Drop stale AP nodes from the client list when disconnecting.
+Fixes some reassoc issues.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -1348,7 +1348,7 @@ __ieee80211_newstate(struct ieee80211vap
+                               IEEE80211_SEND_MGMT(ni,
+                                       IEEE80211_FC0_SUBTYPE_DISASSOC,
+                                       IEEE80211_REASON_ASSOC_LEAVE);
+-                              ieee80211_sta_leave(ni);
++                              ieee80211_node_leave(ni);
+                               break;
+                       case IEEE80211_M_HOSTAP:
+                               ieee80211_iterate_nodes(&ic->ic_sta,
+@@ -1358,12 +1358,14 @@ __ieee80211_newstate(struct ieee80211vap
+                               break;
+                       }
+                       goto reset;
++              case IEEE80211_S_AUTH:
+               case IEEE80211_S_ASSOC:
+                       switch (vap->iv_opmode) {
+                       case IEEE80211_M_STA:
+                               IEEE80211_SEND_MGMT(ni,
+                                       IEEE80211_FC0_SUBTYPE_DEAUTH,
+                                       IEEE80211_REASON_AUTH_LEAVE);
++                              ieee80211_node_leave(ni);
+                               break;
+                       case IEEE80211_M_HOSTAP:
+                               ieee80211_iterate_nodes(&ic->ic_sta,
+@@ -1376,7 +1378,6 @@ __ieee80211_newstate(struct ieee80211vap
+               case IEEE80211_S_SCAN:
+                       ieee80211_cancel_scan(vap);
+                       goto reset;
+-              case IEEE80211_S_AUTH:
+               reset:
+                       ieee80211_reset_bss(vap);
+                       break;
+@@ -1429,10 +1430,12 @@ __ieee80211_newstate(struct ieee80211vap
+                                       IEEE80211_SCAN_FOREVER,
+                                       vap->iv_des_nssid, vap->iv_des_ssid,
+                                       NULL);
++                      else
++                              ieee80211_node_leave(vap->iv_bss);
+                       break;
+               case IEEE80211_S_RUN:           /* beacon miss */
+                       if (vap->iv_opmode == IEEE80211_M_STA) {
+-                              ieee80211_sta_leave(ni);
++                              ieee80211_node_leave(ni);
+                               vap->iv_flags &= ~IEEE80211_F_SIBSS;    /* XXX */
+                               if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
+                                       ieee80211_check_scan(vap,
+@@ -1511,7 +1514,7 @@ __ieee80211_newstate(struct ieee80211vap
+                               IEEE80211_FC0_SUBTYPE_ASSOC_REQ, 0);
+                       break;
+               case IEEE80211_S_RUN:
+-                      ieee80211_sta_leave(ni);
++                      ieee80211_node_leave(ni);
+                       if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
+                               /* NB: caller specifies ASSOC/REASSOC by arg */
+                               IEEE80211_SEND_MGMT(ni, arg ?
+@@ -1779,6 +1782,7 @@ ieee80211_newstate(struct ieee80211vap *
+                         ieee80211_state_name[nstate], 
+                         ieee80211_state_name[dstate]);
++      ieee80211_update_link_status(vap, nstate, ostate);
+       switch (nstate) {
+       case IEEE80211_S_AUTH:
+       case IEEE80211_S_ASSOC:
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -233,33 +233,59 @@ ieee80211_vlan_vdetach(struct ieee80211v
+ }
+ void
+-ieee80211_notify_node_join(struct ieee80211_node *ni, int newassoc)
++ieee80211_update_link_status(struct ieee80211vap *vap, int nstate, int ostate)
+ {
+-      struct ieee80211vap *vap = ni->ni_vap;
+       struct net_device *dev = vap->iv_dev;
+       union iwreq_data wreq;
++      int active;
++
++      if (vap->iv_opmode != IEEE80211_M_STA)
++              return;
++
++      if (ostate == nstate)
++              return;
++
++      if (nstate == IEEE80211_S_RUN)
++              active = 1;
++      else if ((ostate >= IEEE80211_S_AUTH) && (nstate < ostate))
++              active = 0;
++      else
++              return;
++
++      if (active && !vap->iv_bss)
++              return;
++
++      memset(&wreq, 0, sizeof(wreq));
++      wreq.ap_addr.sa_family = ARPHRD_ETHER;
+-      if (ni == vap->iv_bss) {
+-              if (newassoc)
+-                      netif_carrier_on(dev);
+-              memset(&wreq, 0, sizeof(wreq));
++      if (active) {
++              //netif_carrier_on(vap->iv_dev);
+               IEEE80211_ADDR_COPY(wreq.addr.sa_data, vap->iv_bssid);
+-              wreq.addr.sa_family = ARPHRD_ETHER;
+-#ifdef ATH_SUPERG_XR
+-              if (vap->iv_xrvap && vap->iv_flags & IEEE80211_F_XR)
+-                      dev = vap->iv_xrvap->iv_dev;
+-#endif
+-              wireless_send_event(dev, SIOCGIWAP, &wreq, NULL);
+       } else {
+-              memset(&wreq, 0, sizeof(wreq));
+-              IEEE80211_ADDR_COPY(wreq.addr.sa_data, ni->ni_macaddr);
+-              wreq.addr.sa_family = ARPHRD_ETHER;
++              //netif_carrier_off(vap->iv_dev);
++              memset(wreq.ap_addr.sa_data, 0, ETHER_ADDR_LEN);
++      }
++      wireless_send_event(dev, SIOCGIWAP, &wreq, NULL);
++}
++
++void
++ieee80211_notify_node_join(struct ieee80211_node *ni, int newassoc)
++{
++      struct ieee80211vap *vap = ni->ni_vap;
++      struct net_device *dev = vap->iv_dev;
++      union iwreq_data wreq;
++
++      if (ni == vap->iv_bss)
++              return;
++
++      memset(&wreq, 0, sizeof(wreq));
++      IEEE80211_ADDR_COPY(wreq.addr.sa_data, ni->ni_macaddr);
++      wreq.addr.sa_family = ARPHRD_ETHER;
+ #ifdef ATH_SUPERG_XR
+-              if (vap->iv_xrvap && vap->iv_flags & IEEE80211_F_XR)
+-                      dev = vap->iv_xrvap->iv_dev;
++      if (vap->iv_xrvap && vap->iv_flags & IEEE80211_F_XR)
++              dev = vap->iv_xrvap->iv_dev;
+ #endif
+-              wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL);
+-      }
++      wireless_send_event(dev, IWEVREGISTERED, &wreq, NULL);
+ }
+ void
+@@ -269,18 +295,14 @@ ieee80211_notify_node_leave(struct ieee8
+       struct net_device *dev = vap->iv_dev;
+       union iwreq_data wreq;
+-      if (ni == vap->iv_bss) {
+-              netif_carrier_off(dev);
+-              memset(wreq.ap_addr.sa_data, 0, ETHER_ADDR_LEN);
+-              wreq.ap_addr.sa_family = ARPHRD_ETHER;
+-              wireless_send_event(dev, SIOCGIWAP, &wreq, NULL);
+-      } else {
+-              /* fire off wireless event station leaving */
+-              memset(&wreq, 0, sizeof(wreq));
+-              IEEE80211_ADDR_COPY(wreq.addr.sa_data, ni->ni_macaddr);
+-              wreq.addr.sa_family = ARPHRD_ETHER;
+-              wireless_send_event(dev, IWEVEXPIRED, &wreq, NULL);
+-      }
++      if (ni == vap->iv_bss)
++              return;
++
++      /* fire off wireless event station leaving */
++      memset(&wreq, 0, sizeof(wreq));
++      IEEE80211_ADDR_COPY(wreq.addr.sa_data, ni->ni_macaddr);
++      wreq.addr.sa_family = ARPHRD_ETHER;
++      wireless_send_event(dev, IWEVEXPIRED, &wreq, NULL);
+ }
+ void
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -2332,6 +2332,7 @@ ieee80211_node_leave(struct ieee80211_no
+               count_suppchans(ic, ni, -1);
+       IEEE80211_UNLOCK_IRQ(ic);
++done:
+       /*
+        * Cleanup station state.  In particular clear various
+        * state that might otherwise be reused if the node
+@@ -2339,7 +2340,7 @@ ieee80211_node_leave(struct ieee80211_no
+        * (and memory is reclaimed).
+        */
+       ieee80211_sta_leave(ni);
+-done:
++
+       /* Run a cleanup */
+ #ifdef IEEE80211_DEBUG_REFCNT
+       ic->ic_node_cleanup_debug(ni, __func__, __LINE__);
+--- a/net80211/ieee80211_node.h
++++ b/net80211/ieee80211_node.h
+@@ -60,7 +60,7 @@
+ #define       IEEE80211_INACT_PROBE   (30/IEEE80211_INACT_WAIT)       /* probe */
+ #define       IEEE80211_INACT_SCAN    (300/IEEE80211_INACT_WAIT)      /* scanned */
+-#define       IEEE80211_TRANS_WAIT    5                               /* mgt frame tx timer (secs) */
++#define       IEEE80211_TRANS_WAIT    300                             /* mgt frame tx timer (msecs) */
+ #define       IEEE80211_NODE_HASHSIZE 32
+ /* simple hash is enough for variation of macaddr */
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -2141,7 +2141,7 @@ ieee80211_send_mgmt(struct ieee80211_nod
+       ieee80211_mgmt_output(ieee80211_ref_node(ni), skb, type);
+       if (timer)
+-              mod_timer(&vap->iv_mgtsend, jiffies + timer * HZ);
++              mod_timer(&vap->iv_mgtsend, jiffies + msecs_to_jiffies(timer));
+       return 0;
+ bad:
+       return ret;
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -514,8 +514,9 @@ ieee80211_ioctl_siwap(struct net_device 
+                       vap->iv_flags |= IEEE80211_F_DESBSSID;
+               IEEE80211_ADDR_COPY(vap->iv_des_bssid, &ap_addr->sa_data);
+-              if (IS_UP_AUTO(vap))
++              if (IS_UP(vap->iv_dev)) {
+                       ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
++              }
+       }
+       return 0;
+ }
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -643,6 +643,7 @@ void ieee80211_vlan_vdetach(struct ieee8
+ #define       free_netdev(dev)        kfree(dev)
+ #endif
++void ieee80211_update_link_status(struct ieee80211vap *vap, int nstate, int ostate);
+ void ieee80211_ioctl_vattach(struct ieee80211vap *);
+ void ieee80211_ioctl_vdetach(struct ieee80211vap *);
+ struct ifreq;
diff --git a/net/madwifi/patches/361-bmiss_handling.patch b/net/madwifi/patches/361-bmiss_handling.patch
new file mode 100644 (file)
index 0000000..b33cc3f
--- /dev/null
@@ -0,0 +1,102 @@
+Improve the beacon miss handling. Instead of just dropping the connection,
+send a directed probe request to the AP to see if it's still responding.
+Schedule a software beacon miss timer in this case, which adds a timeout
+for the APs probe response.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3400,12 +3400,17 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       }
+                       /* WDS/Repeater: re-schedule software beacon timer for 
+-                       * STA. */
+-                      if ((vap->iv_state == IEEE80211_S_RUN) &&
+-                          (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
+-                              mod_timer(&vap->iv_swbmiss, 
++                       * STA. Reset consecutive bmiss counter as well */
++                      IEEE80211_LOCK_IRQ(ic);
++                      if (vap->iv_state == IEEE80211_S_RUN) {
++                              vap->iv_bmiss_count = 0;
++                              if (vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)
++                                      mod_timer(&vap->iv_swbmiss,
+                                               jiffies + vap->iv_swbmiss_period);
++                              else
++                                      del_timer(&vap->iv_swbmiss);
+                       }
++                      IEEE80211_UNLOCK_IRQ(ic);
+                       /* If scanning, pass the info to the scan module.
+                        * Otherwise, check if it's the right time to do
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -1209,6 +1209,8 @@ ieee80211_beacon_miss(struct ieee80211co
+       }
+       /* XXX locking */
+       TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              int count;
++
+               IEEE80211_DPRINTF(vap,
+                       IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
+                       "%s\n", "beacon miss");
+@@ -1221,6 +1223,29 @@ ieee80211_beacon_miss(struct ieee80211co
+               if (vap->iv_opmode != IEEE80211_M_STA ||
+                   vap->iv_state != IEEE80211_S_RUN)
+                       continue;
++
++              IEEE80211_LOCK_IRQ(ic);
++              count = vap->iv_bmiss_count++;
++              if (count) {
++                      /* if the counter was already above zero, reset it
++                       * here, since we're going to do the bmiss handling
++                       * in any case */
++                      vap->iv_bmiss_count = 0;
++              } else {
++                      /* schedule the software beacon miss timer, it will be
++                       * cancelled, if the probe request is acked */
++                      mod_timer(&vap->iv_swbmiss, jiffies + vap->iv_swbmiss_period);
++              }
++              IEEE80211_UNLOCK_IRQ(ic);
++
++              if (!count) {
++                      ieee80211_send_probereq(vap->iv_bss, vap->iv_myaddr,
++                              vap->iv_bss->ni_bssid, vap->iv_bss->ni_bssid,
++                              vap->iv_bss->ni_essid, vap->iv_bss->ni_esslen,
++                              NULL, 0);
++                      continue;
++              }
++
+               if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
+ #ifdef ATH_SUPERG_DYNTURBO
+                       /* 
+@@ -1621,14 +1646,14 @@ __ieee80211_newstate(struct ieee80211vap
+               }
+               /* WDS/Repeater: Start software beacon timer for STA */
++              vap->iv_swbmiss.function = ieee80211_sta_swbmiss;
++              vap->iv_swbmiss.data = (unsigned long) vap;
++              vap->iv_swbmiss_period = IEEE80211_TU_TO_JIFFIES(
++                      vap->iv_ic->ic_bmissthreshold * ni->ni_intval);
++
+               if (ostate != IEEE80211_S_RUN &&
+                   (vap->iv_opmode == IEEE80211_M_STA &&
+                    vap->iv_flags_ext & IEEE80211_FEXT_SWBMISS)) {
+-                      vap->iv_swbmiss.function = ieee80211_sta_swbmiss;
+-                      vap->iv_swbmiss.data = (unsigned long) vap;
+-                      vap->iv_swbmiss_period = IEEE80211_TU_TO_JIFFIES(
+-                              vap->iv_ic->ic_bmissthreshold * ni->ni_intval);
+-
+                       mod_timer(&vap->iv_swbmiss, jiffies + vap->iv_swbmiss_period);
+               }
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -283,6 +283,7 @@ struct ieee80211vap {
+       struct timer_list iv_swbmiss;                   /* software beacon miss timer */
+       u_int16_t iv_swbmiss_period;                    /* software beacon miss timer period */
++      u_int16_t iv_bmiss_count;                       /* consecutive beacon miss counter */
+       struct ieee80211_nsparams iv_nsparams;          /* new state parameters for tasklet for stajoin1 */
+       struct IEEE80211_TQ_STRUCT iv_stajoin1tq;       /* tasklet for newstate action called from stajoin1tq */
+       unsigned int iv_nsdone;                         /* Done with scheduled newstate tasklet */
diff --git a/net/madwifi/patches/362-rssithr.patch b/net/madwifi/patches/362-rssithr.patch
new file mode 100644 (file)
index 0000000..7e178e1
--- /dev/null
@@ -0,0 +1,93 @@
+Add an optional threshold for low-rssi disconnection. This can be useful
+when letting wpa_supplicant control roaming.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -647,6 +647,8 @@ enum {
+       IEEE80211_PARAM_PROTMODE_RSSI           = 77,   /* RSSI Threshold for enabling protection mode */
+       IEEE80211_PARAM_PROTMODE_TIMEOUT        = 78,   /* Timeout for expiring protection mode */
+       IEEE80211_PARAM_BGSCAN_THRESH           = 79,   /* bg scan rssi threshold */
++      IEEE80211_PARAM_RSSI_DIS_THR    = 80,   /* rssi threshold for disconnection */
++      IEEE80211_PARAM_RSSI_DIS_COUNT  = 81,   /* counter for rssi threshold */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2799,6 +2799,12 @@ ieee80211_ioctl_setparam(struct net_devi
+       case IEEE80211_PARAM_ROAM_RATE_11G:
+               vap->iv_roam.rate11b = value;
+               break;
++      case IEEE80211_PARAM_RSSI_DIS_THR:
++              vap->iv_rssi_dis_thr = value;
++              break;
++      case IEEE80211_PARAM_RSSI_DIS_COUNT:
++              vap->iv_rssi_dis_max = value;
++              break;
+       case IEEE80211_PARAM_UAPSDINFO:
+               if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
+                       if (ic->ic_caps & IEEE80211_C_UAPSD) {
+@@ -3184,6 +3190,12 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_ROAM_RATE_11G:
+               param[0] = vap->iv_roam.rate11b;
+               break;
++      case IEEE80211_PARAM_RSSI_DIS_THR:
++              param[0] = vap->iv_rssi_dis_thr;
++              break;
++      case IEEE80211_PARAM_RSSI_DIS_COUNT:
++              param[0] = vap->iv_rssi_dis_max;
++              break;
+       case IEEE80211_PARAM_UAPSDINFO:
+               if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
+                       if (IEEE80211_VAP_UAPSD_ENABLED(vap))
+@@ -5733,6 +5745,14 @@ static const struct iw_priv_args ieee802
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rate11g" },
+       { IEEE80211_PARAM_ROAM_RATE_11G,
+         0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rate11g" },
++      { IEEE80211_PARAM_RSSI_DIS_THR,
++        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rssi_disthr" },
++      { IEEE80211_PARAM_RSSI_DIS_THR,
++        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rssi_disthr" },
++      { IEEE80211_PARAM_RSSI_DIS_COUNT,
++        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rssi_discnt" },
++      { IEEE80211_PARAM_RSSI_DIS_COUNT,
++        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rssi_discnt" },
+       { IEEE80211_PARAM_UAPSDINFO,
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "uapsd" },
+       { IEEE80211_PARAM_UAPSDINFO,
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3261,6 +3261,19 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       memcpy(ni->ni_tstamp.data, scan.tstamp,
+                               sizeof(ni->ni_tstamp));
++                      /* when rssi falls below the disconnection threshold, drop the connection */
++                      if ((vap->iv_rssi_dis_thr > 0) && (vap->iv_rssi_dis_max > 0)) {
++                              if ((rssi > 0) && (rssi < vap->iv_rssi_dis_thr)) {
++                                      if (++vap->iv_rssi_dis_trig > vap->iv_rssi_dis_max) {
++                                              vap->iv_rssi_dis_trig = 0;
++                                              ieee80211_node_leave(ni);
++                                              return;
++                                      }
++                              } else {
++                                      vap->iv_rssi_dis_trig = 0;
++                              }
++                      }
++
+                       /* When rssi is low, start doing bgscans more frequently to allow
+                        * the supplicant to make a better switching decision */
+                       if (!(ic->ic_flags & IEEE80211_F_SCAN) && (rssi < vap->iv_bgscanthr) &&
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -223,6 +223,9 @@ struct ieee80211vap {
+       u_int iv_bgscanintvl;                           /* bg scan min interval */
+       u_int iv_bgscanthr;                                     /* bg scan rssi threshold */
+       u_int iv_bgscantrintvl;                         /* bg scan trigger interval */
++      u_int iv_rssi_dis_thr;                          /* rssi disassoc threshold */
++      u_int iv_rssi_dis_max;                          /* max beacons below disconnect threshold */
++      u_int iv_rssi_dis_trig;                         /* rssi disassoc trigger count */
+       unsigned long iv_bgscanthr_next;                /* last trigger for bgscan */
+       unsigned long iv_lastconnect;   /* time of last connect attempt */
+       u_int iv_scanvalid;                             /* scan cache valid threshold */
diff --git a/net/madwifi/patches/363-fix_turbo.patch b/net/madwifi/patches/363-fix_turbo.patch
new file mode 100644 (file)
index 0000000..880f2d6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -4925,7 +4925,7 @@ ath_beacon_generate(struct ath_softc *sc
+        * capability info and arrange for a mode change
+        * if needed.
+        */
+-      if (sc->sc_dturbo) {
++      if (sc->sc_dturbo && NULL != avp->av_boff.bo_tim) {
+               u_int8_t dtim;
+               dtim = ((avp->av_boff.bo_tim[2] == 1) ||
+                       (avp->av_boff.bo_tim[3] == 1));
diff --git a/net/madwifi/patches/364-memory_alloc.patch b/net/madwifi/patches/364-memory_alloc.patch
new file mode 100644 (file)
index 0000000..53fbc77
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -539,8 +539,8 @@ ath_attach(u_int16_t devid, struct net_d
+       /* Allocate space for dynamically determined maximum VAP count */
+       sc->sc_bslot = 
+-              kmalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL);
+-      memset(sc->sc_bslot, 0, ath_maxvaps * sizeof(struct ieee80211vap));
++              kmalloc(ath_maxvaps * sizeof(struct ieee80211vap*), GFP_KERNEL);
++      memset(sc->sc_bslot, 0, ath_maxvaps * sizeof(struct ieee80211vap*));
+       /*
+        * Cache line size is used to size and align various
diff --git a/net/madwifi/patches/365-turbo_channelsearch.patch b/net/madwifi/patches/365-turbo_channelsearch.patch
new file mode 100644 (file)
index 0000000..df4306b
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -684,6 +684,7 @@ ieee80211_find_channel(struct ieee80211c
+       int i;
+       /* Brute force search */
++      flags &= IEEE80211_CHAN_ALLTURBO;
+       for (i = 0; i < ic->ic_nchans; i++) {
+               c = &ic->ic_channels[i];
+               if (c->ic_freq == freq &&
diff --git a/net/madwifi/patches/366-bstuck_thresh.patch b/net/madwifi/patches/366-bstuck_thresh.patch
new file mode 100644 (file)
index 0000000..cde1f5c
--- /dev/null
@@ -0,0 +1,52 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -389,6 +389,7 @@ static int ath_countrycode = CTRY_DEFAUL
+ static int ath_outdoor = AH_FALSE;            /* enable outdoor use */
+ static int ath_xchanmode = AH_TRUE;           /* enable extended channels */
+ static int ath_maxvaps = ATH_MAXVAPS_DEFAULT;   /* set default maximum vaps */
++static int bstuck_thresh = BSTUCK_THRESH;       /* Stuck beacon count required for reset */
+ static char *autocreate = NULL;
+ static char *ratectl = DEF_RATE_CTL;
+ static int rfkill = 0;
+@@ -432,6 +433,7 @@ MODULE_PARM(rfkill, "i");
+ #ifdef ATH_CAP_TPC
+ MODULE_PARM(tpc, "i");
+ #endif
++MODULE_PARM(bstuck_thresh, "i");
+ MODULE_PARM(autocreate, "s");
+ MODULE_PARM(ratectl, "s");
+ #else
+@@ -445,6 +447,7 @@ module_param(rfkill, int, 0600);
+ #ifdef ATH_CAP_TPC
+ module_param(tpc, int, 0600);
+ #endif
++module_param(bstuck_thresh, int, 0600);
+ module_param(autocreate, charp, 0600);
+ module_param(ratectl, charp, 0600);
+ #endif
+@@ -457,6 +460,7 @@ MODULE_PARM_DESC(rfkill, "Enable/disable
+ MODULE_PARM_DESC(tpc, "Enable/disable per-packet transmit power control (TPC) "
+               "capability");
+ #endif
++MODULE_PARM_DESC(bstuck_thresh, "Override default stuck beacon threshold");
+ MODULE_PARM_DESC(autocreate, "Create ath device in "
+               "[sta|ap|wds|adhoc|ahdemo|monitor] mode. defaults to sta, use "
+               "'none' to disable");
+@@ -5072,7 +5076,7 @@ ath_beacon_send(struct ath_softc *sc, in
+               DPRINTF(sc, ATH_DEBUG_BEACON_PROC,
+                       "Missed %u consecutive beacons (n_beacon=%u)\n",
+                       sc->sc_bmisscount, n_beacon);
+-              if (sc->sc_bmisscount > BSTUCK_THRESH)
++              if (sc->sc_bmisscount > bstuck_thresh)
+                       ATH_SCHEDULE_TQUEUE(&sc->sc_bstucktq, needmark);
+               return;
+       }
+@@ -5230,7 +5234,7 @@ ath_bstuck_tasklet(TQUEUE_ARG data)
+        *     check will be true, in which case return
+        *     without resetting the driver.
+        */
+-      if (sc->sc_bmisscount <= BSTUCK_THRESH)
++      if (sc->sc_bmisscount <= bstuck_thresh)
+               return;
+       EPRINTF(sc, "Stuck beacon; resetting (beacon miss count: %u)\n",
+               sc->sc_bmisscount);
diff --git a/net/madwifi/patches/367-roaming.patch b/net/madwifi/patches/367-roaming.patch
new file mode 100644 (file)
index 0000000..5950f9f
--- /dev/null
@@ -0,0 +1,77 @@
+Patch adapted from ubnt madwifi patchset
+
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -659,7 +659,7 @@ ieee80211_sta_join1(struct ieee80211_nod
+                */
+               if (canreassoc) {
+                       vap->iv_nsparams.newstate = IEEE80211_S_ASSOC;
+-                      vap->iv_nsparams.arg = 0;
++                      vap->iv_nsparams.arg = IEEE80211_FC0_SUBTYPE_REASSOC_REQ;
+                       IEEE80211_SCHEDULE_TQUEUE(&vap->iv_stajoin1tq);
+               } else {
+                       vap->iv_nsparams.newstate = IEEE80211_S_AUTH;
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -748,14 +748,17 @@ notfound:
+  * a reference to an entry w/o holding the lock on the table.
+  */
+ static struct sta_entry *
+-sta_lookup(struct sta_table *st, const u_int8_t macaddr[IEEE80211_ADDR_LEN])
++sta_lookup(struct sta_table *st, const u_int8_t macaddr[IEEE80211_ADDR_LEN], struct ieee80211_scan_ssid* essid)
+ {
+       struct sta_entry *se;
+       int hash = STA_HASH(macaddr);
+       SCAN_STA_LOCK_IRQ(st);
+       LIST_FOREACH(se, &st->st_hash[hash], se_hash)
+-              if (IEEE80211_ADDR_EQ(se->base.se_macaddr, macaddr))
++              if (IEEE80211_ADDR_EQ(se->base.se_macaddr, macaddr) &&
++                  (essid->len == se->base.se_ssid[1] &&
++                   !memcmp(se->base.se_ssid+2, essid->ssid,
++                           se->base.se_ssid[1])))
+                       break;
+       SCAN_STA_UNLOCK_IRQ(st);
+@@ -772,7 +775,7 @@ sta_roam_check(struct ieee80211_scan_sta
+       u_int8_t roamRate, curRate;
+       int8_t roamRssi, curRssi;
+-      se = sta_lookup(st, ni->ni_macaddr);
++      se = sta_lookup(st, ni->ni_macaddr, ss->ss_ssid);
+       if (se == NULL) {
+               /* XXX something is wrong */
+               return;
+@@ -866,8 +869,8 @@ sta_age(struct ieee80211_scan_state *ss)
+        */
+       KASSERT(vap->iv_opmode == IEEE80211_M_STA,
+               ("wrong mode %u", vap->iv_opmode));
+-      /* XXX turn this off until the ap release is cut */
+-      if (0 && vap->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO &&
++      if (vap->iv_opmode == IEEE80211_M_STA &&
++          vap->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO &&
+           vap->iv_state >= IEEE80211_S_RUN)
+               /* XXX vap is implicit */
+               sta_roam_check(ss, vap);
+@@ -922,7 +925,11 @@ sta_assoc_fail(struct ieee80211_scan_sta
+       struct sta_table *st = ss->ss_priv;
+       struct sta_entry *se;
+-      se = sta_lookup(st, macaddr);
++      /* Let outside apps to decide what peer is blacklisted */
++      if (ss->ss_vap->iv_ic->ic_roaming == IEEE80211_ROAMING_MANUAL)
++              return;
++
++      se = sta_lookup(st, macaddr, ss->ss_ssid);
+       if (se != NULL) {
+               se->se_fails++;
+               se->se_lastfail = jiffies;
+@@ -939,7 +946,7 @@ sta_assoc_success(struct ieee80211_scan_
+       struct sta_table *st = ss->ss_priv;
+       struct sta_entry *se;
+-      se = sta_lookup(st, macaddr);
++      se = sta_lookup(st, macaddr, ss->ss_ssid);
+       if (se != NULL) {
+ #if 0
+               se->se_fails = 0;
diff --git a/net/madwifi/patches/368-sta_ie_preserve.patch b/net/madwifi/patches/368-sta_ie_preserve.patch
new file mode 100644 (file)
index 0000000..4beef62
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -201,8 +201,10 @@ sta_flush_table(struct sta_table *st)
+ }
+ static void
+-saveie(u_int8_t **iep, const u_int8_t *ie)
++saveie(u_int8_t **iep, const u_int8_t *ie, int preserve)
+ {
++      if (preserve && *iep)
++              return;
+       if (ie == NULL)
+               *iep = NULL;
+       else
+@@ -304,10 +306,10 @@ found:
+                   (const struct ieee80211_tim_ie *) sp->tim;
+               ise->se_dtimperiod = tim->tim_period;
+       }
+-      saveie(&ise->se_wme_ie, sp->wme);
+-      saveie(&ise->se_wpa_ie, sp->wpa);
+-      saveie(&ise->se_rsn_ie, sp->rsn);
+-      saveie(&ise->se_ath_ie, sp->ath);
++      saveie(&ise->se_wme_ie, sp->wme, 0);
++      saveie(&ise->se_wpa_ie, sp->wpa, !sp->isprobe);
++      saveie(&ise->se_rsn_ie, sp->rsn, !sp->isprobe);
++      saveie(&ise->se_ath_ie, sp->ath, 0);
+       /* clear failure count after STA_FAIL_AGE passes */
+       if (se->se_fails && (jiffies - se->se_lastfail) > STA_FAILS_AGE*HZ) {
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3106,6 +3106,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                */
+               IEEE80211_VERIFY_LENGTH(efrm - frm, 12);
+               memset(&scan, 0, sizeof(scan));
++              scan.isprobe = (subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP) && IEEE80211_ADDR_EQ(wh->i_addr2, vap->iv_myaddr);
+               scan.tstamp  = frm;
+               frm += 8;
+               scan.bintval = le16toh(*(__le16 *)frm);
+--- a/net80211/ieee80211_scan.h
++++ b/net80211/ieee80211_scan.h
+@@ -133,6 +133,7 @@ struct ieee80211_scanparams {
+       u_int8_t erp;
+       u_int16_t bintval;
+       u_int8_t timoff;
++      u_int8_t isprobe;
+       u_int8_t *tim;
+       u_int8_t *tstamp;
+       u_int8_t *country;
diff --git a/net/madwifi/patches/369-mlme_assoc.patch b/net/madwifi/patches/369-mlme_assoc.patch
new file mode 100644 (file)
index 0000000..43aac66
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -3723,6 +3723,7 @@ ieee80211_ioctl_setmlme(struct net_devic
+               if (vap->iv_opmode == IEEE80211_M_STA) {
+                       struct scanlookup lookup;
++                      preempt_scan(dev, 100, 100);
+                       lookup.se = NULL;
+                       lookup.mac = mlme->im_macaddr;
+                       /* XXX use revised api w/ explicit ssid */
diff --git a/net/madwifi/patches/370-wdsvap.patch b/net/madwifi/patches/370-wdsvap.patch
new file mode 100644 (file)
index 0000000..e507afb
--- /dev/null
@@ -0,0 +1,1665 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -124,7 +124,7 @@ enum {
+ };
+ static struct ieee80211vap *ath_vap_create(struct ieee80211com *,
+-      const char *, int, int, struct net_device *);
++      const char *, int, int, struct net_device *, struct ieee80211vap *);
+ static void ath_vap_delete(struct ieee80211vap *);
+ static int ath_init(struct net_device *);
+ static int ath_set_ack_bitrate(struct ath_softc *, int);
+@@ -1123,8 +1123,6 @@ ath_attach(u_int16_t devid, struct net_d
+                       autocreatemode = IEEE80211_M_IBSS;
+               else if (!strcmp(autocreate, "ahdemo"))
+                       autocreatemode = IEEE80211_M_AHDEMO;
+-              else if (!strcmp(autocreate, "wds"))
+-                      autocreatemode = IEEE80211_M_WDS;
+               else if (!strcmp(autocreate, "monitor"))
+                       autocreatemode = IEEE80211_M_MONITOR;
+               else {
+@@ -1137,7 +1135,7 @@ ath_attach(u_int16_t devid, struct net_d
+       if (autocreatemode != -1) {
+               rtnl_lock();
+               vap = ieee80211_create_vap(ic, "ath%d", dev,
+-                              autocreatemode, 0);
++                              autocreatemode, 0, NULL);
+               rtnl_unlock();
+               if (vap == NULL)
+                       EPRINTF(sc, "Autocreation of %s VAP failed.", autocreate);
+@@ -1230,14 +1228,14 @@ ath_detach(struct net_device *dev)
+ static struct ieee80211vap *
+ ath_vap_create(struct ieee80211com *ic, const char *name,
+-      int opmode, int flags, struct net_device *mdev)
++      int opmode, int flags, struct net_device *mdev, struct ieee80211vap *master)
+ {
+       struct ath_softc *sc = ic->ic_dev->priv;
+       struct ath_hal *ah = sc->sc_ah;
+       struct net_device *dev;
+       struct ath_vap *avp;
+       struct ieee80211vap *vap;
+-      int ic_opmode;
++      int ic_opmode = IEEE80211_M_STA;
+       if (ic->ic_dev->flags & IFF_RUNNING) {
+               /* needs to disable hardware too */
+@@ -1271,8 +1269,12 @@ ath_vap_create(struct ieee80211com *ic, 
+               } else
+                       ic_opmode = opmode;
+               break;
+-      case IEEE80211_M_HOSTAP:
+       case IEEE80211_M_WDS:
++              ic_opmode = ic->ic_opmode;
++              if (!master)
++                      return NULL;
++              break;
++      case IEEE80211_M_HOSTAP:
+               /* permit multiple APs and/or WDS links */
+               /* XXX sta+ap for repeater/bridge application */
+               if ((sc->sc_nvaps != 0) && (ic->ic_opmode == IEEE80211_M_STA))
+@@ -1304,7 +1306,7 @@ ath_vap_create(struct ieee80211com *ic, 
+       }
+       avp = dev->priv;
+-      ieee80211_vap_setup(ic, dev, name, opmode, flags);
++      ieee80211_vap_setup(ic, dev, name, opmode, flags, master);
+       /* override with driver methods */
+       vap = &avp->av_vap;
+       avp->av_newstate = vap->iv_newstate;
+@@ -4209,8 +4211,7 @@ ath_calcrxfilter(struct ath_softc *sc)
+       if (ic->ic_opmode == IEEE80211_M_STA ||
+           sc->sc_opmode == HAL_M_IBSS ||      /* NB: AHDEMO too */
+           (sc->sc_nostabeacons) || sc->sc_scanning ||
+-              ((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
+-               (ic->ic_protmode != IEEE80211_PROT_NONE)))
++              (ic->ic_opmode == IEEE80211_M_HOSTAP))
+               rfilt |= HAL_RX_FILTER_BEACON;
+       if (sc->sc_nmonvaps > 0)
+               rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
+@@ -9032,8 +9033,6 @@ ath_calibrate(unsigned long arg)
+                * set sc->beacons if we might need to restart
+                  * them after ath_reset. */
+               if (!sc->sc_beacons &&
+-                              (TAILQ_FIRST(&ic->ic_vaps)->iv_opmode != 
+-                               IEEE80211_M_WDS) &&
+                               !txcont_was_active &&
+                               !sc->sc_dfs_cac) {
+                       sc->sc_beacons = 1;
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -373,10 +373,25 @@ void
+ ieee80211_ifdetach(struct ieee80211com *ic)
+ {
+       struct ieee80211vap *vap;
++      int count;
++
++      /* bring down all vaps */
++      TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              ieee80211_stop(vap->iv_dev);
++      }
++
++      /* wait for all subifs to disappear */
++      do {
++              schedule();
++              rtnl_lock();
++              count = ic->ic_subifs;
++              rtnl_unlock();
++      } while (count > 0);
+       rtnl_lock();
+-      while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL)
++      while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) {
+               ic->ic_vap_delete(vap);
++      }
+       rtnl_unlock();
+       del_timer(&ic->ic_dfs_excl_timer);
+@@ -396,7 +411,7 @@ EXPORT_SYMBOL(ieee80211_ifdetach);
+ int
+ ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
+-      const char *name, int opmode, int flags)
++      const char *name, int opmode, int flags, struct ieee80211vap *master)
+ {
+ #define       IEEE80211_C_OPMODE \
+       (IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | IEEE80211_C_AHDEMO | \
+@@ -510,9 +525,18 @@ ieee80211_vap_setup(struct ieee80211com 
+       vap->iv_monitor_crc_errors = 0;
+       vap->iv_monitor_phy_errors = 0;
++      TAILQ_INIT(&vap->iv_wdslinks);
+-      IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_myaddr);
+-      IEEE80211_ADDR_COPY(vap->iv_bssid, ic->ic_myaddr);
++      if (master && (vap->iv_opmode == IEEE80211_M_WDS)) {
++              vap->iv_master = master;
++              TAILQ_INSERT_TAIL(&master->iv_wdslinks, vap, iv_wdsnext);
++              /* use the same BSSID as the master interface */
++              IEEE80211_ADDR_COPY(vap->iv_myaddr, vap->iv_master->iv_myaddr);
++              IEEE80211_ADDR_COPY(vap->iv_bssid, vap->iv_master->iv_myaddr);
++      } else {
++              IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_myaddr);
++              IEEE80211_ADDR_COPY(vap->iv_bssid, ic->ic_myaddr);
++      }
+       /* NB: Defer setting dev_addr so driver can override */
+       ieee80211_crypto_vattach(vap);
+@@ -547,7 +571,8 @@ ieee80211_vap_attach(struct ieee80211vap
+       ifmedia_set(&vap->iv_media, imr.ifm_active);
+       IEEE80211_LOCK_IRQ(ic);
+-      TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next);
++      if (vap->iv_opmode != IEEE80211_M_WDS)
++              TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next);
+       IEEE80211_UNLOCK_IRQ(ic);
+       IEEE80211_ADDR_COPY(dev->dev_addr, vap->iv_myaddr);
+@@ -579,10 +604,27 @@ ieee80211_vap_detach(struct ieee80211vap
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *dev = vap->iv_dev;
++      struct ieee80211vap *avp;
++
++      /* Drop all WDS links that belong to this vap */
++      while ((avp = TAILQ_FIRST(&vap->iv_wdslinks)) != NULL) {
++              if (avp->iv_state != IEEE80211_S_INIT)
++                      ieee80211_stop(avp->iv_dev);
++              ic->ic_vap_delete(avp);
++      }
+       IEEE80211_CANCEL_TQUEUE(&vap->iv_stajoin1tq);
+       IEEE80211_LOCK_IRQ(ic);
+-      TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
++      if (vap->iv_wdsnode) {
++              vap->iv_wdsnode->ni_subif = NULL;
++              ieee80211_unref_node(&vap->iv_wdsnode);
++      }
++      if ((vap->iv_opmode == IEEE80211_M_WDS) &&
++              (vap->iv_master != NULL))
++              TAILQ_REMOVE(&vap->iv_master->iv_wdslinks, vap, iv_wdsnext);
++      else
++              TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
++
+       if (TAILQ_EMPTY(&ic->ic_vaps))          /* reset to supported mode */
+               ic->ic_opmode = IEEE80211_M_STA;
+       IEEE80211_UNLOCK_IRQ(ic);
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -474,7 +474,7 @@ struct ieee80211req {
+ #define       IEEE80211_IOC_DTIM_PERIOD       52      /* DTIM period (beacons) */
+ #define       IEEE80211_IOC_BEACON_INTERVAL   53      /* beacon interval (ms) */
+ #define       IEEE80211_IOC_ADDMAC            54      /* add sta to MAC ACL table */
+-#define       IEEE80211_IOC_DELMAC            55      /* del sta from MAC ACL table */
++#define       IEEE80211_IOC_SETMAC            55      /* set interface wds mac addr */
+ #define       IEEE80211_IOC_FF                56      /* ATH fast frames (on, off) */
+ #define       IEEE80211_IOC_TURBOP            57      /* ATH turbo' (on, off) */
+ #define       IEEE80211_IOC_APPIEBUF          58      /* IE in the management frame */
+@@ -552,8 +552,8 @@ struct ieee80211req_scan_result {
+ #define       IEEE80211_IOCTL_HALMAP          (SIOCIWFIRSTPRIV+21)
+ #define       IEEE80211_IOCTL_ADDMAC          (SIOCIWFIRSTPRIV+22)
+ #define       IEEE80211_IOCTL_DELMAC          (SIOCIWFIRSTPRIV+24)
+-#define       IEEE80211_IOCTL_WDSADDMAC       (SIOCIWFIRSTPRIV+26)
+-#define       IEEE80211_IOCTL_WDSDELMAC       (SIOCIWFIRSTPRIV+28)
++#define       IEEE80211_IOCTL_WDSADDMAC       (SIOCIWFIRSTPRIV+25)
++#define       IEEE80211_IOCTL_WDSSETMAC       (SIOCIWFIRSTPRIV+26)
+ #define       IEEE80211_IOCTL_KICKMAC         (SIOCIWFIRSTPRIV+30)
+ #define       IEEE80211_IOCTL_SETSCANLIST     (SIOCIWFIRSTPRIV+31)
+@@ -649,6 +649,7 @@ enum {
+       IEEE80211_PARAM_BGSCAN_THRESH           = 79,   /* bg scan rssi threshold */
+       IEEE80211_PARAM_RSSI_DIS_THR    = 80,   /* rssi threshold for disconnection */
+       IEEE80211_PARAM_RSSI_DIS_COUNT  = 81,   /* counter for rssi threshold */
++      IEEE80211_PARAM_WDS_SEP                 = 82,   /* move wds stations into separate interfaces */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -81,6 +81,12 @@ set_quality(struct iw_quality *iq, u_int
+ #endif
+ }
++#ifndef container_of
++#define container_of(ptr, type, member) ({          \
++    const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
++          (type *)( (char *)__mptr - offsetof(type,member) );})
++#endif
++
+ /*
+  * Task deferral
+  *
+@@ -113,6 +119,29 @@ typedef void *IEEE80211_TQUEUE_ARG;
+ #define       IEEE80211_RESCHEDULE    schedule
++#include <linux/sched.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
++#include <linux/tqueue.h>
++#define work_struct                   tq_struct
++#define schedule_work(t)              schedule_task((t))
++#define flush_scheduled_work()                flush_scheduled_tasks()
++#define IEEE80211_INIT_WORK(t, f) do {                        \
++      memset((t), 0, sizeof(struct tq_struct)); \
++      (t)->routine = (void (*)(void*)) (f);   \
++      (t)->data=(void *) (t);                 \
++} while (0)
++#else
++#include <linux/workqueue.h>
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
++#define IEEE80211_INIT_WORK(_t, _f)   INIT_WORK((_t), (void (*)(void *))(_f), (_t));
++#else
++#define IEEE80211_INIT_WORK(_t, _f)   INIT_WORK((_t), (_f));
++#endif
++
++#endif /* KERNEL_VERSION < 2.5.41 */
++
++
+ /* Locking */
+ /* NB: beware, spin_is_locked() is not usefully defined for !(DEBUG || SMP)
+  * because spinlocks do not exist in this configuration. Instead IRQs 
+@@ -167,6 +196,14 @@ typedef spinlock_t ieee80211com_lock_t;
+       IEEE80211_VAPS_LOCK_ASSERT(_ic);                \
+       spin_unlock_bh(&(_ic)->ic_vapslock);            \
+ } while (0)
++#define       IEEE80211_VAPS_LOCK_IRQ(_ic) do {                                       \
++      unsigned long __ilockflags;                                     \
++      IEEE80211_VAPS_LOCK_CHECK(_ic);                                 \
++      spin_lock_irqsave(&(_ic)->ic_vapslock, __ilockflags);
++#define       IEEE80211_VAPS_UNLOCK_IRQ(_ic)                                  \
++      IEEE80211_VAPS_LOCK_ASSERT(_ic);                                        \
++      spin_unlock_irqrestore(&(_ic)->ic_vapslock, __ilockflags);      \
++} while (0)
+ #if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && defined(spin_is_locked)
+ #define IEEE80211_VAPS_LOCK_ASSERT(_ic) \
+@@ -650,5 +687,5 @@ struct ifreq;
+ int ieee80211_ioctl_create_vap(struct ieee80211com *, struct ifreq *,
+       struct net_device *);
+ struct ieee80211vap *ieee80211_create_vap(struct ieee80211com *, char *,
+-      struct net_device *, int, int);
++      struct net_device *, int, int, struct ieee80211vap *);
+ #endif /* _NET80211_IEEE80211_LINUX_H_ */
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -187,6 +187,12 @@ struct ieee80211vap {
+       struct ieee80211_proc_entry *iv_proc_entries;
+       struct vlan_group *iv_vlgrp;                    /* vlan group state */
++      /* list of wds links */
++      TAILQ_HEAD(, ieee80211vap) iv_wdslinks;
++      TAILQ_ENTRY(ieee80211vap) iv_wdsnext;
++      struct ieee80211vap *iv_master;
++      struct ieee80211_node *iv_wdsnode;
++
+       TAILQ_ENTRY(ieee80211vap) iv_next;              /* list of vap instances */
+       struct ieee80211com *iv_ic;                     /* back ptr to common state */
+       u_int32_t iv_debug;                             /* debug msg flags */
+@@ -316,6 +322,7 @@ struct ieee80211com {
+       u_int8_t ic_myaddr[IEEE80211_ADDR_LEN];
+       struct timer_list ic_inact;             /* mgmt/inactivity timer */
++      unsigned int ic_subifs;
+       u_int32_t ic_flags;                     /* state flags */
+       u_int32_t ic_flags_ext;                 /* extension of state flags */
+       u_int32_t ic_caps;                      /* capabilities */
+@@ -447,7 +454,7 @@ struct ieee80211com {
+       atomic_t ic_node_counter;
+       /* Virtual AP create/delete */
+       struct ieee80211vap *(*ic_vap_create)(struct ieee80211com *,
+-              const char *, int, int, struct net_device *);
++              const char *, int, int, struct net_device *, struct ieee80211vap *);
+       void (*ic_vap_delete)(struct ieee80211vap *);
+       /* Send/recv 802.11 management frame */
+@@ -619,6 +626,7 @@ MALLOC_DECLARE(M_80211_VAP);
+ #define IEEE80211_FEXT_DROPUNENC_EAPOL        0x00000800      /* CONF: drop unencrypted eapol frames */
+ #define IEEE80211_FEXT_APPIE_UPDATE   0x00001000      /* STATE: beacon APP IE updated */
+ #define IEEE80211_FEXT_BGSCAN_THR     0x00002000      /* bgscan due to low rssi */
++#define IEEE80211_FEXT_WDSSEP         0x00004000      /* move wds clients into separate interfaces */
+ #define IEEE80211_COM_UAPSD_ENABLE(_ic)               ((_ic)->ic_flags_ext |= IEEE80211_FEXT_UAPSD)
+ #define IEEE80211_COM_UAPSD_DISABLE(_ic)      ((_ic)->ic_flags_ext &= ~IEEE80211_FEXT_UAPSD)
+@@ -703,7 +711,7 @@ MALLOC_DECLARE(M_80211_VAP);
+ int ieee80211_ifattach(struct ieee80211com *);
+ void ieee80211_ifdetach(struct ieee80211com *);
+ int ieee80211_vap_setup(struct ieee80211com *, struct net_device *,
+-      const char *, int, int);
++      const char *, int, int, struct ieee80211vap *);
+ int ieee80211_vap_attach(struct ieee80211vap *, ifm_change_cb_t, ifm_stat_cb_t);
+ void ieee80211_vap_detach(struct ieee80211vap *);
+ void ieee80211_mark_dfs(struct ieee80211com *, struct ieee80211_channel *);
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2190,7 +2190,7 @@ ieee80211_setupxr(struct ieee80211vap *v
+                       ieee80211_scan_flush(ic);       /* NB: could optimize */
+                       if (!(xrvap = ic->ic_vap_create(ic, name, IEEE80211_M_HOSTAP,
+-                              IEEE80211_VAP_XR | IEEE80211_CLONE_BSSID, dev)))
++                              IEEE80211_VAP_XR | IEEE80211_CLONE_BSSID, dev, NULL)))
+                               return;
+                       /* We use iv_xrvap to link to the parent VAP as well */
+@@ -2867,6 +2867,14 @@ ieee80211_ioctl_setparam(struct net_devi
+               else
+                       vap->iv_minrateindex = 0;
+               break;
++      case IEEE80211_PARAM_WDS_SEP:
++              if (vap->iv_opmode != IEEE80211_M_HOSTAP)
++                      retv = -EINVAL;
++              else if (value)
++                      vap->iv_flags_ext |= IEEE80211_FEXT_WDSSEP;
++              else
++                      vap->iv_flags_ext &= ~IEEE80211_FEXT_WDSSEP;
++              break;
+ #ifdef ATH_REVERSE_ENGINEERING
+       case IEEE80211_PARAM_DUMPREGS:
+               ieee80211_dump_registers(dev, info, w, extra);
+@@ -3223,6 +3231,9 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_MINRATE:
+               param[0] = vap->iv_minrateindex;
+               break;
++      case IEEE80211_PARAM_WDS_SEP:
++              param[0] = !!(vap->iv_flags_ext & IEEE80211_FEXT_WDSSEP);
++              break;
+       default:
+               return -EOPNOTSUPP;
+       }
+@@ -3801,74 +3812,54 @@ ieee80211_ioctl_setmlme(struct net_devic
+       return 0;
+ }
++#define WDSNAME ".wds%d"
+ static int
+-ieee80211_ioctl_wdsmac(struct net_device *dev, struct iw_request_info *info,
++ieee80211_ioctl_wdsaddmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+       struct ieee80211vap *vap = dev->priv;
+       struct sockaddr *sa = (struct sockaddr *)extra;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct ieee80211vap *avp;
++      char *name;
+-      if (!IEEE80211_ADDR_NULL(vap->wds_mac)) {
+-              printk("%s: Failed to add WDS MAC: " MAC_FMT "\n", dev->name,
+-                      MAC_ADDR(sa->sa_data));
+-              printk("%s: Device already has WDS mac address attached,"
+-                      " remove first\n", dev->name);
+-              return -1;
+-      }
+-
+-      memcpy(vap->wds_mac, sa->sa_data, IEEE80211_ADDR_LEN);
++      if (vap->iv_opmode != IEEE80211_M_HOSTAP)
++              return -EINVAL;
+-      printk("%s: Added WDS MAC: " MAC_FMT "\n", dev->name,
+-              MAC_ADDR(vap->wds_mac));
++      name = kmalloc(strlen(vap->iv_dev->name) + sizeof(WDSNAME) + 1, GFP_KERNEL);
++      if (!name)
++              return -ENOMEM;
+-      if (IS_UP(vap->iv_dev)) {
+-              /* Force us back to scan state to force us to go back through RUN
+-               * state and create/pin the WDS peer node into memory. */
+-              return ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
+-      }
++      strcpy(name, vap->iv_dev->name);
++      strcat(name, WDSNAME);
++      avp = ieee80211_create_vap(ic, name, ic->ic_dev, IEEE80211_M_WDS, 0, vap);
++      kfree(name);
++      if (!avp)
++              return -ENOMEM;
++      memcpy(avp->wds_mac, sa->sa_data, IEEE80211_ADDR_LEN);
+       return 0;
+ }
++#undef WDSNAME
+ static int
+-ieee80211_ioctl_wdsdelmac(struct net_device *dev, struct iw_request_info *info,
++ieee80211_ioctl_wdssetmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+       struct ieee80211vap *vap = dev->priv;
+       struct sockaddr *sa = (struct sockaddr *)extra;
+-      struct ieee80211com *ic = vap->iv_ic;
+-      struct ieee80211_node *wds_ni;
+-      /* WDS Mac address filed already? */
+-      if (IEEE80211_ADDR_NULL(vap->wds_mac))
+-              return 0;
++      if (vap->iv_opmode != IEEE80211_M_WDS)
++              return -EINVAL;
+-      /* Compare suplied MAC address with WDS MAC of this interface 
+-       * remove when mac address is known
+-       */
+-      if (memcmp(vap->wds_mac, sa->sa_data, IEEE80211_ADDR_LEN) == 0) {
+-              if (IS_UP(vap->iv_dev)) {
+-                      wds_ni = ieee80211_find_txnode(vap, vap->wds_mac);
+-                      if (wds_ni != NULL) {
+-                              /* Release reference created by find node */
+-                              ieee80211_unref_node(&wds_ni);
+-                              /* Release reference created by transition to RUN state,
+-                               * [pinning peer node into the table] */
+-                              ieee80211_unref_node(&wds_ni);
+-                      }
+-              }
+-              memset(vap->wds_mac, 0x00, IEEE80211_ADDR_LEN);
+-              if (IS_UP(vap->iv_dev)) {
+-                      /* This leaves a dead WDS node, until started again */
+-                      return ic->ic_reset(ic->ic_dev);
+-              }
+-              return 0;
++      memcpy(vap->wds_mac, sa->sa_data, IEEE80211_ADDR_LEN);
++      if (IS_UP(vap->iv_dev)) {
++              /* Force us back to scan state to force us to go back through RUN
++               * state and create/pin the WDS peer node into memory. */
++              return ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
+       }
+-      printk("%s: WDS MAC address " MAC_FMT " is not known by this interface\n",
+-              dev->name, MAC_ADDR(sa->sa_data));
+-
+-      return -1;
++      return 0;
+ }
+ /*
+@@ -4470,6 +4461,8 @@ get_sta_space(void *arg, struct ieee8021
+       struct ieee80211vap *vap = ni->ni_vap;
+       size_t ielen;
++      if (req->vap->iv_wdsnode && ni->ni_subif)
++              vap = ni->ni_subif;
+       if (vap != req->vap && vap != req->vap->iv_xrvap)       /* only entries for this vap */
+               return;
+       if ((vap->iv_opmode == IEEE80211_M_HOSTAP ||
+@@ -4489,6 +4482,8 @@ get_sta_info(void *arg, struct ieee80211
+       size_t ielen, len;
+       u_int8_t *cp;
++      if (req->vap->iv_wdsnode && ni->ni_subif)
++              vap = ni->ni_subif;
+       if (vap != req->vap && vap != req->vap->iv_xrvap)       /* only entries for this vap (or) xrvap */
+               return;
+       if ((vap->iv_opmode == IEEE80211_M_HOSTAP ||
+@@ -5391,8 +5386,8 @@ static const struct iw_priv_args ieee802
+         IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "kickmac"},
+       { IEEE80211_IOCTL_WDSADDMAC,
+         IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,"wds_add" },
+-      { IEEE80211_IOCTL_WDSDELMAC,
+-        IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,"wds_del" },
++      { IEEE80211_IOCTL_WDSSETMAC,
++        IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0,"wds_set" },
+       { IEEE80211_IOCTL_SETCHANLIST,
+         IW_PRIV_TYPE_CHANLIST | IW_PRIV_SIZE_FIXED, 0,"setchanlist" },
+       { IEEE80211_IOCTL_GETCHANLIST,
+@@ -5790,6 +5785,10 @@ static const struct iw_priv_args ieee802
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
+       { IEEE80211_IOCTL_SETSCANLIST,
+        IW_PRIV_TYPE_CHAR | 255, 0, "setscanlist"},
++      { IEEE80211_PARAM_WDS_SEP,
++       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wdssep"},
++      { IEEE80211_PARAM_WDS_SEP,
++       0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_wdssep"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
+@@ -5884,8 +5883,8 @@ static const iw_handler ieee80211_priv_h
+ #endif
+       set_priv(IEEE80211_IOCTL_ADDMAC, ieee80211_ioctl_addmac),
+       set_priv(IEEE80211_IOCTL_DELMAC, ieee80211_ioctl_delmac),
+-      set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsmac),
+-      set_priv(IEEE80211_IOCTL_WDSDELMAC, ieee80211_ioctl_wdsdelmac),
++      set_priv(IEEE80211_IOCTL_WDSADDMAC, ieee80211_ioctl_wdsaddmac),
++      set_priv(IEEE80211_IOCTL_WDSSETMAC, ieee80211_ioctl_wdssetmac),
+       set_priv(IEEE80211_IOCTL_KICKMAC, ieee80211_ioctl_kickmac),
+       set_priv(IEEE80211_IOCTL_SETSCANLIST, ieee80211_ioctl_setscanlist),
+ #ifdef ATH_REVERSE_ENGINEERING
+@@ -5913,6 +5912,8 @@ static int
+ ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ {
+       struct ieee80211vap *vap = dev->priv;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct ieee80211_node *ni;
+       switch (cmd) {
+       case SIOCG80211STATS:
+@@ -5921,8 +5922,20 @@ ieee80211_ioctl(struct net_device *dev, 
+       case SIOC80211IFDESTROY:
+               if (!capable(CAP_NET_ADMIN))
+                       return -EPERM;
++              /* drop all node subifs */
++              TAILQ_FOREACH(ni, &ic->ic_sta.nt_node, ni_list) {
++                      struct ieee80211vap *avp = ni->ni_subif;
++
++                      if (ni->ni_vap != vap)
++                              continue;
++                      if (!avp)
++                              continue;
++                      ni->ni_subif = NULL;
++                      ieee80211_stop(avp->iv_dev);
++                      ic->ic_vap_delete(avp);
++              }
+               ieee80211_stop(vap->iv_dev);    /* force state before cleanup */
+-              vap->iv_ic->ic_vap_delete(vap);
++              ic->ic_vap_delete(vap);
+               return 0;
+       case IEEE80211_IOCTL_GETKEY:
+               return ieee80211_ioctl_getkey(dev, (struct iwreq *) ifr);
+@@ -5956,7 +5969,7 @@ ieee80211_ioctl_create_vap(struct ieee80
+       strncpy(name, cp.icp_name, sizeof(name));
+-      vap = ieee80211_create_vap(ic, name, mdev, cp.icp_opmode, cp.icp_flags);
++      vap = ieee80211_create_vap(ic, name, mdev, cp.icp_opmode, cp.icp_flags, NULL);
+       if (vap == NULL)
+               return -EIO;
+@@ -5973,9 +5986,9 @@ EXPORT_SYMBOL(ieee80211_ioctl_create_vap
+  */
+ struct ieee80211vap*
+ ieee80211_create_vap(struct ieee80211com *ic, char *name,
+-      struct net_device *mdev, int opmode, int opflags)
++      struct net_device *mdev, int opmode, int opflags, struct ieee80211vap *master)
+ {
+-      return ic->ic_vap_create(ic, name, opmode, opflags, mdev);
++      return ic->ic_vap_create(ic, name, opmode, opflags, mdev, master);
+ }
+ EXPORT_SYMBOL(ieee80211_create_vap);
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -199,8 +199,10 @@ ieee80211_input(struct ieee80211vap * va
+ {
+ #define       HAS_SEQ(type)   ((type & 0x4) == 0)
+       struct ieee80211_node * ni = ni_or_null;
+-      struct ieee80211com *ic = vap->iv_ic;
+-      struct net_device *dev = vap->iv_dev;
++      struct ieee80211com *ic;
++      struct net_device *dev;
++      struct ieee80211_node *ni_wds = NULL;
++      struct net_device_stats *stats;
+       struct ieee80211_frame *wh;
+       struct ieee80211_key *key;
+       struct ether_header *eh;
+@@ -212,6 +214,19 @@ ieee80211_input(struct ieee80211vap * va
+       u_int8_t *bssid;
+       u_int16_t rxseq;
++      type = -1;                      /* undefined */
++
++      if (!vap)
++              goto out;
++
++      ic = vap->iv_ic;
++      if (!ic)
++              goto out;
++
++      dev = vap->iv_dev;
++      if (!dev)
++              goto out;
++
+       /* initialize ni as in the previous API */
+       if (ni_or_null == NULL) {
+                /* This function does not 'own' vap->iv_bss, so we cannot
+@@ -227,7 +242,6 @@ ieee80211_input(struct ieee80211vap * va
+       /* XXX adjust device in sk_buff? */
+-      type = -1;                      /* undefined */
+       /*
+        * In monitor mode, send everything directly to bpf.
+        * Also do not process frames w/o i_addr2 any further.
+@@ -434,7 +448,7 @@ ieee80211_input(struct ieee80211vap * va
+       switch (type) {
+       case IEEE80211_FC0_TYPE_DATA:
+-              hdrspace = ieee80211_hdrspace(ic, wh);
++              hdrspace = ieee80211_hdrsize(wh);
+               if (skb->len < hdrspace) {
+                       IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
+                               wh, "data", "too short: len %u, expecting %u",
+@@ -444,16 +458,24 @@ ieee80211_input(struct ieee80211vap * va
+               }
+               switch (vap->iv_opmode) {
+               case IEEE80211_M_STA:
+-                      if ((dir != IEEE80211_FC1_DIR_FROMDS) &&
+-                          (!((vap->iv_flags_ext & IEEE80211_FEXT_WDS) &&
+-                          (dir == IEEE80211_FC1_DIR_DSTODS)))) {
++                      switch(dir) {
++                      case IEEE80211_FC1_DIR_FROMDS:
++                              break;
++                      case IEEE80211_FC1_DIR_DSTODS:
++                              if (vap->iv_flags_ext & IEEE80211_FEXT_WDS)
++                                      break;
++                      default:
+                               IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
+                                       wh, "data", "invalid dir 0x%x", dir);
+                               vap->iv_stats.is_rx_wrongdir++;
+                               goto out;
+                       }
+-                      if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
++                      if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
++                              /* ignore 3-addr mcast if we're WDS STA */
++                              if (vap->iv_flags_ext & IEEE80211_FEXT_WDS)
++                                      goto out;
++
+                               /* Discard multicast if IFF_MULTICAST not set */
+                               if ((0 != memcmp(wh->i_addr3, dev->broadcast, ETH_ALEN)) && 
+                                       (0 == (dev->flags & IFF_MULTICAST))) {
+@@ -481,24 +503,10 @@ ieee80211_input(struct ieee80211vap * va
+                                       vap->iv_stats.is_rx_mcastecho++;
+                                       goto out;
+                               }
+-                              /* 
+-                               * if it is brodcasted by me on behalf of
+-                               * a station behind me, drop it.
+-                               */
+-                              if (vap->iv_flags_ext & IEEE80211_FEXT_WDS) {
+-                                      struct ieee80211_node_table *nt;
+-                                      struct ieee80211_node *ni_wds;
+-                                      nt = &ic->ic_sta;
+-                                      ni_wds = ieee80211_find_wds_node(nt, wh->i_addr3);
+-                                      if (ni_wds) {
+-                                              ieee80211_unref_node(&ni_wds);
+-                                              IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
+-                                                      wh, NULL, "%s",
+-                                                      "multicast echo originated from node behind me");
+-                                              vap->iv_stats.is_rx_mcastecho++;
+-                                              goto out;
+-                                      }
+-                              }
++                      } else {
++                              /* Same BSSID, but not meant for us to receive */
++                              if (!IEEE80211_ADDR_EQ(wh->i_addr1, vap->iv_myaddr))
++                                      goto out;
+                       }
+                       break;
+               case IEEE80211_M_IBSS:
+@@ -540,16 +548,28 @@ ieee80211_input(struct ieee80211vap * va
+                               vap->iv_stats.is_rx_notassoc++;
+                               goto err;
+                       }
++
+                       /*
+                        * If we're a 4 address packet, make sure we have an entry in
+                        * the node table for the packet source address (addr4).
+                        * If not, add one.
+                        */
++                      /* check for wds link first */
++                      if ((dir == IEEE80211_FC1_DIR_DSTODS) && !ni->ni_subif) {
++                              if (vap->iv_flags_ext & IEEE80211_FEXT_WDSSEP) {
++                                      ieee80211_wds_addif(ni);
++                                      /* we must drop frames here until the interface has
++                                       * been fully separated, otherwise a bridge might get
++                                       * confused */
++                                      goto err;
++                              }
++                      }
++
+                       /* XXX: Useless node mgmt API; make better */
+-                      if (dir == IEEE80211_FC1_DIR_DSTODS) {
+-                              struct ieee80211_node_table *nt;
++                      if ((dir == IEEE80211_FC1_DIR_DSTODS) && !vap->iv_wdsnode &&
++                                      !ni_wds && !ni->ni_subif) {
++                              struct ieee80211_node_table *nt = &ic->ic_sta;
+                               struct ieee80211_frame_addr4 *wh4;
+-                              struct ieee80211_node *ni_wds;
+                               if (!(vap->iv_flags_ext & IEEE80211_FEXT_WDS)) {
+                                       IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
+@@ -557,7 +577,6 @@ ieee80211_input(struct ieee80211vap * va
+                                       goto err;
+                               }
+                               wh4 = (struct ieee80211_frame_addr4 *)skb->data;
+-                              nt = &ic->ic_sta;
+                               ni_wds = ieee80211_find_wds_node(nt, wh4->i_addr4);
+                               /* Last call increments ref count if !NULL */
+                               if ((ni_wds != NULL) && (ni_wds != ni)) {
+@@ -608,6 +627,11 @@ ieee80211_input(struct ieee80211vap * va
+                       goto out;
+               }
++              /* check if there is any data left */
++              hdrspace = ieee80211_hdrspace(ic, wh);
++              if (skb->len < hdrspace)
++                      goto out;
++
+               /*
+                * Handle privacy requirements.  Note that we
+                * must not be preempted from here until after
+@@ -680,8 +704,12 @@ ieee80211_input(struct ieee80211vap * va
+               if (! accept_data_frame(vap, ni, key, skb, eh))
+                       goto out;
+-              vap->iv_devstats.rx_packets++;
+-              vap->iv_devstats.rx_bytes += skb->len;
++              if (ni->ni_subif && ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE)))
++                      stats = &ni->ni_subif->iv_devstats;
++              else
++                      stats = &vap->iv_devstats;
++              stats->rx_packets++;
++              stats->rx_bytes += skb->len;
+               IEEE80211_NODE_STAT(ni, rx_data);
+               IEEE80211_NODE_STAT_ADD(ni, rx_bytes, skb->len);
+               ic->ic_lastdata = jiffies;
+@@ -1114,6 +1142,18 @@ ieee80211_deliver_data(struct ieee80211_
+               dev = vap->iv_xrvap->iv_dev;
+ #endif
++      /* if the node has a wds subif, move data frames there,
++       * but keep EAP traffic on the master */
++      if (ni->ni_subif && ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE))) {
++              if (ni->ni_vap == ni->ni_subif) {
++                      ieee80211_dev_kfree_skb(&skb);
++                      return;
++              } else {
++                      vap = ni->ni_subif;
++                      dev = vap->iv_dev;
++              }
++      }
++
+       /* perform as a bridge within the vap */
+       /* XXX intra-vap bridging only */
+       if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
+@@ -1139,7 +1179,16 @@ ieee80211_deliver_data(struct ieee80211_
+                       if (ni1 != NULL) {
+                               if (ni1->ni_vap == vap &&
+                                   ieee80211_node_is_authorized(ni1) &&
++                                      !ni1->ni_subif &&
+                                   ni1 != vap->iv_bss) {
++
++                                      /* tried to bridge to a subif, drop the packet */
++                                      if (ni->ni_subif) {
++                                              ieee80211_unref_node(&ni1);
++                                              ieee80211_dev_kfree_skb(&skb);
++                                              return;
++                                      }
++
+                                       skb1 = skb;
+                                       skb = NULL;
+                               }
+@@ -3084,8 +3133,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                   (vap->iv_opmode == IEEE80211_M_STA && ni->ni_associd) ||
+                   (vap->iv_opmode == IEEE80211_M_IBSS) ||
+                       ((subtype == IEEE80211_FC0_SUBTYPE_BEACON) &&
+-                       (vap->iv_opmode == IEEE80211_M_HOSTAP) &&
+-                       (ic->ic_protmode != IEEE80211_PROT_NONE)))) {
++                       (vap->iv_opmode == IEEE80211_M_HOSTAP)))) {
+                       vap->iv_stats.is_rx_mgtdiscard++;
+                       return;
+               }
+@@ -3471,13 +3519,56 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                */
+               if (ic->ic_flags & IEEE80211_F_SCAN) {
+                       ieee80211_add_scan(vap, &scan, wh, subtype, rssi, rtsf);
+-                      return;
+               }
+-              if ((vap->iv_opmode == IEEE80211_M_IBSS) && 
+-                              (scan.capinfo & IEEE80211_CAPINFO_IBSS)) {
++              /* NB: Behavior of WDS-Link and Ad-Hoc is very similar here:
++               * When we receive a beacon that belongs to the AP that we're
++               * connected to, use it to refresh the local node info.
++               * If no node is found, go through the vap's wds link table
++               * and try to find the sub-vap that is interested in this address
++               */
++              if (((vap->iv_opmode == IEEE80211_M_IBSS) &&
++                              (scan.capinfo & IEEE80211_CAPINFO_IBSS)) ||
++                              (((vap->iv_opmode == IEEE80211_M_HOSTAP) ||
++                               (vap->iv_opmode == IEEE80211_M_WDS)) &&
++                              (scan.capinfo & IEEE80211_CAPINFO_ESS))) {
++                      struct ieee80211vap *avp = NULL;
++                      int found = 0;
++
++                      IEEE80211_LOCK_IRQ(vap->iv_ic);
++                      if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
++                              TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
++                                      if (!memcmp(avp->wds_mac, wh->i_addr2, IEEE80211_ADDR_LEN)) {
++                                              if (avp->iv_state != IEEE80211_S_RUN)
++                                                      continue;
++                                              if (!avp->iv_wdsnode)
++                                                      continue;
++                                              found = 1;
++                                              break;
++                                      }
++                              }
++                              if (found)
++                                      ni = ni_or_null = avp->iv_wdsnode;
++                      } else if ((vap->iv_opmode == IEEE80211_M_WDS) && vap->iv_wdsnode) {
++                              found = 1;
++                              ni = ni_or_null = vap->iv_wdsnode;
++                      }
++                      IEEE80211_UNLOCK_IRQ(vap->iv_ic);
++
++                      if (!found)
++                              break;
++
+                       if (ni_or_null == NULL) {
+-                              /* Create a new entry in the neighbor table. */
+-                              ni = ieee80211_add_neighbor(vap, wh, &scan);
++                              if (avp) {
++                                      IEEE80211_LOCK_IRQ(ic);
++                                      ni = ieee80211_add_neighbor(avp, wh, &scan);
++                                      /* force assoc */
++                                      ni->ni_associd |= 0xc000;
++                                      avp->iv_wdsnode = ieee80211_ref_node(ni);
++                                      IEEE80211_UNLOCK_IRQ(ic);
++                              } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
++                                      /* Create a new entry in the neighbor table. */
++                                      ni = ieee80211_add_neighbor(vap, wh, &scan);
++                              }
+                       } else {
+                               /*
+                                * Copy data from beacon to neighbor table.
+@@ -3490,6 +3581,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                               IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3);
+                               memcpy(ni->ni_tstamp.data, scan.tstamp,
+                                       sizeof(ni->ni_tstamp));
++                              ni->ni_inact = ni->ni_inact_reload;
+                               ni->ni_intval = 
+                                       IEEE80211_BINTVAL_SANITISE(scan.bintval);
+                               ni->ni_capinfo = scan.capinfo;
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -47,6 +47,7 @@
+ #include <linux/netdevice.h>
+ #include <linux/etherdevice.h>
+ #include <linux/random.h>
++#include <linux/rtnetlink.h>
+ #include "if_media.h"
+@@ -236,7 +237,11 @@ void
+ ieee80211_node_vdetach(struct ieee80211vap *vap)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
++      struct ieee80211_node *ni;
++      ni = vap->iv_wdsnode;
++      if (ni)
++              ni->ni_subif = NULL;
+       ieee80211_node_table_reset(&ic->ic_sta, vap);
+       if (vap->iv_bss != NULL) {
+               ieee80211_unref_node(&vap->iv_bss);
+@@ -309,7 +314,7 @@ ieee80211_create_ibss(struct ieee80211va
+       /* Check to see if we already have a node for this mac
+        * NB: we gain a node reference here
+        */
+-      ni = ieee80211_find_node(&ic->ic_sta, vap->iv_myaddr);
++      ni = ieee80211_find_txnode(vap, vap->iv_myaddr);
+       if (ni == NULL) {
+               ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
+               IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
+@@ -831,12 +836,18 @@ node_table_leave_locked(struct ieee80211
+               LIST_REMOVE(ni, ni_hash);
+       }
+       ni->ni_table = NULL;
++      if (ni->ni_vap->iv_wdsnode == ni) {
++#ifdef IEEE80211_DEBUG_REFCNT
++              ieee80211_unref_node_debug(&ni->ni_vap->iv_wdsnode, func, line);
++#else
++              ieee80211_unref_node(&ni->ni_vap->iv_wdsnode);
++#endif
++      }
+ #ifdef IEEE80211_DEBUG_REFCNT
+       ieee80211_unref_node_debug(&ni, func, line);
+ #else
+       ieee80211_unref_node(&ni);
+ #endif
+-      
+ }
+ /* This is overridden by ath_node_alloc in ath/if_ath.c, and so
+@@ -1134,6 +1145,65 @@ ieee80211_alloc_node(struct ieee80211vap
+       return ni;
+ }
++#define WDSIFNAME ".sta%d"
++static void
++ieee80211_wds_do_addif(struct work_struct *work)
++{
++      struct ieee80211_node *ni = container_of(work, struct ieee80211_node, ni_create);
++      struct ieee80211vap *vap = ni->ni_vap;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct ieee80211vap *avp = NULL;
++      char *name;
++
++      rtnl_lock();
++      /* did we get cancelled by the destroy call? */
++      if (!ni->ni_subif)
++              goto done;
++
++      ni->ni_subif = NULL;
++      name = kmalloc(strlen(vap->iv_dev->name) + sizeof(WDSIFNAME) + 1, GFP_KERNEL);
++      if (!name)
++              goto done;
++
++      strcpy(name, vap->iv_dev->name);
++      strcat(name, WDSIFNAME);
++      avp = ieee80211_create_vap(ic, name, ic->ic_dev, IEEE80211_M_WDS, 0, vap);
++      kfree(name);
++      if (!avp)
++              goto done;
++
++      memcpy(avp->wds_mac, ni->ni_bssid, IEEE80211_ADDR_LEN);
++      avp->iv_wdsnode = ieee80211_ref_node(ni);
++      ni->ni_subif = avp;
++      ic->ic_subifs++;
++
++done:
++      if (avp) {
++              IEEE80211_VAPS_LOCK_IRQ(ic);
++              avp->iv_newstate(vap, IEEE80211_S_RUN, -1);
++              IEEE80211_VAPS_UNLOCK_IRQ(ic);
++      }
++      rtnl_unlock();
++      ieee80211_unref_node(&ni);
++}
++#undef WDSIFNAME
++
++void ieee80211_wds_addif(struct ieee80211_node *ni)
++{
++      /* check if the node is split out already,
++       * or if we're in progress of setting up a new interface already */
++      if (ni->ni_subif)
++              return;
++
++      if (!ni->ni_table)
++              return;
++
++      ieee80211_ref_node(ni);
++      ni->ni_subif = ni->ni_vap;
++      IEEE80211_INIT_WORK(&ni->ni_create, ieee80211_wds_do_addif);
++      schedule_work(&ni->ni_create);
++}
++
+ /* Add wds address to the node table */
+ int
+ #ifdef IEEE80211_DEBUG_REFCNT
+@@ -1553,22 +1623,39 @@ ieee80211_find_rxnode(struct ieee80211co
+       ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_PS_POLL)
+       struct ieee80211_node_table *nt;
+       struct ieee80211_node *ni;
++      struct ieee80211vap *vap, *avp;
++      const u_int8_t *addr;
++
++      if (IS_CTL(wh) && !IS_PSPOLL(wh) /*&& !IS_RTS(ah)*/)
++              addr = wh->i_addr1;
++      else
++              addr = wh->i_addr2;
++
++      if (IEEE80211_IS_MULTICAST(addr))
++              return NULL;
+       /* XXX check ic_bss first in station mode */
+       /* XXX 4-address frames? */
+       nt = &ic->ic_sta;
+       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-      if (IS_CTL(wh) && !IS_PSPOLL(wh) /*&& !IS_RTS(ah)*/)
+-#ifdef IEEE80211_DEBUG_REFCNT
+-              ni = ieee80211_find_node_locked_debug(nt, wh->i_addr1, func, line);
+-#else
+-              ni = ieee80211_find_node_locked(nt, wh->i_addr1);
+-#endif
+-      else
++      if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) {
++              TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++                      TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
++                              if (!IEEE80211_ADDR_EQ(addr, avp->wds_mac))
++                                      continue;
++
++                              if (avp->iv_wdsnode)
++                                      return ieee80211_ref_node(avp->iv_wdsnode);
++                              else
++                                      return NULL;
++                      }
++              }
++      }
++
+ #ifdef IEEE80211_DEBUG_REFCNT
+-              ni = ieee80211_find_node_locked_debug(nt, wh->i_addr2, func, line);
++      ni = ieee80211_find_node_locked_debug(nt, addr, func, line);
+ #else
+-              ni = ieee80211_find_node_locked(nt, wh->i_addr2);
++      ni = ieee80211_find_node_locked(nt, addr);
+ #endif
+       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+@@ -1596,9 +1683,19 @@ ieee80211_find_txnode_debug(struct ieee8
+ ieee80211_find_txnode(struct ieee80211vap *vap, const u_int8_t *mac)
+ #endif
+ {
++      struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node_table *nt;
+       struct ieee80211_node *ni = NULL;
++      IEEE80211_LOCK_IRQ(ic);
++      if (vap->iv_opmode == IEEE80211_M_WDS) {
++              if (vap->iv_wdsnode && (vap->iv_state == IEEE80211_S_RUN))
++                      return ieee80211_ref_node(vap->iv_wdsnode);
++              else
++                      return NULL;
++      }
++      IEEE80211_UNLOCK_IRQ(ic);
++
+       /*
+        * The destination address should be in the node table
+        * unless we are operating in station mode or this is a
+@@ -1669,6 +1766,11 @@ ieee80211_free_node(struct ieee80211_nod
+ {
+       struct ieee80211vap *vap = ni->ni_vap;
++      IEEE80211_LOCK_IRQ(ni->ni_ic);
++      if (vap && ni == vap->iv_wdsnode)
++              vap->iv_wdsnode = NULL;
++      IEEE80211_UNLOCK_IRQ(ni->ni_ic);
++
+       atomic_dec(&ni->ni_ic->ic_node_counter);
+       node_print_message(IEEE80211_MSG_NODE|IEEE80211_MSG_NODE_REF,
+                          1 /* show counter */, 
+@@ -1781,22 +1883,6 @@ restart:
+                   jiffies > ni->ni_rxfragstamp + HZ) {
+                       ieee80211_dev_kfree_skb(&ni->ni_rxfrag);
+               }
+-              /*
+-               * Special case ourself; we may be idle for extended periods
+-               * of time and regardless reclaiming our state is wrong.
+-               * Special case a WDS link: it may be dead or idle, but it is 
+-               * never ok to reclaim it, as this will block transmissions
+-               * and nobody will recreate the node when the WDS peer is
+-               * available again. */
+-              if ((ni == ni->ni_vap->iv_bss) ||
+-                  (ni->ni_vap->iv_opmode == IEEE80211_M_WDS && 
+-                   !memcmp(ni->ni_macaddr, ni->ni_vap->wds_mac, ETH_ALEN)))
+-              {
+-                      /* NB: don't permit it to go negative */
+-                      if (ni->ni_inact > 0)
+-                              ni->ni_inact--;
+-                      continue;
+-              }
+               ni->ni_inact--;
+               if (ni->ni_associd != 0 || isadhoc) {
+                       struct ieee80211vap *vap = ni->ni_vap;
+@@ -2263,6 +2349,35 @@ ieee80211_node_leave_11g(struct ieee8021
+       }
+ }
++static void
++ieee80211_subif_destroy(struct work_struct *work)
++{
++      struct ieee80211_node *ni = container_of(work, struct ieee80211_node, ni_destroy);
++      struct ieee80211vap *vap;
++      struct ieee80211com *ic;
++
++      /* wait for full initialization before we start the teardown
++       * otherwise we could leak interfaces */
++      while (ni->ni_subif == ni->ni_vap)
++              schedule();
++
++      rtnl_lock();
++      vap = ni->ni_subif;
++
++      if (!vap)
++              goto done;
++
++      ic = vap->iv_ic;
++      ni->ni_subif = NULL;
++      ieee80211_stop(vap->iv_dev);
++      ic->ic_vap_delete(vap);
++      ic->ic_subifs--;
++
++done:
++      ieee80211_unref_node(&ni);
++      rtnl_unlock();
++}
++
+ /*
+  * Handle bookkeeping for a station/neighbor leaving
+  * the bss when operating in ap or adhoc modes.
+@@ -2279,6 +2394,12 @@ ieee80211_node_leave(struct ieee80211_no
+                       ni, "station with aid %d leaves (refcnt %u)",
+                       IEEE80211_NODE_AID(ni), atomic_read(&ni->ni_refcnt));
++      if (ni->ni_subif) {
++              ieee80211_ref_node(ni);
++              IEEE80211_INIT_WORK(&ni->ni_destroy, ieee80211_subif_destroy);
++              schedule_work(&ni->ni_destroy);
++      }
++
+       /* From this point onwards we can no longer find the node,
+        * so no more references are generated
+        */
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -246,15 +246,16 @@ ieee80211_hardstart(struct sk_buff *skb,
+        * things like power save.
+        */
+       eh = (struct ether_header *)skb->data;
+-      if (vap->iv_opmode == IEEE80211_M_WDS)
+-              ni = ieee80211_find_txnode(vap, vap->wds_mac);
+-      else
+-              ni = ieee80211_find_txnode(vap, eh->ether_dhost);
++      ni = ieee80211_find_txnode(vap, eh->ether_dhost);
+       if (ni == NULL) {
+               /* NB: ieee80211_find_txnode does stat+msg */
+               goto bad;
+       }
++      if (ni->ni_subif && (vap != ni->ni_subif) &&
++              ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE)))
++              goto bad;
++
+       /* calculate priority so drivers can find the TX queue */
+       if (ieee80211_classify(ni, skb)) {
+               IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni,
+@@ -334,20 +335,33 @@ void ieee80211_parent_queue_xmit(struct 
+  * constructing a frame as it sets i_fc[1]; other bits can
+  * then be or'd in.
+  */
+-static void
++static struct ieee80211_frame *
+ ieee80211_send_setup(struct ieee80211vap *vap,
+       struct ieee80211_node *ni,
+-      struct ieee80211_frame *wh,
++      struct sk_buff *skb,
+       int type,
+       const u_int8_t sa[IEEE80211_ADDR_LEN],
+       const u_int8_t da[IEEE80211_ADDR_LEN],
+       const u_int8_t bssid[IEEE80211_ADDR_LEN])
+ {
+ #define       WH4(wh) ((struct ieee80211_frame_addr4 *)wh)
++      struct ieee80211_frame *wh;
++      int len = sizeof(struct ieee80211_frame);
++      int opmode = vap->iv_opmode;
++      if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) {
++              if ((opmode == IEEE80211_M_STA) &&
++                      (vap->iv_flags_ext & IEEE80211_FEXT_WDS))
++                      opmode = IEEE80211_M_WDS;
++
++              if (opmode == IEEE80211_M_WDS)
++                      len = sizeof(struct ieee80211_frame_addr4);
++      }
++
++      wh = (struct ieee80211_frame *)skb_push(skb, len);
+       wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | type;
+       if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) {
+-              switch (vap->iv_opmode) {
++              switch (opmode) {
+               case IEEE80211_M_STA:
+                       wh->i_fc[1] = IEEE80211_FC1_DIR_TODS;
+                       IEEE80211_ADDR_COPY(wh->i_addr1, bssid);
+@@ -389,6 +403,8 @@ ieee80211_send_setup(struct ieee80211vap
+       *(__le16 *)&wh->i_seq[0] =
+           htole16(ni->ni_txseqs[0] << IEEE80211_SEQ_SEQ_SHIFT);
+       ni->ni_txseqs[0]++;
++
++      return wh;
+ #undef WH4
+ }
+@@ -410,9 +426,7 @@ ieee80211_mgmt_output(struct ieee80211_n
+       SKB_CB(skb)->ni = ni;
+-      wh = (struct ieee80211_frame *)
+-              skb_push(skb, sizeof(struct ieee80211_frame));
+-      ieee80211_send_setup(vap, ni, wh,
++      wh = ieee80211_send_setup(vap, ni, skb,
+               IEEE80211_FC0_TYPE_MGT | type,
+               vap->iv_myaddr, ni->ni_macaddr, vap->iv_bssid);
+       /* XXX power management */
+@@ -458,6 +472,9 @@ ieee80211_send_nulldata(struct ieee80211
+       struct ieee80211_frame *wh;
+       u_int8_t *frm;
++      if (ni->ni_subif)
++              vap = ni->ni_subif;
++
+       skb = ieee80211_getmgtframe(&frm, 0);
+       if (skb == NULL) {
+               /* XXX debug msg */
+@@ -466,9 +483,7 @@ ieee80211_send_nulldata(struct ieee80211
+               return -ENOMEM;
+       }
+-      wh = (struct ieee80211_frame *)
+-              skb_push(skb, sizeof(struct ieee80211_frame));
+-      ieee80211_send_setup(vap, ni, wh,
++      wh = ieee80211_send_setup(vap, ni, skb,
+               IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_NODATA,
+               vap->iv_myaddr, ni->ni_macaddr, vap->iv_bssid);
+       /* NB: power management bit is never sent by an AP */
+@@ -506,6 +521,7 @@ ieee80211_send_qosnulldata(struct ieee80
+       struct sk_buff *skb;
+       struct ieee80211_qosframe *qwh;
+       u_int8_t *frm;
++      u_int8_t *i_qos;
+       int tid;
+       skb = ieee80211_getmgtframe(&frm, 2);
+@@ -517,11 +533,12 @@ ieee80211_send_qosnulldata(struct ieee80
+       SKB_CB(skb)->ni = ieee80211_ref_node(ni);
+       skb->priority = ac;
+-      qwh = (struct ieee80211_qosframe *)skb_push(skb, sizeof(struct ieee80211_qosframe));
+-      qwh = (struct ieee80211_qosframe *)skb->data;
++      /* grab a pointer to QoS control and also compensate for the header length
++       * difference between QoS and non-QoS frame */
++      i_qos = skb_push(skb, sizeof(struct ieee80211_qosframe) - sizeof(struct ieee80211_frame));
+-      ieee80211_send_setup(vap, ni, (struct ieee80211_frame *)qwh,
++      qwh = (struct ieee80211_qosframe *) ieee80211_send_setup(vap, ni, skb,
+               IEEE80211_FC0_TYPE_DATA,
+               vap->iv_myaddr, /* SA */
+               ni->ni_macaddr, /* DA */
+@@ -535,10 +552,10 @@ ieee80211_send_qosnulldata(struct ieee80
+       /* map from access class/queue to 11e header priority value */
+       tid = WME_AC_TO_TID(ac);
+-      qwh->i_qos[0] = tid & IEEE80211_QOS_TID;
++      i_qos[0] = tid & IEEE80211_QOS_TID;
+       if (ic->ic_wme.wme_wmeChanParams.cap_wmeParams[ac].wmep_noackPolicy)
+               qwh->i_qos[0] |= (1 << IEEE80211_QOS_ACKPOLICY_S) & IEEE80211_QOS_ACKPOLICY;
+-      qwh->i_qos[1] = 0;
++      i_qos[1] = 0;
+       IEEE80211_NODE_STAT(ni, tx_data);
+@@ -780,6 +797,8 @@ ieee80211_encap(struct ieee80211_node *n
+               hdrsize = sizeof(struct ieee80211_frame);
+       SKB_CB(skb)->auth_pkt = (eh.ether_type == __constant_htons(ETHERTYPE_PAE));
++      if (ni->ni_subif)
++              vap = ni->ni_subif;
+       switch (vap->iv_opmode) {
+       case IEEE80211_M_IBSS:
+@@ -788,7 +807,7 @@ ieee80211_encap(struct ieee80211_node *n
+               break;
+       case IEEE80211_M_WDS:
+               use4addr = 1;
+-              ismulticast = IEEE80211_IS_MULTICAST(ni->ni_macaddr);
++              ismulticast = 0;
+               break;
+       case IEEE80211_M_HOSTAP:
+               if (!IEEE80211_IS_MULTICAST(eh.ether_dhost) &&
+@@ -799,20 +818,9 @@ ieee80211_encap(struct ieee80211_node *n
+                       ismulticast = IEEE80211_IS_MULTICAST(eh.ether_dhost);
+               break;
+       case IEEE80211_M_STA:
+-              if ((vap->iv_flags_ext & IEEE80211_FEXT_WDS) &&
+-                  !IEEE80211_ADDR_EQ(eh.ether_shost, vap->iv_myaddr)) {
++              if (vap->iv_flags_ext & IEEE80211_FEXT_WDS) {
+                       use4addr = 1;
+-                      ismulticast = IEEE80211_IS_MULTICAST(ni->ni_macaddr);
+-                      /* Add a WDS entry to the station VAP */
+-                      if (IEEE80211_IS_MULTICAST(eh.ether_dhost)) {
+-                              struct ieee80211_node_table *nt = &ic->ic_sta;
+-                              struct ieee80211_node *ni_wds 
+-                                      = ieee80211_find_wds_node(nt, eh.ether_shost);
+-                              if (ni_wds)
+-                                      ieee80211_unref_node(&ni_wds);
+-                              else
+-                                      ieee80211_add_wds_addr(nt, ni, eh.ether_shost, 0);
+-                      }
++                      ismulticast = 0;
+               } else
+                       ismulticast = IEEE80211_IS_MULTICAST(vap->iv_bssid);
+               break;
+@@ -973,7 +981,7 @@ ieee80211_encap(struct ieee80211_node *n
+                       break;
+               case IEEE80211_M_WDS:
+                       wh->i_fc[1] = IEEE80211_FC1_DIR_DSTODS;
+-                      IEEE80211_ADDR_COPY(wh->i_addr1, ni->ni_macaddr);
++                      IEEE80211_ADDR_COPY(wh->i_addr1, vap->wds_mac);
+                       IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr);
+                       IEEE80211_ADDR_COPY(wh->i_addr3, eh.ether_dhost);
+                       IEEE80211_ADDR_COPY(WH4(wh)->i_addr4, eh.ether_shost);
+@@ -1683,9 +1691,7 @@ ieee80211_send_probereq(struct ieee80211
+       SKB_CB(skb)->ni = ieee80211_ref_node(ni);
+-      wh = (struct ieee80211_frame *)
+-              skb_push(skb, sizeof(struct ieee80211_frame));
+-      ieee80211_send_setup(vap, ni, wh,
++      wh = ieee80211_send_setup(vap, ni, skb,
+               IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ,
+               sa, da, bssid);
+       /* XXX power management? */
+--- a/tools/athkey.c
++++ b/tools/athkey.c
+@@ -118,7 +118,7 @@ set80211priv(const char *dev, int op, vo
+                               IOCTL_ERR(IEEE80211_IOCTL_ADDMAC),
+                               IOCTL_ERR(IEEE80211_IOCTL_DELMAC),
+                               IOCTL_ERR(IEEE80211_IOCTL_WDSADDMAC),
+-                              IOCTL_ERR(IEEE80211_IOCTL_WDSDELMAC),
++                              IOCTL_ERR(IEEE80211_IOCTL_WDSSETMAC),
+                               IOCTL_ERR(IEEE80211_IOCTL_READREG),
+                               IOCTL_ERR(IEEE80211_IOCTL_WRITEREG),
+                       };
+--- a/tools/athchans.c
++++ b/tools/athchans.c
+@@ -118,7 +118,7 @@ set80211priv(const char *dev, int op, vo
+                               IOCTL_ERR(IEEE80211_IOCTL_ADDMAC),
+                               IOCTL_ERR(IEEE80211_IOCTL_DELMAC),
+                               IOCTL_ERR(IEEE80211_IOCTL_WDSADDMAC),
+-                              IOCTL_ERR(IEEE80211_IOCTL_WDSDELMAC),
++                              IOCTL_ERR(IEEE80211_IOCTL_WDSSETMAC),
+                               IOCTL_ERR(IEEE80211_IOCTL_READREG),
+                               IOCTL_ERR(IEEE80211_IOCTL_WRITEREG),
+                       };
+--- a/tools/wlanconfig.c
++++ b/tools/wlanconfig.c
+@@ -968,7 +968,7 @@ do80211priv(struct iwreq *iwr, const cha
+                       IOCTL_ERR(IEEE80211_IOCTL_ADDMAC),
+                       IOCTL_ERR(IEEE80211_IOCTL_DELMAC),
+                       IOCTL_ERR(IEEE80211_IOCTL_WDSADDMAC),
+-                      IOCTL_ERR(IEEE80211_IOCTL_WDSDELMAC),
++                      IOCTL_ERR(IEEE80211_IOCTL_WDSSETMAC),
+                       IOCTL_ERR(IEEE80211_IOCTL_READREG),
+                       IOCTL_ERR(IEEE80211_IOCTL_WRITEREG),
+               };
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -979,6 +979,12 @@ ieee80211_init(struct net_device *dev, i
+               "start running (state=%d)\n", vap->iv_state);
++      if (vap->iv_master && vap->iv_master->iv_state == IEEE80211_S_INIT) {
++              int ret = ieee80211_init(vap->iv_master->iv_dev, forcescan);
++              if (ret < 0)
++                      return ret;
++      }
++
+       if ((dev->flags & IFF_RUNNING) == 0) {
+               if (ic->ic_nopened++ == 0 &&
+                   (parent->flags & IFF_RUNNING) == 0)
+@@ -1081,6 +1087,8 @@ ieee80211_init(struct net_device *dev, i
+ int
+ ieee80211_open(struct net_device *dev)
+ {
++      struct ieee80211vap *vap = dev->priv;
++
+       return ieee80211_init(dev, 0);
+ }
+@@ -1090,7 +1098,7 @@ ieee80211_open(struct net_device *dev)
+ void
+ ieee80211_start_running(struct ieee80211com *ic)
+ {
+-      struct ieee80211vap *vap;
++      struct ieee80211vap *vap, *avp;
+       struct net_device *dev;
+       /* XXX locking */
+@@ -1099,6 +1107,16 @@ ieee80211_start_running(struct ieee80211
+               /* NB: avoid recursion */
+               if ((dev->flags & IFF_UP) && !(dev->flags & IFF_RUNNING))
+                       ieee80211_open(dev);
++
++              TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
++                      if (avp->iv_wdsnode && avp->iv_wdsnode->ni_subif == avp)
++                              continue;
++
++                      dev = avp->iv_dev;
++                      /* NB: avoid recursion */
++                      if ((dev->flags & IFF_UP) && !(dev->flags & IFF_RUNNING))
++                              ieee80211_open(dev);
++              }
+       }
+ }
+ EXPORT_SYMBOL(ieee80211_start_running);
+@@ -1116,11 +1134,43 @@ ieee80211_stop(struct net_device *dev)
+       struct ieee80211vap *vap = dev->priv;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *parent = ic->ic_dev;
++      struct ieee80211_node *tni, *ni;
++      struct ieee80211vap *avp;
+       IEEE80211_DPRINTF(vap,
+               IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
+               "%s\n", "stop running");
++      if (vap->iv_wdsnode && !vap->iv_wdsnode->ni_subif)
++              ieee80211_unref_node(&vap->iv_wdsnode);
++
++      /* stop wds interfaces */
++      TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_next) {
++              if (avp->iv_state != IEEE80211_S_INIT)
++                      ieee80211_stop(avp->iv_dev);
++      }
++
++      /* get rid of all wds nodes while we're still locked */
++      do {
++              ni = NULL;
++
++              IEEE80211_NODE_TABLE_LOCK_IRQ(&ic->ic_sta);
++              TAILQ_FOREACH(tni, &ic->ic_sta.nt_node, ni_list) {
++                      if (tni->ni_vap != vap)
++                              continue;
++                      if (!tni->ni_subif)
++                              continue;
++                      ni = tni;
++                      break;
++              }
++              IEEE80211_NODE_TABLE_UNLOCK_IRQ(&ic->ic_sta);
++
++              if (!ni)
++                      break;
++
++              ieee80211_node_leave(ni);
++      } while (1);
++
+       ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
+       if (dev->flags & IFF_RUNNING) {
+               dev->flags &= ~IFF_RUNNING;             /* mark us stopped */
+@@ -1148,7 +1198,7 @@ EXPORT_SYMBOL(ieee80211_stop);
+ void
+ ieee80211_stop_running(struct ieee80211com *ic)
+ {
+-      struct ieee80211vap *vap;
++      struct ieee80211vap *vap, *avp;
+       struct net_device *dev;
+       /* XXX locking */
+@@ -1156,6 +1206,12 @@ ieee80211_stop_running(struct ieee80211c
+               dev = vap->iv_dev;
+               if (dev->flags & IFF_RUNNING)   /* NB: avoid recursion */
+                       ieee80211_stop(dev);
++
++              TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
++                      dev = avp->iv_dev;
++                      if (dev->flags & IFF_RUNNING)   /* NB: avoid recursion */
++                              ieee80211_stop(dev);
++              }
+       }
+ }
+ EXPORT_SYMBOL(ieee80211_stop_running);
+@@ -1342,9 +1398,9 @@ ieee80211_new_state(struct ieee80211vap 
+       struct ieee80211com *ic = vap->iv_ic;
+       int rc;
+-      IEEE80211_VAPS_LOCK_BH(ic);
++      IEEE80211_VAPS_LOCK_IRQ(ic);
+       rc = vap->iv_newstate(vap, nstate, arg);
+-      IEEE80211_VAPS_UNLOCK_BH(ic);
++      IEEE80211_VAPS_UNLOCK_IRQ(ic);
+       return rc;
+ }
+@@ -1557,57 +1613,12 @@ __ieee80211_newstate(struct ieee80211vap
+               switch (ostate) {
+               case IEEE80211_S_INIT:
+                       if (vap->iv_opmode == IEEE80211_M_MONITOR ||
+-                          vap->iv_opmode == IEEE80211_M_WDS ||
+                           vap->iv_opmode == IEEE80211_M_HOSTAP) {
+                               /*
+                                * Already have a channel; bypass the
+                                * scan and startup immediately.
+                                */
+                               ieee80211_create_ibss(vap, ic->ic_curchan);
+-
+-                              /* In WDS mode, allocate and initialize peer node. */
+-                              if (vap->iv_opmode == IEEE80211_M_WDS) {
+-                                      /* XXX: This is horribly non-atomic. */
+-                                      struct ieee80211_node *wds_ni =
+-                                              ieee80211_find_node(&ic->ic_sta,
+-                                                              vap->wds_mac);
+-
+-                                      if (wds_ni == NULL) {
+-                                              wds_ni = ieee80211_alloc_node_table(
+-                                                              vap,
+-                                                              vap->wds_mac);
+-                                              if (wds_ni != NULL) {
+-                                                      ieee80211_add_wds_addr(
+-                                                                      &ic->ic_sta,
+-                                                                      wds_ni,
+-                                                                      vap->wds_mac,
+-                                                                      1);
+-                                                      ieee80211_ref_node(wds_ni); /* pin in memory */
+-                                              }
+-                                              else
+-                                                      IEEE80211_DPRINTF(
+-                                                                      vap,
+-                                                                      IEEE80211_MSG_NODE,
+-                                                                      "%s: Unable to "
+-                                                                      "allocate node for "
+-                                                                      "WDS: " MAC_FMT "\n",
+-                                                                      __func__,
+-                                                                      MAC_ADDR(
+-                                                                              vap->wds_mac)
+-                                                                      );
+-                                      }
+-
+-                                      if (wds_ni != NULL) {
+-                                              ieee80211_node_authorize(wds_ni);
+-                                              wds_ni->ni_chan =
+-                                                      vap->iv_bss->ni_chan;
+-                                              wds_ni->ni_capinfo =
+-                                                      ni->ni_capinfo;
+-                                              wds_ni->ni_associd = 1;
+-                                              wds_ni->ni_ath_flags =
+-                                                      vap->iv_ath_cap;
+-                                      }
+-                              }
+                               break;
+                       }
+                       /* fall thru... */
+@@ -1675,6 +1686,7 @@ __ieee80211_newstate(struct ieee80211vap
+                */
+               if (ni->ni_authmode != IEEE80211_AUTH_8021X)
+                       ieee80211_node_authorize(ni);
++
+ #ifdef ATH_SUPERG_XR
+               /*
+                * fire a timer to bring up XR vap if configured.
+@@ -1808,6 +1820,11 @@ ieee80211_newstate(struct ieee80211vap *
+                         ieee80211_state_name[dstate]);
+       ieee80211_update_link_status(vap, nstate, ostate);
++
++      if ((nstate != IEEE80211_S_RUN) && vap->iv_wdsnode &&
++                      !vap->iv_wdsnode->ni_subif)
++              ieee80211_unref_node(&vap->iv_wdsnode);
++
+       switch (nstate) {
+       case IEEE80211_S_AUTH:
+       case IEEE80211_S_ASSOC:
+@@ -1930,8 +1947,15 @@ ieee80211_newstate(struct ieee80211vap *
+               if (ostate == IEEE80211_S_SCAN || 
+                   ostate == IEEE80211_S_AUTH ||
+                   ostate == IEEE80211_S_ASSOC) {
++
+                       /* Transition (S_SCAN|S_AUTH|S_ASSOC) -> S_RUN */
+                       __ieee80211_newstate(vap, nstate, arg);
++
++                      /* if we're in wds, let the ap know that we're doing this */
++                      if ((vap->iv_opmode == IEEE80211_M_STA) &&
++                              (vap->iv_flags_ext & IEEE80211_FEXT_WDS))
++                                      ieee80211_send_nulldata(ieee80211_ref_node(vap->iv_bss));
++
+                       /* Then bring up all other vaps pending on the scan */
+                       dstate = get_dominant_state(ic);
+                       if (dstate == IEEE80211_S_RUN) {
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -79,28 +79,6 @@ typedef void *TQUEUE_ARG;
+ #define       tasklet_enable(t)       do { (void) t; local_bh_enable(); } while (0)
+ #endif /* !DECLARE_TASKLET */
+-#include <linux/sched.h>
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
+-#include <linux/tqueue.h>
+-#define work_struct                   tq_struct
+-#define schedule_work(t)              schedule_task((t))
+-#define flush_scheduled_work()                flush_scheduled_tasks()
+-#define ATH_INIT_WORK(t, f) do {                      \
+-      memset((t), 0, sizeof(struct tq_struct)); \
+-      (t)->routine = (void (*)(void*)) (f);   \
+-      (t)->data=(void *) (t);                 \
+-} while (0)
+-#else
+-#include <linux/workqueue.h>
+-
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+-#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (void (*)(void *))(_f), (_t));
+-#else
+-#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (_f));
+-#endif
+-
+-#endif /* KERNEL_VERSION < 2.5.41 */
+-
+ /*
+  * Guess how the interrupt handler should work.
+  */
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -145,7 +145,7 @@ ieee80211_getmgtframe(u_int8_t **frm, u_
+       struct sk_buff *skb;
+       u_int len;
+-      len = roundup(sizeof(struct ieee80211_frame) + pktlen, 4);
++      len = roundup(sizeof(struct ieee80211_frame_addr4) + pktlen, 4);
+ #ifdef IEEE80211_DEBUG_REFCNT
+       skb = ieee80211_dev_alloc_skb_debug(len + align - 1, func, line);
+ #else
+@@ -161,7 +161,7 @@ ieee80211_getmgtframe(u_int8_t **frm, u_
+               SKB_CB(skb)->flags = 0;
+               SKB_CB(skb)->next = NULL;
+-              skb_reserve(skb, sizeof(struct ieee80211_frame));
++              skb_reserve(skb, sizeof(struct ieee80211_frame_addr4));
+               *frm = skb_put(skb, pktlen);
+       }
+       return skb;
+--- a/net80211/ieee80211_node.h
++++ b/net80211/ieee80211_node.h
+@@ -92,11 +92,13 @@ struct ath_softc;
+  * the ieee80211com structure.
+  */
+ struct ieee80211_node {
+-      struct ieee80211vap *ni_vap;
++      struct ieee80211vap *ni_vap, *ni_subif;
+       struct ieee80211com *ni_ic;
+       struct ieee80211_node_table *ni_table;
+       TAILQ_ENTRY(ieee80211_node) ni_list;
+       LIST_ENTRY(ieee80211_node) ni_hash;
++      struct work_struct ni_create;   /* task for creating a subif */
++      struct work_struct ni_destroy;  /* task for destroying a subif */
+       atomic_t ni_refcnt;
+       u_int ni_scangen;                       /* gen# for timeout scan */
+       u_int8_t ni_authmode;                   /* authentication algorithm */
+@@ -430,5 +432,6 @@ void ieee80211_node_join(struct ieee8021
+ void ieee80211_node_leave(struct ieee80211_node *);
+ u_int8_t ieee80211_getrssi(struct ieee80211com *);
+ int32_t ieee80211_get_node_count(struct ieee80211com *);
++void ieee80211_wds_addif(struct ieee80211_node *ni);
+ #endif /* _NET80211_IEEE80211_NODE_H_ */
diff --git a/net/madwifi/patches/372-queue_vif.patch b/net/madwifi/patches/372-queue_vif.patch
new file mode 100644 (file)
index 0000000..aa32b1b
--- /dev/null
@@ -0,0 +1,39 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1198,6 +1198,7 @@ ieee80211_deliver_data(struct ieee80211_
+               }
+               if (skb1 != NULL) {
+                       struct ieee80211_node *ni_tmp;
++                      int ret;
+                       skb1->dev = dev;
+                       skb_reset_mac_header(skb1);
+                       skb_set_network_header(skb1, sizeof(struct ether_header));
+@@ -1205,7 +1206,12 @@ ieee80211_deliver_data(struct ieee80211_
+                       skb1->protocol = __constant_htons(ETH_P_802_2);
+                       /* XXX insert vlan tag before queue it? */
+                       ni_tmp = SKB_CB(skb1)->ni; /* remember node so we can free it */
+-                      if (dev_queue_xmit(skb1) == NET_XMIT_DROP) {
++                      ret = dev->hard_start_xmit(skb1, dev);
++
++                      if (ret == NETDEV_TX_BUSY)
++                              ieee80211_dev_kfree_skb(&skb1);
++
++                      else if (ret != NETDEV_TX_OK) {
+                               /* If queue dropped the packet because device was
+                                * too busy */
+                               vap->iv_devstats.tx_dropped++;
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -324,9 +324,10 @@ void ieee80211_parent_queue_xmit(struct 
+       /* Dispatch the packet to the parent device */
+       skb->dev = vap->iv_ic->ic_dev;
+-      if (dev_queue_xmit(skb) == NET_XMIT_DROP)
++      if (netif_queue_stopped(skb->dev))
++              ieee80211_dev_kfree_skb(&skb);
++      else if (dev_queue_xmit(skb) == NET_XMIT_DROP)
+               vap->iv_devstats.tx_dropped++;
+-
+ }
+ /*
diff --git a/net/madwifi/patches/373-sanity_check.patch b/net/madwifi/patches/373-sanity_check.patch
new file mode 100644 (file)
index 0000000..06c6acf
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -250,6 +250,9 @@ ieee80211_input(struct ieee80211vap * va
+       if (vap->iv_opmode == IEEE80211_M_MONITOR)
+               goto out;
++      if (!skb->data)
++              goto out;
++
+       if (skb->len < sizeof(struct ieee80211_frame_min)) {
+               IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
+                       ni->ni_macaddr, NULL,
diff --git a/net/madwifi/patches/374-nbtt_fix.patch b/net/madwifi/patches/374-nbtt_fix.patch
new file mode 100644 (file)
index 0000000..0a29827
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -5486,6 +5486,9 @@ ath_beacon_config(struct ath_softc *sc, 
+               ath_beacon_dturbo_config(vap, intval &
+                               ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
+ #endif
++              if ((nexttbtt & HAL_BEACON_PERIOD) - (ath_hal_gettsf32(ah) >> 10)
++                              <= ath_hal_sw_beacon_response_time)
++                      nexttbtt += intval;
+               sc->sc_nexttbtt = nexttbtt;
+               ath_hal_beaconinit(ah, nexttbtt, intval);
+               if (intval & HAL_BEACON_RESET_TSF) {
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
+@@ -71,6 +71,7 @@ static       int ath_hal_debug = 99;
+ int   ath_hal_dma_beacon_response_time = 2;   /* in TUs */
+ int   ath_hal_sw_beacon_response_time = 10;   /* in TUs */
+ int   ath_hal_additional_swba_backoff = 0;    /* in TUs */
++EXPORT_SYMBOL(ath_hal_sw_beacon_response_time);
+ struct ath_hal *
+ _ath_hal_attach(u_int16_t devid, HAL_SOFTC sc,
diff --git a/net/madwifi/patches/375-atim_tsf_update.patch b/net/madwifi/patches/375-atim_tsf_update.patch
new file mode 100644 (file)
index 0000000..9381f8a
--- /dev/null
@@ -0,0 +1,141 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -161,6 +161,7 @@ static void ath_beacon_send(struct ath_s
+ static void ath_beacon_return(struct ath_softc *, struct ath_buf *);
+ static void ath_beacon_free(struct ath_softc *);
+ static void ath_beacon_config(struct ath_softc *, struct ieee80211vap *);
++static void ath_hw_beacon_stop(struct ath_softc *sc);
+ static int ath_desc_alloc(struct ath_softc *);
+ static void ath_desc_free(struct ath_softc *);
+ static void ath_desc_swap(struct ath_desc *);
+@@ -2793,6 +2794,72 @@ ath_set_ack_bitrate(struct ath_softc *sc
+       return 1;
+ }
++static void
++ath_hw_beacon_stop(struct ath_softc *sc)
++{
++      HAL_BEACON_TIMERS btimers;
++
++      btimers.bt_intval = 0;
++      btimers.bt_nexttbtt = 0;
++      btimers.bt_nextdba = 0xffffffff;
++      btimers.bt_nextswba = 0xffffffff;
++      btimers.bt_nextatim = 0;
++
++      ath_hal_setbeacontimers(sc->sc_ah, &btimers);
++}
++
++/* Fix up the ATIM window after TSF resync */
++static int
++ath_hw_check_atim(struct ath_softc *sc, int window, int intval)
++{
++#define AR5K_TIMER0_5210       0x802c  /* Next beacon time register */
++#define AR5K_TIMER0_5211       0x8028
++#define AR5K_TIMER3_5210       0x8038  /* End of ATIM window time register */
++#define AR5K_TIMER3_5211       0x8034
++      struct ath_hal *ah = sc->sc_ah;
++      int dev = sc->sc_ah->ah_macType;
++      unsigned int nbtt, atim;
++      int is_5210 = 0;
++
++      /*
++       * check if the ATIM window is still correct:
++       *   1.) usually ATIM should be NBTT + window
++       *   2.) nbtt already updated
++       *   3.) nbtt already updated and has wrapped around
++       *   4.) atim has wrapped around
++       */
++      switch(dev) {
++      case 5210:
++              nbtt = OS_REG_READ(ah, AR5K_TIMER0_5210);
++              atim = OS_REG_READ(ah, AR5K_TIMER3_5210);
++              is_5210 = 1;
++              break;
++      case 5211:
++      case 5212:
++              nbtt = OS_REG_READ(ah, AR5K_TIMER0_5211);
++              atim = OS_REG_READ(ah, AR5K_TIMER3_5211);
++              break;
++      /* NB: 5416+ doesn't do ATIM in hw */
++      case 5416:
++      default:
++              return 0;
++      }
++
++      if ((atim - nbtt != window) &&                          /* 1.) */
++          (nbtt - atim != intval - window) &&                 /* 2.) */
++          ((nbtt | 0x10000) - atim != intval - window) &&     /* 3.) */
++          ((atim | 0x10000) - nbtt != window)) {              /* 4.) */
++              if (is_5210)
++                      OS_REG_WRITE(ah, AR5K_TIMER3_5210, nbtt + window );
++              else
++                      OS_REG_WRITE(ah, AR5K_TIMER3_5211, nbtt + window );
++              return atim - nbtt;
++      }
++
++      return 0;
++}
++
++
+ /*
+  * Reset the hardware w/o losing operational state.  This is
+  * basically a more efficient way of doing ath_stop, ath_init,
+@@ -5294,6 +5361,7 @@ ath_beacon_config(struct ath_softc *sc, 
+       u_int64_t tsf, hw_tsf;
+       u_int32_t tsftu, hw_tsftu;
+       u_int32_t intval, nexttbtt = 0;
++      unsigned long flags;
+       int reset_tsf = 0;
+       if (vap == NULL)
+@@ -5301,6 +5369,9 @@ ath_beacon_config(struct ath_softc *sc, 
+       ni = vap->iv_bss;
++      /* TSF calculation is timing critical - we don't want to be interrupted here */
++      local_irq_save(flags);
++
+       hw_tsf = ath_hal_gettsf64(ah);
+       tsf = le64_to_cpu(ni->ni_tstamp.tsf);
+       hw_tsftu = hw_tsf >> 10;
+@@ -5490,15 +5561,27 @@ ath_beacon_config(struct ath_softc *sc, 
+                               <= ath_hal_sw_beacon_response_time)
+                       nexttbtt += intval;
+               sc->sc_nexttbtt = nexttbtt;
++
++              /* stop beacons before reconfiguring the timers to avoid race
++               * conditions. ath_hal_beaconinit will start them again */
++              ath_hw_beacon_stop(sc);
++
+               ath_hal_beaconinit(ah, nexttbtt, intval);
+               if (intval & HAL_BEACON_RESET_TSF) {
+                       sc->sc_last_tsf = 0;
+               }
+               sc->sc_bmisscount = 0;
+               ath_hal_intrset(ah, sc->sc_imask);
++
++              if ((sc->sc_opmode == HAL_M_IBSS) && ath_hw_check_atim(sc, 1, intval & HAL_BEACON_PERIOD)) {
++                      DPRINTF(sc, ATH_DEBUG_BEACON,
++                              "fixed atim window after beacon init\n");
++              }
+       }
+ ath_beacon_config_debug:
++      local_irq_restore(flags);
++
+       /* We print all debug messages here, in order to preserve the
+        * time critical aspect of this function */
+       DPRINTF(sc, ATH_DEBUG_BEACON,
+@@ -6401,6 +6484,11 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+                       DPRINTF(sc, ATH_DEBUG_BEACON, 
+                               "Updated beacon timers\n");
+               }
++              if ((sc->sc_opmode == HAL_M_IBSS) &&
++                              IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid) &&
++                              ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval)) {
++                      DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
++              }
+               /* NB: Fall Through */
+       case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
+               if (vap->iv_opmode == IEEE80211_M_IBSS &&
diff --git a/net/madwifi/patches/377-disable_vlan_code.patch b/net/madwifi/patches/377-disable_vlan_code.patch
new file mode 100644 (file)
index 0000000..8a13248
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -657,22 +657,7 @@ int ieee80211_proc_vcreate(struct ieee80
+              char *);
+ void ieee80211_proc_cleanup(struct ieee80211vap *);
+-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+-#define IEEE80211_VLAN_TAG_USED 1
+-
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
+-#define       vlan_hwaccel_receive_skb(skb, grp, tag) vlan_hwaccel_rx(skb, grp, tag)
+-#endif
+-
+-#ifndef VLAN_GROUP_ARRAY_PART_LEN
+-#define vlan_group_set_device(group, vid, dev) do { \
+-      group->vlan_devices[vid] = dev; \
+-} while (0);
+-#endif
+-
+-#else
+ #define IEEE80211_VLAN_TAG_USED 0
+-#endif
+ void ieee80211_vlan_vattach(struct ieee80211vap *);
+ void ieee80211_vlan_vdetach(struct ieee80211vap *);
diff --git a/net/madwifi/patches/378-adhoc_crash_fix.patch b/net/madwifi/patches/378-adhoc_crash_fix.patch
new file mode 100644 (file)
index 0000000..1d699a5
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3529,6 +3529,11 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+               if (ic->ic_flags & IEEE80211_F_SCAN) {
+                       ieee80211_add_scan(vap, &scan, wh, subtype, rssi, rtsf);
+               }
++
++              /* stop processing if the bss channel is not set up yet */
++              if (!ic->ic_bsschan || ic->ic_bsschan == IEEE80211_CHAN_ANYC)
++                      break;
++
+               /* NB: Behavior of WDS-Link and Ad-Hoc is very similar here:
+                * When we receive a beacon that belongs to the AP that we're
+                * connected to, use it to refresh the local node info.
diff --git a/net/madwifi/patches/379-invalid_rate_fix.patch b/net/madwifi/patches/379-invalid_rate_fix.patch
new file mode 100644 (file)
index 0000000..3ee2ed2
--- /dev/null
@@ -0,0 +1,405 @@
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -111,27 +111,13 @@
+ #include <net80211/ieee80211_var.h>
+ #include <net80211/ieee80211_rate.h>
++#include "if_ath_debug.h"
+ #include "if_athvar.h"
+ #include "if_ath_hal.h"
+ #include "ah_desc.h"
+ #include "minstrel.h"
+-#ifdef AR_DEBUG
+-#define       MINSTREL_DEBUG
+-#endif
+-#ifdef MINSTREL_DEBUG
+-enum {
+-              ATH_DEBUG_RATE          = 0x00000010    /* rate control */
+-};
+-#define       DPRINTF(sc, _fmt, ...) do {             \
+-              if (sc->sc_debug & ATH_DEBUG_RATE)      \
+-                      printk(_fmt, __VA_ARGS__);              \
+-} while (0)
+-#else
+-#define       DPRINTF(sc, _fmt, ...)
+-#endif
+-
+ #define ONE_SECOND (1000 * 1000)  /* 1 second, or 1000 milliseconds; eternity, in other words */
+ #include "release.h"
+@@ -471,11 +457,11 @@ ath_rate_tx_complete(struct ath_softc *s
+               final_rate = sc->sc_hwmap[ts->ts_rate & ~HAL_TXSTAT_ALTRATE].ieeerate;
+               final_ndx = rate_to_ndx(sn, final_rate);
+               if (final_ndx >= sn->num_rates) {
+-                      DPRINTF(sc, "%s: final ndx too high\n", __func__);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: final ndx too high\n", __func__);
+                       final_ndx = 0;
+               }
+               if (final_ndx < 0) {
+-                      DPRINTF(sc, "%s: final ndx too low\n", __func__);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: final ndx too low\n", __func__);
+                       final_ndx = 0;
+               }
+@@ -485,7 +471,7 @@ ath_rate_tx_complete(struct ath_softc *s
+               tries = ts->ts_longretry + 1;
+               if (sn->num_rates <= 0) {
+-                      DPRINTF(sc, "%s: " MAC_FMT " %s no rates yet\n", dev_info,
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " %s no rates yet\n", dev_info,
+                               MAC_ADDR(an->an_node.ni_macaddr), __func__);
+                       return;
+               }
+@@ -551,7 +537,7 @@ ath_rate_tx_complete(struct ath_softc *s
+ static void
+ ath_rate_newassoc(struct ath_softc *sc, struct ath_node *an, int isnew)
+ {
+-              DPRINTF(sc, "%s: " MAC_FMT " %s\n", dev_info,
++              DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " %s\n", dev_info,
+                       MAC_ADDR(an->an_node.ni_macaddr), __func__);
+               if (isnew)
+                       ath_rate_ctl_reset(sc, &an->an_node);
+@@ -601,7 +587,7 @@ ath_fill_sample_table(struct minstrel_no
+                           p = rates + sprintf(rates, "rates :: %d ", column_index);
+                           for (i = 0; i < num_sample_rates; i++)
+                                   p += sprintf(p, "%2u ", sn->rs_sampleTable[i][column_index]);
+-                          DPRINTF(sc, "%s\n", rates);
++                          DPRINTF(sc, ATH_DEBUG_RATE, "%s\n", rates);
+               };
+ #endif
+ }
+@@ -628,7 +614,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+               sn->is_sampling = 0;
+               if (rt == NULL) {
+-                      DPRINTF(sc, "no rates yet! mode %u\n", sc->sc_curmode);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "no rates yet! mode %u\n", sc->sc_curmode);
+                       return;
+               }
+               sn->static_rate_ndx = -1;
+@@ -658,7 +644,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+                       sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
+                       }
+                       if (sn->rates[x].rix == 0xff) {
+-                              DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
++                              DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %d\n",
+                                       dev_info, __func__, x);
+                               continue;
+                       }
+@@ -673,7 +659,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+               ni->ni_txrate = 0;
+               if (sn->num_rates <= 0) {
+-                      DPRINTF(sc, "%s: %s " MAC_FMT " no rates (fixed %d) \n",
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " no rates (fixed %d) \n",
+                               dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
+                               vap->iv_fixed_rate);
+                       /* There are no rates yet; we're done */
+@@ -689,23 +675,23 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+                        * the node.  We know the rate is there because the
+                        * rate set is checked when the station associates. */
+                       /* NB: the rate set is assumed sorted */
+-                      for (; (srate >= 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--);
+-
+-                      KASSERT(srate >= 0,
+-                              ("fixed rate %d not in rate set", vap->iv_fixed_rate));
++                      for (; (srate > 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--);
+                       sn->static_rate_ndx = srate;
+                       ni->ni_txrate = srate;
+-                      DPRINTF(sc, "%s: %s " MAC_FMT " fixed rate %d%sMbps\n",
+-                              dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
+-                              sn->rates[srate].rate / 2,
+-                              (sn->rates[srate].rate % 2) ? ".5 " : " ");
++                      if ((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate)
++                              EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
++                      else
++                              DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %d%sMbps\n",
++                                      dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
++                                      sn->rates[srate].rate / 2,
++                                      (sn->rates[srate].rate % 2) ? ".5 " : " ");
+                       return;
+               }
+               for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
+                       if (sn->rates[x].rix == 0xff) {
+-                              DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
++                              DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %d\n",
+                                       dev_info, __func__, x);
+                               continue;
+                       }
+@@ -735,9 +721,9 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+               }
+ #if 0
+-              DPRINTF(sc, "%s: Retry table for this node\n", __func__);
++              DPRINTF(sc, ATH_DEBUG_RATE, "%s: Retry table for this node\n", __func__);
+                 for (x = 0; x < ni->ni_rates.rs_nrates; x++)
+-                           DPRINTF(sc, "%2d  %2d %6d  \n", x, sn->retry_count[x], sn->perfect_tx_time[x]);
++                           DPRINTF(sc, ATH_DEBUG_RATE, "%2d  %2d %6d  \n", x, sn->retry_count[x], sn->perfect_tx_time[x]);
+ #endif
+               /* Set the initial rate */
+@@ -781,10 +767,10 @@ ath_timer_function(unsigned long data)
+               unsigned int interval = ath_timer_interval;
+               if (dev == NULL)
+-                      DPRINTF(sc, "%s: 'dev' is null in this timer \n", __func__);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'dev' is null in this timer \n", __func__);
+               if (sc == NULL)
+-                      DPRINTF(sc, "%s: 'sc' is null in this timer\n", __func__);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'sc' is null in this timer\n", __func__);
+               ic = &sc->sc_ic;
+@@ -808,7 +794,7 @@ ath_timer_function(unsigned long data)
+               timer  = &(ssc->timer);
+               if (timer == NULL)
+-                      DPRINTF(sc, "%s: timer is null - leave it\n", __func__);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: timer is null - leave it\n", __func__);
+               timer->expires = jiffies + ((HZ * interval) / 1000);
+               add_timer(timer);
+@@ -904,7 +890,7 @@ static struct ath_ratectrl *
+ ath_rate_attach(struct ath_softc *sc)
+ {
+               struct minstrel_softc *osc;
+-              DPRINTF(sc, "%s: %s\n", dev_info, __func__);
++              DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s\n", dev_info, __func__);
+               _MOD_INC_USE(THIS_MODULE, return NULL);
+               osc = kmalloc(sizeof(struct minstrel_softc), GFP_ATOMIC);
+@@ -963,7 +949,7 @@ ath_proc_read_nodes(struct ieee80211vap 
+                                       p += sprintf(p, "out of room for node " MAC_FMT "\n\n", MAC_ADDR(ni->ni_macaddr));
+                                       break;
+                               }
+-                              DPRINTF(sc, "%s: out of memeory to write tall of the nodes\n", __func__);
++                              DPRINTF(sc, ATH_DEBUG_RATE, "%s: out of memeory to write tall of the nodes\n", __func__);
+                                   break;
+                       }
+                       an = ATH_NODE(ni);
+--- a/ath_rate/amrr/amrr.c
++++ b/ath_rate/amrr/amrr.c
+@@ -64,24 +64,13 @@
+ #include <net80211/ieee80211_var.h>
+ #include <net80211/ieee80211_rate.h>
++#include "if_ath_debug.h"
+ #include "if_athvar.h"
+ #include "if_ath_hal.h"
+ #include "ah_desc.h"
+ #include "amrr.h"
+-#ifdef AR_DEBUG
+-#define       AMRR_DEBUG
+-#endif
+-#ifdef AMRR_DEBUG
+-#define       DPRINTF(sc, _fmt, ...) do {                                     \
+-      if (sc->sc_debug & 0x10)                                        \
+-              printk(_fmt, __VA_ARGS__);                              \
+-} while (0)
+-#else
+-#define       DPRINTF(sc, _fmt, ...)
+-#endif
+-
+ static int ath_rateinterval = 1000;           /* rate ctl interval (ms)  */
+ static int ath_rate_max_success_threshold = 10;
+ static int ath_rate_min_success_threshold = 1;
+@@ -197,7 +186,7 @@ ath_rate_update(struct ath_softc *sc, st
+       KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+-      DPRINTF(sc, "%s: set xmit rate for " MAC_FMT " to %dM\n",
++      DPRINTF(sc, ATH_DEBUG_RATE, "%s: set xmit rate for " MAC_FMT " to %dM\n",
+               __func__, MAC_ADDR(ni->ni_macaddr),
+               ni->ni_rates.rs_nrates > 0 ?
+                       (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);
+@@ -297,9 +286,9 @@ ath_rate_ctl_start(struct ath_softc *sc,
+                * rate set is checked when the station associates.
+                */
+               srate = ni->ni_rates.rs_nrates - 1;
+-              for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
+-              KASSERT(srate >= 0,
+-                      ("fixed rate %d not in rate set", vap->iv_fixed_rate));
++              for (; srate > 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
++              if (RATE(srate) != vap->iv_fixed_rate)
++                      EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
+       }
+       ath_rate_update(sc, ni, srate);
+ #undef RATE
+@@ -377,7 +366,7 @@ ath_rate_ctl(void *arg, struct ieee80211
+       old_rate = ni->ni_txrate;
+-      DPRINTF (sc, "cnt0: %d cnt1: %d cnt2: %d cnt3: %d -- threshold: %d\n",
++      DPRINTF(sc, ATH_DEBUG_RATE, "cnt0: %d cnt1: %d cnt2: %d cnt3: %d -- threshold: %d\n",
+                amn->amn_tx_try0_cnt,
+                amn->amn_tx_try1_cnt,
+                amn->amn_tx_try2_cnt,
+@@ -390,7 +379,7 @@ ath_rate_ctl(void *arg, struct ieee80211
+                       amn->amn_recovery = 1;
+                       amn->amn_success = 0;
+                       ni->ni_txrate++;
+-                      DPRINTF(sc, "increase rate to %d\n", ni->ni_txrate);
++                      DPRINTF(sc, ATH_DEBUG_RATE, "increase rate to %d\n", ni->ni_txrate);
+               } else
+                       amn->amn_recovery = 0;
+       } else if (is_failure(amn)) {
+@@ -401,12 +390,12 @@ ath_rate_ctl(void *arg, struct ieee80211
+                               amn->amn_success_threshold *= 2;
+                               amn->amn_success_threshold = min(amn->amn_success_threshold,
+                                                                 (u_int)ath_rate_max_success_threshold);
+-                              DPRINTF(sc, "decrease rate recovery thr: %d\n",
++                              DPRINTF(sc, ATH_DEBUG_RATE, "decrease rate recovery thr: %d\n",
+                                       amn->amn_success_threshold);
+                       } else {
+                               /* simple failure. */
+                               amn->amn_success_threshold = ath_rate_min_success_threshold;
+-                              DPRINTF(sc, "decrease rate normal thr: %d\n",
++                              DPRINTF(sc, ATH_DEBUG_RATE, "decrease rate normal thr: %d\n",
+                                       amn->amn_success_threshold);
+                       }
+                       amn->amn_recovery = 0;
+--- a/ath_rate/onoe/onoe.c
++++ b/ath_rate/onoe/onoe.c
+@@ -60,27 +60,13 @@
+ #include <net80211/ieee80211_var.h>
+ #include <net80211/ieee80211_rate.h>
++#include "if_ath_debug.h"
+ #include "if_athvar.h"
+ #include "if_ath_hal.h"
+ #include "ah_desc.h"
+ #include "onoe.h"
+-#ifdef AR_DEBUG
+-#define       ONOE_DEBUG
+-#endif
+-#ifdef ONOE_DEBUG
+-enum {
+-      ATH_DEBUG_RATE  = 0x00000010,   /* rate control */
+-};
+-#define       DPRINTF(sc, _fmt, ...) do {                             \
+-      if (sc->sc_debug & ATH_DEBUG_RATE)                      \
+-              printk(_fmt, __VA_ARGS__);                      \
+-} while (0)
+-#else
+-#define       DPRINTF(sc, _fmt, ...)
+-#endif
+-
+ /*
+  * Default parameters for the rate control algorithm.  These are
+  * all tunable with sysctls.  The rate controller runs periodically
+@@ -186,7 +172,7 @@ ath_rate_update(struct ath_softc *sc, st
+       KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+-      DPRINTF(sc, "%s: set xmit rate for " MAC_FMT " to %dM\n",
++      DPRINTF(sc, ATH_DEBUG_RATE, "%s: set xmit rate for " MAC_FMT " to %dM\n",
+               __func__, MAC_ADDR(ni->ni_macaddr),
+               ni->ni_rates.rs_nrates > 0 ?
+                       (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);
+@@ -283,9 +269,9 @@ ath_rate_ctl_start(struct ath_softc *sc,
+                */
+               /* NB: the rate set is assumed sorted */
+               srate = ni->ni_rates.rs_nrates - 1;
+-              for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
+-              KASSERT(srate >= 0,
+-                      ("fixed rate %d not in rate set", vap->iv_fixed_rate));
++              for (; srate > 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
++              if (RATE(srate) != vap->iv_fixed_rate)
++                      EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
+       }
+       ath_rate_update(sc, ni, srate);
+ #undef RATE
+@@ -364,7 +350,7 @@ ath_rate_ctl(void *arg, struct ieee80211
+           on->on_tx_retr < (on->on_tx_ok * ath_rate_raise) / 100)
+               dir = 1;
+-      DPRINTF(sc, MAC_FMT ": ok %d err %d retr %d upper %d dir %d\n",
++      DPRINTF(sc, ATH_DEBUG_RATE, MAC_FMT ": ok %d err %d retr %d upper %d dir %d\n",
+               MAC_ADDR(ni->ni_macaddr),
+               on->on_tx_ok, on->on_tx_err, on->on_tx_retr,
+               on->on_tx_upper, dir);
+@@ -395,7 +381,7 @@ ath_rate_ctl(void *arg, struct ieee80211
+       }
+       if (nrate != ni->ni_txrate) {
+-              DPRINTF(sc, "%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
++              DPRINTF(sc, ATH_DEBUG_RATE, "%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
+                   __func__,
+                   (rs->rs_rates[ni->ni_txrate] & IEEE80211_RATE_VAL) / 2,
+                   (rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2,
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -62,30 +62,13 @@
+ #include <net80211/ieee80211_var.h>
+ #include <net80211/ieee80211_rate.h>
++#include "if_ath_debug.h"
+ #include "if_athvar.h"
+ #include "if_ath_hal.h"
+ #include "ah_desc.h"
+ #include "sample.h"
+-#ifdef AR_DEBUG
+-#define SAMPLE_DEBUG
+-#endif
+-#ifdef SAMPLE_DEBUG
+-enum {
+-      ATH_DEBUG_RATE          = 0x00000010,   /* rate control */
+-      ATH_DEBUG_ANY           = 0xffffffff
+-};
+-#define       DPRINTF(sc, m, fmt, ...) do {                           \
+-      if (sc->sc_debug & (m))                                 \
+-              printk(fmt, __VA_ARGS__);                       \
+-} while (0)
+-#else
+-#define       DPRINTF(sc, m, fmt, ...) do {                           \
+-      (void) sc;                                              \
+-} while (0)
+-#endif
+-
+ /*
+  * This file is an implementation of the SampleRate algorithm
+  * in "Bit-rate Selection in Wireless Networks"
+@@ -740,7 +723,7 @@ ath_rate_tx_complete(struct ath_softc *s
+               ndx[3] = rate_to_ndx(sn, rate[3]);
+ #if 0
+-              DPRINTF(sc, "%s: " MAC_FMT " size %u finaltsidx %u tries %u status %u rate/try %u/%u %u/%u %u/%u %u/%u\n",
++              DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " size %u finaltsidx %u tries %u status %u rate/try %u/%u %u/%u %u/%u %u/%u\n",
+                       dev_info, MAC_ADDR(an->an_node.ni_macaddr),
+                       bin_to_size(size_to_bin(frame_size)),
+                       finalTSIdx,
+@@ -886,15 +869,16 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+                       if ((ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL) == vap->iv_fixed_rate)
+                               srate = x;
+-              KASSERT(((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) == vap->iv_fixed_rate),
+-                      ("fixed rate %u not in rate set", vap->iv_fixed_rate));
+-
+               sn->static_rate_ndx = srate;
+               ni->ni_txrate = srate;
+-              DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %u%sMbps\n",
+-                      dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
+-                      sn->rates[srate].rate / 2,
+-                      (sn->rates[srate].rate % 0x1) ? ".5" : " ");
++
++              if ((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate)
++                      EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
++              else
++                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %u%sMbps\n",
++                              dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
++                              sn->rates[srate].rate / 2,
++                              (sn->rates[srate].rate % 0x1) ? ".5" : " ");
+               return;
+       }
diff --git a/net/madwifi/patches/380-noderef_hack.patch b/net/madwifi/patches/380-noderef_hack.patch
new file mode 100644 (file)
index 0000000..e939772
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -427,8 +427,8 @@ ieee80211_reset_bss(struct ieee80211vap 
+                         __func__, ni, MAC_ADDR(vap->iv_myaddr));
+       KASSERT(ni != NULL, ("unable to setup inital BSS node"));
+-      vap->iv_bss = PASS_NODE(ni);
+-      KASSERT((atomic_read(&vap->iv_bss->ni_refcnt) == 2), 
++      vap->iv_bss = ieee80211_ref_node(ni);
++      KASSERT((atomic_read(&vap->iv_bss->ni_refcnt) == 3), 
+               ("wrong refcount for new node."));
+       if (obss != NULL) {
diff --git a/net/madwifi/patches/381-ibss_modes.patch b/net/madwifi/patches/381-ibss_modes.patch
new file mode 100644 (file)
index 0000000..f904ed9
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1260,7 +1260,10 @@ ath_vap_create(struct ieee80211com *ic, 
+       case IEEE80211_M_IBSS:
+               if ((sc->sc_nvaps != 0) && (ic->ic_opmode == IEEE80211_M_STA))
+                       return NULL;
+-              ic_opmode = opmode;
++              if (ic->ic_opmode == IEEE80211_M_HOSTAP)
++                      ic_opmode = ic->ic_opmode;
++              else
++                      ic_opmode = opmode;
+               break;
+       case IEEE80211_M_AHDEMO:
+       case IEEE80211_M_MONITOR:
+@@ -1455,7 +1458,7 @@ ath_vap_create(struct ieee80211com *ic, 
+        * frames.  Other modes carry over directly to the HAL.
+        */
+       if (ic->ic_opmode == IEEE80211_M_AHDEMO)
+-              sc->sc_opmode = HAL_M_IBSS;
++              sc->sc_opmode = HAL_M_HOSTAP;
+       else
+               sc->sc_opmode = (HAL_OPMODE) ic->ic_opmode;     /* NB: compatible */
diff --git a/net/madwifi/patches/382-relax_bintval.patch b/net/madwifi/patches/382-relax_bintval.patch
new file mode 100644 (file)
index 0000000..0901949
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -61,8 +61,8 @@
+ #define       IEEE80211_DTIM_MIN              1       /* min DTIM period */
+ #define       IEEE80211_DTIM_DEFAULT          1       /* default DTIM period */
+-#define       IEEE80211_BINTVAL_MAX           1000    /* max beacon interval (TUs) */
+-#define       IEEE80211_BINTVAL_MIN           25      /* min beacon interval (TUs) */
++#define       IEEE80211_BINTVAL_MAX           5000    /* max beacon interval (TUs) */
++#define       IEEE80211_BINTVAL_MIN           10      /* min beacon interval (TUs) */
+ #define       IEEE80211_BINTVAL_DEFAULT       100     /* default beacon interval (TUs) */
+ #define IEEE80211_BINTVAL_VALID(_bi) \
+       ((IEEE80211_BINTVAL_MIN <= (_bi)) && \
diff --git a/net/madwifi/patches/383-ibss_hostap.patch b/net/madwifi/patches/383-ibss_hostap.patch
new file mode 100644 (file)
index 0000000..a91753c
--- /dev/null
@@ -0,0 +1,105 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1452,6 +1452,23 @@ ath_vap_create(struct ieee80211com *ic, 
+               sc->sc_nstavaps++;
+       else if (opmode == IEEE80211_M_MONITOR)
+               sc->sc_nmonvaps++;
++
++
++      /* Driving the HAL in IBSS sometimes adapts the TSF and other timing registers
++       * from received beacons/probes. If that happens, expected TX interrupts may
++       * not occur until next reset. Which triggers the "lost beacon" tasklet.
++       * Resulting effectively in not sending packets for minutes. Because that only
++       * happens in large mesh networks, this mode needs to be activated by a kernel
++       * module parameter: hostap_for_ibss=1. Note that using this mode has side
++       * effects. Such as not supressing beacons/probe answers randomly when
++       * receiving other node beacons. It's recommended to lower the beacon interval
++       * then. When using an IBSS-VAP together with an HOSTAP-VAP, you may also need
++       * to re-trigger IBSS beacon generation after creating the HOSTAP-VAP by
++       * issueing "iwpriv athX bintval 1000".
++       */
++      if ((flags & IEEE80211_NO_STABEACONS) && (ic->ic_opmode == IEEE80211_M_IBSS))
++              sc->sc_opmode = HAL_M_HOSTAP;
++      else
+       /*
+        * Adhoc demo mode is a pseudo mode; to the HAL it's
+        * just IBSS mode and the driver doesn't use management
+@@ -4279,7 +4296,8 @@ ath_calcrxfilter(struct ath_softc *sc)
+       if (ic->ic_opmode != IEEE80211_M_HOSTAP && (dev->flags & IFF_PROMISC))
+               rfilt |= HAL_RX_FILTER_PROM;
+       if (ic->ic_opmode == IEEE80211_M_STA ||
+-          sc->sc_opmode == HAL_M_IBSS ||      /* NB: AHDEMO too */
++          ic->ic_opmode == IEEE80211_M_IBSS ||
++          ic->ic_opmode == IEEE80211_M_AHDEMO ||
+           (sc->sc_nostabeacons) || sc->sc_scanning ||
+               (ic->ic_opmode == IEEE80211_M_HOSTAP))
+               rfilt |= HAL_RX_FILTER_BEACON;
+@@ -6435,6 +6453,33 @@ ath_capture(struct net_device *dev, cons
+ }
+ /*
++ * Advances (forwards/adds) a microsecond value to current chip's TSF registers
++ */
++
++/* from ath_info.c */
++#define AR5K_TSF_L32_5210             0x806c  /* TSF (lower 32 bits) */
++#define AR5K_TSF_L32_5211             0x804c
++#define AR5K_TSF_L32                  (ar_device(ah->ah_sc->devid) == 5210 ? \
++                                      AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
++
++#define AR5K_TSF_U32_5210             0x8070
++#define AR5K_TSF_U32_5211             0x8050
++#define AR5K_TSF_U32                  (ar_device(ah->ah_sc->devid) == 5210 ? \
++                                      AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
++
++static inline void ath_hal_settsf64(struct ath_hal *ah, u_int64_t tsf_adv)
++{
++      ATH_HAL_LOCK_IRQ(ah->ah_sc);
++      ath_hal_set_function(__func__);
++      tsf_adv += ah->ah_getTsf64(ah);
++      OS_REG_WRITE(ah, AR5K_TSF_L32, 0ll);
++      OS_REG_WRITE(ah, AR5K_TSF_U32, (tsf_adv >> 32) & 0xffffffffll);
++      OS_REG_WRITE(ah, AR5K_TSF_L32, (tsf_adv >> 00) & 0xffffffffll);
++      ath_hal_set_function(NULL);
++      ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
++}
++
++/*
+  * Intercept management frames to collect beacon RSSI data and to do
+  * ibss merges. This function is called for all management frames,
+  * including those belonging to other BSS.
+@@ -6487,10 +6532,19 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+                       DPRINTF(sc, ATH_DEBUG_BEACON, 
+                               "Updated beacon timers\n");
+               }
+-              if ((sc->sc_opmode == HAL_M_IBSS) &&
+-                              IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid) &&
+-                              ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval)) {
+-                      DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
++              if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
++                              (sc->sc_opmode == HAL_M_HOSTAP) &&
++                              IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
++                      /* In this mode, we drive the HAL in HOSTAP mode. Hence
++                       * we do the IBSS merging in software. Also do not merge
++                       * if the difference it too small. Otherwise we are playing
++                       * tsf-pingpong with other vendors drivers */
++                      beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf);
++                      if (beacon_tsf > rtsf + 0xffff) {
++                              ath_hal_settsf64(sc->sc_ah, beacon_tsf - rtsf);
++                              ieee80211_ibss_merge(ni);
++                      }
++                      break;
+               }
+               /* NB: Fall Through */
+       case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
+@@ -6563,6 +6617,10 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+ #endif
+                       if (do_merge)
+                               ieee80211_ibss_merge(ni);
++
++                      if ((sc->sc_opmode == HAL_M_IBSS) &&
++                                      ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval))
++                              DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
+               }
+               break;
+       }
diff --git a/net/madwifi/patches/384-hwdetect.patch b/net/madwifi/patches/384-hwdetect.patch
new file mode 100644 (file)
index 0000000..da1fe2d
--- /dev/null
@@ -0,0 +1,325 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -62,6 +62,7 @@
+ #include <linux/if_arp.h>
+ #include <linux/rtnetlink.h>
+ #include <linux/time.h>
++#include <linux/pci.h>
+ #include <asm/uaccess.h>
+ #include "if_ethersubr.h"             /* for ETHER_IS_MULTICAST */
+@@ -401,6 +402,15 @@ static int outdoor = -1;
+ static int xchanmode = -1;
+ static int beacon_cal = 1;
++static const struct ath_hw_detect generic_hw_info = {
++      .vendor_name = "Unknown",
++      .card_name = "Generic",
++      .vendor = PCI_ANY_ID,
++      .id = PCI_ANY_ID,
++      .subvendor = PCI_ANY_ID,
++      .subid = PCI_ANY_ID
++};
++
+ static const char *hal_status_desc[] = {
+       "No error",
+       "No hardware present or device not yet supported",
+@@ -542,6 +552,8 @@ ath_attach(u_int16_t devid, struct net_d
+       DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
+ #endif
++      sc->sc_hwinfo = &generic_hw_info;
++
+       /* Allocate space for dynamically determined maximum VAP count */
+       sc->sc_bslot = 
+               kmalloc(ath_maxvaps * sizeof(struct ieee80211vap*), GFP_KERNEL);
+@@ -1508,6 +1520,29 @@ ath_vap_create(struct ieee80211com *ic, 
+       return vap;
+ }
++void
++ath_hw_detect(struct ath_softc *sc, const struct ath_hw_detect *cards, int n_cards, u32 vendor, u32 id, u32 subvendor, u32 subid)
++{
++      int i;
++
++      for (i = 0; i < n_cards; i++) {
++              const struct ath_hw_detect *c = &cards[i];
++
++              if ((c->vendor != PCI_ANY_ID) && c->vendor != vendor)
++                      continue;
++              if ((c->id != PCI_ANY_ID) && c->id != id)
++                      continue;
++              if ((c->subvendor != PCI_ANY_ID) && c->subvendor != subvendor)
++                      continue;
++              if ((c->subid != PCI_ANY_ID) && c->subid != subid)
++                      continue;
++
++              sc->sc_hwinfo = c;
++              sc->sc_poweroffset = c->poweroffset;
++              break;
++      }
++}
++
+ static void
+ ath_vap_delete(struct ieee80211vap *vap)
+ {
+@@ -10225,6 +10260,7 @@ static u_int32_t
+ ath_set_clamped_maxtxpower(struct ath_softc *sc, 
+               u_int32_t new_clamped_maxtxpower)
+ {
++      new_clamped_maxtxpower -= sc->sc_poweroffset;
+       (void)ath_hal_settxpowlimit(sc->sc_ah, new_clamped_maxtxpower);
+       return ath_get_clamped_maxtxpower(sc);
+ }
+@@ -10238,6 +10274,7 @@ ath_get_clamped_maxtxpower(struct ath_so
+ {
+       u_int32_t clamped_maxtxpower;
+       (void)ath_hal_getmaxtxpow(sc->sc_ah, &clamped_maxtxpower);
++      clamped_maxtxpower += sc->sc_poweroffset;
+       return clamped_maxtxpower;
+ }
+@@ -10821,6 +10858,12 @@ ath_ioctl(struct net_device *dev, struct
+  * is to add module parameters.
+  */
++/* sysctls for hardware info */
++enum {
++      ATH_CARD_VENDOR,
++      ATH_CARD_NAME,
++};
++
+ /*
+  * Dynamic (i.e. per-device) sysctls.  These are automatically
+  * mirrored in /proc/sys.
+@@ -10900,6 +10943,38 @@ ath_sysctl_get_intmit(struct ath_softc *
+ }
+ static int
++ATH_SYSCTL_DECL(ath_sysctl_hwinfo, ctl, write, filp, buffer, lenp, ppos)
++{
++      struct ath_softc *sc = ctl->extra1;
++      struct ath_hal *ah = sc->sc_ah;
++      int ret = 0;
++
++      if (write)
++              return -EINVAL;
++
++      ATH_LOCK(sc);
++      switch((long)ctl->extra2) {
++      case ATH_CARD_VENDOR:
++              ctl->data = (char *)sc->sc_hwinfo->vendor_name;
++              break;
++      case ATH_CARD_NAME:
++              ctl->data = (char *)sc->sc_hwinfo->card_name;
++              break;
++      default:
++              ret = -EINVAL;
++              break;
++      }
++      if (ret == 0) {
++              ctl->maxlen = strlen(ctl->data);
++              ret = ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp,
++                              buffer, lenp, ppos);
++      }
++      ATH_UNLOCK(sc);
++
++      return ret;
++}
++
++static int
+ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
+ {
+       struct ath_softc *sc = ctl->extra1;
+@@ -11179,6 +11254,24 @@ static int maxint = 0x7fffffff;               /* 32-b
+ static const ctl_table ath_sysctl_template[] = {
+       { .ctl_name     = CTL_AUTO,
++        .procname     = "dev_vendor",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_hwinfo,
++        .strategy   = &sysctl_string,
++        .data         = "N/A",
++        .maxlen   = 1,
++        .extra2       = (void *)ATH_CARD_VENDOR,
++      },
++      { .ctl_name     = CTL_AUTO,
++        .procname     = "dev_name",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_hwinfo,
++        .strategy   = &sysctl_string,
++        .data         = "N/A",
++        .maxlen   = 1,
++        .extra2       = (void *)ATH_CARD_NAME,
++      },
++      { .ctl_name     = CTL_AUTO,
+         .procname     = "slottime",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -168,12 +168,16 @@ static inline struct net_device *_alloc_
+         void __user *buffer, size_t *lenp)
+ #define       ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
+       proc_dointvec(ctl, write, filp, buffer, lenp)
++#define       ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
++      proc_dostring(ctl, write, filp, buffer, lenp)
+ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) */
+ #define       ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \
+       f(ctl_table *ctl, int write, struct file *filp, \
+         void __user *buffer, size_t *lenp, loff_t *ppos)
+ #define       ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
+       proc_dointvec(ctl, write, filp, buffer, lenp, ppos)
++#define       ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
++      proc_dostring(ctl, write, filp, buffer, lenp, ppos)
+ #endif
+ #define       ATH_TIMEOUT     1000
+@@ -469,6 +473,7 @@ struct ath_hal;
+ struct ath_desc;
+ struct ath_ratectrl;
+ struct ath_tx99;
++struct ath_hw_detect;
+ struct proc_dir_entry;
+ /*
+@@ -629,6 +634,7 @@ struct ath_softc {
+       struct ath_ratectrl *sc_rc;             /* tx rate control support */
+       struct ath_tx99 *sc_tx99;               /* tx99 support */
+       void (*sc_setdefantenna)(struct ath_softc *, u_int);
++      const struct ath_hw_detect *sc_hwinfo;
+       unsigned int    sc_invalid:1;           /* being detached */
+       unsigned int    sc_mrretry:1;           /* multi-rate retry support */
+@@ -683,6 +689,7 @@ struct ath_softc {
+       const HAL_RATE_TABLE *sc_quarter_rates; /* quarter rate table */
+       HAL_OPMODE sc_opmode;                   /* current hal operating mode */
+       enum ieee80211_phymode sc_curmode;      /* current phy mode */
++      u_int sc_poweroffset;                   /* hardware power offset */
+       u_int16_t sc_curtxpow;                  /* current tx power limit */
+       u_int16_t sc_curaid;                    /* current association id */
+       HAL_CHANNEL sc_curchan;                 /* current h/w channel */
+@@ -929,4 +936,16 @@ int ar_device(int devid);
+ void ath_radar_detected(struct ath_softc *sc, const char* message);
++struct ath_hw_detect {
++      const char *vendor_name;
++      const char *card_name;
++      u32 vendor;
++      u32 id;
++      u32 subvendor;
++      u32 subid;
++      u32 poweroffset;
++};
++
++extern void ath_hw_detect(struct ath_softc *sc, const struct ath_hw_detect *cards, int n_cards, u32 vendor, u32 id, u32 subvendor, u32 subid);
++
+ #endif /* _DEV_ATH_ATHVAR_H */
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
+@@ -20,6 +20,7 @@
+ #include <linux/netdevice.h>
+ #include <linux/cache.h>
+ #include <linux/platform_device.h>
++#include <linux/pci.h>
+ #include <asm/io.h>
+ #include <asm/uaccess.h>
+@@ -181,12 +182,32 @@ exit_ath_wmac(u_int16_t wlanNum, struct 
+       return 0;
+ }
++static const char ubnt[] = "Ubiquiti Networks";
++/* { vendorname, cardname, vendorid, cardid, subsys vendorid, subsys id, poweroffset } */
++static const struct ath_hw_detect cards[] = {
++      { ubnt, "PowerStation2 (18V)", PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xb102 },
++      { ubnt, "PowerStation2 (16D)", PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xb202 },
++      { ubnt, "PowerStation2 (EXT)", PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xb302 },
++      { ubnt, "PowerStation5 (22V)", PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xb105 },
++      { ubnt, "PowerStation5 (EXT)", PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xb305 },
++      { ubnt, "WispStation5",        PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xa105 },
++      { ubnt, "LiteStation2",        PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xa002 },
++      { ubnt, "LiteStation5",        PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xa005 },
++      { ubnt, "NanoStation2",        PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc002 },
++      { ubnt, "NanoStation5",        PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc005 },
++      { ubnt, "NanoStation Loco2",   PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc102 },
++      { ubnt, "NanoStation Loco5",   PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc105 },
++      { ubnt, "Bullet2",             PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc202 },
++      { ubnt, "Bullet5",             PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc205 },
++};
++
+ static int
+ init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
+ {
+       const char *athname;
+       struct net_device *dev;
+       struct ath_ahb_softc *sc;
++      u16 *radio_data;
+       if (((wlanNum != 0) && (wlanNum != 1)) ||
+               (sclist[wlanNum] != NULL))
+@@ -248,6 +269,16 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+       sc->aps_sc.sc_softled = 1; /* SoftLED over GPIO */
+       sc->aps_sc.sc_ledpin = config->board->sysLedGpio;
+       sc->aps_sc.sc_invalid = 0;
++      radio_data = (u16 *) config->radio;
++      if (radio_data) {
++              u16 vendor, id, subvendor, subid;
++              vendor = radio_data[1];
++              id = radio_data[0];
++              subvendor = radio_data[8];
++              subid = radio_data[7];
++              ath_hw_detect(&sc->aps_sc, cards, ARRAY_SIZE(cards), vendor, id, subvendor, subid);
++      }
++
+       return 0;
+  bad4:
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -125,6 +125,33 @@ static u16 ath_devidmap[][2] = {
+       { 0xff1a, 0x001a }
+ };
++static const char ubnt[] = "Ubiquiti Networks";
++/* { vendorname, cardname, vendorid, cardid, subsys vendorid, subsys id, poweroffset } */
++static const struct ath_hw_detect cards[] = {
++      { ubnt, "XR2",     0x168c, 0x001b, 0x0777, 0x3002, 10 },
++      { ubnt, "XR2",     0x168c, 0x001b, 0x7777, 0x3002, 10 },
++      { ubnt, "XR2.3",   0x168c, 0x001b, 0x0777, 0x3b02, 10 },
++      { ubnt, "XR2.6",   0x168c, 0x001b, 0x0777, 0x3c02, 10 },
++      { ubnt, "XR3-2.8", 0x168c, 0x001b, 0x0777, 0x3b03, 10 },
++      { ubnt, "XR3-3.6", 0x168c, 0x001b, 0x0777, 0x3c03, 10 },
++      { ubnt, "XR3",     0x168c, 0x001b, 0x0777, 0x3003, 10 },
++      { ubnt, "XR4",     0x168c, 0x001b, 0x0777, 0x3004, 10 },
++      { ubnt, "XR5",     0x168c, 0x001b, 0x0777, 0x3005, 10 },
++      { ubnt, "XR5",     0x168c, 0x001b, 0x7777, 0x3005, 10 },
++      { ubnt, "XR7",     0x168c, 0x001b, 0x0777, 0x3007, 10 },
++      { ubnt, "XR9",     0x168c, 0x001b, 0x0777, 0x3009, 10 },
++      { ubnt, "SRC",     0x168c, 0x0013, 0x168c, 0x1042, 1 },
++      { ubnt, "SR2",     0x168c, 0x0013, 0x0777, 0x2041, 10 },
++      { ubnt, "SR4",     0x168c, 0x0013, 0x0777, 0x2004, 6 },
++      { ubnt, "SR4",     0x168c, 0x0013, 0x7777, 0x2004, 6 },
++      { ubnt, "SR4C",    0x168c, 0x0013, 0x0777, 0x1004, 6 },
++      { ubnt, "SR4C",    0x168c, 0x0013, 0x7777, 0x1004, 6 },
++      { ubnt, "SR5",     0x168c, 0x0013, 0x168c, 0x2042, 7 },
++      { ubnt, "SR9",     0x168c, 0x0013, 0x7777, 0x2009, 12 },
++      { ubnt, "SR71A",   0x168c, 0x0027, 0x168c, 0x2082, 10 },
++      { ubnt, "SR71",    0x168c, 0x0027, 0x0777, 0x4082, 10 },
++};
++
+ static int
+ ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+ {
+@@ -259,6 +286,10 @@ ath_pci_probe(struct pci_dev *pdev, cons
+       printk(KERN_INFO "%s: %s: %s: mem=0x%lx, irq=%d\n",
+               dev_info, dev->name, athname ? athname : "Atheros ???", phymem, dev->irq);
++      ath_hw_detect(&sc->aps_sc, cards, ARRAY_SIZE(cards),
++              pdev->vendor, pdev->device,
++              pdev->subsystem_vendor, pdev->subsystem_device);
++
+       /* ready to process interrupts */
+       sc->aps_sc.sc_invalid = 0;
diff --git a/net/madwifi/patches/385-antenna_fix.patch b/net/madwifi/patches/385-antenna_fix.patch
new file mode 100644 (file)
index 0000000..e389964
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6669,6 +6669,7 @@ ath_setdefantenna(struct ath_softc *sc, 
+       struct ath_hal *ah = sc->sc_ah;
+       /* XXX block beacon interrupts */
++      ath_hal_setdiversity(ah, (sc->sc_diversity != 0));
+       ath_hal_setdefantenna(ah, antenna);
+       if (sc->sc_defant != antenna)
+               sc->sc_stats.ast_ant_defswitch++;
diff --git a/net/madwifi/patches/386-acl_crashfix.patch b/net/madwifi/patches/386-acl_crashfix.patch
new file mode 100644 (file)
index 0000000..f4ef4ca
--- /dev/null
@@ -0,0 +1,116 @@
+fixes ACL race condition caused by acl list modifications at run time
+
+Signed-off-by: Sebastian Gottschall <brainslayer@dd-wrt.com>
+
+--- a/net80211/ieee80211_acl.c
++++ b/net80211/ieee80211_acl.c
+@@ -112,9 +112,9 @@ acl_detach(struct ieee80211vap *vap)
+ {
+       struct aclstate *as = vap->iv_as;
+-      ACL_LOCK(as);
++      ACL_LOCK_IRQ(as);
+       acl_free_all_locked(as);
+-      ACL_UNLOCK(as);
++      ACL_UNLOCK_IRQ(as);
+       vap->iv_as = NULL;
+       ACL_LOCK_DESTROY(as);
+       FREE(as, M_DEVBUF);
+@@ -128,11 +128,18 @@ _find_acl(struct aclstate *as, const u_i
+       struct acl *acl;
+       int hash;
++      /* locking needed, as inserts are not atomic */
++      ACL_LOCK_IRQ(as);
+       hash = ACL_HASH(macaddr);
+       LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) {
+-              if (IEEE80211_ADDR_EQ(acl->acl_macaddr, macaddr))
+-                      return acl;
++              if (!IEEE80211_ADDR_EQ(acl->acl_macaddr, macaddr))
++                      continue;
++
++              ACL_UNLOCK_IRQ_EARLY(as);
++              return acl;
+       }
++      ACL_UNLOCK_IRQ(as);
++
+       return NULL;
+ }
+@@ -176,11 +183,11 @@ acl_add(struct ieee80211vap *vap, const 
+               return -ENOMEM;
+       }
+-      ACL_LOCK(as);
++      ACL_LOCK_IRQ(as);
+       hash = ACL_HASH(mac);
+       LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) {
+               if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) {
+-                      ACL_UNLOCK_EARLY(as);
++                      ACL_UNLOCK_IRQ_EARLY(as);
+                       FREE(new, M_80211_ACL);
+                       IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
+                               "ACL: add " MAC_FMT " failed, already present\n",
+@@ -191,7 +198,7 @@ acl_add(struct ieee80211vap *vap, const 
+       IEEE80211_ADDR_COPY(new->acl_macaddr, mac);
+       TAILQ_INSERT_TAIL(&as->as_list, new, acl_list);
+       LIST_INSERT_HEAD(&as->as_hash[hash], new, acl_hash);
+-      ACL_UNLOCK(as);
++      ACL_UNLOCK_IRQ(as);
+       IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
+               "ACL: add " MAC_FMT "\n", MAC_ADDR(mac));
+@@ -204,11 +211,11 @@ acl_remove(struct ieee80211vap *vap, con
+       struct aclstate *as = vap->iv_as;
+       struct acl *acl;
+-      ACL_LOCK(as);
++      ACL_LOCK_IRQ(as);
+       acl = _find_acl(as, mac);
+       if (acl != NULL)
+               _acl_free(as, acl);
+-      ACL_UNLOCK(as);
++      ACL_UNLOCK_IRQ(as);
+       IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
+               "ACL: remove " MAC_FMT "%s\n", MAC_ADDR(mac),
+@@ -235,9 +242,9 @@ acl_free_all(struct ieee80211vap *vap)
+       IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: %s\n", "free all");
+-      ACL_LOCK(as);
++      ACL_LOCK_IRQ(as);
+       acl_free_all_locked(vap->iv_as);
+-      ACL_UNLOCK(as);
++      ACL_UNLOCK_IRQ(as);
+       return 0;
+ }
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -319,16 +319,15 @@ typedef spinlock_t ieee80211_scan_lock_t
+ typedef spinlock_t acl_lock_t;
+ #define       ACL_LOCK_INIT(_as, _name)       spin_lock_init(&(_as)->as_lock)
+ #define       ACL_LOCK_DESTROY(_as)
+-#define       ACL_LOCK(_as)                   do {    \
+-      ACL_LOCK_CHECK(_as);            \
+-      spin_lock(&(_as)->as_lock);
+-#define       ACL_UNLOCK(_as)                         \
+-      ACL_LOCK_ASSERT(_as);                   \
+-      spin_unlock(&(_as)->as_lock);           \
+-} while(0)
+-#define ACL_UNLOCK_EARLY(_as)                 \
+-      ACL_LOCK_ASSERT(_as);                   \
+-      spin_unlock(&(_as)->as_lock);
++#define       ACL_LOCK_IRQ(_as)       do {    \
++      unsigned long __acl_lockflags;          \
++      spin_lock_irqsave(&(_as)->as_lock, __acl_lockflags);
++#define       ACL_UNLOCK_IRQ(_as) \
++      spin_unlock_irqrestore(&(_as)->as_lock, __acl_lockflags); \
++} while (0)
++#define       ACL_UNLOCK_IRQ_EARLY(_as)       do { \
++      spin_unlock_irqrestore(&(_as)->as_lock, __acl_lockflags); \
++} while (0)
+ #if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && defined(spin_is_locked)
+ #define       ACL_LOCK_ASSERT(_as) \
diff --git a/net/madwifi/patches/387-maxassoc.patch b/net/madwifi/patches/387-maxassoc.patch
new file mode 100644 (file)
index 0000000..df2b7fd
--- /dev/null
@@ -0,0 +1,85 @@
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -198,6 +198,7 @@ struct ieee80211vap {
+       u_int32_t iv_debug;                             /* debug msg flags */
+       struct ieee80211_stats iv_stats;                /* statistics */
++      int iv_max_nodes;
+       int iv_monitor_nods_only;                       /* in monitor mode only nods traffic */
+       int iv_monitor_txf_len;                         /* in monitor mode, truncate tx packets */
+       int iv_monitor_phy_errors;                      /* in monitor mode, accept phy errors */
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -650,6 +650,7 @@ enum {
+       IEEE80211_PARAM_RSSI_DIS_THR    = 80,   /* rssi threshold for disconnection */
+       IEEE80211_PARAM_RSSI_DIS_COUNT  = 81,   /* counter for rssi threshold */
+       IEEE80211_PARAM_WDS_SEP                 = 82,   /* move wds stations into separate interfaces */
++      IEEE80211_PARAM_MAXASSOC                = 83,   /* maximum associated stations */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2875,6 +2875,12 @@ ieee80211_ioctl_setparam(struct net_devi
+               else
+                       vap->iv_flags_ext &= ~IEEE80211_FEXT_WDSSEP;
+               break;
++      case IEEE80211_PARAM_MAXASSOC:
++              if (vap->iv_opmode != IEEE80211_M_HOSTAP)
++                      retv = -EINVAL;
++              else
++                      vap->iv_max_nodes = value;
++              break;
+ #ifdef ATH_REVERSE_ENGINEERING
+       case IEEE80211_PARAM_DUMPREGS:
+               ieee80211_dump_registers(dev, info, w, extra);
+@@ -3234,6 +3240,9 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_WDS_SEP:
+               param[0] = !!(vap->iv_flags_ext & IEEE80211_FEXT_WDSSEP);
+               break;
++      case IEEE80211_PARAM_MAXASSOC:
++              param[0] = vap->iv_max_nodes;
++              break;
+       default:
+               return -EOPNOTSUPP;
+       }
+@@ -5789,6 +5798,10 @@ static const struct iw_priv_args ieee802
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wdssep"},
+       { IEEE80211_PARAM_WDS_SEP,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_wdssep"},
++      { IEEE80211_PARAM_MAXASSOC,
++       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxassoc"},
++      { IEEE80211_PARAM_MAXASSOC,
++       0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxassoc"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -4020,7 +4020,26 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       vap->iv_stats.is_rx_assoc_norate++;
+                       return;
+               }
++              if (vap->iv_max_nodes > 0) {
++                      unsigned int active_nodes = 0;
++                      struct ieee80211_node *tni;
++
++                      IEEE80211_NODE_TABLE_LOCK_IRQ(&ic->ic_sta);
++                      TAILQ_FOREACH(tni, &ic->ic_sta.nt_node, ni_list) {
++                              if (tni->ni_vap != vap)
++                                      continue;
++                              if (tni->ni_associd == 0)
++                                      continue;
++                              active_nodes++;
++                      }
++                      IEEE80211_NODE_TABLE_UNLOCK_IRQ(&ic->ic_sta);
++                      if (active_nodes >= vap->iv_max_nodes) {
++                              /* too many nodes connected */
++                              ieee80211_node_leave(ni);
++                              return;
++                      }
++              }
+               if (ni->ni_associd != 0 &&
+                   IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan)) {
+                       if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME)
diff --git a/net/madwifi/patches/388-apsta_fix.patch b/net/madwifi/patches/388-apsta_fix.patch
new file mode 100644 (file)
index 0000000..b0cb8e9
--- /dev/null
@@ -0,0 +1,60 @@
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -1415,7 +1415,8 @@ __ieee80211_newstate(struct ieee80211vap
+       vap->iv_state = nstate;                 /* state transition */
+       del_timer(&vap->iv_mgtsend);
+       if ((vap->iv_opmode != IEEE80211_M_HOSTAP) && 
+-                      (ostate != IEEE80211_S_SCAN))
++                      (ostate != IEEE80211_S_SCAN) &&
++                      !(vap->iv_flags_ext & IEEE80211_FEXT_SCAN_PENDING))
+               ieee80211_cancel_scan(vap);     /* background scan */
+       ni = vap->iv_bss;                       /* NB: no reference held */
+       switch (nstate) {
+@@ -1457,7 +1458,8 @@ __ieee80211_newstate(struct ieee80211vap
+                       }
+                       goto reset;
+               case IEEE80211_S_SCAN:
+-                      ieee80211_cancel_scan(vap);
++                      if (!(vap->iv_flags_ext & IEEE80211_FEXT_SCAN_PENDING))
++                              ieee80211_cancel_scan(vap);
+                       goto reset;
+               reset:
+                       ieee80211_reset_bss(vap);
+@@ -1995,7 +1997,9 @@ ieee80211_newstate(struct ieee80211vap *
+                                       }
+                               }
+                       }
+-              } else if (dstate == IEEE80211_S_SCAN) {
++              } else if ((dstate == IEEE80211_S_SCAN) ||
++                              (dstate == IEEE80211_S_AUTH) ||
++                              (dstate == IEEE80211_S_ASSOC)) {
+                       /* Force to scan pending... someone is scanning */
+                       vap->iv_flags_ext |= IEEE80211_FEXT_SCAN_PENDING;
+                       __ieee80211_newstate(vap, IEEE80211_S_INIT, arg);
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -238,7 +238,9 @@ ieee80211_hardstart(struct sk_buff *skb,
+       }
+       
+       /* Cancel any running BG scan */
+-      if (!(ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN_THR) && (vap->iv_state == IEEE80211_S_RUN))
++      if (!(ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN_THR) &&
++              (vap->iv_state == IEEE80211_S_RUN) &&
++              (ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN))
+               ieee80211_cancel_scan(vap);
+       /* 
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2728,9 +2728,9 @@ ieee80211_ioctl_setparam(struct net_devi
+                               return -EINVAL;
+                       vap->iv_flags |= IEEE80211_F_BGSCAN;
+               } else {
+-                      /* XXX racey? */
++                      if (ic->ic_flags_ext & IEEE80211_FEXT_BGSCAN)
++                              ieee80211_cancel_scan(vap);     /* anything current */
+                       vap->iv_flags &= ~IEEE80211_F_BGSCAN;
+-                      ieee80211_cancel_scan(vap);     /* anything current */
+               }
+               break;
+       case IEEE80211_PARAM_BGSCAN_IDLE:
diff --git a/net/madwifi/patches/389-autochannel.patch b/net/madwifi/patches/389-autochannel.patch
new file mode 100644 (file)
index 0000000..06c5c12
--- /dev/null
@@ -0,0 +1,249 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -384,6 +384,7 @@ static u_int32_t ath_get_real_maxtxpower
+ static void ath_poll_disable(struct net_device *dev);
+ static void ath_poll_enable(struct net_device *dev);
++static void ath_fetch_idle_time(struct ath_softc *sc);
+ /* calibrate every 30 secs in steady state but check every second at first. */
+ static int ath_calinterval = ATH_SHORT_CALINTERVAL;
+@@ -2581,6 +2582,7 @@ ath_init(struct net_device *dev)
+        * be followed by initialization of the appropriate bits
+        * and then setup of the interrupt mask.
+        */
++      ath_fetch_idle_time(sc);
+       sc->sc_curchan.channel = ic->ic_curchan->ic_freq;
+       sc->sc_curchan.channelFlags = ath_chan2flags(ic->ic_curchan);
+       if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
+@@ -2914,6 +2916,48 @@ ath_hw_check_atim(struct ath_softc *sc, 
+       return 0;
+ }
++#define AR5K_MIBC       0x0040
++#define AR5K_MIBC_FREEZE   (1 << 1)
++#define AR5K_TXFC       0x80ec
++#define AR5K_RXFC       0x80f0
++#define AR5K_RXCLEAR  0x80f4
++#define AR5K_CYCLES           0x80f8
++static void
++ath_fetch_idle_time(struct ath_softc *sc)
++{
++      struct ieee80211com *ic = &sc->sc_ic;
++      struct ath_hal *ah = sc->sc_ah;
++      u_int32_t cc, rx;
++      u_int32_t time = 0;
++
++      if (sc->sc_ah->ah_macType < 5212)
++              return;
++
++      if (!ic->ic_curchan || (ic->ic_curchan == IEEE80211_CHAN_ANYC))
++              return;
++
++      OS_REG_WRITE(ah, AR5K_MIBC, AR5K_MIBC_FREEZE);
++      rx = OS_REG_READ(ah, AR5K_RXCLEAR);
++      cc = OS_REG_READ(ah, AR5K_CYCLES);
++
++      if (!cc)
++              return;
++
++      if (rx > cc)
++              return; /* should not happen */
++
++      if (sc->sc_last_chan)
++              sc->sc_last_chan->ic_idletime = 100 * (cc - rx) / cc;
++      sc->sc_last_chan = ic->ic_curchan;
++
++      OS_REG_WRITE(ah, AR5K_RXCLEAR, 0);
++      OS_REG_WRITE(ah, AR5K_CYCLES, 0);
++      OS_REG_WRITE(ah, AR5K_TXFC, 0);
++      OS_REG_WRITE(ah, AR5K_RXFC, 0);
++      OS_REG_WRITE(ah, AR5K_MIBC, 0);
++}
++#undef AR5K_RXCLEAR
++#undef AR5K_CYCLES
+ /*
+  * Reset the hardware w/o losing operational state.  This is
+@@ -2941,6 +2985,7 @@ ath_reset(struct net_device *dev)
+        * Convert to a HAL channel description with the flags
+        * constrained to reflect the current operating mode.
+        */
++      ath_fetch_idle_time(sc);
+       c = ic->ic_curchan;
+       sc->sc_curchan.channel = c->ic_freq;
+       sc->sc_curchan.channelFlags = ath_chan2flags(c);
+@@ -9023,6 +9068,7 @@ ath_chan_set(struct ath_softc *sc, struc
+       u_int8_t channel_change_required = 0;
+       struct timeval tv;
++
+       /*
+        * Convert to a HAL channel description with
+        * the flags constrained to reflect the current
+@@ -9031,6 +9077,14 @@ ath_chan_set(struct ath_softc *sc, struc
+       memset(&hchan, 0, sizeof(HAL_CHANNEL));
+       hchan.channel = chan->ic_freq;
+       hchan.channelFlags = ath_chan2flags(chan);
++
++      /* don't do duplicate channel changes, but do
++       * store the available idle time */
++      ath_fetch_idle_time(sc);
++      if ((sc->sc_curchan.channel == hchan.channel) &&
++              (sc->sc_curchan.channelFlags == hchan.channelFlags))
++              return 0;
++
+       KASSERT(hchan.channel != 0,
+               ("bogus channel %u/0x%x", hchan.channel, hchan.channelFlags));
+       do_gettimeofday(&tv);
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -774,6 +774,7 @@ struct ath_softc {
+       struct ieee80211vap **sc_bslot;         /* beacon xmit slots */
+       int sc_bnext;                           /* next slot for beacon xmit */
++      struct ieee80211_channel *sc_last_chan;
+       int sc_beacon_cal;                      /* use beacon timer for calibration */
+       u_int64_t sc_lastcal;                   /* last time the calibration was performed */
+       struct timer_list sc_cal_ch;            /* calibration timer */
+--- a/net80211/_ieee80211.h
++++ b/net80211/_ieee80211.h
+@@ -148,6 +148,7 @@ struct ieee80211_channel {
+       int8_t ic_maxpower;     /* maximum tx power in dBm */
+       int8_t ic_minpower;     /* minimum tx power in dBm */
+       u_int8_t ic_scanflags;
++      u_int8_t ic_idletime; /* phy idle time in % */
+ };
+ #define       IEEE80211_CHAN_MAX      255
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -417,6 +417,19 @@ pc_cmp_rssi(struct ap_state *as, struct 
+ /* This function must be invoked with locks acquired */
+ static int
++pc_cmp_idletime(struct ieee80211_channel *a,
++              struct ieee80211_channel *b)
++{
++      if (!a->ic_idletime || !b->ic_idletime)
++              return 0;
++
++      /* a is better than b (return < 0) when a has more idle time than b */
++      return b->ic_idletime - a->ic_idletime;
++}
++
++
++/* This function must be invoked with locks acquired */
++static int
+ pc_cmp_samechan(struct ieee80211com *ic, struct ieee80211_channel *a,
+               struct ieee80211_channel *b)
+ {
+@@ -451,6 +464,7 @@ pc_cmp(const void *_a, const void *_b)
+       EVALUATE_CRITERION(radar, a, b);
+       EVALUATE_CRITERION(keepmode, params, a, b);
++      EVALUATE_CRITERION(idletime, a, b);
+       EVALUATE_CRITERION(sc, ic, a, b);
+       /* XXX: rssi useless? pick_channel evaluates it anyway */
+       EVALUATE_CRITERION(rssi, params->ss->ss_priv, a, b);
+@@ -519,16 +533,9 @@ pick_channel(struct ieee80211_scan_state
+ #endif
+       best = NULL;
+-      best_rssi = 0xff; /* If signal is bigger than 0xff, we'd be melting. */
+       for (i = 0; i < ss_last; i++) {
+               c = &chans[i];
+-              benefit = best_rssi - as->as_maxrssi[c->chan->ic_ieee];
+-              sta_assoc = ic->ic_sta_assoc;
+-
+-              /* Don't switch... */
+-              if (benefit <= 0)
+-                      continue;
+               /* Verify channel is not marked for non-occupancy */
+               if (IEEE80211_IS_CHAN_RADAR(c->chan))
+@@ -546,31 +553,8 @@ pick_channel(struct ieee80211_scan_state
+                               break;
+               }
+-              if (sta_assoc != 0) {
+-                      int sl = ic->ic_cn_total - 
+-                              ic->ic_chan_nodes[c->chan->ic_ieee]; /* count */
+-                      if (ic->ic_sc_algorithm == IEEE80211_SC_LOOSE) {
+-                              int sl_max = ic->ic_sc_sldg * benefit;
+-                              sl = 1000 * sl / sta_assoc; /* permil */
+-                              IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
+-                                              "%s: chan %d, dB gained: %d, "
+-                                              "STAs lost: %d permil (max %d)\n",
+-                                              __func__, c->chan->ic_ieee, 
+-                                              benefit, sl, sl_max);
+-                              if (sl > sl_max)
+-                                      continue;
+-                      } else if (((ic->ic_sc_algorithm == 
+-                                               IEEE80211_SC_TIGHT) ||
+-                                      (ic->ic_sc_algorithm == 
+-                                               IEEE80211_SC_STRICT)) && 
+-                                      (sl > 0)) {
+-                              /* Break the loop as the subsequent chans 
+-                               * won't be better. */
+-                              break;
+-                      }
+-              }
+               best = c->chan;
+-              best_rssi = as->as_maxrssi[best->ic_ieee];
++              break;
+       }
+       if (best != NULL) {
+@@ -599,6 +583,9 @@ ap_end(struct ieee80211_scan_state *ss, 
+               ("wrong opmode %u", vap->iv_opmode));
+       ic = vap->iv_ic;
++
++      /* record stats for the channel that was scanned last */
++      ic->ic_set_channel(ic);
+       bestchan = pick_channel(ss, vap, flags);
+       if (bestchan == NULL) {
+               if (ss->ss_last > 0) {
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -1002,20 +1002,34 @@ ieee80211_scan_add_channels(struct ieee8
+ {
+       struct ieee80211_channel *c, *cg;
+       u_int modeflags;
++      int has_non_turbo = 0;
+       int i;
+       KASSERT(mode < ARRAY_SIZE(chanflags), ("Unexpected mode %u", mode));
+       modeflags = chanflags[mode];
+       for (i = 0; i < ic->ic_nchans; i++) {
+               c = &ic->ic_channels[i];
++              if (c->ic_flags & (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO))
++                      continue;
++
++              has_non_turbo = 1;
++              break;
++      }
++      for (i = 0; i < ic->ic_nchans; i++) {
++              c = &ic->ic_channels[i];
+               if (c == NULL || isclr(ic->ic_chan_active, c->ic_ieee))
+                       continue;
+               if (c->ic_scanflags & IEEE80211_NOSCAN_SET)
+                       continue;
+-              if (modeflags &&
+-                      ((c->ic_flags & IEEE80211_CHAN_ALLTURBO) !=
+-                       (modeflags & IEEE80211_CHAN_ALLTURBO)))
+-                      continue;
++              if (modeflags) {
++                      if ((c->ic_flags & IEEE80211_CHAN_ALLTURBO) !=
++                               (modeflags & IEEE80211_CHAN_ALLTURBO))
++                              continue;
++              } else if (has_non_turbo) {
++                      if ((ss->ss_vap->iv_opmode == IEEE80211_M_HOSTAP) &&
++                              (c->ic_flags & (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)))
++                              continue;
++              }
+               if (mode == IEEE80211_MODE_AUTO) {
+                       /*
+                        * XXX special-case 11b/g channels so we select
diff --git a/net/madwifi/patches/390-frame_type.patch b/net/madwifi/patches/390-frame_type.patch
new file mode 100644 (file)
index 0000000..0987f7c
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -4443,7 +4443,9 @@ ath_eth_type_trans(struct sk_buff *skb, 
+               if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
+                       skb->pkt_type = PACKET_OTHERHOST;
+-      return eth->h_proto;
++      if ((ntohs(eth->h_proto) >= 1536) || (ntohs(eth->h_proto) < 38))
++              return eth->h_proto;
++      return htons(ETH_P_802_2);
+ }
+ #endif
diff --git a/net/madwifi/patches/391-vap_auth.patch b/net/madwifi/patches/391-vap_auth.patch
new file mode 100644 (file)
index 0000000..832f9e1
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1375,7 +1375,7 @@ ieee80211_auth_open(struct ieee80211_nod
+               vap->iv_stats.is_rx_bad_auth++; /* XXX maybe a unique error? */
+               if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
+                       if (ni == vap->iv_bss) {
+-                              ni = ieee80211_dup_bss(vap, wh->i_addr2, 0);
++                              ni = ieee80211_dup_bss(vap, wh->i_addr2, 1);
+                               if (ni == NULL)
+                                       return;
+                               tmpnode = 1;
+@@ -1763,6 +1763,8 @@ ieee80211_ssid_mismatch(struct ieee80211
+ }
+ #define       IEEE80211_VERIFY_SSID(_ni, _ssid) do {                          \
++      if ((_ni)->ni_esslen == 0)                                      \
++              return;                                                 \
+       if ((_ssid)[1] != 0 &&                                          \
+           ((_ssid)[1] != (_ni)->ni_esslen ||                          \
+           memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {   \
+@@ -1777,6 +1779,8 @@ ieee80211_ssid_mismatch(struct ieee80211
+ } while (0)
+ #else /* !IEEE80211_DEBUG */
+ #define       IEEE80211_VERIFY_SSID(_ni, _ssid) do {                          \
++      if ((_ni)->ni_esslen == 0)                                      \
++              return;                                                 \
+       if ((_ssid)[1] != 0 &&                                          \
+           ((_ssid)[1] != (_ni)->ni_esslen ||                          \
+           memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {   \
diff --git a/net/madwifi/patches/392-remove_wds_nodetracking.patch b/net/madwifi/patches/392-remove_wds_nodetracking.patch
new file mode 100644 (file)
index 0000000..fb9fb6a
--- /dev/null
@@ -0,0 +1,388 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -568,36 +568,6 @@ ieee80211_input(struct ieee80211vap * va
+                               }
+                       }
+-                      /* XXX: Useless node mgmt API; make better */
+-                      if ((dir == IEEE80211_FC1_DIR_DSTODS) && !vap->iv_wdsnode &&
+-                                      !ni_wds && !ni->ni_subif) {
+-                              struct ieee80211_node_table *nt = &ic->ic_sta;
+-                              struct ieee80211_frame_addr4 *wh4;
+-
+-                              if (!(vap->iv_flags_ext & IEEE80211_FEXT_WDS)) {
+-                                      IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
+-                                              wh, "data", "%s", "4 addr not allowed");
+-                                      goto err;
+-                              }
+-                              wh4 = (struct ieee80211_frame_addr4 *)skb->data;
+-                              ni_wds = ieee80211_find_wds_node(nt, wh4->i_addr4);
+-                              /* Last call increments ref count if !NULL */
+-                              if ((ni_wds != NULL) && (ni_wds != ni)) {
+-                                      /*
+-                                       * node with source address (addr4) moved
+-                                       * to another WDS capable station. remove the
+-                                       * reference to the previous station and add 
+-                                       * reference to the new one
+-                                       */
+-                                       (void) ieee80211_remove_wds_addr(nt, wh4->i_addr4);
+-                                       ieee80211_add_wds_addr(nt, ni, wh4->i_addr4, 0);
+-                              }
+-                              if (ni_wds == NULL)
+-                                      ieee80211_add_wds_addr(nt, ni, wh4->i_addr4, 0);
+-                              else
+-                                      ieee80211_unref_node(&ni_wds);
+-                      }
+-
+                       /*
+                        * Check for power save state change.
+                        */
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -122,7 +122,6 @@ static void ieee80211_node_table_init(st
+ static void ieee80211_node_table_cleanup(struct ieee80211_node_table *);
+ static void ieee80211_node_table_reset(struct ieee80211_node_table *,
+       struct ieee80211vap *);
+-static void ieee80211_node_wds_ageout(unsigned long);
+ MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state");
+@@ -785,10 +784,6 @@ ieee80211_node_table_init(struct ieee802
+       nt->nt_name = name;
+       nt->nt_scangen = 1;
+       nt->nt_inact_init = inact;
+-      init_timer(&nt->nt_wds_aging_timer);
+-      nt->nt_wds_aging_timer.function = ieee80211_node_wds_ageout;
+-      nt->nt_wds_aging_timer.data = (unsigned long) nt;
+-      mod_timer(&nt->nt_wds_aging_timer, jiffies + HZ * WDS_AGING_TIMER_VAL);
+ }
+ static __inline 
+@@ -1204,142 +1199,6 @@ void ieee80211_wds_addif(struct ieee8021
+       schedule_work(&ni->ni_create);
+ }
+-/* Add wds address to the node table */
+-int
+-#ifdef IEEE80211_DEBUG_REFCNT
+-ieee80211_add_wds_addr_debug(struct ieee80211_node_table *nt,
+-      struct ieee80211_node *ni, const u_int8_t *macaddr, u_int8_t wds_static,
+-      const char* func, int line)
+-#else
+-ieee80211_add_wds_addr(struct ieee80211_node_table *nt,
+-      struct ieee80211_node *ni, const u_int8_t *macaddr, u_int8_t wds_static)
+-#endif
+-{
+-      int hash;
+-      struct ieee80211_wds_addr *wds;
+-
+-      MALLOC(wds, struct ieee80211_wds_addr *, sizeof(struct ieee80211_wds_addr),
+-              M_80211_WDS, M_NOWAIT | M_ZERO);
+-      if (wds == NULL) {
+-              /* XXX msg */
+-              return 1;
+-      }
+-      if (wds_static)
+-              wds->wds_agingcount = WDS_AGING_STATIC;
+-      else
+-              wds->wds_agingcount = WDS_AGING_COUNT;
+-      hash = IEEE80211_NODE_HASH(macaddr);
+-      IEEE80211_ADDR_COPY(wds->wds_macaddr, macaddr);
+-
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-#ifdef IEEE80211_DEBUG_REFCNT
+-      wds->wds_ni = ieee80211_ref_node_debug(ni, func, line);
+-#else
+-      wds->wds_ni = ieee80211_ref_node(ni);
+-#endif
+-      LIST_INSERT_HEAD(&nt->nt_wds_hash[hash], wds, wds_hash);
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+-      return 0;
+-}
+-#ifdef IEEE80211_DEBUG_REFCNT
+-EXPORT_SYMBOL(ieee80211_add_wds_addr_debug);
+-#else
+-EXPORT_SYMBOL(ieee80211_add_wds_addr);
+-#endif
+-
+-/* remove wds address from the wds hash table */
+-void
+-#ifdef IEEE80211_DEBUG_REFCNT
+-ieee80211_remove_wds_addr_debug(struct ieee80211_node_table *nt, const u_int8_t *macaddr, 
+-                         const char* func, int line)
+-#else
+-ieee80211_remove_wds_addr(struct ieee80211_node_table *nt, const u_int8_t *macaddr)
+-#endif
+-{
+-      int hash;
+-      struct ieee80211_wds_addr *wds, *twds;
+-
+-      hash = IEEE80211_NODE_HASH(macaddr);
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-      LIST_FOREACH_SAFE(wds, &nt->nt_wds_hash[hash], wds_hash, twds) {
+-              if (IEEE80211_ADDR_EQ(wds->wds_macaddr, macaddr)) {
+-                      LIST_REMOVE(wds, wds_hash);
+-#ifdef IEEE80211_DEBUG_REFCNT
+-                      ieee80211_unref_node_debug(&wds->wds_ni, func, line);
+-#else
+-                      ieee80211_unref_node(&wds->wds_ni);
+-#endif
+-                      FREE(wds, M_80211_WDS);
+-                      break;
+-              }
+-      }
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+-}
+-#ifdef IEEE80211_DEBUG_REFCNT
+-EXPORT_SYMBOL(ieee80211_remove_wds_addr_debug);
+-#else
+-EXPORT_SYMBOL(ieee80211_remove_wds_addr);
+-#endif
+-
+-/* Remove node references from wds table */
+-void
+-#ifdef IEEE80211_DEBUG_REFCNT
+-ieee80211_del_wds_node_debug(struct ieee80211_node_table *nt, struct ieee80211_node *ni, 
+-                      const char* func, int line)
+-#else
+-ieee80211_del_wds_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni)
+-#endif
+-{
+-      int hash;
+-      struct ieee80211_wds_addr *wds, *twds;
+-
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-      for (hash = 0; hash < IEEE80211_NODE_HASHSIZE; hash++) {
+-              LIST_FOREACH_SAFE(wds, &nt->nt_wds_hash[hash], wds_hash, twds) {
+-                      if (wds->wds_ni == ni) {
+-                              LIST_REMOVE(wds, wds_hash);
+-#ifdef IEEE80211_DEBUG_REFCNT
+-                              ieee80211_unref_node_debug(&wds->wds_ni, func, line);
+-#else
+-                              ieee80211_unref_node(&wds->wds_ni);
+-#endif
+-                              FREE(wds, M_80211_WDS);
+-                      }
+-              }
+-      }
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+-}
+-#ifdef IEEE80211_DEBUG_REFCNT
+-EXPORT_SYMBOL(ieee80211_del_wds_node_debug);
+-#else
+-EXPORT_SYMBOL(ieee80211_del_wds_node);
+-#endif
+-
+-static void
+-ieee80211_node_wds_ageout(unsigned long data)
+-{
+-      struct ieee80211_node_table *nt = (struct ieee80211_node_table *)data;
+-      int hash;
+-      struct ieee80211_wds_addr *wds, *twds;
+-
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-      for (hash = 0; hash < IEEE80211_NODE_HASHSIZE; hash++) {
+-              LIST_FOREACH_SAFE(wds, &nt->nt_wds_hash[hash], wds_hash, twds) {
+-                      if (wds->wds_agingcount != WDS_AGING_STATIC) {
+-                              if (!wds->wds_agingcount) {
+-                                      LIST_REMOVE(wds, wds_hash);
+-                                      ieee80211_unref_node(&wds->wds_ni);
+-                                      FREE(wds, M_80211_WDS);
+-                              } else
+-                                      wds->wds_agingcount--;
+-                      }
+-              }
+-      }
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+-      mod_timer(&nt->nt_wds_aging_timer, jiffies + HZ * WDS_AGING_TIMER_VAL);
+-}
+-
+-
+ /* Add the specified station to the station table.
+  * Allocates a new ieee80211_node* that has a reference count of one
+  * If tmp is 0, it is added to the node table and the reference is used.
+@@ -1385,34 +1244,6 @@ ieee80211_dup_bss(struct ieee80211vap *v
+       return ni;
+ }
+-static struct ieee80211_node *
+-#ifdef IEEE80211_DEBUG_REFCNT
+-ieee80211_find_wds_node_locked_debug(struct ieee80211_node_table *nt, 
+-                       const u_int8_t *macaddr, const char* func, int line)
+-#else
+-ieee80211_find_wds_node_locked(struct ieee80211_node_table *nt, 
+-                       const u_int8_t *macaddr)
+-#endif
+-{
+-      struct ieee80211_wds_addr *wds;
+-      int hash;
+-      IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
+-
+-      hash = IEEE80211_NODE_HASH(macaddr);
+-      LIST_FOREACH(wds, &nt->nt_wds_hash[hash], wds_hash) {
+-              if (IEEE80211_ADDR_EQ(wds->wds_macaddr, macaddr)) {
+-                      if (wds->wds_agingcount != WDS_AGING_STATIC)
+-                              wds->wds_agingcount = WDS_AGING_COUNT; /* reset the aging count */
+-#ifdef IEEE80211_DEBUG_REFCNT
+-                      return ieee80211_ref_node_debug(wds->wds_ni, func, line);
+-#else
+-                      return ieee80211_ref_node(wds->wds_ni);
+-#endif
+-              }
+-      }
+-      return NULL;
+-}
+-
+ /* NB: A node reference is acquired here; the caller MUST release it. */
+ #ifdef IEEE80211_DEBUG_REFCNT
+ #define       ieee80211_find_node_locked(nt, mac) \
+@@ -1430,7 +1261,6 @@ ieee80211_find_node_locked(struct ieee80
+ {
+       struct ieee80211_node *ni;
+       int hash;
+-      struct ieee80211_wds_addr *wds;
+       IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
+@@ -1445,48 +1275,11 @@ ieee80211_find_node_locked(struct ieee80
+                       return ni;
+               }
+       }
+-
+-      /* Now, we look for the desired mac address in the 4 address
+-         nodes. */
+-      LIST_FOREACH(wds, &nt->nt_wds_hash[hash], wds_hash) {
+-              if (IEEE80211_ADDR_EQ(wds->wds_macaddr, macaddr)) {
+-#ifdef IEEE80211_DEBUG_REFCNT
+-                      return ieee80211_ref_node_debug(wds->wds_ni, func, line);
+-#else
+-                      return ieee80211_ref_node(wds->wds_ni);
+-#endif 
+-              }
+-      }
+       return NULL;
+ }
+ struct ieee80211_node *
+ #ifdef IEEE80211_DEBUG_REFCNT
+-ieee80211_find_wds_node_debug(struct ieee80211_node_table *nt, const u_int8_t *macaddr, 
+-                       const char* func, int line)
+-#else
+-ieee80211_find_wds_node(struct ieee80211_node_table *nt, const u_int8_t *macaddr)
+-#endif
+-{
+-      struct ieee80211_node *ni;
+-
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+-#ifdef IEEE80211_DEBUG_REFCNT
+-      ni = ieee80211_find_wds_node_locked_debug(nt, macaddr, func, line);
+-#else
+-      ni = ieee80211_find_wds_node_locked(nt, macaddr);
+-#endif
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+-      return ni;
+-}
+-#ifdef IEEE80211_DEBUG_REFCNT
+-EXPORT_SYMBOL(ieee80211_find_wds_node_debug);
+-#else
+-EXPORT_SYMBOL(ieee80211_find_wds_node);
+-#endif
+-
+-struct ieee80211_node *
+-#ifdef IEEE80211_DEBUG_REFCNT
+ ieee80211_find_node_debug(struct ieee80211_node_table *nt,
+       const u_int8_t *macaddr, const char *func, int line)
+ #else
+@@ -1838,7 +1631,6 @@ ieee80211_node_table_cleanup(struct ieee
+               ic->ic_node_cleanup(ni);
+ #endif
+       }
+-      del_timer(&nt->nt_wds_aging_timer);
+       IEEE80211_SCAN_LOCK_DESTROY(nt);
+       IEEE80211_NODE_TABLE_LOCK_DESTROY(nt);
+ }
+@@ -2404,8 +2196,6 @@ ieee80211_node_leave(struct ieee80211_no
+        * so no more references are generated
+        */
+       if (nt) {
+-              ieee80211_remove_wds_addr(nt, ni->ni_macaddr);
+-              ieee80211_del_wds_node(nt, ni);
+               IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+               node_table_leave_locked(nt, ni);
+               IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+--- a/net80211/ieee80211_node.h
++++ b/net80211/ieee80211_node.h
+@@ -231,13 +231,6 @@ void ieee80211_sta_leave(struct ieee8021
+ #define WDS_AGING_STATIC      0xffff
+ #define WDS_AGING_TIMER_VAL   (WDS_AGING_TIME / 2)
+-struct ieee80211_wds_addr {
+-      LIST_ENTRY(ieee80211_wds_addr) wds_hash;
+-      u_int8_t        wds_macaddr[IEEE80211_ADDR_LEN];
+-      struct ieee80211_node *wds_ni;
+-      u_int16_t wds_agingcount;
+-};
+-
+ /*
+  * Table of ieee80211_node instances.  Each ieee80211com
+  * has at least one for holding the scan candidates.
+@@ -250,11 +243,9 @@ struct ieee80211_node_table {
+       ieee80211_node_table_lock_t nt_nodelock;        /* on node table */
+       TAILQ_HEAD(, ieee80211_node) nt_node;   /* information of all nodes */
+       ATH_LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE];
+-      ATH_LIST_HEAD(, ieee80211_wds_addr) nt_wds_hash[IEEE80211_NODE_HASHSIZE];
+       ieee80211_scan_lock_t nt_scanlock;      /* on nt_scangen */
+       u_int nt_scangen;                       /* gen# for timeout scan */
+       int nt_inact_init;                      /* initial node inact setting */
+-      struct timer_list nt_wds_aging_timer;   /* timer to age out wds entries */
+ };
+ /* Allocates a new ieee80211_node* that has a reference count of one, and 
+@@ -363,47 +354,6 @@ void
+ ieee80211_unref_node(struct ieee80211_node **pni);
+ #endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+-/* Increments reference count of ieee80211_node *ni */
+-#ifdef IEEE80211_DEBUG_REFCNT
+-#define ieee80211_add_wds_addr(_table, _node, _mac, _static) \
+-      ieee80211_add_wds_addr_debug(_table, _node, _mac, _static, __func__, __LINE__)
+-int ieee80211_add_wds_addr_debug(struct ieee80211_node_table *, struct ieee80211_node *,
+-      const u_int8_t *, u_int8_t, const char* func, int line);
+-#else
+-int ieee80211_add_wds_addr(struct ieee80211_node_table *, struct ieee80211_node *,
+-      const u_int8_t *, u_int8_t);
+-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+-
+-/* Decrements reference count of ieee80211_node *ni */
+-#ifdef IEEE80211_DEBUG_REFCNT
+-#define ieee80211_remove_wds_addr(_table, _mac) \
+-      ieee80211_remove_wds_addr_debug(_table, _mac, __func__, __LINE__)
+-void ieee80211_remove_wds_addr_debug(struct ieee80211_node_table *, const u_int8_t *,
+-                             const char* func, int line);
+-#else
+-void ieee80211_remove_wds_addr(struct ieee80211_node_table *, const u_int8_t *);
+-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+-
+-/* Decrements reference count of node, if found */
+-#ifdef IEEE80211_DEBUG_REFCNT
+-#define ieee80211_del_wds_node(_table, _node) \
+-      ieee80211_del_wds_node_debug(_table, _node, __func__, __LINE__)
+-void ieee80211_del_wds_node_debug(struct ieee80211_node_table *, struct ieee80211_node *,
+-                          const char* func, int line);
+-#else
+-void ieee80211_del_wds_node(struct ieee80211_node_table *, struct ieee80211_node *);
+-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+-
+-/* Increments reference count of node, if found */
+-#ifdef IEEE80211_DEBUG_REFCNT
+-#define ieee80211_find_wds_node(_table, _mac) \
+-      ieee80211_find_wds_node_debug(_table, _mac, __func__, __LINE__)
+-struct ieee80211_node *ieee80211_find_wds_node_debug(struct ieee80211_node_table *,
+-      const u_int8_t *, const char* func, int line);
+-#else
+-struct ieee80211_node *ieee80211_find_wds_node(struct ieee80211_node_table *,
+-      const u_int8_t *);
+-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+ typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
+ void ieee80211_iterate_nodes(struct ieee80211_node_table *,
+       ieee80211_iter_func *, void *);
diff --git a/net/madwifi/patches/393-mbss_vap_auth.patch b/net/madwifi/patches/393-mbss_vap_auth.patch
new file mode 100644 (file)
index 0000000..0e3ecaf
--- /dev/null
@@ -0,0 +1,491 @@
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -123,6 +123,9 @@ static void ieee80211_node_table_cleanup
+ static void ieee80211_node_table_reset(struct ieee80211_node_table *,
+       struct ieee80211vap *);
++static struct ieee80211_node *
++lookup_rxnode(struct ieee80211com *ic, struct ieee80211vap *vap, const u_int8_t *addr);
++
+ MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state");
+ void
+@@ -697,7 +700,7 @@ ieee80211_sta_join(struct ieee80211vap *
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni;
+-      ni = ieee80211_find_node(&ic->ic_sta, se->se_macaddr);
++      ni = lookup_rxnode(ic, vap, se->se_macaddr);
+       if (ni == NULL) {
+               ni = ieee80211_alloc_node_table(vap, se->se_macaddr);
+               IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
+@@ -1394,6 +1397,53 @@ ieee80211_add_neighbor(struct ieee80211v
+       return ni;
+ }
++struct ieee80211vap *
++ieee80211_find_rxvap(struct ieee80211com *ic, const u_int8_t *mac)
++{
++      struct ieee80211vap *vap;
++
++      TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              if (IEEE80211_ADDR_EQ(vap->iv_myaddr, mac))
++                      return vap;
++      }
++      return NULL;
++}
++EXPORT_SYMBOL(ieee80211_find_rxvap);
++
++static struct ieee80211_node *
++lookup_rxnode(struct ieee80211com *ic, struct ieee80211vap *vap,
++      const u_int8_t *addr)
++{
++      struct ieee80211_node_table *nt;
++      struct ieee80211_node *ni = NULL;
++      int use_bss = 0;
++      int hash;
++
++      nt = &ic->ic_sta;
++      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
++      hash = IEEE80211_NODE_HASH(addr);
++      LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
++              if (IEEE80211_ADDR_EQ(ni->ni_macaddr, addr)) {
++                      /* allow multiple nodes on different vaps */
++                      if (vap && (ni->ni_vap != vap))
++                              continue;
++
++                      ieee80211_ref_node(ni);
++                      goto out;
++              }
++      }
++
++      /* no match found */
++      ni = NULL;
++
++out:
++      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
++      return ni;
++#undef IS_PSPOLL
++#undef IS_CTL
++}
++
++
+ /*
+  * Return the node for the sender of a frame; if the sender is unknown return 
+  * NULL. The caller is expected to deal with this. (The frame is sent to all 
+@@ -1403,10 +1453,10 @@ ieee80211_add_neighbor(struct ieee80211v
+  */
+ struct ieee80211_node *
+ #ifdef IEEE80211_DEBUG_REFCNT
+-ieee80211_find_rxnode_debug(struct ieee80211com *ic,
++ieee80211_find_rxnode_debug(struct ieee80211com *ic, struct ieee80211vap *vap,
+       const struct ieee80211_frame_min *wh, const char *func, int line)
+ #else
+-ieee80211_find_rxnode(struct ieee80211com *ic,
++ieee80211_find_rxnode(struct ieee80211com *ic, struct ieee80211vap *vap,
+       const struct ieee80211_frame_min *wh)
+ #endif
+ {
+@@ -1414,9 +1464,8 @@ ieee80211_find_rxnode(struct ieee80211co
+       ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
+ #define       IS_PSPOLL(wh) \
+       ((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_PS_POLL)
+-      struct ieee80211_node_table *nt;
+-      struct ieee80211_node *ni;
+-      struct ieee80211vap *vap, *avp;
++      struct ieee80211_node *ni = NULL;
++      struct ieee80211vap *avp;
+       const u_int8_t *addr;
+       if (IS_CTL(wh) && !IS_PSPOLL(wh) /*&& !IS_RTS(ah)*/)
+@@ -1429,32 +1478,25 @@ ieee80211_find_rxnode(struct ieee80211co
+       /* XXX check ic_bss first in station mode */
+       /* XXX 4-address frames? */
+-      nt = &ic->ic_sta;
+-      IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+       if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) {
+-              TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              if (vap) { /* assume unicast if vap is set, mcast not supported for wds */
+                       TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
+-                              if (!IEEE80211_ADDR_EQ(addr, avp->wds_mac))
++                              if (!IEEE80211_ADDR_EQ(addr, avp->wds_mac) ||
++                                      !IEEE80211_ADDR_EQ(wh->i_addr1, avp->iv_myaddr))
+                                       continue;
+                               if (avp->iv_wdsnode)
+-                                      return ieee80211_ref_node(avp->iv_wdsnode);
+-                              else
+-                                      return NULL;
++                                      ni = ieee80211_ref_node(avp->iv_wdsnode);
++                              return ni;
+                       }
++                      if (!(vap->iv_flags_ext & IEEE80211_FEXT_WDS))
++                              return NULL;
++              } else {
++                      return NULL;
+               }
+       }
+-#ifdef IEEE80211_DEBUG_REFCNT
+-      ni = ieee80211_find_node_locked_debug(nt, addr, func, line);
+-#else
+-      ni = ieee80211_find_node_locked(nt, addr);
+-#endif
+-      IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+-
+-      return ni;
+-#undef IS_PSPOLL
+-#undef IS_CTL
++      return lookup_rxnode(ic, vap, addr);
+ }
+ #ifdef IEEE80211_DEBUG_REFCNT
+ EXPORT_SYMBOL(ieee80211_find_rxnode_debug);
+@@ -1479,15 +1521,14 @@ ieee80211_find_txnode(struct ieee80211va
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node_table *nt;
+       struct ieee80211_node *ni = NULL;
++      int hash;
+-      IEEE80211_LOCK_IRQ(ic);
+       if (vap->iv_opmode == IEEE80211_M_WDS) {
+               if (vap->iv_wdsnode && (vap->iv_state == IEEE80211_S_RUN))
+                       return ieee80211_ref_node(vap->iv_wdsnode);
+               else
+                       return NULL;
+       }
+-      IEEE80211_UNLOCK_IRQ(ic);
+       /*
+        * The destination address should be in the node table
+@@ -1505,11 +1546,22 @@ ieee80211_find_txnode(struct ieee80211va
+       /* XXX: Can't hold lock across dup_bss due to recursive locking. */
+       nt = &vap->iv_ic->ic_sta;
+       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
++      hash = IEEE80211_NODE_HASH(mac);
++      LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
++              if (ni->ni_vap != vap)
++                      continue;
++
++              if (IEEE80211_ADDR_EQ(ni->ni_macaddr, mac)) {
+ #ifdef IEEE80211_DEBUG_REFCNT
+-      ni = ieee80211_find_node_locked_debug(nt, mac, func, line);
++                      ieee80211_ref_node_debug(ni, func, line);
+ #else
+-      ni = ieee80211_find_node_locked(nt, mac);
++                      ieee80211_ref_node(ni);
+ #endif
++                      goto found;
++              }
++      }
++      ni = NULL;
++found:
+       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
+       if (ni == NULL) {
+@@ -1964,13 +2016,32 @@ remove_worse_nodes(void *arg, struct iee
+               }
+ }
++static void
++remove_duplicate_nodes(void *arg, struct ieee80211_node *ni)
++{
++      struct ieee80211_node *rni = arg;
++
++      if (ni == rni)
++              return;
++
++      if (ni->ni_vap == rni->ni_vap)
++              return;
++
++      if (!IEEE80211_ADDR_EQ(rni->ni_macaddr, ni->ni_macaddr))
++              return;
++
++      ieee80211_node_leave(ni);
++}
++
+ void
+ ieee80211_node_join(struct ieee80211_node *ni, int resp)
+ {
+       struct ieee80211com *ic = ni->ni_ic;
+       struct ieee80211vap *vap = ni->ni_vap;
++      struct ieee80211_node *tni;
+       int newassoc;
++      ieee80211_iterate_nodes(&ic->ic_sta, remove_duplicate_nodes, ni);
+       if (ni->ni_associd == 0) {
+               u_int16_t aid;
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -216,16 +216,14 @@ ieee80211_input(struct ieee80211vap * va
+       type = -1;                      /* undefined */
+-      if (!vap)
+-              goto out;
++      if (!vap || !vap->iv_bss || !vap->iv_dev || !vap->iv_ic)
++              goto discard;
+       ic = vap->iv_ic;
+-      if (!ic)
+-              goto out;
+-
+       dev = vap->iv_dev;
+-      if (!dev)
+-              goto out;
++
++      if ((vap->iv_dev->flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
++              goto discard;
+       /* initialize ni as in the previous API */
+       if (ni_or_null == NULL) {
+@@ -233,9 +231,10 @@ ieee80211_input(struct ieee80211vap * va
+                 * guarantee its existence during the following call, hence
+                 * briefly grab our own reference. */
+               ni = ieee80211_ref_node(vap->iv_bss);
++              KASSERT(ni != NULL, ("null node"));
++      } else {
++              ni->ni_inact = ni->ni_inact_reload;
+       }
+-      KASSERT(ni != NULL, ("null node"));
+-      ni->ni_inact = ni->ni_inact_reload;
+       KASSERT(skb->len >= sizeof(struct ieee80211_frame_min),
+               ("frame length too short: %u", skb->len));
+@@ -844,10 +843,11 @@ ieee80211_input(struct ieee80211vap * va
+ err:
+       vap->iv_devstats.rx_errors++;
+ out:
+-      if (skb != NULL)
+-              ieee80211_dev_kfree_skb(&skb);
+       if (ni_or_null == NULL)
+               ieee80211_unref_node(&ni);
++discard:
++      if (skb != NULL)
++              ieee80211_dev_kfree_skb(&skb);
+       return type;
+ #undef HAS_SEQ
+ }
+@@ -929,16 +929,23 @@ int
+ ieee80211_input_all(struct ieee80211com *ic,
+       struct sk_buff *skb, int rssi, u_int64_t rtsf)
+ {
++      struct ieee80211_frame_min *wh = (struct ieee80211_frame_min *) skb->data;
+       struct ieee80211vap *vap;
+       int type = -1;
+       /* XXX locking */
+       TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              struct ieee80211_node *ni = NULL;
+               struct sk_buff *skb1;
+               if ((vap->iv_dev->flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+                       continue;
++              if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
++                      !IEEE80211_IS_MULTICAST(wh->i_addr1))
++                      continue;
++
++              ni = ieee80211_find_rxnode(ic, vap, wh);
+               if (TAILQ_NEXT(vap, iv_next) != NULL) {
+                       skb1 = skb_copy(skb, GFP_ATOMIC);
+                       if (skb1 == NULL) {
+@@ -950,8 +957,12 @@ ieee80211_input_all(struct ieee80211com 
+                       skb1 = skb;
+                       skb = NULL;
+               }
+-              type = ieee80211_input(vap, NULL, skb1, rssi, rtsf);
++              type = ieee80211_input(vap, ni, skb1, rssi, rtsf);
++              if (ni)
++                      ieee80211_unref_node(&ni);
+       }
++
++out:
+       if (skb != NULL)                /* no vaps, reclaim skb */
+               ieee80211_dev_kfree_skb(&skb);
+       return type;
+@@ -1147,11 +1158,9 @@ ieee80211_deliver_data(struct ieee80211_
+                        * sending it will not work; just let it be
+                        * delivered normally.
+                        */
+-                      struct ieee80211_node *ni1 = ieee80211_find_node(
+-                              &vap->iv_ic->ic_sta, eh->ether_dhost);
++                      struct ieee80211_node *ni1 = ieee80211_find_txnode(vap, eh->ether_dhost);
+                       if (ni1 != NULL) {
+-                              if (ni1->ni_vap == vap &&
+-                                  ieee80211_node_is_authorized(ni1) &&
++                              if (ieee80211_node_is_authorized(ni1) &&
+                                       !ni1->ni_subif &&
+                                   ni1 != vap->iv_bss) {
+@@ -3520,6 +3529,7 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                                (vap->iv_opmode == IEEE80211_M_WDS)) &&
+                               (scan.capinfo & IEEE80211_CAPINFO_ESS))) {
+                       struct ieee80211vap *avp = NULL;
++                      int do_unref = 0;
+                       int found = 0;
+                       IEEE80211_LOCK_IRQ(vap->iv_ic);
+@@ -3553,10 +3563,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                                       ni->ni_associd |= 0xc000;
+                                       avp->iv_wdsnode = ieee80211_ref_node(ni);
+                                       IEEE80211_UNLOCK_IRQ(ic);
+-                              } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
++                              } else if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
++                                         IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid)) {
+                                       /* Create a new entry in the neighbor table. */
+                                       ni = ieee80211_add_neighbor(vap, wh, &scan);
+                               }
++                              do_unref = 1;
+                       } else {
+                               /*
+                                * Copy data from beacon to neighbor table.
+@@ -3595,6 +3607,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                               ni->ni_rssi = rssi;
+                               ni->ni_rtsf = rtsf;
+                               ni->ni_last_rx = jiffies;
++                              if (do_unref)
++                                      ieee80211_unref_node(&ni);
+                       }
+               }
+               break;
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6589,9 +6589,8 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+       sc->sc_recv_mgmt(vap, ni_or_null, skb, subtype, rssi, rtsf);
+-
+       /* Lookup the new node if any (this grabs a reference to it) */
+-      ni = ieee80211_find_rxnode(vap->iv_ic,
++      ni = ieee80211_find_rxnode(vap->iv_ic, vap,
+                (const struct ieee80211_frame_min *)skb->data);
+       if (ni == NULL) {
+               DPRINTF(sc, ATH_DEBUG_BEACON, "Dropping; node unknown.\n");
+@@ -6746,7 +6745,9 @@ ath_rx_poll(struct net_device *dev, int 
+       struct ath_desc *ds;
+       struct ath_rx_status *rs;
+       struct sk_buff *skb = NULL;
++      struct ieee80211vap *vap;
+       struct ieee80211_node *ni;
++      const struct ieee80211_frame_min *wh;
+       unsigned int len;
+       int type;
+       u_int phyerr;
+@@ -6901,12 +6902,15 @@ rx_accept:
+               skb_trim(skb, skb->len - IEEE80211_CRC_LEN);
+               if (mic_fail) {
++                      wh = (const struct ieee80211_frame_min *) skb->data;
++
+                       /* Ignore control frames which are reported with mic error */
+-                  if ((((struct ieee80211_frame *)skb->data)->i_fc[0] &
++                  if ((wh->i_fc[0] &
+                                       IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
+                               goto drop_micfail;
+-                      ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
++                      vap = ieee80211_find_rxvap(ic, wh->i_addr1);
++                      ni = ieee80211_find_rxnode(ic, vap, wh);
+                       if (ni && ni->ni_table) {
+                               ieee80211_check_mic(ni, skb);
+@@ -6968,11 +6972,24 @@ drop_micfail:
+                * for its use.  If the sender is unknown spam the
+                * frame; it'll be dropped where it's not wanted.
+                */
+-              if (rs->rs_keyix != HAL_RXKEYIX_INVALID &&
++              wh = (const struct ieee80211_frame_min *) skb->data;
++              if ((rs->rs_keyix != HAL_RXKEYIX_INVALID) &&
+                   (ni = sc->sc_keyixmap[rs->rs_keyix]) != NULL) {
+                       /* Fast path: node is present in the key map;
+                        * grab a reference for processing the frame. */
+-                      ni = ieee80211_ref_node(ni);
++                      ieee80211_ref_node(ni);
++                      if ((ATH_GET_VAP_ID(wh->i_addr1) !=
++                           ATH_GET_VAP_ID(ni->ni_vap->iv_myaddr)) ||
++                              ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) ==
++                               IEEE80211_FC1_DIR_DSTODS)) {
++                              /* key cache node lookup is fast, but it can
++                               * lead to problems in multi-bss (foreign vap
++                               * node reference) or wds (wdsap node ref instead
++                               * of base ap node ref).
++                               * use slowpath lookup in both cases
++                               */
++                              goto lookup_slowpath;
++                      }
+                       ATH_RSSI_LPF(ATH_NODE(ni)->an_avgrssi, rs->rs_rssi);
+                       type = ieee80211_input(ni->ni_vap, ni, skb, rs->rs_rssi, bf->bf_tsf);
+                       ieee80211_unref_node(&ni);
+@@ -6981,24 +6998,39 @@ drop_micfail:
+                        * No key index or no entry, do a lookup and
+                        * add the node to the mapping table if possible.
+                        */
+-                      ni = ieee80211_find_rxnode(ic,
+-                              (const struct ieee80211_frame_min *)skb->data);
++
++lookup_slowpath:
++                      if (IEEE80211_IS_MULTICAST(wh->i_addr1))
++                              vap = NULL;
++                      else
++                              vap = ieee80211_find_rxvap(ic, wh->i_addr1);
++
++                      if (vap)
++                              ni = ieee80211_find_rxnode(ic, vap, wh);
++                      else
++                              ni = NULL;
++
+                       if (ni != NULL) {
+                               ieee80211_keyix_t keyix;
+                               ATH_RSSI_LPF(ATH_NODE(ni)->an_avgrssi, rs->rs_rssi);
+-                              type = ieee80211_input(ni->ni_vap, ni, skb, rs->rs_rssi, bf->bf_tsf);
++                              type = ieee80211_input(vap, ni, skb, rs->rs_rssi, bf->bf_tsf);
+                               /*
+                                * If the station has a key cache slot assigned
+                                * update the key->node mapping table.
+                                */
+                               keyix = ni->ni_ucastkey.wk_keyix;
+                               if (keyix != IEEE80211_KEYIX_NONE &&
+-                                  sc->sc_keyixmap[keyix] == NULL)
++                                  sc->sc_keyixmap[keyix] == NULL) {
+                                       sc->sc_keyixmap[keyix] = ieee80211_ref_node(ni);
++                              }
+                               ieee80211_unref_node(&ni);
+-                      } else
+-                              type = ieee80211_input_all(ic, skb, rs->rs_rssi, bf->bf_tsf);
++                      } else {
++                              if (vap)
++                                      type = ieee80211_input(vap, NULL, skb, rs->rs_rssi, bf->bf_tsf);
++                              else
++                                      type = ieee80211_input_all(ic, skb, rs->rs_rssi, bf->bf_tsf);
++                      }
+               }
+               if (sc->sc_diversity) {
+--- a/net80211/ieee80211_node.h
++++ b/net80211/ieee80211_node.h
+@@ -286,15 +286,18 @@ struct ieee80211_node *ieee80211_find_no
+       const u_int8_t *);
+ #endif /* #ifdef IEEE80211_DEBUG_REFCNT */
++struct ieee80211vap *
++ieee80211_find_rxvap(struct ieee80211com *ic, const u_int8_t *mac);
++
+ /* Returns a ieee80211_node* with refcount incremented, if found */
+ #ifdef IEEE80211_DEBUG_REFCNT
+-#define       ieee80211_find_rxnode(_nt, _wh) \
+-      ieee80211_find_rxnode_debug(_nt, _wh, __func__, __LINE__)
++#define       ieee80211_find_rxnode(_nt, _vap, _wh) \
++      ieee80211_find_rxnode_debug(_nt, _vap, _wh, __func__, __LINE__)
+ struct ieee80211_node *ieee80211_find_rxnode_debug(struct ieee80211com *,
+-      const struct ieee80211_frame_min *, const char *, int);
++      struct ieee80211vap *, const struct ieee80211_frame_min *, const char *, int);
+ #else
+ struct ieee80211_node *ieee80211_find_rxnode(struct ieee80211com *,
+-      const struct ieee80211_frame_min *);
++      struct ieee80211vap *, const struct ieee80211_frame_min *);
+ #endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+ /* Returns a ieee80211_node* with refcount incremented, if found */
diff --git a/net/madwifi/patches/394-probereq.patch b/net/madwifi/patches/394-probereq.patch
new file mode 100644 (file)
index 0000000..c754bfa
--- /dev/null
@@ -0,0 +1,64 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -3621,6 +3621,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       vap->iv_stats.is_rx_mgtdiscard++;
+                       return;
+               }
++              if (vap->iv_no_probereq)
++                      return;
+               if (IEEE80211_IS_MULTICAST(wh->i_addr2)) {
+                       /* frame must be directed */
+                       vap->iv_stats.is_rx_mgtdiscard++;       /* XXX: stat */
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -651,6 +651,7 @@ enum {
+       IEEE80211_PARAM_RSSI_DIS_COUNT  = 81,   /* counter for rssi threshold */
+       IEEE80211_PARAM_WDS_SEP                 = 82,   /* move wds stations into separate interfaces */
+       IEEE80211_PARAM_MAXASSOC                = 83,   /* maximum associated stations */
++      IEEE80211_PARAM_PROBEREQ                = 84,   /* enable handling of probe requests */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -198,6 +198,7 @@ struct ieee80211vap {
+       u_int32_t iv_debug;                             /* debug msg flags */
+       struct ieee80211_stats iv_stats;                /* statistics */
++      int iv_no_probereq;
+       int iv_max_nodes;
+       int iv_monitor_nods_only;                       /* in monitor mode only nods traffic */
+       int iv_monitor_txf_len;                         /* in monitor mode, truncate tx packets */
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2881,6 +2881,9 @@ ieee80211_ioctl_setparam(struct net_devi
+               else
+                       vap->iv_max_nodes = value;
+               break;
++      case IEEE80211_PARAM_PROBEREQ:
++              vap->iv_no_probereq = !value;
++              break;
+ #ifdef ATH_REVERSE_ENGINEERING
+       case IEEE80211_PARAM_DUMPREGS:
+               ieee80211_dump_registers(dev, info, w, extra);
+@@ -3243,6 +3246,9 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_MAXASSOC:
+               param[0] = vap->iv_max_nodes;
+               break;
++      case IEEE80211_PARAM_PROBEREQ:
++              param[0] = !vap->iv_no_probereq;
++              break;
+       default:
+               return -EOPNOTSUPP;
+       }
+@@ -5802,6 +5808,10 @@ static const struct iw_priv_args ieee802
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxassoc"},
+       { IEEE80211_PARAM_MAXASSOC,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxassoc"},
++      { IEEE80211_PARAM_PROBEREQ,
++       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "probereq"},
++      { IEEE80211_PARAM_PROBEREQ,
++       0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_probereq"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
diff --git a/net/madwifi/patches/395-ath_ff_unmap.patch b/net/madwifi/patches/395-ath_ff_unmap.patch
new file mode 100644 (file)
index 0000000..85ddc7b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -13534,7 +13534,7 @@ cleanup_ath_buf(struct ath_softc *sc, st
+                               bus_unmap_single(
+                                       sc->sc_bdev,
+                                       bf->bf_skbaddrff[i], 
+-                                      (direction == BUS_DMA_TODEVICE ? 
++                                      (direction == BUS_DMA_FROMDEVICE ? 
+                                        sc->sc_rxbufsize : ffskb->len), 
+                                       direction);
+                               bf->bf_skbaddrff[i] = 0;
diff --git a/net/madwifi/patches/396-napi_ff_fix.patch b/net/madwifi/patches/396-napi_ff_fix.patch
new file mode 100644 (file)
index 0000000..f84c4b4
--- /dev/null
@@ -0,0 +1,65 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6734,10 +6734,10 @@ ath_rx_poll(struct net_device *dev, int 
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+       struct ath_softc *sc = container_of(napi, struct ath_softc, sc_napi);
+       struct net_device *dev = sc->sc_dev;
+-      u_int rx_limit = budget;
++      int rx_limit = budget;
+ #else
+       struct ath_softc *sc = dev->priv;
+-      u_int rx_limit = min(dev->quota, *budget);
++      int rx_limit = min(dev->quota, *budget);
+ #endif
+       struct ath_buf *bf;
+       struct ieee80211com *ic = &sc->sc_ic;
+@@ -6780,13 +6780,15 @@ process_rx_again:
+                       break;
+               }
+-              if (rx_limit-- < 2) {
++              processed += ic->ic_recv;
++              rx_limit -= ic->ic_recv;
++              ic->ic_recv = 0;
++
++              /* keep a reserve for napi */
++              if (rx_limit < 4) {
+                       early_stop = 1;
+                       break;
+               }
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+-              processed++;
+-#endif
+               skb = bf->bf_skb;
+               if (skb == NULL) {
+@@ -7074,8 +7076,8 @@ rx_next:
+               if (sc->sc_isr & HAL_INT_RX) {
+                       u_int64_t hw_tsf = ath_hal_gettsf64(ah);
+                       sc->sc_isr &= ~HAL_INT_RX;
+-                      local_irq_restore(flags);
+                       ath_uapsd_processtriggers(sc, hw_tsf);
++                      local_irq_restore(flags);
+                       goto process_rx_again;
+               }
+               local_irq_restore(flags);
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1206,6 +1206,7 @@ ieee80211_deliver_data(struct ieee80211_
+               }
+       }
++      vap->iv_ic->ic_recv++;
+       if (skb != NULL) {
+               skb->dev = dev;
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -323,6 +323,7 @@ struct ieee80211com {
+       struct ifmedia ic_media;                /* interface media config */
+       u_int8_t ic_myaddr[IEEE80211_ADDR_LEN];
+       struct timer_list ic_inact;             /* mgmt/inactivity timer */
++      u_int ic_recv;                                  /* frame received counter */
+       unsigned int ic_subifs;
+       u_int32_t ic_flags;                     /* state flags */
diff --git a/net/madwifi/patches/400-new_hal.patch b/net/madwifi/patches/400-new_hal.patch
new file mode 100644 (file)
index 0000000..621bd0f
--- /dev/null
@@ -0,0 +1,153 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -606,6 +606,14 @@ ath_attach(u_int16_t devid, struct net_d
+       }
+       sc->sc_ah = ah;
++      /* WAR for AR7100 PCI bug */
++#if defined(CONFIG_ATHEROS_AR71XX) || defined(CONFIG_ATH79)
++      if ((ar_device(sc->devid) >= 5210) && (ar_device(sc->devid) < 5416)) {
++              ath_hal_setcapability(ah, HAL_CAP_DMABURST_RX, 0, HAL_DMABURST_4B, NULL);
++              ath_hal_setcapability(ah, HAL_CAP_DMABURST_TX, 0, HAL_DMABURST_4B, NULL);
++      }
++#endif
++
+       /*
+        * Check if the MAC has multi-rate retry support.
+        * We do this by trying to setup a fake extended
+@@ -7568,7 +7576,7 @@ ath_txq_setup(struct ath_softc *sc, int 
+       if (qtype == HAL_TX_QUEUE_UAPSD)
+               qi.tqi_qflags = HAL_TXQ_TXDESCINT_ENABLE;
+       else
+-              qi.tqi_qflags = HAL_TXQ_TXEOLINT_ENABLE | 
++              qi.tqi_qflags = HAL_TXQ_TXEOLINT_ENABLE | HAL_TXQ_TXOKINT_ENABLE |
+                       HAL_TXQ_TXDESCINT_ENABLE;
+       qnum = ath_hal_setuptxqueue(ah, qtype, &qi);
+       if (qnum == -1) {
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
+@@ -126,6 +126,13 @@ ath_hal_printf(struct ath_hal *ah, const
+ }
+ EXPORT_SYMBOL(ath_hal_printf);
++void __ahdecl
++ath_hal_printstr(struct ath_hal *ah, const char *str)
++{
++      printk("%s", str);
++}
++EXPORT_SYMBOL(ath_hal_printstr);
++
+ /*
+  * Format an Ethernet MAC for printing.
+  */
+--- a/ath_hal/ah_os.h
++++ b/ath_hal/ah_os.h
+@@ -156,69 +156,23 @@ extern u_int32_t __ahdecl ath_hal_getupt
+ #endif
+ #endif                                /* AH_BYTE_ORDER */
+-/*
+- * Some big-endian architectures don't set CONFIG_GENERIC_IOMAP, but fail to
+- * implement iowrite32be and ioread32be.  Provide compatibility macros when
+- * it's needed.
+- *
+- * As of Linux 2.6.24, only MIPS, PARISC and PowerPC implement iowrite32be and
+- * ioread32be as functions.
+- *
+- * The downside or the replacement macros it that we may be byte-swapping data
+- * for the second time, so the native implementations should be preferred.
+- */
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) && \
+-      !defined(CONFIG_GENERIC_IOMAP) && (AH_BYTE_ORDER == AH_BIG_ENDIAN) && \
+-      !defined(__mips__) && !defined(__hppa__) && !defined(__powerpc__)
+-# ifndef iowrite32be
+-#  define iowrite32be(_val, _addr) iowrite32(swab32((_val)), (_addr))
+-# endif
+-# ifndef ioread32be
+-#  define ioread32be(_addr) swab32(ioread32((_addr)))
+-# endif
+-#endif
++#define IS_SWAPPED(_ah, _reg) \
++      ((_ah)->ah_swapped && \
++              (((0x4000 <= (_reg)) && ((_reg) < 0x5000)) || \
++               ((0x7000 <= (_reg)) && ((_reg) < 0x8000))))
++
++#define SWAPREG(_ah, _reg, _val) \
++      (IS_SWAPPED(_ah, _reg) ? cpu_to_le32(_val) : (_val))
+ /*
+  * The register accesses are done using target-specific functions when
+  * debugging is enabled (AH_DEBUG) or it's explicitly requested for the target.
+- *
+- * The hardware registers use little-endian byte order natively.  Big-endian
+- * systems are configured by HAL to enable hardware byte-swap of register reads
+- * and writes at reset.  This avoid the need to byte-swap the data in software.
+- * However, the registers in a certain area from 0x4000 to 0x4fff (PCI clock
+- * domain registers) are not byte swapped!
+- *
+- * Since Linux I/O primitives default to little-endian operations, we only
+- * need to suppress byte-swapping on big-endian systems outside the area used
+- * by the PCI clock domain registers.
+  */
+-#if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
+-#define is_reg_le(__reg) ((0x4000 <= (__reg) && (__reg) < 0x5000))
+-#else
+-#define is_reg_le(__reg) 1
+-#endif
+-
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+-#define _OS_REG_WRITE(_ah, _reg, _val) do {                   \
+-       is_reg_le(_reg) ?                                      \
+-       iowrite32((_val), (_ah)->ah_sh + (_reg)) :             \
+-       iowrite32be((_val), (_ah)->ah_sh + (_reg));            \
+-      } while (0)
+-#define _OS_REG_READ(_ah, _reg)                                       \
+-      (is_reg_le(_reg) ?                                      \
+-       ioread32((_ah)->ah_sh + (_reg)) :                      \
+-       ioread32be((_ah)->ah_sh + (_reg)))
+-#else
+ #define _OS_REG_WRITE(_ah, _reg, _val) do {                   \
+-       writel(is_reg_le(_reg) ?                               \
+-              (_val) : cpu_to_le32(_val),                     \
+-              (_ah)->ah_sh + (_reg));                         \
+-      } while (0)
++       __raw_writel(SWAPREG(_ah, _reg, _val), (_ah)->ah_sh + (_reg));         \
++} while (0)
+ #define _OS_REG_READ(_ah, _reg)                                       \
+-      (is_reg_le(_reg) ?                                      \
+-       readl((_ah)->ah_sh + (_reg)) :                         \
+-       cpu_to_le32(readl((_ah)->ah_sh + (_reg))))
+-#endif                                /* KERNEL_VERSION(2,6,12) */
++       SWAPREG(_ah, _reg, __raw_readl((_ah)->ah_sh + (_reg)))
+ /*
+  * The functions in this section are not intended to be invoked by MadWifi
+--- a/ath/if_ath_hal.h
++++ b/ath/if_ath_hal.h
+@@ -778,17 +778,6 @@ static inline HAL_STATUS ath_hal_getcapa
+       return ret;
+ }
+-static inline HAL_BOOL ath_hal_radar_wait(struct ath_hal *ah, HAL_CHANNEL *a1)
+-{
+-      HAL_BOOL ret;
+-      ATH_HAL_LOCK_IRQ(ah->ah_sc);
+-      ath_hal_set_function(__func__);
+-      ret = ah->ah_radarWait(ah, a1);
+-      ath_hal_set_function(NULL);
+-      ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
+-      return ret;
+-}
+-
+ static inline HAL_BOOL ath_hal_setmcastfilterindex(struct ath_hal *ah,
+                                                  u_int32_t index)
+ {
+@@ -1268,8 +1257,6 @@ static inline void ath_hal_dump_map(stru
+       /* HAL_STATUS ah_getCapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE a1, u_int32_t capability, u_int32_t *result) */
+       __print_symbol("%s=ah_getCapability\n",
+                      (unsigned long)ah->ah_getCapability);
+-      /* HAL_BOOL ah_radarWait(struct ath_hal *ah, HAL_CHANNEL *a1) */
+-      __print_symbol("%s=ah_radarWait\n", (unsigned long)ah->ah_radarWait);
+       /* HAL_BOOL ah_setMulticastFilterIndex(struct ath_hal *ah, u_int32_t index) */
+       __print_symbol("%s=ah_setMulticastFilterIndex\n",
+                      (unsigned long)ah->ah_setMulticastFilterIndex);
diff --git a/net/madwifi/patches/401-changeset_r3602.patch b/net/madwifi/patches/401-changeset_r3602.patch
new file mode 100644 (file)
index 0000000..cf9c879
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -348,6 +348,8 @@ typedef spinlock_t acl_lock_t;
+ /* __skb_append got a third parameter in 2.6.14 */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+ #define __skb_append(a,b,c)   __skb_append(a, b)
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
++#define __skb_append(a,b,c)   __skb_queue_after(c, a, b)
+ #endif
+ /*
diff --git a/net/madwifi/patches/402-changeset_r3603.patch b/net/madwifi/patches/402-changeset_r3603.patch
new file mode 100644 (file)
index 0000000..92f6e6e
--- /dev/null
@@ -0,0 +1,176 @@
+--- a/Makefile
++++ b/Makefile
+@@ -40,10 +40,7 @@
+ # Makefile for the HAL-based Atheros driver.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)
+ ifneq (svnversion.h,$(MAKECMDGOALS))
+--- a/ath/Makefile
++++ b/ath/Makefile
+@@ -40,10 +40,7 @@
+ # Makefile for the Atheros WLAN driver.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ ifeq ($(strip $(BUS)),AHB)
+--- a/ath_hal/Makefile
++++ b/ath_hal/Makefile
+@@ -40,10 +40,7 @@
+ # Makefile for the Atheros WLAN driver.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ include $(TOP)/Makefile.inc
+--- a/ath_rate/Makefile
++++ b/ath_rate/Makefile
+@@ -1,7 +1,4 @@
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ obj-y := amrr/ onoe/ sample/ minstrel/
+--- a/ath_rate/amrr/Makefile
++++ b/ath_rate/amrr/Makefile
+@@ -40,10 +40,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m         += ath_rate_amrr.o
+--- a/ath_rate/minstrel/Makefile
++++ b/ath_rate/minstrel/Makefile
+@@ -38,10 +38,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m         += ath_rate_minstrel.o
+--- a/ath_rate/onoe/Makefile
++++ b/ath_rate/onoe/Makefile
+@@ -40,10 +40,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m         += ath_rate_onoe.o
+--- a/ath_rate/sample/Makefile
++++ b/ath_rate/sample/Makefile
+@@ -38,10 +38,7 @@
+ #
+ # Makefile for the Atheros Rate Control Support.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m         += ath_rate_sample.o
+--- a/net80211/Makefile
++++ b/net80211/Makefile
+@@ -39,10 +39,7 @@
+ #
+ # Makefile for the 802.11 WLAN modules.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ #
+ # There is one authenticator mechanism: an in-kernel implementation
+--- a/regression/Makefile
++++ b/regression/Makefile
+@@ -1,7 +1,4 @@
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+ obj-y := ccmp/ tkip/ wep/
+--- a/regression/ccmp/Makefile
++++ b/regression/ccmp/Makefile
+@@ -1,10 +1,7 @@
+ #
+ # Makefile for the CCMP regression test.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m                 += ath_test_ccmp.o
+--- a/regression/tkip/Makefile
++++ b/regression/tkip/Makefile
+@@ -1,10 +1,7 @@
+ #
+ # Makefile for the TKIP regression test.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m                 += ath_test_tkip.o
+--- a/regression/wep/Makefile
++++ b/regression/wep/Makefile
+@@ -1,10 +1,7 @@
+ #
+ # Makefile for the WEP regression test.
+ #
+-ifeq ($(obj),)
+-obj=  .
+-endif
+-
++obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/../..
+ obj-m                 += ath_test_wep.o
diff --git a/net/madwifi/patches/403-changeset_r3605.patch b/net/madwifi/patches/403-changeset_r3605.patch
new file mode 100644 (file)
index 0000000..57ce521
--- /dev/null
@@ -0,0 +1,70 @@
+--- a/include/compat.h
++++ b/include/compat.h
+@@ -182,6 +182,13 @@ static inline int timeval_compare(struct
+ #define DEV_ATH CTL_UNNUMBERED
+ #endif
++/* __skb_append got a third parameter in 2.6.14 */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
++#define __skb_queue_after(_list, _old, _new)  __skb_append(_old, _new)
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
++#define __skb_queue_after(_list, _old, _new)  __skb_append(_old, _new, _list)
++#endif
++
+ #endif /* __KERNEL__ */
+ #endif /* _ATH_COMPAT_H_ */
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -345,13 +345,6 @@ typedef spinlock_t acl_lock_t;
+ #define       ACL_LOCK_CHECK(_as)
+ #endif
+-/* __skb_append got a third parameter in 2.6.14 */
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+-#define __skb_append(a,b,c)   __skb_append(a, b)
+-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
+-#define __skb_append(a,b,c)   __skb_queue_after(c, a, b)
+-#endif
+-
+ /*
+  * Per-node power-save queue definitions.  Beware of control
+  * flow with IEEE80211_NODE_SAVEQ_LOCK/IEEE80211_NODE_SAVEQ_UNLOCK.
+@@ -395,16 +388,16 @@ typedef spinlock_t acl_lock_t;
+       _skb = __skb_dequeue(&(_ni)->ni_savedq);                \
+       (_qlen) = skb_queue_len(&(_ni)->ni_savedq);             \
+ } while (0)
+-#define       _IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _skb, _qlen, _age) do {\
+-      struct sk_buff *tail = skb_peek_tail(&(_ni)->ni_savedq);\
+-      if (tail != NULL) {                                     \
+-              _age -= M_AGE_GET(tail);                        \
+-              __skb_append(tail, _skb, &(_ni)->ni_savedq);    \
+-      } else {                                                \
+-              __skb_queue_head(&(_ni)->ni_savedq, _skb);      \
+-      }                                                       \
+-      M_AGE_SET(_skb, _age);                                  \
+-      (_qlen) = skb_queue_len(&(_ni)->ni_savedq);             \
++#define       _IEEE80211_NODE_SAVEQ_ENQUEUE(_ni, _skb, _qlen, _age) do {      \
++      struct sk_buff *tail = skb_peek_tail(&(_ni)->ni_savedq);        \
++      if (tail != NULL) {                                             \
++              _age -= M_AGE_GET(tail);                                \
++              __skb_queue_after(&(_ni)->ni_savedq, tail, _skb);       \
++      } else {                                                        \
++              __skb_queue_head(&(_ni)->ni_savedq, _skb);              \
++      }                                                               \
++      M_AGE_SET(_skb, _age);                                          \
++      (_qlen) = skb_queue_len(&(_ni)->ni_savedq);                     \
+ } while (0)
+ /*
+--- a/net80211/ieee80211_power.c
++++ b/net80211/ieee80211_power.c
+@@ -243,7 +243,7 @@ ieee80211_pwrsave(struct sk_buff *skb)
+       tail = skb_peek_tail(&ni->ni_savedq);
+       if (tail != NULL) {
+               age -= M_AGE_GET(tail);
+-              __skb_append(tail, skb, &ni->ni_savedq);
++              __skb_queue_after(&ni->ni_savedq, tail, skb);
+       } else
+               __skb_queue_head(&ni->ni_savedq, skb);
+       M_AGE_SET(skb, age);
diff --git a/net/madwifi/patches/404-linux24_fix.patch b/net/madwifi/patches/404-linux24_fix.patch
new file mode 100644 (file)
index 0000000..4ea20b3
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/ath_hal/Makefile
++++ b/ath_hal/Makefile
+@@ -78,10 +78,11 @@ endif
+ quiet_cmd_uudecode = UUDECODE $@
+       cmd_uudecode = $(obj)/uudecode -o $@ $<
+-$(obj)/$(TARGET).hal.o: $(HAL)/public/$(TARGET).hal.o.uu $(obj)/uudecode
+ ifdef LINUX24
++$(TARGET).hal.o: $(HAL)/public/$(TARGET).hal.o.uu $(obj)/uudecode
+       $(Q)$(obj)/uudecode -o $@ $<
+ else
++$(obj)/$(TARGET).hal.o: $(HAL)/public/$(TARGET).hal.o.uu $(obj)/uudecode
+       $(call if_changed,uudecode)
+ endif
diff --git a/net/madwifi/patches/405-retransmit_check.patch b/net/madwifi/patches/405-retransmit_check.patch
new file mode 100644 (file)
index 0000000..11e78ab
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/net80211/ieee80211.h
++++ b/net80211/ieee80211.h
+@@ -174,8 +174,6 @@ struct ieee80211_ctlframe_addr2 {
+ #define       IEEE80211_SEQ_SEQ_MASK                  0xfff0
+ #define       IEEE80211_SEQ_SEQ_SHIFT                 4
+-#define       IEEE80211_SEQ_LEQ(a,b)  ((int)((a)-(b)) <= 0)
+-
+ #define       IEEE80211_NWID_LEN                      32
+ #define       IEEE80211_QOS_TXOP                      0x00ff
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -428,7 +428,7 @@ ieee80211_input(struct ieee80211vap * va
+                               tid = 0;
+                       rxseq = le16toh(*(__le16 *)wh->i_seq);
+                       if ((wh->i_fc[1] & IEEE80211_FC1_RETRY) &&
+-                          IEEE80211_SEQ_LEQ(rxseq, ni->ni_rxseqs[tid])) {
++                          (rxseq == ni->ni_rxseqs[tid])) {
+                               /* duplicate, discard */
+                               IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
+                                       bssid, "duplicate",
diff --git a/net/madwifi/patches/406-monitor_r3711.patch b/net/madwifi/patches/406-monitor_r3711.patch
new file mode 100644 (file)
index 0000000..4e2c6ae
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6530,7 +6530,7 @@ ath_capture(struct net_device *dev, cons
+       /* Never copy the SKB, as it is ours on the RX side, and this is the 
+        * last process on the TX side and we only modify our own headers. */
+-      tskb = ath_skb_removepad(skb, 0 /* Copy SKB */);
++      tskb = ath_skb_removepad(skb, !tx /* Copy SKB */);
+       if (tskb == NULL) {
+               DPRINTF(sc, ATH_DEBUG_ANY,
+                       "Dropping; ath_skb_removepad failed!\n");
+@@ -6538,6 +6538,8 @@ ath_capture(struct net_device *dev, cons
+       }
+       
+       ieee80211_input_monitor(ic, tskb, bf, tx, tsf, sc);
++      if (tskb != skb)
++              ieee80211_dev_kfree_skb(&tskb);
+ }
+ /*
diff --git a/net/madwifi/patches/407-new_athinfo.patch b/net/madwifi/patches/407-new_athinfo.patch
new file mode 100644 (file)
index 0000000..6c512ad
--- /dev/null
@@ -0,0 +1,2352 @@
+--- a/tools/ath_info.c
++++ b/tools/ath_info.c
+@@ -16,78 +16,8 @@
+  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+-/* So here is how it works:
+- *
+- * First compile...
+- *
+- * gcc ath_info.c -o ath_info
+- *
+- * then find card's physical address
+- *
+- * lspci -v
+- *
+- * 02:02.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
+- *         Subsystem: Fujitsu Limited. Unknown device 1234
+- *         Flags: bus master, medium devsel, latency 168, IRQ 23
+- *         Memory at c2000000 (32-bit, non-prefetchable) [size=64K]
+- *         Capabilities: [44] Power Management version 2
+- *
+- * address here is 0xc2000000
+- *
+- * load madwifi-ng or madwifi-old if not already loaded (be sure the
+- * interface is down!)
+- *
+- * modprobe ath_pci
+- *
+- * OR
+- *
+- * call:
+- * setpci -s 02:02.0 command=0x41f cache_line_size=0x10
+- *
+- * to enable access to the PCI device.
+- *
+- * and we run the thing...
+- *
+- * ./ath_info 0xc2000000
+- *
+- * In order to change the regdomain to 0, call:
+- *
+- * ./ath_info -w 0xc2000000 regdomain 0
+- *
+- * to change any PCI ID value, say:
+- *
+- * ./ath_info -w 0xc2000000 <name> X
+- *
+- * with <name> ::= pci_dev_id | pci_vendor_id | pci_class |
+- *                 pci_subsys_dev_id | pci_subsys_vendor_id
+- *
+- * With newer chipsets (>= AR5004x, i.e. MAC >= AR5213), Atheros introduced
+- * write protection on the EEPROM. On a GIGABYTE GN-WI01HT you can set GPIO 4
+- * to low to be able to write the EEPROM. This depends highly on the PCB layout,
+- * so there may be different GPIO used.
+- * This program currently sets GPIO 4 to low for a MAC >= AR5213, but you can
+- * override this with the -g option:
+- *
+- * ./ath_info -g 5:0 -w 0xc2000000 regdomain X
+- *
+- * would set GPIO 5 to low (and wouldn't touch GPIO 4). -g can be given several times.
+- *
+- * The write function is currently not tested with 5210 devices.
+- *
+- * Use at your own risk, entering a false device address will have really
+- * nasty results!
+- *
+- * Writing wrong values to the PCI id fields may prevent the driver from
+- * detecting the card!
+- *
+- * Transmitting on illegal frequencies may violate state laws. Stick to the local
+- * regulations!
+- *
+- * DISCLAIMER:
+- * The authors are in no case responsible for damaged hardware or violation of
+- * local laws by operating modified hardware.
+- *
+- */
++/* Try accepting 64-bit device address even with 32-bit userspace */
++#define _FILE_OFFSET_BITS 64
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -130,109 +60,103 @@ fprintf(stderr, "#ERR %s: " fmt "\n", __
+  */
+ #define AR5K_GPIODI   0x401c
+-/*
+- * Common silicon revision/version values
+- */
+-enum ath5k_srev_type {
+-      AR5K_VERSION_VER,
+-      AR5K_VERSION_REV,
+-      AR5K_VERSION_RAD,
+-};
+-
+ struct ath5k_srev_name {
+       const char *sr_name;
+-      enum ath5k_srev_type sr_type;
+-      u_int sr_val;
++      u_int8_t sr_val;
+ };
+-#define AR5K_SREV_UNKNOWN     0xffff
+-
+ /* Known MAC revision numbers */
+-#define AR5K_SREV_VER_AR5210  0x00
+-#define AR5K_SREV_VER_AR5311  0x10
+-#define AR5K_SREV_VER_AR5311A 0x20
+-#define AR5K_SREV_VER_AR5311B 0x30
+-#define AR5K_SREV_VER_AR5211  0x40
+-#define AR5K_SREV_VER_AR5212  0x50
+-#define AR5K_SREV_VER_AR5213  0x55
+-#define AR5K_SREV_VER_AR5213A 0x59
+-#define       AR5K_SREV_VER_AR2424    0xa0
+-#define       AR5K_SREV_VER_AR5424    0xa3
+-#define       AR5K_SREV_VER_AR5413    0xa4
+-#define AR5K_SREV_VER_AR5414  0xa5
+-#define       AR5K_SREV_VER_AR5416    0xc0
+-#define       AR5K_SREV_VER_AR5418    0xca
+-#define       AR5K_SREV_VER_AR2425    0xe0
+-
+-/* Known PHY revision nymbers */
+-#define AR5K_SREV_RAD_5110    0x00
+-#define AR5K_SREV_RAD_5111    0x10
+-#define AR5K_SREV_RAD_5111A   0x15
+-#define AR5K_SREV_RAD_2111    0x20
+-#define AR5K_SREV_RAD_5112    0x30
+-#define AR5K_SREV_RAD_5112A   0x35
+-#define AR5K_SREV_RAD_2112    0x40
+-#define AR5K_SREV_RAD_2112A   0x45
+-#define AR5K_SREV_RAD_SC1     0x63    /* Found on 5413/5414 */
+-#define       AR5K_SREV_RAD_SC2       0xa2    /* Found on 2424/5424 */
+-#define       AR5K_SREV_RAD_5133      0xc0    /* MIMO found on 5418 */
+-
+-static const struct ath5k_srev_name ath5k_srev_names[] = {
+-      {"5210", AR5K_VERSION_VER, AR5K_SREV_VER_AR5210},
+-      {"5311", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311},
+-      {"5311A", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311A},
+-      {"5311B", AR5K_VERSION_VER, AR5K_SREV_VER_AR5311B},
+-      {"5211", AR5K_VERSION_VER, AR5K_SREV_VER_AR5211},
+-      {"5212", AR5K_VERSION_VER, AR5K_SREV_VER_AR5212},
+-      {"5213", AR5K_VERSION_VER, AR5K_SREV_VER_AR5213},
+-      {"5213A", AR5K_VERSION_VER, AR5K_SREV_VER_AR5213A},
+-      {"2424", AR5K_VERSION_VER, AR5K_SREV_VER_AR2424},
+-      {"5424", AR5K_VERSION_VER, AR5K_SREV_VER_AR5424},
+-      {"5413", AR5K_VERSION_VER, AR5K_SREV_VER_AR5413},
+-      {"5414", AR5K_VERSION_VER, AR5K_SREV_VER_AR5414},
+-      {"5416", AR5K_VERSION_VER, AR5K_SREV_VER_AR5416},
+-      {"5418", AR5K_VERSION_VER, AR5K_SREV_VER_AR5418},
+-      {"2425", AR5K_VERSION_VER, AR5K_SREV_VER_AR2425},
+-      {"xxxxx", AR5K_VERSION_VER, AR5K_SREV_UNKNOWN},
+-      {"5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110},
+-      {"5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111},
+-      {"2111", AR5K_VERSION_RAD, AR5K_SREV_RAD_2111},
+-      {"5112", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112},
+-      {"5112a", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112A},
+-      {"2112", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112},
+-      {"2112a", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112A},
+-      {"SChip", AR5K_VERSION_RAD, AR5K_SREV_RAD_SC1},
+-      {"SChip", AR5K_VERSION_RAD, AR5K_SREV_RAD_SC2},
+-      {"5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133},
+-      {"xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN},
++#define AR5K_SREV_MAC_AR5210  0x00
++#define AR5K_SREV_MAC_AR5311  0x10
++#define AR5K_SREV_MAC_AR5311A 0x20
++#define AR5K_SREV_MAC_AR5311B 0x30
++#define AR5K_SREV_MAC_AR5211  0x40
++#define AR5K_SREV_MAC_AR5212  0x50
++#define AR5K_SREV_MAC_AR5213  0x55
++#define AR5K_SREV_MAC_AR5213A 0x59
++#define AR5K_SREV_MAC_AR5513  0x61
++#define AR5K_SREV_MAC_AR2413  0x78
++#define AR5K_SREV_MAC_AR2414  0x79
++#define AR5K_SREV_MAC_AR2424  0xa0
++#define AR5K_SREV_MAC_AR5424  0xa3
++#define AR5K_SREV_MAC_AR5413  0xa4
++#define AR5K_SREV_MAC_AR5414  0xa5
++#define AR5K_SREV_MAC_AR5416  0xc0
++#define AR5K_SREV_MAC_AR5418  0xca
++#define AR5K_SREV_MAC_AR2425  0xe2
++
++/* Known PHY revision numbers */
++#define AR5K_SREV_PHY_5110    0x00
++#define AR5K_SREV_PHY_5111    0x10
++#define AR5K_SREV_PHY_5111A   0x15
++#define AR5K_SREV_PHY_2111    0x20
++#define AR5K_SREV_PHY_5112    0x30
++#define AR5K_SREV_PHY_5112A   0x35
++#define AR5K_SREV_PHY_2112    0x40
++#define AR5K_SREV_PHY_2112A   0x45
++#define AR5K_SREV_PHY_SC0     0x56    /* Found on 2413/2414 */
++#define AR5K_SREV_PHY_SC1     0x63    /* Found on 5413/5414 */
++#define AR5K_SREV_PHY_SC2     0xa2    /* Found on 2424/5424 */
++#define AR5K_SREV_PHY_5133    0xc0    /* MIMO found on 5418 */
++
++static const struct ath5k_srev_name ath5k_mac_names[] = {
++      {"5210", AR5K_SREV_MAC_AR5210},
++      {"5311", AR5K_SREV_MAC_AR5311},
++      {"5311A", AR5K_SREV_MAC_AR5311A},
++      {"5311B", AR5K_SREV_MAC_AR5311B},
++      {"5211", AR5K_SREV_MAC_AR5211},
++      {"5212", AR5K_SREV_MAC_AR5212},
++      {"5213", AR5K_SREV_MAC_AR5213},
++      {"5213A", AR5K_SREV_MAC_AR5213A},
++      {"2413", AR5K_SREV_MAC_AR2413},
++      {"2414", AR5K_SREV_MAC_AR2414},
++      {"2424", AR5K_SREV_MAC_AR2424},
++      {"5424", AR5K_SREV_MAC_AR5424},
++      {"5413", AR5K_SREV_MAC_AR5413},
++      {"5414", AR5K_SREV_MAC_AR5414},
++      {"5416", AR5K_SREV_MAC_AR5416},
++      {"5418", AR5K_SREV_MAC_AR5418},
++      {"2425", AR5K_SREV_MAC_AR2425},
++};
++
++static const struct ath5k_srev_name ath5k_phy_names[] = {
++      {"5110", AR5K_SREV_PHY_5110},
++      {"5111", AR5K_SREV_PHY_5111},
++      {"2111", AR5K_SREV_PHY_2111},
++      {"5112", AR5K_SREV_PHY_5112},
++      {"5112A", AR5K_SREV_PHY_5112A},
++      {"2112", AR5K_SREV_PHY_2112},
++      {"2112A", AR5K_SREV_PHY_2112A},
++      {"SChip", AR5K_SREV_PHY_SC0},
++      {"SChip", AR5K_SREV_PHY_SC1},
++      {"SChip", AR5K_SREV_PHY_SC2},
++      {"5133", AR5K_SREV_PHY_5133},
+ };
+ /*
+  * Silicon revision register
+  */
+ #define AR5K_SREV             0x4020  /* Register Address */
+-#define AR5K_SREV_REV         0x0000000f      /* Mask for revision */
+-#define AR5K_SREV_REV_S               0
+-#define AR5K_SREV_VER         0x000000ff      /* Mask for version */
+-#define AR5K_SREV_VER_S               4
++#define AR5K_SREV_VER         0x000000f0      /* Mask for version */
++#define AR5K_SREV_REV         0x000000ff      /* Mask for revision */
+ /*
+  * PHY chip revision register
+  */
+-#define       AR5K_PHY_CHIP_ID                0x9818
++#define AR5K_PHY_CHIP_ID              0x9818
+ /*
+  * PHY register
+  */
+-#define       AR5K_PHY_BASE                   0x9800
+-#define       AR5K_PHY(_n)                    (AR5K_PHY_BASE + ((_n) << 2))
++#define AR5K_PHY_BASE                 0x9800
++#define AR5K_PHY(_n)                  (AR5K_PHY_BASE + ((_n) << 2))
+ #define AR5K_PHY_SHIFT_2GHZ           0x00004007
+ #define AR5K_PHY_SHIFT_5GHZ           0x00000007
+ #define AR5K_RESET_CTL                0x4000  /* Register Address */
+ #define AR5K_RESET_CTL_PCU    0x00000001      /* Protocol Control Unit reset */
+ #define AR5K_RESET_CTL_DMA    0x00000002      /* DMA (Rx/Tx) reset -5210 only */
+-#define       AR5K_RESET_CTL_BASEBAND 0x00000002      /* Baseband reset (5211/5212) */
++#define AR5K_RESET_CTL_BASEBAND       0x00000002      /* Baseband reset (5211/5212) */
+ #define AR5K_RESET_CTL_MAC    0x00000004      /* MAC reset (PCU+Baseband?) -5210 only */
+ #define AR5K_RESET_CTL_PHY    0x00000008      /* PHY reset -5210 only */
+ #define AR5K_RESET_CTL_PCI    0x00000010      /* PCI Core reset (interrupts etc) */
+@@ -253,7 +177,7 @@ static const struct ath5k_srev_name ath5
+ #define AR5K_SLEEP_CTL_SLE_UNITS      0x00000008      /* not on 5210 */
+ #define AR5K_PCICFG                   0x4010  /* Register Address */
+-#define AR5K_PCICFG_EEAE              0x00000001      /* Eeprom access enable [5210] */
++#define AR5K_PCICFG_EEAE              0x00000001      /* EEPROM access enable [5210] */
+ #define AR5K_PCICFG_CLKRUNEN          0x00000004      /* CLKRUN enable [5211+] */
+ #define AR5K_PCICFG_EESIZE            0x00000018      /* Mask for EEPROM size [5211+] */
+ #define AR5K_PCICFG_EESIZE_S          3
+@@ -264,26 +188,118 @@ static const struct ath5k_srev_name ath5
+ #define AR5K_PCICFG_SPWR_DN           0x00010000      /* Mask for power status (5210) */
+-#define AR5K_EEPROM_BASE              0x6000
++#define AR5K_EEPROM_BASE      0x6000
+-#define AR5K_EEPROM_MAGIC             0x003d  /* Offset for EEPROM Magic number */
++/*
++ * Common AR5xxx EEPROM data offsets (set these on AR5K_EEPROM_BASE)
++ */
++#define AR5K_EEPROM_MAGIC             0x003d  /* EEPROM Magic number */
+ #define AR5K_EEPROM_MAGIC_VALUE               0x5aa5  /* Default - found on EEPROM */
+ #define AR5K_EEPROM_MAGIC_5212                0x0000145c      /* 5212 */
+ #define AR5K_EEPROM_MAGIC_5211                0x0000145b      /* 5211 */
+ #define AR5K_EEPROM_MAGIC_5210                0x0000145a      /* 5210 */
++#define AR5K_EEPROM_PROTECT           0x003f  /* EEPROM protect status */
++#define AR5K_EEPROM_PROTECT_RD_0_31   0x0001  /* Read protection bit for offsets 0x0 - 0x1f */
++#define AR5K_EEPROM_PROTECT_WR_0_31   0x0002  /* Write protection bit for offsets 0x0 - 0x1f */
++#define AR5K_EEPROM_PROTECT_RD_32_63  0x0004  /* 0x20 - 0x3f */
++#define AR5K_EEPROM_PROTECT_WR_32_63  0x0008
++#define AR5K_EEPROM_PROTECT_RD_64_127 0x0010  /* 0x40 - 0x7f */
++#define AR5K_EEPROM_PROTECT_WR_64_127 0x0020
++#define AR5K_EEPROM_PROTECT_RD_128_191        0x0040  /* 0x80 - 0xbf (regdom) */
++#define AR5K_EEPROM_PROTECT_WR_128_191        0x0080
++#define AR5K_EEPROM_PROTECT_RD_192_207        0x0100  /* 0xc0 - 0xcf */
++#define AR5K_EEPROM_PROTECT_WR_192_207        0x0200
++#define AR5K_EEPROM_PROTECT_RD_208_223        0x0400  /* 0xd0 - 0xdf */
++#define AR5K_EEPROM_PROTECT_WR_208_223        0x0800
++#define AR5K_EEPROM_PROTECT_RD_224_239        0x1000  /* 0xe0 - 0xef */
++#define AR5K_EEPROM_PROTECT_WR_224_239        0x2000
++#define AR5K_EEPROM_PROTECT_RD_240_255        0x4000  /* 0xf0 - 0xff */
++#define AR5K_EEPROM_PROTECT_WR_240_255        0x8000
++#define AR5K_EEPROM_REG_DOMAIN                0x00bf  /* EEPROM regdom */
++#define AR5K_EEPROM_INFO_BASE         0x00c0  /* EEPROM header */
++#define AR5K_EEPROM_INFO_MAX          (0x400 - AR5K_EEPROM_INFO_BASE)
++#define AR5K_EEPROM_INFO_CKSUM                0xffff
++#define AR5K_EEPROM_INFO(_n)          (AR5K_EEPROM_INFO_BASE + (_n))
++
++#define AR5K_EEPROM_VERSION           AR5K_EEPROM_INFO(1)     /* EEPROM Version */
++#define AR5K_EEPROM_VERSION_3_0               0x3000  /* No idea what's going on before this version */
++#define AR5K_EEPROM_VERSION_3_1               0x3001  /* ob/db values for 2GHz (AR5211_rfregs) */
++#define AR5K_EEPROM_VERSION_3_2               0x3002  /* different frequency representation (eeprom_bin2freq) */
++#define AR5K_EEPROM_VERSION_3_3               0x3003  /* offsets changed, has 32 CTLs (see below) and ee_false_detect (eeprom_read_modes) */
++#define AR5K_EEPROM_VERSION_3_4               0x3004  /* has ee_i_gain ee_cck_ofdm_power_delta (eeprom_read_modes) */
++#define AR5K_EEPROM_VERSION_4_0               0x4000  /* has ee_misc*, ee_cal_pier, ee_turbo_max_power and ee_xr_power (eeprom_init) */
++#define AR5K_EEPROM_VERSION_4_1               0x4001  /* has ee_margin_tx_rx (eeprom_init) */
++#define AR5K_EEPROM_VERSION_4_2               0x4002  /* has ee_cck_ofdm_gain_delta (eeprom_init) */
++#define AR5K_EEPROM_VERSION_4_3               0x4003
++#define AR5K_EEPROM_VERSION_4_4               0x4004
++#define AR5K_EEPROM_VERSION_4_5               0x4005
++#define AR5K_EEPROM_VERSION_4_6               0x4006  /* has ee_scaled_cck_delta */
++#define AR5K_EEPROM_VERSION_4_7               0x3007
++
++#define AR5K_EEPROM_MODE_11A          0
++#define AR5K_EEPROM_MODE_11B          1
++#define AR5K_EEPROM_MODE_11G          2
++
++#define AR5K_EEPROM_HDR                       AR5K_EEPROM_INFO(2)     /* Header that contains the device caps */
++#define AR5K_EEPROM_HDR_11A(_v)               (((_v) >> AR5K_EEPROM_MODE_11A) & 0x1)
++#define AR5K_EEPROM_HDR_11B(_v)               (((_v) >> AR5K_EEPROM_MODE_11B) & 0x1)
++#define AR5K_EEPROM_HDR_11G(_v)               (((_v) >> AR5K_EEPROM_MODE_11G) & 0x1)
++#define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v)        (((_v) >> 3) & 0x1)     /* Disable turbo for 2GHz (?) */
++#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v)        (((_v) >> 4) & 0x7f)    /* Max turbo power for a/XR mode (eeprom_init) */
++#define AR5K_EEPROM_HDR_DEVICE(_v)    (((_v) >> 11) & 0x7)
++#define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v)        (((_v) >> 15) & 0x1)    /* Disable turbo for 5GHz (?) */
++#define AR5K_EEPROM_HDR_RFKILL(_v)    (((_v) >> 14) & 0x1)    /* Device has RFKill support */
++
++/* Misc values available since EEPROM 4.0 */
++#define AR5K_EEPROM_MISC0             AR5K_EEPROM_INFO(4)
++#define AR5K_EEPROM_EARSTART(_v)      ((_v) & 0xfff)
++#define AR5K_EEPROM_HDR_XR2_DIS(_v)   (((_v) >> 12) & 0x1)
++#define AR5K_EEPROM_HDR_XR5_DIS(_v)   (((_v) >> 13) & 0x1)
++#define AR5K_EEPROM_EEMAP(_v)         (((_v) >> 14) & 0x3)
++#define AR5K_EEPROM_MISC1             AR5K_EEPROM_INFO(5)
++#define AR5K_EEPROM_TARGET_PWRSTART(_v)       ((_v) & 0xfff)
++#define AR5K_EEPROM_HAS32KHZCRYSTAL(_v)       (((_v) >> 14) & 0x1)
++
++#define AR5K_EEPROM_RFKILL_GPIO_SEL   0x0000001c
++#define AR5K_EEPROM_RFKILL_GPIO_SEL_S 2
++#define AR5K_EEPROM_RFKILL_POLARITY   0x00000002
++#define AR5K_EEPROM_RFKILL_POLARITY_S 1
++
++/* Newer EEPROMs are using a different offset */
++#define AR5K_EEPROM_OFF(_v, _v3_0, _v3_3) \
++      (((_v) >= AR5K_EEPROM_VERSION_3_3) ? _v3_3 : _v3_0)
++
++#define AR5K_EEPROM_ANT_GAIN(_v)      AR5K_EEPROM_OFF(_v, 0x00c4, 0x00c3)
++#define AR5K_EEPROM_ANT_GAIN_5GHZ(_v) ((int8_t)(((_v) >> 8) & 0xff))
++#define AR5K_EEPROM_ANT_GAIN_2GHZ(_v) ((int8_t)((_v) & 0xff))
++
++/* calibration settings */
++#define AR5K_EEPROM_MODES_11A(_v)     AR5K_EEPROM_OFF(_v, 0x00c5, 0x00d4)
++#define AR5K_EEPROM_MODES_11B(_v)     AR5K_EEPROM_OFF(_v, 0x00d0, 0x00f2)
++#define AR5K_EEPROM_MODES_11G(_v)     AR5K_EEPROM_OFF(_v, 0x00da, 0x010d)
++#define AR5K_EEPROM_CTL(_v)           AR5K_EEPROM_OFF(_v, 0x00e4, 0x0128)     /* Conformance test limits */
++#define AR5K_EEPROM_CHANNELS_5GHZ(_v) AR5K_EEPROM_OFF(_v, 0x0100, 0x0150)     /* List of calibrated 5GHz chans */
++#define       AR5K_EEPROM_TARGET_PWR_OFF_11A(_v)      AR5K_EEPROM_OFF(_v, AR5K_EEPROM_CHANNELS_5GHZ(_v) + 0x0055, 0x0000)
++#define       AR5K_EEPROM_TARGET_PWR_OFF_11B(_v)      AR5K_EEPROM_OFF(_v, AR5K_EEPROM_CHANNELS_5GHZ(_v) + 0x0065, 0x0010)
++#define       AR5K_EEPROM_TARGET_PWR_OFF_11G(_v)      AR5K_EEPROM_OFF(_v, AR5K_EEPROM_CHANNELS_5GHZ(_v) + 0x0069, 0x0014)
++
++/* [3.1 - 3.3] */
++#define AR5K_EEPROM_OBDB0_2GHZ                0x00ec
++#define AR5K_EEPROM_OBDB1_2GHZ                0x00ed
++
+ /*
+  * EEPROM data register
+  */
+ #define AR5K_EEPROM_DATA_5211 0x6004
+ #define AR5K_EEPROM_DATA_5210 0x6800
+-#define       AR5K_EEPROM_DATA        (mac_version == AR5K_SREV_VER_AR5210 ? \
++#define AR5K_EEPROM_DATA      (mac_version == AR5K_SREV_MAC_AR5210 ? \
+                               AR5K_EEPROM_DATA_5210 : AR5K_EEPROM_DATA_5211)
+ /*
+  * EEPROM command register
+  */
+-#define AR5K_EEPROM_CMD               0x6008  /* Register Addres */
++#define AR5K_EEPROM_CMD               0x6008                  /* Register Address */
+ #define AR5K_EEPROM_CMD_READ  0x00000001      /* EEPROM read */
+ #define AR5K_EEPROM_CMD_WRITE 0x00000002      /* EEPROM write */
+ #define AR5K_EEPROM_CMD_RESET 0x00000004      /* EEPROM reset */
+@@ -291,43 +307,163 @@ static const struct ath5k_srev_name ath5
+ /*
+  * EEPROM status register
+  */
+-#define AR5K_EEPROM_STAT_5210 0x6c00  /* Register Address [5210] */
+-#define AR5K_EEPROM_STAT_5211 0x600c  /* Register Address [5211+] */
+-#define       AR5K_EEPROM_STATUS      (mac_version == AR5K_SREV_VER_AR5210 ? \
++#define AR5K_EEPROM_STAT_5210 0x6c00                  /* Register Address [5210] */
++#define AR5K_EEPROM_STAT_5211 0x600c                  /* Register Address [5211+] */
++#define AR5K_EEPROM_STATUS    (mac_version == AR5K_SREV_MAC_AR5210 ? \
+                               AR5K_EEPROM_STAT_5210 : AR5K_EEPROM_STAT_5211)
+ #define AR5K_EEPROM_STAT_RDERR        0x00000001      /* EEPROM read failed */
+ #define AR5K_EEPROM_STAT_RDDONE       0x00000002      /* EEPROM read successful */
+ #define AR5K_EEPROM_STAT_WRERR        0x00000004      /* EEPROM write failed */
+ #define AR5K_EEPROM_STAT_WRDONE       0x00000008      /* EEPROM write successful */
+-#define AR5K_EEPROM_REG_DOMAIN                0x00bf  /* Offset for EEPROM regulatory domain */
+-#define AR5K_EEPROM_INFO_BASE         0x00c0  /* Offset for EEPROM header */
+-#define AR5K_EEPROM_INFO_MAX          (0x400 - AR5K_EEPROM_INFO_BASE)
+-#define AR5K_EEPROM_INFO_CKSUM                0xffff
+-#define AR5K_EEPROM_INFO(_n)          (AR5K_EEPROM_INFO_BASE + (_n))
+-#define AR5K_EEPROM_MODE_11A          0
+-#define AR5K_EEPROM_MODE_11B          1
+-#define AR5K_EEPROM_MODE_11G          2
++/*
++ * EEPROM config register (?)
++ */
++#define AR5K_EEPROM_CFG       0x6010
+-#define AR5K_EEPROM_VERSION           AR5K_EEPROM_INFO(1)
++/* Some EEPROM defines */
++#define AR5K_EEPROM_EEP_SCALE         100
++#define AR5K_EEPROM_EEP_DELTA         10
++#define AR5K_EEPROM_N_MODES           3
++#define AR5K_EEPROM_N_5GHZ_CHAN               10
++#define AR5K_EEPROM_N_2GHZ_CHAN               3
++#define AR5K_EEPROM_MAX_CHAN          10
++#define AR5K_EEPROM_N_PCDAC           11
++#define AR5K_EEPROM_N_TEST_FREQ               8
++#define AR5K_EEPROM_N_EDGES           8
++#define AR5K_EEPROM_N_INTERCEPTS      11
++#define AR5K_EEPROM_FREQ_M(_v)                AR5K_EEPROM_OFF(_v, 0x7f, 0xff)
++#define AR5K_EEPROM_PCDAC_M           0x3f
++#define AR5K_EEPROM_PCDAC_START               1
++#define AR5K_EEPROM_PCDAC_STOP                63
++#define AR5K_EEPROM_PCDAC_STEP                1
++#define AR5K_EEPROM_NON_EDGE_M                0x40
++#define AR5K_EEPROM_CHANNEL_POWER     8
++#define AR5K_EEPROM_N_OBDB            4
++#define AR5K_EEPROM_OBDB_DIS          0xffff
++#define AR5K_EEPROM_CHANNEL_DIS               0xff
++#define AR5K_EEPROM_SCALE_OC_DELTA(_x)        (((_x) * 2) / 10)
++#define AR5K_EEPROM_N_CTLS(_v)                AR5K_EEPROM_OFF(_v, 16, 32)
++#define AR5K_EEPROM_MAX_CTLS          32
++#define AR5K_EEPROM_N_XPD_PER_CHANNEL 4
++#define AR5K_EEPROM_N_XPD0_POINTS     4
++#define AR5K_EEPROM_N_XPD3_POINTS     3
++#define AR5K_EEPROM_N_INTERCEPT_10_2GHZ       35
++#define AR5K_EEPROM_N_INTERCEPT_10_5GHZ       55
++#define AR5K_EEPROM_POWER_M           0x3f
++#define AR5K_EEPROM_POWER_MIN         0
++#define AR5K_EEPROM_POWER_MAX         3150
++#define AR5K_EEPROM_POWER_STEP                50
++#define AR5K_EEPROM_POWER_TABLE_SIZE  64
++#define AR5K_EEPROM_N_POWER_LOC_11B   4
++#define AR5K_EEPROM_N_POWER_LOC_11G   6
++#define AR5K_EEPROM_I_GAIN            10
++#define AR5K_EEPROM_CCK_OFDM_DELTA    15
++#define AR5K_EEPROM_N_IQ_CAL          2
++
++enum ath5k_ant_setting {
++      AR5K_ANT_VARIABLE       = 0,    /* variable by programming */
++      AR5K_ANT_FIXED_A        = 1,    /* fixed to 11a frequencies */
++      AR5K_ANT_FIXED_B        = 2,    /* fixed to 11b frequencies */
++      AR5K_ANT_MAX            = 3,
++};
+-#define AR5K_EEPROM_HDR                       AR5K_EEPROM_INFO(2)     /* Header that contains the device caps */
+-#define AR5K_EEPROM_HDR_11A(_v)               (((_v) >> AR5K_EEPROM_MODE_11A) & 0x1)  /* Device has a support */
+-#define AR5K_EEPROM_HDR_11B(_v)               (((_v) >> AR5K_EEPROM_MODE_11B) & 0x1)  /* Device has b support */
+-#define AR5K_EEPROM_HDR_11G(_v)               (((_v) >> AR5K_EEPROM_MODE_11G) & 0x1)  /* Device has g support */
+-#define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v)        (((_v) >> 3) & 0x1)     /* Disable turbo for 2Ghz (?) */
+-#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v)        (((_v) >> 4) & 0x7f)    /* Max turbo power for a/XR mode (eeprom_init) */
+-#define AR5K_EEPROM_HDR_DEVICE(_v)    (((_v) >> 11) & 0x7)
+-#define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v)        (((_v) >> 15) & 0x1)    /* Disable turbo for 5Ghz (?) */
+-#define AR5K_EEPROM_HDR_RFKILL(_v)    (((_v) >> 14) & 0x1)    /* Device has RFKill support */
++/* Per channel calibration data, used for power table setup */
++struct ath5k_chan_pcal_info {
++      u_int16_t       freq; /* Frequency */
++      /* Power levels in dBm * 4 units */
++      int16_t         pwr_x0[AR5K_EEPROM_N_XPD0_POINTS];
++      int16_t         pwr_x3[AR5K_EEPROM_N_XPD3_POINTS];
++      /* PCDAC tables in dBm * 2 units */
++      u_int16_t       pcdac_x0[AR5K_EEPROM_N_XPD0_POINTS];
++      u_int16_t       pcdac_x3[AR5K_EEPROM_N_XPD3_POINTS];
++      /* Max available power */
++      u_int16_t       max_pwr;
++};
+-/* Misc values available since EEPROM 4.0 */
+-#define AR5K_EEPROM_MISC0             0x00c4
+-#define AR5K_EEPROM_EARSTART(_v)      ((_v) & 0xfff)
+-#define AR5K_EEPROM_EEMAP(_v)         (((_v) >> 14) & 0x3)
+-#define AR5K_EEPROM_MISC1             0x00c5
+-#define AR5K_EEPROM_TARGET_PWRSTART(_v)       ((_v) & 0xfff)
+-#define AR5K_EEPROM_HAS32KHZCRYSTAL(_v)       (((_v) >> 14) & 0x1)
++/* Per rate calibration data for each mode, used for power table setup */
++struct ath5k_rate_pcal_info {
++      u_int16_t       freq; /* Frequency */
++      /* Power level for 6-24Mbit/s rates */
++      u_int16_t       target_power_6to24;
++      /* Power level for 36Mbit rate */
++      u_int16_t       target_power_36;
++      /* Power level for 48Mbit rate */
++      u_int16_t       target_power_48;
++      /* Power level for 54Mbit rate */
++      u_int16_t       target_power_54;
++};
++
++/* EEPROM calibration data */
++struct ath5k_eeprom_info {
++
++      /* Header information */
++      u_int16_t       ee_magic;
++      u_int16_t       ee_protect;
++      u_int16_t       ee_regdomain;
++      u_int16_t       ee_version;
++      u_int16_t       ee_header;
++      u_int16_t       ee_ant_gain;
++      u_int16_t       ee_misc0;
++      u_int16_t       ee_misc1;
++      u_int16_t       ee_cck_ofdm_gain_delta;
++      u_int16_t       ee_cck_ofdm_power_delta;
++      u_int16_t       ee_scaled_cck_delta;
++
++      /* Used for tx thermal adjustment (eeprom_init, rfregs) */
++      u_int16_t       ee_tx_clip;
++      u_int16_t       ee_pwd_84;
++      u_int16_t       ee_pwd_90;
++      u_int16_t       ee_gain_select;
++
++      /* RF Calibration settings (reset, rfregs) */
++      u_int16_t       ee_i_cal[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_q_cal[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_fixed_bias[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_turbo_max_power[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_xr_power[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_switch_settling[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_ant_tx_rx[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_ant_control[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PCDAC];
++      u_int16_t       ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB];
++      u_int16_t       ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB];
++      u_int16_t       ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_thr_62[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_xlna_gain[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_xpd[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_x_gain[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_i_gain[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_margin_tx_rx[AR5K_EEPROM_N_MODES];
++
++      /* Power calibration data */
++      u_int16_t       ee_false_detect[AR5K_EEPROM_N_MODES];
++      u_int16_t       ee_cal_piers_a;
++      struct ath5k_chan_pcal_info     ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN];
++      u_int16_t       ee_cal_piers_b;
++      struct ath5k_chan_pcal_info     ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN];
++      u_int16_t       ee_cal_piers_g;
++      struct ath5k_chan_pcal_info     ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN];
++      /* Per rate target power levels */
++      u_int16_t       ee_rate_target_pwr_num_a;
++      struct ath5k_rate_pcal_info     ee_rate_tpwr_a[AR5K_EEPROM_N_5GHZ_CHAN];
++      u_int16_t       ee_rate_target_pwr_num_b;
++      struct ath5k_rate_pcal_info     ee_rate_tpwr_b[AR5K_EEPROM_N_2GHZ_CHAN];
++      u_int16_t       ee_rate_target_pwr_num_g;
++      struct ath5k_rate_pcal_info     ee_rate_tpwr_g[AR5K_EEPROM_N_2GHZ_CHAN];
++
++      /* Conformance test limits (Unused) */
++      u_int16_t       ee_ctls;
++      u_int16_t       ee_ctl[AR5K_EEPROM_MAX_CTLS];
++
++      /* Noise Floor Calibration settings */
++      int16_t         ee_noise_floor_thr[AR5K_EEPROM_N_MODES];
++      int8_t          ee_adc_desired_size[AR5K_EEPROM_N_MODES];
++      int8_t          ee_pga_desired_size[AR5K_EEPROM_N_MODES];
++
++      u_int32_t       ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX];
++};
+ /*
+  * Read data by masking
+@@ -350,7 +486,6 @@ static const struct ath5k_srev_name ath5
+       (*((volatile u_int32_t *)(mem + (_reg))) = (_val))
+ #endif
+-
+ #define AR5K_REG_ENABLE_BITS(_reg, _flags)    \
+       AR5K_REG_WRITE(_reg, AR5K_REG_READ(_reg) | (_flags))
+@@ -359,7 +494,12 @@ static const struct ath5k_srev_name ath5
+ #define AR5K_TUNE_REGISTER_TIMEOUT            20000
+-/* names for eeprom fields */
++#define AR5K_EEPROM_READ(_o, _v) do {                                 \
++      if ((ret = ath5k_hw_eeprom_read(mem, (_o), &(_v), mac_version)) != 0)   \
++              return (ret);                                           \
++} while (0)
++
++/* Names for EEPROM fields */
+ struct eeprom_entry {
+       const char *name;
+       int addr;
+@@ -375,8 +515,6 @@ static const struct eeprom_entry eeprom_
+       {"regdomain", AR5K_EEPROM_REG_DOMAIN},
+ };
+-static const int eeprom_addr_len = sizeof(eeprom_addr) / sizeof(eeprom_addr[0]);
+-
+ static int force_write = 0;
+ static int verbose = 0;
+@@ -398,8 +536,8 @@ static u_int32_t ath5k_hw_bitswap(u_int3
+ /*
+  * Get the PHY Chip revision
+  */
+-static u_int16_t
+-ath5k_hw_radio_revision(u_int16_t mac_version, void *mem, u_int8_t chip)
++static u_int16_t ath5k_hw_radio_revision(u_int16_t mac_version, void *mem,
++                                       u_int8_t chip)
+ {
+       int i;
+       u_int32_t srev;
+@@ -427,7 +565,7 @@ ath5k_hw_radio_revision(u_int16_t mac_ve
+       for (i = 0; i < 8; i++)
+               AR5K_REG_WRITE(AR5K_PHY(0x20), 0x00010000);
+-      if (mac_version == AR5K_SREV_VER_AR5210) {
++      if (mac_version == AR5K_SREV_MAC_AR5210) {
+               srev = AR5K_REG_READ(AR5K_PHY(256) >> 28) & 0xf;
+               ret = (u_int16_t)ath5k_hw_bitswap(srev, 4) + 1;
+@@ -447,9 +585,8 @@ ath5k_hw_radio_revision(u_int16_t mac_ve
+ /*
+  * Write to EEPROM
+  */
+-static int
+-ath5k_hw_eeprom_write(void *mem, u_int32_t offset, u_int16_t data,
+-                    u_int8_t mac_version)
++static int ath5k_hw_eeprom_write(void *mem, u_int32_t offset, u_int16_t data,
++                               u_int8_t mac_version)
+ {
+       u_int32_t status, timeout;
+@@ -457,7 +594,7 @@ ath5k_hw_eeprom_write(void *mem, u_int32
+        * Initialize EEPROM access
+        */
+-      if (mac_version == AR5K_SREV_VER_AR5210) {
++      if (mac_version == AR5K_SREV_MAC_AR5210) {
+               AR5K_REG_ENABLE_BITS(AR5K_PCICFG, AR5K_PCICFG_EEAE);
+@@ -466,7 +603,7 @@ ath5k_hw_eeprom_write(void *mem, u_int32
+       } else {
+               /* not 5210 */
+-              /* reset eeprom access */
++              /* reset EEPROM access */
+               AR5K_REG_WRITE(AR5K_EEPROM_CMD, AR5K_EEPROM_CMD_RESET);
+               usleep(5);
+@@ -484,7 +621,7 @@ ath5k_hw_eeprom_write(void *mem, u_int32
+               status = AR5K_REG_READ(AR5K_EEPROM_STATUS);
+               if (status & AR5K_EEPROM_STAT_WRDONE) {
+                       if (status & AR5K_EEPROM_STAT_WRERR) {
+-                              err("eeprom write access to 0x%04x failed",
++                              err("EEPROM write access to 0x%04x failed",
+                                   offset);
+                               return 1;
+                       }
+@@ -499,16 +636,15 @@ ath5k_hw_eeprom_write(void *mem, u_int32
+ /*
+  * Read from EEPROM
+  */
+-static int
+-ath5k_hw_eeprom_read(void *mem, u_int32_t offset, u_int16_t *data,
+-                   u_int8_t mac_version)
++static int ath5k_hw_eeprom_read(void *mem, u_int32_t offset, u_int16_t *data,
++                              u_int8_t mac_version)
+ {
+       u_int32_t status, timeout;
+       /*
+        * Initialize EEPROM access
+        */
+-      if (mac_version == AR5K_SREV_VER_AR5210) {
++      if (mac_version == AR5K_SREV_MAC_AR5210) {
+               AR5K_REG_ENABLE_BITS(AR5K_PCICFG, AR5K_PCICFG_EEAE);
+               (void)AR5K_REG_READ(AR5K_EEPROM_BASE + (4 * offset));
+       } else {
+@@ -531,50 +667,701 @@ ath5k_hw_eeprom_read(void *mem, u_int32_
+       return 1;
+ }
+-static const char *ath5k_hw_get_part_name(enum ath5k_srev_type type,
+-                                        u_int32_t val)
++/*
++ * Translate binary channel representation in EEPROM to frequency
++ */
++static u_int16_t ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee,
++                                     u_int16_t bin, unsigned int mode)
+ {
+-      const char *name = "xxxxx";
+-      int i;
++      u_int16_t val;
+-      for (i = 0; i < ARRAY_SIZE(ath5k_srev_names); i++) {
+-              if (ath5k_srev_names[i].sr_type != type ||
+-                  ath5k_srev_names[i].sr_val == AR5K_SREV_UNKNOWN)
+-                      continue;
+-              if ((val & 0xff) < ath5k_srev_names[i + 1].sr_val) {
+-                      name = ath5k_srev_names[i].sr_name;
++      if (bin == AR5K_EEPROM_CHANNEL_DIS)
++              return bin;
++
++      if (mode == AR5K_EEPROM_MODE_11A) {
++              if (ee->ee_version > AR5K_EEPROM_VERSION_3_2)
++                      val = (5 * bin) + 4800;
++              else
++                      val = bin > 62 ? (10 * 62) + (5 * (bin - 62)) + 5100 :
++                          (bin * 10) + 5100;
++      } else {
++              if (ee->ee_version > AR5K_EEPROM_VERSION_3_2)
++                      val = bin + 2300;
++              else
++                      val = bin + 2400;
++      }
++
++      return val;
++}
++
++/*
++ * Read antenna info from EEPROM
++ */
++static int ath5k_eeprom_read_ants(void *mem, u_int8_t mac_version,
++                                struct ath5k_eeprom_info *ee,
++                                u_int32_t *offset, unsigned int mode)
++{
++      u_int32_t o = *offset;
++      u_int16_t val;
++      int ret, i = 0;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_switch_settling[mode]    = (val >> 8) & 0x7f;
++      ee->ee_ant_tx_rx[mode]          = (val >> 2) & 0x3f;
++      ee->ee_ant_control[mode][i]     = (val << 4) & 0x3f;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_ant_control[mode][i++]   |= (val >> 12) & 0xf;
++      ee->ee_ant_control[mode][i++]   = (val >> 6) & 0x3f;
++      ee->ee_ant_control[mode][i++]   = val & 0x3f;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_ant_control[mode][i++]   = (val >> 10) & 0x3f;
++      ee->ee_ant_control[mode][i++]   = (val >> 4) & 0x3f;
++      ee->ee_ant_control[mode][i]     = (val << 2) & 0x3f;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_ant_control[mode][i++]   |= (val >> 14) & 0x3;
++      ee->ee_ant_control[mode][i++]   = (val >> 8) & 0x3f;
++      ee->ee_ant_control[mode][i++]   = (val >> 2) & 0x3f;
++      ee->ee_ant_control[mode][i]     = (val << 4) & 0x3f;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_ant_control[mode][i++]   |= (val >> 12) & 0xf;
++      ee->ee_ant_control[mode][i++]   = (val >> 6) & 0x3f;
++      ee->ee_ant_control[mode][i++]   = val & 0x3f;
++
++      /* Get antenna modes */
++      ee->ee_antenna[mode][0] =
++          (ee->ee_ant_control[mode][0] << 4) | 0x1;
++      ee->ee_antenna[mode][AR5K_ANT_FIXED_A] =
++           ee->ee_ant_control[mode][1]        |
++          (ee->ee_ant_control[mode][2] << 6)  |
++          (ee->ee_ant_control[mode][3] << 12) |
++          (ee->ee_ant_control[mode][4] << 18) |
++          (ee->ee_ant_control[mode][5] << 24);
++      ee->ee_antenna[mode][AR5K_ANT_FIXED_B] =
++           ee->ee_ant_control[mode][6]        |
++          (ee->ee_ant_control[mode][7] << 6)  |
++          (ee->ee_ant_control[mode][8] << 12) |
++          (ee->ee_ant_control[mode][9] << 18) |
++          (ee->ee_ant_control[mode][10] << 24);
++
++      /* return new offset */
++      *offset = o;
++
++      return 0;
++}
++
++/*
++ * Read supported modes from EEPROM
++ */
++static int ath5k_eeprom_read_modes(void *mem, u_int8_t mac_version,
++                                 struct ath5k_eeprom_info *ee,
++                                 u_int32_t *offset, unsigned int mode)
++{
++      u_int32_t o = *offset;
++      u_int16_t val;
++      int ret;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_tx_end2xlna_enable[mode] = (val >> 8) & 0xff;
++      ee->ee_thr_62[mode]             = val & 0xff;
++
++      if (ee->ee_version <= AR5K_EEPROM_VERSION_3_2)
++              ee->ee_thr_62[mode] = mode == AR5K_EEPROM_MODE_11A ? 15 : 28;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_tx_end2xpa_disable[mode] = (val >> 8) & 0xff;
++      ee->ee_tx_frm2xpa_enable[mode]  = val & 0xff;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_pga_desired_size[mode]   = (val >> 8) & 0xff;
++
++      if ((val & 0xff) & 0x80)
++              ee->ee_noise_floor_thr[mode] = -((((val & 0xff) ^ 0xff)) + 1);
++      else
++              ee->ee_noise_floor_thr[mode] = val & 0xff;
++
++      if (ee->ee_version <= AR5K_EEPROM_VERSION_3_2)
++              ee->ee_noise_floor_thr[mode] =
++                  mode == AR5K_EEPROM_MODE_11A ? -54 : -1;
++
++      AR5K_EEPROM_READ(o++, val);
++      ee->ee_xlna_gain[mode]          = (val >> 5) & 0xff;
++      ee->ee_x_gain[mode]             = (val >> 1) & 0xf;
++      ee->ee_xpd[mode]                = val & 0x1;
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_0)
++              ee->ee_fixed_bias[mode] = (val >> 13) & 0x1;
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) {
++              AR5K_EEPROM_READ(o++, val);
++              ee->ee_false_detect[mode] = (val >> 6) & 0x7f;
++
++              if (mode == AR5K_EEPROM_MODE_11A)
++                      ee->ee_xr_power[mode] = val & 0x3f;
++              else {
++                      ee->ee_ob[mode][0] = val & 0x7;
++                      ee->ee_db[mode][0] = (val >> 3) & 0x7;
++              }
++      }
++
++      if (ee->ee_version < AR5K_EEPROM_VERSION_3_4) {
++              ee->ee_i_gain[mode] = AR5K_EEPROM_I_GAIN;
++              ee->ee_cck_ofdm_power_delta = AR5K_EEPROM_CCK_OFDM_DELTA;
++      } else {
++              ee->ee_i_gain[mode] = (val >> 13) & 0x7;
++
++              AR5K_EEPROM_READ(o++, val);
++              ee->ee_i_gain[mode] |= (val << 3) & 0x38;
++
++              if (mode == AR5K_EEPROM_MODE_11G)
++                      ee->ee_cck_ofdm_power_delta = (val >> 3) & 0xff;
++      }
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_0 &&
++          mode == AR5K_EEPROM_MODE_11A) {
++              ee->ee_i_cal[mode] = (val >> 8) & 0x3f;
++              ee->ee_q_cal[mode] = (val >> 3) & 0x1f;
++      }
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_6 &&
++          mode == AR5K_EEPROM_MODE_11G)
++              ee->ee_scaled_cck_delta = (val >> 11) & 0x1f;
++
++      /* return new offset */
++      *offset = o;
++
++      return 0;
++}
++
++/*
++ * Read per channel calibration info from EEPROM
++ * This doesn't work on 2112+ chips (EEPROM versions >= 4.6),
++ * I only tested it on 5213 + 5112. This is still work in progress...
++ *
++ * This info is used to calibrate the baseband power table. Imagine
++ * that for each channel there is a power curve that's hw specific
++ * (depends on amplifier) and we try to "correct" this curve using offests
++ * we pass on to phy chip (baseband -> before amplifier) so that it can
++ * use acurate power values when setting tx power (takes amplifier's performance
++ * on each channel into account).
++ *
++ * EEPROM provides us with the offsets for some pre-calibrated channels
++ * and we have to scale (to create the full table for these channels) and
++ * interpolate (in order to create the table for any channel).
++ */
++static int ath5k_eeprom_read_pcal_info(void *mem, u_int8_t mac_version,
++                                     struct ath5k_eeprom_info *ee,
++                                     u_int32_t *offset, unsigned int mode)
++{
++      u_int32_t o = *offset;
++      unsigned int i, c;
++      int ret;
++      u_int16_t val;
++      struct ath5k_chan_pcal_info *chan_pcal_info;
++      u_int16_t cal_piers;
++
++      switch (mode) {
++      case AR5K_EEPROM_MODE_11A:
++              chan_pcal_info = ee->ee_pwr_cal_a;
++              cal_piers = ee->ee_cal_piers_a;
++              break;
++      case AR5K_EEPROM_MODE_11B:
++              chan_pcal_info = ee->ee_pwr_cal_b;
++              cal_piers = ee->ee_cal_piers_b;
++              break;
++      case AR5K_EEPROM_MODE_11G:
++              chan_pcal_info = ee->ee_pwr_cal_g;
++              cal_piers = ee->ee_cal_piers_g;
++              break;
++      default:
++              return -EINVAL;
++      }
++
++      for (i = 0; i < cal_piers; i++) {
++              /* Power values in dBm * 4 */
++              for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) {
++                      AR5K_EEPROM_READ(o++, val);
++                      chan_pcal_info[i].pwr_x0[c] = (val & 0xff);
++                      chan_pcal_info[i].pwr_x0[++c] = ((val >> 8) & 0xff);
++              }
++
++              /* PCDAC steps (dBm * 2) */
++              AR5K_EEPROM_READ(o++, val);
++              chan_pcal_info[i].pcdac_x0[1] = (val & 0x1f);
++              chan_pcal_info[i].pcdac_x0[2] = ((val >> 5) & 0x1f);
++              chan_pcal_info[i].pcdac_x0[3] = ((val >> 10) & 0x1f);
++
++              /* No idea what these power levels are for (4 xpds ?)
++                 I got zeroes on my card and the EEPROM info
++                 dumps we found on the net also have weird values */
++              AR5K_EEPROM_READ(o++, val);
++              chan_pcal_info[i].pwr_x3[0] = (val & 0xff);
++              chan_pcal_info[i].pwr_x3[1] = ((val >> 8) & 0xff);
++
++              AR5K_EEPROM_READ(o++, val);
++              chan_pcal_info[i].pwr_x3[2] = (val & 0xff);
++              /* It's weird but they put it here, that's the
++                 PCDAC starting step */
++              chan_pcal_info[i].pcdac_x0[0] = ((val >> 8) & 0xff);
++
++              /* Static values seen on EEPROM info dumps */
++              chan_pcal_info[i].pcdac_x3[0] = 20;
++              chan_pcal_info[i].pcdac_x3[1] = 35;
++              chan_pcal_info[i].pcdac_x3[2] = 63;
++
++              /* Last xpd0 power level is also channel maximum */
++              chan_pcal_info[i].max_pwr = chan_pcal_info[i].pwr_x0[3];
++
++              /* Recreate pcdac_x0 table for this channel using pcdac steps */
++              chan_pcal_info[i].pcdac_x0[1] += chan_pcal_info[i].pcdac_x0[0];
++              chan_pcal_info[i].pcdac_x0[2] += chan_pcal_info[i].pcdac_x0[1];
++              chan_pcal_info[i].pcdac_x0[3] += chan_pcal_info[i].pcdac_x0[2];
++      }
++
++      /* return new offset */
++      (*offset) = o;
++
++      return 0;
++}
++
++/*
++ * Read per rate target power (this is the maximum tx power
++ * supported by the card). This info is used when setting
++ * tx power, no matter the channel.
++ *
++ * This also works for v5 EEPROMs.
++ */
++static int ath5k_eeprom_read_target_rate_pwr_info(void *mem,
++                                                u_int8_t mac_version,
++                                                struct ath5k_eeprom_info *ee,
++                                                u_int32_t *offset,
++                                                unsigned int mode)
++{
++      u_int32_t o = *offset;
++      u_int16_t val;
++      struct ath5k_rate_pcal_info *rate_pcal_info;
++      u_int16_t *rate_target_pwr_num;
++      int ret, i;
++
++      switch (mode) {
++      case AR5K_EEPROM_MODE_11A:
++              rate_pcal_info = ee->ee_rate_tpwr_a;
++              ee->ee_rate_target_pwr_num_a = AR5K_EEPROM_N_5GHZ_CHAN;
++              rate_target_pwr_num = &ee->ee_rate_target_pwr_num_a;
++              break;
++      case AR5K_EEPROM_MODE_11B:
++              rate_pcal_info = ee->ee_rate_tpwr_b;
++              ee->ee_rate_target_pwr_num_b = 2; /* 3rd is g mode'ss 1st */
++              rate_target_pwr_num = &ee->ee_rate_target_pwr_num_b;
++              break;
++      case AR5K_EEPROM_MODE_11G:
++              rate_pcal_info = ee->ee_rate_tpwr_g;
++              ee->ee_rate_target_pwr_num_g = AR5K_EEPROM_N_2GHZ_CHAN;
++              rate_target_pwr_num = &ee->ee_rate_target_pwr_num_g;
++              break;
++      default:
++              return -EINVAL;
++      }
++
++      /* Different freq mask for older eeproms (<= v3.2) */
++      if(ee->ee_version <= 0x3002){
++              for (i = 0; i < (*rate_target_pwr_num); i++) {
++                      AR5K_EEPROM_READ(o++, val);
++                      rate_pcal_info[i].freq =
++                          ath5k_eeprom_bin2freq(ee, (val >> 9) & 0x7f, mode);
++      
++                      rate_pcal_info[i].target_power_6to24 = ((val >> 3) & 0x3f);
++                      rate_pcal_info[i].target_power_36 = (val << 3) & 0x3f;
++      
++                      AR5K_EEPROM_READ(o++, val);
++      
++                      if (rate_pcal_info[i].freq == AR5K_EEPROM_CHANNEL_DIS ||
++                          val == 0) {
++                              (*rate_target_pwr_num) = i;
++                              break;
++                      }
++
++                      rate_pcal_info[i].target_power_36 |= ((val >> 13) & 0x7);
++                      rate_pcal_info[i].target_power_48 = ((val >> 7) & 0x3f);
++                      rate_pcal_info[i].target_power_54 = ((val >> 1) & 0x3f);
++              }
++      } else {
++              for (i = 0; i < (*rate_target_pwr_num); i++) {
++                      AR5K_EEPROM_READ(o++, val);
++                      rate_pcal_info[i].freq =
++                          ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode);
++      
++                      rate_pcal_info[i].target_power_6to24 = ((val >> 2) & 0x3f);
++                      rate_pcal_info[i].target_power_36 = (val << 4) & 0x3f;
++      
++                      AR5K_EEPROM_READ(o++, val);
++      
++                      if (rate_pcal_info[i].freq == AR5K_EEPROM_CHANNEL_DIS ||
++                          val == 0) {
++                              (*rate_target_pwr_num) = i;
++                              break;
++                      }
++
++                      rate_pcal_info[i].target_power_36 |= (val >> 12) & 0xf;
++                      rate_pcal_info[i].target_power_48 = ((val >> 6) & 0x3f);
++                      rate_pcal_info[i].target_power_54 = (val & 0x3f);
++              }
++      }
++      /* return new offset */
++      (*offset) = o;
++
++      return 0;
++}
++
++/*
++ * Initialize EEPROM & capabilities data
++ */
++static int ath5k_eeprom_init(void *mem, u_int8_t mac_version,
++                           struct ath5k_eeprom_info *ee)
++{
++      unsigned int mode, i;
++      int ret;
++      u_int32_t offset;
++      u_int16_t val;
++
++      /* Initial TX thermal adjustment values */
++      ee->ee_tx_clip = 4;
++      ee->ee_pwd_84 = ee->ee_pwd_90 = 1;
++      ee->ee_gain_select = 1;
++
++      /*
++       * Read values from EEPROM and store them in the capability structure
++       */
++      AR5K_EEPROM_READ(AR5K_EEPROM_MAGIC, ee->ee_magic);
++      AR5K_EEPROM_READ(AR5K_EEPROM_PROTECT, ee->ee_protect);
++      AR5K_EEPROM_READ(AR5K_EEPROM_REG_DOMAIN, ee->ee_regdomain);
++      AR5K_EEPROM_READ(AR5K_EEPROM_VERSION, ee->ee_version);
++      AR5K_EEPROM_READ(AR5K_EEPROM_HDR, ee->ee_header);
++
++      /* Return if we have an old EEPROM */
++      if (ee->ee_version < AR5K_EEPROM_VERSION_3_0)
++              return 0;
++
++#ifdef notyet
++      /*
++       * Validate the checksum of the EEPROM date. There are some
++       * devices with invalid EEPROMs.
++       */
++      for (cksum = 0, offset = 0; offset < AR5K_EEPROM_INFO_MAX; offset++) {
++              AR5K_EEPROM_READ(AR5K_EEPROM_INFO(offset), val);
++              cksum ^= val;
++      }
++      if (cksum != AR5K_EEPROM_INFO_CKSUM) {
++              AR5K_PRINTF("Invalid EEPROM checksum 0x%04x\n", cksum);
++              return -EIO;
++      }
++#endif
++
++      AR5K_EEPROM_READ(AR5K_EEPROM_ANT_GAIN(ee->ee_version), ee->ee_ant_gain);
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_0) {
++              AR5K_EEPROM_READ(AR5K_EEPROM_MISC0, ee->ee_misc0);
++              AR5K_EEPROM_READ(AR5K_EEPROM_MISC1, ee->ee_misc1);
++      }
++
++      if (ee->ee_version < AR5K_EEPROM_VERSION_3_3) {
++              AR5K_EEPROM_READ(AR5K_EEPROM_OBDB0_2GHZ, val);
++              ee->ee_ob[AR5K_EEPROM_MODE_11B][0] = val & 0x7;
++              ee->ee_db[AR5K_EEPROM_MODE_11B][0] = (val >> 3) & 0x7;
++
++              AR5K_EEPROM_READ(AR5K_EEPROM_OBDB1_2GHZ, val);
++              ee->ee_ob[AR5K_EEPROM_MODE_11G][0] = val & 0x7;
++              ee->ee_db[AR5K_EEPROM_MODE_11G][0] = (val >> 3) & 0x7;
++      }
++
++      /*
++       * Get conformance test limit values
++       */
++      offset = AR5K_EEPROM_CTL(ee->ee_version);
++      ee->ee_ctls = 0;
++
++      for (i = 0; i < AR5K_EEPROM_N_CTLS(ee->ee_version); i++) {
++              AR5K_EEPROM_READ(offset++, val);
++
++              if (((val >> 8) & 0xff) == 0)
++                      break;
++
++              ee->ee_ctl[i] = (val >> 8) & 0xff;
++              ee->ee_ctls++;
++
++              if ((val & 0xff) == 0)
+                       break;
++
++              ee->ee_ctl[i + 1] = val & 0xff;
++              ee->ee_ctls++;
++      }
++
++      /*
++       * Get values for 802.11a (5GHz)
++       */
++      mode = AR5K_EEPROM_MODE_11A;
++
++      ee->ee_turbo_max_power[mode] =
++          AR5K_EEPROM_HDR_T_5GHZ_DBM(ee->ee_header);
++
++      offset = AR5K_EEPROM_MODES_11A(ee->ee_version);
++
++      ret = ath5k_eeprom_read_ants(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      AR5K_EEPROM_READ(offset++, val);
++      ee->ee_adc_desired_size[mode]   = (int8_t)((val >> 8) & 0xff);
++      ee->ee_ob[mode][3]              = (val >> 5) & 0x7;
++      ee->ee_db[mode][3]              = (val >> 2) & 0x7;
++      ee->ee_ob[mode][2]              = (val << 1) & 0x7;
++
++      AR5K_EEPROM_READ(offset++, val);
++      ee->ee_ob[mode][2]              |= (val >> 15) & 0x1;
++      ee->ee_db[mode][2]              = (val >> 12) & 0x7;
++      ee->ee_ob[mode][1]              = (val >> 9) & 0x7;
++      ee->ee_db[mode][1]              = (val >> 6) & 0x7;
++      ee->ee_ob[mode][0]              = (val >> 3) & 0x7;
++      ee->ee_db[mode][0]              = val & 0x7;
++
++      ret = ath5k_eeprom_read_modes(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_1) {
++              AR5K_EEPROM_READ(offset++, val);
++              ee->ee_margin_tx_rx[mode] = val & 0x3f;
++      }
++
++      /*
++       * Get values for 802.11b (2.4GHz)
++       */
++      mode = AR5K_EEPROM_MODE_11B;
++      offset = AR5K_EEPROM_MODES_11B(ee->ee_version);
++
++      ret = ath5k_eeprom_read_ants(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      AR5K_EEPROM_READ(offset++, val);
++      ee->ee_adc_desired_size[mode]   = (int8_t)((val >> 8) & 0xff);
++      ee->ee_ob[mode][1]              = (val >> 4) & 0x7;
++      ee->ee_db[mode][1]              = val & 0x7;
++
++      ret = ath5k_eeprom_read_modes(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_0) {
++              AR5K_EEPROM_READ(offset++, val);
++
++              ee->ee_cal_piers_b = 0;
++
++              ee->ee_pwr_cal_b[0].freq =
++                      ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
++              if (ee->ee_pwr_cal_b[0].freq != AR5K_EEPROM_CHANNEL_DIS)
++                      ee->ee_cal_piers_b++;
++
++              ee->ee_pwr_cal_b[1].freq =
++                      ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode);
++              if (ee->ee_pwr_cal_b[1].freq != AR5K_EEPROM_CHANNEL_DIS)
++                      ee->ee_cal_piers_b++;
++
++              AR5K_EEPROM_READ(offset++, val);
++              ee->ee_pwr_cal_b[2].freq =
++                      ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
++              if (ee->ee_pwr_cal_b[2].freq != AR5K_EEPROM_CHANNEL_DIS)
++                      ee->ee_cal_piers_b++;
++      }
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_1)
++              ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f;
++
++      /*
++       * Get values for 802.11g (2.4GHz)
++       */
++      mode = AR5K_EEPROM_MODE_11G;
++      offset = AR5K_EEPROM_MODES_11G(ee->ee_version);
++
++      ret = ath5k_eeprom_read_ants(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      AR5K_EEPROM_READ(offset++, val);
++      ee->ee_adc_desired_size[mode]   = (signed short int)((val >> 8) & 0xff);
++      ee->ee_ob[mode][1]              = (val >> 4) & 0x7;
++      ee->ee_db[mode][1]              = val & 0x7;
++
++      ret = ath5k_eeprom_read_modes(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      if (ee->ee_version >= AR5K_EEPROM_VERSION_4_0) {
++              AR5K_EEPROM_READ(offset++, val);
++
++              ee->ee_cal_piers_g = 0;
++
++              ee->ee_pwr_cal_g[0].freq =
++                      ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
++              if (ee->ee_pwr_cal_g[0].freq != AR5K_EEPROM_CHANNEL_DIS)
++                      ee->ee_cal_piers_g++;
++
++              ee->ee_pwr_cal_g[1].freq =
++                      ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode);
++              if (ee->ee_pwr_cal_g[1].freq != AR5K_EEPROM_CHANNEL_DIS)
++                      ee->ee_cal_piers_g++;
++
++              AR5K_EEPROM_READ(offset++, val);
++              ee->ee_turbo_max_power[mode] = val & 0x7f;
++              ee->ee_xr_power[mode] = (val >> 7) & 0x3f;
++
++              AR5K_EEPROM_READ(offset++, val);
++              ee->ee_pwr_cal_g[2].freq =
++                      ath5k_eeprom_bin2freq(ee, val & 0xff, mode);
++              if (ee->ee_pwr_cal_g[2].freq != AR5K_EEPROM_CHANNEL_DIS)
++                      ee->ee_cal_piers_g++;
++
++              if (ee->ee_version >= AR5K_EEPROM_VERSION_4_1)
++                      ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f;
++
++              AR5K_EEPROM_READ(offset++, val);
++              ee->ee_i_cal[mode] = (val >> 8) & 0x3f;
++              ee->ee_q_cal[mode] = (val >> 3) & 0x1f;
++
++              if (ee->ee_version >= AR5K_EEPROM_VERSION_4_2) {
++                      AR5K_EEPROM_READ(offset++, val);
++                      ee->ee_cck_ofdm_gain_delta = val & 0xff;
+               }
+       }
+-      return (name);
++      /*
++       * Read 5GHz EEPROM channels
++       */
++      offset = AR5K_EEPROM_CHANNELS_5GHZ(ee->ee_version);
++      ee->ee_cal_piers_a = 0;
++      for (i = 0; i < AR5K_EEPROM_N_5GHZ_CHAN; i++) {
++              AR5K_EEPROM_READ(offset++, val);
++
++              if ((val & 0xff) == 0)
++                      break;
++
++              ee->ee_pwr_cal_a[i].freq =
++                      ath5k_eeprom_bin2freq(ee, val & 0xff, AR5K_EEPROM_MODE_11A);
++              ee->ee_cal_piers_a++;
++
++              if (((val >> 8) & 0xff) == 0)
++                      break;
++
++              ee->ee_pwr_cal_a[++i].freq =
++                      ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, AR5K_EEPROM_MODE_11A);
++              ee->ee_cal_piers_a++;
++
++      }
++
++      /*
++       * Read power calibration info
++       */
++      mode = AR5K_EEPROM_MODE_11A;
++      ret = ath5k_eeprom_read_pcal_info(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      mode = AR5K_EEPROM_MODE_11B;
++      ret = ath5k_eeprom_read_pcal_info(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      mode = AR5K_EEPROM_MODE_11G;
++      ret = ath5k_eeprom_read_pcal_info(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++
++      /*
++       * Read per rate target power info
++       */
++      offset = AR5K_EEPROM_TARGET_PWRSTART(ee->ee_misc1) + AR5K_EEPROM_TARGET_PWR_OFF_11A(ee->ee_version);
++      mode = AR5K_EEPROM_MODE_11A;
++      ret = ath5k_eeprom_read_target_rate_pwr_info(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      offset = AR5K_EEPROM_TARGET_PWRSTART(ee->ee_misc1) + AR5K_EEPROM_TARGET_PWR_OFF_11B(ee->ee_version);
++      mode = AR5K_EEPROM_MODE_11B;
++      ret = ath5k_eeprom_read_target_rate_pwr_info(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      offset = AR5K_EEPROM_TARGET_PWRSTART(ee->ee_misc1) + AR5K_EEPROM_TARGET_PWR_OFF_11G(ee->ee_version);
++      mode = AR5K_EEPROM_MODE_11G;
++      ret = ath5k_eeprom_read_target_rate_pwr_info(mem, mac_version, ee, &offset, mode);
++      if (ret)
++              return ret;
++
++      return 0;
++}
++
++static const char *ath5k_hw_get_mac_name(u_int8_t val)
++{
++      static char name[16];
++      unsigned int i;
++
++      for (i = 0; i < ARRAY_SIZE(ath5k_mac_names); i++) {
++              if (val <= ath5k_mac_names[i].sr_val)
++                      break;
++      }
++
++      if (val == ath5k_mac_names[i].sr_val)
++              return ath5k_mac_names[i].sr_name;
++
++      snprintf(name, sizeof(name), "%s+", ath5k_mac_names[i - 1].sr_name);
++      return name;
++}
++
++static const char *ath5k_hw_get_phy_name(u_int8_t val)
++{
++      const char *name = "?????";
++      unsigned int i;
++
++      for (i = 0; i < ARRAY_SIZE(ath5k_phy_names); i++) {
++              if (val < ath5k_phy_names[i + 1].sr_val) {
++                      name = ath5k_phy_names[i].sr_name;
++                      break;
++              }
++      }
++
++      return name;
+ }
+ /* returns -1 on unknown name */
+ static int eeprom_name2addr(const char *name)
+ {
+-      int i;
++      unsigned int i;
++
+       if (!name || !name[0])
+               return -1;
+-      for (i = 0; i < eeprom_addr_len; i++)
++      for (i = 0; i < ARRAY_SIZE(eeprom_addr); i++)
+               if (!strcmp(name, eeprom_addr[i].name))
+                       return eeprom_addr[i].addr;
+       return -1;
+-}                             /* eeprom_name2addr */
++}
+ /* returns "<unknown>" on unknown address */
+ static const char *eeprom_addr2name(int addr)
+ {
+-      int i;
+-      for (i = 0; i < eeprom_addr_len; i++)
++      unsigned int i;
++
++      for (i = 0; i < ARRAY_SIZE(eeprom_addr); i++)
+               if (eeprom_addr[i].addr == addr)
+                       return eeprom_addr[i].name;
+       return "<unknown>";
+-}                             /* eeprom_addr2name */
++}
+-static int
+-do_write_pairs(int anr, int argc, char **argv, unsigned char *mem,
+-             int mac_version)
++static int do_write_pairs(int anr, int argc, char **argv, unsigned char *mem,
++                        int mac_version)
+ {
+ #define MAX_NR_WRITES 16
+       struct {
+@@ -635,7 +1422,7 @@ do_write_pairs(int anr, int argc, char *
+               }
+               anr++;
+               i++;
+-      }                       /* while (anr < (argc-1)) */
++      }
+       if (!(wr_ops_len = i)) {
+               err("no (addr,val) pairs given");
+@@ -702,20 +1489,22 @@ do_write_pairs(int anr, int argc, char *
+       }
+       return errors ? 11 : 0;
+-}                             /* do_write_pairs */
++}
+ static void usage(const char *n)
+ {
+-      int i;
++      unsigned int i;
+-      fprintf(stderr, "%s [-w [-g N:M]] [-v] [-f] [-d] <base_address> "
++      fprintf(stderr, "%s [-w [-g N:M]] [-v] [-f] [-d] [-R addr] [-W addr val] <base_address> "
+               "[<name1> <val1> [<name2> <val2> ...]]\n\n", n);
+       fprintf(stderr,
+               "-w      write values into EEPROM\n"
+               "-g N:M  set GPIO N to level M (only used with -w)\n"
+               "-v      verbose output\n"
+               "-f      force; suppress question before writing\n"
+-              "-d      dump eeprom (file 'ath-eeprom-dump.bin' and screen)\n"
++              "-d      dump EEPROM (file 'ath-eeprom-dump.bin' and screen)\n"
++              "-R <addr>       read register at <addr> (hex)\n"
++              "-W <addr> <val> write <val> (hex) into register at <addr> (hex)\n"
+               "<base_address>  device base address (see lspci output)\n\n");
+       fprintf(stderr,
+@@ -725,8 +1514,8 @@ static void usage(const char *n)
+               "  %s -w <base_address> regdomain N\n\n"
+               "- set a PCI id field to value N:\n"
+               "  %s -w <base_address> <field> N\n"
+-              "  where <field> is on of:\n    ", n, n, n);
+-      for (i = 0; i < eeprom_addr_len; i++)
++              "  where <field> is one of:\n    ", n, n, n);
++      for (i = 0; i < ARRAY_SIZE(eeprom_addr); i++)
+               fprintf(stderr, " %s", eeprom_addr[i].name);
+       fprintf(stderr, "\n\n");
+       fprintf(stderr,
+@@ -739,19 +1528,457 @@ static void usage(const char *n)
+               "unlawful radio transmissions!\n\n");
+ }
++static void dump_capabilities(struct ath5k_eeprom_info *ee)
++{
++      u_int8_t has_a, has_b, has_g, has_rfkill, turbog_dis, turboa_dis;
++      u_int8_t xr2_dis, xr5_dis, has_crystal;
++
++      has_a = AR5K_EEPROM_HDR_11A(ee->ee_header);
++      has_b = AR5K_EEPROM_HDR_11B(ee->ee_header);
++      has_g = AR5K_EEPROM_HDR_11G(ee->ee_header);
++      has_rfkill = AR5K_EEPROM_HDR_RFKILL(ee->ee_header);
++      has_crystal = AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1);
++      turbog_dis = AR5K_EEPROM_HDR_T_2GHZ_DIS(ee->ee_header);
++      turboa_dis = AR5K_EEPROM_HDR_T_5GHZ_DIS(ee->ee_header);
++      xr2_dis = AR5K_EEPROM_HDR_XR2_DIS(ee->ee_misc0);
++      xr5_dis = AR5K_EEPROM_HDR_XR5_DIS(ee->ee_misc0);
++
++      printf("|================= Capabilities ================|\n");
++
++      printf("| 802.11a Support: ");
++      if (has_a)
++              printf(" yes |");
++      else
++              printf(" no  |");
++
++      printf(" Turbo-A disabled:");
++      if (turboa_dis)
++              printf(" yes |\n");
++      else
++              printf(" no  |\n");
++
++      printf("| 802.11b Support: ");
++      if (has_b)
++              printf(" yes |");
++      else
++              printf(" no  |");
++
++      printf(" Turbo-G disabled:");
++      if (turbog_dis)
++              printf(" yes |\n");
++      else
++              printf(" no  |\n");
++
++      printf("| 802.11g Support: ");
++      if (has_g)
++              printf(" yes |");
++      else
++              printf(" no  |");
++
++      printf(" 2GHz XR disabled:");
++      if (xr2_dis)
++              printf(" yes |\n");
++      else
++              printf(" no  |\n");
++
++      printf("| RFKill  Support: ");
++      if (has_rfkill)
++              printf(" yes |");
++      else
++              printf(" no  |");
++
++      printf(" 5GHz XR disabled:");
++      if (xr5_dis)
++              printf(" yes |\n");
++      else
++              printf(" no  |\n");
++
++      if (has_crystal != 2) {
++              printf("| 32kHz   Crystal: ");
++              if (has_crystal)
++                      printf(" yes |");
++              else
++                      printf(" no  |");
++
++              printf("                       |\n");
++      }
++
++      printf("\\===============================================/\n");
++}
++
++static void dump_calinfo_for_mode(int mode, struct ath5k_eeprom_info *ee)
++{
++      int i;
++
++      printf("|=========================================================|\n");
++      printf("| I power:              0x%02x |", ee->ee_i_cal[mode]);
++      printf(" Q power:              0x%02x |\n", ee->ee_q_cal[mode]);
++      printf("| Use fixed bias:       0x%02x |", ee->ee_fixed_bias[mode]);
++      printf(" Max turbo power:      0x%02x |\n", ee->ee_turbo_max_power[mode]);
++      printf("| Max XR power:         0x%02x |", ee->ee_xr_power[mode]);
++      printf(" Switch Settling Time: 0x%02x |\n", ee->ee_switch_settling[mode]);
++      printf("| Tx/Rx attenuation:    0x%02x |", ee->ee_ant_tx_rx[mode]);
++      printf(" TX end to XLNA On:    0x%02x |\n", ee->ee_tx_end2xlna_enable[mode]);
++      printf("| TX end to XPA Off:    0x%02x |", ee->ee_tx_end2xpa_disable[mode]);
++      printf(" TX end to XPA On:     0x%02x |\n", ee->ee_tx_frm2xpa_enable[mode]);
++      printf("| 62db Threshold:       0x%02x |", ee->ee_thr_62[mode]);
++      printf(" XLNA gain:            0x%02x |\n", ee->ee_xlna_gain[mode]);
++      printf("| XPD:                  0x%02x |", ee->ee_xpd[mode]);
++      printf(" XPD gain:             0x%02x |\n", ee->ee_x_gain[mode]);
++      printf("| I gain:               0x%02x |", ee->ee_i_gain[mode]);
++      printf(" Tx/Rx margin:         0x%02x |\n", ee->ee_margin_tx_rx[mode]);
++      printf("| False detect backoff: 0x%02x |", ee->ee_false_detect[mode]);
++      printf(" Noise Floor Threshold: %3d |\n", ee->ee_noise_floor_thr[mode]);
++      printf("| ADC desired size:      %3d |", ee->ee_adc_desired_size[mode]);
++      printf(" PGA desired size:      %3d |\n", ee->ee_pga_desired_size[mode]);
++      printf("|=========================================================|\n");
++      for (i = 0; i < AR5K_EEPROM_N_PCDAC; i++) {
++              printf("| Antenna control  %2i:  0x%02x |", i, ee->ee_ant_control[mode][i]);
++              i++;
++              printf(" Antenna control  %2i:  0x%02x |\n", i, ee->ee_ant_control[mode][i]);
++      }
++      printf("|=========================================================|\n");
++      for (i = 0; i < AR5K_EEPROM_N_OBDB; i++) {
++              printf("| Octave Band %i:          %2i |", i, ee->ee_ob[mode][i]);
++              printf(" db %i:                   %2i |\n", i, ee->ee_db[mode][i]);
++      }
++      printf("\\=========================================================/\n");
++}
++
++static void dump_power_calinfo_for_mode(int mode, struct ath5k_eeprom_info *ee)
++{
++      struct ath5k_chan_pcal_info *chan_pcal_info;
++      u_int16_t cal_piers;
++      int i, c;
++
++      switch (mode) {
++      case AR5K_EEPROM_MODE_11A:
++              chan_pcal_info = ee->ee_pwr_cal_a;
++              cal_piers = ee->ee_cal_piers_a;
++              break;
++      case AR5K_EEPROM_MODE_11B:
++              chan_pcal_info = ee->ee_pwr_cal_b;
++              cal_piers = ee->ee_cal_piers_b;
++              break;
++      case AR5K_EEPROM_MODE_11G:
++              chan_pcal_info = ee->ee_pwr_cal_g;
++              cal_piers = ee->ee_cal_piers_g;
++              break;
++      default:
++              return;
++      }
++
++      printf("/=================== Per channel power calibration ====================\\\n");
++      printf("| Freq | pwr_0 | pwr_1 | pwr_2 | pwr_3 |pwrx3_0|pwrx3_1|pwrx3_2|max_pwr|\n");
++      printf("|      | pcdac | pcdac | pcdac | pcdac | pcdac | pcdac | pcdac |       |\n");
++
++      for (i = 0; i < cal_piers; i++) {
++              char buf[16];
++
++              printf("|======|=======|=======|=======|=======|=======|=======|=======|=======|\n");
++              printf("| %4i |", chan_pcal_info[i].freq);
++              for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) {
++                      printf(" %2i.%02i |", chan_pcal_info[i].pwr_x0[c] / 4,
++                             chan_pcal_info[i].pwr_x0[c] % 4);
++              }
++              for (c = 0; c < AR5K_EEPROM_N_XPD3_POINTS; c++) {
++                      printf(" %2i.%02i |", chan_pcal_info[i].pwr_x3[c] / 4,
++                             chan_pcal_info[i].pwr_x3[c] % 4);
++              }
++              printf(" %2i.%02i |\n", chan_pcal_info[i].max_pwr / 4,
++                     chan_pcal_info[i].max_pwr % 4);
++
++              printf("|      |");
++              for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) {
++                      snprintf(buf, sizeof(buf), "[%i]",
++                               chan_pcal_info[i].pcdac_x0[c]);
++                      printf("%6s |", buf);
++              }
++              for (c = 0; c < AR5K_EEPROM_N_XPD3_POINTS; c++) {
++                      snprintf(buf, sizeof(buf), "[%i]",
++                               chan_pcal_info[i].pcdac_x3[c]);
++                      printf("%6s |", buf);
++              }
++              printf("       |\n");
++
++      }
++      printf("\\======================================================================/\n");
++}
++
++static void dump_rate_calinfo_for_mode(int mode, struct ath5k_eeprom_info *ee)
++{
++      int i;
++      struct ath5k_rate_pcal_info *rate_pcal_info;
++      u_int16_t rate_target_pwr_num;
++
++      switch (mode) {
++      case AR5K_EEPROM_MODE_11A:
++              rate_pcal_info = ee->ee_rate_tpwr_a;
++              rate_target_pwr_num = ee->ee_rate_target_pwr_num_a;
++              break;
++      case AR5K_EEPROM_MODE_11B:
++              rate_pcal_info = ee->ee_rate_tpwr_b;
++              rate_target_pwr_num = ee->ee_rate_target_pwr_num_b;
++              break;
++      case AR5K_EEPROM_MODE_11G:
++              rate_pcal_info = ee->ee_rate_tpwr_g;
++              rate_target_pwr_num = ee->ee_rate_target_pwr_num_g;
++              break;
++      default:
++              return;
++      }
++
++      printf("/============== Per rate power calibration ===========\\\n");
++      if (mode == AR5K_EEPROM_MODE_11B)
++              printf("| Freq |   1Mbit/s  | 2Mbit/s  | 5.5Mbit/s | 11Mbit/s |\n");
++      else
++              printf("| Freq | 6-24Mbit/s | 36Mbit/s |  48Mbit/s | 54Mbit/s |\n");
++
++      for (i = 0; i < rate_target_pwr_num; i++) {
++
++              printf("|======|============|==========|===========|==========|\n");
++              printf("| %4i |", rate_pcal_info[i].freq);
++              printf("    %2i.%02i   |",rate_pcal_info[i].target_power_6to24 /2,
++                                      rate_pcal_info[i].target_power_6to24 % 2);
++              printf("  %2i.%02i   |",rate_pcal_info[i].target_power_36 /2,
++                                      rate_pcal_info[i].target_power_36 % 2);
++              printf("   %2i.%02i   |",rate_pcal_info[i].target_power_48 /2,
++                                      rate_pcal_info[i].target_power_48 % 2);
++              printf("  %2i.%02i   |\n",rate_pcal_info[i].target_power_54 /2,
++                                      rate_pcal_info[i].target_power_54 % 2);
++      }
++      printf("\\=====================================================/\n");
++}
++
++static u_int32_t extend_tu(u_int32_t base_tu, u_int32_t val, u_int32_t mask)
++{
++      u_int32_t result;
++
++      result = (base_tu & ~mask) | (val & mask);
++      if ((base_tu & mask) > (val & mask))
++              result += mask + 1;
++      return result;
++}
++
++static void dump_timers_register(void *mem, u_int16_t mac_version)
++{
++#define AR5K_TIMER0_5210              0x802c  /* next TBTT */
++#define AR5K_TIMER0_5211              0x8028
++#define AR5K_TIMER0                   (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_TIMER0_5210 : AR5K_TIMER0_5211)
++
++#define AR5K_TIMER1_5210              0x8030  /* next DMA beacon */
++#define AR5K_TIMER1_5211              0x802c
++#define AR5K_TIMER1                   (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_TIMER1_5210 : AR5K_TIMER1_5211)
++
++#define AR5K_TIMER2_5210              0x8034  /* next SWBA interrupt */
++#define AR5K_TIMER2_5211              0x8030
++#define AR5K_TIMER2                   (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_TIMER2_5210 : AR5K_TIMER2_5211)
++
++#define AR5K_TIMER3_5210              0x8038  /* next ATIM window */
++#define AR5K_TIMER3_5211              0x8034
++#define AR5K_TIMER3                   (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_TIMER3_5210 : AR5K_TIMER3_5211)
++
++#define AR5K_TSF_L32_5210             0x806c  /* TSF (lower 32 bits) */
++#define AR5K_TSF_L32_5211             0x804c
++#define AR5K_TSF_L32                  (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
++
++#define AR5K_TSF_U32_5210             0x8070
++#define AR5K_TSF_U32_5211             0x8050
++#define AR5K_TSF_U32                  (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
++
++#define AR5K_BEACON_5210              0x8024
++#define AR5K_BEACON_5211              0x8020
++#define AR5K_BEACON                   (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_BEACON_5210 : AR5K_BEACON_5211)
++
++#define AR5K_LAST_TSTP                        0x8080
++
++      const int timer_mask = 0xffff;
++
++      u_int32_t timer0, timer1, timer2, timer3, now_tu;
++      u_int32_t timer0_tu, timer1_tu, timer2_tu, timer3_tu;
++      u_int64_t now_tsf;
++
++      timer0 = AR5K_REG_READ(AR5K_TIMER0);            /* 0x0000ffff */
++      timer1 = AR5K_REG_READ(AR5K_TIMER1_5211);       /* 0x0007ffff */
++      timer2 = AR5K_REG_READ(AR5K_TIMER2_5211);       /* 0x?1ffffff */
++      timer3 = AR5K_REG_READ(AR5K_TIMER3_5211);       /* 0x0000ffff */
++
++      now_tsf = ((u_int64_t)AR5K_REG_READ(AR5K_TSF_U32_5211) << 32)
++              | (u_int64_t)AR5K_REG_READ(AR5K_TSF_L32_5211);
++
++      now_tu = now_tsf >> 10;
++
++      timer0_tu = extend_tu(now_tu, timer0, 0xffff);
++      printf("TIMER0: 0x%08x, TBTT: %5u, TU: 0x%08x\n", timer0,
++             timer0 & timer_mask, timer0_tu);
++      timer1_tu = extend_tu(now_tu, timer1 >> 3, 0x7ffff >> 3);
++      printf("TIMER1: 0x%08x, DMAb: %5u, TU: 0x%08x (%+d)\n", timer1,
++             (timer1 >> 3) & timer_mask, timer1_tu, timer1_tu - timer0_tu);
++      timer2_tu = extend_tu(now_tu, timer2 >> 3, 0x1ffffff >> 3);
++      printf("TIMER2: 0x%08x, SWBA: %5u, TU: 0x%08x (%+d)\n", timer2,
++             (timer2 >> 3) & timer_mask, timer2_tu, timer2_tu - timer0_tu);
++      timer3_tu = extend_tu(now_tu, timer3, 0xffff);
++      printf("TIMER3: 0x%08x, ATIM: %5u, TU: 0x%08x (%+d)\n", timer3,
++             timer3 & timer_mask, timer3_tu, timer3_tu - timer0_tu);
++      printf("TSF: 0x%016llx, TSFTU: %5u, TU: 0x%08x\n",
++             (unsigned long long)now_tsf, now_tu & timer_mask, now_tu);
++
++      printf("BEACON: 0x%08x\n", AR5K_REG_READ(AR5K_BEACON));
++      printf("LAST_TSTP: 0x%08x\n", AR5K_REG_READ(AR5K_LAST_TSTP));
++}
++
++#define AR5K_KEYTABLE_0_5210          0x9000
++#define AR5K_KEYTABLE_0_5211          0x8800
++#define AR5K_KEYTABLE_0                       (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_KEYTABLE_0_5210 : \
++                                      AR5K_KEYTABLE_0_5211)
++
++#define AR5K_KEYTABLE(_n)             (AR5K_KEYTABLE_0_5211 + ((_n) << 5))
++#define AR5K_KEYTABLE_OFF(_n, x)      (AR5K_KEYTABLE(_n) + ((x) << 2))
++#define AR5K_KEYTABLE_VALID           0x00008000
++
++#define AR5K_KEYTABLE_SIZE_5210               64
++#define AR5K_KEYTABLE_SIZE_5211               128
++#define AR5K_KEYTABLE_SIZE            (mac_version == AR5K_SREV_MAC_AR5210 ? \
++                                      AR5K_KEYTABLE_SIZE_5210 : \
++                                      AR5K_KEYTABLE_SIZE_5211)
++
++static void keycache_dump(void *mem, u_int16_t mac_version)
++{
++      int i, keylen;
++      u_int32_t val0, val1, val2, val3, val4, keytype, ant, mac0, mac1;
++
++      /* dump all 128 entries */
++      printf("Dumping keycache entries...\n");
++      for (i = 0; i < AR5K_KEYTABLE_SIZE; i++) {
++              mac1 = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 7));
++              if (mac1 & AR5K_KEYTABLE_VALID) {
++                      val0    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 0));
++                      val1    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 1));
++                      val2    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 2));
++                      val3    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 3));
++                      val4    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 4));
++                      keytype = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 5));
++                      ant = keytype & 8;
++                      keytype &= ~8;
++                      switch (keytype) {
++                      case 0: /* WEP40  */ keylen =  40 / 8; break;
++                      case 1: /* WEP104 */ keylen = 104 / 8; break;
++                      case 3: /* WEP128 */ keylen = 128 / 8; break;
++                      case 4: /* TKIP   */ keylen = 128 / 8; break;
++                      case 5: /* AES    */ keylen = 128 / 8; break;
++                      case 6: /* CCM    */ keylen = 128 / 8; break;
++                      default:             keylen = 0;       break;
++                      }
++                      mac0 = AR5K_REG_READ(AR5K_KEYTABLE_OFF(i, 6));
++
++                      printf("[%3u] keytype %d [%s%s%s%s%s%s%s%s] mac %02x:%02x:%02x:%02x:%02x:%02x key:%08x-%08x-%08x-%08x-%08x\n",
++                             i,
++                             keytype,
++                             keytype == 0 ? "WEP40 " : "",
++                             keytype == 1 ? "WEP104" : "",
++                             keytype == 3 ? "WEP128" : "",
++                             keytype == 4 ? "TKIP  " : "",
++                             keytype == 5 ? "AES   " : "",
++                             keytype == 6 ? "CCM   " : "",
++                             keytype == 7 ? "NULL  " : "",
++                             ant     == 8 ? "+ANT"   : "",
++                             ((mac0 <<  1) & 0xff),
++                             ((mac0 >>  7) & 0xff),
++                             ((mac0 >> 15) & 0xff),
++                             ((mac0 >> 23) & 0xff),
++                             ((mac1 <<  1) & 0xff) | (mac0 >> 31),
++                             ((mac1 >>  7) & 0xff),
++                             val0, val1, val2, val3, val4);
++              }
++      }
++}
++
++/* copy key index (0) to key index (idx) */
++
++static void keycache_copy(void *mem, u_int16_t mac_version, int idx)
++{
++      u_int32_t val0, val1, val2, val3, val4, keytype, mac0, mac1;
++
++      printf("Copying keycache entry 0 to %d\n", idx);
++      if (idx < 0 || idx >= AR5K_KEYTABLE_SIZE) {
++              printf("invalid keycache index\n");
++              return;
++      }
++
++      val0    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 0));
++      val1    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 1));
++      val2    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 2));
++      val3    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 3));
++      val4    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 4));
++      keytype = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 5));
++      mac0    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 6));
++      mac1    = AR5K_REG_READ(AR5K_KEYTABLE_OFF(0, 7));
++
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 0), val0);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 1), val1);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 2), val2);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 3), val3);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 4), val4);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 5), keytype);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 6), mac0);
++      AR5K_REG_WRITE(AR5K_KEYTABLE_OFF(idx, 7), mac1);
++}
++
++static void sta_id0_id1_dump(void *mem)
++{
++#define AR5K_STA_ID0                  0x8000
++#define AR5K_STA_ID1                  0x8004
++#define AR5K_STA_ID1_AP                 0x00010000
++#define AR5K_STA_ID1_ADHOC              0x00020000
++#define AR5K_STA_ID1_NO_KEYSRCH               0x00080000
++
++      u_int32_t sta_id0, sta_id1;
++
++      sta_id0 = AR5K_REG_READ(AR5K_STA_ID0);
++      sta_id1 = AR5K_REG_READ(AR5K_STA_ID1);
++      printf("STA_ID0: %02x:%02x:%02x:%02x:%02x:%02x\n",
++             (sta_id0 >>  0) & 0xff,
++             (sta_id0 >>  8) & 0xff,
++             (sta_id0 >> 16) & 0xff,
++             (sta_id0 >> 24) & 0xff,
++             (sta_id1 >>  0) & 0xff,
++             (sta_id1 >>  8) & 0xff);
++      printf("STA_ID1: 0x%08x, AP: %d, IBSS: %d, KeyCache Disable: %d\n",
++             sta_id1,
++             sta_id1 & AR5K_STA_ID1_AP ? 1 : 0,
++             sta_id1 & AR5K_STA_ID1_ADHOC ? 1 : 0,
++             sta_id1 & AR5K_STA_ID1_NO_KEYSRCH ? 1 : 0);
++}
++
+ int
+ CMD(athinfo)(int argc, char *argv[])
+ {
+-      u_int32_t dev_addr;
+-      u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;
+-      u_int16_t eeprom_version, mac_version, regdomain, has_crystal, ee_magic;
+-      u_int8_t error, has_a, has_b, has_g, has_rfkill, eeprom_size;
+-      int byte_size = 0;
++      unsigned long long dev_addr;
++      u_int16_t srev, phy_rev_5ghz, phy_rev_2ghz, ee_magic;
++      u_int8_t mac_version, mac_revision;
++      u_int8_t error, eeprom_size, dev_type, eemap;
++      struct ath5k_eeprom_info *ee;
++      unsigned int byte_size = 0;
+       void *mem;
+       int fd;
+-      int i, anr = 1;
++      unsigned int i;
++      int anr = 1;
+       int do_write = 0;       /* default: read only */
+       int do_dump = 0;
++      int reg_read = 0;
++      int reg_write = 0;
++      unsigned int reg_write_val = 0;
++      unsigned int timer_count = 1;
++      int do_keycache_dump = 0;
++      int keycache_copy_idx = 0;
+       struct {
+               int valid;
+@@ -759,7 +1986,7 @@ CMD(athinfo)(int argc, char *argv[])
+       } gpio_set[AR5K_NUM_GPIO];
+       int nr_gpio_set = 0;
+-      for (i = 0; i < sizeof(gpio_set) / sizeof(gpio_set[0]); i++)
++      for (i = 0; i < ARRAY_SIZE(gpio_set); i++)
+               gpio_set[i].valid = 0;
+       if (argc < 2) {
+@@ -769,6 +1996,15 @@ CMD(athinfo)(int argc, char *argv[])
+       while (anr < argc && argv[anr][0] == '-') {
+               switch (argv[anr][1]) {
++              case 't':
++                      if (++anr < argc) {
++                              timer_count = atoi(argv[anr]);
++                              printf("timer_count:%d\n", timer_count);
++                      } else {
++                              usage(argv[0]);
++                              return 0;
++                      }
++                      break;
+               case 'w':
+                       do_write = 1;
+                       break;
+@@ -777,7 +2013,7 @@ CMD(athinfo)(int argc, char *argv[])
+                       if (strlen(argv[anr]) != 3 || argv[anr][1] != ':' ||
+                           argv[anr][0] < '0' || argv[anr][0] > '5' ||
+                           (argv[anr][2] != '0' && argv[anr][2] != '1')) {
+-                              err("invalid gpio spec. %s", argv[anr]);
++                              err("invalid GPIO spec. %s", argv[anr]);
+                               return 2;
+                       }
+                       gpio_set[argv[anr][0] - '0'].valid = 1;
+@@ -797,6 +2033,25 @@ CMD(athinfo)(int argc, char *argv[])
+                       do_dump = 1;
+                       break;
++              case 'R':
++                      anr++;
++                      reg_read = strtoul(argv[anr], NULL, 16);
++                      break;
++
++              case 'W':
++                      anr++;
++                      reg_write = strtoul(argv[anr++], NULL, 16);
++                      reg_write_val = strtoul(argv[anr], NULL, 16);
++                      break;
++
++              case 'k':
++                      do_keycache_dump = 1;
++                      break;
++
++              case 'K':
++                      keycache_copy_idx = atoi(argv[++anr]);
++                      break;
++
+               case 'h':
+                       usage(argv[0]);
+                       return 0;
+@@ -805,10 +2060,10 @@ CMD(athinfo)(int argc, char *argv[])
+               default:
+                       err("unknown option %s", argv[anr]);
+                       return 2;
+-              }               /* switch (argv[anr][1]) */
++              }
+               anr++;
+-      }                       /* while (anr < argc && ...) */
++      }
+       if (anr >= argc) {
+               err("missing device address");
+@@ -816,7 +2071,7 @@ CMD(athinfo)(int argc, char *argv[])
+               return 3;
+       }
+-      dev_addr = strtoul(argv[anr], NULL, 16);
++      dev_addr = strtoull(argv[anr], NULL, 16);
+       fd = open("/dev/mem", O_RDWR);
+       if (fd < 0) {
+@@ -828,7 +2083,7 @@ CMD(athinfo)(int argc, char *argv[])
+                  MAP_SHARED | MAP_FILE, fd, dev_addr);
+       if (mem == MAP_FAILED) {
+-              printf("Mmap of device at 0x%08X for 0x%X bytes failed - "
++              printf("mmap of device at 0x%08llX for 0x%X bytes failed - "
+                      "%s\n", dev_addr, AR5K_PCI_MEM_SIZE, strerror(errno));
+               return -3;
+       }
+@@ -856,10 +2111,31 @@ CMD(athinfo)(int argc, char *argv[])
+       AR5K_REG_DISABLE_BITS(AR5K_PCICFG, AR5K_PCICFG_SPWR_DN);
+       usleep(500);
++      if (reg_read) {
++              printf("READ %04x = %08x\n", reg_read, AR5K_REG_READ(reg_read));
++              return 0;
++      }
++
++      if (reg_write) {
++              printf("WRITE %04x = %08x\n", reg_write, reg_write_val);
++              AR5K_REG_WRITE(reg_write, reg_write_val);
++              return 0;
++      }
++
+       srev = AR5K_REG_READ(AR5K_SREV);
+-      mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER) << 4;
++      if (srev >= 0x0100) {
++              printf("MAC revision 0x%04x is not supported!\n", srev);
++              return -1;
++      }
++      mac_version = srev & AR5K_SREV_VER;
++      mac_revision = srev & AR5K_SREV_REV;
+-      /* Verify eeprom magic value first */
++      printf(" -==Device Information==-\n");
++
++      printf("MAC Revision: %-5s (0x%02x)\n",
++             ath5k_hw_get_mac_name(mac_revision), mac_revision);
++
++      /* Verify EEPROM magic value first */
+       error = ath5k_hw_eeprom_read(mem, AR5K_EEPROM_MAGIC, &ee_magic,
+                                    mac_version);
+@@ -872,157 +2148,114 @@ CMD(athinfo)(int argc, char *argv[])
+               printf("Warning: Invalid EEPROM Magic number!\n");
+       }
+-      error = ath5k_hw_eeprom_read(mem, AR5K_EEPROM_HDR, &eeprom_header,
+-                                   mac_version);
+-
+-      if (error) {
+-              printf("Unable to read EEPROM Header!\n");
+-              return -1;
+-      }
+-
+-      error = ath5k_hw_eeprom_read(mem, AR5K_EEPROM_VERSION, &eeprom_version,
+-                                   mac_version);
+-
+-      if (error) {
+-              printf("Unable to read EEPROM version!\n");
++      ee = calloc(sizeof(struct ath5k_eeprom_info), 1);
++      if (!ee) {
++              printf("Cannot allocate memory for EEPROM information\n");
+               return -1;
+       }
+-      error = ath5k_hw_eeprom_read(mem, AR5K_EEPROM_REG_DOMAIN, &regdomain,
+-                                   mac_version);
+-
+-      if (error) {
+-              printf("Unable to read Regdomain!\n");
++      if (ath5k_eeprom_init(mem, mac_version, ee)) {
++              printf("EEPROM init failed\n");
+               return -1;
+       }
+-      if (eeprom_version >= 0x4000) {
+-              error = ath5k_hw_eeprom_read(mem, AR5K_EEPROM_MISC0,
+-                                           &has_crystal, mac_version);
+-
+-              if (error) {
+-                      printf("Unable to read EEPROM Misc data!\n");
+-                      return -1;
+-              }
+-
+-              has_crystal = AR5K_EEPROM_HAS32KHZCRYSTAL(has_crystal);
+-      } else {
+-              has_crystal = 2;
+-      }
+-
+       eeprom_size = AR5K_REG_MS(AR5K_REG_READ(AR5K_PCICFG),
+                                 AR5K_PCICFG_EESIZE);
+-      has_a = AR5K_EEPROM_HDR_11A(eeprom_header);
+-      has_b = AR5K_EEPROM_HDR_11B(eeprom_header);
+-      has_g = AR5K_EEPROM_HDR_11G(eeprom_header);
+-      has_rfkill = AR5K_EEPROM_HDR_RFKILL(eeprom_header);
++      dev_type = AR5K_EEPROM_HDR_DEVICE(ee->ee_header);
++      eemap = AR5K_EEPROM_EEMAP(ee->ee_misc0);
+-      if (has_a)
++      /* 1 = ?? 2 = ?? 3 = card 4 = wmac */
++      printf("Device type:  %1i\n", dev_type);
++
++      if (AR5K_EEPROM_HDR_11A(ee->ee_header))
+               phy_rev_5ghz = ath5k_hw_radio_revision(mac_version, mem, 1);
+       else
+               phy_rev_5ghz = 0;
+-      if (has_b)
++      if (AR5K_EEPROM_HDR_11B(ee->ee_header))
+               phy_rev_2ghz = ath5k_hw_radio_revision(mac_version, mem, 0);
+       else
+               phy_rev_2ghz = 0;
+-      printf(" -==Device Information==-\n");
+-
+-      printf("MAC Version:  %-5s (0x%02x)\n",
+-             ath5k_hw_get_part_name(AR5K_VERSION_VER, mac_version),
+-             mac_version);
+-
+-      printf("MAC Revision: %-5s (0x%02x)\n",
+-             ath5k_hw_get_part_name(AR5K_VERSION_VER, srev), srev);
+-
+-      /* Single-chip PHY with a/b/g support */
+-      if (has_b && !phy_rev_2ghz) {
+-              printf("PHY Revision: %-5s (0x%02x)\n",
+-                     ath5k_hw_get_part_name(AR5K_VERSION_RAD, phy_rev_5ghz),
+-                     phy_rev_5ghz);
+-              phy_rev_5ghz = 0;
+-      }
+-
+-      /* Single-chip PHY with b/g support */
+-      if (!has_a) {
+-              printf("PHY Revision: %-5s (0x%02x)\n",
+-                     ath5k_hw_get_part_name(AR5K_VERSION_RAD, phy_rev_2ghz),
+-                     phy_rev_2ghz);
+-              phy_rev_2ghz = 0;
+-      }
+-
+-      /* Different chip for 5Ghz and 2Ghz */
+       if (phy_rev_5ghz) {
+-              printf("5Ghz PHY Revision: %-5s (0x%2x)\n",
+-                     ath5k_hw_get_part_name(AR5K_VERSION_RAD, phy_rev_5ghz),
+-                     phy_rev_5ghz);
++              printf("5GHz PHY Revision: %-5s (0x%02x)\n",
++                     ath5k_hw_get_phy_name(phy_rev_5ghz), phy_rev_5ghz);
+       }
+       if (phy_rev_2ghz) {
+-              printf("2Ghz PHY Revision: %-5s (0x%2x)\n",
+-                     ath5k_hw_get_part_name(AR5K_VERSION_RAD, phy_rev_2ghz),
+-                     phy_rev_2ghz);
++              printf("2GHz PHY Revision: %-5s (0x%02x)\n",
++                     ath5k_hw_get_phy_name(phy_rev_2ghz), phy_rev_2ghz);
+       }
+-      printf(" -==EEPROM Information==-\n");
+-
+-      printf("EEPROM Version:     %x.%x\n",
+-             (eeprom_version & 0xF000) >> 12, eeprom_version & 0xFFF);
++      printf("\n");
++      printf("/============== EEPROM Information =============\\\n");
++      printf("| EEPROM Version:   %1x.%1x |",
++             (ee->ee_version & 0xF000) >> 12, ee->ee_version & 0xFFF);
+-      printf("EEPROM Size: ");
++      printf(" EEPROM Size: ");
+       if (eeprom_size == 0) {
+-              printf("       4K\n");
+-              byte_size = 4096;
++              printf("  4 kbit |\n");
++              byte_size = 4096 / 8;
+       } else if (eeprom_size == 1) {
+-              printf("       8K\n");
+-              byte_size = 8192;
++              printf("  8 kbit |\n");
++              byte_size = 8192 / 8;
+       } else if (eeprom_size == 2) {
+-              printf("       16K\n");
+-              byte_size = 16384;
++              printf(" 16 kbit |\n");
++              byte_size = 16384 / 8;
+       } else
+-              printf("       ??\n");
++              printf(" unknown |\n");
+-      printf("Regulatory Domain:  0x%X\n", regdomain);
+-
+-      printf(" -==== Capabilities ====-\n");
+-
+-      printf("|  802.11a Support: ");
+-      if (has_a)
+-              printf("yes  |\n");
+-      else
+-              printf("no   |\n");
+-
+-      printf("|  802.11b Support: ");
+-      if (has_b)
+-              printf("yes  |\n");
+-      else
+-              printf("no   |\n");
++      printf("| EEMAP:              %i |", eemap);
+-      printf("|  802.11g Support: ");
+-      if (has_g)
+-              printf("yes  |\n");
+-      else
+-              printf("no   |\n");
++      printf(" Reg. Domain:     0x%02X |\n", ee->ee_regdomain);
+-      printf("|  RFKill  Support: ");
+-      if (has_rfkill)
+-              printf("yes  |\n");
+-      else
+-              printf("no   |\n");
++      dump_capabilities(ee);
++      printf("\n");
+-      if (has_crystal != 2) {
+-              printf("|  32KHz   Crystal: ");
+-              if (has_crystal)
+-                      printf("yes  |\n");
+-              else
+-                      printf("no   |\n");
++      printf("/=========================================================\\\n");
++      printf("|          Calibration data common for all modes          |\n");
++      printf("|=========================================================|\n");
++      printf("|          CCK/OFDM gain delta:            %2i             |\n", ee->ee_cck_ofdm_gain_delta);
++      printf("|          CCK/OFDM power delta:           %2i             |\n", ee->ee_cck_ofdm_power_delta);
++      printf("|          Scaled CCK delta:               %2i             |\n", ee->ee_scaled_cck_delta);
++      printf("|          2GHz Antenna gain:              %2i             |\n", AR5K_EEPROM_ANT_GAIN_2GHZ(ee->ee_ant_gain));
++      printf("|          5GHz Antenna gain:              %2i             |\n", AR5K_EEPROM_ANT_GAIN_5GHZ(ee->ee_ant_gain));
++      printf("|          Turbo 2W maximum dBm:           %2i             |\n", AR5K_EEPROM_HDR_T_5GHZ_DBM(ee->ee_header));
++      printf("|          Target power start:          0x%03x             |\n", AR5K_EEPROM_TARGET_PWRSTART(ee->ee_misc1));
++      printf("|          EAR Start:                   0x%03x             |\n", AR5K_EEPROM_EARSTART(ee->ee_misc0));
++      printf("\\=========================================================/\n");
++
++      printf("\n");
++      if (AR5K_EEPROM_HDR_11A(ee->ee_header)) {
++              printf("/=========================================================\\\n");
++              printf("|          Calibration data for 802.11a operation         |\n");
++              dump_calinfo_for_mode(AR5K_EEPROM_MODE_11A, ee);
++              dump_rate_calinfo_for_mode(AR5K_EEPROM_MODE_11A, ee);
++              dump_power_calinfo_for_mode(AR5K_EEPROM_MODE_11A, ee);
++              printf("\n");
++      }
++
++      if (AR5K_EEPROM_HDR_11B(ee->ee_header)) {
++              printf("/=========================================================\\\n");
++              printf("|          Calibration data for 802.11b operation         |\n");
++              dump_calinfo_for_mode(AR5K_EEPROM_MODE_11B, ee);
++              dump_rate_calinfo_for_mode(AR5K_EEPROM_MODE_11B, ee);
++              dump_power_calinfo_for_mode(AR5K_EEPROM_MODE_11B, ee);
++              printf("\n");
++      }
++
++      if (AR5K_EEPROM_HDR_11G(ee->ee_header)) {
++              printf("/=========================================================\\\n");
++              printf("|          Calibration data for 802.11g operation         |\n");
++              dump_calinfo_for_mode(AR5K_EEPROM_MODE_11G, ee);
++              dump_rate_calinfo_for_mode(AR5K_EEPROM_MODE_11G, ee);
++              dump_power_calinfo_for_mode(AR5K_EEPROM_MODE_11G, ee);
++              printf("\n");
+       }
+-      printf(" ========================\n");
+       /* print current GPIO settings */
+-      printf("GPIO registers: CR %08x DO %08x DI %08x\n",
++      printf("GPIO registers: CR 0x%08x, DO 0x%08x, DI 0x%08x\n",
+              AR5K_REG_READ(AR5K_GPIOCR), AR5K_REG_READ(AR5K_GPIODO),
+              AR5K_REG_READ(AR5K_GPIODI));
+@@ -1030,18 +2263,18 @@ CMD(athinfo)(int argc, char *argv[])
+               u_int16_t data;
+               FILE *dumpfile = fopen("ath-eeprom-dump.bin", "w");
+-              printf("\nEEPROM dump (%d byte)\n", byte_size);
++              printf("\nEEPROM dump (%d bytes)\n", byte_size);
+               printf("==============================================");
+-              for (i = 1; i <= (byte_size / 2); i++) {
++              for (i = 0; i < byte_size / 2; i++) {
+                       error =
+                           ath5k_hw_eeprom_read(mem, i, &data, mac_version);
+                       if (error) {
+                               printf("\nUnable to read at %04x\n", i);
+                               continue;
+                       }
+-                      if (!((i - 1) % 8))
+-                              printf("\n%04x:  ", i);
+-                      printf("%04x ", data);
++                      if (!(i % 8))
++                              printf("\n%04x: ", i);
++                      printf(" %04x", data);
+                       fwrite(&data, 2, 1, dumpfile);
+               }
+               printf("\n==============================================\n");
+@@ -1054,18 +2287,18 @@ CMD(athinfo)(int argc, char *argv[])
+               u_int32_t old_cr = rcr, old_do = rdo;
+               int rc;
+-              if (mac_version >= AR5K_SREV_VER_AR5213 && !nr_gpio_set) {
+-                      dbg("new MAC %x (>= AR5213) set gpio4 to low",
++              if (mac_version >= AR5K_SREV_MAC_AR5213 && !nr_gpio_set) {
++                      dbg("new MAC %x (>= AR5213) set GPIO4 to low",
+                           mac_version);
+                       gpio_set[4].valid = 1;
+                       gpio_set[4].value = 0;
+               }
+-              /* set gpios */
++              /* set GPIOs */
+               dbg("old GPIO CR %08x DO %08x DI %08x",
+                   rcr, rdo, AR5K_REG_READ(AR5K_GPIODI));
+-              for (i = 0; i < sizeof(gpio_set) / sizeof(gpio_set[0]); i++) {
++              for (i = 0; i < ARRAY_SIZE(gpio_set); i++) {
+                       if (gpio_set[i].valid) {
+                               rcr |= AR5K_GPIOCR_OUT(i);      /* we use mode 3 */
+                               rcr &= ~AR5K_GPIOCR_INT_SEL(i);
+@@ -1111,5 +2344,17 @@ CMD(athinfo)(int argc, char *argv[])
+               return rc;
+       }
++
++      sta_id0_id1_dump(mem);
++
++      for (i = 0; i < timer_count; i++)
++              dump_timers_register(mem, mac_version);
++
++      if (do_keycache_dump)
++              keycache_dump(mem, mac_version);
++
++      if (keycache_copy_idx > 0)
++              keycache_copy(mem, mac_version, keycache_copy_idx);
++
+       return 0;
+ }
diff --git a/net/madwifi/patches/408-changeset_r3337.patch b/net/madwifi/patches/408-changeset_r3337.patch
new file mode 100644 (file)
index 0000000..c78daf4
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/THANKS
++++ b/THANKS
+@@ -129,6 +129,7 @@ Derek J Smithies
+ jhansen
+ Benoit Papillault
+ Russell Harmon
++Alessandro Erta
+ Apologies to anyone whose name was unintentionally left off.
+ Please let us know if you think your name should be mentioned here!
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -3147,7 +3147,7 @@ ath_tx_startraw(struct net_device *dev, 
+       struct ath_softc *sc = dev->priv;
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
+-              (SKB_CB(skb) + sizeof(struct ieee80211_cb));
++              (SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
+       const HAL_RATE_TABLE *rt;
+       unsigned int pktlen, hdrlen, try0, power;
+       HAL_PKT_TYPE atype;
+--- a/net80211/ieee80211_monitor.c
++++ b/net80211/ieee80211_monitor.c
+@@ -128,8 +128,8 @@ struct ar5212_openbsd_desc {
+ void
+ ieee80211_monitor_encap(struct ieee80211vap *vap, struct sk_buff *skb)
+ {
+-      struct ieee80211_phy_params *ph =
+-              (struct ieee80211_phy_params *) (SKB_CB(skb) + sizeof(struct ieee80211_cb));
++      struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
++              (SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
+       SKB_CB(skb)->flags = M_RAW;
+       SKB_CB(skb)->ni = NULL;
+       SKB_CB(skb)->next = NULL;
diff --git a/net/madwifi/patches/409-wext_compat.patch b/net/madwifi/patches/409-wext_compat.patch
new file mode 100644 (file)
index 0000000..4497092
--- /dev/null
@@ -0,0 +1,133 @@
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -73,6 +73,13 @@
+        (_vap)->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO)
+ #define       RESCAN  1
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
++#define IWE(func, ...) func(&iweinfo, __VA_ARGS__)
++static struct iw_request_info iweinfo = { 0, 0 };
++#else
++#define IWE(func, ...) func(__VA_ARGS__)
++#endif
++
+ static void
+ pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt);
+@@ -1800,7 +1807,7 @@ giwscan_cb(void *arg, const struct ieee8
+               IEEE80211_ADDR_COPY(iwe.u.ap_addr.sa_data, se->se_macaddr);
+       else
+               IEEE80211_ADDR_COPY(iwe.u.ap_addr.sa_data, se->se_bssid);
+-      current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
++      current_ev = IWE(iwe_stream_add_event, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
+       /* We ran out of space in the buffer. */
+       if (last_ev == current_ev)
+@@ -1811,7 +1818,7 @@ giwscan_cb(void *arg, const struct ieee8
+       iwe.cmd = SIOCGIWESSID;
+       iwe.u.data.flags = 1;
+       iwe.u.data.length = se->se_ssid[1];
+-      current_ev = iwe_stream_add_point(current_ev,
++      current_ev = IWE(iwe_stream_add_point, current_ev,
+               end_buf, &iwe, (char *) se->se_ssid+2);
+       /* We ran out of space in the buffer. */
+@@ -1824,7 +1831,7 @@ giwscan_cb(void *arg, const struct ieee8
+               iwe.cmd = SIOCGIWMODE;
+               iwe.u.mode = se->se_capinfo & IEEE80211_CAPINFO_ESS ?
+                       IW_MODE_MASTER : IW_MODE_ADHOC;
+-              current_ev = iwe_stream_add_event(current_ev,
++              current_ev = IWE(iwe_stream_add_event, current_ev,
+                       end_buf, &iwe, IW_EV_UINT_LEN);
+               /* We ran out of space in the buffer. */
+@@ -1837,7 +1844,7 @@ giwscan_cb(void *arg, const struct ieee8
+       iwe.cmd = SIOCGIWFREQ;
+       iwe.u.freq.m = se->se_chan->ic_freq * 100000;
+       iwe.u.freq.e = 1;
+-      current_ev = iwe_stream_add_event(current_ev,
++      current_ev = IWE(iwe_stream_add_event, current_ev,
+               end_buf, &iwe, IW_EV_FREQ_LEN);
+       /* We ran out of space in the buffer. */
+@@ -1848,7 +1855,7 @@ giwscan_cb(void *arg, const struct ieee8
+       last_ev = current_ev;
+       iwe.cmd = IWEVQUAL;
+       set_quality(&iwe.u.qual, se->se_rssi, ATH_DEFAULT_NOISE);
+-      current_ev = iwe_stream_add_event(current_ev,
++      current_ev = IWE(iwe_stream_add_event, current_ev,
+               end_buf, &iwe, IW_EV_QUAL_LEN);
+       /* We ran out of space in the buffer */
+@@ -1863,7 +1870,7 @@ giwscan_cb(void *arg, const struct ieee8
+       else
+               iwe.u.data.flags = IW_ENCODE_DISABLED;
+       iwe.u.data.length = 0;
+-      current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, "");
++      current_ev = IWE(iwe_stream_add_point, current_ev, end_buf, &iwe, "");
+       /* We ran out of space in the buffer. */
+       if (last_ev == current_ev)
+@@ -1878,7 +1885,7 @@ giwscan_cb(void *arg, const struct ieee8
+               int r = se->se_rates[2 + j] & IEEE80211_RATE_VAL;
+               if (r != 0) {
+                       iwe.u.bitrate.value = r * (1000000 / 2);
+-                      current_val = iwe_stream_add_value(current_ev,
++                      current_val = IWE(iwe_stream_add_value, current_ev,
+                               current_val, end_buf, &iwe,
+                               IW_EV_PARAM_LEN);
+               }
+@@ -1887,7 +1894,7 @@ giwscan_cb(void *arg, const struct ieee8
+               int r = se->se_xrates[2+j] & IEEE80211_RATE_VAL;
+               if (r != 0) {
+                       iwe.u.bitrate.value = r * (1000000 / 2);
+-                      current_val = iwe_stream_add_value(current_ev,
++                      current_val = IWE(iwe_stream_add_value, current_ev,
+                               current_val, end_buf, &iwe,
+                               IW_EV_PARAM_LEN);
+               }
+@@ -1906,7 +1913,7 @@ giwscan_cb(void *arg, const struct ieee8
+       iwe.cmd = IWEVCUSTOM;
+       snprintf(buf, sizeof(buf), "bcn_int=%d", se->se_intval);
+       iwe.u.data.length = strlen(buf);
+-      current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
++      current_ev = IWE(iwe_stream_add_point, current_ev, end_buf, &iwe, buf);
+       /* We ran out of space in the buffer. */
+       if (last_ev == current_ev)
+@@ -1930,7 +1937,7 @@ giwscan_cb(void *arg, const struct ieee8
+                               rsn_leader, sizeof(rsn_leader) - 1);
+ #endif
+               if (iwe.u.data.length != 0) {
+-                      current_ev = iwe_stream_add_point(current_ev, end_buf,
++                      current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
+                               &iwe, buf);
+                       /* We ran out of space in the buffer */
+@@ -1956,7 +1963,7 @@ giwscan_cb(void *arg, const struct ieee8
+                       wpa_leader, sizeof(wpa_leader) - 1);
+ #endif
+               if (iwe.u.data.length != 0) {
+-                      current_ev = iwe_stream_add_point(current_ev, end_buf,
++                      current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
+                               &iwe, buf);
+                       /* We ran out of space in the buffer. */
+@@ -1975,7 +1982,7 @@ giwscan_cb(void *arg, const struct ieee8
+                       se->se_wme_ie, se->se_wme_ie[1] + 2,
+                       wme_leader, sizeof(wme_leader) - 1);
+               if (iwe.u.data.length != 0) {
+-                      current_ev = iwe_stream_add_point(current_ev, end_buf,
++                      current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
+                               &iwe, buf);
+                       /* We ran out of space in the buffer. */
+@@ -1993,7 +2000,7 @@ giwscan_cb(void *arg, const struct ieee8
+                       se->se_ath_ie, se->se_ath_ie[1] + 2,
+                       ath_leader, sizeof(ath_leader) - 1);
+               if (iwe.u.data.length != 0) {
+-                      current_ev = iwe_stream_add_point(current_ev, end_buf,
++                      current_ev = IWE(iwe_stream_add_point, current_ev, end_buf,
+                               &iwe, buf);
+                       /* We ran out of space in the buffer. */
diff --git a/net/madwifi/patches/410-ar231x_2.6.28.patch b/net/madwifi/patches/410-ar231x_2.6.28.patch
new file mode 100644 (file)
index 0000000..30d1c56
--- /dev/null
@@ -0,0 +1,281 @@
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
+@@ -33,20 +33,15 @@
+ #include "if_ath_ahb.h"
+ #include "ah_soc.h"
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+-#error "Kernel versions older than 2.6.19 are not supported!"
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
++#include <ar231x_platform.h>
+ #endif
+ struct ath_ahb_softc {
+       struct ath_softc        aps_sc;
+-#ifdef CONFIG_PM
+-      u32 aps_pmstate[16];
+-#endif
++      struct ar531x_config aps_config;
+ };
+-static struct ath_ahb_softc *sclist[2] = {NULL, NULL};
+-static u_int8_t num_activesc = 0;
+-
+ /*
+  * Module glue.
+  */
+@@ -101,13 +96,13 @@ ahb_enable_wmac(u_int16_t devid, u_int16
+               while (REG_READ(AR5315_PCI_MAC_PCICFG) & AR5315_PCI_MAC_PCICFG_SPWR_DN);
+       } else {
+               switch (wlanNum) {
+-              case AR531X_WLAN0_NUM:
++              case 0:
+                       reset = (AR531X_RESET_WLAN0 |
+                               AR531X_RESET_WARM_WLAN0_MAC |
+                               AR531X_RESET_WARM_WLAN0_BB);
+                       enable = AR531X_ENABLE_WLAN0;
+                       break;
+-              case AR531X_WLAN1_NUM:
++              case 1:
+                       reset = (AR531X_RESET_WLAN1 |
+                               AR531X_RESET_WARM_WLAN1_MAC |
+                               AR531X_RESET_WARM_WLAN1_BB);
+@@ -144,10 +139,10 @@ ahb_disable_wmac(u_int16_t devid, u_int1
+               *en &= ~AR5315_ARB_WLAN;
+       } else {
+               switch (wlanNum) {
+-              case AR531X_WLAN0_NUM:
++              case 0:
+                       enable = AR531X_ENABLE_WLAN0;
+                       break;
+-              case AR531X_WLAN1_NUM:
++              case 1:
+                       enable = AR531X_ENABLE_WLAN1;
+                       break;
+               default:
+@@ -159,29 +154,6 @@ ahb_disable_wmac(u_int16_t devid, u_int1
+ }
+-static int
+-exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
+-{
+-      struct ath_ahb_softc *sc = sclist[wlanNum];
+-      struct net_device *dev;
+-      u_int16_t devid;
+-
+-      if (sc == NULL)
+-              return -ENODEV; /* XXX: correct return value? */
+-
+-      dev = sc->aps_sc.sc_dev;
+-      ath_detach(dev);
+-      if (dev->irq)
+-              free_irq(dev->irq, dev);
+-      devid = sc->aps_sc.devid;
+-      config->tag = (void *)((unsigned long) devid);
+-
+-      ahb_disable_wmac(devid, wlanNum);
+-      free_netdev(dev);
+-      sclist[wlanNum] = NULL;
+-      return 0;
+-}
+-
+ static const char ubnt[] = "Ubiquiti Networks";
+ /* { vendorname, cardname, vendorid, cardid, subsys vendorid, subsys id, poweroffset } */
+ static const struct ath_hw_detect cards[] = {
+@@ -201,6 +173,114 @@ static const struct ath_hw_detect cards[
+       { ubnt, "Bullet5",             PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0xc205 },
+ };
++static void
++ahb_hw_detect(struct ath_ahb_softc *sc, const char *radio)
++{
++      u16 *radio_data = (u16 *) radio;
++      if (radio_data) {
++              u16 vendor, id, subvendor, subid;
++              vendor = radio_data[1];
++              id = radio_data[0];
++              subvendor = radio_data[8];
++              subid = radio_data[7];
++              ath_hw_detect(&sc->aps_sc, cards, ARRAY_SIZE(cards), vendor, id, subvendor, subid);
++      }
++}
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
++
++static int ahb_wmac_probe(struct platform_device *pdev)
++{
++      struct ar231x_board_config *bcfg = pdev->dev.platform_data;
++      struct ath_ahb_softc *sc;
++      struct net_device *dev;
++      struct resource *res;
++      const char *athname;
++      int err;
++
++      ahb_enable_wmac(bcfg->devid, pdev->id);
++      dev = alloc_netdev(sizeof(struct ath_ahb_softc), "wifi%d", ether_setup);
++      if (!dev)
++              return -ENOMEM;
++
++      sc = dev->priv;
++      sc->aps_sc.sc_dev = dev;
++
++      dev->irq = platform_get_irq(pdev, 0);
++      if (dev->irq <= 0) {
++              printk("%s: Cannot find IRQ resource\n", dev->name);
++              goto error;
++      }
++
++      res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++      if (!res) {
++              printk("%s: Cannot find MMIO resource\n", dev->name);
++              goto error;
++      }
++
++      dev->mem_start = KSEG1ADDR(res->start);
++      dev->mem_end = KSEG1ADDR(res->end);
++      sc->aps_sc.sc_iobase = (void __iomem *) dev->mem_start;
++      sc->aps_sc.sc_bdev = NULL;
++
++      /* bus information for the HAL */
++      sc->aps_config.board = (const struct ar531x_boarddata *) bcfg->config;
++      sc->aps_config.radio = bcfg->radio;
++      sc->aps_config.unit = pdev->id;
++      sc->aps_config.tag = NULL;
++
++      err = ath_attach(bcfg->devid, dev, &sc->aps_config);
++      if (err != 0) {
++              printk("%s: ath_attach failed: %d\n", dev->name, err);
++              goto error;
++      }
++
++      athname = ath_hal_probe(ATHEROS_VENDOR_ID, bcfg->devid);
++      printk(KERN_INFO "%s: %s: %s: mem=0x%lx, irq=%d\n",
++              dev_info, dev->name, athname ? athname : "Atheros ???", dev->mem_start, dev->irq);
++
++      if (request_irq(dev->irq, ath_intr, IRQF_SHARED|IRQF_DISABLED, dev->name, dev)) {
++              printk(KERN_WARNING "%s: %s: request_irq failed\n", dev_info, dev->name);
++              goto error;
++      }
++
++      sc->aps_sc.sc_softled = 1; /* SoftLED over GPIO */
++      sc->aps_sc.sc_ledpin = bcfg->config->sysLedGpio;
++      sc->aps_sc.sc_invalid = 0;
++      ahb_hw_detect(sc, bcfg->radio);
++      platform_set_drvdata(pdev, dev);
++      return 0;
++
++error_dev:
++      free_irq(dev->irq, dev);
++error:
++      free_netdev(dev);
++
++      return -ENODEV;
++}
++
++
++static int ahb_wmac_remove(struct platform_device *pdev)
++{
++      struct ar231x_board_config *bcfg = pdev->dev.platform_data;
++      struct net_device *dev;
++
++      dev = platform_get_drvdata(pdev);
++      ath_detach(dev);
++
++      if (dev->irq)
++              free_irq(dev->irq, dev);
++
++      ahb_disable_wmac(bcfg->devid, pdev->id);
++      free_netdev(dev);
++
++      return 0;
++}
++
++#else
++
++static struct ath_ahb_softc *sclist[2] = {NULL, NULL};
++
+ static int
+ init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
+ {
+@@ -253,7 +333,7 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+       sc->aps_sc.sc_iobase = (void __iomem *) dev->mem_start;
+       sc->aps_sc.sc_bdev = NULL;
+-      if (request_irq(dev->irq, ath_intr, IRQF_SHARED, dev->name, dev)) {
++      if (request_irq(dev->irq, ath_intr, IRQF_SHARED|IRQF_DISABLED, dev->name, dev)) {
+               printk(KERN_WARNING "%s: %s: request_irq failed\n", dev_info, dev->name);
+               goto bad3;
+       }
+@@ -263,21 +343,12 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+       athname = ath_hal_probe(ATHEROS_VENDOR_ID, devid);
+       printk(KERN_INFO "%s: %s: %s: mem=0x%lx, irq=%d\n",
+               dev_info, dev->name, athname ? athname : "Atheros ???", dev->mem_start, dev->irq);
+-      num_activesc++;
+       /* Ready to process interrupts */
+       sc->aps_sc.sc_softled = 1; /* SoftLED over GPIO */
+       sc->aps_sc.sc_ledpin = config->board->sysLedGpio;
+       sc->aps_sc.sc_invalid = 0;
+-      radio_data = (u16 *) config->radio;
+-      if (radio_data) {
+-              u16 vendor, id, subvendor, subid;
+-              vendor = radio_data[1];
+-              id = radio_data[0];
+-              subvendor = radio_data[8];
+-              subid = radio_data[7];
+-              ath_hw_detect(&sc->aps_sc, cards, ARRAY_SIZE(cards), vendor, id, subvendor, subid);
+-      }
++      ahb_hw_detect(sc, config->radio);
+       return 0;
+@@ -292,6 +363,29 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+       return -ENODEV;
+ }
++static int
++exit_ath_wmac(u_int16_t wlanNum, struct ar531x_config *config)
++{
++      struct ath_ahb_softc *sc = sclist[wlanNum];
++      struct net_device *dev;
++      u_int16_t devid;
++
++      if (sc == NULL)
++              return -ENODEV; /* XXX: correct return value? */
++
++      dev = sc->aps_sc.sc_dev;
++      ath_detach(dev);
++      if (dev->irq)
++              free_irq(dev->irq, dev);
++      devid = sc->aps_sc.devid;
++      config->tag = (void *)((unsigned long) devid);
++
++      ahb_disable_wmac(devid, wlanNum);
++      free_netdev(dev);
++      sclist[wlanNum] = NULL;
++      return 0;
++}
++
+ static int ahb_wmac_probe(struct platform_device *pdev)
+ {
+       u_int16_t devid;
+@@ -312,11 +406,18 @@ static int ahb_wmac_remove(struct platfo
+       return 0;
+ }
++#endif
++
+ static struct platform_driver ahb_wmac_driver = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
++      .driver.name = "ar231x-wmac",
++#else
+       .driver.name = "ar531x-wmac",
++#endif
+       .probe = ahb_wmac_probe,
+       .remove = ahb_wmac_remove
+ };
++
+ int
+ ath_ioctl_ethtool(struct ath_softc *sc, int cmd, void __user *addr)
+ {
diff --git a/net/madwifi/patches/411-autochannel_multi.patch b/net/madwifi/patches/411-autochannel_multi.patch
new file mode 100644 (file)
index 0000000..6e6d678
--- /dev/null
@@ -0,0 +1,347 @@
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -97,6 +97,123 @@ struct scan_state {
+ static void scan_restart_pwrsav(unsigned long);
+ static void scan_next(unsigned long);
++spinlock_t channel_lock = SPIN_LOCK_UNLOCKED;
++static LIST_HEAD(channels_inuse);
++
++struct channel_inuse {
++      struct list_head list;
++      struct ieee80211com *ic;
++      u16 freq;
++      u8 bw;
++};
++
++static inline u32
++get_signal(u8 bw, u8 distance)
++{
++      u32 v;
++
++      /* signal = 1 - (distance / bw)^2 [scale: 100] */
++      v = 100 * distance / bw;
++      v = (100 - ((v * v) / 100));
++      return v;
++}
++
++static u32
++get_overlap(u16 f1, u16 f2, u8 b1, u8 b2)
++{
++      u32 v;
++      u16 d, c;
++
++      /* add offsets for sidechannel interference */
++      b1 += (b1 / 5);
++      b2 += (b2 / 5);
++
++      /* use only one direction */
++      b1 /= 2;
++      b2 /= 2;
++
++      if (f1 + b1 < f2 - b2)
++              return 0;
++
++      d = f2 - f1;
++      c = d * b1 / (b1 + b2);
++      v = get_signal(b1, c);
++
++      return v * v / 100;
++}
++
++static u8
++get_channel_bw(struct ieee80211_channel *c)
++{
++      switch(c->ic_flags & (
++              IEEE80211_CHAN_HALF |
++              IEEE80211_CHAN_QUARTER |
++              IEEE80211_CHAN_TURBO |
++              IEEE80211_CHAN_STURBO)) {
++      case IEEE80211_CHAN_QUARTER:
++              return 5;
++      case IEEE80211_CHAN_HALF:
++              return 10;
++      case IEEE80211_CHAN_TURBO:
++      case IEEE80211_CHAN_STURBO:
++              return 40;
++      default:
++              return 20;
++      }
++}
++
++/* must be called with channel_lock held */
++u32
++ieee80211_scan_get_bias(struct ieee80211_channel *c)
++{
++      struct channel_inuse *ch;
++      u8 bw = get_channel_bw(c);
++      u32 bias = 0;
++
++      list_for_each_entry(ch, &channels_inuse, list) {
++              if (ch->freq == c->ic_freq) {
++                      bias += 50;
++                      continue;
++              }
++              if (c->ic_freq < ch->freq)
++                      bias += get_overlap(c->ic_freq, ch->freq, bw, ch->bw);
++              else
++                      bias += get_overlap(ch->freq, c->ic_freq, ch->bw, bw);
++      }
++      return bias;
++}
++EXPORT_SYMBOL(ieee80211_scan_get_bias);
++
++/* must be called with channel_lock held */
++void
++ieee80211_scan_set_bss_channel(struct ieee80211com *ic, struct ieee80211_channel *c)
++{
++      unsigned long flags;
++      struct channel_inuse *ch;
++
++      list_for_each_entry(ch, &channels_inuse, list) {
++              if (ch->ic == ic)
++                      goto found;
++      }
++      ch = NULL;
++found:
++      if (c && (c != IEEE80211_CHAN_ANYC)) {
++              if (!ch) {
++                      ch = kmalloc(sizeof(struct channel_inuse), GFP_ATOMIC);
++                      ch->ic = ic;
++                      INIT_LIST_HEAD(&ch->list);
++                      list_add(&ch->list, &channels_inuse);
++              }
++              ch->freq = c->ic_freq;
++              ch->bw = get_channel_bw(c);
++      } else if (ch) {
++              list_del(&ch->list);
++              kfree(ch);
++      }
++}
++EXPORT_SYMBOL(ieee80211_scan_set_bss_channel);
++
++
+ void
+ ieee80211_scan_attach(struct ieee80211com *ic)
+ {
+@@ -1169,7 +1286,7 @@ ieee80211_scan_dfs_action(struct ieee802
+                               IEEE80211_RADAR_CHANCHANGE_TBTT_COUNT;
+                       ic->ic_flags |= IEEE80211_F_CHANSWITCH;
+               } else {
+-
++                      unsigned long flags;
+                       IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH,
+                                       "%s: directly switching to channel "
+                                       "%3d (%4d MHz)\n", __func__,
+@@ -1180,6 +1297,9 @@ ieee80211_scan_dfs_action(struct ieee802
+                        * change the channel here. */
+                       change_channel(ic, new_channel);
+                       ic->ic_bsschan = new_channel;
++                      spin_lock_irqsave(&channel_lock, flags);
++                      ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++                      spin_unlock_irqrestore(&channel_lock, flags);
+                       if (vap->iv_bss)
+                               vap->iv_bss->ni_chan = new_channel;
+               }
+--- a/net80211/ieee80211_scan.h
++++ b/net80211/ieee80211_scan.h
+@@ -35,6 +35,7 @@
+ #define       IEEE80211_SCAN_MAX      IEEE80211_CHAN_MAX
++extern spinlock_t channel_lock;
+ struct ieee80211_scanner;
+ struct ieee80211_scan_entry;
+@@ -116,6 +117,8 @@ void ieee80211_scan_flush(struct ieee802
+ struct ieee80211_scan_entry;
+ typedef int ieee80211_scan_iter_func(void *, const struct ieee80211_scan_entry *);
+ int ieee80211_scan_iterate(struct ieee80211com *, ieee80211_scan_iter_func *, void *);
++u32 ieee80211_scan_get_bias(struct ieee80211_channel *c);
++void ieee80211_scan_set_bss_channel(struct ieee80211com *ic, struct ieee80211_channel *c);
+ /*
+  * Parameters supplied when adding/updating an entry in a
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -373,8 +373,16 @@ void
+ ieee80211_ifdetach(struct ieee80211com *ic)
+ {
+       struct ieee80211vap *vap;
++      unsigned long flags;
+       int count;
++      /* mark the channel as no longer in use */
++      ic->ic_bsschan = IEEE80211_CHAN_ANYC;
++      spin_lock_irqsave(&channel_lock, flags);
++      ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++      spin_unlock_irqrestore(&channel_lock, flags);
++
++
+       /* bring down all vaps */
+       TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+               ieee80211_stop(vap->iv_dev);
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -2775,6 +2775,7 @@ static void
+ ieee80211_doth_switch_channel(struct ieee80211vap *vap)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
++      unsigned long flags;
+       IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH,
+                         "%s: Channel switch to %3d (%4d MHz) NOW!\n",
+@@ -2797,6 +2798,9 @@ ieee80211_doth_switch_channel(struct iee
+       ic->ic_curchan = ic->ic_bsschan = vap->iv_csa_chan;
+       ic->ic_set_channel(ic);
++      spin_lock_irqsave(&channel_lock, flags);
++      ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++      spin_unlock_irqrestore(&channel_lock, flags);
+ }
+ static void
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -308,6 +308,7 @@ ieee80211_create_ibss(struct ieee80211va
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni;
++      unsigned long flags;
+       IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
+               "%s: creating ibss on channel %u\n", __func__,
+@@ -386,6 +387,9 @@ ieee80211_create_ibss(struct ieee80211va
+       ic->ic_bsschan = chan;
+       ieee80211_node_set_chan(ic, ni);
+       ic->ic_curmode = ieee80211_chan2mode(chan);
++      spin_lock_irqsave(&channel_lock, flags);
++      ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++      spin_unlock_irqrestore(&channel_lock, flags);
+       /* Update country ie information */
+       ieee80211_build_countryie(ic);
+@@ -622,6 +626,7 @@ ieee80211_sta_join1(struct ieee80211_nod
+       struct ieee80211vap *vap = selbs->ni_vap;
+       struct ieee80211com *ic = selbs->ni_ic;
+       struct ieee80211_node *obss;
++      unsigned long flags;
+       int canreassoc;
+       if (vap->iv_opmode == IEEE80211_M_IBSS) {
+@@ -650,6 +655,9 @@ ieee80211_sta_join1(struct ieee80211_nod
+       ic->ic_curchan = ic->ic_bsschan;
+       ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan);
+       ic->ic_set_channel(ic);
++      spin_lock_irqsave(&channel_lock, flags);
++      ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++      spin_unlock_irqrestore(&channel_lock, flags);
+       /*
+        * Set the erp state (mostly the slot time) to deal with
+        * the auto-select case; this should be redundant if the
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -1231,6 +1231,7 @@ ieee80211_dturbo_switch(struct ieee80211
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+ #endif
+       struct ieee80211_channel *chan;
++      unsigned long flags;
+       chan = ieee80211_find_channel(ic, ic->ic_bsschan->ic_freq, newflags);
+       if (chan == NULL) {             /* XXX should not happen */
+@@ -1249,6 +1250,9 @@ ieee80211_dturbo_switch(struct ieee80211
+       ic->ic_bsschan = chan;
+       ic->ic_curchan = chan;
+       ic->ic_set_channel(ic);
++      spin_lock_irqsave(&channel_lock, flags);
++      ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++      spin_unlock_irqrestore(&channel_lock, flags);
+       /* NB: do not need to reset ERP state because in sta mode */
+ }
+ EXPORT_SYMBOL(ieee80211_dturbo_switch);
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -4076,8 +4076,13 @@ ieee80211_ioctl_setchanlist(struct net_d
+       if (nchan == 0)                 /* no valid channels, disallow */
+               return -EINVAL;
+       if (ic->ic_bsschan != IEEE80211_CHAN_ANYC &&    /* XXX */
+-          isclr(chanlist, ic->ic_bsschan->ic_ieee))
++          isclr(chanlist, ic->ic_bsschan->ic_ieee)) {
++              unsigned long flags;
+               ic->ic_bsschan = IEEE80211_CHAN_ANYC;   /* invalidate */
++              spin_lock_irqsave(&channel_lock, flags);
++              ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
++              spin_unlock_irqrestore(&channel_lock, flags);
++      }
+       memcpy(ic->ic_chan_active, chanlist, sizeof(ic->ic_chan_active));
+       /* update Supported Channels information element */
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -208,9 +208,15 @@ ap_start(struct ieee80211_scan_state *ss
+       struct ieee80211com *ic     = NULL;
+       int i;
+       unsigned int mode = 0;
++      unsigned long sflags;
+       SCAN_AP_LOCK_IRQ(as);
+       ic = vap->iv_ic;
++
++      spin_lock_irqsave(&channel_lock, sflags);
++      ieee80211_scan_set_bss_channel(ic, NULL);
++      spin_unlock_irqrestore(&channel_lock, sflags);
++
+       /* Determine mode flags to match, or leave zero for auto mode */
+       ss->ss_last = 0;
+       ieee80211_scan_add_channels(ic, ss, vap->iv_des_mode);
+@@ -423,8 +429,10 @@ pc_cmp_idletime(struct ieee80211_channel
+       if (!a->ic_idletime || !b->ic_idletime)
+               return 0;
+-      /* a is better than b (return < 0) when a has more idle time than b */
+-      return b->ic_idletime - a->ic_idletime;
++      /* a is better than b (return < 0) when a has more idle and less bias time than b */
++      return
++              ((100 - (u32) a->ic_idletime) + ieee80211_scan_get_bias(a)) -
++              ((100 - (u32) b->ic_idletime) + ieee80211_scan_get_bias(b));
+ }
+@@ -575,6 +583,7 @@ ap_end(struct ieee80211_scan_state *ss, 
+       struct ap_state *as = ss->ss_priv;
+       struct ieee80211_channel *bestchan = NULL;
+       struct ieee80211com *ic = NULL;
++      unsigned long sflags;
+       int res = 1;
+       SCAN_AP_LOCK_IRQ(as);
+@@ -586,8 +595,11 @@ ap_end(struct ieee80211_scan_state *ss, 
+       /* record stats for the channel that was scanned last */
+       ic->ic_set_channel(ic);
++      spin_lock_irqsave(&channel_lock, sflags);
++      ieee80211_scan_set_bss_channel(ic, NULL);
+       bestchan = pick_channel(ss, vap, flags);
+       if (bestchan == NULL) {
++              spin_unlock_irqrestore(&channel_lock, sflags);
+               if (ss->ss_last > 0) {
+                       /* no suitable channel, should not happen */
+                       printk(KERN_ERR "%s: %s: no suitable channel! "
+@@ -606,6 +618,7 @@ ap_end(struct ieee80211_scan_state *ss, 
+                                       bestchan->ic_freq, bestchan->ic_flags &
+                                       ~IEEE80211_CHAN_TURBO)) == NULL) {
+                               /* should never happen ?? */
++                              spin_unlock_irqrestore(&channel_lock, sflags);
+                               SCAN_AP_UNLOCK_IRQ_EARLY(as);
+                               return 0;
+                       }
+@@ -618,6 +631,9 @@ ap_end(struct ieee80211_scan_state *ss, 
+                       as->as_action = action;
+               as->as_selbss = se;
++              ieee80211_scan_set_bss_channel(ic, bestchan);
++              spin_unlock_irqrestore(&channel_lock, sflags);
++
+               /* Must defer action to avoid possible recursive call through 
+                * 80211 state machine, which would result in recursive 
+                * locking. */
diff --git a/net/madwifi/patches/412-fragmentation_fix.patch b/net/madwifi/patches/412-fragmentation_fix.patch
new file mode 100644 (file)
index 0000000..92c411b
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -3684,6 +3684,7 @@ ff_bypass:
+                *  already alloc'd
+                */
+               ATH_TXBUF_LOCK_IRQ(sc);
++              STAILQ_INSERT_TAIL(&bf_head, bf, bf_list);
+               for (bfcnt = 1; bfcnt < framecnt; ++bfcnt) {
+                       tbf = ath_take_txbuf_locked(sc);
+                       if (tbf == NULL)
diff --git a/net/madwifi/patches/413-rxorn.patch b/net/madwifi/patches/413-rxorn.patch
new file mode 100644 (file)
index 0000000..0e8d885
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2308,6 +2308,17 @@ ath_intr(int irq, void *dev_id, struct p
+       sc->sc_isr = status;
+       status &= sc->sc_imask;                 /* discard unasked for bits */
++
++      /* Treat RXORN as non-fatal. Either the bus is busy or the CPU
++       * is not fast enough to process all frames. Treat it like
++       * an Rx interrupt
++       */
++      if (status & HAL_INT_RXORN) {
++              sc->sc_stats.ast_rxorn++;
++              status &= ~HAL_INT_RXORN;
++              status |= HAL_INT_RX;
++      }
++
+       /* As soon as we know we have a real interrupt we intend to service, 
+        * we will check to see if we need an initial hardware TSF reading. 
+        * Normally we would just populate this all the time to keep things
+@@ -2320,10 +2331,6 @@ ath_intr(int irq, void *dev_id, struct p
+               sc->sc_stats.ast_hardware++;
+               ath_hal_intrset(ah, 0);         /* disable intr's until reset */
+               ATH_SCHEDULE_TQUEUE(&sc->sc_fataltq, &needmark);
+-      } else if (status & HAL_INT_RXORN) {
+-              sc->sc_stats.ast_rxorn++;
+-              ath_hal_intrset(ah, 0);         /* disable intr's until reset */
+-              ATH_SCHEDULE_TQUEUE(&sc->sc_rxorntq, &needmark);
+       } else {
+               if (status & HAL_INT_SWBA) {
+                       struct ieee80211vap * vap;
diff --git a/net/madwifi/patches/414-txpower.patch b/net/madwifi/patches/414-txpower.patch
new file mode 100644 (file)
index 0000000..6b33b8b
--- /dev/null
@@ -0,0 +1,262 @@
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -270,6 +270,7 @@ ieee80211_ifattach(struct ieee80211com *
+               ("invalid number of channels specified: %u", ic->ic_nchans));
+       memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail));
+       ic->ic_modecaps |= 1 << IEEE80211_MODE_AUTO;
++      ic->ic_max_txpower = IEEE80211_TXPOWER_MIN;
+       for (i = 0; i < ic->ic_nchans; i++) {
+               c = &ic->ic_channels[i];
+@@ -277,6 +278,7 @@ ieee80211_ifattach(struct ieee80211com *
+               KASSERT(c->ic_ieee < IEEE80211_CHAN_MAX,
+                       ("channel with bogus ieee number %u", c->ic_ieee));
+               setbit(ic->ic_chan_avail, c->ic_ieee);
++              ic->ic_max_txpower = max(ic->ic_max_txpower, (u16) (c->ic_maxpower * 2));
+               if (c->ic_scanflags & IEEE80211_NOSCAN_DEFAULT)
+                       c->ic_scanflags |= IEEE80211_NOSCAN_SET;
+@@ -346,8 +348,6 @@ ieee80211_ifattach(struct ieee80211com *
+       TAILQ_INIT(&ic->ic_vaps);
+       ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
+-      ic->ic_txpowlimit = IEEE80211_TXPOWER_MIN;
+-      ic->ic_newtxpowlimit = IEEE80211_TXPOWER_MAX;
+       init_timer(&ic->ic_dfs_excl_timer);
+       ic->ic_dfs_excl_timer.function = 
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -1125,7 +1125,7 @@ ieee80211_alloc_node(struct ieee80211vap
+               ni->ni_chan = IEEE80211_CHAN_ANYC;
+               ni->ni_authmode = IEEE80211_AUTH_OPEN;
+-              ni->ni_txpower = ic->ic_txpowlimit;
++              ni->ni_txpower = IEEE80211_TXPOWER_MAX;
+               ieee80211_crypto_resetkey(vap, &ni->ni_ucastkey,
+                       IEEE80211_KEYIX_NONE);
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -343,8 +343,8 @@ struct ieee80211com {
+       u_int16_t ic_holdover;                  /* PM hold over duration */
+       u_int16_t ic_bmissthreshold;            /* beacon miss threshold (# beacons) */
+       unsigned long ic_bmiss_guard;           /* when to cease ignoring bmiss (jiffies) */
+-      u_int16_t ic_txpowlimit;                /* global tx power limit (in 0.5 dBm) */
+-      u_int16_t ic_newtxpowlimit;             /* tx power limit to change to (in 0.5 dBm) */
++      u_int16_t ic_txpowlimit;                /* configured global tx power limit (in 0.5 dBm) */
++      u_int16_t ic_max_txpower;                       /* global hardware tx power limit */
+       u_int16_t ic_uapsdmaxtriggers;          /* max triggers that could arrive */
+       u_int8_t ic_coverageclass;              /* coverage class */
+       u_int8_t ic_protmode_rssi;                      /* rssi threshold for protection mode */
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -908,6 +908,21 @@ ieee80211_ioctl_giwessid(struct net_devi
+       return 0;
+ }
++static u16
++ieee80211_get_maxtxpow(struct ieee80211com *ic)
++{
++      u_int16_t txp = IEEE80211_TXPOWER_MAX;
++
++      if (ic->ic_bsschan && (ic->ic_bsschan != IEEE80211_CHAN_ANYC))
++              txp = min(txp, (u16) ic->ic_bsschan->ic_maxpower);
++
++      if (ic->ic_max_txpower > 0)
++              txp = min(txp, ic->ic_max_txpower);
++
++      return txp;
++}
++
++
+ static int
+ ieee80211_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+@@ -920,17 +935,21 @@ ieee80211_ioctl_giwrange(struct net_devi
+       u_int8_t reported[IEEE80211_CHAN_BYTES];        /* XXX stack usage? */
+       int i, r;
+       int step = 0;
++      u_int16_t power;
+       data->length = sizeof(struct iw_range);
+       memset(range, 0, sizeof(struct iw_range));
++      power = ieee80211_get_maxtxpow(ic);
++
+       /* txpower (128 values, but will print out only IW_MAX_TXPOWER) */
+-      range->num_txpower = (ic->ic_txpowlimit >= 8) ? IW_MAX_TXPOWER : ic->ic_txpowlimit;
+-      step = ic->ic_txpowlimit / (2 * (IW_MAX_TXPOWER - 1));
++      power /= 2; /* Unit: 0.5 dBm */
++      range->num_txpower = (power >= 8) ? IW_MAX_TXPOWER : power;
++      step = power / (IW_MAX_TXPOWER - 1);
+       range->txpower[0] = 0;
+       for (i = 1; i < IW_MAX_TXPOWER; i++)
+-              range->txpower[i] = (ic->ic_txpowlimit/2)
++              range->txpower[i] = power
+                       - (IW_MAX_TXPOWER - i - 1) * step;
+       range->txpower_capa = IW_TXPOW_DBM;
+@@ -1379,13 +1398,11 @@ ieee80211_ioctl_siwtxpow(struct net_devi
+       int fixed, disabled;
+       fixed = (ic->ic_flags & IEEE80211_F_TXPOW_FIXED);
+-      disabled = (fixed && vap->iv_bss->ni_txpower == 0);
++      disabled = (fixed && ic->ic_txpowlimit == 0);
+       if (rrq->disabled) {
+               if (!disabled) {
+-                      if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0)
+-                              return -EOPNOTSUPP;
+                       ic->ic_flags |= IEEE80211_F_TXPOW_FIXED;
+-                      vap->iv_bss->ni_txpower = 0;
++                      ic->ic_txpowlimit = 0;
+                       goto done;
+               }
+               return 0;
+@@ -1396,30 +1413,12 @@ ieee80211_ioctl_siwtxpow(struct net_devi
+                       return -EOPNOTSUPP;
+               if (rrq->flags != IW_TXPOW_DBM)
+                       return -EINVAL;
+-              if (ic->ic_bsschan != IEEE80211_CHAN_ANYC) {
+-                      if ((ic->ic_bsschan->ic_maxregpower >= rrq->value) &&
+-                          (ic->ic_txpowlimit/2 >= rrq->value)) {
+-                              vap->iv_bss->ni_txpower = 2 * rrq->value;
+-                              ic->ic_newtxpowlimit = 2 * rrq->value;
+-                              ic->ic_flags |= IEEE80211_F_TXPOW_FIXED;
+-                      } else
+-                              return -EINVAL;
+-              } else {
+-                      /*
+-                       * No channel set yet
+-                       */
+-                      if (ic->ic_txpowlimit/2 >= rrq->value) {
+-                              vap->iv_bss->ni_txpower = 2 * rrq->value;
+-                              ic->ic_newtxpowlimit = 2 * rrq->value;
+-                              ic->ic_flags |= IEEE80211_F_TXPOW_FIXED;
+-                      }
+-                      else
+-                              return -EINVAL;
+-              }
++              ic->ic_txpowlimit = 2 * rrq->value;
++              ic->ic_flags |= IEEE80211_F_TXPOW_FIXED;
+       } else {
+               if (!fixed)             /* no change */
+                       return 0;
+-              ic->ic_newtxpowlimit = IEEE80211_TXPOWER_MAX;
++              ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
+               ic->ic_flags &= ~IEEE80211_F_TXPOW_FIXED;
+       }
+ done:
+@@ -1588,9 +1587,18 @@ ieee80211_ioctl_giwtxpow(struct net_devi
+ {
+       struct ieee80211vap *vap = dev->priv;
+       struct ieee80211com *ic = vap->iv_ic;
+-
+-      rrq->value = vap->iv_bss->ni_txpower / 2;
+-      rrq->fixed = (ic->ic_flags & IEEE80211_F_TXPOW_FIXED) != 0;
++      unsigned int power = ic->ic_txpowlimit;
++      struct ieee80211_channel *c;
++      u_int16_t txp;
++
++      txp = ieee80211_get_maxtxpow(ic);
++      if (ic->ic_flags & IEEE80211_F_TXPOW_FIXED) {
++              txp = min(txp, ic->ic_txpowlimit);
++              rrq->fixed = 1;
++      } else {
++              rrq->fixed = 0;
++      }
++      rrq->value = txp / 2;
+       rrq->disabled = (rrq->fixed && rrq->value == 0);
+       rrq->flags = IW_TXPOW_DBM;
+       return 0;
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -380,7 +380,6 @@ static unsigned int ath_dump_hal_map(str
+ static u_int32_t ath_get_clamped_maxtxpower(struct ath_softc *sc);
+ static u_int32_t ath_set_clamped_maxtxpower(struct ath_softc *sc, 
+               u_int32_t new_clamped_maxtxpower);
+-static u_int32_t ath_get_real_maxtxpower(struct ath_softc *sc);
+ static void ath_poll_disable(struct net_device *dev);
+ static void ath_poll_enable(struct net_device *dev);
+@@ -3168,7 +3167,7 @@ ath_tx_startraw(struct net_device *dev, 
+       try0 = ph->try0;
+       rt = sc->sc_currates;
+       txrate = dot11_to_ratecode(sc, rt, ph->rate0);
+-      power = ph->power > 60 ? 60 : ph->power;
++      power = ph->power > 63 ? 63 : ph->power;
+       hdrlen = ieee80211_anyhdrsize(wh);
+       pktlen = skb->len + IEEE80211_CRC_LEN;
+@@ -8394,7 +8393,7 @@ ath_tx_start(struct net_device *dev, str
+                           pktlen,                     /* packet length */
+                           hdrlen,                     /* header length */
+                           atype,                      /* Atheros packet type */
+-                          MIN(ni->ni_txpower, 60),    /* txpower */
++                          MIN(ni->ni_txpower, 63),    /* txpower */
+                           txrate, try0,               /* series 0 rate/tries */
+                           keyix,                      /* key cache index */
+                           antenna,                    /* antenna mode */
+@@ -10387,59 +10386,16 @@ ath_get_clamped_maxtxpower(struct ath_so
+ /* XXX: this function needs some locking to avoid being called 
+  * twice/interrupted */
+-/* 1. Save the currently specified maximum txpower (as clamped by madwifi)
+- * 2. Determine the real maximum txpower the card can support by
+- *    setting a value that exceeds the maximum range (by one) and
+- *    finding out what it limits us to.
+- * 3. Restore the saved maxtxpower value we had previously specified */
+-static u_int32_t
+-ath_get_real_maxtxpower(struct ath_softc *sc)
+-{
+-      u_int32_t saved_clamped_maxtxpower;
+-      u_int32_t real_maxtxpower;
+-
+-      saved_clamped_maxtxpower = ath_get_clamped_maxtxpower(sc);
+-      real_maxtxpower = 
+-              ath_set_clamped_maxtxpower(sc, IEEE80211_TXPOWER_MAX + 1);
+-      ath_set_clamped_maxtxpower(sc, saved_clamped_maxtxpower);
+-      return real_maxtxpower;
+-}
+-
+-
+-/* XXX: this function needs some locking to avoid being called 
+- * twice/interrupted */
+ static void
+ ath_update_txpow(struct ath_softc *sc)
+ {
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ieee80211vap *vap = NULL;
+       struct ath_hal *ah = sc->sc_ah;
+-      u_int32_t prev_clamped_maxtxpower = 0;
+-      u_int32_t new_clamped_maxtxpower = 0;
+       /* Determine the previous value of maxtxpower */
+-      prev_clamped_maxtxpower = ath_get_clamped_maxtxpower(sc);
+-      /* Determine the real maximum txpower the card can support */
+-      ic->ic_txpowlimit = ath_get_real_maxtxpower(sc);
+-      /* Grab the new maxtxpower setting (which may have changed) */
+-      new_clamped_maxtxpower = ic->ic_newtxpowlimit;
+-      /* Make sure the change is within limits, clamp it otherwise */
+-      if (ic->ic_newtxpowlimit > ic->ic_txpowlimit)
+-              new_clamped_maxtxpower = ic->ic_txpowlimit;
+-      /* Search for the VAP that needs a txpow change, if any */
+-      TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+-              if (!tpc || ic->ic_newtxpowlimit != vap->iv_bss->ni_txpower) {
+-                      vap->iv_bss->ni_txpower = new_clamped_maxtxpower;
+-                      ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, 
+-                                      set_node_txpower, 
+-                                      &new_clamped_maxtxpower);
+-              }
+-      }
+-
+-      /* Store the assigned (clamped) maximum txpower and update the HAL */
+-      sc->sc_curtxpow = new_clamped_maxtxpower;
+-      if (new_clamped_maxtxpower != prev_clamped_maxtxpower)
+-              ath_hal_settxpowlimit(ah, new_clamped_maxtxpower);
++      ath_set_clamped_maxtxpower(sc, ic->ic_txpowlimit);
++      ic->ic_max_txpower = ath_get_clamped_maxtxpower(sc);
+ }
+ #ifdef ATH_SUPERG_XR
diff --git a/net/madwifi/patches/415-chan_switch.patch b/net/madwifi/patches/415-chan_switch.patch
new file mode 100644 (file)
index 0000000..6dc5da8
--- /dev/null
@@ -0,0 +1,187 @@
+--- a/net80211/ieee80211_beacon.c
++++ b/net80211/ieee80211_beacon.c
+@@ -224,18 +224,18 @@ ieee80211_beacon_alloc(struct ieee80211_
+       pktlen = 8                                      /* time stamp */
+                + sizeof(u_int16_t)                    /* beacon interval */
+                + sizeof(u_int16_t)                    /* capability information */
+-               + 2 + ni->ni_esslen                    /* ssid */
++               + 2 + IEEE80211_NWID_LEN                       /* ssid */
+                + 2 + IEEE80211_RATE_SIZE              /* supported rates */
+                + 7                                    /* FH/DS parameters max(7,3) */
+-               + 2 + 4 + vap->iv_tim_len              /* IBSS/TIM parameter set*/
++               + sizeof(struct ieee80211_tim_ie) + 128 /* IBSS/TIM parameter set*/
+                + ic->ic_country_ie.country_len + 2    /* country code */
+                + 3                                    /* power constraint */
+                + 5                                    /* channel switch announcement */
+                + 3                                    /* ERP */
+                + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) /* Ext. Supp. Rates */
+-               + (vap->iv_caps & IEEE80211_C_WME ?    /* WME */
++               + (ic->ic_caps & IEEE80211_C_WME ?     /* WME */
+                       sizeof(struct ieee80211_wme_param) : 0)
+-               + (vap->iv_caps & IEEE80211_C_WPA ?    /* WPA 1+2 */
++               + (ic->ic_caps & IEEE80211_C_WPA ?     /* WPA 1+2 */
+                       2 * sizeof(struct ieee80211_ie_wpa) : 0)
+                + sizeof(struct ieee80211_ie_athAdvCap)
+ #ifdef ATH_SUPERG_XR
+@@ -290,17 +290,26 @@ ieee80211_beacon_update(struct ieee80211
+       IEEE80211_LOCK_IRQ(ic);
+       /* Check if we need to change channel right now */
+-      if ((ic->ic_flags & IEEE80211_F_DOTH) &&
+-          (vap->iv_flags & IEEE80211_F_CHANSWITCH)) {
+-              struct ieee80211_channel *c = 
++      if (ic->ic_flags & IEEE80211_F_CHANSWITCH) {
++              struct ieee80211_channel *c =
+                       ieee80211_doth_findchan(vap, ic->ic_chanchange_chan);
+-              
+-              if (!vap->iv_chanchange_count && !c) {
+-                      vap->iv_flags &= ~IEEE80211_F_CHANSWITCH;
+-                      ic->ic_flags &= ~IEEE80211_F_CHANSWITCH;
+-              } else if (vap->iv_chanchange_count &&
+-                         ((!ic->ic_chanchange_tbtt) ||
+-                          (vap->iv_chanchange_count == ic->ic_chanchange_tbtt))) {
++              struct ieee80211vap *avp;
++              int do_switch = 1;
++
++              TAILQ_FOREACH(avp, &ic->ic_vaps, iv_next) {
++                      if (!(avp->iv_flags & IEEE80211_F_CHANSWITCH))
++                              continue;
++
++                      do_switch = 0;
++                      break;
++              }
++              if (vap->iv_flags & IEEE80211_F_CHANSWITCH) {
++                      if (vap->iv_chanchange_count-- <= 1) {
++                              vap->iv_flags &= ~IEEE80211_F_CHANSWITCH;
++                              vap->iv_chanchange_count = 0;
++                      }
++              }
++              if (do_switch) {
+                       u_int8_t *frm;
+                       IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH,
+@@ -316,16 +325,7 @@ ieee80211_beacon_update(struct ieee80211
+                       } else
+                               ic->ic_bsschan = c;
+-                      skb_pull(skb, sizeof(struct ieee80211_frame));
+-                      skb_trim(skb, 0);
+-                      frm = skb->data;
+-                      skb_put(skb, ieee80211_beacon_init(ni, bo, frm) - frm);
+-                      skb_push(skb, sizeof(struct ieee80211_frame));
+-
+-                      vap->iv_chanchange_count = 0;
+-                      vap->iv_flags &= ~IEEE80211_F_CHANSWITCH;
+                       ic->ic_flags &= ~IEEE80211_F_CHANSWITCH;
+-
+                       /* NB: Only for the first VAP to get here, and when we
+                        * have a valid channel to which to change. */
+                       if (c && (ic->ic_curchan != c)) {
+@@ -488,22 +488,20 @@ ieee80211_beacon_update(struct ieee80211
+       if (IEEE80211_IS_MODE_BEACON(vap->iv_opmode)) {
+-              if ((ic->ic_flags & IEEE80211_F_DOTH) &&
+-                  (ic->ic_flags & IEEE80211_F_CHANSWITCH)) {
++              if (ic->ic_flags & IEEE80211_F_CHANSWITCH) {
+                       struct ieee80211_ie_csa *csa_ie =
+                               (struct ieee80211_ie_csa *)bo->bo_chanswitch;
+-                      IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH, 
++                      if (csa_ie->csa_len == 0) {
++                              IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH,
+                                       "%s: Sending 802.11h chanswitch IE: "
+                                       "%d/%d\n", __func__, 
+                                       ic->ic_chanchange_chan, 
+                                       ic->ic_chanchange_tbtt);
+-                      if (!vap->iv_chanchange_count) {
+-                              vap->iv_flags |= IEEE80211_F_CHANSWITCH;
+                               /* copy out trailer to open up a slot */
+                               memmove(bo->bo_chanswitch + sizeof(*csa_ie),
+-                                      bo->bo_chanswitch, 
++                                      bo->bo_chanswitch,
+                                       bo->bo_chanswitch_trailerlen);
+                               /* add ie in opened slot */
+@@ -523,17 +521,15 @@ ieee80211_beacon_update(struct ieee80211
+                               bo->bo_ath_caps += sizeof(*csa_ie);
+                               bo->bo_xr += sizeof(*csa_ie);
+-                              /* indicate new beacon length so other layers 
++                              /* indicate new beacon length so other layers
+                                * may manage memory */
+                               skb_put(skb, sizeof(*csa_ie));
+                               len_changed = 1;
+-                      } else if(csa_ie->csa_count)
+-                              csa_ie->csa_count--;
+-                      
+-                      vap->iv_chanchange_count++;
+-                      IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH,
+-                              "%s: CHANSWITCH IE, change in %d TBTT\n",
+-                              __func__, csa_ie->csa_count);
++
++                              IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH,
++                                      "%s: CHANSWITCH IE, change in %d TBTT\n",
++                                      __func__, csa_ie->csa_count);
++                      }
+               }
+ #ifdef ATH_SUPERG_XR
+               if (vap->iv_flags & IEEE80211_F_XRUPDATE) {
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -699,39 +699,11 @@ ieee80211_ioctl_siwfreq(struct net_devic
+                       if (c == NULL)                  /* no channel */
+                               return -EINVAL;
+               }
+-              /*
+-               * Fine tune channel selection based on desired mode:
+-               *   if 11b is requested, find the 11b version of any
+-               *      11g channel returned,
+-               *   if static turbo, find the turbo version of any
+-               *      11a channel return,
+-               *   otherwise we should be ok with what we've got.
+-               */
+-              switch (vap->iv_des_mode) {
+-              case IEEE80211_MODE_11B:
+-                      if (IEEE80211_IS_CHAN_ANYG(c)) {
+-                              c2 = findchannel(ic, i, IEEE80211_MODE_11B);
+-                              /* NB: should not happen, =>'s 11g w/o 11b */
+-                              if (c2 != NULL)
+-                                      c = c2;
+-                      }
+-                      break;
+-              case IEEE80211_MODE_TURBO_A:
+-                      if (IEEE80211_IS_CHAN_A(c)) {
+-                              c2 = findchannel(ic, i, IEEE80211_MODE_TURBO_A);
+-                              if (c2 != NULL)
+-                                      c = c2;
+-                      }
+-                      break;
+-              default:                /* NB: no static turboG */
+-                      break;
+-              }
++
+               if (ieee80211_check_mode_consistency(ic, vap->iv_des_mode, c)) {
+                       if (vap->iv_opmode == IEEE80211_M_HOSTAP)
+                               return -EINVAL;
+               }
+-              if ((vap->iv_state == IEEE80211_S_RUN) && (c == vap->iv_des_chan))
+-                      return 0;                       /* no change, return */
+               /* Don't allow to change to channel with radar found */
+               if (c->ic_flags & IEEE80211_CHAN_RADAR)
+@@ -4634,7 +4606,13 @@ static void
+ pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt) {
+       struct ieee80211vap *vap = dev->priv;
+       struct ieee80211com *ic = vap->iv_ic;
++      struct ieee80211vap *avp;
++
+       /* now flag the beacon update to include the channel switch IE */
++      TAILQ_FOREACH(avp, &ic->ic_vaps, iv_next) {
++              avp->iv_flags |= IEEE80211_F_CHANSWITCH;
++              avp->iv_chanchange_count = tbtt;
++      }
+       ic->ic_flags |= IEEE80211_F_CHANSWITCH;
+       ic->ic_chanchange_chan = channel;
+       ic->ic_chanchange_tbtt = tbtt;
diff --git a/net/madwifi/patches/416-wprobe.patch b/net/madwifi/patches/416-wprobe.patch
new file mode 100644 (file)
index 0000000..6c871f4
--- /dev/null
@@ -0,0 +1,549 @@
+--- /dev/null
++++ b/ath/ath_wprobe.c
+@@ -0,0 +1,433 @@
++#include <net80211/ieee80211_node.h>
++#include <linux/wprobe.h>
++
++atomic_t cleanup_tasks = ATOMIC_INIT(0);
++
++enum wp_node_val {
++      WP_NODE_RSSI,
++      WP_NODE_SIGNAL,
++      WP_NODE_RX_RATE,
++      WP_NODE_TX_RATE,
++      WP_NODE_RETRANSMIT_200,
++      WP_NODE_RETRANSMIT_400,
++      WP_NODE_RETRANSMIT_800,
++      WP_NODE_RETRANSMIT_1600,
++};
++
++enum wp_global_val {
++      WP_GLOBAL_NOISE,
++      WP_GLOBAL_PHY_BUSY,
++      WP_GLOBAL_PHY_RX,
++      WP_GLOBAL_PHY_TX,
++      WP_GLOBAL_FRAMES,
++      WP_GLOBAL_PROBEREQ,
++};
++
++static struct wprobe_item ath_wprobe_globals[] = {
++      [WP_GLOBAL_NOISE] = {
++              .name = "noise",
++              .type = WPROBE_VAL_S16,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_GLOBAL_PHY_BUSY] = {
++              .name = "phy_busy",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_GLOBAL_PHY_RX] = {
++              .name = "phy_rx",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_GLOBAL_PHY_TX] = {
++              .name = "phy_tx",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_GLOBAL_FRAMES] = {
++              .name = "frames",
++              .type = WPROBE_VAL_U32,
++      },
++      [WP_GLOBAL_PROBEREQ] = {
++              .name = "probereq",
++              .type = WPROBE_VAL_U32,
++      },
++};
++
++static struct wprobe_item ath_wprobe_link[] = {
++      [WP_NODE_RSSI] = {
++              .name = "rssi",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_SIGNAL] = {
++              .name = "signal",
++              .type = WPROBE_VAL_S16,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_RX_RATE] = {
++              .name = "rx_rate",
++              .type = WPROBE_VAL_U16,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_TX_RATE] = {
++              .name = "tx_rate",
++              .type = WPROBE_VAL_U16,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_RETRANSMIT_200] = {
++              .name = "retransmit_200",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_RETRANSMIT_400] = {
++              .name = "retransmit_400",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_RETRANSMIT_800] = {
++              .name = "retransmit_800",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++      [WP_NODE_RETRANSMIT_1600] = {
++              .name = "retransmit_1600",
++              .type = WPROBE_VAL_U8,
++              .flags = WPROBE_F_KEEPSTAT
++      },
++};
++
++#define AR5K_MIBC       0x0040
++#define AR5K_MIBC_FREEZE      (1 << 1)
++#define AR5K_TXFC       0x80ec
++#define AR5K_RXFC       0x80f0
++#define AR5K_RXCLEAR    0x80f4
++#define AR5K_CYCLES     0x80f8
++
++#define READ_CLR(_ah, _reg) \
++      ({ u32 __val = OS_REG_READ(_ah, _reg); OS_REG_WRITE(_ah, _reg, 0); __val; })
++
++static bool
++wprobe_disabled(void)
++{
++      return (!wprobe_add_iface || IS_ERR(wprobe_add_iface));
++}
++
++static int
++ath_wprobe_sync(struct wprobe_iface *dev, struct wprobe_link *l, struct wprobe_value *val, bool measure)
++{
++      struct ath_vap *avp = container_of(dev, struct ath_vap, av_wpif);
++      struct ieee80211vap *vap = &avp->av_vap;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_hal *ah = sc->sc_ah;
++      u32 cc, busy, rx, tx;
++      s16 noise;
++
++      if (l)
++              goto out;
++
++      OS_REG_WRITE(ah, AR5K_MIBC, AR5K_MIBC_FREEZE);
++      cc = READ_CLR(ah, AR5K_CYCLES);
++      busy = READ_CLR(ah, AR5K_RXCLEAR);
++      rx = READ_CLR(ah, AR5K_RXFC);
++      tx = READ_CLR(ah, AR5K_TXFC);
++      OS_REG_WRITE(ah, AR5K_MIBC, 0);
++      noise = ath_hal_get_channel_noise(sc->sc_ah, &(sc->sc_curchan));
++      ic->ic_channoise = noise;
++
++      WPROBE_FILL_BEGIN(val, ath_wprobe_globals);
++      if (cc & 0xf0000000) {
++              /* scale down if the counters are near max */
++              cc >>= 8;
++              busy >>= 8;
++              rx >>= 8;
++              tx >>= 8;
++      }
++      if (ah->ah_macType < 5212)
++              goto phy_skip;
++      if (!cc)
++              goto phy_skip;
++      if (busy > cc)
++              goto phy_skip;
++      if (rx > cc)
++              goto phy_skip;
++      if (tx > cc)
++              goto phy_skip;
++      busy = (busy * 100) / cc;
++      rx = (rx * 100) / cc;
++      tx = (tx * 100) / cc;
++      WPROBE_SET(WP_GLOBAL_PHY_BUSY, U8, busy);
++      WPROBE_SET(WP_GLOBAL_PHY_RX, U8, rx);
++      WPROBE_SET(WP_GLOBAL_PHY_TX, U8, tx);
++      WPROBE_SET(WP_GLOBAL_FRAMES, U32, avp->av_rxframes);
++      WPROBE_SET(WP_GLOBAL_PROBEREQ, U32, avp->av_rxprobereq);
++
++phy_skip:
++      WPROBE_SET(WP_GLOBAL_NOISE, S16, noise);
++      WPROBE_FILL_END();
++
++out:
++      return 0;
++}
++
++#undef AR5K_TXFC
++#undef AR5K_RXFC
++#undef AR5K_RXCLEAR
++#undef AR5K_CYCLES
++#undef AR5K_MIBC
++#undef AR5K_MIBC_FREEZE
++#undef READ_CLR
++
++static const struct wprobe_iface ath_wprobe_dev = {
++      .link_items = ath_wprobe_link,
++      .n_link_items = ARRAY_SIZE(ath_wprobe_link),
++      .global_items = ath_wprobe_globals,
++      .n_global_items = ARRAY_SIZE(ath_wprobe_globals),
++      .sync_data = ath_wprobe_sync,
++};
++
++static int
++ath_lookup_rateval(struct ieee80211_node *ni, int rate)
++{
++      struct ieee80211vap *vap = ni->ni_vap;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct ath_softc *sc = ic->ic_dev->priv;
++      const HAL_RATE_TABLE *rt = sc->sc_currates;
++
++      if ((!rt) || (rate < 0) || (rate >= ARRAY_SIZE(sc->sc_hwmap)))
++              return -1;
++
++      rate = sc->sc_hwmap[rate].ieeerate;
++      rate = sc->sc_rixmap[rate & IEEE80211_RATE_VAL];
++      if ((rate < 0) || (rate >= rt->rateCount))
++              return -1;
++
++      return rt->info[rate].rateKbps;
++}
++
++static void
++ath_wprobe_report_rx(struct ieee80211vap *vap, struct ath_rx_status *rs, struct sk_buff *skb)
++{
++      const struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
++      struct wprobe_wlan_hdr hdr;
++      struct ath_vap *avp;
++      int hdrsize;
++
++      if (wprobe_disabled())
++              return;
++
++      avp = ATH_VAP(vap);
++      avp->av_rxframes++;
++      if (wh->i_fc[0] == (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ))
++              avp->av_rxprobereq++;
++
++      memset(&hdr, 0, sizeof(hdr));
++      hdr.len = skb->len;
++      hdr.snr = rs->rs_rssi;
++      hdr.type = WPROBE_PKT_RX;
++      if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
++              hdrsize = sizeof(struct ieee80211_ctlframe_addr2);
++      else
++              hdrsize = ieee80211_hdrsize(skb->data);
++      wprobe_add_frame(&avp->av_wpif, &hdr, skb->data, hdrsize + 0x42);
++}
++
++
++static void
++ath_node_sample_rx(struct ieee80211_node *ni, struct ath_rx_status *rs)
++{
++      struct ath_node *an = ATH_NODE(ni);
++      struct ieee80211vap *vap = ni->ni_vap;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct wprobe_link *l = &an->an_wplink;
++      struct wprobe_value *v = l->val;
++      unsigned long flags;
++      int rate;
++
++      if (wprobe_disabled() || !an->an_wplink_active || !l->val)
++              return;
++
++      rate = ath_lookup_rateval(ni, rs->rs_rate);
++
++      spin_lock_irqsave(&l->iface->lock, flags);
++      WPROBE_FILL_BEGIN(v, ath_wprobe_link);
++      WPROBE_SET(WP_NODE_RSSI, U8, rs->rs_rssi);
++      WPROBE_SET(WP_NODE_SIGNAL, S16, ic->ic_channoise + rs->rs_rssi);
++      if ((rate > 0) && (rate <= 600000))
++              WPROBE_SET(WP_NODE_RX_RATE, U16, rate);
++      WPROBE_FILL_END();
++      wprobe_update_stats(l->iface, l);
++      spin_unlock_irqrestore(&l->iface->lock, flags);
++}
++
++static void
++ath_wprobe_report_tx(struct ieee80211vap *vap, struct ath_tx_status *ts, struct sk_buff *skb)
++{
++      const struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
++      struct wprobe_wlan_hdr hdr;
++      struct ath_vap *avp;
++      int hdrsize;
++
++      if (wprobe_disabled())
++              return;
++
++      avp = ATH_VAP(vap);
++
++      memset(&hdr, 0, sizeof(hdr));
++      hdr.len = skb->len;
++      hdr.snr = ts->ts_rssi;
++      hdr.type = WPROBE_PKT_TX;
++      if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
++              hdrsize = sizeof(struct ieee80211_ctlframe_addr2);
++      else
++              hdrsize = ieee80211_hdrsize(skb->data);
++      wprobe_add_frame(&avp->av_wpif, &hdr, skb->data, hdrsize + 0x42);
++}
++
++
++
++static void
++ath_node_sample_tx(struct ieee80211_node *ni, struct ath_tx_status *ts, struct sk_buff *skb)
++{
++      struct ath_node *an = ATH_NODE(ni);
++      struct ieee80211vap *vap = ni->ni_vap;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct wprobe_link *l = &an->an_wplink;
++      struct wprobe_value *v = l->val;
++      unsigned long flags;
++      int rate, rexmit_counter;
++      int len = skb->len;
++
++      if (wprobe_disabled() || !an->an_wplink_active || !l->val)
++              return;
++
++      ath_wprobe_report_tx(vap, ts, skb);
++      rate = ath_lookup_rateval(ni, ts->ts_rate);
++
++      spin_lock_irqsave(&l->iface->lock, flags);
++      WPROBE_FILL_BEGIN(v, ath_wprobe_link);
++      WPROBE_SET(WP_NODE_RSSI, U8, ts->ts_rssi);
++      WPROBE_SET(WP_NODE_SIGNAL, S16, ic->ic_channoise + ts->ts_rssi);
++
++      if (len <= 200)
++              rexmit_counter = WP_NODE_RETRANSMIT_200;
++      else if (len <= 400)
++              rexmit_counter = WP_NODE_RETRANSMIT_400;
++      else if (len <= 800)
++              rexmit_counter = WP_NODE_RETRANSMIT_800;
++      else
++              rexmit_counter = WP_NODE_RETRANSMIT_1600;
++      WPROBE_SET(rexmit_counter, U8, ts->ts_longretry);
++
++      if ((rate > 0) && (rate <= 600000))
++              WPROBE_SET(WP_NODE_TX_RATE, U16, rate);
++      WPROBE_FILL_END();
++      wprobe_update_stats(l->iface, l);
++      spin_unlock_irqrestore(&l->iface->lock, flags);
++}
++
++static void
++ath_wprobe_node_join(struct ieee80211vap *vap, struct ieee80211_node *ni)
++{
++      struct wprobe_iface *dev;
++      struct wprobe_link *l;
++      struct ath_vap *avp;
++      struct ath_node *an = ATH_NODE(ni);
++
++      if (wprobe_disabled() || an->an_wplink_active)
++              return;
++
++      avp = ATH_VAP(vap);
++      dev = &avp->av_wpif;
++      l = &an->an_wplink;
++
++      ieee80211_ref_node(ni);
++      wprobe_add_link(dev, l, ni->ni_macaddr);
++      an->an_wplink_active = 1;
++}
++
++static void
++ath_wprobe_do_node_leave(struct work_struct *work)
++{
++      struct ath_node *an = container_of(work, struct ath_node, an_destroy);
++      struct ieee80211_node *ni = &an->an_node;
++      struct ieee80211vap *vap = ni->ni_vap;
++      struct wprobe_iface *dev;
++      struct wprobe_link *l;
++      struct ath_vap *avp;
++
++      avp = ATH_VAP(vap);
++      dev = &avp->av_wpif;
++      l = &an->an_wplink;
++
++      wprobe_remove_link(dev, l);
++      ieee80211_unref_node(&ni);
++      atomic_dec(&cleanup_tasks);
++}
++
++static void
++ath_wprobe_node_leave(struct ieee80211vap *vap, struct ieee80211_node *ni)
++{
++      struct ath_node *an = ATH_NODE(ni);
++
++      if (wprobe_disabled() || !an->an_wplink_active)
++              return;
++
++      atomic_inc(&cleanup_tasks);
++      an->an_wplink_active = 0;
++      IEEE80211_INIT_WORK(&an->an_destroy, ath_wprobe_do_node_leave);
++      schedule_work(&an->an_destroy);
++}
++
++static void
++ath_init_wprobe_dev(struct ath_vap *avp)
++{
++      struct ieee80211vap *vap = &avp->av_vap;
++      struct wprobe_iface *dev = &avp->av_wpif;
++
++      if (wprobe_disabled() || (vap->iv_opmode == IEEE80211_M_WDS))
++              return;
++
++      memcpy(dev, &ath_wprobe_dev, sizeof(struct wprobe_iface));
++      dev->addr = vap->iv_myaddr;
++      dev->name = vap->iv_dev->name;
++      wprobe_add_iface(dev);
++}
++
++static void
++ath_remove_wprobe_dev(struct ath_vap *avp)
++{
++      struct ieee80211vap *vap = &avp->av_vap;
++      struct ieee80211com *ic = vap->iv_ic;
++      struct ieee80211_node *ni;
++      struct wprobe_iface *dev = &avp->av_wpif;
++      struct wprobe_link *l;
++      struct ath_node *an;
++      unsigned long flags;
++
++      if (wprobe_disabled() || (vap->iv_opmode == IEEE80211_M_WDS))
++              return;
++
++restart:
++      rcu_read_lock();
++      list_for_each_entry_rcu(l, &dev->links, list) {
++              an = container_of(l, struct ath_node, an_wplink);
++
++              if (!an->an_wplink_active)
++                      continue;
++
++              ni = &an->an_node;
++              ath_wprobe_node_leave(vap, ni);
++              rcu_read_unlock();
++              goto restart;
++      }
++      rcu_read_unlock();
++
++      /* wait for the cleanup tasks to finish */
++      while (atomic_read(&cleanup_tasks) != 0) {
++              schedule();
++      }
++
++      wprobe_remove_iface(dev);
++}
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -400,6 +400,7 @@ static int countrycode = -1;
+ static int maxvaps = -1;
+ static int outdoor = -1;
+ static int xchanmode = -1;
++#include "ath_wprobe.c"
+ static int beacon_cal = 1;
+ static const struct ath_hw_detect generic_hw_info = {
+@@ -1525,6 +1526,7 @@ ath_vap_create(struct ieee80211com *ic, 
+               ath_hal_intrset(ah, sc->sc_imask);
+       }
++      ath_init_wprobe_dev(avp);
+       return vap;
+ }
+@@ -1606,6 +1608,7 @@ ath_vap_delete(struct ieee80211vap *vap)
+               decrease = 0;
+       ieee80211_vap_detach(vap);
++      ath_remove_wprobe_dev(ATH_VAP(vap));
+       /* NB: memory is reclaimed through dev->destructor callback */
+       if (decrease)
+               sc->sc_nvaps--;
+@@ -5940,6 +5943,7 @@ ath_node_cleanup(struct ieee80211_node *
+       /* Clean up node-specific rate things - this currently appears to 
+        * always be a no-op */
+       sc->sc_rc->ops->node_cleanup(sc, ATH_NODE(ni));
++      ath_wprobe_node_leave(ni->ni_vap, ni);
+       ATH_NODE_UAPSD_LOCK_IRQ(an);
+ #ifdef IEEE80211_DEBUG_REFCNT
+@@ -7010,6 +7014,8 @@ drop_micfail:
+                               goto lookup_slowpath;
+                       }
+                       ATH_RSSI_LPF(ATH_NODE(ni)->an_avgrssi, rs->rs_rssi);
++                      ath_node_sample_rx(ni, rs);
++                      ath_wprobe_report_rx(ni->ni_vap, rs, skb);
+                       type = ieee80211_input(ni->ni_vap, ni, skb, rs->rs_rssi, bf->bf_tsf);
+                       ieee80211_unref_node(&ni);
+               } else {
+@@ -7024,15 +7030,21 @@ lookup_slowpath:
+                       else
+                               vap = ieee80211_find_rxvap(ic, wh->i_addr1);
+-                      if (vap)
++                      if (vap) {
++                              ath_wprobe_report_rx(vap, rs, skb);
+                               ni = ieee80211_find_rxnode(ic, vap, wh);
+-                      else
++                      } else {
++                              TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++                                      ath_wprobe_report_rx(vap, rs, skb);
++                              }
+                               ni = NULL;
++                      }
+                       if (ni != NULL) {
+                               ieee80211_keyix_t keyix;
+                               ATH_RSSI_LPF(ATH_NODE(ni)->an_avgrssi, rs->rs_rssi);
++                              ath_node_sample_rx(ni, rs);
+                               type = ieee80211_input(vap, ni, skb, rs->rs_rssi, bf->bf_tsf);
+                               /*
+                                * If the station has a key cache slot assigned
+@@ -8612,6 +8624,7 @@ ath_tx_processq(struct ath_softc *sc, st
+                               sc->sc_stats.ast_tx_rssi = ts->ts_rssi;
+                               ATH_RSSI_LPF(an->an_halstats.ns_avgtxrssi,
+                                       ts->ts_rssi);
++                                      ath_node_sample_tx(&an->an_node, ts, bf->bf_skb);
+                               if (bf->bf_skb->priority == WME_AC_VO ||
+                                   bf->bf_skb->priority == WME_AC_VI)
+                                       ni->ni_ic->ic_wme.wme_hipri_traffic++;
+@@ -10111,6 +10124,7 @@ ath_newassoc(struct ieee80211_node *ni, 
+       struct ath_softc *sc = ic->ic_dev->priv;
+       sc->sc_rc->ops->newassoc(sc, ATH_NODE(ni), isnew);
++      ath_wprobe_node_join(ni->ni_vap, ni);
+       /* are we supporting compression? */
+       if (!(vap->iv_ath_cap & ni->ni_ath_flags & IEEE80211_NODE_COMP))
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -46,6 +46,7 @@
+ #include "ah_desc.h"
+ #include "ah_os.h"
+ #include "if_athioctl.h"
++#include <linux/wprobe.h>
+ #include "net80211/ieee80211.h"               /* XXX for WME_NUM_AC */
+ #include <asm/io.h>
+ #include <linux/list.h>
+@@ -352,6 +353,9 @@ typedef STAILQ_HEAD(, ath_buf) ath_bufhe
+ /* driver-specific node state */
+ struct ath_node {
+       struct ieee80211_node an_node;          /* base class */
++      struct wprobe_link an_wplink;
++      uint8_t an_wplink_active;
++      struct work_struct an_destroy;
+       u_int16_t an_decomp_index;              /* decompression mask index */
+       u_int32_t an_avgrssi;                   /* average rssi over all rx frames */
+       u_int8_t  an_prevdatarix;               /* rate ix of last data frame */
+@@ -521,6 +525,9 @@ struct ath_vap {
+ #else
+       unsigned int av_beacon_alloc;
+ #endif
++      struct wprobe_iface av_wpif;
++      u32 av_rxframes;
++      u32 av_rxprobereq;
+ };
+ #define       ATH_VAP(_v)     ((struct ath_vap *)(_v))
diff --git a/net/madwifi/patches/417-beacon_txpower.patch b/net/madwifi/patches/417-beacon_txpower.patch
new file mode 100644 (file)
index 0000000..8a59c12
--- /dev/null
@@ -0,0 +1,81 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -395,7 +395,7 @@ static int bstuck_thresh = BSTUCK_THRESH
+ static char *autocreate = NULL;
+ static char *ratectl = DEF_RATE_CTL;
+ static int rfkill = 0;
+-static int tpc = 0;
++static int tpc = 1;
+ static int countrycode = -1;
+ static int maxvaps = -1;
+ static int outdoor = -1;
+@@ -4932,6 +4932,7 @@ ath_beacon_setup(struct ath_softc *sc, s
+       (((_ic)->ic_flags & (IEEE80211_F_SHPREAMBLE | IEEE80211_F_USEBARKER))\
+               == IEEE80211_F_SHPREAMBLE)
+       struct ieee80211com *ic = bf->bf_node->ni_ic;
++      struct ieee80211vap *vap = bf->bf_node->ni_vap;
+       struct sk_buff *skb = bf->bf_skb;
+       struct ath_hal *ah = sc->sc_ah;
+       struct ath_desc *ds;
+@@ -4999,7 +5000,7 @@ ath_beacon_setup(struct ath_softc *sc, s
+               skb->len + IEEE80211_CRC_LEN,   /* frame length */
+               sizeof(struct ieee80211_frame), /* header length */
+               HAL_PKT_TYPE_BEACON,            /* Atheros packet type */
+-              bf->bf_node->ni_txpower,        /* txpower XXX */
++              (vap->iv_beacon_txpow ? vap->iv_beacon_txpow : 63),
+               rate, 1,                        /* series 0 rate/tries */
+               HAL_TXKEYIX_INVALID,            /* no encryption */
+               antenna,                        /* antenna mode */
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -652,6 +652,7 @@ enum {
+       IEEE80211_PARAM_WDS_SEP                 = 82,   /* move wds stations into separate interfaces */
+       IEEE80211_PARAM_MAXASSOC                = 83,   /* maximum associated stations */
+       IEEE80211_PARAM_PROBEREQ                = 84,   /* enable handling of probe requests */
++      IEEE80211_PARAM_BEACON_TXP              = 85,   /* set beacon tx power */
+ };
+ #define       SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -254,6 +254,7 @@ struct ieee80211vap {
+       u_int8_t iv_dtim_period;                        /* DTIM period */
+       u_int8_t iv_dtim_count;                         /* DTIM count from last bcn */
+                                                       /* set/unset aid pwrsav state */
++      u_int8_t iv_beacon_txpow;                       /* beacon tx power */
+       void (*iv_set_tim)(struct ieee80211_node *, int);
+       u_int8_t iv_uapsdinfo;                          /* sta mode QoS Info flags */
+       struct ieee80211_node *iv_bss;                  /* information for this node */
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2871,6 +2871,9 @@ ieee80211_ioctl_setparam(struct net_devi
+       case IEEE80211_PARAM_PROBEREQ:
+               vap->iv_no_probereq = !value;
+               break;
++      case IEEE80211_PARAM_BEACON_TXP:
++              vap->iv_beacon_txpow = value;
++              break;
+ #ifdef ATH_REVERSE_ENGINEERING
+       case IEEE80211_PARAM_DUMPREGS:
+               ieee80211_dump_registers(dev, info, w, extra);
+@@ -3236,6 +3239,9 @@ ieee80211_ioctl_getparam(struct net_devi
+       case IEEE80211_PARAM_PROBEREQ:
+               param[0] = !vap->iv_no_probereq;
+               break;
++      case IEEE80211_PARAM_BEACON_TXP:
++              param[0] = vap->iv_beacon_txpow;
++              break;
+       default:
+               return -EOPNOTSUPP;
+       }
+@@ -5810,6 +5816,10 @@ static const struct iw_priv_args ieee802
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "probereq"},
+       { IEEE80211_PARAM_PROBEREQ,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_probereq"},
++      { IEEE80211_PARAM_BEACON_TXP,
++       IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "beacon_pwr"},
++      { IEEE80211_PARAM_BEACON_TXP,
++       0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_beacon_pwr"},
+ #ifdef ATH_REVERSE_ENGINEERING
+       /*
diff --git a/net/madwifi/patches/419-skb_unmap_crash.patch b/net/madwifi/patches/419-skb_unmap_crash.patch
new file mode 100644 (file)
index 0000000..37602e4
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -13499,7 +13499,7 @@ cleanup_ath_buf(struct ath_softc *sc, st
+       if (bf == NULL) 
+               return bf;
+-      if (bf->bf_skbaddr) {
++      if (bf->bf_skb && bf->bf_skbaddr) {
+               bus_unmap_single(
+                       sc->sc_bdev,
+                       bf->bf_skbaddr, 
+@@ -13507,8 +13507,6 @@ cleanup_ath_buf(struct ath_softc *sc, st
+                               sc->sc_rxbufsize : bf->bf_skb->len),
+                       direction);
+               bf->bf_skbaddr = 0;
+-              bf->bf_desc->ds_link = 0;
+-              bf->bf_desc->ds_data = 0;
+       }
+ #ifdef ATH_SUPERG_FF
diff --git a/net/madwifi/patches/420-diversity_fix.patch b/net/madwifi/patches/420-diversity_fix.patch
new file mode 100644 (file)
index 0000000..4a5c0b0
--- /dev/null
@@ -0,0 +1,86 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -797,7 +797,6 @@ ath_attach(u_int16_t devid, struct net_d
+               break;
+       }
+-      sc->sc_setdefantenna = ath_setdefantenna;
+       sc->sc_rc = ieee80211_rate_attach(sc, ratectl);
+       if (sc->sc_rc == NULL) {
+               error = EIO;
+@@ -2624,9 +2623,6 @@ ath_init(struct net_device *dev)
+       ath_radar_update(sc);
+       ath_rp_flush(sc);
+-      /* Set the default RX antenna; it may get lost on reset. */
+-      ath_setdefantenna(sc, sc->sc_defant);
+-
+       /*
+        * Setup the hardware after reset: the key cache
+        * is filled as needed and the receive engine is
+@@ -3019,7 +3015,6 @@ ath_reset(struct net_device *dev)
+       ath_setintmit(sc);
+       ath_update_txpow(sc);           /* update tx power state */
+       ath_radar_update(sc);
+-      ath_setdefantenna(sc, sc->sc_defant);
+       if (ath_startrecv(sc) != 0)     /* restart recv */
+               EPRINTF(sc, "Unable to start receive logic.\n");
+       if (sc->sc_softled)
+@@ -5353,27 +5348,6 @@ ath_beacon_send(struct ath_softc *sc, in
+       } else if ((sc->sc_updateslot == COMMIT) && (sc->sc_slotupdate == slot))
+               ath_setslottime(sc);            /* commit change to hardware */
+-      if ((!sc->sc_stagbeacons || slot == 0) && (!sc->sc_diversity)) {
+-              unsigned int otherant;
+-              /*
+-               * Check recent per-antenna transmit statistics and flip
+-               * the default rx antenna if noticeably more frames went out
+-               * on the non-default antenna.  Only do this if rx diversity
+-               * is off.
+-               * XXX assumes 2 antennae
+-               */
+-              otherant = sc->sc_defant & 1 ? 2 : 1;
+-              if (sc->sc_ant_tx[otherant] > sc->sc_ant_tx[sc->sc_defant] + 
+-                              ATH_ANTENNA_DIFF) {
+-                      DPRINTF(sc, ATH_DEBUG_BEACON,
+-                              "Flip default antenna to %u, %u > %u\n",
+-                              otherant, sc->sc_ant_tx[otherant],
+-                              sc->sc_ant_tx[sc->sc_defant]);
+-                      ath_setdefantenna(sc, otherant);
+-              }
+-              sc->sc_ant_tx[1] = sc->sc_ant_tx[2] = 0;
+-      }
+-
+       if (bfaddr != 0) {
+               /*
+                * Stop any current DMA and put the new frame(s) on the queue.
+@@ -6734,9 +6708,8 @@ ath_setdefantenna(struct ath_softc *sc, 
+ {
+       struct ath_hal *ah = sc->sc_ah;
+-      /* XXX block beacon interrupts */
+-      ath_hal_setdiversity(ah, (sc->sc_diversity != 0));
+       ath_hal_setdefantenna(ah, antenna);
++      ath_hal_setantennaswitch(ah, sc->sc_diversity ? 0 : antenna);
+       if (sc->sc_defant != antenna)
+               sc->sc_stats.ast_ant_defswitch++;
+       sc->sc_defant = antenna;
+@@ -11160,7 +11133,7 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                                       break;
+                               }
+                               sc->sc_diversity = val;
+-                              ath_hal_setdiversity(ah, val);
++                              ath_setdefantenna(sc, sc->sc_defant);
+                               break;
+                       case ATH_TXINTRPERIOD:
+                               /* XXX: validate? */
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -640,7 +640,6 @@ struct ath_softc {
+       spinlock_t sc_hal_lock;                 /* hardware access lock */
+       struct ath_ratectrl *sc_rc;             /* tx rate control support */
+       struct ath_tx99 *sc_tx99;               /* tx99 support */
+-      void (*sc_setdefantenna)(struct ath_softc *, u_int);
+       const struct ath_hw_detect *sc_hwinfo;
+       unsigned int    sc_invalid:1;           /* being detached */
diff --git a/net/madwifi/patches/421-channel_handling.patch b/net/madwifi/patches/421-channel_handling.patch
new file mode 100644 (file)
index 0000000..8424321
--- /dev/null
@@ -0,0 +1,1351 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -148,7 +148,6 @@ static int ath_key_set(struct ieee80211v
+ static void ath_key_update_begin(struct ieee80211vap *);
+ static void ath_key_update_end(struct ieee80211vap *);
+ static void ath_mode_init(struct net_device *);
+-static void ath_setslottime(struct ath_softc *);
+ static void ath_updateslot(struct net_device *);
+ static int ath_beaconq_setup(struct ath_softc *);
+ static int ath_beacon_alloc(struct ath_softc *, struct ieee80211_node *);
+@@ -240,7 +239,7 @@ static void ath_setup_stationkey(struct 
+ static void ath_setup_stationwepkey(struct ieee80211_node *);
+ static void ath_setup_keycacheslot(struct ath_softc *, struct ieee80211_node *);
+ static void ath_newassoc(struct ieee80211_node *, int);
+-static int ath_getchannels(struct net_device *, u_int, HAL_BOOL, HAL_BOOL);
++static int ath_getchannels(struct net_device *);
+ static void ath_led_event(struct ath_softc *, int);
+ static void ath_update_txpow(struct ath_softc *);
+@@ -265,7 +264,6 @@ static int ath_change_mtu(struct net_dev
+ static int ath_ioctl(struct net_device *, struct ifreq *, int);
+ static int ath_rate_setup(struct net_device *, u_int);
+-static void ath_setup_subrates(struct net_device *);
+ #ifdef ATH_SUPERG_XR
+ static int ath_xr_rate_setup(struct net_device *);
+ static void ath_grppoll_txq_setup(struct ath_softc *, int, int);
+@@ -387,8 +385,6 @@ static void ath_fetch_idle_time(struct a
+ /* calibrate every 30 secs in steady state but check every second at first. */
+ static int ath_calinterval = ATH_SHORT_CALINTERVAL;
+-static int ath_countrycode = CTRY_DEFAULT;    /* country code */
+-static int ath_outdoor = AH_FALSE;            /* enable outdoor use */
+ static int ath_xchanmode = AH_TRUE;           /* enable extended channels */
+ static int ath_maxvaps = ATH_MAXVAPS_DEFAULT;   /* set default maximum vaps */
+ static int bstuck_thresh = BSTUCK_THRESH;       /* Stuck beacon count required for reset */
+@@ -396,9 +392,7 @@ static char *autocreate = NULL;
+ static char *ratectl = DEF_RATE_CTL;
+ static int rfkill = 0;
+ static int tpc = 1;
+-static int countrycode = -1;
+ static int maxvaps = -1;
+-static int outdoor = -1;
+ static int xchanmode = -1;
+ #include "ath_wprobe.c"
+ static int beacon_cal = 1;
+@@ -437,9 +431,7 @@ static struct notifier_block ath_event_b
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+ MODULE_PARM(beacon_cal, "i");
+-MODULE_PARM(countrycode, "i");
+ MODULE_PARM(maxvaps, "i");
+-MODULE_PARM(outdoor, "i");
+ MODULE_PARM(xchanmode, "i");
+ MODULE_PARM(rfkill, "i");
+ #ifdef ATH_CAP_TPC
+@@ -451,9 +443,7 @@ MODULE_PARM(ratectl, "s");
+ #else
+ #include <linux/moduleparam.h>
+ module_param(beacon_cal, int, 0600);
+-module_param(countrycode, int, 0600);
+ module_param(maxvaps, int, 0600);
+-module_param(outdoor, int, 0600);
+ module_param(xchanmode, int, 0600);
+ module_param(rfkill, int, 0600);
+ #ifdef ATH_CAP_TPC
+@@ -463,9 +453,7 @@ module_param(bstuck_thresh, int, 0600);
+ module_param(autocreate, charp, 0600);
+ module_param(ratectl, charp, 0600);
+ #endif
+-MODULE_PARM_DESC(countrycode, "Override default country code");
+ MODULE_PARM_DESC(maxvaps, "Maximum VAPs");
+-MODULE_PARM_DESC(outdoor, "Enable/disable outdoor use");
+ MODULE_PARM_DESC(xchanmode, "Enable/disable extended channel mode");
+ MODULE_PARM_DESC(rfkill, "Enable/disable RFKILL capability");
+ #ifdef ATH_CAP_TPC
+@@ -531,6 +519,50 @@ MODULE_PARM_DESC(ieee80211_debug, "Load-
+                               (bssid)[0] |= (((id) << 2) | 0x02);     \
+               } while (0)
++static inline int ath_chan2mode(struct ieee80211_channel *c)
++{
++      if (IEEE80211_IS_CHAN_HALF(c))
++              return ATH_MODE_HALF;
++      else if (IEEE80211_IS_CHAN_QUARTER(c))
++              return ATH_MODE_QUARTER;
++      else
++              return ieee80211_chan2mode(c);
++}
++
++static inline int rate_hal2ieee(int dot11Rate, int f)
++{
++      int flag = dot11Rate & ~(IEEE80211_RATE_VAL);
++      dot11Rate &= IEEE80211_RATE_VAL;
++
++      if (f == 4) { /* Quarter */
++              if (dot11Rate == 4)
++                      return 18 | flag;
++      }
++      return (dot11Rate * f) | flag;
++}
++
++static inline int rate_factor(int mode)
++{
++      int f;
++
++      /*
++       * NB: Fix up rates. HAL returns half or quarter dot11Rates,
++       * while the stack deals with full rates only
++       */
++      switch(mode) {
++              case ATH_MODE_HALF:
++                      f = 2;
++                      break;
++              case ATH_MODE_QUARTER:
++                      f = 4;
++                      break;
++              default:
++                      f = 1;
++                      break;
++      }
++      return f;
++}
++
+ /* Initialize ath_softc structure */
+ int
+@@ -647,14 +679,6 @@ ath_attach(u_int16_t devid, struct net_d
+       for (i = 0; i < sc->sc_keymax; i++)
+               ath_hal_keyreset(ah, i);
+-      /*
+-       * Collect the channel list using the default country
+-       * code and including outdoor channels.  The 802.11 layer
+-       * is responsible for filtering this list based on settings
+-       * like the phy mode.
+-       */
+-      if (countrycode != -1)
+-              ath_countrycode = countrycode;
+       if (maxvaps != -1) {
+               ath_maxvaps = maxvaps;
+               if (ath_maxvaps < ATH_MAXVAPS_MIN)
+@@ -662,17 +686,14 @@ ath_attach(u_int16_t devid, struct net_d
+               else if (ath_maxvaps > ATH_MAXVAPS_MAX)
+                       ath_maxvaps = ATH_MAXVAPS_MAX;
+       }
+-      if (outdoor != -1)
+-              ath_outdoor = outdoor;
+       if (xchanmode != -1)
+               ath_xchanmode = xchanmode;
+-      error = ath_getchannels(dev, ath_countrycode,
+-                      ath_outdoor, ath_xchanmode);
++      error = ath_getchannels(dev);
+       if (error != 0)
+               goto bad;
+-      ic->ic_country_code = ath_countrycode;
+-      ic->ic_country_outdoor = ath_outdoor;
++      ic->ic_country_code = CTRY_DEFAULT;
++      ic->ic_country_outdoor = 0;
+       IPRINTF(sc, "Switching rfkill capability %s\n",
+               rfkill ? "on" : "off");
+@@ -686,9 +707,8 @@ ath_attach(u_int16_t devid, struct net_d
+       ath_rate_setup(dev, IEEE80211_MODE_11G);
+       ath_rate_setup(dev, IEEE80211_MODE_TURBO_A);
+       ath_rate_setup(dev, IEEE80211_MODE_TURBO_G);
+-
+-      /* Setup for half/quarter rates */
+-      ath_setup_subrates(dev);
++      ath_rate_setup(dev, ATH_MODE_HALF);
++      ath_rate_setup(dev, ATH_MODE_QUARTER);
+       /* NB: setup here so ath_rate_update is happy */
+       ath_setcurmode(sc, IEEE80211_MODE_11A);
+@@ -908,10 +928,6 @@ ath_attach(u_int16_t devid, struct net_d
+                       IEEE80211_ATHC_COMP : 0);
+ #endif
+-#ifdef ATH_SUPERG_DYNTURBO
+-      ic->ic_ath_cap |= (ath_hal_turboagsupported(ah, ath_countrycode) ? 
+-                      (IEEE80211_ATHC_TURBOP | IEEE80211_ATHC_AR) : 0);
+-#endif
+ #ifdef ATH_SUPERG_XR
+       ic->ic_ath_cap |= (ath_hal_xrsupported(ah) ? IEEE80211_ATHC_XR : 0);
+ #endif
+@@ -4470,17 +4486,17 @@ ath_mode_init(struct net_device *dev)
+  * Set the slot time based on the current setting.
+  */
+ static void
+-ath_setslottime(struct ath_softc *sc)
++ath_settiming(struct ath_softc *sc)
+ {
+-      struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
++      u_int offset = getTimingOffset(sc);
+-      if (sc->sc_slottimeconf > 0) /* manual override */
+-              ath_hal_setslottime(ah, sc->sc_slottimeconf);
+-      else if (ic->ic_flags & IEEE80211_F_SHSLOT)
+-              ath_hal_setslottime(ah, HAL_SLOT_TIME_9);
+-      else
+-              ath_hal_setslottime(ah, HAL_SLOT_TIME_20);
++      if (sc->sc_slottimeconf > 0)
++              ath_hal_setslottime(ah, offset + sc->sc_slottimeconf);
++      if (sc->sc_acktimeconf > 0)
++              ath_hal_setacktimeout(ah, 2 * offset + sc->sc_acktimeconf);
++      if (sc->sc_ctstimeconf > 0)
++              ath_hal_setctstimeout(ah, 2 * offset + sc->sc_ctstimeconf);
+       sc->sc_updateslot = OK;
+ }
+@@ -4502,7 +4518,7 @@ ath_updateslot(struct net_device *dev)
+       if (ic->ic_opmode == IEEE80211_M_HOSTAP)
+               sc->sc_updateslot = UPDATE;
+       else if (dev->flags & IFF_RUNNING)
+-              ath_setslottime(sc);
++              ath_settiming(sc);
+ }
+ #ifdef ATH_SUPERG_DYNTURBO
+@@ -5346,7 +5362,7 @@ ath_beacon_send(struct ath_softc *sc, in
+               sc->sc_updateslot = COMMIT;     /* commit next beacon */
+               sc->sc_slotupdate = slot;
+       } else if ((sc->sc_updateslot == COMMIT) && (sc->sc_slotupdate == slot))
+-              ath_setslottime(sc);            /* commit change to hardware */
++              ath_settiming(sc);              /* commit change to hardware */
+       if (bfaddr != 0) {
+               /*
+@@ -7802,12 +7818,14 @@ ath_get_ivlen(struct ieee80211_key *k)
+  * Get transmit rate index using rate in Kbps
+  */
+ static __inline int
+-ath_tx_findindex(const HAL_RATE_TABLE *rt, int rate)
++ath_tx_findindex(struct ath_softc *sc, const HAL_RATE_TABLE *rt, int rate)
+ {
+       unsigned int i, ndx = 0;
++      int f;
++      f = rate_factor(sc->sc_curmode);
+       for (i = 0; i < rt->rateCount; i++) {
+-              if (rt->info[i].rateKbps == rate) {
++              if ((rt->info[i].rateKbps * f) == rate) {
+                       ndx = i;
+                       break;
+               }
+@@ -8100,7 +8118,7 @@ ath_tx_start(struct net_device *dev, str
+               atype = HAL_PKT_TYPE_NORMAL;            /* default */
+               if (ismcast) {
+-                      rix = ath_tx_findindex(rt, vap->iv_mcast_rate);
++                      rix = ath_tx_findindex(sc, rt, vap->iv_mcast_rate);
+                       txrate = rt->info[rix].rateCode;
+                       if (shortPreamble)
+                               txrate |= rt->info[rix].shortPreamble;
+@@ -9067,7 +9085,7 @@ ath_chan_change(struct ath_softc *sc, st
+       struct net_device *dev = sc->sc_dev;
+       enum ieee80211_phymode mode;
+-      mode = ieee80211_chan2mode(chan);
++      mode = ath_chan2mode(chan);
+       ath_rate_setup(dev, mode);
+       ath_setcurmode(sc, mode);
+@@ -10124,8 +10142,7 @@ ath_newassoc(struct ieee80211_node *ni, 
+ }
+ static int
+-ath_getchannels(struct net_device *dev, u_int cc,
+-      HAL_BOOL outdoor, HAL_BOOL xchanmode)
++ath_getchannels(struct net_device *dev)
+ {
+       struct ath_softc *sc = dev->priv;
+       struct ieee80211com *ic = &sc->sc_ic;
+@@ -10139,17 +10156,31 @@ ath_getchannels(struct net_device *dev, 
+               EPRINTF(sc, "Insufficient memory for channel table!\n");
+               return -ENOMEM;
+       }
++
++restart:
+       if (!ath_hal_init_channels(ah, chans, IEEE80211_CHAN_MAX, &nchan,
+           ic->ic_regclassids, IEEE80211_REGCLASSIDS_MAX, &ic->ic_nregclass,
+-          cc, HAL_MODE_ALL, outdoor, xchanmode)) {
++          ic->ic_country_code, HAL_MODE_ALL, ic->ic_country_outdoor, ath_xchanmode)) {
+               u_int32_t rd;
+               ath_hal_getregdomain(ah, &rd);
+               EPRINTF(sc, "Unable to collect channel list from HAL; "
+-                      "regdomain likely %u country code %u\n", rd, cc);
++                      "regdomain likely %u country code %u\n", rd, ic->ic_country_code);
++              if ((ic->ic_country_code != CTRY_DEFAULT) ||
++                      (ic->ic_country_outdoor != 0)) {
++                      EPRINTF(sc, "Reverting to defaults\n");
++                      ic->ic_country_code = CTRY_DEFAULT;
++                      ic->ic_country_outdoor = 0;
++                      goto restart;
++              }
+               kfree(chans);
+               return -EINVAL;
+       }
++#ifdef ATH_SUPERG_DYNTURBO
++      ic->ic_ath_cap &= ~(IEEE80211_ATHC_TURBOP | IEEE80211_ATHC_AR);
++      ic->ic_ath_cap |= (ath_hal_turboagsupported(ah, ic->ic_country_code) ?
++                      (IEEE80211_ATHC_TURBOP | IEEE80211_ATHC_AR) : 0);
++#endif
+       /*
+        * Convert HAL channels to ieee80211 ones.
+        */
+@@ -10395,7 +10426,7 @@ ath_xr_rate_setup(struct net_device *dev
+       struct ieee80211com *ic = &sc->sc_ic;
+       const HAL_RATE_TABLE *rt;
+       struct ieee80211_rateset *rs;
+-      unsigned int i, maxrates;
++      unsigned int i, j, maxrates;
+       sc->sc_xr_rates = ath_hal_getratetable(ah, HAL_MODE_XR);
+       rt = sc->sc_xr_rates;
+       if (rt == NULL)
+@@ -10408,57 +10439,16 @@ ath_xr_rate_setup(struct net_device *dev
+       } else
+               maxrates = rt->rateCount;
+       rs = &ic->ic_sup_xr_rates;
+-      for (i = 0; i < maxrates; i++)
+-              rs->rs_rates[i] = rt->info[i].dot11Rate;
+-      rs->rs_nrates = maxrates;
++      for (j = 0, i = 0; i < maxrates; i++) {
++              if (!rt->info[i].valid)
++                      continue;
++              rs->rs_rates[j++] = rt->info[i].dot11Rate;
++      }
++      rs->rs_nrates = j;
+       return 1;
+ }
+ #endif
+-/* Setup half/quarter rate table support */
+-static void
+-ath_setup_subrates(struct net_device *dev)
+-{
+-      struct ath_softc *sc = dev->priv;
+-      struct ath_hal *ah = sc->sc_ah;
+-      struct ieee80211com *ic = &sc->sc_ic;
+-      const HAL_RATE_TABLE *rt;
+-      struct ieee80211_rateset *rs;
+-      unsigned int i, maxrates;
+-
+-      sc->sc_half_rates = ath_hal_getratetable(ah, HAL_MODE_11A_HALF_RATE);
+-      rt = sc->sc_half_rates;
+-      if (rt != NULL) {
+-              if (rt->rateCount > IEEE80211_RATE_MAXSIZE) {
+-                      DPRINTF(sc, ATH_DEBUG_ANY,
+-                              "The rate table is too small (%u > %u)\n",
+-                             rt->rateCount, IEEE80211_RATE_MAXSIZE);
+-                      maxrates = IEEE80211_RATE_MAXSIZE;
+-              } else
+-                      maxrates = rt->rateCount;
+-              rs = &ic->ic_sup_half_rates;
+-              for (i = 0; i < maxrates; i++)
+-                      rs->rs_rates[i] = rt->info[i].dot11Rate;
+-              rs->rs_nrates = maxrates;
+-      }
+-
+-      sc->sc_quarter_rates = ath_hal_getratetable(ah, HAL_MODE_11A_QUARTER_RATE);
+-      rt = sc->sc_quarter_rates;
+-      if (rt != NULL) {
+-              if (rt->rateCount > IEEE80211_RATE_MAXSIZE) {
+-                      DPRINTF(sc, ATH_DEBUG_ANY,
+-                              "The rate table is too small (%u > %u)\n",
+-                             rt->rateCount, IEEE80211_RATE_MAXSIZE);
+-                      maxrates = IEEE80211_RATE_MAXSIZE;
+-              } else
+-                      maxrates = rt->rateCount;
+-              rs = &ic->ic_sup_quarter_rates;
+-              for (i = 0; i < maxrates; i++)
+-                      rs->rs_rates[i] = rt->info[i].dot11Rate;
+-              rs->rs_nrates = maxrates;
+-      }
+-}
+-
+ static int
+ ath_rate_setup(struct net_device *dev, u_int mode)
+ {
+@@ -10467,7 +10457,7 @@ ath_rate_setup(struct net_device *dev, u
+       struct ieee80211com *ic = &sc->sc_ic;
+       const HAL_RATE_TABLE *rt;
+       struct ieee80211_rateset *rs;
+-      unsigned int i, maxrates;
++      unsigned int i, j, maxrates, f;
+       switch (mode) {
+       case IEEE80211_MODE_11A:
+@@ -10485,6 +10475,12 @@ ath_rate_setup(struct net_device *dev, u
+       case IEEE80211_MODE_TURBO_G:
+               sc->sc_rates[mode] = ath_hal_getratetable(ah, HAL_MODE_108G);
+               break;
++      case ATH_MODE_HALF:
++              sc->sc_rates[mode] = ath_hal_getratetable(ah, HAL_MODE_11A_HALF_RATE);
++              break;
++      case ATH_MODE_QUARTER:
++              sc->sc_rates[mode] = ath_hal_getratetable(ah, HAL_MODE_11A_QUARTER_RATE);
++              break;
+       default:
+               DPRINTF(sc, ATH_DEBUG_ANY, "Invalid mode %u\n", mode);
+               return 0;
+@@ -10499,10 +10495,16 @@ ath_rate_setup(struct net_device *dev, u
+               maxrates = IEEE80211_RATE_MAXSIZE;
+       } else
+               maxrates = rt->rateCount;
++
++      /* NB: quarter/half rate channels hijack the 11A rateset */
++      if (mode >= IEEE80211_MODE_MAX)
++              return 1;
++
+       rs = &ic->ic_sup_rates[mode];
+       for (i = 0; i < maxrates; i++)
+               rs->rs_rates[i] = rt->info[i].dot11Rate;
+       rs->rs_nrates = maxrates;
++
+       return 1;
+ }
+@@ -10531,13 +10533,18 @@ ath_setcurmode(struct ath_softc *sc, enu
+               {   0, 500, 130 },
+       };
+       const HAL_RATE_TABLE *rt;
+-      unsigned int i, j;
++      unsigned int i, j, f;
++      /*
++       * NB: Fix up rixmap. HAL returns half or quarter dot11Rates,
++       * while the stack deals with full rates only
++       */
++      f = rate_factor(mode);
+       memset(sc->sc_rixmap, 0xff, sizeof(sc->sc_rixmap));
+       rt = sc->sc_rates[mode];
+       KASSERT(rt != NULL, ("no h/w rate set for phy mode %u", mode));
+       for (i = 0; i < rt->rateCount; i++)
+-              sc->sc_rixmap[rt->info[i].dot11Rate & IEEE80211_RATE_VAL] = i;
++              sc->sc_rixmap[rate_hal2ieee(rt->info[i].dot11Rate, f) & IEEE80211_RATE_VAL] = i;
+       memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap));
+       for (i = 0; i < 32; i++) {
+               u_int8_t ix = rt->rateCodeToIndex[i];
+@@ -10547,7 +10554,7 @@ ath_setcurmode(struct ath_softc *sc, enu
+                       continue;
+               }
+               sc->sc_hwmap[i].ieeerate =
+-                      rt->info[ix].dot11Rate & IEEE80211_RATE_VAL;
++                      rate_hal2ieee(rt->info[ix].dot11Rate, f) & IEEE80211_RATE_VAL;
+               if (rt->info[ix].shortPreamble ||
+                   rt->info[ix].phy == IEEE80211_T_OFDM)
+                       sc->sc_hwmap[i].flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
+@@ -10948,9 +10955,106 @@ enum {
+       ATH_MAXVAPS             = 26,
+       ATH_INTMIT                      = 27,
+       ATH_NOISE_IMMUNITY      = 28,
+-      ATH_OFDM_WEAK_DET       = 29
++      ATH_OFDM_WEAK_DET       = 29,
++      ATH_CHANBW              = 30,
++      ATH_OUTDOOR             = 31,
+ };
++/*
++ * perform the channel related sysctl, reload the channel list
++ * and try to stay on the current frequency
++ */
++static int ath_sysctl_setchanparam(struct ath_softc *sc, unsigned long ctl, u_int val)
++{
++      struct ieee80211com *ic = &sc->sc_ic;
++      struct ath_hal *ah = sc->sc_ah;
++      struct ieee80211_channel *c = NULL;
++      struct ieee80211vap *vap;
++      u_int16_t freq = 0;
++      struct ifreq ifr;
++
++      if (ic->ic_curchan != IEEE80211_CHAN_ANYC)
++              freq = ic->ic_curchan->ic_freq;
++
++      switch(ctl) {
++      case ATH_COUNTRYCODE:
++              ic->ic_country_code = val;
++              break;
++      case ATH_OUTDOOR:
++              ic->ic_country_outdoor = val;
++              break;
++      case ATH_CHANBW:
++              switch(val) {
++              case 0:
++              case 5:
++              case 10:
++              case 20:
++              case 40:
++                      if (ath_hal_setcapability(ah, HAL_CAP_CHANBW, 1, val, NULL) == AH_TRUE) {
++                              sc->sc_chanbw = val;
++                              break;
++                      }
++              default:
++                      return -EINVAL;
++              }
++              break;
++      }
++
++      if (ic->ic_curchan != IEEE80211_CHAN_ANYC)
++              freq = ic->ic_curchan->ic_freq;
++
++      /* clear out any old state */
++      TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              vap->iv_des_mode = IEEE80211_MODE_AUTO;
++              vap->iv_des_chan = IEEE80211_CHAN_ANYC;
++      }
++      ieee80211_scan_flush(ic);
++
++      IEEE80211_LOCK_IRQ(ic);
++      ath_getchannels(sc->sc_dev);
++      ieee80211_update_channels(ic, 0);
++      if (freq)
++              c = ieee80211_find_channel(ic, freq, IEEE80211_MODE_AUTO);
++      if (!c)
++              c = &ic->ic_channels[0];
++      ic->ic_curchan = c;
++      ic->ic_bsschan = c;
++      ic->ic_curmode = IEEE80211_MODE_AUTO;
++      IEEE80211_UNLOCK_IRQ(ic);
++
++      if (!(sc->sc_dev->flags & IFF_RUNNING)) {
++              ic->ic_bsschan = IEEE80211_CHAN_ANYC;
++              return 0;
++      }
++
++#ifndef ifr_media
++#define    ifr_media       ifr_ifru.ifru_ivalue
++#endif
++      memset(&ifr, 0, sizeof(ifr));
++      ifr.ifr_media = ic->ic_media.ifm_cur->ifm_media & ~IFM_MMASK;
++      ifr.ifr_media |= IFM_MAKEMODE(IEEE80211_MODE_AUTO);
++      ifmedia_ioctl(ic->ic_dev, &ifr, &ic->ic_media, SIOCSIFMEDIA);
++
++      /* apply the channel to the hw */
++      ath_set_channel(ic);
++
++      TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              struct net_device *dev = vap->iv_dev;
++
++              /* reactivate all active vaps */
++              vap->iv_state = IEEE80211_S_SCAN;
++              if ((vap->iv_opmode == IEEE80211_M_HOSTAP) ||
++                      (vap->iv_opmode == IEEE80211_M_MONITOR) ||
++                      (vap->iv_opmode == IEEE80211_M_WDS))
++                      ieee80211_new_state(vap, IEEE80211_S_RUN, 0);
++              else
++                      ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
++      }
++
++      return 0;
++}
++
++
+ static int
+ ath_sysctl_set_intmit(struct ath_softc *sc, long ctl, u_int val)
+ {
+@@ -11029,6 +11133,7 @@ static int
+ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
+ {
+       struct ath_softc *sc = ctl->extra1;
++      struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+       u_int val;
+       u_int tab_3_val[3];
+@@ -11052,25 +11157,34 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                               lenp, ppos);
+               if (ret == 0) {
+                       switch ((long)ctl->extra2) {
++                      case ATH_REGDOMAIN:
++                              ath_hal_setregdomain(ah, val);
++                              break;
++                      case ATH_OUTDOOR:
++                      case ATH_COUNTRYCODE:
++                      case ATH_CHANBW:
++                              ret = ath_sysctl_setchanparam(sc, (long) ctl->extra2, val);
++                              break;
+                       case ATH_SLOTTIME:
+-                              if (val > 0) {
+-                                      if (!ath_hal_setslottime(ah, val))
+-                                              ret = -EINVAL;
+-                                      else
+-                                              sc->sc_slottimeconf = val;
+-                              } else {
+-                                      /* disable manual override */
++                              if (val > 0)
++                                      sc->sc_slottimeconf = val;
++                              else
+                                       sc->sc_slottimeconf = 0;
+-                                      ath_setslottime(sc);
+-                              }
++                              ath_settiming(sc);
+                               break;
+                       case ATH_ACKTIMEOUT:
+-                              if (!ath_hal_setacktimeout(ah, val))
+-                                      ret = -EINVAL;
++                              if (val > 0)
++                                      sc->sc_acktimeconf = val;
++                              else
++                                      sc->sc_acktimeconf = 0;
++                              ath_settiming(sc);
+                               break;
+                       case ATH_CTSTIMEOUT:
+-                              if (!ath_hal_setctstimeout(ah, val))
+-                                      ret = -EINVAL;
++                              if (val > 0)
++                                      sc->sc_ctstimeconf = val;
++                              else
++                                      sc->sc_ctstimeconf = 0;
++                              ath_settiming(sc);
+                               break;
+                       case ATH_SOFTLED:
+                               if (val != sc->sc_softled) {
+@@ -11223,6 +11337,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               }
+       } else {
+               switch ((long)ctl->extra2) {
++              case ATH_CHANBW:
++                      val = sc->sc_chanbw ?: 20;
++                      break;
+               case ATH_SLOTTIME:
+                       val = ath_hal_getslottime(ah);
+                       break;
+@@ -11241,6 +11358,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_COUNTRYCODE:
+                       ath_hal_getcountrycode(ah, &val);
+                       break;
++              case ATH_OUTDOOR:
++                      val = ic->ic_country_outdoor;
++                      break;
+               case ATH_MAXVAPS:
+                       val = ath_maxvaps;
+                       break;
+@@ -11354,11 +11474,17 @@ static const ctl_table ath_sysctl_templa
+       },
+       { .ctl_name     = CTL_AUTO,
+         .procname     = "countrycode",
+-        .mode         = 0444,
++        .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_COUNTRYCODE,
+       },
+       { .ctl_name     = CTL_AUTO,
++        .procname     = "outdoor",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_OUTDOOR,
++      },
++      { .ctl_name     = CTL_AUTO,
+         .procname     = "maxvaps",
+         .mode         = 0444,
+         .proc_handler = ath_sysctl_halparam,
+@@ -11366,7 +11492,7 @@ static const ctl_table ath_sysctl_templa
+       },
+       { .ctl_name     = CTL_AUTO,
+         .procname     = "regdomain",
+-        .mode         = 0444,
++        .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_REGDOMAIN,
+       },
+@@ -11429,6 +11555,12 @@ static const ctl_table ath_sysctl_templa
+         .extra2       = (void *)ATH_ACKRATE,
+       },
+       { .ctl_name     = CTL_AUTO,
++        .procname     = "channelbw",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_CHANBW,
++      },
++      { .ctl_name     = CTL_AUTO,
+         .procname     = "rp",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+@@ -11669,13 +11801,6 @@ static ctl_table ath_static_sysctls[] = 
+       },
+ #endif
+       { .ctl_name     = CTL_AUTO,
+-        .procname     = "countrycode",
+-        .mode         = 0444,
+-        .data         = &ath_countrycode,
+-        .maxlen       = sizeof(ath_countrycode),
+-        .proc_handler = proc_dointvec
+-      },
+-      { .ctl_name     = CTL_AUTO,
+         .procname     = "maxvaps",
+         .mode         = 0444,
+         .data         = &ath_maxvaps,
+@@ -11683,13 +11808,6 @@ static ctl_table ath_static_sysctls[] = 
+         .proc_handler = proc_dointvec
+       },
+       { .ctl_name     = CTL_AUTO,
+-        .procname     = "outdoor",
+-        .mode         = 0444,
+-        .data         = &ath_outdoor,
+-        .maxlen       = sizeof(ath_outdoor),
+-        .proc_handler = proc_dointvec
+-      },
+-      { .ctl_name     = CTL_AUTO,
+         .procname     = "xchanmode",
+         .mode         = 0444,
+         .data         = &ath_xchanmode,
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -688,17 +688,18 @@ struct ath_softc {
+       int8_t sc_ofdm_weak_det; /* OFDM weak frames detection, -1 == auto */
+       /* rate tables */
+-      const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX];
++#define ATH_MODE_HALF         (IEEE80211_MODE_MAX)
++#define ATH_MODE_QUARTER      (IEEE80211_MODE_MAX + 1)
++      const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX + 2];
+       const HAL_RATE_TABLE *sc_currates;      /* current rate table */
+       const HAL_RATE_TABLE *sc_xr_rates;      /* XR rate table */
+-      const HAL_RATE_TABLE *sc_half_rates;    /* half rate table */
+-      const HAL_RATE_TABLE *sc_quarter_rates; /* quarter rate table */
+       HAL_OPMODE sc_opmode;                   /* current hal operating mode */
+       enum ieee80211_phymode sc_curmode;      /* current phy mode */
+       u_int sc_poweroffset;                   /* hardware power offset */
+       u_int16_t sc_curtxpow;                  /* current tx power limit */
+       u_int16_t sc_curaid;                    /* current association id */
+       HAL_CHANNEL sc_curchan;                 /* current h/w channel */
++      u_int8_t sc_chanbw;                             /* channel bandwidth */
+       u_int8_t sc_curbssid[IEEE80211_ADDR_LEN];
+       u_int8_t        sc_rixmap[256];                 /* IEEE to h/w rate table ix */
+       struct {
+@@ -809,6 +810,8 @@ struct ath_softc {
+       u_int32_t sc_dturbo_bw_turbo;           /* bandwidth threshold */
+ #endif
+       u_int sc_slottimeconf;                  /* manual override for slottime */
++      u_int sc_acktimeconf;                   /* manual override for acktime */
++      u_int sc_ctstimeconf;                   /* manual override for ctstime */
+       struct timer_list sc_dfs_excl_timer;    /* mark expiration timer task */
+       struct timer_list sc_dfs_cac_timer;     /* dfs wait timer */
+@@ -827,6 +830,7 @@ struct ath_softc {
+       int sc_rp_num;
+       int sc_rp_min;
+       HAL_BOOL (*sc_rp_analyse)(struct ath_softc *sc);
++      struct ATH_TQ_STRUCT sc_refresh_tq;
+       struct ATH_TQ_STRUCT sc_rp_tq;
+       
+       int sc_rp_ignored;                      /* if set, we ignored all 
+@@ -942,6 +946,48 @@ int ar_device(int devid);
+         DEV_NAME(_v->iv_ic->ic_dev))
+ void ath_radar_detected(struct ath_softc *sc, const char* message);
++static inline u_int getTimingOffset(struct ath_softc *sc)
++{
++      struct ieee80211com *ic = &sc->sc_ic;
++      u_int usec = 9;
++      if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
++              usec = 20;
++              if (ic->ic_flags & IEEE80211_F_SHSLOT)
++                      usec = 9;
++      } else if (IEEE80211_IS_CHAN_A(ic->ic_curchan))
++              usec = 9;
++
++      if (IEEE80211_IS_CHAN_TURBO(ic->ic_curchan))
++              usec = 6;
++
++      if (IEEE80211_IS_CHAN_HALF(ic->ic_curchan))
++              usec = 13;
++      else if (IEEE80211_IS_CHAN_QUARTER(ic->ic_curchan))
++              usec = 21;
++      return usec;
++}
++
++static inline void ath_get_timings(struct ath_softc *sc, u_int *t_slot, u_int *t_sifs, u_int *t_difs)
++{
++      struct ieee80211_channel *c = sc->sc_ic.ic_curchan;
++
++      *t_slot = getTimingOffset(sc) + sc->sc_slottimeconf;
++
++      if (IEEE80211_IS_CHAN_HALF(c)) {
++              *t_sifs = 32;
++              *t_difs = 56;
++      } else if (IEEE80211_IS_CHAN_QUARTER(c)) {
++              *t_sifs = 64;
++              *t_difs = 112;
++      } else if (IEEE80211_IS_CHAN_TURBO(c)) {
++              *t_sifs = 8;
++              *t_difs = 28;
++      } else {
++              *t_sifs = 16;
++              *t_difs = 28;
++      }
++}
++
+ struct ath_hw_detect {
+       const char *vendor_name;
+--- a/tools/athctrl.c
++++ b/tools/athctrl.c
+@@ -118,7 +118,7 @@ CMD(athctrl)(int argc, char *argv[])
+       }
+       if (distance >= 0) {
+-              int slottime = 9 + (distance / 300) + ((distance % 300) ? 1 : 0);
++              int slottime = (distance / 300) + ((distance % 300) ? 1 : 0);
+               int acktimeout = slottime * 2 + 3;
+               int ctstimeout = slottime * 2 + 3;
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -243,34 +243,17 @@ static const  struct country_code_to_str
+       {CTRY_ZIMBABWE,             "ZW"}
+ };
+-int
+-ieee80211_ifattach(struct ieee80211com *ic)
++void ieee80211_update_channels(struct ieee80211com *ic, int init)
+ {
+-      struct net_device *dev = ic->ic_dev;
+       struct ieee80211_channel *c;
++      struct ieee80211vap *vap;
+       struct ifmediareq imr;
++      int ext = 0;
+       int i;
+-      _MOD_INC_USE(THIS_MODULE, return -ENODEV);
+-
+-      /*
+-       * Pick an initial operating mode until we have a vap
+-       * created to lock it down correctly.  This is only
+-       * drivers have something defined for configuring the
+-       * hardware at startup.
+-       */
+-      ic->ic_opmode = IEEE80211_M_STA;        /* everyone supports this */
+-
+-      /*
+-       * Fill in 802.11 available channel set, mark
+-       * all available channels as active, and pick
+-       * a default channel if not already specified.
+-       */
+-      KASSERT(0 < ic->ic_nchans && ic->ic_nchans < IEEE80211_CHAN_MAX,
+-              ("invalid number of channels specified: %u", ic->ic_nchans));
+       memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail));
+-      ic->ic_modecaps |= 1 << IEEE80211_MODE_AUTO;
+       ic->ic_max_txpower = IEEE80211_TXPOWER_MIN;
++      ic->ic_modecaps = 1 << IEEE80211_MODE_AUTO;
+       for (i = 0; i < ic->ic_nchans; i++) {
+               c = &ic->ic_channels[i];
+@@ -298,6 +281,8 @@ ieee80211_ifattach(struct ieee80211com *
+                       ic->ic_modecaps |= 1 << IEEE80211_MODE_TURBO_A;
+               if (IEEE80211_IS_CHAN_108G(c))
+                       ic->ic_modecaps |= 1 << IEEE80211_MODE_TURBO_G;
++              if (IEEE80211_IS_CHAN_HALF(c) || IEEE80211_IS_CHAN_QUARTER(c))
++                      ext = 1;
+       }
+       /* Initialize candidate channels to all available */
+       memcpy(ic->ic_chan_active, ic->ic_chan_avail,
+@@ -311,11 +296,59 @@ ieee80211_ifattach(struct ieee80211com *
+        * When 11g is supported, force the rate set to
+        * include basic rates suitable for a mixed b/g bss.
+        */
+-      if (ic->ic_modecaps & (1 << IEEE80211_MODE_11G))
++      if ((ic->ic_modecaps & (1 << IEEE80211_MODE_11G)) && !ext)
+               ieee80211_set11gbasicrates(
+                       &ic->ic_sup_rates[IEEE80211_MODE_11G],
+                       IEEE80211_MODE_11G);
++      if (init)
++              return;
++
++      ifmedia_removeall(&ic->ic_media);
++      ieee80211_media_setup(ic, &ic->ic_media, ic->ic_caps, NULL, NULL);
++      ieee80211com_media_status(ic->ic_dev, &imr);
++      ifmedia_set(&ic->ic_media, imr.ifm_active);
++
++      TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
++              struct ieee80211vap *avp;
++              TAILQ_FOREACH(avp, &vap->iv_wdslinks, iv_wdsnext) {
++                      (void) ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps, NULL, NULL);
++                      ieee80211_media_status(vap->iv_dev, &imr);
++                      ifmedia_set(&vap->iv_media, imr.ifm_active);
++              }
++              (void) ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps, NULL, NULL);
++              ieee80211_media_status(vap->iv_dev, &imr);
++              ifmedia_set(&vap->iv_media, imr.ifm_active);
++      }
++}
++EXPORT_SYMBOL(ieee80211_update_channels);
++
++int
++ieee80211_ifattach(struct ieee80211com *ic)
++{
++      struct net_device *dev = ic->ic_dev;
++      struct ieee80211_channel *c;
++      struct ifmediareq imr;
++
++      _MOD_INC_USE(THIS_MODULE, return -ENODEV);
++
++      /*
++       * Pick an initial operating mode until we have a vap
++       * created to lock it down correctly.  This is only
++       * drivers have something defined for configuring the
++       * hardware at startup.
++       */
++      ic->ic_opmode = IEEE80211_M_STA;        /* everyone supports this */
++
++      /*
++       * Fill in 802.11 available channel set, mark
++       * all available channels as active, and pick
++       * a default channel if not already specified.
++       */
++      KASSERT(0 < ic->ic_nchans && ic->ic_nchans < IEEE80211_CHAN_MAX,
++              ("invalid number of channels specified: %u", ic->ic_nchans));
++      ieee80211_update_channels(ic, 1);
++
+       /* Setup initial channel settings */
+       ic->ic_bsschan = IEEE80211_CHAN_ANYC;
+       /* Arbitrarily pick the first channel */
+@@ -327,6 +360,7 @@ ieee80211_ifattach(struct ieee80211com *
+       /* Enable WME by default, if we're capable. */
+       if (ic->ic_caps & IEEE80211_C_WME)
+               ic->ic_flags |= IEEE80211_F_WME;
++
+       (void) ieee80211_setmode(ic, ic->ic_curmode);
+       /* Store default beacon interval, as nec. */
+@@ -763,7 +797,8 @@ ieee80211_media_setup(struct ieee80211co
+       struct ieee80211_rateset allrates;
+       /* Fill in media characteristics. */
+-      ifmedia_init(media, 0, media_change, media_stat);
++      if (media_change || media_stat)
++              ifmedia_init(media, 0, media_change, media_stat);
+       maxrate = 0;
+       memset(&allrates, 0, sizeof(allrates));
+@@ -793,7 +828,7 @@ ieee80211_media_setup(struct ieee80211co
+                       ADD(media, IFM_AUTO, mopt | IFM_IEEE80211_WDS);
+               if (mode == IEEE80211_MODE_AUTO)
+                       continue;
+-              rs = &ic->ic_sup_rates[mode];
++              rs = &ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, mode)];
+               for (i = 0; i < rs->rs_nrates; i++) {
+                       rate = rs->rs_rates[i];
+@@ -1207,7 +1242,7 @@ ieee80211_announce(struct ieee80211com *
+               if ((ic->ic_modecaps & (1 << mode)) == 0)
+                       continue;
+               if_printf(dev, "%s rates: ", ieee80211_phymode_name[mode]);
+-              rs = &ic->ic_sup_rates[mode];
++              rs = &ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, mode)];
+               for (i = 0; i < rs->rs_nrates; i++) {
+                       rate = rs->rs_rates[i];
+                       mword = ieee80211_rate2media(ic, rate, mode);
+@@ -1417,7 +1452,7 @@ ieee80211com_media_change(struct net_dev
+                        * now so drivers have a consistent state.
+                        */
+                       KASSERT(vap->iv_bss != NULL, ("no bss node"));
+-                      vap->iv_bss->ni_rates = ic->ic_sup_rates[newphymode];
++                      vap->iv_bss->ni_rates = ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, newphymode)];
+               }
+               error = -ENETRESET;
+       }
+@@ -1435,7 +1470,7 @@ findrate(struct ieee80211com *ic, enum i
+ {
+ #define       IEEERATE(_ic,_m,_i) \
+       ((_ic)->ic_sup_rates[_m].rs_rates[_i] & IEEE80211_RATE_VAL)
+-      int i, nrates = ic->ic_sup_rates[mode].rs_nrates;
++      int i, nrates = ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, mode)].rs_nrates;
+       for (i = 0; i < nrates; i++)
+               if (IEEERATE(ic, mode, i) == rate)
+                       return i;
+@@ -1877,11 +1912,6 @@ ieee80211_build_countryie(struct ieee802
+                       if (ieee80211_chan2mode(c) != curmode_noturbo)
+                               continue;
+-                      /* Skip half/quarter rate channels */
+-                      if (IEEE80211_IS_CHAN_HALF(c) ||
+-                          IEEE80211_IS_CHAN_QUARTER(c))
+-                              continue;
+-
+                       if (*cur_runlen == 0) {
+                               (*cur_runlen)++;
+                               *cur_pow = c->ic_maxregpower;
+@@ -1915,7 +1945,7 @@ void
+ ieee80211_build_sc_ie(struct ieee80211com *ic)
+ {
+       struct ieee80211_ie_sc *ie = &ic->ic_sc_ie;
+-      int i, j;
++      int i, j, k;
+       struct ieee80211_channel *c;
+       u_int8_t prevchan;
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -336,8 +336,6 @@ struct ieee80211com {
+       u_int8_t ic_nopened;                    /* VAPs been opened */
+       struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX];
+       struct ieee80211_rateset ic_sup_xr_rates;
+-      struct ieee80211_rateset ic_sup_half_rates;
+-      struct ieee80211_rateset ic_sup_quarter_rates;
+       u_int16_t ic_modecaps;                  /* set of mode capabilities */
+       u_int16_t ic_curmode;                   /* current mode */
+       u_int16_t ic_lintval;                   /* beacon interval */
+@@ -714,6 +712,7 @@ MALLOC_DECLARE(M_80211_VAP);
+ int ieee80211_ifattach(struct ieee80211com *);
+ void ieee80211_ifdetach(struct ieee80211com *);
++void ieee80211_update_channels(struct ieee80211com *ic, int);
+ int ieee80211_vap_setup(struct ieee80211com *, struct net_device *,
+       const char *, int, int, struct ieee80211vap *);
+ int ieee80211_vap_attach(struct ieee80211vap *, ifm_change_cb_t, ifm_stat_cb_t);
+@@ -793,6 +792,23 @@ ieee80211_anyhdrspace(struct ieee80211co
+       return size;
+ }
++static __inline int
++ieee80211_chan2ratemode(struct ieee80211_channel *c, int mode)
++{
++      if (mode == -1)
++              mode = ieee80211_chan2mode(c);
++
++      /*
++       * Use 11a rateset for half/quarter to restrict things
++       * to pure OFDM
++       */
++      if (IEEE80211_IS_CHAN_HALF(c) ||
++              IEEE80211_IS_CHAN_QUARTER(c))
++              return IEEE80211_MODE_11A;
++
++      return mode;
++}
++
+ /* Macros to print MAC address used in 802.11 headers */
+ #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -287,7 +287,7 @@ ieee80211_node_set_chan(struct ieee80211
+               ni->ni_rates = ic->ic_sup_xr_rates;
+       else
+ #endif
+-      ni->ni_rates = ic->ic_sup_rates[ieee80211_chan2mode(chan)];
++      ni->ni_rates = ic->ic_sup_rates[ieee80211_chan2ratemode(chan, -1)];
+ }
+ static __inline void
+@@ -387,6 +387,8 @@ ieee80211_create_ibss(struct ieee80211va
+       ic->ic_bsschan = chan;
+       ieee80211_node_set_chan(ic, ni);
+       ic->ic_curmode = ieee80211_chan2mode(chan);
++      ni->ni_rates = ic->ic_sup_rates[ieee80211_chan2ratemode(chan, -1)];
++
+       spin_lock_irqsave(&channel_lock, flags);
+       ieee80211_scan_set_bss_channel(ic, ic->ic_bsschan);
+       spin_unlock_irqrestore(&channel_lock, flags);
+@@ -394,14 +396,8 @@ ieee80211_create_ibss(struct ieee80211va
+       /* Update country ie information */
+       ieee80211_build_countryie(ic);
+-      if (IEEE80211_IS_CHAN_HALF(chan)) {
+-              ni->ni_rates = ic->ic_sup_half_rates;
+-      } else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
+-              ni->ni_rates = ic->ic_sup_quarter_rates;
+-      }
+-
+-      if ((vap->iv_flags & IEEE80211_F_PUREG) &&
+-              IEEE80211_IS_CHAN_ANYG(chan)) {
++      if ((ieee80211_chan2ratemode(chan, -1) != IEEE80211_MODE_11A) &&
++              IEEE80211_IS_CHAN_ANYG(chan) && (vap->iv_flags & IEEE80211_F_PUREG)) {
+               ieee80211_setpuregbasicrates(&ni->ni_rates);
+       }
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -490,12 +490,7 @@ check_rate(struct ieee80211vap *vap, con
+       okrate = badrate = fixedrate = 0;
+-      if (IEEE80211_IS_CHAN_HALF(se->se_chan))
+-              srs = &ic->ic_sup_half_rates;
+-      else if (IEEE80211_IS_CHAN_QUARTER(se->se_chan))
+-              srs = &ic->ic_sup_quarter_rates;
+-      else
+-              srs = &ic->ic_sup_rates[ieee80211_chan2mode(se->se_chan)];
++      srs = &ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, -1)];
+       nrs = se->se_rates[1];
+       rs = se->se_rates + 2;
+       fixedrate = IEEE80211_FIXED_RATE_NONE;
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -1676,8 +1676,8 @@ ieee80211_send_probereq(struct ieee80211
+       frm = ieee80211_add_ssid(frm, ssid, ssidlen);
+       mode = ieee80211_chan2mode(ic->ic_curchan);
+-      frm = ieee80211_add_rates(frm, &ic->ic_sup_rates[mode]);
+-      frm = ieee80211_add_xrates(frm, &ic->ic_sup_rates[mode]);
++      frm = ieee80211_add_rates(frm, &ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, mode)]);
++      frm = ieee80211_add_xrates(frm, &ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, mode)]);
+       if (optie != NULL) {
+               memcpy(frm, optie, optielen);
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -404,7 +404,7 @@ ieee80211_fix_rate(struct ieee80211_node
+       error = 0;
+       okrate = badrate = fixedrate = 0;
+-      srs = &ic->ic_sup_rates[ieee80211_chan2mode(ni->ni_chan)];
++      srs = &ic->ic_sup_rates[ieee80211_chan2ratemode(ic->ic_curchan, -1)];
+       nrs = &ni->ni_rates;
+       fixedrate = IEEE80211_FIXED_RATE_NONE;
+       for (i = 0; i < nrs->rs_nrates;) {
+@@ -1407,6 +1407,7 @@ ieee80211_new_state(struct ieee80211vap 
+       IEEE80211_VAPS_UNLOCK_IRQ(ic);
+       return rc;
+ }
++EXPORT_SYMBOL(ieee80211_new_state);
+ static int
+ __ieee80211_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -195,31 +195,7 @@ calc_usecs_unicast_packet(struct ath_sof
+                       return 0;
+               }
+-              /* XXX: Getting MAC/PHY level timings should be fixed for turbo
+-               * rates, and there is probably a way to get this from the
+-               * HAL... */
+-              switch (rt->info[rix].phy) {
+-              case IEEE80211_T_OFDM:
+-#if 0
+-                      t_slot = 9;
+-                      t_sifs = 16;
+-                      t_difs = 28;
+-                      /* fall through */
+-#endif
+-              case IEEE80211_T_TURBO:
+-                      t_slot = 9;
+-                      t_sifs = 8;
+-                      t_difs = 28;
+-                      break;
+-              case IEEE80211_T_DS:
+-                      /* Fall through to default */
+-              default:
+-                      /* pg. 205 ieee.802.11.pdf */
+-                      t_slot = 20;
+-                      t_difs = 50;
+-                      t_sifs = 10;
+-              }
+-
++              ath_get_timings(sc, &t_slot, &t_sifs, &t_difs);
+               if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
+               (rt->info[rix].phy == IEEE80211_T_OFDM)) {
+                       if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -172,26 +172,7 @@ calc_usecs_unicast_packet(struct ath_sof
+        * rates, and there is probably a way to get this from the
+        * hal...
+        */
+-      switch (rt->info[rix].phy) {
+-      case IEEE80211_T_OFDM:
+-              t_slot = 9;
+-              t_sifs = 16;
+-              t_difs = 28;
+-              /* fall through */
+-      case IEEE80211_T_TURBO:
+-              t_slot = 9;
+-              t_sifs = 8;
+-              t_difs = 28;
+-              break;
+-      case IEEE80211_T_DS:
+-              /* fall through to default */
+-      default:
+-              /* pg 205 ieee.802.11.pdf */
+-              t_slot = 20;
+-              t_difs = 50;
+-              t_sifs = 10;
+-      }
+-
++      ath_get_timings(sc, &t_slot, &t_sifs, &t_difs);
+       rts = cts = 0;
+       if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2142,7 +2142,7 @@ ieee80211_ioctl_setmode(struct net_devic
+               vap->iv_des_mode = mode;
+               if (IS_UP_AUTO(vap))
+-                      ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
++                      ieee80211_init(vap->iv_dev, 0);
+               retv = 0;
+       }
+@@ -4090,46 +4090,60 @@ ieee80211_ioctl_getchanlist(struct net_d
+       return 0;
+ }
++static int alreadyListed(struct ieee80211req_chaninfo *chans, u_int16_t mhz)
++{
++      int i;
++      for (i = 0; i < chans->ic_nchans; i++) {
++              if (chans->ic_chans[i].ic_freq == mhz)
++                      return 1;
++      }
++      return 0;
++}
++
+ static int
+ ieee80211_ioctl_getchaninfo(struct net_device *dev,
+-      struct iw_request_info *info, void *w, char *extra)
++                          struct iw_request_info *info, void *w, char *extra)
+ {
+       struct ieee80211vap *vap = dev->priv;
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ieee80211req_chaninfo chans;
++      struct ieee80211req_chaninfo *chans =
++          (struct ieee80211req_chaninfo *)extra;
++
+       u_int8_t reported[IEEE80211_CHAN_BYTES];        /* XXX stack usage? */
+       int i;
+-      memset(&chans, 0, sizeof(chans));
+-      memset(&reported, 0, sizeof(reported));
++      memset(chans, 0, sizeof(*chans));
++      memset(reported, 0, sizeof(reported));
+       for (i = 0; i < ic->ic_nchans; i++) {
+               const struct ieee80211_channel *c = &ic->ic_channels[i];
+               const struct ieee80211_channel *c1 = c;
+-              if (isclr(reported, c->ic_ieee)) {
++              if (!alreadyListed(chans, c->ic_freq)) {
+                       setbit(reported, c->ic_ieee);
+-                      /* pick turbo channel over non-turbo channel, and
+-                       * 11g channel over 11b channel */
+                       if (IEEE80211_IS_CHAN_A(c))
+-                              c1 = findchannel(ic, c->ic_ieee, IEEE80211_MODE_TURBO_A);
++                              c1 = findchannel(ic, c->ic_freq,
++                                               IEEE80211_MODE_TURBO_A);
+                       if (IEEE80211_IS_CHAN_ANYG(c))
+-                              c1 = findchannel(ic, c->ic_ieee, IEEE80211_MODE_TURBO_G);
++                              c1 = findchannel(ic, c->ic_freq,
++                                               IEEE80211_MODE_TURBO_G);
+                       else if (IEEE80211_IS_CHAN_B(c)) {
+-                              c1 = findchannel(ic, c->ic_ieee, IEEE80211_MODE_TURBO_G);
++                              c1 = findchannel(ic, c->ic_freq,
++                                               IEEE80211_MODE_TURBO_G);
+                               if (!c1)
+-                                      c1 = findchannel(ic, c->ic_ieee, IEEE80211_MODE_11G);
++                                      c1 = findchannel(ic, c->ic_freq,
++                                                       IEEE80211_MODE_11G);
+                       }
+                       if (c1)
+                               c = c1;
+-                      /* Copy the entire structure, whereas it used to just copy a few fields */
+-                      memcpy(&chans.ic_chans[chans.ic_nchans], c, sizeof(struct ieee80211_channel));
+-                      if (++chans.ic_nchans >= IEEE80211_CHAN_MAX)
++                      chans->ic_chans[chans->ic_nchans].ic_ieee = c->ic_ieee;
++                      chans->ic_chans[chans->ic_nchans].ic_freq = c->ic_freq;
++                      chans->ic_chans[chans->ic_nchans].ic_flags = c->ic_flags;
++                      if (++chans->ic_nchans >= IEEE80211_CHAN_MAX)
+                               break;
+               }
+       }
+-      memcpy(extra, &chans, sizeof(struct ieee80211req_chaninfo));
+       return 0;
+ }
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -512,12 +512,13 @@ pick_channel(struct ieee80211_scan_state
+       int ss_last = ss->ss_last;
+       struct ieee80211_channel *best;
+       struct ap_state *as = ss->ss_priv;
+-      struct channel chans[ss_last]; /* actually ss_last-1 is required */
++      struct channel *chans; /* actually ss_last-1 is required */
+       struct channel *c = NULL;
+       struct pc_params params = { vap, ss, flags };
+       int benefit = 0;
+       int sta_assoc = 0;
++      chans = (struct channel *)kmalloc(ss_last*sizeof(struct channel),GFP_ATOMIC);
+       for (i = 0; i < ss_last; i++) {
+               chans[i].chan = ss->ss_chans[i];
+               chans[i].orig = i;
+@@ -571,6 +572,7 @@ pick_channel(struct ieee80211_scan_state
+                               "%s: best: channel %u rssi %d\n",
+                               __func__, i, as->as_maxrssi[i]);
+       }
++      kfree(chans);
+       return best;
+ }
+@@ -609,6 +611,7 @@ ap_end(struct ieee80211_scan_state *ss, 
+               res = 1; /* Do NOT restart scan */
+       } else {
+               struct ieee80211_scan_entry se;
++              int i;
+               /* XXX: notify all VAPs? */
+               /* if this is a dynamic turbo frequency , start with normal 
+                * mode first */
+@@ -623,6 +626,11 @@ ap_end(struct ieee80211_scan_state *ss, 
+                               return 0;
+                       }
+               }
++              for (i = (bestchan - &ic->ic_channels[0])/sizeof(*bestchan) + 1; i < ic->ic_nchans; i++) {
++                      if ((ic->ic_channels[i].ic_freq == bestchan->ic_freq) &&
++                              IEEE80211_IS_CHAN_ANYG(&ic->ic_channels[i]))
++                              bestchan = &ic->ic_channels[i];
++              }
+               memset(&se, 0, sizeof(se));
+               se.se_chan = bestchan;
+--- a/tools/wlanconfig.c
++++ b/tools/wlanconfig.c
+@@ -737,7 +737,7 @@ list_channels(const char *ifname, int al
+       if (get80211priv(ifname, IEEE80211_IOCTL_GETCHANINFO, &chans, sizeof(chans)) < 0)
+               errx(1, "unable to get channel information");
+       if (!allchans) {
+-              uint8_t active[32];
++              uint8_t active[IEEE80211_CHAN_BYTES];
+               if (get80211priv(ifname, IEEE80211_IOCTL_GETCHANLIST, &active, sizeof(active)) < 0)
+                       errx(1, "unable to get active channel list");
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -1044,6 +1044,7 @@ ieee80211_scan_assoc_fail(struct ieee802
+               ss->ss_ops->scan_assoc_fail(ss, mac, reason);
+       }
+ }
++EXPORT_SYMBOL(ieee80211_scan_flush);
+ /*
+  * Iterate over the contents of the scan cache.
+--- a/ath/if_ath_hal_wrappers.h
++++ b/ath/if_ath_hal_wrappers.h
+@@ -111,6 +111,11 @@ static inline HAL_BOOL ath_hal_getregdom
+       return (ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination) == HAL_OK);
+ }
++static inline HAL_BOOL ath_hal_setregdomain(struct ath_hal *ah, u_int32_t v)
++{
++      return (ath_hal_setcapability(ah, HAL_CAP_REG_DMN, 0, v, NULL));
++}
++
+ static inline HAL_BOOL ath_hal_gettkipmic(struct ath_hal *ah)
+ {
+       return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK);
diff --git a/net/madwifi/patches/422-confchange_reset.patch b/net/madwifi/patches/422-confchange_reset.patch
new file mode 100644 (file)
index 0000000..33040ae
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -70,7 +70,8 @@
+       (((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
+ #define       IS_UP_AUTO(_vap) \
+       (IS_UP((_vap)->iv_dev) && \
+-       (_vap)->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO)
++       (((_vap)->iv_opmode == IEEE80211_M_HOSTAP) || \
++       (_vap)->iv_ic->ic_roaming == IEEE80211_ROAMING_AUTO))
+ #define       RESCAN  1
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+@@ -283,7 +284,7 @@ ieee80211_ioctl_siwencode(struct net_dev
+                               vap->iv_flags &= ~IEEE80211_F_DROPUNENC;
+               }
+       }
+-      if ((error == 0) && IS_UP(vap->iv_dev)) {
++      if ((error == 0) && IS_UP_AUTO(vap) && wepchange) {
+               /*
+                * Device is up and running; we must kick it to
+                * effect the change.  If we're enabling/disabling
+@@ -291,8 +292,7 @@ ieee80211_ioctl_siwencode(struct net_dev
+                * so the 802.11 state machine is reset.  Otherwise
+                * the key state should have been updated above.
+                */
+-              if (wepchange && IS_UP_AUTO(vap))
+-                      ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
++              ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
+       }
+ #ifdef ATH_SUPERG_XR
+       /* set the same params on the xr vap device if exists */
diff --git a/net/madwifi/patches/423-phyerr_handling.patch b/net/madwifi/patches/423-phyerr_handling.patch
new file mode 100644 (file)
index 0000000..7f3cbaf
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -4391,13 +4391,12 @@ ath_key_update_end(struct ieee80211vap *
+ static u_int32_t
+ ath_calcrxfilter(struct ath_softc *sc)
+ {
+-#define       RX_FILTER_PRESERVE      (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR)
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct net_device *dev = ic->ic_dev;
+       struct ath_hal *ah = sc->sc_ah;
+       u_int32_t rfilt;
+-      rfilt = (ath_hal_getrxfilter(ah) & RX_FILTER_PRESERVE) |
++      rfilt = ath_hal_getrxfilter(ah) |
+                HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST |
+                HAL_RX_FILTER_MCAST;
+       if (ic->ic_opmode != IEEE80211_M_STA)
+@@ -4416,9 +4415,8 @@ ath_calcrxfilter(struct ath_softc *sc)
+       if (sc->sc_hasintmit && !sc->sc_needmib && ath_hal_getintmit(ah, NULL))
+               rfilt |= HAL_RX_FILTER_PHYERR;
+       if (sc->sc_curchan.privFlags & CHANNEL_DFS)
+-              rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR);
++              rfilt |= HAL_RX_FILTER_PHYRADAR;
+       return rfilt;
+-#undef RX_FILTER_PRESERVE
+ }
+ /*
diff --git a/net/madwifi/patches/424-timing.patch b/net/madwifi/patches/424-timing.patch
new file mode 100644 (file)
index 0000000..a8b82fa
--- /dev/null
@@ -0,0 +1,764 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -382,6 +382,7 @@ static u_int32_t ath_set_clamped_maxtxpo
+ static void ath_poll_disable(struct net_device *dev);
+ static void ath_poll_enable(struct net_device *dev);
+ static void ath_fetch_idle_time(struct ath_softc *sc);
++static void ath_set_timing(struct ath_softc *sc);
+ /* calibrate every 30 secs in steady state but check every second at first. */
+ static int ath_calinterval = ATH_SHORT_CALINTERVAL;
+@@ -1185,6 +1186,7 @@ ath_attach(u_int16_t devid, struct net_d
+       sc->sc_intmit = -1;
+       sc->sc_noise_immunity = -1;
+       sc->sc_ofdm_weak_det = -1;
++      sc->sc_coverage = 7; /* 2100 meters */
+       return 0;
+ bad3:
+@@ -2673,6 +2675,7 @@ ath_init(struct net_device *dev)
+        */
+       ath_chan_change(sc, ic->ic_curchan);
+       ath_set_ack_bitrate(sc, sc->sc_ackrate);
++      ath_set_timing(sc);
+       dev->flags |= IFF_RUNNING;              /* we are ready to go */
+       ieee80211_start_running(ic);            /* start all VAPs */
+ #ifdef ATH_TX99_DIAG
+@@ -4484,17 +4487,52 @@ ath_mode_init(struct net_device *dev)
+  * Set the slot time based on the current setting.
+  */
+ static void
+-ath_settiming(struct ath_softc *sc)
++ath_set_timing(struct ath_softc *sc)
+ {
++      struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+-      u_int offset = getTimingOffset(sc);
++      struct ath_timings *t = &sc->sc_timings;
++      u_int offset = 9;
++
++      t->sifs = 16;
++      if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
++              offset = 20;
++              if (ic->ic_flags & IEEE80211_F_SHSLOT)
++                      offset = 9;
++      } else if (IEEE80211_IS_CHAN_A(ic->ic_curchan)) {
++              offset = 9;
++      }
++
++      if (IEEE80211_IS_CHAN_TURBO(ic->ic_curchan)) {
++              offset = 6;
++              t->sifs = 8;
++      } else if (IEEE80211_IS_CHAN_HALF(ic->ic_curchan)) {
++              offset = 13;
++              t->sifs = 32;
++      } else if (IEEE80211_IS_CHAN_QUARTER(ic->ic_curchan)) {
++              offset = 21;
++              t->sifs = 64;
++      }
++
++      t->slot = offset + sc->sc_coverage;
++      t->ack = t->slot * 2 + 3;
++      t->cts = t->slot * 2 + 3;
+       if (sc->sc_slottimeconf > 0)
+-              ath_hal_setslottime(ah, offset + sc->sc_slottimeconf);
++              t->slot = sc->sc_slottimeconf;
+       if (sc->sc_acktimeconf > 0)
+-              ath_hal_setacktimeout(ah, 2 * offset + sc->sc_acktimeconf);
++              t->ack = sc->sc_acktimeconf;
+       if (sc->sc_ctstimeconf > 0)
+-              ath_hal_setctstimeout(ah, 2 * offset + sc->sc_ctstimeconf);
++              t->cts = sc->sc_ctstimeconf;
++
++      t->difs = 2 * t->sifs + t->slot;
++      t->eifs = t->sifs + t->difs + 3;
++
++      ath_hal_setslottime(ah, t->slot);
++      ath_hal_setacktimeout(ah, t->ack);
++      ath_hal_setctstimeout(ah, t->cts);
++      ath_hal_seteifstime(ah, t->eifs);
++
+       sc->sc_updateslot = OK;
+ }
+@@ -4516,7 +4554,7 @@ ath_updateslot(struct net_device *dev)
+       if (ic->ic_opmode == IEEE80211_M_HOSTAP)
+               sc->sc_updateslot = UPDATE;
+       else if (dev->flags & IFF_RUNNING)
+-              ath_settiming(sc);
++              ath_set_timing(sc);
+ }
+ #ifdef ATH_SUPERG_DYNTURBO
+@@ -5360,7 +5398,7 @@ ath_beacon_send(struct ath_softc *sc, in
+               sc->sc_updateslot = COMMIT;     /* commit next beacon */
+               sc->sc_slotupdate = slot;
+       } else if ((sc->sc_updateslot == COMMIT) && (sc->sc_slotupdate == slot))
+-              ath_settiming(sc);              /* commit change to hardware */
++              ath_set_timing(sc);             /* commit change to hardware */
+       if (bfaddr != 0) {
+               /*
+@@ -9433,7 +9471,8 @@ ath_set_coverageclass(struct ieee80211co
+ {
+       struct ath_softc *sc = ic->ic_dev->priv;
+-      ath_hal_setcoverageclass(sc->sc_ah, ic->ic_coverageclass, 0);
++      sc->sc_coverage = ic->ic_coverageclass * 3;
++      ath_set_timing(sc);
+       return;
+ }
+@@ -10956,6 +10995,7 @@ enum {
+       ATH_OFDM_WEAK_DET       = 29,
+       ATH_CHANBW              = 30,
+       ATH_OUTDOOR             = 31,
++      ATH_DISTANCE    = 32,
+ };
+ /*
+@@ -11168,21 +11208,31 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                                       sc->sc_slottimeconf = val;
+                               else
+                                       sc->sc_slottimeconf = 0;
+-                              ath_settiming(sc);
++                              ath_set_timing(sc);
+                               break;
+                       case ATH_ACKTIMEOUT:
+                               if (val > 0)
+                                       sc->sc_acktimeconf = val;
+                               else
+                                       sc->sc_acktimeconf = 0;
+-                              ath_settiming(sc);
++                              ath_set_timing(sc);
+                               break;
+                       case ATH_CTSTIMEOUT:
+                               if (val > 0)
+                                       sc->sc_ctstimeconf = val;
+                               else
+                                       sc->sc_ctstimeconf = 0;
+-                              ath_settiming(sc);
++                              ath_set_timing(sc);
++                              break;
++                      case ATH_DISTANCE:
++                              if (val > 0) {
++                                      sc->sc_coverage = ((val - 1) / 300) + 1;
++                                      ic->ic_coverageclass = ((sc->sc_coverage - 1) / 3) + 1;
++                              } else {
++                                      sc->sc_coverage = 0;
++                                      ic->ic_coverageclass = 0;
++                              }
++                              ath_set_timing(sc);
+                               break;
+                       case ATH_SOFTLED:
+                               if (val != sc->sc_softled) {
+@@ -11338,6 +11388,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_CHANBW:
+                       val = sc->sc_chanbw ?: 20;
+                       break;
++              case ATH_DISTANCE:
++                      val = sc->sc_coverage * 300;
++                      break;
+               case ATH_SLOTTIME:
+                       val = ath_hal_getslottime(ah);
+                       break;
+@@ -11459,6 +11512,12 @@ static const ctl_table ath_sysctl_templa
+         .extra2       = (void *)ATH_CTSTIMEOUT,
+       },
+       { .ctl_name     = CTL_AUTO,
++        .procname     = "distance",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_DISTANCE,
++      },
++      { .ctl_name     = CTL_AUTO,
+         .procname     = "softled",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+--- a/ath/if_ath_hal.h
++++ b/ath/if_ath_hal.h
+@@ -284,6 +284,17 @@ static inline u_int ath_hal_getslottime(
+       return ret;
+ }
++static inline u_int ath_hal_geteifstime(struct ath_hal *ah)
++{
++      u_int ret;
++      ATH_HAL_LOCK_IRQ(ah->ah_sc);
++      ath_hal_set_function(__func__);
++      ret = ah->ah_getEifsTime(ah);
++      ath_hal_set_function(NULL);
++      ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
++      return ret;
++}
++
+ static inline void ath_hal_beaconinit(struct ath_hal *ah, u_int32_t nexttbtt,
+                                     u_int32_t intval)
+ {
+@@ -841,6 +852,17 @@ static inline HAL_BOOL ath_hal_setslotti
+       return ret;
+ }
++static inline HAL_BOOL ath_hal_seteifstime(struct ath_hal *ah, u_int a1)
++{
++      HAL_BOOL ret;
++      ATH_HAL_LOCK_IRQ(ah->ah_sc);
++      ath_hal_set_function(__func__);
++      ret = ah->ah_setEifsTime(ah, a1);
++      ath_hal_set_function(NULL);
++      ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
++      return ret;
++}
++
+ static inline void ath_hal_setledstate(struct ath_hal *ah, HAL_LED_STATE a1)
+ {
+       ATH_HAL_LOCK_IRQ(ah->ah_sc);
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -613,6 +613,15 @@ struct ath_rp {
+       int       rp_analyzed;
+ };
++struct ath_timings {
++      u_int   slot;
++      u_int   ack;
++      u_int   cts;
++      u_int   sifs;
++      u_int   difs;
++      u_int   eifs;
++};
++
+ struct ath_softc {
+       struct ieee80211com sc_ic;              /* NB: must be first */
+       struct net_device *sc_dev;
+@@ -839,6 +848,8 @@ struct ath_softc {
+                                                * detected radars */
+       u_int32_t sc_nexttbtt;
+       u_int64_t sc_last_tsf;
++      u_int sc_coverage;
++      struct ath_timings sc_timings;
+ };
+ typedef void (*ath_callback) (struct ath_softc *);
+@@ -946,49 +957,76 @@ int ar_device(int devid);
+         DEV_NAME(_v->iv_ic->ic_dev))
+ void ath_radar_detected(struct ath_softc *sc, const char* message);
+-static inline u_int getTimingOffset(struct ath_softc *sc)
+-{
+-      struct ieee80211com *ic = &sc->sc_ic;
+-      u_int usec = 9;
+-      if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
+-              usec = 20;
+-              if (ic->ic_flags & IEEE80211_F_SHSLOT)
+-                      usec = 9;
+-      } else if (IEEE80211_IS_CHAN_A(ic->ic_curchan))
+-              usec = 9;
+-
+-      if (IEEE80211_IS_CHAN_TURBO(ic->ic_curchan))
+-              usec = 6;
+-
+-      if (IEEE80211_IS_CHAN_HALF(ic->ic_curchan))
+-              usec = 13;
+-      else if (IEEE80211_IS_CHAN_QUARTER(ic->ic_curchan))
+-              usec = 21;
+-      return usec;
+-}
+-static inline void ath_get_timings(struct ath_softc *sc, u_int *t_slot, u_int *t_sifs, u_int *t_difs)
+-{
+-      struct ieee80211_channel *c = sc->sc_ic.ic_curchan;
++#ifndef MIN
++#define MIN(a,b)        ((a) < (b) ? (a) : (b))
++#endif
++#ifndef MAX
++#define MAX(a,b)        ((a) > (b) ? (a) : (b))
++#endif
+-      *t_slot = getTimingOffset(sc) + sc->sc_slottimeconf;
+-      if (IEEE80211_IS_CHAN_HALF(c)) {
+-              *t_sifs = 32;
+-              *t_difs = 56;
+-      } else if (IEEE80211_IS_CHAN_QUARTER(c)) {
+-              *t_sifs = 64;
+-              *t_difs = 112;
+-      } else if (IEEE80211_IS_CHAN_TURBO(c)) {
+-              *t_sifs = 8;
+-              *t_difs = 28;
+-      } else {
+-              *t_sifs = 16;
+-              *t_difs = 28;
+-      }
++/* Calculate the transmit duration of a frame. */
++static inline unsigned
++calc_usecs_unicast_packet(struct ath_softc *sc, int length,
++              int rix, int short_retries, int long_retries)
++{
++              const HAL_RATE_TABLE *rt = sc->sc_currates;
++              struct ieee80211com *ic = &sc->sc_ic;
++              struct ath_timings *t = &sc->sc_timings;
++              unsigned int x = 0, tt = 0;
++              unsigned int cix = rt->info[rix].controlRate;
++              int rts = 0, cts = 0;
++              int cw = ATH_DEFAULT_CWMIN;
++
++              KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
++
++              if (!rt->info[rix].rateKbps) {
++                      printk(KERN_WARNING "rix %d (%d) bad ratekbps %d mode %u\n",
++                             rix, rt->info[rix].dot11Rate,
++                             rt->info[rix].rateKbps,
++                             sc->sc_curmode);
++                      return 0;
++              }
++
++              if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
++                      (rt->info[rix].phy == IEEE80211_T_OFDM)) {
++
++                      if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
++                              rts = 1;
++                      else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY)
++                              cts = 1;
++
++                      cix = rt->info[sc->sc_protrix].controlRate;
++              }
++
++              if ((rts || cts) && rt->info[cix].rateKbps) {
++                      int ctsrate = rt->info[cix].rateCode;
++                      int ctsduration = 0;
++
++                      ctsrate |= rt->info[cix].shortPreamble;
++                      if (rts)        /* SIFS + CTS */
++                              ctsduration += rt->info[cix].spAckDuration;
++
++                      ctsduration += ath_hal_computetxtime(sc->sc_ah,
++                                                           rt, length, rix, AH_TRUE);
++
++                      if (cts)        /* SIFS + ACK */
++                              ctsduration += rt->info[cix].spAckDuration;
++
++                      tt += (short_retries + 1) * ctsduration;
++              }
++              tt += t->difs;
++              tt += (long_retries + 1) * (t->sifs + rt->info[rix].spAckDuration);
++              tt += (long_retries + 1) * ath_hal_computetxtime(sc->sc_ah, rt, length,
++                                                      rix, AH_TRUE);
++              for (x = 0; x <= short_retries + long_retries; x++) {
++                      cw = MIN(ATH_DEFAULT_CWMAX, (cw + 1) * 2);
++                      tt += (t->slot * cw / 2);
++              }
++              return tt;
+ }
+-
+ struct ath_hw_detect {
+       const char *vendor_name;
+       const char *card_name;
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -170,85 +170,6 @@ rate_to_ndx(struct minstrel_node *sn, in
+               return -1;
+ }
+-/* Calculate the transmit duration of a frame. */
+-static unsigned
+-calc_usecs_unicast_packet(struct ath_softc *sc, int length,
+-              int rix, int short_retries, int long_retries)
+-{
+-              const HAL_RATE_TABLE *rt = sc->sc_currates;
+-              struct ieee80211com *ic = &sc->sc_ic;
+-              unsigned t_slot = 20;
+-              unsigned t_difs = 50;
+-              unsigned t_sifs = 10;
+-              unsigned int x = 0, tt = 0;
+-              unsigned int cix = rt->info[rix].controlRate;
+-              int rts = 0, cts = 0;
+-              int cw = ATH_DEFAULT_CWMIN;
+-
+-              KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+-
+-              if (!rt->info[rix].rateKbps) {
+-                      printk(KERN_WARNING "rix %d (%d) bad ratekbps %d mode %u\n",
+-                             rix, rt->info[rix].dot11Rate,
+-                             rt->info[rix].rateKbps,
+-                             sc->sc_curmode);
+-                      return 0;
+-              }
+-
+-              ath_get_timings(sc, &t_slot, &t_sifs, &t_difs);
+-              if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
+-              (rt->info[rix].phy == IEEE80211_T_OFDM)) {
+-                      if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
+-                              rts = 1;
+-                      else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY)
+-                              cts = 1;
+-
+-                      cix = rt->info[sc->sc_protrix].controlRate;
+-              }
+-
+-#if 0
+-              if (length > ic->ic_rtsthreshold)
+-                      rts = 1;
+-#endif
+-
+-              if (rts || cts) {
+-                      int ctsrate = rt->info[cix].rateCode;
+-                      int ctsduration = 0;
+-
+-                      if (!rt->info[cix].rateKbps) {
+-#if 0
+-                              printk(KERN_WARNING "cix %d (%d) bad ratekbps %d mode %u\n",
+-                                     cix, rt->info[cix].dot11Rate,
+-                                     rt->info[cix].rateKbps,
+-                                     sc->sc_curmode);
+-#endif
+-                              return 0;
+-                      }
+-
+-
+-                      ctsrate |= rt->info[cix].shortPreamble;
+-                      if (rts)        /* SIFS + CTS */
+-                              ctsduration += rt->info[cix].spAckDuration;
+-
+-                      ctsduration += ath_hal_computetxtime(sc->sc_ah,
+-                                                           rt, length, rix, AH_TRUE);
+-
+-                      if (cts)        /* SIFS + ACK */
+-                              ctsduration += rt->info[cix].spAckDuration;
+-
+-                      tt += (short_retries + 1) * ctsduration;
+-              }
+-              tt += t_difs;
+-              tt += (long_retries + 1) * (t_sifs + rt->info[rix].spAckDuration);
+-              tt += (long_retries + 1) * ath_hal_computetxtime(sc->sc_ah, rt, length,
+-                                                      rix, AH_TRUE);
+-              for (x = 0; x <= short_retries + long_retries; x++) {
+-                      cw = MIN(ATH_DEFAULT_CWMAX, (cw + 1) * 2);
+-                      tt += (t_slot * cw / 2);
+-              }
+-              return tt;
+-}
+-
+ static void
+ ath_rate_node_init(struct ath_softc *sc, struct ath_node *an)
+ {
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -137,92 +137,6 @@ rate_to_ndx(struct sample_node *sn, int 
+       return -1;
+ }
+-/*
+- * Calculate the transmit duration of a frame.
+- */
+-static unsigned
+-calc_usecs_unicast_packet(struct ath_softc *sc, int length,
+-      int rix, int short_retries, int long_retries)
+-{
+-      const HAL_RATE_TABLE *rt = sc->sc_currates;
+-      int rts, cts;
+-
+-      unsigned t_slot;
+-      unsigned t_difs;
+-      unsigned t_sifs;
+-      struct ieee80211com *ic = &sc->sc_ic;
+-      unsigned int tt = 0;
+-      unsigned int x;
+-      unsigned int cw = ATH_DEFAULT_CWMIN;
+-      unsigned int cix = rt->info[rix].controlRate;
+-      KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+-
+-      if (!rt->info[rix].rateKbps) {
+-              printk(KERN_WARNING "rix %u (%u) bad ratekbps %u mode %u\n",
+-                     rix, rt->info[rix].dot11Rate,
+-                     rt->info[rix].rateKbps,
+-                     sc->sc_curmode);
+-
+-              return 0;
+-      }
+-
+-      cix = rt->info[rix].controlRate;
+-      /* 
+-       * XXX getting mac/phy level timings should be fixed for turbo
+-       * rates, and there is probably a way to get this from the
+-       * hal...
+-       */
+-      ath_get_timings(sc, &t_slot, &t_sifs, &t_difs);
+-      rts = cts = 0;
+-
+-      if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
+-          rt->info[rix].phy == IEEE80211_T_OFDM) {
+-              if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
+-                      rts = 1;
+-              else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY)
+-                      cts = 1;
+-
+-              cix = rt->info[sc->sc_protrix].controlRate;
+-      }
+-
+-      if (0 /*length > ic->ic_rtsthreshold */)
+-              rts = 1;
+-
+-      if (rts || cts) {
+-              int ctsrate;
+-              int ctsduration = 0;
+-
+-              if (!rt->info[cix].rateKbps) {
+-                      printk(KERN_WARNING "cix %u (%u) bad ratekbps %u mode %u\n",
+-                             cix, rt->info[cix].dot11Rate,
+-                             rt->info[cix].rateKbps,
+-                             sc->sc_curmode);
+-                      return 0;
+-              }
+-
+-
+-              ctsrate = rt->info[cix].rateCode | rt->info[cix].shortPreamble;
+-              if (rts)                /* SIFS + CTS */
+-                      ctsduration += rt->info[cix].spAckDuration;
+-
+-              ctsduration += ath_hal_computetxtime(sc->sc_ah,
+-                                                   rt, length, rix, AH_TRUE);
+-
+-              if (cts)        /* SIFS + ACK */
+-                      ctsduration += rt->info[cix].spAckDuration;
+-
+-              tt += (short_retries + 1) * ctsduration;
+-      }
+-      tt += t_difs;
+-      tt += (long_retries+1)*(t_sifs + rt->info[rix].spAckDuration);
+-      tt += (long_retries+1)*ath_hal_computetxtime(sc->sc_ah, rt, length,
+-                                              rix, AH_TRUE);
+-      for (x = 0; x <= short_retries + long_retries; x++) {
+-              cw = MIN(ATH_DEFAULT_CWMAX, (cw + 1) * 2);
+-              tt += (t_slot * cw / 2);
+-      }
+-      return tt;
+-}
+ static void
+ ath_rate_node_init(struct ath_softc *sc, struct ath_node *an)
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2745,6 +2745,7 @@ ieee80211_ioctl_setparam(struct net_devi
+       case IEEE80211_PARAM_COVERAGE_CLASS:
+               if (value <= IEEE80211_COVERAGE_CLASS_MAX) {
+                       ic->ic_coverageclass = value;
++                      ic->ic_set_coverageclass(ic);
+                       if (IS_UP_AUTO(vap))
+                               ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
+                       retv = 0;
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -94,7 +94,7 @@
+ #define IEEE80211_BGSCAN_TRIGGER_INTVL 20 /* min trigger interval for thresh based bgscan (secs) */
+-#define IEEE80211_COVERAGE_CLASS_MAX  31      /* max coverage class */
++#define IEEE80211_COVERAGE_CLASS_MAX  255     /* max coverage class */
+ #define IEEE80211_REGCLASSIDS_MAX     10      /* max regclass id list */
+ #define       IEEE80211_PS_SLEEP      0x1             /* STA is in power saving mode */
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -50,7 +50,7 @@ all: compile
+ DEBUG = -DAR_DEBUG
+-ALLPROGS=     athstats 80211stats athkey athchans athctrl \
++ALLPROGS=     athstats 80211stats athkey athchans \
+       $(if $(DEBUG),athdebug 80211debug) wlanconfig ath_info
+ OBJS= $(patsubst %,%.o,$(ALLPROGS))
+--- a/tools/athctrl.c
++++ /dev/null
+@@ -1,133 +0,0 @@
+-/*-
+- * Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG
+- * 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,
+- *    without modification.
+- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+- *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+- *    redistribution must be conditioned upon including a substantially
+- *    similar Disclaimer requirement for further binary redistribution.
+- * 3. Neither the names of the above-listed copyright holders nor the names
+- *    of any contributors may be used to endorse or promote products derived
+- *    from this software without specific prior written permission.
+- *
+- * Alternatively, this software may be distributed under the terms of the
+- * GNU General Public License ("GPL") version 2 as published by the Free
+- * Software Foundation.
+- *
+- * NO WARRANTY
+- * 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 NONINFRINGEMENT, MERCHANTIBILITY
+- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+- *
+- * $Id: athctrl.c 2394 2007-05-30 01:41:18Z mtaylor $
+- */
+-
+-/*
+- * Simple Atheros-specific tool to inspect and set atheros specific values
+- * athctrl [-i interface] [-d distance]
+- * (default interface is wifi0).  
+- */
+-#include <sys/types.h>
+-#include <sys/file.h>
+-
+-#include <getopt.h>
+-
+-#include <stdio.h>
+-#include <string.h>
+-#include <stdlib.h>
+-#include <err.h>
+-
+-#include <net/if.h>
+-#include "do_multi.h"
+-
+-static int
+-setsysctrl(const char *dev, const char *control , u_long value)
+-{
+-      char buffer[256];
+-      FILE * fd;
+-
+-      snprintf(buffer, sizeof(buffer), "/proc/sys/dev/%s/%s", dev, control);
+-      fd = fopen(buffer, "w");
+-      if (fd != NULL) {
+-              fprintf(fd, "%li", value);
+-              fclose(fd);
+-      } else
+-              fprintf(stderr, "Could not open %s for writing!\n", buffer);
+-
+-      return 0;
+-}
+-
+-static void usage(void)
+-{
+-      fprintf(stderr,
+-          "Atheros driver control\n"
+-          "Copyright (c) 2002-2004 Gunter Burchardt, Local-Web AG\n"
+-          "\n"
+-          "usage: athctrl [-i interface] [-d distance]\n"
+-          "\n"
+-          "options:\n"
+-          "   -h   show this usage\n"
+-      "   -i   interface (default interface is wifi0)\n"
+-          "   -d   specify the maximum distance of a sta or the distance\n"
+-      "        of the master\n");
+-
+-      exit(1);
+-}
+-
+-int
+-CMD(athctrl)(int argc, char *argv[])
+-{
+-      char device[IFNAMSIZ + 1];
+-      int distance = -1;
+-      int c;
+-
+-      strncpy(device, "wifi0", sizeof (device));
+-
+-      for (;;) {
+-              c = getopt(argc, argv, "d:i:h");
+-              if (c < 0)
+-                      break;
+-              switch (c) {
+-              case 'h':
+-                      usage();
+-                      break;
+-              case 'd':
+-                      distance = atoi(optarg);
+-                      break;
+-              case 'i':
+-                      strncpy(device, optarg, sizeof (device));
+-                      break;
+-              default:
+-                      usage();
+-                      break;
+-              }
+-      }
+-
+-      if (distance >= 0) {
+-              int slottime = (distance / 300) + ((distance % 300) ? 1 : 0);
+-              int acktimeout = slottime * 2 + 3;
+-              int ctstimeout = slottime * 2 + 3;
+-
+-              printf("Setting distance on interface %s to %i meters\n",
+-                      device, distance);
+-              setsysctrl(device, "slottime", slottime);
+-              setsysctrl(device, "acktimeout", acktimeout);
+-              setsysctrl(device, "ctstimeout", ctstimeout);
+-      } else
+-              usage();
+-      return 0;
+-}
+--- a/tools/do_multi.c
++++ b/tools/do_multi.c
+@@ -18,8 +18,6 @@ main(int argc, char *argv[])
+       ret = a80211stats_init(argc, argv);
+     if(strcmp(progname, "athchans") == 0)
+       ret = athchans_init(argc, argv);
+-    if(strcmp(progname, "athctrl") == 0)
+-      ret =  athctrl_init(argc, argv);
+ #ifdef AR_DEBUG
+     if(strcmp(progname, "athdebug") == 0)
+       ret =  athdebug_init(argc, argv);
+--- a/tools/do_multi.h
++++ b/tools/do_multi.h
+@@ -2,7 +2,6 @@
+ int a80211debug_init(int argc, char *argv[]);
+ int a80211stats_init(int argc, char *argv[]);
+ int athchans_init(int argc, char *argv[]);
+-int athctrl_init(int argc, char *argv[]);
+ int athdebug_init(int argc, char *argv[]);
+ int athkey_init(int argc, char *argv[]);
+ int athstats_init(int argc, char *argv[]);
+--- a/ath_rate/minstrel/minstrel.h
++++ b/ath_rate/minstrel/minstrel.h
+@@ -172,14 +172,6 @@ struct minstrel_node {
+ #define       ATH_NODE_MINSTREL(an)   ((struct minstrel_node *)&an[1])
+-
+-#ifndef MIN
+-#define MIN(a,b)        ((a) < (b) ? (a) : (b))
+-#endif
+-#ifndef MAX
+-#define MAX(a,b)        ((a) > (b) ? (a) : (b))
+-#endif
+-
+ /*
+  * Definitions for pulling the rate and trie counts from
+  * a 5212 h/w descriptor. These Don't belong here; the
+--- a/ath_rate/sample/sample.h
++++ b/ath_rate/sample/sample.h
+@@ -98,14 +98,6 @@ struct sample_node {
+ };
+ #define       ATH_NODE_SAMPLE(an)     ((struct sample_node *)&an[1])
+-
+-#ifndef MIN
+-#define MIN(a,b)        ((a) < (b) ? (a) : (b))
+-#endif
+-#ifndef MAX
+-#define MAX(a,b)        ((a) > (b) ? (a) : (b))
+-#endif
+-
+ /*
+  * Definitions for pulling the rate and trie counts from
+  * a 5212 h/w descriptor. These Don't belong here; the
diff --git a/net/madwifi/patches/425-rc_rexmit.patch b/net/madwifi/patches/425-rc_rexmit.patch
new file mode 100644 (file)
index 0000000..10a6f9c
--- /dev/null
@@ -0,0 +1,506 @@
+--- a/net80211/ieee80211_rate.h
++++ b/net80211/ieee80211_rate.h
+@@ -81,6 +81,8 @@ struct ieee80211vap;
+ /* Multi-rare retry: 3 additional rate/retry pairs */
+ struct ieee80211_mrr {
++      int rate0;
++      int retries0;
+       int rate1;
+       int retries1;
+       int rate2;
+@@ -142,7 +144,7 @@ struct ieee80211_rate_ops {
+        * for packets that were successfully sent and for those that
+        * failed (consult the descriptor for details). */
+       void (*tx_complete)(struct ath_softc *sc, struct ath_node *an,
+-                          const struct ath_buf *bf);
++                          const struct ath_buf *bf, const struct ieee80211_mrr *mrr);
+ };
+ struct ath_ratectrl {
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -8638,6 +8638,8 @@ ath_tx_processq(struct ath_softc *sc, st
+               ni = bf->bf_node;
+               if (ni != NULL) {
++                      struct ieee80211_mrr mrr;
++
+                       an = ATH_NODE(ni);
+                       if (ts->ts_status == 0) {
+                               u_int8_t txant = ts->ts_antenna;
+@@ -8690,15 +8692,43 @@ ath_tx_processq(struct ath_softc *sc, st
+                       lr = ts->ts_longretry;
+                       sc->sc_stats.ast_tx_shortretry += sr;
+                       sc->sc_stats.ast_tx_longretry += lr;
++                      memset(&mrr, 0, sizeof(mrr));
++
++                      switch(ah->ah_macType) {
++                      case 5210:
++                      case 5211:
++                              goto skip_mrr;
++
++                      case 5212:
++                              mrr.rate0 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate0)].ieeerate;
++                              mrr.rate1 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate1)].ieeerate;
++                              mrr.rate2 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate2)].ieeerate;
++                              mrr.rate3 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate3)].ieeerate;
++                              break;
++
++                      case 5416:
++                              mrr.rate0 = sc->sc_hwmap[MS(ds->ds_ctl3, AR5416_XmitRate0)].ieeerate;
++                              mrr.rate1 = sc->sc_hwmap[MS(ds->ds_ctl3, AR5416_XmitRate1)].ieeerate;
++                              mrr.rate2 = sc->sc_hwmap[MS(ds->ds_ctl3, AR5416_XmitRate2)].ieeerate;
++                              mrr.rate3 = sc->sc_hwmap[MS(ds->ds_ctl3, AR5416_XmitRate3)].ieeerate;
++                              break;
++                      }
++
++                      mrr.retries0 = MS(ds->ds_ctl2, AR_XmitDataTries0);
++                      mrr.retries1 = MS(ds->ds_ctl2, AR_XmitDataTries1);
++                      mrr.retries2 = MS(ds->ds_ctl2, AR_XmitDataTries2);
++                      mrr.retries3 = MS(ds->ds_ctl2, AR_XmitDataTries3);
++
+                       /*
+                        * Hand the descriptor to the rate control algorithm
+                        * if the frame wasn't dropped for filtering or sent
+                        * w/o waiting for an ack.  In those cases the rssi
+                        * and retry counts will be meaningless.
+                        */
++skip_mrr:
+                       if ((ts->ts_status & HAL_TXERR_FILT) == 0 &&
+                           (bf->bf_flags & HAL_TXDESC_NOACK) == 0)
+-                              sc->sc_rc->ops->tx_complete(sc, an, bf);
++                              sc->sc_rc->ops->tx_complete(sc, an, bf, &mrr);
+               }
+               bus_unmap_single(sc->sc_bdev, bf->bf_skbaddr,
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -595,6 +595,46 @@ struct ath_vap {
+       (_tqs)->axq_link = NULL; \
+ } while (0)
++/*
++ * Definitions for pulling the rate and trie counts from
++ * a 5212 h/w descriptor. These Don't belong here; the
++ * driver should record this information so the rate control
++ * code doesn't go groveling around in the descriptor bits.
++ */
++#define       ds_ctl2 ds_hw[0]
++#define       ds_ctl3 ds_hw[1]
++
++/* TX ds_ctl3 */
++#define       AR_XmitDataTries0       0x000f0000      /* series 0 max attempts */
++#define       AR_XmitDataTries0_S     16
++#define       AR_XmitDataTries1       0x00f00000      /* series 1 max attempts */
++#define       AR_XmitDataTries1_S     20
++#define       AR_XmitDataTries2       0x0f000000      /* series 2 max attempts */
++#define       AR_XmitDataTries2_S     24
++#define       AR_XmitDataTries3       0xf0000000      /* series 3 max attempts */
++#define       AR_XmitDataTries3_S     28
++
++/* TX ds_ctl3 */
++#define       AR_XmitRate0            0x0000001f      /* series 0 tx rate */
++#define       AR_XmitRate0_S          0
++#define       AR_XmitRate1            0x000003e0      /* series 1 tx rate */
++#define       AR_XmitRate1_S          5
++#define       AR_XmitRate2            0x00007c00      /* series 2 tx rate */
++#define       AR_XmitRate2_S          10
++#define       AR_XmitRate3            0x000f8000      /* series 3 tx rate */
++#define       AR_XmitRate3_S          15
++
++#define AR5416_XmitRate0        0x000000ff
++#define AR5416_XmitRate0_S      0
++#define AR5416_XmitRate1        0x0000ff00
++#define AR5416_XmitRate1_S      8
++#define AR5416_XmitRate2        0x00ff0000
++#define AR5416_XmitRate2_S      16
++#define AR5416_XmitRate3        0xff000000
++#define AR5416_XmitRate3_S      24
++
++#define MS(_v, _f)    (((_v) & (_f)) >> _f##_S)
++
+ /* 
+  * concat buffers from one queue to other
+  */
+--- a/ath_rate/amrr/amrr.c
++++ b/ath_rate/amrr/amrr.c
+@@ -123,7 +123,8 @@ ath_rate_get_mrr(struct ath_softc *sc, s
+ static void
+ ath_rate_tx_complete(struct ath_softc *sc,
+-      struct ath_node *an, const struct ath_buf *bf)
++      struct ath_node *an, const struct ath_buf *bf,
++      const struct ieee80211_mrr *mrr)
+ {
+       struct amrr_node *amn = ATH_NODE_AMRR(an);
+       const struct ath_tx_status *ts = &bf->bf_dsstatus.ds_txstat;
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -333,7 +333,8 @@ ath_rate_get_mrr(struct ath_softc *sc, s
+ static void
+ ath_rate_tx_complete(struct ath_softc *sc,
+-              struct ath_node *an, const struct ath_buf *bf)
++              struct ath_node *an, const struct ath_buf *bf,
++              const struct ieee80211_mrr *mrr)
+ {
+               struct minstrel_node *sn = ATH_NODE_MINSTREL(an);
+               struct ieee80211com *ic = &sc->sc_ic;
+@@ -341,12 +342,9 @@ ath_rate_tx_complete(struct ath_softc *s
+               const struct ath_desc *ds = &bf->bf_desc[0];
+               int final_rate = 0;
+               int tries = 0;
+-              int mrr;
++              int use_mrr;
+               int final_ndx;
+-              int rate0, tries0, ndx0;
+-              int rate1, tries1, ndx1;
+-              int rate2, tries2, ndx2;
+-              int rate3, tries3, ndx3;
++              int ndx0, ndx1, ndx2, ndx3;
+               /* This is the index in the retry chain we finish at.
+                * With no retransmits, it is always 0.
+@@ -376,9 +374,9 @@ ath_rate_tx_complete(struct ath_softc *s
+               if (!ts->ts_status)  /* Success when sending a packet*/
+                       sn->rs_ratesuccess[final_ndx]++;
+-              mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR;
++              use_mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR;
+-              if (!mrr) {
++              if (!use_mrr) {
+                       if ((0 <= final_ndx) && (final_ndx < sn->num_rates)) {
+                               sn->rs_rateattempts[final_ndx] += tries; /* only one rate was used */
+                       }
+@@ -388,47 +386,36 @@ ath_rate_tx_complete(struct ath_softc *s
+               /* Now, query the hal/hardware to find out the contents of the multirate retry chain.
+                * If we have it set to 6,3,2,2, this call will always return 6,3,2,2. For some packets, we can
+                * get a mrr of 0, -1, -1, -1, which indicates there is no chain installed for that packet */
+-              rate0 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate0)].ieeerate;
+-              tries0 = MS(ds->ds_ctl2, AR_XmitDataTries0);
+-              ndx0 = rate_to_ndx(sn, rate0);
++              ndx0 = rate_to_ndx(sn, mrr->rate0);
++              ndx1 = rate_to_ndx(sn, mrr->rate1);
++              ndx2 = rate_to_ndx(sn, mrr->rate2);
++              ndx3 = rate_to_ndx(sn, mrr->rate3);
+-              rate1 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate1)].ieeerate;
+-              tries1 = MS(ds->ds_ctl2, AR_XmitDataTries1);
+-              ndx1 = rate_to_ndx(sn, rate1);
+-
+-              rate2 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate2)].ieeerate;
+-              tries2 = MS(ds->ds_ctl2, AR_XmitDataTries2);
+-              ndx2 = rate_to_ndx(sn, rate2);
+-
+-              rate3 = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate3)].ieeerate;
+-              tries3 = MS(ds->ds_ctl2, AR_XmitDataTries3);
+-              ndx3 = rate_to_ndx(sn, rate3);
+-
+-              sn->rs_rateattempts[ndx0] += MIN(tries, tries0);
+-              if (tries <= tries0)
++              sn->rs_rateattempts[ndx0] += MIN(tries, mrr->retries0);
++              if (tries <= mrr->retries0)
+                       return;
+-              if (tries1 < 0)
++              if (mrr->retries1 < 0)
+                       return;
+-              tries = tries - tries0;
+-              sn->rs_rateattempts[ndx1] += MIN(tries, tries1);
+-              if (tries <= tries1)
++              tries = tries - mrr->retries0;
++              sn->rs_rateattempts[ndx1] += MIN(tries, mrr->retries1);
++              if (tries <= mrr->retries1)
+                       return;
+               if (bf->rcflags)
+                       sn->sample_count++;
+-              if  (tries2 < 0)
++              if (mrr->retries2 < 0)
+                       return;
+-              tries = tries - tries1;
+-              sn->rs_rateattempts[ndx2] += MIN(tries, tries2);
+-              if (tries <= tries2)
++              tries = tries - mrr->retries1;
++              sn->rs_rateattempts[ndx2] += MIN(tries, mrr->retries2);
++              if (tries <= mrr->retries2)
+                       return;
+-              if  (tries3 < 0)
++              if (mrr->retries3 < 0)
+                       return;
+-              tries = tries - tries2;
+-              sn->rs_rateattempts[ndx3] += MIN(tries, tries3);
++              tries = tries - mrr->retries2;
++              sn->rs_rateattempts[ndx3] += MIN(tries, mrr->retries3);
+ }
+ static void
+--- a/ath_rate/minstrel/minstrel.h
++++ b/ath_rate/minstrel/minstrel.h
+@@ -172,36 +172,6 @@ struct minstrel_node {
+ #define       ATH_NODE_MINSTREL(an)   ((struct minstrel_node *)&an[1])
+-/*
+- * Definitions for pulling the rate and trie counts from
+- * a 5212 h/w descriptor. These Don't belong here; the
+- * driver should record this information so the rate control
+- * code doesn't go groveling around in the descriptor bits.
+- */
+-#define       ds_ctl2 ds_hw[0]
+-#define       ds_ctl3 ds_hw[1]
+-
+-/* TX ds_ctl3 */
+-#define       AR_XmitDataTries0       0x000f0000      /* series 0 max attempts */
+-#define       AR_XmitDataTries0_S     16
+-#define       AR_XmitDataTries1       0x00f00000      /* series 1 max attempts */
+-#define       AR_XmitDataTries1_S     20
+-#define       AR_XmitDataTries2       0x0f000000      /* series 2 max attempts */
+-#define       AR_XmitDataTries2_S     24
+-#define       AR_XmitDataTries3       0xf0000000      /* series 3 max attempts */
+-#define       AR_XmitDataTries3_S     28
+-
+-/* TX ds_ctl3 */
+-#define       AR_XmitRate0            0x0000001f      /* series 0 tx rate */
+-#define       AR_XmitRate0_S          0
+-#define       AR_XmitRate1            0x000003e0      /* series 1 tx rate */
+-#define       AR_XmitRate1_S          5
+-#define       AR_XmitRate2            0x00007c00      /* series 2 tx rate */
+-#define       AR_XmitRate2_S          10
+-#define       AR_XmitRate3            0x000f8000      /* series 3 tx rate */
+-#define       AR_XmitRate3_S          15
+-
+-#define MS(_v, _f)    (((_v) & (_f)) >> _f##_S)
+ #endif /* _DEV_ATH_RATE_MINSTEL_H */
+ /* The comment below is magic for those who use emacs to edit this file. */
+--- a/ath_rate/onoe/onoe.c
++++ b/ath_rate/onoe/onoe.c
+@@ -137,7 +137,8 @@ ath_rate_get_mrr(struct ath_softc *sc, s
+ static void
+ ath_rate_tx_complete(struct ath_softc *sc,
+-      struct ath_node *an, const struct ath_buf *bf)
++      struct ath_node *an, const struct ath_buf *bf,
++      const struct ieee80211_mrr *mrr)
+ {
+       struct onoe_node *on = ATH_NODE_ONOE(an);
+       const struct ath_tx_status *ts = &bf->bf_dsstatus.ds_txstat;
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -178,10 +178,6 @@ static __inline int best_rate_ndx(struct
+                   !sn->stats[size_bin][x].packets_acked))
+                       continue;
+-              /* 9 megabits never works better than 12 */
+-              if (sn->rates[x].rate == 18)
+-                      continue;
+-
+               /* don't use a bit-rate that has been failing */
+               if (sn->stats[size_bin][x].successive_failures > 3)
+                       continue;
+@@ -234,10 +230,6 @@ pick_sample_ndx(struct sample_node *sn, 
+               if (sn->rates[ndx].rate > 22 && ndx > current_ndx + 2)
+                       continue;
+-              /* 9 megabits never works better than 12 */
+-              if (sn->rates[ndx].rate == 18)
+-                      continue;
+-
+               /* if we're using 11 megabits, only sample up to 12 megabits
+                */
+               if (sn->rates[current_ndx].rate == 22 && ndx > current_ndx + 1)
+@@ -531,7 +523,8 @@ update_stats(struct ath_softc *sc, struc
+ static void
+ ath_rate_tx_complete(struct ath_softc *sc,
+-      struct ath_node *an, const struct ath_buf *bf)
++      struct ath_node *an, const struct ath_buf *bf,
++      const struct ieee80211_mrr *mrr)
+ {
+       struct sample_node *sn = ATH_NODE_SAMPLE(an);
+       struct ieee80211com *ic = &sc->sc_ic;
+@@ -541,7 +534,7 @@ ath_rate_tx_complete(struct ath_softc *s
+       unsigned int short_tries;
+       unsigned int long_tries;
+       unsigned int frame_size;
+-      unsigned int mrr;
++      unsigned int use_mrr;
+       final_rate = sc->sc_hwmap[ts->ts_rate &~ HAL_TXSTAT_ALTRATE].ieeerate;
+       short_tries = ts->ts_shortretry + 1;
+@@ -557,7 +550,7 @@ ath_rate_tx_complete(struct ath_softc *s
+               return;
+       }
+-      mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR;
++      use_mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR;
+       if (sc->sc_mrretry && ts->ts_status) {
+@@ -566,22 +559,15 @@ ath_rate_tx_complete(struct ath_softc *s
+                       dev_info,
+                       MAC_ADDR(an->an_node.ni_macaddr),
+                       bin_to_size(size_to_bin(frame_size)),
+-                      sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate0)].ieeerate,
+-                              MS(ds->ds_ctl2, AR_XmitDataTries0),
+-                      sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate1)].ieeerate,
+-                              MS(ds->ds_ctl2, AR_XmitDataTries1),
+-                      sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate2)].ieeerate,
+-                              MS(ds->ds_ctl2, AR_XmitDataTries2),
+-                      sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate3)].ieeerate,
+-                              MS(ds->ds_ctl2, AR_XmitDataTries3),
++                      mrr->rate0,
++                      mrr->rate1,
++                      mrr->rate2,
++                      mrr->rate3,
+                       ts->ts_status ? "FAIL" : "OK",
+                       short_tries, long_tries);
+       }
+-      mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT) && ENABLE_MRR;
+-
+-
+-      if (!mrr || !(ts->ts_rate & HAL_TXSTAT_ALTRATE)) {
++      if (!use_mrr || !(ts->ts_rate & HAL_TXSTAT_ALTRATE)) {
+               /* only one rate was used */
+               int ndx = rate_to_ndx(sn, final_rate);
+               if ((ndx >= 0) && (ndx < sn->num_rates)) {
+@@ -593,7 +579,6 @@ ath_rate_tx_complete(struct ath_softc *s
+                               short_tries, long_tries, ts->ts_status);
+               }
+       } else {
+-              unsigned int rate[4], tries[4];
+               int ndx[4];
+               int finalTSIdx = ts->ts_finaltsi;
+@@ -601,21 +586,10 @@ ath_rate_tx_complete(struct ath_softc *s
+                * Process intermediate rates that failed.
+                */
+-              rate[0] = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate0)].ieeerate;
+-              tries[0] = MS(ds->ds_ctl2, AR_XmitDataTries0);
+-              ndx[0] = rate_to_ndx(sn, rate[0]);
+-
+-              rate[1] = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate1)].ieeerate;
+-              tries[1] = MS(ds->ds_ctl2, AR_XmitDataTries1);
+-              ndx[1] = rate_to_ndx(sn, rate[1]);
+-
+-              rate[2] = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate2)].ieeerate;
+-              tries[2] = MS(ds->ds_ctl2, AR_XmitDataTries2);
+-              ndx[2] = rate_to_ndx(sn, rate[2]);
+-
+-              rate[3] = sc->sc_hwmap[MS(ds->ds_ctl3, AR_XmitRate3)].ieeerate;
+-              tries[3] = MS(ds->ds_ctl2, AR_XmitDataTries3);
+-              ndx[3] = rate_to_ndx(sn, rate[3]);
++              ndx[0] = rate_to_ndx(sn, mrr->rate0);
++              ndx[1] = rate_to_ndx(sn, mrr->rate1);
++              ndx[2] = rate_to_ndx(sn, mrr->rate2);
++              ndx[3] = rate_to_ndx(sn, mrr->rate3);
+ #if 0
+               DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " size %u finaltsidx %u tries %u status %u rate/try %u/%u %u/%u %u/%u %u/%u\n",
+@@ -636,43 +610,43 @@ ath_rate_tx_complete(struct ath_softc *s
+                * sample higher rates 1 try at a time doing so
+                * may unfairly penalize them.
+                */
+-              if (tries[0] && ndx[0] >= 0) {
++              if (mrr->retries0 && ndx[0] >= 0) {
+                       update_stats(sc, an, frame_size,
+-                              ndx[0], tries[0],
+-                              ndx[1], tries[1],
+-                              ndx[2], tries[2],
+-                              ndx[3], tries[3],
++                              ndx[0], mrr->retries0,
++                              ndx[1], mrr->retries1,
++                              ndx[2], mrr->retries2,
++                              ndx[3], mrr->retries3,
+                               short_tries, long_tries,
+-                              long_tries > tries[0]);
+-                      long_tries -= tries[0];
++                              long_tries > mrr->retries0);
++                      long_tries -= mrr->retries0;
+               }
+-              if (tries[1] && ndx[1] >= 0 && finalTSIdx > 0) {
++              if (mrr->retries1 && ndx[1] >= 0 && finalTSIdx > 0) {
+                       update_stats(sc, an, frame_size,
+-                              ndx[1], tries[1],
+-                              ndx[2], tries[2],
+-                              ndx[3], tries[3],
++                              ndx[1], mrr->retries1,
++                              ndx[2], mrr->retries2,
++                              ndx[3], mrr->retries3,
+                               0, 0,
+                               short_tries, long_tries,
+                               ts->ts_status);
+-                      long_tries -= tries[1];
++                      long_tries -= mrr->retries1;
+               }
+-              if (tries[2] && ndx[2] >= 0 && finalTSIdx > 1) {
++              if (mrr->retries2 && ndx[2] >= 0 && finalTSIdx > 1) {
+                       update_stats(sc, an, frame_size,
+-                              ndx[2], tries[2],
+-                              ndx[3], tries[3],
++                              ndx[2], mrr->retries2,
++                              ndx[3], mrr->retries3,
+                               0, 0,
+                               0, 0,
+                               short_tries, long_tries,
+                               ts->ts_status);
+-                      long_tries -= tries[2];
++                      long_tries -= mrr->retries2;
+               }
+-              if (tries[3] && ndx[3] >= 0 && finalTSIdx > 2) {
++              if (mrr->retries3 && ndx[3] >= 0 && finalTSIdx > 2) {
+                       update_stats(sc, an, frame_size,
+-                              ndx[3], tries[3],
++                              ndx[3], mrr->retries3,
+                               0, 0,
+                               0, 0,
+                               0, 0,
+--- a/ath_rate/sample/sample.h
++++ b/ath_rate/sample/sample.h
+@@ -98,35 +98,4 @@ struct sample_node {
+ };
+ #define       ATH_NODE_SAMPLE(an)     ((struct sample_node *)&an[1])
+-/*
+- * Definitions for pulling the rate and trie counts from
+- * a 5212 h/w descriptor. These Don't belong here; the
+- * driver should record this information so the rate control
+- * code doesn't go groveling around in the descriptor bits.
+- */
+-#define       ds_ctl2 ds_hw[0]
+-#define       ds_ctl3 ds_hw[1]
+-
+-/* TX ds_ctl3 */
+-#define       AR_XmitDataTries0       0x000f0000      /* series 0 max attempts */
+-#define       AR_XmitDataTries0_S     16
+-#define       AR_XmitDataTries1       0x00f00000      /* series 1 max attempts */
+-#define       AR_XmitDataTries1_S     20
+-#define       AR_XmitDataTries2       0x0f000000      /* series 2 max attempts */
+-#define       AR_XmitDataTries2_S     24
+-#define       AR_XmitDataTries3       0xf0000000      /* series 3 max attempts */
+-#define       AR_XmitDataTries3_S     28
+-
+-/* TX ds_ctl3 */
+-#define       AR_XmitRate0            0x0000001f      /* series 0 tx rate */
+-#define       AR_XmitRate0_S          0
+-#define       AR_XmitRate1            0x000003e0      /* series 1 tx rate */
+-#define       AR_XmitRate1_S          5
+-#define       AR_XmitRate2            0x00007c00      /* series 2 tx rate */
+-#define       AR_XmitRate2_S          10
+-#define       AR_XmitRate3            0x000f8000      /* series 3 tx rate */
+-#define       AR_XmitRate3_S          15
+-
+-#define MS(_v, _f)    (((_v) & (_f)) >> _f##_S)
+-
+ #endif /* _DEV_ATH_RATE_SAMPLE_H */
diff --git a/net/madwifi/patches/426-header_len.patch b/net/madwifi/patches/426-header_len.patch
new file mode 100644 (file)
index 0000000..acfbc18
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -888,9 +888,6 @@ ath_attach(u_int16_t devid, struct net_d
+                               IEEE80211_ADDR_LEN +
+                               IEEE80211_WEP_IVLEN +
+                               IEEE80211_WEP_KIDLEN;
+-#ifdef ATH_SUPERG_FF
+-      dev->hard_header_len += ATH_FF_MAX_HDR;
+-#endif
+ #endif
+       dev->type = ARPHRD_IEEE80211;
diff --git a/net/madwifi/patches/427-ignore_eeprom_ff.patch b/net/madwifi/patches/427-ignore_eeprom_ff.patch
new file mode 100644 (file)
index 0000000..eead70c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -915,7 +915,7 @@ ath_attach(u_int16_t devid, struct net_d
+       ic->ic_ath_cap = 0;
+       sc->sc_fftxqmin = ATH_FF_TXQMIN;
+ #ifdef ATH_SUPERG_FF
+-      ic->ic_ath_cap |= (ath_hal_fastframesupported(ah) ? 
++      ic->ic_ath_cap |= (ah->ah_macType >= 5212 ?
+                       IEEE80211_ATHC_FF : 0);
+ #endif
+       ic->ic_ath_cap |= (ath_hal_burstsupported(ah) ? 
diff --git a/net/madwifi/patches/430-use_netdev_priv.patch b/net/madwifi/patches/430-use_netdev_priv.patch
new file mode 100644 (file)
index 0000000..7a5ae84
--- /dev/null
@@ -0,0 +1,1936 @@
+--- a/ath/ath_wprobe.c
++++ b/ath/ath_wprobe.c
+@@ -119,7 +119,7 @@ ath_wprobe_sync(struct wprobe_iface *dev
+       struct ath_vap *avp = container_of(dev, struct ath_vap, av_wpif);
+       struct ieee80211vap *vap = &avp->av_vap;
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u32 cc, busy, rx, tx;
+       s16 noise;
+@@ -192,7 +192,7 @@ ath_lookup_rateval(struct ieee80211_node
+ {
+       struct ieee80211vap *vap = ni->ni_vap;
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       const HAL_RATE_TABLE *rt = sc->sc_currates;
+       if ((!rt) || (rate < 0) || (rate >= ARRAY_SIZE(sc->sc_hwmap)))
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
+@@ -203,7 +203,7 @@ static int ahb_wmac_probe(struct platfor
+       if (!dev)
+               return -ENOMEM;
+-      sc = dev->priv;
++      sc = netdev_priv(dev);
+       sc->aps_sc.sc_dev = dev;
+       dev->irq = platform_get_irq(pdev, 0);
+@@ -300,7 +300,7 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+               printk(KERN_ERR "%s: no memory for device state\n", dev_info);
+               goto bad2;
+       }
+-      sc = dev->priv;
++      sc = netdev_priv(dev);
+       sc->aps_sc.sc_dev = dev;
+       /*
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -569,7 +569,7 @@ static inline int rate_factor(int mode)
+ int
+ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ieee80211vap *vap;
+       struct ath_hal *ah;
+@@ -1206,7 +1206,7 @@ bad:
+ int
+ ath_detach(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       HAL_INT tmp;
+@@ -1266,7 +1266,7 @@ static struct ieee80211vap *
+ ath_vap_create(struct ieee80211com *ic, const char *name,
+       int opmode, int flags, struct net_device *mdev, struct ieee80211vap *master)
+ {
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct net_device *dev;
+       struct ath_vap *avp;
+@@ -1344,7 +1344,7 @@ ath_vap_create(struct ieee80211com *ic, 
+               return NULL;
+       }
+-      avp = dev->priv;
++      avp = netdev_priv(dev);
+       ieee80211_vap_setup(ic, dev, name, opmode, flags, master);
+       /* override with driver methods */
+       vap = &avp->av_vap;
+@@ -1571,7 +1571,7 @@ static void
+ ath_vap_delete(struct ieee80211vap *vap)
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ath_vap *avp = ATH_VAP(vap);
+       int decrease = 1;
+@@ -1673,7 +1673,7 @@ void
+ ath_suspend(struct net_device *dev)
+ {
+ #ifdef AR_DEBUG
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+ #endif
+       DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
+@@ -1684,7 +1684,7 @@ void
+ ath_resume(struct net_device *dev)
+ {
+ #ifdef AR_DEBUG
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+ #endif
+       DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
+@@ -2248,7 +2248,7 @@ ath_intr(int irq, void *dev_id, struct p
+ #endif
+ {
+       struct net_device *dev = dev_id;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u_int64_t hw_tsf = 0;
+       HAL_INT status;
+@@ -2469,7 +2469,7 @@ static void
+ ath_fatal_tasklet(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       EPRINTF(sc, "Hardware error; resetting.\n");
+       ath_reset(dev);
+@@ -2479,7 +2479,7 @@ static void
+ ath_rxorn_tasklet(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       EPRINTF(sc, "Receive FIFO overrun; resetting.\n");
+       ath_reset(dev);
+@@ -2489,7 +2489,7 @@ static void
+ ath_bmiss_tasklet(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       if (time_before(jiffies, sc->sc_ic.ic_bmiss_guard)) {
+               /* Beacon miss interrupt occured too short after last beacon
+@@ -2568,7 +2568,7 @@ done:
+ static int
+ ath_init(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+       HAL_STATUS status;
+@@ -2693,7 +2693,7 @@ done:
+ static int
+ ath_stop_locked(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+@@ -2778,7 +2778,7 @@ static void ath_set_beacon_cal(struct at
+ static int
+ ath_stop(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       int error;
+       ATH_LOCK(sc);
+@@ -2998,7 +2998,7 @@ ath_fetch_idle_time(struct ath_softc *sc
+ static int
+ ath_reset(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211_channel *c;
+@@ -3164,7 +3164,7 @@ dot11_to_ratecode(struct ath_softc *sc, 
+ static int
+ ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
+               (SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
+@@ -3477,7 +3477,7 @@ _take_txbuf(struct ath_softc *sc, int fo
+ static int
+ ath_hardstart(struct sk_buff *skb, struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211_node *ni = NULL;
+       struct ath_buf *bf = NULL;
+       ath_bufhead bf_head;
+@@ -3792,7 +3792,7 @@ static int
+ ath_mgtstart(struct ieee80211com *ic, struct sk_buff *skb)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_buf *bf = NULL;
+       int error;
+@@ -4151,7 +4151,7 @@ static ieee80211_keyix_t
+ ath_key_alloc(struct ieee80211vap *vap, const struct ieee80211_key *k)
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       /*
+        * Group key allocation must be handled specially for
+@@ -4216,7 +4216,7 @@ ath_key_delete(struct ieee80211vap *vap,
+                               struct ieee80211_node *ninfo)
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211_node *ni = NULL;
+       const struct ieee80211_cipher *cip = k->wk_cipher;
+@@ -4292,14 +4292,14 @@ ath_key_set(struct ieee80211vap *vap, co
+       const u_int8_t mac[IEEE80211_ADDR_LEN])
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       return ath_keyset(sc, k, mac, vap->iv_bss);
+ }
+ static void ath_poll_disable(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       /*
+        * XXX Using in_softirq is not right since we might
+@@ -4317,7 +4317,7 @@ static void ath_poll_disable(struct net_
+ static void ath_poll_enable(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       /* NB: see above */
+       if (!in_softirq()) {
+@@ -4343,7 +4343,7 @@ ath_key_update_begin(struct ieee80211vap
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
+ #ifdef AR_DEBUG
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+ #endif
+       DPRINTF(sc, ATH_DEBUG_KEYCACHE, "Begin\n");
+@@ -4361,7 +4361,7 @@ ath_key_update_end(struct ieee80211vap *
+ {
+       struct net_device *dev = vap->iv_ic->ic_dev;
+ #ifdef AR_DEBUG
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+ #endif
+       DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
+@@ -4454,7 +4454,7 @@ ath_merge_mcast(struct ath_softc *sc, u_
+ static void
+ ath_mode_init(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u_int32_t rfilt, mfilt[2];
+@@ -4540,7 +4540,7 @@ ath_set_timing(struct ath_softc *sc)
+ static void
+ ath_updateslot(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       /*
+@@ -4570,7 +4570,7 @@ ath_beacon_dturbo_config(struct ieee8021
+       (vap->iv_bss && (vap->iv_bss->ni_ath_flags & (IEEE80211_ATHC_TURBOP)) == \
+               (IEEE80211_ATHC_TURBOP))
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       if (ic->ic_opmode == IEEE80211_M_HOSTAP && IS_CAPABLE(vap)) {
+@@ -4618,7 +4618,7 @@ static void
+ ath_beacon_dturbo_update(struct ieee80211vap *vap, int *needmark, u_int8_t dtim)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       u_int32_t bss_traffic;
+       if (sc->sc_ignore_ar) {
+@@ -4759,7 +4759,7 @@ static void
+ ath_turbo_switch_mode(unsigned long data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       unsigned int newflags;
+@@ -5438,7 +5438,7 @@ static void
+ ath_bstuck_tasklet(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       /*
+        * XXX:if the bmisscount is cleared while the
+        *     tasklet execution is pending, the following
+@@ -5891,7 +5891,7 @@ ath_node_alloc_debug(struct ieee80211vap
+ ath_node_alloc(struct ieee80211vap *vap)
+ #endif 
+ {
+-      struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
+       const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space;
+       struct ath_node *an = kmalloc(space, GFP_ATOMIC);
+       if (an != NULL) {
+@@ -5927,7 +5927,7 @@ ath_node_cleanup(struct ieee80211_node *
+ #endif
+ {
+       struct ieee80211com *ic = ni->ni_ic;
+-      struct ath_softc *sc = ni->ni_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ni->ni_ic->ic_dev);
+       struct ath_node *an = ATH_NODE(ni);
+       struct ath_buf *bf;
+@@ -5985,7 +5985,7 @@ ath_node_free_debug(struct ieee80211_nod
+ ath_node_free(struct ieee80211_node *ni)
+ #endif
+ {
+-      struct ath_softc *sc = ni->ni_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ni->ni_ic->ic_dev);
+ #ifdef IEEE80211_DEBUG_REFCNT
+       sc->sc_node_free_debug(ni, func, line);
+@@ -6033,7 +6033,7 @@ ath_node_move_data(const struct ieee8021
+ #ifdef NOT_YET
+       struct ath_txq *txq = NULL;
+       struct ieee80211com *ic = ni->ni_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct ath_buf *bf, *prev, *bf_tmp, *bf_tmp1;
+       struct ath_hal *ah = sc->sc_ah;
+       struct sk_buff *skb = NULL;
+@@ -6553,7 +6553,7 @@ static void
+ ath_capture(struct net_device *dev, const struct ath_buf *bf,
+               struct sk_buff *skb, u_int64_t tsf, unsigned int tx)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct sk_buff *tskb = NULL;
+   
+@@ -6613,7 +6613,7 @@ static void
+ ath_recv_mgmt(struct ieee80211vap * vap, struct ieee80211_node *ni_or_null,
+       struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf)
+ {
+-      struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
+ #ifdef AR_DEBUG
+         struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
+ #endif
+@@ -6780,7 +6780,7 @@ ath_rx_poll(struct net_device *dev, int 
+       struct net_device *dev = sc->sc_dev;
+       int rx_limit = budget;
+ #else
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       int rx_limit = min(dev->quota, *budget);
+ #endif
+       struct ath_buf *bf;
+@@ -7305,7 +7305,7 @@ static void ath_grppoll_start(struct iee
+       struct sk_buff *skb = NULL;
+       struct ath_buf *bf, *head = NULL;
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u_int8_t rate;
+       unsigned int ctsrate = 0, ctsduration = 0;
+@@ -7523,7 +7523,7 @@ static void ath_grppoll_start(struct iee
+ static void ath_grppoll_stop(struct ieee80211vap *vap)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ath_txq *txq = &sc->sc_grpplq;
+       struct ath_buf *bf;
+@@ -7735,7 +7735,7 @@ ath_txq_update(struct ath_softc *sc, str
+ static int
+ ath_wme_update(struct ieee80211com *ic)
+ {
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       if (sc->sc_uapsdq)
+               ath_txq_update(sc, sc->sc_uapsdq, WME_AC_VO);
+@@ -7754,7 +7754,7 @@ ath_uapsd_flush(struct ieee80211_node *n
+ {
+       struct ath_node *an = ATH_NODE(ni);
+       struct ath_buf *bf;
+-      struct ath_softc *sc = ni->ni_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ni->ni_ic->ic_dev);
+       struct ath_txq *txq;
+       ATH_NODE_UAPSD_LOCK_IRQ(an);
+@@ -7945,7 +7945,7 @@ ath_tx_start(struct net_device *dev, str
+               struct ath_buf *bf, struct sk_buff *skb, int nextfraglen)
+ {
+ #define       MIN(a,b)        ((a) < (b) ? (a) : (b))
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = ni->ni_ic;
+       struct ieee80211vap *vap = ni->ni_vap;
+       struct ath_hal *ah = sc->sc_ah;
+@@ -8854,7 +8854,7 @@ static void
+ ath_tx_tasklet_q0(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       unsigned long flags;
+ process_tx_again:
+@@ -8885,7 +8885,7 @@ static void
+ ath_tx_tasklet_q0123(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       unsigned long flags;
+ process_tx_again:
+@@ -8930,7 +8930,7 @@ static void
+ ath_tx_tasklet(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       unsigned int i;
+       unsigned long flags;
+@@ -8958,7 +8958,7 @@ process_tx_again:
+ static void
+ ath_tx_timeout(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       if (ath_chan_unavail(sc))
+               return;
+@@ -9366,7 +9366,7 @@ static void
+ ath_calibrate(unsigned long arg)
+ {
+       struct net_device *dev = (struct net_device *)arg;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211com *ic = &sc->sc_ic;
+       /* u_int32_t nchans; */
+@@ -9441,7 +9441,7 @@ static void
+ ath_scan_start(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u_int32_t rfilt;
+@@ -9461,7 +9461,7 @@ static void
+ ath_scan_end(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u_int32_t rfilt;
+@@ -9479,7 +9479,7 @@ static void
+ ath_set_channel(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       (void) ath_chan_set(sc, ic->ic_curchan);
+       ic->ic_channoise = ath_hal_get_channel_noise(sc->sc_ah, &(sc->sc_curchan));
+@@ -9496,7 +9496,7 @@ ath_set_channel(struct ieee80211com *ic)
+ static void
+ ath_set_coverageclass(struct ieee80211com *ic)
+ {
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       sc->sc_coverage = ic->ic_coverageclass * 3;
+       ath_set_timing(sc);
+@@ -9507,7 +9507,7 @@ ath_set_coverageclass(struct ieee80211co
+ static u_int
+ ath_mhz2ieee(struct ieee80211com *ic, u_int freq, u_int flags)
+ {
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       return (ath_hal_mhz2ieee(sc->sc_ah, freq, flags));
+ }
+@@ -9522,7 +9522,7 @@ ath_newstate(struct ieee80211vap *vap, e
+       struct ath_vap *avp = ATH_VAP(vap);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211_node *ni, *wds_ni;
+       unsigned int i;
+@@ -9962,7 +9962,7 @@ ath_setup_comp(struct ieee80211_node *ni
+ {
+ #define       IEEE80211_KEY_XR        (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)
+       struct ieee80211vap *vap = ni->ni_vap;
+-      struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
+       struct ath_node *an = ATH_NODE(ni);
+       ieee80211_keyix_t keyix;
+@@ -10016,7 +10016,7 @@ static void
+ ath_setup_stationkey(struct ieee80211_node *ni)
+ {
+       struct ieee80211vap *vap = ni->ni_vap;
+-      struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
+       ieee80211_keyix_t keyix;
+       keyix = ath_key_alloc(vap, &ni->ni_ucastkey);
+@@ -10177,7 +10177,7 @@ ath_newassoc(struct ieee80211_node *ni, 
+ {
+       struct ieee80211com *ic = ni->ni_ic;
+       struct ieee80211vap *vap = ni->ni_vap;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       sc->sc_rc->ops->newassoc(sc, ATH_NODE(ni), isnew);
+       ath_wprobe_node_join(ni->ni_vap, ni);
+@@ -10208,7 +10208,7 @@ ath_newassoc(struct ieee80211_node *ni, 
+ static int
+ ath_getchannels(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+       HAL_CHANNEL *chans;
+@@ -10485,7 +10485,7 @@ ath_update_txpow(struct ath_softc *sc)
+ static int
+ ath_xr_rate_setup(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211com *ic = &sc->sc_ic;
+       const HAL_RATE_TABLE *rt;
+@@ -10516,7 +10516,7 @@ ath_xr_rate_setup(struct net_device *dev
+ static int
+ ath_rate_setup(struct net_device *dev, u_int mode)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       struct ieee80211com *ic = &sc->sc_ic;
+       const HAL_RATE_TABLE *rt;
+@@ -10763,7 +10763,7 @@ ath_printtxbuf(const struct ath_buf *bf,
+ {
+       const struct ath_tx_status *ts = &bf->bf_dsstatus.ds_txstat;
+       const struct ath_desc *ds = bf->bf_desc;
+-      struct ath_softc *sc = bf->bf_node->ni_ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(bf->bf_node->ni_ic->ic_dev);
+       u_int8_t status = done ? ts->ts_status : 0;
+       DPRINTF(sc, ATH_DEBUG_ANY, 
+@@ -10790,7 +10790,7 @@ ath_printtxbuf(const struct ath_buf *bf,
+ static struct net_device_stats *
+ ath_getstats(struct net_device *dev)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct net_device_stats *stats = &sc->sc_devstats;
+       /* update according to private statistics */
+@@ -10813,7 +10813,7 @@ ath_getstats(struct net_device *dev)
+ static int
+ ath_set_mac_address(struct net_device *dev, void *addr)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+       struct sockaddr *mac = addr;
+@@ -10842,7 +10842,7 @@ ath_set_mac_address(struct net_device *d
+ static int
+ ath_change_mtu(struct net_device *dev, int mtu)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       int error = 0;
+       if (!(ATH_MIN_MTU < mtu && mtu <= ATH_MAX_MTU)) {
+@@ -10929,7 +10929,7 @@ bad:
+ static int
+ ath_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ {
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ieee80211com *ic = &sc->sc_ic;
+       int error;
+@@ -11810,7 +11810,7 @@ static void
+ ath_announce(struct net_device *dev)
+ {
+ #define       HAL_MODE_DUALBAND       (HAL_MODE_11A|HAL_MODE_11B)
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct ath_hal *ah = sc->sc_ah;
+       u_int modes, cc;
+       static const int MLEN = 1024;
+@@ -11997,7 +11997,7 @@ static void
+ txcont_configure_radio(struct ieee80211com *ic)
+ {
+       struct net_device           *dev = ic->ic_dev;
+-      struct ath_softc            *sc = dev->priv;
++      struct ath_softc            *sc = netdev_priv(dev);
+       struct ath_hal              *ah = sc->sc_ah;
+       struct ieee80211_wme_state  *wme = &ic->ic_wme;
+       struct ieee80211vap         *vap = TAILQ_FIRST(&ic->ic_vaps);
+@@ -12271,7 +12271,7 @@ static void
+ txcont_queue_packet(struct ieee80211com *ic, struct ath_txq* txq)
+ {
+       struct net_device *dev             = ic->ic_dev;
+-      struct ath_softc *sc               = dev->priv;
++      struct ath_softc *sc               = netdev_priv(dev);
+       struct ath_hal *ah                 = sc->sc_ah;
+       struct ath_buf *bf                 = NULL;
+       struct sk_buff *skb                = NULL;
+@@ -12404,7 +12404,7 @@ static void
+ txcont_on(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       if (IFF_RUNNING != (ic->ic_dev->flags & IFF_RUNNING)) {
+               EPRINTF(sc, "Cannot enable txcont when"
+@@ -12425,7 +12425,7 @@ static void
+ txcont_off(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       if (TAILQ_FIRST(&ic->ic_vaps)->iv_opmode != IEEE80211_M_WDS)
+               sc->sc_beacons = 1;
+@@ -12439,7 +12439,7 @@ static int
+ ath_get_dfs_testmode(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       return sc->sc_dfs_testmode;
+ }
+@@ -12466,7 +12466,7 @@ static void
+ ath_set_dfs_testmode(struct ieee80211com *ic, int value)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       sc->sc_dfs_testmode = !!value;
+ }
+@@ -12476,7 +12476,7 @@ static int
+ ath_get_txcont(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       return sc->sc_txcont;
+ }
+@@ -12494,7 +12494,7 @@ static void
+ ath_set_txcont_power(struct ieee80211com *ic, unsigned int txpower)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       int new_txcont_power = txpower > IEEE80211_TXPOWER_MAX ? 
+               IEEE80211_TXPOWER_MAX : txpower;
+       if (sc->sc_txcont_power != new_txcont_power) {
+@@ -12512,7 +12512,7 @@ static int
+ ath_get_txcont_power(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       /* VERY conservative default */
+       return sc->sc_txcont_power ? sc->sc_txcont_power : 0;
+ }
+@@ -12522,7 +12522,7 @@ ath_get_txcont_power(struct ieee80211com
+ ath_set_txcont_rate(struct ieee80211com *ic, unsigned int new_rate)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       if (sc->sc_txcont_rate != new_rate) {
+               /*  NOTE: This value is sanity checked and dropped down to 
+                *  closest rate in txcont_on. */
+@@ -12539,7 +12539,7 @@ ath_set_txcont_rate(struct ieee80211com 
+ ath_get_txcont_rate(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       return sc->sc_txcont_rate ? sc->sc_txcont_rate : 0;
+ }
+@@ -12549,7 +12549,7 @@ static void
+ ath_set_dfs_cac_time(struct ieee80211com *ic, unsigned int time_s)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       sc->sc_dfs_cac_period = time_s;
+ }
+@@ -12559,7 +12559,7 @@ static unsigned int
+ ath_get_dfs_cac_time(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       return sc->sc_dfs_cac_period;
+ }
+@@ -12579,7 +12579,7 @@ static void
+ ath_set_dfs_excl_period(struct ieee80211com *ic, unsigned int time_s)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       sc->sc_dfs_excl_period = time_s;
+ }
+@@ -12588,7 +12588,7 @@ static unsigned int
+ ath_get_dfs_excl_period(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       return sc->sc_dfs_excl_period;
+ }
+@@ -12600,7 +12600,7 @@ static unsigned int
+ ath_test_radar(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc   = dev->priv;
++      struct ath_softc *sc   = netdev_priv(dev);
+       if ((ic->ic_flags & IEEE80211_F_DOTH) && (sc->sc_curchan.privFlags & CHANNEL_DFS))
+               ath_radar_detected(sc, "ath_test_radar from user space");
+       else
+@@ -12616,7 +12616,7 @@ static unsigned int
+ ath_dump_hal_map(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc   = dev->priv;
++      struct ath_softc *sc   = netdev_priv(dev);
+       ath_hal_dump_map(sc->sc_ah);
+       return 0;
+ }
+@@ -12724,7 +12724,7 @@ ath_rcv_dev_event(struct notifier_block 
+       void *ptr)
+ {
+       struct net_device *dev = (struct net_device *)ptr;
+-      struct ath_softc *sc = (struct ath_softc *)dev->priv;
++      struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
+       if (!dev || !sc || dev->open != &ath_init)
+               return 0;
+@@ -13459,7 +13459,7 @@ static unsigned int
+ ath_read_register(struct ieee80211com *ic, unsigned int address, 
+               unsigned int* value)
+ {
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       if (address >= MAX_REGISTER_ADDRESS) {
+               IPRINTF(sc, "Illegal Atheros register access "
+                               "attempted: 0x%04x >= 0x%04x\n",
+@@ -13489,7 +13489,7 @@ static unsigned int
+ ath_write_register(struct ieee80211com *ic, unsigned int address, 
+               unsigned int value)
+ {
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       if (address >= MAX_REGISTER_ADDRESS) {
+               IPRINTF(sc, "Illegal Atheros register access "
+                               "attempted: 0x%04x >= 0x%04x\n",
+@@ -13517,7 +13517,7 @@ static void
+ ath_registers_dump(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       ath_ar5212_registers_dump(sc);
+ }
+ #endif /* #ifdef ATH_REVERSE_ENGINEERING */
+@@ -13529,7 +13529,7 @@ static void
+ ath_registers_mark(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       ath_ar5212_registers_mark(sc);
+ }
+ #endif /* #ifdef ATH_REVERSE_ENGINEERING */
+@@ -13541,7 +13541,7 @@ static void
+ ath_registers_dump_delta(struct ieee80211com *ic)
+ {
+       struct net_device *dev = ic->ic_dev;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       ath_ar5212_registers_dump_delta(sc);
+ }
+ #endif /* #ifdef ATH_REVERSE_ENGINEERING */
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -228,7 +228,7 @@ ath_pci_probe(struct pci_dev *pdev, cons
+               printk(KERN_ERR "%s: no memory for device state\n", dev_info);
+               goto bad2;
+       }
+-      sc = dev->priv;
++      sc = netdev_priv(dev);
+       sc->aps_sc.sc_dev = dev;
+       sc->aps_sc.sc_iobase = mem;
+@@ -311,7 +311,7 @@ static void
+ ath_pci_remove(struct pci_dev *pdev)
+ {
+       struct net_device *dev = pci_get_drvdata(pdev);
+-      struct ath_pci_softc *sc = dev->priv;
++      struct ath_pci_softc *sc = netdev_priv(dev);
+       ath_detach(dev);
+       if (dev->irq)
+@@ -329,7 +329,7 @@ ath_pci_suspend(struct pci_dev *pdev, pm
+       struct net_device *dev = pci_get_drvdata(pdev);
+       ath_suspend(dev);
+-      PCI_SAVE_STATE(pdev, ((struct ath_pci_softc *)dev->priv)->aps_pmstate);
++      PCI_SAVE_STATE(pdev, ((struct ath_pci_softc *)netdev_priv(dev))->aps_pmstate);
+       pci_disable_device(pdev);
+       return pci_set_power_state(pdev, PCI_D3hot);
+ }
+@@ -346,7 +346,7 @@ ath_pci_resume(struct pci_dev *pdev)
+               return err;
+       /* XXX - Should this return nonzero on fail? */
+-      PCI_RESTORE_STATE(pdev, ((struct ath_pci_softc *)dev->priv)->aps_pmstate);
++      PCI_RESTORE_STATE(pdev, ((struct ath_pci_softc *)netdev_priv(dev))->aps_pmstate);
+       err = pci_enable_device(pdev);
+       if (err)
+--- a/ath/if_ath_radar.c
++++ b/ath/if_ath_radar.c
+@@ -1533,7 +1533,7 @@ static void ath_rp_clear(struct ath_soft
+ static void ath_rp_tasklet(TQUEUE_ARG data)
+ {
+       struct net_device *dev = (struct net_device *) data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       if (sc->sc_rp_analyse != NULL)
+               sc->sc_rp_analyse(sc);
+--- a/ath_rate/amrr/amrr.c
++++ b/ath_rate/amrr/amrr.c
+@@ -298,7 +298,7 @@ ath_rate_ctl_start(struct ath_softc *sc,
+ static void
+ ath_rate_cb(void *arg, struct ieee80211_node *ni)
+ {
+-      ath_rate_update(ni->ni_ic->ic_dev->priv, ni, (long) arg);
++      ath_rate_update(netdev_priv(ni->ni_ic->ic_dev), ni, (long) arg);
+ }
+ /*
+@@ -308,7 +308,7 @@ static void
+ ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct amrr_softc *asc = (struct amrr_softc *) sc->sc_rc;
+       struct ieee80211_node *ni;
+@@ -420,7 +420,7 @@ static void
+ ath_ratectl(unsigned long data)
+ {
+       struct net_device *dev = (struct net_device *)data;
+-      struct ath_softc *sc = dev->priv;
++      struct ath_softc *sc = netdev_priv(dev);
+       struct amrr_softc *asc = (struct amrr_softc *)sc->sc_rc;
+       struct ieee80211com *ic = &sc->sc_ic;
+       int interval;
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -622,7 +622,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+ static void
+ ath_rate_cb(void *arg, struct ieee80211_node *ni)
+ {
+-              ath_rate_ctl_reset(ni->ni_ic->ic_dev->priv, ni);
++              ath_rate_ctl_reset(netdev_priv(ni->ni_ic->ic_dev), ni);
+ }
+ /* Reset the rate control state for each 802.11 state transition. */
+@@ -636,7 +636,7 @@ ath_rate_newstate(struct ieee80211vap *v
+                               /* Sync rates for associated stations and neighbors. */
+                               ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, NULL);
+                       }
+-                      ath_rate_newassoc(ic->ic_dev->priv, ATH_NODE(vap->iv_bss), 1);
++                      ath_rate_newassoc(netdev_priv(ic->ic_dev), ATH_NODE(vap->iv_bss), 1);
+               }
+ }
+@@ -822,7 +822,7 @@ ath_proc_read_nodes(struct ieee80211vap 
+               unsigned int x = 0;
+               unsigned int this_tp, this_prob, this_eprob;
+ #ifdef AR_DEBUG
+-                      struct ath_softc *sc = vap->iv_ic->ic_dev->priv;;
++                      struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
+ #endif
+               IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
+--- a/ath_rate/onoe/onoe.c
++++ b/ath_rate/onoe/onoe.c
+@@ -281,7 +281,7 @@ ath_rate_ctl_start(struct ath_softc *sc,
+ static void
+ ath_rate_cb(void *arg, struct ieee80211_node *ni)
+ {
+-      ath_rate_update(ni->ni_ic->ic_dev->priv, ni, (long) arg);
++      ath_rate_update(netdev_priv(ni->ni_ic->ic_dev), ni, (long) arg);
+ }
+ /*
+@@ -291,7 +291,7 @@ static void
+ ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
+ {
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct ath_softc *sc = ic->ic_dev->priv;
++      struct ath_softc *sc = netdev_priv(ic->ic_dev);
+       struct ieee80211_node *ni;
+       if (state == IEEE80211_S_INIT)
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -803,7 +803,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
+ static void
+ ath_rate_cb(void *arg, struct ieee80211_node *ni)
+ {
+-      ath_rate_ctl_reset(ni->ni_ic->ic_dev->priv, ni);
++      ath_rate_ctl_reset(netdev_priv(ni->ni_ic->ic_dev), ni);
+ }
+ /*
+@@ -821,7 +821,7 @@ ath_rate_newstate(struct ieee80211vap *v
+                        */
+                       ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, NULL);
+               }
+-              ath_rate_newassoc(ic->ic_dev->priv, ATH_NODE(vap->iv_bss), 1);
++              ath_rate_newassoc(netdev_priv(ic->ic_dev), ATH_NODE(vap->iv_bss), 1);
+       }
+ }
+--- a/include/compat.h
++++ b/include/compat.h
+@@ -162,6 +162,10 @@ static inline int timeval_compare(struct
+ #define IRQF_SHARED SA_SHIRQ
+ #endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)
++#define netdev_priv(_netdev) ((_netdev)->priv)
++#endif
++
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+ #define skb_end_pointer(_skb) ((_skb)->end)
+ #define skb_tail_pointer(_skb) ((_skb)->tail)
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -458,7 +458,7 @@ ieee80211_vap_setup(struct ieee80211com 
+ #define       IEEE80211_C_OPMODE \
+       (IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | IEEE80211_C_AHDEMO | \
+        IEEE80211_C_MONITOR)
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct net_device *parent = ic->ic_dev;
+       int err;
+@@ -1355,7 +1355,7 @@ media_status(enum ieee80211_opmode opmod
+ static void
+ ieee80211com_media_status(struct net_device *dev, struct ifmediareq *imr)
+ {
+-      struct ieee80211com *ic = dev->priv;    /* XXX */
++      struct ieee80211com *ic = netdev_priv(dev);     /* XXX */
+       imr->ifm_status = IFM_AVALID;
+       if (!TAILQ_EMPTY(&ic->ic_vaps))
+@@ -1407,7 +1407,7 @@ media2mode(const struct ifmedia_entry *i
+ static int
+ ieee80211com_media_change(struct net_device *dev)
+ {
+-      struct ieee80211com *ic = dev->priv;    /* XXX */
++      struct ieee80211com *ic = netdev_priv(dev);     /* XXX */
+       struct ieee80211vap *vap;
+       struct ifmedia_entry *ime = ic->ic_media.ifm_cur;
+       enum ieee80211_phymode newphymode;
+@@ -1511,7 +1511,7 @@ checkrate(struct ieee80211com *ic, enum 
+ int
+ ieee80211_media_change(struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ifmedia_entry *ime = vap->iv_media.ifm_cur;
+       enum ieee80211_phymode newmode;
+@@ -1545,7 +1545,7 @@ EXPORT_SYMBOL(ieee80211_media_change);
+ void
+ ieee80211_media_status(struct net_device *dev, struct ifmediareq *imr)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       enum ieee80211_phymode mode;
+       struct ieee80211_rateset *rs;
+@@ -1751,7 +1751,7 @@ EXPORT_SYMBOL(ieee80211_media2rate);
+ static struct net_device_stats *
+ ieee80211_getstats(struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct net_device_stats *stats = &vap->iv_devstats;
+       /* XXX: Total guess as to what to count where */
+@@ -1790,7 +1790,7 @@ ieee80211_change_mtu(struct net_device *
+ static void
+ ieee80211_set_multicast_list(struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *parent = ic->ic_dev;
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -183,7 +183,7 @@ EXPORT_SYMBOL(ieee80211_getmgtframe);
+ static void
+ ieee80211_vlan_register(struct net_device *dev, struct vlan_group *grp)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       vap->iv_vlgrp = grp;
+ }
+@@ -194,7 +194,7 @@ ieee80211_vlan_register(struct net_devic
+ static void
+ ieee80211_vlan_add_vid(struct net_device *dev, unsigned short vid)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (vap->iv_vlgrp != NULL)
+               vap->iv_bss->ni_vlan = vid;
+@@ -206,7 +206,7 @@ ieee80211_vlan_add_vid(struct net_device
+ static void
+ ieee80211_vlan_kill_vid(struct net_device *dev, unsigned short vid)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (vap->iv_vlgrp != NULL)
+               vlan_group_set_device(vap->iv_vlgrp, vid, NULL);
+@@ -989,8 +989,8 @@ ieee80211_rcv_dev_event(struct notifier_
+       switch (event) {
+       case NETDEV_CHANGENAME:
+-              ieee80211_virtfs_vdetach(dev->priv);
+-              ieee80211_virtfs_latevattach(dev->priv);
++              ieee80211_virtfs_vdetach(netdev_priv(dev));
++              ieee80211_virtfs_latevattach(netdev_priv(dev));
+               return NOTIFY_DONE;
+       default:
+               break;
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -201,7 +201,7 @@ ieee80211_classify(struct ieee80211_node
+ int
+ ieee80211_hardstart(struct sk_buff *skb, struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *parent = ic->ic_dev;
+       struct ieee80211_node *ni = NULL;
+@@ -317,7 +317,7 @@ bad:
+  */
+ void ieee80211_parent_queue_xmit(struct sk_buff *skb) {
+-      struct ieee80211vap *vap = skb->dev->priv;
++      struct ieee80211vap *vap = netdev_priv(skb->dev);
+       vap->iv_devstats.tx_packets++;
+       vap->iv_devstats.tx_bytes += skb->len;
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -970,7 +970,7 @@ ieee80211_init(struct net_device *dev, i
+ {
+ #define       IS_RUNNING(_dev) \
+       ((_dev->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *parent = ic->ic_dev;
+@@ -1087,7 +1087,7 @@ ieee80211_init(struct net_device *dev, i
+ int
+ ieee80211_open(struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       return ieee80211_init(dev, 0);
+ }
+@@ -1131,7 +1131,7 @@ EXPORT_SYMBOL(ieee80211_start_running);
+ int
+ ieee80211_stop(struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct net_device *parent = ic->ic_dev;
+       struct ieee80211_node *tni, *ni;
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -87,7 +87,7 @@ pre_announced_chanswitch(struct net_devi
+ static int
+ preempt_scan(struct net_device *dev, int max_grace, int max_wait)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       int total_delay = 0;
+       int canceled = 0, ready = 0;
+@@ -122,7 +122,7 @@ preempt_scan(struct net_device *dev, int
+ static struct iw_statistics *
+ ieee80211_iw_getstats(struct net_device *dev)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct iw_statistics *is = &vap->iv_iwstats;
+       struct ieee80211com *ic = vap->iv_ic;
+@@ -146,7 +146,7 @@ static int
+ ieee80211_ioctl_giwname(struct net_device *dev, struct iw_request_info *info,
+       char *name, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211_channel *c = vap->iv_ic->ic_curchan;
+       if (IEEE80211_IS_CHAN_108G(c))
+@@ -198,7 +198,7 @@ static int
+ ieee80211_ioctl_siwencode(struct net_device *dev,
+       struct iw_request_info *info, struct iw_point *erq, char *keybuf)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       int error;
+       int wepchange = 0;
+       ieee80211_keyix_t kix;
+@@ -306,7 +306,7 @@ static int
+ ieee80211_ioctl_giwencode(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *erq, char *key)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211_key *k;
+       int error;
+       ieee80211_keyix_t kix;
+@@ -351,7 +351,7 @@ ieee80211_ioctl_siwrate(struct net_devic
+               IFM_IEEE80211_11A | IFM_IEEE80211_TURBO,
+               IFM_IEEE80211_11G | IFM_IEEE80211_TURBO,
+       };
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ifreq ifr;
+       int rate, retv;
+@@ -386,7 +386,7 @@ static int
+ ieee80211_ioctl_giwrate(struct net_device *dev,       struct iw_request_info *info,
+       struct iw_param *rrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ifmediareq imr;
+       int rate;
+@@ -424,7 +424,7 @@ static int
+ ieee80211_ioctl_siwrts(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rts, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       u16 val;
+@@ -447,7 +447,7 @@ static int
+ ieee80211_ioctl_giwrts(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rts, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       rts->value = vap->iv_rtsthreshold;
+       rts->disabled = (rts->value == IEEE80211_RTS_MAX);
+@@ -460,7 +460,7 @@ static int
+ ieee80211_ioctl_siwfrag(struct net_device *dev,       struct iw_request_info *info,
+       struct iw_param *rts, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       u16 val;
+@@ -483,7 +483,7 @@ static int
+ ieee80211_ioctl_giwfrag(struct net_device *dev,       struct iw_request_info *info,
+       struct iw_param *rts, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       rts->value = vap->iv_fragthreshold;
+       rts->disabled = (rts->value == 2346);
+@@ -496,7 +496,7 @@ static int
+ ieee80211_ioctl_siwap(struct net_device *dev, struct iw_request_info *info,
+       struct sockaddr *ap_addr, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       /* NB: should not be set when in AP mode */
+       if (vap->iv_opmode == IEEE80211_M_HOSTAP)
+@@ -532,7 +532,7 @@ static int
+ ieee80211_ioctl_giwap(struct net_device *dev, struct iw_request_info *info,
+       struct sockaddr *ap_addr, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (vap->iv_flags & IEEE80211_F_DESBSSID)
+               IEEE80211_ADDR_COPY(&ap_addr->sa_data, vap->iv_des_bssid);
+@@ -553,7 +553,7 @@ static int
+ ieee80211_ioctl_siwnickn(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *nickname)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (data->length > IEEE80211_NWID_LEN)
+               return -E2BIG;
+@@ -569,7 +569,7 @@ static int
+ ieee80211_ioctl_giwnickn(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *nickname)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (data->length > vap->iv_nicknamelen + 1)
+               data->length = vap->iv_nicknamelen + 1;
+@@ -678,7 +678,7 @@ static int
+ ieee80211_ioctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
+       struct iw_freq *freq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_channel *c, *c2;
+       int i;
+@@ -767,7 +767,7 @@ static int
+ ieee80211_ioctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
+       struct iw_freq *freq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       if (vap->iv_state == IEEE80211_S_RUN &&
+@@ -808,7 +808,7 @@ static int
+ ieee80211_ioctl_siwessid(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *ssid)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (vap->iv_opmode == IEEE80211_M_WDS)
+               return -EOPNOTSUPP;
+@@ -853,7 +853,7 @@ static int
+ ieee80211_ioctl_giwessid(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *essid)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (vap->iv_opmode == IEEE80211_M_WDS)
+               return -EOPNOTSUPP;
+@@ -899,7 +899,7 @@ static int
+ ieee80211_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni = vap->iv_bss;
+       struct iw_range *range = (struct iw_range *) extra;
+@@ -1047,7 +1047,7 @@ ieee80211_ioctl_setspy(struct net_device
+       struct iw_point *data, char *extra)
+ {
+       /* save the list of node addresses */
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct sockaddr address[IW_MAX_SPY];
+       unsigned int number = data->length;
+       int i;
+@@ -1085,7 +1085,7 @@ ieee80211_ioctl_getspy(struct net_device
+        * locate nodes by mac (ieee80211_find_node()),
+        * copy out rssi, set updated flag appropriately
+        */
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211_node_table *nt = &vap->iv_ic->ic_sta;
+       struct ieee80211_node *ni;
+       struct ieee80211com *ic = vap->iv_ic;
+@@ -1133,7 +1133,7 @@ static int
+ ieee80211_ioctl_setthrspy(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct iw_thrspy threshold;
+       if (data->length != 1)
+@@ -1170,7 +1170,7 @@ static int
+ ieee80211_ioctl_getthrspy(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iw_thrspy *threshold;
+@@ -1191,7 +1191,7 @@ static int
+ ieee80211_ioctl_siwmode(struct net_device *dev, struct iw_request_info *info,
+       __u32 *mode, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ifmediareq imr;
+       int valid = 0;
+@@ -1216,7 +1216,7 @@ static int
+ ieee80211_ioctl_giwmode(struct net_device *dev,       struct iw_request_info *info,
+       __u32 *mode, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ifmediareq imr;
+       memset(&imr, 0, sizeof(imr));
+@@ -1239,7 +1239,7 @@ static int
+ ieee80211_ioctl_siwpower(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *wrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       /* XXX: These values, flags, and caps do not seem to be used elsewhere 
+@@ -1278,7 +1278,7 @@ static int
+ ieee80211_ioctl_giwpower(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       rrq->disabled = (ic->ic_flags & IEEE80211_F_PMGTON) == 0;
+@@ -1302,7 +1302,7 @@ static int
+ ieee80211_ioctl_siwretry(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       if (rrq->disabled) {
+@@ -1334,7 +1334,7 @@ static int
+ ieee80211_ioctl_giwretry(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       rrq->disabled = (vap->iv_flags & IEEE80211_F_SWRETRY) == 0;
+       if (!rrq->disabled) {
+@@ -1365,7 +1365,7 @@ static int
+ ieee80211_ioctl_siwtxpow(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       int fixed, disabled;
+@@ -1402,7 +1402,7 @@ ieee80211_get_txcont(struct net_device *
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       params[0] = ic->ic_get_txcont(ic);
+       return 0;
+@@ -1413,7 +1413,7 @@ ieee80211_get_dfs_cac_time(struct net_de
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       params[0] = ic->ic_get_dfs_cac_time(ic);
+       return 0;
+@@ -1424,7 +1424,7 @@ ieee80211_get_dfs_excl_period(struct net
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       params[0] = ic->ic_get_dfs_excl_period(ic);
+       return 0;
+@@ -1434,7 +1434,7 @@ ieee80211_set_dfs_cac_time(struct net_de
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       ic->ic_set_dfs_cac_time(ic, params[1]);
+       return 0;
+@@ -1444,7 +1444,7 @@ ieee80211_set_dfs_excl_period  (struct n
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       ic->ic_set_dfs_excl_period(ic, params[1]);
+       return 0;
+@@ -1455,7 +1455,7 @@ ieee80211_get_dfs_testmode(struct net_de
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       params[0] = ic->ic_get_dfs_testmode(ic);
+       return 0;
+@@ -1466,7 +1466,7 @@ ieee80211_get_txcont_rate(struct net_dev
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       params[0] = ic->ic_get_txcont_rate(ic);
+       return 0;
+@@ -1477,7 +1477,7 @@ ieee80211_set_txcont(struct net_device *
+               void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       ic->ic_set_txcont(ic, params[1]);
+       return 0;
+@@ -1488,7 +1488,7 @@ ieee80211_set_dfs_testmode(struct net_de
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       ic->ic_set_dfs_testmode(ic, params[1]);
+       return 0;
+@@ -1499,7 +1499,7 @@ ieee80211_set_txcont_rate(struct net_dev
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       ic->ic_set_txcont_rate(ic, params[1]);
+       return 0;
+@@ -1510,7 +1510,7 @@ ieee80211_set_txcont_power(struct net_de
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       ic->ic_set_txcont_power(ic, params[1]);
+       return 0;
+@@ -1521,7 +1521,7 @@ ieee80211_get_txcont_power(struct net_de
+               struct iw_request_info *info, void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       params[0] = ic->ic_get_txcont_power(ic);
+       return 0;
+@@ -1533,7 +1533,7 @@ ieee80211_ioctl_hal_map(struct net_devic
+        void *w, char *extra)
+ {
+        int *params = (int*) extra;
+-       struct ieee80211vap *vap = dev->priv;
++       struct ieee80211vap *vap = netdev_priv(dev);
+        struct ieee80211com *ic = vap->iv_ic;
+        params[0] = ic->ic_dump_hal_map(ic);
+        return 0;
+@@ -1545,7 +1545,7 @@ ieee80211_ioctl_radar(struct net_device 
+       void *w, char *extra)
+ {
+       int *params = (int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       if (!(ic->ic_flags & IEEE80211_F_DOTH))
+               return 0;
+@@ -1557,7 +1557,7 @@ static int
+ ieee80211_ioctl_giwtxpow(struct net_device *dev, struct iw_request_info *info,
+       struct iw_param *rrq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       unsigned int power = ic->ic_txpowlimit;
+       struct ieee80211_channel *c;
+@@ -1581,7 +1581,7 @@ static int
+ ieee80211_dump_registers(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
+ {
+       unsigned int *params = (unsigned int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       switch (params[1]) {
+       case 2:
+@@ -1604,7 +1604,7 @@ static int
+ ieee80211_ioctl_writereg(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
+ {
+       unsigned int *params = (unsigned int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       return ic->ic_write_register(ic, params[0], params[1]);
+ }
+@@ -1615,7 +1615,7 @@ static int
+ ieee80211_ioctl_readreg(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
+ {
+       unsigned int *params = (unsigned int*) extra;
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       return ic->ic_read_register(ic, params[0], &params[0]);
+ }
+@@ -1651,7 +1651,7 @@ static int
+ ieee80211_ioctl_iwaplist(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct waplistreq req;          /* XXX off stack */
+@@ -1673,7 +1673,7 @@ static int
+ ieee80211_ioctl_siwscan(struct net_device *dev,       struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       /*
+        * XXX don't permit a scan to be started unless we
+@@ -1997,7 +1997,7 @@ static int
+ ieee80211_ioctl_giwscan(struct net_device *dev,       struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iwscanreq req;
+       int res = 0;
+@@ -2098,7 +2098,7 @@ static int
+ ieee80211_ioctl_setmode(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *wri, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ifreq ifr;
+       char s[6];              /* big enough for ``11adt'' */
+@@ -2222,10 +2222,10 @@ ieee80211_setathcap(struct ieee80211vap 
+ static int
+ ieee80211_set_turbo(struct net_device *dev, int flag)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ifreq ifr;
+-      struct ieee80211vap *tmpvap = dev->priv;
++      struct ieee80211vap *tmpvap = netdev_priv(dev);
+       int nvap = 0;
+       TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next)
+@@ -2246,7 +2246,7 @@ static int
+ ieee80211_ioctl_setparam(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_rsnparms *rsn = &vap->iv_bss->ni_rsn;
+       unsigned int *i = (unsigned int *) extra;
+@@ -2926,7 +2926,7 @@ static int
+ ieee80211_ioctl_getmode(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *wri, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ifmediareq imr;
+@@ -2964,7 +2964,7 @@ static int
+ ieee80211_ioctl_getparam(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_rsnparms *rsn = &vap->iv_bss->ni_rsn;
+       unsigned int *param = (unsigned int *) extra;
+@@ -3309,7 +3309,7 @@ static int
+ ieee80211_ioctl_setoptie(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *wri, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       void *ie;
+       /*
+@@ -3343,7 +3343,7 @@ static int
+ ieee80211_ioctl_getoptie(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *wri, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (vap->iv_opt_ie == NULL) {
+               wri->length = 0;
+@@ -3407,7 +3407,7 @@ ieee80211_ioctl_setappiebuf(struct net_d
+       struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211req_getset_appiebuf *iebuf =
+               (struct ieee80211req_getset_appiebuf *)extra;
+       enum ieee80211_opmode chk_opmode;
+@@ -3449,7 +3449,7 @@ static int
+ ieee80211_ioctl_getappiebuf(struct net_device *dev, struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211req_getset_appiebuf *iebuf =
+               (struct ieee80211req_getset_appiebuf *)extra;
+       int max_iebuf_len;
+@@ -3490,7 +3490,7 @@ static int
+ ieee80211_ioctl_setfilter(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211req_set_filter *app_filter = (struct ieee80211req_set_filter *)extra;
+       if ((extra == NULL) || (app_filter->app_filterype & ~IEEE80211_FILTER_TYPE_ALL))
+@@ -3505,7 +3505,7 @@ static int
+ ieee80211_ioctl_setkey(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211req_key *ik = (struct ieee80211req_key *)extra;
+       struct ieee80211_node *ni;
+@@ -3588,7 +3588,7 @@ ieee80211_ioctl_setkey(struct net_device
+ static int
+ ieee80211_ioctl_getkey(struct net_device *dev, struct iwreq *iwr)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni;
+       struct ieee80211req_key ik;
+@@ -3649,7 +3649,7 @@ static int
+ ieee80211_ioctl_delkey(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211req_del_key *dk = (struct ieee80211req_del_key *)extra;
+       ieee80211_keyix_t kix;
+@@ -3723,7 +3723,7 @@ static int
+ ieee80211_ioctl_setmlme(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211req_mlme *mlme = (struct ieee80211req_mlme *)extra;
+       struct ieee80211_node *ni;
+@@ -3826,7 +3826,7 @@ static int
+ ieee80211_ioctl_wdsaddmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct sockaddr *sa = (struct sockaddr *)extra;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211vap *avp;
+@@ -3855,7 +3855,7 @@ static int
+ ieee80211_ioctl_wdssetmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct sockaddr *sa = (struct sockaddr *)extra;
+       if (vap->iv_opmode != IEEE80211_M_WDS)
+@@ -3922,7 +3922,7 @@ ieee80211_ioctl_setscanlist(struct net_d
+       struct iw_request_info *info,
+       struct iw_point *data, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       char *s, *next;
+       int val = 1;
+@@ -3997,7 +3997,7 @@ static int
+ ieee80211_ioctl_addmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct sockaddr *sa = (struct sockaddr *)extra;
+       const struct ieee80211_aclator *acl = vap->iv_acl;
+@@ -4015,7 +4015,7 @@ static int
+ ieee80211_ioctl_delmac(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct sockaddr *sa = (struct sockaddr *)extra;
+       const struct ieee80211_aclator *acl = vap->iv_acl;
+@@ -4033,7 +4033,7 @@ static int
+ ieee80211_ioctl_setchanlist(struct net_device *dev,
+       struct iw_request_info *info, void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211req_chanlist *list =
+               (struct ieee80211req_chanlist *)extra;
+@@ -4084,7 +4084,7 @@ static int
+ ieee80211_ioctl_getchanlist(struct net_device *dev,
+       struct iw_request_info *info, void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       memcpy(extra, ic->ic_chan_active, sizeof(ic->ic_chan_active));
+@@ -4105,7 +4105,7 @@ static int
+ ieee80211_ioctl_getchaninfo(struct net_device *dev,
+                           struct iw_request_info *info, void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211req_chaninfo *chans =
+           (struct ieee80211req_chaninfo *)extra;
+@@ -4152,7 +4152,7 @@ static int
+ ieee80211_ioctl_setwmmparams(struct net_device *dev,
+       struct iw_request_info *info, void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       unsigned int *param = (unsigned int *) extra;
+       unsigned int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;
+       unsigned int bss = param[2];
+@@ -4240,7 +4240,7 @@ static int
+ ieee80211_ioctl_getwmmparams(struct net_device *dev,
+       struct iw_request_info *info, void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       unsigned int *param = (unsigned int *) extra;
+       unsigned int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;
+       struct ieee80211_wme_state *wme = &vap->iv_ic->ic_wme;
+@@ -4275,7 +4275,7 @@ ieee80211_ioctl_getwmmparams(struct net_
+ static int
+ ieee80211_ioctl_getwpaie(struct net_device *dev, struct iwreq *iwr)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni;
+       struct ieee80211req_wpaie wpaie;
+@@ -4309,7 +4309,7 @@ ieee80211_ioctl_getwpaie(struct net_devi
+ static int
+ ieee80211_ioctl_getstastats(struct net_device *dev, struct iwreq *iwr)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni;
+       u_int8_t macaddr[IEEE80211_ADDR_LEN];
+@@ -4428,7 +4428,7 @@ get_scan_result(void *arg, const struct 
+ static int
+ ieee80211_ioctl_getscanresults(struct net_device *dev, struct iwreq *iwr)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct scanreq req;
+       int error;
+@@ -4591,7 +4591,7 @@ get_sta_info(void *arg, struct ieee80211
+ static int
+ ieee80211_ioctl_getstainfo(struct net_device *dev, struct iwreq *iwr)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct stainforeq req;
+       int error;
+@@ -4625,7 +4625,7 @@ ieee80211_ioctl_getstainfo(struct net_de
+ static void
+ pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt) {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211vap *avp;
+@@ -4643,7 +4643,7 @@ static int
+ ieee80211_ioctl_chanswitch(struct net_device *dev, struct iw_request_info *info,
+       void *w, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       unsigned int *param = (unsigned int *) extra;
+@@ -4688,7 +4688,7 @@ static int
+ ieee80211_ioctl_giwgenie(struct net_device *dev,
+       struct iw_request_info *info, struct iw_point *out, char *buf)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       if (out->length < vap->iv_opt_ie_len)
+               return -E2BIG;
+@@ -5221,7 +5221,7 @@ static int
+ ieee80211_ioctl_giwencodeext(struct net_device *dev,
+       struct iw_request_info *info, struct iw_point *erq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct iw_encode_ext *ext;
+       struct ieee80211_key *wk;
+       ieee80211_keyix_t kix;
+@@ -5281,7 +5281,7 @@ static int
+ ieee80211_ioctl_siwencodeext(struct net_device *dev,
+       struct iw_request_info *info, struct iw_point *erq, char *extra)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
+       struct ieee80211req_key kr;
+       ieee80211_keyix_t kix;
+@@ -5957,7 +5957,7 @@ static struct iw_handler_def ieee80211_i
+ static int
+ ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ {
+-      struct ieee80211vap *vap = dev->priv;
++      struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ieee80211_node *ni;
diff --git a/net/madwifi/patches/431-compile_fixes.patch b/net/madwifi/patches/431-compile_fixes.patch
new file mode 100644 (file)
index 0000000..b11d406
--- /dev/null
@@ -0,0 +1,35 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2388,7 +2388,9 @@ ath_intr(int irq, void *dev_id, struct p
+               if (status & (HAL_INT_RX | HAL_INT_RXPHY)) {
+                       ath_uapsd_processtriggers(sc, hw_tsf);
+                       sc->sc_isr &= ~HAL_INT_RX;
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
++                      if (napi_schedule_prep(&sc->sc_napi))
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+                       if (netif_rx_schedule_prep(dev, &sc->sc_napi))
+ #else
+                       if (netif_rx_schedule_prep(dev))
+@@ -2396,7 +2398,9 @@ ath_intr(int irq, void *dev_id, struct p
+                       {
+                               sc->sc_imask &= ~HAL_INT_RX;
+                               ath_hal_intrset(ah, sc->sc_imask);
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
++                              __napi_schedule(&sc->sc_napi);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+                               __netif_rx_schedule(dev, &sc->sc_napi);
+ #else
+                               __netif_rx_schedule(dev);
+@@ -7135,7 +7139,9 @@ rx_next:
+               local_irq_restore(flags);
+       }
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
++      napi_complete(napi);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+       netif_rx_complete(dev, napi);
+ #else
+       netif_rx_complete(dev);
diff --git a/net/madwifi/patches/432-netdev_ops.patch b/net/madwifi/patches/432-netdev_ops.patch
new file mode 100644 (file)
index 0000000..2e542bf
--- /dev/null
@@ -0,0 +1,184 @@
+Convert to net_device_ops for Linux 2.6.29+
+http://madwifi-project.org/changeset/4005
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -566,6 +566,20 @@ static inline int rate_factor(int mode)
+ /* Initialize ath_softc structure */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
++static const struct net_device_ops ath_netdev_ops = {
++      .ndo_open               = ath_init,
++      .ndo_stop               = ath_stop,
++      .ndo_start_xmit         = ath_hardstart,
++      .ndo_tx_timeout         = ath_tx_timeout,
++      .ndo_set_multicast_list = ath_mode_init,
++      .ndo_do_ioctl           = ath_ioctl,
++      .ndo_get_stats          = ath_getstats,
++      .ndo_set_mac_address    = ath_set_mac_address,
++      .ndo_change_mtu         = ath_change_mtu,
++};
++#endif
++
+ int
+ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
+ {
+@@ -865,16 +879,20 @@ ath_attach(u_int16_t devid, struct net_d
+       }
+       /* NB: ether_setup is done by bus-specific code */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+       dev->open = ath_init;
+       dev->stop = ath_stop;
+       dev->hard_start_xmit = ath_hardstart;
+       dev->tx_timeout = ath_tx_timeout;
+-      dev->watchdog_timeo = 5 * HZ;
+       dev->set_multicast_list = ath_mode_init;
+       dev->do_ioctl = ath_ioctl;
+       dev->get_stats = ath_getstats;
+       dev->set_mac_address = ath_set_mac_address;
+       dev->change_mtu = ath_change_mtu;
++#else
++      dev->netdev_ops = &ath_netdev_ops;
++#endif
++      dev->watchdog_timeo = 5 * HZ;
+       dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+       netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
+@@ -1257,7 +1275,6 @@ ath_detach(struct net_device *dev)
+       ath_dynamic_sysctl_unregister(sc);
+       ATH_LOCK_DESTROY(sc);
+       ATH_HAL_LOCK_DESTROY(sc);
+-      dev->stop = NULL; /* prevent calling ath_stop again */
+       unregister_netdev(dev);
+       return 0;
+ }
+@@ -12732,8 +12749,13 @@ ath_rcv_dev_event(struct notifier_block 
+       struct net_device *dev = (struct net_device *)ptr;
+       struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+       if (!dev || !sc || dev->open != &ath_init)
+               return 0;
++#else
++      if (!dev || !sc || dev->netdev_ops->ndo_open != &ath_init)
++              return 0;
++#endif
+       switch (event) {
+       case NETDEV_CHANGENAME:
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -451,6 +451,18 @@ ieee80211_ifdetach(struct ieee80211com *
+ }
+ EXPORT_SYMBOL(ieee80211_ifdetach);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
++static const struct net_device_ops ieee80211_netdev_ops = {
++      .ndo_get_stats          = ieee80211_getstats,
++      .ndo_open               = ieee80211_open,
++      .ndo_stop               = ieee80211_stop,
++      .ndo_start_xmit         = ieee80211_hardstart,
++      .ndo_set_multicast_list = ieee80211_set_multicast_list,
++      .ndo_change_mtu         = ieee80211_change_mtu,
++      .ndo_do_ioctl           = ieee80211_ioctl,
++};
++#endif
++
+ int
+ ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
+       const char *name, int opmode, int flags, struct ieee80211vap *master)
+@@ -471,16 +483,21 @@ ieee80211_vap_setup(struct ieee80211com 
+               } else
+                       strncpy(dev->name, name, sizeof(dev->name));
+       }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+       dev->get_stats = ieee80211_getstats;
+       dev->open = ieee80211_open;
+       dev->stop = ieee80211_stop;
+       dev->hard_start_xmit = ieee80211_hardstart;
+       dev->set_multicast_list = ieee80211_set_multicast_list;
++      dev->do_ioctl = ieee80211_ioctl;
+ #if 0
+       dev->set_mac_address = ieee80211_set_mac_address;
+ #endif
+       dev->change_mtu = ieee80211_change_mtu;
++#else
++      dev->netdev_ops = &ieee80211_netdev_ops;
++#endif
+       dev->tx_queue_len = 0;                  /* NB: bypass queuing */
+       dev->hard_header_len = parent->hard_header_len;
+       /*
+@@ -1824,7 +1841,11 @@ ieee80211_set_multicast_list(struct net_
+       IEEE80211_UNLOCK_IRQ(ic);
+       /* XXX: Merge multicast list into parent device */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+       parent->set_multicast_list(ic->ic_dev);
++#else
++      parent->netdev_ops->ndo_set_multicast_list(ic->ic_dev);
++#endif
+ }
+ void
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -984,8 +984,14 @@ ieee80211_rcv_dev_event(struct notifier_
+       void *ptr)
+ {
+       struct net_device *dev = (struct net_device *) ptr;
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+       if (!dev || dev->open != &ieee80211_open)
+               return 0;
++#else
++      if (!dev || dev->netdev_ops->ndo_open != &ieee80211_open)
++              return 0;
++#endif
+       switch (event) {
+       case NETDEV_CHANGENAME:
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -739,6 +739,7 @@ void ieee80211_build_sc_ie(struct ieee80
+ void ieee80211_dfs_action(struct ieee80211com *);
+ void ieee80211_expire_channel_excl_restrictions(struct ieee80211com *);
+ void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
++int ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+ /*
+  * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -5954,7 +5954,7 @@ static struct iw_handler_def ieee80211_i
+ /*
+  * Handle private ioctl requests.
+  */
+-static int
++int
+ ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ {
+       struct ieee80211vap *vap = netdev_priv(dev);
+@@ -6044,7 +6044,6 @@ ieee80211_ioctl_vattach(struct ieee80211
+ {
+       struct net_device *dev = vap->iv_dev;
+-      dev->do_ioctl = ieee80211_ioctl;
+ #if IW_HANDLER_VERSION < 7
+       dev->get_wireless_stats = ieee80211_iw_getstats;
+ #endif
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1188,7 +1188,11 @@ ieee80211_deliver_data(struct ieee80211_
+                       skb1->protocol = __constant_htons(ETH_P_802_2);
+                       /* XXX insert vlan tag before queue it? */
+                       ni_tmp = SKB_CB(skb1)->ni; /* remember node so we can free it */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+                       ret = dev->hard_start_xmit(skb1, dev);
++#else
++                      ret = dev->netdev_ops->ndo_start_xmit(skb1, dev);
++#endif
+                       if (ret == NETDEV_TX_BUSY)
+                               ieee80211_dev_kfree_skb(&skb1);
diff --git a/net/madwifi/patches/433-backport_remove_irq_none.patch b/net/madwifi/patches/433-backport_remove_irq_none.patch
new file mode 100644 (file)
index 0000000..5166d9e
--- /dev/null
@@ -0,0 +1,21 @@
+Fix Linux 2.6.30 compatibility
+
+Linux 2.6.30 doesn't define IRQ_NONE as a macro. Assume irqreturn_t,
+IRQ_NONE and IRQ_HANDLED to be present on Linux 2.6.29 and newer.
+http://madwifi-project.org/changeset/3986
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -83,11 +83,13 @@ typedef void *TQUEUE_ARG;
+ /*
+  * Guess how the interrupt handler should work.
+  */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+ #if !defined(IRQ_NONE)
+ typedef void irqreturn_t;
+ #define       IRQ_NONE
+ #define       IRQ_HANDLED
+ #endif /* !defined(IRQ_NONE) */
++#endif /* Linux < 2.6.29 */
+ #ifndef SET_MODULE_OWNER
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
diff --git a/net/madwifi/patches/434-name-alloc-fix.patch b/net/madwifi/patches/434-name-alloc-fix.patch
new file mode 100644 (file)
index 0000000..bc96e5c
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
+@@ -311,6 +311,11 @@ init_ath_wmac(u_int16_t devid, u_int16_t
+       SET_MODULE_OWNER(dev);
+       sclist[wlanNum] = sc;
++      if (dev_alloc_name(dev, dev->name) < 0) {
++              printk(KERN_ERR "%s: cannot allocate name\n", dev_info);
++              goto bad3;
++      }
++
+       switch (wlanNum) {
+       case AR531X_WLAN0_NUM:
+               if (((devid & AR5315_REV_MAJ_M) == AR5315_REV_MAJ) ||
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -238,6 +238,11 @@ ath_pci_probe(struct pci_dev *pdev, cons
+        */
+       sc->aps_sc.sc_invalid = 1;
++      if (dev_alloc_name(dev, dev->name) < 0) {
++              printk(KERN_ERR "%s: cannot allocate name\n", dev_info);
++              goto bad3;
++      }
++
+       dev->irq = pdev->irq;
+       SET_MODULE_OWNER(dev);
diff --git a/net/madwifi/patches/435-ibss_neighbor_fix.patch b/net/madwifi/patches/435-ibss_neighbor_fix.patch
new file mode 100644 (file)
index 0000000..d66af9b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -313,7 +313,7 @@ ieee80211_input(struct ieee80211vap * va
+                       if (type == IEEE80211_FC0_TYPE_DATA && ni == vap->iv_bss &&
+                                       !IEEE80211_ADDR_EQ(vap->iv_bss->ni_macaddr, wh->i_addr2)) {
+                               /* Try to find sender in local node table. */
+-                              ni = ieee80211_find_node(vap->iv_bss->ni_table, wh->i_addr2);
++                              ni = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
+                               if (ni == NULL) {
+                                       /*
+                                        * Fake up a node for this newly discovered
diff --git a/net/madwifi/patches/436-injection_checks.patch b/net/madwifi/patches/436-injection_checks.patch
new file mode 100644 (file)
index 0000000..7bdd82c
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -3199,7 +3199,13 @@ ath_tx_startraw(struct net_device *dev, 
+       struct ieee80211_frame *wh;
+       wh = (struct ieee80211_frame *)skb->data;
++
+       try0 = ph->try0;
++      if (!try0)
++              try0 = 1;
++      else if (try0 > 11)
++              try0 = 11;
++
+       rt = sc->sc_currates;
+       txrate = dot11_to_ratecode(sc, rt, ph->rate0);
+       power = ph->power > 63 ? 63 : ph->power;
+@@ -3224,7 +3230,8 @@ ath_tx_startraw(struct net_device *dev, 
+       rt = sc->sc_currates;
+       KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
+-      if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
++      if (((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_DATA) ||
++              IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+               flags |= HAL_TXDESC_NOACK;      /* no ack on broad/multicast */
+               sc->sc_stats.ast_tx_noack++;
+               try0 = 1;
diff --git a/net/madwifi/patches/437-sysctl_cleanup.patch b/net/madwifi/patches/437-sysctl_cleanup.patch
new file mode 100644 (file)
index 0000000..e35ed02
--- /dev/null
@@ -0,0 +1,73 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -11021,38 +11021,38 @@ enum {
+  * mirrored in /proc/sys.
+  */
+ enum {
+-      ATH_SLOTTIME            = 1,
+-      ATH_ACKTIMEOUT          = 2,
+-      ATH_CTSTIMEOUT          = 3,
+-      ATH_SOFTLED             = 4,
+-      ATH_LEDPIN              = 5,
+-      ATH_COUNTRYCODE         = 6,
+-      ATH_REGDOMAIN           = 7,
+-      ATH_DEBUG               = 8,
+-      ATH_TXANTENNA           = 9,
+-      ATH_RXANTENNA           = 10,
+-      ATH_DIVERSITY           = 11,
+-      ATH_TXINTRPERIOD        = 12,
+-      ATH_FFTXQMIN            = 13,
+-      ATH_XR_POLL_PERIOD      = 14,
+-      ATH_XR_POLL_COUNT       = 15,
+-      ATH_ACKRATE             = 16,
+-      ATH_RP                  = 17,
+-      ATH_RP_PRINT            = 18,
+-      ATH_RP_PRINT_ALL        = 19,
+-      ATH_RP_PRINT_MEM        = 20,
+-      ATH_RP_PRINT_MEM_ALL    = 21,
+-      ATH_RP_FLUSH            = 22,
+-      ATH_PANIC               = 23,
+-      ATH_RP_IGNORED          = 24,
+-      ATH_RADAR_IGNORED       = 25,
+-      ATH_MAXVAPS             = 26,
+-      ATH_INTMIT                      = 27,
+-      ATH_NOISE_IMMUNITY      = 28,
+-      ATH_OFDM_WEAK_DET       = 29,
+-      ATH_CHANBW              = 30,
+-      ATH_OUTDOOR             = 31,
+-      ATH_DISTANCE    = 32,
++      ATH_SLOTTIME,
++      ATH_ACKTIMEOUT,
++      ATH_CTSTIMEOUT,
++      ATH_SOFTLED,
++      ATH_LEDPIN,
++      ATH_COUNTRYCODE,
++      ATH_REGDOMAIN,
++      ATH_DEBUG,
++      ATH_TXANTENNA,
++      ATH_RXANTENNA,
++      ATH_DIVERSITY,
++      ATH_TXINTRPERIOD,
++      ATH_FFTXQMIN,
++      ATH_XR_POLL_PERIOD,
++      ATH_XR_POLL_COUNT,
++      ATH_ACKRATE,
++      ATH_RP,
++      ATH_RP_PRINT,
++      ATH_RP_PRINT_ALL,
++      ATH_RP_PRINT_MEM,
++      ATH_RP_PRINT_MEM_ALL,
++      ATH_RP_FLUSH,
++      ATH_PANIC,
++      ATH_RP_IGNORED,
++      ATH_RADAR_IGNORED,
++      ATH_MAXVAPS,
++      ATH_INTMIT,
++      ATH_NOISE_IMMUNITY,
++      ATH_OFDM_WEAK_DET,
++      ATH_CHANBW,
++      ATH_OUTDOOR,
++      ATH_DISTANCE,
+ };
+ /*
diff --git a/net/madwifi/patches/438-poweroffset_sysctl.patch b/net/madwifi/patches/438-poweroffset_sysctl.patch
new file mode 100644 (file)
index 0000000..e82046e
--- /dev/null
@@ -0,0 +1,59 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -10476,11 +10476,11 @@ set_node_txpower(void *arg, struct ieee8
+  * XXX: this function needs some locking to avoid being called 
+  * twice/interrupted. Returns the value actually stored. */
+ static u_int32_t
+-ath_set_clamped_maxtxpower(struct ath_softc *sc, 
+-              u_int32_t new_clamped_maxtxpower)
++ath_set_clamped_maxtxpower(struct ath_softc *sc, u_int32_t new_txpwr)
+ {
+-      new_clamped_maxtxpower -= sc->sc_poweroffset;
+-      (void)ath_hal_settxpowlimit(sc->sc_ah, new_clamped_maxtxpower);
++      new_txpwr = ((new_txpwr < sc->sc_poweroffset) ? 0 :
++              new_txpwr - sc->sc_poweroffset);
++      (void)ath_hal_settxpowlimit(sc->sc_ah, new_txpwr);
+       return ath_get_clamped_maxtxpower(sc);
+ }
+@@ -11031,6 +11031,7 @@ enum {
+       ATH_DEBUG,
+       ATH_TXANTENNA,
+       ATH_RXANTENNA,
++      ATH_POWEROFFSET,
+       ATH_DIVERSITY,
+       ATH_TXINTRPERIOD,
+       ATH_FFTXQMIN,
+@@ -11311,6 +11312,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                               ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
+ #endif
+                               break;
++                      case ATH_POWEROFFSET:
++                              sc->sc_poweroffset = val;
++                              break;
+                       case ATH_TXANTENNA:
+                               /*
+                                * antenna can be:
+@@ -11478,6 +11482,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_DEBUG:
+                       val = sc->sc_debug | ath_debug_global;
+                       break;
++              case ATH_POWEROFFSET:
++                      val = sc->sc_poweroffset;
++                      break;
+               case ATH_TXANTENNA:
+                       val = sc->sc_txantenna;
+                       break;
+@@ -11619,6 +11626,12 @@ static const ctl_table ath_sysctl_templa
+       },
+ #endif
+       { .ctl_name     = CTL_AUTO,
++        .procname     = "poweroffset",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_POWEROFFSET,
++      },
++      { .ctl_name     = CTL_AUTO,
+         .procname     = "txantenna",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
diff --git a/net/madwifi/patches/439-wlanconfig_stack_usage.patch b/net/madwifi/patches/439-wlanconfig_stack_usage.patch
new file mode 100644 (file)
index 0000000..f346143
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/tools/wlanconfig.c
++++ b/tools/wlanconfig.c
+@@ -560,7 +560,7 @@ ieee80211_ntoa(const uint8_t mac[IEEE802
+ static void
+ list_stations(const char *ifname)
+ {
+-      uint8_t buf[24*1024];
++      static uint8_t buf[24*1024];
+       struct iwreq iwr;
+       uint8_t *cp;
+       int s, len;
+@@ -653,7 +653,7 @@ list_stations(const char *ifname)
+ static void
+ list_scan(const char *ifname)
+ {
+-      uint8_t buf[24 * 1024];
++      static uint8_t buf[24 * 1024];
+       char ssid[14];
+       uint8_t *cp;
+       int len;
diff --git a/net/madwifi/patches/440-wme_cleanup.patch b/net/madwifi/patches/440-wme_cleanup.patch
new file mode 100644 (file)
index 0000000..d6c1b26
--- /dev/null
@@ -0,0 +1,136 @@
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -73,6 +73,29 @@ doprint(struct ieee80211vap *vap, int su
+ }
+ #endif
++static const int ieee802_1d_to_ac[8] = {
++      WME_AC_BE, WME_AC_BK, WME_AC_BK, WME_AC_BE,
++      WME_AC_VI, WME_AC_VI, WME_AC_VO, WME_AC_VO
++};
++
++/* Given a data frame determine the 802.1p/1d tag to use. */
++static unsigned int ieee80211_classify_ip(struct sk_buff *skb)
++{
++      const struct ether_header *eh = (struct ether_header *) skb->data;
++      const struct iphdr *ip = (struct iphdr *)
++                      (skb->data + sizeof (struct ether_header));
++      unsigned int dscp;
++
++      switch (skb->protocol) {
++      case __constant_htons(ETH_P_IP):
++              dscp = ip->tos & 0xfc;
++              break;
++      default:
++              return 0;
++      }
++
++      return dscp >> 5;
++}
+ /*
+  * Determine the priority based on VLAN and/or IP TOS. Priority is
+@@ -83,90 +106,24 @@ static int
+ ieee80211_classify(struct ieee80211_node *ni, struct sk_buff *skb)
+ {
+       struct ieee80211vap *vap = ni->ni_vap;
+-      struct ether_header *eh = (struct ether_header *) skb->data;
+-      int v_wme_ac = 0, d_wme_ac = 0;
+-
+-      /* default priority */
+-      skb->priority = WME_AC_BE;
+-
+-      if (!(ni->ni_flags & IEEE80211_NODE_QOS))
+-              return 0;
+-      /* 
+-       * If node has a vlan tag then all traffic
+-       * to it must have a matching vlan id.
++      /* skb->priority values from 256->263 are magic values to
++       * directly indicate a specific 802.1d priority.  This is used
++       * to allow 802.1d priority to be passed directly in from VLAN
++       * tags, etc.
+        */
+-      if (ni->ni_vlan != 0 && vlan_tx_tag_present(skb)) {
+-              u_int32_t tag=0;
+-              int v_pri;
+-
+-              if (vap->iv_vlgrp == NULL) {
+-                      IEEE80211_NODE_STAT(ni, tx_novlantag);
+-                      ni->ni_stats.ns_tx_novlantag++;
+-                      return 1;
+-              }
+-              if (((tag = vlan_tx_tag_get(skb)) & VLAN_VID_MASK) !=
+-                  (ni->ni_vlan & VLAN_VID_MASK)) {
+-                      IEEE80211_NODE_STAT(ni, tx_vlanmismatch);
+-                      ni->ni_stats.ns_tx_vlanmismatch++;
+-                      return 1;
+-              }
+-              if (ni->ni_flags & IEEE80211_NODE_QOS) {
+-                      v_pri = (tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK;
+-                      switch (v_pri) {
+-                      case 1:
+-                      case 2:         /* Background (BK) */
+-                              v_wme_ac = WME_AC_BK;
+-                              break;
+-                      case 0:
+-                      case 3:         /* Best Effort (BE) */
+-                              v_wme_ac = WME_AC_BE;
+-                              break;
+-                      case 4:
+-                      case 5:         /* Video (VI) */
+-                              v_wme_ac = WME_AC_VI;
+-                              break;
+-                      case 6:
+-                      case 7:         /* Voice (VO) */
+-                              v_wme_ac = WME_AC_VO;
+-                              break;
+-                      }
+-              }
++      if (skb->priority >= 256 && skb->priority <= 263) {
++              skb->priority = ieee802_1d_to_ac[skb->priority - 256];
++              return 0;
+       }
+-      if (eh->ether_type == __constant_htons(ETHERTYPE_IP)) {
+-              const struct iphdr *ip = (struct iphdr *)
+-                      (skb->data + sizeof (struct ether_header));
+-              /*
+-               * IP frame, map the TOS field.
+-               *
+-               * XXX: fill out these mappings???
+-               */
+-              switch (ip->tos) {
+-              case 0x08:                              /* Background */
+-              case 0x20:
+-                      d_wme_ac = WME_AC_BK;
+-                      break;
+-              case 0x28:                              /* Video */
+-              case 0xa0:
+-                      d_wme_ac = WME_AC_VI;
+-                      break;
+-              case 0x30:                              /* Voice */
+-              case 0xe0:
+-              case 0x88:                              /* XXX UPSD */
+-              case 0xb8:
+-                      d_wme_ac = WME_AC_VO;
+-                      break;
+-              default:                                /* All others */
+-                      d_wme_ac = WME_AC_BE;
+-                      break;
+-              }
+-      } else {
+-              d_wme_ac = WME_AC_BE;
++      if (!(ni->ni_flags & IEEE80211_NODE_QOS)) {
++              /* default priority */
++              skb->priority = WME_AC_BE;
++              return 0;
+       }
+-      skb->priority = d_wme_ac;
+-      if (v_wme_ac > d_wme_ac)
+-              skb->priority = v_wme_ac;
++
++      skb->priority = ieee802_1d_to_ac[ieee80211_classify_ip(skb)];
+       /* Applying ACM policy */
+       if (vap->iv_opmode == IEEE80211_M_STA) {
diff --git a/net/madwifi/patches/441-fix_ibss_node_handling.patch b/net/madwifi/patches/441-fix_ibss_node_handling.patch
new file mode 100644 (file)
index 0000000..b12930f
--- /dev/null
@@ -0,0 +1,91 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6641,10 +6641,8 @@ static void
+ ath_recv_mgmt(struct ieee80211vap * vap, struct ieee80211_node *ni_or_null,
+       struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf)
+ {
++      const struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
+       struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
+-#ifdef AR_DEBUG
+-        struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
+-#endif
+       struct ieee80211_node * ni = ni_or_null;
+       u_int64_t hw_tsf, beacon_tsf;
+       u_int32_t hw_tu, beacon_tu, intval;
+@@ -6686,7 +6684,7 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+               }
+               if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
+                               (sc->sc_opmode == HAL_M_HOSTAP) &&
+-                              IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
++                              IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid)) {
+                       /* In this mode, we drive the HAL in HOSTAP mode. Hence
+                        * we do the IBSS merging in software. Also do not merge
+                        * if the difference it too small. Otherwise we are playing
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -311,7 +311,8 @@ ieee80211_input(struct ieee80211vap * va
+                       }
+                       /* Do not try to find a node reference if the packet really did come from the BSS */
+                       if (type == IEEE80211_FC0_TYPE_DATA && ni == vap->iv_bss &&
+-                                      !IEEE80211_ADDR_EQ(vap->iv_bss->ni_macaddr, wh->i_addr2)) {
++                                      !IEEE80211_ADDR_EQ(vap->iv_bss->ni_macaddr, wh->i_addr2) &&
++                                      IEEE80211_ADDR_EQ(vap->iv_bssid, wh->i_addr3)) {
+                               /* Try to find sender in local node table. */
+                               ni = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
+                               if (ni == NULL) {
+@@ -513,6 +514,10 @@ ieee80211_input(struct ieee80211vap * va
+                       break;
+               case IEEE80211_M_IBSS:
+               case IEEE80211_M_AHDEMO:
++                      /* ignore foreign data frames */
++                      if (ni == vap->iv_bss)
++                              goto out;
++
+                       if (dir != IEEE80211_FC1_DIR_NODS) {
+                               IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
+                                       wh, "data", "invalid dir 0x%x", dir);
+@@ -3558,6 +3563,11 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       } else if ((vap->iv_opmode == IEEE80211_M_WDS) && vap->iv_wdsnode) {
+                               found = 1;
+                               ni = ni_or_null = vap->iv_wdsnode;
++                      } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
++                              ni_or_null = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
++                              if (ni_or_null)
++                                      ni = ni_or_null;
++                              found = 1;
+                       }
+                       IEEE80211_UNLOCK_IRQ(vap->iv_ic);
+@@ -3686,19 +3696,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       vap->iv_stats.is_rx_ssidmismatch++; /*XXX*/
+                       return;
+               }
+-              if (ni == vap->iv_bss) {
+-                      if (vap->iv_opmode == IEEE80211_M_IBSS) {
+-                              /*
+-                               * XXX Cannot tell if the sender is operating
+-                               * in ibss mode.  But we need a new node to
+-                               * send the response so blindly add them to the
+-                               * neighbor table.
+-                               */
+-                              ni = ieee80211_fakeup_adhoc_node(vap,
+-                                      wh->i_addr2);
+-                      } else {
+-                              ni = ieee80211_dup_bss(vap, wh->i_addr2, 1);
+-                      }
++              if (ni == vap->iv_bss && vap->iv_opmode != IEEE80211_M_IBSS) {
++                      ni = ieee80211_dup_bss(vap, wh->i_addr2, 1);
+                       if (ni == NULL)
+                               return;
+                       allocbs = 1;
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -601,6 +601,8 @@ ieee80211_ibss_merge(struct ieee80211_no
+               ic->ic_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long",
+               ic->ic_flags & IEEE80211_F_SHSLOT ? "short" : "long",
+               ic->ic_flags & IEEE80211_F_USEPROT ? ", protection" : "");
++      if (!IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bssid))
++              ieee80211_node_table_reset(&vap->iv_ic->ic_sta, vap);
+       return ieee80211_sta_join1(ieee80211_ref_node(ni));
+ }
+ EXPORT_SYMBOL(ieee80211_ibss_merge);
diff --git a/net/madwifi/patches/442-ibss_rx_filter.patch b/net/madwifi/patches/442-ibss_rx_filter.patch
new file mode 100644 (file)
index 0000000..eaf8071
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -294,6 +294,17 @@ ieee80211_input(struct ieee80211vap * va
+                       break;
+               case IEEE80211_M_IBSS:
+               case IEEE80211_M_AHDEMO:
++                      if (!IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid) ||
++                          (!IEEE80211_ADDR_EQ(wh->i_addr1, vap->iv_myaddr) &&
++                           !IEEE80211_IS_MULTICAST(wh->i_addr1) &&
++                           (subtype != IEEE80211_FC0_SUBTYPE_BEACON))) {
++                              if (!(vap->iv_dev->flags & IFF_PROMISC)) {
++                                      IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
++                                              bssid, NULL, "%s", "not to bss");
++                                      vap->iv_stats.is_rx_wrongbss++;
++                                      goto out;
++                              }
++                      }
+                       if (dir != IEEE80211_FC1_DIR_NODS)
+                               bssid = wh->i_addr1;
+                       else if (type == IEEE80211_FC0_TYPE_CTL)
diff --git a/net/madwifi/patches/443-tx_drop_counter.patch b/net/madwifi/patches/443-tx_drop_counter.patch
new file mode 100644 (file)
index 0000000..30630ae
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -1592,10 +1592,6 @@ found:
+                               ieee80211_ref_node(ni);
+ #endif
+                       }
+-              } else {
+-                      IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_OUTPUT, mac,
+-                              "no node, discard frame (%s)", __func__);
+-                      vap->iv_stats.is_tx_nonode++;
+               }
+       }
+       return ni;
+--- a/net80211/ieee80211_output.c
++++ b/net80211/ieee80211_output.c
+@@ -208,6 +208,9 @@ ieee80211_hardstart(struct sk_buff *skb,
+       ni = ieee80211_find_txnode(vap, eh->ether_dhost);
+       if (ni == NULL) {
+               /* NB: ieee80211_find_txnode does stat+msg */
++              IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_OUTPUT, mac,
++                      "no node, discard frame (%s)", __func__);
++              vap->iv_stats.is_tx_nonode++;
+               goto bad;
+       }
diff --git a/net/madwifi/patches/444-beacon_update_war.patch b/net/madwifi/patches/444-beacon_update_war.patch
new file mode 100644 (file)
index 0000000..6a3178a
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/net80211/ieee80211_beacon.c
++++ b/net80211/ieee80211_beacon.c
+@@ -476,6 +476,14 @@ ieee80211_beacon_update(struct ieee80211
+                       tie->tim_bitctl |= BITCTL_BUFD_MCAST;
+               else
+                       tie->tim_bitctl &= ~BITCTL_BUFD_MCAST;
++
++              /* WAR: on some platforms, a race condition between beacon
++               * contents update and beacon transmission leads to beacon
++               * data not being updated in time. For most fields this is
++               * not critical, but for powersave it is. Work around this
++               * by always remapping the beacon when the TIM IE changes.
++               */
++              len_changed = 1;
+       }
+       /* Whenever we want to switch to a new channel, we need to follow the
diff --git a/net/madwifi/patches/445-fix_ps_sta_count.patch b/net/madwifi/patches/445-fix_ps_sta_count.patch
new file mode 100644 (file)
index 0000000..2751465
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1957,6 +1957,7 @@ ath_uapsd_processtriggers(struct ath_sof
+                               if (qwh->i_fc[1] & IEEE80211_FC1_PWR_MGT) {
+                                       ni->ni_flags |=
+                                               IEEE80211_NODE_UAPSD_TRIG;
++                                      ni->ni_vap->iv_ps_sta++;
+                                       ic->ic_uapsdmaxtriggers++;
+                                       WME_UAPSD_NODE_TRIGSEQINIT(ni);
+                                       DPRINTF(sc, ATH_DEBUG_UAPSD,
+@@ -1967,6 +1968,7 @@ ath_uapsd_processtriggers(struct ath_sof
+                               } else {
+                                       ni->ni_flags &=
+                                               ~IEEE80211_NODE_UAPSD_TRIG;
++                                      ni->ni_vap->iv_ps_sta--;
+                                       ic->ic_uapsdmaxtriggers--;
+                                       DPRINTF(sc, ATH_DEBUG_UAPSD,
+                                               "Node (" MAC_FMT ") no longer U-APSD"
diff --git a/net/madwifi/patches/446-single_module.patch b/net/madwifi/patches/446-single_module.patch
new file mode 100644 (file)
index 0000000..ba40545
--- /dev/null
@@ -0,0 +1,778 @@
+--- a/ath/Makefile
++++ b/ath/Makefile
+@@ -41,7 +41,6 @@
+ #
+ obj := $(firstword $(obj) $(SUBDIRS) .)
+-TOP = $(obj)/..
+ ifeq ($(strip $(BUS)),AHB)
+ BUSNAME=ahb
+@@ -57,7 +56,24 @@ COPTS       += -DDFS_DOMAIN_ETSI -DDFS_DOMAIN_
+ include $(TOP)/Makefile.inc
+ obj-m         += ath_$(BUSNAME).o
+-ath_$(BUSNAME)-objs   := if_ath.o if_ath_radar.o if_ath_$(BUSNAME).o
++ath_objs := if_ath.o if_ath_radar.o if_ath_$(BUSNAME).o
++ath_$(BUSNAME)-objs   := $(ath_objs)
++
++ifneq ($(SINGLE_MODULE),)
++include $(TOP)/net80211/Makefile
++include $(TOP)/ath_rate/sample/Makefile
++include $(TOP)/ath_rate/minstrel/Makefile
++RC_DECLARE=$(foreach R,$(ATH_RATE),extern void ath_rate_$(R)_init(void);extern void ath_rate_$(R)_exit(void);)
++RC_INIT=$(foreach R,$(ATH_RATE),ath_rate_$(R)_init();)
++RC_EXIT=$(foreach R,$(ATH_RATE),ath_rate_$(R)_exit();)
++
++ath_$(BUSNAME)-objs += $(patsubst %,../net80211/%,$(wlan-objs) $(foreach var,wep tkip ccmp acl xauth scan_sta scan_ap,$(wlan_$(var)-objs))) $(foreach RC,$(ATH_RATE),$(patsubst %,../ath_rate/$(RC)/%,$(ath_rate_$(RC)-objs)))
++ifdef LINUX24
++  ath_$(BUSNAME)-linkobjs := $(ath_objs) $(wlan-objs) $(foreach var,wep tkip ccmp acl xauth scan_sta scan_ap,$(wlan_$(var)-objs)) $(foreach RC,$(ATH_RATE),$(ath_rate_$(RC)-objs))
++endif
++
++EXTRA_CFLAGS += -DSINGLE_MODULE -DRC_INIT="$(RC_INIT)" -DRC_EXIT="$(RC_EXIT)" -DRC_DECLARE="$(RC_DECLARE)"
++endif
+ INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL) -I$(WLAN)
+@@ -72,13 +88,8 @@ install:
+       test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH)
+       install -m 0644 ath_$(BUSNAME).$(KMODSUF) $(DESTDIR)/$(KMODPATH)
+-clean:
+-      rm -f *~ *.o *.ko *.mod.c .*.cmd
+-      rm -f .depend .version .*.o.flags .*.o.d
+-      rm -rf .tmp_versions
+-
+ ath_$(BUSNAME).o: $(ath_$(BUSNAME)-objs)
+-      $(LD) $(LDOPTS) -o ath_$(BUSNAME).$(KMODSUF) -r $(ath_$(BUSNAME)-objs)
++      $(LD) $(LDOPTS) -o ath_$(BUSNAME).$(KMODSUF) -r $(if $(ath_$(BUSNAME)-linkobjs),$(ath_$(BUSNAME)-linkobjs),$(ath_$(BUSNAME)-objs))
+ if_ath_hal.h: $(HAL)/ah.h
+       $(TOP)/scripts/if_ath_hal_generator.pl $< $@
+--- a/net80211/ieee80211_acl.c
++++ b/net80211/ieee80211_acl.c
+@@ -281,16 +281,6 @@ acl_getpolicy(struct ieee80211vap *vap)
+       return as->as_policy;
+ }
+-/*
+- * Module glue.
+- */
+-
+-MODULE_AUTHOR("Errno Consulting, Sam Leffler");
+-MODULE_DESCRIPTION("802.11 wireless support: MAC-based ACL policy");
+-#ifdef MODULE_LICENSE
+-MODULE_LICENSE("Dual BSD/GPL");
+-#endif
+-
+ static const struct ieee80211_aclator mac = {
+       .iac_name       = "mac",
+       .iac_attach     = acl_attach,
+@@ -303,6 +293,18 @@ static const struct ieee80211_aclator ma
+       .iac_getpolicy  = acl_getpolicy,
+ };
++#include "module.h"
++/*
++ * Module glue.
++ */
++
++MODULE_AUTHOR("Errno Consulting, Sam Leffler");
++MODULE_DESCRIPTION("802.11 wireless support: MAC-based ACL policy");
++#ifdef MODULE_LICENSE
++MODULE_LICENSE("Dual BSD/GPL");
++#endif
++
++
+ static int __init
+ init_ieee80211_acl(void)
+ {
+--- a/net80211/ieee80211_crypto_ccmp.c
++++ b/net80211/ieee80211_crypto_ccmp.c
+@@ -686,6 +686,8 @@ ccmp_decrypt(struct ieee80211_key *key, 
+ }
+ #undef CCMP_DECRYPT
++#include "module.h"
++
+ /*
+  * Module glue.
+  */
+--- a/net80211/ieee80211_crypto_tkip.c
++++ b/net80211/ieee80211_crypto_tkip.c
+@@ -1046,6 +1046,8 @@ tkip_decrypt(struct tkip_ctx *ctx, struc
+       return 1;
+ }
++#include "module.h"
++
+ /*
+  * Module glue.
+  */
+--- a/net80211/ieee80211_crypto_wep.c
++++ b/net80211/ieee80211_crypto_wep.c
+@@ -497,6 +497,8 @@ wep_decrypt(struct ieee80211_key *key, s
+  * Module glue.
+  */
++#include "module.h"
++
+ MODULE_AUTHOR("Errno Consulting, Sam Leffler");
+ MODULE_DESCRIPTION("802.11 wireless support: WEP cipher");
+ #ifdef MODULE_LICENSE
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -1015,6 +1015,10 @@ static struct notifier_block ieee80211_e
+ static char *version = RELEASE_VERSION;
+ static char *dev_info = "wlan";
++extern        void ieee80211_auth_setup(void);
++
++#include "module.h"
++
+ MODULE_AUTHOR("Errno Consulting, Sam Leffler");
+ MODULE_DESCRIPTION("802.11 wireless LAN protocol support");
+ #ifdef MODULE_VERSION
+@@ -1024,8 +1028,6 @@ MODULE_VERSION(RELEASE_VERSION);
+ MODULE_LICENSE("Dual BSD/GPL");
+ #endif
+-extern        void ieee80211_auth_setup(void);
+-
+ static int __init
+ init_wlan(void)
+ {
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -763,15 +763,6 @@ action_tasklet(IEEE80211_TQUEUE_ARG data
+       (*ss->ss_ops->scan_default)(vap, &as->as_selbss);
+ }
+-/*
+- * Module glue.
+- */
+-MODULE_AUTHOR("Errno Consulting, Sam Leffler");
+-MODULE_DESCRIPTION("802.11 wireless support: default ap scanner");
+-#ifdef MODULE_LICENSE
+-MODULE_LICENSE("Dual BSD/GPL");
+-#endif
+-
+ static const struct ieee80211_scanner ap_default = {
+       .scan_name              = "default",
+       .scan_attach            = ap_attach,
+@@ -789,6 +780,16 @@ static const struct ieee80211_scanner ap
+       .scan_default           = ap_default_action,
+ };
++#include "module.h"
++
++/*
++ * Module glue.
++ */
++MODULE_AUTHOR("Errno Consulting, Sam Leffler");
++MODULE_DESCRIPTION("802.11 wireless support: default ap scanner");
++#ifdef MODULE_LICENSE
++MODULE_LICENSE("Dual BSD/GPL");
++#endif
+ static int __init
+ init_scanner_ap(void)
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -1208,6 +1208,8 @@ action_tasklet(IEEE80211_TQUEUE_ARG data
+               ieee80211_start_scan(vap, ss->ss_flags, ss->ss_duration, ss->ss_nssid, ss->ss_ssid);
+ }
++#include "module.h"
++
+ /*
+  * Module glue.
+  */
+@@ -1217,6 +1219,7 @@ MODULE_DESCRIPTION("802.11 wireless supp
+ MODULE_LICENSE("Dual BSD/GPL");
+ #endif
++
+ static int __init
+ init_scanner_sta(void)
+ {
+--- a/net80211/ieee80211_xauth.c
++++ b/net80211/ieee80211_xauth.c
+@@ -65,15 +65,6 @@
+ #include <net80211/ieee80211_var.h>
+ /*
+- * Module glue.
+- */
+-MODULE_AUTHOR("Errno Consulting, Sam Leffler");
+-MODULE_DESCRIPTION("802.11 wireless support: external (user mode) authenticator");
+-#ifdef MODULE_LICENSE
+-MODULE_LICENSE("Dual BSD/GPL");
+-#endif
+-
+-/*
+  * One module handles everything for now.  May want
+  * to split things up for embedded applications.
+  */
+@@ -85,6 +76,18 @@ static const struct ieee80211_authentica
+       .ia_node_leave  = NULL,
+ };
++#include "module.h"
++
++/*
++ * Module glue.
++ */
++MODULE_AUTHOR("Errno Consulting, Sam Leffler");
++MODULE_DESCRIPTION("802.11 wireless support: external (user mode) authenticator");
++#ifdef MODULE_LICENSE
++MODULE_LICENSE("Dual BSD/GPL");
++#endif
++
++
+ static int __init
+ init_ieee80211_xauth(void)
+ {
+--- a/net80211/Makefile
++++ b/net80211/Makefile
+@@ -40,7 +40,11 @@
+ # Makefile for the 802.11 WLAN modules.
+ #
+ obj := $(firstword $(obj) $(SUBDIRS) .)
+-TOP = $(obj)/..
++
++include $(TOP)/Makefile.inc
++
++ifeq ($(SINGLE_MODULE),)
++
+ #
+ # There is one authenticator mechanism: an in-kernel implementation
+ # (wlan_xauth). 
+@@ -59,29 +63,8 @@ MOD_INSTALL := wlan.o wlan_wep.o wlan_tk
+ obj-m         += $(MOD_INSTALL)
+-wlan-objs     := if_media.o \
+-                 ieee80211_skb.o \
+-                 ieee80211.o ieee80211_beacon.o ieee80211_crypto.o \
+-                 ieee80211_crypto_none.o ieee80211_input.o ieee80211_node.o \
+-                 ieee80211_output.o ieee80211_power.o ieee80211_proto.o \
+-                 ieee80211_scan.o ieee80211_wireless.o ieee80211_linux.o \
+-                 ieee80211_monitor.o ieee80211_rate.o
+-wlan_wep-objs := ieee80211_crypto_wep.o
+-wlan_tkip-objs        := ieee80211_crypto_tkip.o
+-wlan_ccmp-objs        := ieee80211_crypto_ccmp.o
+-wlan_acl-objs := ieee80211_acl.o
+-wlan_xauth-objs       := ieee80211_xauth.o
+-wlan_scan_sta-objs :=ieee80211_scan_sta.o
+-wlan_scan_ap-objs := ieee80211_scan_ap.o
+-
+-include $(TOP)/Makefile.inc
+-
+ INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL)
+-EXTRA_CFLAGS+=$(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
+-
+--include $(TOPDIR)/Rules.make
+-
+ all:
+       $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules
+@@ -108,8 +91,28 @@ install:
+               f=`basename $$i .o`; \
+               install -m 0644  $$f.$(KMODSUF) $(DESTDIR)/$(KMODPATH); \
+       done
++else
++all:
++endif
++
++wlan-objs     := if_media.o \
++                 ieee80211_skb.o \
++                 ieee80211.o ieee80211_beacon.o ieee80211_crypto.o \
++                 ieee80211_crypto_none.o ieee80211_input.o ieee80211_node.o \
++                 ieee80211_output.o ieee80211_power.o ieee80211_proto.o \
++                 ieee80211_scan.o ieee80211_wireless.o ieee80211_linux.o \
++                 ieee80211_monitor.o ieee80211_rate.o
++wlan_wep-objs := ieee80211_crypto_wep.o
++wlan_tkip-objs        := ieee80211_crypto_tkip.o
++wlan_ccmp-objs        := ieee80211_crypto_ccmp.o
++wlan_acl-objs := ieee80211_acl.o
++wlan_xauth-objs       := ieee80211_xauth.o
++wlan_scan_sta-objs :=ieee80211_scan_sta.o
++wlan_scan_ap-objs := ieee80211_scan_ap.o
++
++
++EXTRA_CFLAGS+=$(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
++
++-include $(TOPDIR)/Rules.make
++
+-clean:
+-      -rm -f *~ *.o *.ko *.mod.c
+-      -rm -f .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
+-      -rm -rf .tmp_versions
+--- /dev/null
++++ b/net80211/module.h
+@@ -0,0 +1,19 @@
++#ifdef SINGLE_MODULE
++
++#undef static
++#define static
++#undef module_init
++#undef module_exit
++#define module_init(...)
++#define module_exit(...)
++
++#undef MODULE_AUTHOR
++#undef MODULE_LICENSE
++#undef MODULE_VERSION
++#undef MODULE_DESCRIPTION
++#define MODULE_AUTHOR(...)
++#define MODULE_LICENSE(...)
++#define MODULE_VERSION(...)
++#define MODULE_DESCRIPTION(...)
++
++#endif
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -13780,3 +13780,5 @@ cleanup_ath_buf(struct ath_softc *sc, st
+       return bf;
+ }
++
++
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -42,6 +42,7 @@
+ #include <linux/config.h>
+ #endif
+ #include <linux/version.h>
++#include <linux/init.h>
+ #include <linux/module.h>
+ #include <linux/skbuff.h>
+ #include <linux/netdevice.h>
+@@ -2015,3 +2016,65 @@ ieee80211_build_sc_ie(struct ieee80211co
+ int ath_debug_global = 0;
+ EXPORT_SYMBOL(ath_debug_global);
++#ifdef SINGLE_MODULE
++typedef void (*initfunc)(void);
++
++extern void init_ieee80211_acl(void);
++extern void init_crypto_ccmp(void);
++extern void init_crypto_tkip(void);
++extern void init_crypto_wep(void);
++extern void init_wlan(void);
++extern void init_scanner_ap(void);
++extern void init_scanner_sta(void);
++extern void init_ieee80211_xauth(void);
++
++extern void exit_ieee80211_acl(void);
++extern void exit_crypto_ccmp(void);
++extern void exit_crypto_tkip(void);
++extern void exit_crypto_wep(void);
++extern void exit_wlan(void);
++extern void exit_scanner_ap(void);
++extern void exit_scanner_sta(void);
++extern void exit_ieee80211_xauth(void);
++
++static __initdata initfunc net80211_init[] = {
++      init_wlan,
++      init_ieee80211_acl,
++      init_crypto_ccmp,
++      init_crypto_tkip,
++      init_crypto_wep,
++      init_ieee80211_xauth,
++      init_scanner_ap,
++      init_scanner_sta,
++};
++
++static __exitdata initfunc net80211_exit[] = {
++      exit_crypto_ccmp,
++      exit_crypto_tkip,
++      exit_crypto_wep,
++      exit_scanner_ap,
++      exit_scanner_sta,
++      exit_ieee80211_xauth,
++      exit_ieee80211_acl,
++      exit_wlan,
++};
++
++void net80211_init_module(void)
++{
++      int i;
++      for (i = 0; i < sizeof(net80211_init)/sizeof(net80211_init[0]); i++) {
++              if (net80211_init[i])
++                      net80211_init[i]();
++      }
++}
++
++void net80211_exit_module(void)
++{
++      int i;
++      for (i = 0; i < sizeof(net80211_exit)/sizeof(net80211_exit[0]); i++) {
++              if (net80211_exit[i])
++                      net80211_exit[i]();
++      }
++}
++
++#endif
+--- a/ath/if_ath_ahb.c
++++ b/ath/if_ath_ahb.c
+@@ -447,10 +447,18 @@ MODULE_SUPPORTED_DEVICE("Atheros WLAN ca
+ MODULE_LICENSE("Dual BSD/GPL");
+ #endif
++#ifdef SINGLE_MODULE
++RC_DECLARE
++#endif
++
+ static int __init
+ init_ath_ahb(void)
+ {
+       printk(KERN_INFO "%s: %s\n", dev_info, version);
++#ifdef SINGLE_MODULE
++      net80211_init_module();
++      RC_INIT
++#endif
+       platform_driver_register(&ahb_wmac_driver);
+       ath_sysctl_register();
+@@ -463,6 +471,10 @@ exit_ath_ahb(void)
+ {
+       ath_sysctl_unregister();
+       platform_driver_unregister(&ahb_wmac_driver);
++#ifdef SINGLE_MODULE
++      RC_EXIT
++      net80211_exit_module();
++#endif
+       printk(KERN_INFO "%s: driver unloaded\n", dev_info);
+ }
+ module_exit(exit_ath_ahb);
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -417,11 +417,19 @@ MODULE_SUPPORTED_DEVICE("Atheros WLAN ca
+ MODULE_LICENSE("Dual BSD/GPL");
+ #endif
++#ifdef SINGLE_MODULE
++RC_DECLARE
++#endif
++
+ static int __init
+ init_ath_pci(void)
+ {
+       printk(KERN_INFO "%s: %s\n", dev_info, version);
++#ifdef SINGLE_MODULE
++      net80211_init_module();
++      RC_INIT
++#endif
+       if (pci_register_driver(&ath_pci_driver) < 0) {
+               printk(KERN_ERR "%s: No devices found, driver not installed.\n", dev_info);
+               return (-ENODEV);
+@@ -436,6 +444,10 @@ exit_ath_pci(void)
+ {
+       ath_sysctl_unregister();
+       pci_unregister_driver(&ath_pci_driver);
++#ifdef SINGLE_MODULE
++      RC_EXIT
++      net80211_exit_module();
++#endif
+       printk(KERN_INFO "%s: driver unloaded\n", dev_info);
+ }
+--- a/ath_rate/minstrel/Makefile
++++ b/ath_rate/minstrel/Makefile
+@@ -39,9 +39,7 @@
+ # Makefile for the Atheros Rate Control Support.
+ #
+ obj := $(firstword $(obj) $(SUBDIRS) .)
+-TOP = $(obj)/../..
+-obj-m         += ath_rate_minstrel.o
+ ath_rate_minstrel-objs        := minstrel.o
+ include $(TOP)/Makefile.inc
+@@ -50,6 +48,10 @@ INCS += -I$(TOP) -I$(ATH) -I$(ATH_HAL) -
+ EXTRA_CFLAGS+= $(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
++ifeq ($(SINGLE_MODULE),)
++
++obj-m         += ath_rate_minstrel.o
++
+ -include $(TOPDIR)/Rules.make
+ all:
+@@ -59,10 +61,9 @@ install:
+       test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH)
+       install -m 0644 ath_rate_minstrel.$(KMODSUF) $(DESTDIR)/$(KMODPATH)
+-clean:
+-      -rm -f *~ *.o *.ko *.mod.c
+-      -rm -f .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
+-      -rm -rf .tmp_versions
+-
+ ath_rate_minstrel.o: $(ath_rate_minstrel-objs)
+       $(LD) $(LDOPTS) -o ath_rate_minstrel.$(KMODSUF) -r $(ath_rate_minstrel-objs)
++else
++all:
++install:
++endif
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -945,6 +945,8 @@ static struct ieee80211_rate_ops ath_rat
+               .dynamic_proc_register = ath_rate_dynamic_proc_register,
+ };
++#include <net80211/module.h>
++
+ MODULE_AUTHOR("John Bicket/Derek Smithies");
+ MODULE_DESCRIPTION("Minstrel Rate bit-rate selection algorithm for Atheros devices");
+ #ifdef MODULE_VERSION
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -47,6 +47,7 @@
+ #include <net80211/ieee80211_power.h>
+ #include <net80211/ieee80211_proto.h>
+ #include <net80211/ieee80211_scan.h>
++#include "symbol.h"
+ /* NB: 
+  * - Atheros chips use 6 bits when power is specified in whole dBm units, with 
+@@ -740,6 +741,8 @@ void ieee80211_dfs_action(struct ieee802
+ void ieee80211_expire_channel_excl_restrictions(struct ieee80211com *);
+ void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
+ int ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
++void net80211_init_module(void);
++void net80211_exit_module(void);
+ /*
+  * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -521,7 +521,10 @@ extern struct sk_buff * ieee80211_getmgt
+ #define       IF_DRAIN(_q)            skb_queue_drain(_q)
+ extern        void skb_queue_drain(struct sk_buff_head *q);
+-#ifndef __MOD_INC_USE_COUNT
++#ifdef SINGLE_MODULE
++#define _MOD_DEC_USE(_m) do {} while(0)
++#define _MOD_INC_USE(_m, _err) do {} while(0)
++#elif !defined(__MOD_INC_USE_COUNT)
+ #define       _MOD_INC_USE(_m, _err)                                          \
+       if (!try_module_get(_m)) {                                      \
+               printk(KERN_WARNING "%s: try_module_get failed\n",      \
+--- a/ath_rate/sample/Makefile
++++ b/ath_rate/sample/Makefile
+@@ -39,9 +39,7 @@
+ # Makefile for the Atheros Rate Control Support.
+ #
+ obj := $(firstword $(obj) $(SUBDIRS) .)
+-TOP = $(obj)/../..
+-obj-m         += ath_rate_sample.o
+ ath_rate_sample-objs  := sample.o
+ include $(TOP)/Makefile.inc
+@@ -50,6 +48,9 @@ INCS += -I$(TOP) -I$(ATH) -I$(ATH_HAL) -
+ EXTRA_CFLAGS+= $(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
++ifeq ($(SINGLE_MODULE),)
++obj-m         += ath_rate_sample.o
++
+ -include $(TOPDIR)/Rules.make
+ all:
+@@ -59,10 +60,9 @@ install:
+       test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH)
+       install -m 0644 ath_rate_sample.$(KMODSUF) $(DESTDIR)/$(KMODPATH)
+-clean:
+-      -rm -f *~ *.o *.ko *.mod.c
+-      -rm -f .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
+-      -rm -rf .tmp_versions
+-
+ ath_rate_sample.o: $(ath_rate_sample-objs)
+       $(LD) $(LDOPTS) -o ath_rate_sample.$(KMODSUF) -r $(ath_rate_sample-objs)
++else
++all:
++install:
++endif
+--- a/Makefile
++++ b/Makefile
+@@ -41,7 +41,7 @@
+ #
+ obj := $(firstword $(obj) $(SUBDIRS) .)
+-TOP = $(obj)
++export TOP:=$(if $(wildcard $(firstword $(SUBDIRS))/Makefile.inc),$(firstword $(SUBDIRS)),$(CURDIR))
+ ifneq (svnversion.h,$(MAKECMDGOALS))
+ include $(TOP)/Makefile.inc
+@@ -54,7 +54,7 @@ all: modules tools
+ modules: configcheck svnversion.h
+ ifdef LINUX24
+       for i in $(obj-y); do \
+-              $(MAKE) -C $$i || exit 1; \
++              $(MAKE) -C $$i TOP="$(TOP)" || exit 1; \
+       done
+ else
+       $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules
+@@ -89,7 +89,7 @@ install-modules: modules
+       sh scripts/find-madwifi-modules.sh -r $(KERNELRELEASE) $(DESTDIR)
+       for i in $(obj-y); do \
+-              $(MAKE) -C $$i install || exit 1; \
++              $(MAKE) -C $$i install TOP="$(TOP)" || exit 1; \
+       done
+ ifeq ($(DESTDIR),)
+       (export KMODPATH=$(KMODPATH); /sbin/depmod -ae $(KERNELRELEASE))
+@@ -114,12 +114,21 @@ reinstall-tools: uninstall-tools install
+ reinstall-modules: uninstall-modules install-modules
+ clean:
+-      for i in $(obj-y); do \
+-              $(MAKE) -C $$i clean; \
+-      done
+-      -$(MAKE) -C $(TOOLS) clean
+-      rm -rf .tmp_versions
++      -find $(obj-y) -name '*~' \
++              -or -name '*.o' \
++              -or -name '*.o.d' \
++              -or -name '*.o.cmd' \
++              -or -name '*.o.flags' \
++              -or -name '*.ko' \
++              -or -name '*.ko.cmd' \
++              -or -name '*.mod.c' \
++              -or -name '.depend' \
++              -or -name '.version' \
++              -or -name '.symvers' | \
++              xargs -r rm -f
+       rm -f *.symvers svnversion.h
++      rm -rf .tmp_versions
++      make -C tools clean
+ info:
+       @echo "The following settings will be used for compilation:"
+@@ -135,18 +144,6 @@ info:
+       @echo "KMODPATH     : $(KMODPATH)"
+       @echo "KMODSUF      : $(KMODSUF)"
+-sanitycheck:
+-      @echo -n "Checking requirements... "
+-      
+-      @# check if specified rate control is available
+-      @if [ ! -d $(ATH_RATE) ]; then \
+-          echo "FAILED"; \
+-          echo "Selected rate control $(ATH_RATE) not available."; \
+-          exit 1; \
+-      fi
+-      
+-      @echo "ok."
+-
+ .PHONY: release
+ release:
+       sh scripts/make-release.bash
+@@ -155,7 +152,7 @@ release:
+ unload:
+       bash scripts/madwifi-unload
+-configcheck: sanitycheck
++configcheck:
+       @echo -n "Checking kernel configuration... "
+       
+       @# check version of kernel
+--- a/Makefile.inc
++++ b/Makefile.inc
+@@ -68,6 +68,9 @@ endif
+ export KERNELPATH
+ endif
++# build net80211 and ath_ahb/ath_pci into a single module
++export SINGLE_MODULE=1
++
+ # KERNELRELEASE is the target kernel's version.  It's always taken from
+ # the kernel build tree.  Kernel Makefile doesn't always know the exact
+ # kernel version (especially for vendor stock kernels), so we get it
+@@ -100,6 +103,7 @@ export ARCH
+ include $(TOP)/ath_hal/ah_target.inc
+ export TARGET
+ COPTS += -DTARGET='"$(TARGET)"'
++COPTS += -DCONFIG_ATHEROS_RATE_DEFAULT='"$(firstword $(ATH_RATE))"'
+ # KMODPATH nominates the directory where the modules will be
+ # installed to
+@@ -141,7 +145,7 @@ ATH=       $(TOP)/ath
+ #
+ # Path to the rate control algorithms.
+ #
+-ATH_RATE=     $(TOP)/ath_rate
++ATH_RATE=     minstrel
+ #
+ # Path to the userspace utilities. 
+ # 
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -991,6 +991,8 @@ static struct ieee80211_rate_ops ath_rat
+       .dynamic_proc_register = ath_rate_dynamic_proc_register,
+ };
++#include <net80211/module.h>
++
+ MODULE_AUTHOR("John Bicket");
+ MODULE_DESCRIPTION("SampleRate bit-rate selection algorithm for Atheros devices");
+ #ifdef MODULE_VERSION
+@@ -1000,18 +1002,17 @@ MODULE_VERSION(RELEASE_VERSION);
+ MODULE_LICENSE("Dual BSD/GPL");
+ #endif
+-static int __init
+-init_ath_rate_sample(void)
++static int __init ath_rate_sample_init(void)
+ {
+       printk(KERN_INFO "%s: %s\n", dev_info, version);
+       return ieee80211_rate_register(&ath_rate_ops);
+ }
+-module_init(init_ath_rate_sample);
++module_init(ath_rate_sample_init);
+ static void __exit
+-exit_ath_rate_sample(void)
++ath_rate_sample_exit(void)
+ {
+       ieee80211_rate_unregister(&ath_rate_ops);
+       printk(KERN_INFO "%s: unloaded\n", dev_info);
+ }
+-module_exit(exit_ath_rate_sample);
++module_exit(ath_rate_sample_exit);
+--- a/net80211/if_media.h
++++ b/net80211/if_media.h
+@@ -42,6 +42,7 @@
+ #define _NET_IF_MEDIA_H_
+ #include <net80211/ieee80211_linux.h>
++#include "symbol.h"
+ /*
+  * Prototypes and definitions for BSD/OS-compatible network interface
+--- /dev/null
++++ b/net80211/symbol.h
+@@ -0,0 +1,4 @@
++#ifdef SINGLE_MODULE
++#undef EXPORT_SYMBOL
++#define EXPORT_SYMBOL(...)
++#endif
+--- a/ath_rate/Makefile
++++ b/ath_rate/Makefile
+@@ -1,7 +1,7 @@
+ obj := $(firstword $(obj) $(SUBDIRS) .)
+ TOP = $(obj)/..
+-obj-y := amrr/ onoe/ sample/ minstrel/
++obj-y := sample/ minstrel/
+ include $(TOP)/Makefile.inc
diff --git a/net/madwifi/patches/447-sta_reconnect.patch b/net/madwifi/patches/447-sta_reconnect.patch
new file mode 100644 (file)
index 0000000..960d1b8
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -647,8 +647,11 @@ ieee80211_sta_join1(struct ieee80211_nod
+               (vap->iv_state == IEEE80211_S_RUN) && bssid_equal(obss, selbs)); */
+       vap->iv_bss = selbs;
+       IEEE80211_ADDR_COPY(vap->iv_bssid, selbs->ni_bssid);
+-      if (obss != NULL)
++      if (obss != NULL) {
++              if (obss->ni_table)
++                      ieee80211_node_leave(obss);
+               ieee80211_unref_node(&obss);
++      }
+       ic->ic_bsschan = selbs->ni_chan;
+       ic->ic_curchan = ic->ic_bsschan;
+       ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan);
+--- a/net80211/ieee80211_proto.c
++++ b/net80211/ieee80211_proto.c
+@@ -1602,7 +1602,6 @@ __ieee80211_newstate(struct ieee80211vap
+                               IEEE80211_FC0_SUBTYPE_ASSOC_REQ, 0);
+                       break;
+               case IEEE80211_S_RUN:
+-                      ieee80211_node_leave(ni);
+                       if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
+                               /* NB: caller specifies ASSOC/REASSOC by arg */
+                               IEEE80211_SEND_MGMT(ni, arg ?
diff --git a/net/madwifi/patches/448-beacon_handling_fixes.patch b/net/madwifi/patches/448-beacon_handling_fixes.patch
new file mode 100644 (file)
index 0000000..3fa97e2
--- /dev/null
@@ -0,0 +1,407 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -160,7 +160,7 @@ static int ath_check_beacon_done(struct 
+ static void ath_beacon_send(struct ath_softc *, int *, uint64_t hw_tsf);
+ static void ath_beacon_return(struct ath_softc *, struct ath_buf *);
+ static void ath_beacon_free(struct ath_softc *);
+-static void ath_beacon_config(struct ath_softc *, struct ieee80211vap *);
++static void ath_beacon_config(struct ath_softc *, struct ieee80211vap *, int);
+ static void ath_hw_beacon_stop(struct ath_softc *sc);
+ static int ath_desc_alloc(struct ath_softc *);
+ static void ath_desc_free(struct ath_softc *);
+@@ -387,13 +387,11 @@ static void ath_set_timing(struct ath_so
+ /* calibrate every 30 secs in steady state but check every second at first. */
+ static int ath_calinterval = ATH_SHORT_CALINTERVAL;
+ static int ath_xchanmode = AH_TRUE;           /* enable extended channels */
+-static int ath_maxvaps = ATH_MAXVAPS_DEFAULT;   /* set default maximum vaps */
+ static int bstuck_thresh = BSTUCK_THRESH;       /* Stuck beacon count required for reset */
+ static char *autocreate = NULL;
+ static char *ratectl = DEF_RATE_CTL;
+ static int rfkill = 0;
+ static int tpc = 1;
+-static int maxvaps = -1;
+ static int xchanmode = -1;
+ #include "ath_wprobe.c"
+ static int beacon_cal = 1;
+@@ -432,7 +430,6 @@ static struct notifier_block ath_event_b
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+ MODULE_PARM(beacon_cal, "i");
+-MODULE_PARM(maxvaps, "i");
+ MODULE_PARM(xchanmode, "i");
+ MODULE_PARM(rfkill, "i");
+ #ifdef ATH_CAP_TPC
+@@ -444,7 +441,6 @@ MODULE_PARM(ratectl, "s");
+ #else
+ #include <linux/moduleparam.h>
+ module_param(beacon_cal, int, 0600);
+-module_param(maxvaps, int, 0600);
+ module_param(xchanmode, int, 0600);
+ module_param(rfkill, int, 0600);
+ #ifdef ATH_CAP_TPC
+@@ -454,7 +450,6 @@ module_param(bstuck_thresh, int, 0600);
+ module_param(autocreate, charp, 0600);
+ module_param(ratectl, charp, 0600);
+ #endif
+-MODULE_PARM_DESC(maxvaps, "Maximum VAPs");
+ MODULE_PARM_DESC(xchanmode, "Enable/disable extended channel mode");
+ MODULE_PARM_DESC(rfkill, "Enable/disable RFKILL capability");
+ #ifdef ATH_CAP_TPC
+@@ -512,7 +507,7 @@ MODULE_PARM_DESC(ieee80211_debug, "Load-
+  * and use the higher bits as the index of the VAP.
+  */
+ #define ATH_SET_VAP_BSSID_MASK(bssid_mask)                            \
+-      ((bssid_mask)[0] &= ~(((ath_maxvaps-1) << 2) | 0x02))
++      ((bssid_mask)[0] &= ~(((ATH_MAXVAPS_BCN-1) << 2) | 0x02))
+ #define ATH_GET_VAP_ID(bssid)                   ((bssid)[0] >> 2)
+ #define ATH_SET_VAP_BSSID(bssid, id)                                  \
+               do {                                                    \
+@@ -604,8 +599,8 @@ ath_attach(u_int16_t devid, struct net_d
+       /* Allocate space for dynamically determined maximum VAP count */
+       sc->sc_bslot = 
+-              kmalloc(ath_maxvaps * sizeof(struct ieee80211vap*), GFP_KERNEL);
+-      memset(sc->sc_bslot, 0, ath_maxvaps * sizeof(struct ieee80211vap*));
++              kmalloc(ATH_MAXVAPS_BCN * sizeof(struct ieee80211vap*), GFP_KERNEL);
++      memset(sc->sc_bslot, 0, ATH_MAXVAPS_BCN * sizeof(struct ieee80211vap*));
+       /*
+        * Cache line size is used to size and align various
+@@ -694,13 +689,6 @@ ath_attach(u_int16_t devid, struct net_d
+       for (i = 0; i < sc->sc_keymax; i++)
+               ath_hal_keyreset(ah, i);
+-      if (maxvaps != -1) {
+-              ath_maxvaps = maxvaps;
+-              if (ath_maxvaps < ATH_MAXVAPS_MIN)
+-                      ath_maxvaps = ATH_MAXVAPS_MIN;
+-              else if (ath_maxvaps > ATH_MAXVAPS_MAX)
+-                      ath_maxvaps = ATH_MAXVAPS_MAX;
+-      }
+       if (xchanmode != -1)
+               ath_xchanmode = xchanmode;
+       error = ath_getchannels(dev);
+@@ -1349,12 +1337,6 @@ ath_vap_create(struct ieee80211com *ic, 
+               return NULL;
+       }
+-      if (sc->sc_nvaps >= ath_maxvaps) {
+-              EPRINTF(sc, "Too many virtual APs (%d already exist).\n", 
+-                              sc->sc_nvaps);
+-              return NULL;
+-      }
+-
+       dev = alloc_etherdev(sizeof(struct ath_vap) + sc->sc_rc->arc_vap_space);
+       if (dev == NULL) {
+               /* XXX msg */
+@@ -1424,7 +1406,7 @@ ath_vap_create(struct ieee80211com *ic, 
+               TAILQ_FOREACH(v, &ic->ic_vaps, iv_next)
+                       id_mask |= (1 << ATH_GET_VAP_ID(v->iv_myaddr));
+-              for (id = 0; id < ath_maxvaps; id++) {
++              for (id = 0; id < ATH_MAXVAPS_BCN; id++) {
+                       /* get the first available slot */
+                       if ((id_mask & (1 << id)) == 0) {
+                               ATH_SET_VAP_BSSID(vap->iv_myaddr, id);
+@@ -1451,11 +1433,11 @@ ath_vap_create(struct ieee80211com *ic, 
+               /* Assign the VAP to a beacon xmit slot.  As
+                * above, this cannot fail to find one. */
+               avp->av_bslot = 0;
+-              for (slot = 0; slot < ath_maxvaps; slot++)
++              for (slot = 0; slot < ATH_MAXVAPS_BCN; slot++)
+                       if (sc->sc_bslot[slot] == NULL) {
+                               /* XXX: Hack, space out slots to better
+                                * deal with misses. */
+-                              if (slot + 1 < ath_maxvaps &&
++                              if (slot + 1 < ATH_MAXVAPS_BCN &&
+                                   sc->sc_bslot[slot+1] == NULL) {
+                                       avp->av_bslot = slot + 1;
+                                       break;
+@@ -1463,8 +1445,11 @@ ath_vap_create(struct ieee80211com *ic, 
+                               avp->av_bslot = slot;
+                               /* NB: keep looking for a double slot */
+                       }
+-              KASSERT(sc->sc_bslot[avp->av_bslot] == NULL,
+-                      ("beacon slot %u not empty?", avp->av_bslot));
++              if (sc->sc_bslot[avp->av_bslot]) {
++                      free_netdev(dev);
++                      return NULL;
++              }
++
+               sc->sc_bslot[avp->av_bslot] = vap;
+               sc->sc_nbcnvaps++;
+@@ -1475,15 +1460,7 @@ ath_vap_create(struct ieee80211com *ic, 
+                        * of staggered beacons.
+                        */
+                       /* XXX check for beacon interval too small */
+-                      if (ath_maxvaps > 4) {
+-                              DPRINTF(sc, ATH_DEBUG_BEACON, 
+-                                              "Staggered beacons are not "
+-                                              "possible with maxvaps set "
+-                                              "to %d.\n", ath_maxvaps);
+-                              sc->sc_stagbeacons = 0;
+-                      } else {
+-                              sc->sc_stagbeacons = 1;
+-                      }
++                      sc->sc_stagbeacons = 1;
+               }
+               DPRINTF(sc, ATH_DEBUG_BEACON, "sc->sc_stagbeacons %sabled\n", 
+                               (sc->sc_stagbeacons ? "en" : "dis"));
+@@ -1553,7 +1530,7 @@ ath_vap_create(struct ieee80211com *ic, 
+               if (ath_startrecv(sc) != 0)     /* restart recv */
+                       EPRINTF(sc, "Unable to start receive logic.\n");
+               if (sc->sc_beacons)
+-                      ath_beacon_config(sc, NULL);    /* restart beacons */
++                      ath_beacon_config(sc, NULL, 0); /* restart beacons */
+               ath_hal_intrset(ah, sc->sc_imask);
+       }
+@@ -1681,7 +1658,7 @@ ath_vap_delete(struct ieee80211vap *vap)
+               if (ath_startrecv(sc) != 0)             /* restart recv. */
+                       EPRINTF(sc, "Unable to start receive logic.\n");
+               if (sc->sc_beacons)
+-                      ath_beacon_config(sc, NULL);    /* restart beacons */
++                      ath_beacon_config(sc, NULL, 0); /* restart beacons */
+               ath_hal_intrset(ah, sc->sc_imask);
+       }
+ }
+@@ -3066,7 +3043,7 @@ ath_reset(struct net_device *dev)
+        */
+       ath_chan_change(sc, c);
+       if (sc->sc_beacons)
+-              ath_beacon_config(sc, NULL);    /* restart beacons */
++              ath_beacon_config(sc, NULL, 1); /* restart beacons */
+       ath_hal_intrset(ah, sc->sc_imask);
+       ath_set_ack_bitrate(sc, sc->sc_ackrate);
+       netif_wake_queue(dev);          /* restart xmit */
+@@ -4763,7 +4740,7 @@ ath_check_beacon_done(struct ath_softc *
+       /*
+        * check if the last beacon went out with the mode change flag set.
+        */
+-      for (slot = 0; slot < ath_maxvaps; slot++) {
++      for (slot = 0; slot < ATH_MAXVAPS_BCN; slot++) {
+               if (sc->sc_bslot[slot]) {
+                       vap = sc->sc_bslot[slot];
+                       break;
+@@ -4968,7 +4945,7 @@ ath_beacon_alloc_internal(struct ath_sof
+                * has a timestamp in one beacon interval while the
+                * others get a timestamp aligned to the next interval.
+                */
+-              tuadjust = (ni->ni_intval * (ath_maxvaps - avp->av_bslot)) / ath_maxvaps;
++              tuadjust = (ni->ni_intval * (ATH_MAXVAPS_BCN - avp->av_bslot)) / ATH_MAXVAPS_BCN;
+               tsfadjust = cpu_to_le64(tuadjust << 10);        /* TU->TSF */
+               DPRINTF(sc, ATH_DEBUG_BEACON,
+@@ -5361,8 +5338,8 @@ ath_beacon_send(struct ath_softc *sc, in
+               u_int32_t tsftu;
+               tsftu = hw_tsf >> 10; /* NB: 64 -> 32: See note far above. */
+-              slot = ((tsftu % ic->ic_lintval) * ath_maxvaps) / ic->ic_lintval;
+-              vap = sc->sc_bslot[(slot + 1) % ath_maxvaps];
++              slot = ((tsftu % ic->ic_lintval) * ATH_MAXVAPS_BCN) / ic->ic_lintval;
++              vap = sc->sc_bslot[(slot + 1) % ATH_MAXVAPS_BCN];
+               DPRINTF(sc, ATH_DEBUG_BEACON_PROC,
+                       "Slot %d [tsf %llu tsftu %llu intval %u] vap %p\n",
+                       slot, (unsigned long long)hw_tsf, 
+@@ -5377,7 +5354,7 @@ ath_beacon_send(struct ath_softc *sc, in
+               u_int32_t *bflink = NULL;
+               /* XXX: rotate/randomize order? */
+-              for (slot = 0; slot < ath_maxvaps; slot++) {
++              for (slot = 0; slot < ATH_MAXVAPS_BCN; slot++) {
+                       if ((vap = sc->sc_bslot[slot]) != NULL) {
+                               if ((bf = ath_beacon_generate(
+                                               sc, vap, 
+@@ -5418,7 +5395,7 @@ ath_beacon_send(struct ath_softc *sc, in
+        *     again.  If we miss a beacon for that slot then we'll be
+        *     slow to transition but we'll be sure at least one beacon
+        *     interval has passed.  When bursting slot is always left
+-       *     set to ath_maxvaps so this check is a no-op.
++       *     set to ATH_MAXVAPS_BCN so this check is a no-op.
+        */
+       /* XXX locking */
+       if (sc->sc_updateslot == UPDATE) {
+@@ -5526,7 +5503,7 @@ ath_beacon_free(struct ath_softc *sc)
+  * (2^(32 + 10 - 1) - 1)us is a really long time.
+  */
+ static void
+-ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap)
++ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap, int reset)
+ {
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ath_hal *ah = sc->sc_ah;
+@@ -5553,7 +5530,7 @@ ath_beacon_config(struct ath_softc *sc, 
+       /* We should reset hw TSF only once, so we increment
+        * ni_tstamp.tsf to avoid resetting the hw TSF multiple
+        * times */
+-      if (tsf == 0) {
++      if (tsf == 0 || reset) {
+               reset_tsf = 1;
+               ni->ni_tstamp.tsf = cpu_to_le64(1);
+       }
+@@ -5567,7 +5544,7 @@ ath_beacon_config(struct ath_softc *sc, 
+               /* NB: the beacon interval is kept internally in TUs */
+               intval = ic->ic_lintval & HAL_BEACON_PERIOD;
+               if (sc->sc_stagbeacons)
+-                      intval /= ath_maxvaps;  /* for staggered beacons */
++                      intval /= ATH_MAXVAPS_BCN;      /* for staggered beacons */
+               if ((sc->sc_nostabeacons) &&
+                   (vap->iv_opmode == IEEE80211_M_HOSTAP))
+                       reset_tsf = 1;
+@@ -5583,31 +5560,24 @@ ath_beacon_config(struct ath_softc *sc, 
+                * time */
+               nexttbtt = intval;
+       } else if (intval) {    /* NB: can be 0 for monitor mode */
+-              if (tsf == 1) {
+-                      /* We have not received any beacons or probe
+-                       * responses. Since a beacon should be sent
+-                       * every 'intval' ms, we compute the next
+-                       * beacon timestamp using the hardware TSF. We
+-                       * ensure that it is at least FUDGE TUs ahead
+-                       * of the current TSF. Otherwise, we use the
+-                       * next beacon timestamp again */
+-                      nexttbtt = roundup(hw_tsftu + FUDGE, intval);
+-              } 
+-              else if (ic->ic_opmode == IEEE80211_M_IBSS) {
+-                      if (tsf > hw_tsf) {
+-                              /* We received a beacon, but the HW TSF has
+-                               * not been updated (otherwise hw_tsf > tsf)
+-                               * We cannot use the hardware TSF, so we
+-                               * wait to synchronize beacons again. */
+-                              sc->sc_syncbeacon = 1;
+-                              goto ath_beacon_config_debug;
+-                      } else {
+-                              /* Normal case: we received a beacon to which
+-                               * we have synchronized. Make sure that nexttbtt
+-                               * is at least FUDGE TU ahead of hw_tsf */
+-                              nexttbtt = tsftu + roundup(hw_tsftu + FUDGE - 
+-                                              tsftu, intval);
+-                      }
++              if ((tsf > hw_tsf) && (ic->ic_opmode == IEEE80211_M_IBSS)) {
++                      /* We received a beacon, but the HW TSF has
++                       * not been updated (otherwise hw_tsf > tsf)
++                       * We cannot use the hardware TSF, so we
++                       * wait to synchronize beacons again. */
++                      sc->sc_syncbeacon = 1;
++                      goto ath_beacon_config_debug;
++              } else if ((tsftu + FUDGE) > hw_tsftu) {
++                      if (tsftu > hw_tsftu + 2 * intval)
++                              nexttbtt = roundup(hw_tsftu + FUDGE, intval);
++                      else
++                              nexttbtt = tsftu;
++              } else {
++                      /* Normal case: we received a beacon to which
++                       * we have synchronized. Make sure that nexttbtt
++                       * is at least FUDGE TU ahead of hw_tsf */
++                      nexttbtt = tsftu + roundup(hw_tsftu + FUDGE -
++                                      tsftu, intval);
+               }
+       }
+@@ -5730,9 +5700,6 @@ ath_beacon_config(struct ath_softc *sc, 
+               ath_beacon_dturbo_config(vap, intval &
+                               ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
+ #endif
+-              if ((nexttbtt & HAL_BEACON_PERIOD) - (ath_hal_gettsf32(ah) >> 10)
+-                              <= ath_hal_sw_beacon_response_time)
+-                      nexttbtt += intval;
+               sc->sc_nexttbtt = nexttbtt;
+               /* stop beacons before reconfiguring the timers to avoid race
+@@ -5889,7 +5856,7 @@ ath_desc_alloc(struct ath_softc *sc)
+       /* XXX allocate beacon state together with VAP */
+       error = ath_descdma_setup(sc, &sc->sc_bdma, &sc->sc_bbuf,
+-                      "beacon", ath_maxvaps, 1);
++                      "beacon", ATH_MAXVAPS_BCN, 1);
+       if (error != 0) {
+               ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf,
+                       BUS_DMA_TODEVICE);
+@@ -6680,7 +6647,7 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+                       /* Resync beacon timers using the tsf of the
+                        * beacon frame we just received. */
+                       vap->iv_flags_ext &= ~IEEE80211_FEXT_APPIE_UPDATE;
+-                      ath_beacon_config(sc, vap);
++                      ath_beacon_config(sc, vap, 0);
+                       DPRINTF(sc, ATH_DEBUG_BEACON, 
+                               "Updated beacon timers\n");
+               }
+@@ -9359,7 +9326,7 @@ ath_chan_set(struct ath_softc *sc, struc
+                * HW seems to turn off beacons during turbo mode switch.
+                */
+               if (sc->sc_beacons && !sc->sc_dfs_cac)
+-                      ath_beacon_config(sc, NULL);
++                      ath_beacon_config(sc, NULL, 0);
+               /*
+                * Re-enable interrupts.
+                */
+@@ -9813,7 +9780,7 @@ ath_newstate(struct ieee80211vap *vap, e
+                                       ATH_DEBUG_BEACON_PROC, 
+                               "Beacons reconfigured by %p[%s]!\n",
+                               vap, vap->iv_nickname);
+-                      ath_beacon_config(sc, vap);
++                      ath_beacon_config(sc, vap, 1);
+                       sc->sc_beacons = 1;
+               }
+       } else {
+@@ -9948,9 +9915,6 @@ ath_dfs_cac_completed(unsigned long data
+               }
+               netif_wake_queue(dev);
+               ath_reset(dev);
+-              if (sc->sc_beacons) {
+-                      ath_beacon_config(sc, NULL);
+-              }
+               dev->watchdog_timeo = 5 * HZ; /* restore normal timeout */
+       } else {
+               do_gettimeofday(&tv);
+@@ -11473,9 +11437,6 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_OUTDOOR:
+                       val = ic->ic_country_outdoor;
+                       break;
+-              case ATH_MAXVAPS:
+-                      val = ath_maxvaps;
+-                      break;
+               case ATH_REGDOMAIN:
+                       ath_hal_getregdomain(ah, &val);
+                       break;
+@@ -11606,12 +11567,6 @@ static const ctl_table ath_sysctl_templa
+         .extra2       = (void *)ATH_OUTDOOR,
+       },
+       { .ctl_name     = CTL_AUTO,
+-        .procname     = "maxvaps",
+-        .mode         = 0444,
+-        .proc_handler = ath_sysctl_halparam,
+-        .extra2       = (void *)ATH_MAXVAPS,
+-      },
+-      { .ctl_name     = CTL_AUTO,
+         .procname     = "regdomain",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+@@ -11928,13 +11883,6 @@ static ctl_table ath_static_sysctls[] = 
+       },
+ #endif
+       { .ctl_name     = CTL_AUTO,
+-        .procname     = "maxvaps",
+-        .mode         = 0444,
+-        .data         = &ath_maxvaps,
+-        .maxlen       = sizeof(ath_maxvaps),
+-        .proc_handler = proc_dointvec
+-      },
+-      { .ctl_name     = CTL_AUTO,
+         .procname     = "xchanmode",
+         .mode         = 0444,
+         .data         = &ath_xchanmode,
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -211,9 +211,7 @@ static inline struct net_device *_alloc_
+ #define       ATH_RXBUF       40              /* number of RX buffers */
+ #define       ATH_TXBUF       200             /* number of TX buffers */
+-#define ATH_MAXVAPS_MIN       2       /* minimum number of beacon buffers */
+-#define ATH_MAXVAPS_MAX       64      /* maximum number of beacon buffers */
+-#define ATH_MAXVAPS_DEFAULT   4       /* default number of beacon buffers */
++#define ATH_MAXVAPS_BCN               4       /* maximum number of beacon buffers */
+ /* free buffer threshold to restart net dev */
+ #define       ATH_TXBUF_FREE_THRESHOLD  (ATH_TXBUF / 20)
diff --git a/net/madwifi/patches/449-fix_txbuf_leak.patch b/net/madwifi/patches/449-fix_txbuf_leak.patch
new file mode 100644 (file)
index 0000000..31f2fef
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -3697,6 +3697,7 @@ ff_bypass:
+        */
+       skb = ieee80211_encap(ni, skb, &framecnt);
+       if (skb == NULL) {
++              STAILQ_INSERT_TAIL(&bf_head, bf, bf_list);
+               DPRINTF(sc, ATH_DEBUG_XMIT,
+                       "Dropping; encapsulation failure\n");
+               sc->sc_stats.ast_tx_encap++;
diff --git a/net/madwifi/patches/450-calibration.patch b/net/madwifi/patches/450-calibration.patch
new file mode 100644 (file)
index 0000000..8739790
--- /dev/null
@@ -0,0 +1,177 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -394,7 +394,6 @@ static int rfkill = 0;
+ static int tpc = 1;
+ static int xchanmode = -1;
+ #include "ath_wprobe.c"
+-static int beacon_cal = 1;
+ static const struct ath_hw_detect generic_hw_info = {
+       .vendor_name = "Unknown",
+@@ -429,7 +428,6 @@ static struct notifier_block ath_event_b
+ };
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+-MODULE_PARM(beacon_cal, "i");
+ MODULE_PARM(xchanmode, "i");
+ MODULE_PARM(rfkill, "i");
+ #ifdef ATH_CAP_TPC
+@@ -440,7 +438,6 @@ MODULE_PARM(autocreate, "s");
+ MODULE_PARM(ratectl, "s");
+ #else
+ #include <linux/moduleparam.h>
+-module_param(beacon_cal, int, 0600);
+ module_param(xchanmode, int, 0600);
+ module_param(rfkill, int, 0600);
+ #ifdef ATH_CAP_TPC
+@@ -825,6 +822,7 @@ ath_attach(u_int16_t devid, struct net_d
+               error = EIO;
+               goto bad2;
+       }
++      sc->sc_cal_interval = ath_calinterval;
+       init_timer(&sc->sc_cal_ch);
+       sc->sc_cal_ch.function = ath_calibrate;
+       sc->sc_cal_ch.data = (unsigned long) dev;
+@@ -2737,8 +2735,7 @@ ath_stop_locked(struct net_device *dev)
+               }
+               if (!sc->sc_invalid) {
+                       del_timer_sync(&sc->sc_dfs_cac_timer);
+-                      if (!sc->sc_beacon_cal)
+-                              del_timer_sync(&sc->sc_cal_ch);
++                      del_timer_sync(&sc->sc_cal_ch);
+               }
+               ath_draintxq(sc);
+               if (!sc->sc_invalid) {
+@@ -2763,10 +2760,9 @@ static void ath_set_beacon_cal(struct at
+       if (val) {
+               del_timer_sync(&sc->sc_cal_ch);
+       } else {
+-              sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
+-              add_timer(&sc->sc_cal_ch);
++              mod_timer(&sc->sc_cal_ch, jiffies + (sc->sc_cal_interval * HZ));
+       }
+-      sc->sc_beacon_cal = !!val && beacon_cal;
++      sc->sc_beacon_cal = !!val;
+ }
+ /*
+@@ -3008,7 +3004,7 @@ ath_reset(struct net_device *dev)
+        * XXX: starting the calibration too early seems to lead to
+        * problems with the beacons.
+        */
+-      sc->sc_lastcal = jiffies;
++      sc->sc_nextcal = jiffies + msecs_to_jiffies(sc->sc_cal_interval * 1000);
+       /*
+        * Convert to a HAL channel description with the flags
+@@ -5430,10 +5426,9 @@ ath_beacon_send(struct ath_softc *sc, in
+                       "Invoking ath_hal_txstart with sc_bhalq: %d\n",
+                       sc->sc_bhalq);
+               ath_hal_txstart(ah, sc->sc_bhalq);
+-              if (sc->sc_beacon_cal && (jiffies > sc->sc_lastcal + (ath_calinterval * HZ))) {
+-                      sc->sc_cal_ch.expires = jiffies + msecs_to_jiffies(10);
+-                      add_timer(&sc->sc_cal_ch);
+-              }
++              if (sc->sc_beacon_cal && ((sc->sc_bmisscount == 3) ||
++                  (jiffies > sc->sc_nextcal)))
++                      mod_timer(&sc->sc_cal_ch, jiffies + 1);
+               sc->sc_stats.ast_be_xmit++;             /* XXX per-VAP? */
+       }
+@@ -9104,6 +9099,7 @@ ath_startrecv(struct ath_softc *sc)
+               dev->mtu, sc->sc_cachelsz, sc->sc_rxbufsize);
+       sc->sc_rxlink = NULL;
++      ath_set_beacon_cal(sc, IEEE80211_IS_MODE_BEACON(sc->sc_ic.ic_opmode));
+       STAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) {
+               int error = ath_rxbuf_init(sc, bf);
+               ATH_RXBUF_RESET(bf);
+@@ -9320,7 +9316,7 @@ ath_chan_set(struct ath_softc *sc, struc
+                               jiffies + (sc->sc_dfs_cac_period * HZ));
+                       /* This is a good time to start a calibration */
+-                      ath_set_beacon_cal(sc, 1);
++                      mod_timer(&sc->sc_cal_ch, jiffies + 1);
+               }
+               /*
+                * re configure beacons when it is a turbo mode switch.
+@@ -9414,25 +9410,23 @@ ath_calibrate(unsigned long arg)
+       if (isIQdone == AH_TRUE) {
+               /* Unless user has overridden calibration interval,
+                * upgrade to less frequent calibration */
+-              if (ath_calinterval == ATH_SHORT_CALINTERVAL)
+-                      ath_calinterval = ATH_LONG_CALINTERVAL;
++              if (sc->sc_cal_interval == ATH_SHORT_CALINTERVAL)
++                      sc->sc_cal_interval = ATH_LONG_CALINTERVAL;
+       }
+       else {
+               /* Unless user has overridden calibration interval,
+                * downgrade to more frequent calibration */
+-              if (ath_calinterval == ATH_LONG_CALINTERVAL)
+-                      ath_calinterval = ATH_SHORT_CALINTERVAL;
++              if (sc->sc_cal_interval == ATH_LONG_CALINTERVAL)
++                      sc->sc_cal_interval = ATH_SHORT_CALINTERVAL;
+       }
+       DPRINTF(sc, ATH_DEBUG_CALIBRATE, "Channel %u/%x -- IQ %s.\n",
+               sc->sc_curchan.channel, sc->sc_curchan.channelFlags,
+               isIQdone ? "done" : "not done");
+-      sc->sc_lastcal = jiffies;
+-      if (!sc->sc_beacon_cal) {
+-              sc->sc_cal_ch.expires = jiffies + (ath_calinterval * HZ);
+-              add_timer(&sc->sc_cal_ch);
+-      }
++      sc->sc_nextcal = jiffies + msecs_to_jiffies(sc->sc_cal_interval * 1000);
++      if (!sc->sc_beacon_cal)
++              mod_timer(&sc->sc_cal_ch, sc->sc_nextcal);
+ }
+ static void
+@@ -9540,9 +9534,6 @@ ath_newstate(struct ieee80211vap *vap, e
+               ieee80211_state_name[vap->iv_state],
+               ieee80211_state_name[nstate]);
+-      if (!sc->sc_beacon_cal)
+-              del_timer(&sc->sc_cal_ch);              /* periodic calibration timer */
+-
+       ath_hal_setledstate(ah, leds[nstate]);  /* set LED */
+       netif_stop_queue(dev);                  /* before we do anything else */
+@@ -9764,10 +9755,7 @@ ath_newstate(struct ieee80211vap *vap, e
+                               IEEE80211_IS_MODE_DFS_MASTER(vap->iv_opmode)) {
+                       DPRINTF(sc, ATH_DEBUG_STATE | ATH_DEBUG_DOTH, 
+                               "VAP -> DFSWAIT_PENDING \n");
+-                      /* start calibration timer with a really small value 
+-                       * 1/10 sec */
+-                      if (!sc->sc_beacon_cal)
+-                              mod_timer(&sc->sc_cal_ch, jiffies + (HZ/10));
++                      mod_timer(&sc->sc_cal_ch, jiffies + 1);
+                       /* wake the receiver */
+                       netif_wake_queue(dev);
+                       /* don't do the other usual stuff... */
+@@ -9809,12 +9797,6 @@ done:
+       /* Invoke the parent method to complete the work. */
+       error = avp->av_newstate(vap, nstate, arg);
+-      /* Finally, start any timers. */
+-      if (nstate == IEEE80211_S_RUN && !sc->sc_beacon_cal) {
+-              /* start periodic recalibration timer */
+-              mod_timer(&sc->sc_cal_ch, jiffies + (ath_calinterval * HZ));
+-      }
+-
+ #ifdef ATH_SUPERG_XR
+       if (vap->iv_flags & IEEE80211_F_XR &&
+               nstate == IEEE80211_S_RUN)
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -832,7 +832,8 @@ struct ath_softc {
+       struct ieee80211_channel *sc_last_chan;
+       int sc_beacon_cal;                      /* use beacon timer for calibration */
+-      u_int64_t sc_lastcal;                   /* last time the calibration was performed */
++      u_int64_t sc_nextcal;                   /* last time the calibration was performed */
++      int sc_cal_interval;                    /* current calibration interval */
+       struct timer_list sc_cal_ch;            /* calibration timer */
+       HAL_NODE_STATS sc_halstats;             /* station-mode rssi stats */
diff --git a/net/madwifi/patches/451-ibss_race_fix.patch b/net/madwifi/patches/451-ibss_race_fix.patch
new file mode 100644 (file)
index 0000000..8349b31
--- /dev/null
@@ -0,0 +1,342 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -294,10 +294,10 @@ ieee80211_input(struct ieee80211vap * va
+                       break;
+               case IEEE80211_M_IBSS:
+               case IEEE80211_M_AHDEMO:
+-                      if (!IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid) ||
++                      if ((!IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid) ||
+                           (!IEEE80211_ADDR_EQ(wh->i_addr1, vap->iv_myaddr) &&
+-                           !IEEE80211_IS_MULTICAST(wh->i_addr1) &&
+-                           (subtype != IEEE80211_FC0_SUBTYPE_BEACON))) {
++                           !IEEE80211_IS_MULTICAST(wh->i_addr1))) &&
++                           (type == IEEE80211_FC0_TYPE_DATA)) {
+                               if (!(vap->iv_dev->flags & IFF_PROMISC)) {
+                                       IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
+                                               bssid, NULL, "%s", "not to bss");
+@@ -322,22 +322,15 @@ ieee80211_input(struct ieee80211vap * va
+                       }
+                       /* Do not try to find a node reference if the packet really did come from the BSS */
+                       if (type == IEEE80211_FC0_TYPE_DATA && ni == vap->iv_bss &&
+-                                      !IEEE80211_ADDR_EQ(vap->iv_bss->ni_macaddr, wh->i_addr2) &&
+                                       IEEE80211_ADDR_EQ(vap->iv_bssid, wh->i_addr3)) {
+                               /* Try to find sender in local node table. */
+-                              ni = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
++                              if (!ni_or_null) {
++                                      ieee80211_unref_node(&ni);
++                                      ni = ieee80211_find_txnode(vap, wh->i_addr2);
++                              }
+                               if (ni == NULL) {
+-                                      /*
+-                                       * Fake up a node for this newly discovered
+-                                       * member of the IBSS.  This should probably
+-                                       * done after an ACL check.
+-                                       */
+-                                      ni = ieee80211_fakeup_adhoc_node(vap,
+-                                                      wh->i_addr2);
+-                                      if (ni == NULL) {
+-                                              /* NB: stat kept for alloc failure */
+-                                              goto err;
+-                                      }
++                                      /* NB: stat kept for alloc failure */
++                                      goto discard;
+                               }
+                       }
+                       iwspy_event(vap, ni, rssi);
+@@ -3553,8 +3546,8 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                               (((vap->iv_opmode == IEEE80211_M_HOSTAP) ||
+                                (vap->iv_opmode == IEEE80211_M_WDS)) &&
+                               (scan.capinfo & IEEE80211_CAPINFO_ESS))) {
++                      struct ieee80211_node *tni = NULL;
+                       struct ieee80211vap *avp = NULL;
+-                      int do_unref = 0;
+                       int found = 0;
+                       IEEE80211_LOCK_IRQ(vap->iv_ic);
+@@ -3570,14 +3563,12 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                                       }
+                               }
+                               if (found)
+-                                      ni = ni_or_null = avp->iv_wdsnode;
++                                      tni = ieee80211_ref_node(avp->iv_wdsnode);
+                       } else if ((vap->iv_opmode == IEEE80211_M_WDS) && vap->iv_wdsnode) {
+                               found = 1;
+-                              ni = ni_or_null = vap->iv_wdsnode;
+-                      } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
+-                              ni_or_null = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
+-                              if (ni_or_null)
+-                                      ni = ni_or_null;
++                              tni = ieee80211_ref_node(vap->iv_wdsnode);
++                      } else if ((vap->iv_opmode == IEEE80211_M_IBSS) && (vap->iv_state == IEEE80211_S_RUN)) {
++                              tni = ieee80211_find_node(&ic->ic_sta, wh->i_addr2);
+                               found = 1;
+                       }
+                       IEEE80211_UNLOCK_IRQ(vap->iv_ic);
+@@ -3585,20 +3576,21 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                       if (!found)
+                               break;
+-                      if (ni_or_null == NULL) {
++                      memcpy(&SKB_CB(skb)->beacon_tsf, scan.tstamp, sizeof(u_int64_t));
++
++                      if (tni == NULL) {
+                               if (avp) {
+                                       IEEE80211_LOCK_IRQ(ic);
+-                                      ni = ieee80211_add_neighbor(avp, wh, &scan);
++                                      tni = ieee80211_add_neighbor(avp, wh, &scan);
+                                       /* force assoc */
+-                                      ni->ni_associd |= 0xc000;
+-                                      avp->iv_wdsnode = ieee80211_ref_node(ni);
++                                      tni->ni_associd |= 0xc000;
++                                      avp->iv_wdsnode = ieee80211_ref_node(tni);
+                                       IEEE80211_UNLOCK_IRQ(ic);
+                               } else if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
+                                          IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid)) {
+                                       /* Create a new entry in the neighbor table. */
+-                                      ni = ieee80211_add_neighbor(vap, wh, &scan);
++                                      tni = ieee80211_add_neighbor(vap, wh, &scan);
+                               }
+-                              do_unref = 1;
+                       } else {
+                               /*
+                                * Copy data from beacon to neighbor table.
+@@ -3606,39 +3598,38 @@ ieee80211_recv_mgmt(struct ieee80211vap 
+                                * ieee80211_add_neighbor(), so we just copy
+                                * everything over to be safe.
+                                */
+-                              ni->ni_esslen = scan.ssid[1];
+-                              memcpy(ni->ni_essid, scan.ssid + 2, scan.ssid[1]);
+-                              IEEE80211_ADDR_COPY(ni->ni_bssid, wh->i_addr3);
+-                              memcpy(ni->ni_tstamp.data, scan.tstamp,
+-                                      sizeof(ni->ni_tstamp));
+-                              ni->ni_inact = ni->ni_inact_reload;
+-                              ni->ni_intval = 
++                              tni->ni_esslen = scan.ssid[1];
++                              memcpy(tni->ni_essid, scan.ssid + 2, scan.ssid[1]);
++                              IEEE80211_ADDR_COPY(tni->ni_bssid, wh->i_addr3);
++                              memcpy(tni->ni_tstamp.data, scan.tstamp,
++                                      sizeof(tni->ni_tstamp));
++                              tni->ni_inact = tni->ni_inact_reload;
++                              tni->ni_intval =
+                                       IEEE80211_BINTVAL_SANITISE(scan.bintval);
+-                              ni->ni_capinfo = scan.capinfo;
+-                              ni->ni_chan = ic->ic_curchan;
+-                              ni->ni_fhdwell = scan.fhdwell;
+-                              ni->ni_fhindex = scan.fhindex;
+-                              ni->ni_erp = scan.erp;
+-                              ni->ni_timoff = scan.timoff;
++                              tni->ni_capinfo = scan.capinfo;
++                              tni->ni_chan = ic->ic_curchan;
++                              tni->ni_fhdwell = scan.fhdwell;
++                              tni->ni_fhindex = scan.fhindex;
++                              tni->ni_erp = scan.erp;
++                              tni->ni_timoff = scan.timoff;
+                               if (scan.wme != NULL)
+-                                      ieee80211_saveie(&ni->ni_wme_ie, scan.wme);
++                                      ieee80211_saveie(&tni->ni_wme_ie, scan.wme);
+                               if (scan.wpa != NULL)
+-                                      ieee80211_saveie(&ni->ni_wpa_ie, scan.wpa);
++                                      ieee80211_saveie(&tni->ni_wpa_ie, scan.wpa);
+                               if (scan.rsn != NULL)
+-                                      ieee80211_saveie(&ni->ni_rsn_ie, scan.rsn);
++                                      ieee80211_saveie(&tni->ni_rsn_ie, scan.rsn);
+                               if (scan.ath != NULL)
+-                                      ieee80211_saveath(ni, scan.ath);
++                                      ieee80211_saveath(tni, scan.ath);
+                               /* NB: must be after ni_chan is setup */
+-                              ieee80211_setup_rates(ni, scan.rates,
++                              ieee80211_setup_rates(tni, scan.rates,
+                                       scan.xrates, IEEE80211_F_DOSORT);
+                       }
+-                      if (ni != NULL) {
+-                              ni->ni_rssi = rssi;
+-                              ni->ni_rtsf = rtsf;
+-                              ni->ni_last_rx = jiffies;
+-                              if (do_unref)
+-                                      ieee80211_unref_node(&ni);
++                      if (tni != NULL) {
++                              tni->ni_rssi = rssi;
++                              tni->ni_rtsf = rtsf;
++                              tni->ni_last_rx = jiffies;
++                              ieee80211_unref_node(&tni);
+                       }
+               }
+               break;
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -53,6 +53,7 @@
+ #include <net80211/ieee80211_var.h>
+ #include <net80211/if_athproto.h>
++#include <net80211/ieee80211_node.h>
+ /*
+  * Association IDs are managed with a bit vector.
+@@ -317,16 +318,11 @@ ieee80211_create_ibss(struct ieee80211va
+       /* Check to see if we already have a node for this mac
+        * NB: we gain a node reference here
+        */
+-      ni = ieee80211_find_txnode(vap, vap->iv_myaddr);
++      ieee80211_node_table_reset(&ic->ic_sta, vap);
++      ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
+       if (ni == NULL) {
+-              ni = ieee80211_alloc_node_table(vap, vap->iv_myaddr);
+-              IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC,
+-                                "%s: ni:%p allocated for " MAC_FMT "\n",
+-                                __func__, ni, MAC_ADDR(vap->iv_myaddr));
+-              if (ni == NULL) {
+-                      /* XXX recovery? */
+-                      return;
+-              }
++              /* XXX recovery? */
++              return;
+       }
+       IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr);
+@@ -647,7 +643,7 @@ ieee80211_sta_join1(struct ieee80211_nod
+               (vap->iv_state == IEEE80211_S_RUN) && bssid_equal(obss, selbs)); */
+       vap->iv_bss = selbs;
+       IEEE80211_ADDR_COPY(vap->iv_bssid, selbs->ni_bssid);
+-      if (obss != NULL) {
++      if ((obss != NULL) && (obss != selbs)) {
+               if (obss->ni_table)
+                       ieee80211_node_leave(obss);
+               ieee80211_unref_node(&obss);
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -6625,14 +6625,6 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+       sc->sc_recv_mgmt(vap, ni_or_null, skb, subtype, rssi, rtsf);
+-      /* Lookup the new node if any (this grabs a reference to it) */
+-      ni = ieee80211_find_rxnode(vap->iv_ic, vap,
+-               (const struct ieee80211_frame_min *)skb->data);
+-      if (ni == NULL) {
+-              DPRINTF(sc, ATH_DEBUG_BEACON, "Dropping; node unknown.\n");
+-              return;
+-      }
+-
+       switch (subtype) {
+       case IEEE80211_FC0_SUBTYPE_BEACON:
+               /* update RSSI statistics for use by the HAL */
+@@ -6654,11 +6646,9 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+                        * we do the IBSS merging in software. Also do not merge
+                        * if the difference it too small. Otherwise we are playing
+                        * tsf-pingpong with other vendors drivers */
+-                      beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf);
+-                      if (beacon_tsf > rtsf + 0xffff) {
++                      beacon_tsf = le64_to_cpu(SKB_CB(skb)->beacon_tsf);
++                      if (beacon_tsf > rtsf + 0xffff)
+                               ath_hal_settsf64(sc->sc_ah, beacon_tsf - rtsf);
+-                              ieee80211_ibss_merge(ni);
+-                      }
+                       break;
+               }
+               /* NB: Fall Through */
+@@ -6680,13 +6670,21 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+                       hw_tsf = ath_hal_gettsf64(sc->sc_ah);
+                       hw_tu  = hw_tsf >> 10;
+-                      beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf);
++                      beacon_tsf = le64_to_cpu(SKB_CB(skb)->beacon_tsf);
+                       beacon_tu  = beacon_tsf >> 10;
++                      if (!beacon_tsf)
++                              break;
++
++                      if (IEEE80211_ADDR_EQ(wh->i_addr3, vap->iv_bssid))
++                              break;
++
+                       DPRINTF(sc, ATH_DEBUG_BEACON,
+-                                      "Beacon transmitted at %10llx, "
++                                      "Beacon transmitted from "MAC_FMT" ("MAC_FMT") at %10llx, "
+                                       "received at %10llx(%lld), hw TSF "
+                                       "%10llx(%lld)\n",
++                                      MAC_ADDR(wh->i_addr3),
++                                      MAC_ADDR(vap->iv_bssid),
+                                       beacon_tsf,
+                                       rtsf, rtsf - beacon_tsf,
+                                       hw_tsf, hw_tsf - beacon_tsf);
+@@ -6699,39 +6697,13 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+                               do_merge = 1;
+                       }
+-                      /* Check sc_nexttbtt */
+-                      if (sc->sc_nexttbtt < hw_tu) {
+-                              DPRINTF(sc, ATH_DEBUG_BEACON,
+-                                      "sc_nexttbtt (%8x TU) is in the past "
+-                                      "(tsf %8x TU), updating timers\n",
+-                                      sc->sc_nexttbtt, hw_tu);
+-                              do_merge = 1;
+-                      }
+-
+-                      intval = ni->ni_intval & HAL_BEACON_PERIOD;
+-#if 0
+-                      /* This code is disabled since it would produce
+-                       * unwanted merge. For instance, in a two nodes network
+-                       * A & B, A can merge to B and at the same time, B will
+-                       * merge to A, still having a split */
+-                      if (intval != 0) {
+-                              if ((sc->sc_nexttbtt % intval) !=
+-                                              (beacon_tu % intval)) {
+-                                      DPRINTF(sc, ATH_DEBUG_BEACON,
+-                                                      "ibss merge: "
+-                                                      "sc_nexttbtt %10x TU "
+-                                                      "(%3d) beacon %10x TU "
+-                                                      "(%3d)\n",
+-                                                      sc->sc_nexttbtt,
+-                                                      sc->sc_nexttbtt % intval,
+-                                                      beacon_tu,
+-                                                      beacon_tu % intval);
+-                                      do_merge = 1;
+-                              }
+-                      }
+-#endif
+-                      if (do_merge)
++                      if (do_merge) {
++                              /* Lookup the new node if any (this grabs a reference to it) */
++                              ni = ieee80211_find_txnode(vap, wh->i_addr2);
++                              memcpy(ni->ni_bssid, wh->i_addr3, IEEE80211_ADDR_LEN);
+                               ieee80211_ibss_merge(ni);
++                              ieee80211_unref_node(&ni);
++                      }
+                       if ((sc->sc_opmode == HAL_M_IBSS) &&
+                                       ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval))
+@@ -6739,8 +6711,6 @@ ath_recv_mgmt(struct ieee80211vap * vap,
+               }
+               break;
+       }
+-
+-      ieee80211_unref_node(&ni);
+ }
+ static void
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -411,7 +411,7 @@ typedef spinlock_t acl_lock_t;
+  *     8 bytes so we reserve/avoid it.
+  */
+       struct ieee80211_cb {
+-      u_int8_t vlan[8];                       /* reserve for vlan tag info */
++      u_int64_t beacon_tsf;
+       struct ieee80211_node *ni;
+       u_int32_t flags;
+ #define       M_LINK0         0x01                    /* frame needs WEP encryption */
+--- a/net80211/ieee80211_scan_sta.c
++++ b/net80211/ieee80211_scan_sta.c
+@@ -1125,11 +1125,8 @@ adhoc_default_action(struct ieee80211vap
+       u_int8_t zeroMacAddr[IEEE80211_ADDR_LEN];
+       memset(&zeroMacAddr, 0, IEEE80211_ADDR_LEN);
+-      if (IEEE80211_ADDR_EQ(se->se_bssid, &zeroMacAddr[0])) {
+-              ieee80211_create_ibss(vap, se->se_chan);
+-              return 1;
+-      } else
+-              return ieee80211_sta_join(vap, se);
++      ieee80211_create_ibss(vap, se->se_chan);
++      return 1;
+ }
+ static const struct ieee80211_scanner adhoc_default = {
diff --git a/net/madwifi/patches/452-minstrel_no_timer.patch b/net/madwifi/patches/452-minstrel_no_timer.patch
new file mode 100644 (file)
index 0000000..b9b5c9f
--- /dev/null
@@ -0,0 +1,134 @@
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -119,6 +119,7 @@
+ #include "minstrel.h"
+ #define ONE_SECOND (1000 * 1000)  /* 1 second, or 1000 milliseconds; eternity, in other words */
++#define TIMER_INTERVAL 100 /* msecs */
+ #include "release.h"
+@@ -128,9 +129,6 @@ static char *dev_info = "ath_rate_minstr
+ #define STALE_FAILURE_TIMEOUT_MS 10000
+ #define ENABLE_MRR 1
+-static int ath_timer_interval = (1000 / 10); /* every 1/10 second, timer runs */
+-static void ath_timer_function(unsigned long data);
+-
+ /* 10% of the time, send a packet at something other than the optimal rate, which fills
+  * the statistics tables nicely. This percentage is applied to the first packet of the
+  * multi rate retry chain. */
+@@ -142,7 +140,7 @@ static void ath_rate_ctl_reset(struct at
+ /* Calculate the throughput and probability of success for each node
+  * we are talking on, based on the statistics collected during the
+  * last timer period. */
+-static void ath_rate_statistics(void *arg, struct ieee80211_node *ni);
++static void ath_rate_statistics(struct ieee80211_node *ni);
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+@@ -204,6 +202,11 @@ ath_rate_findrate(struct ath_softc *sc, 
+               unsigned int ndx, offset;
+               int mrr;
++
++              if (abs(jiffies - sn->last_update) > msecs_to_jiffies(TIMER_INTERVAL)) {
++                      ath_rate_statistics(&an->an_node);
++                      sn->last_update = jiffies;
++              }
+               if (sn->num_rates <= 0) {
+                           printk(KERN_WARNING "%s: no rates for " MAC_FMT "?\n",
+                                  dev_info,
+@@ -640,54 +643,11 @@ ath_rate_newstate(struct ieee80211vap *v
+               }
+ }
+-static void
+-ath_timer_function(unsigned long data)
+-{
+-              struct minstrel_softc *ssc = (struct minstrel_softc *) data;
+-              struct ath_softc *sc = ssc->sc;
+-              struct ieee80211com *ic;
+-              struct net_device *dev = ssc->sc_dev;
+-              struct timer_list *timer;
+-              unsigned int interval = ath_timer_interval;
+-
+-              if (dev == NULL)
+-                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'dev' is null in this timer \n", __func__);
+-
+-              if (sc == NULL)
+-                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'sc' is null in this timer\n", __func__);
+-
+-              ic = &sc->sc_ic;
+-
+-              if (ssc->close_timer_now)
+-                      return;
+-
+-              if (dev->flags & IFF_RUNNING) {
+-                      sc->sc_stats.ast_rate_calls++;
+-
+-                      if (ic->ic_opmode == IEEE80211_M_STA) {
+-                              struct ieee80211vap *tmpvap;
+-                              TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
+-                                      ath_rate_statistics(sc, tmpvap->iv_bss);/* NB: no reference */
+-                              }
+-                      } else
+-                                  ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_statistics, sc);
+-              }
+-
+-              if (ic->ic_opmode == IEEE80211_M_STA)
+-                      interval = ath_timer_interval >> 1;
+-
+-              timer  = &(ssc->timer);
+-              if (timer == NULL)
+-                      DPRINTF(sc, ATH_DEBUG_RATE, "%s: timer is null - leave it\n", __func__);
+-
+-              timer->expires = jiffies + ((HZ * interval) / 1000);
+-              add_timer(timer);
+-}
+ static void
+-ath_rate_statistics(void *arg, struct ieee80211_node *ni)
++ath_rate_statistics(struct ieee80211_node *ni)
+ {
+-              struct ath_node *an = (struct ath_node *) ni;
++              struct ath_node *an = ATH_NODE(ni);
+               struct ieee80211_rateset *rs = &ni->ni_rates;
+               struct minstrel_node *rn = ATH_NODE_MINSTREL(an);
+               unsigned int i;
+@@ -786,15 +746,8 @@ ath_rate_attach(struct ath_softc *sc)
+               osc->arc.arc_space = sizeof(struct minstrel_node);
+               osc->arc.arc_vap_space = 0;
+-              osc->close_timer_now = 0;
+-              init_timer(&osc->timer);
+       osc->sc          = sc;
+               osc->sc_dev      = sc->sc_dev;
+-              osc->timer.function = ath_timer_function;
+-              osc->timer.data = (unsigned long)osc;
+-
+-              osc->timer.expires = jiffies + HZ;
+-              add_timer(&osc->timer);
+               return &osc->arc;
+ }
+@@ -803,8 +756,6 @@ static void
+ ath_rate_detach(struct ath_ratectrl *arc)
+ {
+       struct minstrel_softc *osc = (struct minstrel_softc *) arc;
+-              osc->close_timer_now = 1;
+-              del_timer(&osc->timer);
+               kfree(osc);
+               _MOD_DEC_USE(THIS_MODULE);
+ }
+--- a/ath_rate/minstrel/minstrel.h
++++ b/ath_rate/minstrel/minstrel.h
+@@ -167,6 +167,8 @@ struct minstrel_node {
+              packet, or a packet at an optimal rate.*/
+       int random_n;
+       int a, b;          /**Coefficients of the random thing */
++
++      unsigned long last_update;
+ };
diff --git a/net/madwifi/patches/453-procps.patch b/net/madwifi/patches/453-procps.patch
new file mode 100644 (file)
index 0000000..5a5633b
--- /dev/null
@@ -0,0 +1,55 @@
+--- a/net80211/ieee80211_linux.h
++++ b/net80211/ieee80211_linux.h
+@@ -640,12 +640,24 @@ static __inline unsigned long msecs_to_j
+         void __user *buffer, size_t *lenp)
+ #define       IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
+       proc_dointvec(ctl, write, filp, buffer, lenp)
+-#else
++#define IEEE80211_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
++        proc_dostring(ctl, write, filp, buffer, lenp)
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
+ #define       IEEE80211_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \
+       f(ctl_table *ctl, int write, struct file *filp, \
+         void __user *buffer, size_t *lenp, loff_t *ppos)
+ #define       IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
+       proc_dointvec(ctl, write, filp, buffer, lenp, ppos)
++#define IEEE80211_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
++        proc_dostring(ctl, write, filp, buffer, lenp, ppos)
++#else /* Linux 2.6.32+ */
++#define       IEEE80211_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \
++      f(ctl_table *ctl, int write, \
++        void __user *buffer, size_t *lenp, loff_t *ppos)
++#define       IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
++      proc_dointvec(ctl, write, buffer, lenp, ppos)
++#define IEEE80211_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
++        proc_dostring(ctl, write, buffer, lenp, ppos)
+ #endif
+ void ieee80211_virtfs_latevattach(struct ieee80211vap *);
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -173,14 +173,22 @@ static inline struct net_device *_alloc_
+       proc_dointvec(ctl, write, filp, buffer, lenp)
+ #define       ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
+       proc_dostring(ctl, write, filp, buffer, lenp)
+-#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) */
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
+ #define       ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \
+       f(ctl_table *ctl, int write, struct file *filp, \
+         void __user *buffer, size_t *lenp, loff_t *ppos)
+ #define       ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
+       proc_dointvec(ctl, write, filp, buffer, lenp, ppos)
++#define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
++        proc_dostring(ctl, write, filp, buffer, lenp, ppos)
++#else /* Linux 2.6.32+ */
++#define       ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \
++      f(ctl_table *ctl, int write, \
++        void __user *buffer, size_t *lenp, loff_t *ppos)
++#define       ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
++      proc_dointvec(ctl, write, buffer, lenp, ppos)
+ #define       ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \
+-      proc_dostring(ctl, write, filp, buffer, lenp, ppos)
++      proc_dostring(ctl, write, buffer, lenp, ppos)
+ #endif
+ #define       ATH_TIMEOUT     1000
diff --git a/net/madwifi/patches/454-cca.patch b/net/madwifi/patches/454-cca.patch
new file mode 100644 (file)
index 0000000..53792cc
--- /dev/null
@@ -0,0 +1,186 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -383,6 +383,8 @@ static void ath_poll_disable(struct net_
+ static void ath_poll_enable(struct net_device *dev);
+ static void ath_fetch_idle_time(struct ath_softc *sc);
+ static void ath_set_timing(struct ath_softc *sc);
++static void ath_update_cca_thresh(struct ath_softc *sc);
++static int ath_hw_read_nf(struct ath_softc *sc);
+ /* calibrate every 30 secs in steady state but check every second at first. */
+ static int ath_calinterval = ATH_SHORT_CALINTERVAL;
+@@ -2623,6 +2625,10 @@ ath_init(struct net_device *dev)
+               goto done;
+       }
++      ath_hal_process_noisefloor(ah);
++      ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
++      ath_update_cca_thresh(sc);
++
+       if (sc->sc_softled)
+               ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
+@@ -3024,6 +3030,10 @@ ath_reset(struct net_device *dev)
+               EPRINTF(sc, "Unable to reset hardware: '%s' (HAL status %u)\n",
+                       ath_get_hal_status_desc(status), status);
++      ath_hal_process_noisefloor(ah);
++      ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
++      ath_update_cca_thresh(sc);
++
+       ath_setintmit(sc);
+       ath_update_txpow(sc);           /* update tx power state */
+       ath_radar_update(sc);
+@@ -9374,9 +9384,11 @@ ath_calibrate(unsigned long arg)
+                       sc->sc_curchan.channel);
+               sc->sc_stats.ast_per_calfail++;
+       }
+-      ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
+       ath_hal_process_noisefloor(ah);
++      ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
++      ath_update_cca_thresh(sc);
++
+       if (isIQdone == AH_TRUE) {
+               /* Unless user has overridden calibration interval,
+                * upgrade to less frequent calibration */
+@@ -9711,8 +9723,6 @@ ath_newstate(struct ieee80211vap *vap, e
+                       break;
+               }
+-              ath_hal_process_noisefloor(ah);
+-              ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
+               /*
+                * Reset rssi stats; maybe not the best place...
+                */
+@@ -10968,6 +10978,7 @@ enum {
+       ATH_INTMIT,
+       ATH_NOISE_IMMUNITY,
+       ATH_OFDM_WEAK_DET,
++      ATH_CCA_THRESH,
+       ATH_CHANBW,
+       ATH_OUTDOOR,
+       ATH_DISTANCE,
+@@ -11110,6 +11121,66 @@ ath_sysctl_get_intmit(struct ath_softc *
+       return 0;
+ }
++#define AR_PHY_CCA              0x9864
++#define AR_PHY_MINCCA_PWR       0x0FF80000
++#define AR_PHY_MINCCA_PWR_S     19
++#define AR_PHY_CCA_THRESH62     0x0007F000
++#define AR_PHY_CCA_THRESH62_S   12
++
++static int
++ath_nf_from_cca(u32 phy_cca)
++{
++      int nf = (phy_cca >> 19) & 0x1ff;
++      nf = -((nf ^ 0x1ff) + 1);
++      return nf;
++}
++
++static int
++ath_hw_read_nf(struct ath_softc *sc)
++{
++      return ath_nf_from_cca(OS_REG_READ(sc->sc_ah, AR_PHY_CCA));
++}
++
++static void
++ath_update_cca_thresh(struct ath_softc *sc)
++{
++      struct ath_hal *ah = sc->sc_ah;
++      int newthr = 0;
++      u32 phy_cca;
++      int nf;
++
++      phy_cca = OS_REG_READ(ah, AR_PHY_CCA);
++      if (sc->sc_cca_thresh < 0) {
++              newthr = sc->sc_cca_thresh - ath_nf_from_cca(phy_cca);
++
++              /* 0xf is a typical eeprom value for thresh62,
++               * use it as minimum for signal based thresholds
++               * to prevent complete connection drops */
++              if (newthr < 0xf)
++                      newthr = 0xf;
++      } else {
++              newthr = sc->sc_cca_thresh;
++      }
++
++      if ((newthr < 4) || (newthr >= 127))
++              return;
++
++      phy_cca &= ~AR_PHY_CCA_THRESH62;
++      phy_cca |= newthr << AR_PHY_CCA_THRESH62_S;
++      OS_REG_WRITE(ah, AR_PHY_CCA, phy_cca);
++}
++
++static int
++ath_get_cca_thresh(struct ath_softc *sc)
++{
++      struct ath_hal *ah = sc->sc_ah;
++      u32 phy_cca;
++
++      phy_cca = OS_REG_READ(ah, AR_PHY_CCA);
++      return ath_nf_from_cca(phy_cca) +
++              ((phy_cca & AR_PHY_CCA_THRESH62) >> AR_PHY_CCA_THRESH62_S);
++}
++
+ static int
+ ATH_SYSCTL_DECL(ath_sysctl_hwinfo, ctl, write, filp, buffer, lenp, ppos)
+ {
+@@ -11356,6 +11427,10 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                       case ATH_OFDM_WEAK_DET:
+                               ret = ath_sysctl_set_intmit(sc, (long)ctl->extra2, val);
+                               break;
++                      case ATH_CCA_THRESH:
++                              sc->sc_cca_thresh = val;
++                              ath_update_cca_thresh(sc);
++                              break;
+                       default:
+                               ret = -EINVAL;
+                               break;
+@@ -11436,6 +11511,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_OFDM_WEAK_DET:
+                       ret = ath_sysctl_get_intmit(sc, (long)ctl->extra2, &val);
+                       break;
++              case ATH_CCA_THRESH:
++                      val = ath_get_cca_thresh(sc);
++                      break;
+               default:
+                       ret = -EINVAL;
+                       break;
+@@ -11667,6 +11745,12 @@ static const ctl_table ath_sysctl_templa
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_OFDM_WEAK_DET,
+       },
++      { .ctl_name     = CTL_AUTO,
++        .procname     = "cca_thresh",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_CCA_THRESH,
++      },
+       { 0 }
+ };
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -844,6 +844,7 @@ struct ath_softc {
+       int sc_cal_interval;                    /* current calibration interval */
+       struct timer_list sc_cal_ch;            /* calibration timer */
+       HAL_NODE_STATS sc_halstats;             /* station-mode rssi stats */
++      int sc_cca_thresh;                              /* configured CCA threshold */
+       struct ctl_table_header *sc_sysctl_header;
+       struct ctl_table *sc_sysctls;
+--- a/ath/ath_wprobe.c
++++ b/ath/ath_wprobe.c
+@@ -133,8 +133,7 @@ ath_wprobe_sync(struct wprobe_iface *dev
+       rx = READ_CLR(ah, AR5K_RXFC);
+       tx = READ_CLR(ah, AR5K_TXFC);
+       OS_REG_WRITE(ah, AR5K_MIBC, 0);
+-      noise = ath_hal_get_channel_noise(sc->sc_ah, &(sc->sc_curchan));
+-      ic->ic_channoise = noise;
++      noise = ath_hw_read_nf(sc);
+       WPROBE_FILL_BEGIN(val, ath_wprobe_globals);
+       if (cc & 0xf0000000) {
diff --git a/net/madwifi/patches/455-beacon_watchdog.patch b/net/madwifi/patches/455-beacon_watchdog.patch
new file mode 100644 (file)
index 0000000..e399564
--- /dev/null
@@ -0,0 +1,95 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -379,6 +379,7 @@ static u_int32_t ath_get_clamped_maxtxpo
+ static u_int32_t ath_set_clamped_maxtxpower(struct ath_softc *sc, 
+               u_int32_t new_clamped_maxtxpower);
++static void ath_bcn_timer(unsigned long arg);
+ static void ath_poll_disable(struct net_device *dev);
+ static void ath_poll_enable(struct net_device *dev);
+ static void ath_fetch_idle_time(struct ath_softc *sc);
+@@ -829,6 +830,10 @@ ath_attach(u_int16_t devid, struct net_d
+       sc->sc_cal_ch.function = ath_calibrate;
+       sc->sc_cal_ch.data = (unsigned long) dev;
++      init_timer(&sc->sc_bcntimer);
++      sc->sc_bcntimer.function = ath_bcn_timer;
++      sc->sc_bcntimer.data = (unsigned long) dev;
++
+       /* initialize DFS related variables */
+       sc->sc_dfswait = 0;
+       sc->sc_dfs_cac = 0;
+@@ -2704,6 +2709,7 @@ ath_stop_locked(struct net_device *dev)
+       DPRINTF(sc, ATH_DEBUG_RESET, "invalid=%u flags=0x%x\n",
+               sc->sc_invalid, dev->flags);
++      del_timer_sync(&sc->sc_bcntimer);
+       if (dev->flags & IFF_RUNNING) {
+               /*
+                * Shutdown the hardware and driver:
+@@ -3006,6 +3012,7 @@ ath_reset(struct net_device *dev)
+       struct ieee80211_channel *c;
+       HAL_STATUS status;
++      del_timer_sync(&sc->sc_bcntimer);
+       /*
+        * XXX: starting the calibration too early seems to lead to
+        * problems with the beacons.
+@@ -5305,6 +5312,7 @@ ath_beacon_send(struct ath_softc *sc, in
+       if (ath_chan_unavail_dbgmsg(sc))
+               return;
++      mod_timer(&sc->sc_bcntimer, jiffies + sc->sc_bcntimer_reload);
+       /*
+        * Check if the previous beacon has gone out.  If
+        * not don't try to post another, skip this period
+@@ -5487,6 +5495,18 @@ ath_beacon_free(struct ath_softc *sc)
+               cleanup_ath_buf(sc, bf, BUS_DMA_TODEVICE);
+ }
++static void ath_bcn_timer(unsigned long arg)
++{
++      struct net_device *dev = (struct net_device *)arg;
++      struct ath_softc *sc = netdev_priv(dev);
++      struct ath_hal *ah = sc->sc_ah;
++
++      if (!sc->sc_beacons)
++              return;
++
++      ath_reset(dev);
++}
++
+ /*
+  * Configure the beacon and sleep timers.
+  *
+@@ -5523,6 +5543,7 @@ ath_beacon_config(struct ath_softc *sc, 
+       if (vap == NULL)
+               vap = TAILQ_FIRST(&ic->ic_vaps);   /* XXX */
++      del_timer_sync(&sc->sc_bcntimer);
+       ni = vap->iv_bss;
+       /* TSF calculation is timing critical - we don't want to be interrupted here */
+@@ -5699,6 +5720,9 @@ ath_beacon_config(struct ath_softc *sc, 
+                       sc->sc_imask |= HAL_INT_SWBA;
+                       ath_set_beacon_cal(sc, 1);
+                       ath_beaconq_config(sc);
++
++                      sc->sc_bcntimer_reload = msecs_to_jiffies(10 * (intval & HAL_BEACON_PERIOD));
++                      mod_timer(&sc->sc_bcntimer, jiffies + sc->sc_bcntimer_reload);
+               } else
+                       ath_set_beacon_cal(sc, 0);
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -789,6 +789,10 @@ struct ath_softc {
+       u_int16_t sc_ledoff;                    /* off time for current blink */
+       struct timer_list sc_ledtimer;          /* led off timer */
++      /* beacon watchdog timer */
++      u_int32_t sc_bcntimer_reload;
++      struct timer_list sc_bcntimer;
++
+       struct ATH_TQ_STRUCT sc_fataltq;        /* fatal error intr tasklet */
+       int sc_rxbufsize;                       /* rx size based on mtu */
diff --git a/net/madwifi/patches/456-rfsilent.patch b/net/madwifi/patches/456-rfsilent.patch
new file mode 100644 (file)
index 0000000..21031e7
--- /dev/null
@@ -0,0 +1,85 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2996,6 +2996,19 @@ ath_fetch_idle_time(struct ath_softc *sc
+ #undef AR5K_RXCLEAR
+ #undef AR5K_CYCLES
++static void
++ath_set_silent(struct ath_softc *sc)
++{
++      struct ath_hal *ah = sc->sc_ah;
++
++      if (!sc->sc_silent)
++              return;
++
++      del_timer_sync(&sc->sc_bcntimer);
++      ath_hal_intrset(ah, 0);
++      OS_REG_WRITE(ah, 0x8048, 0x60); /* set tx loopback and rx disable */
++}
++
+ /*
+  * Reset the hardware w/o losing operational state.  This is
+  * basically a more efficient way of doing ath_stop, ath_init,
+@@ -3073,6 +3086,7 @@ ath_reset(struct net_device *dev)
+               ath_grppoll_start(vap, sc->sc_xrpollcount);
+       }
+ #endif
++      ath_set_silent(sc);
+       return 0;
+ }
+@@ -10972,6 +10986,7 @@ enum {
+  * mirrored in /proc/sys.
+  */
+ enum {
++      ATH_SILENT,
+       ATH_SLOTTIME,
+       ATH_ACKTIMEOUT,
+       ATH_CTSTIMEOUT,
+@@ -11294,6 +11309,13 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+                                       sc->sc_ctstimeconf = 0;
+                               ath_set_timing(sc);
+                               break;
++                      case ATH_SILENT:
++                              sc->sc_silent = !!val;
++                              if (val)
++                                      ath_set_silent(sc);
++                              else
++                                      ath_reset(sc->sc_dev);
++                              break;
+                       case ATH_DISTANCE:
+                               if (val > 0) {
+                                       sc->sc_coverage = ((val - 1) / 300) + 1;
+@@ -11477,6 +11499,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+               case ATH_CTSTIMEOUT:
+                       val = ath_hal_getctstimeout(ah);
+                       break;
++              case ATH_SILENT:
++                      val = sc->sc_silent;
++                      break;
+               case ATH_SOFTLED:
+                       val = sc->sc_softled;
+                       break;
+@@ -11598,6 +11623,12 @@ static const ctl_table ath_sysctl_templa
+         .extra2       = (void *)ATH_DISTANCE,
+       },
+       { .ctl_name     = CTL_AUTO,
++        .procname     = "silent",
++        .mode         = 0644,
++        .proc_handler = ath_sysctl_halparam,
++        .extra2       = (void *)ATH_SILENT,
++      },
++      { .ctl_name     = CTL_AUTO,
+         .procname     = "softled",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -737,6 +737,7 @@ struct ath_softc {
+                                                * 'channel availability check' indefinately,
+                                                * reporting radar and interference detections.
+                                                */
++      unsigned int    sc_silent:1;    /* Turn RF silent */
+       unsigned int sc_txcont_power; /* Continuous transmit power in 0.5dBm units */
+       unsigned int sc_txcont_rate;  /* Continuous transmit rate in Mbps */
diff --git a/net/madwifi/patches/457-idletime.patch b/net/madwifi/patches/457-idletime.patch
new file mode 100644 (file)
index 0000000..429da85
--- /dev/null
@@ -0,0 +1,151 @@
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -355,6 +355,8 @@ ieee80211_ifattach(struct ieee80211com *
+       /* Arbitrarily pick the first channel */
+       ic->ic_curchan = &ic->ic_channels[0];
++      ic->ic_inact_tick = IEEE80211_INACT_WAIT;
++
+       /* Enable marking of dfs by default */
+       ic->ic_flags_ext |= IEEE80211_FEXT_MARKDFS;
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -350,6 +350,7 @@ struct ieee80211com {
+       u_int8_t ic_protmode_rssi;                      /* rssi threshold for protection mode */
+       u_int64_t ic_protmode_lasttrig;         /* last trigger for protection mode */
+       u_int16_t ic_protmode_timeout;          /* protection mode timeout */
++      u_int16_t ic_inact_tick;                        /* inact timer tick interval (seconds) */
+       /* Channel state:
+        *
+--- a/net80211/ieee80211_ioctl.h
++++ b/net80211/ieee80211_ioctl.h
+@@ -591,6 +591,7 @@ enum {
+       IEEE80211_PARAM_INACT_AUTH              = 24,   /* station auth inact timeout */
+       IEEE80211_PARAM_INACT_INIT              = 25,   /* station init inact timeout */
+       IEEE80211_PARAM_ABOLT                   = 26,   /* Atheros Adv. Capabilities */
++      IEEE80211_PARAM_INACT_TICK              = 27,   /* station inactivity timer tick (seconds) */
+       IEEE80211_PARAM_DTIM_PERIOD             = 28,   /* DTIM period (beacons) */
+       IEEE80211_PARAM_BEACON_INTERVAL         = 29,   /* beacon interval (ms) */
+       IEEE80211_PARAM_DOTH                    = 30,   /* 11.h is on/off */
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -2504,13 +2504,18 @@ ieee80211_ioctl_setparam(struct net_devi
+                       vap->iv_flags &= ~IEEE80211_F_NOBRIDGE;
+               break;
+       case IEEE80211_PARAM_INACT:
+-              vap->iv_inact_run = value / IEEE80211_INACT_WAIT;
++              vap->iv_inact_run = value / ic->ic_inact_tick;
++              break;
++      case IEEE80211_PARAM_INACT_TICK:
++              if (value <= 0)
++                      return -EINVAL;
++              ic->ic_inact_tick = value;
+               break;
+       case IEEE80211_PARAM_INACT_AUTH:
+-              vap->iv_inact_auth = value / IEEE80211_INACT_WAIT;
++              vap->iv_inact_auth = value / ic->ic_inact_tick;
+               break;
+       case IEEE80211_PARAM_INACT_INIT:
+-              vap->iv_inact_init = value / IEEE80211_INACT_WAIT;
++              vap->iv_inact_init = value / ic->ic_inact_tick;
+               break;
+       case IEEE80211_PARAM_ABOLT:
+               caps = 0;
+@@ -3050,13 +3055,16 @@ ieee80211_ioctl_getparam(struct net_devi
+               param[0] = (vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0;
+               break;
+       case IEEE80211_PARAM_INACT:
+-              param[0] = vap->iv_inact_run * IEEE80211_INACT_WAIT;
++              param[0] = vap->iv_inact_run * ic->ic_inact_tick;
+               break;
+       case IEEE80211_PARAM_INACT_AUTH:
+-              param[0] = vap->iv_inact_auth * IEEE80211_INACT_WAIT;
++              param[0] = vap->iv_inact_auth * ic->ic_inact_tick;
+               break;
+       case IEEE80211_PARAM_INACT_INIT:
+-              param[0] = vap->iv_inact_init * IEEE80211_INACT_WAIT;
++              param[0] = vap->iv_inact_init * ic->ic_inact_tick;
++              break;
++      case IEEE80211_PARAM_INACT_TICK:
++              param[0] = ic->ic_inact_tick;
+               break;
+       case IEEE80211_PARAM_ABOLT:
+               /*
+@@ -4557,14 +4565,7 @@ get_sta_info(void *arg, struct ieee80211
+               si->isi_opmode = IEEE80211_STA_OPMODE_XR;
+       else
+               si->isi_opmode = IEEE80211_STA_OPMODE_NORMAL;
+-      /* NB: leave all cases in case we relax ni_associd == 0 check */
+-      if (ieee80211_node_is_authorized(ni))
+-              si->isi_inact = vap->iv_inact_run;
+-      else if (ni->ni_associd != 0)
+-              si->isi_inact = vap->iv_inact_auth;
+-      else
+-              si->isi_inact = vap->iv_inact_init;
+-      si->isi_inact = (si->isi_inact - ni->ni_inact) * IEEE80211_INACT_WAIT;
++      si->isi_inact = (ni->ni_inact_reload - ni->ni_inact) * ic->ic_inact_tick;
+       cp = (u_int8_t *)(si+1);
+       if (ni->ni_rsn_ie != NULL) {
+@@ -5597,6 +5598,10 @@ static const struct iw_priv_args ieee802
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "inact_init" },
+       { IEEE80211_PARAM_INACT_INIT,
+         0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_inact_init" },
++      { IEEE80211_PARAM_INACT_TICK,
++        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "inact_tick" },
++      { IEEE80211_PARAM_INACT_TICK,
++        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_inact_tick" },
+       { IEEE80211_PARAM_ABOLT,
+         IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "abolt" },
+       { IEEE80211_PARAM_ABOLT,
+--- a/net80211/ieee80211_node.c
++++ b/net80211/ieee80211_node.c
+@@ -137,7 +137,7 @@ ieee80211_node_attach(struct ieee80211co
+       init_timer(&ic->ic_inact);
+       ic->ic_inact.function = ieee80211_node_timeout;
+       ic->ic_inact.data = (unsigned long) ic;
+-      ic->ic_inact.expires = jiffies + IEEE80211_INACT_WAIT * HZ;
++      ic->ic_inact.expires = jiffies + ic->ic_inact_tick * HZ;
+       add_timer(&ic->ic_inact);
+ #ifdef IEEE80211_DEBUG_REFCNT
+@@ -261,7 +261,7 @@ void
+ ieee80211_node_authorize(struct ieee80211_node *ni)
+ {
+       ni->ni_flags |= IEEE80211_NODE_AUTH;
+-      ni->ni_inact_reload = ni->ni_vap->iv_inact_run;
++      ni->ni_inact = ni->ni_inact_reload = ni->ni_vap->iv_inact_run;
+ }
+ EXPORT_SYMBOL(ieee80211_node_authorize);
+@@ -1819,7 +1819,7 @@ ieee80211_node_timeout(unsigned long arg
+               }
+       }
+-      ic->ic_inact.expires = jiffies + IEEE80211_INACT_WAIT * HZ;
++      ic->ic_inact.expires = jiffies + ic->ic_inact_tick * HZ;
+       add_timer(&ic->ic_inact);
+ }
+--- a/net80211/ieee80211_power.c
++++ b/net80211/ieee80211_power.c
+@@ -148,7 +148,7 @@ ieee80211_node_saveq_age(struct ieee8021
+               IEEE80211_NODE_SAVEQ_LOCK_IRQ(ni);
+               while ((skb = skb_peek(&ni->ni_savedq)) != NULL &&
+-                   M_AGE_GET(skb) < IEEE80211_INACT_WAIT) {
++                   M_AGE_GET(skb) <  ni->ni_vap->iv_ic->ic_inact_tick) {
+                       IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
+                               "discard frame, age %u", M_AGE_GET(skb));
+@@ -159,7 +159,7 @@ ieee80211_node_saveq_age(struct ieee8021
+                       discard++;
+               }
+               if (skb != NULL)
+-                      M_AGE_SUB(skb, IEEE80211_INACT_WAIT);
++                      M_AGE_SUB(skb, ni->ni_vap->iv_ic->ic_inact_tick);
+               IEEE80211_NODE_SAVEQ_UNLOCK_IRQ(ni);
+               IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
diff --git a/net/madwifi/patches/458-ibss_wpa_none.patch b/net/madwifi/patches/458-ibss_wpa_none.patch
new file mode 100644 (file)
index 0000000..df77510
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/net80211/ieee80211_crypto_ccmp.c
++++ b/net80211/ieee80211_crypto_ccmp.c
+@@ -273,7 +273,9 @@ ccmp_decap(struct ieee80211_key *k, stru
+               tid = ((struct ieee80211_qosframe *)wh)->i_qos[0] & IEEE80211_QOS_TID;
+       /* NB: assume IEEE80211_WEP_MINLEN covers the extended IV */
+       pn = READ_6(ivp[0], ivp[1], ivp[4], ivp[5], ivp[6], ivp[7]);
+-      if (pn && pn <= k->wk_keyrsc[tid]) {
++      if ((vap->iv_opmode != IEEE80211_M_IBSS) &&
++          (vap->iv_opmode != IEEE80211_M_AHDEMO) &&
++          (pn && pn <= k->wk_keyrsc[tid])) {
+               /*
+                * Replay violation.
+                */
diff --git a/net/madwifi/patches/459-2.6.33_compile.patch b/net/madwifi/patches/459-2.6.33_compile.patch
new file mode 100644 (file)
index 0000000..e3b94b1
--- /dev/null
@@ -0,0 +1,524 @@
+--- a/kernelversion.c
++++ b/kernelversion.c
+@@ -10,7 +10,11 @@
+ /* Linux 2.6.18+ uses <linux/utsrelease.h> */
+ #ifndef UTS_RELEASE
+-#include <linux/utsrelease.h>
++  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++    #include <generated/utsrelease.h>
++  #else
++    #include <linux/utsrelease.h>
++  #endif
+ #endif
+ char *uts_release = UTS_RELEASE;
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -11580,227 +11580,231 @@ static int mincalibrate = 1;               /* once a 
+ static int maxint = 0x7fffffff;               /* 32-bit big */
+ static const ctl_table ath_sysctl_template[] = {
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "dev_vendor",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_hwinfo,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+         .strategy   = &sysctl_string,
++#endif
+         .data         = "N/A",
+         .maxlen   = 1,
+         .extra2       = (void *)ATH_CARD_VENDOR,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "dev_name",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_hwinfo,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+         .strategy   = &sysctl_string,
++#endif
+         .data         = "N/A",
+         .maxlen   = 1,
+         .extra2       = (void *)ATH_CARD_NAME,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "slottime",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_SLOTTIME,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "acktimeout",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_ACKTIMEOUT,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "ctstimeout",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_CTSTIMEOUT,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "distance",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_DISTANCE,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "silent",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_SILENT,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "softled",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_SOFTLED,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "ledpin",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_LEDPIN,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "countrycode",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_COUNTRYCODE,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "outdoor",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_OUTDOOR,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "regdomain",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_REGDOMAIN,
+       },
+ #ifdef AR_DEBUG
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "debug",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_DEBUG,
+       },
+ #endif
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "poweroffset",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_POWEROFFSET,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "txantenna",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_TXANTENNA,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "rxantenna",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RXANTENNA,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "diversity",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_DIVERSITY,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "txintrperiod",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_TXINTRPERIOD,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "fftxqmin",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_FFTXQMIN,
+       },
+ #ifdef ATH_SUPERG_XR
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "xrpollperiod",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_XR_POLL_PERIOD,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "xrpollcount",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_XR_POLL_COUNT,
+       },
+ #endif
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "ackrate",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_ACKRATE,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "channelbw",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_CHANBW,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "rp",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "radar_print",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP_PRINT,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "radar_print_all",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP_PRINT_ALL,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "radar_dump",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP_PRINT_MEM,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "radar_dump_all",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP_PRINT_MEM_ALL,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "rp_flush",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP_FLUSH,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "panic",
+         .mode         = 0200,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_PANIC,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "rp_ignored",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RP_IGNORED,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "radar_ignored",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_RADAR_IGNORED,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "intmit",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_INTMIT,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "noise_immunity",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_NOISE_IMMUNITY,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "ofdm_weak_det",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+         .extra2       = (void *)ATH_OFDM_WEAK_DET,
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "cca_thresh",
+         .mode         = 0644,
+         .proc_handler = ath_sysctl_halparam,
+@@ -11838,12 +11842,16 @@ ath_dynamic_sysctl_register(struct ath_s
+       /* setup the table */
+       memset(sc->sc_sysctls, 0, space);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+       sc->sc_sysctls[0].ctl_name = CTL_DEV;
++#endif
+       sc->sc_sysctls[0].procname = "dev";
+       sc->sc_sysctls[0].mode = 0555;
+       sc->sc_sysctls[0].child = &sc->sc_sysctls[2];
+       /* [1] is NULL terminator */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+       sc->sc_sysctls[2].ctl_name = CTL_AUTO;
++#endif
+       sc->sc_sysctls[2].procname = dev_name;
+       sc->sc_sysctls[2].mode = 0555;
+       sc->sc_sysctls[2].child = &sc->sc_sysctls[4];
+@@ -11966,7 +11974,7 @@ ath_announce(struct net_device *dev)
+  */
+ static ctl_table ath_static_sysctls[] = {
+ #ifdef AR_DEBUG
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "debug",
+         .mode         = 0644,
+         .data         = &ath_debug,
+@@ -11974,14 +11982,14 @@ static ctl_table ath_static_sysctls[] = 
+         .proc_handler = proc_dointvec
+       },
+ #endif
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "xchanmode",
+         .mode         = 0444,
+         .data         = &ath_xchanmode,
+         .maxlen       = sizeof(ath_xchanmode),
+         .proc_handler = proc_dointvec
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "calibrate",
+         .mode         = 0644,
+         .data         = &ath_calinterval,
+@@ -11993,14 +12001,14 @@ static ctl_table ath_static_sysctls[] = 
+       { 0 }
+ };
+ static ctl_table ath_ath_table[] = {
+-      { .ctl_name     = DEV_ATH,
++      { CTLNAME(DEV_ATH)
+         .procname     = "ath",
+         .mode         = 0555,
+         .child        = ath_static_sysctls
+       }, { 0 }
+ };
+ static ctl_table ath_root_table[] = {
+-      { .ctl_name     = CTL_DEV,
++      { CTLNAME(CTL_DEV)
+         .procname     = "dev",
+         .mode         = 0555,
+         .child        = ath_ath_table
+--- a/ath/if_ath_ahb.h
++++ b/ath/if_ath_ahb.h
+@@ -112,7 +112,11 @@
+       do { (void) (start); (void) (size); } while (0)
+ #endif
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
++#define bus_dma_sync_single   dma_sync_single_for_cpu
++#else
+ #define bus_dma_sync_single   dma_sync_single
++#endif
+ #define bus_map_single                dma_map_single
+ #define bus_unmap_single      dma_unmap_single
+ #define bus_alloc_consistent(_hwdev, _sz, _hdma)              \
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
+@@ -518,7 +518,7 @@ EXPORT_SYMBOL(ath_hal_memcmp);
+ static ctl_table ath_hal_sysctls[] = {
+ #ifdef AH_DEBUG
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "debug",
+         .mode         = 0644,
+         .data         = &ath_hal_debug,
+@@ -526,21 +526,21 @@ static ctl_table ath_hal_sysctls[] = {
+         .proc_handler = proc_dointvec
+       },
+ #endif
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "dma_beacon_response_time",
+         .data         = &ath_hal_dma_beacon_response_time,
+         .maxlen       = sizeof(ath_hal_dma_beacon_response_time),
+         .mode         = 0644,
+         .proc_handler = proc_dointvec
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "sw_beacon_response_time",
+         .mode         = 0644,
+         .data         = &ath_hal_sw_beacon_response_time,
+         .maxlen       = sizeof(ath_hal_sw_beacon_response_time),
+         .proc_handler = proc_dointvec
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "swba_backoff",
+         .mode         = 0644,
+         .data         = &ath_hal_additional_swba_backoff,
+@@ -548,19 +548,19 @@ static ctl_table ath_hal_sysctls[] = {
+         .proc_handler = proc_dointvec
+       },
+ #ifdef AH_DEBUG_ALQ
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "alq",
+         .mode         = 0644,
+         .proc_handler = sysctl_hw_ath_hal_log
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "alq_size",
+         .mode         = 0644,
+         .data         = &ath_hal_alq_qsize,
+         .maxlen       = sizeof(ath_hal_alq_qsize),
+         .proc_handler = proc_dointvec
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "alq_lost",
+         .mode         = 0644,
+         .data         = &ath_hal_alq_lost,
+@@ -571,21 +571,21 @@ static ctl_table ath_hal_sysctls[] = {
+       { 0 }
+ };
+ static ctl_table ath_hal_table[] = {
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "hal",
+         .mode         = 0555,
+         .child        = ath_hal_sysctls
+       }, { 0 }
+ };
+ static ctl_table ath_ath_table[] = {
+-      { .ctl_name     = DEV_ATH,
++      { CTLNAME(DEV_ATH)
+         .procname     = "ath",
+         .mode         = 0555,
+         .child        = ath_hal_table
+       }, { 0 }
+ };
+ static ctl_table ath_root_table[] = {
+-      { .ctl_name     = CTL_DEV,
++      { CTLNAME(CTL_DEV)
+         .procname     = "dev",
+         .mode         = 0555,
+         .child        = ath_ath_table
+--- a/include/compat.h
++++ b/include/compat.h
+@@ -193,6 +193,12 @@ static inline int timeval_compare(struct
+ #define __skb_queue_after(_list, _old, _new)  __skb_append(_old, _new, _list)
+ #endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
++#define CTLNAME(x)    .ctl_name       = x,
++#else
++#define CTLNAME(x)
++#endif
++
+ #endif /* __KERNEL__ */
+ #endif /* _ATH_COMPAT_H_ */
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -699,39 +699,39 @@ IEEE80211_SYSCTL_DECL(ieee80211_sysctl_m
+ static const ctl_table ieee80211_sysctl_template[] = {
+ #ifdef IEEE80211_DEBUG
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "debug",
+         .mode         = 0644,
+         .proc_handler = ieee80211_sysctl_debug
+       },
+ #endif
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "dev_type",
+         .mode         = 0644,
+         .proc_handler = ieee80211_sysctl_dev_type
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "monitor_nods_only",
+         .mode         = 0644,
+         .proc_handler = ieee80211_sysctl_monitor_nods_only
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "monitor_txf_len",
+         .mode         = 0644,
+         .proc_handler = ieee80211_sysctl_monitor_txf_len
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "monitor_phy_errors",
+         .mode         = 0644,
+         .proc_handler = ieee80211_sysctl_monitor_phy_errors
+       },
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "monitor_crc_errors",
+         .mode         = 0644,
+         .proc_handler = ieee80211_sysctl_monitor_crc_errors
+       },
+       /* NB: must be last entry before NULL */
+-      { .ctl_name     = CTL_AUTO,
++      { CTLNAME(CTL_AUTO)
+         .procname     = "%parent",
+         .maxlen       = IFNAMSIZ,
+         .mode         = 0444,
+@@ -786,12 +786,16 @@ ieee80211_virtfs_latevattach(struct ieee
+       /* setup the table */
+       memset(vap->iv_sysctls, 0, space);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+       vap->iv_sysctls[0].ctl_name = CTL_NET;
++#endif
+       vap->iv_sysctls[0].procname = "net";
+       vap->iv_sysctls[0].mode = 0555;
+       vap->iv_sysctls[0].child = &vap->iv_sysctls[2];
+       /* [1] is NULL terminator */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+       vap->iv_sysctls[2].ctl_name = CTL_AUTO;
++#endif
+       vap->iv_sysctls[2].procname = devname; /* XXX bad idea? */
+       vap->iv_sysctls[2].mode = 0555;
+       vap->iv_sysctls[2].child = &vap->iv_sysctls[4];
diff --git a/net/madwifi/patches/460-pci_softled_disable.patch b/net/madwifi/patches/460-pci_softled_disable.patch
new file mode 100644 (file)
index 0000000..1c0ec94
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -266,6 +266,7 @@ ath_pci_probe(struct pci_dev *pdev, cons
+               }
+       }
++#if 0
+       /*
+        * Auto-enable soft led processing for IBM cards and for
+        * 5211 minipci cards.  Users can also manually enable/disable
+@@ -281,6 +282,7 @@ ath_pci_probe(struct pci_dev *pdev, cons
+               sc->aps_sc.sc_softled = 1;
+               sc->aps_sc.sc_ledpin = 1;
+       }
++#endif
+       if ((i = ath_attach(vdevice, dev, NULL)) != 0) {
+               printk(KERN_ERR "%s: ath_attach failed: %d\n", dev_info, i);
diff --git a/net/madwifi/patches/461-rx_stats_count_fix.patch b/net/madwifi/patches/461-rx_stats_count_fix.patch
new file mode 100644 (file)
index 0000000..4b5ce28
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -202,7 +202,6 @@ ieee80211_input(struct ieee80211vap * va
+       struct ieee80211com *ic;
+       struct net_device *dev;
+       struct ieee80211_node *ni_wds = NULL;
+-      struct net_device_stats *stats;
+       struct ieee80211_frame *wh;
+       struct ieee80211_key *key;
+       struct ether_header *eh;
+@@ -685,12 +684,6 @@ ieee80211_input(struct ieee80211vap * va
+               if (! accept_data_frame(vap, ni, key, skb, eh))
+                       goto out;
+-              if (ni->ni_subif && ((eh)->ether_type != __constant_htons(ETHERTYPE_PAE)))
+-                      stats = &ni->ni_subif->iv_devstats;
+-              else
+-                      stats = &vap->iv_devstats;
+-              stats->rx_packets++;
+-              stats->rx_bytes += skb->len;
+               IEEE80211_NODE_STAT(ni, rx_data);
+               IEEE80211_NODE_STAT_ADD(ni, rx_bytes, skb->len);
+               ic->ic_lastdata = jiffies;
diff --git a/net/madwifi/patches/462-fix_ap_scan.patch b/net/madwifi/patches/462-fix_ap_scan.patch
new file mode 100644 (file)
index 0000000..8a14f5b
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/net80211/ieee80211_scan_ap.c
++++ b/net80211/ieee80211_scan_ap.c
+@@ -595,6 +595,14 @@ ap_end(struct ieee80211_scan_state *ss, 
+       ic = vap->iv_ic;
++      /* if we're already running, switch back to the home channel */
++      if ((vap->iv_state == IEEE80211_S_RUN) &&
++          (ic->ic_bsschan != IEEE80211_CHAN_ANYC)) {
++              ic->ic_curchan = ic->ic_bsschan;
++              ic->ic_set_channel(ic);
++              goto out;
++      }
++
+       /* record stats for the channel that was scanned last */
+       ic->ic_set_channel(ic);
+       spin_lock_irqsave(&channel_lock, sflags);
+@@ -648,6 +656,8 @@ ap_end(struct ieee80211_scan_state *ss, 
+               IEEE80211_SCHEDULE_TQUEUE(&as->as_actiontq);
+               res = 1;
+       }
++
++out:
+       SCAN_AP_UNLOCK_IRQ(as);
+       return res;
+ }
diff --git a/net/madwifi/patches/463-fix_txrate_display.patch b/net/madwifi/patches/463-fix_txrate_display.patch
new file mode 100644 (file)
index 0000000..0889f78
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -728,6 +728,7 @@ ath_rate_statistics(struct ieee80211_nod
+               rn->max_tp_rate2  = index_max_tp2;
+               rn->max_prob_rate = index_max_prob;
+               rn->current_rate  = index_max_tp;
++              ni->ni_txrate = index_max_tp;
+ }
+ static struct ath_ratectrl *
diff --git a/net/madwifi/patches/464-0dbm_txpower_fix.patch b/net/madwifi/patches/464-0dbm_txpower_fix.patch
new file mode 100644 (file)
index 0000000..fbd1d76
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -1370,15 +1370,9 @@ ieee80211_ioctl_siwtxpow(struct net_devi
+       int fixed, disabled;
+       fixed = (ic->ic_flags & IEEE80211_F_TXPOW_FIXED);
+-      disabled = (fixed && ic->ic_txpowlimit == 0);
+-      if (rrq->disabled) {
+-              if (!disabled) {
+-                      ic->ic_flags |= IEEE80211_F_TXPOW_FIXED;
+-                      ic->ic_txpowlimit = 0;
+-                      goto done;
+-              }
+-              return 0;
+-      }
++
++      if (rrq->disabled)
++              return -EINVAL;
+       if (rrq->fixed) {
+               if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0)
+@@ -1571,7 +1565,7 @@ ieee80211_ioctl_giwtxpow(struct net_devi
+               rrq->fixed = 0;
+       }
+       rrq->value = txp / 2;
+-      rrq->disabled = (rrq->fixed && rrq->value == 0);
++      rrq->disabled = 0;
+       rrq->flags = IW_TXPOW_DBM;
+       return 0;
+ }
diff --git a/net/madwifi/patches/465-mc_list-2.6.35.patch b/net/madwifi/patches/465-mc_list-2.6.35.patch
new file mode 100644 (file)
index 0000000..4931cfb
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -4466,7 +4466,11 @@ ath_merge_mcast(struct ath_softc *sc, u_
+ {
+       struct ieee80211com *ic = &sc->sc_ic;
+       struct ieee80211vap *vap;
++      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) 
++      struct netdev_hw_addr *ha; 
++      #else
+       struct dev_mc_list *mc;
++      #endif
+       u_int32_t val;
+       u_int8_t pos;
+@@ -4474,6 +4478,17 @@ ath_merge_mcast(struct ath_softc *sc, u_
+       /* XXX locking */
+       TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+               struct net_device *dev = vap->iv_dev;
++              #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
++              netdev_for_each_mc_addr(ha, dev) { 
++                      /* calculate XOR of eight 6-bit values */
++                      val = LE_READ_4(ha->addr + 0);
++                      pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
++                      val = LE_READ_4(ha->addr + 3);
++                      pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
++                      pos &= 0x3f;
++                      mfilt[pos / 32] |= (1 << (pos % 32));
++              }
++              #else
+               for (mc = dev->mc_list; mc; mc = mc->next) {
+                       /* calculate XOR of eight 6-bit values */
+                       val = LE_READ_4(mc->dmi_addr + 0);
+@@ -4483,6 +4498,7 @@ ath_merge_mcast(struct ath_softc *sc, u_
+                       pos &= 0x3f;
+                       mfilt[pos / 32] |= (1 << (pos % 32));
+               }
++              #endif 
+       }
+ }
diff --git a/net/madwifi/patches/466-2.6.38_compile.patch b/net/madwifi/patches/466-2.6.38_compile.patch
new file mode 100644 (file)
index 0000000..10a6f0d
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/include/compat.h
++++ b/include/compat.h
+@@ -131,6 +131,11 @@
+ #ifdef __KERNEL__
+ #include <linux/version.h>
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++#define AUTOCONF_INCLUDED 1
++#endif
++
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
+ #define ATH_REGISTER_SYSCTL_TABLE(t) register_sysctl_table(t, 1)
+ #else
diff --git a/net/madwifi/patches/470-mac_addresss_from_ath5k_platform_data.patch b/net/madwifi/patches/470-mac_addresss_from_ath5k_platform_data.patch
new file mode 100644 (file)
index 0000000..0c35050
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -63,6 +63,8 @@
+ #include <linux/rtnetlink.h>
+ #include <linux/time.h>
+ #include <linux/pci.h>
++#include <linux/device.h>
++#include <linux/ath5k_platform.h>
+ #include <asm/uaccess.h>
+ #include "if_ethersubr.h"             /* for ETHER_IS_MULTICAST */
+@@ -587,6 +589,10 @@ ath_attach(u_int16_t devid, struct net_d
+       unsigned int i;
+       int autocreatemode = -1;
+       u_int8_t csz;
++#ifdef ATH_PCI
++      struct ath5k_platform_data *pdata;
++      struct pci_dev *pdev;
++#endif
+       sc->devid = devid;
+ #ifdef AR_DEBUG
+@@ -648,6 +654,13 @@ ath_attach(u_int16_t devid, struct net_d
+       }
+       sc->sc_ah = ah;
++#ifdef ATH_PCI
++      /* set MAC from ath_platform_data */
++      pdev = (struct pci_dev *)sc->sc_bdev;
++      pdata = pdev->dev.platform_data;
++      if (pdata && pdata->macaddr)
++              ath_hal_setmac(ah, pdata->macaddr);
++#endif
+       /* WAR for AR7100 PCI bug */
+ #if defined(CONFIG_ATHEROS_AR71XX) || defined(CONFIG_ATH79)
+       if ((ar_device(sc->devid) >= 5210) && (ar_device(sc->devid) < 5416)) {
diff --git a/net/madwifi/patches/471-netdev_ops_mac_mtu.patch b/net/madwifi/patches/471-netdev_ops_mac_mtu.patch
new file mode 100644 (file)
index 0000000..c7e1f40
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -47,6 +47,7 @@
+ #include <linux/skbuff.h>
+ #include <linux/netdevice.h>
+ #include <linux/rtnetlink.h>          /* XXX for rtnl_lock */
++#include <linux/etherdevice.h>
+ #include "if_media.h"
+@@ -463,6 +464,8 @@ static const struct net_device_ops ieee8
+       .ndo_set_multicast_list = ieee80211_set_multicast_list,
+       .ndo_change_mtu         = ieee80211_change_mtu,
+       .ndo_do_ioctl           = ieee80211_ioctl,
++      .ndo_validate_addr      = eth_validate_addr,
++      .ndo_set_mac_address    = eth_mac_addr,
+ };
+ #endif
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -574,6 +574,8 @@ static const struct net_device_ops ath_n
+       .ndo_get_stats          = ath_getstats,
+       .ndo_set_mac_address    = ath_set_mac_address,
+       .ndo_change_mtu         = ath_change_mtu,
++      .ndo_validate_addr      = eth_validate_addr,
++      .ndo_set_mac_address    = eth_mac_addr,
+ };
+ #endif
diff --git a/net/madwifi/patches/472-remove_11n_devids.patch b/net/madwifi/patches/472-remove_11n_devids.patch
new file mode 100644 (file)
index 0000000..46e2b04
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/ath/if_ath_pci.c
++++ b/ath/if_ath_pci.c
+@@ -111,8 +111,6 @@ static struct pci_device_id ath_pci_id_t
+       { 0x168c, 0x001b, PCI_ANY_ID, PCI_ANY_ID },
+       { 0x168c, 0x001c, PCI_ANY_ID, PCI_ANY_ID }, /* PCI Express 5424 */
+       { 0x168c, 0x001d, PCI_ANY_ID, PCI_ANY_ID }, /* PCI Express ???  */
+-      { 0x168c, 0x0023, PCI_ANY_ID, PCI_ANY_ID },
+-      { 0x168c, 0x0024, PCI_ANY_ID, PCI_ANY_ID },
+       { 0x168c, 0x9013, PCI_ANY_ID, PCI_ANY_ID }, /* sonicwall */
+       { 0x168c, 0xff16, PCI_ANY_ID, PCI_ANY_ID },
+       { 0x168c, 0xff1a, PCI_ANY_ID, PCI_ANY_ID },
+@@ -148,8 +146,6 @@ static const struct ath_hw_detect cards[
+       { ubnt, "SR4C",    0x168c, 0x0013, 0x7777, 0x1004, 6 },
+       { ubnt, "SR5",     0x168c, 0x0013, 0x168c, 0x2042, 7 },
+       { ubnt, "SR9",     0x168c, 0x0013, 0x7777, 0x2009, 12 },
+-      { ubnt, "SR71A",   0x168c, 0x0027, 0x168c, 0x2082, 10 },
+-      { ubnt, "SR71",    0x168c, 0x0027, 0x0777, 0x4082, 10 },
+ };
+ static int
diff --git a/net/madwifi/patches/473-mutex_fix.patch b/net/madwifi/patches/473-mutex_fix.patch
new file mode 100644 (file)
index 0000000..22cea46
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_athvar.h
++++ b/ath/if_athvar.h
+@@ -974,7 +974,7 @@ typedef void (*ath_callback) (struct ath
+ #endif
+ /* Protects the device from concurrent accesses */
+-#define       ATH_LOCK_INIT(_sc)              init_MUTEX(&(_sc)->sc_lock)
++#define       ATH_LOCK_INIT(_sc)              sema_init(&(_sc)->sc_lock, 1)
+ #define       ATH_LOCK_DESTROY(_sc)
+ #define       ATH_LOCK(_sc)                   down(&(_sc)->sc_lock)
+ #define       ATH_UNLOCK(_sc)                 up(&(_sc)->sc_lock)
diff --git a/net/madwifi/patches/474_fix_ssid_scan_length.patch b/net/madwifi/patches/474_fix_ssid_scan_length.patch
new file mode 100644 (file)
index 0000000..2e85e18
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/tools/wlanconfig.c
++++ b/tools/wlanconfig.c
+@@ -654,7 +654,7 @@ static void
+ list_scan(const char *ifname)
+ {
+       static uint8_t buf[24 * 1024];
+-      char ssid[14];
++      char ssid[30];
+       uint8_t *cp;
+       int len;
+@@ -665,7 +665,7 @@ list_scan(const char *ifname)
+       if (len < sizeof(struct ieee80211req_scan_result))
+               return;
+-      printf("%-14.14s  %-17.17s  %4s %4s  %-5s %3s %4s\n",
++      printf("%-30.30s  %-17.17s  %4s %4s  %-5s %3s %4s\n",
+               "SSID",
+               "BSSID",
+               "CHAN",
+@@ -680,7 +680,7 @@ list_scan(const char *ifname)
+               sr = (struct ieee80211req_scan_result *) cp;
+               vp = (u_int8_t *)(sr+1);
+-              printf("%-14.*s  %s  %3d  %3dM %2d:%-2d  %3d %-4.4s",
++              printf("%-30.*s  %s  %3d  %3dM %2d:%-2d  %3d %-4.4s",
+                       copy_essid(ssid, sizeof(ssid), vp, sr->isr_ssid_len),
+                       ssid,
+                       ieee80211_ntoa(sr->isr_bssid),
diff --git a/net/madwifi/patches/475-2.6.39-compile.patch b/net/madwifi/patches/475-2.6.39-compile.patch
new file mode 100644 (file)
index 0000000..5b8a777
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -97,7 +97,7 @@ struct scan_state {
+ static void scan_restart_pwrsav(unsigned long);
+ static void scan_next(unsigned long);
+-spinlock_t channel_lock = SPIN_LOCK_UNLOCKED;
++DEFINE_SPINLOCK(channel_lock);
+ static LIST_HEAD(channels_inuse);
+ struct channel_inuse {
diff --git a/net/madwifi/patches/476-3.0_detection_fix.patch b/net/madwifi/patches/476-3.0_detection_fix.patch
new file mode 100644 (file)
index 0000000..2f8bfb4
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/Makefile
++++ b/Makefile
+@@ -155,13 +155,15 @@ unload:
+ configcheck:
+       @echo -n "Checking kernel configuration... "
+       
+-      @# check version of kernel
+-      @echo $(KERNELRELEASE) | grep -q -i '^[2-9]\.[4-9]\.' || { \
+-          echo "FAILED"; \
+-          echo "Only kernel versions 2.4.x and above are supported."; \
+-          echo "You have $(KERNELRELEASE)."; \
+-          exit 1; \
+-      }
++      @# check kernel version
++      @case $(KERNELRELEASE) in \
++          2.[456].*) ;; \
++          [3-9].*) ;; \
++          *) echo "FAILED"; \
++             echo "Only kernel versions 2.4.x and above are supported."; \
++             echo "You have $(KERNELRELEASE)."; \
++             exit 1 ;; \
++      esac
+       
+       @# check kernel configuration
+       @if [ -z "$(CONFIG_SYSCTL)" ]; then \
diff --git a/net/madwifi/patches/477-3.2_fixes.patch b/net/madwifi/patches/477-3.2_fixes.patch
new file mode 100644 (file)
index 0000000..89cdfc6
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -569,7 +569,11 @@ static const struct net_device_ops ath_n
+       .ndo_stop               = ath_stop,
+       .ndo_start_xmit         = ath_hardstart,
+       .ndo_tx_timeout         = ath_tx_timeout,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
++      .ndo_set_rx_mode        = ath_mode_init,
++#else
+       .ndo_set_multicast_list = ath_mode_init,
++#endif
+       .ndo_do_ioctl           = ath_ioctl,
+       .ndo_get_stats          = ath_getstats,
+       .ndo_set_mac_address    = ath_set_mac_address,
+--- a/net80211/ieee80211.c
++++ b/net80211/ieee80211.c
+@@ -461,7 +461,11 @@ static const struct net_device_ops ieee8
+       .ndo_open               = ieee80211_open,
+       .ndo_stop               = ieee80211_stop,
+       .ndo_start_xmit         = ieee80211_hardstart,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
++      .ndo_set_rx_mode        = ieee80211_set_multicast_list,
++#else
+       .ndo_set_multicast_list = ieee80211_set_multicast_list,
++#endif
+       .ndo_change_mtu         = ieee80211_change_mtu,
+       .ndo_do_ioctl           = ieee80211_ioctl,
+       .ndo_validate_addr      = eth_validate_addr,
+@@ -1847,10 +1851,14 @@ ieee80211_set_multicast_list(struct net_
+       IEEE80211_UNLOCK_IRQ(ic);
+       /* XXX: Merge multicast list into parent device */
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+-      parent->set_multicast_list(ic->ic_dev);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
++      parent->netdev_ops->ndo_set_rx_mode(ic->ic_dev);
+ #else
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
+       parent->netdev_ops->ndo_set_multicast_list(ic->ic_dev);
++#else
++      parent->set_multicast_list(ic->ic_dev);
++#endif
+ #endif
+ }
diff --git a/net/madwifi/patches/478-remove_vlan_code.patch b/net/madwifi/patches/478-remove_vlan_code.patch
new file mode 100644 (file)
index 0000000..9ceda4a
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/net80211/ieee80211_input.c
++++ b/net80211/ieee80211_input.c
+@@ -1223,6 +1223,7 @@ ieee80211_deliver_data(struct ieee80211_
+ #endif
+               vap->iv_devstats.rx_packets++;
+               vap->iv_devstats.rx_bytes += skb->len;
++#if IEEE80211_VLAN_TAG_USED
+               if (ni->ni_vlan != 0 && vap->iv_vlgrp != NULL) {
+                       /* attach vlan tag */
+                       struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
+@@ -1236,7 +1237,9 @@ ieee80211_deliver_data(struct ieee80211_
+                               vap->iv_devstats.rx_dropped++;
+                       }
+                       skb = NULL; /* SKB is no longer ours */
+-              } else {
++              } else
++#endif
++              {
+                       struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
+                       if (netif_receive_skb(skb) == NET_RX_DROP) {
+                               /* If netif_receive_skb dropped the packet because
diff --git a/net/madwifi/patches/479-deprecate-devinitdata.patch b/net/madwifi/patches/479-deprecate-devinitdata.patch
new file mode 100644 (file)
index 0000000..312043b
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/include/compat.h
++++ b/include/compat.h
+@@ -204,6 +204,10 @@ static inline int timeval_compare(struct
+ #define CTLNAME(x)
+ #endif
++#ifndef __devinitdata
++#define __devinitdata
++#endif
++
+ #endif /* __KERNEL__ */
+ #endif /* _ATH_COMPAT_H_ */
diff --git a/net/madwifi/patches/480-remove_get-signal.patch b/net/madwifi/patches/480-remove_get-signal.patch
new file mode 100644 (file)
index 0000000..3785c57
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/net80211/ieee80211_scan.c
++++ b/net80211/ieee80211_scan.c
+@@ -107,17 +107,6 @@ struct channel_inuse {
+       u8 bw;
+ };
+-static inline u32
+-get_signal(u8 bw, u8 distance)
+-{
+-      u32 v;
+-
+-      /* signal = 1 - (distance / bw)^2 [scale: 100] */
+-      v = 100 * distance / bw;
+-      v = (100 - ((v * v) / 100));
+-      return v;
+-}
+-
+ static u32
+ get_overlap(u16 f1, u16 f2, u8 b1, u8 b2)
+ {
+@@ -137,7 +126,8 @@ get_overlap(u16 f1, u16 f2, u8 b1, u8 b2
+       d = f2 - f1;
+       c = d * b1 / (b1 + b2);
+-      v = get_signal(b1, c);
++      v = 100 * c / b1;
++      v = (100 - ((v * v) / 100));
+       return v * v / 100;
+ }
diff --git a/net/madwifi/patches/481-fix_proc.patch b/net/madwifi/patches/481-fix_proc.patch
new file mode 100644 (file)
index 0000000..61994a5
--- /dev/null
@@ -0,0 +1,177 @@
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -476,8 +476,12 @@ static int
+ proc_ieee80211_open(struct inode *inode, struct file *file)
+ {
+       struct proc_ieee80211_priv *pv = NULL;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++      struct ieee80211vap *vap = PDE_DATA(inode);
++#else
+       struct proc_dir_entry *dp = PDE(inode);
+       struct ieee80211vap *vap = dp->data;
++#endif
+       if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv), GFP_KERNEL)))
+               return -ENOMEM;
+@@ -842,10 +846,16 @@ ieee80211_virtfs_latevattach(struct ieee
+               tmp = vap->iv_proc_entries;
+               while (tmp) {
+                       if (!tmp->entry) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++                              tmp->entry = proc_create_data(tmp->name,
++                              PROC_IEEE80211_PERM, vap->iv_proc,
++                              tmp->fileops, vap);
++#else
+                               tmp->entry = create_proc_entry(tmp->name,
+                               PROC_IEEE80211_PERM, vap->iv_proc);
+                               tmp->entry->data = vap;
+                               tmp->entry->proc_fops = tmp->fileops;
++#endif
+                       }
+                       tmp = tmp->next;
+               }
+@@ -913,10 +923,16 @@ ieee80211_proc_vcreate(struct ieee80211v
+       /* Create the actual proc entry */
+       if (vap->iv_proc) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++              entry->entry = proc_create_data(entry->name,
++                              PROC_IEEE80211_PERM, vap->iv_proc,
++                              entry->fileops, vap);
++#else
+               entry->entry = create_proc_entry(entry->name,
+                               PROC_IEEE80211_PERM, vap->iv_proc);
+               entry->entry->data = vap;
+               entry->entry->proc_fops = entry->fileops;
++#endif
+       }
+       /* Add it to the list */
+@@ -953,14 +969,26 @@ ieee80211_virtfs_vdetach(struct ieee8021
+               tmp = vap->iv_proc_entries;
+               while (tmp) {
+                       if (tmp->entry) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++                              proc_remove(tmp->entry);
++#else
+                               remove_proc_entry(tmp->name, vap->iv_proc);
++#endif
+                               tmp->entry = NULL;
+                       }
+                       tmp = tmp->next;
+               }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++              proc_remove(vap->iv_proc);
++#else
+               remove_proc_entry(vap->iv_proc->name, proc_madwifi);
++#endif
+               if (proc_madwifi_count == 1) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++                      proc_remove(proc_madwifi);
++#else
+                       remove_proc_entry("madwifi", proc_net);
++#endif
+                       proc_madwifi = NULL;
+               }
+               proc_madwifi_count--;
+--- a/ath_rate/minstrel/minstrel.c
++++ b/ath_rate/minstrel/minstrel.c
+@@ -835,8 +835,12 @@ static int
+ ath_proc_ratesample_open(struct inode *inode, struct file *file)
+ {
+               struct proc_ieee80211_priv *pv = NULL;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
++              struct ieee80211vap *vap = PDE_DATA(inode);
++#else
+               struct proc_dir_entry *dp = PDE(inode);
+               struct ieee80211vap *vap = dp->data;
++#endif
+               if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv),
+                                                   GFP_KERNEL)))
+--- a/ath_rate/sample/sample.c
++++ b/ath_rate/sample/sample.c
+@@ -923,12 +923,15 @@ proc_read_nodes(struct ieee80211vap *vap
+ }
+ static int
+-proc_ratesample_open(struct inode *inode, struct file *file)
++proc_ratesample_open_common(struct inode *inode, struct file *file, const unsigned long size)
+ {
+       struct proc_ieee80211_priv *pv;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
++      struct ieee80211vap *vap = PDE_DATA(inode);
++#else
+       struct proc_dir_entry *dp = PDE(inode);
+       struct ieee80211vap *vap = dp->data;
+-      unsigned long size;
++#endif
+       if (!(file->private_data = kmalloc(sizeof(struct proc_ieee80211_priv),
+                                       GFP_KERNEL)))
+@@ -953,18 +956,47 @@ proc_ratesample_open(struct inode *inode
+       pv->max_wlen = MAX_PROC_IEEE80211_SIZE;
+       pv->max_rlen = MAX_PROC_IEEE80211_SIZE;
+-      /* Determine what size packets to get stats for based on proc filename */
+-      size = simple_strtoul(dp->name + 10, NULL, 0);
+-
+       /* now read the data into the buffer */
+       pv->rlen = proc_read_nodes(vap, size, pv->rbuf, MAX_PROC_IEEE80211_SIZE);
+       return 0;
+ }
+-static struct file_operations proc_ratesample_ops = {
++static int
++proc_ratesample_stats250_open(struct inode *inode, struct file *file)
++{
++      return proc_ratesample_open_common(inode, file, 250);
++}
++
++static int
++proc_ratesample_stats1600_open(struct inode *inode, struct file *file)
++{
++      return proc_ratesample_open_common(inode, file, 1600);
++}
++
++static int
++proc_ratesample_stats3000_open(struct inode *inode, struct file *file)
++{
++      return proc_ratesample_open_common(inode, file, 3000);
++}
++
++static struct file_operations proc_ratesample_stats250_ops = {
++      .read = NULL,
++      .write = NULL,
++      .open = proc_ratesample_stats250_open,
++      .release = NULL,
++};
++
++static struct file_operations proc_ratesample_stats1600_ops = {
++      .read = NULL,
++      .write = NULL,
++      .open = proc_ratesample_stats1600_open,
++      .release = NULL,
++};
++
++static struct file_operations proc_ratesample_stats3000_ops = {
+       .read = NULL,
+       .write = NULL,
+-      .open = proc_ratesample_open,
++      .open = proc_ratesample_stats3000_open,
+       .release = NULL,
+ };
+@@ -972,9 +1004,9 @@ static void
+ ath_rate_dynamic_proc_register(struct ieee80211vap *vap)
+ {
+       /* Create proc entries for the rate control algorithm */
+-      ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_250");
+-      ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_1600");
+-      ieee80211_proc_vcreate(vap, &proc_ratesample_ops, "ratestats_3000");
++      ieee80211_proc_vcreate(vap, &proc_ratesample_stats250_ops, "ratestats_250");
++      ieee80211_proc_vcreate(vap, &proc_ratesample_stats1600_ops, "ratestats_1600");
++      ieee80211_proc_vcreate(vap, &proc_ratesample_stats3000_ops, "ratestats_3000");
+ }
+ static struct ieee80211_rate_ops ath_rate_ops = {
diff --git a/net/madwifi/patches/482-fix_enum-compare.patch b/net/madwifi/patches/482-fix_enum-compare.patch
new file mode 100644 (file)
index 0000000..2bcab33
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2560,7 +2560,7 @@ static int ath_setintmit(struct ath_soft
+       switch(sc->sc_intmit) {
+               case -1:
+-                      if (sc->sc_opmode != IEEE80211_M_MONITOR)
++                      if (sc->sc_opmode != HAL_M_MONITOR)
+                               val = 1;
+                       else
+                               val = 0;
diff --git a/net/madwifi/patches/483-fix_frame-larger-than.patch b/net/madwifi/patches/483-fix_frame-larger-than.patch
new file mode 100644 (file)
index 0000000..3b7dea2
--- /dev/null
@@ -0,0 +1,80 @@
+--- a/net80211/ieee80211_skb.c
++++ b/net80211/ieee80211_skb.c
+@@ -108,7 +108,7 @@ static void skb_print_message(
+ {
+       va_list args;
+       char skb_count[32] = { '\0' };
+-      char expanded_message[1024] = { '\0' };
++      char *expanded_message;
+       if (show_counter) {
+ #ifdef IEEE80211_DEBUG_REFCNT
+               snprintf(skb_count, 
+@@ -125,6 +125,7 @@ static void skb_print_message(
+       }
+       va_start(args, message);
++      expanded_message = kzalloc(1024, GFP_KERNEL);
+       vsnprintf(expanded_message, sizeof(expanded_message), message, args);
+ #ifdef IEEE80211_DEBUG_REFCNT
+       printk(KERN_DEBUG "%s: %s%s:%d -> %s:%d %s\n",
+@@ -138,6 +139,7 @@ static void skb_print_message(
+ #endif
+               func2, line2,
+               expanded_message);
++      kfree(expanded_message);
+       va_end(args);
+ }
+--- a/net80211/ieee80211_wireless.c
++++ b/net80211/ieee80211_wireless.c
+@@ -1647,17 +1647,21 @@ ieee80211_ioctl_iwaplist(struct net_devi
+ {
+       struct ieee80211vap *vap = netdev_priv(dev);
+       struct ieee80211com *ic = vap->iv_ic;
+-      struct waplistreq req;          /* XXX off stack */
++      struct waplistreq *req;
+-      req.vap = vap;
+-      req.i = 0;
+-      ieee80211_scan_iterate(ic, waplist_cb, &req);
++      req = kmalloc(sizeof(struct waplistreq), GFP_KERNEL);
++      if (!req)
++              return -ENOMEM;
++      req->vap = vap;
++      req->i = 0;
++      ieee80211_scan_iterate(ic, waplist_cb, req);
+-      data->length = req.i;
+-      memcpy(extra, &req.addr, req.i * sizeof(req.addr[0]));
++      data->length = req->i;
++      memcpy(extra, &req->addr, req->i * sizeof(req->addr[0]));
+       data->flags = 1;                /* signal quality present (sort of) */
+-      memcpy(extra + req.i * sizeof(req.addr[0]), &req.qual,
+-              req.i * sizeof(req.qual[0]));
++      memcpy(extra + req->i * sizeof(req->addr[0]), &req->qual,
++              req->i * sizeof(req->qual[0]));
++      kfree(req);
+       return 0;
+ }
+--- a/net80211/ieee80211_linux.c
++++ b/net80211/ieee80211_linux.c
+@@ -312,8 +312,9 @@ ieee80211_notify_sta_stats(struct ieee80
+       static const char *tag = "STA-TRAFFIC-STAT";
+       struct net_device *dev = vap->iv_dev;
+       union iwreq_data wreq;
+-      char buf[1024];
++      char *buf;
++      buf = kmalloc(1024, GFP_KERNEL);
+       snprintf(buf, sizeof(buf), "%s\nmac=" MAC_FMT "\nrx_packets=%u\nrx_bytes=%llu\n"
+                       "tx_packets=%u\ntx_bytes=%llu\n", tag,
+                       MAC_ADDR(ni->ni_macaddr), ni->ni_stats.ns_rx_data,
+@@ -323,6 +324,7 @@ ieee80211_notify_sta_stats(struct ieee80
+       memset(&wreq, 0, sizeof(wreq));
+       wreq.data.length = strlen(buf);
+       wireless_send_event(dev, IWEVCUSTOM, &wreq, buf);
++      kfree(buf);
+ }
+ void
diff --git a/net/madwimax/Makefile b/net/madwimax/Makefile
new file mode 100644 (file)
index 0000000..cf205de
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=madwimax
+PKG_VERSION:=0.1.1
+PKG_RELEASE:=3
+
+PKG_SOURCE:=madwimax-0.1.1.tar.gz
+PKG_SOURCE_URL:=http://madwimax.googlecode.com/files/
+PKG_MD5SUM:=4ebd2d74e887e6f9d6f23067a4ad8272
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/madwimax
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=driver for  WiMAX devices based on Samsung CMC-730 chip
+  URL:=http://code.google.com/p/madwimax/
+  DEPENDS:=+libusb-1.0 +kmod-tun +libpthread
+endef
+
+define Package/madwimax/description
+madWiMAX is a reverse-engineered Linux driver for mobile WiMAX (802.16e) devices based on Samsung CMC-730 chip. These devices are currently supported:
+
+Samsung SWC-U200
+Samsung SWC-E100
+Samsung SWM-S10R (built in Samsung NC-10 netbook)
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += --without-man-pages
+
+define Package/madwimax/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/madwimax $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/madwimax
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/20-madwimax $(1)/etc/hotplug.d/usb/
+       $(INSTALL_BIN) ./files/event.sh $(1)/etc/madwimax/
+       $(INSTALL_BIN) ./files/madwimax.init $(1)/etc/init.d/madwimax
+endef
+
+$(eval $(call BuildPackage,madwimax))
diff --git a/net/madwimax/files/20-madwimax b/net/madwimax/files/20-madwimax
new file mode 100644 (file)
index 0000000..252eb5e
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+case "$ACTION" in
+        add) 
+                [ -n ${PRODUCT} ] &&
+                [ -n ${INTERFACE} ] &&
+                [ "${PRODUCT}" = "4e8/6761/1" ] &&
+                [ "${INTERFACE}" = "255/0/0" ] && {
+                        /usr/sbin/madwimax -qofd
+                }
+                ;;
+        remove)
+                [ -n ${PRODUCT} ] &&
+                [ -n ${INTERFACE} ] &&
+                [ "${PRODUCT}" = "4e8/6761/1" ] &&
+                [ "${INTERFACE}" = "255/0/0" ] && {
+                        /usr/bin/killall madwimax
+                        return 0
+                }
+                ;;
+esac
+
diff --git a/net/madwimax/files/event.sh b/net/madwimax/files/event.sh
new file mode 100644 (file)
index 0000000..c44afec
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+case "$1" in
+    if-create)
+            ;;
+    if-up)
+            /sbin/ifdown wan
+            /sbin/ifup wimax
+            ;;
+    if-down)
+            /sbin/ifdown wimax
+            /sbin/ifup wan
+            ;;
+    if-release)
+            ;;
+esac
+
+exit 0
\ No newline at end of file
diff --git a/net/madwimax/files/madwimax.init b/net/madwimax/files/madwimax.init
new file mode 100755 (executable)
index 0000000..5be447d
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=90
+boot() {
+       /usr/sbin/madwimax -qofd
+}
diff --git a/net/madwimax/patches/001-fix_detection_on_be.patch b/net/madwimax/patches/001-fix_detection_on_be.patch
new file mode 100644 (file)
index 0000000..9352fb9
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/src/wimax.c
++++ b/src/wimax.c
+@@ -133,19 +133,16 @@ static struct libusb_device_handle* find_wimax_device(void)
+       while (!found && (dev = devs[i++]) != NULL) {
+               struct libusb_device_descriptor desc;
+               unsigned int j = 0;
+-              unsigned short dev_vid, dev_pid;
+               r = libusb_get_device_descriptor(dev, &desc);
+               if (r < 0) {
+                       continue;
+               }
+-              dev_vid = libusb_le16_to_cpu(desc.idVendor);
+-              dev_pid = libusb_le16_to_cpu(desc.idProduct);
+-              wmlog_msg(1, "Bus %03d Device %03d: ID %04x:%04x", libusb_get_bus_number(dev), libusb_get_device_address(dev), dev_vid, dev_pid);
++              wmlog_msg(1, "Bus %03d Device %03d: ID %04x:%04x", libusb_get_bus_number(dev), libusb_get_device_address(dev), desc.idVendor, desc.idProduct);
+               switch (match_method) {
+                       case MATCH_BY_LIST: {
+                               for (j = 0; j < sizeof(wimax_dev_ids) / sizeof(usb_device_id_t); j++) {
+-                                      if (dev_vid == wimax_dev_ids[j].vendorID && dev_pid == wimax_dev_ids[j].productID) {
++                                      if (desc.idVendor == wimax_dev_ids[j].vendorID && desc.idProduct == wimax_dev_ids[j].productID) {
+                                               found = dev;
+                                               break;
+                                       }
+@@ -153,7 +150,7 @@ static struct libusb_device_handle* find_wimax_device(void)
+                               break;
+                       }
+                       case MATCH_BY_VID_PID: {
+-                              if (dev_vid == match_params.vid && dev_pid == match_params.pid) {
++                              if (desc.idVendor == match_params.vid && desc.idProduct == match_params.pid) {
+                                       found = dev;
+                               }
+                               break;
diff --git a/net/maradns/Makefile b/net/maradns/Makefile
new file mode 100644 (file)
index 0000000..8b13f9b
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2006-2009 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:=maradns
+PKG_VERSION:=1.3.07.09
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.maradns.org/download/1.3/$(PKG_VERSION)/
+PKG_MD5SUM:=1d221438fb4d9317263555262b9c652c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/maradns
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread
+  TITLE:=Small and secure DNS Server
+  URL:=http://www.maradns.org/
+  SUBMENU:=IP Addresses and Names
+endef
+
+define Package/maradns/description
+       maradns is a DNS server written with security, simplicity, and
+       performance in mind.
+endef
+
+define Package/maradns/conffiles
+/etc/mararc
+endef
+
+define Build/Configure
+       # it's not GNU autoconf stuff
+       (cd $(PKG_BUILD_DIR); \
+               $(TARGET_CONFIGURE_OPTS) \
+               ./configure \
+       );
+endef
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               FLAGS="$(TARGET_CFLAGS)" \
+               CC="$(TARGET_CC)" \
+               HOSTCC="$(HOSTCC)" \
+               V=
+       mkdir -p $(PKG_INSTALL_DIR)/usr/{bin,sbin}
+       mkdir -p $(PKG_INSTALL_DIR)/usr/man/man{1,5,8}
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               PREFIX="$(PKG_INSTALL_DIR)/usr" \
+               RPM_BUILD_ROOT="$(PKG_INSTALL_DIR)" \
+               V= \
+               install
+endef
+
+define Package/maradns/install 
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/mararc $(1)/etc/mararc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/maradns.init $(1)/etc/init.d/maradns
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{askmara,getzone,fetchzone,duende} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{maradns,zoneserver} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,maradns))
diff --git a/net/maradns/files/maradns.init b/net/maradns/files/maradns.init
new file mode 100644 (file)
index 0000000..897232f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+start() {
+       [ -d /etc/maradns ] || mkdir -p /etc/maradns
+       [ -d /etc/maradns/logger ] || mkdir -p /etc/maradns/logger
+       duende /usr/sbin/maradns
+       duende /usr/sbin/zoneserver
+}
+
+stop() {
+       killall duende maradns zoneserver
+}
+
+reload() {
+       killall -HUP maradns
+}
diff --git a/net/maradns/files/mararc b/net/maradns/files/mararc
new file mode 100644 (file)
index 0000000..e67ee99
--- /dev/null
@@ -0,0 +1,9 @@
+hide_disclaimer="YES"
+chroot_dir="/etc/maradns"
+bind_address="0.0.0.0"
+maradns_uid=65534
+maxprocs=10
+random_seed_file="/dev/urandom"
+recursive_acl="192.168.1.0/24"
+root_servers={}
+root_servers["."]="198.41.0.4,128.9.0.107,192.33.4.12,128.8.10.90,192.203.230.10,192.5.5.241,192.112.36.4,128.63.2.53,192.36.148.17,192.58.128.30,193.0.14.129,198.32.64.12,202.12.27.33"
diff --git a/net/maradns/patches/001-cross_compile_fix.patch b/net/maradns/patches/001-cross_compile_fix.patch
new file mode 100644 (file)
index 0000000..b25977a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/rng/Makefile
++++ b/rng/Makefile
+@@ -25,7 +25,7 @@
+       $(CC) -c $(FLAGS) -o rng-api-fst.o rng-api-fst.c
+ make_32bit_tables: make_32bit_tables.c
+-      $(CC) -o make_32bit_tables make_32bit_tables.c
++      $(HOSTCC) -o make_32bit_tables make_32bit_tables.c
+ rng-32bit-tables.h: make_32bit_tables
+       ./make_32bit_tables > rng-32bit-tables.h
diff --git a/net/matrixtunnel/Makefile b/net/matrixtunnel/Makefile
new file mode 100644 (file)
index 0000000..ac45f4d
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2010 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:=matrixtunnel
+PKG_VERSION:=0.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://znerol.ch/files
+PKG_MD5SUM:=af169751efc7d87d500716a48d74ddc5
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKE_PATH:=src
+
+define Package/matrixtunnel
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=VPN
+  DEPENDS:=+libmatrixssl
+  TITLE:=SSL tunnel based on matrixssl
+  URL:=http://znerol.ch/svn/matrixtunnel/trunk/
+endef
+
+define Package/matrixtunnel/description
+       matrixtunnel is a stripped down version of stunnel
+       based on matrixssl library.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --without-libiconv-prefix \
+               --without-libintl-prefix \
+               --with-matrixssl-src="$(BUILD_DIR)/matrixssl" \
+       )
+endef
+
+define Package/matrixtunnel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/matrixtunnel $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,matrixtunnel))
diff --git a/net/mcabber/Makefile b/net/mcabber/Makefile
new file mode 100644 (file)
index 0000000..6311ae2
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2011-2013 Entware
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mcabber
+PKG_VERSION:=0.10.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://mcabber.com/files/
+PKG_MD5SUM:=6bb2302f5168ad4c28b647390e37f9b3
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+#include $(INCLUDE_DIR)/nls.mk
+
+define Package/mcabber
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncursesw +libloudmouth1 +libcharset +libidn +libgpgme +libotr
+  TITLE:=Jabber console client
+  URL:=http://mcabber.com
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+endef
+
+define Package/mcabber/description
+  mcabber is a small Jabber console client.
+  mcabber includes features such as SASL/SSL/TLS support, MUC (Multi-User Chat) support,
+  history logging, command completion, OpenPGP encryption, OTR (Off-the-Record
+  Messaging) support, dynamic modules and external action triggers.
+endef
+
+CONFIGURE_ARGS += \
+       --with-libidn=$(STAGING_DIR)/usr/lib \
+       --with-gpgme-prefix=$(STAGING_DIR)/usr \
+       --enable-otr
+
+define Package/mcabber/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mcabber/mcabber $(1)/bin
+       $(INSTALL_DIR) $(1)/usr/lib/mcabber
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/beep/.libs/libbeep.so $(1)/usr/lib/mcabber
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/xttitle/.libs/libxttitle.so $(1)/usr/lib/mcabber
+       $(INSTALL_DIR) $(1)/usr/share/mcabber/ $(1)/usr/share/mcabber/help/en
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/mcabberrc.example $(1)/usr/share/mcabber/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/events/eventcmd $(1)/usr/share/mcabber/eventcmd.example
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/help/en/*.txt $(1)/usr/share/mcabber/help/en/
+endef
+
+$(eval $(call BuildPackage,mcabber))
diff --git a/net/mdk3/Makefile b/net/mdk3/Makefile
new file mode 100644 (file)
index 0000000..8d752b9
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2009-2014 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:=mdk3
+PKG_VERSION:=v6
+PKG_RELEASE:=2
+PKG_MD5SUM:=67705a814ded2a2e6f70522ca0dc6da9
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/mdk3-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://homepages.tu-darmstadt.de/~p_larbig/wlan/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mdk3
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread
+  TITLE:= MDK3
+  URL:=http://homepages.tu-darmstadt.de/~p_larbig/wlan/
+  SUBMENU:=wireless
+endef
+
+define Package/mdk3/description
+  Tool to exploit wireless vulnerabilities
+endef
+
+MAKE_FLAGS += \
+       $(TARGET_CONFIGURE_OPTS)
+
+define Package/mdk3/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/mdk3 $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,mdk3))
diff --git a/net/mdk3/patches/001-radiotap_needs_types_h.patch b/net/mdk3/patches/001-radiotap_needs_types_h.patch
new file mode 100644 (file)
index 0000000..3f2b60c
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/osdep/radiotap/radiotap-parser.c
++++ b/osdep/radiotap/radiotap-parser.c
+@@ -18,6 +18,7 @@
+ #include <stdio.h>
+ #include <errno.h>
++#include <sys/types.h>
+ #include "radiotap-parser.h"
diff --git a/net/mdk3/patches/010-fix-dependencies.patch b/net/mdk3/patches/010-fix-dependencies.patch
new file mode 100644 (file)
index 0000000..e55a1c9
--- /dev/null
@@ -0,0 +1,17 @@
+---
+ Makefile |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -18,8 +18,8 @@ osd:
+ $(LIBOSD):
+       $(MAKE) -C $(OSD)
+-mdk3: mdk3.c $(OSD)/libosdep.a
+-      $(CC) $(CFLAGS) $(LINKFLAGS) $^ -o $@ $(LIBS)
++mdk3: $(LIBOSD) mdk3.c
++      $(CC) $(CFLAGS) $(LINKFLAGS) mdk3.c $(OSD)/lib$(OSD).a -o $@ $(LIBS)
+ install: mdk3
+       $(MAKE) -C $(OSD) install
diff --git a/net/mdk3/patches/020-Makefile_honour_CFLAGS_for_VFP.patch b/net/mdk3/patches/020-Makefile_honour_CFLAGS_for_VFP.patch
new file mode 100644 (file)
index 0000000..9a420c2
--- /dev/null
@@ -0,0 +1,8 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,4 @@
+-CFLAGS                = -g -O3 -Wall -Wextra
++CFLAGS                += -g -O3 -Wall -Wextra
+ LINKFLAGS     = -lpthread
+ DESTDIR               =
diff --git a/net/memcached/Makefile b/net/memcached/Makefile
new file mode 100644 (file)
index 0000000..8d7cff9
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2009-2012 OpenWrt.org
+# Copyright (C) 2009-2012 Thomas Heil <heil@terminal-consulting.de>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=memcached
+PKG_VERSION:=1.4.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://memcached.googlecode.com/files
+PKG_MD5SUM:=4194de21b58a92de684ce69b8e501c44
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/memcached
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libevent +libpthread
+  TITLE:=The high-performance, distributed memory object caching system
+  MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
+  URL:=http://memcached.org/
+endef
+
+define Package/memcached/description
+  Free and open source, high-performance, distributed memory object caching system
+endef
+
+define Package/memcached/conffiles
+/etc/config/memcached
+endef
+
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+CONFIGURE_VARS += ac_cv_c_endian=big
+else
+CONFIGURE_VARS += ac_cv_c_endian=little
+endif
+
+CONFIGURE_ARGS += \
+       --with-libevent=$(STAGING_DIR)/usr/include/libevent \
+       --disable-docs \
+       --disable-dtrace \
+       --disable-coverage \
+       --disable-sasl
+
+TARGET_CFLAGS += \
+       -std=gnu99
+
+TARGET_LDFLAGS = \
+       -L$(STAGING_DIR)/usr/lib/libevent -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
+define Package/memcached/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/memcached $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/memcached.config $(1)/etc/config/memcached
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/memcached.init $(1)/etc/init.d/memcached
+endef
+
+$(eval $(call BuildPackage,memcached))
diff --git a/net/memcached/files/memcached.config b/net/memcached/files/memcached.config
new file mode 100644 (file)
index 0000000..4071116
--- /dev/null
@@ -0,0 +1,6 @@
+config memcached
+       option user 'nobody'
+       option maxconn '1024'
+       option listen '0.0.0.0'
+       option port '11211'
+       option memory '64'
diff --git a/net/memcached/files/memcached.init b/net/memcached/files/memcached.init
new file mode 100644 (file)
index 0000000..063bf64
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=80
+
+start_instance () {
+       local section="$1"
+
+       config_get user "$section" user
+       config_get maxconn "$section" maxconn
+       config_get listen "$section" listen
+       config_get port "$section" port
+       config_get memory "$section" memory
+
+       service_start /usr/bin/memcached -d -u ${user:-nobody} \
+               -c ${maxconn:-1024} -l ${listen:-0.0.0.0} \
+               -p ${port:-11211} -U ${port:-11211} -m ${memory:-64}
+}
+
+start() {
+       config_load 'memcached'
+       config_foreach start_instance 'memcached'
+}
+
+stop() {
+       service_stop /usr/bin/memcached
+}
diff --git a/net/memcached/patches/100-fix_iov_max.patch b/net/memcached/patches/100-fix_iov_max.patch
new file mode 100644 (file)
index 0000000..1a5da94
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/memcached.c
++++ b/memcached.c
+@@ -13,6 +13,10 @@
+  *      Anatoly Vorobey <mellon@pobox.com>
+  *      Brad Fitzpatrick <brad@danga.com>
+  */
++#ifndef __need_IOV_MAX
++#define __need_IOV_MAX
++#endif
++
+ #include "memcached.h"
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+@@ -29,9 +33,6 @@
+ #define _P1003_1B_VISIBLE
+ #endif
+ /* need this to get IOV_MAX on some platforms. */
+-#ifndef __need_IOV_MAX
+-#define __need_IOV_MAX
+-#endif
+ #include <pwd.h>
+ #include <sys/mman.h>
+ #include <fcntl.h>
diff --git a/net/mercurial/Makefile b/net/mercurial/Makefile
new file mode 100644 (file)
index 0000000..a94b758
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# 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:=mercurial
+PKG_VERSION:=1.8.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://mercurial.selenic.com/release
+PKG_MD5SUM:=b3dcc3de473e003dd1cc0500dcd9de47
+
+PKG_BUILD_DEPENDS:=python-mini
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/mercurial
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+python
+  TITLE:=Mercurial Source Control Management (SCM) system
+  URL:=http://mercurial.selenic.com/
+  SUBMENU:=Version Control Systems
+endef
+
+define Package/mercurial/description
+  A fast, lightweight Source Control Management system designed for efficient
+  handling of very large distributed projects.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,, \
+               install --prefix="$(PKG_INSTALL_DIR)", \
+    )
+endef
+
+define Package/mercurial/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/bin $(1)/usr/
+       $(CP) $(PKG_INSTALL_DIR)/lib $(1)/usr/
+endef
+
+$(eval $(call BuildPackage,mercurial))
diff --git a/net/mercurial/patches/001-no_bzip2.patch b/net/mercurial/patches/001-no_bzip2.patch
new file mode 100644 (file)
index 0000000..d43acca
--- /dev/null
@@ -0,0 +1,183 @@
+--- a/mercurial/archival.py
++++ b/mercurial/archival.py
+@@ -37,7 +37,6 @@ def tidyprefix(dest, kind, prefix):
+ exts = {
+     'tar': ['.tar'],
+-    'tbz2': ['.tbz2', '.tar.bz2'],
+     'tgz': ['.tgz', '.tar.gz'],
+     'zip': ['.zip'],
+     }
+@@ -51,7 +50,7 @@ def guesskind(dest):
+ class tarit(object):
+     '''write archive to tar file or stream.  can write uncompressed,
+-    or compress with gzip or bzip2.'''
++    or compress with gzip.'''
+     class GzipFileWithTime(gzip.GzipFile):
+@@ -205,7 +204,6 @@ class fileit(object):
+ archivers = {
+     'files': fileit,
+     'tar': tarit,
+-    'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'),
+     'tgz': lambda name, mtime: tarit(name, mtime, 'gz'),
+     'uzip': lambda name, mtime: zipit(name, mtime, False),
+     'zip': zipit,
+--- a/mercurial/bundlerepo.py
++++ b/mercurial/bundlerepo.py
+@@ -307,7 +307,7 @@ def getremotechanges(ui, repo, other, re
+             cg = other.changegroup(incoming, "incoming")
+         else:
+             cg = other.changegroupsubset(incoming, revs, 'incoming')
+-        bundletype = other.local() and "HG10BZ" or "HG10UN"
++        bundletype = other.local() and "HG10GZ" or "HG10UN"
+         fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
+         # keep written bundle?
+         if bundlename:
+--- a/mercurial/changegroup.py
++++ b/mercurial/changegroup.py
+@@ -7,7 +7,7 @@
+ from i18n import _
+ import util
+-import struct, os, bz2, zlib, tempfile
++import struct, os, zlib, tempfile
+ def readexactly(stream, n):
+     '''read n bytes from stream.read and abort if less was available'''
+@@ -45,7 +45,6 @@ class nocompress(object):
+ bundletypes = {
+     "": ("", nocompress),
+     "HG10UN": ("HG10UN", nocompress),
+-    "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
+     "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
+ }
+@@ -59,14 +58,13 @@ def collector(cl, mmfs, files):
+     return collect
+ # hgweb uses this list to communicate its preferred type
+-bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
++bundlepriority = ['HG10GZ', 'HG10UN']
+ def writebundle(cg, filename, bundletype):
+     """Write a bundle file and return its filename.
+     Existing files will not be overwritten.
+     If no filename is specified, a temporary file is created.
+-    bz2 compression can be turned off.
+     The bundle file will be deleted in case of errors.
+     """
+@@ -124,12 +122,6 @@ def decompressor(fh, alg):
+             zd = zlib.decompressobj()
+             for chunk in f:
+                 yield zd.decompress(chunk)
+-    elif alg == 'BZ':
+-        def generator(f):
+-            zd = bz2.BZ2Decompressor()
+-            zd.decompress("BZ")
+-            for chunk in util.filechunkiter(f, 4096):
+-                yield zd.decompress(chunk)
+     else:
+         raise util.Abort("unknown bundle compression '%s'" % alg)
+     return util.chunkbuffer(generator(fh))
+--- a/mercurial/hgweb/hgwebdir_mod.py
++++ b/mercurial/hgweb/hgwebdir_mod.py
+@@ -204,7 +204,7 @@ class hgwebdir(object):
+         def archivelist(ui, nodeid, url):
+             allowed = ui.configlist("web", "allow_archive", untrusted=True)
+             archives = []
+-            for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
++            for i in [('zip', '.zip'), ('gz', '.tar.gz')]:
+                 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
+                                                     untrusted=True):
+                     archives.append({"type" : i[0], "extension": i[1],
+--- a/mercurial/hgweb/hgweb_mod.py
++++ b/mercurial/hgweb/hgweb_mod.py
+@@ -40,7 +40,7 @@ class hgweb(object):
+         self.mtime = -1
+         self.size = -1
+         self.reponame = name
+-        self.archives = 'zip', 'gz', 'bz2'
++        self.archives = 'zip', 'gz'
+         self.stripecount = 1
+         # a repo owner may set web.templates in .hg/hgrc to get any file
+         # readable by the user running the CGI script
+@@ -284,7 +284,6 @@ class hgweb(object):
+                 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
+     archive_specs = {
+-        'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None),
+         'gz': ('application/x-gzip', 'tgz', '.tar.gz', None),
+         'zip': ('application/zip', 'zip', '.zip', None),
+         }
+--- a/mercurial/repair.py
++++ b/mercurial/repair.py
+@@ -19,7 +19,7 @@ def _bundle(repo, bases, heads, node, su
+         os.mkdir(backupdir)
+     name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix))
+     if compress:
+-        bundletype = "HG10BZ"
++        bundletype = "HG10GZ"
+     else:
+         bundletype = "HG10UN"
+     return changegroup.writebundle(cg, name, bundletype)
+--- a/mercurial/commands.py
++++ b/mercurial/commands.py
+@@ -162,7 +162,6 @@ def archive(ui, repo, dest, **opts):
+     :``files``: a directory full of files (default)
+     :``tar``:   tar archive, uncompressed
+-    :``tbz2``:  tar archive, compressed using bzip2
+     :``tgz``:   tar archive, compressed using gzip
+     :``uzip``:  zip archive, uncompressed
+     :``zip``:   zip archive, compressed using deflate
+@@ -644,8 +643,8 @@ def bundle(ui, repo, fname, dest=None, *
+     -a/--all (or --base null).
+     You can change compression method with the -t/--type option.
+-    The available compression methods are: none, bzip2, and
+-    gzip (by default, bundles are compressed using bzip2).
++    The available compression methods are: none, and
++    gzip (by default, bundles are compressed using gzip).
+     The bundle file can then be transferred using conventional means
+     and applied to another repository with the unbundle or pull
+@@ -712,8 +711,8 @@ def bundle(ui, repo, fname, dest=None, *
+     else:
+         cg = repo.changegroup(o, 'bundle')
+-    bundletype = opts.get('type', 'bzip2').lower()
+-    btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
++    bundletype = opts.get('type', 'gzip').lower()
++    btypes = {'none': 'HG10UN', 'gzip': 'HG10GZ'}
+     bundletype = btypes.get(bundletype)
+     if bundletype not in changegroup.bundletypes:
+         raise util.Abort(_('unknown bundle type specified with --type'))
+@@ -4316,7 +4315,7 @@ table = {
+            _('a base changeset assumed to be available at the destination'),
+            _('REV')),
+           ('a', 'all', None, _('bundle all changesets in the repository')),
+-          ('t', 'type', 'bzip2',
++          ('t', 'type', 'gzip',
+            _('bundle compression type to use'), _('TYPE')),
+          ] + remoteopts,
+          _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
+--- a/setup.py
++++ b/setup.py
+@@ -36,12 +36,6 @@ except:
+     raise SystemExit(
+         "Couldn't import standard zlib (incomplete Python install).")
+-try:
+-    import bz2
+-except:
+-    raise SystemExit(
+-        "Couldn't import standard bz2 (incomplete Python install).")
+-
+ import os, subprocess, time
+ import shutil
+ import tempfile
diff --git a/net/mgen/Makefile b/net/mgen/Makefile
new file mode 100644 (file)
index 0000000..13ec1b2
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2006-2014 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:=mgen
+PKG_VERSION:=5.01b
+PKG_RELEASE:=3
+
+PKG_SOURCE:=src-$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://downloads.pf.itd.nrl.navy.mil/mgen/
+PKG_MD5SUM:=1e467131446d649c8a0aebdcd8e5f2a9
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mgen
+  TITLE:=Multi-Generator
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread $(CXX_DEPENDS)
+  URL:=http://cs.itd.nrl.navy.mil/work/mgen/
+endef
+
+define Package/mgen/Description
+       The Multi-Generator (MGEN) is open source software developed by
+       the Naval Research Laboratory (NRL) PROTocol Engineering Advanced
+       Networking (PROTEAN) Research Group. MGEN provides the ability to
+       perform IP network performance tests and measurements using UDP/IP
+       traffic (TCP is currently being developed).
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/unix \
+               $(TARGET_CONFIGURE_OPTS) \
+               CC="$(TARGET_CXX)" \
+               SYSTEM_INCLUDES="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               SYSTEM_LDFLAGS="$(TARGET_LDFLAGS)" \
+               SYSTEM_LIBS="-ldl -lpthread" \
+               -f Makefile.linux mgen
+endef
+
+define Package/mgen/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/unix/mgen $(1)/usr/bin/mgen
+endef
+
+$(eval $(call BuildPackage,mgen))
diff --git a/net/mgen/patches/100-ipv6.patch b/net/mgen/patches/100-ipv6.patch
new file mode 100644 (file)
index 0000000..2e193ec
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/protolib/unix/Makefile.linux
++++ b/protolib/unix/Makefile.linux
+@@ -39,7 +39,7 @@ SYSTEM_LIBS = -ldl -lrt
+ # (We export these for other Makefiles as needed)
+ #
+-SYSTEM_HAVES = -DLINUX -DHAVE_IPV6 -DHAVE_GETLOGIN -D_FILE_OFFSET_BITS=64 -DHAVE_LOCKF \
++SYSTEM_HAVES = -DLINUX -DHAVE_GETLOGIN -D_FILE_OFFSET_BITS=64 -DHAVE_LOCKF \
+ -DHAVE_OLD_SIGNALHANDLER -DHAVE_DIRFD -DHAVE_ASSERT -DNO_SCM_RIGHTS -DHAVE_SCHED
+ # (TBD) Move ProtoRouteMgr to ProtokitEx ??
+--- a/unix/Makefile.linux
++++ b/unix/Makefile.linux
+@@ -35,7 +35,7 @@ SYSTEM_LIBS = -ldl -lpthread
+ # (We export these for other Makefiles as needed)
+ #
+-SYSTEM_HAVES = -DLINUX -DHAVE_PSELECT -DHAVE_SCHED -DHAVE_IPV6 -DHAVE_GETLOGIN -DHAVE_LOCKF -DHAVE_DIRFD \
++SYSTEM_HAVES = -DLINUX -DHAVE_PSELECT -DHAVE_SCHED -DHAVE_GETLOGIN -DHAVE_LOCKF -DHAVE_DIRFD \
+ -DHAVE_ASSERT $(NETSEC)
+ SYSTEM = linux
diff --git a/net/mgen/patches/200-cflags_override.patch b/net/mgen/patches/200-cflags_override.patch
new file mode 100644 (file)
index 0000000..0e78d1f
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/unix/Makefile.linux
++++ b/unix/Makefile.linux
+@@ -5,8 +5,8 @@
+ # 1) System specific additional libraries, include paths, etc
+ #    (Where to find X11 libraries, etc)
+ #
+-SYSTEM_INCLUDES = -I/usr/X11R6/include 
+-SYSTEM_LDFLAGS = -L/usr/X11R6/lib 
++SYSTEM_INCLUDES ?= -I/usr/X11R6/include 
++SYSTEM_LDFLAGS ?= -L/usr/X11R6/lib 
+ SYSTEM_LIBS = -ldl -lpthread
+ # 2) System specific capabilities
+@@ -39,8 +39,8 @@ SYSTEM_HAVES = -DLINUX -DHAVE_PSELECT -D
+ -DHAVE_ASSERT $(NETSEC)
+ SYSTEM = linux
+-CC = g++
+-RANLIB = ranlib
+-AR = ar
++CC ?= g++
++RANLIB ?= ranlib
++AR ?= ar
+ include Makefile.common
diff --git a/net/miau/Makefile b/net/miau/Makefile
new file mode 100644 (file)
index 0000000..0ed0756
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# 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:=miau
+PKG_VERSION:=0.6.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/miau
+PKG_MD5SUM:=8778b8564c679cf5487b1972ca0b35e4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/miau
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Another IRC-bouncer/proxy
+  URL:=http://miau.sourceforge.net/
+endef
+
+define Package/miau/description
+       In short, miau is an IRC-bouncer/proxy.
+       Being more verbose, miau is small but quite featured
+       IRC-bouncer - a service bit like HTTP-proxy, but
+       for IRC-networks.
+endef
+
+define Package/miau/conffiles
+/etc/miau/miaurc
+endef
+
+CONFIGURE_ARGS += \
+       --enable-automode \
+       --enable-releasenick \
+       --enable-uptime \
+       --enable-privlog \
+       --enable-onconnect
+
+define Package/miau/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/miau
+       $(INSTALL_BIN) ./files/miau.init $(1)/etc/init.d/miau
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/doc/miau/examples/miaurc $(1)/etc/miau/
+endef
+
+$(eval $(call BuildPackage,miau))
diff --git a/net/miau/files/miau.init b/net/miau/files/miau.init
new file mode 100644 (file)
index 0000000..4a71877
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+START=50
+
+OPTIONS="-d /etc/miau/"
+LOG_DIR="/var/log/miau"
+ERR_LOG="$LOG_DIR/error.log"
+OUT_LOG="$LOG_DIR/miau.log"
+
+start() {
+       [ -f /var/run/miau.pid ] && {
+               echo "[ERROR] miau is running"
+               exit 0
+       }
+       [ -d $LOG_DIR ] || mkdir -p $LOG_DIR
+       /usr/bin/miau -f $OPTIONS > $OUT_LOG 2> $ERR_LOG &
+       PID=$!
+       sleep 1
+       if [ -d /proc/$PID ]; then
+               echo $PID > /var/run/miau.pid
+       else
+               echo "[ERROR] Unable to run miau as a daemon"
+       fi
+}
+
+stop() {
+       [ -f /var/run/miau.pid ] && kill $(cat /var/run/miau.pid) >/dev/null 2>&1 && rm /var/run/miau.pid
+}
diff --git a/net/mii-tool/Makefile b/net/mii-tool/Makefile
new file mode 100644 (file)
index 0000000..3e4c395
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006-2010 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:=mii-tool
+PKG_VERSION:=2014-02-18
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://git.code.sf.net/p/net-tools/code
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=68a4d784daaf5fb3449808e434e8cbb9625988e6
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mii-tool
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=configure media type using MII commands
+  URL:=http://freshmeat.net/projects/mii-tool/
+endef
+
+define Package/mii-tool/description
+       The mii-tool command allows you to set or autodetect the media type
+       or mii chipset-based ethernet devices. It traditionally had been
+       distributed in the net-tools package. This is a single distribution
+       optimized for embedded systems and fully automated cross/-sysroot-builds
+endef
+
+define Build/Configure
+       # Failed configure.sh leaves stub config.h around.
+       rm -f $(PKG_BUILD_DIR)/config.h
+       (cd $(PKG_BUILD_DIR) && yes $$$$'\n' | ./configure.sh config.in )
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default,mii-tool)
+endef
+
+define Package/mii-tool/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/mii-tool $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,mii-tool))
diff --git a/net/mini_httpd/Makefile b/net/mini_httpd/Makefile
new file mode 100644 (file)
index 0000000..842b571
--- /dev/null
@@ -0,0 +1,189 @@
+#
+# Copyright (C) 2006 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:=mini-httpd
+PKG_VERSION:=1.19
+PKG_RELEASE:=1
+
+PKG_SOURCE:=mini_httpd-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.acme.com/software/mini_httpd/
+PKG_MD5SUM:=792a529dfe974355aad8ba6c80e54e7a
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/mini_httpd-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mini-httpd/Default
+  SUBMENU:=Web Servers/Proxies
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A small web server
+  URL:=http://www.acme.com/software/mini_httpd/
+endef
+
+define Package/mini-httpd/Default/conffiles
+/etc/mini_httpd.conf
+/etc/default/mini_httpd
+endef
+
+define Package/mini-httpd/Default/description
+ mini_httpd is a small HTTP server. Its performance is not great, but for
+ low or medium traffic sites it's quite adequate. It implements all the
+ basic features of an HTTP server, including:
+ - GET, HEAD, and POST methods
+ - CGI
+ - Basic authentication
+ - Security against ".." filename snooping
+ - The common MIME types
+ - Trailing-slash redirection
+ - index.html, index.htm, index.cgi
+ - Directory listings
+ - Multihoming / virtual hosting
+ - Standard logging
+ - Custom error pages
+ It can also be configured to do IPv6.
+endef
+
+define Package/mini-httpd
+$(call Package/mini-httpd/Default)
+endef
+
+define Package/mini-httpd/conffiles
+$(call Package/mini-httpd/Default/conffiles)
+endef
+
+define Package/mini-httpd/description
+$(call Package/mini-httpd/Default/description)
+endef
+
+define Package/mini-httpd-matrixssl
+$(call Package/mini-httpd/Default)
+  DEPENDS:= +libmatrixssl
+  TITLE+= (built with MatrixSSL)
+endef
+
+define Package/mini-httpd-matrixssl/conffiles
+$(call Package/mini-httpd/Default/conffiles)
+/etc/mini_httpd.pem
+endef
+
+define Package/mini-httpd-matrixssl/description
+$(call Package/mini-httpd/Default/description)
+ This package is built with SSL/HTTPS using MatrixSSL.
+endef
+
+define Package/mini-httpd-openssl
+$(call Package/mini-httpd/Default)
+  DEPENDS:= +libopenssl
+  TITLE+= (built with OpenSSL)
+endef
+
+define Package/mini-httpd-openssl/conffiles
+$(call Package/mini-httpd/Default/conffiles)
+/etc/mini_httpd.pem
+endef
+
+define Package/mini-httpd-openssl/description
+$(call Package/mini-httpd/Default/description)
+ This package is built with SSL/HTTPS using OpenSSL.
+endef
+
+define Package/mini-httpd-htpasswd
+  $(call Package/mini-httpd/Default)
+  TITLE:=Utility to generate HTTP access files
+endef
+
+define Package/mini-httpd-htpasswd/description
+$(call Package/mini-httpd/Default/description)
+ This package generates .htaccess/.htpasswd files to use HTTP access authentication.
+endef
+
+
+define Build/Template
+
+$(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
+       -$(MAKE) -C $(PKG_BUILD_DIR) clean
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               OFLAGS="$(TARGET_CFLAGS)" \
+               $(3) \
+               all
+       ( cd $(PKG_BUILD_DIR); mv -f mini_httpd mini_httpd-$(2) )
+       touch $$@
+
+$(STAMP_BUILT): $(STAMP_BUILT)-$(2)
+
+define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/etc
+ifeq ($(2),without-ssl)
+       $(INSTALL_DATA) ./files/mini_httpd.conf $$(1)/etc/mini_httpd.conf
+else
+       $(INSTALL_DATA) ./files/mini_httpd-ssl.conf $$(1)/etc/mini_httpd.conf
+       $(INSTALL_CONF) ./files/mini_httpd.pem $$(1)/etc/mini_httpd.pem
+endif
+       $(INSTALL_DIR) $$(1)/etc/default
+       $(INSTALL_DATA) ./files/mini_httpd.default $$(1)/etc/default/mini_httpd
+       $(INSTALL_DIR) $$(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mini_httpd.init $$(1)/etc/init.d/mini_httpd
+       $(INSTALL_DIR) $$(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mini_httpd-$(2) $$(1)/usr/sbin/mini_httpd
+endef
+
+endef
+
+
+define Build/Prepare
+$(call Build/Prepare/Default)
+       $(CP) ./files/matrixssl_helper.{c,h} $(PKG_BUILD_DIR)/
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+# always build without SSL because we might need htpassd
+define Build/without-ssl
+  $(call Build/Template,mini-httpd,without-ssl,)
+endef
+$(eval $(Build/without-ssl))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_mini-httpd-matrixssl),)
+  define Build/with-matrixssl
+    $(call Build/Template,mini-httpd-matrixssl,with-matrixssl, \
+               SSL_DEFS="-DUSE_SSL -DHAVE_MATRIXSSL" \
+               SSL_INC="$(TARGET_CPPFLAGS)" \
+               SSL_LIBS="$(TARGET_LDFLAGS) -lmatrixssl" \
+               SSL_OBJS="matrixssl_helper.o" \
+    )
+  endef
+endif
+$(eval $(Build/with-matrixssl))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_mini-httpd-openssl),)
+  define Build/with-openssl
+    $(call Build/Template,mini-httpd-openssl,with-openssl, \
+               SSL_DEFS="-DUSE_SSL -DHAVE_OPENSSL" \
+               SSL_INC="$(TARGET_CPPFLAGS)" \
+               SSL_LIBS="$(TARGET_LDFLAGS) -lcrypto -lssl" \
+    )
+  endef
+endif
+$(eval $(Build/with-openssl))
+
+define Package/mini-httpd-htpasswd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/htpasswd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,mini-httpd))
+$(eval $(call BuildPackage,mini-httpd-matrixssl))
+$(eval $(call BuildPackage,mini-httpd-openssl))
+$(eval $(call BuildPackage,mini-httpd-htpasswd))
diff --git a/net/mini_httpd/files/matrixssl_helper.c b/net/mini_httpd/files/matrixssl_helper.c
new file mode 100644 (file)
index 0000000..e3fe334
--- /dev/null
@@ -0,0 +1,455 @@
+/*
+ * MatrixSSL helper functions
+ *
+ * Copyright (C) 2005 Nicolas Thill <nthill@free.fr>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Portions borrowed from MatrixSSL example code
+ *
+ */
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include "matrixssl_helper.h"
+
+#define SSL_SOCKET_EOF  0x0001
+#define SSL_SOCKET_CLOSE_NOTIFY  0x0002
+
+#define min(a, b)  ( (a) < (b) ) ? (a) : (b)
+
+static int _ssl_read(SSL *ssl, char *buf, int len);
+static int _ssl_write(SSL *ssl, char *buf, int len);
+static void _ssl_setSocketBlock(int fd);
+static void _ssl_setSocketNonblock(int fd);
+static void _ssl_closeSocket(int fd);
+
+
+SSL * SSL_new(sslKeys_t *keys)
+{
+       SSL * ssl;
+       ssl = (SSL *)malloc(sizeof(SSL));
+       
+       if (!ssl) return 0;
+       
+       ssl->keys = keys;
+       if ( matrixSslNewSession(&(ssl->ssl), ssl->keys, NULL, SSL_FLAGS_SERVER) < 0 ) {
+       }
+       
+       ssl->insock.size = 1024;
+       ssl->insock.buf = ssl->insock.start = ssl->insock.end =
+               (unsigned char *)malloc(ssl->insock.size);
+       
+       ssl->outsock.size = 1024;
+       ssl->outsock.buf = ssl->outsock.start = ssl->outsock.end = 
+               (unsigned char *)malloc(ssl->outsock.size);
+       
+       ssl->inbuf.size = 0;
+       ssl->inbuf.buf = ssl->inbuf.start = ssl->inbuf.end = NULL;
+       
+       return ssl;
+}
+
+
+int SSL_accept(SSL *ssl) {
+
+       unsigned char buf[1024];
+       int status, rc;
+       
+readMore:
+       rc = _ssl_read(ssl, buf, sizeof(buf));
+       if (rc == 0) {
+               if (ssl->status == SSL_SOCKET_EOF || ssl->status == SSL_SOCKET_CLOSE_NOTIFY) {
+                       SSL_free(ssl);
+                       return -1;
+               }
+               if (matrixSslHandshakeIsComplete(ssl->ssl) == 0) {
+                       goto readMore;
+               }
+       } else if (rc > 0) {
+               return 0;
+       } else {
+               SSL_free(ssl);
+               return -1;
+       }
+       
+       return 1;
+}
+
+
+void SSL_set_fd(SSL *ssl, int fd) {
+       ssl->fd = fd;
+}
+
+
+int SSL_read(SSL *ssl, char *buf, int len) {
+       int rc;
+readMore:
+       rc = _ssl_read(ssl, buf, len);
+       if (rc <= 0) {
+               if (rc < 0 || ssl->status == SSL_SOCKET_EOF || ssl->status == SSL_SOCKET_CLOSE_NOTIFY) {
+                       _ssl_closeSocket(ssl->fd);
+                       return rc;
+               }
+               goto readMore;
+       }
+       return rc;
+}
+
+
+int SSL_write(SSL *ssl, char *buf, int len) {
+       int rc;
+writeMore:
+       rc = _ssl_write(ssl, buf, len);
+       if (rc <= 0) {
+               if (rc < 0) {
+                       return rc;
+               }
+               goto writeMore;
+       }
+       return rc;
+}
+
+
+void SSL_free(SSL * ssl)
+{
+       matrixSslDeleteSession(ssl->ssl);
+       if (ssl->insock.buf) {
+               free(ssl->insock.buf);
+       }
+       if (ssl->outsock.buf) {
+               free(ssl->outsock.buf);
+       }
+       if (ssl->inbuf.buf) {
+               free(ssl->inbuf.buf);
+       }
+       free(ssl);
+}
+
+
+
+static void _ssl_setSocketBlock(int fd)
+{
+       fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK);
+       fcntl(fd, F_SETFD, FD_CLOEXEC);
+}
+
+
+static void _ssl_setSocketNonblock(int fd)
+{
+       fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
+}
+
+
+static void _ssl_closeSocket(int fd)
+{
+       char buf[32];
+
+       if (fd != -1) {
+               _ssl_setSocketNonblock(fd);
+               if (shutdown(fd, 1) >= 0) {
+                       while (recv(fd, buf, sizeof(buf), 0) > 0);
+               }
+               close(fd);
+       }
+}
+
+
+static int _ssl_read(SSL *ssl, char *buf, int len)
+{
+       int bytes, rc, remaining;
+       unsigned char error, alertLevel, alertDescription, performRead;
+
+       ssl->status = 0;
+
+       if (ssl->ssl == NULL || len <= 0) {
+               return -1;
+       }
+/*
+       If inbuf is valid, then we have previously decoded data that must be
+       returned, return as much as possible.  Once all buffered data is
+       returned, free the inbuf.
+*/
+       if (ssl->inbuf.buf) {
+               if (ssl->inbuf.start < ssl->inbuf.end) {
+                       remaining = (int)(ssl->inbuf.end - ssl->inbuf.start);
+                       bytes = (int)min(len, remaining);
+                       memcpy(buf, ssl->inbuf.start, bytes);
+                       ssl->inbuf.start += bytes;
+                       return bytes;
+               }
+               free(ssl->inbuf.buf);
+               ssl->inbuf.buf = NULL;
+       }
+/*
+       Pack the buffered socket data (if any) so that start is at zero.
+*/
+       if (ssl->insock.buf < ssl->insock.start) {
+               if (ssl->insock.start == ssl->insock.end) {
+                       ssl->insock.start = ssl->insock.end = ssl->insock.buf;
+               } else {
+                       memmove(ssl->insock.buf, ssl->insock.start, ssl->insock.end - ssl->insock.start);
+                       ssl->insock.end -= (ssl->insock.start - ssl->insock.buf);
+                       ssl->insock.start = ssl->insock.buf;
+               }
+       }
+/*
+       Read up to as many bytes as there are remaining in the buffer.  We could
+       Have encrypted data already cached in conn->insock, but might as well read more
+       if we can.
+*/
+       performRead = 0;
+readMore:
+       if (ssl->insock.end == ssl->insock.start || performRead) {
+               performRead = 1;
+               bytes = recv(ssl->fd, (char *)ssl->insock.end, 
+                       (int)((ssl->insock.buf + ssl->insock.size) - ssl->insock.end), MSG_NOSIGNAL);
+               if (bytes == -1) {
+                       ssl->status = errno;
+                       return -1;
+               }
+               if (bytes == 0) {
+                       ssl->status = SSL_SOCKET_EOF;
+                       return 0;
+               }
+               ssl->insock.end += bytes;
+       }
+/*
+       Define a temporary sslBuf
+*/
+       ssl->inbuf.start = ssl->inbuf.end = ssl->inbuf.buf = (unsigned char *)malloc(len);
+       ssl->inbuf.size = len;
+/*
+       Decode the data we just read from the socket
+*/
+decodeMore:
+       error = 0;
+       alertLevel = 0;
+       alertDescription = 0;
+
+       rc = matrixSslDecode(ssl->ssl, &ssl->insock, &ssl->inbuf, &error, &alertLevel, 
+               &alertDescription);
+       switch (rc) {
+/*
+       Successfully decoded a record that did not return data or require a response.
+*/
+       case SSL_SUCCESS:
+               return 0;
+/*
+       Successfully decoded an application data record, and placed in tmp buf
+*/
+       case SSL_PROCESS_DATA:
+/*
+               Copy as much as we can from the temp buffer into the caller's buffer
+               and leave the remainder in conn->inbuf until the next call to read
+               It is possible that len > data in buffer if the encoded record
+               was longer than len, but the decoded record isn't!
+*/
+               rc = (int)(ssl->inbuf.end - ssl->inbuf.start);
+               rc = min(rc, len);
+               memcpy(buf, ssl->inbuf.start, rc);
+               ssl->inbuf.start += rc;
+               return rc;
+/*
+       We've decoded a record that requires a response into tmp
+       If there is no data to be flushed in the out buffer, we can write out
+       the contents of the tmp buffer.  Otherwise, we need to append the data 
+       to the outgoing data buffer and flush it out.
+*/
+       case SSL_SEND_RESPONSE:
+               bytes = send(ssl->fd, (char *)ssl->inbuf.start, 
+                       (int)(ssl->inbuf.end - ssl->inbuf.start), MSG_NOSIGNAL);
+               if (bytes == -1) {
+                       ssl->status = errno;
+                       if (ssl->status != EAGAIN) {
+                               goto readError;
+                       }
+                       ssl->status = 0;
+               }
+               ssl->inbuf.start += bytes;
+               if (ssl->inbuf.start < ssl->inbuf.end) {
+/*
+                       This must be a non-blocking socket since it didn't all get sent
+                       out and there was no error.  We want to finish the send here
+                       simply because we are likely in the SSL handshake.
+*/
+                       _ssl_setSocketBlock(ssl->fd);
+                       bytes = send(ssl->fd, (char *)ssl->inbuf.start, 
+                               (int)(ssl->inbuf.end - ssl->inbuf.start), MSG_NOSIGNAL);
+                       if (bytes == -1) {
+                               ssl->status = errno;
+                               goto readError;
+                       }
+                       ssl->inbuf.start += bytes;
+/*
+                       Can safely set back to non-blocking because we wouldn't
+                       have got here if this socket wasn't non-blocking to begin with.
+*/
+                       _ssl_setSocketNonblock(ssl->fd);
+               }
+               ssl->inbuf.start = ssl->inbuf.end = ssl->inbuf.buf;
+               return 0;
+/*
+       There was an error decoding the data, or encoding the out buffer.
+       There may be a response data in the out buffer, so try to send.
+       We try a single hail-mary send of the data, and then close the socket.
+       Since we're closing on error, we don't worry too much about a clean flush.
+*/
+       case SSL_ERROR:
+               if (ssl->inbuf.start < ssl->inbuf.end) {
+                       _ssl_setSocketNonblock(ssl->fd);
+                       bytes = send(ssl->fd, (char *)ssl->inbuf.start, 
+                               (int)(ssl->inbuf.end - ssl->inbuf.start), MSG_NOSIGNAL);
+               }
+               goto readError;
+/*
+       We've decoded an alert.  The level and description passed into
+       matrixSslDecode are filled in with the specifics.
+*/
+       case SSL_ALERT:
+               if (alertDescription == SSL_ALERT_CLOSE_NOTIFY) {
+                       ssl->status = SSL_SOCKET_CLOSE_NOTIFY;
+                       goto readZero;
+               }
+               goto readError;
+/*
+       We have a partial record, we need to read more data off the socket.
+       If we have a completely full conn->insock buffer, we'll need to grow it
+       here so that we CAN read more data when called the next time.
+*/
+       case SSL_PARTIAL:
+               if (ssl->insock.start == ssl->insock.buf && ssl->insock.end == 
+                               (ssl->insock.buf + ssl->insock.size)) {
+                       if (ssl->insock.size > SSL_MAX_BUF_SIZE) {
+                               goto readError;
+                       }
+                       ssl->insock.size *= 2;
+                       ssl->insock.start = ssl->insock.buf = 
+                               (unsigned char *)realloc(ssl->insock.buf, ssl->insock.size);
+                       ssl->insock.end = ssl->insock.buf + (ssl->insock.size / 2);
+               }
+               if (!performRead) {
+                       performRead = 1;
+                       free(ssl->inbuf.buf);
+                       ssl->inbuf.buf = NULL;
+                       goto readMore;
+               } else {
+                       goto readZero;
+               }
+/*
+       The out buffer is too small to fit the decoded or response
+       data.  Increase the size of the buffer and call decode again
+*/
+       case SSL_FULL:
+               ssl->inbuf.size *= 2;
+               if (ssl->inbuf.buf != (unsigned char*)buf) {
+                       free(ssl->inbuf.buf);
+                       ssl->inbuf.buf = NULL;
+               }
+               ssl->inbuf.start = ssl->inbuf.end = ssl->inbuf.buf = 
+                       (unsigned char *)malloc(ssl->inbuf.size);
+               goto decodeMore;
+       }
+/*
+       We consolidated some of the returns here because we must ensure
+       that conn->inbuf is cleared if pointing at caller's buffer, otherwise
+       it will be freed later on.
+*/
+readZero:
+       if (ssl->inbuf.buf == (unsigned char*)buf) {
+               ssl->inbuf.buf = NULL;
+       }
+       return 0;
+readError:
+       if (ssl->inbuf.buf == (unsigned char*)buf) {
+               ssl->inbuf.buf = NULL;
+       }
+       return -1;
+}
+
+
+int _ssl_write(SSL *ssl, char *buf, int len)
+{
+       int             rc;
+
+       ssl->status = 0;
+/*
+       Pack the buffered socket data (if any) so that start is at zero.
+*/
+       if (ssl->outsock.buf < ssl->outsock.start) {
+               if (ssl->outsock.start == ssl->outsock.end) {
+                       ssl->outsock.start = ssl->outsock.end = ssl->outsock.buf;
+               } else {
+                       memmove(ssl->outsock.buf, ssl->outsock.start, ssl->outsock.end - ssl->outsock.start);
+                       ssl->outsock.end -= (ssl->outsock.start - ssl->outsock.buf);
+                       ssl->outsock.start = ssl->outsock.buf;
+               }
+       }
+/*
+       If there is buffered output data, the caller must be trying to
+       send the same amount of data as last time.  We don't support 
+       sending additional data until the original buffered request has
+       been completely sent.
+*/
+       if (ssl->outBufferCount > 0 && len != ssl->outBufferCount) {
+               return -1;
+       }
+/*
+       If we don't have buffered data, encode the caller's data
+*/
+       if (ssl->outBufferCount == 0) {
+retryEncode:
+               rc = matrixSslEncode(ssl->ssl, (unsigned char *)buf, len, &ssl->outsock);
+               switch (rc) {
+               case SSL_ERROR:
+                       return -1;
+               case SSL_FULL:
+                       if (ssl->outsock.size > SSL_MAX_BUF_SIZE) {
+                               return -1;
+                       }
+                       ssl->outsock.size *= 2;
+                       ssl->outsock.buf = 
+                               (unsigned char *)realloc(ssl->outsock.buf, ssl->outsock.size);
+                       ssl->outsock.end = ssl->outsock.buf + (ssl->outsock.end - ssl->outsock.start);
+                       ssl->outsock.start = ssl->outsock.buf;
+                       goto retryEncode;
+               }
+       }
+/*
+       We've got data to send.
+*/
+       rc = send(ssl->fd, (char *)ssl->outsock.start, 
+               (int)(ssl->outsock.end - ssl->outsock.start), MSG_NOSIGNAL);
+       if (rc == -1) {
+               ssl->status = errno;
+               return -1;
+       }
+       ssl->outsock.start += rc;
+/*
+       If we wrote it all return the length, otherwise remember the number of
+       bytes passed in, and return 0 to be called again later.
+*/
+       if (ssl->outsock.start == ssl->outsock.end) {
+               ssl->outBufferCount = 0;
+               return len;
+       }
+       ssl->outBufferCount = len;
+       return 0;
+}
+
diff --git a/net/mini_httpd/files/matrixssl_helper.h b/net/mini_httpd/files/matrixssl_helper.h
new file mode 100644 (file)
index 0000000..e5854df
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * MatrixSSL helper functions
+ *
+ * Copyright (C) 2005 Nicolas Thill <nthill@free.fr>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MATRIXSSL_HELPER_H__
+#define __MATRIXSSL_HELPER_H__
+
+#include <matrixSsl/matrixSsl.h>
+
+typedef struct __SSL {
+  int fd;
+  ssl_t *ssl;
+  sslKeys_t *keys;
+  sslBuf_t insock, outsock, inbuf;
+  int outBufferCount;
+  int partial;
+  int status;
+} SSL;
+
+SSL * SSL_new(sslKeys_t *keys);
+void SSL_set_fd(SSL *ssl, int fd);
+int SSL_accept(SSL *ssl);
+int SSL_read(SSL *ssl, char *b, int len);
+int SSL_write(SSL *ssl, char *buf, int len);
+void SSL_free(SSL *ssl);
+
+#endif /* __MATRIXSSL_HELPER_H__ */
diff --git a/net/mini_httpd/files/mini_httpd-ssl.conf b/net/mini_httpd/files/mini_httpd-ssl.conf
new file mode 100644 (file)
index 0000000..1cd7022
--- /dev/null
@@ -0,0 +1,7 @@
+cgipat=cgi-bin/**|**.sh
+dir=/www
+nochroot
+pidfile=/var/run/mini_httpd.pid
+user=root
+ssl
+certfile=/etc/mini_httpd.pem
diff --git a/net/mini_httpd/files/mini_httpd.conf b/net/mini_httpd/files/mini_httpd.conf
new file mode 100644 (file)
index 0000000..d636a43
--- /dev/null
@@ -0,0 +1,5 @@
+cgipat=cgi-bin/**|**.sh
+dir=/www
+nochroot
+pidfile=/var/run/mini_httpd.pid
+user=root
diff --git a/net/mini_httpd/files/mini_httpd.default b/net/mini_httpd/files/mini_httpd.default
new file mode 100644 (file)
index 0000000..85b229e
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-C /etc/mini_httpd.conf"
diff --git a/net/mini_httpd/files/mini_httpd.init b/net/mini_httpd/files/mini_httpd.init
new file mode 100644 (file)
index 0000000..4e0a3a7
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+BIN=mini_httpd
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+[ -f $DEFAULT ] && . $DEFAULT
+
+start() {
+       [ -d $RUN_D ] || mkdir -p $RUN_D
+       $BIN $OPTIONS 2>/dev/null
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
diff --git a/net/mini_httpd/files/mini_httpd.pem b/net/mini_httpd/files/mini_httpd.pem
new file mode 100644 (file)
index 0000000..8a1241a
--- /dev/null
@@ -0,0 +1,29 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXgIBAAKBgQC5rFJOQakwMmF9aoVnAXaQLOOPoYOEk19/ls9VZt1ZqfzQuTbG
+GGrgMIDclB0kHMFvSbzeiVjMnrSdQTNe1gOQAGtHhHiqugrLqH9m3wqOerbf/Yir
+hic9U6X9RaWC6BzNgcYU1QtPn1sDtbMNFAB6jzF3W76EIlHEobgMtfqtxwIDAQAB
+AoGBAKJst9eToyDxgc1ICQlSA1kem7eDUF0C2xDvadLI2KxegzZIQD1NEPmsFJ5h
+x5hWu3TSabG3LwJZd6D1b63vxE6QRMhcDG3idb7kXzhOOZyfnlnrBtJ3VJC/UH5H
+O1pMMBxcu2fXrua+h7BW0gMoZhchvsArDoWaZPjNUNHiNRYBAkEA3Ngnge7njqlf
+/UlLkQHHfxgorQ78GjOzrrUvz86pFtW8RKCjAv55HIqAhWrSgxWF4yXkPO2XOHC9
+KTeVKccjAQJBANc63r3M3yP817cPzyo/8BJQD9nAzmolrsBf1YMxML20UmEbObax
+QdmxoYu/a8tOD4gT6EZDkauJU0yS69HGeMcCQQCvRmbkuuXQ1iC29+sfpVfeSSBP
+aaswaIRdTrQprA2LcAtCNHPsNmeM/WfPe96j5vsiMrqYmMECLIgVJGYgiEoBAkEA
+kzg1e+ZTC667bwBlWCT79crFzNDRYFH+QqBKz74p9NkPMFULGSgOPvX95jU9aocu
+oInda5J0Zb09OTeWDpuPqQJAUIeY36WUst7NaW40mZXkMjjR2QtWi7P4cmv7nLp0
+WdPQzkUW1Bv4sSUQ7svQqpmZPaFiyhXL1VSa1M5MPd3tbA==
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIICOTCCAaKgAwIBAgIJANRuTbnzy8ObMA0GCSqGSIb3DQEBBAUAMFMxCzAJBgNV
+BAYTAkZSMQ4wDAYDVQQIEwVQYXJpczEOMAwGA1UEBxMFUGFyaXMxEDAOBgNVBAoT
+B015IEhvbWUxEjAQBgNVBAMTCU15IFJvdXRlcjAeFw0wNTAxMTQwMjQzMjdaFw0w
+NjAxMTQwMjQzMjdaMFMxCzAJBgNVBAYTAkZSMQ4wDAYDVQQIEwVQYXJpczEOMAwG
+A1UEBxMFUGFyaXMxEDAOBgNVBAoTB015IEhvbWUxEjAQBgNVBAMTCU15IFJvdXRl
+cjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuaxSTkGpMDJhfWqFZwF2kCzj
+j6GDhJNff5bPVWbdWan80Lk2xhhq4DCA3JQdJBzBb0m83olYzJ60nUEzXtYDkABr
+R4R4qroKy6h/Zt8Kjnq23/2Iq4YnPVOl/UWlgugczYHGFNULT59bA7WzDRQAeo8x
+d1u+hCJRxKG4DLX6rccCAwEAAaMVMBMwEQYJYIZIAYb4QgEBBAQDAgZAMA0GCSqG
+SIb3DQEBBAUAA4GBAErI3QmcZVzjxKcoPTO3z8cRJV87SVFp0qbIjbYCBDUWB1QY
+/bMkQPr2zJyfJmUYLEs4iKgHrmlaUCMHy9NZKOg9ZxrW42BtQ5QnOtDm3UifwzJW
+oCFC3uPWfTYsZn/FrUXlErds+xXXT63VJzBe6DdXwHcdcdxzl05oIyL9JIzI
+-----END CERTIFICATE-----
diff --git a/net/mini_httpd/patches/001-cgi_path.patch b/net/mini_httpd/patches/001-cgi_path.patch
new file mode 100644 (file)
index 0000000..c847d94
--- /dev/null
@@ -0,0 +1,16 @@
+diff -ruN mini_httpd-1.19-old/mini_httpd.c mini_httpd-1.19-new/mini_httpd.c
+--- mini_httpd-1.19-old/mini_httpd.c   2005-10-19 01:11:24.000000000 +0200
++++ mini_httpd-1.19-new/mini_httpd.c   2005-10-19 01:13:05.000000000 +0200
+@@ -138,10 +138,10 @@
+ #define CGI_NICE 10
+ #endif /* CGI_NICE */
+ #ifndef CGI_PATH
+-#define CGI_PATH "/usr/local/bin:/usr/ucb:/bin:/usr/bin"
++#define CGI_PATH "/usr/bin:/bin:/usr/sbin:/sbin"
+ #endif /* CGI_PATH */
+ #ifndef CGI_LD_LIBRARY_PATH
+-#define CGI_LD_LIBRARY_PATH "/usr/local/lib:/usr/lib"
++#define CGI_LD_LIBRARY_PATH "/usr/lib:/lib"
+ #endif /* CGI_LD_LIBRARY_PATH */
+ #ifndef AUTH_FILE
+ #define AUTH_FILE ".htpasswd"
diff --git a/net/mini_httpd/patches/500-matrixssl.patch b/net/mini_httpd/patches/500-matrixssl.patch
new file mode 100644 (file)
index 0000000..0ab8d68
--- /dev/null
@@ -0,0 +1,161 @@
+diff -ruN mini_httpd-1.19-orig/Makefile mini_httpd-1.19-3/Makefile
+--- mini_httpd-1.19-orig/Makefile      2002-11-02 00:02:57.000000000 +0100
++++ mini_httpd-1.19-3/Makefile 2005-03-09 08:52:21.000000000 +0100
+@@ -14,17 +14,30 @@
+ # http://www.openssl.org/  Make sure the SSL_TREE definition points to the
+ # tree with your OpenSSL installation - depending on how you installed it,
+ # it may be in /usr/local instead of /usr/local/ssl.
++
++# OpenSSL
+ #SSL_TREE =   /usr/local/ssl
+ #SSL_DEFS =   -DUSE_SSL
+ #SSL_INC =    -I${SSL_TREE}/include
+ #SSL_LIBS =   -L${SSL_TREE}/lib -lssl -lcrypto
++#SSL_OBJS =
++
++# MatrixSSL
++#SSL_TREE =
++#SSL_DEFS =   -DUSE_SSL -DHAVE_MATRIXSSL
++#SSL_INC =
++#SSL_LIBS =   -lmatrixssl
++#SSL_OBJS =   matrixssl_helper.o
+-BINDIR =      /usr/local/sbin
+-MANDIR =      /usr/local/man
++DESTDIR =
++
++BINDIR =      $(DESTDIR)/usr/sbin
++MANDIR =      $(DESTDIR)/usr/share/man
+ CC =          gcc
+ CDEFS =               ${SSL_DEFS} ${SSL_INC}
+-CFLAGS =      -O ${CDEFS}
++OFLAGS =      -O
++CFLAGS =      ${OFLAGS} ${CDEFS}
+ #CFLAGS =     -g ${CDEFS}
+-LDFLAGS =     -s
++LDFLAGS =
+ #LDFLAGS =    -g
+@@ -32,12 +45,15 @@
+ all:          mini_httpd htpasswd
+-mini_httpd:   mini_httpd.o match.o tdate_parse.o
+-      ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${LDLIBS} -o mini_httpd
++mini_httpd:   mini_httpd.o match.o tdate_parse.o ${SSL_OBJS}
++      ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${SSL_OBJS} ${LDLIBS} -o mini_httpd
+ mini_httpd.o: mini_httpd.c version.h port.h match.h tdate_parse.h mime_encodings.h mime_types.h
+       ${CC} ${CFLAGS} -c mini_httpd.c
++matrixssl_helper.o: matrixssl_helper.c
++      ${CC} ${CFLAGS} -c matrixssl_helper.c
++      
+ match.o:      match.c match.h
+       ${CC} ${CFLAGS} -c match.c
+@@ -71,16 +87,18 @@
+       chmod 600 mini_httpd.pem
+-install:      all
+-      rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd
++install:      all uninstall
+       -mkdir -p ${BINDIR}
+       cp mini_httpd htpasswd ${BINDIR}
+-      rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1
+       -mkdir -p ${MANDIR}/man8
+       cp mini_httpd.8 ${MANDIR}/man8
+       -mkdir -p ${MANDIR}/man1
+       cp htpasswd.1 ${MANDIR}/man1
++uninstall:
++      rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd
++      rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1
++
+ clean:
+       rm -f mini_httpd mime_encodings.h mime_types.h htpasswd mini_httpd.rnd *.o core core.* *.core
+diff -ruN mini_httpd-1.19-orig/mini_httpd.c mini_httpd-1.19-3/mini_httpd.c
+--- mini_httpd-1.19-orig/mini_httpd.c  2003-12-03 19:27:22.000000000 +0100
++++ mini_httpd-1.19-3/mini_httpd.c     2005-03-09 08:46:28.000000000 +0100
+@@ -66,8 +66,14 @@
+ #endif /* HAVE_SENDFILE */
+ #ifdef USE_SSL
++# ifdef HAVE_OPENSSL
+ #include <openssl/ssl.h>
+ #include <openssl/err.h>
++# else /* HAVE_OPENSSL */
++#  ifdef HAVE_MATRIXSSL
++#   include "matrixssl_helper.h"
++#  endif /* HAVE_MATRIXSSL */
++# endif /* HAVE_OPENSSL */
+ #endif /* USE_SSL */
+ extern char* crypt( const char* key, const char* setting );
+@@ -193,7 +199,13 @@
+ static int do_ssl;
+ static char* certfile;
+ static char* cipher;
++#ifdef HAVE_OPENSSL
+ static SSL_CTX* ssl_ctx;
++#else /* HAVE_OPENSSL */
++ #ifdef HAVE_MATRIXSSL
++static sslKeys_t* keys;
++ #endif /* HAVE_MATRIXSSL */
++#endif /* HAVE_OPENSSL */
+ #endif /* USE_SSL */
+ static char cwd[MAXPATHLEN];
+ static int got_hup;
+@@ -540,6 +552,7 @@
+ #ifdef USE_SSL
+     if ( do_ssl )
+       {
++# ifdef HAVE_OPENSSL
+       SSL_load_error_strings();
+       SSLeay_add_ssl_algorithms();
+       ssl_ctx = SSL_CTX_new( SSLv23_server_method() );
+@@ -559,6 +572,17 @@
+               exit( 1 );
+               }
+           }
++# else /* HAVE_OPENSSL */
++#  ifdef HAVE_MATRIXSSL
++      matrixSslOpen();
++      if ( matrixSslReadKeys( &keys, certfile, certfile, NULL, NULL ) < 0 )
++          {
++          syslog( LOG_CRIT, "can't load certificate and/or private key\n");
++          (void) fprintf( stderr, "%s: can't load certificate and/or private key\n", argv0 );
++          exit( 1 );
++          }
++#  endif /* HAVE_MATRIXSSL */
++# endif /* HAVE_OPENSSL */
+       }
+ #endif /* USE_SSL */
+@@ -1174,6 +1198,7 @@
+ #ifdef USE_SSL
+     if ( do_ssl )
+       {
++# ifdef HAVE_OPENSSL
+       ssl = SSL_new( ssl_ctx );
+       SSL_set_fd( ssl, conn_fd );
+       if ( SSL_accept( ssl ) == 0 )
+@@ -1181,6 +1206,16 @@
+           ERR_print_errors_fp( stderr );
+           exit( 1 );
+           }
++# else /* HAVE_OPENSSL */
++#  ifdef HAVE_MATRIXSSL
++      ssl = SSL_new(keys);
++      SSL_set_fd( ssl, conn_fd );
++      if ( SSL_accept( ssl ) <= 0 )
++          {
++          perror( "SSL_accept" );
++          }
++#  endif /* HAVE_MATRIXSSL */
++# endif /* HAVE_OPENSSL */
+       }
+ #endif /* USE_SSL */
diff --git a/net/mini_snmpd/Makefile b/net/mini_snmpd/Makefile
new file mode 100644 (file)
index 0000000..e4a77b5
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2009-2014 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:=mini_snmpd
+PKG_VERSION:=1.2b
+PKG_RELEASE:=8
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://members.aon.at/linuxfreak/linux/
+PKG_MD5SUM:=9e432c50ba8216d7fab0983b11b7112a
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mini-snmpd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=SNMP server for embedded systems
+  URL:=http://members.aon.at/linuxfreak/linux/mini_snmpd.html
+endef
+
+ifneq ($(CONFIG_IPV6),)
+  TARGET_CFLAGS+= -D__IPV6__
+else
+  TARGET_CFLAGS+= -D__IPV4__
+endif
+
+TARGET_CFLAGS+= -DSYSLOG
+
+MAKE_FLAGS+= \
+       OFLAGS="$(TARGET_CFLAGS)" \
+       STRIP="/bin/true" \
+       INSTALL_ROOT="$(PKG_INSTALL_DIR)"
+
+define Build/Compile
+       $(call Build/Compile/Default,mini_snmpd)
+endef
+
+define Package/mini-snmpd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/sbin/mini_snmpd $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/mini_snmpd.config $(1)/etc/config/mini_snmpd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mini_snmpd.init $(1)/etc/init.d/mini_snmpd
+endef
+
+define Package/mini-snmpd/conffiles
+/etc/config/mini_snmpd
+endef
+
+$(eval $(call BuildPackage,mini-snmpd))
diff --git a/net/mini_snmpd/files/mini_snmpd.config b/net/mini_snmpd/files/mini_snmpd.config
new file mode 100644 (file)
index 0000000..e41bdc9
--- /dev/null
@@ -0,0 +1,16 @@
+config mini_snmpd
+       option enabled 0
+       option ipv6 0
+       option community 'public'
+       option contact ''
+       option location ''
+
+       # enable basic disk usage statistics on specified mountpoint
+       list disks '/jffs'
+       list disks '/tmp'
+
+       # enable basic network statistics on specified interface
+       # 4 interfaces maximum, as named in /etc/config/network
+       list interfaces 'loopback'
+       list interfaces 'lan'
+       list interfaces 'wan'
diff --git a/net/mini_snmpd/files/mini_snmpd.init b/net/mini_snmpd/files/mini_snmpd.init
new file mode 100644 (file)
index 0000000..20e2c62
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2012 OpenWrt.org
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+append_disk() {
+       local disk="$1"
+       append disks "$disk" ','
+}
+
+append_interface() {
+       local name="$1"
+       local device
+       network_get_device device "$name"
+       append interfaces "${device:-$name}" ','
+}
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3 $_val"
+}
+
+start_instance() {
+       local cfg="$1"
+       local args=""
+       local disks=""
+       local interfaces=""
+       local ipv6
+
+       append_string "$cfg" community "-c"
+       append_string "$cfg" location "-L"
+       append_string "$cfg" contact "-C"
+
+       config_get_bool ipv6 "$cfg" "ipv6" '0'
+       [ "$ipv6" -gt 0 ] && append args "-6"
+
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] || return 1
+
+       config_list_foreach "$section" 'disks' append_disk
+       args="${args}${disks:+ -d $disks}"
+
+       config_list_foreach "$section" 'interfaces' append_interface
+       args="${args}${interfaces:+ -i $interfaces}"
+
+       service_start /usr/bin/mini_snmpd $args
+}
+
+start() {
+       . /lib/functions/network.sh
+
+       config_load 'mini_snmpd'
+       config_foreach start_instance 'mini_snmpd'
+}
+
+stop() {
+       service_stop /usr/bin/mini_snmpd
+}
diff --git a/net/mini_snmpd/patches/100-dualstack.patch b/net/mini_snmpd/patches/100-dualstack.patch
new file mode 100644 (file)
index 0000000..08aa4a0
--- /dev/null
@@ -0,0 +1,218 @@
+--- a/globals.c
++++ b/globals.c
+@@ -27,9 +27,9 @@
+  * Global variables
+  */
+-#ifdef __IPV4__
+ const struct in_addr inaddr_any = { INADDR_ANY };
+-#endif
++
++int g_family = AF_INET;
+ in_port_t g_udp_port = 161;
+ in_port_t g_tcp_port = 161;
+--- a/mini_snmpd.c
++++ b/mini_snmpd.c
+@@ -54,6 +54,10 @@ static void print_help(void)
+       fprintf(stderr, "-d, --disks nnn        set the disks to monitor (/)\n");
+       fprintf(stderr, "-i, --interfaces nnn   set the network interfaces to monitor (lo)\n");
+       fprintf(stderr, "-I, --listen nnn       set the network interface to listen (all)\n");
++#ifdef __IPV6__
++      fprintf(stderr, "-4, --ipv4             use IPv4 (default)\n");
++      fprintf(stderr, "-6, --ipv6             use IPv6\n");
++#endif
+       fprintf(stderr, "-t, --timeout nnn      set the timeout for MIB updates (1 second)\n");
+       fprintf(stderr, "-a, --auth             require authentication (thus SNMP version 2c)\n");
+       fprintf(stderr, "-v, --verbose          verbose syslog messages \n");
+@@ -117,7 +121,7 @@ static void handle_udp_client(void)
+ #endif
+       /* Call the protocol handler which will prepare the response packet */
+-      inet_ntop(my_af_inet, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
++      inet_ntop(g_family, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
+       if (snmp(&g_udp_client) == -1) {
+               lprintf(LOG_WARNING, "could not handle packet from UDP client %s:%d: %m\n",
+                       straddr, sockaddr.my_sin_port);
+@@ -132,7 +136,7 @@ static void handle_udp_client(void)
+       /* Send the whole UDP packet to the socket at once */
+       rv = sendto(g_udp_sockfd, g_udp_client.packet, g_udp_client.size,
+               MSG_DONTWAIT, (struct sockaddr *)&sockaddr, socklen);
+-      inet_ntop(my_af_inet, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
++      inet_ntop(g_family, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
+       if (rv == -1) {
+               lprintf(LOG_WARNING, "could not send packet to UDP client %s:%d: %m\n",
+                       straddr, sockaddr.my_sin_port);
+@@ -176,7 +180,7 @@ static void handle_tcp_connect(void)
+               }
+               tmp_sockaddr.my_sin_addr = client->addr;
+               tmp_sockaddr.my_sin_port = client->port;
+-              inet_ntop(my_af_inet, &tmp_sockaddr.my_sin_addr, straddr, sizeof(straddr));
++              inet_ntop(g_family, &tmp_sockaddr.my_sin_addr, straddr, sizeof(straddr));
+               lprintf(LOG_WARNING, "maximum number of %d clients reached, kicking out %s:%d\n",
+                       MAX_NR_CLIENTS, straddr, tmp_sockaddr.my_sin_port);
+               close(client->sockfd);
+@@ -190,7 +194,7 @@ static void handle_tcp_connect(void)
+       }
+       /* Now fill out the client control structure values */
+-      inet_ntop(my_af_inet, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
++      inet_ntop(g_family, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
+       lprintf(LOG_DEBUG, "connected TCP client %s:%d\n",
+               straddr, sockaddr.my_sin_port);
+       client->timestamp = time(NULL);
+@@ -211,7 +215,7 @@ static void handle_tcp_client_write(clie
+       sockaddr.my_sin_addr = client->addr;
+       sockaddr.my_sin_port = client->port;
+       rv = send(client->sockfd, client->packet, client->size, 0);
+-      inet_ntop(my_af_inet, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
++      inet_ntop(g_family, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
+       if (rv == -1) {
+               lprintf(LOG_WARNING, "could not send packet to TCP client %s:%d: %m\n",
+                       straddr, sockaddr.my_sin_port);
+@@ -246,7 +250,7 @@ static void handle_tcp_client_read(clien
+       sockaddr.my_sin_port = client->port;
+       rv = read(client->sockfd, client->packet + client->size,
+               sizeof (client->packet) - client->size);
+-      inet_ntop(my_af_inet, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
++      inet_ntop(g_family, &sockaddr.my_sin_addr, straddr, sizeof(straddr));
+       if (rv == -1) {
+               lprintf(LOG_WARNING, "could not read packet from TCP client %s:%d: %m\n",
+                       straddr, sockaddr.my_sin_port);
+@@ -304,7 +308,11 @@ static void handle_tcp_client_read(clien
+ int main(int argc, char *argv[])
+ {
++#ifdef __IPV6__
++      static const char short_options[] = "p:P:c:D:V:L:C:d:i:I:t:T:avl46h";
++#else
+       static const char short_options[] = "p:P:c:D:V:L:C:d:i:I:t:T:avlh";
++#endif
+       static const struct option long_options[] = {
+               { "udp-port", 1, 0, 'p' },
+               { "tcp-port", 1, 0, 'P' },
+@@ -316,6 +324,10 @@ int main(int argc, char *argv[])
+               { "disks", 1, 0, 'd' },
+               { "interfaces", 1, 0, 'i' },
+               { "listen", 1, 0, 'I' },
++#ifdef __IPV6__
++              { "ipv4", 0, 0, '4' },
++              { "ipv6", 0, 0, '6' },
++#endif
+               { "timeout", 1, 0, 't' },
+               { "traps", 1, 0, 'T' },
+               { "auth", 0, 0, 'a' },
+@@ -327,7 +339,12 @@ int main(int argc, char *argv[])
+       int option_index = 1;
+       int c;
+-      struct my_sockaddr_t sockaddr;
++      union {
++              struct sockaddr_in sa;
++#ifdef __IPV6__
++              struct sockaddr_in6 sa6;
++#endif
++      } sockaddr;
+       my_socklen_t socklen;
+       struct timeval tv_last;
+       struct timeval tv_now;
+@@ -396,6 +413,14 @@ int main(int argc, char *argv[])
+                       case 'v':
+                               g_verbose = 1;
+                               break;
++#ifdef __IPV6__
++                      case '4':
++                              g_family = AF_INET;
++                              break;
++                      case '6':
++                              g_family = AF_INET6;
++                              break;
++#endif
+                       case 'l':
+                               print_version();
+                               exit(EXIT_ARGS);
+@@ -435,15 +460,24 @@ int main(int argc, char *argv[])
+ #endif
+       /* Open the server's UDP port and prepare it for listening */
+-      g_udp_sockfd = socket(my_pf_inet, SOCK_DGRAM, 0);
++      g_udp_sockfd = socket((g_family == AF_INET) ? PF_INET : PF_INET6, SOCK_DGRAM, 0);
+       if (g_udp_sockfd == -1) {
+               lprintf(LOG_ERR, "could not create UDP socket: %m\n");
+               exit(EXIT_SYSCALL);
+       }
+-      sockaddr.my_sin_family = my_af_inet;
+-      sockaddr.my_sin_port = htons(g_udp_port);
+-      sockaddr.my_sin_addr = my_inaddr_any;
+-      socklen = sizeof (sockaddr);
++      if (g_family == AF_INET) {
++              sockaddr.sa.sin_family = g_family;
++              sockaddr.sa.sin_port = htons(g_udp_port);
++              sockaddr.sa.sin_addr = inaddr_any;
++              socklen = sizeof(sockaddr.sa);
++#ifdef __IPV6__
++      } else {
++              sockaddr.sa6.sin6_family = g_family;
++              sockaddr.sa6.sin6_port = htons(g_udp_port);
++              sockaddr.sa6.sin6_addr = in6addr_any;
++              socklen = sizeof(sockaddr.sa6);
++#endif
++      }
+       if (bind(g_udp_sockfd, (struct sockaddr *)&sockaddr, socklen) == -1) {
+               lprintf(LOG_ERR, "could not bind UDP socket to port %d: %m\n", g_udp_port);
+               exit(EXIT_SYSCALL);
+@@ -457,7 +491,7 @@ int main(int argc, char *argv[])
+       }
+       /* Open the server's TCP port and prepare it for listening */
+-      g_tcp_sockfd = socket(my_pf_inet, SOCK_STREAM, 0);
++      g_tcp_sockfd = socket((g_family == AF_INET) ? PF_INET : PF_INET6, SOCK_STREAM, 0);
+       if (g_tcp_sockfd == -1) {
+               lprintf(LOG_ERR, "could not create TCP socket: %m\n");
+               exit(EXIT_SYSCALL);
+@@ -474,10 +508,19 @@ int main(int argc, char *argv[])
+               lprintf(LOG_WARNING, "could not set SO_REUSEADDR on TCP socket: %m\n");
+               exit(EXIT_SYSCALL);
+       }
+-      sockaddr.my_sin_family = my_af_inet;
+-      sockaddr.my_sin_port = htons(g_tcp_port);
+-      sockaddr.my_sin_addr = my_inaddr_any;
+-      socklen = sizeof (sockaddr);
++      if (g_family == AF_INET) {
++              sockaddr.sa.sin_family = g_family;
++              sockaddr.sa.sin_port = htons(g_udp_port);
++              sockaddr.sa.sin_addr = inaddr_any;
++              socklen = sizeof(sockaddr.sa);
++#ifdef __IPV6__
++      } else {
++              sockaddr.sa6.sin6_family = g_family;
++              sockaddr.sa6.sin6_port = htons(g_udp_port);
++              sockaddr.sa6.sin6_addr = in6addr_any;
++              socklen = sizeof(sockaddr.sa6);
++#endif
++      }
+       if (bind(g_tcp_sockfd, (struct sockaddr *)&sockaddr, socklen) == -1) {
+               lprintf(LOG_ERR, "could not bind TCP socket to port %d: %m\n", g_tcp_port);
+               exit(EXIT_SYSCALL);
+--- a/mini_snmpd.h
++++ b/mini_snmpd.h
+@@ -255,6 +255,7 @@ typedef struct demoinfo_s {
+ extern in_port_t g_udp_port;
+ extern in_port_t g_tcp_port;
++extern int g_family;
+ extern int g_timeout;
+ extern int g_auth;
+ extern int g_verbose;
+@@ -265,9 +266,9 @@ extern char *g_vendor;
+ extern char *g_location;
+ extern char *g_contact;
+ extern char *g_bind_to_device;
+-#ifdef __IPV4__
++
+ extern const struct in_addr inaddr_any;
+-#endif
++
+ extern char *g_disk_list[MAX_NR_DISKS];
+ extern int g_disk_list_length;
diff --git a/net/mini_snmpd/patches/101-opt_flags.patch b/net/mini_snmpd/patches/101-opt_flags.patch
new file mode 100644 (file)
index 0000000..70dbce5
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/Makefile
++++ b/Makefile
+@@ -32,9 +32,9 @@ HEADERS      = mini_snmpd.h
+ SOURCES       = mini_snmpd.c protocol.c mib.c globals.c utils.c linux.c freebsd.c
+ VERSION = 1.2b
+ VENDOR        = .1.3.6.1.4.1
+-OFLAGS        = -O2 -DDEBUG -g
++OFLAGS        = -O2
+ CFLAGS        = -Wall -Werror -DVERSION="\"$(VERSION)\"" -DVENDOR="\"$(VENDOR)\"" \
+-        $(OFLAGS) -D__TRAPS__ -D__LINUX__ -D__IPV6__
++        $(OFLAGS) -D__TRAPS__ -D__LINUX__
+ LDFLAGS       = $(OFLAGS)
+ TARGET        = mini_snmpd
+ MAN   = mini_snmpd.8
diff --git a/net/mini_snmpd/patches/102-mib_fix_uninitialized_memory.patch b/net/mini_snmpd/patches/102-mib_fix_uninitialized_memory.patch
new file mode 100644 (file)
index 0000000..fc8cecf
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/mib.c
++++ b/mib.c
+@@ -290,6 +290,7 @@ static int mib_build_entry(const oid_t *
+                       value->data.max_length = sizeof (int) + 2;
+                       value->data.encoded_length = 0;
+                       value->data.buffer = malloc(value->data.max_length);
++                      memset(value->data.buffer, 0, value->data.max_length);
+                       if (encode_snmp_element_integer(value, (int)default_value) == -1) {
+                               return -1;
+                       }
+@@ -298,6 +299,7 @@ static int mib_build_entry(const oid_t *
+                       value->data.max_length = strlen((const char *)default_value) + 4;
+                       value->data.encoded_length = 0;
+                       value->data.buffer = malloc(value->data.max_length);
++                      memset(value->data.buffer, 0, value->data.max_length);
+                       if (encode_snmp_element_string(value, (const char *)default_value) == -1) {
+                               return -1;
+                       }
+@@ -306,6 +308,7 @@ static int mib_build_entry(const oid_t *
+                       value->data.max_length = MAX_NR_SUBIDS * 5 + 4;
+                       value->data.encoded_length = 0;
+                       value->data.buffer = malloc(value->data.max_length);
++                      memset(value->data.buffer, 0, value->data.max_length);
+                       if (encode_snmp_element_oid(value, oid_aton((const char *)default_value)) == -1) {
+                               return -1;
+                       }
+@@ -316,6 +319,7 @@ static int mib_build_entry(const oid_t *
+                       value->data.max_length = sizeof (unsigned int) + 2;
+                       value->data.encoded_length = 0;
+                       value->data.buffer = malloc(value->data.max_length);
++                      memset(value->data.buffer, 0, value->data.max_length);
+                       if (encode_snmp_element_unsigned(value, type, (unsigned int)default_value) == -1) {
+                               return -1;
+                       }
diff --git a/net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch b/net/mini_snmpd/patches/103-mib_encode_snmp_element_oid_fix.patch
new file mode 100644 (file)
index 0000000..a1f105c
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/mib.c
++++ b/mib.c
+@@ -120,6 +120,9 @@ static int encode_snmp_element_oid(value
+       int length;
+       int i;
++      if (oid_value == NULL) {
++              return -1;
++      }
+       buffer = value->data.buffer;
+       length = 1;
+       for (i = 2; i < oid_value->subid_list_length; i++) {
+@@ -310,6 +313,8 @@ static int mib_build_entry(const oid_t *
+                       value->data.buffer = malloc(value->data.max_length);
+                       memset(value->data.buffer, 0, value->data.max_length);
+                       if (encode_snmp_element_oid(value, oid_aton((const char *)default_value)) == -1) {
++                              lprintf(LOG_ERR, "could not create MIB entry '%s.%d.%d': invalid oid '%s'\n",
++                                      oid_ntoa(prefix), column, row, (char *)default_value);
+                               return -1;
+                       }
+                       break;
diff --git a/net/mini_snmpd/patches/104-memset_fix.patch b/net/mini_snmpd/patches/104-memset_fix.patch
new file mode 100644 (file)
index 0000000..0ed2a2e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/mini_snmpd.c
++++ b/mini_snmpd.c
+@@ -443,7 +443,7 @@ int main(int argc, char *argv[])
+       /* Store the starting time since we need it for MIB updates */
+       if (gettimeofday(&tv_last, NULL) == -1) {
+               memset(&tv_last, 0, sizeof (tv_last));
+-              memset(&tv_sleep, 0, sizeof (&tv_sleep));
++              memset(&tv_sleep, 0, sizeof (tv_sleep));
+       } else {
+               tv_sleep.tv_sec = g_timeout / 100;
+               tv_sleep.tv_usec = (g_timeout % 100) * 10000;
diff --git a/net/mosh/Makefile b/net/mosh/Makefile
new file mode 100644 (file)
index 0000000..b3fedc1
--- /dev/null
@@ -0,0 +1,107 @@
+#
+# Copyright (C) 2011-2013 Entware
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mosh
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://mosh.mit.edu/
+PKG_MD5SUM:=c2d918f4d91fdc32546e2e089f9281b2
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mosh/Default
+       SECTION:=utils
+       CATEGORY:=Utilities
+       TITLE:=Mosh mobile shell
+       DEPENDS:=+libncursesw +libopenssl +protobuf
+       URL:=http://mosh.mit.edu/
+endef
+
+define Package/mosh-client
+$(call Package/mosh/Default)
+ TITLE+= (client)
+endef
+
+define Package/mosh-server
+$(call Package/mosh/Default)
+ TITLE+= (client)
+endef
+
+define Package/mosh-full
+$(call Package/mosh/Default)
+ TITLE+= (client)
+ DEPENDS:= \
+    +mosh-client \
+    +mosh-server \
+    +perlbase-essential \
+    +perlbase-socket \
+    +perlbase-xsloader \
+    +perlbase-getopt \
+    +perlbase-errno \
+    +perlbase-config \
+    +perlbase-io \
+    +perlbase-symbol \
+    +perlbase-selectsaver \
+    +perlbase-posix \
+    +perlbase-autoloader \
+    +perlbase-fcntl \
+    +perlbase-tie
+endef
+
+
+define Package/mosh/Default/description
+ Mosh is a remote terminal application that allows roaming, supports
+ intermittent connectivity, and provides intelligent local echo and line
+ editing of user keystrokes.
+endef
+
+define Package/mosh-client/description
+$(call Package/mosh/Default/description)
+ This is a mosh client.
+endef
+
+define Package/mosh-server/description
+$(call Package/mosh/Default/description)
+ This is a mosh server.
+endef
+
+define Package/mosh-full/description
+$(call Package/mosh/Default/description)
+ This is a full package with perl wrapper script
+endef
+
+
+CONFIGURE_ARGS += \
+       --with-curses=$(STAGING_DIR)/usr \
+       --disable-hardening \
+       --without-utempter \
+
+define Package/mosh-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mosh-client $(1)/usr/bin/
+endef
+
+define Package/mosh-server/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mosh-server $(1)/usr/bin/
+endef
+
+define Package/mosh-full/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mosh $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,mosh-client))
+$(eval $(call BuildPackage,mosh-server))
+$(eval $(call BuildPackage,mosh-full))
diff --git a/net/mosh/patches/disable-utf8-check.patch b/net/mosh/patches/disable-utf8-check.patch
new file mode 100644 (file)
index 0000000..88525fb
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/src/util/locale_utils.cc
++++ b/src/util/locale_utils.cc
+@@ -86,10 +86,10 @@ const char *locale_charset( void )
+ bool is_utf8_locale( void ) {
+   /* Verify locale calls for UTF-8 */
+-  if ( strcmp( locale_charset(), "UTF-8" ) != 0 &&
+-       strcmp( locale_charset(), "utf-8" ) != 0 ) {
+-    return 0;
+-  }
++  //if ( strcmp( locale_charset(), "UTF-8" ) != 0 &&
++  //    strcmp( locale_charset(), "utf-8" ) != 0 ) {
++  // return 0;
++  //}
+   return 1;
+ }
diff --git a/net/mrtg/Makefile b/net/mrtg/Makefile
new file mode 100644 (file)
index 0000000..939eee3
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2011-2012 OpenWrt.org
+# Copyright (C) 2011 Paolo Pisati <p.pisati@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mrtg
+PKG_VERSION:=2.17.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://oss.oetiker.ch/mrtg/pub/
+PKG_MD5SUM:=c803f671d04367ee719039ea71fb5b37
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mrtg
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libgd +libpng +zlib +perl +perlbase-essential +perlbase-findbin \
+    +perlbase-cwd +perlbase-config +perlbase-file +perlbase-getopt \
+    +perlbase-math +perlbase-integer +perlbase-xsloader +perlbase-pod \
+    +perlbase-universal +perlbase-socket +perlbase-posix +perlbase-autoloader \
+    +perlbase-fcntl +perlbase-tie +perlbase-io +perlbase-symbol \
+    +perlbase-selectsaver +perlbase-errno +perlbase-scalar +perlbase-list \
+       +perlbase-base
+  TITLE:=The Multi Router Traffic Grapher
+  URL:=http://oss.oetiker.ch/mrtg/index.en.html
+endef
+
+define Package/mrtg/description
+  The Multi Router Traffic Grapher, or just simply MRTG, is free software for
+  monitoring and measuring the traffic load on network links. It allows the
+  user to see traffic load on a network over time in graphical form. It was
+  originally developed by Tobias Oetiker and Dave Rand to monitor router
+  traffic, but has developed into a tool that can create graphs and statistics
+  for almost anything.
+endef
+
+define Package/mrtg/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/* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/* $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,mrtg))
diff --git a/net/mrtg/patches/001-rm-printf-longlong-fmt-test.patch b/net/mrtg/patches/001-rm-printf-longlong-fmt-test.patch
new file mode 100644 (file)
index 0000000..d6cb0c8
--- /dev/null
@@ -0,0 +1,50 @@
+--- mrtg-2.17.3.orig/configure.in      2011-12-25 23:54:18.284584003 +0100
++++ mrtg-2.17.3/configure.in   2011-12-25 23:54:52.377260252 +0100
+@@ -19,47 +19,6 @@
+ AC_PATH_PROGS(NROFF, groff nroff)
+-dnl Check for long long type (64 bit rateup)
+-AC_CHECK_HEADERS(inttypes.h)
+-AC_CHECK_TYPE(unsigned long long)
+-AC_CHECK_TYPE(long long)
+-AC_CHECK_FUNCS(strtoll)
+-
+-# Taken from libIDL-0.8.2
+-AC_MSG_CHECKING([for printf long long format specifier])
+-AC_CACHE_VAL(long_long_format_specifier,[
+-    for format in ll l q I64; do
+-        AC_TRY_RUN([#include <stdio.h>  
+-            int main()
+-            {
+-                long long b, a = -0x3AFAFAFAFAFAFAFALL;
+-                char buffer[1000];
+-                sprintf (buffer, "%${format}u", a);
+-                sscanf (buffer, "%${format}u", &b);
+-                exit (b!=a);
+-            }
+-            ],
+-            long_long_format_specifier="%${format}d"
+-            long_long_format="${format}d"
+-            break)
+-        done])
+-AC_MSG_RESULT($long_long_format_specifier)
+-AC_DEFINE_UNQUOTED(LLD, "$long_long_format_specifier",
+-    [How to print a long long])
+-AC_DEFINE_UNQUOTED(LLD_FORMAT, "$long_long_format",
+-    [long long format without % specifier])
+-
+-AH_BOTTOM(
+-#ifndef HAVE_STRTOLL     
+-long long int strtoll(const char *str, char **ptr, int base)
+-{
+-        long long int ll;
+-        sscanf(str, LLD, &ll);
+-        return ll;
+-}
+-#endif
+-)
+-
+ dnl Checks for libraries.
+ AC_CHECK_LIB(m, pow, [ MATHLIBS="-lm" ])
diff --git a/net/mtr/Makefile b/net/mtr/Makefile
new file mode 100644 (file)
index 0000000..d6aedec
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2006-2012 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:=mtr
+PKG_VERSION:=0.82
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.bitwizard.nl/mtr
+PKG_MD5SUM:=10601ea543fda3e51545c4bce195b64c
+
+PKG_INSTALL:=1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mtr
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=Full screen ncurses traceroute tool
+  URL:=http://www.bitwizard.nl/mtr/
+endef
+
+define Package/mtr/description
+       mtr combines the functionality of the 'traceroute' and 'ping' programs
+       in a single network diagnostic tool.
+       As mtr starts, it investigates the network connection between the host
+       mtr runs on and a user-specified destination host. After it
+       determines the address of each network hop between the machines,
+       it sends a sequence ICMP ECHO requests to each one to determine the
+       quality of the link to each machine. As it does this, it prints
+       running statistics about each machine.
+endef
+
+CONFIGURE_ARGS += \
+       --without-gtk \
+
+#CONFIGURE_VARS += \
+#      ac_cv_lib_resolv_res_mkquery=no \
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               aclocal.m4 \
+               Makefile.in \
+               img/Makefile.in \
+               stamp-h.in \
+               config.h.in \
+               configure \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Package/mtr/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mtr $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,mtr))
diff --git a/net/mtr/patches/501-dns.patch b/net/mtr/patches/501-dns.patch
new file mode 100644 (file)
index 0000000..0976cb3
--- /dev/null
@@ -0,0 +1,510 @@
+--- a/dns.c
++++ b/dns.c
+@@ -880,6 +880,507 @@ void restell(char *s)
+   fputs("\r",stderr);
+ }
++#ifdef __UCLIBC__
++
++static const char       digits[] = "0123456789";
++#define __set_errno(e) (errno = (e))
++
++#define NS_PUT16(s, cp) do { \
++        register u_int16_t t_s = (u_int16_t)(s); \
++        register u_char *t_cp = (u_char *)(cp); \
++        *t_cp++ = t_s >> 8; \
++        *t_cp   = t_s; \
++        (cp) += NS_INT16SZ; \
++} while (0)
++
++
++
++#define NS_PUT32(l, cp) do { \
++        register u_int32_t t_l = (u_int32_t)(l); \
++        register u_char *t_cp = (u_char *)(cp); \
++        *t_cp++ = t_l >> 24; \
++        *t_cp++ = t_l >> 16; \
++        *t_cp++ = t_l >> 8; \
++        *t_cp   = t_l; \
++        (cp) += NS_INT32SZ; \
++} while (0)
++
++
++void
++ns_put16(u_int src, u_char *dst) {
++        NS_PUT16(src, dst);
++}
++
++void
++ns_put32(u_long src, u_char *dst) {
++        NS_PUT32(src, dst);
++}
++
++void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); }
++void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); }
++
++int
++mklower(int ch) {
++        if (ch >= 0x41 && ch <= 0x5A)
++                return (ch + 0x20);
++        return (ch);
++}
++
++
++static int
++dn_find(const u_char *domain, const u_char *msg,
++        const u_char * const *dnptrs,
++        const u_char * const *lastdnptr)
++{
++        const u_char *dn, *cp, *sp;
++        const u_char * const *cpp;
++        u_int n;
++
++        for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
++                sp = *cpp;
++                /*
++                 * terminate search on:
++                 * root label
++                 * compression pointer
++                 * unusable offset
++                 */
++                while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 &&
++                       (sp - msg) < 0x4000) {
++                        dn = domain;
++                        cp = sp;
++                        while ((n = *cp++) != 0) {
++                                /*
++                                 * check for indirection
++                                 */
++                                switch (n & NS_CMPRSFLGS) {
++                                case 0:         /* normal case, n == len */
++                                        if (n != *dn++)
++                                                goto next;
++                                        for ((void)NULL; n > 0; n--)
++                                                if (mklower(*dn++) !=
++                                                    mklower(*cp++))
++                                                        goto next;
++                                        /* Is next root for both ? */
++                                        if (*dn == '\0' && *cp == '\0')
++                                                return (sp - msg);
++                                        if (*dn)
++                                                continue;
++                                        goto next;
++
++                                case NS_CMPRSFLGS:      /* indirection */
++                                        cp = msg + (((n & 0x3f) << 8) | *cp);
++                                        break;
++
++                                default:        /* illegal type */
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                        }
++ next:
++                        sp += *sp + 1;
++                }
++        }
++        __set_errno (ENOENT);
++        return (-1);
++}
++
++
++int
++ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
++             const u_char **dnptrs, const u_char **lastdnptr)
++{
++        u_char *dstp;
++        const u_char **cpp, **lpp, *eob, *msg;
++        const u_char *srcp;
++        int n, l, first = 1;
++
++        srcp = src;
++        dstp = dst;
++        eob = dstp + dstsiz;
++        lpp = cpp = NULL;
++        if (dnptrs != NULL) {
++                if ((msg = *dnptrs++) != NULL) {
++                        for (cpp = dnptrs; *cpp != NULL; cpp++)
++                                (void)NULL;
++                        lpp = cpp;      /* end of list to search */
++                }
++        } else
++                msg = NULL;
++
++        /* make sure the domain we are about to add is legal */
++        l = 0;
++        do {
++                n = *srcp;
++                if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) {
++                        __set_errno (EMSGSIZE);
++                        return (-1);
++                }
++                if (n == 0x41)
++                        n = *++srcp / 8;
++                l += n + 1;
++                if (l > MAXCDNAME) {
++                        __set_errno (EMSGSIZE);
++                        return (-1);
++                }
++                srcp += n + 1;
++        } while (n != 0);
++
++        /* from here on we need to reset compression pointer array on error */
++        srcp = src;
++        do {
++                /* Look to see if we can use pointers. */
++                n = *srcp;
++                if (n != 0 && n != 0x41 && msg != NULL) {
++                        l = dn_find(srcp, msg, (const u_char * const *)dnptrs,
++                                    (const u_char * const *)lpp);
++                        if (l >= 0) {
++                                if (dstp + 1 >= eob) {
++                                        goto cleanup;
++                                }
++                                *dstp++ = (l >> 8) | NS_CMPRSFLGS;
++                                *dstp++ = l % 256;
++                                return (dstp - dst);
++                        }
++                        /* Not found, save it. */
++                        if (lastdnptr != NULL && cpp < lastdnptr - 1 &&
++                            (dstp - msg) < 0x4000 && first) {
++                                *cpp++ = dstp;
++                                *cpp = NULL;
++                                first = 0;
++                        }
++                }
++                /* copy label to buffer */
++                if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) {             /* Should not happen. */
++                        goto cleanup;
++                }
++                if (n == 0x41) {
++                        n = *++srcp / 8;
++                        if (dstp + 1 >= eob)
++                                goto cleanup;
++                        *dstp++ = 0x41;
++                }
++                if (dstp + 1 + n >= eob) {
++                        goto cleanup;
++                }
++                memcpy(dstp, srcp, n + 1);
++                srcp += n + 1;
++                dstp += n + 1;
++        } while (n != 0);
++
++        if (dstp > eob) {
++cleanup:
++                if (msg != NULL)
++                        *lpp = NULL;
++                __set_errno (EMSGSIZE);
++                return (-1);
++        }
++        return (dstp - dst);
++}
++
++
++int
++ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
++        u_char *label, *bp, *eom;
++        int c, n, escaped;
++        char *cp;
++
++        escaped = 0;
++        bp = dst;
++        eom = dst + dstsiz;
++        label = bp++;
++
++        while ((c = *src++) != 0) {
++                if (escaped) {
++                        if ((cp = strchr(digits, c)) != NULL) {
++                                n = (cp - digits) * 100;
++                                if ((c = *src++) == 0 ||
++                                    (cp = strchr(digits, c)) == NULL) {
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                                n += (cp - digits) * 10;
++                                if ((c = *src++) == 0 ||
++                                    (cp = strchr(digits, c)) == NULL) {
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                                n += (cp - digits);
++                                if (n > 255) {
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                                c = n;
++                        } else if (c == '[' && label == bp - 1 && *src == 'x') {
++                                /* Theoretically we would have to handle \[o
++                                   as well but we do not since we do not need
++                                   it internally.  */
++                                *label = 0x41;
++                                label = bp++;
++                                ++src;
++                                while (isxdigit (*src)) {
++                                        n = *src > '9' ? *src - 'a' + 10 : *src - '0';
++                                        ++src;
++                                        if (! isxdigit(*src)) {
++                                                __set_errno (EMSGSIZE);
++                                                return (-1);
++                                        }
++                                        n <<= 4;
++                                        n += *src > '9' ? *src - 'a' + 10 : *src - '0';
++                                        if (bp + 1 >= eom) {
++                                                __set_errno (EMSGSIZE);
++                                                return (-1);
++                                        }
++                                        *bp++ = n;
++                                        ++src;
++                                }
++                                *label = (bp - label - 1) * 8;
++                                if (*src++ != ']' || *src++ != '.') {
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                                escaped = 0;
++                                label = bp++;
++                                if (bp >= eom) {
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                                continue;
++                        }
++                        escaped = 0;
++                } else if (c == '\\') {
++                        escaped = 1;
++                        continue;
++                } else if (c == '.') {
++                        c = (bp - label - 1);
++                        if ((c & NS_CMPRSFLGS) != 0) {  /* Label too big. */
++                                __set_errno (EMSGSIZE);
++                                return (-1);
++                        }
++                        if (label >= eom) {
++                                __set_errno (EMSGSIZE);
++                                return (-1);
++                        }
++                        *label = c;
++                        /* Fully qualified ? */
++                        if (*src == '\0') {
++                                if (c != 0) {
++                                        if (bp >= eom) {
++                                                __set_errno (EMSGSIZE);
++                                                return (-1);
++                                        }
++                                        *bp++ = '\0';
++                                }
++                                if ((bp - dst) > MAXCDNAME) {
++                                        __set_errno (EMSGSIZE);
++                                        return (-1);
++                                }
++                                return (1);
++                        }
++                        if (c == 0 || *src == '.') {
++                                __set_errno (EMSGSIZE);
++                                return (-1);
++                        }
++                        label = bp++;
++                        continue;
++                }
++                if (bp >= eom) {
++                        __set_errno (EMSGSIZE);
++                        return (-1);
++                }
++                *bp++ = (u_char)c;
++        }
++        c = (bp - label - 1);
++        if ((c & NS_CMPRSFLGS) != 0) {          /* Label too big. */
++                __set_errno (EMSGSIZE);
++                return (-1);
++        }
++        if (label >= eom) {
++                __set_errno (EMSGSIZE);
++                return (-1);
++        }
++        *label = c;
++        if (c != 0) {
++                if (bp >= eom) {
++                        __set_errno (EMSGSIZE);
++                        return (-1);
++                }
++                *bp++ = 0;
++        }
++        if ((bp - dst) > MAXCDNAME) {   /* src too big */
++                __set_errno (EMSGSIZE);
++                return (-1);
++        }
++        return (0);
++}
++
++
++
++int
++ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
++                 const u_char **dnptrs, const u_char **lastdnptr)
++{
++        u_char tmp[NS_MAXCDNAME];
++
++        if (ns_name_pton(src, tmp, sizeof tmp) == -1)
++                return (-1);
++        return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
++}
++
++
++int
++dn_comp(const char *src, u_char *dst, int dstsiz,
++        u_char **dnptrs, u_char **lastdnptr)
++{
++        return (ns_name_compress(src, dst, (size_t)dstsiz,
++                                 (const u_char **)dnptrs,
++                                 (const u_char **)lastdnptr));
++}
++
++
++
++
++int
++res_nmkquery(res_state statp,
++             int op,                    /* opcode of query */
++             const char *dname,         /* domain name */
++             int class, int type,       /* class and type of query */
++             const u_char *data,        /* resource record data */
++             int datalen,               /* length of data */
++             const u_char *newrr_in,    /* new rr for modify or append */
++             u_char *buf,               /* buffer to put query */
++             int buflen)                /* size of buffer */
++{
++        register HEADER *hp;
++        register u_char *cp;
++        register int n;
++        u_char *dnptrs[20], **dpp, **lastdnptr;
++
++#ifdef DEBUG
++        if (statp->options & RES_DEBUG)
++                printf(";; res_nmkquery(%s, %s, %s, %s)\n",
++                       _res_opcodes[op], dname, p_class(class), p_type(type));
++#endif
++        /*
++         * Initialize header fields.
++         */
++        if ((buf == NULL) || (buflen < HFIXEDSZ))
++                return (-1);
++        memset(buf, 0, HFIXEDSZ);
++        hp = (HEADER *) buf;
++        /* We randomize the IDs every time.  The old code just
++           incremented by one after the initial randomization which
++           still predictable if the application does multiple
++           requests.  */
++#if 0
++        hp->id = htons(++statp->id);
++#else
++        hp->id = htons(statp->id);
++        int randombits;
++        do
++          {
++#ifdef RANDOM_BITS
++            RANDOM_BITS (randombits);
++#else
++            struct timeval tv;
++            gettimeofday (&tv, NULL);
++            randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
++#endif
++          }
++        while ((randombits & 0xffff) == 0);
++        statp->id = (statp->id + randombits) & 0xffff;
++#endif
++        hp->opcode = op;
++        hp->rd = (statp->options & RES_RECURSE) != 0;
++        hp->rcode = NOERROR;
++        cp = buf + HFIXEDSZ;
++        buflen -= HFIXEDSZ;
++        dpp = dnptrs;
++        *dpp++ = buf;
++        *dpp++ = NULL;
++        lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
++        /*
++         * perform opcode specific processing
++         */
++        switch (op) {
++        case QUERY:     /*FALLTHROUGH*/
++        case NS_NOTIFY_OP:
++                if ((buflen -= QFIXEDSZ) < 0)
++                        return (-1);
++                if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
++                        return (-1);
++                cp += n;
++                buflen -= n;
++                __putshort(type, cp);
++                cp += INT16SZ;
++                __putshort(class, cp);
++                cp += INT16SZ;
++                hp->qdcount = htons(1);
++                if (op == QUERY || data == NULL)
++                        break;
++                /*
++                 * Make an additional record for completion domain.
++                 */
++                buflen -= RRFIXEDSZ;
++                n = dn_comp((char *)data, cp, buflen, dnptrs, lastdnptr);
++                if (n < 0)
++                        return (-1);
++                cp += n;
++                buflen -= n;
++                __putshort(T_NULL, cp);
++                cp += INT16SZ;
++                __putshort(class, cp);
++                cp += INT16SZ;
++                __putlong(0, cp);
++                cp += INT32SZ;
++                __putshort(0, cp);
++                cp += INT16SZ;
++                hp->arcount = htons(1);
++                break;
++
++        case IQUERY:
++                /*
++                 * Initialize answer section
++                 */
++                if (buflen < 1 + RRFIXEDSZ + datalen)
++                        return (-1);
++                *cp++ = '\0';   /* no domain name */
++                __putshort(type, cp);
++                cp += INT16SZ;
++                __putshort(class, cp);
++                cp += INT16SZ;
++                __putlong(0, cp);
++                cp += INT32SZ;
++                __putshort(datalen, cp);
++                cp += INT16SZ;
++                if (datalen) {
++                        memcpy(cp, data, datalen);
++                        cp += datalen;
++                }
++                hp->ancount = htons(1);
++                break;
++
++        default:
++                return (-1);
++        }
++        return (cp - buf);
++}
++
++int
++res_mkquery(int op,                     /* opcode of query */
++            const char *dname,          /* domain name */
++            int class, int type,        /* class and type of query */
++            const u_char *data,         /* resource record data */
++            int datalen,                /* length of data */
++            const u_char *newrr_in,     /* new rr for modify or append */
++            u_char *buf,                /* buffer to put query */
++            int buflen)                 /* size of buffer */
++{
++        return (res_nmkquery(&_res, op, dname, class, type,
++                             data, datalen,
++                             newrr_in, buf, buflen));
++}
++
++#endif
+ void dorequest(char *s,int type,word id)
+ {
diff --git a/net/mtr/patches/502-fix-res_ninit.patch b/net/mtr/patches/502-fix-res_ninit.patch
new file mode 100644 (file)
index 0000000..dc0a02b
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/dns.c
++++ b/dns.c
+@@ -1267,28 +1267,6 @@ res_nmkquery(res_state statp,
+                 return (-1);
+         memset(buf, 0, HFIXEDSZ);
+         hp = (HEADER *) buf;
+-        /* We randomize the IDs every time.  The old code just
+-           incremented by one after the initial randomization which
+-           still predictable if the application does multiple
+-           requests.  */
+-#if 0
+-        hp->id = htons(++statp->id);
+-#else
+-        hp->id = htons(statp->id);
+-        int randombits;
+-        do
+-          {
+-#ifdef RANDOM_BITS
+-            RANDOM_BITS (randombits);
+-#else
+-            struct timeval tv;
+-            gettimeofday (&tv, NULL);
+-            randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
+-#endif
+-          }
+-        while ((randombits & 0xffff) == 0);
+-        statp->id = (statp->id + randombits) & 0xffff;
+-#endif
+         hp->opcode = op;
+         hp->rd = (statp->options & RES_RECURSE) != 0;
+         hp->rcode = NOERROR;
diff --git a/net/mtr/patches/520-libresolv_fix.patch b/net/mtr/patches/520-libresolv_fix.patch
new file mode 100644 (file)
index 0000000..b8f6aac
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/configure.in
++++ b/configure.in
+@@ -72,10 +72,10 @@ AC_CHECK_FUNC(gethostbyname, ,
+ AC_CHECK_FUNCS(seteuid)
+ #  AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
+-AC_CHECK_FUNC(res_mkquery, , 
+-  AC_CHECK_LIB(bind, res_mkquery, , 
+-   AC_CHECK_LIB(resolv, res_mkquery, ,
+-     AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
++#AC_CHECK_FUNC(res_mkquery, ,
++#  AC_CHECK_LIB(bind, res_mkquery, ,
++#   AC_CHECK_LIB(resolv, res_mkquery, ,
++#     AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found)))))
+ # This next line would override the just detected-or-not -lresolv. 
+ # This apparently hurts BSD. And it's bad practise. So it should go. 
+ # However, it probably didn't get added for nothing..... Holler if
diff --git a/net/mtr/patches/521-gtk_fix.patch b/net/mtr/patches/521-gtk_fix.patch
new file mode 100644 (file)
index 0000000..4314573
--- /dev/null
@@ -0,0 +1,27 @@
+--- a/configure.in
++++ b/configure.in
+@@ -48,16 +48,16 @@ AC_ARG_ENABLE(ipv6,
+ [  --disable-ipv6          Do not enable IPv6],
+ WANTS_IPV6=$enableval, WANTS_IPV6=yes)
+    
+-if test "x$WANTS_GTK" = "xyes"; then
+-        AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS"
+-                           LIBS="$LIBS $GTK_LIBS -lm",
+-                           AC_MSG_WARN(Building without GTK2 display support)
+-                   AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.])
+-                           GTK_OBJ="")
+-else
++#if test "x$WANTS_GTK" = "xyes"; then
++#        AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS"
++#                           LIBS="$LIBS $GTK_LIBS -lm",
++#                           AC_MSG_WARN(Building without GTK2 display support)
++#                   AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.])
++#                           GTK_OBJ="")
++#else
+       AC_DEFINE(NO_GTK)
+       GTK_OBJ=""
+-fi
++#fi
+ AC_CHECK_FUNC(socket, , 
+   AC_CHECK_LIB(socket, socket, , AC_MSG_ERROR(No socket library found)))
diff --git a/net/multiwan/Makefile b/net/multiwan/Makefile
new file mode 100644 (file)
index 0000000..f5161cc
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2010-2012 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:=multiwan
+PKG_VERSION:=1.0.22
+PKG_RELEASE:=2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/multiwan
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip +iptables +kmod-ipt-conntrack +iptables-mod-conntrack-extra +iptables-mod-ipopt
+  TITLE:=Simple multi WAN configuration
+  URL:=ftp://ftp.netlab7.com/
+  MAINTAINER:=Craig M. Coffee <craigc@netlab7.com>
+endef
+
+define Package/multiwan/description
+An agent script that makes Multi-WAN configuration simple,
+easy and manageable. Complete with load balancing, failover and an easy
+to manage traffic ruleset.
+endef
+
+define Package/multiwan/conffiles
+/etc/config/multiwan
+endef
+
+define Build/Compile
+endef
+
+define Package/multiwan/install
+       $(CP) ./files/* $(1)
+endef
+
+define Package/multiwan/postinst
+[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/multiwan enable
+exit 0
+endef
+
+$(eval $(call BuildPackage,multiwan))
diff --git a/net/multiwan/files/etc/config/multiwan b/net/multiwan/files/etc/config/multiwan
new file mode 100644 (file)
index 0000000..c88bdf3
--- /dev/null
@@ -0,0 +1,57 @@
+
+config 'multiwan' 'config'
+       # REMOVE THIS LINE OR PUT TO 1 TO ENABLE MULTIWAN
+       option 'enabled' '0'
+
+       option 'default_route' 'balancer'
+       # health_monitor below is defaulted to parallel, and can be set to
+       # serial to save system resources.
+       # option 'health_monitor' 'serial'
+       # option 'debug' '1'
+
+config 'interface' 'wan'
+       option 'weight' '10'
+       option 'health_interval' '10'
+       option 'icmp_hosts' 'dns'
+       # icmp_count is defaulted to 1, and can be increased to reduce
+       # false positives.
+       # option 'icmp_count' '3'
+       option 'timeout' '3'
+       option 'health_fail_retries' '3'
+       option 'health_recovery_retries' '5'
+       option 'failover_to' 'wan2'
+       option 'dns' 'auto'
+
+config 'interface' 'wan2'
+       option 'weight' '10'
+       option 'health_interval' '10'
+       option 'icmp_hosts' 'gateway'
+       option 'timeout' '3'
+       option 'health_fail_retries' '3'
+       option 'health_recovery_retries' '5'
+       option 'failover_to' 'balancer'
+       option 'dns' '208.67.222.222 208.67.220.220'
+
+config 'mwanfw'
+       option 'src' '192.168.1.0/24'
+       option 'dst' 'ftp.netlab7.com'
+       option 'proto' 'tcp'
+       option 'ports' '21'
+       option 'wanrule' 'wan2'
+
+# VoIP traffic goes through wan
+# config 'mwanfw'
+       # option 'src' '192.168.1.0/24'
+       # option 'proto' 'udp'
+       # option 'port_type' 'source-ports'
+       # option 'ports' '5060,16384:16482'
+       # option 'wanrule' 'wan'
+
+config 'mwanfw'
+       option 'src' '192.168.0.3'
+       option 'proto' 'icmp'
+       option 'wanrule' 'balancer'
+
+config 'mwanfw'
+       option 'dst' 'www.whatismyip.com'
+       option 'wanrule' 'fastbalancer'
diff --git a/net/multiwan/files/etc/init.d/multiwan b/net/multiwan/files/etc/init.d/multiwan
new file mode 100755 (executable)
index 0000000..8784430
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+START=99
+EXTRA_COMMANDS="single"
+
+start () {
+   /usr/bin/multiwan agent &
+}
+
+stop () {
+  sh /usr/bin/multiwan stop
+}
+
+restart () {
+  /usr/bin/multiwan restart &
+}
+
+single () {
+  /usr/bin/multiwan single &
+}
+  
diff --git a/net/multiwan/files/usr/bin/multiwan b/net/multiwan/files/usr/bin/multiwan
new file mode 100755 (executable)
index 0000000..9f3a444
--- /dev/null
@@ -0,0 +1,1042 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/functions/network.sh
+
+silencer() {
+    if [ -z "$debug" -o "$debug" == "0" ]; then
+       $* > /dev/null 2>&1
+    else
+       $*
+    fi
+}
+
+mwnote() {
+    logger ${debug:+-s} -p 5 -t multiwan "$1"
+}
+
+failover() {
+    local failchk=$(query_config failchk $2)
+    local recvrychk=$(query_config recvrychk $2)
+
+    local wanid=$(query_config wanid $2)
+    local failover_to=$(uci_get_state multiwan ${2} failover_to)
+    local failover_to_wanid=$(query_config wanid $failover_to)
+
+    local existing_failover=$(iptables -n -L FW${wanid}MARK -t mangle | echo $(($(wc -l) - 2)))
+
+    add() {
+
+       wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]//g")
+       wan_fail_map="$wan_fail_map${1}[x]"
+       wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]//g")
+       update_cache
+
+       if [ "$existing_failover" == "2" ]; then
+           if [ "$failover_to" != "balancer" -a "$failover_to" != "fastbalancer" -a "$failover_to" != "disable" -a "$failover_to_wanid" != "$wanid" ]; then
+               iptables -I FW${wanid}MARK 2 -t mangle -j FW${failover_to_wanid}MARK
+           elif [ "$failover_to" == "balancer" ]; then
+               iptables -I FW${wanid}MARK 2 -t mangle -j LoadBalancer
+           elif [ "$failover_to" == "fastbalancer" ]; then
+               iptables -I FW${wanid}MARK 2 -t mangle -j FastBalancer
+           fi
+       fi
+       mwnote "$1 has failed and is currently offline."
+    }
+
+    del() {
+
+       wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]//g")
+       wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]//g")
+       update_cache
+
+       if [ "$existing_failover" == "3" ]; then
+           iptables -D FW${wanid}MARK 2 -t mangle
+       fi
+       mwnote "$1 has recovered and is back online!"
+    }
+
+    case $1 in 
+       add) add $2;;
+       del) del $2;;
+    esac
+}
+
+fail_wan() {
+    local new_fail_count
+
+    local health_fail_retries=$(uci_get_state multiwan ${1} health_fail_retries)
+    local weight=$(uci_get_state multiwan ${1} weight)
+
+    local failchk=$(query_config failchk $1)
+    local recvrychk=$(query_config recvrychk $1)
+    wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]//g")
+
+    if [ -z "$failchk" ]; then
+       failchk=1
+       wan_fail_map="$wan_fail_map${1}[1]"
+    fi
+
+    if [ "$failchk" != "x" ]; then
+       new_fail_count=$(($failchk + 1))
+       if [ "$new_fail_count" -lt "$health_fail_retries" ]; then
+           wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]/$1\[${new_fail_count}\]/g")
+       else
+           failover add $1
+           refresh_dns
+           if [ "$weight" != "disable" ]; then
+               refresh_loadbalancer
+           fi
+       fi
+    fi
+    update_cache
+}
+
+recover_wan() {
+    local new_fail_count
+
+    local health_recovery_retries=$(uci_get_state multiwan ${1} health_recovery_retries)
+    local weight=$(uci_get_state multiwan ${1} weight)
+
+    local failchk=$(query_config failchk $1)
+    local recvrychk=$(query_config recvrychk $1)
+    local wanid=$(query_config wanid $1)
+
+    if [ ! -z "$failchk" -a "$failchk" != "x" ]; then
+       wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]//g")
+       update_cache
+    fi
+
+    if [ "$failchk" == "x" ]; then
+       if [ -z "$recvrychk" ]; then
+           wan_recovery_map="$wan_recovery_map${1}[1]"
+           update_cache
+           if [ "$health_recovery_retries" == "1" ]; then
+               recover_wan $1
+           fi
+       else
+           new_recovery_count=$(($recvrychk + 1))
+           if [ "$new_recovery_count" -lt "$health_recovery_retries" ]; then
+               wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]/$1\[${new_recovery_count}\]/g")
+               update_cache
+           else
+               failover del $1
+               refresh_dns
+               if [ "$weight" != "disable" ]; then
+                   refresh_loadbalancer
+               fi
+           fi
+       fi
+    fi
+}
+
+acquire_wan_data() {
+    local check_old_map
+    local get_wanid
+    local old_ifname
+    local old_ipaddr
+    local old_gateway
+
+    local ifname ipaddr gateway
+    network_get_device  ifname  ${1} || ifname=x
+    network_get_ipaddr  ipaddr  ${1} || ipaddr=x
+    network_get_gateway gateway ${1} || gateway=x
+
+    check_old_map=$(echo $wan_id_map 2>&1 | grep -o "$1\[")
+
+    if [ -z $check_old_map ]; then
+       wancount=$(($wancount + 1))
+       if [ $wancount -gt 20 ]; then
+           wancount=20
+           return
+       fi
+       wan_if_map="$wan_if_map${1}[${ifname}]"
+       wan_id_map="$wan_id_map${1}[${wancount}]"
+       wan_gw_map="$wan_gw_map${1}[${gateway}]"
+       wan_ip_map="$wan_ip_map${1}[${ipaddr}]"
+    else
+       old_ipaddr=$(query_config ipaddr $1)
+       old_gateway=$(query_config gateway $1)
+       old_ifname=$(query_config ifname $1)
+       get_wanid=$(query_config wanid $1)
+
+       wan_if_map=$(echo $wan_if_map | sed -e "s/${1}\[${old_ifname}\]/$1\[${ifname}\]/g")
+       wan_ip_map=$(echo $wan_ip_map | sed -e "s/${1}\[${old_ipaddr}\]/$1\[${ipaddr}\]/g")
+       wan_gw_map=$(echo $wan_gw_map | sed -e "s/${1}\[${old_gateway}\]/$1\[${gateway}\]/g")
+
+       if [ "$old_ifname" != "$ifname" ]; then
+           iptables -D MultiWanPreHandler -t mangle -i $old_$ifname -m state --state NEW -j FW${get_wanid}MARK
+           iptables -A MultiWanPreHandler -t mangle -i $ifname -m state --state NEW -j FW${get_wanid}MARK 
+           iptables -D MultiWanPostHandler -t mangle -o $old_$ifname -m mark --mark 0x1 -j FW${get_wanid}MARK
+           iptables -A MultiWanPostHandler -t mangle -o $ifname -m mark --mark 0x1 -j FW${get_wanid}MARK 
+       fi 
+
+       if [ "$ifname" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" ]; then
+           failover del $1
+           iprules_config $get_wanid
+       else
+           failover add $1
+       fi
+
+       refresh_routes
+       refresh_loadbalancer
+       refresh_dns
+       update_cache
+    fi
+}
+
+update_cache() {
+    if [ ! -d /tmp/.mwan ]; then
+       mkdir /tmp/.mwan > /dev/null 2>&1
+    fi
+
+    rm /tmp/.mwan/cache > /dev/null 2>&1
+    touch /tmp/.mwan/cache
+
+    echo "# Automatically Generated by Multi-WAN Agent Script. Do not modify or remove. #" > /tmp/.mwan/cache
+    echo "wan_id_map=\"$wan_id_map\"" >> /tmp/.mwan/cache
+    echo "wan_if_map=\"$wan_if_map\"" >> /tmp/.mwan/cache
+    echo "wan_ip_map=\"$wan_ip_map\"" >> /tmp/.mwan/cache
+    echo "wan_gw_map=\"$wan_gw_map\"" >> /tmp/.mwan/cache
+    echo "wan_fail_map=\"$wan_fail_map\"" >> /tmp/.mwan/cache
+    echo "wan_recovery_map=\"$wan_recovery_map\"" >> /tmp/.mwan/cache
+    echo "wan_monitor_map=\"$wan_monitor_map\"" >> /tmp/.mwan/cache
+}
+
+query_config() {
+    case $1 in
+       ifname) echo $wan_if_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';; 
+       ipaddr) echo $wan_ip_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
+       gateway) echo $wan_gw_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
+       wanid) echo $wan_id_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
+       failchk) echo $wan_fail_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
+       recvrychk) echo $wan_recovery_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
+       monitor) echo $wan_monitor_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
+       group) echo $wan_id_map | grep -o "\w*\[$2\]" | awk -F "[" '{print $1}';;
+    esac
+}
+
+mwan_kill() {
+    local otherpids=$(ps 2>&1 | grep 'multiwan agent' | grep -v $$ | awk '{print $1}')
+    [ -n "$otherpids" ] && kill $otherpids > /dev/null 2>&1
+    sleep 2
+}
+
+# For system shutdownl: stop
+#   A plain stop will leave network in a limp state, without wan access
+# stop single: restore to a single wan
+# stop restart: restart multiple wan's
+stop() {
+    mwan_kill
+    flush $1
+
+    if [ "$1" == "single" ]; then
+       # ifup is quite expensive--do it only when single wan is requested
+       echo "## Refreshing Interfaces ##"
+       local i=0
+       while [ $((i++)) -lt $wancount ]; do 
+           local group=$(query_config group $i)
+           ifup $group >&- 2>&- && sleep 1
+       done
+
+       echo "## Unloaded, updating syslog and exiting. ##"
+       mwnote "Succesfully Unloaded on $(exec date -R)."
+       rm -fr /tmp/.mwan >&- 2>&-
+    fi
+    ip route flush cache
+
+    if [ "$1" == "restart" ]; then
+       echo "## Restarting Multi-WAN. ##"
+       mwnote "Reinitializing Multi-WAN Configuration."
+       rm -fr /tmp/.mwan >&- 2>&-
+       /etc/init.d/multiwan start >&- 2>&-
+    fi
+
+    exit
+}
+
+clear_rules() {
+    local restore_single=$1
+    local group 
+
+    iptables -t mangle -D PREROUTING -j MultiWan
+    iptables -t mangle -D FORWARD -j MultiWan
+    iptables -t mangle -D OUTPUT -j MultiWan
+    iptables -t mangle -D POSTROUTING -j MultiWan
+    iptables -t mangle -F MultiWan
+    iptables -t mangle -X MultiWan
+    iptables -t mangle -F MultiWanRules
+    iptables -t mangle -X MultiWanRules
+    iptables -t mangle -F MultiWanDNS
+    iptables -t mangle -X MultiWanDNS
+    iptables -t mangle -F MultiWanPreHandler
+    iptables -t mangle -X MultiWanPreHandler
+    iptables -t mangle -F MultiWanPostHandler
+    iptables -t mangle -X MultiWanPostHandler
+    iptables -t mangle -F LoadBalancer
+    iptables -t mangle -X LoadBalancer
+    iptables -t mangle -F FastBalancer
+    iptables -t mangle -X FastBalancer
+    iptables -t mangle -F MultiWanLoadBalancer
+    iptables -t mangle -X MultiWanLoadBalancer
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       iptables -t mangle -F FW${i}MARK
+       iptables -t mangle -X FW${i}MARK
+    done
+
+    if [ ! -z "$CHKFORQOS" ]; then
+       iptables -t mangle -F PREROUTING
+       iptables -t mangle -F FORWARD
+       iptables -t mangle -F OUTPUT
+       iptables -t mangle -F POSTROUTING
+       iptables -t mangle -F MultiWanQoS
+       iptables -t mangle -X MultiWanQoS
+
+       i=0
+       while [ $((i++)) -lt $wancount ]; do 
+           group=$(query_config group $i)
+           iptables -t mangle -F qos_${group}
+           iptables -t mangle -F qos_${group}_ct
+           iptables -t mangle -X qos_${group}
+           iptables -t mangle -X qos_${group}_ct
+       done
+    fi
+
+    [ "$restore_single" == 'single' ] &&
+       /etc/init.d/qos restart > /dev/null 2>&1
+}
+
+qos_init() {
+    local ifname
+    local queue_count
+    local get_wan_tc
+    local get_wan_iptables
+    local add_qos_iptables
+    local add_qos_tc
+    local execute
+    local iprule
+    local qos_if_test
+
+    ifname=$(query_config ifname $1)
+
+    if [ "$ifname" == "x" ]; then
+       return
+    fi
+
+    qos_if_test=$(echo $qos_if_done | grep $ifname.)
+
+    if [ ! -z "$qos_if_test" ]; then
+       return
+    fi
+
+    qos_if_done=$(echo ${qos_if_done}.${ifname})
+
+    queue_count=$(tc filter list dev $ifname | tail -n 1 | awk -F " " '{print $10}' | sed "s/0x//g")
+
+    if [ -z "$queue_count" ]; then
+       return
+    fi
+
+    queue_count=$(($queue_count + 1))
+
+    iptables -t mangle -N qos_${1}
+    iptables -t mangle -N qos_${1}_ct
+
+    get_wan_tc=$(tc filter list dev $ifname | grep "0x" | sed -e "s/filter /tc filter add dev $ifname /g" -e "s/pref/prio/g" -e "s/fw//g") 
+    get_wan_iptables=$(iptables-save | egrep  '(-A Default )|(-A Default_ct )' | grep -v "MultiWanQoS" | sed -e "s/Default /qos_${1} /g" -e "s/Default_ct /qos_${1}_ct /g" -e "s/-A/iptables -t mangle -A/g")
+
+
+    local i=0
+    while [ $i -lt $queue_count ]; do 
+       echo "s/\(0x$i \|0x$i\/0xffffffff\)/0x$(($2 * 10 + $i)) /g" >> /tmp/.mwan/qos.$1.sedfilter
+       i=$(($i + 1))
+    done
+
+    add_qos_iptables=$(echo "$get_wan_iptables" | sed -f /tmp/.mwan/qos.$1.sedfilter)
+    echo "$add_qos_iptables" | while read execute; do ${execute}; done
+
+    rm /tmp/.mwan/qos.$1.sedfilter 
+    i=1
+    while [ $i -lt $queue_count ]; do 
+       echo "s/0x$i /0x${2}${i} fw /g" >> /tmp/.mwan/qos.$1.sedfilter
+       i=$(($i + 1))
+    done
+
+    add_qos_tc=$(echo "$get_wan_tc" | sed -f /tmp/.mwan/qos.$1.sedfilter)
+    echo "$add_qos_tc" | while read execute; do ${execute}; done
+    rm /tmp/.mwan/qos.$1.sedfilter
+
+    i=0
+    while [ $i -lt $queue_count ]; do
+       if [ $i -lt $(($queue_count - 1)) ]; then
+           ip rule add fwmark 0x$(($2 * 10 + $i + 1)) table $(($2 + 170)) prio $(( $2 * 10 + $i + 2))
+       fi
+       iptables -t mangle -A MultiWanQoS -m mark --mark 0x$(($2 * 10 + $i)) -j qos_${1}
+       i=$(($i + 1))
+    done
+}
+
+mwanrule() {
+    local src
+    local dst
+    local ports
+    local proto
+    local wanrule
+
+    config_get src $1 src
+    config_get dst $1 dst
+    config_get port_type $1 port_type 'dports'
+    config_get ports $1 ports
+    config_get proto $1 proto
+    config_get wanrule $1 wanrule
+
+    if [ -z "$wanrule" ]; then
+       return
+    fi
+
+    if [ "$wanrule" != "balancer" -a "$wanrule" != "fastbalancer" ]; then
+       wanrule=$(query_config wanid ${wanrule})
+       wanrule="FW${wanrule}MARK"
+    elif [ "$wanrule" == "balancer" ]; then
+       wanrule="LoadBalancer"
+    elif [ "$wanrule" == "fastbalancer" ]; then
+       wanrule="FastBalancer"
+    fi
+    if [ "$dst" == "all" ]; then
+       dst=$NULL
+    fi
+    if [ "$proto" == "all" ]; then
+       proto=$NULL
+    fi
+    if [ "$ports" == "all" ]; then
+       ports=$NULL
+    fi
+    add_rule() {
+       if [ "$proto" == "icmp" ]; then
+           ports=$NULL
+       fi 
+       if [ "$src" == "all" ]; then
+           src=$NULL
+       fi
+       iptables -t mangle -A MultiWanRules ${src:+-s $src} ${dst:+-d $dst} \
+           -m mark --mark 0x0 ${proto:+-p $proto -m $proto} \
+           ${ports:+-m multiport --$port_type $ports} \
+           -j $wanrule
+    }
+    if  [ -z "$proto" -a ! -z "$ports" ]; then
+       proto=tcp
+       add_rule
+       proto=udp
+       add_rule
+       return
+    fi
+    add_rule
+}
+
+refresh_dns() {
+    local dns
+    local group
+    local ipaddr
+    local gateway
+    local ifname
+    local failchk
+    local compile_dns
+    local dns_server
+
+    iptables -F MultiWanDNS -t mangle
+
+    rm /tmp/resolv.conf.auto
+    touch /tmp/resolv.conf.auto
+
+    echo "## Refreshing DNS Resolution and Tables ##"
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do
+       group=$(query_config group $i)
+       gateway=$(query_config gateway $group)
+       ipaddr=$(query_config ipaddr $group)
+       ifname=$(query_config ifname $group)
+       failchk=$(query_config failchk $group)
+
+       dns=$(uci_get_state multiwan ${group} dns 'auto')
+       [ "$dns" == "auto" ] && network_get_dnsserver dns ${group}
+       dns=$(echo $dns | sed -e "s/ /\n/g")
+
+       if [ ! -z "$dns" -a "$failchk" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" -a "$ifname" != "x" ]; then
+           echo "$dns" | while read dns_server; do
+               iptables -t mangle -A MultiWanDNS -d $dns_server -p tcp --dport 53 -j FW${i}MARK
+               iptables -t mangle -A MultiWanDNS -d $dns_server -p udp --dport 53 -j FW${i}MARK
+
+               compile_dns="nameserver $dns_server"
+               echo "$compile_dns" >> /tmp/resolv.conf.auto
+           done
+       fi
+    done
+
+    last_resolv_update=$(ls -l -e /tmp/resolv.conf.auto | awk -F " " '{print $5, $9}')
+}
+
+iptables_init() {
+    echo "## IPTables Rule Initialization ##"
+    local iprule
+    local group
+    local ifname
+    local execute
+    local IMQ_NFO
+    local default_route_id
+    local i
+
+    if [ ! -z "$CHKFORQOS" ]; then
+       echo "## QoS Initialization ##"
+
+       /etc/init.d/qos restart > /dev/null 2>&1
+
+       IMQ_NFO=$(iptables -n -L PREROUTING -t mangle -v | grep IMQ | awk -F " " '{print $6,$12}')
+
+       iptables -t mangle -F PREROUTING 
+       iptables -t mangle -F FORWARD
+       iptables -t mangle -F POSTROUTING
+       iptables -t mangle -F OUTPUT
+
+       echo "$IMQ_NFO" | while read execute; do
+           iptables -t mangle -A PREROUTING -i $(echo $execute | awk -F " " '{print $1}') -j IMQ --todev $(echo $execute | awk -F " " '{print $2}')
+       done
+
+       iptables -t mangle -N MultiWanQoS
+
+       i=0
+       while [ $((i++)) -lt $wancount ]; do 
+           qos_init $(query_config group $i) $i
+       done
+
+    fi
+
+    iptables -t mangle -N MultiWan
+    iptables -t mangle -N LoadBalancer
+    iptables -t mangle -N FastBalancer
+    iptables -t mangle -N MultiWanRules
+    iptables -t mangle -N MultiWanDNS
+    iptables -t mangle -N MultiWanPreHandler
+    iptables -t mangle -N MultiWanPostHandler
+    iptables -t mangle -N MultiWanLoadBalancer
+
+    echo "## Creating FW Rules ##"
+    i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       iprule=$(($i * 10))
+       iptables -t mangle -N FW${i}MARK
+       iptables -t mangle -A FW${i}MARK -j MARK --set-mark 0x${iprule}
+       iptables -t mangle -A FW${i}MARK -j CONNMARK --save-mark
+    done
+
+    iptables -t mangle -A LoadBalancer -j MARK --set-mark 0x1
+    iptables -t mangle -A LoadBalancer -j CONNMARK --save-mark
+
+    if [ -z "$CHKFORMODULE" ]; then
+       iptables -t mangle -A FastBalancer -j MARK --set-mark 0x2
+       iptables -t mangle -A FastBalancer -j CONNMARK --save-mark
+    else
+       mwnote "Performance load balancer(fastbalanacer) is unavailable due to current kernel limitations."
+       iptables -t mangle -A FastBalancer -j MARK --set-mark 0x1
+       iptables -t mangle -A FastBalancer -j CONNMARK --save-mark
+    fi
+
+    iptables -t mangle -A MultiWan -j CONNMARK --restore-mark
+    iptables -t mangle -A MultiWan -j MultiWanPreHandler
+    iptables -t mangle -A MultiWan -j MultiWanRules
+    iptables -t mangle -A MultiWan -j MultiWanLoadBalancer
+    iptables -t mangle -A MultiWan -j MultiWanDNS
+    iptables -t mangle -A MultiWan -j MultiWanPostHandler
+
+    iptables -t mangle -I PREROUTING -j MultiWan
+    iptables -t mangle -I FORWARD -j MultiWan
+    iptables -t mangle -I OUTPUT -j MultiWan
+    iptables -t mangle -I POSTROUTING -j MultiWan
+
+
+    refresh_dns
+
+    config_load "multiwan"
+    config_foreach mwanrule mwanfw
+
+    if [ "$default_route" != "balancer" -a "$default_route" != "fastbalancer" ]; then 
+       default_route_id=$(query_config wanid $default_route)
+       iptables -t mangle -A MultiWanRules -m mark --mark 0x0 -j FW${default_route_id}MARK
+    elif [ "$default_route" == "fastbalancer" ]; then
+       iptables -t mangle -A MultiWanRules -m mark --mark 0x0 -j FastBalancer
+    else
+       iptables -t mangle -A MultiWanRules -m mark --mark 0x0 -j LoadBalancer
+    fi
+
+    i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       group=$(query_config group $i)
+       ifname=$(query_config ifname $group)
+       iptables -t mangle -A MultiWanPreHandler -i $ifname -m state --state NEW -j FW${i}MARK
+       iptables -t mangle -A MultiWanPostHandler -o $ifname -m mark --mark 0x1 -j FW${i}MARK
+    done
+
+    if [ ! -z "$CHKFORQOS" ]; then
+       iptables -t mangle -A MultiWan -j MultiWanQoS
+    fi
+}
+
+refresh_loadbalancer() {
+    local group
+    local gateway
+    local ifname
+    local failchk
+    local weight
+    local nexthop
+    local pre_nexthop_chk
+    local rand_probability
+
+    echo "## Refreshing Load Balancer ##"
+
+    ip rule del prio 9 > /dev/null 2>&1 
+    ip route flush table 170 > /dev/null 2>&1
+
+    for TABLE in 170; do
+       ip route | grep -Ev ^default | while read ROUTE; do
+           ip route add table $TABLE to $ROUTE
+       done
+    done
+
+    iptables -F MultiWanLoadBalancer -t mangle
+
+    local total_weight=0
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       group=$(query_config group $i)
+       failchk=$(query_config failchk $group)
+       gateway=$(query_config gateway $group)
+       ifname=$(query_config ifname $group)
+       weight=$(uci_get_state multiwan ${group} weight)
+       if [ "$gateway" != "x" -a "$ifname" != "x" -a "$failchk" != "x" -a "$weight" != "disable" ]; then
+           total_weight=$(($total_weight + $weight))
+       fi
+    done
+
+    i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       group=$(query_config group $i)
+       failchk=$(query_config failchk $group)
+       gateway=$(query_config gateway $group)
+       ifname=$(query_config ifname $group)
+
+       weight=$(uci_get_state multiwan ${group} weight)
+
+       if [ "$gateway" != "x" -a "$ifname" != "x" -a "$failchk" != "x" -a "$weight" != "disable" ]; then
+           nexthop="$nexthop nexthop via $gateway dev $ifname weight $weight"
+
+           rand_probability=$(($weight * 100 / $total_weight))
+           total_weight=$(($total_weight - $weight))
+
+           if [ $rand_probability -lt 10 ]; then
+               rand_probability="0.0${rand_probability}"
+           elif [ $rand_probability -lt 100 ]; then
+               rand_probability="0.${rand_probability}"
+           else
+               rand_probability="1.0"
+           fi
+
+           if [ -z "$CHKFORMODULE" ]; then
+               iptables -A MultiWanLoadBalancer -t mangle -m mark --mark 0x2 -m statistic --mode random --probability $rand_probability -j FW${i}MARK
+           fi
+       fi
+
+    done
+
+    pre_nexthop_chk=$(echo $nexthop | awk -F "nexthop" '{print NF-1}')
+    if [ "$pre_nexthop_chk" == "1" ]; then
+       ip route add default via $(echo $nexthop | awk -F " " '{print $3}') dev $(echo $nexthop | awk -F " " '{print $5}') proto static table 170
+    elif [ "$pre_nexthop_chk" -gt "1" ]; then
+       ip route add proto static table 170 default scope global $nexthop
+    fi
+
+    ip rule add fwmark 0x1 table 170 prio 9
+    ip route flush cache
+}
+
+refresh_routes() {
+    local iprule
+    local gateway
+    local group
+    local ifname
+    local ipaddr
+
+    echo "## Refreshing Routing Tables ##"
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       group=$(query_config group $i)
+       gateway=$(query_config gateway $group)
+       ifname=$(query_config ifname $group)
+       ipaddr=$(query_config ipaddr $group)
+       ip route flush table $(($i + 170)) > /dev/null 2>&1
+
+       TABLE=$(($i + 170))
+       ip route | grep -Ev ^default | while read ROUTE; do
+           ip route add table $TABLE to $ROUTE
+       done
+
+       if [ "$gateway" != "x" -a "$ipaddr" != "x" -a "$ifname" != "x" ]; then
+           ip route add default via $gateway table $(($i + 170)) src $ipaddr proto static
+           route add default gw $gateway > /dev/null 2>&1
+       fi
+    done
+
+    ip route flush cache
+}
+
+iprules_config() {
+    local iprule
+    local group
+    local gateway
+    local ipaddr
+
+    group=$(query_config group $1)
+    gateway=$(query_config gateway $group)
+    ipaddr=$(query_config ipaddr $group)
+
+    CHKIPROUTE=$(grep MWAN${1} /etc/iproute2/rt_tables)
+    if [ -z "$CHKIPROUTE" ]; then
+       echo "$(($1 + 170)) MWAN${1}" >> /etc/iproute2/rt_tables
+    fi
+
+    ip rule del prio $(($1 * 10)) > /dev/null 2>&1 
+    ip rule del prio $(($1 * 10 + 1)) > /dev/null 2>&1
+
+    if [ "$gateway" != "x" -a "$ipaddr" != "x" ]; then
+       ip rule add from $ipaddr table $(($1 + 170)) prio $(($1 * 10))
+       ip rule add fwmark 0x$(($1 * 10)) table $(($1 + 170)) prio $(($1 * 10 + 1))
+    fi
+}
+
+flush() {
+    local restore_single=$1
+    echo "## Flushing IP Rules & Routes ##"
+
+    ip rule flush > /dev/null 2>&1
+    ip rule add lookup main prio 32766 > /dev/null 2>&1
+    ip rule add lookup default prio 32767 > /dev/null 2>&1
+
+    ip route flush table 170 > /dev/null
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       ip route del default > /dev/null 2>&1
+       ip route flush table $(($i + 170)) > /dev/null 2>&1
+    done
+
+    echo "## Clearing Rules ##"
+    clear_rules $restore_single > /dev/null 2>&1
+
+    rm $jobfile > /dev/null 2>&1
+}
+
+main_init() {
+    local RP_PATH IFACE
+    local group
+    local health_interval
+
+    echo "## Main Initialization ##"
+
+    mkdir /tmp/.mwan > /dev/null 2>&1
+
+    mwan_kill
+    flush
+
+    echo "## IP Rules Initialization ##"
+
+    CHKIPROUTE=$(grep LoadBalancer /etc/iproute2/rt_tables)
+    if [ -z "$CHKIPROUTE" ]; then
+       echo "#" >> /etc/iproute2/rt_tables
+       echo "170 LoadBalancer" >> /etc/iproute2/rt_tables
+    fi
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       iprules_config $i
+    done
+
+    refresh_routes
+    iptables_init
+
+    refresh_loadbalancer
+
+    RP_PATH=/proc/sys/net/ipv4/conf
+    for IFACE in $(ls $RP_PATH); do
+       echo 0 > $RP_PATH/$IFACE/rp_filter
+    done
+    mwnote "Succesfully Initialized on $(date -R)."
+    fail_start_check
+
+    while :; do
+       schedule_tasks
+       do_tasks
+    done
+}
+
+monitor_wan() {
+    local ifname ipaddr gateway icmp_hosts_acquire icmp_test_host
+    local check_test
+
+    . /tmp/.mwan/cache
+
+    local timeout=$(uci_get_state multiwan ${1} timeout)
+    local icmp_hosts=$(uci_get_state multiwan ${1} icmp_hosts)
+    local icmp_count=$(uci_get_state multiwan ${1} icmp_count '1')
+    local health_interval=$(uci_get_state multiwan ${1} health_interval)
+    local ifname_cur=$(query_config ifname $1)
+    local ipaddr_cur=$(query_config ipaddr $1)
+    local gateway_cur=$(query_config gateway $1)
+
+    while :; do
+       [ "${health_monitor%.*}" = 'parallel' ] && sleep $health_interval
+
+       network_get_device  ifname  ${1} || ifname=x
+       network_get_ipaddr  ipaddr  ${1} || ipaddr=x
+       network_get_gateway gateway ${1} || gateway=x
+
+       if [ "$ifname_cur" != "$ifname" -o "$ipaddr_cur" != "$ipaddr" -o "$gateway_cur" != "$gateway" ]; then
+           add_task "$1" acquire
+           if [ "${health_monitor%.*}" = 'parallel' ]; then
+               exit
+           else
+               return
+           fi
+       else
+           [ "$gateway" != "x" ] && ! ip route | grep -o $gateway >&- 2>&- &&
+               add_task route refresh
+       fi
+
+       if [ "$icmp_hosts" != "disable" -a "$ifname" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" ]; then
+
+           if [ "$icmp_hosts" == "gateway" -o -z "$icmp_hosts" ]; then
+               icmp_hosts_acquire=$gateway
+           elif [ "$icmp_hosts" == "dns" ]; then
+               icmp_hosts_acquire=$(uci_get_state multiwan $1 dns 'auto')
+               [ "$icmp_hosts_acquire" == "auto" ] &&
+                       network_get_dnsserver icmp_hosts_acquire $1
+           else
+               icmp_hosts_acquire=$icmp_hosts
+           fi
+
+           icmp_hosts=$(echo $icmp_hosts_acquire | sed -e "s/\,/ /g" | sed -e "s/ /\n/g")
+
+           ping_test() {
+               echo "$icmp_hosts" | while read icmp_test_host; do
+                   ping -c "$icmp_count" -W $timeout -I $ifname $icmp_test_host 2>&1 | grep -o "round-trip"
+               done
+           }
+
+           check_test=$(ping_test)
+
+           if [ -z "$check_test" ]; then
+               add_task "$1" fail
+           else
+               add_task "$1" pass
+           fi                  
+
+       elif [ "$icmp_hosts" == "disable" ]; then 
+           add_task "$1" pass
+       fi
+
+       [ "$health_monitor" = 'serial' ] && {
+           wan_monitor_map=$(echo $wan_monitor_map | sed -e "s/$1\[\w*\]/$1\[$(date +%s)\]/g")
+           update_cache
+           break
+       }
+    done
+}
+
+# Add a task to the $jobfile while ensuring
+# no duplicate tasks for the specified group
+add_task() {
+    local group=$1
+    local task=$2
+    grep -o "$group.$task" $jobfile >&- 2>&- || echo "$group.$task" >> $jobfile
+}
+
+# For health_monitor "parallel", start a background monitor for each group.
+# For health_monitor "serial", queue monitor tasks for do_tasks.
+schedule_tasks() {
+    local group health_interval monitored_last_at current_time diff delay
+    local i=0
+
+    get_health_interval() {
+       group=$(query_config group $1)
+       health_interval=$(uci_get_state multiwan ${group} health_interval 'disable')
+       [ "$health_interval" = "disable" ] && health_interval=0
+    }
+
+    [ "$health_monitor" = 'parallel' ] && {
+       while [ $((i++)) -lt $wancount ]; do
+           get_health_interval $i
+           if [ "$health_interval" -gt 0 ]; then
+               monitor_wan $group &
+               sleep 1
+           fi
+       done
+       echo "## Started background monitor_wan ##"
+       health_monitor="parallel.started"
+    }
+
+    [ "$health_monitor" = 'serial' ] && {
+       local monitor_disabled=1
+
+       until [ -f $jobfile ]; do
+           current_time=$(date +%s)
+           delay=$max_interval
+           i=0
+
+           while [ $((i++)) -lt $wancount ]; do
+               get_health_interval $i
+               if [ "$health_interval" -gt 0 ]; then
+                   monitor_disabled=0
+
+                   monitored_last=$(query_config monitor $group)
+                   [ -z "$monitored_last" ] && {
+                       monitored_last=$current_time
+                       wan_monitor_map="${wan_monitor_map}${group}[$monitored_last]"
+                       update_cache
+                   }
+
+                   will_monitor_at=$(($monitored_last + $health_interval))
+                   diff=$(($will_monitor_at - $current_time))
+                   [ $diff -le 0 ] && add_task "$group" 'monitor'
+
+                   delay=$(($delay > $diff ? $diff : $delay))
+               fi
+           done
+
+           [ "$monitor_disabled" -eq 1 ] && {
+               # Although health monitors are disabled, still
+               # need to check up on iptables rules in do_tasks
+               sleep "$iptables_interval"
+               break
+           }
+           [ $delay -gt 0 ] && sleep $delay
+       done
+    }
+}
+
+rule_counter=0
+# Process each task in the $jobfile in FIFO order
+do_tasks() {
+    local check_iptables
+    local queued_task
+    local current_resolv_file
+
+    while :; do
+
+       . /tmp/.mwan/cache
+
+       if [ "$((++rule_counter))" -eq 5 -o "$health_monitor" = 'serial' ]; then
+
+           check_iptables=$(iptables -n -L MultiWan -t mangle | grep "references" | awk -F "(" '{print $2}' | cut -d " " -f 1)
+
+           if [ -z "$check_iptables" -o "$check_iptables" -lt 4 ]; then
+               mwnote "Netfilter rules appear to of been altered."
+               /etc/init.d/multiwan restart
+               exit
+           fi
+
+           current_resolv_file=$(ls -l -e /tmp/resolv.conf.auto | awk -F " " '{print $5, $9}')
+
+           if [ "$last_resolv_update" != "$current_resolv_file" ]; then
+               refresh_dns
+           fi
+
+           rule_counter=0
+       fi
+
+       if [ -f $jobfile ]; then
+
+           mv $jobfile $jobfile.work
+
+           while read LINE; do 
+
+               execute_task() {
+                   case $2 in 
+                       fail) fail_wan $1;;
+                       pass) recover_wan $1;;
+                       acquire)
+                           acquire_wan_data $1
+                           [ "${health_monitor%.*}" = 'parallel' ] && {
+                               monitor_wan $1 &
+                               echo "## Started background monitor_wan ##"
+                           }
+                           ;;
+                       monitor) monitor_wan $1;;
+                       refresh) refresh_routes;;
+                       *) echo "## Unknown task command: $2 ##";;
+                   esac
+               }
+
+               queued_task=$(echo $LINE | awk -F "." '{print $1,$2}')
+               execute_task $queued_task
+           done < $jobfile.work
+
+           rm $jobfile.work
+       fi
+
+       if [ "$health_monitor" = 'serial' ]; then
+           break
+       else
+           sleep 1
+       fi
+    done
+}
+
+fail_start_check(){ 
+    local ipaddr
+    local gateway
+    local ifname
+    local group
+
+    local i=0
+    while [ $((i++)) -lt $wancount ]; do 
+       group=$(query_config group $i)
+       ifname=$(query_config ifname $group)
+       ipaddr=$(query_config ipaddr $group)
+       gateway=$(query_config gateway $group)
+
+       if [ "$ifname" == "x" -o "$ipaddr" == "x" -o "$gateway" == "x" ]; then
+           failover add $group
+       fi
+    done
+}
+
+wancount=0
+max_interval=$(((1<<31) - 1))
+
+config_load "multiwan"
+config_get_bool        enabled config  enabled '1'
+[ "$enabled" -gt 0 ] || exit
+config_get default_route       config default_route
+config_get health_monitor      config health_monitor
+config_get iptables_interval   config iptables_interval '30'
+config_get debug               config debug
+
+[ "$health_monitor" = 'serial' ] || health_monitor='parallel'
+
+config_foreach acquire_wan_data interface
+
+update_cache
+
+CHKFORQOS=$(iptables -n -L Default -t mangle 2>&1 | grep "Chain Default")
+CHKFORMODULE=$(iptables -m statistic 2>&1 | grep -o "File not found")
+
+jobfile="/tmp/.mwan/jobqueue"
+
+case $1 in
+    agent) silencer main_init;;
+    stop) silencer stop;;
+    restart) silencer stop restart;;
+    single) silencer stop single;;
+esac
diff --git a/net/mutella/Makefile b/net/mutella/Makefile
new file mode 100644 (file)
index 0000000..d7a3502
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2007-2010 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:=mutella
+PKG_VERSION:=0.4.5
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=1a676eacf562e3b8de90493f99fe059c
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mutella
+  SUBMENU:=P2P
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Gnutella client with command line and http interface
+  URL:=http://mutella.sourceforge.net/
+  DEPENDS:=+libncurses +libreadline +libpthread +libstdcpp +zlib
+endef
+
+define Package/mutella/description
+ Mutella supports all the functionality required to participate as
+ a full-featured node in the Gnutella network. "Full-featured" implies
+ support for file search, download and sharing. It is optimized for a
+ high-bandwidth connection, where it sets standards for server
+ performance and stability, but can also run on a modest-speed line.
+ .
+ Mutella can either be controlled via a colourful text mode interface
+ or via a web browser using a built in http interface.
+endef
+
+CONFIGURE_VARS += \
+       CXXFLAGS="$$$$CXXFLAGS -fno-rtti"  \
+
+define Package/mutella/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mutella{,_sio} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/mutella $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,mutella))
+
diff --git a/net/mutella/patches/001-no_backtrace.patch b/net/mutella/patches/001-no_backtrace.patch
new file mode 100644 (file)
index 0000000..65021db
--- /dev/null
@@ -0,0 +1,15 @@
+Index: mutella-0.4.5/mutella/main.cpp
+===================================================================
+--- mutella-0.4.5.orig/mutella/main.cpp        2007-09-22 05:48:22.000000000 +0200
++++ mutella-0.4.5/mutella/main.cpp     2007-09-22 05:48:22.000000000 +0200
+@@ -45,6 +45,10 @@
+ #define HAVE_BACKTRACE
+ #endif
++#ifdef __UCLIBC__
++#undef HAVE_BACKTRACE
++#endif
++
+ #ifdef HAVE_BACKTRACE
+ #include <execinfo.h>
+ #endif
diff --git a/net/mutella/patches/002-gcc4_fixes.patch b/net/mutella/patches/002-gcc4_fixes.patch
new file mode 100644 (file)
index 0000000..249d9c8
--- /dev/null
@@ -0,0 +1,12 @@
+Index: mutella-0.4.5/mutella/gnushare.h
+===================================================================
+--- mutella-0.4.5.orig/mutella/gnushare.h      2007-09-22 05:48:21.000000000 +0200
++++ mutella-0.4.5/mutella/gnushare.h   2007-09-22 05:48:27.000000000 +0200
+@@ -26,6 +26,7 @@
+ #include "mthread.h"
+ class MGnuDirector;
++class MShareThread;
+ class MGnuShare  
+ {
diff --git a/net/mutella/patches/003-gcc4_3_fixes.patch b/net/mutella/patches/003-gcc4_3_fixes.patch
new file mode 100644 (file)
index 0000000..f7be59d
--- /dev/null
@@ -0,0 +1,34 @@
+diff --git a/mutella/common.h b/mutella/common.h
+--- a/mutella/common.h
++++ b/mutella/common.h
+@@ -50,7 +50,7 @@ CString restore_string(CString s, bool bFormMode = true);
+ bool QueryMatch(CString Result, const CString& Query);
+ // fast functions which do not copy the string
+ void MakeWordList(LPSTR szQuery, vector<char*>& QWords);
+-void MakeWordList(LPSTR szQuery, vector<char*>& QWords, vector<char*>& QWords);
++void MakeWordList(LPSTR szQuery, vector<char*>& QWordsInc, vector<char*>&QWordsExc);
+ bool MatchWordList(const CString& ResultLower, const vector<char*>& QWords, bool bMatchAll = true);
+ // slower but 'storage-independent' versions
+diff --git a/mutella/mutella.h b/mutella/mutella.h
+--- a/mutella/mutella.h
++++ b/mutella/mutella.h
+@@ -79,6 +79,7 @@ using std::insert_iterator;
+ #include <arpa/inet.h>
+ #include <netdb.h>
+ #include <errno.h>
++#include <cstring>
+ // library-type includes
+ #include "defines.h"
+diff --git a/mutella/tstring.h b/mutella/tstring.h
+--- a/mutella/tstring.h
++++ b/mutella/tstring.h
+@@ -22,6 +22,7 @@
+ #define __TSTRING_H__INCLUDED__
+ #include <stdarg.h>
++#include <climits>
+ #include <iostream>
+ #ifdef TSTRING_DEBUG
diff --git a/net/mutella/patches/004-no-host-paths.patch b/net/mutella/patches/004-no-host-paths.patch
new file mode 100644 (file)
index 0000000..c32e524
--- /dev/null
@@ -0,0 +1,58 @@
+--- a/mutella/Makefile.am
++++ b/mutella/Makefile.am
+@@ -12,8 +12,8 @@ EXTRA_DIST = main.cpp common.cpp common.
+ ####### kdevelop will overwrite this part!!! (end)############
+ # set the include path found by configure
+-INCLUDES= $(all_includes) -I$(includedir)
++INCLUDES= $(all_includes)
+  
+ # the library search path.
+-mutella_LDFLAGS = $(all_libraries) -L$(libdir)
++mutella_LDFLAGS = $(all_libraries)
+                                                                                 
+--- a/mutella/Makefile.in
++++ b/mutella/Makefile.in
+@@ -221,10 +221,10 @@ EXTRA_DIST = main.cpp common.cpp common.
+ ####### kdevelop will overwrite this part!!! (end)############
+ # set the include path found by configure
+-INCLUDES = $(all_includes) -I$(includedir)
++INCLUDES = $(all_includes)
+ # the library search path.
+-mutella_LDFLAGS = $(all_libraries) -L$(libdir)
++mutella_LDFLAGS = $(all_libraries)
+ all: all-recursive
+ .SUFFIXES:
+--- a/util/Makefile.am
++++ b/util/Makefile.am
+@@ -9,10 +9,10 @@ bin_PROGRAMS = mutella_sio
+ mutella_sio_SOURCES = sockio.c
+ # set the include path found by configure
+-INCLUDES= $(all_includes) -I$(includedir)
++INCLUDES= $(all_includes)
+ # the library search path.
+-mutella_sio_LDFLAGS = $(all_libraries) -L$(libdir)
++mutella_sio_LDFLAGS = $(all_libraries)
+--- a/util/Makefile.in
++++ b/util/Makefile.in
+@@ -166,10 +166,10 @@ EXTRA_DIST = sockio.c 
+ mutella_sio_SOURCES = sockio.c
+ # set the include path found by configure
+-INCLUDES = $(all_includes) -I$(includedir)
++INCLUDES = $(all_includes)
+ # the library search path.
+-mutella_sio_LDFLAGS = $(all_libraries) -L$(libdir)
++mutella_sio_LDFLAGS = $(all_libraries)
+ all: all-am
+ .SUFFIXES:
diff --git a/net/mvprelay/Makefile b/net/mvprelay/Makefile
new file mode 100644 (file)
index 0000000..432e7ff
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007 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:=mvprelay
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
+PKG_MD5SUM:=189fb792470c966834d5204705ebee83
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mvprelay
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=relays requests from the MVP
+  URL:=http://mvpmc.wikispaces.com/mvprelay
+endef
+
+define Package/mvprelay/description
+       Relays requests from the MediaMVP to the TFTP server
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/$(PKG_NAME).c -o $(PKG_BUILD_DIR)/$(PKG_NAME)
+endef
+
+define Package/mvprelay/install        
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,mvprelay))
diff --git a/net/n2n/Makefile b/net/n2n/Makefile
new file mode 100644 (file)
index 0000000..1925dc8
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2007-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_BRANCH:=trunk
+PKG_SOURCE_URL:=https://svn.ntop.org/svn/ntop/trunk/n2n
+PKG_REV:=3875
+
+PKG_NAME:=n2n
+PKG_VERSION:=$(PKG_REV)
+PKG_RELEASE:=4
+
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/n2n
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=VPN tunneling daemon
+  URL:=http://www.ntop.org/n2n/
+  SUBMENU:=VPN
+  DEPENDS:=+libpthread +kmod-tun
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               INSTALL_PROG=":"
+endef
+
+define Package/n2n/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/edge $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/supernode $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/n2n.config $(1)/etc/config/n2n
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/n2n.init $(1)/etc/init.d/n2n
+endef
+
+define Package/n2n/conffiles
+/etc/config/n2n
+endef
+
+$(eval $(call BuildPackage,n2n))
diff --git a/net/n2n/files/n2n.config b/net/n2n/files/n2n.config
new file mode 100644 (file)
index 0000000..bf4acfe
--- /dev/null
@@ -0,0 +1,7 @@
+config edge
+       option ipaddr           ''
+       option supernode        ''
+       option port             ''
+       option community        ''
+       option key              ''
+       option route            ''
diff --git a/net/n2n/files/n2n.init b/net/n2n/files/n2n.init
new file mode 100644 (file)
index 0000000..2454de2
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2012 OpenWrt.org
+
+START=90
+
+start_instance() {
+       local cfg="$1"
+
+       config_get type "$cfg" TYPE
+
+       case "$type" in
+         edge)
+               config_get ipaddr "$cfg" 'ipaddr'
+               [ -n "$ipaddr" ] || return 1
+               config_get supernode "$cfg" 'supernode'
+               config_get port "$cfg" 'port'
+               config_get community "$cfg" 'community'
+               config_get key "$cfg" 'key'
+               config_get_bool route "$cfg" 'route' '0'
+               [ "$route" = "1" ] && args='-r'
+               service_start /usr/sbin/edge -f $args -a $ipaddr -c $community -k $key -l ${supernode}:${port}
+               ;;
+         supernode)
+               config_get port "$cfg" port
+               [ -n "$port" ] || return 1
+               service_start /usr/sbin/supernode -l $port
+               ;;
+       esac
+}
+
+stop_instance() {
+       local cfg="$1"
+
+       config_get type "$cfg" TYPE
+
+       case "$type" in
+         edge)
+               service_stop /usr/sbin/edge
+               ;;
+         supernode)
+               service_stop /usr/sbin/supernode
+               ;;
+       esac
+}
+
+start() {
+       config_load 'n2n'
+       config_foreach start_instance 'edge'
+       config_foreach start_instance 'supernode'
+}
+
+stop() {
+       config_load 'n2n'
+       config_foreach stop_instance 'edge'
+       config_foreach stop_instance 'supernode'
+}
diff --git a/net/natpmp/Makefile b/net/natpmp/Makefile
new file mode 100644 (file)
index 0000000..c936359
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2007-2012 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:=natpmp
+PKG_VERSION:=0.2.3
+PKG_RELEASE:=5
+
+PKG_SOURCE_URL:=http://download.savannah.nongnu.org/releases/natpmp/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=f696565d59c488b9ad9f43625be93377
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/natpmp
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip
+  SUBMENU:=Firewall
+  TITLE:=A daemon implementing NAT-PMP
+  URL:=http://savannah.nongnu.org/projects/natpmp
+endef
+
+define Package/natpmp/description
+       This is a daemon implementing NAT-PMP. NAT-PMP is a protocol for
+       handling port forwarding requests from clients behind a NAT.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CC="$(TARGET_CC)" \
+               LD="$(TARGET_CC)" \
+               CFLAGS="$(strip $(TARGET_CFLAGS))" \
+               CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS) -DIPTABLES_PATH=\\\"/usr/sbin\\\"" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               prefix="$(PKG_INSTALL_DIR)/usr"
+endef
+
+define Package/natpmp/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/natpmp $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/natpmp.config $(1)/etc/config/natpmp
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/natpmp.init $(1)/etc/init.d/natpmp
+endef
+
+define Package/natpmp/conffiles
+/etc/config/natpmp
+endef
+
+$(eval $(call BuildPackage,natpmp))
diff --git a/net/natpmp/files/natpmp.config b/net/natpmp/files/natpmp.config
new file mode 100644 (file)
index 0000000..9239d56
--- /dev/null
@@ -0,0 +1,4 @@
+config natpmp
+       option outbound_interface       wan
+       option inbound_interfaces       lan
+       option iptables_chain           natpmp
diff --git a/net/natpmp/files/natpmp.init b/net/natpmp/files/natpmp.init
new file mode 100644 (file)
index 0000000..374e364
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/sh /etc/rc.common
+
+START=70
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+IP=$(which ip)
+IPTABLES=$(which iptables)
+NATPMP=/usr/sbin/natpmp
+PIDFILE=/var/run/natpmp.pid
+
+natpmp_config() {
+       local cfg="$1"
+
+       config_get PUBLIC_IF "$cfg" outbound_interface
+       config_get PRIVATE_IFS "$cfg" inbound_interfaces
+       config_get IPTABLES_CHAIN "$cfg" iptables_chain
+}
+
+start() {
+       config_load natpmp
+       config_foreach natpmp_config natpmp
+
+       . /lib/functions/network.sh
+
+       # Flush all the rules in the natpmp chain, or create it, if it doesn't exists.
+       $IPTABLES -t nat -F $IPTABLES_CHAIN 2>/dev/null || \
+       $IPTABLES -t nat -N $IPTABLES_CHAIN
+
+       # Handle all incoming connections in the natpmp chain.
+       $IPTABLES -t nat -D PREROUTING -j $IPTABLES_CHAIN 2>/dev/null || true
+       $IPTABLES -t nat -A PREROUTING -j $IPTABLES_CHAIN
+
+       # Iterate through the private interfaces.
+       BIND_ARGS=""
+       for IF in $PRIVATE_IFS; do
+               local dev
+               network_get_device dev "$IF" || dev="$IF"
+
+               # Get the IP address of this interface.
+               ADDR=`$IP addr show dev $dev 2>/dev/null | grep "^ *inet .* $dev\$" | cut -d " " -f 6 | cut -d / -f 1`
+               if [ -n "$ADDR" ] ; then
+                       # Add the IP address to the argument list.
+                       BIND_ARGS="$BIND_ARGS -a $ADDR"
+               else
+                       echo "Could not get IP address of interface $dev. Skipping." >&2
+               fi
+       done
+
+       if [ -z "$BIND_ARGS" ] ; then
+               echo "No IP addresses to bind to. Exiting." >&2
+               exit 1
+       fi
+
+       local pubdev
+       network_get_device pubdev "$PUBLIC_IF" || pubdev="$PUBLIC_IF"
+
+       SERVICE_PID_FILE="$PIDFILE"
+       service_start $NATPMP -i "$pubdev" $BIND_ARGS -- "$IPTABLES_CHAIN"
+}
+
+stop() {
+       config_load natpmp
+       config_foreach natpmp_config natpmp
+
+       # Unlink chain
+       $IPTABLES -t nat -D PREROUTING -j $IPTABLES_CHAIN 2>/dev/null || true
+
+       # Flush all the rules in the natpmp chain
+       $IPTABLES -t nat -F $IPTABLES_CHAIN 2>/dev/null && \
+       $IPTABLES -t nat -X $IPTABLES_CHAIN
+
+       SERVICE_PID_FILE="$PIDFILE"
+       service_stop $NATPMP
+}
diff --git a/net/nbd/Makefile b/net/nbd/Makefile
new file mode 100644 (file)
index 0000000..ea63cc8
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# 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:=nbd
+PKG_VERSION:=2.9.23
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/nbd
+PKG_MD5SUM:=065b6ded41887a08be6dbb8d77280f24
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+# -liconv due to glib2, to be revisited later
+include $(INCLUDE_DIR)/nls.mk
+
+PKG_BUILD_DEPENDS:=glib2 libintl
+
+define Package/nbd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Network Block Device utilities
+  URL:=http://nbd.sourceforge.net
+  DEPENDS:=+kmod-nbd
+endef
+
+define Package/nbd/description
+  This package contains the network block device client.
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-glibtest
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               nbd-client
+endef
+
+define Package/nbd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nbd-client $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,nbd))
diff --git a/net/nbtscan/Makefile b/net/nbtscan/Makefile
new file mode 100644 (file)
index 0000000..693d7b0
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2008 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:=nbtscan
+PKG_VERSION:=1.5.1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/n/nbtscan/
+PKG_MD5SUM:=85bb085077c380b82a6ff73e0de0c154
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nbtscan
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=NBTscan is a program for scanning IP networks for NetBIOS name information
+  URL:=http://www.inetcat.net/software/nbtscan.html
+endef
+
+define Package/nbtscan/description
+       NBTscan is a program for scanning IP networks for NetBIOS name information.
+       It sends NetBIOS status query to each address in supplied range and lists
+       received information in human readable form. For each responded host it lists
+       IP address, NetBIOS computer name, logged-in user name and MAC address.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)"
+endef
+
+
+define Package/nbtscan/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nbtscan $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,nbtscan))
diff --git a/net/ncftp/Makefile b/net/ncftp/Makefile
new file mode 100644 (file)
index 0000000..053ab7f
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2010-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:=ncftp
+PKG_VERSION:=3.2.5
+PKG_RELEASE:=1
+
+PKG_INSTALL:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.ncftp.com/ncftp
+PKG_MD5SUM:=b05c7a6d5269c04891f02f43d4312b30
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ncftp/Default
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=File Transfer
+ TITLE:=NcFTP Client
+ URL:=http://www.ncftpd.com/
+endef
+
+define Package/ncftp/Default/description
+ NcFTP Client (also known as just NcFTP) is a set of FREE application
+ programs implementing the File Transfer Protocol (FTP).
+endef
+
+define Package/ncftp
+$(call Package/ncftp/Default)
+ TITLE+= (main program)
+endef
+
+define Package/ncftp/description
+$(call Package/ncftp/Default/description)
+ Main program.
+endef
+
+define Package/ncftp-utils
+$(call Package/ncftp/Default)
+ TITLE+= (utilities)
+endef
+
+define Package/ncftp-utils/description
+$(call Package/ncftp/Default/description)
+ Utilities.
+endef
+
+define Package/ncftp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncftp $(1)/usr/bin/
+endef
+
+define Package/ncftp-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/ncftp{batch,get,ls,put,spooler} \
+               $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ncftp))
+$(eval $(call BuildPackage,ncftp-utils))
diff --git a/net/ndyndns/Makefile b/net/ndyndns/Makefile
new file mode 100644 (file)
index 0000000..180d7d2
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2008-2012 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:=ndyndns
+PKG_VERSION:=2.1
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ndyndns.googlecode.com/files
+PKG_MD5SUM:=0cdb4dcba5f8c1664f53884b3c2179e9
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKE_FLAGS:=PLATFORM=linux
+
+define Package/ndyndns
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=DynDNS.com update daemon
+  URL:=http://ndyndns.googlecode.com/
+  DEPENDS:=+libcurl +libopenssl
+endef
+
+define Package/ndyndns/description
+       The ndyndns daemon is an update client for DynDNS.com. It
+       checks for an IP address change every two minutes, avoids
+       unnecessary updates, reports errors, logs to syslog, and
+       generally complies with everything required of a proper dyndns
+       client.
+endef
+
+define Package/ndyndns/conffiles
+/etc/ndyndns/ndyndns.conf.sample
+endef
+
+define Package/ndyndns/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ndyndns $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/ndyndns.init $(1)/etc/init.d/ndyndns
+       $(INSTALL_DIR) $(1)/etc/ndyndns
+       $(INSTALL_CONF) files/ndyndns.conf.sample $(1)/etc/ndyndns
+endef
+
+$(eval $(call BuildPackage,ndyndns))
diff --git a/net/ndyndns/files/ndyndns.conf.sample b/net/ndyndns/files/ndyndns.conf.sample
new file mode 100644 (file)
index 0000000..eedd341
--- /dev/null
@@ -0,0 +1,7 @@
+[config]
+
+[dyndns]
+username = user
+password = password
+hosts = hostname.dyndns.org
+wildcard
diff --git a/net/ndyndns/files/ndyndns.init b/net/ndyndns/files/ndyndns.init
new file mode 100644 (file)
index 0000000..0ef1ccd
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+
+START=80
+
+start() {
+       . /lib/functions/network.sh
+
+       [ -f /etc/ndyndns/ndyndns.conf ] || {
+               echo "$0: missing config file '/etc/ndyndns/ndyndns.conf'" 1>&2
+               return 1
+       }
+
+       local device
+       network_get_device device wan && \
+               service_start /usr/sbin/ndyndns -c /etc/ndyndns -f /etc/ndyndns/ndyndns.conf -i $device
+}
+
+stop() {
+       service_stop /usr/sbin/ndyndns
+}
diff --git a/net/ndyndns/patches/010-dont-add-host-includes.patch b/net/ndyndns/patches/010-dont-add-host-includes.patch
new file mode 100644 (file)
index 0000000..a28dc4a
--- /dev/null
@@ -0,0 +1,24 @@
+diff -urN ndyndns-2.1.orig/configure ndyndns-2.1/configure
+--- ndyndns-2.1.orig/configure 2010-07-17 13:22:39.000000000 +0200
++++ ndyndns-2.1/configure      2011-01-26 16:24:15.834445729 +0100
+@@ -3318,7 +3318,7 @@
+ fi
+-CURLINC=-I`curl-config --prefix`/include
++CURLINC=-I`curl-config --cflags`
+ CURLLIB=`curl-config --libs`
+diff -urN ndyndns-2.1.orig/configure.in ndyndns-2.1/configure.in
+--- ndyndns-2.1.orig/configure.in      2010-07-17 13:22:11.000000000 +0200
++++ ndyndns-2.1/configure.in   2011-01-26 16:24:14.090441650 +0100
+@@ -24,7 +24,7 @@
+ fi
+ AC_SUBST(PLATFORM)
+-CURLINC=-I`curl-config --prefix`/include
++CURLINC=-I`curl-config --cflags`
+ AC_SUBST(CURLINC)
+ CURLLIB=`curl-config --libs`
+ AC_SUBST(CURLLIB)
diff --git a/net/ndyndns/patches/020-ndyndns.patch b/net/ndyndns/patches/020-ndyndns.patch
new file mode 100644 (file)
index 0000000..00f3f57
--- /dev/null
@@ -0,0 +1,211 @@
+diff -urN ndyndns-2.1.orig/cfg.c ndyndns-2.1/cfg.c
+--- ndyndns-2.1.orig/cfg.c     2011-01-26 17:02:05.762443700 +0100
++++ ndyndns-2.1/cfg.c  2011-01-26 17:03:43.334443683 +0100
+@@ -804,34 +804,6 @@
+             continue;
+         }
+-        tmp = parse_line_string(point, "user");
+-        if (tmp) {
+-            switch (prs) {
+-                default:
+-                    parse_warn(lnum, "user");
+-                    break;
+-                case PRS_CONFIG:
+-                    cfg_set_user(tmp);
+-                    break;
+-            }
+-            free(tmp);
+-            continue;
+-        }
+-
+-        tmp = parse_line_string(point, "group");
+-        if (tmp) {
+-            switch (prs) {
+-                default:
+-                    parse_warn(lnum, "group");
+-                    break;
+-                case PRS_CONFIG:
+-                    cfg_set_group(tmp);
+-                    break;
+-            }
+-            free(tmp);
+-            continue;
+-        }
+-
+         tmp = parse_line_string(point, "interface");
+         if (tmp) {
+             switch (prs) {
+diff -urN ndyndns-2.1.orig/chroot.c ndyndns-2.1/chroot.c
+--- ndyndns-2.1.orig/chroot.c  2011-01-26 17:02:05.762443700 +0100
++++ ndyndns-2.1/chroot.c       2011-01-26 17:03:54.470442525 +0100
+@@ -19,8 +19,6 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <pwd.h>
+-#include <grp.h>
+ #include "defines.h"
+ #include "log.h"
+@@ -82,32 +80,3 @@
+         }
+     }
+ }
+-
+-void drop_root(uid_t uid, gid_t gid)
+-{
+-    if (uid == 0 || gid == 0) {
+-        log_line("FATAL - drop_root: attempt to drop root to root?\n");
+-        exit(EXIT_FAILURE);
+-    }
+-
+-    if (getgid() == 0) {
+-        if (setregid(gid, gid) == -1) {
+-            log_line("FATAL - drop_root: failed to drop real gid == root!\n");
+-            exit(EXIT_FAILURE);
+-        }
+-    }
+-
+-    if (getuid() == 0) {
+-        if (setreuid(uid, uid) == -1) {
+-            log_line("FATAL - drop_root: failed to drop real uid == root!\n");
+-            exit(EXIT_FAILURE);
+-        }
+-    }
+-
+-    /* be absolutely sure */
+-    if (getgid() == 0 || getuid() == 0) {
+-        log_line("FATAL - drop_root: tried to drop root, but still have root!\n");
+-        exit(EXIT_FAILURE);
+-    }
+-}
+-
+diff -urN ndyndns-2.1.orig/Makefile.in ndyndns-2.1/Makefile.in
+--- ndyndns-2.1.orig/Makefile.in       2011-01-26 17:02:05.766443748 +0100
++++ ndyndns-2.1/Makefile.in    2011-01-26 17:03:43.338443633 +0100
+@@ -1,11 +1,9 @@
+ #CC = gcc -Wall -Wpointer-arith -Wstrict-prototypes -pedantic
+ CC = @CC@
+-dnslib = -lnss_dns
+ objects = log.o nstrl.o util.o chroot.o pidfile.o signals.o strlist.o checkip.o $(PLATFORM).o cfg.o ndyndns.o
+-CURLINC = @CURLINC@
+ CURLLIB = @CURLLIB@
+ VERSION = @VERSION@
+-CFLAGS = @CFLAGS@ -Wall -Wextra -pedantic $(CURLINC)
++CFLAGS += -Wall -Wpointer-arith -Wstrict-prototypes -pedantic
+ PLATFORM = @PLATFORM@
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+@@ -16,7 +14,7 @@
+ all: ndyndns
+ ndyndns : $(objects)
+-      $(CC) $(LDFLAGS) $(dnslib) $(CURLLIB) -o ndyndns $(objects)
++      $(CC) $(LDFLAGS) $(CURLLIB) -o ndyndns $(objects)
+ ndyndns.o : log.h nstrl.h util.h chroot.h pidfile.h signals.h strlist.h checkip.h $(PLATFORM).h cfg.h
+       $(CC) $(CFLAGS) -c -o $@ ndyndns.c
+diff -urN ndyndns-2.1.orig/ndyndns.c ndyndns-2.1/ndyndns.c
+--- ndyndns-2.1.orig/ndyndns.c 2011-01-26 17:02:05.766443748 +0100
++++ ndyndns-2.1/ndyndns.c      2011-01-26 17:04:15.526443092 +0100
+@@ -32,8 +32,6 @@
+ #include <net/if.h>
+ #include <ctype.h>
+ #include <time.h>
+-#include <pwd.h>
+-#include <grp.h>
+ #include <signal.h>
+ #include <errno.h>
+@@ -897,40 +895,6 @@
+     strlcpy(pidfile, pidfname, sizeof pidfile);
+ }
+-void cfg_set_user(char *username)
+-{
+-    int t;
+-    char *p;
+-    struct passwd *pws;
+-
+-    t = (unsigned int) strtol(username, &p, 10);
+-    if (*p != '\0') {
+-        pws = getpwnam(username);
+-        if (pws) {
+-            cfg_uid = (int)pws->pw_uid;
+-            if (!cfg_gid)
+-                cfg_gid = (int)pws->pw_gid;
+-        } else suicide("FATAL - Invalid uid specified.\n");
+-    } else
+-        cfg_uid = t;
+-}
+-
+-void cfg_set_group(char *groupname)
+-{
+-    int t;
+-    char *p;
+-    struct group *grp;
+-
+-    t = (unsigned int) strtol(groupname, &p, 10);
+-    if (*p != '\0') {
+-        grp = getgrnam(groupname);
+-        if (grp) {
+-            cfg_gid = (int)grp->gr_gid;
+-        } else suicide("FATAL - Invalid gid specified.\n");
+-    } else
+-        cfg_gid = t;
+-}
+-
+ void cfg_set_interface(char *interface)
+ {
+     strlcpy(ifname, interface, sizeof ifname);
+@@ -954,8 +918,6 @@
+             {"disable-chroot", 0, 0, 'x'},
+             {"file", 1, 0, 'f'},
+             {"cfg-stdin", 0, 0, 'F'},
+-            {"user", 1, 0, 'u'},
+-            {"group", 1, 0, 'g'},
+             {"interface", 1, 0, 'i'},
+             {"remote", 0, 0, 'r'},
+             {"help", 0, 0, 'h'},
+@@ -963,7 +925,7 @@
+             {0, 0, 0, 0}
+         };
+-        c = getopt_long(argc, argv, "rdnp:qc:xf:Fu:g:i:hv", long_options, &option_index);
++        c = getopt_long(argc, argv, "rdnp:qc:xf:i:hv", long_options, &option_index);
+         if (c == -1) break;
+         switch (c) {
+@@ -983,8 +945,6 @@
+                     "  -F, --cfg-stdin             read configuration file from standard input\n"
+                     "  -p, --pidfile               pidfile path\n");
+                 printf(
+-                    "  -u, --user                  user name that ndyndns should run as\n"
+-                    "  -g, --group                 group name that ndyndns should run as\n"
+                     "  -i, --interface             interface ip to check (default: ppp0)\n"
+                     "  -r, --remote                get ip from remote dyndns host (overrides -i)\n"
+                     "  -h, --help                  print this help and exit\n"
+@@ -1060,14 +1020,6 @@
+                 cfg_set_pidfile(optarg);
+                 break;
+-            case 'u':
+-                cfg_set_user(optarg);
+-                break;
+-
+-            case 'g':
+-                cfg_set_group(optarg);
+-                break;
+-
+             case 'i':
+                 cfg_set_interface(optarg);
+                 break;
+@@ -1095,7 +1047,6 @@
+     /* Note that failure cases are handled by called fns. */
+     imprison(get_chroot());
+-    drop_root(cfg_uid, cfg_gid);
+     /* Cover our tracks... */
+     wipe_chroot();
diff --git a/net/net-tools/Makefile b/net/net-tools/Makefile
new file mode 100644 (file)
index 0000000..2a7569c
--- /dev/null
@@ -0,0 +1,324 @@
+#
+# Copyright (C) 2006 - 2013 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:=net-tools
+PKG_VERSION:=1.60
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.tazenda.demon.co.uk/phil/net-tools/
+PKG_MD5SUM:=888774accab40217dde927e21979c165
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/net-tools-arp
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - arp
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-arp/description
+  Program arp from net-tools. Manipulate kernel's ARP cache.
+  Add, delete an entry, or to dump the entire cache.
+endef
+
+define Package/net-tools-dnsdomainname
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS += net-tools-hostname
+  TITLE:=net-tools - dnsdomainname
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-dnsdomainname/description
+  Program dnsdomainname from net-tools.
+  Reports the system's DNS domain name.
+endef
+
+define Package/net-tools-domainname
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS += net-tools-hostname
+  TITLE:=net-tools - domainname
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-domainname/description
+  Program domainname from net-tools.
+  Reports the system's NIS/YP domain name.
+endef
+
+define Package/net-tools-hostname
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - hostname
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-hostname/description
+  Program hostname from net-tools.
+  Reports or sets the name of the current host system.
+endef
+
+define Package/net-tools-ifconfig
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - ifconfig
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-ifconfig/description
+  Program ifconfig from net-tools.
+  Configure network interfaces.
+endef
+
+define Package/net-tools-ipmaddr
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - ipmaddr
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-ipmaddr/description
+  Program ipmaddr from net-tools.  Adds,
+  deletes and shows an interface's multicast addresses.
+endef
+
+define Package/net-tools-iptunnel
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - iptunnel
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-iptunnel/description
+  Program iptunnel from net-tools.
+  Adds, changes, deletes and shows an interface's tunnels.
+endef
+
+define Package/net-tools-mii-tool
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - mii-tool
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-mii-tool/description
+  Program mii-tool from net-tools.  Checks or sets
+  the status of a network interface's Media Independent
+  Interface (MII) unit.
+endef
+
+define Package/net-tools-nameif
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - nameif
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-nameif/description
+  Program nameif from net-tools
+  Trivial File Transfer Protocol server.
+endef
+
+define Package/net-tools-netstat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - netstat
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-netstat/description
+  Program netstat from net-tools. Report network
+  connections, routing tables, and interface statistics.
+endef
+
+define Package/net-tools-nisdomainname
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS += net-tools-hostname
+  TITLE:=net-tools - nisdomainname
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-nisdomainname/description
+  Program nisdomainname from net-tools.
+  Same as domainname.
+endef
+
+define Package/net-tools-plipconfig
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - plipconfig
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-plipconfig/description
+  Program plipconfig from net-tools.  Fine tune the
+  PLIP device parameters, to improve its performance.
+endef
+
+define Package/net-tools-rarp
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - rarp
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-rarp/description
+  Program rarp from net-tools.
+  Manipulate the kernel's RARP table.
+endef
+
+define Package/net-tools-route
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  TITLE:=net-tools - route
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-route/description
+  Program route from net-tools.
+  Manipulate the IP routing table.
+endef
+
+define Package/net-tools-slattach
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=net-tools - slattach
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-slattach/description
+  Program slattach from net-tools.  Attaches a
+  network interface to a serial line. This allows
+  to use normal terminal lines for point-to-point
+  links to other computers.
+endef
+
+define Package/net-tools-ypdomainname
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS += net-tools-hostname
+  TITLE:=net-tools - ypdomainname
+  URL:=http://www.tazenda.demon.co.uk/phil/net-tools
+endef
+
+define Package/net-tools-ypdomainname/description
+  Program route from net-tools.
+  Same as domainname.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       CC="$(TARGET_CC)" \
+       AR="$(TARGET_CROSS)ar" \
+       COPTS="$(TARGET_CFLAGS)"
+endef
+
+define Package/net-tools-arp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/arp $(1)/usr/bin/
+endef
+
+define Package/net-tools-dnsdomainname/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       ln -sf hostname $(1)/usr/bin/dnsdomainname
+endef
+
+define Package/net-tools-domainname/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       ln -sf hostname $(1)/usr/bin/domainname
+endef
+
+define Package/net-tools-hostname/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostname $(1)/usr/bin/
+endef
+
+define Package/net-tools-ifconfig/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ifconfig $(1)/usr/sbin/
+endef
+
+define Package/net-tools-ipmaddr/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipmaddr $(1)/usr/bin/
+endef
+
+define Package/net-tools-iptunnel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/iptunnel $(1)/usr/bin/
+endef
+
+define Package/net-tools-mii-tool/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mii-tool $(1)/usr/bin/
+endef
+
+define Package/net-tools-nameif/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nameif $(1)/usr/bin/
+endef
+
+define Package/net-tools-netstat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/netstat $(1)/usr/bin/
+endef
+
+define Package/net-tools-nisdomainname/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       ln -sf hostname $(1)/usr/bin/nisdomainname
+endef
+
+define Package/net-tools-plipconfig/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plipconfig $(1)/usr/bin/
+endef
+
+define Package/net-tools-rarp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rarp $(1)/usr/bin/
+endef
+
+define Package/net-tools-route/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/route $(1)/usr/bin/
+endef
+
+define Package/net-tools-slattach/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/slattach $(1)/usr/bin/
+endef
+
+define Package/net-tools-ypdomainname/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       ln -sf hostname $(1)/usr/bin/ypdomainname
+endef
+
+$(eval $(call BuildPackage,net-tools-arp))
+$(eval $(call BuildPackage,net-tools-hostname))
+$(eval $(call BuildPackage,net-tools-dnsdomainname))
+$(eval $(call BuildPackage,net-tools-domainname))
+$(eval $(call BuildPackage,net-tools-ifconfig))
+$(eval $(call BuildPackage,net-tools-ipmaddr))
+$(eval $(call BuildPackage,net-tools-iptunnel))
+$(eval $(call BuildPackage,net-tools-mii-tool))
+$(eval $(call BuildPackage,net-tools-nameif))
+$(eval $(call BuildPackage,net-tools-netstat))
+$(eval $(call BuildPackage,net-tools-nisdomainname))
+$(eval $(call BuildPackage,net-tools-plipconfig))
+$(eval $(call BuildPackage,net-tools-rarp))
+$(eval $(call BuildPackage,net-tools-route))
+$(eval $(call BuildPackage,net-tools-slattach))
+$(eval $(call BuildPackage,net-tools-ypdomainname))
diff --git a/net/net-tools/patches/001-config.patch b/net/net-tools/patches/001-config.patch
new file mode 100644 (file)
index 0000000..673db17
--- /dev/null
@@ -0,0 +1,209 @@
+--- /dev/null  2006-11-02 13:38:16.000000000 +0100
++++ net-tools-1.60.works/config.make   2007-01-14 04:43:34.000000000 +0100
+@@ -0,0 +1,35 @@
++# I18N=0
++HAVE_AFUNIX=1
++HAVE_AFINET=1
++HAVE_AFINET6=1
++# HAVE_AFIPX=0
++# HAVE_AFATALK=0
++# HAVE_AFAX25=0
++# HAVE_AFNETROM=0
++# HAVE_AFROSE=0
++# HAVE_AFX25=0
++# HAVE_AFECONET=0
++# HAVE_AFDECnet=0
++# HAVE_AFASH=0
++HAVE_HWETHER=1
++# HAVE_HWARC=0
++HAVE_HWSLIP=1
++HAVE_HWPPP=1
++HAVE_HWTUNNEL=1
++# HAVE_HWSTRIP=0
++# HAVE_HWTR=0
++# HAVE_HWAX25=0
++# HAVE_HWROSE=0
++# HAVE_HWNETROM=0
++# HAVE_HWX25=0
++# HAVE_HWFR=0
++# HAVE_HWSIT=0
++# HAVE_HWFDDI=0
++# HAVE_HWHIPPI=0
++# HAVE_HWASH=0
++# HAVE_HWHDLCLAPB=0
++# HAVE_HWIRDA=0
++# HAVE_HWEC=0
++HAVE_FW_MASQUERADE=1
++HAVE_IP_TOOLS=1
++HAVE_MII=1
+--- /dev/null  2006-11-02 13:38:16.000000000 +0100
++++ net-tools-1.60.works/config.status 2007-01-14 04:43:34.000000000 +0100
+@@ -0,0 +1,91 @@
++#
++# config.in   Configure.sh source for the net-tools.
++#             This file contains the definition of what the support
++#             library contains.  Most of all, it defines which types
++#             of address families and hardware we know of.
++#
++# NET-TOOLS   A collection of programs that form the base set of the
++#             NET-3 Networking Distribution for the LINUX operating
++#             system.
++#
++# Version:    config.in 1.22  (99-04-19)
++#
++# Author:     Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
++#             Copyright 1988-1993 MicroWalt Corporation
++#
++#             Bernd 'eckes' Eckenfels <net-tools@lina.inka.de>
++#             Arnaldo Carvalho de Melo <acme@conectiva.com.br>
++#               GNU gettext - I18N
++#
++#             This program is free software; you can redistribute it
++#             and/or  modify it under  the terms of  the GNU General
++#             Public  License as  published  by  the  Free  Software
++#             Foundation;  either  version 2 of the License, or  (at
++#             your option) any later version.
++#
++= /*
++=  * config.h Automatically generated configuration includefile
++=  *
++=  * NET-TOOLS        A collection of programs that form the base set of the
++=  *          NET-3 Networking Distribution for the LINUX operating
++=  *          system.
++=  *
++=  *          DO  NOT  EDIT  DIRECTLY
++=  *
++=  */
++*
++*
++*              Internationalization
++*
++* The net-tools package has currently been translated to French,
++* German and Brazilian Portugese.  Other translations are, of
++* course, welcome.  Answer `n' here if you have no support for
++* internationalization on your system.
++*
++bool 'Does your system support GNU gettext?' I18N n
++*
++*
++*             Protocol Families.
++* 
++bool 'UNIX protocol family' HAVE_AFUNIX y
++bool 'INET (TCP/IP) protocol family' HAVE_AFINET y
++bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 y
++bool 'Novell IPX/SPX protocol family' HAVE_AFIPX n
++bool 'Appletalk DDP protocol family' HAVE_AFATALK n
++bool 'AX25 (packet radio) protocol family' HAVE_AFAX25 n
++bool 'NET/ROM (packet radio) protocol family' HAVE_AFNETROM n
++bool 'Rose (packet radio) protocol family' HAVE_AFROSE n
++bool 'X.25 (CCITT) protocol family' HAVE_AFX25 n
++bool 'Econet protocol family' HAVE_AFECONET n
++bool 'DECnet protocol family' HAVE_AFDECnet n
++bool 'Ash protocol family' HAVE_AFASH n
++*
++*
++*            Device Hardware types.
++*
++bool 'Ethernet (generic) support' HAVE_HWETHER y
++bool 'ARCnet support' HAVE_HWARC n
++bool 'SLIP (serial line) support' HAVE_HWSLIP y
++bool 'PPP (serial line) support' HAVE_HWPPP y
++bool 'IPIP Tunnel support' HAVE_HWTUNNEL y
++bool 'STRIP (Metricom radio) support' HAVE_HWSTRIP n
++bool 'Token ring (generic) support' HAVE_HWTR n
++bool 'AX25 (packet radio) support' HAVE_HWAX25 n
++bool 'Rose (packet radio) support' HAVE_HWROSE n
++bool 'NET/ROM (packet radio) support' HAVE_HWNETROM n
++bool 'X.25 (generic) support' HAVE_HWX25 n
++bool 'DLCI/FRAD (frame relay) support' HAVE_HWFR n
++bool 'SIT (IPv6-in-IPv4) support' HAVE_HWSIT n
++bool 'FDDI (generic) support' HAVE_HWFDDI n
++bool 'HIPPI (generic) support' HAVE_HWHIPPI n
++bool 'Ash hardware support' HAVE_HWASH n
++bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
++bool 'IrDA support' HAVE_HWIRDA n
++bool 'Econet hardware support' HAVE_HWEC n
++*
++*
++*           Other Features.
++*
++bool 'IP Masquerading support' HAVE_FW_MASQUERADE y
++bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y
++bool 'Build mii-tool' HAVE_MII y
+--- /dev/null  2006-11-02 13:38:16.000000000 +0100
++++ net-tools-1.60.works/config.h      2007-01-14 04:43:34.000000000 +0100
+@@ -0,0 +1,74 @@
++/*
++* config.h    Automatically generated configuration includefile
++*
++* NET-TOOLS   A collection of programs that form the base set of the
++*             NET-3 Networking Distribution for the LINUX operating
++*             system.
++*
++*             DO  NOT  EDIT  DIRECTLY
++*
++*/
++
++/* 
++ * 
++ * Internationalization
++ * 
++ * The net-tools package has currently been translated to French,
++ * German and Brazilian Portugese.  Other translations are, of
++ * course, welcome.  Answer `n' here if you have no support for
++ * internationalization on your system.
++ * 
++ */
++#define I18N 0
++
++/* 
++ * 
++ * Protocol Families.
++ * 
++ */
++#define HAVE_AFUNIX 1
++#define HAVE_AFINET 1
++#define HAVE_AFINET6 1
++#define HAVE_AFIPX 0
++#define HAVE_AFATALK 0
++#define HAVE_AFAX25 0
++#define HAVE_AFNETROM 0
++#define HAVE_AFROSE 0
++#define HAVE_AFX25 0
++#define HAVE_AFECONET 0
++#define HAVE_AFDECnet 0
++#define HAVE_AFASH 0
++
++/* 
++ * 
++ * Device Hardware types.
++ * 
++ */
++#define HAVE_HWETHER 1
++#define HAVE_HWARC 0
++#define HAVE_HWSLIP 1
++#define HAVE_HWPPP 1
++#define HAVE_HWTUNNEL 1
++#define HAVE_HWSTRIP 0
++#define HAVE_HWTR 0
++#define HAVE_HWAX25 0
++#define HAVE_HWROSE 0
++#define HAVE_HWNETROM 0
++#define HAVE_HWX25 0
++#define HAVE_HWFR 0
++#define HAVE_HWSIT 0
++#define HAVE_HWFDDI 0
++#define HAVE_HWHIPPI 0
++#define HAVE_HWASH 0
++#define HAVE_HWHDLCLAPB 0
++#define HAVE_HWIRDA 0
++#define HAVE_HWEC 0
++
++/* 
++ * 
++ * Other Features.
++ * 
++ */
++#define HAVE_FW_MASQUERADE 1
++#define HAVE_IP_TOOLS 1
++#define HAVE_MII 1
diff --git a/net/net-tools/patches/002-compile-fixes.patch b/net/net-tools/patches/002-compile-fixes.patch
new file mode 100644 (file)
index 0000000..a72bf3e
--- /dev/null
@@ -0,0 +1,74 @@
+--- net-tools-1.60/lib/inet_sr.c       2000-02-20 22:46:45.000000000 +0100
++++ net-tools-1.60.works/lib/inet_sr.c 2007-01-14 04:44:40.000000000 +0100
+@@ -105,6 +105,7 @@
+     case 2:
+        isnet = 0; break;
+     default:
++       break;
+     }
+     /* Fill in the other fields. */
+--- net-tools-1.60/hostname.c  2001-04-08 19:04:23.000000000 +0200
++++ net-tools-1.60.works/hostname.c    2007-01-14 04:46:09.000000000 +0100
+@@ -98,6 +98,7 @@
+           fprintf(stderr, _("%s: name too long\n"), program_name);
+           break;
+       default:
++            break;
+       }
+       exit(1);
+     };
+@@ -117,6 +118,7 @@
+           fprintf(stderr, _("%s: name too long\n"), program_name);
+           break;
+       default:
++            break;
+       }
+       exit(1);
+     };
+@@ -174,6 +176,7 @@
+       printf("%s\n", hp->h_name);
+       break;
+     default:
++        break;
+     }
+ }
+@@ -330,7 +333,7 @@
+       case 'h':
+       default:
+           usage();
+-
++            break;
+       };
+--- net-tools-1.60/mii-tool.c  2000-05-21 16:31:17.000000000 +0200
++++ net-tools-1.60.works/mii-tool.c    2007-01-14 04:47:42.000000000 +0100
+@@ -379,16 +379,16 @@
+ /*--------------------------------------------------------------------*/
+ const char *usage =
+-"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]
+-       -V, --version               display version information
+-       -v, --verbose               more verbose output
+-       -R, --reset                 reset MII to poweron state
+-       -r, --restart               restart autonegotiation
+-       -w, --watch                 monitor for link status changes
+-       -l, --log                   with -w, write events to syslog
+-       -A, --advertise=media,...   advertise only specified media
+-       -F, --force=media           force specified media technology
+-media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
++"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n\
++       -V, --version               display version information\n\
++       -v, --verbose               more verbose output\n\
++       -R, --reset                 reset MII to poweron state\n\
++       -r, --restart               restart autonegotiation\n\
++       -w, --watch                 monitor for link status changes\n\
++       -l, --log                   with -w, write events to syslog\n\
++       -A, --advertise=media,...   advertise only specified media\n\
++       -F, --force=media           force specified media technology\n\
++media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\
+        (to advertise both HD and FD) 100baseTx, 10baseT\n";
+ int main(int argc, char **argv)
diff --git a/net/netatalk/Makefile b/net/netatalk/Makefile
new file mode 100644 (file)
index 0000000..1d97b96
--- /dev/null
@@ -0,0 +1,85 @@
+#
+# Copyright (C) 2009-2013 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:=netatalk
+PKG_VERSION:=2.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/netatalk
+PKG_MD5SUM:=40753a32340c24e4ec395aeb55ef056e
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netatalk
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  DEPENDS:=+libdb47 +libgcrypt +libopenssl $(LIBRPC_DEPENDS)
+  TITLE:=netatalk
+  URL:=http://netatalk.sourceforge.net
+  MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+endef
+
+define Package/netatalk/decription
+  Netatalk is a freely-available Open Source AFP fileserver.
+  It also provides a kernel level implementation of the AppleTalk
+  Protocol Suite.
+endef
+
+define Package/netatalk/conffiles
+/etc/netatalk/afpd.conf
+endef
+
+TARGET_CFLAGS += -std=gnu99
+TARGET_LDFLAGS += $(LIBRPC)
+
+CONFIGURE_ARGS += \
+       --disable-afs \
+       --enable-hfs \
+       --disable-debugging \
+       --disable-shell-check \
+       --disable-timelord \
+       --disable-a2boot \
+       --disable-cups \
+       --disable-tcp-wrappers \
+       --with-cnid-default-backend=dbd \
+       --with-bdb="$(STAGING_DIR)/usr/" \
+       --with-libgcrypt-dir="$(STAGING_DIR)/usr" \
+       --with-ssl-dir="$(STAGING_DIR)/usr" \
+       --with-uams-path="/usr/lib/uams" \
+       --without-pam \
+       --disable-admin-group \
+       --disable-srvloc \
+       --disable-zeroconf \
+       $(if $(CONFIG_SHADOW_PASSWORDS),--with-shadow,--without-shadow) \
+       --without-ldap
+
+define Package/netatalk/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/lib/uams
+       $(INSTALL_DIR) $(1)/etc/netatalk
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/afppasswd $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/afpd $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/cnid_dbd $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/cnid_metad $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/uams/*.so $(1)/usr/lib/uams/
+       $(CP) ./files/AppleVolumes.default $(1)/etc/netatalk/
+       $(CP) $(PKG_INSTALL_DIR)/etc/netatalk/AppleVolumes.system $(1)/etc/netatalk/
+       $(INSTALL_CONF) ./files/afpd.conf $(1)/etc/netatalk/
+       $(INSTALL_BIN) ./files/afpd.init $(1)/etc/init.d/afpd
+endef
+
+$(eval $(call BuildPackage,netatalk))
diff --git a/net/netatalk/files/AppleVolumes.default b/net/netatalk/files/AppleVolumes.default
new file mode 100644 (file)
index 0000000..5835163
--- /dev/null
@@ -0,0 +1,2 @@
+-
+/tmp Temp allow:root,nobody cnidscheme:dbd
diff --git a/net/netatalk/files/afpd.conf b/net/netatalk/files/afpd.conf
new file mode 100644 (file)
index 0000000..097e954
--- /dev/null
@@ -0,0 +1 @@
+- -noddp -uampath /usr/lib/uams -uamlist uams_guest.so,uams_passwd.so,uams_dhx_passwd.so,uams_randnum.so,uams_dhx2.so -passwdfile /etc/netatalk/afppasswd -savepassword -passwdminlen 0 -nosetpassword -defaultvol /etc/netatalk/AppleVolumes.default -systemvol /etc/netatalk/AppleVolumes.system -nouservol -guestname "nobody" -sleep 1 -icon
diff --git a/net/netatalk/files/afpd.init b/net/netatalk/files/afpd.init
new file mode 100644 (file)
index 0000000..8b13339
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2012 OpenWrt.org
+
+START=70
+
+MAXCONS="7"
+
+start()
+{
+       service_start /usr/sbin/cnid_metad
+       service_start /usr/sbin/afpd -c ${MAXCONS}
+}
+
+stop()
+{
+       service_stop /usr/sbin/afpd
+       service_stop /usr/sbin/cnid_metad
+}
+
+reload()
+{
+       service_reload /usr/sbin/afpd
+}
diff --git a/net/netatalk/patches/001-automake-compat.patch b/net/netatalk/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..e56b086
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/macros/iconv.m4
++++ b/macros/iconv.m4
+@@ -114,6 +114,5 @@ int main() {
+         CFLAGS="$savedcflags"
+         LDFLAGS="$savedldflags"
+-      CPPFLAGS="$saved_CPPFLAGS"
+       
+ ])
diff --git a/net/netcat/Makefile b/net/netcat/Makefile
new file mode 100644 (file)
index 0000000..7c1158b
--- /dev/null
@@ -0,0 +1,57 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=netcat
+PKG_VERSION:=0.7.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=0a29eff1736ddb5effd0b1ec1f6fe0ef
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netcat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A feature-rich network debugging and exploration tool.
+  URL:=http://netcat.sourceforge.net/
+endef
+
+define Package/netcat/description
+               Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol.
+       It is designed to be a reliable "back-end" tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-rpath \
+               --with-included-getopt \
+       )
+endef
+
+define Package/netcat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/netcat \
+               $(1)/usr/bin
+endef
+
+define Package/netcat/postinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/nc ]; then
+  rm -rf $${IPKG_INSTROOT}/usr/bin/nc;
+fi
+ln -s ./netcat $${IPKG_INSTROOT}/usr/bin/nc
+endef
+
+define Package/netcat/postrm
+#!/bin/sh
+rm $${IPKG_INSTROOT}/usr/bin/nc
+ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/nc
+$${IPKG_INSTROOT}/usr/bin/nc 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/nc
+exit 0
+endef
+
+
+$(eval $(call BuildPackage,netcat))
diff --git a/net/netcat/patches/001-netcat_flag_count.patch b/net/netcat/patches/001-netcat_flag_count.patch
new file mode 100644 (file)
index 0000000..44ee9e1
--- /dev/null
@@ -0,0 +1,22 @@
+Index: netcat-0.7.1/src/flagset.c
+===================================================================
+--- netcat-0.7.1.orig/src/flagset.c    2009-02-06 19:56:01.000000000 +0100
++++ netcat-0.7.1/src/flagset.c 2009-02-06 19:56:13.000000000 +0100
+@@ -134,7 +134,7 @@
+ int netcat_flag_count(void)
+ {
+-  register char c;
++  register unsigned char c;
+   register int i;
+   int ret = 0;
+@@ -154,7 +154,7 @@
+       Assumed that the bit number 1 is the sign, and that we will shift the
+       bit 1 (or the bit that takes its place later) until the the most right,
+       WHY it has to keep the wrong sign? */
+-      ret -= (c >> 7);
++      ret += (c >> 7);
+       c <<= 1;
+     }
+   }
diff --git a/net/netdiscover/Makefile b/net/netdiscover/Makefile
new file mode 100644 (file)
index 0000000..f22c8a5
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2009-2010 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:=netdiscover
+PKG_VERSION:=0.3-beta6
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nixgeneration.com/~jaime/netdiscover/releases/
+PKG_MD5SUM:=0919227a91ecaeeb2443cff249417be2
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netdiscover
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libnet1 +libpthread
+  TITLE:=An active/passive address reconnaissance tool
+  URL:=http://nixgeneration.com/~jaime/netdiscover/
+  MAINTAINER:=Daniel Dickinson <openwrt@cshore.neomailbox.net>
+endef
+
+CONFIGURE_VARS+= \
+       CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/lib/libnet-1.1.x/include" \
+       LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/libnet-1.1.x/lib" \
+
+define Package/netdiscover/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/netdiscover $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,netdiscover))
diff --git a/net/netdiscover/patches/00-add-machine-ouput.patch b/net/netdiscover/patches/00-add-machine-ouput.patch
new file mode 100644 (file)
index 0000000..eed7f0f
--- /dev/null
@@ -0,0 +1,467 @@
+diff -Naur netdiscover-0.3-beta6.orig/src/ifaces.c netdiscover-0.3-beta6/src/ifaces.c
+--- netdiscover-0.3-beta6.orig/src/ifaces.c    2009-06-24 18:21:11.000000000 -0400
++++ netdiscover-0.3-beta6/src/ifaces.c 2009-06-24 21:44:05.000000000 -0400
+@@ -127,6 +127,7 @@
+       memcpy(type, packet + 20, 2);           /* ARP Opcode */
+       new_arprep_l->header = new_header;      /* Add header */
+       new_arprep_l->count = 1;                                /* Count      */
++      new_arprep_l->printed = 0;
+       new_arprep_l->next = NULL;
+       
+       /* Source IP */
+diff -Naur netdiscover-0.3-beta6.orig/src/main.c netdiscover-0.3-beta6/src/main.c
+--- netdiscover-0.3-beta6.orig/src/main.c      2009-06-24 18:21:11.000000000 -0400
++++ netdiscover-0.3-beta6/src/main.c   2009-06-24 21:34:59.000000000 -0400
+@@ -30,6 +30,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <signal.h>
+ #include "ifaces.h"
+ #include "screen.h"
+@@ -39,8 +40,17 @@
+       char *disp;
+       char *sip;
+       int autos;
++      int machine;
+ };
++/* Injection Thread data structure */
++struct t_inject {
++  struct t_data *datos;
++  pthread_t *sniffer;
++  pthread_t *screen;
++  pthread_t *keys;
++  int scan_secs;
++};
+ void *inject_arp(void *arg);
+ void *screen_refresh(void *arg);
+@@ -77,7 +87,7 @@
+ pthread_t injection, sniffer, screen, keys;
+-int fastmode, pcount, node, ssleep;
++int fastmode, pcount, node, ssleep, nokeywait;
+ long sleept;
+@@ -86,7 +96,9 @@
+ {
+     while ( 1 == 1 )
+     {
+-        read_key();
++      struct t_data *datos;
++      datos = (struct t_data *)arg;
++        read_key(datos->machine);
+     }
+ }
+@@ -97,20 +109,24 @@
+       int c;
+       int esniff = 0;
+       int erange = 0;
++      int scan_secs = 0;
+       struct t_data datos;
+-      
++      struct t_inject injectdata;
++
+       datos.sip = NULL;
+       datos.disp = NULL;
++      datos.machine = 0;
+       datos.autos = 0;
+       sleept = 99;
+       node = 67;
+       pcount = 1;
++      nokeywait = 0;
+       
+       current_network = (char *) malloc ((sizeof(char)) * 16);
+       sprintf(current_network,"Starting.");
+       
+       /* Fetch parameters */
+-      while ((c = getopt(argc, argv, "i:s:r:n:c:pSfh")) != EOF)
++      while ((c = getopt(argc, argv, "i:s:r:n:c:t:pSfhkm")) != EOF)
+       {
+               switch (c)
+               {
+@@ -138,12 +154,20 @@
+                       case  'n':
+                               node = atoi(optarg);
+                               break;
++
++                      case 't':
++                              scan_secs = atoi(optarg);
++                                break;
+                       
+                       case  'r':
+                               datos.sip = (char *) malloc (sizeof(char) * strlen(optarg));
+                               sprintf(datos.sip, "%s", optarg);
+                               erange = 1;
+                               break;
++
++                      case 'm':
++                             datos.machine = 1;
++                             break;
+                       
+                       case  'f':
+                               fastmode = 1;
+@@ -153,6 +177,10 @@
+                               usage(argv[0]);
+                               exit(1);
+                               break;
++
++                              case 'k':
++                              nokeywait = 1;
++                              break;
+                       
+                       default:
+                               break;
+@@ -181,7 +209,7 @@
+       /* Init some stuff */
+       lnet_init(datos.disp);
+       init_lists();
+-      system("clear");
++      if (!datos.machine) system("clear");
+       
+       /* If no mode was selected, enable auto scan */
+       if ((erange != 1) && (esniff != 1))
+@@ -189,9 +217,15 @@
+               datos.autos = 1;
+       }
+       
++      
+       /* Start the execution */
+-      pthread_create(&screen, NULL, screen_refresh, (void *)NULL);
+-      pthread_create(&keys, NULL, keys_thread, (void *)NULL);
++      pthread_create(&screen, NULL, screen_refresh, (void *)&datos);
++      if (!nokeywait) {
++        pthread_create(&keys, NULL, keys_thread, (void *)&datos);
++        injectdata.keys = &keys;
++      } else {
++        injectdata.keys = NULL;
++      }
+       pthread_create(&sniffer, NULL, start_sniffer, (void *)&datos);
+       
+       if (esniff == 1)
+@@ -201,10 +235,19 @@
+       }
+       else
+       {
+-              if (pthread_create(&injection, NULL, inject_arp, (void *)&datos))
++                injectdata.datos = &datos;
++                injectdata.sniffer = &sniffer;
++                injectdata.screen = &screen;
++                injectdata.scan_secs = scan_secs;
++
++              if (pthread_create(&injection, NULL, inject_arp, (void *)&injectdata))
+                       perror("Could not create injection thread");
+               
+-              pthread_join(sniffer,NULL);
++              if (scan_secs > 0) {
++                pthread_join(injection,NULL);
++              } else {
++                pthread_join(sniffer,NULL);
++              }
+       }
+       
+       
+@@ -215,10 +258,11 @@
+ /* Refresh screen function called by screen thread */
+ void *screen_refresh(void *arg)
+ {
+-      
++      struct t_data *datos;
++      datos = (struct t_data *)arg;
+       while (1==1)
+       {
+-              print_screen();
++              print_screen(datos->machine);
+               sleep(1);
+       }
+       
+@@ -228,9 +272,11 @@
+ /* Inject ARP Replys to the network */
+ void *inject_arp(void *arg)
+ {     
++        struct t_inject *inject;
+       struct t_data *datos;
+               
+-      datos = (struct t_data *)arg;
++      inject = (struct t_inject *)arg;
++      datos = inject->datos;
+       sleep(2);
+       
+       if ( datos->autos != 1 )
+@@ -251,6 +297,12 @@
+       
+       sprintf(current_network,"Finished!");
+       lnet_destroy();
++      if (inject->scan_secs > 0) {
++              sleep(inject->scan_secs);  
++              pthread_kill(*(inject->sniffer), SIGKILL);
++              pthread_kill(*(inject->screen), SIGKILL);
++              pthread_kill(*(inject->keys), SIGKILL);
++      }
+       
+       return NULL;
+ }
+@@ -400,6 +452,9 @@
+               "  -n node: last ip octet used for scanning (from 2 to 253)\n"
+               "  -S enable sleep time supression betwen each request (hardcore mode)\n"
+               "  -f enable fastmode scan, saves a lot of time, recommended for auto\n\n"
++              "  -k nokeywait: Don't wait for keypress\n"
++              "  -t time: maximum time to listen after last arp request sent (seconds)\n"
++              "  -m don't clear and format screen, just output replies\n"
+               "If -p or -r arent enabled, netdiscover will scan for common lan addresses\n",
+               VERSION, comando);
+ }
+diff -Naur netdiscover-0.3-beta6.orig/src/screen.c netdiscover-0.3-beta6/src/screen.c
+--- netdiscover-0.3-beta6.orig/src/screen.c    2009-06-24 18:21:11.000000000 -0400
++++ netdiscover-0.3-beta6/src/screen.c 2009-06-25 19:15:24.000000000 -0400
+@@ -114,7 +114,7 @@
+ /* Read input keys */
+-void read_key()
++void read_key(int machine)
+ {
+     int ch;
+     ch = getchar();
+@@ -162,12 +162,12 @@
+        smode = 2;
+     }
+        
+-       print_screen();
++       print_screen(machine);
+ }
+ /* Clear and fill the screen */
+-void print_screen()
++void print_screen(int machine)
+ {
+       /* Get Console Size */
+    if (ioctl(0, TIOCGWINSZ, &win_sz) < 0)
+@@ -177,16 +177,16 @@
+    }
+        
+       /* Flush and print screen */
+-      fprintf( stderr, "\33[1;1H" );
+-      fill_screen();
+-      fprintf( stderr, "\33[J" );
++        if (!machine) fprintf( stderr, "\33[1;1H" );
++      fill_screen(machine);
++      if (!machine) fprintf( stderr, "\33[J" );
+       fflush(stdout);
+ }
+ /* Fills the screen using white spaces to avoid refresh problems  *
+  * not a very smart way, but it works :)                          */
+-void fill_screen()
++void fill_screen(int machine)
+ {
+    int x, j;
+    struct arp_rep_l *arprep_l;
+@@ -196,40 +196,42 @@
+    
+    pthread_mutex_lock(listm); 
+       
+-   sprintf(line, " Currently scanning: %s   |   Our Mac is: %s - %i", 
+-           current_network, ourmac, scroll);
+-   printf("%s", line);
+-      
+-   /* Fill with spaces */
+-   for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+-         printf(" ");
+-   printf("\n");
+-      
+-      /* Print blank line with spaces */
+-   for (j=0; j<win_sz.ws_col - 1; j++)
+-         printf(" ");
+-   printf("\n");
+-
+-
+-   sprintf(line, " %d Captured ARP Req/Rep packets, from %d hosts.   Total size: %d", 
+-           arprep_count->count, arprep_count->hosts, arprep_count->length);
+-   printf("%s", line);
+-      
+-   /* Fill with spaces */
+-   for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+-         printf(" ");
+-   printf("\n");
+-      
+-      
+-   /* Print Header and counters */
+-   printf(" _____________________________________________________________________________\n");
+-   if (smode == 0 || (oldmode == 0 && smode == 2))
+-      printf("   IP            At MAC Address      Count  Len   MAC Vendor                   \n");
+-   else if (smode == 1 || (oldmode == 1 && smode == 2))
+-      printf("   IP            At MAC Address      Requests IP     Count                     \n");
+-   printf(" ----------------------------------------------------------------------------- \n");
+-
+-
++   
++   if (!machine) {
++     sprintf(line, " Currently scanning: %s   |   Our Mac is: %s - %i", 
++           current_network, ourmac, scroll);
++     printf("%s", line);
++      
++     /* Fill with spaces */
++     for (j=strlen(line); j<win_sz.ws_col - 1; j++)
++       printf(" ");
++     printf("\n");
++     
++     /* Print blank line with spaces */
++     for (j=0; j<win_sz.ws_col - 1; j++)
++       printf(" ");
++     printf("\n");
++     
++
++     sprintf(line, " %d Captured ARP Req/Rep packets, from %d hosts.   Total size: %d", 
++           arprep_count->count, arprep_count->hosts, arprep_count->length);
++     printf("%s", line);
++     
++     /* Fill with spaces */
++     for (j=strlen(line); j<win_sz.ws_col - 1; j++)
++       printf(" ");
++     printf("\n");
++      
++     
++     /* Print Header and counters */
++     printf(" _____________________________________________________________________________\n");
++     if (smode == 0 || (oldmode == 0 && smode == 2))
++       printf("   IP            At MAC Address      Count  Len   MAC Vendor                   \n");
++     else if (smode == 1 || (oldmode == 1 && smode == 2))
++       printf("   IP            At MAC Address      Requests IP     Count                     \n");
++     printf(" ----------------------------------------------------------------------------- \n");
++   }
++   
+    /* Print each found station trough arp reply */
+    if (smode == 0)
+    {
+@@ -243,12 +245,12 @@
+             sprintf(tline, " ");
+             
+             /* Set IP */
+-            sprintf(tline, "%s ", arprep_l->sip);
++            sprintf(tline, "%s ", arprep_l->sip);         
+             strcat(line, tline);
+-            
+-            /* Fill with spaces */
+-            for (j=strlen(line); j<17; j++)
+-               strcat(line, blank);
++   
++          /* Fill with spaces */
++          for (j=strlen(line); j<17; j++)
++            strcat(line, blank);
+             
+             /* IP & MAC */
+             sprintf(tline, "%02x:%02x:%02x:%02x:%02x:%02x    ",
+@@ -260,21 +262,29 @@
+             /* Count, Length & Vendor */
+             sprintf(tline, "%02d    %03d   %s", arprep_l->count, 
+                     arprep_l->header->length, arprep_l->vendor );
+-            strcat(line, tline);
+-            
+-            /* Fill again with spaces */
+-            for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+-               strcat(line, blank);
++          strcat(line, tline);
+             
+-            printf("%s\n", line);
++          /* Fill again with spaces */
++          for (j=strlen(line); j<win_sz.ws_col - 1; j++)
++            strcat(line, blank);
++
++          if (!arprep_l->printed) {
++            printf("%s\n", line);         
++            arprep_l->printed = 1;
++            if (!machine) {
++              arprep_l->printed = 0;
++            }
++          }
+          }
+          
+          arprep_l = arprep_l->next;
+          x += 1;
+-      
+-         /* Check if end of screen was reached */
+-         if (x >= ( (win_sz.ws_row + scroll) - 7))
+-            break;
++
++       if (!machine) {
++         /* Check if end of screen was reached */
++         if (x >= ( (win_sz.ws_row + scroll) - 7))
++           break;
++       }
+       }
+       
+    } /* Print only arp request */
+@@ -292,10 +302,10 @@
+             /* Get source IP */
+             sprintf(tline, "%s ", arprep_l->sip);
+             strcat(line, tline);
+-            
+-            /* Fill with spaces */
+-            for (j=strlen(line); j<17; j++)
+-               strcat(line, blank);
++
++          /* Fill with spaces */
++          for (j=strlen(line); j<17; j++)
++            strcat(line, blank);
+             
+             /* Get source MAC */
+             sprintf(tline, "%02x:%02x:%02x:%02x:%02x:%02x   ",
+@@ -308,27 +318,29 @@
+             sprintf(tline, "%s", arprep_l->dip);
+             strcat(line, tline);
+             
+-            /* Fill with spaces */
+-            for (j=strlen(line); j<54; j++)
+-               strcat(line, blank);
++          /* Fill with spaces */
++          for (j=strlen(line); j<54; j++)
++            strcat(line, blank);
+             
+             /* Count, Length & Vendor */
+             sprintf(tline, "%02d", arprep_l->count);
+             strcat(line, tline);
+             
+-            /* Fill again with spaces */
+-            for (j=strlen(line); j<win_sz.ws_col - 1; j++)
+-               strcat(line, blank);
++          /* Fill again with spaces */
++          for (j=strlen(line); j<win_sz.ws_col - 1; j++)
++            strcat(line, blank);
+             
+             printf("%s\n", line);
+          }
+          
+          arprep_l = arprep_l->next;
+          x += 1;
+-      
+-         /* Check if end of screen was reached */
+-         if (x >= ( (win_sz.ws_row + scroll) - 7))
+-            break;
++
++       if (!machine) {
++         /* Check if end of screen was reached */
++         if (x >= ( (win_sz.ws_row + scroll) - 7))
++           break;
++       }
+       }
+    }
+    else if(smode == 2)
+diff -Naur netdiscover-0.3-beta6.orig/src/screen.h netdiscover-0.3-beta6/src/screen.h
+--- netdiscover-0.3-beta6.orig/src/screen.h    2009-06-24 18:21:11.000000000 -0400
++++ netdiscover-0.3-beta6/src/screen.h 2009-06-24 21:42:13.000000000 -0400
+@@ -60,6 +60,7 @@
+       char *vendor;
+       short type;
+       unsigned int count;
++        int printed;
+       struct arp_rep_l *next;
+ };
diff --git a/net/netdiscover/patches/01-initfix+end-fix.patch b/net/netdiscover/patches/01-initfix+end-fix.patch
new file mode 100644 (file)
index 0000000..6ba5ffe
--- /dev/null
@@ -0,0 +1,34 @@
+diff -Naur netdiscover-0.3-beta6.01machine/src/main.c netdiscover-0.3-beta6/src/main.c
+--- netdiscover-0.3-beta6.01machine/src/main.c 2009-06-25 18:19:18.000000000 -0400
++++ netdiscover-0.3-beta6/src/main.c   2009-07-16 06:37:43.000000000 -0400
+@@ -121,6 +121,8 @@
+       node = 67;
+       pcount = 1;
+       nokeywait = 0;
++      fastmode = 0;
++      ssleep = 0;
+       
+       current_network = (char *) malloc ((sizeof(char)) * 16);
+       sprintf(current_network,"Starting.");
+@@ -250,7 +252,6 @@
+               }
+       }
+       
+-      
+       return 0;
+ }
+@@ -299,9 +300,10 @@
+       lnet_destroy();
+       if (inject->scan_secs > 0) {
+               sleep(inject->scan_secs);  
+-              pthread_kill(*(inject->sniffer), SIGKILL);
+-              pthread_kill(*(inject->screen), SIGKILL);
+-              pthread_kill(*(inject->keys), SIGKILL);
++              pthread_kill(*(inject->sniffer), SIGTERM);
++              pthread_kill(*(inject->screen), SIGTERM);
++              pthread_kill(*(inject->keys), SIGTERM);
++              sighandler(SIGTERM);
+       }
+       
+       return NULL;
diff --git a/net/netio/Config.in b/net/netio/Config.in
new file mode 100644 (file)
index 0000000..cd8d255
--- /dev/null
@@ -0,0 +1,4 @@
+menu "Configuration"
+        depends on PACKAGE_uclibcxx
+
+endmenu
diff --git a/net/netio/Makefile b/net/netio/Makefile
new file mode 100644 (file)
index 0000000..28fb4be
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2006-2014 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:=netio
+PKG_VERSION:=1.31
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)$(subst .,,$(PKG_VERSION)).zip
+PKG_SOURCE_URL:=http://www.ars.de/ars/ars.nsf/f24a6a0b94c22d82862566960071bf5a/aa577bc4be573b05c125706d004c75b5/%24FILE/
+PKG_MD5SUM:=6b81e3c71b9dfa3bd60c53fa82e89085
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK:=mkdir -p $(PKG_BUILD_DIR); unzip $(DL_DIR)/$(PKG_SOURCE) -d $(PKG_BUILD_DIR)
+
+define Package/netio
+  $(call Package/netio/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=$(CXX_DEPENDS) +libpthread
+  TITLE:=Network throughput benchmark
+  URL:=http://www.ars.de/ars/ars.nsf/docs/netio
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) linux CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS) -DUNIX"
+endef
+
+define Package/netio/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,netio))
diff --git a/net/netio/patches/001-Makefile.patch b/net/netio/patches/001-Makefile.patch
new file mode 100644 (file)
index 0000000..1e35baf
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -84,8 +84,8 @@ solaris:\r
+       $(MAKE) all CC="gcc -O -s" O=.o X= \\r
+       CFLAGS="-DUNIX" LFLAGS="" LIBS="-lsocket -lpthread -lnsl" OUT=-o\r
+ linux:\r
+-      $(MAKE) all CC="gcc -O -s" O=.o X= \\r
+-      CFLAGS="-DUNIX" LFLAGS="" LIBS="-lpthread" OUT=-o\r
++      $(MAKE) all CC="$(CC) -O -s" O=.o X= \\r
++      LFLAGS="" LIBS="-lpthread" OUT=-o\r
+ macosx:\r
+       $(MAKE) all CC="gcc -O" O=.o X= \\r
+       CFLAGS="-DUNIX -DSOCKLEN_T" LFLAGS="" LIBS="-lpthread" OUT=-o\r
diff --git a/net/netperf/Makefile b/net/netperf/Makefile
new file mode 100644 (file)
index 0000000..3f1fb6e
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# 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_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/
+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/netpipe/Makefile b/net/netpipe/Makefile
new file mode 100644 (file)
index 0000000..bb1bc08
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2006-2014 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:=netpipe
+PKG_VERSION:=3.7.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=NetPIPE-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.scl.ameslab.gov/netpipe/code
+PKG_MD5SUM:=cc458a9154f6b8c6da9fae16627beec4
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/NetPIPE-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netpipe
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A Network Protocol Independent Performance Evaluator
+  URL:=http://www.scl.ameslab.gov/netpipe/
+endef
+
+define Package/netpipe/description
+       NetPIPE is a protocol independent performance tool that visually
+       represents the network performance under a variety of conditions. It
+       performs simple ping-pong tests, bouncing messages of increasing size
+       between two processes, whether across a network or within an SMP
+       system. Message sizes are chosen at regular intervals, and with slight
+       perturbations, to provide a complete test of the communication system.
+       Each data point involves many ping-pong tests to provide an accurate
+       timing. Latencies are calculated by dividing the round trip time in
+       half for small messages ( < 64 Bytes ).
+endef
+
+define Build/Configure
+endef
+
+MAKE_FLAGS += \
+       $(TARGET_CONFIGURE_OPTS)
+
+define Package/netpipe/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/NPtcp $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,netpipe))
diff --git a/net/netpipe/patches/001-Makefile_honor_CFLAGS_for_VFP.patch b/net/netpipe/patches/001-Makefile_honor_CFLAGS_for_VFP.patch
new file mode 100644 (file)
index 0000000..4136425
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/makefile
++++ b/makefile
+@@ -21,7 +21,7 @@
+ ########################################################################
+ CC         = cc
+-CFLAGS     = -O -g
++CFLAGS     += -O -g
+ SRC        = ./src
+ # For MPI, mpicc will set up the proper include and library paths
diff --git a/net/netstat-nat/Makefile b/net/netstat-nat/Makefile
new file mode 100644 (file)
index 0000000..8673695
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006-2010 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:=netstat-nat
+PKG_VERSION:=1.4.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://tweegy.nl/download
+PKG_MD5SUM:=c1bbb3ee9774ebfa27c440e2d9dd7286
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netstat-nat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A netstat variant for NAT connections
+  URL:=http://tweegy.nl/projects/netstat-nat/
+endef
+
+define Package/netstat-nat/description
+       Netstat-nat is a small program written in C.
+       It displays NAT connections, managed by netfilter/iptables which comes
+       with the > 2.4.x linux kernels.
+       The program reads its information from '/proc/net/ip_conntrack', which
+       is the temporary conntrack-storage of netfilter.
+endef
+
+define Package/netstat-nat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/netstat-nat $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,netstat-nat))
diff --git a/net/nfs-server/Makefile b/net/nfs-server/Makefile
new file mode 100644 (file)
index 0000000..6257fdf
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# 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:=nfs-server
+PKG_VERSION:=2.2beta47
+PKG_RELEASE:=3
+
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/n/nfs-user-server
+PKG_SOURCE:=nfs-user-server_$(PKG_VERSION).orig.tar.gz
+PKG_MD5SUM:=79a29fe9f79b2f3241d4915767b8c511
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nfs-server
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  DEPENDS:=+portmap $(LIBRPC_DEPENDS)
+  TITLE:=User Space NFS server
+  URL:=http://packages.debian.org/nfs-user-server
+endef
+
+define Package/nfs-server/description
+User Space NFS server
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+TARGET_LDFLAGS += $(LIBRPC)
+
+define Package/nfs-server/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/nfsd.exports $(1)/etc/exports
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/nfsd.init $(1)/etc/init.d/nfsd
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rpc.* $(1)/usr/sbin/
+endef
+
+define Package/nfs-server/conffiles
+/etc/exports
+endef
+
+$(eval $(call BuildPackage,nfs-server))
diff --git a/net/nfs-server/files/nfsd.exports b/net/nfs-server/files/nfsd.exports
new file mode 100644 (file)
index 0000000..75a387a
--- /dev/null
@@ -0,0 +1 @@
+/mnt   (ro,all_squash,insecure)
diff --git a/net/nfs-server/files/nfsd.init b/net/nfs-server/files/nfsd.init
new file mode 100644 (file)
index 0000000..f66c1af
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+STOP=50
+
+start() {
+       service_start /usr/sbin/rpc.mountd -r
+       service_start /usr/sbin/rpc.nfsd
+}
+
+stop() {
+       service_stop /usr/sbin/rpc.nfsd
+       service_stop /usr/sbin/rpc.mountd -r
+}
diff --git a/net/nfs-server/patches/001-build_config.patch b/net/nfs-server/patches/001-build_config.patch
new file mode 100644 (file)
index 0000000..5aa1cde
--- /dev/null
@@ -0,0 +1,67 @@
+--- nfs-server-2.2beta47.old/site.mk   1970-01-01 01:00:00.000000000 +0100
++++ nfs-server-2.2beta47/site.mk       2005-03-24 22:42:20.000000000 +0100
+@@ -0,0 +1,11 @@
++#
++# Site-specific make options generated by BUILD. Please do not edit.
++#
++
++# ugidd support
++UGIDD_PROG=
++UGIDD_MAN=
++# Location of tcp_wrapper library
++LIBWRAP_DIR=-L/usr/share/stuff/src/openwrt/experimental/buildroot/build_mipsel/staging_dir/lib
++LIBWRAP_LIB=-lwrap
++DEVTAB_FILE=
+--- nfs-server-2.2beta47.old/site.h    1970-01-01 01:00:00.000000000 +0100
++++ nfs-server-2.2beta47/site.h        2005-03-24 22:44:19.000000000 +0100
+@@ -0,0 +1,50 @@
++/*
++ * Site-specific configuration options generated by BUILD.
++ * Please do not edit.
++ */
++
++/*
++ * If ENABLE_DEVTAB is defined, nfsd will use the new inode
++ * number generation scheme for avoiding inode number clashes
++ * on big hard disks.
++ */
++/* #undef ENABLE_DEVTAB */
++
++/*
++ * If MULTIPLE_SERVER_READWRITE is defined, you will be able 
++ * to run several nfsd process in parallel servicing all NFS 
++ * requests.
++ */
++#define MULTIPLE_SERVERS_READWRITE
++
++/*
++ * If ENABLE_UGID_DAEMON is defined, the real rpc.ugidd is built, 
++ * nfsd is built to support ugidd queries.
++ * Otherwise, a dummy program is created
++ */
++/* #undef ENABLE_UGID_DAEMON */
++
++/*
++ * If ENABLE_UGID_NIS is defined, nfsd will support user mapping 
++ * vie the client's NIS server.
++ */
++/* #undef ENABLE_UGID_NIS */
++
++/*
++ * if HOSTS_ACCESS is defined, ugidd uses host access control
++ * provided by libwrap.a from tcp_wrappers
++ */
++#define HOSTS_ACCESS
++
++/*
++ * Define correct ownership of export control file
++ */
++#define EXPORTSOWNERUID  ((uid_t) 0)
++#define EXPORTSOWNERGID  ((gid_t) 0)
++
++/*
++ * If WANT_LOG_MOUNTS is defined, every mount request will be logged
++ * to syslogd with the name of source site and a path that was
++ * it requested
++ */
++#define WANT_LOG_MOUNTS
diff --git a/net/nfs-server/patches/002-cross_compile_fix.patch b/net/nfs-server/patches/002-cross_compile_fix.patch
new file mode 100644 (file)
index 0000000..646a34a
--- /dev/null
@@ -0,0 +1,149 @@
+diff -urN nfs-server-2.2beta47.old/configure nfs-server-2.2beta47/configure
+--- nfs-server-2.2beta47.old/configure 1999-06-11 12:06:04.000000000 +0200
++++ nfs-server-2.2beta47/configure     2005-03-24 22:24:39.000000000 +0100
+@@ -1960,7 +1960,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 1967 "configure"
+@@ -1996,7 +1996,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2003 "configure"
+@@ -2032,7 +2032,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2039 "configure"
+@@ -2130,7 +2130,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2137 "configure"
+@@ -2166,7 +2166,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2173 "configure"
+@@ -2202,7 +2202,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2209 "configure"
+@@ -2238,7 +2238,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2245 "configure"
+@@ -2862,7 +2862,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 2869 "configure"
+@@ -3089,7 +3089,7 @@
+     
+     # DEC Alpha running OSF/1
+     if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 3096 "configure"
+@@ -3149,7 +3149,7 @@
+     # SVR3
+     if test -z "$space"; then
+       if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 3156 "configure"
+@@ -3348,7 +3348,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   if test "$cross_compiling" = yes; then
+-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
++    { echo "configure: error: can not run test program while cross compiling" 1>&2; }
+ else
+ cat > conftest.$ac_ext <<EOF
+ #line 3355 "configure"
+--- nfs-server-2.2beta47.old/logging.c 1998-10-30 17:11:22.000000000 +0100
++++ nfs-server-2.2beta47/logging.c     2005-03-24 22:47:44.000000000 +0100
+@@ -14,6 +14,7 @@
+  */
+ #include "nfsd.h"
++#include <time.h>
+ #ifdef HAVE_SYSLOG_H
+ #include <syslog.h>
+--- nfs-server-2.2beta47.old/fh.c      1999-11-10 10:41:14.000000000 +0100
++++ nfs-server-2.2beta47/fh.c  2005-03-24 22:50:50.000000000 +0100
+@@ -50,6 +50,7 @@
+  */
+ #include <assert.h>
++#include <time.h>
+ #include "nfsd.h"
+ #include "rpcmisc.h"
+ #include "signals.h"
+@@ -350,7 +351,7 @@
+ #ifndef ENABLE_DEVTAB
+       psi_t           dmajor, dminor;
+-#if SIZEOF_DEV_T == 4
++#if (SIZEOF_DEV_T == 4)
+       /* This folds the upper 16 bits into bits 8..15, and
+        * the lower 16 bits into bits 0..7
+        */
+--- nfs-server-2.2beta47.old/ugid_map.c        2005-03-24 22:34:56.000000000 +0100
++++ nfs-server-2.2beta47/ugid_map.c    2005-03-24 22:54:00.000000000 +0100
+@@ -34,14 +34,8 @@
+ #define UGID_CHUNK0_BYTES     (UGID_CHUNK * sizeof(idmap_t))
+ #define UGID_EXPIRE           300             /* 5 minutes */
+-/*
+- * Make sure we get the right size for ugid_t
+- */
+-#if SIZEOF_UID_T != SIZEOF_GID_T
+-#error Sorry, this code relies on sizeof(uid_t) == sizeof(gid_t)
+-#endif
+-#define UGID_BITS             (SIZEOF_UID_T * BITSPERBYTE)
++#define UGID_BITS             (sizeof(uid_t) * BITSPERBYTE)
+ #define BITSTOLEVEL(b)                ((UGID_BITS - (b)) / UGID_CHUNK_BITS - 1)
+ #define UGID_LOWER(id, b)     ((id) & ~((1 << (b)) - 1))
+ #define UGID_UPPER(id, b)     (((id + (1 << (b))) & ~((1 << (b)) - 1))-1)
diff --git a/net/nfs-server/patches/003-debian_subset.patch b/net/nfs-server/patches/003-debian_subset.patch
new file mode 100644 (file)
index 0000000..2ac3f93
--- /dev/null
@@ -0,0 +1,698 @@
+--- nfs-user-server-2.2beta47.orig/BUILD
++++ nfs-user-server-2.2beta47/BUILD
+@@ -48,7 +48,7 @@
+       shift
+ done
+-function read_yesno {
++read_yesno() {
+       ans=""
+       echo >&2
+       default=$2
+@@ -84,7 +84,7 @@
+       echo $ans
+ }
+-function read_ugid {
++read_ugid() {
+       ans=""
+       prompt="$2 [default $3 $4] "
+       default=$3
+@@ -145,7 +145,7 @@
+ if ! $batch; then
+       echo -n "Please press return to continue"
+-      read
++      read ans
+ fi
+ version=`cat .version`
+--- nfs-user-server-2.2beta47.orig/Makefile.in
++++ nfs-user-server-2.2beta47/Makefile.in
+@@ -95,20 +95,20 @@
+ LIBSRCS               = fileblocks.c fsusage.c realpath.c strerror.c \
+                 utimes.c mkdir.c rename.c getopt.c getopt_long.c \
+                 alloca.c mountlist.c xmalloc.c \
+-                xstrdup.c strdup.c strstr.c nfsmounted.c faccess.c \
++                xstrdup.c strdup.c strstr.c nfsmounted.c \
+                 haccess.c failsafe.c signals.c
+ XDRFILES      = mount.x nfs_prot.x
+ GENFILES      = mount.h mount_xdr.c mount_svc.c nfs_prot.h nfs_prot_xdr.c \
+                 ugid.h ugid_xdr.c ugid_clnt.c
+ HDRS          = system.h nfsd.h auth.h fh.h logging.h fakefsuid.h \
+-                rpcmisc.h faccess.h rquotad.h rquota.h haccess.h
++                rpcmisc.h rquotad.h rquota.h haccess.h
+ LIBHDRS               = fsusage.h getopt.h mountlist.h failsafe.h signals.h
+ MANPAGES5     = exports
+ MANPAGES8p    = mountd nfsd $(UGIDD_MAN)
+ MANPAGES8     = showmount
+ MANPAGES      = $(MANPAGES5) $(MANPAGES8p) $(MANPAGES8)
+ LIBOBJS               = version.o fsusage.o mountlist.o xmalloc.o xstrdup.o \
+-                nfsmounted.o faccess.o haccess.o failsafe.o \
++                nfsmounted.o haccess.o failsafe.o \
+                 signals.o @LIBOBJS@ @ALLOCA@
+ OBJS          = logging.o fh.o devtab.o auth_init.o auth_clnt.o auth.o
+ NFSD_OBJS     = nfsd.o rpcmisc.o nfs_dispatch.o getattr.o setattr.o \
+@@ -116,7 +116,7 @@
+ MOUNTD_OBJS   = mountd.o rpcmisc.o mount_dispatch.o mount_xdr.o rmtab.o \
+                 $(OBJS)
+ SHOWMOUNT_OBJS        = showmount.o mount_xdr.o
+-UGIDD_OBJS    = ugidd.o ugid_xdr.o logging.o
++UGIDD_OBJS    = ugidd.o ugid_xdr.o logging.o rpcmisc.o
+ DAEMONS               = $(rpcprefix)mountd $(rpcprefix)nfsd $(UGIDD_PROG)
+ CLIENTS               = showmount
+--- nfs-user-server-2.2beta47.orig/auth.c
++++ nfs-user-server-2.2beta47/auth.c
+@@ -143,6 +143,21 @@
+       return okay;
+ }
++static inline int
++auth_atob(const char *name, struct in_addr *ap)
++{
++      int m;
++
++      if (!isdigit(*name))
++              return 0;
++      for (m = 0; isdigit(*name); name++)
++              m = m * 10 + (unsigned char) *name - '0';
++      if (m > 32)
++              return 0;
++      ap->s_addr = m ? ~((1 << (32 - m)) - 1) : 0;
++      return 1;
++}
++
+ /*
+  * Get a client entry for a specific name or pattern.
+  * If necessary, this function performs a hostname lookup to
+@@ -614,7 +629,9 @@
+       if (auth_aton(hname, &haddr, &ename)) {
+               if (*ename == '\0')
+                       is_hostaddr = 1;
+-              else if (*ename == '/' && auth_aton(ename+1, &hmask, NULL))
++              else if (*ename == '/' &&
++                       (auth_aton(ename+1, &hmask, NULL) ||
++                        auth_atob(ename+1, &hmask)))
+                       is_netmask = 1;
+       }
+       is_special = is_wildcard + is_netgroup + is_netmask;
+--- nfs-user-server-2.2beta47.orig/auth_init.c
++++ nfs-user-server-2.2beta47/auth_init.c
+@@ -23,6 +23,7 @@
+ #define EXPORTSFILE   "/etc/exports"
+ #endif
++#if 0
+ /* Support for file access control on /etc/exports by Alex Yuriev. */
+ #include "faccess.h"
+ #ifndef EXPORTSOWNERUID
+@@ -31,6 +32,7 @@
+ #ifndef EXPORTSOWNERGID
+ #define EXPORTSOWNERGID               ((gid_t) 0)
+ #endif
++#endif
+ exportnode *  export_list = NULL;
+ int           allow_non_root = 0;
+@@ -395,6 +397,7 @@
+       auth_file = fname;      /* Save for re-initialization */
+       /* Check protection of exports file. */
++#if 0 /* A man's house is his castle. */
+       switch(iCheckAccess(auth_file, EXPORTSOWNERUID, EXPORTSOWNERGID)) {
+       case FACCESSWRITABLE:
+               Dprintf(L_ERROR,
+@@ -409,6 +412,7 @@
+               Dprintf(L_ERROR, "exiting because of security violation.\n");
+               exit(1);
+       }
++#endif
+       if ((ef = fopen(fname, "r")) == NULL) {
+               Dprintf(L_ERROR, "Could not open exports file %s: %s\n",
+@@ -468,7 +472,7 @@
+               /* Build the RPC mount export list data structure. */
+               resex = (exportnode *) xmalloc(sizeof *resex);
+-              resex->ex_dir = mount_point;
++              resex->ex_dir = xstrdup(path);
+               resex->ex_groups = NULL;
+ #ifndef NEW_STYLE_EXPORTS_FILE
+--- nfs-user-server-2.2beta47.orig/configure.in
++++ nfs-user-server-2.2beta47/configure.in
+@@ -53,7 +53,7 @@
+ AC_CHECK_LIB(crypt, main)
+ AC_CHECK_LIB(nys, main)
+ AC_REPLACE_FUNCS(strerror realpath mkdir rename utimes strdup strstr getopt getopt_long)
+-AC_HAVE_FUNCS(getcwd seteuid setreuid getdtablesize setgroups lchown setsid setfsuid setfsgid innetgr quotactl authdes_getucred)
++AC_HAVE_FUNCS(getcwd seteuid setreuid getdtablesize setgroups lchown setsid setfsuid setfsgid innetgr quotactl authdes_getucred strsignal)
+ AC_AUTHDES_GETUCRED
+ AC_BROKEN_SETFSUID
+ AC_MOUNTLIST
+--- nfs-user-server-2.2beta47.orig/exports.man
++++ nfs-user-server-2.2beta47/exports.man
+@@ -8,7 +8,7 @@
+ The file
+ .I /etc/exports
+ serves as the access control list for file systems which may be
+-exported to NFS clients.  It it used by both the NFS mount daemon,
++exported to NFS clients.  It is used by both the NFS mount daemon,
+ .IR mountd (8)
+ and the NFS file server daemon
+ .IR nfsd (8).
+@@ -75,11 +75,12 @@
+ off, specify
+ .IR insecure .
+ .TP
++.IR ro
++Disallow the client to modify files and directories.  The client is only
++allowed to issue read-only requests.
++.TP
+ .IR rw
+-Allow the client to modify files and directories. The default is to
+-restrict the client to read-only request, which can be made explicit
+-by using the
+-.IR ro " option.
++Allow the client to modify files and directories. This is the default.
+ .TP
+ .I noaccess
+ This makes everything below the directory inaccessible for the named
+@@ -98,6 +99,14 @@
+ .TP
+ .IR link_absolute
+ Leave all symbolic link as they are. This is the default operation.
++.SS Anonymous Entries
++.PP
++Entries where hosts are not specified are known as anonymous entries.  They
++have different default settings compared to normal entries.  The differences
++include
++.IR all_squash ,
++.IR no_secure ", and"
++.IR ro .
+ .SS User ID Mapping
+ .PP
+ .I nfsd
+--- nfs-user-server-2.2beta47.orig/failsafe.c
++++ nfs-user-server-2.2beta47/failsafe.c
+@@ -10,8 +10,12 @@
+ #include "logging.h"
+ #include "signals.h"
+ #include <sys/wait.h>
++#ifdef HAVE_STRSIGNAL
++#include <string.h>
++#else
+ static const char *   get_signame(int signo);
++#endif
+ void
+ failsafe(int level, int ncopies)
+@@ -111,9 +115,17 @@
+                                       pid, running? "Continue" : "Exit");
+                       } else {
+                               Dprintf(L_WARNING, "failsafe: "
++#ifdef HAVE_STRSIGNAL
++                                      "child %d terminated by: %s. "
++#else
+                                       "child %d terminated by %s. "
++#endif
+                                       "Restarting.",
++#ifdef HAVE_STRSIGNAL
++                                      pid, strsignal(signo));
++#else
+                                       pid, get_signame(signo));
++#endif
+                               child = -1; /* Restart */
+                       }
+               } else if (WIFEXITED(status)) {
+@@ -159,6 +171,7 @@
+       /* NOP */
+ }
++#ifndef HAVE_STRSIGNAL
+ static const char *
+ get_signame(int signo)
+ {
+@@ -199,3 +212,4 @@
+       sprintf(namebuf, "signal #%d", signo);
+       return namebuf;
+ }
++#endif
+--- nfs-user-server-2.2beta47.orig/mount_dispatch.c
++++ nfs-user-server-2.2beta47/mount_dispatch.c
+@@ -131,7 +131,7 @@
+       dent = &dtbl[proc_index];
+       memset(&argument, 0, dent->arg_size);
+-      if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) {
++      if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) {
+               svcerr_decode(transp);
+               goto done;
+       }
+@@ -148,7 +148,7 @@
+       if (!svc_sendreply(transp, dent->xdr_result, (caddr_t) resp)) {
+               svcerr_systemerr(transp);
+       }
+-      if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) {
++      if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) {
+               Dprintf(L_ERROR, "unable to free RPC arguments, exiting\n");
+               exit(1);
+       }
+--- nfs-user-server-2.2beta47.orig/mount_xdr.c
++++ nfs-user-server-2.2beta47/mount_xdr.c
+@@ -190,7 +190,7 @@
+ xdr_ppathcnf(XDR *xdrs, ppathcnf *objp)
+ {
+-       register long *buf=buf;
++       int32_t *buf=buf;
+        int i=i;
+--- nfs-user-server-2.2beta47.orig/mountd.c
++++ nfs-user-server-2.2beta47/mountd.c
+@@ -310,6 +310,7 @@
+       int c;
+       program_name = argv[0];
++      chdir("/");
+       /* Parse the command line options and arguments. */
+       opterr = 0;
+--- nfs-user-server-2.2beta47.orig/nfs_dispatch.c
++++ nfs-user-server-2.2beta47/nfs_dispatch.c
+@@ -147,7 +147,7 @@
+       nfsclient = NULL;
+       memset(&argument, 0, dent->arg_size);
+-      if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) {
++      if (!svc_getargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) {
+               svcerr_decode(transp);
+               goto done;
+       }
+@@ -173,7 +173,7 @@
+       svc_sendreply(transp, dent->xdr_result, (caddr_t) &result);
+ #endif
+-      if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, &argument)) {
++      if (!svc_freeargs(transp, (xdrproc_t) dent->xdr_argument, (caddr_t) &argument)) {
+               Dprintf(L_ERROR, "unable to free RPC arguments, exiting\n");
+               exit(1);
+       }
+--- nfs-user-server-2.2beta47.orig/nfs_prot_xdr.c
++++ nfs-user-server-2.2beta47/nfs_prot_xdr.c
+@@ -98,7 +98,7 @@
+ xdr_fattr(XDR *xdrs, fattr *objp)
+ {
+-       register long *buf=buf;
++       int32_t *buf=buf;
+        if (xdrs->x_op == XDR_ENCODE) {
+@@ -273,7 +273,7 @@
+ xdr_sattr(XDR *xdrs, sattr *objp)
+ {
+-       register long *buf=buf;
++       int32_t *buf=buf;
+        if (xdrs->x_op == XDR_ENCODE) {
+@@ -553,7 +553,7 @@
+ xdr_writeargs(XDR *xdrs, writeargs *objp)
+ {
+-      register long  *buf = buf;
++      int32_t *buf = buf;
+       if (xdrs->x_op == XDR_ENCODE) {
+@@ -777,7 +777,7 @@
+ xdr_statfsokres(XDR *xdrs, statfsokres *objp)
+ {
+-       register long *buf=buf;
++       int32_t *buf=buf;
+        if (xdrs->x_op == XDR_ENCODE) {
+--- nfs-user-server-2.2beta47.orig/nfsd.c
++++ nfs-user-server-2.2beta47/nfsd.c
+@@ -36,6 +36,7 @@
+ #define CHK_READ      0
+ #define CHK_WRITE     1
+ #define CHK_NOACCESS  2
++#define CHK_ROOT      4
+ /* Make larger reads possible. Without crashing the machine :-) */
+ #undef NFS_MAXDATA
+@@ -173,7 +174,8 @@
+               return NULL;
+       }
+-      auth_user(nfsmount, rqstp);
++      if (!(flags & CHK_ROOT) || strcmp(nfsmount->path, fhc->path))
++              auth_user(nfsmount, rqstp);
+       *statp = NFS_OK;
+       return fhc;
+@@ -244,7 +246,7 @@
+       nfsstat status;
+       fhcache *fhc;
+-      fhc = auth_fh(rqstp, argp, &status, CHK_READ);
++      fhc = auth_fh(rqstp, argp, &status, CHK_READ | CHK_ROOT);
+       if (fhc == NULL)
+               return status;
+@@ -575,7 +577,12 @@
+ #endif
+                       /* MvS: Some clients use chardev 0xFFFF for a FIFO. */
++#if defined(major) && defined(minor)
++                      if (S_ISCHR(argp->attributes.mode) &&
++                          major(dev) == 0xff && minor(dev) == 0xff) {
++#else
+                       if (S_ISCHR(argp->attributes.mode) && dev == 0xFFFF) {
++#endif
+                               is_borc = 0;
+                               dev = 0;
+                               argp->attributes.mode &= ~S_IFMT;
+@@ -882,7 +889,9 @@
+       /* This code is from Mark Shand's version */
+       errno = 0;
+-      if (efs_lstat(h->path, &sbuf) < 0 || !(S_ISDIR(sbuf.st_mode)))
++      if (efs_lstat(h->path, &sbuf) < 0)
++              return (NFSERR_ACCES);
++      if (!S_ISDIR(sbuf.st_mode))
+               return (NFSERR_NOTDIR);
+       if ((dirp = efs_opendir(h->path)) == NULL)
+               return ((errno ? nfs_errno() : NFSERR_NAMETOOLONG));
+@@ -940,7 +949,7 @@
+       char *path;
+       struct fs_usage fs;
+-      fhc = auth_fh(rqstp, argp, &status, CHK_READ | CHK_NOACCESS);
++      fhc = auth_fh(rqstp, argp, &status, CHK_READ | CHK_NOACCESS | CHK_ROOT);
+       if (fhc == NULL)
+               return status;
+       path = fhc->path;
+--- nfs-user-server-2.2beta47.orig/rpcmisc.c
++++ nfs-user-server-2.2beta47/rpcmisc.c
+@@ -64,25 +64,25 @@
+       asize = sizeof(saddr);
+       sock = 0;
+       if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0) {
+-              int     ssize = sizeof (int);
++              int     ssize = sizeof (i);
+               if (saddr.sin_family != AF_INET)
+                       goto not_inetd;
+-              if (getsockopt(0, SOL_SOCKET, SO_TYPE, &_rpcfdtype, &ssize) < 0)
++              if (getsockopt(0, SOL_SOCKET, SO_TYPE, &i, &ssize) < 0)
+                       goto not_inetd;
++              _rpcfdtype = i;
+               background_logging();   /* no more logging to stderr */
+               closedown = time(NULL) + _RPCSVC_CLOSEDOWN;
+               _rpcpmstart = 1;
+       } else {
+ not_inetd:
+-              _rpcfdtype = 0;
+               for (i = 0; (vers = verstbl[i]) != 0; i++)
+                       pmap_unset(prog, vers);
+               sock = RPC_ANYSOCK;
+       }
+       if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
+-              if (_rpcfdtype == 0 && defport != 0)
++              if (_rpcpmstart == 0 && defport != 0)
+                       sock = makesock(defport, IPPROTO_UDP, bufsiz);
+               transp = svcudp_create(sock);
+               if (transp == NULL)
+@@ -97,7 +97,7 @@
+       }
+       if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) {
+-              if (_rpcfdtype == 0 && defport != 0)
++              if (_rpcpmstart == 0 && defport != 0)
+                       sock = makesock(defport, IPPROTO_TCP, bufsiz);
+               transp = svctcp_create(sock, 0, 0);
+               if (transp == NULL)
+@@ -220,11 +220,14 @@
+       }
+ #endif                                /* SO_SNDBUF */
+-      if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1)
+-              Dprintf(L_FATAL, "Could not bind %s socket to %s:%d: %s\n",
++      if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) {
++              Dprintf(L_ERROR, "Could not bind %s socket to %s:%d: %s\n",
+                                       prot_name, inet_ntoa(sin.sin_addr), 
+                                       ntohs(sin.sin_port),
+                                       strerror(errno));
++              close(s);
++              s = RPC_ANYSOCK;
++      }
+       return (s);
+ }
+--- nfs-user-server-2.2beta47.orig/showmount.c
++++ nfs-user-server-2.2beta47/showmount.c
+@@ -200,7 +200,7 @@
+               memset(&exportlist, '\0', sizeof(exportlist));
+               clnt_stat = clnt_call(mclient, MOUNTPROC_EXPORT,
+                       (xdrproc_t) xdr_void, NULL,
+-                      (xdrproc_t) xdr_exports, &exportlist,
++                      (xdrproc_t) xdr_exports, (caddr_t) &exportlist,
+                       total_timeout);
+               if (clnt_stat != RPC_SUCCESS) {
+                       clnt_perror(mclient, "rpc mount export");
+@@ -233,7 +233,7 @@
+       memset(&dumplist, '\0', sizeof(dumplist));
+       clnt_stat = clnt_call(mclient, MOUNTPROC_DUMP,
+               (xdrproc_t) xdr_void, NULL,
+-              (xdrproc_t) xdr_mountlist, &dumplist,
++              (xdrproc_t) xdr_mountlist, (caddr_t) &dumplist,
+               total_timeout);
+       if (clnt_stat != RPC_SUCCESS) {
+               clnt_perror(mclient, "rpc mount dump");
+--- nfs-user-server-2.2beta47.orig/ugid_clnt.c
++++ nfs-user-server-2.2beta47/ugid_clnt.c
+@@ -16,7 +16,7 @@
+       static int clnt_res;
+       memset((char *)&clnt_res, 0, sizeof(clnt_res));
+-      if (clnt_call(clnt, AUTHENTICATE, (xdrproc_t) xdr_int, argp, (xdrproc_t) xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++      if (clnt_call(clnt, AUTHENTICATE, (xdrproc_t) xdr_int, (caddr_t) argp, (xdrproc_t) xdr_int, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) {
+               return (NULL);
+       }
+       return (&clnt_res);
+@@ -28,7 +28,7 @@
+       static int clnt_res;
+       memset((char *)&clnt_res, 0, sizeof(clnt_res));
+-      if (clnt_call(clnt, NAME_UID, (xdrproc_t) xdr_ugname, argp, (xdrproc_t) xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++      if (clnt_call(clnt, NAME_UID, (xdrproc_t) xdr_ugname, (caddr_t) argp, (xdrproc_t) xdr_int, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) {
+               return (NULL);
+       }
+       return (&clnt_res);
+@@ -40,7 +40,7 @@
+       static int clnt_res;
+       memset((char *)&clnt_res, 0, sizeof(clnt_res));
+-      if (clnt_call(clnt, GROUP_GID, (xdrproc_t) xdr_ugname, argp, (xdrproc_t) xdr_int, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++      if (clnt_call(clnt, GROUP_GID, (xdrproc_t) xdr_ugname, (caddr_t) argp, (xdrproc_t) xdr_int, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) {
+               return (NULL);
+       }
+       return (&clnt_res);
+@@ -52,7 +52,7 @@
+       static ugname clnt_res;
+       memset((char *)&clnt_res, 0, sizeof(clnt_res));
+-      if (clnt_call(clnt, UID_NAME, (xdrproc_t) xdr_int, argp, (xdrproc_t) xdr_ugname, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++      if (clnt_call(clnt, UID_NAME, (xdrproc_t) xdr_int, (caddr_t) argp, (xdrproc_t) xdr_ugname, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) {
+               return (NULL);
+       }
+       return (&clnt_res);
+@@ -64,7 +64,7 @@
+       static ugname clnt_res;
+       memset((char *)&clnt_res, 0, sizeof(clnt_res));
+-      if (clnt_call(clnt, GID_GROUP, (xdrproc_t) xdr_int, argp, (xdrproc_t) xdr_ugname, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++      if (clnt_call(clnt, GID_GROUP, (xdrproc_t) xdr_int, (caddr_t) argp, (xdrproc_t) xdr_ugname, (caddr_t) &clnt_res, TIMEOUT) != RPC_SUCCESS) {
+               return (NULL);
+       }
+       return (&clnt_res);
+--- nfs-user-server-2.2beta47.orig/ugid_map.c
++++ nfs-user-server-2.2beta47/ugid_map.c
+@@ -602,7 +602,7 @@
+        * the server's port after clntudp_create, so we fetch it
+        * explicitly.
+        */
+-      clnt_control(clnt, CLGET_SERVER_ADDR, &addr);
++      clnt_control(clnt, CLGET_SERVER_ADDR, (caddr_t) &addr);
+       if (!SECURE_PORT(addr.sin_port)) {
+               Dprintf(L_ERROR, "%s on %s runs on unprivileged port.\n",
+                               name, inet_ntoa(addr.sin_addr));
+--- nfs-user-server-2.2beta47.orig/ugidd.c
++++ nfs-user-server-2.2beta47/ugidd.c
+@@ -20,6 +20,8 @@
+ #include "ugid.h"
+ #include "logging.h"
+ #include "haccess.h"
++#include "rpcmisc.h"
++#include "signals.h"
+ #ifdef HAVE_LIBWRAP_BUG
+ #include <syslog.h>
+ #endif
+@@ -27,6 +29,8 @@
+ static void   ugidprog_1(struct svc_req *rqstp, SVCXPRT *transp);
+ static void   usage(void);
++static void   terminate(void);
++static RETSIGTYPE sigterm(int sig);
+ #ifndef HAVE_RPCGEN_C
+ #define authenticate_1_svc    authenticate_1
+@@ -39,17 +43,23 @@
+ static struct option longopts[] = {
+       { "debug", 0, 0, 'd' },
++      { "port", required_argument, 0, 'P' },
+       { NULL, 0, 0, 0 }
+ };
++static int ugidd_versions[] = {
++      UGIDVERS,
++      0
++};
++
+ int
+ main(argc, argv)
+ int   argc;
+ char  **argv;
+ {
+-      SVCXPRT *transp;
+       int     c, longind;
+       int     foreground = 0;
++      int     port = 0;
+ #ifndef HOSTS_ACCESS
+       fprintf(stderr,
+@@ -59,40 +69,34 @@
+       sleep(1);
+ #endif
+-      while ((c = getopt_long(argc, argv, "d", longopts, &longind)) != EOF) {
++      chdir("/");
++
++      while ((c = getopt_long(argc, argv, "dP:", longopts, &longind)) != EOF) {
+               switch (c) {
+               case 'd':
+                       foreground = 1;
+                       enable_logging("ugid");
+                       break;
++              case 'P':
++                      port = atoi(optarg);
++                      if (port <= 0 || port > 65535) {
++                              fprintf(stderr, "ugidd: bad port number: %s\n",
++                                      optarg);
++                              usage();
++                      }
++                      break;
+               default:
+                       usage();
+               }
+       }
+-        (void)pmap_unset(UGIDPROG, UGIDVERS);
++      log_open("ugidd", foreground);
+-        transp = svcudp_create(RPC_ANYSOCK);
+-        if (transp == NULL) {
+-                (void)fprintf(stderr, "cannot create udp service.\n");
+-                exit(1);
+-        }
+-        if (!svc_register(transp, UGIDPROG, UGIDVERS, ugidprog_1, IPPROTO_UDP)) {
+-                fprintf(stderr, "unable to register (UGIDPROG, UGIDVERS, UDP)\n");
+-                exit(1);
+-        }
+-
+-        transp = svctcp_create(RPC_ANYSOCK, 0, 0);
+-        if (transp == NULL) {
+-                fprintf(stderr, "cannot create tcp service.\n");
+-                exit(1);
+-        }
+-        if (!svc_register(transp, UGIDPROG, UGIDVERS, ugidprog_1, IPPROTO_TCP)) {
+-                fprintf(stderr, "unable to register (UGIDPROG, UGIDVERS, TCP)\n");
+-                exit(1);
+-        }
++      /* Create services and register with portmapper */
++      _rpcfdtype = SOCK_DGRAM;
++      rpc_init("ugidd", UGIDPROG, ugidd_versions, ugidprog_1, port, 0);
+-      if (!foreground) {
++      if (!foreground && !_rpcpmstart) {
+               if ((c = fork()) > 0)
+                       exit(0);
+               if (c < 0) {
+@@ -117,7 +121,8 @@
+ #endif
+       }
+-      log_open("ugidd", foreground);
++      install_signal_handler(SIGTERM, sigterm);
++      atexit(terminate);
+       svc_run();
+       Dprintf(L_ERROR, "svc_run returned\n");
+@@ -127,7 +132,7 @@
+ static void
+ usage()
+ {
+-      fprintf(stderr, "rpc.ugidd: [-d]\n");
++      fprintf(stderr, "rpc.ugidd: [-d] [-P port]\n");
+       exit (2);
+ }
+@@ -188,7 +193,7 @@
+               return;
+       }
+       bzero((char *)&argument, sizeof(argument));
+-      if (!svc_getargs(transp, xdr_argument, &argument)) {
++      if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
+               svcerr_decode(transp);
+               return;
+       }
+@@ -196,7 +201,7 @@
+       if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
+               svcerr_systemerr(transp);
+       }
+-      if (!svc_freeargs(transp, xdr_argument, &argument)) {
++      if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
+               (void)fprintf(stderr, "unable to free arguments\n");
+               exit(1);
+       }
+@@ -321,6 +326,19 @@
+ }
++static RETSIGTYPE
++sigterm(int sig)
++{
++      exit(0);
++}
++
++static void
++terminate(void)
++{
++      rpc_exit(UGIDPROG, ugidd_versions);
++}
++
++
+ #else /* ENABLE_UGID_DAEMON */
diff --git a/net/nfs-server/patches/004-gcc34_fix.patch b/net/nfs-server/patches/004-gcc34_fix.patch
new file mode 100644 (file)
index 0000000..21915ce
--- /dev/null
@@ -0,0 +1,24 @@
+diff -urN nfs-server-2.2beta47.old/fh.c nfs-server-2.2beta47.dev/fh.c
+--- nfs-server-2.2beta47.old/fh.c      2005-04-29 00:37:48.000000000 +0200
++++ nfs-server-2.2beta47.dev/fh.c      2005-04-29 00:39:44.000000000 +0200
+@@ -351,13 +351,13 @@
+ #ifndef ENABLE_DEVTAB
+       psi_t           dmajor, dminor;
+-#if (SIZEOF_DEV_T == 4)
+-      /* This folds the upper 16 bits into bits 8..15, and
+-       * the lower 16 bits into bits 0..7
+-       */
+-      dev = (((dev >> 16) & 0xff00) ^ ((dev >> 8) & 0xff00)) | 
+-            (((dev >> 8) & 0xff) ^ (dev & 0xff));
+-#endif
++      if (sizeof(dev_t) == 4) {
++              /* This folds the upper 16 bits into bits 8..15, and
++               * the lower 16 bits into bits 0..7
++               */
++              dev = (((dev >> 16) & 0xff00) ^ ((dev >> 8) & 0xff00)) | 
++                    (((dev >> 8) & 0xff) ^ (dev & 0xff));
++      }
+       /*
+          * Assuming major and minor numbers are small integers,
diff --git a/net/nfs-server/patches/005-remove_warning.patch b/net/nfs-server/patches/005-remove_warning.patch
new file mode 100644 (file)
index 0000000..5484b79
--- /dev/null
@@ -0,0 +1,30 @@
+--- nfs-server-2.2beta47.old/auth_clnt.c       1999-11-10 10:18:06.000000000 +0100
++++ nfs-server-2.2beta47/auth_clnt.c   2005-03-24 23:44:16.000000000 +0100
+@@ -238,19 +238,23 @@
+       /* First, set the user ID. */
+       if (auth_uid != cred_uid) {
+-              if (setfsuid(cred_uid) < 0)
++              if (setfsuid(cred_uid) < 0) {
++#if 0
+                       Dprintf(L_ERROR, "Unable to setfsuid %d: %s\n",
+                           cred_uid, strerror(errno));
+-              else
++#endif 
++              } else
+                       auth_uid = cred_uid;
+       }
+       /* Next, the group ID. */
+       if (auth_gid != cred_gid) {
+-              if (setfsgid(cred_gid) < 0)
++              if (setfsgid(cred_gid) < 0) {
++#if 0
+                       Dprintf(L_ERROR, "Unable to setfsgid %d: %s\n",
+                           cred_gid, strerror(errno));
+-              else
++#endif 
++              } else
+                       auth_gid = cred_gid;
+       }
diff --git a/net/ngircd/Makefile b/net/ngircd/Makefile
new file mode 100644 (file)
index 0000000..ab9795d
--- /dev/null
@@ -0,0 +1,93 @@
+#
+# Copyright (C) 2008-2012 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:=18
+PKG_RELEASE:=1
+
+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:=4958c8b2d128cf3e9888af3f782892a1
+
+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 ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-openssl="$(STAGING_DIR)/usr"
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --without-openssl
+endif
+
+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
+}
diff --git a/net/ngrep/Makefile b/net/ngrep/Makefile
new file mode 100644 (file)
index 0000000..a516b43
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2007-2010 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:=ngrep
+PKG_VERSION:=1.45
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/ngrep
+PKG_MD5SUM:=bc8150331601f3b869549c94866b4f1c
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ngrep
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libpcre
+  TITLE:=network grep
+  URL:=http://ngrep.sourceforge.net
+endef
+
+define Package/ngrep/description
+       ngrep a pcap-aware tool that will allow you to specify extended
+       regular expressions to match against data payloads of packets. It
+       currently recognizes TCP, UDP, and ICMP across Ethernet, PPP, SLIP,
+       FDDI, Token Ring and null interfaces, and understands BPF filter
+       logic in the same fashion as more common packet sniffing tools,
+       like tcpdump and snoop.
+endef
+
+CONFIGURE_ARGS+= \
+       --with-pcap-includes=$(STAGING_DIR)/usr/include \
+       --enable-pcre \
+       --with-pcre=$(STAGING_DIR)/usr \
+       --disable-dropprivs \
+
+CONFIGURE_VARS+= \
+       LDFLAGS="$(TARGET_LDFLAGS) -lpcre" \
+
+define Package/ngrep/install   
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ngrep $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ngrep))
diff --git a/net/ngrep/patches/001-makefile_in.patch b/net/ngrep/patches/001-makefile_in.patch
new file mode 100644 (file)
index 0000000..5d7ab09
--- /dev/null
@@ -0,0 +1,20 @@
+diff -u ngrep-1.45/Makefile.in ngrep-1.45.mod/Makefile.in
+--- ngrep-1.45/Makefile.in     Tue Nov 28 15:35:37 2006
++++ ngrep-1.45.mod/Makefile.in Sat May 19 10:40:57 2007
+@@ -32,13 +32,13 @@
+ INSTALL = ./install-sh
+-REGEX_DIR=@REGEX_DIR@
+-REGEX_OBJS=@REGEX_OBJS@
++REGEX_DIR=
++REGEX_OBJS=
+ all: $(TARGET) 
+-$(TARGET): $(REGEX_OBJS) $(OBJS) 
++$(TARGET):  $(OBJS) 
+       $(CC) $(CFLAGS) $(LDFLAGS) $(STRIPFLAG) -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS) 
+ debug: $(REGEX_OBJS) $(OBJS)
\ No newline at end of file
diff --git a/net/ngrep/patches/001-ngrep.patch b/net/ngrep/patches/001-ngrep.patch
new file mode 100644 (file)
index 0000000..c3cb2e7
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ur ngrep-1.45/ngrep.c ngrep-1.45.mod/ngrep.c
+--- ngrep-1.45/ngrep.c Tue Nov 28 15:38:43 2006
++++ ngrep-1.45.mod/ngrep.c     Sat May 19 10:21:27 2007
+@@ -92,7 +92,7 @@
+ #endif
+ #if USE_PCRE
+-#include "pcre-5.0/pcre.h"
++#include "pcre.h"
+ #else
+ #include "regex-0.12/regex.h"
+ #endif
diff --git a/net/nmap/Makefile b/net/nmap/Makefile
new file mode 100644 (file)
index 0000000..a24544e
--- /dev/null
@@ -0,0 +1,139 @@
+#
+# Copyright (C) 2006-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+#TODO
+#
+# * uClibcpp not supported, performance +100x slower. libstdcpp is being used. https://bugs.busybox.net/show_bug.cgi?id=2545
+# * liblua is still not recognized/blindly accepted. Impossible to compile with support
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=nmap
+PKG_VERSION:=6.46
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://nmap.org/dist/
+PKG_MD5SUM:=5a36ad3a63d5b7ea5514f745a397436a
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+NMAP_DEPENDS:=+libpcap +libstdcpp
+NCAT_DEPENDS:=+libpcap
+NPING_DEPENDS:=+libpcap +libpthread +libstdcpp
+NDIFF_DEPENDS:=+python
+
+define Package/nmap/default
+  SUBMENU:=NMAP Suite
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://nmap.org/
+endef
+
+define Package/nmap
+$(call Package/nmap/default)
+  DEPENDS:=$(NMAP_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Utility for network exploration or security auditing
+endef
+
+define Package/nmap-ssl
+$(call Package/nmap/default)
+  DEPENDS:=$(NMAP_DEPENDS) +libopenssl
+  VARIANT:=ssl
+  TITLE:=Nmap (with OpenSSL support)
+endef
+
+define Package/ncat
+$(call Package/nmap/default)
+  DEPENDS:=$(NCAT_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Much-improved reimplementation of Netcat
+endef
+
+define Package/ncat-ssl
+$(call Package/nmap/default)
+  DEPENDS:=$(NCAT_DEPENDS) +libopenssl
+  VARIANT:=ssl
+  TITLE:=Ncat (with OpenSSL support)
+endef
+
+define Package/nping
+$(call Package/nmap/default)
+  DEPENDS:=$(NPING_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Network packet generation tool / ping utility
+endef
+
+define Package/ndiff
+$(call Package/nmap/default)
+  DEPENDS:=$(NDIFF_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Utility to compare the results of Nmap scans
+endef
+
+CONFIGURE_ARGS += \
+       --with-libdnet=included \
+       --with-libpcre=included \
+       --with-libpcap="$(STAGING_DIR)/usr" \
+       --without-liblua
+
+CONFIGURE_VARS += CXXFLAGS="$$$$CXXFLAGS -fno-builtin"
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr"
+else
+       CONFIGURE_ARGS += --without-openssl
+endif
+
+define Package/nmap/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/nmap
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/
+endef
+
+define Package/nmap-ssl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/nmap
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/
+endef
+
+define Package/ncat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/
+endef
+
+define Package/ncat-ssl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/ncat
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/ncat/ca-bundle.crt $(1)/usr/share/ncat/
+endef
+
+define Package/ndiff/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndiff $(1)/usr/bin/
+endef
+
+define Package/nping/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nping $(1)/usr/bin/
+endef
+
+
+$(eval $(call BuildPackage,nmap))
+$(eval $(call BuildPackage,nmap-ssl))
+$(eval $(call BuildPackage,ncat))
+$(eval $(call BuildPackage,ncat-ssl))
+$(eval $(call BuildPackage,nping))
+$(eval $(call BuildPackage,ndiff))
diff --git a/net/nocatauth/Makefile b/net/nocatauth/Makefile
new file mode 100644 (file)
index 0000000..92f55aa
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2009-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:=nocatauth
+PKG_VERSION:=nightly
+PKG_RELEASE:=2
+
+PKG_SOURCE:=NoCatAuth-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://nocat.net/downloads/NoCatAuth/
+PKG_MD5SUM:=b3a5f8d62b322a9409806037ab8d374e
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/NoCatAuth-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nocatauth
+  SUBMENU:=Captive Portals
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+perl +perlbase-essential +perlbase-posix +perlbase-autoloader +perlbase-xsloader +perlbase-fcntl +perlbase-tie +perlbase-getopt +perlbase-findbin +perlbase-cwd +perlbase-config +perlbase-file +perlbase-sigtrap +perlbase-io +perlbase-symbol +perlbase-selectsaver +perlbase-socket +perlbase-errno +kmod-ipt-ipopt +kmod-ipt-nat-extra +iptables-mod-ipopt +iptables-mod-nat-extra
+  TITLE:=Open public network perl-based gateway daemon
+  URL:=http://nocat.net
+endef
+
+define Package/nocatauth/description
+        NoCatAuth is the original "catch and release" captive portal
+       implementation. It provides a simple splash screen web page for
+       clients on your network, as well as a variety of authenticated
+       modes. It is written in Perl.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       mkdir -p $(PKG_INSTALL_DIR)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               PREFIX="$(PKG_INSTALL_DIR)" \
+               gateway
+endef
+
+define Package/nocatauth/install
+       $(INSTALL_DIR) $(1)
+       $(INSTALL_DIR) $(1)/www
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/htdocs/{status,splash}.html $(1)/www
+       $(INSTALL_DIR) $(1)/www/images
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/htdocs/images/auth_logo.gif $(1)/www/images
+       $(INSTALL_DIR) $(1)/usr/nocatauth/lib
+       $(CP) $(PKG_INSTALL_DIR)/lib/* $(1)/usr/nocatauth/lib
+       $(INSTALL_DIR) $(1)/usr/nocatauth/bin
+       $(CP) $(PKG_INSTALL_DIR)/bin/* $(1)/usr/nocatauth/bin
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/nocat.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/nocatauth-gateway $(1)/etc/init.d/nocatauth-gateway
+endef
+
+define Package/nocatauth/conffiles
+/etc/nocat.conf
+endef
+
+$(eval $(call BuildPackage,nocatauth))
diff --git a/net/nocatauth/files/nocatauth-gateway b/net/nocatauth/files/nocatauth-gateway
new file mode 100755 (executable)
index 0000000..ec4c07e
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009 OpenWrt.org
+
+START=90
+GATEWAY=/usr/nocatauth/bin/gateway
+CONF=/etc/nocat.conf
+
+start() {
+       $GATEWAY -f $CONF
+}
+
+stop() {
+       killall gateway
+}
diff --git a/net/nocatauth/patches/001-ptp-local.patch b/net/nocatauth/patches/001-ptp-local.patch
new file mode 100644 (file)
index 0000000..ce5dd50
--- /dev/null
@@ -0,0 +1,56 @@
+diff -ru NoCatAuth-nightly/bin/detect-fw.sh NoCatAuth-patched/bin/detect-fw.sh
+--- NoCatAuth-nightly/bin/detect-fw.sh 2002-08-08 23:28:43.000000000 -0700
++++ NoCatAuth-patched/bin/detect-fw.sh 2009-03-18 15:03:00.000000000 -0700
+@@ -9,8 +9,7 @@
+ # Do we have iptables *and* are running Linux 2.4?
+ #
+-elif which iptables >/dev/null 2>&1 && \
+-  test X"`uname -sr | cut -d. -f-2`" = X"Linux 2.4"; then
++elif which iptables >/dev/null 2>&1 ; then
+     FIREWALL=iptables
+     FW_BIN=iptables
+diff -ru NoCatAuth-nightly/bin/gateway NoCatAuth-patched/bin/gateway
+--- NoCatAuth-nightly/bin/gateway      2003-03-07 17:56:51.000000000 -0800
++++ NoCatAuth-patched/bin/gateway      2009-03-19 00:24:05.000000000 -0700
+@@ -7,6 +7,7 @@
+ use lib "$FindBin::Bin/../lib";
+ use NoCat;
+ use strict;
++use sigtrap qw(stack-trace untrapped error-signals);
+ # Gracefully handle termination signals.
+ $SIG{INT} = sub { exit };
+diff -ru NoCatAuth-nightly/lib/NoCat/Gateway.pm NoCatAuth-patched/lib/NoCat/Gateway.pm
+--- NoCatAuth-nightly/lib/NoCat/Gateway.pm     2003-07-30 22:22:22.000000000 -0700
++++ NoCatAuth-patched/lib/NoCat/Gateway.pm     2009-03-19 00:22:09.000000000 -0700
+@@ -90,13 +90,12 @@
+ sub run {
+     my $self  = shift;
+-    my $kids  = 0;
+     my $hup = 0;
+     
+     return unless $self->bind_socket;
+     local $SIG{PIPE} = "IGNORE"; 
+-    local $SIG{CHLD} = sub { $kids++ };
++    local $SIG{CHLD} = "IGNORE";
+     local $SIG{HUP} = sub { $hup++ };
+     # Reset history.
+@@ -134,13 +133,6 @@
+             $self->log( 6, "HUP received, resetting log file." );
+             $hup = 0;
+         }
+-
+-      # See if any kids have expired, reap zombies
+-      if ( $kids ) {
+-          1 until ( wait == -1 );
+-          $kids = 0;
+-      }
+-
+     } # loop forever
+ }
diff --git a/net/nocatauth/patches/002-openwrt.patch b/net/nocatauth/patches/002-openwrt.patch
new file mode 100644 (file)
index 0000000..f6c3ed3
--- /dev/null
@@ -0,0 +1,30 @@
+diff -ur NoCatAuth-nightly/gateway.conf NoCatAuth-patched/gateway.conf
+--- NoCatAuth-nightly/gateway.conf     2003-02-10 17:59:09.000000000 -0800
++++ NoCatAuth-patched/gateway.conf     2009-03-19 01:20:42.000000000 -0700
+@@ -46,7 +46,7 @@
+ ##
+ # GatewayLog -- Optional.  If unset, messages will go to STDERR.
+ #
+-GatewayLog    /usr/local/nocat/nocat.log
++GatewayLog    /var/log/nocat.log
+ ##
+ # LoginTimeout - Number of seconds after a client's last
+@@ -79,7 +79,7 @@
+ # DocumentRoot -- Where all of the application templates (including
+ #   SplashPage) are hiding. Can be different from Apache's DocumentRoot.
+ #
+-DocumentRoot  /usr/local/nocat/htdocs
++DocumentRoot  /www
+ # SplashForm -- Form displayed to users on capture.
+ #
+@@ -289,7 +289,7 @@
+ #   the bin/ parent directory. Set this only if you put it
+ #   somewhere that NoCat doesn't expect.
+ #
+-# PGPKeyPath  /usr/local/nocat/pgp
++# PGPKeyPath  /usr/lib/nocatauth/pgp
+ ##
+ # MessageVerify -- Shell command to verify a PGP signed
diff --git a/net/nocatauth/patches/003-fix-module-loading b/net/nocatauth/patches/003-fix-module-loading
new file mode 100644 (file)
index 0000000..9f12172
--- /dev/null
@@ -0,0 +1,31 @@
+diff -ru NoCatAuth-nightly/libexec/iptables/initialize.fw NoCatAuth-patched/libexec/iptables/initialize.fw
+--- NoCatAuth-nightly/libexec/iptables/initialize.fw   2003-03-26 19:21:04.000000000 -0800
++++ NoCatAuth-patched/libexec/iptables/initialize.fw   2009-03-19 19:24:31.000000000 -0700
+@@ -26,18 +26,6 @@
+     #
+     echo "1" > /proc/sys/net/ipv4/ip_forward
+     echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter
+-
+-    # Load alllll the kernel modules we need.
+-    #
+-    rmmod ipchains > /dev/null 2>&1 # for RH 7.1 users.
+-
+-    for module in ip_tables ipt_REDIRECT ipt_MASQUERADE ipt_MARK ipt_REJECT  \
+-      ipt_TOS ipt_LOG iptable_mangle iptable_filter iptable_nat ip_nat_ftp \
+-      ip_conntrack ip_conntrack_ftp ip_conntrack_irc \
+-      ip_nat_irc ipt_mac ipt_state ipt_mark; do
+-
+-      modprobe $module
+-    done
+ fi
+ # Flush all user-defined chains
+@@ -241,6 +229,8 @@
+ # Add any other local firewall rules below.
+ ##
++iptables -t nat -I POSTROUTING -o $ExternalDevice -j MASQUERADE
++
+ ##
+ # Uncomment the following to permit all 10/8 traffic *before* auth
+ ##
diff --git a/net/nocatauth/patches/004-fw_detect.patch b/net/nocatauth/patches/004-fw_detect.patch
new file mode 100644 (file)
index 0000000..18bb971
--- /dev/null
@@ -0,0 +1,55 @@
+diff -urN NoCatAuth-nightly/bin/detect-fw.sh NoCatAuth-nightly.new/bin/detect-fw.sh
+--- NoCatAuth-nightly/bin/detect-fw.sh 2010-03-27 17:44:01.000000000 +0100
++++ NoCatAuth-nightly.new/bin/detect-fw.sh     2010-03-27 17:44:39.000000000 +0100
+@@ -6,47 +6,12 @@
+ if [ -n "$1" -a -n "$2" -a -d "$2/$1" ]; then
+     FIREWALL=$1
+     shift
+-
+-# Do we have iptables *and* are running Linux 2.4?
+-#
+-elif which iptables >/dev/null 2>&1 ; then
+-    FIREWALL=iptables
+-    FW_BIN=iptables
+-
+-#
+-# Or do we have ipchains?
+-#
+-elif which ipchains >/dev/null 2>&1; then
+-    FIREWALL=ipchains
+-    FW_BIN=ipchains
+-
+-#
+-# Or ip_filter (e.g. *BSD, Solaris, HP-UX, etc)?
+-# <http://www.ipfilter.org/>
+-#
+-elif which ipf >/dev/null 2>&1; then
+-ipf_running="`ipf -V | grep 'Running' | awk '{print $2}'`";
+-    if [ "$ipf_running" = "yes" ]; then
+-      FIREWALL="ipfilter"
+-      FW_BIN=ipf
+-    else
+-        echo "ERROR: ip_filter appears to exist, but we're not postive that it's running"
+-      echo "1. You must be root for us to verify this"
+-        echo "2. Check that it's compiled in your kernel (either staticlly or a loaded module)"
+-    fi
+-
+-# Or packetfilter (OpenBSD 3.0+)
+-elif which pfctl >/dev/null 2>&1; then
+-    FIREWALL=pf
+-    FW_BIN=pfctl
+-
+-else
+-    echo "No supported firewalls detected! Check your path."
+-    echo "Supported firewalls include: iptables, ipchains, ipf, pf."
+-    exit 1
+ fi
+-echo $(which $FW_BIN) found.
++FIREWALL=iptables
++FW_BIN=iptables
++
++echo $FW_BIN found.
+ # Remove the existing *.fw links in /usr/local/nocat/bin (or wherever this is being run from)
+ TARGET=$1
diff --git a/net/nocatsplash/Makefile b/net/nocatsplash/Makefile
new file mode 100644 (file)
index 0000000..c63fdca
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2006-2009 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:=nocatsplash
+PKG_VERSION:=0.93pre2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=NoCatSplash-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nocat.net/downloads/NoCatSplash/
+PKG_MD5SUM:=b0aa5cc33a3bbdd8e65726ff3cfe3cd1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/NoCatSplash-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nocatsplash
+  SUBMENU:=Captive Portals
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+glib1 +iptables-mod-ipopt +iptables-mod-nat-extra
+  TITLE:=Open public network gateway daemon
+  URL:=http://nocat.net
+endef
+
+define Package/nocatsplash/description
+       NoCatSplash is an Open Public Network Gateway Daemon.
+       It performs as a [captive/open/active] portal. When run on a gateway/router
+       on a network, all web requests are redirected until the client either logs
+       in or clicks "I Accept" to an AUP. The gateway daemon then changes the
+       firewall rules on the gateway to pass traffic for that client (based on IP
+       address and MAC address).
+endef
+
+define Package/nocatsplash/conffiles
+/etc/nocat.conf
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-firewall=iptables \
+               --with-glib-prefix="$(STAGING_DIR)/usr" \
+       )
+endef
+
+define Package/nocatsplash/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+$(eval $(call BuildPackage,nocatsplash))
diff --git a/net/nocatsplash/patches/001-openwrt_firewall.patch b/net/nocatsplash/patches/001-openwrt_firewall.patch
new file mode 100644 (file)
index 0000000..a6f7129
--- /dev/null
@@ -0,0 +1,19 @@
+diff -urN NoCatSplash-0.92.old/libexec/iptables/initialize.fw NoCatSplash-0.92/libexec/iptables/initialize.fw
+--- NoCatSplash-0.92.old/libexec/iptables/initialize.fw        2002-12-27 11:44:41.000000000 +0100
++++ NoCatSplash-0.92/libexec/iptables/initialize.fw    2005-04-04 20:45:57.000000000 +0200
+@@ -28,13 +28,9 @@
+ # Load alllll the kernel modules we need.
+ #
+-rmmod ipchains > /dev/null 2>&1 # for RH 7.1 users.
+-for module in ip_tables ipt_REDIRECT ipt_MASQUERADE ipt_MARK ipt_REJECT  \
+-    ipt_TOS ipt_LOG iptable_mangle iptable_filter iptable_nat ip_nat_ftp \
+-    ip_conntrack ipt_mac ipt_state ipt_mark; do
+-
+-    modprobe $module
++for module in ipt_TOS ipt_mac ipt_REDIRECT; do
++    insmod $module
+ done
diff --git a/net/nprobe/Makefile b/net/nprobe/Makefile
new file mode 100644 (file)
index 0000000..400bc9b
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2010 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:=nprobe
+PKG_VERSION:=4.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=nProbe-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
+PKG_MD5SUM:=32ed12f60eab771a79bd5f90622fa2a3
+
+BUILD_DEPENDS:=libwrap
+PKG_FIXUP:=autoreconf
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/nProbe
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nprobe
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpcap +libpcre +libpthread +NPROBE_MYSQL_SUPPORT:libmysqlclient +zlib
+  TITLE:=nProbe
+  URL:=http://invisible-island.net/dialog/
+endef
+
+define Package/nprobe/config
+       config NPROBE_MYSQL_SUPPORT
+               depends on PACKAGE_nprobe
+               bool "MySQL support"
+
+endef
+
+define Package/nprobe/description
+               nprobe
+endef
+
+ifndef CONFIG_NPROBE_MYSQL_SUPPORT
+  CONFIGURE_VARS += ac_cv_prog_MYSQL=no
+endif
+
+define Build/Configure
+       # patch creates these, so we make them executable
+       chmod +x $(PKG_BUILD_DIR)/configure
+       chmod +x $(PKG_BUILD_DIR)/config.guess
+       $(call Build/Configure/Default, \
+               --with-only-ipv4 \
+               PCAP_ROOT="$(STAGING_DIR)/usr" \
+       )
+endef
+
+define Build/Compile
+       DESTDIR=$(PKG_INSTALL_DIR) \
+               LDFLAGS="$(TARGET_LDFLAGS) -ldl" \
+               $(MAKE) -C $(PKG_BUILD_DIR) \
+               all install
+endef
+
+define Package/nprobe/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nprobe \
+               $(1)/usr/bin/
+       $(CP) -a $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+               $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,nprobe))
+
diff --git a/net/nprobe/patches/001-automake-compat.patch b/net/nprobe/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..4360b70
--- /dev/null
@@ -0,0 +1,46 @@
+--- /dev/null
++++ b/acinclude.m4
+@@ -0,0 +1 @@
++sinclude(acinclude.m4.in)
+--- a/acinclude.m4.in
++++ b/acinclude.m4.in
+@@ -120,7 +120,7 @@ else
+     esac
+ fi
+ msg="enabled"
+-AC_DEFINE(DEBUG)
++AC_DEFINE([DEBUG], [], [Enable debugging])
+ ],[
+ if test ".$ac_cv_prog_gcc" = ".yes"; then
+ case "$CFLAGS" in
+--- a/configure.in
++++ b/configure.in
+@@ -13,18 +13,16 @@ AC_REVISION([1.0])
+ dnl> acconfig.h is deprecated 
+-AH_TEMPLATE([ HAVE_UINT64_T ],)
+-AH_TEMPLATE([ HAVE_U_INT64_T ],)
+-AH_TEMPLATE([ HAVE_U_INT32_T ],)
+-AH_TEMPLATE([ HAVE_U_INT16_T ],)
+-AH_TEMPLATE([ HAVE_U_INT8_T ],)
+-AH_TEMPLATE([ HAVE_INT64_T ],)
+-AH_TEMPLATE([ HAVE_INT32_T ],)
+-AH_TEMPLATE([ HAVE_INT16_T ],)
+-AH_TEMPLATE([ HAVE_INT8_T ],)
+-AH_TEMPLATE([ u_int],)
+-AH_TEMPLATE([ HAVE_ZLIB ], [ Define if you have zlib ])
+-AH_TEMPLATE([ DEBUG ], [ Define if you want a debugging version.])
++AC_DEFINE([HAVE_UINT64_T], [], [Define if you have uint64_t])
++AC_DEFINE([HAVE_U_INT64_T], [], [Define if you have u_int64_t])
++AC_DEFINE([HAVE_U_INT32_T], [], [Define if you have u_int32_t])
++AC_DEFINE([HAVE_U_INT16_T], [], [Define if you have u_int16_t])
++AC_DEFINE([HAVE_U_INT8_T], [], [Define if you have u_int8_t])
++AC_DEFINE([HAVE_INT64_T], [], [Define if you have int64_t])
++AC_DEFINE([HAVE_INT32_T], [], [Define if you have int32_t])
++AC_DEFINE([HAVE_INT16_T], [], [Define if you have int16_t])
++AC_DEFINE([HAVE_INT8_T], [], [Define if you have int8_t])
++AC_DEFINE([HAVE_ZLIB], [], [Define if you have zlib])
+ echo
+ echo "Welcome to $PACKAGE_NAME, Version $PACKAGE_VERSION"
diff --git a/net/nprobe/patches/002-path_to_pcap.patch b/net/nprobe/patches/002-path_to_pcap.patch
new file mode 100644 (file)
index 0000000..7f2c155
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/configure.in
++++ b/configure.in
+@@ -331,8 +331,8 @@ dnl> user defined directory passed as op
+ dnl>
+ if test ".${PCAP_ROOT}" != .; then
+   if test -d $PCAP_ROOT &&
+-     test -r $PCAP_ROOT/libpcap.a &&
+-     test -r $PCAP_ROOT/pcap.h; then
++     test -r $PCAP_ROOT/lib/libpcap.a &&
++     test -r $PCAP_ROOT/include/pcap.h; then
+        PCAP_ROOT=`cd ${PCAP_ROOT} && pwd`
+        CORELIBS="${CORELIBS} -L$PCAP_ROOT -lpcap"
+        INCS="${INCS} -I$PCAP_ROOT"
diff --git a/net/nprobe/patches/003-ipv6_fix.patch b/net/nprobe/patches/003-ipv6_fix.patch
new file mode 100644 (file)
index 0000000..689487b
--- /dev/null
@@ -0,0 +1,35 @@
+--- a/nprobe.c
++++ b/nprobe.c
+@@ -241,8 +241,10 @@ void processPacket(u_char *_deviceId,
+   u_short eth_type, off=0, numPkts = 1;
+   u_int8_t flags = 0, proto = 0;
+   struct ip ip;
++  #ifndef IPV4_ONLY
+   struct ip6_hdr ipv6;
+   struct ip6_ext ipv6ext;
++  #endif
+   struct tcphdr tp;
+   struct udphdr up;
+   struct icmp icmpPkt;
+@@ -362,7 +364,9 @@ void processPacket(u_char *_deviceId,
+       isFragment = (ntohs(ip.ip_off) & 0x3fff) ? 1 : 0;
+       off = ntohs(ip.ip_off);
+-      } else if(eth_type == ETHERTYPE_IPV6) {
++      } 
++      #ifndef IPV4_ONLY
++      else if(eth_type == ETHERTYPE_IPV6) {
+       memcpy(&ipv6, p+ehshift, sizeof(struct ip6_hdr));
+       if(((ipv6.ip6_vfc >> 4) & 0x0f) != 6) return; /* IP v6 only */
+       estimatedLen = sizeof(struct ip6_hdr)+ehshift+htons(ipv6.ip6_plen);
+@@ -392,7 +396,9 @@ void processPacket(u_char *_deviceId,
+         hlen += (ipv6ext.ip6e_len+1)*8;
+         proto = ipv6ext.ip6e_nxt;
+       }
+-      } else
++      } 
++     #endif //IPV4_ONLY
++      else
+       return; /* Anything else that's not IPv4/v6 */
+       plen = length-ehshift;
diff --git a/net/nstx/Makefile b/net/nstx/Makefile
new file mode 100644 (file)
index 0000000..b6d52b5
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2006 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:=nstx
+PKG_VERSION:=1.1-beta6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/n/nstx/
+PKG_MD5SUM:=275abd75a856b07a798b1f2360088cf5
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nstx/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall Tunnel
+  TITLE:=allows you to pass IP packets via DNS queries
+  URL:=http://savannah.nongnu.org/projects/nstx/
+endef
+
+define Package/nstx
+  $(call Package/nstx/Default)
+  TITLE+= client version
+endef
+
+define Package/nstx/description
+       nstx client version
+endef
+
+define Package/nstxd
+  $(call Package/nstx/Default)
+  TITLE+= server version
+endef
+
+define Package/nstxd/description
+       nstx server version
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/nstx/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nstxcd $(1)/usr/sbin/
+endef
+
+define Package/nstxd/install
+       $(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nstxd $(1)/usr/sbin
+endef
+
+$(eval $(call BuildPackage,nstx))
+$(eval $(call BuildPackage,nstxd))
diff --git a/net/nstx/patches/001-debian_changes.patch b/net/nstx/patches/001-debian_changes.patch
new file mode 100644 (file)
index 0000000..df31962
--- /dev/null
@@ -0,0 +1,382 @@
+diff -urN nstx-1.1-beta6/Makefile nstx-1.1-beta6.new/Makefile
+--- nstx-1.1-beta6/Makefile    2004-06-27 23:46:38.000000000 +0200
++++ nstx-1.1-beta6.new/Makefile        2006-12-24 12:15:23.000000000 +0100
+@@ -1,4 +1,4 @@
+-CFLAGS += -ggdb -Wall -Werror
++CFLAGS += -ggdb -Wall -Werror -Wsign-compare 
+ NSTXD_SRCS = nstxd.c nstx_encode.c nstx_pstack.c nstx_dns.c nstx_tuntap.c nstx_queue.c
+ NSTXD_OBJS = ${NSTXD_SRCS:.c=.o}
+diff -urN nstx-1.1-beta6/nstx_dns.c nstx-1.1-beta6.new/nstx_dns.c
+--- nstx-1.1-beta6/nstx_dns.c  2004-06-27 23:43:34.000000000 +0200
++++ nstx-1.1-beta6.new/nstx_dns.c      2006-12-24 12:15:23.000000000 +0100
+@@ -6,6 +6,7 @@
+ #include <fcntl.h>
+ #include <syslog.h>
+ #include <unistd.h>
++#include <assert.h>
+ #include "nstxfun.h"
+ #include "nstxdns.h"
+@@ -58,7 +59,7 @@
+  * DNS-packet 'msg'. */
+ static char *
+-decompress_label(const char *msg, int msglen, const char *lbl)
++decompress_label(const char *msg, unsigned int msglen, const char *lbl)
+ {
+    const char *ptr = lbl;
+    char *buf;
+@@ -69,7 +70,7 @@
+    
+    while ((chunklen = *ptr)) {
+       if (chunklen > 63) {
+-       if ((ptr-msg) >= (msglen-1)) {
++       if ((ptr-msg) >= ((signed int)msglen-1)) {
+           DEBUG("Bad pointer at end of msg");
+           if (buf)
+             free(buf);
+@@ -104,13 +105,15 @@
+        ptr += chunklen + 1;
+       }
+    }
+-   buf[buflen] = 0;
+-   buflen++;
++   if (buf) {
++     buf[buflen] = 0;
++     buflen++;
++   }
+    return buf;
+ }
+ static const unsigned char *
+-_cstringify(const unsigned char *data, int *dlen, int clen)
++_cstringify(const unsigned char *data, int *dlen, unsigned int clen)
+ {
+    static unsigned char *buf;
+    
+@@ -143,7 +146,7 @@
+ {
+    int len;
+    
+-   len = strlen(data);
++   len = strlen((char*)data);
+    return _cstringify(data, &len, 63);
+ }
+@@ -183,24 +186,24 @@
+ static const unsigned char *
+ lbl2data (const unsigned char *data, size_t len)
+ {
+-   static unsigned char *buf;
+-   
++   static signed char *buf = NULL;
+    const unsigned char *s = data;
+-   unsigned char *d;
+-   unsigned int llen;
++   signed char *d;
++   signed int llen;
+    
+    d = buf = realloc(buf, len);
++   assert(d);
+    do
+      {
+       llen = *s++;
+-      if ((llen > 63) || (llen > len - (s - data)))
+-        return NULL;
++      if ((llen > 63) || (llen > (signed int)(len - (s - data))))
++        break;
+       memcpy(d, s, llen);
+       s += llen;
+       d += llen;
+      } while (llen);
+    *d = '\0';
+-   return buf;
++   return (const unsigned char*)buf;
+ }
+ /* New DNS-Code */
+@@ -318,7 +321,7 @@
+    const char *ptr;
+    static char *fqdn;
+    
+-   ptr = data2lbl(data);
++   ptr = (char*)data2lbl((unsigned char*)data);
+    fqdn = realloc(fqdn, strlen(ptr)+strlen(suffix)+1);
+    strcpy(fqdn, ptr);
+    strcat(fqdn, suffix);
+@@ -336,8 +339,9 @@
+      free(buf);
+    
+    off = strstr(fqdn, suffix);
+-   if (off)
+-      buf = strdup(lbl2data(fqdn, off - fqdn));
++   /* only parse if the fqdn was found, and there is more than the fqdn */
++   if (off && off != fqdn)
++      buf = strdup((char*)lbl2data((unsigned char*)fqdn, off - fqdn));
+    else
+       /* Our suffix not found... */
+       buf = NULL; 
+@@ -364,7 +368,7 @@
+    const char *ptr;
+    char *buf;
+    
+-   ptr = data2txt(data, &len);
++   ptr = (char*)data2txt((unsigned char*)data, &len);
+    buf = malloc(len);
+    memcpy(buf, ptr, len);
+    
+@@ -477,7 +481,7 @@
+      {
+       offsets[i++] = ptr - buf;
+       rrp = _new_listitem(&pkt->query);
+-      rrp->data = decompress_label(buf, len, ptr);
++      rrp->data = decompress_label((char*)buf, len, (char*)ptr);
+       if (!rrp->data)
+         {
+            syslog(LOG_ERR, "dns_extractpkt: decompress_label choked in qd\n");
+@@ -517,8 +521,9 @@
+            if (j < i)
+              rrp->link = j;
+         }
+-      ptr = _skip_lbl(ptr, &remain);
+-      rrp->len = ptr[8]*256+ptr[9];
++      //      ptr = _skip_lbl(ptr, &remain);
++      //      rrp->len = ptr[8]*256+ptr[9];
++      rrp->len = ptr[10]*256+ptr[11];
+       ptr += 12;
+       remain -= 12;
+       if (remain < rrp->len)
+diff -urN nstx-1.1-beta6/nstx_encode.c nstx-1.1-beta6.new/nstx_encode.c
+--- nstx-1.1-beta6/nstx_encode.c       2004-06-27 23:43:34.000000000 +0200
++++ nstx-1.1-beta6.new/nstx_encode.c   2006-12-24 12:15:23.000000000 +0100
+@@ -30,11 +30,11 @@
+ void init_revmap (void)
+ {
+-   int i;
++   unsigned int i;
+    
+    revmap = malloc(256);
+    
+-   for (i = 0; i < strlen(map); i++)
++   for (i = 0; i < strlen((char*)map); i++)
+      revmap[map[i]] = i;
+ }
+    
+@@ -70,11 +70,11 @@
+    if (!revmap)
+      init_revmap();
+    
+-   len = strlen(data)-1;
+-   
++   len = strlen((char*)data);
++
+    buf = realloc(buf, ((len+3)/4)*3);
+    
+-   while (off < len) {
++   while (off+3 < len) {
+       buf[i+0] = (revmap[data[off]]<<2)|((revmap[data[off+1]]&48)>>4);
+       buf[i+1] = ((revmap[data[off+1]]&15)<<4)|((revmap[data[off+2]]&60)>>2);
+       buf[i+2] = ((revmap[data[off+2]]&3)<<6)|(revmap[data[off+3]]);
+diff -urN nstx-1.1-beta6/nstx_pstack.c nstx-1.1-beta6.new/nstx_pstack.c
+--- nstx-1.1-beta6/nstx_pstack.c       2004-06-27 23:43:34.000000000 +0200
++++ nstx-1.1-beta6.new/nstx_pstack.c   2006-12-24 12:15:23.000000000 +0100
+@@ -49,7 +49,7 @@
+    char *netpacket;
+    int netpacketlen;
+    
+-   if ((!ptr) || len < sizeof(struct nstxhdr))
++   if ((!ptr) || (signed int) len < (signed int) sizeof(struct nstxhdr))
+      return;
+    if (!nstxpkt->id)
+diff -urN nstx-1.1-beta6/nstx_tuntap.c nstx-1.1-beta6.new/nstx_tuntap.c
+--- nstx-1.1-beta6/nstx_tuntap.c       2004-06-27 23:43:34.000000000 +0200
++++ nstx-1.1-beta6.new/nstx_tuntap.c   2006-12-24 12:15:23.000000000 +0100
+@@ -215,7 +215,7 @@
+ struct nstxmsg *nstx_select (int timeout)
+ {
+-   int peerlen;
++   unsigned peerlen;
+    fd_set set;
+    struct timeval tv;
+    static struct nstxmsg *ret = NULL;
+diff -urN nstx-1.1-beta6/nstxcd.8 nstx-1.1-beta6.new/nstxcd.8
+--- nstx-1.1-beta6/nstxcd.8    1970-01-01 01:00:00.000000000 +0100
++++ nstx-1.1-beta6.new/nstxcd.8        2006-12-24 12:15:23.000000000 +0100
+@@ -0,0 +1,36 @@
++.TH NSTXCD "8" "May 2004" "nstx 1.1-beta4" "User Commands"
++.SH NAME
++nstxcd \- IP over DNS tunneling client
++
++.SH SYNOPSIS
++.B "nstxcd \fIDOMAIN\fR \fIIPADDRESS\fR"
++
++.SH DESCRIPTION
++.B nstxcd
++tunnels IP packets over DNS, allowing them to be sent to a server without
++any protocols other than DNS being used.
++
++.SH OPTIONS
++.B nstxcd
++takes the following options:
++.IP "domain"
++The domain that nstxcd will send requests to. This domain must be delegated
++to a machine that is running nstxd.
++.IP "IP address"
++The IP address of a DNS server that can be reached from the current machine.
++
++.SH USAGE
++.Bnstxcd
++should be run against a domain that has been delegated to a machine running
++nstxd. It will then take any packets that are sent to the tun0 interface and
++send them over DNS to the other tunnel endpoint. Responses will appear on 
++the tun0 interface.
++
++.SH AUTHORS
++
++.IP 
++Florian Heinz <sky@sysv.de>
++.IP 
++Julien Oster <frodo@sysv.de>
++.IP 
++http://nstx.dereference.de/nstx/
+diff -urN nstx-1.1-beta6/nstxcd.c nstx-1.1-beta6.new/nstxcd.c
+--- nstx-1.1-beta6/nstxcd.c    2004-06-27 23:43:34.000000000 +0200
++++ nstx-1.1-beta6.new/nstxcd.c        2006-12-24 12:15:23.000000000 +0100
+@@ -63,7 +63,7 @@
+ int main (int argc, char * argv[]) {
+   struct nstxmsg *msg;
+   const char  *device = NULL;
+-  char                 ch;
++  int                  ch;
+   nsid = time(NULL);
+  
+@@ -110,11 +110,11 @@
+    const char *data;
+    int datalen;
+    
+-   pkt = dns_extractpkt (reply, len);
++   pkt = dns_extractpkt ((unsigned char*)reply, len);
+    if (!pkt)
+      return;
+    while ((data = dns_getanswerdata(pkt, &datalen))) {
+-      data = txt2data(data, &datalen);
++      data = (char*)txt2data((unsigned char*)data, &datalen);
+       nstx_handlepacket (data, datalen, &sendtun);
+    }
+    dequeueitem(pkt->id);
+@@ -159,9 +159,9 @@
+     data += l;
+     datalen -= l;
+     
+-    dns_addquery(pkt, dns_data2fqdn(nstx_encode(p, sizeof(nh)+l)));
++    dns_addquery(pkt, dns_data2fqdn(nstx_encode((unsigned char*)p, sizeof(nh)+l)));
+     free(p);
+-    p = dns_constructpacket(pkt, &l);
++    p = (char*)dns_constructpacket(pkt, &l);
+     sendns(p, l, NULL);
+     free(p);
+diff -urN nstx-1.1-beta6/nstxd.8 nstx-1.1-beta6.new/nstxd.8
+--- nstx-1.1-beta6/nstxd.8     1970-01-01 01:00:00.000000000 +0100
++++ nstx-1.1-beta6.new/nstxd.8 2006-12-24 12:15:23.000000000 +0100
+@@ -0,0 +1,47 @@
++.TH NSTXD "7" "Mar 2005" "nstx 1.1-beta6" "User Commands"
++.SH NAME
++nstxd \- IP over DNS tunneling daemon
++
++.SH SYNOPSIS
++.B "nstxd \fIOPTION\fR \fIDOMAIN\fR"
++
++.SH DESCRIPTION
++.B nstxd
++listens for well formed DNS requests and translates them into IP packets.
++Responses are sent in the form of DNS replies. This allows clients to
++tunnel IP packets over the DNS protocol.
++
++.SH OPTIONS
++.B nstxd
++takes the following option:
++.IP \-d tun-device
++Use this tun device instead of tun0
++.IP \-i ipaddr
++Bind to this IP address rather than every available address
++.IP \-C dir
++Chroot to this directory on startup
++.IP \-D
++Daemonize on startup
++.IP \-g
++Switch on debug messages
++.IP \-u user
++Run as the following user
++.IP "domain"
++The domain that nstxd will listen to requests for. This should be a domain
++that is delegated to the machine running nstxd.
++
++.SH USAGE
++A domain should be delegated to the machine that will run nstxd. nstxd should
++then be run giving that domain as the only argument. nstxd will then listen
++for requests and translate them into IP packets that will appear on the tun0
++interface. Packets sent to the tun0 interface will be transferred back to
++the client as DNS answers.
++
++.SH AUTHORS
++
++.IP 
++Florian Heinz <sky@sysv.de>
++.IP 
++Julien Oster <frodo@sysv.de>
++.IP 
++http://nstx.dereference.de/nstx/
+diff -urN nstx-1.1-beta6/nstxd.c nstx-1.1-beta6.new/nstxd.c
+--- nstx-1.1-beta6/nstxd.c     2004-06-27 23:55:17.000000000 +0200
++++ nstx-1.1-beta6.new/nstxd.c 2006-12-24 12:15:23.000000000 +0100
+@@ -67,7 +67,7 @@
+ }
+ int main (int argc, char *argv[]) {
+-   char                ch;
++   signed char         ch;
+    const char *device = NULL, *dir = NULL;
+    in_addr_t   bindto = INADDR_ANY;
+    uid_t       uid = 0;
+@@ -172,7 +172,7 @@
+    dns_setid(pkt, q->id);
+    dns_settype(pkt, DNS_RESPONSE);
+    dns_addanswer(pkt, "\xb4\x00\x00\x00", 4, dns_addquery(pkt, q->name));
+-   buf = dns_constructpacket (pkt, &len);
++   buf = (char*)dns_constructpacket (pkt, &len);
+    sendns(buf, len, &q->peer);
+    free(buf);
+ }  
+@@ -188,7 +188,7 @@
+    
+    if (msg) {
+      if (msg->src == FROMNS) {
+-      pkt = dns_extractpkt(msg->data, msg->len);
++      pkt = dns_extractpkt((unsigned char*)msg->data, msg->len);
+       if (pkt)
+         {
+            name = dns_getquerydata(pkt);
+@@ -198,7 +198,7 @@
+                       name);
+                 queueitem(pkt->id, name, &msg->peer);
+                 if ((data = dns_fqdn2data(name)) &&
+-                    (buf = nstx_decode(data, &len)))
++                    (buf = nstx_decode((unsigned char*)data, &len)))
+                   {
+                      nstx_handlepacket(buf, len, &sendtun);
+                   }
+@@ -220,7 +220,7 @@
+       len = dns_getfreespace(pkt, DNS_RESPONSE);
+       buf = dequeue_senditem(&len);
+       dns_addanswer(pkt, buf, len, link);
+-      buf = dns_constructpacket(pkt, &len);
++      buf = (char*)dns_constructpacket(pkt, &len);
+       sendns(buf, len, &qitem->peer);
+    }
+    timeoutqueue(do_timeout);
diff --git a/net/ntpclient/Makefile b/net/ntpclient/Makefile
new file mode 100644 (file)
index 0000000..841f3e0
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2010 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:=ntpclient
+PKG_VERSION:=2007_365
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://doolittle.icarus.com/ntpclient/
+PKG_MD5SUM:=cb98711f11769cdd22fc592844cef414
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-2007
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ntpclient
+  SUBMENU:=Time Synchronization
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=NTP (Network Time Protocol) client
+  URL:=http://doolittle.icarus.com/ntpclient/
+  DEPENDS:=+librt
+endef
+
+define Package/ntpclient/description
+       NTP client for setting system time from NTP servers.
+endef
+
+define Package/ntpclient/conffiles
+/etc/config/ntpclient
+endef
+
+MAKE_FLAGS += \
+       all adjtimex
+
+define Package/ntpclient/install
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/ntpclient.hotplug $(1)/etc/hotplug.d/iface/20-ntpclient
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/ntpclient.config $(1)/etc/config/ntpclient
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpclient $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/adjtimex $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rate.awk $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ntpclient))
diff --git a/net/ntpclient/files/ntpclient.config b/net/ntpclient/files/ntpclient.config
new file mode 100644 (file)
index 0000000..10be886
--- /dev/null
@@ -0,0 +1,23 @@
+config ntpserver
+       option hostname '0.openwrt.pool.ntp.org'
+       option port     '123'
+
+config ntpserver
+       option hostname '1.openwrt.pool.ntp.org'
+       option port     '123'
+
+config ntpserver
+       option hostname '2.openwrt.pool.ntp.org'
+       option port     '123'
+
+config ntpserver
+       option hostname '3.openwrt.pool.ntp.org'
+       option port     '123'
+
+config ntpdrift
+       option freq     '0'
+
+config ntpclient
+       option interval 600
+       #option count   10
+       #option interface wan
diff --git a/net/ntpclient/files/ntpclient.hotplug b/net/ntpclient/files/ntpclient.hotplug
new file mode 100644 (file)
index 0000000..536f531
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+
+. /lib/functions.sh
+
+unset SERVER
+unset PORT
+unset INTERVAL
+unset COUNT
+unset INTERFACE_GLOBAL
+
+NTPC=`which ntpclient`
+
+check_server() {
+       local hostname
+       local port
+       local interface
+       [ -n "$SERVER" ] && return
+       config_get hostname $1 hostname
+       config_get port $1 port
+       config_get interface $1 interface
+
+       [ -z "$interface" ] && interface=$INTERFACE_GLOBAL
+
+       [ -n "$interface" ] && {
+               # $INTERFACE is passed from hotplug event
+               [ "$interface" = "$INTERFACE" ] || return
+       }
+
+       [ -z "$hostname" ] && return
+       $NTPC -c 1 -p ${port:-123} -i 2 -h $hostname > /dev/null && { SERVER=$hostname; PORT=${port:-123}; }
+}
+
+set_drift() {
+       config_get freq $1 freq
+       [ -n "$freq" ] && adjtimex -f $freq >/dev/null
+}
+
+start_ntpclient() {
+       config_foreach set_drift ntpdrift
+       config_foreach check_server ntpserver
+       [ -z "$SERVER" ] && exit 0
+       logger starting ntpclient
+       $NTPC ${COUNT:+-c $COUNT} ${INTERVAL:+-i $INTERVAL} -s -l -D -p $PORT -h $SERVER 2> /dev/null
+}
+
+stop_ntpclient() {
+       logger stopping ntpclient
+       killall ntpclient
+}
+
+load_settings() {
+       local interval
+       local count
+       local iface
+       
+       config_get interval $1 interval
+       config_get count $1 count
+       config_get interface $1 interface
+       
+       [ -n "$count" ] && COUNT=$count
+       [ -n "$interval" ] && INTERVAL=$interval
+       [ -n "$interface" ] && INTERFACE_GLOBAL=$interface
+}
+
+config_load ntpclient
+config_foreach load_settings ntpclient
+
+NTP_RUNNING=`ps  | grep $NTPC | grep -v grep`
+
+case "${ACTION:-ifup}" in
+       ifup)
+               [ -z "$NTP_RUNNING" ] && start_ntpclient 
+       ;;
+       ifdown)
+               [ -n "$NTP_RUNNING" ] && stop_ntpclient 
+       ;;
+esac
diff --git a/net/ntpclient/patches/100-daemon.patch b/net/ntpclient/patches/100-daemon.patch
new file mode 100644 (file)
index 0000000..0ff8d5e
--- /dev/null
@@ -0,0 +1,24 @@
+Index: ntpclient-2007/ntpclient.c
+===================================================================
+--- ntpclient-2007.orig/ntpclient.c    2008-08-12 03:11:34.000000000 +0200
++++ ntpclient-2007/ntpclient.c 2008-08-12 03:11:36.000000000 +0200
+@@ -614,7 +614,7 @@
+       ntpc.cross_check=1;
+       for (;;) {
+-              c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "st");
++              c = getopt( argc, argv, "c:" DEBUG_OPTION "f:g:h:i:lp:q:" REPLAY_OPTION "stD");
+               if (c == EOF) break;
+               switch (c) {
+                       case 'c':
+@@ -663,6 +663,10 @@
+                               (ntpc.cross_check)=0;
+                               break;
++                      case 'D':
++                              daemon();
++                              break;
++
+                       default:
+                               usage(argv[0]);
+                               exit(1);
diff --git a/net/ntripcaster/Makefile b/net/ntripcaster/Makefile
new file mode 100644 (file)
index 0000000..27e1d37
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2011 segal.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ntripcaster
+PKG_VERSION:=0.1.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).zip
+PKG_SOURCE_URL:=http://igs.bkg.bund.de/root_ftp/NTRIP/software/
+PKG_MD5SUM:=8c85a6c31d8c5cdf2638fe103207a1fd
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ntripcaster
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=NTRIP
+  TITLE:=Standard Ntrip Broadcaster
+  URL:=http://igs.bkg.bund.de/ntrip/download
+  DEPENDS:=+libpthread
+endef
+
+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/
+endef
+
+$(eval $(call BuildPackage,ntripcaster))
diff --git a/net/ntripclient/Makefile b/net/ntripclient/Makefile
new file mode 100644 (file)
index 0000000..25ab46e
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2011 segal.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ntripclient
+PKG_VERSION:=1.5.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME).zip
+PKG_SOURCE_URL:=http://igs.bkg.bund.de/root_ftp/NTRIP/software/
+PKG_MD5SUM:=4b357fa648d74e4e13c4b5a2a39f5624
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ntripclient
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=NTRIP
+  TITLE:=Ntrip Version 2.0 Command Line Client
+  URL:=http://igs.bkg.bund.de/ntrip/download
+endef
+
+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)"
+
+define Package/ntripclient/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntripclient $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ntripclient))
diff --git a/net/ntripserver/Makefile b/net/ntripserver/Makefile
new file mode 100644 (file)
index 0000000..4c2f6d9
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2011 segal.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ntripserver
+PKG_VERSION:=1.5.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME).zip
+PKG_SOURCE_URL:=http://igs.bkg.bund.de/root_ftp/NTRIP/software/
+PKG_MD5SUM:=cecff5da0173896df041bd889935fc12
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ntripserver
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=NTRIP
+  TITLE:=Ntrip Version 2.0 Command Line Server
+  URL:=http://igs.bkg.bund.de/ntrip/download
+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
+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/
+endef
+
+$(eval $(call BuildPackage,ntripserver))
diff --git a/net/nufw/Makefile b/net/nufw/Makefile
new file mode 100644 (file)
index 0000000..50da611
--- /dev/null
@@ -0,0 +1,117 @@
+#
+# Copyright (C) 2007-2010 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:=nufw
+PKG_VERSION:=2.2.21
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.nufw.org/download/nufw/
+PKG_MD5SUM:=7eb500e7ddb3db622dc6c5d43b495c9a
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/nufw/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall
+  DEPENDS:=+glib2 +libgnutls +libgcrypt +libsasl2 +libnetfilter-queue $(ICONV_DEPENDS) $(INTL_DEPENDS)
+  TITLE:=nufw
+  URL:=http://www.nufw.org/
+endef
+
+define Package/nufw/description
+  NuFW adds user-based filtering to Netfilter,
+  the state of the art IP filtering layer from
+  the Linux kernel. Its exclusive algorithm allows
+  authenticated filtering even on multiuser computers.
+endef
+
+define Package/nufw
+  $(call Package/nufw/Default)
+endef
+
+define Package/nutcpc
+  $(call Package/nufw/Default)
+  TITLE:=client version
+endef
+
+define Package/nufw-python
+  $(call Package/nufw/Default)
+  TITLE:=python bindings
+endef
+
+define PyPackage/nufw-python/filespec
++|$(PYTHON_PKG_DIR)/nuauth_command/__init__.py
++|$(PYTHON_PKG_DIR)/nuauth_command/client.py
++|$(PYTHON_PKG_DIR)/nuauth_command/command_dec.py
++|$(PYTHON_PKG_DIR)/nuauth_command/version.py
+endef
+
+
+define Package/nufw-modules
+  $(call Package/nufw/Default)
+  TITLE:=NuFW modules
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared \
+       --disable-pam-nufw \
+       --without-system-auth \
+       --with-libgnutls-prefix="$(STAGING_DIR)/usr/" \
+       --with-libgcrypt-prefix="$(STAGING_DIR)/usr/" \
+       --with-libsasl-prefix="$(STAGING_DIR)/usr/"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR) ; test -x ./autogen.sh && ./autogen.sh || true)
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \
+                       -I$(INTL_PREFIX)/include \
+                       -I$(ICONV_PREFIX)/include" \
+               LDFLAGS="$(TARGET_LDFLAGS) \
+                       -L$(INTL_PREFIX)/lib \
+                       -L$(ICONV_PREFIX)/lib \
+                       -Wl,-rpath-link,$(STAGING_DIR)/usr/lib -liconv \
+                       -lgnutls -lnetfilter_queue -lpthread -lgcrypt" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+
+define Package/nufw/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nufw $(1)/usr/sbin/
+endef
+
+define Package/nutcpc/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nutcpc $(1)/usr/bin/  
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnuclient.so* $(1)/usr/lib/
+endef
+
+define Package/nufw-modules/install
+       $(INSTALL_DIR) $(1)/usr/lib/nuauth/modules/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/nuauth/modules/*.so* $(1)/usr/lib/nuauth/modules/
+endef
+
+$(eval $(call BuildPackage,nufw))
+$(eval $(call BuildPackage,nutcpc))
+$(eval $(call BuildPackage,nufw-modules))
+$(eval $(call PyPackage,nufw-python))
+$(eval $(call BuildPackage,nufw-python))
diff --git a/net/nufw/patches/001-no_doc_tests.patch b/net/nufw/patches/001-no_doc_tests.patch
new file mode 100644 (file)
index 0000000..97d4459
--- /dev/null
@@ -0,0 +1,23 @@
+Index: nufw-2.2.21/Makefile.am
+===================================================================
+--- nufw-2.2.21.orig/Makefile.am       2008-11-18 10:12:32.000000000 +0100
++++ nufw-2.2.21/Makefile.am    2009-10-05 20:26:45.000000000 +0200
+@@ -1,4 +1,4 @@
+-SUBDIRS = src scripts doc tests conf python selinux
++SUBDIRS = src scripts conf python selinux
+ PATCH_FILES = patches/dump-connection-mark.diff 
+ EXTRA_DIST = autogen.sh $(PATCH_FILES)
+Index: nufw-2.2.21/Makefile.in
+===================================================================
+--- nufw-2.2.21.orig/Makefile.in       2009-02-03 22:46:54.000000000 +0100
++++ nufw-2.2.21/Makefile.in    2009-10-05 20:27:05.000000000 +0200
+@@ -193,7 +193,7 @@
+ target_alias = @target_alias@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = src scripts doc tests conf python selinux
++SUBDIRS = src scripts conf python selinux
+ PATCH_FILES = patches/dump-connection-mark.diff 
+ EXTRA_DIST = autogen.sh $(PATCH_FILES)
+ all: all-recursive
diff --git a/net/nufw/patches/002-debian_fixes.patch b/net/nufw/patches/002-debian_fixes.patch
new file mode 100644 (file)
index 0000000..7cea0a7
--- /dev/null
@@ -0,0 +1,22788 @@
+--- nufw-2.2.21.orig/aclocal.m4
++++ nufw-2.2.21/aclocal.m4
+@@ -1,4 +1,4 @@
+-# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
++# generated automatically by aclocal 1.10.2 -*- Autoconf -*-
+ # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ # 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+@@ -13,8 +13,8 @@
+ m4_ifndef([AC_AUTOCONF_VERSION],
+   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+-m4_if(AC_AUTOCONF_VERSION, [2.61],,
+-[m4_warning([this file was generated for autoconf 2.61.
++m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
++[m4_warning([this file was generated for autoconf 2.64.
+ You have another version of autoconf.  It may work, but is not guaranteed to.
+ If you have problems, you may need to regenerate the build system entirely.
+ To do so, use the procedure documented by the package, typically `autoreconf'.])])
+@@ -114,8 +114,9 @@
+ {
+   int major, minor, micro;
+   char *tmp_version;
++  int ignored;
+-  system ("touch conf.glibtest");
++  ignored = system ("touch conf.glibtest");
+   /* HP/UX 9 (%@#!) writes to sscanf strings */
+   tmp_version = g_strdup("$min_glib_version");
+@@ -340,167 +341,6 @@
+   AC_SUBST(LIBGCRYPT_LIBS)
+ ])
+-dnl Autoconf macros for libgnutls
+-dnl $id$
+-
+-# Modified for LIBGNUTLS -- nmav
+-# Configure paths for LIBGCRYPT
+-# Shamelessly stolen from the one of XDELTA by Owen Taylor
+-# Werner Koch   99-12-09
+-
+-dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+-dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
+-dnl
+-AC_DEFUN([AM_PATH_LIBGNUTLS],
+-[dnl
+-dnl Get the cflags and libraries from the libgnutls-config script
+-dnl
+-AC_ARG_WITH(libgnutls-prefix,
+-          [  --with-libgnutls-prefix=PFX   Prefix where libgnutls is installed (optional)],
+-          libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
+-
+-  if test x$libgnutls_config_prefix != x ; then
+-     if test x${LIBGNUTLS_CONFIG+set} != xset ; then
+-        LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
+-     fi
+-  fi
+-
+-  AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
+-  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
+-  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
+-  no_libgnutls=""
+-  if test "$LIBGNUTLS_CONFIG" = "no" ; then
+-    no_libgnutls=yes
+-  else
+-    LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
+-    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
+-    libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
+-
+-
+-      ac_save_CFLAGS="$CFLAGS"
+-      ac_save_LIBS="$LIBS"
+-      CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+-      LIBS="$LIBS $LIBGNUTLS_LIBS"
+-dnl
+-dnl Now check if the installed libgnutls is sufficiently new. Also sanity
+-dnl checks the results of libgnutls-config to some extent
+-dnl
+-      rm -f conf.libgnutlstest
+-      AC_TRY_RUN([
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <gnutls/gnutls.h>
+-
+-int
+-main ()
+-{
+-    system ("touch conf.libgnutlstest");
+-
+-    if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
+-    {
+-      printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
+-             "$libgnutls_config_version", gnutls_check_version(NULL) );
+-      printf("*** was found! If libgnutls-config was correct, then it is best\n");
+-      printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
+-      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+-      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+-      printf("*** required on your system.\n");
+-      printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
+-      printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
+-      printf("*** before re-running configure\n");
+-    }
+-    else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
+-    {
+-      printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
+-      printf("*** library (version %s)\n", gnutls_check_version(NULL) );
+-    }
+-    else
+-    {
+-      if ( gnutls_check_version( "$min_libgnutls_version" ) )
+-      {
+-        return 0;
+-      }
+-     else
+-      {
+-        printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
+-                gnutls_check_version(NULL) );
+-        printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
+-               "$min_libgnutls_version" );
+-        printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
+-        printf("*** \n");
+-        printf("*** If you have already installed a sufficiently new version, this error\n");
+-        printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
+-        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+-        printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
+-        printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
+-        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+-        printf("*** so that the correct libraries are found at run-time))\n");
+-      }
+-    }
+-  return 1;
+-}
+-],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+-       CFLAGS="$ac_save_CFLAGS"
+-       LIBS="$ac_save_LIBS"
+-  fi
+-
+-  if test "x$no_libgnutls" = x ; then
+-     AC_MSG_RESULT(yes)
+-     ifelse([$2], , :, [$2])
+-  else
+-     if test -f conf.libgnutlstest ; then
+-        :
+-     else
+-        AC_MSG_RESULT(no)
+-     fi
+-     if test "$LIBGNUTLS_CONFIG" = "no" ; then
+-       echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
+-       echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
+-       echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
+-       echo "*** full path to libgnutls-config."
+-     else
+-       if test -f conf.libgnutlstest ; then
+-        :
+-       else
+-          echo "*** Could not run libgnutls test program, checking why..."
+-          CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+-          LIBS="$LIBS $LIBGNUTLS_LIBS"
+-          AC_TRY_LINK([
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <gnutls/gnutls.h>
+-],      [ return !!gnutls_check_version(NULL); ],
+-        [ echo "*** The test program compiled, but did not run. This usually means"
+-          echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
+-          echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
+-          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+-          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+-          echo "*** is required on your system"
+-          echo "***"
+-          echo "*** If you have an old version installed, it is best to remove it, although"
+-          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+-          echo "***" ],
+-        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+-          echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
+-          echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
+-          echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
+-          CFLAGS="$ac_save_CFLAGS"
+-          LIBS="$ac_save_LIBS"
+-       fi
+-     fi
+-     LIBGNUTLS_CFLAGS=""
+-     LIBGNUTLS_LIBS=""
+-     ifelse([$3], , :, [$3])
+-  fi
+-  rm -f conf.libgnutlstest
+-  AC_SUBST(LIBGNUTLS_CFLAGS)
+-  AC_SUBST(LIBGNUTLS_LIBS)
+-])
+-
+-dnl *-*wedit:notab*-*  Please keep this as the last line.
+-
+ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+ #
+ #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+@@ -877,12 +717,12 @@
+ # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+ # ---------------------------------------------------
+ m4_define([lt_decl_varnames_tagged],
+-[_$0(m4_quote(m4_default([$1], [[, ]])),
+-     m4_quote(m4_if([$2], [],
+-                   m4_quote(lt_decl_tag_varnames),
+-                m4_quote(m4_shift($@)))),
+-     m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
+-m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
++[m4_assert([$# <= 2])dnl
++_$0(m4_quote(m4_default([$1], [[, ]])),
++    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
++    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
++m4_define([_lt_decl_varnames_tagged],
++[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+ # lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+@@ -1442,10 +1282,10 @@
+       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+     darwin1.*)
+       _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+-    darwin*) # darwin 5.x on 
++    darwin*) # darwin 5.x on
+       # if running on 10.5 or later, the deployment target defaults
+       # to the OS version, if on x86, and 10.4, the deployment
+-      # target defaults to 10.4. Don't you love it? 
++      # target defaults to 10.4. Don't you love it?
+       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+       10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+         _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+@@ -1487,7 +1327,11 @@
+   _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+   _LT_TAGVAR(link_all_deplibs, $1)=yes
+   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+-  if test "$GCC" = "yes"; then
++  case $cc_basename in
++     ifort*) _lt_dar_can_shared=yes ;;
++     *) _lt_dar_can_shared=$GCC ;;
++  esac
++  if test "$_lt_dar_can_shared" = "yes"; then
+     output_verbose_link_cmd=echo
+     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+@@ -2009,7 +1853,7 @@
+     lt_cv_sys_max_cmd_len=-1;
+     ;;
+-  cygwin* | mingw*)
++  cygwin* | mingw* | cegcc*)
+     # On Win9x/ME, this test blows up -- it succeeds, but takes
+     # about 5 minutes as the teststring grows exponentially.
+     # Worse, since 9x/ME are not pre-emptively multitasking,
+@@ -2177,10 +2021,6 @@
+ #  endif
+ #endif
+-#ifdef __cplusplus
+-extern "C" void exit (int);
+-#endif
+-
+ void fnord() { int i=42;}
+ int main ()
+ {
+@@ -2196,7 +2036,7 @@
+   else
+     puts (dlerror ());
+-    exit (status);
++  return status;
+ }]
+ _LT_EOF
+   if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+@@ -2235,7 +2075,7 @@
+     lt_cv_dlopen_self=yes
+     ;;
+-  mingw* | pw32*)
++  mingw* | pw32* | cegcc*)
+     lt_cv_dlopen="LoadLibrary"
+     lt_cv_dlopen_libs=
+     ;;
+@@ -2532,6 +2372,7 @@
+ [AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ m4_require([_LT_DECL_EGREP])dnl
+ m4_require([_LT_FILEUTILS_DEFAULTS])dnl
++m4_require([_LT_DECL_OBJDUMP])dnl
+ m4_require([_LT_DECL_SED])dnl
+ AC_MSG_CHECKING([dynamic linker characteristics])
+ m4_if([$1],
+@@ -2696,14 +2537,14 @@
+   # libtool to hard-code these into programs
+   ;;
+-cygwin* | mingw* | pw32*)
++cygwin* | mingw* | pw32* | cegcc*)
+   version_type=windows
+   shrext_cmds=".dll"
+   need_version=no
+   need_lib_prefix=no
+   case $GCC,$host_os in
+-  yes,cygwin* | yes,mingw* | yes,pw32*)
++  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+     library_names_spec='$libname.dll.a'
+     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+     postinstall_cmds='base_file=`basename \${file}`~
+@@ -2726,7 +2567,7 @@
+       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+       sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+       ;;
+-    mingw*)
++    mingw* | cegcc*)
+       # MinGW DLLs use traditional 'lib' prefix
+       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+       sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+@@ -3164,7 +3005,7 @@
+   version_type=linux
+   need_lib_prefix=no
+   need_version=no
+-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
++  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+   shlibpath_var=LD_LIBRARY_PATH
+   shlibpath_overrides_runpath=no
+   hardcode_into_libs=yes
+@@ -3188,7 +3029,7 @@
+ if test "$GCC" = yes; then
+   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+ fi
+- 
++
+ if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+   sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+ fi
+@@ -3465,6 +3306,7 @@
+ #  -- PORTME fill in with the dynamic library characteristics
+ m4_defun([_LT_CHECK_MAGIC_METHOD],
+ [m4_require([_LT_DECL_EGREP])
++m4_require([_LT_DECL_OBJDUMP])
+ AC_CACHE_CHECK([how to recognize dependent libraries],
+ lt_cv_deplibs_check_method,
+ [lt_cv_file_magic_cmd='$MAGIC_CMD'
+@@ -3515,6 +3357,12 @@
+   fi
+   ;;
++cegcc)
++  # use the weaker test based on 'objdump'. See mingw*.
++  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
++  lt_cv_file_magic_cmd='$OBJDUMP -f'
++  ;;
++
+ darwin* | rhapsody*)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -3826,7 +3674,7 @@
+ aix*)
+   symcode='[[BCDT]]'
+   ;;
+-cygwin* | mingw* | pw32*)
++cygwin* | mingw* | pw32* | cegcc*)
+   symcode='[[ABCDGISTW]]'
+   ;;
+ hpux*)
+@@ -4072,7 +3920,7 @@
+     beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+       # PIC is the default for these OSes.
+       ;;
+-    mingw* | cygwin* | os2* | pw32*)
++    mingw* | cygwin* | os2* | pw32* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       # Although the cygwin gcc ignores -fPIC, still need this for old-style
+@@ -4099,10 +3947,11 @@
+       fi
+       ;;
+     hpux*)
+-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+-      # not for PA HP-UX.
++      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
++      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
++      # sets the default TLS model and affects inlining.
+       case $host_cpu in
+-      hppa*64*|ia64*)
++      hppa*64*)
+       ;;
+       *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+@@ -4200,12 +4049,19 @@
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+-        icpc* | ecpc* )
+-          # Intel C++
++        ecpc* )
++          # old Intel C++ for x86_64 which still supported -KPIC.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
++        icpc* )
++          # Intel C++, used to be incompatible with GCC.
++          # ICC 10 doesn't accept -KPIC any more.
++          _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
++          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
++          _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
++          ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+@@ -4371,7 +4227,7 @@
+       # PIC is the default for these OSes.
+       ;;
+-    mingw* | cygwin* | pw32* | os2*)
++    mingw* | cygwin* | pw32* | os2* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       # Although the cygwin gcc ignores -fPIC, still need this for old-style
+@@ -4387,10 +4243,11 @@
+       ;;
+     hpux*)
+-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+-      # not for PA HP-UX.
++      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
++      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
++      # sets the default TLS model and affects inlining.
+       case $host_cpu in
+-      hppa*64*|ia64*)
++      hppa*64*)
+       # +Z the default
+       ;;
+       *)
+@@ -4440,7 +4297,7 @@
+       fi
+       ;;
+-    mingw* | cygwin* | pw32* | os2*)
++    mingw* | cygwin* | pw32* | os2* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       m4_if([$1], [GCJ], [],
+@@ -4471,11 +4328,25 @@
+     linux* | k*bsd*-gnu)
+       case $cc_basename in
+-      icc* | ecc* | ifort*)
++      # old Intel for x86_64 which still supported -KPIC.
++      ecc*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+         ;;
++      # icc used to be incompatible with GCC.
++      # ICC 10 doesn't accept -KPIC any more.
++      icc* | ifort*)
++      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
++      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
++      _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
++        ;;
++      # Lahey Fortran 8.1.
++      lf95*)
++      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
++      _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
++      _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
++      ;;
+       pgcc* | pgf77* | pgf90* | pgf95*)
+         # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+@@ -4657,7 +4528,7 @@
+   pw32*)
+     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+   ;;
+-  cygwin* | mingw*)
++  cygwin* | mingw* | cegcc*)
+     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+   ;;
+   linux* | k*bsd*-gnu)
+@@ -4712,7 +4583,7 @@
+   extract_expsyms_cmds=
+   case $host_os in
+-  cygwin* | mingw* | pw32*)
++  cygwin* | mingw* | pw32* | cegcc*)
+     # FIXME: the MSVC++ port hasn't been tested in a loooong time
+     # When not using gcc, we currently assume that we are using
+     # Microsoft Visual C++.
+@@ -4727,6 +4598,9 @@
+   openbsd*)
+     with_gnu_ld=no
+     ;;
++  linux* | k*bsd*-gnu)
++    _LT_TAGVAR(link_all_deplibs, $1)=no
++    ;;
+   esac
+   _LT_TAGVAR(ld_shlibs, $1)=yes
+@@ -4799,7 +4673,7 @@
+       fi
+       ;;
+-    cygwin* | mingw* | pw32*)
++    cygwin* | mingw* | pw32* | cegcc*)
+       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+       # as there is no search path for DLLs.
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+@@ -4865,6 +4739,9 @@
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
++      lf95*)                          # Lahey Fortran 8.1
++        _LT_TAGVAR(whole_archive_flag_spec, $1)=
++        tmp_sharedflag='--shared' ;;
+       xl[[cC]]*)                      # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+@@ -5097,6 +4974,7 @@
+       fi
+       fi
++      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+       # It seems that -bexpall does not export symbols beginning with
+       # underscore (_), so it is better to generate a list of symbols to export.
+       _LT_TAGVAR(always_export_symbols, $1)=yes
+@@ -5151,7 +5029,7 @@
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+       ;;
+-    cygwin* | mingw* | pw32*)
++    cygwin* | mingw* | pw32* | cegcc*)
+       # When not using gcc, we currently assume that we are using
+       # Microsoft Visual C++.
+       # hardcode_libdir_flag_spec is actually meaningless, as there is
+@@ -5255,7 +5133,7 @@
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
++        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+@@ -6036,6 +5914,7 @@
+           fi
+         fi
++        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+         # It seems that -bexpall does not export symbols beginning with
+         # underscore (_), so it is better to generate a list of symbols to
+       # export.
+@@ -6094,7 +5973,7 @@
+         esac
+         ;;
+-      cygwin* | mingw* | pw32*)
++      cygwin* | mingw* | pw32* | cegcc*)
+         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+         # as there is no search path for DLLs.
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+@@ -7475,6 +7354,18 @@
+ ])
++# _LT_DECL_OBJDUMP
++# --------------
++# If we don't have a new enough Autoconf to choose the best objdump
++# available, choose the one first in the user's PATH.
++m4_defun([_LT_DECL_OBJDUMP],
++[AC_CHECK_TOOL(OBJDUMP, objdump, false)
++test -z "$OBJDUMP" && OBJDUMP=objdump
++_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
++AC_SUBST([OBJDUMP])
++])
++
++
+ # _LT_DECL_SED
+ # ------------
+ # Check for a fully-functional sed program, that truncates
+@@ -7935,7 +7826,7 @@
+ [enable_win32_dll=yes
+ case $host in
+-*-*-cygwin* | *-*-mingw* | *-*-pw32*)
++*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+   AC_CHECK_TOOL(AS, as, false)
+   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+   AC_CHECK_TOOL(OBJDUMP, objdump, false)
+@@ -8176,14 +8067,14 @@
+ # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+ #
+-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+-#   Written by Gary V. Vaughan, 2004
++# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
++# Written by Gary V. Vaughan, 2004
+ #
+ # This file is free software; the Free Software Foundation gives
+ # unlimited permission to copy and/or distribute it, with or without
+ # modifications, as long as this notice is preserved.
+-# serial 5 ltsugar.m4
++# serial 6 ltsugar.m4
+ # This is to help aclocal find these macros, as it can't see m4_define.
+ AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+@@ -8239,14 +8130,14 @@
+ # Produce a SEP delimited list of all paired combinations of elements of
+ # PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+ # has the form PREFIXmINFIXSUFFIXn.
++# Needed until we can rely on m4_combine added in Autoconf 2.62.
+ m4_define([lt_combine],
+-[m4_if([$2], [], [],
+-  [m4_if([$4], [], [],
+-    [lt_join(m4_quote(m4_default([$1], [[, ]])),
+-      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
+-                 [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
+-                             [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
+-])
++[m4_if(m4_eval([$# > 3]), [1],
++       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
++[[m4_foreach([_Lt_prefix], [$2],
++           [m4_foreach([_Lt_suffix],
++              ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
++      [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+ # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+@@ -8309,15 +8200,15 @@
+ # Generated from ltversion.in.
+-# serial 2976 ltversion.m4
++# serial 3012 ltversion.m4
+ # This file is part of GNU Libtool
+-m4_define([LT_PACKAGE_VERSION], [2.2.4])
+-m4_define([LT_PACKAGE_REVISION], [1.2976])
++m4_define([LT_PACKAGE_VERSION], [2.2.6])
++m4_define([LT_PACKAGE_REVISION], [1.3012])
+ AC_DEFUN([LTVERSION_VERSION],
+-[macro_version='2.2.4'
+-macro_revision='1.2976'
++[macro_version='2.2.6'
++macro_revision='1.3012'
+ _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+ _LT_DECL(, macro_revision, 0)
+ ])
+@@ -8573,7 +8464,7 @@
+ fi[]dnl
+ ])# PKG_CHECK_MODULES
+-# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
++# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+@@ -8588,7 +8479,7 @@
+ [am__api_version='1.10'
+ dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+ dnl require some minimum version.  Point them to the right macro.
+-m4_if([$1], [1.10.1], [],
++m4_if([$1], [1.10.2], [],
+       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+ ])
+@@ -8602,12 +8493,12 @@
+ # AM_SET_CURRENT_AUTOMAKE_VERSION
+ # -------------------------------
+ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
++# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+-[AM_AUTOMAKE_VERSION([1.10.1])dnl
++[AM_AUTOMAKE_VERSION([1.10.2])dnl
+ m4_ifndef([AC_AUTOCONF_VERSION],
+   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+-_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
++_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+ # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+@@ -8857,19 +8748,28 @@
+ # Generate code to set up dependency tracking.              -*- Autoconf -*-
+-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
++# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ # Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+ # with or without modifications, as long as this notice is preserved.
+-#serial 3
++#serial 4
+ # _AM_OUTPUT_DEPENDENCY_COMMANDS
+ # ------------------------------
+ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+-[for mf in $CONFIG_FILES; do
++[# Autoconf 2.62 quotes --file arguments for eval, but not when files
++# are listed without --file.  Let's play safe and only enable the eval
++# if we detect the quoting.
++case $CONFIG_FILES in
++*\'*) eval set x "$CONFIG_FILES" ;;
++*)   set x $CONFIG_FILES ;;
++esac
++shift
++for mf
++do
+   # Strip MF so we end up with the name of the file.
+   mf=`echo "$mf" | sed -e 's/:.*$//'`
+   # Check whether this is an Automake generated Makefile or not.
+@@ -9213,13 +9113,13 @@
+ # Helper functions for option handling.                     -*- Autoconf -*-
+-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
++# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+ #
+ # This file is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+ # with or without modifications, as long as this notice is preserved.
+-# serial 3
++# serial 4
+ # _AM_MANGLE_OPTION(NAME)
+ # -----------------------
+@@ -9236,7 +9136,7 @@
+ # ----------------------------------
+ # OPTIONS is a space-separated list of Automake options.
+ AC_DEFUN([_AM_SET_OPTIONS],
+-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
++[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+ # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+ # -------------------------------------------
+--- nufw-2.2.21.orig/Makefile.in
++++ nufw-2.2.21/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -99,6 +99,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -111,9 +113,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -124,6 +123,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -132,6 +132,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -191,6 +192,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = src scripts doc tests conf python selinux
+@@ -240,7 +242,7 @@
+       -rm -rf .libs _libs
+ distclean-libtool:
+-      -rm -f libtool
++      -rm -f libtool config.lt
+ # This directory's subdirectories are mostly independent; you can cd
+ # into them and run `make' without going through this Makefile.
+@@ -317,7 +319,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/ltmain.sh
++++ nufw-2.2.21/ltmain.sh
+@@ -1,6 +1,6 @@
+ # Generated from ltmain.m4sh.
+-# ltmain.sh (GNU libtool) 2.2.4
++# ltmain.sh (GNU libtool) 2.2.6
+ # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+ # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+@@ -65,7 +65,7 @@
+ #       compiler:             $LTCC
+ #       compiler flags:               $LTCFLAGS
+ #       linker:               $LD (gnu? $with_gnu_ld)
+-#       $progname:            (GNU libtool) 2.2.4 Debian-2.2.4-0ubuntu4
++#       $progname:            (GNU libtool) 2.2.6 Debian-2.2.6a-4
+ #       automake:             $automake_version
+ #       autoconf:             $autoconf_version
+ #
+@@ -73,9 +73,9 @@
+ PROGRAM=ltmain.sh
+ PACKAGE=libtool
+-VERSION="2.2.4 Debian-2.2.4-0ubuntu4"
++VERSION="2.2.6 Debian-2.2.6a-4"
+ TIMESTAMP=""
+-package_revision=1.2976
++package_revision=1.3012
+ # Be Bourne compatible
+ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+@@ -805,7 +805,7 @@
+   case $host in
+-    *cygwin* | *mingw* | *pw32*)
++    *cygwin* | *mingw* | *pw32* | *cegcc*)
+       # don't eliminate duplications in $postdeps and $predeps
+       opt_duplicate_compiler_generated_deps=:
+       ;;
+@@ -893,8 +893,9 @@
+ # determined imposters.
+ func_lalib_p ()
+ {
+-    $SED -e 4q "$1" 2>/dev/null \
+-      | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
++    test -f "$1" &&
++      $SED -e 4q "$1" 2>/dev/null \
++        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+ }
+ # func_lalib_unsafe_p file
+@@ -907,7 +908,7 @@
+ func_lalib_unsafe_p ()
+ {
+     lalib_p=no
+-    if test -r "$1" && exec 5<&0 <"$1"; then
++    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+       for lalib_p_l in 1 2 3 4
+       do
+           read lalib_p_line
+@@ -1275,7 +1276,7 @@
+     # On Cygwin there's no "real" PIC flag so we must build both object types
+     case $host_os in
+-    cygwin* | mingw* | pw32* | os2*)
++    cygwin* | mingw* | pw32* | os2* | cegcc*)
+       pic_mode=default
+       ;;
+     esac
+@@ -2046,7 +2047,7 @@
+             'exit $?'
+         tstripme="$stripme"
+         case $host_os in
+-        cygwin* | mingw* | pw32*)
++        cygwin* | mingw* | pw32* | cegcc*)
+           case $realname in
+           *.dll.a)
+             tstripme=""
+@@ -2152,7 +2153,7 @@
+       # Do a test to see if this is really a libtool program.
+       case $host in
+-      *cygwin*|*mingw*)
++      *cygwin* | *mingw*)
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             wrapper=$func_ltwrapper_scriptname_result
+@@ -2358,7 +2359,7 @@
+             $RM $export_symbols
+             eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+             case $host in
+-            *cygwin* | *mingw* )
++            *cygwin* | *mingw* | *cegcc* )
+                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+               ;;
+@@ -2370,7 +2371,7 @@
+             eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+             case $host in
+-              *cygwin | *mingw* )
++              *cygwin | *mingw* | *cegcc* )
+                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                 ;;
+@@ -2426,7 +2427,7 @@
+ } lt_dlsymlist;
+ "
+         case $host in
+-        *cygwin* | *mingw* )
++        *cygwin* | *mingw* | *cegcc* )
+           $ECHO >> "$output_objdir/$my_dlsyms" "\
+ /* DATA imports from DLLs on WIN32 con't be const, because
+    runtime relocations are performed -- see ld's documentation
+@@ -2512,7 +2513,7 @@
+       # Transform the symbol file into the correct name.
+       symfileobj="$output_objdir/${my_outputname}S.$objext"
+       case $host in
+-      *cygwin* | *mingw* )
++      *cygwin* | *mingw* | *cegcc* )
+         if test -f "$output_objdir/$my_outputname.def"; then
+           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+@@ -2691,25 +2692,16 @@
+-# func_emit_wrapper arg
++# func_emit_wrapper_part1 [arg=no]
+ #
+-# emit a libtool wrapper script on stdout
+-# don't directly open a file because we may want to
+-# incorporate the script contents within a cygwin/mingw
+-# wrapper executable.  Must ONLY be called from within
+-# func_mode_link because it depends on a number of variable
+-# set therein.
+-#
+-# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+-# variable will take.  If 'yes', then the emitted script
+-# will assume that the directory in which it is stored is
+-# the '.lib' directory.  This is a cygwin/mingw-specific
+-# behavior.
+-func_emit_wrapper ()
++# Emit the first part of a libtool wrapper script on stdout.
++# For more information, see the description associated with
++# func_emit_wrapper(), below.
++func_emit_wrapper_part1 ()
+ {
+-      func_emit_wrapper_arg1=no
++      func_emit_wrapper_part1_arg1=no
+       if test -n "$1" ; then
+-        func_emit_wrapper_arg1=$1
++        func_emit_wrapper_part1_arg1=$1
+       fi
+       $ECHO "\
+@@ -2794,10 +2786,27 @@
+     file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+     file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+   done
++"
++}
++# end: func_emit_wrapper_part1
++
++# func_emit_wrapper_part2 [arg=no]
++#
++# Emit the second part of a libtool wrapper script on stdout.
++# For more information, see the description associated with
++# func_emit_wrapper(), below.
++func_emit_wrapper_part2 ()
++{
++      func_emit_wrapper_part2_arg1=no
++      if test -n "$1" ; then
++        func_emit_wrapper_part2_arg1=$1
++      fi
++
++      $ECHO "\
+   # Usually 'no', except on cygwin/mingw when embedded into
+   # the cwrapper.
+-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
++  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+     # special case for '.'
+     if test \"\$thisdir\" = \".\"; then
+@@ -2888,7 +2897,7 @@
+ "
+       case $host in
+       # Backslashes separate directories on plain windows
+-      *-*-mingw | *-*-os2*)
++      *-*-mingw | *-*-os2* | *-cegcc*)
+         $ECHO "\
+       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+ "
+@@ -2914,7 +2923,207 @@
+ fi\
+ "
+ }
+-# end: func_emit_wrapper
++# end: func_emit_wrapper_part2
++
++
++# func_emit_wrapper [arg=no]
++#
++# Emit a libtool wrapper script on stdout.
++# Don't directly open a file because we may want to
++# incorporate the script contents within a cygwin/mingw
++# wrapper executable.  Must ONLY be called from within
++# func_mode_link because it depends on a number of variables
++# set therein.
++#
++# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
++# variable will take.  If 'yes', then the emitted script
++# will assume that the directory in which it is stored is
++# the $objdir directory.  This is a cygwin/mingw-specific
++# behavior.
++func_emit_wrapper ()
++{
++      func_emit_wrapper_arg1=no
++      if test -n "$1" ; then
++        func_emit_wrapper_arg1=$1
++      fi
++
++      # split this up so that func_emit_cwrapperexe_src
++      # can call each part independently.
++      func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
++      func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
++}
++
++
++# func_to_host_path arg
++#
++# Convert paths to host format when used with build tools.
++# Intended for use with "native" mingw (where libtool itself
++# is running under the msys shell), or in the following cross-
++# build environments:
++#    $build          $host
++#    mingw (msys)    mingw  [e.g. native]
++#    cygwin          mingw
++#    *nix + wine     mingw
++# where wine is equipped with the `winepath' executable.
++# In the native mingw case, the (msys) shell automatically
++# converts paths for any non-msys applications it launches,
++# but that facility isn't available from inside the cwrapper.
++# Similar accommodations are necessary for $host mingw and
++# $build cygwin.  Calling this function does no harm for other
++# $host/$build combinations not listed above.
++#
++# ARG is the path (on $build) that should be converted to
++# the proper representation for $host. The result is stored
++# in $func_to_host_path_result.
++func_to_host_path ()
++{
++  func_to_host_path_result="$1"
++  if test -n "$1" ; then
++    case $host in
++      *mingw* )
++        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
++        case $build in
++          *mingw* ) # actually, msys
++            # awkward: cmd appends spaces to result
++            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
++            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
++              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
++            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
++              $SED -e "$lt_sed_naive_backslashify"`
++            ;;
++          *cygwin* )
++            func_to_host_path_tmp1=`cygpath -w "$1"`
++            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
++              $SED -e "$lt_sed_naive_backslashify"`
++            ;;
++          * )
++            # Unfortunately, winepath does not exit with a non-zero
++            # error code, so we are forced to check the contents of
++            # stdout. On the other hand, if the command is not
++            # found, the shell will set an exit code of 127 and print
++            # *an error message* to stdout. So we must check for both
++            # error code of zero AND non-empty stdout, which explains
++            # the odd construction:
++            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
++            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
++              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
++                $SED -e "$lt_sed_naive_backslashify"`
++            else
++              # Allow warning below.
++              func_to_host_path_result=""
++            fi
++            ;;
++        esac
++        if test -z "$func_to_host_path_result" ; then
++          func_error "Could not determine host path corresponding to"
++          func_error "  '$1'"
++          func_error "Continuing, but uninstalled executables may not work."
++          # Fallback:
++          func_to_host_path_result="$1"
++        fi
++        ;;
++    esac
++  fi
++}
++# end: func_to_host_path
++
++# func_to_host_pathlist arg
++#
++# Convert pathlists to host format when used with build tools.
++# See func_to_host_path(), above. This function supports the
++# following $build/$host combinations (but does no harm for
++# combinations not listed here):
++#    $build          $host
++#    mingw (msys)    mingw  [e.g. native]
++#    cygwin          mingw
++#    *nix + wine     mingw
++#
++# Path separators are also converted from $build format to
++# $host format. If ARG begins or ends with a path separator
++# character, it is preserved (but converted to $host format)
++# on output.
++#
++# ARG is a pathlist (on $build) that should be converted to
++# the proper representation on $host. The result is stored
++# in $func_to_host_pathlist_result.
++func_to_host_pathlist ()
++{
++  func_to_host_pathlist_result="$1"
++  if test -n "$1" ; then
++    case $host in
++      *mingw* )
++        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
++        # Remove leading and trailing path separator characters from
++        # ARG. msys behavior is inconsistent here, cygpath turns them
++        # into '.;' and ';.', and winepath ignores them completely.
++        func_to_host_pathlist_tmp2="$1"
++        # Once set for this call, this variable should not be
++        # reassigned. It is used in tha fallback case.
++        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
++          $SED -e 's|^:*||' -e 's|:*$||'`
++        case $build in
++          *mingw* ) # Actually, msys.
++            # Awkward: cmd appends spaces to result.
++            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
++            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
++              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
++            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
++              $SED -e "$lt_sed_naive_backslashify"`
++            ;;
++          *cygwin* )
++            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
++            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
++              $SED -e "$lt_sed_naive_backslashify"`
++            ;;
++          * )
++            # unfortunately, winepath doesn't convert pathlists
++            func_to_host_pathlist_result=""
++            func_to_host_pathlist_oldIFS=$IFS
++            IFS=:
++            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
++              IFS=$func_to_host_pathlist_oldIFS
++              if test -n "$func_to_host_pathlist_f" ; then
++                func_to_host_path "$func_to_host_pathlist_f"
++                if test -n "$func_to_host_path_result" ; then
++                  if test -z "$func_to_host_pathlist_result" ; then
++                    func_to_host_pathlist_result="$func_to_host_path_result"
++                  else
++                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
++                  fi
++                fi
++              fi
++              IFS=:
++            done
++            IFS=$func_to_host_pathlist_oldIFS
++            ;;
++        esac
++        if test -z "$func_to_host_pathlist_result" ; then
++          func_error "Could not determine the host path(s) corresponding to"
++          func_error "  '$1'"
++          func_error "Continuing, but uninstalled executables may not work."
++          # Fallback. This may break if $1 contains DOS-style drive
++          # specifications. The fix is not to complicate the expression
++          # below, but for the user to provide a working wine installation
++          # with winepath so that path translation in the cross-to-mingw
++          # case works properly.
++          lt_replace_pathsep_nix_to_dos="s|:|;|g"
++          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
++            $SED -e "$lt_replace_pathsep_nix_to_dos"`
++        fi
++        # Now, add the leading and trailing path separators back
++        case "$1" in
++          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
++            ;;
++        esac
++        case "$1" in
++          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
++            ;;
++        esac
++        ;;
++    esac
++  fi
++}
++# end: func_to_host_pathlist
+ # func_emit_cwrapperexe_src
+ # emit the source code for a wrapper executable on stdout
+@@ -2951,6 +3160,12 @@
+ # include <stdint.h>
+ # ifdef __CYGWIN__
+ #  include <io.h>
++#  define HAVE_SETENV
++#  ifdef __STRICT_ANSI__
++char *realpath (const char *, char *);
++int putenv (char *);
++int setenv (const char *, const char *, int);
++#  endif
+ # endif
+ #endif
+ #include <malloc.h>
+@@ -3057,29 +3272,105 @@
+ int check_executable (const char *path);
+ char *strendzap (char *str, const char *pat);
+ void lt_fatal (const char *message, ...);
++void lt_setenv (const char *name, const char *value);
++char *lt_extend_str (const char *orig_value, const char *add, int to_end);
++void lt_opt_process_env_set (const char *arg);
++void lt_opt_process_env_prepend (const char *arg);
++void lt_opt_process_env_append (const char *arg);
++int lt_split_name_value (const char *arg, char** name, char** value);
++void lt_update_exe_path (const char *name, const char *value);
++void lt_update_lib_path (const char *name, const char *value);
+-static const char *script_text =
++static const char *script_text_part1 =
+ EOF
+-          func_emit_wrapper yes |
++          func_emit_wrapper_part1 yes |
++              $SED -e 's/\([\\"]\)/\\\1/g' \
++                   -e 's/^/  "/' -e 's/$/\\n"/'
++          echo ";"
++          cat <<EOF
++
++static const char *script_text_part2 =
++EOF
++          func_emit_wrapper_part2 yes |
+               $SED -e 's/\([\\"]\)/\\\1/g' \
+                    -e 's/^/  "/' -e 's/$/\\n"/'
+           echo ";"
+           cat <<EOF
+ const char * MAGIC_EXE = "$magic_exe";
++const char * LIB_PATH_VARNAME = "$shlibpath_var";
++EOF
++
++          if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
++              func_to_host_pathlist "$temp_rpath"
++            cat <<EOF
++const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
++EOF
++          else
++            cat <<"EOF"
++const char * LIB_PATH_VALUE   = "";
++EOF
++          fi
++
++          if test -n "$dllsearchpath"; then
++              func_to_host_pathlist "$dllsearchpath:"
++            cat <<EOF
++const char * EXE_PATH_VARNAME = "PATH";
++const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
++EOF
++          else
++            cat <<"EOF"
++const char * EXE_PATH_VARNAME = "";
++const char * EXE_PATH_VALUE   = "";
++EOF
++          fi
++
++          if test "$fast_install" = yes; then
++            cat <<EOF
++const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
++EOF
++          else
++            cat <<EOF
++const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
++EOF
++          fi
++
++
++          cat <<"EOF"
++
++#define LTWRAPPER_OPTION_PREFIX         "--lt-"
++#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
++
++static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
++static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
++
++static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
++
++static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
++static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
++  /* argument is putenv-style "foo=bar", value of foo is set to bar */
++
++static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
++static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
++  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
++
++static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
++static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
++  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+ int
+ main (int argc, char *argv[])
+ {
+   char **newargz;
++  int  newargc;
+   char *tmp_pathspec;
+   char *actual_cwrapper_path;
+-  char *shwrapper_name;
++  char *actual_cwrapper_name;
++  char *target_name;
++  char *lt_argv_zero;
+   intptr_t rval = 127;
+-  FILE *shwrapper;
+-  const char *dumpscript_opt = "--lt-dump-script";
+   int i;
+   program_name = (char *) xstrdup (base_name (argv[0]));
+@@ -3099,38 +3390,14 @@
+               ;;
+             esac
+-          cat <<EOF
+-        printf ("%s", script_text);
++          cat <<"EOF"
++        printf ("%s", script_text_part1);
++        printf ("%s", script_text_part2);
+         return 0;
+       }
+     }
+-  newargz = XMALLOC (char *, argc + 2);
+-EOF
+-
+-          if test -n "$TARGETSHELL" ; then
+-            # no path translation at all
+-            lt_newargv0=$TARGETSHELL
+-          else
+-            case "$host" in
+-              *mingw* )
+-                # awkward: cmd appends spaces to result
+-                lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+-                lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
+-                case $lt_newargv0 in
+-                  *.exe | *.EXE) ;;
+-                  *) lt_newargv0=$lt_newargv0.exe ;;
+-                esac
+-                ;;
+-              * ) lt_newargv0=$SHELL ;;
+-            esac
+-          fi
+-
+-              cat <<EOF
+-  newargz[0] = (char *) xstrdup ("$lt_newargv0");
+-EOF
+-
+-          cat <<"EOF"
++  newargz = XMALLOC (char *, argc + 1);
+   tmp_pathspec = find_executable (argv[0]);
+   if (tmp_pathspec == NULL)
+     lt_fatal ("Couldn't find %s", argv[0]);
+@@ -3142,39 +3409,60 @@
+                         actual_cwrapper_path));
+   XFREE (tmp_pathspec);
+-  shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
+-  strendzap (actual_cwrapper_path, shwrapper_name);
++  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
++  strendzap (actual_cwrapper_path, actual_cwrapper_name);
++
++  /* wrapper name transforms */
++  strendzap (actual_cwrapper_name, ".exe");
++  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
++  XFREE (actual_cwrapper_name);
++  actual_cwrapper_name = tmp_pathspec;
++  tmp_pathspec = 0;
+-  /* shwrapper_name transforms */
+-  strendzap (shwrapper_name, ".exe");
+-  tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
+-                               strlen ("_ltshwrapperTMP") + 1));
+-  strcpy (tmp_pathspec, shwrapper_name);
+-  strcat (tmp_pathspec, "_ltshwrapperTMP");
+-  XFREE (shwrapper_name);
+-  shwrapper_name = tmp_pathspec;
++  /* target_name transforms -- use actual target program name; might have lt- prefix */
++  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
++  strendzap (target_name, ".exe");
++  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
++  XFREE (target_name);
++  target_name = tmp_pathspec;
+   tmp_pathspec = 0;
+-  LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
+-                        shwrapper_name));
++
++  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
++                        target_name));
+ EOF
+           cat <<EOF
+-  newargz[1] =
++  newargz[0] =
+     XMALLOC (char, (strlen (actual_cwrapper_path) +
+-                  strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
+-  strcpy (newargz[1], actual_cwrapper_path);
+-  strcat (newargz[1], "$objdir");
+-  strcat (newargz[1], "/");
+-  strcat (newargz[1], shwrapper_name);
++                  strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
++  strcpy (newargz[0], actual_cwrapper_path);
++  strcat (newargz[0], "$objdir");
++  strcat (newargz[0], "/");
+ EOF
++          cat <<"EOF"
++  /* stop here, and copy so we don't have to do this twice */
++  tmp_pathspec = xstrdup (newargz[0]);
++
++  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
++  strcat (newargz[0], actual_cwrapper_name);
++
++  /* DO want the lt- prefix here if it exists, so use target_name */
++  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
++  XFREE (tmp_pathspec);
++  tmp_pathspec = NULL;
++EOF
+           case $host_os in
+             mingw*)
+           cat <<"EOF"
+   {
+     char* p;
+-    while ((p = strchr (newargz[1], '\\')) != NULL)
++    while ((p = strchr (newargz[0], '\\')) != NULL)
++      {
++      *p = '/';
++      }
++    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+       {
+       *p = '/';
+       }
+@@ -3184,55 +3472,114 @@
+           esac
+           cat <<"EOF"
+-  XFREE (shwrapper_name);
++  XFREE (target_name);
+   XFREE (actual_cwrapper_path);
++  XFREE (actual_cwrapper_name);
+-  /* always write in binary mode */
+-  if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
+-    {
+-      lt_fatal ("Could not open %s for writing", newargz[1]);
+-    }
+-  fprintf (shwrapper, "%s", script_text);
+-  fclose (shwrapper);
+-
+-  make_executable (newargz[1]);
++  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
++  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
++  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
++  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
++  newargc=0;
+   for (i = 1; i < argc; i++)
+-    newargz[i + 1] = xstrdup (argv[i]);
+-  newargz[argc + 1] = NULL;
++    {
++      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
++        {
++          if (argv[i][env_set_opt_len] == '=')
++            {
++              const char *p = argv[i] + env_set_opt_len + 1;
++              lt_opt_process_env_set (p);
++            }
++          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
++            {
++              lt_opt_process_env_set (argv[++i]); /* don't copy */
++            }
++          else
++            lt_fatal ("%s missing required argument", env_set_opt);
++          continue;
++        }
++      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
++        {
++          if (argv[i][env_prepend_opt_len] == '=')
++            {
++              const char *p = argv[i] + env_prepend_opt_len + 1;
++              lt_opt_process_env_prepend (p);
++            }
++          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
++            {
++              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
++            }
++          else
++            lt_fatal ("%s missing required argument", env_prepend_opt);
++          continue;
++        }
++      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
++        {
++          if (argv[i][env_append_opt_len] == '=')
++            {
++              const char *p = argv[i] + env_append_opt_len + 1;
++              lt_opt_process_env_append (p);
++            }
++          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
++            {
++              lt_opt_process_env_append (argv[++i]); /* don't copy */
++            }
++          else
++            lt_fatal ("%s missing required argument", env_append_opt);
++          continue;
++        }
++      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
++        {
++          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
++             namespace, but it is not one of the ones we know about and
++             have already dealt with, above (inluding dump-script), then
++             report an error. Otherwise, targets might begin to believe
++             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
++             namespace. The first time any user complains about this, we'll
++             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
++             or a configure.ac-settable value.
++           */
++          lt_fatal ("Unrecognized option in %s namespace: '%s'",
++                    ltwrapper_option_prefix, argv[i]);
++        }
++      /* otherwise ... */
++      newargz[++newargc] = xstrdup (argv[i]);
++    }
++  newargz[++newargc] = NULL;
+-  for (i = 0; i < argc + 1; i++)
++  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
++  for (i = 0; i < newargc; i++)
+     {
+-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, newargz[i]));
++      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+     }
+ EOF
+           case $host_os in
+             mingw*)
+-              cat <<EOF
++              cat <<"EOF"
+   /* execv doesn't actually work on mingw as expected on unix */
+-  rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
++  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+   if (rval == -1)
+     {
+       /* failed to start process */
+-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
++      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+       return 127;
+     }
+   return rval;
+-}
+ EOF
+               ;;
+             *)
+-              cat <<EOF
+-  execv ("$lt_newargv0", newargz);
++              cat <<"EOF"
++  execv (lt_argv_zero, newargz);
+   return rval; /* =127, but avoids unused variable warning */
+-}
+ EOF
+               ;;
+           esac
+           cat <<"EOF"
++}
+ void *
+ xmalloc (size_t num)
+@@ -3506,6 +3853,177 @@
+   lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+   va_end (ap);
+ }
++
++void
++lt_setenv (const char *name, const char *value)
++{
++  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
++                          (name ? name : "<NULL>"),
++                          (value ? value : "<NULL>")));
++  {
++#ifdef HAVE_SETENV
++    /* always make a copy, for consistency with !HAVE_SETENV */
++    char *str = xstrdup (value);
++    setenv (name, str, 1);
++#else
++    int len = strlen (name) + 1 + strlen (value) + 1;
++    char *str = XMALLOC (char, len);
++    sprintf (str, "%s=%s", name, value);
++    if (putenv (str) != EXIT_SUCCESS)
++      {
++        XFREE (str);
++      }
++#endif
++  }
++}
++
++char *
++lt_extend_str (const char *orig_value, const char *add, int to_end)
++{
++  char *new_value;
++  if (orig_value && *orig_value)
++    {
++      int orig_value_len = strlen (orig_value);
++      int add_len = strlen (add);
++      new_value = XMALLOC (char, add_len + orig_value_len + 1);
++      if (to_end)
++        {
++          strcpy (new_value, orig_value);
++          strcpy (new_value + orig_value_len, add);
++        }
++      else
++        {
++          strcpy (new_value, add);
++          strcpy (new_value + add_len, orig_value);
++        }
++    }
++  else
++    {
++      new_value = xstrdup (add);
++    }
++  return new_value;
++}
++
++int
++lt_split_name_value (const char *arg, char** name, char** value)
++{
++  const char *p;
++  int len;
++  if (!arg || !*arg)
++    return 1;
++
++  p = strchr (arg, (int)'=');
++
++  if (!p)
++    return 1;
++
++  *value = xstrdup (++p);
++
++  len = strlen (arg) - strlen (*value);
++  *name = XMALLOC (char, len);
++  strncpy (*name, arg, len-1);
++  (*name)[len - 1] = '\0';
++
++  return 0;
++}
++
++void
++lt_opt_process_env_set (const char *arg)
++{
++  char *name = NULL;
++  char *value = NULL;
++
++  if (lt_split_name_value (arg, &name, &value) != 0)
++    {
++      XFREE (name);
++      XFREE (value);
++      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
++    }
++
++  lt_setenv (name, value);
++  XFREE (name);
++  XFREE (value);
++}
++
++void
++lt_opt_process_env_prepend (const char *arg)
++{
++  char *name = NULL;
++  char *value = NULL;
++  char *new_value = NULL;
++
++  if (lt_split_name_value (arg, &name, &value) != 0)
++    {
++      XFREE (name);
++      XFREE (value);
++      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
++    }
++
++  new_value = lt_extend_str (getenv (name), value, 0);
++  lt_setenv (name, new_value);
++  XFREE (new_value);
++  XFREE (name);
++  XFREE (value);
++}
++
++void
++lt_opt_process_env_append (const char *arg)
++{
++  char *name = NULL;
++  char *value = NULL;
++  char *new_value = NULL;
++
++  if (lt_split_name_value (arg, &name, &value) != 0)
++    {
++      XFREE (name);
++      XFREE (value);
++      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
++    }
++
++  new_value = lt_extend_str (getenv (name), value, 1);
++  lt_setenv (name, new_value);
++  XFREE (new_value);
++  XFREE (name);
++  XFREE (value);
++}
++
++void
++lt_update_exe_path (const char *name, const char *value)
++{
++  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
++                          (name ? name : "<NULL>"),
++                          (value ? value : "<NULL>")));
++
++  if (name && *name && value && *value)
++    {
++      char *new_value = lt_extend_str (getenv (name), value, 0);
++      /* some systems can't cope with a ':'-terminated path #' */
++      int len = strlen (new_value);
++      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
++        {
++          new_value[len-1] = '\0';
++        }
++      lt_setenv (name, new_value);
++      XFREE (new_value);
++    }
++}
++
++void
++lt_update_lib_path (const char *name, const char *value)
++{
++  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
++                          (name ? name : "<NULL>"),
++                          (value ? value : "<NULL>")));
++
++  if (name && *name && value && *value)
++    {
++      char *new_value = lt_extend_str (getenv (name), value, 0);
++      lt_setenv (name, new_value);
++      XFREE (new_value);
++    }
++}
++
++
+ EOF
+ }
+ # end: func_emit_cwrapperexe_src
+@@ -3515,7 +4033,7 @@
+ {
+     $opt_debug
+     case $host in
+-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
++    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+       # It is impossible to link a dll without this setting, and
+       # we shouldn't force the makefile maintainer to figure out
+       # which system we are compiling for in order to pass an extra
+@@ -3959,6 +4477,13 @@
+       -L*)
+       func_stripname '-L' '' "$arg"
+       dir=$func_stripname_result
++      if test -z "$dir"; then
++        if test "$#" -gt 0; then
++          func_fatal_error "require no space between \`-L' and \`$1'"
++        else
++          func_fatal_error "need path for \`-L' option"
++        fi
++      fi
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+@@ -3977,14 +4502,16 @@
+         ;;
+       esac
+       case $host in
+-      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
++      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
++        ::) dllsearchpath=$dir;;
+         *) dllsearchpath="$dllsearchpath:$dir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
++        ::) dllsearchpath=$testbindir;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+@@ -3995,7 +4522,7 @@
+       -l*)
+       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+         case $host in
+-        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
++        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+@@ -4072,7 +4599,7 @@
+       -no-install)
+       case $host in
+-      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
++      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # and Darwin in order for the loader to find any dlls it needs.
+         func_warning "\`-no-install' is ignored for $host"
+@@ -4820,19 +5347,19 @@
+           # It is a libtool convenience library, so add in its objects.
+           convenience="$convenience $ladir/$objdir/$old_library"
+           old_convenience="$old_convenience $ladir/$objdir/$old_library"
++          tmp_libs=
++          for deplib in $dependency_libs; do
++            deplibs="$deplib $deplibs"
++            if $opt_duplicate_deps ; then
++              case "$tmp_libs " in
++              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
++              esac
++            fi
++            tmp_libs="$tmp_libs $deplib"
++          done
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
+           func_fatal_error "\`$lib' is not a convenience library"
+         fi
+-        tmp_libs=
+-        for deplib in $dependency_libs; do
+-          deplibs="$deplib $deplibs"
+-          if $opt_duplicate_deps ; then
+-            case "$tmp_libs " in
+-            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+-            esac
+-          fi
+-          tmp_libs="$tmp_libs $deplib"
+-        done
+         continue
+       fi # $pass = conv
+@@ -5032,7 +5559,7 @@
+       if test -n "$library_names" &&
+          { test "$use_static_libs" = no || test -z "$old_library"; }; then
+         case $host in
+-        *cygwin* | *mingw*)
++        *cygwin* | *mingw* | *cegcc*)
+             # No point in relinking DLLs because paths are not encoded
+             notinst_deplibs="$notinst_deplibs $lib"
+             need_relink=no
+@@ -5102,7 +5629,7 @@
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+-            *cygwin* | mingw*)
++            *cygwin* | mingw* | *cegcc*)
+               func_arith $current - $age
+               major=$func_arith_result
+               versuffix="-$major"
+@@ -5369,6 +5896,7 @@
+         if test "$link_all_deplibs" != no; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
++            path=
+             case $deplib in
+             -L*) path="$deplib" ;;
+             *.la)
+@@ -5884,7 +6412,7 @@
+       tempremovelist=`$ECHO "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+-          *.$objext)
++          *.$objext | *.gcno)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+              if test "X$precious_files_regex" != "X"; then
+@@ -5955,7 +6483,7 @@
+       if test "$build_libtool_libs" = yes; then
+       if test -n "$rpath"; then
+         case $host in
+-        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
++        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+@@ -6454,7 +6982,7 @@
+       orig_export_symbols=
+       case $host_os in
+-      cygwin* | mingw*)
++      cygwin* | mingw* | cegcc*)
+         if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+           # exporting using user supplied symfile
+           if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+@@ -7079,14 +7607,16 @@
+         esac
+       fi
+       case $host in
+-      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
++      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
++        ::) dllsearchpath=$libdir;;
+         *) dllsearchpath="$dllsearchpath:$libdir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
++        ::) dllsearchpath=$testbindir;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+@@ -7156,6 +7686,10 @@
+           wrappers_required=no
+         fi
+         ;;
++      *cegcc)
++        # Disable wrappers for cegcc, we are cross compiling anyway.
++        wrappers_required=no
++        ;;
+       *)
+         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+           wrappers_required=no
+@@ -7308,11 +7842,10 @@
+           func_emit_cwrapperexe_src > $cwrappersource
+-          # we should really use a build-platform specific compiler
+-          # here, but OTOH, the wrappers (shell script and this C one)
+-          # are only useful if you want to execute the "real" binary.
+-          # Since the "real" binary is built for $host, then this
+-          # wrapper might as well be built for $host, too.
++          # The wrapper executable is built using the $host compiler,
++          # because it contains $host paths and files. If cross-
++          # compiling, it, like the target executable, must be
++          # executed on the $host or under an emulation environment.
+           $opt_dry_run || {
+             $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+             $STRIP $cwrapper
+@@ -7597,7 +8130,7 @@
+         # place dlname in correct position for cygwin
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+-          *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
++          *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+         esac
+         $ECHO > $output "\
+ # $outputname - a libtool library file
+--- nufw-2.2.21.orig/configure.ac
++++ nufw-2.2.21/configure.ac
+@@ -87,6 +87,7 @@
+ #AM_CHECK_PATH([libgcrypt], [gcry_md_open],AC_DEFINE([HAVE_LIBRARY_GCRYPT],[1],[Gcrypt lib flag]), check_gcrypt=no,[-L/usr/local/lib])
+ #AM_CHECK_PATH(libgnutls], [gnutls_init],AC_DEFINE([HAVE_LIBRARY_GNUTLS],[1],[Gnutls lib flag]), check_gnutls=no)
++PKG_PROG_PKG_CONFIG
+ NEED_LIBGCRYPT_VERSION=1.2.0
+ AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_VERSION")
+@@ -99,11 +100,7 @@
+ fi
+ NEED_LIBGNUTLS_VERSION=1.0.16
+-AM_PATH_LIBGNUTLS("$NEED_LIBGNUTLS_VERSION")
+-if test "x$LIBGNUTLS_LIBS" = "x"; then
+-  AC_MSG_ERROR([libgnutls is needed.
+-                See www.gnu.org/software/gnutls/ .])
+-fi
++PKG_CHECK_MODULES(GNUTLS, gnutls >= $NEED_LIBGNUTLS_VERSION,,exit)
+ #Configure database support, depending on user input
+ AC_ARG_WITH(prelude-log,
+--- nufw-2.2.21.orig/configure
++++ nufw-2.2.21/configure
+@@ -1,62 +1,83 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.61 for NuFW 2.2.21.
++# Generated by GNU Autoconf 2.64 for NuFW 2.2.21.
+ #
+ # Report bugs to <nufw-devel@nongnu.org>.
+ #
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
++# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
++# Foundation, Inc.
++#
+ # This configure script is free software; the Free Software Foundation
+ # gives unlimited permission to copy, distribute and modify it.
+-## --------------------- ##
+-## M4sh Initialization.  ##
+-## --------------------- ##
++## -------------------- ##
++## M4sh Initialization. ##
++## -------------------- ##
+ # Be more Bourne compatible
+ DUALCASE=1; export DUALCASE # for MKS sh
+-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+   emulate sh
+   NULLCMD=:
+-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
++  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+   # is contrary to our usage.  Disable this feature.
+   alias -g '${1+"$@"}'='"$@"'
+   setopt NO_GLOB_SUBST
+ else
+-  case `(set -o) 2>/dev/null` in
+-  *posix*) set -o posix ;;
++  case `(set -o) 2>/dev/null` in #(
++  *posix*) :
++    set -o posix ;; #(
++  *) :
++     ;;
+ esac
+-
+ fi
+-
+-
+-# PATH needs CR
+-# Avoid depending upon Character Ranges.
+-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+-as_cr_digits='0123456789'
+-as_cr_alnum=$as_cr_Letters$as_cr_digits
+-
+-# The user is always right.
+-if test "${PATH_SEPARATOR+set}" != set; then
+-  echo "#! /bin/sh" >conf$$.sh
+-  echo  "exit 0"   >>conf$$.sh
+-  chmod +x conf$$.sh
+-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+-    PATH_SEPARATOR=';'
++as_nl='
++'
++export as_nl
++# Printing a long string crashes Solaris 7 /usr/bin/printf.
++as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
++# Prefer a ksh shell builtin over an external printf program on Solaris,
++# but without wasting forks for bash or zsh.
++if test -z "$BASH_VERSION$ZSH_VERSION" \
++    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
++  as_echo='print -r --'
++  as_echo_n='print -rn --'
++elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
++  as_echo='printf %s\n'
++  as_echo_n='printf %s'
++else
++  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
++    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
++    as_echo_n='/usr/ucb/echo -n'
+   else
+-    PATH_SEPARATOR=:
++    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
++    as_echo_n_body='eval
++      arg=$1;
++      case $arg in #(
++      *"$as_nl"*)
++      expr "X$arg" : "X\\(.*\\)$as_nl";
++      arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
++      esac;
++      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
++    '
++    export as_echo_n_body
++    as_echo_n='sh -c $as_echo_n_body as_echo'
+   fi
+-  rm -f conf$$.sh
++  export as_echo_body
++  as_echo='sh -c $as_echo_body as_echo'
+ fi
+-# Support unset when possible.
+-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+-  as_unset=unset
+-else
+-  as_unset=false
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++  PATH_SEPARATOR=:
++  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
++    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
++      PATH_SEPARATOR=';'
++  }
+ fi
+@@ -65,20 +86,18 @@
+ # there to prevent editors from complaining about space-tab.
+ # (If _AS_PATH_WALK were called with IFS unset, it would disable word
+ # splitting by setting IFS to empty value.)
+-as_nl='
+-'
+ IFS=" ""      $as_nl"
+ # Find who we are.  Look in the path if we contain no directory separator.
+-case $0 in
++case $0 in #((
+   *[\\/]* ) as_myself=$0 ;;
+   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+-done
++    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
++  done
+ IFS=$as_save_IFS
+      ;;
+@@ -89,354 +108,322 @@
+   as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+-  { (exit 1); exit 1; }
++  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
++  exit 1
+ fi
+-# Work around bugs in pre-3.0 UWIN ksh.
+-for as_var in ENV MAIL MAILPATH
+-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
++# Unset variables that we do not need and which cause bugs (e.g. in
++# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
++# suppresses any "Segmentation fault" message there.  '((' could
++# trigger a bug in pdksh 5.2.14.
++for as_var in BASH_ENV ENV MAIL MAILPATH
++do eval test x\${$as_var+set} = xset \
++  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+ done
+ PS1='$ '
+ PS2='> '
+ PS4='+ '
+ # NLS nuisances.
+-for as_var in \
+-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+-  LC_TELEPHONE LC_TIME
+-do
+-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+-    eval $as_var=C; export $as_var
+-  else
+-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+-  fi
+-done
+-
+-# Required to use basename.
+-if expr a : '\(a\)' >/dev/null 2>&1 &&
+-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+-  as_expr=expr
+-else
+-  as_expr=false
+-fi
+-
+-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+-  as_basename=basename
+-else
+-  as_basename=false
+-fi
+-
+-
+-# Name of the executable.
+-as_me=`$as_basename -- "$0" ||
+-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+-       X"$0" : 'X\(//\)$' \| \
+-       X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X/"$0" |
+-    sed '/^.*\/\([^/][^/]*\)\/*$/{
+-          s//\1/
+-          q
+-        }
+-        /^X\/\(\/\/\)$/{
+-          s//\1/
+-          q
+-        }
+-        /^X\/\(\/\).*/{
+-          s//\1/
+-          q
+-        }
+-        s/.*/./; q'`
++LC_ALL=C
++export LC_ALL
++LANGUAGE=C
++export LANGUAGE
+ # CDPATH.
+-$as_unset CDPATH
+-
++(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+ if test "x$CONFIG_SHELL" = x; then
+-  if (eval ":") 2>/dev/null; then
+-  as_have_required=yes
++  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
++  emulate sh
++  NULLCMD=:
++  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
++  # is contrary to our usage.  Disable this feature.
++  alias -g '\${1+\"\$@\"}'='\"\$@\"'
++  setopt NO_GLOB_SUBST
+ else
+-  as_have_required=no
++  case \`(set -o) 2>/dev/null\` in #(
++  *posix*) :
++    set -o posix ;; #(
++  *) :
++     ;;
++esac
+ fi
+-
+-  if test $as_have_required = yes &&   (eval ":
+-(as_func_return () {
+-  (exit \$1)
+-}
+-as_func_success () {
+-  as_func_return 0
+-}
+-as_func_failure () {
+-  as_func_return 1
+-}
+-as_func_ret_success () {
+-  return 0
+-}
+-as_func_ret_failure () {
+-  return 1
+-}
++"
++  as_required="as_fn_return () { (exit \$1); }
++as_fn_success () { as_fn_return 0; }
++as_fn_failure () { as_fn_return 1; }
++as_fn_ret_success () { return 0; }
++as_fn_ret_failure () { return 1; }
+ exitcode=0
+-if as_func_success; then
+-  :
+-else
+-  exitcode=1
+-  echo as_func_success failed.
+-fi
+-
+-if as_func_failure; then
+-  exitcode=1
+-  echo as_func_failure succeeded.
+-fi
+-
+-if as_func_ret_success; then
+-  :
++as_fn_success || { exitcode=1; echo as_fn_success failed.; }
++as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
++as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
++as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
++if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
++
++else
++  exitcode=1; echo positional parameters were not saved.
++fi
++test x\$exitcode = x0 || exit 1"
++  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
++  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
++  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
++  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
++test \$(( 1 + 1 )) = 2 || exit 1"
++  if (eval "$as_required") 2>/dev/null; then :
++  as_have_required=yes
+ else
+-  exitcode=1
+-  echo as_func_ret_success failed.
+-fi
+-
+-if as_func_ret_failure; then
+-  exitcode=1
+-  echo as_func_ret_failure succeeded.
++  as_have_required=no
+ fi
++  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+-  :
+ else
+-  exitcode=1
+-  echo positional parameters were not saved.
+-fi
+-
+-test \$exitcode = 0) || { (exit 1); exit 1; }
+-
+-(
+-  as_lineno_1=\$LINENO
+-  as_lineno_2=\$LINENO
+-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+-") 2> /dev/null; then
+-  :
+-else
+-  as_candidate_shells=
+-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++as_found=false
+ for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  case $as_dir in
++  as_found=:
++  case $as_dir in #(
+        /*)
+          for as_base in sh bash ksh sh5; do
+-           as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
++           # Try only shells that exist, to save several forks.
++           as_shell=$as_dir/$as_base
++           if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
++                  { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
++  CONFIG_SHELL=$as_shell as_have_required=yes
++                 if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
++  break 2
++fi
++fi
+          done;;
+        esac
++  as_found=false
+ done
++$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
++            { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
++  CONFIG_SHELL=$SHELL as_have_required=yes
++fi; }
+ IFS=$as_save_IFS
+-      for as_shell in $as_candidate_shells $SHELL; do
+-       # Try only shells that exist, to save several forks.
+-       if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+-              { ("$as_shell") 2> /dev/null <<\_ASEOF
+-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+-  emulate sh
+-  NULLCMD=:
+-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+-  # is contrary to our usage.  Disable this feature.
+-  alias -g '${1+"$@"}'='"$@"'
+-  setopt NO_GLOB_SUBST
+-else
+-  case `(set -o) 2>/dev/null` in
+-  *posix*) set -o posix ;;
+-esac
+-
++      if test "x$CONFIG_SHELL" != x; then :
++  # We cannot yet assume a decent shell, so we have to provide a
++      # neutralization value for shells without unset; and this also
++      # works around shells that cannot unset nonexistent variables.
++      BASH_ENV=/dev/null
++      ENV=/dev/null
++      (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
++      export CONFIG_SHELL
++      exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
++fi
++
++    if test x$as_have_required = xno; then :
++  $as_echo "$0: This script requires a shell more modern than all"
++  $as_echo "$0: the shells that I found on your system."
++  if test x${ZSH_VERSION+set} = xset ; then
++    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
++    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
++  else
++    $as_echo "$0: Please tell bug-autoconf@gnu.org and
++$0: nufw-devel@nongnu.org about your system, including any
++$0: error possibly output before this message. Then install
++$0: a modern shell, or manually run the script under such a
++$0: shell if you do have one."
++  fi
++  exit 1
+ fi
+-
+-
+-:
+-_ASEOF
+-}; then
+-  CONFIG_SHELL=$as_shell
+-             as_have_required=yes
+-             if { "$as_shell" 2> /dev/null <<\_ASEOF
+-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+-  emulate sh
+-  NULLCMD=:
+-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+-  # is contrary to our usage.  Disable this feature.
+-  alias -g '${1+"$@"}'='"$@"'
+-  setopt NO_GLOB_SUBST
+-else
+-  case `(set -o) 2>/dev/null` in
+-  *posix*) set -o posix ;;
+-esac
+-
+ fi
+-
+-
+-:
+-(as_func_return () {
+-  (exit $1)
+-}
+-as_func_success () {
+-  as_func_return 0
+-}
+-as_func_failure () {
+-  as_func_return 1
+-}
+-as_func_ret_success () {
+-  return 0
+-}
+-as_func_ret_failure () {
+-  return 1
+-}
+-
+-exitcode=0
+-if as_func_success; then
+-  :
+-else
+-  exitcode=1
+-  echo as_func_success failed.
+ fi
++SHELL=${CONFIG_SHELL-/bin/sh}
++export SHELL
++# Unset more variables known to interfere with behavior of common tools.
++CLICOLOR_FORCE= GREP_OPTIONS=
++unset CLICOLOR_FORCE GREP_OPTIONS
+-if as_func_failure; then
+-  exitcode=1
+-  echo as_func_failure succeeded.
+-fi
++## --------------------- ##
++## M4sh Shell Functions. ##
++## --------------------- ##
++# as_fn_unset VAR
++# ---------------
++# Portably unset VAR.
++as_fn_unset ()
++{
++  { eval $1=; unset $1;}
++}
++as_unset=as_fn_unset
++
++# as_fn_set_status STATUS
++# -----------------------
++# Set $? to STATUS, without forking.
++as_fn_set_status ()
++{
++  return $1
++} # as_fn_set_status
++
++# as_fn_exit STATUS
++# -----------------
++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
++as_fn_exit ()
++{
++  set +e
++  as_fn_set_status $1
++  exit $1
++} # as_fn_exit
++
++# as_fn_mkdir_p
++# -------------
++# Create "$as_dir" as a directory, including parents if necessary.
++as_fn_mkdir_p ()
++{
+-if as_func_ret_success; then
+-  :
+-else
+-  exitcode=1
+-  echo as_func_ret_success failed.
+-fi
++  case $as_dir in #(
++  -*) as_dir=./$as_dir;;
++  esac
++  test -d "$as_dir" || eval $as_mkdir_p || {
++    as_dirs=
++    while :; do
++      case $as_dir in #(
++      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
++      *) as_qdir=$as_dir;;
++      esac
++      as_dirs="'$as_qdir' $as_dirs"
++      as_dir=`$as_dirname -- "$as_dir" ||
++$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++       X"$as_dir" : 'X\(//\)[^/]' \| \
++       X"$as_dir" : 'X\(//\)$' \| \
++       X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
++$as_echo X"$as_dir" |
++    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
++          s//\1/
++          q
++        }
++        /^X\(\/\/\)[^/].*/{
++          s//\1/
++          q
++        }
++        /^X\(\/\/\)$/{
++          s//\1/
++          q
++        }
++        /^X\(\/\).*/{
++          s//\1/
++          q
++        }
++        s/.*/./; q'`
++      test -d "$as_dir" && break
++    done
++    test -z "$as_dirs" || eval "mkdir $as_dirs"
++  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+-if as_func_ret_failure; then
+-  exitcode=1
+-  echo as_func_ret_failure succeeded.
+-fi
+-if ( set x; as_func_ret_success y && test x = "$1" ); then
+-  :
++} # as_fn_mkdir_p
++# as_fn_append VAR VALUE
++# ----------------------
++# Append the text in VALUE to the end of the definition contained in VAR. Take
++# advantage of any shell optimizations that allow amortized linear growth over
++# repeated appends, instead of the typical quadratic growth present in naive
++# implementations.
++if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
++  eval 'as_fn_append ()
++  {
++    eval $1+=\$2
++  }'
+ else
+-  exitcode=1
+-  echo positional parameters were not saved.
+-fi
+-
+-test $exitcode = 0) || { (exit 1); exit 1; }
+-
+-(
+-  as_lineno_1=$LINENO
+-  as_lineno_2=$LINENO
+-  test "x$as_lineno_1" != "x$as_lineno_2" &&
+-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+-
+-_ASEOF
+-}; then
+-  break
+-fi
+-
+-fi
+-
+-      done
+-
+-      if test "x$CONFIG_SHELL" != x; then
+-  for as_var in BASH_ENV ENV
+-        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+-        done
+-        export CONFIG_SHELL
+-        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+-fi
+-
+-
+-    if test $as_have_required = no; then
+-  echo This script requires a shell more modern than all the
+-      echo shells that I found on your system.  Please install a
+-      echo modern shell, or manually run the script under such a
+-      echo shell if you do have one.
+-      { (exit 1); exit 1; }
+-fi
+-
+-
+-fi
+-
+-fi
++  as_fn_append ()
++  {
++    eval $1=\$$1\$2
++  }
++fi # as_fn_append
++# as_fn_arith ARG...
++# ------------------
++# Perform arithmetic evaluation on the ARGs, and store the result in the
++# global $as_val. Take advantage of shells that can avoid forks. The arguments
++# must be portable across $(()) and expr.
++if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
++  eval 'as_fn_arith ()
++  {
++    as_val=$(( $* ))
++  }'
++else
++  as_fn_arith ()
++  {
++    as_val=`expr "$@" || test $? -eq 1`
++  }
++fi # as_fn_arith
+-(eval "as_func_return () {
+-  (exit \$1)
+-}
+-as_func_success () {
+-  as_func_return 0
+-}
+-as_func_failure () {
+-  as_func_return 1
+-}
+-as_func_ret_success () {
+-  return 0
+-}
+-as_func_ret_failure () {
+-  return 1
+-}
++# as_fn_error ERROR [LINENO LOG_FD]
++# ---------------------------------
++# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
++# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
++# script with status $?, using 1 if that was 0.
++as_fn_error ()
++{
++  as_status=$?; test $as_status -eq 0 && as_status=1
++  if test "$3"; then
++    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
++  fi
++  $as_echo "$as_me: error: $1" >&2
++  as_fn_exit $as_status
++} # as_fn_error
+-exitcode=0
+-if as_func_success; then
+-  :
++if expr a : '\(a\)' >/dev/null 2>&1 &&
++   test "X`expr 00001 : '.*\(...\)'`" = X001; then
++  as_expr=expr
+ else
+-  exitcode=1
+-  echo as_func_success failed.
+-fi
+-
+-if as_func_failure; then
+-  exitcode=1
+-  echo as_func_failure succeeded.
++  as_expr=false
+ fi
+-if as_func_ret_success; then
+-  :
++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
++  as_basename=basename
+ else
+-  exitcode=1
+-  echo as_func_ret_success failed.
+-fi
+-
+-if as_func_ret_failure; then
+-  exitcode=1
+-  echo as_func_ret_failure succeeded.
++  as_basename=false
+ fi
+-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+-  :
++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
++  as_dirname=dirname
+ else
+-  exitcode=1
+-  echo positional parameters were not saved.
++  as_dirname=false
+ fi
+-test \$exitcode = 0") || {
+-  echo No shell found that supports shell functions.
+-  echo Please tell autoconf@gnu.org about your system,
+-  echo including any error possibly output before this
+-  echo message
+-}
++as_me=`$as_basename -- "$0" ||
++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
++       X"$0" : 'X\(//\)$' \| \
++       X"$0" : 'X\(/\)' \| . 2>/dev/null ||
++$as_echo X/"$0" |
++    sed '/^.*\/\([^/][^/]*\)\/*$/{
++          s//\1/
++          q
++        }
++        /^X\/\(\/\/\)$/{
++          s//\1/
++          q
++        }
++        /^X\/\(\/\).*/{
++          s//\1/
++          q
++        }
++        s/.*/./; q'`
++# Avoid depending upon Character Ranges.
++as_cr_letters='abcdefghijklmnopqrstuvwxyz'
++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
++as_cr_Letters=$as_cr_letters$as_cr_LETTERS
++as_cr_digits='0123456789'
++as_cr_alnum=$as_cr_Letters$as_cr_digits
+-  as_lineno_1=$LINENO
+-  as_lineno_2=$LINENO
+-  test "x$as_lineno_1" != "x$as_lineno_2" &&
+-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+-
+-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+-  # uniformly replaced by the line number.  The first 'sed' inserts a
+-  # line-number line after each line using $LINENO; the second 'sed'
+-  # does the real work.  The second script uses 'N' to pair each
+-  # line-number line with the line containing $LINENO, and appends
+-  # trailing '-' during substitution so that $LINENO is not a special
+-  # case at line end.
+-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+-  # E. McMahon (1931-1989) for sed's syntax.  :-)
++  as_lineno_1=$LINENO as_lineno_1a=$LINENO
++  as_lineno_2=$LINENO as_lineno_2a=$LINENO
++  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
++  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
++  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+   sed -n '
+     p
+     /[$]LINENO/=
+@@ -453,8 +440,7 @@
+       s/-\n.*//
+     ' >$as_me.lineno &&
+   chmod +x "$as_me.lineno" ||
+-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+-   { (exit 1); exit 1; }; }
++    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+   # Don't try to exec as it changes $[0], causing all sort of problems
+   # (the dirname of $[0] is not the place where we might find the
+@@ -464,49 +450,40 @@
+   exit
+ }
+-
+-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+-  as_dirname=dirname
+-else
+-  as_dirname=false
+-fi
+-
+ ECHO_C= ECHO_N= ECHO_T=
+-case `echo -n x` in
++case `echo -n x` in #(((((
+ -n*)
+-  case `echo 'x\c'` in
++  case `echo 'xy\c'` in
+   *c*) ECHO_T='       ';;     # ECHO_T is single tab character.
+-  *)   ECHO_C='\c';;
++  xy)  ECHO_C='\c';;
++  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
++       ECHO_T='       ';;
+   esac;;
+ *)
+   ECHO_N='-n';;
+ esac
+-if expr a : '\(a\)' >/dev/null 2>&1 &&
+-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+-  as_expr=expr
+-else
+-  as_expr=false
+-fi
+-
+ rm -f conf$$ conf$$.exe conf$$.file
+ if test -d conf$$.dir; then
+   rm -f conf$$.dir/conf$$.file
+ else
+   rm -f conf$$.dir
+-  mkdir conf$$.dir
++  mkdir conf$$.dir 2>/dev/null
+ fi
+-echo >conf$$.file
+-if ln -s conf$$.file conf$$ 2>/dev/null; then
+-  as_ln_s='ln -s'
+-  # ... but there are two gotchas:
+-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+-  # In both cases, we have to default to `cp -p'.
+-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
++if (echo >conf$$.file) 2>/dev/null; then
++  if ln -s conf$$.file conf$$ 2>/dev/null; then
++    as_ln_s='ln -s'
++    # ... but there are two gotchas:
++    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
++    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
++    # In both cases, we have to default to `cp -p'.
++    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
++      as_ln_s='cp -p'
++  elif ln conf$$.file conf$$ 2>/dev/null; then
++    as_ln_s=ln
++  else
+     as_ln_s='cp -p'
+-elif ln conf$$.file conf$$ 2>/dev/null; then
+-  as_ln_s=ln
++  fi
+ else
+   as_ln_s='cp -p'
+ fi
+@@ -514,7 +491,7 @@
+ rmdir conf$$.dir 2>/dev/null
+ if mkdir -p . 2>/dev/null; then
+-  as_mkdir_p=:
++  as_mkdir_p='mkdir -p "$as_dir"'
+ else
+   test -d ./-p && rmdir ./-p
+   as_mkdir_p=false
+@@ -531,12 +508,12 @@
+   as_test_x='
+     eval sh -c '\''
+       if test -d "$1"; then
+-        test -d "$1/.";
++      test -d "$1/.";
+       else
+-      case $1 in
+-        -*)set "./$1";;
++      case $1 in #(
++      -*)set "./$1";;
+       esac;
+-      case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
++      case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+     '\'' sh
+   '
+@@ -551,7 +528,6 @@
+-
+ # Check that we are running under the correct shell.
+ SHELL=${CONFIG_SHELL-/bin/sh}
+@@ -718,7 +694,6 @@
+ subdirs=
+ MFLAGS=
+ MAKEFLAGS=
+-SHELL=${CONFIG_SHELL-/bin/sh}
+ # Identity of this package.
+ PACKAGE_NAME='NuFW'
+@@ -726,6 +701,7 @@
+ PACKAGE_VERSION='2.2.21'
+ PACKAGE_STRING='NuFW 2.2.21'
+ PACKAGE_BUGREPORT='nufw-devel@nongnu.org'
++PACKAGE_URL=''
+ ac_unique_file="src/nufw/main.c"
+ # Factoring default headers for most tests.
+@@ -764,172 +740,210 @@
+ # include <unistd.h>
+ #endif"
+-ac_subst_vars='SHELL
+-PATH_SEPARATOR
+-PACKAGE_NAME
+-PACKAGE_TARNAME
+-PACKAGE_VERSION
+-PACKAGE_STRING
+-PACKAGE_BUGREPORT
+-exec_prefix
+-prefix
+-program_transform_name
+-bindir
+-sbindir
+-libexecdir
+-datarootdir
+-datadir
+-sysconfdir
+-sharedstatedir
+-localstatedir
+-includedir
+-oldincludedir
+-docdir
+-infodir
+-htmldir
+-dvidir
+-pdfdir
+-psdir
+-libdir
+-localedir
+-mandir
+-DEFS
+-ECHO_C
+-ECHO_N
+-ECHO_T
+-LIBS
+-build_alias
+-host_alias
+-target_alias
+-CC
+-CFLAGS
+-LDFLAGS
+-CPPFLAGS
+-ac_ct_CC
+-EXEEXT
+-OBJEXT
+-LIBTOOL
+-build
+-build_cpu
+-build_vendor
+-build_os
+-host
+-host_cpu
+-host_vendor
+-host_os
+-SED
+-GREP
+-EGREP
+-FGREP
+-LD
+-DUMPBIN
+-ac_ct_DUMPBIN
+-NM
+-LN_S
+-AR
+-STRIP
+-RANLIB
+-lt_ECHO
+-DSYMUTIL
+-NMEDIT
+-LIPO
+-OTOOL
+-OTOOL64
+-CPP
+-INSTALL_PROGRAM
+-INSTALL_SCRIPT
+-INSTALL_DATA
+-DOCBOOK2MAN
+-DOCBOOK2PDF
+-LIBOBJS
+-LIBGCRYPT_CONFIG
+-LIBGCRYPT_CFLAGS
+-LIBGCRYPT_LIBS
+-LIBGNUTLS_CONFIG
+-LIBGNUTLS_CFLAGS
+-LIBGNUTLS_LIBS
+-PYTHON
+-PKG_CONFIG
+-GLIB_CFLAGS
+-GLIB_LIBS
+-GLIB_GENMARSHAL
+-GOBJECT_QUERY
+-GLIB_MKENUMS
+-USE_SYSTEM_AUTH_TRUE
+-USE_SYSTEM_AUTH_FALSE
+-USE_LDAP_TRUE
+-USE_LDAP_FALSE
+-USE_PRELUDE_LOG_TRUE
+-USE_PRELUDE_LOG_FALSE
+-USE_MYSQL_LOG_TRUE
+-USE_MYSQL_LOG_FALSE
+-USE_MYSQL_AUTH_TRUE
+-USE_MYSQL_AUTH_FALSE
+-HAVE_MYSQL_CONFIG_TRUE
+-HAVE_MYSQL_CONFIG_FALSE
+-USE_PGSQL_LOG_TRUE
+-USE_PGSQL_LOG_FALSE
+-USE_PLAINTEXT_AUTH_TRUE
+-USE_PLAINTEXT_AUTH_FALSE
+-USE_MARK_GROUP_TRUE
+-USE_MARK_GROUP_FALSE
+-USE_MARK_FIELD_TRUE
+-USE_MARK_FIELD_FALSE
+-USE_MARK_FLAG_TRUE
+-USE_MARK_FLAG_FALSE
+-USE_SYSLOG_LOG_TRUE
+-USE_SYSLOG_LOG_FALSE
+-BUILD_NUFW_TRUE
+-BUILD_NUFW_FALSE
+-BUILD_NUAUTH_TRUE
+-BUILD_NUAUTH_FALSE
+-BUILD_NUTCPC_TRUE
+-BUILD_NUTCPC_FALSE
+-BUILD_LIBNUCLIENT_TRUE
+-BUILD_LIBNUCLIENT_FALSE
+-BUILD_PAM_NUFW_TRUE
+-BUILD_PAM_NUFW_FALSE
+-BUILD_NUAUTH_COMMAND_TRUE
+-BUILD_NUAUTH_COMMAND_FALSE
+-HAVE_IPQ_TRUE
+-HAVE_IPQ_FALSE
+-USE_USER_MARK_TRUE
+-USE_USER_MARK_FALSE
+-HAVE_NFQUEUE_ONLY_TRUE
+-HAVE_NFQUEUE_ONLY_FALSE
+-HAVE_NFQUEUE_CONNTRACK_TRUE
+-HAVE_NFQUEUE_CONNTRACK_FALSE
+-HAVE_CONNTRACK_ONLY_TRUE
+-HAVE_CONNTRACK_ONLY_FALSE
+-am__isrc
+-CYGPATH_W
+-PACKAGE
+-VERSION
+-ACLOCAL
+-AUTOCONF
+-AUTOMAKE
+-AUTOHEADER
+-MAKEINFO
+-install_sh
+-INSTALL_STRIP_PROGRAM
+-mkdir_p
+-AWK
+-SET_MAKE
+-am__leading_dot
+-AMTAR
+-am__tar
+-am__untar
+-DEPDIR
+-am__include
+-am__quote
+-AMDEP_TRUE
+-AMDEP_FALSE
+-AMDEPBACKSLASH
+-CCDEPMODE
+-am__fastdepCC_TRUE
++ac_subst_vars='LTLIBOBJS
+ am__fastdepCC_FALSE
+-LTLIBOBJS'
++am__fastdepCC_TRUE
++CCDEPMODE
++AMDEPBACKSLASH
++AMDEP_FALSE
++AMDEP_TRUE
++am__quote
++am__include
++DEPDIR
++am__untar
++am__tar
++AMTAR
++am__leading_dot
++SET_MAKE
++AWK
++mkdir_p
++MKDIR_P
++INSTALL_STRIP_PROGRAM
++install_sh
++MAKEINFO
++AUTOHEADER
++AUTOMAKE
++AUTOCONF
++ACLOCAL
++VERSION
++PACKAGE
++CYGPATH_W
++am__isrc
++HAVE_CONNTRACK_ONLY_FALSE
++HAVE_CONNTRACK_ONLY_TRUE
++HAVE_NFQUEUE_CONNTRACK_FALSE
++HAVE_NFQUEUE_CONNTRACK_TRUE
++HAVE_NFQUEUE_ONLY_FALSE
++HAVE_NFQUEUE_ONLY_TRUE
++USE_USER_MARK_FALSE
++USE_USER_MARK_TRUE
++HAVE_IPQ_FALSE
++HAVE_IPQ_TRUE
++BUILD_NUAUTH_COMMAND_FALSE
++BUILD_NUAUTH_COMMAND_TRUE
++BUILD_PAM_NUFW_FALSE
++BUILD_PAM_NUFW_TRUE
++BUILD_LIBNUCLIENT_FALSE
++BUILD_LIBNUCLIENT_TRUE
++BUILD_NUTCPC_FALSE
++BUILD_NUTCPC_TRUE
++BUILD_NUAUTH_FALSE
++BUILD_NUAUTH_TRUE
++BUILD_NUFW_FALSE
++BUILD_NUFW_TRUE
++USE_SYSLOG_LOG_FALSE
++USE_SYSLOG_LOG_TRUE
++USE_MARK_FLAG_FALSE
++USE_MARK_FLAG_TRUE
++USE_MARK_FIELD_FALSE
++USE_MARK_FIELD_TRUE
++USE_MARK_GROUP_FALSE
++USE_MARK_GROUP_TRUE
++USE_PLAINTEXT_AUTH_FALSE
++USE_PLAINTEXT_AUTH_TRUE
++USE_PGSQL_LOG_FALSE
++USE_PGSQL_LOG_TRUE
++HAVE_MYSQL_CONFIG_FALSE
++HAVE_MYSQL_CONFIG_TRUE
++USE_MYSQL_AUTH_FALSE
++USE_MYSQL_AUTH_TRUE
++USE_MYSQL_LOG_FALSE
++USE_MYSQL_LOG_TRUE
++USE_PRELUDE_LOG_FALSE
++USE_PRELUDE_LOG_TRUE
++USE_LDAP_FALSE
++USE_LDAP_TRUE
++USE_SYSTEM_AUTH_FALSE
++USE_SYSTEM_AUTH_TRUE
++GLIB_MKENUMS
++GOBJECT_QUERY
++GLIB_GENMARSHAL
++GLIB_LIBS
++GLIB_CFLAGS
++PYTHON
++GNUTLS_LIBS
++GNUTLS_CFLAGS
++LIBGCRYPT_LIBS
++LIBGCRYPT_CFLAGS
++LIBGCRYPT_CONFIG
++PKG_CONFIG
++LIBOBJS
++DOCBOOK2PDF
++DOCBOOK2MAN
++INSTALL_DATA
++INSTALL_SCRIPT
++INSTALL_PROGRAM
++CPP
++OTOOL64
++OTOOL
++LIPO
++NMEDIT
++DSYMUTIL
++lt_ECHO
++RANLIB
++STRIP
++AR
++OBJDUMP
++LN_S
++NM
++ac_ct_DUMPBIN
++DUMPBIN
++LD
++FGREP
++EGREP
++GREP
++SED
++host_os
++host_vendor
++host_cpu
++host
++build_os
++build_vendor
++build_cpu
++build
++LIBTOOL
++OBJEXT
++EXEEXT
++ac_ct_CC
++CPPFLAGS
++LDFLAGS
++CFLAGS
++CC
++target_alias
++host_alias
++build_alias
++LIBS
++ECHO_T
++ECHO_N
++ECHO_C
++DEFS
++mandir
++localedir
++libdir
++psdir
++pdfdir
++dvidir
++htmldir
++infodir
++docdir
++oldincludedir
++includedir
++localstatedir
++sharedstatedir
++sysconfdir
++datadir
++datarootdir
++libexecdir
++sbindir
++bindir
++program_transform_name
++prefix
++exec_prefix
++PACKAGE_URL
++PACKAGE_BUGREPORT
++PACKAGE_STRING
++PACKAGE_VERSION
++PACKAGE_TARNAME
++PACKAGE_NAME
++PATH_SEPARATOR
++SHELL'
+ ac_subst_files=''
++ac_user_opts='
++enable_option_checking
++enable_shared
++enable_static
++with_pic
++enable_fast_install
++with_gnu_ld
++enable_libtool_lock
++with_libgcrypt_prefix
++with_prelude_log
++with_mysql_log
++with_mysql_auth
++with_pgsql_log
++with_syslog_log
++with_plaintext_auth
++with_mark_group
++with_mark_field
++with_mark_flag
++with_system_auth
++with_ldap
++with_nfqueue
++with_nfconntrack
++with_utf8
++with_fixedtimeout
++enable_nufw
++enable_nuauth
++enable_libnuclient
++enable_nutcpc
++enable_pam_nufw
++enable_nuauth_command
++enable_debug
++with_perf_display
++enable_glibtest
++with_user_mark
++enable_dependency_tracking
++'
+       ac_precious_vars='build_alias
+ host_alias
+ target_alias
+@@ -939,12 +953,16 @@
+ LIBS
+ CPPFLAGS
+ CPP
+-PKG_CONFIG'
++PKG_CONFIG
++GNUTLS_CFLAGS
++GNUTLS_LIBS'
+ # Initialize some variables set by options.
+ ac_init_help=
+ ac_init_version=false
++ac_unrecognized_opts=
++ac_unrecognized_sep=
+ # The variables have the same names as the options, with
+ # dashes changed to underlines.
+ cache_file=/dev/null
+@@ -1043,13 +1061,20 @@
+     datarootdir=$ac_optarg ;;
+   -disable-* | --disable-*)
+-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
++    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+     # Reject names that are not valid shell variable names.
+-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+-   { (exit 1); exit 1; }; }
+-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+-    eval enable_$ac_feature=no ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      as_fn_error "invalid feature name: $ac_useropt"
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"enable_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
++       ac_unrecognized_sep=', ';;
++    esac
++    eval enable_$ac_useropt=no ;;
+   -docdir | --docdir | --docdi | --doc | --do)
+     ac_prev=docdir ;;
+@@ -1062,13 +1087,20 @@
+     dvidir=$ac_optarg ;;
+   -enable-* | --enable-*)
+-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
++    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+     # Reject names that are not valid shell variable names.
+-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+-   { (exit 1); exit 1; }; }
+-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+-    eval enable_$ac_feature=\$ac_optarg ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      as_fn_error "invalid feature name: $ac_useropt"
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"enable_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
++       ac_unrecognized_sep=', ';;
++    esac
++    eval enable_$ac_useropt=\$ac_optarg ;;
+   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+@@ -1259,22 +1291,36 @@
+     ac_init_version=: ;;
+   -with-* | --with-*)
+-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
++    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+     # Reject names that are not valid shell variable names.
+-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+-      { echo "$as_me: error: invalid package name: $ac_package" >&2
+-   { (exit 1); exit 1; }; }
+-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+-    eval with_$ac_package=\$ac_optarg ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      as_fn_error "invalid package name: $ac_useropt"
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"with_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
++       ac_unrecognized_sep=', ';;
++    esac
++    eval with_$ac_useropt=\$ac_optarg ;;
+   -without-* | --without-*)
+-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
++    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+     # Reject names that are not valid shell variable names.
+-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+-      { echo "$as_me: error: invalid package name: $ac_package" >&2
+-   { (exit 1); exit 1; }; }
+-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+-    eval with_$ac_package=no ;;
++    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
++      as_fn_error "invalid package name: $ac_useropt"
++    ac_useropt_orig=$ac_useropt
++    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
++    case $ac_user_opts in
++      *"
++"with_$ac_useropt"
++"*) ;;
++      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
++       ac_unrecognized_sep=', ';;
++    esac
++    eval with_$ac_useropt=no ;;
+   --x)
+     # Obsolete; use --with-x.
+@@ -1294,25 +1340,25 @@
+   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+     x_libraries=$ac_optarg ;;
+-  -*) { echo "$as_me: error: unrecognized option: $ac_option
+-Try \`$0 --help' for more information." >&2
+-   { (exit 1); exit 1; }; }
++  -*) as_fn_error "unrecognized option: \`$ac_option'
++Try \`$0 --help' for more information."
+     ;;
+   *=*)
+     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+     # Reject names that are not valid shell variable names.
+-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+-      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+-   { (exit 1); exit 1; }; }
++    case $ac_envvar in #(
++      '' | [0-9]* | *[!_$as_cr_alnum]* )
++      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
++    esac
+     eval $ac_envvar=\$ac_optarg
+     export $ac_envvar ;;
+   *)
+     # FIXME: should be removed in autoconf 3.0.
+-    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
++    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+-      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
++      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+     : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+     ;;
+@@ -1321,23 +1367,36 @@
+ if test -n "$ac_prev"; then
+   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+-  { echo "$as_me: error: missing argument to $ac_option" >&2
+-   { (exit 1); exit 1; }; }
++  as_fn_error "missing argument to $ac_option"
++fi
++
++if test -n "$ac_unrecognized_opts"; then
++  case $enable_option_checking in
++    no) ;;
++    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
++    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
++  esac
+ fi
+-# Be sure to have absolute directory names.
++# Check all directory arguments for consistency.
+ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
+ do
+   eval ac_val=\$$ac_var
++  # Remove trailing slashes.
++  case $ac_val in
++    */ )
++      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
++      eval $ac_var=\$ac_val;;
++  esac
++  # Be sure to have absolute directory names.
+   case $ac_val in
+     [\\/$]* | ?:[\\/]* )  continue;;
+     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+   esac
+-  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+-   { (exit 1); exit 1; }; }
++  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+ done
+ # There might be people who depend on the old broken behavior: `$host'
+@@ -1351,7 +1410,7 @@
+ if test "x$host_alias" != x; then
+   if test "x$build_alias" = x; then
+     cross_compiling=maybe
+-    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
++    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+     If a cross compiler is detected then cross compile mode will be used." >&2
+   elif test "x$build_alias" != "x$host_alias"; then
+     cross_compiling=yes
+@@ -1367,23 +1426,21 @@
+ ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ ac_ls_di=`ls -di .` &&
+ ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+-  { echo "$as_me: error: Working directory cannot be determined" >&2
+-   { (exit 1); exit 1; }; }
++  as_fn_error "working directory cannot be determined"
+ test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+-  { echo "$as_me: error: pwd does not report name of working directory" >&2
+-   { (exit 1); exit 1; }; }
++  as_fn_error "pwd does not report name of working directory"
+ # Find the source files, if location was not specified.
+ if test -z "$srcdir"; then
+   ac_srcdir_defaulted=yes
+   # Try the directory containing this script, then the parent directory.
+-  ac_confdir=`$as_dirname -- "$0" ||
+-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+-       X"$0" : 'X\(//\)[^/]' \| \
+-       X"$0" : 'X\(//\)$' \| \
+-       X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$0" |
++  ac_confdir=`$as_dirname -- "$as_myself" ||
++$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++       X"$as_myself" : 'X\(//\)[^/]' \| \
++       X"$as_myself" : 'X\(//\)$' \| \
++       X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
++$as_echo X"$as_myself" |
+     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+@@ -1410,13 +1467,11 @@
+ fi
+ if test ! -r "$srcdir/$ac_unique_file"; then
+   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+-  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+-   { (exit 1); exit 1; }; }
++  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+ fi
+ ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ ac_abs_confdir=`(
+-      cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+-   { (exit 1); exit 1; }; }
++      cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+       pwd)`
+ # When building in place, set srcdir=.
+ if test "$ac_abs_confdir" = "$ac_pwd"; then
+@@ -1464,9 +1519,9 @@
+ Installation directories:
+   --prefix=PREFIX         install architecture-independent files in PREFIX
+-                        [$ac_default_prefix]
++                          [$ac_default_prefix]
+   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+-                        [PREFIX]
++                          [PREFIX]
+ By default, \`make install' will install all the files in
+ \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+@@ -1476,25 +1531,25 @@
+ For better control, use the options below.
+ Fine tuning of the installation directories:
+-  --bindir=DIR           user executables [EPREFIX/bin]
+-  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+-  --libexecdir=DIR       program executables [EPREFIX/libexec]
+-  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+-  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+-  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+-  --libdir=DIR           object code libraries [EPREFIX/lib]
+-  --includedir=DIR       C header files [PREFIX/include]
+-  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+-  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+-  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+-  --infodir=DIR          info documentation [DATAROOTDIR/info]
+-  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+-  --mandir=DIR           man documentation [DATAROOTDIR/man]
+-  --docdir=DIR           documentation root [DATAROOTDIR/doc/nufw]
+-  --htmldir=DIR          html documentation [DOCDIR]
+-  --dvidir=DIR           dvi documentation [DOCDIR]
+-  --pdfdir=DIR           pdf documentation [DOCDIR]
+-  --psdir=DIR            ps documentation [DOCDIR]
++  --bindir=DIR            user executables [EPREFIX/bin]
++  --sbindir=DIR           system admin executables [EPREFIX/sbin]
++  --libexecdir=DIR        program executables [EPREFIX/libexec]
++  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
++  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
++  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
++  --libdir=DIR            object code libraries [EPREFIX/lib]
++  --includedir=DIR        C header files [PREFIX/include]
++  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
++  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
++  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
++  --infodir=DIR           info documentation [DATAROOTDIR/info]
++  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
++  --mandir=DIR            man documentation [DATAROOTDIR/man]
++  --docdir=DIR            documentation root [DATAROOTDIR/doc/nufw]
++  --htmldir=DIR           html documentation [DOCDIR]
++  --dvidir=DIR            dvi documentation [DOCDIR]
++  --pdfdir=DIR            pdf documentation [DOCDIR]
++  --psdir=DIR             ps documentation [DOCDIR]
+ _ACEOF
+   cat <<\_ACEOF
+@@ -1517,6 +1572,7 @@
+   cat <<\_ACEOF
+ Optional Features:
++  --disable-option-checking  ignore unrecognized --enable/--with options
+   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+   --enable-shared[=PKGS]  build shared libraries [default=yes]
+@@ -1544,7 +1600,6 @@
+   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+   --with-libgcrypt-prefix=PFX
+                           prefix where LIBGCRYPT is installed (optional)
+-  --with-libgnutls-prefix=PFX   Prefix where libgnutls is installed (optional)
+   --with-prelude-log      Support user activity logging in Prelude
+   --with-mysql-log        Support user activity logging in Mysql database
+   --with-mysql-auth       Support user authentication in Mysql database
+@@ -1575,87 +1630,506 @@
+               you have headers in a nonstandard directory <include dir>
+   CPP         C preprocessor
+   PKG_CONFIG  path to pkg-config utility
++  GNUTLS_CFLAGS
++              C compiler flags for GNUTLS, overriding pkg-config
++  GNUTLS_LIBS linker flags for GNUTLS, overriding pkg-config
+ Use these variables to override the choices made by `configure' or to help
+ it to find libraries and programs with nonstandard names/locations.
+-Report bugs to <nufw-devel@nongnu.org>.
+-_ACEOF
+-ac_status=$?
++Report bugs to <nufw-devel@nongnu.org>.
++_ACEOF
++ac_status=$?
++fi
++
++if test "$ac_init_help" = "recursive"; then
++  # If there are subdirs, report their specific --help.
++  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
++    test -d "$ac_dir" ||
++      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
++      continue
++    ac_builddir=.
++
++case "$ac_dir" in
++.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
++*)
++  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
++  # A ".." for each directory in $ac_dir_suffix.
++  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
++  case $ac_top_builddir_sub in
++  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
++  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
++  esac ;;
++esac
++ac_abs_top_builddir=$ac_pwd
++ac_abs_builddir=$ac_pwd$ac_dir_suffix
++# for backward compatibility:
++ac_top_builddir=$ac_top_build_prefix
++
++case $srcdir in
++  .)  # We are building in place.
++    ac_srcdir=.
++    ac_top_srcdir=$ac_top_builddir_sub
++    ac_abs_top_srcdir=$ac_pwd ;;
++  [\\/]* | ?:[\\/]* )  # Absolute name.
++    ac_srcdir=$srcdir$ac_dir_suffix;
++    ac_top_srcdir=$srcdir
++    ac_abs_top_srcdir=$srcdir ;;
++  *) # Relative name.
++    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
++    ac_top_srcdir=$ac_top_build_prefix$srcdir
++    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
++esac
++ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
++
++    cd "$ac_dir" || { ac_status=$?; continue; }
++    # Check for guested configure.
++    if test -f "$ac_srcdir/configure.gnu"; then
++      echo &&
++      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
++    elif test -f "$ac_srcdir/configure"; then
++      echo &&
++      $SHELL "$ac_srcdir/configure" --help=recursive
++    else
++      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
++    fi || ac_status=$?
++    cd "$ac_pwd" || { ac_status=$?; break; }
++  done
++fi
++
++test -n "$ac_init_help" && exit $ac_status
++if $ac_init_version; then
++  cat <<\_ACEOF
++NuFW configure 2.2.21
++generated by GNU Autoconf 2.64
++
++Copyright (C) 2009 Free Software Foundation, Inc.
++This configure script is free software; the Free Software Foundation
++gives unlimited permission to copy, distribute and modify it.
++_ACEOF
++  exit
++fi
++
++## ------------------------ ##
++## Autoconf initialization. ##
++## ------------------------ ##
++
++# ac_fn_c_try_compile LINENO
++# --------------------------
++# Try to compile conftest.$ac_ext, and return whether this succeeded.
++ac_fn_c_try_compile ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  rm -f conftest.$ac_objext
++  if { { ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
++  (eval "$ac_compile") 2>conftest.err
++  ac_status=$?
++  if test -s conftest.err; then
++    grep -v '^ *+' conftest.err >conftest.er1
++    cat conftest.er1 >&5
++    mv -f conftest.er1 conftest.err
++  fi
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && {
++       test -z "$ac_c_werror_flag" ||
++       test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then :
++  ac_retval=0
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++      ac_retval=1
++fi
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++  return $ac_retval
++
++} # ac_fn_c_try_compile
++
++# ac_fn_c_try_link LINENO
++# -----------------------
++# Try to link conftest.$ac_ext, and return whether this succeeded.
++ac_fn_c_try_link ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  rm -f conftest.$ac_objext conftest$ac_exeext
++  if { { ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
++  (eval "$ac_link") 2>conftest.err
++  ac_status=$?
++  if test -s conftest.err; then
++    grep -v '^ *+' conftest.err >conftest.er1
++    cat conftest.er1 >&5
++    mv -f conftest.er1 conftest.err
++  fi
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && {
++       test -z "$ac_c_werror_flag" ||
++       test ! -s conftest.err
++       } && test -s conftest$ac_exeext && {
++       test "$cross_compiling" = yes ||
++       $as_test_x conftest$ac_exeext
++       }; then :
++  ac_retval=0
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++      ac_retval=1
++fi
++  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
++  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
++  # interfere with the next link command; also delete a directory that is
++  # left behind by Apple's compiler.  We do this before executing the actions.
++  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++  return $ac_retval
++
++} # ac_fn_c_try_link
++
++# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
++# -------------------------------------------------------
++# Tests whether HEADER exists and can be compiled using the include files in
++# INCLUDES, setting the cache variable VAR accordingly.
++ac_fn_c_check_header_compile ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++$4
++#include <$2>
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  eval "$3=yes"
++else
++  eval "$3=no"
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++eval ac_res=\$$3
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++
++} # ac_fn_c_check_header_compile
++
++# ac_fn_c_try_cpp LINENO
++# ----------------------
++# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
++ac_fn_c_try_cpp ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  if { { ac_try="$ac_cpp conftest.$ac_ext"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
++  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
++  ac_status=$?
++  if test -s conftest.err; then
++    grep -v '^ *+' conftest.err >conftest.er1
++    cat conftest.er1 >&5
++    mv -f conftest.er1 conftest.err
++  fi
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } >/dev/null && {
++       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
++       test ! -s conftest.err
++       }; then :
++  ac_retval=0
++else
++  $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++    ac_retval=1
+ fi
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++  return $ac_retval
+-if test "$ac_init_help" = "recursive"; then
+-  # If there are subdirs, report their specific --help.
+-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+-    test -d "$ac_dir" || continue
+-    ac_builddir=.
++} # ac_fn_c_try_cpp
+-case "$ac_dir" in
+-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+-*)
+-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+-  # A ".." for each directory in $ac_dir_suffix.
+-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+-  case $ac_top_builddir_sub in
+-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+-  esac ;;
++# ac_fn_c_try_run LINENO
++# ----------------------
++# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
++# that executables *can* be run.
++ac_fn_c_try_run ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  if { { ac_try="$ac_link"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
+ esac
+-ac_abs_top_builddir=$ac_pwd
+-ac_abs_builddir=$ac_pwd$ac_dir_suffix
+-# for backward compatibility:
+-ac_top_builddir=$ac_top_build_prefix
+-
+-case $srcdir in
+-  .)  # We are building in place.
+-    ac_srcdir=.
+-    ac_top_srcdir=$ac_top_builddir_sub
+-    ac_abs_top_srcdir=$ac_pwd ;;
+-  [\\/]* | ?:[\\/]* )  # Absolute name.
+-    ac_srcdir=$srcdir$ac_dir_suffix;
+-    ac_top_srcdir=$srcdir
+-    ac_abs_top_srcdir=$srcdir ;;
+-  *) # Relative name.
+-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+-    ac_top_srcdir=$ac_top_build_prefix$srcdir
+-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
++  (eval "$ac_link") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
++  { { case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
+ esac
+-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
++  (eval "$ac_try") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; }; then :
++  ac_retval=0
++else
++  $as_echo "$as_me: program exited with status $ac_status" >&5
++       $as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
+-    cd "$ac_dir" || { ac_status=$?; continue; }
+-    # Check for guested configure.
+-    if test -f "$ac_srcdir/configure.gnu"; then
+-      echo &&
+-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+-    elif test -f "$ac_srcdir/configure"; then
+-      echo &&
+-      $SHELL "$ac_srcdir/configure" --help=recursive
+-    else
+-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+-    fi || ac_status=$?
+-    cd "$ac_pwd" || { ac_status=$?; break; }
+-  done
++       ac_retval=$ac_status
+ fi
++  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++  return $ac_retval
+-test -n "$ac_init_help" && exit $ac_status
+-if $ac_init_version; then
+-  cat <<\_ACEOF
+-NuFW configure 2.2.21
+-generated by GNU Autoconf 2.61
++} # ac_fn_c_try_run
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+-This configure script is free software; the Free Software Foundation
+-gives unlimited permission to copy, distribute and modify it.
++# ac_fn_c_check_func LINENO FUNC VAR
++# ----------------------------------
++# Tests whether FUNC exists, setting the cache variable VAR accordingly
++ac_fn_c_check_func ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
++   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
++#define $2 innocuous_$2
++
++/* System header to define __stub macros and hopefully few prototypes,
++    which can conflict with char $2 (); below.
++    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
++    <limits.h> exists even on freestanding compilers.  */
++
++#ifdef __STDC__
++# include <limits.h>
++#else
++# include <assert.h>
++#endif
++
++#undef $2
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char $2 ();
++/* The GNU C library defines this for functions which it implements
++    to always fail with ENOSYS.  Some functions are actually named
++    something starting with __ and the normal name is an alias.  */
++#if defined __stub_$2 || defined __stub___$2
++choke me
++#endif
++
++int
++main ()
++{
++return $2 ();
++  ;
++  return 0;
++}
+ _ACEOF
+-  exit
++if ac_fn_c_try_link "$LINENO"; then :
++  eval "$3=yes"
++else
++  eval "$3=no"
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++fi
++eval ac_res=\$$3
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++
++} # ac_fn_c_check_func
++
++# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
++# ----------------------------------------------------
++# Tries to find if the field MEMBER exists in type AGGR, after including
++# INCLUDES, setting cache variable VAR accordingly.
++ac_fn_c_check_member ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
++$as_echo_n "checking for $2.$3... " >&6; }
++if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++$5
++int
++main ()
++{
++static $2 ac_aggr;
++if (ac_aggr.$3)
++return 0;
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  eval "$4=yes"
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++$5
++int
++main ()
++{
++static $2 ac_aggr;
++if (sizeof ac_aggr.$3)
++return 0;
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  eval "$4=yes"
++else
++  eval "$4=no"
+ fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++eval ac_res=\$$4
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++
++} # ac_fn_c_check_member
++
++# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
++# -------------------------------------------------------
++# Tests whether HEADER exists, giving a warning if it cannot be compiled using
++# the include files in INCLUDES and setting the cache variable VAR
++# accordingly.
++ac_fn_c_check_header_mongrel ()
++{
++  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
++  $as_echo_n "(cached) " >&6
++fi
++eval ac_res=\$$3
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++else
++  # Is the header compilable?
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
++$as_echo_n "checking $2 usability... " >&6; }
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++$4
++#include <$2>
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  ac_header_compiler=yes
++else
++  ac_header_compiler=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
++$as_echo "$ac_header_compiler" >&6; }
++
++# Is the header present?
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
++$as_echo_n "checking $2 presence... " >&6; }
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <$2>
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++  ac_header_preproc=yes
++else
++  ac_header_preproc=no
++fi
++rm -f conftest.err conftest.$ac_ext
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
++$as_echo "$ac_header_preproc" >&6; }
++
++# So?  What about this header?
++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
++  yes:no: )
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
++$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
++$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
++    ;;
++  no:yes:* )
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
++$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
++$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
++$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
++$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
++$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
++( cat <<\_ASBOX
++## ------------------------------------ ##
++## Report this to nufw-devel@nongnu.org ##
++## ------------------------------------ ##
++_ASBOX
++     ) | sed "s/^/$as_me: WARNING:     /" >&2
++    ;;
++esac
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
++$as_echo_n "checking for $2... " >&6; }
++if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
++  $as_echo_n "(cached) " >&6
++else
++  eval "$3=\$ac_header_compiler"
++fi
++eval ac_res=\$$3
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
++$as_echo "$ac_res" >&6; }
++fi
++  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
++
++} # ac_fn_c_check_header_mongrel
+ cat >config.log <<_ACEOF
+ This file contains any messages produced by compilers while
+ running configure, to aid debugging if configure makes a mistake.
+ It was created by NuFW $as_me 2.2.21, which was
+-generated by GNU Autoconf 2.61.  Invocation command line was
++generated by GNU Autoconf 2.64.  Invocation command line was
+   $ $0 $@
+@@ -1691,8 +2165,8 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  echo "PATH: $as_dir"
+-done
++    $as_echo "PATH: $as_dir"
++  done
+ IFS=$as_save_IFS
+ } >&5
+@@ -1726,12 +2200,12 @@
+     | -silent | --silent | --silen | --sile | --sil)
+       continue ;;
+     *\'*)
+-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
++      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+     esac
+     case $ac_pass in
+-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
++    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+     2)
+-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
++      as_fn_append ac_configure_args1 " '$ac_arg'"
+       if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+       else
+@@ -1747,13 +2221,13 @@
+         -* ) ac_must_keep_next=true ;;
+       esac
+       fi
+-      ac_configure_args="$ac_configure_args '$ac_arg'"
++      as_fn_append ac_configure_args " '$ac_arg'"
+       ;;
+     esac
+   done
+ done
+-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
++{ ac_configure_args0=; unset ac_configure_args0;}
++{ ac_configure_args1=; unset ac_configure_args1;}
+ # When interrupted or exit'd, cleanup temporary files, and complete
+ # config.log.  We remove comments because anyway the quotes in there
+@@ -1778,12 +2252,13 @@
+     case $ac_val in #(
+     *${as_nl}*)
+       case $ac_var in #(
+-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
++      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
++$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+       esac
+       case $ac_var in #(
+       _ | IFS | as_nl) ;; #(
+-      *) $as_unset $ac_var ;;
++      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
++      *) { eval $ac_var=; unset $ac_var;} ;;
+       esac ;;
+     esac
+   done
+@@ -1812,9 +2287,9 @@
+     do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
++      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+-      echo "$ac_var='\''$ac_val'\''"
++      $as_echo "$ac_var='\''$ac_val'\''"
+     done | sort
+     echo
+@@ -1829,9 +2304,9 @@
+       do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
++      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+-      echo "$ac_var='\''$ac_val'\''"
++      $as_echo "$ac_var='\''$ac_val'\''"
+       done | sort
+       echo
+     fi
+@@ -1847,64 +2322,69 @@
+       echo
+     fi
+     test "$ac_signal" != 0 &&
+-      echo "$as_me: caught signal $ac_signal"
+-    echo "$as_me: exit $exit_status"
++      $as_echo "$as_me: caught signal $ac_signal"
++    $as_echo "$as_me: exit $exit_status"
+   } >&5
+   rm -f core *.core core.conftest.* &&
+     rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+     exit $exit_status
+ ' 0
+ for ac_signal in 1 2 13 15; do
+-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
++  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+ done
+ ac_signal=0
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -f -r conftest* confdefs.h
++$as_echo "/* confdefs.h */" > confdefs.h
++
+ # Predefined preprocessor variables.
+ cat >>confdefs.h <<_ACEOF
+ #define PACKAGE_NAME "$PACKAGE_NAME"
+ _ACEOF
+-
+ cat >>confdefs.h <<_ACEOF
+ #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+ _ACEOF
+-
+ cat >>confdefs.h <<_ACEOF
+ #define PACKAGE_VERSION "$PACKAGE_VERSION"
+ _ACEOF
+-
+ cat >>confdefs.h <<_ACEOF
+ #define PACKAGE_STRING "$PACKAGE_STRING"
+ _ACEOF
+-
+ cat >>confdefs.h <<_ACEOF
+ #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+ _ACEOF
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_URL "$PACKAGE_URL"
++_ACEOF
++
+ # Let the site file select an alternate cache file if it wants to.
+-# Prefer explicitly selected file to automatically selected ones.
++# Prefer an explicitly selected file to automatically selected ones.
++ac_site_file1=NONE
++ac_site_file2=NONE
+ if test -n "$CONFIG_SITE"; then
+-  set x "$CONFIG_SITE"
++  ac_site_file1=$CONFIG_SITE
+ elif test "x$prefix" != xNONE; then
+-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
++  ac_site_file1=$prefix/share/config.site
++  ac_site_file2=$prefix/etc/config.site
+ else
+-  set x "$ac_default_prefix/share/config.site" \
+-      "$ac_default_prefix/etc/config.site"
++  ac_site_file1=$ac_default_prefix/share/config.site
++  ac_site_file2=$ac_default_prefix/etc/config.site
+ fi
+-shift
+-for ac_site_file
++for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+ do
++  test "x$ac_site_file" = xNONE && continue
+   if test -r "$ac_site_file"; then
+-    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+-echo "$as_me: loading site script $ac_site_file" >&6;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
++$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+     sed 's/^/| /' "$ac_site_file" >&5
+     . "$ac_site_file"
+   fi
+@@ -1914,16 +2394,16 @@
+   # Some versions of bash will fail to source /dev/null (special
+   # files actually), so we avoid doing that.
+   if test -f "$cache_file"; then
+-    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+-echo "$as_me: loading cache $cache_file" >&6;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
++$as_echo "$as_me: loading cache $cache_file" >&6;}
+     case $cache_file in
+       [\\/]* | ?:[\\/]* ) . "$cache_file";;
+       *)                      . "./$cache_file";;
+     esac
+   fi
+ else
+-  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+-echo "$as_me: creating cache $cache_file" >&6;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
++$as_echo "$as_me: creating cache $cache_file" >&6;}
+   >$cache_file
+ fi
+@@ -1937,68 +2417,56 @@
+   eval ac_new_val=\$ac_env_${ac_var}_value
+   case $ac_old_set,$ac_new_set in
+     set,)
+-      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
++      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
++$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+       ac_cache_corrupted=: ;;
+     ,set)
+-      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
++      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
++$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+       ac_cache_corrupted=: ;;
+     ,);;
+     *)
+       if test "x$ac_old_val" != "x$ac_new_val"; then
+-      { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+-      { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+-echo "$as_me:   former value:  $ac_old_val" >&2;}
+-      { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+-echo "$as_me:   current value: $ac_new_val" >&2;}
+-      ac_cache_corrupted=:
++      # differences in whitespace do not lead to failure.
++      ac_old_val_w=`echo x $ac_old_val`
++      ac_new_val_w=`echo x $ac_new_val`
++      if test "$ac_old_val_w" != "$ac_new_val_w"; then
++        { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
++$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
++        ac_cache_corrupted=:
++      else
++        { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
++$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
++        eval $ac_var=\$ac_old_val
++      fi
++      { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
++$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
++      { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
++$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+       fi;;
+   esac
+   # Pass precious variables to config.status.
+   if test "$ac_new_set" = set; then
+     case $ac_new_val in
+-    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
++    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+     *) ac_arg=$ac_var=$ac_new_val ;;
+     esac
+     case " $ac_configure_args " in
+       *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
++      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+     esac
+   fi
+ done
+ if $ac_cache_corrupted; then
+-  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+-  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-
++  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
++$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
++  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
++fi
++## -------------------- ##
++## Main body of script. ##
++## -------------------- ##
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+@@ -2020,10 +2488,10 @@
+ if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}gcc; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_CC+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+@@ -2033,25 +2501,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_CC="${ac_tool_prefix}gcc"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  { echo "$as_me:$LINENO: result: $CC" >&5
+-echo "${ECHO_T}$CC" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -2060,10 +2528,10 @@
+   ac_ct_CC=$CC
+   # Extract the first word of "gcc", so it can be a program name with args.
+ set dummy gcc; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_CC"; then
+   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+@@ -2073,25 +2541,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_CC="gcc"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_CC=$ac_cv_prog_ac_ct_CC
+ if test -n "$ac_ct_CC"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+-echo "${ECHO_T}$ac_ct_CC" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
++$as_echo "$ac_ct_CC" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_CC" = x; then
+@@ -2099,12 +2567,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     CC=$ac_ct_CC
+@@ -2117,10 +2581,10 @@
+           if test -n "$ac_tool_prefix"; then
+     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}cc; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_CC+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+@@ -2130,25 +2594,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_CC="${ac_tool_prefix}cc"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  { echo "$as_me:$LINENO: result: $CC" >&5
+-echo "${ECHO_T}$CC" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -2157,10 +2621,10 @@
+ if test -z "$CC"; then
+   # Extract the first word of "cc", so it can be a program name with args.
+ set dummy cc; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_CC+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+@@ -2171,18 +2635,18 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+        continue
+      fi
+     ac_cv_prog_CC="cc"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ if test $ac_prog_rejected = yes; then
+@@ -2201,11 +2665,11 @@
+ fi
+ CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  { echo "$as_me:$LINENO: result: $CC" >&5
+-echo "${ECHO_T}$CC" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -2216,10 +2680,10 @@
+   do
+     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+ set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_CC+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_CC+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+@@ -2229,25 +2693,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  { echo "$as_me:$LINENO: result: $CC" >&5
+-echo "${ECHO_T}$CC" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
++$as_echo "$CC" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -2260,10 +2724,10 @@
+ do
+   # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_CC"; then
+   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+@@ -2273,25 +2737,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_CC="$ac_prog"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_CC=$ac_cv_prog_ac_ct_CC
+ if test -n "$ac_ct_CC"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+-echo "${ECHO_T}$ac_ct_CC" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
++$as_echo "$ac_ct_CC" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -2303,12 +2767,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     CC=$ac_ct_CC
+@@ -2318,98 +2778,82 @@
+ fi
+-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: no acceptable C compiler found in \$PATH
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error "no acceptable C compiler found in \$PATH
++See \`config.log' for more details." "$LINENO" 5; }
+ # Provide some information about the compiler.
+-echo "$as_me:$LINENO: checking for C compiler version" >&5
+-ac_compiler=`set X $ac_compile; echo $2`
+-{ (ac_try="$ac_compiler --version >&5"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compiler --version >&5") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }
+-{ (ac_try="$ac_compiler -v >&5"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compiler -v >&5") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }
+-{ (ac_try="$ac_compiler -V >&5"
++$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
++set X $ac_compile
++ac_compiler=$2
++for ac_option in --version -v -V -qversion; do
++  { { ac_try="$ac_compiler $ac_option >&5"
+ case "(($ac_try" in
+   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+   *) ac_try_echo=$ac_try;;
+ esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compiler -V >&5") 2>&5
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
++  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }
++  if test -s conftest.err; then
++    sed '10a\
++... rest of stderr output deleted ...
++         10q' conftest.err >conftest.er1
++    cat conftest.er1 >&5
++    rm -f conftest.er1 conftest.err
++  fi
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }
++done
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+-
++#include <stdio.h>
+ int
+ main ()
+ {
++FILE *f = fopen ("conftest.out", "w");
++ return ferror (f) || fclose (f) != 0;
+   ;
+   return 0;
+ }
+ _ACEOF
+ ac_clean_files_save=$ac_clean_files
+-ac_clean_files="$ac_clean_files a.out a.exe b.out"
++ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+ # Try to create an executable without -o first, disregard a.out.
+ # It will help us diagnose broken compilers, and finding out an intuition
+ # of exeext.
+-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+-#
+-# List of possible output files, starting from the most likely.
+-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+-# only as a last resort.  b.out is created by i960 compilers.
+-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+-#
+-# The IRIX 6 linker writes into existing files which may not be
+-# executable, retaining their permissions.  Remove them first so a
+-# subsequent execution test works.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
++$as_echo_n "checking for C compiler default output file name... " >&6; }
++ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
++
++# The possible output files:
++ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
++
+ ac_rmfiles=
+ for ac_file in $ac_files
+ do
+   case $ac_file in
+-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+     * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+   esac
+ done
+ rm -f $ac_rmfiles
+-if { (ac_try="$ac_link_default"
++if { { ac_try="$ac_link_default"
+ case "(($ac_try" in
+   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+   *) ac_try_echo=$ac_try;;
+ esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
+   (eval "$ac_link_default") 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then :
+   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+ # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+ # in a Makefile.  We should not override ac_cv_exeext if it was cached,
+@@ -2419,14 +2863,14 @@
+ do
+   test -f "$ac_file" || continue
+   case $ac_file in
+-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+       ;;
+     [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+     *.* )
+-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
++      if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+@@ -2445,78 +2889,75 @@
+ else
+   ac_file=''
+ fi
+-
+-{ echo "$as_me:$LINENO: result: $ac_file" >&5
+-echo "${ECHO_T}$ac_file" >&6; }
+-if test -z "$ac_file"; then
+-  echo "$as_me: failed program was:" >&5
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
++$as_echo "$ac_file" >&6; }
++if test -z "$ac_file"; then :
++  $as_echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C compiler cannot create executables
+-See \`config.log' for more details." >&2;}
+-   { (exit 77); exit 77; }; }
++{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++{ as_fn_set_status 77
++as_fn_error "C compiler cannot create executables
++See \`config.log' for more details." "$LINENO" 5; }; }
+ fi
+-
+ ac_exeext=$ac_cv_exeext
+ # Check that the compiler produces executables we can run.  If not, either
+ # the compiler is broken, or we cross compile.
+-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
++$as_echo_n "checking whether the C compiler works... " >&6; }
+ # If not cross compiling, check that we can run a simple program.
+ if test "$cross_compiling" != yes; then
+   if { ac_try='./$ac_file'
+-  { (case "(($ac_try" in
++  { { case "(($ac_try" in
+   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+   *) ac_try_echo=$ac_try;;
+ esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
+   (eval "$ac_try") 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; }; then
+     cross_compiling=no
+   else
+     if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+     else
+-      { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
++      { { $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 C compiled programs.
+ If you meant to cross compile, use \`--host'.
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run C compiled programs.
+-If you meant to cross compile, use \`--host'.
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++See \`config.log' for more details." "$LINENO" 5; }
+     fi
+   fi
+ fi
+-{ echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+-rm -f a.out a.exe conftest$ac_cv_exeext b.out
++rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+ ac_clean_files=$ac_clean_files_save
+ # Check that the compiler produces executables we can run.  If not, either
+ # the compiler is broken, or we cross compile.
+-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+-echo "${ECHO_T}$cross_compiling" >&6; }
+-
+-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+-if { (ac_try="$ac_link"
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
++$as_echo_n "checking whether we are cross compiling... " >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
++$as_echo "$cross_compiling" >&6; }
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
++$as_echo_n "checking for suffix of executables... " >&6; }
++if { { ac_try="$ac_link"
+ case "(($ac_try" in
+   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+   *) ac_try_echo=$ac_try;;
+ esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
+   (eval "$ac_link") 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then :
+   # If both `conftest.exe' and `conftest' are `present' (well, observable)
+ # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+ # work properly (i.e., refer to `conftest.exe'), while it won't with
+@@ -2524,37 +2965,31 @@
+ for ac_file in conftest.exe conftest conftest.*; do
+   test -f "$ac_file" || continue
+   case $ac_file in
+-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         break;;
+     * ) break;;
+   esac
+ done
+ else
+-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++  { { $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 compute suffix of executables: cannot compile and link
++See \`config.log' for more details." "$LINENO" 5; }
+ fi
+-
+ rm -f conftest$ac_cv_exeext
+-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+-echo "${ECHO_T}$ac_cv_exeext" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
++$as_echo "$ac_cv_exeext" >&6; }
+ rm -f conftest.$ac_ext
+ EXEEXT=$ac_cv_exeext
+ ac_exeext=$EXEEXT
+-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+-if test "${ac_cv_objext+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
++$as_echo_n "checking for suffix of object files... " >&6; }
++if test "${ac_cv_objext+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -2566,51 +3001,46 @@
+ }
+ _ACEOF
+ rm -f conftest.o conftest.obj
+-if { (ac_try="$ac_compile"
++if { { ac_try="$ac_compile"
+ case "(($ac_try" in
+   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+   *) ac_try_echo=$ac_try;;
+ esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
++$as_echo "$ac_try_echo"; } >&5
+   (eval "$ac_compile") 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then :
+   for ac_file in conftest.o conftest.obj conftest.*; do
+   test -f "$ac_file" || continue;
+   case $ac_file in
+-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+        break;;
+   esac
+ done
+ else
+-  echo "$as_me: failed program was:" >&5
++  $as_echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot compute suffix of object files: cannot compile
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++{ { $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 compute suffix of object files: cannot compile
++See \`config.log' for more details." "$LINENO" 5; }
+ fi
+-
+ rm -f conftest.$ac_cv_objext conftest.$ac_ext
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+-echo "${ECHO_T}$ac_cv_objext" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
++$as_echo "$ac_cv_objext" >&6; }
+ OBJEXT=$ac_cv_objext
+ ac_objext=$OBJEXT
+-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+-if test "${ac_cv_c_compiler_gnu+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
++$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
++if test "${ac_cv_c_compiler_gnu+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -2624,54 +3054,34 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_compiler_gnu=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_compiler_gnu=no
++  ac_compiler_gnu=no
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_c_compiler_gnu=$ac_compiler_gnu
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+-GCC=`test $ac_compiler_gnu = yes && echo yes`
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
++$as_echo "$ac_cv_c_compiler_gnu" >&6; }
++if test $ac_compiler_gnu = yes; then
++  GCC=yes
++else
++  GCC=
++fi
+ ac_test_CFLAGS=${CFLAGS+set}
+ ac_save_CFLAGS=$CFLAGS
+-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_cc_g+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
++$as_echo_n "checking whether $CC accepts -g... " >&6; }
++if test "${ac_cv_prog_cc_g+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_save_c_werror_flag=$ac_c_werror_flag
+    ac_c_werror_flag=yes
+    ac_cv_prog_cc_g=no
+    CFLAGS="-g"
+-   cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -2682,34 +3092,11 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_prog_cc_g=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      CFLAGS=""
+-      cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  CFLAGS=""
++      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -2720,35 +3107,12 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  :
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++if ac_fn_c_try_compile "$LINENO"; then :
+-      ac_c_werror_flag=$ac_save_c_werror_flag
++else
++  ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+-       cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -2759,42 +3123,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_prog_cc_g=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    ac_c_werror_flag=$ac_save_c_werror_flag
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
++$as_echo "$ac_cv_prog_cc_g" >&6; }
+ if test "$ac_test_CFLAGS" = set; then
+   CFLAGS=$ac_save_CFLAGS
+ elif test $ac_cv_prog_cc_g = yes; then
+@@ -2810,18 +3150,14 @@
+     CFLAGS=
+   fi
+ fi
+-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_cc_c89+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
++$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
++if test "${ac_cv_prog_cc_c89+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_cv_prog_cc_c89=no
+ ac_save_CC=$CC
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdarg.h>
+ #include <stdio.h>
+@@ -2878,31 +3214,9 @@
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+ do
+   CC="$ac_save_CC $ac_arg"
+-  rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++  if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_prog_cc_c89=$ac_arg
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext
+   test "x$ac_cv_prog_cc_c89" != "xno" && break
+ done
+@@ -2913,17 +3227,19 @@
+ # AC_CACHE_VAL
+ case "x$ac_cv_prog_cc_c89" in
+   x)
+-    { echo "$as_me:$LINENO: result: none needed" >&5
+-echo "${ECHO_T}none needed" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
++$as_echo "none needed" >&6; } ;;
+   xno)
+-    { echo "$as_me:$LINENO: result: unsupported" >&5
+-echo "${ECHO_T}unsupported" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
++$as_echo "unsupported" >&6; } ;;
+   *)
+     CC="$CC $ac_cv_prog_cc_c89"
+-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
++$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+ esac
++if test "x$ac_cv_prog_cc_c89" != xno; then :
++fi
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+@@ -2935,20 +3251,18 @@
+ # check for a ISO C99 compiler
+-   case $ac_cv_prog_cc_stdc in
+-  no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;;
+-  *) { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5
+-echo $ECHO_N "checking for $CC option to accept ISO C99... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_cc_c99+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++   case $ac_cv_prog_cc_stdc in #(
++  no) :
++    ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
++  *) :
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
++$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
++if test "${ac_cv_prog_cc_c99+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_cv_prog_cc_c99=no
+ ac_save_CC=$CC
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdarg.h>
+ #include <stdbool.h>
+@@ -3087,34 +3401,12 @@
+   return 0;
+ }
+ _ACEOF
+-for ac_arg in '' -std=gnu99 -c99 -qlanglvl=extc99
++for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99
+ do
+   CC="$ac_save_CC $ac_arg"
+-  rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++  if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_prog_cc_c99=$ac_arg
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext
+   test "x$ac_cv_prog_cc_c99" != "xno" && break
+ done
+@@ -3125,31 +3417,27 @@
+ # AC_CACHE_VAL
+ case "x$ac_cv_prog_cc_c99" in
+   x)
+-    { echo "$as_me:$LINENO: result: none needed" >&5
+-echo "${ECHO_T}none needed" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
++$as_echo "none needed" >&6; } ;;
+   xno)
+-    { echo "$as_me:$LINENO: result: unsupported" >&5
+-echo "${ECHO_T}unsupported" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
++$as_echo "unsupported" >&6; } ;;
+   *)
+     CC="$CC $ac_cv_prog_cc_c99"
+-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5
+-echo "${ECHO_T}$ac_cv_prog_cc_c99" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
++$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
+ esac
+-if test "x$ac_cv_prog_cc_c99" != xno; then
++if test "x$ac_cv_prog_cc_c99" != xno; then :
+   ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+ else
+-  { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_cc_c89+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
++$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
++if test "${ac_cv_prog_cc_c89+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_cv_prog_cc_c89=no
+ ac_save_CC=$CC
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdarg.h>
+ #include <stdio.h>
+@@ -3206,31 +3494,9 @@
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+ do
+   CC="$ac_save_CC $ac_arg"
+-  rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++  if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_prog_cc_c89=$ac_arg
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext
+   test "x$ac_cv_prog_cc_c89" != "xno" && break
+ done
+@@ -3241,54 +3507,50 @@
+ # AC_CACHE_VAL
+ case "x$ac_cv_prog_cc_c89" in
+   x)
+-    { echo "$as_me:$LINENO: result: none needed" >&5
+-echo "${ECHO_T}none needed" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
++$as_echo "none needed" >&6; } ;;
+   xno)
+-    { echo "$as_me:$LINENO: result: unsupported" >&5
+-echo "${ECHO_T}unsupported" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
++$as_echo "unsupported" >&6; } ;;
+   *)
+     CC="$CC $ac_cv_prog_cc_c89"
+-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
++$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+ esac
+-if test "x$ac_cv_prog_cc_c89" != xno; then
++if test "x$ac_cv_prog_cc_c89" != xno; then :
+   ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+ else
+   ac_cv_prog_cc_stdc=no
+ fi
+-
+ fi
+-
+  ;;
+ esac
+-  { echo "$as_me:$LINENO: checking for $CC option to accept ISO Standard C" >&5
+-echo $ECHO_N "checking for $CC option to accept ISO Standard C... $ECHO_C" >&6; }
+-  if test "${ac_cv_prog_cc_stdc+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-fi
+-
+-  case $ac_cv_prog_cc_stdc in
+-  no) { echo "$as_me:$LINENO: result: unsupported" >&5
+-echo "${ECHO_T}unsupported" >&6; } ;;
+-  '') { echo "$as_me:$LINENO: result: none needed" >&5
+-echo "${ECHO_T}none needed" >&6; } ;;
+-  *) { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6; } ;;
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
++$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
++  if test "${ac_cv_prog_cc_stdc+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++fi
++
++  case $ac_cv_prog_cc_stdc in #(
++  no) :
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
++$as_echo "unsupported" >&6; } ;; #(
++  '') :
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
++$as_echo "none needed" >&6; } ;; #(
++  *) :
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
++$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
+ esac
+-
+-{ echo "$as_me:$LINENO: checking for an ANSI C99-conforming __func__" >&5
+-echo $ECHO_N "checking for an ANSI C99-conforming __func__... $ECHO_C" >&6; }
+-if test "${ac_cv_cpp_func+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C99-conforming __func__" >&5
++$as_echo_n "checking for an ANSI C99-conforming __func__... " >&6; }
++if test "${ac_cv_cpp_func+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -3299,33 +3561,10 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_cpp_func=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -3336,56 +3575,29 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_cpp_func=__FUNCTION__
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_cpp_func=no
++  ac_cv_cpp_func=no
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_cpp_func" >&5
+-echo "${ECHO_T}$ac_cv_cpp_func" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_func" >&5
++$as_echo "$ac_cv_cpp_func" >&6; }
+ if test $ac_cv_cpp_func = yes; then
+-cat >>confdefs.h <<\_ACEOF
+-#define __PRELUDE_FUNC__ __func__
+-_ACEOF
++$as_echo "#define __PRELUDE_FUNC__ __func__" >>confdefs.h
+ elif test $ac_cv_cpp_func = __FUNCTION__; then
+-cat >>confdefs.h <<\_ACEOF
+-#define __PRELUDE_FUNC__ __FUNCTION__
+-_ACEOF
++$as_echo "#define __PRELUDE_FUNC__ __FUNCTION__" >>confdefs.h
+ elif test $ac_cv_cpp_func = no; then
+-cat >>confdefs.h <<\_ACEOF
+-#define __PRELUDE_FUNC__ ""
+-_ACEOF
++$as_echo "#define __PRELUDE_FUNC__ \"\"" >>confdefs.h
+ fi
+@@ -3393,14 +3605,14 @@
+ case `pwd` in
+   *\ * | *\   *)
+-    { echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+-echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
++$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+ esac
+-macro_version='2.2.4'
+-macro_revision='1.2976'
++macro_version='2.2.6'
++macro_revision='1.3012'
+@@ -3418,24 +3630,16 @@
+ ac_aux_dir=
+ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+-  if test -f "$ac_dir/install-sh"; then
+-    ac_aux_dir=$ac_dir
+-    ac_install_sh="$ac_aux_dir/install-sh -c"
+-    break
+-  elif test -f "$ac_dir/install.sh"; then
+-    ac_aux_dir=$ac_dir
+-    ac_install_sh="$ac_aux_dir/install.sh -c"
+-    break
+-  elif test -f "$ac_dir/shtool"; then
+-    ac_aux_dir=$ac_dir
+-    ac_install_sh="$ac_aux_dir/shtool install -c"
+-    break
+-  fi
++  for ac_t in install-sh install.sh shtool; do
++    if test -f "$ac_dir/$ac_t"; then
++      ac_aux_dir=$ac_dir
++      ac_install_sh="$ac_aux_dir/$ac_t -c"
++      break 2
++    fi
++  done
+ done
+ if test -z "$ac_aux_dir"; then
+-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+-echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+ fi
+ # These three variables are undocumented and unsupported,
+@@ -3449,35 +3653,27 @@
+ # Make sure we can run config.sub.
+ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+-  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+-   { (exit 1); exit 1; }; }
+-
+-{ echo "$as_me:$LINENO: checking build system type" >&5
+-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+-if test "${ac_cv_build+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
++$as_echo_n "checking build system type... " >&6; }
++if test "${ac_cv_build+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_build_alias=$build_alias
+ test "x$ac_build_alias" = x &&
+   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+ test "x$ac_build_alias" = x &&
+-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+-  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+-echo "${ECHO_T}$ac_cv_build" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
++$as_echo "$ac_cv_build" >&6; }
+ case $ac_cv_build in
+ *-*-*) ;;
+-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+-echo "$as_me: error: invalid value of canonical build" >&2;}
+-   { (exit 1); exit 1; }; };;
++*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+ esac
+ build=$ac_cv_build
+ ac_save_IFS=$IFS; IFS='-'
+@@ -3493,28 +3689,24 @@
+ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+-{ echo "$as_me:$LINENO: checking host system type" >&5
+-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+-if test "${ac_cv_host+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
++$as_echo_n "checking host system type... " >&6; }
++if test "${ac_cv_host+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test "x$host_alias" = x; then
+   ac_cv_host=$ac_cv_build
+ else
+   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+-   { (exit 1); exit 1; }; }
++    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+ fi
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+-echo "${ECHO_T}$ac_cv_host" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
++$as_echo "$ac_cv_host" >&6; }
+ case $ac_cv_host in
+ *-*-*) ;;
+-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+-echo "$as_me: error: invalid value of canonical host" >&2;}
+-   { (exit 1); exit 1; }; };;
++*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+ esac
+ host=$ac_cv_host
+ ac_save_IFS=$IFS; IFS='-'
+@@ -3530,51 +3722,46 @@
+ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+-if test "${ac_cv_path_SED+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
++$as_echo_n "checking for a sed that does not truncate output... " >&6; }
++if test "${ac_cv_path_SED+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+      for ac_i in 1 2 3 4 5 6 7; do
+        ac_script="$ac_script$as_nl$ac_script"
+      done
+-     echo "$ac_script" | sed 99q >conftest.sed
+-     $as_unset ac_script || ac_script=
+-     # Extract the first word of "sed gsed" to use in msg output
+-if test -z "$SED"; then
+-set dummy sed gsed; ac_prog_name=$2
+-if test "${ac_cv_path_SED+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
++     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
++     { ac_script=; unset ac_script;}
++     if test -z "$SED"; then
+   ac_path_SED_found=false
+-# Loop through the user's path and test for each of PROGNAME-LIST
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++  # Loop through the user's path and test for each of PROGNAME-LIST
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_prog in sed gsed; do
+-  for ac_exec_ext in '' $ac_executable_extensions; do
+-    ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+-    { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+-    # Check for GNU ac_path_SED and select it if it is found.
++    for ac_prog in sed gsed; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
++      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
++      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
++# Check for GNU ac_path_SED and select it if it is found.
+   # Check for GNU $ac_path_SED
+ case `"$ac_path_SED" --version 2>&1` in
+ *GNU*)
+   ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+ *)
+   ac_count=0
+-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
++  $as_echo_n 0123456789 >"conftest.in"
+   while :
+   do
+     cat "conftest.in" "conftest.in" >"conftest.tmp"
+     mv "conftest.tmp" "conftest.in"
+     cp "conftest.in" "conftest.nl"
+-    echo '' >> "conftest.nl"
++    $as_echo '' >> "conftest.nl"
+     "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+-    ac_count=`expr $ac_count + 1`
++    as_fn_arith $ac_count + 1 && ac_count=$as_val
+     if test $ac_count -gt ${ac_path_SED_max-0}; then
+       # Best one so far, save it but keep looking for a better one
+       ac_cv_path_SED="$ac_path_SED"
+@@ -3586,31 +3773,21 @@
+   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+ esac
+-
+-    $ac_path_SED_found && break 3
++      $ac_path_SED_found && break 3
++    done
++  done
+   done
+-done
+-
+-done
+ IFS=$as_save_IFS
+-
+-
+-fi
+-
+-SED="$ac_cv_path_SED"
+-if test -z "$SED"; then
+-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in \$PATH" >&5
+-echo "$as_me: error: no acceptable $ac_prog_name could be found in \$PATH" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+-
++  if test -z "$ac_cv_path_SED"; then
++    as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
++  fi
+ else
+   ac_cv_path_SED=$SED
+ fi
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
+-echo "${ECHO_T}$ac_cv_path_SED" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
++$as_echo "$ac_cv_path_SED" >&6; }
+  SED="$ac_cv_path_SED"
+   rm -f conftest.sed
+@@ -3627,45 +3804,40 @@
+-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+-if test "${ac_cv_path_GREP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  # Extract the first word of "grep ggrep" to use in msg output
+-if test -z "$GREP"; then
+-set dummy grep ggrep; ac_prog_name=$2
+-if test "${ac_cv_path_GREP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
++$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
++if test "${ac_cv_path_GREP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
++  if test -z "$GREP"; then
+   ac_path_GREP_found=false
+-# Loop through the user's path and test for each of PROGNAME-LIST
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++  # Loop through the user's path and test for each of PROGNAME-LIST
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_prog in grep ggrep; do
+-  for ac_exec_ext in '' $ac_executable_extensions; do
+-    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+-    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+-    # Check for GNU ac_path_GREP and select it if it is found.
++    for ac_prog in grep ggrep; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
++      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
++      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
++# Check for GNU ac_path_GREP and select it if it is found.
+   # Check for GNU $ac_path_GREP
+ case `"$ac_path_GREP" --version 2>&1` in
+ *GNU*)
+   ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+ *)
+   ac_count=0
+-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
++  $as_echo_n 0123456789 >"conftest.in"
+   while :
+   do
+     cat "conftest.in" "conftest.in" >"conftest.tmp"
+     mv "conftest.tmp" "conftest.in"
+     cp "conftest.in" "conftest.nl"
+-    echo 'GREP' >> "conftest.nl"
++    $as_echo 'GREP' >> "conftest.nl"
+     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+-    ac_count=`expr $ac_count + 1`
++    as_fn_arith $ac_count + 1 && ac_count=$as_val
+     if test $ac_count -gt ${ac_path_GREP_max-0}; then
+       # Best one so far, save it but keep looking for a better one
+       ac_cv_path_GREP="$ac_path_GREP"
+@@ -3677,77 +3849,61 @@
+   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+ esac
+-
+-    $ac_path_GREP_found && break 3
++      $ac_path_GREP_found && break 3
++    done
++  done
+   done
+-done
+-
+-done
+ IFS=$as_save_IFS
+-
+-
+-fi
+-
+-GREP="$ac_cv_path_GREP"
+-if test -z "$GREP"; then
+-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+-
++  if test -z "$ac_cv_path_GREP"; then
++    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
++  fi
+ else
+   ac_cv_path_GREP=$GREP
+ fi
+-
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
++$as_echo "$ac_cv_path_GREP" >&6; }
+  GREP="$ac_cv_path_GREP"
+-{ echo "$as_me:$LINENO: checking for egrep" >&5
+-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+-if test "${ac_cv_path_EGREP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
++$as_echo_n "checking for egrep... " >&6; }
++if test "${ac_cv_path_EGREP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+    then ac_cv_path_EGREP="$GREP -E"
+    else
+-     # Extract the first word of "egrep" to use in msg output
+-if test -z "$EGREP"; then
+-set dummy egrep; ac_prog_name=$2
+-if test "${ac_cv_path_EGREP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
++     if test -z "$EGREP"; then
+   ac_path_EGREP_found=false
+-# Loop through the user's path and test for each of PROGNAME-LIST
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++  # Loop through the user's path and test for each of PROGNAME-LIST
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_prog in egrep; do
+-  for ac_exec_ext in '' $ac_executable_extensions; do
+-    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+-    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+-    # Check for GNU ac_path_EGREP and select it if it is found.
++    for ac_prog in egrep; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
++      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
++      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
++# Check for GNU ac_path_EGREP and select it if it is found.
+   # Check for GNU $ac_path_EGREP
+ case `"$ac_path_EGREP" --version 2>&1` in
+ *GNU*)
+   ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+ *)
+   ac_count=0
+-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
++  $as_echo_n 0123456789 >"conftest.in"
+   while :
+   do
+     cat "conftest.in" "conftest.in" >"conftest.tmp"
+     mv "conftest.tmp" "conftest.in"
+     cp "conftest.in" "conftest.nl"
+-    echo 'EGREP' >> "conftest.nl"
++    $as_echo 'EGREP' >> "conftest.nl"
+     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+-    ac_count=`expr $ac_count + 1`
++    as_fn_arith $ac_count + 1 && ac_count=$as_val
+     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+       # Best one so far, save it but keep looking for a better one
+       ac_cv_path_EGREP="$ac_path_EGREP"
+@@ -3759,78 +3915,62 @@
+   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+ esac
+-
+-    $ac_path_EGREP_found && break 3
++      $ac_path_EGREP_found && break 3
++    done
++  done
+   done
+-done
+-
+-done
+ IFS=$as_save_IFS
+-
+-
+-fi
+-
+-EGREP="$ac_cv_path_EGREP"
+-if test -z "$EGREP"; then
+-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+-
++  if test -z "$ac_cv_path_EGREP"; then
++    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
++  fi
+ else
+   ac_cv_path_EGREP=$EGREP
+ fi
+-
+    fi
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
++$as_echo "$ac_cv_path_EGREP" >&6; }
+  EGREP="$ac_cv_path_EGREP"
+-{ echo "$as_me:$LINENO: checking for fgrep" >&5
+-echo $ECHO_N "checking for fgrep... $ECHO_C" >&6; }
+-if test "${ac_cv_path_FGREP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
++$as_echo_n "checking for fgrep... " >&6; }
++if test "${ac_cv_path_FGREP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+    then ac_cv_path_FGREP="$GREP -F"
+    else
+-     # Extract the first word of "fgrep" to use in msg output
+-if test -z "$FGREP"; then
+-set dummy fgrep; ac_prog_name=$2
+-if test "${ac_cv_path_FGREP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
++     if test -z "$FGREP"; then
+   ac_path_FGREP_found=false
+-# Loop through the user's path and test for each of PROGNAME-LIST
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++  # Loop through the user's path and test for each of PROGNAME-LIST
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_prog in fgrep; do
+-  for ac_exec_ext in '' $ac_executable_extensions; do
+-    ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+-    { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+-    # Check for GNU ac_path_FGREP and select it if it is found.
++    for ac_prog in fgrep; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
++      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
++      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
++# Check for GNU ac_path_FGREP and select it if it is found.
+   # Check for GNU $ac_path_FGREP
+ case `"$ac_path_FGREP" --version 2>&1` in
+ *GNU*)
+   ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+ *)
+   ac_count=0
+-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
++  $as_echo_n 0123456789 >"conftest.in"
+   while :
+   do
+     cat "conftest.in" "conftest.in" >"conftest.tmp"
+     mv "conftest.tmp" "conftest.in"
+     cp "conftest.in" "conftest.nl"
+-    echo 'FGREP' >> "conftest.nl"
++    $as_echo 'FGREP' >> "conftest.nl"
+     "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+-    ac_count=`expr $ac_count + 1`
++    as_fn_arith $ac_count + 1 && ac_count=$as_val
+     if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+       # Best one so far, save it but keep looking for a better one
+       ac_cv_path_FGREP="$ac_path_FGREP"
+@@ -3842,33 +3982,22 @@
+   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+ esac
+-
+-    $ac_path_FGREP_found && break 3
++      $ac_path_FGREP_found && break 3
++    done
++  done
+   done
+-done
+-
+-done
+ IFS=$as_save_IFS
+-
+-
+-fi
+-
+-FGREP="$ac_cv_path_FGREP"
+-if test -z "$FGREP"; then
+-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+-   { (exit 1); exit 1; }; }
+-fi
+-
++  if test -z "$ac_cv_path_FGREP"; then
++    as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
++  fi
+ else
+   ac_cv_path_FGREP=$FGREP
+ fi
+-
+    fi
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
+-echo "${ECHO_T}$ac_cv_path_FGREP" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
++$as_echo "$ac_cv_path_FGREP" >&6; }
+  FGREP="$ac_cv_path_FGREP"
+@@ -3893,7 +4022,7 @@
+ # Check whether --with-gnu-ld was given.
+-if test "${with_gnu_ld+set}" = set; then
++if test "${with_gnu_ld+set}" = set; then :
+   withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+ else
+   with_gnu_ld=no
+@@ -3902,8 +4031,8 @@
+ ac_prog=ld
+ if test "$GCC" = yes; then
+   # Check if gcc -print-prog-name=ld gives a path.
+-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
++$as_echo_n "checking for ld used by $CC... " >&6; }
+   case $host in
+   *-*-mingw*)
+     # gcc leaves a trailing carriage return which upsets mingw
+@@ -3932,14 +4061,14 @@
+     ;;
+   esac
+ elif test "$with_gnu_ld" = yes; then
+-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
++$as_echo_n "checking for GNU ld... " >&6; }
+ else
+-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
++$as_echo_n "checking for non-GNU ld... " >&6; }
+ fi
+-if test "${lt_cv_path_LD+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++if test "${lt_cv_path_LD+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -z "$LD"; then
+   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+@@ -3969,19 +4098,17 @@
+ LD="$lt_cv_path_LD"
+ if test -n "$LD"; then
+-  { echo "$as_me:$LINENO: result: $LD" >&5
+-echo "${ECHO_T}$LD" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
++$as_echo "$LD" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+-   { (exit 1); exit 1; }; }
+-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+-if test "${lt_cv_prog_gnu_ld+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
++$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
++if test "${lt_cv_prog_gnu_ld+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   # I'd rather use --version here, but apparently some GNU lds only accept -v.
+ case `$LD -v 2>&1 </dev/null` in
+@@ -3993,8 +4120,8 @@
+   ;;
+ esac
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
++$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+ with_gnu_ld=$lt_cv_prog_gnu_ld
+@@ -4005,10 +4132,10 @@
+-{ echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+-echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6; }
+-if test "${lt_cv_path_NM+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
++$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
++if test "${lt_cv_path_NM+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$NM"; then
+   # Let the user override the test.
+@@ -4054,8 +4181,8 @@
+   : ${lt_cv_path_NM=no}
+ fi
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
++$as_echo "$lt_cv_path_NM" >&6; }
+ if test "$lt_cv_path_NM" != "no"; then
+   NM="$lt_cv_path_NM"
+ else
+@@ -4065,10 +4192,10 @@
+   do
+     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+ set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_DUMPBIN+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$DUMPBIN"; then
+   ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+@@ -4078,25 +4205,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ DUMPBIN=$ac_cv_prog_DUMPBIN
+ if test -n "$DUMPBIN"; then
+-  { echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+-echo "${ECHO_T}$DUMPBIN" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
++$as_echo "$DUMPBIN" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -4109,10 +4236,10 @@
+ do
+   # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_DUMPBIN"; then
+   ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+@@ -4122,25 +4249,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+ if test -n "$ac_ct_DUMPBIN"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+-echo "${ECHO_T}$ac_ct_DUMPBIN" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
++$as_echo "$ac_ct_DUMPBIN" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -4152,12 +4279,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     DUMPBIN=$ac_ct_DUMPBIN
+@@ -4176,45 +4299,45 @@
+-{ echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+-echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6; }
+-if test "${lt_cv_nm_interface+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
++$as_echo_n "checking the name lister ($NM) interface... " >&6; }
++if test "${lt_cv_nm_interface+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_nm_interface="BSD nm"
+   echo "int some_variable = 0;" > conftest.$ac_ext
+-  (eval echo "\"\$as_me:4186: $ac_compile\"" >&5)
++  (eval echo "\"\$as_me:4309: $ac_compile\"" >&5)
+   (eval "$ac_compile" 2>conftest.err)
+   cat conftest.err >&5
+-  (eval echo "\"\$as_me:4189: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
++  (eval echo "\"\$as_me:4312: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+   cat conftest.err >&5
+-  (eval echo "\"\$as_me:4192: output\"" >&5)
++  (eval echo "\"\$as_me:4315: output\"" >&5)
+   cat conftest.out >&5
+   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+     lt_cv_nm_interface="MS dumpbin"
+   fi
+   rm -f conftest*
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+-echo "${ECHO_T}$lt_cv_nm_interface" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
++$as_echo "$lt_cv_nm_interface" >&6; }
+-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
++$as_echo_n "checking whether ln -s works... " >&6; }
+ LN_S=$as_ln_s
+ if test "$LN_S" = "ln -s"; then
+-  { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+-echo "${ECHO_T}no, using $LN_S" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
++$as_echo "no, using $LN_S" >&6; }
+ fi
+ # find the maximum length of command line arguments
+-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
++$as_echo_n "checking the maximum length of command line arguments... " >&6; }
++if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+     i=0
+   teststring="ABCD"
+@@ -4235,7 +4358,7 @@
+     lt_cv_sys_max_cmd_len=-1;
+     ;;
+-  cygwin* | mingw*)
++  cygwin* | mingw* | cegcc*)
+     # On Win9x/ME, this test blows up -- it succeeds, but takes
+     # about 5 minutes as the teststring grows exponentially.
+     # Worse, since 9x/ME are not pre-emptively multitasking,
+@@ -4331,11 +4454,11 @@
+ fi
+ if test -n $lt_cv_sys_max_cmd_len ; then
+-  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
++$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: none" >&5
+-echo "${ECHO_T}none" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
++$as_echo "none" >&6; }
+ fi
+ max_cmd_len=$lt_cv_sys_max_cmd_len
+@@ -4348,8 +4471,8 @@
+ : ${MV="mv -f"}
+ : ${RM="rm -f"}
+-{ echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+-echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
++$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+ # Try some XSI features
+ xsi_shell=no
+ ( _lt_dummy="a/b/c"
+@@ -4358,18 +4481,18 @@
+     && eval 'test $(( 1 + 1 )) -eq 2 \
+     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+   && xsi_shell=yes
+-{ echo "$as_me:$LINENO: result: $xsi_shell" >&5
+-echo "${ECHO_T}$xsi_shell" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
++$as_echo "$xsi_shell" >&6; }
+-{ echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+-echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
++$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+ lt_shell_append=no
+ ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+     >/dev/null 2>&1 \
+   && lt_shell_append=yes
+-{ echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+-echo "${ECHO_T}$lt_shell_append" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
++$as_echo "$lt_shell_append" >&6; }
+ if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+@@ -4403,31 +4526,132 @@
+-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+-if test "${lt_cv_ld_reload_flag+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
++$as_echo_n "checking for $LD option to reload object files... " >&6; }
++if test "${lt_cv_ld_reload_flag+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  lt_cv_ld_reload_flag='-r'
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
++$as_echo "$lt_cv_ld_reload_flag" >&6; }
++reload_flag=$lt_cv_ld_reload_flag
++case $reload_flag in
++"" | " "*) ;;
++*) reload_flag=" $reload_flag" ;;
++esac
++reload_cmds='$LD$reload_flag -o $output$reload_objs'
++case $host_os in
++  darwin*)
++    if test "$GCC" = yes; then
++      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
++    else
++      reload_cmds='$LD$reload_flag -o $output$reload_objs'
++    fi
++    ;;
++esac
++
++
++
++
++
++
++
++
++
++if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
++set dummy ${ac_tool_prefix}objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$OBJDUMP"; then
++  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++fi
++fi
++OBJDUMP=$ac_cv_prog_OBJDUMP
++if test -n "$OBJDUMP"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
++$as_echo "$OBJDUMP" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OBJDUMP"; then
++  ac_ct_OBJDUMP=$OBJDUMP
++  # Extract the first word of "objdump", so it can be a program name with args.
++set dummy objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  if test -n "$ac_ct_OBJDUMP"; then
++  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_prog_ac_ct_OBJDUMP="objdump"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
++if test -n "$ac_ct_OBJDUMP"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
++$as_echo "$ac_ct_OBJDUMP" >&6; }
+ else
+-  lt_cv_ld_reload_flag='-r'
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+-reload_flag=$lt_cv_ld_reload_flag
+-case $reload_flag in
+-"" | " "*) ;;
+-*) reload_flag=" $reload_flag" ;;
+-esac
+-reload_cmds='$LD$reload_flag -o $output$reload_objs'
+-case $host_os in
+-  darwin*)
+-    if test "$GCC" = yes; then
+-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+-    else
+-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+-    fi
+-    ;;
++
++  if test "x$ac_ct_OBJDUMP" = x; then
++    OBJDUMP="false"
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
+ esac
++    OBJDUMP=$ac_ct_OBJDUMP
++  fi
++else
++  OBJDUMP="$ac_cv_prog_OBJDUMP"
++fi
++test -z "$OBJDUMP" && OBJDUMP=objdump
+@@ -4437,10 +4661,10 @@
+-{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+-echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+-if test "${lt_cv_deplibs_check_method+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
++$as_echo_n "checking how to recognize dependent libraries... " >&6; }
++if test "${lt_cv_deplibs_check_method+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_file_magic_cmd='$MAGIC_CMD'
+ lt_cv_file_magic_test_file=
+@@ -4490,6 +4714,12 @@
+   fi
+   ;;
++cegcc)
++  # use the weaker test based on 'objdump'. See mingw*.
++  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
++  lt_cv_file_magic_cmd='$OBJDUMP -f'
++  ;;
++
+ darwin* | rhapsody*)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -4627,8 +4857,8 @@
+ esac
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
++$as_echo "$lt_cv_deplibs_check_method" >&6; }
+ file_magic_cmd=$lt_cv_file_magic_cmd
+ deplibs_check_method=$lt_cv_deplibs_check_method
+ test -z "$deplibs_check_method" && deplibs_check_method=unknown
+@@ -4647,10 +4877,10 @@
+ if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}ar; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_AR+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_AR+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$AR"; then
+   ac_cv_prog_AR="$AR" # Let the user override the test.
+@@ -4660,25 +4890,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_AR="${ac_tool_prefix}ar"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ AR=$ac_cv_prog_AR
+ if test -n "$AR"; then
+-  { echo "$as_me:$LINENO: result: $AR" >&5
+-echo "${ECHO_T}$AR" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
++$as_echo "$AR" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -4687,10 +4917,10 @@
+   ac_ct_AR=$AR
+   # Extract the first word of "ar", so it can be a program name with args.
+ set dummy ar; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_AR"; then
+   ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+@@ -4700,25 +4930,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_AR="ar"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_AR=$ac_cv_prog_ac_ct_AR
+ if test -n "$ac_ct_AR"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+-echo "${ECHO_T}$ac_ct_AR" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
++$as_echo "$ac_ct_AR" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_AR" = x; then
+@@ -4726,12 +4956,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     AR=$ac_ct_AR
+@@ -4756,10 +4982,10 @@
+ if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}strip; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_STRIP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_STRIP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$STRIP"; then
+   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+@@ -4769,25 +4995,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ STRIP=$ac_cv_prog_STRIP
+ if test -n "$STRIP"; then
+-  { echo "$as_me:$LINENO: result: $STRIP" >&5
+-echo "${ECHO_T}$STRIP" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
++$as_echo "$STRIP" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -4796,10 +5022,10 @@
+   ac_ct_STRIP=$STRIP
+   # Extract the first word of "strip", so it can be a program name with args.
+ set dummy strip; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_STRIP"; then
+   ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+@@ -4809,25 +5035,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_STRIP="strip"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+ if test -n "$ac_ct_STRIP"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
++$as_echo "$ac_ct_STRIP" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_STRIP" = x; then
+@@ -4835,12 +5061,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     STRIP=$ac_ct_STRIP
+@@ -4859,10 +5081,10 @@
+ if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_RANLIB+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_RANLIB+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$RANLIB"; then
+   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+@@ -4872,25 +5094,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ RANLIB=$ac_cv_prog_RANLIB
+ if test -n "$RANLIB"; then
+-  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+-echo "${ECHO_T}$RANLIB" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
++$as_echo "$RANLIB" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -4899,10 +5121,10 @@
+   ac_ct_RANLIB=$RANLIB
+   # Extract the first word of "ranlib", so it can be a program name with args.
+ set dummy ranlib; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_RANLIB"; then
+   ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+@@ -4912,25 +5134,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_RANLIB="ranlib"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+ if test -n "$ac_ct_RANLIB"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
++$as_echo "$ac_ct_RANLIB" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_RANLIB" = x; then
+@@ -4938,12 +5160,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     RANLIB=$ac_ct_RANLIB
+@@ -5020,10 +5238,10 @@
+ # Check for command to grab the raw symbol name followed by C symbol from nm.
+-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
++$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
++if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+ # These are sane defaults that work on at least a few old systems.
+@@ -5040,7 +5258,7 @@
+ aix*)
+   symcode='[BCDT]'
+   ;;
+-cygwin* | mingw* | pw32*)
++cygwin* | mingw* | pw32* | cegcc*)
+   symcode='[ABCDGISTW]'
+   ;;
+ hpux*)
+@@ -5138,18 +5356,18 @@
+ int main(){nm_test_var='a';nm_test_func();return(0);}
+ _LT_EOF
+-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
+     # Now try to grab the symbols.
+     nlist=conftest.nm
+-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
++    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
+   (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && test -s "$nlist"; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && test -s "$nlist"; then
+       # Try sorting and uniquifying the output.
+       if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+@@ -5202,11 +5420,11 @@
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+-        if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+   (eval $ac_link) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && test -s conftest${ac_exeext}; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+@@ -5240,11 +5458,11 @@
+   lt_cv_sys_global_symbol_to_cdecl=
+ fi
+ if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+-  { echo "$as_me:$LINENO: result: failed" >&5
+-echo "${ECHO_T}failed" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
++$as_echo "failed" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: ok" >&5
+-echo "${ECHO_T}ok" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
++$as_echo "ok" >&6; }
+ fi
+@@ -5269,7 +5487,7 @@
+ # Check whether --enable-libtool-lock was given.
+-if test "${enable_libtool_lock+set}" = set; then
++if test "${enable_libtool_lock+set}" = set; then :
+   enableval=$enable_libtool_lock;
+ fi
+@@ -5281,11 +5499,11 @@
+ ia64-*-hpux*)
+   # Find out which ABI we are using.
+   echo 'int i;' > conftest.$ac_ext
+-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
+     case `/usr/bin/file conftest.$ac_objext` in
+       *ELF-32*)
+       HPUX_IA64_MODE="32"
+@@ -5299,12 +5517,12 @@
+   ;;
+ *-*-irix6*)
+   # Find out which ABI we are using.
+-  echo '#line 5302 "configure"' > conftest.$ac_ext
+-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  echo '#line 5520 "configure"' > conftest.$ac_ext
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
+     if test "$lt_cv_prog_gnu_ld" = yes; then
+       case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+@@ -5338,11 +5556,11 @@
+ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+   # Find out which ABI we are using.
+   echo 'int i;' > conftest.$ac_ext
+-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
+     case `/usr/bin/file conftest.o` in
+       *32-bit*)
+       case $host in
+@@ -5391,10 +5609,10 @@
+   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+   SAVE_CFLAGS="$CFLAGS"
+   CFLAGS="$CFLAGS -belf"
+-  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+-if test "${lt_cv_cc_needs_belf+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
++$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
++if test "${lt_cv_cc_needs_belf+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+@@ -5402,11 +5620,7 @@
+ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-     cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -5417,34 +5631,13 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   lt_cv_cc_needs_belf=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      lt_cv_cc_needs_belf=no
++  lt_cv_cc_needs_belf=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+      ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+@@ -5452,8 +5645,8 @@
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
++$as_echo "$lt_cv_cc_needs_belf" >&6; }
+   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+     CFLAGS="$SAVE_CFLAGS"
+@@ -5462,11 +5655,11 @@
+ sparc*-*solaris*)
+   # Find out which ABI we are using.
+   echo 'int i;' > conftest.$ac_ext
+-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
+     case `/usr/bin/file conftest.o` in
+     *64-bit*)
+       case $lt_cv_prog_gnu_ld in
+@@ -5492,10 +5685,10 @@
+     if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$DSYMUTIL"; then
+   ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+@@ -5505,25 +5698,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ DSYMUTIL=$ac_cv_prog_DSYMUTIL
+ if test -n "$DSYMUTIL"; then
+-  { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
+-echo "${ECHO_T}$DSYMUTIL" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
++$as_echo "$DSYMUTIL" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -5532,10 +5725,10 @@
+   ac_ct_DSYMUTIL=$DSYMUTIL
+   # Extract the first word of "dsymutil", so it can be a program name with args.
+ set dummy dsymutil; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_DSYMUTIL"; then
+   ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+@@ -5545,25 +5738,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+ if test -n "$ac_ct_DSYMUTIL"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
+-echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
++$as_echo "$ac_ct_DSYMUTIL" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_DSYMUTIL" = x; then
+@@ -5571,12 +5764,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     DSYMUTIL=$ac_ct_DSYMUTIL
+@@ -5588,10 +5777,10 @@
+     if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_NMEDIT+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_NMEDIT+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$NMEDIT"; then
+   ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+@@ -5601,25 +5790,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ NMEDIT=$ac_cv_prog_NMEDIT
+ if test -n "$NMEDIT"; then
+-  { echo "$as_me:$LINENO: result: $NMEDIT" >&5
+-echo "${ECHO_T}$NMEDIT" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
++$as_echo "$NMEDIT" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -5628,10 +5817,10 @@
+   ac_ct_NMEDIT=$NMEDIT
+   # Extract the first word of "nmedit", so it can be a program name with args.
+ set dummy nmedit; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_NMEDIT"; then
+   ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+@@ -5641,25 +5830,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_NMEDIT="nmedit"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+ if test -n "$ac_ct_NMEDIT"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
+-echo "${ECHO_T}$ac_ct_NMEDIT" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
++$as_echo "$ac_ct_NMEDIT" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_NMEDIT" = x; then
+@@ -5667,12 +5856,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     NMEDIT=$ac_ct_NMEDIT
+@@ -5684,10 +5869,10 @@
+     if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}lipo; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_LIPO+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_LIPO+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$LIPO"; then
+   ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+@@ -5697,25 +5882,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ LIPO=$ac_cv_prog_LIPO
+ if test -n "$LIPO"; then
+-  { echo "$as_me:$LINENO: result: $LIPO" >&5
+-echo "${ECHO_T}$LIPO" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
++$as_echo "$LIPO" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -5724,10 +5909,10 @@
+   ac_ct_LIPO=$LIPO
+   # Extract the first word of "lipo", so it can be a program name with args.
+ set dummy lipo; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_LIPO"; then
+   ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+@@ -5737,25 +5922,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_LIPO="lipo"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+ if test -n "$ac_ct_LIPO"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
+-echo "${ECHO_T}$ac_ct_LIPO" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
++$as_echo "$ac_ct_LIPO" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_LIPO" = x; then
+@@ -5763,12 +5948,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     LIPO=$ac_ct_LIPO
+@@ -5780,10 +5961,10 @@
+     if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}otool; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_OTOOL+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_OTOOL+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$OTOOL"; then
+   ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+@@ -5793,25 +5974,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ OTOOL=$ac_cv_prog_OTOOL
+ if test -n "$OTOOL"; then
+-  { echo "$as_me:$LINENO: result: $OTOOL" >&5
+-echo "${ECHO_T}$OTOOL" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
++$as_echo "$OTOOL" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -5820,10 +6001,10 @@
+   ac_ct_OTOOL=$OTOOL
+   # Extract the first word of "otool", so it can be a program name with args.
+ set dummy otool; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_OTOOL"; then
+   ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+@@ -5833,25 +6014,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_OTOOL="otool"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+ if test -n "$ac_ct_OTOOL"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
+-echo "${ECHO_T}$ac_ct_OTOOL" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
++$as_echo "$ac_ct_OTOOL" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_OTOOL" = x; then
+@@ -5859,12 +6040,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     OTOOL=$ac_ct_OTOOL
+@@ -5876,10 +6053,10 @@
+     if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}otool64; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_OTOOL64+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_OTOOL64+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$OTOOL64"; then
+   ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+@@ -5889,25 +6066,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ OTOOL64=$ac_cv_prog_OTOOL64
+ if test -n "$OTOOL64"; then
+-  { echo "$as_me:$LINENO: result: $OTOOL64" >&5
+-echo "${ECHO_T}$OTOOL64" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
++$as_echo "$OTOOL64" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -5916,10 +6093,10 @@
+   ac_ct_OTOOL64=$OTOOL64
+   # Extract the first word of "otool64", so it can be a program name with args.
+ set dummy otool64; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_OTOOL64"; then
+   ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+@@ -5929,25 +6106,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_OTOOL64="otool64"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+ if test -n "$ac_ct_OTOOL64"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
+-echo "${ECHO_T}$ac_ct_OTOOL64" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
++$as_echo "$ac_ct_OTOOL64" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_OTOOL64" = x; then
+@@ -5955,12 +6132,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     OTOOL64=$ac_ct_OTOOL64
+@@ -5995,10 +6168,10 @@
+-    { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
+-echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; }
+-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
++$as_echo_n "checking for -single_module linker flag... " >&6; }
++if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_apple_cc_single_mod=no
+       if test -z "${LT_MULTI_MODULE}"; then
+@@ -6022,22 +6195,18 @@
+       rm -f conftest.*
+       fi
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
+-echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; }
+-    { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
+-echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; }
+-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
++$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
++$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
++if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_ld_exported_symbols_list=no
+       save_LDFLAGS=$LDFLAGS
+       echo "_main" > conftest.sym
+       LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+-      cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -6048,39 +6217,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   lt_cv_ld_exported_symbols_list=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      lt_cv_ld_exported_symbols_list=no
++  lt_cv_ld_exported_symbols_list=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS="$save_LDFLAGS"
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
+-echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
++$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+     case $host_os in
+     rhapsody* | darwin1.[012])
+       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+@@ -6121,15 +6269,15 @@
+ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
++$as_echo_n "checking how to run the C preprocessor... " >&6; }
+ # On Suns, sometimes $CPP names a directory.
+ if test -n "$CPP" && test -d "$CPP"; then
+   CPP=
+ fi
+ if test -z "$CPP"; then
+-  if test "${ac_cv_prog_CPP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  if test "${ac_cv_prog_CPP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+       # Double quotes because CPP needs to be expanded
+     for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+@@ -6143,11 +6291,7 @@
+   # <limits.h> exists even on freestanding compilers.
+   # On the NeXT, cc -E runs the code through the compiler's parser,
+   # not just through cpp. "Syntax error" is here to catch this case.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #ifdef __STDC__
+ # include <limits.h>
+@@ -6156,76 +6300,34 @@
+ #endif
+                    Syntax error
+ _ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  :
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++if ac_fn_c_try_cpp "$LINENO"; then :
++else
+   # Broken: fails on valid input.
+ continue
+ fi
+-
+ rm -f conftest.err conftest.$ac_ext
+   # OK, works on sane cases.  Now check whether nonexistent headers
+   # can be detected and how.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <ac_nonexistent.h>
+ _ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
++if ac_fn_c_try_cpp "$LINENO"; then :
+   # Broken: success on invalid input.
+ continue
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+   # Passes both tests.
+ ac_preproc_ok=:
+ break
+ fi
+-
+ rm -f conftest.err conftest.$ac_ext
+ done
+ # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+ rm -f conftest.err conftest.$ac_ext
+-if $ac_preproc_ok; then
++if $ac_preproc_ok; then :
+   break
+ fi
+@@ -6237,8 +6339,8 @@
+ else
+   ac_cv_prog_CPP=$CPP
+ fi
+-{ echo "$as_me:$LINENO: result: $CPP" >&5
+-echo "${ECHO_T}$CPP" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
++$as_echo "$CPP" >&6; }
+ ac_preproc_ok=false
+ for ac_c_preproc_warn_flag in '' yes
+ do
+@@ -6248,11 +6350,7 @@
+   # <limits.h> exists even on freestanding compilers.
+   # On the NeXT, cc -E runs the code through the compiler's parser,
+   # not just through cpp. "Syntax error" is here to catch this case.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #ifdef __STDC__
+ # include <limits.h>
+@@ -6261,83 +6359,40 @@
+ #endif
+                    Syntax error
+ _ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  :
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++if ac_fn_c_try_cpp "$LINENO"; then :
++else
+   # Broken: fails on valid input.
+ continue
+ fi
+-
+ rm -f conftest.err conftest.$ac_ext
+   # OK, works on sane cases.  Now check whether nonexistent headers
+   # can be detected and how.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <ac_nonexistent.h>
+ _ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
++if ac_fn_c_try_cpp "$LINENO"; then :
+   # Broken: success on invalid input.
+ continue
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+   # Passes both tests.
+ ac_preproc_ok=:
+ break
+ fi
+-
+ rm -f conftest.err conftest.$ac_ext
+ done
+ # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+ rm -f conftest.err conftest.$ac_ext
+-if $ac_preproc_ok; then
+-  :
++if $ac_preproc_ok; then :
++
+ else
+-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error "C preprocessor \"$CPP\" fails sanity check
++See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ ac_ext=c
+@@ -6347,16 +6402,12 @@
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+-if test "${ac_cv_header_stdc+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
++$as_echo_n "checking for ANSI C header files... " >&6; }
++if test "${ac_cv_header_stdc+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdlib.h>
+ #include <stdarg.h>
+@@ -6371,47 +6422,23 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_header_stdc=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_header_stdc=no
++  ac_cv_header_stdc=no
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_header_stdc = yes; then
+   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <string.h>
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  $EGREP "memchr" >/dev/null 2>&1; then
+-  :
++  $EGREP "memchr" >/dev/null 2>&1; then :
++
+ else
+   ac_cv_header_stdc=no
+ fi
+@@ -6421,18 +6448,14 @@
+ if test $ac_cv_header_stdc = yes; then
+   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdlib.h>
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  $EGREP "free" >/dev/null 2>&1; then
+-  :
++  $EGREP "free" >/dev/null 2>&1; then :
++
+ else
+   ac_cv_header_stdc=no
+ fi
+@@ -6442,14 +6465,10 @@
+ if test $ac_cv_header_stdc = yes; then
+   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+-  if test "$cross_compiling" = yes; then
++  if test "$cross_compiling" = yes; then :
+   :
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <ctype.h>
+ #include <stdlib.h>
+@@ -6476,113 +6495,36 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  :
+-else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++if ac_fn_c_try_run "$LINENO"; then :
+-( exit $ac_status )
+-ac_cv_header_stdc=no
++else
++  ac_cv_header_stdc=no
+ fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+-
+ fi
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
++$as_echo "$ac_cv_header_stdc" >&6; }
+ if test $ac_cv_header_stdc = yes; then
+-cat >>confdefs.h <<\_ACEOF
+-#define STDC_HEADERS 1
+-_ACEOF
++$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+ fi
+ # On IRIX 5.3, sys/types and inttypes.h are conflicting.
+-
+-
+-
+-
+-
+-
+-
+-
+-
+ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+-do
+-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-
+-#include <$ac_header>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  eval "$as_ac_Header=yes"
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      eval "$as_ac_Header=no"
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-if test `eval echo '${'$as_ac_Header'}'` = yes; then
++do :
++  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
++ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
++"
++eval as_val=\$$as_ac_Header
++   if test "x$as_val" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+ _ACEOF
+ fi
+@@ -6590,58 +6532,13 @@
+ done
+-
+ for ac_header in dlfcn.h
+-do
+-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-
+-#include <$ac_header>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  eval "$as_ac_Header=yes"
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      eval "$as_ac_Header=no"
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-if test `eval echo '${'$as_ac_Header'}'` = yes; then
++do :
++  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
++"
++if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++#define HAVE_DLFCN_H 1
+ _ACEOF
+ fi
+@@ -6661,7 +6558,7 @@
+             # Check whether --enable-shared was given.
+-if test "${enable_shared+set}" = set; then
++if test "${enable_shared+set}" = set; then :
+   enableval=$enable_shared; p=${PACKAGE-default}
+     case $enableval in
+     yes) enable_shared=yes ;;
+@@ -6692,7 +6589,7 @@
+   # Check whether --enable-static was given.
+-if test "${enable_static+set}" = set; then
++if test "${enable_static+set}" = set; then :
+   enableval=$enable_static; p=${PACKAGE-default}
+     case $enableval in
+     yes) enable_static=yes ;;
+@@ -6724,7 +6621,7 @@
+ # Check whether --with-pic was given.
+-if test "${with_pic+set}" = set; then
++if test "${with_pic+set}" = set; then :
+   withval=$with_pic; pic_mode="$withval"
+ else
+   pic_mode=default
+@@ -6740,7 +6637,7 @@
+   # Check whether --enable-fast-install was given.
+-if test "${enable_fast_install+set}" = set; then
++if test "${enable_fast_install+set}" = set; then :
+   enableval=$enable_fast_install; p=${PACKAGE-default}
+     case $enableval in
+     yes) enable_fast_install=yes ;;
+@@ -6821,10 +6718,10 @@
+    setopt NO_GLOB_SUBST
+ fi
+-{ echo "$as_me:$LINENO: checking for objdir" >&5
+-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+-if test "${lt_cv_objdir+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
++$as_echo_n "checking for objdir... " >&6; }
++if test "${lt_cv_objdir+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   rm -f .libs 2>/dev/null
+ mkdir .libs 2>/dev/null
+@@ -6836,8 +6733,8 @@
+ fi
+ rmdir .libs 2>/dev/null
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+-echo "${ECHO_T}$lt_cv_objdir" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
++$as_echo "$lt_cv_objdir" >&6; }
+ objdir=$lt_cv_objdir
+@@ -6929,10 +6826,10 @@
+ case $deplibs_check_method in
+ file_magic*)
+   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+-    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
++$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
++if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   case $MAGIC_CMD in
+ [\\/*] |  ?:[\\/]*)
+@@ -6982,11 +6879,11 @@
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if test -n "$MAGIC_CMD"; then
+-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+-echo "${ECHO_T}$MAGIC_CMD" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
++$as_echo "$MAGIC_CMD" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -6995,10 +6892,10 @@
+ if test -z "$lt_cv_path_MAGIC_CMD"; then
+   if test -n "$ac_tool_prefix"; then
+-    { echo "$as_me:$LINENO: checking for file" >&5
+-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
++$as_echo_n "checking for file... " >&6; }
++if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   case $MAGIC_CMD in
+ [\\/*] |  ?:[\\/]*)
+@@ -7048,11 +6945,11 @@
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if test -n "$MAGIC_CMD"; then
+-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+-echo "${ECHO_T}$MAGIC_CMD" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
++$as_echo "$MAGIC_CMD" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -7128,10 +7025,10 @@
+ if test "$GCC" = yes; then
+   lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+-  { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
++$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
++if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_prog_compiler_rtti_exceptions=no
+    ac_outfile=conftest.$ac_objext
+@@ -7146,11 +7043,11 @@
+    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+    -e 's:$: $lt_compiler_flag:'`
+-   (eval echo "\"\$as_me:7149: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:7046: $lt_compile\"" >&5)
+    (eval "$lt_compile" 2>conftest.err)
+    ac_status=$?
+    cat conftest.err >&5
+-   echo "$as_me:7153: \$? = $ac_status" >&5
++   echo "$as_me:7050: \$? = $ac_status" >&5
+    if (exit $ac_status) && test -s "$ac_outfile"; then
+      # The compiler can only warn and ignore the option if not recognized
+      # So say no if there are warnings other than the usual output.
+@@ -7163,8 +7060,8 @@
+    $RM conftest*
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
++$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+ if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+     lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+@@ -7183,8 +7080,8 @@
+ lt_prog_compiler_pic=
+ lt_prog_compiler_static=
+-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
++$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+   if test "$GCC" = yes; then
+     lt_prog_compiler_wl='-Wl,'
+@@ -7218,7 +7115,7 @@
+       # PIC is the default for these OSes.
+       ;;
+-    mingw* | cygwin* | pw32* | os2*)
++    mingw* | cygwin* | pw32* | os2* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       # Although the cygwin gcc ignores -fPIC, still need this for old-style
+@@ -7233,10 +7130,11 @@
+       ;;
+     hpux*)
+-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+-      # not for PA HP-UX.
++      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
++      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
++      # sets the default TLS model and affects inlining.
+       case $host_cpu in
+-      hppa*64*|ia64*)
++      hppa*64*)
+       # +Z the default
+       ;;
+       *)
+@@ -7286,7 +7184,7 @@
+       fi
+       ;;
+-    mingw* | cygwin* | pw32* | os2*)
++    mingw* | cygwin* | pw32* | os2* | cegcc*)
+       # This hack is so that the source file can tell whether it is being
+       # built for inclusion in a dll (and should export symbols for example).
+       lt_prog_compiler_pic='-DDLL_EXPORT'
+@@ -7316,11 +7214,25 @@
+     linux* | k*bsd*-gnu)
+       case $cc_basename in
+-      icc* | ecc* | ifort*)
++      # old Intel for x86_64 which still supported -KPIC.
++      ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+         ;;
++      # icc used to be incompatible with GCC.
++      # ICC 10 doesn't accept -KPIC any more.
++      icc* | ifort*)
++      lt_prog_compiler_wl='-Wl,'
++      lt_prog_compiler_pic='-fPIC'
++      lt_prog_compiler_static='-static'
++        ;;
++      # Lahey Fortran 8.1.
++      lf95*)
++      lt_prog_compiler_wl='-Wl,'
++      lt_prog_compiler_pic='--shared'
++      lt_prog_compiler_static='--static'
++      ;;
+       pgcc* | pgf77* | pgf90* | pgf95*)
+         # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+@@ -7440,8 +7352,8 @@
+     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+     ;;
+ esac
+-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
++$as_echo "$lt_prog_compiler_pic" >&6; }
+@@ -7452,10 +7364,10 @@
+ # Check to make sure the PIC flag actually works.
+ #
+ if test -n "$lt_prog_compiler_pic"; then
+-  { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
++$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
++if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_prog_compiler_pic_works=no
+    ac_outfile=conftest.$ac_objext
+@@ -7470,11 +7382,11 @@
+    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+    -e 's:$: $lt_compiler_flag:'`
+-   (eval echo "\"\$as_me:7473: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:7385: $lt_compile\"" >&5)
+    (eval "$lt_compile" 2>conftest.err)
+    ac_status=$?
+    cat conftest.err >&5
+-   echo "$as_me:7477: \$? = $ac_status" >&5
++   echo "$as_me:7389: \$? = $ac_status" >&5
+    if (exit $ac_status) && test -s "$ac_outfile"; then
+      # The compiler can only warn and ignore the option if not recognized
+      # So say no if there are warnings other than the usual output.
+@@ -7487,8 +7399,8 @@
+    $RM conftest*
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
+-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
++$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+ if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+     case $lt_prog_compiler_pic in
+@@ -7511,10 +7423,10 @@
+ # Check to make sure the static flag actually works.
+ #
+ wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
++$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
++if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_prog_compiler_static_works=no
+    save_LDFLAGS="$LDFLAGS"
+@@ -7539,8 +7451,8 @@
+    LDFLAGS="$save_LDFLAGS"
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
+-echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
++$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+ if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+     :
+@@ -7554,10 +7466,10 @@
+-  { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
++$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
++if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_prog_compiler_c_o=no
+    $RM -r conftest 2>/dev/null
+@@ -7575,11 +7487,11 @@
+    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+    -e 's:$: $lt_compiler_flag:'`
+-   (eval echo "\"\$as_me:7578: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:7490: $lt_compile\"" >&5)
+    (eval "$lt_compile" 2>out/conftest.err)
+    ac_status=$?
+    cat out/conftest.err >&5
+-   echo "$as_me:7582: \$? = $ac_status" >&5
++   echo "$as_me:7494: \$? = $ac_status" >&5
+    if (exit $ac_status) && test -s out/conftest2.$ac_objext
+    then
+      # The compiler can only warn and ignore the option if not recognized
+@@ -7601,18 +7513,18 @@
+    $RM conftest*
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
++$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+-  { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
++$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
++if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   lt_cv_prog_compiler_c_o=no
+    $RM -r conftest 2>/dev/null
+@@ -7630,11 +7542,11 @@
+    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+    -e 's:$: $lt_compiler_flag:'`
+-   (eval echo "\"\$as_me:7633: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:7545: $lt_compile\"" >&5)
+    (eval "$lt_compile" 2>out/conftest.err)
+    ac_status=$?
+    cat out/conftest.err >&5
+-   echo "$as_me:7637: \$? = $ac_status" >&5
++   echo "$as_me:7549: \$? = $ac_status" >&5
+    if (exit $ac_status) && test -s out/conftest2.$ac_objext
+    then
+      # The compiler can only warn and ignore the option if not recognized
+@@ -7656,8 +7568,8 @@
+    $RM conftest*
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
++$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+@@ -7665,19 +7577,19 @@
+ hard_links="nottested"
+ if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+   # do not overwrite the value of need_locks provided by the user
+-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
++$as_echo_n "checking if we can lock with hard links... " >&6; }
+   hard_links=yes
+   $RM conftest*
+   ln conftest.a conftest.b 2>/dev/null && hard_links=no
+   touch conftest.a
+   ln conftest.a conftest.b 2>&5 || hard_links=no
+   ln conftest.a conftest.b 2>/dev/null && hard_links=no
+-  { echo "$as_me:$LINENO: result: $hard_links" >&5
+-echo "${ECHO_T}$hard_links" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
++$as_echo "$hard_links" >&6; }
+   if test "$hard_links" = no; then
+-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
++$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+     need_locks=warn
+   fi
+ else
+@@ -7689,8 +7601,8 @@
+-  { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
++$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+   runpath_var=
+   allow_undefined_flag=
+@@ -7734,7 +7646,7 @@
+   extract_expsyms_cmds=
+   case $host_os in
+-  cygwin* | mingw* | pw32*)
++  cygwin* | mingw* | pw32* | cegcc*)
+     # FIXME: the MSVC++ port hasn't been tested in a loooong time
+     # When not using gcc, we currently assume that we are using
+     # Microsoft Visual C++.
+@@ -7749,6 +7661,9 @@
+   openbsd*)
+     with_gnu_ld=no
+     ;;
++  linux* | k*bsd*-gnu)
++    link_all_deplibs=no
++    ;;
+   esac
+   ld_shlibs=yes
+@@ -7821,7 +7736,7 @@
+       fi
+       ;;
+-    cygwin* | mingw* | pw32*)
++    cygwin* | mingw* | pw32* | cegcc*)
+       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+       # as there is no search path for DLLs.
+       hardcode_libdir_flag_spec='-L$libdir'
+@@ -7887,6 +7802,9 @@
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
++      lf95*)                          # Lahey Fortran 8.1
++        whole_archive_flag_spec=
++        tmp_sharedflag='--shared' ;;
+       xl[cC]*)                        # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+@@ -8119,6 +8037,7 @@
+       fi
+       fi
++      export_dynamic_flag_spec='${wl}-bexpall'
+       # It seems that -bexpall does not export symbols beginning with
+       # underscore (_), so it is better to generate a list of symbols to export.
+       always_export_symbols=yes
+@@ -8128,11 +8047,7 @@
+       allow_undefined_flag='-berok'
+         # Determine the default libpath from the value encoded in an
+         # empty executable.
+-        cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -8143,24 +8058,7 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+ lt_aix_libpath_sed='
+     /Import File Strings/,/^$/ {
+@@ -8174,15 +8072,9 @@
+ if test -z "$aix_libpath"; then
+   aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+@@ -8195,11 +8087,7 @@
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+-       cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -8210,24 +8098,7 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+ lt_aix_libpath_sed='
+     /Import File Strings/,/^$/ {
+@@ -8241,15 +8112,9 @@
+ if test -z "$aix_libpath"; then
+   aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+@@ -8285,7 +8150,7 @@
+       export_dynamic_flag_spec=-rdynamic
+       ;;
+-    cygwin* | mingw* | pw32*)
++    cygwin* | mingw* | pw32* | cegcc*)
+       # When not using gcc, we currently assume that we are using
+       # Microsoft Visual C++.
+       # hardcode_libdir_flag_spec is actually meaningless, as there is
+@@ -8316,7 +8181,11 @@
+   whole_archive_flag_spec=''
+   link_all_deplibs=yes
+   allow_undefined_flag="$_lt_dar_allow_undefined"
+-  if test "$GCC" = "yes"; then
++  case $cc_basename in
++     ifort*) _lt_dar_can_shared=yes ;;
++     *) _lt_dar_can_shared=$GCC ;;
++  esac
++  if test "$_lt_dar_can_shared" = "yes"; then
+     output_verbose_link_cmd=echo
+     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+@@ -8408,7 +8277,7 @@
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+-        archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
++        archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+@@ -8457,38 +8326,16 @@
+       # implicitly export all symbols.
+         save_LDFLAGS="$LDFLAGS"
+         LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+-        cat >conftest.$ac_ext <<_ACEOF
++        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
+ int foo(void) {}
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+         LDFLAGS="$save_LDFLAGS"
+       else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+@@ -8744,8 +8591,8 @@
+     fi
+   fi
+-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+-echo "${ECHO_T}$ld_shlibs" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
++$as_echo "$ld_shlibs" >&6; }
+ test "$ld_shlibs" = no && can_build_shared=no
+ with_gnu_ld=$with_gnu_ld
+@@ -8781,16 +8628,16 @@
+       # Test whether the compiler implicitly links with -lc since on some
+       # systems, -lgcc has to come before -lc. If gcc already passes -lc
+       # to ld, don't add -lc before -lgcc.
+-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
++$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+       $RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+   (eval $ac_compile) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } 2>conftest.err; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+@@ -8804,11 +8651,11 @@
+         libname=conftest
+         lt_save_allow_undefined_flag=$allow_undefined_flag
+         allow_undefined_flag=
+-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
++        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }
+         then
+         archive_cmds_need_lc=no
+         else
+@@ -8819,8 +8666,8 @@
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
++$as_echo "$archive_cmds_need_lc" >&6; }
+       ;;
+     esac
+   fi
+@@ -8983,8 +8830,8 @@
+-  { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
++$as_echo_n "checking dynamic linker characteristics... " >&6; }
+ if test "$GCC" = yes; then
+   case $host_os in
+@@ -9146,14 +8993,14 @@
+   # libtool to hard-code these into programs
+   ;;
+-cygwin* | mingw* | pw32*)
++cygwin* | mingw* | pw32* | cegcc*)
+   version_type=windows
+   shrext_cmds=".dll"
+   need_version=no
+   need_lib_prefix=no
+   case $GCC,$host_os in
+-  yes,cygwin* | yes,mingw* | yes,pw32*)
++  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+     library_names_spec='$libname.dll.a'
+     # DLL is installed to $(libdir)/../bin by postinstall_cmds
+     postinstall_cmds='base_file=`basename \${file}`~
+@@ -9176,7 +9023,7 @@
+       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+       sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+       ;;
+-    mingw*)
++    mingw* | cegcc*)
+       # MinGW DLLs use traditional 'lib' prefix
+       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+       sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+@@ -9405,11 +9252,7 @@
+   save_libdir=$libdir
+   eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -9420,37 +9263,13 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
+-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
++if ac_fn_c_try_link "$LINENO"; then :
++  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+   shlibpath_overrides_runpath=yes
+ fi
+-
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+   LDFLAGS=$save_LDFLAGS
+   libdir=$save_libdir
+@@ -9657,7 +9476,7 @@
+   version_type=linux
+   need_lib_prefix=no
+   need_version=no
+-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
++  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+   shlibpath_var=LD_LIBRARY_PATH
+   shlibpath_overrides_runpath=no
+   hardcode_into_libs=yes
+@@ -9674,8 +9493,8 @@
+   dynamic_linker=no
+   ;;
+ esac
+-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+-echo "${ECHO_T}$dynamic_linker" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
++$as_echo "$dynamic_linker" >&6; }
+ test "$dynamic_linker" = no && can_build_shared=no
+ variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+@@ -9776,8 +9595,8 @@
+-  { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
++$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+ hardcode_action=
+ if test -n "$hardcode_libdir_flag_spec" ||
+    test -n "$runpath_var" ||
+@@ -9801,8 +9620,8 @@
+   # directories.
+   hardcode_action=unsupported
+ fi
+-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+-echo "${ECHO_T}$hardcode_action" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
++$as_echo "$hardcode_action" >&6; }
+ if test "$hardcode_action" = relink ||
+    test "$inherit_rpath" = yes; then
+@@ -9834,7 +9653,7 @@
+     lt_cv_dlopen_self=yes
+     ;;
+-  mingw* | pw32*)
++  mingw* | pw32* | cegcc*)
+     lt_cv_dlopen="LoadLibrary"
+     lt_cv_dlopen_libs=
+     ;;
+@@ -9846,18 +9665,14 @@
+   darwin*)
+   # if libdl is installed we need to link against it
+-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
++$as_echo_n "checking for dlopen in -ldl... " >&6; }
++if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-ldl  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -9875,39 +9690,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_dl_dlopen=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_dl_dlopen=no
++  ac_cv_lib_dl_dlopen=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+-if test $ac_cv_lib_dl_dlopen = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
++$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
++if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+ else
+@@ -9920,102 +9714,18 @@
+     ;;
+   *)
+-    { echo "$as_me:$LINENO: checking for shl_load" >&5
+-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+-if test "${ac_cv_func_shl_load+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+-#define shl_load innocuous_shl_load
+-
+-/* System header to define __stub macros and hopefully few prototypes,
+-    which can conflict with char shl_load (); below.
+-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+-    <limits.h> exists even on freestanding compilers.  */
+-
+-#ifdef __STDC__
+-# include <limits.h>
+-#else
+-# include <assert.h>
+-#endif
+-
+-#undef shl_load
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char shl_load ();
+-/* The GNU C library defines this for functions which it implements
+-    to always fail with ENOSYS.  Some functions are actually named
+-    something starting with __ and the normal name is an alias.  */
+-#if defined __stub_shl_load || defined __stub___shl_load
+-choke me
+-#endif
+-
+-int
+-main ()
+-{
+-return shl_load ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
+-  ac_cv_func_shl_load=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_func_shl_load=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+-if test $ac_cv_func_shl_load = yes; then
++    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
++if test "x$ac_cv_func_shl_load" = x""yes; then :
+   lt_cv_dlopen="shl_load"
+ else
+-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
++$as_echo_n "checking for shl_load in -ldld... " >&6; }
++if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-ldld  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -10033,137 +9743,32 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_dld_shl_load=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_dld_shl_load=no
++  ac_cv_lib_dld_shl_load=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+-if test $ac_cv_lib_dld_shl_load = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
++$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
++if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+ else
+-  { echo "$as_me:$LINENO: checking for dlopen" >&5
+-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+-if test "${ac_cv_func_dlopen+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+-#define dlopen innocuous_dlopen
+-
+-/* System header to define __stub macros and hopefully few prototypes,
+-    which can conflict with char dlopen (); below.
+-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+-    <limits.h> exists even on freestanding compilers.  */
+-
+-#ifdef __STDC__
+-# include <limits.h>
+-#else
+-# include <assert.h>
+-#endif
+-
+-#undef dlopen
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char dlopen ();
+-/* The GNU C library defines this for functions which it implements
+-    to always fail with ENOSYS.  Some functions are actually named
+-    something starting with __ and the normal name is an alias.  */
+-#if defined __stub_dlopen || defined __stub___dlopen
+-choke me
+-#endif
+-
+-int
+-main ()
+-{
+-return dlopen ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
+-  ac_cv_func_dlopen=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_func_dlopen=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+-if test $ac_cv_func_dlopen = yes; then
++  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
++if test "x$ac_cv_func_dlopen" = x""yes; then :
+   lt_cv_dlopen="dlopen"
+ else
+-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
++$as_echo_n "checking for dlopen in -ldl... " >&6; }
++if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-ldl  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -10181,53 +9786,28 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_dl_dlopen=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_dl_dlopen=no
++  ac_cv_lib_dl_dlopen=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+-if test $ac_cv_lib_dl_dlopen = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
++$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
++if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+ else
+-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
++$as_echo_n "checking for dlopen in -lsvld... " >&6; }
++if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lsvld  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -10245,53 +9825,28 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_svld_dlopen=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_svld_dlopen=no
++  ac_cv_lib_svld_dlopen=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+-if test $ac_cv_lib_svld_dlopen = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
++$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
++if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+ else
+-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
++$as_echo_n "checking for dld_link in -ldld... " >&6; }
++if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-ldld  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -10309,39 +9864,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_dld_dld_link=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_dld_dld_link=no
++  ac_cv_lib_dld_dld_link=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+-if test $ac_cv_lib_dld_dld_link = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
++$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
++if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+ fi
+@@ -10380,10 +9914,10 @@
+     save_LIBS="$LIBS"
+     LIBS="$lt_cv_dlopen_libs $LIBS"
+-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+-if test "${lt_cv_dlopen_self+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
++$as_echo_n "checking whether a program can dlopen itself... " >&6; }
++if test "${lt_cv_dlopen_self+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+         if test "$cross_compiling" = yes; then :
+   lt_cv_dlopen_self=cross
+@@ -10391,7 +9925,7 @@
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 10394 "configure"
++#line 9928 "configure"
+ #include "confdefs.h"
+ #if HAVE_DLFCN_H
+@@ -10432,10 +9966,6 @@
+ #  endif
+ #endif
+-#ifdef __cplusplus
+-extern "C" void exit (int);
+-#endif
+-
+ void fnord() { int i=42;}
+ int main ()
+ {
+@@ -10451,14 +9981,14 @@
+   else
+     puts (dlerror ());
+-    exit (status);
++  return status;
+ }
+ _LT_EOF
+-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+   (eval $ac_link) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+     (./conftest; exit; ) >&5 2>/dev/null
+     lt_status=$?
+     case x$lt_status in
+@@ -10475,15 +10005,15 @@
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
++$as_echo "$lt_cv_dlopen_self" >&6; }
+     if test "x$lt_cv_dlopen_self" = xyes; then
+       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+-if test "${lt_cv_dlopen_self_static+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
++$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
++if test "${lt_cv_dlopen_self_static+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+         if test "$cross_compiling" = yes; then :
+   lt_cv_dlopen_self_static=cross
+@@ -10491,7 +10021,7 @@
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 10494 "configure"
++#line 10024 "configure"
+ #include "confdefs.h"
+ #if HAVE_DLFCN_H
+@@ -10532,10 +10062,6 @@
+ #  endif
+ #endif
+-#ifdef __cplusplus
+-extern "C" void exit (int);
+-#endif
+-
+ void fnord() { int i=42;}
+ int main ()
+ {
+@@ -10551,14 +10077,14 @@
+   else
+     puts (dlerror ());
+-    exit (status);
++  return status;
+ }
+ _LT_EOF
+-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+   (eval $ac_link) 2>&5
+   ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+     (./conftest; exit; ) >&5 2>/dev/null
+     lt_status=$?
+     case x$lt_status in
+@@ -10575,8 +10101,8 @@
+ fi
+-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
++$as_echo "$lt_cv_dlopen_self_static" >&6; }
+     fi
+     CPPFLAGS="$save_CPPFLAGS"
+@@ -10614,13 +10140,13 @@
+ striplib=
+ old_striplib=
+-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
++$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+ if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+-  { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+ else
+ # FIXME - insert some real tests, host_os isn't really good enough
+   case $host_os in
+@@ -10628,16 +10154,16 @@
+     if test -n "$STRIP" ; then
+       striplib="$STRIP -x"
+       old_striplib="$STRIP -S"
+-      { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+     else
+-      { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+     fi
+     ;;
+   *)
+-    { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+     ;;
+   esac
+ fi
+@@ -10654,13 +10180,13 @@
+   # Report which library types will actually be built
+-  { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+-  { echo "$as_me:$LINENO: result: $can_build_shared" >&5
+-echo "${ECHO_T}$can_build_shared" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
++$as_echo_n "checking if libtool supports shared libraries... " >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
++$as_echo "$can_build_shared" >&6; }
+-  { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
++$as_echo_n "checking whether to build shared libraries... " >&6; }
+   test "$can_build_shared" = "no" && enable_shared=no
+   # On AIX, shared libraries and static libraries use the same namespace, and
+@@ -10680,15 +10206,15 @@
+     fi
+     ;;
+   esac
+-  { echo "$as_me:$LINENO: result: $enable_shared" >&5
+-echo "${ECHO_T}$enable_shared" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
++$as_echo "$enable_shared" >&6; }
+-  { echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
++$as_echo_n "checking whether to build static libraries... " >&6; }
+   # Make sure either enable_shared or enable_static is yes.
+   test "$enable_shared" = yes || enable_static=yes
+-  { echo "$as_me:$LINENO: result: $enable_static" >&5
+-echo "${ECHO_T}$enable_static" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
++$as_echo "$enable_static" >&6; }
+@@ -10735,22 +10261,23 @@
+ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+ # OS/2's system install, which has a completely different semantic
+ # ./install, which can be erroneously created by make from ./install.sh.
+-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
++# Reject install programs that cannot install multiple files.
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
++$as_echo_n "checking for a BSD-compatible install... " >&6; }
+ if test -z "$INSTALL"; then
+-if test "${ac_cv_path_install+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++if test "${ac_cv_path_install+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  # Account for people who put trailing slashes in PATH elements.
+-case $as_dir/ in
+-  ./ | .// | /cC/* | \
++    # Account for people who put trailing slashes in PATH elements.
++case $as_dir/ in #((
++  ./ | .// | /[cC]/* | \
+   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
++  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+   /usr/ucb/* ) ;;
+   *)
+     # OSF1 and SCO ODT 3.0 have their own names for install.
+@@ -10768,17 +10295,29 @@
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+-          ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+-          break 3
++          rm -rf conftest.one conftest.two conftest.dir
++          echo one > conftest.one
++          echo two > conftest.two
++          mkdir conftest.dir
++          if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
++            test -s conftest.one && test -s conftest.two &&
++            test -s conftest.dir/conftest.one &&
++            test -s conftest.dir/conftest.two
++          then
++            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
++            break 3
++          fi
+         fi
+       fi
+       done
+     done
+     ;;
+ esac
+-done
++
++  done
+ IFS=$as_save_IFS
++rm -rf conftest.one conftest.two conftest.dir
+ fi
+   if test "${ac_cv_path_install+set}" = set; then
+@@ -10791,8 +10330,8 @@
+     INSTALL=$ac_install_sh
+   fi
+ fi
+-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+-echo "${ECHO_T}$INSTALL" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
++$as_echo "$INSTALL" >&6; }
+ # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+ # It thinks the first close brace ends the variable substitution.
+@@ -10804,264 +10343,244 @@
+ # Checks for endianess
+-{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+-if test "${ac_cv_c_bigendian+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  # See if sys/param.h defines the BYTE_ORDER macro.
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
++$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
++if test "${ac_cv_c_bigendian+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_cv_c_bigendian=unknown
++    # See if we're dealing with a universal compiler.
++    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#ifndef __APPLE_CC__
++             not a universal capable compiler
++           #endif
++           typedef int dummy;
++
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++
++      # Check for potential -arch flags.  It is not universal unless
++      # there are at least two -arch flags with different values.
++      ac_arch=
++      ac_prev=
++      for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
++       if test -n "$ac_prev"; then
++         case $ac_word in
++           i?86 | x86_64 | ppc | ppc64)
++             if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
++               ac_arch=$ac_word
++             else
++               ac_cv_c_bigendian=universal
++               break
++             fi
++             ;;
++         esac
++         ac_prev=
++       elif test "x$ac_word" = "x-arch"; then
++         ac_prev=arch
++       fi
++       done
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++    if test $ac_cv_c_bigendian = unknown; then
++      # See if sys/param.h defines the BYTE_ORDER macro.
++      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <sys/types.h>
+-#include <sys/param.h>
++           #include <sys/param.h>
+ int
+ main ()
+ {
+-#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+-      && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+- bogus endian macros
+-#endif
++#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
++                   && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
++                   && LITTLE_ENDIAN)
++            bogus endian macros
++           #endif
+   ;
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   # It does; now see whether it defined to BIG_ENDIAN or not.
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <sys/types.h>
+-#include <sys/param.h>
++              #include <sys/param.h>
+ int
+ main ()
+ {
+ #if BYTE_ORDER != BIG_ENDIAN
+- not big endian
+-#endif
++               not big endian
++              #endif
+   ;
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_c_bigendian=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_c_bigendian=no
++  ac_cv_c_bigendian=no
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++    fi
++    if test $ac_cv_c_bigendian = unknown; then
++      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
++      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <limits.h>
+-      # It does not; compile a test program.
+-if test "$cross_compiling" = yes; then
+-  # try to guess the endianness by grepping values into an object file
+-  ac_cv_c_bigendian=unknown
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
++int
++main ()
++{
++#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
++            bogus endian macros
++           #endif
++
++  ;
++  return 0;
++}
+ _ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  # It does; now see whether it defined to _BIG_ENDIAN or not.
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+-short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+-short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+-short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+-short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
++#include <limits.h>
++
+ int
+ main ()
+ {
+- _ascii (); _ebcdic ();
++#ifndef _BIG_ENDIAN
++               not big endian
++              #endif
++
+   ;
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_c_bigendian=yes
++else
++  ac_cv_c_bigendian=no
+ fi
+-if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+-  if test "$ac_cv_c_bigendian" = unknown; then
+-    ac_cv_c_bigendian=no
+-  else
+-    # finding both strings is unlikely to happen, but who knows?
+-    ac_cv_c_bigendian=unknown
+-  fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++    fi
++    if test $ac_cv_c_bigendian = unknown; then
++      # Compile a test program.
++      if test "$cross_compiling" = yes; then :
++  # Try to guess by grepping values from an object file.
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++short int ascii_mm[] =
++                { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
++              short int ascii_ii[] =
++                { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
++              int use_ascii (int i) {
++                return ascii_mm[i] + ascii_ii[i];
++              }
++              short int ebcdic_ii[] =
++                { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
++              short int ebcdic_mm[] =
++                { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
++              int use_ebcdic (int i) {
++                return ebcdic_mm[i] + ebcdic_ii[i];
++              }
++              extern int foo;
++int
++main ()
++{
++return use_ascii (foo) == use_ebcdic (foo);
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
++            ac_cv_c_bigendian=yes
++          fi
++          if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
++            if test "$ac_cv_c_bigendian" = unknown; then
++              ac_cv_c_bigendian=no
++            else
++              # finding both strings is unlikely to happen, but who knows?
++              ac_cv_c_bigendian=unknown
++            fi
++          fi
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ $ac_includes_default
+ int
+ main ()
+ {
+-  /* Are we little or big endian?  From Harbison&Steele.  */
+-  union
+-  {
+-    long int l;
+-    char c[sizeof (long int)];
+-  } u;
+-  u.l = 1;
+-  return u.c[sizeof (long int) - 1] == 1;
++           /* Are we little or big endian?  From Harbison&Steele.  */
++           union
++           {
++             long int l;
++             char c[sizeof (long int)];
++           } u;
++           u.l = 1;
++           return u.c[sizeof (long int) - 1] == 1;
+   ;
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
++if ac_fn_c_try_run "$LINENO"; then :
+   ac_cv_c_bigendian=no
+ else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-ac_cv_c_bigendian=yes
++  ac_cv_c_bigendian=yes
+ fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+-
++    fi
+ fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
++$as_echo "$ac_cv_c_bigendian" >&6; }
++ case $ac_cv_c_bigendian in #(
++   yes)
++     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
++;; #(
++   no)
++      ;; #(
++   universal)
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+-echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+-case $ac_cv_c_bigendian in
+-  yes)
++$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+-cat >>confdefs.h <<\_ACEOF
+-#define WORDS_BIGENDIAN 1
+-_ACEOF
+- ;;
+-  no)
+-     ;;
+-  *)
+-    { { echo "$as_me:$LINENO: error: unknown endianness
+-presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+-echo "$as_me: error: unknown endianness
+-presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+-   { (exit 1); exit 1; }; } ;;
+-esac
++     ;; #(
++   *)
++     as_fn_error "unknown endianness
++ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
++ esac
+ case $host in
+ *-*-linux*)
+-cat >>confdefs.h <<\_ACEOF
+-#define LINUX 1
+-_ACEOF
++$as_echo "#define LINUX 1" >>confdefs.h
+       CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199506L" ;;
+ *-*-darwin*)
+-cat >>confdefs.h <<\_ACEOF
+-#define FREEBSD 1
+-_ACEOF
++$as_echo "#define FREEBSD 1" >>confdefs.h
+  ;;
+ *-*-freebsd*)
+-cat >>confdefs.h <<\_ACEOF
+-#define FREEBSD 1
+-_ACEOF
++$as_echo "#define FREEBSD 1" >>confdefs.h
+  ;;
+-*) { { echo "$as_me:$LINENO: error: Linux, FreeBSD, Darwin only, dude!" >&5
+-echo "$as_me: error: Linux, FreeBSD, Darwin only, dude!" >&2;}
+-   { (exit 1); exit 1; }; };;
++*) as_fn_error "Linux, FreeBSD, Darwin only, dude!" "$LINENO" 5;;
+ esac
+ # Global definitions
+@@ -11073,125 +10592,25 @@
+ CFLAGS="$CFLAGS -D_ISOC99_SOURCE -D_GNU_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE"
+ # check to see if struct dirent has the d_type member
+-{ echo "$as_me:$LINENO: checking for struct dirent.d_type" >&5
+-echo $ECHO_N "checking for struct dirent.d_type... $ECHO_C" >&6; }
+-if test "${ac_cv_member_struct_dirent_d_type+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <dirent.h>
+-
+-int
+-main ()
+-{
+-static struct dirent ac_aggr;
+-if (ac_aggr.d_type)
+-return 0;
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_cv_member_struct_dirent_d_type=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <dirent.h>
+-
+-int
+-main ()
+-{
+-static struct dirent ac_aggr;
+-if (sizeof ac_aggr.d_type)
+-return 0;
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_cv_member_struct_dirent_d_type=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_member_struct_dirent_d_type=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_dirent_d_type" >&5
+-echo "${ECHO_T}$ac_cv_member_struct_dirent_d_type" >&6; }
+-if test $ac_cv_member_struct_dirent_d_type = yes; then
++ac_fn_c_check_member "$LINENO" "struct dirent" "d_type" "ac_cv_member_struct_dirent_d_type" "#include <dirent.h>
++"
++if test "x$ac_cv_member_struct_dirent_d_type" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_STRUCT_DIRENT_D_TYPE 1
+-_ACEOF
++$as_echo "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h
+ fi
+ # Checks for libraries.
+-
+-{ echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
+-echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5
++$as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; }
++if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lpthread  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -11209,39 +10628,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_pthread_pthread_mutex_init=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_pthread_pthread_mutex_init=no
++  ac_cv_lib_pthread_pthread_mutex_init=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
+-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6; }
+-if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
++$as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; }
++if test "x$ac_cv_lib_pthread_pthread_mutex_init" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+ #define HAVE_LIBPTHREAD 1
+ _ACEOF
+@@ -11256,10 +10654,10 @@
+ if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}docbook2man", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}docbook2man; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_DOCBOOK2MAN+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_DOCBOOK2MAN+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$DOCBOOK2MAN"; then
+   ac_cv_prog_DOCBOOK2MAN="$DOCBOOK2MAN" # Let the user override the test.
+@@ -11269,25 +10667,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_DOCBOOK2MAN="${ac_tool_prefix}docbook2man"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ DOCBOOK2MAN=$ac_cv_prog_DOCBOOK2MAN
+ if test -n "$DOCBOOK2MAN"; then
+-  { echo "$as_me:$LINENO: result: $DOCBOOK2MAN" >&5
+-echo "${ECHO_T}$DOCBOOK2MAN" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOCBOOK2MAN" >&5
++$as_echo "$DOCBOOK2MAN" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -11296,10 +10694,10 @@
+   ac_ct_DOCBOOK2MAN=$DOCBOOK2MAN
+   # Extract the first word of "docbook2man", so it can be a program name with args.
+ set dummy docbook2man; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_DOCBOOK2MAN+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_DOCBOOK2MAN+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_DOCBOOK2MAN"; then
+   ac_cv_prog_ac_ct_DOCBOOK2MAN="$ac_ct_DOCBOOK2MAN" # Let the user override the test.
+@@ -11309,25 +10707,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_DOCBOOK2MAN="docbook2man"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_DOCBOOK2MAN=$ac_cv_prog_ac_ct_DOCBOOK2MAN
+ if test -n "$ac_ct_DOCBOOK2MAN"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_DOCBOOK2MAN" >&5
+-echo "${ECHO_T}$ac_ct_DOCBOOK2MAN" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DOCBOOK2MAN" >&5
++$as_echo "$ac_ct_DOCBOOK2MAN" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_DOCBOOK2MAN" = x; then
+@@ -11335,12 +10733,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     DOCBOOK2MAN=$ac_ct_DOCBOOK2MAN
+@@ -11352,10 +10746,10 @@
+ if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}docbook2pdf", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}docbook2pdf; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_DOCBOOK2PDF+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_DOCBOOK2PDF+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$DOCBOOK2PDF"; then
+   ac_cv_prog_DOCBOOK2PDF="$DOCBOOK2PDF" # Let the user override the test.
+@@ -11365,25 +10759,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_DOCBOOK2PDF="${ac_tool_prefix}docbook2pdf"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ DOCBOOK2PDF=$ac_cv_prog_DOCBOOK2PDF
+ if test -n "$DOCBOOK2PDF"; then
+-  { echo "$as_me:$LINENO: result: $DOCBOOK2PDF" >&5
+-echo "${ECHO_T}$DOCBOOK2PDF" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOCBOOK2PDF" >&5
++$as_echo "$DOCBOOK2PDF" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -11392,10 +10786,10 @@
+   ac_ct_DOCBOOK2PDF=$DOCBOOK2PDF
+   # Extract the first word of "docbook2pdf", so it can be a program name with args.
+ set dummy docbook2pdf; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_DOCBOOK2PDF+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_DOCBOOK2PDF+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_DOCBOOK2PDF"; then
+   ac_cv_prog_ac_ct_DOCBOOK2PDF="$ac_ct_DOCBOOK2PDF" # Let the user override the test.
+@@ -11405,25 +10799,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_DOCBOOK2PDF="docbook2pdf"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_DOCBOOK2PDF=$ac_cv_prog_ac_ct_DOCBOOK2PDF
+ if test -n "$ac_ct_DOCBOOK2PDF"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_DOCBOOK2PDF" >&5
+-echo "${ECHO_T}$ac_ct_DOCBOOK2PDF" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DOCBOOK2PDF" >&5
++$as_echo "$ac_ct_DOCBOOK2PDF" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_DOCBOOK2PDF" = x; then
+@@ -11431,12 +10825,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     DOCBOOK2PDF=$ac_ct_DOCBOOK2PDF
+@@ -11447,16 +10837,12 @@
+ # Checks for header files.
+-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+-if test "${ac_cv_header_stdc+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
++$as_echo_n "checking for ANSI C header files... " >&6; }
++if test "${ac_cv_header_stdc+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <stdlib.h>
+ #include <stdarg.h>
+@@ -11471,68 +10857,23 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_header_stdc=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_header_stdc=no
++  ac_cv_header_stdc=no
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_header_stdc = yes; then
+   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <string.h>
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  $EGREP "memchr" >/dev/null 2>&1; then
+-  :
+-else
+-  ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <stdlib.h>
++  $EGREP "memchr" >/dev/null 2>&1; then :
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  $EGREP "free" >/dev/null 2>&1; then
+-  :
+ else
+   ac_cv_header_stdc=no
+ fi
+@@ -11541,232 +10882,81 @@
+ fi
+ if test $ac_cv_header_stdc = yes; then
+-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+-  if test "$cross_compiling" = yes; then
+-  :
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+-#include <ctype.h>
+ #include <stdlib.h>
+-#if ((' ' & 0x0FF) == 0x020)
+-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+-#else
+-# define ISLOWER(c) \
+-                 (('a' <= (c) && (c) <= 'i') \
+-                   || ('j' <= (c) && (c) <= 'r') \
+-                   || ('s' <= (c) && (c) <= 'z'))
+-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+-#endif
+-
+-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+-int
+-main ()
+-{
+-  int i;
+-  for (i = 0; i < 256; i++)
+-    if (XOR (islower (i), ISLOWER (i))
+-      || toupper (i) != TOUPPER (i))
+-      return 2;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  :
+-else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-ac_cv_header_stdc=no
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-
+-fi
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+-if test $ac_cv_header_stdc = yes; then
+-
+-cat >>confdefs.h <<\_ACEOF
+-#define STDC_HEADERS 1
+-_ACEOF
+-
+-fi
+-
+-
+-
+-
+-
+-
+-
+-
+-
+-for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h
+-do
+-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-else
+-  # Is the header compilable?
+-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-#include <$ac_header>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_header_compiler=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-      ac_header_compiler=no
++_ACEOF
++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++  $EGREP "free" >/dev/null 2>&1; then :
++
++else
++  ac_cv_header_stdc=no
+ fi
++rm -f conftest*
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+-echo "${ECHO_T}$ac_header_compiler" >&6; }
++fi
+-# Is the header present?
+-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++if test $ac_cv_header_stdc = yes; then
++  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
++  if test "$cross_compiling" = yes; then :
++  :
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+-#include <$ac_header>
++#include <ctype.h>
++#include <stdlib.h>
++#if ((' ' & 0x0FF) == 0x020)
++# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
++# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
++#else
++# define ISLOWER(c) \
++                 (('a' <= (c) && (c) <= 'i') \
++                   || ('j' <= (c) && (c) <= 'r') \
++                   || ('s' <= (c) && (c) <= 'z'))
++# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
++#endif
++
++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
++int
++main ()
++{
++  int i;
++  for (i = 0; i < 256; i++)
++    if (XOR (islower (i), ISLOWER (i))
++      || toupper (i) != TOUPPER (i))
++      return 2;
++  return 0;
++}
+ _ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  ac_header_preproc=yes
++if ac_fn_c_try_run "$LINENO"; then :
++
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++  ac_cv_header_stdc=no
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
+-  ac_header_preproc=no
+ fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
++$as_echo "$ac_cv_header_stdc" >&6; }
++if test $ac_cv_header_stdc = yes; then
+-rm -f conftest.err conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+-echo "${ECHO_T}$ac_header_preproc" >&6; }
++$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+-# So?  What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+-  yes:no: )
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+-    ac_header_preproc=yes
+-    ;;
+-  no:yes:* )
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+-    ( cat <<\_ASBOX
+-## ------------------------------------ ##
+-## Report this to nufw-devel@nongnu.org ##
+-## ------------------------------------ ##
+-_ASBOX
+-     ) | sed "s/^/$as_me: WARNING:     /" >&2
+-    ;;
+-esac
+-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  eval "$as_ac_Header=\$ac_header_preproc"
+ fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-fi
+-if test `eval echo '${'$as_ac_Header'}'` = yes; then
++for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h
++do :
++  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
++ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
++eval as_val=\$$as_ac_Header
++   if test "x$as_val" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+ _ACEOF
+ fi
+@@ -11775,16 +10965,12 @@
+ # Checks for typedefs, structures, and compiler characteristics.
+-{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+-if test "${ac_cv_c_const+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
++$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
++if test "${ac_cv_c_const+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -11844,203 +11030,44 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
++if ac_fn_c_try_compile "$LINENO"; then :
+   ac_cv_c_const=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_c_const=no
++  ac_cv_c_const=no
+ fi
+-
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+-echo "${ECHO_T}$ac_cv_c_const" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
++$as_echo "$ac_cv_c_const" >&6; }
+ if test $ac_cv_c_const = no; then
+-cat >>confdefs.h <<\_ACEOF
+-#define const
+-_ACEOF
++$as_echo "#define const /**/" >>confdefs.h
+ fi
+ # Checks for library functions.
+-
+ for ac_header in stdlib.h
+-do
+-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-else
+-  # Is the header compilable?
+-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-#include <$ac_header>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_header_compiler=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_header_compiler=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+-echo "${ECHO_T}$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <$ac_header>
+-_ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  ac_header_preproc=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-  ac_header_preproc=no
+-fi
+-
+-rm -f conftest.err conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+-echo "${ECHO_T}$ac_header_preproc" >&6; }
+-
+-# So?  What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+-  yes:no: )
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+-    ac_header_preproc=yes
+-    ;;
+-  no:yes:* )
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+-    ( cat <<\_ASBOX
+-## ------------------------------------ ##
+-## Report this to nufw-devel@nongnu.org ##
+-## ------------------------------------ ##
+-_ASBOX
+-     ) | sed "s/^/$as_me: WARNING:     /" >&2
+-    ;;
+-esac
+-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  eval "$as_ac_Header=\$ac_header_preproc"
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-
+-fi
+-if test `eval echo '${'$as_ac_Header'}'` = yes; then
++do :
++  ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
++if test "x$ac_cv_header_stdlib_h" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++#define HAVE_STDLIB_H 1
+ _ACEOF
+ fi
+ done
+-{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+-echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; }
+-if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
++$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
++if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  if test "$cross_compiling" = yes; then
++  if test "$cross_compiling" = yes; then :
+   ac_cv_func_malloc_0_nonnull=no
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #if defined STDC_HEADERS || defined HAVE_STDLIB_H
+ # include <stdlib.h>
+@@ -12056,52 +11083,24 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
++if ac_fn_c_try_run "$LINENO"; then :
+   ac_cv_func_malloc_0_nonnull=yes
+ else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-ac_cv_func_malloc_0_nonnull=no
++  ac_cv_func_malloc_0_nonnull=no
+ fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+-
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+-echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; }
+-if test $ac_cv_func_malloc_0_nonnull = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
++$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
++if test $ac_cv_func_malloc_0_nonnull = yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_MALLOC 1
+-_ACEOF
++$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
+ else
+-  cat >>confdefs.h <<\_ACEOF
+-#define HAVE_MALLOC 0
+-_ACEOF
++  $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
+    case " $LIBOBJS " in
+   *" malloc.$ac_objext "* ) ;;
+@@ -12110,30 +11109,23 @@
+ esac
+-cat >>confdefs.h <<\_ACEOF
+-#define malloc rpl_malloc
+-_ACEOF
++$as_echo "#define malloc rpl_malloc" >>confdefs.h
+ fi
+-
+-{ echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
+-echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; }
+-if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
++$as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; }
++if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   rm -f conftest.sym conftest.file
+ echo >conftest.file
+ if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+-  if test "$cross_compiling" = yes; then
++  if test "$cross_compiling" = yes; then :
+   ac_cv_func_lstat_dereferences_slashed_symlink=no
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ $ac_includes_default
+ int
+@@ -12148,39 +11140,15 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
++if ac_fn_c_try_run "$LINENO"; then :
+   ac_cv_func_lstat_dereferences_slashed_symlink=yes
+ else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-ac_cv_func_lstat_dereferences_slashed_symlink=no
++  ac_cv_func_lstat_dereferences_slashed_symlink=no
+ fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+-
+ else
+   # If the `ln -s' command failed, then we probably don't even
+   # have an lstat function.
+@@ -12189,8 +11157,8 @@
+ rm -f conftest.sym conftest.file
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+-echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
++$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+ test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+@@ -12208,19 +11176,15 @@
+ fi
+-{ echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
+-echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6; }
+-if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
++$as_echo_n "checking whether stat accepts an empty string... " >&6; }
++if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  if test "$cross_compiling" = yes; then
++  if test "$cross_compiling" = yes; then :
+   ac_cv_func_stat_empty_string_bug=yes
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ $ac_includes_default
+ int
+@@ -12232,149 +11196,40 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  ac_cv_func_stat_empty_string_bug=no
+-else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-ac_cv_func_stat_empty_string_bug=yes
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
+-echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6; }
+-if test $ac_cv_func_stat_empty_string_bug = yes; then
+-  case " $LIBOBJS " in
+-  *" stat.$ac_objext "* ) ;;
+-  *) LIBOBJS="$LIBOBJS stat.$ac_objext"
+- ;;
+-esac
+-
+-
+-cat >>confdefs.h <<_ACEOF
+-#define HAVE_STAT_EMPTY_STRING_BUG 1
+-_ACEOF
+-
+-fi
+-
+-
+-
+-
+-
+-
+-for ac_func in gethostbyname memset socket strcasecmp strspn
+-do
+-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+-#define $ac_func innocuous_$ac_func
+-
+-/* System header to define __stub macros and hopefully few prototypes,
+-    which can conflict with char $ac_func (); below.
+-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+-    <limits.h> exists even on freestanding compilers.  */
+-
+-#ifdef __STDC__
+-# include <limits.h>
+-#else
+-# include <assert.h>
+-#endif
+-
+-#undef $ac_func
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char $ac_func ();
+-/* The GNU C library defines this for functions which it implements
+-    to always fail with ENOSYS.  Some functions are actually named
+-    something starting with __ and the normal name is an alias.  */
+-#if defined __stub_$ac_func || defined __stub___$ac_func
+-choke me
+-#endif
+-
+-int
+-main ()
+-{
+-return $ac_func ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
+-  eval "$as_ac_var=yes"
++if ac_fn_c_try_run "$LINENO"; then :
++  ac_cv_func_stat_empty_string_bug=no
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++  ac_cv_func_stat_empty_string_bug=yes
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
+-      eval "$as_ac_var=no"
+ fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
++$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
++if test $ac_cv_func_stat_empty_string_bug = yes; then
++  case " $LIBOBJS " in
++  *" stat.$ac_objext "* ) ;;
++  *) LIBOBJS="$LIBOBJS stat.$ac_objext"
++ ;;
++esac
++
++
++cat >>confdefs.h <<_ACEOF
++#define HAVE_STAT_EMPTY_STRING_BUG 1
++_ACEOF
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
+ fi
+-ac_res=`eval echo '${'$as_ac_var'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-if test `eval echo '${'$as_ac_var'}'` = yes; then
++
++for ac_func in gethostbyname memset socket strcasecmp strspn
++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"
++eval as_val=\$$as_ac_var
++   if test "x$as_val" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
++#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+ _ACEOF
+ fi
+@@ -12387,10 +11242,126 @@
+ #AM_CHECK_PATH(libgnutls], [gnutls_init],AC_DEFINE([HAVE_LIBRARY_GNUTLS],[1],[Gnutls lib flag]), check_gnutls=no)
++
++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
++      if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  case $PKG_CONFIG in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  ;;
++esac
++fi
++PKG_CONFIG=$ac_cv_path_PKG_CONFIG
++if test -n "$PKG_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
++$as_echo "$PKG_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_path_PKG_CONFIG"; then
++  ac_pt_PKG_CONFIG=$PKG_CONFIG
++  # Extract the first word of "pkg-config", so it can be a program name with args.
++set dummy pkg-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  case $ac_pt_PKG_CONFIG in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  ;;
++esac
++fi
++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
++if test -n "$ac_pt_PKG_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
++$as_echo "$ac_pt_PKG_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++  if test "x$ac_pt_PKG_CONFIG" = x; then
++    PKG_CONFIG=""
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    PKG_CONFIG=$ac_pt_PKG_CONFIG
++  fi
++else
++  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
++fi
++
++fi
++if test -n "$PKG_CONFIG"; then
++      _pkg_min_version=0.9.0
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
++      if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++      else
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++              PKG_CONFIG=""
++      fi
++
++fi
++
+ NEED_LIBGCRYPT_VERSION=1.2.0
+ # Check whether --with-libgcrypt-prefix was given.
+-if test "${with_libgcrypt_prefix+set}" = set; then
++if test "${with_libgcrypt_prefix+set}" = set; then :
+   withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval"
+ else
+   libgcrypt_config_prefix=""
+@@ -12404,10 +11375,10 @@
+   # Extract the first word of "libgcrypt-config", so it can be a program name with args.
+ set dummy libgcrypt-config; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_path_LIBGCRYPT_CONFIG+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_LIBGCRYPT_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   case $LIBGCRYPT_CONFIG in
+   [\\/]* | ?:[\\/]*)
+@@ -12419,14 +11390,14 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+   test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no"
+@@ -12435,11 +11406,11 @@
+ fi
+ LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
+ if test -n "$LIBGCRYPT_CONFIG"; then
+-  { echo "$as_me:$LINENO: result: $LIBGCRYPT_CONFIG" >&5
+-echo "${ECHO_T}$LIBGCRYPT_CONFIG" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5
++$as_echo "$LIBGCRYPT_CONFIG" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -12452,8 +11423,8 @@
+      min_libgcrypt_version="$tmp"
+   fi
+-  { echo "$as_me:$LINENO: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
+-echo $ECHO_N "checking for LIBGCRYPT - version >= $min_libgcrypt_version... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
++$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; }
+   ok=no
+   if test "$LIBGCRYPT_CONFIG" != "no" ; then
+     req_major=`echo $min_libgcrypt_version | \
+@@ -12486,11 +11457,11 @@
+     fi
+   fi
+   if test $ok = yes; then
+-    { echo "$as_me:$LINENO: result: yes ($libgcrypt_config_version)" >&5
+-echo "${ECHO_T}yes ($libgcrypt_config_version)" >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5
++$as_echo "yes ($libgcrypt_config_version)" >&6; }
+   else
+-    { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+   fi
+   if test $ok = yes; then
+      # If we have a recent libgcrypt, we should also check that the
+@@ -12498,15 +11469,15 @@
+      if test "$req_libgcrypt_api" -gt 0 ; then
+         tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+         if test "$tmp" -gt 0 ; then
+-           { echo "$as_me:$LINENO: checking LIBGCRYPT API version" >&5
+-echo $ECHO_N "checking LIBGCRYPT API version... $ECHO_C" >&6; }
++           { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5
++$as_echo_n "checking LIBGCRYPT API version... " >&6; }
+            if test "$req_libgcrypt_api" -eq "$tmp" ; then
+-             { echo "$as_me:$LINENO: result: okay" >&5
+-echo "${ECHO_T}okay" >&6; }
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5
++$as_echo "okay" >&6; }
+            else
+              ok=no
+-             { echo "$as_me:$LINENO: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
+-echo "${ECHO_T}does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
++             { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
++$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
+            fi
+         fi
+      fi
+@@ -12521,302 +11492,93 @@
+     :
+   fi
+-
+-
+-if test "x$LIBGCRYPT_LIBS" = "x"; then
+-  { { echo "$as_me:$LINENO: error: libgcrypt is needed.
+-                See ftp://ftp.gnupg.org/gcrypt/ ." >&5
+-echo "$as_me: error: libgcrypt is needed.
+-                See ftp://ftp.gnupg.org/gcrypt/ ." >&2;}
+-   { (exit 1); exit 1; }; }
+-else
+-  CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
+-  LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS"
+-fi
+-
+-NEED_LIBGNUTLS_VERSION=1.0.16
+-
+-# Check whether --with-libgnutls-prefix was given.
+-if test "${with_libgnutls_prefix+set}" = set; then
+-  withval=$with_libgnutls_prefix; libgnutls_config_prefix="$withval"
+-else
+-  libgnutls_config_prefix=""
+-fi
+-
+-
+-  if test x$libgnutls_config_prefix != x ; then
+-     if test x${LIBGNUTLS_CONFIG+set} != xset ; then
+-        LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
+-     fi
+-  fi
+-
+-  # Extract the first word of "libgnutls-config", so it can be a program name with args.
+-set dummy libgnutls-config; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_path_LIBGNUTLS_CONFIG+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  case $LIBGNUTLS_CONFIG in
+-  [\\/]* | ?:[\\/]*)
+-  ac_cv_path_LIBGNUTLS_CONFIG="$LIBGNUTLS_CONFIG" # Let the user override the test with a path.
+-  ;;
+-  *)
+-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+-  IFS=$as_save_IFS
+-  test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
+-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+-    ac_cv_path_LIBGNUTLS_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+-    break 2
+-  fi
+-done
+-done
+-IFS=$as_save_IFS
+-
+-  test -z "$ac_cv_path_LIBGNUTLS_CONFIG" && ac_cv_path_LIBGNUTLS_CONFIG="no"
+-  ;;
+-esac
+-fi
+-LIBGNUTLS_CONFIG=$ac_cv_path_LIBGNUTLS_CONFIG
+-if test -n "$LIBGNUTLS_CONFIG"; then
+-  { echo "$as_me:$LINENO: result: $LIBGNUTLS_CONFIG" >&5
+-echo "${ECHO_T}$LIBGNUTLS_CONFIG" >&6; }
+-else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
+-fi
+-
+-
+-  min_libgnutls_version="$NEED_LIBGNUTLS_VERSION"
+-  { echo "$as_me:$LINENO: checking for libgnutls - version >= $min_libgnutls_version" >&5
+-echo $ECHO_N "checking for libgnutls - version >= $min_libgnutls_version... $ECHO_C" >&6; }
+-  no_libgnutls=""
+-  if test "$LIBGNUTLS_CONFIG" = "no" ; then
+-    no_libgnutls=yes
+-  else
+-    LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
+-    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
+-    libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
+-
+-
+-      ac_save_CFLAGS="$CFLAGS"
+-      ac_save_LIBS="$LIBS"
+-      CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+-      LIBS="$LIBS $LIBGNUTLS_LIBS"
+-      rm -f conf.libgnutlstest
+-      if test "$cross_compiling" = yes; then
+-  echo $ac_n "cross compiling; assumed OK... $ac_c"
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <gnutls/gnutls.h>
+-
+-int
+-main ()
+-{
+-    system ("touch conf.libgnutlstest");
+-
+-    if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
+-    {
+-      printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
+-             "$libgnutls_config_version", gnutls_check_version(NULL) );
+-      printf("*** was found! If libgnutls-config was correct, then it is best\n");
+-      printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
+-      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+-      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+-      printf("*** required on your system.\n");
+-      printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
+-      printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
+-      printf("*** before re-running configure\n");
+-    }
+-    else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
+-    {
+-      printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
+-      printf("*** library (version %s)\n", gnutls_check_version(NULL) );
+-    }
+-    else
+-    {
+-      if ( gnutls_check_version( "$min_libgnutls_version" ) )
+-      {
+-        return 0;
+-      }
+-     else
+-      {
+-        printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
+-                gnutls_check_version(NULL) );
+-        printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
+-               "$min_libgnutls_version" );
+-        printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
+-        printf("*** \n");
+-        printf("*** If you have already installed a sufficiently new version, this error\n");
+-        printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
+-        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+-        printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
+-        printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
+-        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+-        printf("*** so that the correct libraries are found at run-time))\n");
+-      }
+-    }
+-  return 1;
+-}
+-
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  :
+-else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-no_libgnutls=yes
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-
+-       CFLAGS="$ac_save_CFLAGS"
+-       LIBS="$ac_save_LIBS"
+-  fi
+-
+-  if test "x$no_libgnutls" = x ; then
+-     { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
+-     :
+-  else
+-     if test -f conf.libgnutlstest ; then
+-        :
+-     else
+-        { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
+-     fi
+-     if test "$LIBGNUTLS_CONFIG" = "no" ; then
+-       echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
+-       echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
+-       echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
+-       echo "*** full path to libgnutls-config."
+-     else
+-       if test -f conf.libgnutlstest ; then
+-        :
+-       else
+-          echo "*** Could not run libgnutls test program, checking why..."
+-          CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+-          LIBS="$LIBS $LIBGNUTLS_LIBS"
+-          cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <gnutls/gnutls.h>
+-
+-int
+-main ()
+-{
+- return !!gnutls_check_version(NULL);
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
+-   echo "*** The test program compiled, but did not run. This usually means"
+-          echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
+-          echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
+-          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+-          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+-          echo "*** is required on your system"
+-          echo "***"
+-          echo "*** If you have an old version installed, it is best to remove it, although"
+-          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+-          echo "***"
++
++
++if test "x$LIBGCRYPT_LIBS" = "x"; then
++  as_fn_error "libgcrypt is needed.
++                See ftp://ftp.gnupg.org/gcrypt/ ." "$LINENO" 5
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++  CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
++  LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS"
++fi
++
++NEED_LIBGNUTLS_VERSION=1.0.16
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUTLS" >&5
++$as_echo_n "checking for GNUTLS... " >&6; }
+-       echo "*** The test program failed to compile or link. See the file config.log for the"
+-          echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
+-          echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
+-          echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG"
++if test -n "$PKG_CONFIG"; then
++    if test -n "$GNUTLS_CFLAGS"; then
++        pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS"
++    else
++        if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls >= \$NEED_LIBGNUTLS_VERSION\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "gnutls >= $NEED_LIBGNUTLS_VERSION") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_GNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= $NEED_LIBGNUTLS_VERSION" 2>/dev/null`
++else
++  pkg_failed=yes
++fi
++    fi
++else
++      pkg_failed=untried
++fi
++if test -n "$PKG_CONFIG"; then
++    if test -n "$GNUTLS_LIBS"; then
++        pkg_cv_GNUTLS_LIBS="$GNUTLS_LIBS"
++    else
++        if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls >= \$NEED_LIBGNUTLS_VERSION\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "gnutls >= $NEED_LIBGNUTLS_VERSION") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_GNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= $NEED_LIBGNUTLS_VERSION" 2>/dev/null`
++else
++  pkg_failed=yes
++fi
++    fi
++else
++      pkg_failed=untried
+ fi
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
+-          CFLAGS="$ac_save_CFLAGS"
+-          LIBS="$ac_save_LIBS"
+-       fi
+-     fi
+-     LIBGNUTLS_CFLAGS=""
+-     LIBGNUTLS_LIBS=""
+-     :
+-  fi
+-  rm -f conf.libgnutlstest
++if test $pkg_failed = yes; then
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++        _pkg_short_errors_supported=yes
++else
++        _pkg_short_errors_supported=no
++fi
++        if test $_pkg_short_errors_supported = yes; then
++              GNUTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gnutls >= $NEED_LIBGNUTLS_VERSION"`
++        else
++              GNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= $NEED_LIBGNUTLS_VERSION"`
++        fi
++      # Put the nasty error message in config.log where it belongs
++      echo "$GNUTLS_PKG_ERRORS" >&5
+-if test "x$LIBGNUTLS_LIBS" = "x"; then
+-  { { echo "$as_me:$LINENO: error: libgnutls is needed.
+-                See www.gnu.org/software/gnutls/ ." >&5
+-echo "$as_me: error: libgnutls is needed.
+-                See www.gnu.org/software/gnutls/ ." >&2;}
+-   { (exit 1); exit 1; }; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++                exit
++elif test $pkg_failed = untried; then
++      exit
++else
++      GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS
++      GNUTLS_LIBS=$pkg_cv_GNUTLS_LIBS
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++      :
+ fi
+ #Configure database support, depending on user input
+ # Check whether --with-prelude-log was given.
+-if test "${with_prelude_log+set}" = set; then
++if test "${with_prelude_log+set}" = set; then :
+   withval=$with_prelude_log; enable_prelude_log=$withval
+ else
+   enable_prelude_log=""
+@@ -12825,7 +11587,7 @@
+ # Check whether --with-mysql-log was given.
+-if test "${with_mysql_log+set}" = set; then
++if test "${with_mysql_log+set}" = set; then :
+   withval=$with_mysql_log; enable_mysql_log=$withval
+ else
+   enable_mysql_log=""
+@@ -12833,7 +11595,7 @@
+ # Check whether --with-mysql-auth was given.
+-if test "${with_mysql_auth+set}" = set; then
++if test "${with_mysql_auth+set}" = set; then :
+   withval=$with_mysql_auth; enable_mysql_auth=$withval
+ else
+   enable_mysql_auth=""
+@@ -12841,7 +11603,7 @@
+ # Check whether --with-pgsql-log was given.
+-if test "${with_pgsql_log+set}" = set; then
++if test "${with_pgsql_log+set}" = set; then :
+   withval=$with_pgsql_log; enable_pgsql_log=$withval
+ else
+   enable_pgsql_log=""
+@@ -12849,7 +11611,7 @@
+ # Check whether --with-syslog-log was given.
+-if test "${with_syslog_log+set}" = set; then
++if test "${with_syslog_log+set}" = set; then :
+   withval=$with_syslog_log; enable_syslog_log=$withval
+ else
+   enable_syslog_log="yes"
+@@ -12858,7 +11620,7 @@
+ # Check whether --with-plaintext-auth was given.
+-if test "${with_plaintext_auth+set}" = set; then
++if test "${with_plaintext_auth+set}" = set; then :
+   withval=$with_plaintext_auth; enable_plaintext_auth=$withval
+ else
+   enable_plaintext_auth="yes"
+@@ -12866,7 +11628,7 @@
+ # Check whether --with-mark-group was given.
+-if test "${with_mark_group+set}" = set; then
++if test "${with_mark_group+set}" = set; then :
+   withval=$with_mark_group; enable_mark_group=$withval
+ else
+   enable_mark_group="yes"
+@@ -12874,7 +11636,7 @@
+ # Check whether --with-mark-field was given.
+-if test "${with_mark_field+set}" = set; then
++if test "${with_mark_field+set}" = set; then :
+   withval=$with_mark_field; enable_mark_field=$withval
+ else
+   enable_mark_field="yes"
+@@ -12882,7 +11644,7 @@
+ # Check whether --with-mark-flag was given.
+-if test "${with_mark_flag+set}" = set; then
++if test "${with_mark_flag+set}" = set; then :
+   withval=$with_mark_flag; enable_mark_flag=$withval
+ else
+   enable_mark_flag="yes"
+@@ -12890,7 +11652,7 @@
+ # Check whether --with-system-auth was given.
+-if test "${with_system_auth+set}" = set; then
++if test "${with_system_auth+set}" = set; then :
+   withval=$with_system_auth; enable_system_auth=$withval
+ else
+   enable_system_auth="yes"
+@@ -12899,7 +11661,7 @@
+ # Check whether --with-ldap was given.
+-if test "${with_ldap+set}" = set; then
++if test "${with_ldap+set}" = set; then :
+   withval=$with_ldap; ldap=$withval
+ else
+   ldap=""
+@@ -12909,7 +11671,7 @@
+ # Check whether --with-nfqueue was given.
+-if test "${with_nfqueue+set}" = set; then
++if test "${with_nfqueue+set}" = set; then :
+   withval=$with_nfqueue; use_nfqueue=$withval
+ else
+   use_nfqueue="yes"
+@@ -12917,7 +11679,7 @@
+ # Check whether --with-nfconntrack was given.
+-if test "${with_nfconntrack+set}" = set; then
++if test "${with_nfconntrack+set}" = set; then :
+   withval=$with_nfconntrack; use_nfconntrack=$withval
+ else
+   use_nfconntrack="yes"
+@@ -12927,7 +11689,7 @@
+ # Check whether --with-utf8 was given.
+-if test "${with_utf8+set}" = set; then
++if test "${with_utf8+set}" = set; then :
+   withval=$with_utf8;
+ cat >>confdefs.h <<_ACEOF
+ #define USE_UTF8 1
+@@ -12937,49 +11699,49 @@
+ # Check whether --with-fixedtimeout was given.
+-if test "${with_fixedtimeout+set}" = set; then
++if test "${with_fixedtimeout+set}" = set; then :
+   withval=$with_fixedtimeout; have_conntrack_fixedtimeout=$withval
+ fi
+ # Check whether --enable-nufw was given.
+-if test "${enable_nufw+set}" = set; then
++if test "${enable_nufw+set}" = set; then :
+   enableval=$enable_nufw; build_nufw=$enableval
+ else
+   build_nufw="yes"
+ fi
+ # Check whether --enable-nuauth was given.
+-if test "${enable_nuauth+set}" = set; then
++if test "${enable_nuauth+set}" = set; then :
+   enableval=$enable_nuauth; build_nuauth=$enableval
+ else
+   build_nuauth="yes"
+ fi
+ # Check whether --enable-libnuclient was given.
+-if test "${enable_libnuclient+set}" = set; then
++if test "${enable_libnuclient+set}" = set; then :
+   enableval=$enable_libnuclient; build_libnuclient=$enableval
+ else
+   build_libnuclient="yes"
+ fi
+ # Check whether --enable-nutcpc was given.
+-if test "${enable_nutcpc+set}" = set; then
++if test "${enable_nutcpc+set}" = set; then :
+   enableval=$enable_nutcpc; build_nutcpc=$enableval
+ else
+   build_nutcpc="yes"
+ fi
+ # Check whether --enable-pam-nufw was given.
+-if test "${enable_pam_nufw+set}" = set; then
++if test "${enable_pam_nufw+set}" = set; then :
+   enableval=$enable_pam_nufw; build_pam_nufw=$enableval
+ else
+   build_pam_nufw="no"
+ fi
+ # Check whether --enable-nuauth-command was given.
+-if test "${enable_nuauth_command+set}" = set; then
++if test "${enable_nuauth_command+set}" = set; then :
+   enableval=$enable_nuauth_command; build_nuauth_command=$enableval
+ else
+   build_nuauth_command="yes"
+@@ -12990,10 +11752,10 @@
+     if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}python", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}python; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_PYTHON+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_PYTHON+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$PYTHON"; then
+   ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test.
+@@ -13003,25 +11765,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_PYTHON="${ac_tool_prefix}python"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ PYTHON=$ac_cv_prog_PYTHON
+ if test -n "$PYTHON"; then
+-  { echo "$as_me:$LINENO: result: $PYTHON" >&5
+-echo "${ECHO_T}$PYTHON" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
++$as_echo "$PYTHON" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -13030,10 +11792,10 @@
+   ac_ct_PYTHON=$PYTHON
+   # Extract the first word of "python", so it can be a program name with args.
+ set dummy python; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_PYTHON+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_PYTHON+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_PYTHON"; then
+   ac_cv_prog_ac_ct_PYTHON="$ac_ct_PYTHON" # Let the user override the test.
+@@ -13043,25 +11805,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_PYTHON="python"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_PYTHON=$ac_cv_prog_ac_ct_PYTHON
+ if test -n "$ac_ct_PYTHON"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_PYTHON" >&5
+-echo "${ECHO_T}$ac_ct_PYTHON" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PYTHON" >&5
++$as_echo "$ac_ct_PYTHON" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_PYTHON" = x; then
+@@ -13069,12 +11831,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     PYTHON=$ac_ct_PYTHON
+@@ -13091,7 +11849,7 @@
+ fi
+ # Check whether --enable-debug was given.
+-if test "${enable_debug+set}" = set; then
++if test "${enable_debug+set}" = set; then :
+   enableval=$enable_debug; debug=$enableval
+ else
+   debug=""
+@@ -13099,7 +11857,7 @@
+ # Check whether --with-perf-display was given.
+-if test "${with_perf_display+set}" = set; then
++if test "${with_perf_display+set}" = set; then :
+   withval=$with_perf_display; use_perf_display=$withval
+ else
+   use_perf_display="yes"
+@@ -13120,18 +11878,14 @@
+       -o "${build_nutcpc}" = "yes" \
+       -o "${build_pam_nufw}" = "yes" \
+ ; then
+-      { echo "$as_me:$LINENO: checking for sasl_server_init in -lsasl2" >&5
+-echo $ECHO_N "checking for sasl_server_init in -lsasl2... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_sasl2_sasl_server_init+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sasl_server_init in -lsasl2" >&5
++$as_echo_n "checking for sasl_server_init in -lsasl2... " >&6; }
++if test "${ac_cv_lib_sasl2_sasl_server_init+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lsasl2  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13149,43 +11903,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_sasl2_sasl_server_init=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_sasl2_sasl_server_init=no
++  ac_cv_lib_sasl2_sasl_server_init=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sasl2_sasl_server_init" >&5
+-echo "${ECHO_T}$ac_cv_lib_sasl2_sasl_server_init" >&6; }
+-if test $ac_cv_lib_sasl2_sasl_server_init = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sasl2_sasl_server_init" >&5
++$as_echo "$ac_cv_lib_sasl2_sasl_server_init" >&6; }
++if test "x$ac_cv_lib_sasl2_sasl_server_init" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_SASL2 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_SASL2 1" >>confdefs.h
+ else
+   check_sasl=no
+@@ -13194,18 +11925,14 @@
+ fi
+ if test "${build_nuauth}" = "yes"; then
+-      { echo "$as_me:$LINENO: checking for sasl_server_init in -lsasl2" >&5
+-echo $ECHO_N "checking for sasl_server_init in -lsasl2... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_sasl2_sasl_server_init+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sasl_server_init in -lsasl2" >&5
++$as_echo_n "checking for sasl_server_init in -lsasl2... " >&6; }
++if test "${ac_cv_lib_sasl2_sasl_server_init+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lsasl2  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13223,43 +11950,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_sasl2_sasl_server_init=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_sasl2_sasl_server_init=no
++  ac_cv_lib_sasl2_sasl_server_init=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sasl2_sasl_server_init" >&5
+-echo "${ECHO_T}$ac_cv_lib_sasl2_sasl_server_init" >&6; }
+-if test $ac_cv_lib_sasl2_sasl_server_init = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sasl2_sasl_server_init" >&5
++$as_echo "$ac_cv_lib_sasl2_sasl_server_init" >&6; }
++if test "x$ac_cv_lib_sasl2_sasl_server_init" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_SASL2 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_SASL2 1" >>confdefs.h
+ else
+   check_sasl=no
+@@ -13267,7 +11971,7 @@
+         # glib stuff
+         # Check whether --enable-glibtest was given.
+-if test "${enable_glibtest+set}" = set; then
++if test "${enable_glibtest+set}" = set; then :
+   enableval=$enable_glibtest;
+ else
+   enable_glibtest=yes
+@@ -13302,10 +12006,10 @@
+       if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   case $PKG_CONFIG in
+   [\\/]* | ?:[\\/]*)
+@@ -13317,14 +12021,14 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+   ;;
+@@ -13332,11 +12036,11 @@
+ fi
+ PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+ if test -n "$PKG_CONFIG"; then
+-  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+-echo "${ECHO_T}$PKG_CONFIG" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
++$as_echo "$PKG_CONFIG" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -13345,10 +12049,10 @@
+   ac_pt_PKG_CONFIG=$PKG_CONFIG
+   # Extract the first word of "pkg-config", so it can be a program name with args.
+ set dummy pkg-config; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   case $ac_pt_PKG_CONFIG in
+   [\\/]* | ?:[\\/]*)
+@@ -13360,14 +12064,14 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+   ;;
+@@ -13375,11 +12079,11 @@
+ fi
+ ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+ if test -n "$ac_pt_PKG_CONFIG"; then
+-  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+-echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
++$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_pt_PKG_CONFIG" = x; then
+@@ -13387,12 +12091,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     PKG_CONFIG=$ac_pt_PKG_CONFIG
+@@ -13404,14 +12104,14 @@
+ fi
+ if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=0.16
+-      { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+-echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+-              { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+       else
+-              { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+               PKG_CONFIG=""
+       fi
+@@ -13425,8 +12125,8 @@
+   fi
+   min_glib_version=2.4.0
+-  { echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5
+-echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5
++$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; }
+   if test x$PKG_CONFIG != xno ; then
+     ## don't try to run the test against uninstalled libtool libs
+@@ -13461,14 +12161,10 @@
+       CFLAGS="$CFLAGS $GLIB_CFLAGS"
+       LIBS="$GLIB_LIBS $LIBS"
+       rm -f conf.glibtest
+-      if test "$cross_compiling" = yes; then
++      if test "$cross_compiling" = yes; then :
+   echo $ac_n "cross compiling; assumed OK... $ac_c"
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <glib.h>
+@@ -13480,8 +12176,9 @@
+ {
+   int major, minor, micro;
+   char *tmp_version;
++  int ignored;
+-  system ("touch conf.glibtest");
++  ignored = system ("touch conf.glibtest");
+   /* HP/UX 9 (%@#!) writes to sscanf strings */
+   tmp_version = g_strdup("$min_glib_version");
+@@ -13543,50 +12240,26 @@
+ }
+ _ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  :
+-else
+-  echo "$as_me: program exited with status $ac_status" >&5
+-echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++if ac_fn_c_try_run "$LINENO"; then :
+-( exit $ac_status )
+-no_glib=yes
++else
++  no_glib=yes
+ fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+-
+        CFLAGS="$ac_save_CFLAGS"
+        LIBS="$ac_save_LIBS"
+      fi
+   fi
+   if test "x$no_glib" = x ; then
+-     { echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5
+-echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; }
++     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5
++$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; }
+      :
+   else
+-     { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+      if test "$PKG_CONFIG" = "no" ; then
+        echo "*** A new enough version of pkg-config was not found."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+@@ -13599,11 +12272,7 @@
+           ac_save_LIBS="$LIBS"
+           CFLAGS="$CFLAGS $GLIB_CFLAGS"
+           LIBS="$LIBS $GLIB_LIBS"
+-          cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <glib.h>
+@@ -13617,24 +12286,7 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+    echo "*** The test program compiled, but did not run. This usually means"
+           echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+           echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+@@ -13645,15 +12297,11 @@
+           echo "*** If you have an old version installed, it is best to remove it, although"
+           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-       echo "*** The test program failed to compile or link. See the file config.log for the"
++   echo "*** The test program failed to compile or link. See the file config.log for the"
+           echo "*** exact error that occured. This usually means GLIB is incorrectly installed."
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+           CFLAGS="$ac_save_CFLAGS"
+           LIBS="$ac_save_LIBS"
+        fi
+@@ -13673,18 +12321,14 @@
+   rm -f conf.glibtest
+         if test "$enable_system_auth" = "yes"; then
+-                { echo "$as_me:$LINENO: checking for pam_start in -lpam" >&5
+-echo $ECHO_N "checking for pam_start in -lpam... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_pam_pam_start+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
++$as_echo_n "checking for pam_start in -lpam... " >&6; }
++if test "${ac_cv_lib_pam_pam_start+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lpam  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13702,43 +12346,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_pam_pam_start=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_pam_pam_start=no
++  ac_cv_lib_pam_pam_start=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_start" >&5
+-echo "${ECHO_T}$ac_cv_lib_pam_pam_start" >&6; }
+-if test $ac_cv_lib_pam_pam_start = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5
++$as_echo "$ac_cv_lib_pam_pam_start" >&6; }
++if test "x$ac_cv_lib_pam_pam_start" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_PAM 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_PAM 1" >>confdefs.h
+ else
+   check_pam=no
+@@ -13747,18 +12368,14 @@
+         fi
+         if test "${ldap}" = "yes"; then
+-                 { echo "$as_me:$LINENO: checking for ldap_simple_bind_s in -lldap" >&5
+-echo $ECHO_N "checking for ldap_simple_bind_s in -lldap... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_ldap_ldap_simple_bind_s+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_simple_bind_s in -lldap" >&5
++$as_echo_n "checking for ldap_simple_bind_s in -lldap... " >&6; }
++if test "${ac_cv_lib_ldap_ldap_simple_bind_s+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lldap  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13776,43 +12393,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_ldap_ldap_simple_bind_s=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_ldap_ldap_simple_bind_s=no
++  ac_cv_lib_ldap_ldap_simple_bind_s=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ldap_ldap_simple_bind_s" >&5
+-echo "${ECHO_T}$ac_cv_lib_ldap_ldap_simple_bind_s" >&6; }
+-if test $ac_cv_lib_ldap_ldap_simple_bind_s = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_simple_bind_s" >&5
++$as_echo "$ac_cv_lib_ldap_ldap_simple_bind_s" >&6; }
++if test "x$ac_cv_lib_ldap_ldap_simple_bind_s" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_LDAP 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_LDAP 1" >>confdefs.h
+ else
+   check_ldap=no
+@@ -13823,18 +12417,14 @@
+         if test "$enable_mysql_log" = "yes" \
+               -o "$enable_mysql_auth" = "yes" ; then
+                       if which mysql_config 1>/dev/null; then
+-                              { echo "$as_me:$LINENO: checking for mysql_real_connect in -lmysqlclient" >&5
+-echo $ECHO_N "checking for mysql_real_connect in -lmysqlclient... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_mysqlclient_mysql_real_connect+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_real_connect in -lmysqlclient" >&5
++$as_echo_n "checking for mysql_real_connect in -lmysqlclient... " >&6; }
++if test "${ac_cv_lib_mysqlclient_mysql_real_connect+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lmysqlclient $(mysql_config --libs) $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13852,60 +12442,33 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_mysqlclient_mysql_real_connect=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_mysqlclient_mysql_real_connect=no
++  ac_cv_lib_mysqlclient_mysql_real_connect=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_real_connect" >&5
+-echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_real_connect" >&6; }
+-if test $ac_cv_lib_mysqlclient_mysql_real_connect = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_real_connect" >&5
++$as_echo "$ac_cv_lib_mysqlclient_mysql_real_connect" >&6; }
++if test "x$ac_cv_lib_mysqlclient_mysql_real_connect" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_MYSQLCLIENT 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_MYSQLCLIENT 1" >>confdefs.h
+ else
+   check_mysql=no
+ fi
+-                              { echo "$as_me:$LINENO: checking for mysql_ssl_set in -lmysqlclient" >&5
+-echo $ECHO_N "checking for mysql_ssl_set in -lmysqlclient... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_mysqlclient_mysql_ssl_set+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_ssl_set in -lmysqlclient" >&5
++$as_echo_n "checking for mysql_ssl_set in -lmysqlclient... " >&6; }
++if test "${ac_cv_lib_mysqlclient_mysql_ssl_set+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lmysqlclient $(mysql_config --libs) $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13923,63 +12486,38 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_mysqlclient_mysql_ssl_set=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_mysqlclient_mysql_ssl_set=no
++  ac_cv_lib_mysqlclient_mysql_ssl_set=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_ssl_set" >&5
+-echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_ssl_set" >&6; }
+-if test $ac_cv_lib_mysqlclient_mysql_ssl_set = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_ssl_set" >&5
++$as_echo "$ac_cv_lib_mysqlclient_mysql_ssl_set" >&6; }
++if test "x$ac_cv_lib_mysqlclient_mysql_ssl_set" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_MYSQL_SSL 1
+ _ACEOF
+ else
+-  { echo "$as_me:$LINENO: mysqlclient has no ssl support" >&5
+-echo "$as_me: mysqlclient has no ssl support" >&6;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: mysqlclient has no ssl support" >&5
++$as_echo "$as_me: mysqlclient has no ssl support" >&6;}
+ fi
+                               have_mysql_config="yes"
+                       else
+-                              { echo "$as_me:$LINENO: checking for mysql_real_connect in -lmysqlclient" >&5
+-echo $ECHO_N "checking for mysql_real_connect in -lmysqlclient... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_mysqlclient_mysql_real_connect+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_real_connect in -lmysqlclient" >&5
++$as_echo_n "checking for mysql_real_connect in -lmysqlclient... " >&6; }
++if test "${ac_cv_lib_mysqlclient_mysql_real_connect+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lmysqlclient  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -13997,60 +12535,33 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_mysqlclient_mysql_real_connect=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_mysqlclient_mysql_real_connect=no
++  ac_cv_lib_mysqlclient_mysql_real_connect=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_real_connect" >&5
+-echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_real_connect" >&6; }
+-if test $ac_cv_lib_mysqlclient_mysql_real_connect = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_real_connect" >&5
++$as_echo "$ac_cv_lib_mysqlclient_mysql_real_connect" >&6; }
++if test "x$ac_cv_lib_mysqlclient_mysql_real_connect" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_MYSQLCLIENT 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_MYSQLCLIENT 1" >>confdefs.h
+ else
+   check_mysql=no
+ fi
+-                              { echo "$as_me:$LINENO: checking for mysql_ssl_set in -lmysqlclient" >&5
+-echo $ECHO_N "checking for mysql_ssl_set in -lmysqlclient... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_mysqlclient_mysql_ssl_set+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_ssl_set in -lmysqlclient" >&5
++$as_echo_n "checking for mysql_ssl_set in -lmysqlclient... " >&6; }
++if test "${ac_cv_lib_mysqlclient_mysql_ssl_set+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lmysqlclient  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14068,47 +12579,26 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_mysqlclient_mysql_ssl_set=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_mysqlclient_mysql_ssl_set=no
++  ac_cv_lib_mysqlclient_mysql_ssl_set=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_ssl_set" >&5
+-echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_ssl_set" >&6; }
+-if test $ac_cv_lib_mysqlclient_mysql_ssl_set = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_ssl_set" >&5
++$as_echo "$ac_cv_lib_mysqlclient_mysql_ssl_set" >&6; }
++if test "x$ac_cv_lib_mysqlclient_mysql_ssl_set" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_MYSQL_SSL 1
+ _ACEOF
+ else
+-  { echo "$as_me:$LINENO: mysqlclient has no ssl support" >&5
+-echo "$as_me: mysqlclient has no ssl support" >&6;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: mysqlclient has no ssl support" >&5
++$as_echo "$as_me: mysqlclient has no ssl support" >&6;}
+ fi
+                   fi
+@@ -14122,138 +12612,9 @@
+                 OLDCPPFLAGS="$CPPFLAGS"
+                 CFLAGS="$CFLAGS -I/usr/include/libprelude/"
+                 CPPFLAGS="$CFLAGS -I/usr/include/libprelude/"
+-                if test "${ac_cv_header_prelude_h+set}" = set; then
+-  { echo "$as_me:$LINENO: checking for prelude.h" >&5
+-echo $ECHO_N "checking for prelude.h... $ECHO_C" >&6; }
+-if test "${ac_cv_header_prelude_h+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_header_prelude_h" >&5
+-echo "${ECHO_T}$ac_cv_header_prelude_h" >&6; }
+-else
+-  # Is the header compilable?
+-{ echo "$as_me:$LINENO: checking prelude.h usability" >&5
+-echo $ECHO_N "checking prelude.h usability... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-#include <prelude.h>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_header_compiler=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++                ac_fn_c_check_header_mongrel "$LINENO" "prelude.h" "ac_cv_header_prelude_h" "$ac_includes_default"
++if test "x$ac_cv_header_prelude_h" = x""yes; then :
+-      ac_header_compiler=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+-echo "${ECHO_T}$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ echo "$as_me:$LINENO: checking prelude.h presence" >&5
+-echo $ECHO_N "checking prelude.h presence... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <prelude.h>
+-_ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  ac_header_preproc=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-  ac_header_preproc=no
+-fi
+-
+-rm -f conftest.err conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+-echo "${ECHO_T}$ac_header_preproc" >&6; }
+-
+-# So?  What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+-  yes:no: )
+-    { echo "$as_me:$LINENO: WARNING: prelude.h: accepted by the compiler, rejected by the preprocessor!" >&5
+-echo "$as_me: WARNING: prelude.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: prelude.h: proceeding with the compiler's result" >&5
+-echo "$as_me: WARNING: prelude.h: proceeding with the compiler's result" >&2;}
+-    ac_header_preproc=yes
+-    ;;
+-  no:yes:* )
+-    { echo "$as_me:$LINENO: WARNING: prelude.h: present but cannot be compiled" >&5
+-echo "$as_me: WARNING: prelude.h: present but cannot be compiled" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: prelude.h:     check for missing prerequisite headers?" >&5
+-echo "$as_me: WARNING: prelude.h:     check for missing prerequisite headers?" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: prelude.h: see the Autoconf documentation" >&5
+-echo "$as_me: WARNING: prelude.h: see the Autoconf documentation" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: prelude.h:     section \"Present But Cannot Be Compiled\"" >&5
+-echo "$as_me: WARNING: prelude.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: prelude.h: proceeding with the preprocessor's result" >&5
+-echo "$as_me: WARNING: prelude.h: proceeding with the preprocessor's result" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: prelude.h: in the future, the compiler will take precedence" >&5
+-echo "$as_me: WARNING: prelude.h: in the future, the compiler will take precedence" >&2;}
+-    ( cat <<\_ASBOX
+-## ------------------------------------ ##
+-## Report this to nufw-devel@nongnu.org ##
+-## ------------------------------------ ##
+-_ASBOX
+-     ) | sed "s/^/$as_me: WARNING:     /" >&2
+-    ;;
+-esac
+-{ echo "$as_me:$LINENO: checking for prelude.h" >&5
+-echo $ECHO_N "checking for prelude.h... $ECHO_C" >&6; }
+-if test "${ac_cv_header_prelude_h+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  ac_cv_header_prelude_h=$ac_header_preproc
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_header_prelude_h" >&5
+-echo "${ECHO_T}$ac_cv_header_prelude_h" >&6; }
+-
+-fi
+-if test $ac_cv_header_prelude_h = yes; then
+-  :
+ else
+   check_prelude=no
+ fi
+@@ -14261,18 +12622,14 @@
+                 # Check for prelude_init() function libprelude.so
+-                { echo "$as_me:$LINENO: checking for prelude_init in -lprelude" >&5
+-echo $ECHO_N "checking for prelude_init in -lprelude... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_prelude_prelude_init+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prelude_init in -lprelude" >&5
++$as_echo_n "checking for prelude_init in -lprelude... " >&6; }
++if test "${ac_cv_lib_prelude_prelude_init+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lprelude  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14290,43 +12647,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_prelude_prelude_init=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_prelude_prelude_init=no
++  ac_cv_lib_prelude_prelude_init=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_prelude_prelude_init" >&5
+-echo "${ECHO_T}$ac_cv_lib_prelude_prelude_init" >&6; }
+-if test $ac_cv_lib_prelude_prelude_init = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prelude_prelude_init" >&5
++$as_echo "$ac_cv_lib_prelude_prelude_init" >&6; }
++if test "x$ac_cv_lib_prelude_prelude_init" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_PRELUDE 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_PRELUDE 1" >>confdefs.h
+ else
+   check_prelude=no
+@@ -14337,18 +12671,14 @@
+         fi
+         if test "$enable_pgsql_log" = "yes"; then
+-                { echo "$as_me:$LINENO: checking for PQconnectdb in -lpq" >&5
+-echo $ECHO_N "checking for PQconnectdb in -lpq... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_pq_PQconnectdb+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQconnectdb in -lpq" >&5
++$as_echo_n "checking for PQconnectdb in -lpq... " >&6; }
++if test "${ac_cv_lib_pq_PQconnectdb+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lpq  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14365,44 +12695,21 @@
+   ;
+   return 0;
+ }
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_pq_PQconnectdb=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_pq_PQconnectdb=no
++  ac_cv_lib_pq_PQconnectdb=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQconnectdb" >&5
+-echo "${ECHO_T}$ac_cv_lib_pq_PQconnectdb" >&6; }
+-if test $ac_cv_lib_pq_PQconnectdb = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQconnectdb" >&5
++$as_echo "$ac_cv_lib_pq_PQconnectdb" >&6; }
++if test "x$ac_cv_lib_pq_PQconnectdb" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_PQ 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_PQ 1" >>confdefs.h
+ else
+   check_pgsql=no
+@@ -14510,18 +12817,14 @@
+ if test "${build_libnuclient}" = "yes"; then
+-      { echo "$as_me:$LINENO: checking for sasl_server_init in -lsasl2" >&5
+-echo $ECHO_N "checking for sasl_server_init in -lsasl2... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_sasl2_sasl_server_init+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sasl_server_init in -lsasl2" >&5
++$as_echo_n "checking for sasl_server_init in -lsasl2... " >&6; }
++if test "${ac_cv_lib_sasl2_sasl_server_init+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lsasl2  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14539,43 +12842,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_sasl2_sasl_server_init=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_sasl2_sasl_server_init=no
++  ac_cv_lib_sasl2_sasl_server_init=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sasl2_sasl_server_init" >&5
+-echo "${ECHO_T}$ac_cv_lib_sasl2_sasl_server_init" >&6; }
+-if test $ac_cv_lib_sasl2_sasl_server_init = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sasl2_sasl_server_init" >&5
++$as_echo "$ac_cv_lib_sasl2_sasl_server_init" >&6; }
++if test "x$ac_cv_lib_sasl2_sasl_server_init" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_SASL2 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_SASL2 1" >>confdefs.h
+ else
+   check_sasl=no
+@@ -14586,18 +12866,14 @@
+ if test "${build_nufw}" = "yes"; then
+     if test "${use_nfqueue}" = "yes"; then
+         # if we don't have we can't build nufw
+-        { echo "$as_me:$LINENO: checking for nfnl_open in -lnfnetlink" >&5
+-echo $ECHO_N "checking for nfnl_open in -lnfnetlink... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_nfnetlink_nfnl_open+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfnl_open in -lnfnetlink" >&5
++$as_echo_n "checking for nfnl_open in -lnfnetlink... " >&6; }
++if test "${ac_cv_lib_nfnetlink_nfnl_open+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnfnetlink  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14615,56 +12891,31 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_nfnetlink_nfnl_open=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_nfnetlink_nfnl_open=no
++  ac_cv_lib_nfnetlink_nfnl_open=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nfnetlink_nfnl_open" >&5
+-echo "${ECHO_T}$ac_cv_lib_nfnetlink_nfnl_open" >&6; }
+-if test $ac_cv_lib_nfnetlink_nfnl_open = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nfnetlink_nfnl_open" >&5
++$as_echo "$ac_cv_lib_nfnetlink_nfnl_open" >&6; }
++if test "x$ac_cv_lib_nfnetlink_nfnl_open" = x""yes; then :
+   have_nfqueue="yes"
+ else
+   build_nufw=""
+ fi
+-        { echo "$as_me:$LINENO: checking for nfq_open in -lnetfilter_queue" >&5
+-echo $ECHO_N "checking for nfq_open in -lnetfilter_queue... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_netfilter_queue_nfq_open+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfq_open in -lnetfilter_queue" >&5
++$as_echo_n "checking for nfq_open in -lnetfilter_queue... " >&6; }
++if test "${ac_cv_lib_netfilter_queue_nfq_open+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnetfilter_queue -lnfnetlink $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14682,58 +12933,31 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_netfilter_queue_nfq_open=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_netfilter_queue_nfq_open=no
++  ac_cv_lib_netfilter_queue_nfq_open=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_netfilter_queue_nfq_open" >&5
+-echo "${ECHO_T}$ac_cv_lib_netfilter_queue_nfq_open" >&6; }
+-if test $ac_cv_lib_netfilter_queue_nfq_open = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netfilter_queue_nfq_open" >&5
++$as_echo "$ac_cv_lib_netfilter_queue_nfq_open" >&6; }
++if test "x$ac_cv_lib_netfilter_queue_nfq_open" = x""yes; then :
+   have_nfqueue="yes"
+ else
+-  { { echo "$as_me:$LINENO: error: libnetfilter_queue not present" >&5
+-echo "$as_me: error: libnetfilter_queue not present" >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "libnetfilter_queue not present" "$LINENO" 5
+ fi
+-        { echo "$as_me:$LINENO: checking for nfq_set_queue_maxlen in -lnetfilter_queue" >&5
+-echo $ECHO_N "checking for nfq_set_queue_maxlen in -lnetfilter_queue... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfq_set_queue_maxlen in -lnetfilter_queue" >&5
++$as_echo_n "checking for nfq_set_queue_maxlen in -lnetfilter_queue... " >&6; }
++if test "${ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnetfilter_queue -lnfnetlink $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14751,39 +12975,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen=no
++  ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen" >&5
+-echo "${ECHO_T}$ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen" >&6; }
+-if test $ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen" >&5
++$as_echo "$ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen" >&6; }
++if test "x$ac_cv_lib_netfilter_queue_nfq_set_queue_maxlen" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_NFQ_SET_QUEUE_MAXLEN 1
+@@ -14791,18 +12994,14 @@
+ fi
+-      { echo "$as_me:$LINENO: checking for nlif_catch in -lnfnetlink" >&5
+-echo $ECHO_N "checking for nlif_catch in -lnfnetlink... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_nfnetlink_nlif_catch+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nlif_catch in -lnfnetlink" >&5
++$as_echo_n "checking for nlif_catch in -lnfnetlink... " >&6; }
++if test "${ac_cv_lib_nfnetlink_nlif_catch+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnfnetlink  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14820,51 +13019,26 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_nfnetlink_nlif_catch=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_nfnetlink_nlif_catch=no
++  ac_cv_lib_nfnetlink_nlif_catch=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nfnetlink_nlif_catch" >&5
+-echo "${ECHO_T}$ac_cv_lib_nfnetlink_nlif_catch" >&6; }
+-if test $ac_cv_lib_nfnetlink_nlif_catch = yes; then
+-  { echo "$as_me:$LINENO: checking for nfq_get_indev_name in -lnetfilter_queue" >&5
+-echo $ECHO_N "checking for nfq_get_indev_name in -lnetfilter_queue... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_netfilter_queue_nfq_get_indev_name+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nfnetlink_nlif_catch" >&5
++$as_echo "$ac_cv_lib_nfnetlink_nlif_catch" >&6; }
++if test "x$ac_cv_lib_nfnetlink_nlif_catch" = x""yes; then :
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfq_get_indev_name in -lnetfilter_queue" >&5
++$as_echo_n "checking for nfq_get_indev_name in -lnetfilter_queue... " >&6; }
++if test "${ac_cv_lib_netfilter_queue_nfq_get_indev_name+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnetfilter_queue -lnfnetlink $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -14882,47 +13056,26 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_netfilter_queue_nfq_get_indev_name=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_netfilter_queue_nfq_get_indev_name=no
++  ac_cv_lib_netfilter_queue_nfq_get_indev_name=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_netfilter_queue_nfq_get_indev_name" >&5
+-echo "${ECHO_T}$ac_cv_lib_netfilter_queue_nfq_get_indev_name" >&6; }
+-if test $ac_cv_lib_netfilter_queue_nfq_get_indev_name = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netfilter_queue_nfq_get_indev_name" >&5
++$as_echo "$ac_cv_lib_netfilter_queue_nfq_get_indev_name" >&6; }
++if test "x$ac_cv_lib_netfilter_queue_nfq_get_indev_name" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_NFQ_INDEV_NAME 1
+ _ACEOF
+ else
+-  { echo "$as_me:$LINENO: WARNING: \"Support of interface resolution in nfnetlink but not in netfilter_queue\"" >&5
+-echo "$as_me: WARNING: \"Support of interface resolution in nfnetlink but not in netfilter_queue\"" >&2;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Support of interface resolution in nfnetlink but not in netfilter_queue\"" >&5
++$as_echo "$as_me: WARNING: \"Support of interface resolution in nfnetlink but not in netfilter_queue\"" >&2;}
+ fi
+@@ -14934,146 +13087,14 @@
+ _ACEOF
+     else
+-
+-
+-for ac_header in libipq/libipq.h libipq.h
+-do
+-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-else
+-  # Is the header compilable?
+-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-$ac_includes_default
+-#include <$ac_header>
+-_ACEOF
+-rm -f conftest.$ac_objext
+-if { (ac_try="$ac_compile"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_compile") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest.$ac_objext; then
+-  ac_header_compiler=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_header_compiler=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+-echo "${ECHO_T}$ac_header_compiler" >&6; }
+-
+-# Is the header present?
+-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-#include <$ac_header>
+-_ACEOF
+-if { (ac_try="$ac_cpp conftest.$ac_ext"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } >/dev/null && {
+-       test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       }; then
+-  ac_header_preproc=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-  ac_header_preproc=no
+-fi
+-
+-rm -f conftest.err conftest.$ac_ext
+-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+-echo "${ECHO_T}$ac_header_preproc" >&6; }
+-
+-# So?  What about this header?
+-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+-  yes:no: )
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+-    ac_header_preproc=yes
+-    ;;
+-  no:yes:* )
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+-    ( cat <<\_ASBOX
+-## ------------------------------------ ##
+-## Report this to nufw-devel@nongnu.org ##
+-## ------------------------------------ ##
+-_ASBOX
+-     ) | sed "s/^/$as_me: WARNING:     /" >&2
+-    ;;
+-esac
+-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  eval "$as_ac_Header=\$ac_header_preproc"
+-fi
+-ac_res=`eval echo '${'$as_ac_Header'}'`
+-             { echo "$as_me:$LINENO: result: $ac_res" >&5
+-echo "${ECHO_T}$ac_res" >&6; }
+-
+-fi
+-if test `eval echo '${'$as_ac_Header'}'` = yes; then
++        for ac_header in libipq/libipq.h libipq.h
++do :
++  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
++ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
++eval as_val=\$$as_ac_Header
++   if test "x$as_val" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+ _ACEOF
+ fi
+@@ -15081,18 +13102,14 @@
+ done
+         # if we don't have we can't build nufw
+-        { echo "$as_me:$LINENO: checking for ipq_message_type in -lipq" >&5
+-echo $ECHO_N "checking for ipq_message_type in -lipq... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_ipq_ipq_message_type+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ipq_message_type in -lipq" >&5
++$as_echo_n "checking for ipq_message_type in -lipq... " >&6; }
++if test "${ac_cv_lib_ipq_ipq_message_type+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lipq  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -15110,39 +13127,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_ipq_ipq_message_type=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_ipq_ipq_message_type=no
++  ac_cv_lib_ipq_ipq_message_type=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ipq_ipq_message_type" >&5
+-echo "${ECHO_T}$ac_cv_lib_ipq_ipq_message_type" >&6; }
+-if test $ac_cv_lib_ipq_ipq_message_type = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipq_ipq_message_type" >&5
++$as_echo "$ac_cv_lib_ipq_ipq_message_type" >&6; }
++if test "x$ac_cv_lib_ipq_ipq_message_type" = x""yes; then :
+   have_ipq="yes"
+ else
+   build_nufw=""
+@@ -15153,7 +13149,7 @@
+         # check if we have a version of libipq supporting mark
+ # Check whether --with-user-mark was given.
+-if test "${with_user_mark+set}" = set; then
++if test "${with_user_mark+set}" = set; then :
+   withval=$with_user_mark; enable_user_mark="yes"
+ else
+   enable_user_mark=""
+@@ -15161,18 +13157,14 @@
+                 if test "$enable_user_mark" = "yes"; then
+-                        { echo "$as_me:$LINENO: checking for ipq_set_vwmark in -lipq" >&5
+-echo $ECHO_N "checking for ipq_set_vwmark in -lipq... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_ipq_ipq_set_vwmark+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ipq_set_vwmark in -lipq" >&5
++$as_echo_n "checking for ipq_set_vwmark in -lipq... " >&6; }
++if test "${ac_cv_lib_ipq_ipq_set_vwmark+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lipq  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -15190,47 +13182,26 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_ipq_ipq_set_vwmark=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_ipq_ipq_set_vwmark=no
++  ac_cv_lib_ipq_ipq_set_vwmark=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ipq_ipq_set_vwmark" >&5
+-echo "${ECHO_T}$ac_cv_lib_ipq_ipq_set_vwmark" >&6; }
+-if test $ac_cv_lib_ipq_ipq_set_vwmark = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipq_ipq_set_vwmark" >&5
++$as_echo "$ac_cv_lib_ipq_ipq_set_vwmark" >&6; }
++if test "x$ac_cv_lib_ipq_ipq_set_vwmark" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_LIBIPQ_MARK 1
+ _ACEOF
+ else
+-  { echo "$as_me:$LINENO: result: libipq has no support for mark" >&5
+-echo "${ECHO_T}libipq has no support for mark" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: libipq has no support for mark" >&5
++$as_echo "libipq has no support for mark" >&6; }
+ fi
+                 fi
+@@ -15239,18 +13210,14 @@
+ fi
+ if test "${use_nfconntrack}" = "yes"; then
+-      { echo "$as_me:$LINENO: checking for nfct_dump_conntrack_table in -lnetfilter_conntrack" >&5
+-echo $ECHO_N "checking for nfct_dump_conntrack_table in -lnetfilter_conntrack... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfct_dump_conntrack_table in -lnetfilter_conntrack" >&5
++$as_echo_n "checking for nfct_dump_conntrack_table in -lnetfilter_conntrack... " >&6; }
++if test "${ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnetfilter_conntrack -ldl -lnfnetlink $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -15268,39 +13235,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table=no
++  ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table" >&5
+-echo "${ECHO_T}$ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table" >&6; }
+-if test $ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table" >&5
++$as_echo "$ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table" >&6; }
++if test "x$ac_cv_lib_netfilter_conntrack_nfct_dump_conntrack_table" = x""yes; then :
+   have_conntrack="yes"
+ else
+   have_conntrack=""
+@@ -15316,18 +13262,14 @@
+ #define HAVE_LIBCONNTRACK 1
+ _ACEOF
+-      { echo "$as_me:$LINENO: checking for nfct_callback_register in -lnetfilter_conntrack" >&5
+-echo $ECHO_N "checking for nfct_callback_register in -lnetfilter_conntrack... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_netfilter_conntrack_nfct_callback_register+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nfct_callback_register in -lnetfilter_conntrack" >&5
++$as_echo_n "checking for nfct_callback_register in -lnetfilter_conntrack... " >&6; }
++if test "${ac_cv_lib_netfilter_conntrack_nfct_callback_register+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lnetfilter_conntrack -ldl -lnfnetlink $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -15345,39 +13287,18 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_netfilter_conntrack_nfct_callback_register=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_netfilter_conntrack_nfct_callback_register=no
++  ac_cv_lib_netfilter_conntrack_nfct_callback_register=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_netfilter_conntrack_nfct_callback_register" >&5
+-echo "${ECHO_T}$ac_cv_lib_netfilter_conntrack_nfct_callback_register" >&6; }
+-if test $ac_cv_lib_netfilter_conntrack_nfct_callback_register = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_netfilter_conntrack_nfct_callback_register" >&5
++$as_echo "$ac_cv_lib_netfilter_conntrack_nfct_callback_register" >&6; }
++if test "x$ac_cv_lib_netfilter_conntrack_nfct_callback_register" = x""yes; then :
+   have_new_conntrack_api="yes"
+ else
+   have_new_conntrack_api=""
+@@ -15401,18 +13322,14 @@
+ if test "${build_pam_nufw}" = "yes"; then
+     #AC_CHECK_LIB([pam], [pam_sm_authenticate],AC_DEFINE([HAVE_LIBRARY_PAM],[1],[Pam lib flag]), check_pam=no)
+-    { echo "$as_me:$LINENO: checking for pam_start in -lpam" >&5
+-echo $ECHO_N "checking for pam_start in -lpam... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_pam_pam_start+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
++$as_echo_n "checking for pam_start in -lpam... " >&6; }
++if test "${ac_cv_lib_pam_pam_start+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lpam  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ /* Override any GCC internal prototype to avoid an error.
+@@ -15430,43 +13347,20 @@
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && {
+-       test -z "$ac_c_werror_flag" ||
+-       test ! -s conftest.err
+-       } && test -s conftest$ac_exeext &&
+-       $as_test_x conftest$ac_exeext; then
++if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_pam_pam_start=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_pam_pam_start=no
++  ac_cv_lib_pam_pam_start=no
+ fi
+-
+-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pam_pam_start" >&5
+-echo "${ECHO_T}$ac_cv_lib_pam_pam_start" >&6; }
+-if test $ac_cv_lib_pam_pam_start = yes; then
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5
++$as_echo "$ac_cv_lib_pam_pam_start" >&6; }
++if test "x$ac_cv_lib_pam_pam_start" = x""yes; then :
+-cat >>confdefs.h <<\_ACEOF
+-#define HAVE_LIBRARY_PAM 1
+-_ACEOF
++$as_echo "#define HAVE_LIBRARY_PAM 1" >>confdefs.h
+ else
+   check_pam=no
+@@ -15566,14 +13460,14 @@
+ if test "x$GCC" = "xyes"; then
+-              { echo "$as_me:$LINENO: checking gcc version" >&5
+-echo $ECHO_N "checking gcc version... $ECHO_C" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version" >&5
++$as_echo_n "checking gcc version... " >&6; }
+               gccver=$($CC -dumpversion)
+               gccvermajor=$(echo $gccver | cut -d . -f1)
+               gccverminor=$(echo $gccver | cut -d . -f2)
+               gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
+-      { echo "$as_me:$LINENO: result: $gccver" >&5
+-echo "${ECHO_T}$gccver" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gccver" >&5
++$as_echo "$gccver" >&6; }
+     CFLAGS="$CFLAGS -Wall"
+@@ -15611,44 +13505,42 @@
+     -o x${check_gnutls} = xno \
+     -o x${check_pam} = xno \
+ ; then
+-    { echo "$as_me:$LINENO: result: " >&5
+-echo "${ECHO_T}" >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
++$as_echo "" >&6; }
+     if test x${check_pthread} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: pthread library needed" >&5
+-echo "${ECHO_T}ERROR: pthread library needed" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: pthread library needed" >&5
++$as_echo "ERROR: pthread library needed" >&6; }
+     fi
+     if test x${check_gcrypt} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: gcrypt library needed for encryption" >&5
+-echo "${ECHO_T}ERROR: gcrypt library needed for encryption" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: gcrypt library needed for encryption" >&5
++$as_echo "ERROR: gcrypt library needed for encryption" >&6; }
+     fi
+     if test x${check_pam} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: PAM library needed for system authentication" >&5
+-echo "${ECHO_T}ERROR: PAM library needed for system authentication" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: PAM library needed for system authentication" >&5
++$as_echo "ERROR: PAM library needed for system authentication" >&6; }
+     fi
+     if test x${check_gnutls} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: gnutls library needed for encryption" >&5
+-echo "${ECHO_T}ERROR: gnutls library needed for encryption" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: gnutls library needed for encryption" >&5
++$as_echo "ERROR: gnutls library needed for encryption" >&6; }
+     fi
+     if test x${check_ldap} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: ldap library needed for authentication" >&5
+-echo "${ECHO_T}ERROR: ldap library needed for authentication" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: ldap library needed for authentication" >&5
++$as_echo "ERROR: ldap library needed for authentication" >&6; }
+     fi
+     if test x${check_glib} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: glib is required in order to compile nuauth" >&5
+-echo "${ECHO_T}ERROR: glib is required in order to compile nuauth" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: glib is required in order to compile nuauth" >&5
++$as_echo "ERROR: glib is required in order to compile nuauth" >&6; }
+     fi
+     if test x${check_mysql} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: mysqlclient library needed if selected" >&5
+-echo "${ECHO_T}ERROR: mysqlclient library needed if selected" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: mysqlclient library needed if selected" >&5
++$as_echo "ERROR: mysqlclient library needed if selected" >&6; }
+     fi
+     if test x${check_prelude} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: libprelude library needed if Prelude logging selected" >&5
+-echo "${ECHO_T}ERROR: libprelude library needed if Prelude logging selected" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: libprelude library needed if Prelude logging selected" >&5
++$as_echo "ERROR: libprelude library needed if Prelude logging selected" >&6; }
+     fi
+     if test x${check_pgsql} = xno; then
+-        { { echo "$as_me:$LINENO: error: libpq library needed if PostgreSQL support selected" >&5
+-echo "$as_me: error: libpq library needed if PostgreSQL support selected" >&2;}
+-   { (exit 1); exit 1; }; }
++        as_fn_error "libpq library needed if PostgreSQL support selected" "$LINENO" 5
+     fi
+     exit 1
+ fi
+@@ -15660,16 +13552,16 @@
+       -o "${build_pam_nufw}" = "yes" \
+ ; then
+     if test x${check_sasl} = xno; then
+-        { echo "$as_me:$LINENO: result: ERROR: sasl library needed for authentication" >&5
+-echo "${ECHO_T}ERROR: sasl library needed for authentication" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ERROR: sasl library needed for authentication" >&5
++$as_echo "ERROR: sasl library needed for authentication" >&6; }
+       exit 1
+     fi
+ fi
+ am__api_version='1.10'
+-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
++$as_echo_n "checking whether build environment is sane... " >&6; }
+ # Just in case
+ sleep 1
+ echo timestamp > conftest.file
+@@ -15692,11 +13584,8 @@
+       # if, for instance, CONFIG_SHELL is bash and it inherits a
+       # broken ls alias from the environment.  This has actually
+       # happened.  Such a system could not be considered "sane".
+-      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+-alias in your environment" >&5
+-echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+-alias in your environment" >&2;}
+-   { (exit 1); exit 1; }; }
++      as_fn_error "ls -t appears to fail.  Make sure there is not a broken
++alias in your environment" "$LINENO" 5
+    fi
+    test "$2" = conftest.file
+@@ -15705,26 +13594,20 @@
+    # Ok.
+    :
+ else
+-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+-Check your system clock" >&5
+-echo "$as_me: error: newly created file is older than distributed files!
+-Check your system clock" >&2;}
+-   { (exit 1); exit 1; }; }
++   as_fn_error "newly created file is older than distributed files!
++Check your system clock" "$LINENO" 5
+ fi
+-{ echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+ test "$program_prefix" != NONE &&
+   program_transform_name="s&^&$program_prefix&;$program_transform_name"
+ # Use a double $ so make ignores it.
+ test "$program_suffix" != NONE &&
+   program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+-# Double any \ or $.  echo might interpret backslashes.
++# Double any \ or $.
+ # By default was `s,x,x', remove it if useless.
+-cat <<\_ACEOF >conftest.sed
+-s/[\\$]/&&/g;s/;s,x,x,$//
+-_ACEOF
+-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+-rm -f conftest.sed
++ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
++program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+ # expand $ac_aux_dir to an absolute path
+ am_aux_dir=`cd $ac_aux_dir && pwd`
+@@ -15735,22 +13618,22 @@
+   am_missing_run="$MISSING --run "
+ else
+   am_missing_run=
+-  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+-echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
++$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+ fi
+-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
++$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+ if test -z "$MKDIR_P"; then
+-  if test "${ac_cv_path_mkdir+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++  if test "${ac_cv_path_mkdir+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_prog in mkdir gmkdir; do
++    for ac_prog in mkdir gmkdir; do
+        for ac_exec_ext in '' $ac_executable_extensions; do
+          { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+@@ -15762,7 +13645,7 @@
+          esac
+        done
+        done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+@@ -15778,8 +13661,8 @@
+     MKDIR_P="$ac_install_sh -d"
+   fi
+ fi
+-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+-echo "${ECHO_T}$MKDIR_P" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
++$as_echo "$MKDIR_P" >&6; }
+ mkdir_p="$MKDIR_P"
+ case $mkdir_p in
+@@ -15791,10 +13674,10 @@
+ do
+   # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_AWK+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_AWK+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$AWK"; then
+   ac_cv_prog_AWK="$AWK" # Let the user override the test.
+@@ -15804,36 +13687,37 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_AWK="$ac_prog"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ AWK=$ac_cv_prog_AWK
+ if test -n "$AWK"; then
+-  { echo "$as_me:$LINENO: result: $AWK" >&5
+-echo "${ECHO_T}$AWK" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
++$as_echo "$AWK" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   test -n "$AWK" && break
+ done
+-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
++$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
++set x ${MAKE-make}
++ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
++if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
++  $as_echo_n "(cached) " >&6
+ else
+   cat >conftest.make <<\_ACEOF
+ SHELL = /bin/sh
+@@ -15850,12 +13734,12 @@
+ rm -f conftest.make
+ fi
+ if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+-  { echo "$as_me:$LINENO: result: yes" >&5
+-echo "${ECHO_T}yes" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
+   SET_MAKE=
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+   SET_MAKE="MAKE=${MAKE-make}"
+ fi
+@@ -15880,8 +13764,8 @@
+ .PHONY: am__doit
+ END
+ # If we don't find an include directive, just comment out the code.
+-{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+-echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
++$as_echo_n "checking for style of include used by $am_make... " >&6; }
+ am__include="#"
+ am__quote=
+ _am_result=none
+@@ -15908,12 +13792,12 @@
+ fi
+-{ echo "$as_me:$LINENO: result: $_am_result" >&5
+-echo "${ECHO_T}$_am_result" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
++$as_echo "$_am_result" >&6; }
+ rm -f confinc confmf
+ # Check whether --enable-dependency-tracking was given.
+-if test "${enable_dependency_tracking+set}" = set; then
++if test "${enable_dependency_tracking+set}" = set; then :
+   enableval=$enable_dependency_tracking;
+ fi
+@@ -15936,9 +13820,7 @@
+   am__isrc=' -I$(srcdir)'
+   # test to see if srcdir already configured
+   if test -f $srcdir/config.status; then
+-    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+-echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+-   { (exit 1); exit 1; }; }
++    as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+   fi
+ fi
+@@ -15992,10 +13874,10 @@
+   if test -n "$ac_tool_prefix"; then
+   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+ set dummy ${ac_tool_prefix}strip; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_STRIP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_STRIP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$STRIP"; then
+   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+@@ -16005,25 +13887,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ STRIP=$ac_cv_prog_STRIP
+ if test -n "$STRIP"; then
+-  { echo "$as_me:$LINENO: result: $STRIP" >&5
+-echo "${ECHO_T}$STRIP" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
++$as_echo "$STRIP" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+@@ -16032,10 +13914,10 @@
+   ac_ct_STRIP=$STRIP
+   # Extract the first word of "strip", so it can be a program name with args.
+ set dummy strip; ac_word=$2
+-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -n "$ac_ct_STRIP"; then
+   ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+@@ -16045,25 +13927,25 @@
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  for ac_exec_ext in '' $ac_executable_extensions; do
++    for ac_exec_ext in '' $ac_executable_extensions; do
+   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+     ac_cv_prog_ac_ct_STRIP="strip"
+-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+ done
+-done
++  done
+ IFS=$as_save_IFS
+ fi
+ fi
+ ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+ if test -n "$ac_ct_STRIP"; then
+-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
++$as_echo "$ac_ct_STRIP" >&6; }
+ else
+-  { echo "$as_me:$LINENO: result: no" >&5
+-echo "${ECHO_T}no" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
+ fi
+   if test "x$ac_ct_STRIP" = x; then
+@@ -16071,12 +13953,8 @@
+   else
+     case $cross_compiling:$ac_tool_warned in
+ yes:)
+-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&5
+-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+-whose name does not start with the host triplet.  If you think this
+-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ ac_tool_warned=yes ;;
+ esac
+     STRIP=$ac_ct_STRIP
+@@ -16101,10 +13979,10 @@
+ depcc="$CC"   am_compiler_list=
+-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
++$as_echo_n "checking dependency style of $depcc... " >&6; }
++if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
++  $as_echo_n "(cached) " >&6
+ else
+   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+   # We make a subdir and do the tests there.  Otherwise we can end up
+@@ -16192,8 +14070,8 @@
+ fi
+ fi
+-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
++$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+ CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+  if
+@@ -16236,12 +14114,13 @@
+     case $ac_val in #(
+     *${as_nl}*)
+       case $ac_var in #(
+-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
++      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
++$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+       esac
+       case $ac_var in #(
+       _ | IFS | as_nl) ;; #(
+-      *) $as_unset $ac_var ;;
++      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
++      *) { eval $ac_var=; unset $ac_var;} ;;
+       esac ;;
+     esac
+   done
+@@ -16249,8 +14128,8 @@
+   (set) 2>&1 |
+     case $as_nl`(ac_space=' '; set) 2>&1` in #(
+     *${as_nl}ac_space=\ *)
+-      # `set' does not quote correctly, so add quotes (double-quote
+-      # substitution turns \\\\ into \\, and sed turns \\ into \).
++      # `set' does not quote correctly, so add quotes: double-quote
++      # substitution turns \\\\ into \\, and sed turns \\ into \.
+       sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+@@ -16273,12 +14152,12 @@
+ if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+   if test -w "$cache_file"; then
+     test "x$cache_file" != "x/dev/null" &&
+-      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+-echo "$as_me: updating cache $cache_file" >&6;}
++      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
++$as_echo "$as_me: updating cache $cache_file" >&6;}
+     cat confcache >$cache_file
+   else
+-    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
++    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
++$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+   fi
+ fi
+ rm -f confcache
+@@ -16294,199 +14173,127 @@
+ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+   # 1. Remove the extension, and $U if already installed.
+   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+-  ac_i=`echo "$ac_i" | sed "$ac_script"`
++  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+   #    will be set to the directory where LIBOBJS objects are built.
+-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
++  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
++  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+ done
+ LIBOBJS=$ac_libobjs
+ LTLIBOBJS=$ac_ltlibobjs
++
+ if test -z "${USE_SYSTEM_AUTH_TRUE}" && test -z "${USE_SYSTEM_AUTH_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_SYSTEM_AUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_SYSTEM_AUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_SYSTEM_AUTH\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_LDAP_TRUE}" && test -z "${USE_LDAP_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_LDAP\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_LDAP\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_LDAP\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_PRELUDE_LOG_TRUE}" && test -z "${USE_PRELUDE_LOG_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_PRELUDE_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_PRELUDE_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_PRELUDE_LOG\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_MYSQL_LOG_TRUE}" && test -z "${USE_MYSQL_LOG_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_MYSQL_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_MYSQL_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_MYSQL_LOG\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_MYSQL_AUTH_TRUE}" && test -z "${USE_MYSQL_AUTH_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_MYSQL_AUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_MYSQL_AUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_MYSQL_AUTH\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${HAVE_MYSQL_CONFIG_TRUE}" && test -z "${HAVE_MYSQL_CONFIG_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"HAVE_MYSQL_CONFIG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"HAVE_MYSQL_CONFIG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"HAVE_MYSQL_CONFIG\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_PGSQL_LOG_TRUE}" && test -z "${USE_PGSQL_LOG_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_PGSQL_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_PGSQL_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_PGSQL_LOG\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_PLAINTEXT_AUTH_TRUE}" && test -z "${USE_PLAINTEXT_AUTH_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_PLAINTEXT_AUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_PLAINTEXT_AUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_PLAINTEXT_AUTH\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_MARK_GROUP_TRUE}" && test -z "${USE_MARK_GROUP_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_MARK_GROUP\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_MARK_GROUP\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_MARK_GROUP\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_MARK_FIELD_TRUE}" && test -z "${USE_MARK_FIELD_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_MARK_FIELD\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_MARK_FIELD\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_MARK_FIELD\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_MARK_FLAG_TRUE}" && test -z "${USE_MARK_FLAG_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_MARK_FLAG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_MARK_FLAG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_MARK_FLAG\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_SYSLOG_LOG_TRUE}" && test -z "${USE_SYSLOG_LOG_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_SYSLOG_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_SYSLOG_LOG\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_SYSLOG_LOG\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${BUILD_NUFW_TRUE}" && test -z "${BUILD_NUFW_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"BUILD_NUFW\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"BUILD_NUFW\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"BUILD_NUFW\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${BUILD_NUAUTH_TRUE}" && test -z "${BUILD_NUAUTH_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"BUILD_NUAUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"BUILD_NUAUTH\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"BUILD_NUAUTH\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${BUILD_NUTCPC_TRUE}" && test -z "${BUILD_NUTCPC_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"BUILD_NUTCPC\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"BUILD_NUTCPC\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"BUILD_NUTCPC\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${BUILD_LIBNUCLIENT_TRUE}" && test -z "${BUILD_LIBNUCLIENT_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"BUILD_LIBNUCLIENT\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"BUILD_LIBNUCLIENT\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"BUILD_LIBNUCLIENT\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${BUILD_PAM_NUFW_TRUE}" && test -z "${BUILD_PAM_NUFW_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"BUILD_PAM_NUFW\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"BUILD_PAM_NUFW\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"BUILD_PAM_NUFW\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${BUILD_NUAUTH_COMMAND_TRUE}" && test -z "${BUILD_NUAUTH_COMMAND_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"BUILD_NUAUTH_COMMAND\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"BUILD_NUAUTH_COMMAND\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"BUILD_NUAUTH_COMMAND\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${HAVE_IPQ_TRUE}" && test -z "${HAVE_IPQ_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"HAVE_IPQ\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"HAVE_IPQ\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"HAVE_IPQ\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${USE_USER_MARK_TRUE}" && test -z "${USE_USER_MARK_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"USE_USER_MARK\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"USE_USER_MARK\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"USE_USER_MARK\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${HAVE_NFQUEUE_ONLY_TRUE}" && test -z "${HAVE_NFQUEUE_ONLY_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"HAVE_NFQUEUE_ONLY\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"HAVE_NFQUEUE_ONLY\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"HAVE_NFQUEUE_ONLY\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${HAVE_NFQUEUE_CONNTRACK_TRUE}" && test -z "${HAVE_NFQUEUE_CONNTRACK_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"HAVE_NFQUEUE_CONNTRACK\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"HAVE_NFQUEUE_CONNTRACK\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"HAVE_NFQUEUE_CONNTRACK\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${HAVE_CONNTRACK_ONLY_TRUE}" && test -z "${HAVE_CONNTRACK_ONLY_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"HAVE_CONNTRACK_ONLY\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"HAVE_CONNTRACK_ONLY\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"HAVE_CONNTRACK_ONLY\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"AMDEP\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"AMDEP\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&5
+-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+-Usually this means the macro was only invoked conditionally." >&2;}
+-   { (exit 1); exit 1; }; }
++  as_fn_error "conditional \"am__fastdepCC\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
+ : ${CONFIG_STATUS=./config.status}
++ac_write_fail=0
+ ac_clean_files_save=$ac_clean_files
+ ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+-echo "$as_me: creating $CONFIG_STATUS" >&6;}
+-cat >$CONFIG_STATUS <<_ACEOF
++{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
++$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
++as_write_fail=0
++cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+ #! $SHELL
+ # Generated by $as_me.
+ # Run this file to recreate the current configuration.
+@@ -16496,59 +14303,79 @@
+ debug=false
+ ac_cs_recheck=false
+ ac_cs_silent=false
+-SHELL=\${CONFIG_SHELL-$SHELL}
+-_ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
+-## --------------------- ##
+-## M4sh Initialization.  ##
+-## --------------------- ##
++SHELL=\${CONFIG_SHELL-$SHELL}
++export SHELL
++_ASEOF
++cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
++## -------------------- ##
++## M4sh Initialization. ##
++## -------------------- ##
+ # Be more Bourne compatible
+ DUALCASE=1; export DUALCASE # for MKS sh
+-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+   emulate sh
+   NULLCMD=:
+-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
++  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+   # is contrary to our usage.  Disable this feature.
+   alias -g '${1+"$@"}'='"$@"'
+   setopt NO_GLOB_SUBST
+ else
+-  case `(set -o) 2>/dev/null` in
+-  *posix*) set -o posix ;;
++  case `(set -o) 2>/dev/null` in #(
++  *posix*) :
++    set -o posix ;; #(
++  *) :
++     ;;
+ esac
+-
+ fi
+-
+-
+-# PATH needs CR
+-# Avoid depending upon Character Ranges.
+-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+-as_cr_digits='0123456789'
+-as_cr_alnum=$as_cr_Letters$as_cr_digits
+-
+-# The user is always right.
+-if test "${PATH_SEPARATOR+set}" != set; then
+-  echo "#! /bin/sh" >conf$$.sh
+-  echo  "exit 0"   >>conf$$.sh
+-  chmod +x conf$$.sh
+-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+-    PATH_SEPARATOR=';'
++as_nl='
++'
++export as_nl
++# Printing a long string crashes Solaris 7 /usr/bin/printf.
++as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
++as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
++# Prefer a ksh shell builtin over an external printf program on Solaris,
++# but without wasting forks for bash or zsh.
++if test -z "$BASH_VERSION$ZSH_VERSION" \
++    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
++  as_echo='print -r --'
++  as_echo_n='print -rn --'
++elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
++  as_echo='printf %s\n'
++  as_echo_n='printf %s'
++else
++  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
++    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
++    as_echo_n='/usr/ucb/echo -n'
+   else
+-    PATH_SEPARATOR=:
++    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
++    as_echo_n_body='eval
++      arg=$1;
++      case $arg in #(
++      *"$as_nl"*)
++      expr "X$arg" : "X\\(.*\\)$as_nl";
++      arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
++      esac;
++      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
++    '
++    export as_echo_n_body
++    as_echo_n='sh -c $as_echo_n_body as_echo'
+   fi
+-  rm -f conf$$.sh
++  export as_echo_body
++  as_echo='sh -c $as_echo_body as_echo'
+ fi
+-# Support unset when possible.
+-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+-  as_unset=unset
+-else
+-  as_unset=false
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++  PATH_SEPARATOR=:
++  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
++    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
++      PATH_SEPARATOR=';'
++  }
+ fi
+@@ -16557,20 +14384,18 @@
+ # there to prevent editors from complaining about space-tab.
+ # (If _AS_PATH_WALK were called with IFS unset, it would disable word
+ # splitting by setting IFS to empty value.)
+-as_nl='
+-'
+ IFS=" ""      $as_nl"
+ # Find who we are.  Look in the path if we contain no directory separator.
+-case $0 in
++case $0 in #((
+   *[\\/]* ) as_myself=$0 ;;
+   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for as_dir in $PATH
+ do
+   IFS=$as_save_IFS
+   test -z "$as_dir" && as_dir=.
+-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+-done
++    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
++  done
+ IFS=$as_save_IFS
+      ;;
+@@ -16581,32 +14406,111 @@
+   as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+-  { (exit 1); exit 1; }
++  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
++  exit 1
+ fi
+-# Work around bugs in pre-3.0 UWIN ksh.
+-for as_var in ENV MAIL MAILPATH
+-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
++# Unset variables that we do not need and which cause bugs (e.g. in
++# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
++# suppresses any "Segmentation fault" message there.  '((' could
++# trigger a bug in pdksh 5.2.14.
++for as_var in BASH_ENV ENV MAIL MAILPATH
++do eval test x\${$as_var+set} = xset \
++  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+ done
+ PS1='$ '
+ PS2='> '
+ PS4='+ '
+-# NLS nuisances.
+-for as_var in \
+-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+-  LC_TELEPHONE LC_TIME
+-do
+-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+-    eval $as_var=C; export $as_var
+-  else
+-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+-  fi
+-done
++# NLS nuisances.
++LC_ALL=C
++export LC_ALL
++LANGUAGE=C
++export LANGUAGE
++
++# CDPATH.
++(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
++
++
++# as_fn_error ERROR [LINENO LOG_FD]
++# ---------------------------------
++# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
++# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
++# script with status $?, using 1 if that was 0.
++as_fn_error ()
++{
++  as_status=$?; test $as_status -eq 0 && as_status=1
++  if test "$3"; then
++    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
++    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
++  fi
++  $as_echo "$as_me: error: $1" >&2
++  as_fn_exit $as_status
++} # as_fn_error
++
++
++# as_fn_set_status STATUS
++# -----------------------
++# Set $? to STATUS, without forking.
++as_fn_set_status ()
++{
++  return $1
++} # as_fn_set_status
++
++# as_fn_exit STATUS
++# -----------------
++# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
++as_fn_exit ()
++{
++  set +e
++  as_fn_set_status $1
++  exit $1
++} # as_fn_exit
++
++# as_fn_unset VAR
++# ---------------
++# Portably unset VAR.
++as_fn_unset ()
++{
++  { eval $1=; unset $1;}
++}
++as_unset=as_fn_unset
++# as_fn_append VAR VALUE
++# ----------------------
++# Append the text in VALUE to the end of the definition contained in VAR. Take
++# advantage of any shell optimizations that allow amortized linear growth over
++# repeated appends, instead of the typical quadratic growth present in naive
++# implementations.
++if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
++  eval 'as_fn_append ()
++  {
++    eval $1+=\$2
++  }'
++else
++  as_fn_append ()
++  {
++    eval $1=\$$1\$2
++  }
++fi # as_fn_append
++
++# as_fn_arith ARG...
++# ------------------
++# Perform arithmetic evaluation on the ARGs, and store the result in the
++# global $as_val. Take advantage of shells that can avoid forks. The arguments
++# must be portable across $(()) and expr.
++if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
++  eval 'as_fn_arith ()
++  {
++    as_val=$(( $* ))
++  }'
++else
++  as_fn_arith ()
++  {
++    as_val=`expr "$@" || test $? -eq 1`
++  }
++fi # as_fn_arith
++
+-# Required to use basename.
+ if expr a : '\(a\)' >/dev/null 2>&1 &&
+    test "X`expr 00001 : '.*\(...\)'`" = X001; then
+   as_expr=expr
+@@ -16620,13 +14524,17 @@
+   as_basename=false
+ fi
++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
++  as_dirname=dirname
++else
++  as_dirname=false
++fi
+-# Name of the executable.
+ as_me=`$as_basename -- "$0" ||
+ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X/"$0" |
++$as_echo X/"$0" |
+     sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+@@ -16641,104 +14549,103 @@
+         }
+         s/.*/./; q'`
+-# CDPATH.
+-$as_unset CDPATH
+-
+-
+-
+-  as_lineno_1=$LINENO
+-  as_lineno_2=$LINENO
+-  test "x$as_lineno_1" != "x$as_lineno_2" &&
+-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+-
+-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+-  # uniformly replaced by the line number.  The first 'sed' inserts a
+-  # line-number line after each line using $LINENO; the second 'sed'
+-  # does the real work.  The second script uses 'N' to pair each
+-  # line-number line with the line containing $LINENO, and appends
+-  # trailing '-' during substitution so that $LINENO is not a special
+-  # case at line end.
+-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+-  # E. McMahon (1931-1989) for sed's syntax.  :-)
+-  sed -n '
+-    p
+-    /[$]LINENO/=
+-  ' <$as_myself |
+-    sed '
+-      s/[$]LINENO.*/&-/
+-      t lineno
+-      b
+-      :lineno
+-      N
+-      :loop
+-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+-      t loop
+-      s/-\n.*//
+-    ' >$as_me.lineno &&
+-  chmod +x "$as_me.lineno" ||
+-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+-   { (exit 1); exit 1; }; }
+-
+-  # Don't try to exec as it changes $[0], causing all sort of problems
+-  # (the dirname of $[0] is not the place where we might find the
+-  # original and so on.  Autoconf is especially sensitive to this).
+-  . "./$as_me.lineno"
+-  # Exit status is that of the last command.
+-  exit
+-}
+-
+-
+-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+-  as_dirname=dirname
+-else
+-  as_dirname=false
+-fi
++# Avoid depending upon Character Ranges.
++as_cr_letters='abcdefghijklmnopqrstuvwxyz'
++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
++as_cr_Letters=$as_cr_letters$as_cr_LETTERS
++as_cr_digits='0123456789'
++as_cr_alnum=$as_cr_Letters$as_cr_digits
+ ECHO_C= ECHO_N= ECHO_T=
+-case `echo -n x` in
++case `echo -n x` in #(((((
+ -n*)
+-  case `echo 'x\c'` in
++  case `echo 'xy\c'` in
+   *c*) ECHO_T='       ';;     # ECHO_T is single tab character.
+-  *)   ECHO_C='\c';;
++  xy)  ECHO_C='\c';;
++  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
++       ECHO_T='       ';;
+   esac;;
+ *)
+   ECHO_N='-n';;
+ esac
+-if expr a : '\(a\)' >/dev/null 2>&1 &&
+-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+-  as_expr=expr
+-else
+-  as_expr=false
+-fi
+-
+ rm -f conf$$ conf$$.exe conf$$.file
+ if test -d conf$$.dir; then
+   rm -f conf$$.dir/conf$$.file
+ else
+   rm -f conf$$.dir
+-  mkdir conf$$.dir
++  mkdir conf$$.dir 2>/dev/null
+ fi
+-echo >conf$$.file
+-if ln -s conf$$.file conf$$ 2>/dev/null; then
+-  as_ln_s='ln -s'
+-  # ... but there are two gotchas:
+-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+-  # In both cases, we have to default to `cp -p'.
+-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
++if (echo >conf$$.file) 2>/dev/null; then
++  if ln -s conf$$.file conf$$ 2>/dev/null; then
++    as_ln_s='ln -s'
++    # ... but there are two gotchas:
++    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
++    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
++    # In both cases, we have to default to `cp -p'.
++    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
++      as_ln_s='cp -p'
++  elif ln conf$$.file conf$$ 2>/dev/null; then
++    as_ln_s=ln
++  else
+     as_ln_s='cp -p'
+-elif ln conf$$.file conf$$ 2>/dev/null; then
+-  as_ln_s=ln
++  fi
+ else
+   as_ln_s='cp -p'
+ fi
+ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+ rmdir conf$$.dir 2>/dev/null
++
++# as_fn_mkdir_p
++# -------------
++# Create "$as_dir" as a directory, including parents if necessary.
++as_fn_mkdir_p ()
++{
++
++  case $as_dir in #(
++  -*) as_dir=./$as_dir;;
++  esac
++  test -d "$as_dir" || eval $as_mkdir_p || {
++    as_dirs=
++    while :; do
++      case $as_dir in #(
++      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
++      *) as_qdir=$as_dir;;
++      esac
++      as_dirs="'$as_qdir' $as_dirs"
++      as_dir=`$as_dirname -- "$as_dir" ||
++$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++       X"$as_dir" : 'X\(//\)[^/]' \| \
++       X"$as_dir" : 'X\(//\)$' \| \
++       X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
++$as_echo X"$as_dir" |
++    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
++          s//\1/
++          q
++        }
++        /^X\(\/\/\)[^/].*/{
++          s//\1/
++          q
++        }
++        /^X\(\/\/\)$/{
++          s//\1/
++          q
++        }
++        /^X\(\/\).*/{
++          s//\1/
++          q
++        }
++        s/.*/./; q'`
++      test -d "$as_dir" && break
++    done
++    test -z "$as_dirs" || eval "mkdir $as_dirs"
++  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
++
++
++} # as_fn_mkdir_p
+ if mkdir -p . 2>/dev/null; then
+-  as_mkdir_p=:
++  as_mkdir_p='mkdir -p "$as_dir"'
+ else
+   test -d ./-p && rmdir ./-p
+   as_mkdir_p=false
+@@ -16755,12 +14662,12 @@
+   as_test_x='
+     eval sh -c '\''
+       if test -d "$1"; then
+-        test -d "$1/.";
++      test -d "$1/.";
+       else
+-      case $1 in
+-        -*)set "./$1";;
++      case $1 in #(
++      -*)set "./$1";;
+       esac;
+-      case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
++      case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+     '\'' sh
+   '
+@@ -16775,13 +14682,19 @@
+ exec 6>&1
++## ----------------------------------- ##
++## Main body of $CONFIG_STATUS script. ##
++## ----------------------------------- ##
++_ASEOF
++test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+-# Save the log message, to keep $[0] and so on meaningful, and to
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
++# Save the log message, to keep $0 and so on meaningful, and to
+ # report actual input values of CONFIG_FILES etc. instead of their
+ # values after options handling.
+ ac_log="
+ This file was extended by NuFW $as_me 2.2.21, which was
+-generated by GNU Autoconf 2.61.  Invocation command line was
++generated by GNU Autoconf 2.64.  Invocation command line was
+   CONFIG_FILES    = $CONFIG_FILES
+   CONFIG_HEADERS  = $CONFIG_HEADERS
+@@ -16794,7 +14707,16 @@
+ _ACEOF
+-cat >>$CONFIG_STATUS <<_ACEOF
++case $ac_config_files in *"
++"*) set x $ac_config_files; shift; ac_config_files=$*;;
++esac
++
++case $ac_config_headers in *"
++"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
++esac
++
++
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ # Files that config.status was made for.
+ config_files="$ac_config_files"
+ config_headers="$ac_config_headers"
+@@ -16802,22 +14724,24 @@
+ _ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ ac_cs_usage="\
+-\`$as_me' instantiates files from templates according to the
+-current configuration.
++\`$as_me' instantiates files and other configuration actions
++from templates according to the current configuration.  Unless the files
++and actions are specified as TAGs, all are instantiated by default.
+-Usage: $0 [OPTIONS] [FILE]...
++Usage: $0 [OPTION]... [TAG]...
+   -h, --help       print this help, then exit
+   -V, --version    print version number and configuration settings, then exit
+-  -q, --quiet      do not print progress messages
++  -q, --quiet, --silent
++                   do not print progress messages
+   -d, --debug      don't remove temporary files
+       --recheck    update $as_me by reconfiguring in the same conditions
+-  --file=FILE[:TEMPLATE]
+-                 instantiate the configuration file FILE
+-  --header=FILE[:TEMPLATE]
+-                 instantiate the configuration header FILE
++      --file=FILE[:TEMPLATE]
++                   instantiate the configuration file FILE
++      --header=FILE[:TEMPLATE]
++                   instantiate the configuration header FILE
+ Configuration files:
+ $config_files
+@@ -16828,16 +14752,16 @@
+ Configuration commands:
+ $config_commands
+-Report bugs to <bug-autoconf@gnu.org>."
++Report bugs to <nufw-devel@nongnu.org>."
+ _ACEOF
+-cat >>$CONFIG_STATUS <<_ACEOF
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_cs_version="\\
+ NuFW config.status 2.2.21
+-configured by $0, generated by GNU Autoconf 2.61,
+-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
++configured by $0, generated by GNU Autoconf 2.64,
++  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+-Copyright (C) 2006 Free Software Foundation, Inc.
++Copyright (C) 2009 Free Software Foundation, Inc.
+ This config.status script is free software; the Free Software Foundation
+ gives unlimited permission to copy, distribute and modify it."
+@@ -16845,11 +14769,12 @@
+ srcdir='$srcdir'
+ INSTALL='$INSTALL'
+ MKDIR_P='$MKDIR_P'
++AWK='$AWK'
++test -n "\$AWK" || AWK=awk
+ _ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
+-# If no file are specified by the user, then we need to provide default
+-# value.  By we need to know if files were specified by the user.
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
++# The default lists apply if the user does not specify any file.
+ ac_need_defaults=:
+ while test $# != 0
+ do
+@@ -16871,34 +14796,38 @@
+   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+     ac_cs_recheck=: ;;
+   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+-    echo "$ac_cs_version"; exit ;;
++    $as_echo "$ac_cs_version"; exit ;;
+   --debug | --debu | --deb | --de | --d | -d )
+     debug=: ;;
+   --file | --fil | --fi | --f )
+     $ac_shift
+-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
++    case $ac_optarg in
++    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
++    esac
++    as_fn_append CONFIG_FILES " '$ac_optarg'"
+     ac_need_defaults=false;;
+   --header | --heade | --head | --hea )
+     $ac_shift
+-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
++    case $ac_optarg in
++    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
++    esac
++    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+     ac_need_defaults=false;;
+   --he | --h)
+     # Conflict between --help and --header
+-    { echo "$as_me: error: ambiguous option: $1
+-Try \`$0 --help' for more information." >&2
+-   { (exit 1); exit 1; }; };;
++    as_fn_error "ambiguous option: \`$1'
++Try \`$0 --help' for more information.";;
+   --help | --hel | -h )
+-    echo "$ac_cs_usage"; exit ;;
++    $as_echo "$ac_cs_usage"; exit ;;
+   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+   | -silent | --silent | --silen | --sile | --sil | --si | --s)
+     ac_cs_silent=: ;;
+   # This is an error.
+-  -*) { echo "$as_me: error: unrecognized option: $1
+-Try \`$0 --help' for more information." >&2
+-   { (exit 1); exit 1; }; } ;;
++  -*) as_fn_error "unrecognized option: \`$1'
++Try \`$0 --help' for more information." ;;
+-  *) ac_config_targets="$ac_config_targets $1"
++  *) as_fn_append ac_config_targets " $1"
+      ac_need_defaults=false ;;
+   esac
+@@ -16913,27 +14842,29 @@
+ fi
+ _ACEOF
+-cat >>$CONFIG_STATUS <<_ACEOF
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ if \$ac_cs_recheck; then
+-  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+-  CONFIG_SHELL=$SHELL
++  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
++  shift
++  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
++  CONFIG_SHELL='$SHELL'
+   export CONFIG_SHELL
+-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
++  exec "\$@"
+ fi
+ _ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ exec 5>>config.log
+ {
+   echo
+   sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+ ## Running $as_me. ##
+ _ASBOX
+-  echo "$ac_log"
++  $as_echo "$ac_log"
+ } >&5
+ _ACEOF
+-cat >>$CONFIG_STATUS <<_ACEOF
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ #
+ # INIT-COMMANDS
+ #
+@@ -16974,6 +14905,7 @@
+ lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+ reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+ reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
++OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+ deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+ file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+ AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+@@ -17079,6 +15011,7 @@
+ lt_SP2NL \
+ lt_NL2SP \
+ reload_flag \
++OBJDUMP \
+ deplibs_check_method \
+ file_magic_cmd \
+ AR \
+@@ -17194,7 +15127,7 @@
+ _ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ # Handling of arguments.
+ for ac_config_target in $ac_config_targets
+@@ -17245,9 +15178,7 @@
+     "tests/pki/Makefile") CONFIG_FILES="$CONFIG_FILES tests/pki/Makefile" ;;
+     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+-   { (exit 1); exit 1; }; };;
++  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+   esac
+ done
+@@ -17274,7 +15205,7 @@
+   trap 'exit_status=$?
+   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ ' 0
+-  trap '{ (exit 1); exit 1; }' 1 2 13 15
++  trap 'as_fn_exit 1' 1 2 13 15
+ }
+ # Create a (secure) tmp directory for tmp files.
+@@ -17285,272 +15216,139 @@
+ {
+   tmp=./conf$$-$RANDOM
+   (umask 077 && mkdir "$tmp")
+-} ||
+-{
+-   echo "$me: cannot create a temporary directory in ." >&2
+-   { (exit 1); exit 1; }
+-}
+-
+-#
+-# Set up the sed scripts for CONFIG_FILES section.
+-#
++} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+-# No need to generate the scripts if there are no CONFIG_FILES.
+-# This happens for instance when ./config.status config.h
++# Set up the scripts for CONFIG_FILES section.
++# No need to generate them if there are no CONFIG_FILES.
++# This happens for instance with `./config.status config.h'.
+ if test -n "$CONFIG_FILES"; then
+-_ACEOF
+-
+-
+-
+-ac_delim='%!_!# '
+-for ac_last_try in false false false false false :; do
+-  cat >conf$$subs.sed <<_ACEOF
+-SHELL!$SHELL$ac_delim
+-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+-exec_prefix!$exec_prefix$ac_delim
+-prefix!$prefix$ac_delim
+-program_transform_name!$program_transform_name$ac_delim
+-bindir!$bindir$ac_delim
+-sbindir!$sbindir$ac_delim
+-libexecdir!$libexecdir$ac_delim
+-datarootdir!$datarootdir$ac_delim
+-datadir!$datadir$ac_delim
+-sysconfdir!$sysconfdir$ac_delim
+-sharedstatedir!$sharedstatedir$ac_delim
+-localstatedir!$localstatedir$ac_delim
+-includedir!$includedir$ac_delim
+-oldincludedir!$oldincludedir$ac_delim
+-docdir!$docdir$ac_delim
+-infodir!$infodir$ac_delim
+-htmldir!$htmldir$ac_delim
+-dvidir!$dvidir$ac_delim
+-pdfdir!$pdfdir$ac_delim
+-psdir!$psdir$ac_delim
+-libdir!$libdir$ac_delim
+-localedir!$localedir$ac_delim
+-mandir!$mandir$ac_delim
+-DEFS!$DEFS$ac_delim
+-ECHO_C!$ECHO_C$ac_delim
+-ECHO_N!$ECHO_N$ac_delim
+-ECHO_T!$ECHO_T$ac_delim
+-LIBS!$LIBS$ac_delim
+-build_alias!$build_alias$ac_delim
+-host_alias!$host_alias$ac_delim
+-target_alias!$target_alias$ac_delim
+-CC!$CC$ac_delim
+-CFLAGS!$CFLAGS$ac_delim
+-LDFLAGS!$LDFLAGS$ac_delim
+-CPPFLAGS!$CPPFLAGS$ac_delim
+-ac_ct_CC!$ac_ct_CC$ac_delim
+-EXEEXT!$EXEEXT$ac_delim
+-OBJEXT!$OBJEXT$ac_delim
+-LIBTOOL!$LIBTOOL$ac_delim
+-build!$build$ac_delim
+-build_cpu!$build_cpu$ac_delim
+-build_vendor!$build_vendor$ac_delim
+-build_os!$build_os$ac_delim
+-host!$host$ac_delim
+-host_cpu!$host_cpu$ac_delim
+-host_vendor!$host_vendor$ac_delim
+-host_os!$host_os$ac_delim
+-SED!$SED$ac_delim
+-GREP!$GREP$ac_delim
+-EGREP!$EGREP$ac_delim
+-FGREP!$FGREP$ac_delim
+-LD!$LD$ac_delim
+-DUMPBIN!$DUMPBIN$ac_delim
+-ac_ct_DUMPBIN!$ac_ct_DUMPBIN$ac_delim
+-NM!$NM$ac_delim
+-LN_S!$LN_S$ac_delim
+-AR!$AR$ac_delim
+-STRIP!$STRIP$ac_delim
+-RANLIB!$RANLIB$ac_delim
+-lt_ECHO!$lt_ECHO$ac_delim
+-DSYMUTIL!$DSYMUTIL$ac_delim
+-NMEDIT!$NMEDIT$ac_delim
+-LIPO!$LIPO$ac_delim
+-OTOOL!$OTOOL$ac_delim
+-OTOOL64!$OTOOL64$ac_delim
+-CPP!$CPP$ac_delim
+-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+-INSTALL_DATA!$INSTALL_DATA$ac_delim
+-DOCBOOK2MAN!$DOCBOOK2MAN$ac_delim
+-DOCBOOK2PDF!$DOCBOOK2PDF$ac_delim
+-LIBOBJS!$LIBOBJS$ac_delim
+-LIBGCRYPT_CONFIG!$LIBGCRYPT_CONFIG$ac_delim
+-LIBGCRYPT_CFLAGS!$LIBGCRYPT_CFLAGS$ac_delim
+-LIBGCRYPT_LIBS!$LIBGCRYPT_LIBS$ac_delim
+-LIBGNUTLS_CONFIG!$LIBGNUTLS_CONFIG$ac_delim
+-LIBGNUTLS_CFLAGS!$LIBGNUTLS_CFLAGS$ac_delim
+-LIBGNUTLS_LIBS!$LIBGNUTLS_LIBS$ac_delim
+-PYTHON!$PYTHON$ac_delim
+-PKG_CONFIG!$PKG_CONFIG$ac_delim
+-GLIB_CFLAGS!$GLIB_CFLAGS$ac_delim
+-GLIB_LIBS!$GLIB_LIBS$ac_delim
+-GLIB_GENMARSHAL!$GLIB_GENMARSHAL$ac_delim
+-GOBJECT_QUERY!$GOBJECT_QUERY$ac_delim
+-GLIB_MKENUMS!$GLIB_MKENUMS$ac_delim
+-USE_SYSTEM_AUTH_TRUE!$USE_SYSTEM_AUTH_TRUE$ac_delim
+-USE_SYSTEM_AUTH_FALSE!$USE_SYSTEM_AUTH_FALSE$ac_delim
+-USE_LDAP_TRUE!$USE_LDAP_TRUE$ac_delim
+-USE_LDAP_FALSE!$USE_LDAP_FALSE$ac_delim
+-USE_PRELUDE_LOG_TRUE!$USE_PRELUDE_LOG_TRUE$ac_delim
+-USE_PRELUDE_LOG_FALSE!$USE_PRELUDE_LOG_FALSE$ac_delim
+-_ACEOF
+-
+-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+-    break
+-  elif $ac_last_try; then
+-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+-   { (exit 1); exit 1; }; }
+-  else
+-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+-  fi
+-done
+-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+-if test -n "$ac_eof"; then
+-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+-  ac_eof=`expr $ac_eof + 1`
++ac_cr=`echo X | tr X '\015'`
++# On cygwin, bash can eat \r inside `` if the user requested igncr.
++# But we know of no other shell where ac_cr would be empty at this
++# point, so we can use a bashism as a fallback.
++if test "x$ac_cr" = x; then
++  eval ac_cr=\$\'\\r\'
++fi
++ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
++if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
++  ac_cs_awk_cr='\r'
++else
++  ac_cs_awk_cr=$ac_cr
+ fi
+-cat >>$CONFIG_STATUS <<_ACEOF
+-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+-_ACEOF
+-sed '
+-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+-s/^/s,@/; s/!/@,|#_!!_#|/
+-:n
+-t n
+-s/'"$ac_delim"'$/,g/; t
+-s/$/\\/; p
+-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+-' >>$CONFIG_STATUS <conf$$subs.sed
+-rm -f conf$$subs.sed
+-cat >>$CONFIG_STATUS <<_ACEOF
+-CEOF$ac_eof
++echo 'BEGIN {' >"$tmp/subs1.awk" &&
+ _ACEOF
++{
++  echo "cat >conf$$subs.awk <<_ACEOF" &&
++  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
++  echo "_ACEOF"
++} >conf$$subs.sh ||
++  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
++ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ ac_delim='%!_!# '
+ for ac_last_try in false false false false false :; do
+-  cat >conf$$subs.sed <<_ACEOF
+-USE_MYSQL_LOG_TRUE!$USE_MYSQL_LOG_TRUE$ac_delim
+-USE_MYSQL_LOG_FALSE!$USE_MYSQL_LOG_FALSE$ac_delim
+-USE_MYSQL_AUTH_TRUE!$USE_MYSQL_AUTH_TRUE$ac_delim
+-USE_MYSQL_AUTH_FALSE!$USE_MYSQL_AUTH_FALSE$ac_delim
+-HAVE_MYSQL_CONFIG_TRUE!$HAVE_MYSQL_CONFIG_TRUE$ac_delim
+-HAVE_MYSQL_CONFIG_FALSE!$HAVE_MYSQL_CONFIG_FALSE$ac_delim
+-USE_PGSQL_LOG_TRUE!$USE_PGSQL_LOG_TRUE$ac_delim
+-USE_PGSQL_LOG_FALSE!$USE_PGSQL_LOG_FALSE$ac_delim
+-USE_PLAINTEXT_AUTH_TRUE!$USE_PLAINTEXT_AUTH_TRUE$ac_delim
+-USE_PLAINTEXT_AUTH_FALSE!$USE_PLAINTEXT_AUTH_FALSE$ac_delim
+-USE_MARK_GROUP_TRUE!$USE_MARK_GROUP_TRUE$ac_delim
+-USE_MARK_GROUP_FALSE!$USE_MARK_GROUP_FALSE$ac_delim
+-USE_MARK_FIELD_TRUE!$USE_MARK_FIELD_TRUE$ac_delim
+-USE_MARK_FIELD_FALSE!$USE_MARK_FIELD_FALSE$ac_delim
+-USE_MARK_FLAG_TRUE!$USE_MARK_FLAG_TRUE$ac_delim
+-USE_MARK_FLAG_FALSE!$USE_MARK_FLAG_FALSE$ac_delim
+-USE_SYSLOG_LOG_TRUE!$USE_SYSLOG_LOG_TRUE$ac_delim
+-USE_SYSLOG_LOG_FALSE!$USE_SYSLOG_LOG_FALSE$ac_delim
+-BUILD_NUFW_TRUE!$BUILD_NUFW_TRUE$ac_delim
+-BUILD_NUFW_FALSE!$BUILD_NUFW_FALSE$ac_delim
+-BUILD_NUAUTH_TRUE!$BUILD_NUAUTH_TRUE$ac_delim
+-BUILD_NUAUTH_FALSE!$BUILD_NUAUTH_FALSE$ac_delim
+-BUILD_NUTCPC_TRUE!$BUILD_NUTCPC_TRUE$ac_delim
+-BUILD_NUTCPC_FALSE!$BUILD_NUTCPC_FALSE$ac_delim
+-BUILD_LIBNUCLIENT_TRUE!$BUILD_LIBNUCLIENT_TRUE$ac_delim
+-BUILD_LIBNUCLIENT_FALSE!$BUILD_LIBNUCLIENT_FALSE$ac_delim
+-BUILD_PAM_NUFW_TRUE!$BUILD_PAM_NUFW_TRUE$ac_delim
+-BUILD_PAM_NUFW_FALSE!$BUILD_PAM_NUFW_FALSE$ac_delim
+-BUILD_NUAUTH_COMMAND_TRUE!$BUILD_NUAUTH_COMMAND_TRUE$ac_delim
+-BUILD_NUAUTH_COMMAND_FALSE!$BUILD_NUAUTH_COMMAND_FALSE$ac_delim
+-HAVE_IPQ_TRUE!$HAVE_IPQ_TRUE$ac_delim
+-HAVE_IPQ_FALSE!$HAVE_IPQ_FALSE$ac_delim
+-USE_USER_MARK_TRUE!$USE_USER_MARK_TRUE$ac_delim
+-USE_USER_MARK_FALSE!$USE_USER_MARK_FALSE$ac_delim
+-HAVE_NFQUEUE_ONLY_TRUE!$HAVE_NFQUEUE_ONLY_TRUE$ac_delim
+-HAVE_NFQUEUE_ONLY_FALSE!$HAVE_NFQUEUE_ONLY_FALSE$ac_delim
+-HAVE_NFQUEUE_CONNTRACK_TRUE!$HAVE_NFQUEUE_CONNTRACK_TRUE$ac_delim
+-HAVE_NFQUEUE_CONNTRACK_FALSE!$HAVE_NFQUEUE_CONNTRACK_FALSE$ac_delim
+-HAVE_CONNTRACK_ONLY_TRUE!$HAVE_CONNTRACK_ONLY_TRUE$ac_delim
+-HAVE_CONNTRACK_ONLY_FALSE!$HAVE_CONNTRACK_ONLY_FALSE$ac_delim
+-am__isrc!$am__isrc$ac_delim
+-CYGPATH_W!$CYGPATH_W$ac_delim
+-PACKAGE!$PACKAGE$ac_delim
+-VERSION!$VERSION$ac_delim
+-ACLOCAL!$ACLOCAL$ac_delim
+-AUTOCONF!$AUTOCONF$ac_delim
+-AUTOMAKE!$AUTOMAKE$ac_delim
+-AUTOHEADER!$AUTOHEADER$ac_delim
+-MAKEINFO!$MAKEINFO$ac_delim
+-install_sh!$install_sh$ac_delim
+-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+-mkdir_p!$mkdir_p$ac_delim
+-AWK!$AWK$ac_delim
+-SET_MAKE!$SET_MAKE$ac_delim
+-am__leading_dot!$am__leading_dot$ac_delim
+-AMTAR!$AMTAR$ac_delim
+-am__tar!$am__tar$ac_delim
+-am__untar!$am__untar$ac_delim
+-DEPDIR!$DEPDIR$ac_delim
+-am__include!$am__include$ac_delim
+-am__quote!$am__quote$ac_delim
+-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+-CCDEPMODE!$CCDEPMODE$ac_delim
+-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+-LTLIBOBJS!$LTLIBOBJS$ac_delim
+-_ACEOF
++  . ./conf$$subs.sh ||
++    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then
++  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
++  if test $ac_delim_n = $ac_delim_num; then
+     break
+   elif $ac_last_try; then
+-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+-   { (exit 1); exit 1; }; }
++    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+   else
+     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+   fi
+ done
++rm -f conf$$subs.sh
+-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+-if test -n "$ac_eof"; then
+-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+-  ac_eof=`expr $ac_eof + 1`
+-fi
+-
+-cat >>$CONFIG_STATUS <<_ACEOF
+-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+-_ACEOF
+-sed '
+-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+-s/^/s,@/; s/!/@,|#_!!_#|/
+-:n
+-t n
+-s/'"$ac_delim"'$/,g/; t
+-s/$/\\/; p
+-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+-' >>$CONFIG_STATUS <conf$$subs.sed
+-rm -f conf$$subs.sed
+-cat >>$CONFIG_STATUS <<_ACEOF
+-:end
+-s/|#_!!_#|//g
+-CEOF$ac_eof
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
++cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+ _ACEOF
++sed -n '
++h
++s/^/S["/; s/!.*/"]=/
++p
++g
++s/^[^!]*!//
++:repl
++t repl
++s/'"$ac_delim"'$//
++t delim
++:nl
++h
++s/\(.\{148\}\).*/\1/
++t more1
++s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
++p
++n
++b repl
++:more1
++s/["\\]/\\&/g; s/^/"/; s/$/"\\/
++p
++g
++s/.\{148\}//
++t nl
++:delim
++h
++s/\(.\{148\}\).*/\1/
++t more2
++s/["\\]/\\&/g; s/^/"/; s/$/"/
++p
++b
++:more2
++s/["\\]/\\&/g; s/^/"/; s/$/"\\/
++p
++g
++s/.\{148\}//
++t delim
++' <conf$$subs.awk | sed '
++/^[^""]/{
++  N
++  s/\n//
++}
++' >>$CONFIG_STATUS || ac_write_fail=1
++rm -f conf$$subs.awk
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
++_ACAWK
++cat >>"\$tmp/subs1.awk" <<_ACAWK &&
++  for (key in S) S_is_set[key] = 1
++  FS = "\a"
++
++}
++{
++  line = $ 0
++  nfields = split(line, field, "@")
++  substed = 0
++  len = length(field[1])
++  for (i = 2; i < nfields; i++) {
++    key = field[i]
++    keylen = length(key)
++    if (S_is_set[key]) {
++      value = S[key]
++      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
++      len += length(value) + length(field[++i])
++      substed = 1
++    } else
++      len += 1 + keylen
++  }
++
++  print line
++}
++_ACAWK
++_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
++if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
++  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
++else
++  cat
++fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
++  || as_fn_error "could not setup config files machinery" "$LINENO" 5
++_ACEOF
+ # VPATH may cause trouble with some makes, so we remove $(srcdir),
+ # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+@@ -17567,20 +15365,128 @@
+ }'
+ fi
+-cat >>$CONFIG_STATUS <<\_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ fi # test -n "$CONFIG_FILES"
++# Set up the scripts for CONFIG_HEADERS section.
++# No need to generate them if there are no CONFIG_HEADERS.
++# This happens for instance with `./config.status Makefile'.
++if test -n "$CONFIG_HEADERS"; then
++cat >"$tmp/defines.awk" <<\_ACAWK ||
++BEGIN {
++_ACEOF
++
++# Transform confdefs.h into an awk script `defines.awk', embedded as
++# here-document in config.status, that substitutes the proper values into
++# config.h.in to produce config.h.
++
++# Create a delimiter string that does not exist in confdefs.h, to ease
++# handling of long lines.
++ac_delim='%!_!# '
++for ac_last_try in false false :; do
++  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
++  if test -z "$ac_t"; then
++    break
++  elif $ac_last_try; then
++    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
++  else
++    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
++  fi
++done
++
++# For the awk script, D is an array of macro values keyed by name,
++# likewise P contains macro parameters if any.  Preserve backslash
++# newline sequences.
++
++ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
++sed -n '
++s/.\{148\}/&'"$ac_delim"'/g
++t rset
++:rset
++s/^[   ]*#[    ]*define[       ][      ]*/ /
++t def
++d
++:def
++s/\\$//
++t bsnl
++s/["\\]/\\&/g
++s/^ \('"$ac_word_re"'\)\(([^()]*)\)[   ]*\(.*\)/P["\1"]="\2"\
++D["\1"]=" \3"/p
++s/^ \('"$ac_word_re"'\)[       ]*\(.*\)/D["\1"]=" \2"/p
++d
++:bsnl
++s/["\\]/\\&/g
++s/^ \('"$ac_word_re"'\)\(([^()]*)\)[   ]*\(.*\)/P["\1"]="\2"\
++D["\1"]=" \3\\\\\\n"\\/p
++t cont
++s/^ \('"$ac_word_re"'\)[       ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
++t cont
++d
++:cont
++n
++s/.\{148\}/&'"$ac_delim"'/g
++t clear
++:clear
++s/\\$//
++t bsnlc
++s/["\\]/\\&/g; s/^/"/; s/$/"/p
++d
++:bsnlc
++s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
++b cont
++' <confdefs.h | sed '
++s/'"$ac_delim"'/"\\\
++"/g' >>$CONFIG_STATUS || ac_write_fail=1
++
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
++  for (key in D) D_is_set[key] = 1
++  FS = "\a"
++}
++/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
++  line = \$ 0
++  split(line, arg, " ")
++  if (arg[1] == "#") {
++    defundef = arg[2]
++    mac1 = arg[3]
++  } else {
++    defundef = substr(arg[1], 2)
++    mac1 = arg[2]
++  }
++  split(mac1, mac2, "(") #)
++  macro = mac2[1]
++  prefix = substr(line, 1, index(line, defundef) - 1)
++  if (D_is_set[macro]) {
++    # Preserve the white space surrounding the "#".
++    print prefix "define", macro P[macro] D[macro]
++    next
++  } else {
++    # Replace #undef with comments.  This is necessary, for example,
++    # in the case of _POSIX_SOURCE, which is predefined and required
++    # on some systems where configure will not decide to define it.
++    if (defundef == "undef") {
++      print "/*", prefix defundef, macro, "*/"
++      next
++    }
++  }
++}
++{ print }
++_ACAWK
++_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
++  as_fn_error "could not setup config headers machinery" "$LINENO" 5
++fi # test -n "$CONFIG_HEADERS"
++
+-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
++eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
++shift
++for ac_tag
+ do
+   case $ac_tag in
+   :[FHLC]) ac_mode=$ac_tag; continue;;
+   esac
+   case $ac_mode$ac_tag in
+   :[FHL]*:*);;
+-  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+-   { (exit 1); exit 1; }; };;
++  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+   :[FH]-) ac_tag=-:-;;
+   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+   esac
+@@ -17608,26 +15514,34 @@
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+-         { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+-   { (exit 1); exit 1; }; };;
++         as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+       esac
+-      ac_file_inputs="$ac_file_inputs $ac_f"
++      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
++      as_fn_append ac_file_inputs " '$ac_f'"
+     done
+     # Let's still pretend it is `configure' which instantiates (i.e., don't
+     # use $as_me), people would be surprised to read:
+     #    /* config.h.  Generated by config.status.  */
+-    configure_input="Generated from "`IFS=:
+-        echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
++    configure_input='Generated from '`
++        $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
++      `' by configure.'
+     if test x"$ac_file" != x-; then
+       configure_input="$ac_file.  $configure_input"
+-      { echo "$as_me:$LINENO: creating $ac_file" >&5
+-echo "$as_me: creating $ac_file" >&6;}
++      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
++$as_echo "$as_me: creating $ac_file" >&6;}
+     fi
++    # Neutralize special characters interpreted by sed in replacement strings.
++    case $configure_input in #(
++    *\&* | *\|* | *\\* )
++       ac_sed_conf_input=`$as_echo "$configure_input" |
++       sed 's/[\\\\&|]/\\\\&/g'`;; #(
++    *) ac_sed_conf_input=$configure_input;;
++    esac
+     case $ac_tag in
+-    *:-:* | *:-) cat >"$tmp/stdin";;
++    *:-:* | *:-) cat >"$tmp/stdin" \
++      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+     esac
+     ;;
+   esac
+@@ -17637,42 +15551,7 @@
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$ac_file" |
+-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+-          s//\1/
+-          q
+-        }
+-        /^X\(\/\/\)[^/].*/{
+-          s//\1/
+-          q
+-        }
+-        /^X\(\/\/\)$/{
+-          s//\1/
+-          q
+-        }
+-        /^X\(\/\).*/{
+-          s//\1/
+-          q
+-        }
+-        s/.*/./; q'`
+-  { as_dir="$ac_dir"
+-  case $as_dir in #(
+-  -*) as_dir=./$as_dir;;
+-  esac
+-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+-    as_dirs=
+-    while :; do
+-      case $as_dir in #(
+-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+-      *) as_qdir=$as_dir;;
+-      esac
+-      as_dirs="'$as_qdir' $as_dirs"
+-      as_dir=`$as_dirname -- "$as_dir" ||
+-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+-       X"$as_dir" : 'X\(//\)[^/]' \| \
+-       X"$as_dir" : 'X\(//\)$' \| \
+-       X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$as_dir" |
++$as_echo X"$ac_file" |
+     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+@@ -17690,20 +15569,15 @@
+           q
+         }
+         s/.*/./; q'`
+-      test -d "$as_dir" && break
+-    done
+-    test -z "$as_dirs" || eval "mkdir $as_dirs"
+-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+-   { (exit 1); exit 1; }; }; }
++  as_dir="$ac_dir"; as_fn_mkdir_p
+   ac_builddir=.
+ case "$ac_dir" in
+ .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *)
+-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
++  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+   # A ".." for each directory in $ac_dir_suffix.
+-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
++  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+   case $ac_top_builddir_sub in
+   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+@@ -17748,12 +15622,12 @@
+   esac
+ _ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ # If the template does not know about datarootdir, expand it.
+ # FIXME: This hack should be removed a few years after 2.60.
+ ac_datarootdir_hack=; ac_datarootdir_seen=
+-
+-case `sed -n '/datarootdir/ {
++ac_sed_dataroot='
++/datarootdir/ {
+   p
+   q
+ }
+@@ -17761,36 +15635,37 @@
+ /@docdir@/p
+ /@infodir@/p
+ /@localedir@/p
+-/@mandir@/p
+-' $ac_file_inputs` in
++/@mandir@/p'
++case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+ *datarootdir*) ac_datarootdir_seen=yes;;
+ *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+-  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
++  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
++$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+ _ACEOF
+-cat >>$CONFIG_STATUS <<_ACEOF
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+   ac_datarootdir_hack='
+   s&@datadir@&$datadir&g
+   s&@docdir@&$docdir&g
+   s&@infodir@&$infodir&g
+   s&@localedir@&$localedir&g
+   s&@mandir@&$mandir&g
+-    s&\\\${datarootdir}&$datarootdir&g' ;;
++  s&\\\${datarootdir}&$datarootdir&g' ;;
+ esac
+ _ACEOF
+ # Neutralize VPATH when `$srcdir' = `.'.
+ # Shell code in configure.ac might set extrasub.
+ # FIXME: do we really want to maintain this feature?
+-cat >>$CONFIG_STATUS <<_ACEOF
+-  sed "$ac_vpsub
++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
++ac_sed_extra="$ac_vpsub
+ $extrasub
+ _ACEOF
+-cat >>$CONFIG_STATUS <<\_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ :t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+-s&@configure_input@&$configure_input&;t t
++s|@configure_input@|$ac_sed_conf_input|;t t
+ s&@top_builddir@&$ac_top_builddir_sub&;t t
++s&@top_build_prefix@&$ac_top_build_prefix&;t t
+ s&@srcdir@&$ac_srcdir&;t t
+ s&@abs_srcdir@&$ac_abs_srcdir&;t t
+ s&@top_srcdir@&$ac_top_srcdir&;t t
+@@ -17801,121 +15676,50 @@
+ s&@INSTALL@&$ac_INSTALL&;t t
+ s&@MKDIR_P@&$ac_MKDIR_P&;t t
+ $ac_datarootdir_hack
+-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
++"
++eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
++  || as_fn_error "could not create $ac_file" "$LINENO" 5
+ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+   { ac_out=`sed -n '/^[        ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+-  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
++  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+ which seems to be undefined.  Please make sure it is defined." >&5
+-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
++$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+ which seems to be undefined.  Please make sure it is defined." >&2;}
+   rm -f "$tmp/stdin"
+   case $ac_file in
+-  -) cat "$tmp/out"; rm -f "$tmp/out";;
+-  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+-  esac
++  -) cat "$tmp/out" && rm -f "$tmp/out";;
++  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
++  esac \
++  || as_fn_error "could not create $ac_file" "$LINENO" 5
+  ;;
+   :H)
+   #
+   # CONFIG_HEADER
+   #
+-_ACEOF
+-
+-# Transform confdefs.h into a sed script `conftest.defines', that
+-# substitutes the proper values into config.h.in to produce config.h.
+-rm -f conftest.defines conftest.tail
+-# First, append a space to every undef/define line, to ease matching.
+-echo 's/$/ /' >conftest.defines
+-# Then, protect against being on the right side of a sed subst, or in
+-# an unquoted here document, in config.status.  If some macros were
+-# called several times there might be several #defines for the same
+-# symbol, which is useless.  But do not sort them, since the last
+-# AC_DEFINE must be honored.
+-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+-# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+-# NAME is the cpp macro being defined, VALUE is the value it is being given.
+-# PARAMS is the parameter list in the macro definition--in most cases, it's
+-# just an empty string.
+-ac_dA='s,^\\([         #]*\\)[^        ]*\\([  ]*'
+-ac_dB='\\)[    (].*,\\1define\\2'
+-ac_dC=' '
+-ac_dD=' ,'
+-
+-uniq confdefs.h |
+-  sed -n '
+-      t rset
+-      :rset
+-      s/^[     ]*#[    ]*define[       ][      ]*//
+-      t ok
+-      d
+-      :ok
+-      s/[\\&,]/\\&/g
+-      s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+-      s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+-  ' >>conftest.defines
+-
+-# Remove the space that was appended to ease matching.
+-# Then replace #undef with comments.  This is necessary, for
+-# example, in the case of _POSIX_SOURCE, which is predefined and required
+-# on some systems where configure will not decide to define it.
+-# (The regexp can be short, since the line contains either #define or #undef.)
+-echo 's/ $//
+-s,^[   #]*u.*,/* & */,' >>conftest.defines
+-
+-# Break up conftest.defines:
+-ac_max_sed_lines=50
+-
+-# First sed command is:        sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+-# Second one is:       sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+-# Third one will be:   sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+-# et cetera.
+-ac_in='$ac_file_inputs'
+-ac_out='"$tmp/out1"'
+-ac_nxt='"$tmp/out2"'
+-
+-while :
+-do
+-  # Write a here document:
+-    cat >>$CONFIG_STATUS <<_ACEOF
+-    # First, check the format of the line:
+-    cat >"\$tmp/defines.sed" <<\\CEOF
+-/^[    ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
+-/^[    ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
+-b
+-:def
+-_ACEOF
+-  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+-  echo 'CEOF
+-    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+-  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+-  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+-  grep . conftest.tail >/dev/null || break
+-  rm -f conftest.defines
+-  mv conftest.tail conftest.defines
+-done
+-rm -f conftest.defines conftest.tail
+-
+-echo "ac_result=$ac_in" >>$CONFIG_STATUS
+-cat >>$CONFIG_STATUS <<\_ACEOF
+   if test x"$ac_file" != x-; then
+-    echo "/* $configure_input  */" >"$tmp/config.h"
+-    cat "$ac_result" >>"$tmp/config.h"
+-    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+-      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+-echo "$as_me: $ac_file is unchanged" >&6;}
++    {
++      $as_echo "/* $configure_input  */" \
++      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
++    } >"$tmp/config.h" \
++      || as_fn_error "could not create $ac_file" "$LINENO" 5
++    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
++      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
++$as_echo "$as_me: $ac_file is unchanged" >&6;}
+     else
+-      rm -f $ac_file
+-      mv "$tmp/config.h" $ac_file
++      rm -f "$ac_file"
++      mv "$tmp/config.h" "$ac_file" \
++      || as_fn_error "could not create $ac_file" "$LINENO" 5
+     fi
+   else
+-    echo "/* $configure_input  */"
+-    cat "$ac_result"
++    $as_echo "/* $configure_input  */" \
++      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
++      || as_fn_error "could not create -" "$LINENO" 5
+   fi
+-  rm -f "$tmp/out12"
+-# Compute $ac_file's index in $config_headers.
+-_am_arg=$ac_file
++# Compute "$ac_file"'s index in $config_headers.
++_am_arg="$ac_file"
+ _am_stamp_count=1
+ for _am_header in $config_headers :; do
+   case $_am_header in
+@@ -17930,7 +15734,7 @@
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$_am_arg" |
++$as_echo X"$_am_arg" |
+     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+@@ -17950,8 +15754,8 @@
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+  ;;
+-  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+-echo "$as_me: executing $ac_file commands" >&6;}
++  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
++$as_echo "$as_me: executing $ac_file commands" >&6;}
+  ;;
+   esac
+@@ -18079,6 +15883,9 @@
+ reload_flag=$lt_reload_flag
+ reload_cmds=$lt_reload_cmds
++# An object symbol dumper.
++OBJDUMP=$lt_OBJDUMP
++
+ # Method to check whether dependent libraries are shared objects.
+ deplibs_check_method=$lt_deplibs_check_method
+@@ -18589,7 +16396,16 @@
+   chmod +x "$ofile"
+  ;;
+-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
++    "depfiles":C) test x"$AMDEP_TRUE" != x"" || # Autoconf 2.62 quotes --file arguments for eval, but not when files
++# are listed without --file.  Let's play safe and only enable the eval
++# if we detect the quoting.
++case $CONFIG_FILES in
++*\'*) eval set x "$CONFIG_FILES" ;;
++*)   set x $CONFIG_FILES ;;
++esac
++shift
++for mf
++do
+   # Strip MF so we end up with the name of the file.
+   mf=`echo "$mf" | sed -e 's/:.*$//'`
+   # Check whether this is an Automake generated Makefile or not.
+@@ -18605,7 +16421,7 @@
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$mf" |
++$as_echo X"$mf" |
+     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+@@ -18649,42 +16465,7 @@
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$file" |
+-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+-          s//\1/
+-          q
+-        }
+-        /^X\(\/\/\)[^/].*/{
+-          s//\1/
+-          q
+-        }
+-        /^X\(\/\/\)$/{
+-          s//\1/
+-          q
+-        }
+-        /^X\(\/\).*/{
+-          s//\1/
+-          q
+-        }
+-        s/.*/./; q'`
+-    { as_dir=$dirpart/$fdir
+-  case $as_dir in #(
+-  -*) as_dir=./$as_dir;;
+-  esac
+-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+-    as_dirs=
+-    while :; do
+-      case $as_dir in #(
+-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+-      *) as_qdir=$as_dir;;
+-      esac
+-      as_dirs="'$as_qdir' $as_dirs"
+-      as_dir=`$as_dirname -- "$as_dir" ||
+-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+-       X"$as_dir" : 'X\(//\)[^/]' \| \
+-       X"$as_dir" : 'X\(//\)$' \| \
+-       X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+-echo X"$as_dir" |
++$as_echo X"$file" |
+     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+@@ -18702,12 +16483,7 @@
+           q
+         }
+         s/.*/./; q'`
+-      test -d "$as_dir" && break
+-    done
+-    test -z "$as_dirs" || eval "mkdir $as_dirs"
+-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+-   { (exit 1); exit 1; }; }; }
++    as_dir=$dirpart/$fdir; as_fn_mkdir_p
+     # echo "creating $dirpart/$file"
+     echo '# dummy' > "$dirpart/$file"
+   done
+@@ -18718,11 +16494,13 @@
+ done # for ac_tag
+-{ (exit 0); exit 0; }
++as_fn_exit 0
+ _ACEOF
+-chmod +x $CONFIG_STATUS
+ ac_clean_files=$ac_clean_files_save
++test $ac_write_fail = 0 ||
++  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
++
+ # configure is writing to config.log, and then calls config.status.
+ # config.status does its own redirection, appending to config.log.
+@@ -18742,129 +16520,133 @@
+   exec 5>>config.log
+   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+   # would make configure fail if this is the last instruction.
+-  $ac_cs_success || { (exit 1); exit 1; }
++  $ac_cs_success || as_fn_exit $?
++fi
++if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
++$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+ fi
+-{ echo "$as_me:$LINENO: result:
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
+ Configuration complete
+ " >&5
+-echo "${ECHO_T}
++$as_echo "
+ Configuration complete
+ " >&6; }
+ if test "$debug"; then
+-      { echo "$as_me:$LINENO: result: * Compiling with developement DEBUG support" >&5
+-echo "${ECHO_T}* Compiling with developement DEBUG support" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: * Compiling with developement DEBUG support" >&5
++$as_echo "* Compiling with developement DEBUG support" >&6; }
+ fi
+ if test "${build_nuauth}" = "yes"; then
+-              { echo "$as_me:$LINENO: result: * Compiling NuAuth" >&5
+-echo "${ECHO_T}* Compiling NuAuth" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result: * Compiling NuAuth" >&5
++$as_echo "* Compiling NuAuth" >&6; }
+         if test "$enable_system_auth" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile auth module system" >&5
+-echo "${ECHO_T}  - NuAuth: compile auth module system" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile auth module system" >&5
++$as_echo "  - NuAuth: compile auth module system" >&6; }
+         fi
+         if test "${ldap}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile module ldap" >&5
+-echo "${ECHO_T}  - NuAuth: compile module ldap" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile module ldap" >&5
++$as_echo "  - NuAuth: compile module ldap" >&6; }
+         fi
+         if test "${enable_prelude_log}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile log module prelude" >&5
+-echo "${ECHO_T}  - NuAuth: compile log module prelude" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile log module prelude" >&5
++$as_echo "  - NuAuth: compile log module prelude" >&6; }
+         fi
+         if test "${enable_mysql_log}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile log module mysql" >&5
+-echo "${ECHO_T}  - NuAuth: compile log module mysql" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile log module mysql" >&5
++$as_echo "  - NuAuth: compile log module mysql" >&6; }
+         fi
+         if test "${enable_mysql_auth}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile authentication module mysql" >&5
+-echo "${ECHO_T}  - NuAuth: compile authentication module mysql" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile authentication module mysql" >&5
++$as_echo "  - NuAuth: compile authentication module mysql" >&6; }
+         fi
+         if test "${enable_pgsql_log}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile log module pgsql" >&5
+-echo "${ECHO_T}  - NuAuth: compile log module pgsql" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile log module pgsql" >&5
++$as_echo "  - NuAuth: compile log module pgsql" >&6; }
+         fi
+         if test "${enable_syslog_log}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile syslog log module" >&5
+-echo "${ECHO_T}  - NuAuth: compile syslog log module" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile syslog log module" >&5
++$as_echo "  - NuAuth: compile syslog log module" >&6; }
+         fi
+         if test "${enable_plaintext_auth}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile plaintext auth module" >&5
+-echo "${ECHO_T}  - NuAuth: compile plaintext auth module" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile plaintext auth module" >&5
++$as_echo "  - NuAuth: compile plaintext auth module" >&6; }
+         fi
+         if test "${enable_mark_group}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile mark group module" >&5
+-echo "${ECHO_T}  - NuAuth: compile mark group module" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile mark group module" >&5
++$as_echo "  - NuAuth: compile mark group module" >&6; }
+         fi
+         if test "${enable_mark_field}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile mark field module" >&5
+-echo "${ECHO_T}  - NuAuth: compile mark field module" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile mark field module" >&5
++$as_echo "  - NuAuth: compile mark field module" >&6; }
+         fi
+         if test "${enable_mark_flag}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuAuth: compile mark flag module" >&5
+-echo "${ECHO_T}  - NuAuth: compile mark flag module" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuAuth: compile mark flag module" >&5
++$as_echo "  - NuAuth: compile mark flag module" >&6; }
+         fi
+ fi
+ if test "${build_nufw}" = "yes"; then
+-        { echo "$as_me:$LINENO: result: * Compiling NuFW" >&5
+-echo "${ECHO_T}* Compiling NuFW" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: * Compiling NuFW" >&5
++$as_echo "* Compiling NuFW" >&6; }
+         if test "${have_conntrack}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuFW: libnetfilter_conntrack support" >&5
+-echo "${ECHO_T}  - NuFW: libnetfilter_conntrack support" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuFW: libnetfilter_conntrack support" >&5
++$as_echo "  - NuFW: libnetfilter_conntrack support" >&6; }
+         fi
+         if test "${have_nfqueue}" = "yes"; then
+-              { echo "$as_me:$LINENO: result:   - NuFW: libnetfilter_queue support" >&5
+-echo "${ECHO_T}  - NuFW: libnetfilter_queue support" >&6; }
++              { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuFW: libnetfilter_queue support" >&5
++$as_echo "  - NuFW: libnetfilter_queue support" >&6; }
+         else
+                 if test "${have_ipq}" = "yes"; then
+-                        { echo "$as_me:$LINENO: result:   - NuFW: libipq support" >&5
+-echo "${ECHO_T}  - NuFW: libipq support" >&6; }
++                        { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuFW: libipq support" >&5
++$as_echo "  - NuFW: libipq support" >&6; }
+                       if test "$enable_user_mark" = "yes"; then
+-                                { echo "$as_me:$LINENO: result:   - NuFW: User mark support" >&5
+-echo "${ECHO_T}  - NuFW: User mark support" >&6; }
++                                { $as_echo "$as_me:${as_lineno-$LINENO}: result:   - NuFW: User mark support" >&5
++$as_echo "  - NuFW: User mark support" >&6; }
+                       fi
+                 fi
+         fi
+ else
+     if test "${use_nfconntrack}" = "yes"; then
+-        { echo "$as_me:$LINENO: result: !!! WARNING !!! NuFW daemon WON'T be compiled: libnetfilter_queue not present" >&5
+-echo "${ECHO_T}!!! WARNING !!! NuFW daemon WON'T be compiled: libnetfilter_queue not present" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: !!! WARNING !!! NuFW daemon WON'T be compiled: libnetfilter_queue not present" >&5
++$as_echo "!!! WARNING !!! NuFW daemon WON'T be compiled: libnetfilter_queue not present" >&6; }
+     else
+-        { echo "$as_me:$LINENO: result: !!! WARNING !!! NuFW daemon WON'T be compiled: libipq not present" >&5
+-echo "${ECHO_T}!!! WARNING !!! NuFW daemon WON'T be compiled: libipq not present" >&6; }
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: !!! WARNING !!! NuFW daemon WON'T be compiled: libipq not present" >&5
++$as_echo "!!! WARNING !!! NuFW daemon WON'T be compiled: libipq not present" >&6; }
+     fi
+ fi
+ if test "${build_libnuclient}" = "yes"; then
+-      { echo "$as_me:$LINENO: result: * Compiling libnuclient" >&5
+-echo "${ECHO_T}* Compiling libnuclient" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: * Compiling libnuclient" >&5
++$as_echo "* Compiling libnuclient" >&6; }
+ fi
+ if test "${build_nutcpc}" = "yes"; then
+-      { echo "$as_me:$LINENO: result: * Compiling nutcpc" >&5
+-echo "${ECHO_T}* Compiling nutcpc" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: * Compiling nutcpc" >&5
++$as_echo "* Compiling nutcpc" >&6; }
+ fi
+ if test "${build_pam_nufw}" = "yes"; then
+-      { echo "$as_me:$LINENO: result: * Compiling pam_nufw" >&5
+-echo "${ECHO_T}* Compiling pam_nufw" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: * Compiling pam_nufw" >&5
++$as_echo "* Compiling pam_nufw" >&6; }
+ fi
+-{ echo "$as_me:$LINENO: result:
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
+ Now type 'make' and then 'sudo make install'" >&5
+-echo "${ECHO_T}
++$as_echo "
+ Now type 'make' and then 'sudo make install'" >&6; }
+--- nufw-2.2.21.orig/src/Makefile.in
++++ nufw-2.2.21/src/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -84,6 +84,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -96,9 +98,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -109,6 +108,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -117,6 +117,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -176,6 +177,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = doxygen.cfg doxygen.sh
+@@ -188,8 +190,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -295,7 +297,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nufw/Makefile.in
++++ nufw-2.2.21/src/nufw/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -111,6 +111,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -123,9 +125,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -136,6 +135,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -144,6 +144,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -203,6 +204,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @BUILD_NUFW_TRUE@AM_CPPFLAGS = -DLOCAL_STATE_DIR=\"$(localstatedir)\"  -DCONFIG_DIR=\"$(sysconfdir)\" -I$(top_srcdir)/src/include/
+@@ -226,8 +228,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -348,7 +350,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/include/config.h
++++ nufw-2.2.21/src/include/config.h
+@@ -1,6 +1,9 @@
+ /* src/include/config.h.  Generated from config.h.in by configure.  */
+ /* src/include/config.h.in.  Generated from configure.ac by autoheader.  */
++/* Define if building universal (internal helper macro) */
++/* #undef AC_APPLE_UNIVERSAL_BUILD */
++
+ /* Build nuauth_command */
+ #define BUILD_NUAUTH_COMMAND 1
+@@ -44,19 +47,19 @@
+ #define HAVE_LIBPTHREAD 1
+ /* ldap lib flag */
+-/* #undef HAVE_LIBRARY_LDAP */
++#define HAVE_LIBRARY_LDAP 1
+ /* mysql lib flag */
+-/* #undef HAVE_LIBRARY_MYSQLCLIENT */
++#define HAVE_LIBRARY_MYSQLCLIENT 1
+ /* pam lib flag */
+ #define HAVE_LIBRARY_PAM 1
+ /* pgsql lib flag */
+-/* #undef HAVE_LIBRARY_PQ */
++#define HAVE_LIBRARY_PQ 1
+ /* prelude library flag */
+-/* #undef HAVE_LIBRARY_PRELUDE */
++#define HAVE_LIBRARY_PRELUDE 1
+ /* SASL lib flag */
+ #define HAVE_LIBRARY_SASL2 1
+@@ -72,7 +75,7 @@
+ #define HAVE_MEMSET 1
+ /* Will compile mysql log module with ssl support */
+-/* #undef HAVE_MYSQL_SSL */
++#define HAVE_MYSQL_SSL 1
+ /* Define to 1 if you have the <netdb.h> header file. */
+ #define HAVE_NETDB_H 1
+@@ -84,7 +87,7 @@
+ #define HAVE_NEW_NFCT_API 1
+ /* Found iface resolution in nfnetlink and libnetfilter_queue */
+-/* #undef HAVE_NFQ_INDEV_NAME */
++#define HAVE_NFQ_INDEV_NAME 1
+ /* Found queue max length support in netfilter_queue */
+ #define HAVE_NFQ_SET_QUEUE_MAXLEN 1
+@@ -155,6 +158,9 @@
+ /* Define to the one symbol short name of this package. */
+ #define PACKAGE_TARNAME "nufw"
++/* Define to the home page for this package. */
++#define PACKAGE_URL ""
++
+ /* Define to the version of this package. */
+ #define PACKAGE_VERSION "2.2.21"
+@@ -168,14 +174,22 @@
+ #define USE_NFQUEUE 1
+ /* Will use UTF8 exchange */
+-/* #undef USE_UTF8 */
++#define USE_UTF8 1
+ /* Version number of package */
+ #define VERSION "2.2.21"
+-/* Define to 1 if your processor stores words with the most significant byte
+-   first (like Motorola and SPARC, unlike Intel and VAX). */
+-/* #undef WORDS_BIGENDIAN */
++/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
++   significant byte first (like Motorola and SPARC, unlike Intel). */
++#if defined AC_APPLE_UNIVERSAL_BUILD
++# if defined __BIG_ENDIAN__
++#  define WORDS_BIGENDIAN 1
++# endif
++#else
++# ifndef WORDS_BIGENDIAN
++/* #  undef WORDS_BIGENDIAN */
++# endif
++#endif
+ /* Define to __FUNCTION__ or "" if '__func__' does not conform to ANSI C. */
+ #define __PRELUDE_FUNC__ __func__
+--- nufw-2.2.21.orig/src/include/Makefile.in
++++ nufw-2.2.21/src/include/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -95,6 +95,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -107,9 +109,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -120,6 +119,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -128,6 +128,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -187,6 +188,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ noinst_LTLIBRARIES = libnufw.la
+@@ -205,8 +207,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -300,7 +302,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/include/config.h.in
++++ nufw-2.2.21/src/include/config.h.in
+@@ -1,5 +1,8 @@
+ /* src/include/config.h.in.  Generated from configure.ac by autoheader.  */
++/* Define if building universal (internal helper macro) */
++#undef AC_APPLE_UNIVERSAL_BUILD
++
+ /* Build nuauth_command */
+ #undef BUILD_NUAUTH_COMMAND
+@@ -154,6 +157,9 @@
+ /* Define to the one symbol short name of this package. */
+ #undef PACKAGE_TARNAME
++/* Define to the home page for this package. */
++#undef PACKAGE_URL
++
+ /* Define to the version of this package. */
+ #undef PACKAGE_VERSION
+@@ -172,9 +178,17 @@
+ /* Version number of package */
+ #undef VERSION
+-/* Define to 1 if your processor stores words with the most significant byte
+-   first (like Motorola and SPARC, unlike Intel and VAX). */
+-#undef WORDS_BIGENDIAN
++/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
++   significant byte first (like Motorola and SPARC, unlike Intel). */
++#if defined AC_APPLE_UNIVERSAL_BUILD
++# if defined __BIG_ENDIAN__
++#  define WORDS_BIGENDIAN 1
++# endif
++#else
++# ifndef WORDS_BIGENDIAN
++#  undef WORDS_BIGENDIAN
++# endif
++#endif
+ /* Define to __FUNCTION__ or "" if '__func__' does not conform to ANSI C. */
+ #undef __PRELUDE_FUNC__
+--- nufw-2.2.21.orig/src/clients/Makefile.in
++++ nufw-2.2.21/src/clients/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -84,6 +84,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -96,9 +98,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -109,6 +108,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -117,6 +117,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -176,6 +177,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = lib nutcpc pam_nufw
+@@ -186,8 +188,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -293,7 +295,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/clients/nutcpc/Makefile.in
++++ nufw-2.2.21/src/clients/nutcpc/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -98,6 +98,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -110,9 +112,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -123,6 +122,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -131,6 +131,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -190,6 +191,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @BUILD_NUTCPC_TRUE@EXTRA_DIST = valgrind.sh valgrind.supp 
+@@ -207,8 +209,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -318,7 +320,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/clients/pam_nufw/Makefile.in
++++ nufw-2.2.21/src/clients/pam_nufw/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -104,6 +104,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -116,9 +118,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -129,6 +128,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -137,6 +137,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -196,6 +197,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @BUILD_PAM_NUFW_TRUE@TITLE = pam_nufw
+@@ -214,8 +216,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -316,7 +318,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/clients/lib/Makefile.in
++++ nufw-2.2.21/src/clients/lib/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -125,6 +125,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -137,9 +139,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -150,6 +149,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -158,6 +158,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -217,6 +218,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @BUILD_LIBNUCLIENT_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -I$(top_srcdir)/src/include/
+@@ -242,8 +244,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -432,7 +434,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/clients/lib/tests/Makefile.in
++++ nufw-2.2.21/src/clients/lib/tests/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = dummy_client.c
+@@ -174,8 +176,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/src/nuauth/Makefile.in
++++ nufw-2.2.21/src/nuauth/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -119,6 +119,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -131,9 +133,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -144,6 +143,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -152,6 +152,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -211,6 +212,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = modules
+@@ -244,8 +246,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -442,7 +444,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -84,6 +84,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -96,9 +98,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -109,6 +108,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -117,6 +117,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -176,6 +177,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = ldap log_syslog log_script log_mysql log_pgsql plaintext system xml_defs \
+@@ -189,8 +191,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -296,7 +298,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/session_authtype/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/session_authtype/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -104,6 +104,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -116,9 +118,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -129,6 +128,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -137,6 +137,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -196,6 +197,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -212,8 +214,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -305,7 +307,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/mark_uid/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/mark_uid/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -104,6 +104,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -116,9 +118,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -129,6 +128,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -137,6 +137,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -196,6 +197,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -212,8 +214,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -305,7 +307,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/ipauth_guest/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/ipauth_guest/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -104,6 +104,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -116,9 +118,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -129,6 +128,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -137,6 +137,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -196,6 +197,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -212,8 +214,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -305,7 +307,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/log_mysql/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/log_mysql/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -110,6 +110,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -122,9 +124,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -135,6 +134,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -143,6 +143,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -202,6 +203,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_MYSQL_LOG_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -221,8 +223,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -333,7 +335,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/log_nuprelude/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/log_nuprelude/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -111,6 +111,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -123,9 +125,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -136,6 +135,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -144,6 +144,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -203,6 +204,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_PRELUDE_LOG_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -221,8 +223,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -333,7 +335,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/log_syslog/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/log_syslog/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -106,6 +106,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -118,9 +120,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -131,6 +130,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -139,6 +139,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -198,6 +199,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_SYSLOG_LOG_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -214,8 +216,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -309,7 +311,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/session_expire/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/session_expire/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -104,6 +104,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -116,9 +118,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -129,6 +128,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -137,6 +137,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -196,6 +197,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -212,8 +214,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -305,7 +307,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/plaintext/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/plaintext/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -112,6 +112,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -124,9 +126,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -137,6 +136,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -145,6 +145,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -204,6 +205,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_PLAINTEXT_AUTH_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -221,8 +223,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -333,7 +335,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/system/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/system/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -109,6 +109,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -121,9 +123,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -134,6 +133,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -142,6 +142,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -201,6 +202,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_SYSTEM_AUTH_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -218,8 +220,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -314,7 +316,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/log_pgsql/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/log_pgsql/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -110,6 +110,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -122,9 +124,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -135,6 +134,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -143,6 +143,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -202,6 +203,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_PGSQL_LOG_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -220,8 +222,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -332,7 +334,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/mark_group/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/mark_group/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -111,6 +111,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -123,9 +125,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -136,6 +135,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -144,6 +144,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -203,6 +204,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_MARK_GROUP_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -220,8 +222,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -332,7 +334,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/ldap/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/ldap/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -110,6 +110,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -122,9 +124,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -135,6 +134,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -143,6 +143,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -202,6 +203,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_LDAP_TRUE@AM_CPPFLAGS = -fPIC -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -220,8 +222,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -332,7 +334,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/auth_mysql/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/auth_mysql/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -111,6 +111,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -123,9 +125,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -136,6 +135,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -144,6 +144,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -203,6 +204,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_MYSQL_AUTH_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -224,8 +226,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -336,7 +338,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/x509_std/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/x509_std/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -108,6 +108,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -120,9 +122,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -133,6 +132,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -141,6 +141,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -200,6 +201,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -217,8 +219,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -327,7 +329,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/log_script/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/log_script/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -102,6 +102,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -114,9 +116,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -127,6 +126,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -135,6 +135,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -194,6 +195,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -210,8 +212,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -303,7 +305,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/xml_defs/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/xml_defs/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -108,6 +108,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -120,9 +122,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -133,6 +132,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -141,6 +141,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -200,6 +201,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -217,8 +219,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -327,7 +329,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/mark_flag/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/mark_flag/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -104,6 +104,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -116,9 +118,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -129,6 +128,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -137,6 +137,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -196,6 +197,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -212,8 +214,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -305,7 +307,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/src/nuauth/modules/mark_field/Makefile.in
++++ nufw-2.2.21/src/nuauth/modules/mark_field/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -111,6 +111,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -123,9 +125,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -136,6 +135,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -144,6 +144,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -203,6 +204,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @USE_MARK_FIELD_TRUE@AM_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" -DMODULE_DIR=\"$(libdir)\"
+@@ -220,8 +222,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -332,7 +334,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/python/Makefile.in
++++ nufw-2.2.21/python/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = test_nuclient.py nuclient/classes.py nuclient/func.py nuclient/__init__.py
+@@ -174,8 +176,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/scripts/Makefile.in
++++ nufw-2.2.21/scripts/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -84,6 +84,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -96,9 +98,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -109,6 +108,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -117,6 +117,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -176,6 +177,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = nuauth_command auth_mysql
+@@ -187,8 +189,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -294,7 +296,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/scripts/nuauth_command/Makefile.in
++++ nufw-2.2.21/scripts/nuauth_command/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -85,6 +85,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -97,9 +99,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -110,6 +109,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -118,6 +118,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -177,6 +178,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ @BUILD_NUAUTH_COMMAND_TRUE@SUBDIRS = scripts nuauth_command
+@@ -188,8 +190,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -295,7 +297,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/scripts/nuauth_command/nuauth_command/Makefile.in
++++ nufw-2.2.21/scripts/nuauth_command/nuauth_command/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = client.py command_dec.py __init__.py version.py
+@@ -174,8 +176,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/scripts/nuauth_command/scripts/Makefile.in
++++ nufw-2.2.21/scripts/nuauth_command/scripts/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ edit = sed \
+@@ -178,8 +180,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/scripts/auth_mysql/Makefile.in
++++ nufw-2.2.21/scripts/auth_mysql/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ PHP_FILES = authmysql/index.php authmysql/pages/authentication_error.php authmysql/pages/authentication.php authmysql/pages/authentication_success.php
+@@ -175,8 +177,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/conf/Makefile.in
++++ nufw-2.2.21/conf/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ CONFIG_FILES = acls.nufw mark_field.conf mark_group.conf nuaclgen.conf nuauth.conf nuclient.conf nutop.conf periods.xml users-plaintext.nufw
+@@ -179,8 +181,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/tests/Makefile.in
++++ nufw-2.2.21/tests/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -84,6 +84,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -96,9 +98,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -109,6 +108,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -117,6 +117,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -176,6 +177,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ SUBDIRS = inl_tests pki
+@@ -198,8 +200,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -305,7 +307,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/tests/pki/Makefile.in
++++ nufw-2.2.21/tests/pki/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = gen_certs.sh gen_config.sh gen_server_cnf.sh gen_user_cnf.sh
+@@ -183,8 +185,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/tests/inl_tests/Makefile.in
++++ nufw-2.2.21/tests/inl_tests/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -99,6 +99,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -111,9 +113,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -124,6 +123,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -132,6 +132,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -191,6 +192,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = \
+@@ -217,8 +219,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -312,7 +314,7 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
++        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+--- nufw-2.2.21.orig/debian/nutcpc.install
++++ nufw-2.2.21/debian/nutcpc.install
+@@ -0,0 +1 @@
++src/clients/nutcpc/.libs/nutcpc usr/bin
+--- nufw-2.2.21.orig/debian/nuauth.default
++++ nufw-2.2.21/debian/nuauth.default
+@@ -0,0 +1,10 @@
++#Change to "true" for Nufw to be started
++NUAUTH_START="true"
++
++#Add "v"s so nufw gets more verbose
++NUAUTH_VERBOSITY="vv"
++
++#User nuauth runs on. Change this to some entry existing in /etc/passwd
++NUAUTH_USER="nuauth"
++
++#EDIT /etc/nuauth/nuauth.conf for other options!
+--- nufw-2.2.21.orig/debian/nuauth.dirs
++++ nufw-2.2.21/debian/nuauth.dirs
+@@ -0,0 +1,5 @@
++etc/nufw/certs
++etc/default
++usr/sbin
++usr/share/nuauth
++var/run/nuauth
+--- nufw-2.2.21.orig/debian/nuauth.install
++++ nufw-2.2.21/debian/nuauth.install
+@@ -0,0 +1,43 @@
++conf/nuauth.conf etc/nufw
++conf/periods.xml etc/nufw
++conf/acls.nufw etc/nufw
++conf/users-plaintext.nufw etc/nufw
++src/nuauth/nuauth usr/sbin
++src/nuauth/modules/ldap/.libs/libldap.so usr/lib/nuauth/modules
++src/nuauth/modules/ldap/libldap.la usr/lib/nuauth/modules
++src/nuauth/modules/ldap/.libs/libldap.a usr/lib/nuauth/modules
++src/nuauth/modules/plaintext/.libs/libplaintext.so usr/lib/nuauth/modules
++src/nuauth/modules/plaintext/libplaintext.la usr/lib/nuauth/modules
++src/nuauth/modules/plaintext/.libs/libplaintext.a usr/lib/nuauth/modules
++src/nuauth/modules/system/.libs/libsystem.so usr/lib/nuauth/modules
++src/nuauth/modules/system/libsystem.la usr/lib/nuauth/modules
++src/nuauth/modules/system/.libs/libsystem.a usr/lib/nuauth/modules
++src/nuauth/modules/log_syslog/.libs/libsyslog.so usr/lib/nuauth/modules
++src/nuauth/modules/log_syslog/libsyslog.la usr/lib/nuauth/modules
++src/nuauth/modules/log_syslog/.libs/libsyslog.a usr/lib/nuauth/modules
++src/nuauth/modules/xml_defs/.libs/libxml_defs.so usr/lib/nuauth/modules
++src/nuauth/modules/xml_defs/.libs/libxml_defs.a usr/lib/nuauth/modules
++src/nuauth/modules/xml_defs/libxml_defs.la usr/lib/nuauth/modules
++src/nuauth/modules/x509_std/.libs/libx509_std.so usr/lib/nuauth/modules
++src/nuauth/modules/x509_std/.libs/libx509_std.a usr/lib/nuauth/modules
++src/nuauth/modules/x509_std/libx509_std.la usr/lib/nuauth/modules
++src/nuauth/modules/mark_uid/.libs/libmark_uid.so usr/lib/nuauth/modules
++src/nuauth/modules/mark_uid/.libs/libmark_uid.a usr/lib/nuauth/modules
++src/nuauth/modules/mark_uid/libmark_uid.la usr/lib/nuauth/modules
++src/nuauth/modules/mark_group/.libs/libmark_group.so usr/lib/nuauth/modules
++src/nuauth/modules/mark_group/.libs/libmark_group.a usr/lib/nuauth/modules
++src/nuauth/modules/mark_group/libmark_group.la usr/lib/nuauth/modules
++src/nuauth/modules/mark_field/.libs/libmark_field.so usr/lib/nuauth/modules
++src/nuauth/modules/mark_field/.libs/libmark_field.a usr/lib/nuauth/modules
++src/nuauth/modules/mark_field/libmark_field.la usr/lib/nuauth/modules
++src/nuauth/modules/mark_flag/.libs/libmark_flag.so usr/lib/nuauth/modules
++src/nuauth/modules/mark_flag/.libs/libmark_flag.a usr/lib/nuauth/modules
++src/nuauth/modules/mark_flag/libmark_flag.la usr/lib/nuauth/modules
++src/nuauth/modules/session_expire/.libs/libsession_expire.so usr/lib/nuauth/modules
++src/nuauth/modules/session_expire/.libs/libsession_expire.a usr/lib/nuauth/modules
++src/nuauth/modules/session_expire/libsession_expire.la usr/lib/nuauth/modules
++src/nuauth/modules/session_authtype/.libs/libsession_authtype.so usr/lib/nuauth/modules
++src/nuauth/modules/session_authtype/.libs/libsession_authtype.a usr/lib/nuauth/modules
++src/nuauth/modules/session_authtype/libsession_authtype.la usr/lib/nuauth/modules
++src/nuauth/modules/log_nuprelude/.libs/libnuprelude.so usr/lib/nuauth/modules
++src/nuauth/modules/log_nuprelude/.libs/libnuprelude.a usr/lib/nuauth/modules
+--- nufw-2.2.21.orig/debian/nuauth-log-mysql.docs
++++ nufw-2.2.21/debian/nuauth-log-mysql.docs
+@@ -0,0 +1,3 @@
++conf/nulog.ipv4.mysql.dump
++conf/nulog.ipv6.mysql.dump
++conf/nulog-v1-v2.mysql.dump
+--- nufw-2.2.21.orig/debian/nuauth-log-pgsql.install
++++ nufw-2.2.21/debian/nuauth-log-pgsql.install
+@@ -0,0 +1,3 @@
++src/nuauth/modules/log_pgsql/.libs/libpgsql.a  usr/lib/nuauth/modules
++src/nuauth/modules/log_pgsql/libpgsql.la  usr/lib/nuauth/modules
++src/nuauth/modules/log_pgsql/.libs/libpgsql.so  usr/lib/nuauth/modules
+--- nufw-2.2.21.orig/debian/nuauth-extra.install
++++ nufw-2.2.21/debian/nuauth-extra.install
+@@ -0,0 +1,9 @@
++src/nuauth/modules/ipauth_guest/.libs/libipauth_guest.so usr/lib/nuauth/modules
++src/nuauth/modules/ipauth_guest/libipauth_guest.la usr/lib/nuauth/modules
++src/nuauth/modules/ipauth_guest/.libs/libipauth_guest.a usr/lib/nuauth/modules
++src/nuauth/modules/auth_mysql/.libs/libauth_mysql.a usr/lib/nuauth/modules
++src/nuauth/modules/auth_mysql/libauth_mysql.la usr/lib/nuauth/modules
++src/nuauth/modules/auth_mysql/.libs/libauth_mysql.so usr/lib/nuauth/modules
++src/nuauth/modules/log_script/.libs/libscript.a usr/lib/nuauth/modules
++src/nuauth/modules/log_script/libscript.la usr/lib/nuauth/modules
++src/nuauth/modules/log_script/.libs/libscript.so usr/lib/nuauth/modules
+--- nufw-2.2.21.orig/debian/rules
++++ nufw-2.2.21/debian/rules
+@@ -0,0 +1,503 @@
++#!/usr/bin/make -f
++# -*- makefile -*-
++# Sample debian/rules that uses debhelper.
++# GNU copyright 1997 to 1999 by Joey Hess.
++
++# Uncomment this to turn on verbose mode.
++#export DH_VERBOSE=1
++maindir         = $(shell pwd)
++b               = $(shell pwd)/debian
++
++
++# These are used for cross-compiling and for saving the configure script
++# from having to guess our platform (since we know it already)
++DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
++DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
++
++
++CFLAGS = -Wall -g
++
++ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
++      CFLAGS += -O0
++else
++      CFLAGS += -O2
++endif
++ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
++      INSTALL_PROGRAM += -s
++endif
++
++# Which packages should we build?
++
++CONFIGURE       = CFLAGS='$(CFLAGS)' ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
++                      --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --localstatedir=/var \
++                      --sysconfdir=/etc/nufw/ --with-mysql-log --with-pgsql-log --with-system-auth --with-ldap \
++                      --with-utf8 --with-nfqueue --with-nfconntrack --without-fixedtimeout --enable-pam-nufw \
++                      --with-prelude-log --with-mysql-auth
++                      # --with-utf8 --with-nfqueue --with-nfconntrack --with-fixedtimeout #FIXME : THIS line should be used
++
++config.status: configure
++      dh_testdir
++      # Add here commands to configure the package.
++      CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
++              --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --localstatedir=/var \
++              --sysconfdir=/etc/nufw/ --with-mysql-log --with-pgsql-log --with-system-auth --with-ldap \
++              --with-nfqueue --with-nfconntrack --with-fixedtimeout --with-utf8 --enable-pam-nufw \
++              --with-prelude-log --with-mysql-auth
++
++build: build-stamp
++
++clean:
++      dh_testdir
++      dh_testroot
++      rm -f build-stamp
++      rm -f build-nufw build-nufw-stamp
++      rm -f config-nufw-stamp install-stamp
++
++      # Add here commands to clean up after the build process.
++      [ ! -f Makefile ] || $(MAKE) distclean
++      rm -f tests/pki/Makefile
++      -find scripts/nuauth_command/ -name '*.pyc' -exec rm {} \;
++      [ ! -d scripts/nuauth_command/build ] || rm -rf scripts/nuauth_command/build
++      [ ! -f scripts/nuauth_command/scripts/nuauth_command ] || rm -f scripts/nuauth_command/scripts/nuauth_command
++      rm -f tests/inl_tests/libnobuffer.so
++      rm -f config.log
++
++      dh_clean
++
++config-nufw: config-nufw-stamp
++config-nufw-stamp:
++      dh_testdir -a
++      @echo "Doing $@"
++      [ ! -f Makefile ] || make clean
++      $(CONFIGURE)
++      touch config-nufw-stamp
++
++build-nufw:build-nufw-stamp
++build-nufw-stamp: config-nufw-stamp
++      dh_testdir -a
++      @echo "Doing $@"
++      $(MAKE)
++      #$(MAKE) && \
++      #(cd src/nufw && mv nufw nufw.plain);
++      touch build-nufw-stamp
++
++build-stamp: build-nufw
++      @echo "--- Compiling"
++      dh_testdir
++      touch build-stamp
++
++binary-arch: build nufw nuauth libnuclient3 libnuclient-dev nutcpc nuauth-extra nuauth-log-mysql nuauth-log-pgsql libpam-nufw nuauth-utils
++
++nufw:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++#     dh_install -p$@ -P$(b)/$@
++#     rm debian/$@/usr/sbin/nufw
++      /usr/bin/install -m 755 src/nufw/nufw debian/nufw/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++      dh_installinit -p$@ -P$(b)/$@ -u"start 40 2 3 4 5 . stop 89 0 1 6 ."
++#     dh_installcron
++#     dh_installinfo
++      dh_installman -pnufw doc/nufw.8
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++
++libnuclient3:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++libnuclient-dev:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -L libnuclient3 -l debian/libnuclient3/usr/lib -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++libpam-nufw:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++      # remove local rpath (#495769)
++      chrpath -d $(CURDIR)/debian/libpam-nufw/lib/security/pam_nufw.so
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++nuauth:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      mkdir -p $(CURDIR)/debian/$@/etc/nufw/
++      dh_install -p$@
++      sed -e "sµ^#\? *nuauth_tls_key=.*µnuauth_tls_key=\"/etc/nufw/certs/nuauth-key.pem\"µ" \
++          -e "sµ^#\? *nuauth_tls_cert=.*µnuauth_tls_cert=\"/etc/nufw/certs/nuauth-cert.pem\"µ" \
++          -e "sµ^ *plaintext_aclfile=.*µplaintext_aclfile=\"/etc/nufw/acls.nufw\"µ" \
++          -e "sµ^ *plaintext_userfile=.*µplaintext_userfile=\"/etc/nufw/users-plaintext.nufw\"µ" \
++          -e "sµ^ *nuauth_user_check_module=.*µnuauth_user_check_module=\"system\"µ" \
++          -e "sµ^ *nuauth_tls_request_cert=.*µnuauth_tls_request_cert=1µ" \
++          -e "sµ^#\? *nuauth_tls_disable_nufw_fqdn_check=.*µnuauth_tls_disable_nufw_fqdn_check=1µ" \
++           < $(CURDIR)/conf/nuauth.conf >$(CURDIR)/debian/$@/etc/nufw/nuauth.conf
++      mv $(CURDIR)/debian/$@/etc/nufw/nuauth.conf $(CURDIR)/debian/$@/usr/share/nuauth/nuauth.conf
++      cp $(CURDIR)/conf/acls.nufw $(CURDIR)/debian/$@/etc/nufw/
++      cp $(CURDIR)/conf/users-plaintext.nufw $(CURDIR)/debian/$@/etc/nufw/
++      cp $(CURDIR)/conf/periods.xml $(CURDIR)/debian/$@/etc/nufw/
++      rmdir $(CURDIR)/debian/$@/var/run/nuauth
++      pwd
++#     dh_install -p$@ -P$(b)/$@
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_installinit -p$@ -P$(b)/$@ -u"start 40 2 3 4 5 . stop 89 0 1 6 ."
++      dh_installman -pnuauth doc/nuauth.8
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++nuauth-extra:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++nuauth-log-mysql:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++nuauth-log-pgsql:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++nuauth-utils:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installdebconf -p$@ -P$(b)/$@
++      cp $(CURDIR)/conf/nuaclgen.conf $(CURDIR)/debian/$@/etc/nufw/
++      cp $(CURDIR)/conf/nutop.conf $(CURDIR)/debian/$@/etc/nufw/
++      cp $(CURDIR)/scripts/nuaclgen $(CURDIR)/debian/$@/usr/bin
++      cp $(CURDIR)/scripts/nutop $(CURDIR)/debian/$@/usr/bin
++      cp $(CURDIR)/scripts/clean_conntrack.pl $(CURDIR)/debian/$@/usr/sbin
++      #make -C $(CURDIR)/scripts/nuauth_command install DESTDIR=$(CURDIR)/debian/$@/
++      cd $(CURDIR)/scripts/nuauth_command && ./setup.py install --no-compile \
++              --install-lib=$(CURDIR)/debian/$@/usr/share/python-support/nuauth_command \
++              --prefix=$(CURDIR)/debian/$@/usr
++      #find $(CURDIR)/debian/$@/ -name \*.pyc -exec rm -f {} \;
++      dh_python
++      dh_pysupport
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_installman -pnuauth-utils doc/nuaclgen.8
++      dh_installman -pnuauth-utils doc/nutop.8
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++nutcpc:
++      @echo "--- Building: $@"
++      dh_installdirs           -p$@ -P$(b)/$@
++      dh_testdir -p$@ -P$(b)/$@
++      dh_testroot -p$@ -P$(b)/$@
++      dh_installchangelogs -p$@ -P$(b)/$@ ChangeLog
++      dh_installdocs -p$@ -P$(b)/$@
++      dh_installexamples -p$@ -P$(b)/$@
++      dh_install -p$@
++#     rm debian/$@/usr/sbin/nufw
++#     dh_installmenu
++      dh_installman -pnutcpc doc/nutcpc.1
++      dh_installdebconf -p$@ -P$(b)/$@
++#     dh_installlogrotate
++#     dh_installemacsen
++#     dh_installpam
++#     dh_installmime
++#     dh_installcron
++#     dh_installinfo
++      dh_link -p$@ -P$(b)/$@
++      dh_strip -p$@ -P$(b)/$@
++      dh_compress -p$@ -P$(b)/$@
++      dh_fixperms -p$@ -P$(b)/$@
++#     dh_perl
++#     dh_python
++      dh_makeshlibs -p$@ -P$(b)/$@ -n
++      dh_installdeb -p$@ -P$(b)/$@
++      dh_shlibdeps -L libnuclient3 -l debian/libnuclient3/usr/lib -p$@ -P$(b)/$@
++      dh_gencontrol -p$@ -P$(b)/$@
++      dh_md5sums -p$@ -P$(b)/$@
++      dh_builddeb -p$@ -P$(b)/$@
++
++install: install-stamp
++install-stamp:
++      dh_testdir -a
++      @echo "Installing $@"
++      dh_testroot -a
++#     dh_clean -k -a
++#     dh_installdirs -a
++
++      # Add here commands to install the package into debian/nufw.
++      #$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/
++#default certificates
++#     cp $(CURDIR)/conf/certs/nufw-key.pem $(CURDIR)/debian/tmp/etc/nufw/certs
++#     cp $(CURDIR)/conf/certs/nufw-cert.pem $(CURDIR)/debian/tmp/etc/nufw/certs
++#     cp $(CURDIR)/conf/certs/nuauth-key.pem $(CURDIR)/debian/tmp/etc/nufw/certs
++#     cp $(CURDIR)/conf/certs/nuauth-cert.pem $(CURDIR)/debian/tmp/etc/nufw/certs
++
++#     cp $(CURDIR)/conf/nufw.init $(CURDIR)/debian/tmp/etc/init.d/nufw
++#     cp $(CURDIR)/conf/nuauth $(CURDIR)/debian/tmp/etc/init.d/nuauth
++#     chmod 755 $(CURDIR)/debian/tmp/etc/init.d/*
++#     ln -s $(CURDIR)/debian/tmp/usr/lib/nuauth $(CURDIR)/debian/tmp/usr/lib/nuauth
++      touch $(maindir)/install-stamp
++
++
++# Build architecture-independent files here.
++binary-indep: build install
++# We have nothing to do by default.
++
++# Build architecture-dependent files here.
++binary-arch: build install
++#     dh_testdir $(dhbuildpackages)
++#     dh_testroot $(dhbuildpackages)
++#     dh_installchangelogs $(dhbuildpackages) ChangeLog
++#     dh_installdocs $(dhbuildpackages)
++#     dh_installexamples $(dhbuildpackages)
++#     dh_install $(dhbuildpackages) --sourcedir=debian/tmp
++##    dh_installmenu
++#     dh_installdebconf $(dhbuildpackages)
++##    dh_installlogrotate
++##    dh_installemacsen
++##    dh_installpam
++##    dh_installmime
++#     dh_installinit $(dhbuildpackages) -u"start 40 2 3 4 5 . stop 89 0 1 6 ."
++##    dh_installcron
++##    dh_installinfo
++#     dh_installman -pnufw doc/nufw.1
++#     dh_installman -pnuauth doc/nuauth.1
++#     dh_installman -pnutcpc doc/nutcpc.1
++#     dh_installman -pnuauth-utils doc/nuaclgen.1
++#     dh_installman -pnuauth-utils doc/nutop.1
++#     dh_link $(dhbuildpackages)
++#     dh_strip $(dhbuildpackages)
++#     dh_compress $(dhbuildpackages)
++#     dh_fixperms $(dhbuildpackages)
++##    dh_perl
++##    dh_python
++#     dh_makeshlibs $(dhbuildpackages) -n
++#     dh_installdeb $(dhbuildpackages)
++#     dh_shlibdeps $(dhbuildpackages)
++#     dh_gencontrol $(dhbuildpackages)
++#     dh_md5sums $(dhbuildpackages)
++#     dh_builddeb $(dhbuildpackages)
++
++binary: binary-indep binary-arch
++.PHONY: build clean binary-indep binary-arch binary install
+--- nufw-2.2.21.orig/debian/copyright
++++ nufw-2.2.21/debian/copyright
+@@ -0,0 +1,29 @@
++This package was debianized by Vincent Deffontaines <vincent@gryzor.com> on
++Thu, 13 Nov 2003 13:03:54 +0100.
++
++It was downloaded from http://www.nufw.org
++
++Upstream Authors: Eric Leblond <eric@regit.org>
++                    Vincent Deffontaines <vincent@gryzor.com>
++
++Copyright (C) 2007-2008 INL
++
++NuFW is licensed under the GPLv2
++
++   This package 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; version 2 dated June, 1991.
++
++   This package 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 package; if not, write to the Free Software
++   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
++   MA 02110-1301, USA.
++
++On Debian GNU/Linux systems, the complete text of the GNU General
++Public License 2 can be found in `/usr/share/common-licenses/GPL-2'.
++
+--- nufw-2.2.21.orig/debian/README.Debian
++++ nufw-2.2.21/debian/README.Debian
+@@ -0,0 +1,54 @@
++TLS and certificates
++--------------------
++
++By default, NuFW requires a valid certificate authority, and valid certificates to
++be installed on all components (especially for nuauth and nufw).
++See http://nufw.org/docs/handbook22.html#hardening for details.
++
++To make the installation easier, the Debian package uses the non-strict mode
++by default.
++
++The following modifications have been done (revert them to use strict mode):
++
++In file /etc/default/nufw, change ::
++
++ NUFW_OPTIONS=""
++
++to ::
++
++ NUFW_OPTIONS="-s"
++
++In file /etc/nufw/nuauth.conf, change ::
++
++ nuauth_tls_request_cert=2
++ # nuauth_tls_disable_nufw_fqdn_check=0
++
++to ::
++
++ nuauth_tls_request_cert=1
++ nuauth_tls_disable_nufw_fqdn_check=1
++
++
++Documentation
++-------------
++
++NuFW handbook (containing the installation guide, and more information) can
++be found at:
++
++http://nufw.org/docs/handbook22.html
++
++PDF version: http://nufw.org/docs/handbook22.pdf
++
++The handbook is not packaged in Debian due to the license (Creative
++Commons by-nc-sa 3.0).
++
++An installation guide for Debian can be found at:
++http://software.inl.fr/trac/wiki/nufw_install_debian
++
++
++More links:
++Documentation, links, forums, etc.:
++  http://software.inl.fr/trac/wiki/EdenWall/NuFW
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 25 Nov 2008 11:45:25 +0100
++
+--- nufw-2.2.21.orig/debian/libnuclient3.postinst
++++ nufw-2.2.21/debian/libnuclient3.postinst
+@@ -0,0 +1,19 @@
++#!/bin/sh
++
++set -e
++
++# dh_installdeb will replace this with shell code automatically
++# generated by other debhelper scripts.
++
++case "$1" in
++    configure)
++
++      ldconfig
++
++    ;;
++esac
++
++#DEBHELPER#
++
++exit 0
++
+--- nufw-2.2.21.orig/debian/nuauth-log-mysql.install
++++ nufw-2.2.21/debian/nuauth-log-mysql.install
+@@ -0,0 +1,3 @@
++src/nuauth/modules/log_mysql/.libs/libmysql.a usr/lib/nuauth/modules
++src/nuauth/modules/log_mysql/libmysql.la usr/lib/nuauth/modules
++src/nuauth/modules/log_mysql/.libs/libmysql.so usr/lib/nuauth/modules
+--- nufw-2.2.21.orig/debian/nuauth.postinst
++++ nufw-2.2.21/debian/nuauth.postinst
+@@ -0,0 +1,72 @@
++#!/bin/sh
++CONFIGFILE1=/etc/default/nuauth
++CONFIGFILE2=/etc/nufw/nuauth.conf
++set -e
++. /usr/share/debconf/confmodule
++
++grepconf () {
++        w="   " # space tab
++        sq=/etc/nufw/nuauth.conf
++        # sed is cool.
++        res=`sed -ne '
++                s/^\s*'$1'\s*=\s*"\?\([^"]*\)\"$/\1/p;
++                t end;
++                d;
++                :end q' < $sq`
++        [ -n "$res" ] || res=$2
++        echo "$res"
++}
++
++grepdefault () {
++        w="   " # space tab
++        sq=/etc/default/nuauth
++        # sed is cool.
++        res=`sed -ne '
++                s/^\s*'$1'\s*=\s*"\?\([^"]*\)\"$/\1/p;
++                t end;
++                d;
++                :end q' < $sq`
++        [ -n "$res" ] || res=$2
++        echo "$res"
++}
++
++# Installing the config
++ucf --three-way --debconf-ok /usr/share/nuauth/nuauth.conf /etc/nufw/nuauth.conf
++
++NUAUTH_USER=`grepdefault NUAUTH_USER nobody`
++nuauth_tls_key=`grepconf nuauth_tls_key /etc/nufw/certs/nuauth-key.pem`
++nuauth_tls_cert=`grepconf nuauth_tls_cert /etc/nufw/certs/nuauth-cert.pem`
++
++if grep -q -e "^$NUAUTH_USER:" /etc/passwd
++then
++  chown $NUAUTH_USER /var/run/nuauth/
++else
++  echo "FATAL : User \"$NUAUTH_USER\" does not exist, but is supposed to run nuath"
++  exit -1
++fi
++
++
++# ssl certificate generation
++if [ -x /usr/bin/openssl ]; then
++  if [ ! -e $nuauth_tls_key ]; then
++
++    make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/nufw/certs/nuauth.pem
++
++    if [ -f /etc/nufw/certs/nuauth.pem ]; then
++      # split key and certificate data
++      openssl x509 -in /etc/nufw/certs/nuauth.pem -out $nuauth_tls_cert
++      openssl rsa  -in /etc/nufw/certs/nuauth.pem -out $nuauth_tls_key
++      chmod 0600 $nuauth_tls_key
++      chown $NUAUTH_USER $nuauth_tls_key
++      rm -f /etc/nufw/certs/nuauth.pem
++      find /etc/nufw/certs -type l -maxdepth 1 -delete
++    fi
++
++  fi
++fi
++
++db_stop
++
++#DEBHELPER#
++
++exit 0
+--- nufw-2.2.21.orig/debian/nuauth-utils.install
++++ nufw-2.2.21/debian/nuauth-utils.install
+@@ -0,0 +1,5 @@
++conf/nuaclgen.conf etc/nufw
++conf/nutop.conf etc/nufw
++scripts/nuaclgen usr/bin
++scripts/nutop usr/bin
++scripts/clean_conntrack.pl usr/sbin
+--- nufw-2.2.21.orig/debian/control
++++ nufw-2.2.21/debian/control
+@@ -0,0 +1,186 @@
++Source: nufw
++Section: net
++Priority: optional
++XS-Python-Version: all
++Maintainer: Pierre Chifflier <pollux@debian.org>
++Build-Depends: debhelper (>= 5), po-debconf, automake1.9,
++               libldap2-dev, libglib2.0-dev,
++               libmysqlclient-dev | libmysqlclient15-dev,
++               libpq-dev,
++               iptables-dev,
++               libtool,
++               libgnutls-dev|libgnutls11-dev, libsasl2-dev,
++               libpam0g-dev,
++               libprelude-dev,
++               libnetfilter-conntrack-dev, libnetfilter-queue-dev, libnfnetlink-dev,
++               python-support (>= 0.4), python-dev,
++               pkg-config,
++               chrpath
++Standards-Version: 3.8.2
++Homepage: http://www.nufw.org/-English-.html
++
++Package: nufw
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, debconf (>= 1.3.22), ssl-cert, openssl
++Suggests: ulogd, ulogd-mysql
++Description: The authenticating firewall [NFQUEUE daemon]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ NuFW can:
++  * Act as a traditional firewall
++  * Add user identity to the list of parameters used to write firewall rules
++  * Authenticate any connection or protocol
++  * Perform accounting, routing and quality of service based on users
++  * Filter packets with criteria such as application and OS
++  * Log all traffic in SQL with username and application information
++  * Be the key of a secure and simple Single Sign On system.
++ .
++ This package provides the daemon receiving packets through the NFQUEUE
++ netfilter rule. Informations about those packets are forwarded to the
++ nuauth daemon, which decides if packets should be accepted or denied,
++ sends back the information to Nufw that applies decisions.
++
++Package: nuauth
++Architecture: any
++Pre-Depends: passwd, adduser
++Depends: ${shlibs:Depends}, ${misc:Depends}, debconf (>= 1.3.22), ucf, libsasl2-modules, ssl-cert, openssl
++Recommends: nuauth-utils
++Description: The authenticating firewall [authentication daemon]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ NuFW can:
++  * Act as a traditional firewall
++  * Add user identity to the list of parameters used to write firewall rules
++  * Authenticate any connection or protocol
++  * Perform accounting, routing and quality of service based on users
++  * Filter packets with criteria such as application and OS
++  * Log all traffic in SQL with username and application information
++  * Be the key of a secure and simple Single Sign On system.
++ .
++ This package provides the authentication daemon, which uses a user database
++ (though PAM modules) and an ACL database (which can be a LDAP directory,
++ or XML/DBM files, etc.).
++ Nuauth handles both client authentication, taking decisions on requests
++ sent by the nufw daemon to accept packets or not, and sending decision
++ to the nufw daemon.
++
++Package: nuauth-extra
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, nuauth
++Recommends: nuauth-utils
++Description: The authenticating firewall [extra modules]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ Nuauth-extra provides extra modules for nuauth, such as the ipauth_guest
++ and auth_mysql modules.
++
++Package: nuauth-log-mysql
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, nuauth
++Recommends: nuauth-utils
++Description: The authenticating firewall [MySQL log module]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ This package adds support for nuauth logging users activity into a MySQL
++ database. You can use this for an SSO solution, too.
++
++Package: nuauth-log-pgsql
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, nuauth
++Recommends: nuauth-utils
++Description: The authenticating firewall [PostgreSQL log module]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ This package adds support for nuauth logging users activity into a PostgreSQL
++ database. You can use this for an SSO solution, too.
++
++Package: nutcpc
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, libnuclient3 (= ${binary:Version})
++Description: The authenticating firewall [client]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ nutcpc is a console-mode client for the NUFW authenticating firewall.
++ It is in charge of authenticating the user, and replying to nuauth requests
++ to send information on network connections.
++
++Package: nuauth-utils
++Architecture: all
++Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}, python-ipy, perl, libnet-ldap-perl, nuauth
++XB-Python-Version: ${python:Versions}
++Description: The authenticating firewall [tools for admin]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ nuaclgen is a perl script that helps generate LDAP ACLs for use with nuauth,
++ the nufw authentication daemon. nuauth_command is a Python script to control
++ the nuauth daemon.
++
++Package: libnuclient3
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, libsasl2-modules
++Replaces: libnuclient
++Conflicts: libnuclient
++Description: The authenticating firewall [client library]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ This library provides the library for nufw clients.
++
++Package: libnuclient-dev
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, libsasl2-dev, libgnutls-dev|libgnutls11-dev, libnuclient3 (= ${binary:Version})
++Section: libdevel
++Description: The authenticating firewall [client development files]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ This library provides files needed to develop a NuFW client.
++
++Package: libpam-nufw
++Architecture: any
++Depends: ${shlibs:Depends}, ${misc:Depends}, libnuclient3 (= ${binary:Version})
++Description: The authenticating firewall [PAM module]
++ NuFW is an authenticating firewall based on netfilter's NFQUEUE target.
++ It allows to write filtering rules based on user identity, in addition 
++ to classical network criteria. Unless other solutions, NuFW uses a
++ strict security model and can apply different access rules to users
++ connected on the same host, for example.
++ .
++ This packages contains a PAM module to transparently authenticate to the NuFW
++ authentication daemon. It uses the login and password to start a NuFW client,
++ for the duration of the session.
++
+--- nufw-2.2.21.orig/debian/nufw.install
++++ nufw-2.2.21/debian/nufw.install
+@@ -0,0 +1 @@
++usr/sbin/nufw
+--- nufw-2.2.21.orig/debian/nutcpc.dirs
++++ nufw-2.2.21/debian/nutcpc.dirs
+@@ -0,0 +1 @@
++usr/bin
+--- nufw-2.2.21.orig/debian/nuauth-log-pgsql.docs
++++ nufw-2.2.21/debian/nuauth-log-pgsql.docs
+@@ -0,0 +1 @@
++conf/nulog.pgsql.dump
+--- nufw-2.2.21.orig/debian/nufw.default
++++ nufw-2.2.21/debian/nufw.default
+@@ -0,0 +1,26 @@
++#Change to "true" for Nufw to be started
++NUFW_START="true"
++
++#Add "v"s so nufw gets more verbose
++NUFW_VERBOSITY="vv"
++
++#Address of the nuauth server
++#NUFW_NUAUTH_ADDRESS="127.0.0.1"
++
++#UDP port the nuauth server listens on
++#NUFW_NUAUTH_PORT=4128
++
++#Timeout to forget about packets when there's no match (seconds)
++#NUFW_TIMEOUT=15
++
++#Track Size
++#NUFW_TRACK_SIZE=1000
++
++#SSL certificates and keys
++NUFW_SSL_CERTIFICATE="/etc/nufw/certs/nufw-cert.pem"
++NUFW_SSL_KEY="/etc/nufw/certs/nufw-key.pem"
++
++# Additional options
++# For ex., add -s here to disable TLS strict checking mode
++# See http://nufw.org/docs/handbook22.html#hardening
++NUFW_OPTIONS="-s"
+--- nufw-2.2.21.orig/debian/docs
++++ nufw-2.2.21/debian/docs
+@@ -0,0 +1,3 @@
++NEWS
++README
++TODO
+--- nufw-2.2.21.orig/debian/nufw.init
++++ nufw-2.2.21/debian/nufw.init
+@@ -0,0 +1,117 @@
++#! /bin/sh
++#
++#             Written by Miquel van Smoorenburg <miquels@cistron.nl>.
++#             Modified for Debian 
++#             by Ian Murdock <imurdock@gnu.ai.mit.edu>.
++#    Customized for nufw by Vincent Deffontaines <vincent@gryzor.com>
++#
++#
++
++### BEGIN INIT INFO
++# Provides:          nufw-nfqueue
++# Required-Start:    $syslog
++# Required-Stop:     $syslog
++# Should-Start:      $local_fs
++# Should-Stop:       $local_fs
++# Default-Start:     2 3 4 5
++# Default-Stop:      0 1 6
++# Short-Description: Control script for nufw
++# Description:       Init script to control (start/stop/reload)
++#                    the nufw server.
++### END INIT INFO
++
++PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
++DAEMON=/usr/sbin/nufw
++NAME=nufw
++PID=nufw
++DESC=nufw
++NUFW_START="false"
++
++
++test -x $DAEMON || exit 0
++
++NUFW_OPTIONS=""
++
++# Include nufw defaults if available
++if [ -f /etc/default/nufw ] ; then
++      . /etc/default/nufw
++fi
++
++if [ "$NUFW_START" != "true" ]; then
++  exit 0
++fi
++
++if [ -z "$NUFW_VERBOSITY" ]; then
++  NUFW_VERBOSITY="vv"
++fi
++
++if [ "$NUFW_NUAUTH_ADDRESS" != "" ]; then
++  NUFW_OPTIONS="$NUFW_OPTIONS -d $NUFW_NUAUTH_ADDRESS"
++fi
++
++if [ "$NUFW_NUAUTH_PORT" != "" ]; then
++  NUFW_OPTIONS="$NUFW_OPTIONS -p $NUFW_NUAUTH_PORT"
++fi
++
++if [ "$NUFW_TIMEOUT" != "" ]; then
++  NUFW_OPTIONS="$NUFW_OPTIONS -t $NUFW_TIMEOUT"
++fi
++
++if [ "$NUFW_TRACK_SIZE" != "" ]; then
++  NUFW_OPTIONS="$NUFW_OPTIONS -T $NUFW_TRACK_SIZE"
++fi
++
++DAEMON_OPTS="-D -$NUFW_VERBOSITY   \
++      $NUFW_OPTIONS \
++      -k $NUFW_SSL_KEY -c $NUFW_SSL_CERTIFICATE -C -M -m"
++
++set -e
++
++case "$1" in
++  start)
++      echo -n "Starting $DESC: "
++      start-stop-daemon --start --quiet --pidfile /var/run/$PID.pid \
++              --exec $DAEMON -- $DAEMON_OPTS
++      echo "$NAME."
++      ;;
++  stop)
++      echo -n "Stopping $DESC: "
++      start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/$PID.pid \
++              --retry 5 --exec $DAEMON
++      echo "$NAME."
++      ;;
++  #reload)
++      #
++      #       If the daemon can reload its config files on the fly
++      #       for example by sending it SIGHUP, do it here.
++      #
++      #       If the daemon responds to changes in its config file
++      #       directly anyway, make this a do-nothing entry.
++      #
++      # echo "Reloading $DESC configuration files."
++      # start-stop-daemon --stop --signal 1 --quiet --pidfile \
++      #       /var/run/$NAME.pid --exec $DAEMON
++  #;;
++  restart|force-reload)
++      #
++      #       If the "reload" option is implemented, move the "force-reload"
++      #       option to the "reload" entry above. If not, "force-reload" is
++      #       just the same as "restart".
++      #
++      echo -n "Restarting $DESC: "
++      start-stop-daemon --stop --quiet --oknodo --pidfile \
++              /var/run/$PID.pid --retry 5 --exec $DAEMON
++      sleep 1
++      start-stop-daemon --start --quiet --pidfile \
++              /var/run/$PID.pid --exec $DAEMON -- $DAEMON_OPTS
++      echo "$NAME."
++      ;;
++  *)
++      N=/etc/init.d/$NAME
++      # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
++      echo "Usage: $N {start|stop|restart|force-reload}" >&2
++      exit 1
++      ;;
++esac
++
++exit 0
+--- nufw-2.2.21.orig/debian/nuauth.postrm
++++ nufw-2.2.21/debian/nuauth.postrm
+@@ -0,0 +1,45 @@
++#! /bin/sh
++# postrm script for nuauth
++#
++# see: dh_installdeb(1)
++
++set -e
++
++# summary of how this script can be called:
++#        * <postrm> `remove'
++#        * <postrm> `purge'
++#        * <old-postrm> `upgrade' <new-version>
++#        * <new-postrm> `failed-upgrade' <old-version>
++#        * <new-postrm> `abort-install'
++#        * <new-postrm> `abort-install' <old-version>
++#        * <new-postrm> `abort-upgrade' <old-version>
++#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
++# for details, see /usr/doc/packaging-manual/
++
++case "$1" in
++       purge|disappear)
++              
++#             update-rc.d -f nuauth remove >/dev/null
++              userdel nuauth 2>/dev/null || true
++                for FILE in /etc/nufw/nuauth.conf; do
++                    # Taken from the ucf example postrm
++                    for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist .ucf-dist;  do
++                        rm -f $FILE$ext
++                    done
++                    rm -f $FILE
++                    if which ucf >/dev/null 2>&1; then
++                        ucf --purge $FILE
++                    fi
++                  done
++              ;;
++       remove|upgrade|failed-upgrade|abort-install|abort-upgrade)
++              # nothing
++              ;;
++esac
++
++# dh_installdeb will replace this with shell code automatically
++# generated by other debhelper scripts.
++
++#DEBHELPER#
++
++
+--- nufw-2.2.21.orig/debian/libpam-nufw.dirs
++++ nufw-2.2.21/debian/libpam-nufw.dirs
+@@ -0,0 +1 @@
++lib/security
+--- nufw-2.2.21.orig/debian/libnuclient3.install
++++ nufw-2.2.21/debian/libnuclient3.install
+@@ -0,0 +1,2 @@
++src/clients/lib/.libs/libnuclient.so.3.0.0 usr/lib
++src/clients/lib/.libs/libnuclient.so.3 usr/lib
+--- nufw-2.2.21.orig/debian/nuauth-extra.docs
++++ nufw-2.2.21/debian/nuauth-extra.docs
+@@ -0,0 +1,4 @@
++conf/auth_mysql/auth_mysql.ipv4.mysql.dump
++conf/auth_mysql/auth_mysql.ipv6.mysql.dump
++conf/auth_mysql/check_net.mysql
++scripts/auth_mysql/authmysql
+--- nufw-2.2.21.orig/debian/nuauth.preinst
++++ nufw-2.2.21/debian/nuauth.preinst
+@@ -0,0 +1,50 @@
++#!/bin/sh
++
++set -e
++
++# summary of how this script can be called:
++#        * <new-preinst> `install'
++#        * <new-preinst> `install' <old-version>
++#        * <new-preinst> `upgrade' <old-version>
++#        * <old-preinst> `abort-upgrade' <new-version>
++
++case "$1" in
++    install|upgrade)
++      # 1. create group if not existing
++      addgroup --quiet --system nuauth 2>/dev/null || true
++      # 2. create homedir if not existing
++      test -d /var/run/nuauth || mkdir -p /var/run/nuauth
++      # 3. create user if not existing
++      adduser --quiet \
++              --system \
++              --ingroup nuauth \
++              --no-create-home \
++              --disabled-password \
++              nuauth 2>/dev/null || true
++      # 4. adjust passwd entry
++      usermod -c "Nuauth for NuFW" \
++              -d /var/run/nuauth \
++              -g nuauth \
++              nuauth  
++      # 5. adjust file and directory permissions
++      chown -R nuauth:nuauth /var/run/nuauth
++      chmod u=rwx,g=rx,o= /var/run/nuauth
++    ;;
++    configure)
++    ;;
++    abort-upgrade)
++    ;;
++    *)
++        echo "preinst called with unknown argument \`$1'" >&2
++        exit 0
++    ;;
++esac
++
++# dh_installdeb will replace this with shell code automatically
++# generated by other debhelper scripts.
++
++#DEBHELPER#
++
++exit 0
++
++
+--- nufw-2.2.21.orig/debian/compat
++++ nufw-2.2.21/debian/compat
+@@ -0,0 +1 @@
++5
+--- nufw-2.2.21.orig/debian/watch
++++ nufw-2.2.21/debian/watch
+@@ -0,0 +1,11 @@
++# debian watch file
++# You can run the "uscan" command
++# to check for upstream updates and more.
++# See uscan(1) for format
++
++# Compulsory line, this is a version 3 file
++version=3
++
++#http://nufw.org/download/nufw/nufw-2.2.3.tar.gz
++http://nufw.org/download/nufw/nufw-([0-9].*)\.tar\.gz
++
+--- nufw-2.2.21.orig/debian/nutcpc.docs
++++ nufw-2.2.21/debian/nutcpc.docs
+@@ -0,0 +1,3 @@
++NEWS
++README
++TODO
+--- nufw-2.2.21.orig/debian/libnuclient-dev.dirs
++++ nufw-2.2.21/debian/libnuclient-dev.dirs
+@@ -0,0 +1 @@
++usr/include/nuclient
+--- nufw-2.2.21.orig/debian/libpam-nufw.install
++++ nufw-2.2.21/debian/libpam-nufw.install
+@@ -0,0 +1 @@
++src/clients/pam_nufw/.libs/pam_nufw.so lib/security
+--- nufw-2.2.21.orig/debian/nuauth-log-mysql.dirs
++++ nufw-2.2.21/debian/nuauth-log-mysql.dirs
+@@ -0,0 +1 @@
++usr/lib
+--- nufw-2.2.21.orig/debian/nuauth.init
++++ nufw-2.2.21/debian/nuauth.init
+@@ -0,0 +1,107 @@
++#! /bin/sh
++#
++#             Written by Miquel van Smoorenburg <miquels@cistron.nl>.
++#             Modified for Debian 
++#             by Ian Murdock <imurdock@gnu.ai.mit.edu>.
++#    Customized for nuauth by Vincent Deffontaines <vincent@gryzor.com>
++#
++#
++
++### BEGIN INIT INFO
++# Provides:          nuauth
++# Required-Start:    $syslog
++# Required-Stop:     $syslog
++# Should-Start:      $local_fs
++# Should-Stop:       $local_fs
++# Default-Start:     2 3 4 5
++# Default-Stop:      0 1 6
++# Short-Description: Control script for nuauth
++# Description:       Init script to control (start/stop/reload)
++#                    the nuauth server.
++### END INIT INFO
++
++PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
++DAEMON=/usr/sbin/nuauth
++PID=nuauth
++NAME=nuauth
++DESC=nuauth
++NUAUTH_START="no"
++
++
++test -x $DAEMON || exit 0
++
++# Include nuauth defaults if available
++if [ -f /etc/default/nuauth ] ; then
++      . /etc/default/nuauth
++fi
++
++if [ "$NUAUTH_START" != "true" ]; then
++  exit 0
++fi
++
++if [ ! "$NUAUTH_VERBOSITY" ]; then
++  NUAUTH_VERBOSITY="vv"
++fi
++
++if [ ! "$NUAUTH_USER" ]; then
++  echo "No user configured to run nuauth... Trying \"nobody\" ..."
++  NUAUTH_USER="nobody"
++fi
++
++DAEMON_OPTS="-D -$NUAUTH_VERBOSITY"
++
++set -e
++
++case "$1" in
++  start)
++        # ubuntu wipes everything in /var/run at boot
++        if [ ! -d /var/run/nuauth ]; then
++                mkdir /var/run/nuauth
++                chown $NUAUTH_USER /var/run/nuauth
++        fi
++      echo -n "Starting $DESC: "
++      start-stop-daemon --start --quiet --pidfile /var/run/$PID/$PID.pid \
++              --chuid $NUAUTH_USER --exec $DAEMON -- $DAEMON_OPTS
++      echo "$NAME."
++      ;;
++  stop)
++      echo -n "Stopping $DESC: "
++      start-stop-daemon --stop --quiet  --oknodo --pidfile /var/run/$PID/$PID.pid \
++              --retry 5 --exec $DAEMON
++      echo "$NAME."
++      ;;
++  #reload)
++      #
++      #       If the daemon can reload its config files on the fly
++      #       for example by sending it SIGHUP, do it here.
++      #
++      #       If the daemon responds to changes in its config file
++      #       directly anyway, make this a do-nothing entry.
++      #
++      # echo "Reloading $DESC configuration files."
++      # start-stop-daemon --stop --signal 1 --quiet --pidfile \
++      #       /var/run/$NAME.pid --exec $DAEMON
++  #;;
++  restart|force-reload)
++      #
++      #       If the "reload" option is implemented, move the "force-reload"
++      #       option to the "reload" entry above. If not, "force-reload" is
++      #       just the same as "restart".
++      #
++      echo -n "Restarting $DESC: "
++      start-stop-daemon --stop --quiet --oknodo --pidfile \
++              /var/run/$PID/$PID.pid --retry 5 --exec $DAEMON
++      sleep 1
++      start-stop-daemon --start --quiet --pidfile /var/run/$PID/$PID.pid \
++                --chuid $NUAUTH_USER --exec $DAEMON -- $DAEMON_OPTS
++      echo "$NAME."
++      ;;
++  *)
++      N=/etc/init.d/$NAME
++      # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
++      echo "Usage: $N {start|stop|restart|force-reload}" >&2
++      exit 1
++      ;;
++esac
++
++exit 0
+--- nufw-2.2.21.orig/debian/nuauth-utils.dirs
++++ nufw-2.2.21/debian/nuauth-utils.dirs
+@@ -0,0 +1 @@
++etc/nufw
+--- nufw-2.2.21.orig/debian/nufw.dirs
++++ nufw-2.2.21/debian/nufw.dirs
+@@ -0,0 +1,2 @@
++etc/nufw/certs
++usr/sbin
+--- nufw-2.2.21.orig/debian/nuauth.docs
++++ nufw-2.2.21/debian/nuauth.docs
+@@ -0,0 +1,4 @@
++NEWS
++README
++TODO
++conf/acls.schema
+--- nufw-2.2.21.orig/debian/pycompat
++++ nufw-2.2.21/debian/pycompat
+@@ -0,0 +1 @@
++2
+--- nufw-2.2.21.orig/debian/nufw.postinst
++++ nufw-2.2.21/debian/nufw.postinst
+@@ -0,0 +1,31 @@
++#!/bin/sh
++CONFIGFILE=/etc/default/nufw
++
++set -e
++#set -x
++. /usr/share/debconf/confmodule
++
++# ssl certificate generation
++if [ -x /usr/bin/openssl ]; then
++  if [ ! -e /etc/nufw/certs/nufw-key.pem ]; then
++
++    make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/nufw/certs/nufw.pem
++
++    if [ -f /etc/nufw/certs/nufw.pem ]; then
++      # split key and certificate data
++      openssl x509 -in /etc/nufw/certs/nufw.pem -out /etc/nufw/certs/nufw-cert.pem
++      openssl rsa  -in /etc/nufw/certs/nufw.pem -out /etc/nufw/certs/nufw-key.pem
++      chmod 0600 /etc/nufw/certs/nufw-key.pem
++      rm -f /etc/nufw/certs/nufw.pem
++      find /etc/nufw/certs -type l -maxdepth 1 -delete
++    fi
++
++  fi
++fi
++
++db_stop
++
++
++#DEBHELPER#
++
++exit 0
+--- nufw-2.2.21.orig/debian/libnuclient-dev.install
++++ nufw-2.2.21/debian/libnuclient-dev.install
+@@ -0,0 +1,4 @@
++src/clients/lib/.libs/libnuclient.so usr/lib
++src/clients/lib/libnuclient.la usr/lib
++src/clients/lib/nuclient.h usr/include/nuclient
++src/include/nufw_source.h usr/include/nuclient
+--- nufw-2.2.21.orig/debian/changelog
++++ nufw-2.2.21/debian/changelog
+@@ -0,0 +1,560 @@
++nufw (2.2.21-4) unstable; urgency=high
++
++  * Fix FTBFS against gnutls26 >= 2.7.x (Closes: #529841)
++    This required to run autogen.sh
++  * Urgency high because of above bug
++  * Update dependency on libmysqlclient-dev
++  * Bump standards version to 3.8.2 (no changes)
++
++ -- Pierre Chifflier <pollux@debian.org>  Sat, 15 Aug 2009 16:33:32 +0200
++
++nufw (2.2.21-3) unstable; urgency=low
++
++  * Apply patch from Jérôme Soyer:
++  * Add more modules to nuauth:
++    - mark_field
++    - mark_flag
++    - session_authtype
++  * Add more modules to nuauth-extra:
++    - script
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 10 Mar 2009 15:34:07 +0100
++
++nufw (2.2.21-2) unstable; urgency=low
++
++  * Upload to unstable
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 25 Feb 2009 12:03:36 +0100
++
++nufw (2.2.21-1) experimental; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 04 Feb 2009 13:49:18 +0100
++
++nufw (2.2.20-2) experimental; urgency=low
++
++  * Add Homepage field (Closes: #511453)
++
++ -- Pierre Chifflier <pollux@debian.org>  Mon, 19 Jan 2009 11:08:20 +0100
++
++nufw (2.2.20-1) experimental; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 10 Dec 2008 13:36:54 +0100
++
++nufw (2.2.19-1) experimental; urgency=low
++
++  * New upstream release
++  * Upstream uses strict TLS checking mode by default. Use less
++    strict, but easier to use configuration (see README.Debian)
++
++ -- Pierre Chifflier <pollux@debian.org>  Fri, 05 Dec 2008 10:21:05 +0100
++
++nufw (2.2.15-3) unstable; urgency=low
++
++  * Rewrite certificate generation code to use make-ssl-cert (Closes: #497778)
++
++ -- Pierre Chifflier <pollux@debian.org>  Thu, 04 Sep 2008 13:49:00 +0200
++
++nufw (2.2.15-2) unstable; urgency=high
++
++  * Remove rpath to insecure location (Closes: #495769)
++  * urgency=high because of RC bug
++  * Add dependency on rpath
++  * Bump standards version (no changes)
++
++ -- Pierre Chifflier <pollux@debian.org>  Mon, 25 Aug 2008 11:42:20 +0200
++
++nufw (2.2.15-1) unstable; urgency=low
++
++  * New upstream release
++  * Rebuild with support for several python versions (Closes: #476238)
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 15 Apr 2008 15:54:47 +0200
++
++nufw (2.2.14-2) unstable; urgency=low
++
++  * Rebuild for python transition (Closes: #476173)
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 15 Apr 2008 09:16:45 +0200
++
++nufw (2.2.14-1) unstable; urgency=low
++
++  * New upstream release
++  * Debian directory is now separated from upstream
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 08 Apr 2008 15:15:58 +0200
++
++nufw (2.2.13-2) unstable; urgency=low
++
++  * Backport patch from upstream to fix build (error with inline functions)
++
++ -- Pierre Chifflier <pollux@debian.org>  Thu, 03 Apr 2008 11:50:15 +0200
++
++nufw (2.2.13-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 02 Apr 2008 12:12:11 +0200
++
++nufw (2.2.11-2) unstable; urgency=low
++
++  * Fix bashism in NuFW init script (Closes: #465013)
++  * Fix spelling in control (mysql -> MySQL)
++
++ -- Pierre Chifflier <pollux@debian.org>  Sun, 10 Feb 2008 18:22:09 +0100
++
++nufw (2.2.11-1) unstable; urgency=low
++
++  * New upstream release
++  * Bump standards version
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 09 Jan 2008 09:24:33 +0100
++
++nufw (2.2.10-2) unstable; urgency=low
++
++  * Add python-ipy to build-deps
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 05 Dec 2007 14:13:55 +0100
++
++nufw (2.2.10-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 05 Dec 2007 09:37:11 +0100
++
++nufw (2.2.9-3) unstable; urgency=low
++
++  * Change build order and tell dh_shlibdeps to search libs in correct dir ..
++
++ -- Pierre Chifflier <pollux@debian.org>  Fri, 30 Nov 2007 13:47:36 +0100
++
++nufw (2.2.9-2) unstable; urgency=low
++
++  * Tell dh_shlibdeps to use libnuclient3
++
++ -- Pierre Chifflier <pollux@debian.org>  Fri, 30 Nov 2007 12:01:34 +0100
++
++nufw (2.2.9-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Mon, 26 Nov 2007 12:17:37 +0100
++
++nufw (2.2.8-1) unstable; urgency=low
++
++  * New upstream release
++  * Create directory /var/run/nuauth in package
++  * Do not use --enable-debug, so it does not flood the log with debug
++    messages
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 13 Nov 2007 13:56:41 +0100
++
++nufw (2.2.7-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Mon, 29 Oct 2007 20:09:27 +0100
++
++nufw (2.2.6-3) unstable; urgency=low
++
++  * Enable Prelude module
++
++ -- Pierre Chifflier <pollux@debian.org>  Sun, 28 Oct 2007 09:36:37 +0100
++
++nufw (2.2.6-2) unstable; urgency=low
++
++  * Make libnuclient-dev depend on libnuclient3
++
++ -- Pierre Chifflier <pollux@debian.org>  Fri, 26 Oct 2007 17:53:04 +0200
++
++nufw (2.2.6-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 10 Oct 2007 11:57:28 +0200
++
++nufw (2.2.5-2) unstable; urgency=low
++
++  * Add binary package libnuclient-dev
++
++ -- Pierre Chifflier <pollux@debian.org>  Wed, 12 Sep 2007 21:41:39 +0200
++
++nufw (2.2.5-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Pierre Chifflier <pollux@debian.org>  Tue, 11 Sep 2007 16:05:35 +0200
++
++nufw (2.2.4-1) unstable; urgency=low
++
++  * New upstream release
++  * Add nuauth-command script to nuauth-utils
++  * Use python-support for nuauth-utils
++  * Update nuauth-utils dependencies
++
++ -- Pierre Chifflier <pollux@debian.org>  Mon, 20 Aug 2007 23:18:37 +0200
++
++nufw (2.2.3-2) unstable; urgency=low
++
++  * Fix init script (Closes: #436958)
++  * Move system files to nuauth (Closes: #427973)
++  * Add --retry to really wait for script exit
++
++ -- Pierre Chifflier <pollux@debian.org>  Mon, 13 Aug 2007 15:14:06 +0200
++
++nufw (2.2.3-1) unstable; urgency=low
++
++  * New upstream release
++  * Add watch file
++  * Update my mail address
++
++ -- Pierre Chifflier <pollux@debian.org>  Sun, 05 Aug 2007 22:28:35 +0200
++
++nufw (2.2.2-2) unstable; urgency=low
++
++  * Also move system backend to nuauth (Closes: #427973)
++
++ -- Pierre Chifflier <chifflier@inl.fr>  Wed, 04 Jul 2007 11:30:30 +0200
++
++nufw (2.2.2-1) unstable; urgency=medium
++
++  * New upstream release
++    + restore compatibility with 2.0 versions
++    + not compatible with 2.2.1
++  * Do not include plaintext files in nuauth-extra (Closes: #427973)
++  * Urgency=medium because of RC bug
++
++ -- Pierre Chifflier <chifflier@inl.fr>  Tue, 26 Jun 2007 16:48:15 +0200
++
++nufw (2.2.1-1) unstable; urgency=low
++
++  * New upstream release
++  * Change build dependency from postgresql-dev to libpq-dev
++
++ -- Pierre Chifflier <chifflier@inl.fr>  Mon, 18 Jun 2007 11:22:34 +0200
++
++nufw (2.2.0-3) unstable; urgency=high
++
++  * Move module plaintext to nuauth (Closes: #427973)
++  * Urgency=high because of RC bug
++  * Remove dependency on libnuclient3, now correctly detected by dh_shlibdeps
++
++ -- Pierre Chifflier <chifflier@inl.fr>  Fri, 08 Jun 2007 11:36:36 +0200
++
++nufw (2.2.0-2) unstable; urgency=high
++
++  * Conficts/Replaces package libnuclient (Closes: #427611)
++  * Urgency=high because of RC bug
++
++ -- Pierre Chifflier <chifflier@inl.fr>  Tue, 05 Jun 2007 14:44:13 +0200
++
++nufw (2.2.0-1) unstable; urgency=low
++
++  * New upstream release
++  * Complete rewrite of the package
++  * Remove templates (Closes: #414507, #420931, #361428)
++  * Set nuauth-utils arch to all (Closes: #419923)
++  * Set myself as Maintainer, with Jean-Michel's agreement
++  * Update libnuclient files location
++  * Update copyright file
++  * Update dependencies on debconf
++  * Spell check packages descriptions
++  * Add LSB sections to init scripts
++  * Remove dependencies on libnetfilter*, detected by dh_shlibdeps
++  * Rename libnuclient to libnuclient3
++  * Remove debconf stuff, not needed
++  * Use ucf for nuauth.conf
++
++ -- Pierre Chifflier <chifflier@inl.fr>  Tue, 29 May 2007 09:26:17 +0200
++
++nufw (2.0.16-1) unstable; urgency=low
++
++  * New upstream release (Closes: #411515)
++  * Ack NMU (Closes: #378385)
++  * Add myself to Uploaders
++  * Bump Standards version to 3.7.2
++  * Add LSB sections to init scripts
++  * Update depends on debconf
++  * Change libpam-nufw description to be less than 80 characters
++  * Change dependency to libpq-dev (Closes: #409768)
++  * Update Czech template (Closes: #412697)
++
++ -- Pierre Chifflier <chifflier@cpe.fr>  Fri, 16 Mar 2007 16:24:56 +0100
++
++nufw (2.0.9-5.2) unstable; urgency=high
++
++  * Non-maintainer upload.
++  * Added nauth: missing pre-dep on passwd (Closes: #408269)
++    - added pre-dep on adduser too, since it uses adduser in preinst
++  * Urgency high due RCness
++
++ -- Bastian Venthur <venthur@debian.org>  Thu,  1 Feb 2007 11:54:30 +0100
++
++nufw (2.0.9-5.1) unstable; urgency=low
++
++  * Non-maintainer upload to fix longstanding l10n issues
++  * Add debconf-updatepo to the clean target in debian/rules
++    Closes: #349839
++  * add the nufw20.templates and nuauth20.templates files to
++    debian/po/POTFILES.in so that these files are translated too
++  * General rewrite of the debconf templates in a desperate attempt to
++    have them DevRef compliant, remove untranslatable strings and,
++    unfortunately, drive translators crazy. Closes: #361423
++  * Fix typo in the package description. Closes: #390090
++  * Lintian fixes:
++    - Remove redundant declaration of conffiles in /etc. Closes: #356772
++  * Debconf translation updates:
++    - French updated
++    - Czech updated. Closes: #345142
++    - Swedish updated. Closes: #347608
++    - German added. Sent during the call for updates for the NMU campaign.
++    - Russian added. Sent during the call for updates for the NMU campaign.
++
++ -- Christian Perrier <bubulle@debian.org>  Sun,  3 Dec 2006 12:14:00 +0100
++
++nufw (2.0.9-5) unstable; urgency=low
++
++  * One more patch for compilation on hppa.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Sat,  2 Dec 2006 12:31:12 +0100
++
++nufw (2.0.9-4) unstable; urgency=low
++
++  * Apply a patch provided by upstream to compile on hppa. This time it should
++    work !
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Tue, 28 Nov 2006 21:12:17 +0100
++
++nufw
++(2.0.9-3) unstable; urgency=low
++
++  * Apply a patch provided by upstream to compile on hppa.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Thu,  9 Nov 2006 21:41:03 +0100
++
++nufw (2.0.9-2) unstable; urgency=low
++
++  * Change copyright file to not include the entire GPL.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Wed,  1 Nov 2006 20:04:30 +0100
++
++nufw (2.0.9-1) unstable; urgency=low
++
++  * New upstream release.
++  * Adapt packaging to version 2.
++  * Many thanks to Vincent Deffontaines for its packaging.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Mon,  9 Oct 2006 21:58:20 +0200
++
++nufw (1.0.23-1.1) unstable; urgency=high
++
++  * Non-maintainer upload.
++  * Unbreak syntactically wrong debconf template, which caused problems
++    during package installation. (Closes: #360581)
++
++ -- Steinar H. Gunderson <sesse@debian.org>  Sun, 16 Jul 2006 00:02:00 +0200
++
++nufw (1.0.23-1) unstable; urgency=low
++
++  * New upstream release
++  * Update debconf configuration to take care of new options.
++  * Upgrade build depends to libmysqlclient15-dev
++  (closes: #356719)
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Thu, 30 Mar 2006 21:01:38 +0200
++
++nufw (1.0.16-1) unstable; urgency=low
++
++  * New upstream release. This is a security release. The NuFW team has
++    identified a problem that could lead to Denial of Service from legitimate
++    users of the authentication service.
++    This has been assigned CVE-2005-3950.
++  (closes: #341544)
++  * Add debconf-updatepo in debian/rules.
++  (closes: #329942)
++  * Add debconf-2.0 as an alternate to debconf.
++  (closes: #332049)
++  * Use gnutls12 instead of gnutls11.
++  (closes: #335769)
++  * Update the French translation for debconf.
++  (closes: #332575)
++  * Add the Swedish translation for debconf.
++  (closes: #336780)
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Tue, 27 Dec 2005 17:04:58 +0100
++
++nufw (1.0.13-1) unstable; urgency=low
++
++  * New upstream release
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Sun, 16 Oct 2005 18:12:39 +0200
++
++nufw (1.0.11-1) unstable; urgency=low
++
++  * Add the Vietnamese translation for debconf.
++  (closes: #316322)
++  * Add the French translation for debconf.
++  (closes: #307763)
++  * Add the Czech translation for debconf.
++  (closes: #310700)
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Fri,  2 Sep 2005 22:02:12 +0200
++
++nufw (1.0.10-1) stable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Mon,  4 Jul 2005 11:32:01 +0200
++
++nufw (1.0.8-1) unstable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Fri, 10 Jun 2005 15:46:35 +0200
++
++nufw (1.0.7-1) unstable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Wed,  8 Jun 2005 09:46:42 +0200
++
++nufw (1.0.6-1) unstable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Thu,  2 Jun 2005 21:56:16 +0200
++
++nufw (1.0.5-1) unstable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Thu, 12 May 2005 12:20:42 +0200
++
++nufw (1.0.3-1) unstable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Wed, 20 Apr 2005 09:17:25 +0200
++
++nufw (1.0.2-1) unstable; urgency=low
++
++  * new upstream release
++
++ -- Eric Leblond <regit@inl.fr>  Tue, 29 Mar 2005 07:16:56 +0200
++
++nufw (1.0.1-1) unstable; urgency=low
++
++  * New upstream release.
++
++ -- Eric Leblond <eric@inl.fr>  Tue, 15 Mar 2005 23:22:12 +0100
++
++nufw (1.0-1) unstable; urgency=low
++
++  * New upstream release.
++  * Add --with-system-auth to configure in debian/rules to support PAM+NSS
++    authentication.
++  * Add --with-ldap to support LDAP directory for users and acl lookup.
++  * Add --with-gdbm to support gdbm users lookup.
++  * Add --with-ident to support support ident users authentication.
++  * Add libgcrypt11-dev, libgnutls11-dev, libident-dev, libpam-dev to
++    Build-Depends.
++  * Add postrm and preinst for nuauth.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Tue, 22 Feb 2005 22:53:22 +0100
++
++nufw (0.8.5-3) unstable; urgency=low
++
++  * Change debian/copyright to reflect changes made by upstreams to the
++    license.
++  * Initial upload in Debian. Thanks to Vincent Deffontaines for packaging the
++    package before me.
++  (closes: #258746)
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Mon, 20 Dec 2004 22:23:16 +0100
++
++nufw (0.8.5-1) unstable; urgency=low
++
++  * New upstream release.
++  * Upstream add an exception to the GPL which allows linking with OpenSSL.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Wed,  1 Sep 2004 23:03:10 +0200
++
++nufw (0.8.2-1) unstable; urgency=low
++
++  * Update Description in debian/control. Thanks to Brandon Robinson.
++  * Switch to gettext for the debconf templates.
++  * Change the way of packaging.
++  * Correct minor policy violations.
++
++ -- Jean-Michel Kelbert <kelbert@debian.org>  Fri, 30 Jul 2004 13:41:25 +0200
++
++nufw (0.8.1-1) unstable; urgency=low
++
++  * New upstream version. Adds a paquet for libnuclient, the client
++  authentication library.
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Mon,  19 Jul 2004 21:23:13 +0200
++
++nufw (0.8.0-1) unstable; urgency=low
++
++  * New upstream version. Adds the strict logs update option, together with
++    some scaling bugfix, that would cause nuauth to grow heavily on some
++    particular [DoS] conditions.
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Mon,  5 Jul 2004 21:23:13 +0200
++
++nufw (0.7.1-1) unstable; urgency=low
++
++  * New upstream version. Fixes some bug that would rarely memleak nuauth.
++    Adds the SQL sync option.
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Fri, 11 Jun 2004 18:08:19 +0200
++
++nufw (0.7.0-1) unstable; urgency=low
++
++  * New upstream version. 0.7.0 is the first release with SSL connections all
++    the way.
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Tue, 30 Mar 2004 21:18:37 +0200
++
++nufw (0.6.5-1) unstable; urgency=low
++
++  * New upstream version
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Sun, 14 Mar 2004 18:52:38 +0100
++
++nufw (0.6.4-1) unstable; urgency=low
++
++  * New upstream version
++  * Splitted debian nuauth packages into 3, so that modules support is ...
++    modular
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Wed,  7 Jan 2004 23:49:34 +0100
++
++nufw (0.6.3-1) unstable; urgency=low
++
++  * Nesw upstream version
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Wed,  7 Jan 2004 00:33:47 +0100
++
++nufw (0.6.2-1) unstable; urgency=low
++
++  * Upstream changed to 0.6.2
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Sun,  4 Jan 2004 23:42:57 +0100
++
++nufw (0.6.1-1) unstable; urgency=low
++
++  * Upstream changed to 0.6.1
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Mon, 22 Dec 2003 15:55:24 +0100
++
++nufw (0.5.4-1) unstable; urgency=low
++
++  * Initial Release.
++
++ -- Vincent Deffontaines <vincent@gryzor.com>  Thu, 13 Nov 2003 13:03:54 +0100
++
+--- nufw-2.2.21.orig/debian/nuauth-log-pgsql.dirs
++++ nufw-2.2.21/debian/nuauth-log-pgsql.dirs
+@@ -0,0 +1 @@
++usr/lib
+--- nufw-2.2.21.orig/selinux/Makefile.in
++++ nufw-2.2.21/selinux/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -72,6 +72,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -84,9 +86,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -97,6 +96,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -105,6 +105,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -164,6 +165,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = nuauth.fc nuauth.if nuauth.te nufw.fc nufw.if nufw.te README.selinux
+@@ -176,8 +178,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+--- nufw-2.2.21.orig/doc/Makefile.in
++++ nufw-2.2.21/doc/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10.2 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+@@ -80,6 +80,8 @@
+ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+ GLIB_LIBS = @GLIB_LIBS@
+ GLIB_MKENUMS = @GLIB_MKENUMS@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
+ GOBJECT_QUERY = @GOBJECT_QUERY@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+@@ -92,9 +94,6 @@
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+-LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
+-LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
+-LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+@@ -105,6 +104,7 @@
+ MKDIR_P = @MKDIR_P@
+ NM = @NM@
+ NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OTOOL = @OTOOL@
+ OTOOL64 = @OTOOL64@
+@@ -113,6 +113,7 @@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PKG_CONFIG = @PKG_CONFIG@
+@@ -172,6 +173,7 @@
+ srcdir = @srcdir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ man_MANS = nuaclgen.8 nuauth.8 nufw.8 nutcpc.1 nutop.8 libnuclient.3 nuclient.conf.5
+@@ -191,8 +193,8 @@
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+-            cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+-              && exit 0; \
++            ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++              && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+@@ -233,8 +235,8 @@
+         esac; \
+       done; \
+       for i in $$list; do \
+-        if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+-        else file=$$i; fi; \
++        if test -f $$i; then file=$$i; \
++        else file=$(srcdir)/$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           1*) ;; \
+@@ -278,8 +280,8 @@
+         esac; \
+       done; \
+       for i in $$list; do \
+-        if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+-        else file=$$i; fi; \
++        if test -f $$i; then file=$$i; \
++        else file=$(srcdir)/$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           3*) ;; \
+@@ -323,8 +325,8 @@
+         esac; \
+       done; \
+       for i in $$list; do \
+-        if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+-        else file=$$i; fi; \
++        if test -f $$i; then file=$$i; \
++        else file=$(srcdir)/$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           5*) ;; \
+@@ -368,8 +370,8 @@
+         esac; \
+       done; \
+       for i in $$list; do \
+-        if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+-        else file=$$i; fi; \
++        if test -f $$i; then file=$$i; \
++        else file=$(srcdir)/$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           8*) ;; \
diff --git a/net/nuttcp/Makefile b/net/nuttcp/Makefile
new file mode 100644 (file)
index 0000000..cbdbc7d
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 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:=nuttcp
+PKG_VERSION:=6.1.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.lcp.nrl.navy.mil/pub/nuttcp
+PKG_MD5SUM:=a16d4d6d5def02cea980e57feaf30500
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nuttcp/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Network performance measurement tool
+  URL:=http://lcp.nrl.navy.mil/nuttcp/nuttcp.html
+endef
+
+define Package/nuttcp/Default/description
+  nuttcp is a network performance measurement tool intended for use by network
+  and system managers. Its most basic usage is to determine the raw TCP (or UDP)
+  network layer throughput by transferring memory buffers from a source system
+  across an interconnecting network to a destination system, either transferring
+  data for a specified time interval, or alternatively transferring a specified
+  number of bytes. In addition to reporting the achieved network throughput in
+  Mbps, nuttcp also provides additional useful information related to the data
+  transfer such as user, system, and wall-clock time, transmitter and receiver
+  CPU utilization, and loss percentage (for UDP transfers).
+endef
+
+define Package/nuttcp
+  $(call Package/nuttcp/Default)
+endef
+
+define Package/nuttcp/description
+  $(call Package/nuttcp/Default/description)
+endef
+
+define Package/nuttcp-xinetd
+  $(call Package/nuttcp/Default)
+  TITLE+= xinetd service files
+  DEPENDS:=+nuttcp +xinetd
+endef
+
+define Package/nuttcp-xinetd/description
+  $(call Package/nuttcp/Default/description)
+  This package contains the nuttcp xinetd service files.
+endef
+
+MAKE_FLAGS += \
+       APP="nuttcp" \
+       OPT="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -Wall"
+
+define Package/nuttcp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nuttcp $(1)/usr/bin/
+endef
+
+define Package/nuttcp-xinetd/install
+       $(INSTALL_DIR) $(1)/etc/xinetd.d
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/xinetd.d/nuttcp* $(1)/etc/xinetd.d/
+       $(SED) 's,/local,,' $(1)/etc/xinetd.d/nuttcp*
+endef
+
+define Package/nuttcp-xinetd/conffiles
+/etc/xinetd.d/nuttcp
+/etc/xinetd.d/nuttcp4
+/etc/xinetd.d/nuttcp6
+endef
+
+$(eval $(call BuildPackage,nuttcp))
+$(eval $(call BuildPackage,nuttcp-xinetd))
diff --git a/net/nzbget/Makefile b/net/nzbget/Makefile
new file mode 100644 (file)
index 0000000..4ed25e9
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2009-2012 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:=nzbget
+PKG_VERSION:=0.8.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/nzbget
+PKG_MD5SUM:=c47f464fe988deeb4fc5381506c1fbe3
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_LDFLAGS+=-Wl,-rpath-link="$(STAGING_DIR)/usr/lib" -lcrypto -lsigc-2.0
+TARGET_CFLAGS += $(FPIC)
+
+define Package/nzbget
+  SUBMENU:=NNTP
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libxml2 +libpar2 +libopenssl +libpthread +libncurses
+  URL:=http://nzbget.sourceforge.net/
+  TITLE:=Binary newsgrabber for nzb-files
+  MAINTAINER:=Artur Wronowski <arteqw@gmail.com>
+endef
+
+define Package/nzbget/description
+A command-line client/server based binary newsgrabber for nzb-files.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-nls \
+       --with-tlslib=OpenSSL \
+       --with-libpar2-includes=$(STAGING_DIR)/usr/include/libpar2 \
+       --with-libpar2-libraries=$(STAGING_DIR)/usr/lib \
+       --with-libsigc-includes=$(STAGING_DIR)/usr/include/sigc++-2.0 \
+       --with-libsigc-libraries=$(STAGING_DIR)/usr/lib \
+       --with-openssl-includes=$(STAGING_DIR)/usr/include \
+       --with-openssl-libraries=$(STAGING_DIR)/usr/lib \
+       --with-libcurses-includes=$(STAGING_DIR)/usr/include \
+       --with-libcurses-libraries=$(STAGING_DIR)/usr/lib \
+       , \
+       PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig"
+
+CONFIGURE_VARS += \
+       ac_cv_header_regex_h=no \
+       CPPFLAGS="-I$(STAGING_DIR)/usr/include/libxml2 $$$$CPPFLAGS"
+
+define Package/nzbget/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nzbget $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/nzbget.conf.example $(1)/etc/nzbget.conf
+endef
+
+define Package/nzbget/conffiles
+/etc/nzbget.conf
+endef
+
+$(eval $(call BuildPackage,nzbget))
diff --git a/net/nzbget/patches/001-openssl-1.0.0-compat.patch b/net/nzbget/patches/001-openssl-1.0.0-compat.patch
new file mode 100644 (file)
index 0000000..04374ab
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/TLS.cpp
++++ b/TLS.cpp
+@@ -908,7 +908,7 @@ int tls_check_cert(tls_t *tls, const cha
+     char *buf;
+     int bufsize;
+     /* needed to get the DNS subjectAltNames: */
+-    STACK *subj_alt_names;
++    STACK_OF(GENERAL_NAME) *subj_alt_names;
+     int subj_alt_names_count;
+     GENERAL_NAME *subj_alt_name;
+     /* did we find a name matching hostname? */
+@@ -960,7 +960,7 @@ int tls_check_cert(tls_t *tls, const cha
+     /* Try the DNS subjectAltNames. */
+     match_found = 0;
+     if ((subj_alt_names =
+-              (STACK*)X509_get_ext_d2i(x509cert, NID_subject_alt_name, NULL, NULL)))
++              (STACK_OF(GENERAL_NAME) *)X509_get_ext_d2i(x509cert, NID_subject_alt_name, NULL, NULL)))
+     {
+       subj_alt_names_count = sk_GENERAL_NAME_num(subj_alt_names);
+       for (i = 0; i < subj_alt_names_count; i++) 
+@@ -1105,7 +1105,11 @@ int tls_init(tls_t *tls, const char *key
+ #ifdef HAVE_OPENSSL
+     
++    #if OPENSSL_VERSION_NUMBER >= 0x10000000L
++    const SSL_METHOD *ssl_method = NULL;
++    #else
+     SSL_METHOD *ssl_method = NULL;
++    #endif
+     
+     ssl_method = force_sslv3 ? SSLv3_client_method() : SSLv23_client_method();
+     if (!ssl_method)
diff --git a/net/nzbgetweb/Makefile b/net/nzbgetweb/Makefile
new file mode 100644 (file)
index 0000000..9e30178
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2009 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:=nzbgetweb
+PKG_VERSION:=1.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
+PKG_SOURCE_URL:=@SF/nzbget
+PKG_MD5SUM:=78ccce66f9df07ee69250ec79819c37c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/nzbgetweb
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nzbgetweb
+  SUBMENU:=NNTP
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+nzbget +php5 +php5-cgi +php5-mod-session +php5-mod-gd +php5-mod-xml +uhttpd
+  URL:=http://nzbget.sourceforge.net/
+  TITLE:=Web interface for nzbget
+  MAINTAINER:=Artur Wronowski <arteqw@gmail.com>
+endef
+
+define Package/nzbgetweb/description
+Web interface for nzbget.
+endef
+
+define Package/nzbgetweb/postinst
+#!/bin/sh      
+uci batch <<EOF
+set uhttpd.nzbgetweb=uhttpd
+set uhttpd.nzbgetweb.listen_http=0.0.0.0:8008
+set uhttpd.nzbgetweb.script_timeout=60
+set uhttpd.nzbgetweb.network_timeout=30
+set uhttpd.nzbgetweb.interpreter=.php=/usr/bin/php-cgi
+set uhttpd.nzbgetweb.home=/www/nzbgetweb
+set uhttpd.nzbgetweb.index_page=index.php
+commit uhttpd
+EOF
+/etc/init.d/uhttpd restart
+echo "Bind your browser to router IP with port 8008"
+endef
+
+define Build/Compile
+endef
+
+define Package/nzbgetweb/install
+       $(INSTALL_DIR) $(1)/www/nzbgetweb
+       $(CP) $(PKG_BUILD_DIR)/*.php $(1)/www/nzbgetweb/
+       $(CP) $(PKG_BUILD_DIR)/*.css $(1)/www/nzbgetweb/
+       $(CP) $(PKG_BUILD_DIR)/README $(1)/www/nzbgetweb/
+       $(CP) $(PKG_BUILD_DIR)/ChangeLog $(1)/www/nzbgetweb/
+       $(CP) $(PKG_BUILD_DIR)/images $(1)/www/nzbgetweb/
+       $(INSTALL_DIR) $(1)/www/nzbgetweb/lib
+       $(CP) ./files/lib $(1)/www/nzbgetweb/lib/
+endef
+
+$(eval $(call BuildPackage,nzbgetweb))
diff --git a/net/nzbgetweb/files/httpd.conf b/net/nzbgetweb/files/httpd.conf
new file mode 100644 (file)
index 0000000..90a3009
--- /dev/null
@@ -0,0 +1 @@
+*.php:/usr/bin/php-cgi
\ No newline at end of file
diff --git a/net/nzbgetweb/files/lib/xmlrpc.inc b/net/nzbgetweb/files/lib/xmlrpc.inc
new file mode 100644 (file)
index 0000000..b3658f0
--- /dev/null
@@ -0,0 +1,3776 @@
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <edd@usefulinc.com>
+// $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// 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 "XML-RPC for PHP" 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
+// REGENTS 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.
+
+       if(!function_exists('xml_parser_create'))
+       {
+               // For PHP 4 onward, XML functionality is always compiled-in on windows:
+               // no more need to dl-open it. It might have been compiled out on *nix...
+               if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
+               {
+                       dl('xml.so');
+               }
+       }
+
+       // G. Giunta 2005/01/29: declare global these variables,
+       // so that xmlrpc.inc will work even if included from within a function
+       // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
+       $GLOBALS['xmlrpcI4']='i4';
+       $GLOBALS['xmlrpcInt']='int';
+       $GLOBALS['xmlrpcBoolean']='boolean';
+       $GLOBALS['xmlrpcDouble']='double';
+       $GLOBALS['xmlrpcString']='string';
+       $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
+       $GLOBALS['xmlrpcBase64']='base64';
+       $GLOBALS['xmlrpcArray']='array';
+       $GLOBALS['xmlrpcStruct']='struct';
+       $GLOBALS['xmlrpcValue']='undefined';
+
+       $GLOBALS['xmlrpcTypes']=array(
+               $GLOBALS['xmlrpcI4']       => 1,
+               $GLOBALS['xmlrpcInt']      => 1,
+               $GLOBALS['xmlrpcBoolean']  => 1,
+               $GLOBALS['xmlrpcString']   => 1,
+               $GLOBALS['xmlrpcDouble']   => 1,
+               $GLOBALS['xmlrpcDateTime'] => 1,
+               $GLOBALS['xmlrpcBase64']   => 1,
+               $GLOBALS['xmlrpcArray']    => 2,
+               $GLOBALS['xmlrpcStruct']   => 3
+       );
+
+       $GLOBALS['xmlrpc_valid_parents'] = array(
+               'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'),
+               'BOOLEAN' => array('VALUE'),
+               'I4' => array('VALUE'),
+               'INT' => array('VALUE'),
+               'STRING' => array('VALUE'),
+               'DOUBLE' => array('VALUE'),
+               'DATETIME.ISO8601' => array('VALUE'),
+               'BASE64' => array('VALUE'),
+               'MEMBER' => array('STRUCT'),
+               'NAME' => array('MEMBER'),
+               'DATA' => array('ARRAY'),
+               'ARRAY' => array('VALUE'),
+               'STRUCT' => array('VALUE'),
+               'PARAM' => array('PARAMS'),
+               'METHODNAME' => array('METHODCALL'),
+               'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),
+               'FAULT' => array('METHODRESPONSE'),
+               'NIL' => array('VALUE'), // only used when extension activated
+               'EX:NIL' => array('VALUE') // only used when extension activated
+       );
+
+       // define extra types for supporting NULL (useful for json or <NIL/>)
+       $GLOBALS['xmlrpcNull']='null';
+       $GLOBALS['xmlrpcTypes']['null']=1;
+
+       // Not in use anymore since 2.0. Shall we remove it?
+       /// @deprecated
+       $GLOBALS['xmlEntities']=array(
+               'amp'  => '&',
+               'quot' => '"',
+               'lt'   => '<',
+               'gt'   => '>',
+               'apos' => "'"
+       );
+
+       // tables used for transcoding different charsets into us-ascii xml
+
+       $GLOBALS['xml_iso88591_Entities']=array();
+       $GLOBALS['xml_iso88591_Entities']['in'] = array();
+       $GLOBALS['xml_iso88591_Entities']['out'] = array();
+       for ($i = 0; $i < 32; $i++)
+       {
+               $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+               $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+       }
+       for ($i = 160; $i < 256; $i++)
+       {
+               $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
+               $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
+       }
+
+       /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159?
+       /// These will NOT be present in true ISO-8859-1, but will save the unwary
+       /// windows user from sending junk (though no luck when reciving them...)
+  /*
+       $GLOBALS['xml_cp1252_Entities']=array();
+       for ($i = 128; $i < 160; $i++)
+       {
+               $GLOBALS['xml_cp1252_Entities']['in'][] = chr($i);
+       }
+       $GLOBALS['xml_cp1252_Entities']['out'] = array(
+               '&#x20AC;', '?',        '&#x201A;', '&#x0192;',
+               '&#x201E;', '&#x2026;', '&#x2020;', '&#x2021;',
+               '&#x02C6;', '&#x2030;', '&#x0160;', '&#x2039;',
+               '&#x0152;', '?',        '&#x017D;', '?',
+               '?',        '&#x2018;', '&#x2019;', '&#x201C;',
+               '&#x201D;', '&#x2022;', '&#x2013;', '&#x2014;',
+               '&#x02DC;', '&#x2122;', '&#x0161;', '&#x203A;',
+               '&#x0153;', '?',        '&#x017E;', '&#x0178;'
+       );
+  */
+
+       $GLOBALS['xmlrpcerr'] = array(
+       'unknown_method'=>1,
+       'invalid_return'=>2,
+       'incorrect_params'=>3,
+       'introspect_unknown'=>4,
+       'http_error'=>5,
+       'no_data'=>6,
+       'no_ssl'=>7,
+       'curl_fail'=>8,
+       'invalid_request'=>15,
+       'no_curl'=>16,
+       'server_error'=>17,
+       'multicall_error'=>18,
+       'multicall_notstruct'=>9,
+       'multicall_nomethod'=>10,
+       'multicall_notstring'=>11,
+       'multicall_recursion'=>12,
+       'multicall_noparams'=>13,
+       'multicall_notarray'=>14,
+
+       'cannot_decompress'=>103,
+       'decompress_fail'=>104,
+       'dechunk_fail'=>105,
+       'server_cannot_decompress'=>106,
+       'server_decompress_fail'=>107
+       );
+
+       $GLOBALS['xmlrpcstr'] = array(
+       'unknown_method'=>'Unknown method',
+       'invalid_return'=>'Invalid return payload: enable debugging to examine incoming payload',
+       'incorrect_params'=>'Incorrect parameters passed to method',
+       'introspect_unknown'=>"Can't introspect: method unknown",
+       'http_error'=>"Didn't receive 200 OK from remote server.",
+       'no_data'=>'No data received from server.',
+       'no_ssl'=>'No SSL support compiled in.',
+       'curl_fail'=>'CURL error',
+       'invalid_request'=>'Invalid request payload',
+       'no_curl'=>'No CURL support compiled in.',
+       'server_error'=>'Internal server error',
+       'multicall_error'=>'Received from server invalid multicall response',
+       'multicall_notstruct'=>'system.multicall expected struct',
+       'multicall_nomethod'=>'missing methodName',
+       'multicall_notstring'=>'methodName is not a string',
+       'multicall_recursion'=>'recursive system.multicall forbidden',
+       'multicall_noparams'=>'missing params',
+       'multicall_notarray'=>'params is not an array',
+
+       'cannot_decompress'=>'Received from server compressed HTTP and cannot decompress',
+       'decompress_fail'=>'Received from server invalid compressed HTTP',
+       'dechunk_fail'=>'Received from server invalid chunked HTTP',
+       'server_cannot_decompress'=>'Received from client compressed HTTP request and cannot decompress',
+       'server_decompress_fail'=>'Received from client invalid compressed HTTP request'
+       );
+
+       // The charset encoding used by the server for received messages and
+       // by the client for received responses when received charset cannot be determined
+       // or is not supported
+       $GLOBALS['xmlrpc_defencoding']='UTF-8';
+
+       // The encoding used internally by PHP.
+       // String values received as xml will be converted to this, and php strings will be converted to xml
+       // as if having been coded with this
+       $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';
+
+       $GLOBALS['xmlrpcName']='XML-RPC for PHP';
+       $GLOBALS['xmlrpcVersion']='3.0.0.beta';
+
+       // let user errors start at 800
+       $GLOBALS['xmlrpcerruser']=800;
+       // let XML parse errors start at 100
+       $GLOBALS['xmlrpcerrxml']=100;
+
+       // formulate backslashes for escaping regexp
+       // Not in use anymore since 2.0. Shall we remove it?
+       /// @deprecated
+       $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
+
+       // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values
+       $GLOBALS['xmlrpc_null_extension']=false;
+
+       // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/>
+       $GLOBALS['xmlrpc_null_apache_encoding']=false;
+
+       // used to store state during parsing
+       // quick explanation of components:
+       //   ac - used to accumulate values
+       //   isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1)
+       //   isf_reason - used for storing xmlrpcresp fault string
+       //   lv - used to indicate "looking for a value": implements
+       //        the logic to allow values with no types to be strings
+       //   params - used to store parameters in method calls
+       //   method - used to store method name
+       //   stack - array with genealogy of xml elements names:
+       //           used to validate nesting of xmlrpc elements
+       $GLOBALS['_xh']=null;
+
+       /**
+       * Convert a string to the correct XML representation in a target charset
+       * To help correct communication of non-ascii chars inside strings, regardless
+       * of the charset used when sending requests, parsing them, sending responses
+       * and parsing responses, an option is to convert all non-ascii chars present in the message
+       * into their equivalent 'charset entity'. Charset entities enumerated this way
+       * are independent of the charset encoding used to transmit them, and all XML
+       * parsers are bound to understand them.
+       * Note that in the std case we are not sending a charset encoding mime type
+       * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
+       *
+       * @todo do a bit of basic benchmarking (strtr vs. str_replace)
+       * @todo make usage of iconv() or recode_string() or mb_string() where available
+       */
+       function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')
+       {
+               if ($src_encoding == '')
+               {
+                       // lame, but we know no better...
+                       $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
+               }
+
+               switch(strtoupper($src_encoding.'_'.$dest_encoding))
+               {
+                       case 'ISO-8859-1_':
+                       case 'ISO-8859-1_US-ASCII':
+                               $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
+                               break;
+                       case 'ISO-8859-1_UTF-8':
+                               $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               $escaped_data = utf8_encode($escaped_data);
+                               break;
+                       case 'ISO-8859-1_ISO-8859-1':
+                       case 'US-ASCII_US-ASCII':
+                       case 'US-ASCII_UTF-8':
+                       case 'US-ASCII_':
+                       case 'US-ASCII_ISO-8859-1':
+                       case 'UTF-8_UTF-8':
+                       //case 'CP1252_CP1252':
+                               $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               break;
+                       case 'UTF-8_':
+                       case 'UTF-8_US-ASCII':
+                       case 'UTF-8_ISO-8859-1':
+       // NB: this will choke on invalid UTF-8, going most likely beyond EOF
+       $escaped_data = '';
+       // be kind to users creating string xmlrpcvals out of different php types
+       $data = (string) $data;
+       $ns = strlen ($data);
+       for ($nn = 0; $nn < $ns; $nn++)
+       {
+               $ch = $data[$nn];
+               $ii = ord($ch);
+               //1 7 0bbbbbbb (127)
+               if ($ii < 128)
+               {
+                       /// @todo shall we replace this with a (supposedly) faster str_replace?
+                       switch($ii){
+                               case 34:
+                                       $escaped_data .= '&quot;';
+                                       break;
+                               case 38:
+                                       $escaped_data .= '&amp;';
+                                       break;
+                               case 39:
+                                       $escaped_data .= '&apos;';
+                                       break;
+                               case 60:
+                                       $escaped_data .= '&lt;';
+                                       break;
+                               case 62:
+                                       $escaped_data .= '&gt;';
+                                       break;
+                               default:
+                                       $escaped_data .= $ch;
+                       } // switch
+               }
+               //2 11 110bbbbb 10bbbbbb (2047)
+               else if ($ii>>5 == 6)
+               {
+                       $b1 = ($ii & 31);
+                       $ii = ord($data[$nn+1]);
+                       $b2 = ($ii & 63);
+                       $ii = ($b1 * 64) + $b2;
+                       $ent = sprintf ('&#%d;', $ii);
+                       $escaped_data .= $ent;
+                       $nn += 1;
+               }
+               //3 16 1110bbbb 10bbbbbb 10bbbbbb
+               else if ($ii>>4 == 14)
+               {
+                       $b1 = ($ii & 15);
+                       $ii = ord($data[$nn+1]);
+                       $b2 = ($ii & 63);
+                       $ii = ord($data[$nn+2]);
+                       $b3 = ($ii & 63);
+                       $ii = ((($b1 * 64) + $b2) * 64) + $b3;
+                       $ent = sprintf ('&#%d;', $ii);
+                       $escaped_data .= $ent;
+                       $nn += 2;
+               }
+               //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+               else if ($ii>>3 == 30)
+               {
+                       $b1 = ($ii & 7);
+                       $ii = ord($data[$nn+1]);
+                       $b2 = ($ii & 63);
+                       $ii = ord($data[$nn+2]);
+                       $b3 = ($ii & 63);
+                       $ii = ord($data[$nn+3]);
+                       $b4 = ($ii & 63);
+                       $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
+                       $ent = sprintf ('&#%d;', $ii);
+                       $escaped_data .= $ent;
+                       $nn += 3;
+               }
+       }
+                               break;
+/*
+                       case 'CP1252_':
+                       case 'CP1252_US-ASCII':
+                               $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
+                               $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
+                               break;
+                       case 'CP1252_UTF-8':
+                               $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               /// @todo we could use real UTF8 chars here instead of xml entities... (note that utf_8 encode all allone will NOT convert them)
+                               $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
+                               $escaped_data = utf8_encode($escaped_data);
+                               break;
+                       case 'CP1252_ISO-8859-1':
+                               $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
+                               // we might as well replave all funky chars with a '?' here, but we are kind and leave it to the receiving application layer to decide what to do with these weird entities...
+                               $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
+                               break;
+*/
+                       default:
+                               $escaped_data = '';
+                               error_log("Converting from $src_encoding to $dest_encoding: not supported...");
+               }
+               return $escaped_data;
+       }
+
+       /// xml parser handler function for opening element tags
+       function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)
+       {
+               // if invalid xmlrpc already detected, skip all processing
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       // check for correct element nesting
+                       // top level element can only be of 2 types
+                       /// @todo optimization creep: save this check into a bool variable, instead of using count() every time:
+                       ///       there is only a single top level element in xml anyway
+                       if (count($GLOBALS['_xh']['stack']) == 0)
+                       {
+                               if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && (
+                                       $name != 'VALUE' && !$accept_single_vals))
+                               {
+                                       $GLOBALS['_xh']['isf'] = 2;
+                                       $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
+                                       return;
+                               }
+                               else
+                               {
+                                       $GLOBALS['_xh']['rt'] = strtolower($name);
+                                       $GLOBALS['_xh']['rt'] = strtolower($name);
+                               }
+                       }
+                       else
+                       {
+                               // not top level element: see if parent is OK
+                               $parent = end($GLOBALS['_xh']['stack']);
+                               if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))
+                               {
+                                       $GLOBALS['_xh']['isf'] = 2;
+                                       $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
+                                       return;
+                               }
+                       }
+
+                       switch($name)
+                       {
+                               // optimize for speed switch cases: most common cases first
+                               case 'VALUE':
+                                       /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element
+                                       $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet
+                                       $GLOBALS['_xh']['ac']='';
+                                       $GLOBALS['_xh']['lv']=1;
+                                       $GLOBALS['_xh']['php_class']=null;
+                                       break;
+                               case 'I4':
+                               case 'INT':
+                               case 'STRING':
+                               case 'BOOLEAN':
+                               case 'DOUBLE':
+                               case 'DATETIME.ISO8601':
+                               case 'BASE64':
+                                       if ($GLOBALS['_xh']['vt']!='value')
+                                       {
+                                               //two data elements inside a value: an error occurred!
+                                               $GLOBALS['_xh']['isf'] = 2;
+                                               $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+                                               return;
+                                       }
+                                       $GLOBALS['_xh']['ac']=''; // reset the accumulator
+                                       break;
+                               case 'STRUCT':
+                               case 'ARRAY':
+                                       if ($GLOBALS['_xh']['vt']!='value')
+                                       {
+                                               //two data elements inside a value: an error occurred!
+                                               $GLOBALS['_xh']['isf'] = 2;
+                                               $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+                                               return;
+                                       }
+                                       // create an empty array to hold child values, and push it onto appropriate stack
+                                       $cur_val = array();
+                                       $cur_val['values'] = array();
+                                       $cur_val['type'] = $name;
+                                       // check for out-of-band information to rebuild php objs
+                                       // and in case it is found, save it
+                                       if (@isset($attrs['PHP_CLASS']))
+                                       {
+                                               $cur_val['php_class'] = $attrs['PHP_CLASS'];
+                                       }
+                                       $GLOBALS['_xh']['valuestack'][] = $cur_val;
+                                       $GLOBALS['_xh']['vt']='data'; // be prepared for a data element next
+                                       break;
+                               case 'DATA':
+                                       if ($GLOBALS['_xh']['vt']!='data')
+                                       {
+                                               //two data elements inside a value: an error occurred!
+                                               $GLOBALS['_xh']['isf'] = 2;
+                                               $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element";
+                                               return;
+                                       }
+                               case 'METHODCALL':
+                               case 'METHODRESPONSE':
+                               case 'PARAMS':
+                                       // valid elements that add little to processing
+                                       break;
+                               case 'METHODNAME':
+                               case 'NAME':
+                                       /// @todo we could check for 2 NAME elements inside a MEMBER element
+                                       $GLOBALS['_xh']['ac']='';
+                                       break;
+                               case 'FAULT':
+                                       $GLOBALS['_xh']['isf']=1;
+                                       break;
+                               case 'MEMBER':
+                                       $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on
+                                       //$GLOBALS['_xh']['ac']='';
+                                       // Drop trough intentionally
+                               case 'PARAM':
+                                       // clear value type, so we can check later if no value has been passed for this param/member
+                                       $GLOBALS['_xh']['vt']=null;
+                                       break;
+                               case 'NIL':
+                               case 'EX:NIL':
+                                       if ($GLOBALS['xmlrpc_null_extension'])
+                                       {
+                                               if ($GLOBALS['_xh']['vt']!='value')
+                                               {
+                                                       //two data elements inside a value: an error occurred!
+                                                       $GLOBALS['_xh']['isf'] = 2;
+                                                       $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
+                                                       return;
+                                               }
+                                               $GLOBALS['_xh']['ac']=''; // reset the accumulator
+                                               break;
+                                       }
+                                       // we do not support the <NIL/> extension, so
+                                       // drop through intentionally
+                               default:
+                                       /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!!
+                                       $GLOBALS['_xh']['isf'] = 2;
+                                       $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name";
+                                       break;
+                       }
+
+                       // Save current element name to stack, to validate nesting
+                       $GLOBALS['_xh']['stack'][] = $name;
+
+                       /// @todo optimization creep: move this inside the big switch() above
+                       if($name!='VALUE')
+                       {
+                               $GLOBALS['_xh']['lv']=0;
+                       }
+               }
+       }
+
+       /// Used in decoding xml chunks that might represent single xmlrpc values
+       function xmlrpc_se_any($parser, $name, $attrs)
+       {
+               xmlrpc_se($parser, $name, $attrs, true);
+       }
+
+       /// xml parser handler function for close element tags
+       function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
+       {
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       // push this element name from stack
+                       // NB: if XML validates, correct opening/closing is guaranteed and
+                       // we do not have to check for $name == $curr_elem.
+                       // we also checked for proper nesting at start of elements...
+                       $curr_elem = array_pop($GLOBALS['_xh']['stack']);
+
+                       switch($name)
+                       {
+                               case 'VALUE':
+                                       // This if() detects if no scalar was inside <VALUE></VALUE>
+                                       if ($GLOBALS['_xh']['vt']=='value')
+                                       {
+                                               $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+                                               $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
+                                       }
+
+                                       if ($rebuild_xmlrpcvals)
+                                       {
+                                               // build the xmlrpc val out of the data received, and substitute it
+                                               $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
+                                               // in case we got info about underlying php class, save it
+                                               // in the object we're rebuilding
+                                               if (isset($GLOBALS['_xh']['php_class']))
+                                                       $temp->_php_class = $GLOBALS['_xh']['php_class'];
+                                               // check if we are inside an array or struct:
+                                               // if value just built is inside an array, let's move it into array on the stack
+                                               $vscount = count($GLOBALS['_xh']['valuestack']);
+                                               if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+                                               {
+                                                       $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
+                                               }
+                                               else
+                                               {
+                                                       $GLOBALS['_xh']['value'] = $temp;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               /// @todo this needs to treat correctly php-serialized objects,
+                                               /// since std deserializing is done by php_xmlrpc_decode,
+                                               /// which we will not be calling...
+                                               if (isset($GLOBALS['_xh']['php_class']))
+                                               {
+                                               }
+
+                                               // check if we are inside an array or struct:
+                                               // if value just built is inside an array, let's move it into array on the stack
+                                               $vscount = count($GLOBALS['_xh']['valuestack']);
+                                               if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
+                                               {
+                                                       $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];
+                                               }
+                                       }
+                                       break;
+                               case 'BOOLEAN':
+                               case 'I4':
+                               case 'INT':
+                               case 'STRING':
+                               case 'DOUBLE':
+                               case 'DATETIME.ISO8601':
+                               case 'BASE64':
+                                       $GLOBALS['_xh']['vt']=strtolower($name);
+                                       /// @todo: optimization creep - remove the if/elseif cycle below
+                                       /// since the case() in which we are already did that
+                                       if ($name=='STRING')
+                                       {
+                                               $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+                                       }
+                                       elseif ($name=='DATETIME.ISO8601')
+                                       {
+                                               if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))
+                                               {
+                                                       error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']);
+                                               }
+                                               $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
+                                               $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
+                                       }
+                                       elseif ($name=='BASE64')
+                                       {
+                                               /// @todo check for failure of base64 decoding / catch warnings
+                                               $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
+                                       }
+                                       elseif ($name=='BOOLEAN')
+                                       {
+                                               // special case here: we translate boolean 1 or 0 into PHP
+                                               // constants true or false.
+                                               // Strings 'true' and 'false' are accepted, even though the
+                                               // spec never mentions them (see eg. Blogger api docs)
+                                               // NB: this simple checks helps a lot sanitizing input, ie no
+                                               // security problems around here
+                                               if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)
+                                               {
+                                                       $GLOBALS['_xh']['value']=true;
+                                               }
+                                               else
+                                               {
+                                                       // log if receiveing something strange, even though we set the value to false anyway
+                                                       if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0)
+                                                               error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
+                                                       $GLOBALS['_xh']['value']=false;
+                                               }
+                                       }
+                                       elseif ($name=='DOUBLE')
+                                       {
+                                               // we have a DOUBLE
+                                               // we must check that only 0123456789-.<space> are characters here
+                                               // NOTE: regexp could be much stricter than this...
+                                               if (!preg_match('/^[+-eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac']))
+                                               {
+                                                       /// @todo: find a better way of throwing an error than this!
+                                                       error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
+                                                       $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+                                               }
+                                               else
+                                               {
+                                                       // it's ok, add it on
+                                                       $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
+                                               }
+                                       }
+                                       else
+                                       {
+                                               // we have an I4/INT
+                                               // we must check that only 0123456789-<space> are characters here
+                                               if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac']))
+                                               {
+                                                       /// @todo find a better way of throwing an error than this!
+                                                       error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
+                                                       $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
+                                               }
+                                               else
+                                               {
+                                                       // it's ok, add it on
+                                                       $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
+                                               }
+                                       }
+                                       //$GLOBALS['_xh']['ac']=''; // is this necessary?
+                                       $GLOBALS['_xh']['lv']=3; // indicate we've found a value
+                                       break;
+                               case 'NAME':
+                                       $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];
+                                       break;
+                               case 'MEMBER':
+                                       //$GLOBALS['_xh']['ac']=''; // is this necessary?
+                                       // add to array in the stack the last element built,
+                                       // unless no VALUE was found
+                                       if ($GLOBALS['_xh']['vt'])
+                                       {
+                                               $vscount = count($GLOBALS['_xh']['valuestack']);
+                                               $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
+                                       } else
+                                               error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
+                                       break;
+                               case 'DATA':
+                                       //$GLOBALS['_xh']['ac']=''; // is this necessary?
+                                       $GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty
+                                       break;
+                               case 'STRUCT':
+                               case 'ARRAY':
+                                       // fetch out of stack array of values, and promote it to current value
+                                       $curr_val = array_pop($GLOBALS['_xh']['valuestack']);
+                                       $GLOBALS['_xh']['value'] = $curr_val['values'];
+                                       $GLOBALS['_xh']['vt']=strtolower($name);
+                                       if (isset($curr_val['php_class']))
+                                       {
+                                               $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
+                                       }
+                                       break;
+                               case 'PARAM':
+                                       // add to array of params the current value,
+                                       // unless no VALUE was found
+                                       if ($GLOBALS['_xh']['vt'])
+                                       {
+                                               $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
+                                               $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
+                                       }
+                                       else
+                                               error_log('XML-RPC: missing VALUE inside PARAM in received xml');
+                                       break;
+                               case 'METHODNAME':
+                                       $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);
+                                       break;
+                               case 'NIL':
+                               case 'EX:NIL':
+                                       if ($GLOBALS['xmlrpc_null_extension'])
+                                       {
+                                               $GLOBALS['_xh']['vt']='null';
+                                               $GLOBALS['_xh']['value']=null;
+                                               $GLOBALS['_xh']['lv']=3;
+                                               break;
+                                       }
+                                       // drop through intentionally if nil extension not enabled
+                               case 'PARAMS':
+                               case 'FAULT':
+                               case 'METHODCALL':
+                               case 'METHORESPONSE':
+                                       break;
+                               default:
+                                       // End of INVALID ELEMENT!
+                                       // shall we add an assert here for unreachable code???
+                                       break;
+                       }
+               }
+       }
+
+       /// Used in decoding xmlrpc requests/responses without rebuilding xmlrpc values
+       function xmlrpc_ee_fast($parser, $name)
+       {
+               xmlrpc_ee($parser, $name, false);
+       }
+
+       /// xml parser handler function for character data
+       function xmlrpc_cd($parser, $data)
+       {
+               // skip processing if xml fault already detected
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       // "lookforvalue==3" means that we've found an entire value
+                       // and should discard any further character data
+                       if($GLOBALS['_xh']['lv']!=3)
+                       {
+                               // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2
+                               //if($GLOBALS['_xh']['lv']==1)
+                               //{
+                                       // if we've found text and we're just in a <value> then
+                                       // say we've found a value
+                                       //$GLOBALS['_xh']['lv']=2;
+                               //}
+                               // we always initialize the accumulator before starting parsing, anyway...
+                               //if(!@isset($GLOBALS['_xh']['ac']))
+                               //{
+                               //      $GLOBALS['_xh']['ac'] = '';
+                               //}
+                               $GLOBALS['_xh']['ac'].=$data;
+                       }
+               }
+       }
+
+       /// xml parser handler function for 'other stuff', ie. not char data or
+       /// element start/end tag. In fact it only gets called on unknown entities...
+       function xmlrpc_dh($parser, $data)
+       {
+               // skip processing if xml fault already detected
+               if ($GLOBALS['_xh']['isf'] < 2)
+               {
+                       if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';')
+                       {
+                               // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2
+                               //if($GLOBALS['_xh']['lv']==1)
+                               //{
+                               //      $GLOBALS['_xh']['lv']=2;
+                               //}
+                               $GLOBALS['_xh']['ac'].=$data;
+                       }
+               }
+               return true;
+       }
+
+       class xmlrpc_client
+       {
+               var $path;
+               var $server;
+               var $port=0;
+               var $method='http';
+               var $errno;
+               var $errstr;
+               var $debug=0;
+               var $username='';
+               var $password='';
+               var $authtype=1;
+               var $cert='';
+               var $certpass='';
+               var $cacert='';
+               var $cacertdir='';
+               var $key='';
+               var $keypass='';
+               var $verifypeer=true;
+               var $verifyhost=1;
+               var $no_multicall=false;
+               var $proxy='';
+               var $proxyport=0;
+               var $proxy_user='';
+               var $proxy_pass='';
+               var $proxy_authtype=1;
+               var $cookies=array();
+               var $extracurlopts=array();
+
+               /**
+               * List of http compression methods accepted by the client for responses.
+               * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
+               *
+               * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since
+               * in those cases it will be up to CURL to decide the compression methods
+               * it supports. You might check for the presence of 'zlib' in the output of
+               * curl_version() to determine wheter compression is supported or not
+               */
+               var $accepted_compression = array();
+               /**
+               * Name of compression scheme to be used for sending requests.
+               * Either null, gzip or deflate
+               */
+               var $request_compression = '';
+               /**
+               * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:
+               * http://curl.haxx.se/docs/faq.html#7.3)
+               */
+               var $xmlrpc_curl_handle = null;
+               /// Wheter to use persistent connections for http 1.1 and https
+               var $keepalive = false;
+               /// Charset encodings that can be decoded without problems by the client
+               var $accepted_charset_encodings = array();
+               /// Charset encoding to be used in serializing request. NULL = use ASCII
+               var $request_charset_encoding = '';
+               /**
+               * Decides the content of xmlrpcresp objects returned by calls to send()
+               * valid strings are 'xmlrpcvals', 'phpvals' or 'xml'
+               */
+               var $return_type = 'xmlrpcvals';
+               /**
+               * Sent to servers in http headers
+               */
+               var $user_agent;
+
+               /**
+               * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php
+               * @param string $server the server name / ip address
+               * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
+               * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
+               */
+               function xmlrpc_client($path, $server='', $port='', $method='')
+               {
+                       // allow user to specify all params in $path
+                       if($server == '' and $port == '' and $method == '')
+                       {
+                               $parts = parse_url($path);
+                               $server = $parts['host'];
+                               $path = isset($parts['path']) ? $parts['path'] : '';
+                               if(isset($parts['query']))
+                               {
+                                       $path .= '?'.$parts['query'];
+                               }
+                               if(isset($parts['fragment']))
+                               {
+                                       $path .= '#'.$parts['fragment'];
+                               }
+                               if(isset($parts['port']))
+                               {
+                                       $port = $parts['port'];
+                               }
+                               if(isset($parts['scheme']))
+                               {
+                                       $method = $parts['scheme'];
+                               }
+                               if(isset($parts['user']))
+                               {
+                                       $this->username = $parts['user'];
+                               }
+                               if(isset($parts['pass']))
+                               {
+                                       $this->password = $parts['pass'];
+                               }
+                       }
+                       if($path == '' || $path[0] != '/')
+                       {
+                               $this->path='/'.$path;
+                       }
+                       else
+                       {
+                               $this->path=$path;
+                       }
+                       $this->server=$server;
+                       if($port != '')
+                       {
+                               $this->port=$port;
+                       }
+                       if($method != '')
+                       {
+                               $this->method=$method;
+                       }
+
+                       // if ZLIB is enabled, let the client by default accept compressed responses
+                       if(function_exists('gzinflate') || (
+                               function_exists('curl_init') && (($info = curl_version()) &&
+                               ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
+                       ))
+                       {
+                               $this->accepted_compression = array('gzip', 'deflate');
+                       }
+
+                       // keepalives: enabled by default
+                       $this->keepalive = true;
+
+                       // by default the xml parser can support these 3 charset encodings
+                       $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
+
+                       // initialize user_agent string
+                       $this->user_agent = $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'];
+               }
+
+               /**
+               * Enables/disables the echoing to screen of the xmlrpc responses received
+               * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)
+               * @access public
+               */
+               function setDebug($in)
+               {
+                       $this->debug=$in;
+               }
+
+               /**
+               * Add some http BASIC AUTH credentials, used by the client to authenticate
+               * @param string $u username
+               * @param string $p password
+               * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
+               * @access public
+               */
+               function setCredentials($u, $p, $t=1)
+               {
+                       $this->username=$u;
+                       $this->password=$p;
+                       $this->authtype=$t;
+               }
+
+               /**
+               * Add a client-side https certificate
+               * @param string $cert
+               * @param string $certpass
+               * @access public
+               */
+               function setCertificate($cert, $certpass)
+               {
+                       $this->cert = $cert;
+                       $this->certpass = $certpass;
+               }
+
+               /**
+               * Add a CA certificate to verify server with (see man page about
+               * CURLOPT_CAINFO for more details
+               * @param string $cacert certificate file name (or dir holding certificates)
+               * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false
+               * @access public
+               */
+               function setCaCertificate($cacert, $is_dir=false)
+               {
+                       if ($is_dir)
+                       {
+                               $this->cacertdir = $cacert;
+                       }
+                       else
+                       {
+                               $this->cacert = $cacert;
+                       }
+               }
+
+               /**
+               * Set attributes for SSL communication: private SSL key
+               * NB: does not work in older php/curl installs
+               * Thanks to Daniel Convissor
+               * @param string $key The name of a file containing a private SSL key
+               * @param string $keypass The secret password needed to use the private SSL key
+               * @access public
+               */
+               function setKey($key, $keypass)
+               {
+                       $this->key = $key;
+                       $this->keypass = $keypass;
+               }
+
+               /**
+               * Set attributes for SSL communication: verify server certificate
+               * @param bool $i enable/disable verification of peer certificate
+               * @access public
+               */
+               function setSSLVerifyPeer($i)
+               {
+                       $this->verifypeer = $i;
+               }
+
+               /**
+               * Set attributes for SSL communication: verify match of server cert w. hostname
+               * @param int $i
+               * @access public
+               */
+               function setSSLVerifyHost($i)
+               {
+                       $this->verifyhost = $i;
+               }
+
+               /**
+               * Set proxy info
+               * @param string $proxyhost
+               * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS
+               * @param string $proxyusername Leave blank if proxy has public access
+               * @param string $proxypassword Leave blank if proxy has public access
+               * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy
+               * @access public
+               */
+               function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1)
+               {
+                       $this->proxy = $proxyhost;
+                       $this->proxyport = $proxyport;
+                       $this->proxy_user = $proxyusername;
+                       $this->proxy_pass = $proxypassword;
+                       $this->proxy_authtype = $proxyauthtype;
+               }
+
+               /**
+               * Enables/disables reception of compressed xmlrpc responses.
+               * Note that enabling reception of compressed responses merely adds some standard
+               * http headers to xmlrpc requests. It is up to the xmlrpc server to return
+               * compressed responses when receiving such requests.
+               * @param string $compmethod either 'gzip', 'deflate', 'any' or ''
+               * @access public
+               */
+               function setAcceptedCompression($compmethod)
+               {
+                       if ($compmethod == 'any')
+                               $this->accepted_compression = array('gzip', 'deflate');
+                       else
+                               $this->accepted_compression = array($compmethod);
+               }
+
+               /**
+               * Enables/disables http compression of xmlrpc request.
+               * Take care when sending compressed requests: servers might not support them
+               * (and automatic fallback to uncompressed requests is not yet implemented)
+               * @param string $compmethod either 'gzip', 'deflate' or ''
+               * @access public
+               */
+               function setRequestCompression($compmethod)
+               {
+                       $this->request_compression = $compmethod;
+               }
+
+               /**
+               * Adds a cookie to list of cookies that will be sent to server.
+               * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie:
+               * do not do it unless you know what you are doing
+               * @param string $name
+               * @param string $value
+               * @param string $path
+               * @param string $domain
+               * @param int $port
+               * @access public
+               *
+               * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
+               */
+               function setCookie($name, $value='', $path='', $domain='', $port=null)
+               {
+                       $this->cookies[$name]['value'] = urlencode($value);
+                       if ($path || $domain || $port)
+                       {
+                               $this->cookies[$name]['path'] = $path;
+                               $this->cookies[$name]['domain'] = $domain;
+                               $this->cookies[$name]['port'] = $port;
+                               $this->cookies[$name]['version'] = 1;
+                       }
+                       else
+                       {
+                               $this->cookies[$name]['version'] = 0;
+                       }
+               }
+
+               /**
+               * Directly set cURL options, for extra flexibility
+               * It allows eg. to bind client to a specific IP interface / address
+               * @param $options array
+               */
+               function SetCurlOptions( $options )
+               {
+                       $this->extracurlopts = $options;
+               }
+
+               /**
+               * Set user-agent string that will be used by this client instance
+               * in http headers sent to the server
+               */
+               function SetUserAgent( $agentstring )
+               {
+                       $this->user_agent = $agentstring;
+               }
+
+               /**
+               * Send an xmlrpc request
+               * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request
+               * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply
+               * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used
+               * @return xmlrpcresp
+               * @access public
+               */
+               function& send($msg, $timeout=0, $method='')
+               {
+                       // if user deos not specify http protocol, use native method of this client
+                       // (i.e. method set during call to constructor)
+                       if($method == '')
+                       {
+                               $method = $this->method;
+                       }
+
+                       if(is_array($msg))
+                       {
+                               // $msg is an array of xmlrpcmsg's
+                               $r = $this->multicall($msg, $timeout, $method);
+                               return $r;
+                       }
+                       elseif(is_string($msg))
+                       {
+                               $n = new xmlrpcmsg('');
+                               $n->payload = $msg;
+                               $msg = $n;
+                       }
+
+                       // where msg is an xmlrpcmsg
+                       $msg->debug=$this->debug;
+
+                       if($method == 'https')
+                       {
+                               $r =& $this->sendPayloadHTTPS(
+                                       $msg,
+                                       $this->server,
+                                       $this->port,
+                                       $timeout,
+                                       $this->username,
+                                       $this->password,
+                                       $this->authtype,
+                                       $this->cert,
+                                       $this->certpass,
+                                       $this->cacert,
+                                       $this->cacertdir,
+                                       $this->proxy,
+                                       $this->proxyport,
+                                       $this->proxy_user,
+                                       $this->proxy_pass,
+                                       $this->proxy_authtype,
+                                       $this->keepalive,
+                                       $this->key,
+                                       $this->keypass
+                               );
+                       }
+                       elseif($method == 'http11')
+                       {
+                               $r =& $this->sendPayloadCURL(
+                                       $msg,
+                                       $this->server,
+                                       $this->port,
+                                       $timeout,
+                                       $this->username,
+                                       $this->password,
+                                       $this->authtype,
+                                       null,
+                                       null,
+                                       null,
+                                       null,
+                                       $this->proxy,
+                                       $this->proxyport,
+                                       $this->proxy_user,
+                                       $this->proxy_pass,
+                                       $this->proxy_authtype,
+                                       'http',
+                                       $this->keepalive
+                               );
+                       }
+                       else
+                       {
+                               $r =& $this->sendPayloadHTTP10(
+                                       $msg,
+                                       $this->server,
+                                       $this->port,
+                                       $timeout,
+                                       $this->username,
+                                       $this->password,
+                                       $this->authtype,
+                                       $this->proxy,
+                                       $this->proxyport,
+                                       $this->proxy_user,
+                                       $this->proxy_pass,
+                                       $this->proxy_authtype
+                               );
+                       }
+
+                       return $r;
+               }
+
+               /**
+               * @access private
+               */
+               function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,
+                       $username='', $password='', $authtype=1, $proxyhost='',
+                       $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)
+               {
+                       if($port==0)
+                       {
+                               $port=80;
+                       }
+
+                       // Only create the payload if it was not created previously
+                       if(empty($msg->payload))
+                       {
+                               $msg->createPayload($this->request_charset_encoding);
+                       }
+
+                       $payload = $msg->payload;
+                       // Deflate request body and set appropriate request headers
+                       if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
+                       {
+                               if($this->request_compression == 'gzip')
+                               {
+                                       $a = @gzencode($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = "Content-Encoding: gzip\r\n";
+                                       }
+                               }
+                               else
+                               {
+                                       $a = @gzcompress($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = "Content-Encoding: deflate\r\n";
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $encoding_hdr = '';
+                       }
+
+                       // thanks to Grant Rauscher <grant7@firstworld.net> for this
+                       $credentials='';
+                       if($username!='')
+                       {
+                               $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
+                               if ($authtype != 1)
+                               {
+                                       error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
+                               }
+                       }
+
+                       $accepted_encoding = '';
+                       if(is_array($this->accepted_compression) && count($this->accepted_compression))
+                       {
+                               $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
+                       }
+
+                       $proxy_credentials = '';
+                       if($proxyhost)
+                       {
+                               if($proxyport == 0)
+                               {
+                                       $proxyport = 8080;
+                               }
+                               $connectserver = $proxyhost;
+                               $connectport = $proxyport;
+                               $uri = 'http://'.$server.':'.$port.$this->path;
+                               if($proxyusername != '')
+                               {
+                                       if ($proxyauthtype != 1)
+                                       {
+                                               error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
+                                       }
+                                       $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
+                               }
+                       }
+                       else
+                       {
+                               $connectserver = $server;
+                               $connectport = $port;
+                               $uri = $this->path;
+                       }
+
+                       // Cookie generation, as per rfc2965 (version 1 cookies) or
+                       // netscape's rules (version 0 cookies)
+                       $cookieheader='';
+                       if (count($this->cookies))
+                       {
+                               $version = '';
+                               foreach ($this->cookies as $name => $cookie)
+                               {
+                                       if ($cookie['version'])
+                                       {
+                                               $version = ' $Version="' . $cookie['version'] . '";';
+                                               $cookieheader .= ' ' . $name . '="' . $cookie['value'] . '";';
+                                               if ($cookie['path'])
+                                                       $cookieheader .= ' $Path="' . $cookie['path'] . '";';
+                                               if ($cookie['domain'])
+                                                       $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
+                                               if ($cookie['port'])
+                                                       $cookieheader .= ' $Port="' . $cookie['port'] . '";';
+                                       }
+                                       else
+                                       {
+                                               $cookieheader .= ' ' . $name . '=' . $cookie['value'] . ";";
+                                       }
+                               }
+                               $cookieheader = 'Cookie:' . $version . substr($cookieheader, 0, -1) . "\r\n";
+                       }
+
+                       $op= 'POST ' . $uri. " HTTP/1.0\r\n" .
+                               'User-Agent: ' . $this->user_agent . "\r\n" .
+                               'Host: '. $server . ':' . $port . "\r\n" .
+                               $credentials .
+                               $proxy_credentials .
+                               $accepted_encoding .
+                               $encoding_hdr .
+                               'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
+                               $cookieheader .
+                               'Content-Type: ' . $msg->content_type . "\r\nContent-Length: " .
+                               strlen($payload) . "\r\n\r\n" .
+                               $payload;
+
+                       if($this->debug > 1)
+                       {
+                               print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>";
+                               // let the client see this now in case http times out...
+                               flush();
+                       }
+
+                       if($timeout>0)
+                       {
+                               $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
+                       }
+                       else
+                       {
+                               $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
+                       }
+                       if($fp)
+                       {
+                               if($timeout>0 && function_exists('stream_set_timeout'))
+                               {
+                                       stream_set_timeout($fp, $timeout);
+                               }
+                       }
+                       else
+                       {
+                               $this->errstr='Connect error: '.$this->errstr;
+                               $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
+                               return $r;
+                       }
+
+                       if(!fputs($fp, $op, strlen($op)))
+                       {
+                               fclose($fp);
+                               $this->errstr='Write error';
+                               $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
+                               return $r;
+                       }
+                       else
+                       {
+                               // reset errno and errstr on succesful socket connection
+                               $this->errstr = '';
+                       }
+                       // G. Giunta 2005/10/24: close socket before parsing.
+                       // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
+                       $ipd='';
+                       do
+                       {
+                               // shall we check for $data === FALSE?
+                               // as per the manual, it signals an error
+                               $ipd.=fread($fp, 32768);
+                       } while(!feof($fp));
+                       fclose($fp);
+                       $r =& $msg->parseResponse($ipd, false, $this->return_type);
+                       return $r;
+
+               }
+
+               /**
+               * @access private
+               */
+               function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='',
+                       $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='',
+                       $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1,
+                       $keepalive=false, $key='', $keypass='')
+               {
+                       $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,
+                               $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,
+                               $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass);
+                       return $r;
+               }
+
+               /**
+               * Contributed by Justin Miller <justin@voxel.net>
+               * Requires curl to be built into PHP
+               * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
+               * @access private
+               */
+               function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='',
+                       $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='',
+                       $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https',
+                       $keepalive=false, $key='', $keypass='')
+               {
+                       if(!function_exists('curl_init'))
+                       {
+                               $this->errstr='CURL unavailable on this install';
+                               $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
+                               return $r;
+                       }
+                       if($method == 'https')
+                       {
+                               if(($info = curl_version()) &&
+                                       ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
+                               {
+                                       $this->errstr='SSL unavailable on this install';
+                                       $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
+                                       return $r;
+                               }
+                       }
+
+                       if($port == 0)
+                       {
+                               if($method == 'http')
+                               {
+                                       $port = 80;
+                               }
+                               else
+                               {
+                                       $port = 443;
+                               }
+                       }
+
+                       // Only create the payload if it was not created previously
+                       if(empty($msg->payload))
+                       {
+                               $msg->createPayload($this->request_charset_encoding);
+                       }
+
+                       // Deflate request body and set appropriate request headers
+                       $payload = $msg->payload;
+                       if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
+                       {
+                               if($this->request_compression == 'gzip')
+                               {
+                                       $a = @gzencode($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = 'Content-Encoding: gzip';
+                                       }
+                               }
+                               else
+                               {
+                                       $a = @gzcompress($payload);
+                                       if($a)
+                                       {
+                                               $payload = $a;
+                                               $encoding_hdr = 'Content-Encoding: deflate';
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $encoding_hdr = '';
+                       }
+
+                       if($this->debug > 1)
+                       {
+                               print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>";
+                               // let the client see this now in case http times out...
+                               flush();
+                       }
+
+                       if(!$keepalive || !$this->xmlrpc_curl_handle)
+                       {
+                               $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
+                               if($keepalive)
+                               {
+                                       $this->xmlrpc_curl_handle = $curl;
+                               }
+                       }
+                       else
+                       {
+                               $curl = $this->xmlrpc_curl_handle;
+                       }
+
+                       // results into variable
+                       curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+
+                       if($this->debug)
+                       {
+                               curl_setopt($curl, CURLOPT_VERBOSE, 1);
+                       }
+                       curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
+                       // required for XMLRPC: post the data
+                       curl_setopt($curl, CURLOPT_POST, 1);
+                       // the data
+                       curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
+
+                       // return the header too
+                       curl_setopt($curl, CURLOPT_HEADER, 1);
+
+                       // will only work with PHP >= 5.0
+                       // NB: if we set an empty string, CURL will add http header indicating
+                       // ALL methods it is supporting. This is possibly a better option than
+                       // letting the user tell what curl can / cannot do...
+                       if(is_array($this->accepted_compression) && count($this->accepted_compression))
+                       {
+                               //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
+                               // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+                               if (count($this->accepted_compression) == 1)
+                               {
+                                       curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);
+                               }
+                               else
+                                       curl_setopt($curl, CURLOPT_ENCODING, '');
+                       }
+                       // extra headers
+                       $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
+                       // if no keepalive is wanted, let the server know it in advance
+                       if(!$keepalive)
+                       {
+                               $headers[] = 'Connection: close';
+                       }
+                       // request compression header
+                       if($encoding_hdr)
+                       {
+                               $headers[] = $encoding_hdr;
+                       }
+
+                       curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+                       // timeout is borked
+                       if($timeout)
+                       {
+                               curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
+                       }
+
+                       if($username && $password)
+                       {
+                               curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
+                               if (defined('CURLOPT_HTTPAUTH'))
+                               {
+                                       curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);
+                               }
+                               else if ($authtype != 1)
+                               {
+                                       error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
+                               }
+                       }
+
+                       if($method == 'https')
+                       {
+                               // set cert file
+                               if($cert)
+                               {
+                                       curl_setopt($curl, CURLOPT_SSLCERT, $cert);
+                               }
+                               // set cert password
+                               if($certpass)
+                               {
+                                       curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
+                               }
+                               // whether to verify remote host's cert
+                               curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
+                               // set ca certificates file/dir
+                               if($cacert)
+                               {
+                                       curl_setopt($curl, CURLOPT_CAINFO, $cacert);
+                               }
+                               if($cacertdir)
+                               {
+                                       curl_setopt($curl, CURLOPT_CAPATH, $cacertdir);
+                               }
+                               // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+                               if($key)
+                               {
+                                       curl_setopt($curl, CURLOPT_SSLKEY, $key);
+                               }
+                               // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
+                               if($keypass)
+                               {
+                                       curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
+                               }
+                               // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
+                               curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost);
+                       }
+
+                       // proxy info
+                       if($proxyhost)
+                       {
+                               if($proxyport == 0)
+                               {
+                                       $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
+                               }
+                               curl_setopt($curl, CURLOPT_PROXY, $proxyhost.':'.$proxyport);
+                               //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
+                               if($proxyusername)
+                               {
+                                       curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
+                                       if (defined('CURLOPT_PROXYAUTH'))
+                                       {
+                                               curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);
+                                       }
+                                       else if ($proxyauthtype != 1)
+                                       {
+                                               error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
+                                       }
+                               }
+                       }
+
+                       // NB: should we build cookie http headers by hand rather than let CURL do it?
+                       // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
+                       // set to client obj the the user...
+                       if (count($this->cookies))
+                       {
+                               $cookieheader = '';
+                               foreach ($this->cookies as $name => $cookie)
+                               {
+                                       $cookieheader .= $name . '=' . $cookie['value'] . '; ';
+                               }
+                               curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2));
+                       }
+
+                       foreach ($this->extracurlopts as $opt => $val)
+                       {
+                               curl_setopt($curl, $opt, $val);
+                       }
+
+                       $result = curl_exec($curl);
+
+                       if ($this->debug > 1)
+                       {
+                               print "<PRE>\n---CURL INFO---\n";
+                               foreach(curl_getinfo($curl) as $name => $val)
+                                        print $name . ': ' . htmlentities($val). "\n";
+                               print "---END---\n</PRE>";
+                       }
+
+                       if(!$result) /// @todo we should use a better check here - what if we get back '' or '0'?
+                       {
+                               $this->errstr='no response';
+                               $resp=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
+                               curl_close($curl);
+                               if($keepalive)
+                               {
+                                       $this->xmlrpc_curl_handle = null;
+                               }
+                       }
+                       else
+                       {
+                               if(!$keepalive)
+                               {
+                                       curl_close($curl);
+                               }
+                               $resp =& $msg->parseResponse($result, true, $this->return_type);
+                       }
+                       return $resp;
+               }
+
+               /**
+               * Send an array of request messages and return an array of responses.
+               * Unless $this->no_multicall has been set to true, it will try first
+               * to use one single xmlrpc call to server method system.multicall, and
+               * revert to sending many successive calls in case of failure.
+               * This failure is also stored in $this->no_multicall for subsequent calls.
+               * Unfortunately, there is no server error code universally used to denote
+               * the fact that multicall is unsupported, so there is no way to reliably
+               * distinguish between that and a temporary failure.
+               * If you are sure that server supports multicall and do not want to
+               * fallback to using many single calls, set the fourth parameter to FALSE.
+               *
+               * NB: trying to shoehorn extra functionality into existing syntax has resulted
+               * in pretty much convoluted code...
+               *
+               * @param array $msgs an array of xmlrpcmsg objects
+               * @param integer $timeout connection timeout (in seconds)
+               * @param string $method the http protocol variant to be used
+               * @param boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
+               * @return array
+               * @access public
+               */
+               function multicall($msgs, $timeout=0, $method='', $fallback=true)
+               {
+                       if ($method == '')
+                       {
+                               $method = $this->method;
+                       }
+                       if(!$this->no_multicall)
+                       {
+                               $results = $this->_try_multicall($msgs, $timeout, $method);
+                               if(is_array($results))
+                               {
+                                       // System.multicall succeeded
+                                       return $results;
+                               }
+                               else
+                               {
+                                       // either system.multicall is unsupported by server,
+                                       // or call failed for some other reason.
+                                       if ($fallback)
+                                       {
+                                               // Don't try it next time...
+                                               $this->no_multicall = true;
+                                       }
+                                       else
+                                       {
+                                               if (is_a($results, 'xmlrpcresp'))
+                                               {
+                                                       $result = $results;
+                                               }
+                                               else
+                                               {
+                                                       $result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               // override fallback, in case careless user tries to do two
+                               // opposite things at the same time
+                               $fallback = true;
+                       }
+
+                       $results = array();
+                       if ($fallback)
+                       {
+                               // system.multicall is (probably) unsupported by server:
+                               // emulate multicall via multiple requests
+                               foreach($msgs as $msg)
+                               {
+                                       $results[] =& $this->send($msg, $timeout, $method);
+                               }
+                       }
+                       else
+                       {
+                               // user does NOT want to fallback on many single calls:
+                               // since we should always return an array of responses,
+                               // return an array with the same error repeated n times
+                               foreach($msgs as $msg)
+                               {
+                                       $results[] = $result;
+                               }
+                       }
+                       return $results;
+               }
+
+               /**
+               * Attempt to boxcar $msgs via system.multicall.
+               * Returns either an array of xmlrpcreponses, an xmlrpc error response
+               * or false (when received response does not respect valid multicall syntax)
+               * @access private
+               */
+               function _try_multicall($msgs, $timeout, $method)
+               {
+                       // Construct multicall message
+                       $calls = array();
+                       foreach($msgs as $msg)
+                       {
+                               $call['methodName'] = new xmlrpcval($msg->method(),'string');
+                               $numParams = $msg->getNumParams();
+                               $params = array();
+                               for($i = 0; $i < $numParams; $i++)
+                               {
+                                       $params[$i] = $msg->getParam($i);
+                               }
+                               $call['params'] = new xmlrpcval($params, 'array');
+                               $calls[] = new xmlrpcval($call, 'struct');
+                       }
+                       $multicall = new xmlrpcmsg('system.multicall');
+                       $multicall->addParam(new xmlrpcval($calls, 'array'));
+
+                       // Attempt RPC call
+                       $result =& $this->send($multicall, $timeout, $method);
+
+                       if($result->faultCode() != 0)
+                       {
+                               // call to system.multicall failed
+                               return $result;
+                       }
+
+                       // Unpack responses.
+                       $rets = $result->value();
+
+                       if ($this->return_type == 'xml')
+                       {
+                                       return $rets;
+                       }
+                       else if ($this->return_type == 'phpvals')
+                       {
+                               ///@todo test this code branch...
+                               $rets = $result->value();
+                               if(!is_array($rets))
+                               {
+                                       return false;           // bad return type from system.multicall
+                               }
+                               $numRets = count($rets);
+                               if($numRets != count($msgs))
+                               {
+                                       return false;           // wrong number of return values.
+                               }
+
+                               $response = array();
+                               for($i = 0; $i < $numRets; $i++)
+                               {
+                                       $val = $rets[$i];
+                                       if (!is_array($val)) {
+                                               return false;
+                                       }
+                                       switch(count($val))
+                                       {
+                                               case 1:
+                                                       if(!isset($val[0]))
+                                                       {
+                                                               return false;           // Bad value
+                                                       }
+                                                       // Normal return value
+                                                       $response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals');
+                                                       break;
+                                               case 2:
+                                                       ///     @todo remove usage of @: it is apparently quite slow
+                                                       $code = @$val['faultCode'];
+                                                       if(!is_int($code))
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $str = @$val['faultString'];
+                                                       if(!is_string($str))
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $response[$i] = new xmlrpcresp(0, $code, $str);
+                                                       break;
+                                               default:
+                                                       return false;
+                                       }
+                               }
+                               return $response;
+                       }
+                       else // return type == 'xmlrpcvals'
+                       {
+                               $rets = $result->value();
+                               if($rets->kindOf() != 'array')
+                               {
+                                       return false;           // bad return type from system.multicall
+                               }
+                               $numRets = $rets->arraysize();
+                               if($numRets != count($msgs))
+                               {
+                                       return false;           // wrong number of return values.
+                               }
+
+                               $response = array();
+                               for($i = 0; $i < $numRets; $i++)
+                               {
+                                       $val = $rets->arraymem($i);
+                                       switch($val->kindOf())
+                                       {
+                                               case 'array':
+                                                       if($val->arraysize() != 1)
+                                                       {
+                                                               return false;           // Bad value
+                                                       }
+                                                       // Normal return value
+                                                       $response[$i] = new xmlrpcresp($val->arraymem(0));
+                                                       break;
+                                               case 'struct':
+                                                       $code = $val->structmem('faultCode');
+                                                       if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $str = $val->structmem('faultString');
+                                                       if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')
+                                                       {
+                                                               return false;
+                                                       }
+                                                       $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
+                                                       break;
+                                               default:
+                                                       return false;
+                                       }
+                               }
+                               return $response;
+                       }
+               }
+       } // end class xmlrpc_client
+
+       class xmlrpcresp
+       {
+               var $val = 0;
+               var $valtyp;
+               var $errno = 0;
+               var $errstr = '';
+               var $payload;
+               var $hdrs = array();
+               var $_cookies = array();
+               var $content_type = 'text/xml';
+               var $raw_data = '';
+
+               /**
+               * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string)
+               * @param integer $fcode set it to anything but 0 to create an error response
+               * @param string $fstr the error string, in case of an error response
+               * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml'
+               *
+               * @todo add check that $val / $fcode / $fstr is of correct type???
+               * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
+               * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
+               */
+               function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='')
+               {
+                       if($fcode != 0)
+                       {
+                               // error response
+                               $this->errno = $fcode;
+                               $this->errstr = $fstr;
+                               //$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
+                       }
+                       else
+                       {
+                               // successful response
+                               $this->val = $val;
+                               if ($valtyp == '')
+                               {
+                                       // user did not declare type of response value: try to guess it
+                                       if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
+                                       {
+                                               $this->valtyp = 'xmlrpcvals';
+                                       }
+                                       else if (is_string($this->val))
+                                       {
+                                               $this->valtyp = 'xml';
+
+                                       }
+                                       else
+                                       {
+                                               $this->valtyp = 'phpvals';
+                                       }
+                               }
+                               else
+                               {
+                                       // user declares type of resp value: believe him
+                                       $this->valtyp = $valtyp;
+                               }
+                       }
+               }
+
+               /**
+               * Returns the error code of the response.
+               * @return integer the error code of this response (0 for not-error responses)
+               * @access public
+               */
+               function faultCode()
+               {
+                       return $this->errno;
+               }
+
+               /**
+               * Returns the error code of the response.
+               * @return string the error string of this response ('' for not-error responses)
+               * @access public
+               */
+               function faultString()
+               {
+                       return $this->errstr;
+               }
+
+               /**
+               * Returns the value received by the server.
+               * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects
+               * @access public
+               */
+               function value()
+               {
+                       return $this->val;
+               }
+
+               /**
+               * Returns an array with the cookies received from the server.
+               * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...)
+               * with attributes being e.g. 'expires', 'path', domain'.
+               * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
+               * are still present in the array. It is up to the user-defined code to decide
+               * how to use the received cookies, and wheter they have to be sent back with the next
+               * request to the server (using xmlrpc_client::setCookie) or not
+               * @return array array of cookies received from the server
+               * @access public
+               */
+               function cookies()
+               {
+                       return $this->_cookies;
+               }
+
+               /**
+               * Returns xml representation of the response. XML prologue not included
+               * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
+               * @return string the xml representation of the response
+               * @access public
+               */
+               function serialize($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                               $this->content_type = 'text/xml; charset=' . $charset_encoding;
+                       else
+                               $this->content_type = 'text/xml';
+                       $result = "<methodResponse>\n";
+                       if($this->errno)
+                       {
+                               // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
+                               // by xml-encoding non ascii chars
+                               $result .= "<fault>\n" .
+"<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
+"</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
+xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
+"</struct>\n</value>\n</fault>";
+                       }
+                       else
+                       {
+                               if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
+                               {
+                                       if (is_string($this->val) && $this->valtyp == 'xml')
+                                       {
+                                               $result .= "<params>\n<param>\n" .
+                                                       $this->val .
+                                                       "</param>\n</params>";
+                                       }
+                                       else
+                                       {
+                                               /// @todo try to build something serializable?
+                                               die('cannot serialize xmlrpcresp objects whose content is native php values');
+                                       }
+                               }
+                               else
+                               {
+                                       $result .= "<params>\n<param>\n" .
+                                               $this->val->serialize($charset_encoding) .
+                                               "</param>\n</params>";
+                               }
+                       }
+                       $result .= "\n</methodResponse>";
+                       $this->payload = $result;
+                       return $result;
+               }
+       }
+
+       class xmlrpcmsg
+       {
+               var $payload;
+               var $methodname;
+               var $params=array();
+               var $debug=0;
+               var $content_type = 'text/xml';
+
+               /**
+               * @param string $meth the name of the method to invoke
+               * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
+               */
+               function xmlrpcmsg($meth, $pars=0)
+               {
+                       $this->methodname=$meth;
+                       if(is_array($pars) && count($pars)>0)
+                       {
+                               for($i=0; $i<count($pars); $i++)
+                               {
+                                       $this->addParam($pars[$i]);
+                               }
+                       }
+               }
+
+               /**
+               * @access private
+               */
+               function xml_header($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                       {
+                               return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
+                       }
+                       else
+                       {
+                               return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
+                       }
+               }
+
+               /**
+               * @access private
+               */
+               function xml_footer()
+               {
+                       return '</methodCall>';
+               }
+
+               /**
+               * @access private
+               */
+               function kindOf()
+               {
+                       return 'msg';
+               }
+
+               /**
+               * @access private
+               */
+               function createPayload($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                               $this->content_type = 'text/xml; charset=' . $charset_encoding;
+                       else
+                               $this->content_type = 'text/xml';
+                       $this->payload=$this->xml_header($charset_encoding);
+                       $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
+                       $this->payload.="<params>\n";
+                       for($i=0; $i<count($this->params); $i++)
+                       {
+                               $p=$this->params[$i];
+                               $this->payload.="<param>\n" . $p->serialize($charset_encoding) .
+                               "</param>\n";
+                       }
+                       $this->payload.="</params>\n";
+                       $this->payload.=$this->xml_footer();
+               }
+
+               /**
+               * Gets/sets the xmlrpc method to be invoked
+               * @param string $meth the method to be set (leave empty not to set it)
+               * @return string the method that will be invoked
+               * @access public
+               */
+               function method($meth='')
+               {
+                       if($meth!='')
+                       {
+                               $this->methodname=$meth;
+                       }
+                       return $this->methodname;
+               }
+
+               /**
+               * Returns xml representation of the message. XML prologue included
+               * @return string the xml representation of the message, xml prologue included
+               * @access public
+               */
+               function serialize($charset_encoding='')
+               {
+                       $this->createPayload($charset_encoding);
+                       return $this->payload;
+               }
+
+               /**
+               * Add a parameter to the list of parameters to be used upon method invocation
+               * @param xmlrpcval $par
+               * @return boolean false on failure
+               * @access public
+               */
+               function addParam($par)
+               {
+                       // add check: do not add to self params which are not xmlrpcvals
+                       if(is_object($par) && is_a($par, 'xmlrpcval'))
+                       {
+                               $this->params[]=$par;
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+
+               /**
+               * Returns the nth parameter in the message. The index zero-based.
+               * @param integer $i the index of the parameter to fetch (zero based)
+               * @return xmlrpcval the i-th parameter
+               * @access public
+               */
+               function getParam($i) { return $this->params[$i]; }
+
+               /**
+               * Returns the number of parameters in the messge.
+               * @return integer the number of parameters currently set
+               * @access public
+               */
+               function getNumParams() { return count($this->params); }
+
+               /**
+               * Given an open file handle, read all data available and parse it as axmlrpc response.
+               * NB: the file handle is not closed by this function.
+               * NNB: might have trouble in rare cases to work on network streams, as we
+               *      check for a read of 0 bytes instead of feof($fp).
+               *      But since checking for feof(null) returns false, we would risk an
+               *      infinite loop in that case, because we cannot trust the caller
+               *      to give us a valid pointer to an open file...
+               * @access public
+               * @return xmlrpcresp
+               * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
+               */
+               function &parseResponseFile($fp)
+               {
+                       $ipd='';
+                       while($data=fread($fp, 32768))
+                       {
+                               $ipd.=$data;
+                       }
+                       //fclose($fp);
+                       $r =& $this->parseResponse($ipd);
+                       return $r;
+               }
+
+               /**
+               * Parses HTTP headers and separates them from data.
+               * @access private
+               */
+               function &parseResponseHeaders(&$data, $headers_processed=false)
+               {
+                               // Support "web-proxy-tunelling" connections for https through proxies
+                               if(preg_match('/^HTTP\/1\.[0-1] 200 Connection established/', $data))
+                               {
+                                       // Look for CR/LF or simple LF as line separator,
+                                       // (even though it is not valid http)
+                                       $pos = strpos($data,"\r\n\r\n");
+                                       if($pos || is_int($pos))
+                                       {
+                                               $bd = $pos+4;
+                                       }
+                                       else
+                                       {
+                                               $pos = strpos($data,"\n\n");
+                                               if($pos || is_int($pos))
+                                               {
+                                                       $bd = $pos+2;
+                                               }
+                                               else
+                                               {
+                                                       // No separation between response headers and body: fault?
+                                                       $bd = 0;
+                                               }
+                                       }
+                                       if ($bd)
+                                       {
+                                               // this filters out all http headers from proxy.
+                                               // maybe we could take them into account, too?
+                                               $data = substr($data, $bd);
+                                       }
+                                       else
+                                       {
+                                               error_log('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
+                                               $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)');
+                                               return $r;
+                                       }
+                               }
+
+                               // Strip HTTP 1.1 100 Continue header if present
+                               while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data))
+                               {
+                                       $pos = strpos($data, 'HTTP', 12);
+                                       // server sent a Continue header without any (valid) content following...
+                                       // give the client a chance to know it
+                                       if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
+                                       {
+                                               break;
+                                       }
+                                       $data = substr($data, $pos);
+                               }
+                               if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))
+                               {
+                                       $errstr= substr($data, 0, strpos($data, "\n")-1);
+                                       error_log('XML-RPC: '.__METHOD__.': HTTP error, got response: ' .$errstr);
+                                       $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');
+                                       return $r;
+                               }
+
+                               $GLOBALS['_xh']['headers'] = array();
+                               $GLOBALS['_xh']['cookies'] = array();
+
+                               // be tolerant to usage of \n instead of \r\n to separate headers and data
+                               // (even though it is not valid http)
+                               $pos = strpos($data,"\r\n\r\n");
+                               if($pos || is_int($pos))
+                               {
+                                       $bd = $pos+4;
+                               }
+                               else
+                               {
+                                       $pos = strpos($data,"\n\n");
+                                       if($pos || is_int($pos))
+                                       {
+                                               $bd = $pos+2;
+                                       }
+                                       else
+                                       {
+                                               // No separation between response headers and body: fault?
+                                               // we could take some action here instead of going on...
+                                               $bd = 0;
+                                       }
+                               }
+                               // be tolerant to line endings, and extra empty lines
+                               $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));
+                               while(list(,$line) = @each($ar))
+                               {
+                                       // take care of multi-line headers and cookies
+                                       $arr = explode(':',$line,2);
+                                       if(count($arr) > 1)
+                                       {
+                                               $header_name = strtolower(trim($arr[0]));
+                                               /// @todo some other headers (the ones that allow a CSV list of values)
+                                               /// do allow many values to be passed using multiple header lines.
+                                               /// We should add content to $GLOBALS['_xh']['headers'][$header_name]
+                                               /// instead of replacing it for those...
+                                               if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')
+                                               {
+                                                       if ($header_name == 'set-cookie2')
+                                                       {
+                                                               // version 2 cookies:
+                                                               // there could be many cookies on one line, comma separated
+                                                               $cookies = explode(',', $arr[1]);
+                                                       }
+                                                       else
+                                                       {
+                                                               $cookies = array($arr[1]);
+                                                       }
+                                                       foreach ($cookies as $cookie)
+                                                       {
+                                                               // glue together all received cookies, using a comma to separate them
+                                                               // (same as php does with getallheaders())
+                                                               if (isset($GLOBALS['_xh']['headers'][$header_name]))
+                                                                       $GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie);
+                                                               else
+                                                                       $GLOBALS['_xh']['headers'][$header_name] = trim($cookie);
+                                                               // parse cookie attributes, in case user wants to correctly honour them
+                                                               // feature creep: only allow rfc-compliant cookie attributes?
+                                                               // @todo support for server sending multiple time cookie with same name, but using different PATHs
+                                                               $cookie = explode(';', $cookie);
+                                                               foreach ($cookie as $pos => $val)
+                                                               {
+                                                                       $val = explode('=', $val, 2);
+                                                                       $tag = trim($val[0]);
+                                                                       $val = trim(@$val[1]);
+                                                                       /// @todo with version 1 cookies, we should strip leading and trailing " chars
+                                                                       if ($pos == 0)
+                                                                       {
+                                                                               $cookiename = $tag;
+                                                                               $GLOBALS['_xh']['cookies'][$tag] = array();
+                                                                               $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               if ($tag != 'value')
+                                                                               {
+                                                                                 $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
+                                               }
+                                       }
+                                       elseif(isset($header_name))
+                                       {
+                                               ///     @todo version1 cookies might span multiple lines, thus breaking the parsing above
+                                               $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
+                                       }
+                               }
+
+                               $data = substr($data, $bd);
+
+                               if($this->debug && count($GLOBALS['_xh']['headers']))
+                               {
+                                       print '<PRE>';
+                                       foreach($GLOBALS['_xh']['headers'] as $header => $value)
+                                       {
+                                               print htmlentities("HEADER: $header: $value\n");
+                                       }
+                                       foreach($GLOBALS['_xh']['cookies'] as $header => $value)
+                                       {
+                                               print htmlentities("COOKIE: $header={$value['value']}\n");
+                                       }
+                                       print "</PRE>\n";
+                               }
+
+                               // if CURL was used for the call, http headers have been processed,
+                               // and dechunking + reinflating have been carried out
+                               if(!$headers_processed)
+                               {
+                                       // Decode chunked encoding sent by http 1.1 servers
+                                       if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
+                                       {
+                                               if(!$data = decode_chunked($data))
+                                               {
+                                                       error_log('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
+                                                       $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
+                                                       return $r;
+                                               }
+                                       }
+
+                                       // Decode gzip-compressed stuff
+                                       // code shamelessly inspired from nusoap library by Dietrich Ayala
+                                       if(isset($GLOBALS['_xh']['headers']['content-encoding']))
+                                       {
+                                               $GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']);
+                                               if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
+                                               {
+                                                       // if decoding works, use it. else assume data wasn't gzencoded
+                                                       if(function_exists('gzinflate'))
+                                                       {
+                                                               if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data))
+                                                               {
+                                                                       $data = $degzdata;
+                                                                       if($this->debug)
+                                                                       print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
+                                                               }
+                                                               elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
+                                                               {
+                                                                       $data = $degzdata;
+                                                                       if($this->debug)
+                                                                       print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
+                                                               }
+                                                               else
+                                                               {
+                                                                       error_log('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
+                                                                       $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
+                                                                       return $r;
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               error_log('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
+                                                               $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
+                                                               return $r;
+                                                       }
+                                               }
+                                       }
+                               } // end of 'if needed, de-chunk, re-inflate response'
+
+                               // real stupid hack to avoid PHP complaining about returning NULL by ref
+                               $r = null;
+                               $r =& $r;
+                               return $r;
+               }
+
+               /**
+               * Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object.
+               * @param string $data the xmlrpc response, eventually including http headers
+               * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding
+               * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
+               * @return xmlrpcresp
+               * @access public
+               */
+               function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')
+               {
+                       if($this->debug)
+                       {
+                               //by maHo, replaced htmlspecialchars with htmlentities
+                               print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
+                       }
+
+                       if($data == '')
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': no response received from server.');
+                               $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
+                               return $r;
+                       }
+
+                       $GLOBALS['_xh']=array();
+
+                       $raw_data = $data;
+                       // parse the HTTP headers of the response, if present, and separate them from data
+                       if(substr($data, 0, 4) == 'HTTP')
+                       {
+                               $r =& $this->parseResponseHeaders($data, $headers_processed);
+                               if ($r)
+                               {
+                                       // failed processing of HTTP response headers
+                                       // save into response obj the full payload received, for debugging
+                                       $r->raw_data = $data;
+                                       return $r;
+                               }
+                       }
+                       else
+                       {
+                               $GLOBALS['_xh']['headers'] = array();
+                               $GLOBALS['_xh']['cookies'] = array();
+                       }
+
+                       if($this->debug)
+                       {
+                               $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
+                               if ($start)
+                               {
+                                       $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
+                                       $end = strpos($data, '-->', $start);
+                                       $comments = substr($data, $start, $end-$start);
+                                       print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";
+                               }
+                       }
+
+                       // be tolerant of extra whitespace in response body
+                       $data = trim($data);
+
+                       /// @todo return an error msg if $data=='' ?
+
+                       // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
+                       // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
+                       $pos = strrpos($data, '</methodResponse>');
+                       if($pos !== false)
+                       {
+                               $data = substr($data, 0, $pos+17);
+                       }
+
+                       // if user wants back raw xml, give it to him
+                       if ($return_type == 'xml')
+                       {
+                               $r = new xmlrpcresp($data, 0, '', 'xml');
+                               $r->hdrs = $GLOBALS['_xh']['headers'];
+                               $r->_cookies = $GLOBALS['_xh']['cookies'];
+                               $r->raw_data = $raw_data;
+                               return $r;
+                       }
+
+                       // try to 'guestimate' the character encoding of the received response
+                       $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
+
+                       $GLOBALS['_xh']['ac']='';
+                       //$GLOBALS['_xh']['qt']=''; //unused...
+                       $GLOBALS['_xh']['stack'] = array();
+                       $GLOBALS['_xh']['valuestack'] = array();
+                       $GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc
+                       $GLOBALS['_xh']['isf_reason']='';
+                       $GLOBALS['_xh']['rt']=''; // 'methodcall or 'methodresponse'
+
+                       // if response charset encoding is not known / supported, try to use
+                       // the default encoding and parse the xml anyway, but log a warning...
+                       if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                       // the following code might be better for mb_string enabled installs, but
+                       // makes the lib about 200% slower...
+                       //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$resp_encoding);
+                               $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
+                       }
+                       $parser = xml_parser_create($resp_encoding);
+                       xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+                       // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
+                       // the xml parser to give us back data in the expected charset.
+                       // What if internal encoding is not in one of the 3 allowed?
+                       // we use the broadest one, ie. utf8
+                       // This allows to send data which is native in various charset,
+                       // by extending xmlrpc_encode_entitites() and setting xmlrpc_internalencoding
+                       if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                       {
+                               xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
+                       }
+                       else
+                       {
+                               xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+                       }
+
+                       if ($return_type == 'phpvals')
+                       {
+                               xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
+                       }
+                       else
+                       {
+                               xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
+                       }
+
+                       xml_set_character_data_handler($parser, 'xmlrpc_cd');
+                       xml_set_default_handler($parser, 'xmlrpc_dh');
+
+                       // first error check: xml not well formed
+                       if(!xml_parse($parser, $data, count($data)))
+                       {
+                               // thanks to Peter Kocks <peter.kocks@baygate.com>
+                               if((xml_get_current_line_number($parser)) == 1)
+                               {
+                                       $errstr = 'XML error at line 1, check URL';
+                               }
+                               else
+                               {
+                                       $errstr = sprintf('XML error: %s at line %d, column %d',
+                                               xml_error_string(xml_get_error_code($parser)),
+                                               xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+                               }
+                               error_log($errstr);
+                               $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
+                               xml_parser_free($parser);
+                               if($this->debug)
+                               {
+                                       print $errstr;
+                               }
+                               $r->hdrs = $GLOBALS['_xh']['headers'];
+                               $r->_cookies = $GLOBALS['_xh']['cookies'];
+                               $r->raw_data = $raw_data;
+                               return $r;
+                       }
+                       xml_parser_free($parser);
+                       // second error check: xml well formed but not xml-rpc compliant
+                       if ($GLOBALS['_xh']['isf'] > 1)
+                       {
+                               if ($this->debug)
+                               {
+                                       /// @todo echo something for user?
+                               }
+
+                               $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
+                               $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
+                       }
+                       // third error check: parsing of the response has somehow gone boink.
+                       // NB: shall we omit this check, since we trust the parsing code?
+                       elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))
+                       {
+                               // something odd has happened
+                               // and it's time to generate a client side error
+                               // indicating something odd went on
+                               $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
+                                       $GLOBALS['xmlrpcstr']['invalid_return']);
+                       }
+                       else
+                       {
+                               if ($this->debug)
+                               {
+                                       print "<PRE>---PARSED---\n";
+                                       // somehow htmlentities chokes on var_export, and some full html string...
+                                       //print htmlentitites(var_export($GLOBALS['_xh']['value'], true));
+                                       print htmlspecialchars(var_export($GLOBALS['_xh']['value'], true));
+                                       print "\n---END---</PRE>";
+                               }
+
+                               // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
+                               $v =& $GLOBALS['_xh']['value'];
+
+                               if($GLOBALS['_xh']['isf'])
+                               {
+                                       /// @todo we should test here if server sent an int and a string,
+                                       /// and/or coerce them into such...
+                                       if ($return_type == 'xmlrpcvals')
+                                       {
+                                               $errno_v = $v->structmem('faultCode');
+                                               $errstr_v = $v->structmem('faultString');
+                                               $errno = $errno_v->scalarval();
+                                               $errstr = $errstr_v->scalarval();
+                                       }
+                                       else
+                                       {
+                                               $errno = $v['faultCode'];
+                                               $errstr = $v['faultString'];
+                                       }
+
+                                       if($errno == 0)
+                                       {
+                                               // FAULT returned, errno needs to reflect that
+                                               $errno = -1;
+                                       }
+
+                                       $r = new xmlrpcresp(0, $errno, $errstr);
+                               }
+                               else
+                               {
+                                       $r=new xmlrpcresp($v, 0, '', $return_type);
+                               }
+                       }
+
+                       $r->hdrs = $GLOBALS['_xh']['headers'];
+                       $r->_cookies = $GLOBALS['_xh']['cookies'];
+                       $r->raw_data = $raw_data;
+                       return $r;
+               }
+       }
+
+       class xmlrpcval
+       {
+               var $me=array();
+               var $mytype=0;
+               var $_php_class=null;
+
+               /**
+               * @param mixed $val
+               * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
+               */
+               function xmlrpcval($val=-1, $type='')
+               {
+                       /// @todo: optimization creep - do not call addXX, do it all inline.
+                       /// downside: booleans will not be coerced anymore
+                       if($val!==-1 || $type!='')
+                       {
+                               // optimization creep: inlined all work done by constructor
+                               switch($type)
+                               {
+                                       case '':
+                                               $this->mytype=1;
+                                               $this->me['string']=$val;
+                                               break;
+                                       case 'i4':
+                                       case 'int':
+                                       case 'double':
+                                       case 'string':
+                                       case 'boolean':
+                                       case 'dateTime.iso8601':
+                                       case 'base64':
+                                       case 'null':
+                                               $this->mytype=1;
+                                               $this->me[$type]=$val;
+                                               break;
+                                       case 'array':
+                                               $this->mytype=2;
+                                               $this->me['array']=$val;
+                                               break;
+                                       case 'struct':
+                                               $this->mytype=3;
+                                               $this->me['struct']=$val;
+                                               break;
+                                       default:
+                                               error_log("XML-RPC: ".__METHOD__.": not a known type ($type)");
+                               }
+                               /*if($type=='')
+                               {
+                                       $type='string';
+                               }
+                               if($GLOBALS['xmlrpcTypes'][$type]==1)
+                               {
+                                       $this->addScalar($val,$type);
+                               }
+                               elseif($GLOBALS['xmlrpcTypes'][$type]==2)
+                               {
+                                       $this->addArray($val);
+                               }
+                               elseif($GLOBALS['xmlrpcTypes'][$type]==3)
+                               {
+                                       $this->addStruct($val);
+                               }*/
+                       }
+               }
+
+               /**
+               * Add a single php value to an (unitialized) xmlrpcval
+               * @param mixed $val
+               * @param string $type
+               * @return int 1 or 0 on failure
+               */
+               function addScalar($val, $type='string')
+               {
+                       $typeof=@$GLOBALS['xmlrpcTypes'][$type];
+                       if($typeof!=1)
+                       {
+                               error_log("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
+                               return 0;
+                       }
+
+                       // coerce booleans into correct values
+                       // NB: we should either do it for datetimes, integers and doubles, too,
+                       // or just plain remove this check, implemented on booleans only...
+                       if($type==$GLOBALS['xmlrpcBoolean'])
+                       {
+                               if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
+                               {
+                                       $val=true;
+                               }
+                               else
+                               {
+                                       $val=false;
+                               }
+                       }
+
+                       switch($this->mytype)
+                       {
+                               case 1:
+                                       error_log('XML-RPC: '.__METHOD__.': scalar xmlrpcval can have only one value');
+                                       return 0;
+                               case 3:
+                                       error_log('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpcval');
+                                       return 0;
+                               case 2:
+                                       // we're adding a scalar value to an array here
+                                       //$ar=$this->me['array'];
+                                       //$ar[]=new xmlrpcval($val, $type);
+                                       //$this->me['array']=$ar;
+                                       // Faster (?) avoid all the costly array-copy-by-val done here...
+                                       $this->me['array'][]=new xmlrpcval($val, $type);
+                                       return 1;
+                               default:
+                                       // a scalar, so set the value and remember we're scalar
+                                       $this->me[$type]=$val;
+                                       $this->mytype=$typeof;
+                                       return 1;
+                       }
+               }
+
+               /**
+               * Add an array of xmlrpcval objects to an xmlrpcval
+               * @param array $vals
+               * @return int 1 or 0 on failure
+               * @access public
+               *
+               * @todo add some checking for $vals to be an array of xmlrpcvals?
+               */
+               function addArray($vals)
+               {
+                       if($this->mytype==0)
+                       {
+                               $this->mytype=$GLOBALS['xmlrpcTypes']['array'];
+                               $this->me['array']=$vals;
+                               return 1;
+                       }
+                       elseif($this->mytype==2)
+                       {
+                               // we're adding to an array here
+                               $this->me['array'] = array_merge($this->me['array'], $vals);
+                               return 1;
+                       }
+                       else
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': already initialized as a [' . $this->kindOf() . ']');
+                               return 0;
+                       }
+               }
+
+               /**
+               * Add an array of named xmlrpcval objects to an xmlrpcval
+               * @param array $vals
+               * @return int 1 or 0 on failure
+               * @access public
+               *
+               * @todo add some checking for $vals to be an array?
+               */
+               function addStruct($vals)
+               {
+                       if($this->mytype==0)
+                       {
+                               $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
+                               $this->me['struct']=$vals;
+                               return 1;
+                       }
+                       elseif($this->mytype==3)
+                       {
+                               // we're adding to a struct here
+                               $this->me['struct'] = array_merge($this->me['struct'], $vals);
+                               return 1;
+                       }
+                       else
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': already initialized as a [' . $this->kindOf() . ']');
+                               return 0;
+                       }
+               }
+
+               // poor man's version of print_r ???
+               // DEPRECATED!
+               function dump($ar)
+               {
+                       foreach($ar as $key => $val)
+                       {
+                               echo "$key => $val<br />";
+                               if($key == 'array')
+                               {
+                                       while(list($key2, $val2) = each($val))
+                                       {
+                                               echo "-- $key2 => $val2<br />";
+                                       }
+                               }
+                       }
+               }
+
+               /**
+               * Returns a string containing "struct", "array" or "scalar" describing the base type of the value
+               * @return string
+               * @access public
+               */
+               function kindOf()
+               {
+                       switch($this->mytype)
+                       {
+                               case 3:
+                                       return 'struct';
+                                       break;
+                               case 2:
+                                       return 'array';
+                                       break;
+                               case 1:
+                                       return 'scalar';
+                                       break;
+                               default:
+                                       return 'undef';
+                       }
+               }
+
+               /**
+               * @access private
+               */
+               function serializedata($typ, $val, $charset_encoding='')
+               {
+                       $rs='';
+                       switch(@$GLOBALS['xmlrpcTypes'][$typ])
+                       {
+                               case 1:
+                                       switch($typ)
+                                       {
+                                               case $GLOBALS['xmlrpcBase64']:
+                                                       $rs.="<${typ}>" . base64_encode($val) . "</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcBoolean']:
+                                                       $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcString']:
+                                                       // G. Giunta 2005/2/13: do NOT use htmlentities, since
+                                                       // it will produce named html entities, which are invalid xml
+                                                       $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcInt']:
+                                               case $GLOBALS['xmlrpcI4']:
+                                                       $rs.="<${typ}>".(int)$val."</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcDouble']:
+                                                       // avoid using standard conversion of float to string because it is locale-dependent,
+                                                       // and also because the xmlrpc spec forbids exponential notation.
+                                                       // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
+                                                       // The code below tries its best at keeping max precision while avoiding exp notation,
+                                                       // but there is of course no limit in the number of decimal places to be used...
+                                                       $rs.="<${typ}>".preg_replace('/\\.?0+$/','',number_format((double)$val, 128, '.', ''))."</${typ}>";
+                                                       break;
+                                               case $GLOBALS['xmlrpcDateTime']:
+                                                       if (is_string($val))
+                                                       {
+                                                               $rs.="<${typ}>${val}</${typ}>";
+                                                       }
+                                                       else if(is_a($val, 'DateTime'))
+                                                       {
+                                                               $rs.="<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
+                                                       }
+                                                       else if(is_int($val))
+                                                       {
+                                                               $rs.="<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
+                                                       }
+                                                       else
+                                                       {
+                                                               // not really a good idea here: but what shall we output anyway? left for backward compat...
+                                                               $rs.="<${typ}>${val}</${typ}>";
+                                                       }
+                                                       break;
+                                               case $GLOBALS['xmlrpcNull']:
+                                                       if ($GLOBALS['xmlrpc_null_apache_encoding'])
+                                                       {
+                                                               $rs.="<ex:nil/>";
+                                                       }
+                                                       else
+                                                       {
+                                                               $rs.="<nil/>";
+                                                       }
+                                                       break;
+                                               default:
+                                                       // no standard type value should arrive here, but provide a possibility
+                                                       // for xmlrpcvals of unknown type...
+                                                       $rs.="<${typ}>${val}</${typ}>";
+                                       }
+                                       break;
+                               case 3:
+                                       // struct
+                                       if ($this->_php_class)
+                                       {
+                                               $rs.='<struct php_class="' . $this->_php_class . "\">\n";
+                                       }
+                                       else
+                                       {
+                                               $rs.="<struct>\n";
+                                       }
+                                       foreach($val as $key2 => $val2)
+                                       {
+                                               $rs.='<member><name>'.xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n";
+                                               //$rs.=$this->serializeval($val2);
+                                               $rs.=$val2->serialize($charset_encoding);
+                                               $rs.="</member>\n";
+                                       }
+                                       $rs.='</struct>';
+                                       break;
+                               case 2:
+                                       // array
+                                       $rs.="<array>\n<data>\n";
+                                       for($i=0; $i<count($val); $i++)
+                                       {
+                                               //$rs.=$this->serializeval($val[$i]);
+                                               $rs.=$val[$i]->serialize($charset_encoding);
+                                       }
+                                       $rs.="</data>\n</array>";
+                                       break;
+                               default:
+                                       break;
+                       }
+                       return $rs;
+               }
+
+               /**
+               * Returns xml representation of the value. XML prologue not included
+               * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed
+               * @return string
+               * @access public
+               */
+               function serialize($charset_encoding='')
+               {
+                       // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+                       //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+                       //{
+                               reset($this->me);
+                               list($typ, $val) = each($this->me);
+                               return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n";
+                       //}
+               }
+
+               // DEPRECATED
+               function serializeval($o)
+               {
+                       // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
+                       //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
+                       //{
+                               $ar=$o->me;
+                               reset($ar);
+                               list($typ, $val) = each($ar);
+                               return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
+                       //}
+               }
+
+               /**
+               * Checks wheter a struct member with a given name is present.
+               * Works only on xmlrpcvals of type struct.
+               * @param string $m the name of the struct member to be looked up
+               * @return boolean
+               * @access public
+               */
+               function structmemexists($m)
+               {
+                       return array_key_exists($m, $this->me['struct']);
+               }
+
+               /**
+               * Returns the value of a given struct member (an xmlrpcval object in itself).
+               * Will raise a php warning if struct member of given name does not exist
+               * @param string $m the name of the struct member to be looked up
+               * @return xmlrpcval
+               * @access public
+               */
+               function structmem($m)
+               {
+                       return $this->me['struct'][$m];
+               }
+
+               /**
+               * Reset internal pointer for xmlrpcvals of type struct.
+               * @access public
+               */
+               function structreset()
+               {
+                       reset($this->me['struct']);
+               }
+
+               /**
+               * Return next member element for xmlrpcvals of type struct.
+               * @return xmlrpcval
+               * @access public
+               */
+               function structeach()
+               {
+                       return each($this->me['struct']);
+               }
+
+               // DEPRECATED! this code looks like it is very fragile and has not been fixed
+               // for a long long time. Shall we remove it for 2.0?
+               function getval()
+               {
+                       // UNSTABLE
+                       reset($this->me);
+                       list($a,$b)=each($this->me);
+                       // contributed by I Sofer, 2001-03-24
+                       // add support for nested arrays to scalarval
+                       // i've created a new method here, so as to
+                       // preserve back compatibility
+
+                       if(is_array($b))
+                       {
+                               @reset($b);
+                               while(list($id,$cont) = @each($b))
+                               {
+                                       $b[$id] = $cont->scalarval();
+                               }
+                       }
+
+                       // add support for structures directly encoding php objects
+                       if(is_object($b))
+                       {
+                               $t = get_object_vars($b);
+                               @reset($t);
+                               while(list($id,$cont) = @each($t))
+                               {
+                                       $t[$id] = $cont->scalarval();
+                               }
+                               @reset($t);
+                               while(list($id,$cont) = @each($t))
+                               {
+                                       @$b->$id = $cont;
+                               }
+                       }
+                       // end contrib
+                       return $b;
+               }
+
+               /**
+               * Returns the value of a scalar xmlrpcval
+               * @return mixed
+               * @access public
+               */
+               function scalarval()
+               {
+                       reset($this->me);
+                       list(,$b)=each($this->me);
+                       return $b;
+               }
+
+               /**
+               * Returns the type of the xmlrpcval.
+               * For integers, 'int' is always returned in place of 'i4'
+               * @return string
+               * @access public
+               */
+               function scalartyp()
+               {
+                       reset($this->me);
+                       list($a,)=each($this->me);
+                       if($a==$GLOBALS['xmlrpcI4'])
+                       {
+                               $a=$GLOBALS['xmlrpcInt'];
+                       }
+                       return $a;
+               }
+
+               /**
+               * Returns the m-th member of an xmlrpcval of struct type
+               * @param integer $m the index of the value to be retrieved (zero based)
+               * @return xmlrpcval
+               * @access public
+               */
+               function arraymem($m)
+               {
+                       return $this->me['array'][$m];
+               }
+
+               /**
+               * Returns the number of members in an xmlrpcval of array type
+               * @return integer
+               * @access public
+               */
+               function arraysize()
+               {
+                       return count($this->me['array']);
+               }
+
+               /**
+               * Returns the number of members in an xmlrpcval of struct type
+               * @return integer
+               * @access public
+               */
+               function structsize()
+               {
+                       return count($this->me['struct']);
+               }
+       }
+
+
+       // date helpers
+
+       /**
+       * Given a timestamp, return the corresponding ISO8601 encoded string.
+       *
+       * Really, timezones ought to be supported
+       * but the XML-RPC spec says:
+       *
+       * "Don't assume a timezone. It should be specified by the server in its
+       * documentation what assumptions it makes about timezones."
+       *
+       * These routines always assume localtime unless
+       * $utc is set to 1, in which case UTC is assumed
+       * and an adjustment for locale is made when encoding
+       *
+       * @param int $timet (timestamp)
+       * @param int $utc (0 or 1)
+       * @return string
+       */
+       function iso8601_encode($timet, $utc=0)
+       {
+               if(!$utc)
+               {
+                       $t=strftime("%Y%m%dT%H:%M:%S", $timet);
+               }
+               else
+               {
+                       if(function_exists('gmstrftime'))
+                       {
+                               // gmstrftime doesn't exist in some versions
+                               // of PHP
+                               $t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
+                       }
+                       else
+                       {
+                               $t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
+                       }
+               }
+               return $t;
+       }
+
+       /**
+       * Given an ISO8601 date string, return a timet in the localtime, or UTC
+       * @param string $idate
+       * @param int $utc either 0 or 1
+       * @return int (datetime)
+       */
+       function iso8601_decode($idate, $utc=0)
+       {
+               $t=0;
+               if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs))
+               {
+                       if($utc)
+                       {
+                               $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+                       }
+                       else
+                       {
+                               $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
+                       }
+               }
+               return $t;
+       }
+
+       /**
+       * Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.
+       *
+       * Works with xmlrpc message objects as input, too.
+       *
+       * Given proper options parameter, can rebuild generic php object instances
+       * (provided those have been encoded to xmlrpc format using a corresponding
+       * option in php_xmlrpc_encode())
+       * PLEASE NOTE that rebuilding php objects involves calling their constructor function.
+       * This means that the remote communication end can decide which php code will
+       * get executed on your server, leaving the door possibly open to 'php-injection'
+       * style of attacks (provided you have some classes defined on your server that
+       * might wreak havoc if instances are built outside an appropriate context).
+       * Make sure you trust the remote server/client before eanbling this!
+       *
+       * @author Dan Libby (dan@libby.com)
+       *
+       * @param xmlrpcval $xmlrpc_val
+       * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects; if 'dates_as_objects' is set xmlrpc datetimes are decoded as php DateTime objects (standard is
+       * @return mixed
+       */
+       function php_xmlrpc_decode($xmlrpc_val, $options=array())
+       {
+               switch($xmlrpc_val->kindOf())
+               {
+                       case 'scalar':
+                               if (in_array('extension_api', $options))
+                               {
+                                       reset($xmlrpc_val->me);
+                                       list($typ,$val) = each($xmlrpc_val->me);
+                                       switch ($typ)
+                                       {
+                                               case 'dateTime.iso8601':
+                                                       $xmlrpc_val->scalar = $val;
+                                                       $xmlrpc_val->xmlrpc_type = 'datetime';
+                                                       $xmlrpc_val->timestamp = iso8601_decode($val);
+                                                       return $xmlrpc_val;
+                                               case 'base64':
+                                                       $xmlrpc_val->scalar = $val;
+                                                       $xmlrpc_val->type = $typ;
+                                                       return $xmlrpc_val;
+                                               default:
+                                                       return $xmlrpc_val->scalarval();
+                                       }
+                               }
+                               if (in_array('dates_as_objects', $options) && $xmlrpc_val->scalartyp() == 'dateTime.iso8601')
+                               {
+                                       // we return a Datetime object instead of a string
+                                       // since now the constructor of xmlrpcval accepts safely strings, ints and datetimes,
+                                       // we cater to all 3 cases here
+                                       $out = $xmlrpc_val->scalarval();
+                                       if (is_string($out))
+                                       {
+                                               $out = strtotime($out);
+                                       }
+                                       if (is_int($out))
+                                       {
+                                               $result = new Datetime();
+                                               $result->setTimestamp($out);
+                                               return $result;
+                                       }
+                                       elseif (is_a($out, 'Datetime'))
+                                       {
+                                               return $out;
+                                       }
+                               }
+                               return $xmlrpc_val->scalarval();
+                       case 'array':
+                               $size = $xmlrpc_val->arraysize();
+                               $arr = array();
+                               for($i = 0; $i < $size; $i++)
+                               {
+                                       $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
+                               }
+                               return $arr;
+                       case 'struct':
+                               $xmlrpc_val->structreset();
+                               // If user said so, try to rebuild php objects for specific struct vals.
+                               /// @todo should we raise a warning for class not found?
+                               // shall we check for proper subclass of xmlrpcval instead of
+                               // presence of _php_class to detect what we can do?
+                               if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
+                                       && class_exists($xmlrpc_val->_php_class))
+                               {
+                                       $obj = @new $xmlrpc_val->_php_class;
+                                       while(list($key,$value)=$xmlrpc_val->structeach())
+                                       {
+                                               $obj->$key = php_xmlrpc_decode($value, $options);
+                                       }
+                                       return $obj;
+                               }
+                               else
+                               {
+                                       $arr = array();
+                                       while(list($key,$value)=$xmlrpc_val->structeach())
+                                       {
+                                               $arr[$key] = php_xmlrpc_decode($value, $options);
+                                       }
+                                       return $arr;
+                               }
+                       case 'msg':
+                               $paramcount = $xmlrpc_val->getNumParams();
+                               $arr = array();
+                               for($i = 0; $i < $paramcount; $i++)
+                               {
+                                       $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
+                               }
+                               return $arr;
+                       }
+       }
+
+       // This constant left here only for historical reasons...
+       // it was used to decide if we have to define xmlrpc_encode on our own, but
+       // we do not do it anymore
+       if(function_exists('xmlrpc_decode'))
+       {
+               define('XMLRPC_EPI_ENABLED','1');
+       }
+       else
+       {
+               define('XMLRPC_EPI_ENABLED','0');
+       }
+
+       /**
+       * Takes native php types and encodes them into xmlrpc PHP object format.
+       * It will not re-encode xmlrpcval objects.
+       *
+       * Feature creep -- could support more types via optional type argument
+       * (string => datetime support has been added, ??? => base64 not yet)
+       *
+       * If given a proper options parameter, php object instances will be encoded
+       * into 'special' xmlrpc values, that can later be decoded into php objects
+       * by calling php_xmlrpc_decode() with a corresponding option
+       *
+       * @author Dan Libby (dan@libby.com)
+       *
+       * @param mixed $php_val the value to be converted into an xmlrpcval object
+       * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
+       * @return xmlrpcval
+       */
+       function php_xmlrpc_encode($php_val, $options=array())
+       {
+               $type = gettype($php_val);
+               switch($type)
+               {
+                       case 'string':
+                               if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val))
+                                       $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
+                               else
+                                       $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
+                               break;
+                       case 'integer':
+                               $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']);
+                               break;
+                       case 'double':
+                               $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']);
+                               break;
+                               // <G_Giunta_2001-02-29>
+                               // Add support for encoding/decoding of booleans, since they are supported in PHP
+                       case 'boolean':
+                               $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']);
+                               break;
+                               // </G_Giunta_2001-02-29>
+                       case 'array':
+                               // PHP arrays can be encoded to either xmlrpc structs or arrays,
+                               // depending on wheter they are hashes or plain 0..n integer indexed
+                               // A shorter one-liner would be
+                               // $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1));
+                               // but execution time skyrockets!
+                               $j = 0;
+                               $arr = array();
+                               $ko = false;
+                               foreach($php_val as $key => $val)
+                               {
+                                       $arr[$key] = php_xmlrpc_encode($val, $options);
+                                       if(!$ko && $key !== $j)
+                                       {
+                                               $ko = true;
+                                       }
+                                       $j++;
+                               }
+                               if($ko)
+                               {
+                                       $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
+                               }
+                               else
+                               {
+                                       $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);
+                               }
+                               break;
+                       case 'object':
+                               if(is_a($php_val, 'xmlrpcval'))
+                               {
+                                       $xmlrpc_val = $php_val;
+                               }
+                               else if(is_a($php_val, 'DateTime'))
+                               {
+                                       $xmlrpc_val = new xmlrpcval($php_val->format('Ymd\TH:i:s'), $GLOBALS['xmlrpcStruct']);
+                               }
+                               else
+                               {
+                                       $arr = array();
+                                       reset($php_val);
+                                       while(list($k,$v) = each($php_val))
+                                       {
+                                               $arr[$k] = php_xmlrpc_encode($v, $options);
+                                       }
+                                       $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
+                                       if (in_array('encode_php_objs', $options))
+                                       {
+                                               // let's save original class name into xmlrpcval:
+                                               // might be useful later on...
+                                               $xmlrpc_val->_php_class = get_class($php_val);
+                                       }
+                               }
+                               break;
+                       case 'NULL':
+                               if (in_array('extension_api', $options))
+                               {
+                                       $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);
+                               }
+                               else if (in_array('null_extension', $options))
+                               {
+                                       $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);
+                               }
+                               else
+                               {
+                                       $xmlrpc_val = new xmlrpcval();
+                               }
+                               break;
+                       case 'resource':
+                               if (in_array('extension_api', $options))
+                               {
+                                       $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
+                               }
+                               else
+                               {
+                                       $xmlrpc_val = new xmlrpcval();
+                               }
+                       // catch "user function", "unknown type"
+                       default:
+                               // giancarlo pinerolo <ping@alt.it>
+                               // it has to return
+                               // an empty object in case, not a boolean.
+                               $xmlrpc_val = new xmlrpcval();
+                               break;
+                       }
+                       return $xmlrpc_val;
+       }
+
+       /**
+       * Convert the xml representation of a method response, method request or single
+       * xmlrpc value into the appropriate object (a.k.a. deserialize)
+       * @param string $xml_val
+       * @param array $options
+       * @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp
+       */
+       function php_xmlrpc_decode_xml($xml_val, $options=array())
+       {
+               $GLOBALS['_xh'] = array();
+               $GLOBALS['_xh']['ac'] = '';
+               $GLOBALS['_xh']['stack'] = array();
+               $GLOBALS['_xh']['valuestack'] = array();
+               $GLOBALS['_xh']['params'] = array();
+               $GLOBALS['_xh']['pt'] = array();
+               $GLOBALS['_xh']['isf'] = 0;
+               $GLOBALS['_xh']['isf_reason'] = '';
+               $GLOBALS['_xh']['method'] = false;
+               $GLOBALS['_xh']['rt'] = '';
+               /// @todo 'guestimate' encoding
+               $parser = xml_parser_create();
+               xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+               // What if internal encoding is not in one of the 3 allowed?
+               // we use the broadest one, ie. utf8!
+               if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+               {
+                       xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
+               }
+               else
+               {
+                       xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+               }
+               xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
+               xml_set_character_data_handler($parser, 'xmlrpc_cd');
+               xml_set_default_handler($parser, 'xmlrpc_dh');
+               if(!xml_parse($parser, $xml_val, 1))
+               {
+                       $errstr = sprintf('XML error: %s at line %d, column %d',
+                                               xml_error_string(xml_get_error_code($parser)),
+                                               xml_get_current_line_number($parser), xml_get_current_column_number($parser));
+                       error_log($errstr);
+                       xml_parser_free($parser);
+                       return false;
+               }
+               xml_parser_free($parser);
+               if ($GLOBALS['_xh']['isf'] > 1) // test that $GLOBALS['_xh']['value'] is an obj, too???
+               {
+                       error_log($GLOBALS['_xh']['isf_reason']);
+                       return false;
+               }
+               switch ($GLOBALS['_xh']['rt'])
+               {
+                       case 'methodresponse':
+                               $v =& $GLOBALS['_xh']['value'];
+                               if ($GLOBALS['_xh']['isf'] == 1)
+                               {
+                                       $vc = $v->structmem('faultCode');
+                                       $vs = $v->structmem('faultString');
+                                       $r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());
+                               }
+                               else
+                               {
+                                       $r = new xmlrpcresp($v);
+                               }
+                               return $r;
+                       case 'methodcall':
+                               $m = new xmlrpcmsg($GLOBALS['_xh']['method']);
+                               for($i=0; $i < count($GLOBALS['_xh']['params']); $i++)
+                               {
+                                       $m->addParam($GLOBALS['_xh']['params'][$i]);
+                               }
+                               return $m;
+                       case 'value':
+                               return $GLOBALS['_xh']['value'];
+                       default:
+                               return false;
+               }
+       }
+
+       /**
+       * decode a string that is encoded w/ "chunked" transfer encoding
+       * as defined in rfc2068 par. 19.4.6
+       * code shamelessly stolen from nusoap library by Dietrich Ayala
+       *
+       * @param string $buffer the string to be decoded
+       * @return string
+       */
+       function decode_chunked($buffer)
+       {
+               // length := 0
+               $length = 0;
+               $new = '';
+
+               // read chunk-size, chunk-extension (if any) and crlf
+               // get the position of the linebreak
+               $chunkend = strpos($buffer,"\r\n") + 2;
+               $temp = substr($buffer,0,$chunkend);
+               $chunk_size = hexdec( trim($temp) );
+               $chunkstart = $chunkend;
+               while($chunk_size > 0)
+               {
+                       $chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
+
+                       // just in case we got a broken connection
+                       if($chunkend == false)
+                       {
+                               $chunk = substr($buffer,$chunkstart);
+                               // append chunk-data to entity-body
+                               $new .= $chunk;
+                               $length += strlen($chunk);
+                               break;
+                       }
+
+                       // read chunk-data and crlf
+                       $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
+                       // append chunk-data to entity-body
+                       $new .= $chunk;
+                       // length := length + chunk-size
+                       $length += strlen($chunk);
+                       // read chunk-size and crlf
+                       $chunkstart = $chunkend + 2;
+
+                       $chunkend = strpos($buffer,"\r\n",$chunkstart)+2;
+                       if($chunkend == false)
+                       {
+                               break; //just in case we got a broken connection
+                       }
+                       $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
+                       $chunk_size = hexdec( trim($temp) );
+                       $chunkstart = $chunkend;
+               }
+               return $new;
+       }
+
+       /**
+       * xml charset encoding guessing helper function.
+       * Tries to determine the charset encoding of an XML chunk received over HTTP.
+       * NB: according to the spec (RFC 3023), if text/xml content-type is received over HTTP without a content-type,
+       * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
+       * which will be most probably using UTF-8 anyway...
+       *
+       * @param string $httpheaders the http Content-type header
+       * @param string $xmlchunk xml content buffer
+       * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
+       *
+       * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
+       */
+       function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)
+       {
+               // discussion: see http://www.yale.edu/pclt/encoding/
+               // 1 - test if encoding is specified in HTTP HEADERS
+
+               //Details:
+               // LWS:           (\13\10)?( |\t)+
+               // token:         (any char but excluded stuff)+
+               // quoted string: " (any char but double quotes and cointrol chars)* "
+               // header:        Content-type = ...; charset=value(; ...)*
+               //   where value is of type token, no LWS allowed between 'charset' and value
+               // Note: we do not check for invalid chars in VALUE:
+               //   this had better be done using pure ereg as below
+               // Note 2: we might be removing whitespace/tabs that ought to be left in if
+               //   the received charset is a quoted string. But nobody uses such charset names...
+
+               /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
+               $matches = array();
+               if(preg_match('/;\s*charset\s*=([^;]+)/i', $httpheader, $matches))
+               {
+                       return strtoupper(trim($matches[1], " \t\""));
+               }
+
+               // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern
+               //     (source: http://www.w3.org/TR/2000/REC-xml-20001006)
+               //     NOTE: actually, according to the spec, even if we find the BOM and determine
+               //     an encoding, we should check if there is an encoding specified
+               //     in the xml declaration, and verify if they match.
+               /// @todo implement check as described above?
+               /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
+               if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk))
+               {
+                       return 'UCS-4';
+               }
+               elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
+               {
+                       return 'UTF-16';
+               }
+               elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
+               {
+                       return 'UTF-8';
+               }
+
+               // 3 - test if encoding is specified in the xml declaration
+               // Details:
+               // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
+               // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
+               if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
+                       '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
+                       $xmlchunk, $matches))
+               {
+                       return strtoupper(substr($matches[2], 1, -1));
+               }
+
+               // 4 - if mbstring is available, let it do the guesswork
+               // NB: we favour finding an encoding that is compatible with what we can process
+               if(extension_loaded('mbstring'))
+               {
+                       if($encoding_prefs)
+                       {
+                               $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
+                       }
+                       else
+                       {
+                               $enc = mb_detect_encoding($xmlchunk);
+                       }
+                       // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
+                       // IANA also likes better US-ASCII, so go with it
+                       if($enc == 'ASCII')
+                       {
+                               $enc = 'US-'.$enc;
+                       }
+                       return $enc;
+               }
+               else
+               {
+                       // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
+                       // Both RFC 2616 (HTTP 1.1) and 1945 (HTTP 1.0) clearly state that for text/xxx content types
+                       // this should be the standard. And we should be getting text/xml as request and response.
+                       // BUT we have to be backward compatible with the lib, which always used UTF-8 as default...
+                       return $GLOBALS['xmlrpc_defencoding'];
+               }
+       }
+
+       /**
+       * Checks if a given charset encoding is present in a list of encodings or
+       * if it is a valid subset of any encoding in the list
+       * @param string $encoding charset to be tested
+       * @param mixed $validlist comma separated list of valid charsets (or array of charsets)
+       */
+       function is_valid_charset($encoding, $validlist)
+       {
+               $charset_supersets = array(
+                       'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
+                               'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
+                               'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
+                               'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
+                               'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN')
+               );
+               if (is_string($validlist))
+                       $validlist = explode(',', $validlist);
+               if (@in_array(strtoupper($encoding), $validlist))
+                       return true;
+               else
+               {
+                       if (array_key_exists($encoding, $charset_supersets))
+                               foreach ($validlist as $allowed)
+                                       if (in_array($allowed, $charset_supersets[$encoding]))
+                                               return true;
+                               return false;
+               }
+       }
+
+?>
\ No newline at end of file
diff --git a/net/nzbgetweb/files/lib/xmlrpc_wrappers.inc b/net/nzbgetweb/files/lib/xmlrpc_wrappers.inc
new file mode 100644 (file)
index 0000000..1a663f0
--- /dev/null
@@ -0,0 +1,955 @@
+<?php
+/**
+ * PHP-XMLRPC "wrapper" functions
+ * Generate stubs to transparently access xmlrpc methods as php functions and viceversa
+ *
+ * @version $Id: xmlrpc_wrappers.inc,v 1.13 2008/09/20 01:23:47 ggiunta Exp $
+ * @author Gaetano Giunta
+ * @copyright (C) 2006-2009 G. Giunta
+ * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt
+ *
+ * @todo separate introspection from code generation for func-2-method wrapping
+ * @todo use some better templating system for code generation?
+ * @todo implement method wrapping with preservation of php objs in calls
+ * @todo when wrapping methods without obj rebuilding, use return_type = 'phpvals' (faster)
+ * @todo implement self-parsing of php code for PHP <= 4
+ */
+
+       // requires: xmlrpc.inc
+
+       /**
+       * Given a string defining a php type or phpxmlrpc type (loosely defined: strings
+       * accepted come from javadoc blocks), return corresponding phpxmlrpc type.
+       * NB: for php 'resource' types returns empty string, since resources cannot be serialized;
+       * for php class names returns 'struct', since php objects can be serialized as xmlrpc structs
+       * for php arrays always return array, even though arrays sometiles serialize as json structs
+       * @param string $phptype
+       * @return string
+       */
+       function php_2_xmlrpc_type($phptype)
+       {
+               switch(strtolower($phptype))
+               {
+                       case 'string':
+                               return $GLOBALS['xmlrpcString'];
+                       case 'integer':
+                       case $GLOBALS['xmlrpcInt']: // 'int'
+                       case $GLOBALS['xmlrpcI4']:
+                               return $GLOBALS['xmlrpcInt'];
+                       case 'double':
+                               return $GLOBALS['xmlrpcDouble'];
+                       case 'boolean':
+                               return $GLOBALS['xmlrpcBoolean'];
+                       case 'array':
+                               return $GLOBALS['xmlrpcArray'];
+                       case 'object':
+                               return $GLOBALS['xmlrpcStruct'];
+                       case $GLOBALS['xmlrpcBase64']:
+                       case $GLOBALS['xmlrpcStruct']:
+                               return strtolower($phptype);
+                       case 'resource':
+                               return '';
+                       default:
+                               if(class_exists($phptype))
+                               {
+                                       return $GLOBALS['xmlrpcStruct'];
+                               }
+                               else
+                               {
+                                       // unknown: might be any 'extended' xmlrpc type
+                                       return $GLOBALS['xmlrpcValue'];
+                               }
+               }
+       }
+
+       /**
+       * Given a string defining a phpxmlrpc type return corresponding php type.
+       * @param string $xmlrpctype
+       * @return string
+       */
+       function xmlrpc_2_php_type($xmlrpctype)
+       {
+               switch(strtolower($xmlrpctype))
+               {
+                       case 'base64':
+                       case 'datetime.iso8601':
+                       case 'string':
+                               return $GLOBALS['xmlrpcString'];
+                       case 'int':
+                       case 'i4':
+                               return 'integer';
+                       case 'struct':
+                       case 'array':
+                               return 'array';
+                       case 'double':
+                               return 'float';
+                       case 'undefined':
+                               return 'mixed';
+                       case 'boolean':
+                       case 'null':
+                       default:
+                               // unknown: might be any xmlrpc type
+                               return strtolower($xmlrpctype);
+               }
+       }
+
+       /**
+       * Given a user-defined PHP function, create a PHP 'wrapper' function that can
+       * be exposed as xmlrpc method from an xmlrpc_server object and called from remote
+       * clients (as well as its corresponding signature info).
+       *
+       * Since php is a typeless language, to infer types of input and output parameters,
+       * it relies on parsing the javadoc-style comment block associated with the given
+       * function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64)
+       * in the @param tag is also allowed, if you need the php function to receive/send
+       * data in that particular format (note that base64 encoding/decoding is transparently
+       * carried out by the lib, while datetime vals are passed around as strings)
+       *
+       * Known limitations:
+       * - requires PHP 5.0.3 +
+       * - only works for user-defined functions, not for PHP internal functions
+       *   (reflection does not support retrieving number/type of params for those)
+       * - functions returning php objects will generate special xmlrpc responses:
+       *   when the xmlrpc decoding of those responses is carried out by this same lib, using
+       *   the appropriate param in php_xmlrpc_decode, the php objects will be rebuilt.
+       *   In short: php objects can be serialized, too (except for their resource members),
+       *   using this function.
+       *   Other libs might choke on the very same xml that will be generated in this case
+       *   (i.e. it has a nonstandard attribute on struct element tags)
+       * - usage of javadoc @param tags using param names in a different order from the
+       *   function prototype is not considered valid (to be fixed?)
+       *
+       * Note that since rel. 2.0RC3 the preferred method to have the server call 'standard'
+       * php functions (ie. functions not expecting a single xmlrpcmsg obj as parameter)
+       * is by making use of the functions_parameters_type class member.
+       *
+       * @param string $funcname the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') and array('class', 'methodname') are ok too
+       * @param string $newfuncname (optional) name for function to be created
+       * @param array $extra_options (optional) array of options for conversion. valid values include:
+       *        bool  return_source when true, php code w. function definition will be returned, not evaluated
+       *        bool  encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects
+       *        bool  decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers ---
+       *        bool  suppress_warnings  remove from produced xml any runtime warnings due to the php function being invoked
+       * @return false on error, or an array containing the name of the new php function,
+       *         its signature and docs, to be used in the server dispatch map
+       *
+       * @todo decide how to deal with params passed by ref: bomb out or allow?
+       * @todo finish using javadoc info to build method sig if all params are named but out of order
+       * @todo add a check for params of 'resource' type
+       * @todo add some trigger_errors / error_log when returning false?
+       * @todo what to do when the PHP function returns NULL? we are currently returning an empty string value...
+       * @todo add an option to suppress php warnings in invocation of user function, similar to server debug level 3?
+       * @todo if $newfuncname is empty, we could use create_user_func instead of eval, as it is possibly faster
+       * @todo add a verbatim_object_copy parameter to allow avoiding the same obj instance?
+       */
+       function wrap_php_function($funcname, $newfuncname='', $extra_options=array())
+       {
+               $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;
+               $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';
+               $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;
+               $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;
+               $catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : '';
+
+               if(version_compare(phpversion(), '5.0.3') == -1)
+               {
+                       // up to php 5.0.3 some useful reflection methods were missing
+                       error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3');
+                       return false;
+               }
+
+        $exists = false;
+           if (is_string($funcname) && strpos($funcname, '::') !== false)
+           {
+               $funcname = explode('::', $funcname);
+           }
+        if(is_array($funcname))
+        {
+            if(count($funcname) < 2 || (!is_string($funcname[0]) && !is_object($funcname[0])))
+            {
+                       error_log('XML-RPC: syntax for function to be wrapped is wrong');
+                       return false;
+            }
+            if(is_string($funcname[0]))
+            {
+                $plainfuncname = implode('::', $funcname);
+            }
+            elseif(is_object($funcname[0]))
+            {
+                $plainfuncname = get_class($funcname[0]) . '->' . $funcname[1];
+            }
+            $exists = method_exists($funcname[0], $funcname[1]);
+            if (!$exists && version_compare(phpversion(), '5.1') < 0)
+            {
+               // workaround for php 5.0: static class methods are not seen by method_exists
+               $exists = is_callable( $funcname );
+            }
+        }
+        else
+        {
+            $plainfuncname = $funcname;
+            $exists = function_exists($funcname);
+        }
+
+               if(!$exists)
+               {
+                       error_log('XML-RPC: function to be wrapped is not defined: '.$plainfuncname);
+                       return false;
+               }
+               else
+               {
+                       // determine name of new php function
+                       if($newfuncname == '')
+                       {
+                               if(is_array($funcname))
+                               {
+                               if(is_string($funcname[0]))
+                                       $xmlrpcfuncname = "{$prefix}_".implode('_', $funcname);
+                               else
+                                       $xmlrpcfuncname = "{$prefix}_".get_class($funcname[0]) . '_' . $funcname[1];
+                               }
+                               else
+                               {
+                                       $xmlrpcfuncname = "{$prefix}_$funcname";
+                               }
+                       }
+                       else
+                       {
+                               $xmlrpcfuncname = $newfuncname;
+                       }
+                       while($buildit && function_exists($xmlrpcfuncname))
+                       {
+                               $xmlrpcfuncname .= 'x';
+                       }
+
+                       // start to introspect PHP code
+                       if(is_array($funcname))
+                       {
+                       $func = new ReflectionMethod($funcname[0], $funcname[1]);
+                       if($func->isPrivate())
+                       {
+                               error_log('XML-RPC: method to be wrapped is private: '.$plainfuncname);
+                               return false;
+                       }
+                       if($func->isProtected())
+                       {
+                               error_log('XML-RPC: method to be wrapped is protected: '.$plainfuncname);
+                               return false;
+                       }
+                       if($func->isConstructor())
+                       {
+                               error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname);
+                               return false;
+                       }
+                           // php 503 always says isdestructor = true...
+                if( version_compare(phpversion(), '5.0.3') != 0 && $func->isDestructor())
+                       {
+                               error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname);
+                               return false;
+                       }
+                       if($func->isAbstract())
+                       {
+                               error_log('XML-RPC: method to be wrapped is abstract: '.$plainfuncname);
+                               return false;
+                       }
+                /// @todo add more checks for static vs. nonstatic?
+            }
+                       else
+                       {
+                       $func = new ReflectionFunction($funcname);
+            }
+                       if($func->isInternal())
+                       {
+                               // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
+                               // instead of getparameters to fully reflect internal php functions ?
+                               error_log('XML-RPC: function to be wrapped is internal: '.$plainfuncname);
+                               return false;
+                       }
+
+                       // retrieve parameter names, types and description from javadoc comments
+
+                       // function description
+                       $desc = '';
+                       // type of return val: by default 'any'
+                       $returns = $GLOBALS['xmlrpcValue'];
+                       // desc of return val
+                       $returnsDocs = '';
+                       // type + name of function parameters
+                       $paramDocs = array();
+
+                       $docs = $func->getDocComment();
+                       if($docs != '')
+                       {
+                               $docs = explode("\n", $docs);
+                               $i = 0;
+                               foreach($docs as $doc)
+                               {
+                                       $doc = trim($doc, " \r\t/*");
+                                       if(strlen($doc) && strpos($doc, '@') !== 0 && !$i)
+                                       {
+                                               if($desc)
+                                               {
+                                                       $desc .= "\n";
+                                               }
+                                               $desc .= $doc;
+                                       }
+                                       elseif(strpos($doc, '@param') === 0)
+                                       {
+                                               // syntax: @param type [$name] desc
+                                               if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches))
+                                               {
+                                                       if(strpos($matches[1], '|'))
+                                                       {
+                                                               //$paramDocs[$i]['type'] = explode('|', $matches[1]);
+                                                               $paramDocs[$i]['type'] = 'mixed';
+                                                       }
+                                                       else
+                                                       {
+                                                               $paramDocs[$i]['type'] = $matches[1];
+                                                       }
+                                                       $paramDocs[$i]['name'] = trim($matches[2]);
+                                                       $paramDocs[$i]['doc'] = $matches[3];
+                                               }
+                                               $i++;
+                                       }
+                                       elseif(strpos($doc, '@return') === 0)
+                                       {
+                                               // syntax: @return type desc
+                                               //$returns = preg_split('/\s+/', $doc);
+                                               if(preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches))
+                                               {
+                                                       $returns = php_2_xmlrpc_type($matches[1]);
+                                                       if(isset($matches[2]))
+                                                       {
+                                                               $returnsDocs = $matches[2];
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
+                       // execute introspection of actual function prototype
+                       $params = array();
+                       $i = 0;
+                       foreach($func->getParameters() as $paramobj)
+                       {
+                               $params[$i] = array();
+                               $params[$i]['name'] = '$'.$paramobj->getName();
+                               $params[$i]['isoptional'] = $paramobj->isOptional();
+                               $i++;
+                       }
+
+
+                       // start  building of PHP code to be eval'd
+                       $innercode = '';
+                       $i = 0;
+                       $parsvariations = array();
+                       $pars = array();
+                       $pnum = count($params);
+                       foreach($params as $param)
+                       {
+                               if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != strtolower($param['name']))
+                               {
+                                       // param name from phpdoc info does not match param definition!
+                                       $paramDocs[$i]['type'] = 'mixed';
+                               }
+
+                               if($param['isoptional'])
+                               {
+                                       // this particular parameter is optional. save as valid previous list of parameters
+                                       $innercode .= "if (\$paramcount > $i) {\n";
+                                       $parsvariations[] = $pars;
+                               }
+                               $innercode .= "\$p$i = \$msg->getParam($i);\n";
+                               if ($decode_php_objects)
+                               {
+                                       $innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n";
+                               }
+                               else
+                               {
+                                       $innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i);\n";
+                               }
+
+                               $pars[] = "\$p$i";
+                               $i++;
+                               if($param['isoptional'])
+                               {
+                                       $innercode .= "}\n";
+                               }
+                               if($i == $pnum)
+                               {
+                                       // last allowed parameters combination
+                                       $parsvariations[] = $pars;
+                               }
+                       }
+
+                       $sigs = array();
+                       $psigs = array();
+                       if(count($parsvariations) == 0)
+                       {
+                               // only known good synopsis = no parameters
+                               $parsvariations[] = array();
+                               $minpars = 0;
+                       }
+                       else
+                       {
+                               $minpars = count($parsvariations[0]);
+                       }
+
+                       if($minpars)
+                       {
+                               // add to code the check for min params number
+                               // NB: this check needs to be done BEFORE decoding param values
+                               $innercode = "\$paramcount = \$msg->getNumParams();\n" .
+                               "if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode;
+                       }
+                       else
+                       {
+                               $innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode;
+                       }
+
+                       $innercode .= "\$np = false;\n";
+                       // since there are no closures in php, if we are given an object instance,
+            // we store a pointer to it in a global var...
+                       if ( is_array($funcname) && is_object($funcname[0]) )
+                       {
+                           $GLOBALS['xmlrpcWPFObjHolder'][$xmlrpcfuncname] =& $funcname[0];
+                           $innercode .= "\$obj =& \$GLOBALS['xmlrpcWPFObjHolder']['$xmlrpcfuncname'];\n";
+                           $realfuncname = '$obj->'.$funcname[1];
+                       }
+                       else
+                       {
+                       $realfuncname = $plainfuncname;
+            }
+                       foreach($parsvariations as $pars)
+                       {
+                               $innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = {$catch_warnings}$realfuncname(" . implode(',', $pars) . "); else\n";
+                               // build a 'generic' signature (only use an appropriate return type)
+                               $sig = array($returns);
+                               $psig = array($returnsDocs);
+                               for($i=0; $i < count($pars); $i++)
+                               {
+                                       if (isset($paramDocs[$i]['type']))
+                                       {
+                                               $sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']);
+                                       }
+                                       else
+                                       {
+                                               $sig[] = $GLOBALS['xmlrpcValue'];
+                                       }
+                                       $psig[] = isset($paramDocs[$i]['doc']) ? $paramDocs[$i]['doc'] : '';
+                               }
+                               $sigs[] = $sig;
+                               $psigs[] = $psig;
+                       }
+                       $innercode .= "\$np = true;\n";
+                       $innercode .= "if (\$np) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else {\n";
+                       //$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n";
+                       $innercode .= "if (is_a(\$retval, '{$prefix}resp')) return \$retval; else\n";
+                       if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64'])
+                       {
+                               $innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));";
+                       }
+                       else
+                       {
+                               if ($encode_php_objects)
+                                       $innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n";
+                               else
+                                       $innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n";
+                       }
+                       // shall we exclude functions returning by ref?
+                       // if($func->returnsReference())
+                       //      return false;
+                       $code = "function $xmlrpcfuncname(\$msg) {\n" . $innercode . "}\n}";
+                       //print_r($code);
+                       if ($buildit)
+                       {
+                               $allOK = 0;
+                               eval($code.'$allOK=1;');
+                               // alternative
+                               //$xmlrpcfuncname = create_function('$m', $innercode);
+
+                               if(!$allOK)
+                               {
+                                       error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap php function '.$plainfuncname);
+                                       return false;
+                               }
+                       }
+
+                       /// @todo examine if $paramDocs matches $parsvariations and build array for
+                       /// usage as method signature, plus put together a nice string for docs
+
+                       $ret = array('function' => $xmlrpcfuncname, 'signature' => $sigs, 'docstring' => $desc, 'signature_docs' => $psigs, 'source' => $code);
+                       return $ret;
+               }
+       }
+
+    /**
+    * Given a user-defined PHP class or php object, map its methods onto a list of
+       * PHP 'wrapper' functions that can be exposed as xmlrpc methods from an xmlrpc_server
+       * object and called from remote clients (as well as their corresponding signature info).
+       *
+    * @param mixed $classname the name of the class whose methods are to be exposed as xmlrpc methods, or an object instance of that class
+    * @param array $extra_options see the docs for wrap_php_method for more options
+    *        string method_type 'static', 'nonstatic', 'all' and 'auto' (default); the latter will switch between static and non-static depending on wheter $classname is a class name or object instance
+    * @return array or false on failure
+    *
+    * @todo get_class_methods will return both static and non-static methods.
+    *       we have to differentiate the action, depending on wheter we recived a class name or object
+    */
+    function wrap_php_class($classname, $extra_options=array())
+    {
+               $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : '';
+               $methodtype = isset($extra_options['method_type']) ? $extra_options['method_type'] : 'auto';
+
+        if(version_compare(phpversion(), '5.0.3') == -1)
+               {
+                       // up to php 5.0.3 some useful reflection methods were missing
+                       error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3');
+                       return false;
+               }
+
+        $result = array();
+               $mlist = get_class_methods($classname);
+               foreach($mlist as $mname)
+               {
+               if ($methodfilter == '' || preg_match($methodfilter, $mname))
+                       {
+                       // echo $mlist."\n";
+                       $func = new ReflectionMethod($classname, $mname);
+                       if(!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract())
+                       {
+                               if(($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) ||
+                               (!$func->isStatic && ($methodtype == 'all' || $methodtype == 'nonstatic' || ($methodtype == 'auto' && is_object($classname)))))
+                       {
+                        $methodwrap = wrap_php_function(array($classname, $mname), '', $extra_options);
+                        if ( $methodwrap )
+                        {
+                            $result[$methodwrap['function']] = $methodwrap['function'];
+                        }
+                    }
+                       }
+                       }
+               }
+        return $result;
+    }
+
+       /**
+       * Given an xmlrpc client and a method name, register a php wrapper function
+       * that will call it and return results using native php types for both
+       * params and results. The generated php function will return an xmlrpcresp
+       * oject for failed xmlrpc calls
+       *
+       * Known limitations:
+       * - server must support system.methodsignature for the wanted xmlrpc method
+       * - for methods that expose many signatures, only one can be picked (we
+       *   could in priciple check if signatures differ only by number of params
+       *   and not by type, but it would be more complication than we can spare time)
+       * - nested xmlrpc params: the caller of the generated php function has to
+       *   encode on its own the params passed to the php function if these are structs
+       *   or arrays whose (sub)members include values of type datetime or base64
+       *
+       * Notes: the connection properties of the given client will be copied
+       * and reused for the connection used during the call to the generated
+       * php function.
+       * Calling the generated php function 'might' be slow: a new xmlrpc client
+       * is created on every invocation and an xmlrpc-connection opened+closed.
+       * An extra 'debug' param is appended to param list of xmlrpc method, useful
+       * for debugging purposes.
+       *
+       * @param xmlrpc_client $client     an xmlrpc client set up correctly to communicate with target server
+       * @param string        $methodname the xmlrpc method to be mapped to a php function
+       * @param array         $extra_options array of options that specify conversion details. valid ptions include
+       *        integer       signum      the index of the method signature to use in mapping (if method exposes many sigs)
+       *        integer       timeout     timeout (in secs) to be used when executing function/calling remote method
+       *        string        protocol    'http' (default), 'http11' or 'https'
+       *        string        new_function_name the name of php function to create. If unsepcified, lib will pick an appropriate name
+       *        string        return_source if true return php code w. function definition instead fo function name
+       *        bool          encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects
+       *        bool          decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers ---
+       *        mixed         return_on_fault a php value to be returned when the xmlrpc call fails/returns a fault response (by default the xmlrpcresp object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values
+       *        bool          debug        set it to 1 or 2 to see debug results of querying server for method synopsis
+       * @return string                   the name of the generated php function (or false) - OR AN ARRAY...
+       */
+       function wrap_xmlrpc_method($client, $methodname, $extra_options=0, $timeout=0, $protocol='', $newfuncname='')
+       {
+               // mind numbing: let caller use sane calling convention (as per javadoc, 3 params),
+               // OR the 2.0 calling convention (no options) - we really love backward compat, don't we?
+               if (!is_array($extra_options))
+               {
+                       $signum = $extra_options;
+                       $extra_options = array();
+               }
+               else
+               {
+                       $signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
+                       $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
+                       $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : '';
+                       $newfuncname = isset($extra_options['new_function_name']) ? $extra_options['new_function_name'] : '';
+               }
+               //$encode_php_objects = in_array('encode_php_objects', $extra_options);
+               //$verbatim_client_copy = in_array('simple_client_copy', $extra_options) ? 1 :
+               //      in_array('build_class_code', $extra_options) ? 2 : 0;
+
+               $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;
+               $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;
+               $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int)($extra_options['simple_client_copy']) : 0;
+               $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;
+               $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';
+               if (isset($extra_options['return_on_fault']))
+               {
+                       $decode_fault = true;
+                       $fault_response = $extra_options['return_on_fault'];
+               }
+               else
+               {
+                       $decode_fault = false;
+                       $fault_response = '';
+               }
+               $debug = isset($extra_options['debug']) ? ($extra_options['debug']) : 0;
+
+               $msgclass = $prefix.'msg';
+               $valclass = $prefix.'val';
+               $decodefunc = 'php_'.$prefix.'_decode';
+
+               $msg = new $msgclass('system.methodSignature');
+               $msg->addparam(new $valclass($methodname));
+               $client->setDebug($debug);
+               $response =& $client->send($msg, $timeout, $protocol);
+               if($response->faultCode())
+               {
+                       error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname);
+                       return false;
+               }
+               else
+               {
+                       $msig = $response->value();
+                       if ($client->return_type != 'phpvals')
+                       {
+                               $msig = $decodefunc($msig);
+                       }
+                       if(!is_array($msig) || count($msig) <= $signum)
+                       {
+                               error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname);
+                               return false;
+                       }
+                       else
+                       {
+                               // pick a suitable name for the new function, avoiding collisions
+                               if($newfuncname != '')
+                               {
+                                       $xmlrpcfuncname = $newfuncname;
+                               }
+                               else
+                               {
+                                       // take care to insure that methodname is translated to valid
+                                       // php function name
+                                       $xmlrpcfuncname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
+                                               array('_', ''), $methodname);
+                               }
+                               while($buildit && function_exists($xmlrpcfuncname))
+                               {
+                                       $xmlrpcfuncname .= 'x';
+                               }
+
+                               $msig = $msig[$signum];
+                               $mdesc = '';
+                               // if in 'offline' mode, get method description too.
+                               // in online mode, favour speed of operation
+                               if(!$buildit)
+                               {
+                                       $msg = new $msgclass('system.methodHelp');
+                                       $msg->addparam(new $valclass($methodname));
+                                       $response =& $client->send($msg, $timeout, $protocol);
+                                       if (!$response->faultCode())
+                                       {
+                                               $mdesc = $response->value();
+                                               if ($client->return_type != 'phpvals')
+                                               {
+                                                       $mdesc = $mdesc->scalarval();
+                                               }
+                                       }
+                               }
+
+                               $results = build_remote_method_wrapper_code($client, $methodname,
+                                       $xmlrpcfuncname, $msig, $mdesc, $timeout, $protocol, $simple_client_copy,
+                                       $prefix, $decode_php_objects, $encode_php_objects, $decode_fault,
+                                       $fault_response);
+
+                               //print_r($code);
+                               if ($buildit)
+                               {
+                                       $allOK = 0;
+                                       eval($results['source'].'$allOK=1;');
+                                       // alternative
+                                       //$xmlrpcfuncname = create_function('$m', $innercode);
+                                       if($allOK)
+                                       {
+                                               return $xmlrpcfuncname;
+                                       }
+                                       else
+                                       {
+                                               error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname);
+                                               return false;
+                                       }
+                               }
+                               else
+                               {
+                                       $results['function'] = $xmlrpcfuncname;
+                                       return $results;
+                               }
+                       }
+               }
+       }
+
+       /**
+       * Similar to wrap_xmlrpc_method, but will generate a php class that wraps
+       * all xmlrpc methods exposed by the remote server as own methods.
+       * For more details see wrap_xmlrpc_method.
+       * @param xmlrpc_client $client the client obj all set to query the desired server
+       * @param array $extra_options list of options for wrapped code
+       * @return mixed false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriatevoption is set in extra_options)
+       */
+       function wrap_xmlrpc_server($client, $extra_options=array())
+       {
+               $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : '';
+               //$signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0;
+               $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0;
+               $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : '';
+               $newclassname = isset($extra_options['new_class_name']) ? $extra_options['new_class_name'] : '';
+               $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false;
+               $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false;
+               $verbatim_client_copy = isset($extra_options['simple_client_copy']) ? !($extra_options['simple_client_copy']) : true;
+               $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true;
+               $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc';
+
+               $msgclass = $prefix.'msg';
+               //$valclass = $prefix.'val';
+               $decodefunc = 'php_'.$prefix.'_decode';
+
+               $msg = new $msgclass('system.listMethods');
+               $response =& $client->send($msg, $timeout, $protocol);
+               if($response->faultCode())
+               {
+                       error_log('XML-RPC: could not retrieve method list from remote server');
+                       return false;
+               }
+               else
+               {
+                       $mlist = $response->value();
+                       if ($client->return_type != 'phpvals')
+                       {
+                               $mlist = $decodefunc($mlist);
+                       }
+                       if(!is_array($mlist) || !count($mlist))
+                       {
+                               error_log('XML-RPC: could not retrieve meaningful method list from remote server');
+                               return false;
+                       }
+                       else
+                       {
+                               // pick a suitable name for the new function, avoiding collisions
+                               if($newclassname != '')
+                               {
+                                       $xmlrpcclassname = $newclassname;
+                               }
+                               else
+                               {
+                                       $xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
+                                               array('_', ''), $client->server).'_client';
+                               }
+                               while($buildit && class_exists($xmlrpcclassname))
+                               {
+                                       $xmlrpcclassname .= 'x';
+                               }
+
+                               /// @todo add function setdebug() to new class, to enable/disable debugging
+                               $source = "class $xmlrpcclassname\n{\nvar \$client;\n\n";
+                               $source .= "function $xmlrpcclassname()\n{\n";
+                               $source .= build_client_wrapper_code($client, $verbatim_client_copy, $prefix);
+                               $source .= "\$this->client =& \$client;\n}\n\n";
+                               $opts = array('simple_client_copy' => 2, 'return_source' => true,
+                                       'timeout' => $timeout, 'protocol' => $protocol,
+                                       'encode_php_objs' => $encode_php_objects, 'prefix' => $prefix,
+                                       'decode_php_objs' => $decode_php_objects
+                                       );
+                               /// @todo build javadoc for class definition, too
+                               foreach($mlist as $mname)
+                               {
+                                       if ($methodfilter == '' || preg_match($methodfilter, $mname))
+                                       {
+                                               $opts['new_function_name'] = preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
+                                                       array('_', ''), $mname);
+                                               $methodwrap = wrap_xmlrpc_method($client, $mname, $opts);
+                                               if ($methodwrap)
+                                               {
+                                                       if (!$buildit)
+                                                       {
+                                                               $source .= $methodwrap['docstring'];
+                                                       }
+                                                       $source .= $methodwrap['source']."\n";
+                                               }
+                                               else
+                                               {
+                                                       error_log('XML-RPC: will not create class method to wrap remote method '.$mname);
+                                               }
+                                       }
+                               }
+                               $source .= "}\n";
+                               if ($buildit)
+                               {
+                                       $allOK = 0;
+                                       eval($source.'$allOK=1;');
+                                       // alternative
+                                       //$xmlrpcfuncname = create_function('$m', $innercode);
+                                       if($allOK)
+                                       {
+                                               return $xmlrpcclassname;
+                                       }
+                                       else
+                                       {
+                                               error_log('XML-RPC: could not create class '.$xmlrpcclassname.' to wrap remote server '.$client->server);
+                                               return false;
+                                       }
+                               }
+                               else
+                               {
+                                       return array('class' => $xmlrpcclassname, 'code' => $source, 'docstring' => '');
+                               }
+                       }
+               }
+       }
+
+       /**
+       * Given the necessary info, build php code that creates a new function to
+       * invoke a remote xmlrpc method.
+       * Take care that no full checking of input parameters is done to ensure that
+       * valid php code is emitted.
+       * Note: real spaghetti code follows...
+       * @access private
+       */
+       function build_remote_method_wrapper_code($client, $methodname, $xmlrpcfuncname,
+               $msig, $mdesc='', $timeout=0, $protocol='', $client_copy_mode=0, $prefix='xmlrpc',
+               $decode_php_objects=false, $encode_php_objects=false, $decode_fault=false,
+               $fault_response='')
+       {
+               $code = "function $xmlrpcfuncname (";
+               if ($client_copy_mode < 2)
+               {
+                       // client copy mode 0 or 1 == partial / full client copy in emitted code
+                       $innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix);
+                       $innercode .= "\$client->setDebug(\$debug);\n";
+                       $this_ = '';
+               }
+               else
+               {
+                       // client copy mode 2 == no client copy in emitted code
+                       $innercode = '';
+                       $this_ = 'this->';
+               }
+               $innercode .= "\$msg = new {$prefix}msg('$methodname');\n";
+
+               if ($mdesc != '')
+               {
+                       // take care that PHP comment is not terminated unwillingly by method description
+                       $mdesc = "/**\n* ".str_replace('*/', '* /', $mdesc)."\n";
+               }
+               else
+               {
+                       $mdesc = "/**\nFunction $xmlrpcfuncname\n";
+               }
+
+               // param parsing
+               $plist = array();
+               $pcount = count($msig);
+               for($i = 1; $i < $pcount; $i++)
+               {
+                       $plist[] = "\$p$i";
+                       $ptype = $msig[$i];
+                       if($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' ||
+                               $ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null')
+                       {
+                               // only build directly xmlrpcvals when type is known and scalar
+                               $innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n";
+                       }
+                       else
+                       {
+                               if ($encode_php_objects)
+                               {
+                                       $innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n";
+                               }
+                               else
+                               {
+                                       $innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i);\n";
+                               }
+                       }
+                       $innercode .= "\$msg->addparam(\$p$i);\n";
+                       $mdesc .= '* @param '.xmlrpc_2_php_type($ptype)." \$p$i\n";
+               }
+               if ($client_copy_mode < 2)
+               {
+                       $plist[] = '$debug=0';
+                       $mdesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
+               }
+               $plist = implode(', ', $plist);
+               $mdesc .= '* @return '.xmlrpc_2_php_type($msig[0])." (or an {$prefix}resp obj instance if call fails)\n*/\n";
+
+               $innercode .= "\$res =& \${$this_}client->send(\$msg, $timeout, '$protocol');\n";
+               if ($decode_fault)
+               {
+                       if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false)))
+                       {
+                               $respcode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $fault_response)."')";
+                       }
+                       else
+                       {
+                               $respcode = var_export($fault_response, true);
+                       }
+               }
+               else
+               {
+                       $respcode = '$res';
+               }
+               if ($decode_php_objects)
+               {
+                       $innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value(), array('decode_php_objs'));";
+               }
+               else
+               {
+                       $innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());";
+               }
+
+               $code = $code . $plist. ") {\n" . $innercode . "\n}\n";
+
+               return array('source' => $code, 'docstring' => $mdesc);
+       }
+
+       /**
+       * Given necessary info, generate php code that will rebuild a client object
+       * Take care that no full checking of input parameters is done to ensure that
+       * valid php code is emitted.
+       * @access private
+       */
+       function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc')
+       {
+               $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path).
+                       "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
+
+               // copy all client fields to the client that will be generated runtime
+               // (this provides for future expansion or subclassing of client obj)
+               if ($verbatim_client_copy)
+               {
+                       foreach($client as $fld => $val)
+                       {
+                               if($fld != 'debug' && $fld != 'return_type')
+                               {
+                                       $val = var_export($val, true);
+                                       $code .= "\$client->$fld = $val;\n";
+                               }
+                       }
+               }
+               // only make sure that client always returns the correct data type
+               $code .= "\$client->return_type = '{$prefix}vals';\n";
+               //$code .= "\$client->setDebug(\$debug);\n";
+               return $code;
+       }
+?>
\ No newline at end of file
diff --git a/net/nzbgetweb/files/lib/xmlrpcs.inc b/net/nzbgetweb/files/lib/xmlrpcs.inc
new file mode 100644 (file)
index 0000000..441dc3d
--- /dev/null
@@ -0,0 +1,1246 @@
+<?php
+// by Edd Dumbill (C) 1999-2002
+// <edd@usefulinc.com>
+// $Id: xmlrpcs.inc,v 1.71 2008/10/29 23:41:28 ggiunta Exp $
+
+// Copyright (c) 1999,2000,2002 Edd Dumbill.
+// All rights reserved.
+//
+// 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 "XML-RPC for PHP" 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
+// REGENTS 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.
+
+       // XML RPC Server class
+       // requires: xmlrpc.inc
+
+       $GLOBALS['xmlrpcs_capabilities'] = array(
+               // xmlrpc spec: always supported
+               'xmlrpc' => new xmlrpcval(array(
+                       'specUrl' => new xmlrpcval('http://www.xmlrpc.com/spec', 'string'),
+                       'specVersion' => new xmlrpcval(1, 'int')
+               ), 'struct'),
+               // if we support system.xxx functions, we always support multicall, too...
+               // Note that, as of 2006/09/17, the following URL does not respond anymore
+               'system.multicall' => new xmlrpcval(array(
+                       'specUrl' => new xmlrpcval('http://www.xmlrpc.com/discuss/msgReader$1208', 'string'),
+                       'specVersion' => new xmlrpcval(1, 'int')
+               ), 'struct'),
+               // introspection: version 2! we support 'mixed', too
+               'introspection' => new xmlrpcval(array(
+                       'specUrl' => new xmlrpcval('http://phpxmlrpc.sourceforge.net/doc-2/ch10.html', 'string'),
+                       'specVersion' => new xmlrpcval(2, 'int')
+               ), 'struct')
+       );
+
+       /* Functions that implement system.XXX methods of xmlrpc servers */
+       $_xmlrpcs_getCapabilities_sig=array(array($GLOBALS['xmlrpcStruct']));
+       $_xmlrpcs_getCapabilities_doc='This method lists all the capabilites that the XML-RPC server has: the (more or less standard) extensions to the xmlrpc spec that it adheres to';
+       $_xmlrpcs_getCapabilities_sdoc=array(array('list of capabilities, described as structs with a version number and url for the spec'));
+       function _xmlrpcs_getCapabilities($server, $m=null)
+       {
+               $outAr = $GLOBALS['xmlrpcs_capabilities'];
+               // NIL extension
+               if ($GLOBALS['xmlrpc_null_extension']) {
+                       $outAr['nil'] = new xmlrpcval(array(
+                               'specUrl' => new xmlrpcval('http://www.ontosys.com/xml-rpc/extensions.php', 'string'),
+                               'specVersion' => new xmlrpcval(1, 'int')
+                       ), 'struct');
+               }
+               return new xmlrpcresp(new xmlrpcval($outAr, 'struct'));
+       }
+
+       // listMethods: signature was either a string, or nothing.
+       // The useless string variant has been removed
+       $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray']));
+       $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
+       $_xmlrpcs_listMethods_sdoc=array(array('list of method names'));
+       function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
+       {
+
+               $outAr=array();
+               foreach($server->dmap as $key => $val)
+               {
+                       $outAr[]=new xmlrpcval($key, 'string');
+               }
+               if($server->allow_system_funcs)
+               {
+                       foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val)
+                       {
+                               $outAr[]=new xmlrpcval($key, 'string');
+                       }
+               }
+               return new xmlrpcresp(new xmlrpcval($outAr, 'array'));
+       }
+
+       $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcString']));
+       $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
+       $_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
+       function _xmlrpcs_methodSignature($server, $m)
+       {
+               // let accept as parameter both an xmlrpcval or string
+               if (is_object($m))
+               {
+                       $methName=$m->getParam(0);
+                       $methName=$methName->scalarval();
+               }
+               else
+               {
+                       $methName=$m;
+               }
+               if(strpos($methName, "system.") === 0)
+               {
+                       $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
+               }
+               else
+               {
+                       $dmap=$server->dmap; $sysCall=0;
+               }
+               if(isset($dmap[$methName]))
+               {
+                       if(isset($dmap[$methName]['signature']))
+                       {
+                               $sigs=array();
+                               foreach($dmap[$methName]['signature'] as $inSig)
+                               {
+                                       $cursig=array();
+                                       foreach($inSig as $sig)
+                                       {
+                                               $cursig[]=new xmlrpcval($sig, 'string');
+                                       }
+                                       $sigs[]=new xmlrpcval($cursig, 'array');
+                               }
+                               $r=new xmlrpcresp(new xmlrpcval($sigs, 'array'));
+                       }
+                       else
+                       {
+                               // NB: according to the official docs, we should be returning a
+                               // "none-array" here, which means not-an-array
+                               $r=new xmlrpcresp(new xmlrpcval('undef', 'string'));
+                       }
+               }
+               else
+               {
+                       $r=new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
+               }
+               return $r;
+       }
+
+       $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
+       $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
+       $_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described'));
+       function _xmlrpcs_methodHelp($server, $m)
+       {
+               // let accept as parameter both an xmlrpcval or string
+               if (is_object($m))
+               {
+                       $methName=$m->getParam(0);
+                       $methName=$methName->scalarval();
+               }
+               else
+               {
+                       $methName=$m;
+               }
+               if(strpos($methName, "system.") === 0)
+               {
+                       $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1;
+               }
+               else
+               {
+                       $dmap=$server->dmap; $sysCall=0;
+               }
+               if(isset($dmap[$methName]))
+               {
+                       if(isset($dmap[$methName]['docstring']))
+                       {
+                               $r=new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string');
+                       }
+                       else
+                       {
+                               $r=new xmlrpcresp(new xmlrpcval('', 'string'));
+                       }
+               }
+               else
+               {
+                       $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']);
+               }
+               return $r;
+       }
+
+       $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcArray']));
+       $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details';
+       $_xmlrpcs_multicall_sdoc = array(array('list of response structs, where each struct has the usual members', 'list of calls, with each call being represented as a struct, with members "methodname" and "params"'));
+       function _xmlrpcs_multicall_error($err)
+       {
+               if(is_string($err))
+               {
+                       $str = $GLOBALS['xmlrpcstr']["multicall_${err}"];
+                       $code = $GLOBALS['xmlrpcerr']["multicall_${err}"];
+               }
+               else
+               {
+                       $code = $err->faultCode();
+                       $str = $err->faultString();
+               }
+               $struct = array();
+               $struct['faultCode'] = new xmlrpcval($code, 'int');
+               $struct['faultString'] = new xmlrpcval($str, 'string');
+               return new xmlrpcval($struct, 'struct');
+       }
+
+       function _xmlrpcs_multicall_do_call($server, $call)
+       {
+               if($call->kindOf() != 'struct')
+               {
+                       return _xmlrpcs_multicall_error('notstruct');
+               }
+               $methName = @$call->structmem('methodName');
+               if(!$methName)
+               {
+                       return _xmlrpcs_multicall_error('nomethod');
+               }
+               if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string')
+               {
+                       return _xmlrpcs_multicall_error('notstring');
+               }
+               if($methName->scalarval() == 'system.multicall')
+               {
+                       return _xmlrpcs_multicall_error('recursion');
+               }
+
+               $params = @$call->structmem('params');
+               if(!$params)
+               {
+                       return _xmlrpcs_multicall_error('noparams');
+               }
+               if($params->kindOf() != 'array')
+               {
+                       return _xmlrpcs_multicall_error('notarray');
+               }
+               $numParams = $params->arraysize();
+
+               $msg = new xmlrpcmsg($methName->scalarval());
+               for($i = 0; $i < $numParams; $i++)
+               {
+                       if(!$msg->addParam($params->arraymem($i)))
+                       {
+                               $i++;
+                               return _xmlrpcs_multicall_error(new xmlrpcresp(0,
+                                       $GLOBALS['xmlrpcerr']['incorrect_params'],
+                                       $GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . $i));
+                       }
+               }
+
+               $result = $server->execute($msg);
+
+               if($result->faultCode() != 0)
+               {
+                       return _xmlrpcs_multicall_error($result);               // Method returned fault.
+               }
+
+               return new xmlrpcval(array($result->value()), 'array');
+       }
+
+       function _xmlrpcs_multicall_do_call_phpvals($server, $call)
+       {
+               if(!is_array($call))
+               {
+                       return _xmlrpcs_multicall_error('notstruct');
+               }
+               if(!array_key_exists('methodName', $call))
+               {
+                       return _xmlrpcs_multicall_error('nomethod');
+               }
+               if (!is_string($call['methodName']))
+               {
+                       return _xmlrpcs_multicall_error('notstring');
+               }
+               if($call['methodName'] == 'system.multicall')
+               {
+                       return _xmlrpcs_multicall_error('recursion');
+               }
+               if(!array_key_exists('params', $call))
+               {
+                       return _xmlrpcs_multicall_error('noparams');
+               }
+               if(!is_array($call['params']))
+               {
+                       return _xmlrpcs_multicall_error('notarray');
+               }
+
+               // this is a real dirty and simplistic hack, since we might have received a
+               // base64 or datetime values, but they will be listed as strings here...
+               $numParams = count($call['params']);
+               $pt = array();
+               foreach($call['params'] as $val)
+                       $pt[] = php_2_xmlrpc_type(gettype($val));
+
+               $result = $server->execute($call['methodName'], $call['params'], $pt);
+
+               if($result->faultCode() != 0)
+               {
+                       return _xmlrpcs_multicall_error($result);               // Method returned fault.
+               }
+
+               return new xmlrpcval(array($result->value()), 'array');
+       }
+
+       function _xmlrpcs_multicall($server, $m)
+       {
+               $result = array();
+               // let accept a plain list of php parameters, beside a single xmlrpc msg object
+               if (is_object($m))
+               {
+                       $calls = $m->getParam(0);
+                       $numCalls = $calls->arraysize();
+                       for($i = 0; $i < $numCalls; $i++)
+                       {
+                               $call = $calls->arraymem($i);
+                               $result[$i] = _xmlrpcs_multicall_do_call($server, $call);
+                       }
+               }
+               else
+               {
+                       $numCalls=count($m);
+                       for($i = 0; $i < $numCalls; $i++)
+                       {
+                               $result[$i] = _xmlrpcs_multicall_do_call_phpvals($server, $m[$i]);
+                       }
+               }
+
+               return new xmlrpcresp(new xmlrpcval($result, 'array'));
+       }
+
+       $GLOBALS['_xmlrpcs_dmap']=array(
+               'system.listMethods' => array(
+                       'function' => '_xmlrpcs_listMethods',
+                       'signature' => $_xmlrpcs_listMethods_sig,
+                       'docstring' => $_xmlrpcs_listMethods_doc,
+                       'signature_docs' => $_xmlrpcs_listMethods_sdoc),
+               'system.methodHelp' => array(
+                       'function' => '_xmlrpcs_methodHelp',
+                       'signature' => $_xmlrpcs_methodHelp_sig,
+                       'docstring' => $_xmlrpcs_methodHelp_doc,
+                       'signature_docs' => $_xmlrpcs_methodHelp_sdoc),
+               'system.methodSignature' => array(
+                       'function' => '_xmlrpcs_methodSignature',
+                       'signature' => $_xmlrpcs_methodSignature_sig,
+                       'docstring' => $_xmlrpcs_methodSignature_doc,
+                       'signature_docs' => $_xmlrpcs_methodSignature_sdoc),
+               'system.multicall' => array(
+                       'function' => '_xmlrpcs_multicall',
+                       'signature' => $_xmlrpcs_multicall_sig,
+                       'docstring' => $_xmlrpcs_multicall_doc,
+                       'signature_docs' => $_xmlrpcs_multicall_sdoc),
+               'system.getCapabilities' => array(
+                       'function' => '_xmlrpcs_getCapabilities',
+                       'signature' => $_xmlrpcs_getCapabilities_sig,
+                       'docstring' => $_xmlrpcs_getCapabilities_doc,
+                       'signature_docs' => $_xmlrpcs_getCapabilities_sdoc)
+       );
+
+       $GLOBALS['_xmlrpcs_occurred_errors'] = '';
+       $GLOBALS['_xmlrpcs_prev_ehandler'] = '';
+
+       /**
+       * Error handler used to track errors that occur during server-side execution of PHP code.
+       * This allows to report back to the client whether an internal error has occurred or not
+       * using an xmlrpc response object, instead of letting the client deal with the html junk
+       * that a PHP execution error on the server generally entails.
+       *
+       * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors.
+       *
+       */
+       function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null)
+       {
+               // obey the @ protocol
+               if (error_reporting() == 0)
+                       return;
+
+               //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING)
+               if($errcode != E_STRICT)
+               {
+                       $GLOBALS['_xmlrpcs_occurred_errors'] = $GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n";
+               }
+               // Try to avoid as much as possible disruption to the previous error handling
+               // mechanism in place
+               if($GLOBALS['_xmlrpcs_prev_ehandler'] == '')
+               {
+                       // The previous error handler was the default: all we should do is log error
+                       // to the default error log (if level high enough)
+                       if(ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errcode))
+                       {
+                               error_log($errstring);
+                       }
+               }
+               else
+               {
+                       // Pass control on to previous error handler, trying to avoid loops...
+                       if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler')
+                       {
+                               // NB: this code will NOT work on php < 4.0.2: only 2 params were used for error handlers
+                               if(is_array($GLOBALS['_xmlrpcs_prev_ehandler']))
+                               {
+                                       // the following works both with static class methods and plain object methods as error handler
+                                       call_user_func_array($GLOBALS['_xmlrpcs_prev_ehandler'], array($errcode, $errstring, $filename, $lineno, $context));
+                               }
+                               else
+                               {
+                                       $GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context);
+                               }
+                       }
+               }
+       }
+
+       $GLOBALS['_xmlrpc_debuginfo']='';
+
+       /**
+       * Add a string to the debug info that can be later seralized by the server
+       * as part of the response message.
+       * Note that for best compatbility, the debug string should be encoded using
+       * the $GLOBALS['xmlrpc_internalencoding'] character set.
+       * @param string $m
+       * @access public
+       */
+       function xmlrpc_debugmsg($m)
+       {
+               $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n";
+       }
+
+       class xmlrpc_server
+       {
+               /**
+               * Array defining php functions exposed as xmlrpc methods by this server
+               * @access private
+               */
+               var $dmap=array();
+               /**
+               * Defines how functions in dmap will be invoked: either using an xmlrpc msg object
+               * or plain php values.
+               * valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'
+               */
+               var $functions_parameters_type='xmlrpcvals';
+               /**
+               * Option used for fine-tuning the encoding the php values returned from
+               * functions registered in the dispatch map when the functions_parameters_types
+               * member is set to 'phpvals'
+               * @see php_xmlrpc_encode for a list of values
+               */
+               var $phpvals_encoding_options = array( 'auto_dates' );
+               /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3
+               var $debug = 1;
+               /**
+               * Controls behaviour of server when invoked user function throws an exception:
+               * 0 = catch it and return an 'internal error' xmlrpc response (default)
+               * 1 = catch it and return an xmlrpc response with the error corresponding to the exception
+               * 2 = allow the exception to float to the upper layers
+               */
+               var $exception_handling = 0;
+               /**
+               * When set to true, it will enable HTTP compression of the response, in case
+               * the client has declared its support for compression in the request.
+               */
+               var $compress_response = false;
+               /**
+               * List of http compression methods accepted by the server for requests.
+               * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib
+               */
+               var $accepted_compression = array();
+               /// shall we serve calls to system.* methods?
+               var $allow_system_funcs = true;
+               /// list of charset encodings natively accepted for requests
+               var $accepted_charset_encodings = array();
+               /**
+               * charset encoding to be used for response.
+               * NB: if we can, we will convert the generated response from internal_encoding to the intended one.
+               * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled),
+               * null (leave unspecified in response, convert output stream to US_ASCII),
+               * 'default' (use xmlrpc library default as specified in xmlrpc.inc, convert output stream if needed),
+               * or 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway).
+               * NB: pretty dangerous if you accept every charset and do not have mbstring enabled)
+               */
+               var $response_charset_encoding = '';
+               /**
+               * Storage for internal debug info
+               * @access private
+               */
+               var $debug_info = '';
+               /**
+               * Extra data passed at runtime to method handling functions. Used only by EPI layer
+               */
+               var $user_data = null;
+
+               /**
+               * @param array $dispmap the dispatch map withd efinition of exposed services
+               * @param boolean $servicenow set to false to prevent the server from runnung upon construction
+               */
+               function xmlrpc_server($dispMap=null, $serviceNow=true)
+               {
+                       // if ZLIB is enabled, let the server by default accept compressed requests,
+                       // and compress responses sent to clients that support them
+                       if(function_exists('gzinflate'))
+                       {
+                               $this->accepted_compression = array('gzip', 'deflate');
+                               $this->compress_response = true;
+                       }
+
+                       // by default the xml parser can support these 3 charset encodings
+                       $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');
+
+                       // dispMap is a dispatch array of methods
+                       // mapped to function names and signatures
+                       // if a method
+                       // doesn't appear in the map then an unknown
+                       // method error is generated
+                       /* milosch - changed to make passing dispMap optional.
+                        * instead, you can use the class add_to_map() function
+                        * to add functions manually (borrowed from SOAPX4)
+                        */
+                       if($dispMap)
+                       {
+                               $this->dmap = $dispMap;
+                               if($serviceNow)
+                               {
+                                       $this->service();
+                               }
+                       }
+               }
+
+               /**
+               * Set debug level of server.
+               * @param integer $in debug lvl: determines info added to xmlrpc responses (as xml comments)
+               * 0 = no debug info,
+               * 1 = msgs set from user with debugmsg(),
+               * 2 = add complete xmlrpc request (headers and body),
+               * 3 = add also all processing warnings happened during method processing
+               * (NB: this involves setting a custom error handler, and might interfere
+               * with the standard processing of the php function exposed as method. In
+               * particular, triggering an USER_ERROR level error will not halt script
+               * execution anymore, but just end up logged in the xmlrpc response)
+               * Note that info added at elevel 2 and 3 will be base64 encoded
+               * @access public
+               */
+               function setDebug($in)
+               {
+                       $this->debug=$in;
+               }
+
+               /**
+               * Return a string with the serialized representation of all debug info
+               * @param string $charset_encoding the target charset encoding for the serialization
+               * @return string an XML comment (or two)
+               */
+               function serializeDebug($charset_encoding='')
+               {
+                       // Tough encoding problem: which internal charset should we assume for debug info?
+                       // It might contain a copy of raw data received from client, ie with unknown encoding,
+                       // intermixed with php generated data and user generated data...
+                       // so we split it: system debug is base 64 encoded,
+                       // user debug info should be encoded by the end user using the INTERNAL_ENCODING
+                       $out = '';
+                       if ($this->debug_info != '')
+                       {
+                               $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
+                       }
+                       if($GLOBALS['_xmlrpc_debuginfo']!='')
+                       {
+
+                               $out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n";
+                               // NB: a better solution MIGHT be to use CDATA, but we need to insert it
+                               // into return payload AFTER the beginning tag
+                               //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n";
+                       }
+                       return $out;
+               }
+
+               /**
+               * Execute the xmlrpc request, printing the response
+               * @param string $data the request body. If null, the http POST request will be examined
+               * @return xmlrpcresp the response object (usually not used by caller...)
+               * @access public
+               */
+               function service($data=null, $return_payload=false)
+               {
+                       if ($data === null)
+                       {
+                               // workaround for a known bug in php ver. 5.2.2 that broke $HTTP_RAW_POST_DATA
+                               $ver = phpversion();
+                               if ($ver[0] >= 5)
+                               {
+                                       $data = file_get_contents('php://input');
+                               }
+                               else
+                               {
+                                       $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
+                               }
+                       }
+                       $raw_data = $data;
+
+                       // reset internal debug info
+                       $this->debug_info = '';
+
+                       // Echo back what we received, before parsing it
+                       if($this->debug > 1)
+                       {
+                               $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
+                       }
+
+                       $r = $this->parseRequestHeaders($data, $req_charset, $resp_charset, $resp_encoding);
+                       if (!$r)
+                       {
+                               $r=$this->parseRequest($data, $req_charset);
+                       }
+
+                       // save full body of request into response, for more debugging usages
+                       $r->raw_data = $raw_data;
+
+                       if($this->debug > 2 && $GLOBALS['_xmlrpcs_occurred_errors'])
+                       {
+                               $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
+                                       $GLOBALS['_xmlrpcs_occurred_errors'] . "+++END+++");
+                       }
+
+                       $payload=$this->xml_header($resp_charset);
+                       if($this->debug > 0)
+                       {
+                               $payload = $payload . $this->serializeDebug($resp_charset);
+                       }
+
+                       // G. Giunta 2006-01-27: do not create response serialization if it has
+                       // already happened. Helps building json magic
+                       if (empty($r->payload))
+                       {
+                               $r->serialize($resp_charset);
+                       }
+                       $payload = $payload . $r->payload;
+
+                       if ($return_payload)
+                       {
+                               return $payload;
+                       }
+
+                       // if we get a warning/error that has output some text before here, then we cannot
+                       // add a new header. We cannot say we are sending xml, either...
+                       if(!headers_sent())
+                       {
+                               header('Content-Type: '.$r->content_type);
+                               // we do not know if client actually told us an accepted charset, but if he did
+                               // we have to tell him what we did
+                               header("Vary: Accept-Charset");
+
+                               // http compression of output: only
+                               // if we can do it, and we want to do it, and client asked us to,
+                               // and php ini settings do not force it already
+                               $php_no_self_compress = !ini_get('zlib.output_compression') && (ini_get('output_handler') != 'ob_gzhandler');
+                               if($this->compress_response && function_exists('gzencode') && $resp_encoding != ''
+                                       && $php_no_self_compress)
+                               {
+                                       if(strpos($resp_encoding, 'gzip') !== false)
+                                       {
+                                               $payload = gzencode($payload);
+                                               header("Content-Encoding: gzip");
+                                               header("Vary: Accept-Encoding");
+                                       }
+                                       elseif (strpos($resp_encoding, 'deflate') !== false)
+                                       {
+                                               $payload = gzcompress($payload);
+                                               header("Content-Encoding: deflate");
+                                               header("Vary: Accept-Encoding");
+                                       }
+                               }
+
+                               // do not ouput content-length header if php is compressing output for us:
+                               // it will mess up measurements
+                               if($php_no_self_compress)
+                               {
+                                       header('Content-Length: ' . (int)strlen($payload));
+                               }
+                       }
+                       else
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
+                       }
+
+                       print $payload;
+
+                       // return request, in case subclasses want it
+                       return $r;
+               }
+
+               /**
+               * Add a method to the dispatch map
+               * @param string $methodname the name with which the method will be made available
+               * @param string $function the php function that will get invoked
+               * @param array $sig the array of valid method signatures
+               * @param string $doc method documentation
+               * @param array $sigdoc the array of valid method signatures docs (one string per param, one for return type)
+               * @access public
+               */
+               function add_to_map($methodname,$function,$sig=null,$doc=false,$sigdoc=false)
+               {
+                       $this->dmap[$methodname] = array(
+                               'function'      => $function,
+                               'docstring' => $doc
+                       );
+                       if ($sig)
+                       {
+                               $this->dmap[$methodname]['signature'] = $sig;
+                       }
+                       if ($sigdoc)
+                       {
+                               $this->dmap[$methodname]['signature_docs'] = $sigdoc;
+                       }
+               }
+
+               /**
+               * Verify type and number of parameters received against a list of known signatures
+               * @param array $in array of either xmlrpcval objects or xmlrpc type definitions
+               * @param array $sig array of known signatures to match against
+               * @access private
+               */
+               function verifySignature($in, $sig)
+               {
+                       // check each possible signature in turn
+                       if (is_object($in))
+                       {
+                               $numParams = $in->getNumParams();
+                       }
+                       else
+                       {
+                               $numParams = count($in);
+                       }
+                       foreach($sig as $cursig)
+                       {
+                               if(count($cursig)==$numParams+1)
+                               {
+                                       $itsOK=1;
+                                       for($n=0; $n<$numParams; $n++)
+                                       {
+                                               if (is_object($in))
+                                               {
+                                                       $p=$in->getParam($n);
+                                                       if($p->kindOf() == 'scalar')
+                                                       {
+                                                               $pt=$p->scalartyp();
+                                                       }
+                                                       else
+                                                       {
+                                                               $pt=$p->kindOf();
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $pt= $in[$n] == 'i4' ? 'int' : strtolower($in[$n]); // dispatch maps never use i4...
+                                               }
+
+                                               // param index is $n+1, as first member of sig is return type
+                                               if($pt != $cursig[$n+1] && $cursig[$n+1] != $GLOBALS['xmlrpcValue'])
+                                               {
+                                                       $itsOK=0;
+                                                       $pno=$n+1;
+                                                       $wanted=$cursig[$n+1];
+                                                       $got=$pt;
+                                                       break;
+                                               }
+                                       }
+                                       if($itsOK)
+                                       {
+                                               return array(1,'');
+                                       }
+                               }
+                       }
+                       if(isset($wanted))
+                       {
+                               return array(0, "Wanted ${wanted}, got ${got} at param ${pno}");
+                       }
+                       else
+                       {
+                               return array(0, "No method signature matches number of parameters");
+                       }
+               }
+
+               /**
+               * Parse http headers received along with xmlrpc request. If needed, inflate request
+               * @return null on success or an xmlrpcresp
+               * @access private
+               */
+               function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression)
+               {
+                       // check if $_SERVER is populated: it might have been disabled via ini file
+                       // (this is true even when in CLI mode)
+                       if (count($_SERVER) == 0)
+                       {
+                               error_log('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
+                       }
+
+                       if($this->debug > 1)
+                       {
+                               if(function_exists('getallheaders'))
+                               {
+                                       $this->debugmsg(''); // empty line
+                                       foreach(getallheaders() as $name => $val)
+                                       {
+                                               $this->debugmsg("HEADER: $name: $val");
+                                       }
+                               }
+
+                       }
+
+                       if(isset($_SERVER['HTTP_CONTENT_ENCODING']))
+                       {
+                               $content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
+                       }
+                       else
+                       {
+                               $content_encoding = '';
+                       }
+
+                       // check if request body has been compressed and decompress it
+                       if($content_encoding != '' && strlen($data))
+                       {
+                               if($content_encoding == 'deflate' || $content_encoding == 'gzip')
+                               {
+                                       // if decoding works, use it. else assume data wasn't gzencoded
+                                       if(function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression))
+                                       {
+                                               if($content_encoding == 'deflate' && $degzdata = @gzuncompress($data))
+                                               {
+                                                       $data = $degzdata;
+                                                       if($this->debug > 1)
+                                                       {
+                                                               $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
+                                                       }
+                                               }
+                                               elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
+                                               {
+                                                       $data = $degzdata;
+                                                       if($this->debug > 1)
+                                                               $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++");
+                                               }
+                                               else
+                                               {
+                                                       $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']);
+                                                       return $r;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
+                                               $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']);
+                                               return $r;
+                                       }
+                               }
+                       }
+
+                       // check if client specified accepted charsets, and if we know how to fulfill
+                       // the request
+                       if ($this->response_charset_encoding == 'auto')
+                       {
+                               $resp_encoding = '';
+                               if (isset($_SERVER['HTTP_ACCEPT_CHARSET']))
+                               {
+                                       // here we should check if we can match the client-requested encoding
+                                       // with the encodings we know we can generate.
+                                       /// @todo we should parse q=0.x preferences instead of getting first charset specified...
+                                       $client_accepted_charsets = explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
+                                       // Give preference to internal encoding
+                                       $known_charsets = array($GLOBALS['xmlrpc_internalencoding'], 'UTF-8', 'ISO-8859-1', 'US-ASCII');
+                                       foreach ($known_charsets as $charset)
+                                       {
+                                               foreach ($client_accepted_charsets as $accepted)
+                                                       if (strpos($accepted, $charset) === 0)
+                                                       {
+                                                               $resp_encoding = $charset;
+                                                               break;
+                                                       }
+                                               if ($resp_encoding)
+                                                       break;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $resp_encoding = $this->response_charset_encoding;
+                       }
+
+                       if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
+                       {
+                               $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
+                       }
+                       else
+                       {
+                               $resp_compression = '';
+                       }
+
+                       // 'guestimate' request encoding
+                       /// @todo check if mbstring is enabled and automagic input conversion is on: it might mingle with this check???
+                       $req_encoding = guess_encoding(isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '',
+                               $data);
+
+                       return null;
+               }
+
+               /**
+               * Parse an xml chunk containing an xmlrpc request and execute the corresponding
+               * php function registered with the server
+               * @param string $data the xml request
+               * @param string $req_encoding (optional) the charset encoding of the xml request
+               * @return xmlrpcresp
+               * @access private
+               */
+               function parseRequest($data, $req_encoding='')
+               {
+                       // 2005/05/07 commented and moved into caller function code
+                       //if($data=='')
+                       //{
+                       //      $data=$GLOBALS['HTTP_RAW_POST_DATA'];
+                       //}
+
+                       // G. Giunta 2005/02/13: we do NOT expect to receive html entities
+                       // so we do not try to convert them into xml character entities
+                       //$data = xmlrpc_html_entity_xlate($data);
+
+                       $GLOBALS['_xh']=array();
+                       $GLOBALS['_xh']['ac']='';
+                       $GLOBALS['_xh']['stack']=array();
+                       $GLOBALS['_xh']['valuestack'] = array();
+                       $GLOBALS['_xh']['params']=array();
+                       $GLOBALS['_xh']['pt']=array();
+                       $GLOBALS['_xh']['isf']=0;
+                       $GLOBALS['_xh']['isf_reason']='';
+                       $GLOBALS['_xh']['method']=false; // so we can check later if we got a methodname or not
+                       $GLOBALS['_xh']['rt']='';
+
+                       // decompose incoming XML into request structure
+                       if ($req_encoding != '')
+                       {
+                               if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                               // the following code might be better for mb_string enabled installs, but
+                               // makes the lib about 200% slower...
+                               //if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                               {
+                                       error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$req_encoding);
+                                       $req_encoding = $GLOBALS['xmlrpc_defencoding'];
+                               }
+                               /// @BUG this will fail on PHP 5 if charset is not specified in the xml prologue,
+                               // the encoding is not UTF8 and there are non-ascii chars in the text...
+                               /// @todo use an ampty string for php 5 ???
+                               $parser = xml_parser_create($req_encoding);
+                       }
+                       else
+                       {
+                               $parser = xml_parser_create();
+                       }
+
+                       xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
+                       // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
+                       // the xml parser to give us back data in the expected charset
+                       // What if internal encoding is not in one of the 3 allowed?
+                       // we use the broadest one, ie. utf8
+                       // This allows to send data which is native in various charset,
+                       // by extending xmlrpc_encode_entitites() and setting xmlrpc_internalencoding
+                       if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+                       {
+                               xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
+                       }
+                       else
+                       {
+                               xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
+                       }
+
+                       if ($this->functions_parameters_type != 'xmlrpcvals')
+                               xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
+                       else
+                               xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
+                       xml_set_character_data_handler($parser, 'xmlrpc_cd');
+                       xml_set_default_handler($parser, 'xmlrpc_dh');
+                       if(!xml_parse($parser, $data, 1))
+                       {
+                               // return XML error as a faultCode
+                               $r=new xmlrpcresp(0,
+                               $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser),
+                               sprintf('XML error: %s at line %d, column %d',
+                                       xml_error_string(xml_get_error_code($parser)),
+                                       xml_get_current_line_number($parser), xml_get_current_column_number($parser)));
+                               xml_parser_free($parser);
+                       }
+                       elseif ($GLOBALS['_xh']['isf'])
+                       {
+                               xml_parser_free($parser);
+                               $r=new xmlrpcresp(0,
+                                       $GLOBALS['xmlrpcerr']['invalid_request'],
+                                       $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']);
+                       }
+                       else
+                       {
+                               xml_parser_free($parser);
+                               // small layering violation in favor of speed and memory usage:
+                               // we should allow the 'execute' method handle this, but in the
+                               // most common scenario (xmlrpcvals type server with some methods
+                               // registered as phpvals) that would mean a useless encode+decode pass
+                               if ($this->functions_parameters_type != 'xmlrpcvals' || (isset($this->dmap[$GLOBALS['_xh']['method']]['parameters_type']) && ($this->dmap[$GLOBALS['_xh']['method']]['parameters_type'] == 'phpvals')))
+                               {
+                                       if($this->debug > 1)
+                                       {
+                                               $this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++");
+                                       }
+                                       $r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']);
+                               }
+                               else
+                               {
+                                       // build an xmlrpcmsg object with data parsed from xml
+                                       $m=new xmlrpcmsg($GLOBALS['_xh']['method']);
+                                       // now add parameters in
+                                       for($i=0; $i<count($GLOBALS['_xh']['params']); $i++)
+                                       {
+                                               $m->addParam($GLOBALS['_xh']['params'][$i]);
+                                       }
+
+                                       if($this->debug > 1)
+                                       {
+                                               $this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++");
+                                       }
+                                       $r = $this->execute($m);
+                               }
+                       }
+                       return $r;
+               }
+
+               /**
+               * Execute a method invoked by the client, checking parameters used
+               * @param mixed $m either an xmlrpcmsg obj or a method name
+               * @param array $params array with method parameters as php types (if m is method name only)
+               * @param array $paramtypes array with xmlrpc types of method parameters (if m is method name only)
+               * @return xmlrpcresp
+               * @access private
+               */
+               function execute($m, $params=null, $paramtypes=null)
+               {
+                       if (is_object($m))
+                       {
+                               $methName = $m->method();
+                       }
+                       else
+                       {
+                               $methName = $m;
+                       }
+                       $sysCall = $this->allow_system_funcs && (strpos($methName, "system.") === 0);
+                       $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap;
+
+                       if(!isset($dmap[$methName]['function']))
+                       {
+                               // No such method
+                               return new xmlrpcresp(0,
+                                       $GLOBALS['xmlrpcerr']['unknown_method'],
+                                       $GLOBALS['xmlrpcstr']['unknown_method']);
+                       }
+
+                       // Check signature
+                       if(isset($dmap[$methName]['signature']))
+                       {
+                               $sig = $dmap[$methName]['signature'];
+                               if (is_object($m))
+                               {
+                                       list($ok, $errstr) = $this->verifySignature($m, $sig);
+                               }
+                               else
+                               {
+                                       list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
+                               }
+                               if(!$ok)
+                               {
+                                       // Didn't match.
+                                       return new xmlrpcresp(
+                                               0,
+                                               $GLOBALS['xmlrpcerr']['incorrect_params'],
+                                               $GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"
+                                       );
+                               }
+                       }
+
+                       $func = $dmap[$methName]['function'];
+                       // let the 'class::function' syntax be accepted in dispatch maps
+                       if(is_string($func) && strpos($func, '::'))
+                       {
+                               $func = explode('::', $func);
+                       }
+                       // verify that function to be invoked is in fact callable
+                       if(!is_callable($func))
+                       {
+                               error_log("XML-RPC: ".__METHOD__.": function $func registered as method handler is not callable");
+                               return new xmlrpcresp(
+                                       0,
+                                       $GLOBALS['xmlrpcerr']['server_error'],
+                                       $GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method"
+                               );
+                       }
+
+                       // If debug level is 3, we should catch all errors generated during
+                       // processing of user function, and log them as part of response
+                       if($this->debug > 2)
+                       {
+                               $GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler');
+                       }
+                       try
+                       {
+                               // Allow mixed-convention servers
+                               if (is_object($m))
+                               {
+                                       if($sysCall)
+                                       {
+                                               $r = call_user_func($func, $this, $m);
+                                       }
+                                       else
+                                       {
+                                               $r = call_user_func($func, $m);
+                                       }
+                                       if (!is_a($r, 'xmlrpcresp'))
+                                       {
+                                               error_log("XML-RPC: ".__METHOD__.": function $func registered as method handler does not return an xmlrpcresp object");
+                                               if (is_a($r, 'xmlrpcval'))
+                                               {
+                                                       $r = new xmlrpcresp($r);
+                                               }
+                                               else
+                                               {
+                                                       $r = new xmlrpcresp(
+                                                               0,
+                                                               $GLOBALS['xmlrpcerr']['server_error'],
+                                                               $GLOBALS['xmlrpcstr']['server_error'] . ": function does not return xmlrpcresp object"
+                                                       );
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       // call a 'plain php' function
+                                       if($sysCall)
+                                       {
+                                               array_unshift($params, $this);
+                                               $r = call_user_func_array($func, $params);
+                                       }
+                                       else
+                                       {
+                                               // 3rd API convention for method-handling functions: EPI-style
+                                               if ($this->functions_parameters_type == 'epivals')
+                                               {
+                                                       $r = call_user_func_array($func, array($methName, $params, $this->user_data));
+                                                       // mimic EPI behaviour: if we get an array that looks like an error, make it
+                                                       // an eror response
+                                                       if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))
+                                                       {
+                                                               $r = new xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);
+                                                       }
+                                                       else
+                                                       {
+                                                               // functions using EPI api should NOT return resp objects,
+                                                               // so make sure we encode the return type correctly
+                                                               $r = new xmlrpcresp(php_xmlrpc_encode($r, array('extension_api')));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $r = call_user_func_array($func, $params);
+                                               }
+                                       }
+                                       // the return type can be either an xmlrpcresp object or a plain php value...
+                                       if (!is_a($r, 'xmlrpcresp'))
+                                       {
+                                               // what should we assume here about automatic encoding of datetimes
+                                               // and php classes instances???
+                                               $r = new xmlrpcresp(php_xmlrpc_encode($r, $this->phpvals_encoding_options));
+                                       }
+                               }
+                       }
+                       catch(Exception $e)
+                       {
+                               // (barring errors in the lib) an uncatched exception happened
+                               // in the called function, we wrap it in a proper error-response
+                               switch($this->exception_handling)
+                               {
+                                       case 2:
+                                               throw $e;
+                                               break;
+                                       case 1:
+                                               $r = new xmlrpcresp(0, $e->getCode(), $e->getMessage());
+                                               break;
+                                       default:
+                                               $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_error'], $GLOBALS['xmlrpcstr']['server_error']);
+                               }
+                       }
+                       if($this->debug > 2)
+                       {
+                               // note: restore the error handler we found before calling the
+                               // user func, even if it has been changed inside the func itself
+                               if($GLOBALS['_xmlrpcs_prev_ehandler'])
+                               {
+                                       set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
+                               }
+                               else
+                               {
+                                       restore_error_handler();
+                               }
+                       }
+                       return $r;
+               }
+
+               /**
+               * add a string to the 'internal debug message' (separate from 'user debug message')
+               * @param string $strings
+               * @access private
+               */
+               function debugmsg($string)
+               {
+                       $this->debug_info .= $string."\n";
+               }
+
+               /**
+               * @access private
+               */
+               function xml_header($charset_encoding='')
+               {
+                       if ($charset_encoding != '')
+                       {
+                               return "<?xml version=\"1.0\" encoding=\"$charset_encoding\"?" . ">\n";
+                       }
+                       else
+                       {
+                               return "<?xml version=\"1.0\"?" . ">\n";
+                       }
+               }
+
+               /**
+               * A debugging routine: just echoes back the input packet as a string value
+               * DEPRECATED!
+               */
+               function echoInput()
+               {
+                       $r=new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string'));
+                       print $r->serialize();
+               }
+       }
+?>
\ No newline at end of file
diff --git a/net/obfsproxy/Makefile b/net/obfsproxy/Makefile
new file mode 100644 (file)
index 0000000..c0800ce
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2012 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:=obfsproxy
+PKG_VERSION:=0.1.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://www.torproject.org/dist/obfsproxy \
+        https://archive.torproject.org/tor-package-archive/obfsproxy
+PKG_MD5SUM:=d3b898b1f5ea21c611bceaeb3c20e0d7
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/obfsproxy
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=A pluggable transports proxy
+  URL:=https://www.torproject.org/projects/obfsproxy
+  DEPENDS:=+libevent2 +libopenssl
+endef
+
+define Package/obfsproxy/description
+  obfsproxy is a tool that attempts to circumvent censorship, by transforming
+  the Tor traffic between the client and the bridge. This way, censors, who
+  usually monitor traffic between the client and the bridge, will see
+  innocent-looking transformed traffic instead of the actual Tor traffic.
+endef
+
+define Package/obfsproxy/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/obfsproxy $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,obfsproxy))
diff --git a/net/obfsproxy/patches/001-no-werror.patch b/net/obfsproxy/patches/001-no-werror.patch
new file mode 100644 (file)
index 0000000..87b60f7
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,5 +1,5 @@
+ ACLOCAL_AMFLAGS = -I m4
+-WARNINGS = -Wall -Wwrite-strings -Werror
++WARNINGS = -Wall -Wwrite-strings
+ AM_CPPFLAGS = -I. -I$(srcdir)/src
+ AM_CFLAGS = $(WARNINGS) @libevent_CFLAGS@ @libcrypto_CFLAGS@
+ LDADD = libobfsproxy.a @libevent_LIBS@ @libcrypto_LIBS@ @ws32_LIBS@
diff --git a/net/obfsproxy/patches/002-no-build-hardening.patch b/net/obfsproxy/patches/002-no-build-hardening.patch
new file mode 100644 (file)
index 0000000..795c7f2
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -23,9 +23,6 @@ AC_CHECK_HEADERS([sys/socket.h])
+ AC_CHECK_HEADERS([sys/types.h])
+ AC_CHECK_HEADERS([netinet/in.h])
+-### Compiler Hardening ###
+-AX_ENABLE_HARDENING
+-
+ ### Libraries ###
+ PKG_CHECK_MODULES([libevent], [libevent >= 2.0])
diff --git a/net/oidentd/Makefile b/net/oidentd/Makefile
new file mode 100644 (file)
index 0000000..8cebb1d
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# 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:=oidentd
+PKG_VERSION:=2.0.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ojnk
+PKG_MD5SUM:=c3d9a56255819ef8904b867284386911
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/oidentd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Identd server
+  URL:=http://dev.ojnk.net/
+endef
+
+define Package/oidentd/description
+       A nat aware identd server that will correctly forwared requests to clients.
+endef
+
+# uses GNU configure
+
+define Build/Compile
+       $(call Build/Compile/Default,all)
+endef
+
+define Package/oidentd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/src/oidentd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/oidentd.init $(1)/etc/init.d/oidentd
+endef
+
+$(eval $(call BuildPackage,oidentd))
diff --git a/net/oidentd/files/oidentd.init b/net/oidentd/files/oidentd.init
new file mode 100644 (file)
index 0000000..4b4f309
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=85
+
+start() {
+       service_start /usr/sbin/oidentd -m -f 113
+}
+
+stop() {
+       service_stop /usr/sbin/oidentd
+}
diff --git a/net/opendchub/Makefile b/net/opendchub/Makefile
new file mode 100644 (file)
index 0000000..a6ef84e
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006-2010 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:=opendchub
+PKG_VERSION:=0.8.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/opendchub
+PKG_MD5SUM:=e812ac26323f3a8113ce1a0761ce9544
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/opendchub
+  SUBMENU:=P2P
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl +libpthread
+  TITLE:=software for the Direct Connect network
+  URL:=http://opendchub.sourceforge.net/
+endef
+
+define Package/opendchub/description
+       Open DC hub is a Unix/Linux version of the hub software
+       for the Direct Connect network
+endef
+
+CONFIGURE_ARGS += \
+       --disable-perl \
+
+define Package/opendchub/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/opendchub $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,opendchub))
diff --git a/net/openl2tp/Makefile b/net/openl2tp/Makefile
new file mode 100644 (file)
index 0000000..fcb2962
--- /dev/null
@@ -0,0 +1,128 @@
+#
+# Copyright (C) 2009-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=openl2tp
+PKG_VERSION:=1.8
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/openl2tp
+PKG_MD5SUM:=e3d08dedfb9e6a9a1e24f6766f6dadd0
+
+PKG_BUILD_DEPENDS:=libreadline libncurses USE_UCLIBC:librpc
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+PPPD_VERSION:=2.4.5
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openl2tp/Default
+  SUBMENU:=VPN
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon
+  URL:=http://www.openl2tp.org/
+  PROVIDES:=openl2tp
+  DEPENDS:=+ppp-mod-pppol2tp
+endef
+
+define Package/openl2tp/description/Default
+ OpenL2TP is an open source L2TP client/server, written by Katalix Systems
+ specifically for Linux. It has been designed for use as an enterprise
+ L2TP VPN server or in commercial, Linux-based, embedded networking
+ products and is able to support hundreds of sessions, each with different
+ configuration.
+endef
+
+
+define Package/openl2tp-full
+$(call Package/openl2tp/Default)
+  TITLE+=(full)
+  VARIANT:=full
+  DEPENDS+=+portmap +libreadline +libncurses $(LIBRPC_DEPENDS)
+endef
+
+define Package/openl2tp-full/description
+$(call Package/openl2tp/description/Default)
+ .
+ This package a full-featured, RPC-enabled OpenL2TP.
+endef
+
+
+define Package/openl2tp-mini
+$(call Package/openl2tp/Default)
+  TITLE+=(mini)
+  VARIANT:=mini
+endef
+
+define Package/openl2tp-mini/description
+$(call Package/openl2tp/description/Default)
+ .
+ This package a minimal-featured, RPC-disabled OpenL2TP.
+endef
+
+
+MAKE_FLAGS+= \
+       KERNEL_SRCDIR="$(LINUX_DIR)" \
+       KERNEL_BLDDIR="$(LINUX_DIR)" \
+       PPPD_VERSION="$(PKG_PPPD_VERSION)" \
+       READLINE_DIR="$(STAGING_DIR)/usr" \
+       PPPD_SRCDIR="$(STAGING_DIR)/usr/include" \
+       PPPD_LIBDIR="$(STAGING_DIR)/usr/lib" \
+       CFLAGS.optimize="$(TARGET_CFLAGS)" \
+       CPPFLAGS-y="-I$(STAGING_DIR)/usr/include" \
+       L2TP_FEATURE_LOCAL_CONF_FILE=y \
+       CROSS_COMPILE="$(TARGET_CROSS)" \
+
+ifeq ($(BUILD_VARIANT),full)
+
+  MAKE_FLAGS += \
+       L2TP_FEATURE_RPC_MANAGEMENT=y \
+       L2TP_FEATURE_LOCAL_STAT_FILE=y \
+       LIBS.dmalloc="-L$(STAGING_DIR)/usr/lib $(LIBRPC)" \
+
+endif
+ifeq ($(BUILD_VARIANT),mini)
+
+  MAKE_FLAGS += \
+       L2TP_FEATURE_RPC_MANAGEMENT= \
+       L2TP_FEATURE_LOCAL_STAT_FILE= \
+
+endif
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(CP) ./src/*.[ch] $(PKG_BUILD_DIR)/
+endef
+
+define Package/openl2tp-full/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/l2tpconfig  $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openl2tpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PPPD_VERSION)
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pppd/openl2tp.so $(1)/usr/lib/pppd/$(PPPD_VERSION)/
+       $(INSTALL_DIR) $(1)/usr/lib/openl2tp
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/event_sock.so $(1)/usr/lib/openl2tp/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ipsec.so $(1)/usr/lib/openl2tp/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ppp_null.so $(1)/usr/lib/openl2tp/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ppp_unix.so $(1)/usr/lib/openl2tp/
+endef
+
+define Package/openl2tp-mini/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openl2tpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/openl2tp
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ipsec.so $(1)/usr/lib/openl2tp/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/plugins/ppp_unix.so $(1)/usr/lib/openl2tp/
+endef
+
+$(eval $(call BuildPackage,openl2tp-full))
+$(eval $(call BuildPackage,openl2tp-mini))
diff --git a/net/openl2tp/patches/001-makefile.patch b/net/openl2tp/patches/001-makefile.patch
new file mode 100644 (file)
index 0000000..cae8e8e
--- /dev/null
@@ -0,0 +1,70 @@
+--- a/Makefile
++++ b/Makefile
+@@ -158,7 +158,7 @@ CFLAGS=                    -I. -Iusl -Icli -isystem inclu
+                               $(CPPFLAGS) $(CPPFLAGS.dmalloc) \
+                               -DSYS_LIBDIR=$(SYS_LIBDIR)
+ LDFLAGS.l2tpd=                -Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
+-LDFLAGS.l2tpconfig=   -Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
++LDFLAGS.l2tpconfig=   -Lcli -lcli -lreadline -lncurses $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
+ OPT_CFLAGS?=          -O
+@@ -185,11 +185,11 @@ RPCGENFLAGS=             -N -M -C -L
+ .PHONY:                       all clean distclean install daemon app test
+-all:                  generated-files daemon $(APP)
++all:                  daemon $(APP)
+-daemon:                       generated-files $(SUBDIRS:%=subdir-%) openl2tpd
++daemon:                       $(SUBDIRS:%=subdir-%) openl2tpd
+-app:                  generated-files l2tpconfig
++app:                  l2tpconfig
+ test:                 subdir-test
+                       $(MAKE) -C $@ $(MFLAGS) $@
+@@ -197,7 +197,7 @@ test:                      subdir-test
+ .PHONY:                       $(SUBDIRS:%=subdir-%)
+-$(SUBDIRS:%=subdir-%):        FORCE
++$(SUBDIRS:%=subdir-%):        FORCE generated-files
+                       $(MAKE) -C $(@:subdir-%=%) $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)"
+ ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
+@@ -212,10 +212,10 @@ LDFLAGS.l2tpd+=          -lfl
+                       $(YACC) -d -o l2tp_config_parse.c $<
+ l2tp_config_token.o:  l2tp_config_token.c
+-                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c -DYY_NO_UNPUT $<
++                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) -DYY_NO_UNPUT $<
+ l2tp_config_parse.o:  l2tp_config_parse.c l2tp_config_parse.h
+-                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c -DYY_NO_UNPUT $<
++                      $(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) -DYY_NO_UNPUT $<
+ endif
+ # Compile without -Wall because rpcgen-generated code is full of warnings.
+@@ -265,9 +265,13 @@ TAGS:
+                       @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done
+                       etags $(wildcard *.c) $(wildcard *.h)
++$(L2TPD_SRCS.o):      generated-files
++
+ openl2tpd:            $(L2TPD_SRCS.o)
+                       $(CC) -o $@ $^ $(LDFLAGS.l2tpd)
++$(L2TPCONFIG_SRCS.o): generated-files
++
+ l2tpconfig:           $(L2TPCONFIG_SRCS.o)
+                       $(CC) -o $@ $^ $(LDFLAGS.l2tpconfig)
+@@ -317,6 +321,7 @@ endif
+       else \
+               mv $@.tmp $@ ;\
+       fi
++      @echo '$@ generated.'
+ .PHONY:                       all install-all install-daemon install-app
diff --git a/net/openl2tp/patches/002-no_libfl.patch b/net/openl2tp/patches/002-no_libfl.patch
new file mode 100644 (file)
index 0000000..ae1dc6a
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/l2tp_config_token.l
++++ b/l2tp_config_token.l
+@@ -23,6 +23,8 @@ static int resolveip(const char *val, st
+ int lineno;
+ int command;
++int yywrap(void) { return 1; }
++
+ %}
+ /* common section */
+--- a/Makefile
++++ b/Makefile
+@@ -204,7 +204,7 @@ ifeq ($(L2TP_FEATURE_LOCAL_CONF_FILE),y)
+ # Config file parser
+ LEX=                  flex
+ YACC=                 bison
+-LDFLAGS.l2tpd+=               -lfl
++LDFLAGS.l2tpd+=
+ %.c:  %.l
+                       $(LEX) -o$@ $<
diff --git a/net/openl2tp/patches/010-ppp_unix.patch b/net/openl2tp/patches/010-ppp_unix.patch
new file mode 100644 (file)
index 0000000..839749e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/plugins/ppp_unix.c
++++ b/plugins/ppp_unix.c
+@@ -888,6 +888,8 @@ static int ppp_unix_pppd_spawn(struct pp
+               if (ppp->ppp_profile_data->proxy_arp) {
+                       argv[arg++] = "proxyarp";
++              } else {
++                      argv[arg++] = "noproxyarp";
+               }
+               argv[arg++] = "plugin";
diff --git a/net/openl2tp/src/l2tp_rpc.h b/net/openl2tp/src/l2tp_rpc.h
new file mode 100644 (file)
index 0000000..3989b92
--- /dev/null
@@ -0,0 +1,1475 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _L2TP_RPC_H_RPCGEN
+#define _L2TP_RPC_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define L2TP_APP_COPYRIGHT_INFO "(c) Copyright 2004-2010"
+#define L2TP_APP_VENDOR_INFO "Katalix Systems Ltd."
+#define L2TP_APP_MAJOR_VERSION 1
+#define L2TP_APP_MINOR_VERSION 8
+#define L2TP_DEBUG_PROTOCOL 1
+#define L2TP_DEBUG_FSM 2
+#define L2TP_DEBUG_API 4
+#define L2TP_DEBUG_AVP 8
+#define L2TP_DEBUG_AVP_HIDE 16
+#define L2TP_DEBUG_AVP_DATA 32
+#define L2TP_DEBUG_FUNC 64
+#define L2TP_DEBUG_XPRT 128
+#define L2TP_DEBUG_DATA 256
+#define L2TP_DEBUG_SYSTEM 512
+#define L2TP_DEBUG_PPP 1024
+#define L2TP_ERR_BASE 500
+#define L2TP_ERR_PARAM_NOT_MODIFIABLE 500
+#define L2TP_ERR_PEER_ADDRESS_MISSING 501
+#define L2TP_ERR_PEER_NOT_FOUND 502
+#define L2TP_ERR_PEER_PROFILE_NOT_FOUND 503
+#define L2TP_ERR_PPP_PROFILE_NOT_FOUND 504
+#define L2TP_ERR_PROFILE_ALREADY_EXISTS 505
+#define L2TP_ERR_PROFILE_NAME_ILLEGAL 506
+#define L2TP_ERR_PROFILE_NAME_MISSING 507
+#define L2TP_ERR_SESSION_ALREADY_EXISTS 508
+#define L2TP_ERR_SESSION_ID_ALLOC_FAILURE 509
+#define L2TP_ERR_SESSION_LIMIT_EXCEEDED 510
+#define L2TP_ERR_SESSION_NOT_FOUND 511
+#define L2TP_ERR_SESSION_PROFILE_NOT_FOUND 512
+#define L2TP_ERR_SESSION_SPEC_MISSING 513
+#define L2TP_ERR_SESSION_TYPE_BAD 514
+#define L2TP_ERR_SESSION_TYPE_ILLEGAL_FOR_TUNNEL 515
+#define L2TP_ERR_TUNNEL_ADD_ADMIN_DISABLED 516
+#define L2TP_ERR_TUNNEL_CREATE_ADMIN_DISABLED 517
+#define L2TP_ERR_TUNNEL_ALREADY_EXISTS 518
+#define L2TP_ERR_TUNNEL_ID_ALLOC_FAILURE 519
+#define L2TP_ERR_TUNNEL_NOT_FOUND 520
+#define L2TP_ERR_TUNNEL_PROFILE_NOT_FOUND 521
+#define L2TP_ERR_TUNNEL_SPEC_MISSING 522
+#define L2TP_ERR_TUNNEL_TOO_MANY_SESSIONS 523
+#define L2TP_ERR_TUNNEL_TOO_MANY_SAME_IP 524
+#define L2TP_ERR_TUNNEL_LIMIT_EXCEEDED 525
+#define L2TP_ERR_SESSION_TYPE_NOT_SUPPORTED 526
+#define L2TP_ERR_TUNNEL_HIDE_AVPS_NEEDS_SECRET 527
+#define L2TP_ERR_MAX 528
+
+struct optstring {
+       int valid;
+       union {
+               char *value;
+       } optstring_u;
+};
+typedef struct optstring optstring;
+#define OPTSTRING(_var) _var.optstring_u.value
+#define OPTSTRING_PTR(_var) ((_var.valid == 1) ? _var.optstring_u.value : NULL)
+
+enum l2tp_api_tunnel_auth_mode {
+       L2TP_API_TUNNEL_AUTH_MODE_NONE = 0,
+       L2TP_API_TUNNEL_AUTH_MODE_SIMPLE = 1,
+       L2TP_API_TUNNEL_AUTH_MODE_CHALLENGE = 2,
+};
+typedef enum l2tp_api_tunnel_auth_mode l2tp_api_tunnel_auth_mode;
+
+enum l2tp_api_tunnel_mode {
+       L2TP_API_TUNNEL_MODE_LACLNS = 0,
+       L2TP_API_TUNNEL_MODE_LAC = 1,
+       L2TP_API_TUNNEL_MODE_LNS = 2,
+};
+typedef enum l2tp_api_tunnel_mode l2tp_api_tunnel_mode;
+
+struct l2tp_api_ip_addr {
+       uint32_t s_addr;
+};
+typedef struct l2tp_api_ip_addr l2tp_api_ip_addr;
+#define L2TP_API_APP_FEATURE_LOCAL_CONF_FILE 1
+#define L2TP_API_APP_FEATURE_LAC_SUPPORT 2
+#define L2TP_API_APP_FEATURE_LNS_SUPPORT 4
+#define L2TP_API_APP_FEATURE_RPC_MANAGEMENT 8
+#define L2TP_API_APP_FEATURE_LAIC_SUPPORT 16
+#define L2TP_API_APP_FEATURE_LAOC_SUPPORT 32
+#define L2TP_API_APP_FEATURE_LNIC_SUPPORT 64
+#define L2TP_API_APP_FEATURE_LNOC_SUPPORT 128
+#define L2TP_API_APP_FEATURE_LOCAL_STAT_FILE 256
+
+struct l2tp_api_app_msg_data {
+       char *build_date;
+       char *build_time;
+       int major;
+       int minor;
+       uint32_t cookie;
+       struct {
+               u_int patches_len;
+               int *patches_val;
+       } patches;
+       uint32_t features;
+};
+typedef struct l2tp_api_app_msg_data l2tp_api_app_msg_data;
+#define L2TP_API_CONFIG_FLAG_TRACE_FLAGS 1
+#define L2TP_API_CONFIG_FLAG_MAX_TUNNELS 2
+#define L2TP_API_CONFIG_FLAG_DRAIN_TUNNELS 4
+#define L2TP_API_CONFIG_FLAG_MAX_SESSIONS 8
+#define L2TP_API_CONFIG_FLAG_TUNNEL_ESTABLISH_TIMEOUT 16
+#define L2TP_API_CONFIG_FLAG_SESSION_ESTABLISH_TIMEOUT 32
+#define L2TP_API_CONFIG_FLAG_DENY_LOCAL_TUNNEL_CREATES 64
+#define L2TP_API_CONFIG_FLAG_DENY_REMOTE_TUNNEL_CREATES 128
+#define L2TP_API_CONFIG_FLAG_RESET_STATISTICS 256
+#define L2TP_API_CONFIG_FLAG_TUNNEL_PERSIST_PEND_TIMEOUT 512
+#define L2TP_API_CONFIG_FLAG_SESSION_PERSIST_PEND_TIMEOUT 1024
+
+struct l2tp_api_system_config {
+       uint32_t flags;
+       int udp_port;
+       uint32_t trace_flags;
+       uint32_t trace_flags_mask;
+       int max_tunnels;
+       int max_sessions;
+       int drain_tunnels;
+       int tunnel_establish_timeout;
+       int session_establish_timeout;
+       int tunnel_persist_pend_timeout;
+       int session_persist_pend_timeout;
+       bool_t deny_local_tunnel_creates;
+       bool_t deny_remote_tunnel_creates;
+};
+typedef struct l2tp_api_system_config l2tp_api_system_config;
+
+struct l2tp_api_system_msg_stats {
+       uint32_t rx;
+       uint32_t tx;
+       uint32_t rx_bad;
+};
+typedef struct l2tp_api_system_msg_stats l2tp_api_system_msg_stats;
+#define L2TP_API_MSG_TYPE_COUNT 17
+
+struct l2tp_api_system_stats {
+       uint32_t short_frames;
+       uint32_t wrong_version_frames;
+       uint32_t unexpected_data_frames;
+       uint32_t bad_rcvd_frames;
+       uint32_t total_rcvd_control_frames;
+       uint32_t total_sent_control_frames;
+       uint32_t total_control_frame_send_fails;
+       uint32_t total_retransmitted_control_frames;
+       uint32_t no_control_frame_resources;
+       uint32_t no_peer_resources;
+       uint32_t no_tunnel_resources;
+       uint32_t no_session_resources;
+       uint32_t no_ppp_resources;
+       uint32_t too_many_tunnels;
+       uint32_t too_many_sessions;
+       uint32_t auth_fails;
+       uint32_t no_matching_tunnel_id_discards;
+       uint32_t no_matching_session_id_discards;
+       uint32_t mismatched_tunnel_ids;
+       uint32_t mismatched_session_ids;
+       uint32_t encode_message_fails;
+       uint32_t tunnel_setup_failures;
+       uint32_t session_setup_failures;
+       uint32_t event_queue_full_errors;
+       uint32_t ignored_avps;
+       uint32_t vendor_avps;
+       uint32_t illegal_messages;
+       uint32_t unsupported_messages;
+       struct {
+               u_int messages_len;
+               struct l2tp_api_system_msg_stats *messages_val;
+       } messages;
+};
+typedef struct l2tp_api_system_stats l2tp_api_system_stats;
+
+struct l2tp_api_system_status {
+       struct l2tp_api_system_stats stats;
+       uint32_t num_tunnels;
+       uint32_t num_sessions;
+};
+typedef struct l2tp_api_system_status l2tp_api_system_status;
+
+struct l2tp_api_system_msg_data {
+       struct l2tp_api_system_config config;
+       struct l2tp_api_system_status status;
+};
+typedef struct l2tp_api_system_msg_data l2tp_api_system_msg_data;
+
+struct l2tp_api_peer_msg_data {
+       int result_code;
+       struct l2tp_api_ip_addr peer_addr;
+       struct l2tp_api_ip_addr local_addr;
+       int num_tunnels;
+};
+typedef struct l2tp_api_peer_msg_data l2tp_api_peer_msg_data;
+
+struct l2tp_api_peer_list_entry {
+       struct l2tp_api_ip_addr peer_addr;
+       struct l2tp_api_ip_addr local_addr;
+       struct l2tp_api_peer_list_entry *next;
+};
+typedef struct l2tp_api_peer_list_entry l2tp_api_peer_list_entry;
+
+struct l2tp_api_peer_list_msg_data {
+       int result;
+       struct l2tp_api_peer_list_entry *peers;
+};
+typedef struct l2tp_api_peer_list_msg_data l2tp_api_peer_list_msg_data;
+#define L2TP_API_PEER_PROFILE_DEFAULT_PROFILE_NAME "default"
+#define L2TP_API_PEER_PROFILE_FLAG_LACLNS 1
+#define L2TP_API_PEER_PROFILE_FLAG_TUNNEL_PROFILE_NAME 2
+#define L2TP_API_PEER_PROFILE_FLAG_SESSION_PROFILE_NAME 4
+#define L2TP_API_PEER_PROFILE_FLAG_PPP_PROFILE_NAME 8
+#define L2TP_API_PEER_PROFILE_FLAG_PEER_IPADDR 16
+#define L2TP_API_PEER_PROFILE_FLAG_PEER_PORT 32
+#define L2TP_API_PEER_PROFILE_FLAG_NETMASK 64
+
+struct l2tp_api_peer_profile_msg_data {
+       uint32_t flags;
+       int result_code;
+       struct l2tp_api_ip_addr peer_addr;
+       uint16_t peer_port;
+       bool_t we_can_be_lac;
+       bool_t we_can_be_lns;
+       char *profile_name;
+       optstring default_tunnel_profile_name;
+       optstring default_session_profile_name;
+       optstring default_ppp_profile_name;
+       struct l2tp_api_ip_addr netmask;
+       int use_count;
+};
+typedef struct l2tp_api_peer_profile_msg_data l2tp_api_peer_profile_msg_data;
+
+struct l2tp_api_peer_profile_list_entry {
+       char *profile_name;
+       struct l2tp_api_peer_profile_list_entry *next;
+};
+typedef struct l2tp_api_peer_profile_list_entry l2tp_api_peer_profile_list_entry;
+
+struct l2tp_api_peer_profile_list_msg_data {
+       int result;
+       int num_profiles;
+       struct l2tp_api_peer_profile_list_entry *profiles;
+};
+typedef struct l2tp_api_peer_profile_list_msg_data l2tp_api_peer_profile_list_msg_data;
+
+struct l2tp_api_peer_profile_unset_msg_data {
+       uint32_t flags;
+       int result_code;
+       char *profile_name;
+};
+typedef struct l2tp_api_peer_profile_unset_msg_data l2tp_api_peer_profile_unset_msg_data;
+
+struct l2tp_api_tunnel_peer {
+       bool_t framing_cap_sync;
+       bool_t framing_cap_async;
+       bool_t bearer_cap_digital;
+       bool_t bearer_cap_analog;
+       uint8_t protocol_version_ver;
+       uint8_t protocol_version_rev;
+       uint16_t rx_window_size;
+       uint16_t firmware_revision;
+       optstring host_name;
+       optstring vendor_name;
+       struct {
+               u_int tiebreaker_len;
+               uint8_t *tiebreaker_val;
+       } tiebreaker;
+       uint16_t result_code_result;
+       uint16_t result_code_error;
+       optstring result_code_message;
+};
+typedef struct l2tp_api_tunnel_peer l2tp_api_tunnel_peer;
+
+struct l2tp_api_tunnel_stats {
+       uint32_t retransmits;
+       uint32_t tx_zlbs;
+       uint32_t tx_zlb_fails;
+       uint32_t rx_zlbs;
+       uint32_t data_pkt_discards;
+       uint32_t duplicate_pkt_discards;
+       uint32_t rx_hellos;
+       uint32_t tx_hellos;
+       uint32_t tx_hello_fails;
+       uint16_t ns;
+       uint16_t nr;
+       uint16_t peer_ns;
+       uint16_t peer_nr;
+       uint16_t cwnd;
+       uint16_t ssthresh;
+       uint16_t congpkt_acc;
+       uint64_t control_rx_packets;
+       uint64_t control_rx_bytes;
+       uint64_t control_rx_oos_packets;
+       uint64_t control_rx_oos_discards;
+       uint64_t control_tx_packets;
+       uint64_t control_tx_bytes;
+       uint64_t data_rx_packets;
+       uint64_t data_rx_bytes;
+       uint64_t data_rx_errors;
+       uint64_t data_rx_oos_packets;
+       uint64_t data_rx_oos_discards;
+       uint64_t data_tx_packets;
+       uint64_t data_tx_bytes;
+       uint64_t data_tx_errors;
+       bool_t using_ipsec;
+};
+typedef struct l2tp_api_tunnel_stats l2tp_api_tunnel_stats;
+#define L2TP_API_TUNNEL_FLAG_HIDE_AVPS 1
+#define L2TP_API_TUNNEL_FLAG_OUR_ADDR 2
+#define L2TP_API_TUNNEL_FLAG_PEER_ADDR 4
+#define L2TP_API_TUNNEL_FLAG_CONFIG_ID 8
+#define L2TP_API_TUNNEL_FLAG_OUR_UDP_PORT 16
+#define L2TP_API_TUNNEL_FLAG_AUTH_MODE 32
+#define L2TP_API_TUNNEL_FLAG_FRAMING_CAP 64
+#define L2TP_API_TUNNEL_FLAG_BEARER_CAP 128
+#define L2TP_API_TUNNEL_FLAG_USE_TIEBREAKER 256
+#define L2TP_API_TUNNEL_FLAG_PERSIST 512
+#define L2TP_API_TUNNEL_FLAG_HELLO_TIMEOUT 1024
+#define L2TP_API_TUNNEL_FLAG_MAX_RETRIES 2048
+#define L2TP_API_TUNNEL_FLAG_RX_WINDOW_SIZE 4096
+#define L2TP_API_TUNNEL_FLAG_TX_WINDOW_SIZE 8192
+#define L2TP_API_TUNNEL_FLAG_RETRY_TIMEOUT 16384
+#define L2TP_API_TUNNEL_FLAG_IDLE_TIMEOUT 32768
+#define L2TP_API_TUNNEL_FLAG_PEER_UDP_PORT 65536
+#define L2TP_API_TUNNEL_FLAG_SECRET 131072
+#define L2TP_API_TUNNEL_FLAG_ALLOW_PPP_PROXY 262144
+#define L2TP_API_TUNNEL_FLAG_TRACE_FLAGS 524288
+#define L2TP_API_TUNNEL_FLAG_USE_UDP_CHECKSUMS 1048576
+#define L2TP_API_TUNNEL_FLAG_HOST_NAME 2097152
+#define L2TP_API_TUNNEL_FLAG_TUNNEL_ID 4194304
+#define L2TP_API_TUNNEL_FLAG_PROFILE_NAME 8388608
+#define L2TP_API_TUNNEL_FLAG_MAX_SESSIONS 16777216
+#define L2TP_API_TUNNEL_FLAG_TUNNEL_NAME 33554432
+#define L2TP_API_TUNNEL_FLAG_UNUSED_2 67108864
+#define L2TP_API_TUNNEL_FLAG_PEER_PROFILE_NAME 134217728
+#define L2TP_API_TUNNEL_FLAG_SESSION_PROFILE_NAME 268435456
+#define L2TP_API_TUNNEL_FLAG_PPP_PROFILE_NAME 536870912
+#define L2TP_API_TUNNEL_FLAG_DO_PMTU_DISCOVERY 1073741824
+#define L2TP_API_TUNNEL_FLAG_MTU 2147483648
+#define L2TP_API_TUNNEL_FLAG_INTERFACE_NAME 1
+
+struct l2tp_api_tunnel_msg_data {
+       uint32_t flags;
+       uint32_t flags2;
+       uint16_t tunnel_id;
+       uint16_t peer_tunnel_id;
+       int result_code;
+       int hide_avps;
+       optstring tunnel_name;
+       struct l2tp_api_ip_addr our_addr;
+       struct l2tp_api_ip_addr peer_addr;
+       uint16_t our_udp_port;
+       uint16_t peer_udp_port;
+       int config_id;
+       enum l2tp_api_tunnel_auth_mode auth_mode;
+       bool_t framing_cap_sync;
+       bool_t framing_cap_async;
+       bool_t bearer_cap_digital;
+       bool_t bearer_cap_analog;
+       bool_t use_tiebreaker;
+       bool_t allow_ppp_proxy;
+       bool_t use_udp_checksums;
+       bool_t created_by_admin;
+       optstring create_time;
+       int max_sessions;
+       int num_sessions;
+       int use_count;
+       int num_establish_retries;
+       enum l2tp_api_tunnel_mode mode;
+       int hello_timeout;
+       int max_retries;
+       uint16_t rx_window_size;
+       uint16_t tx_window_size;
+       uint16_t actual_tx_window_size;
+       int retry_timeout;
+       int idle_timeout;
+       uint32_t trace_flags;
+       uint32_t trace_flags_mask;
+       bool_t do_pmtu_discovery;
+       bool_t persist;
+       int mtu;
+       optstring state;
+       optstring secret;
+       optstring host_name;
+       optstring tunnel_profile_name;
+       optstring peer_profile_name;
+       optstring session_profile_name;
+       optstring ppp_profile_name;
+       optstring interface_name;
+       struct {
+               u_int tiebreaker_len;
+               uint8_t *tiebreaker_val;
+       } tiebreaker;
+       uint16_t result_code_result;
+       uint16_t result_code_error;
+       optstring result_code_message;
+       struct l2tp_api_tunnel_peer peer;
+       struct l2tp_api_tunnel_stats stats;
+};
+typedef struct l2tp_api_tunnel_msg_data l2tp_api_tunnel_msg_data;
+
+struct l2tp_api_tunnel_list_msg_data {
+       int result;
+       struct {
+               u_int tunnel_ids_len;
+               uint16_t *tunnel_ids_val;
+       } tunnel_ids;
+};
+typedef struct l2tp_api_tunnel_list_msg_data l2tp_api_tunnel_list_msg_data;
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_PROFILE_NAME "default"
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_AUTH_MODE L2TP_API_TUNNEL_AUTH_MODE_NONE
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_FRAMING_CAP_SYNC 1
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_FRAMING_CAP_ASYNC 1
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_BEARER_CAP_DIGITAL 1
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_BEARER_CAP_ANALOG 1
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_USE_TIEBREAKER 0
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_HELLO_TIMEOUT 60
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_MAX_RETRIES 5
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_RX_WINDOW_SIZE 10
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_TX_WINDOW_SIZE 10
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_RETRY_TIMEOUT 1
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_IDLE_TIMEOUT 0
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_ZLB_TIMEOUT 5
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_TRACE_FLAGS 0
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_ALLOW_PPP_PROXY 0
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_USE_UDP_CHECKSUMS 1
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_DO_PMTU_DISCOVERY 0
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_MTU 1460
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_HIDE_AVPS 0
+#define L2TP_API_TUNNEL_PROFILE_DEFAULT_MAX_SESSIONS 0
+#define L2TP_API_TUNNEL_PROFILE_FLAG_HIDE_AVPS 1
+#define L2TP_API_TUNNEL_PROFILE_FLAG_AUTH_MODE 2
+#define L2TP_API_TUNNEL_PROFILE_FLAG_FRAMING_CAP 4
+#define L2TP_API_TUNNEL_PROFILE_FLAG_BEARER_CAP 8
+#define L2TP_API_TUNNEL_PROFILE_FLAG_USE_TIEBREAKER 16
+#define L2TP_API_TUNNEL_PROFILE_FLAG_UNUSED_1 32
+#define L2TP_API_TUNNEL_PROFILE_FLAG_HELLO_TIMEOUT 64
+#define L2TP_API_TUNNEL_PROFILE_FLAG_MAX_RETRIES 128
+#define L2TP_API_TUNNEL_PROFILE_FLAG_RX_WINDOW_SIZE 256
+#define L2TP_API_TUNNEL_PROFILE_FLAG_TX_WINDOW_SIZE 512
+#define L2TP_API_TUNNEL_PROFILE_FLAG_RETRY_TIMEOUT 1024
+#define L2TP_API_TUNNEL_PROFILE_FLAG_IDLE_TIMEOUT 2048
+#define L2TP_API_TUNNEL_PROFILE_FLAG_SECRET 4096
+#define L2TP_API_TUNNEL_PROFILE_FLAG_ALLOW_PPP_PROXY 8192
+#define L2TP_API_TUNNEL_PROFILE_FLAG_TRACE_FLAGS 16384
+#define L2TP_API_TUNNEL_PROFILE_FLAG_USE_UDP_CHECKSUMS 32768
+#define L2TP_API_TUNNEL_PROFILE_FLAG_HOST_NAME 65536
+#define L2TP_API_TUNNEL_PROFILE_FLAG_MAX_SESSIONS 131072
+#define L2TP_API_TUNNEL_PROFILE_FLAG_OUR_ADDR 262144
+#define L2TP_API_TUNNEL_PROFILE_FLAG_PEER_ADDR 524288
+#define L2TP_API_TUNNEL_PROFILE_FLAG_OUR_UDP_PORT 1048576
+#define L2TP_API_TUNNEL_PROFILE_FLAG_PEER_UDP_PORT 2097152
+#define L2TP_API_TUNNEL_PROFILE_FLAG_UNUSED_2 4194304
+#define L2TP_API_TUNNEL_PROFILE_FLAG_PEER_PROFILE_NAME 8388608
+#define L2TP_API_TUNNEL_PROFILE_FLAG_SESSION_PROFILE_NAME 16777216
+#define L2TP_API_TUNNEL_PROFILE_FLAG_PPP_PROFILE_NAME 33554432
+#define L2TP_API_TUNNEL_PROFILE_FLAG_DO_PMTU_DISCOVERY 67108864
+#define L2TP_API_TUNNEL_PROFILE_FLAG_MTU 134217728
+
+struct l2tp_api_tunnel_profile_msg_data {
+       uint32_t flags;
+       char *profile_name;
+       int result_code;
+       int hide_avps;
+       enum l2tp_api_tunnel_auth_mode auth_mode;
+       bool_t framing_cap_sync;
+       bool_t framing_cap_async;
+       bool_t bearer_cap_digital;
+       bool_t bearer_cap_analog;
+       bool_t use_tiebreaker;
+       bool_t allow_ppp_proxy;
+       bool_t use_udp_checksums;
+       int hello_timeout;
+       int max_retries;
+       uint16_t rx_window_size;
+       uint16_t tx_window_size;
+       int retry_timeout;
+       int idle_timeout;
+       uint32_t trace_flags;
+       uint32_t trace_flags_mask;
+       int max_sessions;
+       struct l2tp_api_ip_addr our_addr;
+       struct l2tp_api_ip_addr peer_addr;
+       uint16_t our_udp_port;
+       uint16_t peer_udp_port;
+       bool_t do_pmtu_discovery;
+       int mtu;
+       optstring peer_profile_name;
+       optstring session_profile_name;
+       optstring ppp_profile_name;
+       optstring secret;
+       optstring host_name;
+};
+typedef struct l2tp_api_tunnel_profile_msg_data l2tp_api_tunnel_profile_msg_data;
+
+struct l2tp_api_tunnel_profile_list_entry {
+       char *profile_name;
+       struct l2tp_api_tunnel_profile_list_entry *next;
+};
+typedef struct l2tp_api_tunnel_profile_list_entry l2tp_api_tunnel_profile_list_entry;
+
+struct l2tp_api_tunnel_profile_list_msg_data {
+       int result;
+       int num_profiles;
+       struct l2tp_api_tunnel_profile_list_entry *profiles;
+};
+typedef struct l2tp_api_tunnel_profile_list_msg_data l2tp_api_tunnel_profile_list_msg_data;
+
+struct l2tp_api_tunnel_profile_unset_msg_data {
+       uint32_t flags;
+       int result_code;
+       char *profile_name;
+};
+typedef struct l2tp_api_tunnel_profile_unset_msg_data l2tp_api_tunnel_profile_unset_msg_data;
+#define L2TP_API_SESSION_DEFAULT_SESSION_TYPE L2TP_API_SESSION_TYPE_UNSPECIFIED
+#define L2TP_API_SESSION_FLAG_TRACE_FLAGS 1
+#define L2TP_API_SESSION_FLAG_SEQUENCING_REQUIRED 2
+#define L2TP_API_SESSION_FLAG_PPP_PROFILE_NAME 4
+#define L2TP_API_SESSION_FLAG_SESSION_TYPE 8
+#define L2TP_API_SESSION_FLAG_PRIV_GROUP_ID 16
+#define L2TP_API_SESSION_FLAG_FRAMING_TYPE 32
+#define L2TP_API_SESSION_FLAG_BEARER_TYPE 64
+#define L2TP_API_SESSION_FLAG_MINIMUM_BPS 128
+#define L2TP_API_SESSION_FLAG_MAXIMUM_BPS 256
+#define L2TP_API_SESSION_FLAG_CONNECT_SPEED 512
+#define L2TP_API_SESSION_FLAG_USE_PPP_PROXY 1024
+#define L2TP_API_SESSION_FLAG_PROXY_AUTH_TYPE 8192
+#define L2TP_API_SESSION_FLAG_PROXY_AUTH_NAME 16384
+#define L2TP_API_SESSION_FLAG_PROXY_AUTH_CHALLENGE 32768
+#define L2TP_API_SESSION_FLAG_PROXY_AUTH_RESPONSE 65536
+#define L2TP_API_SESSION_FLAG_CALLING_NUMBER 131072
+#define L2TP_API_SESSION_FLAG_CALLED_NUMBER 262144
+#define L2TP_API_SESSION_FLAG_SUB_ADDRESS 524288
+#define L2TP_API_SESSION_FLAG_INITIAL_RCVD_LCP_CONFREQ 1048576
+#define L2TP_API_SESSION_FLAG_LAST_SENT_LCP_CONFREQ 2097152
+#define L2TP_API_SESSION_FLAG_LAST_RCVD_LCP_CONFREQ 4194304
+#define L2TP_API_SESSION_FLAG_USER_NAME 8388608
+#define L2TP_API_SESSION_FLAG_USER_PASSWORD 16777216
+#define L2TP_API_SESSION_FLAG_USE_SEQUENCE_NUMBERS 33554432
+#define L2TP_API_SESSION_FLAG_REORDER_TIMEOUT 67108864
+#define L2TP_API_SESSION_FLAG_TUNNEL_NAME 134217728
+#define L2TP_API_SESSION_FLAG_SESSION_NAME 268435456
+#define L2TP_API_SESSION_FLAG_INTERFACE_NAME 536870912
+#define L2TP_API_SESSION_FLAG_PROFILE_NAME 1073741824
+#define L2TP_API_SESSION_FLAG_NO_PPP 2147483648
+
+enum l2tp_api_session_proxy_auth_type {
+       L2TP_API_SESSION_PROXY_AUTH_TYPE_RESERVED = 0,
+       L2TP_API_SESSION_PROXY_AUTH_TYPE_PLAIN_TEXT = 1,
+       L2TP_API_SESSION_PROXY_AUTH_TYPE_PPP_CHAP = 2,
+       L2TP_API_SESSION_PROXY_AUTH_TYPE_PPP_PAP = 3,
+       L2TP_API_SESSION_PROXY_AUTH_TYPE_NO_AUTH = 4,
+       L2TP_API_SESSION_PROXY_AUTH_TYPE_PPP_MSCHAPV1 = 5,
+};
+typedef enum l2tp_api_session_proxy_auth_type l2tp_api_session_proxy_auth_type;
+
+struct l2tp_api_session_call_errors {
+       uint32_t crc_errors;
+       uint32_t framing_errors;
+       uint32_t hardware_overruns;
+       uint32_t buffer_overruns;
+       uint32_t timeout_errors;
+       uint32_t alignment_errors;
+};
+typedef struct l2tp_api_session_call_errors l2tp_api_session_call_errors;
+
+struct l2tp_api_session_stats {
+       uint64_t data_rx_packets;
+       uint64_t data_rx_bytes;
+       uint64_t data_rx_errors;
+       uint64_t data_rx_oos_packets;
+       uint64_t data_rx_oos_discards;
+       uint64_t data_tx_packets;
+       uint64_t data_tx_bytes;
+       uint64_t data_tx_errors;
+};
+typedef struct l2tp_api_session_stats l2tp_api_session_stats;
+
+struct l2tp_api_session_peer_info {
+       uint16_t result_code;
+       uint16_t error_code;
+       optstring error_message;
+       uint32_t minimum_bps;
+       uint32_t maximum_bps;
+       uint32_t connect_speed;
+       uint32_t rx_connect_speed;
+       enum l2tp_api_session_proxy_auth_type proxy_auth_type;
+       uint8_t proxy_auth_id;
+       optstring proxy_auth_name;
+       struct {
+               u_int proxy_auth_challenge_len;
+               uint8_t *proxy_auth_challenge_val;
+       } proxy_auth_challenge;
+       struct {
+               u_int proxy_auth_response_len;
+               uint8_t *proxy_auth_response_val;
+       } proxy_auth_response;
+       optstring private_group_id;
+       bool_t framing_type_sync;
+       bool_t framing_type_async;
+       bool_t bearer_type_digital;
+       bool_t bearer_type_analog;
+       bool_t sequencing_required;
+       uint32_t call_serial_number;
+       uint32_t physical_channel_id;
+       struct {
+               u_int initial_rcvd_lcp_confreq_len;
+               uint8_t *initial_rcvd_lcp_confreq_val;
+       } initial_rcvd_lcp_confreq;
+       struct {
+               u_int last_sent_lcp_confreq_len;
+               uint8_t *last_sent_lcp_confreq_val;
+       } last_sent_lcp_confreq;
+       struct {
+               u_int last_rcvd_lcp_confreq_len;
+               uint8_t *last_rcvd_lcp_confreq_val;
+       } last_rcvd_lcp_confreq;
+       optstring calling_number;
+       optstring called_number;
+       optstring sub_address;
+       uint16_t q931_cause_code;
+       uint16_t q931_cause_msg;
+       optstring q931_advisory_msg;
+       struct l2tp_api_session_call_errors call_errors;
+       uint32_t send_accm;
+       uint32_t recv_accm;
+};
+typedef struct l2tp_api_session_peer_info l2tp_api_session_peer_info;
+
+enum l2tp_api_session_type {
+       L2TP_API_SESSION_TYPE_UNSPECIFIED = 0,
+       L2TP_API_SESSION_TYPE_LAIC = 1,
+       L2TP_API_SESSION_TYPE_LAOC = 2,
+       L2TP_API_SESSION_TYPE_LNIC = 3,
+       L2TP_API_SESSION_TYPE_LNOC = 4,
+};
+typedef enum l2tp_api_session_type l2tp_api_session_type;
+
+struct l2tp_api_session_msg_data {
+       uint32_t flags;
+       uint16_t tunnel_id;
+       uint16_t session_id;
+       int result_code;
+       optstring tunnel_name;
+       uint16_t peer_session_id;
+       optstring state;
+       optstring session_name;
+       optstring interface_name;
+       enum l2tp_api_session_type session_type;
+       optstring user_name;
+       optstring user_password;
+       optstring priv_group_id;
+       optstring profile_name;
+       bool_t created_by_admin;
+       optstring create_time;
+       bool_t no_ppp;
+       bool_t sequencing_required;
+       bool_t use_sequence_numbers;
+       int reorder_timeout;
+       bool_t framing_type_sync;
+       bool_t framing_type_async;
+       bool_t bearer_type_digital;
+       bool_t bearer_type_analog;
+       uint32_t call_serial_number;
+       uint32_t physical_channel_id;
+       uint32_t trace_flags;
+       uint32_t trace_flags_mask;
+       int minimum_bps;
+       int maximum_bps;
+       int tx_connect_speed;
+       int rx_connect_speed;
+       struct l2tp_api_session_peer_info peer;
+       optstring ppp_profile_name;
+       struct l2tp_api_session_stats stats;
+       bool_t use_ppp_proxy;
+       enum l2tp_api_session_proxy_auth_type proxy_auth_type;
+       optstring proxy_auth_name;
+       struct {
+               u_int proxy_auth_challenge_len;
+               uint8_t *proxy_auth_challenge_val;
+       } proxy_auth_challenge;
+       struct {
+               u_int proxy_auth_response_len;
+               uint8_t *proxy_auth_response_val;
+       } proxy_auth_response;
+       optstring calling_number;
+       optstring called_number;
+       optstring sub_address;
+       struct {
+               u_int initial_rcvd_lcp_confreq_len;
+               uint8_t *initial_rcvd_lcp_confreq_val;
+       } initial_rcvd_lcp_confreq;
+       struct {
+               u_int last_sent_lcp_confreq_len;
+               uint8_t *last_sent_lcp_confreq_val;
+       } last_sent_lcp_confreq;
+       struct {
+               u_int last_rcvd_lcp_confreq_len;
+               uint8_t *last_rcvd_lcp_confreq_val;
+       } last_rcvd_lcp_confreq;
+};
+typedef struct l2tp_api_session_msg_data l2tp_api_session_msg_data;
+
+struct l2tp_api_session_list_msg_data {
+       int result;
+       struct {
+               u_int session_ids_len;
+               uint16_t *session_ids_val;
+       } session_ids;
+};
+typedef struct l2tp_api_session_list_msg_data l2tp_api_session_list_msg_data;
+
+struct l2tp_api_session_incall_msg_data {
+       int ppp_unit;
+       char *tunnel_profile_name;
+       struct l2tp_api_session_msg_data session;
+};
+typedef struct l2tp_api_session_incall_msg_data l2tp_api_session_incall_msg_data;
+#define L2TP_API_SESSION_PROFILE_DEFAULT_PROFILE_NAME "default"
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_TRACE_FLAGS 0
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_SEQUENCING_REQUIRED 0
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_TYPE L2TP_API_SESSION_TYPE_UNSPECIFIED
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_FRAMING_TYPE_SYNC 1
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_FRAMING_TYPE_ASYNC 1
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_BEARER_TYPE_ANALOG 1
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_BEARER_TYPE_DIGITAL 1
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_MINIMUM_BPS 0
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_MAXIMUM_BPS 0
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_TX_CONNECT_SPEED 1000000
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_RX_CONNECT_SPEED 0
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_USE_PPP_PROXY FALSE
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_USE_SEQUENCE_NUMBERS FALSE
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_REORDER_TIMEOUT 0
+#define L2TP_API_SESSION_PROFILE_DEFAULT_SESSION_NO_PPP FALSE
+#define L2TP_API_SESSION_PROFILE_FLAG_TRACE_FLAGS 1
+#define L2TP_API_SESSION_PROFILE_FLAG_SEQUENCING_REQUIRED 2
+#define L2TP_API_SESSION_PROFILE_FLAG_PPP_PROFILE_NAME 4
+#define L2TP_API_SESSION_PROFILE_FLAG_SESSION_TYPE 8
+#define L2TP_API_SESSION_PROFILE_FLAG_PRIV_GROUP_ID 16
+#define L2TP_API_SESSION_PROFILE_FLAG_FRAMING_TYPE 32
+#define L2TP_API_SESSION_PROFILE_FLAG_BEARER_TYPE 64
+#define L2TP_API_SESSION_PROFILE_FLAG_MINIMUM_BPS 128
+#define L2TP_API_SESSION_PROFILE_FLAG_MAXIMUM_BPS 256
+#define L2TP_API_SESSION_PROFILE_FLAG_CONNECT_SPEED 512
+#define L2TP_API_SESSION_PROFILE_FLAG_USE_PPP_PROXY 1024
+#define L2TP_API_SESSION_PROFILE_FLAG_USE_SEQUENCE_NUMBERS 2048
+#define L2TP_API_SESSION_PROFILE_FLAG_REORDER_TIMEOUT 4096
+#define L2TP_API_SESSION_PROFILE_FLAG_NO_PPP 8192
+
+struct l2tp_api_session_profile_msg_data {
+       uint32_t flags;
+       int result_code;
+       char *profile_name;
+       bool_t sequencing_required;
+       bool_t use_sequence_numbers;
+       bool_t no_ppp;
+       int reorder_timeout;
+       bool_t do_pmtu_discovery;
+       int mtu;
+       int mru;
+       uint32_t trace_flags;
+       uint32_t trace_flags_mask;
+       optstring ppp_profile_name;
+       enum l2tp_api_session_type session_type;
+       optstring priv_group_id;
+       bool_t framing_type_sync;
+       bool_t framing_type_async;
+       bool_t bearer_type_digital;
+       bool_t bearer_type_analog;
+       int minimum_bps;
+       int maximum_bps;
+       int tx_connect_speed;
+       int rx_connect_speed;
+       bool_t use_ppp_proxy;
+};
+typedef struct l2tp_api_session_profile_msg_data l2tp_api_session_profile_msg_data;
+
+struct l2tp_api_session_profile_list_entry {
+       char *profile_name;
+       struct l2tp_api_session_profile_list_entry *next;
+};
+typedef struct l2tp_api_session_profile_list_entry l2tp_api_session_profile_list_entry;
+
+struct l2tp_api_session_profile_list_msg_data {
+       int result;
+       int num_profiles;
+       struct l2tp_api_session_profile_list_entry *profiles;
+};
+typedef struct l2tp_api_session_profile_list_msg_data l2tp_api_session_profile_list_msg_data;
+
+struct l2tp_api_session_profile_unset_msg_data {
+       uint32_t flags;
+       int result_code;
+       char *profile_name;
+};
+typedef struct l2tp_api_session_profile_unset_msg_data l2tp_api_session_profile_unset_msg_data;
+#define L2TP_API_PPP_PROFILE_FLAG_TRACE_FLAGS 1
+#define L2TP_API_PPP_PROFILE_FLAG_ASYNCMAP 2
+#define L2TP_API_PPP_PROFILE_FLAG_MRU 4
+#define L2TP_API_PPP_PROFILE_FLAG_MTU 8
+#define L2TP_API_PPP_PROFILE_FLAG_USE_RADIUS 32
+#define L2TP_API_PPP_PROFILE_FLAG_RADIUS_HINT 64
+#define L2TP_API_PPP_PROFILE_FLAG_SYNC_MODE 256
+#define L2TP_API_PPP_PROFILE_FLAG_CHAP_INTERVAL 512
+#define L2TP_API_PPP_PROFILE_FLAG_CHAP_MAX_CHALLENGE 1024
+#define L2TP_API_PPP_PROFILE_FLAG_CHAP_RESTART 2048
+#define L2TP_API_PPP_PROFILE_FLAG_PAP_MAX_AUTH_REQUESTS 4096
+#define L2TP_API_PPP_PROFILE_FLAG_PAP_RESTART_INTERVAL 8192
+#define L2TP_API_PPP_PROFILE_FLAG_PAP_TIMEOUT 16384
+#define L2TP_API_PPP_PROFILE_FLAG_IDLE_TIMEOUT 32768
+#define L2TP_API_PPP_PROFILE_FLAG_IPCP_MAX_CONFIG_REQUESTS 65536
+#define L2TP_API_PPP_PROFILE_FLAG_IPCP_MAX_CONFIG_NAKS 131072
+#define L2TP_API_PPP_PROFILE_FLAG_IPCP_MAX_TERMINATE_REQUESTS 262144
+#define L2TP_API_PPP_PROFILE_FLAG_IPCP_RETRANSMIT_INTERVAL 524288
+#define L2TP_API_PPP_PROFILE_FLAG_LCP_ECHO_FAILURE_COUNT 1048576
+#define L2TP_API_PPP_PROFILE_FLAG_LCP_ECHO_INTERVAL 2097152
+#define L2TP_API_PPP_PROFILE_FLAG_LCP_MAX_CONFIG_REQUESTS 4194304
+#define L2TP_API_PPP_PROFILE_FLAG_LCP_MAX_CONFIG_NAKS 8388608
+#define L2TP_API_PPP_PROFILE_FLAG_LCP_MAX_TERMINATE_REQUESTS 16777216
+#define L2TP_API_PPP_PROFILE_FLAG_LCP_RETRANSMIT_INTERVAL 33554432
+#define L2TP_API_PPP_PROFILE_FLAG_MAX_CONNECT_TIME 67108864
+#define L2TP_API_PPP_PROFILE_FLAG_MAX_FAILURE_COUNT 134217728
+#define L2TP_API_PPP_PROFILE_FLAG_DNS_ADDR_1 1
+#define L2TP_API_PPP_PROFILE_FLAG_DNS_ADDR_2 2
+#define L2TP_API_PPP_PROFILE_FLAG_WINS_ADDR_1 4
+#define L2TP_API_PPP_PROFILE_FLAG_WINS_ADDR_2 8
+#define L2TP_API_PPP_PROFILE_FLAG_LOCAL_IP_ADDR 16
+#define L2TP_API_PPP_PROFILE_FLAG_PEER_IP_ADDR 32
+#define L2TP_API_PPP_PROFILE_FLAG_IP_POOL_NAME 64
+#define L2TP_API_PPP_PROFILE_FLAG_USE_AS_DEFAULT_ROUTE 128
+#define L2TP_API_PPP_PROFILE_FLAG_MULTILINK 256
+#define L2TP_API_PPP_PROFILE_FLAG_LOCAL_NAME 512
+#define L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME 1024
+#define L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP 2048
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE 4096
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP 8192
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 16384
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAP 32768
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_CHAP 65536
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP 131072
+#define L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER 262144
+#define L2TP_API_PPP_PROFILE_DEFAULT_PROFILE_NAME "default"
+#define L2TP_API_PPP_PROFILE_DEFAULT_TRACE_FLAGS 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_ASYNCMAP 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_MRU 1500
+#define L2TP_API_PPP_PROFILE_DEFAULT_MTU 1500
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_NONE 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_PEER 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_REFUSE_PAP 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_REFUSE_CHAP 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_REFUSE_MSCHAP 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_REFUSE_MSCHAPV2 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_AUTH_REFUSE_EAP 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_SYNC_MODE L2TP_API_PPP_SYNCMODE_SYNC_ASYNC
+#define L2TP_API_PPP_PROFILE_DEFAULT_CHAP_INTERVAL 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_CHAP_MAX_CHALLENGE 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_CHAP_RESTART 3
+#define L2TP_API_PPP_PROFILE_DEFAULT_PAP_MAX_AUTH_REQUESTS 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_PAP_RESTART_INTERVAL 3
+#define L2TP_API_PPP_PROFILE_DEFAULT_PAP_TIMEOUT 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_IDLE_TIMEOUT 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_IPCP_MAX_CONFIG_REQUESTS 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_IPCP_MAX_CONFIG_NAKS 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_IPCP_MAX_TERMINATE_REQUESTS 3
+#define L2TP_API_PPP_PROFILE_DEFAULT_IPCP_RETRANSMIT_INTERVAL 3
+#define L2TP_API_PPP_PROFILE_DEFAULT_LCP_ECHO_FAILURE_COUNT 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_LCP_ECHO_INTERVAL 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_LCP_MAX_CONFIG_REQUESTS 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_LCP_MAX_CONFIG_NAKS 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_LCP_MAX_TERMINATE_REQUESTS 3
+#define L2TP_API_PPP_PROFILE_DEFAULT_LCP_RETRANSMIT_INTERVAL 3
+#define L2TP_API_PPP_PROFILE_DEFAULT_MAX_CONNECT_TIME 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_MAX_FAILURE_COUNT 10
+#define L2TP_API_PPP_PROFILE_DEFAULT_LOCAL_IP_ADDR 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_PEER_IP_ADDR 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_DNS_ADDR_1 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_DNS_ADDR_2 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_WINS_ADDR_1 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_WINS_ADDR_2 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_USE_RADIUS 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_RADIUS_HINT ""
+#define L2TP_API_PPP_PROFILE_DEFAULT_USE_AS_DEFAULT_ROUTE 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK 0
+#define L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP 0
+
+enum l2tp_api_ppp_sync_mode {
+       L2TP_API_PPP_SYNCMODE_SYNC_ASYNC = 0,
+       L2TP_API_PPP_SYNCMODE_SYNC = 1,
+       L2TP_API_PPP_SYNCMODE_ASYNC = 2,
+};
+typedef enum l2tp_api_ppp_sync_mode l2tp_api_ppp_sync_mode;
+
+struct l2tp_api_ppp_profile_msg_data {
+       uint32_t flags;
+       uint32_t flags2;
+       int result_code;
+       uint32_t trace_flags;
+       uint32_t trace_flags_mask;
+       char *profile_name;
+       uint32_t asyncmap;
+       uint16_t mru;
+       uint16_t mtu;
+       bool_t auth_none;
+       bool_t auth_peer;
+       bool_t auth_refuse_pap;
+       bool_t auth_refuse_chap;
+       bool_t auth_refuse_mschap;
+       bool_t auth_refuse_mschapv2;
+       bool_t auth_refuse_eap;
+       enum l2tp_api_ppp_sync_mode sync_mode;
+       int chap_interval;
+       int chap_max_challenge;
+       int chap_restart;
+       int pap_max_auth_requests;
+       int pap_restart_interval;
+       int pap_timeout;
+       int idle_timeout;
+       int ipcp_max_config_requests;
+       int ipcp_max_config_naks;
+       int ipcp_max_terminate_requests;
+       int ipcp_retransmit_interval;
+       int lcp_echo_failure_count;
+       int lcp_echo_interval;
+       int lcp_max_config_requests;
+       int lcp_max_config_naks;
+       int lcp_max_terminate_requests;
+       int lcp_retransmit_interval;
+       int max_connect_time;
+       int max_failure_count;
+       struct l2tp_api_ip_addr local_ip_addr;
+       struct l2tp_api_ip_addr peer_ip_addr;
+       struct l2tp_api_ip_addr dns_addr_1;
+       struct l2tp_api_ip_addr dns_addr_2;
+       struct l2tp_api_ip_addr wins_addr_1;
+       struct l2tp_api_ip_addr wins_addr_2;
+       optstring ip_pool_name;
+       bool_t use_radius;
+       optstring radius_hint;
+       bool_t use_as_default_route;
+       bool_t multilink;
+       optstring local_name;
+       optstring remote_name;
+       bool_t proxy_arp;
+};
+typedef struct l2tp_api_ppp_profile_msg_data l2tp_api_ppp_profile_msg_data;
+
+struct l2tp_api_ppp_profile_list_entry {
+       char *profile_name;
+       struct l2tp_api_ppp_profile_list_entry *next;
+};
+typedef struct l2tp_api_ppp_profile_list_entry l2tp_api_ppp_profile_list_entry;
+
+struct l2tp_api_ppp_profile_list_msg_data {
+       int result;
+       int num_profiles;
+       struct l2tp_api_ppp_profile_list_entry *profiles;
+};
+typedef struct l2tp_api_ppp_profile_list_msg_data l2tp_api_ppp_profile_list_msg_data;
+
+struct l2tp_api_ppp_profile_unset_msg_data {
+       uint32_t flags;
+       uint32_t flags2;
+       int result_code;
+       char *profile_name;
+};
+typedef struct l2tp_api_ppp_profile_unset_msg_data l2tp_api_ppp_profile_unset_msg_data;
+
+struct l2tp_api_user_list_entry {
+       char *user_name;
+       char *create_time;
+       bool_t created_by_admin;
+       uint16_t tunnel_id;
+       uint16_t session_id;
+       struct l2tp_api_user_list_entry *next;
+};
+typedef struct l2tp_api_user_list_entry l2tp_api_user_list_entry;
+
+struct l2tp_api_user_list_msg_data {
+       int result;
+       int num_users;
+       struct l2tp_api_user_list_entry *users;
+};
+typedef struct l2tp_api_user_list_msg_data l2tp_api_user_list_msg_data;
+#define L2TP_API_TEST_FLAG_FAKE_RX_DROP 1
+#define L2TP_API_TEST_FLAG_FAKE_TX_DROP 2
+#define L2TP_API_TEST_FLAG_FAKE_TRIGGER_TYPE 4
+#define L2TP_API_TEST_FLAG_CLEAR_FAKE_TRIGGER 8
+#define L2TP_API_TEST_FLAG_HOLD_TUNNELS 16
+#define L2TP_API_TEST_FLAG_HOLD_SESSIONS 32
+#define L2TP_API_TEST_FLAG_NO_RANDOM_IDS 64
+#define L2TP_API_TEST_FLAG_RESET_IDS 128
+#define L2TP_API_TEST_FLAG_DO_TRANSPORT_TEST 256
+#define L2TP_API_TEST_FLAG_TUNNEL_ID 512
+#define L2TP_API_TEST_FLAG_SESSION_ID 1024
+#define L2TP_API_TEST_FLAG_DEFAULT_CONFIG 2048
+#define L2TP_API_TEST_FLAG_SHOW_PROFILE_USAGE 4096
+
+enum l2tp_api_test_trigger_type {
+       L2TP_API_TEST_FAKE_TRIGGER_OFF = 0,
+       L2TP_API_TEST_FAKE_TRIGGER_ON = 1,
+       L2TP_API_TEST_FAKE_TRIGGER_ONCE = 2,
+       L2TP_API_TEST_FAKE_TRIGGER_LOW = 3,
+       L2TP_API_TEST_FAKE_TRIGGER_MEDIUM = 4,
+       L2TP_API_TEST_FAKE_TRIGGER_HIGH = 5,
+};
+typedef enum l2tp_api_test_trigger_type l2tp_api_test_trigger_type;
+
+struct l2tp_api_test_msg_data {
+       uint32_t flags;
+       bool_t fake_rx_drop;
+       bool_t fake_tx_drop;
+       bool_t fake_trigger_fired;
+       bool_t hold_tunnels;
+       bool_t hold_sessions;
+       bool_t no_random_ids;
+       bool_t show_profile_usage;
+       int num_rx_drops;
+       int num_tx_drops;
+       enum l2tp_api_test_trigger_type fake_trigger_type;
+       uint16_t tunnel_id;
+       uint16_t session_id;
+       int num_tunnel_id_hash_hits;
+       int num_tunnel_id_hash_misses;
+       int num_tunnel_name_hash_hits;
+       int num_tunnel_name_hash_misses;
+       int num_session_id_hash_hits;
+       int num_session_id_hash_misses;
+};
+typedef struct l2tp_api_test_msg_data l2tp_api_test_msg_data;
+
+struct l2tp_tunnel_delete_1_argument {
+       uint16_t tunnel_id;
+       optstring tunnel_name;
+       optstring reason;
+};
+typedef struct l2tp_tunnel_delete_1_argument l2tp_tunnel_delete_1_argument;
+
+struct l2tp_tunnel_get_1_argument {
+       uint16_t tunnel_id;
+       optstring tunnel_name;
+};
+typedef struct l2tp_tunnel_get_1_argument l2tp_tunnel_get_1_argument;
+
+struct l2tp_session_delete_1_argument {
+       uint16_t tunnel_id;
+       optstring tunnel_name;
+       uint16_t session_id;
+       optstring session_name;
+       optstring reason;
+};
+typedef struct l2tp_session_delete_1_argument l2tp_session_delete_1_argument;
+
+struct l2tp_session_get_1_argument {
+       uint16_t tunnel_id;
+       optstring tunnel_name;
+       uint16_t session_id;
+       optstring session_name;
+};
+typedef struct l2tp_session_get_1_argument l2tp_session_get_1_argument;
+
+struct l2tp_session_list_1_argument {
+       uint16_t tunnel_id;
+       optstring tunnel_name;
+};
+typedef struct l2tp_session_list_1_argument l2tp_session_list_1_argument;
+
+struct l2tp_peer_get_1_argument {
+       struct l2tp_api_ip_addr local_addr;
+       struct l2tp_api_ip_addr peer_addr;
+};
+typedef struct l2tp_peer_get_1_argument l2tp_peer_get_1_argument;
+
+#define L2TP_PROG 300773
+#define L2TP_VERSION 1
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define L2TP_APP_INFO_GET 1
+extern  enum clnt_stat l2tp_app_info_get_1(struct l2tp_api_app_msg_data *, CLIENT *);
+extern  bool_t l2tp_app_info_get_1_svc(struct l2tp_api_app_msg_data *, struct svc_req *);
+#define L2TP_SYSTEM_MODIFY 2
+extern  enum clnt_stat l2tp_system_modify_1(struct l2tp_api_system_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_system_modify_1_svc(struct l2tp_api_system_msg_data , int *, struct svc_req *);
+#define L2TP_SYSTEM_GET 3
+extern  enum clnt_stat l2tp_system_get_1(struct l2tp_api_system_msg_data *, CLIENT *);
+extern  bool_t l2tp_system_get_1_svc(struct l2tp_api_system_msg_data *, struct svc_req *);
+#define L2TP_PEER_PROFILE_CREATE 4
+extern  enum clnt_stat l2tp_peer_profile_create_1(struct l2tp_api_peer_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_peer_profile_create_1_svc(struct l2tp_api_peer_profile_msg_data , int *, struct svc_req *);
+#define L2TP_PEER_PROFILE_DELETE 5
+extern  enum clnt_stat l2tp_peer_profile_delete_1(char *, int *, CLIENT *);
+extern  bool_t l2tp_peer_profile_delete_1_svc(char *, int *, struct svc_req *);
+#define L2TP_PEER_PROFILE_MODIFY 6
+extern  enum clnt_stat l2tp_peer_profile_modify_1(struct l2tp_api_peer_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_peer_profile_modify_1_svc(struct l2tp_api_peer_profile_msg_data , int *, struct svc_req *);
+#define L2TP_PEER_PROFILE_GET 7
+extern  enum clnt_stat l2tp_peer_profile_get_1(char *, struct l2tp_api_peer_profile_msg_data *, CLIENT *);
+extern  bool_t l2tp_peer_profile_get_1_svc(char *, struct l2tp_api_peer_profile_msg_data *, struct svc_req *);
+#define L2TP_PEER_PROFILE_LIST 8
+extern  enum clnt_stat l2tp_peer_profile_list_1(struct l2tp_api_peer_profile_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_peer_profile_list_1_svc(struct l2tp_api_peer_profile_list_msg_data *, struct svc_req *);
+#define L2TP_TUNNEL_CREATE 9
+extern  enum clnt_stat l2tp_tunnel_create_1(struct l2tp_api_tunnel_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_tunnel_create_1_svc(struct l2tp_api_tunnel_msg_data , int *, struct svc_req *);
+#define L2TP_TUNNEL_DELETE 10
+extern  enum clnt_stat l2tp_tunnel_delete_1(uint16_t , optstring , optstring , int *, CLIENT *);
+extern  bool_t l2tp_tunnel_delete_1_svc(uint16_t , optstring , optstring , int *, struct svc_req *);
+#define L2TP_TUNNEL_MODIFY 11
+extern  enum clnt_stat l2tp_tunnel_modify_1(struct l2tp_api_tunnel_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_tunnel_modify_1_svc(struct l2tp_api_tunnel_msg_data , int *, struct svc_req *);
+#define L2TP_TUNNEL_GET 12
+extern  enum clnt_stat l2tp_tunnel_get_1(uint16_t , optstring , struct l2tp_api_tunnel_msg_data *, CLIENT *);
+extern  bool_t l2tp_tunnel_get_1_svc(uint16_t , optstring , struct l2tp_api_tunnel_msg_data *, struct svc_req *);
+#define L2TP_TUNNEL_LIST 13
+extern  enum clnt_stat l2tp_tunnel_list_1(struct l2tp_api_tunnel_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_tunnel_list_1_svc(struct l2tp_api_tunnel_list_msg_data *, struct svc_req *);
+#define L2TP_TUNNEL_PROFILE_CREATE 14
+extern  enum clnt_stat l2tp_tunnel_profile_create_1(struct l2tp_api_tunnel_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_tunnel_profile_create_1_svc(struct l2tp_api_tunnel_profile_msg_data , int *, struct svc_req *);
+#define L2TP_TUNNEL_PROFILE_DELETE 15
+extern  enum clnt_stat l2tp_tunnel_profile_delete_1(char *, int *, CLIENT *);
+extern  bool_t l2tp_tunnel_profile_delete_1_svc(char *, int *, struct svc_req *);
+#define L2TP_TUNNEL_PROFILE_MODIFY 16
+extern  enum clnt_stat l2tp_tunnel_profile_modify_1(struct l2tp_api_tunnel_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_tunnel_profile_modify_1_svc(struct l2tp_api_tunnel_profile_msg_data , int *, struct svc_req *);
+#define L2TP_TUNNEL_PROFILE_GET 17
+extern  enum clnt_stat l2tp_tunnel_profile_get_1(char *, struct l2tp_api_tunnel_profile_msg_data *, CLIENT *);
+extern  bool_t l2tp_tunnel_profile_get_1_svc(char *, struct l2tp_api_tunnel_profile_msg_data *, struct svc_req *);
+#define L2TP_TUNNEL_PROFILE_LIST 18
+extern  enum clnt_stat l2tp_tunnel_profile_list_1(struct l2tp_api_tunnel_profile_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_tunnel_profile_list_1_svc(struct l2tp_api_tunnel_profile_list_msg_data *, struct svc_req *);
+#define L2TP_SESSION_CREATE 19
+extern  enum clnt_stat l2tp_session_create_1(struct l2tp_api_session_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_session_create_1_svc(struct l2tp_api_session_msg_data , int *, struct svc_req *);
+#define L2TP_SESSION_DELETE 20
+extern  enum clnt_stat l2tp_session_delete_1(uint16_t , optstring , uint16_t , optstring , optstring , int *, CLIENT *);
+extern  bool_t l2tp_session_delete_1_svc(uint16_t , optstring , uint16_t , optstring , optstring , int *, struct svc_req *);
+#define L2TP_SESSION_MODIFY 21
+extern  enum clnt_stat l2tp_session_modify_1(struct l2tp_api_session_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_session_modify_1_svc(struct l2tp_api_session_msg_data , int *, struct svc_req *);
+#define L2TP_SESSION_GET 22
+extern  enum clnt_stat l2tp_session_get_1(uint16_t , optstring , uint16_t , optstring , struct l2tp_api_session_msg_data *, CLIENT *);
+extern  bool_t l2tp_session_get_1_svc(uint16_t , optstring , uint16_t , optstring , struct l2tp_api_session_msg_data *, struct svc_req *);
+#define L2TP_SESSION_LIST 23
+extern  enum clnt_stat l2tp_session_list_1(uint16_t , optstring , struct l2tp_api_session_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_session_list_1_svc(uint16_t , optstring , struct l2tp_api_session_list_msg_data *, struct svc_req *);
+#define L2TP_SESSION_INCALL_IND 24
+extern  enum clnt_stat l2tp_session_incall_ind_1(struct l2tp_api_session_incall_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_session_incall_ind_1_svc(struct l2tp_api_session_incall_msg_data , int *, struct svc_req *);
+#define L2TP_SESSION_PROFILE_CREATE 25
+extern  enum clnt_stat l2tp_session_profile_create_1(struct l2tp_api_session_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_session_profile_create_1_svc(struct l2tp_api_session_profile_msg_data , int *, struct svc_req *);
+#define L2TP_SESSION_PROFILE_DELETE 26
+extern  enum clnt_stat l2tp_session_profile_delete_1(char *, int *, CLIENT *);
+extern  bool_t l2tp_session_profile_delete_1_svc(char *, int *, struct svc_req *);
+#define L2TP_SESSION_PROFILE_MODIFY 27
+extern  enum clnt_stat l2tp_session_profile_modify_1(struct l2tp_api_session_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_session_profile_modify_1_svc(struct l2tp_api_session_profile_msg_data , int *, struct svc_req *);
+#define L2TP_SESSION_PROFILE_GET 28
+extern  enum clnt_stat l2tp_session_profile_get_1(char *, struct l2tp_api_session_profile_msg_data *, CLIENT *);
+extern  bool_t l2tp_session_profile_get_1_svc(char *, struct l2tp_api_session_profile_msg_data *, struct svc_req *);
+#define L2TP_SESSION_PROFILE_LIST 29
+extern  enum clnt_stat l2tp_session_profile_list_1(struct l2tp_api_session_profile_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_session_profile_list_1_svc(struct l2tp_api_session_profile_list_msg_data *, struct svc_req *);
+#define L2TP_PPP_PROFILE_CREATE 30
+extern  enum clnt_stat l2tp_ppp_profile_create_1(struct l2tp_api_ppp_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_ppp_profile_create_1_svc(struct l2tp_api_ppp_profile_msg_data , int *, struct svc_req *);
+#define L2TP_PPP_PROFILE_DELETE 31
+extern  enum clnt_stat l2tp_ppp_profile_delete_1(char *, int *, CLIENT *);
+extern  bool_t l2tp_ppp_profile_delete_1_svc(char *, int *, struct svc_req *);
+#define L2TP_PPP_PROFILE_MODIFY 32
+extern  enum clnt_stat l2tp_ppp_profile_modify_1(struct l2tp_api_ppp_profile_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_ppp_profile_modify_1_svc(struct l2tp_api_ppp_profile_msg_data , int *, struct svc_req *);
+#define L2TP_PPP_PROFILE_GET 33
+extern  enum clnt_stat l2tp_ppp_profile_get_1(char *, struct l2tp_api_ppp_profile_msg_data *, CLIENT *);
+extern  bool_t l2tp_ppp_profile_get_1_svc(char *, struct l2tp_api_ppp_profile_msg_data *, struct svc_req *);
+#define L2TP_PPP_PROFILE_LIST 34
+extern  enum clnt_stat l2tp_ppp_profile_list_1(struct l2tp_api_ppp_profile_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_ppp_profile_list_1_svc(struct l2tp_api_ppp_profile_list_msg_data *, struct svc_req *);
+#define L2TP_PEER_GET 35
+extern  enum clnt_stat l2tp_peer_get_1(struct l2tp_api_ip_addr , struct l2tp_api_ip_addr , struct l2tp_api_peer_msg_data *, CLIENT *);
+extern  bool_t l2tp_peer_get_1_svc(struct l2tp_api_ip_addr , struct l2tp_api_ip_addr , struct l2tp_api_peer_msg_data *, struct svc_req *);
+#define L2TP_PEER_LIST 36
+extern  enum clnt_stat l2tp_peer_list_1(struct l2tp_api_peer_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_peer_list_1_svc(struct l2tp_api_peer_list_msg_data *, struct svc_req *);
+#define L2TP_USER_LIST 37
+extern  enum clnt_stat l2tp_user_list_1(struct l2tp_api_user_list_msg_data *, CLIENT *);
+extern  bool_t l2tp_user_list_1_svc(struct l2tp_api_user_list_msg_data *, struct svc_req *);
+#define L2TP_PEER_PROFILE_UNSET 38
+extern  enum clnt_stat l2tp_peer_profile_unset_1(struct l2tp_api_peer_profile_unset_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_peer_profile_unset_1_svc(struct l2tp_api_peer_profile_unset_msg_data , int *, struct svc_req *);
+#define L2TP_TUNNEL_PROFILE_UNSET 39
+extern  enum clnt_stat l2tp_tunnel_profile_unset_1(struct l2tp_api_tunnel_profile_unset_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_tunnel_profile_unset_1_svc(struct l2tp_api_tunnel_profile_unset_msg_data , int *, struct svc_req *);
+#define L2TP_SESSION_PROFILE_UNSET 40
+extern  enum clnt_stat l2tp_session_profile_unset_1(struct l2tp_api_session_profile_unset_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_session_profile_unset_1_svc(struct l2tp_api_session_profile_unset_msg_data , int *, struct svc_req *);
+#define L2TP_PPP_PROFILE_UNSET 41
+extern  enum clnt_stat l2tp_ppp_profile_unset_1(struct l2tp_api_ppp_profile_unset_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_ppp_profile_unset_1_svc(struct l2tp_api_ppp_profile_unset_msg_data , int *, struct svc_req *);
+#define L2TP_TEST_LOG 97
+extern  enum clnt_stat l2tp_test_log_1(char *, int *, CLIENT *);
+extern  bool_t l2tp_test_log_1_svc(char *, int *, struct svc_req *);
+#define L2TP_TEST_MODIFY 98
+extern  enum clnt_stat l2tp_test_modify_1(struct l2tp_api_test_msg_data , int *, CLIENT *);
+extern  bool_t l2tp_test_modify_1_svc(struct l2tp_api_test_msg_data , int *, struct svc_req *);
+#define L2TP_TEST_GET 99
+extern  enum clnt_stat l2tp_test_get_1(struct l2tp_api_test_msg_data *, CLIENT *);
+extern  bool_t l2tp_test_get_1_svc(struct l2tp_api_test_msg_data *, struct svc_req *);
+extern int l2tp_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define L2TP_APP_INFO_GET 1
+extern  enum clnt_stat l2tp_app_info_get_1();
+extern  bool_t l2tp_app_info_get_1_svc();
+#define L2TP_SYSTEM_MODIFY 2
+extern  enum clnt_stat l2tp_system_modify_1();
+extern  bool_t l2tp_system_modify_1_svc();
+#define L2TP_SYSTEM_GET 3
+extern  enum clnt_stat l2tp_system_get_1();
+extern  bool_t l2tp_system_get_1_svc();
+#define L2TP_PEER_PROFILE_CREATE 4
+extern  enum clnt_stat l2tp_peer_profile_create_1();
+extern  bool_t l2tp_peer_profile_create_1_svc();
+#define L2TP_PEER_PROFILE_DELETE 5
+extern  enum clnt_stat l2tp_peer_profile_delete_1();
+extern  bool_t l2tp_peer_profile_delete_1_svc();
+#define L2TP_PEER_PROFILE_MODIFY 6
+extern  enum clnt_stat l2tp_peer_profile_modify_1();
+extern  bool_t l2tp_peer_profile_modify_1_svc();
+#define L2TP_PEER_PROFILE_GET 7
+extern  enum clnt_stat l2tp_peer_profile_get_1();
+extern  bool_t l2tp_peer_profile_get_1_svc();
+#define L2TP_PEER_PROFILE_LIST 8
+extern  enum clnt_stat l2tp_peer_profile_list_1();
+extern  bool_t l2tp_peer_profile_list_1_svc();
+#define L2TP_TUNNEL_CREATE 9
+extern  enum clnt_stat l2tp_tunnel_create_1();
+extern  bool_t l2tp_tunnel_create_1_svc();
+#define L2TP_TUNNEL_DELETE 10
+extern  enum clnt_stat l2tp_tunnel_delete_1();
+extern  bool_t l2tp_tunnel_delete_1_svc();
+#define L2TP_TUNNEL_MODIFY 11
+extern  enum clnt_stat l2tp_tunnel_modify_1();
+extern  bool_t l2tp_tunnel_modify_1_svc();
+#define L2TP_TUNNEL_GET 12
+extern  enum clnt_stat l2tp_tunnel_get_1();
+extern  bool_t l2tp_tunnel_get_1_svc();
+#define L2TP_TUNNEL_LIST 13
+extern  enum clnt_stat l2tp_tunnel_list_1();
+extern  bool_t l2tp_tunnel_list_1_svc();
+#define L2TP_TUNNEL_PROFILE_CREATE 14
+extern  enum clnt_stat l2tp_tunnel_profile_create_1();
+extern  bool_t l2tp_tunnel_profile_create_1_svc();
+#define L2TP_TUNNEL_PROFILE_DELETE 15
+extern  enum clnt_stat l2tp_tunnel_profile_delete_1();
+extern  bool_t l2tp_tunnel_profile_delete_1_svc();
+#define L2TP_TUNNEL_PROFILE_MODIFY 16
+extern  enum clnt_stat l2tp_tunnel_profile_modify_1();
+extern  bool_t l2tp_tunnel_profile_modify_1_svc();
+#define L2TP_TUNNEL_PROFILE_GET 17
+extern  enum clnt_stat l2tp_tunnel_profile_get_1();
+extern  bool_t l2tp_tunnel_profile_get_1_svc();
+#define L2TP_TUNNEL_PROFILE_LIST 18
+extern  enum clnt_stat l2tp_tunnel_profile_list_1();
+extern  bool_t l2tp_tunnel_profile_list_1_svc();
+#define L2TP_SESSION_CREATE 19
+extern  enum clnt_stat l2tp_session_create_1();
+extern  bool_t l2tp_session_create_1_svc();
+#define L2TP_SESSION_DELETE 20
+extern  enum clnt_stat l2tp_session_delete_1();
+extern  bool_t l2tp_session_delete_1_svc();
+#define L2TP_SESSION_MODIFY 21
+extern  enum clnt_stat l2tp_session_modify_1();
+extern  bool_t l2tp_session_modify_1_svc();
+#define L2TP_SESSION_GET 22
+extern  enum clnt_stat l2tp_session_get_1();
+extern  bool_t l2tp_session_get_1_svc();
+#define L2TP_SESSION_LIST 23
+extern  enum clnt_stat l2tp_session_list_1();
+extern  bool_t l2tp_session_list_1_svc();
+#define L2TP_SESSION_INCALL_IND 24
+extern  enum clnt_stat l2tp_session_incall_ind_1();
+extern  bool_t l2tp_session_incall_ind_1_svc();
+#define L2TP_SESSION_PROFILE_CREATE 25
+extern  enum clnt_stat l2tp_session_profile_create_1();
+extern  bool_t l2tp_session_profile_create_1_svc();
+#define L2TP_SESSION_PROFILE_DELETE 26
+extern  enum clnt_stat l2tp_session_profile_delete_1();
+extern  bool_t l2tp_session_profile_delete_1_svc();
+#define L2TP_SESSION_PROFILE_MODIFY 27
+extern  enum clnt_stat l2tp_session_profile_modify_1();
+extern  bool_t l2tp_session_profile_modify_1_svc();
+#define L2TP_SESSION_PROFILE_GET 28
+extern  enum clnt_stat l2tp_session_profile_get_1();
+extern  bool_t l2tp_session_profile_get_1_svc();
+#define L2TP_SESSION_PROFILE_LIST 29
+extern  enum clnt_stat l2tp_session_profile_list_1();
+extern  bool_t l2tp_session_profile_list_1_svc();
+#define L2TP_PPP_PROFILE_CREATE 30
+extern  enum clnt_stat l2tp_ppp_profile_create_1();
+extern  bool_t l2tp_ppp_profile_create_1_svc();
+#define L2TP_PPP_PROFILE_DELETE 31
+extern  enum clnt_stat l2tp_ppp_profile_delete_1();
+extern  bool_t l2tp_ppp_profile_delete_1_svc();
+#define L2TP_PPP_PROFILE_MODIFY 32
+extern  enum clnt_stat l2tp_ppp_profile_modify_1();
+extern  bool_t l2tp_ppp_profile_modify_1_svc();
+#define L2TP_PPP_PROFILE_GET 33
+extern  enum clnt_stat l2tp_ppp_profile_get_1();
+extern  bool_t l2tp_ppp_profile_get_1_svc();
+#define L2TP_PPP_PROFILE_LIST 34
+extern  enum clnt_stat l2tp_ppp_profile_list_1();
+extern  bool_t l2tp_ppp_profile_list_1_svc();
+#define L2TP_PEER_GET 35
+extern  enum clnt_stat l2tp_peer_get_1();
+extern  bool_t l2tp_peer_get_1_svc();
+#define L2TP_PEER_LIST 36
+extern  enum clnt_stat l2tp_peer_list_1();
+extern  bool_t l2tp_peer_list_1_svc();
+#define L2TP_USER_LIST 37
+extern  enum clnt_stat l2tp_user_list_1();
+extern  bool_t l2tp_user_list_1_svc();
+#define L2TP_PEER_PROFILE_UNSET 38
+extern  enum clnt_stat l2tp_peer_profile_unset_1();
+extern  bool_t l2tp_peer_profile_unset_1_svc();
+#define L2TP_TUNNEL_PROFILE_UNSET 39
+extern  enum clnt_stat l2tp_tunnel_profile_unset_1();
+extern  bool_t l2tp_tunnel_profile_unset_1_svc();
+#define L2TP_SESSION_PROFILE_UNSET 40
+extern  enum clnt_stat l2tp_session_profile_unset_1();
+extern  bool_t l2tp_session_profile_unset_1_svc();
+#define L2TP_PPP_PROFILE_UNSET 41
+extern  enum clnt_stat l2tp_ppp_profile_unset_1();
+extern  bool_t l2tp_ppp_profile_unset_1_svc();
+#define L2TP_TEST_LOG 97
+extern  enum clnt_stat l2tp_test_log_1();
+extern  bool_t l2tp_test_log_1_svc();
+#define L2TP_TEST_MODIFY 98
+extern  enum clnt_stat l2tp_test_modify_1();
+extern  bool_t l2tp_test_modify_1_svc();
+#define L2TP_TEST_GET 99
+extern  enum clnt_stat l2tp_test_get_1();
+extern  bool_t l2tp_test_get_1_svc();
+extern int l2tp_prog_1_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern  bool_t xdr_optstring (XDR *, optstring*);
+extern  bool_t xdr_l2tp_api_tunnel_auth_mode (XDR *, l2tp_api_tunnel_auth_mode*);
+extern  bool_t xdr_l2tp_api_tunnel_mode (XDR *, l2tp_api_tunnel_mode*);
+extern  bool_t xdr_l2tp_api_ip_addr (XDR *, l2tp_api_ip_addr*);
+extern  bool_t xdr_l2tp_api_app_msg_data (XDR *, l2tp_api_app_msg_data*);
+extern  bool_t xdr_l2tp_api_system_config (XDR *, l2tp_api_system_config*);
+extern  bool_t xdr_l2tp_api_system_msg_stats (XDR *, l2tp_api_system_msg_stats*);
+extern  bool_t xdr_l2tp_api_system_stats (XDR *, l2tp_api_system_stats*);
+extern  bool_t xdr_l2tp_api_system_status (XDR *, l2tp_api_system_status*);
+extern  bool_t xdr_l2tp_api_system_msg_data (XDR *, l2tp_api_system_msg_data*);
+extern  bool_t xdr_l2tp_api_peer_msg_data (XDR *, l2tp_api_peer_msg_data*);
+extern  bool_t xdr_l2tp_api_peer_list_entry (XDR *, l2tp_api_peer_list_entry*);
+extern  bool_t xdr_l2tp_api_peer_list_msg_data (XDR *, l2tp_api_peer_list_msg_data*);
+extern  bool_t xdr_l2tp_api_peer_profile_msg_data (XDR *, l2tp_api_peer_profile_msg_data*);
+extern  bool_t xdr_l2tp_api_peer_profile_list_entry (XDR *, l2tp_api_peer_profile_list_entry*);
+extern  bool_t xdr_l2tp_api_peer_profile_list_msg_data (XDR *, l2tp_api_peer_profile_list_msg_data*);
+extern  bool_t xdr_l2tp_api_peer_profile_unset_msg_data (XDR *, l2tp_api_peer_profile_unset_msg_data*);
+extern  bool_t xdr_l2tp_api_tunnel_peer (XDR *, l2tp_api_tunnel_peer*);
+extern  bool_t xdr_l2tp_api_tunnel_stats (XDR *, l2tp_api_tunnel_stats*);
+extern  bool_t xdr_l2tp_api_tunnel_msg_data (XDR *, l2tp_api_tunnel_msg_data*);
+extern  bool_t xdr_l2tp_api_tunnel_list_msg_data (XDR *, l2tp_api_tunnel_list_msg_data*);
+extern  bool_t xdr_l2tp_api_tunnel_profile_msg_data (XDR *, l2tp_api_tunnel_profile_msg_data*);
+extern  bool_t xdr_l2tp_api_tunnel_profile_list_entry (XDR *, l2tp_api_tunnel_profile_list_entry*);
+extern  bool_t xdr_l2tp_api_tunnel_profile_list_msg_data (XDR *, l2tp_api_tunnel_profile_list_msg_data*);
+extern  bool_t xdr_l2tp_api_tunnel_profile_unset_msg_data (XDR *, l2tp_api_tunnel_profile_unset_msg_data*);
+extern  bool_t xdr_l2tp_api_session_proxy_auth_type (XDR *, l2tp_api_session_proxy_auth_type*);
+extern  bool_t xdr_l2tp_api_session_call_errors (XDR *, l2tp_api_session_call_errors*);
+extern  bool_t xdr_l2tp_api_session_stats (XDR *, l2tp_api_session_stats*);
+extern  bool_t xdr_l2tp_api_session_peer_info (XDR *, l2tp_api_session_peer_info*);
+extern  bool_t xdr_l2tp_api_session_type (XDR *, l2tp_api_session_type*);
+extern  bool_t xdr_l2tp_api_session_msg_data (XDR *, l2tp_api_session_msg_data*);
+extern  bool_t xdr_l2tp_api_session_list_msg_data (XDR *, l2tp_api_session_list_msg_data*);
+extern  bool_t xdr_l2tp_api_session_incall_msg_data (XDR *, l2tp_api_session_incall_msg_data*);
+extern  bool_t xdr_l2tp_api_session_profile_msg_data (XDR *, l2tp_api_session_profile_msg_data*);
+extern  bool_t xdr_l2tp_api_session_profile_list_entry (XDR *, l2tp_api_session_profile_list_entry*);
+extern  bool_t xdr_l2tp_api_session_profile_list_msg_data (XDR *, l2tp_api_session_profile_list_msg_data*);
+extern  bool_t xdr_l2tp_api_session_profile_unset_msg_data (XDR *, l2tp_api_session_profile_unset_msg_data*);
+extern  bool_t xdr_l2tp_api_ppp_sync_mode (XDR *, l2tp_api_ppp_sync_mode*);
+extern  bool_t xdr_l2tp_api_ppp_profile_msg_data (XDR *, l2tp_api_ppp_profile_msg_data*);
+extern  bool_t xdr_l2tp_api_ppp_profile_list_entry (XDR *, l2tp_api_ppp_profile_list_entry*);
+extern  bool_t xdr_l2tp_api_ppp_profile_list_msg_data (XDR *, l2tp_api_ppp_profile_list_msg_data*);
+extern  bool_t xdr_l2tp_api_ppp_profile_unset_msg_data (XDR *, l2tp_api_ppp_profile_unset_msg_data*);
+extern  bool_t xdr_l2tp_api_user_list_entry (XDR *, l2tp_api_user_list_entry*);
+extern  bool_t xdr_l2tp_api_user_list_msg_data (XDR *, l2tp_api_user_list_msg_data*);
+extern  bool_t xdr_l2tp_api_test_trigger_type (XDR *, l2tp_api_test_trigger_type*);
+extern  bool_t xdr_l2tp_api_test_msg_data (XDR *, l2tp_api_test_msg_data*);
+extern  bool_t xdr_l2tp_tunnel_delete_1_argument (XDR *, l2tp_tunnel_delete_1_argument*);
+extern  bool_t xdr_l2tp_tunnel_get_1_argument (XDR *, l2tp_tunnel_get_1_argument*);
+extern  bool_t xdr_l2tp_session_delete_1_argument (XDR *, l2tp_session_delete_1_argument*);
+extern  bool_t xdr_l2tp_session_get_1_argument (XDR *, l2tp_session_get_1_argument*);
+extern  bool_t xdr_l2tp_session_list_1_argument (XDR *, l2tp_session_list_1_argument*);
+extern  bool_t xdr_l2tp_peer_get_1_argument (XDR *, l2tp_peer_get_1_argument*);
+
+#else /* K&R C */
+extern bool_t xdr_optstring ();
+extern bool_t xdr_l2tp_api_tunnel_auth_mode ();
+extern bool_t xdr_l2tp_api_tunnel_mode ();
+extern bool_t xdr_l2tp_api_ip_addr ();
+extern bool_t xdr_l2tp_api_app_msg_data ();
+extern bool_t xdr_l2tp_api_system_config ();
+extern bool_t xdr_l2tp_api_system_msg_stats ();
+extern bool_t xdr_l2tp_api_system_stats ();
+extern bool_t xdr_l2tp_api_system_status ();
+extern bool_t xdr_l2tp_api_system_msg_data ();
+extern bool_t xdr_l2tp_api_peer_msg_data ();
+extern bool_t xdr_l2tp_api_peer_list_entry ();
+extern bool_t xdr_l2tp_api_peer_list_msg_data ();
+extern bool_t xdr_l2tp_api_peer_profile_msg_data ();
+extern bool_t xdr_l2tp_api_peer_profile_list_entry ();
+extern bool_t xdr_l2tp_api_peer_profile_list_msg_data ();
+extern bool_t xdr_l2tp_api_peer_profile_unset_msg_data ();
+extern bool_t xdr_l2tp_api_tunnel_peer ();
+extern bool_t xdr_l2tp_api_tunnel_stats ();
+extern bool_t xdr_l2tp_api_tunnel_msg_data ();
+extern bool_t xdr_l2tp_api_tunnel_list_msg_data ();
+extern bool_t xdr_l2tp_api_tunnel_profile_msg_data ();
+extern bool_t xdr_l2tp_api_tunnel_profile_list_entry ();
+extern bool_t xdr_l2tp_api_tunnel_profile_list_msg_data ();
+extern bool_t xdr_l2tp_api_tunnel_profile_unset_msg_data ();
+extern bool_t xdr_l2tp_api_session_proxy_auth_type ();
+extern bool_t xdr_l2tp_api_session_call_errors ();
+extern bool_t xdr_l2tp_api_session_stats ();
+extern bool_t xdr_l2tp_api_session_peer_info ();
+extern bool_t xdr_l2tp_api_session_type ();
+extern bool_t xdr_l2tp_api_session_msg_data ();
+extern bool_t xdr_l2tp_api_session_list_msg_data ();
+extern bool_t xdr_l2tp_api_session_incall_msg_data ();
+extern bool_t xdr_l2tp_api_session_profile_msg_data ();
+extern bool_t xdr_l2tp_api_session_profile_list_entry ();
+extern bool_t xdr_l2tp_api_session_profile_list_msg_data ();
+extern bool_t xdr_l2tp_api_session_profile_unset_msg_data ();
+extern bool_t xdr_l2tp_api_ppp_sync_mode ();
+extern bool_t xdr_l2tp_api_ppp_profile_msg_data ();
+extern bool_t xdr_l2tp_api_ppp_profile_list_entry ();
+extern bool_t xdr_l2tp_api_ppp_profile_list_msg_data ();
+extern bool_t xdr_l2tp_api_ppp_profile_unset_msg_data ();
+extern bool_t xdr_l2tp_api_user_list_entry ();
+extern bool_t xdr_l2tp_api_user_list_msg_data ();
+extern bool_t xdr_l2tp_api_test_trigger_type ();
+extern bool_t xdr_l2tp_api_test_msg_data ();
+extern bool_t xdr_l2tp_tunnel_delete_1_argument ();
+extern bool_t xdr_l2tp_tunnel_get_1_argument ();
+extern bool_t xdr_l2tp_session_delete_1_argument ();
+extern bool_t xdr_l2tp_session_get_1_argument ();
+extern bool_t xdr_l2tp_session_list_1_argument ();
+extern bool_t xdr_l2tp_peer_get_1_argument ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_L2TP_RPC_H_RPCGEN */
diff --git a/net/openl2tp/src/l2tp_rpc_client.c b/net/openl2tp/src/l2tp_rpc_client.c
new file mode 100644 (file)
index 0000000..2acec51
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "l2tp_rpc.h"
+#define OPTSTRING(_var) _var.optstring_u.value
+#define OPTSTRING_PTR(_var) ((_var.valid == 1) ? _var.optstring_u.value : NULL)
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat 
+l2tp_app_info_get_1(struct l2tp_api_app_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_APP_INFO_GET, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_app_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_system_modify_1(struct l2tp_api_system_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SYSTEM_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_system_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_system_get_1(struct l2tp_api_system_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_SYSTEM_GET, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_system_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_peer_profile_create_1(struct l2tp_api_peer_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PEER_PROFILE_CREATE,
+               (xdrproc_t) xdr_l2tp_api_peer_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_peer_profile_delete_1(char *name, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PEER_PROFILE_DELETE,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_peer_profile_modify_1(struct l2tp_api_peer_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PEER_PROFILE_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_peer_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_peer_profile_get_1(char *name, struct l2tp_api_peer_profile_msg_data *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PEER_PROFILE_GET,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_l2tp_api_peer_profile_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_peer_profile_list_1(struct l2tp_api_peer_profile_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_PEER_PROFILE_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_peer_profile_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_tunnel_create_1(struct l2tp_api_tunnel_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_CREATE,
+               (xdrproc_t) xdr_l2tp_api_tunnel_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_delete_1(uint16_t tunnel_id, optstring tunnel_name, optstring reason, int *clnt_res,  CLIENT *clnt)
+{
+       l2tp_tunnel_delete_1_argument arg;
+       arg.tunnel_id = tunnel_id;
+       arg.tunnel_name = tunnel_name;
+       arg.reason = reason;
+       return (clnt_call (clnt, L2TP_TUNNEL_DELETE, (xdrproc_t) xdr_l2tp_tunnel_delete_1_argument, (caddr_t) &arg,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_modify_1(struct l2tp_api_tunnel_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_tunnel_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_get_1(uint16_t tunnel_id, optstring tunnel_name, struct l2tp_api_tunnel_msg_data *clnt_res,  CLIENT *clnt)
+{
+       l2tp_tunnel_get_1_argument arg;
+       arg.tunnel_id = tunnel_id;
+       arg.tunnel_name = tunnel_name;
+       return (clnt_call (clnt, L2TP_TUNNEL_GET, (xdrproc_t) xdr_l2tp_tunnel_get_1_argument, (caddr_t) &arg,
+               (xdrproc_t) xdr_l2tp_api_tunnel_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_list_1(struct l2tp_api_tunnel_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_TUNNEL_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_tunnel_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_tunnel_profile_create_1(struct l2tp_api_tunnel_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_PROFILE_CREATE,
+               (xdrproc_t) xdr_l2tp_api_tunnel_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_profile_delete_1(char *name, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_PROFILE_DELETE,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_profile_modify_1(struct l2tp_api_tunnel_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_PROFILE_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_tunnel_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_profile_get_1(char *name, struct l2tp_api_tunnel_profile_msg_data *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_PROFILE_GET,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_l2tp_api_tunnel_profile_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_profile_list_1(struct l2tp_api_tunnel_profile_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_TUNNEL_PROFILE_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_tunnel_profile_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_session_create_1(struct l2tp_api_session_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_CREATE,
+               (xdrproc_t) xdr_l2tp_api_session_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_delete_1(uint16_t tunnel_id, optstring tunnel_name, uint16_t session_id, optstring session_name, optstring reason, int *clnt_res,  CLIENT *clnt)
+{
+       l2tp_session_delete_1_argument arg;
+       arg.tunnel_id = tunnel_id;
+       arg.tunnel_name = tunnel_name;
+       arg.session_id = session_id;
+       arg.session_name = session_name;
+       arg.reason = reason;
+       return (clnt_call (clnt, L2TP_SESSION_DELETE, (xdrproc_t) xdr_l2tp_session_delete_1_argument, (caddr_t) &arg,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_modify_1(struct l2tp_api_session_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_session_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_get_1(uint16_t tunnel_id, optstring tunnel_name, uint16_t session_id, optstring session_name, struct l2tp_api_session_msg_data *clnt_res,  CLIENT *clnt)
+{
+       l2tp_session_get_1_argument arg;
+       arg.tunnel_id = tunnel_id;
+       arg.tunnel_name = tunnel_name;
+       arg.session_id = session_id;
+       arg.session_name = session_name;
+       return (clnt_call (clnt, L2TP_SESSION_GET, (xdrproc_t) xdr_l2tp_session_get_1_argument, (caddr_t) &arg,
+               (xdrproc_t) xdr_l2tp_api_session_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_list_1(uint16_t tunnel_id, optstring tunnel_name, struct l2tp_api_session_list_msg_data *clnt_res,  CLIENT *clnt)
+{
+       l2tp_session_list_1_argument arg;
+       arg.tunnel_id = tunnel_id;
+       arg.tunnel_name = tunnel_name;
+       return (clnt_call (clnt, L2TP_SESSION_LIST, (xdrproc_t) xdr_l2tp_session_list_1_argument, (caddr_t) &arg,
+               (xdrproc_t) xdr_l2tp_api_session_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_incall_ind_1(struct l2tp_api_session_incall_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_INCALL_IND,
+               (xdrproc_t) xdr_l2tp_api_session_incall_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_profile_create_1(struct l2tp_api_session_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_PROFILE_CREATE,
+               (xdrproc_t) xdr_l2tp_api_session_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_profile_delete_1(char *name, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_PROFILE_DELETE,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_profile_modify_1(struct l2tp_api_session_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_PROFILE_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_session_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_profile_get_1(char *name, struct l2tp_api_session_profile_msg_data *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_PROFILE_GET,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_l2tp_api_session_profile_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_profile_list_1(struct l2tp_api_session_profile_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_SESSION_PROFILE_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_session_profile_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_ppp_profile_create_1(struct l2tp_api_ppp_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PPP_PROFILE_CREATE,
+               (xdrproc_t) xdr_l2tp_api_ppp_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_ppp_profile_delete_1(char *name, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PPP_PROFILE_DELETE,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_ppp_profile_modify_1(struct l2tp_api_ppp_profile_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PPP_PROFILE_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_ppp_profile_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_ppp_profile_get_1(char *name, struct l2tp_api_ppp_profile_msg_data *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PPP_PROFILE_GET,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
+               (xdrproc_t) xdr_l2tp_api_ppp_profile_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_ppp_profile_list_1(struct l2tp_api_ppp_profile_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_PPP_PROFILE_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_ppp_profile_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_peer_get_1(struct l2tp_api_ip_addr local_addr, struct l2tp_api_ip_addr peer_addr, struct l2tp_api_peer_msg_data *clnt_res,  CLIENT *clnt)
+{
+       l2tp_peer_get_1_argument arg;
+       arg.local_addr = local_addr;
+       arg.peer_addr = peer_addr;
+       return (clnt_call (clnt, L2TP_PEER_GET, (xdrproc_t) xdr_l2tp_peer_get_1_argument, (caddr_t) &arg,
+               (xdrproc_t) xdr_l2tp_api_peer_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_peer_list_1(struct l2tp_api_peer_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_PEER_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_peer_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_user_list_1(struct l2tp_api_user_list_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_USER_LIST, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_user_list_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
+
+enum clnt_stat 
+l2tp_peer_profile_unset_1(struct l2tp_api_peer_profile_unset_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PEER_PROFILE_UNSET,
+               (xdrproc_t) xdr_l2tp_api_peer_profile_unset_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_tunnel_profile_unset_1(struct l2tp_api_tunnel_profile_unset_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TUNNEL_PROFILE_UNSET,
+               (xdrproc_t) xdr_l2tp_api_tunnel_profile_unset_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_session_profile_unset_1(struct l2tp_api_session_profile_unset_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_SESSION_PROFILE_UNSET,
+               (xdrproc_t) xdr_l2tp_api_session_profile_unset_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_ppp_profile_unset_1(struct l2tp_api_ppp_profile_unset_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_PPP_PROFILE_UNSET,
+               (xdrproc_t) xdr_l2tp_api_ppp_profile_unset_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_test_log_1(char *text, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TEST_LOG,
+               (xdrproc_t) xdr_wrapstring, (caddr_t) &text,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_test_modify_1(struct l2tp_api_test_msg_data params, int *clnt_res,  CLIENT *clnt)
+{
+       return (clnt_call(clnt, L2TP_TEST_MODIFY,
+               (xdrproc_t) xdr_l2tp_api_test_msg_data, (caddr_t) &params,
+               (xdrproc_t) xdr_int, (caddr_t) clnt_res,
+               TIMEOUT));
+}
+
+enum clnt_stat 
+l2tp_test_get_1(struct l2tp_api_test_msg_data *clnt_res, CLIENT *clnt)
+{
+        return (clnt_call (clnt, L2TP_TEST_GET, (xdrproc_t) xdr_void, (caddr_t) NULL,
+               (xdrproc_t) xdr_l2tp_api_test_msg_data, (caddr_t) clnt_res,
+               TIMEOUT));
+
+}
diff --git a/net/openl2tp/src/l2tp_rpc_server.c b/net/openl2tp/src/l2tp_rpc_server.c
new file mode 100644 (file)
index 0000000..b2dd30a
--- /dev/null
@@ -0,0 +1,665 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "l2tp_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <syslog.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+#define OPTSTRING(_var) _var.optstring_u.value
+#define OPTSTRING_PTR(_var) ((_var.valid == 1) ? _var.optstring_u.value : NULL)
+
+int
+_l2tp_app_info_get_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_app_info_get_1_svc(result, rqstp));
+}
+
+int
+_l2tp_system_modify_1 (struct l2tp_api_system_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_system_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_system_get_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_system_get_1_svc(result, rqstp));
+}
+
+int
+_l2tp_peer_profile_create_1 (struct l2tp_api_peer_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_profile_create_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_peer_profile_delete_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_profile_delete_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_peer_profile_modify_1 (struct l2tp_api_peer_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_profile_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_peer_profile_get_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_profile_get_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_peer_profile_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_profile_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_tunnel_create_1 (struct l2tp_api_tunnel_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_create_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_delete_1 (l2tp_tunnel_delete_1_argument *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_delete_1_svc(argp->tunnel_id, argp->tunnel_name, argp->reason, result, rqstp));
+}
+
+int
+_l2tp_tunnel_modify_1 (struct l2tp_api_tunnel_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_get_1 (l2tp_tunnel_get_1_argument *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_get_1_svc(argp->tunnel_id, argp->tunnel_name, result, rqstp));
+}
+
+int
+_l2tp_tunnel_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_tunnel_profile_create_1 (struct l2tp_api_tunnel_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_profile_create_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_profile_delete_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_profile_delete_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_profile_modify_1 (struct l2tp_api_tunnel_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_profile_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_profile_get_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_profile_get_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_profile_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_profile_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_session_create_1 (struct l2tp_api_session_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_create_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_delete_1 (l2tp_session_delete_1_argument *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_delete_1_svc(argp->tunnel_id, argp->tunnel_name, argp->session_id, argp->session_name, argp->reason, result, rqstp));
+}
+
+int
+_l2tp_session_modify_1 (struct l2tp_api_session_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_get_1 (l2tp_session_get_1_argument *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_get_1_svc(argp->tunnel_id, argp->tunnel_name, argp->session_id, argp->session_name, result, rqstp));
+}
+
+int
+_l2tp_session_list_1 (l2tp_session_list_1_argument *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_list_1_svc(argp->tunnel_id, argp->tunnel_name, result, rqstp));
+}
+
+int
+_l2tp_session_incall_ind_1 (struct l2tp_api_session_incall_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_incall_ind_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_profile_create_1 (struct l2tp_api_session_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_profile_create_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_profile_delete_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_profile_delete_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_profile_modify_1 (struct l2tp_api_session_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_profile_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_profile_get_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_profile_get_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_profile_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_profile_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_ppp_profile_create_1 (struct l2tp_api_ppp_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_ppp_profile_create_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_ppp_profile_delete_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_ppp_profile_delete_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_ppp_profile_modify_1 (struct l2tp_api_ppp_profile_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_ppp_profile_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_ppp_profile_get_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_ppp_profile_get_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_ppp_profile_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_ppp_profile_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_peer_get_1 (l2tp_peer_get_1_argument *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_get_1_svc(argp->local_addr, argp->peer_addr, result, rqstp));
+}
+
+int
+_l2tp_peer_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_user_list_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_user_list_1_svc(result, rqstp));
+}
+
+int
+_l2tp_peer_profile_unset_1 (struct l2tp_api_peer_profile_unset_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_peer_profile_unset_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_tunnel_profile_unset_1 (struct l2tp_api_tunnel_profile_unset_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_tunnel_profile_unset_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_session_profile_unset_1 (struct l2tp_api_session_profile_unset_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_session_profile_unset_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_ppp_profile_unset_1 (struct l2tp_api_ppp_profile_unset_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_ppp_profile_unset_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_test_log_1 (char * *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_test_log_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_test_modify_1 (struct l2tp_api_test_msg_data  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_test_modify_1_svc(*argp, result, rqstp));
+}
+
+int
+_l2tp_test_get_1 (void  *argp, void *result, struct svc_req *rqstp)
+{
+       return (l2tp_test_get_1_svc(result, rqstp));
+}
+
+void
+l2tp_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+       union {
+               struct l2tp_api_system_msg_data l2tp_system_modify_1_arg;
+               struct l2tp_api_peer_profile_msg_data l2tp_peer_profile_create_1_arg;
+               char *l2tp_peer_profile_delete_1_arg;
+               struct l2tp_api_peer_profile_msg_data l2tp_peer_profile_modify_1_arg;
+               char *l2tp_peer_profile_get_1_arg;
+               struct l2tp_api_tunnel_msg_data l2tp_tunnel_create_1_arg;
+               l2tp_tunnel_delete_1_argument l2tp_tunnel_delete_1_arg;
+               struct l2tp_api_tunnel_msg_data l2tp_tunnel_modify_1_arg;
+               l2tp_tunnel_get_1_argument l2tp_tunnel_get_1_arg;
+               struct l2tp_api_tunnel_profile_msg_data l2tp_tunnel_profile_create_1_arg;
+               char *l2tp_tunnel_profile_delete_1_arg;
+               struct l2tp_api_tunnel_profile_msg_data l2tp_tunnel_profile_modify_1_arg;
+               char *l2tp_tunnel_profile_get_1_arg;
+               struct l2tp_api_session_msg_data l2tp_session_create_1_arg;
+               l2tp_session_delete_1_argument l2tp_session_delete_1_arg;
+               struct l2tp_api_session_msg_data l2tp_session_modify_1_arg;
+               l2tp_session_get_1_argument l2tp_session_get_1_arg;
+               l2tp_session_list_1_argument l2tp_session_list_1_arg;
+               struct l2tp_api_session_incall_msg_data l2tp_session_incall_ind_1_arg;
+               struct l2tp_api_session_profile_msg_data l2tp_session_profile_create_1_arg;
+               char *l2tp_session_profile_delete_1_arg;
+               struct l2tp_api_session_profile_msg_data l2tp_session_profile_modify_1_arg;
+               char *l2tp_session_profile_get_1_arg;
+               struct l2tp_api_ppp_profile_msg_data l2tp_ppp_profile_create_1_arg;
+               char *l2tp_ppp_profile_delete_1_arg;
+               struct l2tp_api_ppp_profile_msg_data l2tp_ppp_profile_modify_1_arg;
+               char *l2tp_ppp_profile_get_1_arg;
+               l2tp_peer_get_1_argument l2tp_peer_get_1_arg;
+               struct l2tp_api_peer_profile_unset_msg_data l2tp_peer_profile_unset_1_arg;
+               struct l2tp_api_tunnel_profile_unset_msg_data l2tp_tunnel_profile_unset_1_arg;
+               struct l2tp_api_session_profile_unset_msg_data l2tp_session_profile_unset_1_arg;
+               struct l2tp_api_ppp_profile_unset_msg_data l2tp_ppp_profile_unset_1_arg;
+               char *l2tp_test_log_1_arg;
+               struct l2tp_api_test_msg_data l2tp_test_modify_1_arg;
+       } argument;
+       union {
+               struct l2tp_api_app_msg_data l2tp_app_info_get_1_res;
+               int l2tp_system_modify_1_res;
+               struct l2tp_api_system_msg_data l2tp_system_get_1_res;
+               int l2tp_peer_profile_create_1_res;
+               int l2tp_peer_profile_delete_1_res;
+               int l2tp_peer_profile_modify_1_res;
+               struct l2tp_api_peer_profile_msg_data l2tp_peer_profile_get_1_res;
+               struct l2tp_api_peer_profile_list_msg_data l2tp_peer_profile_list_1_res;
+               int l2tp_tunnel_create_1_res;
+               int l2tp_tunnel_delete_1_res;
+               int l2tp_tunnel_modify_1_res;
+               struct l2tp_api_tunnel_msg_data l2tp_tunnel_get_1_res;
+               struct l2tp_api_tunnel_list_msg_data l2tp_tunnel_list_1_res;
+               int l2tp_tunnel_profile_create_1_res;
+               int l2tp_tunnel_profile_delete_1_res;
+               int l2tp_tunnel_profile_modify_1_res;
+               struct l2tp_api_tunnel_profile_msg_data l2tp_tunnel_profile_get_1_res;
+               struct l2tp_api_tunnel_profile_list_msg_data l2tp_tunnel_profile_list_1_res;
+               int l2tp_session_create_1_res;
+               int l2tp_session_delete_1_res;
+               int l2tp_session_modify_1_res;
+               struct l2tp_api_session_msg_data l2tp_session_get_1_res;
+               struct l2tp_api_session_list_msg_data l2tp_session_list_1_res;
+               int l2tp_session_incall_ind_1_res;
+               int l2tp_session_profile_create_1_res;
+               int l2tp_session_profile_delete_1_res;
+               int l2tp_session_profile_modify_1_res;
+               struct l2tp_api_session_profile_msg_data l2tp_session_profile_get_1_res;
+               struct l2tp_api_session_profile_list_msg_data l2tp_session_profile_list_1_res;
+               int l2tp_ppp_profile_create_1_res;
+               int l2tp_ppp_profile_delete_1_res;
+               int l2tp_ppp_profile_modify_1_res;
+               struct l2tp_api_ppp_profile_msg_data l2tp_ppp_profile_get_1_res;
+               struct l2tp_api_ppp_profile_list_msg_data l2tp_ppp_profile_list_1_res;
+               struct l2tp_api_peer_msg_data l2tp_peer_get_1_res;
+               struct l2tp_api_peer_list_msg_data l2tp_peer_list_1_res;
+               struct l2tp_api_user_list_msg_data l2tp_user_list_1_res;
+               int l2tp_peer_profile_unset_1_res;
+               int l2tp_tunnel_profile_unset_1_res;
+               int l2tp_session_profile_unset_1_res;
+               int l2tp_ppp_profile_unset_1_res;
+               int l2tp_test_log_1_res;
+               int l2tp_test_modify_1_res;
+               struct l2tp_api_test_msg_data l2tp_test_get_1_res;
+       } result;
+       bool_t retval;
+       xdrproc_t _xdr_argument, _xdr_result;
+       bool_t (*local)(char *, void *, struct svc_req *);
+
+       if (l2tp_api_rpc_check_request(transp) < 0) return; switch (rqstp->rq_proc) {
+       case NULLPROC:
+               (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+               return;
+
+       case L2TP_APP_INFO_GET:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_app_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_app_info_get_1;
+               break;
+
+       case L2TP_SYSTEM_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_system_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_system_modify_1;
+               break;
+
+       case L2TP_SYSTEM_GET:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_system_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_system_get_1;
+               break;
+
+       case L2TP_PEER_PROFILE_CREATE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_peer_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_profile_create_1;
+               break;
+
+       case L2TP_PEER_PROFILE_DELETE:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_profile_delete_1;
+               break;
+
+       case L2TP_PEER_PROFILE_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_peer_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_profile_modify_1;
+               break;
+
+       case L2TP_PEER_PROFILE_GET:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_peer_profile_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_profile_get_1;
+               break;
+
+       case L2TP_PEER_PROFILE_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_peer_profile_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_profile_list_1;
+               break;
+
+       case L2TP_TUNNEL_CREATE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_tunnel_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_create_1;
+               break;
+
+       case L2TP_TUNNEL_DELETE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_tunnel_delete_1_argument;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_delete_1;
+               break;
+
+       case L2TP_TUNNEL_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_tunnel_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_modify_1;
+               break;
+
+       case L2TP_TUNNEL_GET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_tunnel_get_1_argument;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_tunnel_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_get_1;
+               break;
+
+       case L2TP_TUNNEL_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_tunnel_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_list_1;
+               break;
+
+       case L2TP_TUNNEL_PROFILE_CREATE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_tunnel_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_profile_create_1;
+               break;
+
+       case L2TP_TUNNEL_PROFILE_DELETE:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_profile_delete_1;
+               break;
+
+       case L2TP_TUNNEL_PROFILE_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_tunnel_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_profile_modify_1;
+               break;
+
+       case L2TP_TUNNEL_PROFILE_GET:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_tunnel_profile_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_profile_get_1;
+               break;
+
+       case L2TP_TUNNEL_PROFILE_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_tunnel_profile_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_profile_list_1;
+               break;
+
+       case L2TP_SESSION_CREATE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_session_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_create_1;
+               break;
+
+       case L2TP_SESSION_DELETE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_session_delete_1_argument;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_delete_1;
+               break;
+
+       case L2TP_SESSION_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_session_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_modify_1;
+               break;
+
+       case L2TP_SESSION_GET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_session_get_1_argument;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_session_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_get_1;
+               break;
+
+       case L2TP_SESSION_LIST:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_session_list_1_argument;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_session_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_list_1;
+               break;
+
+       case L2TP_SESSION_INCALL_IND:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_session_incall_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_incall_ind_1;
+               break;
+
+       case L2TP_SESSION_PROFILE_CREATE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_session_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_profile_create_1;
+               break;
+
+       case L2TP_SESSION_PROFILE_DELETE:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_profile_delete_1;
+               break;
+
+       case L2TP_SESSION_PROFILE_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_session_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_profile_modify_1;
+               break;
+
+       case L2TP_SESSION_PROFILE_GET:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_session_profile_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_profile_get_1;
+               break;
+
+       case L2TP_SESSION_PROFILE_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_session_profile_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_profile_list_1;
+               break;
+
+       case L2TP_PPP_PROFILE_CREATE:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_ppp_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_ppp_profile_create_1;
+               break;
+
+       case L2TP_PPP_PROFILE_DELETE:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_ppp_profile_delete_1;
+               break;
+
+       case L2TP_PPP_PROFILE_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_ppp_profile_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_ppp_profile_modify_1;
+               break;
+
+       case L2TP_PPP_PROFILE_GET:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_ppp_profile_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_ppp_profile_get_1;
+               break;
+
+       case L2TP_PPP_PROFILE_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_ppp_profile_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_ppp_profile_list_1;
+               break;
+
+       case L2TP_PEER_GET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_peer_get_1_argument;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_peer_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_get_1;
+               break;
+
+       case L2TP_PEER_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_peer_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_list_1;
+               break;
+
+       case L2TP_USER_LIST:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_user_list_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_user_list_1;
+               break;
+
+       case L2TP_PEER_PROFILE_UNSET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_peer_profile_unset_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_peer_profile_unset_1;
+               break;
+
+       case L2TP_TUNNEL_PROFILE_UNSET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_tunnel_profile_unset_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_tunnel_profile_unset_1;
+               break;
+
+       case L2TP_SESSION_PROFILE_UNSET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_session_profile_unset_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_session_profile_unset_1;
+               break;
+
+       case L2TP_PPP_PROFILE_UNSET:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_ppp_profile_unset_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_ppp_profile_unset_1;
+               break;
+
+       case L2TP_TEST_LOG:
+               _xdr_argument = (xdrproc_t) xdr_wrapstring;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_test_log_1;
+               break;
+
+       case L2TP_TEST_MODIFY:
+               _xdr_argument = (xdrproc_t) xdr_l2tp_api_test_msg_data;
+               _xdr_result = (xdrproc_t) xdr_int;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_test_modify_1;
+               break;
+
+       case L2TP_TEST_GET:
+               _xdr_argument = (xdrproc_t) xdr_void;
+               _xdr_result = (xdrproc_t) xdr_l2tp_api_test_msg_data;
+               local = (bool_t (*) (char *, void *,  struct svc_req *))_l2tp_test_get_1;
+               break;
+
+       default:
+               svcerr_noproc (transp);
+               return;
+       }
+       memset ((char *)&argument, 0, sizeof (argument));
+       if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+               svcerr_decode (transp);
+               return;
+       }
+       retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+       if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+               svcerr_systemerr (transp);
+       }
+       if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+               syslog (LOG_ERR, "%s", "unable to free arguments");
+               exit (1);
+       }
+       if (!l2tp_prog_1_freeresult (transp, _xdr_result, (caddr_t) &result))
+               syslog (LOG_ERR, "%s", "unable to free results");
+
+       return;
+}
diff --git a/net/openl2tp/src/l2tp_rpc_xdr.c b/net/openl2tp/src/l2tp_rpc_xdr.c
new file mode 100644 (file)
index 0000000..9c540c3
--- /dev/null
@@ -0,0 +1,2957 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "l2tp_rpc.h"
+
+bool_t
+xdr_optstring (XDR *xdrs, optstring *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->valid))
+                return FALSE;
+       switch (objp->valid) {
+       case 1:
+                if (!xdr_string (xdrs, &objp->optstring_u.value, ~0))
+                        return FALSE;
+               break;
+       default:
+               break;
+       }
+       return TRUE;
+}
+#define OPTSTRING(_var) _var.optstring_u.value
+#define OPTSTRING_PTR(_var) ((_var.valid == 1) ? _var.optstring_u.value : NULL)
+
+bool_t
+xdr_l2tp_api_tunnel_auth_mode (XDR *xdrs, l2tp_api_tunnel_auth_mode *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_enum (xdrs, (enum_t *) objp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_mode (XDR *xdrs, l2tp_api_tunnel_mode *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_enum (xdrs, (enum_t *) objp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_ip_addr (XDR *xdrs, l2tp_api_ip_addr *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->s_addr))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_app_msg_data (XDR *xdrs, l2tp_api_app_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_string (xdrs, &objp->build_date, 16))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->build_time, 16))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->major))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->minor))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->cookie))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->patches.patches_val, (u_int *) &objp->patches.patches_len, ~0,
+               sizeof (int), (xdrproc_t) xdr_int))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->features))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_system_config (XDR *xdrs, l2tp_api_system_config *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->udp_port))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->max_tunnels))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_sessions))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->drain_tunnels))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tunnel_establish_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->session_establish_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tunnel_persist_pend_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->session_persist_pend_timeout))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->deny_local_tunnel_creates))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->deny_remote_tunnel_creates))
+                                return FALSE;
+               } else {
+                       IXDR_PUT_LONG(buf, objp->max_tunnels);
+                       IXDR_PUT_LONG(buf, objp->max_sessions);
+                       IXDR_PUT_LONG(buf, objp->drain_tunnels);
+                       IXDR_PUT_LONG(buf, objp->tunnel_establish_timeout);
+                       IXDR_PUT_LONG(buf, objp->session_establish_timeout);
+                       IXDR_PUT_LONG(buf, objp->tunnel_persist_pend_timeout);
+                       IXDR_PUT_LONG(buf, objp->session_persist_pend_timeout);
+                       IXDR_PUT_BOOL(buf, objp->deny_local_tunnel_creates);
+                       IXDR_PUT_BOOL(buf, objp->deny_remote_tunnel_creates);
+               }
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->udp_port))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->max_tunnels))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_sessions))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->drain_tunnels))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tunnel_establish_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->session_establish_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tunnel_persist_pend_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->session_persist_pend_timeout))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->deny_local_tunnel_creates))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->deny_remote_tunnel_creates))
+                                return FALSE;
+               } else {
+                       objp->max_tunnels = IXDR_GET_LONG(buf);
+                       objp->max_sessions = IXDR_GET_LONG(buf);
+                       objp->drain_tunnels = IXDR_GET_LONG(buf);
+                       objp->tunnel_establish_timeout = IXDR_GET_LONG(buf);
+                       objp->session_establish_timeout = IXDR_GET_LONG(buf);
+                       objp->tunnel_persist_pend_timeout = IXDR_GET_LONG(buf);
+                       objp->session_persist_pend_timeout = IXDR_GET_LONG(buf);
+                       objp->deny_local_tunnel_creates = IXDR_GET_BOOL(buf);
+                       objp->deny_remote_tunnel_creates = IXDR_GET_BOOL(buf);
+               }
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->udp_port))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_tunnels))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_sessions))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->drain_tunnels))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->tunnel_establish_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->session_establish_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->tunnel_persist_pend_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->session_persist_pend_timeout))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->deny_local_tunnel_creates))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->deny_remote_tunnel_creates))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_system_msg_stats (XDR *xdrs, l2tp_api_system_msg_stats *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->rx))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->tx))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->rx_bad))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_system_stats (XDR *xdrs, l2tp_api_system_stats *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->short_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->wrong_version_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->unexpected_data_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->bad_rcvd_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->total_rcvd_control_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->total_sent_control_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->total_control_frame_send_fails))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->total_retransmitted_control_frames))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_control_frame_resources))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_peer_resources))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_tunnel_resources))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_session_resources))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_ppp_resources))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->too_many_tunnels))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->too_many_sessions))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->auth_fails))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_matching_tunnel_id_discards))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->no_matching_session_id_discards))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->mismatched_tunnel_ids))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->mismatched_session_ids))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->encode_message_fails))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->tunnel_setup_failures))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->session_setup_failures))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->event_queue_full_errors))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->ignored_avps))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->vendor_avps))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->illegal_messages))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->unsupported_messages))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->messages.messages_val, (u_int *) &objp->messages.messages_len, L2TP_API_MSG_TYPE_COUNT,
+               sizeof (l2tp_api_system_msg_stats), (xdrproc_t) xdr_l2tp_api_system_msg_stats))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_system_status (XDR *xdrs, l2tp_api_system_status *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_l2tp_api_system_stats (xdrs, &objp->stats))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->num_tunnels))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->num_sessions))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_system_msg_data (XDR *xdrs, l2tp_api_system_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_l2tp_api_system_config (xdrs, &objp->config))
+                return FALSE;
+        if (!xdr_l2tp_api_system_status (xdrs, &objp->status))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_msg_data (XDR *xdrs, l2tp_api_peer_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->local_addr))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_tunnels))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_list_entry (XDR *xdrs, l2tp_api_peer_list_entry *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->local_addr))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (l2tp_api_peer_list_entry), (xdrproc_t) xdr_l2tp_api_peer_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_list_msg_data (XDR *xdrs, l2tp_api_peer_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->peers, sizeof (l2tp_api_peer_list_entry), (xdrproc_t) xdr_l2tp_api_peer_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_profile_msg_data (XDR *xdrs, l2tp_api_peer_profile_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_port))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->we_can_be_lac))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->we_can_be_lns))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->default_tunnel_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->default_session_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->default_ppp_profile_name))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->netmask))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->use_count))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_profile_list_entry (XDR *xdrs, l2tp_api_peer_profile_list_entry *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (l2tp_api_peer_profile_list_entry), (xdrproc_t) xdr_l2tp_api_peer_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_profile_list_msg_data (XDR *xdrs, l2tp_api_peer_profile_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_profiles))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->profiles, sizeof (l2tp_api_peer_profile_list_entry), (xdrproc_t) xdr_l2tp_api_peer_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_peer_profile_unset_msg_data (XDR *xdrs, l2tp_api_peer_profile_unset_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_peer (XDR *xdrs, l2tp_api_tunnel_peer *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+               buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->framing_cap_sync);
+               IXDR_PUT_BOOL(buf, objp->framing_cap_async);
+               IXDR_PUT_BOOL(buf, objp->bearer_cap_digital);
+               IXDR_PUT_BOOL(buf, objp->bearer_cap_analog);
+               }
+                if (!xdr_uint8_t (xdrs, &objp->protocol_version_ver))
+                        return FALSE;
+                if (!xdr_uint8_t (xdrs, &objp->protocol_version_rev))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->firmware_revision))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->host_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->vendor_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->tiebreaker.tiebreaker_val, (u_int *) &objp->tiebreaker.tiebreaker_len, 8,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_result))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_error))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->result_code_message))
+                        return FALSE;
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+               buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                                return FALSE;
+
+               } else {
+               objp->framing_cap_sync = IXDR_GET_BOOL(buf);
+               objp->framing_cap_async = IXDR_GET_BOOL(buf);
+               objp->bearer_cap_digital = IXDR_GET_BOOL(buf);
+               objp->bearer_cap_analog = IXDR_GET_BOOL(buf);
+               }
+                if (!xdr_uint8_t (xdrs, &objp->protocol_version_ver))
+                        return FALSE;
+                if (!xdr_uint8_t (xdrs, &objp->protocol_version_rev))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->firmware_revision))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->host_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->vendor_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->tiebreaker.tiebreaker_val, (u_int *) &objp->tiebreaker.tiebreaker_len, 8,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_result))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_error))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->result_code_message))
+                        return FALSE;
+        return TRUE;
+       }
+
+        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                return FALSE;
+        if (!xdr_uint8_t (xdrs, &objp->protocol_version_ver))
+                return FALSE;
+        if (!xdr_uint8_t (xdrs, &objp->protocol_version_rev))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->firmware_revision))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->host_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->vendor_name))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->tiebreaker.tiebreaker_val, (u_int *) &objp->tiebreaker.tiebreaker_len, 8,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->result_code_result))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->result_code_error))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->result_code_message))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_stats (XDR *xdrs, l2tp_api_tunnel_stats *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->retransmits))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->tx_zlbs))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->tx_zlb_fails))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->rx_zlbs))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->data_pkt_discards))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->duplicate_pkt_discards))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->rx_hellos))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->tx_hellos))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->tx_hello_fails))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->ns))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->nr))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_ns))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_nr))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->cwnd))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->ssthresh))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->congpkt_acc))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->control_rx_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->control_rx_bytes))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->control_rx_oos_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->control_rx_oos_discards))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->control_tx_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->control_tx_bytes))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_bytes))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_errors))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_oos_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_oos_discards))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_tx_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_tx_bytes))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_tx_errors))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->using_ipsec))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_msg_data (XDR *xdrs, l2tp_api_tunnel_msg_data *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->flags2))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_tunnel_id))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->hide_avps))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->our_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->our_udp_port))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_udp_port))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->config_id))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_auth_mode (xdrs, &objp->auth_mode))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 8 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_tiebreaker))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->allow_ppp_proxy))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_udp_checksums))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->created_by_admin))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->framing_cap_sync);
+               IXDR_PUT_BOOL(buf, objp->framing_cap_async);
+               IXDR_PUT_BOOL(buf, objp->bearer_cap_digital);
+               IXDR_PUT_BOOL(buf, objp->bearer_cap_analog);
+               IXDR_PUT_BOOL(buf, objp->use_tiebreaker);
+               IXDR_PUT_BOOL(buf, objp->allow_ppp_proxy);
+               IXDR_PUT_BOOL(buf, objp->use_udp_checksums);
+               IXDR_PUT_BOOL(buf, objp->created_by_admin);
+               }
+                if (!xdr_optstring (xdrs, &objp->create_time))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->max_sessions))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_sessions))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->use_count))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_establish_retries))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_LONG(buf, objp->max_sessions);
+               IXDR_PUT_LONG(buf, objp->num_sessions);
+               IXDR_PUT_LONG(buf, objp->use_count);
+               IXDR_PUT_LONG(buf, objp->num_establish_retries);
+               }
+                if (!xdr_l2tp_api_tunnel_mode (xdrs, &objp->mode))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->hello_timeout))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->max_retries))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->actual_tx_window_size))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->retry_timeout))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->idle_timeout))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->persist))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->mtu))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->do_pmtu_discovery);
+               IXDR_PUT_BOOL(buf, objp->persist);
+               IXDR_PUT_LONG(buf, objp->mtu);
+               }
+                if (!xdr_optstring (xdrs, &objp->state))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->secret))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->host_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->tunnel_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->peer_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->session_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->interface_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->tiebreaker.tiebreaker_val, (u_int *) &objp->tiebreaker.tiebreaker_len, 8,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_result))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_error))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->result_code_message))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_peer (xdrs, &objp->peer))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_stats (xdrs, &objp->stats))
+                        return FALSE;
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->flags2))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_tunnel_id))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->hide_avps))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->our_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->our_udp_port))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_udp_port))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->config_id))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_auth_mode (xdrs, &objp->auth_mode))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 8 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_tiebreaker))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->allow_ppp_proxy))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_udp_checksums))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->created_by_admin))
+                                return FALSE;
+
+               } else {
+               objp->framing_cap_sync = IXDR_GET_BOOL(buf);
+               objp->framing_cap_async = IXDR_GET_BOOL(buf);
+               objp->bearer_cap_digital = IXDR_GET_BOOL(buf);
+               objp->bearer_cap_analog = IXDR_GET_BOOL(buf);
+               objp->use_tiebreaker = IXDR_GET_BOOL(buf);
+               objp->allow_ppp_proxy = IXDR_GET_BOOL(buf);
+               objp->use_udp_checksums = IXDR_GET_BOOL(buf);
+               objp->created_by_admin = IXDR_GET_BOOL(buf);
+               }
+                if (!xdr_optstring (xdrs, &objp->create_time))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->max_sessions))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_sessions))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->use_count))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_establish_retries))
+                                return FALSE;
+
+               } else {
+               objp->max_sessions = IXDR_GET_LONG(buf);
+               objp->num_sessions = IXDR_GET_LONG(buf);
+               objp->use_count = IXDR_GET_LONG(buf);
+               objp->num_establish_retries = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_l2tp_api_tunnel_mode (xdrs, &objp->mode))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->hello_timeout))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->max_retries))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->actual_tx_window_size))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->retry_timeout))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->idle_timeout))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->persist))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->mtu))
+                                return FALSE;
+
+               } else {
+               objp->do_pmtu_discovery = IXDR_GET_BOOL(buf);
+               objp->persist = IXDR_GET_BOOL(buf);
+               objp->mtu = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_optstring (xdrs, &objp->state))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->secret))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->host_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->tunnel_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->peer_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->session_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->interface_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->tiebreaker.tiebreaker_val, (u_int *) &objp->tiebreaker.tiebreaker_len, 8,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_result))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->result_code_error))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->result_code_message))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_peer (xdrs, &objp->peer))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_stats (xdrs, &objp->stats))
+                        return FALSE;
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->flags2))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_tunnel_id))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->hide_avps))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->our_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->our_udp_port))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_udp_port))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->config_id))
+                return FALSE;
+        if (!xdr_l2tp_api_tunnel_auth_mode (xdrs, &objp->auth_mode))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_tiebreaker))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->allow_ppp_proxy))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_udp_checksums))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->created_by_admin))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->create_time))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_sessions))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_sessions))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->use_count))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_establish_retries))
+                return FALSE;
+        if (!xdr_l2tp_api_tunnel_mode (xdrs, &objp->mode))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->hello_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_retries))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->tx_window_size))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->actual_tx_window_size))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->retry_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->idle_timeout))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->persist))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->mtu))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->state))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->secret))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->host_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->peer_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->session_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->interface_name))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->tiebreaker.tiebreaker_val, (u_int *) &objp->tiebreaker.tiebreaker_len, 8,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->result_code_result))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->result_code_error))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->result_code_message))
+                return FALSE;
+        if (!xdr_l2tp_api_tunnel_peer (xdrs, &objp->peer))
+                return FALSE;
+        if (!xdr_l2tp_api_tunnel_stats (xdrs, &objp->stats))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_list_msg_data (XDR *xdrs, l2tp_api_tunnel_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->tunnel_ids.tunnel_ids_val, (u_int *) &objp->tunnel_ids.tunnel_ids_len, ~0,
+               sizeof (uint16_t), (xdrproc_t) xdr_uint16_t))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_profile_msg_data (XDR *xdrs, l2tp_api_tunnel_profile_msg_data *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->hide_avps))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_auth_mode (xdrs, &objp->auth_mode))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_tiebreaker))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->allow_ppp_proxy))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_udp_checksums))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->hello_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_retries))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->framing_cap_sync);
+               IXDR_PUT_BOOL(buf, objp->framing_cap_async);
+               IXDR_PUT_BOOL(buf, objp->bearer_cap_digital);
+               IXDR_PUT_BOOL(buf, objp->bearer_cap_analog);
+               IXDR_PUT_BOOL(buf, objp->use_tiebreaker);
+               IXDR_PUT_BOOL(buf, objp->allow_ppp_proxy);
+               IXDR_PUT_BOOL(buf, objp->use_udp_checksums);
+               IXDR_PUT_LONG(buf, objp->hello_timeout);
+               IXDR_PUT_LONG(buf, objp->max_retries);
+               }
+                if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tx_window_size))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->retry_timeout))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->idle_timeout))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->max_sessions))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->our_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->our_udp_port))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_udp_port))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->mtu))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->peer_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->session_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->secret))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->host_name))
+                        return FALSE;
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->hide_avps))
+                        return FALSE;
+                if (!xdr_l2tp_api_tunnel_auth_mode (xdrs, &objp->auth_mode))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_tiebreaker))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->allow_ppp_proxy))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_udp_checksums))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->hello_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_retries))
+                                return FALSE;
+
+               } else {
+               objp->framing_cap_sync = IXDR_GET_BOOL(buf);
+               objp->framing_cap_async = IXDR_GET_BOOL(buf);
+               objp->bearer_cap_digital = IXDR_GET_BOOL(buf);
+               objp->bearer_cap_analog = IXDR_GET_BOOL(buf);
+               objp->use_tiebreaker = IXDR_GET_BOOL(buf);
+               objp->allow_ppp_proxy = IXDR_GET_BOOL(buf);
+               objp->use_udp_checksums = IXDR_GET_BOOL(buf);
+               objp->hello_timeout = IXDR_GET_LONG(buf);
+               objp->max_retries = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tx_window_size))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->retry_timeout))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->idle_timeout))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->max_sessions))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->our_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->our_udp_port))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_udp_port))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->mtu))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->peer_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->session_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->secret))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->host_name))
+                        return FALSE;
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->hide_avps))
+                return FALSE;
+        if (!xdr_l2tp_api_tunnel_auth_mode (xdrs, &objp->auth_mode))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_cap_sync))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_cap_async))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_cap_digital))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_cap_analog))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_tiebreaker))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->allow_ppp_proxy))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_udp_checksums))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->hello_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_retries))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->rx_window_size))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->tx_window_size))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->retry_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->idle_timeout))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_sessions))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->our_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->our_udp_port))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_udp_port))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->mtu))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->peer_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->session_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->secret))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->host_name))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_profile_list_entry (XDR *xdrs, l2tp_api_tunnel_profile_list_entry *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (l2tp_api_tunnel_profile_list_entry), (xdrproc_t) xdr_l2tp_api_tunnel_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_profile_list_msg_data (XDR *xdrs, l2tp_api_tunnel_profile_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_profiles))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->profiles, sizeof (l2tp_api_tunnel_profile_list_entry), (xdrproc_t) xdr_l2tp_api_tunnel_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_tunnel_profile_unset_msg_data (XDR *xdrs, l2tp_api_tunnel_profile_unset_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_proxy_auth_type (XDR *xdrs, l2tp_api_session_proxy_auth_type *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_enum (xdrs, (enum_t *) objp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_call_errors (XDR *xdrs, l2tp_api_session_call_errors *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->crc_errors))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->framing_errors))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->hardware_overruns))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->buffer_overruns))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->timeout_errors))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->alignment_errors))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_stats (XDR *xdrs, l2tp_api_session_stats *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_bytes))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_errors))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_oos_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_rx_oos_discards))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_tx_packets))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_tx_bytes))
+                return FALSE;
+        if (!xdr_uint64_t (xdrs, &objp->data_tx_errors))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_peer_info (XDR *xdrs, l2tp_api_session_peer_info *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint16_t (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->error_code))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->error_message))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->minimum_bps))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->maximum_bps))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->connect_speed))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->rx_connect_speed))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_proxy_auth_type (xdrs, &objp->proxy_auth_type))
+                        return FALSE;
+                if (!xdr_uint8_t (xdrs, &objp->proxy_auth_id))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->proxy_auth_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_challenge.proxy_auth_challenge_val, (u_int *) &objp->proxy_auth_challenge.proxy_auth_challenge_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_response.proxy_auth_response_val, (u_int *) &objp->proxy_auth_response.proxy_auth_response_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->private_group_id))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 5 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->framing_type_sync);
+               IXDR_PUT_BOOL(buf, objp->framing_type_async);
+               IXDR_PUT_BOOL(buf, objp->bearer_type_digital);
+               IXDR_PUT_BOOL(buf, objp->bearer_type_analog);
+               IXDR_PUT_BOOL(buf, objp->sequencing_required);
+               }
+                if (!xdr_uint32_t (xdrs, &objp->call_serial_number))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->physical_channel_id))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_val, (u_int *) &objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_sent_lcp_confreq.last_sent_lcp_confreq_val, (u_int *) &objp->last_sent_lcp_confreq.last_sent_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_val, (u_int *) &objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->calling_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->called_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->sub_address))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->q931_cause_code))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->q931_cause_msg))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->q931_advisory_msg))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_call_errors (xdrs, &objp->call_errors))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->send_accm))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->recv_accm))
+                        return FALSE;
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint16_t (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->error_code))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->error_message))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->minimum_bps))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->maximum_bps))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->connect_speed))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->rx_connect_speed))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_proxy_auth_type (xdrs, &objp->proxy_auth_type))
+                        return FALSE;
+                if (!xdr_uint8_t (xdrs, &objp->proxy_auth_id))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->proxy_auth_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_challenge.proxy_auth_challenge_val, (u_int *) &objp->proxy_auth_challenge.proxy_auth_challenge_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_response.proxy_auth_response_val, (u_int *) &objp->proxy_auth_response.proxy_auth_response_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->private_group_id))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 5 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                                return FALSE;
+
+               } else {
+               objp->framing_type_sync = IXDR_GET_BOOL(buf);
+               objp->framing_type_async = IXDR_GET_BOOL(buf);
+               objp->bearer_type_digital = IXDR_GET_BOOL(buf);
+               objp->bearer_type_analog = IXDR_GET_BOOL(buf);
+               objp->sequencing_required = IXDR_GET_BOOL(buf);
+               }
+                if (!xdr_uint32_t (xdrs, &objp->call_serial_number))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->physical_channel_id))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_val, (u_int *) &objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_sent_lcp_confreq.last_sent_lcp_confreq_val, (u_int *) &objp->last_sent_lcp_confreq.last_sent_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_val, (u_int *) &objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->calling_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->called_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->sub_address))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->q931_cause_code))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->q931_cause_msg))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->q931_advisory_msg))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_call_errors (xdrs, &objp->call_errors))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->send_accm))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->recv_accm))
+                        return FALSE;
+        return TRUE;
+       }
+
+        if (!xdr_uint16_t (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->error_code))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->error_message))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->minimum_bps))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->maximum_bps))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->connect_speed))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->rx_connect_speed))
+                return FALSE;
+        if (!xdr_l2tp_api_session_proxy_auth_type (xdrs, &objp->proxy_auth_type))
+                return FALSE;
+        if (!xdr_uint8_t (xdrs, &objp->proxy_auth_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->proxy_auth_name))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->proxy_auth_challenge.proxy_auth_challenge_val, (u_int *) &objp->proxy_auth_challenge.proxy_auth_challenge_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->proxy_auth_response.proxy_auth_response_val, (u_int *) &objp->proxy_auth_response.proxy_auth_response_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->private_group_id))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->call_serial_number))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->physical_channel_id))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_val, (u_int *) &objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->last_sent_lcp_confreq.last_sent_lcp_confreq_val, (u_int *) &objp->last_sent_lcp_confreq.last_sent_lcp_confreq_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_val, (u_int *) &objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->calling_number))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->called_number))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->sub_address))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->q931_cause_code))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->q931_cause_msg))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->q931_advisory_msg))
+                return FALSE;
+        if (!xdr_l2tp_api_session_call_errors (xdrs, &objp->call_errors))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->send_accm))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->recv_accm))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_type (XDR *xdrs, l2tp_api_session_type *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_enum (xdrs, (enum_t *) objp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_msg_data (XDR *xdrs, l2tp_api_session_msg_data *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->session_id))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_session_id))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->state))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->session_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->interface_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_type (xdrs, &objp->session_type))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->user_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->user_password))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->priv_group_id))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->profile_name))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->created_by_admin))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->create_time))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 8 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->no_ppp))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_sequence_numbers))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->reorder_timeout))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->no_ppp);
+               IXDR_PUT_BOOL(buf, objp->sequencing_required);
+               IXDR_PUT_BOOL(buf, objp->use_sequence_numbers);
+               IXDR_PUT_LONG(buf, objp->reorder_timeout);
+               IXDR_PUT_BOOL(buf, objp->framing_type_sync);
+               IXDR_PUT_BOOL(buf, objp->framing_type_async);
+               IXDR_PUT_BOOL(buf, objp->bearer_type_digital);
+               IXDR_PUT_BOOL(buf, objp->bearer_type_analog);
+               }
+                if (!xdr_uint32_t (xdrs, &objp->call_serial_number))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->physical_channel_id))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->minimum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->maximum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tx_connect_speed))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->rx_connect_speed))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_LONG(buf, objp->minimum_bps);
+               IXDR_PUT_LONG(buf, objp->maximum_bps);
+               IXDR_PUT_LONG(buf, objp->tx_connect_speed);
+               IXDR_PUT_LONG(buf, objp->rx_connect_speed);
+               }
+                if (!xdr_l2tp_api_session_peer_info (xdrs, &objp->peer))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_stats (xdrs, &objp->stats))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->use_ppp_proxy))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_proxy_auth_type (xdrs, &objp->proxy_auth_type))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->proxy_auth_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_challenge.proxy_auth_challenge_val, (u_int *) &objp->proxy_auth_challenge.proxy_auth_challenge_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_response.proxy_auth_response_val, (u_int *) &objp->proxy_auth_response.proxy_auth_response_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->calling_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->called_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->sub_address))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_val, (u_int *) &objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_sent_lcp_confreq.last_sent_lcp_confreq_val, (u_int *) &objp->last_sent_lcp_confreq.last_sent_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_val, (u_int *) &objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->session_id))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->peer_session_id))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->state))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->session_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->interface_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_type (xdrs, &objp->session_type))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->user_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->user_password))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->priv_group_id))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->profile_name))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->created_by_admin))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->create_time))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 8 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->no_ppp))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_sequence_numbers))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->reorder_timeout))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                                return FALSE;
+
+               } else {
+               objp->no_ppp = IXDR_GET_BOOL(buf);
+               objp->sequencing_required = IXDR_GET_BOOL(buf);
+               objp->use_sequence_numbers = IXDR_GET_BOOL(buf);
+               objp->reorder_timeout = IXDR_GET_LONG(buf);
+               objp->framing_type_sync = IXDR_GET_BOOL(buf);
+               objp->framing_type_async = IXDR_GET_BOOL(buf);
+               objp->bearer_type_digital = IXDR_GET_BOOL(buf);
+               objp->bearer_type_analog = IXDR_GET_BOOL(buf);
+               }
+                if (!xdr_uint32_t (xdrs, &objp->call_serial_number))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->physical_channel_id))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->minimum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->maximum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tx_connect_speed))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->rx_connect_speed))
+                                return FALSE;
+
+               } else {
+               objp->minimum_bps = IXDR_GET_LONG(buf);
+               objp->maximum_bps = IXDR_GET_LONG(buf);
+               objp->tx_connect_speed = IXDR_GET_LONG(buf);
+               objp->rx_connect_speed = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_l2tp_api_session_peer_info (xdrs, &objp->peer))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_stats (xdrs, &objp->stats))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->use_ppp_proxy))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_proxy_auth_type (xdrs, &objp->proxy_auth_type))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->proxy_auth_name))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_challenge.proxy_auth_challenge_val, (u_int *) &objp->proxy_auth_challenge.proxy_auth_challenge_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->proxy_auth_response.proxy_auth_response_val, (u_int *) &objp->proxy_auth_response.proxy_auth_response_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->calling_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->called_number))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->sub_address))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_val, (u_int *) &objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_sent_lcp_confreq.last_sent_lcp_confreq_val, (u_int *) &objp->last_sent_lcp_confreq.last_sent_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+                if (!xdr_array (xdrs, (char **)&objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_val, (u_int *) &objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_len, ~0,
+                       sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                        return FALSE;
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->session_id))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->peer_session_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->state))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->session_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->interface_name))
+                return FALSE;
+        if (!xdr_l2tp_api_session_type (xdrs, &objp->session_type))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->user_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->user_password))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->priv_group_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->profile_name))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->created_by_admin))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->create_time))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->no_ppp))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_sequence_numbers))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->reorder_timeout))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->call_serial_number))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->physical_channel_id))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->minimum_bps))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->maximum_bps))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->tx_connect_speed))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->rx_connect_speed))
+                return FALSE;
+        if (!xdr_l2tp_api_session_peer_info (xdrs, &objp->peer))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                return FALSE;
+        if (!xdr_l2tp_api_session_stats (xdrs, &objp->stats))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_ppp_proxy))
+                return FALSE;
+        if (!xdr_l2tp_api_session_proxy_auth_type (xdrs, &objp->proxy_auth_type))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->proxy_auth_name))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->proxy_auth_challenge.proxy_auth_challenge_val, (u_int *) &objp->proxy_auth_challenge.proxy_auth_challenge_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->proxy_auth_response.proxy_auth_response_val, (u_int *) &objp->proxy_auth_response.proxy_auth_response_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->calling_number))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->called_number))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->sub_address))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_val, (u_int *) &objp->initial_rcvd_lcp_confreq.initial_rcvd_lcp_confreq_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->last_sent_lcp_confreq.last_sent_lcp_confreq_val, (u_int *) &objp->last_sent_lcp_confreq.last_sent_lcp_confreq_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_val, (u_int *) &objp->last_rcvd_lcp_confreq.last_rcvd_lcp_confreq_len, ~0,
+               sizeof (uint8_t), (xdrproc_t) xdr_uint8_t))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_list_msg_data (XDR *xdrs, l2tp_api_session_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_array (xdrs, (char **)&objp->session_ids.session_ids_val, (u_int *) &objp->session_ids.session_ids_len, ~0,
+               sizeof (uint16_t), (xdrproc_t) xdr_uint16_t))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_incall_msg_data (XDR *xdrs, l2tp_api_session_incall_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->ppp_unit))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->tunnel_profile_name, ~0))
+                return FALSE;
+        if (!xdr_l2tp_api_session_msg_data (xdrs, &objp->session))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_profile_msg_data (XDR *xdrs, l2tp_api_session_profile_msg_data *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 7 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_sequence_numbers))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->no_ppp))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->reorder_timeout))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->mtu))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->mru))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->sequencing_required);
+               IXDR_PUT_BOOL(buf, objp->use_sequence_numbers);
+               IXDR_PUT_BOOL(buf, objp->no_ppp);
+               IXDR_PUT_LONG(buf, objp->reorder_timeout);
+               IXDR_PUT_BOOL(buf, objp->do_pmtu_discovery);
+               IXDR_PUT_LONG(buf, objp->mtu);
+               IXDR_PUT_LONG(buf, objp->mru);
+               }
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_type (xdrs, &objp->session_type))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->priv_group_id))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->minimum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->maximum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tx_connect_speed))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->rx_connect_speed))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_ppp_proxy))
+                                return FALSE;
+               } else {
+                       IXDR_PUT_BOOL(buf, objp->framing_type_sync);
+                       IXDR_PUT_BOOL(buf, objp->framing_type_async);
+                       IXDR_PUT_BOOL(buf, objp->bearer_type_digital);
+                       IXDR_PUT_BOOL(buf, objp->bearer_type_analog);
+                       IXDR_PUT_LONG(buf, objp->minimum_bps);
+                       IXDR_PUT_LONG(buf, objp->maximum_bps);
+                       IXDR_PUT_LONG(buf, objp->tx_connect_speed);
+                       IXDR_PUT_LONG(buf, objp->rx_connect_speed);
+                       IXDR_PUT_BOOL(buf, objp->use_ppp_proxy);
+               }
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 7 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_sequence_numbers))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->no_ppp))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->reorder_timeout))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->mtu))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->mru))
+                                return FALSE;
+
+               } else {
+               objp->sequencing_required = IXDR_GET_BOOL(buf);
+               objp->use_sequence_numbers = IXDR_GET_BOOL(buf);
+               objp->no_ppp = IXDR_GET_BOOL(buf);
+               objp->reorder_timeout = IXDR_GET_LONG(buf);
+               objp->do_pmtu_discovery = IXDR_GET_BOOL(buf);
+               objp->mtu = IXDR_GET_LONG(buf);
+               objp->mru = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                        return FALSE;
+                if (!xdr_l2tp_api_session_type (xdrs, &objp->session_type))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->priv_group_id))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->minimum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->maximum_bps))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->tx_connect_speed))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->rx_connect_speed))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->use_ppp_proxy))
+                                return FALSE;
+               } else {
+                       objp->framing_type_sync = IXDR_GET_BOOL(buf);
+                       objp->framing_type_async = IXDR_GET_BOOL(buf);
+                       objp->bearer_type_digital = IXDR_GET_BOOL(buf);
+                       objp->bearer_type_analog = IXDR_GET_BOOL(buf);
+                       objp->minimum_bps = IXDR_GET_LONG(buf);
+                       objp->maximum_bps = IXDR_GET_LONG(buf);
+                       objp->tx_connect_speed = IXDR_GET_LONG(buf);
+                       objp->rx_connect_speed = IXDR_GET_LONG(buf);
+                       objp->use_ppp_proxy = IXDR_GET_BOOL(buf);
+               }
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->sequencing_required))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_sequence_numbers))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->no_ppp))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->reorder_timeout))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->do_pmtu_discovery))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->mtu))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->mru))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->ppp_profile_name))
+                return FALSE;
+        if (!xdr_l2tp_api_session_type (xdrs, &objp->session_type))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->priv_group_id))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_type_sync))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->framing_type_async))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_type_digital))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->bearer_type_analog))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->minimum_bps))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->maximum_bps))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->tx_connect_speed))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->rx_connect_speed))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_ppp_proxy))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_profile_list_entry (XDR *xdrs, l2tp_api_session_profile_list_entry *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (l2tp_api_session_profile_list_entry), (xdrproc_t) xdr_l2tp_api_session_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_profile_list_msg_data (XDR *xdrs, l2tp_api_session_profile_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_profiles))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->profiles, sizeof (l2tp_api_session_profile_list_entry), (xdrproc_t) xdr_l2tp_api_session_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_session_profile_unset_msg_data (XDR *xdrs, l2tp_api_session_profile_unset_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_ppp_sync_mode (XDR *xdrs, l2tp_api_ppp_sync_mode *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_enum (xdrs, (enum_t *) objp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_ppp_profile_msg_data (XDR *xdrs, l2tp_api_ppp_profile_msg_data *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->flags2))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+                if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->asyncmap))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->mru))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->mtu))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 7 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->auth_none))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_peer))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_pap))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_chap))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_mschap))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_mschapv2))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_eap))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->auth_none);
+               IXDR_PUT_BOOL(buf, objp->auth_peer);
+               IXDR_PUT_BOOL(buf, objp->auth_refuse_pap);
+               IXDR_PUT_BOOL(buf, objp->auth_refuse_chap);
+               IXDR_PUT_BOOL(buf, objp->auth_refuse_mschap);
+               IXDR_PUT_BOOL(buf, objp->auth_refuse_mschapv2);
+               IXDR_PUT_BOOL(buf, objp->auth_refuse_eap);
+               }
+                if (!xdr_l2tp_api_ppp_sync_mode (xdrs, &objp->sync_mode))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 19 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->chap_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->chap_max_challenge))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->chap_restart))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->pap_max_auth_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->pap_restart_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->pap_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->idle_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_max_config_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_max_config_naks))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_max_terminate_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_retransmit_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_echo_failure_count))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_echo_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_max_config_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_max_config_naks))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_max_terminate_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_retransmit_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_connect_time))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_failure_count))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_LONG(buf, objp->chap_interval);
+               IXDR_PUT_LONG(buf, objp->chap_max_challenge);
+               IXDR_PUT_LONG(buf, objp->chap_restart);
+               IXDR_PUT_LONG(buf, objp->pap_max_auth_requests);
+               IXDR_PUT_LONG(buf, objp->pap_restart_interval);
+               IXDR_PUT_LONG(buf, objp->pap_timeout);
+               IXDR_PUT_LONG(buf, objp->idle_timeout);
+               IXDR_PUT_LONG(buf, objp->ipcp_max_config_requests);
+               IXDR_PUT_LONG(buf, objp->ipcp_max_config_naks);
+               IXDR_PUT_LONG(buf, objp->ipcp_max_terminate_requests);
+               IXDR_PUT_LONG(buf, objp->ipcp_retransmit_interval);
+               IXDR_PUT_LONG(buf, objp->lcp_echo_failure_count);
+               IXDR_PUT_LONG(buf, objp->lcp_echo_interval);
+               IXDR_PUT_LONG(buf, objp->lcp_max_config_requests);
+               IXDR_PUT_LONG(buf, objp->lcp_max_config_naks);
+               IXDR_PUT_LONG(buf, objp->lcp_max_terminate_requests);
+               IXDR_PUT_LONG(buf, objp->lcp_retransmit_interval);
+               IXDR_PUT_LONG(buf, objp->max_connect_time);
+               IXDR_PUT_LONG(buf, objp->max_failure_count);
+               }
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->local_ip_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_ip_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->dns_addr_1))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->dns_addr_2))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->wins_addr_1))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->wins_addr_2))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ip_pool_name))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->use_radius))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->radius_hint))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->use_as_default_route))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->multilink))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->local_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->remote_name))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->proxy_arp))
+                        return FALSE;
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->flags2))
+                        return FALSE;
+                if (!xdr_int (xdrs, &objp->result_code))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                        return FALSE;
+                if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                        return FALSE;
+                if (!xdr_uint32_t (xdrs, &objp->asyncmap))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->mru))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->mtu))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 7 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->auth_none))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_peer))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_pap))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_chap))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_mschap))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_mschapv2))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->auth_refuse_eap))
+                                return FALSE;
+
+               } else {
+               objp->auth_none = IXDR_GET_BOOL(buf);
+               objp->auth_peer = IXDR_GET_BOOL(buf);
+               objp->auth_refuse_pap = IXDR_GET_BOOL(buf);
+               objp->auth_refuse_chap = IXDR_GET_BOOL(buf);
+               objp->auth_refuse_mschap = IXDR_GET_BOOL(buf);
+               objp->auth_refuse_mschapv2 = IXDR_GET_BOOL(buf);
+               objp->auth_refuse_eap = IXDR_GET_BOOL(buf);
+               }
+                if (!xdr_l2tp_api_ppp_sync_mode (xdrs, &objp->sync_mode))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 19 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->chap_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->chap_max_challenge))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->chap_restart))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->pap_max_auth_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->pap_restart_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->pap_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->idle_timeout))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_max_config_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_max_config_naks))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_max_terminate_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->ipcp_retransmit_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_echo_failure_count))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_echo_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_max_config_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_max_config_naks))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_max_terminate_requests))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->lcp_retransmit_interval))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_connect_time))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->max_failure_count))
+                                return FALSE;
+
+               } else {
+               objp->chap_interval = IXDR_GET_LONG(buf);
+               objp->chap_max_challenge = IXDR_GET_LONG(buf);
+               objp->chap_restart = IXDR_GET_LONG(buf);
+               objp->pap_max_auth_requests = IXDR_GET_LONG(buf);
+               objp->pap_restart_interval = IXDR_GET_LONG(buf);
+               objp->pap_timeout = IXDR_GET_LONG(buf);
+               objp->idle_timeout = IXDR_GET_LONG(buf);
+               objp->ipcp_max_config_requests = IXDR_GET_LONG(buf);
+               objp->ipcp_max_config_naks = IXDR_GET_LONG(buf);
+               objp->ipcp_max_terminate_requests = IXDR_GET_LONG(buf);
+               objp->ipcp_retransmit_interval = IXDR_GET_LONG(buf);
+               objp->lcp_echo_failure_count = IXDR_GET_LONG(buf);
+               objp->lcp_echo_interval = IXDR_GET_LONG(buf);
+               objp->lcp_max_config_requests = IXDR_GET_LONG(buf);
+               objp->lcp_max_config_naks = IXDR_GET_LONG(buf);
+               objp->lcp_max_terminate_requests = IXDR_GET_LONG(buf);
+               objp->lcp_retransmit_interval = IXDR_GET_LONG(buf);
+               objp->max_connect_time = IXDR_GET_LONG(buf);
+               objp->max_failure_count = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->local_ip_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_ip_addr))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->dns_addr_1))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->dns_addr_2))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->wins_addr_1))
+                        return FALSE;
+                if (!xdr_l2tp_api_ip_addr (xdrs, &objp->wins_addr_2))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->ip_pool_name))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->use_radius))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->radius_hint))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->use_as_default_route))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->multilink))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->local_name))
+                        return FALSE;
+                if (!xdr_optstring (xdrs, &objp->remote_name))
+                        return FALSE;
+                if (!xdr_bool (xdrs, &objp->proxy_arp))
+                        return FALSE;
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->flags2))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->trace_flags_mask))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->asyncmap))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->mru))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->mtu))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_none))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_peer))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_refuse_pap))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_refuse_chap))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_refuse_mschap))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_refuse_mschapv2))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->auth_refuse_eap))
+                return FALSE;
+        if (!xdr_l2tp_api_ppp_sync_mode (xdrs, &objp->sync_mode))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->chap_interval))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->chap_max_challenge))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->chap_restart))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->pap_max_auth_requests))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->pap_restart_interval))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->pap_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->idle_timeout))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->ipcp_max_config_requests))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->ipcp_max_config_naks))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->ipcp_max_terminate_requests))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->ipcp_retransmit_interval))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->lcp_echo_failure_count))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->lcp_echo_interval))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->lcp_max_config_requests))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->lcp_max_config_naks))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->lcp_max_terminate_requests))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->lcp_retransmit_interval))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_connect_time))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->max_failure_count))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->local_ip_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_ip_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->dns_addr_1))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->dns_addr_2))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->wins_addr_1))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->wins_addr_2))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->ip_pool_name))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_radius))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->radius_hint))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->use_as_default_route))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->multilink))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->local_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->remote_name))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->proxy_arp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_ppp_profile_list_entry (XDR *xdrs, l2tp_api_ppp_profile_list_entry *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (l2tp_api_ppp_profile_list_entry), (xdrproc_t) xdr_l2tp_api_ppp_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_ppp_profile_list_msg_data (XDR *xdrs, l2tp_api_ppp_profile_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_profiles))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->profiles, sizeof (l2tp_api_ppp_profile_list_entry), (xdrproc_t) xdr_l2tp_api_ppp_profile_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_ppp_profile_unset_msg_data (XDR *xdrs, l2tp_api_ppp_profile_unset_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_uint32_t (xdrs, &objp->flags2))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->result_code))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->profile_name, ~0))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_user_list_entry (XDR *xdrs, l2tp_api_user_list_entry *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_string (xdrs, &objp->user_name, ~0))
+                return FALSE;
+        if (!xdr_string (xdrs, &objp->create_time, ~0))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->created_by_admin))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->session_id))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->next, sizeof (l2tp_api_user_list_entry), (xdrproc_t) xdr_l2tp_api_user_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_user_list_msg_data (XDR *xdrs, l2tp_api_user_list_msg_data *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_int (xdrs, &objp->result))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_users))
+                return FALSE;
+        if (!xdr_pointer (xdrs, (char **)&objp->users, sizeof (l2tp_api_user_list_entry), (xdrproc_t) xdr_l2tp_api_user_list_entry))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_test_trigger_type (XDR *xdrs, l2tp_api_test_trigger_type *objp)
+{
+       register int32_t *buf;
+
+        if (!xdr_enum (xdrs, (enum_t *) objp))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_api_test_msg_data (XDR *xdrs, l2tp_api_test_msg_data *objp)
+{
+       register int32_t *buf;
+
+
+       if (xdrs->x_op == XDR_ENCODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->fake_rx_drop))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->fake_tx_drop))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->fake_trigger_fired))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->hold_tunnels))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->hold_sessions))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->no_random_ids))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->show_profile_usage))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_rx_drops))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tx_drops))
+                                return FALSE;
+
+               } else {
+               IXDR_PUT_BOOL(buf, objp->fake_rx_drop);
+               IXDR_PUT_BOOL(buf, objp->fake_tx_drop);
+               IXDR_PUT_BOOL(buf, objp->fake_trigger_fired);
+               IXDR_PUT_BOOL(buf, objp->hold_tunnels);
+               IXDR_PUT_BOOL(buf, objp->hold_sessions);
+               IXDR_PUT_BOOL(buf, objp->no_random_ids);
+               IXDR_PUT_BOOL(buf, objp->show_profile_usage);
+               IXDR_PUT_LONG(buf, objp->num_rx_drops);
+               IXDR_PUT_LONG(buf, objp->num_tx_drops);
+               }
+                if (!xdr_l2tp_api_test_trigger_type (xdrs, &objp->fake_trigger_type))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->session_id))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->num_tunnel_id_hash_hits))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tunnel_id_hash_misses))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tunnel_name_hash_hits))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tunnel_name_hash_misses))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_session_id_hash_hits))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_session_id_hash_misses))
+                                return FALSE;
+               } else {
+                       IXDR_PUT_LONG(buf, objp->num_tunnel_id_hash_hits);
+                       IXDR_PUT_LONG(buf, objp->num_tunnel_id_hash_misses);
+                       IXDR_PUT_LONG(buf, objp->num_tunnel_name_hash_hits);
+                       IXDR_PUT_LONG(buf, objp->num_tunnel_name_hash_misses);
+                       IXDR_PUT_LONG(buf, objp->num_session_id_hash_hits);
+                       IXDR_PUT_LONG(buf, objp->num_session_id_hash_misses);
+               }
+               return TRUE;
+       } else if (xdrs->x_op == XDR_DECODE) {
+                if (!xdr_uint32_t (xdrs, &objp->flags))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 9 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_bool (xdrs, &objp->fake_rx_drop))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->fake_tx_drop))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->fake_trigger_fired))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->hold_tunnels))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->hold_sessions))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->no_random_ids))
+                                return FALSE;
+                        if (!xdr_bool (xdrs, &objp->show_profile_usage))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_rx_drops))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tx_drops))
+                                return FALSE;
+
+               } else {
+               objp->fake_rx_drop = IXDR_GET_BOOL(buf);
+               objp->fake_tx_drop = IXDR_GET_BOOL(buf);
+               objp->fake_trigger_fired = IXDR_GET_BOOL(buf);
+               objp->hold_tunnels = IXDR_GET_BOOL(buf);
+               objp->hold_sessions = IXDR_GET_BOOL(buf);
+               objp->no_random_ids = IXDR_GET_BOOL(buf);
+               objp->show_profile_usage = IXDR_GET_BOOL(buf);
+               objp->num_rx_drops = IXDR_GET_LONG(buf);
+               objp->num_tx_drops = IXDR_GET_LONG(buf);
+               }
+                if (!xdr_l2tp_api_test_trigger_type (xdrs, &objp->fake_trigger_type))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                        return FALSE;
+                if (!xdr_uint16_t (xdrs, &objp->session_id))
+                        return FALSE;
+               buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
+               if (buf == NULL) {
+                        if (!xdr_int (xdrs, &objp->num_tunnel_id_hash_hits))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tunnel_id_hash_misses))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tunnel_name_hash_hits))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_tunnel_name_hash_misses))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_session_id_hash_hits))
+                                return FALSE;
+                        if (!xdr_int (xdrs, &objp->num_session_id_hash_misses))
+                                return FALSE;
+               } else {
+                       objp->num_tunnel_id_hash_hits = IXDR_GET_LONG(buf);
+                       objp->num_tunnel_id_hash_misses = IXDR_GET_LONG(buf);
+                       objp->num_tunnel_name_hash_hits = IXDR_GET_LONG(buf);
+                       objp->num_tunnel_name_hash_misses = IXDR_GET_LONG(buf);
+                       objp->num_session_id_hash_hits = IXDR_GET_LONG(buf);
+                       objp->num_session_id_hash_misses = IXDR_GET_LONG(buf);
+               }
+        return TRUE;
+       }
+
+        if (!xdr_uint32_t (xdrs, &objp->flags))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->fake_rx_drop))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->fake_tx_drop))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->fake_trigger_fired))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->hold_tunnels))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->hold_sessions))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->no_random_ids))
+                return FALSE;
+        if (!xdr_bool (xdrs, &objp->show_profile_usage))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_rx_drops))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_tx_drops))
+                return FALSE;
+        if (!xdr_l2tp_api_test_trigger_type (xdrs, &objp->fake_trigger_type))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->session_id))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_tunnel_id_hash_hits))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_tunnel_id_hash_misses))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_tunnel_name_hash_hits))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_tunnel_name_hash_misses))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_session_id_hash_hits))
+                return FALSE;
+        if (!xdr_int (xdrs, &objp->num_session_id_hash_misses))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_tunnel_delete_1_argument (XDR *xdrs, l2tp_tunnel_delete_1_argument *objp)
+{
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->reason))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_tunnel_get_1_argument (XDR *xdrs, l2tp_tunnel_get_1_argument *objp)
+{
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_session_delete_1_argument (XDR *xdrs, l2tp_session_delete_1_argument *objp)
+{
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->session_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->session_name))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->reason))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_session_get_1_argument (XDR *xdrs, l2tp_session_get_1_argument *objp)
+{
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+        if (!xdr_uint16_t (xdrs, &objp->session_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->session_name))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_session_list_1_argument (XDR *xdrs, l2tp_session_list_1_argument *objp)
+{
+        if (!xdr_uint16_t (xdrs, &objp->tunnel_id))
+                return FALSE;
+        if (!xdr_optstring (xdrs, &objp->tunnel_name))
+                return FALSE;
+       return TRUE;
+}
+
+bool_t
+xdr_l2tp_peer_get_1_argument (XDR *xdrs, l2tp_peer_get_1_argument *objp)
+{
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->local_addr))
+                return FALSE;
+        if (!xdr_l2tp_api_ip_addr (xdrs, &objp->peer_addr))
+                return FALSE;
+       return TRUE;
+}
diff --git a/net/opennhrp/Makefile b/net/opennhrp/Makefile
new file mode 100644 (file)
index 0000000..b086f65
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2009-2011 OpenWrt.org
+# Copyright (C) 2009 Jakob Pfeiffer
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=opennhrp
+PKG_VERSION:=0.12.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/opennhrp
+PKG_MD5SUM:=4d0ec7c0282e181ecca4d78e52067da3
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/opennhrp
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=VPN
+  DEPENDS:=+libcares +ipsec-tools +ip +kmod-gre
+  KCONFIG:=CONFIG_ARPD=y
+  TITLE:=NBMA Next Hop Resolution Protocol
+  URL:=http://opennhrp.sourceforge.net/
+endef
+
+define Package/opennhrp/description
+  OpenNHRP implements NBMA Next Hop Resolution Protocol (as defined in RFC 2332).
+  It makes it possible to create dynamic multipoint VPN Linux router using NHRP,
+  GRE and IPsec. It aims to be Cisco DMVPN compatible.
+endef
+
+define Package/opennhrp/conffiles
+/etc/opennhrp/opennhrp.conf
+endef
+
+define Package/opennhrp/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opennhrp{,ctl} $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/opennhrp
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/opennhrp/opennhrp.conf $(1)/etc/opennhrp/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/opennhrp/opennhrp-script $(1)/etc/opennhrp/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/opennhrp/racoon-ph1down.sh $(1)/etc/opennhrp/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/opennhrp/racoon-ph1dead.sh $(1)/etc/opennhrp/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/opennhrp.init $(1)/etc/init.d/opennhrp
+endef
+
+$(eval $(call BuildPackage,opennhrp))
diff --git a/net/opennhrp/files/opennhrp.init b/net/opennhrp/files/opennhrp.init
new file mode 100755 (executable)
index 0000000..8831287
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+# Copyright (C) 2009 Jakob Pfeiffer
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/opennhrp -d
+}
+
+stop() {
+       service_stop /usr/sbin/opennhrp
+}
diff --git a/net/openntpd/Makefile b/net/openntpd/Makefile
new file mode 100644 (file)
index 0000000..d6c139c
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# 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:=openntpd
+PKG_VERSION:=3.9p1
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \
+       ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ \
+       ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenNTPD/ \
+       ftp://ftp.sunet.se/pub/OpenBSD/OpenNTPD/
+PKG_MD5SUM:=afc34175f38d08867c1403d9008600b3
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openntpd
+  SUBMENU:=Time Synchronization
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=NTP server
+  URL:=http://www.openntpd.org/
+endef
+
+define Package/openntpd/description
+       A free and easy to use NTP (Network Time Protocol) implementation.
+endef
+
+define Package/openntpd/conffiles
+/etc/ntpd.conf
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-builtin-arc4random \
+               --with-privsep-user=network \
+               --with-adjtimex \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) -DUSE_ADJTIMEX"
+endef
+
+define Package/openntpd/install        
+       $(INSTALL_DIR) $(1)/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntpd $(1)/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/ntpd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ntpd.init $(1)/etc/init.d/ntpd
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/ntpd.hotplug $(1)/etc/hotplug.d/iface/20-ntpd
+endef
+
+define Package/openntpd/postinst
+#!/bin/sh
+[ -L "$${IPKG_INSTROOT}/usr/sbin/ntpd" ] && rm -f "$${IPKG_INSTROOT}/usr/sbin/ntpd"
+exit 0
+endef
+
+define Package/openntpd/postrm
+#!/bin/sh
+/bin/busybox ntpd -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/sbin/ntpd
+exit 0
+endef
+
+$(eval $(call BuildPackage,openntpd))
diff --git a/net/openntpd/files/ntpd.conf b/net/openntpd/files/ntpd.conf
new file mode 100644 (file)
index 0000000..4569c39
--- /dev/null
@@ -0,0 +1,6 @@
+# use a random selection of 8 public stratum 2 servers
+# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers
+server 0.openwrt.pool.ntp.org
+server 1.openwrt.pool.ntp.org
+server 2.openwrt.pool.ntp.org
+server 3.openwrt.pool.ntp.org
diff --git a/net/openntpd/files/ntpd.config b/net/openntpd/files/ntpd.config
new file mode 100644 (file)
index 0000000..192ae7b
--- /dev/null
@@ -0,0 +1,3 @@
+config timezone
+       option posixtz "CET-1CEST,M3.5.0,M10.5.0/3"
+       option zoneinfo "Europe/Paris"
diff --git a/net/openntpd/files/ntpd.hotplug b/net/openntpd/files/ntpd.hotplug
new file mode 100644 (file)
index 0000000..dfd58d4
--- /dev/null
@@ -0,0 +1,12 @@
+case "${ACTION:-ifup}" in
+       ifup)
+               ps | grep -v 'grep' | grep -v '20-ntpd' | grep -q 'ntpd' || {
+                       route -n 2>/dev/null | grep -q '^0.0.0.0' && {
+                               /etc/init.d/ntpd enabled && /etc/init.d/ntpd start 2>/dev/null >/dev/null
+                       }
+               }
+       ;;
+       ifdown)
+               route -n 2>/dev/null | grep -q '^0.0.0.0' || /etc/init.d/ntpd stop 2>/dev/null >/dev/null
+       ;;
+esac
diff --git a/net/openntpd/files/ntpd.init b/net/openntpd/files/ntpd.init
new file mode 100644 (file)
index 0000000..ea5fc3b
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=60
+
+boot() {
+       return 0
+}
+
+start() {
+       mkdir -p `awk -F: '/^network:/{print $6}' /etc/passwd`
+       mkdir -p /var/db/
+       /sbin/ntpd -s
+}
+
+stop() {
+       service_kill ntpd
+}
diff --git a/net/openntpd/patches/001-adjtimex_linux.patch b/net/openntpd/patches/001-adjtimex_linux.patch
new file mode 100644 (file)
index 0000000..3a02775
--- /dev/null
@@ -0,0 +1,178 @@
+diff -urN openntpd-3.9p1/client.c openntpd-3.9p1.new/client.c
+--- openntpd-3.9p1/client.c    2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1.new/client.c        2006-11-03 11:05:18.000000000 +0100
+@@ -321,7 +321,7 @@
+       priv_adjtime();
+       for (i = 0; i < OFFSET_ARRAY_SIZE; i++)
+-              if (p->reply[i].rcvd <= p->reply[best].rcvd)
++              /* if (p->reply[i].rcvd <= p->reply[best].rcvd) */
+                       p->reply[i].good = 0;
+       return (0);
+diff -urN openntpd-3.9p1/configure.ac openntpd-3.9p1.new/configure.ac
+--- openntpd-3.9p1/configure.ac        2006-05-14 07:29:23.000000000 +0200
++++ openntpd-3.9p1.new/configure.ac    2006-11-03 11:06:26.000000000 +0100
+@@ -583,6 +583,12 @@
+       [ builtin_arc4random=$withval ]
+ )
++AC_ARG_WITH(adjtimex,
++      [  --with-adjtimex         Use adjtimex to adjust kernel skew],
++      [ AC_DEFINE(USE_ADJTIMEX, [], [Use adjust skew with adjtimex (experimental)]) ]
++)
++
++
+ AC_ARG_WITH(mantype,
+       [  --with-mantype=man|cat|doc  Set man page type],
+       [
+diff -urN openntpd-3.9p1/defines.h openntpd-3.9p1.new/defines.h
+--- openntpd-3.9p1/defines.h   2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1.new/defines.h       2006-11-03 11:06:56.000000000 +0100
+@@ -20,6 +20,10 @@
+ # define setproctitle(x)
+ #endif
++#ifdef USE_ADJTIMEX
++# define adjtime(a,b)  (_compat_adjtime((a),(b)))
++#endif
++
+ #if !defined(SA_LEN)
+ # if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
+ #  define SA_LEN(x)   ((x)->sa_len)
+diff -urN openntpd-3.9p1/openbsd-compat/Makefile.in openntpd-3.9p1.new/openbsd-compat/Makefile.in
+--- openntpd-3.9p1/openbsd-compat/Makefile.in  2006-05-14 07:29:19.000000000 +0200
++++ openntpd-3.9p1.new/openbsd-compat/Makefile.in      2006-11-03 11:07:20.000000000 +0100
+@@ -9,7 +9,7 @@
+ COMPAT=               atomicio.o bsd-arc4random.o bsd-misc.o bsd-poll.o \
+               bsd-snprintf.o bsd-getifaddrs.o bsd-setresuid.o \
+               bsd-setresgid.o fake-rfc2553.o
+-PORT=         port-qnx.o
++PORT=         port-linux.o port-qnx.o
+ VPATH=@srcdir@
+ CC=@CC@
+diff -urN openntpd-3.9p1/openbsd-compat/openbsd-compat.h openntpd-3.9p1.new/openbsd-compat/openbsd-compat.h
+--- openntpd-3.9p1/openbsd-compat/openbsd-compat.h     2006-05-14 07:29:19.000000000 +0200
++++ openntpd-3.9p1.new/openbsd-compat/openbsd-compat.h 2006-11-03 11:07:55.000000000 +0100
+@@ -46,6 +46,11 @@
+                 __attribute__((__format__ (printf, 2, 3)));
+ #endif
++#ifdef USE_ADJTIMEX
++# include <sys/time.h>
++int _compat_adjtime(const struct timeval *, struct timeval *);
++#endif
++
+ #ifndef HAVE_INET_PTON
+ int inet_pton(int, const char *, void *);
+ #endif
+diff -urN openntpd-3.9p1/openbsd-compat/port-linux.c openntpd-3.9p1.new/openbsd-compat/port-linux.c
+--- openntpd-3.9p1/openbsd-compat/port-linux.c 1970-01-01 01:00:00.000000000 +0100
++++ openntpd-3.9p1.new/openbsd-compat/port-linux.c     2006-11-03 11:08:57.000000000 +0100
+@@ -0,0 +1,105 @@
++/* $Id$ */
++
++/*
++ * Copyright (c) 2004 Darren Tucker <dtucker at zip com au>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include "includes.h"
++
++#ifdef USE_ADJTIMEX
++#include <sys/timex.h>
++#include <errno.h>
++#ifdef adjtime
++# undef adjtime
++#endif
++
++#include "ntpd.h"
++
++/* scale factor used by adjtimex freq param.  1 ppm = 65536 */
++#define ADJTIMEX_FREQ_SCALE 65536
++
++/* maximum change to skew per adjustment, in PPM */
++#define MAX_SKEW_DELTA 5.0
++
++int
++_compat_adjtime(const struct timeval *delta, struct timeval *olddelta)
++{
++      static struct timeval tlast = {0,0};
++      static double tskew = 0;
++      static int synced = -1;
++      struct timeval tnow, tdelta;
++      double skew = 0, newskew, deltaskew, adjust, interval = 0;
++      struct timex tmx;
++      int result, saved_errno;
++
++      gettimeofday(&tnow, NULL);
++      adjust = (double)delta->tv_sec;
++      adjust += (double)delta->tv_usec / 1000000;
++
++      /* Even if the caller doesn't care about the olddelta, we do */
++      if (olddelta == NULL)
++              olddelta = &tdelta;
++
++      result = adjtime(delta, olddelta);
++      saved_errno = errno;
++
++      if (olddelta->tv_sec == 0 && olddelta->tv_usec == 0 &&
++          synced != INT_MAX)
++              synced++;
++       else
++              synced = 0;
++
++      /*
++       * do skew calculations if we have synced
++       */
++      if (synced == 0 ) {
++              tmx.modes = 0;
++              if (adjtimex(&tmx) == -1)
++                      log_warn("adjtimex get failed");
++              else
++                      tskew = (double)tmx.freq / ADJTIMEX_FREQ_SCALE;
++      } else if (synced >= 1) {
++              interval = (double)(tnow.tv_sec - tlast.tv_sec);
++              interval += (double)(tnow.tv_usec - tlast.tv_usec) / 1000000;
++
++              skew = (adjust * 1000000) / interval;
++              newskew = ((tskew * synced) + skew) / synced;
++              deltaskew = newskew - tskew;
++
++              if (deltaskew > MAX_SKEW_DELTA) {
++                      log_info("skew change %0.3lf exceeds limit", deltaskew);
++                      tskew += MAX_SKEW_DELTA;
++              } else if (deltaskew < -MAX_SKEW_DELTA) {
++                      log_info("skew change %0.3lf exceeds limit", deltaskew);
++                      tskew -= MAX_SKEW_DELTA;
++              } else {
++                      tskew = newskew;
++              }
++
++              /* Adjust the kernel skew.  */
++              tmx.freq = (long)(tskew * ADJTIMEX_FREQ_SCALE);
++              tmx.modes = ADJ_FREQUENCY;
++              if (adjtimex(&tmx) == -1)
++                      log_warn("adjtimex set freq failed");
++      }
++
++      log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval,
++          skew, tskew);
++
++      tlast = tnow;
++      errno = saved_errno;
++      return result;
++}
++#endif
diff --git a/net/openntpd/patches/002-save_freq_drift.patch b/net/openntpd/patches/002-save_freq_drift.patch
new file mode 100644 (file)
index 0000000..2bc5bb2
--- /dev/null
@@ -0,0 +1,92 @@
+--- openntpd-3.9p1/ntpd.h      2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1new/ntpd.h   2007-02-03 23:51:56.000000000 +0100
+@@ -34,6 +34,7 @@
+ #define       NTPD_USER       "_ntp"
+ #endif
+ #define       CONFFILE        SYSCONFDIR "/ntpd.conf"
++#define DRIFTFILE     "/var/db/ntpd.drift"
+ #define       READ_BUF_SIZE           4096
+--- openntpd-3.9p1/ntpd.c      2006-05-14 07:29:23.000000000 +0200
++++ openntpd-3.9p1new/ntpd.c   2007-02-04 00:00:36.000000000 +0100
+@@ -45,6 +45,7 @@
+ int           dispatch_imsg(struct ntpd_conf *);
+ int           ntpd_adjtime(double);
+ void          ntpd_settime(double);
++void  readfreq(void);
+ volatile sig_atomic_t  quit = 0;
+ volatile sig_atomic_t  reconfig = 0;
+@@ -153,7 +154,8 @@
+       chld_pid = ntp_main(pipe_chld, &conf);
+       setproctitle("[priv]");
+-
++      readfreq();
++      
+       signal(SIGTERM, sighdlr);
+       signal(SIGINT, sighdlr);
+       signal(SIGCHLD, sighdlr);
+
+--- openntpd-3.9p1/openbsd-compat/port-linux.c 2007-02-03 20:52:20.000000000 +0100
++++ openntpd-3.9p1new/openbsd-compat/port-linux.c      2007-02-04 01:02:16.000000000 +0100
+@@ -33,6 +33,49 @@
+ /* maximum change to skew per adjustment, in PPM */
+ #define MAX_SKEW_DELTA 5.0
++void
++writefreq(double d)
++{
++      int r;
++      FILE *fp;
++
++      fp = fopen(DRIFTFILE, "w");
++      if (fp == NULL)
++      {
++              log_warn("opening drift file for writing failed");
++              return;
++      }
++      
++      fprintf(fp, "%e\n", d);
++      r = ferror(fp);
++      if (fclose(fp) != 0 || r != 0)
++      {
++              unlink(DRIFTFILE);
++              log_warn("saving freq drift failed");
++      }
++}
++
++void
++readfreq(void)
++{
++      FILE *fp;
++      double d;
++      struct timex tmx;
++
++      fp = fopen(DRIFTFILE, "r");
++      if (fp == NULL)
++              return;
++
++      if (fscanf(fp, "%le", &d) == 1)
++      {
++              tmx.freq = (long)(d * ADJTIMEX_FREQ_SCALE);
++              tmx.modes = ADJ_FREQUENCY;
++              if (adjtimex(&tmx) == -1)
++                      log_warn("adjtimex set freq failed");
++      }
++      fclose(fp);
++}
++
+ int
+ _compat_adjtime(const struct timeval *delta, struct timeval *olddelta)
+ {
+@@ -93,6 +136,8 @@
+               tmx.modes = ADJ_FREQUENCY;
+               if (adjtimex(&tmx) == -1)
+                       log_warn("adjtimex set freq failed");
++                      
++              writefreq( tskew );
+       }
+       log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval,
diff --git a/net/openntpd/patches/003-no_permission_check.patch b/net/openntpd/patches/003-no_permission_check.patch
new file mode 100644 (file)
index 0000000..4391a30
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ntp.c
++++ b/ntp.c
+@@ -111,8 +111,6 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
+       if (stat(chrootdir, &stb) == -1)
+               fatal("stat");
+-      if (stb.st_uid != 0 || (stb.st_mode & (S_IWGRP|S_IWOTH)) != 0)
+-              fatal("bad privsep dir permissions");
+       if (chroot(chrootdir) == -1)
+               fatal("chroot");
+       if (chdir("/") == -1)
diff --git a/net/openrrcp/Makefile b/net/openrrcp/Makefile
new file mode 100644 (file)
index 0000000..3d45962
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2008-2014 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:=openrrcp
+PKG_VERSION:=0.2.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nording.ru/projects/download/openrrcp/stable
+PKG_MD5SUM:=e3d6097732af812b03dbbbedeced34d2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openrrcp
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=OpenRRCP toolset for managing RRCP-capable Ethernet switches
+  URL:=http://openrrcp.org.ru/
+endef
+
+define Package/openrrcp/description
+       OpenRRCP toolset for managing RRCP-capable Ethernet switches
+endef
+
+MAKE_VARS += \
+       PREFIX="/usr" \
+       $(TARGET_CONFIGURE_OPTS)
+
+define Package/openrrcp/install
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(1)" \
+               PREFIX="/usr" \
+               install
+endef
+
+$(eval $(call BuildPackage,openrrcp))
diff --git a/net/openrrcp/patches/001-Makefile_honor_CFLAGS_for_VFP.patch b/net/openrrcp/patches/001-Makefile_honor_CFLAGS_for_VFP.patch
new file mode 100644 (file)
index 0000000..1799bda
--- /dev/null
@@ -0,0 +1,7 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -1,4 +1,3 @@
+-CFLAGS=`/bin/sh Makefile-helper.sh`
+ all: rtl8316b rtl8324 rtl8326 rtl83xx_dlink_des1016d rtl83xx_dlink_des1024d_b1 \
+ rtl83xx_dlink_des1024d_c1 rtl83xx_compex_ps2216 rtl83xx_ovislink_fsh2402gt \
diff --git a/net/openslp/Makefile b/net/openslp/Makefile
new file mode 100644 (file)
index 0000000..25f5d14
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2008-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:=openslp
+PKG_VERSION:=1.2.1
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/openslp
+PKG_MD5SUM:=ff9999d1b44017281dd00ed2c4d32330
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openslp
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl
+  TITLE:=openslp
+  URL:=http://www.openslp.org/
+endef
+
+#CONFIGURE_ARGS += \
+#      --disable-libwrap
+
+#MAKE_FLAGS += \
+#      CFLAGS="$(TARGET_CFLAGS) -Wall -D_REENTRANT" \
+#      all
+
+define Package/openslp/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libslp.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/slptool $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/slpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/etc/slp.* $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/etc/init.d/* $(1)/etc/init.d/
+endef
+
+define Package/openslp/conffiles
+/etc/slp.*
+endef
+
+$(eval $(call BuildPackage,openslp))
diff --git a/net/openslp/files/etc/init.d/slpd b/net/openslp/files/etc/init.d/slpd
new file mode 100644 (file)
index 0000000..2b5e727
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+START=50
+
+start() {
+       cp /etc/slp* /var
+       IP=`ifconfig br-lan | grep inet | cut -d" " -f12 | cut -d: -f2`
+       sed -i "s/IPADDR/${IP}/g" /var/slp.reg
+       slpd -r /var/slp.reg -c /var/slp.conf
+}
+
+stop() {
+       killall slpd
+}
diff --git a/net/openslp/files/etc/slp.conf b/net/openslp/files/etc/slp.conf
new file mode 100644 (file)
index 0000000..ca434ea
--- /dev/null
@@ -0,0 +1,28 @@
+;net.slp.useScopes = myScope1, myScope2, myScope3
+;net.slp.DAAddresses = myDa1,myDa2,myDa3
+;net.slp.isDA = true
+;net.slp.DAHeartBeat = 10800
+;net.slp.watchRegistrationPID = false
+;net.slp.maxResults = 256
+;net.slp.isBroadcastOnly = true
+;net.slp.passiveDADetection = false
+;net.slp.activeDADetection = false
+;net.slp.DAActiveDiscoveryInterval = 1
+;net.slp.multicastTTL = 255
+;net.slp.DADiscoveryMaximumWait = 2000
+;net.slp.DADiscoveryTimeouts = 500,750,1000,1500,2000,3000
+;net.slp.multicastMaximumWait = 5000
+;net.slp.multicastTimeouts  = 500,750,1000,1500,2000,3000
+;net.slp.unicastMaximumWait = 5000 
+;net.slp.unicastTimeouts  = 500,750,1000,1500,2000,3000
+;net.slp.datagramTimeouts = IGNORED
+;net.slp.randomWaitBound = 5000
+;net.slp.MTU = 1400
+;net.slp.interfaces = 1.2.3.4,1.2.3.5,1.2.3.6
+;net.slp.securityEnabled=true
+;net.slp.checkSourceAddr=false
+
+;net.slp.traceDATraffic = true
+;net.slp.traceReg = true
+;net.slp.traceDrop = true
+;net.slp.traceMsg = true
diff --git a/net/openslp/files/etc/slp.reg b/net/openslp/files/etc/slp.reg
new file mode 100644 (file)
index 0000000..44fdae3
--- /dev/null
@@ -0,0 +1,2 @@
+service:device.AP://IPADDR,en,65535 
+use default scopes
diff --git a/net/openslp/files/etc/slp.spi b/net/openslp/files/etc/slp.spi
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/net/openswan/Makefile b/net/openswan/Makefile
new file mode 100644 (file)
index 0000000..05ae1f8
--- /dev/null
@@ -0,0 +1,110 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=openswan
+PKG_VERSION:=2.6.41
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.openswan.org/download
+PKG_MD5SUM:=da2e8b02ecc30a408cc5766767fef84f
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openswan/Default
+  TITLE:=Openswan
+  URL:=http://www.openswan.org/
+endef
+
+define Package/openswan/Default/description
+ Openswan is an IPsec implementation for Linux.
+endef
+
+define Package/openswan
+$(call Package/openswan/Default)
+  SUBMENU:=VPN
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE+= (daemon)
+  DEPENDS+= +libgmp +ip
+endef
+
+define Package/openswan/description
+$(call Package/openswan/Default/description)
+ This package contains the Openswan user-land daemon.
+endef
+
+define KernelPackage/openswan
+$(call Package/openswan/Default)
+  SUBMENU:=Network Support
+  TITLE+= (kernel module)
+  DEPENDS+=+IPV6:kmod-ipv6
+  FILES:=$(PKG_BUILD_DIR)/modobj*/ipsec.$(LINUX_KMOD_SUFFIX)
+endef
+
+define KernelPackage/openswan/description
+$(call Package/openswan/Default/description)
+ This package contains the Openswan kernel module.
+endef
+
+TARGET_CPPFLAGS += -I$(LINUX_DIR)/$(LINUX_UAPI_DIR)include -D__EXPORTED_HEADERS__
+TARGET_CFLAGS += $(FPIC)
+
+OPENSWAN_MAKEFLAGS:= \
+       -C $(PKG_BUILD_DIR) \
+       $(TARGET_CONFIGURE_OPTS) \
+       LINUX_RELEASE="$(LINUX_RELEASE)" \
+       KERNELSRC="$(LINUX_DIR)" \
+       ARCH="$(LINUX_KARCH)" \
+       CROSS_COMPILE="$(TARGET_CROSS)" \
+       USERCOMPILE="$(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/ports/linux/include -I$(PKG_BUILD_DIR)/linux/include -I$(PKG_BUILD_DIR)/include $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" \
+       IPSECDIR="/usr/lib/ipsec" \
+       INC_USRLOCAL="/usr" \
+       INC_RCDEFAULT="/etc/init.d" \
+       MODPROBE="/sbin/insmod" \
+       DESTDIR="$(PKG_INSTALL_DIR)"
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) programs
+       +$(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) module
+endef
+
+define Build/Install
+       $(MAKE) $(OPENSWAN_MAKEFLAGS) install
+endef
+
+define Package/openswan/conffiles
+/etc/ipsec.conf
+/etc/ipsec.secrets
+/etc/config/ipsec
+endef
+
+define Package/openswan/install
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(CP) ./files/ipsec.init $(1)/etc/init.d/ipsec
+       $(CP) ./files/ipsec.conf $(1)/etc/ipsec.conf
+       $(CP) ./files/ipsec.secrets $(1)/etc/ipsec.secrets
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/ipsec.config $(1)/etc/config/ipsec
+       rm -rf $(1)/usr/share
+       rm -rf $(1)/usr/man
+       rm -rf $(1)/var
+       rm -rf $(1)/etc/rc.d
+       find $(1) -name \*.old | xargs rm -rf
+       $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
+       $(INSTALL_DATA) files/ipsec.upgrade $(1)/lib/upgrade/keep.d/ipsec
+endef
+
+$(eval $(call BuildPackage,openswan))
+$(eval $(call KernelPackage,openswan))
diff --git a/net/openswan/files/ipsec.conf b/net/openswan/files/ipsec.conf
new file mode 100644 (file)
index 0000000..b214bac
--- /dev/null
@@ -0,0 +1,8 @@
+# /etc/ipsec.conf - IPsec configuration file
+
+version        2.0
+
+include /etc/ipsec.uci.conf
+
+# Include non-UCI connections here
+# They will be preserved across restarts/upgrades
diff --git a/net/openswan/files/ipsec.config b/net/openswan/files/ipsec.config
new file mode 100644 (file)
index 0000000..6469e98
--- /dev/null
@@ -0,0 +1,2 @@
+config ipsec_config setup
+       option nat_traversal    yes
diff --git a/net/openswan/files/ipsec.init b/net/openswan/files/ipsec.init
new file mode 100755 (executable)
index 0000000..b0961b3
--- /dev/null
@@ -0,0 +1,393 @@
+#!/bin/sh /etc/rc.common
+# IPsec startup and shutdown script
+# Copyright (C) 1998, 1999, 2001  Henry Spencer.
+# Copyright (C) 2002                     Michael Richardson <mcr@freeswan.org>
+# 
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+#
+# ipsec                 init.d script for starting and stopping
+#                         the IPsec security subsystem (KLIPS and Pluto).
+#
+# This script becomes /etc/rc.d/init.d/ipsec (or possibly /etc/init.d/ipsec)
+# and is also accessible as "ipsec setup" (the preferred route for human
+# invocation).
+#
+# The startup and shutdown times are a difficult compromise (in particular,
+# it is almost impossible to reconcile them with the insanely early/late
+# times of NFS filesystem startup/shutdown).  Startup is after startup of
+# syslog and pcmcia support; shutdown is just before shutdown of syslog.
+#
+# chkconfig: 2345 47 76
+# description: IPsec provides encrypted and authenticated communications; \
+# KLIPS is the kernel half of it, Pluto is the user-level management daemon.
+
+START=60
+EXTRA_COMMANDS=status
+EXTRA_HELP="   status  Show the status of the service"
+
+# Format a list into a delimited string and print it
+config_list_delimit() {
+       local SECTION="$1"
+       local OPTION="$2"
+       local DELIMITER="${3:- }"
+
+       config_list_foreach "$SECTION" "$OPTION" "printf \"%s%s\"" "$DELIMITER" | sed "s/.\{${#DELIMITER}\}$//"
+}
+
+# Callback for each ipsec configuration section
+# Converts list options from UCI to ipsec format and writes ipsec section headers
+CUR_SECTION_NAME=
+CUR_SECTION_TYPE=
+config_cb() {
+       local TYPE="$1"
+       local NAME="$2"
+
+       # Handle list options from previous section
+       if [ "$CUR_SECTION_TYPE" = "ipsec_conn" ] ; then
+               local IKE="$(config_list_delimit "$CUR_SECTION_NAME" "ike" ", ")"
+               if [ -n "$IKE" ] ; then
+                       printf "\tike=\"%s\"\n" "$IKE" >> "$IPSEC_UCI_CONF"
+               fi
+
+               local SUBNETS
+               local SPACE_PAT="* *"
+               config_get "SUBNETS" "$CUR_SECTION_NAME" "leftsubnets"
+               case "$SUBNETS" in
+                       $SPACE_PAT)
+                               printf "\tleftsubnets={ %s }\n" "$SUBNETS" >> "$IPSEC_UCI_CONF"
+                               ;;
+                       ?*)
+                               printf "\tleftsubnet=%s\n" "$SUBNETS" >> "$IPSEC_UCI_CONF"
+                               ;;
+               esac
+
+               config_get "SUBNETS" "$CUR_SECTION_NAME" "rightsubnets"
+               case "$SUBNETS" in
+                       $SPACE_PAT)
+                               printf "\trightsubnets={ %s }\n" "$SUBNETS" >> "$IPSEC_UCI_CONF"
+                               ;;
+                       ?*)
+                               printf "\trightsubnet=%s\n" "$SUBNETS" >> "$IPSEC_UCI_CONF"
+                               ;;
+               esac
+       elif [ "$CUR_SECTION_TYPE" = "ipsec_config" ] ; then
+               local VPRIV="$(config_list_delimit "$CUR_SECTION_NAME" "virtual_private" ",")"
+               if [ -n "$VPRIV" ] ; then
+                       printf "\tvirtual_private=%s\n" "$VPRIV" >> "$IPSEC_UCI_CONF"
+               fi
+       fi
+
+       CUR_SECTION_NAME="$NAME"
+       CUR_SECTION_TYPE="$TYPE"
+
+       case "$CUR_SECTION_TYPE" in
+               ipsec_config|ipsec_conn)
+                       # Handled in option_cb
+                       echo >> "$IPSEC_UCI_CONF"
+                       echo "${TYPE#ipsec_} $NAME" >> "$IPSEC_UCI_CONF"
+                       ;;
+               *)
+                       # Not handled in option_cb
+                       ;;
+       esac
+
+       return 0
+}
+
+# Callback for each ipsec configuration option
+# Prints each UCI option to $IPSEC_UCI_CONF in ipsec.conf format
+option_cb() {
+       local NAME="$1"
+       local VALUE="$2"
+
+       case "$CUR_SECTION_TYPE" in
+               ipsec_config|ipsec_conn)
+                       # Handle option in these sections
+                       ;;
+               *)
+                       # Ignore options in all other sections
+                       return 0
+                       ;;
+       esac
+
+       case "$NAME" in
+               modecfgdns_ITEM[0-9]*)
+                       printf "\tmodecfgdns%d=%s\n" "${NAME##modecfgdns_ITEM}" "$VALUE" >> "$IPSEC_UCI_CONF"
+                       ;;
+               modecfgwins_ITEM[0-9]*)
+                       printf "\tmodecfgwins%d=%s\n" "${NAME##modecfgwins_ITEM}" "$VALUE" >> "$IPSEC_UCI_CONF"
+                       ;;
+               *_ITEM[0-9]*|*_LENGTH)
+                       # Ignore list items and length updates
+                       ;;
+               [!a-zA-Z]*)
+                       # Ignore non-ipsec.conf parameters
+                       ;;
+               *)
+                       # Quote values with characers which require quoting
+                       if echo "$VALUE" | grep -q '^[[:alnum:]_%.]*$' ; then
+                               printf "\t%s=%s\n" "$NAME" "$VALUE" >> "$IPSEC_UCI_CONF"
+                       else
+                               printf "\t%s=\"%s\"\n" "$NAME" "$VALUE" >> "$IPSEC_UCI_CONF"
+                       fi
+                       ;;
+       esac
+
+       return 0
+}
+
+ipsec_config_convert() {
+       IPSEC_UCI_CONF="${IPSEC_UCI_CONF:-${IPSEC_CONFS:-/etc}/ipsec.uci.conf}"
+       ipsec_config_print_header
+       config_load "ipsec"
+       # Conversion for $IPSEC_UCI_CONF handled in section_cb and option_cb
+
+       IPSEC_SEC_UCI_CONF="${IPSEC_SEC_UCI_CONF:-${IPSEC_CONFS:-/etc}/ipsec.uci.secrets}"
+       ipsec_config_print_header_secret
+       echo >> "$IPSEC_SEC_UCI_CONF"
+       echo "# Certificate Secrets" >> "$IPSEC_SEC_UCI_CONF"
+       config_foreach "ipsec_config_add_secret_cs" "ipsec_secret_cs"
+       echo >> "$IPSEC_SEC_UCI_CONF"
+       echo "# Shared Secrets" >> "$IPSEC_SEC_UCI_CONF"
+       config_foreach "ipsec_config_add_secret_ss" "ipsec_secret_ss"
+       echo >> "$IPSEC_SEC_UCI_CONF"
+       echo "# XAUTH Secrets" >> "$IPSEC_SEC_UCI_CONF"
+       config_foreach "ipsec_config_add_secret_xs" "ipsec_secret_xs"
+}
+
+ipsec_config_print_header() {
+       cat > "$IPSEC_UCI_CONF" <<ENDHEADER
+# $IPSEC_UCI_CONF - UCI IPsec configuration file
+#
+# This file is automatically generated by the ipsec init script from
+# configuration information stored in UCI.  DO NOT EDIT THIS FILE BY HAND.
+ENDHEADER
+}
+
+ipsec_config_print_header_secret() {
+       cat > "$IPSEC_SEC_UCI_CONF" <<ENDHEADER
+# $IPSEC_SEC_UCI_CONF - UCI IPsec sensitive configuration file
+#
+# This file is automatically generated by the ipsec init script from
+# configuration information stored in UCI.  DO NOT EDIT THIS FILE BY HAND.
+ENDHEADER
+}
+
+ipsec_config_add_secret_cs() {
+       local SECTNAME="$1"
+
+       config_get "FILE" "$SECTNAME" "file"
+       config_get "SECRET" "$SECTNAME" "secret"
+
+       FILE="\"$FILE\""
+       if [ "$SECRET" != "%prompt" ] ; then
+               SECRET="\"$SECRET\""
+       fi
+
+       echo ": RSA $FILE $SECRET" >> "$IPSEC_SEC_UCI_CONF"
+}
+
+ipsec_config_add_secret_ss() {
+       local SECTNAME="$1"
+
+       config_get "INDICES" "$SECTNAME" "indices"
+       config_get "SECRET" "$SECTNAME" "secret"
+
+       echo "$INDICES : PSK \"$SECRET\"" >> "$IPSEC_SEC_UCI_CONF"
+}
+
+ipsec_config_add_secret_xs() {
+       local SECTNAME="$1"
+
+       config_get "USERNAME" "$SECTNAME" "username"
+       config_get "SECRET" "$SECTNAME" "secret"
+
+       echo "@$USERNAME : XAUTH \"$SECRET\"" >> "$IPSEC_SEC_UCI_CONF"
+}
+
+script_init() {
+       me='ipsec setup'                # for messages
+
+       # where the private directory and the config files are
+       IPSEC_EXECDIR="${IPSEC_EXECDIR-/usr/libexec/ipsec}"
+       IPSEC_LIBDIR="${IPSEC_LIBDIR-/usr/lib/ipsec}"
+       IPSEC_SBINDIR="${IPSEC_SBINDIR-/usr/sbin}"
+       IPSEC_CONFS="${IPSEC_CONFS-/etc}"
+
+       if test " $IPSEC_DIR" = " "     # if we were not called by the ipsec command
+       then
+               # we must establish a suitable PATH ourselves
+               PATH="${IPSEC_SBINDIR}":/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin
+               export PATH
+
+               IPSEC_DIR="$IPSEC_LIBDIR"
+               export IPSEC_DIR IPSEC_CONFS IPSEC_LIBDIR IPSEC_EXECDIR
+       fi
+
+       # Check that the ipsec command is available.
+       found=
+       for dir in `echo $PATH | tr ':' ' '`
+       do
+               if test -f $dir/ipsec -a -x $dir/ipsec
+               then
+                       found=yes
+                       break                   # NOTE BREAK OUT
+               fi
+       done
+       if ! test "$found"
+       then
+               echo "cannot find ipsec command -- \`$1' aborted" |
+                       logger -s -p daemon.error -t ipsec_setup
+               exit 1
+       fi
+
+       # accept a few flags
+
+       export IPSEC_setupflags
+       IPSEC_setupflags=""
+
+       config=""
+
+       for dummy
+       do
+               case "$1" in
+               --showonly|--show)  IPSEC_setupflags="$1" ;;
+               --config)  config="--config $2" ; shift ;;
+               *) break ;;
+               esac
+               shift
+       done
+
+
+       # Pick up IPsec configuration (until we have done this, successfully, we
+       # do not know where errors should go, hence the explicit "daemon.error"s.)
+       # Note the "--export", which exports the variables created.
+       variables=`ipsec addconn $config --varprefix IPSEC --configsetup`
+       if [ $? != 0 ]
+       then
+               echo "Failed to parse config setup portion of ipsec.conf"
+               exit $?
+       fi
+       eval $variables
+
+       if test " $IPSEC_confreadstatus" != " "
+       then
+               case $1 in 
+               stop|--stop|_autostop) 
+               echo "$IPSEC_confreadstatus -- \`$1' may not work" |
+                       logger -s -p daemon.error -t ipsec_setup;;
+                       
+               *) echo "$IPSEC_confreadstatus -- \`$1' aborted" |
+                       logger -s -p daemon.error -t ipsec_setup;
+               exit 1;;
+               esac
+       fi
+
+       IPSEC_confreadsection=${IPSEC_confreadsection:-setup}
+       export IPSEC_confreadsection
+
+       IPSECsyslog=${IPSECsyslog-daemon.error}
+       export IPSECsyslog
+
+       # misc setup
+       umask 022
+
+       mkdir -p /var/run/pluto
+}
+
+script_command() {
+       # do it
+       case "$1" in
+       start|--start|stop|--stop|_autostop|_autostart)
+               # remove for: @cygwin_START@ 
+               # portable way for checking for root
+               if [ ! -w / ]
+               then
+
+                       echo "permission denied (must be superuser)" |
+                               logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
+                       exit 1
+               fi
+               # remove for: @cygwin_END@
+               tmp=/var/run/pluto/ipsec_setup.st
+               outtmp=/var/run/pluto/ipsec_setup.out
+               (
+                       ipsec _realsetup $1
+                       echo "$?" >$tmp
+               ) > ${outtmp} 2>&1
+               st=$?
+               if test -f $tmp
+               then
+                       st=`cat $tmp`
+                       rm -f $tmp
+               fi
+               if [ -f ${outtmp} ]; then
+                       cat ${outtmp} | logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
+                       rm -f ${outtmp}
+               fi
+               ;;
+
+       restart|--restart|force-reload)
+               $0 $IPSEC_setupflags stop
+               $0 $IPSEC_setupflags start
+               ;;
+
+       _autorestart)                   # for internal use only
+               $0 $IPSEC_setupflags _autostop
+               $0 $IPSEC_setupflags _autostart
+               ;;
+
+       status|--status)
+               ipsec _realsetup $1
+               exit
+               ;;
+
+       --version)
+               echo "$me $IPSEC_VERSION"
+               exit 0
+               ;;
+
+       --help)
+               echo "Usage: $me [ --showonly ] {--start|--stop|--restart}"
+               echo "     $me --status"
+               exit 0
+               ;;
+
+       *)
+               echo "Usage: $me [ --showonly ] {--start|--stop|--restart}"
+               echo "     $me --status"
+               exit 2
+       esac
+}
+start() {
+       ipsec_config_convert
+       script_init start "$@"
+       script_command start "$@"
+}
+
+stop() {
+       script_init stop "$@"
+       script_command stop "$@"
+}
+
+restart() {
+       ipsec_config_convert
+       script_init stop "$@"
+       script_command stop "$@"
+       script_command start "$@"
+}
+
+status() {
+       script_init status "$@"
+       ipsec _realsetup status
+}
+
diff --git a/net/openswan/files/ipsec.secrets b/net/openswan/files/ipsec.secrets
new file mode 100644 (file)
index 0000000..1384683
--- /dev/null
@@ -0,0 +1,7 @@
+# /etc/ipsec.secrets - IPsec sensitive configuration file
+
+# Include configuration information from UCI
+include /etc/ipsec.uci.secrets
+
+# Add non-UCI secrets below
+# This file will be preserved across restarts/upgrades
diff --git a/net/openswan/files/ipsec.upgrade b/net/openswan/files/ipsec.upgrade
new file mode 100644 (file)
index 0000000..36ba0c5
--- /dev/null
@@ -0,0 +1,3 @@
+/etc/ipsec.conf
+/etc/ipsec.d/
+/etc/ipsec.secrets
diff --git a/net/openswan/patches/100-cross_compile.patch b/net/openswan/patches/100-cross_compile.patch
new file mode 100644 (file)
index 0000000..72bf8ef
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/programs/pluto/Makefile
++++ b/programs/pluto/Makefile
+@@ -66,10 +66,6 @@ CFLAGS+=-DALLOW_MICROSOFT_BAD_PROPOSAL
+ ALLFLAGS = $(CPPFLAGS) $(CFLAGS) ${CROSSFLAGS}
+-ifneq ($(LD_LIBRARY_PATH),)
+-LDFLAGS+=-L$(LD_LIBRARY_PATH)
+-endif
+-
+ LIBSADNS = $(OPENSWANLIB)
+ LIBSADNS += -lresolv # -lefence
+--- a/programs/Makefile.program
++++ b/programs/Makefile.program
+@@ -55,10 +55,6 @@ endif
+ CFLAGS+= ${WERROR}
+-ifneq ($(LD_LIBRARY_PATH),)
+-LDFLAGS=-L$(LD_LIBRARY_PATH)
+-endif
+-
+ ifeq ($(USE_DMALLOC),true)
+ CFLAGS+=-DDMALLOC
+ LIBS+= -ldmalloc
diff --git a/net/openswan/patches/120-no_manpages.patch b/net/openswan/patches/120-no_manpages.patch
new file mode 100644 (file)
index 0000000..258f503
--- /dev/null
@@ -0,0 +1,60 @@
+--- a/programs/_confread/Makefile
++++ b/programs/_confread/Makefile
+@@ -14,7 +14,6 @@
+ OPENSWANSRCDIR?=$(shell cd ../..; pwd)
+ include ${OPENSWANSRCDIR}/Makefile.inc
+-EXTRA5MAN=ipsec.conf.5
+ CONFFILES=ipsec.conf
+ EXCONFILES=ipsec.win2k.conf
+ SOURCEDIR=_confread
+@@ -24,11 +23,3 @@ CONFDFILES=clear clear-or-private privat
+ include ${srcdir}../Makefile.program
+-ipsec.conf.5: ${srcdir}ipsec.conf.5.xml
+-
+-${srcdir}ipsec.conf.5.xml: $(wildcard d.ipsec.conf/*.xml) ${srcdir}d.ipsec.conf/order.txt
+-      cd ${srcdir} && cat `cat ${srcdir}d.ipsec.conf/order.txt` >ipsec.conf.5.xml
+-
+-diff: ipsec.conf.5.xml
+-      diff -B -w -u ipsec.conf.5.xml ipsec.conf.5.xml-ref
+-
+--- a/programs/pluto/Makefile
++++ b/programs/pluto/Makefile
+@@ -200,35 +200,11 @@ doinstall: all
+       $(INSTALL) $(INSTBINFLAGS) $(BINNAMEPLUTO) $(BINNAMEWHACK) $(LIBEXECDIR)
+       #$(INSTALL) $(INSTSUIDFLAGS) $(BINNAMEWHACKINIT) $(LIBEXECDIR)
+       if $(USE_ADNS) ; then $(INSTALL) $(INSTBINFLAGS) $(BINNAMEADNS)  $(LIBEXECDIR) ; fi
+-      $(INSTALL) $(INSTMANFLAGS) ${srcdir}pluto.8 $(PMANDIR)/ipsec_pluto.8
+-      sh ${OPENSWANSRCDIR}/packaging/utils/manlink ${srcdir}pluto.8 | \
+-              while read from to ; \
+-              do \
+-                      ln -s -f ipsec_$$from $(PMANDIR)/$$to; \
+-              done
+-      $(INSTALL) $(INSTMANFLAGS) ${srcdir}ipsec.secrets.5 $(FMANDIR)
+-      sh ${OPENSWANSRCDIR}/packaging/utils/manlink ${srcdir}ipsec.secrets.5 | \
+-              while read from to ; \
+-              do \
+-               ln -s -f $$from $(FMANDIR)/$$to; \
+-              done
+ install_file_list:
+       @echo $(LIBEXECDIR)/$(BINNAMEPLUTO)
+       @if $(USE_ADNS) ; then echo $(LIBDIR)/$(BINNAMEADNS) ; fi
+       @echo $(LIBEXECDIR)/$(BINNAMEWHACK)
+-      @echo $(PMANDIR)/ipsec_pluto.8
+-      @sh ${OPENSWANSRCDIR}/packaging/utils/manlink pluto.8 | \
+-              while read from to; \
+-              do\
+-                       echo $(PMANDIR)/$$to; \
+-              done
+-      @echo $(FMANDIR)/ipsec.secrets.5
+-      @sh ${OPENSWANSRCDIR}/packaging/utils/manlink ipsec.secrets.5 | \
+-              while read from to; \
+-              do \
+-                      echo $(FMANDIR)/$$to; \
+-              done
+ alg_info_test: alg_info_test.o ike_alg.o constants.o defs.o log.o db_ops.o crypto.o $(LIBDESLITE) $(OPENSWANLIB)
+       $(CC) -o $@ $^ $(LDFLAGS) $(LIBSPLUTO)
diff --git a/net/p910nd/Makefile b/net/p910nd/Makefile
new file mode 100644 (file)
index 0000000..5ab61fe
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2009-2012 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:=p910nd
+PKG_VERSION:=0.95
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/p910nd
+PKG_MD5SUM:=c7ac6afdf7730ac8387a8e87198d4491
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/p910nd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Printing
+  TITLE:=A small non-spooling printer server
+  URL:=http://p910nd.sourceforge.net
+endef
+
+define Package/p910nd/conffiles
+/etc/config/p910nd
+endef
+
+define Package/p910nd/description
+ p910nd is a small daemon that copies any data received on
+ the port it is listening on to the corresponding printer
+ port. It is primarily intended for diskless Linux hosts
+ running as printer drivers but there is no reason why it
+ could not be used on diskful hosts. Port 9100 is copied
+ to /dev/lp0, 9101 to /dev/lp1 and 9102 to /dev/lp2. The
+ default is port 9100 to /dev/lp0.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -DLOCKFILE_DIR=\"\\\"/tmp\"\\\""
+
+define Package/p910nd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/p910nd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/p910nd.config $(1)/etc/config/p910nd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/p910nd.init $(1)/etc/init.d/p910nd
+endef
+
+$(eval $(call BuildPackage,p910nd))
diff --git a/net/p910nd/files/p910nd.config b/net/p910nd/files/p910nd.config
new file mode 100644 (file)
index 0000000..d509035
--- /dev/null
@@ -0,0 +1,5 @@
+config p910nd
+       option device        /dev/usb/lp0
+       option port          0
+       option bidirectional 1
+       option enabled       0
diff --git a/net/p910nd/files/p910nd.init b/net/p910nd/files/p910nd.init
new file mode 100644 (file)
index 0000000..8757551
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+START=50
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get_bool _val "$section" "$option" '0'
+       [ "$_val" -gt 0 ] && append args "$3"
+}
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3$_val"
+}
+
+start_service() {
+       local section="$1"
+       args=""
+
+       append_bool "$section" bidirectional "-b"
+       append_string "$section" device "-f "
+       append_string "$section" bind "-i "
+       append_string "$section" port ""
+       config_get_bool "enabled" "$section" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/sbin/p910nd $args
+}
+
+stop_service() {
+       local section="$1"
+       config_get port "$section" port
+
+       PID_F=/var/run/p910${port}d.pid
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
+
+start() {
+       config_load "p910nd"
+       config_foreach start_service p910nd
+}
+
+stop() {
+       config_load "p910nd"
+       config_foreach stop_service p910nd
+}
diff --git a/net/paris-traceroute/Makefile b/net/paris-traceroute/Makefile
new file mode 100644 (file)
index 0000000..01d90ad
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 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:=paris-traceroute
+PKG_VERSION:=0.92
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-dev.tar.gz
+PKG_SOURCE_URL:=http://www.paris-traceroute.net/downloads
+PKG_MD5SUM:=18643a62fdcabd038cdeb14b5cbedb8b
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-current
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/paris-traceroute
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Paris Traceroute
+  URL:=http://www.paris-traceroute.net/
+  DEPENDS:=+libpthread $(CXX_DEPENDS)
+endef
+
+define Package/paris-traceroute/description
+  Paris traceroute is a new version of the well-known network diagnosis and
+  measurement tool. It addresses problems caused by load balancers with the
+  initial implementation of traceroute.
+endef
+
+TARGET_LDFLAGS += -lm
+
+define Package/paris-traceroute/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/paris-traceroute \
+               $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,paris-traceroute))
diff --git a/net/parprouted/Makefile b/net/parprouted/Makefile
new file mode 100644 (file)
index 0000000..20d039f
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2006-2012 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:=parprouted
+PKG_VERSION:=0.70
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-0.7.tar.gz
+PKG_SOURCE_URL:=http://www.hazard.maks.net/parprouted/
+PKG_MD5SUM:=570f5deaf09600df8f80f589de79ecdb
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-0.7
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/parprouted
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  DEPENDS:=+libpthread
+  TITLE:=Proxy ARP daemon
+ URL:=http://www.hazard.maks.net/parprouted/
+endef
+
+define Package/parprouted/description
+       parprouted is a daemon for transparent IP (Layer 3) proxy ARP bridging.
+       This is useful for creation of transparent firewalls and bridging networks
+       with different MAC protocols. Also, unlike standard bridging, proxy ARP
+       bridging allows to bridge Ethernet networks behind wireless nodes without
+       using WDS or layer 2 bridging.
+
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               LDFLAGS="" \
+               all \
+       )
+endef
+
+define Package/parprouted/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/parprouted $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_BIN) ./files/parprouted.config $(1)/etc/config/parprouted
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/parprouted.init $(1)/etc/init.d/parprouted
+endef
+
+define Package/parprouted/conffiles
+/etc/config/parprouted
+endef
+
+$(eval $(call BuildPackage,parprouted))
diff --git a/net/parprouted/files/parprouted.config b/net/parprouted/files/parprouted.config
new file mode 100755 (executable)
index 0000000..cf726ce
--- /dev/null
@@ -0,0 +1,11 @@
+package 'parprouted'
+
+config 'parprouted'
+       option enabled 0
+
+       # make all ARP entries to be permanent
+       option permanent 0
+
+       # list interfaces to do bridging on
+       list interfaces 'lan'
+       list interfaces 'wan'
diff --git a/net/parprouted/files/parprouted.init b/net/parprouted/files/parprouted.init
new file mode 100644 (file)
index 0000000..a8a8ab7
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=50
+
+section_enabled() {
+       local enabled
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+append_interface() {
+       local name="$1"
+       local device
+       network_get_device device "$name"
+       append args "${device:-$name}"
+}
+
+start_instance() {
+       local section="$1"
+       local permanent
+       local interfaces
+       local args=""
+
+       section_enabled "$section" || return 1
+
+       config_get_bool permanent "$section" 'permanent' 0
+       [ $permanent -eq 0 ] || append args "-p"
+
+       config_list_foreach "$section" 'interfaces' append_interface
+
+       service_start /usr/sbin/parprouted $args
+}
+
+start() {
+       . /lib/functions/network.sh
+
+       config_load 'parprouted'
+       config_foreach start_instance 'parprouted'
+}
+
+stop() {
+       service_stop /usr/sbin/parprouted
+}
diff --git a/net/parprouted/patches/001-parprouted.patch b/net/parprouted/patches/001-parprouted.patch
new file mode 100644 (file)
index 0000000..7b84123
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/arp.c
++++ b/arp.c
+@@ -366,7 +366,7 @@ void *arp(char *ifname)
+     do {
+       pthread_testcancel();
+       /* Sleep a bit in order not to overload the system */
+-      usleep(300);
++      usleep(3000);
+       if (arp_recv(sock, &frame) <= 0)
+           continue;
+--- a/parprouted.c
++++ b/parprouted.c
+@@ -106,7 +106,7 @@ int route_remove(ARPTAB_ENTRY* cur_entry
+     int success = 1;
+     
+     if (snprintf(routecmd_str, ROUTE_CMD_LEN-1, 
+-          "/sbin/ip route del %s/32 metric 50 dev %s scope link",
++          "/sbin/route del -host %s metric 50 dev %s",
+           inet_ntoa(cur_entry->ipaddr_ia), cur_entry->ifname) > ROUTE_CMD_LEN-1) 
+     {
+       syslog(LOG_INFO, "ip route command too large to fit in buffer!");
+@@ -136,7 +136,7 @@ int route_add(ARPTAB_ENTRY* cur_entry)
+     int success = 1;
+     if (snprintf(routecmd_str, ROUTE_CMD_LEN-1, 
+-          "/sbin/ip route add %s/32 metric 50 dev %s scope link",
++          "/sbin/route add -host %s metric 50 dev %s",
+           inet_ntoa(cur_entry->ipaddr_ia), cur_entry->ifname) > ROUTE_CMD_LEN-1) 
+     {
+       syslog(LOG_INFO, "ip route command too large to fit in buffer!");
diff --git a/net/pdnsd/Makefile b/net/pdnsd/Makefile
new file mode 100644 (file)
index 0000000..3d75aa1
--- /dev/null
@@ -0,0 +1,55 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pdnsd
+PKG_VERSION:=1.2.9a-par
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://gitorious.org/pdnsd/pdnsd.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=a8e46ccba7b0fa2230d6c42ab6dcd92926f6c21d
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+# PKG_MIRROR_MD5SUM:=
+# CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pdnsd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  DEPENDS:=+libpthread
+  TITLE:=Proxy DNS Server
+endef
+
+define Package/pdnsd/description
+  pdnsd, is an IPv6 capable proxy DNS server with permanent caching (the cache
+  contents are written to hard disk on exit) that is designed to cope with
+  unreachable or down DNS servers (for example in dial-in networking).
+
+  pdnsd can be used with applications that do dns lookups, eg on startup, and
+  can't be configured to change that behaviour, to prevent the often
+  minute-long hangs (or even crashes) that result from stalled dns queries.
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+#TARGET_CFLAGS += -ggdb3
+
+CMAKE_OPTIONS += -DDEBUG=1
+
+CONFIGURE_ARGS += \
+               --with-cachedir=/var/pdnsd
+
+define Package/pdnsd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pdnsd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pdnsd-ctl/pdnsd-ctl $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pdnsd.init $(1)/etc/init.d/pdnsd
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/pdnsd.conf $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,pdnsd))
diff --git a/net/pdnsd/files/pdnsd.init b/net/pdnsd/files/pdnsd.init
new file mode 100644 (file)
index 0000000..e678d8d
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+NAME=pdnsd
+DESC="proxy DNS server"
+
+DAEMON=/usr/sbin/pdnsd
+PID_FILE=/var/run/$NAME.pid
+CACHEDIR=/var/pdnsd
+CACHE=$CACHEDIR/pdnsd.cache
+
+USER=nobody
+GROUP=nogroup
+
+start() {
+       echo -n "Starting $DESC: $NAME"
+
+       gen_cache
+
+       $DAEMON --daemon -p $PID_FILE
+       echo " ."
+}
+
+stop() {
+       echo -n "Stopping $DESC: $NAME"
+       kill `cat $PID_FILE` > /dev/null 2>&1
+       rm -rf $PID_FILE
+       echo " ."
+}
+
+restart() {
+       echo "Restarting $DESC: $NAME... "
+       stop
+       sleep 2
+       start
+}
+
+gen_cache()
+{
+       if ! test -f "$CACHE"; then
+               mkdir -p `dirname $CACHE`
+               dd if=/dev/zero of="$CACHE" bs=1 count=4 2> /dev/null
+               chown -R $USER.$GROUP $CACHEDIR
+       fi
+}
+                                                
diff --git a/net/peerguardian/Makefile b/net/peerguardian/Makefile
new file mode 100644 (file)
index 0000000..395f7bb
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006-2012 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:=peerguardian
+PKG_VERSION:=2.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=pgl-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/peerguardian
+PKG_MD5SUM:=
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/pgl-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/peerguardian
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=P2P
+  DEPENDS:=+libnetfilter-queue +zlib
+  TITLE:=PeerGuardian for Linux
+  URL:=http://phoenixlabs.org/
+endef
+
+define Package/peerguardian/description
+ PeerGuardian helps protect your privacy by blocking many ranges  of aggressive
+ IPs while you use P2P.
+endef
+
+define Package/peerguardian/conffiles
+/etc/PG.conf
+/etc/p2p.p2b.p2p
+endef
+
+CONFIGURE_ARGS += \
+       --enable-lowmem \
+       --without-qt4 \
+       --disable-dbus \
+       --disable-networkmanager \
+       --disable-cron
+
+define Package/peerguardian/install
+       $(INSTALL_DIR) $(1)/etc/
+       $(CP) $(PKG_INSTALL_DIR)/etc/pgl $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pglcmd $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pgld $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pgl $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/peerguardian.init $(1)/etc/init.d/peerguardian
+endef
+
+$(eval $(call BuildPackage,peerguardian))
diff --git a/net/peerguardian/files/peerguardian.init b/net/peerguardian/files/peerguardian.init
new file mode 100644 (file)
index 0000000..a17e1e9
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+CONTROL_MAIN="/usr/lib/pgl/pglcmd.main"
+BIN=pgctl
+
+start() {
+       $BIN $1
+}
+
diff --git a/net/peervpn/Makefile b/net/peervpn/Makefile
new file mode 100644 (file)
index 0000000..ff930e6
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2007-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:=peervpn
+PKG_VERSION:=0-036
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL :=http://www.peervpn.net/files
+PKG_MD5SUM:=38fe86fed7ec341887220626cd102ec1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/peervpn
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=VPN
+  TITLE:=PeerVPN the open source peer-to-peer VPN
+  URL:=http://www.peervpn.net/
+  DEPENDS:=+libopenssl +ip
+endef
+
+define Package/peervpn/description
+  PeerVPN is software that builds virtual ethernet networks between multiple
+  computers. Adding a new node to an existing network doesn't require the
+  existing nodes to alter their configuration, because its IP address is
+  automatically distributed across the whole virtual network.
+endef
+
+define Package/peervpn/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/peervpn $(1)/sbin/
+       $(INSTALL_DIR) $(1)/etc/peervpn
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/peervpn.conf $(1)/etc/peervpn
+endef
+
+$(eval $(call BuildPackage,peervpn))
diff --git a/net/pen/Makefile b/net/pen/Makefile
new file mode 100644 (file)
index 0000000..464e753
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pen
+PKG_VERSION:=0.18.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://siag.nu/pub/pen/
+PKG_MD5SUM:=96f6d39e7e7cca11a647e795550f3829
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pen
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl
+  TITLE:=Simple tcp load balancer
+  URL:=http://siag.nu/pen/
+endef
+
+define Package/pen/description
+       This is pen, a load balancer for "simple" tcp based protocols
+       such as http or smtp. It allows several servers to appear as
+       one to the outside and automatically detects servers that are
+       down and distributes clients among the available servers.
+       This gives high availability and scalable performance.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-poll \
+               --with-experimental-only-ssl="$(STAGING_DIR)/usr" \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/pen/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mergelogs $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pen $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/penctl $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/penctl.cgi $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/penlog $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/penlogd $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/penstats $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,pen))
diff --git a/net/pepperspot/Makefile b/net/pepperspot/Makefile
new file mode 100644 (file)
index 0000000..4f420f4
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2008-2012 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:=pepperspot
+PKG_VERSION:=0.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/pepperspot
+PKG_MD5SUM:=977ad2d376190daadd863509110acf09
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pepperspot
+  SUBMENU:=Captive Portals
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Wireless LAN HotSpot controller
+  URL:=http://pepperspot.sourceforge.net/
+  DEPENDS:=+kmod-tun +kmod-ipv6
+endef
+
+define Package/pepperspot/description
+  PepperSpot is a captive portal or wireless LAN access point controller
+  which support the IPv6 protocol. It supports web based login and it
+  supports Wireless Protected Access (WPA). Authentication is handled by
+  your favorite radius server (over IPv4/IPv6).
+endef
+
+define Package/pepperspot/conffiles
+/etc/pepper.conf
+endef
+
+# uses GNU configure
+
+define Build/Prepare
+$(call Build/Prepare/Default)
+       # prevent autoconf invocation, since one the patches touched
+       # configure
+       (cd $(PKG_BUILD_DIR); \
+               touch -r Makefile.am configure.in; \
+               touch -r Makefile.in configure; \
+       )
+endef
+
+define Package/pepperspot/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/pepper
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/extra/pepper.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pepper $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,pepperspot))
diff --git a/net/pepperspot/files/pepperspot.init b/net/pepperspot/files/pepperspot.init
new file mode 100644 (file)
index 0000000..a1d57a8
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2012 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+SERVICE_PID_FILE=/var/run/pepper.pid
+
+start() {
+       . /lib/functions/network.sh
+
+       local ipaddr
+       network_get_ipaddr ipaddr lan && \
+               service_start /usr/sbin/pepper --dns1="$ipaddr"
+}
+
+stop() {
+       service_stop /usr/sbin/pepper
+}
diff --git a/net/pepperspot/patches/101-cflags.patch b/net/pepperspot/patches/101-cflags.patch
new file mode 100644 (file)
index 0000000..2840eff
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure
++++ b/configure
+@@ -2815,8 +2815,6 @@ am__tar='${AMTAR} chof - "$$tardir"'; am
+ ac_config_headers="$ac_config_headers config.h"
+-CFLAGS=""
+-
+ # Checks for programs.
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+--- a/configure.in
++++ b/configure.in
+@@ -9,8 +9,6 @@ AM_INIT_AUTOMAKE
+ AM_CONFIG_HEADER([config.h])
+-CFLAGS=""
+-
+ # Checks for programs.
+ AC_PROG_CC
diff --git a/net/pepperspot/patches/102-no_warnings.patch b/net/pepperspot/patches/102-no_warnings.patch
new file mode 100644 (file)
index 0000000..2767ae0
--- /dev/null
@@ -0,0 +1,134 @@
+--- a/src/pepper.c
++++ b/src/pepper.c
+@@ -389,7 +389,7 @@ static int set_env(char *name, char *val
+   }
+   else if(mac != NULL)
+   {
+-    (void) snprintf(s, sizeof(s) - 1, "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X",
++    (void) snprintf(s, sizeof(s) - 1, "%.2hX-%.2hX-%.2hX-%.2hX-%.2hX-%.2hX",
+                     mac[0], mac[1],
+                     mac[2], mac[3],
+                     mac[4], mac[5]);
+@@ -447,7 +447,7 @@ static int set_envv6(char *name, char *v
+   }
+   else if(mac != NULL)
+   {
+-    (void) snprintf(s, sizeof(s) - 1, "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X",
++    (void) snprintf(s, sizeof(s) - 1, "%.2hX-%.2hX-%.2hX-%.2hX-%.2hX-%.2hX",
+                     mac[0], mac[1],
+                     mac[2], mac[3],
+                     mac[4], mac[5]);
+@@ -958,7 +958,7 @@ static int set_macallowed(char *macallow
+     for(i = 0; i < strlen(p1); i++)
+       if(!isxdigit(p1[i])) p1[i] = 0x20;
+-    if(sscanf(p1, "%2x %2x %2x %2x %2x %2x",
++    if(sscanf(p1, "%2hhx %2hhx %2hhx %2hhx %2hhx %2hhx",
+                 &options.macok[options.macoklen][0],
+                 &options.macok[options.macoklen][1],
+                 &options.macok[options.macoklen][2],
+@@ -973,7 +973,7 @@ static int set_macallowed(char *macallow
+     }
+     if(options.debug & DEBUG_CONF)
+     {
+-      printf("Macallowed address #%d: %.2X-%.2X-%.2X-%.2X-%.2X-%.2X\n",
++      printf("Macallowed address #%d: %.2hhX-%.2hhX-%.2hhX-%.2hhX-%.2hhX-%.2hhX\n",
+              options.macoklen,
+              options.macok[options.macoklen][0],
+              options.macok[options.macoklen][1],
+--- a/src/redir.c
++++ b/src/redir.c
+@@ -178,7 +178,7 @@ static int redir_hextochar(char *src, in
+ {
+   char x[3];
+   int n = 0;
+-  int y = 0;
++  unsigned int y = 0;
+   int nb = len / 2;
+   for(n = 0 ; n < nb ; n++)
+--- a/src/radius.c
++++ b/src/radius.c
+@@ -971,7 +971,7 @@ int radius_getattr(struct radius_packet_
+       }
+       offset +=  t->l;
+     }
+-    while(offset < (ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
++    while(offset < ((int)ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
+   }
+   else       /* Need to check pack -> length */
+   {
+@@ -992,7 +992,7 @@ int radius_getattr(struct radius_packet_
+       }
+       offset +=  t->l;
+     }
+-    while(offset < (ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
++    while(offset < ((int)ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
+   }
+   return -1; /* Not found */
+@@ -1040,7 +1040,7 @@ int radius_getattrv6(struct radius_packe
+       }
+       offset +=  t->l;
+     }
+-    while(offset < (ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
++    while(offset < ((int)ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
+   }
+   else       /* Need to check pack -> length */
+   {
+@@ -1061,7 +1061,7 @@ int radius_getattrv6(struct radius_packe
+       }
+       offset +=  t->l;
+     }
+-    while(offset < (ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
++    while(offset < ((int)ntohs(pack->length) - RADIUS_HDRSIZE)); /* TODO */
+   }
+   return -1; /* Not found */
+@@ -1090,7 +1090,7 @@ int radius_getattrv6(struct radius_packe
+     }
+     offset +=  2 + t->l;
+   }
+-  while(offset < ntohs(pack->length));
++  while(offset < (int)ntohs(pack->length));
+   if(0) printf("Count %d\n", count);
+   return count;
+@@ -1903,7 +1903,7 @@ int radius_decaps(struct radius_t *this)
+     return -1;
+   }
+-  if(ntohs(pack.length) != status)
++  if((int)ntohs(pack.length) != status)
+   {
+     sys_err(LOG_WARNING, __FILE__, __LINE__, errno,
+             "Received radius packet with wrong length field %d != %d!",
+@@ -2107,7 +2107,7 @@ int radius_proxy_ind(struct radius_t *th
+     return -1;
+   }
+-  if(ntohs(pack.length) != status)
++  if((int)ntohs(pack.length) != status)
+   {
+     sys_err(LOG_WARNING, __FILE__, __LINE__, 0,
+             "Received radius packet with wrong length field %d != %d!",
+--- a/src/dhcp.c
++++ b/src/dhcp.c
+@@ -240,7 +240,7 @@ static int dhcp_tcp_checkv6(struct dhcp_
+   struct dhcp_tcphdr_t *tcph = NULL;
+   int tcp_len = 0;
+-  if(ntohs(pack->ip6h.payload_length) > (length - DHCP_ETH_HLEN))
++  if((int)ntohs(pack->ip6h.payload_length) > (length - DHCP_ETH_HLEN))
+     return -1; /* Wrong length of packet */
+   tcp_len = ntohs(pack->ip6h.payload_length);
+@@ -347,7 +347,7 @@ static int dhcp_tcp_check(struct dhcp_ip
+   struct dhcp_tcphdr_t *tcph;
+   int tcp_len = 0;
+-  if(ntohs(pack->iph.tot_len) > (length - DHCP_ETH_HLEN))
++  if((int)ntohs(pack->iph.tot_len) > (length - DHCP_ETH_HLEN))
+     return -1; /* Wrong length of packet */
+   tcp_len = ntohs(pack->iph.tot_len) - pack->iph.ihl * 4;
diff --git a/net/pepperspot/patches/110-fix-compile.patch b/net/pepperspot/patches/110-fix-compile.patch
new file mode 100644 (file)
index 0000000..6606f6b
--- /dev/null
@@ -0,0 +1,247 @@
+--- a/src/cmdline.c
++++ b/src/cmdline.c
+@@ -1335,7 +1335,7 @@ cmdline_parser_required (struct gengetop
+ #endif
+ int
+-cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error)
++cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required __attribute__((__unused__)), const char *additional_error)
+ {
+   int c;  /* Character of the parsed option.  */
+   char *multi_token, *multi_next; /* for multiple options */
+--- a/src/ippool.c
++++ b/src/ippool.c
+@@ -267,7 +267,7 @@ void ippool_getv6suffix(struct in6_addr
+ /* Get IP address and mask */
+ int ippool_aton(struct in_addr *addr, struct in_addr *mask,
+-                char *pool, int number)
++                char *pool, int number __attribute__((__unused__)))
+ {
+   /* Parse only first instance of network for now */
+   /* Eventually "number" will indicate the token which we want to parse */
+--- a/src/pepper.c
++++ b/src/pepper.c
+@@ -3305,7 +3305,7 @@ static int dnprot_accept(struct app_conn
+  * \return 0
+  * \author Sebastien Vincent
+  */
+-static int cb_tun6_ind(struct tun6_t* tun_obj, void* pack, unsigned len)
++static int cb_tun6_ind(struct tun6_t* tun_obj __attribute__((__unused__)), void* pack, unsigned len)
+ {
+   struct ippoolm_t* ipm = NULL;
+   struct in6_addr dst;
+@@ -3377,7 +3377,7 @@ static int cb_tun6_ind(struct tun6_t* tu
+  * \param len data length
+  * \return 0
+  */
+-int cb_tun_ind(struct tun_t *tun_obj, void *pack, unsigned len)
++int cb_tun_ind(struct tun_t *tun_obj __attribute__((__unused__)), void *pack, unsigned len)
+ {
+   struct ippoolm_t *ipm = NULL;
+   struct in_addr dst;
+@@ -3459,7 +3459,7 @@ int cb_tun_ind(struct tun_t *tun_obj, vo
+  * \param conn redir connection that we will filled up up-to-date value
+  * \return 0 if success, -1 otherwise
+  */
+-static int cb_redir_getstate(struct redir_t *redir_obj, struct in_addr *addr,
++static int cb_redir_getstate(struct redir_t *redir_obj __attribute__((__unused__)), struct in_addr *addr,
+                              struct redir_conn_t *conn)
+ {
+   struct ippoolm_t *ipm = NULL;
+@@ -3524,7 +3524,7 @@ static int cb_redir_getstate(struct redi
+  * \param conn redir connection that we will filled up up-to-date value
+  * \return 0 if success, -1 otherwise
+  */
+-static int cb_redir_getstatev6(struct redir_t* redir_obj, struct in6_addr* addr, struct redir_conn_t* conn)
++static int cb_redir_getstatev6(struct redir_t* redir_obj __attribute__((__unused__)), struct in6_addr* addr, struct redir_conn_t* conn)
+ {
+   struct ippoolm_t *ipm = NULL;
+   struct app_conn_t *appconn = NULL;
+@@ -4354,9 +4354,9 @@ int upprot_getipv6(struct app_conn_t *ap
+  * \param pack_req packet for request
+  * \return 0 if success, -1 otherwise
+  */
+-int radius_conf(struct radius_t *radius_obj,
++int radius_conf(struct radius_t *radius_obj __attribute__((__unused__)),
+                 struct radius_packet_t *pack,
+-                struct radius_packet_t *pack_req)
++                struct radius_packet_t *pack_req __attribute__((__unused__)))
+ {
+   struct radius_attr_t *attr = NULL;
+--- a/src/tun.c
++++ b/src/tun.c
+@@ -226,7 +226,7 @@ int tun_addaddr(struct tun_t *this,
+   struct sockaddr_nl local;
+   int addr_len = 0;
+   int fd = -1;
+-  int status = 0;
++  int status __attribute__((__unused__)) = 0;
+   struct sockaddr_nl nladdr;
+   struct iovec iov;
+@@ -507,7 +507,7 @@ int tun_setaddr(struct tun_t *this,
+  * \param delete 1 = delete route, 0 = add route
+  * \return 0 if success, -1 otherwise
+  */
+-static int tun_route(struct tun_t *this,
++static int tun_route(struct tun_t *this __attribute__((__unused__)),
+                      struct in_addr *dst,
+                      struct in_addr *gateway,
+                      struct in_addr *mask,
+--- a/src/dhcp.c
++++ b/src/dhcp.c
+@@ -2111,7 +2111,7 @@ int dhcp_timeout(struct dhcp_t *this)
+   return 0;
+ }
+-struct timeval* dhcp_timeleft(struct dhcp_t *this, struct timeval *tvp)
++struct timeval* dhcp_timeleft(struct dhcp_t *this __attribute__((__unused__)), struct timeval *tvp)
+ {
+   /* To avoid unused parameter warning */
+   this = NULL;
+@@ -2640,7 +2640,7 @@ static int dhcp_gettag(struct dhcp_packe
+  * \return 0 if success, -1 otherwise4
+  */
+ static int dhcp_sendOFFER(struct dhcp_conn_t *conn,
+-                          struct dhcp_fullpacket_t *pack, int len)
++                          struct dhcp_fullpacket_t *pack, int len __attribute__((__unused__)))
+ {
+   struct dhcp_t *this = conn->parent;
+   struct dhcp_fullpacket_t packet;
+@@ -2762,7 +2762,7 @@ static int dhcp_sendOFFER(struct dhcp_co
+  * \return 0 if success, -1 otherwise
+  */
+ static int dhcp_sendACK(struct dhcp_conn_t *conn,
+-                        struct dhcp_fullpacket_t *pack, int len)
++                        struct dhcp_fullpacket_t *pack, int len __attribute__((__unused__)))
+ {
+   struct dhcp_t *this = conn->parent;
+   struct dhcp_fullpacket_t packet;
+@@ -2895,7 +2895,7 @@ static int dhcp_sendACK(struct dhcp_conn
+  * \return 0 if success, -1 otherwise
+  */
+ static int dhcp_sendNAK(struct dhcp_conn_t *conn,
+-                        struct dhcp_fullpacket_t *pack, int len)
++                        struct dhcp_fullpacket_t *pack, int len __attribute__((__unused__)))
+ {
+   struct dhcp_t *this = conn->parent;
+   struct dhcp_fullpacket_t packet;
+@@ -3496,7 +3496,7 @@ int dhcp_data_req(struct dhcp_conn_t *co
+  * \return 0
+  */
+ static int dhcp_sendARP(struct dhcp_conn_t *conn,
+-                        struct dhcp_arp_fullpacket_t *pack, int len)
++                        struct dhcp_arp_fullpacket_t *pack, int len __attribute__((__unused__)))
+ {
+   struct dhcp_t *this = conn->parent;
+   struct dhcp_arp_fullpacket_t packet;
+--- a/src/radius.c
++++ b/src/radius.c
+@@ -210,7 +210,7 @@ static int radius_acctreq_authenticator(
+  * \param secretlen length of secret
+  * \return 0
+  */
+-static int radius_authresp_authenticator(struct radius_t *this,
++static int radius_authresp_authenticator(struct radius_t *this __attribute__((__unused__)),
+                                   struct radius_packet_t *pack,
+                                   uint8_t *req_auth,
+                                   char *secret, int secretlen)
+@@ -801,7 +801,7 @@ int radius_addattr(struct radius_t *this
+   return 0;
+ }
+-int radius_addattrv6(struct radius_t *this, struct radius_packet_t *pack,
++int radius_addattrv6(struct radius_t *this __attribute__((__unused__)), struct radius_packet_t *pack,
+                  uint8_t type, uint32_t vendor_id, uint8_t vendor_type,
+                  struct in6_addr value, uint8_t *data, uint16_t dlen)
+ {
+@@ -1124,7 +1124,7 @@ int radius_getattrv6(struct radius_packe
+   return 0;
+ }
+-int radius_keydecode(struct radius_t *this, uint8_t *dst, int dstsize,
++int radius_keydecode(struct radius_t *this __attribute__((__unused__)), uint8_t *dst, int dstsize,
+                      int *dstlen, uint8_t *src, int srclen,
+                      uint8_t *authenticator, char *secret, int secretlen)
+ {
+@@ -1346,7 +1346,7 @@ int radius_pwdecode(struct radius_t *thi
+   return 0;
+ }
+-int radius_pwencode(struct radius_t *this, uint8_t *dst, int dstsize,
++int radius_pwencode(struct radius_t *this __attribute__((__unused__)), uint8_t *dst, int dstsize,
+                     int *dstlen, uint8_t *src, int srclen,
+                     uint8_t *authenticator, char *secret, int secretlen)
+ {
+--- a/src/redir.c
++++ b/src/redir.c
+@@ -974,7 +974,7 @@ void redir_set(struct redir_t *redir, in
+  * \param dstsize size of dst
+  * \return 0 if success, -1 otherwise
+  */
+-static int redir_getpath(struct redir_t *redir, char *src, char *dst, int dstsize)
++static int redir_getpath(struct redir_t *redir __attribute__((__unused__)), char *src, char *dst, int dstsize)
+ {
+   char *p1 = NULL;
+   char *p2 = NULL;
+@@ -1045,7 +1045,7 @@ static int redir_getpath(struct redir_t
+ /**
+  * \brief Get the url of an HTTP request.
+  */
+-static int redir_geturl(struct redir_t *redir, char *src, char *dst, int dstsize)
++static int redir_geturl(struct redir_t *redir __attribute__((__unused__)), char *src, char *dst, int dstsize)
+ {
+   char *p1 = NULL;
+   char *p3 = NULL;
+@@ -1128,7 +1128,7 @@ static int redir_geturl(struct redir_t *
+  * \return 0 if found, -1 otherwise (not found, malformed HTTP response)
+  */
+ /* TODO: Should be merged with other parsers */
+-static int redir_getparam(struct redir_t *redir, char *src,
++static int redir_getparam(struct redir_t *redir __attribute__((__unused__)), char *src,
+                           char *param,
+                           char *dst, int dstsize)
+ {
+@@ -1362,9 +1362,9 @@ static int redir_getreq(struct redir_t *
+  * \param cbp pointer for callback
+  * \return 0
+  */
+-static int redir_cb_radius_auth_conf(struct radius_t *radius,
++static int redir_cb_radius_auth_conf(struct radius_t *radius __attribute__((__unused__)),
+                                      struct radius_packet_t *pack,
+-                                     struct radius_packet_t *pack_req, void *cbp)
++                                     struct radius_packet_t *pack_req __attribute__((__unused__)), void *cbp)
+ {
+   struct radius_attr_t *interimattr = NULL;
+   struct radius_attr_t *stateattr = NULL;
+@@ -1696,7 +1696,7 @@ static int redir_cb_radius_auth_conf(str
+  * \param conn redir connection
+  * \return 0 if success, -1 otherwise
+  */
+-static int redir_radius(struct redir_t *redir, struct sockaddr_storage *addr,
++static int redir_radius(struct redir_t *redir, struct sockaddr_storage *addr __attribute__((__unused__)),
+                         struct redir_conn_t *conn)
+ {
+   struct radius_t *radius = NULL;      /* Radius client instance */
+--- a/src/tun6.c
++++ b/src/tun6.c
+@@ -1080,7 +1080,7 @@ int tun6_setaddr(struct tun6_t *this, st
+   return code;
+ }
+-int tun6_addroute(struct tun6_t *this, struct in6_addr *dst, struct in6_addr *gateway, uint8_t prefixlen)
++int tun6_addroute(struct tun6_t *this __attribute__((__unused__)), struct in6_addr *dst __attribute__((__unused__)), struct in6_addr *gateway __attribute__((__unused__)), uint8_t prefixlen __attribute__((__unused__)))
+ {
+   /* TODO : use _iface_route */
+   this = NULL;
+@@ -1096,7 +1096,7 @@ int tun6_set_cb_ind(struct tun6_t *this,
+   return 0;
+ }
+-int tun6_runscript(struct tun6_t *tun, char* script)
++int tun6_runscript(struct tun6_t *tun __attribute__((__unused__)), char* script __attribute__((__unused__)))
+ {
+   /* TODO */
+   tun = NULL;
diff --git a/net/pepsal/Makefile b/net/pepsal/Makefile
new file mode 100644 (file)
index 0000000..3f44f29
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006-2010 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:=pepsal
+PKG_VERSION:=1.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=5107f0b922716276e8493b26b80fb4b6
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pepsal
+  TITLE:=Performance Enhancing Proxy
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  URL:=http://pepsal.sourceforge.net/
+  DEPENDS:=+libnetfilter-queue
+endef
+
+define Package/pepsal/description
+ PEPsal is an integrated, multi-layer, transparent TCP Performance Enhancing
+ Proxy which splits the connection into two parts, making use of Linux TCP
+ enhancements when sending data, and largely improving performance in
+ links with different characteristics
+endef
+
+
+define Package/pepsal/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/pepsal $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,pepsal))
diff --git a/net/portsentry/Makefile b/net/portsentry/Makefile
new file mode 100644 (file)
index 0000000..ed0cf15
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2007-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:=portsentry
+PKG_VERSION:=1.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-1.2.tar.gz
+PKG_SOURCE_URL:=@SF/sentrytools
+PKG_MD5SUM:=3ebd3618ba9abfea2525e236bd44cebd
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_beta
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/portsentry
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall
+  TITLE:=Portscan protection utility
+  URL:=http://sourceforge.net/projects/sentrytools
+endef
+
+define Package/portsentry/conffiles
+/etc/portsentry.conf
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -DNODAEMON" \
+       linux \
+
+define Package/portsentry/install      
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/portsentry $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/portsentry.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/portsentry.init $(1)/etc/init.d/portsentry
+       $(SED) 's|^\(.*_FILE\)="/usr/local/psionic/\(portsentry/.*\)"|\1="/var/run/\2"|g' \
+            $(1)/etc/portsentry.conf
+endef
+
+$(eval $(call BuildPackage,portsentry))
diff --git a/net/portsentry/files/portsentry.init b/net/portsentry/files/portsentry.init
new file mode 100644 (file)
index 0000000..03e8835
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2011 OpenWrt.org
+
+START=99
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start() {
+       mkdir -m 0755 -p /var/run/portsentry
+       SERVICE_PID_FILE="/var/run/portsentry-atcp.pid" \
+       service_start /usr/bin/portsentry -atcp
+       SERVICE_PID_FILE="/var/run/portsentry-audp.pid" \
+       service_start /usr/bin/portsentry -audp
+}
+
+stop() {
+       SERVICE_PID_FILE="/var/run/portsentry-atcp.pid" \
+       service_stop /usr/bin/portsentry
+       SERVICE_PID_FILE="/var/run/portsentry-audp.pid" \
+       service_stop /usr/bin/portsentry
+}
diff --git a/net/portsentry/patches/100-conf_location.patch b/net/portsentry/patches/100-conf_location.patch
new file mode 100644 (file)
index 0000000..d644825
--- /dev/null
@@ -0,0 +1,13 @@
+Index: portsentry_beta/portsentry_config.h
+===================================================================
+--- portsentry_beta.orig/portsentry_config.h   2007-09-20 17:30:32.000000000 +0200
++++ portsentry_beta/portsentry_config.h        2007-09-20 17:30:32.000000000 +0200
+@@ -22,7 +22,7 @@
+ /* These are probably ok. Be sure you change the Makefile if you */
+ /* change the path */
+-#define CONFIG_FILE "/usr/local/psionic/portsentry/portsentry.conf"
++#define CONFIG_FILE "/etc/portsentry.conf"
+ /* The location of Wietse Venema's TCP Wrapper hosts.deny file */
+ #define WRAPPER_HOSTS_DENY "/etc/hosts.deny"
diff --git a/net/portsentry/patches/101-postsentry_c.patch b/net/portsentry/patches/101-postsentry_c.patch
new file mode 100644 (file)
index 0000000..51374bd
--- /dev/null
@@ -0,0 +1,14 @@
+Index: portsentry_beta/portsentry.c
+===================================================================
+--- portsentry_beta.orig/portsentry.c  2007-09-20 17:30:32.000000000 +0200
++++ portsentry_beta/portsentry.c       2007-09-20 17:30:32.000000000 +0200
+@@ -1581,8 +1581,7 @@
+ Usage (void)
+ {
+   printf ("PortSentry - Port Scan Detector.\n");
+-  printf ("Copyright 1997-2003 Craig H. Rowland <craigrowland at users dot 
+-sourceforget dot net>\n");
++  printf ("Copyright 1997-2003 Craig H. Rowland <craigrowland at users dot sourceforget dot net>\n");
+   printf ("Licensing restrictions apply. Please see documentation\n");
+   printf ("Version: %s\n\n", VERSION);
+ #ifdef SUPPORT_STEALTH
diff --git a/net/pptpd/Makefile b/net/pptpd/Makefile
new file mode 100644 (file)
index 0000000..2a44c7c
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2006-2014 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:=pptpd
+PKG_VERSION:=1.4.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/poptop
+PKG_MD5SUM:=36f9f45c6ffa92bc3b6e24ae2d053505
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pptpd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-ppp +kmod-gre +kmod-mppe +ppp
+  TITLE:=PopTop pptp server
+  URL:=http://www.poptop.org/
+  SUBMENU:=VPN
+endef
+
+CONFIGURE_ARGS += \
+       --enable-bcrelay \
+
+CONFIGURE_VARS += \
+       ac_cv_header_libintl_h=no \
+
+MAKE_FLAGS += \
+       COPTS="$(TARGET_CFLAGS)" \
+       INSTALL="install" \
+
+define Package/pptpd/conffiles
+/etc/pptpd.conf
+/etc/ppp/options.pptpd
+/etc/config/pptpd
+endef
+
+define Package/pptpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/sbin/bcrelay \
+               $(PKG_INSTALL_DIR)/usr/sbin/pptpctrl \
+               $(PKG_INSTALL_DIR)/usr/sbin/pptpd \
+               $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/pptpd
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pptpd/* $(1)/usr/lib/pptpd/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/pptpd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd
+       $(INSTALL_DIR) $(1)/etc/ppp
+       $(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/pptpd.config $(1)/etc/config/pptpd
+endef
+
+$(eval $(call BuildPackage,pptpd))
diff --git a/net/pptpd/files/options.pptpd b/net/pptpd/files/options.pptpd
new file mode 100644 (file)
index 0000000..f73eeea
--- /dev/null
@@ -0,0 +1,22 @@
+#debug
+#logfile /tmp/pptp-server.log
+auth
+name "pptp-server"
+lcp-echo-failure 3
+lcp-echo-interval 60
+default-asyncmap
+mtu 1482
+mru 1482
+nobsdcomp
+nodeflate
+#noproxyarp
+#nomppc
+mppe required,no40,no56,stateless
+require-mschap-v2
+refuse-chap
+refuse-mschap
+refuse-eap
+refuse-pap
+#ms-dns 172.16.1.1
+#plugin radius.so
+#radius-config-file /etc/radius.conf
diff --git a/net/pptpd/files/pptpd.conf b/net/pptpd/files/pptpd.conf
new file mode 100644 (file)
index 0000000..354745f
--- /dev/null
@@ -0,0 +1,5 @@
+#debug
+option /etc/ppp/options.pptpd
+speed 115200
+stimeout 10
+#localip & remoteip are not needed, ip management is done by pppd
diff --git a/net/pptpd/files/pptpd.config b/net/pptpd/files/pptpd.config
new file mode 100644 (file)
index 0000000..b2d5df5
--- /dev/null
@@ -0,0 +1,8 @@
+config service 'pptpd'
+       option 'enabled' '0'
+       option 'localip' '192.168.0.1'
+       option 'remoteip' '192.168.0.20-30'
+
+config 'login'
+       option 'username' 'youruser'
+       option 'password' 'yourpass'
diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init
new file mode 100644 (file)
index 0000000..0d0639f
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=60
+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
+
+setup_login() {
+       local section="$1"
+
+       config_get username "$section" username
+       config_get password "$section" password
+       [ -n "$username" ] || return 0
+       [ -n "$password" ] || return 0
+
+       echo "$username pptp-server $password *" >> $CHAP_SECRETS
+}
+
+setup_config() {
+       local section="$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
+}
+
+start() {
+       config_load pptpd
+       setup_config pptpd || return
+       config_foreach setup_login login
+       start_pptpd
+}
+
+stop() {
+       service_stop $BIN
+}
diff --git a/net/pptpd/patches/001-bad_pqueue_debug.patch b/net/pptpd/patches/001-bad_pqueue_debug.patch
new file mode 100644 (file)
index 0000000..50d5252
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/pqueue.c
++++ b/pqueue.c
+@@ -7,13 +7,11 @@
+ #include "pqueue.h"
+ #ifdef DEBUG_PQUEUE
+-#define DEBUG_ON 1
++#define DEBUG_CMD(_a) { _a }
+ #else
+-#define DEBUG_ON 0
++#define DEBUG_CMD(_a)
+ #endif
+-#define DEBUG_CMD(_a) if (DEBUG_ON) { _a }
+-
+ #define MIN_CAPACITY 128 /* min allocated buffer for a packet */
+ static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new);
diff --git a/net/pptpd/patches/002-makefile_fix.patch b/net/pptpd/patches/002-makefile_fix.patch
new file mode 100644 (file)
index 0000000..74e3335
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/plugins/Makefile
++++ b/plugins/Makefile
+@@ -18,7 +18,7 @@ all: $(PLUGINS)
+ %.so: %.c
+       $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^ $(LDADD)
+-LIBDIR        ?= $(DESTDIR)$(prefix)/lib/pptpd
++LIBDIR        = $(DESTDIR)$(prefix)/lib/pptpd
+ install: $(PLUGINS)
+       $(INSTALL) -d $(LIBDIR)
diff --git a/net/pptpd/patches/003-opt_flags.patch b/net/pptpd/patches/003-opt_flags.patch
new file mode 100644 (file)
index 0000000..cc136c5
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -153,7 +153,7 @@ AUTOMAKE = @AUTOMAKE@
+ AWK = @AWK@
+ CC = @CC@
+ CCDEPMODE = @CCDEPMODE@
+-CFLAGS = -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
++CFLAGS = $(COPTS) -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
+ CPP = @CPP@
+ CPPFLAGS = @CPPFLAGS@
+ CYGPATH_W = @CYGPATH_W@
diff --git a/net/privoxy/Makefile b/net/privoxy/Makefile
new file mode 100644 (file)
index 0000000..7257d1f
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2006-2013 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:=privoxy
+PKG_VERSION:=3.0.21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-stable-src.tar.gz
+PKG_SOURCE_URL:=@SF/ijbswa
+PKG_MD5SUM:=79558f2545cfcf9731f7de611646d837
+
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-stable
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/privoxy
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  DEPENDS:=+libpcre +libpthread +zlib
+  TITLE:=web proxy with advanced filtering capabilities
+  URL:=http://www.privoxy.org/
+endef
+
+define Package/privoxy/description
+       Privoxy is a web proxy with advanced filtering capabilities for
+       protecting privacy, modifying web page content, managing cookies,
+       controlling access, and removing ads, banners, pop-ups and other
+       obnoxious Internet junk. Privoxy has a very flexible configuration
+       and can be customized to suit individual needs and tastes. Privoxy
+       has application for both stand-alone systems and multi-user networks.
+endef
+
+CONFIGURE_ARGS += \
+       --sysconfdir=/etc/privoxy \
+
+MAKE_FLAGS :=
+
+define Package/privoxy/conffiles
+/etc/privoxy/config
+endef
+
+define Package/privoxy/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/privoxy $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/privoxy
+       $(CP) $(PKG_INSTALL_DIR)/etc/privoxy/* $(1)/etc/privoxy/
+       $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/privoxy/config
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
+endef
+
+$(eval $(call BuildPackage,privoxy))
diff --git a/net/privoxy/files/privoxy.config b/net/privoxy/files/privoxy.config
new file mode 100644 (file)
index 0000000..7f0b8af
--- /dev/null
@@ -0,0 +1,27 @@
+confdir /etc/privoxy
+logdir /var/log
+filterfile default.filter
+logfile privoxy
+actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.
+actionsfile default.action   # Main actions file
+#actionsfile user.action      # User customizations
+listen-address  127.0.0.1:8118
+toggle  1
+enable-remote-toggle  1
+enable-remote-http-toggle  0
+enable-edit-actions 1
+enforce-blocks 0
+buffer-limit 4096
+forwarded-connect-retries  0
+accept-intercepted-requests 0
+allow-cgi-request-crunching 0
+split-large-forms 0
+keep-alive-timeout 300
+socket-timeout 300
+permit-access  192.168.1.0/24
+debug   1    # show each GET/POST/CONNECT request
+debug   4096 # Startup banner and warnings
+debug   8192 # Errors - *we highly recommended enabling this*
+#admin-address privoxy-admin@example.com
+#proxy-info-url http://www.example.com/proxy-service.html
+
diff --git a/net/privoxy/files/privoxy.init b/net/privoxy/files/privoxy.init
new file mode 100644 (file)
index 0000000..78c29b4
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=80
+STOP=80
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/privoxy --pidfile /var/run/privoxy.pid \
+                                       /etc/privoxy/config
+}
+
+stop() {
+       service_stop /usr/sbin/privoxy
+}
diff --git a/net/proftpd/Makefile b/net/proftpd/Makefile
new file mode 100644 (file)
index 0000000..dff7233
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2009-2014 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:=proftpd
+PKG_VERSION:=1.3.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.proftpd.org/distrib/source
+PKG_MD5SUM:=aff1bff40e675244d72c4667f203e5bb
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/proftpd
+  SUBMENU:=File Transfer
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=ProFTPD FTP server
+  URL:=http://www.proftpd.org/
+  MAINTAINER:=Cezary Jackiewicz <cezary@eko.one.pl>
+endef
+
+define Package/proftpd/conffiles
+/etc/proftpd.conf
+endef
+
+TARGET_CPPFLAGS += \
+       -I$(LINUX_DIR)/include
+
+MAKE_FLAGS += \
+       INSTALL_USER=$(shell id -u) \
+       INSTALL_GROUP=$(shell id -g)
+
+CONFIGURE_ARGS += \
+       --disable-cap \
+       --enable-devel \
+       --disable-auth-pam \
+       ac_cv_header_curses_h=no \
+       ac_cv_header_ncurses_h=no
+
+define Package/proftpd/install
+       $(INSTALL_DIR) $(1)/etc
+       $(if $(CONFIG_IPV6),,$(SED) 's/^UseIPv6/#UseIPv6/' $(PKG_INSTALL_DIR)/etc/proftpd.conf)
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/proftpd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/proftpd.init $(1)/etc/init.d/proftpd
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ftp{count,top,who} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{ftpshut,proftpd} $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/in.proftpd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,proftpd))
diff --git a/net/proftpd/files/proftpd.init b/net/proftpd/files/proftpd.init
new file mode 100644 (file)
index 0000000..b92dc38
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010 OpenWrt.org
+
+START=50
+
+BIN=/usr/sbin/proftpd
+HOME=/home/ftp
+RUN_D=/var
+PID_F=$RUN_D/proftpd.pid
+RUN_USER=ftp
+RUN_GROUP=$RUN_USER
+
+EXTRA_COMMANDS="suspend resume"
+EXTRA_HELP="   suspend Suspend the service
+       resume  Resume the service"
+
+start() {
+       [ -d $HOME ] || ( mkdir -p $HOME && chown $RUN_USER:$RUN_GROUP $HOME )
+
+       [ ! -f $PID_F ] && $BIN
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
+
+reload() {
+       [ -f $PID_F ] && kill -HUP $(cat $PID_F)
+}
+
+suspend() {
+       echo "Suspending NOW"
+       ftpshut now "Maintenance in progress"
+}
+
+resume() {
+       [ -f /etc/shutmsg ] && {
+               echo "Allowing sessions again"
+               ftpshut -R > /dev/null
+       }
+}
diff --git a/net/proftpd/patches/001-automake-compat.patch b/net/proftpd/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..df01bdf
--- /dev/null
@@ -0,0 +1,145 @@
+--- a/configure.in
++++ b/configure.in
+@@ -40,8 +40,8 @@ if test "$OSTYPE" = "$OSREL" ; then
+   platform="\"$ostype\""
+ fi
+-AC_DEFINE_UNQUOTED(PR_BUILD_OPTS, "`echo "$ac_configure_args"`")
+-AC_DEFINE_UNQUOTED(PR_PLATFORM, $platform)
++AC_DEFINE_UNQUOTED(PR_BUILD_OPTS, "`echo "$ac_configure_args"`", [.])
++AC_DEFINE_UNQUOTED(PR_PLATFORM, $platform, [.])
+ AC_SUBST(OSREL)
+ AC_SUBST(OSTYPE)
+@@ -278,7 +278,7 @@ AC_ARG_WITH(lastlog,
+       fi
+       if test -n "$pr_lastlog_path" ; then
+-        AC_DEFINE_UNQUOTED(PR_LASTLOG_PATH, "`eval echo "$pr_lastlog_path"`")
++        AC_DEFINE_UNQUOTED(PR_LASTLOG_PATH, "`eval echo "$pr_lastlog_path"`", [.])
+       fi
+     fi
+   ])
+@@ -657,15 +657,6 @@ AC_ARG_ENABLE(dso,
+       LIB_DEPS="libltdl"
+       MODULE_DEPS="libltdl"
+       AC_DEFINE(PR_USE_DSO, 1, [Define if using DSO support.])
+-
+-      dnl Run configure scripts in subdirectories
+-      LT_CONFIG_LTDL_DIR([lib/libltdl])
+-      LTDL_INIT([convenience])
+-
+-      dnl Even though this macro is deprecated, we need to use it to
+-      dnl specifically tell ltdl that it is NOT to use any system directories,
+-      dnl and ONLY to use this bundled location.
+-      LTDL_CONVENIENCE([lib/libltdl])
+     fi
+   ])
+@@ -1029,9 +1020,9 @@ AC_ARG_ENABLE(scoreboard-updates,
+   [
+     if test x"$enableval" = xyes || test x"$enableval" = xno ; then
+       AC_MSG_WARN(scoreboard updates defaulting to 10)
+-      AC_DEFINE_UNQUOTED(PR_TUNABLE_XFER_SCOREBOARD_UPDATES, 10)
++      AC_DEFINE_UNQUOTED(PR_TUNABLE_XFER_SCOREBOARD_UPDATES, 10, [.])
+     else
+-      AC_DEFINE_UNQUOTED(PR_TUNABLE_XFER_SCOREBOARD_UPDATES, $enableval)
++      AC_DEFINE_UNQUOTED(PR_TUNABLE_XFER_SCOREBOARD_UPDATES, $enableval, [.])
+     fi
+   ])
+@@ -1267,13 +1258,13 @@ if test x"$force_shadow" != xno ; then
+         AC_DEFINE(PR_USE_SHADOW, 1, [Define if using shadow password support.])
+         AC_CHECK_MEMBER(struct spwd.sp_warn,
+-          [AC_DEFINE(HAVE_SPWD_SP_WARN)],,
++          [AC_DEFINE(HAVE_SPWD_SP_WARN, 1, [.])],,
+           [#include <shadow.h>])
+         AC_CHECK_MEMBER(struct spwd.sp_inact,
+-          [AC_DEFINE(HAVE_SPWD_SP_INACT)],,
++          [AC_DEFINE(HAVE_SPWD_SP_INACT, 1, [.])],,
+           [#include <shadow.h>])
+         AC_CHECK_MEMBER(struct spwd.sp_expire,
+-          [AC_DEFINE(HAVE_SPWD_SP_EXPIRE)],,
++          [AC_DEFINE(HAVE_SPWD_SP_EXPIRE, 1, [.])],,
+           [#include <shadow.h>])
+       fi ])
+@@ -2696,19 +2687,19 @@ pr_saved_exec_prefix="$exec_prefix"
+ test "x$prefix" = xNONE && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+-AC_DEFINE_UNQUOTED(PR_CONFIG_DIR, "`eval echo "${sysconfdir}"`")
+-AC_DEFINE_UNQUOTED(PR_INCLUDE_DIR, "`eval echo "${includedir}"`")
+-AC_DEFINE_UNQUOTED(PR_LIBEXEC_DIR, "`eval echo "${libexecdir}"`")
++AC_DEFINE_UNQUOTED(PR_CONFIG_DIR, "`eval echo "${sysconfdir}"`", [.])
++AC_DEFINE_UNQUOTED(PR_INCLUDE_DIR, "`eval echo "${includedir}"`", [.])
++AC_DEFINE_UNQUOTED(PR_LIBEXEC_DIR, "`eval echo "${libexecdir}"`", [.])
+ dnl We evaluate the string twice.  Once to go from $datadir to $prefix/share,
+ dnl and once more to substitute in the $prefix value.  What a pain.
+ locale_dir="`eval echo ${localedir}`"
+ locale_dir="`eval echo ${locale_dir}`"
+-AC_DEFINE_UNQUOTED(PR_LOCALE_DIR, "`eval echo "${locale_dir}"`")
++AC_DEFINE_UNQUOTED(PR_LOCALE_DIR, "`eval echo "${locale_dir}"`", [.])
+-AC_DEFINE_UNQUOTED(PR_RUN_DIR, "`eval echo "${localstatedir}"`")
+-AC_DEFINE_UNQUOTED(PR_CONFIG_FILE_PATH, "`eval echo "${sysconfdir}/proftpd.conf"`")
+-AC_DEFINE_UNQUOTED(PR_PID_FILE_PATH, "`eval echo "${localstatedir}/proftpd.pid"`")
++AC_DEFINE_UNQUOTED(PR_RUN_DIR, "`eval echo "${localstatedir}"`", [.])
++AC_DEFINE_UNQUOTED(PR_CONFIG_FILE_PATH, "`eval echo "${sysconfdir}/proftpd.conf"`", [.])
++AC_DEFINE_UNQUOTED(PR_PID_FILE_PATH, "`eval echo "${localstatedir}/proftpd.pid"`", [.])
+ prefix="$pr_saved_prefix"
+ exec_prefix="$pr_saved_exec_prefix"
+@@ -2764,11 +2755,11 @@ if test "$OSTYPE" = "-DDARWIN6" -o "$OST
+ fi
+ my_cflags="\"$CFLAGS\""
+-AC_DEFINE_UNQUOTED(PR_BUILD_CFLAGS, $my_cflags)
++AC_DEFINE_UNQUOTED(PR_BUILD_CFLAGS, $my_cflags, [.])
+ my_ldflags="\"$LDFLAGS $LIBDIRS\""
+-AC_DEFINE_UNQUOTED(PR_BUILD_LDFLAGS, $my_ldflags)
++AC_DEFINE_UNQUOTED(PR_BUILD_LDFLAGS, $my_ldflags, [.])
+ my_libs="\"$LIBRARIES $LIBS\""
+-AC_DEFINE_UNQUOTED(PR_BUILD_LIBS, $my_libs)
++AC_DEFINE_UNQUOTED(PR_BUILD_LIBS, $my_libs, [.])
+ dnl And finally, generate the appropriate Make* and config.h
+ AC_SUBST(ENABLE_NLS)
+--- /dev/null
++++ b/acinclude.m4
+@@ -0,0 +1 @@
++sinclude(m4/proftpd.m4)
+--- /dev/null
++++ b/lib/libltdl/acinclude.m4
+@@ -0,0 +1,7 @@
++sinclude(m4/argz.m4)
++sinclude(m4/libtool.m4)
++sinclude(m4/ltversion.m4)
++sinclude(m4/ltsugar.m4)
++sinclude(m4/ltoptions.m4)
++sinclude(m4/ltdl.m4)
++sinclude(m4/lt~obsolete.m4)
+--- a/lib/libltdl/Makefile.am
++++ b/lib/libltdl/Makefile.am
+@@ -50,19 +50,7 @@ AM_LDFLAGS         += -no-undefined
+ LTDL_VERSION_INFO     = -version-info 9:0:2
+ noinst_LTLIBRARIES    += $(LT_DLLOADERS)
+-
+-if INSTALL_LTDL
+-ltdlincludedir                = $(includedir)/libltdl
+-ltdlinclude_HEADERS   = libltdl/lt_system.h \
+-                        libltdl/lt_error.h \
+-                        libltdl/lt_dlloader.h
+-include_HEADERS              += ltdl.h
+-lib_LTLIBRARIES              += libltdl.la
+-endif
+-
+-if CONVENIENCE_LTDL
+ noinst_LTLIBRARIES     += libltdlc.la
+-endif
+ libltdl_la_SOURCES = libltdl/lt__alloc.h \
+                         libltdl/lt__dirent.h \
diff --git a/net/proftpd/patches/002-mempcpy_def.patch b/net/proftpd/patches/002-mempcpy_def.patch
new file mode 100644 (file)
index 0000000..d5aa346
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/include/options.h
++++ b/include/options.h
+@@ -238,3 +238,9 @@
+ #endif
+ #endif /* PR_OPTIONS_H */
++
++#ifndef _LIBC
++#ifndef __mempcpy
++#define __mempcpy mempcpy
++#endif
++#endif
diff --git a/net/psybnc/Makefile b/net/psybnc/Makefile
new file mode 100644 (file)
index 0000000..91715f7
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006 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:=psybnc
+PKG_VERSION:=2.3.2-7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=psyBNC-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.psybnc.at/download/beta/
+PKG_MD5SUM:=4b893a92f914813450e0921b2894ad6c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/psybnc
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=An IRC-Bouncer with many features
+  URL:=http://www.psybnc.at/
+endef
+
+define Package/psybnc/description
+       psyBNC is an easy-to-use, multi-user, permanent
+       IRC-Bouncer with many features. Some of its features
+       vhost- and relay support to connected bouncers and an
+       extensive online help system. Many other helpful
+       functions are included.
+endef
+
+ifneq ($(SDK)$(CONFIG_BIG_ENDIAN),)
+  ENDIANESS:=1
+else
+  ENDIANESS:=0
+endif
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               HOSTCC="$(HOSTCC)" \
+               all \
+       )
+endef
+
+define Package/psybnc/conffiles
+/etc/psybnc.conf
+endef
+
+define Package/psybnc/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/psybnc.sh $(1)/usr/sbin/psybnc
+       $(INSTALL_DIR) $(1)/usr/share/psybnc
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/psybnc $(1)/usr/share/psybnc/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/psybnc.conf $(1)/usr/share/psybnc/
+       $(INSTALL_DIR) $(1)/usr/share/psybnc/lang
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/lang/english.lng $(1)/usr/share/psybnc/lang/
+       $(INSTALL_DIR) $(1)/etc/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/psybnc.conf $(1)/etc
+endef
+
+$(eval $(call BuildPackage,psybnc))
diff --git a/net/psybnc/patches/001-makefile.patch b/net/psybnc/patches/001-makefile.patch
new file mode 100644 (file)
index 0000000..2db9560
--- /dev/null
@@ -0,0 +1,59 @@
+--- psybnc/Makefile    2005-06-04 20:22:45.000000000 +0200
++++ psybnc_patched/Makefile    2005-11-04 11:50:28.879157626 +0100
+@@ -1,16 +1,16 @@
+-CC    = gcc
++HOSTCC        = gcc
+ CCFLAGS = 
+ all:  $(OBJS)
+       @echo Initializing bouncer compilation
+       @echo [*] Running Conversion Tool for older psyBNC Data.
+-      @$(CC) tools/convconf.c -o tools/convconf
++      @$(HOSTCC) tools/convconf.c -o tools/convconf
+       @tools/convconf
+       @echo [*] Running Autoconfig.
+-      @$(CC) -I. tools/autoconf.c -o tools/autoconf
++      @$(HOSTCC) -I. tools/autoconf.c -o tools/autoconf
+       @tools/autoconf
+       @echo [*] Compiling MakeSalt for Encryption..
+-      @$(CC) -I. -o makesalt tools/makesalt.c
++      @$(HOSTCC) -I. -o makesalt tools/makesalt.c
+       @./makesalt
+       @echo [*] Compiling Bouncer..
+       @make -f makefile.out
+@@ -20,14 +20,14 @@
+ menuconfig:
+       @echo Initializing Menu-Configuration
+       @echo [*] Running Conversion Tool for older psyBNC Data.
+-      @$(CC) tools/convconf.c -o tools/convconf
++      @$(HOSTCC) tools/convconf.c -o tools/convconf
+       @tools/convconf
+       @echo [*] Running Autoconfig.
+-      @$(CC) -I. tools/autoconf.c -o tools/autoconf
++      @$(HOSTCC) -I. tools/autoconf.c -o tools/autoconf
+       @tools/autoconf
+       @echo [*] Creating Menu, please wait.
+       @echo This needs the 'ncurses' library. If it is not available, menuconf wont work. If you are using 'curses', use make menuconfig-curses instead.
+-      @$(CC) menuconf/menuconf.c menuconf/inputbox.c menuconf/util.c menuconf/checklist.c menuconf/menubox.c menuconf/textbox.c src/snprintf.c -I. -lncurses -lm -o menuconf/menuconf 2>/dev/null
++      @$(HOSTCC) menuconf/menuconf.c menuconf/inputbox.c menuconf/util.c menuconf/checklist.c menuconf/menubox.c menuconf/textbox.c src/snprintf.c -I. -lncurses -lm -o menuconf/menuconf 2>/dev/null
+       @menuconf/menuconf
+       @clear
+       @echo Now compile psyBNC using make, if not yet compiled, or if Options were changed.
+@@ -36,14 +36,14 @@
+ menuconfig-curses:
+       @echo Initializing Menu-Configuration using Curses
+       @echo [*] Running Conversion Tool for older psyBNC Data.
+-      @$(CC) tools/convconf.c -o tools/convconf
++      @$(HOSTCC) tools/convconf.c -o tools/convconf
+       @tools/convconf
+       @echo [*] Running Autoconfig.
+-      @$(CC) -I. tools/autoconf.c -o tools/autoconf
++      @$(HOSTCC) -I. tools/autoconf.c -o tools/autoconf
+       @tools/autoconf
+       @echo [*] Creating Menu, please wait.
+       @echo This needs the 'curses' library. If it is not available, menuconf wont work.
+-      @$(CC) menuconf/menuconf.c menuconf/inputbox.c menuconf/util.c menuconf/checklist.c menuconf/menubox.c menuconf/textbox.c src/snprintf.c -DNONCURSES -I. -lcurses -lm -o menuconf/menuconf 2>/dev/null
++      @$(HOSTCC) menuconf/menuconf.c menuconf/inputbox.c menuconf/util.c menuconf/checklist.c menuconf/menubox.c menuconf/textbox.c src/snprintf.c -DNONCURSES -I. -lcurses -lm -o menuconf/menuconf 2>/dev/null
+       @menuconf/menuconf
+       @clear
+       @echo Now compile psyBNC using make, if not yet compiled, or if Options were changed.
diff --git a/net/psybnc/patches/002-conf.patch b/net/psybnc/patches/002-conf.patch
new file mode 100644 (file)
index 0000000..98e9ad5
--- /dev/null
@@ -0,0 +1,14 @@
+diff -Naur psybnc/psybnc.conf psybnc_finish/psybnc.conf
+--- psybnc/psybnc.conf 1970-01-01 01:00:00.000000000 +0100
++++ psybnc_finish/psybnc.conf  2005-11-03 18:27:44.726264185 +0100
+@@ -0,0 +1,10 @@
++PSYBNC.SYSTEM.PORT1=50001
++PSYBNC.SYSTEM.ME=psybnc_mipsel
++PSYBNC.SYSTEM.HOST1=*
++PSYBNC.HOSTALLOWS.ENTRY0=*;*
++USER1.USER.NICK=change_me
++USER1.USER.USER=psybnc_admin
++USER1.USER.PASS=change_me
++USER1.USER.RIGHTS=1
++USER1.USER.VLINK=0
++USER1.USER.LOGIN=psybnc_admin
diff --git a/net/psybnc/patches/003-psybnc.patch b/net/psybnc/patches/003-psybnc.patch
new file mode 100644 (file)
index 0000000..32f2165
--- /dev/null
@@ -0,0 +1,105 @@
+diff -ur psybnc/config.h psybnc_finish/config.h
+--- psybnc/config.h    2005-06-04 20:22:45.000000000 +0200
++++ psybnc_finish/config.h     2005-11-03 17:05:40.802998216 +0100
+@@ -1,40 +1,7 @@
+-/* $Id: config.h,v 1.2 2005/06/04 18:05:33 hisi Exp $ */
+ /*
+  * Configuration file for psyBNC, created by menuconf
+  */
+-/* Encryption */
+-
+-#define CRYPT
+-
+-/* Encryption Type*/
+-
+-#define BLOWFISH
+-
+-/* Allow Translation */
+-
+-#define TRANSLATE
+-
+-/* Allow internal network */
+-
+-#define INTNET
+-
+-/* Allow traffic logging */
+-
+-#define TRAFFICLOG
+-
+-/* Allow linkage of bouncers */
+-
+-#define LINKAGE
+-
+-/* Allow the dcc File-Functions */
+-
+-#define DCCFILES
+-
+-/* Pipe dcc Chats */
+-
+-#define DCCCHAT
+-
+ /* Allow to add more users */
+ #define MULTIUSER
+@@ -47,28 +14,27 @@
+ #define MAXCONN 99
+-/* Allow the usage of scripts */
++/* Use blocking DNS */
+-#define SCRIPTING
++#define BLOCKDNS
+ /* Allow multiple irc connections per user */
+ #define NETWORK
+-/* Allow Proxy Support */
++/* The logging level */
+-#define PROXYS
++#define LOGLEVEL 2
+-/* The logging level */
++/* The ctcp Version reply */
+-#define LOGLEVEL 0
++#define CTCPVERSION "psyBNC 2.3.2-7 running on mipsel, ported by piie visit www.linuX-gamers.net"
+-/* SSL-Security */
++/* The Path to SSL */
+-#define SSLSEC 2
++#define SSLPATH "/tmp/"
+-/* Blocking DNS is preferred. Non Blocking DNS is experimental */
++/* SSL-Security */
++
++#define SSLSEC 0
+-#ifndef BLOCKDNS
+-#define BLOCKDNS
+-#endif
+diff -ur psybnc/tools/autoconf.c psybnc_finish/tools/autoconf.c
+--- psybnc/tools/autoconf.c    2005-06-04 20:22:45.000000000 +0200
++++ psybnc_finish/tools/autoconf.c     2005-10-29 14:46:49.000000000 +0200
+@@ -425,7 +425,7 @@
+       printf("Can't create makefile.out .. aborting\n");
+       exit(0x1);
+     }
+-    fprintf(makefile,"CC      = gcc\n");
++    fprintf(makefile,"CC      = mipsel-linux-gcc\n");
+     fprintf(makefile,"SRC     = src/\n");
+ #ifdef BOUNDCHECK
+     fprintf(makefile,"CFLAGS  = -O -fbounds-checking -fno-builtin\n");
+@@ -450,7 +450,7 @@
+     fprintf(makefile,"\n");
+     fprintf(makefile,"all:    $(OBJS)\n");
+     fprintf(makefile,"        $(CC) -o $(TARGET) $(CFLAGS) $(OBJS) $(LIBS)\n");
+-    fprintf(makefile,"        @strip $(TARGET)\n");
++    /*fprintf(makefile,"      @strip $(TARGET)\n");*/
+     if(ssl==0)
+     {
+       if(!fexists("key/psybnc.cert.pem")) /* only create, if not exist */
diff --git a/net/psybnc/patches/004-start_script.patch b/net/psybnc/patches/004-start_script.patch
new file mode 100644 (file)
index 0000000..635213d
--- /dev/null
@@ -0,0 +1,16 @@
+diff -Naur psybnc/psybnc.sh psybnc_patched/psybnc.sh
+--- psybnc/psybnc.sh   1970-01-01 01:00:00.000000000 +0100
++++ psybnc_finish/psybnc.sh    2005-11-04 12:51:26.478557377 +0100
+@@ -0,0 +1,12 @@
++#!/bin/sh
++
++PDIR=$(pwd);
++cd /usr/share/psybnc;
++./psybnc "$@";
++cd "$PDIR";
++
++echo;
++echo;
++echo "Configuration is located at /usr/share/psybnc/psybnc.conf";
++echo "everything can be configured within your chatclient,";
++echo "after logging in as psybnc_admin ( /bhelp shows bnc help )";
diff --git a/net/psybnc/patches/005-fix_endianess_detection.patch b/net/psybnc/patches/005-fix_endianess_detection.patch
new file mode 100644 (file)
index 0000000..7783f84
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/tools/autoconf.c
++++ b/tools/autoconf.c
+@@ -222,6 +222,9 @@
+ int checkendian()
+ {
++#ifdef ENDIANESS
++    return ENDIANESS;
++#else
+     char xyz[]="\x01\x02\x03\x04";
+     unsigned long *lp;    
+     unsigned long result;
+@@ -229,6 +232,7 @@
+     result=*lp;
+     if(result==67305985) return 0x1;
+     return 0x0;
++#endif
+ }
+ int main()
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,7 @@
+       @$(HOSTCC) tools/convconf.c -o tools/convconf
+       @tools/convconf
+       @echo [*] Running Autoconfig.
+-      @$(HOSTCC) -I. tools/autoconf.c -o tools/autoconf
++      @$(HOSTCC) -I. -DENDIANESS=$(ENDIANESS) tools/autoconf.c -o tools/autoconf
+       @tools/autoconf
+       @echo [*] Compiling MakeSalt for Encryption..
+       @$(HOSTCC) -I. -o makesalt tools/makesalt.c
diff --git a/net/ptpd/Makefile b/net/ptpd/Makefile
new file mode 100644 (file)
index 0000000..50a7682
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2010-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:=ptpd
+PKG_VERSION:=2.1.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ptpd
+PKG_MD5SUM:=9748f031ed9ebb5c600de354dae53046
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKE_PATH:=src
+
+define Package/ptpd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Time Synchronization
+  TITLE:=Precision Time Protocol (PTP) daemon
+  URL:=http://ptpd.sourceforge.net/
+  DEPENDS:=+libpthread +librt
+endef
+
+define Package/ptpd/description
+ The PTP daemon (PTPd) implements version 2 of the Precision Time Protocol (PTP)
+ as defined by the IEEE 1588-2008 standard.
+ PTP was developed to provide very precise time coordination of LAN connected
+ computers.
+endef
+
+define Package/ptpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ptpd2 $(1)/usr/sbin/ptpd
+       $(INSTALL_BIN) ./files/ptpd.init $(1)/etc/init.d/ptpd
+endef
+
+$(eval $(call BuildPackage,ptpd))
diff --git a/net/ptpd/files/ptpd.init b/net/ptpd/files/ptpd.init
new file mode 100644 (file)
index 0000000..9cce55c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=50
+
+start() {
+       service_start /usr/sbin/ptpd
+}
+
+stop() {
+       service_stop /usr/sbin/ptpd
+}
diff --git a/net/ptunnel/Makefile b/net/ptunnel/Makefile
new file mode 100644 (file)
index 0000000..18d232c
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2006-2012 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:=ptunnel
+PKG_VERSION:=0.71
+PKG_RELEASE:=4
+
+PKG_SOURCE:=PingTunnel-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.cs.uit.no/~daniels/PingTunnel
+PKG_MD5SUM:=9b04771d4fa50abc15a6af690b81c71a
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/PingTunnel
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ptunnel
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall Tunnel
+  DEPENDS:=+libpthread +libpcap
+  TITLE:=Tunnel TCP connections over ICMP packets
+  URL:=http://www.cs.uit.no/~daniels/PingTunnel/
+endef
+
+define Package/ptunnel/description
+  ptunnel is an application that allows you to reliably tunnel TCP connections to
+  a remote host using ICMP echo request and reply packets, commonly known as ping
+  requests and replies. It acts as a proxy and can handle sockets and secured
+  identification.
+endef
+
+define Package/ptunnel/conffiles
+/etc/config/ptunnel
+endef
+
+# uses GNU configure
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -g -I$(STAGING_DIR)/usr/include" \
+               LDOPTS="$(TARGET_LDFLAGS) -lpthread -lpcap" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/ptunnel/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ptunnel $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ptunnel.init $(1)/etc/init.d/ptunnel
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/ptunnel.config $(1)/etc/config/ptunnel
+endef
+
+$(eval $(call BuildPackage,ptunnel))
diff --git a/net/ptunnel/files/ptunnel.config b/net/ptunnel/files/ptunnel.config
new file mode 100644 (file)
index 0000000..bfc7495
--- /dev/null
@@ -0,0 +1,2 @@
+config ptunnel
+       option interface 'lan'
diff --git a/net/ptunnel/files/ptunnel.init b/net/ptunnel/files/ptunnel.init
new file mode 100644 (file)
index 0000000..3b10d41
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2012 OpenWrt.org
+
+START=70
+
+start_instance() {
+       local section="$1"
+
+       config_get interface "$section" interface
+       network_get_device ifname "$interface" || {
+               echo "${initscript}: Error: Interface '$interface' not found" 1>&2
+               return 1
+       }
+
+       SERVICE_PID_FILE="/var/run/ptunnel.$ifname.pid"
+       service_start /usr/sbin/ptunnel -c "$ifname" -daemon $SERVICE_PID_FILE
+}
+
+start() {
+       . /lib/functions/network.sh
+
+       config_load 'ptunnel'
+       config_foreach start_instance 'ptunnel'
+       iptables -I OUTPUT 1 -p icmp -j ACCEPT 2>/dev/null
+}
+
+stop() {
+       service_stop /usr/sbin/ptunnel
+       iptables -D OUTPUT -p icmp -j ACCEPT 2>/dev/null
+}
diff --git a/net/ptunnel/patches/001-prefix.patch b/net/ptunnel/patches/001-prefix.patch
new file mode 100644 (file)
index 0000000..c640670
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -12,8 +12,8 @@ WIN32_CFLAGS = -g -Wall -DWIN32 -I"c:\Pr
+ WIN32_LDOPTS = -lwpcap -lwsock32 -L"c:\Program Files\WpdPack\Lib"
+ WIN32_PT_OBJS = ptunnel.obj md5.obj
+-prefix                = /usr
+-bindir                = $(prefix)/bin
++prefix                = $(DESTDIR)/usr
++bindir                = $(prefix)/sbin
+ mandir                = $(prefix)/share/man/man8
+ all: ptunnel
diff --git a/net/ptunnel/patches/002-no_selinux.patch b/net/ptunnel/patches/002-no_selinux.patch
new file mode 100644 (file)
index 0000000..2dcf8c4
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/Makefile
++++ b/Makefile
+@@ -32,7 +32,7 @@ install: ptunnel
+       install ./ptunnel.8 $(mandir)/ptunnel.8
+ ptunnel: $(PT_OBJS)
+-      $(CC) -o $@ $^ $(LDOPTS) `[ -e /usr/include/selinux/selinux.h ] && echo -lselinux`
++      $(CC) -o $@ $^ $(LDOPTS)
+ ptunnel.exe: $(WIN32_PT_OBJS)
+       $(CC) -o $@ $^ $(WIN32_LDOPTS)
+@@ -47,7 +47,7 @@ depend: .depend
+       $(CC) $(CFLAGS) -MM *.c > $@
+ %.o:%.c
+-      $(CC) $(CFLAGS) `[ -e /usr/include/selinux/selinux.h ] && echo -DHAVE_SELINUX` -c -o $@ $<
++      $(CC) $(CFLAGS) -c -o $@ $<
+ %.obj:%.c
+       $(WIN32_CC) $(WIN32_CFLAGS) -c -o $@ $<
diff --git a/net/pure-ftpd/Makefile b/net/pure-ftpd/Makefile
new file mode 100644 (file)
index 0000000..3b2403b
--- /dev/null
@@ -0,0 +1,92 @@
+#
+# Copyright (C) 2007-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:=pure-ftpd
+PKG_VERSION:=1.0.36
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.pureftpd.org/pub/pure-ftpd/releases
+PKG_MD5SUM:=7899c75c1fed7dbad0352eb31080e066
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pure-ftpd/Default
+  SUBMENU:=File Transfer
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libelf1
+  TITLE:=Secure FTP made easy!
+  URL:=http://www.pureftpd.org/project/pure-ftpd
+endef
+
+define Package/pure-ftpd
+  $(call Package/pure-ftpd/Default)
+  TITLE+= (no TLS)
+  VARIANT:=notls
+endef
+
+define Package/pure-ftpd-tls
+  $(call Package/pure-ftpd/Default)
+  TITLE+= (TLS)
+  VARIANT:=tls
+  DEPENDS+=+libopenssl
+endef
+
+define Package/pure-ftpd/description
+ Pure-FTPd is a free (BSD), secure, production-quality and standard-conformant
+ FTP server. It doesn't provide useless bells and whistles, but focuses on
+ efficiency and ease of use.
+ It provides simple answers to common needs, plus unique  useful features for
+ personal users as well as hosting providers.
+endef
+
+Package/pure-ftpd-tls/description=$(Package/pure-ftpd/description)
+
+define Package/pure-ftpd/conffiles
+/etc/config/pure-ftpd
+endef
+
+Package/pure-ftpd-tls/conffiles=$(Package/pure-ftpd/conffiles)
+
+CONFIGURE_ARGS += \
+       --with-everything \
+       --with-virtualchroot \
+       --without-capabilities \
+
+ifeq ($(BUILD_VARIANT),tls)
+CONFIGURE_ARGS += \
+       --with-certfile=/etc/ssl/private/pure-ftpd.pem \
+       --with-tls
+endif
+
+define Package/pure-ftpd/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/pure-{pw,pwconvert,statsdecode} \
+               $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ptracetest $(1)/usr/sbin/
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/pure-{authd,ftpd,ftpwho,mrtginfo,quotacheck,uploadscript} \
+               $(1)/usr/sbin/
+endef
+
+Package/pure-ftpd-tls/install=$(Package/pure-ftpd/install)
+
+$(eval $(call BuildPackage,pure-ftpd))
+$(eval $(call BuildPackage,pure-ftpd-tls))
diff --git a/net/pure-ftpd/files/pure-ftpd.config b/net/pure-ftpd/files/pure-ftpd.config
new file mode 100644 (file)
index 0000000..69aa734
--- /dev/null
@@ -0,0 +1,10 @@
+config pure-ftpd
+       option port             '21'
+       option noanonymous      '1'
+       option chrooteveryone   '1'
+       option maxclientsperip  '10'
+       option maxclientsnumber '4'
+       option peruserlimits    '3:4'
+       option umask            '133:022'
+       option authentication   'unix'
+       option enabled          '0'
diff --git a/net/pure-ftpd/files/pure-ftpd.init b/net/pure-ftpd/files/pure-ftpd.init
new file mode 100644 (file)
index 0000000..9c9d332
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+# TODO: allow multiple instance to run with different pid-files
+
+# XXX: pure-ftpd changes it's name to 'pure-ftpd (SERVER) ...'
+SERVICE_MATCH_EXEC=
+SERVICE_MATCH_NAME=1
+SERVICE_USE_PID=1
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get_bool _val "$section" "$option" '0'
+       [ "$_val" -gt 0 ] && append args "$3"
+}
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3 $_val"
+}
+
+start_instance() {
+       local section="$1"
+
+       config_get_bool enabled "$section" 'enabled' '1'
+       [ $enabled -gt 0 ] || return 1
+
+       args=""
+       append_string "$section" trustedgid "-a"
+       append_string "$section" syslogfacility "-f"
+       append_string "$section" fortunesfile "-F"
+       append_string "$section" maxidletime "-I"
+       append_string "$section" maxdiskusagepct "-k"
+       append_string "$section" limitrecursion "-L"
+       append_string "$section" anonymouscancreate "-M"
+       append_string "$section" maxload "-m"
+       append_string "$section" quota "-n"
+       append_string "$section" altlog "-O"
+       append_string "$section" passiveportrange "-p"
+       append_string "$section" forcepassiveip "-P"
+       append_string "$section" anonymousratio "-q"
+       append_string "$section" userratio "-Q"
+       append_string "$section" anonymousbandwidth "-t"
+       append_string "$section" userbandwidth "-T"
+       append_string "$section" minuid "-u"
+       append_string "$section" trustedip "-V"
+       append_string "$section" tls "-Y"
+       append_string "$section" tlsciphersuite "-J"
+
+       append_bool "$section" uploadscript "-o"
+       append_bool "$section" natmode "-N"
+       append_bool "$section" autorename "-r"
+       append_bool "$section" nochmod "-R"
+       append_bool "$section" antiwarez "-s"
+       append_bool "$section" allowuserfxp "-w"
+       append_bool "$section" allowanonymousfxp "-W"
+       append_bool "$section" prohibitdotfileswrite "-x"
+       append_bool "$section" prohibitdotfilesread "-X"
+       append_bool "$section" allowdotfiles "-z"
+       append_bool "$section" customerproof "-Z"
+       append_bool "$section" anonymouscantupload "-i"
+       append_bool "$section" createhomedir "-j"
+       append_bool "$section" keepallfiles "-K"
+       append_bool "$section" norename "-G"
+       append_bool "$section" dontresolve "-H"
+       append_bool "$section" verboselog "-d"
+       append_bool "$section" displaydotfiles "-D"
+       append_bool "$section" anonymousonly "-e"
+       append_bool "$section" brokenclientscompatibility "-b"
+       append_bool "$section" notruncate "-0"
+       append_bool "$section" logpid "-1"
+       append_bool "$section" ipv4only "-4"
+       append_bool "$section" ipv6only "-6"
+
+       append_string "$section" bind "-S"
+       append_string "$section" login "-l"
+
+       append_bool "$section" noanonymous "-E"
+       append_bool "$section" chrooteveryone "-A"
+       append_string "$section" maxclientsperip "-c"
+       append_string "$section" maxclientsnumber "-C"
+       append_string "$section" peruserlimits "-y"
+       append_string "$section" umask "-U"
+
+       append_string "$section" port "-S"
+       append_string "$section" authentication "-l"
+
+       service_start /usr/sbin/pure-ftpd -B $args
+}
+
+start() {
+       config_load "pure-ftpd"
+       config_foreach start_instance "pure-ftpd"
+}
+
+stop() {
+       service_stop /usr/sbin/pure-ftpd
+}
diff --git a/net/pure-ftpd/patches/010-dont-add-host-paths.patch b/net/pure-ftpd/patches/010-dont-add-host-paths.patch
new file mode 100644 (file)
index 0000000..42a9189
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/configure
++++ b/configure
+@@ -4825,18 +4825,6 @@ fi
+-if test -d /usr/local/include; then
+-  CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+-fi
+-
+-if test -d /usr/kerberos/include; then
+-  CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
+-fi
+-
+-if test -d /usr/local/lib; then
+-  LDFLAGS="$LDFLAGS -L/usr/local/lib"
+-fi
+-
+ if uname | fgrep SunOS > /dev/null 2> /dev/null ; then
+   CPPFLAGS="$CPPFLAGS -D_XPG4_2=1"
+ fi
+@@ -9222,7 +9210,6 @@ if test $ac_have_func = no; then
+   # There is a commonly available library for RS/6000 AIX.
+   # Since it is not a standard part of AIX, it might be installed locally.
+   ac_getloadavg_LIBS=$LIBS
+-  LIBS="-L/usr/local/lib $LIBS"
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getloadavg in -lgetloadavg" >&5
+ $as_echo_n "checking for getloadavg in -lgetloadavg... " >&6; }
+ if test "${ac_cv_lib_getloadavg_getloadavg+set}" = set; then :
diff --git a/net/pyload/Makefile b/net/pyload/Makefile
new file mode 100644 (file)
index 0000000..f888628
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2011-2014 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:=pyload
+PKG_VERSION:=0.4.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-src-v$(PKG_VERSION).zip
+PKG_SOURCE_URL:=http://download.pyload.org/
+PKG_MD5SUM:=28876150af22999b6f539c8579d3b415
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/pyload
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+python +pyopenssl +python-curl +python-crypto \
+       +python-expat +python-imaging-library +python-sqlite3 +js \
+       +tesseract +unrar
+  TITLE:=A fast, lightweight and full featured download manager
+  URL:=http://pyload.org
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/pyload/install
+       $(INSTALL_DIR) $(1)/usr/share/python
+       $(CP) $(PKG_BUILD_DIR)/pyload $(1)/usr/share/python/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pyload.init $(1)/etc/init.d/pyload
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(LN) ../share/python/pyload/pyLoadCore.py $(1)/usr/bin/pyload
+endef
+
+$(eval $(call BuildPackage,pyload))
diff --git a/net/pyload/files/pyload.init b/net/pyload/files/pyload.init
new file mode 100644 (file)
index 0000000..cd0e270
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=94
+
+start() {
+       /usr/bin/python /usr/share/python/pyload/pyLoadCore.py --configdir=/etc/pyload --daemon
+}
+
+stop() {
+       /usr/bin/python /usr/share/python/pyload/pyLoadCore.py --configdir=/etc/pyload --quit
+}
diff --git a/net/pyrit/Makefile b/net/pyrit/Makefile
new file mode 100644 (file)
index 0000000..9385be6
--- /dev/null
@@ -0,0 +1,49 @@
+#\r
+# Copyright (C) 2011 OpenWrt.org\r
+#\r
+# This is free software, licensed under the GNU General Public License v2.\r
+# See /LICENSE for more information.\r
+#\r
+\r
+include $(TOPDIR)/rules.mk\r
+\r
+PKG_NAME:=pyrit\r
+PKG_VERSION:=0.4.0\r
+PKG_RELEASE:=1\r
+\r
+PKG_SOURCE_URL:=http://pyrit.googlecode.com/files\r
+PKG_SOURCE:=pyrit-0.4.0.tar.gz\r
+PKG_MD5SUM:=7258b6f3dacfb09736ddeed2a379df2d\r
+\r
+include $(INCLUDE_DIR)/package.mk\r
+$(call include_mk, python-package.mk)\r
+\r
+define Package/pyrit\r
+  SECTION:=net\r
+  CATEGORY:=Network\r
+  DEPENDS:=+python +libopenssl +libpcap\r
+  TITLE:=A GPGPU-driven WPA/WPA2-PSK key cracker\r
+  URL:=http://code.google.com/p/pyrit/\r
+endef\r
+\r
+define Package/pyrit/description\r
+ A GPGPU-driven WPA/WPA2-PSK key cracker\r
+ Pyrit exploits the computational power of many-core- and GPGPU-\r
+ -platforms to create massive databases, pre-computing part of the \r
+ WPA/WPA2-PSK authentication phase in a space-time tradeoff. \r
+ It is a powerful attack against one of the world's most used security\r
+ protocols\r
+endef\r
+\r
+define Build/Compile\r
+       $(call Build/Compile/PyMod,., \\r
+               install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \\r
+       )\r
+endef\r
+\r
+define Package/pyrit/install\r
+       $(INSTALL_DIR) $(1)\r
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/\r
+endef\r
+\r
+$(eval $(call BuildPackage,pyrit))\r
diff --git a/net/qolyester/Makefile b/net/qolyester/Makefile
new file mode 100644 (file)
index 0000000..3b7f25f
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007-2009 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:=qolyester
+PKG_VERSION:=20090302
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://qolsr.lri.fr/code/
+PKG_MD5SUM:=650286fc2ea3e13c246d233aaa46f2a4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/qolyester
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread +libstdcpp @!TARGET_avr32 @!powerpc
+  TITLE:=OLSR implementation with QoS
+  URL:=http://qolsr.lri.fr/code/
+endef
+
+define Package/qolyester/description
+       This is an implementation from scratch of the OLSR protocol.
+       It is written in the C++ programming language and its goals
+       are modularity, efficiency and conformance to RFC 3626 (OLSR).
+endef
+
+# uses GNU configure
+
+define Package/qolyester/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qolsrd $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,qolyester))
diff --git a/net/quicktun/Makefile b/net/quicktun/Makefile
new file mode 100644 (file)
index 0000000..c4d9bd0
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 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:=quicktun
+PKG_VERSION:=2.1.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://oss.ucis.nl/quicktun/src
+PKG_MD5SUM:=6cf38b17218deb8c908cc17d91f9cbd7
+
+PKG_BUILD_DEPENDS:=nacl
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/quicktun
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-tun
+  TITLE:=QuickTun is a simple and secure VPN software
+  URL:=http://wiki.ucis.nl/QuickTun
+  SUBMENU:=VPN
+endef
+
+define Package/quicktun/description
+ QuickTun is a simple and secure VPN software
+endef
+
+define Package/quicktun/conffiles
+/etc/config/quicktun
+endef
+
+define Build/Compile
+       ( \
+               cd $(PKG_BUILD_DIR); \
+               mkdir -p obj out; \
+               \
+               export CPATH=$(STAGING_DIR)/usr/include/nacl; \
+               \
+               $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -c -DCOMBINED_BINARY        src/proto.raw.c         -o obj/proto.raw.o; \
+               $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -c -DCOMBINED_BINARY        src/proto.nacl0.c       -o obj/proto.nacl0.o; \
+               $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -c -DCOMBINED_BINARY        src/proto.nacltai.c     -o obj/proto.nacltai.o; \
+               $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -c -DCOMBINED_BINARY        src/run.combined.c      -o obj/run.combined.o; \
+               $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -c                          src/common.c            -o obj/common.o; \
+               $(TARGET_CC)  $(TARGET_LDFLAGS) -o out/quicktun.combined obj/common.o obj/run.combined.o obj/proto.raw.o obj/proto.nacl0.o obj/proto.nacltai.o \
+                       -lnacl; \
+               \
+               $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS) -o out/quicktun.keypair     src/keypair.c           -lnacl \
+       )
+endef
+
+define Package/quicktun/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/quicktun.{combined,keypair} $(1)/usr/sbin/
+       $(LN) quicktun.combined $(1)/usr/sbin/quicktun
+
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,quicktun))
diff --git a/net/quicktun/files/quicktun.config b/net/quicktun/files/quicktun.config
new file mode 100644 (file)
index 0000000..e5cc6f3
--- /dev/null
@@ -0,0 +1,55 @@
+package quicktun
+
+config quicktun sample_config
+
+       # Set to 1 to enable this instance:
+       option enabled 0
+
+       # IP address or hostname of the local end, optional
+#      option local_address 0.0.0.0
+
+       # Local UDP port
+       option local_port 2998
+
+       # IP address or hostname of the remote end
+       # Use 0.0.0.0 for a floating/dynamic endpoint
+       option remote_address 0.0.0.0
+
+       # Remote UDP port
+       option remote_port 2998
+
+       # Allows the remote address and port to change when properly
+       # encrypted packets are received even when a remote address
+       # is set
+       option remote_float 0
+
+       # "proto raw" uses no encryption
+       # "proto nacl0" uses NaCl encryption without nonce
+       # "proto nacltai" uses NaCl encryption with nonce
+       option protocol raw
+
+       # "tun_mode 0" will create an ethernet tunnel (tap device),
+       # "tun_mode 1" will create an IP tunnel (tun device).
+       option tun_mode 0
+
+       # Set the name of the tunnel interface to use
+       option interface "tap0"
+#      option interface "tun0"
+#      option interface "qt0"
+
+       # The local private key and the remote public key
+       # A keypair can be generated with quicktun.keygen
+       # (nacl0 and nacltai protocols only)
+       #option private_key 0000000000000000000000000000000000000000000000000000000000000000
+       #option public_key 0000000000000000000000000000000000000000000000000000000000000000
+
+       # allowed time window for first received packet in seconds,
+       # positive number allows packets from history
+       # (nacltai protocol only)
+       #option time_window 0
+
+       # command to configure IP addresses etc. after the tunnel is up; $1 will be the interface name (optional)
+#      option up ""
+
+       # command to execute before the tunnel is set down; $1 will be the interface name (optional)
+#      option down ""
diff --git a/net/quicktun/files/quicktun.init b/net/quicktun/files/quicktun.init
new file mode 100644 (file)
index 0000000..e6192d6
--- /dev/null
@@ -0,0 +1,141 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+# Partly taken the OpenVPN init script (Copyright (C) 2008 Jo-Philipp Wich)
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+START=95
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+EXTRA_COMMANDS="up down"
+
+LIST_SEP="
+"
+
+append_opt() {
+       local p="$1"; local v="$2"; local p_uc
+       
+       p_uc=$(echo "$p" | tr '[a-z]' '[A-Z]')
+       OPTS="$OPTS \"$p_uc=$v\""
+}
+
+append_opts() {
+       local p; local v; local s="$1"; shift
+       for p in $*; do
+               config_get v "$s" "$p"
+               [ -n "$v" ] && append_opt "$p" "$v"
+       done
+}
+
+section_enabled() {
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+error() {
+       echo "${initscript}:" "$@" 1>&2
+}
+
+start_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       SERVICE_PID_FILE="/var/run/quicktun-$s.pid"
+       OPTS=""
+
+       config_get interface "$s" interface
+       if [ -z "$interface" ]; then
+               error "$s: interface '$interface' is not set"
+               return 1
+       fi
+
+       if ifconfig "$interface" &>/dev/null; then
+               error "$s: interface '$interface' is already in use"
+               return 1
+       fi
+
+       append_opts "$s" interface local_address local_port remote_address remote_port \
+               protocol private_key public_key time_window
+
+       config_get_bool tun_mode "$s" tun_mode 0
+       [ "$tun_mode" == 1 ] && append_opt tun_mode 1
+
+       config_get_bool remote_float "$s" remote_float 0
+       [ "$remote_float" == 1 ] && append_opt remote_float 1
+
+       eval env $OPTS service_start /usr/sbin/quicktun
+
+       while ! ifconfig "$interface" >/dev/null 2>&1; do
+               if ! service_check /usr/sbin/quicktun; then
+                       error "$s: startup failed"
+                       return 1
+               fi
+
+               sleep 1
+       done
+
+       config_get up "$s" up
+       [ -n "$up" ] && sh -c "$up" - "$interface"
+}
+
+stop_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       SERVICE_PID_FILE="/var/run/quicktun-$s.pid"
+
+       config_get interface "$s" interface
+       if [ -z "$interface" ]; then
+               error "$s: interface '$interface' is not set"
+               return 1
+       fi
+
+       if ! ifconfig "$interface" &>/dev/null; then
+               error "$s: interface '$interface' does not exist"
+               return 1
+       fi
+
+       config_get down "$s" down
+       [ -n "$down" ] && sh -c "$down" - "$interface"
+
+       service_stop /usr/sbin/quicktun
+}
+
+start() {
+       config_load 'quicktun'
+       config_foreach start_instance 'quicktun'
+}
+
+stop() {
+       config_load 'quicktun'
+       config_foreach stop_instance 'quicktun'
+}
+
+up() {
+       local exists
+       local instance
+       config_load 'quicktun'
+       for instance in "$@"; do
+               config_get exists "$instance" 'TYPE'
+               if [ "$exists" == "quicktun" ]; then
+                       start_instance "$instance"
+               fi
+       done
+}
+
+down() {
+       local exists
+       local instance
+       config_load 'quicktun'
+       for instance in "$@"; do
+               config_get exists "$instance" 'TYPE'
+               if [ "$exists" == "quicktun" ]; then
+                       stop_instance "$instance"
+               fi
+       done
+}
diff --git a/net/raddump/Makefile b/net/raddump/Makefile
new file mode 100644 (file)
index 0000000..ad7c367
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006 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:=raddump
+PKG_VERSION:=0.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/raddump
+PKG_MD5SUM:=f8c29c67141ea78bb6ae8b97d5149480
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/raddump
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libopenssl
+  TITLE:=raddump interprets captured RADIUS packets.
+  URL:=http://sourceforge.net/projects/raddump
+endef
+
+define Package/raddump/description
+       raddump interprets captured RADIUS packets to print a
+       timestamp, packet length, RADIUS packet type, source and
+       destination hosts and ports, and included attribute names and
+       values for each packet.
+endef
+
+# uses GNU configure
+
+define Package/raddump/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/raddump $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,raddump))
diff --git a/net/radsecproxy/Makefile b/net/radsecproxy/Makefile
new file mode 100644 (file)
index 0000000..5b4dfdd
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2008-2012 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:=radsecproxy
+PKG_VERSION:=1.6.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://software.uninett.no/radsecproxy/
+PKG_MD5SUM:=f74f82a7ae2cdf2b1d9d271a5c360617
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/radsecproxy
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl +libpthread
+  TITLE:=radsecproxy
+  URL:=http://software.uninett.no/radsecproxy
+endef
+
+define Package/radsecproxy/description
+  A generic radius proxy for UDP/TLS (RadSec)
+endef
+
+CONFIGURE_ARGS+= \
+       --with-ssl="$(STAGING_DIR)/usr"
+
+#TARGET_CFLAGS += -ansi
+#TARGET_CFLAGS += -std=c99
+TARGET_CFLAGS += -Wno-long-long
+
+
+define Package/radsecproxy/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/radsecproxy $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/
+       $(CP) $(PKG_BUILD_DIR)/radsecproxy.conf-example $(1)/etc/radsecproxy.conf
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/radsecproxy.init $(1)/etc/init.d/radsecproxy
+endef
+
+define Package/radsecproxy/conffiles
+/etc/radsecproxy.conf
+endef
+
+$(eval $(call BuildPackage,radsecproxy))
+
diff --git a/net/radsecproxy/files/radsecproxy.init b/net/radsecproxy/files/radsecproxy.init
new file mode 100644 (file)
index 0000000..39bdc6e
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=70
+
+USE_PROCD=1
+PROG=/usr/sbin/radsecproxy
+CONFFILE=/etc/radsecproxy.conf
+
+start_service() {
+       procd_open_instance
+       procd_set_param command $PROG -f -c $CONFFILE
+       procd_set_param file $CONFFILE
+       procd_set_param respawn
+       procd_close_instance
+}
diff --git a/net/radsecproxy/patches/100-missing-return.patch b/net/radsecproxy/patches/100-missing-return.patch
new file mode 100644 (file)
index 0000000..871fc6e
--- /dev/null
@@ -0,0 +1,58 @@
+--- a/dtls.c
++++ b/dtls.c
+@@ -523,6 +523,7 @@ void *udpdtlsserverrd(void *arg) {
+       free(params);
+       cacheexpire(sessioncache, &lastexpiry);
+     }
++    return NULL;
+ }
+ int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *text) {
+@@ -642,6 +643,7 @@ void *udpdtlsclientrd(void *arg) {
+       if (udp2bio(s, conf->servers->rbios, cnt))
+           debug(DBG_DBG, "radudpget: got DTLS in UDP from %s", addr2string((struct sockaddr *)&from));
+     }
++    return NULL;
+ }
+ void *dtlsclientrd(void *arg) {
+--- a/radsecproxy.c
++++ b/radsecproxy.c
+@@ -3203,6 +3203,8 @@ void *sighandler(void *arg) {
+             debug(DBG_WARN, "sighandler: ignoring signal %d", sig);
+         }
+     }
++
++    return NULL;
+ }
+ int createpidfile(const char *pidfile) {
+@@ -3289,6 +3291,8 @@ int radsecproxy_main(int argc, char **ar
+     /* just hang around doing nothing, anything to do here? */
+     for (;;)
+       sleep(1000);
++
++    return 0;
+ }
+ /* Local Variables: */
+--- a/udp.c
++++ b/udp.c
+@@ -266,6 +266,8 @@ void *udpclientrd(void *arg) {
+       buf = radudpget(*s, NULL, &server, NULL);
+       replyh(server, buf);
+     }
++
++    return NULL;
+ }
+ void *udpserverrd(void *arg) {
+@@ -310,6 +312,8 @@ void *udpserverwr(void *arg) {
+       debug(DBG_DBG, "udpserverwr: refcount %d", reply->refcount);
+       freerq(reply);
+     }
++
++    return NULL;
+ }
+ void addclientudp(struct client *client) {
diff --git a/net/radsecproxy/patches/200-logdest-on-foreground.patch b/net/radsecproxy/patches/200-logdest-on-foreground.patch
new file mode 100644 (file)
index 0000000..6678448
--- /dev/null
@@ -0,0 +1,31 @@
+diff --git a/radsecproxy.c b/radsecproxy.c
+index 563c4a8..9fa076d 100644
+--- a/radsecproxy.c
++++ b/radsecproxy.c
+@@ -3382,18 +3382,16 @@ int radsecproxy_main(int argc, char **argv) {
+       options.loglevel = loglevel;
+     else if (options.loglevel)
+       debug_set_level(options.loglevel);
+-    if (!foreground) {
+-      debug_set_destination(options.logdestination
+-                              ? options.logdestination
+-                              : "x-syslog:///", LOG_TYPE_DEBUG);
++    debug_set_destination(options.logdestination
++                        ? options.logdestination
++                        : "x-syslog:///", LOG_TYPE_DEBUG);
+ #if defined(WANT_FTICKS)
+-      if (options.ftickssyslogfacility) {
+-            debug_set_destination(options.ftickssyslogfacility,
+-                                  LOG_TYPE_FTICKS);
+-            free(options.ftickssyslogfacility);
+-      }
+-#endif
++    if (options.ftickssyslogfacility) {
++      debug_set_destination(options.ftickssyslogfacility,
++                            LOG_TYPE_FTICKS);
++      free(options.ftickssyslogfacility);
+     }
++#endif
+     free(options.logdestination);
+     if (!list_first(clconfs))
diff --git a/net/rarpd/Makefile b/net/rarpd/Makefile
new file mode 100644 (file)
index 0000000..25a98a8
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2006-2012 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:=rarpd
+PKG_VERSION:=1.1
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.dementia.org/pub/net-tools
+PKG_MD5SUM:=04e2ca849e758d0b88c8281775ec3b58
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rarpd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=+libnet0
+  TITLE:=Reverse ARP Daemon
+  URL:=ftp://ftp.dementia.org/pub/net-tools/
+endef
+
+define Package/rarpd/description
+       Rarpd is a daemon which responds to RARP requests.
+       RARP is used by some machines at boot time to discover their
+       IP address. They provide their Ethernet address and rarpd
+       responds with their IP address if it finds it in the ethers
+       database.
+endef
+
+CONFIGURE_ARGS+= \
+       --with-libnet="$(STAGING_DIR)/usr/lib/libnet-1.0.x" \
+       --with-pcap="$(STAGING_DIR)/usr" \
+
+CONFIGURE_VARS+= \
+       CFLAGS="$$$$CFLAGS -DNEW_LIBNET_INTERFACE" \
+
+define Package/rarpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rarpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/rarpd.config $(1)/etc/config/rarpd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rarpd.init $(1)/etc/init.d/rarpd
+endef
+
+define Package/rarpd/conffiles
+/etc/config/rarpd
+endef
+
+$(eval $(call BuildPackage,rarpd))
diff --git a/net/rarpd/files/rarpd.config b/net/rarpd/files/rarpd.config
new file mode 100644 (file)
index 0000000..297a869
--- /dev/null
@@ -0,0 +1,13 @@
+package 'rarpd'
+
+config 'rarpd'
+       option enabled 0
+
+       # listen on the specified interface (default: lan)
+#      option interface 'lan'
+
+       # use the specified 'ethers' file (default: /etc/ethers)
+#      option ethers '/etc/ethers'
+
+       # be verbose (default: false)
+#      option verbose 0
diff --git a/net/rarpd/files/rarpd.init b/net/rarpd/files/rarpd.init
new file mode 100644 (file)
index 0000000..68feb32
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+append_bool() {
+       local var="$1"
+       local section="$2"
+       local option="$3"
+       local value="$4"
+       local _val
+       config_get_bool _val "$section" "$option" 0
+       [ $_val -gt 0 ] && append "$var" "$value"
+}
+
+append_string() {
+       local var="$1"
+       local section="$2"
+       local option="$3"
+       local val="$4"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append "$var" "$val $_val"
+}
+
+section_enabled() {
+       local enabled
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+start_instance() {
+       local section="$1"
+       local if
+       local dev
+       local args
+
+       section_enabled "$section" || return 1
+
+       config_get if "$section" 'interface' 'lan'
+       network_get_device dev "$if" && {
+               args="-n -i $if"
+               append_string args "$section" 'ethers' '-e'
+               append_bool args "$section" 'verbose' '-v'
+
+               SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
+               service_start /usr/sbin/rarpd $args
+       }
+}
+
+stop_instance() {
+       local section="$1"
+       local id
+       local if
+       local dev
+
+       section_enabled "$section" || return 1
+
+       config_get if "$section" 'interface' 'lan'
+       network_get_device dev "$if"
+
+       SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
+       service_stop /usr/sbin/rarpd
+}
+
+start() {
+       . /lib/functions/network.sh
+       config_load 'rarpd'
+       config_foreach start_instance 'rarpd'
+}
+
+stop() {
+       . /lib/functions/network.sh
+       config_load 'rarpd'
+       config_foreach stop_instance 'rarpd'
+}
diff --git a/net/reaim/Makefile b/net/reaim/Makefile
new file mode 100644 (file)
index 0000000..b3fa5d1
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006-2012 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:=reaim
+PKG_VERSION:=0.8
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/reaim
+PKG_MD5SUM:=647d2ab72ec454f89294accfb3182c09
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/reaim
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+iptables
+  TITLE:=A transparent AIM / MSN proxy
+  URL:=http://reaim.sourceforge.net/
+endef
+
+define Package/reaim/description
+ReAIM is a proxy for file transfers with MSN/AIM.
+endef
+
+define Package/reaim/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/reaim $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/reaim.init $(1)/etc/init.d/reaim
+endef
+
+$(eval $(call BuildPackage,reaim))
diff --git a/net/reaim/files/reaim.init b/net/reaim/files/reaim.init
new file mode 100644 (file)
index 0000000..d848d9f
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=60
+
+IPT=/usr/sbin/iptables
+
+set_rules() {
+       . /lib/functions/network.sh
+
+       local device
+       network_get_device device wan && {
+               $IPT $1 input_rule -i $device -p tcp --dport 1863:1864 -j ACCEPT
+               $IPT $1 input_rule -i $device -p tcp --dport 4443 -j ACCEPT
+               $IPT $1 input_rule -i $device -p tcp --dport 5566 -j ACCEPT
+               $IPT $1 input_rule -i $device -p tcp --dport 40000:40099 -j ACCEPT
+       }
+}
+
+start() {
+       service_start /usr/sbin/reaim && set_rules -A
+}
+
+stop() {
+       service_stop /usr/sbin/reaim && set_rules -D
+}
diff --git a/net/reaim/patches/501-cross_compile-install.patch b/net/reaim/patches/501-cross_compile-install.patch
new file mode 100644 (file)
index 0000000..9e88f61
--- /dev/null
@@ -0,0 +1,16 @@
+diff -urN reaim-0.8/Makefile reaim-0.8/Makefile
+--- reaim-0.8/Makefile 2002-11-28 06:10:38.000000000 +0100
++++ reaim-0.8/Makefile 2005-10-07 12:07:43.000000000 +0200
+@@ -11,7 +11,10 @@
+ endif
+ reaim: reaim.c
+-      gcc -o reaim reaim.c -g -Wall $(FW_FLAGS)
+-
++      $(CC) $(CFLAGS) -o reaim reaim.c -Wall $(FW_FLAGS)
+ clean:
+       -rm reaim
++
++install:
++      install -d -m 0755 $(DESTDIR)/usr/sbin
++      install -m 0755 reaim $(DESTDIR)/usr/sbin/
diff --git a/net/reaver/Makefile b/net/reaver/Makefile
new file mode 100644 (file)
index 0000000..13a28c7
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2012 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:=reaver
+PKG_REV:=113
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://reaver-wps.googlecode.com/svn/trunk
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=svn
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/reaver
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=wireless
+  TITLE:=Efficient brute force attack against Wifi Protected Setup
+  URL:=https://code.google.com/p/reaver-wps/
+  DEPENDS:=+libpcap +libsqlite3
+endef
+
+define Package/reaver/description
+  Reaver targets the external registrar functionality mandated by the WiFi
+  Protected Setup specification.
+  Access points will provide authenticated registrars with their current
+  wireless configuration (including the WPA PSK), and also accept a new
+  configuration from the registrar.
+endef
+
+CONFIGURE_PATH:=src
+
+MAKE_PATH:=src
+
+TARGET_CFLAGS+=$(TARGET_CPPFLAGS)
+
+define Package/reaver/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/{reaver,wash} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/reaver
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/reaver.db $(1)/etc/reaver/
+endef
+
+$(eval $(call BuildPackage,reaver))
diff --git a/net/reaver/patches/0001-wpscrack-big-endian-fixes.patch b/net/reaver/patches/0001-wpscrack-big-endian-fixes.patch
new file mode 100644 (file)
index 0000000..da76c2e
--- /dev/null
@@ -0,0 +1,565 @@
+From 4e7af9f022996cb0a03b30f6af265b757807dfa2 Mon Sep 17 00:00:00 2001
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Wed, 27 Jun 2012 17:44:55 +0400
+Subject: [PATCH 1/3] wpscrack: big-endian fixes
+
+This should fix access to the radiotap, 802.11, LLC/SNAP and WFA
+headers' fields. Run-time tested on an ar71xx BE system.
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+---
+ src/80211.c    |   65 +++++++++++++++++++------------
+ src/builder.c  |   23 +++++------
+ src/defs.h     |  116 +++++++++++++++++++++++++++++++++++++++-----------------
+ src/exchange.c |   23 ++++++-----
+ src/wpsmon.c   |   13 ++++--
+ 5 files changed, 151 insertions(+), 89 deletions(-)
+
+diff --git a/src/80211.c b/src/80211.c
+index c2aff59..19f1e92 100644
+--- a/src/80211.c
++++ b/src/80211.c
+@@ -90,17 +90,19 @@ void read_ap_beacon()
+                 if(header.len >= MIN_BEACON_SIZE)
+                 {
+                         rt_header = (struct radio_tap_header *) radio_header(packet, header.len);
+-                        frame_header = (struct dot11_frame_header *) (packet + rt_header->len);
+-
++                      size_t rt_header_len = __le16_to_cpu(rt_header->len);
++                      frame_header = (struct dot11_frame_header *) (packet + rt_header_len);
++                      
+                       if(is_target(frame_header))
+                       {
+-                                if(frame_header->fc.type == MANAGEMENT_FRAME && frame_header->fc.sub_type == SUBTYPE_BEACON)
++                                if((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
++                                 __cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON))
+                                 {
+-                                              beacon = (struct beacon_management_frame *) (packet + rt_header->len + sizeof(struct dot11_frame_header));
++                                              beacon = (struct beacon_management_frame *) (packet + rt_header_len + sizeof(struct dot11_frame_header));
+                                               set_ap_capability(beacon->capability);
+                                       /* Obtain the SSID and channel number from the beacon packet */
+-                                      tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
++                                      tag_offset = rt_header_len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
+                                       channel = parse_beacon_tags(packet, header.len);
+                                       
+                                       /* If no channel was manually specified, switch to the AP's current channel */
+@@ -135,29 +137,31 @@ int8_t signal_strength(const u_char *packet, size_t len)
+       {
+               header = (struct radio_tap_header *) packet;
+-              if((header->flags & SSI_FLAG) == SSI_FLAG)
++              uint32_t flags = __le32_to_cpu(header->flags);
++              
++              if((flags & SSI_FLAG) == SSI_FLAG)
+               {
+-                      if((header->flags & TSFT_FLAG) == TSFT_FLAG)
++                      if((flags & TSFT_FLAG) == TSFT_FLAG)
+                       {
+                               offset += TSFT_SIZE;
+                       }
+-                      if((header->flags & FLAGS_FLAG) == FLAGS_FLAG)
++                      if((flags & FLAGS_FLAG) == FLAGS_FLAG)
+                       {
+                               offset += FLAGS_SIZE;
+                       }
+       
+-                      if((header->flags & RATE_FLAG) == RATE_FLAG)
++                      if((flags & RATE_FLAG) == RATE_FLAG)
+                       {
+                               offset += RATE_SIZE;
+                       }
+-                      if((header->flags & CHANNEL_FLAG) == CHANNEL_FLAG)
++                      if((flags & CHANNEL_FLAG) == CHANNEL_FLAG)
+                       {
+                               offset += CHANNEL_SIZE;
+                       }
+-                      if((header->flags & FHSS_FLAG) == FHSS_FLAG)
++                      if((flags & FHSS_FLAG) == FHSS_FLAG)
+                       {
+                               offset += FHSS_FLAG;
+                       }
+@@ -196,11 +200,13 @@ int is_wps_locked()
+               if(header.len >= MIN_BEACON_SIZE)
+               {
+                       rt_header = (struct radio_tap_header *) radio_header(packet, header.len);
+-                      frame_header = (struct dot11_frame_header *) (packet + rt_header->len);
++                      size_t rt_header_len = __le16_to_cpu(rt_header->len);
++                      frame_header = (struct dot11_frame_header *) (packet + rt_header_len);
+                       if(memcmp(frame_header->addr3, get_bssid(), MAC_ADDR_LEN) == 0)
+                       {
+-                              if(frame_header->fc.type == MANAGEMENT_FRAME && frame_header->fc.sub_type == SUBTYPE_BEACON)
++                                if((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
++                                 __cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON))
+                               {
+                                       if(parse_wps_parameters(packet, header.len, &wps))
+                                       {
+@@ -411,24 +417,30 @@ int associate_recv_loop()
+                 if(header.len >= MIN_AUTH_SIZE)
+                 {
+                       rt_header = (struct radio_tap_header *) radio_header(packet, header.len);
+-                        dot11_frame = (struct dot11_frame_header *) (packet + rt_header->len);
++                      size_t rt_header_len = __le16_to_cpu(rt_header->len);
++                      dot11_frame = (struct dot11_frame_header *) (packet + rt_header_len);
+                         if((memcmp(dot11_frame->addr3, get_bssid(), MAC_ADDR_LEN) == 0) &&
+                            (memcmp(dot11_frame->addr1, get_mac(), MAC_ADDR_LEN) == 0))
+                         {
+-                              if(dot11_frame->fc.type == MANAGEMENT_FRAME)
++                                if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
++                                 __cpu_to_le16(IEEE80211_FTYPE_MGMT))
+                               {
+-                                      auth_frame = (struct authentication_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header->len);
+-                                      assoc_frame = (struct association_response_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header->len);
++                                      auth_frame = (struct authentication_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header_len);
++                                      assoc_frame = (struct association_response_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header_len);
+                                       /* Did we get an authentication packet with a successful status? */
+-                                      if((dot11_frame->fc.sub_type == SUBTYPE_AUTHENTICATION) && (auth_frame->status == AUTHENTICATION_SUCCESS))
++                                      if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE)) ==
++                                         __cpu_to_le16(IEEE80211_STYPE_AUTH)
++                                         && (auth_frame->status == __cpu_to_le16(AUTHENTICATION_SUCCESS)))
+                                               {
+                                                       ret_val = AUTH_OK;
+                                                       break;
+                                               }
+                                       /* Did we get an association packet with a successful status? */
+-                                              else if((dot11_frame->fc.sub_type == SUBTYPE_ASSOCIATION) && (assoc_frame->status == ASSOCIATION_SUCCESS))
++                                              else if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE)) ==
++                                              __cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP)
++                                              && (assoc_frame->status == __cpu_to_le16(ASSOCIATION_SUCCESS)))
+                                       {
+                                               ret_val = ASSOCIATE_OK;
+                                               break;
+@@ -455,13 +467,14 @@ enum encryption_type supported_encryption(const u_char *packet, size_t len)
+       if(len > MIN_BEACON_SIZE)
+       {
+               rt_header = (struct radio_tap_header *) radio_header(packet, len);
+-              beacon = (struct beacon_management_frame *) (packet + rt_header->len + sizeof(struct dot11_frame_header));
+-              offset = tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
++              size_t rt_header_len = __le16_to_cpu(rt_header->len);
++              beacon = (struct beacon_management_frame *) (packet + rt_header_len + sizeof(struct dot11_frame_header));
++              offset = tag_offset = rt_header_len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
+               
+               tag_len = len - tag_offset;
+               tag_data = (const u_char *) (packet + tag_offset);
+-              if((beacon->capability & CAPABILITY_WEP) == CAPABILITY_WEP)
++              if((__le16_to_cpu(beacon->capability) & CAPABILITY_WEP) == CAPABILITY_WEP)
+               {
+                       enc = WEP;
+@@ -509,7 +522,7 @@ int parse_beacon_tags(const u_char *packet, size_t len)
+       struct radio_tap_header *rt_header = NULL;
+       rt_header = (struct radio_tap_header *) radio_header(packet, len);
+-      tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
++      tag_offset = __le16_to_cpu(rt_header->len) + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
+       if(tag_offset < len)
+       {
+@@ -548,7 +561,7 @@ int parse_beacon_tags(const u_char *packet, size_t len)
+               {
+                       if(ie_len  == 1)
+                       {
+-                              memcpy((int *) &channel, channel_data, ie_len);
++                              channel = *(uint8_t*)channel_data;
+                       }
+                       free(channel_data);
+               }
+@@ -603,13 +616,13 @@ int check_fcs(const u_char *packet, size_t len)
+       if(len > 4)
+       {
+               /* Get the packet's reported FCS (last 4 bytes of the packet) */
+-              memcpy((uint32_t *) &fcs, (packet + (len-4)), 4);
++              fcs = __le32_to_cpu(*(uint32_t*)(packet + (len-4)));
+               /* FCS is not calculated over the radio tap header */
+               if(has_rt_header())
+               {
+                       rt_header = (struct radio_tap_header *) packet;
+-                      offset += rt_header->len;
++                      offset += __le16_to_cpu(rt_header->len);
+               }
+               if(len > offset)
+diff --git a/src/builder.c b/src/builder.c
+index 37f2de7..6bf89e7 100644
+--- a/src/builder.c
++++ b/src/builder.c
+@@ -44,9 +44,8 @@ const void *build_radio_tap_header(size_t *len)
+               memset((void *) buf, 0, sizeof(struct radio_tap_header));
+               rt_header = (struct radio_tap_header *) buf;
+-              rt_header->len = sizeof(struct radio_tap_header);
+-      
+-              *len = rt_header->len;
++              *len = sizeof(struct radio_tap_header);
++              rt_header->len = __cpu_to_le16(*len);
+       }
+       
+       return buf;
+@@ -67,9 +66,9 @@ const void *build_dot11_frame_header(uint16_t fc, size_t *len)
+       
+               frag_seq += SEQ_MASK;
+-              header->duration = DEFAULT_DURATION;
+-              memcpy((void *) &header->fc, (void *) &fc, sizeof(struct frame_control));
+-              header->frag_seq = frag_seq;
++              header->duration = __cpu_to_le16(DEFAULT_DURATION);
++              header->fc = __cpu_to_le16(fc);
++              header->frag_seq = __cpu_to_le16(frag_seq);
+               memcpy((void *) header->addr1, get_bssid(), MAC_ADDR_LEN);
+               memcpy((void *) header->addr2, get_mac(), MAC_ADDR_LEN);
+@@ -91,8 +90,8 @@ const void *build_authentication_management_frame(size_t *len)
+               memset((void *) buf, 0, *len);
+               frame = (struct authentication_management_frame *) buf;
+-              frame->algorithm = OPEN_SYSTEM;
+-              frame->sequence = 1;
++              frame->algorithm = __cpu_to_le16(OPEN_SYSTEM);
++              frame->sequence = __cpu_to_le16(1);
+               frame->status = 0;
+       }
+       
+@@ -111,8 +110,8 @@ const void *build_association_management_frame(size_t *len)
+               memset((void *) buf, 0, *len);
+               frame = (struct association_request_management_frame *) buf;
+-              frame->capability = get_ap_capability();
+-              frame->listen_interval = LISTEN_INTERVAL;
++              frame->capability = __cpu_to_le16(get_ap_capability());
++              frame->listen_interval = __cpu_to_le16(LISTEN_INTERVAL);
+       }
+       return buf;
+@@ -133,7 +132,7 @@ const void *build_llc_header(size_t *len)
+               header->dsap = LLC_SNAP;
+               header->ssap = LLC_SNAP;
+               header->control_field = UNNUMBERED_FRAME;
+-              header->type = DOT1X_AUTHENTICATION;
++              header->type = __cpu_to_be16(DOT1X_AUTHENTICATION);
+       }
+@@ -279,7 +278,7 @@ const void *build_wfa_header(uint8_t op_code, size_t *len)
+               header = (struct wfa_expanded_header *) buf;
+       
+               memcpy(header->id, WFA_VENDOR_ID, sizeof(header->id));
+-              header->type = SIMPLE_CONFIG;
++              header->type = __cpu_to_be32(SIMPLE_CONFIG);
+               header->opcode = op_code;
+       }
+       
+diff --git a/src/defs.h b/src/defs.h
+index b2f45ea..0c628e7 100644
+--- a/src/defs.h
++++ b/src/defs.h
+@@ -41,6 +41,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <pcap.h>
++#include <asm/byteorder.h>
+ #include "wps.h"
+@@ -65,10 +66,10 @@
+ #define MANAGEMENT_FRAME      0x00
+ #define SUBTYPE_BEACON                0x08
+-#define DOT1X_AUTHENTICATION  0x8E88
++#define DOT1X_AUTHENTICATION  0x888E
+ #define DOT1X_EAP_PACKET      0x00
+-#define SIMPLE_CONFIG         0x01000000
++#define SIMPLE_CONFIG         0x00000001
+ #define P1_SIZE                       10000
+ #define P2_SIZE                       1000
+@@ -282,66 +283,111 @@ enum wfa_elements
+       WEP_TRANSMIT_KEY = 0x10064
+ };
++#define IEEE80211_FCTL_VERS           0x0003
++#define IEEE80211_FCTL_FTYPE          0x000c
++#define IEEE80211_FCTL_STYPE          0x00f0
++#define IEEE80211_FCTL_TODS           0x0100
++#define IEEE80211_FCTL_FROMDS         0x0200
++#define IEEE80211_FCTL_MOREFRAGS      0x0400
++#define IEEE80211_FCTL_RETRY          0x0800
++#define IEEE80211_FCTL_PM             0x1000
++#define IEEE80211_FCTL_MOREDATA               0x2000
++#define IEEE80211_FCTL_PROTECTED      0x4000
++#define IEEE80211_FCTL_ORDER          0x8000
++
++#define IEEE80211_SCTL_FRAG           0x000F
++#define IEEE80211_SCTL_SEQ            0xFFF0
++
++#define IEEE80211_FTYPE_MGMT          0x0000
++#define IEEE80211_FTYPE_CTL           0x0004
++#define IEEE80211_FTYPE_DATA          0x0008
++
++/* management */
++#define IEEE80211_STYPE_ASSOC_REQ     0x0000
++#define IEEE80211_STYPE_ASSOC_RESP    0x0010
++#define IEEE80211_STYPE_REASSOC_REQ   0x0020
++#define IEEE80211_STYPE_REASSOC_RESP  0x0030
++#define IEEE80211_STYPE_PROBE_REQ     0x0040
++#define IEEE80211_STYPE_PROBE_RESP    0x0050
++#define IEEE80211_STYPE_BEACON                0x0080
++#define IEEE80211_STYPE_ATIM          0x0090
++#define IEEE80211_STYPE_DISASSOC      0x00A0
++#define IEEE80211_STYPE_AUTH          0x00B0
++#define IEEE80211_STYPE_DEAUTH                0x00C0
++#define IEEE80211_STYPE_ACTION                0x00D0
++
++/* control */
++#define IEEE80211_STYPE_BACK_REQ      0x0080
++#define IEEE80211_STYPE_BACK          0x0090
++#define IEEE80211_STYPE_PSPOLL                0x00A0
++#define IEEE80211_STYPE_RTS           0x00B0
++#define IEEE80211_STYPE_CTS           0x00C0
++#define IEEE80211_STYPE_ACK           0x00D0
++#define IEEE80211_STYPE_CFEND         0x00E0
++#define IEEE80211_STYPE_CFENDACK      0x00F0
++
++/* data */
++#define IEEE80211_STYPE_DATA                  0x0000
++#define IEEE80211_STYPE_DATA_CFACK            0x0010
++#define IEEE80211_STYPE_DATA_CFPOLL           0x0020
++#define IEEE80211_STYPE_DATA_CFACKPOLL                0x0030
++#define IEEE80211_STYPE_NULLFUNC              0x0040
++#define IEEE80211_STYPE_CFACK                 0x0050
++#define IEEE80211_STYPE_CFPOLL                        0x0060
++#define IEEE80211_STYPE_CFACKPOLL             0x0070
++#define IEEE80211_STYPE_QOS_DATA              0x0080
++#define IEEE80211_STYPE_QOS_DATA_CFACK                0x0090
++#define IEEE80211_STYPE_QOS_DATA_CFPOLL               0x00A0
++#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL    0x00B0
++#define IEEE80211_STYPE_QOS_NULLFUNC          0x00C0
++#define IEEE80211_STYPE_QOS_CFACK             0x00D0
++#define IEEE80211_STYPE_QOS_CFPOLL            0x00E0
++#define IEEE80211_STYPE_QOS_CFACKPOLL         0x00F0
++
+ #pragma pack(1)
+ struct radio_tap_header
+ {
+       uint8_t revision;       
+       uint8_t pad;
+-      uint16_t len;
+-      uint32_t flags;
+-};
+-
+-struct frame_control
+-{
+-        unsigned version : 2;
+-        unsigned type : 2;
+-        unsigned sub_type : 4;
+-
+-        unsigned to_ds : 1;
+-        unsigned from_ds : 1;
+-        unsigned more_frag : 1;
+-        unsigned retry : 1;
+-        unsigned pwr_mgt : 1;
+-        unsigned more_data : 1;
+-        unsigned protected_frame : 1;
+-        unsigned order : 1;
++      __le16 len;
++      __le32 flags;
+ };
+ struct dot11_frame_header
+ {
+-      struct frame_control fc;
+-        uint16_t duration;
++      __le16 fc;
++      __le16 duration;
+       unsigned char addr1[MAC_ADDR_LEN];
+       unsigned char addr2[MAC_ADDR_LEN];
+       unsigned char addr3[MAC_ADDR_LEN];
+-      uint16_t frag_seq;
++      __le16 frag_seq;
+ };
+ struct authentication_management_frame
+ {
+-      uint16_t algorithm;
+-      uint16_t sequence;
+-      uint16_t status;
++      __le16 algorithm;
++      __le16 sequence;
++      __le16 status;
+ };
+ struct association_request_management_frame
+ {
+-      uint16_t capability;
+-      uint16_t listen_interval;
++      __le16 capability;
++      __le16 listen_interval;
+ };
+ struct association_response_management_frame
+ {
+-      uint16_t capability;
+-      uint16_t status;
+-      uint16_t id;
++      __le16 capability;
++      __le16 status;
++      __le16 id;
+ };
+ struct beacon_management_frame
+ {
+       unsigned char timestamp[TIMESTAMP_LEN];
+-      uint16_t beacon_interval;
+-      uint16_t capability;
++      __le16 beacon_interval;
++      __le16 capability;
+ };
+ struct llc_header
+@@ -350,7 +396,7 @@ struct llc_header
+       uint8_t ssap;
+       uint8_t control_field;
+       unsigned char org_code[3];
+-      uint16_t type;
++      __be16 type;
+ };
+ struct dot1X_header
+@@ -371,7 +417,7 @@ struct eap_header
+ struct wfa_expanded_header
+ {
+       unsigned char id[3];
+-      uint32_t type;
++      __be32 type;
+       uint8_t opcode;
+       uint8_t flags;
+ };
+diff --git a/src/exchange.c b/src/exchange.c
+index 23c87e9..4f9a82b 100644
+--- a/src/exchange.c
++++ b/src/exchange.c
+@@ -306,26 +306,27 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+       /* Cast the radio tap and 802.11 frame headers and parse out the Frame Control field */
+       rt_header = (struct radio_tap_header *) packet;
+-      frame_header = (struct dot11_frame_header *) (packet+rt_header->len);
++      size_t rt_header_len = __le16_to_cpu(rt_header->len);
++      frame_header = (struct dot11_frame_header *) (packet+rt_header_len);
+       /* Does the BSSID/source address match our target BSSID? */
+       if(memcmp(frame_header->addr3, get_bssid(), MAC_ADDR_LEN) == 0)
+       {
+               /* Is this a data packet sent to our MAC address? */
+-              if(frame_header->fc.type == DATA_FRAME && 
+-                      frame_header->fc.sub_type == SUBTYPE_DATA && 
+-                      (memcmp(frame_header->addr1, get_mac(), MAC_ADDR_LEN) == 0)) 
++              if (((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
++                   __cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)) &&
++                  (memcmp(frame_header->addr1, get_mac(), MAC_ADDR_LEN) == 0)) 
+               {
+                       llc = (struct llc_header *) (packet +
+-                                                      rt_header->len +
++                                                      rt_header_len +
+                                                       sizeof(struct dot11_frame_header)
+                       );
+                       /* All packets in our exchanges will be 802.1x */
+-                      if(llc->type == DOT1X_AUTHENTICATION)
++                      if(llc->type == __cpu_to_be16(DOT1X_AUTHENTICATION))
+                       {
+                               dot1x = (struct dot1X_header *) (packet +
+-                                                              rt_header->len +
++                                                              rt_header_len +
+                                                               sizeof(struct dot11_frame_header) +
+                                                               sizeof(struct llc_header)
+                               );
+@@ -334,7 +335,7 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+                               if(dot1x->type == DOT1X_EAP_PACKET && (header->len >= EAP_PACKET_SIZE))
+                               {
+                                       eap = (struct eap_header *) (packet +
+-                                                                      rt_header->len +
++                                                                      rt_header_len +
+                                                                       sizeof(struct dot11_frame_header) +
+                                                                       sizeof(struct llc_header) +
+                                                                       sizeof(struct dot1X_header)
+@@ -366,7 +367,7 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+                                               else if((eap->type == EAP_EXPANDED) && (header->len > WFA_PACKET_SIZE))
+                                               {
+                                                       wfa = (struct wfa_expanded_header *) (packet +
+-                                                                                      rt_header->len +
++                                                                                      rt_header_len +
+                                                                                       sizeof(struct dot11_frame_header) +
+                                                                                       sizeof(struct llc_header) +
+                                                                                       sizeof(struct dot1X_header) +
+@@ -374,14 +375,14 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+                                                       );
+                                               
+                                                       /* Verify that this is a WPS message */
+-                                                      if(wfa->type == SIMPLE_CONFIG)
++                                                      if(wfa->type == __cpu_to_be32(SIMPLE_CONFIG))
+                                                       {
+                                                               wps_msg_len =   (size_t) ntohs(eap->len) - 
+                                                                               sizeof(struct eap_header) - 
+                                                                               sizeof(struct wfa_expanded_header);
+                                                               wps_msg = (const void *) (packet +
+-                                                                                      rt_header->len +
++                                                                                      rt_header_len +
+                                                                                               sizeof(struct dot11_frame_header) +
+                                                                                               sizeof(struct llc_header) +
+                                                                                               sizeof(struct dot1X_header) +
+diff --git a/src/wpsmon.c b/src/wpsmon.c
+index d976924..22a394f 100644
+--- a/src/wpsmon.c
++++ b/src/wpsmon.c
+@@ -295,7 +295,8 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+         }
+       rt_header = (struct radio_tap_header *) radio_header(packet, header->len);
+-      frame_header = (struct dot11_frame_header *) (packet + rt_header->len);
++      size_t rt_header_len = __le16_to_cpu(rt_header->len);
++      frame_header = (struct dot11_frame_header *) (packet + rt_header_len);
+       /* If a specific BSSID was specified, only parse packets from that BSSID */
+       if(!is_target(frame_header))
+@@ -323,15 +324,17 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+                               channel_changed = 1;
+                       }
+-                      if(frame_header->fc.sub_type == PROBE_RESPONSE ||
+-                                   frame_header->fc.sub_type == SUBTYPE_BEACON)
++                      unsigned fsub_type = frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE);
++
++                      if(fsub_type == __cpu_to_le16(IEEE80211_STYPE_PROBE_RESP) ||
++                         fsub_type == __cpu_to_le16(IEEE80211_STYPE_BEACON))
+                       {
+                               wps_parsed = parse_wps_parameters(packet, header->len, wps);
+                       }
+       
+                       if(!is_done(bssid) && (get_channel() == channel || source == PCAP_FILE))
+                       {
+-                              if(frame_header->fc.sub_type == SUBTYPE_BEACON && 
++                              if(fsub_type == __cpu_to_le16(IEEE80211_STYPE_BEACON) && 
+                                  mode == SCAN && 
+                                  !passive && 
+                                  should_probe(bssid))
+@@ -369,7 +372,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+                                * If there was no WPS information, then the AP does not support WPS and we should ignore it from here on.
+                                * If this was a probe response, then we've gotten all WPS info we can get from this AP and should ignore it from here on.
+                                */
+-                              if(!wps_parsed || frame_header->fc.sub_type == PROBE_RESPONSE)
++                              if(!wps_parsed || fsub_type == __cpu_to_le16(IEEE80211_STYPE_PROBE_RESP))
+                               {
+                                       mark_ap_complete(bssid);
+                               }
+-- 
+1.7.7
+
diff --git a/net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch b/net/reaver/patches/0002-Use-the-current-directory-for-storing-and-loading-se.patch
new file mode 100644 (file)
index 0000000..dd1bb42
--- /dev/null
@@ -0,0 +1,53 @@
+From cd444949f3176790101b8bdc9656831a03d8c01d Mon Sep 17 00:00:00 2001
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Tue, 10 Jul 2012 11:13:29 +0400
+Subject: [PATCH 2/3] Use the current directory for storing and loading
+ sessions
+
+This allows the user to always explicitely choose (by changing the
+current directory before launching the program) where the session
+files should go. Useful e.g. to avoid hogging the precious space on
+embedded devices, just cd /tmp before starting the app.
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+---
+ src/session.c |   16 +++-------------
+ 1 files changed, 3 insertions(+), 13 deletions(-)
+
+diff --git a/src/session.c b/src/session.c
+index d3af0c3..308f213 100644
+--- a/src/session.c
++++ b/src/session.c
+@@ -62,7 +62,7 @@ int restore_session()
+               memset(file, 0, FILENAME_MAX);
+               bssid = mac2str(get_bssid(), '\0');
+-              snprintf(file, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT);
++              snprintf(file, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
+               free(bssid);
+       }
+@@ -199,18 +199,8 @@ int save_session()
+               }
+               else
+               {       
+-                      /* 
+-                       * If the configuration directory exists, save the session file there; else, save it to the 
+-                       * current working directory.
+-                       */
+-                      if(configuration_directory_exists())
+-                      {
+-                              snprintf((char *) &file_name, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT);
+-                      }
+-                      else
+-                      {
+-                              snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
+-                      }
++                      /* save session to the current directory */
++                      snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
+               }
+               /* Don't bother saving anything if nothing has been done */
+-- 
+1.7.7
+
diff --git a/net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch b/net/reaver/patches/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch
new file mode 100644 (file)
index 0000000..64b290b
--- /dev/null
@@ -0,0 +1,38 @@
+From 638bb8d70d6c7e5dc99975e0bf57d8ce0455e2cc Mon Sep 17 00:00:00 2001
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Tue, 10 Jul 2012 11:25:00 +0400
+Subject: [PATCH 3/3] wash/wpsmon: use less useless spaces in output to fit
+ narrow terminals
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+---
+ src/wpsmon.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/wpsmon.c b/src/wpsmon.c
+index 22a394f..e0948b3 100644
+--- a/src/wpsmon.c
++++ b/src/wpsmon.c
+@@ -262,8 +262,8 @@ void monitor(char *bssid, int passive, int source, int channel, int mode)
+       if(!header_printed)
+       {
+-              cprintf(INFO, "BSSID                  Channel       RSSI       WPS Version       WPS Locked        ESSID\n");
+-              cprintf(INFO, "---------------------------------------------------------------------------------------------------------------\n");
++              cprintf(INFO, "BSSID              Channel  RSSI  WPS Version  WPS Locked  ESSID\n");
++              cprintf(INFO, "--------------------------------------------------------------------------------------\n");
+               header_printed = 1;
+       }
+@@ -360,7 +360,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+                                                       break;
+                                       }
+-                                      cprintf(INFO, "%17s      %2d            %.2d        %d.%d               %s               %s\n", bssid, channel, rssi, (wps->version >> 4), (wps->version & 0x0F), lock_display, ssid);
++                                      cprintf(INFO, "%17s    %2d       %.2d   %d.%d          %s         %s\n", bssid, channel, rssi, (wps->version >> 4), (wps->version & 0x0F), lock_display, ssid);
+                               }
+                               if(probe_sent)
+-- 
+1.7.7
+
diff --git a/net/redir/Makefile b/net/redir/Makefile
new file mode 100644 (file)
index 0000000..c822b8c
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2009 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:=redir
+PKG_VERSION:=2.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://sammy.net/~sammy/hacks
+PKG_MD5SUM:=4342fadac30504c86c8db7beefe01995
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/redir
+       SECTION:=net
+       CATEGORY:=Network
+       SUBMENU:=Routing and Redirection
+       TITLE=Redirect TCP connections
+       URL:=http://sammy.net/~sammy/hacks
+endef
+
+define Package/redir/description
+ A port redirector, used to forward incoming connections to somewhere else.
+endef
+
+define Package/redir/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/redir $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,redir))
diff --git a/net/redir/patches/00_honor_copts.patch b/net/redir/patches/00_honor_copts.patch
new file mode 100644 (file)
index 0000000..dfd6b46
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ruN a/Makefile b/Makefile
+--- a/Makefile 2009-05-07 14:31:14.000000000 +0100
++++ b/Makefile 2009-05-07 14:31:47.000000000 +0100
+@@ -32,7 +32,7 @@
+ # if your system lacks getopt_long, remove the comment from this line
+ OBJS = redir.o $(GETOPT_OBJS)
+-CFLAGS = -O2 -Wall $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
++CFLAGS += -Wall $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
+ LDFLAGS = -s
+ # solaris, and others, may also need these libraries to link
diff --git a/net/redir/patches/01_fix_max_bandwidth_docs.patch b/net/redir/patches/01_fix_max_bandwidth_docs.patch
new file mode 100644 (file)
index 0000000..378061c
--- /dev/null
@@ -0,0 +1,54 @@
+diff -Nur a/redir.c b/redir.c
+--- a/redir.c  1999-12-26 15:50:06.000000000 -0500
++++ b/redir.c  2005-10-22 21:21:56.849499952 -0400
+@@ -233,7 +233,7 @@
+ #ifndef NO_SHAPER
+         /* options for bandwidth */
+         fprintf(stderr, "\t\t--bufsize=<octets>\tsize of the buffer\n");
+-        fprintf(stderr, "\t\t--maxbandwidth=<bit-per-sec>\tlimit the bandwidth\n");
++        fprintf(stderr, "\t\t--max_bandwidth=<bit-per-sec>\tlimit the bandwidth\n");
+         fprintf(stderr, "\t\t--random_wait=<millisec>\twait before each packet\n");
+         fprintf(stderr, "\t\t--wait_in_out=<flag>\t1 wait for in, 2 out, 3 in&out\n");
+         /* end options for bandwidth */
+diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
+--- redir-2.2.1~/redir.man     1999-12-26 15:52:24.000000000 -0500
++++ redir-2.2.1/redir.man      2005-10-22 21:22:28.882630176 -0400
+@@ -18,7 +18,7 @@
+ .I --lport=port
+ .I --cport=port
+ .RB [ \--bufsize=n ]
+-.RB [ \--maxbandwidth=n ]
++.RB [ \--max_bandwidth=n ]
+ .RB [ \--random_wait=n ]
+ .RB [ \--wait_in_out=n ]
+ .ll -8
+@@ -35,7 +35,7 @@
+ .RB [ \--connect=host:port ]
+ .I --cport=port
+ .RB [ \--bufsize=n ]
+-.RB [ \--maxbandwidth=n ]
++.RB [ \--max_bandwidth=n ]
+ .RB [ \--random_wait=n ]
+ .RB [ \--wait_in_out=n ]
+ .ll -8
+@@ -102,9 +102,9 @@
+ .TP
+ .B \--bufsize n
+ Set the bufsize (defaut 4096) in bytes. Can be used combined with
+---maxbandwidth or --random_wait to simulate a slow connection.
++--max_bandwidth or --random_wait to simulate a slow connection.
+ .TP
+-.B \--maxbandwidth n
++.B \--max_bandwidth n
+ Reduce the bandwidth to be no more than n bits/sec.  The algorithme is
+ basic, the goal is to simulate a slow connection, so there is no pic
+ acceptance.
+@@ -115,7 +115,7 @@
+ than the bufsize (see also --bufsize).
+ .TP
+ .B \--wait_in_out n
+-Apply --maxbandwidth and --random_wait for input if n=1, output if n=2 and
++Apply --max_bandwidth and --random_wait for input if n=1, output if n=2 and
+ both if n=3.
+ .SH "SEE ALSO"
+ inetd(1)
diff --git a/net/redir/patches/02_use_ntohs.patch b/net/redir/patches/02_use_ntohs.patch
new file mode 100644 (file)
index 0000000..a6b9f0f
--- /dev/null
@@ -0,0 +1,43 @@
+diff -Nur a/redir.c b/redir.c
+--- a/redir.c  1999-12-26 15:50:06.000000000 -0500
++++ b/redir.c  2005-10-22 21:29:55.491735272 -0400
+@@ -745,7 +745,7 @@
+       }
+      
+       debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
+-      debug1("peer socket is %d\n", client.sin_port);
++      debug1("peer socket is %d\n", ntohs(client.sin_port));
+       /*
+        * Double fork here so we don't have to wait later
+@@ -871,8 +871,8 @@
+               strcpy(tmp2, inet_ntoa(target->sin_addr));
+         
+               syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
+-                     tmp1, client.sin_port,
+-                     tmp2, target->sin_port);
++                     tmp1, ntohs(client.sin_port),
++                     tmp2, ntohs(target->sin_port));
+       }
+       /* do proxy stuff */
+@@ -1066,7 +1066,7 @@
+               if (!getpeername(0, (struct sockaddr *) &client, &client_size)) {
+                       debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
+-                      debug1("peer socket is %d\n", client.sin_port);
++                      debug1("peer socket is %d\n", ntohs(client.sin_port));
+               }
+               if ((targetsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+                       perror("target: socket");
+@@ -1109,8 +1109,8 @@
+               if (dosyslog) {
+                       syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
+-                             inet_ntoa(client.sin_addr), client.sin_port,
+-                             target_ip, target.sin_port);
++                             inet_ntoa(client.sin_addr), ntohs(client.sin_port),
++                             target_ip, ntohs(target.sin_port));
+               }
+               /* Just start copying - one side of the loop is stdin - 0 */
diff --git a/net/redir/patches/03_fix_tcp_wrappers.patch b/net/redir/patches/03_fix_tcp_wrappers.patch
new file mode 100644 (file)
index 0000000..3718c65
--- /dev/null
@@ -0,0 +1,25 @@
+diff -Nur a/redir.c b/redir.c
+--- a/redir.c  2005-10-22 22:10:11.439455392 -0400
++++ b/redir.c  2005-10-22 22:10:51.625346208 -0400
+@@ -802,8 +802,8 @@
+ #ifdef USE_TCP_WRAPPERS
+       request_init(&request, RQ_DAEMON, ident, RQ_FILE, clisock, 0);
+       sock_host(&request);
+-      sock_hostname(&request);
+-      sock_hostaddr(&request);
++      sock_hostname(request.client);
++      sock_hostaddr(request.client);
+       if (!hosts_access(&request)) {
+               refuse(&request);
+@@ -1057,8 +1057,8 @@
+ #ifdef USE_TCP_WRAPPERS
+               request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
+               sock_host(&request);
+-              sock_hostname(&request);
+-              sock_hostaddr(&request);
++              sock_hostname(request.client);
++              sock_hostaddr(request.client);
+       
+               if (!hosts_access(&request))
+                       refuse(&request);
diff --git a/net/redir/patches/04_fix_timeouts.patch b/net/redir/patches/04_fix_timeouts.patch
new file mode 100644 (file)
index 0000000..45bba9b
--- /dev/null
@@ -0,0 +1,38 @@
+diff -Nur a/redir.c b/redir.c
+--- a/redir.c  2005-10-22 22:44:39.504061784 -0400
++++ b/redir.c  2005-10-22 22:47:14.746461352 -0400
+@@ -598,10 +598,6 @@
+       /* Record start time */
+       start_time = (unsigned int) time(NULL);
+-      /* Set up timeout */
+-      timeout.tv_sec = timeout_secs;
+-      timeout.tv_usec = 0;
+-
+       /* file descriptor bits */
+       FD_ZERO(&iofds);
+       FD_SET(insock, &iofds);
+@@ -618,14 +614,21 @@
+       while(1) {
+               (void) memcpy(&c_iofds, &iofds, sizeof(iofds));
++              /* Set up timeout, Linux returns seconds left in this structure
++               * so we have to reset it before each select(). */
++              timeout.tv_sec = timeout_secs;
++              timeout.tv_usec = 0;
++
+               if (select(max_fd + 1,
+                          &c_iofds,
+                          (fd_set *)0,
+                          (fd_set *)0,
+                          (timeout_secs ? &timeout : NULL)) <= 0) {
+-                      /*          syslog(LLEV,"connection timeout: %d sec",timeout.tv_sec);*/
+-                      break;
++                if (dosyslog) {
++                  syslog(LOG_NOTICE,"connection timeout: %d sec",timeout_secs);
++                }
++                break;
+               }
+               if(FD_ISSET(insock, &c_iofds)) {
diff --git a/net/redir/patches/06_fix_shaper_buffer.patch b/net/redir/patches/06_fix_shaper_buffer.patch
new file mode 100644 (file)
index 0000000..8cbe723
--- /dev/null
@@ -0,0 +1,56 @@
+diff -Nur a/redir.c b/redir.c
+--- a/redir.c  2005-10-22 23:20:05.235901424 -0400
++++ b/redir.c  2005-10-22 23:22:20.198384008 -0400
+@@ -259,7 +259,7 @@
+ #endif
+          int *transproxy,
+ #ifndef NO_SHAPER
+-           unsigned int * bufsize,
++           unsigned int * bufsizeout,
+            int * max_bandwidth,
+            int * random_wait,
+            int * wait_in_out,
+@@ -366,7 +366,7 @@
+ #ifndef NO_SHAPER
+                 case 'z':
+-                  *bufsize = (unsigned int)atol(optarg);
++                  *bufsizeout = (unsigned int)atol(optarg);
+                   break;
+  
+                 case 'm':
+@@ -593,7 +593,7 @@
+       unsigned long bytes_in = 0;
+       unsigned long bytes_out = 0;
+       unsigned int start_time, end_time;
+-      char buf[bufsize];
++      char* buf = malloc(bufsize);
+       /* Record start time */
+       start_time = (unsigned int) time(NULL);
+@@ -632,7 +632,7 @@
+               }
+               if(FD_ISSET(insock, &c_iofds)) {
+-                      if((bytes = read(insock, buf, sizeof(buf))) <= 0)
++                      if((bytes = read(insock, buf, bufsize)) <= 0)
+                               break;
+ #ifndef NO_FTP
+                       if (ftp & FTP_PORT)
+@@ -647,7 +647,7 @@
+                       bytes_out += bytes;
+               }
+               if(FD_ISSET(outsock, &c_iofds)) {
+-                      if((bytes = read(outsock, buf, sizeof(buf))) <= 0)
++                      if((bytes = read(outsock, buf, bufsize)) <= 0)
+                               break;
+                       /* if we're correcting for PASV on ftp redirections, then
+                          fix buf and bytes to have the new address, among other
+@@ -684,6 +684,7 @@
+               syslog(LOG_NOTICE, "disconnect %d secs, %ld in %ld out",
+                      (end_time - start_time), bytes_in, bytes_out);
+       }
++      free(buf);
+       return;
+ }
diff --git a/net/redsocks/Makefile b/net/redsocks/Makefile
new file mode 100644 (file)
index 0000000..64c5e81
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2012 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:=redsocks
+PKG_VERSION:=0.4
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/darkk/redsocks.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=a9cfd090119385a1ef973baf94342a2db20595b9
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/redsocks
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  DEPENDS:=+libevent2
+  TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server
+endef
+
+define Package/redsocks/description
+  Redsocks is a daemon running on the local system, that will transparently
+  tunnel any TCP connection via a remote SOCKS4, SOCKS5 or HTTP proxy server. It
+  uses the system firewall's redirection facility to intercept TCP connections,
+  thus the redirection is system-wide, with fine-grained control, and does
+  not depend on LD_PRELOAD libraries.
+
+  Redsocks supports tunneling TCP connections and UDP packets. It has
+  authentication support for both, SOCKS and HTTP proxies.
+
+  Also included is a small DNS server returning answers with the "truncated" flag
+  set for any UDP query, forcing the resolver to use TCP.
+endef
+
+define Package/redsocks/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/redsocks $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/redsocks.init $(1)/etc/init.d/redsocks
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/redsocks.conf.example $(1)/etc/redsocks.conf
+endef
+
+$(eval $(call BuildPackage,redsocks))
diff --git a/net/redsocks/files/redsocks.init b/net/redsocks/files/redsocks.init
new file mode 100644 (file)
index 0000000..244d3a2
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+
+START=80
+APP=redsocks
+PID_FILE=/var/run/$APP.pid
+
+start() {
+        start-stop-daemon -S -x $APP -p $PID_FILE -m -b -- -c /etc/redsocks.conf
+}
+
+stop() {
+        start-stop-daemon -K -n $APP -p $PID_FILE -s TERM
+        rm -rf $PID_FILE
+}
diff --git a/net/redsocks/patches/010-fix-undeclared.diff b/net/redsocks/patches/010-fix-undeclared.diff
new file mode 100644 (file)
index 0000000..0f41e5c
--- /dev/null
@@ -0,0 +1,28 @@
+diff -ur redsocks-0.4.orig/redudp.c redsocks-0.4/redudp.c
+--- redsocks-0.4.orig/redudp.c 2012-07-27 20:30:40.283988208 +0200
++++ redsocks-0.4/redudp.c      2012-07-27 20:31:35.759985938 +0200
+@@ -33,6 +33,10 @@
+ #include "redsocks.h"
+ #include "redudp.h"
++#define IP_ORIGDSTADDR 20
++#define IP_TRANSPARENT 19
++#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
++
+ #define redudp_log_error(client, prio, msg...) \
+       redsocks_log_write_plain(__FILE__, __LINE__, __func__, 0, &(client)->clientaddr, get_destaddr(client), prio, ## msg)
+ #define redudp_log_errno(client, prio, msg...) \
+diff -ur redsocks-0.4.orig/utils.c redsocks-0.4/utils.c
+--- redsocks-0.4.orig/utils.c  2012-07-27 20:30:40.283988208 +0200
++++ redsocks-0.4/utils.c       2012-07-27 20:31:20.075986580 +0200
+@@ -26,6 +26,10 @@
+ #include "utils.h"
+ #include "redsocks.h" // for redsocks_close
++#define IP_ORIGDSTADDR 20
++#define IP_TRANSPARENT 19
++#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
++
+ int red_recv_udp_pkt(int fd, char *buf, size_t buflen, struct sockaddr_in *inaddr, struct sockaddr_in *toaddr)
+ {
+       socklen_t addrlen = sizeof(*inaddr);
diff --git a/net/remotefs/Makefile b/net/remotefs/Makefile
new file mode 100644 (file)
index 0000000..5648ae3
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2006-2012 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:=remotefs
+PKG_REV:=1.0
+PKG_VERSION:=$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=remotefs-$(PKG_VERSION)
+PKG_SOURCE_URL:=git://git.code.sf.net/p/remotefs/git
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+include $(INCLUDE_DIR)/package.mk
+
+define Package/remotefs
+  TITLE:=RemoteFS
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  DEPENDS:=+libfuse +libpthread
+  URL:=http://remotefs.sourceforge.net
+endef
+
+define Package/remotefs/description
+  remotefs is a network file system designed for use with home NAS.
+  Simple to use, few dependencies, reasonable security, completely
+  in user space. Provided remotefs-server package contains server
+  components.
+endef
+
+define Package/remotefs-server
+  $(call Package/remotefs)
+  TITLE:=RemoteFS server
+  DEPENDS:=
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               INSTALL_DIR="$(PKG_INSTALL_DIR)" \
+               HOST_CPU="$(ARCH)" \
+               CFLAGS_RELEASE="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
+               LDFLAGS_RELEASE="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
+               server client install_client install_server
+endef
+
+define Package/remotefs/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/rfs $(1)/bin/rfs
+       $(INSTALL_DIR) $(1)/lib
+       $(CP) $(PKG_INSTALL_DIR)/lib/librfs.so.* $(1)/lib
+endef
+
+define Package/remotefs-server/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/rfsd $(1)/bin/rfsd
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/rfspasswd $(1)/bin/rfspasswd
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/etc/rfs-exports $(1)/etc/rfs-exports
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rfsd $(1)/etc/init.d/rfsd
+endef
+
+define Package/remotefs-server/conffiles
+/etc/rfs-exports
+endef
+
+$(eval $(call BuildPackage,remotefs))
+$(eval $(call BuildPackage,remotefs-server))
diff --git a/net/remotefs/files/rfsd b/net/remotefs/files/rfsd
new file mode 100755 (executable)
index 0000000..c451c70
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+
+# Author: Oskari Rauta <oskari.rauta@gmail.com>
+
+START=50
+
+LISTEN=$(ifconfig br-lan | sed -n 's/.*dr:\(.*\)Bc.*/\1/p')
+PORT="5001"
+RFSD_USER="root"
+PIDFILE="/var/run/rfsd.pid"
+#QUIET="-q"
+
+start()
+{
+       rfsd -a ${LISTEN} -p ${PORT} -u ${RFSD_USER} -r ${PIDFILE} ${QUIET}
+}
+
+stop()
+{
+       killall rfsd
+}
+
+reload()
+{
+       kill -HUP `cat ${PIDFILE}` \
+       && rfsd -a ${LISTEN} -p ${PORT} -u ${RFSD_USER} -r ${PIDFILE} ${QUIET}
+}
diff --git a/net/remserial/Makefile b/net/remserial/Makefile
new file mode 100644 (file)
index 0000000..4036c75
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2014 nunojpg@gmail.com
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=remserial
+PKG_VERSION:=1.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://lpccomp.bc.ca/remserial/
+PKG_MD5SUM:=b19b57fd118329c5ea3aaf9887f946a6
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/remserial
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Bridge TCP/IP port with a device
+  URL:=http://lpccomp.bc.ca/remserial/
+endef
+
+define Package/remserial/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/remserial $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,remserial))
diff --git a/net/rinetd/Makefile b/net/rinetd/Makefile
new file mode 100755 (executable)
index 0000000..9fbb000
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2009-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:=rinetd
+PKG_VERSION:=0.62
+PKG_RELEASE:=2
+
+PKG_SOURCE:=rinetd.tar.gz
+PKG_SOURCE_URL:=http://www.boutell.com/rinetd/http
+PKG_MD5SUM:=28c78bac648971724c46f1a921154c4f
+PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rinetd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  TITLE:=rinetd - Internet Redirection Server
+  URL:=http://www.boutell.com/rinetd/
+endef
+
+define Package/rinetd/conffiles
+/etc/config/rinetd
+endef
+
+define Package/rinetd/description
+  Rinetd redirects TCP connections from one IP address and port to another.
+  Rinetd is a single-process server which handles any number of connections
+  to the address/port pairs specified in the configuration.
+  Since rinetd runs as a single process using nonblocking I/O, it is able to
+  redirect a large number of connections without a severe impact on the
+  machine.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               rinetd
+endef
+
+define Package/rinetd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rinetd $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/rinetd.config $(1)/etc/config/rinetd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rinetd.init $(1)/etc/init.d/rinetd
+
+endef
+
+$(eval $(call BuildPackage,rinetd))
diff --git a/net/rinetd/files/rinetd.config b/net/rinetd/files/rinetd.config
new file mode 100644 (file)
index 0000000..eb543af
--- /dev/null
@@ -0,0 +1,33 @@
+# This section defines common settings for the rinetd process.
+config common
+       # Remove the comment from the line below to enable logging.
+       #option logfile /var/log/rinetd.log
+       
+       # Enable the option below to use a web server style
+       # common log format.
+       #option logcommon 1
+
+       # Define allow and deny rules below, you may use "?" and "*"
+       # as wildcards, "?" matches exactly one and "*" matches zero
+       # or more characters.
+       #
+       #list deny "88.*.*.*"
+       #list deny "89.123.12?.*"
+       #
+       #list allow "192.168.*.*"
+       #list allow "172.16.*.*"
+       #list allow "10.*.*.*"
+
+# Forwarding sections define forwarding rules for rinetd,
+# there may be multiple sections of this type to define
+# any number of forwardings.
+config forwarding
+       # IP and port rinetd should listen to for connections.
+       # Use the address "0.0.0.0" to listen on any interface.
+       option bindaddress "0.0.0.0"
+       option bindport "123"
+
+       # IP and port to forward accepted connections to.
+       option connectaddress "10.0.0.1"
+       option connectport "123"
+
diff --git a/net/rinetd/files/rinetd.init b/net/rinetd/files/rinetd.init
new file mode 100755 (executable)
index 0000000..9e1c0b9
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+
+START=80
+
+CFG=/var/etc/rinetd.conf
+
+common_add() {
+       local cfg="$1"
+       local logfile logcommon allow deny match
+
+       config_get      logfile   "$cfg" logfile
+       config_get_bool logcommon "$cfg" logcommon 0
+
+       [ -n "$logfile" ] && {
+               echo "logfile $logfile" >> $CFG
+               [ "$logcommon" -gt 0 ] && echo "logcommon" >> $CFG
+       }
+
+       config_get allow "$cfg" allow
+       config_get deny  "$cfg" deny
+
+       for match in $allow; do
+               echo "allow $match" >> $CFG
+       done
+
+       for match in $deny; do
+               echo "deny $match" >> $CFG
+       done
+}
+
+forward_add() {
+       local cfg="$1"
+       local bindaddr bindport connaddr connport
+
+       config_get bindaddr "$cfg" bindaddress
+       config_get bindport "$cfg" bindport
+       config_get connaddr "$cfg" connectaddress
+       config_get connport "$cfg" connectport
+
+       [ -n "$bindaddr" ] && [ -n "$connaddr" ] && \
+       [ -n "$bindport" ] && [ -n "$connport" ] && \
+               echo "$bindaddr $bindport $connaddr $connport" >> $CFG
+}
+
+start() {
+       mkdir -m 0755 -p /var/etc
+       mkdir -m 0755 -p /var/run
+       
+       echo "# This file is autogenerated, check /etc/config/rinetd" > $CFG
+       config_load 'rinetd'
+       config_foreach common_add 'common'
+       config_foreach forward_add 'forwarding'
+
+       service_start /usr/sbin/rinetd -c $CFG
+}
+
+stop() {
+       service_stop /usr/sbin/rinetd
+}
+
+reload() {
+       service_reload /usr/sbin/rinetd
+}
diff --git a/net/rinetd/patches/001-crosscompile.patch b/net/rinetd/patches/001-crosscompile.patch
new file mode 100644 (file)
index 0000000..0024306
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,8 @@
++CC=gcc
+ CFLAGS=-DLINUX -g
+ rinetd: rinetd.o match.o
+-      gcc rinetd.o match.o -o rinetd
++      $(CC) rinetd.o match.o -o rinetd
+ install: rinetd
+       install -m 700 rinetd /usr/sbin
diff --git a/net/rp-l2tp/Makefile b/net/rp-l2tp/Makefile
new file mode 100644 (file)
index 0000000..d7942fa
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# 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:=rp-l2tp
+PKG_VERSION:=0.4
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/rp-l2tp
+PKG_MD5SUM:=0e45d11cb4fa6c56cce6b1d119733ed9
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rp-l2tpd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Roaring Penguin L2TP
+  URL:=http://sourceforge.net/projects/rp-l2tp/
+  TITLE+= daemon
+  SUBMENU:=dial-in/up
+endef
+
+define Package/rp-l2tpd/description
+       Roaring Penguin L2TP (Layer 2 Tunneling Protocol) implementation.
+endef
+
+TARGET_CFLAGS := -I$(PKG_BUILD_DIR)/libevent $(TARGET_CFLAGS)
+
+define Package/rp-l2tpd/install
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/l2tp.conf.example $(1)/etc/l2tp.conf
+       $(INSTALL_DIR) $(1)/usr/lib/l2tp
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/l2tpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rp-l2tpd.init $(1)/etc/init.d/rp-l2tpd
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/l2tp/cmd.so $(1)/usr/lib/l2tp/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/l2tp/sync-pppd.so $(1)/usr/lib/l2tp/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/l2tp-control $(1)/usr/sbin/
+endef
+
+define Package/rp-l2tpd/conffiles
+/etc/l2tp.conf
+endef
+
+#define Package/rp-l2tpd-mod-cmd/install
+#      $(INSTALL_DIR) $(1)/usr/lib/l2tp
+#      $(CP) $(PKG_INSTALL_DIR)/usr/lib/l2tp/cmd.so $(1)/usr/lib/l2tp/
+#      $(INSTALL_DIR) $(1)/usr/sbin
+#      $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/l2tp-control $(1)/usr/sbin/
+#endef
+
+#define Package/rp-l2tpd-mod-ppp/install
+#      $(INSTALL_DIR) $(1)/usr/lib/l2tp
+#      $(CP) $(PKG_INSTALL_DIR)/usr/lib/l2tp/sync-pppd.so $(1)/usr/lib/l2tp/
+#endef
+
+$(eval $(call BuildPackage,rp-l2tpd))
+#$(eval $(call BuildPackage,rp-l2tpd-mod-cmd))
+#$(eval $(call BuildPackage,rp-l2tpd-mod-ppp))
diff --git a/net/rp-l2tp/files/rp-l2tpd.init b/net/rp-l2tp/files/rp-l2tpd.init
new file mode 100644 (file)
index 0000000..cff1f15
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=60
+
+start() {
+       service_start /usr/sbin/l2tpd
+}
+
+stop() {
+       service_stop /usr/sbin/l2tpd
+}
+
diff --git a/net/rp-l2tp/patches/001-cross.patch b/net/rp-l2tp/patches/001-cross.patch
new file mode 100644 (file)
index 0000000..654402e
--- /dev/null
@@ -0,0 +1,235 @@
+diff -ruN rp-l2tp-0.4-orig/Makefile.in rp-l2tp-0.4-4/Makefile.in
+--- rp-l2tp-0.4-orig/Makefile.in       2004-07-01 17:17:11.000000000 +0200
++++ rp-l2tp-0.4-4/Makefile.in  2005-03-09 16:26:49.000000000 +0100
+@@ -27,10 +27,10 @@
+ sbindir=@sbindir@
+ OBJS=auth.o debug.o dgram.o main.o md5.o network.o options.o peer.o session.o tunnel.o utils.o
+-EXTRA_LIBS=@LIBEVENT@/*.o -ldl
++EXTRA_LIBS=@LIBEVENT@/*.o -lc -ldl
+ SRCS=$(OBJS:.o=.c)
+-CFLAGS=-g -I.. -I@LIBEVENT@ -Wall -Wstrict-prototypes -ansi -pedantic -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" -DPREFIX=\"$(prefix)\"
++CFLAGS=@CFLAGS@ -I@LIBEVENT@ -Wall -Wstrict-prototypes -ansi -pedantic -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" -DPREFIX=\"$(prefix)\"
+ TARGETS=l2tpd libl2tp.a handlers
+@@ -38,12 +38,12 @@
+ libl2tp.a: $(OBJS)
+       rm -f $@
+-      ar -rc $@ $^
+-      ranlib $@ || true
++      $(AR) -rc $@ $^
++      @RANLIB@ $@ || true
+ l2tpd: libl2tp.a libevent/libevent.a
+       $(MAKE) -C handlers
+-      @CC@ -o l2tpd -rdynamic $(OBJS) $(EXTRA_LIBS)
++      @CC@ $(CFLAGS) -o l2tpd -rdynamic $(OBJS) $(EXTRA_LIBS)
+ libevent/libevent.a:
+       test -d libevent || ln -s ../libevent .
+@@ -72,18 +72,20 @@
+       rm -f *.o *.a *~
+       rm -f l2tpd
+       $(MAKE) -C handlers clean
++      $(MAKE) -C libevent clean
+ distclean: clean
+-      rm -f Makefile config.cache
++      rm -f Makefile config.cache config.log config.status .depend
+       $(MAKE) -C handlers distclean
++      $(MAKE) -C libevent distclean
+ -include .depend
+ install: all
+       -mkdir -p $(RPM_INSTALL_ROOT)$(DESTDIR)$(sbindir)
+-      $(install) -m 755 -s l2tpd $(RPM_INSTALL_ROOT)$(DESTDIR)$(sbindir)
++      $(install) -m 755 l2tpd $(RPM_INSTALL_ROOT)$(DESTDIR)$(sbindir)
+       -mkdir -p $(RPM_INSTALL_ROOT)$(DESTDIR)/etc/l2tp
+-      $(install) -m 644 l2tp.conf $(RPM_INSTALL_ROOT)$(DESTDIR)/etc/l2tp/l2tp.conf.example
++      $(install) -m 644 l2tp.conf $(RPM_INSTALL_ROOT)$(DESTDIR)/etc/l2tp.conf.example
+       -mkdir -p $(RPM_INSTALL_ROOT)$(DESTDIR)$(mandir)/man8
+       -mkdir -p $(RPM_INSTALL_ROOT)$(DESTDIR)$(mandir)/man5
+       $(install) -m 644 man/l2tpd.8 $(RPM_INSTALL_ROOT)$(DESTDIR)$(mandir)/man8
+diff -ruN rp-l2tp-0.4-orig/handlers/Makefile.in rp-l2tp-0.4-4/handlers/Makefile.in
+--- rp-l2tp-0.4-orig/handlers/Makefile.in      2002-09-30 21:45:00.000000000 +0200
++++ rp-l2tp-0.4-4/handlers/Makefile.in 2005-03-09 16:26:49.000000000 +0100
+@@ -14,32 +14,34 @@
+ OBJS=pty.o sync-pppd.o dstring.o
+ SRCS=$(OBJS:.o=.c)
+-CFLAGS=-g -O2 -I.. -I../libevent -I../../libevent -Wall
++CFLAGS=@CFLAGS@ -I.. -I../libevent -I../../libevent -Wall
+ all: $(HANDLERS) l2tp-control
+ l2tp-control: cmd-control.o
+-      gcc -o l2tp-control cmd-control.o
++      $(CC) $(CFLAGS) -o l2tp-control cmd-control.o
+ cmd-control.o: cmd-control.c
+-      gcc -c -o $@ $^
++      $(CC) $(CFLAGS) -c -o $@ $^
+ %.o: %.c
+-      gcc $(CFLAGS) -fPIC -c -o $@ $<
++      $(CC) $(CFLAGS) -fPIC -c -o $@ $<
+ sync-pppd.so: pty.o sync-pppd.o
+-      gcc -shared -o $@ $^
++      $(CC) $(CFLAGS) -shared -o $@ $^
+ cmd.so: cmd.o dstring.o
+-      gcc -shared -o $@ $^
++      $(CC) $(CFLAGS) -shared -o $@ $^
+ clean:
+       rm -f *.so *.o *~
+       rm -f l2tp-control
+ install: all
+-      -mkdir -p $(RPM_INSTALL_ROOT)$(sbindir)
+-      -mkdir -p $(RPM_INSTALL_ROOT)$(prefix)/lib/l2tp/plugins
+-      $(install) -m 755 -s l2tp-control $(RPM_INSTALL_ROOT)$(sbindir)
+-      $(install) -m 755 $(HANDLERS) $(RPM_INSTALL_ROOT)$(prefix)/lib/l2tp/plugins
++      -mkdir -p $(RPM_INSTALL_ROOT)$(DESTDIR)$(sbindir)
++      -mkdir -p $(RPM_INSTALL_ROOT)$(DESTDIR)$(prefix)/lib/l2tp
++      $(install) -m 755 l2tp-control $(RPM_INSTALL_ROOT)$(DESTDIR)$(sbindir)
++      $(install) -m 755 $(HANDLERS) $(RPM_INSTALL_ROOT)$(DESTDIR)$(prefix)/lib/l2tp
++
+ distclean: clean
++      rm -f Makefile
+diff -ruN rp-l2tp-0.4-orig/handlers/cmd-control.c rp-l2tp-0.4-4/handlers/cmd-control.c
+--- rp-l2tp-0.4-orig/handlers/cmd-control.c    2002-09-30 21:45:00.000000000 +0200
++++ rp-l2tp-0.4-4/handlers/cmd-control.c       2005-03-09 16:26:49.000000000 +0100
+@@ -52,7 +52,7 @@
+     memset(&addr, 0, sizeof(addr));
+     addr.sun_family = AF_LOCAL;
+-    strncpy(addr.sun_path, "/var/run/l2tpctrl", sizeof(addr.sun_path) - 1);
++    strncpy(addr.sun_path, "/var/run/l2tp.sock", sizeof(addr.sun_path) - 1);
+     fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+     if (fd < 0) {
+diff -ruN rp-l2tp-0.4-orig/handlers/cmd.c rp-l2tp-0.4-4/handlers/cmd.c
+--- rp-l2tp-0.4-orig/handlers/cmd.c    2004-07-01 16:58:56.000000000 +0200
++++ rp-l2tp-0.4-4/handlers/cmd.c       2005-03-09 16:26:49.000000000 +0100
+@@ -162,7 +162,7 @@
+     /* We have hit the end of our options.  Open command socket */
+     if (!sockname) {
+-      sockname = "/var/run/l2tpctrl";
++      sockname = "/var/run/l2tp.sock";
+     }
+     (void) remove(sockname);
+diff -ruN rp-l2tp-0.4-orig/libevent/Makefile.in rp-l2tp-0.4-4/libevent/Makefile.in
+--- rp-l2tp-0.4-orig/libevent/Makefile.in      2002-09-30 21:45:00.000000000 +0200
++++ rp-l2tp-0.4-4/libevent/Makefile.in 2005-03-09 16:26:49.000000000 +0100
+@@ -18,24 +18,27 @@
+ libevent.a: $(OBJS)
+       rm -f libevent.a
+-      ar -cq libevent.a $(OBJS)
++      $(AR) r libevent.a $(OBJS)
+       @RANLIB@ libevent.a
+ event.o: event.c $(HDRS)
+-      gcc $(CFLAGS) -c -o event.o event.c
++      $(CC) $(CFLAGS) -c -o event.o event.c
+ hash.o: hash.c $(HDRS)
+-      gcc $(CFLAGS) -c -o hash.o hash.c
++      $(CC) $(CFLAGS) -c -o hash.o hash.c
+ event_sig.o: event_sig.c $(HDRS)
+-      gcc $(CFLAGS) -c -o event_sig.o event_sig.c
++      $(CC) $(CFLAGS) -c -o event_sig.o event_sig.c
+ event_tcp.o: event_tcp.c $(HDRS)
+-      gcc $(CFLAGS) -c -o event_tcp.o event_tcp.c
++      $(CC) $(CFLAGS) -c -o event_tcp.o event_tcp.c
+ clean: FORCE
+       rm -f *.a *.o *~
++distclean: clean
++      rm -f Makefile
++
+ FORCE:
+-.phony: FORCE
+\ No newline at end of file
++.phony: FORCE
+diff -ruN rp-l2tp-0.4-orig/main.c rp-l2tp-0.4-4/main.c
+--- rp-l2tp-0.4-orig/main.c    2002-09-30 21:45:00.000000000 +0200
++++ rp-l2tp-0.4-4/main.c       2005-03-09 16:26:49.000000000 +0100
+@@ -68,7 +68,7 @@
+     l2tp_peer_init();
+     l2tp_debug_set_bitmask(debugmask);
+-    if (l2tp_parse_config_file(es, "/etc/l2tp/l2tp.conf") < 0) {
++    if (l2tp_parse_config_file(es, "/etc/l2tp.conf") < 0) {
+       l2tp_die();
+     }
+diff -ruN rp-l2tp-0.4-orig/man/l2tp.conf.5 rp-l2tp-0.4-4/man/l2tp.conf.5
+--- rp-l2tp-0.4-orig/man/l2tp.conf.5   2004-07-01 16:58:56.000000000 +0200
++++ rp-l2tp-0.4-4/man/l2tp.conf.5      2005-03-09 16:26:49.000000000 +0100
+@@ -155,7 +155,7 @@
+ in the global section.  The only option available is:
+ .IP "\fBsocket-path\fP \fIpathname\fR"
+ Specifies the path name of the UNIX-domain socket for controlling the
+-daemon.  Defaults to \fI/var/run/l2tpctrl\fR.
++daemon.  Defaults to \fI/var/run/l2tp.sock\fR.
+ .PP
+ Even if you do not supply any options to cmd, you \fImust\fR have
+ a \fBsection cmd\fR line to activate the handler.
+diff -ruN rp-l2tp-0.4-orig/man/l2tpd.8 rp-l2tp-0.4-4/man/l2tpd.8
+--- rp-l2tp-0.4-orig/man/l2tpd.8       2002-09-30 21:45:00.000000000 +0200
++++ rp-l2tp-0.4-4/man/l2tpd.8  2005-03-09 16:26:49.000000000 +0100
+@@ -47,17 +47,17 @@
+ fairly lightweight and efficient.
+ .SH L2TPD CONFIGURATION
+-On startup, \fBl2tpd\fR reads the configuration file \fB/etc/l2tp/l2tp.conf\fR.
++On startup, \fBl2tpd\fR reads the configuration file \fB/etc/l2tp.conf\fR.
+ This configuration file sets operating parameters, describes peers and loads
+ and configures handlers.  See \fBl2tp.conf\fR(5) for configuration
+ file details.
+ .SH FILES
+ .TP
+-.B /etc/l2tp/l2tp.conf
++.B /etc/l2tp.conf
+ Main configuration file.
+ .TP
+-.B /var/run/l2tpctrl
++.B /var/run/l2tp.sock
+ Control socket for \fBcmd.so\fR handler.
+ .SH AUTHORS
+diff -ruN rp-l2tp-0.4-orig/utils.c rp-l2tp-0.4-4/utils.c
+--- rp-l2tp-0.4-orig/utils.c   2002-09-30 21:45:00.000000000 +0200
++++ rp-l2tp-0.4-4/utils.c      2005-03-09 16:26:49.000000000 +0100
+@@ -182,7 +182,7 @@
+ *  -1 on error, 0 if OK
+ * %DESCRIPTION:
+ *  Dynamically-loads a handler and initializes it.  If fname is not
+-*  an absolute path name, we load the handler from /usr/lib/l2tp/plugins
++*  an absolute path name, we load the handler from /usr/lib/l2tp
+ ***********************************************************************/
+ int
+ l2tp_load_handler(EventSelector *es,
+@@ -196,7 +196,7 @@
+     if (*fname == '/') {
+       handle = dlopen(fname, RTLD_NOW);
+     } else {
+-      snprintf(buf, sizeof(buf), "%s/lib/l2tp/plugins/%s", PREFIX, fname);
++      snprintf(buf, sizeof(buf), "%s/lib/l2tp/%s", PREFIX, fname);
+       buf[sizeof(buf)-1] = 0;
+       handle = dlopen(buf, RTLD_NOW);
+     }
diff --git a/net/rp-pppoe/Makefile b/net/rp-pppoe/Makefile
new file mode 100644 (file)
index 0000000..abb921f
--- /dev/null
@@ -0,0 +1,135 @@
+#
+# Copyright (C) 2006-2013 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:=rp-pppoe
+PKG_VERSION:=3.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://roaringpenguin.com/files/download
+PKG_MD5SUM:=13b5900c56bd602df6cc526e5e520722
+
+PKG_BUILD_DEPENDS:=ppp
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rp-pppoe/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ppp
+  TITLE:=PPPoE (PPP over Ethernet)
+  URL:=http://roaringpenguin.com/products/pppoe
+  SUBMENU:=dial-in/up
+endef
+
+define Package/rp-pppoe/Default/description
+  Dubbed RP-PPPoE, this open-source product is ideal for Linux users with
+  a DSL "modem" whose Internet service provider uses PPPoE.
+endef
+
+define Package/rp-pppoe-client
+  $(call Package/rp-pppoe/Default)
+  DEPENDS += @BROKEN
+  TITLE+= client
+endef
+
+define Package/rp-pppoe-client/description
+$(call Package/rp-pppoe/Default/description)
+ .
+ This package contains pppoe-connect.
+endef
+
+define Package/rp-pppoe-relay
+  $(call Package/rp-pppoe/Default)
+  TITLE+= relay
+endef
+
+define Package/rp-pppoe-relay/description
+$(call Package/rp-pppoe/Default/description)
+ .
+ This package contains pppoe-relay.
+endef
+
+define Package/rp-pppoe-server
+  $(call Package/rp-pppoe/Default)
+  TITLE+= server
+endef
+
+define Package/rp-pppoe-server/conffiles
+/etc/ppp/pppoe-server-options
+/etc/default/pppoe-server
+endef
+
+define Package/rp-pppoe-server/description
+$(call Package/rp-pppoe/Default/description)
+ .
+ This package contains pppoe-server.
+endef
+
+define Package/rp-pppoe-sniff
+  $(call Package/rp-pppoe/Default)
+  TITLE+= sniffer
+endef
+
+define Package/rp-pppoe-sniff/description
+$(call Package/rp-pppoe/Default/description)
+ .
+ This package contains pppoe-sniff.
+endef
+
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/src/libevent
+CONFIGURE_PATH := ./src
+CONFIGURE_ARGS += ac_cv_path_PPPD=/usr/sbin/pppd --enable-plugin=$(STAGING_DIR)/usr/include/
+MAKE_FLAGS := DESTDIR="$(PKG_INSTALL_DIR)" install
+MAKE_PATH := ./src
+
+define Package/rp-pppoe-client/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pppoe-client.init $(1)/etc/init.d/pppoe-client
+       $(INSTALL_DIR) $(1)/etc/ppp
+       $(CP) $(PKG_INSTALL_DIR)/etc/ppp/pppoe.conf $(1)/etc/ppp/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/pppoe-connect $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/pppoe-start $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/pppoe-stop $(1)/usr/sbin/
+       $(SED) 's,modprobe,insmod,g' $(1)/usr/sbin/pppoe-connect
+endef
+
+define Package/rp-pppoe-relay/install
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_BIN) ./files/pppoe-relay.default $(1)/etc/default/pppoe-relay
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pppoe-relay.init $(1)/etc/init.d/pppoe-relay
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-relay $(1)/usr/sbin/
+endef
+
+define Package/rp-pppoe-server/install
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_BIN) ./files/pppoe-server.default $(1)/etc/default/pppoe-server
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/pppoe-server.init $(1)/etc/init.d/pppoe-server
+       $(INSTALL_DIR) $(1)/etc/ppp
+       $(INSTALL_DIR) $(1)/etc/ppp/plugins
+       $(CP) $(PKG_INSTALL_DIR)/etc/ppp/pppoe-server-options $(1)/etc/ppp/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-server $(1)/usr/sbin/
+       $(CP) $(PKG_INSTALL_DIR)/etc/ppp/plugins/rp-pppoe.so $(1)/etc/ppp/plugins/
+endef
+
+define Package/rp-pppoe-sniff/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-sniff $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,rp-pppoe-client))
+$(eval $(call BuildPackage,rp-pppoe-relay))
+$(eval $(call BuildPackage,rp-pppoe-server))
+$(eval $(call BuildPackage,rp-pppoe-sniff))
diff --git a/net/rp-pppoe/files/pppoe-client.init b/net/rp-pppoe/files/pppoe-client.init
new file mode 100644 (file)
index 0000000..93654dd
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+start() {
+       pppoe-start
+}
+
+stop() {
+       pppoe-stop
+}
+
diff --git a/net/rp-pppoe/files/pppoe-relay.default b/net/rp-pppoe/files/pppoe-relay.default
new file mode 100644 (file)
index 0000000..47a3892
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-C eth2 -S vlan1"
diff --git a/net/rp-pppoe/files/pppoe-relay.init b/net/rp-pppoe/files/pppoe-relay.init
new file mode 100644 (file)
index 0000000..965aa74
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+DEFAULT=/etc/default/pppoe-relay
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start /usr/sbin/pppoe-relay $OPTIONS
+}
+
+stop() {
+       service_stop /usr/sbin/pppoe-relay
+}
diff --git a/net/rp-pppoe/files/pppoe-server.default b/net/rp-pppoe/files/pppoe-server.default
new file mode 100644 (file)
index 0000000..72a8c01
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-C MyRouter -I eth2"
diff --git a/net/rp-pppoe/files/pppoe-server.init b/net/rp-pppoe/files/pppoe-server.init
new file mode 100644 (file)
index 0000000..16be3bf
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+DEFAULT=/etc/default/pppoe-server
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start /usr/sbin/pppoe-server $OPTIONS
+}
+
+stop() {
+       service_stop /usr/sbin/pppoe-server
+}
diff --git a/net/rp-pppoe/patches/100-configure.patch b/net/rp-pppoe/patches/100-configure.patch
new file mode 100644 (file)
index 0000000..d45593a
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/src/configure
++++ b/src/configure
+@@ -3661,7 +3661,7 @@ done
+ for ac_header in linux/if.h
+ do :
+-  ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include<sys/socket.h>
++  ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include <sys/socket.h>
+ "
+ if test "x$ac_cv_header_linux_if_h" = x""yes; then :
+   cat >>confdefs.h <<_ACEOF
+@@ -3675,10 +3675,11 @@ done
+ for ac_header in linux/if_pppox.h
+ do :
+   ac_fn_c_check_header_compile "$LINENO" "linux/if_pppox.h" "ac_cv_header_linux_if_pppox_h" "
+-#include<sys/socket.h>
+-#include<net/ethernet.h>
+-#include<linux/if.h>
+-#include<linux/in.h>
++#include <sys/socket.h>
++#include <net/ethernet.h>
++#include <linux/if.h>
++#include <linux/in.h>
++#include <linux/in6.h>
+ "
+ if test "x$ac_cv_header_linux_if_pppox_h" = x""yes; then :
+@@ -4611,7 +4612,7 @@ esac
+ $as_echo_n "checking packing order of bit fields... " >&6; }
+ if test "${rpppoe_cv_pack_bitfields+set}" != set ; then
+ if test "$cross_compiling" = yes; then :
+-  $ECHO "no defaults for cross-compiling"; exit 0
++  rpppoe_cv_pack_bitfields="$ac_cv_pack_bitfields"
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/net/rp-pppoe/patches/110-Makefile.patch b/net/rp-pppoe/patches/110-Makefile.patch
new file mode 100644 (file)
index 0000000..9dc1c72
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -71,7 +71,7 @@ pppoe-sniff: pppoe-sniff.o if.o common.o
+       @CC@ -o $@ $^ $(LDFLAGS)
+ pppoe-server: pppoe-server.o if.o debug.o common.o md5.o libevent/libevent.a @PPPOE_SERVER_DEPS@
+-      @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS) -Llibevent -levent
++      @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS)
+ pppoe: pppoe.o if.o debug.o common.o ppp.o discovery.o
+       @CC@ -o $@ $^ $(LDFLAGS)
diff --git a/net/rrs/Makefile b/net/rrs/Makefile
new file mode 100644 (file)
index 0000000..09bc43c
--- /dev/null
@@ -0,0 +1,90 @@
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/uclibc++.mk
+
+PKG_NAME:=rrs
+PKG_VERSION:=1.70
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.cycom.se/uploads/36/19
+PKG_MD5SUM:=b400d03c0e39e3e78a7327ba78f789f0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rrs/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=$(CXX_DEPENDS)
+  TITLE:=A reverse (connecting) remote shell
+  URL:=http://www.cycom.se/dl/rrs/
+endef
+
+define Package/rrs
+$(call Package/rrs/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS+= +libopenssl
+  TITLE+= (with SSL support)
+  URL:=http://www.cycom.se/dl/rrs/
+endef
+
+define Package/rrs-nossl
+$(call Package/rrs/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE+= (without SSL support)
+endef
+
+
+define Build/Template
+
+$(STAMP_BUILT)-$(2): $(STAMP_PREPARED)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include/uClibc++ -fno-builtin -fno-rtti -nostdinc++" \
+               LDFLAGS="$(TARGET_LDFLAGS) -nodefaultlibs -lc $(4) -luClibc++ -lm -lutil $(LIBGCC_S)" \
+               LDFLAGSNOSSL="$(TARGET_LDFLAGS) -nodefaultlibs -lc $(4) -luClibc++ -lm -lutil $(LIBGCC_S)" \
+               $(3)
+       ( cd $(PKG_BUILD_DIR); mv -f rrs rrs-$(2); )
+       touch $$@
+
+$(STAMP_BUILT): $(STAMP_BUILT)-$(2)
+
+define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rrs-$(2) $$(1)/usr/bin/rrs
+endef
+
+endef
+
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_rrs),)
+  define Build/with-ssl
+    $(call Build/Template,rrs,with-ssl,generic,-lcrypto -lssl)
+  endef
+endif
+$(eval $(Build/with-ssl))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_rrs-nossl),)
+  define Build/without-ssl
+    $(call Build/Template,rrs-nossl,without-ssl,generic-nossl,)
+  endef
+endif
+$(eval $(Build/without-ssl))
+
+
+$(eval $(call BuildPackage,rrs))
+$(eval $(call BuildPackage,rrs-nossl))
diff --git a/net/rrs/patches/001-shell.patch b/net/rrs/patches/001-shell.patch
new file mode 100644 (file)
index 0000000..13520fc
--- /dev/null
@@ -0,0 +1,13 @@
+Index: rrs-1.70/rrs.c
+===================================================================
+--- rrs-1.70.orig/rrs.c        2007-07-30 14:30:24.000000000 +0200
++++ rrs-1.70/rrs.c     2007-07-30 14:30:24.000000000 +0200
+@@ -920,7 +920,7 @@
+         close(slave_fd);
+         signal(SIGHUP, SIG_DFL);
+         signal(SIGCHLD, SIG_DFL);
+-        execl("/bin/sh", "", NULL);
++        execl("/bin/sh", "/bin/sh", NULL);
+         /* should not return */
+         exit(1);
+     } else if (pid > 0) {
diff --git a/net/rrs/patches/002-no_sslv2.patch b/net/rrs/patches/002-no_sslv2.patch
new file mode 100644 (file)
index 0000000..1f7c35d
--- /dev/null
@@ -0,0 +1,46 @@
+Index: rrs-1.70/rrs.c
+===================================================================
+--- rrs-1.70.orig/rrs.c        2007-07-30 14:30:24.000000000 +0200
++++ rrs-1.70/rrs.c     2007-07-30 14:30:25.000000000 +0200
+@@ -1826,9 +1826,12 @@
+                 }
+                 rrs_ssl = TLSv1;
+                 if (optarg) {
++#ifndef OPENSSL_NO_SSL2                   
+                     if (!strcasecmp(optarg, "SSLv2")) {
+                         rrs_ssl = SSLv2;
+-                    } else if (!strcasecmp(optarg, "SSLv3")) {
++                    } else
++#endif
++                  if (!strcasecmp(optarg, "SSLv3")) {
+                         rrs_ssl = SSLv3;
+                     } else if (!strcasecmp(optarg, "TLSv1")) {
+                         rrs_ssl = TLSv1;
+@@ -1981,9 +1984,12 @@
+         SSL_load_error_strings();
+         if (rrs_listen) {
++#ifndef OPENSSL_NO_SSL2
+             if (rrs_ssl == SSLv2) {
+                 sslmethod = SSLv2_server_method();
+-            } else if (rrs_ssl == SSLv3) {
++            } else
++#endif
++          if (rrs_ssl == SSLv3) {
+                 sslmethod = SSLv3_server_method();
+             } else if (rrs_ssl == TLSv1) {
+                 sslmethod = TLSv1_server_method();
+@@ -1992,9 +1998,12 @@
+                 return err_generic;
+             }
+         } else {
++#ifndef OPENSSL_NO_SSL2
+             if (rrs_ssl == SSLv2) {
+                 sslmethod = SSLv2_client_method();
+-            } else if (rrs_ssl == SSLv3) {
++            } else
++#endif
++          if (rrs_ssl == SSLv3) {
+                 sslmethod = SSLv3_client_method();
+             } else if (rrs_ssl == TLSv1) {
+                 sslmethod = TLSv1_client_method();
diff --git a/net/rrs/patches/003-honour_copts.patch b/net/rrs/patches/003-honour_copts.patch
new file mode 100644 (file)
index 0000000..b089329
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ruN rrs-1.70-old/Makefile rrs-1.70-new/Makefile
+--- rrs-1.70-old/Makefile      2004-05-30 02:14:14.000000000 +0200
++++ rrs-1.70-new/Makefile      2007-09-01 16:26:09.000000000 +0200
+@@ -50,7 +50,7 @@
+       $(CC) $(CFLAGS) $(LDFLAGS) $(LDEXTRA) -o $(out) rrs.c md5.c sha1.c farm9crypt.cc twofish2.cc
+ compile-generic-nossl:
+-      $(CC) -DWITHOUT_SSL $(CFLAGS) $$CFLAGS $(LDFLAGSNOSSL) $(LDEXTRA) -o $(out) rrs.c md5.c sha1.c farm9crypt.cc twofish2.cc
++      $(CC) -DWITHOUT_SSL $(CFLAGS) $(LDFLAGSNOSSL) $(LDEXTRA) -o $(out) rrs.c md5.c sha1.c farm9crypt.cc twofish2.cc
+ ## qnx
+ compile-qnx:
diff --git a/net/rssh/Makefile b/net/rssh/Makefile
new file mode 100644 (file)
index 0000000..8e7e9f1
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2007-2010 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:=rssh
+PKG_VERSION:=2.3.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/rssh
+PKG_MD5SUM:=b0c147602fcc95737ed50573b92fc468
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rssh
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=SSH
+  TITLE:=restricted shell for use with OpenSSH
+  URL:=http://www.pizzashack.org/rssh/index.shtml
+endef
+
+define Package/rssh/description
+       rssh is a restricted shell for use with OpenSSH, allowing only scp and/or sftp.
+       It now also includes support for rdist, rsync, and cvs. For example, if you have
+       a server which you only want to allow users to copy files off of via scp, without
+       providing shell access, you can use rssh to do that.
+endef
+
+define Package/rssh/conffiles
+/etc/rssh.conf
+endef
+
+CONFIGURE_ARGS += \
+       --with-sftp-server="/usr/libexec/sftp-server" \
+
+CONFIGURE_VARS += \
+       ac_cv_func_malloc_0_nonnull=yes \
+
+define Package/rssh/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME).conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/rssh_chroot_helper $(1)/usr/lib/
+endef
+
+define Package/rssh/postinst
+#!/bin/sh
+grep rssh $${IPKG_INSTROOT}/etc/shells || \
+       echo "/usr/bin/rssh" >> $${IPKG_INSTROOT}/etc/shells
+endef
+
+$(eval $(call BuildPackage,rssh))
diff --git a/net/rssh/patches/001-destdir.patch b/net/rssh/patches/001-destdir.patch
new file mode 100644 (file)
index 0000000..96184a0
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -16,7 +16,7 @@ base=`echo @PACKAGE_STRING@|tr " " "-"`
+       $(CC) -c $(DEFS) $(ourdefs) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $<
+ install-exec-hook:
+-      chmod u+s $(libexecdir)/rssh_chroot_helper
++      chmod u+s $(DESTDIR)$(libexecdir)/rssh_chroot_helper
+ rpm:  dist
+       rpmbuild -ta --sign $(base).tar.gz
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -830,7 +830,7 @@ uninstall-man: uninstall-man1 uninstall-
+       $(CC) -c $(DEFS) $(ourdefs) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $<
+ install-exec-hook:
+-      chmod u+s $(libexecdir)/rssh_chroot_helper
++      chmod u+s $(DESTDIR)$(libexecdir)/rssh_chroot_helper
+ rpm:  dist
+       rpmbuild -ta --sign $(base).tar.gz
diff --git a/net/scanlogd/Makefile b/net/scanlogd/Makefile
new file mode 100644 (file)
index 0000000..1d13853
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# 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:=scanlogd
+PKG_VERSION:=2.2.6
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.openwall.com/scanlogd/ \
+       ftp://ftp.wiretapped.net/pub/openwall/ \
+       http://distro.ibiblio.org/pub/linux/distributions/openwall/
+PKG_MD5SUM:=7b8187ea718ebe47f22805b921b909ab
+
+PKG_INIT_PRIO:=60
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/scanlogd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall
+  DEPENDS:=+libpcap +libnet0 +libnids
+  TITLE:=Port scan detection tool
+  URL:=http://www.openwall.com/scanlogd
+endef
+
+define Package/scanlogd/description
+       Scanlogd is a TCP port scan detection tool, originally designed
+       to illustrate various attacks an IDS developer has to deal with.
+       Thus, unlike some of the other port scan detection tools out there,
+       scanlogd is designed to be totally safe to use.
+endef
+
+define Build/Configure
+       $(SED) 's,^#define \(SCANLOGD_CHROOT\).*,#define \1 "/var/run/scanlogd",' \
+           -e 's,^#undef \(SCANLOGD_DEVICE\),#define \1 "all",' \
+           $(PKG_BUILD_DIR)/params.h
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CC="$(TARGET_CC)" LD="$(TARGET_CC)" CFLAGS="-c $(TARGET_CFLAGS)" \
+               LDFLAGS= \
+               PCAP_H="$(TARGET_CPPFLAGS)" \
+               NIDS_H="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
+               NIDS_L="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib -lnids -lnet -lpcap" \
+               libnids
+endef
+
+define Package/scanlogd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/scanlogd.init $(1)/etc/init.d/scanlogd
+endef
+
+$(eval $(call BuildPackage,scanlogd))
diff --git a/net/scanlogd/files/scanlogd.init b/net/scanlogd/files/scanlogd.init
new file mode 100644 (file)
index 0000000..cfe5825
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=50
+
+start() {
+       user_exists scanlogd 51 || user_add scanlogd 51
+       group_exists scanlogd 51 || group_add scanlogd
+       [ -d  /var/run/scanlogd ] || {
+               mkdir -m 0755 -p /var/run/scanlogd
+               chmod 0755 /var/run/scanlogd
+               chown scanlogd:scanlogd /var/run/scanlogd
+       }
+       service_start /usr/sbin/scanlogd
+}
+
+stop() {
+       service_stop /usr/sbin/scanlogd
+}
diff --git a/net/scdp/Makefile b/net/scdp/Makefile
new file mode 100644 (file)
index 0000000..8c80131
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006 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:=scdp
+PKG_VERSION:=1.0b
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/scdp
+PKG_MD5SUM:=7eafaf5a422e37d04715613993ed5d95
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/scdp
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libnet0
+  TITLE:=An utility to send CDP (Cisco Discovery Protocol) packets
+  URL:=http://sourceforge.net/projects/scdp
+endef
+
+define Package/scdp/description
+       This program sends CDP (Cisco Discovery Protocol) packets out on
+       selected interfaces and tells the connected switch (cisco only)
+       where the host is connected.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               , \
+               CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
+               LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib" \
+               PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
+       )
+endef
+
+define Package/scdp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scdp $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,scdp))
diff --git a/net/seeks/Makefile b/net/seeks/Makefile
new file mode 100644 (file)
index 0000000..49fd8e6
--- /dev/null
@@ -0,0 +1,115 @@
+#
+# Copyright (C) 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:=seeks
+PKG_VERSION:=0.3.4
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=git://seeks.git.sourceforge.net/gitroot/seeks/seeks
+PKG_SOURCE_PROTO:=git
+PKG_REV:=e8565b98cfe40fba644f587536f15f1a8665d230
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/seeks
+  SUBMENU:=Web Servers/Proxies
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=An open P2P design for websearch
+  URL:=http://www.seeks-project.info/site/
+  DEPENDS:=+libpthread +libevent2 +libstdcpp +libcurl +libpcre +libxml2 $(ICONV_DEPENDS) +zlib +protobuf +tokyocabinet
+  MAINTAINER:=Obinou <obconseil@gmail.com>
+endef
+
+define Package/seeks/description
+ Seeks is a free and open P2P design and application for enabling social
+ websearch. Its specific purpose is to regroup users whose queries
+ are similar so they can share both the query results and their
+ experience on these results. On this basis, Seeks allows for true
+ real-time, decentralized, websearch to emerge.
+
+ In the long term, there is no need for web crawlers and third-party
+ web indexes as users can push content directly to search groups.
+ By hashing queries, Seeks offers a unique solution that allows to
+ issue queries and get answers while not revealing the true query itself.
+
+ Seeks is currently under development. Code is available from our git
+ repository. Help on any of the social, technical and software matters
+ is greatly encouraged and appreciated, see the dedicated page.
+endef
+
+
+CONFIGURE_VARS:= \
+        CXXFLAGS="-I$(STAGING_DIR)/usr/include $(ICONV_CFLAGS) $(TARGET_CFLAGS)" \
+        LDFLAGS="-L$(STAGING_DIR)/usr/lib      $(ICONV_LDFLAGS)" \
+
+CONFIGURE_ARGS += \
+       --prefix=/usr \
+       --enable-httpserv-plugin \
+       --enable-keepalive \
+       --disable-image-websearch-plugin \
+       --disable-icu
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
+               ./autogen.sh \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CXXFLAGS="-I$(STAGING_DIR)/usr/include $(ICONV_CFLAGS) $(TARGET_CFLAGS)"
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+define Package/seeks/conffiles
+/etc/config/seeks
+/etc/seeks/config
+endef
+
+define Package/seeks/install
+# Binary program
+       $(INSTALL_DIR)  $(1)/usr/bin
+       $(INSTALL_BIN)  $(PKG_INSTALL_DIR)/usr/bin/seeks $(1)/usr/bin/
+# Config files
+       $(INSTALL_DIR)  $(1)/etc/seeks
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/seeks/* $(1)/etc/seeks/
+# Libs
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so*  $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/blocker
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/httpserv
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/websearch
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/query_capture
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/uri_capture
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/cf
+       $(INSTALL_DIR) $(1)/usr/lib/seeks/plugins/udb_service
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/blocker/lib*.so*    $(1)/usr/lib/seeks/plugins/blocker
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/httpserv/lib*.so*   $(1)/usr/lib/seeks/plugins/httpserv
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/websearch/lib*.so*  $(1)/usr/lib/seeks/plugins/websearch
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/query_capture/lib*.so*  $(1)/usr/lib/seeks/plugins/query_capture
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/uri_capture/lib*.so*  $(1)/usr/lib/seeks/plugins/uri_capture
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/cf/lib*.so*  $(1)/usr/lib/seeks/plugins/cf
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/seeks/plugins/udb_service/lib*.so*  $(1)/usr/lib/seeks/plugins/udb_service
+#Share
+       $(INSTALL_DIR) $(1)/usr/share/seeks
+       $(CP) -r $(PKG_INSTALL_DIR)/usr/share/seeks/*  $(1)/usr/share/seeks/
+# This is OpenWRT specific config & scripts
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/seeks.init $(1)/etc/init.d/seeks
+endef
+
+$(eval $(call BuildPackage,seeks))
diff --git a/net/seeks/files/seeks.init b/net/seeks/files/seeks.init
new file mode 100644 (file)
index 0000000..eb4c5e4
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=99
+
+start() {
+       service_start /usr/bin/seeks --daemon
+}
+
+stop() {
+       service_stop /usr/bin/seeks
+}
diff --git a/net/seeks/patches/050-better_icu_detection.patch b/net/seeks/patches/050-better_icu_detection.patch
new file mode 100644 (file)
index 0000000..7d2fa63
--- /dev/null
@@ -0,0 +1,39 @@
+diff -ru seeks-0.3.3/configure.in seeks-0.3.3-new/configure.in
+--- seeks-0.3.3/configure.in   2011-04-30 10:16:57.000000000 +0200
++++ seeks-0.3.3-new/configure.in       2011-05-28 14:44:13.094516755 +0200
+@@ -351,17 +351,25 @@
+ #==========================================================================
+ # Finding icu
+ #==========================================================================
+-# First, check for the icu-config tool
+-AC_PATH_PROGS(ICU_CONFIG, icu-config, no)
+-if test x$ICU_CONFIG = xno; then
+-   AM_CONDITIONAL(HAVE_ICU,false)
++AC_ARG_ENABLE(icu,
++AC_HELP_STRING([--disable-icu], [Don't use icu to detect and convert non-UTF8 strings (default is NO)]),
++[enableval2=$enableval],
++[enableval2=yes])
++if test $enableval2 = yes; then
++   # First, check for the icu-config tool
++   AC_PATH_PROGS(ICU_CONFIG, icu-config, no)
++   if test x$ICU_CONFIG = xno; then
++      AM_CONDITIONAL(HAVE_ICU,false)
++   else
++    AC_DEFINE(FEATURE_ICU,1,"ICU library is there")
++    AM_CONDITIONAL(HAVE_ICU,true)
++    ICU_LDADD=`$ICU_CONFIG --ldflags`
++    AC_SUBST(ICU_LDADD)
++    ICU_CFLAGS=`$ICU_CONFIG --cppflags`
++    AC_SUBST(ICU_CFLAGS)
++   fi
+ else
+-   AC_DEFINE(FEATURE_ICU,1,"ICU library is there")
+-   AM_CONDITIONAL(HAVE_ICU,true)
+-   ICU_LDADD=`$ICU_CONFIG --ldflags`
+-   AC_SUBST(ICU_LDADD)
+-   ICU_CFLAGS=`$ICU_CONFIG --cppflags`
+-   AC_SUBST(ICU_CFLAGS)
++  AM_CONDITIONAL(HAVE_ICU,false)
+ fi
+ #ICU_LDADD=`$ICU_CONFIG --ldflags`
diff --git a/net/seeks/patches/100-no_tests-and-add-iconv-link.patch b/net/seeks/patches/100-no_tests-and-add-iconv-link.patch
new file mode 100644 (file)
index 0000000..0dd28ae
--- /dev/null
@@ -0,0 +1,34 @@
+diff -ru seeks-0.3.3/src/Makefile.am seeks-0.3.3-new/src/Makefile.am
+--- seeks-0.3.3/src/Makefile.am        2011-04-30 10:16:57.000000000 +0200
++++ seeks-0.3.3-new/src/Makefile.am    2011-05-27 10:56:09.648313435 +0200
+@@ -57,12 +57,12 @@
+ LDADD += -lseeksuserdb -lseeksuserdbfix
+ endif
+ endif
+-LDADD += -lpcre -lpcreposix -lseekslsh -lseeksdht -lrmd160 -lpthread -lz @CURL_LDADD@
++LDADD += -lpcre -lpcreposix -lseekslsh -lseeksdht -lrmd160 -lpthread -lz -liconv @CURL_LDADD@
+ if !HAVE_BSD
+ LDADD += -ldl
+ endif
+-SUBDIRS=utils proxy lsh dht plugins proxy/tests lsh/tests .
++SUBDIRS=utils proxy lsh dht plugins .
+ configdir=$(sysconfdir)/seeks
+ dist_config_DATA=config \
+diff -rU5 seeks-0.3.3/src/plugins/websearch/Makefile.am seeks-0.3.3-new/src/plugins/websearch/Makefile.am
+--- seeks-0.3.3/src/plugins/websearch/Makefile.am      2011-04-30 10:16:57.000000000 +0200
++++ seeks-0.3.3-new/src/plugins/websearch/Makefile.am  2011-05-24 00:42:34.836033228 +0200
+@@ -42,11 +42,11 @@
+ if USE_PERL
+ libseekswebsearchplugin_la_CXXFLAGS += `perl -MExtUtils::Embed -e ccopts`
+ endif
+-SUBDIRS=. tests
++SUBDIRS=. 
+ websearchconfigdir=$(sysconfdir)/seeks
+ dist_websearchconfig_DATA=websearch-config
+ nobase_dist_websearchplugindata_DATA= \
diff --git a/net/seeks/patches/200-add_pcre_headers_to_plugins.patch b/net/seeks/patches/200-add_pcre_headers_to_plugins.patch
new file mode 100644 (file)
index 0000000..0e21b97
--- /dev/null
@@ -0,0 +1,32 @@
+diff -rU5 seeks-0.3.3/src/plugins/blocker/Makefile.am seeks-0.3.3-new/src/plugins/blocker/Makefile.am
+--- seeks-0.3.3/src/plugins/blocker/Makefile.am        2010-12-05 09:33:05.000000000 +0100
++++ seeks-0.3.3-new/src/plugins/blocker/Makefile.am    2011-05-24 01:13:09.994085964 +0200
+@@ -4,11 +4,11 @@
+ blockerplugindatadir = $(datadir)/seeks/plugins/blocker
+ AM_CXXFLAGS=-Wall -g -pipe
+ AM_CPPFLAGS= -I${srcdir} -I${srcdir}/../../utils -I${srcdir}/../../proxy -I${srcdir}/../../lsh \
+           -DSEEKS_CONFIGDIR='"$(sysconfdir)/seeks/"' `pkg-config --cflags protobuf` `pkg-config --cflags tokyocabinet` \
+-          -I../../proxy
++          -I../../proxy @PCRE_CFLAGS@
+ ACLOCAL_AMFLAGS=-I m4
+ blockerpluginlib_LTLIBRARIES=libblockerplugin.la
+ libblockerplugin_la_SOURCES=blocker.cpp blocker.h
+diff -rU5 seeks-0.3.3/src/plugins/httpserv/Makefile.am seeks-0.3.3-new/src/plugins/httpserv/Makefile.am
+--- seeks-0.3.3/src/plugins/httpserv/Makefile.am       2011-02-18 15:44:02.000000000 +0100
++++ seeks-0.3.3-new/src/plugins/httpserv/Makefile.am   2011-05-24 01:27:13.413787987 +0200
+@@ -4,11 +4,11 @@
+ httpservplugindatadir = $(datadir)/seeks/plugins/httpserv
+ AM_CPPFLAGS=-Wno-deprecated -Wall -g -pipe \
+             -I${srcdir} -I${srcdir}/../websearch -I${srcdir}/../../utils -I${srcdir}/../../lsh -I${srcdir}/../../proxy \
+-          -I${srcdir}/../../dht
++          -I${srcdir}/../../dht @PCRE_CFLAGS@
+ if HAVE_TC
+ if HAVE_PROTOBUF
+ AM_CPPFLAGS+=-I${srcdir}/../query_capture -I${srcdir}/../cf `pkg-config --cflags protobuf` `pkg-config --cflags tokyocabinet`
diff --git a/net/ser2net/Makefile b/net/ser2net/Makefile
new file mode 100644 (file)
index 0000000..c67e08f
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006-2013 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:=ser2net
+PKG_VERSION:=2.9.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ser2net
+PKG_MD5SUM:=80011ac0e60bbdcb65f1d7a86251e3f3
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ser2net
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Serial port TCP/IP redirector
+  URL:=http://sourceforge.net/projects/ser2net/
+endef
+
+define Package/ser2net/description
+  This is ser2net, a program for allowing network connections to serial ports.
+  See the man page for information about using the program. Note that ser2net
+  supports RFC 2217 (remote control of serial port parameters), but you must
+  have a complient client.
+endef
+
+define Package/ser2net/conffiles
+/etc/ser2net.conf
+endef
+
+# uses GNU configure
+
+define Package/ser2net/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ser2net $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/ser2net.conf $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,ser2net))
diff --git a/net/serialoverip/Makefile b/net/serialoverip/Makefile
new file mode 100644 (file)
index 0000000..c1ed9fa
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2009 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:=serialoverip
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).tgz
+PKG_SOURCE_URL:=@SF/serialoverip
+PKG_MD5SUM:=0931cca65b8f9d32079fa3e55130ee1e
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/serialoverip
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=SerialOverIP
+  URL:=http://sourceforge.net/projects/serialoverip/
+endef
+
+define Package/serialoverip/description
+       Tool for transport of serial interfaces over UDP/IP.
+       Usefull for accessing a distant serial device by a local program.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) \
+               -o $(PKG_BUILD_DIR)/serialoverip $(PKG_BUILD_DIR)/serialoverip.c
+endef
+
+define Package/serialoverip/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/serialoverip $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,serialoverip))
diff --git a/net/serialoverip/patches/001-compile-fixes.patch b/net/serialoverip/patches/001-compile-fixes.patch
new file mode 100644 (file)
index 0000000..f487e24
--- /dev/null
@@ -0,0 +1,76 @@
+diff -ur serialoverip-1.0.orig/serialoverip.c serialoverip-1.0/serialoverip.c
+--- serialoverip-1.0.orig/serialoverip.c       2009-09-24 19:32:40.000000000 +0200
++++ serialoverip-1.0/serialoverip.c    2009-09-24 19:43:18.000000000 +0200
+@@ -34,6 +34,7 @@
+ #include <fcntl.h>
+ #include <termios.h>
+ #include <signal.h>
++#include <strings.h>
+ #define MAXMESG 2048
+@@ -42,20 +43,19 @@
+ int s[2],st[2];
+ void help(){
+-      fprintf(stderr,"\
+-SerialOverIP version 1.0, Copyright (C) 2002 Stefan-Florin Nicola <sten@fx.ro>
+-SerialOverIP comes with ABSOLUTELY NO WARRANTY. This is free software, and you
+-are welcome to redistribute it under GNU General Public License.
+- Usage: %s <source1> <source2>
+-  where <source1> and <source2> are one of the folowing:
+-    -s <IP> <port>                 UDP server on IP:port
+-    -c <IP> <port>                 UDP client for server IP:port
+-    -d <device> sss-dps            local serial device
+-       sss is speed (50,..,230400)
+-       d is data bits (5,6,7,8)
+-       p is parity type (N,E,O)
+-       s is stop bits (1,2)
+-",pname);
++      fprintf(stderr,
++"SerialOverIP version 1.0, Copyright (C) 2002 Stefan-Florin Nicola <sten@fx.ro>\n"
++"SerialOverIP comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n"
++"are welcome to redistribute it under GNU General Public License.\n"
++" Usage: %s <source1> <source2>\n"
++"  where <source1> and <source2> are one of the folowing:\n"
++"    -s <IP> <port>                 UDP server on IP:port\n"
++"    -c <IP> <port>                 UDP client for server IP:port\n"
++"    -d <device> sss-dps            local serial device\n"
++"       sss is speed (50,..,230400)\n"
++"       d is data bits (5,6,7,8)\n"
++"       p is parity type (N,E,O)\n"
++"       s is stop bits (1,2)\n", pname);
+       return;
+ }
+@@ -113,10 +113,9 @@
+ int main(int argc,char**argv){
+       int i,n,w,clen[2],nonblock[2],speed,data,stopb;
+-      unsigned char c,buf[MAXMESG],*p,parity;
++      unsigned char buf[MAXMESG],*p,parity;
+       struct termios cfg;
+       struct sockaddr_in addr[4][4];
+-      struct sigaction newact,oldact;
+       pname=argv[0];
+       if(argc!=7){
+@@ -156,7 +155,7 @@
+                       n=sscanf(argv[3*i+3],"%d-%d%c%d",&speed,&data,&parity,&stopb);
+                       if(n<4){
+                               fprintf(stderr,"%s: invalid argument %1d from %s\n",
+-                                              pname,read+1,argv[3*i+3]);
++                                              pname,(int)(read+1),argv[3*i+3]);
+                               return 3;
+                       }
+                       if(setserial(s[i],&cfg,speed,data,parity,stopb)<0){
+@@ -177,7 +176,7 @@
+               if(st[i]&2)n=read(s[i],buf,MAXMESG);
+               else{
+                       n=recvfrom(s[i],buf,MAXMESG,nonblock[i]*MSG_DONTWAIT,
+-                                      (struct sockaddr*)&addr[i][st[i]],&clen[i]);
++                                      (struct sockaddr*)&addr[i][st[i]],(socklen_t *)&clen[i]);
+                       nonblock[i]=1;
+               }
+               p=buf;
+Only in serialoverip-1.0: serialoverip.new
diff --git a/net/shat/Makefile b/net/shat/Makefile
new file mode 100644 (file)
index 0000000..7412f53
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=shat
+PKG_VERSION:=0.9.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/shat
+PKG_MD5SUM:=da06846f35838b14d1513523dad84d24
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Source Hardware Address Translation
+  URL:=http://sourceforge.net/projects/shat/
+endef
+
+define Package/shat/description
+       A tool which allows hosts with arbitrary IP configuration
+       to connect to the internet over a SHAT gateway.
+
+endef
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -Wall -I$(PKG_BUILD_DIR)/include/linux/include -I$(PKG_BUILD_DIR)/include -DVERSION=\\\"$(PKG_VERSION)\\\" -DDROP_NETBIOS"
+endef
+
+define Package/shat/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/shatd $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/shatc $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,shat))
diff --git a/net/shorewall-core/Makefile b/net/shorewall-core/Makefile
new file mode 100644 (file)
index 0000000..060a274
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2008-2012 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:=shorewall-core
+PKG_VERSION:=4.5.7
+PKG_DIRECTORY:=4.5.7
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.shorewall.net/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://www1.shorewall.net/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://slovakia.shorewall.net/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://shorewall.de/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://www.shorewall.com.au/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://shorewall.infohiiway.com/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://www.shorewall.com.ar/pub/shorewall/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=ed3880b96a22e16cafc68d2e0f976b3a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shorewall-core
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip +iptables +perl +perlbase-digest
+  TITLE:=Shorewall Core
+  URL:=http://www.shorewall.net/
+  SUBMENU:=Firewall
+endef
+
+define Package/shorewall-core/description
+       The Shoreline Firewall, is high-level tool for configuring Netfilter.
+       This package provides the core Shorewall libraries installed in /usr/share/shorewall/,
+       which are required for the rest of the Shorewall packages to work.
+endef
+
+define Package/shorewall-core/conffiles
+       /usr/share/shorewall/shorewallrc
+endef
+
+CONFIGURE_ARGS += \
+       vendor=linux
+
+define Build/Compile
+       DESTDIR=$(PKG_INSTALL_DIR) $(PKG_BUILD_DIR)/install.sh
+endef
+
+define Package/shorewall-core/install
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/shorewall $(1)/usr/share
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/shorewall/wait4ifup $(1)/usr/share/shorewall
+endef
+
+$(eval $(call BuildPackage,shorewall-core))
diff --git a/net/shorewall-core/patches/100-shorewallrc.default.patch b/net/shorewall-core/patches/100-shorewallrc.default.patch
new file mode 100644 (file)
index 0000000..47324ca
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/shorewallrc.default      2012-08-08 16:29:23.000000000 +0200
++++ b/shorewallrc.default      2012-08-13 10:15:46.769381221 +0200
+@@ -2,7 +2,7 @@
+ # Default Shorewall 4.5 rc file
+ #
+ HOST=linux                              #Generic Linux
+-BUILD=                                  #Default is to detect the build system
++BUILD=linux                             #Default is to detect the build system
+ PREFIX=/usr                             #Top-level directory for shared files, libraries, etc.
+ SHAREDIR=${PREFIX}/share                #Directory for arch-neutral files.
+ LIBEXECDIR=${PREFIX}/share              #Directory for executable scripts.
diff --git a/net/shorewall-core/patches/110-lib.common.patch b/net/shorewall-core/patches/110-lib.common.patch
new file mode 100644 (file)
index 0000000..c582523
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/lib.common       2012-08-08 16:29:23.000000000 +0200
++++ b/lib.common       2012-08-13 10:14:23.574529864 +0200
+@@ -372,7 +372,7 @@
+     [ -z "$MODULESDIR" ] && \
+       uname=$(uname -r) && \
+-      MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
++      MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset:/lib/modules/$uname
+     [ -d /sys/module/ ] || MODULES=$(lsmod | cut -d ' ' -f1)
+@@ -411,7 +411,7 @@
+     [ -z "$MODULESDIR" ] && \
+       uname=$(uname -r) && \
+-      MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset
++      MODULESDIR=/lib/modules/$uname/kernel/net/ipv${g_family}/netfilter:/lib/modules/$uname/kernel/net/netfilter:/lib/modules/$uname/kernel/net/sched:/lib/modules/$uname/extra:/lib/modules/$uname/extra/ipset:/lib/modules/$uname
+     for directory in $(split $MODULESDIR); do
+       [ -d $directory ] && moduledirectories="$moduledirectories $directory"
diff --git a/net/shorewall-lite/Makefile b/net/shorewall-lite/Makefile
new file mode 100644 (file)
index 0000000..434cb9d
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2008-2012 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:=shorewall-lite
+PKG_VERSION:=4.5.7
+PKG_DIRECTORY:=4.5.7
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.shorewall.net/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://www1.shorewall.net/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://slovakia.shorewall.net/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://shorewall.de/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://www.shorewall.com.au/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://shorewall.infohiiway.com/pub/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/ \
+       http://www.shorewall.com.ar/pub/shorewall/shorewall/4.5/shorewall-$(PKG_DIRECTORY)/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=d2650b0842b5b3f950423a4f5ada0c3e
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shorewall-lite
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip +iptables +shorewall-core +perlbase-digest
+  TITLE:=Shorewall Lite
+  URL:=http://www.shorewall.net/
+  SUBMENU:=Firewall
+endef
+
+define Package/shorewall-lite/description
+       The Shoreline Firewall, is high-level tool for configuring Netfilter.
+
+       Shorewall allows for central administration of multiple IPv4 firewalls
+       through use of Shorewall lite. The full Shorewall product is installed
+       on a central administrative system where compiled Shorewall scripts are
+       generated. These scripts are copied to the firewall systems where they
+       run under the control of Shorewall-lite.
+endef
+
+define Package/shorewall-lite/conffiles
+/etc/shorewall-lite/shorewall-lite.conf
+/etc/shorewall-lite/vardir
+endef
+
+CONFIGURE_ARGS += \
+       vendor=linux
+
+define Build/Compile
+       DESTDIR=$(PKG_INSTALL_DIR) $(PKG_BUILD_DIR)/install.sh
+endef
+
+define Package/shorewall-lite/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/lsm/script.d
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DIR) $(1)/etc/shorewall-lite/state
+       $(INSTALL_DIR) $(1)/usr/share
+       $(INSTALL_BIN) ./files/shorewall-lite.init $(1)/etc/init.d/shorewall-lite
+       $(INSTALL_BIN) ./files/hotplug_iface $(1)/etc/hotplug.d/iface/05-shorewall-lite
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/shorewall-lite $(1)/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/shorewall-lite $(1)/usr/share
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/shorewall-lite/shorecap $(1)/usr/share/shorewall-lite
+       $(INSTALL_BIN) ./files/hostname $(1)/usr/share/shorewall-lite
+       $(INSTALL_BIN) ./files/lsm_script $(1)/etc/lsm/script.d/45_shorewall-lite
+       $(CP) $(PKG_INSTALL_DIR)/etc/shorewall-lite $(1)/etc
+       $(CP) ./files/vardir $(1)/etc/shorewall-lite
+endef
+
+$(eval $(call BuildPackage,shorewall-lite))
diff --git a/net/shorewall-lite/files/hostname b/net/shorewall-lite/files/hostname
new file mode 100644 (file)
index 0000000..42e1643
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat /proc/sys/kernel/hostname
diff --git a/net/shorewall-lite/files/hotplug_iface b/net/shorewall-lite/files/hotplug_iface
new file mode 100644 (file)
index 0000000..acb9950
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# should restart shorewall when an interface comes up
+
+[ ifup = "$ACTION" ] && {
+       /etc/init.d/shorewall-lite restart
+}
+
+[ ifdown = "$ACTION" ] && {
+       # might need to restore some routing
+       /etc/init.d/shorewall-lite restart
+}
diff --git a/net/shorewall-lite/files/lsm_script b/net/shorewall-lite/files/lsm_script
new file mode 100644 (file)
index 0000000..b324508
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# (C) 2009 Mika Ilmaranta <ilmis@nullnet.fi>
+# (C) 2009 Tom Eastep <teastep@shorewall.net>
+#
+# License: GPLv2
+#
+
+STATE=${1}
+DEVICE=${4}
+
+if [ -f /usr/share/shorewall-lite/lib.base ]; then
+       VARDIR=/etc/shorewall-lite/state
+       STATEDIR=/etc/shorewall-lite
+fi
+
+[ -f ${STATEDIR}/vardir ] && . ${STATEDIR}/vardir
+
+if [ ${STATE} = up ]; then
+       ${VARDIR}/firewall enable ${DEVICE}
+else
+       ${VARDIR}/firewall disable ${DEVICE}
+fi
+
+/sbin/shorewall-lite show routing > /var/log/lsm
+
+exit 0
diff --git a/net/shorewall-lite/files/shorewall-lite.init b/net/shorewall-lite/files/shorewall-lite.init
new file mode 100644 (file)
index 0000000..777683a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+
+START=46
+start() {
+       touch /var/log/messages
+       mkdir -p /var/lock/subsys
+       /sbin/shorewall-lite -qq start
+}
+
+stop() {
+       /sbin/shorewall-lite -qq stop
+}
+
+restart() {
+       if [ -f /etc/shorewall-lite/state/restore ] ; then
+               /sbin/shorewall-lite -qq restore
+       else
+               /sbin/shorewall-lite -qq restart
+       fi
+}
diff --git a/net/shorewall-lite/files/vardir b/net/shorewall-lite/files/vardir
new file mode 100644 (file)
index 0000000..3afdabb
--- /dev/null
@@ -0,0 +1,2 @@
+# move state dir out of ram
+VARDIR=/etc/shorewall-lite/state
diff --git a/net/shorewall-lite/patches/100-shorewallrc.default.patch b/net/shorewall-lite/patches/100-shorewallrc.default.patch
new file mode 100644 (file)
index 0000000..0cbc9f0
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/shorewallrc.default      2012-08-08 17:42:31.000000000 +0200
++++ b/shorewallrc.default      2012-08-13 11:53:38.479048989 +0200
+@@ -2,7 +2,7 @@
+ # Default Shorewall 4.5 rc file
+ #
+ HOST=linux                              #Generic Linux
+-BUILD=                                  #Default is to detect the build system
++BUILD=linux                             #Default is to detect the build system
+ PREFIX=/usr                             #Top-level directory for shared files, libraries, etc.
+ SHAREDIR=${PREFIX}/share                #Directory for arch-neutral files.
+ LIBEXECDIR=${PREFIX}/share              #Directory for executable scripts.
+@@ -10,7 +10,7 @@
+ CONFDIR=/etc                            #Directory where subsystem configurations are installed
+ SBINDIR=/sbin                           #Directory where system administration programs are installed
+ MANDIR=${PREFIX}/man                    #Directory where manpages are installed.
+-INITDIR=etc/init.d                      #Directory where SysV init scripts are installed.
++INITDIR=/etc/init.d                     #Directory where SysV init scripts are installed.
+ INITFILE=$PRODUCT                       #Name of the product's installed SysV init script
+ INITSOURCE=init.sh                      #Name of the distributed file to be installed as the SysV init script
+ ANNOTATED=                              #If non-zero, annotated configuration files are installed
+@@ -18,4 +18,4 @@
+ SYSCONFFILE=                            #Name of the distributed file to be installed in $SYSCONFDIR
+ SYSCONFDIR=                             #Directory where SysV init parameter files are installed
+ SPARSE=                                 #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
+-VARDIR=/var/lib                         #Directory where product variable data is stored.
++VARDIR=/etc/shorewall-lite/state        #Directory where product variable data is stored.
diff --git a/net/shorewall-lite/patches/120-LOGFILE.patch b/net/shorewall-lite/patches/120-LOGFILE.patch
new file mode 100644 (file)
index 0000000..2006cc0
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/shorewall-lite.conf      2012-08-08 16:29:23.000000000 +0200
++++ b/shorewall-lite.conf      2012-08-13 11:11:11.687938395 +0200
+@@ -28,7 +28,7 @@
+ #                            L O G G I N G
+ ###############################################################################
+-LOGFILE=
++LOGFILE=/dev/null
+ ###############################################################################
+ #     L O C A T I O N   O F   F I L E S   A N D   D I R E C T O R I E S
diff --git a/net/siit/Makefile b/net/siit/Makefile
new file mode 100644 (file)
index 0000000..fc059e7
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2006-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=siit
+PKG_VERSION:=1.1
+PKG_RELEASE:=2
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/siit
+  SUBMENU:=Network Devices
+  TITLE:=Stateless IP ICMP Translation Algorithm
+  DEPENDS:= @(!(TARGET_ps3||TARGET_pxcab)||BROKEN)
+  FILES:=$(PKG_BUILD_DIR)/siit.ko
+  AUTOLOAD:=$(call AutoLoad,50,siit)
+endef
+
+include $(INCLUDE_DIR)/kernel-defaults.mk
+
+define KernelPackage/siit/description
+ Stateless IP ICMP Translation Algorithm
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       cp src/Makefile src/siit.h src/siit.c $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+       $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS="$(PKG_BUILD_DIR)" modules
+endef
+
+$(eval $(call KernelPackage,siit))
diff --git a/net/siit/src/Makefile b/net/siit/src/Makefile
new file mode 100644 (file)
index 0000000..06c36f1
--- /dev/null
@@ -0,0 +1,5 @@
+obj-m   := siit.o
+ifeq ($(MAKING_MODULES),1)
+-include $(TOPDIR)/Rules.make
+endif
+
diff --git a/net/siit/src/siit.c b/net/siit/src/siit.c
new file mode 100644 (file)
index 0000000..20cfabf
--- /dev/null
@@ -0,0 +1,1425 @@
+/*
+ * siit.c: the Stateless IP/ICMP Translator (SIIT) module for Linux.
+ *
+ *
+ */
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>       /* printk() */
+#include <linux/slab.h>
+
+#include <linux/errno.h>        /* error codes */
+#include <linux/types.h>        /* size_t */
+#include <linux/interrupt.h>    /* mark_bh */
+#include <linux/random.h>
+#include <linux/in.h>
+#include <linux/netdevice.h>    /* struct device, and other headers */
+#include <linux/etherdevice.h>  /* eth_type_trans */
+#include <net/ip.h>             /* struct iphdr */
+#include <net/icmp.h>           /* struct icmphdr */
+#include <net/ipv6.h>
+#include <net/udp.h>
+#include <linux/skbuff.h>
+#include <linux/in6.h>
+#include <linux/init.h>
+#include <asm/uaccess.h>
+#include <asm/checksum.h>
+#include <net/ip6_checksum.h>
+#include <linux/in6.h>
+#include "siit.h"
+
+MODULE_AUTHOR("Dmitriy Moscalev, Grigory Klyuchnikov, Felix Fietkau");
+
+/*
+ * If tos_ignore_flag != 0, we don't copy TOS and Traffic Class
+ * from origin paket and set it to 0
+ */
+int tos_ignore_flag = 0;
+
+#define siit_stats(_dev) (&(_dev)->stats)
+
+/*
+ * The Utility  stuff
+ */
+
+#ifdef SIIT_DEBUG
+/* print dump bytes (data point data area sizeof len and message
+ * before dump.
+ */
+static int siit_print_dump(char *data, int len, char *message)
+{
+       int i;
+       int j = 0, k = 1;
+
+       len = len > BUFF_SIZE ? BUFF_SIZE : len;
+       printk("%s:\n", message);
+       for (i=0; i < len; i++, k++) {
+               if( i == len-1 || k == 16) {
+                       printk("%02x\n", (~(~0 << 8) & *(data+i)));
+                       j = 0;
+                       k = 0;
+               }
+               else if (j) {
+                       printk("%02x ", (~(~0 << 8) & *(data+i)));
+                       j--;
+               }
+               else {
+                       printk("%02x", (~(~0 << 8) & *(data+i)));
+                       j++;
+               }
+       }
+       return 0;
+}
+#endif
+
+/*
+ * Open and close
+ */
+static int siit_open(struct net_device *dev)
+{
+       netif_start_queue(dev);
+       return 0;
+}
+
+
+static int siit_release(struct net_device *dev)
+{
+       netif_stop_queue(dev); /* can't transmit any more */
+       return 0;
+}
+
+/*
+ * Translation IPv4 to IPv6 stuff
+ *
+ * ip4_ip6 (src, len, dst, include_flag)
+ *
+ * where
+ * src - buffer with original IPv4 packet,
+ * len - size of original packet,
+ * dst - new buffer for IPv6 packet,
+ * include_flag - if = 1, dst point to IPv4 packet that is ICMP error
+ *                included IP packet, else = 0
+ */
+
+static int ip4_ip6(char *src, int len, char *dst, int include_flag)
+{
+       struct iphdr *ih4 = (struct iphdr *) src; /* point to current IPv4 header struct */
+       struct icmphdr *icmp_hdr;   /* point to current ICMPv4 header struct */
+       struct udphdr *udp_hdr;     /* point to current IPv4 UDP header struct */
+
+       struct ipv6hdr *ih6 = (struct ipv6hdr *) dst; /* point to current IPv6 header struct */
+       struct frag_hdr *ih6_frag = (struct frag_hdr *)(dst+sizeof(struct ipv6hdr));
+                                                                                     /* point to current IPv6 fragment header struct */
+       struct icmp6hdr *icmp6_hdr; /* point to current ICMPv6 header */
+
+       int hdr_len = (int)(ih4->ihl * 4); /* IPv4 header length */
+       int icmp_len;               /* ICMPv4 packet length */
+       int plen;                   /* payload length */
+
+       unsigned int csum;          /* need to calculate ICMPv6 and UDP checksum */
+       int fl_csum = 0;            /* flag to calculate UDP checksum */
+       int icmperr = 1;            /* flag to indicate ICMP error message and to need
+                                                                  translate ICMP included IP packet */
+       int fr_flag = 0;            /* fragment flag, if = 0 - don't add
+                                                                  fragment header */
+       __u16 new_tot_len;          /* need to calculate IPv6 total length */
+       __u8 new_nexthdr;           /* next header code */
+       __u16 icmp_ptr = 0;         /* Pointer field in ICMP_PARAMETERPROB */
+
+#ifdef SIIT_DEBUG              /* print IPv4 header dump */
+       siit_print_dump(src, hdr_len, "siit: ip4_ip6() (in) ip4 header dump");
+#endif
+
+       /* If DF == 1 && MF == 0 && Fragment Offset == 0
+        * or this packet is ICMP included IP packet
+        * we don't need fragment header */
+       if (ntohs(ih4->frag_off) == IP_DF || include_flag ) {
+               /* not fragment and we need not to add Fragment
+                * Header to IPv6 packet. */
+               /* total length = total length from IPv4 packet */
+               new_tot_len = ntohs(ih4->tot_len);
+
+               if (ih4->protocol == IPPROTO_ICMP)
+                       new_nexthdr = NEXTHDR_ICMP;
+               else
+                       new_nexthdr = ih4->protocol;
+       }
+       else {
+               /* need to add Fragment Header */
+               fr_flag = 1;
+               /* total length = total length from IPv4 packet +
+                  length of Fragment Header */
+               new_tot_len = ntohs(ih4->tot_len) + sizeof(struct frag_hdr);
+               /* IPv6 Header NextHeader = NEXTHDR_FRAGMENT */
+               new_nexthdr = NEXTHDR_FRAGMENT;
+               /* Fragment Header NextHeader copy from IPv4 packet */
+               if (ih4->protocol == IPPROTO_ICMP)
+                       ih6_frag->nexthdr = NEXTHDR_ICMP;
+               else
+                       ih6_frag->nexthdr = ih4->protocol;
+
+               /* copy frag offset from IPv4 packet */
+               ih6_frag->frag_off = htons((ntohs(ih4->frag_off) & IP_OFFSET) << 3);
+               /* copy MF flag from IPv4 packet */
+               ih6_frag->frag_off = htons((ntohs(ih6_frag->frag_off) |
+                                                                       ((ntohs(ih4->frag_off) & IP_MF) >> 13)));
+               /* copy Identification field from IPv4 packet */
+               ih6_frag->identification = htonl(ntohs(ih4->id));
+               /* reserved field initialized to zero */
+               ih6_frag->reserved = 0;
+       }
+
+       /* Form rest IPv6 fields */
+
+       /*
+        * At this point we need to add checking of unxpired source
+        * route optin and if it is, send ICMPv4 "destination
+        * unreacheble/source route failes" Type 3/Code 5 and
+        * drop packet. (NOT RELEASED YET)
+        */
+
+       /* IP version = 6 */
+       ih6->version = 6;
+
+       if (tos_ignore_flag) {
+               ih6->priority = 0;
+               ih6->flow_lbl[0] = 0;
+       } else {
+               ih6->priority = (ih4->tos & 0xf0) >> 4;
+               ih6->flow_lbl[0] = (ih4->tos & 0x0f) << 4;
+       }
+       ih6->flow_lbl[1] = 0;
+       ih6->flow_lbl[2] = 0;
+
+       /* Hop Limit = IPv4 TTL */
+       ih6->hop_limit = ih4->ttl;
+
+       /* Translate source destination addresses,
+          for IPv6 host it's IPv4-translated IPv6 address,
+          for IPv4 host it's IPv4-mapped IPv6 address
+
+          !!WARNING!! Instead IPv4-mapped IPv6 addresses we use addreesses
+          with unused prefix ::ffff:ffff:0:0/96, because KAME implementation
+          doesn't support IPv4-mapped addresses in IPv6 packets and discard them.
+
+       */
+
+       if (include_flag) {
+               /*
+                  It's ICMP included IP packet and there is a diffirence
+                  in src/dst addresses then src/dst in normal direction
+                */
+
+               /*
+                  Source address
+                  is IPv4-translated IPv6 address because packet traveled
+                  from IPv6 to IPv4 area
+               */
+               ih6->saddr.in6_u.u6_addr32[0] = 0;
+               ih6->saddr.in6_u.u6_addr32[1] = 0;
+               ih6->saddr.in6_u.u6_addr32[2] = htonl(TRANSLATED_PREFIX); /* to network order bytes */
+               ih6->saddr.in6_u.u6_addr32[3] = ih4->saddr;
+
+               /*
+                  Destination address
+                  is IPv4-mapped address (but it's not IPv4- mapped, we use
+                  prefix ::ffff:ffff:0:0/96
+                */
+               ih6->daddr.in6_u.u6_addr32[0] = 0;
+               ih6->daddr.in6_u.u6_addr32[1] = 0;
+               ih6->daddr.in6_u.u6_addr32[2] = htonl(MAPPED_PREFIX); /* to network order bytes */
+               ih6->daddr.in6_u.u6_addr32[3] = ih4->daddr;
+       }
+       else {
+
+               /*
+                  This is normal case (packet isn't included IP packet)
+
+                  Source address
+                  is IPv4-mapped address (but it's not IPv4- mapped, we use
+                  prefix ::ffff:ffff:0:0/96)
+               */
+               ih6->saddr.in6_u.u6_addr32[0] = 0;
+               ih6->saddr.in6_u.u6_addr32[1] = 0;
+               ih6->saddr.in6_u.u6_addr32[2] = htonl(MAPPED_PREFIX); /* to network order bytes */
+               ih6->saddr.in6_u.u6_addr32[3] = ih4->saddr;
+
+               /* Destination address
+                  is is IPv4-translated IPv6 address
+                */
+               ih6->daddr.in6_u.u6_addr32[0] = 0;
+               ih6->daddr.in6_u.u6_addr32[1] = 0;
+               ih6->daddr.in6_u.u6_addr32[2] = htonl(TRANSLATED_PREFIX); /* to network order bytes */
+               ih6->daddr.in6_u.u6_addr32[3] = ih4->daddr;
+       }
+
+       /* Payload Length */
+       plen = new_tot_len - hdr_len; /* Payload length = IPv4 total len - IPv4 header len */
+       ih6->payload_len = htons(plen);
+
+       /* Next Header */
+       ih6->nexthdr = new_nexthdr; /* Next Header */
+
+       /* Process ICMP protocols data */
+
+       switch (ih4->protocol) {
+       case IPPROTO_ICMP:
+               if ( (ntohs(ih4->frag_off) & IP_OFFSET) != 0 || (ntohs(ih4->frag_off) & IP_MF) != 0 ) {
+                       PDEBUG("ip4_ip6(): don't translate ICMPv4 fragments - packet dropped.\n");
+                       return -1;
+               }
+
+               icmp_hdr = (struct icmphdr *) (src+hdr_len); /* point to ICMPv4 header */
+               csum = 0;
+               icmp_len =  ntohs(ih4->tot_len) - hdr_len; /* ICMPv4 packet length */
+               icmp6_hdr = (struct icmp6hdr *)(dst+sizeof(struct ipv6hdr)
+                                                                           +fr_flag*sizeof(struct frag_hdr)); /* point to ICMPv6 header */
+
+               if (include_flag) {
+                       /* ICMPv4 packet cannot be included in ICMPv4 Error message */
+                       /* !!! May be it's WRONG !!! ICMPv4 QUERY packet can be included
+                          in ICMPv4 Error message */
+                       PDEBUG("ip4_ip6(): It's included ICMPv4 in ICMPv4 Error message - packet dropped.\n");
+                       return -1;
+               }
+
+               /* Check ICMPv4 Type field */
+               switch (icmp_hdr->type) {
+               /* ICMP Error messages */
+               /* Destination Unreachable (Type 3) */
+               case ICMP_DEST_UNREACH:
+                       icmp6_hdr->icmp6_type = ICMPV6_DEST_UNREACH; /* to Type 1 */
+                       icmp6_hdr->icmp6_unused = 0;
+                       switch (icmp_hdr->code)
+                       {
+                       case ICMP_NET_UNREACH: /* Code 0 */
+                       case ICMP_HOST_UNREACH: /* Code 1 */
+                       case ICMP_SR_FAILED: /* Code 5 */
+                       case ICMP_NET_UNKNOWN: /* Code 6 */
+                       case ICMP_HOST_UNKNOWN: /* Code 7 */
+                       case ICMP_HOST_ISOLATED: /* Code 8 */
+                       case ICMP_NET_UNR_TOS: /* Code 11 */
+                       case ICMP_HOST_UNR_TOS: /* Code 12 */
+                               icmp6_hdr->icmp6_code = ICMPV6_NOROUTE; /* to Code 0 */
+                               break;
+                       case ICMP_PROT_UNREACH: /* Code 2 */
+                               icmp6_hdr->icmp6_type = ICMPV6_PARAMPROB; /* to Type 4 */
+                               icmp6_hdr->icmp6_code = ICMPV6_UNK_NEXTHDR; /* to Code 1 */
+                               /* Set pointer filed to 6, it's octet offset IPv6 Next Header field */
+                               icmp6_hdr->icmp6_pointer = htonl(6);
+                               break;
+                       case ICMP_PORT_UNREACH: /* Code 3 */
+                               icmp6_hdr->icmp6_code = ICMPV6_PORT_UNREACH; /* to Code 4 */
+                               break;
+                       case ICMP_FRAG_NEEDED: /* Code 4 */
+                               icmp6_hdr->icmp6_type = ICMPV6_PKT_TOOBIG; /* to Type 2 */
+                               icmp6_hdr->icmp6_code = 0;
+                               /* Correct MTU  */
+                               if (icmp_hdr->un.frag.mtu == 0)
+                                       /* we use minimum MTU for IPv4 PMTUv4 RFC1191, section 5;
+                                          IPv6 implementation wouldn't accept Path MTU < 1280,
+                                          but it records info correctly to always include
+                                          a fragment header */
+                                       icmp6_hdr->icmp6_mtu = htonl(576);
+                               else
+                                       /* needs to adjusted for difference between IPv4/IPv6 headers
+                                        * SIIT RFC2765, section 3.3,
+                                        * we assume that difference is 20 bytes */
+                                       icmp6_hdr->icmp6_mtu = htonl(ntohs(icmp_hdr->un.frag.mtu)+IP4_IP6_HDR_DIFF);
+
+                               break;
+                       case ICMP_NET_ANO: /* Code 9 */
+                       case ICMP_HOST_ANO: /* Code 10 */
+                               icmp6_hdr->icmp6_code = ICMPV6_ADM_PROHIBITED; /* to Code 1 */
+                               break;
+                       default: /* discard any other Code */
+                               PDEBUG("ip4_ip6(): Unknown ICMPv4 Type %d Code %d - packet dropped.\n",
+                                          ICMP_DEST_UNREACH, icmp_hdr->code);
+                               return -1;
+                       }
+                       break;
+                       /* Time Exceeded (Type 11) */
+               case ICMP_TIME_EXCEEDED:
+                       icmp6_hdr->icmp6_type = ICMPV6_TIME_EXCEED;
+                       icmp6_hdr->icmp6_code = icmp_hdr->code;
+                       break;
+                       /* Parameter Problem (Type 12) */
+               case ICMP_PARAMETERPROB:
+                       icmp6_hdr->icmp6_type = ICMPV6_PARAMPROB;
+                       icmp6_hdr->icmp6_code = icmp_hdr->code;
+
+                       icmp_ptr = ntohs(icmp_hdr->un.echo.id) >> 8;
+                       switch (icmp_ptr) {
+                       case 0:
+                               icmp6_hdr->icmp6_pointer = 0; /* IPv4 Version -> IPv6 Version */
+                               break;
+                       case 2:
+                               icmp6_hdr->icmp6_pointer = __constant_htonl(4); /* IPv4 length -> IPv6 Payload Length */
+                               break;
+                       case 8:
+                               icmp6_hdr->icmp6_pointer = __constant_htonl(7); /* IPv4 TTL -> IPv6 Hop Limit */
+                               break;
+                       case 9:
+                               icmp6_hdr->icmp6_pointer = __constant_htonl(6); /* IPv4 Protocol -> IPv6 Next Header */
+                               break;
+                       case 12:
+                               icmp6_hdr->icmp6_pointer = __constant_htonl(8); /* IPv4 Src Addr -> IPv6 Src Addr */
+                               break;
+                       case 16:
+                               icmp6_hdr->icmp6_pointer = __constant_htonl(24); /* IPv4 Dst Addr -> IPv6 Dst Addr */
+                               break;
+                       default:
+                               icmp6_hdr->icmp6_pointer = 0xffffffff; /* set to all ones in any other cases */
+                               break;
+                       }
+                       break;
+               case ICMP_ECHO:
+                       icmperr = 0;
+                       icmp6_hdr->icmp6_type = ICMPV6_ECHO_REQUEST;
+                       icmp6_hdr->icmp6_code = 0;
+                       /* Copy rest ICMP data to new IPv6 packet without changing */
+                       memcpy(((char *)icmp6_hdr)+4, ((char *)icmp_hdr)+4, len - hdr_len - 4);
+                       break;
+
+               case ICMP_ECHOREPLY:
+                       icmperr = 0;
+                       icmp6_hdr->icmp6_type = ICMPV6_ECHO_REPLY;
+                       icmp6_hdr->icmp6_code = 0;
+                       /* Copy rest ICMP data to new IPv6 packet without changing */
+                       memcpy(((char *)icmp6_hdr)+4, ((char *)icmp_hdr)+4, len - hdr_len - 4);
+                       break;
+
+                       /* Discard any other ICMP messages */
+               default:
+                       PDEBUG("ip4_ip6(): Unknown ICMPv4 packet Type %x - packet dropped.\n", icmp_hdr->type);
+                       return -1;
+               }
+
+               /* Now if it's ICMPv4 Error message we must translate included IP packet */
+
+               if (icmperr) {
+                       /* Call our ip4_ip6() to translate included IP packet */
+                       if (ip4_ip6(src+hdr_len+sizeof(struct icmphdr), len - hdr_len - sizeof(struct icmphdr),
+                                               dst+sizeof(struct ipv6hdr)+fr_flag*sizeof(struct frag_hdr)
+                                               +sizeof(struct icmp6hdr), 1) == -1) {
+                               PDEBUG("ip4_ip6(): Uncorrect translation of ICMPv4 Error message - packet dropped.\n");
+                               return -1;
+                       }
+                       /* correct ICMPv6 packet length for diffirence between IPv4 and IPv6 headers
+                          in included IP packet
+                          */
+                       icmp_len += 20;
+                       /* and correct Payload length for diffirence between IPv4 and IPv6 headers */
+                       plen += 20;
+                       ih6->payload_len = htons(plen);
+               }
+
+               /* Calculate ICMPv6 checksum */
+
+               icmp6_hdr->icmp6_cksum = 0;
+               csum = 0;
+
+               csum = csum_partial((u_char *)icmp6_hdr, icmp_len, csum);
+               icmp6_hdr->icmp6_cksum = csum_ipv6_magic(&ih6->saddr, &ih6->daddr, icmp_len,
+                                                                                IPPROTO_ICMPV6, csum);
+               break;
+
+       /* Process TCP protocols data */
+       case IPPROTO_TCP:
+               /* Copy TCP data to new IPv6 packet without changing */
+               memcpy(dst+sizeof(struct ipv6hdr)+fr_flag*sizeof(struct frag_hdr),
+                                  src+hdr_len, len - hdr_len);
+               break;
+
+       /* Process UDP protocols data */
+       case IPPROTO_UDP:
+               udp_hdr = (struct udphdr *)(src+hdr_len);
+               if ((ntohs(ih4->frag_off) & IP_OFFSET) == 0) {
+                       if ((ntohs(ih4->frag_off) & IP_MF) != 0) {
+                               /* It's a first fragment */
+                               if (udp_hdr->check == 0) {
+                                       /* System management event */
+                                       printk("siit: First fragment of UDP with zero checksum - packet droped\n");
+                                       printk("siit: addr: %x src port: %d dst port: %d\n",
+                                                  htonl(ih4->saddr), htons(udp_hdr->source), htons(udp_hdr->dest));
+                                       return -1;
+                               }
+                       }
+                       else if (udp_hdr->check == 0)
+                               fl_csum = 1;
+               }
+
+               /* Copy UDP data to new IPv6 packet */
+               udp_hdr = (struct udphdr *)(dst+sizeof(struct ipv6hdr)
+                                                                       + fr_flag*sizeof(struct frag_hdr));
+               memcpy((char *)udp_hdr, src+hdr_len, len - hdr_len);
+
+               /* Calculate UDP checksum if UDP checksum in IPv4 packet was ZERO
+                  and if it isn't included IP packet
+                */
+               if (fl_csum && (!include_flag)) {
+                       udp_hdr->check = 0;
+                       csum = 0;
+                       csum = csum_partial((unsigned char *)udp_hdr, plen - fr_flag*sizeof(struct frag_hdr), csum);
+                       udp_hdr->check = csum_ipv6_magic(&ih6->saddr, &ih6->daddr, plen -
+                                                                                    fr_flag*sizeof(struct frag_hdr), IPPROTO_UDP, csum);
+               }
+               break;
+
+       /* Discard packets with any other protocol */
+       default:
+               PDEBUG("ip4_ip6(): Unknown upper protocol - packet dropped.\n");
+               return -1;
+       }
+
+#ifdef SIIT_DEBUG
+       siit_print_dump(dst, sizeof(struct ipv6hdr), "siit: ip4_ip6(): (out) ipv6 header dump");
+#endif
+
+       return 0;
+}
+
+/*
+ * Translation IPv6 to IPv4 stuff
+ *
+ * ip6_ip4(src, len, dst, include_flag)
+ *
+ * where
+ * src - buffer with original IPv6 packet,
+ * len - size of original packet,
+ * dst - new buffer for IPv4 packet,
+ * include_flag - if = 1, dst point to IPv6 packet that is ICMP error
+ *                included IP packet, else = 0
+ *
+ */
+
+static int ip6_ip4(char *src, int len, char *dst, int include_flag)
+{
+       struct ipv6hdr *ip6_hdr;    /* point to current IPv6 header struct */
+       struct iphdr *ip_hdr;       /* point to current IPv4 header struct */
+       int opts_len = 0;           /* to sum Option Headers length */
+       int icmperr = 1;            /* if = 1, indicate that packet is ICMP Error message, else = 0 */
+       int ntot_len = 0;           /* to calculate IPv6 Total Length field */
+       int real_len;
+       int len_delta;
+       int ip6_payload_len;
+       int inc_opts_len = 0;       /* to sum Option Headers length in ICMP included IP packet */
+       __u8 next_hdr;              /* Next Header */
+
+#ifdef SIIT_DEBUG
+       siit_print_dump(src, sizeof(struct ipv6hdr), "siit: ip6_ip4(): (in) ipv6 header dump");
+#endif
+
+       if ( (len_delta = len - sizeof(struct ipv6hdr)) >= 0)
+       {
+               ip6_hdr = (struct ipv6hdr *)src;
+               ip_hdr = (struct iphdr *)dst;
+
+               real_len = sizeof(struct iphdr);
+
+               /* Check validation of Saddr & Daddr? is a packet to fall under our translation? */
+               if (include_flag) { /* It's ICMP included IP packet,
+                                                          about process include_flag see comment in ip4_ip6() */
+                       if (ip6_hdr->saddr.s6_addr32[2] != htonl(MAPPED_PREFIX)) {
+                               PDEBUG("ip6_ip4(): Included IP packet Src addr isn't mapped addr: %x%x%x%x, packet dropped.\n",
+                                          ip6_hdr->saddr.s6_addr32[0], ip6_hdr->saddr.s6_addr32[1],
+                                          ip6_hdr->saddr.s6_addr32[2], ip6_hdr->saddr.s6_addr32[3]);
+                               return -1;
+                       }
+                       if ( ip6_hdr->daddr.s6_addr32[2] != htonl(TRANSLATED_PREFIX)) {
+                               PDEBUG("ip6_ip4(): Included IP packet Dst addr isn't translated addr: %x%x%x%x, packet dropped.\n",
+                                          ip6_hdr->daddr.s6_addr32[0], ip6_hdr->daddr.s6_addr32[1],
+                                          ip6_hdr->daddr.s6_addr32[2], ip6_hdr->daddr.s6_addr32[3]);
+                               return -1;
+                       }
+               }
+               else { /* It's normal IP packet (not included in ICMP) */
+                       if (ip6_hdr->saddr.s6_addr32[2] != htonl(TRANSLATED_PREFIX)) {
+                               PDEBUG("ip6_ip4(): Src addr isn't translated addr: %x%x%x%x, packet dropped.\n",
+                                          ip6_hdr->saddr.s6_addr32[0], ip6_hdr->saddr.s6_addr32[1],
+                                          ip6_hdr->saddr.s6_addr32[2], ip6_hdr->saddr.s6_addr32[3]);
+                               return -1;
+                       }
+                       if ( ip6_hdr->daddr.s6_addr32[2] != htonl(MAPPED_PREFIX)) {
+                               PDEBUG("ip6_ip4(): Dst addr isn't mapped addr: %x%x%x%x, packet dropped.\n",
+                                          ip6_hdr->daddr.s6_addr32[0], ip6_hdr->daddr.s6_addr32[1],
+                                          ip6_hdr->daddr.s6_addr32[2], ip6_hdr->daddr.s6_addr32[3]);
+                               return -1;
+                       }
+               }
+
+               /* Set IPv4 Fragment Offset and ID to 0
+                  before process any Option Headers */
+               ip_hdr->frag_off = 0;
+               ip_hdr->id = 0;
+
+               /*
+                * We process only Fragment Header. Any other options headers
+                * are ignored, i.e. there is no attempt to translate them.
+                * However, the Total Length field and the Protocol field would
+                * have to be adjusted to "skip" these extension headers.
+                */
+
+               next_hdr = ip6_hdr->nexthdr;
+
+               /* Hop_by_Hop options header (ip6_hdr->nexthdr = 0). It must
+                * appear only in IPv6 header's Next Header field.
+                */
+               if (next_hdr == NEXTHDR_HOP) {
+                       if ( (len_delta - sizeof(struct ipv6_opt_hdr)) >= 0)
+                       {
+                               struct ipv6_opt_hdr *ip6h =
+                                       (struct ipv6_opt_hdr *)(src+sizeof(struct ipv6hdr) + opts_len);
+                               if ( (len_delta -= ip6h->hdrlen*8 + 8) >= 0)
+                               {
+                                       opts_len += ip6h->hdrlen*8 + 8;  /* See  RFC 2460 page 11:
+                                                       Hdr Ext Len  8-bit unsigned integer.  Length of the Hop-by-
+                                                                                Hop Options header in 8-octet units, not
+                                                                                including the first 8 octets.
+                                                       */
+                                       next_hdr = ip6h->nexthdr;
+                               }
+                               else
+                               {
+                                       PDEBUG("ip6_ip4(): hop_by_hop header error, packet droped");
+                                       /* Generate ICMP Parameter Problem */
+                                       return -1;
+                               }
+                       }
+               }
+
+               if (len_delta > 0)
+               {
+                       while(next_hdr != NEXTHDR_ICMP && next_hdr != NEXTHDR_TCP
+                                 && next_hdr != NEXTHDR_UDP)
+                       {
+                               /* Destination options header */
+                               if (next_hdr == NEXTHDR_DEST)
+                               {
+                                       if ( (len_delta - sizeof(struct ipv6_opt_hdr)) >= 0)
+                                       {
+                                               struct ipv6_opt_hdr *ip6d =
+                                                       (struct ipv6_opt_hdr *)(src + sizeof(struct ipv6hdr) + opts_len);
+                                               if ( (len_delta -= ip6d->hdrlen*8 + 8) >= 0)
+                                               {
+                                                       opts_len += ip6d->hdrlen*8 + 8;
+                                                       next_hdr = ip6d->nexthdr;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               PDEBUG("ip6_ip4(): destination header error, packet droped");
+                                               /* Generate ICMP Parameter Problem */
+                                               return -1;
+                                       }
+                               }
+                               /* Routing options header */
+                               else if (next_hdr == NEXTHDR_ROUTING)
+                               {
+                                       if ( (len_delta - sizeof(struct ipv6_rt_hdr)) >= 0)
+                                       {
+                                               struct ipv6_rt_hdr *ip6rt =
+                                                       (struct ipv6_rt_hdr *)(src+sizeof(struct ipv6hdr) + opts_len);
+                                               /* RFC 2765 SIIT, 4.1:
+                                                  If a routing header with a non-zero Segments Left field is present
+                                                  then the packet MUST NOT be translated, and an ICMPv6 "parameter
+                                                  problem/ erroneous header field encountered" (Type 4/Code 0) error
+                                                  message, with the Pointer field indicating the first byte of the
+                                                  Segments Left field, SHOULD be returned to the sender.
+                                                  */
+                                               if (ip6rt->segments_left != 0) {
+                                                       /* Build ICMPv6 "Parameter Problem/Erroneous Header
+                                                          Field Encountered" & drop the packet */
+                                                       /* !!! We don't send ICMPv6 "Parameter Problem" !!! */
+                                                       PDEBUG("ip6_ip4(): routing header type != 0\n");
+                                                       return -1;
+                                               }
+                                               if ( (len_delta -= ip6rt->hdrlen*8 + 8) >= 0)
+                                               {
+                                                       opts_len += ip6rt->hdrlen*8 + 8;
+                                                       next_hdr = ip6rt->nexthdr;
+                                               }
+                                               else
+                                               {
+                                                       PDEBUG("ip6_ip4(): routing header error, packet droped");
+                                                       /* Generate ICMP Parameter Problem */
+                                                       return -1;
+                                               }
+                                       }
+                               }
+                               /* Fragment options header */
+                               else if (next_hdr == NEXTHDR_FRAGMENT)
+                               {
+                                       if ( (len_delta -= sizeof(struct frag_hdr)) >= 0)
+                                       {
+                                               struct frag_hdr *ip6f =
+                                                       (struct frag_hdr *)(src+sizeof(struct ipv6hdr)+opts_len);
+
+                                               opts_len += sizeof(struct frag_hdr);      /* Frag Header Length = 8 */
+                                               ip_hdr->id = htons(ntohl(ip6f->identification)); /* ID field */
+                                               ip_hdr->frag_off = htons((ntohs(ip6f->frag_off) & IP6F_OFF_MASK) >> 3);
+                                                                                                                  /* fragment offset */
+                                               ip_hdr->frag_off = htons(ntohs(ip_hdr->frag_off) |
+                                                                                        ((ntohs(ip6f->frag_off) & IP6F_MORE_FRAG) << 13));
+                                                                                                                 /* more fragments flag */
+                                               next_hdr = ip6f->nexthdr;
+                                       }
+                                       else
+                                       {
+                                               PDEBUG("ip6_ip4(): fragment header error, packet droped");
+                                               /* Generate ICMP Parameter Problem */
+                                               return -1;
+                                       }
+                               }
+                               /* No Next Header */
+                               else if (next_hdr == NEXTHDR_NONE)
+                               {
+                                       /* RFC 2460 IPv6 Specification, 4.7
+                                          4.7 No Next Header
+
+                                          The value 59 in the Next Header field of an IPv6 header or any
+                                          extension header indicates that there is nothing following that
+                                          header.  If the Payload Length field of the IPv6 header indicates the
+                                          presence of octets past the end of a header whose Next Header field
+                                          contains 59, those octets must be ignored, and passed on unchanged if
+                                          the packet is forwarded.
+                                          */
+                                       break;
+                               }
+                               else if (next_hdr == NEXTHDR_ESP || next_hdr == NEXTHDR_AUTH)
+                               {
+                                       PDEBUG("ip6_ip4(): cannot translate AUTH or ESP extention header, packet dropped\n");
+                                       return -1;
+                               }
+                               else if (next_hdr == NEXTHDR_IPV6)
+                               {
+                                       PDEBUG("ip6_ip4(): cannot translate IPv6-IPv6 packet, packet dropped\n");
+                                       return -1;
+                               }
+                               else if (next_hdr == 0)
+                               {
+                                       /* As say RFC 2460 (IPv6 Spec) we should discard the packet and send an
+                                          ICMP Parameter Problem message to the source of the packet, with an
+                                          ICMP Code value of 1 ("unrecognized Next Header type encountered")
+                                          and the ICMP Pointer field containing the offset of the unrecognized
+                                          value within the original packet
+                                          */
+                                       /* NOT IMPLEMENTED */
+                                       PDEBUG("ip6_ip4(): NEXTHDR in extention header = 0, packet dropped\n");
+                                       return -1;
+                               }
+                               else
+                               {
+                                       PDEBUG("ip6_ip4(): cannot translate extention header = %d, packet dropped\n", next_hdr);
+                                       return -1;
+                               }
+                       }
+               }
+       }
+       else
+       {
+          PDEBUG("ip6_ip4(): error packet len, packet dropped.\n");
+          return -1;
+       }
+
+       /* Building ipv4 packet */
+
+       ip_hdr->version = IPVERSION;
+       ip_hdr->ihl = 5;
+
+       /* TOS see comment about TOS in ip4_ip6() */
+       if (tos_ignore_flag)
+               ip_hdr->tos = 0;
+       else {
+               ip_hdr->tos = ip6_hdr->priority << 4;
+               ip_hdr->tos = ip_hdr->tos | (ip6_hdr->flow_lbl[0] >> 4);
+       }
+
+       /* IPv4 Total Len = IPv6 Payload Len +
+          IPv4 Header Len (without options) - Options Headers Len */
+       ip6_payload_len = ntohs(ip6_hdr->payload_len);
+
+       if (ip6_payload_len == 0)
+               ntot_len = 0;
+       else
+               ntot_len = ip6_payload_len + IP4_IP6_HDR_DIFF - opts_len;
+
+       ip_hdr->tot_len = htons(ntot_len);
+
+       /* IPv4 TTL = IPv6 Hop Limit */
+       ip_hdr->ttl = ip6_hdr->hop_limit;
+
+       /* IPv4 Protocol = Next Header that will point to upper layer protocol */
+       ip_hdr->protocol = next_hdr;
+
+       /* IPv4 Src addr = last 4 bytes from IPv6 Src addr */
+       ip_hdr->saddr = ip6_hdr->saddr.s6_addr32[3];
+       /* IPv4 Dst addr = last 4 bytes from IPv6 Dst addr */
+       ip_hdr->daddr = ip6_hdr->daddr.s6_addr32[3];
+
+       /* Calculate IPv4 header checksum */
+       ip_hdr->check = 0;
+       ip_hdr->check = ip_fast_csum((unsigned char *)ip_hdr, ip_hdr->ihl);
+
+       if (len_delta > 0)
+       {
+               /* PROCESS ICMP */
+
+               if (next_hdr == NEXTHDR_ICMP)
+               {
+                       struct icmp6hdr *icmp6_hdr;
+                       struct icmphdr *icmp_hdr;
+
+                       if ((len_delta -= sizeof(struct icmp6hdr)) >= 0)
+                       {
+                               icmp6_hdr = (struct icmp6hdr *)(src + sizeof(struct ipv6hdr) + opts_len);
+                               icmp_hdr = (struct icmphdr *)(dst + sizeof(struct iphdr));
+
+                               real_len += len_delta + sizeof(struct icmphdr);
+
+                               /* There is diffirent between ICMPv4/ICMPv6 protocol codes
+                                  IPPROTO_ICMP = 1
+                                  IPPROTO_ICMPV6 = 58        */
+                               ip_hdr->protocol = IPPROTO_ICMP;
+
+                               if (include_flag) {
+                                       /* !!! Warnig !!! We discard ICMP packets with any ICMP as included
+                                          in ICMP Error. But ICMP Error messages can include ICMP Query message
+                                          */
+                                       if (icmp6_hdr->icmp6_type != ICMPV6_ECHO_REQUEST)
+                                       {
+                                               PDEBUG("ip6_ip4(): included ICMPv6 in ICMPv6 Error message, packet dropped\n");
+                                               return -1;
+                                       }
+                               }
+
+                       /* Translate ICMPv6 to ICMPv4 */
+                               switch (icmp6_hdr->icmp6_type)
+                               {
+/* ICMP Error messages */
+                       /* Destination Unreachable (Type 1) */
+                               case ICMPV6_DEST_UNREACH: /* Type 1 */
+                                       icmp_hdr->type = ICMP_DEST_UNREACH; /* to Type 3 */
+                                       icmp_hdr->un.echo.id = 0;
+                                       icmp_hdr->un.echo.sequence = 0;
+                                       switch (icmp6_hdr->icmp6_code)
+                                       {
+                                       case ICMPV6_NOROUTE: /* Code 0 */
+                                       case ICMPV6_NOT_NEIGHBOUR: /* Code 2 */
+                                       case ICMPV6_ADDR_UNREACH: /* Code 3  */
+                                               icmp_hdr->code = ICMP_HOST_UNREACH; /* To Code 1 */
+                                               break;
+                                       case ICMPV6_ADM_PROHIBITED: /* Code 1 */
+                                               icmp_hdr->code = ICMP_HOST_ANO; /* To Code 10 */
+                                               break;
+                                       case ICMPV6_PORT_UNREACH: /* Code 4 */
+                                               icmp_hdr->code = ICMP_PORT_UNREACH; /* To Code 3 */
+
+                                               break;
+                                       default:            /* discard any other codes */
+                                               PDEBUG("ip6_ip4(): Unknown ICMPv6 Type %d Code %d - packet dropped.\n",
+                                                          ICMPV6_DEST_UNREACH, icmp6_hdr->icmp6_code);
+                                               return -1;
+                                       }
+                                       break;
+                       /* Packet Too Big (Type 2) */
+                               case ICMPV6_PKT_TOOBIG: /* Type 2 */
+                                       icmp_hdr->type = ICMP_DEST_UNREACH; /* to Type 3  */
+                                       icmp_hdr->code = ICMP_FRAG_NEEDED; /*  to Code 4 */
+                                       /* Change MTU, RFC 2765 (SIIT), 4.2:
+                                          The MTU field needs to be adjusted for the difference between
+                                          the IPv4 and IPv6 header sizes taking into account whether or
+                                          not the packet in error includes a Fragment header.
+                                          */
+                                       /* !!! Don't implement !!! */
+                                       icmp_hdr->un.frag.mtu = (__u16) icmp6_hdr->icmp6_mtu;
+                                       break;
+                       /* Time Exceeded (Type 3) */
+                               case ICMPV6_TIME_EXCEED:
+                                       icmp_hdr->type = ICMP_TIME_EXCEEDED; /* to Type 11 */
+                                       icmp_hdr->code = icmp6_hdr->icmp6_code; /* Code unchanged */
+                                       break;
+                       /* Parameter Problem (Type 4) */
+                               case ICMPV6_PARAMPROB:
+                                       switch (icmp6_hdr->icmp6_code) {
+                                       case ICMPV6_UNK_NEXTHDR: /* Code 1 */
+                                               icmp_hdr->type = ICMP_DEST_UNREACH; /* to Type 3 */
+                                               icmp_hdr->code = ICMP_PROT_UNREACH; /* to Code 2 */
+                                               break;
+                                       default: /* if Code != 1 */
+                                               icmp_hdr->type = ICMP_PARAMETERPROB; /* to Type 12 */
+                                               icmp_hdr->code = 0; /* to Code 0 */
+                                               /* Update Pointer field
+                                                  RFC 2765 (SIIT), 4.2:
+                                                  The Pointer needs to be updated to point to the corresponding
+                                                  field in the translated include IP header.
+                                                  */
+                                               switch (ntohl(icmp6_hdr->icmp6_pointer))
+                                               {
+                                               case 0: /* IPv6 Version -> IPv4 Version */
+                                                       icmp_hdr->un.echo.id = 0;
+                                                       break;
+                                               case 4: /* IPv6 PayloadLength -> IPv4 Total Length */
+                                                       icmp_hdr->un.echo.id = 0x0002; /* 2 */
+                                                       break;
+                                               case 6: /* IPv6 Next Header-> IPv4 Protocol */
+                                                       icmp_hdr->un.echo.id = 0x0009; /* 9 */
+                                                       break;
+                                               case 7: /* IPv6 Hop Limit -> IPv4 TTL */
+                                                       icmp_hdr->un.echo.id = 0x0008; /* 8 */
+                                                       break;
+                                               case 8: /* IPv6 Src addr -> IPv4 Src addr */
+                                                       icmp_hdr->un.echo.id = 0x000c; /* 12 */
+                                                       break;
+                                               case 24: /* IPv6 Dst addr -> IPv4 Dst addr*/
+                                                       icmp_hdr->un.echo.id = 0x0010; /* 16 */
+                                                       break;
+                                               default: /* set all ones in other cases */
+                                                       icmp_hdr->un.echo.id = 0xff;
+                                                       break;
+                                               }
+                                               break;
+                                       }
+                                       break;
+
+/* End of ICMP Error messages */
+
+                       /* Echo Request and Echo Reply (Type 128 and 129)  */
+                               case ICMPV6_ECHO_REQUEST:
+                                       icmperr = 0;        /* not error ICMP message */
+                                       icmp_hdr->type = ICMP_ECHO; /* to Type 8 */
+                                       icmp_hdr->code = 0; /* to Code 0 */
+                                       icmp_hdr->un.echo.id = icmp6_hdr->icmp6_identifier;
+                                       icmp_hdr->un.echo.sequence = icmp6_hdr->icmp6_sequence;
+                                       /* copy rest of ICMP data to result packet */
+                                       if (len_delta > 0)
+                                               memcpy(((char *)icmp_hdr) + sizeof(struct icmphdr),
+                                                          ((char *)icmp6_hdr) + sizeof(struct icmp6hdr), len_delta);
+                                       break;
+                               case ICMPV6_ECHO_REPLY:
+                                       icmperr = 0;        /* not error ICMP message */
+                                       icmp_hdr->type = ICMP_ECHOREPLY; /* to Type 0 */
+                                       icmp_hdr->code = 0; /* to Code 0 */
+                                       icmp_hdr->un.echo.id = icmp6_hdr->icmp6_identifier;
+                                       icmp_hdr->un.echo.sequence = icmp6_hdr->icmp6_sequence;
+                                       /* copy rest of ICMP data */
+                                       if (len_delta > 0)
+                                               memcpy(((char *)icmp_hdr) + sizeof(struct icmphdr),
+                                                          ((char *)icmp6_hdr) + sizeof(struct icmp6hdr), len_delta);
+                                       break;
+                               default:
+                                       /* Unknown error messages. Silently drop. */
+                                       PDEBUG("ip6_ip4(): unknown ICMPv6 Type %d, packet dropped.\n", icmp6_hdr->icmp6_type);
+                                       return -1;
+                               }
+
+                               if (icmperr)
+                               {
+                                       /* If ICMP Error message, we translate IP included packet*/
+                                       if (len_delta >= sizeof(struct ipv6hdr))
+                                       {
+                                               if((inc_opts_len = ip6_ip4((char *)icmp6_hdr + sizeof(struct icmp6hdr), len_delta,
+                                                                                          (char *)icmp_hdr + sizeof(struct icmphdr), 1)) == -1) {
+                                                       PDEBUG("ip6_ip4(): incorrect translation of ICMPv6 Error message, packet dropped\n");
+                                                       return -1;
+                                               }
+                                               /* correct IPv4 Total Len that = old Total Len
+                                                  - Options Headers Len in included IP packet
+                                                  - diffirence between IPv6 Header Len and IPv4 Header Len
+                                                  */
+                                               if (ntot_len != 0)
+                                                       ip_hdr->tot_len = htons(ntot_len - inc_opts_len - IP4_IP6_HDR_DIFF);
+                                               real_len = real_len - inc_opts_len - IP4_IP6_HDR_DIFF;
+                                       }
+                                       else if (len_delta > 0)
+                                       {
+                                               /* May be it need set 0x0 to rest area in result IPv4 packet,
+                                                * but we copy rest data unchanged
+                                                */
+                                               memcpy(((char *)icmp_hdr) + sizeof(struct icmphdr),
+                                                          ((char *)icmp6_hdr) + sizeof(struct icmp6hdr), len_delta);
+                                       }
+                               }
+
+                               /* Calculate IPv4 Header checksum */
+                               ip_hdr->check = 0;
+                               ip_hdr->check = ip_fast_csum((unsigned char *)ip_hdr, ip_hdr->ihl);
+
+                               /* Calculate ICMPv4 checksum */
+                               if (ntot_len != 0)
+                               {
+                                       icmp_hdr->checksum = 0;
+                                       icmp_hdr->checksum = ip_compute_csum((unsigned char *)icmp_hdr, ntohs(ip_hdr->tot_len)
+                                                                                            - sizeof(struct iphdr));
+                               }
+                       }
+                       else
+                       {
+                               PDEBUG("ip6_ip4(): error length ICMP packet, packet dropped.\n");
+                               return -1;
+                       }
+
+               }
+               /* PROCESS TCP and UDP (and rest data) */
+
+               else {
+                       real_len += len_delta;
+                       /* we copy rest data to IPv4 packet without changing */
+                       memcpy(dst+sizeof(struct iphdr), src + sizeof(struct ipv6hdr) + opts_len, len_delta);
+               }
+       }
+
+       if (include_flag)           /* if it's included IP packet */
+               return opts_len;        /* return options headers length */
+       else
+               return real_len; /* result packet len */
+}
+
+/*
+ * ip4_fragment(skb, len, hdr_len, dev, eth_h)
+ * to fragment original IPv4 packet if result IPv6 packet will be > 1280
+ */
+
+static int ip4_fragment(struct sk_buff *skb, int len, int hdr_len, struct net_device *dev, struct ethhdr *eth_h)
+{
+       struct sk_buff *skb2 = NULL;       /* pointer to new struct sk_buff for transleded packet */
+       char buff[FRAG_BUFF_SIZE+hdr_len]; /* buffer to form new fragment packet */
+       char *cur_ptr = skb->data+hdr_len; /* pointter to current packet data with len = frag_len */
+       struct iphdr *ih4 = (struct iphdr *) skb->data;
+       struct iphdr *new_ih4 = (struct iphdr *) buff; /* point to new IPv4 hdr */
+       struct ethhdr *new_eth_h;   /* point to ether hdr, need to set hard header data in fragment */
+       int data_len = len - hdr_len; /* origin packet data len */
+       int rest_len = data_len;    /* rest data to fragment */
+       int frag_len = 0;           /* current fragment len */
+       int last_frag = 0;          /* last fragment flag, if = 1, it's last fragment */
+       int flag_last_mf = 0;
+       __u16 new_id = 0;           /* to generate identification field */
+       __u16 frag_offset = 0;      /* fragment offset */
+       unsigned int csum;
+       unsigned short udp_len;
+
+#ifdef SIIT_DEBUG
+       printk("siit: it's DF == 0 and result IPv6 packet will be > 1280\n");
+       siit_print_dump(skb->data, hdr_len, "siit: (orig) ipv4_hdr dump");
+#endif
+
+       if ((ntohs(ih4->frag_off) & IP_MF) == 0 )
+               /* it's a case we'll clear MF flag in our last packet */
+               flag_last_mf = 1;
+
+       if (ih4->protocol == IPPROTO_UDP) {
+               if ( (ntohs(ih4->frag_off) & IP_OFFSET) == 0) {
+                       struct udphdr *udp_hdr = (struct udphdr *)((char *)ih4 + hdr_len);
+                       if (!flag_last_mf) {
+                               if (udp_hdr->check == 0) {
+                                       /* it's a first fragment with ZERO checksum and we drop packet */
+                                       printk("siit: First fragment of UDP with zero checksum - packet droped\n");
+                                       printk("siit: addr: %x src port: %d dst port: %d\n",
+                                                  htonl(ih4->saddr), htons(udp_hdr->source), htons(udp_hdr->dest));
+                                       return -1;
+                               }
+                       }
+                       else if (udp_hdr->check == 0) {
+                               /* Calculate UDP checksum only if it's not fragment */
+                               udp_len = ntohs(udp_hdr->len);
+                               csum = 0;
+                               csum = csum_partial((unsigned char *)udp_hdr, udp_len, csum);
+                               udp_hdr->check = csum_tcpudp_magic(ih4->saddr, ih4->daddr, udp_len, IPPROTO_UDP, csum);
+                       }
+               }
+       }
+
+       frag_offset = ntohs(ih4->frag_off) & IP_OFFSET;
+
+       new_id = ih4->id;
+
+       while(1) {
+               if (rest_len <= FRAG_BUFF_SIZE) {
+                       /* it's last fragmen */
+                       frag_len = rest_len; /* rest data */
+                       last_frag = 1;
+               }
+               else
+                       frag_len = FRAG_BUFF_SIZE;
+
+               /* copy IP header to buffer */
+               memcpy(buff, skb->data, hdr_len);
+               /* copy data to buffer with len = frag_len */
+               memcpy(buff + hdr_len, cur_ptr, frag_len);
+
+               /* set id field in new IPv4 header*/
+               new_ih4->id = new_id;
+
+               /* is it last fragmet */
+               if(last_frag && flag_last_mf)
+                       /* clear MF flag */
+                       new_ih4->frag_off = htons(frag_offset & (~IP_MF));
+               else
+                       /* set MF flag */
+                       new_ih4->frag_off = htons(frag_offset | IP_MF);
+
+               /* change packet total length */
+               new_ih4->tot_len = htons(frag_len+hdr_len);
+
+               /* rebuild the header checksum (IP needs it) */
+               new_ih4->check = 0;
+               new_ih4->check = ip_fast_csum((unsigned char *)new_ih4,new_ih4->ihl);
+
+               /* Allocate new sk_buff to compose translated packet */
+               skb2 = dev_alloc_skb(frag_len+hdr_len+dev->hard_header_len+IP4_IP6_HDR_DIFF+IP6_FRAGMENT_SIZE);
+               if (!skb2) {
+                       printk(KERN_DEBUG "%s: alloc_skb failure - packet dropped.\n", dev->name);
+                       dev_kfree_skb(skb2);
+                       return -1;
+               }
+               /* allocate skb->data portion for IP header len, fragment data len and ether header len
+                * and copy to head ether header from origin skb
+                */
+               memcpy(skb_put(skb2, frag_len+hdr_len+dev->hard_header_len+IP4_IP6_HDR_DIFF+IP6_FRAGMENT_SIZE), (char *) eth_h,
+                          dev->hard_header_len);
+               /* correct ether header data, ether protocol field to ETH_P_IPV6 */
+               new_eth_h = (struct ethhdr *)skb2->data;
+               new_eth_h->h_proto = htons(ETH_P_IPV6);
+
+               /* reset the mac header */
+               skb_reset_mac_header(skb2);
+
+               /* pull ether header from new skb->data */
+               skb_pull(skb2, dev->hard_header_len);
+               /* set skb protocol to IPV6 */
+               skb2->protocol = htons(ETH_P_IPV6);
+
+               /* call translation function */
+               if ( ip4_ip6(buff, frag_len+hdr_len, skb2->data, 0) == -1) {
+                       dev_kfree_skb(skb2);
+                       return -1;
+               }
+
+               /*
+                * Set needed fields in new sk_buff
+                */
+               skb2->dev = dev;
+               skb2->ip_summed = CHECKSUM_UNNECESSARY;
+               skb2->pkt_type = PACKET_HOST;
+
+               /* Add transmit statistic */
+               siit_stats(dev)->tx_packets++;
+               siit_stats(dev)->tx_bytes += skb2->len;
+
+               /* send packet to upper layer */
+               netif_rx(skb2);
+
+               /* exit if it was last fragment */
+               if (last_frag)
+                       break;
+
+               /* correct current data pointer */
+               cur_ptr += frag_len;
+               /* rest data len */
+               rest_len -= frag_len;
+               /* current fragment offset */
+               frag_offset = (frag_offset*8 + frag_len)/8;
+       }
+
+       return 0;
+}
+/*
+ * Transmit a packet (called by the kernel)
+ *
+ * siit_xmit(skb, dev)
+ *
+ * where
+ * skb - pointer to struct sk_buff with incomed packet
+ * dev - pointer to struct device on which packet revieved
+ *
+ * Statistic:
+ * for all incoming packes:
+ *            stats.rx_bytes+=skb->len
+ *            stats.rx_packets++
+ * for packets we can't transle:
+ *            stats.tx_errors++
+ * device busy:
+ *            stats.tx_errors++
+ * for packets we can't allocate sk_buff:
+ *            stats.tx_dropped++
+ * for outgoing packes:
+ *            stats.tx_packets++
+ *            stats.tx_bytes+=skb2->len !!! But we don't set skb2->len !!!
+ */
+
+static int siit_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+       struct sk_buff *skb2 = NULL;/* pointer to new struct sk_buff for transleded packet */
+       struct ethhdr *eth_h;       /* pointer to incoming Ether header */
+       int len;                    /* original packets length */
+       int new_packet_len;
+       int skb_delta = 0;          /* delta size for allocate new skb */
+       char new_packet_buff[2048];
+
+       /* Check pointer to sk_buff and device structs */
+       if (skb == NULL || dev == NULL)
+               return -EINVAL;
+
+       /* Add receive statistic */
+       siit_stats(dev)->rx_bytes += skb->len;
+       siit_stats(dev)->rx_packets++;
+
+       dev->trans_start = jiffies;
+
+       /* Upper layer (IP) protocol forms sk_buff for outgoing packet
+        * and sets IP header + Ether header too. IP layer sets outgoing
+        * device in sk_buff->dev.
+        * In function (from linux/net/core/dev.c) ther is a call to
+        * device transmit function (dev->hard_start_xmit):
+        *
+        *    dev_queue_xmit(struct sk_buff *skb)
+        *    {
+        *    ...
+        *          device *dev = skb->dev;
+        *    ...
+        *          dev->hard_start_xmit(skb, dev);
+        *    ...
+        *    }
+        * We save pointer to ether header in eth_h and skb_pull ether header
+        * from data field of skb_buff
+        */
+
+       eth_h = (struct ethhdr *)skb->data; /* point to incoming packet Ether Header */
+
+#ifdef SIIT_DEBUG
+       siit_print_dump(skb->data, ETH_HLEN, "siit: eth_hdr dump");
+#endif
+
+       /* Remove hardware header from origin sk_buff */
+       skb_pull(skb,dev->hard_header_len);
+
+       /*
+        * Process IPv4 paket
+        */
+       if (ntohs(skb->protocol) == ETH_P_IP) {
+               int hdr_len;            /* IPv4 header length */
+               int data_len;           /* IPv4 data length */
+               struct iphdr *ih4;      /* pointer to IPv4 header */
+               struct icmphdr *icmp_hdr;   /* point to current ICMPv4 header struct */
+
+               ih4 = (struct iphdr *)skb->data; /* point to incoming packet's IPv4 header */
+
+               /* Check IPv4 Total Length */
+               if (skb->len != ntohs(ih4->tot_len)) {
+                       PDEBUG("siit_xmit(): Different skb_len %x and ip4 tot_len %x - packet dropped.\n",
+                                  skb->len, ih4->tot_len);
+                       siit_stats(dev)->tx_errors++;
+                       dev_kfree_skb(skb);
+                       return 0;
+               }
+
+               len = skb->len;     /* packet's total len */
+               hdr_len = (int)(ih4->ihl * 4); /* packet's header len */
+               data_len = len - hdr_len; /* packet's data len */
+
+               /* If DF == 0 */
+               if ( (ntohs(ih4->frag_off) & IP_DF) == 0 ) {
+                       /* If result IPv6 packet will be > 1280
+                          we need to fragment original IPv4 packet
+                       */
+                       if ( data_len > FRAG_BUFF_SIZE ) {
+                               /* call function that fragment packet and translate to IPv6 each fragment
+                                * and send to upper layer
+                                */
+                               if ( ip4_fragment(skb, len, hdr_len, dev, eth_h) == -1) {
+                                       siit_stats(dev)->tx_errors++;
+                               }
+                               /* Free incoming skb */
+                               dev_kfree_skb(skb);
+                               /* Device can accept a new packet */
+
+                               return 0;
+
+                       }
+               }
+               /* If DF == 1 && MF == 0 && Fragment Offset == 0
+                * we don't include fragment header
+                */
+               if ( ntohs(ih4->frag_off) == IP_DF )
+                       skb_delta = IP4_IP6_HDR_DIFF; /* delta is +20 */
+               else
+                       skb_delta = IP4_IP6_HDR_DIFF + IP6_FRAGMENT_SIZE; /* delta is +20 and +8 */
+
+               /* If it's ICMP, check is it included IP packet in it */
+               if ( ih4->protocol == IPPROTO_ICMP) {
+                       icmp_hdr = (struct icmphdr *) (skb->data+hdr_len); /* point to ICMPv4 header */
+                       if ( icmp_hdr->type != ICMP_ECHO && icmp_hdr->type != ICMP_ECHOREPLY) {
+                               /*
+                                * It's ICMP Error that has included IP packet
+                                * we'll add only +20 because we don't include Fragment Header
+                                * into translated included IP packet
+                                */
+                               skb_delta += IP4_IP6_HDR_DIFF;
+                       }
+               }
+
+               /* Allocate new sk_buff to compose translated packet */
+               skb2 = dev_alloc_skb(len+dev->hard_header_len+skb_delta);
+               if (!skb2) {
+                       printk(KERN_DEBUG "%s: alloc_skb failure - packet dropped.\n", dev->name);
+                       dev_kfree_skb(skb);
+                       siit_stats(dev)->rx_dropped++;
+
+                       return 0;
+               }
+               /* allocate skb->data portion = IPv4 packet len + ether header len
+                * + skb_delta (max = two times (diffirence between IPv4 header and
+                * IPv6 header + Frag Header), second for included packet,
+                * and copy to head of skb->data ether header from origin skb
+                */
+               memcpy(skb_put(skb2, len+dev->hard_header_len+skb_delta), (char *)eth_h, dev->hard_header_len);
+               /* correct ether header data, ether protocol field to ETH_P_IPV6 */
+               eth_h = (struct ethhdr *)skb2->data;
+               eth_h->h_proto = htons(ETH_P_IPV6);
+               skb_reset_mac_header(skb2);
+               /* remove ether header from new skb->data,
+                * NOTE! data will rest, pointer to data and data len will change
+                */
+               skb_pull(skb2,dev->hard_header_len);
+               /* set skb protocol to IPV6 */
+               skb2->protocol = htons(ETH_P_IPV6);
+
+               /* call translation function */
+               if (ip4_ip6(skb->data, len, skb2->data, 0) == -1 ) {
+                       dev_kfree_skb(skb);
+                       dev_kfree_skb(skb2);
+                       siit_stats(dev)->rx_errors++;
+
+                       return 0;
+               }
+       }
+       /*
+        * IPv6 paket
+        */
+       else if (ntohs(skb->protocol) == ETH_P_IPV6) {
+
+#ifdef SIIT_DEBUG
+               siit_print_dump(skb->data, sizeof(struct ipv6hdr), "siit: (in) ip6_hdr dump");
+#endif
+               /* packet len = skb->data len*/
+               len = skb->len;
+
+               /* call translation function */
+               if ((new_packet_len = ip6_ip4(skb->data, len, new_packet_buff, 0)) == -1 )
+               {
+                       PDEBUG("siit_xmit(): error translation ipv6->ipv4, packet dropped.\n");
+                       siit_stats(dev)->rx_dropped++;
+                       goto end;
+               }
+
+               /* Allocate new sk_buff to compose translated packet */
+               skb2 = dev_alloc_skb(new_packet_len + dev->hard_header_len);
+               if (!skb2) {
+                       printk(KERN_DEBUG "%s: alloc_skb failure, packet dropped.\n", dev->name);
+                       siit_stats(dev)->rx_dropped++;
+                       goto end;
+               }
+               memcpy(skb_put(skb2, new_packet_len + dev->hard_header_len), (char *)eth_h, dev->hard_header_len);
+               eth_h = (struct ethhdr *)skb2->data;
+               eth_h->h_proto = htons(ETH_P_IP);
+               skb_reset_mac_header(skb2);
+               skb_pull(skb2, dev->hard_header_len);
+               memcpy(skb2->data, new_packet_buff, new_packet_len);
+               skb2->protocol = htons(ETH_P_IP);
+       }
+       else {
+               PDEBUG("siit_xmit(): unsupported protocol family %x, packet dropped.\n", skb->protocol);
+               goto end;
+       }
+
+       /*
+        * Set needed fields in new sk_buff
+        */
+       skb2->pkt_type = PACKET_HOST;
+       skb2->dev = dev;
+       skb2->ip_summed = CHECKSUM_UNNECESSARY;
+
+       /* Add transmit statistic */
+       siit_stats(dev)->tx_packets++;
+       siit_stats(dev)->tx_bytes += skb2->len;
+
+       /* Send packet to upper layer protocol */
+       netif_rx(skb2);
+
+end:
+       dev_kfree_skb(skb);
+
+       return 0;
+}
+
+static bool header_ops_init = false;
+static struct header_ops siit_header_ops ____cacheline_aligned;
+
+static const struct net_device_ops siit_netdev_ops = {
+       .ndo_open               = siit_open,
+       .ndo_stop               = siit_release,
+       .ndo_start_xmit         = siit_xmit,
+};
+
+/*
+ * The init function initialize of the SIIT device..
+ * It is invoked by register_netdev()
+ */
+
+static void
+siit_init(struct net_device *dev)
+{
+       ether_setup(dev);    /* assign some of the fields */
+       random_ether_addr(dev->dev_addr);
+
+       /*
+        * Assign device function.
+        */
+       dev->netdev_ops = &siit_netdev_ops;
+       dev->flags           |= IFF_NOARP;     /* ARP not used */
+       dev->tx_queue_len = 10;
+
+       if (!header_ops_init) {
+               memcpy(&siit_header_ops, dev->header_ops, sizeof(struct header_ops));
+               siit_header_ops.cache = NULL;
+       }
+       dev->header_ops = &siit_header_ops;
+}
+
+/*
+ * Finally, the module stuff
+ */
+static struct net_device *siit_dev = NULL;
+
+int init_module(void)
+{
+       int res = -ENOMEM;
+       int priv_size;
+
+       priv_size = sizeof(struct header_ops);
+       siit_dev = alloc_netdev(priv_size, "siit%d", siit_init);
+       if (!siit_dev)
+               goto err_alloc;
+
+       res = register_netdev(siit_dev);
+       if (res)
+               goto err_register;
+
+       return 0;
+
+err_register:
+       free_netdev(siit_dev);
+err_alloc:
+       printk(KERN_ERR "Error creating siit device: %d\n", res);
+       return res;
+}
+
+void cleanup_module(void)
+{
+       unregister_netdev(siit_dev);
+       free_netdev(siit_dev);
+}
+
+MODULE_LICENSE("GPL");
diff --git a/net/siit/src/siit.h b/net/siit/src/siit.h
new file mode 100644 (file)
index 0000000..47cf776
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * siit.h -- definitions for the SIIT module
+ *
+ *
+ */
+
+/*
+ * Constants
+ */
+
+/* SIIT_ETH control the name of SIIT interface:
+ * 0 - interface name is siit0,
+ * 1 - interface name is ethX.
+ */
+#define SIIT_ETH 0
+
+#define BUFF_SIZE 4096
+#define FRAG_BUFF_SIZE 1232     /* IPv6 max fragment size without IPv6 header 
+                                 * to fragmanet IPv4 if result IPv6 packet will be > 1280
+                                 */
+
+#define TRANSLATED_PREFIX 0x0000ffff /* third byte in IPv4-translated addr prefix */
+#define MAPPED_PREFIX 0x0000ffff     /* third byte in IPv4-mapped addr prefix */
+
+#define IP4_IP6_HDR_DIFF 20     /* diffirence between IPv4 and IPv6 headers */
+#define IP6_FRAGMENT_SIZE 8     /* size of Fragment Header */
+
+/* IPv6 header fields masks */
+#define IP6F_OFF_MASK       0xfff8  /* mask out offset from frag_off */
+#define IP6F_RESERVED_MASK  0x0006  /* reserved bits in frag_off */
+#define IP6F_MORE_FRAG      0x0001  /* more-fragments flag */
+
+
+
+/*
+ * Macros to help debugging
+ */
+
+#undef PDEBUG             /* undef it, just in case */
+#ifdef SIIT_DEBUG
+#  ifdef __KERNEL__
+     /* This one if debugging is on, and kernel space */
+#    define PDEBUG(fmt, args...) printk(KERN_DEBUG "siit: " fmt, ## args)
+#  else
+     /* This one for user space */
+#    define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
+#  endif
+#else
+#  define PDEBUG(fmt, args...) /* not debugging: nothing */
+#endif
+
+#undef PDEBUGG
+#define PDEBUGG(fmt, args...)
+
+
+
+
+
+
+
+
diff --git a/net/slurm/Makefile b/net/slurm/Makefile
new file mode 100644 (file)
index 0000000..821808d
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2006 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:=slurm
+PKG_VERSION:=0.3.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.wormulon.net/slurm/
+PKG_MD5SUM:=e68d09202b835c644f7f6b7f070f29a2
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/slurm
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=A realtime network interface monitor
+  URL:=http://www.wormulon.net/slurm/
+endef
+
+define Package/slurm/description
+       A realtime network interface monitor with the following features:
+       - realtime traffic statistics divided into incoming and outgoing ;
+       - optional combined view ;
+       - can monitor any kind of network interface ;
+       - shows detailed statistics about the interface ;
+       - it's themeable.
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               aclocal.m4 \
+               Makefile.in \
+               config.h.in \
+               configure \
+       );
+       $(call Build/Configure/Default, \
+               , \
+               LIBS="-lncurses" \
+               ac_cv_lib_ncurses_use_default_colors=yes \
+       )
+endef
+
+define Package/slurm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/slurm $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,slurm))
diff --git a/net/slurm/patches/001-no_host_curses.patch b/net/slurm/patches/001-no_host_curses.patch
new file mode 100644 (file)
index 0000000..ce97478
--- /dev/null
@@ -0,0 +1,67 @@
+diff -ruN slurm-0.3.3-old/configure slurm-0.3.3-new/configure
+--- slurm-0.3.3-old/configure  2004-09-28 16:34:56.000000000 +0200
++++ slurm-0.3.3-new/configure  2005-11-06 22:08:53.000000000 +0100
+@@ -4762,35 +4762,35 @@
+ _ACEOF
+-for cursespath in /usr/include/ncurses.h /usr/local/include/ncurses.h /usr/local/include/ncurses/ncurses.h /opt/include/ncurses.h /opt/include/curses.h /usr/include/curses.h /usr/local/include/curses.h /dev/null
+-do
+-  test -f "${cursespath}" && break
+-done
+-case ${cursespath} in
+-  /usr/include/*)
+-      CFLAGS="$CFLAGS -I/usr/include"
+-      LDFLAGS=""
+-      ;;
+-  /usr/local/include/ncurses/*)
+-        CFLAGS="${CFLAGS} -I/usr/local/include/ncurses"
+-        LDFLAGS="-L/usr/local/lib"
+-        SOLLDFLAGS="-R/usr/local/lib"
+-        ;;
+-  /usr/local/include/*)
+-      CFLAGS="${CFLAGS} -I/usr/local/include"
+-      LDFLAGS="-L/usr/local/lib"
+-      SOLLDFLAGS="-R/usr/local/lib"
+-      ;;
+-  /opt/include/*)
+-      CFLAGS="${CFLAGS} -I/opt/include"
+-      LDFLAGS="-L/opt/lib"
+-      SOLLDFLAGS="-R/opt/lib"
+-      ;;
+-esac
++#for cursespath in /usr/include/ncurses.h /usr/local/include/ncurses.h /usr/local/include/ncurses/ncurses.h /opt/include/ncurses.h /opt/include/curses.h /usr/include/curses.h /usr/local/include/curses.h /dev/null
++#do
++#  test -f "${cursespath}" && break
++#done
++#case ${cursespath} in
++#  /usr/include/*)
++#     CFLAGS="$CFLAGS -I/usr/include"
++#     LDFLAGS=""
++#     ;;
++#  /usr/local/include/ncurses/*)
++#        CFLAGS="${CFLAGS} -I/usr/local/include/ncurses"
++#        LDFLAGS="-L/usr/local/lib"
++#        SOLLDFLAGS="-R/usr/local/lib"
++#        ;;
++#  /usr/local/include/*)
++#     CFLAGS="${CFLAGS} -I/usr/local/include"
++#     LDFLAGS="-L/usr/local/lib"
++#     SOLLDFLAGS="-R/usr/local/lib"
++#     ;;
++#  /opt/include/*)
++#     CFLAGS="${CFLAGS} -I/opt/include"
++#     LDFLAGS="-L/opt/lib"
++#     SOLLDFLAGS="-R/opt/lib"
++#     ;;
++#esac
+ # add Slowlaris -R and libraries to LDFLAGS
+-if test ${OSTYPE} = "solaris" ; then
+-      LDFLAGS="${LDFLAGS} ${SOLLDFLAGS} -lnsl -lsocket -lkstat"
+-fi
++#if test ${OSTYPE} = "solaris" ; then
++#     LDFLAGS="${LDFLAGS} ${SOLLDFLAGS} -lnsl -lsocket -lkstat"
++#fi
+ echo "$as_me:$LINENO: checking for vanilla_coke in -lfridge" >&5
+ echo $ECHO_N "checking for vanilla_coke in -lfridge... $ECHO_C" >&6
diff --git a/net/smcroute/Makefile b/net/smcroute/Makefile
new file mode 100644 (file)
index 0000000..8626b66
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2010 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:=smcroute
+PKG_VERSION:=0.92
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.cschill.de/smcroute
+PKG_MD5SUM:=2b50e7166606ec90e09682399e69c4a6
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/smcroute
+       SECTION:=net
+       CATEGORY:=Network
+       SUBMENU:=Routing and Redirection
+       TITLE:=Static multicast routing daemon
+       URL:=http://www.cschill.de/smcroute/
+endef
+
+define Package/smcroute/description
+ SMCRoute is a command line tool to manipulate the multicast routes of the Linux kernel.
+endef
+
+
+ifeq ($(HOST_OS),FreeBSD)
+  TARGET_CFLAGS += -fno-builtin-log
+  TARGET_LDFLAGS += -fno-builtin-log
+endif
+
+define Build/Compile
+        $(MAKE) CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)" -C $(PKG_BUILD_DIR)/src all
+endef
+
+define Package/smcroute/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smcroute $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mcsender $(1)/usr/bin/
+       $(INSTALL_BIN) ./files/smcroute.init $(1)/etc/init.d/smcroute
+endef
+
+$(eval $(call BuildPackage,smcroute))
diff --git a/net/smcroute/files/smcroute.init b/net/smcroute/files/smcroute.init
new file mode 100644 (file)
index 0000000..3e36272
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2010 OpenWrt.org
+START=50
+
+start() {
+       smcroute -d
+}
+
+stop() {
+       smcroute -k
+}
diff --git a/net/smcroute/patches/001-socket_path.patch b/net/smcroute/patches/001-socket_path.patch
new file mode 100644 (file)
index 0000000..4b6eda0
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/ipc.c        2002-07-07 19:38:49.000000000 +0200
++++ b/src/ipc.c        2010-10-01 21:44:26.000000000 +0200
+@@ -24,7 +24,7 @@
+ #include "mclab.h"
+-#define SOCKET_PATH "/var/lib/smcroute"
++#define SOCKET_PATH "/tmp/smcroute"
+ // server's listen socket
+ static int ListenSock; 
diff --git a/net/smcroute/patches/002-optimize_size.patch b/net/smcroute/patches/002-optimize_size.patch
new file mode 100644 (file)
index 0000000..23059fa
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -1,9 +1,6 @@
+ BINDIR=../bin
+-# CFLAGS=-g
+-CFLAGS=-O
+-
+ default : build.h smcroute
+ all   : smcroute mcsender
diff --git a/net/smtptrapd/Makefile b/net/smtptrapd/Makefile
new file mode 100644 (file)
index 0000000..c2182ac
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2008-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:=smtptrapd
+PKG_VERSION:=1.5
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=edc5f2f3ea9f9bdd9e0f479a58903bf1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/smtptrapd
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread
+  TITLE:=SMTP Trap Daemon
+  URL:=http://smtptrapd.sourceforge.net/
+endef
+
+define Package/smtptrapd/description
+       The smtptrapd program is a multi-threaded daemon that provides
+       a RFC 2821 compliant SMTP service that always returns a 4xx soft
+       error to the RCPT TO verb.
+endef
+
+define Build/Compile
+       $(TARGET_CC) \
+               $(TARGET_CFLAGS) \
+               $(TARGET_CPPFLAGS) \
+               -D_REENTRANT \
+               $(PKG_BUILD_DIR)/smtptrapd.c \
+               -o $(PKG_BUILD_DIR)/smtptrapd \
+               $(TARGET_LDFLAGS) \
+               -lpthread
+endef
+
+define Package/smtptrapd/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/smtptrapd.init $(1)/etc/init.d/smtptrapd
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/smtptrapd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,smtptrapd))
diff --git a/net/smtptrapd/files/smtptrapd.init b/net/smtptrapd/files/smtptrapd.init
new file mode 100644 (file)
index 0000000..53aba97
--- /dev/null
@@ -0,0 +1,125 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+SERVICE_USE_PID=1
+
+START=90
+STOP=10
+
+EXTRA_COMMANDS="list status exconf"
+EXTRA_HELP="   list    Lists available configurations
+       status  Prints status of the service
+       exconf  Shows an example config file
+
+The actions start, stop, restart, reload, status operate
+globally on all configurations unless the particular
+configuration has been provided as the next parameter.
+"
+
+check_section() {
+       echo "$1" | grep -vq '^cfg[[:xdigit:]]\{6\}$'
+}
+
+start_instance() {
+       local section="$1"
+       local instance="$2"
+
+       check_section "$section" || return 1
+       [ -n "$instance" -a "$section" != "$instance" ] && return 0
+
+       local args listen_ip banner_host username num_threads listen_port accept_queue_len
+
+       config_get listen_ip "$section" 'listen_ip'
+       [ -n "$listen_ip" ] && append args "-l $listen_ip"
+
+       config_get listen_port "$section" 'listen_port'
+       [ -n "$listen_port" ] && append args "-p $listen_port"
+
+       config_get username "$section" 'username'
+       [ -n "$username" ] && append args "-u $username"
+
+       config_get banner_host "$section" 'banner_host'
+       [ -n "$banner_host" ] && append args "-b '$banner_host'"
+
+       config_get num_threads "$section" 'num_threads'
+       [ -n "$num_threads" ] && append args "-t $num_threads"
+
+       config_get accept_queue_len "$section" 'accept_queue_len'
+       [ -n "$accept_queue_len" ] && append args "-m $accept_queue_len"
+
+       SERVICE_PID_FILE="/var/run/smtptrapd-${section}.pid
+       service_start /usr/sbin/smtptrapd -f $SERVICE_PID_FILE $args
+}
+
+stop_instance() {
+       local section="$1"
+       local instance="$2"
+
+       check_section "$section" || return 1
+       [ -n "$instance" -a "$section" != "$instance" ] && return 0
+
+       SERVICE_PID_FILE="/var/run/smtptrapd-${section}.pid"
+       service_stop /usr/sbin/smtptrapd
+}
+
+check_instance() {
+       local section="$1"
+       local instance="$2"
+
+       check_section "$section" || return 1
+       [ -n "$instance" -a "$section" != "$instance" ] && return 0
+
+       SERVICE_PID_FILE="/var/run/smtptrapd-${section}.pid"
+       service_check /usr/sbin/smtptrapd && {
+               echo "${initscript}: configuration instance '$section' is running"
+       } || {
+               echo "${initscript}: configuration instance '$section' is not running"
+       }
+}
+
+list_instance() {
+       local section="$1"
+       check_section "$section" || return 1
+       echo "  $section"
+}
+
+start() {
+       config_load 'smtptrapd'
+       config_foreach start_instance 'smtptrapd' "$@"
+}
+
+stop() {
+       config_load 'smtptrapd'
+       config_foreach stop_instance 'smtptrapd' "$@"
+}
+
+status() {
+       config_load 'smtptrapd'
+       config_foreach check_instance 'smtptrapd' "$@"
+}
+
+list() {
+       config_load 'smtptrapd'
+       echo "${initscript}: available configuration instances:"
+       config_foreach list_instance 'smtptrapd'
+}
+
+exconf() {
+       cat <<EOF
+# /etc/config/smtptrapd - example configuration
+
+package 'smtptrapd'
+
+config 'smtptrapd' 'myfailhost'
+       option 'num_threads' '1'
+
+# The init script operates only with named sections
+# All options (default values)
+#      option 'banner_host' '<hostname>'
+#      option 'username' 'nobody'
+#      option 'listen_ip' '<all addresses>'
+#      option 'listen_port' '25'
+#      option 'num_threads' '10'
+#      option 'accept_queue_len' '100'
+EOF
+}
diff --git a/net/smtptrapd/patches/200-missing_opt.patch b/net/smtptrapd/patches/200-missing_opt.patch
new file mode 100644 (file)
index 0000000..c989b01
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN smtptrapd-1.5.orig/smtptrapd.c smtptrapd-1.5.dev/smtptrapd.c
+--- smtptrapd-1.5.orig/smtptrapd.c     2008-04-15 12:56:20.000000000 +0200
++++ smtptrapd-1.5.dev/smtptrapd.c      2008-04-16 18:23:03.000000000 +0200
+@@ -545,7 +545,7 @@
+       config.threads = NUM_CONSUMER;
+       config.max_queue_len = MAX_QUEUE_LEN;
+-      while ((c = getopt(argc, argv, "hc:l:p:b:u:m:t:")) != -1) {
++      while ((c = getopt(argc, argv, "hc:l:p:b:u:m:t:f:")) != -1) {
+               switch (c) {
+                       case 'h':
diff --git a/net/snort-wireless/Makefile b/net/snort-wireless/Makefile
new file mode 100644 (file)
index 0000000..fd3847f
--- /dev/null
@@ -0,0 +1,147 @@
+#
+# Copyright (C) 2006 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:=snort-wireless
+PKG_VERSION:=2.4.3-alpha04
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.snort-wireless.org/files/
+PKG_MD5SUM:=1aa699ae279bf7a1140cf6cca02f9999
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/snort-wireless/Default
+  SUBMENU:=wireless
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libnet0 +libpcap +libpcre
+  TITLE:=Lightweight Network Intrusion Detection System
+  URL:=http://www.snort-wireless.org/
+endef
+
+define Package/snort-wireless
+  $(call Package/snort-wireless/Default)
+endef
+
+define Package/snort-wireless-mysql
+  $(call Package/snort-wireless/Default)
+  DEPENDS+= +libmysqlclient
+  TITLE+= (MySQL)
+endef
+
+define Package/snort-wireless-pgsql
+  $(call Package/snort-wireless/Default)
+  DEPENDS+= +libpq
+  TITLE+= (PostgreSQL)
+endef
+
+
+define Compile/Template
+
+$(PKG_BUILD_DIR)/snort$(1): $(STAMP_CONFIGURED)
+       touch -r $(PKG_BUILD_DIR)/Makefile.am $(PKG_BUILD_DIR)/configure.in
+       touch -r $(PKG_BUILD_DIR)/Makefile.in $(PKG_BUILD_DIR)/configure
+       -$(MAKE) -C $(PKG_BUILD_DIR) distclean
+       $(call Build/Configure/Default, \
+               --enable-flexresp \
+               --with-libnet-includes="$(STAGING_DIR)/usr/lib/libnet-1.0.x/include" \
+               --with-libnet-libraries="$(STAGING_DIR)/usr/lib/libnet-1.0.x/lib" \
+               --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
+               --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
+               --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
+               --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
+               $(2) \
+               , \
+               CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
+               LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
+               PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
+               $(3) \
+       );
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               extra_incl="" \
+               all
+       mv $(PKG_BUILD_DIR)/src/snort $(PKG_BUILD_DIR)/snort$(1)
+
+$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/snort$(1)
+
+endef
+
+
+define Install/Template
+
+define Package/snort-wireless$(1)/conffiles
+/etc/default/snort
+/etc/snort/snort.conf
+/etc/snort/threshold.conf
+endef
+
+define Package/snort-wireless$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/snort$(1) $$(1)/usr/sbin/snort
+       $(INSTALL_DIR) $$(1)/etc/snort
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $$(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $$(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $$(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $$(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/sid-msg.map $$(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $$(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $$(1)/etc/snort/
+       $(INSTALL_DIR) $$(1)/etc/default
+       $(INSTALL_DATA) ./files/snort-wireless.default $$(1)/etc/default/snort
+       $(INSTALL_DIR) $$(1)/etc/init.d
+       $(INSTALL_BIN) ./files/snort-wireless.init $$(1)/etc/init.d/snort
+endef
+
+endef
+
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_snort-wireless),)
+  define Compile/snort-wireless
+    $(call Compile/Template,, \
+               --without-mysql \
+               --without-postgresql \
+    )
+    $(call Install/Template,)
+  endef
+endif
+$(eval $(Compile/snort-wireless))
+
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_snort-wireless-mysql),)
+  define Compile/snort-wireless-mysql
+    $(call Compile/Template,-mysql, \
+               --with-mysql="$(STAGING_DIR)/usr" \
+               --without-postgresql \
+    )
+    $(call Install/Template,-mysql)
+  endef
+endif
+$(eval $(Compile/snort-wireless-mysql))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_snort-wireless-pgsql),)
+  define Compile/snort-wireless-pgsql
+    $(call Compile/Template,-pgsql, \
+               --without-mysql \
+               --with-postgresql="$(STAGING_DIR)/usr" \
+    )
+    $(call Install/Template,-pgsql)
+  endef
+endif
+$(eval $(Compile/snort-wireless-pgsql))
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+$(eval $(call BuildPackage,snort-wireless))
+$(eval $(call BuildPackage,snort-wireless-mysql))
+$(eval $(call BuildPackage,snort-wireless-pgsql))
diff --git a/net/snort-wireless/files/snort-wireless.default b/net/snort-wireless/files/snort-wireless.default
new file mode 100644 (file)
index 0000000..796a893
--- /dev/null
@@ -0,0 +1,2 @@
+INTERFACE="vlan1" # WAN
+OPTIONS="-i $INTERFACE -c /etc/snort/snort.conf -D -N -q -s"
diff --git a/net/snort-wireless/files/snort-wireless.init b/net/snort-wireless/files/snort-wireless.init
new file mode 100644 (file)
index 0000000..8c019c4
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+DEFAULT=/etc/default/snort
+LOG_D=/var/log/snort
+RUN_D=/var/run
+[ -f $DEFAULT ] && . $DEFAULT
+PID_F=$RUN_D/snort_$INTERFACE.pid
+
+case $1 in
+ start)
+  [ -d $LOG_D ] || mkdir -p $LOG_D
+  [ -d $RUN_D ] || mkdir -p $RUN_D
+  snort $OPTIONS
+  ;;
+ stop)
+  [ -f $PID_F ] && kill $(cat $PID_F)
+  ;;
+ *)
+  echo "usage: $0 (start|stop)"
+  exit 1
+esac
+
+exit $?
diff --git a/net/snort-wireless/patches/500-no-config-search.patch b/net/snort-wireless/patches/500-no-config-search.patch
new file mode 100644 (file)
index 0000000..d674ba6
--- /dev/null
@@ -0,0 +1,35 @@
+--- snort-2.3.2-orig/src/snort.c       2005-01-13 21:36:20.000000000 +0100
++++ snort-2.3.2-1/src/snort.c  2005-04-04 20:03:34.000000000 +0200
+@@ -1949,7 +1949,7 @@
+ {
+     struct stat st;
+     int i;
+-    char *conf_files[]={"/etc/snort.conf", "./snort.conf", NULL};
++    char *conf_files[]={"/etc/snort/snort.conf", NULL};
+     char *fname = NULL;
+     char *home_dir = NULL;
+     char *rval = NULL;
+@@ -1970,23 +1970,6 @@
+         i++;
+     }
+-    /* search for .snortrc in the HOMEDIR */
+-    if(!rval)
+-    {
+-        if((home_dir = getenv("HOME")))
+-        {
+-            /* create the full path */
+-            fname = (char *)malloc(strlen(home_dir) + strlen("/.snortrc") + 1);
+-            if(!fname)
+-                FatalError("Out of memory searching for config file\n");
+-
+-            if(stat(fname, &st) != -1)
+-                rval = fname;
+-            else
+-                free(fname);
+-        }
+-    }
+-
+     return rval;
+ }
diff --git a/net/snort-wireless/patches/750-lightweight-config.patch b/net/snort-wireless/patches/750-lightweight-config.patch
new file mode 100644 (file)
index 0000000..daea3be
--- /dev/null
@@ -0,0 +1,178 @@
+--- snort-wireless-2.4.3-alpha04/etc/snort.conf        2005-10-21 09:41:01.000000000 +0200
++++ /Users/florian/telechargements/snort.conf  2005-10-30 13:20:17.000000000 +0100
+@@ -6,6 +6,7 @@
+ #
+ ###################################################
+ # This file contains a sample snort configuration. 
++# Most preprocessors and rules were disabled to save memory.
+ # You can take the following steps to create your own custom configuration:
+ #
+ #  1) Set the variables for your network
+@@ -42,10 +43,10 @@
+ # or you can specify the variable to be any IP address
+ # like this:
+-var HOME_NET any
++var HOME_NET 192.168.1.0/24
+ # Set up the external network addresses as well.  A good start may be "any"
+-var EXTERNAL_NET any
++var EXTERNAL_NET !$HOME_NET
+ # Configure your wireless AP lists.  This allows snort to look for attacks
+ # against your wireless network, such as rogue access points or adhoc wireless
+@@ -137,7 +138,7 @@
+ # Path to your rules files (this can be a relative path)
+ # Note for Windows users:  You are advised to make this an absolute path,
+ # such as:  c:\snort\rules
+-var RULE_PATH ../rules
++var RULE_PATH /etc/snort/rules
+ # Configure the snort decoder
+ # ============================
+@@ -413,11 +414,11 @@
+ # lots of options available here. See doc/README.http_inspect.
+ # unicode.map should be wherever your snort.conf lives, or given
+ # a full path to where snort can find it.
+-preprocessor http_inspect: global \
+-    iis_unicode_map unicode.map 1252 
++#preprocessor http_inspect: global \
++#    iis_unicode_map unicode.map 1252 
+-preprocessor http_inspect_server: server default \
+-    profile all ports { 80 8080 8180 } oversize_dir_length 500
++#preprocessor http_inspect_server: server default \
++#    profile all ports { 80 8080 8180 } oversize_dir_length 500
+ #
+ #  Example unique server configuration
+@@ -451,7 +452,7 @@
+ # no_alert_incomplete - don't alert when a single segment
+ #                       exceeds the current packet size
+-preprocessor rpc_decode: 111 32771
++#preprocessor rpc_decode: 111 32771
+ # bo: Back Orifice detector
+ # -------------------------
+@@ -474,7 +475,7 @@
+ #   3       Back Orifice Server Traffic Detected
+ #   4       Back Orifice Snort Buffer Attack
+-preprocessor bo
++#preprocessor bo
+ # telnet_decode: Telnet negotiation string normalizer
+ # ---------------------------------------------------
+@@ -486,7 +487,7 @@
+ # This preprocessor requires no arguments.
+ # Portscan uses Generator ID 109 and does not generate any SID currently.
+-preprocessor telnet_decode
++#preprocessor telnet_decode
+ # sfPortscan
+ # ----------
+@@ -537,9 +538,9 @@
+ #       are still watched as scanner hosts.  The 'ignore_scanned' option is
+ #       used to tune alerts from very active hosts such as syslog servers, etc.
+ #
+-preprocessor sfportscan: proto  { all } \
+-                         memcap { 10000000 } \
+-                         sense_level { low }
++#preprocessor sfportscan: proto  { all } \
++#                         memcap { 10000000 } \
++#                         sense_level { low }
+ # arpspoof
+ #----------------------------------------
+@@ -814,41 +815,41 @@
+ include $RULE_PATH/bad-traffic.rules
+ include $RULE_PATH/exploit.rules
+ include $RULE_PATH/scan.rules
+-include $RULE_PATH/finger.rules
+-include $RULE_PATH/ftp.rules
+-include $RULE_PATH/telnet.rules
+-include $RULE_PATH/rpc.rules
+-include $RULE_PATH/rservices.rules
+-include $RULE_PATH/dos.rules
+-include $RULE_PATH/ddos.rules
+-include $RULE_PATH/dns.rules
+-include $RULE_PATH/tftp.rules
+-
+-include $RULE_PATH/web-cgi.rules
+-include $RULE_PATH/web-coldfusion.rules
+-include $RULE_PATH/web-iis.rules
+-include $RULE_PATH/web-frontpage.rules
+-include $RULE_PATH/web-misc.rules
+-include $RULE_PATH/web-client.rules
+-include $RULE_PATH/web-php.rules
+-
+-include $RULE_PATH/sql.rules
+-include $RULE_PATH/x11.rules
+-include $RULE_PATH/icmp.rules
+-include $RULE_PATH/netbios.rules
+-include $RULE_PATH/misc.rules
+-include $RULE_PATH/attack-responses.rules
+-include $RULE_PATH/oracle.rules
+-include $RULE_PATH/mysql.rules
+-include $RULE_PATH/snmp.rules
+-
+-include $RULE_PATH/smtp.rules
+-include $RULE_PATH/imap.rules
+-include $RULE_PATH/pop2.rules
+-include $RULE_PATH/pop3.rules
++#include $RULE_PATH/finger.rules
++#include $RULE_PATH/ftp.rules
++#include $RULE_PATH/telnet.rules
++#include $RULE_PATH/rpc.rules
++#include $RULE_PATH/rservices.rules
++#include $RULE_PATH/dos.rules
++#include $RULE_PATH/ddos.rules
++#include $RULE_PATH/dns.rules
++#include $RULE_PATH/tftp.rules
++
++#include $RULE_PATH/web-cgi.rules
++#include $RULE_PATH/web-coldfusion.rules
++#include $RULE_PATH/web-iis.rules
++#include $RULE_PATH/web-frontpage.rules
++#include $RULE_PATH/web-misc.rules
++#include $RULE_PATH/web-client.rules
++#include $RULE_PATH/web-php.rules
++
++#include $RULE_PATH/sql.rules
++#include $RULE_PATH/x11.rules
++#include $RULE_PATH/icmp.rules
++#include $RULE_PATH/netbios.rules
++#include $RULE_PATH/misc.rules
++#include $RULE_PATH/attack-responses.rules
++#include $RULE_PATH/oracle.rules
++#include $RULE_PATH/mysql.rules
++#include $RULE_PATH/snmp.rules
++
++#include $RULE_PATH/smtp.rules
++#include $RULE_PATH/imap.rules
++#include $RULE_PATH/pop2.rules
++#include $RULE_PATH/pop3.rules
+-include $RULE_PATH/nntp.rules
+-include $RULE_PATH/other-ids.rules
++#include $RULE_PATH/nntp.rules
++#include $RULE_PATH/other-ids.rules
+ # include $RULE_PATH/web-attacks.rules
+ # include $RULE_PATH/backdoor.rules
+ # include $RULE_PATH/shellcode.rules
+@@ -856,11 +857,11 @@
+ # include $RULE_PATH/porn.rules
+ # include $RULE_PATH/info.rules
+ # include $RULE_PATH/icmp-info.rules
+- include $RULE_PATH/virus.rules
++# include $RULE_PATH/virus.rules
+ # include $RULE_PATH/chat.rules
+ # include $RULE_PATH/multimedia.rules
+ # include $RULE_PATH/p2p.rules
+-include $RULE_PATH/experimental.rules
++#include $RULE_PATH/experimental.rules
+ #include $RULE_PATH/wifi.rules
+ # Include any thresholding or suppression commands. See threshold.conf in the
diff --git a/net/snort/Makefile b/net/snort/Makefile
new file mode 100644 (file)
index 0000000..703c3b3
--- /dev/null
@@ -0,0 +1,181 @@
+
+# Copyright (C) 2006-2012 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:=snort
+PKG_VERSION:=2.9.2.2
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://snort.org/dl/snort-current/
+PKG_MD5SUM:=4254389550e3be31afebc70e64e6002f
+
+PKG_BUILD_DEPENDS:=librpc
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/snort/Default
+  SUBMENU:=Firewall
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libpcre +libdnet +libdaq +libpthread +libuuid +zlib
+  TITLE:=Lightweight Network Intrusion Detection System
+  URL:=http://www.snort.org/
+endef
+
+define Package/snort/Default/description
+  Snort is an open source network intrusion detection and prevention system.
+  It is capable of performing real-time traffic analysis, alerting, blocking
+  and packet logging on IP networks.  It utilizes a combination of protocol
+  analysis and pattern matching in order to detect anomalies, misuse and
+  attacks.
+endef
+
+define Package/snort
+  $(call Package/snort/Default)
+  VARIANT:=basic
+endef
+
+define Package/snort/description
+  $(call Package/snort/Default/description)
+endef
+
+define Package/snort-mysql
+  $(call Package/snort/Default)
+  DEPENDS+= +libmysqlclient
+  TITLE+= (MySQL)
+  VARIANT:=mysql
+endef
+
+define Package/snort-mysql/description
+  $(call Package/snort/Default/description)
+  This package contains snort with support for logging to a MySQL database.
+endef
+
+define Package/snort-pgsql
+  $(call Package/snort/Default)
+  DEPENDS+= +libpq +libuuid
+  TITLE+= (PostgreSQL)
+  VARIANT:=pgsql
+endef
+
+define Package/snort-pgsql/description
+  $(call Package/snort/Default/description)
+  This package contains snort with support for logging to a PostgreSQL database.
+endef
+
+
+CONFIGURE_ARGS += \
+       --prefix="/usr" \
+       --enable-flexresp \
+       --with-dnet-includes="$(STAGING_DIR)/usr/include" \
+       --with-dnet-libraries="$(STAGING_DIR)/usr/lib" \
+       --with-libpcap-includes="$(STAGING_DIR)/usr/include" \
+       --with-libpcap-libraries="$(STAGING_DIR)/usr/lib" \
+       --with-libpcre-includes="$(STAGING_DIR)/usr/include" \
+       --with-libpcre-libraries="$(STAGING_DIR)/usr/lib" \
+       --with-daq-includes="$(STAGING_DIR)/usr/include" \
+       --with-daq-libraries="$(STAGING_DIR)/usr/lib" \
+       --disable-static-daq
+
+CONFIGURE_VARS += \
+       CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/mysql" \
+       LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/mysql" \
+       PATH="$(STAGING_DIR)/usr/lib/libnet-1.0.x/bin:$$$$PATH" \
+
+MAKE_FLAGS += \
+       extra_incl="" \
+
+ifeq ($(BUILD_VARIANT),basic)
+
+  CONFIGURE_ARGS += \
+       --without-mysql \
+       --without-postgresql \
+
+endif
+ifeq ($(BUILD_VARIANT),mysql)
+  CONFIGURE_VARS += \
+       mysql_has_reconnect=yes
+
+  CONFIGURE_ARGS += \
+       --with-mysql="$(STAGING_DIR)/usr" \
+       --without-postgresql \
+
+endif
+ifeq ($(BUILD_VARIANT),pgsql)
+
+  CONFIGURE_ARGS += \
+       --without-mysql \
+       --with-postgresql="$(STAGING_DIR)/usr" \
+
+endif
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/include/snort/dynamic_preproc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/snort/dynamic_preproc/* \
+               $(STAGING_DIR)/usr/include/snort/dynamic_preproc/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort/dynamic_preproc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/snort/dynamic_preproc/* \
+               $(STAGING_DIR)/usr/lib/snort/dynamic_preproc/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicengine
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/* \
+               $(STAGING_DIR)/usr/lib/snort_dynamicengine/
+       $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/* \
+               $(STAGING_DIR)/usr/lib/snort_dynamicpreprocessor/
+endef
+
+define Package/snort/conffiles
+/etc/default/snort
+/etc/snort/snort.conf
+/etc/snort/threshold.conf
+endef
+
+define Package/snort/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/snort $(1)/usr/bin/snort.bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/u2{boat,spewfoo} $(1)/usr/bin
+       $(INSTALL_BIN) ./files/snort.bin $(1)/usr/bin/snort
+       $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicengine
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicengine/libsf_engine.so* $(1)/usr/lib/snort_dynamicengine/
+       $(INSTALL_DIR) $(1)/usr/lib/snort_dynamicpreprocessor
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/snort_dynamicpreprocessor/libsf*.so* $(1)/usr/lib/snort_dynamicpreprocessor/
+       $(INSTALL_DIR) $(1)/etc/snort
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/snort.conf $(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/attribute_table.dtd $(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/classification.config $(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/gen-msg.map $(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/reference.config $(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/threshold.conf $(1)/etc/snort/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/unicode.map $(1)/etc/snort/
+       $(INSTALL_DIR) $(1)/etc/snort/preproc_rules
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/preproc_rules/*.rules $(1)/etc/snort/preproc_rules/
+       $(INSTALL_DIR) $(1)/etc/snort/rules
+       $(INSTALL_DATA) ./files/snort.local.rules $(1)/etc/snort/rules/local.rules
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_DATA) ./files/snort.default $(1)/etc/default/snort
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/snort.init $(1)/etc/init.d/snort
+endef
+
+Package/snort-mysql/conffiles = $(Package/snort/conffiles)
+Package/snort-mysql/install = $(Package/snort/install)
+
+Package/snort-pgsql/conffiles = $(Package/snort/conffiles)
+Package/snort-pgsql/install = $(Package/snort/install)
+
+$(eval $(call BuildPackage,snort))
+$(eval $(call BuildPackage,snort-mysql))
+$(eval $(call BuildPackage,snort-pgsql))
diff --git a/net/snort/files/snort.bin b/net/snort/files/snort.bin
new file mode 100644 (file)
index 0000000..dd6b222
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec snort.bin --daq-dir /usr/lib/daq/ $*
diff --git a/net/snort/files/snort.default b/net/snort/files/snort.default
new file mode 100644 (file)
index 0000000..dd50613
--- /dev/null
@@ -0,0 +1,2 @@
+INTERFACE="lo"
+OPTIONS="-i $INTERFACE -c /etc/snort/snort.conf -D -N -q -s"
diff --git a/net/snort/files/snort.init b/net/snort/files/snort.init
new file mode 100644 (file)
index 0000000..3dd0eac
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+
+START=99
+APP=snort.bin
+BIN_FILE="/usr/bin/"$APP
+PID_FILE="/var/run/"$APP"_"$INTERFACE".pid"
+OPTIONS="--daq-dir /usr/lib/daq/"
+DEFAULT=/etc/default/snort
+LOG_D=/var/log/snort
+
+start() {
+       [ -d $LOG_D ] || mkdir -p $LOG_D
+       start-stop-daemon -S -x $APP -p $PID_FILE -b -m -- $OPTIONS
+}
+
+stop() {
+       start-stop-daemon -K -x $APP -p $PID_FILE -s TERM
+       rm -rf $PID_FILE
+}
diff --git a/net/snort/files/snort.local.rules b/net/snort/files/snort.local.rules
new file mode 100644 (file)
index 0000000..13e9684
--- /dev/null
@@ -0,0 +1,5 @@
+# ----------------
+# LOCAL RULES
+# ----------------
+# This file intentionally does not come with signatures.  Put your local
+# additions here.
diff --git a/net/snort/patches/001-automake-compat.patch b/net/snort/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..023c510
--- /dev/null
@@ -0,0 +1,4 @@
+--- /dev/null
++++ b/acinclude.m4
+@@ -0,0 +1 @@
++sinclude(m4/libprelude.m4)
diff --git a/net/snort/patches/100-INADDR_NONE.patch b/net/snort/patches/100-INADDR_NONE.patch
new file mode 100644 (file)
index 0000000..cae11fc
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/configure.in
++++ b/configure.in
+@@ -283,21 +283,22 @@ AC_CHECK_TYPES([int8_t,int16_t,int32_t,i
+ AC_CHECK_TYPES([boolean])
+ # In case INADDR_NONE is not defined (like on Solaris)
+-have_inaddr_none="no"
+-AC_MSG_CHECKING([for INADDR_NONE])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <sys/types.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+-]],
+-[[
+-      if (inet_addr("10,5,2") == INADDR_NONE);
+-    return 0;
+-]])],
+-[have_inaddr_none="yes"],
+-[have_inaddr_none="no"])
++have_inaddr_none="yes"
++#AC_MSG_CHECKING([for INADDR_NONE])
++#AC_RUN_IFELSE(
++#[AC_LANG_PROGRAM(
++#[[
++##include <sys/types.h>
++##include <netinet/in.h>
++##include <arpa/inet.h>
++#]],
++#[[
++#     if (inet_addr("10,5,2") == INADDR_NONE);
++#    return 0;
++#]])],
++#[have_inaddr_none="yes"],
++#[have_inaddr_none="yes"])
++
+ AC_MSG_RESULT($have_inaddr_none)
+ if test "x$have_inaddr_none" = "xno"; then
+       AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition])
diff --git a/net/snort/patches/101-PCAP.patch b/net/snort/patches/101-PCAP.patch
new file mode 100644 (file)
index 0000000..5ffc165
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/configure.in
++++ b/configure.in
+@@ -401,16 +401,18 @@ if test "x$LPCAP" = "xno"; then
+ fi
+ AC_MSG_CHECKING([for pcap_lex_destroy])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <pcap.h>
+-]],
+-[[
+-   pcap_lex_destroy();
+-]])],
+-[have_pcap_lex_destroy="yes"],
+-[have_pcap_lex_destroy="no"])
++have_pcap_lex_destroy="yes"
++#AC_RUN_IFELSE(
++#[AC_LANG_PROGRAM(
++#[[
++##include <pcap.h>
++#]],
++#[[
++#   pcap_lex_destroy();
++#]])],
++#[have_pcap_lex_destroy="yes"],
++#[have_pcap_lex_destroy="no"])
++
+ AC_MSG_RESULT($have_pcap_lex_destroy)
+ if test "x$have_pcap_lex_destroy" = "xyes"; then
+     AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stack created by pcap bpf filter])
diff --git a/net/snort/patches/150-config-preprocessors-disable.patch b/net/snort/patches/150-config-preprocessors-disable.patch
new file mode 100644 (file)
index 0000000..c9d71cb
--- /dev/null
@@ -0,0 +1,491 @@
+--- a/etc/snort.conf
++++ b/etc/snort.conf
+@@ -20,6 +20,13 @@
+ #     test mode -T you are required to supply an interface -i <interface>
+ #     or test mode will fail to fully validate the configuration and
+ #     exit with a FATAL error
++#!
++#!  OpenWrt:
++#!    Some options in this config were changed to adapt snort for OpenWrt. Any changes
++#!    made to the original default configuration will start with '#! ' so you can track
++#!    the changes.
++#!
++#!    Most preprocessors and rules were disabled to save memory.
+ #--------------------------------------------------
+ ###################################################
+@@ -42,10 +49,12 @@
+ ###################################################
+ # Setup the network addresses you are protecting
+-ipvar HOME_NET any
++#! ipvar HOME_NET any
++ipvar HOME_NET 192.168.1.0/24
+ # Set up the external network addresses. Leave as "any" in most situations
+-ipvar EXTERNAL_NET any
++#! ipvar EXTERNAL_NET any
++ipvar EXTERNAL_NET !$HOME_NET
+ # List of DNS servers on your network 
+ ipvar DNS_SERVERS $HOME_NET
+@@ -101,17 +110,23 @@ ipvar AIM_SERVERS [64.12.24.0/23,64.12.2
+ # Path to your rules files (this can be a relative path)
+ # Note for Windows users:  You are advised to make this an absolute path,
+ # such as:  c:\snort\rules
+-var RULE_PATH ../rules
+-var SO_RULE_PATH ../so_rules
+-var PREPROC_RULE_PATH ../preproc_rules
++#! Those paths are relative to this snort.conf file.
++#! var RULE_PATH ../rules
++#! var SO_RULE_PATH ../so_rules
++#! var PREPROC_RULE_PATH ../preproc_rules
++var RULE_PATH ./rules
++var SO_RULE_PATH ./so_rules
++var PREPROC_RULE_PATH ./preproc_rules
+ # If you are using reputation preprocessor set these
+ # Currently there is a bug with relative paths, they are relative to where snort is
+ # not relative to snort.conf like the above variables
+ # This is completely inconsistent with how other vars work, BUG 89986
+ # Set the absolute path appropriately
+-var WHITE_LIST_PATH ../rules
+-var BLACK_LIST_PATH ../rules
++#! var WHITE_LIST_PATH ../rules
++#! var BLACK_LIST_PATH ../rules
++var WHITE_LIST_PATH ./rules
++var BLACK_LIST_PATH ./rules
+ ###################################################
+ # Step #2: Configure the decoder.  For more information, see README.decode
+@@ -244,13 +259,16 @@ config paf_max: 16000
+ ###################################################
+ # path to dynamic preprocessor libraries
+-dynamicpreprocessor directory /usr/local/lib/snort_dynamicpreprocessor/
++#! dynamicpreprocessor directory /usr/local/lib/snort_dynamicpreprocessor/
++dynamicpreprocessor directory /usr/lib/snort_dynamicpreprocessor/
+ # path to base preprocessor engine
+-dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so
++#! dynamicengine /usr/local/lib/snort_dynamicengine/libsf_engine.so
++#! dynamicengine /usr/lib/snort_dynamicengine/libsf_engine.so #! disabled for performance reasons
+ # path to dynamic rules libraries
+-dynamicdetection directory /usr/local/lib/snort_dynamicrules
++#! dynamicdetection directory /usr/local/lib/snort_dynamicrules
++#! dynamicdetection directory /usr/lib/snort_dynamicrules #! disabled for performance reasons
+ ###################################################
+ # Step #5: Configure preprocessors
+@@ -294,124 +312,128 @@ preprocessor stream5_udp: timeout 180
+ # preprocessor perfmonitor: time 300 file /var/snort/snort.stats pktcnt 10000
+ # HTTP normalization and anomaly detection.  For more information, see README.http_inspect
+-preprocessor http_inspect: global iis_unicode_map unicode.map 1252 compress_depth 65535 decompress_depth 65535
+-preprocessor http_inspect_server: server default \
+-    http_methods { GET POST PUT SEARCH MKCOL COPY MOVE LOCK UNLOCK NOTIFY POLL BCOPY BDELETE BMOVE LINK UNLINK OPTIONS HEAD DELETE TRACE TRACK CONNECT SOURCE SUBSCRIBE UNSUBSCRIBE PROPFIND PROPPATCH BPROPFIND BPROPPATCH RPC_CONNECT PROXY_SUCCESS BITS_POST CCM_POST SMS_POST RPC_IN_DATA RPC_OUT_DATA RPC_ECHO_DATA } \
+-    chunk_length 500000 \
+-    server_flow_depth 0 \
+-    client_flow_depth 0 \
+-    post_depth 65495 \
+-    oversize_dir_length 500 \
+-    max_header_length 750 \
+-    max_headers 100 \
+-    max_spaces 0 \
+-    small_chunk_length { 10 5 } \
+-    ports { 80 81 311 591 593 901 1220 1414 1830 2301 2381 2809 3128 3702 4343 5250 7001 7145 7510 7777 7779 8000 8008 8014 8028 8080 8088 8118 8123 8180 8181 8243 8280 8800 8888 8899 9080 9090 9091 9443 9999 11371 55555 } \
+-    non_rfc_char { 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 } \
+-    enable_cookie \
+-    extended_response_inspection \
+-    inspect_gzip \
+-    normalize_utf \
+-    unlimited_decompress \
+-    normalize_javascript \
+-    apache_whitespace no \
+-    ascii no \
+-    bare_byte no \
+-    directory no \
+-    double_decode no \
+-    iis_backslash no \
+-    iis_delimiter no \
+-    iis_unicode no \
+-    multi_slash no \
+-    utf_8 no \
+-    u_encode yes \
+-    webroot no
++#! disabled for performance reasons:
++#! preprocessor http_inspect: global iis_unicode_map unicode.map 1252 compress_depth 65535 decompress_depth 65535
++#! preprocessor http_inspect_server: server default \
++#!     http_methods { GET POST PUT SEARCH MKCOL COPY MOVE LOCK UNLOCK NOTIFY POLL BCOPY BDELETE BMOVE LINK UNLINK OPTIONS HEAD DELETE TRACE TRACK CONNECT SOURCE SUBSCRIBE UNSUBSCRIBE PROPFIND PROPPATCH BPROPFIND BPROPPATCH RPC_CONNECT PROXY_SUCCESS BITS_POST CCM_POST SMS_POST RPC_IN_DATA RPC_OUT_DATA RPC_ECHO_DATA } \
++#!     chunk_length 500000 \
++#!     server_flow_depth 0 \
++#!     client_flow_depth 0 \
++#!     post_depth 65495 \
++#!     oversize_dir_length 500 \
++#!     max_header_length 750 \
++#!     max_headers 100 \
++#!     max_spaces 0 \
++#!     small_chunk_length { 10 5 } \
++#!     ports { 80 81 311 591 593 901 1220 1414 1830 2301 2381 2809 3128 3702 4343 5250 7001 7145 7510 7777 7779 8000 8008 8014 8028 8080 8088 8118 8123 8180 8181 8243 8280 8800 8888 8899 9080 9090 9091 9443 9999 11371 55555 } \
++#!     non_rfc_char { 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 } \
++#!     enable_cookie \
++#!     extended_response_inspection \
++#!     inspect_gzip \
++#!     normalize_utf \
++#!     unlimited_decompress \
++#!     normalize_javascript \
++#!     apache_whitespace no \
++#!     ascii no \
++#!     bare_byte no \
++#!     directory no \
++#!     double_decode no \
++#!     iis_backslash no \
++#!     iis_delimiter no \
++#!     iis_unicode no \
++#!     multi_slash no \
++#!     utf_8 no \
++#!     u_encode yes \
++#!     webroot no
+ # ONC-RPC normalization and anomaly detection.  For more information, see the Snort Manual, Configuring Snort - Preprocessors - RPC Decode
+-preprocessor rpc_decode: 111 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 no_alert_multiple_requests no_alert_large_fragments no_alert_incomplete
++#! disabled for performance reasons:
++#! preprocessor rpc_decode: 111 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 no_alert_multiple_requests no_alert_large_fragments no_alert_incomplete
+ # Back Orifice detection.
+-preprocessor bo
++#! preprocessor bo #! disabled for performance reasons
+ # FTP / Telnet normalization and anomaly detection.  For more information, see README.ftptelnet
+-preprocessor ftp_telnet: global inspection_type stateful encrypted_traffic no
+-preprocessor ftp_telnet_protocol: telnet \
+-    ayt_attack_thresh 20 \
+-    normalize ports { 23 } \
+-    detect_anomalies
+-preprocessor ftp_telnet_protocol: ftp server default \
+-    def_max_param_len 100 \
+-    ports { 21 2100 3535 } \
+-    telnet_cmds yes \
+-    ignore_telnet_erase_cmds yes \
+-    ftp_cmds { ABOR ACCT ADAT ALLO APPE AUTH CCC CDUP } \
+-    ftp_cmds { CEL CLNT CMD CONF CWD DELE ENC EPRT } \
+-    ftp_cmds { EPSV ESTA ESTP FEAT HELP LANG LIST LPRT } \
+-    ftp_cmds { LPSV MACB MAIL MDTM MIC MKD MLSD MLST } \
+-    ftp_cmds { MODE NLST NOOP OPTS PASS PASV PBSZ PORT } \
+-    ftp_cmds { PROT PWD QUIT REIN REST RETR RMD RNFR } \
+-    ftp_cmds { RNTO SDUP SITE SIZE SMNT STAT STOR STOU } \
+-    ftp_cmds { STRU SYST TEST TYPE USER XCUP XCRC XCWD } \
+-    ftp_cmds { XMAS XMD5 XMKD XPWD XRCP XRMD XRSQ XSEM } \
+-    ftp_cmds { XSEN XSHA1 XSHA256 } \
+-    alt_max_param_len 0 { ABOR CCC CDUP ESTA FEAT LPSV NOOP PASV PWD QUIT REIN STOU SYST XCUP XPWD } \
+-    alt_max_param_len 200 { ALLO APPE CMD HELP NLST RETR RNFR STOR STOU XMKD } \
+-    alt_max_param_len 256 { CWD RNTO } \
+-    alt_max_param_len 400 { PORT } \
+-    alt_max_param_len 512 { SIZE } \
+-    chk_str_fmt { ACCT ADAT ALLO APPE AUTH CEL CLNT CMD } \
+-    chk_str_fmt { CONF CWD DELE ENC EPRT EPSV ESTP HELP } \
+-    chk_str_fmt { LANG LIST LPRT MACB MAIL MDTM MIC MKD } \
+-    chk_str_fmt { MLSD MLST MODE NLST OPTS PASS PBSZ PORT } \
+-    chk_str_fmt { PROT REST RETR RMD RNFR RNTO SDUP SITE } \
+-    chk_str_fmt { SIZE SMNT STAT STOR STRU TEST TYPE USER } \
+-    chk_str_fmt { XCRC XCWD XMAS XMD5 XMKD XRCP XRMD XRSQ } \ 
+-    chk_str_fmt { XSEM XSEN XSHA1 XSHA256 } \
+-    cmd_validity ALLO < int [ char R int ] > \    
+-    cmd_validity EPSV < [ { char 12 | char A char L char L } ] > \
+-    cmd_validity MACB < string > \
+-    cmd_validity MDTM < [ date nnnnnnnnnnnnnn[.n[n[n]]] ] string > \
+-    cmd_validity MODE < char ASBCZ > \
+-    cmd_validity PORT < host_port > \
+-    cmd_validity PROT < char CSEP > \
+-    cmd_validity STRU < char FRPO [ string ] > \    
+-    cmd_validity TYPE < { char AE [ char NTC ] | char I | char L [ number ] } >
+-preprocessor ftp_telnet_protocol: ftp client default \
+-    max_resp_len 256 \
+-    bounce yes \
+-    ignore_telnet_erase_cmds yes \
+-    telnet_cmds yes
++#! disabled for performance reasons:
++#! preprocessor ftp_telnet: global inspection_type stateful encrypted_traffic no check_encrypted
++#! preprocessor ftp_telnet_protocol: telnet \
++#!     ayt_attack_thresh 20 \
++#!     normalize ports { 23 } \
++#!     detect_anomalies
++#! preprocessor ftp_telnet_protocol: ftp server default \
++#!     def_max_param_len 100 \
++#!     ports { 21 2100 3535 } \
++#!     telnet_cmds yes \
++#!     ignore_telnet_erase_cmds yes \
++#!     ftp_cmds { ABOR ACCT ADAT ALLO APPE AUTH CCC CDUP } \
++#!     ftp_cmds { CEL CLNT CMD CONF CWD DELE ENC EPRT } \
++#!     ftp_cmds { EPSV ESTA ESTP FEAT HELP LANG LIST LPRT } \
++#!     ftp_cmds { LPSV MACB MAIL MDTM MIC MKD MLSD MLST } \
++#!     ftp_cmds { MODE NLST NOOP OPTS PASS PASV PBSZ PORT } \
++#!     ftp_cmds { PROT PWD QUIT REIN REST RETR RMD RNFR } \
++#!     ftp_cmds { RNTO SDUP SITE SIZE SMNT STAT STOR STOU } \
++#!     ftp_cmds { STRU SYST TEST TYPE USER XCUP XCRC XCWD } \
++#!     ftp_cmds { XMAS XMD5 XMKD XPWD XRCP XRMD XRSQ XSEM } \
++#!     ftp_cmds { XSEN XSHA1 XSHA256 } \
++#!     alt_max_param_len 0 { ABOR CCC CDUP ESTA FEAT LPSV NOOP PASV PWD QUIT REIN STOU SYST XCUP XPWD } \
++#!     alt_max_param_len 200 { ALLO APPE CMD HELP NLST RETR RNFR STOR STOU XMKD } \
++#!     alt_max_param_len 256 { CWD RNTO } \
++#!     alt_max_param_len 400 { PORT } \
++#!     alt_max_param_len 512 { SIZE } \
++#!     chk_str_fmt { ACCT ADAT ALLO APPE AUTH CEL CLNT CMD } \
++#!     chk_str_fmt { CONF CWD DELE ENC EPRT EPSV ESTP HELP } \
++#!     chk_str_fmt { LANG LIST LPRT MACB MAIL MDTM MIC MKD } \
++#!     chk_str_fmt { MLSD MLST MODE NLST OPTS PASS PBSZ PORT } \
++#!     chk_str_fmt { PROT REST RETR RMD RNFR RNTO SDUP SITE } \
++#!     chk_str_fmt { SIZE SMNT STAT STOR STRU TEST TYPE USER } \
++#!     chk_str_fmt { XCRC XCWD XMAS XMD5 XMKD XRCP XRMD XRSQ } \ 
++#!     chk_str_fmt { XSEM XSEN XSHA1 XSHA256 } \
++#!     cmd_validity ALLO < int [ char R int ] > \    
++#!     cmd_validity EPSV < [ { char 12 | char A char L char L } ] > \
++#!     cmd_validity MACB < string > \
++#!     cmd_validity MDTM < [ date nnnnnnnnnnnnnn[.n[n[n]]] ] string > \
++#!     cmd_validity MODE < char ASBCZ > \
++#!     cmd_validity PORT < host_port > \
++#!     cmd_validity PROT < char CSEP > \
++#!     cmd_validity STRU < char FRPO [ string ] > \    
++#!     cmd_validity TYPE < { char AE [ char NTC ] | char I | char L [ number ] } >
++#! preprocessor ftp_telnet_protocol: ftp client default \
++#!     max_resp_len 256 \
++#!     bounce yes \
++#!     ignore_telnet_erase_cmds yes \
++#!     telnet_cmds yes
+ # SMTP normalization and anomaly detection.  For more information, see README.SMTP
+-preprocessor smtp: ports { 25 465 587 691 } \
+-    inspection_type stateful \
+-    b64_decode_depth 0 \
+-    qp_decode_depth 0 \
+-    bitenc_decode_depth 0 \
+-    uu_decode_depth 0 \
+-    log_mailfrom \
+-    log_rcptto \
+-    log_filename \
+-    log_email_hdrs \
+-    normalize cmds \
+-    normalize_cmds { ATRN AUTH BDAT CHUNKING DATA DEBUG EHLO EMAL ESAM ESND ESOM ETRN EVFY } \
+-    normalize_cmds { EXPN HELO HELP IDENT MAIL NOOP ONEX QUEU QUIT RCPT RSET SAML SEND SOML } \
+-    normalize_cmds { STARTTLS TICK TIME TURN TURNME VERB VRFY X-ADAT X-DRCP X-ERCP X-EXCH50 } \
+-    normalize_cmds { X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
+-    max_command_line_len 512 \
+-    max_header_line_len 1000 \
+-    max_response_line_len 512 \
+-    alt_max_command_line_len 260 { MAIL } \
+-    alt_max_command_line_len 300 { RCPT } \
+-    alt_max_command_line_len 500 { HELP HELO ETRN EHLO } \
+-    alt_max_command_line_len 255 { EXPN VRFY ATRN SIZE BDAT DEBUG EMAL ESAM ESND ESOM EVFY IDENT NOOP RSET } \
+-    alt_max_command_line_len 246 { SEND SAML SOML AUTH TURN ETRN DATA RSET QUIT ONEX QUEU STARTTLS TICK TIME TURNME VERB X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
+-    valid_cmds { ATRN AUTH BDAT CHUNKING DATA DEBUG EHLO EMAL ESAM ESND ESOM ETRN EVFY } \ 
+-    valid_cmds { EXPN HELO HELP IDENT MAIL NOOP ONEX QUEU QUIT RCPT RSET SAML SEND SOML } \
+-    valid_cmds { STARTTLS TICK TIME TURN TURNME VERB VRFY X-ADAT X-DRCP X-ERCP X-EXCH50 } \
+-    valid_cmds { X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
+-    xlink2state { enabled }
++#! disabled for performance reasons:
++#! preprocessor smtp: ports { 25 465 587 691 } \
++#!     inspection_type stateful \
++#!     b64_decode_depth 0 \
++#!     qp_decode_depth 0 \
++#!     bitenc_decode_depth 0 \
++#!     uu_decode_depth 0 \
++#!     log_mailfrom \
++#!     log_rcptto \
++#!     log_filename \
++#!     log_email_hdrs \
++#!     normalize cmds \
++#!     normalize_cmds { ATRN AUTH BDAT CHUNKING DATA DEBUG EHLO EMAL ESAM ESND ESOM ETRN EVFY } \
++#!     normalize_cmds { EXPN HELO HELP IDENT MAIL NOOP ONEX QUEU QUIT RCPT RSET SAML SEND SOML } \
++#!     normalize_cmds { STARTTLS TICK TIME TURN TURNME VERB VRFY X-ADAT X-DRCP X-ERCP X-EXCH50 } \
++#!     normalize_cmds { X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
++#!     max_command_line_len 512 \
++#!     max_header_line_len 1000 \
++#!     max_response_line_len 512 \
++#!     alt_max_command_line_len 260 { MAIL } \
++#!     alt_max_command_line_len 300 { RCPT } \
++#!     alt_max_command_line_len 500 { HELP HELO ETRN EHLO } \
++#!     alt_max_command_line_len 255 { EXPN VRFY ATRN SIZE BDAT DEBUG EMAL ESAM ESND ESOM EVFY IDENT NOOP RSET } \
++#!     alt_max_command_line_len 246 { SEND SAML SOML AUTH TURN ETRN DATA RSET QUIT ONEX QUEU STARTTLS TICK TIME TURNME VERB X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
++#!     valid_cmds { ATRN AUTH BDAT CHUNKING DATA DEBUG EHLO EMAL ESAM ESND ESOM ETRN EVFY } \ 
++#!     valid_cmds { EXPN HELO HELP IDENT MAIL NOOP ONEX QUEU QUIT RCPT RSET SAML SEND SOML } \
++#!     valid_cmds { STARTTLS TICK TIME TURN TURNME VERB VRFY X-ADAT X-DRCP X-ERCP X-EXCH50 } \
++#!     valid_cmds { X-EXPS X-LINK2STATE XADR XAUTH XCIR XEXCH50 XGEN XLICENSE XQUE XSTA XTRN XUSR } \
++#!     xlink2state { enabled }
+ # Portscan detection.  For more information, see README.sfportscan
+ # preprocessor sfportscan: proto  { all } memcap { 10000000 } sense_level { low }
+@@ -430,17 +452,19 @@ preprocessor ssh: server_ports { 22 } \
+                   enable_srvoverflow enable_protomismatch
+ # SMB / DCE-RPC normalization and anomaly detection.  For more information, see README.dcerpc2
+-preprocessor dcerpc2: memcap 102400, events [co ]
+-preprocessor dcerpc2_server: default, policy WinXP, \
+-    detect [smb [139,445], tcp 135, udp 135, rpc-over-http-server 593], \
+-    autodetect [tcp 1025:, udp 1025:, rpc-over-http-server 1025:], \
+-    smb_max_chain 3, smb_invalid_shares ["C$", "D$", "ADMIN$"]
++#! disabled for performance reasons:
++#! preprocessor dcerpc2: memcap 102400, events [co ]
++#! preprocessor dcerpc2_server: default, policy WinXP, \
++#!     detect [smb [139,445], tcp 135, udp 135, rpc-over-http-server 593], \
++#!     autodetect [tcp 1025:, udp 1025:, rpc-over-http-server 1025:], \
++#!     smb_max_chain 3, smb_invalid_shares ["C$", "D$", "ADMIN$"]
+ # DNS anomaly detection.  For more information, see README.dns
+-preprocessor dns: ports { 53 } enable_rdata_overflow
++#! preprocessor dns: ports { 53 } enable_rdata_overflow #! disabled for performance reasons
+ # SSL anomaly detection and traffic bypass.  For more information, see README.ssl
+-preprocessor ssl: ports { 443 465 563 636 989 992 993 994 995 7801 7802 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 }, trustservers, noinspect_encrypted
++#! disabled for performance reasons:
++#! preprocessor ssl: ports { 443 465 563 636 989 992 993 994 995 7801 7802 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 }, trustservers, noinspect_encrypted
+ # SDF sensitive data preprocessor.  For more information see README.sensitive_data
+ preprocessor sensitive_data: alert_threshold 25
+@@ -503,12 +527,13 @@ preprocessor dnp3: ports { 20000 } \
+    check_crc
+ # Reputation preprocessor. For more information see README.reputation
+-preprocessor reputation: \
+-   memcap 500, \
+-   priority whitelist, \
+-   nested_ip inner, \
+-   whitelist $WHITE_LIST_PATH/white_list.rules, \
+-   blacklist $BLACK_LIST_PATH/black_list.rules 
++#! disabled for performance reasons:
++#! preprocessor reputation: \
++#!    memcap 500, \
++#!    priority whitelist, \
++#!    nested_ip inner, \
++#!    whitelist $WHITE_LIST_PATH/white_list.rules, \
++#!    blacklist $BLACK_LIST_PATH/black_list.rules 
+ ###################################################
+ # Step #6: Configure output plugins
+@@ -551,60 +576,71 @@ include reference.config
+ # site specific rules
+ include $RULE_PATH/local.rules
+-include $RULE_PATH/attack-responses.rules
+-include $RULE_PATH/backdoor.rules
+-include $RULE_PATH/bad-traffic.rules
+-include $RULE_PATH/blacklist.rules
+-include $RULE_PATH/botnet-cnc.rules
+-include $RULE_PATH/chat.rules
+-include $RULE_PATH/content-replace.rules
+-include $RULE_PATH/ddos.rules
+-include $RULE_PATH/dns.rules
+-include $RULE_PATH/dos.rules
+-include $RULE_PATH/exploit.rules
+-include $RULE_PATH/file-identify.rules
+-include $RULE_PATH/finger.rules
+-include $RULE_PATH/ftp.rules
+-include $RULE_PATH/icmp.rules
+-include $RULE_PATH/icmp-info.rules
+-include $RULE_PATH/imap.rules
+-include $RULE_PATH/info.rules
+-include $RULE_PATH/misc.rules
+-include $RULE_PATH/multimedia.rules
+-include $RULE_PATH/mysql.rules
+-include $RULE_PATH/netbios.rules
+-include $RULE_PATH/nntp.rules
+-include $RULE_PATH/oracle.rules
+-include $RULE_PATH/other-ids.rules
+-include $RULE_PATH/p2p.rules
+-include $RULE_PATH/phishing-spam.rules
+-include $RULE_PATH/policy.rules
+-include $RULE_PATH/pop2.rules
+-include $RULE_PATH/pop3.rules
+-include $RULE_PATH/rpc.rules
+-include $RULE_PATH/rservices.rules
+-include $RULE_PATH/scada.rules
+-include $RULE_PATH/scan.rules
+-include $RULE_PATH/shellcode.rules
+-include $RULE_PATH/smtp.rules
+-include $RULE_PATH/snmp.rules
+-include $RULE_PATH/specific-threats.rules
+-include $RULE_PATH/spyware-put.rules
+-include $RULE_PATH/sql.rules
+-include $RULE_PATH/telnet.rules
+-include $RULE_PATH/tftp.rules
+-include $RULE_PATH/virus.rules
+-include $RULE_PATH/voip.rules
+-include $RULE_PATH/web-activex.rules
+-include $RULE_PATH/web-attacks.rules
+-include $RULE_PATH/web-cgi.rules
+-include $RULE_PATH/web-client.rules
+-include $RULE_PATH/web-coldfusion.rules
+-include $RULE_PATH/web-frontpage.rules
+-include $RULE_PATH/web-iis.rules
+-include $RULE_PATH/web-misc.rules
+-include $RULE_PATH/web-php.rules
+-include $RULE_PATH/x11.rules
++#! include $RULE_PATH/attack-responses.rules
++#! include $RULE_PATH/backdoor.rules
++#! include $RULE_PATH/bad-traffic.rules
++#! include $RULE_PATH/blacklist.rules
++#! include $RULE_PATH/botnet-cnc.rules
++#! include $RULE_PATH/chat.rules
++#! include $RULE_PATH/content-replace.rules
++#! include $RULE_PATH/ddos.rules
++#! include $RULE_PATH/dns.rules
++#! include $RULE_PATH/dos.rules
++#! include $RULE_PATH/exploit.rules
++#! include $RULE_PATH/file-identify.rules
++#! include $RULE_PATH/file-office.rules
++#! include $RULE_PATH/file-other.rules
++#! include $RULE_PATH/file-pdf.rules
++#! include $RULE_PATH/finger.rules
++#! include $RULE_PATH/ftp.rules
++#! include $RULE_PATH/icmp.rules
++#! include $RULE_PATH/icmp-info.rules
++#! include $RULE_PATH/imap.rules
++#! include $RULE_PATH/indicator-compromise.rules
++#! include $RULE_PATH/indicator-obfuscation.rules
++#! include $RULE_PATH/info.rules
++#! include $RULE_PATH/misc.rules
++#! include $RULE_PATH/multimedia.rules
++#! include $RULE_PATH/mysql.rules
++#! include $RULE_PATH/netbios.rules
++#! include $RULE_PATH/nntp.rules
++#! include $RULE_PATH/oracle.rules
++#! include $RULE_PATH/other-ids.rules
++#! include $RULE_PATH/p2p.rules
++#! include $RULE_PATH/phishing-spam.rules
++#! include $RULE_PATH/policy.rules
++#! include $RULE_PATH/policy-multimedia.rules
++#! include $RULE_PATH/policy-other.rules
++#! include $RULE_PATH/policy-social.rules
++#! include $RULE_PATH/pop2.rules
++#! include $RULE_PATH/pop3.rules
++#! include $RULE_PATH/pua-p2p.rules
++#! include $RULE_PATH/pua-toolbars.rules
++#! include $RULE_PATH/rpc.rules
++#! include $RULE_PATH/rservices.rules
++#! include $RULE_PATH/scada.rules
++#! include $RULE_PATH/scan.rules
++#! include $RULE_PATH/server-mail.rules
++#! include $RULE_PATH/shellcode.rules
++#! include $RULE_PATH/smtp.rules
++#! include $RULE_PATH/snmp.rules
++#! include $RULE_PATH/specific-threats.rules
++#! include $RULE_PATH/spyware-put.rules
++#! include $RULE_PATH/sql.rules
++#! include $RULE_PATH/telnet.rules
++#! include $RULE_PATH/tftp.rules
++#! include $RULE_PATH/virus.rules
++#! include $RULE_PATH/voip.rules
++#! include $RULE_PATH/web-activex.rules
++#! include $RULE_PATH/web-attacks.rules
++#! include $RULE_PATH/web-cgi.rules
++#! include $RULE_PATH/web-client.rules
++#! include $RULE_PATH/web-coldfusion.rules
++#! include $RULE_PATH/web-frontpage.rules
++#! include $RULE_PATH/web-iis.rules
++#! include $RULE_PATH/web-misc.rules
++#! include $RULE_PATH/web-php.rules
++#! include $RULE_PATH/x11.rules
+ ###################################################
+ # Step #8: Customize your preprocessor and decoder alerts
diff --git a/net/snort/patches/160-mysql_cross_compiling_checks.patch b/net/snort/patches/160-mysql_cross_compiling_checks.patch
new file mode 100644 (file)
index 0000000..4ad5355
--- /dev/null
@@ -0,0 +1,66 @@
+--- a/configure.in
++++ b/configure.in
+@@ -1128,63 +1128,6 @@ if test "x$with_mysql" != "xno"; then
+     fi
+   fi
+-  AC_MSG_CHECKING([for mysql default client reconnect])
+-
+-  AC_RUN_IFELSE(
+-  [AC_LANG_PROGRAM(
+-  [[
+-  #include <mysql.h>
+-  ]],
+-  [[
+-      if (mysql_get_client_version() < 50003)
+-          return 1;
+-  ]])],
+-  [mysql_default_reconnect="no"],
+-  [mysql_default_reconnect="yes"])
+-
+-  AC_MSG_RESULT($mysql_default_reconnect)
+-
+-  if test "x$mysql_default_reconnect" = "xno"; then
+-      AC_MSG_CHECKING([for mysql reconnect option])
+-
+-      AC_RUN_IFELSE(
+-      [AC_LANG_PROGRAM(
+-      [[
+-      #include <mysql.h>
+-      ]],
+-      [[
+-          if (mysql_get_client_version() < 50013)
+-              return 1;
+-      ]])],
+-      [mysql_has_reconnect="yes"],
+-      [mysql_has_reconnect="no"])
+-
+-      AC_MSG_RESULT($mysql_has_reconnect)
+-
+-      if test "x$mysql_has_reconnect" = "xyes"; then
+-          AC_DEFINE([MYSQL_HAS_OPT_RECONNECT],[1],[For MySQL versions 5.0.13 and greater])
+-
+-          AC_MSG_CHECKING([for mysql setting of reconnect option before connect bug])
+-
+-          AC_RUN_IFELSE(
+-          [AC_LANG_PROGRAM(
+-          [[
+-          #include <mysql.h>
+-          ]],
+-          [[
+-              if (mysql_get_client_version() < 50019)
+-                  return 1;
+-          ]])],
+-          [mysql_has_reconnect_bug="no"],
+-          [mysql_has_reconnect_bug="yes"])
+-
+-          AC_MSG_RESULT($mysql_has_reconnect_bug)
+-
+-          if test "x$mysql_has_reconnect_bug" = "xyes"; then
+-              AC_DEFINE([MYSQL_HAS_OPT_RECONNECT_BUG],[1],[For MySQL versions 5.0.13 to 5.0.18])
+-          fi
+-      fi
+-  fi
+ fi
+ AC_ARG_WITH(odbc,
diff --git a/net/snort/patches/200-snortsam.patch b/net/snort/patches/200-snortsam.patch
new file mode 100644 (file)
index 0000000..d767d86
--- /dev/null
@@ -0,0 +1,3016 @@
+diff -ruN snort-2.9.2.2/autojunk.sh snort-2.9.2.2_bkup/autojunk.sh
+--- snort-2.9.2.2/autojunk.sh  1969-12-31 16:00:00.000000000 -0800
++++ snort-2.9.2.2_bkup/autojunk.sh     2012-04-08 20:34:57.385687022 -0700
+@@ -0,0 +1,7 @@
++#!/bin/sh
++# the list of commands that need to run before we do a compile
++libtoolize --automake --copy
++aclocal -I m4
++autoheader
++automake --add-missing --copy
++autoconf
+diff -ruN snort-2.9.2.2/etc/snort.conf snort-2.9.2.2_bkup/etc/snort.conf
+--- snort-2.9.2.2/etc/snort.conf       2012-03-19 15:57:09.000000000 -0700
++++ snort-2.9.2.2_bkup/etc/snort.conf  2012-04-08 20:34:57.385687022 -0700
+@@ -536,11 +536,38 @@
+ # prelude
+ # output alert_prelude
++###################################################
++# snortsam
++###################################################
++# In order to cause Snort to send a blocking request to the SnortSam agent,
++# that agent has to be listed, including the port it listens on,
++# and the encryption key it is using. The statement for that is:
++#
++# output alert_fwsam: {SnortSam Station}:{port}/{password}
++#
++#  {SnortSam Station}: IP address or host name of the host where SnortSam is running.
++#  {port}:             The port the remote SnortSam agent listens on.
++#  {password}:         The password, or key, used for encryption of the
++#                      communication to the remote agent.
++#
++# At the very least, the IP address or host name of the host running SnortSam
++# needs to be specified. If the port is omitted, it defaults to TCP port 898.
++# If the password is omitted, it defaults to a preset password.
++# (In which case it needs to be omitted on the SnortSam agent as well)
++#
++# More than one host can be specified, but has to be done on the same line.
++# Just separate them with one or more spaces.
++#
++# Examples:
++#
++# output alert_fwsam: firewall/idspassword
++# output alert_fwsam: fw1.domain.tld:898/mykey
++# output alert_fwsam: 192.168.0.1/borderfw  192.168.1.254/wanfw
++
+ # metadata reference data.  do not modify these lines
+ include classification.config
+ include reference.config
+-
+ ###################################################
+ # Step #7: Customize your rule set
+ # For more information, see Snort Manual, Writing Snort Rules
+diff -ruN snort-2.9.2.2/src/fatal.h snort-2.9.2.2_bkup/src/fatal.h
+--- snort-2.9.2.2/src/fatal.h  1969-12-31 16:00:00.000000000 -0800
++++ snort-2.9.2.2_bkup/src/fatal.h     2012-04-08 20:34:57.385687022 -0700
+@@ -0,0 +1,40 @@
++/* $Id$ */
++/*
++** Copyright (C) 2002-2008 Sourcefire, Inc.
++** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com>
++**
++** This program is free software; you can redistribute it and/or modify
++** it under the terms of the GNU General Public License Version 2 as
++** published by the Free Software Foundation.  You may not use, modify or
++** distribute this program under any other version of the GNU General
++** Public License.
++**
++** This program is distributed in the hope that it will be useful,
++** but WITHOUT ANY WARRANTY; without even the implied warranty of
++** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++** GNU General Public License for more details.
++**
++** You should have received a copy of the GNU General Public License
++** along with this program; if not, write to the Free Software
++** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++*/
++
++#ifndef __FATAL_H__
++#define __FATAL_H__
++
++
++/*
++ * in debugging mode print out the filename and the line number where the
++ * failure have occured
++ */
++
++
++#ifdef DEBUG
++      #define FATAL(msg)      { printf("%s:%d: ", __FILE__, __LINE__); FatalError( (char *) msg); }
++#else
++      #define FATAL(msg)      FatalError( (char *) msg)
++#endif
++
++
++
++#endif        /* __FATAL_H__ */
+diff -ruN snort-2.9.2.2/src/Makefile.am snort-2.9.2.2_bkup/src/Makefile.am
+--- snort-2.9.2.2/src/Makefile.am      2011-10-26 11:28:52.000000000 -0700
++++ snort-2.9.2.2_bkup/src/Makefile.am 2012-04-08 20:34:57.385687022 -0700
+@@ -59,6 +59,7 @@
+ rate_filter.c rate_filter.h \
+ obfuscation.c obfuscation.h \
+ rule_option_types.h \
++twofish.c twofish.h \
+ sfdaq.c sfdaq.h \
+ idle_processing.c idle_processing.h idle_processing_funcs.h
+diff -ruN snort-2.9.2.2/src/output-plugins/Makefile.am snort-2.9.2.2_bkup/src/output-plugins/Makefile.am
+--- snort-2.9.2.2/src/output-plugins/Makefile.am       2010-06-09 15:05:17.000000000 -0700
++++ snort-2.9.2.2_bkup/src/output-plugins/Makefile.am  2012-04-08 20:34:57.385687022 -0700
+@@ -15,6 +15,7 @@
+ spo_log_tcpdump.h spo_unified.c spo_unified2.c spo_unified.h spo_unified2.h \
+ spo_log_ascii.c spo_log_ascii.h spo_alert_sf_socket.h spo_alert_sf_socket.c \
+ $(PRELUDE_CODE) spo_alert_arubaaction.c spo_alert_arubaaction.h \
++spo_alert_fwsam.c spo_alert_fwsam.h \
+ spo_alert_test.c spo_alert_test.h
+ INCLUDES = @INCLUDES@
+diff -ruN snort-2.9.2.2/src/output-plugins/spo_alert_fwsam.c snort-2.9.2.2_bkup/src/output-plugins/spo_alert_fwsam.c
+--- snort-2.9.2.2/src/output-plugins/spo_alert_fwsam.c 1969-12-31 16:00:00.000000000 -0800
++++ snort-2.9.2.2_bkup/src/output-plugins/spo_alert_fwsam.c    2012-04-08 23:40:57.676343063 -0700
+@@ -0,0 +1,1387 @@
++/* $id: snortpatchb,v 1.2 2002/10/26 03:32:35 fknobbe Exp $
++**
++** spo_alert_fwsam.c
++**
++** Copyright (c) 2001-2004 Frank Knobbe <frank@knobbe.us>
++**
++** This program is free software; you can redistribute it and/or modify
++** it under the terms of the GNU General Public License as published by
++** the Free Software Foundation; either version 2 of the License, or
++** (at your option) any later version.
++**
++** This program is distributed in the hope that it will be useful,
++** but WITHOUT ANY WARRANTY; without even the implied warranty of
++** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++** GNU General Public License for more details.
++**
++** You should have received a copy of the GNU General Public License
++** along with this program; if not, write to the Free Software
++** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++*/
++
++/*
++ * Purpose:
++ *
++ * This module sends alerts to a remote service on a host running SnortSam
++ * (the agent) which will block the intruding IP address on a variety of
++ * host and network firewalls.
++ *
++ * SnortSam also performs checks against a white-list of never-to-be-blocked IP addresses,
++ * can override block durations (for example for known proxies), and can detect attack conditions
++ * where too many blocks are received within a defined interval. If an attack is detected
++ * it will unblock the last x blocks and wait for the attack to end.
++ *
++ * See the SnortSam documentation for more information.
++ *
++ *
++ * Output Plugin Parameters:
++ ***************************
++ *
++ * output alert_fwsam: <SnortSam Station>:<port>/<key>
++ *
++ *    <FW Mgmt Station>:      The IP address or host name of the host running SnortSam.
++ *    <port>:                 The port the remote SnortSam service listens on (default 898).
++ *    <key>:                  The key used for authentication (encryption really)
++ *                            of the communication to the remote service.
++ *
++ * Examples:
++ *
++ * output alert_fwsam: snortsambox/idspassword
++ * output alert_fwsam: fw1.domain.tld:898/mykey
++ * output alert_fwsam: 192.168.0.1/borderfw  192.168.1.254/wanfw
++ *
++ *
++ * Rule Options:
++ ***************
++ *
++ * fwsam:     who[how],time;
++ *
++ *  who: src, source, dst, dest, destination
++ *                    IP address to be blocked according to snort rule (some rules
++ *                    are reversed, i.e. homenet -> any [and you want to block any]).
++ *          src denotes IP to the left of -> and dst denotes IP to the right
++ *
++ *  how: Optional. In, out, src, dest, either, both, this, conn, connection
++ *                    Tells FW-1 to block packets INcoming from host, OUTgoing to host,
++ *                    EITHERway, or only THIS connection (IP/Service pair).
++ *                    See 'fw sam' for more information. May be ignored by other plugins.
++ *
++ * time: Duration of block in seconds. (Accepts 'days', 'months', 'weeks',
++ *             'years', 'minutes', 'seconds', 'hours'. Alternatively, a value of
++ *             0, or the keyword PERManent, INFinite, or ALWAYS, will block the
++ *             host permanently. Be careful with this!
++ *                    Tells FW-1 (and others) how long to inhibit packets from the host.
++ *
++ * Examples:
++ *
++ * fwsam:  src[either],15min;
++ *     or  dst[in], 2 days 4 hours
++ *     or  src, 1 hour
++ *
++ *         (default: src[either],5min)
++ *
++ *
++ * Effect:
++ *
++ * Alerts are sent to the remote SnortSam services on Firewall-1 Management Stations
++ * or other hosts running SnortSam (as required for Cisco Routers and PIX).
++ * The remote services will invoke the SAM configuration via the fw sam
++ * command line, or by sending a packet to the SAM port 18183, or by using the official
++ * OPSEC API calls, or by telnetting into Cisco routers or PIX firewalls.
++ * The communication over the network is encrypted using two-fish.
++ * (Implementation ripped from CryptCat by Farm9 with permission.)
++ *
++ * Future Plans:
++ *
++ * - Custom alert trigger per rule (x alerts in y secs) --> Seems to exist in Snort 1.9 now.
++ * - Enable/Allow tagged fwsam: arguments to provide different values to
++ *        different stations.  --> Seems to be accomplished with custom rule-types
++ *
++ *
++ * Comments:
++ *
++ * It seem that above wishes can be implemented with todays setup. Feedback concerning
++ * these is greatly appreciated.
++ *
++*/
++
++
++#include "spo_alert_fwsam.h"
++#include "twofish.h"
++/* external globals from rules.c  */
++extern char *file_name;
++extern int file_line;
++extern OptTreeNode *otn_tmp;
++extern char *snort_conf_dir; /* extern PV pv; */
++
++
++/* my globals  */
++
++FWsamList *FWsamStationList=NULL;                     /* Global (for all alert-types) list of snortsam stations */
++FWsamOptions *FWsamOptionField=NULL;
++unsigned long FWsamMaxOptions=0;
++
++
++/*
++ * Function: AlertFWsamSetup()
++ *
++ * Purpose: Registers the output plugin keyword and initialization
++ *          function into the output plugin list.  This is the function that
++ *          gets called from InitOutputPlugins() in plugbase.c.
++ *                    It also registers itself as a plugin in order to parse every rule
++ *                    and to set the appropiate flags from fwsam: option.
++ *
++ * Arguments: None.
++ *
++ * Returns: void function
++ *
++*/
++void AlertFWsamSetup(void)
++{
++    /* link the preprocessor keyword to the init function in the preproc list */
++    RegisterOutputPlugin("alert_fwsam", OUTPUT_TYPE_FLAG__ALERT, AlertFWsamInit);
++    RegisterRuleOption("fwsam", AlertFWsamOptionInit, NULL, OPT_TYPE_ACTION, NULL);
++
++#ifdef FWSAMDEBUG   /* This allows debugging of fwsam only */
++    LogMessage("DEBUG => [Alert_FWsam](AlertFWsamSetup) Output plugin is plugged in...\n");
++#endif
++}
++
++
++/*    This function checks if a given snortsam station is already in
++ *    a given list.
++*/
++int FWsamStationExists(FWsamStation *who,FWsamList *list)
++{
++    while(list)
++    {
++        if(list->station) {
++//                    if(     who->stationip.s_addr==list->station->stationip.s_addr &&
++            if(IP_EQUALITY(&who->stationip, &list->station->stationip) &&
++            who->stationport==list->station->stationport)
++            return TRUE;
++        }
++        list=list->next;
++    }
++    return FALSE;
++}
++
++/*
++ * Function: AlertFWsamInit(char *args)
++ *
++ * Purpose: Calls the argument parsing function, performs final setup on data
++ *          structs, links the preproc function into the function list.
++ *
++ * Arguments: args => ptr to argument string
++ *
++ * Returns: void function
++ *
++*/
++void AlertFWsamInit(char *args)
++{     char *ap;
++      unsigned long statip,cnt,again,i;
++      char *stathost,*statport,*statpass;
++      FWsamStation *station;
++      FWsamList *fwsamlist=NULL;      /* alert-type dependent list of snortsam stations  */
++      FWsamList *listp,*newlistp;
++      struct hostent *hoste;
++      char buf[1024]="";
++      FILE *fp;
++      FWsamOptions tempopt;
++
++#ifdef FWSAMDEBUG
++      unsigned long hostcnt=0;
++
++
++
++    LogMessage("DEBUG => [Alert_FWsam](AlertFWsamInit) Output plugin initializing...\n");
++#endif
++
++    /* pv.alert_plugin_active = 1; */
++
++    /* parse the argument list from the rules file */
++
++      if(args == NULL)
++              FatalError("ERROR %s (%d) => [Alert_FWsam](AlertFWsamInit) No arguments to alert_fwsam preprocessor!\n", file_name, file_line);
++
++      if(!FWsamOptionField && !FWsamMaxOptions)
++      {       strncpy(buf,snort_conf_dir,sizeof(buf)-1);
++              strncpy(buf+strlen(buf),SID_MAPFILE,sizeof(buf)-strlen(buf)-1);
++#ifdef FWSAMDEBUG
++              LogMessage("DEBUG => [Alert_FWsam](AlertFWsamSetup) Using file: %s\n",buf);
++#endif
++              fp=fopen(buf,"rt");
++              if(!fp)
++              {       strncpy(buf,snort_conf_dir,sizeof(buf)-1);
++                      strncpy(buf+strlen(buf),SID_ALT_MAPFILE,sizeof(buf)-strlen(buf)-1);
++                      fp=fopen(buf,"rt");
++              }
++              if(fp)  /* Check for presence of map file and read those in, sorted. */
++              {   LogMessage("INFO => [Alert_FWsam](AlertFWsamSetup) Using sid-map file: %s\n",buf);
++
++                      while(FWsamReadLine(buf,sizeof(buf),fp))
++                              if(*buf)
++                                      FWsamMaxOptions++;
++                      if(FWsamMaxOptions)
++                      {   if((FWsamOptionField=(FWsamOptions *)malloc(sizeof(FWsamOptions)*FWsamMaxOptions))==NULL)
++                                      FatalError("ERROR => [Alert_FWsam](AlertFWsamSetup) malloc failed for OptionField!\n");
++                              fseek(fp,0,SEEK_SET);
++                              for(cnt=0;cnt<FWsamMaxOptions;)
++                              {       FWsamReadLine(buf,sizeof(buf),fp);
++                                      if(*buf)
++                                              FWsamParseLine(&(FWsamOptionField[cnt++]),buf);
++                              }
++                              if(FWsamMaxOptions>1)
++                              {       for(again=TRUE,cnt=FWsamMaxOptions-1;cnt>=1 && again;cnt--)
++                                      {       for(again=FALSE,i=0;i<cnt;i++)
++                                              {       if(FWsamOptionField[i].sid>FWsamOptionField[i+1].sid)
++                                                      {       memcpy(&tempopt,&(FWsamOptionField[i]),sizeof(FWsamOptions));
++                                                              memcpy(&(FWsamOptionField[i]),&(FWsamOptionField[i+1]),sizeof(FWsamOptions));
++                                                              memcpy(&(FWsamOptionField[i+1]),&tempopt,sizeof(FWsamOptions));
++                                                              again=TRUE;
++                                                      }
++                                              }
++                                      }
++                              }
++                      }
++                      else
++                              FWsamMaxOptions=1;
++                      fclose(fp);
++              }
++              else
++                      FWsamMaxOptions=1;
++      }
++
++
++      ap=args; /* start at the beginning of the argument */
++      while(*ap && isspace(*ap)) ap++;
++      while(*ap)
++      {       stathost=ap; /* first argument should be host */
++              statport=NULL;
++              statpass=NULL;
++              while(*ap && *ap!=':' && *ap!='/' && !isspace(*ap)) ap++; /* find token */
++              switch(*ap)
++              {       case ':':       *ap++=0; /* grab the port */
++                                              statport=ap;
++                                              while(*ap && *ap!='/' && !isspace(*ap)) ap++;
++                                              if(*ap!='/')
++                                                      break;
++                      case '/':       *ap++=0; /* grab the key */
++                                              statpass=ap;
++                                              while(*ap && !isspace(*ap)) ap++;
++                      default:        break;
++              }
++              if(*ap)
++              {       *ap++=0;
++                      while(isspace(*ap)) ap++;
++              }
++              /* now we have the first host with port and password (key) */
++              /* next we check for valid/blank password/port */
++              if(statpass!=NULL)
++                      if(!*statpass)
++                              statpass=NULL;
++              if(statport!=NULL)
++                      if(!*statport)
++                              statport=NULL;
++              statip=0;
++              /* now we check if a valid host was specified */
++              if(inet_addr(stathost)==INADDR_NONE)
++              {       hoste=gethostbyname(stathost);
++                      if (!hoste)
++                              LogMessage("WARNING %s (%d) => [Alert_FWsam](AlertFWsamInit) Unable to resolve host '%s'!\n",file_name,file_line,stathost);
++                      else
++                              statip=*(unsigned long *)hoste->h_addr;
++              }
++              else
++              {       statip=inet_addr(stathost);
++                      if(!statip)
++                              LogMessage("WARNING %s (%d) => [Alert_FWsam](AlertFWsamInit) Invalid host address '%s'!\n",file_name,file_line,stathost);
++              }
++              if(statip)
++              {       /* groovie, a valid host. Let's alloc and assemble the structure for it. */
++                      if((station=(FWsamStation *)malloc(sizeof(FWsamStation)))==NULL)
++                              FatalError("ERROR => [Alert_FWsam](AlertFWsamInit) malloc failed for station!\n");
++
++//                    station->stationip.s_addr=statip; /* the IP address */
++                      station->stationip.ip32[0] = statip; /* the IP address */
++                      if(statport!=NULL && atoi(statport)>0) /* if the user specified one */
++                              station->stationport=atoi(statport); /* use users setting */
++                      else
++                              station->stationport=FWSAM_DEFAULTPORT; /* set the default port */
++
++                      if(statpass!=NULL) /* if specified by user */
++                              strncpy(station->stationkey,statpass,TwoFish_KEY_LENGTH); /* use defined key */
++                      else
++                              station->stationkey[0]=0;
++                      station->stationkey[TwoFish_KEY_LENGTH]=0; /* make sure it's terminated. (damn strncpy...) */
++
++                      strcpy(station->initialkey,station->stationkey);
++                      station->stationfish=TwoFishInit(station->stationkey);
++
++                      station->localsocketaddr.sin_port=htons(0); /* let's use dynamic ports for now */
++                      station->localsocketaddr.sin_addr.s_addr=0;
++                      station->localsocketaddr.sin_family=AF_INET;
++                      station->stationsocketaddr.sin_port=htons(station->stationport);
++                      //station->stationsocketaddr.sin_addr=station->stationip;
++                      station->stationsocketaddr.sin_addr.s_addr=station->stationip.ip32[0];
++                      station->stationsocketaddr.sin_family=AF_INET; /* load all socket crap and keep for later */
++
++                      do
++                              station->myseqno=rand(); /* the seqno this host will use */
++                      while(station->myseqno<20 || station->myseqno>65500);
++                      station->mykeymod[0]=rand();
++                      station->mykeymod[1]=rand();
++                      station->mykeymod[2]=rand();
++                      station->mykeymod[3]=rand();
++                      station->stationseqno=0;                                /* peer hasn't answered yet. */
++
++
++                      if(!FWsamStationExists(station,FWsamStationList))       /* If we don't have the station already in global list....*/
++                      {       if(FWsamCheckIn(station))                       /* ...and we can talk to the agent...  */
++                              {       if((newlistp=(FWsamList *)malloc(sizeof(FWsamList)))==NULL)
++                                              FatalError("ERROR => [Alert_FWsam](AlertFWsamInit) malloc failed for global newlistp!\n");
++                                      newlistp->station=station;
++                                      newlistp->next=NULL;
++
++                                      if(!FWsamStationList)                           /* ... add it to the global list/ */
++                                              FWsamStationList=newlistp;
++                                      else
++                                      {       listp=FWsamStationList;
++                                              while(listp->next)
++                                                      listp=listp->next;
++                                              listp->next=newlistp;
++                                      }
++                              }
++                              else
++                              {       TwoFishDestroy(station->stationfish); /* if not, we trash it. */
++                                      free(station);
++                                      station=NULL;
++                              }
++                      }
++#ifdef FWSAMDEBUG
++                      else
++                              LogMessage("DEBUG => [Alert_FWsam](AlertFWsamInit) Host %s:%i already in global list, skipping CheckIn.\n", sfip_ntoa(&station->stationip),station->stationport);
++#endif
++
++                      if(station)
++                      {       if(!FWsamStationExists(station,fwsamlist))      /* If we don't have the station already in local list....*/
++                              {       if((newlistp=(FWsamList *)malloc(sizeof(FWsamList)))==NULL)
++                                              FatalError("ERROR => [Alert_FWsam](AlertFWsamInit) malloc failed for local newlistp!\n");
++                                      newlistp->station=station;
++                                      newlistp->next=NULL;
++
++                                      if(!fwsamlist)                          /* ... add it to the local list/ */
++                                              fwsamlist=newlistp;
++                                      else
++                                      {       listp=fwsamlist;
++                                              while(listp->next)
++                                                      listp=listp->next;
++                                              listp->next=newlistp;
++                                      }
++                              }
++
++#ifdef FWSAMDEBUG
++                              else
++                                      LogMessage("DEBUG => [Alert_FWsam](AlertFWsamInit) Host %s:%i already in local list, skipping.\n",sfip_ntoa(&station->stationip),station->stationport);
++                              LogMessage("DEBUG => [Alert_FWsam](AlertFWsamInit) #%i: Host %s [%s] port %i password %s\n",++hostcnt,stathost,sfip_ntoa(&station->stationip),station->stationport,station->stationkey);
++#endif
++                      }
++
++              }
++      }       /* next one */
++
++#ifdef FWSAMDEBUG
++    LogMessage("DEBUG => [Alert_FWsam](AlertFWsamInit) Linking fwsam alert function to call list...\n");
++#endif
++
++    /* Set the preprocessor function into the function list */
++    AddFuncToOutputList(AlertFWsam, OUTPUT_TYPE_FLAG__ALERT, fwsamlist);
++    AddFuncToCleanExitList(AlertFWsamCleanExitFunc, fwsamlist);
++
++/* 
++* This ifdef function reloads snortsam config/list on SIG HUP
++* 04082012 RZ
++*/
++#ifdef SNORT_RELOAD
++    AddFuncToReloadList(AlertFWsamRestartFunc, fwsamlist);
++#endif
++
++}
++
++
++/*    This routine reads in a str from a file, snips white-spaces
++ *    off the front and back, removes comments, and pretties the
++ *    string. Returns true or false if a line was read or not.
++*/
++int FWsamReadLine(char *buf,unsigned long bufsize,FILE *fp)
++{     char *p;
++
++      if(fgets(buf,bufsize-1,fp))
++      {       buf[bufsize-1]=0;
++
++#ifdef FWSAMDEBUG_off
++              LogMessage("DEBUG => [Alert_FWsam](AlertFWsamReadLine) Line: %s\n",buf);
++#endif
++
++              p=buf;
++              while(isspace(*p))
++                p++;
++              if(p>buf);
++                      strcpy(buf,p);
++              if(*buf)
++              {       p=buf+strlen(buf)-1;    /* remove leading and trailing spaces */
++                      while(isspace(*p))
++                              *p-- =0;
++              }
++              p=buf;
++              if(*p=='#' || *p==';')
++                      *p=0;
++              else
++                      p++;
++              while(*p)                                       /* remove inline comments (except escaped #'s and ;'s) */
++              {       if(*p=='#' || *p==';')
++                      {       if(*(p-1)=='\\')
++                                      strcpy(p-1,p);
++                              else
++                                      *p=0;
++                      }
++                      else
++                              p++;
++              }
++              return TRUE;
++      }
++      return FALSE;
++}
++
++
++/* Parses the duration of the argument, recognizing minutes, hours, etc..
++*/
++unsigned long FWsamParseDuration(char *p)
++{     unsigned long dur=0,tdu;
++      char *tok,c1,c2;
++
++      while(*p)
++      {       tok=p;
++              while(*p && isdigit(*p))
++                      p++;
++              if(*p)
++              {       c1=tolower(*p);
++                      *p=0;
++                      p++;
++                      if(*p && !isdigit(*p))
++                      {       c2=tolower(*p++);
++                              while(*p && !isdigit(*p))
++                                      p++;
++                      }
++                      else
++                              c2=0;
++                      tdu=atol(tok);
++                      switch(c1)
++                      {       case 'm':       if(c2=='o')                             /* month */
++                                                              tdu*=(60*60*24*30);     /* use 30 days */
++                                                      else
++                                                              tdu*=60;                        /* minutes */
++                              case 's':       break;                                  /* seconds */
++                              case 'h':       tdu*=(60*60);                   /* hours */
++                                                      break;
++                              case 'd':       tdu*=(60*60*24);                /* days */
++                                                      break;
++                              case 'w':       tdu*=(60*60*24*7);              /* week */
++                                                      break;
++                              case 'y':       tdu*=(60*60*24*365);    /* year */
++                                                      break;
++                      }
++                      dur+=tdu;
++              }
++              else
++                      dur+=atol(tok);
++      }
++
++      return dur;
++}
++
++
++/*  This routine parses an option line. It is called by FWsamParseLine,
++ *  which parses the sid-block.map file, and also by AlertFWsamOptionInit,
++ *  which is called by Snort when processing fwsam: options in rules.
++ *  It returns TRUE it there is a possible option problem, otherwise FALSE.
++*/
++int FWsamParseOption(FWsamOptions *optp,char *ap)
++{   int possprob=FALSE;
++
++      /* set defaults */
++
++      optp->duration=300;                                     /* default of 5 minute block */
++      optp->how=FWSAM_HOW_INOUT;                      /* inbound and outbound block */
++      optp->who=FWSAM_WHO_SRC;                        /* the source  */
++    optp->loglevel=FWSAM_LOG_LONGALERT; /* the log level default */
++      /* parse the fwsam keywords */
++
++#ifdef FWSAMDEBUG
++      LogMessage("DEBUG => [Alert_FWsam](AlertFWamOptionInit) Parse Options Args: %s\n",ap);
++#endif
++
++      if(*ap)         /* should be dst/src (the WHO) or duration */
++      {       if(isdigit(*ap))
++                      optp->duration=FWsamParseDuration(ap);
++              else
++              {       switch(*ap)                     /* yeah, we're lazy and check only the first character */
++                      {       case 'p':       ;                                                               /* permanent, perm */
++                              case 'f':       ;                                                               /* forever */
++                              case 'i':       optp->duration=0;                               /* infinite, inf */
++                                                      break;
++                              case 'd':       optp->who=FWSAM_WHO_DST;                /* destination, dest, dst */
++                                                      break;
++                              case 's':       optp->who=FWSAM_WHO_SRC;                /* source, src */
++                                                      break;
++                              default:        possprob=TRUE;
++                      }
++                      while(*ap && *ap!=',' && *ap!='[')
++                              ap++;
++                      if(*ap=='[')
++                      {       ap++;           /* now we have the HOW */
++                              switch(*ap)
++                              {       case 'i':       ;                                                       /* in */
++                                      case 's':       optp->how=FWSAM_HOW_IN;         /* source, src */
++                                                              break;
++                                      case 'o':       ;                                                       /* out */
++                                      case 'd':       optp->how=FWSAM_HOW_OUT;        /* destination, dest, dst */
++                                                              break;
++                                      case 'b':       ;                                                       /* both */
++                                      case 'e':       optp->how=FWSAM_HOW_INOUT;      /* either */
++                                                              break;
++                                      case 't':       ;                                                       /* this */
++                                      case 'c':       optp->how=FWSAM_HOW_THIS;       /* connection, conn */
++                                                              break;
++                                      default:        possprob=TRUE;
++                              }
++                              while(*ap && *ap!=',')
++                                      ap++;
++                      }
++                      if(*ap==',')
++                      {       ap++;
++                              if(isdigit(*ap))  /* and figure out how long to block */
++                                      optp->duration=FWsamParseDuration(ap);
++                              else if(*ap=='p' || *ap=='f' || *ap=='i')
++                                      optp->duration=0;
++                              else
++                                      possprob=TRUE;
++                      }
++                      else if(!*ap)
++                              possprob=TRUE;
++              }
++      }
++      else
++              possprob=TRUE;
++
++      return possprob;
++}
++
++
++/*    This goes through the lines of sid-block.map and sets the
++ *    options for fwsam if the file is being used.
++*/
++void FWsamParseLine(FWsamOptions *optp,char *buf)
++{   char *ap;
++
++      ap=buf; /* start at the beginning of the argument */
++
++      while(*ap)
++      {       if(isspace(*ap))                /* normalize spaces (tabs into space, etc) */
++                      *ap=' ';
++              if(isupper(*ap))                /* and set to lower case */
++                      *ap=tolower(*ap);
++              ap++;
++      }
++      while((ap=strrchr(buf,' '))!=NULL)      /* remove spaces */
++              strcpy(ap,ap+1);
++
++      ap=buf;
++      if(*ap)
++      {       while(*ap && *ap!=':' && *ap!='|')
++                      ap++;
++              *ap++ =0;
++              while(*ap && (*ap==':' || *ap=='|'))
++                      ap++;
++
++              optp->sid=(unsigned long)atol(buf);
++
++              if(FWsamParseOption(optp,ap))
++                      LogMessage("WARNING %s (%d) => [Alert_FWsam](AlertFWamOptionInit) Possible option problem. Using %s[%s],%lu.\n",file_name,file_line,(optp->who==FWSAM_WHO_SRC)?"src":"dst",(optp->how==FWSAM_HOW_IN)?"in":((optp->how==FWSAM_HOW_OUT)?"out":"either"),optp->duration);
++      }
++      else
++              optp->sid=0;
++}
++
++
++
++/*
++ * Function: AlertFWsamOptionInit(char *data, OptTreeNode *otn, int protocol)
++ *
++ * Purpose: Parses each rule and sets the option flags in the tree.
++ *
++ * Arguments: args => ptr to argument string
++ *
++ * Returns: void function
++ *
++*/
++void AlertFWsamOptionInit(char *args,OptTreeNode *otn,int protocol)
++{
++    FWsamOptions *optp;
++      char *ap;
++
++
++#ifdef FWSAMDEBUG
++    LogMessage("DEBUG => [Alert_FWsam](AlertFWamOptionInit) FWsamOptionInit is parsing...\n");
++#endif
++
++    if((optp=(FWsamOptions *)malloc(sizeof(FWsamOptions)))==NULL)
++              FatalError("ERROR => [Alert_FWsam](AlertFWamOptionInit) malloc failed for opt!\n");
++
++
++      ap=args; /* start at the beginning of the argument */
++
++      while(*ap)
++      {       if(isspace(*ap))                /* normalize spaces (tabs into space, etc) */
++                      *ap=' ';
++              if(isupper(*ap))                /* and set to lower case */
++                      *ap=tolower(*ap);
++              ap++;
++      }
++      while((ap=strrchr(args,' '))!=NULL)     /* remove spaces */
++              strcpy(ap,ap+1);
++
++
++      if(FWsamParseOption(optp,args))
++              LogMessage("WARNING %s (%d) => [Alert_FWsam](AlertFWamOptionInit) Possible option problem. Using %s[%s],%lu.\n",file_name,file_line,(optp->who==FWSAM_WHO_SRC)?"src":"dst",(optp->how==FWSAM_HOW_IN)?"in":((optp->how==FWSAM_HOW_OUT)?"out":"either"),optp->duration);
++
++      otn->ds_list[PLUGIN_FWSAM]=(FWsamOptions *)optp;
++}
++
++
++/* Generates a new encryption key for TwoFish based on seq numbers and a random that
++ * the SnortSam agents send on checkin (in protocol)
++*/
++void FWsamNewStationKey(FWsamStation *station,FWsamPacket *packet)
++{
++    //unsigned char newkey[TwoFish_KEY_LENGTH+2];
++    char newkey[TwoFish_KEY_LENGTH+2];
++      int i;
++
++      newkey[0]=packet->snortseqno[0];                /* current snort seq # (which both know) */
++      newkey[1]=packet->snortseqno[1];
++      newkey[2]=packet->fwseqno[0];                   /* current SnortSam seq # (which both know) */
++      newkey[3]=packet->fwseqno[1];
++      newkey[4]=packet->protocol[0];          /* the random SnortSam chose */
++      newkey[5]=packet->protocol[1];
++
++      strncpy(newkey+6,station->stationkey,TwoFish_KEY_LENGTH-6); /* append old key */
++      newkey[TwoFish_KEY_LENGTH]=0;
++
++      newkey[0]^=station->mykeymod[0];                /* modify key with key modifiers which were */
++      newkey[1]^=station->mykeymod[1];                /* exchanged during the check-in handshake. */
++      newkey[2]^=station->mykeymod[2];
++      newkey[3]^=station->mykeymod[3];
++      newkey[4]^=station->fwkeymod[0];
++      newkey[5]^=station->fwkeymod[1];
++      newkey[6]^=station->fwkeymod[2];
++      newkey[7]^=station->fwkeymod[3];
++
++      for(i=0;i<=7;i++)
++              if(newkey[i]==0)
++                      newkey[i]++;
++
++      strcpy(station->stationkey,newkey);
++      TwoFishDestroy(station->stationfish);
++      station->stationfish=TwoFishInit(newkey);
++}
++
++
++/*    This routine will search the option list as defined
++ *    by the sid-block.map file and return a pointer
++ *    to the matching record.
++*/
++FWsamOptions *FWsamGetOption(unsigned long sid)
++{     signed long i,step,diff,o,o2;
++
++#ifdef FWSAM_FANCYFETCH       /* Fancy-fetch jumps in decreasing n/2 steps and takes much less lookups */
++      o=o2= -1;
++      i=step=FWsamMaxOptions>>1;
++      while(i>=0 && i<FWsamMaxOptions && i!=o2)
++      {       diff=sid-FWsamOptionField[i].sid;
++              if(!diff)
++                      return &(FWsamOptionField[i]);
++              if(step>1)
++                      step=step>>1;
++              o2=o;
++              o=i;
++              if(diff>0)
++                      i+=step;
++              else
++                      i-=step;
++      }
++#else                                         /* This is just a sequential list lookup */
++      for(i=0;i<FWsamMaxOptions;i++)
++              if(FWsamOptionField[i].sid==sid)
++                      return &(FWsamOptionField[i]);
++#endif
++      return NULL;
++}
++
++
++/****************************************************************************
++ *
++ * Function: AlertFWsam(Packet *, char *)
++ *
++ * Purpose: Send the current alert to a remote module on a FW-1 mgmt station
++ *
++ * Arguments: p => pointer to the packet data struct
++ *            msg => the message to print in the alert
++ *
++ * Returns: void function
++ *
++ ***************************************************************************/
++void AlertFWsam(Packet *p, char *msg, void *arg, Event *event)
++{     FWsamOptions *optp;
++      FWsamPacket sampacket;
++      FWsamStation *station=NULL;
++      FWsamList *fwsamlist;
++      SOCKET stationsocket;
++      int i,len,deletestation,stationtry=0;
++      //unsigned char *encbuf,*decbuf;
++    char *encbuf,*decbuf;
++      static unsigned long lastbsip[FWSAM_REPET_BLOCKS],lastbdip[FWSAM_REPET_BLOCKS],
++                                               lastbduration[FWSAM_REPET_BLOCKS],lastbtime[FWSAM_REPET_BLOCKS];
++      static unsigned short lastbsp[FWSAM_REPET_BLOCKS],lastbdp[FWSAM_REPET_BLOCKS],
++                                                lastbproto[FWSAM_REPET_BLOCKS],lastbpointer;
++      static unsigned char lastbmode[FWSAM_REPET_BLOCKS];
++      static unsigned long btime=0;
++
++
++      if(otn_tmp==NULL)
++    {
++#ifdef FWSAMDEBUG
++        LogMessage("DEBUG => [Alert_FWsam] NULL otn_tmp!\n");
++#endif
++        return;
++    }
++    if(p == NULL)
++    {
++#ifdef FWSAMDEBUG
++        LogMessage("DEBUG => [Alert_FWsam] NULL packet!\n");
++#endif
++        return;
++    }
++    if(arg == NULL)
++    {
++#ifdef FWSAMDEBUG
++        LogMessage("DEBUG => [Alert_FWsam] NULL arg!\n");
++#endif
++        return;
++    }
++
++    /* SnortSam does no IPv6 */
++    if (!IS_IP4(p)) {
++#ifdef FWSAMDEBUG
++        LogMessage("DEBUG => [Alert_FWsam] not acting on non-IP4 packet!\n");
++#endif
++        return;
++    }
++
++      optp=NULL;
++
++      if(FWsamOptionField)            /* If using the file (field present), let's use that */
++              optp=FWsamGetOption(event->sig_id);
++
++      if(!optp)                       /* If file not present, check if an fwsam option was defined on the triggering rule */
++              optp=otn_tmp->ds_list[PLUGIN_FWSAM];
++
++      if(optp)        /* if options specified for this rule */
++      {       if(!btime)                      /* if this is the first time this function is */
++              {       for(i=0;i<FWSAM_REPET_BLOCKS;i++)       /*  called, reset the time and protocol to 0. */
++                      {       lastbproto[i]=0;
++                              lastbtime[i]=0;
++                      }
++              }
++
++              fwsamlist=(FWsamList *)arg;
++
++#ifdef FWSAMDEBUG
++              LogMessage("DEBUG => [Alert_FWsam] Alert -> Msg=\"%s\"\n",msg);
++
++              LogMessage("DEBUG => [Alert_FWsam] Alert -> Option: %s[%s],%lu.\n",(optp->who==FWSAM_WHO_SRC)?"src":"dst",(optp->how==FWSAM_HOW_IN)?"in":((optp->how==FWSAM_HOW_OUT)?"out":"either"),optp->duration);
++#endif
++
++              len=TRUE;
++              btime=(unsigned long)time(NULL);        /* get current time */
++              /* This is a cheap check to see if the blocking request matches any of the previous requests. */
++              for(i=0;i<FWSAM_REPET_BLOCKS && len;i++)
++              {       if( ((optp->how==FWSAM_HOW_THIS)?       /* if blocking mode SERVICE, check for src and dst        */
++                              ( lastbsip[i]==p->iph->ip_src.s_addr && lastbdip[i]==p->iph->ip_dst.s_addr &&lastbproto[i]==p->iph->ip_proto &&
++                                ((p->iph->ip_proto==IPPROTO_TCP || p->iph->ip_proto==IPPROTO_UDP)? /* check port only of TCP or UDP */
++/*                                    ((optp->who==FWSAM_WHO_SRC)?(lastbsp[i]==p->sp):(lastbdp[i]==p->dp)):TRUE) ): */
++                                      lastbdp[i]==p->dp:TRUE) ):
++                              ((optp->who==FWSAM_WHO_SRC)?(lastbsip[i]==p->iph->ip_src.s_addr):(lastbdip[i]==p->iph->ip_dst.s_addr))) && /* otherwise if we block source, only compare source. Same for dest. */
++                              lastbduration[i]==optp->duration &&
++                              (lastbmode[i]&(FWSAM_HOW|FWSAM_WHO))==(optp->how|optp->who) &&
++                              (btime-lastbtime[i]<((optp->duration>FWSAM_REPET_TIME)?FWSAM_REPET_TIME:optp->duration)))
++                      {       len=FALSE;              /* If so, we don't need to block again. */
++                      }
++              }
++              if(len)
++              {       if(++lastbpointer>=FWSAM_REPET_BLOCKS)          /* increase repetitive check pointer */
++                              lastbpointer=0;
++                      lastbsip[lastbpointer]=p->iph->ip_src.s_addr;           /* and note packet details */
++                      lastbdip[lastbpointer]=p->iph->ip_dst.s_addr;
++                      lastbduration[lastbpointer]=optp->duration;
++                      lastbmode[lastbpointer]=optp->how|optp->who|optp->loglevel;
++                      lastbproto[lastbpointer]=p->iph->ip_proto;
++                      if(p->iph->ip_proto==IPPROTO_TCP || p->iph->ip_proto==IPPROTO_UDP)
++                      {       lastbsp[lastbpointer]=p->sp;                                    /* set ports if TCP or UDP */
++                              lastbdp[lastbpointer]=p->dp;
++                      }
++                      lastbtime[lastbpointer]=btime;
++
++
++                      while(fwsamlist!=NULL)
++                      {       station=fwsamlist->station;
++                              //if(station->stationip.s_addr)
++                              if(station->stationip.ip32[0])
++                              {       deletestation=FALSE;
++                                      stationtry++;                           /* first try */
++                                      /* create a socket for the station */
++                                      stationsocket=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
++                                      if(stationsocket==INVALID_SOCKET)
++                                              FatalError("ERROR => [Alert_FWsam] Funky socket error (socket)!\n");
++                                      if(bind(stationsocket,(struct sockaddr *)&(station->localsocketaddr),sizeof(struct sockaddr)))
++                                              FatalError("ERROR => [Alert_FWsam] Could not bind socket!\n");
++
++                                      /* let's connect to the agent */
++                                      if(connect(stationsocket,(struct sockaddr *)&station->stationsocketaddr,sizeof(struct sockaddr)))
++                                      {
++                                              LogMessage("WARNING => [Alert_FWsam] Could not send block to host %s. Will try later.\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++                                              closesocket(stationsocket);
++#else
++                                              close(stationsocket);
++#endif
++                                              stationtry=0;
++                                      }
++                                      else
++                                      {
++#ifdef FWSAMDEBUG
++                                              LogMessage("DEBUG => [Alert_FWsam] Connected to host %s.\n",sfip_ntoa(&station->stationip));
++#endif
++                                              /* now build the packet */
++                                              station->myseqno+=station->stationseqno; /* increase my seqno by adding agent seq no */
++                                              sampacket.endiancheck=1;                                                /* This is an endian indicator for Snortsam */
++                                              sampacket.snortseqno[0]=(char)station->myseqno;
++                                              sampacket.snortseqno[1]=(char)(station->myseqno>>8);
++                                              sampacket.fwseqno[0]=(char)station->stationseqno;/* fill station seqno */
++                                              sampacket.fwseqno[1]=(char)(station->stationseqno>>8);
++                                              sampacket.status=FWSAM_STATUS_BLOCK;                    /* set block mode */
++                                              sampacket.version=FWSAM_PACKETVERSION;                  /* set packet version */
++                                              sampacket.duration[0]=(char)optp->duration;             /* set duration */
++                                              sampacket.duration[1]=(char)(optp->duration>>8);
++                                              sampacket.duration[2]=(char)(optp->duration>>16);
++                                              sampacket.duration[3]=(char)(optp->duration>>24);
++                                              sampacket.fwmode=optp->how|optp->who|optp->loglevel; /* set the mode */
++                                              sampacket.dstip[0]=(char)p->iph->ip_dst.s_addr; /* destination IP */
++                                              sampacket.dstip[1]=(char)(p->iph->ip_dst.s_addr>>8);
++                                              sampacket.dstip[2]=(char)(p->iph->ip_dst.s_addr>>16);
++                                              sampacket.dstip[3]=(char)(p->iph->ip_dst.s_addr>>24);
++                                              sampacket.srcip[0]=(char)p->iph->ip_src.s_addr; /* source IP */
++                                              sampacket.srcip[1]=(char)(p->iph->ip_src.s_addr>>8);
++                                              sampacket.srcip[2]=(char)(p->iph->ip_src.s_addr>>16);
++                                              sampacket.srcip[3]=(char)(p->iph->ip_src.s_addr>>24);
++                                              sampacket.protocol[0]=(char)p->iph->ip_proto;   /* protocol */
++                                              sampacket.protocol[1]=(char)(p->iph->ip_proto>>8);/* protocol */
++
++                                              if(p->iph->ip_proto==IPPROTO_TCP || p->iph->ip_proto==IPPROTO_UDP)
++                                              {       sampacket.srcport[0]=(char)p->sp;       /* set ports */
++                                                      sampacket.srcport[1]=(char)(p->sp>>8);
++                                                      sampacket.dstport[0]=(char)p->dp;
++                                                      sampacket.dstport[1]=(char)(p->dp>>8);
++                                              }
++                                              else
++                                                      sampacket.srcport[0]=sampacket.srcport[1]=sampacket.dstport[0]=sampacket.dstport[1]=0;
++
++                                              sampacket.sig_id[0]=(char)event->sig_id;                /* set signature ID */
++                                              sampacket.sig_id[1]=(char)(event->sig_id>>8);
++                                              sampacket.sig_id[2]=(char)(event->sig_id>>16);
++                                              sampacket.sig_id[3]=(char)(event->sig_id>>24);
++
++#ifdef FWSAMDEBUG
++                                              LogMessage("DEBUG => [Alert_FWsam] Sending BLOCK\n");
++                                              LogMessage("DEBUG => [Alert_FWsam] Snort SeqNo:  %x\n",station->myseqno);
++                                              LogMessage("DEBUG => [Alert_FWsam] Mgmt SeqNo :  %x\n",station->stationseqno);
++                                              LogMessage("DEBUG => [Alert_FWsam] Status     :  %i\n",FWSAM_STATUS_BLOCK);
++                                              LogMessage("DEBUG => [Alert_FWsam] Mode       :  %i\n",optp->how|optp->who|optp->loglevel);
++                                              LogMessage("DEBUG => [Alert_FWsam] Duration   :  %li\n",optp->duration);
++                                              LogMessage("DEBUG => [Alert_FWsam] Protocol   :  %i\n",GET_IPH_PROTO(p));
++#ifdef SUP_IP6
++                                              LogMessage("DEBUG => [Alert_FWsam] Src IP     :  %s\n",sfip_ntoa(GET_SRC_IP(p)));
++                                              LogMessage("DEBUG => [Alert_FWsam] Dest IP    :  %s\n",sfip_ntoa(GET_DST_IP(p)));
++#else
++                                              LogMessage("DEBUG => [Alert_FWsam] Src IP     :  %s\n",inet_ntoa(p->iph->ip_src));
++                                              LogMessage("DEBUG => [Alert_FWsam] Dest IP    :  %s\n",inet_ntoa(p->iph->ip_dst));
++#endif
++                                              LogMessage("DEBUG => [Alert_FWsam] Src Port   :  %i\n",p->sp);
++                                              LogMessage("DEBUG => [Alert_FWsam] Dest Port  :  %i\n",p->dp);
++                                              LogMessage("DEBUG => [Alert_FWsam] Sig_ID     :  %lu\n",event->sig_id);
++
++#endif
++
++                                              encbuf=TwoFishAlloc(sizeof(FWsamPacket),FALSE,FALSE,station->stationfish); /* get the encryption buffer */
++                                              len=TwoFishEncrypt((char *)&sampacket,&encbuf,sizeof(FWsamPacket),FALSE,station->stationfish); /* encrypt the packet with current key */
++
++                                              if(send(stationsocket,encbuf,len,0)!=len) /* weird...could not send */
++                                              {       LogMessage("WARNING => [Alert_FWsam] Could not send to host %s. Will try again later.\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++                                                      closesocket(stationsocket);
++#else
++                                                      close(stationsocket);
++#endif
++                                                      stationtry=0;
++                                              }
++                                              else
++                                              {       i=FWSAM_NETWAIT;
++#ifdef WIN32
++                                                      ioctlsocket(stationsocket,FIONBIO,&i);  /* set non blocking and wait for  */
++#else
++                                                      ioctl(stationsocket,FIONBIO,&i);                /* set non blocking and wait for  */
++#endif
++                                                      while(i-- >1)                                                   /* the response packet   */
++                                                      {       waitms(10); /* wait for response (default maximum 3 secs */
++                                                              if(recv(stationsocket,encbuf,len,0)==len)
++                                                                      i=0; /* if we received packet we set the counter to 0. */
++                                                                               /* by the time we check with if, it's already dec'ed to -1 */
++                                                      }
++                                                      if(!i) /* id we timed out (i was one, then dec'ed)... */
++                                                      {       LogMessage("WARNING => [Alert_FWsam] Did not receive response from host %s. Will try again later.\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++                                                              closesocket(stationsocket);
++#else
++                                                              close(stationsocket);
++#endif
++                                                              stationtry=0;
++                                                      }
++                                                      else /* got a packet */
++                                                      {       decbuf=(char *)&sampacket; /* get the pointer to the packet struct */
++                                                              len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish); /* try to decrypt the packet with current key */
++
++                                                              if(len!=sizeof(FWsamPacket)) /* invalid decryption */
++                                                              {       strcpy(station->stationkey,station->initialkey); /* try the intial key */
++                                                                      TwoFishDestroy(station->stationfish);
++                                                                      station->stationfish=TwoFishInit(station->stationkey); /* re-initialize the TwoFish with the intial key */
++                                                                      len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish); /* try again to decrypt */
++                                                                      LogMessage("INFO => [Alert_FWsam] Had to use initial key!\n");
++                                                              }
++                                                              if(len==sizeof(FWsamPacket)) /* valid decryption */
++                                                              {       if(sampacket.version==FWSAM_PACKETVERSION)/* master speaks my language */
++                                                                      {       if(sampacket.status==FWSAM_STATUS_OK || sampacket.status==FWSAM_STATUS_NEWKEY
++                                                                              || sampacket.status==FWSAM_STATUS_RESYNC || sampacket.status==FWSAM_STATUS_HOLD)
++                                                                              {       station->stationseqno=sampacket.fwseqno[0] | (sampacket.fwseqno[1]<<8); /* get stations seqno */
++                                                                                      station->lastcontact=(unsigned long)time(NULL); /* set the last contact time (not used yet) */
++#ifdef FWSAMDEBUG
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Received %s\n",sampacket.status==FWSAM_STATUS_OK?"OK":
++                                                                                                                                                 sampacket.status==FWSAM_STATUS_NEWKEY?"NEWKEY":
++                                                                                                                                                 sampacket.status==FWSAM_STATUS_RESYNC?"RESYNC":
++                                                                                                                                                 sampacket.status==FWSAM_STATUS_HOLD?"HOLD":"ERROR");
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Snort SeqNo:  %x\n",sampacket.snortseqno[0]|(sampacket.snortseqno[1]<<8));
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Mgmt SeqNo :  %x\n",station->stationseqno);
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Status     :  %i\n",sampacket.status);
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Version    :  %i\n",sampacket.version);
++#endif
++                                                                                      if(sampacket.status==FWSAM_STATUS_HOLD)
++                                                                                      {       i=FWSAM_NETHOLD;                        /* Stay on hold for a maximum of 60 secs (default) */
++                                                                                              while(i-- >1)                                                   /* the response packet   */
++                                                                                              {       waitms(10); /* wait for response  */
++                                                                                                      if(recv(stationsocket,encbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,0)==sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE)
++                                                                                                        i=0; /* if we received packet we set the counter to 0. */
++                                                                                              }
++                                                                                              if(!i) /* id we timed out (i was one, then dec'ed)... */
++                                                                                              {       LogMessage("WARNING => [Alert_FWsam] Did not receive response from host %s. Will try again later.\n",sfip_ntoa(&station->stationip));
++                                                                                                      stationtry=0;
++                                                                                                      sampacket.status=FWSAM_STATUS_ERROR;
++                                                                                              }
++                                                                                              else /* got a packet */
++                                                                                              {       decbuf=(char *)&sampacket; /* get the pointer to the packet struct */
++                                                                                                      len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish); /* try to decrypt the packet with current key */
++
++                                                                                                      if(len!=sizeof(FWsamPacket)) /* invalid decryption */
++                                                                                                      {       strcpy(station->stationkey,station->initialkey); /* try the intial key */
++                                                                                                              TwoFishDestroy(station->stationfish);
++                                                                                                              station->stationfish=TwoFishInit(station->stationkey); /* re-initialize the TwoFish with the intial key */
++                                                                                                              len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish); /* try again to decrypt */
++                                                                                                              LogMessage("INFO => [Alert_FWsam] Had to use initial key again!\n");
++                                                                                                      }
++#ifdef FWSAMDEBUG
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Received %s\n",sampacket.status==FWSAM_STATUS_OK?"OK":
++                                                                                                                                                 sampacket.status==FWSAM_STATUS_NEWKEY?"NEWKEY":
++                                                                                                                                                 sampacket.status==FWSAM_STATUS_RESYNC?"RESYNC":
++                                                                                                                                                 sampacket.status==FWSAM_STATUS_HOLD?"HOLD":"ERROR");
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Snort SeqNo:  %x\n",sampacket.snortseqno[0]|(sampacket.snortseqno[1]<<8));
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Mgmt SeqNo :  %x\n",station->stationseqno);
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Status     :  %i\n",sampacket.status);
++                                                                      LogMessage("DEBUG => [Alert_FWsam] Version    :  %i\n",sampacket.version);
++#endif
++                                                                                                      if(len!=sizeof(FWsamPacket)) /* invalid decryption */
++                                                                                                      {       ErrorMessage("ERROR => [Alert_FWsam] Password mismatch! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                                                                                              deletestation=TRUE;
++                                                                                                              sampacket.status=FWSAM_STATUS_ERROR;
++                                                                                                      }
++                                                                                                      else if(sampacket.version!=FWSAM_PACKETVERSION) /* invalid protocol version */
++                                                                                                      {       ErrorMessage("ERROR => [Alert_FWsam] Protocol version error! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                                                                                              deletestation=TRUE;
++                                                                                                              sampacket.status=FWSAM_STATUS_ERROR;
++                                                                                                      }
++                                                                                                      else if(sampacket.status!=FWSAM_STATUS_OK && sampacket.status!=FWSAM_STATUS_NEWKEY && sampacket.status!=FWSAM_STATUS_RESYNC)
++                                                                                                      {       ErrorMessage("ERROR => [Alert_FWsam] Funky handshake error! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                                                                                              deletestation=TRUE;
++                                                                                                              sampacket.status=FWSAM_STATUS_ERROR;
++                                                                                                      }
++                                                                                              }
++                                                                                      }
++                                                                                      if(sampacket.status==FWSAM_STATUS_RESYNC)  /* if station want's to resync... */
++                                                                                      {       strcpy(station->stationkey,station->initialkey); /* ...we use the intial key... */
++                                                                                              memcpy(station->fwkeymod,sampacket.duration,4);  /* and note the random key modifier */
++                                                                                      }
++                                                                                      if(sampacket.status==FWSAM_STATUS_NEWKEY || sampacket.status==FWSAM_STATUS_RESYNC)
++                                                                                      {
++                                                                                              FWsamNewStationKey(station,&sampacket); /* generate new TwoFish keys */
++#ifdef FWSAMDEBUG
++                                                                                                      LogMessage("DEBUG => [Alert_FWsam] Generated new encryption key...\n");
++#endif
++                                                                                      }
++#ifdef WIN32
++                                                                                      closesocket(stationsocket);
++#else
++                                                                                      close(stationsocket);
++#endif
++                                                                                      stationtry=0;
++                                                                              }
++                                                                              else if(sampacket.status==FWSAM_STATUS_ERROR) /* if SnortSam reports an error on second try, */
++                                                                              {
++#ifdef WIN32
++                                                                                      closesocket(stationsocket);                               /* something is messed up and ... */
++#else
++                                                                                      close(stationsocket);
++#endif
++                                                                                      if(stationtry>1)                                                  /* we ignore that station. */
++                                                                                      {       deletestation=TRUE;                                       /* flag for deletion */
++                                                                                              ErrorMessage("ERROR => [Alert_FWsam] Could not renegotiate key! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                                                                      }
++                                                                                      else                                                    /* if we get an error on the first try, */
++                                                                                      {       if(!FWsamCheckIn(station))      /* we first try to check in again. */
++                                                                                              {       deletestation=TRUE;
++                                                                                                      ErrorMessage("ERROR => [Alert_FWsam] Password mismatch! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                                                                              }
++                                                                                      }
++                                                                              }
++                                                                              else /* an unknown status means trouble... */
++                                                                              {       ErrorMessage("ERROR => [Alert_FWsam] Funky handshake error! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++                                                                                      closesocket(stationsocket);
++#else
++                                                                                      close(stationsocket);
++#endif
++                                                                                      deletestation=TRUE;
++                                                                              }
++                                                                      }
++                                                                      else   /* if the SnortSam agent uses a different packet version, we have no choice but to ignore it. */
++                                                                      {       ErrorMessage("ERROR => [Alert_FWsam] Protocol version error! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++                                                                              closesocket(stationsocket);
++#else
++                                                                              close(stationsocket);
++#endif
++                                                                              deletestation=TRUE;
++                                                                      }
++                                                              }
++                                                              else /* if the intial key failed to decrypt as well, the keys are not configured the same, and we ignore that SnortSam station. */
++                                                              {       ErrorMessage("ERROR => [Alert_FWsam] Password mismatch! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++                                                                      closesocket(stationsocket);
++#else
++                                                                      close(stationsocket);
++#endif
++                                                                      deletestation=TRUE;
++                                                              }
++                                                      }
++                                              }
++                                              free(encbuf); /* release of the TwoFishAlloc'ed encryption buffer */
++                                      }
++                                      if(stationtry==0 || deletestation)              /* if everything went real well, or real bad... */
++                                      {       if(deletestation){                                      /* If it went bad, we remove the station from the list by marking the IP */
++//                                                    station->stationip.s_addr=0;
++                                                      station->stationip.ip32[0]=0;
++                                                }
++                                              fwsamlist=fwsamlist->next;
++                                      }
++                              }
++                              else
++                                      fwsamlist=fwsamlist->next;
++                      }
++              }
++              else
++              {
++#ifdef FWSAMDEBUG
++                      LogMessage("DEBUG => [Alert_FWsam] Skipping repetitive block.\n");
++#endif
++              }
++      }
++}
++
++/*  FWsamCheckOut will be called when Snort exists. It de-registeres this snort sensor
++ *  from the list of sensor that the SnortSam agent keeps.
++ */
++void FWsamCheckOut(FWsamStation *station)
++{     FWsamPacket sampacket;
++      SOCKET stationsocket;
++      int i,len;
++    char *encbuf,*decbuf;
++      //unsigned char *encbuf,*decbuf;
++
++
++      stationsocket=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
++      if(stationsocket==INVALID_SOCKET)
++              FatalError("ERROR => [Alert_FWsam](FWsamCheckOut) Funky socket error (socket)!\n");
++      if(bind(stationsocket,(struct sockaddr *)&(station->localsocketaddr),sizeof(struct sockaddr)))
++              FatalError("ERROR => [Alert_FWsam](FWsamCheckOut) Could not bind socket!\n");
++
++      /* let's connect to the agent */
++      if(!connect(stationsocket,(struct sockaddr *)&station->stationsocketaddr,sizeof(struct sockaddr)))
++      {       LogMessage("INFO => [Alert_FWsam](FWsamCheckOut) Disconnecting from host %s.\n",sfip_ntoa(&station->stationip));
++              /* now build the packet */
++              station->myseqno+=station->stationseqno; /* increase my seqno */
++              sampacket.endiancheck=1;
++              sampacket.snortseqno[0]=(char)station->myseqno;
++              sampacket.snortseqno[1]=(char)(station->myseqno>>8);
++              sampacket.fwseqno[0]=(char)station->stationseqno; /* fill station seqno */
++              sampacket.fwseqno[1]=(char)(station->stationseqno>>8);
++              sampacket.status=FWSAM_STATUS_CHECKOUT;  /* checking out... */
++              sampacket.version=FWSAM_PACKETVERSION;
++
++#ifdef FWSAMDEBUG
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckOut) Sending CHECKOUT\n");
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckOut) Snort SeqNo:  %x\n",station->myseqno);
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckOut) Mgmt SeqNo :  %x\n",station->stationseqno);
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckOut) Status     :  %i\n",sampacket.status);
++
++#endif
++
++              encbuf=TwoFishAlloc(sizeof(FWsamPacket),FALSE,FALSE,station->stationfish); /* get encryption buffer */
++              len=TwoFishEncrypt((char *)&sampacket,&encbuf,sizeof(FWsamPacket),FALSE,station->stationfish); /* encrypt packet with current key */
++
++              if(send(stationsocket,encbuf,len,0)==len)
++              {       i=FWSAM_NETWAIT;
++#ifdef WIN32
++                      ioctlsocket(stationsocket,FIONBIO,&i);  /* set non blocking and wait for  */
++#else
++                      ioctl(stationsocket,FIONBIO,&i);                /* set non blocking and wait for  */
++#endif
++                      while(i-- >1)
++                      {       waitms(10);                                     /* ...wait a maximum of 3 secs for response... */
++                              if(recv(stationsocket,encbuf,len,0)==len) /* ... for the status packet */
++                                      i=0;
++                      }
++                      if(i) /* if we got the packet */
++                      {       decbuf=(char *)&sampacket;
++                              len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish);
++
++                              if(len!=sizeof(FWsamPacket)) /* invalid decryption */
++                              {       strcpy(station->stationkey,station->initialkey); /* try initial key */
++                                      TwoFishDestroy(station->stationfish);                    /* toss this fish */
++                                      station->stationfish=TwoFishInit(station->stationkey); /* re-initialze TwoFish with initial key */
++                                      len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish); /* and try to decrypt again */
++                                      LogMessage("INFO => [Alert_FWsam](FWsamCheckOut) Had to use initial key!\n");
++                              }
++                              if(len==sizeof(FWsamPacket)) /* valid decryption */
++                              {       if(sampacket.version!=FWSAM_PACKETVERSION) /* but don't really care since we are on the way out */
++                                              ErrorMessage("WARNING => [Alert_FWsam](FWsamCheckOut) Protocol version error! What the hell, we're quitting anyway! :)\n");
++                              }
++                              else
++                                      ErrorMessage("WARNING => [Alert_FWsam](FWsamCheckOut) Password mismatch! What the hell, we're quitting anyway! :)\n");
++                      }
++              }
++              free(encbuf); /* release TwoFishAlloc'ed buffer */
++      }
++      else
++              LogMessage("WARNING => [Alert_FWsam] Could not connect to host %s for CheckOut. What the hell, we're quitting anyway! :)\n",sfip_ntoa(&station->stationip));
++#ifdef WIN32
++      closesocket(stationsocket);
++#else
++      close(stationsocket);
++#endif
++}
++
++
++/*   FWSamFree: Disconnects all FW-1 management stations,
++ *   closes sockets, and frees the structures.
++ */
++void FWsamFree(FWsamList *list)
++{
++    FWsamList *next;
++
++    while(list)       /* Free pointer list for rule type */
++    {
++        next=list->next;
++        free(list);
++        list=next;
++    }
++    list=FWsamStationList;
++
++    while(list) /* Free global pointer list and stations */
++    {
++        next=list->next;
++        if (list->station)
++        {
++            if(list->station->stationip.ip32[0])
++            //if(list->station->stationip.s_addr)
++                FWsamCheckOut(list->station); /* Send a Check-Out to SnortSam, */
++
++            TwoFishDestroy(list->station->stationfish);       /* toss the fish, */
++            free(list->station); /* free station, */
++        }
++        free(list); /* free pointer, */
++        list=next; /* and move to next. */
++    }
++    FWsamStationList=NULL;
++    if(FWsamOptionField)
++        free(FWsamOptionField);
++}
++
++void AlertFWsamCleanExitFunc(int signal, void *arg)
++{     FWsamList *fwsamlist;
++
++#ifdef FWSAMDEBUG
++    LogMessage("DEBUG => [Alert_FWsam](AlertFWsamCleanExitFunc) Exiting...\n");
++#endif
++
++      fwsamlist=(FWsamList *)arg;
++      FWsamFree(fwsamlist); /* Free all elements */
++}
++
++void AlertFWsamRestartFunc(int signal, void *arg)
++{     FWsamList *fwsamlist;
++
++#ifdef FWSAMDEBUG
++    LogMessage("DEBUG => [Alert_FWsam](AlertFWsamRestartFunc) Restarting...\n");
++#endif
++
++      fwsamlist=(FWsamList *)arg;
++      FWsamFree(fwsamlist); /* Free all elements */
++}
++
++/*  This routine registers this Snort sensor with SnortSam.
++ *  It will also change the encryption key based on some variables.
++ */
++int FWsamCheckIn(FWsamStation *station)
++{     int i,len,stationok=TRUE;
++      FWsamPacket sampacket;
++    char *encbuf,*decbuf;
++      //unsigned char *encbuf,*decbuf;
++      SOCKET stationsocket;
++
++
++      /* create a socket for the station */
++      stationsocket=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
++      if(stationsocket==INVALID_SOCKET)
++              FatalError("ERROR => [Alert_FWsam](FWsamCheckIn) Funky socket error (socket)!\n");
++      if(bind(stationsocket,(struct sockaddr *)&(station->localsocketaddr),sizeof(struct sockaddr)))
++              FatalError("ERROR => [Alert_FWsam](FWsamCheckIn) Could not bind socket!\n");
++
++      i=TRUE;
++      /* let's connect to the agent */
++      if(connect(stationsocket,(struct sockaddr *)&station->stationsocketaddr,sizeof(struct sockaddr)))
++              LogMessage("WARNING => [Alert_FWsam](FWsamCheckIn) Could not connect to host %s. Will try later.\n",sfip_ntoa(&station->stationip));
++      else
++      {       LogMessage("INFO => [Alert_FWsam](FWsamCheckIn) Connected to host %s.\n",sfip_ntoa(&station->stationip));
++              /* now build the packet */
++              sampacket.endiancheck=1;
++              sampacket.snortseqno[0]=(char)station->myseqno; /* fill my sequence number number */
++              sampacket.snortseqno[1]=(char)(station->myseqno>>8); /* fill my sequence number number */
++              sampacket.status=FWSAM_STATUS_CHECKIN; /* let's check in */
++              sampacket.version=FWSAM_PACKETVERSION; /* set the packet version */
++              memcpy(sampacket.duration,station->mykeymod,4);  /* we'll send SnortSam our key modifier in the duration slot */
++                                                                                         /* (the checkin packet is just the plain initial key) */
++#ifdef FWSAMDEBUG
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Sending CheckIn\n");
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Snort SeqNo:  %x\n",station->myseqno);
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Mode       :  %i\n",sampacket.status);
++                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Version    :  %i\n",sampacket.version);
++#endif
++              encbuf=TwoFishAlloc(sizeof(FWsamPacket),FALSE,FALSE,station->stationfish); /* get buffer for encryption */
++              len=TwoFishEncrypt((char *)&sampacket,&encbuf,sizeof(FWsamPacket),FALSE,station->stationfish); /* encrypt with initial key */
++              if(send(stationsocket,encbuf,len,0)!=len) /* weird...could not send */
++                      LogMessage("WARNING => [Alert_FWsam](FWsamCheckIn) Could not send to host %s. Will try again later.\n",sfip_ntoa(&station->stationip));
++              else
++              {       i=FWSAM_NETWAIT;
++#ifdef WIN32
++                      ioctlsocket(stationsocket,FIONBIO,&i);  /* set non blocking and wait for  */
++#else
++                      ioctl(stationsocket,FIONBIO,&i);                /* set non blocking and wait for  */
++#endif
++                      while(i-- >1)
++                      {       waitms(10); /* wait a maximum of 3 secs for response */
++                              if(recv(stationsocket,encbuf,len,0)==len)
++                                      i=0;
++                      }
++                      if(!i) /* time up? */
++                              LogMessage("WARNING => [Alert_FWsam](FWsamCheckIn) Did not receive response from host %s. Will try again later.\n",sfip_ntoa(&station->stationip));
++                      else
++                      {       decbuf=(char *)&sampacket; /* got status packet */
++                              len=TwoFishDecrypt(encbuf,&decbuf,sizeof(FWsamPacket)+TwoFish_BLOCK_SIZE,FALSE,station->stationfish); /* try to decrypt with initial key */
++                              if(len==sizeof(FWsamPacket)) /* valid decryption */
++                              {
++#ifdef FWSAMDEBUG
++                                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Received %s\n",sampacket.status==FWSAM_STATUS_OK?"OK":
++                                                                                                                         sampacket.status==FWSAM_STATUS_NEWKEY?"NEWKEY":
++                                                                                                                         sampacket.status==FWSAM_STATUS_RESYNC?"RESYNC":
++                                                                                                                         sampacket.status==FWSAM_STATUS_HOLD?"HOLD":"ERROR");
++                                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Snort SeqNo:  %x\n",sampacket.snortseqno[0]|(sampacket.snortseqno[1]<<8));
++                                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Mgmt SeqNo :  %x\n",sampacket.fwseqno[0]|(sampacket.fwseqno[1]<<8));
++                                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Status     :  %i\n",sampacket.status);
++                                      LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Version    :  %i\n",sampacket.version);
++#endif
++                                      if(sampacket.version==FWSAM_PACKETVERSION) /* master speaks my language */
++                                      {       if(sampacket.status==FWSAM_STATUS_OK || sampacket.status==FWSAM_STATUS_NEWKEY || sampacket.status==FWSAM_STATUS_RESYNC)
++                                              {       station->stationseqno=sampacket.fwseqno[0]|(sampacket.fwseqno[1]<<8); /* get stations seqno */
++                                                      station->lastcontact=(unsigned long)time(NULL);
++
++                                                      if(sampacket.status==FWSAM_STATUS_NEWKEY || sampacket.status==FWSAM_STATUS_RESYNC)      /* generate new keys */
++                                                      {       memcpy(station->fwkeymod,sampacket.duration,4); /* note the key modifier */
++                                                              FWsamNewStationKey(station,&sampacket); /* and generate new TwoFish keys (with key modifiers) */
++#ifdef FWSAMDEBUG
++                              LogMessage("DEBUG => [Alert_FWsam](FWsamCheckIn) Generated new encryption key...\n");
++#endif
++                                                      }
++                                              }
++                                              else /* weird, got a strange status back */
++                                              {       ErrorMessage("ERROR => [Alert_FWsam](FWsamCheckIn) Funky handshake error! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                                      stationok=FALSE;
++                                              }
++                                      }
++                                      else /* packet version does not match */
++                                      {       ErrorMessage("ERROR =>[Alert_FWsam](FWsamCheckIn) Protocol version error! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                              stationok=FALSE;
++                                      }
++                              }
++                              else /* key does not match */
++                              {       ErrorMessage("ERROR => [Alert_FWsam](FWsamCheckIn) Password mismatch! Ignoring host %s.\n",sfip_ntoa(&station->stationip));
++                                      stationok=FALSE;
++                              }
++                      }
++              }
++              free(encbuf); /* release TwoFishAlloc'ed buffer */
++      }
++#ifdef WIN32
++      closesocket(stationsocket);
++#else
++      close(stationsocket);
++#endif
++      return stationok;
++}
++#undef FWSAMDEBUG
++
+diff -ruN snort-2.9.2.2/src/output-plugins/spo_alert_fwsam.h snort-2.9.2.2_bkup/src/output-plugins/spo_alert_fwsam.h
+--- snort-2.9.2.2/src/output-plugins/spo_alert_fwsam.h 1969-12-31 16:00:00.000000000 -0800
++++ snort-2.9.2.2_bkup/src/output-plugins/spo_alert_fwsam.h    2012-04-08 20:34:57.389687124 -0700
+@@ -0,0 +1,216 @@
++/* $Id: snortpatchb,v 1.5 2005/10/06 08:50:39 fknobbe Exp $
++**
++** spo_alert_fwsam.h
++**
++** Copyright (c) 2001-2004 Frank Knobbe <frank@knobbe.us>
++**
++** This program is free software; you can redistribute it and/or modify
++** it under the terms of the GNU General Public License as published by
++** the Free Software Foundation; either version 2 of the License, or
++** (at your option) any later version.
++**
++** This program is distributed in the hope that it will be useful,
++** but WITHOUT ANY WARRANTY; without even the implied warranty of
++** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++** GNU General Public License for more details.
++**
++** You should have received a copy of the GNU General Public License
++** along with this program; if not, write to the Free Software
++** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++*/
++
++/* This file gets included in plugbase.c when it is integrated into the rest
++ * of the program.
++ *
++ * For more info, see the beginning of spo_alert_fwsam.c
++ *
++ */
++
++#ifndef __SPO_FWSAM_H__
++#define __SPO_FWSAM_H__
++
++#include "snort.h"
++#include "rules.h"
++#include "plugbase.h"
++#include "plugin_enum.h"
++#include "fatal.h"
++#include "util.h"
++#include "twofish.h"
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <time.h>
++#include <string.h>
++#include <ctype.h>
++#include <unistd.h>
++
++
++/* just some compatibility stuff */
++#ifdef WIN32
++#if !defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
++#include <winsock.h>
++#endif
++#define       waitms(x)                               Sleep(x)
++
++#else
++
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++#include <sys/ioctl.h>
++#include <netdb.h>
++
++#ifdef SOLARIS
++#include <sys/filio.h>
++#endif
++
++typedef int SOCKET;
++
++#ifndef INVALID_SOCKET
++#define INVALID_SOCKET        -1
++#endif
++
++#define       waitms(x)                               usleep((x)*1000)
++
++#endif
++
++#ifndef       FALSE
++#define FALSE 0
++#endif
++#ifndef       TRUE
++#define       TRUE    !FALSE
++#endif
++#ifndef       bool
++#define       bool    int
++#endif
++
++
++#if defined(_DEBUG) || defined(DEBUG)
++#ifndef FWSAMDEBUG
++#define FWSAMDEBUG
++#endif
++#else
++#endif
++
++
++/* Official Snort PlugIn Number has been moved into plugin_enum.h */
++
++
++/* fixed defines */
++
++#define FWSAM_DEFAULTPORT             898     /* Default port if user does not specify one in snort.conf */
++                                                                      /* (Was unused last time I checked...) */
++#define FWSAM_PACKETVERSION           14      /* version of the packet. Will increase with enhancements. */
++
++#define FWSAM_STATUS_CHECKIN  1       /* snort to fw */
++#define FWSAM_STATUS_CHECKOUT 2
++#define FWSAM_STATUS_BLOCK            3
++#define FWSAM_STATUS_UNBLOCK  9
++
++#define FWSAM_STATUS_OK                       4       /* fw to snort */
++#define FWSAM_STATUS_ERROR            5
++#define FWSAM_STATUS_NEWKEY           6
++#define FWSAM_STATUS_RESYNC           7
++#define FWSAM_STATUS_HOLD             8
++
++#define FWSAM_LOG_NONE                        0
++#define FWSAM_LOG_SHORTLOG            1
++#define FWSAM_LOG_SHORTALERT  2
++#define FWSAM_LOG_LONGLOG             3
++#define FWSAM_LOG_LONGALERT           4
++#define FWSAM_LOG                             (FWSAM_LOG_SHORTLOG|FWSAM_LOG_SHORTALERT|FWSAM_LOG_LONGLOG|FWSAM_LOG_LONGALERT)
++#define       FWSAM_WHO_DST                   8
++#define FWSAM_WHO_SRC                 16
++#define FWSAM_WHO                             (FWSAM_WHO_DST|FWSAM_WHO_SRC)
++#define FWSAM_HOW_IN                  32
++#define FWSAM_HOW_OUT                 64
++#define FWSAM_HOW_INOUT                       (FWSAM_HOW_IN|FWSAM_HOW_OUT)
++#define FWSAM_HOW_THIS                        128
++#define FWSAM_HOW                             (FWSAM_HOW_IN|FWSAM_HOW_OUT|FWSAM_HOW_THIS)
++
++
++/* user adjustable defines */
++
++#define FWSAM_REPET_BLOCKS            10      /* Snort remembers this amount of last blocks and... */
++#define FWSAM_REPET_TIME              20      /* ...checks if they fall within this time. If so,... */
++                                                                      /* ...the blocking request is not send. */
++
++#define FWSAM_NETWAIT                 300             /* 100th of a second. 3 sec timeout for network connections */
++#define FWSAM_NETHOLD                 6000    /* 100th of a second. 60 sec timeout for holding */
++
++#define SID_MAPFILE                           "sid-block.map"
++#define SID_ALT_MAPFILE                       "sid-fwsam.map"
++
++#define FWSAM_FANCYFETCH        /* This will invoke a fast sid lookup routine */
++
++
++/* vars */
++
++typedef struct _FWsamstation          /* structure of a mgmt station */
++{     unsigned short          myseqno;
++      unsigned short          stationseqno;
++      unsigned char           mykeymod[4];
++      unsigned char           fwkeymod[4];
++      unsigned short          stationport;
++      //struct in_addr                stationip;
++      sfip_t                  stationip;
++      struct sockaddr_in      localsocketaddr;
++      struct sockaddr_in      stationsocketaddr;
++      TWOFISH                 *stationfish;
++      char                    initialkey[TwoFish_KEY_LENGTH+2];
++      char                    stationkey[TwoFish_KEY_LENGTH+2];
++      time_t                  lastcontact;
++/*    time_t                  sleepstart; */
++}     FWsamStation;
++
++typedef struct _FWsampacket                   /* 2 blocks (3rd block is header from TwoFish) */
++{     unsigned short          endiancheck;    /* 0  */
++      unsigned char           srcip[4];               /* 2  */
++      unsigned char           dstip[4];               /* 6  */
++      unsigned char           duration[4];    /* 10 */
++      unsigned char           snortseqno[2];  /* 14 */
++      unsigned char           fwseqno[2];             /* 16 */
++      unsigned char           srcport[2];             /* 18 */
++      unsigned char           dstport[2];             /* 20 */
++      unsigned char           protocol[2];    /* 22 */
++      unsigned char           fwmode;                 /* 24 */
++      unsigned char           version;                /* 25 */
++      unsigned char           status;                 /* 26 */
++      unsigned char           sig_id[4];              /* 27 */
++      unsigned char           fluff;                  /* 31 */
++}     FWsamPacket;                                            /* 32 bytes in size */
++
++typedef struct _FWsamoptions  /* snort rule options */
++{     unsigned long   sid;
++    unsigned long     duration;
++      unsigned char   who;
++      unsigned char   how;
++      unsigned char   loglevel;
++}     FWsamOptions;
++
++typedef struct _FWsamlistpointer
++{     FWsamStation *station;
++      struct _FWsamlistpointer *next;
++}     FWsamList;
++
++
++/* functions */
++void AlertFWsamSetup(void);
++void AlertFWsamInit(char *args);
++void AlertFWsamOptionInit(char *args,OptTreeNode *otn,int protocol);
++void AlertFWsamCleanExitFunc(int signal, void *arg);
++void AlertFWsamRestartFunc(int signal, void *arg);
++void AlertFWsam(Packet *p, char *msg, void *arg, Event *event);
++int FWsamCheckIn(FWsamStation *station);
++void FWsamCheckOut(FWsamStation *station);
++void FWsamNewStationKey(FWsamStation *station,FWsamPacket *packet);
++void FWsamFixPacketEndian(FWsamPacket *p);
++unsigned long FWsamParseDuration(char *p);
++void FWsamFree(FWsamList *fwsamlist);
++int FWsamStationExists(FWsamStation *who,FWsamList *list);
++int FWsamReadLine(char *,unsigned long,FILE *);
++void FWsamParseLine(FWsamOptions *,char *);
++FWsamOptions *FWsamGetOption(unsigned long);
++int FWsamParseOption(FWsamOptions *,char *);
++
++#endif  /* __SPO_FWSAM_H__ */
+diff -ruN snort-2.9.2.2/src/plugbase.c snort-2.9.2.2_bkup/src/plugbase.c
+--- snort-2.9.2.2/src/plugbase.c       2012-03-17 14:40:16.000000000 -0700
++++ snort-2.9.2.2_bkup/src/plugbase.c  2012-04-08 20:34:57.389687124 -0700
+@@ -130,6 +130,7 @@
+ #endif
+ #include "output-plugins/spo_alert_test.h"
++#include "output-plugins/spo_alert_fwsam.h"
+ extern ListHead *head_tmp;
+ extern PreprocConfigFuncNode *preproc_config_funcs;
+@@ -1520,6 +1521,7 @@
+ #endif
+     AlertTestSetup();
++    AlertFWsamSetup();
+ }
+ /****************************************************************************
+diff -ruN snort-2.9.2.2/src/plugin_enum.h snort-2.9.2.2_bkup/src/plugin_enum.h
+--- snort-2.9.2.2/src/plugin_enum.h    2012-01-12 14:11:40.000000000 -0800
++++ snort-2.9.2.2_bkup/src/plugin_enum.h       2012-04-08 20:34:57.389687124 -0700
+@@ -60,6 +60,7 @@
+     PLUGIN_URILEN_CHECK,
+     PLUGIN_DYNAMIC,
+     PLUGIN_FLOWBIT,
++    PLUGIN_FWSAM,
+     PLUGIN_FILE_DATA,
+     PLUGIN_BASE64_DECODE,
+     PLUGIN_MAX  /* sentinel value */
+diff -ruN snort-2.9.2.2/src/twofish.c snort-2.9.2.2_bkup/src/twofish.c
+--- snort-2.9.2.2/src/twofish.c        1969-12-31 16:00:00.000000000 -0800
++++ snort-2.9.2.2_bkup/src/twofish.c   2012-04-08 20:34:57.389687124 -0700
+@@ -0,0 +1,971 @@
++/* $Id: twofish.c,v 2.1 2008/12/15 20:36:05 fknobbe Exp $
++ *
++ *
++ * Copyright (C) 1997-2000 The Cryptix Foundation Limited.
++ * Copyright (C) 2000 Farm9.
++ * Copyright (C) 2001 Frank Knobbe.
++ * All rights reserved.
++ *
++ * For Cryptix code:
++ * Use, modification, copying and distribution of this software is subject
++ * the terms and conditions of the Cryptix General Licence. You should have
++ * received a copy of the Cryptix General Licence along with this library;
++ * if not, you can download a copy from http://www.cryptix.org/ .
++ *
++ * For Farm9:
++ * ---  jojo@farm9.com, August 2000, converted from Java to C++, added CBC mode and
++ *      ciphertext stealing technique, added AsciiTwofish class for easy encryption
++ *      decryption of text strings
++ *
++ * Frank Knobbe <frank@knobbe.us>:
++ * ---  April 2001, converted from C++ to C, prefixed global variables
++ *      with TwoFish, substituted some defines, changed functions to make use of
++ *      variables supplied in a struct, modified and added routines for modular calls.
++ *      Cleaned up the code so that defines are used instead of fixed 16's and 32's.
++ *      Created two general purpose crypt routines for one block and multiple block
++ *      encryption using Joh's CBC code.
++ *            Added crypt routines that use a header (with a magic and data length).
++ *            (Basically a major rewrite).
++ *
++ *      Note: Routines labeled _TwoFish are private and should not be used
++ *      (or with extreme caution).
++ *
++ */
++
++#ifndef __TWOFISH_LIBRARY_SOURCE__
++#define __TWOFISH_LIBRARY_SOURCE__
++
++#include <string.h>
++#include <stdlib.h>
++#include <time.h>
++#include <ctype.h>
++#include <sys/types.h>
++
++#ifdef WIN32
++
++#ifndef u_long
++typedef unsigned long u_long;
++#endif
++#ifndef u_int32_t
++typedef unsigned long u_int32_t;
++#endif
++#ifndef u_word
++typedef unsigned short u_word;
++#endif
++#ifndef u_int16_t
++typedef unsigned short u_int16_t;
++#endif
++#ifndef u_char
++typedef unsigned char u_char;
++#endif
++#ifndef u_int8_t
++typedef unsigned char u_int8_t;
++#endif
++
++#endif /* WIN32 */
++
++#include "twofish.h"
++
++
++bool TwoFish_srand=TRUE;                              /* if TRUE, first call of TwoFishInit will seed rand(); */
++                                                                              /* of TwoFishInit */
++
++/* Fixed 8x8 permutation S-boxes */
++static const u_int8_t TwoFish_P[2][256] =
++{
++    {  /* p0 */
++        0xA9, 0x67, 0xB3, 0xE8,   0x04, 0xFD, 0xA3, 0x76,   0x9A, 0x92, 0x80, 0x78,
++        0xE4, 0xDD, 0xD1, 0x38,   0x0D, 0xC6, 0x35, 0x98,   0x18, 0xF7, 0xEC, 0x6C,
++        0x43, 0x75, 0x37, 0x26,   0xFA, 0x13, 0x94, 0x48,   0xF2, 0xD0, 0x8B, 0x30,
++        0x84, 0x54, 0xDF, 0x23,   0x19, 0x5B, 0x3D, 0x59,   0xF3, 0xAE, 0xA2, 0x82,
++        0x63, 0x01, 0x83, 0x2E,   0xD9, 0x51, 0x9B, 0x7C,   0xA6, 0xEB, 0xA5, 0xBE,
++        0x16, 0x0C, 0xE3, 0x61,   0xC0, 0x8C, 0x3A, 0xF5,   0x73, 0x2C, 0x25, 0x0B,
++        0xBB, 0x4E, 0x89, 0x6B,   0x53, 0x6A, 0xB4, 0xF1,   0xE1, 0xE6, 0xBD, 0x45,
++        0xE2, 0xF4, 0xB6, 0x66,   0xCC, 0x95, 0x03, 0x56,   0xD4, 0x1C, 0x1E, 0xD7,
++        0xFB, 0xC3, 0x8E, 0xB5,   0xE9, 0xCF, 0xBF, 0xBA,   0xEA, 0x77, 0x39, 0xAF,
++        0x33, 0xC9, 0x62, 0x71,   0x81, 0x79, 0x09, 0xAD,   0x24, 0xCD, 0xF9, 0xD8,
++        0xE5, 0xC5, 0xB9, 0x4D,   0x44, 0x08, 0x86, 0xE7,   0xA1, 0x1D, 0xAA, 0xED,
++        0x06, 0x70, 0xB2, 0xD2,   0x41, 0x7B, 0xA0, 0x11,   0x31, 0xC2, 0x27, 0x90,
++        0x20, 0xF6, 0x60, 0xFF,   0x96, 0x5C, 0xB1, 0xAB,   0x9E, 0x9C, 0x52, 0x1B,
++        0x5F, 0x93, 0x0A, 0xEF,   0x91, 0x85, 0x49, 0xEE,   0x2D, 0x4F, 0x8F, 0x3B,
++        0x47, 0x87, 0x6D, 0x46,   0xD6, 0x3E, 0x69, 0x64,   0x2A, 0xCE, 0xCB, 0x2F,
++        0xFC, 0x97, 0x05, 0x7A,   0xAC, 0x7F, 0xD5, 0x1A,   0x4B, 0x0E, 0xA7, 0x5A,
++        0x28, 0x14, 0x3F, 0x29,   0x88, 0x3C, 0x4C, 0x02,   0xB8, 0xDA, 0xB0, 0x17,
++        0x55, 0x1F, 0x8A, 0x7D,   0x57, 0xC7, 0x8D, 0x74,   0xB7, 0xC4, 0x9F, 0x72,
++        0x7E, 0x15, 0x22, 0x12,   0x58, 0x07, 0x99, 0x34,   0x6E, 0x50, 0xDE, 0x68,
++        0x65, 0xBC, 0xDB, 0xF8,   0xC8, 0xA8, 0x2B, 0x40,   0xDC, 0xFE, 0x32, 0xA4,
++        0xCA, 0x10, 0x21, 0xF0,   0xD3, 0x5D, 0x0F, 0x00,   0x6F, 0x9D, 0x36, 0x42,
++        0x4A, 0x5E, 0xC1, 0xE0
++    },
++    {  /* p1 */
++        0x75, 0xF3, 0xC6, 0xF4,   0xDB, 0x7B, 0xFB, 0xC8,   0x4A, 0xD3, 0xE6, 0x6B,
++        0x45, 0x7D, 0xE8, 0x4B,   0xD6, 0x32, 0xD8, 0xFD,   0x37, 0x71, 0xF1, 0xE1,
++        0x30, 0x0F, 0xF8, 0x1B,   0x87, 0xFA, 0x06, 0x3F,   0x5E, 0xBA, 0xAE, 0x5B,
++        0x8A, 0x00, 0xBC, 0x9D,   0x6D, 0xC1, 0xB1, 0x0E,   0x80, 0x5D, 0xD2, 0xD5,
++        0xA0, 0x84, 0x07, 0x14,   0xB5, 0x90, 0x2C, 0xA3,   0xB2, 0x73, 0x4C, 0x54,
++        0x92, 0x74, 0x36, 0x51,   0x38, 0xB0, 0xBD, 0x5A,   0xFC, 0x60, 0x62, 0x96,
++        0x6C, 0x42, 0xF7, 0x10,   0x7C, 0x28, 0x27, 0x8C,   0x13, 0x95, 0x9C, 0xC7,
++        0x24, 0x46, 0x3B, 0x70,   0xCA, 0xE3, 0x85, 0xCB,   0x11, 0xD0, 0x93, 0xB8,
++        0xA6, 0x83, 0x20, 0xFF,   0x9F, 0x77, 0xC3, 0xCC,   0x03, 0x6F, 0x08, 0xBF,
++              0x40, 0xE7, 0x2B, 0xE2,   0x79, 0x0C, 0xAA, 0x82,   0x41, 0x3A, 0xEA, 0xB9,
++        0xE4, 0x9A, 0xA4, 0x97,   0x7E, 0xDA, 0x7A, 0x17,   0x66, 0x94, 0xA1, 0x1D,
++        0x3D, 0xF0, 0xDE, 0xB3,   0x0B, 0x72, 0xA7, 0x1C,   0xEF, 0xD1, 0x53, 0x3E,
++        0x8F, 0x33, 0x26, 0x5F,   0xEC, 0x76, 0x2A, 0x49,   0x81, 0x88, 0xEE, 0x21,
++        0xC4, 0x1A, 0xEB, 0xD9,   0xC5, 0x39, 0x99, 0xCD,   0xAD, 0x31, 0x8B, 0x01,
++        0x18, 0x23, 0xDD, 0x1F,   0x4E, 0x2D, 0xF9, 0x48,   0x4F, 0xF2, 0x65, 0x8E,
++        0x78, 0x5C, 0x58, 0x19,   0x8D, 0xE5, 0x98, 0x57,   0x67, 0x7F, 0x05, 0x64,
++        0xAF, 0x63, 0xB6, 0xFE,   0xF5, 0xB7, 0x3C, 0xA5,   0xCE, 0xE9, 0x68, 0x44,
++        0xE0, 0x4D, 0x43, 0x69,   0x29, 0x2E, 0xAC, 0x15,   0x59, 0xA8, 0x0A, 0x9E,
++        0x6E, 0x47, 0xDF, 0x34,   0x35, 0x6A, 0xCF, 0xDC,   0x22, 0xC9, 0xC0, 0x9B,
++        0x89, 0xD4, 0xED, 0xAB,   0x12, 0xA2, 0x0D, 0x52,   0xBB, 0x02, 0x2F, 0xA9,
++        0xD7, 0x61, 0x1E, 0xB4,   0x50, 0x04, 0xF6, 0xC2,   0x16, 0x25, 0x86, 0x56,
++        0x55, 0x09, 0xBE, 0x91
++    }
++};
++
++static bool TwoFish_MDSready=FALSE;
++static u_int32_t TwoFish_MDS[4][256]; /* TwoFish_MDS matrix */
++
++
++#define       TwoFish_LFSR1(x) (((x)>>1)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/2:0))
++#define       TwoFish_LFSR2(x) (((x)>>2)^(((x)&0x02)?TwoFish_MDS_GF_FDBK/2:0)^(((x)&0x01)?TwoFish_MDS_GF_FDBK/4:0))
++
++#define       TwoFish_Mx_1(x) ((u_int32_t)(x))                /* force result to dword so << will work  */
++#define       TwoFish_Mx_X(x) ((u_int32_t)((x)^TwoFish_LFSR2(x)))     /* 5B */
++#define       TwoFish_Mx_Y(x) ((u_int32_t)((x)^TwoFish_LFSR1(x)^TwoFish_LFSR2(x)))    /* EF  */
++#define       TwoFish_RS_rem(x) { u_int8_t b=(u_int8_t)(x>>24); u_int32_t g2=((b<<1)^((b&0x80)?TwoFish_RS_GF_FDBK:0))&0xFF; u_int32_t g3=((b>>1)&0x7F)^((b&1)?TwoFish_RS_GF_FDBK>>1:0)^g2; x=(x<<8)^(g3<<24)^(g2<<16)^(g3<<8)^b; }
++
++/*#define     TwoFish__b(x,N) (((u_int8_t *)&x)[((N)&3)^TwoFish_ADDR_XOR])*/ /* pick bytes out of a dword */
++
++#define       TwoFish_b0(x)                   TwoFish__b(x,0)         /* extract LSB of u_int32_t  */
++#define       TwoFish_b1(x)                   TwoFish__b(x,1)
++#define       TwoFish_b2(x)                   TwoFish__b(x,2)
++#define       TwoFish_b3(x)                   TwoFish__b(x,3)         /* extract MSB of u_int32_t  */
++
++u_int8_t TwoFish__b(u_int32_t x,int n)
++{     n&=3;
++      while(n-->0)
++              x>>=8;
++      return (u_int8_t)x;
++}
++
++
++/*    TwoFish Initialization
++ *
++ *    This routine generates a global data structure for use with TwoFish,
++ *    initializes important values (such as subkeys, sBoxes), generates subkeys
++ *    and precomputes the MDS matrix if not already done.
++ *
++ *    Input:  User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!')
++ *
++ *  Output:   Pointer to TWOFISH structure. This data structure contains key dependent data.
++ *                    This pointer is used with all other crypt functions.
++ */
++
++TWOFISH *TwoFishInit(char *userkey)
++{   TWOFISH *tfdata;
++      int i,x,m;
++      char tkey[TwoFish_KEY_LENGTH+40];
++
++      tfdata=malloc(sizeof(TWOFISH));                 /* allocate the TwoFish structure */
++      if(tfdata!=NULL)
++      {       if(*userkey)
++              {       strncpy(tkey,userkey,TwoFish_KEY_LENGTH);                       /* use first 32 chars of user supplied password */
++                      tkey[TwoFish_KEY_LENGTH]=0;                                                     /* make sure it wasn't more */
++              }
++              else
++                      strcpy(tkey,TwoFish_DEFAULT_PW);        /* if no key defined, use default password */
++              for(i=0,x=0,m=strlen(tkey);i<TwoFish_KEY_LENGTH;i++)    /* copy into data structure */
++              {       tfdata->key[i]=tkey[x++];                                                       /* fill the whole keyspace with repeating key. */
++                      if(x==m)
++                              x=0;
++              }
++
++              if(!TwoFish_MDSready)
++                      _TwoFish_PrecomputeMDSmatrix();         /* "Wake Up, Neo" */
++              _TwoFish_MakeSubKeys(tfdata);                   /* generate subkeys */
++              _TwoFish_ResetCBC(tfdata);                              /* reset the CBC */
++              tfdata->output=NULL;                                    /* nothing to output yet */
++              tfdata->dontflush=FALSE;                                /* reset decrypt skip block flag */
++              if(TwoFish_srand)
++              {       TwoFish_srand=FALSE;
++                      srand(time(NULL));
++              }
++      }
++      return tfdata;                                                  /* return the data pointer */
++}
++
++
++void TwoFishDestroy(TWOFISH *tfdata)
++{     if(tfdata!=NULL)
++              free(tfdata);
++}
++
++
++/* en/decryption with CBC mode */
++unsigned long _TwoFish_CryptRawCBC(char *in,char *out,unsigned long len,bool decrypt,TWOFISH *tfdata)
++{     unsigned long rl;
++
++      rl=len;                                                                                 /* remember how much data to crypt. */
++      while(len>TwoFish_BLOCK_SIZE)                                   /* and now we process block by block. */
++      {       _TwoFish_BlockCrypt(in,out,TwoFish_BLOCK_SIZE,decrypt,tfdata); /* de/encrypt it. */
++              in+=TwoFish_BLOCK_SIZE;                                         /* adjust pointers. */
++              out+=TwoFish_BLOCK_SIZE;
++              len-=TwoFish_BLOCK_SIZE;
++      }
++      if(len>0)                                                                               /* if we have less than a block left... */
++              _TwoFish_BlockCrypt(in,out,len,decrypt,tfdata); /* ...then we de/encrypt that too. */
++      if(tfdata->qBlockDefined && !tfdata->dontflush)                                         /* in case len was exactly one block... */
++              _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata); /* ...we need to write the...  */
++                                                                                                                                              /* ...remaining bytes of the buffer */
++      return rl;
++}
++
++/* en/decryption on one block only */
++unsigned long _TwoFish_CryptRaw16(char *in,char *out,unsigned long len,bool decrypt,TWOFISH *tfdata)
++{     /* qBlockPlain already zero'ed through ResetCBC  */
++      memcpy(tfdata->qBlockPlain,in,len);                                     /* toss the data into it. */
++      _TwoFish_BlockCrypt16(tfdata->qBlockPlain,tfdata->qBlockCrypt,decrypt,tfdata); /* encrypt just that block without CBC. */
++      memcpy(out,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE);                             /* and return what we got */
++      return TwoFish_BLOCK_SIZE;
++}
++
++/* en/decryption without reset of CBC and output assignment */
++unsigned long _TwoFish_CryptRaw(char *in,char *out,unsigned long len,bool decrypt,TWOFISH *tfdata)
++{
++      if(in!=NULL && out!=NULL && len>0 && tfdata!=NULL)              /* if we have valid data, then... */
++      {       if(len>TwoFish_BLOCK_SIZE)                                                      /* ...check if we have more than one block. */
++                      return _TwoFish_CryptRawCBC(in,out,len,decrypt,tfdata); /* if so, use the CBC routines... */
++              else
++                      return _TwoFish_CryptRaw16(in,out,len,decrypt,tfdata); /* ...otherwise just do one block. */
++      }
++      return 0;
++}
++
++
++/*    TwoFish Raw Encryption
++ *
++ *    Does not use header, but does use CBC (if more than one block has to be encrypted).
++ *
++ *    Input:  Pointer to the buffer of the plaintext to be encrypted.
++ *                    Pointer to the buffer receiving the ciphertext.
++ *                    The length of the plaintext buffer.
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes encrypted if successful, otherwise 0.
++ */
++
++unsigned long TwoFishEncryptRaw(char *in,
++                                                              char *out,
++                                                              unsigned long len,
++                                                              TWOFISH *tfdata)
++{     _TwoFish_ResetCBC(tfdata);                                                      /* reset CBC flag. */
++      tfdata->output=out;                                                     /* output straight into output buffer. */
++      return _TwoFish_CryptRaw(in,out,len,FALSE,tfdata);      /* and go for it. */
++}
++
++/*    TwoFish Raw Decryption
++ *
++ *    Does not use header, but does use CBC (if more than one block has to be decrypted).
++ *
++ *    Input:  Pointer to the buffer of the ciphertext to be decrypted.
++ *                    Pointer to the buffer receiving the plaintext.
++ *                    The length of the ciphertext buffer (at least one cipher block).
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes decrypted if successful, otherwise 0.
++ */
++
++unsigned long TwoFishDecryptRaw(char *in,
++                                                              char *out,
++                                                              unsigned long len,
++                                                              TWOFISH *tfdata)
++{     _TwoFish_ResetCBC(tfdata);                                                      /* reset CBC flag. */
++      tfdata->output=out;                                                     /* output straight into output buffer. */
++      return _TwoFish_CryptRaw(in,out,len,TRUE,tfdata);       /* and go for it. */
++}
++
++/*    TwoFish Free
++ *
++ *    Free's the allocated buffer.
++ *
++ *    Input:  Pointer to the TwoFish structure
++ *
++ *    Output: (none)
++ */
++
++void TwoFishFree(TWOFISH *tfdata)
++{     if(tfdata->output!=NULL)        /* if a valid buffer is present... */
++      {       free(tfdata->output);   /* ...then we free it for you... */
++              tfdata->output=NULL;    /* ...and mark as such. */
++      }
++}
++
++/*    TwoFish Set Output
++ *
++ *    If you want to allocate the output buffer yourself,
++ *    then you can set it with this function.
++ *
++ *    Input:  Pointer to your output buffer
++ *                    Pointer to the TwoFish structure
++ *
++ *    Output: (none)
++ */
++
++void TwoFishSetOutput(char *outp,TWOFISH *tfdata)
++{     tfdata->output=outp;                            /* (do we really need a function for this?) */
++}
++
++/*    TwoFish Alloc
++ *
++ *    Allocates enough memory for the output buffer that would be required
++ *
++ *    Input:  Length of the plaintext.
++ *                    Boolean flag for BinHex Output.
++ *                    Pointer to the TwoFish structure.
++ *
++ *    Output: Returns a pointer to the memory allocated.
++ */
++
++void *TwoFishAlloc(unsigned long len,bool binhex,bool decrypt,TWOFISH *tfdata)
++{
++/*    TwoFishFree(tfdata);    */                      /* (don't for now) discard whatever was allocated earlier. */
++      if(decrypt)                                                     /* if decrypting... */
++      {       if(binhex)                                              /* ...and input is binhex encoded... */
++                      len/=2;                                         /* ...use half as much for output. */
++              len-=TwoFish_BLOCK_SIZE;                /* Also, subtract the size of the header. */
++      }
++      else
++      {       len+=TwoFish_BLOCK_SIZE;                /* the size is just increased by the header... */
++              if(binhex)
++                      len*=2;                                         /* ...and doubled if output is to be binhexed. */
++      }
++      tfdata->output=malloc(len+TwoFish_BLOCK_SIZE);/* grab some memory...plus some extra (it's running over somewhere, crashes without extra padding) */
++
++      return tfdata->output;                          /* ...and return to caller. */
++}
++
++/* bin2hex and hex2bin conversion */
++void _TwoFish_BinHex(u_int8_t *buf,unsigned long len,bool bintohex)
++{     u_int8_t *pi,*po,c;
++
++      if(bintohex)
++      {       for(pi=buf+len-1,po=buf+(2*len)-1;len>0;pi--,po--,len--) /* let's start from the end of the bin block. */
++              {       c=*pi;                                                                                           /* grab value. */
++                      c&=15;                                                                                           /* use lower 4 bits. */
++                      if(c>9)                                                                                          /* convert to ascii. */
++                              c+=('a'-10);
++                      else
++                              c+='0';
++                      *po--=c;                                                                                         /* set the lower nibble. */
++                      c=*pi;                                                                                           /* grab value again. */
++                      c>>=4;                                                                                           /* right shift 4 bits. */
++                      c&=15;                                                                                           /* make sure we only have 4 bits. */
++                      if(c>9)                                                                                          /* convert to ascii. */
++                              c+=('a'-10);
++                      else
++                              c+='0';
++                      *po=c;                                                                                           /* set the higher nibble. */
++              }                                                                                                                /* and keep going. */
++      }
++      else
++      {       for(pi=buf,po=buf;len>0;pi++,po++,len-=2)                                /* let's start from the beginning of the hex block. */
++              {       c=tolower(*pi++)-'0';                                                            /* grab higher nibble. */
++                      if(c>9)                                                                                          /* convert to value. */
++                              c-=('0'-9);
++                      *po=c<<4;                                                                                        /* left shit 4 bits. */
++                      c=tolower(*pi)-'0';                                                                      /* grab lower nibble. */
++                      if(c>9)                                                                                          /* convert to value. */
++                              c-=('0'-9);
++                      *po|=c;                                                                                          /* and add to value. */
++              }
++      }
++}
++
++
++/*    TwoFish Encryption
++ *
++ *    Uses header and CBC. If the output area has not been intialized with TwoFishAlloc,
++ *  this routine will alloc the memory. In addition, it will include a small 'header'
++ *  containing the magic and some salt. That way the decrypt routine can check if the
++ *  packet got decrypted successfully, and return 0 instead of garbage.
++ *
++ *    Input:  Pointer to the buffer of the plaintext to be encrypted.
++ *                    Pointer to the pointer to the buffer receiving the ciphertext.
++ *                            The pointer either points to user allocated output buffer space, or to NULL, in which case
++ *                            this routine will set the pointer to the buffer allocated through the struct.
++ *                    The length of the plaintext buffer.
++ *                            Can be -1 if the input is a null terminated string, in which case we'll count for you.
++ *                    Boolean flag for BinHex Output (if used, output will be twice as large as input).
++ *                            Note: BinHex conversion overwrites (converts) input buffer!
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes encrypted if successful, otherwise 0.
++ */
++
++unsigned long TwoFishEncrypt(char *in,
++                                                       char **out,
++                                                       signed long len,
++                                                       bool binhex,
++                                                       TWOFISH *tfdata)
++{     unsigned long ilen,olen;
++
++
++      if(len== -1)                    /* if we got -1 for len, we'll assume IN is a...  */
++              ilen=strlen(in);        /* ...\0 terminated string and figure len out ourselves... */
++      else
++              ilen=len;                       /* ...otherwise we trust you supply a correct length. */
++
++      if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */
++      {       if(*out==NULL)                                                                  /* if OUT points to a NULL pointer... */
++                      *out=TwoFishAlloc(ilen,binhex,FALSE,tfdata);  /* ...we'll (re-)allocate buffer space. */
++              if(*out!=NULL)
++              {       tfdata->output=*out;                                                    /* set output buffer. */
++                      tfdata->header.salt=rand()*65536+rand();                /* toss in some salt. */
++                      tfdata->header.length[0]= (u_int8_t)(ilen);
++                      tfdata->header.length[1]= (u_int8_t)(ilen>>8);
++                      tfdata->header.length[2]= (u_int8_t)(ilen>>16);
++                      tfdata->header.length[3]= (u_int8_t)(ilen>>24);
++                      memcpy(tfdata->header.magic,TwoFish_MAGIC,TwoFish_MAGIC_LEN); /* set the magic. */
++                      olen=TwoFish_BLOCK_SIZE;                                                /* set output counter. */
++                      _TwoFish_ResetCBC(tfdata);                                              /* reset the CBC flag */
++                      _TwoFish_BlockCrypt((u_int8_t *)&(tfdata->header),*out,olen,FALSE,tfdata); /* encrypt first block (without flush on 16 byte boundary). */
++                      olen+=_TwoFish_CryptRawCBC(in,*out+TwoFish_BLOCK_SIZE,ilen,FALSE,tfdata);       /* and encrypt the rest (we do not reset the CBC flag). */
++                      if(binhex)                                                                      /* if binhex... */
++                      {       _TwoFish_BinHex(*out,olen,TRUE);                /* ...convert output to binhex... */
++                              olen*=2;                                                                /* ...and size twice as large. */
++                      }
++                      tfdata->output=*out;
++                      return olen;
++              }
++      }
++      return 0;
++}
++
++/*    TwoFish Decryption
++ *
++ *    Uses header and CBC. If the output area has not been intialized with TwoFishAlloc,
++ *  this routine will alloc the memory. In addition, it will check the small 'header'
++ *  containing the magic. If magic does not match we return 0. Otherwise we return the
++ *  amount of bytes decrypted (should be the same as the length in the header).
++ *
++ *    Input:  Pointer to the buffer of the ciphertext to be decrypted.
++ *                    Pointer to the pointer to the buffer receiving the plaintext.
++ *                            The pointer either points to user allocated output buffer space, or to NULL, in which case
++ *                            this routine will set the pointer to the buffer allocated through the struct.
++ *                    The length of the ciphertext buffer.
++ *                            Can be -1 if the input is a null terminated binhex string, in which case we'll count for you.
++ *                    Boolean flag for BinHex Input (if used, plaintext will be half as large as input).
++ *                            Note: BinHex conversion overwrites (converts) input buffer!
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes decrypted if successful, otherwise 0.
++ */
++
++unsigned long TwoFishDecrypt(char *in,
++                                                       char **out,
++                                                       signed long len,
++                                                       bool binhex,
++                                                       TWOFISH *tfdata)
++{     unsigned long ilen,elen,olen;
++      const u_int8_t cmagic[TwoFish_MAGIC_LEN]=TwoFish_MAGIC;
++      u_int8_t *tbuf;
++
++
++
++      if(len== -1)                    /* if we got -1 for len, we'll assume IN is...  */
++              ilen=strlen(in);        /* ...\0 terminated binhex and figure len out ourselves... */
++      else
++              ilen=len;                       /* ...otherwise we trust you supply a correct length. */
++
++      if(in!=NULL && out!=NULL && ilen>0 && tfdata!=NULL) /* if we got usable stuff, we'll do it. */
++      {       if(*out==NULL)                                                                  /* if OUT points to a NULL pointer... */
++                      *out=TwoFishAlloc(ilen,binhex,TRUE,tfdata); /* ...we'll (re-)allocate buffer space. */
++              if(*out!=NULL)
++              {       if(binhex)                                                                      /* if binhex... */
++                      {       _TwoFish_BinHex(in,ilen,FALSE);         /* ...convert input to values... */
++                              ilen/=2;                                                                /* ...and size half as much. */
++                      }
++                      _TwoFish_ResetCBC(tfdata);                                              /* reset the CBC flag. */
++
++                      tbuf=(u_int8_t *)malloc(ilen+TwoFish_BLOCK_SIZE); /* get memory for data and header. */
++                      if(tbuf==NULL)
++                              return 0;
++                      tfdata->output=tbuf;                                    /* set output to temp buffer. */
++
++                      olen=_TwoFish_CryptRawCBC(in,tbuf,ilen,TRUE,tfdata)-TwoFish_BLOCK_SIZE; /* decrypt the whole thing. */
++                      memcpy(&(tfdata->header),tbuf,TwoFish_BLOCK_SIZE); /* copy first block into header. */
++                      tfdata->output=*out;
++                      for(elen=0;elen<TwoFish_MAGIC_LEN;elen++)       /* compare magic. */
++                              if(tfdata->header.magic[elen]!=cmagic[elen])
++                                      break;
++                      if(elen==TwoFish_MAGIC_LEN)                                     /* if magic matches then... */
++                      {       elen=(tfdata->header.length[0]) |
++                                       (tfdata->header.length[1])<<8 |
++                                       (tfdata->header.length[2])<<16 |
++                                       (tfdata->header.length[3])<<24;        /* .. we know how much to expect. */
++                              if(elen>olen)                                                   /* adjust if necessary. */
++                                      elen=olen;
++                              memcpy(*out,tbuf+TwoFish_BLOCK_SIZE,elen);      /* copy data into intended output. */
++                              free(tbuf);
++                              return elen;
++                      }
++                      free(tbuf);
++              }
++      }
++      return 0;
++}
++
++void _TwoFish_PrecomputeMDSmatrix(void)       /* precompute the TwoFish_MDS matrix */
++{   u_int32_t m1[2];
++    u_int32_t mX[2];
++    u_int32_t mY[2];
++    u_int32_t i, j;
++
++    for (i = 0; i < 256; i++)
++    {   j = TwoFish_P[0][i]       & 0xFF; /* compute all the matrix elements */
++        m1[0] = j;
++        mX[0] = TwoFish_Mx_X( j ) & 0xFF;
++        mY[0] = TwoFish_Mx_Y( j ) & 0xFF;
++
++        j = TwoFish_P[1][i]       & 0xFF;
++        m1[1] = j;
++        mX[1] = TwoFish_Mx_X( j ) & 0xFF;
++        mY[1] = TwoFish_Mx_Y( j ) & 0xFF;
++
++        TwoFish_MDS[0][i] = m1[TwoFish_P_00] | /* fill matrix w/ above elements */
++                    mX[TwoFish_P_00] <<  8 |
++                    mY[TwoFish_P_00] << 16 |
++                    mY[TwoFish_P_00] << 24;
++        TwoFish_MDS[1][i] = mY[TwoFish_P_10] |
++                    mY[TwoFish_P_10] <<  8 |
++                    mX[TwoFish_P_10] << 16 |
++                    m1[TwoFish_P_10] << 24;
++        TwoFish_MDS[2][i] = mX[TwoFish_P_20] |
++                    mY[TwoFish_P_20] <<  8 |
++                    m1[TwoFish_P_20] << 16 |
++                    mY[TwoFish_P_20] << 24;
++        TwoFish_MDS[3][i] = mX[TwoFish_P_30] |
++                    m1[TwoFish_P_30] <<  8 |
++                    mY[TwoFish_P_30] << 16 |
++                    mX[TwoFish_P_30] << 24;
++    }
++      TwoFish_MDSready=TRUE;
++}
++
++
++void _TwoFish_MakeSubKeys(TWOFISH *tfdata)    /* Expand a user-supplied key material into a session key. */
++{     u_int32_t k64Cnt    = TwoFish_KEY_LENGTH / 8;
++      u_int32_t k32e[4]; /* even 32-bit entities */
++      u_int32_t k32o[4]; /* odd 32-bit entities */
++      u_int32_t sBoxKey[4];
++      u_int32_t offset,i,j;
++      u_int32_t A, B, q=0;
++      u_int32_t k0,k1,k2,k3;
++    u_int32_t b0,b1,b2,b3;
++
++    /* split user key material into even and odd 32-bit entities and */
++    /* compute S-box keys using (12, 8) Reed-Solomon code over GF(256) */
++
++
++    for (offset=0,i=0,j=k64Cnt-1;i<4 && offset<TwoFish_KEY_LENGTH;i++,j--)
++    { k32e[i] = tfdata->key[offset++];
++              k32e[i]|= tfdata->key[offset++]<<8;
++              k32e[i]|= tfdata->key[offset++]<<16;
++              k32e[i]|= tfdata->key[offset++]<<24;
++      k32o[i] = tfdata->key[offset++];
++              k32o[i]|= tfdata->key[offset++]<<8;
++              k32o[i]|= tfdata->key[offset++]<<16;
++              k32o[i]|= tfdata->key[offset++]<<24;
++        sBoxKey[j] = _TwoFish_RS_MDS_Encode( k32e[i], k32o[i] ); /* reverse order */
++    }
++
++    /* compute the round decryption subkeys for PHT. these same subkeys */
++    /* will be used in encryption but will be applied in reverse order. */
++    i=0;
++    while(i < TwoFish_TOTAL_SUBKEYS)
++    { A = _TwoFish_F32( k64Cnt, q, k32e ); /* A uses even key entities */
++        q += TwoFish_SK_BUMP;
++
++        B = _TwoFish_F32( k64Cnt, q, k32o ); /* B uses odd  key entities */
++        q += TwoFish_SK_BUMP;
++
++        B = B << 8 | B >> 24;
++
++        A += B;
++        tfdata->subKeys[i++] = A;           /* combine with a PHT */
++
++        A += B;
++        tfdata->subKeys[i++] = A << TwoFish_SK_ROTL | A >> (32-TwoFish_SK_ROTL);
++    }
++
++    /* fully expand the table for speed */
++    k0 = sBoxKey[0];
++    k1 = sBoxKey[1];
++    k2 = sBoxKey[2];
++    k3 = sBoxKey[3];
++
++    for (i = 0; i < 256; i++)
++    {   b0 = b1 = b2 = b3 = i;
++        switch (k64Cnt & 3)
++        {     case 1: /* 64-bit keys */
++                              tfdata->sBox[      2*i  ] = TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0]) ^ TwoFish_b0(k0)];
++                              tfdata->sBox[      2*i+1] = TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1]) ^ TwoFish_b1(k0)];
++                              tfdata->sBox[0x200+2*i  ] = TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2]) ^ TwoFish_b2(k0)];
++                              tfdata->sBox[0x200+2*i+1] = TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3]) ^ TwoFish_b3(k0)];
++                              break;
++                      case 0: /* 256-bit keys (same as 4) */
++                              b0 = (TwoFish_P[TwoFish_P_04][b0]) ^ TwoFish_b0(k3);
++                              b1 = (TwoFish_P[TwoFish_P_14][b1]) ^ TwoFish_b1(k3);
++                              b2 = (TwoFish_P[TwoFish_P_24][b2]) ^ TwoFish_b2(k3);
++                              b3 = (TwoFish_P[TwoFish_P_34][b3]) ^ TwoFish_b3(k3);
++                      case 3:  /* 192-bit keys */
++                              b0 = (TwoFish_P[TwoFish_P_03][b0]) ^ TwoFish_b0(k2);
++                              b1 = (TwoFish_P[TwoFish_P_13][b1]) ^ TwoFish_b1(k2);
++                              b2 = (TwoFish_P[TwoFish_P_23][b2]) ^ TwoFish_b2(k2);
++                              b3 = (TwoFish_P[TwoFish_P_33][b3]) ^ TwoFish_b3(k2);
++                      case 2: /* 128-bit keys */
++                              tfdata->sBox[      2*i  ]=
++                                      TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0]) ^
++                                      TwoFish_b0(k1)]) ^ TwoFish_b0(k0)];
++
++                              tfdata->sBox[      2*i+1]=
++                                      TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1]) ^
++                                      TwoFish_b1(k1)]) ^ TwoFish_b1(k0)];
++
++                              tfdata->sBox[0x200+2*i  ]=
++                                      TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2]) ^
++                                      TwoFish_b2(k1)]) ^ TwoFish_b2(k0)];
++
++                              tfdata->sBox[0x200+2*i+1]=
++                                      TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3]) ^
++                                      TwoFish_b3(k1)]) ^ TwoFish_b3(k0)];
++              }
++    }
++}
++
++
++/**
++ * Encrypt or decrypt exactly one block of plaintext in CBC mode.
++ * Use "ciphertext stealing" technique described on pg. 196
++ * of "Applied Cryptography" to encrypt the final partial
++ * (i.e. <16 byte) block if necessary.
++ *
++ * jojo: the "ciphertext stealing" requires we read ahead and have
++ * special handling for the last two blocks.  Because of this, the
++ * output from the TwoFish algorithm is handled internally here.
++ * It would be better to have a higher level handle this as well as
++ * CBC mode.  Unfortunately, I've mixed the two together, which is
++ * pretty crappy... The Java version separates these out correctly.
++ *
++ * fknobbe:   I have reduced the CBC mode to work on memory buffer only.
++ *                    Higher routines should use an intermediate buffer and handle
++ *                    their output seperately (mainly so the data can be flushed
++ *                    in one chunk, not seperate 16 byte blocks...)
++ *
++ * @param in   The plaintext.
++ * @param out  The ciphertext
++ * @param size how much to encrypt
++ * @param tfdata: Pointer to the global data structure containing session keys.
++ * @return none
++ */
++void _TwoFish_BlockCrypt(u_int8_t *in,u_int8_t *out,unsigned long size,int decrypt,TWOFISH *tfdata)
++{     u_int8_t PnMinusOne[TwoFish_BLOCK_SIZE];
++      u_int8_t CnMinusOne[TwoFish_BLOCK_SIZE];
++      u_int8_t CBCplusCprime[TwoFish_BLOCK_SIZE];
++      u_int8_t Pn[TwoFish_BLOCK_SIZE];
++      u_int8_t *p,*pout;
++      unsigned long i;
++
++    /* here is where we implement CBC mode and cipher block stealing */
++    if(size==TwoFish_BLOCK_SIZE)
++      {   /* if we are encrypting, CBC means we XOR the plain text block with the */
++        /* previous cipher text block before encrypting */
++              if(!decrypt && tfdata->qBlockDefined)
++              {   for(p=in,i=0;i<TwoFish_BLOCK_SIZE;i++,p++)
++                              Pn[i]=*p ^ tfdata->qBlockCrypt[i];      /* FK: I'm copying the xor'ed input into Pn... */
++              }
++              else
++                      memcpy(Pn,in,TwoFish_BLOCK_SIZE); /* FK: same here. we work of Pn all the time. */
++
++        /* TwoFish block level encryption or decryption */
++              _TwoFish_BlockCrypt16(Pn,out,decrypt,tfdata);
++
++        /* if we are decrypting, CBC means we XOR the result of the decryption */
++        /* with the previous cipher text block to get the resulting plain text */
++        if(decrypt && tfdata->qBlockDefined)
++        {     for (p=out,i=0;i<TwoFish_BLOCK_SIZE;i++,p++)
++                              *p^=tfdata->qBlockPlain[i];
++        }
++
++        /* save the input and output blocks, since CBC needs these for XOR */
++        /* operations */
++        _TwoFish_qBlockPush(Pn,out,tfdata);
++      }
++      else
++      {   /* cipher block stealing, we are at Pn, */
++        /* but since Cn-1 must now be replaced with CnC' */
++        /* we pop it off, and recalculate Cn-1 */
++
++        if(decrypt)
++        {   /* We are on an odd block, and had to do cipher block stealing, */
++            /* so the PnMinusOne has to be derived differently. */
++
++            /* First we decrypt it into CBC and C' */
++              _TwoFish_qBlockPop(CnMinusOne,PnMinusOne,tfdata);
++            _TwoFish_BlockCrypt16(CnMinusOne,CBCplusCprime,decrypt,tfdata);
++
++            /* we then xor the first few bytes with the "in" bytes (Cn) */
++            /* to recover Pn, which we put in out */
++            for(p=in,pout=out,i=0;i<size;i++,p++,pout++)
++                *pout=*p ^ CBCplusCprime[i];
++
++            /* We now recover the original CnMinusOne, which consists of */
++            /* the first "size" bytes of "in" data, followed by the */
++            /* "Cprime" portion of CBCplusCprime */
++            for(p=in,i=0;i<size;i++,p++)
++                CnMinusOne[i]=*p;
++            for(;i<TwoFish_BLOCK_SIZE;i++)
++                CnMinusOne[i]=CBCplusCprime[i];
++
++            /* we now decrypt CnMinusOne to get PnMinusOne xored with Cn-2 */
++            _TwoFish_BlockCrypt16(CnMinusOne,PnMinusOne,decrypt,tfdata);
++
++            for(i=0;i<TwoFish_BLOCK_SIZE;i++)
++                PnMinusOne[i]=PnMinusOne[i] ^ tfdata->prevCipher[i];
++
++            /* So at this point, out has PnMinusOne */
++            _TwoFish_qBlockPush(CnMinusOne,PnMinusOne,tfdata);
++                  _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata);
++            _TwoFish_FlushOutput(out,size,tfdata);
++        }
++              else
++              {       _TwoFish_qBlockPop(PnMinusOne,CnMinusOne,tfdata);
++                      memset(Pn,0,TwoFish_BLOCK_SIZE);
++                      memcpy(Pn,in,size);
++                      for(i=0;i<TwoFish_BLOCK_SIZE;i++)
++                              Pn[i]^=CnMinusOne[i];
++                      _TwoFish_BlockCrypt16(Pn,out,decrypt,tfdata);
++                      _TwoFish_qBlockPush(Pn,out,tfdata);  /* now we officially have Cn-1 */
++                      _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata);
++                      _TwoFish_FlushOutput(CnMinusOne,size,tfdata);  /* old Cn-1 becomes new partial Cn */
++              }
++              tfdata->qBlockDefined=FALSE;
++      }
++}
++
++void _TwoFish_qBlockPush(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata)
++{     if(tfdata->qBlockDefined)
++              _TwoFish_FlushOutput(tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE,tfdata);
++      memcpy(tfdata->prevCipher,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE);
++      memcpy(tfdata->qBlockPlain,p,TwoFish_BLOCK_SIZE);
++      memcpy(tfdata->qBlockCrypt,c,TwoFish_BLOCK_SIZE);
++      tfdata->qBlockDefined=TRUE;
++}
++
++void _TwoFish_qBlockPop(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata)
++{     memcpy(p,tfdata->qBlockPlain,TwoFish_BLOCK_SIZE );
++      memcpy(c,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE );
++      tfdata->qBlockDefined=FALSE;
++}
++
++/* Reset's the CBC flag and zero's PrevCipher (through qBlockPlain) (important) */
++void _TwoFish_ResetCBC(TWOFISH *tfdata)
++{     tfdata->qBlockDefined=FALSE;
++      memset(tfdata->qBlockPlain,0,TwoFish_BLOCK_SIZE);
++}
++
++void _TwoFish_FlushOutput(u_int8_t *b,unsigned long len,TWOFISH *tfdata)
++{     unsigned long i;
++
++      for(i=0;i<len && !tfdata->dontflush;i++)
++              *tfdata->output++ = *b++;
++      tfdata->dontflush=FALSE;
++}
++
++void _TwoFish_BlockCrypt16(u_int8_t *in,u_int8_t *out,bool decrypt,TWOFISH *tfdata)
++{     u_int32_t x0,x1,x2,x3;
++    u_int32_t k,t0,t1,R;
++
++
++      x0=*in++;
++      x0|=(*in++ << 8 );
++      x0|=(*in++ << 16);
++      x0|=(*in++ << 24);
++    x1=*in++;
++      x1|=(*in++ << 8 );
++      x1|=(*in++ << 16);
++      x1|=(*in++ << 24);
++      x2=*in++;
++      x2|=(*in++ << 8 );
++      x2|=(*in++ << 16);
++      x2|=(*in++ << 24);
++      x3=*in++;
++      x3|=(*in++ << 8 );
++      x3|=(*in++ << 16);
++      x3|=(*in++ << 24);
++
++      if(decrypt)
++    { x0 ^= tfdata->subKeys[4];       /* swap input and output whitening keys when decrypting */
++          x1 ^= tfdata->subKeys[5];
++              x2 ^= tfdata->subKeys[6];
++              x3 ^= tfdata->subKeys[7];
++
++        k = 7+(TwoFish_ROUNDS*2);
++        for (R = 0; R < TwoFish_ROUNDS; R += 2)
++              {   t0 = _TwoFish_Fe320( tfdata->sBox, x0);
++            t1 = _TwoFish_Fe323( tfdata->sBox, x1);
++            x3 ^= t0 + (t1<<1) + tfdata->subKeys[k--];
++            x3  = x3 >> 1 | x3 << 31;
++            x2  = x2 << 1 | x2 >> 31;
++            x2 ^= t0 + t1 + tfdata->subKeys[k--];
++
++            t0 = _TwoFish_Fe320( tfdata->sBox, x2);
++            t1 = _TwoFish_Fe323( tfdata->sBox, x3);
++            x1 ^= t0 + (t1<<1) + tfdata->subKeys[k--];
++            x1  = x1 >> 1 | x1 << 31;
++            x0  = x0 << 1 | x0 >> 31;
++            x0 ^= t0 + t1 + tfdata->subKeys[k--];
++        }
++
++              x2 ^= tfdata->subKeys[0];
++              x3 ^= tfdata->subKeys[1];
++              x0 ^= tfdata->subKeys[2];
++              x1 ^= tfdata->subKeys[3];
++      }
++      else
++    { x0 ^= tfdata->subKeys[0];
++          x1 ^= tfdata->subKeys[1];
++              x2 ^= tfdata->subKeys[2];
++              x3 ^= tfdata->subKeys[3];
++
++              k = 8;
++        for (R = 0; R < TwoFish_ROUNDS; R += 2)
++        {   t0 = _TwoFish_Fe320( tfdata->sBox, x0);
++            t1 = _TwoFish_Fe323( tfdata->sBox, x1);
++            x2 ^= t0 + t1 + tfdata->subKeys[k++];
++            x2  = x2 >> 1 | x2 << 31;
++            x3  = x3 << 1 | x3 >> 31;
++            x3 ^= t0 + (t1<<1) + tfdata->subKeys[k++];
++
++            t0 = _TwoFish_Fe320( tfdata->sBox, x2);
++            t1 = _TwoFish_Fe323( tfdata->sBox, x3);
++            x0 ^= t0 + t1 + tfdata->subKeys[k++];
++            x0  = x0 >> 1 | x0 << 31;
++            x1  = x1 << 1 | x1 >> 31;
++            x1 ^= t0 + (t1<<1) + tfdata->subKeys[k++];
++        }
++
++              x2 ^= tfdata->subKeys[4];
++              x3 ^= tfdata->subKeys[5];
++              x0 ^= tfdata->subKeys[6];
++              x1 ^= tfdata->subKeys[7];
++      }
++
++      *out++ = (u_int8_t)(x2      );
++    *out++ = (u_int8_t)(x2 >>  8);
++    *out++ = (u_int8_t)(x2 >> 16);
++    *out++ = (u_int8_t)(x2 >> 24);
++
++    *out++ = (u_int8_t)(x3      );
++    *out++ = (u_int8_t)(x3 >>  8);
++    *out++ = (u_int8_t)(x3 >> 16);
++    *out++ = (u_int8_t)(x3 >> 24);
++
++    *out++ = (u_int8_t)(x0      );
++    *out++ = (u_int8_t)(x0 >>  8);
++    *out++ = (u_int8_t)(x0 >> 16);
++    *out++ = (u_int8_t)(x0 >> 24);
++
++    *out++ = (u_int8_t)(x1      );
++    *out++ = (u_int8_t)(x1 >>  8);
++    *out++ = (u_int8_t)(x1 >> 16);
++    *out++ = (u_int8_t)(x1 >> 24);
++}
++
++/**
++ * Use (12, 8) Reed-Solomon code over GF(256) to produce a key S-box
++ * 32-bit entity from two key material 32-bit entities.
++ *
++ * @param  k0  1st 32-bit entity.
++ * @param  k1  2nd 32-bit entity.
++ * @return  Remainder polynomial generated using RS code
++ */
++u_int32_t _TwoFish_RS_MDS_Encode(u_int32_t k0,u_int32_t k1)
++{     u_int32_t i,r;
++
++    for(r=k1,i=0;i<4;i++) /* shift 1 byte at a time */
++        TwoFish_RS_rem(r);
++    r ^= k0;
++    for(i=0;i<4;i++)
++        TwoFish_RS_rem(r);
++
++    return r;
++}
++
++u_int32_t _TwoFish_F32(u_int32_t k64Cnt,u_int32_t x,u_int32_t *k32)
++{   u_int8_t b0,b1,b2,b3;
++      u_int32_t k0,k1,k2,k3,result = 0;
++
++      b0=TwoFish_b0(x);
++    b1=TwoFish_b1(x);
++    b2=TwoFish_b2(x);
++    b3=TwoFish_b3(x);
++    k0=k32[0];
++    k1=k32[1];
++    k2=k32[2];
++    k3=k32[3];
++
++    switch (k64Cnt & 3)
++    { case 1: /* 64-bit keys */
++                      result =
++                              TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][b0] & 0xFF) ^ TwoFish_b0(k0)] ^
++                              TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][b1] & 0xFF) ^ TwoFish_b1(k0)] ^
++                              TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][b2] & 0xFF) ^ TwoFish_b2(k0)] ^
++                              TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][b3] & 0xFF) ^ TwoFish_b3(k0)];
++        break;
++              case 0: /* 256-bit keys (same as 4) */
++                      b0 = (TwoFish_P[TwoFish_P_04][b0] & 0xFF) ^ TwoFish_b0(k3);
++                      b1 = (TwoFish_P[TwoFish_P_14][b1] & 0xFF) ^ TwoFish_b1(k3);
++                      b2 = (TwoFish_P[TwoFish_P_24][b2] & 0xFF) ^ TwoFish_b2(k3);
++                      b3 = (TwoFish_P[TwoFish_P_34][b3] & 0xFF) ^ TwoFish_b3(k3);
++
++              case 3: /* 192-bit keys */
++                      b0 = (TwoFish_P[TwoFish_P_03][b0] & 0xFF) ^ TwoFish_b0(k2);
++                      b1 = (TwoFish_P[TwoFish_P_13][b1] & 0xFF) ^ TwoFish_b1(k2);
++                      b2 = (TwoFish_P[TwoFish_P_23][b2] & 0xFF) ^ TwoFish_b2(k2);
++                      b3 = (TwoFish_P[TwoFish_P_33][b3] & 0xFF) ^ TwoFish_b3(k2);
++              case 2: /* 128-bit keys (optimize for this case) */
++                      result =
++                                TwoFish_MDS[0][(TwoFish_P[TwoFish_P_01][(TwoFish_P[TwoFish_P_02][b0] & 0xFF) ^ TwoFish_b0(k1)] & 0xFF) ^ TwoFish_b0(k0)] ^
++                                TwoFish_MDS[1][(TwoFish_P[TwoFish_P_11][(TwoFish_P[TwoFish_P_12][b1] & 0xFF) ^ TwoFish_b1(k1)] & 0xFF) ^ TwoFish_b1(k0)] ^
++                                TwoFish_MDS[2][(TwoFish_P[TwoFish_P_21][(TwoFish_P[TwoFish_P_22][b2] & 0xFF) ^ TwoFish_b2(k1)] & 0xFF) ^ TwoFish_b2(k0)] ^
++                                TwoFish_MDS[3][(TwoFish_P[TwoFish_P_31][(TwoFish_P[TwoFish_P_32][b3] & 0xFF) ^ TwoFish_b3(k1)] & 0xFF) ^ TwoFish_b3(k0)];
++        break;
++    }
++    return result;
++}
++
++u_int32_t _TwoFish_Fe320(u_int32_t *lsBox,u_int32_t x)
++{   return lsBox[        TwoFish_b0(x)<<1    ]^
++           lsBox[      ((TwoFish_b1(x)<<1)|1)]^
++           lsBox[0x200+ (TwoFish_b2(x)<<1)   ]^
++           lsBox[0x200+((TwoFish_b3(x)<<1)|1)];
++}
++
++u_int32_t _TwoFish_Fe323(u_int32_t *lsBox,u_int32_t x)
++{   return lsBox[       (TwoFish_b3(x)<<1)   ]^
++           lsBox[      ((TwoFish_b0(x)<<1)|1)]^
++           lsBox[0x200+ (TwoFish_b1(x)<<1)   ]^
++           lsBox[0x200+((TwoFish_b2(x)<<1)|1)];
++}
++
++u_int32_t _TwoFish_Fe32(u_int32_t *lsBox,u_int32_t x,u_int32_t R)
++{   return lsBox[      2*TwoFish__b(x,R  )  ]^
++           lsBox[      2*TwoFish__b(x,R+1)+1]^
++           lsBox[0x200+2*TwoFish__b(x,R+2)  ]^
++           lsBox[0x200+2*TwoFish__b(x,R+3)+1];
++}
++
++
++#endif
+diff -ruN snort-2.9.2.2/src/twofish.h snort-2.9.2.2_bkup/src/twofish.h
+--- snort-2.9.2.2/src/twofish.h        1969-12-31 16:00:00.000000000 -0800
++++ snort-2.9.2.2_bkup/src/twofish.h   2012-04-08 20:34:57.389687124 -0700
+@@ -0,0 +1,276 @@
++/* $Id: twofish.h,v 2.1 2008/12/15 20:36:05 fknobbe Exp $
++ *
++ *
++ * Copyright (C) 1997-2000 The Cryptix Foundation Limited.
++ * Copyright (C) 2000 Farm9.
++ * Copyright (C) 2001 Frank Knobbe.
++ * All rights reserved.
++ *
++ * For Cryptix code:
++ * Use, modification, copying and distribution of this software is subject
++ * the terms and conditions of the Cryptix General Licence. You should have
++ * received a copy of the Cryptix General Licence along with this library;
++ * if not, you can download a copy from http://www.cryptix.org/ .
++ *
++ * For Farm9:
++ * ---  jojo@farm9.com, August 2000, converted from Java to C++, added CBC mode and
++ *      ciphertext stealing technique, added AsciiTwofish class for easy encryption
++ *      decryption of text strings
++ *
++ * Frank Knobbe <frank@knobbe.us>:
++ * ---  April 2001, converted from C++ to C, prefixed global variables
++ *      with TwoFish, substituted some defines, changed functions to make use of
++ *      variables supplied in a struct, modified and added routines for modular calls.
++ *      Cleaned up the code so that defines are used instead of fixed 16's and 32's.
++ *      Created two general purpose crypt routines for one block and multiple block
++ *      encryption using Joh's CBC code.
++ *            Added crypt routines that use a header (with a magic and data length).
++ *            (Basically a major rewrite).
++ *
++ *      Note: Routines labeled _TwoFish are private and should not be used
++ *      (or with extreme caution).
++ *
++ */
++
++#ifndef __TWOFISH_LIBRARY_HEADER__
++#define __TWOFISH_LIBRARY_HEADER__
++
++#ifndef FALSE
++#define FALSE 0
++#endif
++#ifndef TRUE
++#define TRUE  !FALSE
++#endif
++#ifndef bool
++#define bool  int
++#endif
++
++
++/* Constants */
++
++#define TwoFish_DEFAULT_PW            "SnortHas2FishEncryptionRoutines!" /* default password (not more than 32 chars) */
++#define TwoFish_MAGIC                 "TwoFish"                       /* to indentify a successful decryption */
++
++enum
++{     TwoFish_KEY_SIZE = 256,                                 /* Valid values: 64, 128, 192, 256 */
++                                                                                      /* User 256, other key sizes have not been tested. */
++                                                                                      /* (But should work. I substituted as much as */
++                                                                                      /* I could with this define.) */
++      TwoFish_ROUNDS = 16,
++      TwoFish_BLOCK_SIZE = 16,                                /* bytes in a data-block */
++      TwoFish_KEY_LENGTH = TwoFish_KEY_SIZE/8,        /* 32= 256-bit key */
++      TwoFish_TOTAL_SUBKEYS = 4+4+2*TwoFish_ROUNDS,
++      TwoFish_MAGIC_LEN = TwoFish_BLOCK_SIZE-8,
++      TwoFish_SK_BUMP = 0x01010101,
++      TwoFish_SK_ROTL = 9,
++      TwoFish_P_00 = 1,
++      TwoFish_P_01 = 0,
++      TwoFish_P_02 = 0,
++      TwoFish_P_03 = TwoFish_P_01 ^ 1,
++      TwoFish_P_04 = 1,
++      TwoFish_P_10 = 0,
++      TwoFish_P_11 = 0,
++      TwoFish_P_12 = 1,
++      TwoFish_P_13 = TwoFish_P_11 ^ 1,
++      TwoFish_P_14 = 0,
++      TwoFish_P_20 = 1,
++      TwoFish_P_21 = 1,
++      TwoFish_P_22 = 0,
++      TwoFish_P_23 = TwoFish_P_21 ^ 1,
++      TwoFish_P_24 = 0,
++      TwoFish_P_30 = 0,
++      TwoFish_P_31 = 1,
++      TwoFish_P_32 = 1,
++      TwoFish_P_33 = TwoFish_P_31 ^ 1,
++      TwoFish_P_34 = 1,
++      TwoFish_GF256_FDBK =   0x169,
++      TwoFish_GF256_FDBK_2 = 0x169 / 2,
++      TwoFish_GF256_FDBK_4 = 0x169 / 4,
++      TwoFish_RS_GF_FDBK = 0x14D,             /* field generator */
++      TwoFish_MDS_GF_FDBK = 0x169             /* primitive polynomial for GF(256) */
++};
++
++
++/* Global data structure for callers */
++
++typedef struct
++{     u_int32_t sBox[4 * 256];                                        /* Key dependent S-box */
++      u_int32_t subKeys[TwoFish_TOTAL_SUBKEYS];       /* Subkeys  */
++      u_int8_t key[TwoFish_KEY_LENGTH];                       /* Encryption Key */
++      u_int8_t *output;                                                       /* Pointer to output buffer */
++      u_int8_t qBlockPlain[TwoFish_BLOCK_SIZE];       /* Used by CBC */
++      u_int8_t qBlockCrypt[TwoFish_BLOCK_SIZE];
++      u_int8_t prevCipher[TwoFish_BLOCK_SIZE];
++      struct                          /* Header for crypt functions. Has to be at least one block long. */
++      {       u_int32_t salt;                                                 /* Random salt in first block (will salt the rest through CBC) */
++              u_int8_t length[4];                                     /* The amount of data following the header */
++              u_int8_t magic[TwoFish_MAGIC_LEN];              /* Magic to identify successful decryption  */
++      }       header;
++      bool qBlockDefined;
++      bool dontflush;
++}     TWOFISH;
++
++#ifndef __TWOFISH_LIBRARY_SOURCE__
++
++extern bool TwoFish_srand;                                    /* if set to TRUE (default), first call of TwoFishInit will seed rand();  */
++                                                                                      /* call of TwoFishInit */
++#endif
++
++
++/**** Public Functions ****/
++
++/*    TwoFish Initialization
++ *
++ *    This routine generates a global data structure for use with TwoFish,
++ *    initializes important values (such as subkeys, sBoxes), generates subkeys
++ *    and precomputes the MDS matrix if not already done.
++ *
++ *    Input:  User supplied password (will be appended by default password of 'SnortHas2FishEncryptionRoutines!')
++ *
++ *  Output:   Pointer to TWOFISH structure. This data structure contains key dependent data.
++ *                    This pointer is used with all other crypt functions.
++ */
++TWOFISH *TwoFishInit(char *userkey);
++
++
++/*    TwoFish Destroy
++ *
++ *    Nothing else but a free...
++ *
++ *    Input:  Pointer to the TwoFish structure.
++ *
++ */
++void TwoFishDestroy(TWOFISH *tfdata);
++
++
++/*    TwoFish Alloc
++ *
++ *    Allocates enough memory for the output buffer as required.
++ *
++ *    Input:  Length of the plaintext.
++ *                    Boolean flag for BinHex Output.
++ *                    Pointer to the TwoFish structure.
++ *
++ *    Output: Returns a pointer to the memory allocated.
++ */
++void *TwoFishAlloc(unsigned long len,bool binhex,bool decrypt,TWOFISH *tfdata);
++
++
++/*    TwoFish Free
++ *
++ *    Free's the allocated buffer.
++ *
++ *    Input:  Pointer to the TwoFish structure
++ *
++ *    Output: (none)
++ */
++void TwoFishFree(TWOFISH *tfdata);
++
++
++/*    TwoFish Set Output
++ *
++ *    If you want to allocate the output buffer yourself,
++ *    then you can set it with this function.
++ *
++ *    Input:  Pointer to your output buffer
++ *                    Pointer to the TwoFish structure
++ *
++ *    Output: (none)
++ */
++void TwoFishSetOutput(char *outp,TWOFISH *tfdata);
++
++
++/*    TwoFish Raw Encryption
++ *
++ *    Does not use header, but does use CBC (if more than one block has to be encrypted).
++ *
++ *    Input:  Pointer to the buffer of the plaintext to be encrypted.
++ *                    Pointer to the buffer receiving the ciphertext.
++ *                    The length of the plaintext buffer.
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes encrypted if successful, otherwise 0.
++ */
++unsigned long TwoFishEncryptRaw(char *in,char *out,unsigned long len,TWOFISH *tfdata);
++
++/*    TwoFish Raw Decryption
++ *
++ *    Does not use header, but does use CBC (if more than one block has to be decrypted).
++ *
++ *    Input:  Pointer to the buffer of the ciphertext to be decrypted.
++ *                    Pointer to the buffer receiving the plaintext.
++ *                    The length of the ciphertext buffer (at least one cipher block).
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes decrypted if successful, otherwise 0.
++ */
++unsigned long TwoFishDecryptRaw(char *in,char *out,unsigned long len,TWOFISH *tfdata);
++
++
++/*    TwoFish Encryption
++ *
++ *    Uses header and CBC. If the output area has not been intialized with TwoFishAlloc,
++ *  this routine will alloc the memory. In addition, it will include a small 'header'
++ *  containing the magic and some salt. That way the decrypt routine can check if the
++ *  packet got decrypted successfully, and return 0 instead of garbage.
++ *
++ *    Input:  Pointer to the buffer of the plaintext to be encrypted.
++ *                    Pointer to the pointer to the buffer receiving the ciphertext.
++ *                            The pointer either points to user allocated output buffer space, or to NULL, in which case
++ *                            this routine will set the pointer to the buffer allocated through the struct.
++ *                    The length of the plaintext buffer.
++ *                            Can be -1 if the input is a null terminated string, in which case we'll count for you.
++ *                    Boolean flag for BinHex Output (if used, output will be twice as large as input).
++ *                            Note: BinHex conversion overwrites (converts) input buffer!
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes encrypted if successful, otherwise 0.
++ */
++unsigned long TwoFishEncrypt(char *in,char **out,signed long len,bool binhex,TWOFISH *tfdata);
++
++
++/*    TwoFish Decryption
++ *
++ *    Uses header and CBC. If the output area has not been intialized with TwoFishAlloc,
++ *  this routine will alloc the memory. In addition, it will check the small 'header'
++ *  containing the magic. If magic does not match we return 0. Otherwise we return the
++ *  amount of bytes decrypted (should be the same as the length in the header).
++ *
++ *    Input:  Pointer to the buffer of the ciphertext to be decrypted.
++ *                    Pointer to the pointer to the buffer receiving the plaintext.
++ *                            The pointer either points to user allocated output buffer space, or to NULL, in which case
++ *                            this routine will set the pointer to the buffer allocated through the struct.
++ *                    The length of the ciphertext buffer.
++ *                            Can be -1 if the input is a null terminated binhex string, in which case we'll count for you.
++ *                    Boolean flag for BinHex Input (if used, plaintext will be half as large as input).
++ *                            Note: BinHex conversion overwrites (converts) input buffer!
++ *                    The TwoFish structure.
++ *
++ *    Output: The amount of bytes decrypted if successful, otherwise 0.
++ */
++unsigned long TwoFishDecrypt(char *in,char **out,signed long len,bool binhex,TWOFISH *tfdata);
++
++
++/**** Private Functions ****/
++
++u_int8_t TwoFish__b(u_int32_t x,int n);
++void _TwoFish_BinHex(u_int8_t *buf,unsigned long len,bool bintohex);
++unsigned long _TwoFish_CryptRawCBC(char *in,char *out,unsigned long len,bool decrypt,TWOFISH *tfdata);
++unsigned long _TwoFish_CryptRaw16(char *in,char *out,unsigned long len,bool decrypt,TWOFISH *tfdata);
++unsigned long _TwoFish_CryptRaw(char *in,char *out,unsigned long len,bool decrypt,TWOFISH *tfdata);
++void _TwoFish_PrecomputeMDSmatrix(void);
++void _TwoFish_MakeSubKeys(TWOFISH *tfdata);
++void _TwoFish_qBlockPush(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata);
++void _TwoFish_qBlockPop(u_int8_t *p,u_int8_t *c,TWOFISH *tfdata);
++void _TwoFish_ResetCBC(TWOFISH *tfdata);
++void _TwoFish_FlushOutput(u_int8_t *b,unsigned long len,TWOFISH *tfdata);
++void _TwoFish_BlockCrypt(u_int8_t *in,u_int8_t *out,unsigned long size,int decrypt,TWOFISH *tfdata);
++void _TwoFish_BlockCrypt16(u_int8_t *in,u_int8_t *out,bool decrypt,TWOFISH *tfdata);
++u_int32_t _TwoFish_RS_MDS_Encode(u_int32_t k0,u_int32_t k1);
++u_int32_t _TwoFish_F32(u_int32_t k64Cnt,u_int32_t x,u_int32_t *k32);
++u_int32_t _TwoFish_Fe320(u_int32_t *lsBox,u_int32_t x);
++u_int32_t _TwoFish_Fe323(u_int32_t *lsBox,u_int32_t x);
++u_int32_t _TwoFish_Fe32(u_int32_t *lsBox,u_int32_t x,u_int32_t R);
++
++
++#endif
diff --git a/net/snortsam/Makefile b/net/snortsam/Makefile
new file mode 100644 (file)
index 0000000..c3aeba6
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2012 OpenWrt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=snortsam
+PKG_VERSION:=2.70
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://val.bmstu.ru/unix/snort/
+PKG_SOURCE:=$(PKG_NAME)-src-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=8ffa32056152e089fbacd601090f941d
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+MAKE_PATH:=src
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/snortsam
+  SUBMENU:=Firewall
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Snortsam
+  URL:=https://www.snortsam.net/
+  DEPENDS:=+libpthread +snort
+endef
+
+define Package/snortsam/description
+ SnortSam is a plugin for Snort, an Intrusion Detection System (IDS). The plugin allows automated blocking of IP addresses.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               $(MAKE_FLAGS) \
+               all
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               $(MAKE_FLAGS) \
+               samtool
+endef
+
+define Package/snortsam/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/snortsam $(PKG_BUILD_DIR)/samtool $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/conf/* $(1)/etc/
+       $(CP) $(PKG_BUILD_DIR)/conf/snortsam.conf.sample $(1)/etc/snortsam.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/snortsam.init $(1)/etc/init.d/snortsam
+endef
+
+$(eval $(call BuildPackage,snortsam))
diff --git a/net/snortsam/files/snortsam.init b/net/snortsam/files/snortsam.init
new file mode 100644 (file)
index 0000000..c39e5af
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+START=99 
+APP=snortsam
+BIN_FILE="/usr/sbin/"$APP
+PID_FILE="/var/run/"$APP".pid"
+PARAMS="/etc/snortsam.conf"
+
+start() {
+       start-stop-daemon -S -x $BIN_FILE -p $PID_FILE -b -m -- $PARAMS
+}
+
+stop() {
+       start-stop-daemon -K -x $BIN_FILE -p $PID_FILE -q
+       rm -rf $PID_FILE
+}
diff --git a/net/snortsam/patches/100-iptables-path-fix.patch b/net/snortsam/patches/100-iptables-path-fix.patch
new file mode 100644 (file)
index 0000000..971a706
--- /dev/null
@@ -0,0 +1,179 @@
+diff -ruN snortsam-orig/contrib/snortsam-state.c snortsam/contrib/snortsam-state.c
+--- snortsam-orig/contrib/snortsam-state.c     2012-10-10 10:05:33.037907601 +0200
++++ snortsam/contrib/snortsam-state.c  2012-10-10 10:07:19.677910382 +0200
+@@ -256,13 +256,13 @@
+       addr.s_addr = bi->blockip;
+-      sprintf(buffer, "/sbin/iptables -D INPUT -i %s -s %s -j DROP",
++      sprintf(buffer, "/usr/sbin/iptables -D INPUT -i %s -s %s -j DROP",
+               iface, inet_ntoa(addr));
+       if(!(h = popen(buffer, "r")) || pclose(h) != 0)
+               fprintf(stderr, "%s: failed: %s\n", name, buffer);
+-      sprintf(buffer, "/sbin/iptables -D FORWARD -i %s -s %s -j DROP",
++      sprintf(buffer, "/usr/sbin/iptables -D FORWARD -i %s -s %s -j DROP",
+               iface, inet_ntoa(addr));
+       if(!(h = popen(buffer, "r")) || pclose(h) != 0)
+diff -ruN snortsam-orig/src/ssp_iptables.c snortsam/src/ssp_iptables.c
+--- snortsam-orig/src/ssp_iptables.c   2012-10-10 10:05:33.037907601 +0200
++++ snortsam/src/ssp_iptables.c        2012-10-10 10:07:09.333910113 +0200
+@@ -109,7 +109,7 @@
+       /*Nuevo*/
+       char iptcmd1[255],iptcmd4[255];
+ #ifdef SAVETABLES
+-      const char savecmd[]="/sbin/iptables-save -c > /etc/sysconfig/iptables";
++      const char savecmd[]="/usr/sbin/iptables-save -c > /etc/sysconfig/iptables";
+ #endif
+ #ifdef FWSAMDEBUG
+@@ -131,14 +131,14 @@
+               {       case FWSAM_HOW_IN:      \r
+         /* Assemble command */\r
+         if (snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -I FORWARD -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -I FORWARD -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+           }\r
+         if (snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -I INPUT -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -I INPUT -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd2)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -148,14 +148,14 @@
+                 case FWSAM_HOW_OUT:   \r
+         /* Assemble command */\r
+         if (snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -I FORWARD -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -I FORWARD -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+           }\r
+         if (snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -I INPUT -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -I INPUT -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd2)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -165,18 +165,18 @@
+                 case FWSAM_HOW_INOUT: \r
+         /* Assemble command - block src*/\r
+               if ((snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -I FORWARD -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -I FORWARD -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd)) || (snprintf(iptcmd1,sizeof(iptcmd1)-1,\r
+-              "/sbin/iptables -I FORWARD -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -I FORWARD -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd1))) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+           }\r
+               if ((snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -I INPUT -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -I INPUT -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd2)) || (snprintf(iptcmd4,sizeof(iptcmd4)-1,\r
+-              "/sbin/iptables -I INPUT -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -I INPUT -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd4))) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -186,14 +186,14 @@
+                 case FWSAM_HOW_THIS:  \r
+         /* Assemble command */\r
+         if (snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -I FORWARD -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
++              "/usr/sbin/iptables -I FORWARD -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
+               iptp->iface, inettoa(bd->blockip), inettoa(bd->peerip), bd->proto, bd->port) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+           }\r
+         if (snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -I INPUT -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
++              "/usr/sbin/iptables -I INPUT -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
+               iptp->iface, inettoa(bd->blockip), inettoa(bd->peerip), bd->proto, bd->port) >= sizeof(iptcmd2)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -210,14 +210,14 @@
+       {       case FWSAM_HOW_IN:      \r
+           /* Assemble command */\r
+           if (snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -D FORWARD -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -D FORWARD -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+         }\r
+           if (snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -D INPUT -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -D INPUT -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd2)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -227,14 +227,14 @@
+               case FWSAM_HOW_OUT:     \r
+                /* Assemble command */\r
+           if (snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -D FORWARD -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -D FORWARD -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+         }\r
+           if (snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -D INPUT -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -D INPUT -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd2)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -244,18 +244,18 @@
+               case FWSAM_HOW_INOUT:   \r
+         /* Assemble command - block src*/\r
+               if ((snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -D FORWARD -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -D FORWARD -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd)) || (snprintf(iptcmd1,sizeof(iptcmd1)-1,\r
+-              "/sbin/iptables -D FORWARD -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -D FORWARD -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd1))) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+           }\r
+               if ((snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -D INPUT -i %s  -s %s -j DROP",\r
++              "/usr/sbin/iptables -D INPUT -i %s  -s %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd2)) || (snprintf(iptcmd4,sizeof(iptcmd4)-1,\r
+-              "/sbin/iptables -D INPUT -i %s  -d %s -j DROP",\r
++              "/usr/sbin/iptables -D INPUT -i %s  -d %s -j DROP",\r
+               iptp->iface, inettoa(bd->blockip)) >= sizeof(iptcmd4))) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
+@@ -265,14 +265,14 @@
+                 case FWSAM_HOW_THIS:  \r
+         /* Assemble command */\r
+         if (snprintf(iptcmd,sizeof(iptcmd)-1,\r
+-              "/sbin/iptables -D FORWARD -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
++              "/usr/sbin/iptables -D FORWARD -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
+               iptp->iface, inettoa(bd->blockip), inettoa(bd->peerip), bd->proto, bd->port) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command %s is too long", iptcmd);\r
+                 logmessage(1,msg,"iptables",0);\r
+               return;\r
+           }\r
+         if (snprintf(iptcmd2,sizeof(iptcmd2)-1,\r
+-              "/sbin/iptables -D INPUT -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
++              "/usr/sbin/iptables -D INPUT -i %s  -s %s  -d %s  -p %d  --dport %d -j DROP",\r
+               iptp->iface, inettoa(bd->blockip), inettoa(bd->peerip), bd->proto, bd->port) >= sizeof(iptcmd)) {\r
+                 snprintf(msg,sizeof(msg)-1,"Error: Command2 %s is too long", iptcmd2);\r
+                 logmessage(1,msg,"iptables",0);\r
diff --git a/net/socat/Makefile b/net/socat/Makefile
new file mode 100644 (file)
index 0000000..ae8d55b
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006-2012 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:=socat
+PKG_VERSION:=1.7.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.dest-unreach.org/socat/download
+PKG_MD5SUM:=7ddfea7e9e85f868670f94d3ea08358b
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/socat
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpthread
+  TITLE:=A multipurpose relay (SOcket CAT)
+  URL:=http://www.dest-unreach.org/socat/
+endef
+
+define Package/socat/description
+       SoCat (for SOcket CAT) establishes two bidirectional byte streams and
+       transfers data between them.
+       Data channels may be files, pipes, devices (terminal or modem, etc.), or
+       sockets (Unix, IPv4, IPv6, raw, UDP, TCP, SSL). It provides forking,
+       logging and tracing, different modes for interprocess communication and
+       many more options.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-libwrap \
+       --disable-readline \
+       --disable-openssl \
+       --enable-termios
+
+CONFIGURE_VARS += \
+       sc_cv_termios_ispeed="no" \
+       sc_cv_sys_crdly_shift=9 \
+       sc_cv_sys_tabdly_shift=11 \
+       sc_cv_sys_csize_shift=4
+
+define Package/socat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/socat $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,socat))
diff --git a/net/socat/patches/501-honor_ldflags.patch b/net/socat/patches/501-honor_ldflags.patch
new file mode 100644 (file)
index 0000000..0dbc773
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -38,7 +38,8 @@ INSTALL = @INSTALL@
+ #0 CFLAGS = @CFLAGS@ $(CCOPTS) $(DEFS) $(INCLS)
+ CFLAGS = @CFLAGS@ $(CCOPTS) $(DEFS) $(CPPFLAGS)
+-CLIBS = $(LIBS)
++LDFLAGS = @LDFLAGS@
++CLIBS = $(LDFLAGS) $(LIBS)
+ #CLIBS = $(LIBS) -lm -lefence
+ XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
+       xiosignal.c xiosigchld.c xioread.c xiowrite.c \
diff --git a/net/spawn-fcgi/Makefile b/net/spawn-fcgi/Makefile
new file mode 100644 (file)
index 0000000..560f3be
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2006-2009 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:=spawn-fcgi
+PKG_VERSION:=1.6.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.lighttpd.net/download/
+PKG_MD5SUM:=787ed2f88d2204bf1fe4fbd6e509d1d7
+
+PKG_INSTALL = 1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/spawn-fcgi
+  SUBMENU:=Web Servers/Proxies
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Tool to spawn fastcgi applications
+  URL:=http://redmine.lighttpd.net/projects/spawn-fcgi
+endef
+
+define Package/spawn-fcgi/description
+       spawn-fcgi is used to spawn fastcgi applications
+endef
+
+define Package/spawn-fcgi/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/spawn-fcgi $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,spawn-fcgi))
diff --git a/net/speedtouch-usb-firmware/Makefile b/net/speedtouch-usb-firmware/Makefile
new file mode 100644 (file)
index 0000000..f2a4afd
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2008 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:=speedtouch-usb-firmware
+PKG_VERSION:=3
+PKG_RELEASE:=012
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/speedtouch-usb-firmware-$(PKG_VERSION)
+PKG_SOURCE:=SpeedTouch330_firmware_$(PKG_VERSION)$(PKG_RELEASE).zip
+PKG_SOURCE_URL:=http://www.speedtouch.com/download/drivers/USB/
+PKG_MD5SUM:=2551ce46ef785642f2c6768511f70ff3
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/speedtouch-usb-firmware
+  SUBMENU:=firmware
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=SpeedTouch 330 ADSL USB firmware
+  DEPENDS:=+kmod-usb-atm +kmod-usb-atm-speedtouch
+  PKGARCH:=all
+endef
+
+define Package/speedtouch-usb-firmware/description
+       This package add the firmware for SpeedTouch330 ADSL USB modem.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       mv $(PKG_BUILD_DIR)/../KQD6_$(PKG_VERSION).$(PKG_RELEASE) $(PKG_BUILD_DIR)/
+       mv $(PKG_BUILD_DIR)/../ZZZL_$(PKG_VERSION).$(PKG_RELEASE) $(PKG_BUILD_DIR)/
+       # next lines from Gentoo ebuild
+       # Extract the "stage 1" portion of the firmware
+       dd if=$(PKG_BUILD_DIR)/KQD6_$(PKG_VERSION).$(PKG_RELEASE) \
+               of=$(PKG_BUILD_DIR)/speedtch-1.bin.2 ibs=1 obs=991 count=991 skip=36
+       dd if=$(PKG_BUILD_DIR)/ZZZL_$(PKG_VERSION).$(PKG_RELEASE) \
+               of=$(PKG_BUILD_DIR)/speedtch-1.bin.4 ibs=1 obs=935 count=935 skip=32
+       # Extract the "stage 2" portion of the firmware
+       dd if=$(PKG_BUILD_DIR)/KQD6_$(PKG_VERSION).$(PKG_RELEASE) \
+               of=$(PKG_BUILD_DIR)/speedtch-2.bin.2 ibs=1 obs=762650 count=762650 skip=1027
+       dd if=$(PKG_BUILD_DIR)/ZZZL_$(PKG_VERSION).$(PKG_RELEASE) \
+               of=$(PKG_BUILD_DIR)/speedtch-2.bin.4 ibs=1 obs=775545 count=775545 skip=967
+endef
+
+define Package/speedtouch-usb-firmware/install
+       $(INSTALL_DIR) -d $(1)/lib/firmware
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/speedtch-1.bin.2 $(1)/lib/firmware
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/speedtch-1.bin.4 $(1)/lib/firmware
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/speedtch-2.bin.2 $(1)/lib/firmware
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/speedtch-2.bin.4 $(1)/lib/firmware
+endef
+
+define Package/speedtouch-usb-firmware/postinst
+#!/bin/sh
+# Symlinks for other revisions of the modem
+cd "$${IPKG_INSTROOT}/lib/firmware"
+for n in 1 2 ; do
+       for rev in 0 1 ; do
+               ln -sfn speedtch-$${n}.bin.2 speedtch-$${n}.bin.$${rev}
+       done
+       # Seems like a reasonable guess, for revision 3
+       ln -sfn speedtch-$${stub}$${n}.bin.4 speedtch-$${n}.bin.3
+done
+endef
+
+$(eval $(call BuildPackage,speedtouch-usb-firmware))
diff --git a/net/squid/Makefile b/net/squid/Makefile
new file mode 100644 (file)
index 0000000..04d2d7b
--- /dev/null
@@ -0,0 +1,189 @@
+#
+# Copyright (C) 2006-2012 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:=squid
+PKG_VERSION:=2.7.STABLE9
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.squid-cache.org/Versions/v2/2.7/
+PKG_MD5SUM:=3c6642c85470b1079207d43bba25a819
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/squid/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  URL:=http://www.squid-cache.org/
+endef
+
+define Package/squid
+  $(call Package/squid/Default)
+  MENU:=1
+  DEPENDS:=+libopenssl +libpthread
+  TITLE:=full-featured Web proxy cache
+endef
+
+define Package/squid/description
+       Squid is a high-performance proxy caching server for web clients,
+       supporting FTP, gopher, and HTTP data objects. Unlike traditional
+       caching software, Squid handles all requests in a single,
+       non-blocking, I/O-driven process.
+endef
+
+define Package/squid/conffiles
+/etc/squid/mime.conf
+/etc/squid/squid.conf
+endef
+
+define Package/squid-mod-cachemgr
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=Web based proxy manager and reporting tool
+endef
+
+define Package/squid-mod-basic-auth-getpwnam
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=getpwnam basic authentication helper
+endef
+
+define Package/squid-mod-basic-auth-ncsa
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=NCSA basic authentication helper
+endef
+
+define Package/squid-mod-basic-auth-smb
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=Samba basic authentication helper
+endef
+
+define Package/squid-mod-digest-auth-password
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=Password digest authentication helper
+endef
+
+define Package/squid-mod-external-acl-ip-user
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=IP user external ACL helper
+endef
+
+define Package/squid-mod-external-acl-unix-group
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=Unix group external ACL helper
+endef
+
+define Package/squid-mod-ntlm-auth-fakeauth
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=Fakeauth NTLM authentication helper
+endef
+
+define Package/squid-mod-ntlm-auth-smb-auth
+  $(call Package/squid/Default)
+  DEPENDS:=squid
+  TITLE:=Samba NTLM authentication helper
+endef
+
+CONFIGURE_ARGS += \
+       --datadir=/usr/share/squid \
+       --libexecdir=/usr/lib/squid \
+       --sysconfdir=/etc/squid \
+       --enable-shared \
+       --enable-static \
+       --enable-x-accelerator-vary \
+       --with-pthreads \
+       --with-dl \
+       --enable-icmp \
+       --enable-kill-parent-hack \
+       --enable-arp-acl \
+       --enable-ssl \
+       --enable-htcp \
+       --enable-err-languages=English \
+       --enable-default-err-language=English \
+       --enable-linux-netfilter \
+       --enable-icmp \
+       --enable-external-acl-helpers="" \
+       --enable-underscores \
+       --enable-cache-digests \
+       --enable-referer-log \
+       --enable-delay-pools \
+       --enable-useragent-log \
+       --with-openssl=$(STAGING_DIR)/usr \
+       --enable-auth="basic digest ntlm" \
+       --enable-basic-auth-helpers="getpwnam NCSA SMB" \
+       --enable-ntlm-auth-helpers="fakeauth SMB" \
+       --enable-digest-auth-helpers="password" \
+       --enable-external-acl-helpers="ip_user unix_group" \
+       --enable-storeio=null,ufs \
+       --enable-epoll \
+       --with-maxfd=4096 \
+       --without-libcap
+
+CONFIGURE_VARS += \
+       ac_cv_header_linux_netfilter_ipv4_h=yes \
+       ac_cv_epoll_works=yes \
+
+define Build/Compile
+       # pass INCLUDES to compile host sources against our OpenSSL, not the host one
+       $(MAKE) -C $(PKG_BUILD_DIR)/lib \
+               all
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/squid
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/squid/$(2) $$(1)/usr/lib/squid/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+define Package/squid/install
+       $(INSTALL_DIR) $(1)/etc/squid
+       $(CP) $(PKG_INSTALL_DIR)/etc/squid/mime.conf $(1)/etc/squid/
+       $(CP) $(PKG_INSTALL_DIR)/etc/squid/squid.conf $(1)/etc/squid/
+       $(INSTALL_DIR) $(1)/usr/share/squid
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/squid/* $(1)/usr/share/squid/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/squid $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/squid
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/squid/{unlinkd,pinger,logfile-daemon} $(1)/usr/lib/squid/
+endef
+
+define Package/squid-mod-cachemgr/install
+       $(INSTALL_DIR) $(1)/www/cgi-bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/squid/cachemgr.cgi $(1)/www/cgi-bin/
+endef
+
+$(eval $(call RequireHeader,/usr/include/openssl/ssl.h, \
+       $(PKG_NAME) requires the openssl development (named like libssl-dev, \
+       depending of your package manager) package be installed on the host-system. \
+))
+
+$(eval $(call BuildPackage,squid))
+$(eval $(call BuildPackage,squid-mod-cachemgr))
+$(eval $(call BuildPlugin,squid-mod-basic-auth-getpwnam,getpwname_auth))
+$(eval $(call BuildPlugin,squid-mod-basic-auth-ncsa,ncsa_auth))
+$(eval $(call BuildPlugin,squid-mod-basic-auth-smb,smb_auth))
+$(eval $(call BuildPlugin,squid-mod-digest-auth-password,digest_pw_auth))
+$(eval $(call BuildPlugin,squid-mod-external-acl-ip-user,ip_user_check))
+$(eval $(call BuildPlugin,squid-mod-external-acl-unix-group,squid_unix_group))
+$(eval $(call BuildPlugin,squid-mod-ntlm-auth-fakeauth,fakeauth_auth))
+$(eval $(call BuildPlugin,squid-mod-ntlm-auth-smb-auth,ntlm_auth))
+
diff --git a/net/squid/patches/001-cross_compile.patch b/net/squid/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..f2648d9
--- /dev/null
@@ -0,0 +1,561 @@
+--- /dev/null
++++ b/src/ctype.c
+@@ -0,0 +1,546 @@
++/*
++ Static ctype data for IFC-7.1 / RedHat-9 workaround.
++ This is taken from the GLIBC source code.
++ Hack by Joe Krahn <krahn@niehs.nih.gov>
++
++ To use, compile with gcc (ifc should work as well):
++
++   gcc -c ctype.c
++
++ Next, include the resulting ctype.o when creating executables.
++ Do this automatically using a ~/.ifcrc file with a line like this:
++  
++   -Wl,/some/path/ctype.o
++
++ That's all.
++
++ My .ifcrc also turns off the typically excessive warnings:
++   -cm -w90 -w95 -Wl,/home/krahn/Prog/ctype/ctype.o
++ 
++ To IFC maintainters: it would be nice to flag on/off specific
++ warning types, like -woff=22,33,44
++
++*/
++
++/*
++  file: ctype.c
++
++  Derived from C-ctype.c and ctype-info.c in the GLIBC 2.3 source.
++
++  To compile: (either gcc or icc is OK)
++      icc -c ctype.c
++
++  To use, just add the object file ctype.o at link stage. Example:
++      ifc -o hello hello.f ctype.o
++
++*/
++
++
++/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#include <stdint.h>
++
++/* This table's entries are taken from POSIX.2 Table 2-6
++   ``LC_CTYPE Category Definition in the POSIX Locale''.
++
++   The `_nl_C_LC_CTYPE_width' array is a GNU extension.
++
++   In the `_nl_C_LC_CTYPE_class' array the value for EOF (== -1)
++   is set to always return 0 and the conversion arrays return EOF.  */
++
++const char _nl_C_LC_CTYPE_class[768] =
++  /* 0x80 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x86 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x8c */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x92 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x98 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x9e */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xa4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xaa */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xb0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xb6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xbc */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xc2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xc8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xce */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xd4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xda */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xe0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xe6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xec */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xf2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xf8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xfe */ "\000\000" "\000\000" "\002\000" "\002\000" "\002\000" "\002\000"
++  /* 0x04 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\003\040"
++  /* 0x0a */ "\002\040" "\002\040" "\002\040" "\002\040" "\002\000" "\002\000"
++  /* 0x10 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
++  /* 0x16 */ "\002\000" "\002\000" "\002\000" "\002\000" "\002\000" "\002\000"
++  /* 0x1c */ "\002\000" "\002\000" "\002\000" "\002\000" "\001\140" "\004\300"
++  /* 0x22 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
++  /* 0x28 */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
++  /* 0x2e */ "\004\300" "\004\300" "\010\330" "\010\330" "\010\330" "\010\330"
++  /* 0x34 */ "\010\330" "\010\330" "\010\330" "\010\330" "\010\330" "\010\330"
++  /* 0x3a */ "\004\300" "\004\300" "\004\300" "\004\300" "\004\300" "\004\300"
++  /* 0x40 */ "\004\300" "\010\325" "\010\325" "\010\325" "\010\325" "\010\325"
++  /* 0x46 */ "\010\325" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
++  /* 0x4c */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
++  /* 0x52 */ "\010\305" "\010\305" "\010\305" "\010\305" "\010\305" "\010\305"
++  /* 0x58 */ "\010\305" "\010\305" "\010\305" "\004\300" "\004\300" "\004\300"
++  /* 0x5e */ "\004\300" "\004\300" "\004\300" "\010\326" "\010\326" "\010\326"
++  /* 0x64 */ "\010\326" "\010\326" "\010\326" "\010\306" "\010\306" "\010\306"
++  /* 0x6a */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
++  /* 0x70 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\010\306"
++  /* 0x76 */ "\010\306" "\010\306" "\010\306" "\010\306" "\010\306" "\004\300"
++  /* 0x7c */ "\004\300" "\004\300" "\004\300" "\002\000" "\000\000" "\000\000"
++  /* 0x82 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x88 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x8e */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x94 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0x9a */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xa0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xa6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xac */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xb2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xb8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xbe */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xc4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xca */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xd0 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xd6 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xdc */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xe2 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xe8 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xee */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xf4 */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++  /* 0xfa */ "\000\000" "\000\000" "\000\000" "\000\000" "\000\000" "\000\000"
++;
++const char _nl_C_LC_CTYPE_class32[1024] =
++  /* 0x00 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x03 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x06 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x09 */ "\000\000\003\040" "\000\000\002\040" "\000\000\002\040"
++  /* 0x0c */ "\000\000\002\040" "\000\000\002\040" "\000\000\002\000"
++  /* 0x0f */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x12 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x15 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x18 */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x1b */ "\000\000\002\000" "\000\000\002\000" "\000\000\002\000"
++  /* 0x1e */ "\000\000\002\000" "\000\000\002\000" "\000\000\001\140"
++  /* 0x21 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x24 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x27 */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x2a */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x2d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x30 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330"
++  /* 0x33 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330"
++  /* 0x36 */ "\000\000\010\330" "\000\000\010\330" "\000\000\010\330"
++  /* 0x39 */ "\000\000\010\330" "\000\000\004\300" "\000\000\004\300"
++  /* 0x3c */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x3f */ "\000\000\004\300" "\000\000\004\300" "\000\000\010\325"
++  /* 0x42 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\325"
++  /* 0x45 */ "\000\000\010\325" "\000\000\010\325" "\000\000\010\305"
++  /* 0x48 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
++  /* 0x4b */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
++  /* 0x4e */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
++  /* 0x51 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
++  /* 0x54 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
++  /* 0x57 */ "\000\000\010\305" "\000\000\010\305" "\000\000\010\305"
++  /* 0x5a */ "\000\000\010\305" "\000\000\004\300" "\000\000\004\300"
++  /* 0x5d */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x60 */ "\000\000\004\300" "\000\000\010\326" "\000\000\010\326"
++  /* 0x63 */ "\000\000\010\326" "\000\000\010\326" "\000\000\010\326"
++  /* 0x66 */ "\000\000\010\326" "\000\000\010\306" "\000\000\010\306"
++  /* 0x69 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
++  /* 0x6c */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
++  /* 0x6f */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
++  /* 0x72 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
++  /* 0x75 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
++  /* 0x78 */ "\000\000\010\306" "\000\000\010\306" "\000\000\010\306"
++  /* 0x7b */ "\000\000\004\300" "\000\000\004\300" "\000\000\004\300"
++  /* 0x7e */ "\000\000\004\300" "\000\000\002\000" "\000\000\000\000"
++  /* 0x81 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x84 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x87 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x8a */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x8d */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x90 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x93 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x96 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x99 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x9c */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0x9f */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xa2 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xa5 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xa8 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xab */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xae */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xb1 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xb4 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xb7 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xba */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xbd */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xc0 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xc3 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xc6 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xc9 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xcc */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xcf */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xd2 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xd5 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xd8 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xdb */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xde */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xe1 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xe4 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xe7 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xea */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xed */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xf0 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xf3 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xf6 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xf9 */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xfc */ "\000\000\000\000" "\000\000\000\000" "\000\000\000\000"
++  /* 0xff */ "\000\000\000\000"
++;
++const uint32_t _nl_C_LC_CTYPE_toupper[384] =
++{
++  /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
++  /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
++  /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
++  /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
++  /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
++  /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
++  /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
++  /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
++  /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
++  /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
++  /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
++  /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
++  /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
++  /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
++  /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
++  /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xffffffff,
++  /* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
++  /* 0x08 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
++  /* 0x10 */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
++  /* 0x18 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
++  /* 0x20 */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
++  /* 0x28 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
++  /* 0x30 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
++  /* 0x38 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
++  /* 0x40 */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
++  /* 0x48 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
++  /* 0x50 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
++  /* 0x58 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
++  /* 0x60 */ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
++  /* 0x68 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
++  /* 0x70 */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
++  /* 0x78 */ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
++  /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
++  /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
++  /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
++  /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
++  /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
++  /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
++  /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
++  /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
++  /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
++  /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
++  /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
++  /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
++  /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
++  /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
++  /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
++  /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
++};
++const uint32_t _nl_C_LC_CTYPE_tolower[384] =
++{
++  /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
++  /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
++  /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
++  /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
++  /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
++  /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
++  /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
++  /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
++  /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
++  /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
++  /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
++  /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
++  /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
++  /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
++  /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
++  /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xffffffff,
++  /* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
++  /* 0x08 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
++  /* 0x10 */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
++  /* 0x18 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
++  /* 0x20 */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
++  /* 0x28 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
++  /* 0x30 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
++  /* 0x38 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
++  /* 0x40 */ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
++  /* 0x48 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
++  /* 0x50 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
++  /* 0x58 */ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
++  /* 0x60 */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
++  /* 0x68 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
++  /* 0x70 */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
++  /* 0x78 */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
++  /* 0x80 */ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
++  /* 0x88 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
++  /* 0x90 */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
++  /* 0x98 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
++  /* 0xa0 */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
++  /* 0xa8 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
++  /* 0xb0 */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
++  /* 0xb8 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
++  /* 0xc0 */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
++  /* 0xc8 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
++  /* 0xd0 */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
++  /* 0xd8 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
++  /* 0xe0 */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
++  /* 0xe8 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
++  /* 0xf0 */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
++  /* 0xf8 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
++};
++
++#define STRUCT_CTYPE_CLASS(p, q) \
++  struct                                                                      \
++    {                                                                         \
++      uint32_t isctype_data[8];                                               \
++      uint32_t header[5];                                                     \
++      uint32_t level1[1];                                                     \
++      uint32_t level2[1 << q];                                                \
++      uint32_t level3[1 << p];                                                \
++    }
++
++const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_upper =
++{
++  { 0x00000000, 0x00000000, 0x07fffffe, 0x00000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 6, 1, 1 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 0, 8 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x07fffffe, 0x00000000 }
++};
++const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_lower =
++{
++  { 0x00000000, 0x00000000, 0x00000000, 0x07fffffe,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 6, 1, 1 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 0, 8 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0x07fffffe }
++};
++const STRUCT_CTYPE_CLASS(1, 1) _nl_C_LC_CTYPE_class_alpha =
++{
++  { 0x00000000, 0x00000000, 0x07fffffe, 0x07fffffe,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 6, 1, 1 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 0, 8 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x07fffffe, 0x07fffffe }
++};
++const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_digit =
++{
++  { 0x00000000, 0x03ff0000, 0x00000000, 0x00000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 6, 1, 6, 0, 1 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0x03ff0000 }
++};
++const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_xdigit =
++{
++  { 0x00000000, 0x03ff0000, 0x0000007e, 0x0000007e,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 7, 0, 3 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0x03ff0000, 0x0000007e, 0x0000007e }
++};
++const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_space =
++{
++  { 0x00003e00, 0x00000001, 0x00000000, 0x00000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 6, 1, 6, 0, 1 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00003e00, 0x00000001 }
++};
++const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_print =
++{
++  { 0x00000000, 0xffffffff, 0xffffffff, 0x7fffffff,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 7, 0, 3 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0xffffffff, 0xffffffff, 0x7fffffff }
++};
++const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_graph =
++{
++  { 0x00000000, 0xfffffffe, 0xffffffff, 0x7fffffff,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 7, 0, 3 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0xfffffffe, 0xffffffff, 0x7fffffff }
++};
++const STRUCT_CTYPE_CLASS(1, 0) _nl_C_LC_CTYPE_class_blank =
++{
++  { 0x00000200, 0x00000001, 0x00000000, 0x00000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 6, 1, 6, 0, 1 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000200, 0x00000001 }
++};
++const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_cntrl =
++{
++  { 0xffffffff, 0x00000000, 0x00000000, 0x80000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 7, 0, 3 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0xffffffff, 0x00000000, 0x00000000, 0x80000000 }
++};
++const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_punct =
++{
++  { 0x00000000, 0xfc00fffe, 0xf8000001, 0x78000001,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 7, 0, 3 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0xfc00fffe, 0xf8000001, 0x78000001 }
++};
++const STRUCT_CTYPE_CLASS(2, 0) _nl_C_LC_CTYPE_class_alnum =
++{
++  { 0x00000000, 0x03ff0000, 0x07fffffe, 0x07fffffe,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  },
++  { 7, 1, 7, 0, 3 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 7 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  { 0x00000000, 0x03ff0000, 0x07fffffe, 0x07fffffe }
++};
++
++const struct
++{
++  uint32_t header[5];
++  uint32_t level1[1];
++  uint32_t level2[4];
++  int32_t level3[32];
++}
++_nl_C_LC_CTYPE_map_toupper =
++{
++  { 7, 1, 5, 3, 31 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 0, 0, 0, 10 * sizeof (uint32_t) },
++  /* 3rd-level table */
++  {
++    0x00000000, 0xffffffe0, 0xffffffe0, 0xffffffe0,
++    0xffffffe0, 0xffffffe0, 0xffffffe0, 0xffffffe0,
++    0xffffffe0, 0xffffffe0, 0xffffffe0, 0xffffffe0,
++    0xffffffe0, 0xffffffe0, 0xffffffe0, 0xffffffe0,
++    0xffffffe0, 0xffffffe0, 0xffffffe0, 0xffffffe0,
++    0xffffffe0, 0xffffffe0, 0xffffffe0, 0xffffffe0,
++    0xffffffe0, 0xffffffe0, 0xffffffe0, 0x00000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  }
++},
++_nl_C_LC_CTYPE_map_tolower =
++{
++  { 7, 1, 5, 3, 31 },
++  /* 1st-level table */
++  { 6 * sizeof (uint32_t) },
++  /* 2nd-level table */
++  { 0, 0, 10 * sizeof (uint32_t), 0 },
++  /* 3rd-level table */
++  {
++    0x00000000, 0x00000020, 0x00000020, 0x00000020,
++    0x00000020, 0x00000020, 0x00000020, 0x00000020,
++    0x00000020, 0x00000020, 0x00000020, 0x00000020,
++    0x00000020, 0x00000020, 0x00000020, 0x00000020,
++    0x00000020, 0x00000020, 0x00000020, 0x00000020,
++    0x00000020, 0x00000020, 0x00000020, 0x00000020,
++    0x00000020, 0x00000020, 0x00000020, 0x00000000,
++    0x00000000, 0x00000000, 0x00000000, 0x00000000
++  }
++};
++
++#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o)
++
++const uint16_t *__ctype_b = b (uint16_t, class, 128);
++const uint32_t *__ctype32_b = b (uint32_t, class32, 0);
++const int32_t *__ctype_tolower = b (int32_t, tolower, 128);
++const int32_t *__ctype_toupper = b (int32_t, toupper, 128);
++const uint32_t *__ctype32_tolower = b (uint32_t, tolower, 128);
++const uint32_t *__ctype32_toupper = b (uint32_t, toupper, 128);
++
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -1234,6 +1234,9 @@ squid.conf.default: cf_parser.h
+       true
+ cf_parser.h: cf.data cf_gen$(EXEEXT)
++      rm -f cf_gen
++      gcc -c ctype.c
++      gcc -o cf_gen cf_gen.c -DNODEBUG=1 -I./ -I../ -I../include/ -L../lib -lmiscutil$(shell uname -m) -lm -lnsl -Wl,ctype.o
+       ./cf_gen cf.data $(srcdir)/cf.data.depend
+ cf_gen_defines.h: $(srcdir)/cf_gen_defines $(srcdir)/cf.data.pre
diff --git a/net/squid/patches/002-no_sslv2.patch b/net/squid/patches/002-no_sslv2.patch
new file mode 100644 (file)
index 0000000..c5c0f0e
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/src/ssl_support.c
++++ b/src/ssl_support.c
+@@ -446,10 +446,12 @@ sslCreateServerContext(const char *certf
+     ERR_clear_error();
+     debug(83, 1) ("Initialising SSL.\n");
+     switch (version) {
++#ifndef OPENSSL_NO_SSL2
+     case 2:
+       debug(83, 5) ("Using SSLv2.\n");
+       method = SSLv2_server_method();
+       break;
++#endif
+     case 3:
+       debug(83, 5) ("Using SSLv3.\n");
+       method = SSLv3_server_method();
diff --git a/net/squid/patches/003-configure.patch b/net/squid/patches/003-configure.patch
new file mode 100644 (file)
index 0000000..c58b29e
--- /dev/null
@@ -0,0 +1,50 @@
+--- a/configure
++++ b/configure
+@@ -5059,10 +5059,6 @@ _ACEOF
+   if test -z "$SSLLIB"; then
+     SSLLIB="-lcrypto" # for MD5 routines
+   fi
+-  if $PKGCONFIG --exists openssl; then
+-    SSLLIB="`$PKGCONFIG --libs openssl`"
+-    SSLFLAGS="`$PKGCONFIG --cflags openssl`"
+-  fi
+   CPPFLAGS="${SSLFLAGS} $CPPFLAGS"
+ fi
+@@ -27318,7 +27314,7 @@ else
+ See \`config.log' for more details." >&5
+ $as_echo "$as_me: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   { (true); true; }; }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -27481,8 +27477,7 @@ else
+   { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+ $as_echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&2;} }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -27733,7 +27728,7 @@ else
+ See \`config.log' for more details." >&5
+ $as_echo "$as_me: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   { (true); true; }; }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -27815,7 +27810,7 @@ else
+ See \`config.log' for more details." >&5
+ $as_echo "$as_me: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   { (true); true; }; }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
diff --git a/net/squid/patches/004-include-autoconf.patch b/net/squid/patches/004-include-autoconf.patch
new file mode 100644 (file)
index 0000000..9ed4360
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/include/autoconf.h.in
++++ b/include/autoconf.h.in
+@@ -313,10 +313,10 @@
+ #undef HAVE_OPENSSL_ERR_H
+ /* Define to 1 if you have the <openssl/md5.h> header file. */
+-#undef HAVE_OPENSSL_MD5_H
++#define HAVE_OPENSSL_MD5_H 1
+ /* Define to 1 if you have the <openssl/ssl.h> header file. */
+-#undef HAVE_OPENSSL_SSL_H
++#define HAVE_OPENSSL_SSL_H 1
+ /* Define to 1 if you have the <paths.h> header file. */
+ #undef HAVE_PATHS_H
diff --git a/net/squid/patches/005-lib-makefile.patch b/net/squid/patches/005-lib-makefile.patch
new file mode 100644 (file)
index 0000000..06b7955
--- /dev/null
@@ -0,0 +1,179 @@
+--- a/lib/Makefile.in
++++ b/lib/Makefile.in
+@@ -60,8 +60,10 @@ am__libmiscutil_a_SOURCES_DIST = Array.c
+       rfc1123.c rfc1738.c rfc2617.c safe_inet_addr.c snprintf.c \
+       splay.c Stack.c strsep.c stub_memaccount.c util.c uudecode.c \
+       win32lib.c
++@NEED_OWN_MD5_TRUE@am__host_objects_1 = md5.$(HOST_OBJEXT)
+ @NEED_OWN_SNPRINTF_TRUE@am__objects_1 = snprintf.$(OBJEXT)
+ @NEED_OWN_STRSEP_TRUE@am__objects_2 = strsep.$(OBJEXT)
++@NEED_OWN_SNPRINTF_TRUE@am__host_objects_2 = snprintf.$(HOST_OBJEXT)
+ @ENABLE_MINGW32SPECIFIC_TRUE@am__objects_3 = win32lib.$(OBJEXT)
+ am_libmiscutil_a_OBJECTS = Array.$(OBJEXT) base64.$(OBJEXT) \
+       getfullhostname.$(OBJEXT) hash.$(OBJEXT) heap.$(OBJEXT) \
+@@ -71,7 +73,19 @@ am_libmiscutil_a_OBJECTS = Array.$(OBJEX
+       $(am__objects_1) splay.$(OBJEXT) Stack.$(OBJEXT) \
+       $(am__objects_2) stub_memaccount.$(OBJEXT) util.$(OBJEXT) \
+       uudecode.$(OBJEXT) $(am__objects_3)
++am_libmiscutil_a_HOST_OBJECTS = Array.$(HOST_OBJEXT) \
++      base64.$(HOST_OBJEXT) getfullhostname.$(HOST_OBJEXT) \
++      hash.$(HOST_OBJEXT) heap.$(HOST_OBJEXT) \
++      html_quote.$(HOST_OBJEXT) iso3307.$(HOST_OBJEXT) \
++      $(am__host_objects_1) radix.$(HOST_OBJEXT) \
++      rfc1035.$(HOST_OBJEXT) rfc1123.$(HOST_OBJEXT) \
++      rfc1738.$(HOST_OBJEXT) rfc2617.$(HOST_OBJEXT) \
++      safe_inet_addr.$(HOST_OBJEXT) $(am__host_objects_2) \
++      splay.$(HOST_OBJEXT) Stack.$(HOST_OBJEXT) \
++      stub_memaccount.$(HOST_OBJEXT) util.$(HOST_OBJEXT) \
++      uudecode.$(HOST_OBJEXT)
+ libmiscutil_a_OBJECTS = $(am_libmiscutil_a_OBJECTS)
++libmiscutil_a_HOST_OBJECTS = $(am_libmiscutil_a_HOST_OBJECTS)
+ libntlmauth_a_AR = $(AR) $(ARFLAGS)
+ libntlmauth_a_DEPENDENCIES = @LIBOBJS@
+ am_libntlmauth_a_OBJECTS = ntlmauth.$(OBJEXT)
+@@ -89,15 +103,19 @@ depcomp = $(SHELL) $(top_srcdir)/cfgaux/
+ am__depfiles_maybe = depfiles
+ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
++HOST_COMPILE = $(HOST_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++      $(AM_CFLAGS)
+ CCLD = $(CC)
++HOST_CCLD = ld
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+-SOURCES = $(libdlmalloc_a_SOURCES) $(libmiscutil_a_SOURCES) \
++HOST_LINK = $(HOST_CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++SOURCES = $(libdlmalloc_a_SOURCES) $(libmiscutil_a_SOURCES) $(libmiscutil_a_HOST_SOURCES) \
+       $(EXTRA_libmiscutil_a_SOURCES) $(libntlmauth_a_SOURCES) \
+       $(libregex_a_SOURCES) $(libsspwin32_a_SOURCES)
+ DIST_SOURCES = $(libdlmalloc_a_SOURCES) \
+       $(am__libmiscutil_a_SOURCES_DIST) \
+       $(EXTRA_libmiscutil_a_SOURCES) $(libntlmauth_a_SOURCES) \
+-      $(libregex_a_SOURCES) $(libsspwin32_a_SOURCES)
++      $(libregex_a_SOURCES) $(libsspwin32_a_SOURCES) $(libmiscutil_a_HOST_SOURCES)
+ ETAGS = etags
+ CTAGS = ctags
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+@@ -105,6 +123,7 @@ ACLOCAL = @ACLOCAL@
+ ALLOCA = @ALLOCA@
+ AMTAR = @AMTAR@
+ AR = @AR@
++HOST_AR = ar
+ AR_R = @AR_R@
+ AUTH_LIBS = @AUTH_LIBS@
+ AUTH_MODULES = @AUTH_MODULES@
+@@ -117,6 +136,7 @@ BASIC_AUTH_HELPERS = @BASIC_AUTH_HELPERS
+ CACHE_HTTP_PORT = @CACHE_HTTP_PORT@
+ CACHE_ICP_PORT = @CACHE_ICP_PORT@
+ CC = @CC@
++HOST_CC = gcc
+ CCDEPMODE = @CCDEPMODE@
+ CFLAGS = @CFLAGS@
+ CGIEXT = @CGIEXT@
+@@ -164,6 +184,8 @@ NEGOTIATE_AUTH_HELPERS = @NEGOTIATE_AUTH
+ NIS_LIBS = @NIS_LIBS@
+ NTLM_AUTH_HELPERS = @NTLM_AUTH_HELPERS@
+ OBJEXT = @OBJEXT@
++HOST_OBJEXT = @OBJEXT@.$(shell uname -m)
++HOST_DEPEXT = .$(shell uname -m)
+ OPT_DEFAULT_HOSTS = @OPT_DEFAULT_HOSTS@
+ PACKAGE = @PACKAGE@
+ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+@@ -261,6 +283,7 @@ EXTRA_LIBRARIES = \
+ noinst_LIBRARIES = \
+       @LIBDLMALLOC@ \
+       libmiscutil.a \
++      libmiscutil$(shell uname -m).a \
+       libntlmauth.a \
+       @LIBREGEX@ \
+       $(LIBSSPWIN32)
+@@ -300,9 +323,34 @@ libmiscutil_a_SOURCES = \
+       uudecode.c \
+       $(WIN32SRC)
++libmiscutil_a_HOST_SOURCES = \
++        Array.c \
++        base64.c \
++        getfullhostname.c \
++        hash.c \
++        heap.c \
++        html_quote.c \
++        iso3307.c \
++        $(MD5SOURCE) \
++        radix.c \
++        rfc1035.c \
++        rfc1123.c \
++        rfc1738.c \
++        rfc2617.c \
++        safe_inet_addr.c \
++        $(SNPRINTFSOURCE) \
++        splay.c \
++        Stack.c \
++        stub_memaccount.c \
++        util.c \
++        uudecode.c
++
+ libmiscutil_a_LIBADD = \
+       @LIBOBJS@
++libmiscutil_a_HOST_LIBADD = \
++      @LIBOBJS@
++
+ # $(top_srcdir)/include/version.h should be a dependency
+ libregex_a_SOURCES = \
+       GNUregex.c
+@@ -323,7 +371,7 @@ INCLUDES = -I$(top_builddir)/include -I$
+ all: all-am
+ .SUFFIXES:
+-.SUFFIXES: .c .o .obj
++.SUFFIXES: .c .o .obj .o.$(shell uname -m)
+ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+@@ -360,10 +408,13 @@ libdlmalloc.a: $(libdlmalloc_a_OBJECTS)
+       -rm -f libdlmalloc.a
+       $(libdlmalloc_a_AR) libdlmalloc.a $(libdlmalloc_a_OBJECTS) $(libdlmalloc_a_LIBADD)
+       $(RANLIB) libdlmalloc.a
+-libmiscutil.a: $(libmiscutil_a_OBJECTS) $(libmiscutil_a_DEPENDENCIES) 
++libmiscutil.a: $(libmiscutil_a_OBJECTS) $(libmiscutil_a_HOST_OBJECTS) $(libmiscutil_a_DEPENDENCIES) 
+       -rm -f libmiscutil.a
++      -rm -f libmiscutil$(shell uname -m).a
+       $(libmiscutil_a_AR) libmiscutil.a $(libmiscutil_a_OBJECTS) $(libmiscutil_a_LIBADD)
++      ar rcu libmiscutil$(shell uname -m).a $(libmiscutil_a_HOST_OBJECTS) $(libmiscutil_a_HOST_LIBADD)
+       $(RANLIB) libmiscutil.a
++      ranlib libmiscutil$(shell uname -m).a
+ libntlmauth.a: $(libntlmauth_a_OBJECTS) $(libntlmauth_a_DEPENDENCIES) 
+       -rm -f libntlmauth.a
+       $(libntlmauth_a_AR) libntlmauth.a $(libntlmauth_a_OBJECTS) $(libntlmauth_a_LIBADD)
+@@ -417,6 +468,21 @@ distclean-compile:
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uudecode.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32lib.Po@am__quote@
++@AMDEP_TRUE@DEP_HOST_FILES = $(DEPDIR)/Array.Po.$(HOST_DEPEXT) $(DEPDIR)/GNUregex.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/Stack.Po.$(HOST_DEPEXT) $(DEPDIR)/base64.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/dlmalloc.Po.$(HOST_DEPEXT) $(DEPDIR)/drand48.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/getfullhostname.Po.$(HOST_DEPEXT) $(DEPDIR)/hash.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/heap.Po.$(HOST_DEPEXT) $(DEPDIR)/html_quote.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/inet_ntoa.Po.$(HOST_DEPEXT) $(DEPDIR)/initgroups.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/iso3307.Po.$(HOST_DEPEXT) $(DEPDIR)/md5.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/ntlmauth.Po.$(HOST_DEPEXT) $(DEPDIR)/radix.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/rfc1035.Po.$(HOST_DEPEXT) $(DEPDIR)/rfc1123.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/rfc1738.Po.$(HOST_DEPEXT) $(DEPDIR)/rfc2617.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/safe_inet_addr.Po.$(HOST_DEPEXT) $(DEPDIR)/snprintf.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/splay.Po.$(HOST_DEPEXT) $(DEPDIR)/strerror.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/stub_memaccount.Po.$(HOST_DEPEXT) $(DEPDIR)/tempnam.Po.$(HOST_DEPEXT) \
++@AMDEP_TRUE@    $(DEPDIR)/util.Po.$(HOST_DEPEXT) $(DEPDIR)/uudecode.Po.$(HOST_DEPEXT)
++
+ .c.o:
+ @am__fastdepCC_TRUE@  $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@@ -425,6 +491,9 @@ distclean-compile:
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@ $(COMPILE) -c $<
++.c.o.$(shell uname -m):
++      $(HOST_COMPILE) -o $(shell basename $< .c).o.$(shell uname -m) -c $<
++
+ .c.obj:
+ @am__fastdepCC_TRUE@  $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ @am__fastdepCC_TRUE@  mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
diff --git a/net/srelay/Makefile b/net/srelay/Makefile
new file mode 100644 (file)
index 0000000..d579d1d
--- /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:=srelay
+PKG_VERSION:=0.4.8b3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/socks-relay
+PKG_MD5SUM:=a6d9521594172710ffa308d6b5dbece4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/srelay
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libwrap
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=A socks 4/5 proxy server
+  URL:=http://www.c-wind.com/srelay/
+endef
+
+define Package/srelay/conffiles
+/etc/srelay.conf
+endef
+
+CONFIGURE_ARGS += \
+       --disable-thread \
+       --with-libwrap="$(STAGING_DIR)/usr" \
+
+CONFIGURE_VARS += \
+       CPPFLAGS="-DLINUX $$$$CPPFLAGS" \
+
+define Package/srelay/install  
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) files/$(PKG_NAME).conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,srelay))
diff --git a/net/srelay/files/srelay.conf b/net/srelay/files/srelay.conf
new file mode 100644 (file)
index 0000000..e5d53ec
--- /dev/null
@@ -0,0 +1,2 @@
+# allow local subnet to access socks proxy
+192.168.1.0/24 any -
diff --git a/net/srelay/files/srelay.init b/net/srelay/files/srelay.init
new file mode 100644 (file)
index 0000000..95d1d81
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/bin/srelay -c /etc/srelay.conf -r -s 
+}
+
+stop() {
+       service_stop /usr/bin/srelay
+}
diff --git a/net/sscep/Makefile b/net/sscep/Makefile
new file mode 100644 (file)
index 0000000..8dd037e
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2006 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:=sscep
+PKG_VERSION:=20040325+ng2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=${PKG_NAME}.tgz
+PKG_SOURCE_URL:=http://www.klake.org/~jt/sscep/
+PKG_MD5SUM:=b509cdf0de952841471e77499aa6e4ca
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sscep
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl
+  TITLE:=A Simple SCEP (Simple Certificate Enrollment Protocol) client
+  URL:=http://www.klake.org/~jt/sscep/
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)"
+endef
+
+define Package/sscep/conffiles
+/etc/sscep.conf
+endef
+
+define Package/sscep/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/sscep.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sscep $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,sscep))
diff --git a/net/sscep/patches/001-certnanny.patch b/net/sscep/patches/001-certnanny.patch
new file mode 100644 (file)
index 0000000..6a37352
--- /dev/null
@@ -0,0 +1,3009 @@
+This patch adds support for signing requests with an existing key.
+It was taken from CertNanny <http://www.cynops.de/oss/CertNanny/>
+
+diff -uN sscep/Makefile sscep-ng2/Makefile
+--- sscep/Makefile     2003-01-22 06:23:18.000000000 +0100
++++ sscep-ng2/Makefile 2006-04-25 19:38:49.000000000 +0200
+@@ -7,13 +7,14 @@
+ CC    = gcc
+ CFLAGS        = -Wall -O 
++LDLIBS = -lcrypto
+ MAN   = sscep.8
+ PROG  = sscep
+ OBJS    = sscep.o init.o net.o sceputils.o pkcs7.o ias.o fileutils.o
+ $(PROG): $(OBJS)
+-      $(CC) $(CFLAGS) -lcrypto -o $(PROG) $(OBJS) 
++      $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDLIBS) 
+ clean:
+       rm -f $(PROG) $(OBJS) $(MAN) core
+diff -uN sscep/README sscep-ng2/README
+--- sscep/README       2003-04-17 07:49:46.000000000 +0200
++++ sscep-ng2/README   2006-04-28 10:27:44.000000000 +0200
+@@ -51,11 +51,13 @@
+ o iPlanet CMS (getca and enroll works)*
+ o VeriSign Onsite (getca and enroll works)**
+ o Entrust VPN Connect (getca and enroll works)***
++o OpenCA (getca, enroll, getcrl and automatic approval works)****
+ (*) by default, subjectAltName extensions are dropped from certificate
+ (**) only DNS subjectAltName allowed (demo mode)
+ (***) demo requires to use /C=US/O=Entrust
+-
++(****) automatic approval according to newer SCEP drafts requires
++       OpenCA 0.9.2.4 or higher
+ HOW TO COMPILE
+ ==============
+@@ -76,7 +78,7 @@
+ $ ./sscep
+-sscep version 20030131
++sscep version 2005XXXX
+ Usage: ./sscep OPERATION [OPTIONS]
+@@ -103,6 +105,8 @@
+ OPTIONS for OPERATION enroll are
+   -k <file>         Private key file
+   -r <file>         Certificate request file
++  -K <file>         Signature private key file
++  -O <file>         Signature certificate (used instead of self-signed)
+   -l <file>         Write enrolled certificate in file
+   -e <file>         Use different CA cert for encryption
+   -L <file>         Write selfsigned certificate in file
+@@ -152,6 +156,16 @@
+ CAIdentifier  Some CAs require you to define this. Example: mydomain.com
+               Command line option: -i
++CheckSubjectName
++              Check subject DN in the certificate return by the CA. The 
++              default is to match on the public key only. Up to version
++              20040325 sscep checked on the subject DN only, which is a
++              problem e.g. if the CA adds a SER attribute, enforces a 
++              naming policy or fixes encoding errors (e.g. with Java keytool
++              and DC).
++              Example: yes
++              Command line option: -C
++
+ CertReqFile   Certificate request file created with mkrequest.
+               Example: ./local.csr
+               Command line option: -r
+@@ -171,6 +185,21 @@
+               the signature. Example: ./enc.crt
+               Command line option: -e
++SignCertFile    Instead of creating a self-signed certificate from the
++              new key pair use an already existing certficate/key to
++              sign the SCEP request. If the "old" certificate and
++              key is used, the CA can verify that the holder of the
++              private key for an existing certificate re-enrolls for
++              a renewal certificate, allowing for automatic approval
++              of the request. Requires specification of the corresponding
++              signature private key file (-K, SignKeyFile). 
++              Example: ./sig.crt
++              Command line option: -O
++
++SignKeyFile   See SignCertFile. Specifies the corresponding private key.
++              Example: ./sig.key
++              Command line option: -K
++
+ FingerPrint   Display fingerprint algorithm. Available algorithms are md5
+               and sha1. Default is md5.
+               Command line option: -F
+@@ -367,6 +396,23 @@
+ the challenge password), it returns SUCCESS as a first reply. Otherwise, the
+ enrollment requires manual signing and authentication (perhaps a phone call).
++Newer SCEP draft versions allow to use the existing certificate (issued
++by the CA) to authenticate a renewal request. In this context, the SCEP
++request with the new public key is signed with the old certificate and
++key (instead of using a self-signed certificate created from the new
++key pair).
++To use this feature, use the command line options -O and -K to specify
++the old certificate and private key (SignCertFile and SignCertKey
++in the configuration file).
++The actual behaviour of the SCEP server depends on the CA policy and
++on the capabilities of the SCEP server (not all servers implement
++this feature, using the existing certificate with an older SCEP server
++may or may not work, depending on implementation).
++
++Note: Newer versions of OpenCA (http://www.openca.info/) support
++an SCEP server that is capable of automatically approving SCEP requests
++signed with the already existing key pair.
++
+ STEP 5 - Use certificate
+ ========================
+diff -uN sscep/cmd.h sscep-ng2/cmd.h
+--- sscep/cmd.h        2003-01-30 08:57:34.000000000 +0100
++++ sscep-ng2/cmd.h    2006-04-28 10:01:10.000000000 +0200
+@@ -16,6 +16,9 @@
+ int c_flag;
+ char *c_char;
++/* Check subject DN */
++int C_flag;
++
+ /* Debug? */
+ int d_flag;
+@@ -51,10 +54,18 @@
+ char *k_char;
+ int k_flag;
++/* Private key of already existing certificate */
++char *K_char;
++int K_flag;
++
+ /* Request count */
+ int n_flag;
+ int n_num;
++/* Already existing certificate (to be renewed) */
++char *O_char; 
++int O_flag;
++
+ /* Proxy */
+ char *p_char; 
+ int p_flag;
+diff -uN sscep/draft-nourse-scep-11.txt sscep-ng2/draft-nourse-scep-11.txt
+--- sscep/draft-nourse-scep-11.txt     1970-01-01 01:00:00.000000000 +0100
++++ sscep-ng2/draft-nourse-scep-11.txt 2006-04-25 16:27:03.000000000 +0200
+@@ -0,0 +1,2367 @@
++
++INTERNET DRAFT                                           Xiaoyi Liu
++draft-nourse-scep-11.txt                                 Cheryl Madson
++expires 11 Aug 2005                                    David  McGrew
++(revised 11 Feb 2005)                                    Andrew Nourse 
++                                                         Cisco Systems
++
++Category: Informational                                  11 Feb 2005
++
++
++Cisco Systems' Simple Certificate Enrollment Protocol(SCEP): 
++
++Status of this Memo
++
++This document is an Internet-Draft and is NOT offered in accordance
++with Section 10 of RFC2026, and the author does not provide the IETF
++with any rights other than to publish as an Internet-Draft
++
++Internet-Drafts are working documents of the Internet Engineering Task
++Force (IETF), its areas, and its working groups.  Note that other
++groups may also distribute working documents as Internet-Drafts.
++
++Internet-Drafts are draft documents valid for a maximum of six months
++and may be updated, replaced, or obsoleted by other documents at any
++time.  It is inappropriate to use Internet- Drafts as reference
++material or to cite them other than as "work in progress."
++
++The list of current Internet-Drafts can be accessed at
++http://www.ietf.org/ietf/1id-abstracts.txt
++
++The list of Internet-Draft Shadow Directories can be accessed at
++http://www.ietf.org/shadow.html.
++
++This memo provides information for the Internet community.  This memo
++does not specify an Internet standard of any kind.  Distribution of
++this memo is unlimited.
++
++By submitting this Internet-Draft, I certify that any applicable patent
++or other IPR claims of which I am aware have been disclosed, or will be
++disclosed, and any of which I become aware will be disclosed, in accordance
++with RFC 3668.
++
++Abstract
++
++This document specifies the Simple Certificate Enrollment Protocol,
++a PKI communication protocol which leverages existing technology by
++using PKCS#7 and PKCS#10.  SCEP is the evolution of the enrollment
++protocol developed by Verisign, Inc. for Cisco Systems, Inc.
++It now enjoys wide support in both client and CA implementations.
++
++
++Table of Contents
++
++   1.   Introduction . . . . . . . . . . . . . . . . . . . . . . .   2
++   2.   The Goal of SCEP . . . . . . . . . . . . . . . . . . . . .   3
++   2.1  SCEP Entity types  . . . . . . . . . . . . . . . . . . . .   3
++   2.2  SCEP Operations Overview . . . . . . . . . . . . . . . . .   7
++   2.3  PKI Operation Transactional Behavior . . . . . . . . . . .  10
++   2.4  Security . . . . . . . . . . . . . . . . . . . . . . . . .  12
++   3.   Transport Protocol . . . . . . . . . . . . . . . . . . . .  13
++   4.   Secure Transportation: PKCS #7 . . . . . . . . . . . . . .  14
++   4.1  SCEP Message Format  . . . . . . . . . . . . . . . . . . .  14
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 2]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++   4.2  Signed Transaction Attributes  . . . . . . . . . . . . . .  15
++   5.   SCEP Transaction Specification . . . . . . . . . . . . . .  16
++   5.1  Certificate Enrollment . . . . . . . . . . . . . . . . . .  16
++   5.2  Poll for Requester Initial Certificate . . . . . . . . . .  22
++   5.3  Certificate Access . . . . . . . . . . . . . . . . . . . .  26
++   5.4  CRL Access   . . . . . . . . . . . . . . . . . . . . . . .  27
++   5.5  Get Certificate Authority Certificate  . . . . . . . . . .  31
++   5.6  Get Certificate Authority Certificate Chain  . . . . . . .  33
++   6.   Security Considerations  . . . . . . . . . . . . . . . . .  33 
++   7.   Intellectual Propoerty . . . . . . . . . . . . . . . . . .  33
++   8.   References . . . . . . . . . . . . . . . . . . . . . . . .  33
++   Appendix A. Cisco Requester Subject Name Definition . . . . . .  34
++   Appendix B. IPSEC Client Enrollment Certificate Request . . . .  35
++   Appendix C. Private OID Definitions   . . . . . . . . . . . . .  36
++   Appendix D. Obtaining CRL by LDAP Query . . . . . . . . . . . .  36
++   Appendix E. SCEP State Transitions  . . . . . . . . . . . . . .  37
++   Appendix F. CA Capabilities . . . . . . . . . . . . . . . . . .  40
++   Appendix G. Certificate Renewal and CA Key Rollover . . . . . .  41
++   Appendix H. PKIOperation via HTTP POST Message. . . . . . . . .  42
++   Appendix Y. Author Contact Information. . . . . . . . . . . . .  43
++   Appendix Z. Copyright Section . . . . . . . . . . . . . . . . .  43
++
++Section 1. Introduction
++
++Public key technology is becoming more widely deployed and is becoming
++the basis for standards based security, such as the Internet Engineering
++Task Force's IPSEC and IKE protocols.  With the use of public key
++certificates in network security protocols comes the need for a
++certificate management protocol that Public Key Infrastructure (PKI)
++clients and Certificate Authority servers can use to support certificate
++life cycle operations such as certificate enrollment and revocation, and
++certificate and CRL access.
++
++In the following, Section 2 gives an overview of the PKI operations,
++and Section 2.4 describes the security goals of the protocol and the
++mechanisms used to achieve them.  The transport protocol and the
++security protocol PKCS#7 are described at Section 3 and Section 4,
++respectively.  The last section, Section 5, specifies each PKI
++operation in terms of the message formats and the data structures of
++each operation.
++
++The appendices provide detailed specifications and examples. Requester
++subject names are specified in Appendix A, attribute OIDs are
++specified in Appendix C , and the SCEP state transitions are described
++in Appendix E.  An example of a certificate enrollment request is
++provided in Appendix B, and an example LDAP query URL encoding is
++provided in Appendix D.
++
++The authors would like to thank Peter William of ValiCert, Inc.
++(formerly of Verisign, Inc) and Alex Deacon of Verisign, Inc. and
++Christopher Welles of IRE, Inc. for their contributions to this protocol
++and to this document.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 3]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++2.0 The Goal of SCEP
++The goal of SCEP is to support the secure issuance of certificates to
++network devices in a scalable manner, using existing technology whenever
++possible.  The protocol supports the following operations:
++
++  CA and RA public key distribution 
++  Certificate enrollment 
++  Certificate revocation 
++  Certificate query 
++  CRL query 
++
++Certificate and CRL access can be achieved by using the LDAP protocol
++(as specified in Appendix D), or by using the query messages defined in
++SCEP.  The use of HTTP certificate and CRL access, and the support of
++CDP as specified in RFC2459, will be specified in a future version of
++this document.  In Section 2.1, we first define PKI entity types as well
++as the properties of each entity type. In Section 2.2, the PKI
++operations are described at functional level. Section 2.3 describes the
++transaction behavior of each PKI operations.  The complete PKI messages
++are covered in Section 5.
++
++2.1 SCEP Entity types
++
++The entity types defined in SCEP are the "requester" type (i.e., IPSEC
++clients), the Certificate Authority (CA) entity type, and the
++Registration Authority entity type (RA).  A requester is sometimes
++called a "SCEP client" in the following.
++
++2.1.1 Requesters
++
++A requester is an entity whose name is defined in a certificate
++subject name field and optionally, in SubjectAltName, a X.509
++certificate V3 extension.  As a requester, a SCEP client is identified
++by a subject name consisting of the following naming attributes:
++  
++  Fully qualified domain name, for example, router.cisco.com 
++ IP address,  Serial number, and/or x.500 distinguished name
++
++The fully qualified domain name is required for a requester that intends
++to use the certificate for ISAKMP.  The IP address, serial number, and
++x.500 distinguished name are optional name attributes.  In the
++certificate enrollment request, the PKCS#10 subject field contains the
++required and optional name attributes.  The distinguished name, if any,
++should be the subject name field, while any domain name, serial number,
++or IP address supplied should be in the subjectAltName field. The
++subject name field may be empty (if there is no distinguished name)
++or the subjectAltName may be omitted, but not both.
++
++It is important to note that a client named as Alice.cisco.com is
++different than a client named as Alice.cisco.com plus the IP address
++name attribute 117.96.1.219. From CA point of view, the Distinguished
++names assigned in these two cases are distinct names.
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 4]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Entity names which are specified as in the IPSEC profile (i.e., FQDN, IP
++address and User FQDN) must be presented in certificate's SubjectAltName
++extension. Multiple IPSEC entity names, (if any) are encoded as multiple
++values of a single SubjectAltName extension.  The CA has the authority
++to assign a distinguished name to a requester, whether or not one was
++included in the request. The assigned DN should contain the SCEP client
++names as the relative DN.
++
++The attribute identifiers and an example of SCEP client subject name are
++specified in Appendix A. Appendix B has an example from Cisco VPN Client
++enrollment request.
++  
++2.1.1.1  Local Key/Certificate/CRL Storage and Certificate-name uniqueness
++
++A requester is required to generate asymmetric key pairs and to provide
++storage to store its private keys.  If the requester does not have enough
++permanent memory to save its certificate, then it should be able to query
++its own certificate from the CA or an LDAP server, once the certificate
++has been issued.  The public key pairs can be generated with a specific
++key usage. The key usage is conveyed to the CA through the certificate
++enrollment request.  All current SCEP client implementations expect that
++there will be only one pair of keys for a given subject name
++and key usage combination and CA, at any time.  This property is called
++the certificate-name uniqueness property, and it implies that a CA that
++implements SCEP will enforce the unique mapping between a SCEP client
++subject name and its key pairs with a given key usage. At any time, if
++the subject name is changed, or if the key is updated, the existing
++certificate would have to be revoked before a new one could be issued.
++
++It is desirable that the CA enforce certificate-name uniqueness, but
++it is not mandatory.  However a CA that does not enforce uniqueness
++must provide some other mechanism to prevent the re-transmission of an
++enrollment request by a SCEP client from creating a second certificate
++or certificate request, nor can the second request merely be rejected.
++If a client times out from polling for a pending request it can 
++resynchronize by reissuing the original request with the original
++subject name, key, and transaction ID.  This should return the status of
++the original transaction, including the certificate if it was granted.
++It should not create a new transaction unless the original cert has been
++revoked, or the transaction arrives more than halfway through the
++validity time of the original certificate.
++
++An enrollment request that occurs more than halfway through the validity
++time of an existing certificate for the same subject name and key usage
++MAY be interpreted as a re-enrollment or renewal request and accepted.
++A new certificate with new validity dates may be issued, even though 
++the old one is still valid, if the CA policy permits, as described in
++2.1.1.3.  See also appendix G.
++
++2.1.1.2 Requester authentication
++
++As with every protocol that uses public-key cryptography, the
++association between the public keys used in the protocol and the
++identities with which they are associated must be authenticated in a
++\fLiu/Madson/McGrew/Nourse                                     [Page 5]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++cryptographically secure manner.  This requirement is needed to
++prevent a "man in the middle" attack, in which an adversary that can
++manipulate the data as it travels between the protocol participants
++can subvert the security of the protocol.  To satisfy this
++requirement, SCEP provides two authentication methods: manual
++authentication, and authentication based on pre-shared secret.  In the
++manual mode, the requester is required to wait until its identity can
++be verified by the CA operator using any reliable out-of-band
++method. To prevent a "man-in-the-middle" attack, a SHA-1 or MD5
++`fingerprint' generated on the PKCS#10 (before PKCS #7 enveloping and
++signing) must be compared out-of-band between the server and the
++requester.  SCEP clients and CAs (or RAs, if appropriate) must display
++this fingerprint to the operator to enable this verification if manual
++mode is used.  Failing to provide this information leaves the protocol
++vulnerable to attack by sophisticated adversaries.  When utilizing a
++pre-shared secret scheme, the server should distribute a shared secret
++to the requester which can uniquely associate the enrollment request
++with the given end entity. The distribution of the secret must be
++private: only the end entity should know this secret. The actual
++binding mechanism between the requester and the secret is subject to
++the server policy and implementation.  When creating the enrollment
++request, the requester is asked to provide a challenge password. When
++using the pre-shared secret scheme, the requester must enter the
++re-distributed secret as the password. In the manual authentication
++case, the challenge password only used to authenticate a request for
++the certificate's revokation.  This challenge password is included as
++a PKCS#10 attribute, and is sent to the server as encrypted data.  The
++PKCS#7 envelope protects the privacy of the challenge password with
++DES encryption.
++
++2.1.1.3  Requester Uses Existing CA-Issued or Self-Signed Certificates
++
++In this protocol, the communication between the requester and the
++certificate authority is secured by using PKCS#7 as the messaging
++protocol. PKCS#7, however, is a protocol which assumes the
++communicating entities already possess the peer's certificates and
++requires both parties use the issuer names and issuer assigned
++certificate serial numbers to identify the certificate in order to
++verify the signature and decrypt the message.  If the requesting
++system already has a certificate issued by the CA, that certificate
++may be presented as credentials for the renewal of that certificate if
++the CA supports the "Renewal" capability and the CA policy permits the
++certificate to be renewed. If the requester has no certificate issued
++by the CA, or if the CA does not support and permit renewal, the
++requestor must generate a self-signed certificate with the requester
++subject name (the same name later used in the PKCS#10) as both issuer
++and subject name.  During the certificate enrollment, the requester
++will first post itself as the signing authority by attaching the
++self-signed certificate to the signed certificate request.  When the
++Certificate Authority makes the envelope on the issued certificate
++using the public key included in the self-signed certificate, it
++should use the same issuer name and serial number as conveyed in the
++self-signed certificate to inform the end entity on which private key
++should be used to open the envelope.
++\fLiu/Madson/McGrew/Nourse                                     [Page 6]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Note that when a client enrolls for separate encryption and signature
++certificates, it may use the signature certificate to sign both
++requests, and then expect its signature key to be used to encrypt
++both responses.  In any case, the recipientinfo on the envelope should 
++reflect the key used to encrypt the request.
++
++2.1.1.4 Trusted CA Store
++ 
++To support interoperability between IPSEC peers whose certificates are
++issued by different CA, SCEP allows the users to configure multiple
++trusted certificates.  Trusted certificates are have been configured as
++such in the client, based on some out-of-band means such as a "fingerprint".
++These trusted certificates are used to verify certificate chains that end
++in those certificates.
++
++2.1.2 Certificate Authority
++
++A Certificate Authority(CA) is an entity whose name is defined in the
++certificate issuer name field. Before any PKI operations can begin,
++the CA generates its own public key pair and creates a self-signed CA
++certificate, or causes another CA to issue a certificate to it.
++Associated with the CA certificate is a fingerprint which will be used
++by the requester to authenticate the received CA certificate if it is
++self-signed.  The fingerprint is created by calculating a SHA-1 or MD5
++hash on the whole CA certificate.  Before any requester can start its
++enrollment, this CA certificate has to be configured at the entity
++side securely.  For IPSEC clients, the client certificates must have
++SubjectAltName extension.  To utilize LDAP as a CRL query protocol,
++the certificates must have a CRL Distribution Point. Key usage is
++optional. Without key usage, the public key is assumed as a general
++purpose public key and it can be used for all the purposes.
++
++A Certificate Authority may enforce certain name policy. When using
++X.500 directory name as the subject name, all the name attributes
++specified in the PKCS#10 request should be included as Relative DN. All
++the name attributes as defined in RFC2459 should be specified in the
++SubjectAltName.  An example is provided in Appendix A.
++
++ If there is no LDAP query protocol support, the Certificate Authority
++should answer certificate and CRL queries, and to this end it should be
++online all the time.
++
++The updating of the CA's public key is addressed in Appendix G.
++ 
++2.1.3 Registration Authorities
++
++In an environment where an RA is present, a requester performs
++enrollment through the RA. In order to setup a secure channel with an RA
++using PKCS#7, the RA certificate(s) have to be obtained by the client
++in addition to the CA certificate(s).
++
++In the following, the CA and RA are specified as one entity in the
++context of PKI operation definitions.
++\fLiu/Madson/McGrew/Nourse                                     [Page 7]
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++2.2 SCEP Operations Overview
++
++In this section, we give a high level overview of the PKI operations as
++defined in SCEP.
++
++2.2.1 Requester Initialization
++
++The requester initialization includes the key pair generation and the
++configuring of the required information to communicate with the
++certificate authority.
++
++2.2.1.1  Key Pairs
++
++Before a requester can start PKI transaction, it must have at least one
++asymmetric key pair, using the selected algorithm (the RSA algorithm is
++required in SCEP, and is the only algorithm in current implementations).
++
++Key pairs may be intended for particular purposes, such as encryption only,
++or signing only.  The usage of any associated certificate can be restricted
++by adding key usage and extended key usage attributes to the PKCS#10.
++
++2.2.1.2 Required Information
++
++A requester is required to have the following information configured
++before starting any PKI operations:
++
++1. the certificate authority IP address or fully-qualified domain name, 
++2. the certificate authority HTTP CGI script path, and 
++   the HTTP proxy information in case there is no direct Internet
++   connection to the server,
++3. If CRLs are being published by the CA to an LDAP directory server,
++   and there is a CRL Distribution Point containing only an X.500 directory
++   name, then the client will need to know the LDAP server fully-qualified
++   domain name or IP address.  CRL Distribution Points are discussed in
++   more detail in RFC 2459.
++
++
++2.2.2  CA/RA Certificate Distribution
++
++Before any PKI operation can be started, the requester needs to get
++the CA/RA certificates. At this time, since no public key has been
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 8]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++exchanged between the requester and the CA/RA, the message to get the
++CA/RA certificate can not be secured using PKCS#7 protocol. Instead, the
++CA/RA certificate distribution is implemented as a clear HTTP Get
++operation. After the requester gets the CA certificate, it has to
++authenticate the CA certificate by comparing the finger print with the
++CA/RA operator. Since the RA certificates are signed by the CA, there is
++no need to authenticate the RA certificates.
++
++This operation is defined as a transaction consisting of one HTTP Get
++message and one HTTP Response message:
++
++         REQUESTER                           CA SERVER 
++  Get CA/RA Cert: HTTP Get message 
++     -----------------------------> 
++                              CA/RA Cert download: HTTP Response message 
++                                <--------------------------------------- 
++     Compute finger print and 
++     call CA operator. 
++                                    Receive call and check finger print 
++
++If an RA is in use, a degenerated PKCS#7 with a certificate chain 
++consisting of both RA and CA certificates is sent back to the end
++entity. Otherwise the CA certificate is directly sent back as the
++HTTP response payload.   
++
++  
++2.2.3 Certificate Enrollment
++
++A requester starts an enrollment transaction by creating a certificate
++request using PKCS#10 and sends it to the CA/RA enveloped using the
++PKCS#7. After the CA/RA receives the request, it will either
++automatically approve the request and send the certificate back, or it
++will require the requester to wait until the operator can manually
++authenticate the identity of the requester.  Two attributes are
++included in the PKCS#10 certificate request - a Challenge Password
++attribute and an optional ExtensionReq attribute which will be a
++sequence of extensions the requester would like to be included in its
++V3 certificate extensions.  The Challenge Password may be used to
++authenticate either the enrollment request itself, or a verbal
++revocation request for the issued certificate in the event of key
++compromise or other reason.
++
++In the automatic mode, the transaction consists of one PKCSReq PKI
++Message, and one CertRep PKI message. In the manual mode, the requester
++enters into polling mode by periodically sending a GetCertInitial PKI
++message to the server, until the server operator completes the manual
++authentication, after which the CA will respond to GetCertInitial by
++returning the issued certificate.  A  CA MAY run in automatic mode for
++preapproved requests, and manual mode for the rest.  A request with a
++non-null password is not necessarily a pre-approved request. It is up
++to the CA server to decide.   Polling mode is entered whenever the
++server returns a PENDING response.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 9]
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++The transaction in automatic mode: 
++
++         REQUESTER                           CA SERVER      
++
++PKCSReq: PKI cert. enrollment msg
++     --------------------------------> CertRep: pkiStatus = SUCCESS
++                                     certificate attached
++                                       <------------------------------
++     Receive issued certificate. 
++
++The transaction in manual mode: 
++
++         REQUESTER                           CA SERVER 
++     PKCSReq: PKI cert. enrollment msg 
++     --------------------------------> CertRep: pkiStatus = PENDING 
++                                       <------------------------------
++     GetCertInitial: polling msg 
++     --------------------------------> CertRep: pkiStatus = PENDING 
++                                       <------------------------------
++     ................. <manual identity authentication................
++  
++     GetCertInitial: polling msg 
++     --------------------------------> CertRep: pkiStatus = SUCCESS
++                                     certificate attached
++                                       <------------------------------
++     Receive issued certificate. 
++
++2.2.4 Requester Certificate Revocation
++
++A requester should be able to revoke its own certificate. Currently
++the revocation is implemented as a manual process. In order to revoke a
++certificate, the requester makes a phone call to the CA server
++operator. The operator will come back asking the ChallengePassword
++(which has been sent to the server as an attribute of the PKCS#10
++certificate request). If the ChallengePassword matches, the certificate
++is revoked. The reason of the revocation is documented by CA/RA.
++
++2.2.5 Certificate  Access
++
++There are two methods to query certificates. The first method is to use
++LDAP as a query protocol. Using LDAP to query assumes the client
++understand the LDAP scheme supported by the CA. The SCEP client assumes
++that the subject DN name in the certificate is used as the URL to query the
++certificate. The standard attributes (userCertificate and caCertificate)
++are used as filter.
++
++For the environment where LDAP is not available, a certificate query
++message is defined to retrieve the certificates from the CA.
++
++To query a certificate from the certificate authority, a requester
++sends a request consisting of the certificate's issuer name and the
++serial number. This assumes that the requester has saved the issuer
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 10]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++name and the serial number of the issued certificate from the previous
++enrollment transaction.  The transaction to query a certificate consists
++of one GetCert PKI message and one CertRep PKI message:
++
++         REQUESTER                           CA SERVER 
++     GetCert: PKI cert query msg 
++     -------------------------------> CertRep:  pkiStatus = SUCCESS
++                                    certificate 
++attached
++                                      <-----------------------------
++     Receive the certificate. 
++
++2.2.6 CRL Distribution
++
++The CA/RA will not "push" the CRL to the end entities. The query of the
++CRL can only be initialized by the requester.
++
++There are three methods to query CRL.
++
++The CRL may be retrieved by a simple HTTP GET.  If the CA supports this
++method, it should encode the URL into a CRL Distribution Point extension
++in the certificates it issues.  Support for this method should be
++incorporated in new and updated clients, but may not be in older
++versions.
++
++The second method is to query CRL using LDAP. This assumes the CA server
++supports CRL LDAP publishing and issues the CRL Distribution Point in
++the certificate.  The CRL Distribution Point is encoded as a DN. Please
++refer to Appendix D for the examples of CRL Distribution Point.
++
++The third method is implemented for the CA which does not support LDAP
++CRL publishing or does not implement the CRL Distribution Point. In this
++case, a CRL query is composed by creating a message consists of the CA
++issuer name and the CA's certificate serial number.  This method is
++deprecated because it does not scale well and requires the CA to be a
++high-availability service.
++
++The message is sent to the CA in the same way as the other SCEP
++requests: The transaction to query CRL consists of one GetCRL PKI
++message and one CertRep PKI message which have no certificates but CRL.
++
++         REQUESTER                           CA SERVER 
++     GetCRL: PKI CRL query msg 
++     ----------------------------------> CertRep:  CRL attached 
++                                       <-------------------------------- 
++
++2.3  PKI Operation Transactional Behavior
++
++As described before, a PKI operation is a transaction consisting of the
++messages exchanged between a requester and the CA/RA. This section
++will specify the transaction behavior on both the requester and the
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 11]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++certificate authority server.  Because the protocol is basically a two
++way communication protocol without a confirmation message from the
++initiating side, state and state resynchronization rules have to be
++defined, in case any error happens at either side.  Before the state
++transition can be defined, the notion of transaction identifier has to
++be defined first.
++  
++2.3.1 Transaction Identifier
++
++A transaction identifier is a string generated by the entity when
++starting a transaction. Since all the PKI operations defined in this
++protocol are initiated by the requester, it is the responsibility of
++the requester to generate a unique string as the transaction
++identifier. All the PKI messages exchanged for a given PKI transaction
++must carry the same transaction identifier.  The transaction identifier
++is generated as a SHA-1 or MD5 hash on the public key value for which the
++enrollment request is made. This allows the SCEP client to reuse the
++same transaction identifier if it is reissuing a request for the same
++certificate (i.e. a certificate with the same subject, issuer, and key).
++The SCEP protocol requires that transaction identifiers be unique, so
++that queries can be matched up with transactions.  For this reason, in
++those cases in which separate signing and encryption certificates are
++issued to the same requester, the keys must be different.  
++ 
++2.3.2 State Transitions in Certificate Enrollment
++
++The requester state transitions during enrollment operation are
++indicated in the diagram below:
++                                    +-<------+ 
++                                    |        | 
++                                   GetCertInitial triggered by timeout or 
++                                    |        |    manual authentication 
++                                    |        | 
++     [CERT-NONEXISTANT] ------> [CERT-REQ-PENDING] ---> [CERT-ISSUED] 
++           |           PKCSReq          |        CertRep with SUCCESS 
++           |                            | 
++           |                            | 
++           +--------<-------------------+ 
++           request rejected, timeout, or error
++
++As described in the section 2.2.3, certificate enrollment starts at the
++state CERT-NONEXISTANT. Sending PKCSReq changes the state to
++CERT-REQ-PENDING. Receiving CertRep with SUCCESS status changes the
++state to CERT-ISSUED. In the case the server sending back the response
++with pending status, the requester will keep polling certificate
++response by sending GetCertInitial to the server, until either a CertRep
++with SUCCESS status is received, or the maximum polling number has been
++exceeded.
++
++If an error or timeout occurs in the CERT-REQ-PENDING state, the end
++entity will transition to the CERT-NONEXISTANT state. 
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 12]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++The client administrator will, eventually, start up another enrollment
++request.  It is important to note that, as long as the requester does
++not change its subject name or keys, the same transaction id will be
++used in the "new" transaction. This is important because based on this
++transaction id, the certificate authority server can recognize this as
++an existing transaction instead of a new one.
++
++  
++2.3.3 Transaction Behavior of Certificate/CRL Access
++
++There is no state maintained during certificate access and CRL access
++transaction. When using the certificate query and CRL query messages
++defined in this protocol, the transaction identifier is still required
++so that the requester can match the response message with the
++upstanding request message. When using LDAP to query the certificate and
++the CRL, the behavior is specified by the LDAP protocol.
++
++2.4 Security
++
++The security goals of SCEP are that no adversary can: 
++
++o subvert the public key/identity binding from that intended, 
++o discover the identity information in the enrollment requests and
++  issued certificates, 
++o cause the revocation of certificates with any non-negligible
++  probability. 
++
++Here an adversary is any entity other than the requester and the CA
++(and optionally the RA) participating in the protocol that is
++computationally limited, but that can manipulate data during
++transmission (that is, a man-in-the-middle).  The precise meaning of
++'computationally limited' depends on the implementer's choice of
++cryptographic hash functions and ciphers.  The required algorithms are
++RSA, DES, and either SHA-1 or MD5, depending on the "SHA-1" CA Capability.
++[See Appendix F].
++
++The first and second goals are met through the use of PKCS#7 and PKCS#10
++encryption and digital signatures using authenticated public keys.  The
++CA's public key is authenticated via the checking of the CA fingerprint,
++as specified in Section 2.1.2, and the SCEP client's public key is
++authenticated through the manual authentication or pre-shared secret
++authentication, as specified in Section 2.1.1.2.  The third goal is met
++through the use of a Challenge Password for revocation, that is chosen
++by the SCEP client and communicated to the CA protected by the PKCS#7
++encryption, as specified in Section 2.2.4.
++
++The motivation of the first security goal is straightforward.  The
++motivation for the second security goal is to protect the identity
++information in the enrollment requests and certificates.  For example,
++two IPSEC hosts behind a firewall may need to exchange certificates, and
++may need to enroll certificates with a CA that is outside of a firewall.
++Most networks with firewalls seek to prevent IP addresses and DNS
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 13]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++information from the trusted network leaving that network.  The second
++goal enables the hosts in this example to enroll with a CA outside the
++firewall without revealing this information.  The motivation for the
++third security goal is to protect the SCEP clients from denial of
++service attacks.
++
++Section 3 Transport Protocol
++
++In the SCEP protocol, HTTP is used as the transport protocol for the PKI
++messages.
++
++3.1 HTTP "GET" and "POST" Message Format
++
++The following is the syntax definition of a HTTP GET message sent from
++a requester to a certificate authority server:
++
++Request = "GET " CGI-PATH CGI-PROG "?operation=" OPERATION "&message=" MESSAGE 
++where: 
++  CGI-PATH defines the actual CGI path to invoke the CGI program which
++  parses the request. 
++  CGI-PROG is set to be the string "pkiclient.exe".  This is intended
++  to be the program that the CA will use to handle the SCEP transactions,
++  though the CA may ignore CGI-PROG and use only the CGI-PATH. 
++  OPERATION is set to be the string "PKIOperation" when the GET message
++  carries a PKI message to request certificates or CRL; OPERATION is set
++  to be the string "GetCACaps", "GetCACert", "GetNextCACert" or
++  "GetCACertChain" when the GET operation is used to get CA capabilities,
++  CA/RA certificate, the replacement CA/RA certificates for when the
++  current ones expire, or the CA Cert chain  (respectively).
++
++  When OPERATION is "PKIOperation", MESSAGE is a base64-encoded PKI message,
++  When OPERATION is GetCACert, MESSAGE is a CRL distribution
++  point in URI format,  otherwise, MESSAGE is a string which represents
++  the certificate authority issuer identifier. 
++
++SCEP uses the HTTP "GET" and "POST" messages to request information from the CA.
++Requests for CA certificates or capabilities are sent in the clear, using "GET",
++with the OPERATION and MESSAGE fields identifying the requested data.
++CRLs may also be requested in the clear if the CA supports it.
++
++Other types of requests are sent using the PKCS#7 secure protocol.
++These may be issued by means of a GET operation with
++OPERATION and MESSAGE parameters in the Request-URL. OPERATION
++identifies the type of GET operation, and MESSAGE is actually the PKCS#7
++message Base64-Encoded.
++
++For example. a requester may submit a message via HTTP to the server
++as follows:
++
++GET /cgi-bin/pkiclient.exe?operation=PKIOperation&message=MIAGCSqGSIb3D
++QEHA6CAMIACAQAxgDCBzAIBADB2MGIxETAPBgNVBAcTCE ......AAAAAA== 
++\fLiu/Madson/McGrew/Nourse                                     [Page 13a]
++
++If supported by the CA, the message may also be sent via HTTP POST:
++
++POST /cgi-bin/pkiclient.exe?operation=PKIOperation
++
++This is further described in Appendix H.
++To determine if the CA supports POST, use the GetCACaps message described
++in Appendix F.
++
++
++3.2 Response Message Format
++
++For each GET operation, the CA/RA server will return a MIME object via
++HTTP. For a GET operation with PKIOperation as its type, the response is
++tagged as having a Content Type of application/x-pki-message.  The body
++of this message is a BER encoded binary PKI message. The following is an
++example of the response:
++
++"Content-Type:application/x-pki-message\n\n"<BER-encoded PKI msg>
++
++In the case of GET operation with a type of GetCACert the MIME content
++type returned will depend on whether or not an RA is in use.  If there
++is no RA, only the CA certificate is sent back in the response, and
++the response has the content type tagged as
++application/x-x509-ca-cert. the body of the response is a DER encoded
++binary X.509 certificate. For example:
++
++"Content-Type:application/x-x509-ca-cert\n\n"<BER-encoded X509>
++
++If there is an RA, the RA certificates are sent back together with the
++CA certificates, a certificate-only PKCS#7 SignedData is sent back in
++the response where the SignerInfo is empty. Section 5 has the detailed
++definition of the message format in this case.  The content type is
++application/x-x509-ca-ra-cert. 
++
++The response to GetNextCACert is always a certificates-only PKCS#7
++SignedData with a content type of application/x-x509-ca-ra-cert. 
++If there is an RA, The signer is the current RA certificate.  Otherwise,
++the signer is the current CA certificate.
++
++If the CA supports it, PKIOperation may also be done via an HTTP POST.
++This is described in Appendix H.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 14]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Section 4  Secure Transportation: PKCS#7
++
++PKCS#7 is a general enveloping mechanism that enables both signed and
++encrypted transmission of arbitrary data. It is widely implemented and
++included in the RSA tool kit.  In this section, the general PKCS#7
++enveloped PKI message format is specified.  The complete PKCS#7 message
++format for each PKI transaction will be covered in Section 5.
++
++4.1 SCEP Message Format
++
++As a transaction message, a SCEP message has a set of transaction
++specific attributes and an information portion. Employing PKCS#7
++protocol, the transaction specific attributes are encoded as a set of
++authenticated attributes of the SignedData. The information portion will
++first be encrypted to become Enveloped Data, and then the digest of the
++enveloped information portion is included as one of the message digest
++attributes and being signed together with the other transaction specific
++attributes.
++
++By applying both enveloping and signing transformations, a SCEP message
++is protected both for the integrity of its end-end-transition
++information and the confidentiality of its information portion. The
++advantage of this technique over the conventional transaction message
++format is that, the signed transaction type information and the status
++of the transaction can be determined prior to invoke security handling
++procedures specific to the information portion being processed.
++
++The following is an example of a SCEP message with its enveloped and
++signed data portion represented by pkcsPKISigned and
++pkcsPKIEnveloped. The out-most of any PKI message is a blob of
++ContentInfo, with its content type set to SignedData and the actual
++signed data as the content.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 15]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++  pkiMessage ContentInfo ::= { 
++      contentType {pkcs-7 signedData(2)} 
++      content pkcsPKISigned 
++  } 
++  pkcsPKISigned SignedData ::= { 
++      version 1 
++      digestAlgorithm { iso(1) member-body(2) US(840) rsadsi(113549) 
++                        digestAlgorithm(2) 5} 
++      contentInfo { 
++          contentType {pkcs-7 1} --  data content identifier 
++          content pkcsPKIEnvelope -- enveloped information portion 
++      } 
++      certificates   -- signer certificate chain 
++      signerInfo     -- including signed transaction info and the digest 
++                     -- of the enveloped information portion as the 
++                     -- authenticated attributes 
++  } 
++  pkcsPKIEnveloped EnvelopedData ::= { 
++      version 0 
++      recipientInfos -- information required to open the envelop 
++      encryptedContentInfo { 
++          contentType {pkcs-7 1}  -- data content identifier 
++          contentEncryptionAlgorithm 
++          encryptedContent     -- encrypted information portion 
++      } 
++  } 
++
++4.2 Signed Transaction Attributes
++
++The following transaction attributes are encoded as authenticated
++attributes.  Please refer to Appendix B for the OID definitions.
++
++transactionID      PrintableString  -- Decimal value as a string 
++  messageType        PrintableString  -- Decimal value as a string 
++  pkiStatus          PrintableString  -- Decimal value as a string 
++  failinfo           PrintableString  -- Decimal value as a string 
++  senderNonce        Octet String 
++  recipientNonce     Octet String 
++
++where: 
++
++  The transactionID is an attribute which uniquely identify a 
++  transaction.  This attribute is required in all PKI messages. 
++
++  The messageType attribute specify the type of operation performed by the 
++  transaction. This attribute is required in all PKI
++  messages. Currently, the following message types are defined: 
++
++    PKCSReq (19)  -- Permits use of PKCS#10 certificate request 
++    CertRep (3)   -- Response to certificate or CRL request 
++    GetCertInitial (20)  -- Certificate polling in manual enrollment 
++    GetCert (21)  -- Retrieve a certificate 
++    GetCRL  (22)  -- Retrieve a CRL
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 16]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++  All response message will include transaction status information which
++  is defined as pkiStatus attribute: 
++
++          SUCCESS (0)   -- request granted 
++          FAILURE (2)   -- request rejected 
++          PENDING (3)   -- request pending for manual approval.
++
++  If the status in the response is FAILURE, the failinfo attribute will
++  contain one of the following failure reasons: 
++
++        badAlg (0)  -- Unrecognized or unsupported algorithm ident 
++        badMessageCheck (1)  -- integrity check failed 
++        badRequest (2)  -- transaction not permitted or supported 
++        badTime (3)  -- Message time field was not sufficiently close
++                        to the system time 
++        badCertId (4)  -- No certificate could be identified matching
++                          the provided criteria 
++
++  The attributes of senderNonce and recipientNonce are the 16 byte
++  random numbers generated for each transaction to prevent the replay
++  attack. 
++
++When a requester sends a PKI message to the server, a senderNonce is
++included in the message. After the server processes the request, it will
++send back the requester senderNonce as the recipientNonce and generates
++another nonce as the senderNonce in the response message.  Because the
++proposed pki protocol is a two-way communication protocol, it is clear
++that the nonce can only be used by the requester to prevent the
++replay. The server has to employ extra state related information to
++prevent a replay attack.
++
++Section 5. SCEP Transaction Specification
++
++In this section each SCEP transaction is specified in terms of the
++complete messages exchanged during the transaction.
++  
++5.1 Certificate Enrollment
++
++The certificate enrollment transaction consists of one PKCSReq message
++sent to the certificate authority from a requester, and one CertRep
++message sent back from the server. The pkiStatus returned in the
++response message is either SUCCESS, or FAILURE, or PENDING.  The
++information portion of a PKCSReq message is a PKCS#10 certificate
++request, which contains the subject Distinguished Name, the subject
++public key, and two attributes, a ChallengePassword attribute to be used
++for revocation, and an optional ExtensionReq attribute which will be a
++sequence of extensions the requester expects to be included in its V3
++certificate extensions. One of the extension attribute specifies the key
++usage.  If the request is granted, the pkiStatus is set to SUCCESS, and
++the certificate is returned in CertRep; if the request is rejected, the
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 17]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++pkiStatus is set to FAILURE; if the server requires manual approval of
++the request, the pkiStatus is set to PENDING. The messages exchanged
++in the manual authentication mode is further specified in Section 5.2.
++
++Precondition:
++  Both the requester and the certificate authority have completed their
++  initialization process. The requester has already been configured
++  with the CA/RA certificate. 
++
++Postcondition: 
++  Either the certificate is received by the requester, or the end
++  entity is notified to do the manual authentication, or the request
++  is rejected. 
++  
++5.1.1 PKCSReq Message Format
++
++A PKCSReq message is created by following the steps defined below: 
++  
++1.  Create a PKCS#10 certificate request which is signed by the end 
++    entity's private key, corresponding to the public key included in
++    the PKCS#10 certificate request. This constitutes the information
++    portion of PKCSReq. 
++
++2.  Encrypt the PKCS#10 certificate request using a randomly generated 
++    content-encryption key. This content-encryption key is then 
++    encrypted by the CA's* public key and included in the recipientInfo.
++    This step completes the "envelope" for the PKCS#10 certificate
++    request. 
++
++3.  Generate a unique string as the transaction id. 
++
++4.  Generate a 16 byte random number as senderNonce. 
++
++5.  Generate message digest on the enveloped PKCS#10 certificate request
++    using the selected digest algorithm. 
++
++6.  Create SignedData by adding the requester's self- or CA-certificate
++    as the  signer's public key certificate. Include the message type,
++    transaction id, the senderNonce and the message digest as the
++    authenticated attributes and sign the attributes using the end 
++    entity's private key. This completes the SignedData. 
++
++7.  The SignedData is prepended with the ContenInfo blob which indicates
++    a SignedData object. This final step completes the create of a
++    complete PKCSReq PKI message. 
++
++In the following, the PKCSReq message is defined following the ASN.1
++notation.
++
++For readability, the values of a field is either represented by a quoted
++string which specifies the intended value, or a constant when the value
++is known.
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 18]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++  -- PKCSReq information portion 
++  pkcsCertReq CertificationRequest ::= {   -- PKCS#10 
++      version 0 
++      subject  "the requester's subject name" 
++      subjectPublicKeyInfo { 
++          algorithm {pkcs-1 1}  -- rsa encryption 
++          subjectPublicKey "DER encoding of the requester's public key"
++      } 
++      attributes { 
++          challengePassword {{pkcs-9 7} "password string" } 
++          extensions 
++      } 
++      signatureAlgorithm {pkcs-1 4} -- MD5WithRSAEncryption 
++      signature "bit string which is created by signing inner content 
++                of the defined pkcsCertReq using requester's private
++                key, corresponding to the public key included in 
++                subjectPublicKeyInfo." 
++  } 
++  -- Enveloped information portion 
++  pkcsCertReqEnvelope EnvelopeData ::= {   -- PKCS#7 
++      version 0 
++      recipientInfo { 
++          version 0 
++          issuerAndSerialNumber { 
++              issuer  "the CA issuer name" 
++              serialNumber  "the CA certificate serial number" 
++          } 
++          keyEncryptionAlgorithm  {pkcs-1 1}  -- rsa encryption 
++          encryptedKey "content-encryption key
++                        encrypted by CA public key"
++      } 
++      encryptedContentInfo { 
++          contentType {pkcs-7 1}  -- data content 
++          contentEncryptionAlgorithm  "object identifier 
++                                       for DES encryption" 
++          encryptedContent  "encrypted pkcsCertReq using the content-
++                             encryption key" 
++      } 
++  } 
++  -- Signed PKCSReq 
++  pkcsCertReqSigned SignedData ::= { -- PKCS#7 
++      version 1 
++      digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                       digestAlgorithm(2) 5} 
++      contentInfo { 
++          contentType {pkcs-7 1} -- data content identifier 
++          content  pkcsCertReqEnvelope 
++      } 
++     certificate {   -- requester self-signed or CA-issued certificate 
++          version 3 
++          serialNumber  "the transaction id associated with enrollment"
++          signature {pkcs-1 4}  -- md5WithRSAEncryption 
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 19]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++     issuer " the requester's subject name" 
++          validity { 
++              notBefore "a UTC time" 
++              notAfter  "a UTC time" 
++          } 
++          subject  "the requester's subject name" 
++          subjectPublicKeyInfo { 
++              algorithm {pkcs-1 1} 
++              subjectPublicKey "DER encoding of requester's public key"
++          } 
++          signatureAlgorithm {pkcs-1 4} 
++          signature "the signature generated by using the requester's 
++                     private key corresponding to the public key in 
++                     this certificate." 
++      } 
++      signerInfo  { 
++          version 1 
++          issuerAndSerialNumber { 
++              issuer "the requester's subject name" 
++              serialNumber "the transaction id associated 
++                            with the enrollment" 
++          } 
++          digestAlgorithm {iso(0) member-body(2) US(840) rsadsi(113549) 
++                           digestAlgorithm(2) 5} 
++          authenticateAttributes { 
++              contentType  {{pkcs-9 3} {pkcs-7 1}} 
++              messageDigest {{pkcs-9 4} "an octet string"} 
++              transaction-id {{id-attributes transId(7)} "printable
++                                                          string"}
++                             -- this transaction id will be used 
++                             -- together with the subject name as
++                             -- the identifier of the requester's key
++                             -- pair during enrollment 
++              messageType {{id-attributes messageType(2)} "PKCSReq"}
++              senderNonce {{id-attributes senderNonce(5)} 
++                           "a random number encoded as a string"} 
++          } 
++          digestEncryptionAlgorithm {pkcs-1 1} -- rsa encryption 
++          encryptedDigest "encrypted digest of the authenticated
++                           attributes using requester's private key"
++      } 
++  }
++  pkcsReq PKIMessage ::= { 
++      contentType {pkcs-7 2} 
++      content pkcsCertRepSigned 
++  } 
++  
++
++
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 20]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++5.1.2 CertRep Message Format
++
++The response to an SCEP enrollment request is a CertRep message.
++
++5.1.2.1 PENDING Response
++
++When the CA is configured to manually authenticate the requester,
++the CertRep is returned with the attribute pkiStatus set to PENDING.
++The data portion for this message is null. Only the transaction
++required attributes are sent back.
++
++CertRepSigned  SignedData ::= { -- PKCS#7 
++    version 1 
++    digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                     digestAlgorithm(2) 5} 
++    contentInfo {contentType {pkcs-7 1}  -- empty content 
++    } 
++    signerInfo { 
++        version 1 
++        issuerAndSerialNumber { 
++           issuer "name of CA that issued the CA [RA] cert" 
++           serialNumber "the serial number of the CA [RA] cert" 
++        } 
++        digestAlgorithm (iso(1) member-body(2) US(840) rsadsi(113549) 
++                         digestAlgorithm(2) 5} 
++        authenticateAttributes { 
++            contentType {{pkcs-9 3} {pkcs-7 1}} 
++            messageDigest {{pkcs-9 4} NULL} 
++            messageType {{id-attribute messageType(0)} "CertRep"} 
++            transaction-id {{id-attributes transid(7)} "printablestring"}
++                           --- same transaction id used in PKCSReq 
++            pkiStatus  {{id-attributes pkiStatus(3)} "PENDING"} 
++            recipientNonce {{id-attributes recipientNonce(6)}<16 bytes>}
++            senderNonce {{id-attributes senderNonce(5)} <16 bytes>}
++        } 
++        digestEncrytionAlgorithm {pkcs-1 1} 
++        encryptedDigest  "encrypted message digest of the authenticated
++                         attributes using the CA's [RA's] private key"
++     } 
++} 
++CertRep PKIMessage ::= { 
++    contentType {pkcs-7 2} 
++    content CertRepSigned 
++} 
++
++5.1.2.2 Failure Response
++
++In this case, the CertRep sent back to the requester is same as in
++the PENDING case, except that the pkiStatus attribute is set to FAILURE,
++and the failInfo attribute should be included:
++
++    pkistatus {{id-attributes pkiStatus(3)} "FAILURE"} 
++    failInfo {{id-attributes failInfo(4)} "the reason to reject"} 
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 21]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++  
++5.1.2.3  SUCCESS response
++
++In this case, the information portion of CertRep will be a degenerated
++PKCS#7 which contains the requester's certificate. It is then enveloped
++and signed as below:
++
++pkcsCertRep SignedData ::= { -- PKCS#7 
++    version 1 
++    digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                     digestAlgorithm(2) 5} 
++    contentInfo { -- empty content since this is degenerated PKCS#7 
++        contentType {pkcs-7 1} 
++    } 
++    certificates { 
++        certificate { -- issued requester's certificate  // must be first
++            version 3 
++            serialNumber "issued requester's certificate serial number"
++            signature {pkcs-1 4}  -- md5WithRSAEncryption 
++            issuer "the certificate authority issuer name" 
++            validity { 
++                notBefore "UTC time" 
++                notAfter "UTC time" 
++            } 
++            subject  "the requester subject name as given in PKCS#10" 
++            subjectPublicKeyInfo { 
++                algorithm {pkcs-1 1} 
++                subjectPublicKey "a DER encoding of requester public
++                                  key as given in PKCS#10" 
++            } 
++            extensions  " the extensions as given in PKCS#10" 
++            signatureAlgorithm {pkcs-1 4} 
++            signature " the certificate authority signature" 
++        } 
++        certificate "the certificate authority certificate" (optional)
++        certificate "the registration authority certificate(s)" (optional) 
++    } 
++} 
++pkcsCertRepEnvelope EnvelopedData ::= {  -- PKCS#7 
++    version 0 
++    recipientInfo { 
++        version 0 
++        issuerAndSerialNumber { -- use issuer name and serial number as
++                                -- conveyed in requester's self-signed 
++                                -- certificate, included in the PKCSReq 
++            issuer  "the requester's subject name" 
++            serialNumber "the serial number defined by the requester in
++                          its self-signed certificate" 
++        } 
++        keyEncryptionAlgorithm {pkcs-1 1} 
++        encryptedKey "content-encrypt key encrypted by the requester's 
++                      public key which is same key as authenticated in 
++                      the requester's certificate" 
++    } 
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 22]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++    encryptedContentInfo { 
++        contentType {pkcs-7 1}  -- data content identifier 
++        contentEncryptionAlgorithm "OID for DES encryption" 
++        encryptedContent "encrypted pkcsCertRep using content encryption 
++                          key" 
++    } 
++} 
++pkcsCertRepSigned SignedData ::= { -- PKCS#7 
++    version 1 
++    digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                     digestAlgorithm(2) 5} 
++    contentInfo { 
++        contentType {pkcs-7 1} 
++        content pkcsCertRepEnvelope 
++    } 
++    signerInfo { 
++        version 1 
++        issuerAndSerialNumber { 
++            issuer "the certificate authority issuer name" 
++            serialNumber "the CA certificate's serial number" 
++        } 
++        digestAlgorithm {iso(1), member-body(2) US(840) rsadsi(113549) 
++                         digestAlgorithm(2) 5} 
++        authenticateAttributes { 
++            contentType {{pkcs-9 3} {pkcs-7 1}} 
++            messageDigest {{pkcs-9 4} "a octet string"} 
++            messageType {{id-attribute messageType(2)} "CertRep"} 
++            transaction-id {{id-attributes transId(7)} "printable
++                                                        string"}
++                          -- same transaction id as given in PKCSReq 
++            pkiStatus {{id-attributes pkiStatus(3) "SUCCESS"} 
++            recipientNonce {{id-attribute recipientNonce(6)}<16 bytes>}
++            senderNonce {{ id-attributes senderNonce(5) <16 bytes>} 
++        } 
++        digestEncryptionAlgorithm {pkcs-1 1} 
++        encryptedDigest "encrypted digest of authenticate attributes 
++                         using CA's private key " 
++    } 
++} 
++CertRep PKIMessage ::= { 
++    contentType {pkcs-7 2} 
++    content pkcsCertRepSigned 
++} 
++  
++5.2 Poll for Requester Initial Certificate
++
++Either triggered by the PENDING status received from the CertRep, or by
++the non-response timeout for the previous PKCSReq, a requester will
++enter the polling state by periodically sending GetCertInitial to the
++server, until either the request is granted and the certificate is sent
++back, or the request is rejected, or the configured time limit for
++polling is exceeded.
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 23]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++Since GetCertInitial is part of the enrollment, the messages exchanged
++during the polling period should carry the same transaction identifier
++as the previous PKCSReq.
++
++PreCondition 
++    Either the requester has received a CertRep with pkiStatus set to be 
++    PENDING, or the previous PKCSReq has timed out. 
++
++PostContition 
++    The requester has either received the certificate, or be rejected of
++    its request, or the polling period ended as a failure. 
++  
++5.2.1 GetCertInitial Message Format
++
++Since at this time the certificate has not been issued, the requester
++can only use the requester's subject name, combined with the
++transaction identifier, to identify the polled certificate request.
++
++The certificate authority server must be able to uniquely identify the
++polled certificate request.  A subject name can have more than one
++outstanding certificate request (with different key usage attributes).
++
++-- Information portion
++
++pkcsGetCertInitial issuerAndSubject ::= { 
++    issuer "the certificate authority issuer name" 
++    subject "the requester subject name as given in PKCS#10" 
++} 
++pkcsGetCertInitialEnvelope EnvelopedData ::= { 
++    version 0 
++    recipientInfo { 
++        version 0 
++        issuerAndSerialNumber { 
++            issuer  "the CA issuer name" 
++            serialNumber "the CA certificate serial number" 
++        } 
++        keyEncryptionAlgorithm {pkcs-1 1} 
++        encryptedKey "content-encrypt key encrypted by CA's public key"
++    } 
++    encryptedContentInfo { 
++        contentType {pkcs-7 1}  -- data content 
++        contentEncryptionAlgorithm "OID for DES encryption" 
++        encryptedContent "encrypted getCertInital" 
++    } 
++} 
++pkcsGetCertInitialSigned SignedData ::= { -- PKCS#7 
++    version 1 
++    digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                     digestAlgorithm(2) 5} 
++    contentInfo { 
++        contentType {pkcs-7 1} 
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 24]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++        content pkcsGetCertIntialEnvelope 
++    } 
++     certificate {   -- the requester's self-signed certificate 
++         version 3 
++         serialNumber  "the transaction id associated with enrollment"
++         signature {pkcs-1 4}  -- md5WithRSAEncryption 
++         issuer " the requester's subject name" 
++         validity { 
++             notBefore "a UTC time" 
++             notAfter  "a UTC time" 
++         } 
++         subject  "the requester's subject name" 
++         subjectPublicKeyInfo { 
++             algorithm {pkcs-1 1} 
++             subjectPublicKey "DER encoding of requester's public key"
++         } 
++         signatureAlgorithm {pkcs-1 4} 
++         signature "the signature generated by using the requester's 
++                    private key corresponding to the public key in 
++                    this certificate." 
++     } 
++    signerInfo { 
++        version 1 
++        issuerAndSerialNumber { 
++            issuer "requester's subject name" 
++            serialNumber "the transaction id used in previous PKCSReq"
++        } 
++        digestAlgorithm {iso(1), member-body(2) US(840) rsadsi(113549) 
++                         digestAlgorithm(2) 5} 
++        authenticateAttributes { 
++            contentType {{pkcs-9 3} {pkcs-7 1}} 
++            messageDigest {{pkcs-9 4} "an octet string"} 
++                            -- digest of getCertInitial 
++            messageType {{id-attribute messageType(2)} "GetCertInitial"}
++            transaction-id {{id-attributes transId(7)} "printable
++                                                        string"} 
++                          -- same transaction idused in previous PKCSReq
++            senderNonce {{id-attribute senderNonce(3)} 0x<16 bytes>} 
++        } 
++        digestEncryptionAlgorithm {pkcs-1 1} 
++        encryptedDigest "encrypted digest of authenticateAttributes" 
++    } 
++} 
++GetCertInitial PKIMessage ::= { 
++    contentType {pkcs-7 2} 
++    content pkcsGetCertInitialSigned 
++} 
++
++
++
++5.2.2 GetCertInitial Response Message Format
++
++The response messages for GetCertInitial are the same as for PKCSReq.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 25]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++  
++5.3  Certificate Access
++
++The certificate query message defined in this section is an option when
++the LDAP server is not available to provide the certificate query.  A
++requester should be able to query an issued certificate from the
++certificate authority, as long as the issuer name and the issuer
++assigned certificate serial number is known to the requesting end
++entity. This transaction is not intended to provide the service as a
++certificate directory service. A more complicated query mechanism would
++have to be defined in order to allow a requester to query a certificate
++using various different fields.
++
++This transaction consists of one GetCert message sent to the server by
++a requester, and one CertRep message sent back from the server.
++
++PreCondition 
++   The queried certificate have been issued by the certificate authority
++   and the issuer assigned serial number is known. 
++
++PostCondition 
++    Either the certificate is sent back or the request is rejected. 
++  
++  
++5.3.1 GetCert Message Format
++
++The queried certificate is identified by its issuer name and the issuer
++assigned serial number. If this is a query for an arbitrary requester's
++certificate, the requesting requester should includes its own CA issued
++certificate in the signed envelope. If this is a query for its own
++certificate (assume the requester lost the issued certificate, or does
++not have enough non-volatile memory to save the certificate), then the
++self-signed certificate has to be included in the signed envelope.
++
++  pkcsGetCert issuerAndSerialNumber ::= { 
++      issuer "the certificate issuer name" 
++      serialNumber "the certificate serial number" 
++  } 
++  pkcsGetCertEnvelope EnvelopedData ::= { 
++      version 0 
++      recipientInfo { 
++          version 0 
++          issuerAndSerialNumber { 
++              issuer  "the CA [RA] issuer name" 
++              serialNumber "the CA [RA] certificate serial number" 
++          } 
++          keyEncryptionAlgorithm {pkcs-1 1} 
++          encryptedKey "content-encrypt key encrypted 
++                        by CA [RA] public key"
++      } 
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 26]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++      encryptedContentInfo { 
++          contentType {pkcs-7 1}  -- data content 
++          contentEncryptionAlgorithm "OID for DES encryption" 
++          encryptedContent "encrypted pkcsGetCert using the content 
++                            encryption key" 
++      } 
++  } 
++  pkcsGetCertSigned SignedData ::= { 
++      version 1 
++      digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                       digestAlgorithm(2) 5} 
++      contentInfo { 
++          contentType {pkcs-7 1} 
++          content pkcsGetCertEnvelope 
++      } 
++      certificates { 
++          certificate "CA issued certificate" 
++                      or "self-signed certificate" 
++      } 
++      signerInfo { 
++          version 1 
++          issuerAndSerialNumber { 
++              issuer "the requester's subject name" 
++              serialNumber "requester's certificate serial number" 
++          } 
++          digestAlgorithm {iso(1), member-body(2) US(840) rsadsi(113549) 
++                           digestAlgorithm(2) 5} 
++          authenticateAttributes { 
++              contentType {{pkcs-9 3} {pkcs-7 1}} 
++              messageDigest {{pkcs-9 4} "an octet string"} 
++                              -- digest of pkcsGetCertEnvelope 
++              messageType {{id-attribute messageType(2)} "GetCert"} 
++              transaction-id {{id-attributes transId(7)} "printable
++                                                          string"} 
++              senderNonce {{id-attribute senderNonce(3)} <16 bytes>} 
++          } 
++          digestEncryptionAlgorithm {pkcs-1 1} 
++          encryptedDigest "encrypted digest of authenticateAttributes"
++      } 
++  } 
++  GetCert PKIMessage ::= { 
++      contentType {pkcs-7 2} 
++      content pkcsGetCertSigned 
++  } 
++
++
++
++
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 27]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++5.3.2 CertRep Message Format
++
++In this case, the CertRep from the server is same as the CertRep for the
++PKCSReq, except that the server will only either grant the request or
++reject the request. Also, the recipientInfo should use the CA issuer
++name and CA assigned serial number to identify the requester's key pair
++since at this time, the requester has received its own certificate.
++  
++5.4  CRL Access
++
++The CRL query message defined in this section is an option when the LDAP
++server is not available to provide the CRL query.  In the PKI protocol
++proposed here, only the requester can initiate the transaction to
++download CRL. A requester sends GetCRL request to the server and the
++server sends back CertRep whose information portion is a degenerated
++PKCS#7 which contains only the most recent CRL. The size of CRL included
++in the CertRep should be determined by the implementation.
++
++PreCondition 
++    The certificate authority certificate has been downloaded to the end
++    entity. 
++
++PostCondition 
++    CRL sent back to the requester. 
++  
++5.4.1 GetCRL Message format
++
++The CRL is identified by using both CA's issuer name and the CA
++certificate's serial number:
++
++  pkcsGetCRL issuerAndSerialNumber { 
++      issuer "the certificate authority issuer name" 
++      serialNumber "certificate authority certificate's serial number" 
++  } 
++
++When the CRLDistributionPoint is supported, the pkcsGetCRL is defined as
++the following:
++
++  pkcsGetCRL SEQUENCE { 
++      crlIssuer  issuerAndSerialNumber 
++      distributionPoint CE-CRLDistPoints 
++  } 
++
++where CE-CRLDisPoints is defined in X.509, but must contain only one
++CRL distribution point.
++
++
++
++
++
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 28]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++  pkcsGetCRLEnvelope EnvelopedData ::= { 
++      version 0 
++      recipientInfo { 
++          version 0 
++          issuerAndSerialNumber { 
++              issuer  "the certificate authority (or RA) issuer name" 
++              serialNumber "the CA (RA) certificate's serial number" 
++          } 
++          keyEncryptionAlgorithm {pkcs-1 1} 
++          encryptedKey "content-encrypt key encrypted by CA (RA) public key" 
++      } 
++      encryptedContentInfo { 
++          contentType {pkcs-7 1}  -- data content 
++          contentEncryptionAlgorithm "OID for DES encryption" 
++          encryptedContent "encrypted pkcsGetCRL" 
++      } 
++  } 
++  pkcsGetCRLSigned SignedData ::= { 
++      version 1 
++      digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                       digestAlgorithm(2) 5} 
++      contentInfo { 
++          contentType {pkcs-7 1} 
++          content pkcsGetCRLEnvelope 
++      } 
++      certificates { 
++         certificate "CA-issued or self-signed requester's certificate" 
++      } 
++      signerInfo { 
++          version 1 
++          issuerAndSerialNumber { 
++              issuer "the requester's issuer name" 
++              serialNumber "the requester's certificate serial number" 
++          } 
++          digestAlgorithm {iso(1), member-body(2) US(840) rsadsi(113549) 
++                           digestAlgorithm(2) 5} 
++          authenticateAttributes { 
++              contentType {{pkcs-9 3} {pkcs-7 1}} 
++              messageDigest {{pkcs-9 4} 0x<16/20 bytes>} 
++                              -- digest of pkcsGetCRLEnvelope 
++              messageType {{id-attribute messageType(2)} "CertCRL"} 
++              transaction-id {{id-attributes transId(7)} "printable
++                                                          string"} 
++              senderNonce {{id-attribute senderNonce(3)} <16 bytes>}
++          } 
++          digestEncryptionAlgorithm {pkcs-1 1} 
++          encryptedDigest "encrypted digest of authenticateAttributes"
++      } 
++  } 
++  GetCRL PKIMessage ::= { 
++      contentType {pkcs-7 2} 
++      content pkcsGetCRLSigned 
++  } 
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 29]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++5.4.2  CertRep Message Format
++
++The CRL is sent back to the requester through CertRep message. The
++information portion of this message is a degenerated PKCS#7 SignedData
++which contains only a CRL.
++
++  pkcsCertRep SignedData ::= { 
++      version 1 
++      digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                       digestAlgorithm(2) 5} 
++      contentInfo { 
++          contentType {pkcs-7 1} 
++      } 
++      crl { 
++          signature {pkcs-1 4} 
++          issuer "the certificate authority issuer name" 
++          lastUpdate "UTC time" 
++          nextUpdate "UTC time" 
++          revokedCertificate { 
++              -- the first entry 
++              userCertificate "certificate serial number" 
++              revocationData "UTC time" 
++              .... 
++              -- last entry 
++              userCertificate "certificate serial number" 
++              revocationData "UTC time" 
++      } 
++  } 
++  pkcsCertRepEnvelope EnvelopedData ::= { 
++      version 0 
++      recipientInfo { 
++          version 0 
++          issuerAndSerialNumber { 
++              issuer  "the requester's issuer name" 
++              serialNumber "the requester certificate serial number" 
++          } 
++          keyEncryptionAlgorithm {pkcs-1 1} 
++          encryptedKey "content-encrypt key encrypted by requester's 
++                        public key " 
++      } 
++      encryptedContentInfo { 
++          contentType {pkcs-7 1}  -- data content 
++          contentEncryptionAlgorithm "OID for DES encryption" 
++          encryptedContent "encrypted pkcsCertRep using requester's 
++                            public key" 
++      } 
++  } 
++ 
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 30]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++  pkcsCertRepSigned SignedData ::= { -- PKCS#7 
++      version 1 
++      digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                       digestAlgorithm(2) 5} 
++      contentInfo { 
++          contentType {pkcs-7 1} 
++          content pkcsCertRepEnvelope 
++      } 
++      signerInfo { 
++          version 1 
++          issuerAndSerialNumber { 
++              issuer "the certificate authority issuer name" 
++              serialNumber "the CA certificate's serial number" 
++          } 
++          digestAlgorithm {iso(1), member-body(2) US(840) rsadsi(113549) 
++                           digestAlgorithm(2) 5} 
++          authenticateAttributes { 
++              contentType {{pkcs-9 3} {pkcs-7 1}} 
++              messageDigest {{pkcs-9 4} "an octet string"} 
++                            -- digest of pkcsCertRepEnvelope 
++              messageType {{id-attribute messageType(2)} "CertRep"} 
++              transaction-id {{id-attributes transId(7)} "printable
++                                                          string"} 
++                            -- same transaction id as given in PKCSReq 
++              pkiStatus {{id-attributes pkiStatus(3) "SUCCESS"} 
++              recipientNonce{{id-attribute recipientNonce(6)}<16 bytes>}
++              senderNonce {{id-attribute senderNonce (5) 0x<16 bytes>} 
++          } 
++          digestEncryptionAlgorithm {pkcs-1 1} 
++          encryptedDigest "encrypted digest of authenticatedAttributes
++                           using CA private key" 
++      } 
++  } 
++  
++
++NOTE:The PKCS#7 EncryptedContent is specified as an octet string, but
++SCEP entities must also accept a sequence of octet strings as a valid
++alternate encoding.   
++
++This alternate encoding must be accepted wherever PKCS #7 Enveloped
++Data is specified in this document.  
++
++
++
++
++
++
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 31]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++5.5 Get Certificate Authority Certificate
++
++Before any transaction begins, end entities have to get the CA (and
++possibly RA) certificate(s) first.  Since the requester may have no CA
++certificates or CA public keys at all, this message can not be
++encrypted and the response must be authenticated by out-of-band means.
++These certs are obtained by means of an HTTP GET message.  To get the
++CA certificate, the requester does a "HTTP GET" with a URL that
++identifies a CGI script on the server and an optional CA issuer
++identifier as the parameter to the CGI script.  The response is either
++a single X.509 CA certificate ("CA mode"), or a PKCS7 message
++containing the CA certificate and RA certificates ("RA mode").  The
++client can determine which mode the CA operates in by which response
++it gets.  Once the CA certificate is received by the requester, a
++fingerprint is generated using either the SHA-1 or the MD5 hash
++algorithm on the whole CA certificate.  If the requester does not have
++a certificate path to a trusted CA certificate, this fingerprint may
++be used to verify the certificate, by some positive out-of-band means,
++such as a phone call.
++
++5.5.1 GetCACert HTTP Message Format 
++   "GET" CGI-PATH CGI-PROG "?operation=GetCACert" "&message=" CA-IDENT 
++    where: 
++      CGI-PATH defines the actual CGI path to invoke the CGI program
++      which parses the request. 
++      CGI-PROG is set to be the string "pkiclient.exe" and this is
++        expected to be the program that the CA will use to handle the
++        SCEP transactions.
++        CA-IDENT is any string which is understood by the CA.
++        For example, it could be a domain name like ietf.org.
++      If a certificate authority has multiple CA certificates
++      this field can be used to distinguish which is required.
++      Otherwise it may be ignored.
++  
++5.5.2 Response
++
++The response for GetCACert is different between the case where the CA
++directly communicated with the requester during the enrollment, and the
++case where a RA exists and the requester communicates with the RA
++during the enrollment.
++
++5.5.2.1 CA Certificate Only Response
++
++A binary X.509 CA certificate is sent back as a MIME object with a
++Content-Type of application/x-x509-ca-cert.
++
++5.5.2.2 CA and RA Certificates Response 
++
++When an RA exists,  both CA and RA certificates must be sent back in
++the response to the GetCACert request.  The RA certificate(s) must be
++signed by the CA.   A certificates-only PKCS#7 SignedData is used to
++carry the certificates to the requester, with a Content-Type of
++application/x-x509-ca-ra-cert.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 32]
++
++5.5.3 Get Next Certificate Authority Certificate
++
++5.5.3.1 GetNextCACert HTTP Message Format 
++   "GET" CGI-PATH CGI-PROG "?operation=GetNextCACert" "&message=" CA-IDENT 
++
++The response to this message is a PKCS#7 certificates-only message containing
++a CA certificate (and possibly RA certificates) to be used when the current CA
++certificate expires, signed with the current CA cert (or RA certificate, if
++the CA is in RA mode.  Note that a PKCS#7 is returned even in CA mode.
++
++5.5.3.2 GetCACaps HTTP Message Format 
++   "GET" CGI-PATH CGI-PROG "?operation=GetCACaps" "&message=" CA-IDENT 
++
++This message requests capabilities from CA.  The response is a list of
++text capabilities, as defined in Appendix F.  Support for this message
++is optional, but if it is not supported, the client should assume that
++none of the capabilities in Appendix F are supported.
++
++5.6 Get Certificate Authority Certificate Chain
++
++GetCACertChain provides  a way to get the entire certificate chain.
++
++5.6.1 GetCACertChain HTTP Message Format 
++
++   "GET" CGI-SCRIPT "?" "operation=GetCACertChain" "&" "message" CA-IDENT 
++    where CGI-SCRIPT and CA-IDENT are as described for GetCACert.
++  
++5.6.2 Response
++
++The response for GetCACertChain is a certificates-only PKCS#7 SignedData
++to carry the certificates to the requester, with a Content-Type of
++application/x-x509-ca-ra-cert-chain.
++
++5.6.3 Backwards Compatability
++
++Versions of SCEP prior to revision 3 do not support GetCACertChain.
++Certificate Authorities written to these prior versions will not be
++able to process the message and may return an HTML error.
++
++To avoid this, clients should send the GetCACert message first.  If the
++returned certificate is self-signed or is signed by a Certificate
++Authority that is trusted by the client, then it is not necessary to
++send the GetCACertChain message and it should not be sent.
++
++If a Certificate Authority is configured with a certificate that is
++not either self-signed or has a self-signed issuer, then it should
++support this message.  In other words, it should be supported if the
++CA hierarchy is more than two-deep.
++
++An old CA in a two-deep hierarchy might still get this message from
++a client if the client did not trust either that CA or its issuer.
++In that event, the certificate cannot be trusted anyway. In any case
++the CA must not crash or hang upon the receipt of the message and the
++client must be able to handle whatever error is returned by the CA,
++including an HTML error or an ungraceful disconnect.
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 33]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++The following is the ASN.1 definition of Cert-Only PKCS#7: 
++
++  certOnly SignedData ::= { 
++      version 1 
++      digestAlgorithm {iso(1) member-body(2) US(840) rsadsi(113549) 
++                       digestAlgorithm(2) 5} 
++
++contentInfo { 
++          contentType {pkcs-7 1} -- data content identifier 
++          content  -- NULL 
++      } 
++      certificates   -- the RA and CA certificates. 
++  } 
++
++  CARACerts PKIMessage ::= {  -- special pki message sent in the clear 
++      contentType {pkcs-7 2} 
++      content certOnly 
++  } 
++
++
++6.0 Security Considerations
++
++This entire document is about security. Common security considerations
++such as keeping private keys truly private and using adequate lengths
++for symmetric and asymmetric keys must be followed in order to maintain
++the security of this protocol.
++
++
++7.0 Intellectual Property
++
++This protcol includes the optional use of Certificate Revocation List
++Distribution Point (CRLDP) technology, which is a patented technology
++of Entrust Technologies, Inc. (Method for Efficient Management of
++Certificate Revocation Lists and Update Information (U.S. Patent
++5,699,431)). Please contact Entrust Technologies, Inc.
++(www.entrust.com) for more information on licensing CRLDP technology.
++
++
++8.0 References
++
++[PKCS7] Kaliski, B., "PKCS #7: Cryptographic Message Syntax Version
++1.5", RFC 2315, March 1998.
++
++[PKCS10] Kaliski, B., "PKCS #10: Certification Request Syntax Version
++1.5", RFC 2314, March 1998.
++
++[RFC2459] Housley, R., ec. al., "Internet X.509 Public Key
++Infrastructure Certificate and CRL Profile", RFC 2459, January 1999.
++
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 34]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Appendix A: Cisco Requester Subject Name Definition
++
++The ip address and the FQDN of a SCEP client should be included in the
++V3 extension subjectAltName. When the subjectAltName extension attribute
++is present, both the subjectAltName fields and the subjectName field could
++have the IP address and the FQDN information.
++
++When the X.500 directory is used by the CA to define the name space, the
++subject name defined above become a RDN which is part of DN binded to
++the requester's public key in the certificate.
++
++
++A sample of DN assigned by Entrust CA is given below (assume the same 
++ciscoRouterAlice is used as the requester defined subject name): 
++
++    OU = InteropTesting, O = Entrust Technologies, C = CA 
++    RDN = {"alice.cisco.com", "172.21.114.67", "22334455"} 
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 35]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Appendix B:  IPSEC Client Enrollment Certificate Request
++
++The following is the certificate enrollment request (PKCS#10) as created
++by Cisco VPN Client:
++
++-----END NEW CERTIFICATE REQUEST----- 
++   0 30  439: SEQUENCE { 
++   4 30  288:   SEQUENCE { 
++   8 02    1:     INTEGER 0 
++  11 30   57:     SEQUENCE { 
++  13 31   55:       SET { 
++  15 30   53:         SEQUENCE { 
++  17 06    3:           OBJECT IDENTIFIER commonName (2 5 4 3) 
++  22 13   46:           PrintableString 
++            :             'For Xiaoyi, IPSEC attrs in alternate name 
++                           extn'
++            :           } 
++            :         } 
++            :       } 
++  70 30  158:     SEQUENCE { 
++  73 30   13:       SEQUENCE { 
++  75 06    9:         OBJECT IDENTIFIER rsaEncryption (1 2 840 113549 1
++                                                       1 1) 
++  86 05    0:         NULL 
++            :         } 
++  88 03  140:       BIT STRING 0 unused bits 
++            :         30 81 88 02 81 80 73 DB 1D D5 65 AA EF C7 D4 8E 
++            :         AA 6E EB 46 AC 91 2A 0F 50 51 17 AD 50 A2 2A F2 
++            :         CE BE F1 E4 22 8C D7 61 A1 6C 87 61 62 92 CB A6 
++            :         80 EA B4 0F 09 9D 18 5F 39 A3 02 0E DB 38 4C E4 
++            :         8A 63 2E 72 8B DC BE 9E ED 6C 1A 47 DE 13 1B 0F 
++            :         83 29 4D 3E 08 86 FF 08 2B 43 09 EF 67 A7 6B EA 
++            :         77 62 30 35 4D A9 0F 0F DF CC 44 F5 4D 2C 2E 19 
++            :         E8 63 94 AC 84 A4 D0 01 E1 E3 97 16 CD 86 64 18 
++            :                 [ Another 11 bytes skipped ] 
++            :       } 
++ 231 A0   63:     [0] { 
++ 233 30   61:       SEQUENCE { 
++ 235 06    9:         OBJECT IDENTIFIER extensionReq (1 2 840 113549 1 9
++                                                      14) 
++ 246 31   48:         SET { 
++ 248 30   46:           SEQUENCE { 
++ 250 30   44:             SEQUENCE { 
++ 252 06    3:               OBJECT IDENTIFIER subjectAltName (2 5 29 17) 
++ 257 04   37:               OCTET STRING 
++                              30 23 87 04 01 02 03 04 81 0D 65 6D 61 69
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 36]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++                              6C 40 69 72 65 2E 63 6F 6D 82 0C 66 71 64
++                              6E 2E 69 72 65 2E 63 6F 6D 
++            :               } 
++            :             } 
++            :           } 
++            :         } 
++            :       } 
++            :     } 
++
++ 296 30   13:   SEQUENCE { 
++ 298 06    9:     OBJECT IDENTIFIER md5withRSAEncryption (1 2 840 113549 
++                                                          1 1 4) 
++ 309 05    0:     NULL 
++            :     } 
++ 311 03  129:   BIT STRING 0 unused bits 
++            :     19 60 55 45 7F 72 FD 4E E5 3F D2 66 B0 77 13 9A 
++            :     87 86 75 6A E1 36 C6 B6 21 71 68 BD 96 F0 B4 60 
++            :     95 8F 12 F1 65 33 16 FD 46 8A 63 19 90 40 B4 B7 
++            :     2C B5 AC 63 17 50 28 F0 CD A4 F0 00 4E D2 DE 6D 
++            :     C3 4F F5 CB 03 4D C8 D8 31 5A 7C 01 47 D2 2B 91 
++            :     B5 48 55 C8 A7 0B DD 45 D3 4A 8D 94 04 3A 6C B0 
++            :     A7 1D 64 74 AB 8A F7 FF 82 C7 22 0A 2A 95 FB 24 
++            :     88 AA B6 27 83 C1 EC 5E A0 BA 0C BA 2E 6D 50 C7 
++            :   } 
++  
++
++Appendix C:   Private OID Definitions
++
++The OIDs used in defining pkiStatus are VeriSign self-maintained
++OIDs. Please note, work is in progress to replace the VeriSign owned
++object identifiers with the standard object identifiers. Once the
++standarlization is completed, this documentation will be updated.
++
++id-VeriSign   OBJECT_IDENTIFIER ::= {2 16 US(840) 1 VeriSign(113733)} 
++id-pki        OBJECT_IDENTIFIER ::= {id-VeriSign pki(1)} 
++id-attributes OBJECT_IDENTIFIER ::= {id-pki attributes(9)} 
++id-messageType  OBJECT_IDENTIFIER ::= {id-attributes messageType(2)} 
++id-pkiStatus    OBJECT_IDENTIFIER ::= {id-attributes pkiStatus(3)} 
++id-failInfo     OBJECT_IDENTIFIER ::= {id-attributes failInfo(4)} 
++id-senderNonce  OBJECT_IDENTIFIER ::= {id-attributes senderNonce(5)} 
++id-recipientNonce OBJECT_IDENTIFIER ::= {id-attributes recipientNonce(6)} 
++id-transId        OBJECT_IDENTIFIER ::= {id-attributes transId(7)} 
++id-extensionReq   OBJECT_IDENTIFIER ::= {id-attributes extensionReq(8)}
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 37]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++ Appendix D:   CRL Query by means of LDAP
++
++ In order to retrieve the CRL by means of LDAP, the client needs to know
++ where in the directory it is stored.  The certificate must contain a
++ CRL Distribution Point extension encoded as a DN or as an LDAP URI.
++
++For example, the certificate issued by Entrust VPN contains
++the following DN as the CRL distribution point:
++
++
++
++CN = CRL1, O = cisco, C = US.
++
++ The asn.1 encoding of this distribution point is:
++
++     30 2C 31 0B 30 09 06 03 55 04 06 13 02 55 53 31 0E 30 0C 06 
++     03 55 04 0A 13 05 63 69 73 63 6F 31 0D 30 0B 06 03 55 04 03 
++     13 04 43 52 4C 31 
++  
++
++The ldap form would be:
++
++ldap://servername/CN=CRL1,O=cisco,C=US
++
++
++
++Appendix E:  SCEP State Transitions
++
++SCEP state transitions are based on transaction identifier. The design
++goal is to ensure the synchronization between the CA and the requester
++under various error situations.
++
++
++An identity is defined by the combination of FQDN, the IP address and
++the client serial number.  FQDN is the required name attribute. It is
++important to notice that, a client named as Alice.cisco.com is different
++from the client named as Alice.cisco.com plus IPAddress 117.96.1.219.
++
++Each enrollment transaction is uniquely associated with a transaction
++identifier. Because the enrollment transaction could be interrupted by
++various errors, including network connection errors or client reboot,
++the SCEP client generates a transaction identifier by calculating a
++hash on the public key value for which the enrollment is requested. This
++retains the same transaction identifier throughout the enrollment
++transaction, even if the client has rebooted or timed out, and issues a
++new enrollment request for the same key pair.  It also provides the way
++for the CA to uniquely identify a transaction in its database.  At the
++requester side, it generates a transaction identifier which is included
++in PKCSReq.  If the CA returns a response of PENDING, the requester
++will poll by periodically sending out GetCertInitial with the same
++transaction identifier until either a response other than PENDING is
++obtained, or the configured maximum time has elapsed.
++
++If the client times out or the client reboots, the client administrator
++will start another enrollment transaction with the same key pair.  The
++second enrollment will have the transaction idenifier.  At the server
++side, instead of accepting the PKCSReq as a new enrollment request, it
++should respond as if another GetCertInitial message had been sent with
++that transaction ID.  In another word, the second PKCSReq should be
++taken as a resynchronization message to allow the enrollment resume as
++the same transaction.
++
++It is important to keep the transaction id unique since SCEP requires the
++same policy and same identity be applied to the same subject name and
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 38]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++key pair binding.  In the current implementation, an SCEP client can
++only assume one identity. At any time, only one key pair, with a given
++key usage, can be associated with the same identity.
++
++The following gives several examples of client to CA transactions.
++
++Client actions are indicated in the left column, CA actions are
++indicated in the right column.  A blank action signifies that no message
++was received.  Note that these examples assume that the CA enforces the
++certificate-name uniqueness property defined in Section 2.1.1.1.
++
++The first transaction, for example, would read like this: 
++ "Client Sends PKCSReq message with transaction ID 1 to the 
++  CA.  The CA signs the certificate and constructs a CertRep Message 
++  containing the signed certificate with a transaction ID 1.  The client 
++  receives the message and installs the cert locally." 
++
++Successful Enrollment Case: no manual authentication 
++PKCSReq (1)             ----------> CA Signs Cert 
++Client Installs Cert    <---------- CertRep (1) SIGNED CERT 
++
++
++
++Successful Enrollment Case:  manual authentication required 
++PKCSReq (10)            ----------> Cert Request goes into Queue 
++Client Polls            <---------- CertRep (10) PENDING 
++GetCertInitial (10)     ----------> Still pending 
++Client Polls            <---------- CertRep (10) PENDING 
++GetCertInitial (10)     ----------> Still pending 
++Client Polls            <---------- CertRep (10) PENDING 
++GetCertInitial (10)     ----------> Still pending 
++Client Polls            <---------- CertRep (10) PENDING 
++GetCertInitial (10)     ----------> Cert has been signed 
++Client Installs Cert    <---------- CertRep (10) SIGNED CERT 
++
++
++
++Resync Case - CA Receive and Signs PKCSReq, Client Did not receive 
++CertRep: 
++
++PKCSReq (3)           ----------> Cert Request goes into queue 
++                      <---------- CertRep (3) PENDING 
++GetCertInitial (3)    ----------> 
++                      <---------- CertRep (3) PENDING 
++GetCertInitial (3)    -----------> 
++                      <----------- CA signed Cert and sent back
++                                   CertRep(3) 
++(Time Out) 
++PKCSReq (3)           ----------> Cert already signed, sent back to
++                                  client 
++Client Installs Cert  <---------- CertRep (3) SIGNED CERT 
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 39]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++
++Case when NVRAM is lost and client has to generate a new key pair, there
++is no change of name information:
++
++PKCSReq (4)           ----------> CA Signs Cert 
++Client Installs Cert  <---------- CertRep (4) SIGNED CERT 
++(Client looses Cert) 
++PKCSReq (5)           ----------> There is already a valid cert with 
++                                  this DN. 
++Client Admin Revokes  <---------- CertRep (5) OVERLAPPING CERT ERROR 
++PKCSReq (5)           ----------> CA Signs Cert 
++Client Installs Cert  <---------- CertRep (5) SIGNED CERT 
++
++
++Case when client admin resync the enrollment using a different PKCS#10: 
++PKCSReq (6)             ----------> CA Signs Cert 
++                        <---------- CertRep (6) SIGNED CERT 
++(Client timeout and admin starts another enrollment with a different
++ PKCS#10, but the same transaction id) 
++PKCSReq (6)  with different PKCS#10 
++                        ----------> There is already a valid cert with 
++                                    this entity (by checking FQDN). 
++                        <---------- CertRep (6) INVALID PKCS#10 CERT
++                                     ERROR 
++Client admin either revokes the existing cert 
++or corrects the error by enrolling with 
++the same PKCS#10 as the first PKCSReq(6) 
++PKCSReq (6)             ----------> CA find the existing Cert 
++Client Installs Cert    <---------- CertRep (6) SIGNED CERT 
++
++
++Resync case when server is slow in response: 
++PKCSReq (13)    ---------->  Cert Request goes into Queue 
++                <----------  CertRep (13) PENDING 
++GetCertInitial  ----------> Still pending 
++                <----------  CertRep (13) PENDING 
++GetCertInitial  ---------->  Still pending 
++                <----------  CertRep (13) PENDING 
++GetCertInitial  ---------->  Still pending 
++                <----------  CertRep (13) PENDING 
++GetCertInitial  ---------->  Still pending 
++(TimeOut)       <----------  CertRep (13) PENDING 
++* Case 1 
++PKCSReq (13)          ---------->  Still pending 
++Client polls          <----------  CertRep (13) PENDING 
++CertCertInitial       ---------->  Cert has been signed 
++Client Installs Cert  <----------  CertRep (13) SIGNED CERT 
++* Case 2 
++PKCSReq (13)          ----------> Cert has been signed 
++Client Installs Cert  <---------- CertRep (13) SIGNED CERT 
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 40]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Appendix F. CA Capabilities
++
++The response for a GetCACaps message is a list of CA capabilities, in
++plain text, separated by <LF> characters, as follows (quotation marks
++are NOT sent):
++
++Keyword               Description
++
++"GetNextCACert"       CA Supports the GetNextCACert message.
++"POSTPKIOperation"    PKIOPeration messages may be sent via HTTP POST.
++"SHA-1"                     CA Supports the SHA-1 hashing algorithm in 
++                    signatures and fingerprints.  If present, the
++                    client SHOULD use SHA-1.  If absent, the client
++                    MUST use MD5 to maintain backward compatability.
++"Renewal"           Clients may use current certificate and key to
++                    authenticate an enrollment request for a new
++                    certificate.  
++
++A client must be able to accept and ignore any unknown keywords that
++might be sent back by a CA that implements a future version of SCEP.
++
++Example:
++
++GET /cgi-bin/pkiclient.exe?operation=GetCACaps&message=myca
++
++returns:
++
++GetNextCACert
++POSTPKIOperation
++
++This means that the CA supports the GetNextCACert message and allows
++PKIOperation messages (PKCSreq, GetCert, GetCertInitial...) to be sent
++using HTTP POST.
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 41]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Appendix G. Certificate Renewal and CA Key Rollover
++
++To renew a client certificate, use the PKCSreq message and sign it with
++the existing client certificate instead of a self-signed certificate.
++
++To obtain the new CA certificate prior to the expiration of the current
++one, use the GetNextCACert message if the CA supports it.
++
++To obtain a new client certificate signed by the new CA certificate,
++use the new CA or RA certificate in the message envelope.
++
++
++Example:
++
++GetNextCACert           ----------> 
++                      <---------- CertRep (3) New CA certificate
++
++PKCSReq* (1)            ----------> CA Signs certificate with NEW key
++Client Stores Cert      <---------- CertRep (3) Certificate issued
++for installation when               from NEW CA certificate and keypair.
++existing cert expires.
++
++
++*enveloped for new CA or RA cert and keypair.  The CA will use the
++envelope to determine which key and certificate to use to issue the 
++client certificate.
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 42]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Appendix H. PKIOperation via HTTP POST Message
++
++If the remote CA supports it, any of the PKCS#7-encoded SCEP messages
++may be sent via HTTP POST instead of HTTP GET.   This is allowed for
++any SCEP message except GetCACert, GetCACertChain, GetNextCACert,
++or GetCACaps.  In this form of the message, Base 64 encoding is not
++used.
++
++POST /cgi-bin/pkiclient.exe?operation=PKIOperation
++<binary PKCS7 data>
++
++The client can verify that the CA supports SCEP messages via POST by
++looking for the "POSTPKIOperation" capability (See Appendix F).
++
++
++
++
++
++
++\fLiu/Madson/McGrew/Nourse                                     [Page 43]
++
++Cisco Systems' Simple Certificate Enrollment Protocol         Feb 2005
++
++Appendix Y. Author Contact Information
++
++Xiaoyi Liu                    Cheryl Madson
++Cisco                         Cisco
++510 McCarthy Drive            510 McCarthy Drive
++Milpitas, CA                  Milpitas, CA.
++xliu@cisco.com                        cmadson@cisco.com
++
++
++David McGrew                  Andrew Nourse
++Cisco                         Cisco                           
++170 West Tasman Drive         510 McCarthy Drive
++San Jose, CA 94134            Milpitas, CA.
++mcgrew@cisco.com              nourse@cisco.com
++
++
++
++
++Appendix Z.  Copyright Section
++
++Copyright (C) The Internet Society (2005). This document is subject
++to the rights, licenses and restrictions contained in BCP 78, and
++except as set forth therein, the authors retain all their rights.
++
++This document and the information contained herein are provided on an
++"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
++OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
++ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
++INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
++INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
++WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
++
++
++
++
++This draft expires 11 Aug 2005
++
++[End of draft-nourse-scep-11.txt]
++
+diff -uN sscep/fileutils.c sscep-ng2/fileutils.c
+--- sscep/fileutils.c  2003-04-15 12:53:45.000000000 +0200
++++ sscep-ng2/fileutils.c      2006-04-28 10:03:24.000000000 +0200
+@@ -55,8 +55,11 @@
+       PKCS7                   *p7;
+       STACK_OF(X509)          *certs;
+       X509                    *cert = NULL;
++      ASN1_BIT_STRING         *cert_pubkey = NULL;
+       FILE                    *fp;
+       int                     i;
++      ASN1_BIT_STRING         *request_pubkey = 
++                                      request->req_info->pubkey->public_key;
+       localcert = NULL;
+@@ -66,29 +69,44 @@
+       /* Find cert */
+       for (i = 0; i < sk_X509_num(certs); i++) {
+-              char buffer[1024];
+-
+               cert = sk_X509_value(certs, i);
++              cert_pubkey = X509_get_X509_PUBKEY(cert)->public_key;
++#define fu_print_name(n) \
++      X509_NAME_print_ex_fp(stdout,(n),0,XN_FLAG_RFC2253|ASN1_STRFLGS_SHOW_TYPE)
+               if (v_flag) {
+-                      printf("%s: found certificate with\n"
+-                              "  subject: %s\n", pname,
+-                              X509_NAME_oneline(X509_get_subject_name(cert),
+-                                      buffer, sizeof(buffer)));
+-                      printf("  issuer: %s\n", 
+-                              X509_NAME_oneline(X509_get_issuer_name(cert),
+-                                      buffer, sizeof(buffer)));
++                      printf("%s: found certificate with\n  subject: ", pname);
++                      fu_print_name(X509_get_subject_name(cert));
++                      printf("\n  issuer:  "); 
++                      fu_print_name(X509_get_issuer_name(cert));
++                      printf("\n");
+               }
+-              /* The subject has to match that of our request */
+-              if (!X509_NAME_cmp(X509_get_subject_name(cert),
++              /* The public keys of the request and certificate must match */
++              if (M_ASN1_BIT_STRING_cmp(request_pubkey,cert_pubkey) != 0) {
++                      if (v_flag)
++                              printf("  public keys of request and certificate don't match\n");
++                      continue;
++              }
++              /* The subject has to match that of our request,
++                 if the "Compare subject DN" flag is set */
++              if (C_flag && X509_NAME_cmp(X509_get_subject_name(cert),
+                       X509_REQ_get_subject_name(request))) {
+-
+-                      /* The subject cannot be the issuer (selfsigned) */
+-                      if (X509_NAME_cmp(X509_get_subject_name(cert),
+-                              X509_get_issuer_name(cert))) {
+-                                      localcert = cert;       
+-                                      break;
++                      if (v_flag) {
++                              printf("  certificate subject names doesn't match request subject name:\n           ");
++                              fu_print_name(X509_REQ_get_subject_name(request));
++                              printf("\n");
+                       }
+-              }       
++                      continue;
++              }
++#undef fu_print_name
++              /* The subject cannot be the issuer (selfsigned) */
++              if (!X509_NAME_cmp(X509_get_subject_name(cert),
++                      X509_get_issuer_name(cert))) {
++                      if (v_flag)
++                              printf("  certificate is self signed\n");
++                      continue;
++              }
++              localcert = cert;       
++              break;
+       }
+       if (localcert == NULL) {
+               fprintf(stderr, "%s: cannot find requested certificate\n",
+@@ -320,34 +338,36 @@
+ /* Read local certificate (GetCert and GetCrl) */
+ void
+-read_local_cert(void) {
+-      if (!l_flag || !(localfile = fopen(l_char, "r"))) {
+-              fprintf(stderr, "%s: cannot open local cert file\n", pname);
++read_cert(X509** cert, char* filename) {
++        FILE *file;
++      if (!(file = fopen(filename, "r"))) {
++              fprintf(stderr, "%s: cannot open cert file %s\n", pname, filename);
+               exit (SCEP_PKISTATUS_FILE);
+       }
+-      if (!PEM_read_X509(localfile, &localcert, NULL, NULL)) {
+-              fprintf(stderr, "%s: error while reading local cert\n", pname);
++      if (!PEM_read_X509(file, cert, NULL, NULL)) {
++              fprintf(stderr, "%s: error while reading cert %s\n", pname, filename);
+               ERR_print_errors_fp(stderr);
+               exit (SCEP_PKISTATUS_FILE);
+       }
+-      fclose(localfile);
++      fclose(file);
+ }
+ /* Read private key */
+ void
+-read_key(void) {
++read_key(EVP_PKEY** key, char* filename) {
++        FILE *file;
+       /* Read private key file */
+-      if (!k_flag || !(keyfile = fopen(k_char, "r"))) {
+-              fprintf(stderr, "%s: cannot open private key file\n", pname);
++      if (!(file = fopen(filename, "r"))) {
++              fprintf(stderr, "%s: cannot open private key file %s\n", pname, filename);
+               exit (SCEP_PKISTATUS_FILE);
+       }
+-      if (!PEM_read_PrivateKey(keyfile, &rsa, NULL, NULL)) {
+-              fprintf(stderr, "%s: error while reading private key\n", pname);
++      if (!PEM_read_PrivateKey(file, key, NULL, NULL)) {
++              fprintf(stderr, "%s: error while reading private key %s\n", pname, filename);
+               ERR_print_errors_fp(stderr);
+               exit (SCEP_PKISTATUS_FILE);
+       }
+-      fclose(keyfile);
++      fclose(file);
+ }
+ /* Read PKCS#10 request */
+diff -uN sscep/init.c sscep-ng2/init.c
+--- sscep/init.c       2003-01-31 10:07:16.000000000 +0100
++++ sscep-ng2/init.c   2006-04-28 10:11:40.000000000 +0200
+@@ -61,6 +61,9 @@
+                                       if (!(i_char = strdup(str2))) 
+                                               error_memory();
+                                       }
++                      } else if (!strncmp(str1, "CheckSubjectName", 16)) {
++                              if (!strncmp(str2, "yes", 3) && !C_flag)
++                                      C_flag = 1;
+                       } else if (!strncmp(str1, "CertReqFile", 11)) {
+                               if (!r_flag) {
+                                       r_flag = 1;
+@@ -114,6 +117,12 @@
+                                       if (!(l_char = strdup(str2)))
+                                               error_memory();
+                               }
++                      } else if (!strncmp(str1, "SignCertFile", 12)) {
++                              if (!O_flag) {
++                                      O_flag = 1;
++                                      if (!(O_char = strdup(str2)))
++                                              error_memory();
++                              }
+                       } else if (!strncmp(str1, "MaxPollCount", 12)) {
+                               if (!n_flag) {
+                                       n_flag = 1;
+@@ -130,6 +139,12 @@
+                                       if (!(k_char = strdup(str2))) 
+                                               error_memory();
+                                       }
++                      } else if (!strncmp(str1, "SignKeyFile", 11)) {
++                              if (!K_flag) {
++                                      K_flag = 1;
++                                      if (!(K_char = strdup(str2))) 
++                                              error_memory();
++                                      }
+                       } else if (!strncmp(str1, "SelfSignedFile", 15)) {
+                               if (!L_flag) {
+                                       L_flag = 1;
+diff -uN sscep/pkcs7.c sscep-ng2/pkcs7.c
+--- sscep/pkcs7.c      2003-02-10 06:04:48.000000000 +0100
++++ sscep-ng2/pkcs7.c  2006-04-26 13:40:34.000000000 +0200
+@@ -28,7 +28,8 @@
+       PKCS7                   *p7enc;
+       PKCS7_SIGNER_INFO       *si;
+       STACK_OF(X509_ATTRIBUTE) *attributes;
+-      X509                    *signer = NULL;
++      X509                    *signercert = NULL;
++      EVP_PKEY                *signerkey = NULL;
+       /* Create a new sender nonce for all messages 
+        * XXXXXXXXXXXXXX should it be per transaction? */
+@@ -47,7 +48,8 @@
+                       s->request_type_str = SCEP_REQUEST_PKCSREQ_STR;
+                       /* Signer cert */
+-                      signer = s->selfsigned;
++                      signercert = s->signercert;
++                      signerkey = s->signerkey;
+                       /* Create inner PKCS#7  */
+                       if (v_flag)
+@@ -71,7 +73,8 @@
+                       s->request_type_str = SCEP_REQUEST_GETCERTINIT_STR;
+                       /* Signer cert */
+-                      signer = s->selfsigned;
++                      signercert = s->signercert;
++                      signerkey = s->signerkey;
+                       /* Create inner PKCS#7  */
+                       if (v_flag)
+@@ -95,7 +98,8 @@
+                       s->request_type_str = SCEP_REQUEST_GETCERT_STR;
+                       /* Signer cert */
+-                      signer = localcert;
++                      signercert = localcert;
++                      signerkey = rsa;
+                       /* Read data in memory bio */
+                       databio = BIO_new(BIO_s_mem());
+@@ -115,7 +119,8 @@
+                       s->request_type_str = SCEP_REQUEST_GETCRL_STR;
+                       /* Signer cert */
+-                      signer = localcert;
++                      signercert = localcert;
++                      signerkey = rsa;
+                       /* Read data in memory bio */
+                       databio = BIO_new(BIO_s_mem());
+@@ -217,9 +222,9 @@
+       }
+       /* Add signer certificate  and signature */
+-      PKCS7_add_certificate(s->request_p7, signer);
++      PKCS7_add_certificate(s->request_p7, signercert);
+       if ((si = PKCS7_add_signature(s->request_p7,
+-                              signer, rsa, sig_alg)) == NULL) {
++                              signercert, signerkey, sig_alg)) == NULL) {
+               fprintf(stderr, "%s: error adding PKCS#7 signature\n", pname);
+               ERR_print_errors_fp(stderr);
+               exit (SCEP_PKISTATUS_P7);
+@@ -317,7 +322,8 @@
+       STACK_OF(X509_ATTRIBUTE)        *attribs;
+       char                            *p;
+       unsigned char                   buffer[1024];
+-      X509                            *recipient;
++      X509                            *recipientcert;
++      EVP_PKEY                        *recipientkey;
+       /* Create new memory BIO for outer PKCS#7 */
+       memorybio = BIO_new(BIO_s_mem());
+@@ -547,10 +553,14 @@
+       /* Decrypt the inner PKCS#7 */
+       if ((s->request_type == SCEP_REQUEST_PKCSREQ) ||
+-         (s->request_type == SCEP_REQUEST_GETCERTINIT))
+-              recipient = s->selfsigned;
+-      else
+-              recipient = localcert;
++          (s->request_type == SCEP_REQUEST_GETCERTINIT)) {
++              recipientcert = s->signercert;
++              recipientkey = s->signerkey;
++      }
++      else {
++              recipientcert = localcert;
++              recipientkey = rsa;
++      }
+       if (v_flag)
+               printf("%s: reading inner PKCS#7\n",pname);
+       p7enc = d2i_PKCS7_bio(outbio, NULL);
+@@ -568,7 +578,7 @@
+       outbio = BIO_new(BIO_s_mem());
+       if (v_flag)
+               printf("%s: decrypting inner PKCS#7\n",pname);
+-      if (PKCS7_decrypt(p7enc, rsa, recipient, outbio, 0) == 0) {
++      if (PKCS7_decrypt(p7enc, recipientkey, recipientcert, outbio, 0) == 0) {
+               fprintf(stderr, "%s: error decrypting inner PKCS#7\n", pname);
+               ERR_print_errors_fp(stderr);
+               exit (SCEP_PKISTATUS_P7);
+diff -uN sscep/sceputils.c sscep-ng2/sceputils.c
+--- sscep/sceputils.c  2003-02-09 14:18:23.000000000 +0100
++++ sscep-ng2/sceputils.c      2006-04-25 16:27:03.000000000 +0200
+@@ -156,7 +156,8 @@
+       }
+       /* Copy the pointer and return */
+-      s->selfsigned = cert;
++      s->signercert = cert;
++      s->signerkey = rsa;
+       return (0);
+ }
+diff -uN sscep/sscep.c sscep-ng2/sscep.c
+--- sscep/sscep.c      2003-04-17 07:47:04.000000000 +0200
++++ sscep-ng2/sscep.c  2006-04-28 11:06:16.000000000 +0200
+@@ -53,12 +53,15 @@
+       }
+       /* Skip first parameter and parse the rest of the command */
+       optind++;
+-      while ((c = getopt(argc, argv, "c:de:E:f:F:i:k:l:L:n:p:r:Rs:S:t:T:u:vw:")) != -1)
++      while ((c = getopt(argc, argv, "c:Cde:E:f:F:i:k:K:l:L:n:O:p:r:Rs:S:t:T:u:vw:")) != -1)
+                 switch(c) {
+                       case 'c':
+                               c_flag = 1;
+                               c_char = optarg;
+                               break;
++                      case 'C':
++                              C_flag = 1;
++                              break;
+                       case 'd':
+                               d_flag = 1;
+                               break;
+@@ -86,6 +89,10 @@
+                               k_flag = 1;
+                               k_char = optarg;
+                               break;
++                      case 'K':
++                              K_flag = 1;
++                              K_char = optarg;
++                              break;
+                       case 'l':
+                               l_flag = 1;
+                               l_char = optarg;
+@@ -98,6 +105,10 @@
+                               n_flag = 1;
+                               n_num = atoi(optarg);
+                               break;
++                      case 'O':
++                              O_flag = 1;
++                              O_char = optarg;
++                              break;
+                       case 'p':
+                               p_flag = 1;
+                               p_char = optarg;
+@@ -137,6 +148,7 @@
+                               w_char = optarg;
+                               break;
+                       default:
++                        printf("argv: %s\n", argv[optind]);
+                               usage();
+                 }
+       argc -= optind;
+@@ -402,15 +414,38 @@
+               case SCEP_OPERATION_GETCERT:
+               case SCEP_OPERATION_GETCRL:
+                       /* Read local certificate */
+-                      read_local_cert();
++                      if (!l_flag) {
++                        fprintf(stderr, "%s: missing local cert (-l)\n", pname);
++                        exit (SCEP_PKISTATUS_FILE);
++                      }
++                      read_cert(&localcert, l_char);
+               case SCEP_OPERATION_ENROLL:
+                       /*
+                        * Read in CA cert, private key and certificate
+                        * request in global variables.
+                        */
+-                      read_ca_cert();
+-                      read_key();
++                      read_ca_cert();
++
++                      if (!k_flag) {
++                        fprintf(stderr, "%s: missing private key (-k)\n", pname);
++                        exit (SCEP_PKISTATUS_FILE);
++                      }
++                      read_key(&rsa, k_char);
++
++                      if ((K_flag && !O_flag) || (!K_flag && O_flag)) {
++                        fprintf(stderr, "%s: -O also requires -K (and vice-versa)\n", pname);
++                        exit (SCEP_PKISTATUS_FILE);
++                      }
++
++                      if (K_flag) {
++                        read_key(&renewal_key, K_char);
++                      }
++
++                      if (O_flag) {
++                        read_cert(&renewal_cert, O_char);
++                      }
++
+                       if (operation_flag == SCEP_OPERATION_ENROLL)
+                               read_request();
+@@ -426,7 +461,14 @@
+                       if (v_flag)
+                                 fprintf(stdout, "%s: generating selfsigned "
+                                       "certificate\n", pname);
+-                      new_selfsigned(&scep_t);
++
++                      if (! O_flag) 
++                        new_selfsigned(&scep_t);
++                      else {
++                        /* Use existing certificate */
++                        scep_t.signercert = renewal_cert;
++                        scep_t.signerkey = renewal_key;
++                      }
+                       /* Write the selfsigned certificate if requested */
+                       if (L_flag) {
+@@ -436,7 +478,7 @@
+                                         "file for writing\n", pname);
+                                       exit (SCEP_PKISTATUS_ERROR);
+                               }
+-                              if (PEM_write_X509(fp,scep_t.selfsigned) != 1) {
++                              if (PEM_write_X509(fp,scep_t.signercert) != 1) {
+                                       fprintf(stderr, "%s: error while "
+                                         "writing certificate file\n", pname);
+                                       ERR_print_errors_fp(stderr);
+@@ -643,7 +685,8 @@
+ void
+ usage() {
+-      fprintf(stdout, "\nsscep version %s\n\n" , VERSION);
++      fprintf(stdout, "\nsscep version %s using %s\n\n" , 
++              VERSION,SSLeay_version(SSLEAY_VERSION));
+       fprintf(stdout, "Usage: %s OPERATION [OPTIONS]\n"
+       "\nAvailable OPERATIONs are\n"
+       "  getca             Get CA/RA certificate(s)\n"
+@@ -665,6 +708,8 @@
+       "\nOPTIONS for OPERATION enroll are\n"
+       "  -k <file>         Private key file\n"
+       "  -r <file>         Certificate request file\n"
++      "  -K <file>         Signature private key file, use with -O\n"
++      "  -O <file>         Signature certificate (used instead of self-signed)\n"
+       "  -l <file>         Write enrolled certificate in file\n"
+       "  -e <file>         Use different CA cert for encryption\n"
+       "  -L <file>         Write selfsigned certificate in file\n"
+@@ -672,6 +717,8 @@
+       "  -T <secs>         Max polling time in seconds\n"
+       "  -n <count>        Max number of GetCertInitial requests\n"
+       "  -R                Resume interrupted enrollment\n"
++      "  -C                Check subject DN in the certificate return by the\n"
++      "                    CA (default is to match on the public key only)\n"
+       "\nOPTIONS for OPERATION getcert are\n"
+       "  -k <file>         Private key file\n"
+       "  -l <file>         Local certificate file\n"
+diff -uN sscep/sscep.h sscep-ng2/sscep.h
+--- sscep/sscep.h      2003-04-17 07:50:04.000000000 +0200
++++ sscep-ng2/sscep.h  2006-04-28 10:46:49.000000000 +0200
+@@ -36,10 +36,9 @@
+ #include <openssl/objects.h>
+ #include <openssl/asn1_mac.h>
+-
+ /* Global defines */
+-#define       VERSION "20030417"
++#define       VERSION "20060428"
+ /* SCEP operations */
+ int operation_flag;
+@@ -128,13 +127,13 @@
+ X509 *encert;
+ X509 *localcert;
+ X509 *othercert;
++X509 *renewal_cert;
+ X509_REQ *request;
+ EVP_PKEY *rsa;
++EVP_PKEY *renewal_key;
+ X509_CRL *crl;
+ FILE *cafile;
+ FILE *reqfile;
+-FILE *keyfile;
+-FILE *localfile;
+ FILE *otherfile;
+ FILE *crlfile;
+@@ -207,7 +206,9 @@
+       int recipient_nonce_len;
+       /* Certificates */
+-      X509 *selfsigned;
++      X509 *signercert;
++      EVP_PKEY *signerkey;
++
+       EVP_PKEY *pkey;
+       /* Request */
+@@ -251,13 +252,13 @@
+ int init_scep(void);
+ /* Read RSA private key file */
+-void read_key(void);
++void read_key(EVP_PKEY** key, char* filename);
+ /* Read CA certificate file */
+ void read_ca_cert(void);
+ /* Read local certificate file */
+-void read_local_cert(void);
++void read_cert(X509** cert, char* filename);
+ /* Read certificate request and private key */
+ void read_request(void);
diff --git a/net/sshfs/Makefile b/net/sshfs/Makefile
new file mode 100644 (file)
index 0000000..0e84cb8
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007 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:=sshfs
+PKG_VERSION:=2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-fuse-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/fuse
+PKG_MD5SUM:=26e9206eb5169e87e6f95f54bc005a4f
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-fuse-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/sshfs
+  TITLE:=SSHFS
+  DEPENDS:=+libfuse +fuse-utils +glib2 +libpthread
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  URL:=http://fuse.sourceforge.net/
+endef
+
+define Package/sshfs/description
+       Mount remote system over sftp.
+endef
+
+CONFIGURE_VARS += \
+       SSHFS_CFLAGS=" \
+               -D_FILE_OFFSET_BITS=64 \
+               -I$(STAGING_DIR)/usr/include/glib-2.0 \
+               -I$(STAGING_DIR)/usr/lib/glib-2.0/include \
+               -I$(STAGING_DIR)/usr/include/fuse" \
+       SSHFS_LIBS=" \
+               -lglib-2.0 -liconv $(if $(INTL_FULL),-lintl) -lfuse -pthread -lgthread-2.0 \
+               -L$(STAGING_DIR)/usr/lib"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               ARCH="$(LINUX_KARCH)" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/sshfs/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sshfs $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sshfs))
diff --git a/net/sshtunnel/Makefile b/net/sshtunnel/Makefile
new file mode 100644 (file)
index 0000000..f47279f
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010 segal.di.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=sshtunnel
+PKG_VERSION:=3
+PKG_RELEASE:=3
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sshtunnel
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=SSH
+  TITLE:=Manages Local and Remote openssh ssh(1) tunnels
+  DEPENDS:=+openssh-client
+endef
+
+define Package/sshtunnel/description
+Creates openssh ssh(1) Local and Remote tunnels configured in UCI file. Can be used to allow remote connections, possibly over NATed connections or without public IP/DNS
+endef
+
+define Package/sshtunnel/conffiles
+/etc/config/sshtunnel
+endef
+
+define Build/Compile
+endef
+
+define Package/sshtunnel/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sshtunnel.init $(1)/etc/init.d/sshtunnel
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/sshtunnel.sh $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/uci_sshtunnel $(1)/etc/config/sshtunnel
+endef
+
+$(eval $(call BuildPackage,sshtunnel))
diff --git a/net/sshtunnel/files/sshtunnel.init b/net/sshtunnel/files/sshtunnel.init
new file mode 100644 (file)
index 0000000..4ca491f
--- /dev/null
@@ -0,0 +1,203 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+STOP=01
+
+PIDFILE="/tmp/run/sshtunnel"
+
+
+append_params() {
+       local p; local v; local args;
+       for p in $*; do
+               eval "v=\$$p"
+               [ -n "$v" ] && args="$args -o $p=$v"
+       done
+       
+       ARGS_options="${args# *}"
+}
+
+append_string() {
+       local varname="$1"; local add="$2"; local separator="${3:- }"; local actual
+       eval "actual=\$$varname"
+
+       new="${actual:+$actual$separator}$add"
+       eval "$varname=\$new"
+}
+
+load_tunnelR() {
+       config_get section_server $1 server
+       [ "$server" = "$section_server" ] || return 0 # continue to read next section if this is not for the current server
+       let count++ # count nr of valid sections to make sure there are at least one
+
+       config_get remoteaddress $1 remoteaddress "*"
+       config_get remoteport   $1 remoteport
+       config_get localaddress $1 localaddress
+       config_get localport    $1 localport
+       
+        [ "$remoteport" -gt 0 ] || append_string "error" "[tunnelR: $1]remoteport must be a positive integer" "; "
+        [ "$localport" -gt 0 ]         || append_string "error" "[tunnelR: $1]localport must be a positive integer" "; "
+       [ -n "$error" ] && return 1
+
+       append_string "ARGS_tunnels" "-R $remoteaddress:$remoteport:$localaddress:$localport"
+}
+
+load_tunnelL() {
+       config_get section_server $1 server
+       [ "$server" = "$section_server" ] || return 0 # continue to read next section if this is not for the current server
+       let count++ # count nr of valid sections to make sure there are at least one
+
+       config_get localaddress $1 localaddress "*"     
+       config_get localport    $1 localport
+       config_get remoteaddress $1 remoteaddress
+       config_get remoteport   $1 remoteport
+
+        [ "$remoteport" -gt 0 ] || append_string "error" "[tunnelL: $1]remoteport must be a positive integer" "; "
+        [ "$localport" -gt 0 ]         || append_string "error" "[tunnelL: $1]localport must be a positive integer" "; "
+       [ -n "$error" ] && return 1
+
+       append_string "ARGS_tunnels" "-L $localaddress:$localport:$remoteaddress:$remoteport"
+}
+
+load_tunnelD() {
+       config_get section_server $1 server
+       [ "$server" = "$section_server" ] || return 0 # continue to read next section if this is not for the current server
+       let count++ # count nr of valid sections to make sure there are at least one
+
+       config_get localaddress $1 localaddress "*"
+       config_get localport    $1 localport
+
+        [ "$remoteport" -gt 0 ] || append_string "error" "[tunnelD: $1]remoteport must be a positive integer" "; "
+        [ "$localport" -gt 0 ]         || append_string "error" "[tunnelD: $1]localport must be a positive integer" "; "
+       [ -n "$error" ] && return 1
+
+       append_string "ARGS_tunnels" "-D $localaddress:$localport"
+}
+
+load_tunnelW() {
+        config_get section_server $1 server
+        [ "$server" = "$section_server" ] || return 0 # continue to read next section if this is not for the current server
+        let count++ # count nr of valid sections to make sure there are at least one
+
+        config_get localdev     $1 localdev "*"
+        config_get remotedev    $1 remotedev "*"
+        config_get vpntype      $1 vpntype "*"
+
+        [ "$vpntype" == "ethernet" ] || [ "$vpntype" == "point-to-point" ] || append_string "error" "[tunnelW: $1] vpntype must be \"ethernet\" (tap) or \"pointopoint\" (tun)" "; "
+        [ "$localdev" == "any" ] || [ "$localdev" -ge 0 ] || append_string "error" "[tunnelW: $1] localdev must be an integer or \"any\"" "; "
+        [ "$remotedev" == "any" ] || [ "$remotedev" -ge 0 ] || append_string "error" "[tunnelW: $1] remotedev must be an integer or \"any\"" "; "
+        [ "$user" == "root" ] || logger -p user.warn -t "sshtunnel" "warning: root is required unless the tunnel device has been created manually"
+        [ -n "$error" ] && return 1
+
+        append_string "ARGS_tunnels" "-w $localdev:$remotedev -o Tunnel=$vpntype"
+}
+
+load_server() {
+       server="$1"
+
+       config_get user         $1 user
+       config_get hostname     $1 hostname
+       config_get port         $1 port         "22"
+       config_get retrydelay   $1 retrydelay   "60"
+       config_get PKCS11Provider       $1 PKCS11Provider
+       config_get CheckHostIP          $1 CheckHostIP
+       config_get Compression          $1 Compression
+       config_get CompressionLevel     $1 CompressionLevel
+       config_get IdentityFile         $1 IdentityFile
+       config_get LogLevel             $1 LogLevel
+       config_get ServerAliveCountMax  $1 ServerAliveCountMax
+       config_get ServerAliveInterval  $1 ServerAliveInterval
+       config_get StrictHostKeyChecking $1 StrictHostKeyChecking
+       config_get TCPKeepAlive         $1 TCPKeepAlive
+       config_get VerifyHostKeyDNS     $1 VerifyHostKeyDNS
+               
+       error=""
+        [ -n "$user" ] \
+               || append_string "error" "user is not set" "; "
+        [ -n "$hostname" ] \
+               || append_string "error" "hostname is not set" "; "
+        [ "$retrydelay" -ge 1 ] \
+               || append_string "error" "retrydelay must be a positive integer" "; "
+       [ -z "$PKCS11Provider" -o -f "$PKCS11Provider" ] \
+               || append_string "error" "PKCS11Provider must be a pkcs11 shared library accessible" "; "
+       [ -z "$CheckHostIP" -o "$CheckHostIP"="yes" -o "$CheckHostIP"="no" ] \
+               || append_string "error" "CheckHostIP must be 'yes' or 'no'" "; "
+       [ -z "$Compression" -o "$Compression"="yes" -o "$Compression"="no" ] \
+               || append_string "error" "Compression must be 'yes' or 'no'" "; "
+       [ -z "$CompressionLevel" ] || [ "$CompressionLevel" -ge 1 -a "$CompressionLevel" -le 9 ] \
+               || append_string "error" "CompressionLevel must be between 1 and 9" "; "
+       [ -z "$IdentityFile" -o -f "$IdentityFile" ] \
+               || append_string "error" "IdentityFile $IdentityFile not accessible" "; "       
+       [ -z "$LogLevel" -o "$LogLevel" = "QUIET" -o "$LogLevel" = "FATAL" -o "$LogLevel" = "ERROR" -o \
+               "$LogLevel" = "INFO" -o "$LogLevel" = "VERBOSE" -o "$LogLevel" = "DEBUG" -o \
+               "$LogLevel" = "DEBUG1" -o "$LogLevel" = "DEBUG2" -o "$LogLevel" = "DEBUG3" ] \
+               || append_string "error" "LogLevel is invalid" "; "
+       [ -z "$ServerAliveCountMax" ] || [ "$ServerAliveCountMax" -ge 1 ] \
+               || append_string "error" "ServerAliveCountMax must be greater or equal than 1" "; "
+       [ -z "$ServerAliveInterval" ] || [ "$ServerAliveInterval" -ge 0 ] \
+               || append_string "error" "ServerAliveInterval must be greater or equal than 0" "; "
+       [ -z "$StrictHostKeyChecking" -o "$StrictHostKeyChecking" = "yes" -o "$StrictHostKeyChecking" = "ask" -o "$StrictHostKeyChecking" = "no" ] \
+               || append_string "error" "StrictHostKeyChecking must be 'yes', 'ask' or 'no'" "; "
+       [ -z "$TCPKeepAlive" -o "$TCPKeepAlive" = "yes" -o "$TCPKeepAlive" = "no" ] \
+               || append_string "error" "TCPKeepAlive must be 'yes' or 'no'" "; "
+       [ -z "$VerifyHostKeyDNS" -o "$VerifyHostKeyDNS" = "yes" -o "$VerifyHostKeyDNS" = "no" ] \
+               || append_string "error" "VerifyHostKeyDNS must be 'yes' or 'no'" "; "
+
+       [ -n "$error" ] && { logger -p user.err -t "sshtunnel" "tunnels to $server not started - $error"; return; }
+        
+
+       ARGS=""
+       ARGS_options=""
+        ARGS_tunnels=""
+
+       count=0
+        config_foreach load_tunnelR tunnelR && config_foreach load_tunnelL tunnelL && config_foreach load_tunnelD tunnelD
+       [ -n "$error" ]         && { logger -p user.err -t "sshtunnel" "tunnels to $server not started - $error"; return; }
+       [ "$count" -eq 0 ]      && { logger -p user.err -t "sshtunnel" "tunnels to $server not started - no tunnels defined"; return; }
+
+       append_params CheckHostIP Compression CompressionLevel IdentityFile LogLevel PKCS11Provider ServerAliveCountMax ServerAliveInterval StrictHostKeyChecking TCPKeepAlive VerifyHostKeyDNS
+       ARGS="$ARGS_options -o ExitOnForwardFailure=yes -o BatchMode=yes -nN $ARGS_tunnels -p $port $user@$hostname"
+
+       /usr/bin/sshtunnel.sh "$ARGS" "$retrydelay" "$server" &
+       echo $! >> "${PIDFILE}.pids"
+       logger -p user.info -t "sshtunnel" "started tunnels to $server (pid=$!;retrydelay=$retrydelay)" 
+}
+
+stop() {
+        if [ -f "$PIDFILE".pids ]
+        then
+                logger -p user.info -t "sshtunnel" "stopping all tunnels"
+                
+                while read pid
+                do
+                       kill "$pid"     # kill mother process first
+
+                       [ -f "${PIDFILE}_${pid}.pid" ] && { # if ssh was running, kill it also (mother process could be in retry wait)
+                               start-stop-daemon -K -p "${PIDFILE}_${pid}.pid"
+                               rm "${PIDFILE}_${pid}.pid"
+                       }
+                       
+                       logger -p daemon.info -t "sshtunnel[$pid]" "tunnel stopped"
+                       
+               done < "${PIDFILE}.pids"
+
+               rm "${PIDFILE}.pids"
+
+                logger -p user.info -t "sshtunnel" "all tunnels stopped"
+        else
+                logger -p user.info -t "sshtunnel" "no tunnels running"
+        fi
+}
+
+start() {
+        [ -f "${PIDFILE}.pids" ] && stop
+        
+       config_load sshtunnel
+       if [ -n "$(uci show sshtunnel.@server[0])" ] # at least one server section exists
+       then        
+               logger -p user.info -t "sshtunnel" "starting all tunnels"
+               config_foreach load_server server       
+               logger -p user.info -t "sshtunnel" "all tunnels started"        
+       else
+               logger -p user.info -t "sshtunnel" "no servers defined"
+       fi
+}
diff --git a/net/sshtunnel/files/sshtunnel.sh b/net/sshtunnel/files/sshtunnel.sh
new file mode 100644 (file)
index 0000000..0ff18a6
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh 
+
+PIDFILE="/tmp/run/sshtunnel"
+
+args="$1"
+retrydelay="$2"
+server="$3"
+
+while true
+do
+       logger -p daemon.info -t "sshtunnel[$$][$server]" "connection started"
+       
+       start-stop-daemon -S -p "${PIDFILE}_${$}.pid" -mx ssh -- $args &>/tmp/log/sshtunnel_$$ 
+       
+       logger -p daemon.err -t "sshtunnel[$$][$server]" < /tmp/log/sshtunnel_$$
+       rm /tmp/log/sshtunnel_$$
+       logger -p daemon.info -t "sshtunnel[$$][$server]" "ssh exited with code $?, retrying in $retrydelay seconds"
+       rm "${PIDFILE}_${$}.pid"
+
+       sleep "$retrydelay" & wait
+done
diff --git a/net/sshtunnel/files/uci_sshtunnel b/net/sshtunnel/files/uci_sshtunnel
new file mode 100644 (file)
index 0000000..52e6881
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# password authentication is not possible, public key authentication must be used.
+# set "option IdentityFile" to he file from which the identity (private key) for RSA or DSA authentication is read.  
+# The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version 2.
+# ssh will also try to load certificate information from the filename obtained by appending -cert.pub to identity filenames.
+#
+
+#config server disney
+#      option user                     mourinho
+#      option hostname                 server.disney.com
+#      option port                     22
+#      option retrydelay               1       
+#      option CheckHostIP              yes
+#      option Compression              no
+#      option CompressionLevel         6
+#      option IdentityFile             ~/.ssh/id_rsa
+#      option LogLevel                 INFO
+#      option PKCS11Provider           /lib/pteidpkcs11.so
+#      option ServerAliveCountMax      3
+#      option ServerAliveInterval      0
+#      option StrictHostKeyChecking    ask
+#      option TCPKeepAlive             yes
+#      option VerifyHostKeyDNS         yes
+
+# tunnelR(emote) - when the connection will be initiated to the R(emote) endpoint at
+# remoteaddress:remoteport and then forwarded to localaddress:localport
+#
+#config tunnelR http
+#      option server           disney
+#      option remoteaddress    *
+#      option remoteport       9009
+#      option localaddress     192.168.1.13
+#      option localport        80
+
+# tunnelL(ocal) - when the connection will be initiated to the L(ocal) endpoint at
+# localaddress:localport and then forwarded to remoteaddress:remoteport 
+#
+#config tunnelL test
+#      option server           disney
+#      option localaddress     *
+#      option localport        1022
+#      option remoteaddress    secretserver.disney.com
+#      option remoteport       22
+
+# tunnelD(ynamic) - when the connection will be initiated with the SOCKS4 or SOCKS5 protocol
+# to the local endpoint at localaddress:localport and then forwarded over the remote host
+#
+#config tunnelD proxy
+#      option server           disney
+#      option localaddress     *
+#      option localport        4055
+
+# tunnelW - creates TUN/TAP devices on client and server to establish a VPN tunnel between them
+# vpntypes:
+#  point-to-point = TUN
+#  ethernet = TAP
+#
+#config tunnelW proxy
+#      option server           disney
+#      option vpntype          point-to-point|ethernet
+#      option localdev         any|0|1|2|...
+#      option remotedev        any|0|1|2|...
+
diff --git a/net/sslcat/Makefile b/net/sslcat/Makefile
new file mode 100644 (file)
index 0000000..8a8377d
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2010 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:=sslcat
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).tgz
+PKG_SOURCE_URL:=http://www.bindshell.net/tools/sslcat/
+PKG_MD5SUM:=27a88e2143cbfe216e13e9493bacd32e
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sslcat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A netcat like utility with SSL support
+  URL:=http://www.bindshell.net/tools/sslcat
+  DEPENDS:= +libopenssl
+endef
+
+define Package/sslcat/description
+ SSLCat is a simple Unix utility that reads and writes data across an
+ SSL enable network connection.
+endef
+
+CONFIGURE_ARGS+= \
+       --with-openssl=$(STAGING_DIR)/usr \
+
+define Package/sslcat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sslcat $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sslcat))
diff --git a/net/sslsniff/Makefile b/net/sslsniff/Makefile
new file mode 100644 (file)
index 0000000..f1ed2a5
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2009 David Cooper <dave@kupesoft.com>
+# Copyright (C) 2009 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:=sslsniff
+PKG_VERSION:=0.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.thoughtcrime.org/software/sslsniff
+PKG_MD5SUM:=24653e2c4f1ca94328520667eb756369
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sslsniff
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=SSL man-in-the-middle attack
+  URL:=http://www.thoughtcrime.org/software/sslsniff/index.html
+  DEPENDS:=+libopenssl
+endef
+
+define Package/sslsniff/description
+ sslsniff is designed to MITM all SSL connections on a LAN,
+ and dynamically generates certs for the domains that are
+ being accessed on the fly. The new certificates are constructed
+ in a certificate chain that is signed by any certificate that
+ you provide.
+endef
+
+# Take this opportunity to remove the pre-packaged x86 binary
+define Build/Prepare
+$(call Build/Prepare/Default)
+       $(RM) $(PKG_BUILD_DIR)/sslsniff
+endef
+
+MAKE_FLAGS += CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)"
+
+define Package/sslsniff/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sslsniff $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sslsniff))
diff --git a/net/sslsniff/patches/01-cross-compile.patch b/net/sslsniff/patches/01-cross-compile.patch
new file mode 100644 (file)
index 0000000..48bee83
--- /dev/null
@@ -0,0 +1,24 @@
+diff -ruN sslsniff-0.5.orig/Makefile sslsniff-0.5/Makefile
+--- sslsniff-0.5.orig/Makefile 2009-02-16 12:00:36.000000000 -0500
++++ sslsniff-0.5/Makefile      2009-02-23 11:14:22.000000000 -0500
+@@ -1,4 +1,7 @@
++CC := gcc
++CFLAGS := -g -Wall
++
+ all:
+-      gcc -g -Wall -o sslsniff cache.c sslsniff.c network.c mx509.c mssl.c log.c -lcrypto -lssl
++      $(CC) $(CFLAGS) -o sslsniff cache.c sslsniff.c network.c mx509.c mssl.c log.c -lcrypto -lssl
+ clean:
+       rm sslsniff
+\ No newline at end of file
+diff -ruN sslsniff-0.5.orig/network.c sslsniff-0.5/network.c
+--- sslsniff-0.5.orig/network.c        2009-02-16 12:00:36.000000000 -0500
++++ sslsniff-0.5/network.c     2009-02-23 10:45:37.000000000 -0500
+@@ -27,6 +27,7 @@
+  * SUCH DAMAGE.
+  */
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
diff --git a/net/sslstrip/Makefile b/net/sslstrip/Makefile
new file mode 100644 (file)
index 0000000..3c58ef9
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006-2010 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:=sslstrip
+PKG_VERSION:=0.9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.thoughtcrime.org/software/sslstrip
+PKG_MD5SUM:=944020144e4f5528888b3dfbb107dd78
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/sslstrip
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=sslstrip
+  URL:=http://www.thoughtcrime.org/software/sslstrip/index.html
+  DEPENDS:=+python +twisted +twisted-web +pyopenssl
+endef
+
+define Package/sslstrip/description
+  sslstrip will transparently hijack HTTP traffic on a network,
+  watch for HTTPS links and redirects, then map those links
+  into either look-alike HTTP links or homograph-similar HTTPS
+  links. It also supports modes for supplying a favicon which
+  looks like a lock icon, selective logging, and session denial.
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/sslstrip/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) \
+           $(PKG_INSTALL_DIR)/usr/bin/sslstrip \
+           $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/share/sslstrip
+       $(CP) \
+           $(PKG_INSTALL_DIR)/usr/share/sslstrip/* \
+           $(1)/usr/share/sslstrip
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,sslstrip))
diff --git a/net/ssltunnel/Makefile b/net/ssltunnel/Makefile
new file mode 100644 (file)
index 0000000..84ddadb
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006 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:=ssltunnel
+PKG_VERSION:=1.16
+PKG_RELEASE:=1
+
+PKG_SOURCE:=${PKG_NAME}-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.hsc.fr/ressources/outils/ssltunnel/download
+PKG_MD5SUM:=4039b50566a33a4077883ea974e476d5
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ssltunnel
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ppp +libopenssl
+  TITLE:=A PPP over SSL VPN tool
+  URL:=http://www.hsc.fr/ressources/outils/ssltunnel/index.html
+  SUBMENU:=VPN
+endef
+
+define Package/ssltunnel/description
+       SSLTunnel is a client/server program to create a PPP connection over a
+       SSL/TLS session.
+       Client and server are mutually authenticated using a X509 certificate,
+       PPP packets are then encrypted/decrypted realtime on each side.
+       It's possible to use ssltunnel to connect a machine to another, a
+       machine with a network or two networks sets.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               , \
+               BUILD_CC="$(TARGET_CC)" \
+               HOSTCC="$(HOSTCC)" \
+       )
+endef
+
+define Package/ssltunnel/install       
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pppclient $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppwho $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppserver $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,ssltunnel))
diff --git a/net/strongswan/Config.in b/net/strongswan/Config.in
new file mode 100644 (file)
index 0000000..10b4ec6
--- /dev/null
@@ -0,0 +1,28 @@
+menu "Configuration"
+       depends on PACKAGE_strongswan
+
+# --with-random-device
+config STRONGSWAN_DEVICE_RANDOM
+       string
+       prompt "Set the device to read real random data from"
+       default "/dev/random"
+
+# --with-urandom-device
+config STRONGSWAN_DEVICE_URANDOM
+       string
+       prompt "Set the device to read pseudo random data from"
+       default "/dev/urandom"
+
+# --with-routing-table
+config STRONGSWAN_ROUTING_TABLE
+       string
+       prompt "Set the IPsec routing table ID"
+       default "220"
+
+#  --with-routing-table-prio
+config STRONGSWAN_ROUTING_TABLE_PRIO
+       string
+       prompt "Set the IPsec routing table priority"
+       default "220"
+
+endmenu
diff --git a/net/strongswan/Makefile b/net/strongswan/Makefile
new file mode 100644 (file)
index 0000000..a85a01b
--- /dev/null
@@ -0,0 +1,532 @@
+#
+# Copyright (C) 2012-2014 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:=strongswan
+PKG_VERSION:=5.1.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.strongswan.org/ http://download2.strongswan.org/
+PKG_MD5SUM:=1d1c108775242743cd8699215b2918c3
+
+PKG_MOD_AVAILABLE:= \
+       addrblock \
+       aes \
+       af-alg \
+       agent \
+       attr \
+       attr-sql \
+       blowfish \
+       ccm \
+       cmac \
+       constraints \
+       coupling \
+       ctr \
+       curl \
+       des \
+       dhcp \
+       dnskey \
+       duplicheck \
+       eap-identity \
+       eap-md5 \
+       eap-mschapv2 \
+       eap-radius \
+       farp \
+       fips-prf \
+       gcm \
+       gcrypt \
+       gmp \
+       ha \
+       hmac \
+       kernel-klips \
+       kernel-libipsec \
+       kernel-netlink \
+       kernel-pfkey \
+       ldap \
+       led \
+       load-tester \
+       nonce \
+       md4 \
+       md5 \
+       mysql \
+       openssl \
+       padlock \
+       pem \
+       pgp \
+       pkcs1 \
+       pkcs8 \
+       pkcs11 \
+       pubkey \
+       random \
+       resolve \
+       revocation \
+       sha1 \
+       sha2 \
+       smp \
+       socket-default \
+       socket-dynamic \
+       sql \
+       sqlite \
+       stroke \
+       test-vectors \
+       unity \
+       uci \
+       updown \
+       whitelist \
+       x509 \
+       xauth-eap \
+       xauth-generic \
+       xcbc
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_STRONGSWAN_DEVICE_RANDOM \
+       CONFIG_STRONGSWAN_DEVICE_URANDOM \
+       CONFIG_STRONGSWAN_ROUTING_TABLE \
+       CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO \
+       $(patsubst %,CONFIG_PACKAGE_strongswan-mod-%,$(PKG_MOD_AVAILABLE)) \
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/strongswan/Default
+  SUBMENU:=VPN
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=StrongSwan
+  URL:=http://www.strongswan.org/
+endef
+
+define Package/strongswan/description/Default
+ StrongSwan is an OpenSource IPsec implementation for the Linux operating system.
+endef
+
+define Package/strongswan
+$(call Package/strongswan/Default)
+  DEPENDS:= +libpthread +ip \
+       +kmod-crypto-authenc \
+       +kmod-ipsec +kmod-ipsec4 +kmod-ipsec6 \
+       +kmod-ipt-ipsec +iptables-mod-ipsec
+endef
+
+define Package/strongswan/config
+  source "$(SOURCE)/Config.in"
+endef
+
+define Package/strongswan/description
+$(call Package/strongswan/description/Default)
+ This package contains shared libraries and scripts.
+endef
+
+define Package/strongswan-full
+$(call Package/strongswan/Default)
+  TITLE+= (full)
+  DEPENDS:= +strongswan \
+       +strongswan-charon \
+       +strongswan-libfast \
+       +strongswan-mod-addrblock \
+       +strongswan-mod-aes \
+       +strongswan-mod-af-alg \
+       +strongswan-mod-agent \
+       +strongswan-mod-attr \
+       +strongswan-mod-attr-sql \
+       +strongswan-mod-blowfish \
+       +strongswan-mod-ccm \
+       +strongswan-mod-cmac \
+       +strongswan-mod-constraints \
+       +strongswan-mod-coupling \
+       +strongswan-mod-ctr \
+       +strongswan-mod-curl \
+       +strongswan-mod-des \
+       +strongswan-mod-dhcp \
+       +strongswan-mod-dnskey \
+       +strongswan-mod-duplicheck \
+       +strongswan-mod-eap-identity \
+       +strongswan-mod-eap-md5 \
+       +strongswan-mod-eap-mschapv2 \
+       +strongswan-mod-eap-radius \
+       +strongswan-mod-farp \
+       +strongswan-mod-fips-prf \
+       +strongswan-mod-gcm \
+       +strongswan-mod-gcrypt \
+       +strongswan-mod-gmp \
+       +strongswan-mod-ha \
+       +strongswan-mod-hmac \
+       +strongswan-mod-kernel-netlink \
+       +strongswan-mod-ldap \
+       +strongswan-mod-led \
+       +strongswan-mod-load-tester \
+       +strongswan-mod-nonce \
+       +strongswan-mod-md4 \
+       +strongswan-mod-md5 \
+       +strongswan-mod-mysql \
+       +strongswan-mod-openssl \
+       +TARGET_x86:strongswan-mod-padlock \
+       +strongswan-mod-pem \
+       +strongswan-mod-pgp \
+       +strongswan-mod-pkcs1 \
+       +strongswan-mod-pkcs8 \
+       +strongswan-mod-pkcs11 \
+       +strongswan-mod-pubkey \
+       +strongswan-mod-random \
+       +strongswan-mod-resolve \
+       +strongswan-mod-revocation \
+       +strongswan-mod-sha1 \
+       +strongswan-mod-sha2 \
+       +strongswan-mod-smp \
+       +strongswan-mod-socket-default \
+       +strongswan-mod-sql \
+       +strongswan-mod-sqlite \
+       +strongswan-mod-stroke \
+       +strongswan-mod-test-vectors \
+       +strongswan-mod-uci \
+       +strongswan-mod-unity \
+       +strongswan-mod-updown \
+       +strongswan-mod-whitelist \
+       +strongswan-mod-x509 \
+       +strongswan-mod-xauth-eap \
+       +strongswan-mod-xauth-generic \
+       +strongswan-mod-xcbc \
+       +strongswan-utils \
+       @DEVEL
+endef
+
+define Package/strongswan-full/description
+$(call Package/strongswan/description/Default)
+ This meta-package contains dependencies for all of the strongswan plugins
+ except kernel-klips, kernel-libipsec, kernel-pfkey,
+ socket-dynamic and which are ommitted in favor of the kernel-netlink and
+ socket-default plugins.
+endef
+
+
+define Package/strongswan-default
+$(call Package/strongswan/Default)
+  TITLE+= (default)
+  DEPENDS:= +strongswan \
+       +strongswan-charon \
+       +strongswan-mod-aes \
+       +strongswan-mod-attr \
+       +strongswan-mod-constraints \
+       +strongswan-mod-des \
+       +strongswan-mod-dnskey \
+       +strongswan-mod-fips-prf \
+       +strongswan-mod-gmp \
+       +strongswan-mod-hmac \
+       +strongswan-mod-kernel-netlink \
+       +strongswan-mod-md5 \
+       +strongswan-mod-nonce \
+       +strongswan-mod-pem \
+       +strongswan-mod-pgp \
+       +strongswan-mod-pkcs1 \
+       +strongswan-mod-pubkey \
+       +strongswan-mod-random \
+       +strongswan-mod-resolve \
+       +strongswan-mod-revocation \
+       +strongswan-mod-sha1 \
+       +strongswan-mod-sha2 \
+       +strongswan-mod-socket-default \
+       +strongswan-mod-stroke \
+       +strongswan-mod-updown \
+       +strongswan-mod-x509 \
+       +strongswan-mod-xauth-generic \
+       +strongswan-mod-xcbc \
+       +strongswan-utils
+endef
+
+define Package/strongswan-default/description
+$(call Package/strongswan/description/Default)
+ This meta-package contains only dependencies to match upstream defaults.
+endef
+
+define Package/strongswan-minimal
+$(call Package/strongswan/Default)
+  TITLE+= (minimal)
+  DEPENDS:= +strongswan \
+       +strongswan-charon \
+       +strongswan-mod-aes \
+       +strongswan-mod-gmp \
+       +strongswan-mod-hmac \
+       +strongswan-mod-kernel-netlink \
+       +strongswan-mod-nonce \
+       +strongswan-mod-pubkey \
+       +strongswan-mod-random \
+       +strongswan-mod-sha1 \
+       +strongswan-mod-socket-default \
+       +strongswan-mod-stroke \
+       +strongswan-mod-updown \
+       +strongswan-mod-x509 \
+       +strongswan-mod-xcbc
+endef
+
+define Package/strongswan-minimal/description
+$(call Package/strongswan/description/Default)
+ This meta-package contains only dependencies for a minimal IKEv2 setup.
+endef
+
+define Package/strongswan-charon
+$(call Package/strongswan/Default)
+  TITLE+= IKEv1/IKEv2 keying daemon
+  DEPENDS:= +strongswan
+endef
+
+define Package/strongswan-charon/description
+$(call Package/strongswan/description/Default)
+ This package contains charon, an IKEv2 keying daemon.
+endef
+
+define Package/strongswan-libfast
+$(call Package/strongswan/Default)
+  TITLE+= libfast
+  DEPENDS:= +strongswan \
+               +PACKAGE_strongswan-libfast:zlib \
+               +PACKAGE_strongswan-libfast:fcgi \
+               +PACKAGE_strongswan-libfast:clearsilver
+endef
+
+define Package/strongswan-libfast/description
+$(call Package/strongswan/description/Default)
+ This package contains libfast, a lightweight framework to build native web
+ applications using ClearSilver and FastCGI.
+endef
+
+define Package/strongswan-utils
+$(call Package/strongswan/Default)
+  TITLE+= utilities
+  DEPENDS:= +strongswan
+endef
+
+define Package/strongswan-utils/description
+$(call Package/strongswan/description/Default)
+ This package contains the pki & scepclient utilities.
+endef
+
+define BuildPlugin
+  define Package/strongswan-mod-$(1)
+    $$(call Package/strongswan/Default)
+    TITLE:= StrongSwan $(2) plugin
+    DEPENDS:= +strongswan $(3)
+  endef
+
+  strongswan_mod_conf=$(wildcard $(PKG_INSTALL_DIR)/etc/strongswan.d/charon/$(1).conf)
+  define Package/strongswan-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/etc/strongswan.d/charon
+       $(if $(call strongswan_mod_conf,$(1)), \
+               $(INSTALL_DATA) \
+                       $(call strongswan_mod_conf,$(1)) \
+                       $$(1)/etc/strongswan.d/charon/ \
+       )
+       $(INSTALL_DIR) $$(1)/usr/lib/ipsec/plugins
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-$(1).so \
+               $$(1)/usr/lib/ipsec/plugins/
+       $(call Plugin/$(1)/install,$$(1))
+  endef
+
+  Package/strongswan-mod-$(1)/conffiles=$(patsubst $(PKG_INSTALL_DIR)%,%,$(call strongswan_mod_conf,$(1)))
+
+  $$(eval $$(call BuildPackage,strongswan-mod-$(1)))
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-scripts \
+       --disable-static \
+       $(if $(CONFIG_PACKAGE_strongswan-libfast),--enable-fast,--disable-fast) \
+       $(if $(CONFIG_PACKAGE_strongswan-utils),--enable-tools,--disable-tools) \
+       --with-random-device="$(call qstrip,$(CONFIG_STRONGSWAN_DEVICE_RANDOM))" \
+       --with-urandom-device="$(call qstrip,$(CONFIG_STRONGSWAN_DEVICE_URANDOM))" \
+       --with-routing-table="$(call qstrip,$(CONFIG_STRONGSWAN_ROUTING_TABLE))" \
+       --with-routing-table-prio="$(call qstrip,$(CONFIG_STRONGSWAN_ROUTING_TABLE_PRIO))" \
+       $(foreach m,$(PKG_MOD_AVAILABLE), \
+         $(if $(CONFIG_PACKAGE_strongswan-mod-$(m)),--enable-$(m),--disable-$(m)) \
+       )
+
+ifneq ($(CONFIG_PACKAGE_strongswan-libfast),)
+  EXTRA_CPPFLAGS+= -I$(STAGING_DIR)/usr/include/ClearSilver
+endif
+
+EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/strongswan/conffiles
+/etc/ipsec.conf
+/etc/ipsec.secrets
+/etc/ipsec.user
+/etc/strongswan.conf
+endef
+
+define Package/strongswan/install
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/strongswan.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{libstrongswan.so.*,libhydra.so.*} $(1)/usr/lib/ipsec/
+       $(INSTALL_CONF) ./files/ipsec.secrets $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ipsec.init $(1)/etc/init.d/ipsec
+endef
+
+define Package/strongswan-default/install
+       true
+endef
+
+define Package/strongswan-full/install
+       true
+endef
+
+define Package/strongswan-minimal/install
+       true
+endef
+
+define Package/strongswan-charon/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/charon $(1)/usr/lib/ipsec/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libcharon.so.* $(1)/usr/lib/ipsec/
+endef
+
+define Package/strongswan-libfast/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libfast.so.* $(1)/usr/lib/ipsec/
+endef
+
+define Package/strongswan-utils/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ipsec $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pki $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/scepclient $(1)/usr/lib/ipsec/
+endef
+
+define Plugin/duplicheck/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/duplicheck $(1)/usr/lib/ipsec/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-duplicheck.so $(1)/usr/lib/ipsec/plugins/
+endef
+
+define Plugin/eap-radius/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libradius.so.* $(1)/usr/lib/ipsec/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-eap-radius.so $(1)/usr/lib/ipsec/plugins/
+endef
+
+define Plugin/attr-sql/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/pool $(1)/usr/lib/ipsec/
+endef
+
+define Plugin/stroke/install
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/aacerts
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/acerts
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/cacerts
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/certs
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/crls
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/ocspcerts
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/private
+       $(INSTALL_DIR) $(1)/etc/ipsec.d/reqs
+
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ipsec.conf $(1)/etc/
+
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{starter,stroke} $(1)/usr/lib/ipsec/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-stroke.so $(1)/usr/lib/ipsec/plugins/
+endef
+
+define Plugin/updown/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/{_updown,_updown_espmark} $(1)/usr/lib/ipsec/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-updown.so $(1)/usr/lib/ipsec/plugins/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/ipsec.user $(1)/etc/
+endef
+
+define Plugin/whitelist/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec/plugins
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/whitelist $(1)/usr/lib/ipsec/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/plugins/libstrongswan-whitelist.so $(1)/usr/lib/ipsec/plugins/
+endef
+
+define Plugin/kernel-libipsec/install
+       $(INSTALL_DIR) $(1)/usr/lib/ipsec
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ipsec/libipsec.so.* $(1)/usr/lib/ipsec/
+endef
+
+$(eval $(call BuildPackage,strongswan))
+$(eval $(call BuildPackage,strongswan-default))
+$(eval $(call BuildPackage,strongswan-full))
+$(eval $(call BuildPackage,strongswan-minimal))
+$(eval $(call BuildPackage,strongswan-charon))
+$(eval $(call BuildPackage,strongswan-libfast))
+$(eval $(call BuildPackage,strongswan-utils))
+$(eval $(call BuildPlugin,addrblock,RFC 3779 address block constraint support,))
+$(eval $(call BuildPlugin,aes,AES crypto,))
+$(eval $(call BuildPlugin,af-alg,AF_ALG crypto interface to Linux Crypto API,+kmod-crypto-user))
+$(eval $(call BuildPlugin,agent,SSH agent signing,))
+$(eval $(call BuildPlugin,attr,file based config,))
+$(eval $(call BuildPlugin,attr-sql,SQL based config,+strongswan-mod-sql))
+$(eval $(call BuildPlugin,blowfish,Blowfish crypto,))
+$(eval $(call BuildPlugin,ccm,CCM AEAD wrapper crypto,))
+$(eval $(call BuildPlugin,cmac,CMAC crypto,))
+$(eval $(call BuildPlugin,constraints,advanced X509 constraint checking,))
+$(eval $(call BuildPlugin,coupling,IKEv2 plugin to couple peer certificates permanently to authentication,))
+$(eval $(call BuildPlugin,ctr,Counter Mode wrapper crypto,))
+$(eval $(call BuildPlugin,curl,cURL fetcher plugin,+PACKAGE_strongswan-mod-curl:libcurl))
+$(eval $(call BuildPlugin,des,DES crypto,))
+$(eval $(call BuildPlugin,dhcp,DHCP based attribute provider,))
+$(eval $(call BuildPlugin,dnskey,DNS RR key decoding,))
+$(eval $(call BuildPlugin,duplicheck,advanced duplicate checking,))
+$(eval $(call BuildPlugin,eap-identity,EAP identity helper,))
+$(eval $(call BuildPlugin,eap-md5,EAP MD5 (CHAP) EAP auth,))
+$(eval $(call BuildPlugin,eap-mschapv2,EAP MS-CHAPv2 EAP auth,+strongswan-mod-md4 +strongswan-mod-des))
+$(eval $(call BuildPlugin,eap-radius,EAP RADIUS auth,))
+$(eval $(call BuildPlugin,farp,fake arp respsonses,))
+$(eval $(call BuildPlugin,fips-prf,FIPS PRF crypto,+strongswan-mod-sha1))
+$(eval $(call BuildPlugin,gcm,GCM AEAD wrapper crypto,))
+$(eval $(call BuildPlugin,gcrypt,libgcrypt,+PACKAGE_strongswan-mod-gcrypt:libgcrypt))
+$(eval $(call BuildPlugin,gmp,libgmp,+PACKAGE_strongswan-mod-gmp:libgmp))
+$(eval $(call BuildPlugin,ha,high availability cluster,))
+$(eval $(call BuildPlugin,hmac,HMAC crypto,))
+$(eval $(call BuildPlugin,kernel-klips,KLIPS kernel interface,))
+$(eval $(call BuildPlugin,kernel-libipsec,libipsec kernel interface,))
+$(eval $(call BuildPlugin,kernel-netlink,netlink kernel interface,))
+$(eval $(call BuildPlugin,kernel-pfkey,PK_KEY kernel interface,))
+$(eval $(call BuildPlugin,ldap,LDAP,+PACKAGE_strongswan-mod-ldap:libopenldap))
+$(eval $(call BuildPlugin,led,LED blink on IKE activity,))
+$(eval $(call BuildPlugin,load-tester,load testing,))
+$(eval $(call BuildPlugin,nonce,nonce genereation,))
+$(eval $(call BuildPlugin,md4,MD4 crypto,))
+$(eval $(call BuildPlugin,md5,MD5 crypto,))
+$(eval $(call BuildPlugin,mysql,MySQL database interface,+strongswan-mod-sql +PACKAGE_strongswan-mod-mysql:libmysqlclient-r))
+$(eval $(call BuildPlugin,openssl,OpenSSL crypto,+PACKAGE_strongswan-mod-openssl:libopenssl))
+$(eval $(call BuildPlugin,padlock,VIA PadLock crypto,@TARGET_x86))
+$(eval $(call BuildPlugin,pem,PEM decoding,))
+$(eval $(call BuildPlugin,pgp,PGP key decoding,))
+$(eval $(call BuildPlugin,pkcs1,PKCS1 key decoding,))
+$(eval $(call BuildPlugin,pkcs8,PKCS8 key decoding,))
+$(eval $(call BuildPlugin,pkcs11,PKCS11 key decoding,))
+$(eval $(call BuildPlugin,pubkey,raw public key,))
+$(eval $(call BuildPlugin,random,RNG,))
+$(eval $(call BuildPlugin,resolve,DNS resolver,))
+$(eval $(call BuildPlugin,revocation,X509 CRL/OCSP revocation,))
+$(eval $(call BuildPlugin,sha1,SHA1 crypto,))
+$(eval $(call BuildPlugin,sha2,SHA2 crypto,))
+$(eval $(call BuildPlugin,smp,SMP configuration and control interface,+PACKAGE_strongswan-mod-smp:libxml2))
+$(eval $(call BuildPlugin,socket-default,default socket implementation for charon,))
+$(eval $(call BuildPlugin,socket-dynamic,dynamic socket implementation for charon,))
+$(eval $(call BuildPlugin,sql,SQL database interface,))
+$(eval $(call BuildPlugin,sqlite,SQLite database interface,+strongswan-mod-sql +PACKAGE_strongswan-mod-sqlite:libsqlite3))
+$(eval $(call BuildPlugin,stroke,Stroke,+strongswan-utils))
+$(eval $(call BuildPlugin,test-vectors,crypto test vectors,))
+$(eval $(call BuildPlugin,uci,UCI config interface,+PACKAGE_strongswan-mod-uci:libuci))
+$(eval $(call BuildPlugin,unity,Cisco Unity extension,))
+$(eval $(call BuildPlugin,updown,updown firewall,))
+$(eval $(call BuildPlugin,whitelist,peer identity whitelisting,))
+$(eval $(call BuildPlugin,x509,x509 certificate,))
+$(eval $(call BuildPlugin,xauth-eap,EAP XAuth backend,))
+$(eval $(call BuildPlugin,xauth-generic,generic XAuth backend,))
+$(eval $(call BuildPlugin,xcbc,xcbc crypto,))
diff --git a/net/strongswan/files/ipsec.init b/net/strongswan/files/ipsec.init
new file mode 100644 (file)
index 0000000..391a2ae
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+
+START=90
+STOP=10
+
+start() {
+       ipsec start
+}
+
+stop() {
+       ipsec stop
+}
+
+restart() {
+       ipsec restart
+}
+
+reload() {
+       ipsec update
+}
diff --git a/net/strongswan/files/ipsec.secrets b/net/strongswan/files/ipsec.secrets
new file mode 100644 (file)
index 0000000..ddd4956
--- /dev/null
@@ -0,0 +1 @@
+# /etc/ipsec.secrets - strongSwan IPsec secrets file
diff --git a/net/strongswan/files/ipsec.user b/net/strongswan/files/ipsec.user
new file mode 100644 (file)
index 0000000..4351ace
--- /dev/null
@@ -0,0 +1,6 @@
+# This file is interpreted as shell script.
+# Put your custom ip rules here, they will
+# be executed with each call to the script
+# /usr/lib/ipsec/_updown which by default
+# strongswan executes.
+
diff --git a/net/strongswan/patches/100-method_name_fix.patch b/net/strongswan/patches/100-method_name_fix.patch
new file mode 100644 (file)
index 0000000..477f399
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/src/libipsec/ip_packet.c
++++ b/src/libipsec/ip_packet.c
+@@ -95,7 +95,7 @@ METHOD(ip_packet_t, get_next_header, u_i
+       return this->next_header;
+ }
+-METHOD(ip_packet_t, clone, ip_packet_t*,
++METHOD(ip_packet_t, clone_, ip_packet_t*,
+       private_ip_packet_t *this)
+ {
+       return ip_packet_create(chunk_clone(this->packet));
+@@ -183,7 +183,7 @@ ip_packet_t *ip_packet_create(chunk_t pa
+                       .get_destination = _get_destination,
+                       .get_next_header = _get_next_header,
+                       .get_encoding = _get_encoding,
+-                      .clone = _clone,
++                      .clone = _clone_,
+                       .destroy = _destroy,
+               },
+               .src = src,
+--- a/src/libipsec/esp_packet.c
++++ b/src/libipsec/esp_packet.c
+@@ -115,7 +115,7 @@ METHOD(packet_t, skip_bytes, void,
+       return this->packet->skip_bytes(this->packet, bytes);
+ }
+-METHOD(packet_t, clone, packet_t*,
++METHOD(packet_t, clone_, packet_t*,
+       private_esp_packet_t *this)
+ {
+       private_esp_packet_t *pkt;
+@@ -414,7 +414,7 @@ static private_esp_packet_t *esp_packet_
+                               .get_dscp = _get_dscp,
+                               .set_dscp = _set_dscp,
+                               .skip_bytes = _skip_bytes,
+-                              .clone = _clone,
++                              .clone = _clone_,
+                               .destroy = _destroy,
+                       },
+                       .get_source = _get_source,
diff --git a/net/strongswan/patches/201-kmodloader.patch b/net/strongswan/patches/201-kmodloader.patch
new file mode 100644 (file)
index 0000000..7d46156
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/src/starter/netkey.c
++++ b/src/starter/netkey.c
+@@ -31,7 +31,7 @@ bool starter_netkey_init(void)
+               /* af_key module makes the netkey proc interface visible */
+               if (stat(PROC_MODULES, &stb) == 0)
+               {
+-                      ignore_result(system("modprobe -qv af_key"));
++                      ignore_result(system("modprobe af_key 2>&1 >/dev/null"));
+               }
+               /* now test again */
+@@ -45,11 +45,11 @@ bool starter_netkey_init(void)
+       /* make sure that all required IPsec modules are loaded */
+       if (stat(PROC_MODULES, &stb) == 0)
+       {
+-              ignore_result(system("modprobe -qv ah4"));
+-              ignore_result(system("modprobe -qv esp4"));
+-              ignore_result(system("modprobe -qv ipcomp"));
+-              ignore_result(system("modprobe -qv xfrm4_tunnel"));
+-              ignore_result(system("modprobe -qv xfrm_user"));
++              ignore_result(system("modprobe ah4 2>&1 >/dev/null"));
++              ignore_result(system("modprobe esp4 2>&1 >/dev/null"));
++              ignore_result(system("modprobe ipcomp 2>&1 >/dev/null"));
++              ignore_result(system("modprobe xfrm4_tunnel 2>&1 >/dev/null"));
++              ignore_result(system("modprobe xfrm_user 2>&1 >/dev/null"));
+       }
+       DBG2(DBG_APP, "found netkey IPsec stack");
diff --git a/net/strongswan/patches/203-uci.patch b/net/strongswan/patches/203-uci.patch
new file mode 100644 (file)
index 0000000..274ea86
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/libcharon/plugins/uci/uci_parser.c
++++ b/src/libcharon/plugins/uci/uci_parser.c
+@@ -78,7 +78,7 @@ METHOD(enumerator_t, section_enumerator_
+               if (uci_lookup(this->ctx, &element, this->package,
+                                          this->current->name, "name") == UCI_OK)
+               {       /* use "name" attribute as config name if available ... */
+-                      *value = uci_to_option(element)->value;
++                      *value = uci_to_option(element)->v.string;
+               }
+               else
+               {       /* ... or the section name becomes config name */
+@@ -93,7 +93,7 @@ METHOD(enumerator_t, section_enumerator_
+               if (value && uci_lookup(this->ctx, &element, this->package,
+                                                 this->current->name, this->keywords[i]) == UCI_OK)
+               {
+-                      *value = uci_to_option(element)->value;
++                      *value = uci_to_option(element)->v.string;
+               }
+       }
+       va_end(args);
diff --git a/net/strongswan/patches/300-include-ipsec-user-script.patch b/net/strongswan/patches/300-include-ipsec-user-script.patch
new file mode 100644 (file)
index 0000000..d96e844
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/src/_updown/_updown.in
++++ b/src/_updown/_updown.in
+@@ -16,11 +16,9 @@
+ # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ # for more details.
+-# CAUTION:  Installing a new version of strongSwan will install a new
+-# copy of this script, wiping out any custom changes you make.  If
+-# you need changes, make a copy of this under another name, and customize
+-# that, and use the (left/right)updown parameters in ipsec.conf to make
+-# strongSwan use yours instead of this default one.
++# Add your custom ip rules to the /etc/ipsec.user file if you need that functionality.
++
++[ -e /etc/ipsec.user ] && . /etc/ipsec.user "$1"
+ # things that this script gets (from ipsec_pluto(8) man page)
+ #
diff --git a/net/stun/Makefile b/net/stun/Makefile
new file mode 100644 (file)
index 0000000..7461fab
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Copyright (C) 2008-2014 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:=stund
+PKG_VERSION:=0.96
+PKG_RELEASE:=7
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)_Aug13.tgz
+PKG_SOURCE_URL:=@SF/stun
+PKG_MD5SUM:=3273abb1a6f299f4e611b658304faefa
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/stun/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=$(CXX_DEPENDS)
+  URL:=http://sourceforge.net/projects/stun
+endef
+
+define Package/stun/Default/description
+  The STUN protocol (Simple Traversal of UDP through NATs) is described in the
+  IETF RFC 3489, available at http://www.ietf.org/rfc/rfc3489.txt. It's used to
+  help clients behind NAT to tunnel incoming calls through. This server is the
+  counterpart to help the client identify the NAT and have it open the proper
+  ports for it.
+endef
+
+define Package/stund
+$(call Package/stun/Default)
+  TITLE:=STUN server
+endef
+
+define Package/stund/description
+$(call Package/stun/Default/description)
+endef
+
+define Package/stun-client
+$(call Package/stun/Default)
+  TITLE:=STUN test client
+endef
+
+define Package/stun-client/description
+$(call Package/stun/Default/description)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CXX="$(TARGET_CXX)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               CXXFLAGS="$(TARGET_CFLAGS) -fno-rtti"  \
+               CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$$$$LDFLAGS $(TARGET_LDFLAGS)" \
+               all
+endef
+
+
+define Package/stund/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server $(1)/usr/sbin/stund
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/stund.init $(1)/etc/init.d/stund
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/stund.config $(1)/etc/config/stund
+endef
+
+define Package/stund/conffiles
+/etc/config/stund
+endef
+
+define Package/stun-client/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/client $(1)/usr/sbin/stun-client
+endef
+
+$(eval $(call BuildPackage,stund))
+$(eval $(call BuildPackage,stun-client))
diff --git a/net/stun/files/stund.config b/net/stun/files/stund.config
new file mode 100644 (file)
index 0000000..0a0bc07
--- /dev/null
@@ -0,0 +1,5 @@
+config stund
+       option primaryip ''
+       option secondaryip ''
+       option primaryport '3478'
+       option secondaryport '3479'
diff --git a/net/stun/files/stund.init b/net/stun/files/stund.init
new file mode 100644 (file)
index 0000000..1deada4
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+
+START=70
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start() {
+       local pri_ip sec_ip pri_port sec_port
+
+       parse_opts() {
+               local cfg="$1"
+               config_get pri_ip   "$cfg" 'primaryip'
+               config_get sec_ip   "$cfg" 'secondaryip'
+               config_get pri_port "$cfg" 'primaryport'
+               config_get sec_port "$cfg" 'secondaryport'
+       }
+
+       config_load 'stund'
+       config_foreach parse_opts
+
+       service_start /usr/sbin/stund \
+               ${pri_ip:+-h $pri_ip} ${sec_ip:+-a $sec_ip} \
+               ${pri_port:+-p $pri_port} ${sec_port:+-o $sec_port}
+}
+
+stop() {
+       service_stop /usr/sbin/stund
+}
diff --git a/net/stun/patches/001-fix_non_i386.patch b/net/stun/patches/001-fix_non_i386.patch
new file mode 100644 (file)
index 0000000..070b551
--- /dev/null
@@ -0,0 +1,27 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix_non_i386.dpatch by Kilian Krause <kilian@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Remove i386-only code analogous to twinkle
+@DPATCH@
+diff -urNad stun-0.96~/stun.cxx stun-0.96/stun.cxx
+--- stun-0.96~/stun.cxx        2005-08-14 00:39:03.000000000 +0000
++++ stun-0.96/stun.cxx 2006-01-03 00:54:33.000000000 +0000
+@@ -669,16 +669,8 @@
+       tick = hightick;
+       tick <<= 32;
+       tick |= lowtick;
+-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
+-      asm("rdtsc" : "=A" (tick));
+-#elif defined (__SUNPRO_CC) || defined( __sparc__ )   
+-      tick = gethrtime();
+-#elif defined(__MACH__) 
+-      int fd=open("/dev/random",O_RDONLY);
+-      read(fd,&tick,sizeof(tick));
+-      closesocket(fd);
+ #else
+-#     error Need some way to seed the random number generator 
++      tick = time(NULL);
+ #endif 
+       int seed = int(tick);
+ #ifdef WIN32
diff --git a/net/stun/patches/002-linking_order.patch b/net/stun/patches/002-linking_order.patch
new file mode 100644 (file)
index 0000000..c9a23f1
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/Makefile
++++ b/Makefile
+@@ -37,13 +37,13 @@
+                        $(addprefix stund/, $(TARS))
+ server: server.o stun.o udp.o 
+-      $(CXX) $(LDFLAGS) -o $@  $^
++      $(CXX) -o $@ $^ $(LDFLAGS)
+ tlsServer: tlsServer.o stun.o udp.o
+-      $(CXX) $(LDFLAGS) -o $@  $^
++      $(CXX) -o $@  $^ $(LDFLAGS)
+ client: client.o stun.o udp.o 
+-      $(CXX) $(LDFLAGS) -o $@  $^
++      $(CXX) -o $@  $^ $(LDFLAGS)
+ %.o:%.cxx
+       $(CXX)  -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
diff --git a/net/stunnel/Makefile b/net/stunnel/Makefile
new file mode 100644 (file)
index 0000000..f124b35
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2006-2010 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:=stunnel
+PKG_VERSION:=4.33
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.stunnel.org/download/stunnel/src/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=559a864066d8cc4afd8a97682c90d41c
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/stunnel
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libopenssl +libwrap
+  TITLE:=SSL TCP Wrapper
+  URL:=http://www.stunnel.org/
+endef
+
+define Package/stunnel/description
+       Stunnel is a program that allows you to encrypt arbitrary TCP
+       connections inside SSL (Secure Sockets Layer) available on both Unix
+       and Windows. Stunnel can allow you to secure non-SSL aware daemons and
+       protocols (like POP, IMAP, LDAP, etc) by having Stunnel provide the
+       encryption, requiring no changes to the daemon's code.
+endef
+
+define Package/stunnel/conffiles
+/etc/stunnel/stunnel.conf
+endef
+
+CONFIGURE_ARGS+= \
+       --with-random=/dev/urandom \
+       --with-threads=fork \
+       --with-ssl=$(STAGING_DIR)/usr \
+
+define Build/Compile
+       mkdir -p $(PKG_INSTALL_DIR)/etc/stunnel
+       echo '#dummy' > $(PKG_INSTALL_DIR)/etc/stunnel/stunnel.pem
+       $(call Build/Compile/Default)
+endef
+
+define Package/stunnel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stunnel $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/stunnel
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/stunnel/libstunnel.so $(1)/usr/lib/stunnel/
+       $(INSTALL_DIR) $(1)/etc/stunnel
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/stunnel/stunnel.conf-sample $(1)/etc/stunnel/stunnel.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/stunnel.init $(1)/etc/init.d/stunnel
+endef
+
+$(eval $(call BuildPackage,stunnel))
diff --git a/net/stunnel/files/stunnel.init b/net/stunnel/files/stunnel.init
new file mode 100644 (file)
index 0000000..a3ea103
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2008 OpenWrt.org
+
+START=90
+RUN_D=/var
+PID_F=$RUN_D/stunnel.pid
+
+start() {
+       if [ -s "/etc/stunnel/stunnel.pem" ]; then
+               chmod og-rwx /etc/stunnel/stunnel.pem
+               [ ! -f $PID_F ] && stunnel
+       else
+               [ -e /etc/stunnel/config ] && \
+               . /etc/stunnel/config
+
+               X509_CN=${X509_CN:-"router"}
+               X509_O=${X509_O:-"openwrt.org"}
+               X509_OU=${X509_OU:-"open-source firmware"}
+
+               [ -x /sbin/keygen ] && {
+               (keygen "$X509_CN" "$X509_O" "$X509_OU" > /etc/stunnel/stunnel.pem;
+                       chmod og-rwx /etc/stunnel/stunnel.pem;
+                       stunnel) &
+               }
+       fi
+}
+
+stop() {
+       [ -f $PID_F ] && {
+               kill $(cat $PID_F)
+               kill -9 $(cat $PID_F)
+               rm -f $PID_F
+       }
+}
diff --git a/net/stunnel/patches/100-cross-compile.patch b/net/stunnel/patches/100-cross-compile.patch
new file mode 100644 (file)
index 0000000..5ce3c35
--- /dev/null
@@ -0,0 +1,126 @@
+--- a/configure
++++ b/configure
+@@ -21552,56 +21552,56 @@ _ACEOF
+ fi
+ rm -f conftest*
+-
+-{ echo "$as_me:$LINENO: **************************************** PTY device files" >&5
+-echo "$as_me: **************************************** PTY device files" >&6;}
+-{ echo "$as_me:$LINENO: checking for \"/dev/ptmx\"" >&5
+-echo $ECHO_N "checking for \"/dev/ptmx\"... $ECHO_C" >&6; }
+-if test "${ac_cv_file___dev_ptmx_+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  test "$cross_compiling" = yes &&
+-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+-   { (exit 1); exit 1; }; }
+-if test -r ""/dev/ptmx""; then
+-  ac_cv_file___dev_ptmx_=yes
+-else
+-  ac_cv_file___dev_ptmx_=no
+-fi
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptmx_" >&5
+-echo "${ECHO_T}$ac_cv_file___dev_ptmx_" >&6; }
+-if test $ac_cv_file___dev_ptmx_ = yes; then
++#
++#{ echo "$as_me:$LINENO: **************************************** PTY device files" >&5
++#echo "$as_me: **************************************** PTY device files" >&6;}
++#{ echo "$as_me:$LINENO: checking for \"/dev/ptmx\"" >&5
++#echo $ECHO_N "checking for \"/dev/ptmx\"... $ECHO_C" >&6; }
++#if test "${ac_cv_file___dev_ptmx_+set}" = set; then
++#  echo $ECHO_N "(cached) $ECHO_C" >&6
++#else
++#  test "$cross_compiling" = yes &&
++#  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
++#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
++#   { (exit 1); exit 1; }; }
++#if test -r ""/dev/ptmx""; then
++#  ac_cv_file___dev_ptmx_=yes
++#else
++#  ac_cv_file___dev_ptmx_=no
++#fi
++#fi
++#{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptmx_" >&5
++#echo "${ECHO_T}$ac_cv_file___dev_ptmx_" >&6; }
++#if test $ac_cv_file___dev_ptmx_ = yes; then
+   cat >>confdefs.h <<\_ACEOF
+-#define HAVE_DEV_PTMX 1
++#define HAVE_DEV_PTMX 0
+ _ACEOF
+-fi
++#fi
+-{ echo "$as_me:$LINENO: checking for \"/dev/ptc\"" >&5
+-echo $ECHO_N "checking for \"/dev/ptc\"... $ECHO_C" >&6; }
+-if test "${ac_cv_file___dev_ptc_+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  test "$cross_compiling" = yes &&
+-  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+-   { (exit 1); exit 1; }; }
+-if test -r ""/dev/ptc""; then
+-  ac_cv_file___dev_ptc_=yes
+-else
+-  ac_cv_file___dev_ptc_=no
+-fi
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptc_" >&5
+-echo "${ECHO_T}$ac_cv_file___dev_ptc_" >&6; }
+-if test $ac_cv_file___dev_ptc_ = yes; then
++#{ echo "$as_me:$LINENO: checking for \"/dev/ptc\"" >&5
++#echo $ECHO_N "checking for \"/dev/ptc\"... $ECHO_C" >&6; }
++#if test "${ac_cv_file___dev_ptc_+set}" = set; then
++#  echo $ECHO_N "(cached) $ECHO_C" >&6
++#else
++#  test "$cross_compiling" = yes &&
++#  { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
++#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
++#   { (exit 1); exit 1; }; }
++#if test -r ""/dev/ptc""; then
++#  ac_cv_file___dev_ptc_=yes
++#else
++#  ac_cv_file___dev_ptc_=no
++#fi
++#fi
++#{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptc_" >&5
++#echo "${ECHO_T}$ac_cv_file___dev_ptc_" >&6; }
++#if test $ac_cv_file___dev_ptc_ = yes; then
+   cat >>confdefs.h <<\_ACEOF
+-#define HAVE_DEV_PTS_AND_PTC 1
++#define HAVE_DEV_PTS_AND_PTC 0
+ _ACEOF
+-fi
++#fi
+ { echo "$as_me:$LINENO: **************************************** entropy" >&5
+@@ -24049,8 +24049,8 @@ _ACEOF
+ # Add SSL includes and libraries
+-CFLAGS="$CFLAGS -I$ssldir/include"
+-LIBS="$LIBS -L$ssldir/lib -lssl -lcrypto"
++CFLAGS="$CFLAGS"
++LIBS="$LIBS -lssl -lcrypto"
+ # Check for obsolete RSAref library
+ { echo "$as_me:$LINENO: checking for obsolete RSAref library" >&5
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,10 +44,6 @@ AC_EGREP_HEADER(socklen_t, sys/socket.h,
+     AC_MSG_RESULT([no (defined as int)])
+     AC_DEFINE(socklen_t, int))
+-AC_MSG_NOTICE([**************************************** PTY device files])
+-AC_CHECK_FILE("/dev/ptmx", AC_DEFINE(HAVE_DEV_PTMX))
+-AC_CHECK_FILE("/dev/ptc", AC_DEFINE(HAVE_DEV_PTS_AND_PTC))
+-
+ AC_MSG_NOTICE([**************************************** entropy])
+ AC_ARG_WITH(egd-socket,
diff --git a/net/stunnel/patches/101-no-comp.patch b/net/stunnel/patches/101-no-comp.patch
new file mode 100644 (file)
index 0000000..9fbe22c
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/src/ssl.c
++++ b/src/ssl.c
+@@ -72,14 +72,17 @@ int ssl_configure(void) { /* configure g
+     s_log(LOG_NOTICE, "FIPS mode %s",
+         global_options.option.fips ? "enabled" : "disabled");
+ #endif /* USE_FIPS */
++#ifndef OPENSSL_NO_COMP   
+     if(global_options.compression!=COMP_NONE && !init_compression())
+         return 0;
++#endif
+     if(!init_prng())
+         return 0;
+     s_log(LOG_DEBUG, "PRNG seeded successfully");
+     return 1; /* SUCCESS */
+ }
++#ifndef OPENSSL_NO_COMP
+ static int init_compression(void) {
+     int id=0;
+     COMP_METHOD *cm=NULL;
+@@ -111,6 +114,7 @@ static int init_compression(void) {
+     s_log(LOG_INFO, "Compression enabled using %s method", name);
+     return 1;
+ }
++#endif
+ static int init_prng(void) {
+     int totbytes=0;
diff --git a/net/stunnel/patches/102-no-ssl2.patch b/net/stunnel/patches/102-no-ssl2.patch
new file mode 100644 (file)
index 0000000..e94184b
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/src/options.c
++++ b/src/options.c
+@@ -1234,8 +1234,10 @@ static char *parse_service_option(CMD cm
+             section->client_method=(SSL_METHOD *)SSLv23_client_method();
+             section->server_method=(SSL_METHOD *)SSLv23_server_method();
+         } else if(!strcasecmp(arg, "SSLv2")) {
++#ifndef OPENSSL_NO_SSL2
+             section->client_method=(SSL_METHOD *)SSLv2_client_method();
+             section->server_method=(SSL_METHOD *)SSLv2_server_method();
++#endif
+         } else if(!strcasecmp(arg, "SSLv3")) {
+             section->client_method=(SSL_METHOD *)SSLv3_client_method();
+             section->server_method=(SSL_METHOD *)SSLv3_server_method();
diff --git a/net/stunnel/patches/103-no-zlib-link.patch b/net/stunnel/patches/103-no-zlib-link.patch
new file mode 100644 (file)
index 0000000..f627c53
--- /dev/null
@@ -0,0 +1,12 @@
+Avoid linking with zlib, which is a dependency of openssl, not ours.
+--- a/configure
++++ b/configure
+@@ -23017,7 +23017,7 @@ if test $ac_cv_lib_z_inflateEnd = yes; t
+ #define HAVE_LIBZ 1
+ _ACEOF
+-  LIBS="-lz $LIBS"
++#  LIBS="-lz $LIBS"
+ fi
diff --git a/net/stunnel/patches/104-fix-paths.patch b/net/stunnel/patches/104-fix-paths.patch
new file mode 100644 (file)
index 0000000..aad310b
--- /dev/null
@@ -0,0 +1,42 @@
+## Do several path fixups, removing unneeded @prefix@s
+--- a/tools/stunnel.conf-sample.in
++++ b/tools/stunnel.conf-sample.in
+@@ -4,15 +4,15 @@
+ ; please read the manual and make sure you understand them
+ ; certificate/key is needed in server mode and optional in client mode
+-cert = @prefix@/etc/stunnel/mail.pem
+-;key = @prefix@/etc/stunnel/mail.pem
++cert = @sysconfdir@/stunnel/stunnel.pem
++;key = @sysconfdir@/stunnel/stunnel.pem
+ ; protocol version (all, SSLv2, SSLv3, TLSv1)
+ sslVersion = SSLv3
+ ; security enhancements for UNIX systems - comment them out on Win32
+ ; for chroot a copy of some devices and files is needed within the jail
+-chroot = @prefix@/var/lib/stunnel/
++chroot = @localstatedir@
+ setuid = nobody
+ setgid = @DEFAULT_GROUP@
+ ; PID is created inside the chroot jail
+@@ -33,16 +33,16 @@ socket = r:TCP_NODELAY=1
+ ; CApath is located inside chroot jail
+ ;CApath = /certs
+ ; it's often easier to use CAfile
+-;CAfile = @prefix@/etc/stunnel/certs.pem
++;CAfile = @sysconfdir@/stunnel/certs.pem
+ ; don't forget to c_rehash CRLpath
+ ; CRLpath is located inside chroot jail
+ ;CRLpath = /crls
+ ; alternatively CRLfile can be used
+-;CRLfile = @prefix@/etc/stunnel/crls.pem
++;CRLfile = @sysconfdir@/stunnel/crls.pem
+ ; debugging stuff (may useful for troubleshooting)
+ ;debug = 7
+-;output = stunnel.log
++;output = @localstatedir@/log/stunnel.log
+ ; SSL client mode
+ ;client = yes
diff --git a/net/stunnel/patches/105-stunnel-conf.patch b/net/stunnel/patches/105-stunnel-conf.patch
new file mode 100644 (file)
index 0000000..c22e0b4
--- /dev/null
@@ -0,0 +1,54 @@
+--- a/tools/stunnel.conf-sample.in
++++ b/tools/stunnel.conf-sample.in
+@@ -8,7 +8,7 @@ cert = @sysconfdir@/stunnel/stunnel.pem
+ ;key = @sysconfdir@/stunnel/stunnel.pem
+ ; protocol version (all, SSLv2, SSLv3, TLSv1)
+-sslVersion = SSLv3
++sslVersion = all
+ ; security enhancements for UNIX systems - comment them out on Win32
+ ; for chroot a copy of some devices and files is needed within the jail
+@@ -49,21 +49,26 @@ socket = r:TCP_NODELAY=1
+ ; service-level configuration
+-[pop3s]
+-accept  = 995
+-connect = 110
+-
+-[imaps]
+-accept  = 993
+-connect = 143
+-
+-[ssmtp]
+-accept  = 465
+-connect = 25
+-
+-;[https]
+-;accept  = 443
+-;connect = 80
+-;TIMEOUTclose = 0
++;[pop3s]
++;accept  = 995
++;connect = 110
++
++;[imaps]
++;accept  = 993
++;connect = 143
++
++;[ssmtp]
++;accept  = 465
++;connect = 25
++
++[https]
++accept  = 443
++connect = 80
++TIMEOUTclose = 0
++
++[chilli]
++accept  = 3443
++connect = 3442
++TIMEOUTclose = 0
+ ; vim:ft=dosini
diff --git a/net/stunnel/patches/106-stunnel-xforwardedfor.patch b/net/stunnel/patches/106-stunnel-xforwardedfor.patch
new file mode 100644 (file)
index 0000000..497ff6d
--- /dev/null
@@ -0,0 +1,248 @@
+--- a/doc/stunnel.8
++++ b/doc/stunnel.8
+@@ -504,7 +504,10 @@ time to keep an idle connection
+ .IP "\fBtransparent\fR = yes | no (Unix only)" 4
+ .IX Item "transparent = yes | no (Unix only)"
+ transparent proxy mode
+-.Sp
++.IP "\fBxforwardedfor\fR = yes | no" 4
++.IX Item "xforwardedfor = yes | no"
++append an 'X-Forwarded-For:' HTTP request header providing the
++client's IP address to the server.
+ Re-write address to appear as if wrapped daemon is connecting
+ from the \s-1SSL\s0 client machine instead of the machine running \fBstunnel\fR.
+ .Sp
+--- a/doc/stunnel.fr.8
++++ b/doc/stunnel.fr.8
+@@ -445,6 +445,10 @@ Cette option permet de relier une adress
+ Négocie avec \s-1SSL\s0 selon le protocole indiqué
+ .Sp
+ Actuellement gérés\ : cifs, nntp, pop3, smtp
++.IP "\fBxforwardedfor\fR = yes | no" 4
++.IX Item "xforwardedfor = yes | no"
++Ajoute un en-tête 'X-Forwarded-For:' dans la requête HTTP fournissant
++au serveur l'adresse IP du client.
+ .IP "\fBpty\fR = yes | no (Unix seulement)" 4
+ .IX Item "pty = yes | no (Unix seulement)"
+ Alloue un pseudo-terminal pour l'option Â«\ exec\ Â»
+--- a/src/client.c
++++ b/src/client.c
+@@ -86,6 +86,12 @@ CLI *alloc_client_session(SERVICE_OPTION
+         return NULL;
+     }
+     c->opt=opt;
++    /* some options need space to add some information */
++    if (c->opt->option.xforwardedfor)
++        c->buffsize = BUFFSIZE - BUFF_RESERVED;
++    else
++        c->buffsize = BUFFSIZE;
++    c->crlf_seen=0;
+     c->local_rfd.fd=rfd;
+     c->local_wfd.fd=wfd;
+     return c;
+@@ -376,6 +382,29 @@ static void init_ssl(CLI *c) {
+     }
+ }
++/* Moves all data from the buffer <buffer> between positions <start> and <stop>
++ * to insert <string> of length <len>. <start> and <stop> are updated to their
++ * new respective values, and the number of characters inserted is returned.
++ * If <len> is too long, nothing is done and -1 is returned.
++ * Note that neither <string> nor <buffer> can be NULL.
++*/
++static int buffer_insert_with_len(char *buffer, int *start, int *stop, int limit, char *string, int len) {
++    if (len > limit - *stop)
++      return -1;
++    if (*start > *stop)
++      return -1;
++    memmove(buffer + *start + len, buffer + *start, *stop - *start);
++    memcpy(buffer + *start, string, len);
++    *start += len;
++    *stop += len;
++    return len;
++}
++
++static int buffer_insert(char *buffer, int *start, int *stop, int limit, char *string) {
++    return buffer_insert_with_len(buffer, start, stop, limit, string, strlen(string));
++}
++
++
+ /****************************** some defines for transfer() */
+ /* is socket/SSL open for read/write? */
+ #define sock_rd (c->sock_rfd->rd)
+@@ -410,13 +439,16 @@ static void transfer(CLI *c) {
+         check_SSL_pending=0;
+         SSL_read_wants_read=
+-            ssl_rd && c->ssl_ptr<BUFFSIZE && !SSL_read_wants_write;
++            //ssl_rd && c->ssl_ptr<BUFFSIZE && !SSL_read_wants_write;
++            ssl_rd && c->ssl_ptr<c->buffsize && !SSL_read_wants_write;
++            
+         SSL_write_wants_write=
+             ssl_wr && c->sock_ptr && !SSL_write_wants_read;
+         /****************************** setup c->fds structure */
+         s_poll_init(&c->fds); /* initialize the structure */
+-        if(sock_rd && c->sock_ptr<BUFFSIZE)
++        //if(sock_rd && c->sock_ptr<BUFFSIZE)
++        if(sock_rd && c->sock_ptr<c->buffsize)
+             s_poll_add(&c->fds, c->sock_rfd->fd, 1, 0);
+         if(SSL_read_wants_read ||
+                 SSL_write_wants_read ||
+@@ -515,7 +547,8 @@ static void transfer(CLI *c) {
+                 break;
+             default:
+                 memmove(c->ssl_buff, c->ssl_buff+num, c->ssl_ptr-num);
+-                if(c->ssl_ptr==BUFFSIZE) /* buffer was previously full */
++                //if(c->ssl_ptr==BUFFSIZE) /* buffer was previously full */
++                if(c->ssl_ptr>=c->buffsize) /* buffer was previously full */
+                     check_SSL_pending=1; /* check for data buffered by SSL */
+                 c->ssl_ptr-=num;
+                 c->sock_bytes+=num;
+@@ -577,7 +610,8 @@ static void transfer(CLI *c) {
+         /****************************** read from socket */
+         if(sock_rd && sock_can_rd) {
+             num=readsocket(c->sock_rfd->fd,
+-                c->sock_buff+c->sock_ptr, BUFFSIZE-c->sock_ptr);
++                //c->sock_buff+c->sock_ptr, BUFFSIZE-c->sock_ptr);
++                c->sock_buff+c->sock_ptr, c->buffsize-c->sock_ptr);
+             switch(num) {
+             case -1:
+                 parse_socket_error(c, "readsocket");
+@@ -597,10 +631,73 @@ static void transfer(CLI *c) {
+                 (SSL_read_wants_write && ssl_can_wr) ||
+                 (check_SSL_pending && SSL_pending(c->ssl))) {
+             SSL_read_wants_write=0;
+-            num=SSL_read(c->ssl, c->ssl_buff+c->ssl_ptr, BUFFSIZE-c->ssl_ptr);
++            //num=SSL_read(c->ssl, c->ssl_buff+c->ssl_ptr, BUFFSIZE-c->ssl_ptr);
++            num=SSL_read(c->ssl, c->ssl_buff+c->ssl_ptr, c->buffsize-c->ssl_ptr);
+             switch(err=SSL_get_error(c->ssl, num)) {
+             case SSL_ERROR_NONE:
++                //c->ssl_ptr+=num;
++                if (c->buffsize != BUFFSIZE && c->opt->option.xforwardedfor) { /* some work left to do */
++                    int last = c->ssl_ptr;
++                    c->ssl_ptr += num;
++             
++                    /* Look for end of HTTP headers between last and ssl_ptr.
++                     * To achieve this reliably, we have to count the number of
++                     * successive [CR]LF and to memorize it in case it's spread
++                     * over multiple segments. --WT.
++                     */
++                    while (last < c->ssl_ptr) {
++                  if (c->ssl_buff[last] == '\n') {
++                      if (++c->crlf_seen == 2)
++                    break;
++                  } else if (last < c->ssl_ptr - 1 &&
++                             c->ssl_buff[last] == '\r' &&
++                       c->ssl_buff[last+1] == '\n') {
++                      if (++c->crlf_seen == 2)
++                    break;
++                      last++;
++                  } else if (c->ssl_buff[last] != '\r')
++                      /* don't refuse '\r' because we may get a '\n' on next read */
++                      c->crlf_seen = 0;
++                  last++;
++                    }
++                    if (c->crlf_seen >= 2) {
++                  /* We have all the HTTP headers now. We don't need to
++                   * reserve any space anymore. <ssl_ptr> points to the
++                   * first byte of unread data, and <last> points to the
++                   * exact location where we want to insert our headers,
++                   * which is right before the empty line.
++                   */
++                  c->buffsize = BUFFSIZE;
++             
++                  if (c->opt->option.xforwardedfor) {
++                      /* X-Forwarded-For: xxxx \r\n\0 */
++                      char xforw[17 + IPLEN + 3];
++             
++                      /* We will insert our X-Forwarded-For: header here.
++                       * We need to write the IP address, but if we use
++                       * sprintf, it will pad with the terminating 0.
++                       * So we will pass via a temporary buffer allocated
++                       * on the stack.
++                       */
++                      memcpy(xforw, "X-Forwarded-For: ", 17);
++                      if (getnameinfo(&c->peer_addr.addr[0].sa,
++                          addr_len(c->peer_addr.addr[0]),
++                          xforw + 17, IPLEN, NULL, 0,
++                          NI_NUMERICHOST) == 0) {
++                    strcat(xforw + 17, "\r\n");
++                    buffer_insert(c->ssl_buff, &last, &c->ssl_ptr,
++                            c->buffsize, xforw);
++                      }
++                      /* last still points to the \r\n and ssl_ptr to the
++                       * end of the buffer, so we may add as many headers
++                       * as wee need to.
++                       */
++                  }                   
++                    }
++                }
++                else
+                 c->ssl_ptr+=num;
++
+                 watchdog=0; /* reset watchdog */
+                 break;
+             case SSL_ERROR_WANT_WRITE:
+--- a/src/common.h
++++ b/src/common.h
+@@ -53,6 +53,9 @@
+ /* I/O buffer size */
+ #define BUFFSIZE 16384
++/* maximum space reserved for header insertion in BUFFSIZE */
++#define BUFF_RESERVED  1024
++
+ /* length of strings (including the terminating '\0' character) */
+ /* it can't be lower than 256 bytes or NTLM authentication will break */
+ #define STRLEN 256
+--- a/src/options.c
++++ b/src/options.c
+@@ -792,6 +792,28 @@ static char *parse_service_option(CMD cm
+     }
+ #endif
++    /* xforwardedfor */
++    switch(cmd) {
++    case CMD_INIT:
++        section->option.xforwardedfor=0;
++        break;
++    case CMD_EXEC:
++        if(strcasecmp(opt, "xforwardedfor"))
++            break;
++        if(!strcasecmp(arg, "yes"))
++            section->option.xforwardedfor=1;
++        else if(!strcasecmp(arg, "no"))
++            section->option.xforwardedfor=0;
++        else
++            return "argument should be either 'yes' or 'no'";
++        return NULL; /* OK */
++    case CMD_DEFAULT:
++        break;
++    case CMD_HELP:
++        s_log("%-15s = yes|no append an HTTP X-Forwarded-For header","xforwardedfor");
++        break;
++    }
++
+     /* exec */
+     switch(cmd) {
+     case CMD_INIT:
+--- a/src/prototypes.h
++++ b/src/prototypes.h
+@@ -177,6 +177,7 @@ typedef struct service_options_struct {
+         unsigned int remote:1;
+         unsigned int retry:1; /* loop remote+program */
+         unsigned int sessiond:1;
++        unsigned int xforwardedfor:1;
+         unsigned int program:1;
+ #ifndef USE_WIN32
+         unsigned int pty:1;
+@@ -351,6 +352,8 @@ typedef struct {
+     FD *ssl_rfd, *ssl_wfd; /* read and write SSL descriptors */
+     int sock_bytes, ssl_bytes; /* bytes written to socket and ssl */
+     s_poll_set fds; /* file descriptors */
++    int buffsize;  /* current buffer size, may be lower than BUFFSIZE */
++    int crlf_seen; /* the number of successive CRLF seen */
+ } CLI;
+ extern int max_fds, max_clients;
diff --git a/net/subversion/Makefile b/net/subversion/Makefile
new file mode 100644 (file)
index 0000000..a2ec866
--- /dev/null
@@ -0,0 +1,129 @@
+#
+# Copyright (C) 2007-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:=subversion
+PKG_VERSION:=1.6.23
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://subversion.tigris.org/downloads
+PKG_MD5SUM:=5d621281ce9d3448e1437cb006331f57
+
+PKG_FIXUP:=autoreconf
+PKG_MACRO_PATHS:=build/ac-macros
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/subversion/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A compelling replacement for CVS
+  DEPENDS:=+zlib +libneon +libaprutil
+  URL:=http://subversion.apache.org/
+  SUBMENU:=Version Control Systems
+endef
+
+define Package/subversion/Default/description
+       Subversion is a free/open-source version control system. That is,
+       Subversion manages files and directories, and the changes made to them,
+       over time. This allows you to recover older versions of your data, or
+       examine the history of how your data changed. In this regard, many
+       people think of a version control system as a sort of time machine.
+endef
+
+define Package/subversion-libs
+  $(call Package/subversion/Default)
+  DEPENDS+=+unixodbc
+  TITLE:=subversion libs
+endef
+
+define Package/subversion-libs/description
+  $(call Package/subversion/Default/description)
+  This package contains the subversion libraries.
+endef
+
+define Package/subversion-client
+  $(call Package/subversion/Default)
+  DEPENDS+=subversion-libs
+  TITLE:=subversion client tools
+endef
+
+define Package/subversion-client/description
+  $(call Package/subversion/Default/description)
+  This package contains the subversion client tools.
+endef
+
+define Package/subversion-server
+  $(call Package/subversion/Default)
+  DEPENDS+=subversion-libs
+  TITLE:=subversion server
+endef
+
+define Package/subversion-server/description
+  $(call Package/subversion/Default/description)
+  This package contains the subversion server.
+endef
+
+define Package/subversion-server/conffiles
+/etc/config/subversion
+endef
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+
+CONFIGURE_ARGS += \
+       --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \
+       --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \
+       --with-neon="$(STAGING_DIR)/usr" \
+       --disable-mod-activation \
+       --without-ruby-sitedir \
+       --without-swig \
+       --with-jikes=no \
+       --without-junit \
+       --without-berkeley-db \
+       --with-ssl \
+       --disable-neon-version-check \
+       --with-apxs=no \
+       --without-sasl \
+
+CONFIGURE_VARS += \
+       svn_lib_neon=yes \
+       LDFLAGS="$(TARGET_LDFLAGS) -lcrypt -lm \
+               -lz -lpthread -L$(TOOLCHAIN_DIR)/usr/lib \
+               -L$(TOOLCHAIN_DIR)/lib" \
+       CPPFLAGS="$(TARGET_CPPFLAGS)" \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all local-install
+endef
+
+define Package/subversion-libs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsvn_*.so.* $(1)/usr/lib/
+endef
+
+define Package/subversion-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{svn,svnversion,svnsync} $(1)/usr/bin/
+endef
+
+define Package/subversion-server/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/svn{look,admin,dumpfilter,serve} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/subversion.config $(1)/etc/config/subversion
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/subversion.init $(1)/etc/init.d/subversion
+endef
+
+$(eval $(call BuildPackage,subversion-libs))
+$(eval $(call BuildPackage,subversion-client))
+$(eval $(call BuildPackage,subversion-server))
diff --git a/net/subversion/files/subversion.config b/net/subversion/files/subversion.config
new file mode 100644 (file)
index 0000000..3297c8d
--- /dev/null
@@ -0,0 +1,3 @@
+config subversion
+       option path     '/var/local/svn'
+       option port     '3690'
diff --git a/net/subversion/files/subversion.init b/net/subversion/files/subversion.init
new file mode 100644 (file)
index 0000000..c2bcc07
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start_instance () {
+       local section="$1"
+       config_get path "$section" 'path'
+       config_get port "$section" 'port'
+
+       if [ ! -d "$path" ]; then
+               echo "The subversion repository (${path}) does not exist."
+               echo "Create a new repository and/or change the path in /etc/config/subversion"
+               echo
+               echo "Create a new subversion repository with:"
+               echo "        mkdir -p /srv"
+               echo "        svnadmin create --fs-type fsfs /srv/svn"
+               echo
+               echo "Changing the path using UCI (default path is: /var/local/svn):"
+               echo "        uci set subversion.@[0].path="/srv/svn""
+               echo "        uci commit"
+               echo "        /etc/init.d/subversion restart"
+               return 1
+       fi
+
+       service_start /usr/bin/svnserve -d --listen-port ${port} -r ${path}
+}
+
+start() {
+       config_load 'subversion'
+       config_foreach start_instance 'subversion'
+}
+
+stop() {
+       SERVICE_SIG_STOP="INT" \
+       service_stop /usr/bin/svnserve
+}
diff --git a/net/synce-dccm/Makefile b/net/synce-dccm/Makefile
new file mode 100644 (file)
index 0000000..73bf4b8
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2008-2010 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:=synce-dccm
+PKG_VERSION:=0.9.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/synce
+PKG_MD5SUM:=8818b71133049fe9c739166225aebe0c
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/synce-dccm
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libsynce $(ICONV_DEPENDS)
+  TITLE:=dccm for mobiles
+  URL:=http://sourceforge.net/projects/synce/
+endef
+
+define Package/synce-dccm/description
+Description TBD
+endef
+
+CONFIGURE_VARS+= \
+       CPPFLAGS="$$$$CPPFLAGS -I$(ICONV_PREFIX)/include" \
+       CPPFLAGS="$$$$CPPFLAGS -I$(INTL_PREFIX)/include" \
+       CPPFLAGS="$$$$CPPFLAGS -Wl,-rpath-link,$(STAGING_DIR)/usr/lib:$(ICONV_PREFIX)/lib:$(INTL_PREFIX)/lib"
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               LDFLAGS="$(TARGET_LDFLAGS) -L$(ICONV_PREFIX)/lib" \
+               LIBS="-lsynce -liconv" \
+               all install
+endef
+
+define Package/synce-dccm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dccm $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,synce-dccm))
+#LIBS="-Wl,-Bstatic,-lsynce,-Bdynamic,-liconv" \
diff --git a/net/tcptraceroute/Makefile b/net/tcptraceroute/Makefile
new file mode 100644 (file)
index 0000000..1a862b5
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006 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:=tcptraceroute
+PKG_VERSION:=1.5beta7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://michael.toren.net/code/tcptraceroute
+PKG_MD5SUM:=65d1001509f971ea986fcbc2dd009643
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tcptraceroute
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcap +libnet1
+  TITLE:=A traceroute implementation using TCP packets.
+  URL:=http://michael.toren.net/code/tcptraceroute/
+endef
+
+define Build/Configure
+        $(call Build/Configure/Default, \
+               , \
+               CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/lib/libnet-1.1.x/include" \
+               LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib/libnet-1.1.x/lib" \
+               PATH="$(STAGING_DIR)/usr/lib/libnet-1.1.x/bin:$$$$PATH" \
+        )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/tcptraceroute/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tcptraceroute $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,tcptraceroute))
diff --git a/net/tcptraceroute/patches/001-configure_cross_compile.patch b/net/tcptraceroute/patches/001-configure_cross_compile.patch
new file mode 100644 (file)
index 0000000..5690a23
--- /dev/null
@@ -0,0 +1,62 @@
+--- tcptraceroute-1.5beta7.orig/configure      2006-03-29 02:49:55.000000000 +0100
++++ tcptraceroute-1.5beta7/configure   2007-03-19 19:13:31.644193395 +0000
+@@ -5484,11 +5484,11 @@
+ echo "$as_me:$LINENO: checking for Solaris" >&5
+ echo $ECHO_N "checking for Solaris... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
++  { { echo "$as_me:$LINENO: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
++echo "$as_me: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -5551,11 +5551,11 @@
+ echo "$as_me:$LINENO: checking for BSDI" >&5
+ echo $ECHO_N "checking for BSDI... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
++  { { echo "$as_me:$LINENO: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
++echo "$as_me: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -5618,11 +5618,11 @@
+ echo "$as_me:$LINENO: checking for NetBSD" >&5
+ echo $ECHO_N "checking for NetBSD... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
++  { { echo "$as_me:$LINENO: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
++echo "$as_me: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -5685,11 +5685,11 @@
+ echo "$as_me:$LINENO: checking for MacOS X" >&5
+ echo $ECHO_N "checking for MacOS X... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
++  { { echo "$as_me:$LINENO: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
++echo "$as_me: warning: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
diff --git a/net/tctool/Makefile b/net/tctool/Makefile
new file mode 100644 (file)
index 0000000..6520569
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2008-2014 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:=tctool
+PKG_VERSION:=0.9.7
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
+PKG_SOURCE_URL:=http://download2.berlios.de/speedmodem50b
+PKG_MD5SUM:=df38334206d4cad106e58bd71c6f1d9a
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tctool
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=TrendChip-Modem-Utility
+  URL:=http://speedmodem50b.berlios.de/
+  DEPENDS:=+libstdcpp
+endef
+
+define Package/tctool/description
+ tcTool provides access to the console-service of TrendChip-based
+ ADSL-Modems.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               $(TARGET_CONFIGURE_OPTS) \
+               CXXFLAGS="$(TARGET_CXXFLAGS)" \
+               tctool
+endef
+
+define Package/tctool/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/tctool $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,tctool))
diff --git a/net/tctool/patches/001_Makefile_fix.diff b/net/tctool/patches/001_Makefile_fix.diff
new file mode 100644 (file)
index 0000000..8677c4e
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -31,16 +31,16 @@ MAINOBJ  := if.o interface.o etherStream
+ EXAMPLE  := example
+ EXOBJ    := if.o interface.o etherStream.o etherStreambuf.o tcStream.o tcStreambuf.o tcRtsDump.o tcRtsDumpbuf.o
+-CXX        := g++
+-CXXFLAGS   := -march=i386 -O2
+-LDFLAGS    := --strip-unneeded
+-LIBS       := 
+-LDSTATIC   := -L. -static-libgcc
+-STATICLIBS := stdc++ m
+-COUNTRY    := "C"
+-LANG       := "C"
+-LANGUAGE   := "C"
+-LC_ALL     := "C"
++#CXX        := g++
++#CXXFLAGS   := -march=i386 -O2
++#LDFLAGS    := --strip-unneeded
++#LIBS       := 
++#LDSTATIC   := -L. -static-libgcc
++#STATICLIBS := stdc++ m
++#COUNTRY    := "C"
++#LANG       := "C"
++#LANGUAGE   := "C"
++#LC_ALL     := "C"
+ default: install
diff --git a/net/tctool/patches/005-fix-gcc_4_3-compile.patch b/net/tctool/patches/005-fix-gcc_4_3-compile.patch
new file mode 100644 (file)
index 0000000..3abe592
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/tctool.cpp
++++ b/src/tctool.cpp
+@@ -33,6 +33,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <signal.h>
++#include <cstdlib>
+ std::string                      options = "I:m:i:r:t:p:c:MUdsSCRh";
+ std::string                      ethDev  = "eth0";
diff --git a/net/tctool/patches/006-fix_close_declaration.patch b/net/tctool/patches/006-fix_close_declaration.patch
new file mode 100644 (file)
index 0000000..387b474
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/etherStreambuf.cpp
++++ b/src/etherStreambuf.cpp
+@@ -28,6 +28,7 @@
+ #include "etherStreambuf.h"
+ #include <stdio.h>
++#include <unistd.h>
+ namespace tc {
+    etherStreambuf::etherStreambuf() {
+--- a/src/tcStreambuf.cpp
++++ b/src/tcStreambuf.cpp
+@@ -30,6 +30,7 @@
+ // this is for the udp-part...
+ #include <netdb.h>         // gethostbyname hostent
+ #include <arpa/inet.h>     // inet_ntoa
++#include <unistd.h>
+ namespace tc {
+    char tcStreambuf::tcPktType::confirmation(char pktType) {
diff --git a/net/tftp-hpa/Makefile b/net/tftp-hpa/Makefile
new file mode 100644 (file)
index 0000000..45f246f
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# 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:=tftp-hpa
+PKG_VERSION:=0.48
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@KERNEL/software/network/tftp
+PKG_MD5SUM:=73dd29dfa9062a174163f6a267e0b5f7
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tftp-hpa/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  DEPENDS:=+libreadline
+  URL:=http://www.kernel.org/pub/software/network/tftp
+endef
+
+define Package/tftp-hpa
+  $(call Package/tftp-hpa/Default)
+  TITLE:=An enhanced version of the BSD TFTP client
+endef
+
+define Package/tftpd-hpa
+  $(call Package/tftp-hpa/Default)
+  TITLE:=An enhanced version of the BSD TFTP server
+endef
+
+define Build/Configure 
+       $(call Build/Configure/Default, \
+               --without-tcpwrappers, \
+               CFLAGS="$$$$CFLAGS $$$$CPPFLAGS" \
+       )
+endef
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/tftp-hpa/install        
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tftp/tftp $(1)/usr/bin/tftp-hpa
+endef
+
+define Package/tftpd-hpa/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tftpd/tftpd $(1)/usr/sbin/tftpd-hpa
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tftpd-hpa.init $(1)/etc/init.d/tftpd-hpa
+endef
+
+$(eval $(call BuildPackage,tftp-hpa))
+$(eval $(call BuildPackage,tftpd-hpa))
diff --git a/net/tftp-hpa/files/tftpd-hpa.init b/net/tftp-hpa/files/tftpd-hpa.init
new file mode 100644 (file)
index 0000000..c3432ed
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       mkdir -m 0755 -p /var/tftpd-hpa
+       service_start /usr/sbin/tftpd-hpa -l -s /var/tftpd-hpa
+}
+
+stop() {
+       service_stop /usr/sbin/tftpd-hpa
+}
diff --git a/net/tig/Makefile b/net/tig/Makefile
new file mode 100644 (file)
index 0000000..deb3339
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tig
+PKG_VERSION:=1.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=tig-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://jonas.nitro.dk/tig/releases/
+PKG_MD5SUM:=d5c1dd1d829f8e515f59c96a5d419323
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/tig-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=libncurses libiconv
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/tig
+       SECTION:=devel
+       CATEGORY:=Development
+       TITLE:=Console Git repository viewer
+       DEPENDS:=+git +libncursesw
+       URL:=http://jonas.nitro.dk/tig/releases/
+endef
+
+define Package/tig/description
+       Tig is a git repository browser that additionally can act as a pager for output
+       from various git commands.
+endef
+
+CONFIGURE_ARGS+= \
+       --with-libiconv="$(ICONV_PREFIX)"
+
+define Package/tig/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tig $(1)/usr/bin/tig
+endef
+
+$(eval $(call BuildPackage,tig))
diff --git a/net/tinc/Makefile b/net/tinc/Makefile
new file mode 100644 (file)
index 0000000..646c906
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007-2013 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:=tinc
+PKG_VERSION:=1.0.23
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.tinc-vpn.org/packages
+PKG_MD5SUM:=762c0d47bdf1b33a40b19165d9c2761f
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tinc
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+liblzo +libopenssl +kmod-tun
+  TITLE:=VPN tunneling daemon
+  URL:=http://www.tinc-vpn.org/
+  SUBMENU:=VPN
+endef
+
+define Package/tinc/description
+  tinc is a Virtual Private Network (VPN) daemon that uses tunnelling and
+  encryption to create a secure private network between hosts on the Internet.
+endef
+
+TARGET_CFLAGS += -std=gnu99
+
+CONFIGURE_ARGS += \
+       --with-kernel="$(LINUX_DIR)" \
+       --with-zlib="$(STAGING_DIR)/usr" \
+       --with-lzo-include="$(STAGING_DIR)/usr/include/lzo"
+
+define Package/tinc/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/tincd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/tinc
+       $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
+       $(INSTALL_DATA) files/tinc.upgrade $(1)/lib/upgrade/keep.d/tinc
+endef
+
+define Package/tinc/conffiles
+/etc/config/tinc
+endef
+
+$(eval $(call BuildPackage,tinc))
diff --git a/net/tinc/files/tinc.config b/net/tinc/files/tinc.config
new file mode 100644 (file)
index 0000000..1894078
--- /dev/null
@@ -0,0 +1,56 @@
+config tinc-net NETNAME
+       option enabled 0
+
+       ## Daemon Configuration (cmd arguments)
+       #option generate_keys 0
+       #option key_size 2048
+       #option logfile /tmp/log/tinc.NETNAME.log
+       #option debug 3
+
+       ## Server Configuration (tinc.conf)
+       #option AddressFamily any
+       #option BindToAddress 127.0.0.1
+       #option BindToInterface lo
+
+       #list ConnectTo peer1
+
+       #option DirectOnly 0
+       #option Forwarding internal
+       #option GraphDumpFile /tmp/log/tinc.NETNAME.dot
+       #option Hostnames 0
+       #option IffOneQueue 0
+       #option Interface NETNAME
+       #option KeyExpire 3600
+       #option MACExpire 600
+       #option MaxTimeout 900
+       #option Mode router
+
+       option Name NODENAME
+
+       #option PingInterval 60
+       #option PingTimeout 5
+       #option PriorityInheritance 0
+       #option PrivateKeyFile /etc/tinc/NETNAME/rsa_key.priv
+       #option ProcessPriority normal
+       #option ReplayWindow 16
+       #option StrictSubnets 0
+       #option TunnelServer 0
+       #option UDPRcvBuf x
+       #option UDPSndBuf x
+
+config tinc-host NODENAME
+       option enabled 0
+
+       option net NETNAME
+
+       #list Address example.com
+       #option Cipher blowfish
+       #option ClampMSS yes
+       #option Compression 0
+       #option Digest sha1
+       #option IndirectData 0
+       #option MACLength 4
+       #option PMTU 1514
+       #option PMTUDiscovery yes
+       #option Port 655
+       #option Subnet 192.168.1.0/24
diff --git a/net/tinc/files/tinc.init b/net/tinc/files/tinc.init
new file mode 100644 (file)
index 0000000..b24bc68
--- /dev/null
@@ -0,0 +1,241 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+# Copyright (C) 2011 Linus Lüssing
+#  Based on Jo-Philipp Wich's OpenVPN init script
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+START=42
+
+SERVICE_USE_PID=1
+
+BIN=/usr/sbin/tincd
+EXTRA_COMMANDS="up down"
+
+LIST_SEP="
+"
+TMP_TINC="/tmp/tinc"
+
+append_param() {
+       local v="$1"
+       case "$v" in
+               *_*_*_*) v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;;
+               *_*_*)   v=${v%%_*}-${v#*_}; v=${v%%_*}-${v#*_} ;;
+               *_*)     v=${v%%_*}-${v#*_} ;;
+       esac
+       ARGS="$ARGS --$v"
+       return 0
+}
+
+append_conf_bools() {
+       local p; local v; local s="$1"; local f="$2"; shift; shift
+       for p in $*; do
+               config_get_bool v "$s" "$p"
+               [ "$v" == 1 ] && echo "$p = yes" >> "$f"
+               [ "$v" == 0 ] && echo "$p = no" >> "$f"
+       done
+}
+
+append_params() {
+       local p; local v; local s="$1"; shift
+       for p in $*; do
+               config_get v "$s" "$p"
+               IFS="$LIST_SEP"
+               for v in $v; do
+                       [ -n "$v" ] && append_param "$p" && ARGS="$ARGS=$v"
+               done
+               unset IFS
+       done
+}
+
+append_conf_params() {
+       local p; local v; local s="$1"; local f="$2"; shift; shift
+       for p in $*; do
+               config_get v "$s" "$p"
+               IFS="$LIST_SEP"
+               for v in $v; do
+                       # Look up OpenWRT interface names
+                       [ "$p" = "BindToInterface" ] && {
+                               local ifname=$(uci -P /var/state get network.$v.ifname 2>&-)
+                               [ -n "$ifname" ] && v="$ifname"
+                       }
+
+                       [ -n "$v" ] && echo "$p = $v" >> "$f"
+               done
+               unset IFS
+       done
+}
+
+section_enabled() {
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+prepare_host() {
+       local s="$1"
+       local n
+
+       # net disabled?
+       config_get n "$s" net
+       section_enabled "$n" || return 1
+
+       if [ "$#" = "2" ]; then
+               [ "$2" != "$n" ] && return 1
+       fi
+
+       # host disabled?
+       section_enabled "$s" || {
+               [ -f "$TMP_TINC/$n/hosts/$s" ] && rm "$TMP_TINC/$n/hosts/$s"
+               return 1
+       }
+
+       [ ! -f "/etc/tinc/$n/hosts/$s" ] && {
+               echo -n "tinc: Warning, public key for $s for network $n "
+               echo -n "missing in /etc/tinc/$n/hosts/$s, "
+               echo "skipping configuration of $s"
+               return 1
+       }
+
+       # append flags
+       append_conf_bools "$s" "$TMP_TINC/$n/hosts/$s" \
+               ClampMSS IndirectData PMTUDiscovery TCPOnly
+
+       # append params
+       append_conf_params "$s" "$TMP_TINC/$n/hosts/$s" \
+               Address Cipher Compression Digest MACLength PMTU \
+               Port PublicKey PublicKeyFile Subnet
+}
+
+check_gen_own_key() {
+       local s="$1"; local n; local k
+
+       config_get n "$s" Name
+       config_get_bool k "$s" generate_keys 0
+       [ "$k" == 0 ] && return 0
+
+       ([ -z "$n" ] || [ -f "$TMP_TINC/$s/hosts/$n" ] || [ -f "$TMP_TINC/$s/rsa_key.priv" ]) && \
+               return 0
+       [ ! -d "$TMP_TINC/$s/hosts" ] && mkdir -p "$TMP_TINC/$s/hosts"
+
+       config_get k "$s" key_size
+       if [ -z "$k" ]; then
+               $BIN -c "$TMP_TINC/$s" --generate-keys </dev/null
+       else
+               $BIN -c "$TMP_TINC/$s" "--generate-keys=$k" </dev/null
+       fi
+
+       [ ! -d "/etc/tinc/$s/hosts" ] && mkdir -p "/etc/tinc/$s/hosts"
+       cp "$TMP_TINC/$s/rsa_key.priv" "/etc/tinc/$s/"
+       [ -n "$n" ] && cp "$TMP_TINC/$s/hosts/$n" "/etc/tinc/$s/hosts/"
+}
+
+prepare_net() {
+       local s="$1"
+       local n
+
+       section_enabled "$s" || return 1
+
+        # rm old config
+        rm -rf "$TMP_TINC/$s/"
+
+       [ ! -d "$TMP_TINC/$s" ] && mkdir -p "$TMP_TINC/$s"
+       [ -d "/etc/tinc/$s" ] && cp -r "/etc/tinc/$s" "$TMP_TINC/"
+
+       # append flags
+       append_conf_bools "$s" "$TMP_TINC/$s/tinc.conf" \
+               DecrementTTL DirectOnly Hostnames IffOneQueue \
+               LocalDiscovery PriorityInheritance StrictSubnets TunnelServer \
+               ClampMSS IndirectData PMTUDiscovery TCPOnly
+
+       # append params
+       append_conf_params "$s" "$TMP_TINC/$s/tinc.conf" \
+               AddressFamily BindToAddress ConnectTo BindToInterface \
+               Broadcast Device DeviceType Forwarding \
+               GraphDumpFile Interface KeyExpire MACExpire \
+               MaxTimeout Mode Name PingInterval PingTimeout \
+               PrivateKey PrivateKeyFile ProcessPriority ReplayWindow \
+               UDPRcvBuf UDPSndBuf \
+               Address Cipher Compression Digest MACLength PMTU \
+               Port PublicKey PublicKeyFile Subnet
+
+       check_gen_own_key "$s" && return 0
+}
+
+start_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       ARGS=""
+
+       # append params
+       append_params "$s" logfile debug
+
+       SERVICE_PID_FILE="/var/run/tinc.$s.pid"
+       service_start $BIN -c "$TMP_TINC/$s" -n $s $ARGS --pidfile="$SERVICE_PID_FILE"
+}
+
+stop_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       SERVICE_PID_FILE="/var/run/tinc.$s.pid"
+       service_stop $BIN
+       # rm old config
+       rm -rf "$TMP_TINC/$s/"
+}
+
+reload_instance() {
+       local s="$1"
+
+       section_enabled "$s" || return 1
+
+       SERVICE_PID_FILE="/var/run/tinc.$s.pid"
+       service_reload $BIN
+}
+
+start() {
+       config_load 'tinc'
+
+       config_foreach prepare_net 'tinc-net'
+       config_foreach prepare_host 'tinc-host'
+
+       config_foreach start_instance 'tinc-net'
+}
+
+stop() {
+       config_load 'tinc'
+       config_foreach stop_instance 'tinc-net'
+}
+
+reload() {
+       config_load 'tinc'
+       config_foreach reload_instance 'tinc-net'
+}
+
+up() {
+       local exists
+       local instance
+       config_load 'tinc'
+       for instance in "$@"; do
+               config_get exists "$instance" 'TYPE'
+               if [ "$exists" == "tinc-net" ]; then
+                       prepare_net "$instance"
+                       config_foreach prepare_host 'tinc-host' "$instance"
+                       start_instance "$instance"
+               fi
+       done
+}
+
+down() {
+       local exists
+       local instance
+       config_load 'tinc'
+       for instance in "$@"; do
+               config_get exists "$instance" 'TYPE'
+               if [ "$exists" == "tinc-net" ]; then
+                       stop_instance "$instance"
+               fi
+       done
+}
diff --git a/net/tinc/files/tinc.upgrade b/net/tinc/files/tinc.upgrade
new file mode 100644 (file)
index 0000000..13f5d80
--- /dev/null
@@ -0,0 +1 @@
+/etc/tinc/
diff --git a/net/tmsnc/Makefile b/net/tmsnc/Makefile
new file mode 100644 (file)
index 0000000..b7b25fc
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2006 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:=tmsnc
+PKG_VERSION:=0.3.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/tmsnc
+PKG_MD5SUM:=337dae91d4775e03b6681f61db56d2a7
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tmsnc
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses +libopenssl +libpthread
+  TITLE:=text-based MSN client
+  URL:=http://tmsnc.sourceforge.net
+endef
+
+define Package/tmsnc/description
+       TMSNC is a textbased (console) MSN client written in C.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-rpath \
+               --with-openssl="$(STAGING_DIR)/usr" \
+               --with-ncurses="$(STAGING_DIR)/usr" \
+               --without-libiconv-prefix \
+       )
+endef
+
+define Package/tmsnc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tmsnc $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,tmsnc))
diff --git a/net/tor-alpha/Makefile b/net/tor-alpha/Makefile
new file mode 100644 (file)
index 0000000..89ccc14
--- /dev/null
@@ -0,0 +1,122 @@
+#
+# Copyright (C) 2008-2014 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:=tor-alpha
+PKG_VERSION:=0.2.5.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=tor-$(PKG_VERSION)-alpha.tar.gz
+PKG_SOURCE_URL:=https://www.torproject.org/dist \
+       https://archive.torproject.org/tor-package-archive \
+       http://tor.mirror.tn/dist
+PKG_MD5SUM:=c913735a3527fec3e9bacf3a1e1a70bf
+
+PKG_BUILD_DEPENDS:=libminiupnpc libnatpmp
+PKG_BUILD_DIR:=$(BUILD_DIR)/tor-$(PKG_VERSION)-alpha
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tor-alpha/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=https://www.torproject.org/
+endef
+
+define Package/tor-alpha/Default/description
+ Tor is a toolset for a wide range of organizations and people that want to
+ improve their safety and security on the Internet. Using Tor can help you
+ anonymize web browsing and publishing, instant messaging, IRC, SSH, and
+ more. Tor also provides a platform on which software developers can build
+ new applications with built-in anonymity, safety, and privacy features.
+endef
+
+define Package/tor-alpha
+$(call Package/tor-alpha/Default)
+  TITLE:=An anonymous Internet communication system
+  DEPENDS:=+libevent2 +libopenssl +libpthread +librt +SSP_SUPPORT:libssp
+endef
+
+define Package/tor-alpha/description
+$(call Package/tor-alpha/Default/description)
+ This package contains the tor daemon.
+endef
+
+define Package/tor-alpha-fw-helper
+$(call Package/tor-alpha/Default)
+  TITLE:=Firewall helper for tor
+  DEPENDS:=+tor-alpha +libminiupnpc +libnatpmp
+endef
+
+define Package/tor-alpha-fw-helper/description
+$(call Package/tor-alpha/Default/description)
+ This package contains a helper for automatically configuring port forwarding.
+endef
+
+define Package/tor-alpha-geoip
+$(call Package/tor-alpha/Default)
+  TITLE:=GeoIP db for tor
+  DEPENDS:=+tor-alpha
+endef
+
+define Package/tor-alpha-geoip/description
+$(call Package/tor-alpha/Default/description)
+ This package contains a GeoIP database mapping IP addresses to countries.
+endef
+
+define Package/tor-alpha/conffiles
+/etc/tor/torrc
+endef
+
+CONFIGURE_ARGS += \
+       --with-libevent-dir="$(STAGING_DIR)/usr" \
+       --with-ssl-dir="$(STAGING_DIR)/usr" \
+       --enable-upnp \
+       --with-libminiupnpc-dir="$(STAGING_DIR)/usr" \
+       --enable-nat-pmp \
+       --with-libnatpmp-dir="$(STAGING_DIR)/usr" \
+       --disable-asciidoc \
+       --disable-threads
+
+ifneq ($(CONFIG_SSP_SUPPORT),y)
+       CONFIGURE_ARGS += \
+               --disable-gcc-hardening
+       MAKE_FLAGS += \
+               CFLAGS="$(TARGET_CFLAGS)"
+else
+       MAKE_FLAGS += \
+               CFLAGS="$(TARGET_CFLAGS) -fPIC"
+
+endif
+
+CONFIGURE_VARS += \
+       CROSS_COMPILE="yes"
+
+define Package/tor-alpha/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
+       $(INSTALL_DIR) $(1)/etc/tor
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
+endef
+
+define Package/tor-alpha-fw-helper/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-fw-helper $(1)/usr/bin/
+endef
+
+define Package/tor-alpha-geoip/install
+       $(INSTALL_DIR) $(1)/usr/share/tor
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
+endef
+
+$(eval $(call BuildPackage,tor-alpha))
+$(eval $(call BuildPackage,tor-alpha-fw-helper))
+$(eval $(call BuildPackage,tor-alpha-geoip))
diff --git a/net/tor-alpha/files/tor.init b/net/tor-alpha/files/tor.init
new file mode 100644 (file)
index 0000000..8d11089
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+STOP=50
+
+SERVICE_USE_PID=1
+
+start() {
+       user_exists tor 52 || user_add tor 52 52 /var/lib/tor
+       group_exists tor 52 || group_add tor 52
+       [ -f /var/run/tor.pid ] || {
+               touch /var/run/tor.pid
+               chown tor:tor /var/run/tor.pid
+       }
+       [ -d /var/lib/tor ] || {
+               mkdir -m 0755 -p /var/lib/tor
+               chmod 0700 /var/lib/tor
+               chown tor:tor /var/lib/tor
+       }
+       [ -d /var/log/tor ] || {
+               mkdir -m 0755 -p /var/log/tor
+               chown tor:tor /var/log/tor
+       }
+       service_start /usr/sbin/tor --PidFile /var/run/tor.pid
+}
+
+stop() {
+       service_stop /usr/sbin/tor
+}
diff --git a/net/tor-alpha/patches/001-torrc.patch b/net/tor-alpha/patches/001-torrc.patch
new file mode 100644 (file)
index 0000000..e295219
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/src/config/torrc.sample.in
++++ b/src/config/torrc.sample.in
+@@ -45,11 +45,11 @@
+ ## Uncomment this to start the process in the background... or use
+ ## --runasdaemon 1 on the command line. This is ignored on Windows;
+ ## see the FAQ entry if you want Tor to run as an NT service.
+-#RunAsDaemon 1
++RunAsDaemon 1
+ ## The directory for keeping all the keys/etc. By default, we store
+ ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
+-#DataDirectory @LOCALSTATEDIR@/lib/tor
++DataDirectory @LOCALSTATEDIR@/lib/tor
+ ## The port on which Tor will listen for local connections from Tor
+ ## controller applications, as documented in control-spec.txt.
+@@ -190,3 +190,4 @@
+ ## address manually to your friends, uncomment this line:
+ #PublishServerDescriptor 0
++User tor
diff --git a/net/tor/Makefile b/net/tor/Makefile
new file mode 100644 (file)
index 0000000..e300529
--- /dev/null
@@ -0,0 +1,118 @@
+#
+# Copyright (C) 2008-2014 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:=tor
+PKG_VERSION:=0.2.4.22
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://www.torproject.org/dist \
+       https://archive.torproject.org/tor-package-archive
+PKG_MD5SUM:=5a7eee0d9df87233255d78b25c6f8270
+
+PKG_BUILD_DEPENDS:=libminiupnpc libnatpmp
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tor/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=https://www.torproject.org/
+endef
+
+define Package/tor/Default/description
+ Tor is a toolset for a wide range of organizations and people that want to
+ improve their safety and security on the Internet. Using Tor can help you
+ anonymize web browsing and publishing, instant messaging, IRC, SSH, and
+ more. Tor also provides a platform on which software developers can build
+ new applications with built-in anonymity, safety, and privacy features.
+endef
+
+define Package/tor
+$(call Package/tor/Default)
+  TITLE:=An anonymous Internet communication system
+  DEPENDS:=+libevent2 +libopenssl +libpthread +librt +SSP_SUPPORT:libssp
+endef
+
+define Package/tor/description
+$(call Package/tor/Default/description)
+ This package contains the tor daemon.
+endef
+
+define Package/tor-fw-helper
+$(call Package/tor/Default)
+  TITLE:=Firewall helper for tor
+  DEPENDS:=+tor +libminiupnpc +libnatpmp
+endef
+
+define Package/tor-fw-helper/description
+$(call Package/tor/Default/description)
+ This package contains a helper for automatically configuring port forwarding.
+endef
+
+define Package/tor-geoip
+$(call Package/tor/Default)
+  TITLE:=GeoIP db for tor
+  DEPENDS:=+tor
+endef
+
+define Package/tor-geoip/description
+$(call Package/tor/Default/description)
+ This package contains a GeoIP database mapping IP addresses to countries.
+endef
+
+define Package/tor/conffiles
+/etc/tor/torrc
+endef
+
+CONFIGURE_ARGS += \
+       --with-libevent-dir="$(STAGING_DIR)/usr" \
+       --with-ssl-dir="$(STAGING_DIR)/usr" \
+       --enable-upnp \
+       --with-libminiupnpc-dir="$(STAGING_DIR)/usr" \
+       --enable-nat-pmp \
+       --with-libnatpmp-dir="$(STAGING_DIR)/usr" \
+       --disable-asciidoc
+
+ifneq ($(CONFIG_SSP_SUPPORT),y)
+       CONFIGURE_ARGS += \
+               --disable-gcc-hardening
+       MAKE_FLAGS += \
+               CFLAGS="$(TARGET_CFLAGS)"
+else
+       MAKE_FLAGS += \
+               CFLAGS="$(TARGET_CFLAGS) -fPIC" 
+endif
+
+CONFIGURE_VARS += \
+       CROSS_COMPILE="yes"
+
+define Package/tor/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
+       $(INSTALL_DIR) $(1)/etc/tor
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
+endef
+
+define Package/tor-fw-helper/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-fw-helper $(1)/usr/bin/
+endef
+
+define Package/tor-geoip/install
+       $(INSTALL_DIR) $(1)/usr/share/tor
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
+endef
+
+$(eval $(call BuildPackage,tor))
+$(eval $(call BuildPackage,tor-fw-helper))
+$(eval $(call BuildPackage,tor-geoip))
diff --git a/net/tor/files/tor.init b/net/tor/files/tor.init
new file mode 100644 (file)
index 0000000..7c548b4
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+STOP=50
+
+USE_PROCD=1
+
+start_service() {
+       user_exists tor 52 || user_add tor 52 52 /var/lib/tor
+       group_exists tor 52 || group_add tor 52
+       [ -f /var/run/tor.pid ] || {
+               touch /var/run/tor.pid
+               chown tor:tor /var/run/tor.pid
+       }
+       [ -d /var/lib/tor ] || {
+               mkdir -m 0755 -p /var/lib/tor
+               chmod 0700 /var/lib/tor
+               chown tor:tor /var/lib/tor
+       }
+       [ -d /var/log/tor ] || {
+               mkdir -m 0755 -p /var/log/tor
+               chown tor:tor /var/log/tor
+       }
+       procd_open_instance
+       procd_set_param command /usr/sbin/tor --runasdaemon 0
+       procd_close_instance
+}
diff --git a/net/tor/patches/001-torrc.patch b/net/tor/patches/001-torrc.patch
new file mode 100644 (file)
index 0000000..988cb8e
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/src/config/torrc.sample.in
++++ b/src/config/torrc.sample.in
+@@ -45,11 +45,11 @@
+ ## Uncomment this to start the process in the background... or use
+ ## --runasdaemon 1 on the command line. This is ignored on Windows;
+ ## see the FAQ entry if you want Tor to run as an NT service.
+-#RunAsDaemon 1
++RunAsDaemon 1
+ ## The directory for keeping all the keys/etc. By default, we store
+ ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
+-#DataDirectory @LOCALSTATEDIR@/lib/tor
++DataDirectory @LOCALSTATEDIR@/lib/tor
+ ## The port on which Tor will listen for local connections from Tor
+ ## controller applications, as documented in control-spec.txt.
+@@ -187,3 +187,4 @@
+ ## address manually to your friends, uncomment this line:
+ #PublishServerDescriptor 0
++User tor
diff --git a/net/transocks/Makefile b/net/transocks/Makefile
new file mode 100644 (file)
index 0000000..6e2cf14
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 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:=transocks
+PKG_VERSION:=1.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=:pserver:anonymous@transocks.cvs.sourceforge.net:/cvsroot/transocks
+PKG_SOURCE_SUBDIR:=transocks
+PKG_SOURCE_VERSION:=-DNOW
+PKG_SOURCE_PROTO:=cvs
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xf -
+
+define Build/Compile
+       $(TARGET_CC) \
+               -I$(STAGING_DIR)/usr/include \
+               $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
+               $(LIBRPC) -lsocks -o \
+               $(PKG_BUILD_DIR)/transocks \
+               $(PKG_BUILD_DIR)/transocks.c
+endef
+
+define Package/transocks
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=Transparent SOCKSifying proxy
+  DEPENDS:=+libsocks $(LIBRPC_DEPENDS)
+endef
+
+define Package/transocks/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/transocks $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,transocks))
diff --git a/net/tsocks/Makefile b/net/tsocks/Makefile
new file mode 100644 (file)
index 0000000..305fc36
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2007 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:=tsocks
+PKG_VERSION:=1.8
+PKG_RELEASE:=1
+PKG_MD5SUM:=51caefd77e5d440d0bbd6443db4fc0f8
+
+PKG_SOURCE_URL:=@SF/tsocks
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)beta5.tar.gz
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tsocks
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=Transparent SOCKS v4 proxying library
+  URL:=http://tsocks.sourceforge.net/
+endef
+
+define Package/tsocks/description
+Transparent SOCKS v4 proxying library
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default,\
+                  --with-conf=/etc/tsocks.conf \
+       )
+endef
+
+define Package/tsocks/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tsocks $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/lib/libtsocks.so{,*} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,tsocks))
diff --git a/net/tsocks/patches/100-no_static.patch b/net/tsocks/patches/100-no_static.patch
new file mode 100644 (file)
index 0000000..1a9afb4
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -47,7 +47,7 @@
+       ${SHCC} ${CFLAGS} ${INCLUDES} -o ${INSPECT} ${INSPECT}.c ${COMMON}.o ${LIBS} 
+ ${SAVE}: ${SAVE}.c
+-      ${SHCC} ${CFLAGS} ${INCLUDES} -static -o ${SAVE} ${SAVE}.c
++      ${SHCC} ${CFLAGS} ${INCLUDES} -o ${SAVE} ${SAVE}.c
+ ${SHLIB}: ${OBJS} ${COMMON}.o ${PARSER}.o
+       ${SHCC} ${CFLAGS} ${INCLUDES} -nostdlib -shared -o ${SHLIB} ${OBJS} ${COMMON}.o ${PARSER}.o ${DYNLIB_FLAGS} ${SPECIALLIBS} ${LIBS}
diff --git a/net/tstat/Makefile b/net/tstat/Makefile
new file mode 100644 (file)
index 0000000..bcc5d66
--- /dev/null
@@ -0,0 +1,41 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tstat
+PKG_REV:=528
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://tstat.polito.it/svn/software/tstat/trunk
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=svn
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_BUILD_DEPENDS:=libpcap libpthread
+
+define Package/tstat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=TCP STatistic and Analysis Tool from POLITO
+  URL:=http://tstat.tlc.polito.it
+  DEPENDS:=+libpcap +libpthread +zlib
+  MAINTAINER:=Tivadar Szemethy <tivadar.szemethy@netvisor.hu>
+endef
+
+define Package/tstat/description
+ Tstat is a passive sniffer able to provide several insight on the traffic
+ patterns at both the network and the transport levels.
+endef
+
+define Package/tstat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tstat/tstat $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,tstat))
diff --git a/net/ttcp/Makefile b/net/ttcp/Makefile
new file mode 100644 (file)
index 0000000..3badab6
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2006 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:=ttcp
+PKG_VERSION:=3.8
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/ttcp
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ttcp
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A TCP connection performance tester
+  URL:=https://dev.openwrt.org/browser/packages/net/ttcp/
+endef
+
+define Package/ttcp/description
+       A small utility to test TCP connection performance.
+endef
+
+define Build/Compile           
+       $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/ttcp ttcp.c
+endef
+
+define Package/ttcp/install    
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ttcp $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ttcp))
diff --git a/net/ttcp/ttcp.c b/net/ttcp/ttcp.c
new file mode 100644 (file)
index 0000000..7233ace
--- /dev/null
@@ -0,0 +1,2374 @@
+/*
+ *        T T C P . C
+ *
+ * Test TCP connection.  Makes a connection on port 5010
+ * and transfers fabricated buffers or data copied from stdin.
+ *
+ * Usable on 4.2, 4.3, and 4.1a systems by defining one of
+ * BSD42 BSD43 (BSD41a)
+ * Machines using System V with BSD sockets should define SYSV.
+ *
+ * Modified for operation under 4.2BSD, 18 Dec 84
+ *       T.C. Slattery, USNA
+ * Minor improvements, Mike Muuss and Terry Slattery, 16-Oct-85.
+ * Modified in 1989 at Silicon Graphics, Inc.
+ *        catch SIGPIPE to be able to print stats when receiver has died 
+ *        for tcp, don't look for sentinel during reads to allow small transfers
+ *        increased default buffer size to 8K, nbuf to 2K to transfer 16MB
+ *        moved default port to 5001, beyond IPPORT_USERRESERVED
+ *        make sinkmode default because it is more popular, 
+ *                -s now means don't sink/source 
+ *        count number of read/write system calls to see effects of 
+ *                blocking from full socket buffers
+ *        for tcp, -D option turns off buffered writes (sets TCP_NODELAY sockopt)
+ *        buffer alignment options, -A and -O
+ *        print stats in a format that's a bit easier to use with grep & awk
+ *        for SYSV, mimic BSD routines to use most of the existing timing code
+ * Modified by Steve Miller of the University of Maryland, College Park
+ *        -b sets the socket buffer size (SO_SNDBUF/SO_RCVBUF)
+ * Modified Sept. 1989 at Silicon Graphics, Inc.
+ *        restored -s sense at request of tcs@brl
+ * Modified Oct. 1991 at Silicon Graphics, Inc.
+ *        use getopt(3) for option processing, add -f and -T options.
+ *        SGI IRIX 3.3 and 4.0 releases don't need #define SYSV.
+ *
+ * Modified --> Nov 1996 at CERN (Daniel DAVIDS)
+ *        printout of the Socket-Buffer-Sizes 
+ *        configured for HP-UX 9000 OS        
+ *        configured for Windows NT OS 
+ * Modified Dec 1996 at CERN (Jacques ROCHEZ)
+ *        severe cleanup
+ *        addaptation to the gcc compiler (ANSI)
+ *        configured for Lynx OS 
+ *        automatic format for the rate display (G/M/K/)bytes/sec
+ *        added log (L) and more help (h) options.
+ * Modified May 1997 at CERN (Jacques ROCHEZ) 
+ *        removed the mes() function following err() function.
+ *        changed the default port to 5010
+ * Modified jul 1997 at CERN (Jacques ROCHEZ)
+ *        adapted the timing calculation in microseconds 
+ *        addapted the code for Vsisual C++ under NT4.0 
+ * Modified aug 1997 at CERN (Jacques ROCHEZ)
+ *        initialise to 0 the variables nbytes, numcalls  
+ *        moved the buffer pre-load outside the measured timed area 
+ * Distribution Status -
+ *        Public Domain.  Distribution Unlimited.
+ * Modified jun 1998 at Epigram
+ *        - print hash marks to indicate prograss on transmitting side
+ *        - sleep between bursts of buffers
+ *        - set number of buffers/burst
+ * Modified jul 1998 at Epigram
+ *        - send random size buffers
+ * Modified jan 1999 at Epigram (WES)
+ *        - added start and end patterns to UDP start and end packets
+ *        - added handling of missed start, end, or data packets for UDP tests
+ */
+#ifndef lint
+static char RCSid[] = "ttcp.c $- CERN Revision: 3.8 (dev level) -$";
+#endif
+
+static char VersDate[] = "Epigram 15-jul-98";
+
+/*                system dependent setting
+ *                ------------------------
+ * uname -a,gcc -v a.c are the tools used                              
+ *
+ * Platform/OS          #define         MACRO predefined 
+ * -----------          -------   ---------------------------------------------------
+ * SunOS OS             BSD43     __unix__   __sun__   __sparc__
+ * SUN Solaris           SYSV     __unix__   __sun__   __sparc__   __svr4__ 
+ * SGI-IRIX  < 3.3 SYSV     set as #define sgi
+ * HP-UX 9000           SYSV      __unix__   __hpux__  __hp9k8__
+ * OSF/1 V3.2           SYSV      __unix__   __osf__   __alpha__
+ * OSF/1 V4.0           SYSV      __unix__   __osf__   __alpha__   _CFE
+ * LynxOS               SYSV      __unix__   __lynx__  __powerpc__
+ * Windows NT           SYSV                 __WINNT__ __i386__    __M_COFF__
+ * AIX                  SYSV      _AIX       _AIX32    _POWER      _IBMR2   _ARCH_PWR
+
+ * Micosoft Visual C++ compiler under WindowNT 4.0
+ * Windows NT                    _WINDOWS    WIN32 
+
+ * Unix BSD 41a         BSD41a
+ *          42          BSD42
+ *          43          BSD43
+ * Machines using System V with BSD sockets should define SYSV.
+ *
+ *            Compiler commands 
+ *            -----------------
+ * LynxOS : gcc -c ttcp.c -o ttcp.o | gcc -o ttcp -O ttcp.o -lnetinet -lc_p -lc
+ */
+
+/* -------------attempt to set an automatic UNIX  OS family detection -------*/
+
+#if defined(__hp9k8__) || defined(__osf__) || defined(__srv4__)  
+#define SYSV
+#endif
+#if defined(__lynx__)  
+#define SYSV
+#endif
+/* for solaris (__srv4__) the parameters SYSV is already set */
+
+/* version A.09.01  'key words' differs from A.09.05 A */ 
+#if defined(__hpux)
+#define __hpux__
+#endif
+
+#if defined(__sun__)&&!defined(__srv4__)
+#define BSD43                  /* changed by BSD42 if necessary */
+#endif
+
+#if defined(_WIN32)                /* Window NT 4.0 compiled with VisualC++ 4 */
+#define __NTVIS__
+#define SYSV
+#endif 
+
+#if defined(__FreeBSD__)
+#define BSD43
+#endif
+
+#if defined(__linux__)
+#define BSD43
+#endif
+/*--------------------------------------------------------------------------*/
+
+#if !defined(UNDER_CE)
+#include <signal.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+#endif
+
+#if defined(SYSV)
+
+#if defined(__osf__) 
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <sys/time.h>           /* struct timeval */
+#include <sys/resource.h>       /* definition of struct rusage */    
+
+#else  /* else of __osf__ */ 
+#if defined(__NTVIS__)
+#include <winsock2.h>
+#include <windows.h>            /* required for all Windows applications */
+#include <ws2tcpip.h>
+#include <memory.h>
+#include <time.h>
+#if !defined(UNDER_CE)
+#include <sys\timeb.h> 
+#include <fcntl.h>
+#endif
+#include <stdlib.h>
+#include <io.h>
+struct rusage { struct timeval ru_utime, ru_stime; };
+#define RUSAGE_SELF 0
+#else  /* else of __NTVIS__ */  
+#if defined(__lynx__)
+#include <socket.h>             /* located in  /usr/include/..... */
+#include <netinet/in.h>    
+#include <netinet/tcp.h> 
+#include <arpa/inet.h>     
+#include <netdb.h>         
+#include <time.h> 
+#include <resource.h>           /* definition of struct rusage */    
+#include <sys/times.h>
+#define RUSAGE_SELF 0
+#include <conf.h>               /* definition of TICKSPERSEC (HZ) */
+#include <sys/param.h>     
+
+#else  /* else of __Lynx__  */
+#if defined(__svr4__)
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <sys/time.h>           /* struct timeval */
+#include <sys/resource.h>       /* definition of struct rusage */    
+#include <sys/times.h>
+#define RUSAGE_SELF 0
+#include <sys/param.h>     
+
+#else  /* else of __svr4__    all SYSV cases except those mentionned before */
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <sys/time.h>           /* struct timeval */
+#include <sys/resource.h>       /* definition of struct rusage */    
+#include <sys/times.h>
+#define RUSAGE_SELF 0
+#include <sys/param.h>     
+
+#endif /* __svr4__  */
+#endif /* __lynx__  */
+#endif /* __NTVIS__ */
+#endif /* __osf__   */
+
+#else  /* else of SYSV      it is a BSD OS  */
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#if defined(__linux__)
+#include <time.h>           /* struct timeval */
+#else
+#include <sys/time.h>           /* struct timeval */
+#endif
+#include <sys/resource.h>       /* definition of struct rusage */
+#include <unistd.h>            /* for usleep() - henry */
+#define SOCKET_ERROR   -1
+
+#endif /* SYSV */
+
+#if defined(__NTVIS__)
+
+#if defined(_DEBUG)     /* usual debug symbol for VC++ */
+#define DEBUG 1
+#endif
+
+void usleep(unsigned int microseconds);
+
+#define bcopy(a,b,n) memcpy((b), (a), (n))
+#define bzero(a,n) memset((a), 0, (n))
+
+#ifndef _GETOPT_
+#define _GETOPT_
+int getopt(int argc, char **argv, char *optstring);
+
+extern char *optarg;                // returned arg to go with this option
+extern int optind;                  // index to next argv element to process
+extern int opterr;                  // should error messages be printed?
+extern int optopt;                  //
+
+#define BADCH ('?')
+#endif // _GETOPT
+
+/* get option letter from argument vector  */
+int
+        opterr = 1,                  // should error messages be printed?
+        optind = 1,                  // index into parent argv vector
+        optopt;                      // character checked for validity
+char   *optarg;                      // argument associated with option
+
+#define EMSG        ""
+char *progname;                      // may also be defined elsewhere
+#endif /*__NTVIS__*/
+
+/* sockaddr_in ==  file server address structure 
+ * 
+ * Socket address, internet style.   declared in : /netinet/in.h
+ * struct sockaddr_in {short   sin_family;
+ *                     u_short sin_port;
+ *                     struct  in_addr sin_addr;
+ *                     char    sin_zero[8];
+ *                    };
+ *
+ * Structure used by kernel to store most addresses. declared in ./sys/socket.h
+ * struct sockaddr{u_short sa_family;       address family
+ *                 char    sa_data[14];     up to 14 bytes of direct address 
+ *                };
+ * PS : sin stand for "socket internet number" 
+ */
+
+#ifndef __NTVIS__
+#define FAR
+#endif
+
+#if     defined(__CONST_SOCKADDR_ARG)
+#define SOCKADDR_CAST   (__CONST_SOCKADDR_ARG)
+#elif  defined(__lynx__) || defined(__sun__) || defined(_AIX) || defined(__FreeBSD__) || defined(__NTVIS__)
+#define SOCKADDR_CAST   (struct sockaddr FAR *)
+#else
+#define SOCKADDR_CAST
+#endif
+
+#if defined(__sun__)
+struct sockaddr_in sockaddr;   /* done in ./X11/Xdmcp.h */
+#endif 
+
+struct sockaddr_in sinme;     /* is the socket struct. in the local host */
+struct sockaddr_in sinhim;    /* is the socket struc. in the remote host */
+
+#if defined(__lynx__) || defined(__svr4__) || defined(_AIX) 
+struct sockaddr frominet;
+#else
+struct sockaddr_in frominet;
+#endif /* __lynx__ */
+
+int domain, fromlen;
+
+#if !defined(__NTVIS__)
+#define SOCKET int
+#endif /* __NTVIS__ */
+SOCKET fd;                             /* fd of network socket */
+
+#if !defined(__lynx__)
+extern int errno;
+#endif 
+
+#include <stdio.h>
+
+FILE  *fplog = NULL;                   /* file pointer for the log file */
+char  logfile[100];                    /* file name for the log */
+static char logfile_head[] ="ttcp_log";   /* header  name for the log */
+int   buflen = 8 * 1024;               /* length of buffer */
+char  *buf;                            /* ptr to dynamic buffer */
+int   nbuf = 2 * 1024;                 /* number of buffers to send in sinkmode */
+
+#define START_PKT_LEN 4
+#define START_PATTERN_LEN 4
+#define END_PKT_LEN 8
+#define END_PATTERN_LEN 4
+#define MIN_UDP_LEN 5
+
+char start_pattern[START_PATTERN_LEN] = {1, 2, 3, 4};
+char end_pattern[END_PATTERN_LEN] = {2, 2, 2, 2};
+
+int   bufoffset = 0;                   /* align buffer to this */
+int   bufalign = 16*1024;              /* modulo this */
+
+int   udp = 0;                         /* 0 = tcp, !0 = udp */
+int   options = 0;                     /* socket options */
+int   one = 1;                         /* for 4.3 BSD style setsockopt() */
+short port = 5010;                     /* TCP port number */
+char *host;                            /* ptr to name of host */
+int  rndm = 0;                         /* 0="normal", !0=random data */
+int  trans;                            /* 0=receive, !0=transmit mode */
+int  timeout;                          /* read timeout in millisec */
+int  debug = 0;                        /* 0=No-Debug, 1=Debug-Set-On */
+int  sinkmode = 0;                     /* 0=normal I/O, !0=sink/source mode */
+int  verbose = 0;                      /* 0=print basic info, 1=print cpu rate,
+                                        * proc resource usage. */
+int  nodelay = 0;                      /* set TCP_NODELAY socket option */
+int  pri = 0;                          /* link layer priority */
+int  b_flag = 0;                       /* use mread() */
+int  log_cnt = 0;                      /* append result to a log */
+int  sockbufsize = 0;                  /* socket buffer size to use */
+char fmt = 'A';                        /* output format:
+                                        *  b = bits,     B = bytes,
+                                        *  k = kilobits, K = kilobytes,
+                                        *  m = megabits, M = megabytes, 
+                                        *  g = gigabits, G = gigabytes,
+                                        *  A = automatic Xbytes (default) */
+int  touchdata = 0;                    /* access data after reading */
+int  seq_info = 0;                     /* report out of order seq nums */
+
+int hash = 0;                          /* print hash marks for each buffer */
+int udpsleep = 0;                      /* sleep in between udp buffers */
+int burstn = 1;                        /* number of buffers per burst */
+int bufmin = -1;                       /* minimum buffer size to use when
+                                          sending random-size buffers */
+unsigned int seed = 1;                 /* seed for random number generator
+                                          used for random buffer lengths */
+int no_start = 0;                      /* skip the start frames for UDP */
+int no_data = 0;                       /* skip all data frames for UDP */
+int no_end = 0;                        /* skip the end frames for UDP */
+
+double   nbytes;                       /* bytes on net */
+unsigned long numCalls;                /* # of I/O system calls */
+
+struct hostent *addr;
+extern int optind;
+extern char *optarg;
+
+#if defined(UNDER_CE)
+static int errno;
+static char *weekday[] ={"Sun", "Mon","Tues", "Wed", "Thurs", "Fri", "Sat"};
+static char *month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec"};
+#define perror printf
+#endif
+
+/*--------------------------------------------------------------------------*/
+static struct timeval time0;    /* Time at which timing started */
+static struct timeval time1;
+static struct rusage ru0;       /* Resource utilization at the start */
+static struct rusage ru1;
+static struct tm *tms;        /* system time structure */
+
+
+/*-----------Prototype functions definitions -------------------------------*/
+/*--------------------------------------------------------------------------*/
+
+                                   /* ANSI input/output functions (stdio.h) */
+
+#if defined(__lynx__)
+int  getopt(int, char**, char*);
+int  gettimeofday(struct timeval *tp, struct timezone *tzp);
+
+#else
+#if defined(__svr4__)
+
+#else 
+#if defined(_AIX)
+
+#else
+#if defined(__hpux__)
+#else
+#if defined(__NTVIS__)
+#else 
+#if defined(BSD42) || defined(BSD43)
+#else
+
+int  printf( char*, ...);
+int  fprintf(FILE*,char*, ...);
+void perror(char*);
+int  getopt(int, char**, char*);
+int  gettimeofday(struct timeval *tp, struct timezone *tzp);
+#endif  /* BSD42 || BSD43 */
+#endif  /* __NTVIS__ */
+#endif  /* __hpux__ */
+#endif  /*  _AIX    */
+#endif  /* __svr4__ */
+#endif  /* __lynx__ */ 
+
+int main(int argc, char* argv[]); 
+#if ( (!(defined(BSD42))) && (!(defined(BSD43))) && (!(defined(__NTVIS__))) )
+int  read(int, char*, int);
+int  write(int, char*, int);
+int  close(int);
+#endif /* !(BSD42) && !(BSD43) */
+int  fclose(FILE *stream);
+
+#if !defined(BSD43) && !defined(__NTVIS__)
+void bzero(char*,int);
+void bcopy(char*, char*, int);
+char strncpy(char *s1,char *s2,size_t n);
+int  atoi(char*);
+int  malloc(int);
+#endif
+
+
+                           /* ANSI socket functions prototype /sys/socket.h */
+#if defined(__lynx__)
+int  select(int, fd_set*, fd_set*, fd_set*, struct timeval*); 
+
+#else 
+#if defined(__svr4__) && !defined(sparc)
+
+/*  informations in : /usr/include/sys/socket.h */
+int  socket(int, int, int); 
+int  connect(int, struct sockaddr *, int);
+int  bind(int, struct sockaddr *, int);
+int  listen(int, int);
+int  accept(int, struct sockaddr *, int *);
+int  sendto(int, const char *, int, int, const struct sockaddr *, int);
+int  recvfrom(int, char *, int, int, struct sockaddr *, int *);
+int  getpeername(int, struct sockaddr *, int *);
+int  getsockopt(int, int, int, char *, int *);
+int  select(int, fd_set*, fd_set*, fd_set*, struct timeval*); 
+
+#else
+#if defined(_AIX)
+int  select(unsigned long, void *, void *, void *, struct timeval *);
+
+#else
+#if defined(__hpux__)
+int getrusage(int who,struct rusage *rusage);
+
+#else 
+#if defined(__NTVIS__)
+
+#else
+#if defined(BSD42) || defined(BSD43)
+
+#else
+
+int  socket(int, int, int);
+int  connect(int s,struct sockaddr_in *name, int namelen);
+int  bind(int s,struct sockaddr *name,int namelen);
+int  listen(int, int);
+int  accept(int, struct sockaddr_in *, int *);
+int  sendto(int, char *, int, int, struct sockaddr_in *, int);
+int  recvfrom(int, char *, int, int, struct sockaddr_in *, int *);
+int  getpeername(int, struct sockaddr *, int *);
+int  setsockopt(int, int, int, char *, int);
+
+int  getsockopt(int, int, int, char*, int*);
+int  select(int, fd_set*, fd_set*, fd_set*, struct timeval*); 
+
+#endif /* BSD42 || BSD43 */
+#endif /* __hpux__ */
+#endif /*  _AIX    */
+#endif /* __svr4__ */
+#endif /* __lynx__ */ 
+#endif /* __NTVIS__ */
+
+/* ttcp prototype functions */
+void udp_rcv_test(void);
+double calc_cpu_time(struct rusage *r0, struct rusage *r1);
+double calc_real_time(struct timeval *t0, struct timeval *t1);
+int  getrusage(int who,struct rusage *rusage);
+void sockets_err(char*);
+void err(char *);
+void mes(char *);
+void pattern(char *, int);
+int  Nread(SOCKET, void *, int);
+int  Nwrite(int, void *, int);
+void delay(int);
+int  mread(int, char *,unsigned);
+char *outfmt(char format, double b);
+void prep_timer(void);
+void read_timer(void);
+void result_summary(void);
+void prusage(struct rusage*,  struct rusage*,
+             struct timeval*, struct timeval*); 
+void tvadd(struct timeval *tsum, struct timeval *t0,struct timeval *t1);
+void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0);
+void psecs(int);
+void open_log(void);
+void close_log(void);
+void do_Usage(void);
+void do_help(void);
+
+/*--------------------------------------------------------------------------*/
+#if !defined(__NTVIS__)
+void 
+sigpipe()
+{;
+}
+#endif
+/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
+int
+main(int argc, char **argv)
+{
+  unsigned long addr_tmp;
+  int c,k;
+  int sockbufsndsize,sockbufrcvsize;
+  int sockbuflen;
+  struct sockaddr_in peer;
+  int peerlen = sizeof(peer);
+
+#if defined(__NTVIS__)
+  extern char *optarg;
+  WSADATA WSAData;
+  WSAStartup(MAKEWORD(1,1), &WSAData);
+#endif /* __NTVIS__ */
+
+  if (argc < 2) { do_Usage(); exit(1); }
+
+  while (1) {
+    while ((c=getopt(argc, argv, "hidrstuvxHVBDTLb:f:l:n:p:A:O:S:N:P:R:I:w:")) != -1) {
+      switch (c) {
+        case 'w':
+           timeout = atoi(optarg);
+           break;
+        case 'I':
+           seed = atoi(optarg);
+           break;
+        case 'N':
+           burstn = atoi(optarg);
+           break;
+       case 'P':
+#if defined(__linux__)
+          pri = atoi(optarg);
+          break;
+#else
+          fprintf(stderr, "ttcp: -P option not supported on this OS\n");
+          exit(1);
+#endif
+       case 'R':
+          bufmin = atoi(optarg);
+          break;
+        case 'S':
+           udpsleep = atoi(optarg);
+           if (udpsleep < 0) udpsleep = 0;
+           /* convert msec arg to usec for usleep, minimum 10ms */
+           udpsleep = udpsleep * 1000;
+           break;
+        case 'H':
+           hash = 1;
+           break;
+        case 'V':
+           fprintf(stdout,"%s %s\n" , RCSid , VersDate );
+           exit(0);
+        case 'B':
+          b_flag = 1;
+          break;
+        case 'L':
+          log_cnt = 1;
+          break;
+        case 'h':
+          do_help();
+          exit(1);
+          break;
+        case 't':
+          trans = 1;
+          break;
+        case 'r':
+          trans = 0;
+          break;
+        case 'x':
+          rndm = 1;
+          break;
+        case 'd':
+          options |= SO_DEBUG;
+          break;
+        case 'D':
+#ifdef TCP_NODELAY
+        nodelay = 1;
+#else
+        fprintf(stderr, 
+       "ttcp: -D option ignored: TCP_NODELAY socket option not supported\n");
+#endif
+          break;
+        case 'n':
+          nbuf = atoi(optarg);
+          break;
+        case 'l':
+          buflen = atoi(optarg);
+          break;
+        case 's':
+          sinkmode = !sinkmode;
+          break;
+        case 'p':
+          port = atoi(optarg);
+          break;
+        case 'u':
+          udp = 1;
+          break;
+        case 'v':
+          verbose = 1;
+          break;
+        case 'A':
+          bufalign = atoi(optarg);
+          break;
+        case 'O':
+          bufoffset = atoi(optarg);
+          break;
+        case 'b':
+#if defined(SO_SNDBUF) || defined(SO_RCVBUF)
+          sockbufsize = atoi(optarg);
+#else
+          fprintf(stderr, 
+"ttcp: -b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported\n");
+#endif
+          break;
+        case 'f':
+          fmt = *optarg;
+          break;
+        case 'T':
+          touchdata = 1;
+          break;
+        case 'i':
+          seq_info = 1;
+          break;
+          
+      default:
+          {do_Usage(); exit(1);}
+       }/*switch */
+    }/* while getopt() */
+
+    argc -= optind;
+    argv += optind;
+    optind = 0;
+    
+    /* check for '--' args */
+    if (argc == 0) {
+      /* no more args */
+      break; /* while (1) */
+#if defined(DEBUG)
+    } else if (!strcmp(argv[0], "--nostart")) {
+      no_start = 1;
+      argc--; argv++;
+    } else if (!strcmp(argv[0], "--nodata")) {
+      no_data = 1;
+      argc--; argv++;
+    } else if (!strcmp(argv[0], "--noend")) {
+      no_end = 1;
+      argc--; argv++;
+    } else if (!strcmp(argv[0], "--debug")) {
+      debug = 1;
+      argc--; argv++;
+#endif /* DEBUG */
+    } else if (!strncmp(argv[0], "--", 2)) {
+      fprintf(stderr, "ttcp: illegal option: %s\n", argv[0]);
+      do_Usage(); exit(1);
+    } else {
+      /* the arg was not a '--' arg */
+      break; /* while (1) */
+    }
+  } /* while (1) */
+  
+    
+ /* ----------------------- main part ----------------------- */
+
+#if defined(__NTVIS__) && !defined(UNDER_CE)
+  /* Set "stdin" to have binary mode: */
+  if (_setmode(_fileno(stdin), _O_BINARY) == -1)
+    perror("%s: Error setting stdin to binary mode");
+  /* Set "stdout" to have binary mode: */
+  if (_setmode(_fileno(stdout), _O_BINARY) == -1)
+    perror("%s: Error setting stdout to binary mode");
+#endif /* __NTVIS__ */
+
+if (log_cnt) open_log(); 
+
+/* input error checking */
+if (burstn > nbuf) {
+    fprintf(stderr, "ttcp: buffers per burst must be less than or equal to "
+        "total number of buffers\n");
+    exit(1);
+}
+if (bufmin < -1) {
+    fprintf(stderr, "ttcp: minimum buffer size specified with -R option must "
+        "be non-negative\n");
+    exit(1);
+}
+if (buflen > 65535) {
+    fprintf(stderr, "ttcp: maximum buffer size specified with -l option must "
+        "be <= 65536\n");
+    exit(1);
+}
+if (bufmin > buflen) {
+    fprintf(stderr, "ttcp: minimum buffer size specified with -R option must "
+        "be less than or equal to (maximum) buffer size specified with -l\n");
+    exit(1);
+}
+
+/* buffer allocation */
+
+ if (udp && buflen < MIN_UDP_LEN) 
+   buflen = MIN_UDP_LEN;        /* send more than the sentinel size */
+ if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL) 
+      err("malloc");
+ if (bufalign != 0)
+      buf +=(bufalign - ((int)buf % bufalign) + bufoffset) % bufalign;
+ fprintf(stderr,"ttcp%s: buflen=%d, nbuf=%d, align=%d/%d, port=%d\n",
+            trans?"-t":"-r",buflen, nbuf, bufalign, bufoffset, port);
+ if (log_cnt)fprintf(fplog," %6d %6d %6d %6d %4d",
+                      buflen, nbuf, bufalign, bufoffset, port);
+
+ /* preload the buffer for the transmit condition */
+ pattern( buf, buflen );
+
+ /* seed the random number generator */
+ if ((bufmin != -1) || (rndm != 0)) {
+#if defined(__NTVIS__)
+   srand(seed);
+#else /* ! __NTVIS__ */
+   srandom(seed);
+#endif /* __NTVIS__ */
+ }
+
+ if(trans)  
+   {/* xmitr */
+     if (argc == 0) {
+       fprintf(stderr, "ttcp: missing destination host arg\n");
+       do_Usage(); exit(1);
+     }
+     
+     bzero((char *)&sinhim, sizeof(sinhim));
+     host = argv[0];
+     if (atoi(host) > 0 )  
+       {/* Numeric */
+         sinhim.sin_family = AF_INET;
+         sinhim.sin_addr.s_addr = inet_addr(host);
+       } 
+     else 
+       {if ((addr=gethostbyname(host)) == NULL) sockets_err("bad hostname");
+        sinhim.sin_family = addr->h_addrtype;
+        bcopy(addr->h_addr,(char*)&addr_tmp, addr->h_length);
+        sinhim.sin_addr.s_addr = addr_tmp;
+       }
+     sinhim.sin_port = htons(port);
+     sinme.sin_port = 0;                /* free choice */
+   } 
+ else 
+   {/* rcvr */
+     sinme.sin_port =  htons(port);
+   }
+#if defined(__NTVIS__)
+ sinme.sin_family = AF_INET;
+#endif
+ fd = socket(AF_INET, udp?SOCK_DGRAM:SOCK_STREAM, 0);
+
+#if defined(__NTVIS__)
+ if (fd == INVALID_SOCKET) sockets_err("socket");
+#else
+ if (fd < 0) sockets_err("socket");
+#endif
+ if (verbose) {
+       char *label = trans?"ttcp-t":"ttcp-r";
+#if defined(UNDER_CE)
+       SYSTEMTIME SystemTime;
+       char time_str[30];
+
+       GetLocalTime(&SystemTime);
+       sprintf(time_str, "%s %s %d %02d:%02d:%02d %d\n", weekday[SystemTime.wDayOfWeek], month[SystemTime.wMonth - 1],
+               SystemTime.wDay, SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond, SystemTime.wYear);
+#else
+   time_t now;
+   char *time_str; 
+       
+   time(&now);
+   time_str = ctime(&now);
+#endif
+   fprintf(stdout,"%s: start time %s", label, time_str);
+   fprintf(stdout,"%s: File-Descriptor 0x%x Opened\n", label, fd );
+ }
+
+#if defined(__NTVIS__)
+ if (bind(fd, (struct sockaddr FAR *)&sinme, sizeof(sinme)) == SOCKET_ERROR) 
+   sockets_err("bind");
+#else
+ if (bind(fd, SOCKADDR_CAST &sinme, sizeof(sinme)) < 0) 
+   sockets_err("bind");
+#endif /* __NTVIS__ */
+
+
+#if defined(SO_SNDBUF) || defined(SO_RCVBUF)
+ if (sockbufsize) 
+   {
+#if defined(__lynx__) || defined(__sun__)  || defined(__NTVIS__)
+     if (trans) 
+       {if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize,
+                       sizeof sockbufsize) < 0)  
+        sockets_err("setsockopt: sndbuf");
+       } 
+     else 
+       {if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize,
+                       sizeof sockbufsize) < 0)  
+        sockets_err("setsockopt: rcvbuf");
+       }
+
+#else
+     if (trans) 
+
+         {if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sockbufsize,
+                       sizeof sockbufsize) < 0) 
+        sockets_err("setsockopt: sndbuf");
+       } 
+     else 
+       {if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &sockbufsize,
+                       sizeof sockbufsize) < 0) 
+        sockets_err("setsockopt: rcvbuf");
+       }
+#endif /* __lynx__ __sun__ __NTVIS__ */ 
+   }
+ else
+   {/*
+    ** Added by Daniel Davids to Know Socket-Buffer-Sizes
+    */
+     sockbuflen = sizeof sockbufsndsize;
+#if defined(__lynx__) || defined(__sun__) || defined(__NTVIS__)
+     getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsndsize, 
+                &sockbuflen);
+     sockbuflen = sizeof sockbufrcvsize;
+     getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufrcvsize, 
+                     &sockbuflen);
+#else
+     getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &sockbufsndsize, &sockbuflen);
+     sockbuflen = sizeof sockbufrcvsize;
+     getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &sockbufrcvsize, &sockbuflen);
+#endif /* __lynx__ __sun__ __NTVIS__ */
+     sockbufsize = ( sockbufsndsize + sockbufrcvsize ) / 2;
+
+     if ( sockbufsndsize != sockbufrcvsize )
+       {fprintf(stderr, "sockbufsndsize=%d, ", sockbufsndsize );
+       fprintf(stderr, "sockbufrcvsize=%d, ", sockbufrcvsize );
+       }
+   }
+#endif /* defined(SO_SNDBUF) || defined(SO_RCVBUF) */
+ if (sockbufsize) fprintf(stderr, "sockbufsize=%d, \n", sockbufsize);
+
+ if (log_cnt)
+   {if (sockbufsize)fprintf(fplog," %6d",sockbufsize);
+    else fprintf(fplog," 0");
+   }
+
+#if defined(__linux__)
+ if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (char *)&pri, sizeof pri) < 0)  
+   sockets_err("setsockopt: priority");
+#endif
+
+
+ if (trans)  fprintf(stderr, "# %s sender -> %s #\n", udp?"udp":"tcp", host);
+ else        fprintf(stderr, "# %s receiver #\n", udp?"udp":"tcp");
+ if (!udp)  
+   {
+#if !defined(__NTVIS__)
+     signal(SIGPIPE, sigpipe);
+#endif /* !__NTVIS__ */
+
+     if (trans) 
+       {/* We are the client if transmitting */
+         if (options)  
+           {
+#if defined(BSD42)
+            if( setsockopt(fd, SOL_SOCKET, options, 0, 0) < 0)
+#else /* BSD43 */
+       if( setsockopt(fd, SOL_SOCKET, options, (char *)&one, sizeof(one)) < 0)
+#endif /* BDS42 */
+           sockets_err("setsockopt");
+           }
+#ifdef TCP_NODELAY
+         if (nodelay) 
+           {struct protoent *p;
+            p = getprotobyname("tcp");
+#if defined(__lynx__)  || defined(__sun__)        || defined(__NTVIS__)
+                if( p && setsockopt(fd, p->p_proto, TCP_NODELAY, 
+                                      (char *) &one, sizeof(one)) < 0)
+#else 
+            if( p && setsockopt(fd, p->p_proto, TCP_NODELAY, 
+                                      &one, sizeof(one)) < 0)
+#endif /* __lynx__  __sun__ __NTVIS__ */
+            sockets_err("setsockopt: nodelay");
+           }
+#endif /* TCP_NODELAY */
+         if (connect(fd, SOCKADDR_CAST &sinhim, sizeof(sinhim) ) < 0) 
+         sockets_err("connect");
+       }/* if (trans) */ 
+     else 
+       {/* otherwise, we are the server and should listen for connections */
+
+errno = 0;
+
+#if defined(sgi) || ( defined(__osf__) && !defined(_CFE) )
+        if( listen(fd,1) <0 )   
+#else
+        if( listen(fd,0) <0 )   /* allow a queue of 0 */
+#endif
+        sockets_err("listen");
+
+        if(options) {
+          int err;
+#if defined(BSD42)
+          err = setsockopt(fd, SOL_SOCKET, options, 0, 0);
+#elif defined(__lynx__) || defined(__sun__) || defined(__NTVIS__)
+          err = setsockopt(fd, SOL_SOCKET, options, (char *) &one, sizeof(one));
+#else
+          err = setsockopt(fd, SOL_SOCKET, options, &one, sizeof(one));
+#endif /* BSD42 */
+          if (err < 0)
+            sockets_err("setsockopt");
+        }
+        fromlen = sizeof(frominet);
+        domain = AF_INET;
+ if (timeout > 0) {
+   fd_set readfds, exceptfds;
+   struct timeval tv_timeout;
+   int n;
+   
+   tv_timeout.tv_sec = timeout/1000;
+   tv_timeout.tv_usec = (timeout%1000)*1000;
+   
+   FD_ZERO(&readfds);
+   FD_ZERO(&exceptfds);
+   FD_SET(fd, &readfds);
+   FD_SET(fd, &exceptfds);
+   
+   n =  select( fd+1, &readfds, NULL, &exceptfds, &tv_timeout );
+   if (n == 0 || n == SOCKET_ERROR) {
+     sockets_err("select listen");
+     return 0;
+   } 
+ }
+        if((fd=accept(fd, SOCKADDR_CAST &frominet, &fromlen) ) < 0) 
+                sockets_err("accept");
+
+        if (getpeername(fd, SOCKADDR_CAST &peer, &peerlen) < 0)
+          sockets_err("getpeername");
+         
+        fprintf(stderr,"ttcp-r: accept from %s\n",inet_ntoa(peer.sin_addr));
+
+       } /* otherwise we are ... */
+   }
+
+ prep_timer();
+ errno = 0;
+ nbytes = 0.0;
+ numCalls = 0;
+
+ {
+   register int cnt,multi;
+   char *pb;
+   int nb = 0;
+   unsigned long rbuflen = 0;
+   multi = nbuf;
+
+   if (trans) {
+#if !defined(BSD43)
+     if(udp) {
+       int err;
+       int nochecksum_opt = 0;
+       err = setsockopt(fd, IPPROTO_UDP, UDP_NOCHECKSUM,
+                        (char *)&nochecksum_opt, sizeof(nochecksum_opt));
+       if (err < 0)
+         sockets_err("setsockopt");
+     }
+#endif
+     
+     if(udp && !no_start) {
+       int start_count = 2;
+       char start_pkt[START_PKT_LEN];
+       memset(start_pkt, 0, START_PKT_LEN);
+       memcpy(start_pkt, start_pattern, START_PATTERN_LEN);
+
+       while (start_count-- > 0) {
+         (void)Nwrite( fd, start_pkt, START_PKT_LEN ); /* rcvr start */
+         if (udpsleep) {
+           usleep(udpsleep);
+           /* clear errno (see man page for errno(3), definition of
+              EINTR.  usleep() uses SIGCONT? ) */
+           if (errno == EINTR) errno = 0;
+         } /* udpsleep */
+       }
+     }
+
+     /* initial seqence num for UDP */
+     if (udp) buf[0] = 0;
+     k = burstn;
+
+     if (sinkmode) {
+       while (multi-- > 0 && !no_data) {
+
+         if (bufmin == -1) {
+           rbuflen = buflen;
+         } else {
+           /* set rbuflen to a random value evenly distributed in 
+              [bufmin, buflen].  As long as buflen is < 2^16, we can 
+              fit the calculation in 32 bits */
+#if defined(__NTVIS__)
+           rbuflen = (( (unsigned long)rand() *
+                        ((unsigned long)(buflen-bufmin+1)) ) >> 15) + bufmin;
+#else /* ! __NTVIS__ */
+           rbuflen = (( ((unsigned long)random() >> 15) *
+                        ((unsigned long)(buflen-bufmin+1)) ) >> 16) + bufmin;
+#endif /* __NTVIS__ */
+         }
+
+         if (rndm) {
+           unsigned int i, j, l;
+           unsigned long data;
+           
+           if (udp)
+             l = 1;
+           else
+             l = 0;
+
+           for (i = l; i < rbuflen; /* null */) {
+#if defined(__NTVIS__)
+             data = (unsigned long)rand();
+#else /* ! __NTVIS__ */
+             data = (unsigned long)random();
+#endif /* __NTVIS__ */
+             /*fprintf(stderr, "%08x\n",data);*/ /* DEBUG */
+             /* The NT rand() function returns only 16 useful bits! */
+             for (j = 0; (j < 2/*4*/) && (i < rbuflen) ; j++) {
+               buf[i++] = (unsigned char)(data & 0xff);
+               data >>= 8;
+             }
+           }
+         }
+         
+         if ((cnt=Nwrite(fd,buf,rbuflen)) != (int)rbuflen)
+         sockets_err("error from the socket write");
+         /* increment sequence num if UDP */
+         if (udp) buf[0] = (char)(((unsigned char)(buf[0])+1) & 0xFF);
+         
+         if (debug)
+           fprintf(stdout,"ttcp-t: %5d | %d Bytes Written in %d write commands \n",
+                   ++nb, cnt, nbuf );
+
+         nbytes += rbuflen;
+
+         /* hashes */
+         if (hash) {
+           fprintf(stderr,"#");
+         }
+
+         /* Check for the end of a burst */
+         if (--k <= 0) {
+           k = burstn;
+           
+           /* sleep to avoid overrunning slower receivers - henry */
+           if (udpsleep) {
+             usleep(udpsleep);
+             /* clear errno (see man page for errno(3), definition of
+              EINTR.  usleep() uses SIGCONT? ) */
+             if (errno == EINTR) errno = 0;
+           } /* udpsleep */
+         }
+       } /* while */
+
+     } /* if (sinkmode) */
+     else 
+     {
+
+       nbuf = 0;
+
+       if (bufmin == -1) {
+         rbuflen = buflen;
+       } else {
+         /* set rbuflen to a random value evenly distributed in 
+            [bufmin, buflen].  As long as buflen is < 2^16, we can 
+            fit the calculation in 32 bits */
+#if defined(__NTVIS__)
+         rbuflen = (( (unsigned long)rand() *
+                      ((unsigned long)(buflen-bufmin+1)) ) >> 15) + bufmin;
+#else /* ! __NTVIS__ */
+         rbuflen = (( ((unsigned long)random() >> 15) *
+                      ((unsigned long)(buflen-bufmin+1)) ) >> 16) + bufmin;
+#endif /* __NTVIS__ */
+       }
+
+       if (udp)
+         pb = &(buf[1]);
+       else
+         pb = &(buf[0]);
+
+#if !defined(__NTVIS__)     /* else case specific to WINNT */
+       while((cnt=read(0,pb,rbuflen)) > 0)
+#else /* __NTVIS__ */
+       while((cnt=(int)fread(pb,1,rbuflen,stdin)) > 0)
+#endif /* __NTVIS__ */
+        {
+
+         if (udp)
+           multi = cnt+1; /* don't include seq. num. in count of data */
+         else
+           multi = cnt;
+         if ((cnt=Nwrite(fd,buf,multi)) != (int)multi)
+           sockets_err("error from the socket write");
+         /* increment seqence num if UDP */
+         if (udp) buf[0] = (char)(((unsigned char)(buf[0])+1) & 0xFF);
+         nbuf++;
+
+         if (debug)
+           fprintf(stdout,"ttcp-t: %5d | %d Bytes Written in %d write commands \n",
+                   ++nb, cnt, nbuf );
+
+         nbytes += multi;
+
+         /* hashes */
+         if (hash) {
+           fprintf(stderr,"#");
+         }
+
+         /* Check for the end of a burst */
+         if (--k <= 0) {
+           k = burstn;
+           
+           /* sleep to avoid overrunning slower receivers - henry */
+           if (udpsleep) {
+             usleep(udpsleep);
+             /* clear errno (see man page for errno(3), definition of
+              EINTR.  usleep() uses SIGCONT? ) */
+             if (errno == EINTR) errno = 0;
+           } /* udpsleep */
+         }
+
+         if (bufmin == -1) {
+           rbuflen = buflen;
+         } else {
+           /* set rbuflen to a random value evenly distributed in 
+              [bufmin, buflen].  As long as buflen is < 2^16, we can 
+              fit the calculation in 32 bits */
+#if defined(__NTVIS__)
+           rbuflen = (( (unsigned long)rand() *
+                        ((unsigned long)(buflen-bufmin+1)) ) >> 15) + bufmin;
+#else /* ! __NTVIS__ */
+           rbuflen = (( ((unsigned long)random() >> 15) *
+                        ((unsigned long)(buflen-bufmin+1)) ) >> 16) + bufmin;
+#endif /* __NTVIS__ */
+         }
+
+       } /* while */
+
+     } /* if (sinkmode) */
+     
+     if (hash) {
+       fprintf(stderr,"\n");
+       fflush(stderr);
+     }
+     
+#if defined(UNDER_CE)
+        errno = WSAGetLastError();
+#endif
+     if (!errno) {
+       read_timer();
+       if(udp && !no_end) {
+         int end_count = 4;
+         int data_count = nbuf;
+         char end_pkt[END_PKT_LEN];
+         unsigned char* net_byte = &end_pkt[END_PATTERN_LEN];
+         memset(end_pkt, 0, END_PKT_LEN);
+         memcpy(end_pkt, end_pattern, END_PATTERN_LEN);
+         net_byte[3] = data_count & 0xFF; data_count >>= 8;
+         net_byte[2] = data_count & 0xFF; data_count >>= 8;
+         net_byte[1] = data_count & 0xFF; data_count >>= 8;
+         net_byte[0] = data_count & 0xFF;
+         
+         while (end_count-- > 0) {
+           Nwrite( fd, end_pkt, END_PKT_LEN ); /* rcvr end */
+           if (udpsleep && end_count>0) usleep(udpsleep);
+         }
+       }
+       result_summary();
+     }
+   } /* trans */ 
+   else 
+   {
+       if (udp) {
+         udp_rcv_test();
+       }
+       else 
+       {/* not udp received transfer */
+         while ((cnt=Nread(fd,buf,buflen)) > 0)
+           {if(debug)fprintf(stdout,
+                            "ttcp%s: %5d | %d Bytes Read\n",
+                            trans?"-t":"-r", ++nb, cnt );
+           nbytes += cnt;
+           if (!sinkmode) {
+#if !defined(__NTVIS__)     /* else case specific to WINNT */
+             if (write(1,buf,cnt) != cnt) err("write");
+#else /* __NTVIS__ */
+             if ((int)fwrite(buf,1,cnt,stdout) != cnt) err("fwrite");
+#endif /* __NTVIS__ */
+           }
+         }
+#if defined(UNDER_CE)
+                errno = WSAGetLastError();
+#endif
+         if (!errno) {
+           read_timer();
+           result_summary();
+         }
+       }
+     }
+   }
+
+ if(errno) err("IO");
+
+#if defined(__NTVIS__) 
+  closesocket ( fd );
+#else 
+  close ( fd );
+#endif /* __NTVIS__ */
+
+  if (verbose) fprintf(stdout,"ttcp%s: File-Descriptor  fd 0x%x Closed\n" ,
+                       trans?"-t":"-r", fd );
+
+  if (log_cnt) close_log();
+
+  fprintf(stderr,"ttcp done.\n");
+  fflush(stdout);
+
+  exit(0);
+}
+/*--------------------------------------------------------------------------*/
+void
+udp_rcv_test(void)
+{
+  enum {START_WAIT, DATA_WAIT, DATA_RCV, END_TEST} rcv_state;
+  enum {START_PKT_TYPE, END_PKT_TYPE, DATA_PKT_TYPE} pkt_type;
+  int cnt;
+  int nbuffers = 0;
+  unsigned int start_pkt_cnt = 0;
+  unsigned int end_pkt_cnt = 0;
+  unsigned int data_pkt_cnt = 0;
+  unsigned int expected_pkt_cnt = 0;
+  unsigned char seq = 0;
+  unsigned char buf_seq;
+  
+  rcv_state = START_WAIT;
+  while (rcv_state != END_TEST && (cnt=Nread(fd,buf,buflen)) > 0) {
+    /* Determine the type of packet received */
+    if (!memcmp(buf, start_pattern, START_PATTERN_LEN)) {
+      pkt_type = START_PKT_TYPE;
+      start_pkt_cnt++;
+    } else if (!memcmp(buf, end_pattern, END_PATTERN_LEN)) {
+      /* read the expected data packet count from the end packet */
+      unsigned char* net_byte = buf;
+      net_byte += END_PATTERN_LEN;
+      expected_pkt_cnt = ((net_byte[0] << 24) + (net_byte[1] << 16) +
+                          (net_byte[2] << 8) + net_byte[3]);
+      pkt_type = END_PKT_TYPE;
+      end_pkt_cnt++;
+    } else {
+      data_pkt_cnt++;
+      pkt_type = DATA_PKT_TYPE;
+    }
+           
+    if (rcv_state == START_WAIT) {
+      /* Wait until we see a vaild start packet */
+      if (pkt_type == START_PKT_TYPE) {
+        prep_timer();
+        rcv_state = DATA_WAIT;
+      } else if (pkt_type == DATA_PKT_TYPE) {
+        fprintf(stderr, "ERROR: Missed UDP start packet.\n");
+        prep_timer();
+        rcv_state = DATA_RCV;
+      } else if (pkt_type == END_PKT_TYPE) {
+        fprintf(stderr, "ERROR: Found UDP end packet before start packet or data.\n");
+        rcv_state = END_TEST;
+      }
+    } else if (rcv_state == DATA_WAIT) {
+      /* Skip any extra start packets until we see data */
+      if (pkt_type == START_PKT_TYPE) {
+        prep_timer();
+      } else if (pkt_type == DATA_PKT_TYPE) {
+        rcv_state = DATA_RCV;
+      } else if (pkt_type == END_PKT_TYPE) {
+        fprintf(stderr, "ERROR: Found UDP end packet without receiving "
+                "any data packets.\n");
+        rcv_state = END_TEST;
+      }
+    } else { /* DATA_RCV */
+      /* Collect data packets until we see a vaild end packet */
+      if (pkt_type == START_PKT_TYPE) {
+        /* We missed the end packets and now a new test is
+         * starting. Report the results of this test then start
+         * another. */
+        read_timer();
+        result_summary();
+        fprintf(stderr, "ERROR: Found UDP start packet while receiving data.\n"
+                "ERROR: Expected more data packets or an end packet.\n");
+        nbytes = 0.0;
+        nbuffers = 0;
+        numCalls = 0;
+        prep_timer();
+        rcv_state = DATA_WAIT;
+      } else if (pkt_type == DATA_PKT_TYPE) {
+        /* loop in this state */
+      } else if (pkt_type == END_PKT_TYPE) {
+        /* we used to print results here but now we do when the loop ends */
+        rcv_state = END_TEST;
+      }
+    }
+    
+    /* tally data packets the same way from whatever state we are in */
+    if (pkt_type == DATA_PKT_TYPE) {
+      if (debug)
+        fprintf(stderr, "ttcp-r: %5d | %d Bytes Read\n", ++nbuffers, cnt);
+      nbytes += cnt;
+      if (seq_info) {
+        /* check seqence num */
+        buf_seq = (unsigned char)(buf[0]);
+        if (buf_seq != seq) {
+          fprintf(stderr, "ERROR: Out of sequence. "
+                  "Buffer %u, seq %u, expected %u\n",
+                  data_pkt_cnt, buf_seq, seq);
+          seq = buf_seq;
+        }
+        seq++;
+      }
+      if (!sinkmode) {
+#if !defined(__NTVIS__)     /* else case specific to WINNT */
+        if (write(1,&(buf[1]),cnt-1) != cnt-1) err("write");
+#else /* __NTVIS__ */
+        if ((int)fwrite(&(buf[1]),1,cnt-1,stdout) != cnt-1) err("fwrite");
+#endif /* __NTVIS__ */
+      }
+    }
+  } /* end-while */
+
+  /* normal end of test */
+  read_timer();
+  result_summary();
+  fprintf(stderr, "ttcp-r: packets %u data, %u start, %u end\n",
+          data_pkt_cnt, start_pkt_cnt, end_pkt_cnt);
+  if (expected_pkt_cnt != 0) {
+    int lost_cnt = expected_pkt_cnt - data_pkt_cnt;
+
+    fprintf(stderr, "ttcp-r: %g%% (%u/%u) packet loss\n",
+            100.0 * (double)lost_cnt/(double)expected_pkt_cnt,
+            lost_cnt, expected_pkt_cnt);
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+/* calc_cpu_time(): Time difference, in usecs, of the combined user and
+ * sys times of the given start and end usage info */
+double
+calc_cpu_time(
+  struct rusage *r0,
+  struct rusage *r1
+)
+{
+  double time;
+  time_t ms;
+  struct timeval tdiff, tend, tstart;
+    
+  /* total user delta time + total system delta time */
+  tvadd( &tend, &r1->ru_utime, &r1->ru_stime );   /* user + sys time  @ end */
+  tvadd( &tstart, &r0->ru_utime, &r0->ru_stime ); /* user + sys time  @ start*/
+  tvsub( &tdiff, &tend, &tstart );
+
+  /* useconds */
+  time = ((double)tdiff.tv_sec)*1e6 + (double)tdiff.tv_usec;
+
+  /* debug mseconds */
+  ms = tdiff.tv_sec*(time_t)1000 + tdiff.tv_usec/(time_t)1000;
+  if (ms != (time_t)(time/1000.0)) {
+    fprintf(stderr, "ERROR: time calc mismatch of msec (%d) to usec (%f)\n",
+            (int)ms, time/1000.0);
+  }
+
+  return time;
+}
+
+/*--------------------------------------------------------------------------*/
+/* calc_real_time(): Time difference in usecs of the given times */
+double
+calc_real_time(
+  struct timeval *t0,
+  struct timeval *t1
+)
+{
+  double time;
+  time_t ms;
+  struct timeval tdiff;
+    
+  tvsub(&tdiff, t1 ,t0);
+
+  /* useconds */
+  time = ((double)tdiff.tv_sec)*1e6 + (double)tdiff.tv_usec;
+  
+  /* debug mseconds */
+  ms = tdiff.tv_sec*(time_t)1000 + tdiff.tv_usec/(time_t)1000;
+  if (ms != (time_t)(time/1000.0)) {
+    fprintf(stderr, "ERROR: time calc mismatch of msec (%d) to usec (%f)\n",
+            (int)ms, time/1000.0);
+  }
+
+  return time;
+}
+/*--------------------------------------------------------------------------*/
+void
+result_summary(void)
+{
+  char* label = trans ? "ttcp-t" : "ttcp-r";
+  double cput = calc_cpu_time(&ru0, &ru1);
+  double realt = calc_real_time(&time0, &time1);
+  double t_min;
+  double bytes_per_sec;
+
+  /* lower end boundary conditions */
+  t_min = 10.0;                 /* 10 usec */
+#if  defined(__NTVIS__)
+  t_min = 1000.0;               /* 1 msec */
+#endif
+  if (cput <= t_min) {          /* value in usec */
+    cput = t_min;
+    fprintf(stderr,"%s: cpu time too short set at %.0f usec, NOT accurate result.\n",
+            label,t_min);
+  }
+  if (realt <= t_min) {         /* value in usec */
+    realt = t_min;
+    fprintf(stderr,"%s: real time too short, set at %.0f usec, NOT accurate result.\n",
+            label,t_min);
+  }
+
+  bytes_per_sec = (nbytes/realt)*1e6;
+
+  fprintf(stderr,"%s: %.0f bytes in %.06f real seconds = %s/sec +++\n",
+          label, nbytes, realt/1e6, outfmt(fmt, bytes_per_sec));
+
+  if (verbose)
+    fprintf(stderr,"%s: %.0f bytes in %.06f cpu  seconds = %s/cpu sec\n",
+            label, nbytes,cput/1e6, outfmt(fmt, (nbytes/cput)*1e6));
+
+  fprintf(stderr,"%s: %ld I/O calls, %.3f msec(real)/call, %.3f msec(cpu)/call\n",
+          label, numCalls,
+          (numCalls>0)?(realt/(double)numCalls)/1000.0:0.0,
+          (numCalls>0)?(cput /(double)numCalls)/1000.0:0.0);
+
+  fprintf(stderr,"%s: ", label);
+  prusage(&ru0, &ru1, &time0, &time1);
+  fprintf(stderr,"\n");
+
+  if (verbose)
+    printf("%s: buffer address %#x\n", label, (unsigned int)buf);
+
+  if (fplog) {
+    struct timeval tdiff;
+    /* User time */
+    tvsub(&tdiff, &ru1.ru_utime, &ru0.ru_utime);
+    fprintf(fplog," %ld.%06ld", (long)tdiff.tv_sec, (long)tdiff.tv_usec);
+    /* System time */
+    tvsub(&tdiff, &ru1.ru_stime, &ru0.ru_stime);
+    fprintf(fplog," %ld.%06ld", (long)tdiff.tv_sec, (long)tdiff.tv_usec);
+    /* Percent of cput usage */
+    fprintf(fplog," %.1f", 100.0 * (cput/realt));
+    /* validity of real time mesurment */
+    fprintf(fplog, (realt == t_min)?" 0":" 1");
+    /* bytes, seconds, MBytes/sec, IO calls */
+    fprintf(fplog," %10.0f %4.06f %4.3f %6ld",
+            nbytes, realt/1e6, bytes_per_sec/(1024.0*1024.0), numCalls);
+  }
+}
+/*--------------------------------------------------------------------------*/
+void
+sockets_err(char* s)
+{
+#if defined(__NTVIS__)
+  int err = WSAGetLastError();
+  char* prefix = trans?"ttcp-t":"ttcp-r";
+  fprintf(stderr,"%s: %s\n", prefix, s);
+  fprintf(stderr,"%s: errno=%d\n", prefix, err);
+  exit(1);
+#else
+  err(s);
+#endif /* __NTVIS__ */
+}
+
+/*--------------------------------------------------------------------------*/
+void
+err(char *s)
+{
+  char* prefix = trans?"ttcp-t":"ttcp-r";
+  fprintf(stderr,"%s: ", prefix);
+  perror(s);
+  fprintf(stderr,"%s: errno=%d\n", prefix, errno);
+  exit(1);
+}
+/*--------------------------------------------------------------------------*/
+void
+mes(char *s)
+{
+        fprintf(stderr,"ttcp%s: %s\n", trans?"-t":"-r", s);
+}
+/*--------------------------------------------------------------------------*/
+void
+pattern( char *cp, int cnt )
+{
+        register char c;
+        register int cnt1;
+        cnt1 = cnt;
+        c = 0;
+        while( cnt1-- > 0 )  {
+                while( !isprint((c&0x7F)) )  c++;
+                *cp++ = (c++&0x7F);
+        }
+}
+/*--------------------------------------------------------------------------*/
+char *
+outfmt(char format, double b)
+{
+  static char obuf[50];
+  double giga = 1024.0 * 1024.0 * 1024.0;
+  double mega = 1024.0 * 1024.0;
+  double kilo = 1024.0;
+  
+  if (format == 'A') {
+    if (b >= giga)
+      format = 'G';
+    else if (b >= mega)
+      format = 'M';
+    else if (b >= kilo)
+      format = 'K';
+    else
+      format = 'B';
+  }
+
+  switch (format) {
+  case 'G':
+    sprintf(obuf, "%.3f GB", b / giga);
+    break;
+  case 'M':
+    sprintf(obuf, "%.3f MB", b / mega);
+    break;
+  case 'K':
+    sprintf(obuf, "%.3f KB", b / kilo);
+    break;
+  case 'B':
+    sprintf(obuf, "%4f B", b);
+    break;
+  case 'g':
+    sprintf(obuf, "%.3f Gbit", b * 8.0 / giga);
+    break;
+  case 'm':
+    sprintf(obuf, "%.3f Mbit", b * 8.0 / mega);
+    break;
+  case 'k':
+    sprintf(obuf, "%.3f Kbit", b * 8.0 / kilo);
+    break;
+  case 'b':
+    sprintf(obuf, "%4f b", b * 8.0);
+    break;
+  default:
+    sprintf(obuf, "default.........."); 
+  }
+  return obuf;
+}
+/*--------------------------------------------------------------------------*/
+#if defined(SYSV)
+
+/*ARGSUSED*/
+
+#if defined(__osf__)
+/* getrusage defined in the system lib */
+#else 
+#if defined(__lynx__)
+/* getrusage defined in the system lib */
+#else 
+#if defined(__sun__) 
+/* getrusage defined in the system lib */
+#else 
+
+int
+getrusage(ignored, ru)
+     int ignored;
+     register struct rusage *ru;
+{
+
+
+#if defined(__NTVIS__)
+  HANDLE phd;
+  FILETIME CreateTime, ExitTime, KernelTime, UserTime;
+  SYSTEMTIME SysTime;
+#if defined(UNDER_CE)
+  phd = GetCurrentThread();
+  if( GetThreadTimes(phd, &CreateTime, &ExitTime, &KernelTime, &UserTime) 
+      != TRUE) 
+#else
+  phd = GetCurrentProcess();
+  if( GetProcessTimes(phd, &CreateTime, &ExitTime, &KernelTime, &UserTime) 
+      != TRUE) 
+#endif
+    {ru->ru_stime.tv_sec  = 0;
+    ru->ru_stime.tv_usec = 0;
+    ru->ru_utime.tv_sec  = 0;
+    ru->ru_utime.tv_usec = 0;
+    } 
+  else 
+   {
+     (void) FileTimeToSystemTime(&KernelTime, &SysTime);
+     /*
+      * fprintf(stdout,
+      * "System sec=%d, msec=%d\n", SysTime.wSecond, SysTime.wMilliseconds);
+      */
+     ru->ru_stime.tv_sec  = SysTime.wSecond; 
+     ru->ru_stime.tv_usec = SysTime.wMilliseconds * 1000;
+     (void) FileTimeToSystemTime(&UserTime, &SysTime);
+     /*
+      *  fprintf(stdout,
+      *  "   User sec=%d, msec=%d\n", SysTime.wSecond, SysTime.wMilliseconds);
+      */
+     ru->ru_utime.tv_sec  = SysTime.wSecond;
+     ru->ru_utime.tv_usec = SysTime.wMilliseconds * 1000;
+    }
+
+#else   /* __NTVIS__ */
+
+  struct tms buftime;
+  times(&buftime);
+  /* Assumption: HZ <= 2147 (LONG_MAX/1000000) */
+  /* info : in lynxOS HZ is called TICKSPERSEC (<conf.h>) */
+
+    ru->ru_stime.tv_sec  = buftime.tms_stime / HZ;
+    ru->ru_stime.tv_usec = ((buftime.tms_stime % HZ) * 1000000) / HZ;
+    ru->ru_utime.tv_sec  = buftime.tms_utime / HZ;
+    ru->ru_utime.tv_usec = ((buftime.tms_utime % HZ) * 1000000) / HZ;
+#endif /* __NTVIS__ */
+return(0);
+
+} /* static getrusage */
+
+#endif /* __sun__ */
+#endif /* __lynx__ */
+#endif /* __osf__ */
+#endif /* SYSV */
+/*--------------------------------------------------------------------------*/
+#if defined(SYSV) 
+#if defined(__hpux__) || defined(_AIX) || defined(__sun__)
+/* gettimeofday defined in the system lib */
+#else
+# if defined (__osf__) ||defined (__lynx__)
+/* gettimeofday defined in the system lib */
+#else
+/*ARGSUSED*/
+static 
+gettimeofday(tp, zp)
+struct timeval *tp;
+struct timezone *zp;
+{
+#if defined(__NTVIS__)
+#if defined(UNDER_CE)
+       SYSTEMTIME SystemTime;
+
+       GetLocalTime(&SystemTime); 
+       tp->tv_sec = SystemTime.wSecond;
+       tp->tv_usec = SystemTime.wMilliseconds * 1000;
+#else
+  struct _timeb timeptr;
+
+  _ftime(&timeptr);
+  tp->tv_sec = timeptr.time;
+  tp->tv_usec = timeptr.millitm * 1000;
+#endif
+#else /* all cases */
+  tp->tv_sec = time(0);
+  tp->tv_usec = 0;
+#endif /* __NTVIS__ */
+return(1);
+} /* static gettimeofday */
+
+#endif /*__osf__ || __lynx__ */
+#endif /* __hpux__ || _AIX || __sun__ || __osf__*/
+#endif /* SYSV */
+/*--------------------------------------------------------------------------*/
+/*
+ *                        P R E P _ T I M E R
+ */
+void
+prep_timer(void)
+{
+  gettimeofday(&time0, (struct timezone *)0);
+  getrusage(RUSAGE_SELF, &ru0);
+}
+/*--------------------------------------------------------------------------*/
+/*
+ *                        R E A D _ T I M E R
+ * 
+ */
+void
+read_timer(void)
+{
+  getrusage(RUSAGE_SELF, &ru1);
+  gettimeofday(&time1, (struct timezone *)0);
+}
+/*--------------------------------------------------------------------------*/
+/*         Print the process usage calculated from timers values extracted 
+ *         before and after the transfer execution.
+ */
+void
+prusage(
+  struct rusage *r0, struct rusage *r1,
+  struct timeval *t0, struct timeval *t1
+)
+{
+  struct timeval tdiff;
+  int t, ms;
+  register char *cp;
+  double cput = calc_cpu_time(r0, r1);
+  double realt = calc_real_time(t0, t1);
+
+  /* t == total user delta time + total system delta time */
+  if (debug)   
+  { 
+    printf("timers     : end          startup\n");
+    printf("user (sec) : %9ld  %9ld\n",r1->ru_utime.tv_sec, 
+           r0->ru_utime.tv_sec);
+    printf("user (usec): %9ld  %9ld\n",r1->ru_utime.tv_usec, 
+           r0->ru_utime.tv_usec);
+    printf("sys  (sec) : %9ld  %9ld\n",r1->ru_stime.tv_sec, 
+           r0->ru_stime.tv_sec);
+    printf("sys  (usec): %9ld  %9ld\n",r1->ru_stime.tv_usec, 
+           r0->ru_stime.tv_usec);
+    printf("time (sec) : %9ld  %9ld\n",t1->tv_sec,t0->tv_sec);
+    printf("time (usec): %9ld  %9ld\n",t1->tv_usec,t0->tv_usec);
+  }
+  /* for the AIX debug, most counters are outside a good range  
+    printf("                               r0                   r1\n");
+    printf("ru_ixrss    %20ld %20ld \n", r0->ru_ixrss  ,r1->ru_ixrss  );    
+    printf("ru_idrss    %20ld %20ld \n", r0->ru_idrss  ,r1->ru_idrss  );    
+    printf("ru_isrss    %20ld %20ld \n", r0->ru_isrss ,r1->ru_isrss );  
+    printf("ru_minflt   %20ld %20ld \n", r0->ru_minflt  ,r1->ru_minflt  );   
+    printf("ru_majflt   %20ld %20ld \n", r0->ru_majflt  ,r1->ru_majflt  );   
+    printf("ru_nswap    %20ld %20ld \n", r0->ru_nswap  ,r1->ru_nswap  );    
+    printf("ru_inblock  %20ld %20ld \n", r0->ru_inblock  ,r1->ru_inblock );  
+    printf("ru_oublock  %20ld %20ld \n", r0->ru_oublock  ,r1->ru_oublock  );  
+    printf("ru_msgsnd   %20ld %20ld \n", r0->ru_msgsnd  ,r1->ru_msgsnd  );   
+    printf("ru_msgrcv   %20ld %20ld \n", r0->ru_msgrcv  ,r1->ru_msgrcv   );   
+    printf("ru_nsignals %20ld %20ld \n", r0->ru_nsignals  ,r1->ru_nsignals); 
+    printf("ru_nvcsw    %20ld %20ld \n", r0->ru_nvcsw   ,r1->ru_nvcsw   );    
+    printf("ru_nivcsw   %20ld %20ld \n", r0->ru_nivcsw  ,r1->ru_nivcsw  );   
+  */
+
+  /* cpu time in mseconds */
+  t = (int)(cput / 1000.0);
+
+  /* ms == value of the internal clock at the end of the xfer   */      
+  /*                             also called real time.         */
+  /* real time in mseconds */
+  ms = (int)(realt / 1000.0);
+
+  /* The display is based on variables provided by the function getrusage 
+     Info located in : /usr/include/sys/resource.h  
+  */                       
+#if defined(SYSV)
+
+#if defined(_AIX)
+  /* with AIX cernsp most counters are wrong  
+   * cp = "%Uuser %Ssys %Ereal %P %Xi+%Dd %Mmaxrss %F+%Rpf %Ccsw\0";
+   */
+  cp = "%Uuser %Ssys %Ereal %P\0";
+
+#else 
+#if defined(__osf__)
+  cp = "%Uuser %Ssys %Ereal %P %Xi+%Dd %Mmaxrss %F+%Rpf %Ccsw\0";
+#else
+#if defined(sgi)                        /* IRIX 3.3 will show 0 for %M,%F,%R,%C */
+  cp = "%Uuser %Ssys %Ereal %P %Mmaxrss %F+%Rpf %Ccsw\0";
+#else 
+#if defined(__Lynx__)
+  cp = "%Uuser %Ssys %Ereal %P\0";
+#else 
+  cp = "%Uuser %Ssys %Ereal %P\0";    /* all SYSV except those mentionned */
+#endif /*__lynx__ */
+#endif /* sgi     */
+#endif /*__osf__  */
+#endif /* _AIX    */
+
+#else  /* BSD system */
+  cp = "%Uuser %Ssys %Ereal %P %Xi+%Dd %Mmaxrss %F+%Rpf %Ccsw\0"; 
+
+#endif /* SYSV    */
+
+  for (; *cp; cp++) {
+    if (*cp != '%') {
+      putc(*cp, stderr);
+      /*  *outp++ = *cp; */
+    } else if (cp[1]) 
+      switch(*++cp) {
+      case 'U':
+        tvsub(&tdiff, &r1->ru_utime, &r0->ru_utime);
+        fprintf(stderr,"%ld.%06ld", (long)tdiff.tv_sec, (long)tdiff.tv_usec);
+        break;
+
+      case 'S':
+        tvsub(&tdiff, &r1->ru_stime, &r0->ru_stime);
+        fprintf(stderr,"%ld.%06ld", (long)tdiff.tv_sec, (long)tdiff.tv_usec);
+        break;
+
+      case 'E':
+        psecs( ms / 1000);
+        break;
+
+      case 'P':
+        fprintf(stderr,"%.1f%%", (cput*100.0 / (realt ? realt : 1.0)) );
+        break;
+
+#if !defined(SYSV) || defined(__osf__) || defined(_AIX)
+      case 'W':
+        {
+          int i = r1->ru_nswap - r0->ru_nswap;
+          fprintf(stderr,"%d", i);
+          break;
+        }
+            
+      case 'X':
+        fprintf(stderr,"%ld", t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t);
+        break;
+
+      case 'D':
+        fprintf(stderr,"%ld", t == 0 ? 0 :
+                (r1->ru_idrss+r1->ru_isrss - (r0->ru_idrss+r0->ru_isrss))/t);
+        break;
+
+      case 'K':
+        fprintf(stderr,"%ld", t == 0 ? 0 :
+                ((r1->ru_ixrss+r1->ru_isrss+r1->ru_idrss) -
+                 (r0->ru_ixrss+r0->ru_idrss+r0->ru_isrss))/t);
+        break;
+
+      case 'M':
+        fprintf(stderr,"%ld", r1->ru_maxrss/2);
+        break;
+  
+      case 'F':
+        fprintf(stderr,"%ld", r1->ru_majflt-r0->ru_majflt);
+        break;
+
+      case 'R':
+        fprintf(stderr,"%ld", r1->ru_minflt-r0->ru_minflt);
+        break;
+
+      case 'I':
+        fprintf(stderr,"%ld", r1->ru_inblock-r0->ru_inblock);
+        break;
+
+      case 'O':
+        fprintf(stderr,"%ld", r1->ru_oublock-r0->ru_oublock);
+        break;
+
+      case 'C':
+        fprintf(stderr,"%ld+%ld",
+                r1->ru_nvcsw-r0->ru_nvcsw, r1->ru_nivcsw-r0->ru_nivcsw);
+        break;
+#endif /* !SYSV || __osf__ */
+      default:
+        putc(*cp, stderr);
+        break;
+      } /* switch */
+  } /* for */
+}
+/*--------------------------------------------------------------------------*/
+/* add 2 times structure and move usec bigger than 1000000 to sec */
+void              
+tvadd(tsum, t0, t1)
+     struct timeval *tsum, *t0, *t1;
+{
+  tsum->tv_sec = t0->tv_sec + t1->tv_sec;
+  tsum->tv_usec = t0->tv_usec + t1->tv_usec;
+  if (tsum->tv_usec > 1000000) tsum->tv_sec++, tsum->tv_usec -= 1000000;
+}
+/*--------------------------------------------------------------------------*/
+/* substract 2 time structure (t1 > t0) */
+void             
+tvsub(tdiff, t1, t0)
+     struct timeval *tdiff, *t1, *t0;
+{ 
+  tdiff->tv_sec = t1->tv_sec - t0->tv_sec;
+  tdiff->tv_usec = t1->tv_usec - t0->tv_usec;
+  if (tdiff->tv_usec < 0)  tdiff->tv_sec--, tdiff->tv_usec += 1000000;
+}
+
+/*--------------------------------------------------------------------------*/
+void          
+psecs(int l)
+{
+  int i = (int)l/3600;
+
+  if (i) {
+    /* hours:min:sec */
+    fprintf(stderr,"%d:", i);
+    i = (int)l % 3600;
+    fprintf(stderr,"%.2d:%.2d", i/60, i%60);
+  } else {
+    /* min:sec */
+    i = (int)l;
+    fprintf(stderr,"%d:%.2d", i/60, i%60);
+  }
+}
+/*--------------------------------------------------------------------------*/
+/*                        N R E A D                                           */
+
+int                          
+Nread(SOCKET s, void* bufp, int count )
+{
+#if defined(__lynx__) || defined(__svr4__) || defined(_AIX) || defined(__NTVIS__) || defined(__FreeBSD__)
+  struct sockaddr from;
+#else
+  struct sockaddr_in from;
+#endif
+  int len = sizeof(from);
+  register int cnt;
+
+  if (timeout > 0) {
+    fd_set readfds, exceptfds;
+    struct timeval tv_timeout;
+    int n;
+
+    tv_timeout.tv_sec = timeout/1000;
+    tv_timeout.tv_usec = (timeout%1000)*1000;
+
+    FD_ZERO(&readfds);
+    FD_ZERO(&exceptfds);
+    FD_SET(s, &readfds);
+    FD_SET(s, &exceptfds);
+
+    n =  select( s+1, &readfds, NULL, &exceptfds, &tv_timeout );
+    if (n == SOCKET_ERROR) {
+      sockets_err("select read");
+    } else if (n == 0) {
+      return (0);
+    }
+
+  }
+
+  if( udp )  
+    {cnt = recvfrom( s, bufp, count, 0, SOCKADDR_CAST &from, &len );
+    numCalls++;
+    } 
+  else 
+    {if( b_flag )  cnt = mread( s, bufp, count );        /* fill bufp */
+    else 
+      {
+#if defined(__NTVIS__)
+        cnt = recv( s, bufp, count, 0 );
+#else
+        cnt = read( s, bufp, count );
+#endif /* __NTVIS__ */
+        numCalls++;
+      }
+    if (touchdata && cnt > 0) 
+      {register int c = cnt, sum = 0;
+       register char *b = bufp;
+       while (c--) sum += *b++;
+      }
+    }
+  /* rchrch   printf (" numcall %d read buffer %d bytes \n",numCalls,cnt); */
+  return(cnt);
+}
+/*--------------------------------------------------------------------------*/
+/*                        N W R I T E                                         */
+
+int                                    
+Nwrite( int s, void* bufp, int count )
+{
+  register int cnt;
+  if( udp )  
+    {
+    again:
+      cnt = sendto( s, bufp, count, 0, SOCKADDR_CAST &sinhim,
+                                                sizeof(sinhim) );
+
+      numCalls++;
+
+#if defined(__NTVIS__)
+      if( cnt<0 && WSAENOBUFS == WSAGetLastError()) 
+#else
+      if( cnt<0 && errno == ENOBUFS )  
+#endif /* __NTVIS__ */
+
+        { delay(18000); errno = 0; goto again; }
+    }  else /* if (udp) */
+    {
+
+#if defined(__NTVIS__)
+      cnt = send( s, bufp, count, 0 );
+      numCalls++;
+#else
+      cnt = write( s, bufp, count );
+      numCalls++;
+#endif /* __NTVIS__ */
+    }        
+  return(cnt);
+}
+/*--------------------------------------------------------------------------*/
+void
+delay(us)
+int us;        
+{
+  struct timeval tv;
+
+  tv.tv_sec = 0;
+  tv.tv_usec = (time_t)us;
+
+#if defined(__hpux__)
+  select(1, 0, 0, 0, &tv); 
+#else
+  select(1, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv); 
+#endif
+}
+/*--------------------------------------------------------------------------*/
+/*                        M R E A D        
+ *
+ * This function performs the function of a read(II) but will
+ * call read(II) multiple times in order to get the requested
+ * number of characters.  This can be necessary because
+ * network connections don't deliver data with the same
+ * grouping as it is written with.  Written by Robert S. Miles, BRL.
+ */
+int
+mread(int s, char* bufp, unsigned n)
+{
+  register unsigned        count = 0;
+  register int                nread;
+  
+  do
+    {
+#if defined(__NTVIS__)
+     nread = recv(s, bufp, n-count, 0);
+#else
+     nread = read(s, bufp, n-count);
+#endif /* __NTVIS__ */
+     numCalls++;
+     if(nread < 0)  {perror("ttcp_mread"); return(-1); }
+     if(nread == 0)  return((int)count);
+     count += (unsigned)nread;
+     bufp += nread;
+    }while(count < n);
+  return((int)count);
+}
+
+/*--------------------------------------------------------------------------*/
+void
+open_log()
+{static long sysTicks;
+#if defined(UNDER_CE)
+       SYSTEMTIME SystemTime;
+#endif
+ sprintf(logfile,"%s_%s",logfile_head,trans?"t":"r");
+
+ fprintf(stderr,"open the log file >%s<\n",logfile);
+ if ((fplog = fopen(logfile,"r")) == NULL)    
+       
+   {if ((fplog = fopen(logfile,"a+")) == NULL)
+     {fprintf(stderr,"Failure : creation of the file >%s< \n",logfile );
+      exit(1);
+     }
+    else 
+     {fprintf(fplog," creation date : ");
+      /* get date */
+#if defined(UNDER_CE)
+       GetLocalTime(&SystemTime);
+       sprintf(fplog,"%02d-%02d-%02d %02d:%02d\n", SystemTime.wDay, month[SystemTime.wMonth - 1],
+               SystemTime.wYear, SystemTime.wHour, SystemTime.wMinute);
+#else
+      time(&sysTicks);
+      tms = localtime(&sysTicks);
+      fprintf(fplog,"%02d-%02d-%02d %02d:%02d\n",
+              tms->tm_mday, tms->tm_mon, tms->tm_year,tms->tm_hour, tms->tm_min);
+#endif
+
+      /* An other version will produce : Mon Aug  4 16:32:16 1997
+       * long  lDxcomsTicks;  char *pDateTime; 
+       * time(&lDxcomsTicks);
+       * pDateTime = ctime(&lDxcomsTicks);  *(pDateTime+24) = '\0';
+       * fprintf(fplog," ttcp called : %s", pDateTime);
+       */
+      fprintf(fplog,"format\n");
+      fprintf(fplog,",buflen, nbuf(byte), bufalign(byte), bufoffset(byte)");
+      fprintf(fplog,",  port, sockbufsize(byte), UserTime(sec), SysTime(sec)\n");
+      fprintf(fplog,",  CPUusage(%%), Validity, nbytes(byte), realt(sec)");
+      fprintf(fplog,",  rate(MB/sec), I/O call, hours*3600+min*60+sec\n\n");
+      /* day-month-year, hour:minute\n\n");  */
+    }
+  } /* file already exist */
+   else 
+   {fclose (fplog);
+     if ((fplog = fopen(logfile,"a+")) == NULL)     
+       {fprintf(stderr,"Failure : access of the file >%s< \n",logfile );
+        exit(1);
+           }
+   }
+} 
+/*--------------------------------------------------------------------------*/
+void
+close_log()
+{
+#if defined(UNDER_CE)
+       SYSTEMTIME SystemTime;
+
+       GetLocalTime(&SystemTime);
+       fprintf(fplog," %d\n", SystemTime.wHour * 3600 + SystemTime.wMinute * 60 + SystemTime.wSecond);
+#else
+ static long sysTicks;
+ time(&sysTicks);
+ tms = localtime(&sysTicks);
+ fprintf(fplog," %d\n",((tms->tm_hour)*3600 + (tms->tm_min)*60 + tms->tm_sec));
+#endif
+ fclose(fplog);
+ fflush(fplog);
+}
+/*--------------------------------------------------------------------------*/
+/* routine emulating UNIX function under NT */
+#if defined(__NTVIS__)
+
+/*---------------------------------------------------------------------------*/
+static void
+error(char *pch)
+{
+        if (!opterr) {
+                return;                // without printing
+        }
+        fprintf(stderr, "%s: %s: %c\n",
+                (NULL != progname) ? progname : "getopt", pch, optopt);
+}
+/*---------------------------------------------------------------------------*/
+int
+getopt(int argc, char **argv, char *ostr)
+{
+  static char *place = EMSG;    /* option letter processing */
+  register char *oli;           /* option letter list index */
+
+  if (!*place) {
+    // update scanning pointer
+    if (optind >= argc || *(place = argv[optind]) != '-' || !*++place) {
+      place = EMSG;
+      return -1; 
+    }
+    // place now points to the first char past the initial '-'
+    if (place[0] == '-') {
+      // found "--"
+      // Was the word just a '--'?
+      if (place[1] == '\0')
+        ++optind; // yes, so consume the word
+      // otherwise, the '--' was the start of a longer word,
+      // so do not consume it.
+      place = EMSG;
+      return -1;
+    }
+  }
+
+  /* option letter okay? */
+  if ((optopt = (int)*place++) == (int)':'
+      || !(oli = strchr(ostr, optopt))) {
+    if (!*place) {
+      ++optind;
+    }
+    error("illegal option");
+    return BADCH;
+  }
+  if (*++oli != ':') {        
+    /* don't need argument */
+    optarg = NULL;
+    if (!*place)
+      ++optind;
+  } else {
+    /* need an argument */
+    if (*place) {
+      optarg = place;                /* no white space */
+    } else  if (argc <= ++optind) {
+      /* no arg */
+      place = EMSG;
+      error("option requires an argument");
+      return BADCH;
+    } else {
+      optarg = argv[optind];                /* white space */
+    }
+    place = EMSG;
+    ++optind;
+  }
+  return optopt;                        // return option letter
+}
+
+void
+usleep(unsigned int microseconds)
+{
+  Sleep(microseconds/1000);
+}
+#endif /* __NTVIS__ */
+/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
+void
+do_help()
+{
+char More_help[] =
+" Details about the reply: \n"
+"   Example: \n"
+"   ttcp-t: buflen=8192, nbuf=100, align=16384/0, port=5010\n"
+"   ttcp-t: File-Descriptor 0x4 Opened\n"
+"   # tcp sender -> <host> #\n"
+"   ttcp-t: 819200 bytes in 1.152557 real seconds = 694.109 KB/sec +++\n"
+"   ttcp-t: 100 I/O calls, 11.526 msec(real)/call, 0.213 msec(cpu)/call\n"
+"   ttcp-t: 0.001914user 0.019388sys 0:01real 1% 9i+58d 190maxrss 1+2pf 177+180csw\n"
+"   ttcp-t: buffer address 0x28000\n"
+"   ttcp-t: File-Descriptor  fd 0x4 Closed\n"
+"   ttcp done.\n\n"
+"cpu seconds  ==  (sec) elapse ru_utime + elapse ru_stime.\n"
+"                 ru_utime == The total amount of time running in user mode.\n"
+"                 ru_stime == The total amount of time spent in the system.\n"
+"                             executing on behalf of the process.\n"
+"real seconds ==  elapse time calculated by the system timer (date).\n"
+"I/O calls    ==  I/O call to the driver.\n"
+"msec/call    ==  average elapse time (Real seconds) between each I/O.\n"
+"calls/sec    ==  invert of msec/call.\n"
+"user         ==  (sec.msec) elaspe ru_utime.\n"
+"sys          ==  (sec.msec) elapse ru_stime.\n"
+"real         ==  (min:sec)  CPU seconds.\n"
+"%%           ==  Real seconds / CPU seconds.\n"
+"(ru_ixrss)i+(ru_idrss)d\n"
+"             ru_ixrss  == An integral value indicating the amount of memory \n"
+"                          used by the text segment that was also shared among\n"
+"                          other processes. This value is expressed in units of\n"
+"                          kilobytes * seconds-of-execution and is calculated \n"
+"                          by adding the number of shared memory pages in use \n"
+"                          each time the internal system clock ticks, and then\n"
+"                          averaging over one-second intervals.\n"
+"             ru_idrss  == An integral value of the amount of unshared memory \n"
+"                          in the data segment of a process (expressed in \n"
+"                          units of kilobytes * seconds-of-execution).\n";
+char More_help1[] =
+"  (ru_maxrss/2)maxrss.\n"
+"             ru_maxrss == The maximum size, in kilobytes, of the used\n"
+"                          resident set size. \n"
+"  (ru_majflt)+(ru_minflt)pf : Page fault\n"
+"             ru_majflt == The number of page faults serviced that required\n"
+"                          I/O activity.\n"
+"             ru_minflt == The number of page faults serviced without any\n"
+"                          I/O activity. In this case, I/O activity is \n"
+"                          avoided by reclaiming a page frame from the list \n"
+"                          of pages awaiting reallocation. \n"
+"(ru_nvcsw)+(ru_nivcsw)csw : context switch\n"
+"             ru_nvcsw  == The number of times a context switch resulted \n"
+"                          because a process voluntarily gave up the \n"
+"                          processor before its time slice was completed. \n"
+"                          This usually occurs while the process waits \n"
+"                          for availability of a resource.\n"
+"             ru_nivcsw == The number of times a context switch resulted \n"
+"                          because a higher priority process ran or because\n"
+"                          the current process exceeded its time slice.\n\n";
+
+char More_help2[] =
+"log file format :\n"
+"         buflen, nbuf(byte), bufalign(byte), bufoffset(byte)\n"
+"         port, sockbufsize(byte), UserTime(sec), SysTime(sec), CPUusage(%)\n"
+"         nbytes(byte), realt(sec), rate(MB/sec), I/O call,\n"
+"                 hours*3600+min*60+sec\n\n";
+
+  fprintf(stderr,More_help);
+  fprintf(stderr,More_help1);
+  fprintf(stderr,More_help2);
+}
+/*---------------------------------------------------------------------------*/
+void
+do_Usage()
+{
+char Usage[] =
+"  Usage: ttcp -t [-options] host [ < in ]    ttcp -r [-options > out]\n"
+"Example: ttcp -t -s -v -n100 host            ttcp -r -s -v -n100\n"
+"Common options:\n"
+"    -V      prints version number and date of last modification\n"
+"    -L      create and append all results to a file named ttcp_log\n"
+"    -h      more help\n"
+"    -l ##   length of bufs read from or written to network (default 8192,\n"
+"            max 65535)\n"
+"    -u      use UDP instead of TCP\n"
+"    -p ##   port number to send to or listen at (default 5010)\n"
+#if defined(__linux__)
+"    -P ##   link-layer priority (default 0)\n"
+#endif
+"    -s      (ttcp -t) : source a pattern to network\n"
+"            (ttcp -r) : sink (discard) all data from network\n"
+"    -A ##   align the start of buffers to this modulus (default 16384)\n"
+"    -O ##   start buffers at this offset from the modulus (default 0)\n"
+"    -v      verbose: print more statistics\n"
+"    -d      set SO_DEBUG socket option\n"
+"    -b ##   set socket buffer size (if supported)\n"
+"    -f X    format for rate: b,B = bits, bytes k,K = kilo{bits,bytes};\n"
+"                             m,M = mega{bits,bytes}; g,G = giga{bits,bytes}\n"
+"    -w ##   set timeout value (in milliseconds) to exit if no receive data or tcp connect\n"
+"Options specific to (ttcp -t) :\n"
+"    -n ##   number of source bufs written to network (default 2048)\n"
+"    -x      use random data in tcp/udp frames (-I provides seed)\n"
+"    -D      don't buffer TCP writes (sets TCP_NODELAY socket option)\n"
+"    -H      print hash marks to indicate progress, one per buffer\n"
+"    -I      init/seed value for RNG when sending random size bufs (default 1)\n"
+"    -N ##   number of source bufs per burst, i.e between sleeps (default 1)\n"
+"    -R ##   send random size buffers with minimum size specified, max size\n"
+"            is value of -l option\n"
+"    -S ##   millisecs between bursts (only used for udp, 10ms resolution)\n"
+"Options specific to (ttcp -r) :\n"
+"    -B      for -s, only output full blocks as specified by -l (for TAR)\n"
+"    -T      \"touch\": access each byte as it's read\n"
+"    -i      report information on out of order sequence numbers\n"
+#if defined(DEBUG)
+"Options for debug:\n"
+"    --nostart do not send UDP start packets\n"
+"    --noend   do not send UDP end packets\n"
+"    --nodata  do not send UDP data packets\n"
+"    --debug   print extra debug outputs\n"
+#endif /* DEBUG */
+;
+  fprintf(stderr,Usage);
+}
+
+/* Define automatic Emacs variables for consistent code formatting */
+/* Local Variables:     */
+/* c-basic-offset:2     */
+/* indent-tabs-mode:nil */
+/* End:                 */
diff --git a/net/uanytun/Makefile b/net/uanytun/Makefile
new file mode 100644 (file)
index 0000000..ce1adf0
--- /dev/null
@@ -0,0 +1,207 @@
+#
+# Copyright (C) 2008 Christian Pointner,
+#                    <equinox@anytun.org>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# This Makefile builds uAnytun Package for OpenWRT
+#
+# $Id: $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=uanytun
+PKG_VERSION:=0.3.3
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.anytun.org/download/
+PKG_MD5SUM:=ca39dab02e91b0737e2b3f0839e74f6a
+
+include $(INCLUDE_DIR)/package.mk
+
+
+define Package/uanytun/template
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=micro anycast tunneling daemon
+  URL:=http://www.anytun.org/
+  MAINTAINER:=Christian Pointner <equinox@anytun.org>
+  SUBMENU:=VPN
+endef
+
+define Package/uanytun/desc-template
+uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol.
+  SATP defines a protocol used for communication between any combination of
+  unicast and anycast tunnel endpoints.  It has less protocol overhead than
+  IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g.
+  ethernet, ip, arp ...). SATP directly includes cryptography and message
+  authentication based on the methodes used by SRTP.  It is intended to deliver
+  a generic, scaleable and secure solution for tunneling and relaying of packets
+  of any protocol.
+  Unlike Anytun which is a full featured implementation uAnytun has no support
+  for multiple connections or synchronisation. It is a small single threaded
+  implementation intended to act as a client on small platforms.
+endef
+
+
+define Package/uanytun
+  $(call Package/uanytun/template)
+  DEPENDS:=+kmod-tun +libgcrypt
+endef
+
+define Package/uanytun/conffiles
+/etc/config/uanytun
+endef
+
+define Package/uanytun/description
+  $(call Package/uanytun/desc-template)
+endef
+
+
+define Package/uanytun-sslcrypt
+  $(call Package/uanytun/template)
+  DEPENDS:=+kmod-tun +libopenssl
+endef
+
+define Package/uanytun-sslcrypt/conffiles
+/etc/config/uanytun-sslcrypt
+endef
+
+define Package/uanytun-sslcrypt/description
+  $(call Package/uanytun/desc-template)
+endef
+
+
+define Package/uanytun-nocrypt
+  $(call Package/uanytun/template)
+  DEPENDS:=+kmod-tun
+endef
+
+define Package/uanytun-nocrypt/conffiles
+/etc/config/uanytun-nocrypt
+endef
+
+define Package/uanytun-nocrypt/description
+  $(call Package/uanytun/desc-template)
+endef
+
+define Package/uanytun/configure
+       (cd $(1)/$(2)/src; \
+    touch include.mk; \
+    ln -s linux/tun.c .; \
+    echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \
+    echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \
+    echo '' >> version.h; \
+    echo '#define VERSION_STRING_0 "uanytun version '`cat $(1)/version`'"' >> version.h; \
+    echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \
+    echo '' >> version.h; \
+    echo '#endif' >> version.h \
+  )
+endef
+
+ifneq ($(CONFIG_PACKAGE_uanytun-nocrypt),)
+ define Build/Configure/uanytun-nocrypt
+       rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
+       mkdir -p $(PKG_BUILD_DIR)/uanytun-nocrypt
+       $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-nocrypt
+       $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-nocrypt)
+ endef
+
+ define Build/Compile/uanytun-nocrypt
+       $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-nocrypt/src \
+    $(TARGET_CONFIGURE_OPTS) \
+    NO_CRYPT_OBJ=1 \
+    TARGET=Linux \
+    CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \
+    LDFLAGS="$(TARGET_LDFLAGS) -ldl"
+       $(STRIP) $(PKG_BUILD_DIR)/uanytun-nocrypt/src/uanytun
+ endef
+endif
+
+ifneq ($(CONFIG_PACKAGE_uanytun-sslcrypt),)
+ define Build/Configure/uanytun-sslcrypt
+       rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
+       mkdir -p $(PKG_BUILD_DIR)/uanytun-sslcrypt
+       $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-sslcrypt
+       $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-sslcrypt)
+ endef
+
+ define Build/Compile/uanytun-sslcrypt
+       $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-sslcrypt/src \
+    $(TARGET_CONFIGURE_OPTS) \
+    TARGET=Linux \
+    CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \
+    LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto"
+       $(STRIP) $(PKG_BUILD_DIR)/uanytun-sslcrypt/src/uanytun
+ endef
+endif
+
+ifneq ($(CONFIG_PACKAGE_uanytun),)
+ define Build/Configure/uanytun-default
+       rm -rf $(PKG_BUILD_DIR)/uanytun
+       mkdir -p $(PKG_BUILD_DIR)/uanytun
+       $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun
+       $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun)
+ endef
+
+ define Build/Compile/uanytun-default
+       $(MAKE) -C $(PKG_BUILD_DIR)/uanytun/src \
+    $(TARGET_CONFIGURE_OPTS) \
+    TARGET=Linux \
+    CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
+    LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpg-error"
+       $(STRIP) $(PKG_BUILD_DIR)/uanytun/src/uanytun
+ endef
+endif
+
+
+define Build/Configure
+       $(call Build/Configure/uanytun-nocrypt)
+       $(call Build/Configure/uanytun-sslcrypt)
+       $(call Build/Configure/uanytun-default)
+endef
+
+define Build/Compile
+       $(call Build/Compile/uanytun-nocrypt)
+       $(call Build/Compile/uanytun-sslcrypt)
+       $(call Build/Compile/uanytun-default)
+endef
+
+define Build/Clean
+       rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt
+       rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt
+       rm -rf $(PKG_BUILD_DIR)/uanytun
+endef
+
+
+
+define Package/uanytun/install-generic
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2)
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/uanytun $(1)/usr/sbin/$(2)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2)
+       @sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2)
+endef
+
+define Package/uanytun/install
+  $(call Package/uanytun/install-generic,$(1),uanytun,uanytun.config)
+endef
+
+define Package/uanytun-sslcrypt/install
+  $(call Package/uanytun/install-generic,$(1),uanytun-sslcrypt,uanytun.config)
+endef
+
+define Package/uanytun-nocrypt/install
+  $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt,uanytun-nocrypt.config)
+endef
+
+
+
+$(eval $(call BuildPackage,uanytun))
+$(eval $(call BuildPackage,uanytun-sslcrypt))
+$(eval $(call BuildPackage,uanytun-nocrypt))
diff --git a/net/uanytun/files/uanytun-nocrypt.config b/net/uanytun/files/uanytun-nocrypt.config
new file mode 100644 (file)
index 0000000..9792d1f
--- /dev/null
@@ -0,0 +1,88 @@
+config "client1"
+  option disabled 0
+  option username 'nobody'
+  option groupname 'nogroup'
+#  option chroot "/var/run/uanytun"
+
+#  option interface '<ip-address>'
+#  option port '4444'
+#  option sender_id '1'
+
+#  option dev 'anytun0'
+  option type 'tun'
+  option ifconfig '192.168.123.1/24'
+#  option post-up-script '/etc/uanytun/client1-post-up.sh'
+
+  option remote_host 'example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option mux 1
+
+  option log 'syslog:3,anytun-client1,daemon'
+
+
+config "client2"
+  option disabled 1
+  option username 'nobody'
+  option groupname 'nogroup'
+
+  option type 'tun'
+  option ifconfig '192.168.123.2/24'
+
+  option remote_host 'example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option mux 2
+
+  option log 'syslog:3,anytun-client2,daemon'
+
+
+config "client3"
+  option disabled 1
+  option username 'nobody'
+  option groupname 'nogroup'
+
+  option type 'tun'
+  option ifconfig '192.168.123.3/24'
+
+  option remote_host 'example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option mux 3
+
+  option log 'syslog:3,anytun-client3,daemon'
+
+
+config "p2p-a"
+  option disabled 1
+  option username 'nobody'
+  option groupname 'nogroup'
+
+  option type 'tun'
+  option ifconfig '192.168.223.1/24'
+
+  option remote_host 'p2p-b.example.com'
+  option remote_port '4444'
+
+  option window_size 0
+
+  option log 'syslog:3,anytun-p2p-a,daemon'
+
+
+config "p2p-b"
+  option disabled 1
+  option username 'nobody'
+  option groupname 'nogroup'
+
+  option type 'tun'
+  option ifconfig '192.168.223.2/24'
+
+  option remote_host 'p2p-a.example.com'
+  option remote_port '4444'
+
+  option window_size 0
+
+  option log 'syslog:3,anytun-p2p-b,daemon'
diff --git a/net/uanytun/files/uanytun.config b/net/uanytun/files/uanytun.config
new file mode 100644 (file)
index 0000000..c53db37
--- /dev/null
@@ -0,0 +1,116 @@
+config "client1"
+  option disabled 0
+#  option username 'nobody'
+#  option groupname 'nogroup'
+#  option chroot "/var/run/uanytun"
+
+#  option interface '<ip-address>'
+#  option port '4444'
+#  option sender_id '1'
+
+  option cipher 'aes-ctr'
+#  option cipher 'null'
+#  option cipher 'aes-ctr-128'
+#  option cipher 'aes-ctr-192'
+#  option cipher 'aes-ctr-256'
+  option auth_algo 'sha1'
+#  option auth_algo 'null'
+#  option auth_tag_length 10
+
+#  option dev 'anytun0'
+  option type 'tun'
+  option ifconfig '192.168.123.1/24'
+#  option post-up-script '/etc/uanytun/client1-post-up.sh'
+
+  option remote_host 'example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option mux 1
+
+  option role 'client'
+#  option kd_prf 'null'
+#  option kd_prf 'aes-ctr'
+#  option kd_prf 'aes-ctr-128'
+#  option kd_prf 'aes-ctr-192'
+#  option kd_prf 'aes-ctr-256'
+#  option ld_kdr '0'
+#  option key '0123456789ABCDEF0123456789ABCDEF'
+#  option salt '0123456789ABCD0123456789ABCD'
+  option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy'
+
+  option log 'syslog:3,anytun-client1,daemon'
+
+
+config "client2"
+  option disabled 1
+
+  option cipher 'aes-ctr'
+  option auth_algo 'sha1'
+  option type 'tun'
+  option ifconfig '192.168.123.2/24'
+
+  option remote_host 'example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option mux 2
+  option role 'client'
+  option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy'
+
+  option log 'syslog:3,anytun-client2,daemon'
+
+
+config "client3"
+  option disabled 1
+
+  option cipher 'aes-ctr'
+  option auth_algo 'sha1'
+  option type 'tun'
+  option ifconfig '192.168.123.3/24'
+
+  option remote_host 'example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option mux 3
+  option role 'client'
+  option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy'
+
+  option log 'syslog:3,anytun-client3,daemon'
+
+
+config "p2p-a"
+  option disabled 1
+
+  option cipher 'aes-ctr'
+  option auth_algo 'sha1'
+  option type 'tun'
+  option ifconfig '192.168.223.1/24'
+
+  option remote_host 'p2p-b.example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option role 'alice'
+  option passphrase 'Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy'
+
+  option log 'syslog:3,anytun-p2p-a,daemon'
+
+
+config "p2p-b"
+  option disabled 1
+
+  option cipher 'aes-ctr'
+  option auth_algo 'sha1'
+  option type 'tun'
+  option ifconfig '192.168.223.2/24'
+
+  option remote_host 'p2p-a.example.com'
+  option remote_port '4444'
+
+  option window_size 0
+  option role 'bob'
+  option passphrase 'Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy'
+
+  option log 'syslog:3,anytun-p2p-b,daemon'
diff --git a/net/uanytun/files/uanytun.init b/net/uanytun/files/uanytun.init
new file mode 100644 (file)
index 0000000..59e1c23
--- /dev/null
@@ -0,0 +1,104 @@
+#!/bin/sh /etc/rc.common
+START=50
+
+BIN=uanytun
+DAEMON=/usr/sbin/$BIN
+DESC=$BIN
+RUN_D=/var/run
+
+
+option_cb() {
+  local varname="$1"
+  local value="$2"
+
+  if ! echo "$CONFIG_OPTIONS" | grep " $varname " > /dev/null; then
+    CONFIG_OPTIONS="$CONFIG_OPTIONS $varname "
+  fi
+}
+
+foreach_config_forced() {
+  foreach_config $1 "forced"
+}
+
+foreach_config() {
+  local cfg="$1"
+  local name
+  local option
+  local value
+  local args=""
+  local forced=0
+
+  if [ -n "$2" ] && [ "x$2" == "xforced" ]; then
+    forced=1
+  fi
+
+  config_get name "$cfg" TYPE
+  for option in $CONFIG_OPTIONS
+  do
+    config_get value "$cfg" "$option"
+    if [ "x$option" == "xdisabled" ]; then
+      if [ $forced -eq 0 ] && [ $value -eq 1 ]; then
+        echo -n " $name(disabled)"
+        return
+      fi
+      continue
+    fi
+
+    option=`echo $option | tr '_' '-'`
+    if [ -n "$value" ]; then
+      args="$args --$option $value"
+    fi
+  done
+  echo -n " $name"
+  local status="OK"
+  $DAEMON --write-pid "$RUN_D/$BIN.$name.pid" $args || status="failed"
+  echo -n "($status)"
+}
+
+stop_vpn() {
+  local name=$1
+  local pidfile=$RUN_D/$BIN.$name.pid
+  echo -n " $name"
+  local status="OK"
+  if [ ! -f "$pidfile" ]; then
+    status="tunnel not active"    
+  else
+    kill `cat $pidfile` > /dev/null 2>&1 || status="failed"
+    rm -f $pidfile
+  fi
+  echo -n "($status)"
+}
+
+start() {
+  echo -n "Starting $DESC:"
+  config_load $BIN  
+  if [ $# -gt 0 ]; then
+    while [ $# -gt 0 ]; do
+      config_foreach foreach_config_forced "$1"
+      shift
+    done
+  else
+    config_foreach foreach_config ""
+  fi
+  echo "."
+}
+
+stop() {
+  echo -n "Stopping $DESC:"
+  local name
+  local pidfile
+
+  if [ $# -gt 0 ]; then
+    while [ $# -gt 0 ]; do
+      stop_vpn $1
+      shift
+    done
+  else
+    for pidfile in `ls $RUN_D/$BIN.*.pid 2> /dev/null`; do
+      name=${pidfile%%.pid}
+      name=${name##$RUN_D/$BIN.}
+      stop_vpn $name
+    done
+  fi
+  echo "."
+}
diff --git a/net/ucarp/Makefile b/net/ucarp/Makefile
new file mode 100644 (file)
index 0000000..67afdfc
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2010 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:=ucarp
+PKG_VERSION:=1.5.2
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.pureftpd.org/pub/ucarp
+PKG_MD5SUM:=723636dbf79fc6abd329a71ec4ddf79d
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ucarp
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Lets several hosts share one IP
+  DEPENDS:=+ip +libpcap
+  URL:=http://www.ucarp.org/project/ucarp
+endef
+
+define Package/ucarp/description
+ ucarp allows a couple of hosts to share common virtual IP addresses in order
+ to provide automatic failover. It is a portable userland implementation of the
+ secure and patent-free Common Address Redundancy Protocol
+endef
+
+define Package/ucarp/conffiles
+/etc/ucarp.conf
+endef
+
+define Package/ucarp/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/ucarp.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ucarp.init $(1)/etc/init.d/ucarp
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ucarp $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ucarp))
diff --git a/net/ucarp/files/ucarp.conf b/net/ucarp/files/ucarp.conf
new file mode 100644 (file)
index 0000000..86480f5
--- /dev/null
@@ -0,0 +1,22 @@
+# Run in background
+BACKGROUND=1
+
+# Interface to run CARP on
+IF=br-lan
+
+# Virtual IP shared with the other system
+VIP=10.0.0.117
+
+# Size of the network mask for the virtual IP
+VMASK=24
+
+# Real, static IP of this host
+MYIP=192.168.1.20
+
+# Password shared with the other system
+PASSWORD=love
+
+# IP addresses to arping after taking over the shared IP,
+# you should list all known systems, those not listed can
+# take up to a minute to notice the change.
+PINGIP="10.0.0.1 10.0.0.20"
diff --git a/net/ucarp/files/ucarp.init b/net/ucarp/files/ucarp.init
new file mode 100644 (file)
index 0000000..c00baf4
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+CONF=/etc/ucarp.conf
+IP=$(which ip)
+UCARP=$(which ucarp)
+ARPING=$(which arping)
+
+start() {
+       . ${CONF}
+
+       [ ${BACKGROUND} = 1 ] && daemon="--daemonize"
+
+       cat > /var/run/ucarp-vip-up <<EOF
+#!/bin/sh
+
+$IP addr add ${VIP}/${VMASK} dev ${IF}
+
+EOF
+       for ip in ${PINGIP}
+       do
+       cat >> /var/run/ucarp-vip-up <<EOF
+$ARPING -c 2 -I ${IF} -s ${VIP} ${ip}
+EOF
+       done
+       chmod a+x /var/run/ucarp-vip-up
+
+       cat > /var/run/ucarp-vip-down <<EOF
+#!/bin/sh
+
+$IP addr del ${VIP}/${VMASK} dev ${IF}
+
+EOF
+       chmod a+x /var/run/ucarp-vip-down
+
+       $UCARP --interface=${IF} --srcip=${MYIP} --vhid=1 --pass=${PASSWORD} \
+                       --addr=${VIP} --nomcast $daemon \
+                       --upscript=/var/run/ucarp-vip-up --downscript=/var/run/ucarp-vip-down
+}
+
+stop() {
+       killall ucarp
+}
diff --git a/net/ucarp/patches/100-configure-cross-compilation.patch b/net/ucarp/patches/100-configure-cross-compilation.patch
new file mode 100644 (file)
index 0000000..f6b0a14
--- /dev/null
@@ -0,0 +1,178 @@
+--- a/configure
++++ b/configure
+@@ -30129,174 +30129,11 @@ _ACEOF
+ fi
+-{ $as_echo "$as_me:$LINENO: checking whether snprintf is C99 conformant" >&5
+-$as_echo_n "checking whether snprintf is C99 conformant... " >&6; }
+-if test "$cross_compiling" = yes; then
+-  { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&5
+-$as_echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-
+-#include <stdio.h>
+-#ifdef STDC_HEADERS
+-# include <stdlib.h>
+-# include <stddef.h>
+-#else
+-# if HAVE_STDLIB_H
+-#  include <stdlib.h>
+-# endif
+-#endif
+-#ifdef HAVE_UNISTD_H
+-# include <unistd.h>
+-#endif
+-
+-int main(void)
+-{
+-    char buf[4];
+-
+-    (void) fprintf(fopen("conftestval", "w"), "%d\n",
+-        (int) snprintf(buf, sizeof buf, "12345678"));
+-    return 0;
+-}
+-
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  CONF_SNPRINTF_TYPE=`cat conftestval`
+-
+-else
+-  $as_echo "$as_me: program exited with status $ac_status" >&5
+-$as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-fi
+-rm -rf conftest.dSYM
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-
+-{ $as_echo "$as_me:$LINENO: result: done" >&5
+-$as_echo "done" >&6; }
+-if test "x$CONF_SNPRINTF_TYPE" = "x" ; then
+-  { $as_echo "$as_me:$LINENO: WARNING: your operating system doesn't implement snprintf" >&5
+-$as_echo "$as_me: WARNING: your operating system doesn't implement snprintf" >&2;}
+-else
+-
+ cat >>confdefs.h <<_ACEOF
+-#define CONF_SNPRINTF_TYPE $CONF_SNPRINTF_TYPE
+-_ACEOF
+-
+-fi
+-
+-{ $as_echo "$as_me:$LINENO: checking whether you already have a standard SHA1 implementation" >&5
+-$as_echo_n "checking whether you already have a standard SHA1 implementation... " >&6; }
+-if test "$cross_compiling" = yes; then
+-  { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&5
+-$as_echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-
+-#include <stdio.h>
+-#include <string.h>
+-#include <sys/types.h>
+-#include <sha1.h>
+-
+-int main(void)
+-{
+-    SHA1_CTX ctx;
+-    char b[41];
+-
+-    SHA1Init(&ctx);
+-    SHA1Update(&ctx, (const unsigned char *) "test", 4U);
+-    SHA1End(&ctx, b);
+-    b[40] = 0;
+-
+-    return strcasecmp(b, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3");
+-}
+-
+-_ACEOF
+-rm -f conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_link") 2>&5
+-  ac_status=$?
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+-$as_echo "$ac_try_echo") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-
+-{ $as_echo "$as_me:$LINENO: result: yes" >&5
+-$as_echo "yes" >&6; }
+-
+-cat >>confdefs.h <<\_ACEOF
+-#define USE_SYSTEM_CRYPT_SHA1 /**/
++#define CONF_SNPRINTF_TYPE 1
+ _ACEOF
+-else
+-  $as_echo "$as_me: program exited with status $ac_status" >&5
+-$as_echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-( exit $ac_status )
+-{ $as_echo "$as_me:$LINENO: result: no" >&5
+-$as_echo "no" >&6; }
+-
+-fi
+-rm -rf conftest.dSYM
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
+-
+-
+ { $as_echo "$as_me:$LINENO: checking whether syslog names are available" >&5
+ $as_echo_n "checking whether syslog names are available... " >&6; }
diff --git a/net/ucspi-tcp/Makefile b/net/ucspi-tcp/Makefile
new file mode 100644 (file)
index 0000000..b9ad9cf
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+# Original port by FreeWRT project.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Alexander Tsvyashchenko       Created OpenWRT package as per Trac ticket 2497
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ucspi-tcp
+PKG_VERSION:=0.88
+PKG_RELEASE:=1
+
+PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
+PKG_SOURCE_URL:=http://cr.yp.to/ucspi-tcp/
+PKG_MD5SUM:=39b619147db54687c4a583a7a94c9163
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ucspi-tcp
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=
+  TITLE:=UNIX Client-Server Program Interface for TCP
+  URL:=http://cr.yp.to/ucspi-tcp.html
+endef
+
+define Package/PKG_NAME/description.
+       tcpserver and tcpclient are command-line tools for building
+       TCP client-server applications.
+endef
+
+define Build/Compile
+       TARGET_CC="$(TARGET_CC)" \
+       TARGET_CFLAGS="$(TARGET_CFLAGS)" \
+       TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
+       TARGET_RANLIB="$(TARGET_CROSS)ranlib" \
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/ucspi-tcp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       (cd $(PKG_BUILD_DIR); \
+       $(INSTALL_BIN) tcpserver tcprules tcprulescheck argv0 recordio \
+               tcpclient who@ date@ finger@ http@ tcpcat mconnect mconnect-io \
+               addcr delcr fixcrio rblsmtpd \
+       $(1)/usr/bin)
+endef
+
+$(eval $(call BuildPackage,ucspi-tcp))
+
diff --git a/net/ucspi-tcp/patches/100-cross_compile.patch b/net/ucspi-tcp/patches/100-cross_compile.patch
new file mode 100644 (file)
index 0000000..a688ea9
--- /dev/null
@@ -0,0 +1,196 @@
+--- a/Makefile
++++ b/Makefile
+@@ -36,10 +36,6 @@ auto-str.o: \
+ compile auto-str.c buffer.h readwrite.h exit.h
+       ./compile auto-str.c
+-auto_home.c: \
+-auto-str conf-home
+-      ./auto-str auto_home `head -1 conf-home` > auto_home.c
+-
+ auto_home.o: \
+ compile auto_home.c
+       ./compile auto_home.c
+@@ -305,10 +301,6 @@ fmt_ulong.o: \
+ compile fmt_ulong.c fmt.h
+       ./compile fmt_ulong.c
+-fork.h: \
+-choose compile load tryvfork.c fork.h1 fork.h2
+-      ./choose cl tryvfork fork.h1 fork.h2 > fork.h
+-
+ getln.o: \
+ compile getln.c byte.h getln.h buffer.h stralloc.h gen_alloc.h
+       ./compile getln.c
+@@ -317,24 +309,6 @@ getln2.o: \
+ compile getln2.c byte.h getln.h buffer.h stralloc.h gen_alloc.h
+       ./compile getln2.c
+-hassgact.h: \
+-choose compile load trysgact.c hassgact.h1 hassgact.h2
+-      ./choose cl trysgact hassgact.h1 hassgact.h2 > hassgact.h
+-
+-hassgprm.h: \
+-choose compile load trysgprm.c hassgprm.h1 hassgprm.h2
+-      ./choose cl trysgprm hassgprm.h1 hassgprm.h2 > hassgprm.h
+-
+-hasshsgr.h: \
+-choose compile load tryshsgr.c hasshsgr.h1 hasshsgr.h2 chkshsgr \
+-warn-shsgr
+-      ./chkshsgr || ( cat warn-shsgr; exit 1 )
+-      ./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h
+-
+-haswaitp.h: \
+-choose compile load trywaitp.c haswaitp.h1 haswaitp.h2
+-      ./choose cl trywaitp haswaitp.h1 haswaitp.h2 > haswaitp.h
+-
+ hier.o: \
+ compile hier.c auto_home.h
+       ./compile hier.c
+@@ -362,10 +336,6 @@ instcheck.o: \
+ compile instcheck.c strerr.h error.h readwrite.h exit.h
+       ./compile instcheck.c
+-iopause.h: \
+-choose compile trypoll.c iopause.h1 iopause.h2
+-      ./choose clr trypoll iopause.h1 iopause.h2 > iopause.h
+-
+ iopause.o: \
+ compile iopause.c taia.h tai.h uint64.h select.h iopause.h taia.h
+       ./compile iopause.c
+@@ -404,7 +374,7 @@ warn-auto.sh systype
+       dgux-*) ;; \
+       hp-ux-*) ;; \
+       sco*) ;; \
+-      *) echo 'ranlib "$$main"' ;; \
++      *) echo '$(if $(TARGET_RANLIB),$(TARGET_RANLIB),ranlib) "$$main"' ;; \
+       esac \
+       ) > makelib
+       chmod 755 makelib
+@@ -521,10 +491,6 @@ seek_set.o: \
+ compile seek_set.c seek.h
+       ./compile seek_set.c
+-select.h: \
+-choose compile trysysel.c select.h1 select.h2
+-      ./choose c trysysel select.h1 select.h2 > select.h
+-
+ setup: \
+ it install
+       ./install
+@@ -791,10 +757,6 @@ uint32_unpack.o: \
+ compile uint32_unpack.c uint32.h
+       ./compile uint32_unpack.c
+-uint64.h: \
+-choose compile load tryulong64.c uint64.h1 uint64.h2
+-      ./choose clr tryulong64 uint64.h1 uint64.h2 > uint64.h
+-
+ unix.a: \
+ makelib alloc.o alloc_re.o buffer.o buffer_0.o buffer_1.o buffer_2.o \
+ buffer_copy.o buffer_get.o buffer_put.o env.o error.o error_str.o \
+--- /dev/null
++++ b/auto_home.c
+@@ -0,0 +1,3 @@
++const char auto_home[] = "\
++\057\165\163\162\
++";
+--- a/conf-cc
++++ b/conf-cc
+@@ -1,3 +1,3 @@
+-gcc -O2
++$TARGET_CC $TARGET_CFLAGS -include errno.h
+ This will be used to compile .c files.
+--- a/conf-home
++++ b/conf-home
+@@ -1,4 +1,4 @@
+-/usr/local
++/usr
+ This is the ucspi-tcp home directory. Programs will be installed in
+ .../bin.
+--- a/conf-ld
++++ b/conf-ld
+@@ -1,3 +1,3 @@
+-gcc -s
++$TARGET_CC -s $TARGET_LDFLAGS
+ This will be used to link .o files into an executable.
+--- /dev/null
++++ b/fork.h
+@@ -0,0 +1,9 @@
++#ifndef FORK_H
++#define FORK_H
++
++/* sysdep: +vfork */
++
++extern int fork();
++extern int vfork();
++
++#endif
+--- /dev/null
++++ b/hassgact.h
+@@ -0,0 +1,2 @@
++/* sysdep: +sigaction */
++#define HASSIGACTION 1
+--- /dev/null
++++ b/hassgprm.h
+@@ -0,0 +1,2 @@
++/* sysdep: +sigprocmask */
++#define HASSIGPROCMASK 1
+--- /dev/null
++++ b/hasshsgr.h
+@@ -0,0 +1 @@
++/* sysdep: -shortsetgroups */
+--- /dev/null
++++ b/haswaitp.h
+@@ -0,0 +1,2 @@
++/* sysdep: +waitpid */
++#define HASWAITPID 1
+--- /dev/null
++++ b/iopause.h
+@@ -0,0 +1,18 @@
++#ifndef IOPAUSE_H
++#define IOPAUSE_H
++
++/* sysdep: +poll */
++#define IOPAUSE_POLL
++
++#include <sys/types.h>
++#include <poll.h>
++
++typedef struct pollfd iopause_fd;
++#define IOPAUSE_READ POLLIN
++#define IOPAUSE_WRITE POLLOUT
++
++#include "taia.h"
++
++extern void iopause(iopause_fd *,unsigned int,struct taia *,struct taia *);
++
++#endif
+--- /dev/null
++++ b/select.h
+@@ -0,0 +1,11 @@
++#ifndef SELECT_H
++#define SELECT_H
++
++/* sysdep: +sysselect */
++
++#include <sys/types.h>
++#include <sys/time.h>
++#include <sys/select.h>
++extern int select();
++
++#endif
+--- /dev/null
++++ b/uint64.h
+@@ -0,0 +1,8 @@
++#ifndef UINT64_H
++#define UINT64_H
++
++/* sysdep: -ulong64 */
++
++typedef unsigned long long uint64;
++
++#endif
diff --git a/net/udp-broadcast-relay/Makefile b/net/udp-broadcast-relay/Makefile
new file mode 100644 (file)
index 0000000..6737da4
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006-2014 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:=udp-broadcast-relay
+PKG_VERSION:=0.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.joachim-breitner.de/udp-broadcast-relay/files/
+PKG_MD5SUM:=a32f983b7063d6ac670e6b22be9b9d24
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/udp-broadcast-relay
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  TITLE:=listens for packets on a specified UDP broadcast port
+  URL:=http://www.joachim-breitner.de/udp-broadcast-relay/
+endef
+
+define Package/udp-broadcast-relay/description
+       This program listens for packets on a specified UDP broadcast port.
+       When a packet is received, it sends that packet to all specified interfaces but
+       the one it came from as though it originated from the original sender.
+       The primary purpose of this is to allow games on machines on separated
+       local networks (Ethernet, WLAN) that use udp broadcasts to find each other to do so.
+       It also works on ppp links, so you can log in from windows boxes (e.g. using pptp)
+       and play LAN-based games together. Currently, you have to care about upcoming or
+       downgoing interfaces yourself.
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/main.c -o $(PKG_BUILD_DIR)/$(PKG_NAME)
+endef
+
+define Package/udp-broadcast-relay/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,udp-broadcast-relay))
diff --git a/net/udpcast/Makefile b/net/udpcast/Makefile
new file mode 100644 (file)
index 0000000..5ad15c9
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 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:=udpcast
+PKG_RELEASE:=1
+PKG_VERSION:=20100130
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://udpcast.linux.lu/download/
+PKG_MD5SUM:=f9ad942dfe3ecbd2da5d91479957e5a9
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/udpcast
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=UDP Cast
+  URL:=http://udpcast.linux.lu/
+  DEPENDS:=+libpthread
+endef
+
+define Package/udpcast/description
+  UDPcast is a file transfer tool that can send data simultaneously to many destinations on a LAN.
+endef
+
+define Package/udpcast/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(PKG_BUILD_DIR)/udp-receiver \
+               $(1)/usr/sbin/
+       $(INSTALL_BIN) \
+               $(PKG_BUILD_DIR)/udp-sender \
+               $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,udpcast))
diff --git a/net/uftp/Makefile b/net/uftp/Makefile
new file mode 100644 (file)
index 0000000..879c0d4
--- /dev/null
@@ -0,0 +1,165 @@
+#
+# Copyright (C) 2011-2014 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:=uftp
+PKG_VERSION:=4.1.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar
+PKG_SOURCE_URL:=@SF/uftp-multicast
+PKG_MD5SUM:=6d2134245bf463dcf1fab06e2a68ad5a
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/uftp/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  TITLE:=Multicast UDP FTP
+  URL:=http://uftp-multicast.sourceforge.net/
+endef
+
+define Package/uftp/Default/description
+  UFTP is an encrypted multicast file transfer program, designed to securely,
+  reliably, and efficiently transfer files to multiple receivers
+  simultaneously.
+endef
+
+define Package/uftp
+  $(call Package/uftp/Default)
+  TITLE+= server with TLS support
+  VARIANT:=tls
+  DEPENDS:=+libopenssl +libpthread
+endef
+
+define Package/uftp/description
+  $(call Package/uftp/Default/description)
+  This package contains the server built with TLS support.
+endef
+
+define Package/uftp-notls
+  $(call Package/uftp/Default)
+  TITLE+= server without TLS support
+  VARIANT:=notls
+  DEPENDS:=+libpthread
+endef
+
+define Package/uftp-notls/description
+  $(call Package/uftp/Default/description)
+  This package contains the server built without TLS support.
+endef
+
+define Package/uftpd
+  $(call Package/uftp/Default)
+  TITLE+= client daemon with TLS support
+  VARIANT:=tls
+  DEPENDS:=+libopenssl
+endef
+
+define Package/uftpd/description
+  $(call Package/uftp/Default/description)
+  This package contains the client daemon built with TLS support.
+endef
+
+define Package/uftpd-notls
+  $(call Package/uftp/Default)
+  TITLE+= client daemon without TLS support
+  VARIANT:=notls
+endef
+
+define Package/uftpd-notls/description
+  $(call Package/uftp/Default/description)
+  This package contains the client daemon built without TLS support.
+endef
+
+define Package/uftpproxyd
+  $(call Package/uftp/Default)
+  TITLE+= proxy daemon with TLS support
+  VARIANT:=tls
+  DEPENDS:=+libopenssl
+endef
+
+define Package/uftpproxyd/description
+  $(call Package/uftp/Default/description)
+  This package contains the proxy daemon built with TLS support.
+endef
+
+define Package/uftpproxyd-notls
+  $(call Package/uftp/Default)
+  TITLE+= proxy daemon without TLS support
+  VARIANT:=notls
+endef
+
+define Package/uftpproxyd-notls/description
+  $(call Package/uftp/Default/description)
+  This package contains the proxy daemon built without TLS support.
+endef
+
+define Package/uftp-keymgt
+  $(call Package/uftp/Default)
+  TITLE+= key management utility
+  VARIANT:=tls
+  DEPENDS:=+libopenssl
+endef
+
+define Package/uftp-keymgt/description
+  $(call Package/uftp/Default/description)
+  This package contains the key management utility.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+       UNAME_S="Linux"
+
+ifeq ($(BUILD_VARIANT),tls)
+       MAKE_FLAGS += \
+               NO_EC="1" \
+               OPENSSL="$(STAGING_DIR)/usr"
+endif
+
+ifeq ($(BUILD_VARIANT),notls)
+       MAKE_FLAGS += \
+               NO_ENCRYPTION="1"
+endif
+
+define Package/uftp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/uftp $(1)/usr/bin/
+endef
+
+define Package/uftpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/uftpd $(1)/usr/sbin/
+endef
+
+define Package/uftpproxyd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/uftpproxyd $(1)/usr/sbin/
+endef
+
+Package/uftp-notls/install=$(Package/uftp/install)
+Package/uftpd-notls/install=$(Package/uftpd/install)
+Package/uftpproxyd-notls/install=$(Package/uftpproxyd/install)
+
+define Package/uftp-keymgt/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/uftp_keymgt $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,uftp))
+$(eval $(call BuildPackage,uftp-notls))
+$(eval $(call BuildPackage,uftpd))
+$(eval $(call BuildPackage,uftpd-notls))
+$(eval $(call BuildPackage,uftpproxyd))
+$(eval $(call BuildPackage,uftpproxyd-notls))
+$(eval $(call BuildPackage,uftp-keymgt))
diff --git a/net/uhub/Makefile b/net/uhub/Makefile
new file mode 100644 (file)
index 0000000..9b5bcb0
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2009-2012 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:=uhub
+PKG_VERSION:=0.2.8
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.gz
+PKG_SOURCE_URL:=http://www.extatic.org/downloads/uhub/
+PKG_MD5SUM:=45d35d9757bc0a84297dec51520f725b
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/uhub
+  SUBMENU:=P2P
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libevent
+  TITLE:=High performance ADC hub
+  URL:=http://www.extatic.org/uhub/
+endef
+
+define Package/uhub/description
+       uhub is a high performance peer-to-peer hub for the ADC network.
+        Its low memory footprint allows it to handle several thousand users
+        on high-end servers, or a small private hub on embedded hardware.
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libevent
+TARGET_LDFLAGS = -L$(STAGING_DIR)/usr/lib/libevent -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
+ifdef CONFIG_USE_EGLIBC
+TARGET_LDFLAGS += -lrt
+endif
+
+define Package/uhub/install
+       $(INSTALL_DIR) $(1)/usr/local/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhub $(1)/usr/local/bin/
+       $(INSTALL_DIR) $(1)/etc/uhub/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/uhub.conf $(1)/etc/uhub/
+endef
+
+define Package/uhub/conffiles
+/etc/uhub/uhub.conf
+endef
+
+$(eval $(call BuildPackage,uhub))
diff --git a/net/uhub/patches/100-user_struct.patch b/net/uhub/patches/100-user_struct.patch
new file mode 100644 (file)
index 0000000..62fb992
--- /dev/null
@@ -0,0 +1,1664 @@
+--- a/src/auth.c
++++ b/src/auth.c
+@@ -70,7 +70,7 @@
+ {
+       char* data;
+       char* data_extra;
+-      struct user_access_info* info = 0;
++      struct uhub_user_access_info* info = 0;
+       
+       if (!strncmp(line, cmd, strlen(cmd)))
+       {
+@@ -86,7 +86,7 @@
+                       return -1;
+               }
+               
+-              info = hub_malloc_zero(sizeof(struct user_access_info));
++              info = hub_malloc_zero(sizeof(struct uhub_user_access_info));
+               
+               if (!info)
+               {
+@@ -340,7 +340,7 @@
+ static void acl_free_access_info(void* ptr)
+ {
+-      struct user_access_info* info = (struct user_access_info*) ptr;
++      struct uhub_user_access_info* info = (struct uhub_user_access_info*) ptr;
+       if (info)
+       {
+               hub_free(info->username);
+@@ -404,16 +404,16 @@
+ }
+-struct user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name)
++struct uhub_user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name)
+ {
+-      struct user_access_info* info = (struct user_access_info*) list_get_first(handle->users);
++      struct uhub_user_access_info* info = (struct uhub_user_access_info*) list_get_first(handle->users);
+       while (info)
+       {
+               if (strcasecmp(info->username, name) == 0)
+               {
+                       return info;
+               }
+-              info = (struct user_access_info*) list_get_next(handle->users);
++              info = (struct uhub_user_access_info*) list_get_next(handle->users);
+       }
+       return NULL;
+ }
+@@ -492,7 +492,7 @@
+  * seconds since the unix epoch (modulus 1 million)
+  * and the SID of the user (0-1 million).
+  */
+-const char* password_generate_challenge(struct user* user)
++const char* password_generate_challenge(struct uhub_user* user)
+ {
+       char buf[32];
+       uint64_t tiger_res[3];
+@@ -511,10 +511,10 @@
+ }
+-int password_verify(struct user* user, const char* password)
++int password_verify(struct uhub_user* user, const char* password)
+ {
+       char buf[1024];
+-      struct user_access_info* access;
++      struct uhub_user_access_info* access;
+       const char* challenge;
+       char raw_challenge[64];
+       char password_calc[64];
+--- a/src/auth.h
++++ b/src/auth.h
+@@ -21,7 +21,7 @@
+ #define HAVE_UHUB_ACL_H
+ struct hub_config;
+-struct user;
++struct uhub_user;
+ struct ip_addr_encap;
+ enum password_status
+@@ -50,7 +50,7 @@
+ const char* get_user_credential_string(enum user_credentials cred);
+-struct user_access_info
++struct uhub_user_access_info
+ {
+       char* username;          /* name of user, cid or IP range */
+       char* password;          /* password */
+@@ -77,7 +77,7 @@
+ extern int acl_initialize(struct hub_config* config, struct acl_handle* handle);
+ extern int acl_shutdown(struct acl_handle* handle);
+-extern struct user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name);
++extern struct uhub_user_access_info* acl_get_access_info(struct acl_handle* handle, const char* name);
+ extern int acl_is_cid_banned(struct acl_handle* handle, const char* cid);
+ extern int acl_is_ip_banned(struct acl_handle* handle, const char* ip_address);
+ extern int acl_is_ip_nat_override(struct acl_handle* handle, const char* ip_address);
+@@ -87,7 +87,7 @@
+ extern int acl_check_ip_range(struct ip_addr_encap* addr, struct ip_ban_record* info);
+-extern const char* password_generate_challenge(struct user* user);
+-extern int password_verify(struct user* user, const char* password);
++extern const char* password_generate_challenge(struct uhub_user* user);
++extern int password_verify(struct uhub_user* user, const char* password);
+ #endif /* HAVE_UHUB_ACL_H */
+--- a/src/commands.c
++++ b/src/commands.c
+@@ -19,7 +19,7 @@
+ #include "uhub.h"
+-typedef int (*command_handler)(struct user* user, const char* message);
++typedef int (*command_handler)(struct uhub_user* user, const char* message);
+ struct commands_handler
+ {
+@@ -32,7 +32,7 @@
+ static struct commands_handler command_handlers[];
+-static void send_message(struct user* user, const char* message)
++static void send_message(struct uhub_user* user, const char* message)
+ {
+       char* buffer = adc_msg_escape(message);
+       struct adc_message* command = adc_msg_construct(ADC_CMD_IMSG, strlen(buffer) + 6);
+@@ -42,7 +42,7 @@
+       hub_free(buffer);
+ }
+-static int command_access_denied(struct user* user, const char* command)
++static int command_access_denied(struct uhub_user* user, const char* command)
+ {
+       char temp[64];
+       snprintf(temp, 64, "*** Access denied: \"%s\"", command);
+@@ -51,7 +51,7 @@
+ }
+-static int command_stats(struct user* user, const char* message)
++static int command_stats(struct uhub_user* user, const char* message)
+ {
+       char temp[128];
+       snprintf(temp, 128, "*** Stats: %zu users, peak: %zu. Network (up/down): %d/%d KB/s, peak: %d/%d KB/s",
+@@ -67,7 +67,7 @@
+ }
+-static int command_help(struct user* user, const char* message)
++static int command_help(struct uhub_user* user, const char* message)
+ {
+ #define MAX_HELP_MSG 1024
+       size_t n;
+@@ -89,7 +89,7 @@
+     return 0;
+ }
+-static int command_uptime(struct user* user, const char* message)
++static int command_uptime(struct uhub_user* user, const char* message)
+ {
+       char tmp[128];
+       size_t d;
+@@ -124,20 +124,20 @@
+       return 0;
+ }
+-static int command_kick(struct user* user, const char* message)
++static int command_kick(struct uhub_user* user, const char* message)
+ {
+       send_message(user, "*** Kick not implemented!");
+       return 0;
+ }
+-static int command_reload(struct user* user, const char* message)
++static int command_reload(struct uhub_user* user, const char* message)
+ {
+       send_message(user, "*** Reloading configuration");
+       user->hub->status = hub_status_restart;
+       return 0;
+ }
+-static int command_shutdown(struct user* user, const char* message)
++static int command_shutdown(struct uhub_user* user, const char* message)
+ {
+       send_message(user, "*** Hub shuting down...");
+       user->hub->status = hub_status_shutdown;
+@@ -145,13 +145,13 @@
+ }
+-static int command_version(struct user* user, const char* message)
++static int command_version(struct uhub_user* user, const char* message)
+ {
+     send_message(user, "*** Powered by " PRODUCT "/" VERSION);
+     return 0;
+ }
+-static int command_myip(struct user* user, const char* message)
++static int command_myip(struct uhub_user* user, const char* message)
+ {
+     char tmp[128];
+     snprintf(tmp, 128, "*** Your IP: %s", ip_convert_to_string(&user->ipaddr));
+@@ -159,7 +159,7 @@
+     return 0;
+ }
+-int command_dipatcher(struct user* user, const char* message)
++int command_dipatcher(struct uhub_user* user, const char* message)
+ {
+       size_t n = 0;
+       for (n = 0; command_handlers[n].prefix; n++)
+--- a/src/commands.h
++++ b/src/commands.h
+@@ -23,7 +23,7 @@
+ #define CHAT_MSG_IGNORED  0
+ #define CHAT_MSG_INVALID -1
+-typedef int (*plugin_event_chat_message)(struct hub_info*, struct user*, struct adc_message*);
++typedef int (*plugin_event_chat_message)(struct hub_info*, struct uhub_user*, struct adc_message*);
+ struct command_info
+ {
+@@ -32,4 +32,4 @@
+       plugin_event_chat_message function;
+ };
+-int command_dipatcher(struct user* user, const char* message);
++int command_dipatcher(struct uhub_user* user, const char* message);
+--- a/src/hub.c
++++ b/src/hub.c
+@@ -19,7 +19,7 @@
+ #include "uhub.h"
+-int hub_handle_message(struct user* u, const char* line, size_t length)
++int hub_handle_message(struct uhub_user* u, const char* line, size_t length)
+ {
+       int ret = 0;
+       struct adc_message* cmd = 0;
+@@ -96,7 +96,7 @@
+ }
+-int hub_handle_support(struct user* u, struct adc_message* cmd)
++int hub_handle_support(struct uhub_user* u, struct adc_message* cmd)
+ {
+       int ret = 0;
+       int index = 0;
+@@ -161,7 +161,7 @@
+ }
+-int hub_handle_password(struct user* u, struct adc_message* cmd)
++int hub_handle_password(struct uhub_user* u, struct adc_message* cmd)
+ {
+       char* password = adc_msg_get_argument(cmd, 0);
+       int ret = 0;
+@@ -184,7 +184,7 @@
+ }
+-int hub_handle_chat_message(struct user* u, struct adc_message* cmd)
++int hub_handle_chat_message(struct uhub_user* u, struct adc_message* cmd)
+ {
+       char* message = adc_msg_get_argument(cmd, 0);
+       int ret = 0;
+@@ -206,14 +206,14 @@
+       return ret;
+ }
+-int on_kick(struct user* u, struct adc_message* cmd)
++int on_kick(struct uhub_user* u, struct adc_message* cmd)
+ {
+       hub_log(log_error, "on_kick() not implemented");
+       return -1;
+ }
+ #ifdef ADC_UDP_OPERATION
+-int hub_handle_autocheck(struct user* u, struct adc_message* cmd)
++int hub_handle_autocheck(struct uhub_user* u, struct adc_message* cmd)
+ {
+       char* port_str = adc_msg_get_argument(cmd, 0);
+       char* token    = adc_msg_get_argument(cmd, 1);
+@@ -245,13 +245,13 @@
+ #endif
+-void hub_send_autocheck(struct user* u, uint16_t port, const char* token)
++void hub_send_autocheck(struct uhub_user* u, uint16_t port, const char* token)
+ {
+       
+ }
+-void hub_send_support(struct user* u)
++void hub_send_support(struct uhub_user* u)
+ {
+       if (user_is_connecting(u) || user_is_logged_in(u))
+       {
+@@ -260,7 +260,7 @@
+ }
+-void hub_send_sid(struct user* u)
++void hub_send_sid(struct uhub_user* u)
+ {
+       struct adc_message* command;
+       if (user_is_connecting(u))
+@@ -274,7 +274,7 @@
+ }
+-void hub_send_ping(struct user* user)
++void hub_send_ping(struct uhub_user* user)
+ {
+       /* This will just send a newline, despite appearing to do more below. */
+       struct adc_message* ping = adc_msg_construct(0, 0);
+@@ -287,7 +287,7 @@
+ }
+-void hub_send_hubinfo(struct user* u)
++void hub_send_hubinfo(struct uhub_user* u)
+ {
+       struct adc_message* info = adc_msg_copy(u->hub->command_info);
+       int value = 0;
+@@ -356,7 +356,7 @@
+ }
+-void hub_send_handshake(struct user* u)
++void hub_send_handshake(struct uhub_user* u)
+ {
+       hub_send_support(u);
+       hub_send_sid(u);
+@@ -369,7 +369,7 @@
+ }
+-void hub_send_motd(struct user* u)
++void hub_send_motd(struct uhub_user* u)
+ {
+       if (u->hub->command_motd)
+       {
+@@ -378,7 +378,7 @@
+ }
+-void hub_send_password_challenge(struct user* u)
++void hub_send_password_challenge(struct uhub_user* u)
+ {
+       struct adc_message* igpa;
+       igpa = adc_msg_construct(ADC_CMD_IGPA, 38);
+@@ -399,33 +399,33 @@
+       {
+               case UHUB_EVENT_USER_JOIN:
+               {
+-                      if (user_is_disconnecting((struct user*) message->ptr))
++                      if (user_is_disconnecting((struct uhub_user*) message->ptr))
+                               break;
+               
+                       if (message->flags)
+                       {
+-                              hub_send_password_challenge((struct user*) message->ptr);
++                              hub_send_password_challenge((struct uhub_user*) message->ptr);
+                       }
+                       else
+                       {
+-                              on_login_success((struct user*) message->ptr);
++                              on_login_success((struct uhub_user*) message->ptr);
+                       }
+                       break;
+               }
+               case UHUB_EVENT_USER_QUIT:
+               {
+-                      user_manager_remove((struct user*) message->ptr);
+-                      send_quit_message((struct user*) message->ptr);
+-                      on_logout_user((struct user*) message->ptr);
+-                      user_schedule_destroy((struct user*) message->ptr);
++                      user_manager_remove((struct uhub_user*) message->ptr);
++                      send_quit_message((struct uhub_user*) message->ptr);
++                      on_logout_user((struct uhub_user*) message->ptr);
++                      user_schedule_destroy((struct uhub_user*) message->ptr);
+                       break;
+               }
+               
+               case UHUB_EVENT_USER_DESTROY:
+               {
+                       hub_log(log_trace, "hub_event_dispatcher: UHUB_EVENT_USER_DESTROY (ptr=%p)", message->ptr);
+-                      user_destroy((struct user*) message->ptr);
++                      user_destroy((struct uhub_user*) message->ptr);
+                       break;
+               }
+               
+@@ -757,7 +757,7 @@
+  */
+ static inline int is_nick_in_use(struct hub_info* hub, const char* nick)
+ {
+-      struct user* lookup = get_user_by_nick(hub, nick);
++      struct uhub_user* lookup = get_user_by_nick(hub, nick);
+       if (lookup)
+       {
+               return 1;
+@@ -771,7 +771,7 @@
+  */
+ static inline int is_cid_in_use(struct hub_info* hub, const char* cid)
+ {
+-      struct user* lookup = get_user_by_cid(hub, cid);
++      struct uhub_user* lookup = get_user_by_cid(hub, cid);
+       if (lookup)
+       {
+               return 1;
+@@ -796,7 +796,7 @@
+  * @param msg See enum status_message
+  * @param level See enum status_level
+  */
+-void hub_send_status(struct user* user, enum status_message msg, enum msg_status_level level)
++void hub_send_status(struct uhub_user* user, enum status_message msg, enum msg_status_level level)
+ {
+       struct hub_config* cfg = user->hub->config;
+       struct adc_message* cmd = adc_msg_construct(ADC_CMD_ISTA, 6);
+--- a/src/hubevent.c
++++ b/src/hubevent.c
+@@ -19,27 +19,27 @@
+ #include "uhub.h"
+-static void log_user_login(struct user* u)
++static void log_user_login(struct uhub_user* u)
+ {
+       const char* cred = get_user_credential_string(u->credentials);
+       const char* addr = ip_convert_to_string(&u->ipaddr);
+       hub_log(log_user, "LoginOK     %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, cred, u->user_agent);
+ }
+-static void log_user_login_error(struct user* u, enum status_message msg)
++static void log_user_login_error(struct uhub_user* u, enum status_message msg)
+ {
+       const char* addr = ip_convert_to_string(&u->ipaddr);
+       const char* message = hub_get_status_message_log(u->hub, msg);
+       hub_log(log_user, "LoginError  %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message, u->user_agent);
+ }
+-static void log_user_logout(struct user* u, const char* message)
++static void log_user_logout(struct uhub_user* u, const char* message)
+ {
+       const char* addr = ip_convert_to_string(&u->ipaddr);
+       hub_log(log_user, "Logout      %s/%s %s \"%s\" (%s)", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message);
+ }
+-static void log_user_nick_change(struct user* u, const char* nick)
++static void log_user_nick_change(struct uhub_user* u, const char* nick)
+ {
+       const char* addr = ip_convert_to_string(&u->ipaddr);
+       hub_log(log_user, "NickChange  %s/%s %s \"%s\" -> \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, nick);
+@@ -47,7 +47,7 @@
+ /* Send MOTD, do logging etc */
+-void on_login_success(struct user* u)
++void on_login_success(struct uhub_user* u)
+ {
+       struct timeval timeout = { TIMEOUT_IDLE, 0 };
+       
+@@ -75,14 +75,14 @@
+               event_add(u->ev_read, &timeout);
+ }
+-void on_login_failure(struct user* u, enum status_message msg)
++void on_login_failure(struct uhub_user* u, enum status_message msg)
+ {
+       log_user_login_error(u, msg);
+       hub_send_status(u, msg, status_level_fatal);
+       user_disconnect(u, quit_logon_error);
+ }
+-void on_nick_change(struct user* u, const char* nick)
++void on_nick_change(struct uhub_user* u, const char* nick)
+ {
+       if (user_is_logged_in(u))
+       {
+@@ -90,7 +90,7 @@
+       }
+ }
+-void on_logout_user(struct user* user)
++void on_logout_user(struct uhub_user* user)
+ {
+       const char* reason = "";
+       
+--- a/src/hubevent.h
++++ b/src/hubevent.h
+@@ -23,22 +23,22 @@
+ /**
+  * This event is triggered whenever a user successfully logs in to the hub.
+  */
+-extern void on_login_success(struct user* u);
++extern void on_login_success(struct uhub_user* u);
+ /**
+  * This event is triggered whenever a user failed to log in to the hub.
+  */
+-extern void on_login_failure(struct user* u, enum status_message msg);
++extern void on_login_failure(struct uhub_user* u, enum status_message msg);
+ /**
+  * This event is triggered whenever a previously logged in user leaves the hub.
+  */
+-extern void on_logout_user(struct user* u);
++extern void on_logout_user(struct uhub_user* u);
+ /**
+  * This event is triggered whenever a user changes his/her nickname.
+  */
+-extern void on_nick_change(struct user* u, const char* nick);
++extern void on_nick_change(struct uhub_user* u, const char* nick);
+ #endif /* HAVE_UHUB_HUB_EVENT_H */
+--- a/src/hub.h
++++ b/src/hub.h
+@@ -94,7 +94,7 @@
+       struct event_queue* queue;
+       struct event_base* evbase;
+       struct hub_config* config;
+-      struct user_manager* users;
++      struct uhub_user_manager* users;
+       struct acl_handle* acl;
+       struct adc_message* command_info;    /* The hub's INF command */
+       struct adc_message* command_support; /* The hub's SUP command */
+@@ -116,103 +116,103 @@
+  *
+  * @return 0 on success, -1 on error
+  */
+-extern int hub_handle_message(struct user* u, const char* message, size_t length);
++extern int hub_handle_message(struct uhub_user* u, const char* message, size_t length);
+ /**
+  * Handle protocol support/subscription messages received clients.
+  *
+  * @return 0 on success, -1 on error
+  */
+-extern int hub_handle_support(struct user* u, struct adc_message* cmd);
++extern int hub_handle_support(struct uhub_user* u, struct adc_message* cmd);
+ /**
+  * Handle password messages received from clients.
+  *
+  * @return 0 on success, -1 on error
+  */
+-extern int hub_handle_password(struct user* u, struct adc_message* cmd);
++extern int hub_handle_password(struct uhub_user* u, struct adc_message* cmd);
+ /**
+  * Handle chat messages received from clients.
+  * @return 0 on success, -1 on error.
+  */
+-extern int hub_handle_chat_message(struct user* u, struct adc_message* cmd);
++extern int hub_handle_chat_message(struct uhub_user* u, struct adc_message* cmd);
+ /**
+  * Used internally by hub_handle_info
+  * @return 1 if nickname is OK, or 0 if nickname is not accepted.
+  */
+-extern int  hub_handle_info_check_nick(struct user* u, struct adc_message* cmd);
++extern int  hub_handle_info_check_nick(struct uhub_user* u, struct adc_message* cmd);
+ /**
+  * Used internally by hub_handle_info
+  * @return 1 if CID/PID is OK, or 0 if not valid.
+  */
+-extern int  hub_handle_info_check_cid(struct user* u, struct adc_message* cmd);
++extern int  hub_handle_info_check_cid(struct uhub_user* u, struct adc_message* cmd);
+ /**
+  * Can only be used by administrators or operators.
+  *
+  * @return 0 on success, -1 on error
+  */
+-extern int hub_handle_kick(struct user* u, struct adc_message* cmd);
++extern int hub_handle_kick(struct uhub_user* u, struct adc_message* cmd);
+ #ifdef ADC_UDP_OPERATION
+ /**
+  * Handle incoming autocheck message.
+  */
+-extern int hub_handle_autocheck(struct user* u, struct adc_message* cmd);
++extern int hub_handle_autocheck(struct uhub_user* u, struct adc_message* cmd);
+ #endif
+ /**
+  * Send the support line for the hub to a particular user.
+  * Only used during the initial handshake.
+  */
+-extern void hub_send_support(struct user* u);
++extern void hub_send_support(struct uhub_user* u);
+ /**
+  * Send a message assigning a SID for a user.
+  * This is only sent after hub_send_support() during initial handshake.
+  */
+-extern void hub_send_sid(struct user* u);
++extern void hub_send_sid(struct uhub_user* u);
+ /**
+  * Send a 'ping' message to user.
+  */
+-extern void hub_send_ping(struct user* user);
++extern void hub_send_ping(struct uhub_user* user);
+ /**
+  * Send a message containing hub information to a particular user.
+  * This is sent during user connection, but can safely be sent at any
+  * point later.
+  */
+-extern void hub_send_hubinfo(struct user* u);
++extern void hub_send_hubinfo(struct uhub_user* u);
+ /**
+  * Send handshake. This basically calls
+  * hub_send_support() and hub_send_sid()
+  */
+-extern void hub_send_handshake(struct user* u);
++extern void hub_send_handshake(struct uhub_user* u);
+ /**
+  * Send a welcome message containing the message of the day to 
+  * one particular user. This can be sent in any point in time.
+  */
+-extern void hub_send_motd(struct user* u);
++extern void hub_send_motd(struct uhub_user* u);
+ /**
+  * Send a password challenge to a user.
+  * This is only used if the user tries to access the hub using a
+  * password protected nick name.
+  */
+-extern void hub_send_password_challenge(struct user* u);
++extern void hub_send_password_challenge(struct uhub_user* u);
+ /**
+  * Send an autocheck message to a user.
+  * This is basically a UDP message. The user's client can then determine
+  * if UDP communication works by either hole punching or configuring UPnP.
+  */
+-extern void hub_send_autocheck(struct user* u, uint16_t port, const char* token);
++extern void hub_send_autocheck(struct uhub_user* u, uint16_t port, const char* token);
+ /**
+  * This starts the hub.
+@@ -244,7 +244,7 @@
+ /**
+  * Sends a status_message to a user.
+  */
+-extern void hub_send_status(struct user* user, enum status_message msg, enum msg_status_level level);
++extern void hub_send_status(struct uhub_user* user, enum status_message msg, enum msg_status_level level);
+ /**
+  * Returns the number of logged in users on the hub.
+--- a/src/inf.c
++++ b/src/inf.c
+@@ -39,9 +39,9 @@
+       adc_msg_remove_named_argument(cmd, ADC_INF_FLAG_REFERER);
+ }
+-static int user_is_protected(struct user* user);
++static int user_is_protected(struct uhub_user* user);
+-static int set_feature_cast_supports(struct user* u, struct adc_message* cmd)
++static int set_feature_cast_supports(struct uhub_user* u, struct adc_message* cmd)
+ {
+       char *it, *tmp;
+       
+@@ -89,7 +89,7 @@
+ /*
+  * FIXME: Only works for tiger hash. If a client doesnt support tiger we cannot let it in!
+  */
+-static int check_cid(struct user* user, struct adc_message* cmd)
++static int check_cid(struct uhub_user* user, struct adc_message* cmd)
+ {
+       size_t pos;
+       char* cid = adc_msg_get_named_argument(cmd, ADC_INF_FLAG_CLIENT_ID);
+@@ -150,7 +150,7 @@
+ }
+-static int check_required_login_flags(struct user* user, struct adc_message* cmd)
++static int check_required_login_flags(struct uhub_user* user, struct adc_message* cmd)
+ {
+       int num = 0;
+       
+@@ -186,7 +186,7 @@
+  * remove any wrong address, and replace it with the correct one
+  * as seen by the hub.
+  */
+-int check_network(struct user* user, struct adc_message* cmd)
++int check_network(struct uhub_user* user, struct adc_message* cmd)
+ {
+       const char* address = ip_convert_to_string(&user->ipaddr);
+       
+@@ -269,7 +269,7 @@
+ }
+-static int check_nick(struct user* user, struct adc_message* cmd)
++static int check_nick(struct uhub_user* user, struct adc_message* cmd)
+ {
+       char* nick;
+       char* tmp;
+@@ -317,10 +317,10 @@
+ }
+-static int check_logged_in(struct user* user, struct adc_message* cmd)
++static int check_logged_in(struct uhub_user* user, struct adc_message* cmd)
+ {
+-      struct user* lookup1 = get_user_by_nick(user->hub, user->id.nick);
+-      struct user* lookup2 = get_user_by_cid(user->hub,  user->id.cid);
++      struct uhub_user* lookup1 = get_user_by_nick(user->hub, user->id.nick);
++      struct uhub_user* lookup2 = get_user_by_cid(user->hub,  user->id.cid);
+       
+       if (lookup1 == user)
+       {
+@@ -358,7 +358,7 @@
+  * But this is not something we want to do, and is deprecated in the ADC specification.
+  * One should rather look at capabilities/features.
+  */
+-static int check_user_agent(struct user* user, struct adc_message* cmd)
++static int check_user_agent(struct uhub_user* user, struct adc_message* cmd)
+ {
+       char* ua_encoded = 0;
+       char* ua = 0;
+@@ -379,7 +379,7 @@
+ }
+-static int check_acl(struct user* user, struct adc_message* cmd)
++static int check_acl(struct uhub_user* user, struct adc_message* cmd)
+ {
+       if (acl_is_cid_banned(user->hub->acl, user->id.cid))
+       {
+@@ -399,7 +399,7 @@
+       return 0;
+ }
+-static int check_limits(struct user* user, struct adc_message* cmd)
++static int check_limits(struct uhub_user* user, struct adc_message* cmd)
+ {
+       char* arg = adc_msg_get_named_argument(cmd, ADC_INF_FLAG_SHARED_SIZE);
+       if (arg)
+@@ -525,10 +525,10 @@
+  * If the hub is configured to allow only registered users and the user
+  * is not recognized this will return 1.
+  */
+-static int set_credentials(struct user* user, struct adc_message* cmd)
++static int set_credentials(struct uhub_user* user, struct adc_message* cmd)
+ {
+       int ret = 0;
+-      struct user_access_info* info = acl_get_access_info(user->hub->acl, user->id.nick);
++      struct uhub_user_access_info* info = acl_get_access_info(user->hub->acl, user->id.nick);
+       
+       if (info)
+       {
+@@ -580,7 +580,7 @@
+ /**
+  * Determines if a user is to be let into the hub even if the hub is "full".
+  */
+-static int user_is_protected(struct user* user)
++static int user_is_protected(struct uhub_user* user)
+ {
+       switch (user->credentials)
+       {
+@@ -601,7 +601,7 @@
+  * Only registered users will be let in if the hub is configured for registered
+  * users only.
+  */
+-static int user_is_registered(struct user* user)
++static int user_is_registered(struct uhub_user* user)
+ {
+       switch (user->credentials)
+       {
+@@ -619,7 +619,7 @@
+ }
+-void update_user_info(struct user* u, struct adc_message* cmd)
++void update_user_info(struct uhub_user* u, struct adc_message* cmd)
+ {
+       char prefix[2];
+       char* argument;
+@@ -649,7 +649,7 @@
+ }
+-static int check_is_hub_full(struct user* user)
++static int check_is_hub_full(struct uhub_user* user)
+ {
+       /*
+        * If hub is full, don't let users in, but we still want to allow
+@@ -663,7 +663,7 @@
+ }
+-static int check_registered_users_only(struct user* user)
++static int check_registered_users_only(struct uhub_user* user)
+ {
+       if (user->hub->config->registered_users_only && !user_is_registered(user))
+       {
+@@ -679,7 +679,7 @@
+                       return ret; \
+       } while(0)
+-static int hub_handle_info_common(struct user* user, struct adc_message* cmd)
++static int hub_handle_info_common(struct uhub_user* user, struct adc_message* cmd)
+ {
+       /* Remove server restricted flags */
+       remove_server_restricted_flags(cmd);
+@@ -690,7 +690,7 @@
+       return 0;
+ }
+-static int hub_handle_info_low_bandwidth(struct user* user, struct adc_message* cmd)
++static int hub_handle_info_low_bandwidth(struct uhub_user* user, struct adc_message* cmd)
+ {
+       if (user->hub->config->low_bandwidth_mode)
+       {
+@@ -711,7 +711,7 @@
+       return 0;
+ }
+-int hub_handle_info_login(struct user* user, struct adc_message* cmd)
++int hub_handle_info_login(struct uhub_user* user, struct adc_message* cmd)
+ {
+       int need_auth = 0;
+       
+@@ -765,7 +765,7 @@
+  * - CID/PID (valid, not taken, etc).
+  * - IP addresses (IPv4 and IPv6)
+  */
+-int hub_handle_info(struct user* user, const struct adc_message* cmd_unmodified)
++int hub_handle_info(struct uhub_user* user, const struct adc_message* cmd_unmodified)
+ {
+       struct adc_message* cmd = adc_msg_copy(cmd_unmodified);
+       if (!cmd) return -1; /* OOM */
+--- a/src/inf.h
++++ b/src/inf.h
+@@ -47,7 +47,7 @@
+  *
+  * @return 0 on success, -1 on error
+  */
+-extern int hub_handle_info(struct user* u, const struct adc_message* cmd);
++extern int hub_handle_info(struct uhub_user* u, const struct adc_message* cmd);
+ #endif /* HAVE_UHUB_INF_PARSER_H */
+--- a/src/message.c
++++ b/src/message.c
+@@ -234,7 +234,7 @@
+ }
+-struct adc_message* adc_msg_parse_verify(struct user* u, const char* line, size_t length)
++struct adc_message* adc_msg_parse_verify(struct uhub_user* u, const char* line, size_t length)
+ {
+       struct adc_message* command = adc_msg_parse(line, length);
+       
+--- a/src/message.h
++++ b/src/message.h
+@@ -20,7 +20,7 @@
+ #ifndef HAVE_UHUB_COMMAND_H
+ #define HAVE_UHUB_COMMAND_H
+-struct user;
++struct uhub_user;
+ struct adc_message
+ {
+@@ -70,7 +70,7 @@
+  * The message is only considered valid if the user who sent it
+  * is the rightful origin of the message.
+  */
+-extern struct adc_message* adc_msg_parse_verify(struct user* u, const char* string, size_t length);
++extern struct adc_message* adc_msg_parse_verify(struct uhub_user* u, const char* string, size_t length);
+ /**
+  * This will parse 'string' and return it as a adc_message struct, or
+--- a/src/netevent.c
++++ b/src/netevent.c
+@@ -23,7 +23,7 @@
+ void net_on_read(int fd, short ev, void *arg)
+ {
+       static char buf[MAX_RECV_BUF];
+-      struct user* user = (struct user*) arg;
++      struct uhub_user* user = (struct uhub_user*) arg;
+       char* pos;
+       size_t offset;
+       size_t buflen;
+@@ -168,7 +168,7 @@
+ void net_on_write(int fd, short ev, void *arg)
+ {
+-      struct user* user = (struct user*) arg;
++      struct uhub_user* user = (struct uhub_user*) arg;
+       struct adc_message* msg;
+       int ret;
+       int length;
+@@ -259,7 +259,7 @@
+ void net_on_accept(int server_fd, short ev, void *arg)
+ {
+       struct hub_info* hub = (struct hub_info*) arg;
+-      struct user* user = 0;
++      struct uhub_user* user = 0;
+       struct ip_addr_encap ipaddr;
+       const char* addr;
+       struct timeval timeout = { TIMEOUT_CONNECTED, 0 };
+@@ -320,7 +320,7 @@
+ {
+       static char buffer[1024] = {0,};
+       // struct hub_info* hub = (struct hub_info*) arg;
+-      // struct user* user = 0;
++      // struct uhub_user* user = 0;
+       ssize_t size;
+       struct sockaddr_storage from;
+       socklen_t fromlen;
+--- a/src/plugin.h
++++ b/src/plugin.h
+@@ -19,12 +19,12 @@
+ typedef void (*plugin_event_startup)(struct hub*);
+ typedef void (*plugin_event_shutdown)(struct hub*);
+-typedef void (*plugin_event_user_login)(struct hub*, struct user*);
+-typedef void (*plugin_event_user_logout)(struct hub*, struct user*);
++typedef void (*plugin_event_user_login)(struct hub*, struct uhub_user*);
++typedef void (*plugin_event_user_logout)(struct hub*, struct uhub_user*);
+ typedef int  (*plugin_event_connect)(struct hub*, struct ip_addr_encap);
+-typedef void (*plugin_event_disconnect)(struct hub*, struct user*);
+-typedef int  (*plugin_event_message)(struct hub*, struct user*, struct adc_message*);
+-typedef void (*plugin_event_support)(struct hub*, struct user*, int);
++typedef void (*plugin_event_disconnect)(struct hub*, struct uhub_user*);
++typedef int  (*plugin_event_message)(struct hub*, struct uhub_user*, struct adc_message*);
++typedef void (*plugin_event_support)(struct hub*, struct uhub_user*, int);
+ struct uhub_plugin
+ {
+--- a/src/route.c
++++ b/src/route.c
+@@ -20,9 +20,9 @@
+ #include "uhub.h"
+-int route_message(struct user* u, struct adc_message* msg)
++int route_message(struct uhub_user* u, struct adc_message* msg)
+ {
+-      struct user* target = NULL;
++      struct uhub_user* target = NULL;
+       switch (msg->cache[0])
+       {
+@@ -59,7 +59,7 @@
+ }
+-static void queue_command(struct user* user, struct adc_message* msg__, int offset)
++static void queue_command(struct uhub_user* user, struct adc_message* msg__, int offset)
+ {
+       struct adc_message* msg = adc_msg_incref(msg__);
+       list_append(user->send_queue, msg);
+@@ -97,7 +97,7 @@
+  *         -1 if send queue is overflowed
+  *         0 if soft send queue is overflowed (not implemented at the moment)
+  */
+-static int check_send_queue(struct user* user, struct adc_message* msg)
++static int check_send_queue(struct uhub_user* user, struct adc_message* msg)
+ {
+       if (user_flag_get(user, flag_user_list))
+               return 1;
+@@ -111,7 +111,7 @@
+       return 1;
+ }
+-int route_to_user(struct user* user, struct adc_message* msg)
++int route_to_user(struct uhub_user* user, struct adc_message* msg)
+ {
+       int ret;
+       
+@@ -174,11 +174,11 @@
+ int route_to_all(struct hub_info* hub, struct adc_message* command) /* iterate users */
+ {
+-      struct user* user = (struct user*) list_get_first(hub->users->list);
++      struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list);
+       while (user)
+       {
+               route_to_user(user, command);
+-              user = (struct user*) list_get_next(hub->users->list);
++              user = (struct uhub_user*) list_get_next(hub->users->list);
+       }
+       
+       return 0;
+@@ -190,7 +190,7 @@
+       int do_send;
+       char* tmp;
+       
+-      struct user* user = (struct user*) list_get_first(hub->users->list);
++      struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list);
+       while (user)
+       {
+               if (user->feature_cast)
+@@ -209,7 +209,7 @@
+                       }
+                       
+                       if (!do_send) {
+-                              user = (struct user*) list_get_next(hub->users->list);
++                              user = (struct uhub_user*) list_get_next(hub->users->list);
+                               continue;
+                       }
+                       
+@@ -229,13 +229,13 @@
+                               route_to_user(user, command);
+                       }
+               }
+-              user = (struct user*) list_get_next(hub->users->list);
++              user = (struct uhub_user*) list_get_next(hub->users->list);
+       }
+       
+       return 0;
+ }
+-int route_info_message(struct user* u)
++int route_info_message(struct uhub_user* u)
+ {
+       if (!user_is_nat_override(u))
+       {
+@@ -245,12 +245,12 @@
+       {
+               struct adc_message* cmd = adc_msg_copy(u->info);
+               const char* address = ip_convert_to_string(&u->ipaddr);
+-              struct user* user = 0;
++              struct uhub_user* user = 0;
+               
+               adc_msg_remove_named_argument(cmd, ADC_INF_FLAG_IPV4_ADDR);
+               adc_msg_add_named_argument(cmd, ADC_INF_FLAG_IPV4_ADDR, address);
+       
+-              user = (struct user*) list_get_first(u->hub->users->list);
++              user = (struct uhub_user*) list_get_first(u->hub->users->list);
+               while (user)
+               {
+                       if (user_is_nat_override(user))
+@@ -258,7 +258,7 @@
+                       else
+                               route_to_user(user, u->info);
+                       
+-                      user = (struct user*) list_get_next(u->hub->users->list);
++                      user = (struct uhub_user*) list_get_next(u->hub->users->list);
+               }
+               adc_msg_free(cmd);
+       }
+--- a/src/route.h
++++ b/src/route.h
+@@ -23,12 +23,12 @@
+ /**
+  * Route a message by sending it to it's final destination.
+  */
+-extern int route_message(struct user* u, struct adc_message* msg);
++extern int route_message(struct uhub_user* u, struct adc_message* msg);
+ /**
+  * Transmit message directly to one user.
+  */
+-extern int route_to_user(struct user*, struct adc_message* command);
++extern int route_to_user(struct uhub_user*, struct adc_message* command);
+ /**
+  * Broadcast message to all users.
+@@ -45,7 +45,7 @@
+  * This will ensure the correct IP is seen by other users
+  * in case nat override is in use.
+  */
+-extern int route_info_message(struct user* user);
++extern int route_info_message(struct uhub_user* user);
+ #endif /* HAVE_UHUB_ROUTE_H */
+--- a/src/sid.h
++++ b/src/sid.h
+@@ -28,7 +28,7 @@
+ struct sid_map
+ {
+-      struct user* ptr;
++      struct uhub_user* ptr;
+       struct sid_map* next;
+ };
+@@ -58,7 +58,7 @@
+ extern void sid_initialize(struct sid_pool*);
+-extern sid_t sid_alloc(struct sid_pool*, struct user*);
++extern sid_t sid_alloc(struct sid_pool*, struct uhub_user*);
+ extern void sid_free(struct sid_pool*, sid_t);
+--- a/src/user.c
++++ b/src/user.c
+@@ -19,13 +19,13 @@
+ #include "uhub.h"
+-struct user* user_create(struct hub_info* hub, int sd)
++struct uhub_user* user_create(struct hub_info* hub, int sd)
+ {
+-      struct user* user = NULL;
++      struct uhub_user* user = NULL;
+       
+       hub_log(log_trace, "user_create(), hub=%p, sd=%d", hub, sd);
+-      user = (struct user*) hub_malloc_zero(sizeof(struct user));
++      user = (struct uhub_user*) hub_malloc_zero(sizeof(struct uhub_user));
+       if (user == NULL)
+               return NULL; /* OOM */
+@@ -61,7 +61,7 @@
+       adc_msg_free((struct adc_message*) ptr);
+ }
+-void user_destroy(struct user* user)
++void user_destroy(struct uhub_user* user)
+ {
+       hub_log(log_trace, "user_destroy(), user=%p", user);
+@@ -98,7 +98,7 @@
+       hub_free(user);
+ }
+-void user_set_state(struct user* user, enum user_state state)
++void user_set_state(struct uhub_user* user, enum user_state state)
+ {
+       if ((user->state == state_cleanup && state != state_disconnected) || (user->state == state_disconnected))
+       {
+@@ -109,7 +109,7 @@
+       user->state = state;
+ }
+-void user_set_info(struct user* user, struct adc_message* cmd)
++void user_set_info(struct uhub_user* user, struct adc_message* cmd)
+ {
+       adc_msg_free(user->info);
+       user->info = adc_msg_incref(cmd);
+@@ -156,44 +156,44 @@
+       }
+ }
+-void user_support_add(struct user* user, int fourcc)
++void user_support_add(struct uhub_user* user, int fourcc)
+ {
+       int feature_mask = convert_support_fourcc(fourcc);
+       user->flags |= feature_mask;
+ }
+-int user_flag_get(struct user* user, enum user_flags flag)
++int user_flag_get(struct uhub_user* user, enum user_flags flag)
+ {
+     return user->flags & flag;
+ }
+-void user_flag_set(struct user* user, enum user_flags flag)
++void user_flag_set(struct uhub_user* user, enum user_flags flag)
+ {
+     user->flags |= flag;
+ }
+-void user_flag_unset(struct user* user, enum user_flags flag)
++void user_flag_unset(struct uhub_user* user, enum user_flags flag)
+ {
+     user->flags &= ~flag;
+ }
+-void user_set_nat_override(struct user* user)
++void user_set_nat_override(struct uhub_user* user)
+ {
+       user_flag_set(user, flag_nat);
+ }
+-int user_is_nat_override(struct user* user)
++int user_is_nat_override(struct uhub_user* user)
+ {
+       return user_flag_get(user, flag_nat);
+ }
+-void user_support_remove(struct user* user, int fourcc)
++void user_support_remove(struct uhub_user* user, int fourcc)
+ {
+       int feature_mask = convert_support_fourcc(fourcc);
+       user->flags &= ~feature_mask;
+ }
+-void user_schedule_destroy(struct user* user)
++void user_schedule_destroy(struct uhub_user* user)
+ {
+       struct event_data post;
+       memset(&post, 0, sizeof(post));
+@@ -202,7 +202,7 @@
+       event_queue_post(user->hub->queue, &post);
+ }
+-void user_disconnect(struct user* user, int reason)
++void user_disconnect(struct uhub_user* user, int reason)
+ {
+       struct event_data post;
+       int need_notify = 0;
+@@ -242,7 +242,7 @@
+ }
+-int user_have_feature_cast_support(struct user* user, char feature[4])
++int user_have_feature_cast_support(struct uhub_user* user, char feature[4])
+ {
+       char* tmp = list_get_first(user->feature_cast);
+       while (tmp)
+@@ -256,7 +256,7 @@
+       return 0;
+ }
+-int user_set_feature_cast_support(struct user* u, char feature[4])
++int user_set_feature_cast_support(struct uhub_user* u, char feature[4])
+ {
+       if (!u->feature_cast)
+       {
+@@ -272,7 +272,7 @@
+       return 1;
+ }
+-void user_clear_feature_cast_support(struct user* u)
++void user_clear_feature_cast_support(struct uhub_user* u)
+ {
+       if (u->feature_cast)
+       {
+@@ -282,21 +282,21 @@
+       }
+ }
+-int user_is_logged_in(struct user* user)
++int user_is_logged_in(struct uhub_user* user)
+ {
+       if (user->state == state_normal)
+               return 1;
+       return 0;
+ }
+-int user_is_connecting(struct user* user)
++int user_is_connecting(struct uhub_user* user)
+ {
+       if (user->state == state_protocol || user->state == state_identify || user->state == state_verify)
+               return 1;
+       return 0;
+ }
+-int user_is_disconnecting(struct user* user)
++int user_is_disconnecting(struct uhub_user* user)
+ {
+       if (user->state == state_cleanup || user->state == state_disconnected)
+               return 1;
+--- a/src/user.h
++++ b/src/user.h
+@@ -73,7 +73,7 @@
+ };
+-struct user_info
++struct uhub_user_info
+ {
+       sid_t sid;                    /** session ID */
+       char cid[MAX_CID_LEN+1];      /** global client ID */
+@@ -85,7 +85,7 @@
+  * as the number of bytes and files shared, and the number of hubs the
+  * user is connected to, etc.
+  */
+-struct user_counts
++struct uhub_user_counts
+ {
+       uint64_t             shared_size;             /** Shared size in bytes */
+       size_t               shared_files;            /** The number of shared files */
+@@ -96,14 +96,14 @@
+       size_t               hub_count_total;         /** The number of hubs connected to in total */
+ };
+-struct user
++struct uhub_user
+ {
+       int                  sd;                      /** socket descriptor */
+       struct event*        ev_read;                 /** libevent struct for read events */
+       struct event*        ev_write;                /** libevent struct for write events */
+       enum user_state      state;                   /** see enum user_state */
+       enum user_credentials credentials;            /** see enum user_credentials */
+-      struct user_info     id;                      /** Contains nick name and CID */
++      struct uhub_user_info     id;                      /** Contains nick name and CID */
+       int                  flags;                   /** see enum user_features */
+       char                 user_agent[MAX_UA_LEN+1];/** User agent string */
+       time_t               tm_connected;            /** time when user connected */
+@@ -120,7 +120,7 @@
+       struct hub_info*     hub;                     /** The hub instance this user belong to */
+       int                  quit_reason;             /** Quit reason (see user_quit_reason) */
+       struct ip_addr_encap ipaddr;                  /** IP address of connected user */
+-      struct user_counts   limits;                  /** Data used for limitation */
++      struct uhub_user_counts   limits;                  /** Data used for limitation */
+ #ifdef SSL_SUPPORT
+       SSL*                 ssl;                     /** SSL handle */
+ #endif /*  SSL_SUPPORT */
+@@ -137,19 +137,19 @@
+  * @param sd socket descriptor associated with the user
+  * @return User object or NULL if not enough memory is available.
+  */
+-extern struct user* user_create(struct hub_info* hub, int sd);
++extern struct uhub_user* user_create(struct hub_info* hub, int sd);
+ /**
+  * Delete a user.
+  *
+  * !WRONG! If the user is logged in a quit message is issued.
+  */
+-extern void user_destroy(struct user* user);
++extern void user_destroy(struct uhub_user* user);
+ /**
+  * Will post a message that will delete the user later.
+  */
+-extern void user_schedule_destroy(struct user* user);
++extern void user_schedule_destroy(struct uhub_user* user);
+ /**
+  * Disconnect a user.
+@@ -165,36 +165,36 @@
+  * @param user User to disconnect
+  * @param reason See enum user_quit_reason
+  */
+-extern void user_disconnect(struct user* user, int reason);
++extern void user_disconnect(struct uhub_user* user, int reason);
+ /**
+  * This associates a INF message to the user.
+  * If the user already has a INF message associated, then this is
+  * released before setting the new one.
+  */
+-extern void user_set_info(struct user* user, struct adc_message* info);
++extern void user_set_info(struct uhub_user* user, struct adc_message* info);
+ /**
+  * Specify a user's state.
+  * NOTE: DON'T, unless you know what you are doing.
+  */
+-extern void user_set_state(struct user* user, enum user_state);
++extern void user_set_state(struct uhub_user* user, enum user_state);
+ /**
+  * Returns 1 if the user is in state state_normal, or 0 otherwise.
+  */
+-extern int user_is_logged_in(struct user* user);
++extern int user_is_logged_in(struct uhub_user* user);
+ /**
+  * Returns 1 if the user is in state_protocol, state_identify or state_verify.
+  * Returns 0 otherwise.
+  */
+-extern int user_is_connecting(struct user* user);
++extern int user_is_connecting(struct uhub_user* user);
+ /**
+  * Returns 1 only if the user is in state_cleanup or state_disconnected.
+  */
+-extern int user_is_disconnecting(struct user* user);
++extern int user_is_disconnecting(struct uhub_user* user);
+ /**
+  * User supports the protocol extension as given in fourcc.
+@@ -204,7 +204,7 @@
+  *
+  * @see enum user_flags
+  */
+-extern void user_support_add(struct user* user, int fourcc);
++extern void user_support_add(struct uhub_user* user, int fourcc);
+ /**
+  * User no longer supports the protocol extension as given in fourcc.
+@@ -212,26 +212,26 @@
+  * the hub.
+  * @see enum user_flags
+  */
+-extern void user_support_remove(struct user* user, int fourcc);
++extern void user_support_remove(struct uhub_user* user, int fourcc);
+ /**
+  * Sets the nat override flag for a user, this allows users on the same
+  * subnet as a natted hub to spoof their IP in order to use active mode
+  * on a natted hub.
+  */
+-extern void user_set_nat_override(struct user* user);
+-extern int user_is_nat_override(struct user* user);
++extern void user_set_nat_override(struct uhub_user* user);
++extern int user_is_nat_override(struct uhub_user* user);
+ /**
+  * Set a flag. @see enum user_flags
+  */
+-extern void user_flag_set(struct user* user, enum user_flags flag);
+-extern void user_flag_unset(struct user* user, enum user_flags flag);
++extern void user_flag_set(struct uhub_user* user, enum user_flags flag);
++extern void user_flag_unset(struct uhub_user* user, enum user_flags flag);
+ /**
+  * Get a flag. @see enum user_flags
+  */
+-extern int user_flag_get(struct user* user, enum user_flags flag);
++extern int user_flag_get(struct uhub_user* user, enum user_flags flag);
+ /**
+  * Check if a user supports 'feature' for feature casting (basis for 'Fxxx' messages)
+@@ -241,7 +241,7 @@
+  * @param feature a feature to lookup (example: 'TCP4' or 'UDP4')
+  * @return 1 if 'feature' supported, or 0 otherwise
+  */
+-extern int user_have_feature_cast_support(struct user* user, char feature[4]);
++extern int user_have_feature_cast_support(struct uhub_user* user, char feature[4]);
+ /**
+  * Set feature cast support for feature.
+@@ -249,12 +249,12 @@
+  * @param feature a feature to lookup (example: 'TCP4' or 'UDP4')
+  * @return 1 if 'feature' supported, or 0 otherwise
+  */
+-extern int user_set_feature_cast_support(struct user* u, char feature[4]);
++extern int user_set_feature_cast_support(struct uhub_user* u, char feature[4]);
+ /**
+  * Remove all feature cast support features.
+  */
+-extern void user_clear_feature_cast_support(struct user* u);
++extern void user_clear_feature_cast_support(struct uhub_user* u);
+--- a/src/usermanager.c
++++ b/src/usermanager.c
+@@ -27,7 +27,7 @@
+ {
+       if (ptr)
+       {
+-              struct user* u = (struct user*) ptr;
++              struct uhub_user* u = (struct uhub_user*) ptr;
+               
+               /* Mark the user as already being disconnected.
+                * This prevents the hub from trying to send
+@@ -81,10 +81,10 @@
+ int user_manager_init(struct hub_info* hub)
+ {
+-      struct user_manager* users = NULL;
++      struct uhub_user_manager* users = NULL;
+       struct timeval timeout = { TIMEOUT_STATS, 0 };
+-      users = (struct user_manager*) hub_malloc_zero(sizeof(struct user_manager));
++      users = (struct uhub_user_manager*) hub_malloc_zero(sizeof(struct uhub_user_manager));
+       users->list = list_create();
+       users->free_sid = 1;
+@@ -106,7 +106,7 @@
+ void user_manager_shutdown(struct hub_info* hub)
+ {
+-      struct user_manager* users = hub->users;
++      struct uhub_user_manager* users = hub->users;
+       event_del(&hub->ev_timer);
+       list_clear(users->list, &clear_user_list_callback);
+@@ -115,7 +115,7 @@
+ }
+-void user_manager_add(struct user* user)
++void user_manager_add(struct uhub_user* user)
+ {
+       list_append(user->hub->users->list, user);
+       user->hub->users->count++;
+@@ -125,7 +125,7 @@
+       user->hub->users->shared_files += user->limits.shared_files;
+ }
+-void user_manager_remove(struct user* user)
++void user_manager_remove(struct uhub_user* user)
+ {
+       list_remove(user->hub->users->list, user);
+       user->hub->users->count--;
+@@ -135,50 +135,50 @@
+ }
+-struct user* get_user_by_sid(struct hub_info* hub, sid_t sid)
++struct uhub_user* get_user_by_sid(struct hub_info* hub, sid_t sid)
+ {
+-      struct user* user = (struct user*) list_get_first(hub->users->list); /* iterate users */
++      struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate users */
+       while (user)
+       {
+               if (user->id.sid == sid)
+                       return user;
+-              user = (struct user*) list_get_next(hub->users->list);
++              user = (struct uhub_user*) list_get_next(hub->users->list);
+       }
+       return NULL;
+ }
+-struct user* get_user_by_cid(struct hub_info* hub, const char* cid)
++struct uhub_user* get_user_by_cid(struct hub_info* hub, const char* cid)
+ {
+-      struct user* user = (struct user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
++      struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
+       while (user)
+       {
+               if (strcmp(user->id.cid, cid) == 0)
+                       return user;
+-              user = (struct user*) list_get_next(hub->users->list);
++              user = (struct uhub_user*) list_get_next(hub->users->list);
+       }
+       return NULL;
+ }
+-struct user* get_user_by_nick(struct hub_info* hub, const char* nick)
++struct uhub_user* get_user_by_nick(struct hub_info* hub, const char* nick)
+ {
+-      struct user* user = (struct user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
++      struct uhub_user* user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate users - only on incoming INF msg */
+       while (user)
+       {
+               if (strcmp(user->id.nick, nick) == 0)
+                       return user;
+-              user = (struct user*) list_get_next(hub->users->list);
++              user = (struct uhub_user*) list_get_next(hub->users->list);
+       }
+       return NULL;
+ }
+-int send_user_list(struct user* target)
++int send_user_list(struct uhub_user* target)
+ {
+       int ret = 1;
+       user_flag_set(target, flag_user_list);
+-      struct user* user = (struct user*) list_get_first(target->hub->users->list); /* iterate users - only on INF or PAS msg */
++      struct uhub_user* user = (struct uhub_user*) list_get_first(target->hub->users->list); /* iterate users - only on INF or PAS msg */
+       while (user)
+       {
+               if (user_is_logged_in(user))
+@@ -187,7 +187,7 @@
+                       if (!ret)
+                               break;
+               }
+-              user = (struct user*) list_get_next(user->hub->users->list);
++              user = (struct uhub_user*) list_get_next(user->hub->users->list);
+       }
+       
+       if (!target->send_queue_size)
+@@ -198,7 +198,7 @@
+ }
+-void send_quit_message(struct user* leaving)
++void send_quit_message(struct uhub_user* leaving)
+ {
+       struct adc_message* command = adc_msg_construct(ADC_CMD_IQUI, 6);
+       adc_msg_add_argument(command, (const char*) sid_to_string(leaving->id.sid));
+@@ -216,8 +216,8 @@
+ sid_t user_manager_get_free_sid(struct hub_info* hub)
+ {
+ #if 0
+-      struct user* user;
+-      user = (struct user*) list_get_first(hub->users->list); /* iterate normal users */
++      struct uhub_user* user;
++      user = (struct uhub_user*) list_get_first(hub->users->list); /* iterate normal users */
+       while (user)
+       {
+               if (user->sid == hub->users->free_sid)
+@@ -226,7 +226,7 @@
+                       if (hub->users->free_sid >= SID_MAX) hub->users->free_sid = 1;
+                       break;
+               }
+-              user = (struct user*) list_get_next(hub->users->list);
++              user = (struct uhub_user*) list_get_next(hub->users->list);
+       }
+ #endif
+       return hub->users->free_sid++;
+--- a/src/usermanager.h
++++ b/src/usermanager.h
+@@ -20,7 +20,7 @@
+ #ifndef HAVE_UHUB_USER_MANAGER_H
+ #define HAVE_UHUB_USER_MANAGER_H
+-struct user_manager
++struct uhub_user_manager
+ {
+       size_t count;                   /**<< "Number of all fully connected and logged in users" */
+       size_t count_peak;              /**<< "Peak number of users" */
+@@ -51,14 +51,14 @@
+ /**
+  * Add a new user to the user manager.
+  */
+-extern void user_manager_add(struct user* user);
++extern void user_manager_add(struct uhub_user* user);
+ /**
+  * Remove a user from the user manager.
+  * This user is connected, and will be moved to the leaving queue, pending
+  * all messages in the message queue, and resource cleanup.
+  */
+-extern void user_manager_remove(struct user* user);
++extern void user_manager_remove(struct uhub_user* user);
+ /**
+  * Returns a free sid for a new user.
+@@ -70,19 +70,19 @@
+  * NOTE: This will only search connected users.
+  * @return a user if found, or NULL if not found
+  */
+-extern struct user* get_user_by_sid(struct hub_info* hub, sid_t sid);
++extern struct uhub_user* get_user_by_sid(struct hub_info* hub, sid_t sid);
+ /**
+  * Lookup a user based on the client ID (cid).
+  * @return a user if found, or NULL if not found
+  */
+-extern struct user* get_user_by_cid(struct hub_info* hub, const char* cid);
++extern struct uhub_user* get_user_by_cid(struct hub_info* hub, const char* cid);
+ /**
+  * Lookup a user based on the nick name.
+  * @return a user if found, or NULL if not found
+  */
+-extern struct user* get_user_by_nick(struct hub_info* hub, const char* nick);
++extern struct uhub_user* get_user_by_nick(struct hub_info* hub, const char* nick);
+ /**
+  * Send the user list of connected clients to 'user'.
+@@ -90,13 +90,13 @@
+  *
+  * @return 1 if sending the user list succeeded, 0 otherwise.
+  */
+-extern int send_user_list(struct user* user);
++extern int send_user_list(struct uhub_user* user);
+ /**
+  * Send a quit message to all connected users when 'user' is
+  * leaving the hub (for whatever reason).
+  */
+-extern void send_quit_message(struct user* user);
++extern void send_quit_message(struct uhub_user* user);
+ #endif /* HAVE_UHUB_USER_MANAGER_H */
diff --git a/net/ulogd/Makefile b/net/ulogd/Makefile
new file mode 100644 (file)
index 0000000..c676419
--- /dev/null
@@ -0,0 +1,146 @@
+#
+# 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:=ulogd
+PKG_VERSION:=1.24
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.netfilter.org/pub/ulogd/ \
+       ftp://ftp.be.netfilter.org/pub/netfilter/ulogd/ \
+       ftp://ftp.de.netfilter.org/pub/netfilter/ulogd/ \
+       ftp://ftp.no.netfilter.org/pub/netfilter/ulogd/
+PKG_MD5SUM:=05b4ed2926b9a22aaeaf642917bbf8ff
+
+define Package/ulogd/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://www.netfilter.org/projects/ulogd/index.html
+endef
+
+define Package/ulogd
+  $(call Package/ulogd/Default)
+  DEPENDS:=+iptables-mod-ulog
+  TITLE:=Netfilter userspace logging daemon
+  MENU:=1
+endef
+
+define Package/ulogd/conffiles
+/etc/default/ulogd
+/etc/ulogd.conf
+endef
+
+define Package/ulogd-mod-mysql
+  $(call Package/ulogd/Default)
+  DEPENDS:=ulogd +libmysqlclient
+  TITLE:=Output plugin for logging to a MySQL database
+endef
+
+define Package/ulogd-mod-pcap
+  $(call Package/ulogd/Default)
+  DEPENDS:=ulogd +libpcap
+  TITLE:=Output plugin for logging in pcap format
+endef
+
+define Package/ulogd-mod-pgsql
+  $(call Package/ulogd/Default)
+  DEPENDS:=ulogd +libpq
+  TITLE:=Output plugin for logging to a PostgreSQL database
+endef
+
+define Package/ulogd-mod-sqlite
+  $(call Package/ulogd/Default)
+  DEPENDS:=ulogd +libsqlite3
+  TITLE:=Output plugin for logging to an SQLite database
+endef
+
+define Package/ulogd-mod-extra
+  $(call Package/ulogd/Default)
+  DEPENDS:=ulogd
+  TITLE:=Extra plugins
+endef
+
+define Package/ulogd-mod-extra/description
+       This package contains the LOCAL, LOGEMU, OPRINT, PWSNIFF and SYSLOG plugins.
+endef
+
+include $(INCLUDE_DIR)/package.mk
+
+ifneq ($(Package/ulogd-mod-mysql),)
+  ULOGD_MYSQL_OPTION:= --with-mysql="$(STAGING_DIR)/usr"
+endif
+
+ifneq ($(Package/ulogd-mod-pcap),)
+  ULOGD_PCAP_HEADER:=yes
+else
+  ULOGD_PCAP_HEADER:=no
+endif
+
+ifneq ($(Package/ulogd-mod-pgsql),)
+  ULOGD_PGSQL_OPTION:= --with-pgsql="$(STAGING_DIR)/usr"
+endif
+
+ifneq ($(Package/ulogd-mod-sqlite),)
+  ULOGD_SQLITE_OPTION:= --with-sqlite3="$(STAGING_DIR)/usr"
+endif
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               $(ULOGD_MYSQL_OPTION) \
+               $(ULOGD_PGSQL_OPTION) \
+               $(ULOGD_SQLITE_OPTION) \
+               , \
+               ac_cv_header_pcap_h=$(ULOGD_PCAP_HEADER) \
+       )
+       $(SED) 's/-lgcc_s//g' $(PKG_BUILD_DIR)/Rules.make
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               CFLAGS="$(TARGET_CFLAGS) \
+                       -Iinclude \
+                       -I$(PKG_BUILD_DIR)/include/ulogd \
+                       -I$(PKG_BUILD_DIR)/include \
+                       -I$(PKG_BUILD_DIR)/libipulog/include \
+                       -Wl,--export-dynamic \
+                       $(TARGET_CPPFLAGS)" \
+               all install
+endef
+
+define Package/ulogd/install   
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/ulogd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ulogd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/ulogd
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_BASE.so $(1)/usr/lib/ulogd/
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_DATA) ./files/ulogd.default $(1)/etc/default/ulogd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ulogd.init $(1)/etc/init.d/ulogd
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/ulogd
+       for m in $(2); do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/ulogd/ulogd_$$$$$$$${m}.so $$(1)/usr/lib/ulogd/ ; \
+       done
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+$(eval $(call BuildPackage,ulogd))
+$(eval $(call BuildPlugin,ulogd-mod-mysql,MYSQL))
+$(eval $(call BuildPlugin,ulogd-mod-pcap,PCAP))
+$(eval $(call BuildPlugin,ulogd-mod-pgsql,PGSQL))
+$(eval $(call BuildPlugin,ulogd-mod-sqlite,SQLITE3))
+$(eval $(call BuildPlugin,ulogd-mod-extra,LOCAL LOGEMU OPRINT PWSNIFF SYSLOG))
diff --git a/net/ulogd/files/ulogd.default b/net/ulogd/files/ulogd.default
new file mode 100644 (file)
index 0000000..86bf444
--- /dev/null
@@ -0,0 +1 @@
+OPTIONS="-d"
\ No newline at end of file
diff --git a/net/ulogd/files/ulogd.init b/net/ulogd/files/ulogd.init
new file mode 100644 (file)
index 0000000..1e13bdb
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+PROG="ulogd"
+COMMAND="/usr/sbin/$PROG"
+DEFAULT="/etc/default/$PROG"
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       service_start $COMMAND $OPTIONS
+}
+
+stop() {
+       service_stop $COMMAND
+}
diff --git a/net/ulogd/patches/001-pcap_flags.patch b/net/ulogd/patches/001-pcap_flags.patch
new file mode 100644 (file)
index 0000000..c97d879
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN ulogd-1.23/pcap/Makefile.in ulogd-1.23.new/pcap/Makefile.in
+--- ulogd-1.23/pcap/Makefile.in        2004-03-23 23:36:04.000000000 +0100
++++ ulogd-1.23.new/pcap/Makefile.in    2006-04-19 11:30:45.000000000 +0200
+@@ -14,7 +14,7 @@
+ distrib:
+ $(SHARED_LIBS): %.so: %_sh.o
+-      $(LD) -shared -o $@ $< -lc -lpcap
++      $(LD) -shared -o $@ $< @LDFLAGS@ -lc -lpcap 
+
+ %_sh.o: %.c
+       $(CC) $(SH_CFLAGS) -o $@ -c $<
diff --git a/net/ulogd/patches/002-inc.patch b/net/ulogd/patches/002-inc.patch
new file mode 100644 (file)
index 0000000..b472112
--- /dev/null
@@ -0,0 +1,24 @@
+diff -ruN ulogd-1.23-old/Rules.make.in ulogd-1.23-new/Rules.make.in
+--- ulogd-1.23-old/Rules.make.in       2005-02-19 22:32:40.000000000 +0100
++++ ulogd-1.23-new/Rules.make.in       2005-05-27 07:45:18.000000000 +0200
+@@ -22,7 +22,7 @@
+ CFLAGS+=-DULOGD_CONFIGFILE=\"$(ULOGD_CONFIGFILE)\"
+ # doesn't work for subdirs
+ #CFLAGS+=$(INCIPULOG) $(INCCONFFILE)
+-CFLAGS+=-I/lib/modules/`uname -r`/build/include
++#CFLAGS+=-I/lib/modules/`uname -r`/build/include
+ #CFLAGS+=@DEFS@
+ #CFLAGS+=-g -DDEBUG -DDEBUG_MYSQL -DDEBUG_PGSQL
+diff -ruN ulogd-1.23-old/libipulog/Makefile.in ulogd-1.23-new/libipulog/Makefile.in
+--- ulogd-1.23-old/libipulog/Makefile.in       2004-03-23 23:36:06.000000000 +0100
++++ ulogd-1.23-new/libipulog/Makefile.in       2005-05-27 07:44:21.000000000 +0200
+@@ -1,7 +1,7 @@
+ #
+ include @top_srcdir@/Rules.make
+-CFLAGS+=-Iinclude -I/usr/src/linux/include
++CFLAGS+=-Iinclude
+ libipulog.a: libipulog.o
+       $(LD) -i $< -o $@
diff --git a/net/ulogd/patches/003-fix-bad-rpath.patch b/net/ulogd/patches/003-fix-bad-rpath.patch
new file mode 100644 (file)
index 0000000..0a2e646
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/configure
++++ b/configure
+@@ -1728,7 +1728,7 @@ else
+ EOF
+         MYSQLINCLUDES=`$d/mysql_config --include`
+-        MYSQLLIBS=`$d/mysql_config --libs`
++        MYSQLLIBS=`$d/mysql_config --libs | sed 's/-rdynamic//'`
+       DATABASE_DIR="${DATABASE_DIR} mysql"
+--- a/configure.in
++++ b/configure.in
+@@ -60,7 +60,7 @@ then
+ else
+         AC_DEFINE(HAVE_MYSQL)
+         MYSQLINCLUDES=`$d/mysql_config --include`
+-        MYSQLLIBS=`$d/mysql_config --libs`
++        MYSQLLIBS=`$d/mysql_config --libs | $(SED) 's/-rdynamic//'`
+       DATABASE_DIR="${DATABASE_DIR} mysql"
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -63,7 +63,7 @@ recurse: 
+       @for d in $(SUBDIRS); do if ! make -C $$d; then exit 1; fi; done
+ ulogd: ulogd.c $(LIBIPULOG) include/ulogd/ulogd.h conffile/conffile.o $(LIBIPULOG)/libipulog.a ulogd.conf
+-      $(CC) $(CFLAGS) -rdynamic $< conffile/conffile.o $(LIBIPULOG)/libipulog.a -o $@ $(LIBS)
++      $(CC) $(CFLAGS) $< conffile/conffile.o $(LIBIPULOG)/libipulog.a -o $@ $(LIBS)
+ edit = sed -e 's,@libdir\@,$(ULOGD_LIB_PATH),g'
diff --git a/net/umurmur/Makefile b/net/umurmur/Makefile
new file mode 100644 (file)
index 0000000..f4cc3bf
--- /dev/null
@@ -0,0 +1,95 @@
+#
+# Copyright (C) 2009-2012 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:=umurmur
+PKG_VERSION:=0.2.14
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://umurmur.googlecode.com/files
+PKG_MD5SUM:=e22121b4b91f4c9de43f858f6defa0b0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/umurmur/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Instant Messaging
+  TITLE:=uMurmur
+  DEPENDS:=+libconfig +libprotobuf-c
+  URL:=http://code.google.com/p/umurmur
+  MAINTAINER:=Martin Johansson <martin@fatbob.nu>
+endef
+
+define Package/umurmur/Default/description
+  Minimalistic Mumble server daemon.
+endef
+
+define Package/umurmur-openssl
+  $(call Package/umurmur/Default)
+  TITLE+= (with OpenSSL support)
+  DEPENDS+= +libopenssl
+  VARIANT:=openssl
+endef
+
+define Package/umurmur-openssl/description
+  $(call Package/umurmur/Default/description)
+  Uses OpenSSL library for SSL and crypto.
+endef
+
+define Package/umurmur-polarssl
+  $(call Package/umurmur/Default)
+  TITLE+= (with PolarSSL support)
+  DEPENDS+= +libpolarssl
+  VARIANT:=polarssl
+endef
+
+define Package/umurmur-polarssl/description
+  $(call Package/umurmur/Default/description)
+  Uses the PolarSSL library for SSL and crypto.
+endef
+
+define Build/Compile
+       CC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       $(MAKE) -C $(PKG_BUILD_DIR)/src all
+endef
+
+define Package/umurmur-openssl/conffiles
+/etc/umurmur.conf
+endef
+
+Package/umurmur-polarssl/conffiles = $(Package/umurmur-openssl/conffiles)
+
+define Package/umurmur-openssl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/umurmurd $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/openwrt/files/umurmur.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/files/umurmur.init $(1)/etc/init.d/umurmur
+       $(INSTALL_DIR) $(1)/etc/umurmur
+endef
+
+Package/umurmur-polarssl/install = $(Package/umurmur-openssl/install)
+
+ifeq ($(BUILD_VARIANT),openssl)
+  CONFIGURE_ARGS += \
+       --with-ssl=openssl
+endif
+
+ifeq ($(BUILD_VARIANT),polarssl)
+  CONFIGURE_ARGS += \
+       --with-ssl=polarssl
+endif
+
+$(eval $(call BuildPackage,umurmur-openssl))
+$(eval $(call BuildPackage,umurmur-polarssl))
diff --git a/net/unbound/Makefile b/net/unbound/Makefile
new file mode 100644 (file)
index 0000000..bba05c3
--- /dev/null
@@ -0,0 +1,172 @@
+#
+# Copyright (C) 2010-2014 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:=unbound
+PKG_VERSION:=1.4.22
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.unbound.net/downloads
+PKG_MD5SUM:=59728c74fef8783f8bad1d7451eba97f
+
+PKG_BUILD_DEPENDS:=libexpat
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/unbound/Default
+  TITLE:=A validating, recursive & caching DNS resolver
+  URL:=http://www.unbound.net/
+  DEPENDS:=+libopenssl
+endef
+
+define Package/unbound
+  $(call Package/unbound/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE+= (daemon)
+  DEPENDS+= +libunbound
+endef
+
+define Package/unbound/description
+  This package contains the Unbound daemon.
+endef
+
+define Package/unbound-anchor
+  $(call Package/unbound/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE+= (anchor utility)
+  DEPENDS+= +unbound +libexpat
+endef
+
+define Package/unbound-anchor/description
+  This package contains the Unbound anchor utility.
+endef
+
+define Package/unbound-control
+  $(call Package/unbound/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE+= (control utility)
+  DEPENDS+= +unbound
+endef
+
+define Package/unbound-control/description
+  This package contains the Unbound control utility.
+endef
+
+define Package/unbound-control-setup
+  $(call Package/unbound/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE+= (control setup utility)
+  DEPENDS+= +unbound-control +openssl-util
+endef
+
+define Package/unbound-control-setup/description
+  This package contains the Unbound control setup utility.
+endef
+
+define Package/unbound-host
+  $(call Package/unbound/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE+= (DNS lookup utility)
+  DEPENDS+= +libunbound
+endef
+
+define Package/unbound-host/description
+  This package contains the Unbound DNS lookup utility.
+endef
+
+define Package/libunbound
+  $(call Package/unbound/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+endef
+
+define Package/libunbound/description
+  This package contains the Unbound shared library.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-ecdsa \
+       --disable-gost \
+       --enable-allsymbols \
+       --with-libexpat="$(STAGING_DIR)/usr" \
+       --with-ssl="$(STAGING_DIR)/usr" \
+       --without-pthreads
+
+define Package/unbound/conffiles
+/etc/unbound/unbound.conf
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/unbound.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libunbound.{so*,a,la} $(1)/usr/lib/
+endef
+
+define Package/unbound/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/sbin/unbound \
+               $(PKG_INSTALL_DIR)/usr/sbin/unbound-checkconf \
+               $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/unbound
+       $(INSTALL_CONF) \
+               $(PKG_INSTALL_DIR)/etc/unbound/unbound.conf \
+               $(1)/etc/unbound/
+       $(INSTALL_CONF) ./files/root.key $(1)/etc/unbound/
+       $(INSTALL_CONF) ./files/named.cache $(1)/etc/unbound/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/unbound.init $(1)/etc/init.d/unbound
+endef
+
+define Package/unbound-anchor/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/unbound-anchor $(1)/usr/sbin/
+endef
+
+define Package/unbound-control/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/unbound-control $(1)/usr/sbin/
+endef
+
+define Package/unbound-control-setup/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/unbound-control-setup $(1)/usr/sbin/
+endef
+
+define Package/unbound-host/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/unbound-host $(1)/usr/sbin/
+endef
+
+define Package/libunbound/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libunbound.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,unbound))
+$(eval $(call BuildPackage,unbound-anchor))
+$(eval $(call BuildPackage,unbound-control))
+$(eval $(call BuildPackage,unbound-control-setup))
+$(eval $(call BuildPackage,unbound-host))
+$(eval $(call BuildPackage,libunbound))
diff --git a/net/unbound/files/named.cache b/net/unbound/files/named.cache
new file mode 100644 (file)
index 0000000..442b515
--- /dev/null
@@ -0,0 +1,89 @@
+;       This file holds the information on root name servers needed to
+;       initialize cache of Internet domain name servers
+;       (e.g. reference this file in the "cache  .  <file>"
+;       configuration file of BIND domain name servers).
+;
+;       This file is made available by InterNIC 
+;       under anonymous FTP as
+;           file                /domain/named.cache
+;           on server           FTP.INTERNIC.NET
+;       -OR-                    RS.INTERNIC.NET
+;
+;       last update:    Mar 26, 2014
+;       related version of root zone:   2014032601
+;
+; formerly NS.INTERNIC.NET
+;
+.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
+A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
+A.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:BA3E::2:30
+;
+; FORMERLY NS1.ISI.EDU
+;
+.                        3600000      NS    B.ROOT-SERVERS.NET.
+B.ROOT-SERVERS.NET.      3600000      A     192.228.79.201
+;
+; FORMERLY C.PSI.NET
+;
+.                        3600000      NS    C.ROOT-SERVERS.NET.
+C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
+C.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2::C
+;
+; FORMERLY TERP.UMD.EDU
+;
+.                        3600000      NS    D.ROOT-SERVERS.NET.
+D.ROOT-SERVERS.NET.      3600000      A     199.7.91.13
+D.ROOT-SERVERS.NET.     3600000      AAAA  2001:500:2D::D
+;
+; FORMERLY NS.NASA.GOV
+;
+.                        3600000      NS    E.ROOT-SERVERS.NET.
+E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
+;
+; FORMERLY NS.ISC.ORG
+;
+.                        3600000      NS    F.ROOT-SERVERS.NET.
+F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
+F.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2F::F
+;
+; FORMERLY NS.NIC.DDN.MIL
+;
+.                        3600000      NS    G.ROOT-SERVERS.NET.
+G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
+;
+; FORMERLY AOS.ARL.ARMY.MIL
+;
+.                        3600000      NS    H.ROOT-SERVERS.NET.
+H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
+H.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:1::803F:235
+;
+; FORMERLY NIC.NORDU.NET
+;
+.                        3600000      NS    I.ROOT-SERVERS.NET.
+I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
+I.ROOT-SERVERS.NET.      3600000      AAAA  2001:7FE::53
+;
+; OPERATED BY VERISIGN, INC.
+;
+.                        3600000      NS    J.ROOT-SERVERS.NET.
+J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
+J.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:C27::2:30
+;
+; OPERATED BY RIPE NCC
+;
+.                        3600000      NS    K.ROOT-SERVERS.NET.
+K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
+K.ROOT-SERVERS.NET.      3600000      AAAA  2001:7FD::1
+;
+; OPERATED BY ICANN
+;
+.                        3600000      NS    L.ROOT-SERVERS.NET.
+L.ROOT-SERVERS.NET.      3600000      A     199.7.83.42
+L.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:3::42
+;
+; OPERATED BY WIDE
+;
+.                        3600000      NS    M.ROOT-SERVERS.NET.
+M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
+M.ROOT-SERVERS.NET.      3600000      AAAA  2001:DC3::35
+; End of File
diff --git a/net/unbound/files/root.key b/net/unbound/files/root.key
new file mode 100644 (file)
index 0000000..2ad6641
--- /dev/null
@@ -0,0 +1 @@
+. IN DS 19036 8 2 49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
diff --git a/net/unbound/files/unbound.init b/net/unbound/files/unbound.init
new file mode 100755 (executable)
index 0000000..4e700e4
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+#Copyright (C) 2010 Ondrej Caletka <o.caletka@sh.cvut.cz>
+START=61
+
+start () {
+       unbound
+}
+
+stop () {
+       PIDFILE='/var/run/unbound.pid'
+       if [ -f $PIDFILE ] ; then
+               kill $(cat $PIDFILE)
+       fi
+}
diff --git a/net/unbound/patches/001-conf.patch b/net/unbound/patches/001-conf.patch
new file mode 100644 (file)
index 0000000..6300e51
--- /dev/null
@@ -0,0 +1,154 @@
+--- a/doc/example.conf.in
++++ b/doc/example.conf.in
+@@ -38,6 +38,8 @@ server:
+       # interface: 192.0.2.154
+       # interface: 192.0.2.154@5003
+       # interface: 2001:DB8::5
++      interface: 0.0.0.0
++      interface: ::0
+       # enable this feature to copy the source address of queries to reply.
+       # Socket options are not supported on all platforms. experimental. 
+@@ -57,6 +59,7 @@ server:
+       # port range that can be open simultaneously.  About double the
+       # num-queries-per-thread, or, use as many as the OS will allow you.
+       # outgoing-range: 4096
++      outgoing-range: 60
+       # permit unbound to use this port number or port range for
+       # making outgoing queries, using an outgoing interface.
+@@ -73,9 +76,11 @@ server:
+       # number of outgoing simultaneous tcp buffers to hold per thread.
+       # outgoing-num-tcp: 10
++      outgoing-num-tcp: 1
+       # number of incoming simultaneous tcp buffers to hold per thread.
+       # incoming-num-tcp: 10
++      incoming-num-tcp: 1
+       # buffer size for UDP port 53 incoming (SO_RCVBUF socket option).
+       # 0 is system default.  Use 4m to catch query spikes for busy servers.
+@@ -99,18 +104,22 @@ server:
+       # buffer size for handling DNS data. No messages larger than this
+       # size can be sent or received, by UDP or TCP. In bytes.
+       # msg-buffer-size: 65552
++      msg-buffer-size: 8192
+       # the amount of memory to use for the message cache.
+       # plain value in bytes or you can append k, m or G. default is "4Mb". 
+       # msg-cache-size: 4m
++      msg-cache-size: 100k
+       # the number of slabs to use for the message cache.
+       # the number of slabs must be a power of 2.
+       # more slabs reduce lock contention, but fragment memory usage.
+       # msg-cache-slabs: 4
++      msg-cache-slabs: 1
+       # the number of queries that a thread gets to service.
+       # num-queries-per-thread: 1024
++      num-queries-per-thread: 30
+       # if very busy, 50% queries run to completion, 50% get timeout in msec
+       # jostle-timeout: 200
+@@ -121,11 +130,13 @@ server:
+       # the amount of memory to use for the RRset cache.
+       # plain value in bytes or you can append k, m or G. default is "4Mb". 
+       # rrset-cache-size: 4m
++      rrset-cache-size: 100k
+       # the number of slabs to use for the RRset cache.
+       # the number of slabs must be a power of 2.
+       # more slabs reduce lock contention, but fragment memory usage.
+       # rrset-cache-slabs: 4
++      rrset-cache-slabs: 1
+       # the time to live (TTL) value lower bound, in seconds. Default 0.
+       # If more than an hour could easily give trouble due to stale data.
+@@ -143,9 +154,11 @@ server:
+       # the number of slabs must be a power of 2.
+       # more slabs reduce lock contention, but fragment memory usage.
+       # infra-cache-slabs: 4
++      infra-cache-slabs: 1
+       # the maximum number of hosts that are cached (roundtrip, EDNS, lame).
+       # infra-cache-numhosts: 10000
++      infra-cache-numhosts: 200
+       # Enable IPv4, "yes" or "no".
+       # do-ip4: yes
+@@ -178,6 +191,8 @@ server:
+       # access-control: ::0/0 refuse
+       # access-control: ::1 allow
+       # access-control: ::ffff:127.0.0.1 allow
++      access-control: 0.0.0.0/0 allow
++      access-control: ::0/0 allow
+       # if given, a chroot(2) is done to the given directory.
+       # i.e. you can chroot to the working directory, for example,
+@@ -208,6 +223,7 @@ server:
+       # and the given username is assumed. Default is user "unbound".
+       # If you give "" no privileges are dropped.
+       # username: "@UNBOUND_USERNAME@"
++      username: ""
+       # the working directory. The relative files in this config are 
+       # relative to this directory. If you give "" the working directory
+@@ -230,10 +246,12 @@ server:
+       # the pid file. Can be an absolute path outside of chroot/work dir.
+       # pidfile: "@UNBOUND_PIDFILE@"
++      pidfile: "/var/run/unbound.pid"
+       # file to read root hints from.
+       # get one from ftp://FTP.INTERNIC.NET/domain/named.cache
+       # root-hints: ""
++      root-hints: "/etc/unbound/named.cache"
+       # enable to not answer id.server and hostname.bind queries.
+       # hide-identity: no
+@@ -256,12 +274,15 @@ server:
+       #       positive value: fetch that many targets opportunistically.
+       # Enclose the list of numbers between quotes ("").
+       # target-fetch-policy: "3 2 1 0 0"
++      target-fetch-policy: "2 1 0 0 0 0"
+       # Harden against very small EDNS buffer sizes. 
+       # harden-short-bufsize: no
++      harden-short-bufsize: yes
+       # Harden against unseemly large queries.
+       # harden-large-queries: no
++      harden-large-queries: yes
+       # Harden against out of zone rrsets, to avoid spoofing attempts. 
+       # harden-glue: yes
+@@ -342,7 +363,7 @@ server:
+       # you start unbound (i.e. in the system boot scripts).  And enable:
+       # Please note usage of unbound-anchor root anchor is at your own risk
+       # and under the terms of our LICENSE (see that file in the source).
+-      # auto-trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
++      auto-trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
+       # File with DLV trusted keys. Same format as trust-anchor-file.
+       # There can be only one DLV configured, it is trusted from root down.
+@@ -428,15 +449,18 @@ server:
+       # the amount of memory to use for the key cache.
+       # plain value in bytes or you can append k, m or G. default is "4Mb". 
+       # key-cache-size: 4m
++      key-cache-size: 100k
+       # the number of slabs to use for the key cache.
+       # the number of slabs must be a power of 2.
+       # more slabs reduce lock contention, but fragment memory usage.
+       # key-cache-slabs: 4
++      key-cache-slabs: 1
+       # the amount of memory to use for the negative cache (used for DLV).
+       # plain value in bytes or you can append k, m or G. default is "1Mb". 
+       # neg-cache-size: 1m
++      neg-cache-size: 10k
+       # By default, for a number of zones a small default 'nothing here'
+       # reply is built-in.  Query traffic is thus blocked.  If you
diff --git a/net/unfs3/Makefile b/net/unfs3/Makefile
new file mode 100644 (file)
index 0000000..339b3cf
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# 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:=unfs3
+PKG_VERSION:=0.9.22
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=ddf679a5d4d80096a59f3affc64f16e5
+
+PKG_LICENSE:=UNFS3
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/unfs3
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Filesystem
+  DEPENDS:=+portmap $(LIBRPC_DEPENDS)
+  TITLE:=User-space NFSv3 Server
+  URL:=http://unfs3.sourceforge.net/
+endef
+
+define Package/unfs3/description
+       UNFS3 is a user-space implementation of the NFSv3 server
+       specification. It provides a daemon for the MOUNT and NFS
+       protocols, which are used by NFS clients for accessing files
+       on the server.
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
+TARGET_LDFLAGS += $(LIBRPC)
+
+define Package/unfs3/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/$(PKG_NAME).exports $(1)/etc/exports
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/unfsd $(1)/usr/sbin
+endef
+
+define Package/unfs3/conffiles
+/etc/exports
+endef
+
+$(eval $(call BuildPackage,unfs3))
diff --git a/net/unfs3/files/unfs3.exports b/net/unfs3/files/unfs3.exports
new file mode 100644 (file)
index 0000000..a730f77
--- /dev/null
@@ -0,0 +1 @@
+/mnt    (ro,all_squash,insecure)
diff --git a/net/unfs3/files/unfs3.init b/net/unfs3/files/unfs3.init
new file mode 100644 (file)
index 0000000..4a5965a
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       service_start /usr/sbin/unfsd
+}
+
+stop() {
+       service_stop /usr/sbin/unfsd
+}
diff --git a/net/unfs3/patches/100-no_lfl.patch b/net/unfs3/patches/100-no_lfl.patch
new file mode 100644 (file)
index 0000000..c4a971f
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/Config/lex.yy.c
++++ b/Config/lex.yy.c
+@@ -445,9 +445,15 @@ static void copy_text(const char *from, 
+ #ifndef YY_SKIP_YYWRAP
+ #ifdef __cplusplus
+-extern "C" int yywrap YY_PROTO(( void ));
+-#else
+-extern int yywrap YY_PROTO(( void ));
++/* extern "C" int yywrap YY_PROTO(( void )); */
++int yywrap (void ) {
++    return 1;
++}
++#else
++/* extern int yywrap YY_PROTO(( void )); */
++int yywrap (void ) {
++    return 1;
++}
+ #endif
+ #endif
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -12,7 +12,7 @@ OBJS = attr.o daemon.o error.o fd_cache.
+        md5.o mount.o nfs.o password.o readdir.o user.o xdr.o winsupport.o
+ CONFOBJ = Config/lib.a
+ EXTRAOBJ = @EXTRAOBJ@
+-LDFLAGS = @LDFLAGS@ @LIBS@ @LEXLIB@
++LDFLAGS = @LDFLAGS@ @LIBS@
+ EXEEXT = @EXEEXT@
+ prefix = @prefix@
+--- a/configure
++++ b/configure
+@@ -2604,7 +2604,7 @@ else
+     ac_save_LIBS=$LIBS
+     ac_cv_lib_lex='none needed'
+-    for ac_lib in '' -lfl -ll; do
++    for ac_lib in '' -ll; do
+       LIBS="$ac_lib $ac_save_LIBS"
+       cat >conftest.$ac_ext <<_ACEOF
+ `cat $LEX_OUTPUT_ROOT.c`
diff --git a/net/uob-nomad/Makefile b/net/uob-nomad/Makefile
new file mode 100644 (file)
index 0000000..937b2d5
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# 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:=uob-nomad
+PKG_VERSION:=0.11
+PKG_RELEASE:=2
+
+PKG_SOURCE_URL:=http://www.comnets.uni-bremen.de/~mab/openwrt/source/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=9c7445cefaf8d6160017aef606f2e558
+
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/uob-nomad
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-iptunnel4 +libpthread
+  TITLE:=UoB Nomad
+  URL:=http://www.comnets.uni-bremen.de/~mab/openwrt/source/
+endef
+
+define Package/uob-nomad/description
+This is an implementation of NOMADv4 (Filters for
+       Mobile IP, IETF Draft
+       draft-mobileip-nomad-filters-05.txt) for Linux,
+       based on the Sun Labs Mobile IP software. It is
+       released under the Sun Public License (SPL).
+       
+       This version (0.11) has been modified to provide
+       status information to the UoB-NOMAD-GUI (ver 0.1).
+endef
+
+TARGET_CFLAGS += -include stddef.h -include string.h
+
+MAKE_FLAGS = \
+       CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+
+define Build/Compile
+$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/Agent clean mipagent)
+$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/Client/net-tools clean)
+$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/Client/net-tools/lib clean)
+$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/Client/net-tools all)
+$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/Client clean mipmn)
+endef
+
+define Package/uob-nomad/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/etc/
+       $(CP) $(PKG_BUILD_DIR)/Agent/mipagent $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/Client/mipmn $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/conf/mip{agent,mn,mn-filters}.conf $(1)/etc/
+endef
+
+define Package/uob-nomad/conffiles
+/etc/mip{agent,mn,mn-filters}.conf
+endef
+
+$(eval $(call BuildPackage,uob-nomad))
diff --git a/net/uob-nomad/patches/001-inet_sr.patch b/net/uob-nomad/patches/001-inet_sr.patch
new file mode 100644 (file)
index 0000000..21c940b
--- /dev/null
@@ -0,0 +1,11 @@
+diff -urN uob-nomad-0.11/Client/net-tools/lib/inet_sr.c uob-nomad-0.11.new/Client/net-tools/lib/inet_sr.c
+--- uob-nomad-0.11/Client/net-tools/lib/inet_sr.c      2003-09-05 10:21:52.000000000 +0200
++++ uob-nomad-0.11.new/Client/net-tools/lib/inet_sr.c  2006-10-09 20:36:50.000000000 +0200
+@@ -105,6 +105,7 @@
+     case 2:
+        isnet = 0; break;
+     default:
++      break;
+     }
+     /* Fill in the other fields. */
diff --git a/net/uob-nomad/patches/002-hostname.patch b/net/uob-nomad/patches/002-hostname.patch
new file mode 100644 (file)
index 0000000..7882c15
--- /dev/null
@@ -0,0 +1,34 @@
+--- uob-nomad-0.11/Client/net-tools/hostname.c 2003-09-05 10:21:54.000000000 +0200
++++ uob-nomad-0.11.new/Client/net-tools/hostname.c     2006-10-09 20:38:25.000000000 +0200
+@@ -77,6 +77,7 @@
+             fprintf(stderr, _("%s: name too long\n"), program_name);
+             break;
+         default:
++          break;
+         }
+       exit(1);
+     }
+@@ -97,6 +98,7 @@
+           fprintf(stderr, _("%s: name too long\n"), program_name);
+           break;
+       default:
++          break;
+       }
+       exit(1);
+     };
+@@ -116,6 +118,7 @@
+           fprintf(stderr, _("%s: name too long\n"), program_name);
+           break;
+       default:
++          break;
+       }
+       exit(1);
+     };
+@@ -173,6 +176,7 @@
+       printf("%s\n", hp->h_name);
+       break;
+     default:
++      break;
+     }
+ }
diff --git a/net/uob-nomad/patches/003-conf.patch b/net/uob-nomad/patches/003-conf.patch
new file mode 100644 (file)
index 0000000..7927a05
--- /dev/null
@@ -0,0 +1,21 @@
+diff -ruN package/uobnomad.orig/patches/003-conf.patch package/uobnomad/patches/003-conf.patch
+--- package/uobnomad.orig/patches/003-conf.patch        1970-01-01 01:00:00.000000000 +0100
++++ package/uobnomad/patches/003-conf.patch     2006-05-08 16:54:36.000000000 +0200
+@@ -0,0 +1,17 @@
++--- uob-nomad-0.11-orig/Client/mobile.h        2003-10-20 16:07:09.000000000 +0200
+++++ uob-nomad-0.11/Client/mobile.h     2006-05-08 16:53:31.000000000 +0200
++@@ -83,10 +83,10 @@
++ /* Destination port for registration requests */
++ #define MIP_PORT                     434
++
++-//#define CONF_FILE_NAME               "/etc/mipmn.conf"
++-//#define FILTER_FILE_NAME             "/etc/mipmn-filters.conf"
++-#define CONF_FILE_NAME               "/home/adu/mipmn.conf"
++-#define FILTER_FILE_NAME             "/home/adu/mipmn-filters.conf"
+++#define CONF_FILE_NAME               "/etc/mipmn.conf"
+++#define FILTER_FILE_NAME             "/etc/mipmn-filters.conf"
+++//#define CONF_FILE_NAME               "/home/adu/mipmn.conf"
+++//#define FILTER_FILE_NAME             "/home/adu/mipmn-filters.conf"
++ #define ROUTE_PATH                     "/sbin/route"
++
++ /* Maximum number of mobility agents a MN keeps track of */
diff --git a/net/uob-nomad/patches/004-linux26_header_fix.patch b/net/uob-nomad/patches/004-linux26_header_fix.patch
new file mode 100644 (file)
index 0000000..98a1791
--- /dev/null
@@ -0,0 +1,14 @@
+diff -ur nomad.old/Client/net-tools/lib/x25_sr.c nomad.dev/Client/net-tools/lib/x25_sr.c
+--- nomad.old/Client/net-tools/lib/x25_sr.c    2003-09-05 10:21:52.000000000 +0200
++++ nomad.dev/Client/net-tools/lib/x25_sr.c    2006-12-09 00:19:50.036574096 +0100
+@@ -41,6 +41,10 @@
+ #include "net-features.h"
++#ifdef X25_MASK_CALLING_AE
++typedef struct x25_address x25_address;
++#endif
++
+ extern     struct aftype   x25_aftype;
+ static int skfd = -1;
diff --git a/net/uob-nomad/patches/005-linux_if_strip_fix.patch b/net/uob-nomad/patches/005-linux_if_strip_fix.patch
new file mode 100644 (file)
index 0000000..82ffefb
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/Client/net-tools/lib/strip.c
++++ b/Client/net-tools/lib/strip.c
+@@ -21,7 +21,6 @@
+ #include <sys/socket.h>
+ #include <net/if_arp.h>
+ #include <linux/types.h>
+-#include <linux/if_strip.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <ctype.h>
+@@ -35,6 +34,9 @@
+ #include "util.h"
+ #include "intl.h"
++typedef struct {
++  __u8 c[6];
++} MetricomAddress;
+ extern struct hwtype strip_hwtype;
diff --git a/net/uob-nomad/patches/006-linux_if_tr_fix.patch b/net/uob-nomad/patches/006-linux_if_tr_fix.patch
new file mode 100644 (file)
index 0000000..778ce38
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Client/net-tools/lib/tr.c
++++ b/Client/net-tools/lib/tr.c
+@@ -20,7 +20,7 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <net/if_arp.h>
+-#include <linux/if_tr.h>
++#include <netinet/if_tr.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <errno.h>
diff --git a/net/updatedd/Makefile b/net/updatedd/Makefile
new file mode 100644 (file)
index 0000000..6c023e7
--- /dev/null
@@ -0,0 +1,155 @@
+#
+# Copyright (C) 2007-2012 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:=updatedd
+PKG_VERSION:=2.6
+PKG_RELEASE:=9
+
+PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=f03446105ed043cd5dbd1ab95484d27f
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/updatedd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  MENU:=1
+  TITLE:=A tool to update dynamic dns services
+  URL:=http://savannah.nongnu.org/projects/updatedd/
+endef
+
+define Package/updatedd/description
+Updatedd is a small tool that will update one of many dynamic
+       dns services on boot.
+       Please look at the /etc/init.d/ddns script for more info.
+
+endef
+
+define Package/updatedd/conffiles
+/etc/config/updatedd
+endef
+
+define Package/updatedd-mod-changeip
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=changeip.com
+endef
+
+define Package/updatedd-mod-dyndns
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=dyndns.org
+endef
+
+define Package/updatedd-mod-eurodyndns
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=eurodyndns.org
+endef
+
+define Package/updatedd-mod-hn
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=hn.org
+endef
+
+define Package/updatedd-mod-noip
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=no-ip.com
+endef
+
+define Package/updatedd-mod-ods
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=ods.org
+endef
+
+define Package/updatedd-mod-ovh
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=ovh.com
+endef
+
+define Package/updatedd-mod-regfish
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=regfish.com
+endef
+
+define Package/updatedd-mod-tzo
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=tzo.com
+endef
+
+define Package/updatedd-mod-zoneedit
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  DEPENDS:=updatedd
+  TITLE:=zoneedit.com
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/updatedd
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/updatedd/$(2).so* $$(1)/usr/lib/updatedd/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+define Package/updatedd/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/updatedd.init $(1)/etc/init.d/updatedd
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/updatedd.config $(1)/etc/config/updatedd
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/updatedd $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/updatedd
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/updatedd.hotplug $(1)/etc/hotplug.d/iface/30-updatedd
+endef
+
+$(eval $(call BuildPackage,updatedd))
+$(eval $(call BuildPlugin,updatedd-mod-changeip,libchangeip))
+$(eval $(call BuildPlugin,updatedd-mod-dyndns,libdyndns))
+$(eval $(call BuildPlugin,updatedd-mod-eurodyndns,libeurodyndns))
+$(eval $(call BuildPlugin,updatedd-mod-hn,libhn))
+$(eval $(call BuildPlugin,updatedd-mod-noip,libnoip))
+$(eval $(call BuildPlugin,updatedd-mod-ods,libods))
+$(eval $(call BuildPlugin,updatedd-mod-ovh,libovh))
+$(eval $(call BuildPlugin,updatedd-mod-regfish,libregfish))
+$(eval $(call BuildPlugin,updatedd-mod-tzo,libtzo))
+$(eval $(call BuildPlugin,updatedd-mod-zoneedit,libzoneedit))
diff --git a/net/updatedd/files/updatedd.config b/net/updatedd/files/updatedd.config
new file mode 100644 (file)
index 0000000..f2e9e91
--- /dev/null
@@ -0,0 +1,6 @@
+config updatedd
+        option service     ''
+        option username    ''
+        option password    ''
+        option host        ''
+        option update      '0'
diff --git a/net/updatedd/files/updatedd.hotplug b/net/updatedd/files/updatedd.hotplug
new file mode 100644 (file)
index 0000000..a918025
--- /dev/null
@@ -0,0 +1,14 @@
+NAME=updatedd
+CONFIG=/etc/config/$NAME
+COMMAND=/usr/bin/$NAME
+
+[ "$ACTION" = "ifup" ] && {
+       [ -x $COMMAND ] && [ -r $CONFIG ] && {
+               . /lib/functions/network.sh
+
+               local device
+               network_get_device device wan && {
+                       /etc/init.d/updatedd restart
+               }
+       } &
+}
diff --git a/net/updatedd/files/updatedd.init b/net/updatedd/files/updatedd.init
new file mode 100644 (file)
index 0000000..5ae4545
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start_instance () {
+       local section="$1"
+       config_get service  "$section" 'service'
+       config_get username "$section" 'username'
+       config_get password "$section" 'password'
+       config_get host     "$section" 'host'
+       config_get update   "$section" 'update'
+
+       [ "$update" = 1 ] && {
+               if [ "$service" = "dyndns" ]; then
+                       wget http://checkip.dyndns.org -O /tmp/updatedd_ip_check
+                       current_ip=`cat /tmp/updatedd_ip_check |cut -d':' -f2|cut -d'<' -f1 |cut -d' ' -f2`
+                       rm /tmp/updatedd_ip_check
+                       old_ip=`nslookup "$host" |grep "$host" -A 1 |grep Address |cut -d' ' -f3`
+                       if [ "$current_ip" = "$old_ip" ]; then
+                               echo "Preventing abusive update"
+                               abusive=1
+                       fi
+               fi
+               if [ "$abusive" != "1" ]; then
+                       service_start /usr/bin/updatedd -Y $service -- $username:$password $host
+               fi
+       }
+}
+
+start() {
+       config_load 'updatedd'
+       config_foreach start_instance 'updatedd'
+}
+
+stop() {
+       service_stop /usr/bin/updatedd
+}
diff --git a/net/updatedd/patches/001-service_libname.patch b/net/updatedd/patches/001-service_libname.patch
new file mode 100644 (file)
index 0000000..0003a6e
--- /dev/null
@@ -0,0 +1,84 @@
+--- a/src/updatedd.c
++++ b/src/updatedd.c
+@@ -36,7 +36,8 @@
+ #include <limits.h> /* PATH_MAX */
+ #include "updatedd.h"
+-#define PLUGIN_ENDING ".so"
++#define LIBPREFIX  "lib"
++#define LIBSUFFIX  ".so"
+ void
+ print_usage(char *pname, FILE *fp)
+@@ -92,23 +93,7 @@
+ void
+ get_plugin_path(char *service, char *buffer, size_t len)
+ {
+-        FILE *pipe;
+-        char la_path[PATH_MAX];
+-        char lib_name[256];
+-        char command[1024];
+-
+-        (void)snprintf(la_path, PATH_MAX-1, LIBPATH "/lib%s.la", service);
+-
+-        snprintf(command, 1023, ". %s; echo $dlname", la_path);
+-        if((pipe = popen(command, "r")) == NULL)
+-                err(PERR, "popen() failed");
+-        fscanf(pipe, "%255s", lib_name);
+-
+-        if(fclose(pipe) == EOF)
+-                err(PERR, "fclose() failed");
+-
+-      (void)memset(buffer, 0, len);
+-        snprintf(buffer, len-1, LIBPATH"/%s", lib_name);
++        snprintf(buffer, len-1, LIBPATH "/" LIBPREFIX "%s" LIBSUFFIX, service);
+ }
+ void *
+@@ -139,6 +124,7 @@
+ }
++#define SERVICE_MAXLEN  20
+ int
+ get_service(DIR *dir, char *buf, size_t size)
+ {
+@@ -146,26 +132,19 @@
+       struct dirent *dir_info;
+       while( (dir_info = readdir(dir)) ) {
++              char *p = dir_info->d_name;
+               int n;
+-              char *ptr = strstr(dir_info->d_name, ".la");
+-
+-                if(strlen(dir_info->d_name) < 6)
+-                        continue;
+-
+-              if(ptr != NULL) {
+-                        if(!dir_info->d_name[0] == 'l')
+-                                continue;
+-                        if(!dir_info->d_name[1] == 'i')
+-                                continue;
+-                        if(!dir_info->d_name[2] == 'b')
+-                                continue;
+-
+-                      for(n = 0; dir_info->d_name+n+3 != ptr; n++) {
+-                              buf[n] = dir_info->d_name[n+3];
+-                      }
+-                      buf[n] = '\0';
+-                      return 1;
+-              }
++              if( strlen(p) <= strlen(LIBPREFIX LIBSUFFIX) )
++                      continue;
++              if( strstr(p, LIBPREFIX) != p )
++                      continue;
++              p += strlen(LIBPREFIX);
++              n = strlen(p) - strlen(LIBSUFFIX);
++              if( strstr(p + n, LIBSUFFIX) != p + n )
++                      continue;
++              p[n] = 0;
++              strncpy(buf, p, size);
++              return 1;
+       }
+       return 0;
diff --git a/net/updatedd/patches/002-ovh-dyndnshost.patch b/net/updatedd/patches/002-ovh-dyndnshost.patch
new file mode 100644 (file)
index 0000000..0e617d9
--- /dev/null
@@ -0,0 +1,12 @@
+diff -pruN updatedd-2.6-ori/src/plugins/libovh.h updatedd-2.6/src/plugins/libovh.h
+--- updatedd-2.6-ori/src/plugins/libovh.h      2006-09-07 22:32:59.000000000 +0200
++++ updatedd-2.6/src/plugins/libovh.h  2008-06-08 13:12:17.000000000 +0200
+@@ -21,7 +21,7 @@
+ #include <ret_codes.h>
+-#define DYNDNSHOST    "ovh.com"
++#define DYNDNSHOST    "www.ovh.com"
+ #define PORT          80
+ #define BUFSIZE               512
diff --git a/net/updatedd/patches/003-zoneedit-url-fix.patch b/net/updatedd/patches/003-zoneedit-url-fix.patch
new file mode 100644 (file)
index 0000000..9e40001
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/plugins/libzoneedit.h
++++ b/src/plugins/libzoneedit.h
+@@ -21,7 +21,7 @@
+ #include <ret_codes.h>
+-#define DYNDNSHOST    "www.zoneedit.com"
++#define DYNDNSHOST    "dynamic.zoneedit.com"
+ #define PORT          80
+ #define BUFSIZE               4096
diff --git a/net/updatedd/patches/004-fix_liberty_dep.patch b/net/updatedd/patches/004-fix_liberty_dep.patch
new file mode 100644 (file)
index 0000000..9085a32
--- /dev/null
@@ -0,0 +1,122 @@
+diff -Nur updatedd-2.6/config.h.in updatedd-2.6.lx2/config.h.in
+--- updatedd-2.6/config.h.in   2006-09-15 18:19:37.000000000 +0400
++++ updatedd-2.6.lx2/config.h.in       2009-11-25 11:00:14.000000000 +0300
+@@ -36,9 +36,6 @@
+ /* Define to 1 if you have the `dl' library (-ldl). */
+ #undef HAVE_LIBDL
+-/* Define to 1 if you have the `iberty' library (-liberty). */
+-#undef HAVE_LIBIBERTY
+-
+ /* Define to 1 if you have the `nsl' library (-lnsl). */
+ #undef HAVE_LIBNSL
+diff -Nur updatedd-2.6/configure updatedd-2.6.lx2/configure
+--- updatedd-2.6/configure     2006-09-15 18:19:10.000000000 +0400
++++ updatedd-2.6.lx2/configure 2009-11-25 11:02:02.000000000 +0300
+@@ -20596,93 +20596,6 @@
+ fi
+-{ echo "$as_me:$LINENO: checking for vasprintf in -liberty" >&5
+-echo $ECHO_N "checking for vasprintf in -liberty... $ECHO_C" >&6; }
+-if test "${ac_cv_lib_iberty_vasprintf+set}" = set; then
+-  echo $ECHO_N "(cached) $ECHO_C" >&6
+-else
+-  ac_check_lib_save_LIBS=$LIBS
+-LIBS="-liberty  $LIBS"
+-cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
+-/* end confdefs.h.  */
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char vasprintf ();
+-int
+-main ()
+-{
+-return vasprintf ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (ac_try="$ac_link"
+-case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_link") 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } &&
+-       { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; } &&
+-       { ac_try='test -s conftest$ac_exeext'
+-  { (case "(($ac_try" in
+-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+-  *) ac_try_echo=$ac_try;;
+-esac
+-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+-  (eval "$ac_try") 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
+-  ac_cv_lib_iberty_vasprintf=yes
+-else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
+-
+-      ac_cv_lib_iberty_vasprintf=no
+-fi
+-
+-rm -f core conftest.err conftest.$ac_objext \
+-      conftest$ac_exeext conftest.$ac_ext
+-LIBS=$ac_check_lib_save_LIBS
+-fi
+-{ echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_vasprintf" >&5
+-echo "${ECHO_T}$ac_cv_lib_iberty_vasprintf" >&6; }
+-if test $ac_cv_lib_iberty_vasprintf = yes; then
+-  cat >>confdefs.h <<_ACEOF
+-#define HAVE_LIBIBERTY 1
+-_ACEOF
+-
+-  LIBS="-liberty $LIBS"
+-
+-fi
+-
+-
+ # ------------------] GETOPT_LONG [
+diff -Nur updatedd-2.6/configure.ac updatedd-2.6.lx2/configure.ac
+--- updatedd-2.6/configure.ac  2006-09-15 18:18:44.000000000 +0400
++++ updatedd-2.6.lx2/configure.ac      2009-11-25 11:00:33.000000000 +0300
+@@ -74,8 +74,6 @@
+ AC_CHECK_LIB([c], [dlopen])
+ dnl Linux distributes dlopen() in libdl.
+ AC_CHECK_LIB([dl], [dlopen])
+-dnl Tru64 distributes vasprintf() in -liberty
+-AC_CHECK_LIB([iberty], [vasprintf])
+ # ------------------] GETOPT_LONG [
diff --git a/net/usbip/Makefile b/net/usbip/Makefile
new file mode 100644 (file)
index 0000000..65e2469
--- /dev/null
@@ -0,0 +1,107 @@
+#
+# Copyright (C) 2010-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=usbip
+PKG_RELEASE:=3
+
+# Since kernel 2.6.39.1 userspace tools are inside the kernel tree
+# Package Automatic match version in kernel
+# MD5SUM is not useful kernel package already check it
+PKG_VERSION:=$(shell  sed -n -e '/^AC_INIT/s/.*\[\([[:digit:]\.]*\)\].*/\1/gp' $(LINUX_DIR)/drivers/staging/usbip/userspace/configure.ac)
+PKG_SOURCE:=
+PKG_SOURCE_URL:=
+PKG_MD5SUM:=unknown
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+PATCH_DIR:=./patches-$(PKG_VERSION)
+
+define prepare_source_directory
+       rm -rf $(PKG_BUILD_DIR)
+       $(CP) $(LINUX_DIR)/drivers/staging/usbip/userspace $(PKG_BUILD_DIR)
+endef
+Hooks/Prepare/Pre += prepare_source_directory
+
+PKG_BUILD_DEPENDS:=glib2 sysfsutils
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/usbip/Common
+  TITLE:=USB-over-IP
+  URL:=http://usbip.sourceforge.net/
+  DEPENDS:=@USB_SUPPORT
+endef
+
+define Package/usbip/Default
+  $(call Package/usbip/Common)
+  SECTION:=net
+  CATEGORY:=Network
+endef
+
+define Package/usbip
+  $(call Package/usbip/Default)
+  TITLE+= (common)
+  DEPENDS+= +libsysfs +libwrap +kmod-usbip
+endef
+
+define Package/usbip-client
+  $(call Package/usbip/Default)
+  TITLE+= (client)
+  DEPENDS+= usbip +glib2 +kmod-usbip-client
+endef
+
+define Package/usbip-server
+  $(call Package/usbip/Default)
+  TITLE+= (server)
+  DEPENDS+= usbip +glib2 +kmod-usbip-server
+endef
+
+CONFIGURE_PATH:=.
+MAKE_PATH:=.
+LIBTOOL_PATHS:=.
+MAKE_FLAGS+=CFLAGS="-Wno-implicit-function-declaration"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); ./autogen.sh );
+       $(call Build/Configure/Default)
+endef
+
+CFLAGS+="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include"
+
+define Download/usb.ids
+  URL:=http://www.linux-usb.org/
+  FILE:=usb.ids
+  MD5SUM:=
+endef
+
+define Package/usbip/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libusbip.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share/hwdata
+       $(CP) $(DL_DIR)/usb.ids $(1)/usr/share/hwdata/
+endef
+
+define Package/usbip-client/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbip $(1)/usr/sbin/
+endef
+
+define Package/usbip-server/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbipd $(1)/usr/sbin/
+endef
+
+$(eval $(call Download,usb.ids))
+$(eval $(call BuildPackage,usbip))
+$(eval $(call BuildPackage,usbip-client))
+$(eval $(call BuildPackage,usbip-server))
diff --git a/net/usbip/patches/001-upstream_svn_r99.diff b/net/usbip/patches/001-upstream_svn_r99.diff
new file mode 100644 (file)
index 0000000..aa193e1
--- /dev/null
@@ -0,0 +1,11 @@
+Index: trunk/src/cmd/Makefile.am
+===================================================================
+--- trunk/src/cmd/Makefile.am  (revision 98)
++++ trunk/src/cmd/Makefile.am  (revision 99)
+@@ -17,5 +17,5 @@
+ INCLUDES = -I$(top_srcdir)/lib
+ LDADD = ../lib/libusbip.la @PACKAGE_LIBS@
+ EXTRA_CFLAGS = @EXTRA_CFLAGS@
+-AM_CFLAGS = -Wall -W -Wstrict-prototypes -std=gnu99 $(EXTRA_CFLAGS) @PACKAGE_CFLAGS@
++AM_CFLAGS = -Wall -W -Wstrict-prototypes -std=gnu99 $(EXTRA_CFLAGS) @PACKAGE_CFLAGS@ -DUSBIDS_FILE='"@USBIDS_DIR@/usb.ids"'
diff --git a/net/usbip/patches/002-upstream_svn_r152.patch b/net/usbip/patches/002-upstream_svn_r152.patch
new file mode 100644 (file)
index 0000000..e7135a6
--- /dev/null
@@ -0,0 +1,229 @@
+--- a/drivers/head/stub_dev.c
++++ b/drivers/head/stub_dev.c
+@@ -398,7 +398,11 @@ static int stub_probe(struct usb_interfa
+ {
+       struct usb_device *udev = interface_to_usbdev(interface);
+       struct stub_device *sdev = NULL;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+       char *udev_busid = interface->dev.parent->bus_id;
++#else
++      char *udev_busid = dev_name(interface->dev.parent);
++#endif
+       int err = 0;
+       udbg("Enter\n");
+--- a/drivers/head/stub_main.c
++++ b/drivers/head/stub_main.c
+@@ -252,18 +252,17 @@ static int __init usb_stub_init(void)
+               return -ENOMEM;
+       }
++      info(DRIVER_DESC "" DRIVER_VERSION);
++
++      memset(busid_table, 0, sizeof(busid_table));
++      spin_lock_init(&busid_table_lock);
++
+       ret = usb_register(&stub_driver);
+       if (ret) {
+               uerr("usb_register failed %d\n", ret);
+               return ret;
+       }
+-
+-      info(DRIVER_DESC "" DRIVER_VERSION);
+-
+-      memset(busid_table, 0, sizeof(busid_table));
+-      spin_lock_init(&busid_table_lock);
+-
+       ret = driver_create_file(&stub_driver.drvwrap.driver, &driver_attr_match_busid);
+       if (ret) {
+--- a/drivers/head/stub_rx.c
++++ b/drivers/head/stub_rx.c
+@@ -159,7 +159,11 @@ static int tweak_set_configuration_cmd(s
+        * A user may need to set a special configuration value before
+        * exporting the device.
+        */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+       uinfo("set_configuration (%d) to %s\n", config, urb->dev->dev.bus_id);
++#else
++      uinfo("set_configuration (%d) to %s\n", config, dev_name(&urb->dev->dev));
++#endif
+       uinfo("but, skip!\n");
+       return 0;
+@@ -177,7 +181,11 @@ static int tweak_reset_device_cmd(struct
+       value = le16_to_cpu(req->wValue);
+       index = le16_to_cpu(req->wIndex);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+       uinfo("reset_device (port %d) to %s\n", index, urb->dev->dev.bus_id);
++#else
++      uinfo("reset_device (port %d) to %s\n", index, dev_name(&urb->dev->dev));
++#endif
+       /* all interfaces should be owned by usbip driver, so just reset it. */
+       ret = usb_lock_device_for_reset(urb->dev, NULL);
+@@ -187,7 +195,11 @@ static int tweak_reset_device_cmd(struct
+       }
+       /* try to reset the device */
+-      ret = usb_reset_composite_device(urb->dev, NULL);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
++    ret = usb_reset_composite_device(urb->dev, NULL);
++#else
++      ret = usb_reset_device(urb->dev);
++#endif
+       if (ret < 0)
+               uerr("device reset\n");
+--- a/drivers/head/usbip_common.c
++++ b/drivers/head/usbip_common.c
+@@ -55,10 +55,7 @@ static ssize_t show_flag(struct device *
+ static ssize_t store_flag(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t count)
+ {
+-      unsigned long flag;
+-
+-      sscanf(buf, "%lx", &flag);
+-      usbip_debug_flag = flag;
++      sscanf(buf, "%lx", &usbip_debug_flag);
+       return count;
+ }
+@@ -390,7 +387,7 @@ int usbip_thread(void *param)
+       unlock_kernel();
+       /* srv.rb must wait for rx_thread starting */
+-      complete(&ut->thread_done);
++      complete(&ut->thread_started);
+       /* start of while loop */
+       ut->loop_ops(ut);
+@@ -403,15 +400,21 @@ int usbip_thread(void *param)
+ void usbip_start_threads(struct usbip_device *ud)
+ {
++
+       /*
+        * threads are invoked per one device (per one connection).
+        */
++    INIT_COMPLETION(ud->tcp_rx.thread_started);
++    INIT_COMPLETION(ud->tcp_tx.thread_started);
++    INIT_COMPLETION(ud->tcp_rx.thread_done);
++    INIT_COMPLETION(ud->tcp_tx.thread_done);
++
+       kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_rx, 0);
+       kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_tx, 0);
+       /* confirm threads are starting */
+-      wait_for_completion(&ud->tcp_rx.thread_done);
+-      wait_for_completion(&ud->tcp_tx.thread_done);
++      wait_for_completion(&ud->tcp_rx.thread_started);
++      wait_for_completion(&ud->tcp_tx.thread_started);
+ }
+ EXPORT_SYMBOL(usbip_start_threads);
+@@ -436,6 +439,7 @@ void usbip_task_init(struct usbip_task *
+               void (*loop_ops)(struct usbip_task *))
+ {
+       ut->thread = NULL;
++      init_completion(&ut->thread_started);
+       init_completion(&ut->thread_done);
+       ut->name = name;
+       ut->loop_ops = loop_ops;
+--- a/drivers/head/usbip_event.c
++++ b/drivers/head/usbip_event.c
+@@ -38,7 +38,7 @@ void usbip_start_eh(struct usbip_device
+       kernel_thread((int(*)(void *)) usbip_thread, (void *) eh, 0);
+-      wait_for_completion(&eh->thread_done);
++      wait_for_completion(&eh->thread_started);
+ }
+ EXPORT_SYMBOL(usbip_start_eh);
+--- a/drivers/head/vhci_hcd.c
++++ b/drivers/head/vhci_hcd.c
+@@ -58,7 +58,7 @@ static void vhci_stop(struct usb_hcd *hc
+ static int vhci_get_frame_number(struct usb_hcd *hcd);
+ static const char driver_name[] = "vhci_hcd";
+-static const char driver_desc[] = "USB/IP Virtual Host Contoroller";
++static const char driver_desc[] = "USB/IP Virtual Host Controller";
+@@ -416,14 +416,6 @@ static int vhci_hub_control(struct usb_h
+                               case USB_PORT_FEAT_SUSPEND:
+                                       dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_SUSPEND\n");
+                                       uerr(" not yet\n");
+-#if 0
+-                                      dum->port_status[rhport] |= (1 << USB_PORT_FEAT_SUSPEND);
+-                                      if (dum->driver->suspend) {
+-                                              spin_unlock (&dum->lock);
+-                                              dum->driver->suspend (&dum->gadget);
+-                                              spin_lock (&dum->lock);
+-                                      }
+-#endif
+                                       break;
+                               case USB_PORT_FEAT_RESET:
+                                       dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_RESET\n");
+@@ -432,12 +424,6 @@ static int vhci_hub_control(struct usb_h
+                                               dum->port_status[rhport] &= ~(USB_PORT_STAT_ENABLE
+                                                               | USB_PORT_STAT_LOW_SPEED
+                                                               | USB_PORT_STAT_HIGH_SPEED);
+-#if 0
+-                                              if (dum->driver) {
+-                                                      dev_dbg (hardware, "disconnect\n");
+-                                                      stop_activity (dum, dum->driver);
+-                                              }
+-#endif
+                                               /* FIXME test that code path! */
+                                       }
+@@ -1060,7 +1046,7 @@ static int vhci_hcd_probe(struct platfor
+       struct usb_hcd          *hcd;
+       int                     ret;
+-      uinfo("proving...\n");
++      uinfo("probing...\n");
+       dbg_vhci_hc("name %s id %d\n", pdev->name, pdev->id);
+@@ -1076,7 +1062,11 @@ static int vhci_hcd_probe(struct platfor
+        * Allocate and initialize hcd.
+        * Our private data is also allocated automatically.
+        */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+       hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, pdev->dev.bus_id);
++#else
++      hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, dev_name(&pdev->dev));
++#endif
+       if (!hcd) {
+               uerr("create hcd failed\n");
+               return -ENOMEM;
+--- a/drivers/head/vhci_sysfs.c
++++ b/drivers/head/vhci_sysfs.c
+@@ -123,7 +123,11 @@ static ssize_t show_status(struct device
+                       out += sprintf(out, "%03u %08x ",
+                                       vdev->speed, vdev->devid);
+                       out += sprintf(out, "%16p ", vdev->ud.tcp_socket);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+                       out += sprintf(out, "%s", vdev->udev->dev.bus_id);
++#else
++                      out += sprintf(out, "%s", dev_name(&vdev->udev->dev));
++#endif
+               } else
+                       out += sprintf(out, "000 000 000 0000000000000000 0-0");
+--- a/drivers/head/usbip_common.h
++++ b/drivers/head/usbip_common.h
+@@ -300,6 +300,7 @@ struct usbip_device;
+ struct usbip_task {
+       struct task_struct *thread;
++      struct completion thread_started;
+       struct completion thread_done;
+       char *name;
+       void (*loop_ops)(struct usbip_task *);
diff --git a/net/uucp/Makefile b/net/uucp/Makefile
new file mode 100644 (file)
index 0000000..73a6cd7
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2008-2010 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:=uucp
+PKG_VERSION:=1.07
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/u/uucp/
+PKG_MD5SUM:=64c54d43787339a7cced48390eb3e1d0
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/uucp
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  TITLE:=copy files to or from another (usually *nix) system
+  URL:=http://packages.debian.org/etch/uucp
+endef
+
+define Package/uucp/description
+       UUCP is used to transfer mail, news and random files between systems which are not
+       connected by more modern networks. The communication can be made via modems, direct
+       (hard-wired) serial connections or via an IP connection.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared
+
+define Package/uucp/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/{cu,tstuu,uu{chk,cico,conv,cp,log,name,pick,sched,stat,to,x,xqt}} $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,uucp))
diff --git a/net/vblade/Makefile b/net/vblade/Makefile
new file mode 100644 (file)
index 0000000..6e9ec3e
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2010-2014 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:=vblade
+PKG_VERSION:=21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/aoetools/vblade
+PKG_MD5SUM:=0a2a257737a808d8f2fbfa5de3172337
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vblade
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Vblade AoE Target
+  URL:=http://aoetools.sourceforge.net/
+endef
+
+define Package/$(PKG_NAME)/conffiles
+/etc/config/vblade
+endef
+
+define Package/vblade/description
+       The vblade is the virtual EtherDrive (R) blade, a program that makes a
+       seekable file available over an ethernet local area network (LAN) via
+       the ATA over Ethernet (AoE) protocol.
+endef
+
+CONFIGURE_ARGS +=  NPERSHELF=16
+
+define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vblade $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vbladed $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/net/vblade/files/vblade.config b/net/vblade/files/vblade.config
new file mode 100644 (file)
index 0000000..455988a
--- /dev/null
@@ -0,0 +1,14 @@
+#config vblade
+#      option shelf            '1'
+#      option slot             '1'
+#      option netif            'eth0'
+#      option device           '/dev/sda'
+#      option options          '-r'
+#
+#config vblade
+#      option shelf            '1'
+#      option slot             '2'
+#      option netif            'eth0'
+#      option device           '/dev/sdb'
+#      option options          '-r'
+#
diff --git a/net/vblade/files/vblade.init b/net/vblade/files/vblade.init
new file mode 100644 (file)
index 0000000..afed46b
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Startup init script for vblade for Openwrt
+START=95
+STOP=10
+
+start_service() {
+       local section="$1"
+       config_get shelf "$section" shelf
+       config_get slot "$section" slot
+       config_get netif "$section" netif
+       config_get device "$section" device
+       config_get options "$section" options
+       vbladed $options $shelf $slot $netif $device
+}
+
+start() {
+       config_load vblade
+       config_foreach start_service vblade
+}
+
+stop() {
+       /usr/bin/pkill -f /usr/sbin/vblade
+}
+
diff --git a/net/veth/Makefile b/net/veth/Makefile
new file mode 100644 (file)
index 0000000..ee92fd6
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2008-2010 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:=veth
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://w3.epca.com.ve/projects/veth
+PKG_MD5SUM:=11536388d9c76552a4b736638a458361
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/veth
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-tun
+  TITLE:=Virtual Ethernet Device for Linux
+  URL:=http://w3.epca.com.ve/projects/veth/
+endef
+
+define Package/veth/description
+       VETH is a daemon that virtualizes a ethernet card in Linux.
+       The virtualization is done via Universal TUN/TAP Driver.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/veth \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)"
+endef
+
+define Package/veth/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/veth/vethd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,veth))
diff --git a/net/veth/patches/100-veth-makefile-cflags.patch b/net/veth/patches/100-veth-makefile-cflags.patch
new file mode 100644 (file)
index 0000000..c9a1d74
--- /dev/null
@@ -0,0 +1,14 @@
+Index: veth-1.0/veth/Makefile
+===================================================================
+--- veth-1.0.orig/veth/Makefile        2008-10-29 16:11:33.000000000 +0100
++++ veth-1.0/veth/Makefile     2008-10-31 18:01:33.000000000 +0100
+@@ -4,8 +4,7 @@
+       rm -f vethd
+ vethd: vethd.c
+-      $(CC) -O6 -Wall -pedantic -o vethd vethd.c
+-      strip vethd
++      $(CC) $(CFLAGS) -o vethd vethd.c
+ install: all
+       install -s -m 750 ./vethd $(INSTALL_DIR)
diff --git a/net/veth/patches/200-drop-multicast.patch b/net/veth/patches/200-drop-multicast.patch
new file mode 100644 (file)
index 0000000..438b0d3
--- /dev/null
@@ -0,0 +1,32 @@
+diff -pNur veth-1.0/veth/vethd.c veth-1.0/veth/vethd.c
+--- veth-1.0/veth/vethd.c      2008-11-14 10:59:50.000000000 +0100
++++ veth-1.0/veth/vethd.c      2008-11-24 11:24:45.000000000 +0100
+@@ -29,6 +29,7 @@
+ #include <linux/if_ether.h>
+ #include <linux/if_packet.h>
+ #include <linux/if_tun.h>
++#include <net/ethernet.h>
+ #define max(a,b) ((a)>(b) ? (a):(b))
+@@ -223,6 +224,7 @@ int main(int argc, char **argv)
+       int vfd, nfd, leidos, opc, foreground = 0;
+       fd_set fds;
++      struct ether_header const* const ether_hdr = (struct ether_header const *)buffer;
+       set_locale();
+       show_copyright();
+@@ -356,7 +358,11 @@ int main(int argc, char **argv)
+                               perror("Error reading from ethernet interface");
+                               return 2;
+                       }
+-                      write(vfd, buffer, leidos);
++                      /* drop multicast and ppp session */
++                      if (!(ether_hdr->ether_dhost[0] == 0x01)
++                         && (ether_hdr->ether_type != htons(ETH_P_PPP_SES))) {
++                              write(vfd, buffer, leidos);
++                      }
+               }
+               FD_ZERO(&fds);
+               FD_SET(nfd, &fds);
diff --git a/net/vgp/Makefile b/net/vgp/Makefile
new file mode 100644 (file)
index 0000000..105987d
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006 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:=vgp
+PKG_VERSION:=0.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://vgpd.freaknet.org/files/
+PKG_MD5SUM:=b8c25b5dfcb944f78bbc584be9c230c7
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vgp
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A daemon working like Cisco(c) HSRP
+  URL:=http://vgpd.freaknet.org/
+endef
+
+define Package/vgp/description
+       VGP (Virtual Gateway Protocol)is a very simple protocol able to
+       work in a way similar to Cisco(c) HSRP. It implements the idea
+       of Virtual Gateway to provide fault tollerance (and load
+       balancing) on your net. Each client on your net has as its
+       default gateway set to the virtual gateway and not the real router.
+endef
+
+# uses GNU configure
+
+define Package/vgp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgpd $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,vgp))
diff --git a/net/vnc-reflector/Makefile b/net/vnc-reflector/Makefile
new file mode 100644 (file)
index 0000000..00f3786
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006 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:=vnc-reflector
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=vnc_reflector-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/vnc-reflector
+PKG_MD5SUM:=c3f88bc62f228b335c25c07f9744ab0c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/vnc_reflector
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vnc-reflector
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libjpeg +zlib
+  TITLE:=VNC proxy for multiple clients
+  URL:=http://sourceforge.net/projects/vnc-reflector
+endef
+
+define Package/vnc-reflector/description
+       VNC Reflector is a specialized VNC server which acts as
+       a proxy sitting between real VNC server (a host) and a
+       number of VNC clients. It was designed to work efficiently
+       with large number of clients.
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CC="$(TARGET_CC)" \
+               OFLAGS="$(TARGET_CFLAGS)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               default \
+       )
+endef
+
+define Package/vnc-reflector/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vncreflector $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,vnc-reflector))
diff --git a/net/vnc-reflector/patches/001-honor_include_lib_path.patch b/net/vnc-reflector/patches/001-honor_include_lib_path.patch
new file mode 100644 (file)
index 0000000..fb409ac
--- /dev/null
@@ -0,0 +1,25 @@
+--- vnc_reflector/Makefile.orig        2005-12-14 01:25:53.000000000 +0100
++++ vnc_reflector/Makefile     2005-12-14 01:28:05.000000000 +0100
+@@ -14,10 +14,11 @@
+ #
+ # Variables you might want to edit: CFLAGS, CONFFLAGS
+-IFLAGS =      -I.
++IFLAGS =      -I. -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
++OFLAGS =      -O2
+ # Production
+-CFLAGS =      -O2 $(IFLAGS)
++CFLAGS =      $(OFLAGS) $(IFLAGS)
+ # Debug (strict)
+ #CFLAGS =     -g -pedantic -Wall $(IFLAGS)
+ # Debug (profiling)
+@@ -29,7 +30,7 @@
+ CONFFLAGS =   -DUSE_POLL
+ # Link with zlib and JPEG libraries
+-LDFLAGS =     -L/usr/local/lib -lz -ljpeg
++LDFLAGS =     -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -lz -ljpeg
+ PROG =        vncreflector
diff --git a/net/vncrepeater/Makefile b/net/vncrepeater/Makefile
new file mode 100644 (file)
index 0000000..0e606e5
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2006-2014 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:=vncrepeater
+PKG_VERSION:=0.12
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.rit.edu/~reh5586/openwrt/packages/vncrepeater/src
+PKG_MD5SUM:=5951740a8a103d7d9668558b3639c6c4
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vncrepeater
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=$(CXX_DEPENDS)
+  TITLE:=UltraVNC repeater for Linux
+  URL:=http://www.uvnc.com/addons/repeater.html
+endef
+
+define Package/vncrepeater/conffiles
+/etc/vncrepeater.conf
+endef
+
+define Package/vncrepeater/description
+ Viewer can be behind Nat router or directly connected to the internet
+ instead of forwarding serveral ports, you only need to forward 1 port.
+ If the PC that runs the Repeater has access to the local DNS server,
+ you can use your local DNS names instead of 10.10.10.12.
+ This could be handy when you have a dynamic DHCP server allocating
+ ip adresses for your PC.
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CC="$(TARGET_CXX)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -fno-rtti" \
+               repeater \
+       )
+endef
+
+define Package/vncrepeater/install
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/repeater $(1)/usr/sbin/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/uvncrepeater.ini $(1)/etc/vncrepeater.conf
+endef
+
+$(eval $(call BuildPackage,vncrepeater))
diff --git a/net/vncrepeater/patches/001-uclibcxx_linking.patch b/net/vncrepeater/patches/001-uclibcxx_linking.patch
new file mode 100644 (file)
index 0000000..a9d05bc
--- /dev/null
@@ -0,0 +1,32 @@
+diff -urN vncrepeater-0.12/Makefile vncrepeater-0.12.new/Makefile
+--- vncrepeater-0.12/Makefile  2006-03-31 07:40:14.000000000 +0200
++++ vncrepeater-0.12.new/Makefile      2006-04-11 10:26:06.345879104 +0200
+@@ -1,21 +1,21 @@
+-CFLAGS=-Wall
++CFLAGS=-Wall 
+ repeater: repeater.o repeaterproc.o openbsd_stringfuncs.o iniparser.o readini.o
+-      g++ $(CFLAGS) -o repeater repeater.o repeaterproc.o openbsd_stringfuncs.o iniparser.o readini.o
++      $(CC) $(CFLAGS) -o repeater repeater.o repeaterproc.o openbsd_stringfuncs.o iniparser.o readini.o $(LDFLAGS)
+ repeater.o: repeater.cpp
+-      g++ $(CFLAGS) -c repeater.cpp
++      $(CC) $(CFLAGS) -c repeater.cpp
+ repeaterproc.o: repeaterproc.cpp
+-      g++ $(CFLAGS) -c repeaterproc.cpp
++      $(CC) $(CFLAGS) -c repeaterproc.cpp
+ openbsd_stringfuncs.o: openbsd_stringfuncs.cpp
+-      g++ $(CFLAGS) -c openbsd_stringfuncs.cpp
++      $(CC) $(CFLAGS) -c openbsd_stringfuncs.cpp
+ iniparser.o: iniparser.cpp
+-      g++ $(CFLAGS) -c iniparser.cpp
++      $(CC) $(CFLAGS) -c iniparser.cpp
+ readini.o: readini.cpp
+-      g++ $(CFLAGS) -c readini.cpp
++      $(CC) $(CFLAGS) -c readini.cpp
+ clean:
+       rm -f *.o repeater
diff --git a/net/vpnc-scripts/Makefile b/net/vpnc-scripts/Makefile
new file mode 100644 (file)
index 0000000..7481dea
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006 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:=vpnc-scripts
+PKG_VERSION:=20120423
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/vpnc-scripts/
+PKG_MD5SUM:=3265dc7fe57ae9b4c905961a28699c4c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vpnc-scripts
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip
+  TITLE:=VPN configuration script for vpnc and OpenConnect
+  URL:=http://www.infradead.org/openconnect/vpnc-script.html
+  SUBMENU:=VPN
+endef
+
+define Package/vpnc/vpnc-scripts
+       This package contains the vpnc-script which is used by vpnc
+       and OpenConnect to configure the tunnel interface.
+endef
+
+define Package/vpnc-scripts/conffiles
+/etc/vpnc/connect.d/
+/etc/vpnc/post-connect.d/
+/etc/vpnc/disconnect.d/
+/etc/vpnc/post-connect.d/
+/etc/vpnc/reconnect.d/
+endef
+
+define Build/Compile
+endef
+
+define Package/vpnc-scripts/install
+       $(INSTALL_DIR) $(1)/etc/vpnc
+       $(INSTALL_DIR) $(1)/etc/vpnc/connect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/post-connect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/disconnect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/post-disconnect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/reconnect.d
+       $(INSTALL_BIN) ./files/etc/vpnc/connect.d/ifstate $(1)/etc/vpnc/connect.d/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vpnc-script $(1)/etc/vpnc/
+endef
+
+$(eval $(call BuildPackage,vpnc-scripts))
diff --git a/net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate b/net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate
new file mode 100644 (file)
index 0000000..8d2a157
--- /dev/null
@@ -0,0 +1,7 @@
+if [ -r /etc/openwrt_release ] && [ -n "$OPENWRT_INTERFACE" ]; then
+    uci_set_state network "$OPENWRT_INTERFACE" banner "$CISCO_BANNER"
+    uci_set_state network "$OPENWRT_INTERFACE" ifname "$TUNDEV"
+    [ -n "$INTERNAL_IP4_ADDRESS" ] && uci_set_state network "$OPENWRT_INTERFACE" ipaddr "$INTERNAL_IP4_ADDRESS"
+    [ -n "$INTERNAL_IP6_NETMASK" ] && uci_set_state network "$OPENWRT_INTERFACE" ip6addr "$INTERNAL_IP6_NETMASK"
+    env -i ACTION="ifup" INTERFACE="$OPENWRT_INTERFACE" DEVICE="$TUNDEV" PROTO=openconnect /sbin/hotplug-call "iface"
+fi
diff --git a/net/vpnc/Makefile b/net/vpnc/Makefile
new file mode 100644 (file)
index 0000000..58af207
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2006-2012 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:=vpnc
+PKG_VERSION:=0.5.3
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.unix-ag.uni-kl.de/~massar/vpnc/
+PKG_MD5SUM:=4378f9551d5b077e1770bbe09995afb3
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vpnc
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libgpg-error +libgcrypt +kmod-tun +vpnc-scripts
+  TITLE:=VPN client for Cisco EasyVPN
+  URL:=http://www.unix-ag.uni-kl.de/~massar/vpnc/
+  SUBMENU:=VPN
+endef
+
+define Package/vpnc/description
+       A VPN client compatible with Cisco's EasyVPN equipment.
+
+       Supports IPSec (ESP) with Mode Configuration and Xauth.  Supports only
+       shared-secret IPSec authentication with Xauth, AES (256, 192, 128),
+       3DES, 1DES, MD5, SHA1, DH1/2/5 and IP tunneling.
+endef
+
+define Package/vpnc/conffiles
+/etc/vpnc/default.conf
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               OFLAGS="$(TARGET_CFLAGS)" \
+               OS="Linux" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               PREFIX=/usr \
+               all install \
+       )
+endef
+
+define Package/vpnc/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP)   $(PKG_INSTALL_DIR)/usr/sbin/vpnc \
+               $(PKG_INSTALL_DIR)/usr/sbin/vpnc-disconnect \
+               $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/vpnc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/vpnc/default.conf $(1)/etc/vpnc/
+endef
+
+$(eval $(call BuildPackage,vpnc))
diff --git a/net/vpnc/patches/001-cross.patch b/net/vpnc/patches/001-cross.patch
new file mode 100644 (file)
index 0000000..fda17b1
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,7 @@
+ # $Id: Makefile 312 2008-06-15 18:09:42Z Joerg Mayer $
+ DESTDIR=
+-PREFIX=/usr/local
++PREFIX=/usr
+ ETCDIR=/etc/vpnc
+ BINDIR=$(PREFIX)/bin
+ SBINDIR=$(PREFIX)/sbin
+@@ -51,14 +51,11 @@ RELEASE_VERSION := $(shell cat VERSION)
+ #OPENSSLLIBS = -lcrypto
+ CC=gcc
+-CFLAGS ?= -O3 -g
+-CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings
+-CFLAGS +=  $(shell libgcrypt-config --cflags)
++CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include $(OFLAGS) '-DVERSION="$(shell cat VERSION)"'
+ CPPFLAGS += -DVERSION=\"$(VERSION)\" $(OPENSSL_GPL_VIOLATION)
+-LDFLAGS ?= -g
+-LDFLAGS += $(shell libgcrypt-config --libs) $(OPENSSLLIBS)
++LDFLAGS = -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -lgcrypt -lgpg-error
+-ifeq ($(shell uname -s), SunOS)
++ifeq ($(OS), SunOS)
+ LDFLAGS += -lnsl -lresolv -lsocket
+ endif
+ ifneq (,$(findstring Apple,$(shell $(CC) --version)))
diff --git a/net/vpnc/patches/002-vpn_script.patch b/net/vpnc/patches/002-vpn_script.patch
new file mode 100644 (file)
index 0000000..5a0ebce
--- /dev/null
@@ -0,0 +1,41 @@
+--- a/vpnc-script.in
++++ b/vpnc-script.in
+@@ -97,7 +97,7 @@ do_ifconfig() {
+       fi
+       # Point to point interface require a netmask of 255.255.255.255 on some systems
+-      ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu ${MTU} up
++      ifconfig "$TUNDEV" "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu ${MTU} up
+       if [ -n "$INTERNAL_IP4_NETMASK" ]; then
+               set_network_route $INTERNAL_IP4_NETADDR $INTERNAL_IP4_NETMASK $INTERNAL_IP4_NETMASKLEN
+@@ -503,6 +503,18 @@ do_disconnect() {
+       destroy_tun_device
+ }
++start_vpn_nat() {
++      iptables -A forwarding_rule -o $TUNDEV -j ACCEPT
++      iptables -A forwarding_rule -i $TUNDEV -j ACCEPT
++      iptables -t nat -A postrouting_rule -o $TUNDEV -j MASQUERADE
++}
++
++stop_vpn_nat() {
++      iptables -t nat -D postrouting_rule -o $TUNDEV -j MASQUERADE
++      iptables -D forwarding_rule -i $TUNDEV -j ACCEPT
++      iptables -D forwarding_rule -o $TUNDEV -j ACCEPT
++}
++
+ #### Main
+ if [ -z "$reason" ]; then
+@@ -516,8 +528,10 @@ case "$reason" in
+               ;;
+       connect)
+               do_connect
++              start_vpn_nat
+               ;;
+       disconnect)
++              stop_vpn_nat
+               do_disconnect
+               ;;
+       *)
diff --git a/net/vpnc/patches/003-no_makeman.patch b/net/vpnc/patches/003-no_makeman.patch
new file mode 100644 (file)
index 0000000..ef01643
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -69,7 +69,7 @@ vpnc : $(OBJS) vpnc.o
+       $(CC) -o $@ $^ $(LDFLAGS)
+ vpnc.8 : vpnc.8.template makeman.pl vpnc
+-      ./makeman.pl
++      touch vpnc.8
+ vpnc-script : vpnc-script.in
+       sed -e 's,@''PREFIX''@,$(PREFIX),g' $< > $@ && chmod 755 $@
diff --git a/net/vpzone/Makefile b/net/vpzone/Makefile
new file mode 100644 (file)
index 0000000..f8185bf
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2010-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:=vpzone
+PKG_VERSION:=0.1.2
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/vpzone
+PKG_MD5SUM:=9b8a142a217f69ece0163b2026dc8585
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vpzone
+  CATEGORY:=Network
+  SECTION:=net
+  SUBMENU:=VPN
+  TITLE:=A flexible multipurpose layer 3 VPN daemon
+  URL:=http://vpzone.sourceforge.net/
+  DEPENDS:=+libcares +libevent2 +libgnutls +kmod-ipv6 +kmod-tun
+endef
+
+define Package/vpzone/conffiles
+/etc/vpzone/vpzone.conf
+endef
+
+define Package/vpzone/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/vpzone $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/vpzone
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/vpzone/*.so $(1)/usr/lib/vpzone/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/vpzone.init $(1)/etc/init.d/vpzone
+       $(INSTALL_DIR) $(1)/etc/vpzone
+       $(INSTALL_CONF) ./files/vpzone.conf $(1)/etc/vpzone/
+endef
+
+$(eval $(call BuildPackage,vpzone))
diff --git a/net/vpzone/files/vpzone.conf b/net/vpzone/files/vpzone.conf
new file mode 100644 (file)
index 0000000..9a7940b
--- /dev/null
@@ -0,0 +1,28 @@
+# vpzone.conf - vpzone configuration file
+
+log-file /var/log/vpzone.log
+log-level 3
+
+load tcp # mandatory
+#load udp
+#load gnutls
+#load babeld
+#load simple_vp
+#load manage
+
+device vpz0
+
+dev-ip fe80::8c7:3280:8ae3:6882/64 # mandatory link-local ip address
+dev-ip 2001:218:420::45/64 # mandatory VPN ip address
+
+group nogroup
+user nobody
+
+#server tcp:ssl:0.0.0.0
+
+#manage secret
+
+#cafile /etc/vpzone/ca.crt
+#crlfile /etc/vpzone/crl.pem
+#dhfile /etc/vpzone/dh.pem
+#certnkey-files /etc/vpzone/cert.crt /etc/vpzone/keyfile
diff --git a/net/vpzone/files/vpzone.init b/net/vpzone/files/vpzone.init
new file mode 100644 (file)
index 0000000..e78a0b7
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start() {
+       service_start /usr/bin/vpzone
+}
+
+stop() {
+       service_stop /usr/bin/vpzone
+}
diff --git a/net/vpzone/patches/001-no_werror.patch b/net/vpzone/patches/001-no_werror.patch
new file mode 100644 (file)
index 0000000..514bc79
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure
++++ b/configure
+@@ -14776,7 +14776,7 @@ fi
+-VPZONE_CFLAGS="-std=gnu99 -Wall -Werror -Wextra -fdiagnostics-show-option ${DEV_CFLAGS}"
++VPZONE_CFLAGS="-std=gnu99 -Wall -Wextra -fdiagnostics-show-option ${DEV_CFLAGS}"
+ VPZONE_LDFLAGS="-ldl -levent -lcares"
+--- a/configure.ac
++++ b/configure.ac
+@@ -65,7 +65,7 @@ dnl # #######################
+ dnl Compiler and Linker flags
+ dnl # #######################
+-VPZONE_CFLAGS="-std=gnu99 -Wall -Werror -Wextra -fdiagnostics-show-option ${DEV_CFLAGS}"
++VPZONE_CFLAGS="-std=gnu99 -Wall -Wextra -fdiagnostics-show-option ${DEV_CFLAGS}"
+ AC_SUBST(VPZONE_CFLAGS)
+ VPZONE_LDFLAGS="-ldl -levent -lcares"
+ AC_SUBST(VPZONE_LDFLAGS)
diff --git a/net/vpzone/patches/002-ipv6_inc_fix.patch b/net/vpzone/patches/002-ipv6_inc_fix.patch
new file mode 100644 (file)
index 0000000..d062bcf
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/include/iface.h
++++ b/src/include/iface.h
+@@ -36,7 +36,7 @@
+ /*A temporary and *dirty* fix against bad headers 
+ on some system (<linux/ipv6.h> conflicting with <netinet/in.h>)...*/
+ #include <linux/types.h>
+-#include <linux/in6.h>
++/*#include <linux/in6.h>*/
+ struct in6_ifreq 
+ {
+       struct in6_addr ifr6_addr;
diff --git a/net/vrrpd/Makefile b/net/vrrpd/Makefile
new file mode 100644 (file)
index 0000000..472578a
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006-2012 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:=vrrpd
+PKG_VERSION:=1.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/vrrpd
+PKG_MD5SUM:=6d5066ea1a6ced817376ca0f54765447
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vrrpd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  TITLE:=Virtual Router Redundancy Protocol daemon
+  URL:=http://www.sourceforge.net/projects/vrrpd
+endef
+
+define Package/vrrpd/description
+       VRRPd is an implementation of Virtual Router Redundancy
+       Protocol as specified in rfc2338. VRRPd is interoperable with
+       other RFC-based VRRP implementations, including Cisco and
+       Juniper, and is included as a standard feature on ImageStream
+       routers.
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               DBG_OPT="" \
+               MAIN_OPT="$(TARGET_CFLAGS)" \
+               vrrpd \
+       )
+endef
+
+define Package/vrrpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vrrpd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/vrrpd.config $(1)/etc/config/vrrpd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/vrrpd.init $(1)/etc/init.d/vrrpd
+endef
+
+define Package/vrrpd/conffiles
+/etc/config/vrrpd
+endef
+
+$(eval $(call BuildPackage,vrrpd))
diff --git a/net/vrrpd/files/vrrpd.config b/net/vrrpd/files/vrrpd.config
new file mode 100644 (file)
index 0000000..624bdc4
--- /dev/null
@@ -0,0 +1,29 @@
+package 'vrrpd'
+
+config 'vrrpd' 'vid1'
+       option enabled 0
+
+       # set the interface to run on
+       # (default: lan)
+#      option interface 'lan'
+
+       # set the ID of the virtual server (1-255)
+       # (default: 1)
+#      option virtual_id '1'
+
+       # set the IP address(es) of the virtual server
+       list virtual_ip '192.168.1.253'
+#      list virtual_ip '192.168.1.252'
+#      list virtual_ip '192.168.1.251'
+
+       # set the priority of this host in the virtual server
+       # (default: 100)
+#      option priority '100'
+
+       # set the advertisement interval (in seconds)
+       # (default: 1)
+#      option delay '1'
+
+       # don't handle the virtual MAC address
+       # (default: false)
+#      option no_virtual_mac '0'
diff --git a/net/vrrpd/files/vrrpd.init b/net/vrrpd/files/vrrpd.init
new file mode 100644 (file)
index 0000000..71e5967
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2012 OpenWrt.org
+
+START=50
+
+append_list_item() {
+       local val="$1"
+       local var="$2"
+       append "$var" "$val"
+}
+
+append_bool() {
+       local var="$1"
+       local section="$2"
+       local option="$3"
+       local value="$4"
+       local _val
+       config_get_bool _val "$section" "$option" 0
+       [ $_val -gt 0 ] && append "$var" "$value"
+}
+
+append_string() {
+       local var="$1"
+       local section="$2"
+       local option="$3"
+       local val="$4"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append "$var" "$val $_val"
+}
+
+section_enabled() {
+       local enabled
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ]
+}
+
+start_instance() {
+       local section="$1"
+       local id
+       local if
+       local dev
+       local args
+
+       section_enabled "$section" || return 1
+
+       config_get id "$section" 'virtual_id' '1'
+       config_get if "$section" 'interface' 'lan'
+       network_get_device dev "$if" && {
+               args="-v $id -i $dev"
+               append_string args "$section" 'delay' '-d'
+               append_string args "$section" 'priority' '-p'
+               append_bool args "$section" 'no_virtual_mac' '-n'
+               config_list_foreach "$section" 'virtual_ip' append_list_item args
+
+               SERVICE_PID_FILE="/var/run/vrrpd_${dev}_${id}.pid"
+               service_start /usr/sbin/vrrpd $args
+       }
+}
+
+stop_instance() {
+       local section="$1"
+       local id
+       local if
+       local dev
+
+       section_enabled "$section" || return 1
+
+       config_get id "$section" 'virtual_id' '1'
+       config_get if "$section" 'interface' 'lan'
+       network_get_device dev "$if"
+
+       SERVICE_PID_FILE="/var/run/vrrpd_${dev}_${id}.pid"
+       service_stop /usr/sbin/vrrpd
+}
+
+start() {
+       . /lib/functions/network.sh
+       config_load 'vrrpd'
+       config_foreach start_instance 'vrrpd'
+}
+
+stop() {
+       . /lib/functions/network.sh
+       config_load 'vrrpd'
+       config_foreach stop_instance 'vrrpd'
+}
diff --git a/net/vtun/Makefile b/net/vtun/Makefile
new file mode 100644 (file)
index 0000000..e8d4422
--- /dev/null
@@ -0,0 +1,78 @@
+#
+# Copyright (C) 2006-2009 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:=vtun
+PKG_VERSION:=3.0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/vtun
+PKG_MD5SUM:=d3d8bc4d58886498a1c338670eab9315
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vtun
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-tun +VTUN_LZO:liblzo +VTUN_LZO:zlib +VTUN_SSL:libopenssl
+  TITLE:=VPN tunneling daemon
+  URL:=http://vtun.sourceforge.net
+  SUBMENU:=VPN
+  MENU:=1
+endef
+
+define Package/vtun/config
+menu "Configuration"
+        depends on PACKAGE_vtun
+
+config VTUN_config
+       bool
+
+       depends on PACKAGE_vtun
+       config VTUN_LZO
+               bool "enable vtun compression"
+               help
+                       vtun tunnels will be compressed
+               default y
+
+       config VTUN_SSL
+               bool "enable vtun ssl encryption"
+               help
+                       vtun tunnels will be encrypted
+               default y
+endmenu
+endef
+
+define Package/vtun/conffiles
+/etc/vtund.conf
+endef
+
+CONFIGURE_ARGS += \
+       $(if $(CONFIG_VTUN_LZO),--with-lzo-lib="$(STAGING_DIR)/usr/lib/",--disable-zlib) \
+       $(if $(CONFIG_VTUN_LZO),--with-lzo-headers="$(STAGING_DIR)/usr/include/lzo",--disable-lzo) \
+       $(if $(CONFIG_VTUN_SSL),--with-ssl-headers="$(STAGING_DIR)/usr/lib/",--disable-ssl) \
+
+CONFIGURE_VARS += \
+       LIBS="$(TARGET_LDFLAGS)" \
+       $(if $(CONFIG_VTUN_LZO),LZO_HDR_DIR="$(STAGING_DIR)/usr/include/lzo") \
+       $(if $(CONFIG_VTUN_SSL),BLOWFISH_HDR_DIR="$(STAGING_DIR)/usr/include/openssl") \
+       $(if $(CONFIG_VTUN_SSL),SSL_HDR_DIR="$(STAGING_DIR)/usr/include/openssl") \
+
+define Build/Compile
+       $(call Build/Compile/Default,vtund)
+endef
+
+define Package/vtun/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/vtund.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vtund $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,vtun))
diff --git a/net/vtun/patches/100-lzo2.patch b/net/vtun/patches/100-lzo2.patch
new file mode 100644 (file)
index 0000000..fa9ba8b
--- /dev/null
@@ -0,0 +1,37 @@
+--- a/configure
++++ b/configure
+@@ -5459,7 +5459,7 @@ echo $ECHO_N "checking \"for lzo_asm.h\"
+       fi
+         echo "$as_me:$LINENO: result: ($dir) yes " >&5
+ echo "${ECHO_T}($dir) yes " >&6
+-      LZOCHK="lzo2 lzo"
++      LZOCHK="lzo2"
+     else
+         echo "$as_me:$LINENO: result: \"no\"" >&5
+ echo "${ECHO_T}\"no\"" >&6
+@@ -5504,8 +5504,7 @@ echo "${ECHO_T}($dir) yes " >&6
+         echo "$as_me:$LINENO: result: \"no\"" >&5
+ echo "${ECHO_T}\"no\"" >&6
+       { { echo "$as_me:$LINENO: error: LZO library not found. " >&5
+-echo "$as_me: error: LZO library not found. " >&2;}
+-   { (exit 1); exit 1; }; }
++echo "$as_me: error: LZO library not found. " >&2;} }
+     fi
+@@ -5598,13 +5597,11 @@ fi
+       done
+       if test $havelzo = 0; then
+           { { echo "$as_me:$LINENO: error: LZO library not found. " >&5
+-echo "$as_me: error: LZO library not found. " >&2;}
+-   { (exit 1); exit 1; }; }
++echo "$as_me: error: LZO library not found. " >&2;} }
+       fi
+    else
+         { { echo "$as_me:$LINENO: error: LZO headers not found. " >&5
+-echo "$as_me: error: LZO headers not found. " >&2;}
+-   { (exit 1); exit 1; }; }
++echo "$as_me: error: LZO headers not found. " >&2;} }
+    fi
+ fi
diff --git a/net/wccpd/Makefile b/net/wccpd/Makefile
new file mode 100644 (file)
index 0000000..b1e73da
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006 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:=wccpd
+PKG_VERSION:=0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/wccpd
+PKG_MD5SUM:=5f15c274de61dfb88e0dbfc1ccbe6b67
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wccpd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=a Web Cache Coordination daemon
+  URL:=http://wccpd.sourceforge.net/
+endef
+
+define Package/wccpd/description
+       wccpd is a WCCP (Web Cache Coordination Protocol) server daemon
+       It allows a router (running Linux) to redirect web traffic to a
+       group of Squid servers using WCCP as the monitoring/controling
+       protocol.
+endef
+
+define Package/wccpd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/wccpd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,wccpd))
diff --git a/net/wdiag/Makefile b/net/wdiag/Makefile
new file mode 100644 (file)
index 0000000..6c7be04
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006 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:=wdiag
+PKG_VERSION:=0.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/wdiag
+PKG_MD5SUM:=83a4e5610ec8fa0166c57b9a25f0b069
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wdiag
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Westell DSL Modem Diagnostics for Linux
+  URL:=http://sourceforge.net/projects/wdiag/
+endef
+
+define Package/wdiag/description
+A collection of utilities to get DSL stats from Westell DSL modems.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/wdiag/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/src/w{start,stop,estell} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,wdiag))
diff --git a/net/weechat/Makefile b/net/weechat/Makefile
new file mode 100644 (file)
index 0000000..79bc5b6
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2006-2012 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:=weechat
+PKG_VERSION:=0.4.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.weechat.org/files/src
+PKG_MD5SUM:=07500f0d1054691d88f21dd12b7c5871
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/weechat
+  SUBMENU:=Instant Messaging
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Lightweight IRC client
+  URL:=http://www.weechat.org/
+  DEPENDS:=+libcurl +libgnutls +libgcrypt +zlib +libncursesw $(ICONV_DEPENDS)
+endef
+
+define Package/weechat/description
+ Weechat is fast, light & extensible IRC client.
+endef
+
+CMAKE_OPTIONS+= \
+       -DENABLE_PYTHON=OFF \
+       -DENABLE_PERL=OFF \
+       -DENABLE_LUA=OFF \
+       -DENABLE_GUILE=OFF \
+       -DENABLE_RUBY=OFF \
+       -DENABLE_TCL=OFF
+
+TARGET_LDFLAGS += \
+       -L$(ICONV_PREFIX)/lib -ldl \
+       -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/weechat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/weechat-curses $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/weechat/plugins
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/weechat/plugins/* \
+               $(1)/usr/lib/weechat/plugins/
+endef
+
+$(eval $(call BuildPackage,weechat))
diff --git a/net/wifidog/Makefile b/net/wifidog/Makefile
new file mode 100644 (file)
index 0000000..a2d9d02
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2006,2013 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:=wifidog
+PKG_VERSION:=20130917
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=440445db60b0c3aff528ea703a828b0567293387
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wifidog
+  SUBMENU:=Captive Portals
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+iptables-mod-extra +iptables-mod-ipopt +iptables-mod-nat-extra +libpthread
+  TITLE:=A wireless captive portal solution
+  URL:=http://www.wifidog.org
+endef
+
+define Package/wifidog/description
+       The Wifidog project is a complete and embeddable captive
+       portal solution for wireless community groups or individuals
+       who wish to open a free Hotspot while still preventing abuse
+       of their Internet connection.
+endef
+
+define Package/wifidog/conffiles
+/etc/wifidog.conf
+endef
+
+define Package/wifidog/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/init.d/wifidog $(1)/usr/bin/wifidog-init
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wifidog $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wdctl $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttpd.so* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog.conf $(1)/etc/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog-msg.html $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/wifidog.init $(1)/etc/init.d/wifidog
+endef
+
+$(eval $(call BuildPackage,wifidog))
diff --git a/net/wifidog/files/wifidog.init b/net/wifidog/files/wifidog.init
new file mode 100644 (file)
index 0000000..9db075d
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=65
+EXTRA_COMMANDS="status"
+EXTRA_HELP="        status Print the status of the service"
+
+start() {
+       /usr/bin/wifidog-init start
+}
+
+stop() {
+       /usr/bin/wifidog-init stop
+}
+
+status() {
+       /usr/bin/wifidog-init status
+}
\ No newline at end of file
diff --git a/net/wing/Makefile b/net/wing/Makefile
new file mode 100644 (file)
index 0000000..03348e3
--- /dev/null
@@ -0,0 +1,94 @@
+#
+# Copyright (C) 2006-2012 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:=wing
+PKG_VERSION:=20121218
+PKG_RELEASE:=1
+PKG_REV:=a4f901c3442c5bc49d1250007db7f45436069716
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=git://github.com/rriggio/click.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=git
+
+PKG_BUILD_DEPENDS:=wing/host
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+define Package/wing
+       SECTION:=net
+       CATEGORY:=Network
+       SUBMENU:=Routing and Redirection
+       TITLE:=Wireless mesh networking toolkit
+       MAINTAINER:=Roberto Riggio <roberto.riggio@create-net.org>
+       DEPENDS:=+kmod-tun +libpcap +libstdcpp
+       URL:=http://www.wing-project.org/
+endef
+
+define Package/wing/Description
+       Wing is a wireless mesh routing software. The routing protocol
+       is derived from Roofnet. It supports multiple radio interfaces
+       and link quality routing using the ETX, ETT, or WCETT metric.
+endef
+
+EXTRA_CFLAGS=-MD
+
+CONFIGURE_ARGS += \
+       --enable-tools=host \
+       --enable-userlevel \
+       --enable-wifi \
+       --enable-wing \
+       --enable-diffserv \
+       --disable-linuxmodule \
+       --disable-dynamic-linking \
+
+HOST_CONFIGURE_ARGS += \
+       --enable-userlevel \
+       --enable-wifi \
+       --enable-wing \
+       --enable-diffserv \
+       --disable-linuxmodule \
+
+define Host/Compile
+       $(call Host/Install/Default, tools elementmap.xml install)
+endef
+
+define Build/Compile
+       (cd $(PKG_BUILD_DIR)/userlevel; \
+               $(STAGING_DIR_HOST)/bin/click-mkmindriver -p $(PKG_NAME) -C $(STAGING_DIR_HOST) \
+               -f $(PKG_BUILD_DIR)/conf/wing/sample.click \
+               -A --all -E Discard -E Print -E PrintWifi -E Strip -E Null \
+               -E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \
+               -E SetTXRateHT \
+               -E WINGETTMetric -E WINGETXMetric -E WINGHopCountMetric \
+               -E ProbeTXRate -E MadwifiRate -E AutoRateFallback -E Minstrel \
+               -E FairBuffer -E DeAggregator -E DWRRSched -E WFQSched -E WRRSched; \
+       );
+       $(call Build/Install/Default, MINDRIVER=$(PKG_NAME) install)
+endef
+
+define Package/wing/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/wing
+       $(INSTALL_DIR) $(1)/usr/share/click
+       $(CP) ./files/* $(1)/
+       $(CP) $(PKG_BUILD_DIR)/conf/wing/click_config $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/conf/wing/write_handler $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/conf/wing/read_handler $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME)click $(1)/usr/bin/click
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/click-align $(1)/usr/bin/click-align
+       $(CP) $(PKG_BUILD_DIR)/conf/wing/*click $(1)/etc/wing/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/click/elementmap.xml $(1)/usr/share/click/elementmap.xml
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,wing))
+
diff --git a/net/wing/files/etc/uci-defaults/wing b/net/wing/files/etc/uci-defaults/wing
new file mode 100644 (file)
index 0000000..2a8c35e
--- /dev/null
@@ -0,0 +1,24 @@
+uci delete network.mesh
+uci set network.mesh=interface
+uci set network.mesh.proto=wing
+
+uci delete firewall.zone_mesh
+uci set firewall.zone_mesh=zone
+uci set firewall.zone_mesh.name="mesh"
+uci set firewall.zone_mesh.input="ACCEPT"
+uci set firewall.zone_mesh.output="ACCEPT"
+uci set firewall.zone_mesh.forward="REJECT"
+uci set firewall.zone_mesh.masq="1"
+
+uci delete firewall.fwd_lan_mesh
+uci set firewall.fwd_lan_mesh=forwarding
+uci set firewall.fwd_lan_mesh.src="lan"
+uci set firewall.fwd_lan_mesh.dest="mesh"
+
+uci delete firewall.fwd_mesh_wan
+uci set firewall.fwd_mesh_wan=forwarding
+uci set firewall.fwd_mesh_wan.src="mesh"
+uci set firewall.fwd_mesh_wan.dest="wan"
+
+uci commit
+
diff --git a/net/wing/files/lib/netifd/proto/wing.sh b/net/wing/files/lib/netifd/proto/wing.sh
new file mode 100644 (file)
index 0000000..69f7421
--- /dev/null
@@ -0,0 +1,272 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_wing_init_config() {
+       no_device=1
+       available=1
+        proto_config_add_string "ipaddr"
+       proto_config_add_string "netmask"
+}
+
+proto_wing_teardown() {
+       local config="$1"
+       local link="wing-$config"
+       [ -f "/var/run/$link.pid" ] && {
+               kill -9 $(cat /var/run/$link.pid)
+               rm /var/run/$link.pid
+       }
+       env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$link" PROTO=wing /sbin/hotplug-call "link" &
+}
+
+proto_wing_setup() {
+
+       local iface="$2"
+       local config="$1"
+       local link="wing-$config"
+
+       local hwmodes=""
+       local freqs=""
+       local ifnames=""
+       local hwaddrs=""
+
+       # temporary hack waiting for a way to delay wing interfaces until the
+       # wifi sub-system has been brought up
+       sleep 30
+
+       config_load wireless
+       config_foreach wing_list_interfaces wifi-iface
+
+       # start click router
+       if [ "$hwmodes" = "" -o "$freqs" = "" -o "$ifnames" = "" -o "$hwaddrs" = "" ]; then
+               logger -t "$config" "No raw interfaces available. Exiting."
+               exit 1
+       fi
+
+       local profile rc ls metric prefix period tau debug
+
+       config_load network
+       config_get profile $config profile "bulk"
+       config_get rc $config rc "minstrel"
+       config_get ls $config ls "fcfs"
+       config_get metric $config metric "wcett"
+       config_get prefix $config prefix "6"
+       config_get period $config period "10000"
+       config_get tau $config tau "100000"
+       config_get_bool debug $config debug "false"
+
+       local hwaddr=$(echo $hwaddrs | sed 's/ .*//');
+       local ipaddr=$(printf "$prefix.%d.%d.%d" $(echo $hwaddr | awk -F: '{printf "0x%s 0x%s 0x%s",$4,$5,$6}'))
+       local bcast="$prefix.255.255.255"
+       local netmask=255.0.0.0
+
+       if ! wing_template_available "profile" "$profile"; then
+               logger -t "$config" "Unable to configure router. Exiting."
+               exit 1
+       fi
+
+       if ! wing_template_available "rc" "$rc"; then
+               logger -t "$config" "Unable to configure rate control. Exiting."
+               exit 1
+       fi
+
+       if ! wing_template_available "ls" "$ls"; then
+               logger -t "$config" "Unable to configure link scheduler. Exiting."
+               exit 1
+       fi
+
+       if [ "$profile" = "" -o "$rc" = "" ]; then
+               logger -t "$config" "Unable to generate template. Exiting."
+               exit 1
+       fi
+
+       [ "$debug" == 0 ] && dbg="" || dbg="-d"
+
+       export CLICK_BACKTRACE=1
+
+       /usr/bin/click_config -p $profile -r $rc -s $ls -l $metric \
+               -m "$hwmodes" -c "$freqs" -n "$ifnames" -a "$hwaddrs" $dbg \
+               | sed -e "s/__XR_IFNAME__/$link/g" \
+               | sed -e "s/__XR_IP__/$ipaddr/g" \
+               | sed -e "s/__XR_BCAST__/$bcast/g" \
+               | sed -e "s/__XR_NM__/$netmask/g" \
+               | sed -e "s/__XR_PERIOD__/$period/g" \
+               | sed -e "s/__XR_TAU__/$tau/g" > /tmp/$link.click
+
+       /usr/bin/click-align /tmp/$link.click > /tmp/$link-aligned.click 2>/var/log/$link.log
+       [ ! -c /dev/net/tun ] && {
+               mkdir -p /dev/net/
+               mknod /dev/net/tun c 10 200
+               if [ ! -c /dev/net/tun ]; then
+                       logger -t "$config" "Device not available (/dev/net/tun). Exiting."
+                       exit 1
+               fi
+       }
+
+       (/usr/bin/click /tmp/$link-aligned.click >> /var/log/$link.log 2>&1 &) &
+
+       sleep 2
+
+       ps | grep /usr/bin/click | grep -q -v grep || {
+               logger -t "$config" "Unable to start click. Exiting."
+               exit 1
+       }
+
+       ps | grep /usr/bin/click | grep -v grep | awk '{print $1}' > /var/run/$link.pid
+
+        uci_set_state network $config ifname "$iface"
+        uci_set_state network $config ipaddr "$ipaddr"
+        uci_set_state network $config netmask "$netmask"
+        uci_set_state network $config gateway "0.0.0.0"
+
+       env -i ACTION="ifup" INTERFACE="$config" DEVICE="$link" PROTO=wing /sbin/hotplug-call "link" &
+
+       proto_init_update "$link" 1
+       proto_add_ipv4_address "$ipaddr" "$netmask"
+       proto_add_ipv4_route "$prefix.0.0.0" "255.0.0.0" "$iface"
+
+       wing_load_static_routes
+       wing_load_static_hnas
+
+       proto_send_update "$config"
+
+}
+
+wing_template_available() { # prefix, template, default
+       local template="/etc/wing/$1.$2.click"
+       [ ! -f $template ] && {
+               return 1
+       }
+       return 0
+}
+
+wing_list_interfaces() {
+       local channel freq hwmode hwaddr ifname mode
+       config_get mode $1 mode
+       config_get_bool up $1 up
+       [ "$up" = "1" ] || {
+               logger -t "$1" "Device not up. Ignoring."
+               return 0
+       }
+       [ "$mode" = "monitor" ] || {
+               logger -t "$1" "Device not in monitor mode. Ignoring."
+               return 0
+       }
+       config_get ifname $1 ifname
+       config_get device $1 device
+       config_get hwmode $device hwmode "11bg"
+       config_get channel $device channel "0"
+       [ "$channel" = "0" -o "$channel" = "auto" ] && {
+               logger -t "$device" "Channel not specified. Ignoring."
+               return 0
+       }
+       freq=$(iw phy $device info | grep "MHz" | grep "\[$channel\]" | sed -n "s/^.* \([0-9]*\) MHz.*/\1/p")
+       hwaddr=$(/sbin/ifconfig $ifname 2>&1 | sed -n 's/^.*HWaddr \([0-9A-Za-z\-]*\).*/\1/p' | sed -e 's/\-/:/g' | cut -c1-17)
+       freqs=${freqs:+"$freqs "}$freq
+       hwmodes=${hwmodes:+"$hwmodes "}$hwmode
+       hwaddrs=${hwaddrs:+"$hwaddrs "}$hwaddr
+       ifnames=${ifnames:+"$ifnames "}$ifname
+       /sbin/ifconfig $ifname mtu 1900
+       /sbin/ifconfig $ifname txqueuelen 5
+       /sbin/ifconfig $ifname up
+}
+
+#
+# HNAs functions
+#
+
+wing_add_static_hna() {
+       logger "Adding hna: $1"
+       uci add_list network.mesh.hna=$1
+       uci commit
+       wing_load_static_hnas
+}
+
+wing_clear_static_hna() {
+       logger "Deleting hna: $1"
+       local list="$(uci get network.mesh.hna)"
+       local elem
+       uci delete network.mesh.hna
+       for elem in $list; do
+               if [ "$elem" != "$1" ]; then
+                       uci add_list network.mesh.hna=$elem
+               fi
+       done
+       uci commit
+}
+
+wing_load_static_hna() {
+       logger "Loading hna: $1"
+       output=$(/usr/bin/write_handler wr/gw.hna_add $1)
+       [ "$output" != "" ] && {
+               logger "Invalid hna: $1"
+               wing_clear_static_hna "$1"
+       }
+}
+
+wing_load_static_hnas() {
+       logger "Loading hnas"
+       /usr/bin/write_handler wr/gw.hnas_clear true
+       config_load network
+       config_list_foreach mesh hna wing_load_static_hna
+}
+
+wing_clear_static_hnas() {
+       logger "Clearing hnas"
+       /usr/bin/write_handler wr/gw.hnas_clear true
+       config_load network
+       config_list_foreach mesh hna wing_clear_static_hna
+}
+
+#
+# Static routes functions
+#
+
+wing_add_static_route() {
+       logger "Adding route: $1"
+       uci add_list network.mesh.route=$1
+       uci commit
+       wing_load_static_routes
+}
+
+wing_clear_static_route() {
+       logger "Deleting route: $1"
+       local list="$(uci get network.mesh.route)"
+       local elem
+       uci delete network.mesh.route
+       for elem in $list; do
+               if [ "$elem" != "$1" ]; then
+                       uci add_list network.mesh.route=$elem
+               fi
+       done
+       uci commit
+}
+
+wing_load_static_route() {
+       logger "Loading route: $1"
+       route=$(echo $1 | sed 's/@/ /')
+       output=$(/usr/bin/write_handler wr/querier.add $route)
+       [ "$output" != "" ] && {
+               logger "Invalid route: $1"
+               wing_clear_static_route "$1"
+       }
+}
+
+wing_load_static_routes() {
+       logger "Loading routes"
+       /usr/bin/write_handler wr/querier.clear_static_routes true
+       config_load network
+       config_list_foreach mesh route wing_load_static_route
+}
+
+wing_clear_static_routes() {
+       logger "Clearing routes"
+       /usr/bin/write_handler wr/querier.clear_static_routes true
+       config_load network
+       config_list_foreach mesh route wing_clear_static_route
+}
+
+add_protocol wing
+
diff --git a/net/wing/files/usr/bin/wing_status b/net/wing/files/usr/bin/wing_status
new file mode 100755 (executable)
index 0000000..eaddb99
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/sh
+
+# Copyright (c) 2012, Roberto Riggio
+#
+# All rights reserved.
+#
+# 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 CREATE-NET 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 COPYRIGHT OWNER 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.
+
+ROUTES=0
+STATIC=0
+HOSTS=0
+LINKS=0
+ARP=0
+GATEWAY=0
+PROBES=0
+INTERFACES=0
+
+show_status() {
+
+       [ $ROUTES = 1 ] && {
+               printf "Routes:\n"
+               write_handler lt.dijkstra true
+               read_handler lt.routes
+       }
+
+       [ $STATIC = 1 ] && {
+               printf "\nStatic Routes:\n"
+               read_handler wr/querier.static_routes
+       }
+
+       [ $HOSTS = 1 ] && {
+               printf "\nIP:\n"
+               read_handler lt.ip
+               printf "\nHosts:\n"
+               read_handler lt.hosts
+       }
+
+       [ $INTERFACES = 1 ] && {
+               printf "\nInterfaces:\n"
+               read_handler lt.interfaces
+       }
+
+       [ $LINKS = 1 ] && {
+               printf "\nLinks:\n"
+               read_handler lt.links
+       }
+
+       [ $ARP = 1 ] && {
+               printf "\nARP Table:\n"
+               read_handler arp.table
+       }
+
+       [ $GATEWAY = 1 ] && {
+               printf "\nBest gateway:\n"
+               read_handler wr/set_gateway.gateway
+               printf "\nGateways:\n"
+               read_handler wr/gw.gateway_stats
+               printf "\nHNAs:\n"
+               read_handler wr/gw.hnas
+       }
+
+       [ $PROBES = 1 ] && {
+               interfaces=$(read_handler lt.interfaces)
+               for interface in $interfaces; do
+                       printf "\nBroadcast statistics ($interface):\n"
+                       read_handler wr/es/es_$interface.bcast_stats
+                       printf "\nBroadcast statistics HT ($interface):\n"
+                       read_handler wr/es/es_$interface.bcast_stats_ht
+               done
+       }
+
+       exit 0
+
+}
+
+if [ $# -eq 0 ]; then
+       ROUTES=1
+       STATIC=1
+       HOSTS=1
+       LINKS=1
+       ARP=1
+       GATEWAY=1
+       PROBES=1
+       INTERFACES=1
+fi
+
+while getopts "rshlagpi" OPTVAL
+do
+       case $OPTVAL in
+       r) ROUTES=1
+         ;;
+       r) STATIC=1
+         ;;
+       h) HOSTS=1
+         ;;
+       l) LINKS=1
+         ;;
+       i) INTERFACES=1
+         ;;
+       a) ARP=1
+         ;;
+       g) GATEWAY=1
+         ;;
+       p) PROBES=1
+         ;;
+       *) ROUTES=1; STATIC=1; HOSTS=1; LINKS=1; ARP=1; GATEWAY=1; PROBES=1
+         ;;
+       esac
+done
+
+show_status
diff --git a/net/wiviz/Makefile b/net/wiviz/Makefile
new file mode 100644 (file)
index 0000000..053517f
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2006-2009 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:=wiviz
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wiviz
+  SECTION:=net
+  CATEGORY:=Network
+  SUMENU:=wireless
+  DEPENDS:=+libpcap
+  TITLE:=Wireless Network Visualization
+  URL:=http://devices.natetrue.com/wiviz/
+endef
+       
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
+EXTRA_LDFLAGS += $(TARGET_LDFLAGS)
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CCOPTS="$(TARGET_CFLAGS)" \
+               INCLUDE="$(EXTRA_CFLAGS)" \
+               LDFLAGS="$(EXTRA_LDFLAGS)" \
+       )
+endef
+
+define Package/wiviz/install   
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(CP) ./files/* $(1)
+       find $(1) -name CVS | xargs rm -rf
+       find $(1) -name .svn | xargs rm -rf
+endef
+
+$(eval $(call BuildPackage,wiviz))
diff --git a/net/wiviz/files/www/cgi-bin/wiviz/get.cgi b/net/wiviz/files/www/cgi-bin/wiviz/get.cgi
new file mode 100755 (executable)
index 0000000..161fc75
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+WIVIZ_PATH=wiviz
+
+echo Content-type: text/html
+echo 
+killall -USR1 wiviz >/dev/null 2>&1
+if [ 0 -ne $? ]
+ then #### Wi-Viz daemon not running, start it
+  $WIVIZ_PATH >/dev/null </dev/null 2>&1 &
+  killall -USR1 wiviz > /dev/null
+ fi
+echo "<html><head><script language='JavaScript1.2'>"
+cat /tmp/wiviz-pipe
+echo "</script></head><body></body></html>"
diff --git a/net/wiviz/files/www/cgi-bin/wiviz/set.cgi b/net/wiviz/files/www/cgi-bin/wiviz/set.cgi
new file mode 100755 (executable)
index 0000000..17b4787
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+httpd -d $QUERY_STRING > /tmp/wiviz-cfg
+killall -USR2 wiviz
diff --git a/net/wiviz/files/www/wiviz/adhoc-idle.gif b/net/wiviz/files/www/wiviz/adhoc-idle.gif
new file mode 100755 (executable)
index 0000000..05e479f
Binary files /dev/null and b/net/wiviz/files/www/wiviz/adhoc-idle.gif differ
diff --git a/net/wiviz/files/www/wiviz/adhoc-idle.png b/net/wiviz/files/www/wiviz/adhoc-idle.png
new file mode 100755 (executable)
index 0000000..b10b102
Binary files /dev/null and b/net/wiviz/files/www/wiviz/adhoc-idle.png differ
diff --git a/net/wiviz/files/www/wiviz/adhoc.gif b/net/wiviz/files/www/wiviz/adhoc.gif
new file mode 100755 (executable)
index 0000000..d07c80c
Binary files /dev/null and b/net/wiviz/files/www/wiviz/adhoc.gif differ
diff --git a/net/wiviz/files/www/wiviz/adhoc.png b/net/wiviz/files/www/wiviz/adhoc.png
new file mode 100755 (executable)
index 0000000..57db25c
Binary files /dev/null and b/net/wiviz/files/www/wiviz/adhoc.png differ
diff --git a/net/wiviz/files/www/wiviz/ap-idle.gif b/net/wiviz/files/www/wiviz/ap-idle.gif
new file mode 100755 (executable)
index 0000000..a929696
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap-idle.gif differ
diff --git a/net/wiviz/files/www/wiviz/ap-idle.png b/net/wiviz/files/www/wiviz/ap-idle.png
new file mode 100755 (executable)
index 0000000..a6e6fb3
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap-idle.png differ
diff --git a/net/wiviz/files/www/wiviz/ap-wep-idle.gif b/net/wiviz/files/www/wiviz/ap-wep-idle.gif
new file mode 100755 (executable)
index 0000000..a929696
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap-wep-idle.gif differ
diff --git a/net/wiviz/files/www/wiviz/ap-wep-idle.png b/net/wiviz/files/www/wiviz/ap-wep-idle.png
new file mode 100755 (executable)
index 0000000..a6e6fb3
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap-wep-idle.png differ
diff --git a/net/wiviz/files/www/wiviz/ap-wep.gif b/net/wiviz/files/www/wiviz/ap-wep.gif
new file mode 100755 (executable)
index 0000000..2901520
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap-wep.gif differ
diff --git a/net/wiviz/files/www/wiviz/ap-wep.png b/net/wiviz/files/www/wiviz/ap-wep.png
new file mode 100755 (executable)
index 0000000..3436183
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap-wep.png differ
diff --git a/net/wiviz/files/www/wiviz/ap.gif b/net/wiviz/files/www/wiviz/ap.gif
new file mode 100755 (executable)
index 0000000..7eb5b3a
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap.gif differ
diff --git a/net/wiviz/files/www/wiviz/ap.png b/net/wiviz/files/www/wiviz/ap.png
new file mode 100755 (executable)
index 0000000..ccfc864
Binary files /dev/null and b/net/wiviz/files/www/wiviz/ap.png differ
diff --git a/net/wiviz/files/www/wiviz/pip-idle.gif b/net/wiviz/files/www/wiviz/pip-idle.gif
new file mode 100755 (executable)
index 0000000..fa923bd
Binary files /dev/null and b/net/wiviz/files/www/wiviz/pip-idle.gif differ
diff --git a/net/wiviz/files/www/wiviz/pip-idle.png b/net/wiviz/files/www/wiviz/pip-idle.png
new file mode 100755 (executable)
index 0000000..3fe25fe
Binary files /dev/null and b/net/wiviz/files/www/wiviz/pip-idle.png differ
diff --git a/net/wiviz/files/www/wiviz/pip.gif b/net/wiviz/files/www/wiviz/pip.gif
new file mode 100755 (executable)
index 0000000..1c566e9
Binary files /dev/null and b/net/wiviz/files/www/wiviz/pip.gif differ
diff --git a/net/wiviz/files/www/wiviz/pip.png b/net/wiviz/files/www/wiviz/pip.png
new file mode 100755 (executable)
index 0000000..5c05a73
Binary files /dev/null and b/net/wiviz/files/www/wiviz/pip.png differ
diff --git a/net/wiviz/files/www/wiviz/station-idle.gif b/net/wiviz/files/www/wiviz/station-idle.gif
new file mode 100755 (executable)
index 0000000..155f022
Binary files /dev/null and b/net/wiviz/files/www/wiviz/station-idle.gif differ
diff --git a/net/wiviz/files/www/wiviz/station-idle.png b/net/wiviz/files/www/wiviz/station-idle.png
new file mode 100755 (executable)
index 0000000..eb1621e
Binary files /dev/null and b/net/wiviz/files/www/wiviz/station-idle.png differ
diff --git a/net/wiviz/files/www/wiviz/station.gif b/net/wiviz/files/www/wiviz/station.gif
new file mode 100755 (executable)
index 0000000..c8a075f
Binary files /dev/null and b/net/wiviz/files/www/wiviz/station.gif differ
diff --git a/net/wiviz/files/www/wiviz/station.png b/net/wiviz/files/www/wiviz/station.png
new file mode 100755 (executable)
index 0000000..8daf8df
Binary files /dev/null and b/net/wiviz/files/www/wiviz/station.png differ
diff --git a/net/wiviz/files/www/wiviz/wiviz.css b/net/wiviz/files/www/wiviz/wiviz.css
new file mode 100755 (executable)
index 0000000..7b5afa7
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+body {
+       background-color: #D0D0D0;
+       vertical-align: center;
+       text-align: center;
+}
+div.main {
+       background-color: #D0F0D0;
+       width: 500px;
+       height: 500px;
+       border: 1px solid #555599;
+       vertical-align: center;
+       text-align: center;
+}
+div.floater {
+       background-color: #D0F0D0;
+       width: 125px;
+       height: 300px;
+       border: 1px solid #555599;
+       float: right;
+       z-index: 3;
+}
+span.status {
+       color: #FF0000;
+}
+img.icon {
+       width: 50px;
+       height: 50px;
+}
+img.pip {
+       width: 12px;
+       height: 12px;
+       position: absolute;
+       z-index: 1;
+}
+td {
+       vertical-align: center;
+  text-align: center;
+}
+span.hostdesc {
+       font-size: 10pt;
+}
+span.extrafo {
+       font-size: 10pt;
+       visibility: hidden;
+}
+div.hostdiv {
+       position: absolute;
+       background-color: transparent;
+       text-align: center;
+       width: 150px;
+       z-index: 2;
+}
+div.hostdiv_hov {
+       position: absolute;
+       background-color: #C0E0C0;
+       text-align: center;
+       width: 150px;
+       z-index: 3;
+       border: 1px solid #000000;
+}
diff --git a/net/wiviz/files/www/wiviz/wiviz.html b/net/wiviz/files/www/wiviz/wiviz.html
new file mode 100755 (executable)
index 0000000..f1356fd
--- /dev/null
@@ -0,0 +1,81 @@
+<html>
+<head>
+<!--
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+-->
+<title>Wi-viz wireless network environment visualization</title>
+<link rel='stylesheet' type='text/css' href='wiviz.css'>
+<script language='JavaScript1.2' src='wiviz.js'>
+</script>
+</head>
+<body>
+<h2>OpenWRT Wi-viz network visualization</h2>
+<div class='floater'>
+Status: <span id='status' class='status'>Monitoring</span><br>
+<input type='button' id='togglelisten' value='Stop monitoring' onclick='toggleListen()'>
+<p><form name='channelform' action='/cgi-bin/wiviz/set.cgi' method='get' target='wivizGetFrame'>
+Channel setting:
+<select id='channelsel' name='channelsel' onchange='channelSet()'>
+<option value='nochange' selected>No change</option>
+<option value='hop'>Hopping</option>
+<option>1</option>
+<option>2</option>
+<option>3</option>
+<option>4</option>
+<option>5</option>
+<option>6</option>
+<option>7</option>
+<option>8</option>
+<option>9</option>
+<option>10</option>
+<option>11</option>
+<option>12</option>
+<option>13</option>
+<option>14</option>
+</select><br>
+<span id='hopoptions' style='display: none'>
+Time/channel: <select name='hopdwell'>
+<option value='500'>0.5 sec</option>
+<option selected value='1000'>1 sec</option>
+<option value='2000'>2 sec</option>
+<option value='5000'>5 sec</option>
+</select><br>
+Hop sequence: <select name='hopseq'>
+<option selected>1,3,6,8,11</option>
+<option>1,3,6,8,11,14</option>
+<option>1,6,11</option>
+<option value='1,2,3,4,5,6,7,8,9,10,11'>1 to 11</option>
+<option value='1,2,3,4,5,6,7,8,9,10,11,12,13,14'>1 to 14</option>
+</select><br>
+<input type='submit' value='Set'>
+</form>
+</span>
+</div>
+<center>
+<div id='infodiv' class='main'>
+<table height=100% width=100%><tr><td>
+<span id='pips' style='position: relative'></span>
+<span id='content' style='position: relative'></span>
+</td></tr></table>
+</div>
+</center>
+<span id='debug' style='display: none'></span>
+<iframe style='display:none' id='wivizGetFrame' name='wivizGetFrame' src='about:blank'></iframe>
+<script language='JavaScript1.2'>
+ scan_thread();
+</script>
+</body>
+</html>
diff --git a/net/wiviz/files/www/wiviz/wiviz.js b/net/wiviz/files/www/wiviz/wiviz.js
new file mode 100755 (executable)
index 0000000..dc67d8f
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+var mv = 353;
+var stupid = eval('window.attachEvent') ? 1 : 0;
+var hosts;
+var idle_timeout = 20;
+var erase_timeout = 35;
+var skew_x = 0; skew_y = 0;
+var listening = 1;
+var wiviz_cgi_url = "/cgi-bin/wiviz/get.cgi";
+
+//What? You mean the POSIX thread API hasn't been ported to Javascript?  Bugger.
+function scan_thread() {
+       var loc = document.getElementById('wivizGetFrame').contentWindow.location;
+       if (!listening) return;
+       if (loc.href != wiviz_cgi_url) {
+               loc.replace(wiviz_cgi_url);
+       }
+       else {
+               loc.reload(true);
+       }
+       setTimeout("scan_thread()", 5000);
+}
+
+function toggleListen() {
+       statusel = document.getElementById('status');
+       statusbutton = document.getElementById('togglelisten');
+       listening = 1 - listening;
+       if (listening) {
+           statusel.innerHTML = "Monitoring";
+           statusbutton.value = "Stop monitoring";
+           document.getElementById('content').innerHTML = '';
+           scan_thread();
+       }
+       else {
+           statusel.innerHTML = "Stopped";
+           statusbutton.value = "Start monitoring";
+       }
+}
+
+function channelSet() {
+       channelset = document.getElementById('channelsel').value;
+       if (channelset == 'hop') {
+           document.getElementById('hopoptions').style.display = 'inline';
+       }
+       else {
+           document.getElementById('hopoptions').style.display = 'none';
+           if (channelset != 'nochange') document.forms[0].submit();
+       }
+}
+
+function mousenter(e) {
+       if (stupid) e = event;
+       el = stupid ? e.srcElement : e.currentTarget;
+       el.parentNode.parentNode.className = 'hostdiv_hov';
+       el.nextSibling.nextSibling.nextSibling.style.visibility = 'visible';
+}
+
+function mouseout(e) {
+       if (stupid) e = event;
+       el = stupid ? e.srcElement : e.currentTarget;
+       el.parentNode.parentNode.className = 'hostdiv';
+       el.nextSibling.nextSibling.nextSibling.style.visibility = 'hidden';
+}
+
+function generate_mnemonic(hash) {
+       c = new Array('b','c','d','f','g','h','j','k','l','m','n','p','qu','r','s',
+               't','v','w','y','z','th','ch','sh','cc','rr');
+       v = new Array('a','e','i','o','u','ae','ai','ao','au','eo','ei','eu','iu','oa','oe');
+       var i, a;
+       var p = hash & 1;
+       var n = '';
+       for (i = 0; i < 4; i++) {
+               a = p ? c : v;
+               n += a[hash % a.length];
+               hash += a.length << 3 + a.length / 2;
+               hash *= hash;
+         p = 1 - p;
+       }
+       return n;
+}
+
+function mkhash(mac) {
+       var     macarr = mac.split(/:/);
+  var hash = 0;
+               for (j = 0; j < 6; j++) {
+                       hash += parseInt(macarr[j]) * j << j;
+                       hash += 11;
+               }
+       if (hash < 0) hash = -hash;
+       return hash;
+}
+
+function wiviz_callback(mhosts, cfgstring) {
+       var nh = '';
+       hosts = mhosts;
+       for (i = 0; i < hosts.length; i++) {
+         hs = hosts[i];
+         if (hs.length == 0) break;
+    hs.mac = hs[0];
+    hs.rssi = hs[1];
+    hs.desc = hs[2];
+    hs.descarr = hs.desc.split(/-/)
+    hs.age = hs[3];
+               hs.hash = mkhash(hs.mac);
+    hs.mnem = generate_mnemonic(hs.hash)
+    hs.name = hs.mnem;
+    el = document.getElementById(hs.mnem);
+    if (el) {
+      if (hs.age > erase_timeout) {
+        el.parentNode.removeChild(el);
+        continue;
+      }
+       el.innerHTML = genHTML(hs);
+    }
+    else {
+      if (hs.age > erase_timeout) continue;
+                       hs.x = Math.sin(hs.hash / mv) * hs.rssi * 2 - 67;
+                       hs.y = Math.cos(hs.hash / mv) * hs.rssi * 2;
+                       nh += "<div class='hostdiv' id='" + hs.mnem + "' style='top: ";
+                       nh += parseInt(hs.y) + "px; left: " + parseInt(hs.x) + "px'>";
+                 nh += genHTML(hs) + "</div>";
+    }
+       }
+       document.getElementById('content').innerHTML += nh;
+       
+       cfgarr = cfgstring.split(/-/);
+       if (cfgarr[1]) {
+           if (cfgarr[1] == 'hopping') cfgarr[1] = 'hop';
+           document.getElementById('channelsel').value = cfgarr[1];
+           if (cfgarr[1] == 'hop') channelSet();
+       }
+       
+       //repip();
+       setTimeout("declump(); repip();", 250);
+}
+
+function repip() {
+  var nh = "";
+  if (!hosts) return;
+       for (i = 0; i < hosts.length; i++) {
+         hs = hosts[i];
+         if (hs.length == 0) break;
+    mac = hs[0];
+    rssi = hs[1];
+    desc = hs[2].split(/-/);
+               if (desc[0] == 'sta' && desc[1] == 'assoc') {
+                       bss = desc[2];
+                       hs.apmnem = generate_mnemonic(mkhash(bss));
+                       ap = document.getElementById(hs.apmnem);
+                       sta = document.getElementById(hs.mnem);
+                       if (ap && sta) {
+                         x = parseInt(sta.style.left);
+                         y = parseInt(sta.style.top);
+                         dx = parseInt(ap.style.left) - x;
+                         dy = parseInt(ap.style.top) - y;
+                         x += 67;
+                         y += 10;
+                         d = Math.sqrt(dx*dx+dy*dy);
+                         for (j = 0; j < d; j += 15) {
+                           nh += "<img src='"
+                                         + ((hs.age < idle_timeout) ? "pip" : "pip-idle")
+                                         + (stupid ? ".gif" : ".png")
+                                               + "' class='pip' style='top:"
+                             + parseInt(y+dy * j / d) + "; left:"
+                             + parseInt(x+dx * j / d) + "'>";
+                         }
+                       }
+               }
+       }
+       document.getElementById('pips').innerHTML = nh;
+}
+
+function declump() {
+       var c = 0;
+       var top = 30000,left = 30000,right = -30000,bottom = -30000;
+       for (i = 0; i < hosts.length; i++) {
+         for (j = 0; j < hosts.length; j++) {
+           if (i == j) continue;
+                       e1 = document.getElementById(hosts[i].mnem);
+                       e2 = document.getElementById(hosts[j].mnem);
+                       if (!e1 || !e2) continue;
+                       x1 = parseInt(e1.style.left);
+                       x2 = parseInt(e2.style.left);
+                       y1 = parseInt(e1.style.top);
+                       y2 = parseInt(e2.style.top);
+                       if (x1 < left) left = x1;
+                       if (y1 < top) top = y1;
+                       if (x1 > right) right = x1;
+                       if (y1 > bottom) bottom = y1;
+                       ox = x2;
+                       oy = y2;
+                       dist = Math.sqrt(Math.pow((x1-x2), 2) + Math.pow((y1-y2), 2));
+                       if (dist == 0) {
+                           x2 += Math.random() * 5;
+                               y2 += Math.random() * 5;
+                               dist = 10;
+                       }
+                       if (dist < 100) {
+                               cx = (x1-x2) * 5 / (dist / 3);
+                               cy = (y1-y2) * 5 / (dist / 3);
+                               x2 -= cx;
+                               y2 -= cy;
+                               }
+                       if (hosts[j].apmnem == hosts[i].mnem
+                                       || hosts[i].apmnem == hosts[j].mnem) {
+                         cx = (x1-x2) * 5 / (dist / 3);
+                         cy = (y1-y2) * 5 / (dist / 3);
+                               if (dist > 150) {
+                                 x2 += cx;
+                                 y2 += cy;
+                               }
+                       }
+                       if (Math.abs(ox-x2) > 2 || Math.abs(oy-y2) > 2) {
+                               e2.style.left = parseInt(x2);
+                               e2.style.top = parseInt(y2);
+                               c++;
+                       }
+         }
+       }
+       if (top < bottom && left < right) {
+         document.getElementById('debug').innerHTML = left + "," + right + "," + top + "," +bottom;
+         document.getElementById('content').style.left =
+               document.getElementById('pips').style.left =
+                        -(right - left) / 2 - left - 67;
+         document.getElementById('content').style.top =
+         document.getElementById('pips').style.top =
+                        -(bottom - top) / 2 - top - 25;
+       }
+       repip();
+       if (c) setTimeout("declump()", 100);
+}
+
+function genHTML(hs) {
+       var nh = '';
+  nh += "<center><img class='icon' src='"
+       a = hs.descarr;
+       if (a[0] == 'ap' || a[0] == 'adhoc') {
+         if (a[0] == 'ap') {
+                       nh += "ap";
+                       if (a[5] == 'enc') nh += "-wep";
+         }
+         else {
+           nh += "adhoc";
+         }
+               hs.channel = a[2];
+               hs.name = a[4];
+       }
+       else if (a[0] == 'sta') {
+               nh += "station";
+               hs.channel = 0;
+       }
+       nh += (hs.age < idle_timeout) ? "": "-idle";
+       nh += stupid ? ".gif" : ".png";
+       nh += "' onmouseover='mousenter(event)' onmouseout='mouseout(event)'"
+               + "><br><span class='hostdesc'>" + hs.mac + "<br><i>'" + hs.name;
+       nh += "'</i>";
+       if (hs.channel) {
+         nh += " ch" + hs.channel;
+       }
+       nh += "</span><span class='extrafo'><br>";
+       if (a[0] == 'ap') nh += "Access point";
+       if (a[0] == 'sta') nh += "Station";
+       if (a[0] == 'adhoc') nh += "Logical ad-hoc entity";
+       if (a[0] == 'ap' || a[0] == 'adhoc') {
+               nh += "<br>";
+               if (a[5] == '?enc') nh += "Encryption unknown";
+               if (a[5] == 'enc') nh += "Encrypted";
+               if (a[5] == 'unenc') nh += "Unencrypted";
+               if (a[6] == 'wep') nh += "-WEP";
+               if (a[6] == 'wpa') nh += "-WPA";
+       }
+       nh += "<br>RSSI: " + hs.rssi + " dBm<br>"
+               + "Seen " + hs.age + " seconds ago<br>";
+       nh += "</span></center>";
+       return nh;
+}
diff --git a/net/wiviz/src/Makefile b/net/wiviz/src/Makefile
new file mode 100644 (file)
index 0000000..6f23035
--- /dev/null
@@ -0,0 +1,25 @@
+## Wi-viz makefile
+# Supply your own C cross-compiler; I recommend the one from the OpenWRT buildroot
+# Also requires a libpcap to link with, use libpcap.a for static, .so for shared
+CC=~/buildroot/staging_dir_mipsel/bin/mipsel-linux-gcc
+LDFLAGS=-L~/buildroot/staging_dir_mipsel/lib
+LIBS=-lpcap
+
+CCOPTS=-O2 -Os -pipe -mips32 -mtune=mips32
+INCLUDE=-I~/buildroot/staging_dir_mipsel/include
+SOURCES=wiviz.c wl_access.c channelhopper.c
+OBJS=wiviz.o wl_access.o channelhopper.o
+TARGET=wiviz
+
+wiviz: ${OBJS}
+       ${CC} ${CCOPTS} ${INCLUDE} -o ${TARGET} ${OBJS} ${LDFLAGS} ${LIBS}
+
+wiviz.o: wiviz.c
+       ${CC} ${CCOPTS} ${INCLUDE} -c ${SOURCES}
+wl_access.o: wl_access.c
+       ${CC} ${CCOPTS} ${INCLUDE} -c ${SOURCES}
+channelhopper.o: channelhopper.c
+       ${CC} ${CCOPTS} ${INCLUDE} -c ${SOURCES}
+
+remake:
+       touch wiviz.c wl_access.c channelhopper.c
diff --git a/net/wiviz/src/channelhopper.c b/net/wiviz/src/channelhopper.c
new file mode 100644 (file)
index 0000000..0a3e6fe
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+#include <stdio.h>
+#include <pcap.h>
+#include <signal.h>
+#include <sys/time.h>
+#include "wl_access.h"
+#include "channelhopper.h"
+#include "structs.h"
+
+void ch_sig_handler(int i) {
+
+  }
+
+void channelHopper(wiviz_cfg * cfg) {
+  int hopPos;
+  int nc;
+
+  //Turn off signal handling from parent process
+  signal(SIGUSR1, &ch_sig_handler);
+  signal(SIGUSR2, &ch_sig_handler);
+
+  //Start hoppin'!
+  hopPos = 0;
+  while (1) {
+    nc = cfg->channelHopSeq[hopPos];
+    hopPos = (hopPos + 1) % cfg->channelHopSeqLen;
+    //Set the channel
+    fprintf(stderr, "It sets the channel to %i\n", nc);
+    wl_ioctl(WL_DEVICE, WLC_SET_CHANNEL, &nc, 4);
+    //Sleep
+    usleep(cfg->channelDwellTime * 1000);
+    }
+  }
diff --git a/net/wiviz/src/channelhopper.h b/net/wiviz/src/channelhopper.h
new file mode 100644 (file)
index 0000000..6ab63af
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Channel hopper definition
+
+void channelHopper();
diff --git a/net/wiviz/src/structs.h b/net/wiviz/src/structs.h
new file mode 100644 (file)
index 0000000..10f80f3
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+//Structure definitions for wireless packets
+
+#define MAX_HOSTS 257
+
+#ifdef DEFINE_TYPES
+typedef unsigned short u_short;
+typedef unsigned char u_char;
+typedef unsigned int u_int;
+#endif
+
+typedef enum {
+  mgt_assocRequest = 0,
+  mgt_assocResponse = 1,
+  mgt_reassocRequest = 2,
+  mgt_reassocResponse = 3,
+  mgt_probeRequest = 4,
+  mgt_probeResponse = 5,
+  mgt_beacon = 8,
+  mgt_disassoc = 10,
+  mgt_auth = 11,
+  mgt_deauth = 12
+  } wifi_frametype;
+
+typedef struct ieee802_11_hdr {
+  u_char frame_control;
+  u_char flags;
+#define IEEE80211_TO_DS 0x01
+#define IEEE80211_FROM_DS 0x02
+#define IEEE80211_MORE_FRAG 0x04
+#define IEEE80211_RETRY 0x08
+#define IEEE80211_PWR_MGT 0x10
+#define IEEE80211_MORE_DATA 0x20
+#define IEEE80211_WEP_FLAG 0x40
+#define IEEE80211_ORDER_FLAG 0x80
+  u_short duration;
+  u_char addr1[6];
+  u_char addr2[6];
+  u_char addr3[6];
+  u_short frag_and_seq;
+  } ieee802_11_hdr;
+
+typedef struct {
+  u_char timestamp[8];
+  u_short bcn_interval;
+  u_short caps;
+#define MGT_CAPS_AP 0x1
+#define MGT_CAPS_IBSS 0x2
+#define MGT_CAPS_WEP 0x10
+  } ieee_802_11_mgt_frame;
+
+typedef struct {
+  u_char tag;
+  u_char length;
+  } ieee_802_11_tag;
+
+typedef enum {
+  tagSSID = 0,
+  tagRates = 1,
+  tagChannel = 3,
+  tagVendorSpecific = 0xDD
+  } i81tag;
+
+typedef struct prism_hdr {
+  u_int msg_code;
+  u_int msg_length;
+  char cap_device[16];
+  //char dids[0];
+  } prism_hdr;
+
+typedef struct prism_did {
+  u_short did;
+  u_short status1;
+  u_short status2;
+  u_short length;
+  //int value[0];
+  } prism_did;
+
+typedef enum prism_did_num {
+  pdn_host_time = 0x1041,
+  pdn_mac_time = 0x2041,
+  pdn_rssi = 0x4041,
+  pdn_sq = 0x5041,
+  pdn_datarate = 0x8041,
+  pdn_framelen = 0xa041
+  } prism_did_num;
+
+
+
+//Structure definitions for data collection
+
+typedef enum {
+  typeUnknown,
+  typeAP,
+  typeSta,
+  typeAdhocHub
+  } host_type;
+
+typedef enum {
+  ssUnknown,
+  ssUnassociated,
+  ssAssociated
+  } sta_state;
+
+typedef enum {
+  aetUnknown,
+  aetUnencrypted,
+  aetEncUnknown,
+  aetEncWEP,
+  aetEncWPA
+  } ap_enc_type;
+
+typedef struct {
+  u_char bssid[6];
+  char * ssid[32];
+  u_char ssidlen;
+  u_char channel;
+  u_short flags;
+  ap_enc_type encryption;
+  } ap_info;
+
+typedef struct {
+  sta_state state;
+  u_char connectedBSSID[6];
+  } sta_info;
+
+typedef struct {
+  u_char occupied;
+  u_char mac[6];
+  host_type type;
+  time_t lastSeen;
+  int RSSI;
+  ap_info * apInfo;
+  sta_info * staInfo;
+  } wiviz_host;
+
+//Primary config struct
+typedef struct {
+  wiviz_host hosts[MAX_HOSTS];
+  int numHosts;
+  int readFromWl;
+  time_t lastKeepAlive;
+  int channelHopping;
+  int channelDwellTime;
+  int channelHopSeq[14];
+  int channelHopSeqLen;
+  int curChannel;
+  int channelHopperPID;
+  } wiviz_cfg;
+
+
+
+
+
diff --git a/net/wiviz/src/wiviz.c b/net/wiviz/src/wiviz.c
new file mode 100644 (file)
index 0000000..d2ad9f2
--- /dev/null
@@ -0,0 +1,572 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+#include <stdio.h>
+#include <pcap.h>
+#include <signal.h>
+
+#define HOST_TIMEOUT 300
+
+#include "wl_access.h"
+#include "structs.h"
+#include "channelhopper.h"
+
+#ifdef WIN32
+#define OFFLINE
+#endif
+#ifndef __cplusplus
+#define __cdecl
+#endif
+
+#define nonzeromac(x) memcmp(x, "\0\0\0\0\0\0", 6)
+
+void dealWithPacket(wiviz_cfg * cfg, struct pcap_pkthdr * header, const u_char * packet);
+wiviz_host * gotHost(wiviz_cfg * cfg, u_char * mac, host_type type);
+void fprint_mac(FILE * outf, u_char * mac, char * extra);
+void print_mac(u_char * mac, char * extra);
+void print_host(FILE * outf, wiviz_host * host);
+void __cdecl signal_handler(int);
+void readWL(wiviz_cfg * cfg);
+void reloadConfig();
+
+wiviz_cfg * global_cfg;
+
+////////////////////////////////////////////////////////////////////////////////
+int main(int argc, char * * argv) {
+  pcap_t *handle;                        
+  char *dev;                                
+  char errbuf[PCAP_ERRBUF_SIZE]; 
+  int stop = 0;
+  int oldMonitor, newMonitor;
+  struct pcap_pkthdr header;          
+  const u_char *packet;                 
+  wiviz_cfg cfg;
+  int i;
+  int defaultHopSeq[] = { 1, 3, 6, 8, 11 };
+  
+  global_cfg = &cfg;
+  signal(SIGUSR1, &signal_handler);
+  signal(SIGUSR2, &signal_handler);
+
+  fprintf(stderr, "Wi-Viz infogathering daemon by Nathan True\n");
+  
+  memset(&cfg, 0, sizeof(wiviz_cfg));
+  cfg.numHosts = 0;
+  cfg.lastKeepAlive = time(NULL);
+  cfg.channelHopping = 0;
+  cfg.channelDwellTime = 1000;
+  cfg.channelHopSeqLen = 5;
+  memcpy(cfg.channelHopSeq, defaultHopSeq, sizeof(defaultHopSeq));
+
+  wl_ioctl(WL_DEVICE, WLC_GET_MAGIC, &i, 4);
+       if (i != WLC_IOCTL_MAGIC) {
+               fprintf(stderr, "Wireless magic not correct, not querying wl for info\n");
+               cfg.readFromWl = 0;
+       }
+       else {
+         cfg.readFromWl = 1;
+         wl_ioctl(WL_DEVICE, WLC_GET_MONITOR, &oldMonitor, 4);
+         newMonitor = 1;
+         wl_ioctl(WL_DEVICE, WLC_SET_MONITOR, &newMonitor, 4);
+       }
+
+  reloadConfig();
+
+#ifndef OFFLINE
+  dev = "prism0";
+  handle = pcap_open_live(dev, BUFSIZ, 1, 0, errbuf);
+#else
+  dev = "c:\\cifsroot\\wdump2.pcap";
+  handle = pcap_open_offline(dev, errbuf);
+#endif
+
+       if (cfg.readFromWl) {
+         readWL(&cfg);
+       }
+
+  if (!handle) {
+    fprintf(stderr, "Failure to open pcap!\nErr=%s\n", errbuf);
+    return -1;
+    }
+  while (!stop) {
+    packet = pcap_next(handle, &header);
+    if (!packet) break;
+    dealWithPacket(&cfg, &header, packet);
+    if (time(NULL) - cfg.lastKeepAlive > 30) stop = 1;
+    }
+
+  signal_handler(SIGUSR1);
+
+  if (cfg.channelHopperPID) kill(cfg.channelHopperPID, SIGKILL);
+
+  for (i = 0; i < MAX_HOSTS; i++) {
+    print_host(stderr, cfg.hosts + i);
+    if (cfg.hosts[i].occupied) printf("\n");
+    if (cfg.hosts[i].apInfo) free(cfg.hosts[i].apInfo);
+    if (cfg.hosts[i].staInfo) free(cfg.hosts[i].staInfo);
+    }
+
+  wl_ioctl(WL_DEVICE, WLC_SET_MONITOR, &oldMonitor, 4);
+
+  pcap_close(handle);
+  return 0;
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void writeJavascript() { 
+  int i;
+  FILE * outf;
+  wiviz_host * h;
+
+  outf = fopen("/tmp/wiviz-pipe", "w");
+  if (!outf) {
+    fprintf(stderr, "Failure to open output file\n");
+    return;
+    }
+
+  global_cfg->lastKeepAlive = time(NULL);
+  
+  if(global_cfg->readFromWl) readWL(global_cfg);
+  
+  fprintf(outf, "top.hosts = new Array(\n");
+  for (i = 0; i < MAX_HOSTS; i++) {
+    h = global_cfg->hosts + i;
+    if (h->occupied == 0) continue;
+    if (time(NULL) - h->lastSeen > HOST_TIMEOUT) {
+      h->occupied = 0;
+      }
+    fprintf(outf, "  new Array(");
+    print_host(outf, h);
+    fprintf(outf, "),\n");
+    }
+  fprintf(outf, "new Array());\n");
+  fprintf(outf, "var cfg_string = 'channel-");
+  if (global_cfg->channelHopping) {
+    fprintf(outf, "hopping");
+    }
+  else {
+    fprintf(outf, "%i", global_cfg->curChannel);
+    }
+  fprintf(outf, "';\ntop.wiviz_callback(top.hosts, cfg_string);\n");
+  fclose(outf);
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void reloadConfig() {
+  FILE * cnf;
+  wiviz_cfg * cfg = global_cfg;
+  char filebuffer[512];
+  char * fbptr, * p, * v, * vv;
+  int fblen, val;
+  int hopCfgChanged = 0;
+  int newHopSeq[12];
+  int newHopSeqLen = 0;
+
+  fprintf(stderr, "Loading config file\n");
+
+  cnf = fopen("/tmp/wiviz-cfg", "r");
+  if (!cnf) {
+    fprintf(stderr, "Wiviz: No config file (/tmp/wiviz-cfg) present, using defaults\n");
+    return;
+    }
+
+  fblen = fread(filebuffer, 1, 512, cnf);
+  fclose(cnf);
+  if (fblen >= 512) {
+    fprintf(stderr, "Error reading config file\n");
+    return;
+    }
+  filebuffer[fblen] = 0;
+  fprintf(stderr, "Read %i bytes from config file\n", fblen);
+
+  fbptr = filebuffer;
+
+  while (fbptr < filebuffer + fblen && *fbptr != 0) {
+    p = fbptr;
+    //Find end of parameter
+    for (; *fbptr != '=' && *fbptr != 0; fbptr++);
+    *fbptr = 0;
+    v = ++fbptr;
+    //Find end of value
+    for (; *fbptr != '&' && *fbptr != 0; fbptr++);
+    *(fbptr++) = 0;
+    fprintf(stderr, "Config: %s=%s\n", p, v);
+    //Apply configuration
+    if (!strcmp(p, "channelsel")) {
+      //Channel selector
+      cfg->channelHopping = 0;
+      if (!strcmp(v, "hop")) {
+        //Set channel hopping
+        cfg->channelHopping = 1;
+        hopCfgChanged = 1;
+        }
+      else if (!strcmp(v, "nochange")) {
+        //Don't change anything, read channel from wireless card
+        readWL(cfg);
+        }
+      else {
+        val = atoi(v);
+        if (val < 1 || val > 14) {
+          fprintf(stderr, "Channel setting in config file invalid (%i)\n", cfg->curChannel);
+        }
+        else {
+          cfg->curChannel = val;
+          if (cfg->readFromWl) {
+            if (wl_ioctl(WL_DEVICE, WLC_SET_CHANNEL, &cfg->curChannel, 4) < 0) {
+              fprintf(stderr, "Channel set to %i failed\n", cfg->curChannel);
+              }
+            }
+          else {
+            fprintf(stderr, "Can't set channel, no Broadcom wireless device present\n");
+            }
+          }
+        }
+      }
+    if (!strcmp(p, "hopdwell")) {
+      val = atoi(v);
+      if (val < 100) val = 100;
+      if (val > 30000) val = 30000;
+      if (cfg->channelDwellTime != val) hopCfgChanged = 1;
+      cfg->channelDwellTime = val;
+      }
+    if (!strcmp(p, "hopseq")) {
+      cfg->channelHopSeqLen = 0;
+      while (v < fbptr) {
+        for (vv = v; *vv != ',' && *vv != 0; vv++);
+        if (*vv == 0) {
+          cfg->channelHopSeq[cfg->channelHopSeqLen++] = atoi(v);
+          break;          
+          }
+        *vv = 0;
+        cfg->channelHopSeq[cfg->channelHopSeqLen++] = atoi(v);
+        v = vv + 1;
+        }
+      }
+    /*
+    if (!strcmp(p, "")) {
+      }
+    */
+    }
+  //Apply channel hopper settings
+  if (cfg->channelHopping == 0 && cfg->channelHopperPID) {
+    kill(cfg->channelHopperPID, SIGKILL);
+    cfg->channelHopperPID = 0;
+    }
+  if (cfg->channelHopping == 1 && hopCfgChanged) {
+    if (cfg->channelHopperPID) kill(cfg->channelHopperPID, SIGKILL);
+    if ((cfg->channelHopperPID = fork()) == 0) {
+      channelHopper(cfg);
+      }
+    }
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void __cdecl signal_handler(int signum) {
+  if (signum == SIGUSR1) writeJavascript();
+  if (signum == SIGUSR2) reloadConfig();
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void dealWithPacket(wiviz_cfg * cfg, struct pcap_pkthdr * header, const u_char * packet) {
+  ieee802_11_hdr * hWifi;
+  prism_hdr * hPrism;
+  wiviz_host * host;
+  wiviz_host * emergebss;
+  host_type type = typeUnknown;
+  int wfType;
+  int rssi = 0;
+  int to_ds, from_ds;
+  prism_did * i;
+  ieee_802_11_tag * e;
+  ieee_802_11_mgt_frame * m;
+  char * src = "\0\0\0\0\0\0";
+  char * dst = "\0\0\0\0\0\0";
+  char * bss = "\0\0\0\0\0\0";
+  char * ssid = "";
+  int channel = 0;
+  int adhocbeacon = 0;
+  u_char ssidlen = 0;
+  ap_enc_type encType = aetUnknown;
+
+  if (!packet) return;
+  if (header->len < sizeof(prism_hdr) + sizeof(ieee802_11_hdr)) return;
+  hPrism = (prism_hdr *) packet;
+  hWifi = (ieee802_11_hdr *) (packet + (hPrism->msg_length));
+
+  //Parse the prism DIDs
+  i = (prism_did *)((char *)hPrism + sizeof(prism_hdr));
+  while ((int)i < (int)hWifi) {
+    if (i->did == pdn_rssi) rssi = *(int *)(i+1);
+    i = (prism_did *) ((int)(i+1) + i->length);
+    }
+
+  //Establish the frame type
+  wfType = ((hWifi->frame_control & 0xF0) >> 4) + ((hWifi->frame_control & 0xC) << 2);
+  switch (wfType) {
+    case mgt_assocRequest:
+    case mgt_reassocRequest:
+    case mgt_probeRequest:
+      type = typeSta;
+      src=hWifi->addr2;
+      dst=hWifi->addr1;
+      break;
+    case mgt_assocResponse:
+    case mgt_reassocResponse:
+    case mgt_probeResponse:
+    case mgt_beacon:
+      src=hWifi->addr2;
+      dst=hWifi->addr1;
+      bss=hWifi->addr3;
+      type = typeAP;
+      break;
+    }
+  to_ds = hWifi->flags & IEEE80211_TO_DS;
+  from_ds = hWifi->flags & IEEE80211_FROM_DS;
+  if ((wfType & 0xF0) == 0x20 && (wfType & 0xF) < 4) {
+    //Data frame
+    src=hWifi->addr2;
+    dst=hWifi->addr1;
+    if (!from_ds) type = typeSta;
+      else type = typeAP;
+    if (!to_ds && !from_ds) bss = hWifi->addr3;
+    if (to_ds && !from_ds) bss = hWifi->addr1;
+    if (!to_ds && from_ds) bss = hWifi->addr2;
+    }
+  if (type == typeUnknown) return;
+
+  //Parse the 802.11 tags
+  if (wfType == mgt_probeResponse || wfType == mgt_beacon) {
+    m = (ieee_802_11_mgt_frame *) (hWifi + 1);
+    if (m->caps & MGT_CAPS_IBSS) {
+      type = typeSta;
+      adhocbeacon = 1;
+      }
+    if (m->caps & MGT_CAPS_WEP) encType = aetEncWEP;
+    else encType = aetUnencrypted;
+    e = (ieee_802_11_tag *) ((int) m + sizeof(ieee_802_11_mgt_frame));
+    while ((u_int)e < (u_int)packet + header->len) {
+      if (e->tag == tagSSID) {
+        ssidlen = e->length;
+        ssid = (char *)(e + 1);
+        }
+      if (e->tag == tagChannel) {
+        channel = *(char *)(e + 1);
+        }
+      if (e->tag == tagVendorSpecific) {
+        if (e->length >= 4 && memcmp(e + 1, "\x00\x50\xf2\x01", 4) == 0) {
+          //WPA encryption
+          encType = aetEncWPA;
+          }
+        }
+      e = (ieee_802_11_tag *) ((int)(e + 1) + e->length);
+      }
+    }
+  
+  //Look up the host in the hash table
+  host = gotHost(cfg, src, type);
+
+  //Add any info we received
+  if (host->RSSI) {
+    host->RSSI = host->RSSI * 9 / 10 + (-rssi * 10);
+    }
+  else {
+    host->RSSI = -rssi * 100;
+    }
+  if (type == typeSta) {
+    if (nonzeromac(bss)) {
+      memcpy(host->staInfo->connectedBSSID, bss, 6);
+      host->staInfo->state = ssAssociated;
+      emergebss = gotHost(cfg, bss, typeAP);
+      if (emergebss->RSSI == 0) emergebss->RSSI = 10000;
+      memcpy(emergebss->apInfo->bssid, bss, 6);
+      if (adhocbeacon) {
+        emergebss->type = typeAdhocHub;
+        if (ssidlen > 0 && ssidlen <= 32) {
+          memcpy(emergebss->apInfo->ssid, ssid, ssidlen);
+          emergebss->apInfo->ssidlen = ssidlen;
+          }
+        if (channel) emergebss->apInfo->channel = channel;
+        emergebss->apInfo->flags = hWifi->flags;
+        emergebss->RSSI = host->RSSI;
+        if (encType != aetUnknown) emergebss->apInfo->encryption = encType;
+        }
+      }
+    if (wfType == mgt_probeRequest && host->staInfo->state == ssUnknown) host->staInfo->state = ssUnassociated;
+    }
+  if (type == typeAP) {
+    if (nonzeromac(bss)) {
+      memcpy(host->apInfo->bssid, bss, 6);
+      }
+    if (ssidlen > 0 && ssidlen <= 32) {
+      memcpy(host->apInfo->ssid, ssid, ssidlen);
+      host->apInfo->ssidlen = ssidlen;
+      }
+    if (channel) host->apInfo->channel = channel;
+    host->apInfo->flags = hWifi->flags;
+    if (encType != aetUnknown) host->apInfo->encryption = encType;
+    }
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void print_mac(u_char * mac, char * extra) {
+  fprint_mac(stdout, mac, extra);
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void fprint_mac(FILE * outf, u_char * mac, char * extra) {
+  fprintf(outf, "%02X:%02X:%02X:%02X:%02X:%02X%s",
+      mac[0] & 0xFF,
+      mac[1] & 0xFF,
+      mac[2] & 0xFF,
+      mac[3] & 0xFF,
+      mac[4] & 0xFF,
+      mac[5] & 0xFF,
+      extra);
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+#define MAX_PROBES MAX_HOSTS/2
+wiviz_host * gotHost(wiviz_cfg * cfg, u_char * mac, host_type type) {
+  int i = (mac[5] + (mac[4] << 8)) % MAX_HOSTS;
+  int c = 0;
+  wiviz_host * h = cfg->hosts + i;
+  while (h->occupied && memcmp(h->mac, mac, 6)) {
+    i++; h++; c++;
+    if (i >= MAX_HOSTS) {
+      i = 0;
+      h = cfg->hosts;
+      }
+    if (c > MAX_PROBES) break;
+    } 
+  if (!h->occupied) {
+    fprintf(stderr, "New host, ");
+    fprint_mac(stderr, mac, ", type=");
+    fprintf(stderr, "%s\n", (type==typeAP) ? "AP" : ((type==typeSta) ? "Sta" : "Unk"));
+    }
+  h->occupied = 1;
+  h->lastSeen = time(NULL);
+  h->type = type;
+  memcpy(h->mac, mac, 6);
+  if (h->type == typeAP && !h->apInfo) {
+    h->apInfo = (ap_info *) malloc(sizeof(ap_info));
+    memset(h->apInfo, 0, sizeof(ap_info));
+    }
+  if (h->type == typeSta && !h->staInfo) {
+    h->staInfo = (sta_info *) malloc(sizeof(sta_info));
+    memset(h->staInfo, 0, sizeof(sta_info));
+    }
+  return h;
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+void print_host(FILE * outf, wiviz_host * host) {
+  int i;
+
+  if (!host->occupied) return;
+  fprintf(outf, "'");
+  fprint_mac(outf, host->mac, "'");
+  fprintf(outf, ", -%i, '", host->RSSI / 100);
+  switch (host->type) {
+    case typeAP:  fprintf(outf, "ap"); break;
+    case typeSta: fprintf(outf, "sta"); break;
+    case typeAdhocHub: fprintf(outf, "adhoc"); break;
+    }
+  if (host->type == typeSta) {
+    switch(host->staInfo->state) {
+      case ssAssociated:
+        fprintf(outf, "-assoc-");
+        fprint_mac(outf, host->staInfo->connectedBSSID, "");
+        break;
+      case ssUnassociated:
+        fprintf(outf, "-unassoc");
+      }
+    }
+  if (host->type == typeAP || host->type == typeAdhocHub) {
+    fprintf(outf, "-channel-%i-ssid-", host->apInfo->channel & 0xFF);
+    for (i = 0; i < host->apInfo->ssidlen; i++) {
+      fprintf(outf, "\\x%02X", *((char *)host->apInfo->ssid + i) & 0xFF);
+       }
+    switch (host->apInfo->encryption) {
+      case aetUnknown: fprintf(outf, "-?enc-?alg"); break;
+      case aetUnencrypted: fprintf(outf, "-unenc-na"); break;
+      case aetEncUnknown: fprintf(outf, "-enc-unknown"); break;
+      case aetEncWEP: fprintf(outf, "-enc-wep"); break;
+      case aetEncWPA: fprintf(outf, "-enc-wpa"); break;
+      }
+    }
+  fprintf(outf, "', %i", time(0) - host->lastSeen);
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+#define MAX_STA_COUNT 64
+void readWL(wiviz_cfg * cfg) {
+       int ap, i;
+       wiviz_host * host, * sta;
+       uchar mac[6];
+       wlc_ssid_t ssid; 
+       channel_info_t channel;
+       maclist_t * macs;
+  sta_rssi_t starssi;
+       
+       get_mac(WL_DEVICE, mac);
+       printf("AP mac: ");
+       print_mac(mac, "\n");
+       if (!nonzeromac(mac)) return;
+       wl_ioctl(WL_DEVICE, WLC_GET_AP, &ap, 4);
+       if (ap) {
+               host = gotHost(cfg, mac, typeAP);
+               wl_ioctl(WL_DEVICE, WLC_GET_BSSID, host->apInfo->bssid, 6);
+               wl_ioctl(WL_DEVICE, WLC_GET_SSID, &ssid, sizeof(wlc_ssid_t));
+               memcpy(host->apInfo->ssid, ssid.SSID, 32);
+               host->apInfo->ssidlen = ssid.SSID_len;
+               host->RSSI = 0;
+               wl_ioctl(WL_DEVICE, WLC_GET_CHANNEL, &channel, sizeof(channel_info_t));
+               host->apInfo->channel = channel.hw_channel;
+               macs = (maclist_t *) malloc(4 + MAX_STA_COUNT * sizeof(ether_addr_t));
+               macs->count = MAX_STA_COUNT;
+               if (wl_ioctl(WL_DEVICE, WLC_GET_ASSOCLIST, macs, 4 + MAX_STA_COUNT * sizeof(ether_addr_t)) > -1) {
+                       for (i = 0; i < macs->count; i++) {
+                         sta = gotHost(cfg, (char *)&macs->ea[i], typeSta);
+        memcpy(starssi.mac, &macs->ea[i], 6);
+        starssi.RSSI = 3000;
+        starssi.zero_ex_forty_one = 0x41;
+                               if (wl_ioctl(WL_DEVICE, WLC_GET_RSSI, &starssi, 12) < 0) printf("rssifail\n");
+                               sta->RSSI = -starssi.RSSI * 100;
+                               sta->staInfo->state = ssAssociated;
+                               memcpy(sta->staInfo->connectedBSSID, host->apInfo->bssid, 6);
+                       }
+               }
+       }
+       else {
+               host = gotHost(cfg, mac, typeSta);
+               host->RSSI = 0;
+               if (wl_ioctl(WL_DEVICE, WLC_GET_BSSID, &host->staInfo->connectedBSSID, 6) < 0) {
+                 host->staInfo->state = ssUnassociated;
+               }
+               else {
+                 host->staInfo->state = ssAssociated;
+               }
+       }
+  if (wl_ioctl(WL_DEVICE, WLC_GET_CHANNEL, &channel, sizeof(channel_info_t)) >= 0) {
+    cfg->curChannel = channel.hw_channel;
+    fprintf(stderr, "Current channel is %i\n", cfg->curChannel);
+    }
+}
+
+
+
+
+
diff --git a/net/wiviz/src/wl_access.c b/net/wiviz/src/wl_access.c
new file mode 100644 (file)
index 0000000..a5172c3
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+#include "wl_access.h"
+
+int wl_ioctl(char *name, int cmd, void *buf, int len)
+{
+       struct ifreq ifr;
+       wl_ioctl_t ioc;
+       int ret = 0;
+       int s;
+
+       /* open socket to kernel */
+       if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+               perror("socket");
+               return errno;
+       }
+
+       /* do it */
+       ioc.cmd = cmd;
+       ioc.buf = buf;
+       ioc.len = len;
+       strncpy(ifr.ifr_name, name, IFNAMSIZ);
+       ifr.ifr_data = (caddr_t) &ioc;
+       ret = ioctl(s, SIOCDEVPRIVATE, &ifr);
+
+       /* cleanup */
+       close(s);
+       return ret;
+}
+
+int get_mac(char *name, void *buf)
+{
+       struct ifreq ifr;
+       int ret = 0;
+       int s;
+
+       /* open socket to kernel */
+       if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+               perror("socket");
+               return errno;
+       }
+
+       strncpy(ifr.ifr_name, name, IFNAMSIZ);
+       //ifr.ifr_data = (caddr_t) buf;
+       if ((ret = ioctl(s, SIOCGIFHWADDR, &ifr)) < 0)
+                       perror(ifr.ifr_name);
+
+       /* cleanup */
+       close(s);
+       memcpy(buf, &ifr.ifr_hwaddr.sa_data, 6);
+       return ret;
+}
diff --git a/net/wiviz/src/wl_access.h b/net/wiviz/src/wl_access.h
new file mode 100644 (file)
index 0000000..96f239d
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+//wl_access.h - functions for accessing broadcom crap
+
+#define WL_DEVICE "eth1"
+
+typedef unsigned int uint32;
+typedef unsigned char uchar;
+typedef int bool;
+
+typedef struct ether_addr {
+       uchar addr[6];
+} ether_addr_t;
+
+typedef struct wlc_ssid {
+       uint32          SSID_len;
+       uchar           SSID[32];
+} wlc_ssid_t;
+/* For ioctls that take a list of MAC addresses */
+typedef struct maclist {
+       uint count;                     /* number of MAC addresses */
+       struct ether_addr ea[1];        /* variable length array of MAC addresses */
+} maclist_t;
+/* Linux network driver ioctl encoding */
+typedef struct wl_ioctl {
+       uint cmd;       /* common ioctl definition */
+       void *buf;      /* pointer to user buffer */
+       uint len;       /* length of user buffer */
+       bool set;       /* get or set request (optional) */
+       uint used;      /* bytes read or written (optional) */
+       uint needed;    /* bytes needed (optional) */
+} wl_ioctl_t;
+/* channel encoding */
+typedef struct channel_info {
+       int hw_channel;
+       int target_channel;
+       int scan_channel;
+} channel_info_t;
+/* RSSI info for sta */
+typedef struct sta_rssi {
+  int RSSI;
+  char mac[6];
+  u_short zero_ex_forty_one;
+  } sta_rssi_t;
+/* check this magic number */
+#define WLC_IOCTL_MAGIC                0x14e46c77
+
+#define WLC_GET_MAGIC                          0
+#define WLC_GET_BSSID                          23
+#define WLC_SET_BSSID                          24
+#define WLC_GET_SSID                           25
+#define WLC_SET_SSID                           26
+#define WLC_GET_CHANNEL                                29
+#define WLC_SET_CHANNEL                                30
+#define WLC_GET_MONITOR                                107     /* discovered by nbd */
+#define WLC_SET_MONITOR                                108     /* discovered by nbd */
+#define WLC_GET_AP                             117
+#define WLC_SET_AP                             118
+#define WLC_GET_RSSI                           127
+#define WLC_GET_ASSOCLIST                      159
+
+
+int wl_ioctl(char *name, int cmd, void *buf, int len);
diff --git a/net/wknock/Makefile b/net/wknock/Makefile
new file mode 100644 (file)
index 0000000..96cd269
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006-2009 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:=wknock
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).tar.gz
+PKG_SOURCE_URL:=http://blackhat.com/presentations/bh-europe-05/BH_EU_05-Oudot/
+PKG_MD5SUM:=6b7a1f3cbb0af88da02e5d30cefd8e7f
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wknock
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=kmod-brcm-wl +libpcap
+  TITLE:=A tool to hide your Access Point against opportunistic attackers.
+  URL:=http://www.rstack.org/oudot/wknock/
+endef
+
+define Package/wknock/description
+tool to hide your Access Point against opportunistic attackers.
+endef
+
+define Build/Compile   
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS) -lpcap" \
+               all
+endef
+
+define Package/wknock/install  
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wknock $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wknock-ng $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,wknock))
diff --git a/net/wol/Makefile b/net/wol/Makefile
new file mode 100644 (file)
index 0000000..0aab78e
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2007-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:=wol
+PKG_VERSION:=0.7.1
+PKG_RELEASE:=3
+
+PKG_SOURCE_URL:=@SF/ahh
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=c2fa9d7e771134ac8c89d56b8197d4ca
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wol
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Wake On LAN client
+  URL:=http://ahh.sourceforge.net/wol/
+endef
+
+define Package/wol/description
+ wol implements Wake On LAN functionality in a small program.
+ It wakes up hardware that is Magic Packet compliant.
+endef
+
+CONFIGURE_VARS += \
+       ac_cv_func_malloc_0_nonnull=yes \
+       ac_cv_func_realloc_0_nonnull=yes \
+       ac_cv_func_mmap_fixed_mapped=yes \
+       jm_cv_func_working_malloc=yes \
+       ac_cv_func_alloca_works=yes \
+
+define Package/wol/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+define Package/wol/conffiles
+/etc/config/wol
+endef
+
+$(eval $(call BuildPackage,wol))
diff --git a/net/wol/files/wol.config b/net/wol/files/wol.config
new file mode 100644 (file)
index 0000000..f49c96f
--- /dev/null
@@ -0,0 +1,3 @@
+config wol-target
+       option mac       ''
+       option enabled   '0'
diff --git a/net/wol/files/wol.init b/net/wol/files/wol.init
new file mode 100644 (file)
index 0000000..18be829
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+START=60
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3$_val"
+}
+
+start_service() {
+       local cfg="$1"
+       args=""
+
+       append_string "$cfg" broadcast "--host="
+       append_string "$cfg" port "--port="
+       append_string "$cfg" password "--passwd="
+       append_string "$cfg" mac ""
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ "$enabled" -gt 0 ] && /usr/bin/wol $args
+}
+
+start() {
+       config_load wol
+       config_foreach start_service wol-target
+}
diff --git a/net/wprobe/Makefile b/net/wprobe/Makefile
new file mode 100644 (file)
index 0000000..fe80453
--- /dev/null
@@ -0,0 +1,143 @@
+#
+# Copyright (C) 2008-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=wprobe
+PKG_VERSION:=1
+PKG_RELEASE:=2
+
+PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
+
+PKG_CONFIG_DEPENDS = \
+       CONFIG_PACKAGE_kmod-wprobe \
+       CONFIG_PACKAGE_wprobe-export \
+
+include $(INCLUDE_DIR)/package.mk
+
+# XXX: build failure on cris
+# wprobe-lib.c:145: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
+# wprobe-lib.c:149: error: 'packed' attribute ignored for field of type 'struct <anonymous>'
+
+define Package/wprobe/Default
+  DEPENDS:=@(!(TARGET_ps3||TARGET_pxcab||cris)||BROKEN)
+endef
+
+define KernelPackage/wprobe
+$(call Package/wprobe/Default)
+  SUBMENU:=Network Support
+  TITLE:=Wireless driver probe infrastructure
+  MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+  FILES:= \
+       $(PKG_BUILD_DIR)/kernel/wprobe.ko
+  AUTOLOAD:=$(call AutoLoad,01,wprobe)
+endef
+
+define KernelPackage/wprobe/description
+  A module that exports measurement data from wireless driver to user space
+endef
+
+define Package/wprobe-util
+$(call Package/wprobe/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS+=+kmod-wprobe +libnl-tiny
+  TITLE:=Wireless measurement utility
+endef
+
+define Package/wprobe-util/description
+  wprobe-util uses the wprobe kernel module to query
+  wireless driver measurement data from an interface
+endef
+
+define Package/wprobe-export
+$(call Package/wprobe/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS+=+wprobe-util
+  TITLE:=Wireless measurement data exporter
+endef
+
+define Package/wprobe-export/description
+  wprobe-export uses the wprobe kernel module to export
+  wireless driver measurement data via the IPFIX protocol
+endef
+
+define Package/wprobe-export/conffiles
+/etc/config/wprobe
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) src/* $(PKG_BUILD_DIR)/
+endef
+
+TARGET_CPPFLAGS := \
+       -D_GNU_SOURCE \
+       -I$(STAGING_DIR)/usr/include/libnl-tiny \
+       $(TARGET_CPPFLAGS)
+
+ifdef CONFIG_PACKAGE_kmod-wprobe
+  define Build/Compile/kmod
+       $(MAKE) -C $(LINUX_DIR) \
+               CROSS_COMPILE="$(KERNEL_CROSS)" \
+               ARCH="$(LINUX_KARCH)" \
+               SUBDIRS="$(PKG_BUILD_DIR)/kernel" \
+               KERNELDIR=$(LINUX_DIR) \
+               CC="$(TARGET_CC)" \
+               EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/kernel" \
+               modules
+  endef
+endif
+
+define Build/Compile/lib
+       $(MAKE) -C $(PKG_BUILD_DIR)/user \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               HOST_OS=Linux \
+               LIBNL="-lnl-tiny"
+endef
+
+ifdef CONFIG_PACKAGE_wprobe-export
+  define Build/Compile/exporter
+       $(MAKE) -C $(PKG_BUILD_DIR)/exporter \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PKG_BUILD_DIR)/kernel -I$(PKG_BUILD_DIR)/user" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               LIBS="$(PKG_BUILD_DIR)/user/libwprobe.a $(STAGING_DIR)/usr/lib/libipfix.a $(STAGING_DIR)/usr/lib/libipfixmisc.a -lnl-tiny -lm"
+  endef
+endif
+
+define Build/Compile
+       $(Build/Compile/kmod)
+       $(Build/Compile/lib)
+       $(Build/Compile/exporter)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/wprobe
+       $(CP) $(PKG_BUILD_DIR)/kernel/linux $(1)/usr/include/wprobe
+endef
+
+define Package/wprobe-util/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/user/wprobe-util $(1)/sbin/
+endef
+
+define Package/wprobe-export/install
+       $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d $(1)/etc/config
+       $(INSTALL_BIN) ./files/wprobe.init $(1)/etc/init.d/wprobe
+       $(INSTALL_BIN) ./files/wprobe.config $(1)/etc/config/wprobe
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/exporter/wprobe-export $(1)/sbin/
+endef
+
+$(eval $(call KernelPackage,wprobe))
+$(eval $(call BuildPackage,wprobe-util))
+$(eval $(call BuildPackage,wprobe-export))
diff --git a/net/wprobe/files/wprobe.config b/net/wprobe/files/wprobe.config
new file mode 100644 (file)
index 0000000..63518ef
--- /dev/null
@@ -0,0 +1,10 @@
+config export
+       # uncomment this line to enable ipfix export:
+       # option type ipfix
+       option ifname ath0
+       option host ipfix-col
+       option proto tcp
+
+# enable public wprobe protocol access
+config export
+       option type wprobe
diff --git a/net/wprobe/files/wprobe.init b/net/wprobe/files/wprobe.init
new file mode 100755 (executable)
index 0000000..b35246d
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh /etc/rc.common
+START=90
+EXPORTER=/sbin/wprobe-export
+UTIL=/sbin/wprobe-util
+
+wprobe_ssd() {
+       local cmd="$1"; shift
+       local type="$1"; shift
+       local app="$1"; shift
+       start-stop-daemon "$cmd" -p "/var/run/wprobe-$type.pid" -b ${app:+-x "$app"} -m -- "$@"
+}
+
+stop_wprobe() {
+       local type="$1"
+       [ -f "/var/run/wprobe-$type.pid" ] && wprobe_ssd -K "$type"
+       rm -f "/var/run/wprobe-$type.pid"
+}
+
+config_wprobe() {
+       config_get ifname "$cfg" ifname
+       config_get interval "$cfg" interval
+       [ -n "$interval" ] || interval=100
+       $UTIL "$ifname" -i "$interval" 2>/dev/null >/dev/null
+}
+
+start_proxy() {
+       config_get port "$cfg" port
+       wprobe_ssd -S proxy "$UTIL" -P -p "${port:-17990}"
+}
+
+start_ipfix() {
+       local cfg="$1"
+       config_get ifname "$cfg" ifname
+       config_get host "$cfg" host
+       config_get port "$cfg" port
+       config_get proto "$cfg" proto
+       case "$proto" in
+               sctp) proto="-s";;
+               tcp) proto="-t";;
+               udp) proto="-u";;
+               *) proto="-t";;
+       esac
+       [ -z "$ifname" -o -z "$host" ] && {
+               echo "wprobe-export: missing host or interface name in config $cfg"
+               return
+       }
+       config_wprobe "$cfg"
+       wprobe_ssd -S "export-$cfg" "$EXPORTER" "$proto" -i "$ifname" -c "$host" -p "${port:-4739}"
+}
+
+start_export() {
+       local cfg="$1"
+       config_get export_type "$cfg" type
+       case "$export_type" in 
+               ipfix) [ -x "$EXPORTER" ] && start_ipfix "$cfg";;
+               wprobe) start_proxy "$cfg";;
+       esac
+}
+
+stop() {
+       for f in /var/run/wprobe-*.pid; do
+               CFG="${f%%.pid}"
+               CFG="${CFG##/var/run/wprobe-}"
+               stop_wprobe "$CFG"
+       done
+}
+
+start() {
+       config_load wprobe
+       config_foreach config_wprobe interface
+       config_foreach start_export export
+}
diff --git a/net/wprobe/src/Makefile.inc b/net/wprobe/src/Makefile.inc
new file mode 100644 (file)
index 0000000..5044c0a
--- /dev/null
@@ -0,0 +1,12 @@
+HOST_OS=$(shell uname)
+
+CC=gcc
+AR=ar
+RANLIB=ranlib
+
+WFLAGS = -Wall -Werror -Wno-format
+CFLAGS?=-O2
+CPPFLAGS=
+LDFLAGS=
+LIBS=
+
diff --git a/net/wprobe/src/exporter/Makefile b/net/wprobe/src/exporter/Makefile
new file mode 100644 (file)
index 0000000..9f81507
--- /dev/null
@@ -0,0 +1,5 @@
+include ../Makefile.inc
+CPPFLAGS += -I../kernel -I../user
+
+wprobe-export: wprobe-export.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
diff --git a/net/wprobe/src/exporter/wprobe-export.c b/net/wprobe/src/exporter/wprobe-export.c
new file mode 100644 (file)
index 0000000..a0e52e2
--- /dev/null
@@ -0,0 +1,304 @@
+/*
+**     exporter.c - example exporter
+**
+**     Copyright Fraunhofer FOKUS
+**
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <ipfix_def.h>
+#include <ipfix_def_fokus.h>
+#include <ipfix_fields_fokus.h>
+
+#include <ipfix.h>
+#include <mlog.h>
+#include <wprobe.h>
+#include <stdbool.h>
+
+static ipfix_datarecord_t g_data  = { NULL, NULL, 0 };
+static int do_close = 0;
+
+struct wprobe_mapping {
+       int id;
+       bool counter;
+       const char *wprobe_id;
+       struct wprobe_value *val;
+};
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(_array) (sizeof(_array) / sizeof((_array)[0]))
+#endif
+
+#define WMAP(_id, _name, ...) \
+       { \
+               .counter = false, \
+               .id = IPFIX_FT_WPROBE_##_id##_N, \
+               .wprobe_id = _name \
+               , ## __VA_ARGS__ \
+       }
+
+#define WMAP_COUNTER(_id, _name, ...) \
+       { \
+               .counter = true, \
+               .id = IPFIX_FT_WPROBE_##_id, \
+               .wprobe_id = _name \
+               , ## __VA_ARGS__ \
+       }
+
+
+#define WPROBE_OFFSET  2
+
+static struct wprobe_mapping map_globals[] = {
+       WMAP(NOISE, "noise"),
+       WMAP(PHY_BUSY, "phy_busy"),
+       WMAP(PHY_RX, "phy_rx"),
+       WMAP(PHY_TX, "phy_tx"),
+       WMAP_COUNTER(FRAMES, "frames"),
+       WMAP_COUNTER(PROBEREQ, "probereq"),
+};
+
+static struct wprobe_mapping map_perlink[] = {
+       WMAP(IEEE_TX_RATE, "tx_rate"),
+       WMAP(IEEE_RX_RATE, "rx_rate"),
+       WMAP(RSSI, "rssi"),
+       WMAP(SIGNAL, "signal"),
+       WMAP(RETRANSMIT_200, "retransmit_200"),
+       WMAP(RETRANSMIT_400, "retransmit_400"),
+       WMAP(RETRANSMIT_800, "retransmit_800"),
+       WMAP(RETRANSMIT_1600, "retransmit_1600"),
+};
+
+static unsigned char link_local[6];
+static char link_default[6];
+static int nfields = 0;
+
+#define FOKUS_USERID   12325
+
+static void
+match_template(struct wprobe_mapping *map, int n, struct list_head *list)
+{
+       struct wprobe_attribute *attr;
+       int i, j, last = -1;
+
+       list_for_each_entry(attr, list, list) {
+               for (i = 0; i < n; i++) {
+                       j = (last + 1 + i) % n;
+                       if (!strcmp(attr->name, map[j].wprobe_id))
+                               goto found;
+               }
+               continue;
+found:
+               last = j;
+               map[j].val = &attr->val;
+               memset(&attr->val, 0, sizeof(attr->val));
+               nfields++;
+       }
+}
+
+/* name: export_ipfix_get_template()
+ */
+static ipfix_template_t *
+prepare_template(ipfix_t *handle)
+{
+    ipfix_template_t *t = NULL;
+       int size = 3 * nfields + WPROBE_OFFSET;
+    int i;
+
+    if (ipfix_new_data_template( handle, &t, size) < 0) {
+        mlogf( 0, "ipfix_new_template() failed: %s\n", strerror(errno) ); 
+               exit(1);
+    }
+
+       ipfix_add_field(handle, t, 0, IPFIX_FT_SOURCEMACADDRESS, 6);
+       ipfix_add_field(handle, t, 0, IPFIX_FT_DESTINATIONMACADDRESS, 6);
+
+       g_data.lens = calloc(size, sizeof(g_data.lens[0]));
+       g_data.lens[0] = 6;
+       g_data.lens[1] = 6;
+       for (i = WPROBE_OFFSET; i < size; i++)
+               g_data.lens[i] = 4;
+
+       g_data.addrs = calloc(size, sizeof(g_data.addrs[0]));
+       g_data.addrs[0] = link_local;
+       g_data.maxfields = WPROBE_OFFSET;
+       return t;
+}
+
+static void
+add_template_fields(ipfix_t *handle, ipfix_template_t *t, struct wprobe_mapping *map, int n)
+{
+       int f = g_data.maxfields;
+       int i;
+
+    for (i = 0; i < n; i++) {
+               if (!map[i].val)
+                       continue;
+
+               if (map[i].counter)
+                       g_data.addrs[f++] = &map[i].val->U32;
+               else
+                       g_data.addrs[f++] = &map[i].val->n;
+
+        if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 0, 4) < 0)
+            exit(1);
+
+               if (map[i].counter)
+                       continue;
+
+               g_data.lens[f] = 8;
+               g_data.addrs[f++] = &map[i].val->s;
+
+               g_data.lens[f] = 8;
+               g_data.addrs[f++] = &map[i].val->ss;
+        if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 1, 8) < 0)
+            exit(1);
+        if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 2, 8) < 0)
+            exit(1);
+    }
+       g_data.maxfields = f;
+}
+
+static void
+wprobe_dump_data(ipfix_t *ipfixh, ipfix_template_t *ipfixt, struct wprobe_iface *dev)
+{
+       struct wprobe_link *link;
+
+       wprobe_update_links(dev);
+       wprobe_request_data(dev, NULL);
+       if (list_empty(&dev->links)) {
+               g_data.addrs[1] = link_default;
+               ipfix_export_array(ipfixh, ipfixt, g_data.maxfields, g_data.addrs, g_data.lens);
+               ipfix_export_flush(ipfixh);
+       }
+       list_for_each_entry(link, &dev->links, list) {
+               g_data.addrs[1] = link->addr;
+               wprobe_request_data(dev, link->addr);
+               ipfix_export_array(ipfixh, ipfixt, g_data.maxfields, g_data.addrs, g_data.lens);
+               ipfix_export_flush(ipfixh);
+       }
+}
+
+int main ( int argc, char **argv )
+{
+       struct wprobe_iface *dev = NULL;
+    ipfix_template_t  *ipfixt = NULL;
+    ipfix_t *ipfixh = NULL;
+    int protocol = IPFIX_PROTO_TCP;
+    char *chost = NULL;
+       char *ifname = NULL;
+    int sourceid = 12345;
+    int port = IPFIX_PORTNO;
+    int verbose_level = 0;
+    int opt, i = 10;
+       char *err = NULL;
+
+       while ((opt = getopt(argc, argv, "hi:c:p:vstu")) != EOF) {
+               switch (opt) {
+               case 'p':
+                       if ((port=atoi(optarg)) <0) {
+                               fprintf( stderr, "Invalid -p argument!\n" );
+                               exit(1);
+                       }
+                       break;
+               case 'i':
+                       ifname = optarg;
+                       break;
+               case 'c':
+                       chost = optarg;
+                       break;
+
+               case 's':
+                       protocol = IPFIX_PROTO_SCTP;
+                       break;
+
+               case 't':
+                       protocol = IPFIX_PROTO_TCP;
+                       break;
+
+               case 'u':
+                       protocol = IPFIX_PROTO_UDP;
+                       break;
+
+               case 'v':
+                       verbose_level ++;
+                       break;
+
+               case 'h':
+               default:
+                       fprintf(stderr, "usage: %s [-hstuv] -i <interface> -c <collector> [-p portno]\n"
+                                        "  -h               this help\n"
+                                        "  -i <interface>   wprobe interface\n"
+                                        "  -c <collector>   collector address\n"
+                                        "  -p <portno>      collector port number (default=%d)\n"
+                                        "  -s               send data via SCTP\n"
+                                        "  -t               send data via TCP (default)\n"
+                                        "  -u               send data via UDP\n"
+                                        "  -v               increase verbose level\n\n",
+                                        argv[0], IPFIX_PORTNO  );
+                       exit(1);
+               }
+       }
+
+       if (!ifname) {
+               fprintf(stderr, "No interface specified\n");
+               return -1;
+       }
+
+       if (!chost) {
+               fprintf(stderr, "No collector specified\n");
+               return -1;
+       }
+
+       dev = wprobe_get_auto(ifname, &err);
+       if (!dev || (list_empty(&dev->global_attr) && list_empty(&dev->link_attr))) {
+               fprintf(stderr, "Cannot connect to wprobe on interface '%s': %s\n", ifname, (err ? err : "Unknown error"));
+               return -1;
+       }
+
+       match_template(map_globals, ARRAY_SIZE(map_globals), &dev->global_attr);
+       match_template(map_perlink, ARRAY_SIZE(map_perlink), &dev->link_attr);
+       if (nfields == 0) {
+               fprintf(stderr, "No usable attributes found\n");
+               return -1;
+       }
+
+    mlog_set_vlevel( verbose_level );
+    if (ipfix_init() < 0) {
+        fprintf( stderr, "cannot init ipfix module: %s\n", strerror(errno) );
+        exit(1);
+    }
+
+    ipfix_add_vendor_information_elements(ipfix_ft_fokus);
+    if (ipfix_open(&ipfixh, sourceid, IPFIX_VERSION) < 0) {
+        fprintf( stderr, "ipfix_open() failed: %s\n", strerror(errno) );
+        exit(1);
+    }
+
+    if (ipfix_add_collector( ipfixh, chost, port, protocol ) < 0) {
+        fprintf( stderr, "ipfix_add_collector(%s,%d) failed: %s\n", 
+                 chost, port, strerror(errno));
+        exit(1);
+    }
+
+       fprintf(stderr, "Local link address: %02x:%02x:%02x:%02x:%02x:%02x\n",
+               link_local[0], link_local[1], link_local[2],
+               link_local[3], link_local[4], link_local[5]);
+
+       ipfixt = prepare_template(ipfixh);
+       add_template_fields(ipfixh, ipfixt, map_globals, ARRAY_SIZE(map_globals));
+       add_template_fields(ipfixh, ipfixt, map_perlink, ARRAY_SIZE(map_perlink));
+
+       while (!do_close) {
+               sleep(1);
+               wprobe_dump_data(ipfixh, ipfixt, dev);
+    }
+
+    ipfix_delete_template( ipfixh, ipfixt );
+    ipfix_close( ipfixh );
+    ipfix_cleanup();
+    exit(0);
+}
diff --git a/net/wprobe/src/exporter/wprobe-export.h b/net/wprobe/src/exporter/wprobe-export.h
new file mode 100644 (file)
index 0000000..89da9e8
--- /dev/null
@@ -0,0 +1,34 @@
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+/**
+ * struct wprobe_value: data structure for attribute values
+ * see kernel api netlink attributes for more information
+ */
+struct wprobe_value {
+       /* attribute value */
+       union data {
+               const char *STRING;
+               uint8_t U8;
+               uint16_t U16;
+               uint32_t U32;
+               uint64_t U64;
+               int8_t S8;
+               int16_t S16;
+               int32_t S32;
+               int64_t S64;
+       } data;
+       /* statistics */
+       int64_t s, ss;
+       double avg, stdev;
+       unsigned int n;
+       void *usedata;  /* Pointer to used data.something */
+};
+
+struct exporter_data {
+       int id; /* ipfix id */
+        int userid; /* focus or global */
+       int size; /* size in byte*/
+       struct wprobe_value val;
+};
diff --git a/net/wprobe/src/filter/README.txt b/net/wprobe/src/filter/README.txt
new file mode 100644 (file)
index 0000000..6fa265e
--- /dev/null
@@ -0,0 +1 @@
+To compile pfc you need at least libpcap version 1.0, as it requires proper radiotap header support
diff --git a/net/wprobe/src/filter/gen_filter.pl b/net/wprobe/src/filter/gen_filter.pl
new file mode 100755 (executable)
index 0000000..f03f477
--- /dev/null
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+use strict;
+
+# helpers for custom packet format
+# bytes 0-7 are used by a dummy radiotap header
+my $WLAN_LEN = "radio[8:2]";
+my $SNR = "radio[10:1]";
+my $DEFAULT = undef;
+
+my $MAGIC = "WPFF";
+my $VERSION = 1; # filter binary format version
+my $HDRLEN = 3; # assumed storage space for custom fields
+
+my $output = "filter.bin";
+my $config = {
+       "packetsize" => [
+               [ "small", "$WLAN_LEN < 250" ],
+               [ "medium", "$WLAN_LEN < 800" ],
+               [ "big", $DEFAULT ],
+       ],
+       "snr" => [
+               [ "low", "$SNR < 10" ],
+               [ "medium", "$SNR < 20" ],
+               [ "high", $DEFAULT ],
+       ],
+       "type" => [
+               [ "beacon", "type mgt subtype beacon" ],
+               [ "data", "type data subtype data" ],
+               [ "qosdata", "type data subtype qos-data" ],
+               [ "other", "$DEFAULT" ]
+       ]
+};
+
+sub escape_q($) {
+       my $str = shift;
+       $str =~ s/'/'\\''/g;
+       return $str;
+}
+
+my $GROUPS = scalar(keys %$config);
+open OUTPUT, ">$output" or die "Cannot open output file: $!\n";
+print OUTPUT pack("a4CCn", $MAGIC, $VERSION, $HDRLEN, $GROUPS);
+
+foreach my $groupname (keys %$config) {
+       my $default = 0;
+       my $group = $config->{$groupname};
+       print OUTPUT pack("a32N", $groupname, scalar(@$group));
+       foreach my $filter (@$group) {
+               if (!$filter->[1]) {
+                       $default > 0 and print "Cannot add more than one default filter per group: $groupname -> ".$filter->[0]."\n";
+                       print OUTPUT pack("a32N", $filter->[0], 0);
+                       $default++;
+               } else {
+                       open FILTER, "./pfc '".escape_q($filter->[0])."' '".escape_q($filter->[1])."' |"
+                               or die "Failed to run filter command for '".$filter->[0]."': $!\n";
+                       while (<FILTER>) {
+                               print OUTPUT $_;
+                       }
+                       close FILTER;
+                       $? and die "Filter '".$filter->[0]."' did not compile.\n";
+               }
+       }
+}
diff --git a/net/wprobe/src/filter/pfc.c b/net/wprobe/src/filter/pfc.c
new file mode 100644 (file)
index 0000000..76fb141
--- /dev/null
@@ -0,0 +1,58 @@
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <pcap.h>
+#include <pcap-bpf.h>
+
+struct wprobe_filter_hdr {
+       char name[32];
+       uint32_t len;
+} hdr;
+
+int main (int argc, char ** argv)
+{
+    struct  bpf_program filter;
+    pcap_t  *pc;
+       int i;
+
+    if (argc != 3)
+    {
+               fprintf(stderr, "Usage: %s <name> <expression>\n", argv[0]);
+               return 1;
+    }
+
+    pc = pcap_open_dead(DLT_IEEE802_11_RADIO, 256);
+    if (pcap_compile(pc, &filter, argv[2], 1, 0) != 0)
+       {
+               pcap_perror(pc, argv[0]);
+               exit(1);
+       }
+
+       /* fix up for linux */
+       for (i = 0; i < filter.bf_len; i++) {
+               struct bpf_insn *bi = &filter.bf_insns[i];
+               switch(BPF_CLASS(bi->code)) {
+               case BPF_RET:
+                       if (BPF_MODE(bi->code) == BPF_K) {
+                               if (bi->k != 0)
+                                       bi->k = 65535;
+                       }
+                       break;
+               }
+               bi->code = ntohs(bi->code);
+               bi->k = ntohl(bi->k);
+       }
+
+       memset(&hdr, 0, sizeof(hdr));
+       strncpy(hdr.name, argv[1], sizeof(hdr.name));
+       hdr.len = htonl(filter.bf_len);
+       fwrite(&hdr, sizeof(hdr), 1, stdout);
+       fwrite(filter.bf_insns, 8, filter.bf_len, stdout);
+       fflush(stdout);
+
+    return 0;
+}
diff --git a/net/wprobe/src/kernel/Makefile b/net/wprobe/src/kernel/Makefile
new file mode 100644 (file)
index 0000000..2a98753
--- /dev/null
@@ -0,0 +1,5 @@
+EXTRA_CFLAGS += -I.
+
+obj-m := wprobe.o wprobe-dummy.o
+
+wprobe-objs := wprobe-core.o
diff --git a/net/wprobe/src/kernel/linux/wprobe.h b/net/wprobe/src/kernel/linux/wprobe.h
new file mode 100644 (file)
index 0000000..901daf3
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+ * wprobe.h: API for the wireless probe interface
+ * Copyright (C) 2008-2009 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __WPROBE_H
+#define __WPROBE_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#include <linux/if_ether.h>
+#include <linux/spinlock.h>
+#include <linux/module.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/filter.h>
+#include <net/genetlink.h>
+#endif
+
+/** 
+ * enum wprobe_attr: netlink attribute list
+ *
+ * @WPROBE_ATTR_UNSPEC: unused
+ *
+ * @WPROBE_ATTR_INTERFACE: interface name to process query on (NLA_STRING)
+ * @WPROBE_ATTR_MAC: mac address (used for wireless links) (NLA_STRING)
+ * @WPROBE_ATTR_FLAGS: interface/link/attribute flags (see enum wprobe_flags) (NLA_U32)a
+ * @WPROBE_ATTR_DURATION: sampling duration (in milliseconds) (NLA_MSECS) 
+ *
+ * @WPROBE_ATTR_ID: attribute id (NLA_U32)
+ * @WPROBE_ATTR_NAME: attribute name (NLA_STRING)
+ * @WPROBE_ATTR_TYPE: attribute type (NLA_U8)
+ *
+ * attribute values:
+ *
+ * @WPROBE_VAL_STRING: string value (NLA_STRING)
+ * @WPROBE_VAL_S8: signed 8-bit integer (NLA_U8)
+ * @WPROBE_VAL_S16: signed 16-bit integer (NLA_U16)
+ * @WPROBE_VAL_S32: signed 32-bit integer (NLA_U32)
+ * @WPROBE_VAL_S64: signed 64-bit integer (NLA_U64)
+ * @WPROBE_VAL_U8: unsigned 8-bit integer (NLA_U8)
+ * @WPROBE_VAL_U16: unsigned 16-bit integer (NLA_U16)
+ * @WPROBE_VAL_U32: unsigned 32-bit integer (NLA_U32)
+ * @WPROBE_VAL_U64: unsigned 64-bit integer (NLA_U64)
+ *
+ * statistics:
+ * @WPROBE_VAL_SUM: sum of all samples
+ * @WPROBE_VAL_SUM_SQ: sum of all samples^2
+ * @WPROBE_VAL_SAMPLES: number of samples
+ * @WPROBE_VAL_SCALE_TIME: last time the samples were scaled down
+ *
+ * configuration:
+ * @WPROBE_ATTR_INTERVAL: (measurement interval in milliseconds) (NLA_MSECS)
+ * @WPROBE_ATTR_SAMPLES_MIN: minimum samples to keep during inactivity (NLA_U32)
+ * @WPROBE_ATTR_SAMPLES_MAX: maximum samples to keep before scaling down (NLA_U32)
+ * @WPROBE_ATTR_SAMPLES_SCALE_M: multiplier for scaling down samples (NLA_U32)
+ * @WPROBE_ATTR_SAMPLES_SCALE_D: divisor for scaling down samples (NLA_U32)
+ *
+ * @WPROBE_ATTR_LAST: unused
+ */
+enum wprobe_attr {
+       /* query attributes */
+       WPROBE_ATTR_UNSPEC,
+       WPROBE_ATTR_INTERFACE,
+       WPROBE_ATTR_MAC,
+       WPROBE_ATTR_FLAGS,
+
+       /* response data */
+       WPROBE_ATTR_ID,
+       WPROBE_ATTR_NAME,
+       WPROBE_ATTR_TYPE,
+       WPROBE_ATTR_DURATION,
+
+       /* value type attributes */
+       WPROBE_VAL_STRING,
+       WPROBE_VAL_S8,
+       WPROBE_VAL_S16,
+       WPROBE_VAL_S32,
+       WPROBE_VAL_S64,
+       WPROBE_VAL_U8,
+       WPROBE_VAL_U16,
+       WPROBE_VAL_U32,
+       WPROBE_VAL_U64,
+
+       /* aggregates for statistics */
+       WPROBE_VAL_SUM,
+       WPROBE_VAL_SUM_SQ,
+       WPROBE_VAL_SAMPLES,
+       WPROBE_VAL_SCALE_TIME,
+
+       /* config attributes */
+       WPROBE_ATTR_INTERVAL,
+       WPROBE_ATTR_SAMPLES_MIN,
+       WPROBE_ATTR_SAMPLES_MAX,
+       WPROBE_ATTR_SAMPLES_SCALE_M,
+       WPROBE_ATTR_SAMPLES_SCALE_D,
+       WPROBE_ATTR_FILTER,
+
+       WPROBE_ATTR_FILTER_GROUP,
+       WPROBE_ATTR_RXCOUNT,
+       WPROBE_ATTR_TXCOUNT,
+
+       WPROBE_ATTR_LAST
+};
+
+
+/**
+ * enum wprobe_cmd: netlink commands for interacting with wprobe
+ *
+ * @WPROBE_CMD_UNSPEC: unused
+ *
+ * @WPROBE_CMD_GET_LIST: get global/link property list
+ * @WPROBE_CMD_GET_INFO: get global/link properties
+ * @WPROBE_CMD_SET_FLAGS: set global/link flags
+ * @WPROBE_CMD_MEASURE: take a snapshot of the current data
+ * @WPROBE_CMD_GET_LINKS: get a list of links
+ * @WPROBE_CMD_CONFIG: set config options
+ * @WPROBE_CMD_GET_FILTER: get counters for active filters
+ *
+ * @WPROBE_CMD_LAST: unused
+ * 
+ * options for GET_INFO and SET_FLAGS:
+ *   - mac address set: per-link
+ *   - mac address unset: globalsa
+ */
+enum wprobe_cmd {
+       WPROBE_CMD_UNSPEC,
+       WPROBE_CMD_GET_LIST,
+       WPROBE_CMD_GET_INFO,
+       WPROBE_CMD_SET_FLAGS,
+       WPROBE_CMD_MEASURE,
+       WPROBE_CMD_GET_LINKS,
+       WPROBE_CMD_CONFIG,
+       WPROBE_CMD_GET_FILTER,
+       WPROBE_CMD_LAST
+};
+
+/**
+ * enum wprobe_flags: flags for wprobe links and items
+ * @WPROBE_F_KEEPSTAT: keep statistics for this link/device
+ * @WPROBE_F_RESET: reset statistics now
+ * @WPROBE_F_NEWDATA: used to indicate that a value has been updated
+ */
+enum wprobe_flags {
+       WPROBE_F_KEEPSTAT = (1 << 0),
+       WPROBE_F_RESET = (1 << 1),
+       WPROBE_F_NEWDATA = (1 << 2),
+};
+
+#ifdef __KERNEL__
+
+struct wprobe_link;
+struct wprobe_item;
+struct wprobe_source;
+struct wprobe_value;
+
+/**
+ * struct wprobe_link - data structure describing a wireless link
+ * @iface: pointer to the wprobe_iface that this link belongs to
+ * @addr: BSSID of the remote link partner
+ * @flags: link flags (see wprobe_flags)
+ * @priv: user pointer
+ *
+ * @list: for internal use
+ * @val: for internal use
+ */
+struct wprobe_link {
+       struct list_head list;
+       struct wprobe_iface *iface;
+       char addr[ETH_ALEN];
+       u32 flags;
+       void *priv;
+       struct wprobe_value *val;
+};
+
+/** 
+ * struct wprobe_item - data structure describing the format of wprobe_link::data or wprobe_iface::data
+ * @name: name of the field
+ * @type: data type of this field
+ * @flags: measurement item flags (see wprobe_flags)
+ */
+struct wprobe_item {
+       const char *name;
+       enum wprobe_attr type;
+       u32 flags;
+};
+
+struct wprobe_value {
+       bool pending;
+       union {
+               /*
+                * the following are kept uppercase to allow
+                * for automated checking against WPROBE_VAL_*
+                * via BUG_ON()
+                */
+               const char *STRING;
+               u8 U8;
+               u16 U16;
+               u32 U32;
+               u64 U64;
+               s8 S8;
+               s16 S16;
+               s32 S32;
+               s64 S64;
+       };
+       s64 s, ss;
+       unsigned int n;
+
+       /* timestamps */
+       u64 first, last;
+       u64 scale_timestamp;
+};
+
+struct wprobe_filter_item_hdr {
+       char name[32];
+       __be32 n_items;
+} __attribute__((packed));
+
+struct wprobe_filter_item {
+       struct wprobe_filter_item_hdr hdr;
+       struct sock_filter filter[];
+} __attribute__((packed));
+
+struct wprobe_filter_counter {
+       u64 tx;
+       u64 rx;
+};
+
+struct wprobe_filter_group {
+       const char *name;
+       int n_items;
+       struct wprobe_filter_item **items;
+       struct wprobe_filter_counter *counters;
+};
+
+struct wprobe_filter_hdr {
+       __u8 magic[4];
+       __u8 version;
+       __u8 hdrlen;
+       __u16 n_groups;
+} __attribute__((packed));
+
+struct wprobe_filter {
+       spinlock_t lock;
+       struct sk_buff *skb;
+       void *data;
+       int n_groups;
+       int hdrlen;
+       struct wprobe_filter_item **items;
+       struct wprobe_filter_counter *counters;
+       struct wprobe_filter_group groups[];
+};
+
+enum {
+       WPROBE_PKT_RX = 0x00,
+       WPROBE_PKT_TX = 0x10,
+};
+
+struct wprobe_wlan_hdr {
+       u16 len;
+       u8 snr;
+       u8 type;
+} __attribute__((packed));
+
+
+/**
+ * struct wprobe_source - data structure describing a wireless interface
+ *
+ * @name: name of the interface
+ * @addr: local mac address of the interface
+ * @links: list of wireless links to poll
+ * @link_items: description of the per-link data structure
+ * @n_link_items: number of link description items
+ * @global_items: description of the per-interface data structure
+ * @n_global_items: number of per-interface description items
+ * @sync_data: callback allowing the driver to prepare data for the wprobe poll
+ *
+ * @list: head for the list of interfaces
+ * @priv: user pointer
+ * @lock: spinlock protecting value data access
+ * @val: internal use
+ * @query_val: internal use
+ *
+ * if sync_data is NULL, wprobe assumes that it can access the data structure
+ * at any time (in atomic context). if sync_data returns a negative error code,
+ * the poll request will not be handled for the given link
+ */
+struct wprobe_iface {
+       /* to be filled in by wprobe source drivers */
+       const char *name;
+       const char *addr;
+       const struct wprobe_item *link_items;
+       int n_link_items;
+       const struct wprobe_item *global_items;
+       int n_global_items;
+
+       int (*sync_data)(struct wprobe_iface *dev, struct wprobe_link *l,
+                        struct wprobe_value *val, bool measure);
+       void *priv;
+
+       /* handled by the wprobe core */
+       struct list_head list;
+       struct list_head links;
+       spinlock_t lock;
+       struct wprobe_value *val;
+       struct wprobe_value *query_val;
+       struct wprobe_filter *active_filter;
+
+       u32 measure_interval;
+       struct timer_list measure_timer;
+
+       u32 scale_min;
+       u32 scale_max;
+       u32 scale_m;
+       u32 scale_d;
+};
+
+
+#define WPROBE_FILL_BEGIN(_ptr, _list) do {                    \
+       struct wprobe_value *__val = (_ptr);                    \
+       const struct wprobe_item *__item = _list;               \
+       u64 __msecs = jiffies_to_msecs(jiffies)
+
+#define WPROBE_SET(_idx, _type, _value)                                \
+       if (__item[_idx].type != WPROBE_VAL_##_type) {          \
+               printk("ERROR: invalid data type at %s:%d\n", __FILE__, __LINE__); \
+               break;                                          \
+       }                                                       \
+       __val[_idx].pending = true;                             \
+       __val[_idx]._type = _value;                             \
+       if (!__val[_idx].first)                                 \
+               __val[_idx].first = __msecs;                    \
+       __val[_idx].first = __msecs
+
+#define WPROBE_FILL_END()                                      \
+} while(0)
+
+/**
+ * wprobe_add_iface: register an interface with the wireless probe subsystem
+ * @dev: wprobe_iface structure describing the interface
+ */
+extern int __weak wprobe_add_iface(struct wprobe_iface *dev);
+
+/**
+ * wprobe_remove_iface: deregister an interface from the wireless probe subsystem
+ * @dev: wprobe_iface structure describing the interface
+ */
+extern void __weak wprobe_remove_iface(struct wprobe_iface *dev);
+
+/**
+ * wprobe_add_link: register a new wireless link
+ * @dev: wprobe_iface structure describing the interface
+ * @l: storage space for the wprobe_link structure
+ * @addr: mac address of the new link
+ *
+ * the entire wprobe_link structure is overwritten by this function call
+ */
+extern int __weak wprobe_add_link(struct wprobe_iface *dev, struct wprobe_link *l, const char *addr);
+
+/**
+ * wprobe_remove_link: deregister a previously registered wireless link
+ * @dev: wprobe_iface structure describing the interface
+ * @l: wprobe_link data structure
+ */
+extern void __weak wprobe_remove_link(struct wprobe_iface *dev, struct wprobe_link *l);
+
+/**
+ * wprobe_update_stats: update statistics after sampling values
+ * @dev: wprobe_iface structure describing the interface
+ * @l: wprobe_link data structure
+ *
+ * if l == NULL, then the stats for globals are updated
+ */
+extern void __weak wprobe_update_stats(struct wprobe_iface *dev, struct wprobe_link *l);
+
+/**
+ * wprobe_add_frame: add frame for layer 2 analysis
+ * @dev: wprobe_iface structure describing the interface
+ * @hdr: metadata for the frame
+ * @data: 802.11 header pointer
+ * @len: length of the 802.11 header
+ */
+extern int __weak wprobe_add_frame(struct wprobe_iface *dev, const struct wprobe_wlan_hdr *hdr, void *data, int len);
+
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/net/wprobe/src/kernel/wprobe-core.c b/net/wprobe/src/kernel/wprobe-core.c
new file mode 100644 (file)
index 0000000..27bc366
--- /dev/null
@@ -0,0 +1,1196 @@
+/*
+ * wprobe-core.c: Wireless probe interface core
+ * Copyright (C) 2008-2009 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/spinlock.h>
+#include <linux/rcupdate.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+#include <linux/rculist.h>
+#else
+#include <linux/list.h>
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+#include <linux/prefetch.h>
+#endif
+#include <linux/skbuff.h>
+#include <linux/wprobe.h>
+#include <linux/math64.h>
+
+#define static
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+#define list_for_each_rcu(pos, head) \
+for (pos = rcu_dereference((head)->next); \
+prefetch(pos->next), pos != (head); \
+pos = rcu_dereference(pos->next))
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+#define SKB_PORTID(x) NETLINK_CB(x).portid
+#else
+#define SKB_PORTID(x) NETLINK_CB(x).pid
+#endif
+
+#define WPROBE_MIN_INTERVAL            100 /* minimum measurement interval in msecs */
+#define WPROBE_MAX_FILTER_SIZE 1024
+#define WPROBE_MAX_FRAME_SIZE  1900
+
+static struct list_head wprobe_if;
+static spinlock_t wprobe_lock;
+
+static struct genl_family wprobe_fam = {
+       .id = GENL_ID_GENERATE,
+       .name = "wprobe",
+       .hdrsize = 0,
+       .version = 1,
+       /* only the first set of attributes is used for queries */
+       .maxattr = WPROBE_ATTR_LAST,
+};
+
+/* fake radiotap header */
+struct wprobe_rtap_hdr {
+       __u8 version;
+       __u8 padding;
+       __le16 len;
+       __le32 present;
+};
+
+static void wprobe_update_stats(struct wprobe_iface *dev, struct wprobe_link *l);
+static int wprobe_sync_data(struct wprobe_iface *dev, struct wprobe_link *l, bool query);
+static void wprobe_free_filter(struct wprobe_filter *f);
+
+int
+wprobe_add_link(struct wprobe_iface *s, struct wprobe_link *l, const char *addr)
+{
+       unsigned long flags;
+
+       INIT_LIST_HEAD(&l->list);
+       l->val = kzalloc(sizeof(struct wprobe_value) * s->n_link_items, GFP_ATOMIC);
+       if (!l->val)
+               return -ENOMEM;
+
+       l->iface = s;
+       memcpy(&l->addr, addr, ETH_ALEN);
+       spin_lock_irqsave(&wprobe_lock, flags);
+       list_add_tail_rcu(&l->list, &s->links);
+       spin_unlock_irqrestore(&wprobe_lock, flags);
+
+       return 0;
+}
+EXPORT_SYMBOL(wprobe_add_link);
+
+void
+wprobe_remove_link(struct wprobe_iface *s, struct wprobe_link *l)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&wprobe_lock, flags);
+       list_del_rcu(&l->list);
+       spin_unlock_irqrestore(&wprobe_lock, flags);
+       synchronize_rcu();
+       kfree(l->val);
+}
+EXPORT_SYMBOL(wprobe_remove_link);
+
+static void
+wprobe_measure_timer(unsigned long data)
+{
+       struct wprobe_iface *dev = (struct wprobe_iface *) data;
+
+       /* set next measurement interval */
+       mod_timer(&dev->measure_timer, jiffies +
+               msecs_to_jiffies(dev->measure_interval));
+
+       /* perform measurement */
+       wprobe_sync_data(dev, NULL, false);
+}
+
+int
+wprobe_add_iface(struct wprobe_iface *s)
+{
+       unsigned long flags;
+       int vsize;
+
+       /* reset only wprobe private area */
+       memset(&s->list, 0, sizeof(struct wprobe_iface) - offsetof(struct wprobe_iface, list));
+
+       BUG_ON(!s->name);
+       INIT_LIST_HEAD(&s->list);
+       INIT_LIST_HEAD(&s->links);
+       setup_timer(&s->measure_timer, wprobe_measure_timer, (unsigned long) s);
+
+       s->val = kzalloc(sizeof(struct wprobe_value) * s->n_global_items, GFP_ATOMIC);
+       if (!s->val)
+               goto error;
+
+       vsize = max(s->n_link_items, s->n_global_items);
+       s->query_val = kzalloc(sizeof(struct wprobe_value) * vsize, GFP_ATOMIC);
+       if (!s->query_val)
+               goto error;
+
+       /* initialize defaults to be able to handle overflow,
+        * user space will need to handle this if it keeps an
+        * internal histogram */
+       s->scale_min = 20;
+       s->scale_max = (1 << 31);
+
+       s->scale_m = 1;
+       s->scale_d = 10;
+
+       spin_lock_irqsave(&wprobe_lock, flags);
+       list_add_rcu(&s->list, &wprobe_if);
+       spin_unlock_irqrestore(&wprobe_lock, flags);
+
+       return 0;
+
+error:
+       if (s->val)
+               kfree(s->val);
+       return -ENOMEM;
+}
+EXPORT_SYMBOL(wprobe_add_iface);
+
+void
+wprobe_remove_iface(struct wprobe_iface *s)
+{
+       unsigned long flags;
+
+       BUG_ON(!list_empty(&s->links));
+
+       del_timer_sync(&s->measure_timer);
+       spin_lock_irqsave(&wprobe_lock, flags);
+       list_del_rcu(&s->list);
+       spin_unlock_irqrestore(&wprobe_lock, flags);
+
+       /* wait for all queries to finish before freeing the
+        * temporary value storage buffer */
+       synchronize_rcu();
+
+       kfree(s->val);
+       kfree(s->query_val);
+       if (s->active_filter)
+               wprobe_free_filter(s->active_filter);
+}
+EXPORT_SYMBOL(wprobe_remove_iface);
+
+static struct wprobe_iface *
+wprobe_get_dev(struct nlattr *attr)
+{
+       struct wprobe_iface *dev = NULL;
+       struct wprobe_iface *p;
+       const char *name;
+       int i = 0;
+
+       if (!attr)
+               return NULL;
+
+       name = nla_data(attr);
+       list_for_each_entry_rcu(p, &wprobe_if, list) {
+               i++;
+               if (strcmp(name, p->name) != 0)
+                       continue;
+
+               dev = p;
+               break;
+       }
+
+       return dev;
+}
+
+int
+wprobe_add_frame(struct wprobe_iface *dev, const struct wprobe_wlan_hdr *hdr, void *data, int len)
+{
+       struct wprobe_wlan_hdr *new_hdr;
+       struct wprobe_filter *f;
+       struct sk_buff *skb;
+       unsigned long flags;
+       int i, j;
+
+       rcu_read_lock();
+       f = rcu_dereference(dev->active_filter);
+       if (!f)
+               goto out;
+
+       spin_lock_irqsave(&f->lock, flags);
+
+       skb = f->skb;
+       skb->len = sizeof(struct wprobe_rtap_hdr);
+       skb->tail = skb->data + skb->len;
+       if (len + skb->len > WPROBE_MAX_FRAME_SIZE)
+               len = WPROBE_MAX_FRAME_SIZE - skb->len;
+
+       new_hdr = (struct wprobe_wlan_hdr *) skb_put(skb, f->hdrlen);
+       memcpy(new_hdr, hdr, sizeof(struct wprobe_wlan_hdr));
+       new_hdr->len = cpu_to_be16(new_hdr->len);
+
+       memcpy(skb_put(skb, len), data, len);
+
+       for(i = 0; i < f->n_groups; i++) {
+               struct wprobe_filter_group *fg = &f->groups[i];
+               bool found = false;
+               int def = -1;
+
+               for (j = 0; j < fg->n_items; j++) {
+                       struct wprobe_filter_item *fi = fg->items[j];
+
+                       if (!fi->hdr.n_items) {
+                               def = j;
+                               continue;
+                       }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+                       if (sk_run_filter(skb, fi->filter) == 0)
+                               continue;
+#else
+                       if (sk_run_filter(skb, fi->filter, fi->hdr.n_items) == 0)
+                               continue;
+#endif
+
+                       found = true;
+                       break;
+               }
+               if (!found && def >= 0) {
+                       j = def;
+                       found = true;
+               }
+               if (found) {
+                       struct wprobe_filter_counter *c = &fg->counters[j];
+
+                       if (hdr->type >= WPROBE_PKT_TX)
+                               c->tx++;
+                       else
+                               c->rx++;
+               }
+       }
+
+       spin_unlock_irqrestore(&f->lock, flags);
+out:
+       rcu_read_unlock();
+       return 0;
+}
+EXPORT_SYMBOL(wprobe_add_frame);
+
+static int
+wprobe_sync_data(struct wprobe_iface *dev, struct wprobe_link *l, bool query)
+{
+       struct wprobe_value *val;
+       unsigned long flags;
+       int n, err;
+
+       if (l) {
+               n = dev->n_link_items;
+               val = l->val;
+       } else {
+               n = dev->n_global_items;
+               val = dev->val;
+       }
+
+       spin_lock_irqsave(&dev->lock, flags);
+       err = dev->sync_data(dev, l, val, !query);
+       if (err)
+               goto done;
+
+       if (query)
+               memcpy(dev->query_val, val, sizeof(struct wprobe_value) * n);
+
+       wprobe_update_stats(dev, l);
+done:
+       spin_unlock_irqrestore(&dev->lock, flags);
+       return 0;
+}
+EXPORT_SYMBOL(wprobe_sync_data);
+
+static void
+wprobe_scale_stats(struct wprobe_iface *dev, const struct wprobe_item *item,
+                   struct wprobe_value *val, int n)
+{
+       u64 scale_ts = jiffies_64;
+       int i;
+
+       for (i = 0; i < n; i++) {
+               if (!(item[i].flags & WPROBE_F_KEEPSTAT))
+                       continue;
+
+               if (val[i].n <= dev->scale_min)
+                       continue;
+
+               /* FIXME: div_s64 seems to be very imprecise here, even when
+                * the values are scaled up */
+               val[i].s *= dev->scale_m;
+               val[i].s = div_s64(val[i].s, dev->scale_d);
+
+               val[i].ss *= dev->scale_m;
+               val[i].ss = div_s64(val[i].ss, dev->scale_d);
+
+               val[i].n = (val[i].n * dev->scale_m) / dev->scale_d;
+               val[i].scale_timestamp = scale_ts;
+       }
+}
+
+
+void
+wprobe_update_stats(struct wprobe_iface *dev, struct wprobe_link *l)
+{
+       const struct wprobe_item *item;
+       struct wprobe_value *val;
+       bool scale_stats = false;
+       int i, n;
+
+       if (l) {
+               n = dev->n_link_items;
+               item = dev->link_items;
+               val = l->val;
+       } else {
+               n = dev->n_global_items;
+               item = dev->global_items;
+               val = dev->val;
+       }
+
+       /* process statistics */
+       for (i = 0; i < n; i++) {
+               s64 v;
+
+               if (!val[i].pending)
+                       continue;
+
+               val[i].n++;
+               if ((item[i].flags & WPROBE_F_KEEPSTAT) &&
+                       (dev->scale_max > 0) && (val[i].n > dev->scale_max)) {
+                       scale_stats = true;
+               }
+
+               switch(item[i].type) {
+               case WPROBE_VAL_S8:
+                       v = val[i].S8;
+                       break;
+               case WPROBE_VAL_S16:
+                       v = val[i].S16;
+                       break;
+               case WPROBE_VAL_S32:
+                       v = val[i].S32;
+                       break;
+               case WPROBE_VAL_S64:
+                       v = val[i].S64;
+                       break;
+               case WPROBE_VAL_U8:
+                       v = val[i].U8;
+                       break;
+               case WPROBE_VAL_U16:
+                       v = val[i].U16;
+                       break;
+               case WPROBE_VAL_U32:
+                       v = val[i].U32;
+                       break;
+               case WPROBE_VAL_U64:
+                       v = val[i].U64;
+                       break;
+               default:
+                       continue;
+               }
+
+               val[i].s += v;
+               val[i].ss += v * v;
+               val[i].pending = false;
+       }
+       if (scale_stats)
+               wprobe_scale_stats(dev, item, val, n);
+}
+EXPORT_SYMBOL(wprobe_update_stats);
+
+static const struct nla_policy wprobe_policy[WPROBE_ATTR_LAST+1] = {
+       [WPROBE_ATTR_INTERFACE] = { .type = NLA_NUL_STRING },
+       [WPROBE_ATTR_MAC] = { .type = NLA_STRING },
+       [WPROBE_ATTR_FLAGS] = { .type = NLA_U32 },
+
+       /* config */
+       [WPROBE_ATTR_INTERVAL] = { .type = NLA_MSECS },
+       [WPROBE_ATTR_SAMPLES_MIN] = { .type = NLA_U32 },
+       [WPROBE_ATTR_SAMPLES_MAX] = { .type = NLA_U32 },
+       [WPROBE_ATTR_SAMPLES_SCALE_M] = { .type = NLA_U32 },
+       [WPROBE_ATTR_SAMPLES_SCALE_D] = { .type = NLA_U32 },
+       [WPROBE_ATTR_FILTER] = { .type = NLA_BINARY, .len = 32768 },
+};
+
+static bool
+wprobe_check_ptr(struct list_head *list, struct list_head *ptr)
+{
+       struct list_head *p;
+
+       list_for_each_rcu(p, list) {
+               if (ptr == p)
+                       return true;
+       }
+       return false;
+}
+
+static bool
+wprobe_send_item_value(struct sk_buff *msg, struct netlink_callback *cb,
+                       struct wprobe_iface *dev, struct wprobe_link *l,
+                       const struct wprobe_item *item,
+                       int i, u32 flags)
+{
+       struct genlmsghdr *hdr;
+       struct wprobe_value *val = dev->query_val;
+       u64 time = val[i].last - val[i].first;
+
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
+                       &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_INFO);
+
+       if (nla_put_u32(msg, WPROBE_ATTR_ID, i))
+               goto nla_put_failure;
+       if (nla_put_u32(msg, WPROBE_ATTR_FLAGS, flags))
+               goto nla_put_failure;
+       if (nla_put_u8(msg, WPROBE_ATTR_TYPE, item[i].type))
+               goto nla_put_failure;
+       if (nla_put_u64(msg, WPROBE_ATTR_DURATION, time))
+               goto nla_put_failure;
+
+       switch(item[i].type) {
+       case WPROBE_VAL_S8:
+       case WPROBE_VAL_U8:
+               if (nla_put_u8(msg, item[i].type, val[i].U8))
+                       goto nla_put_failure;
+               break;
+       case WPROBE_VAL_S16:
+       case WPROBE_VAL_U16:
+               if (nla_put_u16(msg, item[i].type, val[i].U16))
+                       goto nla_put_failure;
+               break;
+       case WPROBE_VAL_S32:
+       case WPROBE_VAL_U32:
+               if (nla_put_u32(msg, item[i].type, val[i].U32))
+                       goto nla_put_failure;
+               break;
+       case WPROBE_VAL_S64:
+       case WPROBE_VAL_U64:
+               if (nla_put_u64(msg, item[i].type, val[i].U64))
+                       goto nla_put_failure;
+               break;
+       case WPROBE_VAL_STRING:
+               if (val[i].STRING) {
+                       if (nla_put_string(msg, item[i].type, val[i].STRING))
+                               goto nla_put_failure;
+               } else {
+                       if (nla_put_string(msg, item[i].type, ""))
+                               goto nla_put_failure;
+               }
+               /* bypass avg/stdev */
+               goto done;
+       default:
+               /* skip unknown values */
+               goto done;
+       }
+       if (item[i].flags & WPROBE_F_KEEPSTAT) {
+               if (nla_put_u64(msg, WPROBE_VAL_SUM, val[i].s))
+                       goto nla_put_failure;
+               if (nla_put_u64(msg, WPROBE_VAL_SUM_SQ, val[i].ss))
+                       goto nla_put_failure;
+               if (nla_put_u32(msg, WPROBE_VAL_SAMPLES, (u32) val[i].n))
+                       goto nla_put_failure;
+               if (nla_put_msecs(msg, WPROBE_VAL_SCALE_TIME, val[i].scale_timestamp))
+                       goto nla_put_failure;
+       }
+done:
+       genlmsg_end(msg, hdr);
+       return true;
+
+nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       return false;
+}
+
+static bool
+wprobe_send_item_info(struct sk_buff *msg, struct netlink_callback *cb,
+                       struct wprobe_iface *dev,
+                       const struct wprobe_item *item, int i)
+{
+       struct genlmsghdr *hdr;
+
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
+                       &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LIST);
+
+       if ((i == 0) && (dev->addr != NULL)) {
+               if (nla_put(msg, WPROBE_ATTR_MAC, 6, dev->addr))
+                       goto nla_put_failure;
+       }
+       if (nla_put_u32(msg, WPROBE_ATTR_ID, (u32) i))
+               goto nla_put_failure;
+       if (nla_put_string(msg, WPROBE_ATTR_NAME, item[i].name))
+               goto nla_put_failure;
+       if (nla_put_u8(msg, WPROBE_ATTR_TYPE, item[i].type))
+               goto nla_put_failure;
+       if (nla_put_u32(msg, WPROBE_ATTR_FLAGS, item[i].flags))
+               goto nla_put_failure;
+       genlmsg_end(msg, hdr);
+       return true;
+
+nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       return false;
+}
+
+
+static struct wprobe_link *
+wprobe_find_link(struct wprobe_iface *dev, const char *mac)
+{
+       struct wprobe_link *l;
+
+       list_for_each_entry_rcu(l, &dev->links, list) {
+               if (!memcmp(l->addr, mac, 6))
+                       return l;
+       }
+       return NULL;
+}
+
+static bool
+wprobe_dump_filter_group(struct sk_buff *msg, struct wprobe_filter_group *fg, struct netlink_callback *cb)
+{
+       struct genlmsghdr *hdr;
+       struct nlattr *group, *item;
+       int i;
+
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
+                       &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_FILTER);
+       if (!hdr)
+               return false;
+
+       if (nla_put_string(msg, WPROBE_ATTR_NAME, fg->name))
+               goto nla_put_failure;
+       group = nla_nest_start(msg, WPROBE_ATTR_FILTER_GROUP);
+       for (i = 0; i < fg->n_items; i++) {
+               struct wprobe_filter_item *fi = fg->items[i];
+               struct wprobe_filter_counter *fc = &fg->counters[i];
+
+               item = nla_nest_start(msg, WPROBE_ATTR_FILTER_GROUP);
+               if (nla_put_string(msg, WPROBE_ATTR_NAME, fi->hdr.name))
+                       goto nla_put_failure;
+               if (nla_put_u64(msg, WPROBE_ATTR_RXCOUNT, fc->rx))
+                       goto nla_put_failure;
+               if (nla_put_u64(msg, WPROBE_ATTR_TXCOUNT, fc->tx))
+                       goto nla_put_failure;
+               nla_nest_end(msg, item);
+       }
+
+       nla_nest_end(msg, group);
+       genlmsg_end(msg, hdr);
+       return true;
+
+nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       return false;
+}
+
+static int
+wprobe_dump_filters(struct sk_buff *skb, struct netlink_callback *cb)
+{
+       struct wprobe_iface *dev = (struct wprobe_iface *)cb->args[0];
+       struct wprobe_filter *f;
+       int err = 0;
+       int i = 0;
+
+       if (!dev) {
+               err = nlmsg_parse(cb->nlh, GENL_HDRLEN + wprobe_fam.hdrsize,
+                               wprobe_fam.attrbuf, wprobe_fam.maxattr, wprobe_policy);
+               if (err)
+                       goto done;
+
+               dev = wprobe_get_dev(wprobe_fam.attrbuf[WPROBE_ATTR_INTERFACE]);
+               if (!dev) {
+                       err = -ENODEV;
+                       goto done;
+               }
+
+               cb->args[0] = (long) dev;
+               cb->args[1] = 0;
+       } else {
+               if (!wprobe_check_ptr(&wprobe_if, &dev->list)) {
+                       err = -ENODEV;
+                       goto done;
+               }
+       }
+
+       rcu_read_lock();
+       f = rcu_dereference(dev->active_filter);
+       if (!f)
+               goto abort;
+
+       for (i = cb->args[1]; i < f->n_groups; i++) {
+               if (unlikely(!wprobe_dump_filter_group(skb, &f->groups[i], cb)))
+                       break;
+       }
+       cb->args[1] = i;
+abort:
+       rcu_read_unlock();
+       err = skb->len;
+done:
+       return err;
+}
+
+static bool
+wprobe_dump_link(struct sk_buff *msg, struct wprobe_link *l, struct netlink_callback *cb)
+{
+       struct genlmsghdr *hdr;
+
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
+                       &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LINKS);
+       if (!hdr)
+               return false;
+
+       if (nla_put(msg, WPROBE_ATTR_MAC, 6, l->addr))
+               goto nla_put_failure;
+       genlmsg_end(msg, hdr);
+       return true;
+
+nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       return false;
+}
+
+static int
+wprobe_dump_links(struct sk_buff *skb, struct netlink_callback *cb)
+{
+       struct wprobe_iface *dev = (struct wprobe_iface *)cb->args[0];
+       struct wprobe_link *l;
+       int err = 0;
+       int i = 0;
+
+       if (!dev) {
+               err = nlmsg_parse(cb->nlh, GENL_HDRLEN + wprobe_fam.hdrsize,
+                               wprobe_fam.attrbuf, wprobe_fam.maxattr, wprobe_policy);
+               if (err)
+                       goto done;
+
+               dev = wprobe_get_dev(wprobe_fam.attrbuf[WPROBE_ATTR_INTERFACE]);
+               if (!dev) {
+                       err = -ENODEV;
+                       goto done;
+               }
+
+               cb->args[0] = (long) dev;
+       } else {
+               if (!wprobe_check_ptr(&wprobe_if, &dev->list)) {
+                       err = -ENODEV;
+                       goto done;
+               }
+       }
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(l, &dev->links, list) {
+               if (i < cb->args[1])
+                       continue;
+
+               if (unlikely(!wprobe_dump_link(skb, l, cb)))
+                       break;
+
+               i++;
+       }
+       cb->args[1] = i;
+       rcu_read_unlock();
+       err = skb->len;
+done:
+       return err;
+}
+
+#define WPROBE_F_LINK (1 << 31) /* for internal use */
+static int
+wprobe_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
+{
+       struct wprobe_iface *dev = (struct wprobe_iface *)cb->args[0];
+       struct wprobe_link *l = (struct wprobe_link *)cb->args[1];
+       struct wprobe_value *val;
+       const struct wprobe_item *item;
+       struct genlmsghdr *hdr;
+       unsigned long flags;
+       int cmd, n, i = cb->args[3];
+       u32     vflags = cb->args[2];
+       int err = 0;
+
+       hdr = (struct genlmsghdr *)nlmsg_data(cb->nlh);
+       cmd = hdr->cmd;
+
+       /* since the attribute value list might be too big for a single netlink
+        * message, the device, link and offset get stored in the netlink callback.
+        * if this is the first request, we need to do the full lookup for the device.
+        *
+        * access to the device and link structure is synchronized through rcu.
+        */
+       rcu_read_lock();
+       if (!dev) {
+               err = nlmsg_parse(cb->nlh, GENL_HDRLEN + wprobe_fam.hdrsize,
+                               wprobe_fam.attrbuf, wprobe_fam.maxattr, wprobe_policy);
+               if (err)
+                       goto done;
+
+               err = -ENOENT;
+               dev = wprobe_get_dev(wprobe_fam.attrbuf[WPROBE_ATTR_INTERFACE]);
+               if (!dev)
+                       goto done;
+
+               if (cmd == WPROBE_CMD_GET_INFO) {
+                       if (wprobe_fam.attrbuf[WPROBE_ATTR_MAC]) {
+                               l = wprobe_find_link(dev, nla_data(wprobe_fam.attrbuf[WPROBE_ATTR_MAC]));
+                               if (!l)
+                                       goto done;
+
+                               vflags = l->flags;
+                       }
+
+                       if (l) {
+                               item = dev->link_items;
+                               n = dev->n_link_items;
+                               val = l->val;
+                       } else {
+                               item = dev->global_items;
+                               n = dev->n_global_items;
+                               val = dev->val;
+                       }
+
+                       /* sync data and move to temp storage for the query */
+                       spin_lock_irqsave(&dev->lock, flags);
+                       err = wprobe_sync_data(dev, l, true);
+                       if (!err)
+                               memcpy(dev->query_val, val, n * sizeof(struct wprobe_value));
+                       spin_unlock_irqrestore(&dev->lock, flags);
+
+                       if (err)
+                               goto done;
+               }
+
+               if (wprobe_fam.attrbuf[WPROBE_ATTR_FLAGS])
+                       vflags |= nla_get_u32(wprobe_fam.attrbuf[WPROBE_ATTR_FLAGS]);
+
+               if (wprobe_fam.attrbuf[WPROBE_ATTR_MAC])
+                       vflags |= WPROBE_F_LINK;
+
+               cb->args[0] = (long) dev;
+               cb->args[1] = (long) l;
+               cb->args[2] = vflags;
+               cb->args[3] = 0;
+       } else {
+               /* when pulling pointers from the callback, validate them
+                * against the list using rcu to make sure that we won't
+                * dereference pointers to free'd memory after the last
+                * grace period */
+               err = -ENOENT;
+               if (!wprobe_check_ptr(&wprobe_if, &dev->list))
+                       goto done;
+
+               if (l && !wprobe_check_ptr(&dev->links, &l->list))
+                       goto done;
+       }
+
+       if (vflags & WPROBE_F_LINK) {
+               item = dev->link_items;
+               n = dev->n_link_items;
+       } else {
+               item = dev->global_items;
+               n = dev->n_global_items;
+       }
+
+       err = 0;
+       switch(cmd) {
+       case WPROBE_CMD_GET_INFO:
+               while (i < n) {
+                       if (!wprobe_send_item_value(skb, cb, dev, l, item, i, vflags))
+                               break;
+                       i++;
+               }
+               break;
+       case WPROBE_CMD_GET_LIST:
+               while (i < n) {
+                       if (!wprobe_send_item_info(skb, cb, dev, item, i))
+                               break;
+                       i++;
+               }
+               break;
+       default:
+               err = -EINVAL;
+               goto done;
+       }
+       cb->args[3] = i;
+       err = skb->len;
+
+done:
+       rcu_read_unlock();
+       return err;
+}
+#undef WPROBE_F_LINK
+
+static int
+wprobe_update_auto_measurement(struct wprobe_iface *dev, u32 interval)
+{
+       if (interval && (interval < WPROBE_MIN_INTERVAL))
+               return -EINVAL;
+
+       if (!interval && dev->measure_interval)
+               del_timer_sync(&dev->measure_timer);
+
+       dev->measure_interval = interval;
+       if (!interval)
+               return 0;
+
+       /* kick of a new measurement immediately */
+       mod_timer(&dev->measure_timer, jiffies + 1);
+
+       return 0;
+}
+
+static int
+wprobe_measure(struct sk_buff *skb, struct genl_info *info)
+{
+       struct wprobe_iface *dev;
+       struct wprobe_link *l = NULL;
+       int err = -ENOENT;
+
+       rcu_read_lock();
+       dev = wprobe_get_dev(info->attrs[WPROBE_ATTR_INTERFACE]);
+       if (!dev)
+               goto done;
+
+       if (info->attrs[WPROBE_ATTR_MAC]) {
+               l = wprobe_find_link(dev, nla_data(wprobe_fam.attrbuf[WPROBE_ATTR_MAC]));
+               if (!l)
+                       goto done;
+       }
+
+       err = wprobe_sync_data(dev, l, false);
+
+done:
+       rcu_read_unlock();
+       return err;
+}
+
+static int
+wprobe_check_filter(void *data, int datalen, int gs)
+{
+       struct wprobe_filter_item_hdr *hdr;
+       void *orig_data = data;
+       void *end = data + datalen;
+       int i, j, k, is, cur_is;
+
+       for (i = j = is = 0; i < gs; i++) {
+               hdr = data;
+               data += sizeof(*hdr);
+
+               if (data > end)
+                       goto overrun;
+
+               hdr->name[31] = 0;
+               cur_is = be32_to_cpu(hdr->n_items);
+               hdr->n_items = cur_is;
+               is += cur_is;
+               for (j = 0; j < cur_is; j++) {
+                       struct sock_filter *sf;
+                       int n_items;
+
+                       hdr = data;
+                       data += sizeof(*hdr);
+                       if (data > end)
+                               goto overrun;
+
+                       hdr->name[31] = 0;
+                       n_items = be32_to_cpu(hdr->n_items);
+                       hdr->n_items = n_items;
+
+                       if (n_items > 1024)
+                               goto overrun;
+
+                       sf = data;
+                       if (n_items > 0) {
+                               for (k = 0; k < n_items; k++) {
+                                       sf->code = be16_to_cpu(sf->code);
+                                       sf->k = be32_to_cpu(sf->k);
+                                       sf++;
+                               }
+                               if (sk_chk_filter(data, n_items) != 0) {
+                                       printk("%s: filter check failed at group %d, item %d\n", __func__, i, j);
+                                       return 0;
+                               }
+                       }
+                       data += n_items * sizeof(struct sock_filter);
+               }
+       }
+       return is;
+
+overrun:
+       printk(KERN_ERR "%s: overrun during filter check at group %d, item %d, offset=%d, len=%d\n", __func__, i, j, (data - orig_data), datalen);
+       return 0;
+}
+
+static void
+wprobe_free_filter(struct wprobe_filter *f)
+{
+       if (f->skb)
+               kfree_skb(f->skb);
+       if (f->data)
+               kfree(f->data);
+       if (f->items)
+               kfree(f->items);
+       if (f->counters)
+               kfree(f->counters);
+       kfree(f);
+}
+
+
+static int
+wprobe_set_filter(struct wprobe_iface *dev, void *data, int len)
+{
+       struct wprobe_filter_hdr *fhdr;
+       struct wprobe_rtap_hdr *rtap;
+       struct wprobe_filter *f;
+       int i, j, cur_is, is, gs;
+
+       if (len < sizeof(*fhdr))
+               return -EINVAL;
+
+       fhdr = data;
+       data += sizeof(*fhdr);
+       len -= sizeof(*fhdr);
+
+       if (memcmp(fhdr->magic, "WPFF", 4) != 0) {
+               printk(KERN_ERR "%s: filter rejected (invalid magic)\n", __func__);
+               return -EINVAL;
+       }
+
+       gs = be16_to_cpu(fhdr->n_groups);
+       is = wprobe_check_filter(data, len, gs);
+       if (is == 0)
+               return -EINVAL;
+
+       f = kzalloc(sizeof(struct wprobe_filter) +
+               gs * sizeof(struct wprobe_filter_group), GFP_ATOMIC);
+       if (!f)
+               return -ENOMEM;
+
+       f->skb = alloc_skb(WPROBE_MAX_FRAME_SIZE, GFP_ATOMIC);
+       if (!f->skb)
+               goto error;
+
+       f->data = kmalloc(len, GFP_ATOMIC);
+       if (!f->data)
+               goto error;
+
+       f->items = kzalloc(sizeof(struct wprobe_filter_item *) * is, GFP_ATOMIC);
+       if (!f->items)
+               goto error;
+
+       f->counters = kzalloc(sizeof(struct wprobe_filter_counter) * is, GFP_ATOMIC);
+       if (!f->counters)
+               goto error;
+
+       spin_lock_init(&f->lock);
+       memcpy(f->data, data, len);
+       f->n_groups = gs;
+
+       if (f->hdrlen < sizeof(struct wprobe_wlan_hdr))
+               f->hdrlen = sizeof(struct wprobe_wlan_hdr);
+
+       rtap = (struct wprobe_rtap_hdr *)skb_put(f->skb, sizeof(*rtap));
+       memset(rtap, 0, sizeof(*rtap));
+       rtap->len = cpu_to_le16(sizeof(struct wprobe_rtap_hdr) + f->hdrlen);
+       data = f->data;
+
+       cur_is = 0;
+       for (i = 0; i < gs; i++) {
+               struct wprobe_filter_item_hdr *hdr = data;
+               struct wprobe_filter_group *g = &f->groups[i];
+
+               data += sizeof(*hdr);
+               g->name = hdr->name;
+               g->items = &f->items[cur_is];
+               g->counters = &f->counters[cur_is];
+               g->n_items = hdr->n_items;
+
+               for (j = 0; j < g->n_items; j++) {
+                       hdr = data;
+                       f->items[cur_is++] = data;
+                       data += sizeof(*hdr) + hdr->n_items * sizeof(struct sock_filter);
+               }
+       }
+       rcu_assign_pointer(dev->active_filter, f);
+       return 0;
+
+error:
+       wprobe_free_filter(f);
+       return -ENOMEM;
+}
+
+static int
+wprobe_set_config(struct sk_buff *skb, struct genl_info *info)
+{
+       struct wprobe_iface *dev;
+       unsigned long flags;
+       int err = -ENOENT;
+       u32 scale_min, scale_max;
+       u32 scale_m, scale_d;
+       struct nlattr *attr;
+       struct wprobe_filter *filter_free = NULL;
+
+       rcu_read_lock();
+       dev = wprobe_get_dev(info->attrs[WPROBE_ATTR_INTERFACE]);
+       if (!dev)
+               goto done_unlocked;
+
+       err = -EINVAL;
+       spin_lock_irqsave(&dev->lock, flags);
+       if (info->attrs[WPROBE_ATTR_MAC]) {
+               /* not supported yet */
+               goto done;
+       }
+
+       if (info->attrs[WPROBE_ATTR_FLAGS]) {
+               u32 flags = nla_get_u32(info->attrs[WPROBE_ATTR_FLAGS]);
+
+               if (flags & BIT(WPROBE_F_RESET)) {
+                       struct wprobe_link *l;
+
+                       memset(dev->val, 0, sizeof(struct wprobe_value) * dev->n_global_items);
+                       list_for_each_entry_rcu(l, &dev->links, list) {
+                               memset(l->val, 0, sizeof(struct wprobe_value) * dev->n_link_items);
+                       }
+               }
+       }
+
+       if (info->attrs[WPROBE_ATTR_SAMPLES_MIN] ||
+               info->attrs[WPROBE_ATTR_SAMPLES_MAX]) {
+               if ((attr = info->attrs[WPROBE_ATTR_SAMPLES_MIN]))
+                       scale_min = nla_get_u32(attr);
+               else
+                       scale_min = dev->scale_min;
+
+               if ((attr = info->attrs[WPROBE_ATTR_SAMPLES_MAX]))
+                       scale_max = nla_get_u32(attr);
+               else
+                       scale_max = dev->scale_max;
+
+               if ((!scale_min && !scale_max) ||
+                   (scale_min && scale_max && (scale_min < scale_max))) {
+                       dev->scale_min = scale_min;
+                       dev->scale_max = scale_max;
+               } else {
+                       goto done;
+               }
+       }
+
+       if (info->attrs[WPROBE_ATTR_SAMPLES_SCALE_M] &&
+               info->attrs[WPROBE_ATTR_SAMPLES_SCALE_D]) {
+
+               scale_m = nla_get_u32(info->attrs[WPROBE_ATTR_SAMPLES_SCALE_M]);
+               scale_d = nla_get_u32(info->attrs[WPROBE_ATTR_SAMPLES_SCALE_D]);
+
+               if (!scale_d || (scale_m > scale_d))
+                       goto done;
+
+               dev->scale_m = scale_m;
+               dev->scale_d = scale_d;
+       }
+
+       if ((attr = info->attrs[WPROBE_ATTR_FILTER])) {
+               filter_free = rcu_dereference(dev->active_filter);
+               rcu_assign_pointer(dev->active_filter, NULL);
+               if (nla_len(attr) > 0)
+                       wprobe_set_filter(dev, nla_data(attr), nla_len(attr));
+       }
+
+       err = 0;
+       if (info->attrs[WPROBE_ATTR_INTERVAL]) {
+               /* change of measurement interval requested */
+               err = wprobe_update_auto_measurement(dev,
+                       (u32) nla_get_u64(info->attrs[WPROBE_ATTR_INTERVAL]));
+       }
+
+done:
+       spin_unlock_irqrestore(&dev->lock, flags);
+done_unlocked:
+       rcu_read_unlock();
+       if (filter_free) {
+               synchronize_rcu();
+               wprobe_free_filter(filter_free);
+       }
+       return err;
+}
+
+static struct genl_ops wprobe_ops[] = {
+       {
+               .cmd = WPROBE_CMD_GET_INFO,
+               .dumpit = wprobe_dump_info,
+               .policy = wprobe_policy,
+       },
+       {
+               .cmd = WPROBE_CMD_GET_LIST,
+               .dumpit = wprobe_dump_info,
+               .policy = wprobe_policy,
+       },
+       {
+               .cmd = WPROBE_CMD_MEASURE,
+               .doit = wprobe_measure,
+               .policy = wprobe_policy,
+       },
+       {
+               .cmd = WPROBE_CMD_GET_LINKS,
+               .dumpit = wprobe_dump_links,
+               .policy = wprobe_policy,
+       },
+       {
+               .cmd = WPROBE_CMD_CONFIG,
+               .doit = wprobe_set_config,
+               .policy = wprobe_policy,
+       },
+       {
+               .cmd = WPROBE_CMD_GET_FILTER,
+               .dumpit = wprobe_dump_filters,
+               .policy = wprobe_policy,
+       },
+};
+
+static void __exit
+wprobe_exit(void)
+{
+       BUG_ON(!list_empty(&wprobe_if));
+       genl_unregister_family(&wprobe_fam);
+}
+
+
+static int __init
+wprobe_init(void)
+{
+       int i, err;
+
+       spin_lock_init(&wprobe_lock);
+       INIT_LIST_HEAD(&wprobe_if);
+
+       err = genl_register_family(&wprobe_fam);
+       if (err)
+               return err;
+
+       for (i = 0; i < ARRAY_SIZE(wprobe_ops); i++) {
+               err = genl_register_ops(&wprobe_fam, &wprobe_ops[i]);
+               if (err)
+                       goto error;
+       }
+
+       return 0;
+
+error:
+       genl_unregister_family(&wprobe_fam);
+       return err;
+}
+
+module_init(wprobe_init);
+module_exit(wprobe_exit);
+MODULE_LICENSE("GPL");
+
diff --git a/net/wprobe/src/kernel/wprobe-dummy.c b/net/wprobe/src/kernel/wprobe-dummy.c
new file mode 100644 (file)
index 0000000..4231223
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * wprobe-core.c: Wireless probe interface dummy driver
+ * Copyright (C) 2008-2009 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/spinlock.h>
+#include <linux/random.h>
+#include <linux/wprobe.h>
+
+static const char local_addr[] = "\x00\x13\x37\xba\xbe\x00";
+
+enum dummy_global_values {
+       DUMMY_GLOBAL_MEDIUM_BUSY
+};
+enum dummy_link_values {
+       DUMMY_LINK_SNR
+};
+
+struct wprobe_item dummy_perlink[] = {
+       [DUMMY_LINK_SNR] = {
+               .name = "snr",
+               .type = WPROBE_VAL_U8,
+               .flags = WPROBE_F_KEEPSTAT,
+       },
+};
+
+struct wprobe_item dummy_globals[] = {
+       [DUMMY_GLOBAL_MEDIUM_BUSY] = {
+               .name = "medium_busy",
+               .type = WPROBE_VAL_U8,
+               .flags = WPROBE_F_KEEPSTAT,
+       }
+};
+
+int dummy_sync(struct wprobe_iface *dev, struct wprobe_link *l, struct wprobe_value *val, bool measure)
+{
+       u8 intval = 0;
+
+       get_random_bytes(&intval, 1);
+       if (l) {
+               WPROBE_FILL_BEGIN(val, dummy_perlink);
+               WPROBE_SET(DUMMY_LINK_SNR, U8, (intval % 40));
+               WPROBE_FILL_END();
+       } else {
+               WPROBE_FILL_BEGIN(val, dummy_globals);
+               WPROBE_SET(DUMMY_GLOBAL_MEDIUM_BUSY, U8, (intval % 100));
+               WPROBE_FILL_END();
+       }
+       return 0;
+}
+
+static struct wprobe_iface dummy_dev = {
+       .name = "dummy",
+       .addr = local_addr,
+       .link_items = dummy_perlink,
+       .n_link_items = ARRAY_SIZE(dummy_perlink),
+       .global_items = dummy_globals,
+       .n_global_items = ARRAY_SIZE(dummy_globals),
+       .sync_data = dummy_sync,
+};
+
+static struct wprobe_link dummy_link;
+
+static int __init
+wprobe_dummy_init(void)
+{
+       wprobe_add_iface(&dummy_dev);
+       wprobe_add_link(&dummy_dev, &dummy_link, "\x00\x13\x37\xda\xda\x00");
+       return 0;
+}
+
+static void __exit
+wprobe_dummy_exit(void)
+{
+       wprobe_remove_link(&dummy_dev, &dummy_link);
+       wprobe_remove_iface(&dummy_dev);
+}
+
+module_init(wprobe_dummy_init);
+module_exit(wprobe_dummy_exit);
+
+MODULE_LICENSE("GPL");
diff --git a/net/wprobe/src/user/Makefile b/net/wprobe/src/user/Makefile
new file mode 100644 (file)
index 0000000..01e83da
--- /dev/null
@@ -0,0 +1,38 @@
+include ../Makefile.inc
+
+CPPFLAGS += -I../kernel
+LDFLAGS =
+
+ifneq ($(HOST_OS),Linux)
+USE_LIBNL_MICRO=1
+else
+USE_LIBNL_MICRO=
+endif
+
+ifeq ($(USE_LIBNL_MICRO),1)
+LIBNL_PREFIX = /usr/local
+LIBNL = $(LIBNL_PREFIX)/lib/libnl-micro.a
+CPPFLAGS += -I$(LIBNL_PREFIX)/include/libnl-micro
+EXTRA_CFLAGS += -DNO_LOCAL_ACCESS
+else
+LIBNL = -lnl
+endif
+
+LIBM = -lm
+LIBS = $(LIBNL) $(LIBM)
+
+all: libwprobe.a wprobe-util
+
+libwprobe.a: wprobe-lib.o
+       rm -f $@
+       $(AR) rcu $@ $^
+       $(RANLIB) $@
+
+%.o: %.c
+       $(CC) $(WFLAGS) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $<
+
+wprobe-util: wprobe-util.o wprobe-lib.o
+       $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
+
+clean:
+       rm -f *.o *.a wprobe-util
diff --git a/net/wprobe/src/user/list.h b/net/wprobe/src/user/list.h
new file mode 100644 (file)
index 0000000..2959a06
--- /dev/null
@@ -0,0 +1,601 @@
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
+
+#include <stddef.h>
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr:       the pointer to the member.
+ * @type:      the type of the container struct this is embedded in.
+ * @member:    the name of the member within the struct.
+ *
+ */
+#ifndef container_of
+#define container_of(ptr, type, member) (                      \
+       (type *)( (char *)ptr - offsetof(type,member) ))
+#endif
+
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+       struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+       struct list_head name = LIST_HEAD_INIT(name)
+
+static inline void INIT_LIST_HEAD(struct list_head *list)
+{
+       list->next = list;
+       list->prev = list;
+}
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_add(struct list_head *new,
+                             struct list_head *prev,
+                             struct list_head *next)
+{
+       next->prev = new;
+       new->next = next;
+       new->prev = prev;
+       prev->next = new;
+}
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static inline void list_add(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head, head->next);
+}
+
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+       __list_add(new, head->prev, head);
+}
+
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_del(struct list_head * prev, struct list_head * next)
+{
+       next->prev = prev;
+       prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty() on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+static inline void list_del(struct list_head *entry)
+{
+       __list_del(entry->prev, entry->next);
+       entry->next = NULL;
+       entry->prev = NULL;
+}
+
+/**
+ * list_replace - replace old entry by new one
+ * @old : the element to be replaced
+ * @new : the new element to insert
+ *
+ * If @old was empty, it will be overwritten.
+ */
+static inline void list_replace(struct list_head *old,
+                               struct list_head *new)
+{
+       new->next = old->next;
+       new->next->prev = new;
+       new->prev = old->prev;
+       new->prev->next = new;
+}
+
+static inline void list_replace_init(struct list_head *old,
+                                       struct list_head *new)
+{
+       list_replace(old, new);
+       INIT_LIST_HEAD(old);
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static inline void list_del_init(struct list_head *entry)
+{
+       __list_del(entry->prev, entry->next);
+       INIT_LIST_HEAD(entry);
+}
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+       __list_del(list->prev, list->next);
+       list_add(list, head);
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static inline void list_move_tail(struct list_head *list,
+                                 struct list_head *head)
+{
+       __list_del(list->prev, list->next);
+       list_add_tail(list, head);
+}
+
+/**
+ * list_is_last - tests whether @list is the last entry in list @head
+ * @list: the entry to test
+ * @head: the head of the list
+ */
+static inline int list_is_last(const struct list_head *list,
+                               const struct list_head *head)
+{
+       return list->next == head;
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static inline int list_empty(const struct list_head *head)
+{
+       return head->next == head;
+}
+
+/**
+ * list_empty_careful - tests whether a list is empty and not being modified
+ * @head: the list to test
+ *
+ * Description:
+ * tests whether a list is empty _and_ checks that no other CPU might be
+ * in the process of modifying either member (next or prev)
+ *
+ * NOTE: using list_empty_careful() without synchronization
+ * can only be safe if the only activity that can happen
+ * to the list entry is list_del_init(). Eg. it cannot be used
+ * if another CPU could re-list_add() it.
+ */
+static inline int list_empty_careful(const struct list_head *head)
+{
+       struct list_head *next = head->next;
+       return (next == head) && (next == head->prev);
+}
+
+static inline void __list_splice(struct list_head *list,
+                                struct list_head *head)
+{
+       struct list_head *first = list->next;
+       struct list_head *last = list->prev;
+       struct list_head *at = head->next;
+
+       first->prev = head;
+       head->next = first;
+
+       last->next = at;
+       at->prev = last;
+}
+
+/**
+ * list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice(struct list_head *list, struct list_head *head)
+{
+       if (!list_empty(list))
+               __list_splice(list, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_init(struct list_head *list,
+                                   struct list_head *head)
+{
+       if (!list_empty(list)) {
+               __list_splice(list, head);
+               INIT_LIST_HEAD(list);
+       }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr:       the &struct list_head pointer.
+ * @type:      the type of the struct this is embedded in.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+       container_of(ptr, type, member)
+
+/**
+ * list_first_entry - get the first element from a list
+ * @ptr:       the list head to take the element from.
+ * @type:      the type of the struct this is embedded in.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Note, that list is expected to be not empty.
+ */
+#define list_first_entry(ptr, type, member) \
+       list_entry((ptr)->next, type, member)
+
+/**
+ * list_for_each       -       iterate over a list
+ * @pos:       the &struct list_head to use as a loop cursor.
+ * @head:      the head for your list.
+ */
+#define list_for_each(pos, head) \
+       for (pos = (head)->next; pos != (head); \
+               pos = pos->next)
+
+/**
+ * __list_for_each     -       iterate over a list
+ * @pos:       the &struct list_head to use as a loop cursor.
+ * @head:      the head for your list.
+ *
+ * This variant differs from list_for_each() in that it's the
+ * simplest possible list iteration code, no prefetching is done.
+ * Use this for code that knows the list to be very short (empty
+ * or 1 entry) most of the time.
+ */
+#define __list_for_each(pos, head) \
+       for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_prev  -       iterate over a list backwards
+ * @pos:       the &struct list_head to use as a loop cursor.
+ * @head:      the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+       for (pos = (head)->prev; pos != (head); \
+               pos = pos->prev)
+
+/**
+ * list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos:       the &struct list_head to use as a loop cursor.
+ * @n:         another &struct list_head to use as temporary storage
+ * @head:      the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+       for (pos = (head)->next, n = pos->next; pos != (head); \
+               pos = n, n = pos->next)
+
+/**
+ * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
+ * @pos:       the &struct list_head to use as a loop cursor.
+ * @n:         another &struct list_head to use as temporary storage
+ * @head:      the head for your list.
+ */
+#define list_for_each_prev_safe(pos, n, head) \
+       for (pos = (head)->prev, n = pos->prev; \
+            pos != (head); \
+            pos = n, n = pos->prev)
+
+/**
+ * list_for_each_entry -       iterate over list of given type
+ * @pos:       the type * to use as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member)                         \
+       for (pos = list_entry((head)->next, typeof(*pos), member);      \
+            &pos->member != (head);    \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_reverse - iterate backwards over list of given type.
+ * @pos:       the type * to use as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_reverse(pos, head, member)                 \
+       for (pos = list_entry((head)->prev, typeof(*pos), member);      \
+            &pos->member != (head);    \
+            pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
+ * @pos:       the type * to use as a start point
+ * @head:      the head of the list
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
+ */
+#define list_prepare_entry(pos, head, member) \
+       ((pos) ? : list_entry(head, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue - continue iteration over list of given type
+ * @pos:       the type * to use as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Continue to iterate over list of given type, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue(pos, head, member)                \
+       for (pos = list_entry(pos->member.next, typeof(*pos), member);  \
+            &pos->member != (head);    \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_continue_reverse - iterate backwards from the given point
+ * @pos:       the type * to use as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Start to iterate over list of given type backwards, continuing after
+ * the current position.
+ */
+#define list_for_each_entry_continue_reverse(pos, head, member)                \
+       for (pos = list_entry(pos->member.prev, typeof(*pos), member);  \
+            &pos->member != (head);    \
+            pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_from - iterate over list of given type from the current point
+ * @pos:       the type * to use as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type, continuing from current position.
+ */
+#define list_for_each_entry_from(pos, head, member)                    \
+       for (; &pos->member != (head);  \
+            pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos:       the type * to use as a loop cursor.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member)                 \
+       for (pos = list_entry((head)->next, typeof(*pos), member),      \
+               n = list_entry(pos->member.next, typeof(*pos), member); \
+            &pos->member != (head);                                    \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_continue
+ * @pos:       the type * to use as a loop cursor.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type, continuing after current point,
+ * safe against removal of list entry.
+ */
+#define list_for_each_entry_safe_continue(pos, n, head, member)                \
+       for (pos = list_entry(pos->member.next, typeof(*pos), member),          \
+               n = list_entry(pos->member.next, typeof(*pos), member);         \
+            &pos->member != (head);                                            \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_from
+ * @pos:       the type * to use as a loop cursor.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Iterate over list of given type from current point, safe against
+ * removal of list entry.
+ */
+#define list_for_each_entry_safe_from(pos, n, head, member)                    \
+       for (n = list_entry(pos->member.next, typeof(*pos), member);            \
+            &pos->member != (head);                                            \
+            pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+/**
+ * list_for_each_entry_safe_reverse
+ * @pos:       the type * to use as a loop cursor.
+ * @n:         another type * to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ *
+ * Iterate backwards over list of given type, safe against removal
+ * of list entry.
+ */
+#define list_for_each_entry_safe_reverse(pos, n, head, member)         \
+       for (pos = list_entry((head)->prev, typeof(*pos), member),      \
+               n = list_entry(pos->member.prev, typeof(*pos), member); \
+            &pos->member != (head);                                    \
+            pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+
+/*
+ * Double linked lists with a single pointer list head.
+ * Mostly useful for hash tables where the two pointer list head is
+ * too wasteful.
+ * You lose the ability to access the tail in O(1).
+ */
+
+struct hlist_head {
+       struct hlist_node *first;
+};
+
+struct hlist_node {
+       struct hlist_node *next, **pprev;
+};
+
+#define HLIST_HEAD_INIT { .first = NULL }
+#define HLIST_HEAD(name) struct hlist_head name = {  .first = NULL }
+#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
+static inline void INIT_HLIST_NODE(struct hlist_node *h)
+{
+       h->next = NULL;
+       h->pprev = NULL;
+}
+
+static inline int hlist_unhashed(const struct hlist_node *h)
+{
+       return !h->pprev;
+}
+
+static inline int hlist_empty(const struct hlist_head *h)
+{
+       return !h->first;
+}
+
+static inline void __hlist_del(struct hlist_node *n)
+{
+       struct hlist_node *next = n->next;
+       struct hlist_node **pprev = n->pprev;
+       *pprev = next;
+       if (next)
+               next->pprev = pprev;
+}
+
+static inline void hlist_del(struct hlist_node *n)
+{
+       __hlist_del(n);
+       n->next = NULL;
+       n->pprev = NULL;
+}
+
+static inline void hlist_del_init(struct hlist_node *n)
+{
+       if (!hlist_unhashed(n)) {
+               __hlist_del(n);
+               INIT_HLIST_NODE(n);
+       }
+}
+
+
+static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
+{
+       struct hlist_node *first = h->first;
+       n->next = first;
+       if (first)
+               first->pprev = &n->next;
+       h->first = n;
+       n->pprev = &h->first;
+}
+
+
+/* next must be != NULL */
+static inline void hlist_add_before(struct hlist_node *n,
+                                       struct hlist_node *next)
+{
+       n->pprev = next->pprev;
+       n->next = next;
+       next->pprev = &n->next;
+       *(n->pprev) = n;
+}
+
+static inline void hlist_add_after(struct hlist_node *n,
+                                       struct hlist_node *next)
+{
+       next->next = n->next;
+       n->next = next;
+       next->pprev = &n->next;
+
+       if(next->next)
+               next->next->pprev  = &next->next;
+}
+
+#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
+
+#define hlist_for_each(pos, head) \
+       for (pos = (head)->first; pos; pos = pos->next)
+
+#define hlist_for_each_safe(pos, n, head) \
+       for (pos = (head)->first; pos; pos = n)
+
+/**
+ * hlist_for_each_entry        - iterate over list of given type
+ * @tpos:      the type * to use as a loop cursor.
+ * @pos:       the &struct hlist_node to use as a loop cursor.
+ * @head:      the head for your list.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry(tpos, pos, head, member)                   \
+       for (pos = (head)->first; pos &&                                 \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = pos->next)
+
+/**
+ * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
+ * @tpos:      the type * to use as a loop cursor.
+ * @pos:       the &struct hlist_node to use as a loop cursor.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_continue(tpos, pos, member)               \
+       for (pos = (pos)->next; pos &&                                  \
+            ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;});   \
+            pos = pos->next)
+
+/**
+ * hlist_for_each_entry_from - iterate over a hlist continuing from current point
+ * @tpos:      the type * to use as a loop cursor.
+ * @pos:       the &struct hlist_node to use as a loop cursor.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_from(tpos, pos, member)                    \
+       for (; pos &&                    \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = pos->next)
+
+/**
+ * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @tpos:      the type * to use as a loop cursor.
+ * @pos:       the &struct hlist_node to use as a loop cursor.
+ * @n:         another &struct hlist_node to use as temporary storage
+ * @head:      the head for your list.
+ * @member:    the name of the hlist_node within the struct.
+ */
+#define hlist_for_each_entry_safe(tpos, pos, n, head, member)           \
+       for (pos = (head)->first;                                        \
+            pos && ({ n = pos->next; 1; }) &&                           \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = n)
+
+#endif
diff --git a/net/wprobe/src/user/wprobe-lib.c b/net/wprobe/src/user/wprobe-lib.c
new file mode 100644 (file)
index 0000000..7a5460b
--- /dev/null
@@ -0,0 +1,1210 @@
+/*
+ * wprobe.c: Wireless probe user space library
+ * Copyright (C) 2008-2009 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#define _ISOC99_SOURCE
+#define _BSD_SOURCE
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <math.h>
+#include <linux/wprobe.h>
+#include <netlink/netlink.h>
+#include <netlink/attr.h>
+#include <netlink/genl/genl.h>
+#ifndef NO_LOCAL_ACCESS 
+#include <netlink/genl/ctrl.h>
+#include <netlink/genl/family.h>
+#include <endian.h>
+#endif
+#include "wprobe.h"
+
+#define DEBUG 1
+#ifdef DEBUG
+#define DPRINTF(fmt, ...) fprintf(stderr, "%s(%d): " fmt, __func__, __LINE__, ##__VA_ARGS__)
+#else
+#define DPRINTF(fmt, ...) do {} while (0)
+#endif
+
+#if defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#define __BYTE_ORDER BYTE_ORDER
+#endif
+
+#ifndef __BYTE_ORDER
+#error Unknown endian type
+#endif
+
+#define WPROBE_MAX_MSGLEN      65536
+
+static inline __u16 __swab16(__u16 x)
+{
+       return x<<8 | x>>8;
+}
+
+static inline __u32 __swab32(__u32 x)
+{
+       return x<<24 | x>>24 |
+               (x & (__u32)0x0000ff00UL)<<8 |
+               (x & (__u32)0x00ff0000UL)>>8;
+}
+
+static inline __u64 __swab64(__u64 x)
+{
+       return x<<56 | x>>56 |
+               (x & (__u64)0x000000000000ff00ULL)<<40 |
+               (x & (__u64)0x0000000000ff0000ULL)<<24 |
+               (x & (__u64)0x00000000ff000000ULL)<< 8 |
+               (x & (__u64)0x000000ff00000000ULL)>> 8 |
+               (x & (__u64)0x0000ff0000000000ULL)>>24 |
+               (x & (__u64)0x00ff000000000000ULL)>>40;
+}
+
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define SWAP16(var) var = __swab16(var)
+#define SWAP32(var) var = __swab32(var)
+#define SWAP64(var) var = __swab64(var)
+#else
+#define SWAP16(var) do {} while(0)
+#define SWAP32(var) do {} while(0)
+#define SWAP64(var) do {} while(0)
+#endif
+
+int wprobe_port = 17990;
+static struct nlattr *tb[WPROBE_ATTR_LAST+1];
+static struct nla_policy attribute_policy[WPROBE_ATTR_LAST+1] = {
+       [WPROBE_ATTR_ID] = { .type = NLA_U32 },
+       [WPROBE_ATTR_MAC] = { .type = NLA_UNSPEC, .minlen = 6, .maxlen = 6 },
+       [WPROBE_ATTR_NAME] = { .type = NLA_STRING },
+       [WPROBE_ATTR_FLAGS] = { .type = NLA_U32 },
+       [WPROBE_ATTR_TYPE] = { .type = NLA_U8 },
+       [WPROBE_ATTR_FLAGS] = { .type = NLA_U32 },
+       [WPROBE_VAL_S8] = { .type = NLA_U8 },
+       [WPROBE_VAL_S16] = { .type = NLA_U16 },
+       [WPROBE_VAL_S32] = { .type = NLA_U32 },
+       [WPROBE_VAL_S64] = { .type = NLA_U64 },
+       [WPROBE_VAL_U8] = { .type = NLA_U8 },
+       [WPROBE_VAL_U16] = { .type = NLA_U16 },
+       [WPROBE_VAL_U32] = { .type = NLA_U32 },
+       [WPROBE_VAL_U64] = { .type = NLA_U64 },
+       [WPROBE_VAL_SUM] = { .type = NLA_U64 },
+       [WPROBE_VAL_SUM_SQ] = { .type = NLA_U64 },
+       [WPROBE_VAL_SAMPLES] = { .type = NLA_U32 },
+       [WPROBE_VAL_SCALE_TIME] = { .type = NLA_U64 },
+       [WPROBE_ATTR_INTERVAL] = { .type = NLA_U64 },
+       [WPROBE_ATTR_SAMPLES_MIN] = { .type = NLA_U32 },
+       [WPROBE_ATTR_SAMPLES_MAX] = { .type = NLA_U32 },
+       [WPROBE_ATTR_SAMPLES_SCALE_M] = { .type = NLA_U32 },
+       [WPROBE_ATTR_SAMPLES_SCALE_D] = { .type = NLA_U32 },
+       [WPROBE_ATTR_FILTER_GROUP] = { .type = NLA_NESTED },
+       [WPROBE_ATTR_RXCOUNT] = { .type = NLA_U64 },
+       [WPROBE_ATTR_TXCOUNT] = { .type = NLA_U64 },
+};
+
+typedef int (*wprobe_cb_t)(struct nl_msg *, void *);
+
+struct wprobe_iface_ops {
+       int (*send_msg)(struct wprobe_iface *dev, struct nl_msg *msg, wprobe_cb_t cb, void *arg);
+       void (*free)(struct wprobe_iface *dev);
+};
+
+struct wprobe_attr_cb {
+       struct list_head *list;
+       char *addr;
+};
+
+#define WPROBE_MAGIC_STR "WPROBE"
+struct wprobe_init_hdr {
+       struct {
+               char magic[sizeof(WPROBE_MAGIC_STR)];
+
+               /* protocol version */
+               uint8_t version;
+
+               /* extra header length (unused for now) */
+               uint16_t extra;
+       } pre __attribute__((packed));
+       union {
+               struct {
+                       uint16_t genl_family;
+               } v0 __attribute__((packed));
+       };
+} __attribute__((packed));
+
+struct wprobe_msg_hdr {
+       __u16 status;
+       __u16 error;
+       __u32 len;
+};
+
+enum wprobe_resp_status {
+       WPROBE_MSG_DONE = 0,
+       WPROBE_MSG_DATA = 1,
+};
+
+static inline void
+wprobe_swap_msg_hdr(struct wprobe_msg_hdr *mhdr)
+{
+       SWAP16(mhdr->status);
+       SWAP16(mhdr->error);
+       SWAP32(mhdr->len);
+}
+
+static int
+save_attribute_handler(struct nl_msg *msg, void *arg)
+{
+       struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+       const char *name = "N/A";
+       struct wprobe_attribute *attr;
+       int type = 0;
+       struct wprobe_attr_cb *cb = arg;
+
+       nla_parse(tb, WPROBE_ATTR_LAST, genlmsg_attrdata(gnlh, 0),
+                       genlmsg_attrlen(gnlh, 0), attribute_policy);
+
+       if (tb[WPROBE_ATTR_NAME])
+               name = nla_data(tb[WPROBE_ATTR_NAME]);
+
+       attr = malloc(sizeof(struct wprobe_attribute) + strlen(name) + 1);
+       if (!attr)
+               return -1;
+
+       memset(attr, 0, sizeof(struct wprobe_attribute));
+
+       if (tb[WPROBE_ATTR_ID])
+               attr->id = nla_get_u32(tb[WPROBE_ATTR_ID]);
+
+       if (tb[WPROBE_ATTR_MAC] && cb->addr)
+               memcpy(cb->addr, nla_data(tb[WPROBE_ATTR_MAC]), 6);
+
+       if (tb[WPROBE_ATTR_FLAGS])
+               attr->flags = nla_get_u32(tb[WPROBE_ATTR_FLAGS]);
+
+       if (tb[WPROBE_ATTR_TYPE])
+               type = nla_get_u8(tb[WPROBE_ATTR_TYPE]);
+
+       if ((type < WPROBE_VAL_STRING) ||
+               (type > WPROBE_VAL_U64))
+               type = 0;
+
+       attr->type = type;
+       strcpy(attr->name, name);
+       INIT_LIST_HEAD(&attr->list);
+       list_add(&attr->list, cb->list);
+       return 0;
+}
+
+static struct nl_msg *
+wprobe_new_msg(struct wprobe_iface *dev, int cmd, bool dump)
+{
+       struct nl_msg *msg;
+       uint32_t flags = 0;
+
+       msg = nlmsg_alloc_size(65536);
+       if (!msg)
+               return NULL;
+
+       if (dump)
+               flags |= NLM_F_DUMP;
+
+       genlmsg_put(msg, 0, 0, dev->genl_family,
+                       0, flags, cmd, 0);
+
+       NLA_PUT_STRING(msg, WPROBE_ATTR_INTERFACE, dev->ifname);
+nla_put_failure:
+       return msg;
+}
+
+
+static int
+dump_attributes(struct wprobe_iface *dev, bool link, struct list_head *list, char *addr)
+{
+       struct nl_msg *msg;
+       struct wprobe_attr_cb cb;
+
+       cb.list = list;
+       cb.addr = addr;
+       msg = wprobe_new_msg(dev, WPROBE_CMD_GET_LIST, true);
+       if (!msg)
+               return -ENOMEM;
+
+       if (link)
+               NLA_PUT(msg, WPROBE_ATTR_MAC, 6, "\x00\x00\x00\x00\x00\x00");
+
+       return dev->ops->send_msg(dev, msg, save_attribute_handler, &cb);
+
+nla_put_failure:
+       nlmsg_free(msg);
+       return -EINVAL;
+}
+
+static struct wprobe_iface *
+wprobe_alloc_dev(void)
+{
+       struct wprobe_iface *dev;
+
+       dev = malloc(sizeof(struct wprobe_iface));
+       if (!dev)
+               return NULL;
+
+       memset(dev, 0, sizeof(struct wprobe_iface));
+
+       dev->interval = -1;
+       dev->scale_min = -1;
+       dev->scale_max = -1;
+       dev->scale_m = -1;
+       dev->scale_d = -1;
+       dev->sockfd = -1;
+
+       INIT_LIST_HEAD(&dev->global_attr);
+       INIT_LIST_HEAD(&dev->link_attr);
+       INIT_LIST_HEAD(&dev->links);
+       return dev;
+}
+
+static int
+wprobe_init_dev(struct wprobe_iface *dev)
+{
+       dump_attributes(dev, false, &dev->global_attr, NULL);
+       dump_attributes(dev, true, &dev->link_attr, NULL);
+       return 0;
+}
+
+#ifndef NO_LOCAL_ACCESS 
+static int n_devs = 0;
+static struct nl_sock *handle = NULL;
+static struct nl_cache *cache = NULL;
+static struct genl_family *family = NULL;
+
+static int
+error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg)
+{
+       int *ret = arg;
+       *ret = err->error;
+       return NL_STOP;
+}
+
+static int
+finish_handler(struct nl_msg *msg, void *arg)
+{
+       int *ret = arg;
+       *ret = 0;
+       return NL_SKIP;
+}
+
+static int
+ack_handler(struct nl_msg *msg, void *arg)
+{
+       int *ret = arg;
+       *ret = 0;
+       return NL_STOP;
+}
+
+static void
+wprobe_local_free(struct wprobe_iface *dev)
+{
+       /* should not happen */
+       if (n_devs == 0)
+               return;
+
+       if (--n_devs != 0)
+               return;
+
+       if (cache)
+               nl_cache_free(cache);
+       if (handle)
+               nl_socket_free(handle);
+       handle = NULL;
+       cache = NULL;
+}
+
+static int
+wprobe_local_init(void)
+{
+       int ret;
+
+       if (n_devs++ > 0)
+               return 0;
+
+       handle = nl_socket_alloc();
+       if (!handle) {
+               DPRINTF("Failed to create handle\n");
+               goto err;
+       }
+
+       if (genl_connect(handle)) {
+               DPRINTF("Failed to connect to generic netlink\n");
+               goto err;
+       }
+
+       ret = genl_ctrl_alloc_cache(handle, &cache);
+       if (ret < 0) {
+               DPRINTF("Failed to allocate netlink cache\n");
+               goto err;
+       }
+
+       family = genl_ctrl_search_by_name(cache, "wprobe");
+       if (!family) {
+               DPRINTF("wprobe API not present\n");
+               goto err;
+       }
+       return 0;
+
+err:
+       wprobe_local_free(NULL);
+       return -EINVAL;
+}
+
+
+static int
+wprobe_local_send_msg(struct wprobe_iface *dev, struct nl_msg *msg, wprobe_cb_t callback, void *arg)
+{
+       struct nl_cb *cb;
+       int err = 0;
+
+       cb = nl_cb_alloc(NL_CB_DEFAULT);
+       if (!cb)
+               goto out_no_cb;
+
+       if (callback)
+               nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, callback, arg);
+
+       err = nl_send_auto_complete(handle, msg);
+       if (err < 0)
+               goto out;
+
+       err = 1;
+
+       nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
+       nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, &err);
+       nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &err);
+
+       while (err > 0)
+               nl_recvmsgs(handle, cb);
+
+out:
+       nl_cb_put(cb);
+out_no_cb:
+       nlmsg_free(msg);
+       return err;
+}
+
+static const struct wprobe_iface_ops wprobe_local_ops = {
+       .send_msg = wprobe_local_send_msg,
+       .free = wprobe_local_free,
+};
+
+struct wprobe_iface *
+wprobe_get_dev(const char *ifname)
+{
+       struct wprobe_iface *dev;
+
+       if (wprobe_local_init() != 0)
+               return NULL;
+
+       dev = wprobe_alloc_dev();
+       if (!dev)
+               goto error_alloc;
+
+       dev->ifname = strdup(ifname);
+       dev->ops = &wprobe_local_ops;
+       dev->genl_family = genl_family_get_id(family);
+
+       if (wprobe_init_dev(dev) < 0)
+               goto error;
+
+       return dev;
+
+error:
+       free(dev);
+error_alloc:
+       wprobe_local_free(NULL);
+       return NULL;
+}
+
+#endif
+
+static void swap_nlmsghdr(struct nlmsghdr *nlh)
+{
+       SWAP32(nlh->nlmsg_len);
+       SWAP16(nlh->nlmsg_type);
+       SWAP16(nlh->nlmsg_flags);
+       SWAP32(nlh->nlmsg_seq);
+       SWAP32(nlh->nlmsg_pid);
+}
+
+static void swap_genlmsghdr(struct genlmsghdr *gnlh)
+{
+#if 0 /* probably unnecessary */
+       SWAP16(gnlh->reserved);
+#endif
+}
+
+static void
+wprobe_swap_nested(void *data, int len, bool outgoing)
+{
+       void *end = data + len;
+
+       while (data < end) {
+               struct nlattr *nla = data;
+               unsigned int type, len;
+
+               if (!outgoing) {
+                       SWAP16(nla->nla_len);
+                       SWAP16(nla->nla_type);
+
+                       /* required for further sanity checks */
+                       if (data + nla->nla_len > end)
+                               nla->nla_len = end - data;
+               }
+
+               len = NLA_ALIGN(nla->nla_len);
+               type = nla->nla_type & NLA_TYPE_MASK;
+
+               if (type <= WPROBE_ATTR_LAST) {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+                       switch(attribute_policy[type].type) {
+                       case NLA_U16:
+                               SWAP16(*(__u16 *)nla_data(nla));
+                               break;
+                       case NLA_U32:
+                               SWAP32(*(__u32 *)nla_data(nla));
+                               break;
+                       case NLA_U64:
+                               SWAP64(*(__u64 *)nla_data(nla));
+                               break;
+                       case NLA_NESTED:
+                               wprobe_swap_nested(nla_data(nla), nla_len(nla), outgoing);
+                               break;
+                       }
+#endif
+               }
+               data += len;
+
+               if (outgoing) {
+                       SWAP16(nla->nla_len);
+                       SWAP16(nla->nla_type);
+               }
+               if (!nla->nla_len)
+                       break;
+       }
+}
+
+static struct nl_msg *
+wprobe_msg_from_network(int socket, int len)
+{
+       struct genlmsghdr *gnlh;
+       struct nlmsghdr *nlh;
+       struct nl_msg *msg;
+       void *data;
+
+       msg = nlmsg_alloc_size(len + 32);
+       if (!msg)
+               return NULL;
+
+       nlh = nlmsg_hdr(msg);
+       if (read(socket, nlh, len) != len)
+               goto free;
+
+       swap_nlmsghdr(nlh);
+       if (nlh->nlmsg_len > len)
+               goto free;
+
+       gnlh = nlmsg_data(nlh);
+       swap_genlmsghdr(gnlh);
+
+       data = genlmsg_data(gnlh);
+       wprobe_swap_nested(data, genlmsg_len(gnlh), false);
+
+       return msg;
+free:
+       nlmsg_free(msg);
+       return NULL;
+}
+
+static int
+wprobe_msg_to_network(int socket, struct nl_msg *msg)
+{
+       struct nlmsghdr *nlh = nlmsg_hdr(msg);
+       struct wprobe_msg_hdr mhdr;
+       struct genlmsghdr *gnlh;
+       void *buf, *data;
+       int buflen, datalen;
+       int ret;
+
+       buflen = nlh->nlmsg_len;
+       buf = malloc(buflen);
+       if (!buf)
+               return -ENOMEM;
+
+       memset(&mhdr, 0, sizeof(mhdr));
+       mhdr.status = WPROBE_MSG_DATA;
+       mhdr.len = buflen;
+       wprobe_swap_msg_hdr(&mhdr);
+       ret = write(socket, &mhdr, sizeof(mhdr));
+       if (ret < 0)
+               goto out;
+
+       memcpy(buf, nlh, buflen);
+       nlh = buf;
+       gnlh = nlmsg_data(nlh);
+       data = genlmsg_data(gnlh);
+       datalen = genlmsg_len(gnlh);
+
+       wprobe_swap_nested(data, datalen, true);
+       swap_genlmsghdr(gnlh);
+       swap_nlmsghdr(nlh);
+       ret = write(socket, buf, buflen);
+
+out:
+       free(buf);
+
+       return ret;
+}
+
+static int
+wprobe_remote_send_msg(struct wprobe_iface *dev, struct nl_msg *msg, wprobe_cb_t callback, void *arg)
+{
+       struct wprobe_msg_hdr mhdr;
+       int msgs = 0;
+
+       wprobe_msg_to_network(dev->sockfd, msg);
+       nlmsg_free(msg);
+       do {
+               if (read(dev->sockfd, &mhdr, sizeof(mhdr)) != sizeof(mhdr)) {
+                       DPRINTF("Failed to read response header\n");
+                       return -1;
+               }
+               wprobe_swap_msg_hdr(&mhdr);
+
+               switch(mhdr.status) {
+               case WPROBE_MSG_DATA:
+                       if (mhdr.len > WPROBE_MAX_MSGLEN) {
+                               fprintf(stderr, "Invalid length in received response message.\n");
+                               exit(1);
+                       }
+
+                       msg = wprobe_msg_from_network(dev->sockfd, mhdr.len);
+                       if (!msg)
+                               return -EINVAL;
+
+                       msgs++;
+                       callback(msg, arg);
+                       nlmsg_free(msg);
+                       break;
+               }
+       } while (mhdr.status != WPROBE_MSG_DONE);
+
+       if (mhdr.error)
+               return -mhdr.error;
+       else
+               return msgs;
+}
+
+
+static void
+wprobe_socket_dev_free(struct wprobe_iface *dev)
+{
+       if (dev->sockfd >= 0)
+               close(dev->sockfd);
+}
+
+static const struct wprobe_iface_ops wprobe_remote_ops = {
+       .send_msg = wprobe_remote_send_msg,
+       .free = wprobe_socket_dev_free,
+};
+
+
+#ifndef NO_LOCAL_ACCESS 
+int
+wprobe_server_init(int socket)
+{
+       struct wprobe_init_hdr hdr;
+       int ret;
+
+       ret = wprobe_local_init();
+       if (ret != 0)
+               return ret;
+
+       memset(&hdr, 0, sizeof(hdr));
+       memcpy(hdr.pre.magic, WPROBE_MAGIC_STR, sizeof(WPROBE_MAGIC_STR));
+       hdr.pre.version = 0;
+       hdr.v0.genl_family = genl_family_get_id(family);
+       SWAP16(hdr.v0.genl_family);
+       write(socket, (unsigned char *)&hdr, sizeof(hdr));
+
+       return 0;
+}
+
+static int
+wprobe_server_cb(struct nl_msg *msg, void *arg)
+{
+       int *socket = arg;
+       int ret;
+
+       ret = wprobe_msg_to_network(*socket, msg);
+       if (ret > 0)
+               ret = 0;
+
+       return ret;
+}
+
+
+int
+wprobe_server_handle(int socket)
+{
+       struct wprobe_msg_hdr mhdr;
+       struct nl_msg *msg;
+       int ret;
+
+       ret = read(socket, &mhdr, sizeof(mhdr));
+       if (ret != sizeof(mhdr)) {
+               if (ret <= 0)
+                       return -1;
+
+               DPRINTF("Failed to read request header\n");
+               return -EINVAL;
+       }
+       wprobe_swap_msg_hdr(&mhdr);
+
+       switch(mhdr.status) {
+       case WPROBE_MSG_DATA:
+               if (mhdr.len > WPROBE_MAX_MSGLEN) {
+                       DPRINTF("Invalid length in received response message.\n");
+                       return -EINVAL;
+               }
+               msg = wprobe_msg_from_network(socket, mhdr.len);
+               break;
+       default:
+               DPRINTF("Invalid request header type\n");
+               return -ENOENT;
+       }
+
+       if (!msg) {
+               DPRINTF("Failed to get message\n");
+               return -EINVAL;
+       }
+
+       ret = wprobe_local_send_msg(NULL, msg, wprobe_server_cb, &socket);
+
+       memset(&mhdr, 0, sizeof(mhdr));
+       mhdr.status = WPROBE_MSG_DONE;
+       if (ret < 0)
+               mhdr.error = (uint16_t) -ret;
+
+       ret = write(socket, (unsigned char *)&mhdr, sizeof(mhdr));
+       if (ret > 0)
+               ret = 0;
+
+       return ret;
+}
+
+void
+wprobe_server_done(void)
+{
+       wprobe_local_free(NULL);
+}
+#endif
+
+struct wprobe_iface *
+wprobe_get_from_socket(int socket, const char *name)
+{
+       struct wprobe_iface *dev;
+       struct wprobe_init_hdr hdr;
+
+       dev = wprobe_alloc_dev();
+       if (!dev)
+               goto out;
+
+       dev->ops = &wprobe_remote_ops;
+       dev->sockfd = socket;
+       dev->ifname = strdup(name);
+
+       /* read version and header length */
+       if (read(socket, &hdr.pre, sizeof(hdr.pre)) != sizeof(hdr.pre)) {
+               DPRINTF("Could not read header\n");
+               goto error;
+       }
+
+       /* magic not found */
+       if (memcmp(hdr.pre.magic, WPROBE_MAGIC_STR, sizeof(hdr.pre.magic)) != 0) {
+               DPRINTF("Magic does not match\n");
+               goto error;
+       }
+
+       /* unsupported version */
+       if (hdr.pre.version != 0) {
+               DPRINTF("Protocol version does not match\n");
+               goto error;
+       }
+
+       if (read(socket, &hdr.v0, sizeof(hdr.v0)) != sizeof(hdr.v0)) {
+               DPRINTF("Could not read header data\n");
+               goto error;
+       }
+
+       SWAP16(hdr.pre.extra);
+       SWAP16(hdr.v0.genl_family);
+       dev->genl_family = hdr.v0.genl_family;
+
+       if (wprobe_init_dev(dev) < 0) {
+               DPRINTF("Could not initialize device\n");
+               goto error;
+       }
+
+out:
+       return dev;
+
+error:
+       wprobe_free_dev(dev);
+       return NULL;
+}
+
+struct wprobe_iface *
+wprobe_get_auto(const char *arg, char **err)
+{
+       static struct sockaddr_in sa;
+       static char errbuf[512];
+
+       struct wprobe_iface *dev = NULL;
+       struct hostent *h;
+       char *devstr = strdup(arg);
+       char *sep = NULL;
+       int sock = -1;
+       int len;
+
+       if (err)
+               *err = NULL;
+
+       sep = strchr(devstr, ':');
+       if (!sep) {
+#ifndef NO_LOCAL_ACCESS 
+               free(devstr);
+               return wprobe_get_dev(arg);
+#else
+               if (err)
+                       *err = "Invalid argument";
+               goto out;
+#endif
+       }
+
+       *sep = 0;
+       sep++;
+
+       sock = socket(AF_INET, SOCK_STREAM, 0);
+       if (sock < 0)
+               goto syserr;
+
+       h = gethostbyname(devstr);
+       if (!h) {
+               sprintf(errbuf, "Host not found");
+               goto out_err;
+       }
+
+       memcpy(&sa.sin_addr, h->h_addr, h->h_length);
+       sa.sin_family = AF_INET;
+       sa.sin_port = htons(wprobe_port);
+       if (connect(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0)
+               goto syserr;
+
+       dev = wprobe_get_from_socket(sock, sep);
+       if (!dev) {
+               sprintf(errbuf, "wprobe connection initialization failed");
+               goto out_err;
+       }
+       goto out;
+
+syserr:
+       if (err) {
+               strcpy(errbuf, "Connection failed: ");
+               len = strlen(errbuf);
+               strerror_r(errno, errbuf + len, sizeof(errbuf) - len - 1);
+       }
+out_err:
+       if (err)
+               *err = errbuf;
+       if (sock >= 0)
+               close(sock);
+out:
+       if (devstr)
+               free(devstr);
+       return dev;
+}
+
+static void
+free_attr_list(struct list_head *list)
+{
+       struct wprobe_attribute *attr, *tmp;
+
+       list_for_each_entry_safe(attr, tmp, list, list) {
+               list_del(&attr->list);
+               free(attr);
+       }
+}
+
+void
+wprobe_free_dev(struct wprobe_iface *dev)
+{
+       if (dev->ops->free)
+               dev->ops->free(dev);
+       free_attr_list(&dev->global_attr);
+       free_attr_list(&dev->link_attr);
+       free((void *)dev->ifname);
+       free(dev);
+}
+
+static struct wprobe_link *
+get_link(struct list_head *list, const char *addr)
+{
+       struct wprobe_link *l;
+
+       list_for_each_entry(l, list, list) {
+               if (!memcmp(l->addr, addr, 6)) {
+                       list_del_init(&l->list);
+                       goto out;
+               }
+       }
+
+       /* no previous link found, allocate a new one */
+       l = malloc(sizeof(struct wprobe_link));
+       if (!l)
+               goto out;
+
+       memset(l, 0, sizeof(struct wprobe_link));
+       memcpy(l->addr, addr, sizeof(l->addr));
+       INIT_LIST_HEAD(&l->list);
+
+out:
+       return l;
+}
+
+struct wprobe_save_cb {
+       struct list_head *list;
+       struct list_head old_list;
+};
+
+static int
+save_link_handler(struct nl_msg *msg, void *arg)
+{
+       struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+       struct wprobe_link *link;
+       struct wprobe_save_cb *cb = arg;
+       const char *addr;
+
+       nla_parse(tb, WPROBE_ATTR_LAST, genlmsg_attrdata(gnlh, 0),
+                       genlmsg_attrlen(gnlh, 0), attribute_policy);
+
+       if (!tb[WPROBE_ATTR_MAC] || (nla_len(tb[WPROBE_ATTR_MAC]) != 6))
+               return -1;
+
+       addr = nla_data(tb[WPROBE_ATTR_MAC]);
+       link = get_link(&cb->old_list, addr);
+       if (!link)
+               return -1;
+
+       if (tb[WPROBE_ATTR_FLAGS])
+               link->flags = nla_get_u32(tb[WPROBE_ATTR_FLAGS]);
+
+       list_add_tail(&link->list, cb->list);
+       return 0;
+}
+
+
+int
+wprobe_update_links(struct wprobe_iface *dev)
+{
+       struct wprobe_link *l, *tmp;
+       struct nl_msg *msg;
+       struct wprobe_save_cb cb;
+       int err;
+
+       INIT_LIST_HEAD(&cb.old_list);
+       list_splice_init(&dev->links, &cb.old_list);
+       cb.list = &dev->links;
+
+       msg = wprobe_new_msg(dev, WPROBE_CMD_GET_LINKS, true);
+       if (!msg)
+               return -ENOMEM;
+
+       err = dev->ops->send_msg(dev, msg, save_link_handler, &cb);
+       if (err < 0)
+               return err;
+
+       list_for_each_entry_safe(l, tmp, &cb.old_list, list) {
+               list_del(&l->list);
+               free(l);
+       }
+
+       return 0;
+}
+
+
+struct wprobe_filter_data
+{
+       wprobe_filter_cb cb;
+       void *arg;
+       struct wprobe_filter_item *buf;
+       int buflen;
+};
+
+static int
+dump_filter_handler(struct nl_msg *msg, void *arg)
+{
+       struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+       struct wprobe_filter_data *data = arg;
+       struct nlattr *p;
+       const char *name;
+       int count = 0;
+       int len;
+
+       nla_parse(tb, WPROBE_ATTR_LAST, genlmsg_attrdata(gnlh, 0),
+                       genlmsg_attrlen(gnlh, 0), attribute_policy);
+
+       if (!tb[WPROBE_ATTR_NAME] || !tb[WPROBE_ATTR_FILTER_GROUP])
+               return -1;
+
+       name = nla_data(tb[WPROBE_ATTR_NAME]);
+       nla_for_each_nested(p, tb[WPROBE_ATTR_FILTER_GROUP], len) {
+               count++;
+       }
+
+       if (data->buflen < count) {
+               if (data->buf)
+                       free(data->buf);
+               data->buflen = count;
+               data->buf = malloc(sizeof(struct wprobe_filter_item) * count);
+               memset(data->buf, 0, sizeof(struct wprobe_filter_item) * count);
+       }
+
+       count = 0;
+       nla_for_each_nested(p, tb[WPROBE_ATTR_FILTER_GROUP], len) {
+               struct wprobe_filter_item *fi;
+
+               nla_parse(tb, WPROBE_ATTR_LAST, nla_data(p),
+                               nla_len(p), attribute_policy);
+
+               if (!tb[WPROBE_ATTR_NAME] || !tb[WPROBE_ATTR_RXCOUNT]
+                               || !tb[WPROBE_ATTR_TXCOUNT])
+                       continue;
+
+               fi = &data->buf[count++];
+               strncpy(fi->name, nla_data(tb[WPROBE_ATTR_NAME]), sizeof(fi->name) - 1);
+               fi->name[sizeof(fi->name) - 1] = 0;
+               fi->rx = nla_get_u64(tb[WPROBE_ATTR_RXCOUNT]);
+               fi->tx = nla_get_u64(tb[WPROBE_ATTR_TXCOUNT]);
+       }
+       data->cb(data->arg, name, data->buf, count);
+
+       return 0;
+}
+
+int
+wprobe_dump_filters(struct wprobe_iface *dev, wprobe_filter_cb cb, void *arg)
+{
+       struct wprobe_filter_data data;
+       struct nl_msg *msg;
+       int err;
+
+       data.buf = 0;
+       data.buflen = 0;
+       data.cb = cb;
+       data.arg = arg;
+
+       msg = wprobe_new_msg(dev, WPROBE_CMD_GET_FILTER, true);
+       if (!msg)
+               return -ENOMEM;
+
+       err = dev->ops->send_msg(dev, msg, dump_filter_handler, &data);
+       if (err < 0)
+               return err;
+
+       return 0;
+}
+
+int
+wprobe_apply_config(struct wprobe_iface *dev)
+{
+       struct nl_msg *msg;
+
+       msg = wprobe_new_msg(dev, WPROBE_CMD_CONFIG, false);
+       if (!msg)
+               return -ENOMEM;
+
+       if (dev->interval >= 0)
+               NLA_PUT_MSECS(msg, WPROBE_ATTR_INTERVAL, dev->interval);
+
+       if (dev->filter_len < 0) {
+               NLA_PUT(msg, WPROBE_ATTR_FILTER, 0, NULL);
+               dev->filter_len = 0;
+       } else if (dev->filter && dev->filter_len > 0) {
+               NLA_PUT(msg, WPROBE_ATTR_FILTER, dev->filter_len, dev->filter);
+       }
+       dev->filter = NULL;
+
+       dev->ops->send_msg(dev, msg, NULL, NULL);
+       return 0;
+
+nla_put_failure:
+       nlmsg_free(msg);
+       return -ENOMEM;
+}
+
+int
+wprobe_measure(struct wprobe_iface *dev)
+{
+       struct nl_msg *msg;
+
+       msg = wprobe_new_msg(dev, WPROBE_CMD_MEASURE, false);
+       if (!msg)
+               return -ENOMEM;
+
+       dev->ops->send_msg(dev, msg, NULL, NULL);
+       return 0;
+}
+
+struct wprobe_request_cb {
+       struct list_head *list;
+       struct list_head old_list;
+       char *addr;
+};
+
+static int
+save_attrdata_handler(struct nl_msg *msg, void *arg)
+{
+       struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+       struct wprobe_request_cb *cb = arg;
+       struct wprobe_attribute *attr;
+       int type, id;
+
+       nla_parse(tb, WPROBE_ATTR_LAST, genlmsg_attrdata(gnlh, 0),
+                       genlmsg_attrlen(gnlh, 0), attribute_policy);
+
+       if (!tb[WPROBE_ATTR_ID])
+               return -1;
+
+       if (!tb[WPROBE_ATTR_TYPE])
+               return -1;
+
+       id = nla_get_u32(tb[WPROBE_ATTR_ID]);
+       list_for_each_entry(attr, &cb->old_list, list) {
+               if (attr->id == id)
+                       goto found;
+       }
+       /* not found */
+       return -1;
+
+found:
+       list_del_init(&attr->list);
+
+       type = nla_get_u8(tb[WPROBE_ATTR_TYPE]);
+       if (type != attr->type) {
+               DPRINTF("WARNING: type mismatch for %s attribute '%s' (%d != %d)\n",
+                       (cb->addr ? "link" : "global"),
+                       attr->name,
+                       type, attr->type);
+               goto out;
+       }
+
+       if ((type < WPROBE_VAL_STRING) ||
+               (type > WPROBE_VAL_U64))
+               goto out;
+
+       memset(&attr->val, 0, sizeof(attr->val));
+
+#define HANDLE_INT_TYPE(_idx, _type) \
+       case WPROBE_VAL_S##_type: \
+       case WPROBE_VAL_U##_type: \
+               attr->val.U##_type = nla_get_u##_type(tb[_idx]); \
+               break
+
+       switch(type) {
+               HANDLE_INT_TYPE(type, 8);
+               HANDLE_INT_TYPE(type, 16);
+               HANDLE_INT_TYPE(type, 32);
+               HANDLE_INT_TYPE(type, 64);
+               case WPROBE_VAL_STRING:
+                       /* unimplemented */
+                       break;
+       }
+#undef HANDLE_TYPE
+
+       if (attr->flags & WPROBE_F_KEEPSTAT) {
+               if (tb[WPROBE_VAL_SUM])
+                       attr->val.s = nla_get_u64(tb[WPROBE_VAL_SUM]);
+
+               if (tb[WPROBE_VAL_SUM_SQ])
+                       attr->val.ss = nla_get_u64(tb[WPROBE_VAL_SUM_SQ]);
+
+               if (tb[WPROBE_VAL_SAMPLES])
+                       attr->val.n = nla_get_u32(tb[WPROBE_VAL_SAMPLES]);
+
+               if (attr->val.n > 0) {
+                       float avg = ((float) attr->val.s) / attr->val.n;
+                       float stdev = sqrt((((float) attr->val.ss) / attr->val.n) - (avg * avg));
+                       if (isnan(stdev))
+                               stdev = 0.0f;
+                       if (isnan(avg))
+                               avg = 0.0f;
+                       attr->val.avg = avg;
+                       attr->val.stdev = stdev;
+               }
+       }
+
+out:
+       list_add_tail(&attr->list, cb->list);
+       return 0;
+}
+
+
+int
+wprobe_request_data(struct wprobe_iface *dev, const unsigned char *addr)
+{
+       struct wprobe_request_cb cb;
+       struct list_head *attrs;
+       struct nl_msg *msg;
+       int err;
+
+       msg = wprobe_new_msg(dev, WPROBE_CMD_GET_INFO, true);
+       if (!msg)
+               return -ENOMEM;
+
+       if (addr) {
+               attrs = &dev->link_attr;
+               NLA_PUT(msg, WPROBE_ATTR_MAC, 6, addr);
+       } else {
+               attrs = &dev->global_attr;
+       }
+
+       INIT_LIST_HEAD(&cb.old_list);
+       list_splice_init(attrs, &cb.old_list);
+       cb.list = attrs;
+
+       err = dev->ops->send_msg(dev, msg, save_attrdata_handler, &cb);
+       list_splice(&cb.old_list, attrs->prev);
+       return err;
+
+nla_put_failure:
+       nlmsg_free(msg);
+       return -ENOMEM;
+}
+
+
diff --git a/net/wprobe/src/user/wprobe-util.c b/net/wprobe/src/user/wprobe-util.c
new file mode 100644 (file)
index 0000000..654442f
--- /dev/null
@@ -0,0 +1,450 @@
+/*
+ * wprobe-test.c: Wireless probe user space test code
+ * Copyright (C) 2008-2009 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <stdint.h>
+#include <getopt.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <netdb.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include <linux/wprobe.h>
+#include "wprobe.h"
+
+static bool simple_mode = false;
+
+static const char *
+wprobe_dump_value(struct wprobe_attribute *attr)
+{
+       static char buf[128];
+
+#define HANDLE_TYPE(_type, _format) \
+       case WPROBE_VAL_##_type: \
+               snprintf(buf, sizeof(buf), _format, attr->val._type); \
+               break
+
+       switch(attr->type) {
+               HANDLE_TYPE(S8, "%d");
+               HANDLE_TYPE(S16, "%d");
+               HANDLE_TYPE(S32, "%d");
+               HANDLE_TYPE(S64, "%lld");
+               HANDLE_TYPE(U8, "%d");
+               HANDLE_TYPE(U16, "%d");
+               HANDLE_TYPE(U32, "%d");
+               HANDLE_TYPE(U64, "%lld");
+               case WPROBE_VAL_STRING:
+                       /* FIXME: implement this */
+               default:
+                       strncpy(buf, "<unknown>", sizeof(buf));
+                       break;
+       }
+       if ((attr->flags & WPROBE_F_KEEPSTAT) &&
+               (attr->val.n > 0)) {
+               int len = strlen(buf);
+               if (simple_mode)
+                       snprintf(buf + len, sizeof(buf) - len, ";%.02f;%.02f;%d;%lld;%lld", attr->val.avg, attr->val.stdev, attr->val.n, attr->val.s, attr->val.ss);
+               else
+                       snprintf(buf + len, sizeof(buf) - len, " (avg: %.02f; stdev: %.02f, n=%d)", attr->val.avg, attr->val.stdev, attr->val.n);
+       }
+#undef HANDLE_TYPE
+
+       return buf;
+}
+
+
+static void
+wprobe_dump_data(struct wprobe_iface *dev)
+{
+       struct wprobe_attribute *attr;
+       struct wprobe_link *link;
+       bool first = true;
+
+       if (!simple_mode)
+               fprintf(stdout, "\n");
+       wprobe_request_data(dev, NULL);
+       list_for_each_entry(attr, &dev->global_attr, list) {
+               if (simple_mode) {
+                       if (first)
+                               fprintf(stdout, "[global]\n");
+                       fprintf(stdout, "%s=%s\n", attr->name, wprobe_dump_value(attr));
+               } else {
+                       fprintf(stdout, (first ?
+                               "Global:            %s=%s\n" :
+                               "                   %s=%s\n"),
+                               attr->name,
+                               wprobe_dump_value(attr)
+                       );
+               }
+               first = false;
+       }
+
+       list_for_each_entry(link, &dev->links, list) {
+               first = true;
+               wprobe_request_data(dev, link->addr);
+               list_for_each_entry(attr, &dev->link_attr, list) {
+                       if (first) {
+                               fprintf(stdout,
+                                       (simple_mode ?
+                                        "[%02x:%02x:%02x:%02x:%02x:%02x]\n%s=%s\n" :
+                                        "%02x:%02x:%02x:%02x:%02x:%02x: %s=%s\n"),
+                                       link->addr[0], link->addr[1], link->addr[2],
+                                       link->addr[3], link->addr[4], link->addr[5],
+                                       attr->name,
+                                       wprobe_dump_value(attr));
+                               first = false;
+                       } else {
+                               fprintf(stdout,
+                                       (simple_mode ? "%s=%s\n" :
+                                        "                   %s=%s\n"),
+                                       attr->name,
+                                       wprobe_dump_value(attr));
+                       }
+               }
+       }
+       fflush(stdout);
+}
+
+static const char *attr_typestr[] = {
+       [0] = "Unknown",
+       [WPROBE_VAL_STRING] = "String",
+       [WPROBE_VAL_U8] = "Unsigned 8 bit",
+       [WPROBE_VAL_U16] = "Unsigned 16 bit",
+       [WPROBE_VAL_U32] = "Unsigned 32 bit",
+       [WPROBE_VAL_U64] = "Unsigned 64 bit",
+       [WPROBE_VAL_S8] = "Signed 8 bit",
+       [WPROBE_VAL_S16] = "Signed 16 bit",
+       [WPROBE_VAL_S32] = "Signed 32 bit",
+       [WPROBE_VAL_S64] = "Signed 64 bit",
+};
+
+static int usage(const char *prog)
+{
+       fprintf(stderr,
+#ifndef NO_LOCAL_ACCESS
+               "Usage: %s <interface>|<host>:<device>|-P [options]\n"
+#else
+               "Usage: %s <host>:<device> [options]\n"
+#endif
+               "\n"
+               "Options:\n"
+               "  -a:            Print attributes\n"
+               "  -c:            Only apply configuration\n"
+               "  -d:            Delay between measurement dumps (in milliseconds, default: 1000)\n"
+               "                 A value of 0 (zero) prints once and exits; useful for scripts\n"
+               "  -f:            Dump contents of layer 2 filter counters during measurement\n"
+               "  -F <file>:     Apply layer 2 filters from <file>\n"
+               "  -h:            This help text\n"
+               "  -i <interval>: Set measurement interval\n"
+               "  -m:            Run measurement loop\n"
+               "  -p:            Set the TCP port for server/client (default: 17990)\n"
+#ifndef NO_LOCAL_ACCESS
+               "  -P:            Run in proxy mode (listen on network)\n"
+#endif
+               "\n"
+               , prog);
+       exit(1);
+}
+
+static void show_attributes(struct wprobe_iface *dev)
+{
+       struct wprobe_attribute *attr;
+       if (simple_mode)
+               return;
+       list_for_each_entry(attr, &dev->global_attr, list) {
+               fprintf(stdout, "Global attribute: '%s' (%s)\n",
+                       attr->name, attr_typestr[attr->type]);
+       }
+       list_for_each_entry(attr, &dev->link_attr, list) {
+               fprintf(stdout, "Link attribute: '%s' (%s)\n",
+                       attr->name, attr_typestr[attr->type]);
+       }
+}
+
+static void show_filter_simple(void *arg, const char *group, struct wprobe_filter_item *items, int n_items)
+{
+       int i;
+
+       fprintf(stdout, "[filter:%s]\n", group);
+       for (i = 0; i < n_items; i++) {
+               fprintf(stdout, "%s=%lld;%lld\n",
+                       items[i].name, items[i].tx, items[i].rx);
+       }
+       fflush(stdout);
+}
+
+
+static void show_filter(void *arg, const char *group, struct wprobe_filter_item *items, int n_items)
+{
+       int i;
+       fprintf(stdout, "Filter group: '%s' (tx/rx)\n", group);
+       for (i = 0; i < n_items; i++) {
+               fprintf(stdout, " - %s (%lld/%lld)\n",
+                       items[i].name, items[i].tx, items[i].rx);
+       }
+}
+
+static void loop_measurement(struct wprobe_iface *dev, bool print_filters, unsigned long delay)
+{
+       do {
+               wprobe_update_links(dev);
+               wprobe_dump_data(dev);
+               if (print_filters)
+                       wprobe_dump_filters(dev, simple_mode ? show_filter_simple : show_filter, NULL);
+               usleep(delay * 1000);
+       }
+       while (delay);
+}
+
+static void set_filter(struct wprobe_iface *dev, const char *filename)
+{
+       unsigned char *buf = NULL;
+       unsigned int buflen = 0;
+       unsigned int len = 0;
+       int fd;
+
+       /* clear filter */
+       if (filename[0] == 0) {
+               dev->filter_len = -1;
+               return;
+       }
+
+       fd = open(filename, O_RDONLY);
+       if (fd < 0) {
+               perror("open filter");
+               return;
+       }
+
+       do {
+               int rlen;
+
+               if (!buf) {
+                       len = 0;
+                       buflen = 1024;
+                       buf = malloc(1024);
+               } else {
+                       buflen *= 2;
+                       buf = realloc(buf, buflen);
+               }
+               rlen = read(fd, buf + len, buflen - len);
+               if (rlen < 0)
+                       break;
+
+               len += rlen;
+       } while (len == buflen);
+
+       dev->filter = buf;
+       dev->filter_len = len;
+       close(fd);
+}
+
+#ifndef NO_LOCAL_ACCESS
+
+static void sigchld_handler(int s)
+{
+       while (waitpid(-1, NULL, WNOHANG) > 0);
+}
+
+static int run_proxy(int port)
+{
+       struct sockaddr_in sa;
+       struct sigaction sig;
+       int v = 1;
+       int s;
+
+       s = socket(AF_INET, SOCK_STREAM, 0);
+       if (s < 0) {
+               perror("socket");
+               return 1;
+       }
+
+       sig.sa_handler = sigchld_handler;  // Signal Handler fuer Zombie Prozesse
+       sigemptyset(&sig.sa_mask);
+       sig.sa_flags = SA_RESTART;
+       sigaction(SIGCHLD, &sig, NULL);
+
+       memset(&sa, 0, sizeof(sa));
+       sa.sin_family = AF_INET;
+       sa.sin_addr.s_addr = htonl(INADDR_ANY);
+       sa.sin_port = htons(wprobe_port);
+
+       setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(v));
+       if (bind(s, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
+               perror("bind");
+               return 1;
+       }
+       if (listen(s, 10)) {
+               perror("listen");
+               return 1;
+       }
+       while(1) {
+               unsigned int addrlen = sizeof(struct sockaddr_in);
+               int ret, c;
+
+               c = accept(s, (struct sockaddr *)&sa, &addrlen);
+               if (c < 0) {
+                       if (errno == EINTR)
+                               continue;
+
+                       perror("accept");
+                       return 1;
+               }
+               if (fork() == 0) {
+                       /* close server socket, stdin, stdout, stderr */
+                       close(s);
+                       close(0);
+                       close(1);
+                       close(2);
+
+                       wprobe_server_init(c);
+                       do {
+                               ret = wprobe_server_handle(c);
+                       } while (ret >= 0);
+                       wprobe_server_done();
+                       close(c);
+                       exit(0);
+               }
+               close(c);
+       }
+
+       return 0;
+}
+#endif
+
+int main(int argc, char **argv)
+{
+       struct wprobe_iface *dev = NULL;
+       const char *ifname;
+       const char *prog = argv[0];
+       char *err = NULL;
+       enum {
+               CMD_NONE,
+               CMD_CONFIG,
+               CMD_MEASURE,
+               CMD_PROXY,
+       } cmd = CMD_NONE;
+       const char *filter = NULL;
+       bool print_attributes = false;
+       bool print_filters = false;
+       unsigned long delay = 1000;
+       int interval = -1;
+       int ch;
+
+       if (argc < 2)
+               return usage(prog);
+
+#ifndef NO_LOCAL_ACCESS
+       if (!strcmp(argv[1], "-P")) {
+               while ((ch = getopt(argc - 1, argv + 1, "p:")) != -1) {
+                       switch(ch) {
+                       case 'p':
+                               /* set port */
+                               wprobe_port = strtoul(optarg, NULL, 0);
+                               break;
+                       default:
+                               return usage(prog);
+                       }
+               }
+               return run_proxy(wprobe_port);
+       }
+#endif
+
+       if (argv[1][0] == '-')
+               return usage(prog);
+
+       ifname = argv[1];
+       argv++;
+       argc--;
+
+       while ((ch = getopt(argc, argv, "acd:fF:hi:msp:")) != -1) {
+               switch(ch) {
+               case 'a':
+                       print_attributes = true;
+                       break;
+               case 'c':
+                       cmd = CMD_CONFIG;
+                       break;
+               case 'd':
+                       delay = strtoul(optarg, NULL, 10);
+                       break;
+               case 'm':
+                       cmd = CMD_MEASURE;
+                       break;
+               case 'i':
+                       interval = strtoul(optarg, NULL, 10);
+                       break;
+               case 'f':
+                       print_filters = true;
+                       break;
+               case 'F':
+                       if (filter) {
+                               fprintf(stderr, "Cannot set multiple filters\n");
+                               return usage(prog);
+                       }
+                       filter = optarg;
+                       break;
+               case 's':
+                       simple_mode = true;
+                       break;
+               case 'p':
+                       /* set port */
+                       wprobe_port = strtoul(optarg, NULL, 0);
+                       break;
+               case 'h':
+               default:
+                       usage(prog);
+                       break;
+               }
+       }
+
+       dev = wprobe_get_auto(ifname, &err);
+       if (!dev || (list_empty(&dev->global_attr) &&
+               list_empty(&dev->link_attr))) {
+               if (err)
+                       fprintf(stdout, "%s\n", err);
+               else
+                       fprintf(stderr, "Interface '%s' not found\n", ifname);
+               return 1;
+       }
+
+       if (filter || interval >= 0) {
+               if (filter)
+                       set_filter(dev, filter);
+               if (interval >= 0)
+                       dev->interval = interval;
+
+               wprobe_apply_config(dev);
+       }
+
+       if (cmd != CMD_CONFIG) {
+               if (print_attributes)
+                       show_attributes(dev);
+       }
+       if (cmd == CMD_MEASURE)
+               loop_measurement(dev, print_filters, delay);
+
+       wprobe_free_dev(dev);
+
+       return 0;
+}
diff --git a/net/wprobe/src/user/wprobe.h b/net/wprobe/src/user/wprobe.h
new file mode 100644 (file)
index 0000000..706facc
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ * wprobe.h: Wireless probe user space library
+ * Copyright (C) 2008-2009 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __WPROBE_USER_H
+#define __WPROBE_USER_H
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include "list.h"
+
+/**
+ * struct wprobe_value: data structure for attribute values
+ * @STRING: string value (currently unsupported)
+ * @U8: unsigned 8-bit integer value
+ * @U16: unsigned 16-bit integer value
+ * @U32: unsigned 32-bit integer value
+ * @U64: unsigned 64-bit integer value
+ * @S8: signed 8-bit integer value
+ * @S16: signed 16-bit integer value
+ * @S32: signed 32-bit integer value
+ * @S64: signed 64-bit integer value
+ *
+ * @n: number of sample values 
+ * @avg: average value
+ * @stdev: standard deviation
+ * @s: sum of all sample values (internal use)
+ * @ss: sum of all sample values squared (internal use)
+ */
+struct wprobe_value {
+       /* attribute value */
+       union {
+               const char *STRING;
+               uint8_t U8;
+               uint16_t U16;
+               uint32_t U32;
+               uint64_t U64;
+               int8_t S8;
+               int16_t S16;
+               int32_t S32;
+               int64_t S64;
+       };
+       /* statistics */
+       int64_t s, ss;
+       float avg, stdev;
+       unsigned int n;
+};
+
+/**
+ * struct wprobe_attribute: data structures for attribute descriptions
+ * @list: linked list data structure for a list of attributes
+ * @id: attribute id
+ * @type: netlink type for the attribute (see kernel api documentation)
+ * @flags: attribute flags (see kernel api documentation)
+ * @val: cached version of the last netlink query, will be overwritten on each request
+ * @name: attribute name
+ */
+struct wprobe_attribute {
+       struct list_head list;
+       int id;
+       int type;
+       uint32_t flags;
+       struct wprobe_value val;
+       char name[];
+};
+
+/**
+ * struct wprobe_link: data structure for the link description
+ * @list: linked list data structure for a list of links 
+ * @flags: link flags (see kernel api documentation)
+ * @addr: mac address of the remote link partner
+ */
+struct wprobe_link {
+       struct list_head list;
+       uint32_t flags;
+       unsigned char addr[6];
+};
+
+struct wprobe_filter_item {
+       char name[32];
+       uint64_t rx;
+       uint64_t tx;
+};
+
+struct wprobe_iface_ops;
+struct wprobe_iface {
+       const struct wprobe_iface_ops *ops;
+
+       int sockfd;
+       const char *ifname;
+       unsigned int genl_family;
+       char addr[6];
+
+       struct list_head global_attr;
+       struct list_head link_attr;
+       struct list_head links;
+
+       /* config */
+       int interval;
+       int scale_min;
+       int scale_max;
+       int scale_m;
+       int scale_d;
+
+       /* filter */
+       void *filter;
+
+       /* filter_len:
+        *   set to -1 to drop the current filter
+        *   automatically reset to 0 after config apply
+        */
+       int filter_len;
+};
+
+typedef void (*wprobe_filter_cb)(void *arg, const char *group, struct wprobe_filter_item *items, int n_items);
+extern int wprobe_port;
+
+/**
+ * wprobe_update_links: get a list of all link partners
+ * @dev: wprobe device structure
+ * @list: linked list for storing link descriptions
+ *
+ * when wprobe_update_links is called multiple times, the linked list 
+ * is updated with new link partners, old entries are automatically expired
+ */
+extern int wprobe_update_links(struct wprobe_iface *dev);
+
+/**
+ * wprobe_dump_filters: dump all layer 2 filter counters
+ * @dev: wprobe device structure
+ * @cb: callback (called once per filter group)
+ * @arg: user argument for the callback
+ */
+extern int wprobe_dump_filters(struct wprobe_iface *dev, wprobe_filter_cb cb, void *arg);
+
+/**
+ * wprobe_measure: start a measurement request for all global attributes
+ * @dev: wprobe device structure
+ *
+ * not all attributes are automatically filled with data, since for some
+ * it may be desirable to control the sampling interval from user space
+ * you can use this function to do that.
+ */
+extern int wprobe_measure(struct wprobe_iface *dev);
+
+/**
+ * wprobe_get_dev: get a handle to a local wprobe device
+ * @ifname: name of the wprobe interface
+ *
+ * queries the wprobe interface for all attributes
+ * must be freed with wprobe_free_dev
+ */
+extern struct wprobe_iface *wprobe_get_dev(const char *ifname);
+
+/**
+ * wprobe_get_auto: get a handle to a local or remote wprobe device
+ * @arg: pointer to the wprobe device, either <dev> (local) or <host>:<dev> (remote)
+ */
+extern struct wprobe_iface *wprobe_get_auto(const char *arg, char **err);
+
+/**
+ * wprobe_get_dev: free all device information
+ * @dev: wprobe device structure
+ */
+extern void wprobe_free_dev(struct wprobe_iface *dev);
+
+/**
+ * wprobe_apply_config: apply configuration data
+ * @dev: wprobe device structure
+ *
+ * uploads all configuration values from @dev that are not set to -1
+ */
+extern int wprobe_apply_config(struct wprobe_iface *dev);
+
+/**
+ * wprobe_request_data: request new sampling values for the given list of attributes
+ * @dev: wprobe device structure
+ * @addr: (optional) mac address of the link partner
+ *
+ * if addr is unset, global values are stored in the global attributes list
+ * if addr is set, per-link values for the given address are stored in the link attributes list
+ */
+extern int wprobe_request_data(struct wprobe_iface *dev, const unsigned char *addr);
+
+/**
+ * wprobe_server_init: send a wprobe server init message to a server's client socket
+ * @socket: socket of the connection to the client
+ */
+extern int wprobe_server_init(int socket);
+
+/**
+ * wprobe_server_handle: read a request from the client socket, process it, send the response
+ * @socket: socket of the connection to the client
+ */
+extern int wprobe_server_handle(int socket);
+
+/**
+ * wprobe_server_done: release memory allocated for the server connection
+ */
+extern void wprobe_server_done(void);
+
+#endif
diff --git a/net/wput/Makefile b/net/wput/Makefile
new file mode 100644 (file)
index 0000000..d25dd74
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2007-2008 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:=wput
+PKG_VERSION:=0.6.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/wput
+PKG_MD5SUM:=a14c4c13d91d04d6119bdc977e8a8bdf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wput
+  SUBMENU:=File Transfer
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A tiny wget-like ftp-client for uploading files
+  URL:=http://wput.sourceforge.net/
+endef
+
+define Package/wput/description
+ Wput is a tiny ftp-client, that uploads files or directories
+ to a remote ftp-server.  Main features are: resuming,
+ time-stamping, wget-like interface, proxy-support and
+ speed-limit.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-g-switch \
+       --without-ssl \
+
+define Package/wput/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wput $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,wput))
diff --git a/net/wput/patches/100-socketlib.diff b/net/wput/patches/100-socketlib.diff
new file mode 100644 (file)
index 0000000..b5acafe
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/src/socketlib.c
++++ b/src/socketlib.c
+@@ -392,17 +392,15 @@ int socket_is_data_readable(int s, int t
+ wput_socket * socket_timeout_connect(wput_socket * sock, struct sockaddr *remote_addr, size_t size, int timeout) {
+   int c = 0;
+   printout(vDEBUG, "initiating timeout connect (%d)\n", timeout);
+-#ifdef WIN32
+   /* reset errno before connecting. otherwise connection might "fail" for:
+    * no such file or directory ;) */
+   errno = 0;
+-#endif
+-  socket_set_blocking(sock->fd, 0);
++  socket_set_blocking(sock->fd, 1);
+   c = connect(sock->fd,remote_addr,size);
+   /* here was a check also for errno != 36 (FILENAMETOOLONG)
+    * maybe this was EINPROGRESS on another system? */
+   if(errno > 0 && errno != EINPROGRESS) {
+-      printout(vMORE, "[%s]", strerror(errno));
++      printout(vMORE, "[%d:%s] ", errno, strerror(errno));
+       return NULL;
+   }
+   /* DEBUG if(c == -1) perror("connect"); */
diff --git a/net/wput/patches/102-wput.diff b/net/wput/patches/102-wput.diff
new file mode 100644 (file)
index 0000000..19629b5
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/src/wput.c
++++ b/src/wput.c
+@@ -621,8 +621,8 @@ void commandlineoptions(int argc, char *
+               {"output-file", 1, 0, 'o'},     
+               {"port-mode", 0, 0, 'p'},       
+               {"proxy", 1, 0, 'Y'},           
+-              {"proxy-user", 1, 0, 0},
+-              {"proxy-pass", 1, 0, 0},         //20
++              {"proxy_user", 1, 0, 0},
++              {"proxy_pass", 1, 0, 0},         //20
+               {"quiet", 0, 0, 'q'},           
+               {"random-wait", 0, 0, 0},       
+               {"remove-source-files", 0, 0, 'R'},
+@@ -642,7 +642,9 @@ void commandlineoptions(int argc, char *
+               {"waitretry", 1, 0, 0},         
+               {"chmod", 1, 0, 'm'},
+               {"disable-tls", 0, 0, 0},
+-              {0, 0, 0, 0}                    //40
++              {"proxy_host", 1, 0, 0},         //40
++              {"proxy_port", 1, 0, 0},
++              {0, 0, 0, 0}
+       };
+     while (1)
+     {
+@@ -699,6 +701,10 @@ void commandlineoptions(int argc, char *
+                 opt.retry_interval = atoi(optarg);                  break;
+           case 39: //disable-tls
+                   opt.tls = 2;                                    break;
++            case 40: //proxy_host
++                set_option("proxy_host", optarg);                   break;
++            case 41: //proxy_port
++                set_option("proxy_port", optarg);                   break;
+             default:
+                 fprintf(stderr, _("Option %s should not appear here :|\n"), long_options[option_index].name);
+             }
+@@ -806,8 +812,10 @@ void commandlineoptions(int argc, char *
+ "  -l,  --limit-rate=RATE       limit upload rate to RATE\n"
+ "  -nd, --no-directories        do not create any directories\n"
+ "  -Y,  --proxy=http/socks/off  set proxy type or turn off\n"
+-"       --proxy-user=NAME       set the proxy-username to NAME\n"
+-"       --proxy-pass=PASS       set the proxy-password to PASS\n"
++"       --proxy_user=NAME       set the proxy-username to NAME\n"
++"       --proxy_pass=PASS       set the proxy-password to PASS\n"
++"       --proxy_port=PORT       set the proxy port to PORT\n"
++"       --proxy_host=HOST       set the proxy host to HOST\n"
+ "\n"));
+                       fprintf(stderr, _(
+ "FTP-Options:\n"
diff --git a/net/wrt-radauth/Makefile b/net/wrt-radauth/Makefile
new file mode 100644 (file)
index 0000000..aeab48c
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2006 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:=wrt-radauth
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.zerfleddert.de/wrt54g/
+PKG_MD5SUM:=1713b96a157f9e209cf7986f38ef57d9
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wrt-radauth
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+kmod-brcm-wl +nvram
+  TITLE:=A Radius MAC authenticator for Broadcom based access points
+  URL:=http://www.zerfleddert.de/wrt54g/
+endef
+
+define Package/wrt-radauth/description
+       This software watches the stations associating to a broadcom based
+       AccessPoint (e.g. Linksys WRT54G) and sends an authentication request
+       to the radius-server specified in nvram.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) clean
+       $(call Build/Compile/Default, \
+               CFLAGS="$(EXTRA_CFLAGS)" \
+               LDFLAGS="$(EXTRA_LDFLAGS)" \
+       )
+endef
+
+define Package/wrt-radauth/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/radius-client $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wrt-radauth $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,wrt-radauth))
diff --git a/net/wrt-radauth/patches/001-ldpath.patch b/net/wrt-radauth/patches/001-ldpath.patch
new file mode 100644 (file)
index 0000000..c740c3f
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN wrt-radauth/Makefile wrt-radauth.new/Makefile
+--- wrt-radauth/Makefile       2007-01-07 20:05:21.000000000 +0100
++++ wrt-radauth.new/Makefile   2008-04-01 22:50:09.000000000 +0200
+@@ -7,7 +7,7 @@
+ all: wrt-radauth radius-client
+ wrt-radauth: wrt-radauth.o md5.o wireless.o radius.o
+-      $(CC) $(LDFLAGS) -L$(WRT_BUILDROOT)/build_mipsel/root/usr/lib -lshared -lnvram $^ -o $@
++      $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -L$(STAGING_DIR)/usr/lib -lnvram $(STAGING_DIR)/usr/lib/libshared.a
+ radius-client: radius-client.o md5.o radius.o
diff --git a/net/xsupplicant/Makefile b/net/xsupplicant/Makefile
new file mode 100644 (file)
index 0000000..64ee2c5
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2006-2009 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:=xsupplicant
+PKG_VERSION:=1.2.8
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/open1x
+PKG_MD5SUM:=75f89731b905eb8d36a52621661e1226
+
+PKG_BUILD_DEPENDS:=PACKAGE_kmod-madwifi:madwifi
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xsupplicant
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=wireless
+  DEPENDS:=+libopenssl +libiw
+  TITLE:=A fully compliant 802.1x authenticator
+  URL:=http://open1x.sourceforge.net/
+endef
+
+define Package/xsupplicant/description
+ This software allows a GNU/Linux or BSD workstation to authenticate with
+ a RADIUS server using 802.1x and various EAP protocols.
+endef
+
+define Package/xsupplicant/conffiles
+/etc/xsupplicant.conf
+endef
+
+TARGET_CFLAGS += --std=gnu99
+
+CONFIGURE_ARGS+= \
+       --with-openssl="$(STAGING_DIR)/usr" \
+       --with-madwifi-path="$(STAGING_DIR)/usr/include/madwifi" \
+
+CONFIGURE_VARS+= \
+       CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/madwifi" \
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               aclocal.m4 \
+               Makefile.in \
+               configure \
+       );
+endef
+
+define Package/xsupplicant/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/xsupplicant.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/xsup_* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xsupplicant $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,xsupplicant))
diff --git a/net/xsupplicant/patches/001-no-lfl.patch b/net/xsupplicant/patches/001-no-lfl.patch
new file mode 100644 (file)
index 0000000..7110814
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure
++++ b/configure
+@@ -3259,7 +3259,7 @@ if test "$LEX" = :; then
+ fi
+  if test -n "$LEX"; then
+        LFLAGS="$LFLAGS -i"
+-       MORELIBS="${MORELIBS} -lfl"
++
+  fi
+ ac_ext=c
+--- a/configure.in
++++ b/configure.in
+@@ -18,7 +18,7 @@ AC_PROG_YACC
+ AM_PROG_LEX
+  if test -n "$LEX"; then
+        LFLAGS="$LFLAGS -i"
+-       MORELIBS="${MORELIBS} -lfl"
++
+  fi 
+ AC_HEADER_STDC
diff --git a/net/xsupplicant/patches/002-disable-procfs-check.patch b/net/xsupplicant/patches/002-disable-procfs-check.patch
new file mode 100644 (file)
index 0000000..2c7177a
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure
++++ b/configure
+@@ -5362,19 +5362,6 @@ _ACEOF
+   FRAMER="generic"
+ fi
+-if test $FRAMER = "linux"; then
+-   echo "$as_me:$LINENO: checking for procfs support" >&5
+-echo $ECHO_N "checking for procfs support... $ECHO_C" >&6
+-   if test -r /proc/net/dev; then
+-      echo "$as_me:$LINENO: result: okay" >&5
+-echo "${ECHO_T}okay" >&6
+-   else
+-      { { echo "$as_me:$LINENO: error: You must have ProcFS enabled in your kernel!" >&5
+-echo "$as_me: error: You must have ProcFS enabled in your kernel!" >&2;}
+-   { (exit 1); exit 1; }; };
+-   fi
+-fi
+-
+ CFLAGS="$GGDBFLAGS $CFLAGS"
+ touch Makefile.in
diff --git a/net/xsupplicant/patches/003-compile_fix.patch b/net/xsupplicant/patches/003-compile_fix.patch
new file mode 100644 (file)
index 0000000..30fe2c6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/lib/libxsupgui/Makefile.in
++++ b/lib/libxsupgui/Makefile.in
+@@ -91,7 +91,7 @@ install_sh = @install_sh@
+ with_openssl_libs = @with_openssl_libs@
+ AUTOMAKE_OPTIONS = foreign no-dependencies
+-INCLUDES = ${top_srcdir}/src
++INCLUDES = -I${top_srcdir}/src
+ include_HEADERS = xsupgui.h
+ lib_LIBRARIES = libxsupgui.a
diff --git a/net/xsupplicant/patches/005-no_private_linux_header_includes.patch b/net/xsupplicant/patches/005-no_private_linux_header_includes.patch
new file mode 100644 (file)
index 0000000..3caf928
--- /dev/null
@@ -0,0 +1,48 @@
+Index: xsupplicant-1.2.8/src/cardif/linux/cardif_atmel_driver.c
+===================================================================
+--- xsupplicant-1.2.8.orig/src/cardif/linux/cardif_atmel_driver.c      2006-10-08 05:42:53.000000000 +0200
++++ xsupplicant-1.2.8/src/cardif/linux/cardif_atmel_driver.c   2009-01-11 02:59:46.998587770 +0100
+@@ -103,7 +103,6 @@
+ #include <sys/ioctl.h>
+ #include <linux/types.h>
+ #include <linux/socket.h>
+-#include <linux/compiler.h>
+ #include <iwlib.h>
+ #include <stdlib.h>
+ #include <string.h>
+Index: xsupplicant-1.2.8/src/cardif/linux/cardif_linux.c
+===================================================================
+--- xsupplicant-1.2.8.orig/src/cardif/linux/cardif_linux.c     2006-10-08 05:42:53.000000000 +0200
++++ xsupplicant-1.2.8/src/cardif/linux/cardif_linux.c  2009-01-11 03:00:04.496300396 +0100
+@@ -174,7 +174,6 @@
+ #include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/socket.h>
+-#include <linux/compiler.h>
+ #include <iwlib.h>
+ #include <linux/if_packet.h>
+ #include <stdio.h>
+Index: xsupplicant-1.2.8/src/cardif/linux/cardif_linux_rtnetlink.c
+===================================================================
+--- xsupplicant-1.2.8.orig/src/cardif/linux/cardif_linux_rtnetlink.c   2006-10-08 05:42:53.000000000 +0200
++++ xsupplicant-1.2.8/src/cardif/linux/cardif_linux_rtnetlink.c        2009-01-11 03:00:14.997328194 +0100
+@@ -203,7 +203,6 @@
+ #include <unistd.h>
+ #include <sys/socket.h>
+-#include <linux/compiler.h>
+ #include <iwlib.h>
+ #include <sys/ioctl.h>
+ #include "netlink.h"
+Index: xsupplicant-1.2.8/src/cardif/linux/cardif_linux_wext.c
+===================================================================
+--- xsupplicant-1.2.8.orig/src/cardif/linux/cardif_linux_wext.c        2009-01-11 02:58:02.000000000 +0100
++++ xsupplicant-1.2.8/src/cardif/linux/cardif_linux_wext.c     2009-01-11 03:00:26.230427636 +0100
+@@ -203,7 +203,6 @@
+ #include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/socket.h>
+-#include <linux/compiler.h>
+ #include <linux/wireless.h>
+ #include <iwlib.h>
+ #include <linux/if_packet.h>
diff --git a/net/xsupplicant/patches/006-no_wireless_h.patch b/net/xsupplicant/patches/006-no_wireless_h.patch
new file mode 100644 (file)
index 0000000..378e21f
--- /dev/null
@@ -0,0 +1,61 @@
+--- a/src/cardif/linux/cardif_atmel_driver.c
++++ b/src/cardif/linux/cardif_atmel_driver.c
+@@ -109,7 +109,6 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <stdint.h>
+-#include <linux/wireless.h>
+ #ifdef USE_EFENCE
+ #include <efence.h>
+--- a/src/cardif/linux/cardif_linux.c
++++ b/src/cardif/linux/cardif_linux.c
+@@ -180,7 +180,6 @@
+ #include <errno.h>
+ #include <unistd.h>
+ #include <linux/rtnetlink.h>
+-#include <linux/wireless.h>
+ #include "xsupconfig.h"
+ #include "profile.h"
+--- a/src/cardif/linux/cardif_linux_rtnetlink.c
++++ b/src/cardif/linux/cardif_linux_rtnetlink.c
+@@ -207,10 +207,8 @@
+ #include <sys/ioctl.h>
+ #include "netlink.h"
+ #include "rtnetlink.h"
+-#include <linux/if.h>
+ #include <linux/if_packet.h>
+ #include <math.h>
+-#include <linux/wireless.h>
+ #include "profile.h"
+ #include "xsupconfig.h"
+--- a/src/cardif/linux/cardif_linux_wext.c
++++ b/src/cardif/linux/cardif_linux_wext.c
+@@ -203,7 +203,6 @@
+ #include <netinet/in.h>
+ #include <linux/types.h>
+ #include <linux/socket.h>
+-#include <linux/wireless.h>
+ #include <iwlib.h>
+ #include <linux/if_packet.h>
+ #include <linux/netlink.h>
+--- a/configure
++++ b/configure
+@@ -4759,7 +4759,6 @@ cat >>conftest.$ac_ext <<_ACEOF
+    #ifndef __user
+    #define __user
+    #endif
+-   #include <linux/wireless.h>
+ #include <$ac_header>
+ _ACEOF
+@@ -4823,7 +4822,6 @@ cat >>conftest.$ac_ext <<_ACEOF
+                  #ifndef __user
+                  #define __user
+                  #endif
+-                   #include <linux/wireless.h>
+                    #include <iwlib.h>
+ int
+ main ()
diff --git a/net/yaddns/Makefile b/net/yaddns/Makefile
new file mode 100644 (file)
index 0000000..0f3d8b1
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2006-2012 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:=yaddns
+PKG_VERSION:=1.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.gna.org/yaddns/
+PKG_MD5SUM:=d8b6ed9bed61dabaa17188d831e352d1
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/yaddns
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+USE_EGLIBC:librt
+  SUBMENU:=IP Addresses and Names
+  TITLE:=Yet Another DDNS client
+  URL:=http://patatrac.info/yaddns
+endef
+
+define Package/yaddns/description
+Yaddns is a small ddns client with multiple ddns server supports (dyndns, ...)
+and a high flexibility. Yaddns is particularly appropriate for embedded systems.
+endef
+
+define Package/yaddns/conffiles
+/etc/config/ddns
+endef
+
+define Package/yaddns/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/yaddns $(1)/usr/bin/
+       $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,yaddns))
diff --git a/net/yaddns/files/etc/config/ddns b/net/yaddns/files/etc/config/ddns
new file mode 100644 (file)
index 0000000..2fac1de
--- /dev/null
@@ -0,0 +1,67 @@
+#################################################################
+# In order to enable dynamic dns you need at least one section, and in that
+# seciton the "enabled" option must be set to one
+# 
+# Each section represents an update to a different service
+#
+# You specify your domain name, your username and your password with the optins
+# "domain", "username" and "password" respectively
+#
+# Next you need to specify the name of the service you are connecting to "eg.
+# dyndns".  The list of the available dns services is specified in the
+# /usr/lib/ddns/services file.
+#
+# We also need to specify the source of the ip address to associate with your
+# domain.  The "ip_source" option can be "network", "interface" or "web", with
+# "network" as the default.  
+#
+# If "ip_source" is "network" you specify a network section in your
+# /etc/network config file (e.g. "wan", which is the default) with the
+# "ip_network" option.  If you specify "wan", you will update with whatever the
+# ip for your wan is.
+# 
+# If "ip_source" is "interface" you specify a hardware interface (e.g. "eth1")
+# and whatever the current ip of this interface is will be associated with the
+# domain when an update is performed.
+#
+# If "ip_source" is "script" you specify a script to obtain ip address.  The
+# "ip_script" option should contain path to your script.
+#
+# The last possibility is that "ip_source" is "web", which means that in order
+# to obtain our ip address we will connect to a website, and the first valid ip
+# address listed on that page will be assumed to be ours.  If you are behind
+# another firewall this is the best option since none of the local networks or
+# interfaces will have the external ip.  The website to connect to is specified
+# by the "ip_url" option.
+#
+# Finally we need to specify how often to check whether we need to check
+# whether the ip address has changed (and if so update it), this is only valid
+# for the "web" method. Use the "check_interval" to specify how often to check
+# whether an update is necessary. Specify the units for this value with the
+# "check_unit" option.  Units can be "days", "hours", "minutes" or "seconds".
+# The default check_interval is 600 seconds, or ten minutes.
+#
+# For yaddns all ip_* options are system-wide and are taken from the first
+# enabled section.
+#
+#########################################################
+
+config service "myddns"
+       option enabled          "0"
+
+       option service_name     "dyndns"
+       option domain           "mypersonaldomain.dyndns.org"
+       option username         "myusername"
+       option password         "mypassword"
+
+       #option ip_source       "network" 
+       #option ip_network      "wan"
+
+       #option ip_source       "interface"
+       #option ip_interface    "eth0.1"
+
+       option ip_source        "web"
+       option ip_url           "http://checkip.dyndns.org"
+       option check_interval   "10"
+       option check_unit       "minutes"
+
diff --git a/net/yaddns/files/etc/hotplug.d/iface/25-ddns b/net/yaddns/files/etc/hotplug.d/iface/25-ddns
new file mode 100644 (file)
index 0000000..2aefc18
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/sh
+
+YADDNS_CONF=/tmp/yaddns.conf
+YADDNS_PID=/var/run/yaddns.pid
+
+prepare_yaddns_conf ()
+{
+       . /lib/functions.sh
+       . /lib/functions/network.sh
+
+       > $YADDNS_CONF
+
+       SECTIONS=""
+       config_cb()
+       {
+               SECTIONS="$SECTIONS $2"
+       }
+       config_load "ddns"
+
+       for section in $SECTIONS; do
+               config_get enabled $section enabled
+               if [ "$enabled" = "1" ]; then
+                       if [ -z "$header_filled" ]; then
+                               config_get ip_source $section ip_source
+                               #if ip source is not defined, assume we want to get ip from wan 
+                               if [ "$ip_source" != "interface" ] && [ "$ip_source" != "web" ]; then
+                                       ip_source="network"
+                               fi
+                               if [ "$ip_source" = "interface" ]; then
+                                       config_get ip_interface $section ip_interface
+                               fi
+                               if [ "$ip_source" = "network" ]; then
+                                       if [ -z "$ip_network" ]; then
+                                               ip_network="wan"
+                                       fi
+                                       network_get_device ip_interface $ip_network
+                               fi
+                               if [ "$ip_source" = "web" ]; then
+                                       config_get ip_url $section ip_url
+                                       config_get check_interval $section check_interval
+                                       config_get check_unit $section check_unit
+                                       if [ -z "$check_interval" ]; then
+                                               check_interval=600
+                                       fi
+                                       if [ -z "$check_unit" ]; then
+                                               check_unit="seconds"
+                                       fi
+                                       if [ -z "$ip_url" ]; then
+                                               ip_url="http://checkip.dyndns.org/"
+                                       fi
+                                       case "$check_unit" in
+                                               "days" )
+                                                       check_interval_seconds=$(($check_interval*60*60*24))
+                                                       ;;
+                                               "hours" )
+                                                       check_interval_seconds=$(($check_interval*60*60))
+                                                       ;;
+                                               "minutes" )
+                                                       check_interval_seconds=$(($check_interval*60))
+                                                       ;;
+                                               "seconds" )
+                                                       check_interval_seconds=$check_interval
+                                                       ;;
+                                               * )
+                                                       #default is hours
+                                                       check_interval_seconds=$(($check_interval*60*60))
+                                                       ;;
+                                       esac
+                                       myip_host="`echo $ip_url | sed 's%.*//\([^:/]*\).*%\1%'`"
+                                       myip_port="`echo $ip_url | sed -n 's%.*//[^:]*:\([0-9]\+\).*%\1%; t m; b; :m p'`"
+                                       if [ -z "$myip_port" ]; then
+                                               myip_port=80
+                                       fi
+                                       myip_path="`echo $ip_url | sed 's%.*//[^/]*\(.*\)%\1%'`"
+                                       if [ -z "$myip_path" ]; then
+                                               myip_path="/"
+                                       fi
+                                       echo mode = \"indirect\" >> $YADDNS_CONF
+                                       echo myip_host = \"$myip_host\" >> $YADDNS_CONF
+                                       echo myip_path = \"$myip_path\" >> $YADDNS_CONF
+                                       echo myip_port = \"$myip_port\" >> $YADDNS_CONF
+                                       echo myip_upint = \"$check_interval_seconds\" >> $YADDNS_CONF
+                               else
+                                       echo mode = \"direct\" >> $YADDNS_CONF
+                                       echo wanifname = \"$ip_interface\" >> $YADDNS_CONF
+                               fi
+                               echo >> $YADDNS_CONF
+                               header_filled=1
+                       fi
+                       config_get service_name $section service_name
+                       config_get domain $section domain
+                       config_get username $section username
+                       config_get password $section password
+                       echo account \{ >> $YADDNS_CONF
+                       echo -e '\tname = '\"$section\" >> $YADDNS_CONF
+                       echo -e '\tservice = '\"$service_name\" >> $YADDNS_CONF
+                       echo -e '\tusername = '\"$username\" >> $YADDNS_CONF
+                       echo -e '\tpassword = '\"$password\" >> $YADDNS_CONF
+                       echo -e '\thostname = '\"$domain\" >> $YADDNS_CONF
+                       echo \} >> $YADDNS_CONF
+               fi
+       done
+}
+
+if [ "$INTERFACE" = "wan" ] && [ "$ACTION" = "ifup" ]
+then
+       prepare_yaddns_conf
+       pid=`pidof yaddns`
+       if [ -z "$pid" ]; then
+               yaddns -f $YADDNS_CONF -p $YADDNS_PID -D
+       else
+               kill -HUP $pid
+       fi
+fi
+
diff --git a/net/yaddns/files/usr/lib/ddns/services b/net/yaddns/files/usr/lib/ddns/services
new file mode 100644 (file)
index 0000000..0bed6e1
--- /dev/null
@@ -0,0 +1,5 @@
+"changeip"
+"dyndns"
+"dyndnsit"
+"no-ip"
+"ovh"
diff --git a/net/yafc/Makefile b/net/yafc/Makefile
new file mode 100644 (file)
index 0000000..f440f2b
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2008-2010 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:=yafc
+PKG_VERSION:=1.1.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=832d074183a36ee15b47553ed5962fce
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/yafc
+  SUBMENU:=File Transfer
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses +libreadline
+  TITLE:=Yafc is yet another ftp client.
+  URL:=http://yafc.sourceforge.net/
+endef
+
+# uses GNU configure
+CONFIGURE_ARGS += \
+       --with-socks=no \
+       --with-socks5=no \
+       --with-krb4=no \
+       --with-krb5=no \
+       --with-gssapi=no
+
+CONFIGURE_VARS += \
+       bash_cv_func_sigsetjmp=missing
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/yafc/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/src/yafc $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,yafc))
diff --git a/skels/Makefile.template b/skels/Makefile.template
new file mode 100644 (file)
index 0000000..893fb54
--- /dev/null
@@ -0,0 +1,52 @@
+# 
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# This Makefile is a skeleton
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=
+PKG_VERSION:=
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=
+PKG_MD5SUM:=
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/package
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=package
+  URL:=
+endef
+
+define Package/package/description
+endef
+
+# add extra configure flags here
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared
+
+# add make variable overrides here
+MAKE_FLAGS +=
+
+define Build/InstallDev
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)/
+endef
+
+define Package/package/install
+       $(INSTALL_DIR) $(1)/usr/package
+       $(CP) $(PKG_INSTALL_DIR)/usr/package/package.so.* $(1)/usr/package/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/package.init $(1)/etc/init.d/package
+       $(INSTALL_DIR) $(1)/etc/config/
+       $(INSTALL_CONF) $(1)/etc/config/package
+endef
+
+$(eval $(call BuildPackage,package))
diff --git a/skels/files/package.conf b/skels/files/package.conf
new file mode 100644 (file)
index 0000000..db3bc4d
--- /dev/null
@@ -0,0 +1,4 @@
+# Sample configuration file
+config package
+        option option1     'some default value'
+        option option2 ''
diff --git a/skels/files/package.init b/skels/files/package.init
new file mode 100755 (executable)
index 0000000..b0de442
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+# Sample init script reading its
+# configuration from /etc/config/package
+
+START=46
+STOP=46
+
+start_service() {
+       local section="$1"
+
+       . /lib/functions/network.sh
+
+       network_get_device LAN lan ifname
+       config_get option1 "$section" option1
+       config_get option2 "$section" option2
+
+       # Do some action with the variables
+       echo "option1 = $option1"
+}
+
+stop_service() {
+       local section="$1"
+
+       . /lib/functions/network.sh
+
+       network_get_device LAN lan ifname
+       config_get option1 "$section" option1
+       config_get option2 "$section" option2
+}
+start() {
+       # Do some optionnal testing
+       # before starting the program
+       config_load "package"
+       config_foreach start_service package
+}
+
+stop() {
+       config_load "package"
+       config_foreach stop_service package
+}
diff --git a/sound/cmus/Makefile b/sound/cmus/Makefile
new file mode 100644 (file)
index 0000000..bf0b3e7
--- /dev/null
@@ -0,0 +1,148 @@
+#
+# Copyright (C) 2011 Johannes Weißl <jargon@molb.org>
+# 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:=cmus
+PKG_VERSION:=2.5.0
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/cmus
+PKG_MD5SUM:=9af16d324060447996ed25e1a9c1c7d8
+
+PKG_BUILD_DEPENDS:=pulseaudio-daemon
+
+PKG_INSTALL:=1
+PKG_BUILD_DIR:=$(BUILD_DIR)/cmus-v$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+
+define Package/cmus/Default
+  SUBMENU:=cmus
+  SECTION:=sound
+  CATEGORY:=Sound
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+  URL:=http://cmus.sourceforge.net/
+endef
+
+define Package/cmus
+$(call Package/cmus/Default)
+  TITLE:=C* Music Player
+  DEPENDS:= \
+       +libpthread +librt +libncursesw $(ICONV_DEPENDS) \
+       +AUDIO_SUPPORT:alsa-lib \
+       +BUILD_PATENTED:libmad +libvorbisidec +libflac
+endef
+
+define Package/cmus-plugin-pulse
+$(call Package/cmus/Default)
+  TITLE:=cmus pulseaudio plugin
+  DEPENDS:= \
+       +cmus \
+       +pulseaudio-daemon
+endef
+
+define Package/cmus-plugin-oss
+$(call Package/cmus/Default)
+  TITLE:=cmus oss plugin
+  DEPENDS:= \
+       +cmus
+endef
+
+define Package/cmus/Default/description
+       C* Music Player is a modular and very configurable ncurses-based
+       audio player. It has some interesting features like configurable
+       colorscheme, mp3 and ogg streaming, it can be controlled with an
+       UNIX socket, filters, album/artists sorting and a vi-like
+       configuration interface.
+endef
+
+define Package/cmus/description
+$(call Package/cmus/Default/description)
+endef
+
+define Package/cmus-plugin-pulse/description
+$(call Package/cmus/Default/description)
+       This package adds the Pulseaudio plugin.
+endef
+
+define Package/cmus-plugin-oss/description
+$(call Package/cmus/Default/description)
+       This package adds the OSS plugin.
+endef
+
+define Build/Configure
+       # this is *NOT* GNU configure
+       ( cd $(PKG_BUILD_DIR); \
+               CROSS="$(TARGET_CROSS)" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -I$(ICONV_PREFIX)/include" \
+               LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -L$(ICONV_PREFIX)/lib" \
+               PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
+               PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
+               ./configure \
+               prefix="/usr" \
+               CONFIG_FLAC=a \
+               CONFIG_MAD=$(if $(CONFIG_BUILD_PATENTED),a,n) \
+               CONFIG_MODPLUG=n \
+               CONFIG_MIKMOD=n \
+               CONFIG_MPC=n \
+               CONFIG_VORBIS=a \
+               CONFIG_TREMOR=y \
+               CONFIG_WAVPACK=n \
+               CONFIG_MP4=n \
+               CONFIG_AAC=n \
+               CONFIG_FFMPEG=n \
+               CONFIG_ROAR=n \
+               CONFIG_PULSE=a \
+               CONFIG_ALSA=$(if $(CONFIG_AUDIO_SUPPORT),a,n) \
+               CONFIG_AO=n \
+               CONFIG_ARTS=n \
+               CONFIG_OSS=a \
+               CONFIG_SUN=n \
+               CONFIG_WAVEOUT=n \
+               DEBUG=0 \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               V=$(V) \
+               install
+endef
+
+define Package/cmus/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib/cmus/ip
+       $(INSTALL_DIR) $(1)/usr/lib/cmus/op
+       $(INSTALL_DIR) $(1)/usr/share/cmus
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cmus $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/ip/{flac,vorbis,wav}.so $(1)/usr/lib/cmus/ip/
+       $(if $(CONFIG_BUILD_PATENTED),$(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/ip/mad.so $(1)/usr/lib/cmus/ip/,)
+       $(if $(CONFIG_AUDIO_SUPPORT),$(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/op/alsa.so $(1)/usr/lib/cmus/op/,)
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/cmus/{rc,default.theme} $(1)/usr/share/cmus/
+endef
+
+define Package/cmus-plugin-pulse/install
+       $(INSTALL_DIR) $(1)/usr/lib/cmus/op
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/op/pulse.so $(1)/usr/lib/cmus/op/
+endef
+
+define Package/cmus-plugin-oss/install
+       $(INSTALL_DIR) $(1)/usr/lib/cmus/op
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/op/oss.so $(1)/usr/lib/cmus/op/
+endef
+
+
+$(eval $(call BuildPackage,cmus))
+$(eval $(call BuildPackage,cmus-plugin-pulse))
+$(eval $(call BuildPackage,cmus-plugin-oss))
+
diff --git a/sound/cmus/patches/010-do_not_use_ACS_VLINE.patch b/sound/cmus/patches/010-do_not_use_ACS_VLINE.patch
new file mode 100644 (file)
index 0000000..aaeb34e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/ui_curses.c
++++ b/ui_curses.c
+@@ -928,7 +928,7 @@ static void draw_separator(void)
+       (void) mvaddch(0, tree_win_w, ' ');
+       bkgdset(pairs[CURSED_SEPARATOR]);
+       for (row = 1; row < LINES - 3; row++)
+-              (void) mvaddch(row, tree_win_w, ACS_VLINE);
++              (void) mvaddch(row, tree_win_w, '|');
+ }
+ static void do_update_view(int full)
diff --git a/sound/cmus/patches/020-check_header_sys_soundcard.patch b/sound/cmus/patches/020-check_header_sys_soundcard.patch
new file mode 100644 (file)
index 0000000..74f622e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure        2011-04-23 22:35:36.000000000 +0200
++++ b/configure        2014-01-23 15:50:42.139304856 +0100
+@@ -247,7 +247,7 @@
+       OSS_CFLAGS=""
+       OSS_LIBS=""
+       msg_checking "for header <sys/soundcard.h>"
+-      if test -f /usr/include/sys/soundcard.h
++      if check_header sys/soundcard.h
+       then
+               msg_result "yes"
+               makefile_vars OSS_CFLAGS OSS_LIBS
diff --git a/sound/empcd/Makefile b/sound/empcd/Makefile
new file mode 100644 (file)
index 0000000..f5b0cd7
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2007-2014 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:=empcd
+PKG_VERSION:=2008.02.16
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://unfix.org/projects/empcd
+PKG_MD5SUM:=c3209f6bf8eb6e8ea9638601e1cd04a4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/empcd
+  SECTION:=sound
+  CATEGORY:=Sound
+  TITLE:=EMPCd can control the MPD
+  URL:=http://unfix.org/projects/empcd
+endef
+
+define Package/empcd/description
+       This is EMPCd which can use /dev/input/event0 or other event devices
+       to control MPD (Music Player Daemon), directly using libmpdclient
+       and other programs, currently using system(2).
+endef
+
+define Package/empcd/conffiles
+/etc/empcd.conf
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default,\
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               $(TARGET_CONFIGURE_OPTS) \
+               all \
+       )
+endef
+
+define Package/empcd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/empcd $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/empcd.conf $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,empcd))
diff --git a/sound/empcd/patches/001-Makefile_use_VFP_CFLAGS.patch b/sound/empcd/patches/001-Makefile_use_VFP_CFLAGS.patch
new file mode 100644 (file)
index 0000000..3cfded9
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -17,7 +17,7 @@ DEPS = Makefile
+ OBJS  = empcd.o keyeventtable.o support/mpc-0.12.2/src/libmpdclient.o
+ WARNS = -W -Wall -pedantic -Wno-format -Wno-unused -Wno-long-long
+ EXTRA   = -g3
+-CFLAGS        = $(WARNS) $(EXTRA) -D_GNU_SOURCE
++CFLAGS        += $(WARNS) $(EXTRA) -D_GNU_SOURCE
+ LDFLAGS       =
+ CC      = gcc
+ RM      = rm
diff --git a/sound/flite/Makefile b/sound/flite/Makefile
new file mode 100644 (file)
index 0000000..4325e7f
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2006-2010 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:=flite
+PKG_VERSION:=1.3-release
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.speech.cs.cmu.edu/flite/packed/flite-1.3/
+PKG_MD5SUM:=ae0aca1cb7b4801f4372f3a75a9e52b5
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/flite
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=@!GCC_VERSION_3_4_6
+  TITLE:=Text-to-speech for embedded systems
+  URL:=http://www.speech.cs.cmu.edu/flite/index.html
+endef
+
+define Package/flite/description
+Festival Lite is a stripped down version of Festival,
+       the well-developed text-to-speech program written in C++.
+       This program is written in C to keep memory usage low.
+endef
+
+TARGET_LDFLAGS += -lm
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --with-audio="oss" \
+               --with-vox="cmu_us_kal16" \
+               --prefix="$(PKG_INSTALL_DIR)/usr" \
+               --exec-prefix="$(PKG_INSTALL_DIR)/usr" \
+               --bindir="$(PKG_INSTALL_DIR)/usr/bin" \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/flite
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/flite/{cst,flite}*.h $(1)/usr/include/flite/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libflite*.so.* $(1)/usr/lib/
+endef
+
+define Package/flite/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/flite $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libflite*.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,flite))
diff --git a/sound/flite/patches/100-shared_libs b/sound/flite/patches/100-shared_libs
new file mode 100644 (file)
index 0000000..47254b0
--- /dev/null
@@ -0,0 +1,182 @@
+---
+ Makefile                 |    2 -
+ config/common_make_rules |   34 ++++++++++++--------
+ lib/Makefile             |   78 +++++++++++++++++++++++++++++++++++++++++++++++
+ main/Makefile            |    4 +-
+ 4 files changed, 102 insertions(+), 16 deletions(-)
+
+--- flite-1.3-release.orig/config/common_make_rules
++++ flite-1.3-release/config/common_make_rules
+@@ -59,27 +59,35 @@ BUILDDIR=$(TOP)/build/$(TARGET_PLATFORM)
+ endif
+ OBJDIR=$(BUILDDIR)/obj/$(DIRNAME)
+ BINDIR=$(BUILDDIR)/bin
++LIBDIR=$(BUILDDIR)/lib
+ ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM))
+ BINDIR=$(TOP)/bin
++LIBDIR=$(TOP)/lib
+ endif
+-LIBDIR=$(BUILDDIR)/lib
+ BUILDDIRS=$(OBJDIR) $(BINDIR) $(LIBDIR)
+-FLITELIBS = $(BUILDDIR)/lib/libflite.a
+-LDFLAGS += -L$(BUILDDIR)/lib -lflite -lm $(AUDIOLIBS) $(OTHERLIBS)
++ifdef SHFLAGS
++FLITELIBS = $(LIBDIR)/libflite.so
++LDFLAGS += -L$(LIBDIR) -lflite $(OTHERLIBS)
++else
++FLITELIBS = $(LIBDIR)/libflite.a
++LDFLAGS += -L$(LIBDIR) -lflite -lm $(AUDIOLIBS) $(OTHERLIBS)
++endif
+ FULLOBJS = $(OBJS:%=$(OBJDIR)/%)
+ ifdef SHFLAGS
+ SOOBJS = $(OBJS:.o=.os)
+-FULLSHOBJS = $(SOOBJS:%=$(OBJDIR)/%)
++FULLSOOBJS = $(SOOBJS:%=$(OBJDIR)/%)
+ ifdef LIBNAME
+ ALL += $(OBJDIR)/.build_so
+ endif
+-endif
++else
+ ifdef LIBNAME
+ ALL += $(OBJDIR)/.build_lib
+ endif
++endif
++
+ # Only do some directories when you are not cross compiling
+ ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM))
+ OTHER_BUILD_DIRS = $(HOST_ONLY_DIRS)
+@@ -117,15 +125,15 @@ $(OBJDIR)/.build_so: $(FULLSOOBJS)
+       @ touch $(OBJDIR)/.build_so
+ # Used in the lib/ directory and in building new voices
+-$(OBJDIR)/%.so: %.shared.a
++%.so: %.shared.a
+       @ echo making $@
+-      @ rm -rf shared_os && mkdir shared_os
+-      @ rm -f $@ $(LIBDIR)/$@.${PROJECT_VERSION} $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION} 
+-      @ (cd shared_os && ar x ../$<)
+-      @ (cd shared_os && $(CC) -shared -Wl,-soname,$@.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os)
+-      @ ln -s $(LIBDIR)/$@.${PROJECT_VERSION} $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION}
+-      @ ln -s $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION} $(LIBDIR)/$@
+-      @ rm -rf shared_os
++      @ rm -rf shared_os-$@ && mkdir shared_os-$@
++      @ rm -f $@ $@.${PROJECT_VERSION} $@.${PROJECT_SHLIB_VERSION} 
++      @ (cd shared_os-$@ && ar x ../$<)
++      @ (cd shared_os-$@ && $(CC) -shared -Wl,-soname,$@.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os -L../ $($(@:%.so=%_LDLIBS)))
++      @ ln -s $@.${PROJECT_VERSION} $@.${PROJECT_SHLIB_VERSION}
++      @ ln -s $@.${PROJECT_SHLIB_VERSION} $@
++      @ rm -rf shared_os-$@
+ $(OBJDIR)/.make_build_dirs:
+       @ echo making in $(DIRNAME) ...
+--- /dev/null
++++ flite-1.3-release/lib/Makefile
+@@ -0,0 +1,78 @@
++###########################################################################
++##                                                                       ##
++##                  Language Technologies Institute                      ##
++##                     Carnegie Mellon University                        ##
++##                        Copyright (c) 1999                             ##
++##                        All Rights Reserved.                           ##
++##                                                                       ##
++##  Permission is hereby granted, free of charge, to use and distribute  ##
++##  this software and its documentation without restriction, including   ##
++##  without limitation the rights to use, copy, modify, merge, publish,  ##
++##  distribute, sublicense, and/or sell copies of this work, and to      ##
++##  permit persons to whom this work is furnished to do so, subject to   ##
++##  the following conditions:                                            ##
++##   1. The code must retain the above copyright notice, this list of    ##
++##      conditions and the following disclaimer.                         ##
++##   2. Any modifications must be clearly marked as such.                ##
++##   3. Original authors' names are not deleted.                         ##
++##   4. The authors' names are not used to endorse or promote products   ##
++##      derived from this software without specific prior written        ##
++##      permission.                                                      ##
++##                                                                       ##
++##  CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK         ##
++##  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ##
++##  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ##
++##  SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE      ##
++##  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ##
++##  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ##
++##  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ##
++##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ##
++##  THIS SOFTWARE.                                                       ##
++##                                                                       ##
++###########################################################################
++##                                                                       ##
++##    FLITE libraries                                                    ##
++##                                                                       ##
++###########################################################################
++TOP=..
++DIRNAME=lib
++BUILD_DIRS = 
++ALL_DIRS=
++FILES = Makefile
++LIBNAMES = flite flite_cmulex flite_usenglish \
++           flite_cmu_us_kal flite_cmu_us_kal16 flite_cmu_time_awb
++
++STATICLIBS= $(LIBNAMES:%=lib%.a)
++SHAREDARLIBS= $(LIBNAMES:%=lib%.shared.a)
++#SHAREDLIBS = $(LIBNAMES:%=lib%.so)
++SHAREDLIBS = $(SHAREDARLIBS:%.shared.a=%.so)
++VERSIONSHAREDLIBS = $(SHAREDLIBS:%=%.${PROJECT_VERSION}) \
++                    $(SHAREDLIBS:%=%.${PROJECT_SHLIB_VERSION})
++ALL_LIBS = $(SHAREDLIBS) $(VERSIONSHAREDLIBS)
++
++ALL = shared_libs
++
++LOCAL_CLEAN=*.a *.so *.so.${PROJECT_VERSION} *.so.${PROJECT_SHLIB_VERSION}
++
++include $(TOP)/config/common_make_rules
++
++ifdef SHFLAGS
++shared_libs: $(SHAREDLIBS)
++libflite_LDLIBS = -lm $(AUDIOLIBS)
++libflite_cmulex_LDLIBS = -lflite
++libflite_cmulex.so: libflite.so
++libflite_usenglish_LDLIBS = -lflite
++libflite_usenglish.so: libflite.so
++libflite_cmu_us_kal_LDLIBS = -lflite_cmulex -lflite_usenglish
++libflite_cmu_us_kal.so: libflite_cmulex.so libflite_usenglish.so
++libflite_cmu_us_kal16_LDLIBS = -lflite_cmulex -lflite_usenglish
++libflite_cmu_us_kal16.so: libflite_cmulex.so libflite_usenglish.so
++libflite_cmu_time_awb_LDLIBS = -lflite -lflite_cmulex -lflite_usenglish
++libflite_cmu_time_awb.so: libflite.so libflite_cmulex.so libflite_usenglish.so
++else
++shared_libs: nothing
++endif
++
++install:
++      @ tar cvf - $(ALL_LIBS) | ( cd $(INSTALLLIBDIR) && tar xf -)
++
+--- flite-1.3-release.orig/main/Makefile
++++ flite-1.3-release/main/Makefile
+@@ -50,11 +50,11 @@ ALL = $(BINDIR)/flite$(EXEEXT) $(BINDIR)
+ flite_LIBS = flite_$(FL_VOX) flite_$(FL_LANG) flite_$(FL_LEX) 
+ flite_LIBS_flags = -L$(LIBDIR) $(flite_LIBS:%=-l%)
+-flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.a)
++flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.so)
+ flite_time_LIBS = flite_cmu_time_awb flite_$(FL_LANG) flite_$(FL_LEX)
+ flite_time_LIBS_flags = -L$(LIBDIR) $(flite_time_LIBS:%=-l%)
+-flite_time_LIBS_deps = $(flite_time_LIBS:%=$(LIBDIR)/lib%.a)
++flite_time_LIBS_deps = $(flite_time_LIBS:%=$(LIBDIR)/lib%.so)
+ include $(TOP)/config/common_make_rules
+--- flite-1.3-release.orig/Makefile
++++ flite-1.3-release/Makefile
+@@ -41,7 +41,7 @@
+ ###########################################################################
+ TOP=.
+ DIRNAME=
+-BUILD_DIRS = include src lang doc
++BUILD_DIRS = include src lang lib
+ ALL_DIRS=config $(BUILD_DIRS) testsuite sapi palm tools main
+ CONFIG=configure configure.in config.sub config.guess \
+        missing install-sh mkinstalldirs
diff --git a/sound/ices/Makefile b/sound/ices/Makefile
new file mode 100644 (file)
index 0000000..be8e975
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2009 Freifunk Leipzig
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ices
+PKG_VERSION:=2.0.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.xiph.org/releases/ices/
+PKG_MD5SUM:=0d95ac34d59fed337028d5e7771076d8
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ices
+  SECTION:=sound
+  CATEGORY:=Sound
+  TITLE:=ices client for Icecast media streaming servers
+  URL:=http://xiph.org/
+  DEPENDS:=+libshout +libxml2 +zlib +libogg +libvorbis +alsa-lib
+endef
+
+define Package/ices/description
+  ices is a command line source client for Icecast media streaming servers.
+  It began as the successor of the old "shout" utility, and has since gained a
+  lot of useful features.
+endef
+
+define Package/ices/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+CONFIGURE_ARGS+= \
+    --with-ogg="$(STAGING_DIR)/usr/include" \
+    --with-vorbis="$(STAGING_DIR)/usr/include" \
+
+define Build/Configure
+    $(call Build/Configure/Default, \
+      LDFLAGS="$(TARGET_LDFLAGS) -lz -lm" \
+    )
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+         $(TARGET_CONFIGURE_OPTS) \
+         CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
+         LDFLAGS="$(TARGET_LDFLAGS) -lz -lm"
+endef
+
+$(eval $(call BuildPackage,ices))
diff --git a/sound/lame/Makefile b/sound/lame/Makefile
new file mode 100644 (file)
index 0000000..5695dd8
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2007-2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# blogic@openwrt.org
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lame
+PKG_VERSION:=398-2
+PKG_RELEASE:=3
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/lame
+PKG_MD5SUM:=719dae0ee675d0c16e0e89952930ed35
+PKG_FIXUP:=autoreconf
+
+PKG_LICENSE:=LGPLv2
+PKG_LICENSE_FILES:=COPYING LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/lame/Default
+  SECTION:=sound
+  CATEGORY:=Sound
+  URL:=http://sourceforge.net/projects/lame
+  DEPENDS:=@BUILD_PATENTED
+endef
+
+define Package/lame
+$(call Package/lame/Default)
+  TITLE:=lame
+  MENU:=1
+  DEPENDS += +libncurses
+endef
+
+define Package/lame/description
+lame mp3 encoder
+endef
+
+define Package/lame-lib
+$(call Package/lame/Default)
+  TITLE:=lame-lib
+endef
+
+define Package/lame-lib/description
+lame mp3 encoder libs
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+       --disable-nasm \
+       )
+endef
+
+
+define Package/lame/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lame $(1)/usr/bin/
+endef
+
+define Package/lame-lib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/lame
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/lame/*.h \
+               $(1)/usr/include/lame/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{la,so*} \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,lame-lib))
+$(eval $(call BuildPackage,lame))
diff --git a/sound/lame/patches/001-automake-compat.patch b/sound/lame/patches/001-automake-compat.patch
new file mode 100644 (file)
index 0000000..a2ba61a
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/configure.in
++++ b/configure.in
+@@ -385,7 +385,7 @@ CONFIG_MATH_LIB="${USE_LIBM}"
+ dnl configure use of features
+-AM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no")
++HAVE_GTK="no"
+ dnl ElectricFence malloc debugging
+ AC_MSG_CHECKING(use of ElectricFence malloc debugging)
+--- a/frontend/Makefile.am
++++ b/frontend/Makefile.am
+@@ -51,7 +51,7 @@ mp3rtp_SOURCES = mp3rtp.c rtp.c rtp.h $(
+ mp3x_SOURCES = mp3x.c gtkanal.c gpkplotting.c $(common_sources)
+ endif
+-CFLAGS = @CFLAGS@ @GTK_CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@
++CFLAGS = @CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@
+ LDFLAGS = @LDFLAGS@ @FRONTEND_LDFLAGS@ @SNDFILE_LIBS@ -static
+ INCLUDES = -I$(top_srcdir)/libmp3lame -I$(top_srcdir)/include -I$(top_builddir)
+--- a/frontend/Makefile.in
++++ b/frontend/Makefile.in
+@@ -113,7 +113,7 @@ AUTOMAKE = @AUTOMAKE@
+ AWK = @AWK@
+ CC = @CC@
+ CCDEPMODE = @CCDEPMODE@
+-CFLAGS = @CFLAGS@ @GTK_CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@
++CFLAGS = @CFLAGS@ @FRONTEND_CFLAGS@ @SNDFILE_CFLAGS@
+ CONFIG_DEFS = @CONFIG_DEFS@
+ CONFIG_MATH_LIB = @CONFIG_MATH_LIB@
+ CPP = @CPP@
diff --git a/sound/listener/Makefile b/sound/listener/Makefile
new file mode 100644 (file)
index 0000000..7bb41a8
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 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:=listener
+PKG_VERSION:=1.7.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.vanheusden.com/listener/
+PKG_MD5SUM:=8ad9c24c45c7d28aed606304a2bf80bf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/listener
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=+libncurses +libsndfile
+  TITLE:=Listener automatically records when sound is detected
+  URL:=http://www.vanheusden.com/listener/
+endef
+
+define Package/listener/description
+  This program listens for sound. If it detects any, it starts recording
+  automatically and also automatically stops when things become silent
+  again.
+endef
+
+MAKE_FLAGS+= \
+       INSTALL_PREFIX= \
+
+define Package/listener/conffiles
+/etc/listener.conf
+endef
+
+define Package/listener/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/{listener,listenersoundpipe,setlistener} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/listener.conf $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,listener))
diff --git a/sound/listener/files/listener.conf b/sound/listener/files/listener.conf
new file mode 100644 (file)
index 0000000..aeafd44
--- /dev/null
@@ -0,0 +1,20 @@
+wav_path = /tmp/
+fname_template = listener-%h-%y%m%d-%H%M%S.wav
+devname = /dev/dsp
+detect_level = 1
+min_duration = 10
+rec_silence = 5
+max_duration = 60
+min_triggers = 2
+sample_rate = 8000
+channels = 1
+format=wav
+amplify = off
+start_amplify = 1.5
+max_amplify = 10.0
+fixed_amplify = no
+safe_after_filter = no
+one_shot = no
+
+#compression = a-law
+#filter = ./my_filter2.so.0.1 0 3000.0 1.0
diff --git a/sound/listener/patches/100-makefile.patch b/sound/listener/patches/100-makefile.patch
new file mode 100644 (file)
index 0000000..bd254b8
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/Makefile
++++ b/Makefile
+@@ -2,7 +2,10 @@ VERSION=1.7.2
+ INSTALL_PREFIX=/usr/local
+-CFLAGS+=-g -O2 -Wall -DVERSION=\"$(VERSION)\"
++ifeq ($(CFLAGS),)
++  CFLAGS:=-g -O2
++endif
++CFLAGS+=-Wall -DVERSION=\"$(VERSION)\"
+ OBJSsl=sl.o snd_dev.o error.o utils.o
+ OBJSli=listener.o snd_dev.o error.o utils.o lib.o
+@@ -11,13 +14,13 @@ OBJSsp=snd_dev.o lsp.o error.o utils.o
+ all: setlistener listener listenersoundpipe
+ setlistener: $(OBJSsl)
+-      $(CC) -g -Wall -W $(OBJSsl) -ldl -lncurses -o setlistener
++      $(CC) $(CFLAGS) $(OBJSsl) $(LDFLAGS) -ldl -lncurses -o setlistener
+ listener: $(OBJSli)
+-      $(CC) -g -Wall -W $(OBJSli) -ldl -lm -lsndfile -o listener -DCONFIGFILE=$(INSTALL_PREFIX)/etc/listener.conf
++      $(CC) $(CFLAGS) $(OBJSli) $(LDFLAGS) -ldl -lm -lsndfile -o listener -DCONFIGFILE=$(INSTALL_PREFIX)/etc/listener.conf
+ listenersoundpipe: $(OBJSsp)
+-      $(CC) -g -Wall -W $(OBJSsp) -o listenersoundpipe
++      $(CC) $(CFLAGS) $(OBJSsp) -o listenersoundpipe
+ install: setlistener listener listenersoundpipe
+       cp setlistener $(INSTALL_PREFIX)/bin
diff --git a/sound/madplay/Makefile b/sound/madplay/Makefile
new file mode 100644 (file)
index 0000000..63a95c5
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2006-2010 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:=madplay
+PKG_VERSION:=0.15.2b
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/mad \
+       ftp://ftp.mars.org/pub/mpeg/
+PKG_MD5SUM:=6814b47ceaa99880c754c5195aa1aac1
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/madplay
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=+libid3tag +libmad
+  TITLE:=MPEG audio player in fixed point
+  URL:=http://sourceforge.net/projects/mad
+endef
+
+define Package/madplay/description
+       MAD is an MPEG audio decoder. It currently only supports the MPEG 1
+       standard, but fully implements all three audio layers (Layer I, Layer II,
+       and Layer III, the latter often colloquially known as MP3.). There is also
+       full support for ID3 tags.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --enable-shared \
+               --disable-static \
+               --disable-debugging \
+               --disable-profiling \
+               --disable-experimental \
+               --without-libiconv-prefix \
+               --without-libintl-prefix \
+               --without-alsa \
+               --without-esd \
+               , \
+               LIBS="-lz" \
+       )
+endef
+
+define Package/madplay/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/madplay $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,madplay))
diff --git a/sound/mocp/Makefile b/sound/mocp/Makefile
new file mode 100644 (file)
index 0000000..8f866e5
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 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:=moc
+PKG_VERSION:=2.5.0-beta2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://ftp.daper.net/pub/soft/moc/unstable/
+PKG_MD5SUM:=da87b90b57934234589b63e347921458
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/moc
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=+libcurl +BUILD_PATENTED:libmad +libvorbis $(ICONV_DEPENDS) +alsa-utils +libid3tag +libflac +libsamplerate +PACKAGE_libncursesw:libncursesw +!PACKAGE_libncursesw:libncurses +libffmpeg +libltdl +libmagic +faad2 +libdb47
+  TITLE:=Music On Console
+  URL:=http://moc.daper.net/
+endef
+
+define Package/moc/description
+       MOC (music on console) is a console audio player for LINUX/UNIX designed to be powerful and easy to use.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               $(if $(CONFIG_BUILD_PATENTED),,--without-mp3) \
+               --enable-shared \
+               --disable-static \
+               --disable-debug \
+               --without-speex \
+               --without-samplerate \
+               --without-curl \
+               --without-flac \
+               --without-musepack \
+               --without-rcc \
+               $(if $(CONFIG_PACKAGE_libncursesw),--with-ncursesw --without-ncurses,--with-ncurses --without-ncursesw) \
+       )
+endef
+
+define Package/moc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mocp $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/moc/decoder_plugins
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/moc/decoder_plugins/*.so $(1)/usr/lib/moc/decoder_plugins
+endef
+
+$(eval $(call BuildPackage,moc))
diff --git a/sound/mpdas/Makefile b/sound/mpdas/Makefile
new file mode 100644 (file)
index 0000000..db9e999
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2009-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:=mpdas
+PKG_VERSION:=0.3.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://50hz.ws/mpdas
+PKG_MD5SUM:=d9f6e4d3b000d95835f39fb1aa3f4b28
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/mpdas
+  SECTION:=sound
+  CATEGORY:=Sound
+  TITLE:=A MPD client which submits your tracks to Last.Fm
+  DEPENDS:=+libcurl +libmpd +libstdcpp
+  URL:=http://50hz.ws/mpdas/
+endef
+
+define Package/mpdas/description
+    mpdas is an AudioScrobbler client for MPD written in C++.
+    It supports the latest AudioScrobbler protocol (2.0).
+    In case of a downtime or connectivity problems, mpdas will
+    cache the played songs to ~/.mpdascache.
+endef
+
+define Package/mpdas/conffiles
+/etc/mpdasrc
+endef
+
+EXTRA_CPPFLAGS:=\
+       -I$(ICONV_PREFIX)/include \
+       -I$(INTL_PREFIX)/include \
+
+EXTRA_LDFLAGS:=\
+       -L$(ICONV_PREFIX)/lib \
+       -L$(INTL_PREFIX)/lib \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+MAKE_FLAGS += \
+       CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDPFLAGS) $(EXTRA_LDFLAGS)"
+
+define Package/mpdas/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/mpdasrc $(1)/etc/mpdasrc
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mpdas $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mpdas.init $(1)/etc/init.d/mpdas
+endef
+
+$(eval $(call BuildPackage,mpdas))
diff --git a/sound/mpdas/files/mpdas.init b/sound/mpdas/files/mpdas.init
new file mode 100644 (file)
index 0000000..ba64d95
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2011 OpenWrt.org
+
+START=94
+
+SERVICE_DAEMONIZE=1
+
+start() {
+       HOME=/root \
+       service_start /usr/bin/mpdas -c /etc/mpdasrc
+}
+
+stop() {
+       service_stop /usr/bin/mpdas
+}
diff --git a/sound/mpdas/files/mpdasrc b/sound/mpdas/files/mpdasrc
new file mode 100644 (file)
index 0000000..34af9a7
--- /dev/null
@@ -0,0 +1,5 @@
+username = username_here
+# create md5 password:
+# echo -n password | md5sum
+password = md5_hash_here
+debug = 0
diff --git a/sound/mpdas/patches/001-flags.patch b/sound/mpdas/patches/001-flags.patch
new file mode 100644 (file)
index 0000000..11a6a6d
--- /dev/null
@@ -0,0 +1,20 @@
+Index: mpdas-0.3.0/Makefile
+===================================================================
+--- mpdas-0.3.0.orig/Makefile  2010-11-22 02:15:12.000000000 +0100
++++ mpdas-0.3.0/Makefile       2011-07-20 16:53:31.000000000 +0200
+@@ -3,12 +3,12 @@
+ CXX   ?= g++
+ OBJ   = main.o md5.o utils.o mpd.o audioscrobbler.o cache.o config.o
+ OUT   = mpdas
+-PREFIX ?= /usr/local
++PREFIX ?= /
+ MANPREFIX ?= ${PREFIX}/man/man1
+ CONFIG ?= $(PREFIX)/etc
+-CXXFLAGS      += `pkg-config --cflags libmpd libcurl` 
+-LIBS          = `pkg-config --libs libmpd libcurl`
++CXXFLAGS      += $(CPPFLAGS) `pkg-config --cflags libmpd libcurl`
++LIBS          = $(LDFLAGS) `pkg-config --libs libmpd libcurl`
+ CXXFLAGS      += -DCONFDIR="\"$(CONFIG)\"" -DVERSION="\"$(VERSION)\""
diff --git a/sound/mt-daapd/Makefile b/sound/mt-daapd/Makefile
new file mode 100644 (file)
index 0000000..75e1664
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2005-2010 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:=mt-daapd
+PKG_VERSION:=0.2.4.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=67bef9fb14d487693b0dfb792c3f1b05
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mt-daapd
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=+libgdbm +libhowl +libid3tag +libpthread
+  TITLE:=A multi-threaded DAAP (Digital Audio Access Protocol) daemon
+  URL:=http://www.fireflymediaserver.org/
+endef
+
+define Package/mt-daapd/description
+       mt-daapd is a program which acts as an iTunes (DAAP) server for Linux.
+endef
+
+define Package/mt-daapd/conffiles
+/etc/mt-daapd.conf
+/etc/mt-daapd.playlist
+endef
+
+CONFIGURE_ARGS += \
+       --enable-mdns \
+       --enable-howl \
+       --with-id3tag="$(STAGING_DIR)/usr" \
+       --with-gdbm-includes="$(STAGING_DIR)/usr/include" \
+       --with-gdbm-libs="$(STAGING_DIR)/usr/lib" \
+       --with-howl-includes="$(STAGING_DIR)/usr/include/howl" \
+       --with-howl-libs="$(STAGING_DIR)/usr/lib" \
+       --without-static-libs \
+
+define Package/mt-daapd/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/contrib/mt-daapd.conf $(1)/etc/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/contrib/mt-daapd.playlist $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/mt-daapd $(1)/usr/share/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mt-daapd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mt-daapd.init $(1)/etc/init.d/mt-daapd
+endef
+
+$(eval $(call BuildPackage,mt-daapd))
diff --git a/sound/mt-daapd/files/mt-daapd.init b/sound/mt-daapd/files/mt-daapd.init
new file mode 100644 (file)
index 0000000..720c7d8
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=50
+
+BIN=mt-daapd
+DEFAULT=/etc/default/$BIN
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+start() {
+       [ -f $DEFAULT ] && . $DEFAULT
+       [ -d $RUN_D ] || mkdir -p $RUN_D
+       $BIN $OPTIONS
+}
+
+stop() {
+       [ -f $PID_F ] && kill -INT $(cat $PID_F)
+}
+
diff --git a/sound/pianobar/Makefile b/sound/pianobar/Makefile
new file mode 100644 (file)
index 0000000..e9c3e8e
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2012 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:=pianobar
+PKG_VERSION:=2012.01.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://6xq.net/static/projects/pianobar
+PKG_MD5SUM:=448c57d65c71158674e8b30a8cfa217e
+
+PKG_BUILD_DEPENDS:=libao libfaad2 libmad
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pianobar/Default
+  DEPENDS:=+libgnutls
+  TITLE:=Pandora radio
+  URL:=http://6xq.net/projects/pianobar/
+endef
+
+define Package/pianobar/Default/description
+  Pianobar is a free/open-source, console-based replacement for Pandora’s flash
+  player.
+endef
+
+define Package/pianobar
+  $(call Package/pianobar/Default)
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS+= +libao +libfaad2 +libmad +libpiano +libpthread
+  TITLE+= console client
+endef
+
+define Package/pianobar/description
+  $(call Package/pianobar/Default/description)
+endef
+
+define Package/libpiano
+  $(call Package/pianobar/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+endef
+
+define Package/libpiano/description
+  $(call Package/pianobar/Default/description)
+  This package contains the libpiano shared library.
+endef
+
+TARGET_CFLAGS += -std=c99
+
+MAKE_FLAGS += \
+       DYNLINK="1" \
+       PREFIX="/usr"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpiano.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/pianobar/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pianobar $(1)/usr/bin/
+endef
+
+define Package/libpiano/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpiano.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,pianobar))
+$(eval $(call BuildPackage,libpiano))
diff --git a/sound/pianobar/patches/001-verbose.patch b/sound/pianobar/patches/001-verbose.patch
new file mode 100644 (file)
index 0000000..ae4c4b5
--- /dev/null
@@ -0,0 +1,57 @@
+--- a/Makefile
++++ b/Makefile
+@@ -91,14 +91,12 @@ LIBGNUTLS_LDFLAGS=-lgnutls
+ # build pianobar
+ ifeq (${DYNLINK},1)
+ pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} libpiano.so.0
+-      @echo "  LINK  $@"
+-      @${CC} -o $@ ${PIANOBAR_OBJ} ${LDFLAGS} -lao -lpthread -lm -L. -lpiano \
++      ${CC} -o $@ ${PIANOBAR_OBJ} ${LDFLAGS} -lao -lpthread -lm -L. -lpiano \
+                       ${LIBFAAD_LDFLAGS} ${LIBMAD_LDFLAGS} ${LIBGNUTLS_LDFLAGS}
+ else
+ pianobar: ${PIANOBAR_OBJ} ${PIANOBAR_HDR} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} \
+               ${LIBWAITRESS_HDR} ${LIBEZXML_OBJ} ${LIBEZXML_HDR}
+-      @echo "  LINK  $@"
+-      @${CC} ${CFLAGS} ${LDFLAGS} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} \
++      ${CC} ${CFLAGS} ${LDFLAGS} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} \
+                       ${LIBWAITRESS_OBJ} ${LIBEZXML_OBJ} -lao -lpthread -lm \
+                       ${LIBFAAD_LDFLAGS} ${LIBMAD_LDFLAGS} ${LIBGNUTLS_LDFLAGS} -o $@
+ endif
+@@ -107,30 +105,25 @@ endif
+ libpiano.so.0: ${LIBPIANO_RELOBJ} ${LIBPIANO_HDR} ${LIBWAITRESS_RELOBJ} \
+               ${LIBWAITRESS_HDR} ${LIBEZXML_RELOBJ} ${LIBEZXML_HDR} \
+               ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBEZXML_OBJ}
+-      @echo "  LINK  $@"
+-      @${CC} -shared -Wl,-soname,libpiano.so.0 ${CFLAGS} ${LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
++      ${CC} -shared -Wl,-soname,libpiano.so.0 ${CFLAGS} ${LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
+                       -o libpiano.so.0.0.0 ${LIBPIANO_RELOBJ} \
+                       ${LIBWAITRESS_RELOBJ} ${LIBEZXML_RELOBJ}
+-      @ln -s libpiano.so.0.0.0 libpiano.so.0
+-      @ln -s libpiano.so.0 libpiano.so
+-      @echo "    AR  libpiano.a"
+-      @${AR} rcs libpiano.a ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBEZXML_OBJ}
++      ln -s libpiano.so.0.0.0 libpiano.so.0
++      ln -s libpiano.so.0 libpiano.so
++      ${AR} rcs libpiano.a ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBEZXML_OBJ}
+ %.o: %.c
+-      @echo "    CC  $<"
+-      @${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
++      ${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
+                       -I ${LIBEZXML_INCLUDE} ${LIBFAAD_CFLAGS} \
+                       ${LIBMAD_CFLAGS} ${LIBGNUTLS_CFLAGS} -c -o $@ $<
+ # create position independent code (for shared libraries)
+ %.lo: %.c
+-      @echo "    CC  $< (PIC)"
+-      @${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
++      ${CC} ${CFLAGS} -I ${LIBPIANO_INCLUDE} -I ${LIBWAITRESS_INCLUDE} \
+                       -I ${LIBEZXML_INCLUDE} -c -fPIC -o $@ $<
+ clean:
+-      @echo " CLEAN"
+-      @${RM} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBWAITRESS_OBJ}/test.o \
++      ${RM} ${PIANOBAR_OBJ} ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBWAITRESS_OBJ}/test.o \
+                       ${LIBEZXML_OBJ} ${LIBPIANO_RELOBJ} ${LIBWAITRESS_RELOBJ} \
+                       ${LIBEZXML_RELOBJ} pianobar libpiano.so* libpiano.a waitress-test
diff --git a/sound/pianobar/patches/002-force-symlinks.patch b/sound/pianobar/patches/002-force-symlinks.patch
new file mode 100644 (file)
index 0000000..cacaa49
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/Makefile
++++ b/Makefile
+@@ -108,8 +108,8 @@ libpiano.so.0: ${LIBPIANO_RELOBJ} ${LIBP
+       ${CC} -shared -Wl,-soname,libpiano.so.0 ${CFLAGS} ${LDFLAGS} ${LIBGNUTLS_LDFLAGS} \
+                       -o libpiano.so.0.0.0 ${LIBPIANO_RELOBJ} \
+                       ${LIBWAITRESS_RELOBJ} ${LIBEZXML_RELOBJ}
+-      ln -s libpiano.so.0.0.0 libpiano.so.0
+-      ln -s libpiano.so.0 libpiano.so
++      ln -sf libpiano.so.0.0.0 libpiano.so.0
++      ln -sf libpiano.so.0 libpiano.so
+       ${AR} rcs libpiano.a ${LIBPIANO_OBJ} ${LIBWAITRESS_OBJ} ${LIBEZXML_OBJ}
+ %.o: %.c
+@@ -177,8 +177,8 @@ endif
+ install-libpiano:
+       install -d ${DESTDIR}/${LIBDIR}/
+       install -m644 libpiano.so.0.0.0 ${DESTDIR}/${LIBDIR}/
+-      ln -s libpiano.so.0.0.0 ${DESTDIR}/${LIBDIR}/libpiano.so.0
+-      ln -s libpiano.so.0 ${DESTDIR}/${LIBDIR}/libpiano.so
++      ln -sf libpiano.so.0.0.0 ${DESTDIR}/${LIBDIR}/libpiano.so.0
++      ln -sf libpiano.so.0 ${DESTDIR}/${LIBDIR}/libpiano.so
+       install -m644 libpiano.a ${DESTDIR}/${LIBDIR}/
+       install -d ${DESTDIR}/${INCDIR}/
+       install -m644 src/libpiano/piano.h ${DESTDIR}/${INCDIR}/
diff --git a/sound/scmpc/Makefile b/sound/scmpc/Makefile
new file mode 100644 (file)
index 0000000..a067f82
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# 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:=scmpc
+PKG_VERSION:=0.2.2
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.berlios.de/scmpc
+PKG_MD5SUM:=f42482e4dbf398df92a36d5610b403e5
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/scmpc
+  SECTION:=sound
+  CATEGORY:=Sound
+  TITLE:=A MPD client which submits your tracks to Last.Fm
+  DEPENDS:=+libcurl +libdaemon +argtable +confuse +libpthread
+  URL:=http://scmpc.berlios.de/
+endef
+
+define Package/scmpc/description
+  scmpc is a multithreaded, robust client for MPD to submit tracks to Audioscrobbler (Last.fm).
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --disable-rpath \
+       --without-libiconv-prefix \
+       --without-libintl-prefix \
+
+MAKE_FLAGS += \
+       $(TARGET_CONFIGURE_OPTS) \
+       $(1) \
+
+TARGET_LDFLAGS += \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/scmpc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/src/scmpc $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/scmpc.init $(1)/etc/init.d/scmpc
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_BUILD_DIR)/examples/scmpc.conf $(1)/etc/
+endef
+
+define Package/scmpc/conffiles
+/etc/scmpc.conf
+endef
+
+$(eval $(call BuildPackage,scmpc))
diff --git a/sound/scmpc/files/scmpc.init b/sound/scmpc/files/scmpc.init
new file mode 100644 (file)
index 0000000..5327b6b
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=94
+
+SERVICE_USE_PID=1
+
+start() {
+       mkdir -m 0755 -p /var/lib/scmpc
+       service_start /usr/bin/scmpc
+}
+
+stop() {
+       service_stop /usr/bin/scmpc
+}
diff --git a/sound/scmpc/patches/100-Rules.patch b/sound/scmpc/patches/100-Rules.patch
new file mode 100644 (file)
index 0000000..f9ad44d
--- /dev/null
@@ -0,0 +1,11 @@
+--- scmpc-0.2.2/src/Rules.mkorig       2007-10-31 23:32:48.000000000 +0100
++++ scmpc-0.2.2/src/Rules.mk   2007-10-31 23:19:00.000000000 +0100
+@@ -16,7 +16,7 @@
+ -include $(DEPENDS)
+ DEFINES := -DHAVE_CONFIG_H -D_GNU_SOURCE
+-INCLUDES := -I$(src_d) -I$(src_b)
++INCLUDES := -I$(src_d) -I$(src_b) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
+ LDLIBS := $(LIBS)
+ CLEAN += $(OBJS) $(PROGRAM)
diff --git a/sound/shell-fm/Makefile b/sound/shell-fm/Makefile
new file mode 100644 (file)
index 0000000..2c08ca4
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2006-2010 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:=shell-fm
+PKG_REV:=c274aa51b52185b289ac22f0cb95420a1c19868b
+PKG_VERSION:=0.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/jkramer/shell-fm.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shell-fm
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=+libao +libpthread +libmad
+  TITLE:=Console Based Last.FM Radio Player
+  URL:=http://nex.scrapping.cc
+endef
+
+define Package/shell-fm/description
+       Shell.FM is a console based player for the streams provided
+       by Last.FM for the Linux platform. It's lightweight and easy to use.
+endef
+
+define Package/shell-fm/conffiles
+/etc/shell-fm.rc
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -I./include/ -DLIBAO $(TARGET_CPPFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               LDFLAGS="$(TARGET_LDFLAGS) -lmad -lao -lpthread" \
+               all install
+endef
+
+define Package/shell-fm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/shell-fm $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/shell-fm.rc $(1)/etc/shell-fm.rc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/shell-fm.init $(1)/etc/init.d/shell-fm
+endef
+
+$(eval $(call BuildPackage,shell-fm))
diff --git a/sound/shell-fm/files/shell-fm.init b/sound/shell-fm/files/shell-fm.init
new file mode 100644 (file)
index 0000000..f0403b6
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=99
+start() {
+       [ -d /tmp/.shell-fm ] || mkdir /tmp/.shell-fm
+       [ -L /tmp/.shell-fm/shell-fm.rc ] || ln -s /etc/shell-fm.rc /tmp/.shell-fm/shell-fm.rc
+       [ -L /tmp/.libao ] || ln -s /etc/libao.conf /tmp/.libao
+       HOME=/tmp shell-fm -d
+}
+
+stop() {
+       echo "quit" | telnet localhost 54311
+}
diff --git a/sound/shell-fm/files/shell-fm.rc b/sound/shell-fm/files/shell-fm.rc
new file mode 100644 (file)
index 0000000..b3f6a2d
--- /dev/null
@@ -0,0 +1,9 @@
+username = username
+password = password
+#np-cmd = netmsg <network> "%a - %t"
+default-radio = lastfm://artist/Nightwish/similarartists
+t-color = 1;32          # light green track titles
+a-color = 0;32          # dark green track artist names
+s-color = 1;37          # white station names
+bind = 0.0.0.0
+#extern = madplay -q -
diff --git a/sound/sox/Makefile b/sound/sox/Makefile
new file mode 100644 (file)
index 0000000..466f44d
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Copyright (C) 2008 David Cooper <dave@kupesoft.com>
+# Copyright (C) 2006-2012 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:=sox
+PKG_VERSION:=14.4.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/sox
+PKG_MD5SUM:=ff9ca6aca972549de0e80e8e30ed379c
+
+PKG_LICENSE:=LGPLv2.1 GPLv2
+PKG_LICENSE_FILES:=COPYING LICENSE.LGPL LICENSE.GPL
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/sox
+  SECTION:=sound
+  CATEGORY:=Sound
+  DEPENDS:=+BUILD_PATENTED:lame-lib +BUILD_PATENTED:libmad +BUILD_PATENTED:libid3tag +libvorbis +libvorbisidec +libgsm +alsa-lib +libsndfile +libflac +ffmpeg +libmagic +libpng +libao
+  TITLE:=Sox is a general purpose sound converter/player/recorder
+  URL:=http://sox.sourceforge.net/
+  MAINTAINER:=Hamish Guthrie <hcg@openwrt.org>
+endef
+
+define Package/sox/description
+       SoX is a command line utility that can convert various formats
+       of computer audio files in to other formats. It can also apply
+       various effects to these sound files during the conversion.
+       As an added bonus, SoX can play and record audio files on
+       several unix-style platforms.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-external-gsm \
+               --disable-oss \
+               --enable-alsa \
+               --disable-libao \
+               --without-libltdl \
+               --with-ogg \
+               --with-flac \
+               --with-ffmpeg \
+               --without-amr-wb \
+               --without-amr-nb \
+               --without-samplerate \
+               --without-ladspa \
+               --$(if $(CONFIG_BUILD_PATENTED),with-mad,without-mad) \
+               --$(if $(CONFIG_BUILD_PATENTED),with-lame,without-lame) \
+               --$(if $(CONFIG_BUILD_PATENTED),with-id3tag,without-id3tag) \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include \
+               $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/libsox.{a,so*,la} \
+               $(1)/usr/lib/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/sox/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/{play,rec,sox} $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsox.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,sox))
diff --git a/sound/sox/patches/001-cross_compile.patch b/sound/sox/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..7996ece
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -144,7 +144,7 @@ EXTRA_DIST = monkey.wav optional-fmts.am
+            CMakeLists.txt soxconfig.h.cmake \
+            tests.sh testall.sh tests.bat testall.bat test-comments
+-all: sox$(EXEEXT) play rec soxi sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT)
++all: sox$(EXEEXT) play rec
+ play rec: sox$(EXEEXT)
+       if test "$(PLAYRECLINKS)" = "yes"; then \
+--- sox-14.4.1/src/Makefile.in
++++ sox-14.4.1/src/Makefile.in
+@@ -2904,7 +2904,7 @@
+       uninstall-libLTLIBRARIES uninstall-pkglibLTLIBRARIES
+-all: sox$(EXEEXT) play rec soxi sox_sample_test$(EXEEXT) example0$(EXEEXT) example1$(EXEEXT) example2$(EXEEXT) example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT)
++all: sox$(EXEEXT) play rec
+ play rec: sox$(EXEEXT)
+       if test "$(PLAYRECLINKS)" = "yes"; then \
diff --git a/sound/sox/patches/010-fix_uclibc_build_issue.patch b/sound/sox/patches/010-fix_uclibc_build_issue.patch
new file mode 100644 (file)
index 0000000..06454cd
--- /dev/null
@@ -0,0 +1,19 @@
+--- sox-14.4.1.orig/src/formats.c
++++ sox-14.4.1/src/formats.c
+@@ -409,7 +409,7 @@ static void UNUSED rewind_pipe(FILE * fp
+ #if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__
+   fp->_p -= PIPE_AUTO_DETECT_SIZE;
+   fp->_r += PIPE_AUTO_DETECT_SIZE;
+-#elif defined __GLIBC__
++#elif defined __GLIBC__ && ! defined __UCLIBC__
+   fp->_IO_read_ptr = fp->_IO_read_base;
+ #elif defined _MSC_VER || defined _WIN32 || defined _WIN64 || defined _ISO_STDIO_ISO_H
+   fp->_ptr = fp->_base;
+@@ -417,7 +417,6 @@ static void UNUSED rewind_pipe(FILE * fp
+   /* To fix this #error, either simply remove the #error line and live without
+    * file-type detection with pipes, or add support for your compiler in the
+    * lines above.  Test with cat monkey.wav | ./sox --info - */
+-  #error FIX NEEDED HERE
+   #define NO_REWIND_PIPE
+   (void)fp;
+ #endif
diff --git a/sound/sox/patches/020-ffmpeg-0.11.patch b/sound/sox/patches/020-ffmpeg-0.11.patch
new file mode 100644 (file)
index 0000000..61f6e23
--- /dev/null
@@ -0,0 +1,129 @@
+--- a/configure
++++ b/configure
+@@ -15825,9 +15825,9 @@
+   cat >>confdefs.h <<_ACEOF
+ #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+ _ACEOF
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for av_open_input_file in -lavformat" >&5
+-$as_echo_n "checking for av_open_input_file in -lavformat... " >&6; }
+-if ${ac_cv_lib_avformat_av_open_input_file+:} false; then :
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avformat_open_input in -lavformat" >&5
++$as_echo_n "checking for avformat_open_input in -lavformat... " >&6; }
++if ${ac_cv_lib_avformat_avformat_open_input+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+@@ -15841,27 +15841,27 @@
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+-char av_open_input_file ();
++char avformat_open_input ();
+ int
+ main ()
+ {
+-return av_open_input_file ();
++return avformat_open_input ();
+   ;
+   return 0;
+ }
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+-  ac_cv_lib_avformat_av_open_input_file=yes
++  ac_cv_lib_avformat_avformat_open_input=yes
+ else
+-  ac_cv_lib_avformat_av_open_input_file=no
++  ac_cv_lib_avformat_avformat_open_input=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_av_open_input_file" >&5
+-$as_echo "$ac_cv_lib_avformat_av_open_input_file" >&6; }
+-if test "x$ac_cv_lib_avformat_av_open_input_file" = xyes; then :
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avformat_avformat_open_input" >&5
++$as_echo "$ac_cv_lib_avformat_avformat_open_input" >&6; }
++if test "x$ac_cv_lib_avformat_avformat_open_input" = xyes; then :
+   for ac_header in libavcodec/avcodec.h ffmpeg/avcodec.h
+ do :
+   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+diff -Naur sox-14.4.0-orig/src/ffmpeg.c sox-14.4.0/src/ffmpeg.c
+--- sox-14.4.0-orig/src/ffmpeg.c       2012-06-12 00:35:53.459027469 -0400
++++ sox-14.4.0/src/ffmpeg.c    2012-06-12 00:36:26.539028545 -0400
+@@ -93,7 +93,7 @@
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+   enc->error_resilience = 1;
+ #else
+-  enc->error_recognition = 1;
++  enc->err_recognition = 1;
+ #endif
+   if (!codec || avcodec_open(enc, codec) < 0)
+@@ -157,7 +157,7 @@
+ static int startread(sox_format_t * ft)
+ {
+   priv_t * ffmpeg = (priv_t *)ft->priv;
+-  AVFormatParameters params;
++  AVDictionary *params;
+   int ret;
+   int i;
+@@ -172,7 +172,7 @@
+   /* Open file and get format */
+   memset(&params, 0, sizeof(params));
+-  if ((ret = av_open_input_file(&ffmpeg->ctxt, ft->filename, NULL, 0, &params)) < 0) {
++  if ((ret = avformat_open_input(&ffmpeg->ctxt, ft->filename, NULL, &params)) < 0) {
+     lsx_fail("ffmpeg cannot open file for reading: %s (code %d)", ft->filename, ret);
+     return SOX_EOF;
+   }
+@@ -231,7 +231,7 @@
+     /* If input buffer empty, read more data */
+     if (ffmpeg->audio_buf_index * 2 >= ffmpeg->audio_buf_size) {
+       if ((ret = av_read_frame(ffmpeg->ctxt, pkt)) < 0 &&
+-        (ret == AVERROR_EOF || url_ferror(ffmpeg->ctxt->pb)))
++        (ret == AVERROR_EOF || ffmpeg->ctxt->pb->error))
+       break;
+       ffmpeg->audio_buf_size = audio_decode_frame(ffmpeg, ffmpeg->audio_buf_aligned, AVCODEC_MAX_AUDIO_FRAME_SIZE);
+       ffmpeg->audio_buf_index = 0;
+@@ -373,13 +373,6 @@
+       return SOX_EOF;
+   }
+-  /* set the output parameters (must be done even if no
+-     parameters). */
+-  if (av_set_parameters(ffmpeg->ctxt, NULL) < 0) {
+-    lsx_fail("ffmpeg invalid output format parameters");
+-    return SOX_EOF;
+-  }
+-
+   /* Next line for debugging */
+   /* dump_format(ffmpeg->ctxt, 0, ft->filename, 1); */
+@@ -391,14 +384,14 @@
+   /* open the output file, if needed */
+   if (!(ffmpeg->fmt->flags & AVFMT_NOFILE)) {
+-    if (url_fopen(&ffmpeg->ctxt->pb, ft->filename, URL_WRONLY) < 0) {
++    if (avio_open(&ffmpeg->ctxt->pb, ft->filename, AVIO_FLAG_WRITE) < 0) {
+       lsx_fail("ffmpeg could not open `%s'", ft->filename);
+       return SOX_EOF;
+     }
+   }
+   /* write the stream header, if any */
+-  av_write_header(ffmpeg->ctxt);
++  avformat_write_header(ffmpeg->ctxt, NULL);
+   return SOX_SUCCESS;
+ }
+@@ -478,7 +471,7 @@
+ #if (LIBAVFORMAT_VERSION_INT < 0x340000)
+     url_fclose(&ffmpeg->ctxt->pb);
+ #else
+-    url_fclose(ffmpeg->ctxt->pb);
++    avio_close(ffmpeg->ctxt->pb);
+ #endif
+   }
+
diff --git a/sound/streamripper/Makefile b/sound/streamripper/Makefile
new file mode 100644 (file)
index 0000000..cf238ab
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2007-2010 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:=streamripper
+PKG_VERSION:=1.62.0
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=1a8353af3c36d56f2d8ee8552f632071
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+PKG_LIBTOOL_PATHS:=. tre-0.7.2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/streamripper
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  DEPENDS:=+libmad +libfaad2 +libpthread
+  TITLE:=streamripper
+  URL:=http://streamripper.sourceforge.net/
+endef
+
+define Package/streamripper/description
+       Streamripper is an Open Source application that lets you record streaming mp3 to your hard drive.
+endef
+
+
+EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
+
+CONFIGURE_ARGS+= \
+       --without-ogg \
+       --with-included-argv \
+       --without-included-libmad \
+       --without-libiconv-prefix \
+       --with-included-tre \
+       --with-gnu-ld \
+
+define Package/streamripper/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/streamripper $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/agrep $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtre.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,streamripper))
diff --git a/utils/acpid/Makefile b/utils/acpid/Makefile
new file mode 100644 (file)
index 0000000..c772f00
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2012 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:=acpid
+PKG_VERSION:=2.0.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://tedfelix.com/linux/
+PKG_MD5SUM:=d5dd88bcfaa4a0bf51905e95115da6df
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/acpid
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The ACPI Daemon (acpid) With Netlink Support
+  URL:=http://tedfelix.com/linux/acpid-netlink.html
+  DEPENDS:=+kmod-input-evdev +kmod-acpi-button
+endef
+
+define Package/acpid/description
+  The ACPI Daemon (acpid) With Netlink Support
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               LD="$(TARGET_CC)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               all
+endef
+
+define Package/acpid/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/acpid $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/acpi_listen $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/acpi/events
+       $(INSTALL_CONF) ./files/default $(1)/etc/acpi/events/default
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_CONF) ./files/acpid.init $(1)/etc/init.d/acpid
+       chmod 0750 $(1)/etc/init.d/acpid
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/input/
+       $(INSTALL_CONF) ./files/acpid.hotplug $(1)/etc/hotplug.d/input/
+endef
+
+define Package/acpid/postinst
+#!/bin/sh
+[ -n "$${IPKG_INSTROOT}" ] || {
+       echo "waiting for input devices to come up"
+       /etc/init.d/acpid enable
+       sleep 5
+       /etc/init.d/acpid start
+       echo "please try the power button"
+       exit 0
+}
+endef
+
+$(eval $(call BuildPackage,acpid))
diff --git a/utils/acpid/files/acpid.hotplug b/utils/acpid/files/acpid.hotplug
new file mode 100644 (file)
index 0000000..6e08d01
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. /lib/functions.sh
+
+if [ "$ACTION" = add ] && [ "$DEVICENAME" = event0 ]; then
+        ( /etc/init.d/acpid/stop; sleep 3; /usr/sbin/acpid )&
+fi
diff --git a/utils/acpid/files/acpid.init b/utils/acpid/files/acpid.init
new file mode 100644 (file)
index 0000000..3365aa0
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/ash /etc/rc.common
+# Copyright (C) 2009-2010 OpenWrt.org
+
+START=99
+STOP=80
+
+ACPID_BIN="/usr/sbin/acpid"
+ACPID_PID="/var/run/acpid.pid"
+
+start() {
+    [ -x "$ACPID_BIN" ] || return 1
+    start-stop-daemon -S -x $ACPID_BIN -p $ACPID_PID
+}
+
+boot() {
+       # Do nothing on boot
+       [ -x "$ACPID_BIN" ] || return 1
+       start-stop-daemon -S -x $ACPID_BIN -p $ACPID_PID
+       exit 0
+}
+
+stop() {
+       service_kill ${ACPID_BIN##*/} $ACPID_PID
+       rm -f $ACPID_PID
+}
diff --git a/utils/acpid/files/default b/utils/acpid/files/default
new file mode 100644 (file)
index 0000000..cf8d9a3
--- /dev/null
@@ -0,0 +1,5 @@
+# This is a sample ACPID configuration
+
+event=button/power.*
+action=/sbin/poweroff 
+
diff --git a/utils/anyremote/Makefile b/utils/anyremote/Makefile
new file mode 100644 (file)
index 0000000..0441cff
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2008-2013 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:=anyremote
+PKG_VERSION:=6.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/${PKG_NAME}
+PKG_MD5SUM:=130369d8f632127b20de67930386e9ca
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/anyremote
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A bluetooth remote control app
+  DEPENDS:=+bluez-libs +libpthread
+  URL:=http://anyremote.sourceforge.net/
+endef
+
+define Package/anyremote/description
+ Remote control your machine via bluetooth
+endef
+
+define Build/Configure
+    $(call Build/Configure/Default, \
+    --disable-xtest --disable-glib --disable-iconv \
+    )
+endef
+
+define Package/anyremote/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/anyremote.cfg $(1)/etc/anyremote.cfg
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/anyremote.init $(1)/etc/init.d/anyremote
+endef
+
+define Package/anyremote/conffiles
+/etc/anyremote.cfg
+endef
+
+$(eval $(call BuildPackage,anyremote))
diff --git a/utils/anyremote/files/anyremote.cfg b/utils/anyremote/files/anyremote.cfg
new file mode 100644 (file)
index 0000000..13ee8f4
--- /dev/null
@@ -0,0 +1,105 @@
+%
+% anyremote configuration file. (Server-mode)
+%
+
+% STATUS unknown
+% XTEST no
+% SOUND no
+% ENV no
+
+GuiAppName=Admin
+GuiAppType=Example
+GuiAppBinary=true
+GuiAppProtocols=Server
+GuiAppDesc=Show free space on disks, system uptime, dmesg output. Allows to reboot PC.
+
+[Protocol]=Server
+
+(Connect)=\
+       ExecAndSet(status,uname -n);\
+       ExecAndSet(title,whoami);\
+       Set(icons,ADMIN,1,plus,2,default,3,default,4,default,5,default,6,default,7,default,8,default,9,default,*,question,0,no,#,default);
+
+* *=\
+       Set(text,replace,Help,1 - Show list of features)
+
+Back=\
+       Set(text,close);
+
+1=\
+       Make(mode,LIST);
+
+
+[Mode]=LIST
+
+(EnterMode)=\
+       Macro(ADM_LIST);\
+       Set(menu,replace,Choose);
+       
+ADM_LIST=\
+       Set(list,replace,Admin,Disk space,Uptime,Dmesg,Reboot,Shutdown);
+
+DISK_SPACE=\
+       ExecAndSet(text,replace,Free Space,df -kl|tr -s ' '|cut -f 1,4 -d ' ');\
+       Make(mode,TXT);
+
+UPTIME=\
+       Set(list,close);\
+       ExecAndSet(title,uptime|tr -s ' '|cut -d ' ' -f 3,4,5);\
+       Make(mode,default);
+
+DMESG=\
+       ExecAndSet(text,replace,Dmesg output, dmesg|tail -50);\
+       Make(mode,TXT);
+
+REBOOT=\
+       Exec(reboot);
+
+SHUTDOWN=\
+       Exec(poweroff);
+
+Back($$)=\
+       Set(list,close);\
+       Make(mode,default);
+
+Choose(Disk space)=\
+       Macro(DISK_SPACE);
+
+Choose(Uptime)=\
+       Macro(UPTIME);
+
+Choose(Dmesg)=\
+       Macro(DMESG);
+
+Choose(Reboot)=\
+       Macro(REBOOT);
+
+Choose(Shutdown)=\
+       Macro(SHUTDOWN);
+
+Push(Disk space)=\
+       Macro(DISK_SPACE);
+       
+Push(Uptime)=\
+       Macro(UPTIME);
+
+Push(Dmesg)=\
+       Macro(DMESG);
+
+Push(Reboot)=\
+       Macro(REBOOT);
+
+Push(Shutdown)=\
+       Macro(SHUTDOWN);
+
+[ModeEnd]
+
+[Mode]=TXT
+
+Back=\
+       Set(text,close);\
+       Make(mode,LIST);
+
+[ModeEnd]
+
+[End]
diff --git a/utils/anyremote/files/anyremote.init b/utils/anyremote/files/anyremote.init
new file mode 100644 (file)
index 0000000..af05f49
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=95
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start() {
+       service_start /usr/sbin/anyremote -f /etc/anyremote.cfg
+}
+
+stop() {
+       service_stop /usr/sbin/anyremote
+}
diff --git a/utils/anyremote/patches/010-dont-add-host-includes.patch b/utils/anyremote/patches/010-dont-add-host-includes.patch
new file mode 100644 (file)
index 0000000..56ef80f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -4135,7 +4135,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>c
+ fi
+-CFLAGS="$CFLAGS -I/usr/local/include -Wall -D_REENTRANT -O2 -g"
++CFLAGS="$CFLAGS -Wall -D_REENTRANT -O2 -g"
+ # On IRIX 5.3, sys/types and inttypes.h are conflicting.
+ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
diff --git a/utils/ap51-flash/Makefile b/utils/ap51-flash/Makefile
new file mode 100644 (file)
index 0000000..ae5a8c3
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2010-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:=ap51-flash
+PKG_REV:=232
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=3
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=ap51-flash-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://dev.cloudtrax.com/downloads/svn/ap51-flash/trunk
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_MIRROR_MD5SUM:=3bff5b2ffa77ee80a807f3d24165b7cf
+
+include $(INCLUDE_DIR)/package.mk
+
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+  STAMP_BUILT:=$(STAMP_BUILT)_big
+endif
+
+define Package/ap51-flash
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A tool for flashing (nearly) all ap51/ap61 based routers
+  URL:=http://dev.cloudtrax.com/wiki/ap51-flash-station
+endef
+
+TARGET_EXTRA_CFLAGS:=-DFLASH_FROM_FILE -DNO_LIBPCAP
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+       TARGET_EXTRA_CFLAGS:=$(TARGET_EXTRA_CFLAGS) -DUIP_CONF_BYTE_ORDER=1234
+endif
+
+# pass optimization flags
+MAKE_FLAGS += \
+       OFLAGS="$(TARGET_CFLAGS)" \
+       EXTRA_CFLAGS="$(TARGET_EXTRA_CFLAGS)" \
+       REVISION="$(PKG_VERSION)" \
+
+define Package/ap51-flash/install
+       $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/usr/sbin \
+               $(1)/usr/lib/ap51-flash
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ap51-flash $(1)/usr/sbin/
+       $(INSTALL_BIN) ./files/ap51-flash.init $(1)/etc/init.d/ap51-flash
+       $(INSTALL_BIN) ./files/ap51-flash.sh $(1)/usr/lib/ap51-flash/ap51-flash.sh
+       $(INSTALL_DATA) ./files/ap51-flash.config $(1)/etc/config/ap51-flash
+endef
+
+define Package/ap51-flash/conffiles
+/etc/config/ap51-flash
+endef
+
+$(eval $(call BuildPackage,ap51-flash))
diff --git a/utils/ap51-flash/files/ap51-flash.config b/utils/ap51-flash/files/ap51-flash.config
new file mode 100644 (file)
index 0000000..f66973f
--- /dev/null
@@ -0,0 +1,6 @@
+#config flash
+#      option ifname   eth0.1
+#      option rootfs   /tmp/images/openwrt-atheros-root.squashfs
+#      option kernel   /tmp/images/openwrt-atheros-vmlinux.lzma
+#      option ubnt     /tmp/images/openwrt-atheros-ubnt5-squashfs.bin
+##     option loop     '1'
diff --git a/utils/ap51-flash/files/ap51-flash.init b/utils/ap51-flash/files/ap51-flash.init
new file mode 100644 (file)
index 0000000..1633ac4
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010 OpenWrt.org
+
+START=20
+
+NAME=ap51-flash
+
+start_daemon() {
+       local cfg="$1"
+
+       config_get_bool loop "$cfg" loop
+       config_get ifname "$cfg" ifname
+       config_get rootfs "$cfg" rootfs
+       config_get kernel "$cfg" kernel
+       config_get ubnt "$cfg" ubnt
+       [ "$loop" != "1" ] && loop=0
+       if [ -n "$ifname" -a -n "$rootfs" -a -n "$kernel" ] || \
+          [ -n "$ifname" -a -n "$ubnt" ]; then
+               PID="`cat /var/run/$NAME.sh-$ifname.pid 2> /dev/null`"
+               [ -z "`ps | grep "^.[ ]*$PID "`" ] && \
+                       rm /var/run/$NAME.sh-$ifname.pid
+               [ -n "`ls /var/run/$NAME.sh-$ifname.pid 2> /dev/null`" ] && {
+                       echo "Can't start more than one ap51-flash for interface $ifname!"
+                       return 0
+               }
+               start-stop-daemon -S -b -m -p /var/run/$NAME.sh-$ifname.pid -n $NAME.sh \
+                       -x /usr/lib/ap51-flash/$NAME.sh -- "$loop" "$ifname" "$rootfs" "$kernel" "$ubnt"
+       fi
+}
+
+start() {
+       config_load ap51-flash
+       config_foreach start_daemon flash
+}
+
+stop() {
+       # Terminating all ap51-flash processes
+       echo "WARNING: Going to teminate all ap51-flash processes! (hope you made sure that they're not flashing right now)"
+       echo "OR you can stop this with Ctrl+c within 10 seconds"
+       sleep 10
+       local pidfile
+       for pidfile in `ls /var/run/${NAME}.sh-*.pid 2> /dev/null`; do
+               start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}.sh" >/dev/null
+               rm -f "${pidfile}"
+       done
+       for pidfile in `ls /var/run/${NAME}-*.pid 2> /dev/null`; do
+               start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}" >/dev/null
+               rm -f "${pidfile}"
+       done
+}
diff --git a/utils/ap51-flash/files/ap51-flash.sh b/utils/ap51-flash/files/ap51-flash.sh
new file mode 100755 (executable)
index 0000000..9ac33ee
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+NAME=ap51-flash
+rootfs=""
+kernel=""
+ubnt=""
+
+[ $1 -eq "1" ] && loop="1"
+ifname="$2"
+[ -n "$3" ] && rootfs="--rootfs $3"
+[ -n "$4" ] && kernel="--kernel $4"
+[ -n "$5" ] && ubnt="--ubnt $5"
+
+while [ 1 ]; do
+       start-stop-daemon -S -m -p /var/run/$NAME-$ifname.pid -n $NAME \
+               -x /usr/sbin/$NAME -- --flash-from-file $rootfs $kernel $ubnt $ifname
+       
+       rm /var/run/$NAME-$ifname.pid
+       [ "$loop" != "1" ] && break
+       sleep 15
+done
diff --git a/utils/at/Makefile b/utils/at/Makefile
new file mode 100644 (file)
index 0000000..389e620
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2008-2014 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:=at
+PKG_VERSION:=3.1.13
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/a/at
+PKG_MD5SUM:=1da61af6c29e323abaaf13ee1a8dad79
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/at
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libelf1
+  TITLE:=Delayed job execution and batch processing
+  URL:=http://packages.debian.org/stable/at
+  MAINTAINER:=Luka Perkov <openwrt@lukaperkov.net>
+endef
+
+define Package/at/description
+ At and batch read shell commands from standard input storing them as a job to
+ be scheduled for execution in the future.
+endef
+
+export SENDMAIL=/bin/true
+EXTRA_CFLAGS:=-DNEED_YYWRAP -I$(PKG_BUILD_DIR) \
+       $(TARGET_LDFLAGS)
+
+CONFIGURE_ARGS+=--prefix=/usr \
+               --with-daemon_username=nobody \
+               --with-daemon_groupname=nogroup \
+               --with-jobdir=/var/spool/cron/atjobs \
+               --with-atspool=/var/spool/cron/atspool
+
+CONFIGURE_VARS += \
+       ac_cv_header_security_pam_appl_h=no
+
+define Package/at/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/sbin $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/atd.init $(1)/etc/init.d/atd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/at $(1)/usr/bin
+       ln -sf at $(1)/usr/bin/atq
+       ln -sf at $(1)/usr/bin/atrm
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/atd $(1)/usr/sbin
+endef
+
+$(eval $(call BuildPackage,at))
diff --git a/utils/at/files/atd.init b/utils/at/files/atd.init
new file mode 100755 (executable)
index 0000000..6254d29
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       [ -d /var/spool/cron/atjobs ] || {
+               mkdir -m 0755 -p /var/spool/cron/atjobs
+               touch /var/spool/cron/atjobs/.SEQ
+               chown -R nobody:nogroup /var/spool/cron/atjobs
+       }
+       [ -d /var/spool/cron/atspool ] || {
+               mkdir -m 0755 -p /var/spool/cron/atspool
+               chown -R nobody:nogroup /var/spool/cron/atspool
+       }
+       service_start /usr/sbin/atd
+}
+
+stop() {
+       service_stop /usr/sbin/atd
+}
diff --git a/utils/at/patches/100-cross-compile.patch b/utils/at/patches/100-cross-compile.patch
new file mode 100644 (file)
index 0000000..fbbc7e4
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/configure
++++ b/configure
+@@ -3458,27 +3458,6 @@ $as_echo "yes" >&6; }
+ $as_echo "no" >&6; }
+     ;;
+ esac
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Trying to compile a trivial ANSI C program" >&5
+-$as_echo_n "checking Trying to compile a trivial ANSI C program... " >&6; }
+-if test "$cross_compiling" = yes; then :
+-  as_fn_error $? "Could not compile and run even a trivial ANSI C program - check CC." "$LINENO" 5
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+- main(int ac, char **av) { return 0; }
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+-else
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-    as_fn_error $? "Could not compile and run even a trivial ANSI C program - check CC." "$LINENO" 5
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
+-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking __attribute__((noreturn))" >&5
+ $as_echo_n "checking __attribute__((noreturn))... " >&6; }
diff --git a/utils/at/patches/110-getloadavg.patch b/utils/at/patches/110-getloadavg.patch
new file mode 100644 (file)
index 0000000..0faef97
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/getloadavg.c
++++ b/getloadavg.c
+@@ -69,8 +69,9 @@ Boston, MA  02110-1301  USA */
+ #include <config.h>
+ #endif
+-#include "lisp.h"
+-#include "sysfile.h" /* for encapsulated open, close, read, write */
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #ifndef HAVE_GETLOADAVG
diff --git a/utils/avrdude/Makefile b/utils/avrdude/Makefile
new file mode 100644 (file)
index 0000000..015f0f4
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2008 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:=avrdude
+PKG_VERSION:=6.0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/avrdude
+PKG_MD5SUM:=346ec2e46393a54ac152b95abf1d9850
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/avrdude
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=AVR Downloader/UploaDEr
+  URL:=http://www.bsdhome.com/avrdude/
+  DEPENDS:=+libncurses +libreadline +libusb-compat +libftdi
+endef
+
+define Package/avrdude/description
+ AVRDUDE is a full featured program for programming Atmel's AVR CPU's.
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       chmod -R u+w $(PKG_BUILD_DIR)
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-doc \
+       --disable-parport \
+
+CONFIGURE_VARS += \
+       ac_cv_lib_elf_elf_begin=no \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install-exec
+endef
+
+define Package/avrdude/conffiles
+/etc/avrdude.conf
+endef
+
+define Package/avrdude/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/avrdude.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/avrdude $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,avrdude))
diff --git a/utils/avrusbboot/Makefile b/utils/avrusbboot/Makefile
new file mode 100644 (file)
index 0000000..81063b0
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2008-2014 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:=avrusbboot
+PKG_VERSION:=2006-06-25
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.fischl.de/avrusbboot/
+PKG_MD5SUM:=3e2f5e2c257918410a66c3463f583fdf
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/avrusbboot
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libusb-compat $(CXX_DEPENDS)
+  TITLE:=USB bootloader for Atmel AVR controllers
+  URL:=http://www.fischl.de/avrusbboot/
+endef
+
+define Package/avrusbboot/description
+  AVRUSBBoot is a bootloader for the Atmel AVR controllers.
+  It uses a firmware-only USB driver to transfer binary data
+  from the PC to the flash of the controller. Once the AVR
+  is flashed with the bootloader, no other ISP programmer is
+  needed; then the microcontroller can be reprogrammed over USB.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/software \
+               CXX="$(TARGET_CXX)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -fno-rtti" \
+               LFLAGS="$(TARGET_LDFLAGS) $(TARGET_CFLAGS) -lusb" \
+               all
+endef
+
+define Package/avrusbboot/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/software/avrusbboot $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,avrusbboot))
diff --git a/utils/avrusbboot/patches/001-fix_makefile.patch b/utils/avrusbboot/patches/001-fix_makefile.patch
new file mode 100644 (file)
index 0000000..4439b62
--- /dev/null
@@ -0,0 +1,18 @@
+diff -urN avrusbboot.2006-06-25/software/Makefile avrusbboot.2006-06-25.new/software/Makefile
+--- avrusbboot.2006-06-25/software/Makefile    2006-06-25 11:09:03.000000000 +0200
++++ avrusbboot.2006-06-25.new/software/Makefile        2008-05-20 12:54:22.000000000 +0200
+@@ -1,6 +1,5 @@
+-LIBUSB_CONFIG   = libusb-config
+-CFLAGS+=-g -Wall -pedantic `$(LIBUSB_CONFIG) --cflags`
+-LFLAGS+=`$(LIBUSB_CONFIG) --libs` -lusb
++CFLAGS=-I$(STAGING_DIR)/usr/include
++LFLAGS=-L$(STAGING_DIR)/usr/lib -lusb
+ all:
+       make avrusbboot
+@@ -10,4 +9,4 @@
+       rm avrusbboot
+ avrusbboot: main.cpp cflashmem.o cpage.o cbootloader.o
+-      g++ $(CFLAGS) main.cpp cflashmem.o cpage.o cbootloader.o -o avrusbboot $(LFLAGS)
++      $(CXX) $(CFLAGS) main.cpp cflashmem.o cpage.o cbootloader.o -o avrusbboot $(LFLAGS)
diff --git a/utils/avrusbboot/patches/002-fix_compilation.patch b/utils/avrusbboot/patches/002-fix_compilation.patch
new file mode 100644 (file)
index 0000000..bd8bcd9
--- /dev/null
@@ -0,0 +1,9 @@
+diff -ruN avrusbboot.2006-06-25-orig/software/main.cpp avrusbboot.2006-06-25-work/software/main.cpp
+--- avrusbboot.2006-06-25-orig/software/main.cpp       2006-06-25 09:33:13.000000000 +0200
++++ avrusbboot.2006-06-25-work/software/main.cpp       2008-05-01 17:25:30.000000000 +0200
+@@ -39,4 +39,4 @@
+   } 
+   return 0;
+-};
++}
diff --git a/utils/bandwidthd/Makefile b/utils/bandwidthd/Makefile
new file mode 100644 (file)
index 0000000..a91182d
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# 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:=bandwidthd
+PKG_VERSION:=2.0.1
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/bandwidthd
+PKG_MD5SUM:=aa79aad7bd489fd2cae1f7dc086ca8b6
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bandwidthd
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Bandwidthd
+  URL:=http://bandwidthd.sourceforge.net/
+  DEPENDS:=+libgd +libpcap
+endef
+
+define Package/bandwidthd/daemon
+ This package contains bandwidthd a bandwith tracking utility.
+endef
+
+CONFIGURE_ARGS += \
+       ac_cv_file__sw_lib=no \
+       ac_cv_file__sw_include=no \
+       ac_cv_file__usr_pkg_lib=no \
+       ac_cv_file__usr_pkg_include=no \
+       ac_cv_file__usr_local_pgsql_lib=no \
+       ac_cv_file__usr_local_pgsql_include=no \
+       ac_cv_lib_pq_PQconnectdb=no \
+
+EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
+EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+define Package/bandwidthd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
+       $(INSTALL_DIR) $(1)/www
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/
+endef
+
+define Package/bandwidthd/conffiles
+/etc/config/bandwidthd
+endef
+
+$(eval $(call BuildPackage,bandwidthd))
diff --git a/utils/bandwidthd/files/bandwidthd.config b/utils/bandwidthd/files/bandwidthd.config
new file mode 100644 (file)
index 0000000..4bb18cf
--- /dev/null
@@ -0,0 +1,11 @@
+config bandwidthd
+       option dev      br-lan
+       option subnets          "192.168.0.0/16 10.0.0.0/8 172.16.0.0/12"
+       option skip_intervals   0
+       option graph_cutoff     1024
+       option promiscuous      true
+       option output_cdf       false
+       option recover_cdf      false
+       option filter           ip
+       option graph            true
+       option meta_refresh     150
diff --git a/utils/bandwidthd/files/bandwidthd.init b/utils/bandwidthd/files/bandwidthd.init
new file mode 100644 (file)
index 0000000..6483daa
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=99
+
+config_cb() {
+       local cfg_type="$1"
+       local cfg_name="$2"
+
+       case "$cfg_type" in
+               bandwidthd)
+                       append cfgs "$cfg_name"
+               ;;
+       esac
+}
+
+export_bool() {
+       local option="$1"
+       local section="$2"
+       local _loctmp
+       config_get_bool _loctmp "$section" "$option"
+       if [ -n "$_loctmp" ]; then
+               conffile="${conffile}$option "
+               if [ 1 -eq "$_loctmp" ]; then
+                       conffile="${conffile}true"
+               else
+                       conffile="${conffile}false"
+               fi
+               conffile="${conffile}\n"
+       fi
+}
+
+export_number() {
+       local option="$1"
+       local section="$2"
+       local _loctmp
+       config_get _loctmp "$section" "$option"
+       if [ -n "$_loctmp" ]; then
+               conffile="${conffile}$option ${_loctmp}\n"
+       fi
+}
+
+export_string() {
+       local option="$1"
+       local section="$2"
+       local _loctmp
+       config_get _loctmp "$section" "$option"
+       if [ -n "$_loctmp" ]; then
+               conffile="${conffile}$option \"${_loctmp}\"\n"
+       fi
+}
+
+start() {
+       local subnet conffile
+
+       [ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/
+       [ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs
+       [ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd
+       rm -f /tmp/bandwidthd.conf
+       touch /tmp/bandwidthd.conf
+       [ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf
+       
+       
+       config_load bandwidthd
+       for cfg in $cfgs; do
+               config_get subnets $cfg subnets
+                       for subnet in $subnets; do
+                               conffile="${conffile}subnet ${subnet}\n"
+                       done
+               export_string dev $cfg
+               export_number skip_intervals $cfg
+               export_number graph_cutoff $cfg
+               export_bool promiscuous $cfg
+               export_bool output_cdf $cfg
+               export_bool recover_cdf $cfg
+               export_string filter $cfg
+               export_bool graph $cfg
+               export_number meta_refresh $cfg
+               [ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf
+               unset conffile
+       done
+       cd /
+       service_start /usr/sbin/bandwidthd
+}
+
+stop() {
+       service_stop /usr/sbin/bandwidthd
+}
diff --git a/utils/bandwidthd/files/logo.gif b/utils/bandwidthd/files/logo.gif
new file mode 100644 (file)
index 0000000..7b17cc6
Binary files /dev/null and b/utils/bandwidthd/files/logo.gif differ
diff --git a/utils/bandwidthd/patches/010-dont-add-host-paths.patch b/utils/bandwidthd/patches/010-dont-add-host-paths.patch
new file mode 100644 (file)
index 0000000..59a5737
--- /dev/null
@@ -0,0 +1,36 @@
+diff --git a/configure b/configure
+index 4c2546e..e516137 100755
+--- a/configure
++++ b/configure
+@@ -2439,11 +2439,6 @@ if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
+       LDFLAGS="$LDFLAGS -L$x_libraries"
+ fi
+-# May be equired for BSD
+-LDFLAGS="$LDFLAGS -L/usr/local/lib"
+-
+-CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+-
+ #Check for Darwin sw directory
+ echo "$as_me:2448: checking for /sw/lib" >&5
+ echo $ECHO_N "checking for /sw/lib... $ECHO_C" >&6
+@@ -2505,9 +2500,6 @@ fi
+ fi
+ echo "$as_me:2506: result: $ac_cv_file__usr_pkg_lib" >&5
+ echo "${ECHO_T}$ac_cv_file__usr_pkg_lib" >&6
+-if test $ac_cv_file__usr_pkg_lib = yes; then
+-  LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
+-fi
+ echo "$as_me:2512: checking for /usr/pkg/include" >&5
+ echo $ECHO_N "checking for /usr/pkg/include... $ECHO_C" >&6
+@@ -3092,9 +3084,6 @@ fi
+ fi
+ echo "$as_me:3093: result: $ac_cv_file__usr_local_pgsql_lib" >&5
+ echo "${ECHO_T}$ac_cv_file__usr_local_pgsql_lib" >&6
+-if test $ac_cv_file__usr_local_pgsql_lib = yes; then
+-  LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib"
+-fi
+ echo "$as_me:3099: checking for /usr/local/pgsql/include" >&5
+ echo $ECHO_N "checking for /usr/local/pgsql/include... $ECHO_C" >&6
diff --git a/utils/bandwidthd/patches/100-fix_config_file_location b/utils/bandwidthd/patches/100-fix_config_file_location
new file mode 100644 (file)
index 0000000..ae44cd2
--- /dev/null
@@ -0,0 +1,31 @@
+--- bandwidthd-2.0.1/bandwidthd.c.orig 2008-05-09 10:06:37.000000000 -0500
++++ bandwidthd-2.0.1/bandwidthd.c      2008-05-09 10:32:54.000000000 -0500
+@@ -255,22 +255,22 @@
+       openlog("bandwidthd", LOG_CONS, LOG_DAEMON);
+-      if (stat("./etc/bandwidthd.conf", &StatBuf))
++      if (stat("/etc/bandwidthd.conf", &StatBuf))
+               {
+               chdir(INSTALL_DIR);
+-              if (stat("./etc/bandwidthd.conf", &StatBuf))
++              if (stat("/etc/bandwidthd.conf", &StatBuf))
+                       {
+-                      printf("Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
+-                      syslog(LOG_ERR, "Cannot find ./etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
++                      printf("Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf\n", INSTALL_DIR);
++                      syslog(LOG_ERR, "Cannot find /etc/bandwidthd.conf or %s/etc/bandwidthd.conf", INSTALL_DIR);
+                       exit(1);
+                       }
+               }
+-      bdconfig_in = fopen("./etc/bandwidthd.conf", "rt");
++      bdconfig_in = fopen("/etc/bandwidthd.conf", "rt");
+       if (!bdconfig_in)
+               {
+               syslog(LOG_ERR, "Cannot open bandwidthd.conf");
+-              printf("Cannot open ./etc/bandwidthd.conf\n");
++              printf("Cannot open /etc/bandwidthd.conf\n");
+               exit(1);
+               }
+       bdconfig_parse();
diff --git a/utils/bash-completion/Makefile b/utils/bash-completion/Makefile
new file mode 100644 (file)
index 0000000..f5c4392
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2009-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:=bash-completion
+PKG_VERSION:=20080705
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/b/bash-completion/
+PKG_MD5SUM:=8bc36281bb0567bc67a9083c4c5595a9
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bash-completion
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=bash completion scripts
+  DEPENDS:=+libncurses +bash
+  URL:=http://www.caliban.org/bash/
+  PKGARCH:=all
+endef
+
+define Package/bash-completion/description
+  bash completion extends bashs standard completion behavior
+  to achieve complex command lines with just a few keystrokes.
+endef
+
+
+define Build/Configure
+endef
+
+
+define Build/Compile
+endef
+
+define Package/bash-completion/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bash_completion $(1)/etc/
+endef
+
+define Package/bash-completion/conffiles
+/etc/bash_completion
+endef
+
+$(eval $(call BuildPackage,bash-completion))
diff --git a/utils/bash/Makefile b/utils/bash/Makefile
new file mode 100644 (file)
index 0000000..bef9bcc
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2007-2012 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:=bash
+PKG_VERSION:=4.2
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/bash
+PKG_MD5SUM:=3fb927c7c33022f1c327f14a81c0d4b0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bash
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The GNU Bourne Again SHell
+  DEPENDS:=+libncurses
+  URL:=http://www.gnu.org/software/bash/
+endef
+
+define Package/bash/description
+       Bash is an sh-compatible command language interpreter that executes
+       commands read from the standard input or from a file. Bash also
+       incorporates useful features from the Korn and C shells (ksh and csh).
+endef
+
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --without-bash-malloc \
+                --bindir=/bin \
+       )
+endef
+
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/builtins LDFLAGS_FOR_BUILD= mkbuiltins
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               SHELL="/bin/bash" \
+               all install
+endef
+
+define Package/bash/postinst
+#!/bin/sh
+grep bash $${IPKG_INSTROOT}/etc/shells || \
+       echo "/bin/bash" >> $${IPKG_INSTROOT}/etc/shells
+       echo "/bin/rbash" >> $${IPKG_INSTROOT}/etc/shells
+endef
+
+define Package/bash/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/bash $(1)/bin/
+       ln -sf bash $(1)/bin/rbash
+endef
+
+$(eval $(call BuildPackage,bash))
diff --git a/utils/bash/patches/001-compile-fix.patch b/utils/bash/patches/001-compile-fix.patch
new file mode 100644 (file)
index 0000000..8f4090b
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/execute_cmd.c
++++ b/execute_cmd.c
+@@ -2202,7 +2202,11 @@ execute_pipeline (command, asynchronous,
+   /* If the `lastpipe' option is set with shopt, and job control is not
+      enabled, execute the last element of non-async pipelines in the
+      current shell environment. */
+-  if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
++  if (lastpipe_opt &&
++#if defined(JOB_CONTROL)
++               job_control == 0 && 
++#endif
++               asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
+     {
+       lstdin = move_to_high_fd (0, 0, 255);
+       if (lstdin > 0)
diff --git a/utils/bash/patches/002-force-internal-readline.patch b/utils/bash/patches/002-force-internal-readline.patch
new file mode 100644 (file)
index 0000000..ecb8375
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/configure
++++ b/configure
+@@ -5748,8 +5748,7 @@ _ACEOF
+               # static version specified as -llibname to override the
+               # dynamic version
+               case "${host_os}" in
+-              darwin[89]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
+-              *)              READLINE_LIB=-lreadline ;;
++              *) READLINE_LIB='${READLINE_LIBRARY}' ;;
+               esac
+       fi
+ else
+--- a/configure.in
++++ b/configure.in
+@@ -540,8 +540,7 @@ if test $opt_readline = yes; then
+               # static version specified as -llibname to override the
+               # dynamic version
+               case "${host_os}" in
+-              darwin[[89]]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
+-              *)              READLINE_LIB=-lreadline ;;
++              *) READLINE_LIB='${READLINE_LIBRARY}' ;;
+               esac
+       fi
+ else
diff --git a/utils/bash/patches/101-upstream-bash42-001.patch b/utils/bash/patches/101-upstream-bash42-001.patch
new file mode 100644 (file)
index 0000000..8aca815
--- /dev/null
@@ -0,0 +1,65 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-001
+
+Bug-Reported-by:       Juergen Daubert <jue@jue.li>
+Bug-Reference-ID:      <20110214175132.GA19813@jue.netz>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00125.html
+
+Bug-Description:
+
+When running in Posix mode, bash does not correctly expand the right-hand
+side of a double-quoted word expansion containing single quotes.
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -1379,10 +1379,12 @@ extract_dollar_brace_string (string, sin
+   slen = strlen (string + *sindex) + *sindex;
+   /* The handling of dolbrace_state needs to agree with the code in parse.y:
+-     parse_matched_pair() */
+-  dolbrace_state = 0;
+-  if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
+-    dolbrace_state = (flags & SX_POSIXEXP) ? DOLBRACE_QUOTE : DOLBRACE_PARAM;
++     parse_matched_pair().  The different initial value is to handle the
++     case where this function is called to parse the word in
++     ${param op word} (SX_WORD). */
++  dolbrace_state = (flags & SX_WORD) ? DOLBRACE_WORD : DOLBRACE_PARAM;
++  if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
++    dolbrace_state = DOLBRACE_QUOTE;
+   i = *sindex;
+   while (c = string[i])
+@@ -7176,7 +7178,7 @@ parameter_brace_expand (string, indexp, 
+     {
+       /* Extract the contents of the ${ ... } expansion
+        according to the Posix.2 rules. */
+-      value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#') ? SX_POSIXEXP : 0);
++      value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#' || c =='/' || c == '^' || c == ',' || c ==':') ? SX_POSIXEXP|SX_WORD : SX_WORD);
+       if (string[sindex] == RBRACE)
+       sindex++;
+       else
+--- a/subst.h
++++ b/subst.h
+@@ -56,6 +56,7 @@
+ #define SX_NOLONGJMP  0x0040  /* don't longjmp on fatal error */
+ #define SX_ARITHSUB   0x0080  /* extracting $(( ... )) (currently unused) */
+ #define SX_POSIXEXP   0x0100  /* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
++#define SX_WORD               0x0200  /* extracting word in ${param op word} */
+ /* Remove backslashes which are quoting backquotes from STRING.  Modifies
+    STRING, and returns a pointer to it. */
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 0
++#define PATCHLEVEL 1
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/102-upstream-bash42-002.patch b/utils/bash/patches/102-upstream-bash42-002.patch
new file mode 100644 (file)
index 0000000..3756ac1
--- /dev/null
@@ -0,0 +1,50 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-002
+
+Bug-Reported-by:       Clark J. Wang <dearvoid@gmail.com>
+Bug-Reference-ID:      <AANLkTimGbW7aC4E5infXP6ku5WPci4t=xVc+L1SyHqrD@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00157.html
+
+Bug-Description:
+
+The readline vi-mode `cc', `dd', and `yy' commands failed to modify the
+entire line.
+
+Patch (apply with `patch -p0'):
+
+--- a/lib/readline/vi_mode.c
++++ b/lib/readline/vi_mode.c
+@@ -1114,7 +1114,7 @@ rl_domove_read_callback (m)
+       rl_beg_of_line (1, c);
+       _rl_vi_last_motion = c;
+       RL_UNSETSTATE (RL_STATE_VIMOTION);
+-      return (0);
++      return (vidomove_dispatch (m));
+     }
+ #if defined (READLINE_CALLBACKS)
+   /* XXX - these need to handle rl_universal_argument bindings */
+--- a/lib/readline/callback.c
++++ b/lib/readline/callback.c
+@@ -148,6 +148,9 @@ rl_callback_read_char ()
+         eof = _rl_vi_domove_callback (_rl_vimvcxt);
+         /* Should handle everything, including cleanup, numeric arguments,
+            and turning off RL_STATE_VIMOTION */
++        if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
++          _rl_internal_char_cleanup ();
++
+         return;
+       }
+ #endif
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 1
++#define PATCHLEVEL 2
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/103-upstream-bash42-003.patch b/utils/bash/patches/103-upstream-bash42-003.patch
new file mode 100644 (file)
index 0000000..ad82635
--- /dev/null
@@ -0,0 +1,231 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-003
+
+Bug-Reported-by:       Clark J. Wang <dearvoid@gmail.com>
+Bug-Reference-ID:      <AANLkTikZ_rVV-frR8Fh0PzhXnMKnm5XsUR-F3qtPPs5G@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00136.html
+
+Bug-Description:
+
+When using the pattern replacement and pattern removal word expansions, bash
+miscalculates the possible match length in the presence of an unescaped left
+bracket without a closing right bracket, resulting in a failure to match
+the pattern.
+
+Patch (apply with `patch -p0'):
+
+--- a/lib/glob/gmisc.c
++++ b/lib/glob/gmisc.c
+@@ -77,8 +77,8 @@ wmatchlen (wpat, wmax)
+      wchar_t *wpat;
+      size_t wmax;
+ {
+-  wchar_t wc, *wbrack;
+-  int matlen, t, in_cclass, in_collsym, in_equiv;
++  wchar_t wc;
++  int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
+   if (*wpat == 0)
+     return (0);
+@@ -118,58 +118,80 @@ wmatchlen (wpat, wmax)
+         break;
+       case L'[':
+         /* scan for ending `]', skipping over embedded [:...:] */
+-        wbrack = wpat;
++        bracklen = 1;
+         wc = *wpat++;
+         do
+           {
+             if (wc == 0)
+               {
+-                matlen += wpat - wbrack - 1;  /* incremented below */
+-                break;
++                wpat--;                       /* back up to NUL */
++                matlen += bracklen;
++                goto bad_bracket;
+               }
+             else if (wc == L'\\')
+               {
+-                wc = *wpat++;
+-                if (*wpat == 0)
+-                  break;
++                /* *wpat == backslash-escaped character */
++                bracklen++;
++                /* If the backslash or backslash-escape ends the string,
++                   bail.  The ++wpat skips over the backslash escape */
++                if (*wpat == 0 || *++wpat == 0)
++                  {
++                    matlen += bracklen;
++                    goto bad_bracket;
++                  }
+               }
+             else if (wc == L'[' && *wpat == L':')     /* character class */
+               {
+                 wpat++;
++                bracklen++;
+                 in_cclass = 1;
+               }
+             else if (in_cclass && wc == L':' && *wpat == L']')
+               {
+                 wpat++;
++                bracklen++;
+                 in_cclass = 0;
+               }
+             else if (wc == L'[' && *wpat == L'.')     /* collating symbol */
+               {
+                 wpat++;
++                bracklen++;
+                 if (*wpat == L']')    /* right bracket can appear as collating symbol */
+-                  wpat++;
++                  {
++                    wpat++;
++                    bracklen++;
++                  }
+                 in_collsym = 1;
+               }
+             else if (in_collsym && wc == L'.' && *wpat == L']')
+               {
+                 wpat++;
++                bracklen++;
+                 in_collsym = 0;
+               }
+             else if (wc == L'[' && *wpat == L'=')     /* equivalence class */
+               {
+                 wpat++;
++                bracklen++;
+                 if (*wpat == L']')    /* right bracket can appear as equivalence class */
+-                  wpat++;
++                  {
++                    wpat++;
++                    bracklen++;
++                  }
+                 in_equiv = 1;
+               }
+             else if (in_equiv && wc == L'=' && *wpat == L']')
+               {
+                 wpat++;
++                bracklen++;
+                 in_equiv = 0;
+               }
++            else
++              bracklen++;
+           }
+         while ((wc = *wpat++) != L']');
+         matlen++;             /* bracket expression can only match one char */
++bad_bracket:
+         break;
+       }
+     }
+@@ -213,8 +235,8 @@ umatchlen (pat, max)
+      char *pat;
+      size_t max;
+ {
+-  char c, *brack;
+-  int matlen, t, in_cclass, in_collsym, in_equiv;
++  char c;
++  int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
+   if (*pat == 0)
+     return (0);
+@@ -254,58 +276,80 @@ umatchlen (pat, max)
+         break;
+       case '[':
+         /* scan for ending `]', skipping over embedded [:...:] */
+-        brack = pat;
++        bracklen = 1;
+         c = *pat++;
+         do
+           {
+             if (c == 0)
+               {
+-                matlen += pat - brack - 1;    /* incremented below */
+-                break;
++                pat--;                        /* back up to NUL */
++                matlen += bracklen;
++                goto bad_bracket;
+               }
+             else if (c == '\\')
+               {
+-                c = *pat++;
+-                if (*pat == 0)
+-                  break;
++                /* *pat == backslash-escaped character */
++                bracklen++;
++                /* If the backslash or backslash-escape ends the string,
++                   bail.  The ++pat skips over the backslash escape */
++                if (*pat == 0 || *++pat == 0)
++                  {
++                    matlen += bracklen;
++                    goto bad_bracket;
++                  }
+               }
+             else if (c == '[' && *pat == ':') /* character class */
+               {
+                 pat++;
++                bracklen++;
+                 in_cclass = 1;
+               }
+             else if (in_cclass && c == ':' && *pat == ']')
+               {
+                 pat++;
++                bracklen++;
+                 in_cclass = 0;
+               }
+             else if (c == '[' && *pat == '.') /* collating symbol */
+               {
+                 pat++;
++                bracklen++;
+                 if (*pat == ']')      /* right bracket can appear as collating symbol */
+-                  pat++;
++                  {
++                    pat++;
++                    bracklen++;
++                  }
+                 in_collsym = 1;
+               }
+             else if (in_collsym && c == '.' && *pat == ']')
+               {
+                 pat++;
++                bracklen++;
+                 in_collsym = 0;
+               }
+             else if (c == '[' && *pat == '=') /* equivalence class */
+               {
+                 pat++;
++                bracklen++;
+                 if (*pat == ']')      /* right bracket can appear as equivalence class */
+-                  pat++;
++                  {
++                    pat++;
++                    bracklen++;
++                  }
+                 in_equiv = 1;
+               }
+             else if (in_equiv && c == '=' && *pat == ']')
+               {
+                 pat++;
++                bracklen++;
+                 in_equiv = 0;
+               }
++            else
++              bracklen++;
+           }
+         while ((c = *pat++) != ']');
+         matlen++;             /* bracket expression can only match one char */
++bad_bracket:
+         break;
+       }
+     }
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 2
++#define PATCHLEVEL 3
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/104-upstream-bash42-004.patch b/utils/bash/patches/104-upstream-bash42-004.patch
new file mode 100644 (file)
index 0000000..e353c5b
--- /dev/null
@@ -0,0 +1,40 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-004
+
+Bug-Reported-by:       Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID:      <201102182106.17834.vapier@gentoo.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00222.html
+
+Bug-Description:
+
+When used in contexts where word splitting and quote removal were not
+performed, such as pattern removal or pattern substitution, empty strings
+(either literal or resulting from quoted variables that were unset or
+null) were not matched correctly, resulting in failure.
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -3373,7 +3373,7 @@ expand_string_for_rhs (string, quoted, d
+   if (string == 0 || *string == '\0')
+     return (WORD_LIST *)NULL;
+-  td.flags = 0;
++  td.flags = W_NOSPLIT2;              /* no splitting, remove "" and '' */
+   td.word = string;
+   tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
+   return (tresult);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 3
++#define PATCHLEVEL 4
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/105-upstream-bash42-005.patch b/utils/bash/patches/105-upstream-bash42-005.patch
new file mode 100644 (file)
index 0000000..5df63c7
--- /dev/null
@@ -0,0 +1,114 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-005
+
+Bug-Reported-by:       Dennis Williamson <dennistwilliamson@gmail.com>
+Bug-Reference-ID:      <AANLkTikDbEV5rnbPc0zOfmZfBcg0xGetzLLzK+KjRiNa@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00147.html
+
+Bug-Description:
+
+Systems that use tzset() to set the local timezone require the TZ variable
+to be in the environment.  Bash must make sure the environment has been
+modified with any updated value for TZ before calling tzset().  This
+affects prompt string expansions and the `%T' printf conversion specification
+on systems that do not allow bash to supply a replacement for getenv(3).
+
+Patch (apply with `patch -p0'):
+
+--- a/variables.h
++++ b/variables.h
+@@ -313,6 +313,7 @@ extern void set_func_auto_export __P((co
+ extern void sort_variables __P((SHELL_VAR **));
++extern int chkexport __P((char *));
+ extern void maybe_make_export_env __P((void));
+ extern void update_export_env_inplace __P((char *, int, char *));
+ extern void put_command_name_into_env __P((char *));
+--- a/variables.c
++++ b/variables.c
+@@ -3653,6 +3653,22 @@ n_shell_variables ()
+   return n;
+ }
++int
++chkexport (name)
++     char *name;
++{
++  SHELL_VAR *v;
++
++  v = find_variable (name);
++  if (exported_p (v))
++    {
++      array_needs_making = 1;
++      maybe_make_export_env ();
++      return 1;
++    }
++  return 0;
++}
++
+ void
+ maybe_make_export_env ()
+ {
+@@ -4214,7 +4230,7 @@ static struct name_and_function special_
+   { "TEXTDOMAIN", sv_locale },
+   { "TEXTDOMAINDIR", sv_locale },
+-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
++#if defined (HAVE_TZSET)
+   { "TZ", sv_tz },
+ #endif
+@@ -4558,12 +4574,13 @@ sv_histtimefmt (name)
+ }
+ #endif /* HISTORY */
+-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
++#if defined (HAVE_TZSET)
+ void
+ sv_tz (name)
+      char *name;
+ {
+-  tzset ();
++  if (chkexport (name))
++    tzset ();
+ }
+ #endif
+--- a/parse.y
++++ b/parse.y
+@@ -5135,6 +5135,9 @@ decode_prompt_string (string)
+           case 'A':
+             /* Make the current time/date into a string. */
+             (void) time (&the_time);
++#if defined (HAVE_TZSET)
++            sv_tz ("TZ");             /* XXX -- just make sure */
++#endif
+             tm = localtime (&the_time);
+             if (c == 'd')
+--- a/builtins/printf.def
++++ b/builtins/printf.def
+@@ -465,6 +465,9 @@ printf_builtin (list)
+                 secs = shell_start_time;      /* roughly $SECONDS */
+               else
+                 secs = arg;
++#if defined (HAVE_TZSET)
++              sv_tz ("TZ");           /* XXX -- just make sure */
++#endif
+               tm = localtime (&secs);
+               n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
+               free (timefmt);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 4
++#define PATCHLEVEL 5
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/106-upstream-bash42-006.patch b/utils/bash/patches/106-upstream-bash42-006.patch
new file mode 100644 (file)
index 0000000..89c887e
--- /dev/null
@@ -0,0 +1,37 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-006
+
+Bug-Reported-by:       Allan McRae <allan@archlinux.org>
+Bug-Reference-ID:      <4D6D0D0B.50908@archlinux.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00001.html
+
+Bug-Description:
+
+A problem with bash42-005 caused it to dump core if TZ was unset.
+
+Patch (apply with `patch -p0'):
+
+--- a/variables.c
++++ b/variables.c
+@@ -3660,7 +3660,7 @@ chkexport (name)
+   SHELL_VAR *v;
+   v = find_variable (name);
+-  if (exported_p (v))
++  if (v && exported_p (v))
+     {
+       array_needs_making = 1;
+       maybe_make_export_env ();
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 5
++#define PATCHLEVEL 6
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/107-upstream-bash42-007.patch b/utils/bash/patches/107-upstream-bash42-007.patch
new file mode 100644 (file)
index 0000000..7587195
--- /dev/null
@@ -0,0 +1,39 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-007
+
+Bug-Reported-by:       Matthias Klose <doko@debian.org>
+Bug-Reference-ID:      <4D6FD2AC.1010500@debian.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00015.html
+
+Bug-Description:
+
+When used in contexts where word splitting and quote removal were not
+performed, such as case statement word expansion, empty strings
+(either literal or resulting from quoted variables that were unset or
+null) were not expanded correctly, resulting in failure.
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -4609,6 +4609,7 @@ expand_word_unsplit (word, quoted)
+   if (ifs_firstc == 0)
+ #endif
+     word->flags |= W_NOSPLIT;
++  word->flags |= W_NOSPLIT2;
+   result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
+   expand_no_split_dollar_star = 0;
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 6
++#define PATCHLEVEL 7
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/108-upstream-bash42-008.patch b/utils/bash/patches/108-upstream-bash42-008.patch
new file mode 100644 (file)
index 0000000..29493b5
--- /dev/null
@@ -0,0 +1,65 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-008
+
+Bug-Reported-by:       Doug McMahon <mc2man@optonline.net>
+Bug-Reference-ID:      <1299441211.2535.11.camel@doug-XPS-M1330>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-03/msg00050.html
+
+Bug-Description:
+
+Bash-4.2 does not attempt to save the shell history on receipt of a
+terminating signal that is handled synchronously.  Unfortunately, the
+`close' button on most X11 terminal emulators sends SIGHUP, which
+kills the shell.
+
+This is a very small patch to save the history in the case that an
+interactive shell receives a SIGHUP or SIGTERM while in readline and
+reading a command.
+
+The next version of bash will do this differently.
+
+Patch (apply with `patch -p0'):
+
+--- a/sig.c
++++ b/sig.c
+@@ -46,6 +46,7 @@
+ #if defined (READLINE)
+ #  include "bashline.h"
++#  include <readline/readline.h>
+ #endif
+ #if defined (HISTORY)
+@@ -62,6 +63,7 @@ extern int parse_and_execute_level, shel
+ #if defined (HISTORY)
+ extern int history_lines_this_session;
+ #endif
++extern int no_line_editing;
+ extern void initialize_siglist ();
+@@ -505,7 +507,10 @@ termsig_sighandler (sig)
+     {
+ #if defined (HISTORY)
+       /* XXX - will inhibit history file being written */
+-      history_lines_this_session = 0;
++#  if defined (READLINE)
++      if (interactive_shell == 0 || interactive == 0 || (sig != SIGHUP && sig != SIGTERM) || no_line_editing || (RL_ISSTATE (RL_STATE_READCMD) == 0))
++#  endif
++        history_lines_this_session = 0;
+ #endif
+       terminate_immediately = 0;
+       termsig_handler (sig);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 7
++#define PATCHLEVEL 8
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/109-upstream-bash42-009.patch b/utils/bash/patches/109-upstream-bash42-009.patch
new file mode 100644 (file)
index 0000000..d05f499
--- /dev/null
@@ -0,0 +1,65 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-009
+
+Bug-Reported-by:       <piuma@piumalab.org>
+Bug-Reference-ID:      <4DAAC0DB.7060606@piumalab.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00075.html
+
+Bug-Description:
+
+Under certain circumstances, running `fc -l' two times in succession with a
+relative history offset at the end of the history will result in an incorrect
+calculation of the last history entry and a seg fault.
+
+Patch (apply with `patch -p0'):
+
+--- a/builtins/fc.def
++++ b/builtins/fc.def
+@@ -304,7 +304,7 @@ fc_builtin (list)
+   last_hist = i - rh - hist_last_line_added;
+   /* XXX */
+-  if (saved_command_line_count > 0 && i == last_hist && hlist[last_hist] == 0)
++  if (i == last_hist && hlist[last_hist] == 0)
+     while (last_hist >= 0 && hlist[last_hist] == 0)
+       last_hist--;
+   if (last_hist < 0)
+@@ -475,7 +475,7 @@ fc_gethnum (command, hlist)
+      HIST_ENTRY **hlist;
+ {
+   int sign, n, clen, rh;
+-  register int i, j;
++  register int i, j, last_hist;
+   register char *s;
+   sign = 1;
+@@ -495,7 +495,15 @@ fc_gethnum (command, hlist)
+      has been enabled (interactive or not) should use it in the last_hist
+      calculation as if it were on. */
+   rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
+-  i -= rh + hist_last_line_added;
++  last_hist = i - rh - hist_last_line_added;
++
++  if (i == last_hist && hlist[last_hist] == 0)
++    while (last_hist >= 0 && hlist[last_hist] == 0)
++      last_hist--;
++  if (last_hist < 0)
++    return (-1);
++
++  i = last_hist;
+   /* No specification defaults to most recent command. */
+   if (command == NULL)
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 8
++#define PATCHLEVEL 9
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/110-upstream-bash42-010.patch b/utils/bash/patches/110-upstream-bash42-010.patch
new file mode 100644 (file)
index 0000000..06cdb61
--- /dev/null
@@ -0,0 +1,56 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-010
+
+Bug-Reported-by:       Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID:      <201104122356.20160.vapier@gentoo.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00058.html
+
+Bug-Description:
+
+Bash did not correctly print/reproduce here documents attached to commands
+inside compound commands such as arithmetic for loops and user-specified
+subshells.  This affected the execution of such commands inside a shell
+function when the function definition is saved and later restored using
+`.' or `eval'.
+
+Patch (apply with `patch -p0'):
+
+--- a/print_cmd.c
++++ b/print_cmd.c
+@@ -315,6 +315,7 @@ make_command_string_internal (command)
+         cprintf ("( ");
+         skip_this_indent++;
+         make_command_string_internal (command->value.Subshell->command);
++        PRINT_DEFERRED_HEREDOCS ("");
+         cprintf (" )");
+         break;
+@@ -592,6 +593,7 @@ print_arith_for_command (arith_for_comma
+   newline ("do\n");
+   indentation += indentation_amount;
+   make_command_string_internal (arith_for_command->action);
++  PRINT_DEFERRED_HEREDOCS ("");
+   semicolon ();
+   indentation -= indentation_amount;
+   newline ("done");
+@@ -653,6 +655,7 @@ print_group_command (group_command)
+     }
+   make_command_string_internal (group_command->command);
++  PRINT_DEFERRED_HEREDOCS ("");
+   if (inside_function_def)
+     {
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 9
++#define PATCHLEVEL 10
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/111-upstream-bash42-011.patch b/utils/bash/patches/111-upstream-bash42-011.patch
new file mode 100644 (file)
index 0000000..bb84a8d
--- /dev/null
@@ -0,0 +1,41 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-011
+
+Bug-Reported-by:       "David Parks" <davidparks21@yahoo.com>
+Bug-Reference-ID:      <014101cc82c6$46ac1540$d4043fc0$@com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00031.html
+
+Bug-Description:
+
+Overwriting a value in an associative array causes the memory allocated to
+store the key on the second and subsequent assignments to leak.
+
+Patch (apply with `patch -p0'):
+
+--- a/assoc.c
++++ b/assoc.c
+@@ -77,6 +77,11 @@ assoc_insert (hash, key, value)
+   b = hash_search (key, hash, HASH_CREATE);
+   if (b == 0)
+     return -1;
++  /* If we are overwriting an existing element's value, we're not going to
++     use the key.  Nothing in the array assignment code path frees the key
++     string, so we can free it here to avoid a memory leak. */
++  if (b->key != key)
++    free (key);
+   FREE (b->data);
+   b->data = value ? savestring (value) : (char *)0;
+   return (0);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 10
++#define PATCHLEVEL 11
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/112-upstream-bash42-012.patch b/utils/bash/patches/112-upstream-bash42-012.patch
new file mode 100644 (file)
index 0000000..697ed1a
--- /dev/null
@@ -0,0 +1,145 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-012
+
+Bug-Reported-by:       Rui Santos <rsantos@grupopie.com>
+Bug-Reference-ID:      <4E04C6D0.2020507@grupopie.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-06/msg00079.html
+
+Bug-Description:
+
+When calling the parser to recursively parse a command substitution within
+an arithmetic expansion, the shell overwrote the saved shell input line and
+associated state, resulting in a garbled command.
+
+Patch (apply with `patch -p0'):
+
+--- a/parse.y
++++ b/parse.y
+@@ -3842,6 +3842,7 @@ xparse_dolparen (base, string, indp, fla
+      int flags;
+ {
+   sh_parser_state_t ps;
++  sh_input_line_state_t ls;
+   int orig_ind, nc, sflags;
+   char *ret, *s, *ep, *ostring;
+@@ -3849,10 +3850,12 @@ xparse_dolparen (base, string, indp, fla
+   orig_ind = *indp;
+   ostring = string;
++/*itrace("xparse_dolparen: size = %d shell_input_line = `%s'", shell_input_line_size, shell_input_line);*/
+   sflags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOFREE;
+   if (flags & SX_NOLONGJMP)
+     sflags |= SEVAL_NOLONGJMP;
+   save_parser_state (&ps);
++  save_input_line_state (&ls);
+   /*(*/
+   parser_state |= PST_CMDSUBST|PST_EOFTOKEN;  /* allow instant ')' */ /*(*/
+@@ -3861,6 +3864,8 @@ xparse_dolparen (base, string, indp, fla
+   restore_parser_state (&ps);
+   reset_parser ();
++  /* reset_parser clears shell_input_line and associated variables */
++  restore_input_line_state (&ls);
+   if (interactive)
+     token_to_read = 0;
+@@ -5908,6 +5913,12 @@ save_parser_state (ps)
+   ps->expand_aliases = expand_aliases;
+   ps->echo_input_at_read = echo_input_at_read;
++  ps->token = token;
++  ps->token_buffer_size = token_buffer_size;
++  /* Force reallocation on next call to read_token_word */
++  token = 0;
++  token_buffer_size = 0;
++
+   return (ps);
+ }
+@@ -5949,6 +5960,42 @@ restore_parser_state (ps)
+   expand_aliases = ps->expand_aliases;
+   echo_input_at_read = ps->echo_input_at_read;
++
++  FREE (token);
++  token = ps->token;
++  token_buffer_size = ps->token_buffer_size;
++}
++
++sh_input_line_state_t *
++save_input_line_state (ls)
++     sh_input_line_state_t *ls;
++{
++  if (ls == 0)
++    ls = (sh_input_line_state_t *)xmalloc (sizeof (sh_input_line_state_t));
++  if (ls == 0)
++    return ((sh_input_line_state_t *)NULL);
++
++  ls->input_line = shell_input_line;
++  ls->input_line_size = shell_input_line_size;
++  ls->input_line_len = shell_input_line_len;
++  ls->input_line_index = shell_input_line_index;
++
++  /* force reallocation */
++  shell_input_line = 0;
++  shell_input_line_size = shell_input_line_len = shell_input_line_index = 0;
++}
++
++void
++restore_input_line_state (ls)
++     sh_input_line_state_t *ls;
++{
++  FREE (shell_input_line);
++  shell_input_line = ls->input_line;
++  shell_input_line_size = ls->input_line_size;
++  shell_input_line_len = ls->input_line_len;
++  shell_input_line_index = ls->input_line_index;
++
++  set_line_mbstate ();
+ }
+ /************************************************
+--- a/shell.h
++++ b/shell.h
+@@ -136,6 +136,9 @@ typedef struct _sh_parser_state_t {
+   int parser_state;
+   int *token_state;
++  char *token;
++  int token_buffer_size;
++
+   /* input line state -- line number saved elsewhere */
+   int input_line_terminator;
+   int eof_encountered;
+@@ -166,6 +169,16 @@ typedef struct _sh_parser_state_t {
+   
+ } sh_parser_state_t;
++typedef struct _sh_input_line_state_t {
++  char *input_line;
++  int input_line_index;
++  int input_line_size;
++  int input_line_len;
++} sh_input_line_state_t;
++
+ /* Let's try declaring these here. */
+ extern sh_parser_state_t *save_parser_state __P((sh_parser_state_t *));
+ extern void restore_parser_state __P((sh_parser_state_t *));
++
++extern sh_input_line_state_t *save_input_line_state __P((sh_input_line_state_t *));
++extern void restore_input_line_state __P((sh_input_line_state_t *));
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 11
++#define PATCHLEVEL 12
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/113-upstream-bash42-013.patch b/utils/bash/patches/113-upstream-bash42-013.patch
new file mode 100644 (file)
index 0000000..aee78a2
--- /dev/null
@@ -0,0 +1,43 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-013
+
+Bug-Reported-by:       Marten Wikstrom <marten.wikstrom@keystream.se>
+Bug-Reference-ID:      <BANLkTikKECAh94ZEX68iQvxYuPeEM_xoSQ@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-05/msg00049.html
+
+Bug-Description:
+
+An off-by-one error caused the shell to skip over CTLNUL characters,
+which are used internally to mark quoted null strings.  The effect
+was to have stray 0x7f characters left after expanding words like
+""""""""aa.
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -3706,7 +3706,10 @@ remove_quoted_nulls (string)
+           break;
+       }
+       else if (string[i] == CTLNUL)
+-      i++;
++      {
++        i++;
++        continue;
++      }
+       prev_i = i;
+       ADVANCE_CHAR (string, slen, i);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 12
++#define PATCHLEVEL 13
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/114-upstream-bash42-014.patch b/utils/bash/patches/114-upstream-bash42-014.patch
new file mode 100644 (file)
index 0000000..dfbc990
--- /dev/null
@@ -0,0 +1,38 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-014
+
+Bug-Reported-by:       Shawn Bohrer <sbohrer@rgmadvisors.com>
+Bug-Reference-ID:      <20110504152320.6E8F28130527@dev1.rgmadvisors.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-05/msg00018.html
+
+Bug-Description:
+
+The regular expression matching operator did not correctly match
+expressions with an embedded ^A.
+
+Patch (apply with `patch -p0'):
+
+--- a/pathexp.c
++++ b/pathexp.c
+@@ -196,7 +196,7 @@ quote_string_for_globbing (pathname, qfl
+       {
+         if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
+           continue;
+-        if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
++        if (pathname[i+1] != CTLESC && (qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0)
+           continue;
+         temp[j++] = '\\';
+         i++;
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 13
++#define PATCHLEVEL 14
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/115-upstream-bash42-015.patch b/utils/bash/patches/115-upstream-bash42-015.patch
new file mode 100644 (file)
index 0000000..49c7a82
--- /dev/null
@@ -0,0 +1,71 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-015
+
+Bug-Reported-by:       <dnade.ext@orange-ftgroup.com>
+Bug-Reference-ID:      <728_1312188080_4E3666B0_728_118711_1_3B5D3E0F95CC5C478D6500CDCE8B691F7AAAA4AA3D@PUEXCB2B.nanterre.francetelecom.fr>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00000.html
+
+Bug-Description:
+
+When in a context where arithmetic evaluation is not taking place, the
+evaluator should not check for division by 0.
+
+Patch (apply with `patch -p0'):
+
+--- a/expr.c
++++ b/expr.c
+@@ -476,19 +476,23 @@ expassign ()
+       if (special)
+       {
++        if ((op == DIV || op == MOD) && value == 0)
++          {
++            if (noeval == 0)
++              evalerror (_("division by 0"));
++            else
++              value = 1;
++          }
++
+         switch (op)
+           {
+           case MUL:
+             lvalue *= value;
+             break;
+           case DIV:
+-            if (value == 0)
+-              evalerror (_("division by 0"));
+             lvalue /= value;
+             break;
+           case MOD:
+-            if (value == 0)
+-              evalerror (_("division by 0"));
+             lvalue %= value;
+             break;
+           case PLUS:
+@@ -804,7 +808,12 @@ exp2 ()
+       val2 = exppower ();
+       if (((op == DIV) || (op == MOD)) && (val2 == 0))
+-      evalerror (_("division by 0"));
++      {
++        if (noeval == 0)
++          evalerror (_("division by 0"));
++        else
++          val2 = 1;
++      }
+       if (op == MUL)
+       val1 *= val2;
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 14
++#define PATCHLEVEL 15
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/116-upstream-bash42-016.patch b/utils/bash/patches/116-upstream-bash42-016.patch
new file mode 100644 (file)
index 0000000..0848cfc
--- /dev/null
@@ -0,0 +1,37 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-016
+
+Bug-Reported-by:       Martin von Gagern <Martin.vGagern@gmx.net>
+Bug-Reference-ID:      <4E43AD9E.8060501@gmx.net>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00141.html
+
+Bug-Description:
+
+Bash should not check for mail while executing the `eval' builtin.
+
+Patch (apply with `patch -p0'):
+
+--- a/parse.y
++++ b/parse.y
+@@ -2499,7 +2499,7 @@ yylex ()
+        We do this only if it is time to do so. Notice that only here
+        is the mail alarm reset; nothing takes place in check_mail ()
+        except the checking of mail.  Please don't change this. */
+-      if (prompt_is_ps1 && time_to_check_mail ())
++      if (prompt_is_ps1 && parse_and_execute_level == 0 && time_to_check_mail ())
+       {
+         check_mail ();
+         reset_mail_timer ();
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 15
++#define PATCHLEVEL 16
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/117-upstream-bash42-017.patch b/utils/bash/patches/117-upstream-bash42-017.patch
new file mode 100644 (file)
index 0000000..90f71c6
--- /dev/null
@@ -0,0 +1,42 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-017
+
+Bug-Reported-by:       Curtis Doty <Curtis@GreenKey.net>
+Bug-Reference-ID:      <20110621035324.A4F70849F59@mx1.iParadigms.net>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-06/msg00053.html
+
+Bug-Description:
+
+Using `read -a foo' where foo was an already-declared associative array
+caused the shell to die with a segmentation fault.
+
+Patch (apply with `patch -p0'):
+
+--- a/builtins/read.def
++++ b/builtins/read.def
+@@ -642,6 +642,12 @@ assign_vars:
+         xfree (input_string);
+         return EXECUTION_FAILURE;     /* readonly or noassign */
+       }
++      if (assoc_p (var))
++      {
++          builtin_error (_("%s: cannot convert associative to indexed array"), arrayname);
++        xfree (input_string);
++        return EXECUTION_FAILURE;     /* existing associative array */
++      }
+       array_flush (array_cell (var));
+       alist = list_string (input_string, ifs_chars, 0);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 16
++#define PATCHLEVEL 17
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/118-upstream-bash42-018.patch b/utils/bash/patches/118-upstream-bash42-018.patch
new file mode 100644 (file)
index 0000000..82654c8
--- /dev/null
@@ -0,0 +1,57 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-018
+
+Bug-Reported-by:       Thomas Cort <tcort@minix3.org>
+Bug-Reference-ID:      <BANLkTik-ebGGw3k_1YtB=RyfV1bsqdxC_g@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-06/msg00110.html
+
+Bug-Description:
+
+Bash fails to compile unless JOB_CONTROL is defined.
+
+Patch (apply with `patch -p0'):
+
+--- a/execute_cmd.c
++++ b/execute_cmd.c
+@@ -2196,6 +2196,7 @@ execute_pipeline (command, asynchronous,
+   if (ignore_return && cmd)
+     cmd->flags |= CMD_IGNORE_RETURN;
++#if defined (JOB_CONTROL)
+   lastpipe_flag = 0;
+   begin_unwind_frame ("lastpipe-exec");
+   lstdin = -1;
+@@ -2219,15 +2220,19 @@ execute_pipeline (command, asynchronous,
+         lastpipe_jid = stop_pipeline (0, (COMMAND *)NULL);    /* XXX */
+         add_unwind_protect (lastpipe_cleanup, lastpipe_jid);
+       }
+-      cmd->flags |= CMD_LASTPIPE;
++      if (cmd)
++      cmd->flags |= CMD_LASTPIPE;
+     }   
+   if (prev >= 0)
+     add_unwind_protect (close, prev);
++#endif
+   exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close);
++#if defined (JOB_CONTROL)
+   if (lstdin > 0)
+     restore_stdin (lstdin);
++#endif
+   if (prev >= 0)
+     close (prev);
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 17
++#define PATCHLEVEL 18
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/119-upstream-bash42-019.patch b/utils/bash/patches/119-upstream-bash42-019.patch
new file mode 100644 (file)
index 0000000..215ae67
--- /dev/null
@@ -0,0 +1,42 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-019
+
+Bug-Reported-by:       Diego Augusto Molina <diegoaugustomolina@gmail.com>
+Bug-Reference-ID:      <CAGOxLdHcSQu3ck9Qy3pRjj_NBU5tAPSAvNm-95-nLQ9Szwb6aA@mail.gmail.com>
+Bug-Reference-URL:     lists.gnu.org/archive/html/bug-bash/2011-09/msg00047.html
+
+Bug-Description:
+
+Using `declare' with attributes and an invalid array variable name or
+assignment reference resulted in a segmentation fault instead of a
+declaration error.
+
+Patch (apply with `patch -p0'):
+
+--- a/builtins/declare.def
++++ b/builtins/declare.def
+@@ -513,6 +513,11 @@ declare_internal (list, local_var)
+             *subscript_start = '[';   /* ] */
+             var = assign_array_element (name, value, 0);      /* XXX - not aflags */
+             *subscript_start = '\0';
++            if (var == 0)     /* some kind of assignment error */
++              {
++                assign_error++;
++                NEXT_VARIABLE ();
++              }
+           }
+         else if (simple_array_assign)
+           {
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 18
++#define PATCHLEVEL 19
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/120-upstream-bash42-020.patch b/utils/bash/patches/120-upstream-bash42-020.patch
new file mode 100644 (file)
index 0000000..a91c950
--- /dev/null
@@ -0,0 +1,47 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-020
+
+Bug-Reported-by:       Vincent Sheffer <vince.sheffer@apisphere.com>
+Bug-Reference-ID:      <F13C1C4F-C44C-4071-BFED-4BB6D13CF92F@apisphere.com>
+Bug-Reference-URL:     https://lists.gnu.org/archive/html/bug-readline/2011-08/msg00000.html
+
+Bug-Description:
+
+The shared object helper script needs to be updated for Mac OS X 10.7
+(Lion, darwin11).
+
+Patch (apply with `patch -p0'):
+
+--- a/support/shobj-conf
++++ b/support/shobj-conf
+@@ -157,7 +157,7 @@ freebsd[4-9]*|freebsdelf*|dragonfly*)
+       ;;
+ # Darwin/MacOS X
+-darwin[89]*|darwin10*)
++darwin[89]*|darwin1[012]*)
+       SHOBJ_STATUS=supported
+       SHLIB_STATUS=supported
+       
+@@ -186,7 +186,7 @@ darwin*|macosx*)
+       SHLIB_LIBSUFF='dylib'
+       case "${host_os}" in
+-      darwin[789]*|darwin10*) SHOBJ_LDFLAGS=''
++      darwin[789]*|darwin1[012]*)     SHOBJ_LDFLAGS=''
+                       SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+                       ;;
+       *)              SHOBJ_LDFLAGS='-dynamic'
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 19
++#define PATCHLEVEL 20
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/121-upstream-bash42-021.patch b/utils/bash/patches/121-upstream-bash42-021.patch
new file mode 100644 (file)
index 0000000..38c3ae4
--- /dev/null
@@ -0,0 +1,48 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-021
+
+Bug-Reported-by:       Dan Douglas <ormaaj@gmail.com>
+Bug-Reference-ID:      <4585554.nZWb4q7YoZ@smorgbox>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-12/msg00084.html
+
+Bug-Description:
+
+Using `read -N' to assign values to an array can result in NUL values being
+assigned to some array elements.  These values cause seg faults when referenced
+later.
+
+Patch (apply with `patch -p0'):
+
+--- a/builtins/read.def
++++ b/builtins/read.def
+@@ -737,7 +737,7 @@ assign_vars:
+             xfree (t1);
+           }
+         else
+-          var = bind_read_variable (varname, t);
++          var = bind_read_variable (varname, t ? t : "");
+       }
+       else
+       {
+@@ -798,7 +798,7 @@ assign_vars:
+       xfree (t);
+     }
+   else
+-    var = bind_read_variable (list->word->word, input_string);
++    var = bind_read_variable (list->word->word, input_string ? input_string : "");
+   if (var)
+     {
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 20
++#define PATCHLEVEL 21
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/122-upstream-bash42-022.patch b/utils/bash/patches/122-upstream-bash42-022.patch
new file mode 100644 (file)
index 0000000..30020ba
--- /dev/null
@@ -0,0 +1,46 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-022
+
+Bug-Reported-by:       Gregory Margo <gmargo@pacbell.net>
+Bug-Reference-ID:      <20110727174529.GA3333@pacbell.net>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2011-07/msg00102.html
+
+Bug-Description:
+
+The return value from lseek is `off_t'.  This can cause corrupted return
+values when the file offset is greater than 2**31 - 1.
+
+Patch (apply with `patch -p0'):
+
+--- a/lib/sh/zread.c
++++ b/lib/sh/zread.c
+@@ -160,14 +160,13 @@ void
+ zsyncfd (fd)
+      int fd;
+ {
+-  off_t off;
+-  int r;
++  off_t off, r;
+   off = lused - lind;
+   r = 0;
+   if (off > 0)
+     r = lseek (fd, -off, SEEK_CUR);
+-  if (r >= 0)
++  if (r != -1)
+     lused = lind = 0;
+ }
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 21
++#define PATCHLEVEL 22
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/123-upstream-bash42-023.patch b/utils/bash/patches/123-upstream-bash42-023.patch
new file mode 100644 (file)
index 0000000..6c6fdb3
--- /dev/null
@@ -0,0 +1,53 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-023
+
+Bug-Reported-by:       Ewan Mellor <Ewan.Mellor@eu.citrix.com>
+Bug-Reference-ID:      <6005BE083BF501439A84DC3523BAC82DC4B964FD12@LONPMAILBOX01.citrite.net>
+Bug-Reference-URL:     
+
+Bug-Description:
+
+Under some circumstances, an exit trap triggered by a bad substitution
+error when errexit is enabled will cause the shell to exit with an
+incorrect exit status (0).
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -7274,6 +7274,7 @@ parameter_brace_expand (string, indexp, 
+     default:
+     case '\0':
+     bad_substitution:
++      last_command_exit_value = EXECUTION_FAILURE;
+       report_error (_("%s: bad substitution"), string ? string : "??");
+       FREE (value);
+       FREE (temp);
+--- a/error.c
++++ b/error.c
+@@ -200,7 +200,11 @@ report_error (format, va_alist)
+   va_end (args);
+   if (exit_immediately_on_error)
+-    exit_shell (1);
++    {
++      if (last_command_exit_value == 0)
++      last_command_exit_value = 1;
++      exit_shell (last_command_exit_value);
++    }
+ }
+ void
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 22
++#define PATCHLEVEL 23
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/124-upstream-bash42-024.patch b/utils/bash/patches/124-upstream-bash42-024.patch
new file mode 100644 (file)
index 0000000..2137c02
--- /dev/null
@@ -0,0 +1,40 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-024
+
+Bug-Reported-by:       Jim Avera <james_avera@yahoo.com>
+Bug-Reference-ID:      <4F29E07A.80405@yahoo.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2012-02/msg00001.html
+
+Bug-Description:
+
+When `printf -v' is used to set an array element, the format string contains
+`%b', and the corresponding argument is the empty string, the buffer used
+to store the value to be assigned can be NULL, which results in NUL being
+assigned to the array element.  This causes a seg fault when it's used later.
+
+Patch (apply with `patch -p0'):
+
+--- a/builtins/printf.def
++++ b/builtins/printf.def
+@@ -255,6 +255,8 @@ printf_builtin (list)
+ #endif
+           {
+             vflag = 1;
++            if (vbsize == 0)
++              vbuf = xmalloc (vbsize = 16);
+             vblen = 0;
+             if (vbuf)
+               vbuf[0] = 0;
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 23
++#define PATCHLEVEL 24
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/125-upstream-bash42-025.patch b/utils/bash/patches/125-upstream-bash42-025.patch
new file mode 100644 (file)
index 0000000..3983ff5
--- /dev/null
@@ -0,0 +1,111 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-025
+
+Bug-Reported-by:       Bill Gradwohl <bill@ycc.com>
+Bug-Reference-ID:      <CAFyvKis-UfuOWr5THBRKh=vYHDoKEEgdW8hN1RviTuYQ00Lu5A@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/help-bash/2012-03/msg00078.html
+
+Bug-Description:
+
+When used in a shell function, `declare -g -a array=(compound assignment)'
+creates a local variable instead of a global one.
+
+Patch (apply with `patch -p0'):
+
+--- a/command.h
++++ b/command.h
+@@ -97,6 +97,7 @@ enum command_type { cm_for, cm_case, cm_
+ #define W_HASCTLESC   0x200000        /* word contains literal CTLESC characters */
+ #define W_ASSIGNASSOC 0x400000        /* word looks like associative array assignment */
+ #define W_ARRAYIND    0x800000        /* word is an array index being expanded */
++#define W_ASSNGLOBAL  0x1000000       /* word is a global assignment to declare (declare/typeset -g) */
+ /* Possible values for subshell_environment */
+ #define SUBSHELL_ASYNC        0x01    /* subshell caused by `command &' */
+--- a/execute_cmd.c
++++ b/execute_cmd.c
+@@ -3584,13 +3584,13 @@ fix_assignment_words (words)
+ {
+   WORD_LIST *w;
+   struct builtin *b;
+-  int assoc;
++  int assoc, global;
+   if (words == 0)
+     return;
+   b = 0;
+-  assoc = 0;
++  assoc = global = 0;
+   for (w = words; w; w = w->next)
+     if (w->word->flags & W_ASSIGNMENT)
+@@ -3607,12 +3607,17 @@ fix_assignment_words (words)
+ #if defined (ARRAY_VARS)
+       if (assoc)
+         w->word->flags |= W_ASSIGNASSOC;
++      if (global)
++        w->word->flags |= W_ASSNGLOBAL;
+ #endif
+       }
+ #if defined (ARRAY_VARS)
+     /* Note that we saw an associative array option to a builtin that takes
+        assignment statements.  This is a bit of a kludge. */
+-    else if (w->word->word[0] == '-' && strchr (w->word->word, 'A'))
++    else if (w->word->word[0] == '-' && (strchr (w->word->word+1, 'A') || strchr (w->word->word+1, 'g')))
++#else
++    else if (w->word->word[0] == '-' && strchr (w->word->word+1, 'g'))
++#endif
+       {
+       if (b == 0)
+         {
+@@ -3622,10 +3627,11 @@ fix_assignment_words (words)
+           else if (b && (b->flags & ASSIGNMENT_BUILTIN))
+             words->word->flags |= W_ASSNBLTIN;
+         }
+-      if (words->word->flags & W_ASSNBLTIN)
++      if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'A'))
+         assoc = 1;
++      if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'g'))
++        global = 1;
+       }
+-#endif
+ }
+ /* Return 1 if the file found by searching $PATH for PATHNAME, defaulting
+--- a/subst.c
++++ b/subst.c
+@@ -366,6 +366,11 @@ dump_word_flags (flags)
+       f &= ~W_ASSNBLTIN;
+       fprintf (stderr, "W_ASSNBLTIN%s", f ? "|" : "");
+     }
++  if (f & W_ASSNGLOBAL)
++    {
++      f &= ~W_ASSNGLOBAL;
++      fprintf (stderr, "W_ASSNGLOBAL%s", f ? "|" : "");
++    }
+   if (f & W_COMPASSIGN)
+     {
+       f &= ~W_COMPASSIGN;
+@@ -2803,7 +2808,7 @@ do_assignment_internal (word, expand)
+     }
+   else if (assign_list)
+     {
+-      if (word->flags & W_ASSIGNARG)
++      if ((word->flags & W_ASSIGNARG) && (word->flags & W_ASSNGLOBAL) == 0)
+       aflags |= ASS_MKLOCAL;
+       if (word->flags & W_ASSIGNASSOC)
+       aflags |= ASS_MKASSOC;
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 24
++#define PATCHLEVEL 25
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/126-upstream-bash42-026.patch b/utils/bash/patches/126-upstream-bash42-026.patch
new file mode 100644 (file)
index 0000000..b0efc0c
--- /dev/null
@@ -0,0 +1,48 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-026
+
+Bug-Reported-by:       Greg Wooledge <wooledg@eeg.ccf.org>
+Bug-Reference-ID:      <20120425180443.GO22241@eeg.ccf.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2012-04/msg00172.html
+
+Bug-Description:
+
+The `lastpipe' option does not behave correctly on machines where the
+open file limit is less than 256.
+
+Patch (apply with `patch -p0'):
+
+--- a/execute_cmd.c
++++ b/execute_cmd.c
+@@ -2209,7 +2209,7 @@ execute_pipeline (command, asynchronous,
+ #endif
+                asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
+     {
+-      lstdin = move_to_high_fd (0, 0, 255);
++      lstdin = move_to_high_fd (0, 1, -1);
+       if (lstdin > 0)
+       {
+         do_piping (prev, pipe_out);
+@@ -2255,7 +2255,9 @@ execute_pipeline (command, asynchronous,
+       unfreeze_jobs_list ();
+     }
++#if defined (JOB_CONTROL)
+   discard_unwind_frame ("lastpipe-exec");
++#endif
+   return (exec_result);
+ }
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 25
++#define PATCHLEVEL 26
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/127-upstream-bash42-027.patch b/utils/bash/patches/127-upstream-bash42-027.patch
new file mode 100644 (file)
index 0000000..525abe0
--- /dev/null
@@ -0,0 +1,38 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-027
+
+Bug-Reported-by:       Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID:      <201204211243.30163.vapier@gentoo.org>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2012-04/msg00134.html
+
+Bug-Description:
+
+When the `extglob' shell option is enabled, pattern substitution does not
+work correctly in the presence of multibyte characters.
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -4166,7 +4166,7 @@ match_wpattern (wstring, indices, wstrle
+   simple = (wpat[0] != L'\\' && wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'[');
+ #if defined (EXTENDED_GLOB)
+   if (extended_glob)
+-    simple |= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
++    simple &= (wpat[1] != L'(' || (wpat[0] != L'*' && wpat[0] != L'?' && wpat[0] != L'+' && wpat[0] != L'!' && wpat[0] != L'@')); /*)*/
+ #endif
+   /* If the pattern doesn't match anywhere in the string, go ahead and
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 26
++#define PATCHLEVEL 27
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/128-upstream-bash42-028.patch b/utils/bash/patches/128-upstream-bash42-028.patch
new file mode 100644 (file)
index 0000000..8b5b1b2
--- /dev/null
@@ -0,0 +1,46 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release:  4.2
+Patch-ID:      bash42-028
+
+Bug-Reported-by:       Mark Edgar <medgar123@gmail.com>
+Bug-Reference-ID:      <CABHMh_3d+ZgO_zaEtYXPwK4P7tC0ghZ4g=Ue_TRpsEMf5YDsqw@mail.gmail.com>
+Bug-Reference-URL:     http://lists.gnu.org/archive/html/bug-bash/2012-03/msg00109.html
+
+Bug-Description:
+
+When using a word expansion for which the right hand side is evaluated,
+certain expansions of quoted null strings include spurious ^? characters.
+
+Patch (apply with `patch -p0'):
+
+--- a/subst.c
++++ b/subst.c
+@@ -5809,6 +5809,16 @@ parameter_brace_expand_rhs (name, value,
+        is the only expansion that creates more than one word. */
+       if (qdollaratp && ((hasdol && quoted) || l->next))
+       *qdollaratp = 1;
++      /* If we have a quoted null result (QUOTED_NULL(temp)) and the word is
++       a quoted null (l->next == 0 && QUOTED_NULL(l->word->word)), the
++       flags indicate it (l->word->flags & W_HASQUOTEDNULL), and the
++       expansion is quoted (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
++       (which is more paranoia than anything else), we need to return the
++       quoted null string and set the flags to indicate it. */
++      if (l->next == 0 && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && QUOTED_NULL(temp) && QUOTED_NULL(l->word->word) && (l->word->flags & W_HASQUOTEDNULL))
++      {
++        w->flags |= W_HASQUOTEDNULL;
++      }
+       dispose_words (l);
+     }
+   else if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && hasdol)
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -25,6 +25,6 @@
+    regexp `^#define[  ]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+-#define PATCHLEVEL 27
++#define PATCHLEVEL 28
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/utils/bash/patches/129-no_doc.patch b/utils/bash/patches/129-no_doc.patch
new file mode 100644 (file)
index 0000000..442cd22
--- /dev/null
@@ -0,0 +1,14 @@
+diff -urN bash-4.2/Makefile.in bash-4.2.new/Makefile.in
+--- bash-4.2/Makefile.in       2010-12-01 01:22:42.000000000 +0100
++++ bash-4.2.new/Makefile.in   2012-07-30 16:24:01.325057998 +0200
+@@ -724,10 +724,8 @@
+ #     $(MAKE) -f $(srcdir)/Makefile $(MFLAGS) srcdir=$(srcdir)
+ doc documentation:  force
+-      @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) )
+ info dvi ps: force
+-      @(cd $(DOCDIR) ; $(MAKE) $(MFLAGS) CFLAGS='$(CCFLAGS)' $@ )
+ force:
diff --git a/utils/bc/Makefile b/utils/bc/Makefile
new file mode 100644 (file)
index 0000000..7293a76
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2006-2010 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:=bc
+PKG_VERSION:=1.06.95
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=ftp://ftp.debian.org/debian/pool/main/b/bc
+PKG_MD5SUM:=24d0831812d8262b6cac8316b0bac483
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bc/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://packages.debian.org/bc
+endef
+
+define Package/bc
+  $(call Package/bc/Default)
+  TITLE:=Arbitrary precision calculator language
+  DEPENDS:=+libreadline +libncurses
+endef
+
+define Package/bc/description
+ bc is a language that supports arbitrary precision numbers with
+ interactive execution of statements.
+endef
+
+define Package/dc
+  $(call Package/bc/Default)
+  TITLE:=Arbitrary precision reverse-polish calculator
+  DEPENDS:=bc
+endef
+
+define Package/dc/description
+ dc is a reverse-polish desk calculator which supports unlimited
+ precision arithmetic.
+endef
+
+CONFIGURE_ARGS += --with-readline
+
+define Package/bc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bc/bc $(1)/usr/bin/
+endef
+
+define Package/dc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dc/dc $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bc))
+$(eval $(call BuildPackage,dc))
diff --git a/utils/bc/patches/001-disable-doc.patch b/utils/bc/patches/001-disable-doc.patch
new file mode 100644 (file)
index 0000000..a6ecd6e
--- /dev/null
@@ -0,0 +1,21 @@
+--- bc-1.06.95/Makefile.in     2010-07-03 10:48:13.422725147 +0000
++++ bc-1.06.95/Makefile.in     2010-07-03 10:50:09.714725197 +0000
+@@ -149,7 +149,7 @@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+-SUBDIRS = lib bc dc doc
++SUBDIRS = lib bc dc
+ MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \
+                       stamp-h $(distdir).tar.gz h/number.h depcomp missing
+--- bc-1.06.95/Makefile.am     2010-07-03 10:48:32.522725037 +0000
++++ bc-1.06.95/Makefile.am     2010-07-03 10:48:38.114725024 +0000
+@@ -1,6 +1,6 @@
+ ## Process this file with automake to produce Makefile.in
+-SUBDIRS = lib bc dc doc
++SUBDIRS = lib bc dc
+ MAINTAINERCLEANFILES =  aclocal.m4 config.h.in configure Makefile.in \
+                       stamp-h $(distdir).tar.gz h/number.h depcomp missing
diff --git a/utils/bemused/Makefile b/utils/bemused/Makefile
new file mode 100644 (file)
index 0000000..c30c7c3
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2008-2014 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:=bemused-mpd
+PKG_VERSION:=r062
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.origo.ethz.ch/bemused-lnx-mpdhack/526
+PKG_MD5SUM:=aed8b41aed530e9177e43d9bebad10b7
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/bemusedlinuxserver
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+bluez-libs +glib1 +mpd +libstdcpp $(ICONV_DEPENDS)
+  TITLE:=Bemused linux server
+  URL:=http://bemused-lnx-mpdhack.origo.ethz.ch/
+endef
+
+define Package/bemusedlinuxserver/description
+    Bemused is a system which allows you to control your music collection
+    from your phone, using Bluetooth.
+    This is the MPD hack version.
+    Check http://jamse.sourceforge.net/ for a mobile phone client.
+endef
+
+EXTRA_CPPFLAGS:= \
+       -I$(STAGING_DIR)/usr/include/glib-1.2 \
+       -I$(STAGING_DIR)/usr/lib/glib/include
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+               CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
+               LDLIBS="-lbluetooth -lglib -liconv"
+endef
+
+define Package/bemusedlinuxserver/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bemusedlinuxserver $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/bemused.conf $(1)/etc/bemused.conf
+       $(INSTALL_CONF) ./files/bemused-bookmarks $(1)/etc/bemused-bookmarks
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bemused.init $(1)/etc/init.d/bemused
+endef
+
+define Package/bemusedlinuxserver/conffiles
+/etc/bemused.conf
+/etc/bemused-bookmarks
+endef
+
+$(eval $(call BuildPackage,bemusedlinuxserver))
diff --git a/utils/bemused/files/bemused-bookmarks b/utils/bemused/files/bemused-bookmarks
new file mode 100644 (file)
index 0000000..5f132b5
--- /dev/null
@@ -0,0 +1,8 @@
+# Bemused stream file
+# This is quite a simple format file
+# Stream Title = URL
+#
+# IMPORTANT: stream name MUST contain the ".mp3" extension, else jamse will not display the file!
+
+UnitedBreaks.mp3 = http://74.52.13.138:8000
+nubreaks.mp3 = http://208.100.38.52:8419
diff --git a/utils/bemused/files/bemused.conf b/utils/bemused/files/bemused.conf
new file mode 100644 (file)
index 0000000..95acd46
--- /dev/null
@@ -0,0 +1,43 @@
+# bemused config file Version 1.73 (no changes since 1.71)
+# lines with a # at the beinning are for comments and not readen by the bemusedserver
+# You only need to set up options which have no default and which ware not optinal
+
+# this is a mpd-hack version by michu@neophob.com
+
+# Path to mpd (if mpd is in path only mpd) (default is mpd)
+mpddir=/usr/local/bin/mpd
+
+# channel for what the serial port service is registered (with sdptool look in README) (default 10)
+# example:
+# root@OpenWrt:~# sdptool browse
+# Inquiring ...
+# <...>
+# Service Name: COM 1
+# Service RecHandle: 0x10005
+# Service Class ID List:
+#   "Serial Port" (0x1101)
+# Protocol Descriptor List:
+#   "L2CAP" (0x0100)
+#   "RFCOMM" (0x0003)
+#     Channel: 3               <<<
+# Language Base Attr List:
+#   code_ISO639: 0x656e
+#   encoding:    0x6a
+#   base_offset: 0x100
+channel=3
+
+# directorys where the mp3s are. If more than one seperate them by a m semicolon (must be set)
+# point this directory to the mpd music directory!
+mp3dir=/
+
+# bookmarks file for URLs of net radio stations (optional)
+bookmarkfile=/etc/bemused-bookmarks
+
+# speed setting for fast forward and rewind. time for every jump in milliseconds 10000 is default
+#fastforbackspeed=10000
+
+# set to 1 to use connection over TCP/IP (for bluetooth pan or maybe LAN oder internet) set to 0 for normal rfcomm bluetooth (default)
+#tcp=1
+
+# port to use if you set tcp to 1 for your incomming TCP/IP Connection. (default is 7654 and at the moment the only one useable by the client on the phone)
+#tcpport=7654
diff --git a/utils/bemused/files/bemused.init b/utils/bemused/files/bemused.init
new file mode 100644 (file)
index 0000000..a4ab2c7
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=95
+
+start() {
+       service_start /usr/sbin/bemusedlinuxserver -d
+}
+
+stop() {
+       service_stop /usr/sbin/bemusedlinuxserver
+}
diff --git a/utils/bemused/patches/110-missing_includes.patch b/utils/bemused/patches/110-missing_includes.patch
new file mode 100644 (file)
index 0000000..7f14a42
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/main.cpp
++++ b/main.cpp
+@@ -16,6 +16,9 @@
+  ***************************************************************************/
+ #include <stdlib.h>
++#include <stdio.h>
++#include <getopt.h>
++#include <unistd.h>
+ #include <iostream>
+ #include "BemusedServerDlg.h"
+--- a/BemusedServerDlg.cpp
++++ b/BemusedServerDlg.cpp
+@@ -28,6 +28,7 @@
+ #include <cerrno>
+ #include <csignal>
++#include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <dirent.h>
diff --git a/utils/bemused/patches/200-cxx-compile-fixes.patch b/utils/bemused/patches/200-cxx-compile-fixes.patch
new file mode 100644 (file)
index 0000000..607b623
--- /dev/null
@@ -0,0 +1,65 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,8 +1,15 @@
+-SHELL = /bin/sh
++LDLIBS = -lbluetooth -lglib -liconv
++CPPFLAGS = -I/usr/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I./
++CFLAGS = -Os
++CXXFLAGS = -Os
+-#optimized for openwrt use! mylibs should be -lbluetooth, liconv and -lglib
+-MYLIBS = -lbluetooth -lglib -liconv
+-INCL = -I/usr/include -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I./
++%.o: %.c
++      $(CC) -c $(CFLAGS) $(CPPFLAGS) $^ -o $@
+-bemusedlinuxserver:   main.cpp BemusedServerDlg.cpp mpdctrl.c
+-                      $(CXX) -Os -o bemusedlinuxserver $(INCL) $(LDFLAGS) $(MYLIBS) main.cpp BemusedServerDlg.cpp mpdctrl.c libmpdclient.c
++%.o: %.cpp
++      $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $^ -o $@
++
++bemusedlinuxserver: main.o BemusedServerDlg.o mpdctrl.o libmpdclient.o
++      $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
++
++all: bemusedlinuxserver
+--- a/libmpdclient.h
++++ b/libmpdclient.h
+@@ -68,11 +68,10 @@
+ #define MPD_ACK_ERROR_EXIST                   56
+ #include <stdlib.h>
+-#include <iostream>
+-//#ifdef __cplusplus
+-//extern "C" {
+-//#endif
++#ifdef __cplusplus
++extern "C" {
++#endif
+ typedef enum mpd_TagItems {
+     MPD_TAG_ITEM_ARTIST,
+@@ -654,8 +653,8 @@ void mpd_sendPlaylistAddCommand(mpd_Conn
+ 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
++#ifdef __cplusplus
++}
++#endif
+ #endif
+--- a/mpdctrl.c
++++ b/mpdctrl.c
+@@ -59,6 +59,9 @@
+ #define ERROR_DISPLAY 5
++#define false 0
++#define true  (!false)
++
+ static int l_totalTimeSec;
+ static int l_elapsedTimeSec;
+ static int l_bitRate;
diff --git a/utils/bluelog/Makefile b/utils/bluelog/Makefile
new file mode 100644 (file)
index 0000000..e40290d
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# Copyright (C) 2012-2013 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:=bluelog
+PKG_VERSION:=1.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.digifail.com/software/bluelog
+PKG_MD5SUM:=a5327d64731cd45debb57ab1edbe6e43
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bluelog/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Bluetooth scanner and logger
+  URL:=http://www.digifail.com/software/bluelog.shtml
+  DEPENDS:=+bluez-utils +kmod-bluetooth
+endef
+
+define Package/bluelog/Default/description
+  Bluelog is a simple Bluetooth scanner designed to tell you how many
+  discoverable devices there are in an area as quickly as possible. It is
+  intended to be used as a site survey tool, identifying the number of possible
+  Bluetooth targets there are in the surrounding environment.
+endef
+
+define Package/bluelog
+  $(call Package/bluelog/Default)
+endef
+
+define Package/bluelog/description
+  $(call Package/bluelog/Default/description)
+endef
+
+define Package/bluelog-live
+  $(call Package/bluelog/Default)
+  TITLE+= (live output)
+  DEPENDS+= bluelog
+endef
+
+define Package/bluelog-live/description
+  $(call Package/bluelog/Default/description)
+  This package contains the files for "Bluelog Live", an optional mode of
+  Bluelog which creates a real-time webpage of discovered Bluetooth devices.
+endef
+
+TARGET_CFLAGS += -DOPENWRT
+
+MAKE_FLAGS += \
+        LIBS="$(TARGET_LDFLAGS) -lbluetooth -lm"
+
+define Package/bluelog/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/bluelog $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bluelog.init $(1)/etc/init.d/bluelog
+endef
+
+define Package/bluelog-live/install
+       $(INSTALL_DIR) $(1)/www/bluelog
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/bluelog/*.html $(1)/www/bluelog/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/bluelog/openwrt.css \
+               $(1)/www/bluelog/style.css
+       $(INSTALL_DIR) $(1)/www/bluelog/images
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/bluelog/images/digifail_logo.png \
+               $(PKG_INSTALL_DIR)/usr/share/bluelog/images/email.png \
+               $(PKG_INSTALL_DIR)/usr/share/bluelog/images/favicon.png \
+               $(PKG_INSTALL_DIR)/usr/share/bluelog/images/openwrt_logo.png \
+               $(PKG_INSTALL_DIR)/usr/share/bluelog/images/qrcontact.png \
+               $(1)/www/bluelog/images/
+       $(INSTALL_DIR) $(1)/www/cgi-bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/bluelog/cgi-bin/* $(1)/www/cgi-bin/
+endef
+
+$(eval $(call BuildPackage,bluelog))
+$(eval $(call BuildPackage,bluelog-live))
diff --git a/utils/bluelog/files/bluelog.init b/utils/bluelog/files/bluelog.init
new file mode 100644 (file)
index 0000000..efae288
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+
+SERVICE_DAEMONIZE=1
+
+start() {
+       service_start /usr/bin/bluelog
+}
+
+stop() {
+       service_stop /usr/bin/bluelog
+}
diff --git a/utils/bluez-hcidump/Makefile b/utils/bluez-hcidump/Makefile
new file mode 100644 (file)
index 0000000..0385553
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2006-2010 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:=bluez-hcidump
+PKG_VERSION:=1.42
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://bluez.sourceforge.net/download
+PKG_MD5SUM:=5704737aaf72104eeaf77335218a1827
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bluez-hcidump
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+bluez-libs
+  TITLE:=Bluetooth packet analyzer
+  URL:=http://www.bluez.org/
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --with-bluez="$(STAGING_DIR)/usr/include" \
+       )
+endef
+
+define Package/bluez-hcidump/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hcidump $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,bluez-hcidump))
diff --git a/utils/bluez-utils/Makefile b/utils/bluez-utils/Makefile
new file mode 100644 (file)
index 0000000..4f3f787
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2012 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:=bluez-utils
+PKG_VERSION:=3.36
+PKG_RELEASE:=12
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://bluez.sourceforge.net/download
+PKG_MD5SUM:=4fc292b635ba7b442c7aaf5680199012
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/bluez-utils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+bluez-libs +libpthread +dbus $(INTL_DEPENDS) $(ICONV_DEPENDS)
+  TITLE:=Bluetooth utilities
+  URL:=http://www.bluez.org/
+endef
+
+define Package/bluez-utils/conffiles
+/etc/bluetooth/hcid.conf
+/etc/bluetooth/rfcomm.conf
+/etc/config/bluetooth
+endef
+
+CONFIGURE_ARGS += \
+       --disable-glib \
+       --enable-pand \
+       --enable-rfcomm \
+       --enable-dund \
+       --enable-serial \
+       --enable-network \
+       --enable-usb \
+       --enable-input \
+       --disable-audio \
+       --with-bluez="$(STAGING_DIR)/usr/include" \
+       --with-usb=yes \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               LDFLAGS="$(TARGET_LDFLAGS) \
+                       -L$(ICONV_PREFIX)/lib \
+                       -L$(INTL_PREFIX)/lib -lm" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/bluez-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/bluetooth
+       $(CP) $(PKG_INSTALL_DIR)/etc/bluetooth/hcid.conf $(1)/etc/bluetooth/
+       $(CP) $(PKG_INSTALL_DIR)/etc/bluetooth/rfcomm.conf $(1)/etc/bluetooth/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/bluetooth.config $(1)/etc/config/bluetooth
+       $(INSTALL_DIR) $(1)/etc/dbus-1/system.d/
+       $(INSTALL_DATA) ./files/bluetooth.dbus $(1)/etc/dbus-1/system.d/bluetooth.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bluez-utils.init $(1)/etc/init.d/bluez-utils
+endef
+
+$(eval $(call BuildPackage,bluez-utils))
diff --git a/utils/bluez-utils/files/bluetooth.config b/utils/bluez-utils/files/bluetooth.config
new file mode 100644 (file)
index 0000000..42f390c
--- /dev/null
@@ -0,0 +1,32 @@
+config hcid
+#      option config   /etc/bluetooth/hcid.conf
+       option enabled  1
+
+config hciattach
+       option initspeed        115200
+       option tty      ttyS1
+       option type     csr
+       option speed    115200
+       option flow     noflow
+       option enabled  0
+
+config rfcomm
+#      option config   /etc/bluetooth/rfcomm.conf
+       option enabled  0
+
+config dund
+       option listen   true
+       option persist  true
+       option msdun    true
+       option interface dund
+       option unit     1
+       option pppdopts "ktune proxyarp 192.168.1.1:192.168.1.2 ms-dns 192.168.1.1"
+       option enabled  0
+
+config pand
+       option listen   true
+       option autozap  true
+       option role     "NAP"
+       option master   true
+       option persist  true
+       option enabled  0
diff --git a/utils/bluez-utils/files/bluetooth.dbus b/utils/bluez-utils/files/bluetooth.dbus
new file mode 100644 (file)
index 0000000..88545fa
--- /dev/null
@@ -0,0 +1,37 @@
+<!-- This configuration file specifies the required security policies
+     for Bluetooth core daemon to work. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="org.bluez"/>
+  </policy>
+
+  <policy at_console="true">
+    <allow send_path="/"/>
+    <allow send_path="/org/bluez"/>
+
+    <allow send_destination="org.bluez.Manager"/>
+    <allow receive_sender="org.bluez.Manager"/>
+
+    <allow send_destination="org.bluez.Adapter"/>
+    <allow receive_sender="org.bluez.Adapter"/>
+
+    <allow send_destination="org.bluez.Device"/>
+    <allow receive_sender="org.bluez.Device"/>
+
+    <allow send_destination="org.bluez.Service"/>
+    <allow receive_sender="org.bluez.Service"/>
+
+    <allow send_destination="org.bluez.Database"/>
+    <allow receive_sender="org.bluez.Database"/>
+
+    <allow send_destination="org.bluez.Security"/>
+    <allow receive_sender="org.bluez.Security"/>
+  </policy>
+
+</busconfig>
diff --git a/utils/bluez-utils/files/bluez-utils.init b/utils/bluez-utils/files/bluez-utils.init
new file mode 100644 (file)
index 0000000..e9320ae
--- /dev/null
@@ -0,0 +1,131 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+
+#start after dbus (60)
+START=62
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get_bool _val "$section" "$option" '0'
+       [ $_val -gt 0 ] && append args "$3"
+}
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local default="$4"
+       local _val
+       config_get _val "$section" "$option" "$default"
+       [ -n "$_val" ] && append args "$3 $_val"
+}
+
+hcid_config() {
+       local cfg="$1"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ $enabled -gt 0 ] || return 1
+       args=""
+       append_bool "$cfg" nodaemon "-n"
+       append_string "$cfg" config "-f"
+       service_start /usr/sbin/hcid $args
+}
+
+hciattach_config() {
+       local cfg="$1"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ $enabled -gt 0 ] || return 1
+       args=""
+       append_string "$cfg" initspeed "-s" "115200"
+       append_string "$cfg" tty " " "ttyS1"
+       append_string "$cfg" type " " "csr"
+       append_string "$cfg" speed " " "115200"
+       append_string "$cfg" flow " " "noflow"
+       service_start /usr/sbin/hciattach $args
+}
+
+rfcomm_config() {
+       local cfg="$1"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ $enabled -gt 0 ] || return 1
+       args=""
+       append_string "$cfg" config "-f"
+       /usr/bin/rfcomm $args bind all
+}
+
+dund_config() {
+       local cfg="$1"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ $enabled -gt 0 ] || return 1
+       args=""
+       append_bool "$cfg" listen "--listen"
+       append_string "$cfg" connect "--connect"
+       append_string "$cfg" mrouter "--mrouter"
+       append_bool "$cfg" search "--search"
+       append_string "$cfg" channel "--channel"
+       append_string "$cfg" device "--device"
+       append_bool "$cfg" nosdp "--nosdp"
+       append_bool "$cfg" auth "--auth"
+       append_bool "$cfg" encrypt "--encrypt"
+       append_bool "$cfg" secure "--secure"
+       append_bool "$cfg" master "--master"
+       append_bool "$cfg" nodetach "--nodetach"
+       append_bool "$cfg" persist "--persist"
+       append_string "$cfg" pppd "--pppd"
+       append_bool "$cfg" msdun "--msdun"
+       append_bool "$cfg" activesync "--activesync"
+       append_bool "$cfg" cache "--cache"
+
+       append_string "$cfg" pppdopts ""
+       config_get ifn "$cfg" interface
+       if [ -n "$ifn" ]; then
+               config_get unit "$cfg" unit
+               [ -z "$unit" ] || append args "unit $unit ipparam $ifn linkname $ifn"
+       fi
+
+       service_start /usr/bin/dund $args
+}
+
+pand_config() {
+       local cfg="$1"
+       config_get_bool enabled "$cfg" "enabled" '1'
+       [ $enabled -gt 0 ] || return 1
+       args=""
+       append_bool "$cfg" listen "--listen"
+       append_string "$cfg" connect "--connect"
+       append_bool "$cfg" autozap "--autozap"
+       append_bool "$cfg" search "--search"
+       append_string "$cfg" role "--role"
+       append_string "$cfg" service "--service"
+       append_string "$cfg" ethernet "--ethernet"
+       append_string "$cfg" device "--device"
+       append_bool "$cfg" nosdp "-D"
+       append_bool "$cfg" auth "-A"
+       append_bool "$cfg" encrypt "-E"
+       append_bool "$cfg" secure "-S"
+       append_bool "$cfg" master "-M"
+       append_bool "$cfg" nodetach "-n"
+       append_bool "$cfg" persist "--persist"
+       append_bool "$cfg" cache "--cache"
+       append_string "$cfg" pidfile "--pidfile"
+       service_start /usr/bin/pand $args
+}
+
+start() {
+       config_load bluetooth
+       config_foreach hcid_config hcid
+       config_foreach hciattach_config hciattach
+       config_foreach rfcomm_config rfcomm
+       config_foreach dund_config dund
+       config_foreach pand_config pand
+}
+
+stop() {
+       service_stop /usr/bin/dund
+       service_stop /usr/bin/pand
+       /usr/bin/rfcomm release all
+       service_stop /usr/sbin/hciattach
+       service_stop /usr/sbin/hcid
+}
diff --git a/utils/bluez-utils/files/givepin b/utils/bluez-utils/files/givepin
new file mode 100644 (file)
index 0000000..e52a338
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Write bluetooth PIN number here:
+pin=
+
+if [ -z "$pin" ]; then
+       msg="Set bluetooth PIN in file $0"
+       logger -p user.err "$msg"
+       for i in /dev/pts/* ; do
+               [ -w $i ] && echo "$msg" > $i
+       done
+else
+       echo "PIN:$pin"
+fi
diff --git a/utils/bluez-utils/patches/001-include_limits.patch b/utils/bluez-utils/patches/001-include_limits.patch
new file mode 100644 (file)
index 0000000..2617306
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/hidd/sdp.c
++++ b/hidd/sdp.c
+@@ -34,6 +34,7 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
++#include <linux/limits.h>
+ #include <bluetooth/bluetooth.h>
+ #include <bluetooth/l2cap.h>
+--- a/tools/hciconfig.c
++++ b/tools/hciconfig.c
+@@ -37,6 +37,7 @@
+ #include <sys/param.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
++#include <linux/limits.h>
+ #include <bluetooth/bluetooth.h>
+ #include <bluetooth/hci.h>
diff --git a/utils/bluez-utils/patches/002-hcid_pin_helper.patch b/utils/bluez-utils/patches/002-hcid_pin_helper.patch
new file mode 100644 (file)
index 0000000..c236e4d
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/hcid/hcid.conf
++++ b/hcid/hcid.conf
+@@ -12,7 +12,7 @@
+       #   auto - Use local PIN for incoming connections
+       #   user - Always ask user for a PIN
+       #
+-      security user;
++      security auto;
+       # Pairing mode
+       #   none  - Pairing disabled
+@@ -29,7 +29,7 @@
+       # Local device name
+       #   %d - device id
+       #   %h - host name
+-      name "BlueZ (%d)";
++      name "%h";
+       # Local device class
+       class 0x000100;
diff --git a/utils/bluez-utils/patches/100-enokey.patch b/utils/bluez-utils/patches/100-enokey.patch
new file mode 100644 (file)
index 0000000..6273e17
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/input/device.c
++++ b/input/device.c
+@@ -25,6 +25,8 @@
+ #include <config.h>
+ #endif
++#define ENOKEY          161     /* Required key not available */
++
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <fcntl.h>
+--- a/input/storage.c
++++ b/input/storage.c
+@@ -25,6 +25,8 @@
+ #include <config.h>
+ #endif
++#define ENOKEY          161     /* Required key not available */
++
+ #include <stdio.h>
+ #include <errno.h>
+ #include <ctype.h>
diff --git a/utils/bluez-utils/patches/200-uart-speed.patch b/utils/bluez-utils/patches/200-uart-speed.patch
new file mode 100644 (file)
index 0000000..cb7d0e8
--- /dev/null
@@ -0,0 +1,40 @@
+--- a/tools/hciattach.c
++++ b/tools/hciattach.c
+@@ -111,20 +111,37 @@
+               return B230400;
+       case 460800:
+               return B460800;
++/* FIX: Not all platform support this high serial speed
++   claudyus84 @gamil.com
++*/
++#ifdef B500000
+       case 500000:
+               return B500000;
++#endif
++#ifdef B576000
+       case 576000:
+               return B576000;
++#endif
++#ifdef B921600
+       case 921600:
+               return B921600;
++#endif
++#ifdef B1000000
+       case 1000000:
+               return B1000000;
++#endif
++#ifdef B1152000
+       case 1152000:
+               return B1152000;
++#endif
++#ifdef B1500000
+       case 1500000:
+               return B1500000;
++#endif
++#ifdef B2000000
+       case 2000000:
+               return B2000000;
++#endif
+ #ifdef B2500000
+       case 2500000:
+               return B2500000;
diff --git a/utils/boblight/Makefile b/utils/boblight/Makefile
new file mode 100644 (file)
index 0000000..07e804c
--- /dev/null
@@ -0,0 +1,123 @@
+#
+# Copyright (C) 2011-2013 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:=boblight
+PKG_REV:=478
+PKG_VERSION:=$(PKG_REV)
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://boblight.googlecode.com/svn/trunk
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/boblight/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Tools for driving lights connected to an external controller
+  URL:=http://code.google.com/p/boblight/
+  DEPENDS:=+librt +libstdcpp
+endef
+
+define Package/boblight/Default/description
+  Its main purpose is to create light effects from an external input, such as a
+  video stream (desktop capture, video player, tv card), an audio stream (jack,
+  alsa), or user input (lirc, http). Currently it only handles video input by
+  desktop capture with xlib, video capture from v4l/v4l2 devices and user input
+  from the commandline with boblight-constant.
+
+  Boblight uses a client/server model, where clients are responsible for
+  translating an external input to light data, and boblightd is responsible for
+  translating the light data into commands for external light controllers.
+endef
+
+define Package/boblight-client
+  $(call Package/boblight/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= (constant color client)
+  DEPENDS+= +libboblight
+endef
+
+define Package/boblight-client/description
+  $(call Package/boblight/Default/description)
+
+  This package contains the boblight constant color client.
+endef
+
+define Package/boblight-daemon
+  $(call Package/boblight/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= (daemon)
+  DEPENDS+= +libboblight +libusb-1.0
+endef
+
+define Package/boblight-daemon/conffiles
+/etc/boblight.conf
+endef
+
+define Package/boblight-daemon/description
+  $(call Package/boblight/Default/description)
+
+  This package contains the boblight daemon.
+endef
+
+define Package/libboblight
+  $(call Package/boblight/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+endef
+
+define Package/libboblight/description
+  $(call Package/boblight/Default/description)
+
+  This package contains the libboblight shared library.
+endef
+
+CONFIGURE_ARGS += \
+       --without-portaudio \
+       --without-x11
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/libboblight
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/libboblight $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libboblight.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/boblight-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/boblight-constant $(1)/usr/bin/
+endef
+
+define Package/boblight-daemon/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/boblight.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/boblight.init $(1)/etc/init.d/boblight
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/boblightd $(1)/usr/bin/
+endef
+
+define Package/libboblight/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libboblight.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,boblight-client))
+$(eval $(call BuildPackage,boblight-daemon))
+$(eval $(call BuildPackage,libboblight))
diff --git a/utils/boblight/files/boblight.init b/utils/boblight/files/boblight.init
new file mode 100644 (file)
index 0000000..73705e7
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+
+SERVICE_DAEMONIZE=1
+
+start() {
+       service_start /usr/bin/boblightd
+}
+
+stop() {
+       service_stop /usr/bin/boblightd
+}
diff --git a/utils/bonnie++/Makefile b/utils/bonnie++/Makefile
new file mode 100644 (file)
index 0000000..55fe123
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2009-2014 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:=bonnie++
+PKG_VERSION:=1.96
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.coker.com.au/bonnie++/experimental/
+PKG_MD5SUM:=7b8594559f00887d2865de1838328b35
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bonniexx
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libstdcpp +libpthread
+  TITLE:=Bonnie++ - hard drive bottleneck testing program.
+  URL:=http://www.coker.com.au/bonnie++/
+endef
+
+define Package/bonniexx/description
+  Bonnie++ is a benchmark suite that is aimed at performing a number of simple
+  tests of hard drive and file system performance.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               TARGET_CXX="$(TARGET_CXX)" \
+               TARGET_LINK="$(TARGET_CXX)" \
+               MORECFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+endef
+
+define Package/bonniexx/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/bonnie++ $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/bon_csv2html $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bonniexx))
diff --git a/utils/bonnie++/patches/001-cross_compile_fix.patch b/utils/bonnie++/patches/001-cross_compile_fix.patch
new file mode 100644 (file)
index 0000000..98a933a
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/configure
++++ b/configure
+@@ -4372,7 +4372,7 @@ if test "$cross_compiling" = yes; then
+ See \`config.log' for more details." >&5
+ echo "$as_me: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++   { (exit 0); exit 0; }; }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,7 @@
+ EXES=bonnie++ zcav getc_putc getc_putc_helper
+ EXE=bon_csv2html generate_randfile
++TARGET_CXX=g++
++TARGET_LINK=g++
+ all: $(EXE) $(EXES)
+@@ -10,8 +12,8 @@ eprefix=${prefix}
+ #MORE_WARNINGS=-Weffc++
+ WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS)
+ CFLAGS=-O2  -DNDEBUG $(WFLAGS) $(MORECFLAGS)
+-CXX=g++ $(CFLAGS)
+-LINK=g++
++CXX=$(TARGET_CXX) $(CFLAGS)
++LINK=$(TARGET_LINK)
+ THREAD_LFLAGS=-lpthread
+ INSTALL=/usr/bin/install -c
diff --git a/utils/bonnie++/patches/002-add-verbose-error-messages.patch b/utils/bonnie++/patches/002-add-verbose-error-messages.patch
new file mode 100644 (file)
index 0000000..ccec8e8
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/bon_file.cpp
++++ b/bon_file.cpp
+@@ -464,25 +464,37 @@ int COpenTest::delete_sequential(BonTime
+     }
+     if(m_number_directories != 1)
+     {
+-      if(chdir("..") || rmdir(buf))
++      if(chdir(".."))
+       {
++        io_error("chdir");
++        return -1;
++      }
++      if(rmdir(buf))
++      {
++        fprintf(stderr, "Unable to delete directory '%s'\n", buf);
+         io_error("rmdir");
+         return -1;
+       }
+     }
+   }
+-  if(chdir("..") || rmdir(m_dirname))
++  if(count != m_number)
+   {
+-    io_error("rmdir");
++    fprintf(stderr, "Expected %d files but only got %d\n", m_number, count);
+     return -1;
+   }
+-  delete m_dirname;
+-  m_dirname = NULL;
+-  if(count != m_number)
++  if(chdir(".."))
+   {
+-    fprintf(stderr, "Expected %d files but only got %d\n", m_number, count);
++    io_error("chdir");
++    return -1;
++  }
++  if(rmdir(m_dirname))
++  {
++    fprintf(stderr, "Unable to delete directory '%s'\n", m_dirname);
++    io_error("rmdir");
+     return -1;
+   }
++  delete m_dirname;
++  m_dirname = NULL;
+   sync();
+   timer.stop_and_record(DelSeq);
+   timer.add_latency(DelSeq, dur.getMax());
diff --git a/utils/boxbackup/Makefile b/utils/boxbackup/Makefile
new file mode 100644 (file)
index 0000000..70e64e2
--- /dev/null
@@ -0,0 +1,140 @@
+#
+# 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:=boxbackup
+PKG_VERSION:=0.11.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.boxbackup.org/trac/export/2998/box/packages
+PKG_MD5SUM:=c4c4786a918a9c026f80833614c40a6b
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/boxbackup/Default
+  SUBMENU:=backup
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.boxbackup.org/
+  MAINTAINER:=Daniel Dickinson <openwrt@cshore.neomailbox.net>
+endef
+
+define Package/boxbackup
+  $(call Package/boxbackup/Default)
+  TITLE:=Secure network backup
+  MENU:=1
+endef
+
+define Package/bbstored
+  $(call Package/boxbackup/Default)
+  TITLE:=Server for secure network backup
+  DEPENDS:=boxbackup +libopenssl +zlib +libdb47 +libopenssl +libstdcpp +libreadline +libncurses
+endef
+
+define Package/bbstored/description
+  Boxbackup is an open source, completely automatic, on-line backup system.
+  This package is for the server (where the backups are stored).  The
+  server is known as bbstored.
+endef
+
+define Package/bbstored/conffiles
+/etc/config/bbbstored
+endef
+
+
+define Package/bbstored-config-external
+  $(call Package/boxbackup/Default)
+  TITLE:=Configure network backup server
+  DEPENDS:=boxbackup +openssl-util +microperl
+endef
+
+define Package/boxbackup-certs
+  $(call Package/boxbackup/Default)
+  TITLE:=Manage network backup security certificates
+  DEPENDS:=boxbackup +openssl-util +microperl
+endef
+
+define Package/bbackupd
+  $(call Package/boxbackup/Default)
+  TITLE:=Client for secure network backup
+  DEPENDS:=boxbackup +libopenssl +zlib +libdb47 +libopenssl +libreadline +libstdcpp +libncurses +openssl-util +microperl
+endef
+
+define Package/bbackupd/description
+  Box Backup is an open source, completely automatic, on-line backup system.
+  This package is for the client (host to be backed up).
+endef
+
+
+TARGET_CFLAGS += $(FPIC) -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib
+
+CONFIGURE_ARGS += \
+       --sysconfdir=/var/etc \
+       --enable-gnu-readline \
+       --with-bdb-headers=$(STAGING_DIR)/usr/include \
+       --with-bdb-lib=$(STAGING_DIR)/usr/lib \
+       --with-ssl-header=$(STAGING_DIR)/usr/include \
+       --with-ssl-lib=$(STAGING_DIR)/usr/lib \
+       --with-random=/dev/urandom \
+       --disable-static-bin
+
+define Build/Install
+       mkdir -p $(PKG_INSTALL_DIR)
+       tar -C $(PKG_INSTALL_DIR) -xzf $(PKG_BUILD_DIR)/parcels/$(PKG_NAME)-$(PKG_VERSION)-backup-server-linux-gnu.tgz
+       tar -C $(PKG_INSTALL_DIR) -xzf $(PKG_BUILD_DIR)/parcels/$(PKG_NAME)-$(PKG_VERSION)-backup-client-linux-gnu.tgz
+endef
+
+BXBK_SRV_INSTALL_DIR = $(PKG_INSTALL_DIR)/$(PKG_NAME)-$(PKG_VERSION)-backup-server-linux-gnu
+BXBK_CLIENT_INSTALL_DIR = $(PKG_INSTALL_DIR)/$(PKG_NAME)-$(PKG_VERSION)-backup-client-linux-gnu
+
+define Package/boxbackup/install
+       true
+endef
+
+define Package/bbstored/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstored $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/boxbackup
+       $(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstoreaccounts $(1)/usr/lib/boxbackup/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/bbstored.init $(1)/etc/init.d/bbstored
+       $(INSTALL_DIR) $(1)/lib/functions
+       $(INSTALL_DATA) ./files/bbstored.sh $(1)/lib/functions/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/bbstored.config $(1)/etc/config/bbstored
+       $(INSTALL_BIN) ./files/bbstoreaccounts $(1)/usr/sbin/
+endef
+
+define Package/bbstored-config-external/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstored-config $(1)/usr/sbin/
+       $(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/raidfile-config $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/bbstored
+endef
+
+define Package/boxbackup-certs/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstored-certs $(1)/usr/sbin/
+endef
+
+define Package/bbackupd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupd $(1)/usr/sbin/
+       $(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupquery $(1)/usr/sbin/
+       $(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupctl $(1)/usr/sbin/
+       $(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupd-config $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,boxbackup))
+$(eval $(call BuildPackage,bbstored))
+$(eval $(call BuildPackage,boxbackup-certs))
+$(eval $(call BuildPackage,bbstored-config-external))
+$(eval $(call BuildPackage,bbackupd))
diff --git a/utils/boxbackup/files/bbstoreaccounts b/utils/boxbackup/files/bbstoreaccounts
new file mode 100755 (executable)
index 0000000..ec38fc0
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/functions/bbstored.sh
+
+bxbk_config_file=
+NORUN=
+
+if [ "$1" = "-c" ]; then
+       shift
+       bxbk_config_file="$1"
+       shift
+else
+       if [ -z "$1" ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
+               /usr/lib/boxbackup/bbstoreaccounts -h
+               exit 1
+       fi
+       if [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ]; then
+               /usr/lib/boxbackup/bbstoreaccounts -h
+               exit 1
+       fi
+       config_load bbstored
+       create_config
+       if [ "$EXTERNAL_CONFIG" = "1" ]; then
+               bxbk_config_file="$EXTERNAL_CONF_FILE"
+       else
+               bxbk_config_file="$BXBK_CONFIG_PATH/bbstored.conf"
+       fi
+fi
+
+[ "$NORUN" != "1" ] && [ -n "$bxbk_config_file" ] && /usr/lib/boxbackup/bbstoreaccounts -c "$bxbk_config_file" "$@" || {
+       echo "Error managing account using '$bxbk_config_file'"
+       exit 1
+}
diff --git a/utils/boxbackup/files/bbstored.config b/utils/boxbackup/files/bbstored.config
new file mode 100644 (file)
index 0000000..d53a4b9
--- /dev/null
@@ -0,0 +1,26 @@
+
+# Example config using defaults used of no option supplied
+# or <value> for values that have no default....the <> would
+# need to be removed.
+
+# config bbstored
+#      option config_path '/var/etc/boxbackup'
+#      option raidfileconf '/var/etc/boxbackup/raidfile.conf'
+#      option accountdb 'etc/bbstored/accounts.txt'
+#      option extlog 1
+#      option housekeep_time 900
+#      option user nobody
+#      option group nogroup
+#      option address <192.168.1.1>
+# OR   option address <myhost.example.com>
+#      option certfile </path/to/server_certificate>
+#      option keyfile </path/to/key_for_certificate>
+#      option cafile </path/to/trusted_certificate_authority>
+#      option pidfile /var/run/bbstored.pid
+
+#config raidfile
+#      option setnum <0>
+#      option blocksize 1024
+#      option path </directory/for/backup/store>
+
+# There can be many raidfile section, but each must have a unique setnum
diff --git a/utils/boxbackup/files/bbstored.init b/utils/boxbackup/files/bbstored.init
new file mode 100644 (file)
index 0000000..91e677e
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 Openwrt.org
+
+START=90
+
+start() {
+       . /lib/functions/bbstored.sh
+
+       create_config
+
+       if [ "$EXTERNAL_CONFIG" -eq 1 ]
+       then
+               BXBK_CONFIG_FILE="$EXTERNAL_CONF_FILE"
+       fi
+       service_start /usr/sbin/bbstored "$BXBK_CONFIG_FILE"
+}
+
+stop() {
+       . /lib/functions/bbstored.sh
+
+       service_stop /usr/sbin/bbstored
+}
diff --git a/utils/boxbackup/files/bbstored.sh b/utils/boxbackup/files/bbstored.sh
new file mode 100644 (file)
index 0000000..91bc1ad
--- /dev/null
@@ -0,0 +1,164 @@
+#!/bin/sh
+# Copyright (C) 2011 Openwrt.org
+# Copyright (C) 2011 Daniel Dickinson <openwrt@cshore.neomailbox.net>
+
+BXBK_CONFIG_PATH=/var/etc/boxbackup
+PID_FILE=/var/run/bbstored.pid
+
+EXTERNAL_CONFIG=0
+
+EXTERNAL_CONF_FILE=
+RUNAS_USER=
+RUNAS_GROUP=
+BXBK_RAIDFILE_CONF=
+
+bbstored_global() {
+       local cfg="$1"
+       local get_config="$2"
+
+       local external_config
+       local raidfileconf
+       local user
+       local group
+       local config_path
+       local pidfile
+       local accountdb
+       local extended_logging
+       local housekeep_time
+       local address
+       local certfile
+       local keyfile
+       local cafile
+
+       config_get external_config "$cfg" external_config
+       if [ -n "$external_config" ]; then
+               EXTERNAL_CONFIG=1
+               EXTERNAL_CONF_FILE="$external_config"
+       fi
+
+       config_get config_path "$cfg" config_path
+       [ -n "$config_path" ] && {
+               BXBK_CONFIG_PATH="$config_path"
+       }
+
+       [ "$get_config" = "1" ] && return 0
+       [ -z "$BXBK_CONFIG_FILE" ] && return 1
+       
+       rm -f "$BXBK_CONFIG_FILE"
+       touch "$BXBK_CONFIG_FILE"
+
+       config_get raidfileconf "$cfg" raidfileconf "$BXBK_CONFIG_PATH/raidfile.conf"
+       echo "RaidFileConf = $raidfileconf" >>$BXBK_CONFIG_FILE
+       BXBK_RAIDFILE_CONF="$raidfileconf"
+
+       config_get accountdb "$cfg" accountdb "/etc/bbstored/accounts.txt"
+       echo "AccountDatabase = $accountdb" >>$BXBK_CONFIG_FILE
+       [ ! -r "$accountdb" ] && {
+               echo "Account database missing"
+               NORUN=1
+               return 1
+       }
+
+       local extlog
+       config_get extended_logging "$cfg" extended_logging 1
+       if [ "$extended_logging" = "1" ]; then
+               extlog=yes
+       else
+               extlog=no
+       fi
+       echo "ExtendedLogging = $extlog" >>$BXBK_CONFIG_FILE
+
+       config_get housekeep_time "$cfg" housekeep_time 900
+       echo "TimeBetweenHousekeeping = $housekeep_time" >>$BXBK_CONFIG_FILE    
+
+       echo "" >>$BXBK_CONFIG_FILE
+       echo "Server" >>$BXBK_CONFIG_FILE
+       echo "{" >>$BXBK_CONFIG_FILE
+
+       config_get user "$cfg" user 
+       config_get group "$cfg" group
+       [ -n "$user" ] && [ "$group" ] && {
+               RUNAS_USER=$user
+               RUNAS_GROUP=$group
+       }
+       echo "    User = ${RUNAS_USER:-nobody}" >>$BXBK_CONFIG_FILE
+       
+       config_get address "$cfg" address
+       [ -z "$address" ] && NORUN=1
+
+       echo "    ListenAddresses = inet:$address" >>$BXBK_CONFIG_FILE
+       
+       config_get certfile "$cfg" certfile
+       [ -z  "$certfile" ] && NORUN=1
+
+       echo "    CertificateFile = $certfile" >>$BXBK_CONFIG_FILE
+
+       config_get keyfile "$cfg" keyfile
+       [ -z  "$keyfile" ] && NORUN=1
+
+       echo "    PrivateKeyFile = $keyfile" >>$BXBK_CONFIG_FILE
+
+       config_get cafile "$cfg" cafile
+       [ -z  "$cafile" ] && NORUN=1
+
+       echo "    TrustedCAsFile = $cafile" >>$BXBK_CONFIG_FILE
+
+       config_get pidfile "$cfg" pidfile 
+       [ -n "$pidfile" ] && {
+               PID_FILE="$pidfile"
+       }
+       echo "    PidFile = $PID_FILE" >>$BXBK_CONFIG_FILE
+
+       echo "}" >>$BXBK_CONFIG_FILE
+}
+
+raidfile_section() {
+       local cfg="$1"
+
+       local setnum
+       local blocksize
+       local path
+       
+       config_get setnum "$cfg" setnum
+       [ -z "$setnum" ] && return 1
+
+       config_get blocksize "$cfg" blocksize
+
+       config_get path "$cfg" path
+       [ -z "$path" ] && return 1
+
+       echo "disc${setnum}" >>$BXBK_RAIDFILE_CONF
+       echo "{" >>$BXBK_RAIDFILE_CONF
+       echo "    SetNumber = ${setnum}" >>$BXBK_RAIDFILE_CONF
+       [ -n "$blocksize" ] && echo "    BlockSize = ${blocksize}" >>$BXBK_RAIDFILE_CONF
+       for i in 0 1 2; do
+               echo "    Dir${i} = $path" >>$BXBK_RAIDFILE_CONF
+       done
+
+       echo "}" >>$BXBK_RAIDFILE_CONF
+
+}
+
+create_config() {
+       config_load bbstored
+       config_foreach bbstored_global bbstored 1
+
+       if [ "$EXTERNAL_CONFIG" -eq 0 ]
+       then
+               mkdir -p "$BXBK_CONFIG_PATH/bbstored"
+               BXBK_CONFIG_FILE="$BXBK_CONFIG_PATH/bbstored.conf"
+               touch "$BXBK_CONFIG_FILE"
+
+               config_load bbstored
+               config_foreach bbstored_global bbstored
+
+               [ -z "$BXBK_RAIDFILE_CONF" ] && return 1
+               rm -f "$BXBK_RAIDFILE_CONF"
+               touch "$BXBK_RAIDFILE_CONF"
+       
+               config_foreach raidfile_section raidfile
+
+               chown -R ${RUNAS_USER:-nobody}:${RUNAS_GROUP:-nogroup} "$BXBK_CONFIG_PATH"
+       fi
+}
+
diff --git a/utils/bsdiff/Makefile b/utils/bsdiff/Makefile
new file mode 100644 (file)
index 0000000..2dab0ac
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2011 Alexander Gordeev <lasaine@lvk.cs.msu.su>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bsdiff
+PKG_VERSION:=4.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.daemonology.net/bsdiff
+PKG_MD5SUM:=e6d812394f0e0ecc8d5df255aa1db22a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bsdiff
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libbz2
+  URL:=http://www.daemonology.net/bsdiff
+  TITLE:=Tools for building and applying patches to binary files
+endef
+
+define Package/bsdiff/description
+ bsdiff and bspatch are tools for building and applying patches to binary
+ files. By using suffix sorting (specifically, Larsson and Sadakane's
+ qsufsort) and taking advantage of how executable files change, bsdiff
+ routinely produces binary patches 50-80% smaller than those produced by
+ Xdelta, and 15% smaller than those produced by .RTPatch (a $2750/seat
+ commercial patch tool).
+endef
+
+define Package/bsdiff/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bsdiff $(PKG_BUILD_DIR)/bspatch $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bsdiff))
diff --git a/utils/bsdiff/patches/001-makefile.patch b/utils/bsdiff/patches/001-makefile.patch
new file mode 100644 (file)
index 0000000..45f3d6a
--- /dev/null
@@ -0,0 +1,11 @@
+diff --git a/Makefile b/Makefile
+index a522607..7da4463 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,6 +10,3 @@ bspatch:     bspatch.c
+ install:
+       ${INSTALL_PROGRAM} bsdiff bspatch ${PREFIX}/bin
+-.ifndef WITHOUT_MAN
+-      ${INSTALL_MAN} bsdiff.1 bspatch.1 ${PREFIX}/man/man1
+-.endif
diff --git a/utils/btrfs-progs/Makefile b/utils/btrfs-progs/Makefile
new file mode 100644 (file)
index 0000000..f93b9ac
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2009 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:=btrfs-progs
+PKG_VERSION:=0.19
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/
+PKG_MD5SUM:=69e29ecd922e3f9dcb74a3a8f80b4f68
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/btrfs-progs
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Filesystem
+  DEPENDS:=+libuuid +zlib
+  TITLE:=Btrfs filesystems utilities
+  URL:=http://btrfs.wiki.kernel.org/
+endef
+
+define Package/btrfs-progs/description
+ Btrfs is a new copy on write filesystem for Linux aimed at implementing
+ advanced features while focusing on fault tolerance, repair and easy
+ administration. Initially developed by Oracle, Btrfs is licensed under the
+ GPL and open for contribution from anyone.
+endef
+
+progs = btrfsctl mkfs.btrfs btrfs-debug-tree btrfs-show btrfs-vol btrfsck
+
+MAKE_FLAGS+=\
+       CC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       prefix=/usr \
+       DESTDIR=$(PKG_INSTALL_DIR)
+
+define Package/btrfs-progs/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(addprefix $(PKG_INSTALL_DIR)/usr/bin/, $(progs)) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/btrfs-scan.init $(1)/etc/init.d/btrfs-scan
+endef
+
+$(eval $(call BuildPackage,btrfs-progs))
diff --git a/utils/btrfs-progs/files/btrfs-scan.init b/utils/btrfs-progs/files/btrfs-scan.init
new file mode 100644 (file)
index 0000000..f1264ee
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009 OpenWrt.org
+
+START=19
+
+start() {
+       grep -q btrfs /proc/modules && /usr/bin/btrfsctl -a
+}
+
diff --git a/utils/btrfs-progs/patches/001-Makefile-gcc-fix b/utils/btrfs-progs/patches/001-Makefile-gcc-fix
new file mode 100644 (file)
index 0000000..37da622
--- /dev/null
@@ -0,0 +1,53 @@
+diff --git a/Makefile b/Makefile
+index 8097b5a..63a734b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -36,37 +36,37 @@ version:
+       bash version.sh
+ btrfsctl: $(objects) btrfsctl.o
+-      gcc $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS)
+ btrfs-vol: $(objects) btrfs-vol.o
+-      gcc $(CFLAGS) -o btrfs-vol btrfs-vol.o $(objects) $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfs-vol btrfs-vol.o $(objects) $(LDFLAGS) $(LIBS)
+ btrfs-show: $(objects) btrfs-show.o
+-      gcc $(CFLAGS) -o btrfs-show btrfs-show.o $(objects) $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfs-show btrfs-show.o $(objects) $(LDFLAGS) $(LIBS)
+ btrfsck: $(objects) btrfsck.o
+-      gcc $(CFLAGS) -o btrfsck btrfsck.o $(objects) $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfsck btrfsck.o $(objects) $(LDFLAGS) $(LIBS)
+ mkfs.btrfs: $(objects) mkfs.o
+-      gcc $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
+ btrfs-debug-tree: $(objects) debug-tree.o
+-      gcc $(CFLAGS) -o btrfs-debug-tree $(objects) debug-tree.o $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfs-debug-tree $(objects) debug-tree.o $(LDFLAGS) $(LIBS)
+ btrfstune: $(objects) btrfstune.o
+-      gcc $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
+ btrfs-image: $(objects) btrfs-image.o
+-      gcc $(CFLAGS) -o btrfs-image $(objects) btrfs-image.o -lpthread -lz $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfs-image $(objects) btrfs-image.o -lpthread -lz $(LDFLAGS) $(LIBS)
+ dir-test: $(objects) dir-test.o
+-      gcc $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS)
+ quick-test: $(objects) quick-test.o
+-      gcc $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS) $(LIBS)
+ convert: $(objects) convert.o
+-      gcc $(CFLAGS) -o btrfs-convert $(objects) convert.o -lext2fs $(LDFLAGS) $(LIBS)
++      $(CC) $(CFLAGS) -o btrfs-convert $(objects) convert.o -lext2fs $(LDFLAGS) $(LIBS)
+ manpages:
+       cd man; make
diff --git a/utils/byobu/Makefile b/utils/byobu/Makefile
new file mode 100644 (file)
index 0000000..5d046db
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2009 Sharim At Work, Ltd.
+# Author: Xiangfu Liu <xiangfu@sharism.cc>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=byobu
+PKG_VERSION:=3.6
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://launchpad.net/byobu/trunk/3.6/+download/
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/byobu
+    MAINTAINER:="Xiangfu Liu" <xiangfu@sharism.cc>
+    SECTION:=utils
+    CATEGORY:=Utilities
+    TITLE:=a Japanese term for decorative, multi-panel screens that serve as folding room dividers
+    URL:=https://launchpad.net/byobu
+endef
+
+define Package/byobu/description
+  Byobu is a Japanese term for decorative, multi-panel screens that serve
+  as folding room dividers. As an open source project, Byobu is an elegant
+  enhancement of the otherwise functional, plain, practical GNU Screen.
+  Byobu includes an enhanced profile and configuration utilities for the
+  GNU screen window manager, such as toggle-able system status notifications.
+endef
+
+define Package/byobu/install
+       $(INSTALL_DIR) \
+               $(1)/usr/bin \
+               $(1)/usr/lib/byobu \
+               $(1)/usr/share
+
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/* \
+               $(1)/usr/bin/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/byobu \
+               $(1)/usr/lib/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/byobu \
+               $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,byobu))
diff --git a/utils/calcurse/Makefile b/utils/calcurse/Makefile
new file mode 100644 (file)
index 0000000..4295ade
--- /dev/null
@@ -0,0 +1,39 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=calcurse
+PKG_VERSION:=2.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=get.cgi?calcurse-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://culot.org/cgi-bin
+PKG_MD5SUM:=124d40c0912b12021996220f02b759cc
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/calcurse-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/calcurse
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Calcurse
+  DEPENDS:=+libncursesw +libreadline +libpthread
+  URL:=http://culot.org/calcurse
+endef
+
+define Package/calcurse/description
+       Fullscreen curses based calendar.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --prefix=/usr \
+       )
+endef
+
+define Package/calcurse/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/calcurse $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,calcurse))
diff --git a/utils/calvaria/Makefile b/utils/calvaria/Makefile
new file mode 100644 (file)
index 0000000..f8574fa
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 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:=calvaria
+PKG_RELEASE:=1
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/calvaria
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Maemo CAL partition access tool
+  MAINTAINER:=Michael Buesch <mb@bu3sch.de>
+endef
+
+define Package/calvaria/description
+  Calvaria - Maemo CAL partition variable access tool
+  The CAL partition (/dev/mtdblock1) is used to store configuration
+  and calibration data.
+endef
+
+define Build/Prepare
+       $(CP) ./files/src/* $(PKG_BUILD_DIR)/
+endef
+
+define Package/calvaria/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/calvaria $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cal2p54 $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,calvaria))
diff --git a/utils/calvaria/files/src/Makefile b/utils/calvaria/files/src/Makefile
new file mode 100644 (file)
index 0000000..6d42bf1
--- /dev/null
@@ -0,0 +1,32 @@
+DESTDIR                ?=
+PREFIX         ?= /usr
+CFLAGS         ?= -O2 -Wall
+LDFLAGS                ?=
+LDLIBS         ?=
+
+STRIP          ?= strip
+INSTALL                ?= install
+
+CALVARIA_BIN   := calvaria
+CAL2P54_BIN    := cal2p54
+
+all: $(CALVARIA_BIN) $(CAL2P54_BIN)
+
+$(CALVARIA_BIN): calvaria.o
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+       $(STRIP) $@
+
+$(CAL2P54_BIN): cal2p54.o
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+       $(STRIP) $@
+
+%.o: %.c
+       $(CC) -c $(CFLAGS) $^ -o $@
+
+install: $(CALVARIA_BIN) $(CAL2P54_BIN)
+       $(INSTALL) -d $(DESTDIR)/$(PREFIX)/bin
+       $(INSTALL) -m 0755 $(CALVARIA_BIN) $(DESTDIR)/$(PREFIX)/bin/
+       $(INSTALL) -m 0755 $(CAL2P54_BIN) $(DESTDIR)/$(PREFIX)/bin/
+
+clean:
+       rm -f $(CALVARIA_BIN) $(CAL2P54_BIN) *.o
diff --git a/utils/calvaria/files/src/cal2p54.c b/utils/calvaria/files/src/cal2p54.c
new file mode 100644 (file)
index 0000000..cac4436
--- /dev/null
@@ -0,0 +1,940 @@
+/*
+ * cal2p54 - CAL to p54spi EEPROM converter
+ *
+ * Copyright (c) 2011 Michael Buesch <mb@bu3sch.de>
+ *
+ * Licensed under the GNU General Public License version 2.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+
+/* Template data from Linux p54spi_eeprom.h:
+ *
+ * Copyright (C) 2003 Conexant Americas Inc. All Rights Reserved.
+ * Copyright (C) 2004, 2005, 2006 Nokia Corporation
+ * Copyright 2008 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2008 Christian Lamparter <chunkeey@web.de>
+ *
+ * based on:
+ *  - cx3110x's pda.h from Nokia
+ *  - cx3110-transfer.log by Johannes Berg
+ */
+
+static const uint8_t template_eeprom_pda_wrap[] = {
+       /* struct eeprom_pda_wrap */
+       0x47, 0x4d, 0x55, 0xaa, /* magic */
+       0x00, 0x00,             /* pad */
+       0x00, 0x00,             /* eeprom_pda_data_wrap length */
+       0x00, 0x00, 0x00, 0x00, /* arm opcode */
+};
+
+static const uint8_t template_mac_address[] = {
+       /* bogus MAC address */
+       0x04, 0x00, 0x01, 0x01,         /* PDR_MAC_ADDRESS */
+               0x00, 0x02, 0xee, 0xc0, 0xff, 0xee,
+};
+
+static const uint8_t template_bootrec_exp_if[] = {
+       /* struct bootrec_exp_if */
+       0x06, 0x00, 0x01, 0x10,         /* PDR_INTERFACE_LIST */
+               0x00, 0x00,                     /* role */
+               0x0f, 0x00,                     /* if_id */
+               0x85, 0x00,                     /* variant = Longbow RF, 2GHz */
+               0x01, 0x00,                     /* btm_compat */
+               0x1f, 0x00,                     /* top_compat */
+
+       0x03, 0x00, 0x02, 0x10,         /* PDR_HARDWARE_PLATFORM_COMPONENT_ID */
+               0x03, 0x20, 0x00, 0x43,
+};
+
+static const uint8_t template_pda_country_list[] = {
+       /* struct pda_country[6] */
+       0x0d, 0x00, 0x07, 0x10,         /* PDR_COUNTRY_LIST */
+               0x10, 0x00, 0x00, 0x00,
+               0x20, 0x00, 0x00, 0x00,
+               0x30, 0x00, 0x00, 0x00,
+               0x31, 0x00, 0x00, 0x00,
+               0x32, 0x00, 0x00, 0x00,
+               0x40, 0x00, 0x00, 0x00,
+};
+
+static const uint8_t template_pda_country[] = {
+       /* struct pda_country */
+       0x03, 0x00, 0x08, 0x10,         /* PDR_DEFAULT_COUNTRY */
+               0x30, 0x00, 0x00, 0x00,         /* ETSI */
+};
+
+static const uint8_t template_antenna_gain[] = {
+       0x03, 0x00, 0x00, 0x11,         /* PDR_ANTENNA_GAIN */
+               0x08, 0x08, 0x08, 0x08,
+};
+
+static const uint8_t template_rssi_linear_approx_custom2[] = {
+       0x0a, 0x00, 0xff, 0xca,         /* PDR_RSSI_LINEAR_APPROXIMATION_CUSTOMV2 */
+               0x01, 0x00, 0x0a, 0x00,
+               0x00, 0x00, 0x0a, 0x00,
+                       0x85, 0x09, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00,
+};
+
+static const uint8_t template_pa_cal_curve[] = {
+       /* struct pda_custom_wrapper */
+       0x10, 0x06, 0x5d, 0xb0,         /* PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM */
+               0x0d, 0x00, 0xee, 0x00,         /* 13 entries, 238 bytes per entry */
+               0x00, 0x00, 0x16, 0x0c,         /* no offset, 3094 total len */
+                       /* 2412 MHz */
+                       0x6c, 0x09,
+                               0x10, 0x01, 0x9a, 0x84,
+                                       0xaa, 0x8a, 0xaa, 0x8a, 0xaa, 0x8a, 0xaa, 0x8a,
+                                       0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6,
+                                       0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6,
+                               0xf0, 0x00, 0x94, 0x6c,
+                                       0x99, 0x82, 0x99, 0x82, 0x99, 0x82, 0x99, 0x82,
+                                       0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae,
+                                       0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae,
+                               0xd0, 0x00, 0xaa, 0x5a,
+                                       0x88, 0x7a, 0x88, 0x7a, 0x88, 0x7a, 0x88, 0x7a,
+                                       0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6,
+                                       0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6,
+                               0xa0, 0x00, 0xf3, 0x47,
+                                       0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e,
+                                       0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a,
+                                       0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a,
+                               0x50, 0x00, 0x59, 0x36,
+                                       0x43, 0x5a, 0x43, 0x5a, 0x43, 0x5a, 0x43, 0x5a,
+                                       0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85,
+                                       0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85,
+                               0x00, 0x00, 0xe4, 0x2d,
+                                       0x18, 0x46, 0x18, 0x46, 0x18, 0x46, 0x18, 0x46,
+                                       0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71,
+                                       0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2417 MHz */
+                       0x71, 0x09,
+                               0x10, 0x01, 0xb9, 0x83,
+                                       0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a,
+                                       0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                                       0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                               0xf0, 0x00, 0x2e, 0x6c,
+                                       0x68, 0x82, 0x68, 0x82, 0x68, 0x82, 0x68, 0x82,
+                                       0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                                       0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                               0xd0, 0x00, 0x8d, 0x5a,
+                                       0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a,
+                                       0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                                       0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                               0xa0, 0x00, 0x0a, 0x48,
+                                       0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e,
+                                       0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                                       0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                               0x50, 0x00, 0x7c, 0x36,
+                                       0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59,
+                                       0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                                       0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                               0x00, 0x00, 0xf5, 0x2d,
+                                       0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45,
+                                       0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                                       0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2422 MHz */
+                       0x76, 0x09,
+                               0x10, 0x01, 0xb9, 0x83,
+                                       0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a,
+                                       0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                                       0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                               0xf0, 0x00, 0x2e, 0x6c,
+                                       0x68, 0x82, 0x68, 0x82, 0x68, 0x82, 0x68, 0x82,
+                                       0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                                       0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                               0xd0, 0x00, 0x8d, 0x5a,
+                                       0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a,
+                                       0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                                       0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                               0xa0, 0x00, 0x0a, 0x48,
+                                       0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e,
+                                       0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                                       0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                               0x50, 0x00, 0x7c, 0x36,
+                                       0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59,
+                                       0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                                       0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                               0x00, 0x00, 0xf5, 0x2d,
+                                       0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45,
+                                       0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                                       0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2427 MHz */
+                       0x7b, 0x09,
+                               0x10, 0x01, 0x48, 0x83,
+                                       0x67, 0x8a, 0x67, 0x8a, 0x67, 0x8a, 0x67, 0x8a,
+                                       0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5,
+                                       0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5,
+                               0xf0, 0x00, 0xfb, 0x6b,
+                                       0x50, 0x82, 0x50, 0x82, 0x50, 0x82, 0x50, 0x82,
+                                       0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad,
+                                       0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad,
+                               0xd0, 0x00, 0x7e, 0x5a,
+                                       0x38, 0x7a, 0x38, 0x7a, 0x38, 0x7a, 0x38, 0x7a,
+                                       0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5,
+                                       0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5,
+                               0xa0, 0x00, 0x15, 0x48,
+                                       0x14, 0x6e, 0x14, 0x6e, 0x14, 0x6e, 0x14, 0x6e,
+                                       0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99,
+                                       0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99,
+                               0x50, 0x00, 0x8e, 0x36,
+                                       0xd9, 0x59, 0xd9, 0x59, 0xd9, 0x59, 0xd9, 0x59,
+                                       0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85,
+                                       0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85,
+                               0x00, 0x00, 0xfe, 0x2d,
+                                       0x9d, 0x45, 0x9d, 0x45, 0x9d, 0x45, 0x9d, 0x45,
+                                       0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71,
+                                       0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2432 MHz */
+                       0x80, 0x09,
+                               0x10, 0x01, 0xd7, 0x82,
+                                       0x51, 0x8a, 0x51, 0x8a, 0x51, 0x8a, 0x51, 0x8a,
+                                       0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5,
+                                       0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5,
+                               0xf0, 0x00, 0xc8, 0x6b,
+                                       0x37, 0x82, 0x37, 0x82, 0x37, 0x82, 0x37, 0x82,
+                                       0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad,
+                                       0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad,
+                               0xd0, 0x00, 0x6f, 0x5a,
+                                       0x1d, 0x7a, 0x1d, 0x7a, 0x1d, 0x7a, 0x1d, 0x7a,
+                                       0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5,
+                                       0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5,
+                               0xa0, 0x00, 0x20, 0x48,
+                                       0xf6, 0x6d, 0xf6, 0x6d, 0xf6, 0x6d, 0xf6, 0x6d,
+                                       0x88, 0x99, 0x88, 0x99, 0x88, 0x99, 0x88, 0x99,
+                                       0x88, 0x99, 0x88, 0x99, 0x88, 0x99, 0x88, 0x99,
+                               0x50, 0x00, 0x9f, 0x36,
+                                       0xb5, 0x59, 0xb5, 0x59, 0xb5, 0x59, 0xb5, 0x59,
+                                       0x47, 0x85, 0x47, 0x85, 0x47, 0x85, 0x47, 0x85,
+                                       0x47, 0x85, 0x47, 0x85, 0x47, 0x85, 0x47, 0x85,
+                               0x00, 0x00, 0x06, 0x2e,
+                                       0x74, 0x45, 0x74, 0x45, 0x74, 0x45, 0x74, 0x45,
+                                       0x06, 0x71, 0x06, 0x71, 0x06, 0x71, 0x06, 0x71,
+                                       0x06, 0x71, 0x06, 0x71, 0x06, 0x71, 0x06, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2437 MHz */
+                       0x85, 0x09,
+                               0x10, 0x01, 0x67, 0x82,
+                                       0x3a, 0x8a, 0x3a, 0x8a, 0x3a, 0x8a, 0x3a, 0x8a,
+                                       0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5,
+                                       0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5,
+                               0xf0, 0x00, 0x95, 0x6b,
+                                       0x1f, 0x82, 0x1f, 0x82, 0x1f, 0x82, 0x1f, 0x82,
+                                       0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad,
+                                       0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad,
+                               0xd0, 0x00, 0x61, 0x5a,
+                                       0x02, 0x7a, 0x02, 0x7a, 0x02, 0x7a, 0x02, 0x7a,
+                                       0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5,
+                                       0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5,
+                               0xa0, 0x00, 0x2c, 0x48,
+                                       0xd8, 0x6d, 0xd8, 0x6d, 0xd8, 0x6d, 0xd8, 0x6d,
+                                       0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99,
+                                       0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99,
+                               0x50, 0x00, 0xb1, 0x36,
+                                       0x92, 0x59, 0x92, 0x59, 0x92, 0x59, 0x92, 0x59,
+                                       0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                                       0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                               0x00, 0x00, 0x0f, 0x2e,
+                                       0x4b, 0x45, 0x4b, 0x45, 0x4b, 0x45, 0x4b, 0x45,
+                                       0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70,
+                                       0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2442 MHz */
+                       0x8a, 0x09,
+                               0x10, 0x01, 0xf6, 0x81,
+                                       0x24, 0x8a, 0x24, 0x8a, 0x24, 0x8a, 0x24, 0x8a,
+                                       0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5,
+                                       0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5,
+                               0xf0, 0x00, 0x62, 0x6b,
+                                       0x06, 0x82, 0x06, 0x82, 0x06, 0x82, 0x06, 0x82,
+                                       0x98, 0xad, 0x98, 0xad, 0x98, 0xad, 0x98, 0xad,
+                                       0x98, 0xad, 0x98, 0xad, 0x98, 0xad, 0x98, 0xad,
+                               0xd0, 0x00, 0x52, 0x5a,
+                                       0xe7, 0x79, 0xe7, 0x79, 0xe7, 0x79, 0xe7, 0x79,
+                                       0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5,
+                                       0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5,
+                               0xa0, 0x00, 0x37, 0x48,
+                                       0xba, 0x6d, 0xba, 0x6d, 0xba, 0x6d, 0xba, 0x6d,
+                                       0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99,
+                                       0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99,
+                               0x50, 0x00, 0xc2, 0x36,
+                                       0x6e, 0x59, 0x6e, 0x59, 0x6e, 0x59, 0x6e, 0x59,
+                                       0x00, 0x85, 0x00, 0x85, 0x00, 0x85, 0x00, 0x85,
+                                       0x00, 0x85, 0x00, 0x85, 0x00, 0x85, 0x00, 0x85,
+                               0x00, 0x00, 0x17, 0x2e,
+                                       0x22, 0x45, 0x22, 0x45, 0x22, 0x45, 0x22, 0x45,
+                                       0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70,
+                                       0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2447 MHz */
+                       0x8f, 0x09,
+                               0x10, 0x01, 0x75, 0x83,
+                                       0x61, 0x8a, 0x61, 0x8a, 0x61, 0x8a, 0x61, 0x8a,
+                                       0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5,
+                                       0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5,
+                               0xf0, 0x00, 0x4b, 0x6c,
+                                       0x3f, 0x82, 0x3f, 0x82, 0x3f, 0x82, 0x3f, 0x82,
+                                       0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad,
+                                       0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad,
+                               0xd0, 0x00, 0xda, 0x5a,
+                                       0x1c, 0x7a, 0x1c, 0x7a, 0x1c, 0x7a, 0x1c, 0x7a,
+                                       0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5,
+                                       0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5,
+                               0xa0, 0x00, 0x6d, 0x48,
+                                       0xe9, 0x6d, 0xe9, 0x6d, 0xe9, 0x6d, 0xe9, 0x6d,
+                                       0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99,
+                                       0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99,
+                               0x50, 0x00, 0xc6, 0x36,
+                                       0x92, 0x59, 0x92, 0x59, 0x92, 0x59, 0x92, 0x59,
+                                       0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                                       0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                               0x00, 0x00, 0x15, 0x2e,
+                                       0x3c, 0x45, 0x3c, 0x45, 0x3c, 0x45, 0x3c, 0x45,
+                                       0xce, 0x70, 0xce, 0x70, 0xce, 0x70, 0xce, 0x70,
+                                       0xce, 0x70, 0xce, 0x70, 0xce, 0x70, 0xce, 0x70,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2452 MHz */
+                       0x94, 0x09,
+                               0x10, 0x01, 0xf4, 0x84,
+                                       0x9e, 0x8a, 0x9e, 0x8a, 0x9e, 0x8a, 0x9e, 0x8a,
+                                       0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6,
+                                       0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6,
+                               0xf0, 0x00, 0x34, 0x6d,
+                                       0x77, 0x82, 0x77, 0x82, 0x77, 0x82, 0x77, 0x82,
+                                       0x09, 0xae, 0x09, 0xae, 0x09, 0xae, 0x09, 0xae,
+                                       0x09, 0xae, 0x09, 0xae, 0x09, 0xae, 0x09, 0xae,
+                               0xd0, 0x00, 0x62, 0x5b,
+                                       0x50, 0x7a, 0x50, 0x7a, 0x50, 0x7a, 0x50, 0x7a,
+                                       0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5,
+                                       0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5,
+                               0xa0, 0x00, 0xa2, 0x48,
+                                       0x17, 0x6e, 0x17, 0x6e, 0x17, 0x6e, 0x17, 0x6e,
+                                       0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99,
+                                       0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99,
+                               0x50, 0x00, 0xc9, 0x36,
+                                       0xb7, 0x59, 0xb7, 0x59, 0xb7, 0x59, 0xb7, 0x59,
+                                       0x49, 0x85, 0x49, 0x85, 0x49, 0x85, 0x49, 0x85,
+                                       0x49, 0x85, 0x49, 0x85, 0x49, 0x85, 0x49, 0x85,
+                               0x00, 0x00, 0x12, 0x2e,
+                                       0x57, 0x45, 0x57, 0x45, 0x57, 0x45, 0x57, 0x45,
+                                       0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70,
+                                       0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2452 MHz */
+                       0x99, 0x09,
+                               0x10, 0x01, 0x74, 0x86,
+                                       0xdb, 0x8a, 0xdb, 0x8a, 0xdb, 0x8a, 0xdb, 0x8a,
+                                       0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6,
+                                       0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6,
+                               0xf0, 0x00, 0x1e, 0x6e,
+                                       0xb0, 0x82, 0xb0, 0x82, 0xb0, 0x82, 0xb0, 0x82,
+                                       0x42, 0xae, 0x42, 0xae, 0x42, 0xae, 0x42, 0xae,
+                                       0x42, 0xae, 0x42, 0xae, 0x42, 0xae, 0x42, 0xae,
+                               0xd0, 0x00, 0xeb, 0x5b,
+                                       0x85, 0x7a, 0x85, 0x7a, 0x85, 0x7a, 0x85, 0x7a,
+                                       0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6,
+                                       0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6,
+                               0xa0, 0x00, 0xd8, 0x48,
+                                       0x46, 0x6e, 0x46, 0x6e, 0x46, 0x6e, 0x46, 0x6e,
+                                       0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99,
+                                       0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99,
+                               0x50, 0x00, 0xcd, 0x36,
+                                       0xdb, 0x59, 0xdb, 0x59, 0xdb, 0x59, 0xdb, 0x59,
+                                       0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85,
+                                       0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85,
+                               0x00, 0x00, 0x10, 0x2e,
+                                       0x71, 0x45, 0x71, 0x45, 0x71, 0x45, 0x71, 0x45,
+                                       0x03, 0x71, 0x03, 0x71, 0x03, 0x71, 0x03, 0x71,
+                                       0x03, 0x71, 0x03, 0x71, 0x03, 0x71, 0x03, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2557 MHz */
+                       0x9e, 0x09,
+                               0x10, 0x01, 0xf3, 0x87,
+                                       0x17, 0x8b, 0x17, 0x8b, 0x17, 0x8b, 0x17, 0x8b,
+                                       0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6,
+                                       0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6,
+                               0xf0, 0x00, 0x07, 0x6f,
+                                       0xe9, 0x82, 0xe9, 0x82, 0xe9, 0x82, 0xe9, 0x82,
+                                       0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae,
+                                       0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae,
+                               0xd0, 0x00, 0x73, 0x5c,
+                                       0xba, 0x7a, 0xba, 0x7a, 0xba, 0x7a, 0xba, 0x7a,
+                                       0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6,
+                                       0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6,
+                               0xa0, 0x00, 0x0d, 0x49,
+                                       0x74, 0x6e, 0x74, 0x6e, 0x74, 0x6e, 0x74, 0x6e,
+                                       0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a,
+                                       0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a,
+                               0x50, 0x00, 0xd1, 0x36,
+                                       0xff, 0x59, 0xff, 0x59, 0xff, 0x59, 0xff, 0x59,
+                                       0x91, 0x85, 0x91, 0x85, 0x91, 0x85, 0x91, 0x85,
+                                       0x91, 0x85, 0x91, 0x85, 0x91, 0x85, 0x91, 0x85,
+                               0x00, 0x00, 0x0e, 0x2e,
+                                       0x8b, 0x45, 0x8b, 0x45, 0x8b, 0x45, 0x8b, 0x45,
+                                       0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71,
+                                       0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2562 MHz */
+                       0xa3, 0x09,
+                               0x10, 0x01, 0x72, 0x89,
+                                       0x54, 0x8b, 0x54, 0x8b, 0x54, 0x8b, 0x54, 0x8b,
+                                       0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6,
+                                       0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6,
+                               0xf0, 0x00, 0xf0, 0x6f,
+                                       0x21, 0x83, 0x21, 0x83, 0x21, 0x83, 0x21, 0x83,
+                                       0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae,
+                                       0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae,
+                               0xd0, 0x00, 0xfb, 0x5c,
+                                       0xee, 0x7a, 0xee, 0x7a, 0xee, 0x7a, 0xee, 0x7a,
+                                       0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6,
+                                       0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6,
+                               0xa0, 0x00, 0x43, 0x49,
+                                       0xa3, 0x6e, 0xa3, 0x6e, 0xa3, 0x6e, 0xa3, 0x6e,
+                                       0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a,
+                                       0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a,
+                               0x50, 0x00, 0xd4, 0x36,
+                                       0x24, 0x5a, 0x24, 0x5a, 0x24, 0x5a, 0x24, 0x5a,
+                                       0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85,
+                                       0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85,
+                               0x00, 0x00, 0x0b, 0x2e,
+                                       0xa6, 0x45, 0xa6, 0x45, 0xa6, 0x45, 0xa6, 0x45,
+                                       0x38, 0x71, 0x38, 0x71, 0x38, 0x71, 0x38, 0x71,
+                                       0x38, 0x71, 0x38, 0x71, 0x38, 0x71, 0x38, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+                       /* 2572 MHz */
+                       0xa8, 0x09,
+                               0x10, 0x01, 0xf1, 0x8a,
+                                       0x91, 0x8b, 0x91, 0x8b, 0x91, 0x8b, 0x91, 0x8b,
+                                       0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7,
+                                       0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7,
+                               0xf0, 0x00, 0xd9, 0x70,
+                                       0x5a, 0x83, 0x5a, 0x83, 0x5a, 0x83, 0x5a, 0x83,
+                                       0xec, 0xae, 0xec, 0xae, 0xec, 0xae, 0xec, 0xae,
+                                       0xec, 0xae, 0xec, 0xae, 0xec, 0xae, 0xec, 0xae,
+                               0xd0, 0x00, 0x83, 0x5d,
+                                       0x23, 0x7b, 0x23, 0x7b, 0x23, 0x7b, 0x23, 0x7b,
+                                       0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6,
+                                       0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6,
+                               0xa0, 0x00, 0x78, 0x49,
+                                       0xd1, 0x6e, 0xd1, 0x6e, 0xd1, 0x6e, 0xd1, 0x6e,
+                                       0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a,
+                                       0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a,
+                               0x50, 0x00, 0xd8, 0x36,
+                                       0x48, 0x5a, 0x48, 0x5a, 0x48, 0x5a, 0x48, 0x5a,
+                                       0xda, 0x85, 0xda, 0x85, 0xda, 0x85, 0xda, 0x85,
+                                       0xda, 0x85, 0xda, 0x85, 0xda, 0x85, 0xda, 0x85,
+                               0x00, 0x00, 0x09, 0x2e,
+                                       0xc0, 0x45, 0xc0, 0x45, 0xc0, 0x45, 0xc0, 0x45,
+                                       0x52, 0x71, 0x52, 0x71, 0x52, 0x71, 0x52, 0x71,
+                                       0x52, 0x71, 0x52, 0x71, 0x52, 0x71, 0x52, 0x71,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x80, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00,
+                                       0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+};
+
+/*
+ * Not really sure if this is actually the power_limit database,
+ * it looks a bit "related" to PDR_PRISM_ZIF_TX_IQ_CALIBRATION
+ */
+static const uint8_t template_pa_cal_output_power_limits[] = {
+       /* struct pda_custom_wrapper */
+       0xae, 0x00, 0xef, 0xbe,      /* PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM */
+               0x0d, 0x00, 0x1a, 0x00,         /* 13 entries, 26 bytes per entry */
+               0x00, 0x00, 0x52, 0x01,         /* no offset, 338 bytes total */
+
+                       /* 2412 MHz */
+                       0x6c, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2417 MHz */
+                       0x71, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2422 MHz */
+                       0x76, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2427 MHz */
+                       0x7b, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2432 MHz */
+                       0x80, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2437 MHz */
+                       0x85, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2442 MHz */
+                       0x8a, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2447 MHz */
+                       0x8f, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2452 MHz */
+                       0x94, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2457 MHz */
+                       0x99, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2462 MHz */
+                       0x9e, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2467 MHz */
+                       0xa3, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+                       /* 2472 MHz */
+                       0xa8, 0x09,
+                               0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                               0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                               0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+};
+
+static const uint8_t template_pda_iq_autocal[] = {
+       /* struct pda_iq_autocal_entry[13] */
+       0x42, 0x00, 0x06, 0x19,         /* PDR_PRISM_ZIF_TX_IQ_CALIBRATION */
+               /* 2412 MHz */
+               0x6c, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2417 MHz */
+               0x71, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2422 MHz */
+               0x76, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2427 MHz */
+               0x7b, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2432 MHz */
+               0x80, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2437 MHz */
+               0x85, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2442 MHz */
+               0x8a, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2447 MHz */
+               0x8f, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2452 MHz */
+               0x94, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+               /* 2457 MHz */
+               0x99, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+               /* 2462 MHz */
+               0x9e, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+               /* 2467 MHz */
+               0xa3, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+               /* 2472 MHz */
+               0xa8, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+};
+
+static const uint8_t template_pdr_end[] = {
+       0x02, 0x00, 0x00, 0x00,         /* PDR_END */
+};
+
+/*     linux/lib/crc-ccitt.c
+ *
+ * This mysterious table is just the CRC of each possible byte. It can be
+ * computed using the standard bit-at-a-time methods. The polynomial can
+ * be seen in entry 128, 0x8408. This corresponds to x^0 + x^5 + x^12.
+ * Add the implicit x^16, and you have the standard CRC-CCITT.
+ */
+static uint16_t const crc_ccitt_table[256] = {
+       0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
+       0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
+       0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
+       0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
+       0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
+       0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
+       0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
+       0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
+       0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
+       0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
+       0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
+       0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
+       0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
+       0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
+       0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
+       0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
+       0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
+       0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
+       0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
+       0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
+       0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
+       0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
+       0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
+       0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
+       0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
+       0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
+       0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
+       0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
+       0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
+       0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
+       0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
+       0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
+};
+
+static inline uint16_t crc_ccitt_byte(uint16_t crc, const uint8_t c)
+{
+       return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
+}
+
+static uint16_t crc_ccitt(uint16_t crc, uint8_t const *buffer, size_t len)
+{
+       while (len--)
+               crc = crc_ccitt_byte(crc, *buffer++);
+       return crc;
+}
+
+static int generate_pa_cal_curve(uint8_t *buffer,
+                                const uint8_t *txgen_image,
+                                size_t txgen_image_size)
+{
+       memcpy(buffer, template_pa_cal_curve, sizeof(template_pa_cal_curve));
+
+       //TODO
+
+       return 0;
+}
+
+static int generate_iq_autocal(uint8_t *buffer,
+                              const uint8_t *iqalign_image,
+                              size_t iqalign_image_size)
+{
+       unsigned int expected_size;
+       uint8_t *out;
+       const uint8_t *in;
+       unsigned int i;
+
+       expected_size = 13 * 8 + 4;
+       if (iqalign_image_size != expected_size) {
+               fprintf(stderr, "ERROR: Unknown wlan-iq-align image size. "
+                       "Got %u, but expected %u\n",
+                       (unsigned int)iqalign_image_size, expected_size);
+               return -EINVAL;
+       }
+
+       in = iqalign_image;
+       out = buffer;
+
+       memcpy(out, template_pda_iq_autocal, sizeof(template_pda_iq_autocal));
+
+       in += 4;        /* Skip zero padding */
+       out += 4;       /* Skip header */
+       for (i = 0; i < 13; i++) {
+               out += 2;       /* Skip little endian 16bit Mhz number */
+               memcpy(out, in, 8);
+               out += 8;       /* Next element */
+               in += 8;        /* Next element */
+       }
+
+       return 0;
+}
+
+static int generate_eeprom(FILE *outstream,
+                          const uint8_t *txgen_image,
+                          size_t txgen_image_size,
+                          const uint8_t *iqalign_image,
+                          size_t iqalign_image_size)
+{
+       int err, res = 0;
+       uint16_t crc = ~0;
+       uint8_t crc_buf[2];
+       uint8_t gen_pda_iq_autocal[sizeof(template_pda_iq_autocal)];
+       uint8_t gen_pa_cal_curve[sizeof(template_pa_cal_curve)];
+
+       err = generate_iq_autocal(gen_pda_iq_autocal,
+                                 iqalign_image, iqalign_image_size);
+       if (err)
+               return err;
+       err = generate_pa_cal_curve(gen_pa_cal_curve,
+                                   txgen_image, txgen_image_size);
+       if (err)
+               return err;
+
+#define writebuf(buffer, do_crc) do {                                          \
+               if (do_crc)                                                     \
+                       crc = crc_ccitt(crc, buffer, sizeof(buffer));           \
+               res = fwrite(buffer, sizeof(buffer), 1, outstream);             \
+               if (res != 1) {                                                 \
+                       fprintf(stderr, "Failed to write output data\n");       \
+                       return -EIO;                                            \
+               }                                                               \
+       } while (0)
+
+       writebuf(template_eeprom_pda_wrap, 0);
+       writebuf(template_mac_address, 1);
+       writebuf(template_bootrec_exp_if, 1);
+       writebuf(template_pda_country_list, 1);
+       writebuf(template_pda_country, 1);
+       writebuf(template_antenna_gain, 1);
+       writebuf(template_rssi_linear_approx_custom2, 1);
+       writebuf(gen_pa_cal_curve, 1);
+       writebuf(template_pa_cal_output_power_limits, 1);
+       writebuf(gen_pda_iq_autocal, 1);
+       writebuf(template_pdr_end, 1);
+
+       crc = ~crc;
+       crc_buf[0] = crc & 0xFF;
+       crc_buf[1] = (crc >> 8) & 0xFF;
+       res = fwrite(crc_buf, sizeof(crc_buf), 1, outstream);
+       if (res != 1) {
+               fprintf(stderr, "Failed to write CRC\n");
+               return -EIO;
+       }
+
+       return 0;
+}
+
+static void * map_file(const char *filepath, int readonly,
+                      uint64_t *filelen)
+{
+       int fd;
+       off_t len;
+       void *data;
+
+       fd = open(filepath, readonly ? O_RDONLY : O_RDWR);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open file %s: %s\n",
+                       filepath, strerror(errno));
+               return NULL;
+       }
+       len = lseek(fd, 0, SEEK_END);
+       if (len < 0 || lseek(fd, 0, SEEK_SET)) {
+               fprintf(stderr, "Failed to calculate file length of %s: %s\n",
+                       filepath, strerror(errno));
+               close(fd);
+               return NULL;
+       }
+
+       data = mmap(NULL, len,
+                   readonly ? PROT_READ : (PROT_READ | PROT_WRITE),
+                   readonly ? MAP_PRIVATE : 0,
+                   fd, 0);
+       close(fd);
+       if (data == MAP_FAILED) {
+               fprintf(stderr, "Failed to MMAP file %s: %s\n",
+                       filepath, strerror(errno));
+               return NULL;
+       }
+       madvise(data, len, MADV_SEQUENTIAL);
+
+       *filelen = len;
+
+       return data;
+}
+
+static void unmap_file(void *mapping, uint64_t len)
+{
+       if (mapping)
+               munmap(mapping, len);
+}
+
+static void usage(FILE *fd)
+{
+       fprintf(fd, "cal2p54 - CAL to p54spi EEPROM converter\n");
+       fprintf(fd, "\n");
+       fprintf(fd, "Usage: cal2p54 WLAN-TX-GEN2-IMAGE WLAN-IQ-ALIGN-IMAGE\n");
+}
+
+int main(int argc, char **argv)
+{
+       int err, ret = 0;
+       uint8_t *txgen_image = NULL;
+       uint64_t txgen_image_len = 0;
+       uint8_t *iqalign_image = NULL;
+       uint64_t iqalign_image_len = 0;
+
+       const char *txgen_filepath;
+       const char *iqalign_filepath;
+
+       if (argc != 3) {
+               usage(stderr);
+               return 1;
+       }
+       txgen_filepath = argv[1];
+       iqalign_filepath = argv[2];
+
+       txgen_image = map_file(txgen_filepath, 1, &txgen_image_len);
+       iqalign_image = map_file(iqalign_filepath, 1, &iqalign_image_len);
+       if (!txgen_image || !iqalign_image) {
+               ret = 1;
+               goto out;
+       }
+
+       err = generate_eeprom(stdout, txgen_image, txgen_image_len,
+                             iqalign_image, iqalign_image_len);
+       if (err) {
+               ret = 1;
+               goto out;
+       }
+
+out:
+       unmap_file(txgen_image, txgen_image_len);
+       unmap_file(iqalign_image, iqalign_image_len);
+
+       return ret;
+}
diff --git a/utils/calvaria/files/src/calvaria.c b/utils/calvaria/files/src/calvaria.c
new file mode 100644 (file)
index 0000000..2438e34
--- /dev/null
@@ -0,0 +1,514 @@
+/*
+ * Calvaria - Maemo CAL partition variable access tool.
+ *
+ * Copyright (c) 2011 Michael Buesch <mb@bu3sch.de>
+ *
+ * Licensed under the GNU General Public License version 2.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdint.h>
+#include <sys/mman.h>
+
+
+#define _packed                __attribute__((__packed__))
+
+typedef uint16_t le16_t;
+typedef uint32_t le32_t;
+
+struct header {
+       char magic[4];          /* Magic sequence */
+       uint8_t type;           /* Type number */
+       uint8_t index;          /* Index number */
+       le16_t flags;           /* Flags */
+       char name[16];          /* Human readable section name */
+       le32_t length;          /* Payload length */
+       le32_t datasum;         /* Data CRC32 checksum */
+       le32_t hdrsum;          /* Header CRC32 checksum */
+} _packed;
+
+#define HDR_MAGIC      "ConF"
+
+#define INDEX_LAST     (0xFF + 1)
+
+
+static char toAscii(char c)
+{
+       if (c >= 32 && c <= 126)
+               return c;
+       return '.';
+}
+
+static void dump_bytes(FILE *outstream, const void *_buf, size_t size)
+{
+       const char *buf = _buf;
+       size_t i, ascii_cnt = 0;
+       char ascii[17] = { 0, };
+
+       for (i = 0; i < size; i++) {
+               if (i % 16 == 0) {
+                       if (i != 0) {
+                               fprintf(outstream, "  |%s|\n", ascii);
+                               ascii[0] = 0;
+                               ascii_cnt = 0;
+                       }
+                       fprintf(outstream, "[%04X]: ", (unsigned int)i);
+               }
+               fprintf(outstream, " %02X", buf[i] & 0xFF);
+               ascii[ascii_cnt] = toAscii(buf[i]);
+               ascii[ascii_cnt + 1] = 0;
+               ascii_cnt++;
+       }
+       if (ascii[0]) {
+               if (size % 16) {
+                       for (i = 0; i < 16 - (size % 16); i++)
+                               fprintf(outstream, "   ");
+               }
+               fprintf(outstream, "  |%s|\n", ascii);
+       }
+}
+
+static uint32_t crc32(uint32_t crc, const void *_data, size_t size)
+{
+       const uint8_t *data = _data;
+       uint8_t value;
+       unsigned int bit;
+       size_t i;
+       const uint32_t poly = 0xEDB88320;
+
+       for (i = 0; i < size; i++) {
+               value = data[i];
+               for (bit = 8; bit; bit--) {
+                       if ((crc & 1) != (value & 1))
+                               crc = (crc >> 1) ^ poly;
+                       else
+                               crc >>= 1;
+                       value >>= 1;
+               }
+       }
+
+       return crc;
+}
+
+static inline uint16_t le16_to_cpu(le16_t x)
+{
+       uint8_t *bytes = (uint8_t *)&x;
+       uint16_t ret;
+
+       ret = bytes[0];
+       ret |= (uint16_t)(bytes[1]) << 8;
+
+       return ret;
+}
+
+static inline uint32_t le32_to_cpu(le32_t x)
+{
+       uint8_t *bytes = (uint8_t *)&x;
+       uint32_t ret;
+
+       ret = bytes[0];
+       ret |= (uint32_t)(bytes[1]) << 8;
+       ret |= (uint32_t)(bytes[2]) << 16;
+       ret |= (uint32_t)(bytes[3]) << 24;
+
+       return ret;
+}
+
+static int is_header(void *data, size_t size)
+{
+       struct header *hdr = data;
+
+       if (size < sizeof(struct header))
+               return 0;
+       if (memcmp(hdr->magic, HDR_MAGIC, sizeof(hdr->magic)) != 0)
+               return 0;
+       return 1;
+}
+
+void dump_bme_payload(FILE *outstream, const void *payload, size_t len)
+{
+       const uint8_t *pmm_area = payload;
+       unsigned int group, element, pmm_offset;
+       uint8_t active_group_mask;
+       static const uint8_t zero_element[16] = { 0, };
+
+       if (len != 0x600 || memcmp(payload, "BME-PMM-BLOCK01", 15) != 0) {
+               fprintf(outstream, "ERROR: The section payload is not "
+                       "a BME PMM block\n");
+               return;
+       }
+
+       active_group_mask = pmm_area[16];
+
+       for (group = 0; group < 3; group++) {
+               for (element = 0; element < 32; element++) {
+                       pmm_offset = group * 512 + element * 16;
+                       if (memcmp(pmm_area + pmm_offset, zero_element, 16) == 0)
+                               continue;
+                       fprintf(outstream, "-- BME-PMM area -- group %u%s, element %u:\n",
+                               group,
+                               (active_group_mask & (1 << group)) ? "" : " (INACTIVE)",
+                               element);
+                       dump_bytes(outstream, pmm_area + pmm_offset, 16);
+               }
+       }
+}
+
+typedef void (*payload_dumper_t)(FILE *, const void *payload, size_t len);
+
+static payload_dumper_t get_payload_dumper(const char *section_name, int raw)
+{
+       if (!raw) {
+               if (strcmp(section_name, "bme") == 0)
+                       return dump_bme_payload;
+       }
+
+       return dump_bytes;
+}
+
+static int dump_section(const struct header *hdr,
+                       const void *payload, size_t payload_len,
+                       int dump_payload,
+                       int dump_raw_payload,
+                       FILE *outstream)
+{
+       char name[sizeof(hdr->name) + 1] = { 0, };
+       int hdrsum_ok, datasum_ok;
+       payload_dumper_t dumper;
+
+       memcpy(name, hdr->name, sizeof(hdr->name));
+       hdrsum_ok = (crc32(0, hdr, sizeof(*hdr) - 4) == le32_to_cpu(hdr->hdrsum));
+       datasum_ok = (crc32(0, payload, payload_len) == le32_to_cpu(hdr->datasum));
+
+       fprintf(outstream, "Section:       %s\n", name);
+       fprintf(outstream, "Type:          %u (0x%X)\n", hdr->type, hdr->type);
+       fprintf(outstream, "Index:         %u (0x%X)\n", hdr->index, hdr->index);
+       fprintf(outstream, "Flags:         0x%04X\n", le16_to_cpu(hdr->flags));
+       fprintf(outstream, "Length:        %u (0x%X)\n",
+               le32_to_cpu(hdr->length), le32_to_cpu(hdr->length));
+       fprintf(outstream, "Data CRC32:    0x%08X (%s)\n", le32_to_cpu(hdr->datasum),
+               datasum_ok ? "Ok" : "MISMATCH");
+       fprintf(outstream, "Header CRC32:  0x%08X (%s)\n", le32_to_cpu(hdr->hdrsum),
+               hdrsum_ok ? "Ok" : "MISMATCH");
+       if (dump_payload) {
+               dumper = get_payload_dumper(name, dump_raw_payload);
+               dumper(outstream, payload, payload_len);
+       }
+       fprintf(outstream, "\n");
+
+       return 0;
+}
+
+static void * map_file(const char *filepath, int readonly,
+                      uint64_t *filelen)
+{
+       int fd;
+       off_t len;
+       void *data;
+
+       fd = open(filepath, readonly ? O_RDONLY : O_RDWR);
+       if (fd < 0) {
+               fprintf(stderr, "Failed to open file %s: %s\n",
+                       filepath, strerror(errno));
+               return NULL;
+       }
+       len = lseek(fd, 0, SEEK_END);
+       if (len < 0 || lseek(fd, 0, SEEK_SET)) {
+               fprintf(stderr, "Failed to calculate file length of %s: %s\n",
+                       filepath, strerror(errno));
+               close(fd);
+               return NULL;
+       }
+
+       data = mmap(NULL, len,
+                   readonly ? PROT_READ : (PROT_READ | PROT_WRITE),
+                   readonly ? MAP_PRIVATE : 0,
+                   fd, 0);
+       close(fd);
+       if (data == MAP_FAILED) {
+               fprintf(stderr, "Failed to MMAP file %s: %s\n",
+                       filepath, strerror(errno));
+               return NULL;
+       }
+       madvise(data, len, MADV_SEQUENTIAL);
+
+       *filelen = len;
+
+       return data;
+}
+
+static void unmap_file(void *mapping, uint64_t len)
+{
+       if (mapping)
+               munmap(mapping, len);
+}
+
+static int64_t find_section(void *start, uint64_t count,
+                           int want_index, const char *want_name)
+{
+       int64_t offset = 0, found_offset = -1;
+       uint8_t *data = start;
+       struct header *hdr;
+       char sectname[sizeof(hdr->name) + 1] = { 0, };
+       uint32_t payload_len;
+       int previous_index = -1;
+
+       while (1) {
+               /* Find header start */
+               if (count < sizeof(struct header))
+                       break;
+               if (!is_header(data + offset, count)) {
+                       count--;
+                       offset++;
+                       continue;
+               }
+               hdr = (struct header *)(data + offset);
+               payload_len = le32_to_cpu(hdr->length);
+               if (count - sizeof(struct header) < payload_len) {
+                       fprintf(stderr, "Premature EOF\n");
+                       return -1;
+               }
+               memcpy(sectname, hdr->name, sizeof(hdr->name));
+
+               if (want_index == INDEX_LAST) {
+                       if ((int)hdr->index <= previous_index)
+                               goto next;
+               } else {
+                       if (want_index >= 0 && want_index != hdr->index)
+                               goto next;
+               }
+               if (want_name && strcmp(sectname, want_name) != 0)
+                       goto next;
+
+               /* Found it */
+               found_offset = offset;
+               if (want_index == INDEX_LAST)
+                       previous_index = hdr->index;
+               else
+                       break;
+
+next:
+               count -= sizeof(struct header) + payload_len;
+               offset += sizeof(struct header) + payload_len;
+       }
+
+       return found_offset;
+}
+
+static int dump_image(const char *filepath,
+                     int want_section_index, const char *want_section_name,
+                     int want_headers_only,
+                     int dump_raw_payload,
+                     FILE *outstream)
+{
+       int err, ret = 0;
+       uint64_t filelen;
+       uint64_t count, offset;
+       int64_t find_offset;
+       uint8_t *data, *section;
+       struct header *hdr;
+       uint32_t payload_len;
+
+       data = map_file(filepath, 1, &filelen);
+       if (!data)
+               return -EIO;
+
+       count = filelen;
+       offset = 0;
+       while (1) {
+               find_offset = find_section(data + offset, count,
+                                          want_section_index, want_section_name);
+               if (find_offset < 0)
+                       break;
+               offset += find_offset;
+               count -= find_offset;
+
+               section = data + offset;
+               hdr = (struct header *)section;
+               payload_len = le32_to_cpu(hdr->length);
+
+               err = dump_section(hdr, section + sizeof(struct header),
+                                  payload_len,
+                                  !want_headers_only,
+                                  dump_raw_payload,
+                                  outstream);
+               if (err) {
+                       ret = err;
+                       goto out;
+               }
+
+               count -= sizeof(struct header) + payload_len;
+               offset += sizeof(struct header) + payload_len;
+       }
+out:
+       unmap_file(data, filelen);
+
+       return ret;
+}
+
+static int write_payload(const char *filepath,
+                        int want_section_index, const char *want_section_name,
+                        FILE *outstream)
+{
+       int64_t find_offset;
+       uint64_t filelen;
+       uint8_t *data;
+       struct header *hdr;
+
+       data = map_file(filepath, 1, &filelen);
+       if (!data)
+               return -EIO;
+
+       find_offset = find_section(data, filelen,
+                                  want_section_index, want_section_name);
+       if (find_offset < 0) {
+               fprintf(stderr, "Section %s, index %d not found\n",
+                       want_section_name, want_section_index);
+               unmap_file(data, filelen);
+               return -ESRCH;
+       }
+
+       hdr = (struct header *)(data + find_offset);
+       if (fwrite(data + find_offset + sizeof(struct header),
+                  le32_to_cpu(hdr->length), 1, outstream) != 1) {
+               fprintf(stderr, "Could not write output data\n");
+               unmap_file(data, filelen);
+               return -EIO;
+       }
+
+       unmap_file(data, filelen);
+
+       return 0;
+}
+
+static void usage(FILE *fd)
+{
+       fprintf(fd, "Calvaria - Maemo CAL partition variable access tool\n");
+       fprintf(fd, "\n");
+       fprintf(fd, "Usage: calvaria [OPTIONS] FILE\n");
+       fprintf(fd, "\n");
+       fprintf(fd, "Actions:\n");
+       fprintf(fd, "  -d|--dump            Dump the contents of the image\n");
+       fprintf(fd, "  -H|--headers         Dump the headers of the image, only\n");
+       fprintf(fd, "  -p|--payload         Write the binary payload to stdout.\n");
+       fprintf(fd, "                       Requires -i and -n to be set, too\n");
+       fprintf(fd, "\n");
+       fprintf(fd, "Options:\n");
+       fprintf(fd, "  -i|--index NUMBER    Use this section index number\n");
+       fprintf(fd, "  -n|--name STRING     Use this section name\n");
+       fprintf(fd, "  -r|--raw             Dump raw data (for -d|--dump only)\n");
+       fprintf(fd, "\n");
+       fprintf(fd, "  -h|--help            Print this help text\n");
+}
+
+enum action {
+       ACTION_NONE,
+       ACTION_DUMP,
+       ACTION_DUMPHDRS,
+       ACTION_GETPAYLOAD,
+};
+
+int main(int argc, char **argv)
+{
+       int err, c, idx = 0;
+       const char *filepath;
+       enum action action = ACTION_NONE;
+       int opt_index = -1;
+       const char *opt_name = NULL;
+       int opt_raw_payload = 0;
+
+       static struct option long_options[] = {
+               { "dump", no_argument, 0, 'd', },
+               { "headers", no_argument, 0, 'H', },
+               { "payload", no_argument, 0, 'p', },
+               { "index", required_argument, 0, 'i', },
+               { "name", required_argument, 0, 'n', },
+               { "raw", no_argument, 0, 'r', },
+               { "help", no_argument, 0, 'h', },
+               { },
+       };
+
+       while (1) {
+               c = getopt_long(argc, argv, "dHphi:n:r",
+                               long_options, &idx);
+               if (c == -1)
+                       break;
+               switch (c) {
+               case 'h':
+                       usage(stdout);
+                       return 0;
+               case 'd':
+                       action = ACTION_DUMP;
+                       break;
+               case 'H':
+                       action = ACTION_DUMPHDRS;
+                       break;
+               case 'p':
+                       action = ACTION_GETPAYLOAD;
+                       break;
+               case 'i':
+                       if (strcasecmp(optarg, "last") == 0) {
+                               opt_index = INDEX_LAST;
+                       } else {
+                               if (sscanf(optarg, "%d", &opt_index) != 1 || opt_index < 0) {
+                                       fprintf(stderr, "-i|--index is not a positive integer\n");
+                                       return 1;
+                               }
+                       }
+                       break;
+               case 'n':
+                       opt_name = optarg;
+                       break;
+               case 'r':
+                       opt_raw_payload = 1;
+                       break;
+               default:
+                       return 1;
+               }
+       }
+       argc -= optind;
+       argv += optind;
+       if (action == ACTION_NONE) {
+               fprintf(stderr, "No action specified.\n");
+               return 1;
+       }
+       if (action == ACTION_GETPAYLOAD) {
+               if (opt_index < 0 || !opt_name) {
+                       fprintf(stderr, "Required options -i|--index or -n|--name "
+                               "not specified for action -p|--payload\n");
+                       return 1;
+               }
+       }
+       if (argc != 1) {
+               usage(stderr);
+               return 1;
+       }
+       filepath = argv[0];
+
+       switch (action) {
+       case ACTION_NONE:
+               break;
+       case ACTION_DUMP:
+       case ACTION_DUMPHDRS:
+               err = dump_image(filepath, opt_index, opt_name,
+                                (action == ACTION_DUMPHDRS),
+                                opt_raw_payload,
+                                stdout);
+               if (err)
+                       return 1;
+               break;
+       case ACTION_GETPAYLOAD:
+               err = write_payload(filepath, opt_index, opt_name, stdout);
+               if (err)
+                       return 1;
+               break;
+       }
+
+       return 0;
+}
diff --git a/utils/canutils/Makefile b/utils/canutils/Makefile
new file mode 100644 (file)
index 0000000..7fd2295
--- /dev/null
@@ -0,0 +1,116 @@
+#
+# Copyright (C) 2013 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:=canutils
+PKG_VERSION:=2014-02-27
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://gitorious.org/linux-can/can-utils.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=67a2bdcd336e6becfa5784742e18c88dbeddc973
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+FILES:=        canbusload can-calc-bit-timing candump \
+       cangen cangw canplayer cansniffer cansend
+
+
+define Package/canutils-log-conversion
+  TITLE:=canutils log conversion
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=canutils
+endef
+
+define PartGen
+define Package/canutils-$(1)
+  TITLE:=$(1) package from canutils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=canutils
+endef
+endef
+
+define Package/canutils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL=https://gitorious.org/linux-can
+  TITLE:=CAN userspace utilities and tools
+  MENU:=1
+endef
+
+define Build/Configure
+       ( cd "$(PKG_BUILD_DIR)"; ./autogen.sh )
+       $(call Build/Configure/Default)
+endef
+
+$(foreach file,$(FILES),$(eval $(call PartGen,$(file))))
+
+define Package/canutils/install
+       true
+endef
+
+define Package/canutils-log-conversion/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/asc2log $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2asc $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2long $(1)/usr/bin/
+endef
+
+define PartInstall
+define Package/canutils-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_BUILD_DIR)/$(1) \
+               $$(1)/usr/bin/
+endef
+endef
+
+define Package/canutils-log-conversion/description
+asc2log - convert ASC logfile to compact CAN frame logfile.
+log2asc - convert compact CAN frame logfile to ASC logfile.
+log2long - convert compact CAN frame representation into user readable.
+endef
+
+define Package/canutils-canbusload/description
+canbusload - display the load percentage of can buses.
+endef
+
+define Package/canutils-can-calc-bit-timing/description
+can-calc-bit-timing - calculate hw bittiming for supported can chips.
+endef
+
+define Package/canutils-candump/description
+candump - dumps can frames to terminal, logfile or another can device,
+with optional filtering.
+endef
+
+define Package/canutils-cangen/description
+cangen - CAN frames generator for testing purposes.
+endef
+
+define Package/canutils-cangw/description
+cangw - manage PF_CAN netlink gateway.
+endef
+
+define Package/canutils-canplayer/description
+canplayer - replay a compact CAN frame logfile to CAN devices.
+endef
+
+define Package/canutils-cansend/description
+cansend - simple command line tool to send CAN-frames via CAN_RAW sockets.
+endef
+
+$(foreach file,$(FILES),$(eval $(call PartInstall,$(file))))
+
+$(eval $(call BuildPackage,canutils))
+$(eval $(call BuildPackage,canutils-log-conversion))
+$(foreach file,$(FILES),$(eval $(call BuildPackage,canutils-$(file))))
diff --git a/utils/cdparanoia/Makefile b/utils/cdparanoia/Makefile
new file mode 100644 (file)
index 0000000..046e1b3
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2010 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:=cdparanoia-III
+PKG_VERSION:=10.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tgz
+PKG_SOURCE_URL:=http://downloads.xiph.org/releases/cdparanoia/
+PKG_SOURCE_TARGETDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_MD5SUM:=b304bbe8ab63373924a744eac9ebc652
+
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cdparanoia
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Cdparanoia
+  DEPENDS:=+librt
+  URL:=http://www.xiph.org/paranoia/index.html
+endef
+
+#define Build/Configure
+#      echo "Build/Configure"
+#        $(call Build/Configure/Default)
+#endef
+
+#define Build/Compile
+#endef
+
+define Build/InstallDev
+       echo "Build/InstallDev"
+endef
+
+define Package/cdparanoia/install
+       echo "package/cdparanoia/install"
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/cdparanoia $(1)/usr/bin
+#      $(CP) $(PKG_BUILD_DIR)/paranoia/libcdda_paranoia.so.0.$(PKG_VERSION) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/paranoia/libcdda_paranoia.so.* $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/interface/libcdda_interface.so.* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,cdparanoia))
diff --git a/utils/cdparanoia/patches/002-fixbecrash-private-keyword.patch b/utils/cdparanoia/patches/002-fixbecrash-private-keyword.patch
new file mode 100644 (file)
index 0000000..9cf28fc
--- /dev/null
@@ -0,0 +1,908 @@
+diff -ur cdparanoia-III-10.2/interface/cdda_interface.h cdparanoia/interface/cdda_interface.h
+--- cdparanoia-III-10.2/interface/cdda_interface.h     2008-09-11 12:43:52.000000000 +0200
++++ cdparanoia/interface/cdda_interface.h      2009-01-28 18:02:11.000000000 +0100
+@@ -84,7 +84,7 @@
+   int is_atapi;
+   int is_mmc;
+-  cdda_private_data_t *private;
++  cdda_private_data_t *private_data;
+   void         *reserved;
+   unsigned char inqbytes[4];
+diff -ur cdparanoia-III-10.2/interface/cooked_interface.c cdparanoia/interface/cooked_interface.c
+--- cdparanoia-III-10.2/interface/cooked_interface.c   2008-08-26 11:55:22.000000000 +0200
++++ cdparanoia/interface/cooked_interface.c    2009-01-28 18:02:11.000000000 +0100
+@@ -13,13 +13,13 @@
+ static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){
+   struct timespec tv1;
+   struct timespec tv2;
+-  int ret1=clock_gettime(d->private->clock,&tv1);
++  int ret1=clock_gettime(d->private_data->clock,&tv1);
+   int ret2=ioctl(fd, command,arg);
+-  int ret3=clock_gettime(d->private->clock,&tv2);
++  int ret3=clock_gettime(d->private_data->clock,&tv2);
+   if(ret1<0 || ret3<0){
+-    d->private->last_milliseconds=-1;
++    d->private_data->last_milliseconds=-1;
+   }else{
+-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
++    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
+   }
+   return ret2;
+ }
+diff -ur cdparanoia-III-10.2/interface/interface.c cdparanoia/interface/interface.c
+--- cdparanoia-III-10.2/interface/interface.c  2008-09-11 12:43:52.000000000 +0200
++++ cdparanoia/interface/interface.c   2009-01-28 18:02:11.000000000 +0100
+@@ -39,9 +39,9 @@
+     if(d->drive_model)free(d->drive_model);
+     if(d->cdda_fd!=-1)close(d->cdda_fd);
+     if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd);
+-    if(d->private){
+-      if(d->private->sg_hd)free(d->private->sg_hd);
+-      free(d->private);
++    if(d->private_data){
++      if(d->private_data->sg_hd)free(d->private_data->sg_hd);
++      free(d->private_data);
+     }
+     free(d);
+@@ -90,11 +90,11 @@
+       }
+   }
++  if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d);
++
+   if((ret=d->enable_cdda(d,1)))
+     return(ret);
+     
+-  /*  d->select_speed(d,d->maxspeed); most drives are full speed by default */
+-  if(d->bigendianp==-1)d->bigendianp=data_bigendianp(d);
+   return(0);
+ }
+@@ -118,7 +118,7 @@
+       if(d->bigendianp==-1) /* not determined yet */
+         d->bigendianp=data_bigendianp(d);
+       
+-      if(d->bigendianp!=bigendianp()){
++      if(buffer && d->bigendianp!=bigendianp()){
+         int i;
+         u_int16_t *p=(u_int16_t *)buffer;
+         long els=sectors*CD_FRAMESIZE_RAW/2;
+@@ -127,7 +127,7 @@
+       }
+       }       
+     }
+-    if(ms)*ms=d->private->last_milliseconds;
++    if(ms)*ms=d->private_data->last_milliseconds;
+     return(sectors);
+   }
+   
+diff -ur cdparanoia-III-10.2/interface/scan_devices.c cdparanoia/interface/scan_devices.c
+--- cdparanoia-III-10.2/interface/scan_devices.c       2008-08-26 11:55:22.000000000 +0200
++++ cdparanoia/interface/scan_devices.c        2009-01-28 18:02:11.000000000 +0100
+@@ -264,11 +264,11 @@
+   d->interface=COOKED_IOCTL;
+   d->bigendianp=-1; /* We don't know yet... */
+   d->nsectors=-1;
+-  d->private=calloc(1,sizeof(*d->private));
++  d->private_data=calloc(1,sizeof(*d->private_data));
+   {
+     /* goddamnit */
+     struct timespec tv;
+-    d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
++    d->private_data->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
+   }
+   idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",description);
+   return(d);
+@@ -674,15 +674,15 @@
+   d->bigendianp=-1; /* We don't know yet... */
+   d->nsectors=-1;
+   d->messagedest = messagedest;
+-  d->private=calloc(1,sizeof(*d->private));
++  d->private_data=calloc(1,sizeof(*d->private_data));
+   {
+     /* goddamnit */
+     struct timespec tv;
+-    d->private->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
++    d->private_data->clock=(clock_gettime(CLOCK_MONOTONIC,&tv)<0?CLOCK_REALTIME:CLOCK_MONOTONIC);
+   }
+   if(use_sgio){
+     d->interface=SGIO_SCSI;
+-    d->private->sg_buffer=(unsigned char *)(d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE));
++    d->private_data->sg_buffer=(unsigned char *)(d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE));
+     g_fd=d->cdda_fd=dup(d->ioctl_fd);
+   }else{
+     version=verify_SG_version(d,messagedest,messages);
+@@ -696,8 +696,8 @@
+     }
+     /* malloc our big buffer for scsi commands */
+-    d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE);
+-    d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF;
++    d->private_data->sg_hd=malloc(MAX_BIG_BUFF_SIZE);
++    d->private_data->sg_buffer=((unsigned char *)d->private_data->sg_hd)+SG_OFF;
+   }
+   {
+@@ -772,9 +772,9 @@
+   if(i_fd!=-1)close(i_fd);
+   if(g_fd!=-1)close(g_fd);
+   if(d){
+-    if(d->private){
+-      if(d->private->sg_hd)free(d->private->sg_hd);
+-      free(d->private);
++    if(d->private_data){
++      if(d->private_data->sg_hd)free(d->private_data->sg_hd);
++      free(d->private_data);
+     }
+     free(d);
+   }
+@@ -821,7 +821,7 @@
+   d->interface=TEST_INTERFACE;
+   d->bigendianp=-1; /* We don't know yet... */
+   d->nsectors=-1;
+-  d->private=calloc(1,sizeof(*d->private));
++  d->private_data=calloc(1,sizeof(*d->private_data));
+   d->drive_model=copystring("File based test interface");
+   idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",d->drive_model);
+   
+diff -ur cdparanoia-III-10.2/interface/scsi_interface.c cdparanoia/interface/scsi_interface.c
+--- cdparanoia-III-10.2/interface/scsi_interface.c     2008-09-11 22:33:30.000000000 +0200
++++ cdparanoia/interface/scsi_interface.c      2009-01-28 18:02:11.000000000 +0100
+@@ -15,13 +15,13 @@
+ static int timed_ioctl(cdrom_drive *d, int fd, int command, void *arg){
+   struct timespec tv1;
+   struct timespec tv2;
+-  int ret1=clock_gettime(d->private->clock,&tv1);
++  int ret1=clock_gettime(d->private_data->clock,&tv1);
+   int ret2=ioctl(fd, command,arg);
+-  int ret3=clock_gettime(d->private->clock,&tv2);
++  int ret3=clock_gettime(d->private_data->clock,&tv2);
+   if(ret1<0 || ret3<0){
+-    d->private->last_milliseconds=-1;
++    d->private_data->last_milliseconds=-1;
+   }else{
+-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
++    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
+   }
+   return ret2;
+ }
+@@ -96,7 +96,7 @@
+ static void clear_garbage(cdrom_drive *d){
+   fd_set fdset;
+   struct timeval tv;
+-  struct sg_header *sg_hd=d->private->sg_hd;
++  struct sg_header *sg_hd=d->private_data->sg_hd;
+   int flag=0;
+   /* clear out any possibly preexisting garbage */
+@@ -185,7 +185,7 @@
+   struct timespec tv2;
+   int tret1,tret2;
+   int status = 0;
+-  struct sg_header *sg_hd=d->private->sg_hd;
++  struct sg_header *sg_hd=d->private_data->sg_hd;
+   long writebytes=SG_OFF+cmd_len+in_size;
+   /* generic scsi device services */
+@@ -195,7 +195,7 @@
+   memset(sg_hd,0,sizeof(sg_hd)); 
+   memset(sense_buffer,0,SG_MAX_SENSE); 
+-  memcpy(d->private->sg_buffer,cmd,cmd_len+in_size);
++  memcpy(d->private_data->sg_buffer,cmd,cmd_len+in_size);
+   sg_hd->twelve_byte = cmd_len == 12;
+   sg_hd->result = 0;
+   sg_hd->reply_len = SG_OFF + out_size;
+@@ -209,7 +209,7 @@
+      tell if the command failed.  Scared yet? */
+   if(bytecheck && out_size>in_size){
+-    memset(d->private->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); 
++    memset(d->private_data->sg_buffer+cmd_len+in_size,bytefill,out_size-in_size); 
+     /* the size does not remove cmd_len due to the way the kernel
+        driver copies buffers */
+     writebytes+=(out_size-in_size);
+@@ -243,7 +243,7 @@
+   }
+   sigprocmask (SIG_BLOCK, &(d->sigset), NULL );
+-  tret1=clock_gettime(d->private->clock,&tv1);  
++  tret1=clock_gettime(d->private_data->clock,&tv1);  
+   errno=0;
+   status = write(d->cdda_fd, sg_hd, writebytes );
+@@ -289,7 +289,7 @@
+     }
+   }
+-  tret2=clock_gettime(d->private->clock,&tv2);  
++  tret2=clock_gettime(d->private_data->clock,&tv2);  
+   errno=0;
+   status = read(d->cdda_fd, sg_hd, SG_OFF + out_size);
+   sigprocmask ( SIG_UNBLOCK, &(d->sigset), NULL );
+@@ -313,7 +313,7 @@
+   if(bytecheck && in_size+cmd_len<out_size){
+     long i,flag=0;
+     for(i=in_size;i<out_size;i++)
+-      if(d->private->sg_buffer[i]!=bytefill){
++      if(d->private_data->sg_buffer[i]!=bytefill){
+       flag=1;
+       break;
+       }
+@@ -326,9 +326,9 @@
+   errno=0;
+   if(tret1<0 || tret2<0){
+-    d->private->last_milliseconds=-1;
++    d->private_data->last_milliseconds=-1;
+   }else{
+-    d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000;
++    d->private_data->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000 + (tv2.tv_nsec-tv1.tv_nsec)/1000000;
+   }
+   return(0);
+ }
+@@ -347,7 +347,7 @@
+   memset(&hdr,0,sizeof(hdr));
+   memset(sense,0,sizeof(sense));
+-  memcpy(d->private->sg_buffer,cmd+cmd_len,in_size);
++  memcpy(d->private_data->sg_buffer,cmd+cmd_len,in_size);
+   hdr.cmdp = cmd;
+   hdr.cmd_len = cmd_len;
+@@ -355,7 +355,7 @@
+   hdr.mx_sb_len = SG_MAX_SENSE;
+   hdr.timeout = 50000;
+   hdr.interface_id = 'S';
+-  hdr.dxferp =  d->private->sg_buffer;
++  hdr.dxferp =  d->private_data->sg_buffer;
+   hdr.flags = SG_FLAG_DIRECT_IO;  /* direct IO if we can get it */
+   /* scary buffer fill hack */
+@@ -400,7 +400,7 @@
+   if(bytecheck && in_size<out_size){
+     long i,flag=0;
+     for(i=in_size;i<out_size;i++)
+-      if(d->private->sg_buffer[i]!=bytefill){
++      if(d->private_data->sg_buffer[i]!=bytefill){
+       flag=1;
+       break;
+       }
+@@ -412,7 +412,7 @@
+   }
+   /* Can't rely on .duration because we can't be certain kernel has HZ set to something useful */
+-  /* d->private->last_milliseconds = hdr.duration; */
++  /* d->private_data->last_milliseconds = hdr.duration; */
+   errno = 0;
+   return 0;
+@@ -445,9 +445,9 @@
+   handle_scsi_cmd(d, cmd, 6, 0, 56, 0,0, sense);
+-  key = d->private->sg_buffer[2] & 0xf;
+-  ASC = d->private->sg_buffer[12];
+-  ASCQ = d->private->sg_buffer[13];
++  key = d->private_data->sg_buffer[2] & 0xf;
++  ASC = d->private_data->sg_buffer[12];
++  ASCQ = d->private_data->sg_buffer[13];
+   
+   if(key == 2 && ASC == 4 && ASCQ == 1) return 0;
+   return 1;
+@@ -492,7 +492,7 @@
+   if (handle_scsi_cmd (d, cmd, 10, 0, size+4,'\377',1,sense)) return(1);
+   {
+-    unsigned char *b=d->private->sg_buffer;
++    unsigned char *b=d->private_data->sg_buffer;
+     if(b[0])return(1); /* Handles only up to 256 bytes */
+     if(b[6])return(1); /* Handles only up to 256 bytes */
+@@ -604,8 +604,8 @@
+ static unsigned int get_orig_sectorsize(cdrom_drive *d){
+   if(mode_sense(d,12,0x01))return(-1);
+-  d->orgdens = d->private->sg_buffer[4];
+-  return(d->orgsize = ((int)(d->private->sg_buffer[10])<<8)+d->private->sg_buffer[11]);
++  d->orgdens = d->private_data->sg_buffer[4];
++  return(d->orgsize = ((int)(d->private_data->sg_buffer[10])<<8)+d->private_data->sg_buffer[11]);
+ }
+ /* switch CDROM scsi drives to given sector size  */
+@@ -664,8 +664,8 @@
+     return(-4);
+   }
+-  first=d->private->sg_buffer[2];
+-  last=d->private->sg_buffer[3];
++  first=d->private_data->sg_buffer[2];
++  last=d->private_data->sg_buffer[3];
+   tracks=last-first+1;
+   if (last > MAXTRK || first > MAXTRK || last<0 || first<0) {
+@@ -683,7 +683,7 @@
+       return(-5);
+     }
+     {
+-      scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4);
++      scsi_TOC *toc=(scsi_TOC *)(d->private_data->sg_buffer+4);
+       d->disc_toc[i-first].bFlags=toc->bFlags;
+       d->disc_toc[i-first].bTrack=i;
+@@ -704,7 +704,7 @@
+     return(-2);
+   }
+   {
+-    scsi_TOC *toc=(scsi_TOC *)(d->private->sg_buffer+4);
++    scsi_TOC *toc=(scsi_TOC *)(d->private_data->sg_buffer+4);
+     
+     d->disc_toc[i-first].bFlags=toc->bFlags;
+     d->disc_toc[i-first].bTrack=0xAA;
+@@ -738,7 +738,7 @@
+   }
+   /* copy to our structure and convert start sector */
+-  tracks = d->private->sg_buffer[1];
++  tracks = d->private_data->sg_buffer[1];
+   if (tracks > MAXTRK) {
+     cderror(d,"003: CDROM reporting illegal number of tracks\n");
+     return(-3);
+@@ -754,33 +754,33 @@
+       return(-5);
+     }
+     
+-    d->disc_toc[i].bFlags = d->private->sg_buffer[10];
++    d->disc_toc[i].bFlags = d->private_data->sg_buffer[10];
+     d->disc_toc[i].bTrack = i + 1;
+     d->disc_toc[i].dwStartSector= d->adjust_ssize * 
+-      (((signed char)(d->private->sg_buffer[2])<<24) | 
+-       (d->private->sg_buffer[3]<<16)|
+-       (d->private->sg_buffer[4]<<8)|
+-       (d->private->sg_buffer[5]));
++      (((signed char)(d->private_data->sg_buffer[2])<<24) | 
++       (d->private_data->sg_buffer[3]<<16)|
++       (d->private_data->sg_buffer[4]<<8)|
++       (d->private_data->sg_buffer[5]));
+   }
+   d->disc_toc[i].bFlags = 0;
+   d->disc_toc[i].bTrack = i + 1;
+-  memcpy (&foo, d->private->sg_buffer+2, 4);
+-  memcpy (&bar, d->private->sg_buffer+6, 4);
++  memcpy (&foo, d->private_data->sg_buffer+2, 4);
++  memcpy (&bar, d->private_data->sg_buffer+6, 4);
+   d->disc_toc[i].dwStartSector = d->adjust_ssize * (be32_to_cpu(foo) +
+                                                   be32_to_cpu(bar));
+   d->disc_toc[i].dwStartSector= d->adjust_ssize * 
+-    ((((signed char)(d->private->sg_buffer[2])<<24) | 
+-      (d->private->sg_buffer[3]<<16)|
+-      (d->private->sg_buffer[4]<<8)|
+-      (d->private->sg_buffer[5]))+
++    ((((signed char)(d->private_data->sg_buffer[2])<<24) | 
++      (d->private_data->sg_buffer[3]<<16)|
++      (d->private_data->sg_buffer[4]<<8)|
++      (d->private_data->sg_buffer[5]))+
+      
+-     ((((signed char)(d->private->sg_buffer[6])<<24) | 
+-       (d->private->sg_buffer[7]<<16)|
+-       (d->private->sg_buffer[8]<<8)|
+-       (d->private->sg_buffer[9]))));
++     ((((signed char)(d->private_data->sg_buffer[6])<<24) | 
++       (d->private_data->sg_buffer[7]<<16)|
++       (d->private_data->sg_buffer[8]<<8)|
++       (d->private_data->sg_buffer[9]))));
+   d->cd_extra = FixupTOC(d,tracks+1);
+@@ -817,7 +817,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -836,7 +836,7 @@
+   cmd[9] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -854,7 +854,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -872,7 +872,7 @@
+   cmd[9] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -890,7 +890,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,10,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -908,7 +908,7 @@
+   cmd[9] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -922,7 +922,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -936,7 +936,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -950,7 +950,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -964,7 +964,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -978,7 +978,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -992,7 +992,7 @@
+   cmd[8] = sectors;
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -1026,7 +1026,7 @@
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -1039,7 +1039,7 @@
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -1052,7 +1052,7 @@
+   
+   if((ret=handle_scsi_cmd(d,cmd,12,0,sectors * CD_FRAMESIZE_RAW,'\177',1,sense)))
+     return(ret);
+-  if(p)memcpy(p,d->private->sg_buffer,sectors*CD_FRAMESIZE_RAW);
++  if(p)memcpy(p,d->private_data->sg_buffer,sectors*CD_FRAMESIZE_RAW);
+   return(0);
+ }
+@@ -1275,7 +1275,7 @@
+ static int count_2352_bytes(cdrom_drive *d){
+   long i;
+   for(i=2351;i>=0;i--)
+-    if(d->private->sg_buffer[i]!=(unsigned char)'\177')
++    if(d->private_data->sg_buffer[i]!=(unsigned char)'\177')
+       return(((i+3)>>2)<<2);
+   return(0);
+@@ -1284,7 +1284,7 @@
+ static int verify_nonzero(cdrom_drive *d){
+   long i,flag=0;
+   for(i=0;i<2352;i++)
+-    if(d->private->sg_buffer[i]!=0){
++    if(d->private_data->sg_buffer[i]!=0){
+       flag=1;
+       break;
+     }
+@@ -1298,7 +1298,7 @@
+ static int verify_read_command(cdrom_drive *d){
+   int i,j,k;
+-  int audioflag=0;
++  int audioflag=1;
+   int  (*enablecommand)  (struct cdrom_drive *d, int speed);
+   long (*readcommand)   (struct cdrom_drive *d, void *p, long begin, 
+@@ -1313,7 +1313,7 @@
+      for data */
+   if(d->enable_cdda(d,1)==0){
+-    
++    audioflag=0;
+     for(i=1;i<=d->tracks;i++){
+       if(cdda_track_audiop(d,i)==1){
+       long firstsector=cdda_track_firstsector(d,i);
+@@ -1358,115 +1358,111 @@
+     /* NEC test must come before sony; the nec drive expects d8 to be
+        10 bytes, and a 12 byte verson (Sony) crashes the drive */
+-    for(j=0;j<15;j++){
+-      int densitypossible=1;
+-
+-      switch(j){
++    for(i=0;i<5;i++){
++      switch(i){
+       case 0:
+-      d->read_audio=scsi_read_28;
+-      rs="28 0x,00";
++      d->density=0;
++      d->enable_cdda=Dummy;
++      es="none    ";
+       break;
+       case 1:
+-      d->read_audio=scsi_read_A8;
+-      rs="a8 0x,00";
++      d->density=0;
++      d->enable_cdda=scsi_enable_cdda;
++      es="yes/0x00";
+       break;
+-
+       case 2:
+-      d->read_audio=scsi_read_mmcB;
+-      rs="be 02,10";
+-      densitypossible=0;
++      d->density=0x04;
++      d->enable_cdda=scsi_enable_cdda;
++      es="yes/0x04";
+       break;
+       case 3:
+-      d->read_audio=scsi_read_mmc2B;
+-      rs="be 02,f8";
+-      densitypossible=0;
++      d->density=0x82;
++      d->enable_cdda=scsi_enable_cdda;
++      es="yes/0x82";
+       break;
+       case 4:
+-      d->read_audio=scsi_read_mmc3B;
+-      rs="be 06,f8";
+-      densitypossible=0;
+-      break;
+-
+-      case 5:
+-      d->read_audio=scsi_read_mmc;
+-      rs="be 00,10";
+-      densitypossible=0;
+-      break;
+-      case 6:
+-      d->read_audio=scsi_read_mmc2;
+-      rs="be 00,f8";
+-      densitypossible=0;
+-      break;
+-      case 7:
+-      d->read_audio=scsi_read_mmc3;
+-      rs="be 04,f8";
+-      densitypossible=0;
+-      break;
+-
+-      case 8:
+-      d->read_audio=scsi_read_msf;
+-      rs="b9 00,10";
+-      densitypossible=0;
+-      break;
+-      case 9:
+-      d->read_audio=scsi_read_msf2;
+-      rs="b9 00,f8";
+-      densitypossible=0;
+-      break;
+-      case 10:
+-      d->read_audio=scsi_read_msf3;
+-      rs="b9 04,f8";
+-      densitypossible=0;
+-      break;
+-
+-      case 11:
+-      d->read_audio=scsi_read_D4_10;
+-      rs="d4(10)0x";
+-      break;
+-      case 12:
+-      d->read_audio=scsi_read_D4_12;
+-      rs="d4(12)0x";
+-      break;
+-      case 13:
+-      d->read_audio=scsi_read_D5;
+-      rs="d5 0x,00";
+-      break;
+-      case 14:
+-      d->read_audio=scsi_read_D8;
+-      rs="d8 0x,00";
++      d->density=0x81;
++      d->enable_cdda=scsi_enable_cdda;
++      es="yes/0x81";
+       break;
+       }
+-      
+-      for(i=0;i<5;i++){
+-      switch(i){
++
++      for(j=0;j<15;j++){
++      
++      switch(j){
+       case 0:
+-        d->density=0;
+-        d->enable_cdda=Dummy;
+-        es="none    ";
+-        if(!densitypossible)i=5; /* short circuit MMC style commands */
++        d->read_audio=scsi_read_28;
++        rs="28 0x,00";
+         break;
+       case 1:
+-        d->density=0;
+-        d->enable_cdda=scsi_enable_cdda;
+-        es="yes/0x00";
++        d->read_audio=scsi_read_A8;
++        rs="a8 0x,00";
+         break;
++        
++        /* 2 through 10 do not allow/require density */
+       case 2:
+-        d->density=0x04;
+-        d->enable_cdda=scsi_enable_cdda;
+-        es="yes/0x04";
+-        break;
++        d->read_audio=scsi_read_mmcB;
++        rs="be 02,10";
++        if(i==0)break;
+       case 3:
+-        d->density=0x82;
+-        d->enable_cdda=scsi_enable_cdda;
+-        es="yes/0x82";
+-        break;
++        j=3;
++        d->read_audio=scsi_read_mmc2B;
++        rs="be 02,f8";
++        if(i==0)break;
+       case 4:
+-        d->density=0x81;
+-        d->enable_cdda=scsi_enable_cdda;
+-        es="yes/0x81";
++        j=4;
++        d->read_audio=scsi_read_mmc3B;
++        rs="be 06,f8";
++        if(i==0)break;
++      case 5:
++        j=5;
++        d->read_audio=scsi_read_mmc;
++        rs="be 00,10";
++        if(i==0)break;
++      case 6:
++        j=6;
++        d->read_audio=scsi_read_mmc2;
++        rs="be 00,f8";
++        if(i==0)break;
++      case 7:
++        j=7;
++        d->read_audio=scsi_read_mmc3;
++        rs="be 04,f8";
++        if(i==0)break;
++      case 8:
++        j=8;
++        d->read_audio=scsi_read_msf;
++        rs="b9 00,10";
++        if(i==0)break;
++      case 9:
++        j=9;
++        d->read_audio=scsi_read_msf2;
++        rs="b9 00,f8";
++        if(i==0)break;
++      case 10:
++        j=10;
++        d->read_audio=scsi_read_msf3;
++        rs="b9 04,f8";
++        if(i==0)break;
++      
++      case 11:
++        d->read_audio=scsi_read_D4_10;
++        rs="d4(10)0x";
++        break;
++      case 12:
++        d->read_audio=scsi_read_D4_12;
++        rs="d4(12)0x";
++        break;
++      case 13:
++        d->read_audio=scsi_read_D5;
++        rs="d5 0x,00";
++        break;
++      case 14:
++        d->read_audio=scsi_read_D8;
++        rs="d8 0x,00";
+         break;
+       }
+-
++      
+       cdmessage(d,"\ttest -> density: [");
+       cdmessage(d,es);
+       cdmessage(d,"]  command: [");
+@@ -1525,21 +1521,21 @@
+         if(zeroflag){
+           char buffer[256];
+           sprintf(buffer,"\t\tDrive returned %d packet(s), but contents\n"
+-                      "\t\twere entirely zero\n",zeroflag);
++                  "\t\twere entirely zero\n",zeroflag);
+           cdmessage(d,buffer);
+         }
+       }
+       }
+     }
+-
++    
+     /* D'oh. */
+     d->density=density;
+     d->read_audio=readcommand;
+     d->enable_cdda=enablecommand;
+-
++    
+     cdmessage(d,"\tUnable to find any suitable command set from probe;\n"
+             "\tdrive probably not CDDA capable.\n");
+-
++    
+     cderror(d,"006: Could not read any data from drive\n");
+   }
+@@ -1625,7 +1621,7 @@
+   d->is_mmc=0;
+   if(mode_sense(d,22,0x2A)==0){
+   
+-    b=d->private->sg_buffer;
++    b=d->private_data->sg_buffer;
+     b+=b[3]+4;
+     
+     if((b[0]&0x3F)==0x2A){
+@@ -1673,7 +1669,7 @@
+     cderror(d,"008: Unable to identify CDROM model\n");
+     return(NULL);
+   }
+-  return (d->private->sg_buffer);
++  return (d->private_data->sg_buffer);
+ }
+ int scsi_init_drive(cdrom_drive *d){
+@@ -1690,33 +1686,20 @@
+   if(d->is_atapi)d->lun=0; /* it should already be; just to make sure */
+       
+   if(d->is_mmc){
+-
+     d->read_audio = scsi_read_mmc2B;
+     d->bigendianp=0;
+-
+     check_exceptions(d,mmc_list);
+-
+   }else{
+-    
+     if(d->is_atapi){
+       /* Not MMC maybe still uses 0xbe */
+-
+       d->read_audio = scsi_read_mmc2B;
+       d->bigendianp=0;
+-
+       check_exceptions(d,atapi_list);
+-
+     }else{
+-
+       check_exceptions(d,scsi_list);
+-
+     }
+   }
+-  if(!d->is_atapi)set_sectorsize(d,2048); /* we really do want the
+-                                           sector size at 2048 to begin.*/
+-  d->enable_cdda(d,0);
+-
+   d->read_toc = (!memcmp(d->drive_model, "IMS", 3) && !d->is_atapi) ? scsi_read_toc2 : 
+     scsi_read_toc;
+   d->set_speed = scsi_set_speed;
+@@ -1742,8 +1725,8 @@
+   check_cache(d);
+   d->error_retry=1;
+-  d->private->sg_hd=realloc(d->private->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
+-  d->private->sg_buffer=((unsigned char *)d->private->sg_hd)+SG_OFF;
++  d->private_data->sg_hd=realloc(d->private_data->sg_hd,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
++  d->private_data->sg_buffer=((unsigned char *)d->private_data->sg_hd)+SG_OFF;
+   d->report_all=1;
+   return(0);
+ }
+diff -ur cdparanoia-III-10.2/interface/test_interface.c cdparanoia/interface/test_interface.c
+--- cdparanoia-III-10.2/interface/test_interface.c     2008-09-11 22:33:30.000000000 +0200
++++ cdparanoia/interface/test_interface.c      2009-01-28 18:02:11.000000000 +0100
+@@ -66,9 +66,9 @@
+   if(!fd)fd=fdopen(d->cdda_fd,"r");
+   if(begin<lastread)
+-    d->private->last_milliseconds=20;
++    d->private_data->last_milliseconds=20;
+   else
+-    d->private->last_milliseconds=sectors;
++    d->private_data->last_milliseconds=sectors;
+ #ifdef CDDA_TEST_UNDERRUN
+   sectors-=1;
+diff -ur cdparanoia-III-10.2/main.c cdparanoia/main.c
+--- cdparanoia-III-10.2/main.c 2008-09-11 23:11:02.000000000 +0200
++++ cdparanoia/main.c  2009-01-28 18:02:11.000000000 +0100
+@@ -746,7 +746,7 @@
+       break;
+     case 'p':
+       output_type=0;
+-      output_endian=-1;
++      output_endian=bigendianp();
+       break;
+     case 'r':
+       output_type=0;
+diff -ur cdparanoia-III-10.2/version.h cdparanoia/version.h
+--- cdparanoia-III-10.2/version.h      2008-09-11 22:33:30.000000000 +0200
++++ cdparanoia/version.h       2009-01-28 18:02:11.000000000 +0100
+@@ -1,11 +1,11 @@
+ /******************************************************************
+  * CopyPolicy: GNU Public License 2 applies
+  * 
+- * cdda_paranoia generation III release 10.2
++ * cdda_paranoia generation III release 10.3
+  * Copyright (C) 2008 Monty monty@xiph.org
+  *
+  ******************************************************************/
+-#define VERSIONNUM "10.2"
+-#define VERSION "cdparanoia III release " VERSIONNUM " (September 11, 2008)\n"
++#define VERSIONNUM "10.3pre"
++#define VERSION "cdparanoia III release " VERSIONNUM " (September 16, 2008)\n"
diff --git a/utils/cdparanoia/patches/010-fix_configure.patch b/utils/cdparanoia/patches/010-fix_configure.patch
new file mode 100644 (file)
index 0000000..3fa76a0
--- /dev/null
@@ -0,0 +1,40 @@
+Index: cdparanoia-10.2/Makefile.in
+===================================================================
+--- cdparanoia-10.2.orig/Makefile.in   2008-11-06 15:17:28.000000000 +0100
++++ cdparanoia-10.2/Makefile.in        2008-11-06 15:19:12.000000000 +0100
+@@ -8,12 +8,12 @@
+ srcdir=@srcdir@
+ @SET_MAKE@
+-FLAGS=@TYPESIZES@ @CFLAGS@
+-OPT=@OPT@ $(FLAGS)
+-DEBUG=@DEBUG@ $(FLAGS)
++#FLAGS=@TYPESIZES@ @CFLAGS@
++#OPT=@OPT@ $(FLAGS)
++#DEBUG=@DEBUG@ $(FLAGS)
+ CC=@CC@
+ LD=@CC@
+-LDFLAGS=@LDFLAGS@ $(FLAGS)
++LDFLAGS=@LDFLAGS@
+ AR=@AR@
+ RANLIB=@RANLIB@
+ INSTALL=@INSTALL@
+@@ -43,7 +43,8 @@
+ all:  
+       cd interface && $(MAKE) all
+       cd paranoia && $(MAKE) all
+-      $(MAKE) cdparanoia CFLAGS="$(OPT)" 
++      $(MAKE) cdparanoia 
++#CFLAGS="$(OPT)" 
+ debug:  
+       cd interface && $(MAKE) debug
+@@ -87,7 +88,7 @@
+               $(LIBDIR)/libcdda_paranoia.so
+ cdparanoia:   $(OFILES) $(LIBDEP)
+-              $(LD) $(CFLAGS) $(LDFLAGS) $(OFILES) \
++              $(CC) $(CFLAGS) $(LDFLAGS) $(OFILES) \
+               -L$(PWD)/paranoia -L$(PWD)/interface \
+               -o cdparanoia $(LIBS)
diff --git a/utils/cksfv/Makefile b/utils/cksfv/Makefile
new file mode 100644 (file)
index 0000000..aac72fd
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2010-2014 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:=cksfv
+PKG_VERSION:=1.3.14
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://zakalwe.fi/~shd/foss/cksfv/files
+PKG_MD5SUM:=2e15289753ea0b90b6ea86993f93b383
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cksfv
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=cksfv CRC32 checksum verification tool
+  URL:=http://zakalwe.fi/~shd/foss/cksfv/
+endef
+
+define Package/cksfv/description
+  cksfv is a tool for verifying CRC32 checksums.
+endef
+
+define Package/cksfv/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cksfv $(1)/usr/sbin/cksfv
+endef
+
+$(eval $(call BuildPackage,cksfv))
diff --git a/utils/cksfv/patches/001-missing_inttypes_h.patch b/utils/cksfv/patches/001-missing_inttypes_h.patch
new file mode 100644 (file)
index 0000000..1580d63
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/cksfv.h      2009-04-12 09:04:10.000000000 -0700
++++ b/src/cksfv.h      2014-03-06 14:18:21.020889903 -0800
+@@ -5,6 +5,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#include <inttypes.h>
+ #include "config.h"
+--- a/src/crc32.c      2009-04-12 09:04:10.000000000 -0700
++++ b/src/crc32.c      2014-03-06 14:44:20.836871963 -0800
+@@ -18,6 +18,7 @@
+ #include <unistd.h>
+ #include <errno.h>
++#include <inttypes.h>
+ #include "config.h"
diff --git a/utils/clish/Makefile b/utils/clish/Makefile
new file mode 100644 (file)
index 0000000..f1774e5
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2012 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:=clish
+PKG_VERSION:=0.7.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=81e20f7a888bcd8e2280e37804d342e4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/clish
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libstdcpp +libpthread
+  TITLE:=Command Line Interface SHell
+  URL:=http://clish.sourceforge.net/
+endef
+
+define Package/clish/description
+ A modular framework for implementing a CISCO-like CLI on a *NIX system.
+ Arbitary command menus and actions can be defined using XML files.
+ This software handles the user interaction,
+ and forks the appropriate system commands to perform any actions.
+endef
+
+CONFIGURE_VARS += \
+       ac_cv_header_bfd_h=no
+
+MAKE_FLAGS += \
+       bin_PROGRAMS=bin/clish
+
+define Package/clish/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(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/clish
+       $(CP) $(PKG_BUILD_DIR)/xml-examples/*.xml $(1)/etc/clish/
+endef
+
+$(eval $(call BuildPackage,clish))
diff --git a/utils/cpusage/Makefile b/utils/cpusage/Makefile
new file mode 100644 (file)
index 0000000..10b5ec5
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2005 Fabian Schneider, 2010 Florian Sesser, TU Muenchen
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cpusage
+PKG_VERSION:=0.31
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/cpusage
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/cpusage
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Outputs CPU usage statistics once per second
+  URL:=http://www.net.t-labs.tu-berlin.de/~fabian/software_en.html\#cpusage
+endef
+
+define Package/cpusage/description
+  CPUsage outputs CPU usage statistics once per second.
+  Optionally writes CSV output (see '-o' option).
+  Written by Fabian Schneider (TUM, TUB) in 2005.
+  Timestamp and CSV-compliance by Florian Sesser (TUM), 2010.
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) src/* $(PKG_BUILD_DIR)/
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -D__Linux26__ -D_BSD_SOURCE=1 -c -I$(PKG_BUILD_DIR) -I$(STAGING_DIR)/usr/include -o $(PKG_BUILD_DIR)/cpusage.o $(PKG_BUILD_DIR)/cpusage.c
+       $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/cpusage -L$(STAGING_DIR)/usr/lib $(PKG_BUILD_DIR)/cpusage.o
+endef
+
+define Package/cpusage/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cpusage $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,cpusage))
diff --git a/utils/cpusage/src/cpusage.c b/utils/cpusage/src/cpusage.c
new file mode 100644 (file)
index 0000000..a027e4f
--- /dev/null
@@ -0,0 +1,426 @@
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <time.h>
+
+#ifdef __FreeBSD__
+#include <sys/sysctl.h>
+#else
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
+#ifdef __FreeBSD__
+static void getsysctl(char *, void *, size_t);
+#define CPUSTATES 5
+#define IDLEI 3
+char *cpustatenames[] = {
+        "user", "nice", "system", "idle", "interrupt", NULL
+};
+#endif
+
+#ifdef __Linux24__
+#define CPUSTATES 4
+#define IDLEI 3
+char *cpustatenames[] = {
+        "user", "nice", "system", "idle",  NULL
+};
+#endif
+
+#ifdef __Linux26__
+#define CPUSTATES 7
+#define IDLEI 3
+/* long names:
+ * user - nice - system - idle - iowait - irq - soft irq */
+char *cpustatenames[] = {
+        "user", "nice", "system", "idle", "iowait", "irq", "softirq", NULL
+};
+#endif
+
+#define LIMIT 95
+
+static const char usage[] = 
+    "\n usage: cpusage [ -hos ] [ -a | -l limit ] [ -c CPU ]\n";
+
+char* appname;
+
+static float cpu_perc[CPUSTATES];
+static float cpu_max[CPUSTATES];
+static float cpu_min[CPUSTATES];
+
+int cpunum; /* -1 all, 0-n CPU/Core 0-n */
+
+int output;
+
+int breakloop;
+
+/* returns 1-n yielding the number of CPU's/Cores */
+int getNumCPU()
+{
+#ifdef __FreeBSD__
+    return 0;
+#else
+
+    char buffer[32768];
+    int fd, len, i;
+    char * test;
+           
+    fd = open("/proc/stat", O_RDONLY);
+    if(fd<=0)
+       fprintf(stderr, "%s: cannot open /proc/stat \n", appname);
+    
+    len = read(fd, buffer, sizeof(buffer)-1);
+    close(fd);
+    buffer[len] = '\0';
+
+    i=0;
+
+    test = strstr(buffer, "cpu");
+    if (test != NULL ) {
+       test += sizeof("cpu");
+       test = strstr(test, "cpu");
+    }
+
+    while ( test != NULL  ) {
+       test += sizeof("cpu");
+       /* fprintf(stderr, "%s: DEBUG: %s\n", appname, test); */
+       i++;
+       test = strstr(test, "cpu");
+    }
+    return i;
+#endif
+}
+
+#ifdef __FreeBSD__
+static void getsysctl (char *name, void *ptr, size_t len) {
+    size_t nlen = len;
+    long save;
+    
+    if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) {
+            fprintf(stderr, "%s: sysctl(%s...) failed: %s\n", 
+               appname, name, strerror(errno));
+           exit(1);
+    }
+    if (nlen != len) {
+           fprintf(stderr, "%s: sysctl(%s...) expected %lu, got %lu\n",
+               appname, name, (unsigned long)len, (unsigned long)nlen); 
+           exit(1);
+    }
+   
+    /* swapping idle and interrupt to look like linux */
+    save = ((long*) ptr)[4];
+    ((long*) ptr)[4] = ((long*) ptr)[3];
+    ((long*) ptr)[3] = save;
+}
+#else
+void getSysinfo(unsigned long *ptr, size_t size)
+{
+    char buffer[4096];
+    char match[100];
+    char * start;
+    int fd, len, j;
+           
+    for (j = 0; j<size; j++)
+       ptr[j]=0;
+
+    fd = open("/proc/stat", O_RDONLY);
+    if(fd<=0)
+       fprintf(stderr, "%s: cannot open /proc/stat\n", appname );
+    len = read(fd, buffer, sizeof(buffer)-1);
+    close(fd);
+    buffer[len] = '\0';
+
+
+    strcpy(match, "cpu ");
+    start = buffer;
+    if ( cpunum != -1 ) {
+       sprintf(match, "cpu%d ", cpunum);
+       start = strstr(buffer, match);
+    }
+
+#ifdef __Linux26__
+    strcat(match, "%ld %ld %ld %ld %ld %ld %ld");
+    if ( sscanf(start, match, &ptr[0], 
+           &ptr[1], &ptr[2], &ptr[3], &ptr[4], &ptr[5], &ptr[6]) != 7 ) {
+       fprintf(stderr, "%s: wrong /proc/stat format\n", appname);
+    }
+#else
+    strcat(match, "%ld %ld %ld %ld");
+    if ( sscanf(start, match, 
+               &ptr[0], &ptr[1], &ptr[2], &ptr[3]) != 4) {
+       fprintf(stderr, "%s: wrong /proc/stat format\n", appname);
+    }
+#endif
+           
+}
+#endif
+
+long perc(int cpustates, long *cp_time, long *cp_old, long *cp_diff) {
+
+    int i = 0;
+    long total = 0;
+    
+    for ( i = 0; i < cpustates; i++ ) {
+       cp_diff[i] = cp_time[i] - cp_old[i];
+       total += cp_diff[i];
+    }
+    
+    for ( i = 0; i < cpustates; i++) {
+       cpu_perc[i] = ((float)cp_diff[i]*100.0 / total);
+       /* new max ? */
+       if ( cpu_perc[i] > cpu_max[i] )
+           cpu_max[i] = cpu_perc[i];
+       /* new min ? */
+       if ( cpu_perc[i] < cpu_min[i] )
+           cpu_min[i] = cpu_perc[i];
+    }
+   
+    return total;
+}
+
+void print_perc(float *perc, const char *head){
+    int i;
+    time_t Zeitstempel;
+    struct tm *now;
+   
+    /* human readable */
+    if ( (output == 0) && (head != ""))
+       printf("%s: ", head);
+
+    /* machine readable */
+    if ( (output == 1) && (head != ""))
+       printf("%s;", head);
+   
+    /* timestamp */
+    time(&Zeitstempel);
+    now = localtime(&Zeitstempel);
+    if ( output == 0 )
+        printf("timestamp: %04d-%02d-%02d %02d.%02d.%02d, ", now->tm_year+1900, now->tm_mon+1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec);
+    else 
+       printf("%04d-%02d-%02d;%02d:%02d:%02d;", now->tm_year+1900, now->tm_mon+1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec);
+   
+    if ( output == 0 )
+       printf("%s: %5.1f%%, ", cpustatenames[0], perc[0]);
+    else 
+       printf("%.1f", perc[0]);
+    
+    /* print out calculated information in percentages */
+    for ( i = 1; i < CPUSTATES; i++) {
+       if ( output == 0 )
+           printf("%s: %5.1f%%, ", cpustatenames[i], perc[i]);
+       else 
+           printf(";%.1f", perc[i]);
+    }
+    printf("\n");
+}
+
+/* to catch Strg+C when looping */
+void loop_term_handler (int signum) {
+    breakloop = 1;
+}
+
+int main(int argc, char** argv) {
+
+    appname = argv[0];
+
+    int i,c,limit;
+    int runonce;  /* run just once and exit */
+    int avg; /* is avg measurement allready running */ 
+    int avg_run; /* did we allready had an avg measurement */
+    static long cp_time1[CPUSTATES];
+    static long cp_time2[CPUSTATES];
+    static long cp_avg_start[CPUSTATES];
+    static long cp_avg_stop[CPUSTATES];
+    static long cp_diff[CPUSTATES];
+
+    struct sigaction sigold, signew;
+    
+    long *old = cp_time2;
+    long *new = cp_time1;
+
+    long total;
+    limit = LIMIT;
+    output = 0; /* 0: human readable; 1: machine readable */
+    runonce = 0; /* 0: run continuesly; 1: run once */
+
+    cpunum = -1; /* -1: all CPUs/Cores, 0-n: special CPU/Core */
+
+    /* reading commandline options */
+    while (1) {
+       c = getopt(argc, argv, "saohl:c:");
+       
+       if (c == -1){
+           break;
+        }
+
+       switch(c){
+        /*run once and exit */
+        case 's':
+           runonce = 1;             
+           break;
+       /* use avg from begin to end -> same as "-l 100" */
+       case 'a':
+           limit = 100; 
+           break;
+       case 'o':
+           output = 1; /* machine readable */ 
+           // header for CSV output
+           printf("date;time;user;nice;system;idle;iowait;irq;softirq\n");
+           break;
+       /* print usage */
+       case 'h':
+           fprintf(stderr, "%s: %s", appname, usage);
+           exit(0);
+           break;
+       /* set limit */
+       case 'l':
+           if ( !(sscanf(optarg, "%d", &limit) == 1) ) {
+               fprintf(stderr, "%s: option for -l should be integer (is %s)\n",
+                   appname, optarg); 
+               exit(1);
+           }
+           break;
+       /* select CPU/Core */
+       case 'c':
+           if ( !(sscanf(optarg, "%d", &cpunum) == 1) ) {
+               fprintf(stderr, "%s: option for -c should be integer (is %s)\n",
+                   appname, optarg); 
+               exit(1);
+           }
+           break;
+
+       }
+    }
+   
+    if (cpunum != -1) {
+#ifdef __FreeBSD__
+       fprintf(stderr, "%s: No CPU/Core selection available for FreeBSD\n",
+           appname);
+       exit (1);
+#else
+       int numcpu = getNumCPU();
+       if ( cpunum < numcpu ) {
+           printf("-- Selected CPU %d\n", cpunum );
+       } else {
+           if (numcpu == 1) {
+           fprintf(stderr, "%s: CPU %d not available (found %d CPU: [0])\n", 
+               appname, cpunum, numcpu );
+           } else {
+           fprintf(stderr, "%s: CPU %d not available (found %d CPU's: [0]-[%d])\n ", 
+               appname, cpunum, numcpu, numcpu - 1 );
+           }
+           exit(1);
+       }
+
+#endif
+    }
+
+    breakloop = 0;
+
+    for (i=0; i < CPUSTATES; i++){
+       cpu_max[i] = 0;
+       cpu_min[i] = 100;
+    }
+    
+    /* get information */
+#ifdef __FreeBSD__
+    getsysctl("kern.cp_time", new, sizeof(cp_time1));
+#else
+    getSysinfo((unsigned long*)new, CPUSTATES);
+#endif
+
+    /* catch Strg+C when capturing to call pcap_breakloop() */
+    memset(&signew, 0, sizeof(signew));
+    signew.sa_handler = loop_term_handler;
+    if (sigaction(SIGINT, &signew, &sigold) < 0 ){
+       fprintf(stderr, "Could not set signal handler -> exiting");
+    }
+   
+    avg = 0;
+    avg_run = 0;
+    
+    if ( runonce ) {
+        breakloop=1;
+    }
+
+    while(1) {
+       usleep( 1000000 );
+
+       if ( new == cp_time1 ) {
+           new = cp_time2;
+           old = cp_time1;
+       } else{
+           new = cp_time1;
+           old = cp_time2;
+       }
+       
+       /* get information again */
+#ifdef __FreeBSD__
+       getsysctl("kern.cp_time", new, sizeof(cp_time1));
+#else
+       getSysinfo((unsigned long*)new, CPUSTATES);
+#endif
+    
+       /* convert cp_time counts to percentages */
+       total = perc(CPUSTATES, new, old, cp_diff); 
+
+       /* check for avg measurement start */
+       if ( !avg_run && !avg && (cpu_perc[IDLEI] <= limit) ){
+           avg = 1;
+           for ( i = 0; i < CPUSTATES; i++ )
+               cp_avg_start[i] = new[i];
+       }
+
+       /* check for avg measurement stop */
+       if ( !avg_run && avg && (cpu_perc[IDLEI] > limit) ){
+           avg = 0;
+           for ( i = 0; i < CPUSTATES; i++ )
+               cp_avg_stop[i] = new[i];
+           avg_run = 1;
+       }
+
+       print_perc(cpu_perc, ""); 
+
+       if (breakloop) {
+           if (avg) {
+               avg = 0;
+               for ( i = 0; i < CPUSTATES; i++ )
+                   cp_avg_stop[i] = new[i];
+           }
+           break;
+       }
+    }
+  
+    /* Set default behaviour when loop is done */
+    if (sigaction(SIGINT, &sigold, &signew) < 0 ){
+       fprintf(stderr, "%s: Could not restore signal handler -> exiting", appname);
+    }
+
+    if ( ! runonce && output == 0) {
+       // print avg only when not making a one-shot msg and
+       // when not writing CSV output
+       printf("---Summary----\n");
+       
+       print_perc(cpu_min, "Min");
+
+       print_perc(cpu_max, "Max");
+
+       perc(CPUSTATES, cp_avg_start, cp_avg_stop, cp_diff); 
+
+       print_perc(cpu_perc, "Avg");
+    }
+    
+    return 0;
+}
+
+
+
diff --git a/utils/crypto-tools/Makefile b/utils/crypto-tools/Makefile
new file mode 100644 (file)
index 0000000..1bfcde4
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=crypto-tools
+PKG_VERSION:=20100325
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ocf-linux
+PKG_MD5SUM:=51e0ef8918a8cf15f78f0631341d826c
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_DEPENDS:=libopenssl ocf-crypto-headers
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/crypto-tools
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libopenssl
+  TITLE:=OCF-Linux's crypto-tools
+  URL:=http://ocf-linux.sourceforge.net/
+endef
+
+define Package/crypto-tools/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cryptotest $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cryptokeytest $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,crypto-tools))
diff --git a/utils/cryptsetup/Makefile b/utils/cryptsetup/Makefile
new file mode 100644 (file)
index 0000000..5793da5
--- /dev/null
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2006-2010 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:=cryptsetup
+PKG_VERSION:=1.6.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://cryptsetup.googlecode.com/files/
+PKG_MD5SUM:=cd834da49fbe92dd66df02cc5c61280f
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/cryptsetup/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Cryptsetup
+  DEPENDS:=+libblkid +libuuid +libpopt +lvm2 +libdevmapper +@KERNEL_DIRECT_IO
+  URL:=http://code.google.com/p/cryptsetup/
+endef
+
+define Package/cryptsetup
+$(call Package/cryptsetup/Default)
+  DEPENDS+=+libgcrypt
+  VARIANT:=gcrypt
+endef
+
+define Package/cryptsetup-openssl
+$(call Package/cryptsetup/Default)
+  TITLE+= (with openssl support)
+  DEPENDS+=+libopenssl
+  VARIANT:=openssl
+endef
+
+define Package/cryptsetup/Default/description
+       Cryptsetup-luks
+endef
+
+define Package/cryptsetup/description
+$(call Package/cryptsetup/Default/description)
+linked against libgcrypt
+endef
+
+
+define Package/cryptsetup-openssl/description
+$(call Package/cryptsetup/Default/description)
+linked against openssl
+endef
+
+ifeq ($(BUILD_VARIANT),openssl)
+CONFIGURE_ARGS+= \
+        --with-crypto_backend=openssl
+endif
+
+define Package/cryptsetup/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/src/.libs/cryptsetup $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/.libs/libcryptsetup.so* $(1)/usr/lib
+endef
+
+Package/cryptsetup-openssl/install = $(Package/cryptsetup/install)
+
+$(eval $(call BuildPackage,cryptsetup))
+$(eval $(call BuildPackage,cryptsetup-openssl))
diff --git a/utils/cwiid/Makefile b/utils/cwiid/Makefile
new file mode 100644 (file)
index 0000000..d7adf6e
--- /dev/null
@@ -0,0 +1,107 @@
+#
+# Copyright (C) 2010-2014 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:=cwiid
+PKG_VERSION:=0.6.00
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://abstrakraft.org/cwiid/downloads/
+PKG_SOURCE_VERSION:=2100f14c612471084434b364501e3818c7f4144e
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/cwiid/Default
+  TITLE:=Linux Nintendo Wiimote interface
+  URL:=http://abstrakraft.org/cwiid/
+endef
+
+define Package/libcwiid
+$(call Package/cwiid/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (library)
+  DEPENDS+= +bluez-libs +libpthread +librt
+endef
+
+define Package/wminput
+$(call Package/cwiid/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= (utility)
+  DEPENDS+= +libcwiid
+endef
+
+define Package/python-cwiid
+$(call Package/cwiid/Default)
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python bindings for the cwiid libs
+  DEPENDS:= +python-mini +libcwiid
+endef
+
+CONFIGURE_ARGS += \
+       --without-python \
+       --disable-ldconfig \
+       --enable-shared \
+       --enable-static \
+
+TARGET_CFLAGS += $(FPIC)
+TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/libcwiid/
+TARGET_LDFLAGS += -lpthread -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       ( cd $(PKG_BUILD_DIR) ; \
+               autoconf ; \
+       )
+endef
+
+define Build/Compile
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               CC="$(TARGET_CC) $(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS) -L../libcwiid/" \
+               all
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,./python/, \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/libcwiid/*.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libcwiid/*.so $(1)/usr/lib/
+endef
+
+define Package/libcwiid/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libcwiid/libcwiid.so.1.0 $(1)/usr/lib/
+endef
+
+define Package/wminput/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/wminput/wminput $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/lswm/lswm $(1)/usr/bin/
+endef
+
+define PyPackage/python-cwiid/filespec
++|$(PYTHON_PKG_DIR)/cwiid.so
+endef
+
+$(eval $(call BuildPackage,libcwiid))
+$(eval $(call BuildPackage,wminput))
+$(eval $(call PyPackage,python-cwiid))
+$(eval $(call BuildPackage,python-cwiid))
diff --git a/utils/cwiid/patches/100-dump_gtk_wmdemo.patch b/utils/cwiid/patches/100-dump_gtk_wmdemo.patch
new file mode 100644 (file)
index 0000000..ebfdeeb
--- /dev/null
@@ -0,0 +1,69 @@
+Index: cwiid-0.6.00/Makefile.in
+===================================================================
+--- cwiid-0.6.00.orig/Makefile.in      2010-06-20 19:32:38.000000000 +0200
++++ cwiid-0.6.00/Makefile.in   2010-06-20 19:32:46.000000000 +0200
+@@ -3,7 +3,7 @@
+ include @top_builddir@/defs.mak
+ LIB_DIRS = libcwiid
+-BIN_DIRS = wmgui wminput lswm
++BIN_DIRS = wminput lswm
+ DOC_DIRS = man doc
+ ifdef PYTHON
+ BIND_DIRS = python
+Index: cwiid-0.6.00/configure.ac
+===================================================================
+--- cwiid-0.6.00.orig/configure.ac     2010-06-20 19:31:22.000000000 +0200
++++ cwiid-0.6.00/configure.ac  2010-06-20 19:31:35.000000000 +0200
+@@ -124,11 +124,6 @@
+ fi
+ AC_SUBST(LDCONFIG)
+-pkg_modules="gtk+-2.0 >= 2.0.0 gthread-2.0"
+-PKG_CHECK_MODULES([GTK], [$pkg_modules])
+-AC_SUBST(GTK_CFLAGS)
+-AC_SUBST(GTK_LIBS)
+-
+ AC_OUTPUT(
+       [Makefile]
+       [defs.mak]
+Index: cwiid-0.6.00/wminput/Makefile.in
+===================================================================
+--- cwiid-0.6.00.orig/wminput/Makefile.in      2010-06-20 19:47:06.000000000 +0200
++++ cwiid-0.6.00/wminput/Makefile.in   2010-06-20 19:47:13.000000000 +0200
+@@ -14,7 +14,7 @@
+       -DWMINPUT_CONFIG_DIR=\"$(WMINPUT_CONFIG_DIR)\" \
+       -DCWIID_PLUGINS_DIR=\"$(CWIID_PLUGINS_DIR)\"
+-LDLIBS += -lcwiid -ldl
++LDLIBS += -lcwiid -ldl -lbluetooth
+ LDFLAGS += -L@top_builddir@/libcwiid -rdynamic
+ INST_DIR = @bindir@
+Index: cwiid-0.6.00/lswm/Makefile.in
+===================================================================
+--- cwiid-0.6.00.orig/lswm/Makefile.in 2010-06-20 19:50:13.000000000 +0200
++++ cwiid-0.6.00/lswm/Makefile.in      2010-06-20 19:50:22.000000000 +0200
+@@ -8,7 +8,7 @@
+ CFLAGS += -I@top_builddir@/libcwiid
+ LDFLAGS += -L@top_builddir@/libcwiid
+-LDLIBS += -lcwiid
++LDLIBS += -lcwiid -lbluetooth
+ INST_DIR = @bindir@
+ include $(COMMON)/include/app.mak
+Index: cwiid-0.6.00/Makefile.in
+===================================================================
+--- cwiid-0.6.00.orig/Makefile.in      2010-06-20 19:53:45.000000000 +0200
++++ cwiid-0.6.00/Makefile.in   2010-06-20 19:53:54.000000000 +0200
+@@ -9,7 +9,7 @@
+ BIND_DIRS = python
+ endif
+-SUB_DIRS = $(LIB_DIRS) $(BIN_DIRS) $(DOC_DIRS) $(BIND_DIRS) wmdemo
++SUB_DIRS = $(LIB_DIRS) $(BIN_DIRS) $(DOC_DIRS) $(BIND_DIRS)
+ all install clean distclean uninstall: TARGET += $(MAKECMDGOALS)
+
diff --git a/utils/daemontools/Makefile b/utils/daemontools/Makefile
new file mode 100644 (file)
index 0000000..771e4c5
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+# Original port by FreeWRT project.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Alexander Tsvyashchenko      Created OpenWRT package as per Trac ticket 2497
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=daemontools
+PKG_VERSION:=0.76
+PKG_RELEASE:=1
+
+PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
+PKG_SOURCE_URL:=http://cr.yp.to/daemontools/
+PKG_MD5SUM:=1871af2453d6e464034968a0fbcb2bfc
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK += && mv $(PKG_BUILD_DIR)/../admin/* $(PKG_BUILD_DIR)/.. && rmdir $(PKG_BUILD_DIR)/../admin
+
+define Package/daemontools
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=
+  TITLE:=Tools for managing UNIX services
+  URL:=http://cr.yp.to/daemontools.html
+endef
+
+define Package/daemontools/description
+       Daemontools is a collection of tools for managing UNIX services by DJ Bernstein.
+endef
+
+define Build/Compile
+       cd $(PKG_BUILD_DIR) && \
+       TARGET_CC="$(TARGET_CC)" \
+       TARGET_CFLAGS="$(TARGET_CFLAGS)" \
+       TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
+       $(PKG_BUILD_DIR)/package/compile
+endef
+
+define Package/daemontools/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/command/* $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,daemontools))
diff --git a/utils/daemontools/patches/crosscompile.patch b/utils/daemontools/patches/crosscompile.patch
new file mode 100644 (file)
index 0000000..2abb466
--- /dev/null
@@ -0,0 +1,205 @@
+diff -urN daemontools-0.76/src/Makefile daemontools-0.76.new/src/Makefile
+--- daemontools-0.76/src/Makefile      2001-07-12 19:49:49.000000000 +0300
++++ daemontools-0.76.new/src/Makefile  2007-09-30 16:27:25.000000000 +0300
+@@ -101,9 +101,6 @@
+ uint64.h
+       ./compile deepsleep.c
+-direntry.h: choose compile direntry.h1 direntry.h2 trydrent.c
+-      ./choose c trydrent direntry.h1 direntry.h2 > direntry.h
+-
+ env.o: compile env.c env.h str.h
+       ./compile env.c
+@@ -151,29 +148,6 @@
+ fmt_ulong.o: compile fmt.h fmt_ulong.c
+       ./compile fmt_ulong.c
+-hasflock.h: choose compile hasflock.h1 hasflock.h2 load tryflock.c
+-      ./choose cl tryflock hasflock.h1 hasflock.h2 > hasflock.h
+-
+-hasmkffo.h: choose compile hasmkffo.h1 hasmkffo.h2 load trymkffo.c
+-      ./choose cl trymkffo hasmkffo.h1 hasmkffo.h2 > hasmkffo.h
+-
+-hassgact.h: choose compile hassgact.h1 hassgact.h2 load trysgact.c
+-      ./choose cl trysgact hassgact.h1 hassgact.h2 > hassgact.h
+-
+-hassgprm.h: choose compile hassgprm.h1 hassgprm.h2 load trysgprm.c
+-      ./choose cl trysgprm hassgprm.h1 hassgprm.h2 > hassgprm.h
+-
+-hasshsgr.h: chkshsgr choose compile hasshsgr.h1 hasshsgr.h2 load \
+-tryshsgr.c warn-shsgr
+-      ./chkshsgr || ( cat warn-shsgr; exit 1 )
+-      ./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h
+-
+-haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c
+-      ./choose cl trywaitp haswaitp.h1 haswaitp.h2 > haswaitp.h
+-
+-iopause.h: choose compile iopause.h1 iopause.h2 load trypoll.c
+-      ./choose clr trypoll iopause.h1 iopause.h2 > iopause.h
+-
+ iopause.o: compile iopause.c iopause.h select.h tai.h taia.h uint64.h
+       ./compile iopause.c
+@@ -265,7 +239,6 @@
+ rts: envdir envuidgid fghack matchtest multilog pgrphack \
+ readproctitle rts.tests setlock setuidgid softlimit supervise svc \
+ svok svscan svscanboot svstat tai64n tai64nlocal
+-      env - /bin/sh rts.tests 2>&1 | cat -v > rts
+ scan_ulong.o: compile scan.h scan_ulong.c
+       ./compile scan_ulong.c
+@@ -273,9 +246,6 @@
+ seek_set.o: compile seek.h seek_set.c
+       ./compile seek_set.c
+-select.h: choose compile select.h1 select.h2 trysysel.c
+-      ./choose c trysysel select.h1 select.h2 > select.h
+-
+ setlock: byte.a load setlock.o unix.a
+       ./load setlock unix.a byte.a 
+@@ -478,9 +448,6 @@
+ timestamp.o: compile tai.h taia.h timestamp.c timestamp.h uint64.h
+       ./compile timestamp.c
+-uint64.h: choose compile load tryulong64.c uint64.h1 uint64.h2
+-      ./choose clr tryulong64 uint64.h1 uint64.h2 > uint64.h
+-
+ unix.a: alloc.o alloc_re.o buffer.o buffer_0.o buffer_1.o buffer_2.o \
+ buffer_get.o buffer_put.o buffer_read.o buffer_write.o coe.o env.o \
+ error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o lock_exnb.o \
+diff -urN daemontools-0.76/src/conf-cc daemontools-0.76.new/src/conf-cc
+--- daemontools-0.76/src/conf-cc       2007-09-30 13:58:40.000000000 +0300
++++ daemontools-0.76.new/src/conf-cc   2007-09-30 15:15:32.000000000 +0300
+@@ -1,3 +1,3 @@
+-gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings
++$TARGET_CC $TARGET_CFLAGS -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -include errno.h
+ This will be used to compile .c files.
+diff -urN daemontools-0.76/src/conf-ld daemontools-0.76.new/src/conf-ld
+--- daemontools-0.76/src/conf-ld       2001-07-12 19:49:49.000000000 +0300
++++ daemontools-0.76.new/src/conf-ld   2007-09-30 15:15:42.000000000 +0300
+@@ -1,3 +1,3 @@
+-gcc -s
++$TARGET_CC -s $TARGET_LDFLAGS
+ This will be used to link .o files into an executable.
+diff -urN daemontools-0.76/src/direntry.h daemontools-0.76.new/src/direntry.h
+--- daemontools-0.76/src/direntry.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/direntry.h        2007-09-30 13:52:11.000000000 +0300
+@@ -0,0 +1,12 @@
++/* Public domain. */
++
++#ifndef DIRENTRY_H
++#define DIRENTRY_H
++
++/* sysdep: +dirent */
++
++#include <sys/types.h>
++#include <dirent.h>
++#define direntry struct dirent
++
++#endif
+diff -urN daemontools-0.76/src/hasflock.h daemontools-0.76.new/src/hasflock.h
+--- daemontools-0.76/src/hasflock.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/hasflock.h        2007-09-30 13:52:55.000000000 +0300
+@@ -0,0 +1,4 @@
++/* Public domain. */
++
++/* sysdep: +flock */
++#define HASFLOCK 1
+diff -urN daemontools-0.76/src/hasmkffo.h daemontools-0.76.new/src/hasmkffo.h
+--- daemontools-0.76/src/hasmkffo.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/hasmkffo.h        2007-09-30 13:53:16.000000000 +0300
+@@ -0,0 +1,4 @@
++/* Public domain. */
++
++/* sysdep: +mkfifo */
++#define HASMKFIFO 1
+diff -urN daemontools-0.76/src/hassgact.h daemontools-0.76.new/src/hassgact.h
+--- daemontools-0.76/src/hassgact.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/hassgact.h        2007-09-30 13:53:47.000000000 +0300
+@@ -0,0 +1,4 @@
++/* Public domain. */
++
++/* sysdep: +sigaction */
++#define HASSIGACTION 1
+diff -urN daemontools-0.76/src/hassgprm.h daemontools-0.76.new/src/hassgprm.h
+--- daemontools-0.76/src/hassgprm.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/hassgprm.h        2007-09-30 13:54:13.000000000 +0300
+@@ -0,0 +1,4 @@
++/* Public domain. */
++
++/* sysdep: +sigprocmask */
++#define HASSIGPROCMASK 1
+diff -urN daemontools-0.76/src/hasshsgr.h daemontools-0.76.new/src/hasshsgr.h
+--- daemontools-0.76/src/hasshsgr.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/hasshsgr.h        2007-09-30 13:54:41.000000000 +0300
+@@ -0,0 +1,3 @@
++/* Public domain. */
++
++/* sysdep: -shortsetgroups */
+diff -urN daemontools-0.76/src/haswaitp.h daemontools-0.76.new/src/haswaitp.h
+--- daemontools-0.76/src/haswaitp.h    1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/haswaitp.h        2007-09-30 13:54:57.000000000 +0300
+@@ -0,0 +1,4 @@
++/* Public domain. */
++
++/* sysdep: +waitpid */
++#define HASWAITPID 1
+diff -urN daemontools-0.76/src/iopause.h daemontools-0.76.new/src/iopause.h
+--- daemontools-0.76/src/iopause.h     1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/iopause.h 2007-09-30 13:55:14.000000000 +0300
+@@ -0,0 +1,20 @@
++/* Public domain. */
++
++#ifndef IOPAUSE_H
++#define IOPAUSE_H
++
++/* sysdep: +poll */
++#define IOPAUSE_POLL
++
++#include <sys/types.h>
++#include <poll.h>
++
++typedef struct pollfd iopause_fd;
++#define IOPAUSE_READ POLLIN
++#define IOPAUSE_WRITE POLLOUT
++
++#include "taia.h"
++
++extern void iopause(iopause_fd *,unsigned int,struct taia *,struct taia *);
++
++#endif
+diff -urN daemontools-0.76/src/select.h daemontools-0.76.new/src/select.h
+--- daemontools-0.76/src/select.h      1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/select.h  2007-09-30 13:55:32.000000000 +0300
+@@ -0,0 +1,13 @@
++/* Public domain. */
++
++#ifndef SELECT_H
++#define SELECT_H
++
++/* sysdep: +sysselect */
++
++#include <sys/types.h>
++#include <sys/time.h>
++#include <sys/select.h>
++extern int select();
++
++#endif
+diff -urN daemontools-0.76/src/uint64.h daemontools-0.76.new/src/uint64.h
+--- daemontools-0.76/src/uint64.h      1970-01-01 03:00:00.000000000 +0300
++++ daemontools-0.76.new/src/uint64.h  2007-09-30 13:55:54.000000000 +0300
+@@ -0,0 +1,10 @@
++/* Public domain. */
++
++#ifndef UINT64_H
++#define UINT64_H
++
++/* sysdep: -ulong64 */
++
++typedef unsigned long long uint64;
++
++#endif
diff --git a/utils/daemontools/patches/svscanboot.patch b/utils/daemontools/patches/svscanboot.patch
new file mode 100644 (file)
index 0000000..ae59ea7
--- /dev/null
@@ -0,0 +1,16 @@
+--- daemontools-0.76/src/svscanboot.sh.orig    2007-01-27 11:49:38.000000000 +0100
++++ daemontools-0.76/src/svscanboot.sh 2007-01-27 11:52:07.000000000 +0100
+@@ -1,11 +1,11 @@
+-PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
++PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ exec </dev/null
+ exec >/dev/null
+ exec 2>/dev/null
+-/command/svc -dx /service/* /service/*/log
++/usr/bin/svc -dx /service/* /service/*/log
+ env - PATH=$PATH svscan /service 2>&1 | \
+ env - PATH=$PATH readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................
diff --git a/utils/dash/Makefile b/utils/dash/Makefile
new file mode 100644 (file)
index 0000000..1a88db4
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# 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:=dash
+PKG_VERSION:=0.5.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://gondor.apana.org.au/~herbert/dash/files
+PKG_MD5SUM:=f6cedb10ae7258adb5ab17a10ae80d51
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dash
+  SECTION:=base
+  CATEGORY:=Base system
+  TITLE:=Debian Almquist shell
+  URL:=http://gondor.apana.org.au/~herbert/dash/
+endef
+
+define Package/dash/description
+ A small footprint, POSIX complied unix shell
+endef
+
+MAKE_FLAGS += \
+       AWK="awk"
+
+define Package/dash/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dash $(1)/bin/
+endef
+
+$(eval $(call BuildPackage,dash))
diff --git a/utils/deco/Makefile b/utils/deco/Makefile
new file mode 100644 (file)
index 0000000..294e21d
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006 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:=deco
+PKG_VERSION:=39
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/deco
+PKG_MD5SUM:=f77f60e8be0cae1f814cba1ef61bf4d0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/deco
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=Text-based, full featured file manager
+  URL:=http://deco.sourceforge.net/
+  SUBMENU:=filemanager
+endef
+
+define Package/deco/description
+       A clone of Norton Commander for Unix. Text-based, full featured
+       file manager.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/deco/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/deco $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib/deco
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/menu $(1)/usr/lib/deco/menu
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/profile $(1)/usr/lib/deco/profile
+endef
+
+$(eval $(call BuildPackage,deco))
diff --git a/utils/deco/patches/100-tty.c.patch b/utils/deco/patches/100-tty.c.patch
new file mode 100644 (file)
index 0000000..f37e4e2
--- /dev/null
@@ -0,0 +1,11 @@
+--- src/tty.c  2005-09-25 00:23:41.671022039 -0700
++++ str_new/tty.c      2005-09-25 01:09:37.189119615 -0700
+@@ -14,7 +14,7 @@
+ #if HAVE_TERMIOS_H
+ #   include <sys/termios.h>
+ #   if HAVE_SYS_IOCTL_H
+-#      include <sys/ioctl.h>
++/*#      include <sys/ioctl.h>*/
+ #   endif
+ #   define HAVE_TERMIO_H 1
+ #   define termio termios
diff --git a/utils/devio/Makefile b/utils/devio/Makefile
new file mode 100644 (file)
index 0000000..f632c62
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2007 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:=devio
+PKG_VERSION:=1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/devio
+PKG_MD5SUM:=5d332c2bffc0791367bcf3368ba1a0d1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/devio
+  SUBMENU:=disc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=correctly read (or write) a region of a block device
+  URL:=http://sourceforge.net/projects/devio/
+endef
+
+define Package/devio/description
+       A command line program to correctly read (or write) a region of a block device.
+       Primary use is for extracting formatted data from MTD partitions.
+endef
+
+define Package/devio/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/devio $(1)/usr/sbin
+endef
+
+$(eval $(call BuildPackage,devio))
diff --git a/utils/devmem2/Makefile b/utils/devmem2/Makefile
new file mode 100644 (file)
index 0000000..baa1337
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2010 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:=devmem2
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/devmem2
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Simple program to read/write from memory.
+endef
+
+define Package/devmem2/description
+  Simple program to read/write from/to any location in memory.
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Package/devmem2/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/devmem2 $(1)/usr/sbin/devmem2
+endef
+
+$(eval $(call BuildPackage,devmem2))
diff --git a/utils/devmem2/src/Makefile b/utils/devmem2/src/Makefile
new file mode 100644 (file)
index 0000000..1db49ca
--- /dev/null
@@ -0,0 +1,13 @@
+OBJ = devmem2.o
+
+all: compile
+
+%.o: %.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+compile: $(OBJ)
+       $(CC) -o devmem2 $(LDFLAGS) $(OBJ)
+
+clean:
+       rm -f *.o *.so devmem2
+
diff --git a/utils/devmem2/src/devmem2.c b/utils/devmem2/src/devmem2.c
new file mode 100644 (file)
index 0000000..0c1b5b3
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * devmem2.c: Simple program to read/write from/to any location in memory.
+ *
+ *  Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
+ *
+ *
+ * This software has been developed for the LART computing board
+ * (http://www.lart.tudelft.nl/). The development has been sponsored by
+ * the Mobile MultiMedia Communications (http://www.mmc.tudelft.nl/)
+ * and Ubiquitous Communications (http://www.ubicom.tudelft.nl/)
+ * projects.
+ *
+ * The author can be reached at:
+ *
+ *  Jan-Derk Bakker
+ *  Information and Communication Theory Group
+ *  Faculty of Information Technology and Systems
+ *  Delft University of Technology
+ *  P.O. Box 5031
+ *  2600 GA Delft
+ *  The Netherlands
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <termios.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+  
+#define FATAL do { fprintf(stderr, "Error at line %d, file %s (%d) [%s]\n", \
+  __LINE__, __FILE__, errno, strerror(errno)); exit(1); } while(0)
+#define MAP_SIZE 4096UL
+#define MAP_MASK (MAP_SIZE - 1)
+
+int main(int argc, char **argv) {
+       int fd;
+       void *map_base, *virt_addr; 
+       unsigned long read_result, writeval;
+       off_t target;
+       int access_type = 'w';
+       
+       if(argc < 2) {
+               fprintf(stderr, "\nUsage:\t%s { address } [ type [ data ] ]\n"
+                       "\taddress : memory address to act upon\n"
+                       "\ttype : access operation type : [b]yte, [h]alfword, [w]ord\n"
+                       "\tdata : data to be written\n\n",
+                       argv[0]);
+               exit(1);
+       }
+       target = strtoul(argv[1], 0, 0);
+
+       if(argc > 2)
+               access_type = tolower(argv[2][0]);
+
+
+       if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;
+       printf("/dev/mem opened.\n"); 
+       fflush(stdout);
+       
+       /* Map one page */
+       map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK);
+       if(map_base == (void *) -1) FATAL;
+       printf("Memory mapped at address %p.\n", map_base); 
+       fflush(stdout);
+       
+       virt_addr = map_base + (target & MAP_MASK);
+       switch(access_type) {
+               case 'b':
+                       read_result = *((unsigned char *) virt_addr);
+                       break;
+               case 'h':
+                       read_result = *((unsigned short *) virt_addr);
+                       break;
+               case 'w':
+                       read_result = *((unsigned long *) virt_addr);
+                       break;
+               default:
+                       fprintf(stderr, "Illegal data type '%c'.\n", access_type);
+                       exit(2);
+       }
+       printf("Value at address 0x%lX (%p): 0x%lX\n", target, virt_addr, read_result); 
+       fflush(stdout);
+
+       if(argc > 3) {
+               writeval = strtoul(argv[3], 0, 0);
+               switch(access_type) {
+                       case 'b':
+                               *((unsigned char *) virt_addr) = writeval;
+                               read_result = *((unsigned char *) virt_addr);
+                               break;
+                       case 'h':
+                               *((unsigned short *) virt_addr) = writeval;
+                               read_result = *((unsigned short *) virt_addr);
+                               break;
+                       case 'w':
+                               *((unsigned long *) virt_addr) = writeval;
+                               read_result = *((unsigned long *) virt_addr);
+                               break;
+               }
+               printf("Written 0x%lX; readback 0x%lX\n", writeval, read_result); 
+               fflush(stdout);
+       }
+       
+       if(munmap(map_base, MAP_SIZE) == -1) FATAL;
+       close(fd);
+       return 0;
+}
+
+
diff --git a/utils/dfu-util/Makefile b/utils/dfu-util/Makefile
new file mode 100644 (file)
index 0000000..f587934
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006 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:=dfu-util
+PKG_VERSION:=r3095
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://sources.nslu2-linux.org/sources
+PKG_MD5SUM:=2346dddceeab0e7090109f04d9c3a6be
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dfu-util
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=OpenMoko device flash utility
+  URL:=http://wiki.openmoko.org/wiki/Dfu-util
+  DEPENDS:=+libusb-compat
+endef
+
+define Package/dfu-util/description
+       Dfu-util is a program that implements the host side of the USB DFU
+       (Universal Serial Bus Device Firmware Upgrade) protocol.
+       This version is specifically used to flash the FIC Neo 1973 mobile phone.
+endef
+
+# CONFIGURE_VARS += USB_CFLAGS="-I $(STAGING_DIR)/usr/include" \
+#                USB_LIBS="-L $(STAGING_DIR)/usr/lib"
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
+               ./autogen.sh \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Package/dfu-util/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dfu-util $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,dfu-util))
diff --git a/utils/dfu-util/patches/001-no_static_binary.patch b/utils/dfu-util/patches/001-no_static_binary.patch
new file mode 100644 (file)
index 0000000..2efa15e
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN dfu-util/src/Makefile.am dfu-util.new/src/Makefile.am
+--- dfu-util/src/Makefile.am   2007-10-06 23:36:18.000000000 +0200
++++ dfu-util.new/src/Makefile.am       2012-07-30 15:13:04.020948991 +0200
+@@ -6,7 +6,7 @@
+       '\n#endif' > dfu-version.h
+ BUILT_SOURCES = dfu-version.h
+-bin_PROGRAMS = dfu-util dfu-util_static
++bin_PROGRAMS = dfu-util
+ dfu_util_SOURCES = main.c sam7dfu.c dfu.c dfu.h
+ dfu_util_static_SOURCES = main.c sam7dfu.c dfu.c dfu.h
diff --git a/utils/dialog/Makefile b/utils/dialog/Makefile
new file mode 100644 (file)
index 0000000..8c4737a
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2006-2014 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:=dialog
+PKG_VERSION:=1.1-20120706
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=ftp://invisible-island.net/dialog
+PKG_MD5SUM:=2e538305977178eb085a9859511c299d
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dialog
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=Dialog
+  URL:=http://invisible-island.net/dialog/
+endef
+
+define Package/dialog/description
+ A script-interpreter which provides a set of curses widgets.
+endef
+
+define Package/dialog/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dialog $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,dialog))
diff --git a/utils/dialog/patches/001-cross_compile.patch b/utils/dialog/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..f2f079f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure
++++ b/configure
+@@ -11827,7 +11827,7 @@ linux*)
+               if test -d /lib64
+               then
+-if test -n "/lib64" ; then
++if test -n "/lib64" -a test $cross_compiling = "no"; then
+   for cf_add_libdir in /lib64
+   do
+     if test $cf_add_libdir = /usr/lib ; then
diff --git a/utils/digitemp/Makefile b/utils/digitemp/Makefile
new file mode 100644 (file)
index 0000000..2381581
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (C) 2009-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:=digitemp
+PKG_VERSION:=3.6.0
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.digitemp.com/software/linux
+PKG_MD5SUM:=9be2e48db37920f21925ae6e88f83b84
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/digitemp/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=DigiTemp is a simple to use program for reading values from 1-wire devices.
+  URL:=http://www.digitemp.com
+endef
+
+define Package/digitemp/Default/description
+       DigiTemp is a simple to use program for reading values from 1-wire devices.
+       Its main use is for reading temperature sensors, but it also reads counters,
+       and understands the 1-wire hubs with devices on different branches of the network.
+endef
+
+define Package/digitemp
+$(call Package/digitemp/Default)
+  TITLE += (serial version)
+endef
+
+define Package/digitemp/description
+$(call Package/digitemp/Default/description)
+       This package is build without USB support.
+endef
+
+define Package/digitemp-usb
+$(call Package/digitemp/Default)
+  TITLE += (USB version)
+  DEPENDS += +libusb-compat
+endef
+
+define Package/digitemp-usb/description
+$(call Package/digitemp/Default/description)
+       This package is build with USB support.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -DLINUX $(TARGET_CPPFLAGS) \
+                       -I./src -I./userial" \
+               LIBS="$(TARGET_LDFLAGS)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               ds9097 ds9097u
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -DLINUX $(TARGET_CPPFLAGS) \
+                       -I./src -I./userial -DOWUSB" \
+               LIBS="$(TARGET_LDFLAGS) -lusb -lm -DOWUSB" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               clean ds2490
+endef
+
+define Package/digitemp/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/digitemp_{DS9097,DS9097U} $(1)/usr/bin/
+endef
+
+define Package/digitemp-usb/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(CP) $(PKG_BUILD_DIR)/digitemp_DS2490 $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,digitemp))
+$(eval $(call BuildPackage,digitemp-usb))
diff --git a/utils/dir300-flash/Makefile b/utils/dir300-flash/Makefile
new file mode 100644 (file)
index 0000000..c271212
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2008 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:=dir300-flash
+PKG_VERSION:=0.9.9
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://x-alina.freifunk-potsdam.de/downloads/dir300-flash
+PKG_MD5SUM:=84ad98c36393d7d238a229da67e23903
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dir300-flash
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Flashes a custom firmware on the DIR-300 wireless router
+  URL:=http://x-alina.freifunk-potsdam.de/
+  PKGARCH:=all
+endef
+
+define Download/ap61.ram
+  URL:=http://www.dd-wrt.com/dd-wrtv2/downloads/v24/Atheros%20WiSoc/Airlink%20101%20AR430W
+  FILE:=ap61.ram
+  MD5SUM:=4aaec2bff1edffe8c49003ed9363ad8b
+endef
+
+define Download/ap61.rom
+  URL:=http://www.dd-wrt.com/dd-wrtv2/downloads/v24/Atheros%20WiSoc/Airlink%20101%20AR430W
+  FILE:=ap61.rom
+  MD5SUM:=eb7817d202c297ae5dc6b6b897632601
+endef
+
+define Download/dir300redboot.zip
+  URL:=http://www.shadowandy.net/wp/wp-content/uploads
+  FILE:=dir300redboot.zip
+  MD5SUM:=5fdb24432aa200b508026215d821e126
+endef
+
+define Build/Compile
+       unzip -n '$(DL_DIR)/dir300redboot.zip' -d '$(PKG_BUILD_DIR)'
+endef
+
+define Package/dir300-flash/install
+       $(INSTALL_DIR) -- '$(1)/usr/sbin'
+       $(INSTALL_BIN) -- '$(PKG_BUILD_DIR)/dir300-flash.sh' '$(1)/usr/sbin/dir300-flash'
+       $(INSTALL_DIR) -- '$(1)/usr/share/dir300-flash'
+       $(INSTALL_DATA) -- '$(DL_DIR)/ap61.ram' '$(1)/usr/share/dir300-flash'
+       $(INSTALL_DATA) -- '$(DL_DIR)/ap61.rom' '$(1)/usr/share/dir300-flash'
+       $(INSTALL_DATA) -- '$(PKG_BUILD_DIR)/dir300redboot.rom' '$(1)/usr/share/dir300-flash'
+endef
+
+$(eval $(call BuildPackage,dir300-flash))
+$(eval $(call Download,ap61.ram))
+$(eval $(call Download,ap61.rom))
+$(eval $(call Download,dir300redboot.zip))
diff --git a/utils/disktype/Makefile b/utils/disktype/Makefile
new file mode 100644 (file)
index 0000000..667efde
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2010 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:=disktype
+PKG_VERSION:=9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)/
+PKG_MD5SUM:=25a673f162b9c01cd565109202559489
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/disktype
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Disk format detection
+  SUBMENU:=Filesystem
+  URL:=http://disktype.sourceforge.net
+endef
+
+define Package/disktype/description
+       The purpose of disktype is to detect the content format of a disk or disk image.
+       It knows about common file systems, partition tables, and boot codes.
+       The program is written in C and is designed to compile on any modern Unix flavour.
+       It is self-contained and in general works without special libraries or headers.
+       Some system-dependant features can be used to gather additional information.
+endef
+
+MAKE_FLAGS += CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+
+define Package/disktype/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,disktype))
diff --git a/utils/dosfstools/Makefile b/utils/dosfstools/Makefile
new file mode 100644 (file)
index 0000000..0f04c36
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2006-2012 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:=dosfstools
+PKG_VERSION:=3.0.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fossies.org/linux/misc
+PKG_MD5SUM:=4c1f1e72b82371704f93ebdd3c7b6259
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dosfstools/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.daniel-baumann.ch/software/dosfstools/
+  SUBMENU:=Filesystem
+endef
+
+define Package/dosfsck
+  $(call Package/dosfstools/Default)
+  TITLE:=dosfsck
+endef
+
+define Package/dosfslabel
+  $(call Package/dosfstools/Default)
+  TITLE:=dosfslabel
+endef
+
+define Package/mkdosfs
+  $(call Package/dosfstools/Default)
+  TITLE:=mkdosfs
+endef
+
+define Package/dosfsck/description
+       Utilities to create and check MS-DOS FAT filesystems.
+       (fsck.vfat and fsck.msdos for checking integrity of FAT volumes)
+endef
+
+define Package/dosfslabel/description
+       Utilities to create and check MS-DOS FAT filesystems.
+       (dosfslabel for reading and writing labels of FAT volumes)
+endef
+
+define Package/mkdosfs/description
+       Utilities to create and check MS-DOS FAT filesystems.
+       (mkfs.vfat and mkfs.msdos for creating FAT volumes)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               OPTFLAGS="$(TARGET_CFLAGS) -D_FILE_OFFSET_BITS=64" \
+               PREFIX="/usr" \
+               SBINDIR="/usr/sbin" \
+               all
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               OPTFLAGS="$(TARGET_CFLAGS) -D_FILE_OFFSET_BITS=64" \
+               PREFIX="$(PKG_INSTALL_DIR)/usr" \
+               SBINDIR="$(PKG_INSTALL_DIR)/usr/sbin" \
+               install-bin
+endef
+
+define Package/dosfsck/install
+       $(INSTALL_DIR) $(1)/lib/functions/fsck
+       $(INSTALL_DATA) ./files/dosfsck.sh $(1)/lib/functions/fsck/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dosfsck $(1)/usr/sbin/
+       (cd $(1)/usr/sbin; ln -sf dosfsck fsck.msdos; ln -sf dosfsck fsck.vfat)
+endef
+
+define Package/dosfslabel/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dosfslabel $(1)/usr/sbin/
+endef
+
+define Package/mkdosfs/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mkdosfs $(1)/usr/sbin/
+       (cd $(1)/usr/sbin; ln -sf mkdosfs mkfs.msdos; ln -sf mkdosfs mkfs.vfat)
+endef
+
+$(eval $(call BuildPackage,dosfsck))
+$(eval $(call BuildPackage,dosfslabel))
+$(eval $(call BuildPackage,mkdosfs))
diff --git a/utils/dosfstools/files/dosfsck.sh b/utils/dosfstools/files/dosfsck.sh
new file mode 100644 (file)
index 0000000..bcc29b9
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright 2010 Vertical Communications
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+fsck_dosfsck() {
+       dosfsck -p "$device" 2>&1 | logger -t "fstab: dosfsck ($device)"
+       local status="$?"
+       case "$status" in
+               0|1) ;; #success
+               2) reboot;;
+               4) echo "dosfsck ($device): Warning! Uncorrected errors."| logger -t fstab
+                       return 1
+                       ;;
+               *) echo "dosfsck ($device): Error $status. Check not complete."| logger -t fstab;;
+       esac
+       return 0
+}
+
+fsck_dos() {
+       fsck_dosfsck "$@"
+}
+
+fsck_vfat() {
+       fsck_dosfsck "$@"
+}
+
+append libmount_known_fsck "dos"
+append libmount_known_fsck "vfat"
diff --git a/utils/dosfstools/patches/002-linux_26_headers.patch b/utils/dosfstools/patches/002-linux_26_headers.patch
new file mode 100644 (file)
index 0000000..b55a7c8
--- /dev/null
@@ -0,0 +1,54 @@
+--- a/src/common.h
++++ b/src/common.h
+@@ -19,7 +19,7 @@
+    can be found in /usr/share/common-licenses/GPL-3 file.
+ */
+-#include <asm/types.h>
++#include <linux/types.h>
+ #ifndef _COMMON_H
+ #define _COMMON_H
+--- a/src/dosfsck.h
++++ b/src/dosfsck.h
+@@ -31,7 +31,7 @@
+ #define _LINUX_STRING_H_      /* hack to avoid inclusion of <linux/string.h> */
+ #define _LINUX_FS_H           /* hack to avoid inclusion of <linux/fs.h> */
+-#include <asm/types.h>
++#include <linux/types.h>
+ #include <asm/byteorder.h>
+ #include <linux/msdos_fs.h>
+--- a/src/file.c
++++ b/src/file.c
+@@ -33,7 +33,7 @@
+ #define _LINUX_STRING_H_      /* hack to avoid inclusion of <linux/string.h> */
+ #define _LINUX_FS_H           /* hack to avoid inclusion of <linux/fs.h> */
+-#include <asm/types.h>
++#include <linux/types.h>
+ #include <linux/msdos_fs.h>
+--- a/src/io.c
++++ b/src/io.c
+@@ -39,6 +39,7 @@
+ #include <sys/ioctl.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <linux/types.h>
+ #include <linux/fd.h>
+ #include "dosfsck.h"
+--- a/src/mkdosfs.c
++++ b/src/mkdosfs.c
+@@ -63,7 +63,7 @@
+ #include <time.h>
+ #include <errno.h>
+-#include <asm/types.h>
++#include <linux/types.h>
+ #if __BYTE_ORDER == __BIG_ENDIAN
diff --git a/utils/dstat/Makefile b/utils/dstat/Makefile
new file mode 100644 (file)
index 0000000..c05d405
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2012 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:=dstat
+PKG_VERSION:=0.7.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://dag.wieers.com/home-made/dstat/
+PKG_MD5SUM:=bfea4dc8037a0b18fc40a4dfc104dcc8
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dstat
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Versatile resource statistics tool
+  URL:=http://dag.wieers.com/home-made/dstat/
+  DEPENDS:=+python
+endef
+
+define Package/dstat/description
+  Dstat is a versatile replacement for vmstat, iostat, netstat
+  and ifstat. Dstat overcomes some of their limitations and
+  adds some extra features, more counters and flexibility.
+  Dstat is handy for monitoring systems during performance
+  tuning tests, benchmarks or troubleshooting.
+endef
+
+define Build/Compile
+endef
+
+define Package/dstat/install
+       $(INSTALL_DIR) $(1)/usr/share/dstat
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dstat $(1)/usr/share/dstat/dstat.py
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/plugins/dstat_*.py $(1)/usr/share/dstat/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(LN) -sf ../share/dstat/dstat.py $(1)/usr/bin/dstat
+endef
+
+$(eval $(call BuildPackage,dstat))
diff --git a/utils/dt/Makefile b/utils/dt/Makefile
new file mode 100644 (file)
index 0000000..d3a0147
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2009 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:=dt
+PKG_VERSION:=15.14
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-source.tar.gz
+PKG_SOURCE_URL:=http://home.comcast.net/~SCSIguy/SCSI_FAQ/RMiller_Tools/ftp/$(PKG_NAME)/
+PKG_MD5SUM:=5776233a2d301a50b314306538257a45
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK= \
+       zcat $(DL_DIR)/$(PKG_SOURCE) | \
+               $(TAR) -C $(PKG_BUILD_DIR) --strip-components 2 $(TAR_OPTIONS);
+
+define Package/dt
+  CATEGORY:=Utilities
+  SECTION:=utils
+  TITLE:=A generic data test program
+  URL:=http://www.scsifaq.org/RMiller_Tools/index.html
+  DEPENDS:=+libpthread +librt
+endef
+
+define Package/dt/description
+ dt is a generic data test program used to verify proper operation of peripherals,
+ file systems, device drivers, or any data stream supported by the operating system.
+ In its' simplest mode of operation, dt writes and then verifys its' default data pattern,
+ then displays performance statisics and other test parameters before exiting.
+ Since verification of data is performed, dt can be thought of as a generic diagnostic tool.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.linux \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -DFIFO -DMMAP -DTTY -D__linux__ -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" \
+               dt
+endef
+
+define Package/dt/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dt $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,dt))
diff --git a/utils/dtach/Makefile b/utils/dtach/Makefile
new file mode 100644 (file)
index 0000000..5d01d28
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2006 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:=dtach
+PKG_VERSION:=0.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/dtach
+PKG_MD5SUM:=ec5999f3b6bb67da19754fcb2e5221f3
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dtach
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A program that emulates the dtach feature of screen
+  URL:=http://dtach.sourceforge.net/
+endef
+
+define Package/dtach/description
+       dtach is a tiny program that emulates the detach feature of screen,
+       allowing you to run a program in an environment that is protected from
+       the controlling terminal and attach to it later. dtach does not keep
+       track of the contents of the screen, and thus works best with programs
+       that know how to redraw themselves.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/dtach/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dtach $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,dtach))
diff --git a/utils/empty/Makefile b/utils/empty/Makefile
new file mode 100644 (file)
index 0000000..9c3b3c9
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2007 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:=empty
+PKG_VERSION:=0.6.18b
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/empty
+PKG_MD5SUM:=2cf5e1b8ff58c41b63738bdc7c24fbc2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/empty
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Run applications under pseudo-terminal sessions
+  URL:=http://empty.sourceforge.net
+endef
+
+define Package/empty/description
+ empty is an utility that provides an interface to execute and/or interact
+ with processes under pseudo-terminal sessions (PTYs). This tool is
+ definitely useful in programming of shell scripts designed to communicate
+ with interactive programs like telnet, ssh, ftp, etc. In some cases, empty
+ can be the simplest replacement for TCL/expect or other similar
+ programming tools.
+endef
+
+define Package/empty/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,empty))
diff --git a/utils/event_test/Makefile b/utils/event_test/Makefile
new file mode 100644 (file)
index 0000000..a72fd26
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2008 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:=event_test
+PKG_VERSION:=0.01
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/event_test
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/event_test
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Event device test program
+endef
+
+define Package/event_test/description
+ This package contains an utility for testing event devices.
+endef
+
+define Build/Prepare
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Package/event_test/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/event_test $(1)/sbin/
+endef
+
+$(eval $(call BuildPackage,event_test))
diff --git a/utils/event_test/src/Makefile b/utils/event_test/src/Makefile
new file mode 100644 (file)
index 0000000..74eedbf
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under GNU General Public Licese v2.
+# See /LICENSE for more information.
+#
+
+all: event_test
+
+%.o: %.c
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $^
+
+event_test: evtest.o
+       $(CC) -o $@ $^
+
+clean:
+       rm -f *.o event_test
diff --git a/utils/event_test/src/evtest.c b/utils/event_test/src/evtest.c
new file mode 100644 (file)
index 0000000..b62209b
--- /dev/null
@@ -0,0 +1,309 @@
+/*
+ *
+ *  Copyright (c) 1999-2000 Vojtech Pavlik
+ *
+ *  As modified by Rene van Paassen, May 19, 2005
+ *  Event device test program
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or 
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * 
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <linux/input.h>
+#include <linux/version.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+char *events[EV_MAX + 1] = { "Reset", "Key", "Relative", "Absolute", "MSC", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", "Power", "ForceFeedbackStatus"};
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 0)
+
+/* Keys updated with version 2.6.11, am assuming this is 2.6 style */
+char *keys[KEY_MAX + 1] = 
+  { "Reserved", "Esc", /* 0, 1 */
+    "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", /* 2 - 11 */
+    "Minus", "Equal", "Backspace", "Tab", /* 12 - 15 */
+    "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", /* 16 - 25 */
+    "LeftBrace", "RightBrace", "Enter", "LeftControl", /* 26 - 29 */
+    "A", "S", "D", "F", "G", "H", "J", "K", "L", /* 30 - 38 */
+    "Semicolon", "Apostrophe", "Grave", "LeftShift", "BackSlash", /* 39 - 43 */
+    "Z", "X", "C", "V", "B", "N", "M",  /* 44 - 50 */
+    "Comma", "Dot", "Slash", "RightShift", "KPAsterisk", 
+    "LeftAlt", "Space", "CapsLock",  /* 51 - 58 */
+    "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", /* 59 - 68 */
+    "NumLock", "ScrollLock", /* 69, 70 */
+    "KP7", "KP8", "KP9", "KPMinus", /* 71 - 74 */
+    "KP4", "KP5", "KP6", "KPPlus", /* 75 - 78 */
+    "KP1", "KP2", "KP3", "KP0", "KPDot", /* 79 - 83 */
+    NULL, 
+    "ZENKAKUHANKAKU", /* 85 */
+    "102nd", "F11", "F12", /* 86 - 88 */
+    "R0", "KATAKANA", "HIRAGANA", "HENKAN", /* 89 - 92 */
+    "KATAKANAHIRAGANA", "MUHENKAN", "KPJPCOMMA", /* 93 - 95 */
+    "KPEnter", "RightCtrl", "KPSlash", "SysRq", /* 96 - 99 */
+    "RightAlt", "LineFeed", /*100 - 101 */
+    "Home", "Up", "PageUp", "Left", "Right", "End", "Down", 
+    "PageDown", "Insert", "Delete", /* 102 - 111 */
+    "Macro", "Mute", "VolumeDown", "VolumeUp", "Power", /* 112 - 116 */
+    "KPEqual", "KPPlusMinus", "Pause", /* 117 - 119 */
+    NULL, 
+    "KPComma", /* 121 */
+    "Hanguel", "Hanja", "Yen", /* 122 - 124 */
+    "LeftMeta", "RightMeta", "Compose", /* 125 - 127 */
+    "Stop", "Again", "Props", "Undo", "Front", "Copy", "Open", 
+    "Paste", "Find", "Cut", "Help", "Menu", "Calc", "Setup",
+    "Sleep", "WakeUp", "File", "SendFile", "DeleteFile", "X-fer", 
+    "Prog1", "Prog2", "WWW", "MSDOS", "Coffee", "Direction",
+    "CycleWindows", "Mail", "Bookmarks", "Computer", 
+    "Back", "Forward", "CloseCD", "EjectCD", "EjectCloseCD", 
+    "NextSong", "PlayPause", "PreviousSong", "StopCD", 
+    "Record", "Rewind", "Phone", /* 128 - 169 */
+    "ISOKey", "Config", "HomePage", "Refresh", "Exit", 
+    "Move", "Edit", "ScrollUp", "ScrollDown", /* 170 - 178 */
+    "KPLeftParenthesis", "KPRightParenthesis", /* 179 - 180 */
+    NULL, NULL,
+    "F13", "F14", "F15", "F16", "F17", "F18", 
+    "F19", "F20", "F21", "F22", "F23", "F24", /* 183 - 194 */
+    NULL, NULL, NULL, NULL, NULL,
+    "PlayCD", "PauseCD", "Prog3", "Prog4", NULL, 
+    "Suspend", "Close", /* 200 - 206 */
+    "Play", "FastForward", "BassBoost", "Print", "HP", "Camera", 
+    "Sound", "Question", "Email", "Chat", "Search", 
+    "Connect", "Finance", "Sport", "Shop", "AltErase", 
+    "Cancel", "BrightnessDown", "BrightnessUp", "Media", /* 207 - 226 */
+    "SwitchVideoMode", 
+    "KBDIllumToggle", "KBDIllumDown", "KBDIllumUp", /* 227 - 230 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "Unknown", /* 240 */ 
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "Btn0", "Btn1", "Btn2", "Btn3", "Btn4", 
+    "Btn5", "Btn6", "Btn7", "Btn8", "Btn9", /* 256 - 265 */
+    NULL, NULL, NULL, NULL, NULL, NULL,
+    "LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", 
+    "ExtraBtn", "ForwardBtn", "BackBtn", "TaskBtn", /* 0x110 - 0x117 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", 
+    "TopBtn2", "PinkieBtn", "BaseBtn", "BaseBtn2", 
+    "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6",
+    NULL, NULL, NULL, "BtnDead", /* 0x120 - 0x12f */
+    "BtnA", "BtnB", "BtnC", "BtnX", 
+    "BtnY", "BtnZ", "BtnTL", "BtnTR", 
+    "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", 
+    "BtnMode", "BtnThumbL", "BtnThumbR", /* 0x130 - 0x13e */ NULL,
+    "ToolPen", "ToolRubber", "ToolBrush", "ToolPencil", 
+    "ToolAirbrush", "ToolFinger", "ToolMouse", "ToolLens", /* 0x140-0x147 */
+    NULL, NULL, "Touch", "Stylus", 
+    "Stylus2", "DoubleTap", "TripleTap", /* 0x14a - 0x14e */ NULL,
+    "GearUp", "GearDown", /* 0x150, 0x151 */
+    NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "Ok", "Select", "Goto", "Clear", "Power2", "Option", "Info", "Time",
+    "Vendor", "Archive", "Program", "Channel",
+    "Favorites", "Epg", "Pvr", "Mhp", 
+    "Language", "Title", "Subtitle", "Angle",
+    "Zoom", "Mode", "Keyboard", "Screen",
+    "Pc", "Tv", "Tv2", "Vcr", "Vcr2", "Sat", "Sat2", "Cd",
+    "Tape", "Radio", "Tuner", "Player", "Text", "Dvd", "Aux", "Mp3",
+    "Audio", "Video", "Directory", "List",
+    "Memo", "Calendar", "Red", "Green", 
+    "Yellow", "Blue", "Channelup", "Channeldown",
+    "First", "Last", "Ab", "Next", 
+    "Restart", "Slow", "Shuffle", "Break", 
+    "Previous", "Digits", "Teen", "Twen", /* 160 - 19f */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "DelEol", "DelEos", "InsLine", "DelLine", /* 1c0 - 1c3 */
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "FN", "FN_ESC", 
+    "FN_F1", "FN_F2", "FN_F3", "FN_F4", "FN_F5", 
+    "FN_F6", "FN_F7", "FN_F8", "FN_F9", "FN_F10", 
+    "FN_F11", "FN_F12", 
+    "FN_1", "FN_2", "FN_D", "FN_E", "FN_F", "FN_S", "FN_B" /* 0x1d0 - 0x1e4 */
+  };
+
+#else
+
+/* Keys I used with 2.4 kernels. */
+char *keys[KEY_MAX + 1] = { "Reserved", "Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Minus", "Equal", "Backspace",
+"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "LeftBrace", "RightBrace", "Enter", "LeftControl", "A", "S", "D", "F", "G",
+"H", "J", "K", "L", "Semicolon", "Apostrophe", "Grave", "LeftShift", "BackSlash", "Z", "X", "C", "V", "B", "N", "M", "Comma", "Dot",
+"Slash", "RightShift", "KPAsterisk", "LeftAlt", "Space", "CapsLock", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
+"NumLock", "ScrollLock", "KP7", "KP8", "KP9", "KPMinus", "KP4", "KP5", "KP6", "KPPlus", "KP1", "KP2", "KP3", "KP0", "KPDot", "103rd",
+"F13", "102nd", "F11", "F12", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "KPEnter", "RightCtrl", "KPSlash", "SysRq",
+"RightAlt", "LineFeed", "Home", "Up", "PageUp", "Left", "Right", "End", "Down", "PageDown", "Insert", "Delete", "Macro", "Mute",
+"VolumeDown", "VolumeUp", "Power", "KPEqual", "KPPlusMinus", "Pause", "F21", "F22", "F23", "F24", "KPComma", "LeftMeta", "RightMeta",
+"Compose", "Stop", "Again", "Props", "Undo", "Front", "Copy", "Open", "Paste", "Find", "Cut", "Help", "Menu", "Calc", "Setup",
+"Sleep", "WakeUp", "File", "SendFile", "DeleteFile", "X-fer", "Prog1", "Prog2", "WWW", "MSDOS", "Coffee", "Direction",
+"CycleWindows", "Mail", "Bookmarks", "Computer", "Back", "Forward", "CloseCD", "EjectCD", "EjectCloseCD", "NextSong", "PlayPause",
+"PreviousSong", "StopCD", "Record", "Rewind", "Phone", "ISOKey", "Config", "HomePage", "Refresh", "Exit", "Move", "Edit", "ScrollUp",
+"ScrollDown", "KPLeftParenthesis", "KPRightParenthesis",
+"International1", "International2", "International3", "International4", "International5",
+"International6", "International7", "International8", "International9",
+"Language1", "Language2", "Language3", "Language4", "Language5", "Language6", "Language7", "Language8", "Language9",
+NULL, 
+"PlayCD", "PauseCD", "Prog3", "Prog4", "Suspend", "Close",
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+"Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9",
+NULL, NULL,  NULL, NULL, NULL, NULL,
+"LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn",
+NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+"Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn",
+"BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6",
+NULL, NULL, NULL, "BtnDead",
+"BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", "BtnMode",
+"BtnThumbL", "BtnThumbR", NULL,
+"ToolPen", "ToolRubber", "ToolBrush", "ToolPencil", "ToolAirbrush", "ToolFinger", "ToolMouse", "ToolLens", NULL, NULL,
+"Touch", "Stylus", "Stylus2" };
+#endif
+
+char *absval[5] = { "Value", "Min  ", "Max  ", "Fuzz ", "Flat " };
+char *relatives[REL_MAX + 1] = 
+  { "X", "Y", "Z", NULL, 
+    NULL, NULL, "HWheel", "Dial", 
+    /* 0x08: */ "Wheel", "MISC" };
+char *absolutes[ABS_MAX + 1] = 
+  { "X", "Y", "Z", "Rx",  "Ry", "Rz", "Throttle", "Rudder", 
+    "Wheel", "Gas", "Brake", NULL, NULL, NULL, NULL, NULL,
+    /* 0x10: */ "Hat0X", "Hat0Y", "Hat1X", "Hat1Y", 
+    "Hat2X", "Hat2Y", "Hat3X", "Hat 3Y", 
+    "Pressure", "Distance", "XTilt", "YTilt", 
+    "ToolWidth", NULL, NULL, NULL, 
+    /* 0x20: */ "Volume", NULL, NULL, NULL, 
+    NULL, NULL, NULL, NULL, 
+    /* 0x28: */ "Misc" };
+char *leds[LED_MAX + 1] = { "NumLock", "CapsLock", "ScrollLock", "Compose", "Kana", "Sleep", "Suspend", "Mute" };
+char *repeats[REP_MAX + 1] = { "Delay", "Period" };
+char *sounds[SND_MAX + 1] = { "Bell", "Click" };
+
+char **names[EV_MAX + 1] = { events, keys, relatives, absolutes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+NULL, NULL, leds, sounds, NULL, repeats, NULL, NULL, NULL };
+
+#define BITS_PER_LONG (sizeof(long) * 8)
+#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
+#define OFF(x)  ((x)%BITS_PER_LONG)
+#define BIT(x)  (1UL<<OFF(x))
+#define LONG(x) ((x)/BITS_PER_LONG)
+#define test_bit(bit, array)   ((array[LONG(bit)] >> OFF(bit)) & 1)
+
+int main (int argc, char **argv)
+{
+       int fd, rd, i, j, k;
+       struct input_event ev[64];
+       int version;
+       unsigned short id[4];
+       unsigned long bit[EV_MAX][NBITS(KEY_MAX)];
+       char name[256] = "Unknown";
+       int abs[5];
+
+#if 0
+       for (i = 0; i < KEY_MAX; i++) {
+         printf("Key %d, name \"%s\"\n", i, keys[i] ? keys[i]: "?");
+       }
+#endif
+           
+       if (argc < 2) {
+               printf ("Usage: evtest /dev/inputX\n");
+               printf ("Where X = input device number\n");
+               exit (1);
+       }
+
+       if ((fd = open(argv[argc - 1], O_RDONLY)) < 0) {
+               perror("evtest");
+               exit(1);
+       }
+
+       ioctl(fd, EVIOCGVERSION, &version);
+       printf("Input driver version is %d.%d.%d\n",
+               version >> 16, (version >> 8) & 0xff, version & 0xff);
+
+       ioctl(fd, EVIOCGID, id);
+       printf("Input device ID: bus 0x%x vendor 0x%x product 0x%x version 0x%x\n",
+               id[ID_BUS], id[ID_VENDOR], id[ID_PRODUCT], id[ID_VERSION]);
+
+       ioctl(fd, EVIOCGNAME(sizeof(name)), name);
+       printf("Input device name: \"%s\"\n", name);
+
+       memset(bit, 0, sizeof(bit));
+       ioctl(fd, EVIOCGBIT(0, EV_MAX), bit[0]);
+       printf("Supported events:\n");
+
+       for (i = 0; i < EV_MAX; i++)
+    {
+               if (test_bit(i, bit[0])) 
+        {
+                       printf("  Event type %d (%s)\n", i, events[i] ? events[i] : "?");
+                       ioctl(fd, EVIOCGBIT(i, KEY_MAX), bit[i]);
+                       for (j = 0; j < KEY_MAX; j++) 
+            {
+                               if (test_bit(j, bit[i])) 
+                {
+                                       printf("    Event code %d (%s)\n", j, names[i] ? (names[i][j] ? names[i][j] : "?") : "?");
+                                       if (i == EV_ABS) 
+                    {
+                                               ioctl(fd, EVIOCGABS(j), abs);
+                                               for (k = 0; k < 5; k++)
+                        {
+                                                       if ((k < 3) || abs[k])
+                            {
+                                                               printf("      %s %6d\n", absval[k], abs[k]);
+                            }
+                        }
+                                       }
+                               }
+            }
+               }
+    }  
+
+       printf("Testing ... (interrupt to exit)\n");
+
+       while (1) 
+    {
+               rd = read(fd, ev, sizeof(struct input_event) * 64);
+
+               if (rd < (int) sizeof(struct input_event)) 
+        {
+                       printf("yyy\n");
+                       perror("\nevtest: error reading");
+                       exit (1);
+               }
+
+               for (i = 0; i < rd / sizeof(struct input_event); i++)
+        {
+                       printf("Event: time %ld.%06ld, type %d (%s), code %d (%s), value %d\n",
+                               ev[i].time.tv_sec, 
+                ev[i].time.tv_usec, 
+                ev[i].type,
+                               events[ev[i].type] ? events[ev[i].type] : "?",
+                               ev[i].code,
+                               names[ev[i].type] ? (names[ev[i].type][ev[i].code] ? names[ev[i].type][ev[i].code] : "?") : "?",
+                               ev[i].value);
+        }
+       }
+}
diff --git a/utils/fancontroled/Makefile b/utils/fancontroled/Makefile
new file mode 100644 (file)
index 0000000..c308800
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fancontroled
+PKG_VERSION:=0.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar
+PKG_SOURCE_URL:=http://code.lukaperkov.net/fancontroled/
+PKG_MD5SUM:=8c3a7efa99e58216ad4633d1e6ed1358
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fancontroled
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=fancontroled
+  DEPENDS:=+libsensors
+  URL:=http://fancontroled.lukaperkov.net/
+endef
+
+define Package/fancontroled/description
+       fancontroled is linux daemon written in C implementing a temperature dependent fan speed control.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       $(TARGET_CONFIGURE_OPTS) \
+       CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       INC_PATH="-I$(STAGING_DIR)/usr/include/ -I$(STAGING_DIR)/usr/lib/"
+
+       $(STRIP) $(PKG_BUILD_DIR)/$(PKG_NAME)
+
+       mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       install
+endef
+
+define Package/fancontroled/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/fancontroled.init $(1)/etc/init.d/fancontroled
+endef
+
+$(eval $(call BuildPackage,fancontroled))
diff --git a/utils/fancontroled/files/fancontroled.init b/utils/fancontroled/files/fancontroled.init
new file mode 100644 (file)
index 0000000..b872553
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh /etc/rc.common
+
+START=75
+STOP=75
+
+SERVICE_NAME="fancontroled"
+SERVICE_COMMAND="/usr/sbin/$SERVICE_NAME"
+SERVICE_PID_FILE="/var/run/$SERVICE_NAME.pid"
+
+TEMP_SENSOR_CHIP=lm75
+TEMP_READ_FIELD=temp1_input
+MIN_TEMP=30
+MAX_TEMP=50
+FAN_SENSOR_CHIP=g760a
+FAN_CONTROL_FIELD=pwm1
+PWM_FAN_MIN=1
+PWM_FAN_MAX=180
+
+start() {
+       service_start $SERVICE_COMMAND -t $TEMP_SENSOR_CHIP -r $TEMP_READ_FIELD -m $MIN_TEMP -M $MAX_TEMP -f $FAN_SENSOR_CHIP -c $FAN_CONTROL_FIELD -p $PWM_FAN_MIN -P $PWM_FAN_MAX -z $SERVICE_PID_FILE
+}
+
+stop() {
+       service_stop $SERVICE_COMMAND
+}
diff --git a/utils/firmwarehotplug/Makefile b/utils/firmwarehotplug/Makefile
new file mode 100644 (file)
index 0000000..22756cc
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006-2009 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:=firmwarehotplug
+PKG_VERSION:=0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/linux-hotplug
+PKG_MD5SUM:=e5cf352b172f498e27b160167b981f24
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+# workaround for fedora sdcc naming changes
+ifneq ($(wildcard /usr/libexec/sdcc),)
+  export PATH:=$(PATH):/usr/libexec
+endif
+
+define Package/firmwarehotplug
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=@USB_SUPPORT +fxload
+  TITLE:=Hotplug firmware for EZ-USB microcontrollers
+  URL:=http://linux-hotplug.sourceforge.net/
+endef
+
+MAKE_PATH:=ezusb/midi/original
+
+MAKE_FLAGS+=\
+       OPT="$(TARGET_CFLAGS)"
+
+define Package/firmwarehotplug/install
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
+       install -m755 $(PKG_BUILD_DIR)/ezusb/midi/original/Hotplug/ezusbmidi $(1)/etc/hotplug.d/usb
+       install -m644 $(PKG_BUILD_DIR)/ezusb/midi/original/Hotplug/ezusbmidi.usermap $(1)/etc/hotplug.d
+       $(INSTALL_DIR) $(1)/usr/share/usb/ezusbmidi
+       install -m644 $(PKG_BUILD_DIR)/ezusb/midi/original/ezusbmidi1x1.ihx $(1)/usr/share/usb/ezusbmidi
+       install -m644 $(PKG_BUILD_DIR)/ezusb/midi/original/ezusbmidi2x2.ihx $(1)/usr/share/usb/ezusbmidi
+endef
+
+$(eval $(call BuildPackage,firmwarehotplug))
+
diff --git a/utils/firmwarehotplug/patches/001-no_documentation.patch b/utils/firmwarehotplug/patches/001-no_documentation.patch
new file mode 100644 (file)
index 0000000..0079fdd
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN firmwarehotplug-0.1/ezusb/midi/original/Makefile firmwarehotplug-0.1.new/ezusb/midi/original/Makefile
+--- firmwarehotplug-0.1/ezusb/midi/original/Makefile   2003-05-19 02:10:28.000000000 +0200
++++ firmwarehotplug-0.1.new/ezusb/midi/original/Makefile       2007-01-01 23:07:42.000000000 +0100
+@@ -1,7 +1,7 @@
+ VERSION = $(shell date +%Y_%m_%d)
+ RELEASE_NAME =        ezusbmidi-$(VERSION)
+-all: ezusbmidi1x1.ihx ezusbmidi2x2.ihx ezusbmidi.html ezusbmidi.ps
++all: ezusbmidi1x1.ihx ezusbmidi2x2.ihx
+ ezusbmidi1x1.ihx: ezusbmidi.c ezusb_reg.h bufsync.h
+       rm -rf sdcc; mkdir sdcc; cp $^ sdcc
diff --git a/utils/firmwarehotplug/patches/100-compile-fixes.patch b/utils/firmwarehotplug/patches/100-compile-fixes.patch
new file mode 100644 (file)
index 0000000..056a9c6
--- /dev/null
@@ -0,0 +1,36 @@
+Index: firmwarehotplug-0.1/ezusb/midi/original/Makefile
+===================================================================
+--- firmwarehotplug-0.1.orig/ezusb/midi/original/Makefile      2010-10-29 19:21:43.867000023 +0200
++++ firmwarehotplug-0.1/ezusb/midi/original/Makefile   2010-10-29 19:27:09.590002911 +0200
+@@ -1,15 +1,18 @@
+ VERSION = $(shell date +%Y_%m_%d)
+ RELEASE_NAME =        ezusbmidi-$(VERSION)
++SDCC = sdcc
++PACKIHX = packihx
++
+ all: ezusbmidi1x1.ihx ezusbmidi2x2.ihx
+ ezusbmidi1x1.ihx: ezusbmidi.c ezusb_reg.h bufsync.h
+-      rm -rf sdcc; mkdir sdcc; cp $^ sdcc
+-      cd sdcc; sdcc -DCONFIG_MidiSport1x1 -I. $<; packihx ezusbmidi.ihx > ../$@
++      rm -rf sdcc.1x1 && mkdir sdcc.1x1 && cp $^ sdcc.1x1/
++      cd sdcc.1x1 && $(SDCC) -DCONFIG_MidiSport1x1 -I. $< && $(PACKIHX) ezusbmidi.ihx > ../$@
+ ezusbmidi2x2.ihx: ezusbmidi.c ezusb_reg.h bufsync.h
+-      rm -rf sdcc; mkdir sdcc; cp $^ sdcc
+-      cd sdcc; sdcc -DCONFIG_MidiSport2x2  -I. $<; packihx ezusbmidi.ihx > ../$@
++      rm -rf sdcc.2x2 && mkdir sdcc.2x2 && cp $^ sdcc.2x2/
++      cd sdcc.2x2 && $(SDCC) -DCONFIG_MidiSport2x2 -I. $< && $(PACKIHX) ezusbmidi.ihx > ../$@
+ ezusbmidi.ps: ezusbmidi.sgml descriptor.png
+       sgml2latex --output=ps $<
+@@ -27,7 +30,7 @@
+       fakeroot dpkg-buildpackage
+ clean:
+-      rm -rf sdcc
++      rm -rf sdcc*
+       rm -f [1-9] *.pdf *.html *.ps *.ihx *.tar.gz *.tar.bz2 ezusbmidi.spec
+       rm -rf debian/ezusbmidi debian/files build-stamp configure-stamp
diff --git a/utils/fortune-mod/Makefile b/utils/fortune-mod/Makefile
new file mode 100644 (file)
index 0000000..e3482c7
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2007 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:=fortune-mod
+PKG_VERSION:=1.2.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://freeware.sgi.com/source/fortune-mod
+PKG_MD5SUM:=383b1de06b35450235732c7ae7b5f0e3
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fortune-mod
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=display fortune cookies on demand.
+  URL:=http://packages.debian.org/fortune-mod
+endef
+
+define Package/fortune-mod/description
+Fortune mod displays fortune cookies on demand
+endef
+
+define Build/Compile
+       $(HOSTCC) -Wall -o $(PKG_BUILD_DIR)/util/strfile-host $(PKG_BUILD_DIR)/util/strfile.c -DVERSION=\"$(PKG_VERSION)\"
+       $(PKG_BUILD_DIR)/util/strfile-host $(PKG_BUILD_DIR)/datfiles/fortunes $(PKG_BUILD_DIR)/datfiles/fortunes.dat
+       $(MAKE) -C $(PKG_BUILD_DIR)/fortune
+endef
+
+define Package/fortune-mod/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/fortune/fortune $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/games/fortunes
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/datfiles/fortunes $(1)/usr/share/games/fortunes
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/datfiles/fortunes.dat $(1)/usr/share/games/fortunes
+endef
+
+$(eval $(call BuildPackage,fortune-mod))
diff --git a/utils/fortune-mod/patches/01-strfile-64bit-fix b/utils/fortune-mod/patches/01-strfile-64bit-fix
new file mode 100644 (file)
index 0000000..9bd3da9
--- /dev/null
@@ -0,0 +1,156 @@
+--- fortune-mod-1.2.1/util/strfile.c.orig      2007-07-27 00:40:54.687140050 +0100
++++ fortune-mod-1.2.1/util/strfile.c   2007-07-27 00:41:14.184165656 +0100
+@@ -144,7 +135,7 @@
+ typedef struct
+ {
+     char first;
+-    off_t pos;
++    int32_t pos;
+ }
+ STR;
+@@ -159,7 +150,7 @@
+ int Xflag = FALSE;            /* set rotated bit */
+ long Num_pts = 0;             /* number of pointers/strings */
+-off_t *Seekpts;
++int32_t *Seekpts;
+ FILE *Sort_1, *Sort_2;                /* pointers for sorting */
+@@ -237,9 +228,9 @@
+  * add_offset:
+  *      Add an offset to the list, or write it out, as appropriate.
+  */
+-void add_offset(FILE * fp, off_t off)
++void add_offset(FILE * fp, int32_t off)
+ {
+-    off_t net;
++    int32_t net;
+     if (!STORING_PTRS)
+     {
+@@ -258,9 +249,9 @@
+  * fix_last_offset:
+  *     Used when we have two separators in a row.
+  */
+-void fix_last_offset(FILE * fp, off_t off)
++void fix_last_offset(FILE * fp, int32_t off)
+ {
+-    off_t net;
++    int32_t net;
+     if (!STORING_PTRS)
+     {
+@@ -333,7 +324,7 @@
+   do_order(void)
+ {
+     register long i;
+-    register off_t *lp;
++    register int32_t *lp;
+     register STR *fp;
+     Sort_1 = fopen(Infile, "r");
+@@ -384,8 +375,8 @@
+ void randomize(void)
+ {
+     register int cnt, i;
+-    register off_t tmp;
+-    register off_t *sp;
++    register int32_t tmp;
++    register int32_t *sp;
+     extern time_t time(time_t *);
+     srandom((int) (time((time_t *) NULL) + getpid()));
+@@ -422,7 +413,7 @@
+ {
+     register unsigned char *sp;
+     register FILE *inf, *outf;
+-    register off_t last_off, length, pos, *p;
++    register int32_t last_off, length, pos, *p;
+     register int first, cnt;
+     register char *nsp;
+     register STR *fp;
+@@ -514,14 +505,19 @@
+     if (!Sflag)
+     {
+       printf("\"%s\" created\n", Outfile);
+-      if (Num_pts == 2)
+-          puts("There was 1 string");
++      if (Num_pts == 1)
++          puts("There was no string");
+       else
+-          printf("There were %ld strings\n", Num_pts - 1);
+-      printf("Longest string: %lu byte%s\n", Tbl.str_longlen,
+-             Tbl.str_longlen == 1 ? "" : "s");
+-      printf("Shortest string: %lu byte%s\n", Tbl.str_shortlen,
+-             Tbl.str_shortlen == 1 ? "" : "s");
++      {
++          if (Num_pts == 2)
++              puts("There was 1 string");
++          else
++              printf("There were %ld strings\n", Num_pts - 1);
++          printf("Longest string: %lu byte%s\n", Tbl.str_longlen, 
++              Tbl.str_longlen == 1 ? "" : "s");
++          printf("Shortest string: %lu byte%s\n", Tbl.str_shortlen,
++              Tbl.str_shortlen == 1 ? "" : "s");
++      }
+     }
+     fseek(outf, (off_t) 0, 0);
+@@ -533,12 +529,19 @@
+     Tbl.str_longlen = htonl(Tbl.str_longlen);
+     Tbl.str_shortlen = htonl(Tbl.str_shortlen);
+     Tbl.str_flags = htonl(Tbl.str_flags);
+-    fwrite((char *) &Tbl, sizeof Tbl, 1, outf);
++    fwrite(&Tbl.str_version,  sizeof Tbl.str_version,  1, outf);
++    fwrite(&Tbl.str_numstr,   sizeof Tbl.str_numstr,   1, outf);
++    fwrite(&Tbl.str_longlen,  sizeof Tbl.str_longlen,  1, outf);
++    fwrite(&Tbl.str_shortlen, sizeof Tbl.str_shortlen, 1, outf);
++    fwrite(&Tbl.str_flags,    sizeof Tbl.str_flags,    1, outf);
++    fwrite( Tbl.stuff,        sizeof Tbl.stuff,        1, outf);
+     if (STORING_PTRS)
+     {
+       for (p = Seekpts, cnt = Num_pts; cnt--; ++p)
++      {
+           *p = htonl(*p);
+-      fwrite((char *) Seekpts, sizeof *Seekpts, (int) Num_pts, outf);
++          fwrite(p, sizeof *p, 1, outf);
++      }
+     }
+     fclose(outf);
+     exit(0);
+--- fortune-mod-1.2.1/util/strfile.h   2000-01-29 11:14:34.000000000 +0000
++++ fortune-mod-1.2.1/util/strfile.h   2007-07-27 00:25:46.825640014 +0100
+@@ -38,24 +38,19 @@
+  *    @(#)strfile.h   8.1 (Berkeley) 5/31/93
+  */
+-/* Modified Jan 2000, Chris Ausbrooks <weed@bucket.pp.ualr.edu>
+- *  + Changed VERSION to FILE_VERSION to avoid warnings caused by
+- *    automake/autoconf.
+- */
+-
+ #define       STR_ENDSTRING(line,tbl) \
+       ((line)[0] == (tbl).str_delim && (line)[1] == '\n')
+ typedef struct {                              /* information table */
+-#define       FILE_VERSION    1
+-      unsigned long   str_version;            /* version number */
+-      unsigned long   str_numstr;             /* # of strings in the file */
+-      unsigned long   str_longlen;            /* length of longest string */
+-      unsigned long   str_shortlen;           /* length of shortest string */
++#define       FILE_VERSION            2
++      u_int32_t       str_version;            /* version number */
++      u_int32_t       str_numstr;             /* # of strings in the file */
++      u_int32_t       str_longlen;            /* length of longest string */
++      u_int32_t       str_shortlen;           /* length of shortest string */
+ #define       STR_RANDOM      0x1                     /* randomized pointers */
+ #define       STR_ORDERED     0x2                     /* ordered pointers */
+ #define       STR_ROTATED     0x4                     /* rot-13'd text */
+-      unsigned long   str_flags;              /* bit field for flags */
+-      unsigned char   stuff[4];               /* long aligned space */
++      u_int32_t       str_flags;              /* bit field for flags */
++      u_int8_t        stuff[4];               /* long aligned space */
+ #define       str_delim       stuff[0]                /* delimiting character */
+ } STRFILE;
diff --git a/utils/fowsr/Makefile b/utils/fowsr/Makefile
new file mode 100644 (file)
index 0000000..2bf4d01
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2010-2013 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:=fowsr
+PKG_VERSION:=2.0-131015
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fowsr.googlecode.com/svn/tags/Releases/
+PKG_MD5SUM:=7f78e8d2b1a162a99e684cab49a210a0
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).src
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fowsr
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libusb-compat
+  TITLE:=Fine Offset Wireless Weather Station Reader
+  URL:=http://fowsr.googlecode.com/
+endef
+
+define Package/fowsr/description
+  fowsr is a USB Data Collector application for WH1080 compatible
+  weather stations.
+  Output formats include XML, Wunderground.com and pywws.
+endef
+
+define Package/fowsr/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/fowsr $(1)/usr/bin/
+       $(INSTALL_BIN) \
+               $(PKG_BUILD_DIR)/{fowsr,pwsweather,pywws,wunderground,xml}.sh \
+               $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,fowsr))
diff --git a/utils/foxboard-utils/Makefile b/utils/foxboard-utils/Makefile
new file mode 100644 (file)
index 0000000..28c7d85
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2006 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:=foxboard-utils
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=foxboard-utils.tar.bz2
+PKG_SOURCE_URL:=http://www.acmesystems.it/download/owrt
+PKG_MD5SUM:=
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/foxboard-utils
+  SECTION:=utils
+  CATEGORY:=Base system
+  TITLE:=Foxboard base tools
+  URL:=http://www.acmesystems.it
+  DEPENDS:=@TARGET_etrax
+endef
+
+define Package/foxboard-utils/description
+ This package contains a collection of tools for configuring the foxboard
+ gpio pins/leds.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) CFLAGS="$(TARGET_CFLAGS)" CC="$(TARGET_CC)"
+       $(MAKE) -C $(PKG_BUILD_DIR) PREFIX="$(PKG_INSTALL_DIR)" install
+endef
+
+define Package/foxboard-utils/install
+       $(INSTALL_DIR) $(1)/
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)
+       $(INSTALL_DIR) $(1)/www/cgi-bin
+       cd $(1)/www/cgi-bin; ln -s ../../bin/editcgi.cgi .
+endef
+
+$(eval $(call BuildPackage,foxboard-utils))
diff --git a/utils/fxload/Makefile b/utils/fxload/Makefile
new file mode 100644 (file)
index 0000000..93e63c1
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=fxload
+PKG_VERSION:=2008_10_13
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/linux-hotplug
+PKG_MD5SUM:=4477a2457f064228bef4a93ba2f21692
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fxload
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=@USB_SUPPORT +udev
+  TITLE:=Downloading firmware into EZ-USB microcontrollers
+  URL:=http://linux-hotplug.sourceforge.net/
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/$(LINUX_UAPI_DIR)include" \
+       )
+endef
+
+define Package/fxload/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/sbin/
+       $(INSTALL_DIR) $(1)/usr/share/usb
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/a3load.hex $(1)/usr/share/usb/
+endef
+
+$(eval $(call BuildPackage,fxload))
diff --git a/utils/fxload/patches/010-compile_fix.patch b/utils/fxload/patches/010-compile_fix.patch
new file mode 100644 (file)
index 0000000..39ab9dc
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/ezusb.c
++++ b/ezusb.c
+@@ -30,8 +30,14 @@
+ # include  <sys/ioctl.h>
+ # include  <linux/version.h>
+-# include  <linux/usb/ch9.h>
++typedef unsigned long kernel_ulong_t;
++
++#ifndef BITS_PER_LONG
++#define BITS_PER_LONG 32
++#endif
++
+ # include  <linux/usbdevice_fs.h>
++# include  <linux/usb/ch9.h>
+ # include "ezusb.h"
diff --git a/utils/gadgetfs-test/Makefile b/utils/gadgetfs-test/Makefile
new file mode 100644 (file)
index 0000000..3dfc298
--- /dev/null
@@ -0,0 +1,112 @@
+#
+# Copyright (C) 2007 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:=gadgetfs-test
+PKG_VERSION:=2007-11-29
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).tar.bz2
+PKG_SOURCE_URL:=http://avr32linux.org/twiki/pub/Main/GadgetFsTest
+PKG_MD5SUM:=49476a74c29f1281c8a4c035aa57a5bd
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gadgetfs-test
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Filesystem
+  TITLE:=Test program for gadgetfs
+  DEPENDS:=@DEVEL +libpthread
+  URL:=http://linux-usb.org/gadget
+endef
+
+define Package/gadgetfs-test/description
+ Test program for gadgetfs from linux-usb.org.
+endef
+
+define Package/gadgetfs-test-bulk
+$(call Package/gadgetfs-test)
+  TITLE+= (BULK transfer)
+endef
+
+define Package/gadgetfs-test-bulk/description
+$(call Package/gadgetfs-test/description)
+ This package is built with BULK transfer support.
+endef
+
+define Package/gadgetfs-test-isoc
+$(call Package/gadgetfs-test)
+  DEPENDS+= +libaio
+  TITLE+= (ISOCHRONOUS transfer)
+endef
+
+define Package/gadgetfs-test-isoc/description
+$(call Package/gadgetfs-test/description)
+ This package is built with ISOCHRONOUS transfer support using libaio.
+endef
+
+
+GADGETFS_CFLAGS:=$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)
+GADGETFS_LDFLAGS:=$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)
+GADGETFS_LIBS:=-lpthread
+
+define Build/Template
+
+$(STAMP_BUILT)-$(1): $(STAMP_PREPARED)
+       -$(MAKE) -C $(PKG_BUILD_DIR) clean
+       $(MAKE_VARS) \
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CC="$(TARGET_CC)" \
+               LDFLAGS="$(GADGETFS_LDFLAGS)" \
+               $(2) \
+               all
+       mv -f $(PKG_BUILD_DIR)/gadgetfs-test $(PKG_BUILD_DIR)/gadgetfs-test-$(1)
+       touch $$@
+
+$(STAMP_BUILT): $(STAMP_BUILT)-$(1)
+
+define Package/gadgetfs-test-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/sbin
+       $(INSTALL_BIN) $$(PKG_BUILD_DIR)/gadgetfs-test-$(1) $$(1)/usr/sbin/
+endef
+
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_gadgetfs-test-bulk),)
+  define Build/bulk
+    $(call Build/Template,bulk, \
+               CFLAGS="$(GADGETFS_CFLAGS)" \
+               LIBS="$(GADGETFS_LIBS)" \
+    )
+  endef
+endif
+$(eval $(Build/bulk))
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_gadgetfs-test-isoc),)
+  define Build/isoc
+    $(call Build/Template,isoc, \
+               CFLAGS="$(GADGETFS_CFLAGS) -DAIO" \
+               LIBS="$(GADGETFS_LIBS) -laio" \
+    )
+  endef
+endif
+$(eval $(Build/isoc))
+
+$(eval $(call BuildPackage,gadgetfs-test-bulk))
+$(eval $(call BuildPackage,gadgetfs-test-isoc))
+
diff --git a/utils/gadgetfs-test/patches/001-linux_usb_org_2007_11_29.patch b/utils/gadgetfs-test/patches/001-linux_usb_org_2007_11_29.patch
new file mode 100644 (file)
index 0000000..fce5b68
--- /dev/null
@@ -0,0 +1,214 @@
+diff -Nur gadgetfs-test.orig/usb.c gadgetfs-test.2007-11-29/usb.c
+--- gadgetfs-test.orig/usb.c   2007-06-21 16:36:32.000000000 +0200
++++ gadgetfs-test.2007-11-29/usb.c     2007-09-25 09:01:48.000000000 +0200
+@@ -34,8 +34,8 @@
+ #include <asm/byteorder.h>
+ #include <linux/types.h>
+-#include <linux/usb_gadgetfs.h>
+-#include <linux/usb_ch9.h>
++#include <linux/usb/gadgetfs.h>
++#include <linux/usb/ch9.h>
+ #ifdef        AIO
+ /* this aio code works with libaio-0.3.106 */
+@@ -402,6 +402,26 @@
+               fs_status_desc.bEndpointAddress = USB_DIR_IN | 3;
+               EP_STATUS_NAME = "ep3in-int";
++      /* Atmel AT32AP700x processors, high/full speed */
++      } else if (stat (DEVNAME = "atmel_usba_udc", &statb) == 0) {
++              HIGHSPEED = 1;
++              device_desc.bcdDevice = __constant_cpu_to_le16 (0x0108);
++
++              fs_source_desc.bEndpointAddress
++                      = hs_source_desc.bEndpointAddress
++                      = USB_DIR_IN | 1;
++              EP_IN_NAME = "ep1in-bulk";
++              fs_sink_desc.bEndpointAddress
++                      = hs_sink_desc.bEndpointAddress
++                      = USB_DIR_OUT | 2;
++              EP_OUT_NAME = "ep2out-bulk";
++
++              source_sink_intf.bNumEndpoints = 3;
++              fs_status_desc.bEndpointAddress
++                      = hs_status_desc.bEndpointAddress
++                      = USB_DIR_IN | 3;
++              EP_STATUS_NAME = "ep3in-int";
++
+       } else {
+               DEVNAME = 0;
+               return -ENODEV;
+@@ -597,18 +617,58 @@
+               fs_status_desc.bEndpointAddress = USB_DIR_IN | 3;
+               EP_STATUS_NAME = "ep3-int";
++      /* Atmel AT32AP700x processors, high/full speed */
++      } else if (stat (DEVNAME = "atmel_usba_udc", &statb) == 0){
++              HIGHSPEED = 1;
++
++              device_desc.bcdDevice = __constant_cpu_to_le16 (0x0105);
++
++              fs_source_desc.bEndpointAddress
++                      = hs_source_desc.bEndpointAddress
++                      = USB_DIR_IN | 5;
++              fs_source_desc.bmAttributes
++                      = hs_source_desc.bmAttributes
++                      = USB_ENDPOINT_XFER_ISOC;
++              fs_source_desc.wMaxPacketSize
++                      = hs_source_desc.wMaxPacketSize
++                      = __cpu_to_le16(min (bufsize, 1024));
++              fs_source_desc.bInterval
++                      = hs_source_desc.bInterval
++                      = interval;
++              EP_IN_NAME = "ep5in-iso";
++
++              fs_sink_desc.bEndpointAddress
++                      = hs_sink_desc.bEndpointAddress
++                      = USB_DIR_OUT | 6;
++              fs_sink_desc.bmAttributes
++                      = hs_sink_desc.bmAttributes
++                      = USB_ENDPOINT_XFER_ISOC;
++              fs_sink_desc.wMaxPacketSize
++                      = hs_sink_desc.wMaxPacketSize
++                      = __cpu_to_le16(min (bufsize, 1024));
++              fs_sink_desc.bInterval
++                      = hs_sink_desc.bInterval
++                      = interval;
++              EP_OUT_NAME = "ep6out-iso";
++
++              source_sink_intf.bNumEndpoints = 3;
++              fs_status_desc.bEndpointAddress
++                      = hs_status_desc.bEndpointAddress
++                      = USB_DIR_IN | 3;
++              EP_STATUS_NAME = "ep3in-int";
++
+       } else {
+               DEVNAME = 0;
+               return -ENODEV;
+       }
+       if (verbose) {
+               fprintf (stderr, "iso fs wMaxPacket %04x bInterval %02x\n",
+-                      fs_sink_desc.wMaxPacketSize,
++                      __le16_to_cpu(fs_sink_desc.wMaxPacketSize),
+                       fs_sink_desc.bInterval);
+               if (HIGHSPEED)
+                       fprintf (stderr,
+                               "iso hs wMaxPacket %04x bInterval %02x\n",
+-                              hs_sink_desc.wMaxPacketSize,
++                              __le16_to_cpu(hs_sink_desc.wMaxPacketSize),
+                               hs_sink_desc.bInterval);
+       }
+       return 0;
+@@ -1285,13 +1345,17 @@
+ {
+       int             status, tmp;
+       __u8            buf [256];
++      __u16           value, index, length;
++
++      value = __le16_to_cpu(setup->wValue);
++      index = __le16_to_cpu(setup->wIndex);
++      length = __le16_to_cpu(setup->wLength);
+       if (verbose)
+               fprintf (stderr, "SETUP %02x.%02x "
+                               "v%04x i%04x %d\n",
+                       setup->bRequestType, setup->bRequest,
+-                      setup->wValue, setup->wIndex,
+-                      setup->wLength);
++                      value, index, length);
+       /*
+       if ((setup->bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD)
+@@ -1302,21 +1366,21 @@
+       case USB_REQ_GET_DESCRIPTOR:
+               if (setup->bRequestType != USB_DIR_IN)
+                       goto stall;
+-              switch (setup->wValue >> 8) {
++              switch (value >> 8) {
+               case USB_DT_STRING:
+-                      tmp = setup->wValue & 0x0ff;
++                      tmp = value & 0x0ff;
+                       if (verbose > 1)
+                               fprintf (stderr,
+                                       "... get string %d lang %04x\n",
+-                                      tmp, setup->wIndex);
+-                      if (tmp != 0 && setup->wIndex != strings.language)
++                                      tmp, index);
++                      if (tmp != 0 && index != strings.language)
+                               goto stall;
+                       status = usb_gadget_get_string (&strings, tmp, buf);
+                       if (status < 0)
+                               goto stall;
+                       tmp = status;
+-                      if (setup->wLength < tmp)
+-                              tmp = setup->wLength;
++                      if (length < tmp)
++                              tmp = length;
+                       status = write (fd, buf, tmp);
+                       if (status < 0) {
+                               if (errno == EIDRM)
+@@ -1336,7 +1400,7 @@
+               if (setup->bRequestType != USB_DIR_OUT)
+                       goto stall;
+               if (verbose)
+-                      fprintf (stderr, "CONFIG #%d\n", setup->wValue);
++                      fprintf (stderr, "CONFIG #%d\n", value);
+               /* Kernel is normally waiting for us to finish reconfiguring
+                * the device.
+@@ -1349,7 +1413,7 @@
+                * the endpoints always active and don't rely on seeing any
+                * config change events, either this or SET_INTERFACE.
+                */
+-              switch (setup->wValue) {
++              switch (value) {
+               case CONFIG_VALUE:
+                       start_io ();
+                       break;
+@@ -1369,27 +1433,27 @@
+               return;
+       case USB_REQ_GET_INTERFACE:
+               if (setup->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)
+-                              || setup->wIndex != 0
+-                              || setup->wLength > 1)
++                              || index != 0
++                              || length > 1)
+                       goto stall;
+               /* only one altsetting in this driver */
+               buf [0] = 0;
+-              status = write (fd, buf, setup->wLength);
++              status = write (fd, buf, length);
+               if (status < 0) {
+                       if (errno == EIDRM)
+                               fprintf (stderr, "GET_INTERFACE timeout\n");
+                       else
+                               perror ("write GET_INTERFACE data");
+-              } else if (status != setup->wLength) {
++              } else if (status != length) {
+                       fprintf (stderr, "short GET_INTERFACE write, %d\n",
+                               status);
+               }
+               return;
+       case USB_REQ_SET_INTERFACE:
+               if (setup->bRequestType != USB_RECIP_INTERFACE
+-                              || setup->wIndex != 0
+-                              || setup->wValue != 0)
++                              || index != 0
++                              || value != 0)
+                       goto stall;
+               /* just reset toggle/halt for the interface's endpoints */
+diff -Nur gadgetfs-test.orig/usbstring.c gadgetfs-test.2007-11-29/usbstring.c
+--- gadgetfs-test.orig/usbstring.c     2007-06-21 16:36:32.000000000 +0200
++++ gadgetfs-test.2007-11-29/usbstring.c       2007-09-25 09:01:48.000000000 +0200
+@@ -11,7 +11,7 @@
+ #include <string.h>
+ #include <linux/types.h>
+-#include <linux/usb_ch9.h>
++#include <linux/usb/ch9.h>
+ #include "usbstring.h"
diff --git a/utils/gawk/Makefile b/utils/gawk/Makefile
new file mode 100644 (file)
index 0000000..1105b39
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gawk
+PKG_VERSION:=3.1.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=gawk-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://ftp.gnu.org/gnu/gawk/
+PKG_MD5SUM:=35937a0f83f0efe7a8c2dee635624784
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/gawk-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gawk
+       SECTION:=utils
+       CATEGORY:=Utilities
+       TITLE:=GAWK
+       URL:=http://www.gnu.org/software/gawk/
+endef
+
+define Package/gawk/description
+       GNU version of AWK.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --prefix=/usr --with-linux-headers="$(LINUX_DIR)" \
+       )
+endef
+
+define Package/gawk/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/gawk $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/awklib/igawk $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pgawk $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/libexec/
+       $(INSTALL_DIR) $(1)/usr/libexec/awk/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/awklib/grcat $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/awklib/pwcat $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/
+       $(INSTALL_DIR) $(1)/usr/share/awk/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/awklib/eg/lib/* $(1)/usr/share/awk
+endef
+
+$(eval $(call BuildPackage,gawk))
diff --git a/utils/gnokii/Makefile b/utils/gnokii/Makefile
new file mode 100644 (file)
index 0000000..45f8f91
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006-2010 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:=gnokii
+PKG_VERSION:=0.6.21
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://gnokii.org/download/gnokii/0.6.x
+PKG_MD5SUM:=bbf0aabe2436d8e927f3e2edb4efcac8
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gnokii
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libusb-compat
+  TITLE:=Gnokii - Datasuite for the mobile phones
+  URL:=http://www.gnokii.org/
+endef
+
+define Package/gnokii/description
+       Gnokii is a suite of programs linked against a backend
+       library that allows communication with the phones. It
+       currently supports the most mobile phones, all AT
+       capable mobiles as well as Symbian phones.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --without-libiconv-prefix \
+               --without-libintl-prefix \
+               --disable-rlpdebug \
+               --disable-xdebug \
+               --disable-debug \
+               --enable-shared \
+               --disable-static \
+               --disable-libpcsclite \
+               --disable-libical \
+               --disable-irda \
+               --disable-bluetooth \
+               --without-x \
+               )
+endef
+
+define Package/gnokii/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnokii $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/gnokiid $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mgnokiidev $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnokii.so.3.5.0 $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnokii.so.3 $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnokii.so $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,gnokii))
diff --git a/utils/gnupg/Makefile b/utils/gnupg/Makefile
new file mode 100644 (file)
index 0000000..1d866ae
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2006-2012 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:=gnupg
+PKG_VERSION:=1.4.16
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/gnupg \
+       ftp://ftp.gnupg.org/gcrypt/gnupg
+PKG_MD5SUM:=6df73c57d3ece1dd36dc2a7679f00fb0
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gnupg
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+zlib +libncurses +libreadline
+  TITLE:=GNU privacy guard - a free PGP replacement
+  URL:=http://www.gnupg.org/
+endef
+
+define Package/gnupg/description
+ GnuPG is GNU's tool for secure communication and data storage.
+ It can be used to encrypt data and to create digital signatures.
+ It includes an advanced key management facility and is compliant
+ with the proposed OpenPGP Internet standard as described in RFC2440.
+ .
+ GnuPG does not use any patented algorithms so it cannot be compatible
+ with PGP2 because it uses IDEA (which is patented worldwide).
+endef
+
+CONFIGURE_ARGS += \
+       --disable-rpath \
+       --disable-asm \
+       --disable-gnupg-iconv \
+       --disable-card-support \
+       --disable-agent-support \
+       --disable-bzip2 \
+       --disable-exec \
+       --disable-ldap \
+       --disable-hkp \
+       --disable-finger \
+       --disable-ftp \
+       --disable-dns-srv \
+       --enable-fake-curl \
+       --disable-regex \
+
+MAKE_FLAGS += \
+       SUBDIRS="m4 intl zlib util mpi cipher tools g10 keyserver ${checks}" \
+
+define Package/gnupg/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gpg $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,gnupg))
diff --git a/utils/gnuplot/Makefile b/utils/gnuplot/Makefile
new file mode 100644 (file)
index 0000000..ec50a4e
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2010-2012 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:=gnuplot
+PKG_VERSION:=4.6.0
+PKG_RELEASE:=2
+
+PKG_INSTALL:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/gnuplot
+PKG_MD5SUM:=8e6e92b4596ea0eb75e16a57fc79efec
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+= \
+       -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+CONFIGURE_VARS += \
+       CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \
+       LIBS="-lpthread"
+
+define Package/gnuplot
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses $(CXX_DEPENDS) +zlib +libpng +libfreetype +libgd \
+       $(INTL_DEPENDS) $(ICONV_DEPENDS) +libpthread +libreadline
+  TITLE:=A portable command-line driven graphing utility
+  URL:=http://sourceforge.net/projects/gnuplot/
+endef
+
+define Package/gnuplot/description
+  Gnuplot is a portable command-line driven graphing utility for linux, OS/2,
+  MS Windows, OSX, VMS, and many other platforms.
+endef
+
+CONFIGURE_ARGS += \
+       --without-x \
+       --disable-mouse \
+       --without-tutorial \
+       --without-row-help \
+       --without-lisp-files \
+       --disable-wxwidgets \
+       --without-lua \
+       --without-cairo
+
+define Package/gnuplot/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnuplot $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,gnuplot))
diff --git a/utils/gnuplot/patches/010-Makefile.in.patch b/utils/gnuplot/patches/010-Makefile.in.patch
new file mode 100644 (file)
index 0000000..8a83fd6
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -250,7 +250,7 @@ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AUTOMAKE_OPTIONS = foreign 1.2h
+-SUBDIRS = config m4 term src docs $(LISPDIR) man demo tutorial share
++SUBDIRS = config m4 term src $(LISPDIR) share
+ EXTRA_DIST = BUGS CodeStyle Copyright FAQ.pdf GNUmakefile INSTALL INSTALL.gnu \
+ Makefile.maint PATCHLEVEL PGPKEYS PORTING README README.1ST \
+ VERSION configure.vms pm3d win
diff --git a/utils/goldfish-qemu/Makefile b/utils/goldfish-qemu/Makefile
new file mode 100644 (file)
index 0000000..e5b4083
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2006-2010 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:=goldfish-qemu
+PKG_REV:=2b8ea29e2bd12f876a4d06647e6077bf72de567e
+PKG_VERSION:=20090429
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://android.git.kernel.org/platform/external/qemu
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_TARGETS:=bin
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/goldfish-qemu
+  SECTION:=emulator
+  CATEGORY:=Emulators
+  DEPENDS:=@TARGET_goldfish
+  TITLE:=A modified version of the Google Android Emulator
+  URL:=http://www.android.com/
+endef
+
+LIBSDL_PATCHED:=sdl-1.2.12-android-20080919
+
+define Download/libsdl-patched
+  FILE:=$(LIBSDL_PATCHED).tar.gz
+  URL:=http://android.git.kernel.org/pub
+  MD5SUM:=22df8cbb2ecb811938eba8410e861650
+endef
+$(eval $(call Download,libsdl-patched))
+
+Build/Exports=
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       zcat $(DL_DIR)/$(LIBSDL_PATCHED).tar.gz | tar x -C $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+       [ -x $(PKG_BUILD_DIR)/libsdl/bin/sdl-config ] || ( \
+               cd $(PKG_BUILD_DIR)/$(LIBSDL_PATCHED); \
+               ./android-configure --prefix=$(PKG_BUILD_DIR)/libsdl; \
+               make all install; \
+       )
+endef
+
+define Build/Compile
+       (cd $(PKG_BUILD_DIR); \
+               [ -f $(PKG_BUILD_DIR)/objs/config.make ] || \
+                       ./android-configure.sh --sdl-config=$(PKG_BUILD_DIR)/libsdl/bin/sdl-config \
+       )
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/goldfish-qemu/install
+       $(INSTALL_DIR) $(1)
+       $(CP) $(PKG_BUILD_DIR)/objs/emulator $(1)/
+       $(CP) ./skins $(1)/
+endef
+
+$(eval $(call BuildPackage,goldfish-qemu))
diff --git a/utils/goldfish-qemu/patches/100-darwin_fix.patch b/utils/goldfish-qemu/patches/100-darwin_fix.patch
new file mode 100644 (file)
index 0000000..a5f56b3
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/android-configure.sh
++++ b/android-configure.sh
+@@ -656,6 +656,9 @@ case "$CPU" in
+     *) HOST_CPU=$CPU
+     ;;
+ esac
++case "$OS" in
++    darwin*) echo "#define _BSD       1" >> $config_h;;
++esac
+ echo "#define HOST_$HOST_CPU    1" >> $config_h
+ log "Generate   : $config_h"
+--- a/android/utils/display-quartz.m
++++ b/android/utils/display-quartz.m
+@@ -34,6 +34,7 @@ get_monitor_resolution( int  *px_dpi, in
+ int
+ get_nearest_monitor_rect( int  *x, int  *y, int  *width, int  *height )
+ {
++#if 0
+     SDL_SysWMinfo  info;
+     NSWindow*      window;
+@@ -108,4 +109,7 @@ get_nearest_monitor_rect( int  *x, int  
+         }
+         return 0;
+     }
++#else
++      return -1;
++#endif
+ };
diff --git a/utils/goldfish-qemu/patches/110-single_image.patch b/utils/goldfish-qemu/patches/110-single_image.patch
new file mode 100644 (file)
index 0000000..92a9e54
--- /dev/null
@@ -0,0 +1,233 @@
+--- a/android/cmdline-option.c
++++ b/android/cmdline-option.c
+@@ -50,16 +50,6 @@ android_parse_options( int  *pargc, char
+         char   arg2_tab[64], *arg2 = arg2_tab;
+         int    nn;
+-        /* process @<name> as a special exception meaning
+-         * '-avd <name>'
+-         */
+-        if (aread[0][0] == '@') {
+-            opt->avd = aread[0]+1;
+-            nargs--;
+-            aread++;
+-            continue;
+-        }
+-
+         /* anything that isn't an option past this points
+          * exits the loop
+          */
+--- a/android/cmdline-options.h
++++ b/android/cmdline-options.h
+@@ -60,21 +60,16 @@
+  */
+ CFG_PARAM( sysdir,  "<dir>",  "search for system disk images in <dir>" )
+-CFG_PARAM( system,  "<file>", "read initial system image from <file>" )
+-CFG_PARAM( datadir, "<dir>",  "write user data into <dir>" )
+-CFG_PARAM( kernel,  "<file>", "use specific emulated kernel" )
+-CFG_PARAM( ramdisk, "<file>", "ramdisk image (default <system>/ramdisk.img" )
+-CFG_PARAM( image,   "<file>", "obsolete, use -system <file> instead" )
+-CFG_PARAM( init_data, "<file>", "initial data image (default <system>/userdata.img" )
+-CFG_PARAM( initdata, "<file>", "same as '-init-data <file>'" )
+-CFG_PARAM( data,     "<file>", "data image (default <datadir>/userdata-qemu.img" )
++CFG_PARAM( system,  "<file>", "read system image from <file>, default: <system>/system.img" )
++CFG_PARAM( data,     "<file>", "data image, default: <system>/data.img" )
++CFG_PARAM( kernel,  "<file>", "use specific emulated kernel, default: kernel.bin" )
++CFG_PARAM( ramdisk, "<file>", "ramdisk image (default <system>/ramdisk.bin" )
+ CFG_PARAM( partition_size, "<size>", "system/data partition size in MBs" )
+ CFG_PARAM( cache,    "<file>", "cache partition image (default is temporary file)" )
+ CFG_FLAG ( no_cache, "disable the cache partition" )
+ CFG_FLAG ( nocache,  "same as -no-cache" )
+ OPT_PARAM( sdcard, "<file>", "SD card image (default <system>/sdcard.img")
+ OPT_FLAG ( wipe_data, "reset the use data image (copy it from initdata)" )
+-CFG_PARAM( avd, "<name>", "use a specific android virtual device" )
+ CFG_PARAM( skindir, "<dir>", "search skins in <dir> (default <system>/skins)" )
+ CFG_PARAM( skin, "<name>", "select a given skin" )
+ CFG_FLAG ( no_skin, "don't use any emulator skin" )
+--- a/android/main.c
++++ b/android/main.c
+@@ -1606,6 +1606,7 @@ report_console( const char*  proto_port,
+  *       containing 'fileName'. this is *not* the full
+  *       path to 'fileName'.
+  */
++
+ static char*
+ _getSdkImagePath( const char*  fileName )
+ {
+@@ -1617,8 +1618,6 @@ _getSdkImagePath( const char*  fileName 
+     static const char* const  searchPaths[] = {
+         "",                                  /* program's directory */
+-        "/lib/images",                       /* this is for SDK 1.0 */
+-        "/../platforms/android-1.1/images",  /* this is for SDK 1.1 */
+         NULL
+     };
+@@ -1841,25 +1840,7 @@ int main(int argc, char **argv)
+         }
+     }
+-    /* legacy support: we used to use -system <dir> and -image <file>
+-     * instead of -sysdir <dir> and -system <file>, so handle this by checking
+-     * whether the options point to directories or files.
+-     */
+-    if (opts->image != NULL) {
+-        if (opts->system != NULL) {
+-            if (opts->sysdir != NULL) {
+-                derror( "You can't use -sysdir, -system and -image at the same time.\n"
+-                        "You should probably use '-sysdir <path> -system <file>'.\n" );
+-                exit(2);
+-            }
+-        }
+-        dwarning( "Please note that -image is obsolete and that -system is now used to point\n"
+-                  "to the system image. Next time, try using '-sysdir <path> -system <file>' instead.\n" );
+-        opts->sysdir = opts->system;
+-        opts->system = opts->image;
+-        opts->image  = NULL;
+-    }
+-    else if (opts->system != NULL && path_is_dir(opts->system)) {
++    if (opts->system != NULL && path_is_dir(opts->system)) {
+         if (opts->sysdir != NULL) {
+             derror( "Option -system should now be followed by a file path, not a directory one.\n"
+                     "Please use '-sysdir <path>' to point to the system directory.\n" );
+@@ -1885,49 +1866,11 @@ int main(int argc, char **argv)
+     if (opts->noskin)
+         opts->no_skin = opts->noskin;
+-    if (opts->initdata) {
+-        opts->init_data = opts->initdata;
+-        opts->initdata  = NULL;
+-    }
+-
+-    /* If no AVD name was given, try to find the top of the
+-     * Android build tree
+-     */
+-    if (opts->avd == NULL) {
+-        do {
+-            char*  out = getenv("ANDROID_PRODUCT_OUT");
+-
+-            if (out == NULL || out[0] == 0)
+-                break;
+-
+-            if (!path_exists(out)) {
+-                derror("Can't access ANDROID_PRODUCT_OUT as '%s'\n"
+-                    "You need to build the Android system before launching the emulator",
+-                    out);
+-                exit(2);
+-            }
+-
+-            android_build_root = path_parent( out, 4 );
+-            if (android_build_root == NULL || !path_exists(android_build_root)) {
+-                derror("Can't find the Android build root from '%s'\n"
+-                    "Please check the definition of the ANDROID_PRODUCT_OUT variable.\n"
+-                    "It should point to your product-specific build output directory.\n",
+-                    out );
+-                exit(2);
+-            }
+-            android_build_out = out;
+-            D( "found Android build root: %s", android_build_root );
+-            D( "found Android build out:  %s", android_build_out );
+-        } while (0);
+-    }
+     /* if no virtual device name is given, and we're not in the
+      * Android build system, we'll need to perform some auto-detection
+      * magic :-)
+      */
+-    if (opts->avd == NULL && !android_build_out) 
+     {
+-        char   dataDirIsSystem = 0;
+-
+         if (!opts->sysdir) {
+             opts->sysdir = _getSdkImagePath("system.img");
+             if (!opts->sysdir) {
+@@ -1945,47 +1888,30 @@ int main(int argc, char **argv)
+         }
+         if (!opts->system) {
+-            opts->system = _getSdkSystemImage(opts->sysdir, "-image", "system.img");
+-            D("autoconfig: -image %s", opts->image);
++            opts->system = _getSdkSystemImage(opts->sysdir, "-system", "system.img");
++            D("autoconfig: -system %s", opts->system);
+         }
+         if (!opts->kernel) {
+-            opts->kernel = _getSdkSystemImage(opts->sysdir, "-kernel", "kernel-qemu");
++            opts->kernel = _getSdkSystemImage(opts->sysdir, "-kernel", "kernel.bin");
+             D("autoconfig: -kernel %s", opts->kernel);
+         }
+         if (!opts->ramdisk) {
+-            opts->ramdisk = _getSdkSystemImage(opts->sysdir, "-ramdisk", "ramdisk.img");
++            opts->ramdisk = _getSdkSystemImage(opts->sysdir, "-ramdisk", "ramdisk.bin");
+             D("autoconfig: -ramdisk %s", opts->ramdisk);
+         }
+-        /* if no data directory is specified, use the system directory */
+-        if (!opts->datadir) {
+-            opts->datadir   = qemu_strdup(opts->sysdir);
+-            dataDirIsSystem = 1;
+-            D("autoconfig: -datadir %s", opts->sysdir);
+-        }
+-
+         if (!opts->data) {
+             /* check for userdata-qemu.img in the data directory */
+-            bufprint(tmp, tmpend, "%s/userdata-qemu.img", opts->datadir);
+-            if (!path_exists(tmp)) {
+-                derror(
+-                "You did not provide the name of an Android Virtual Device\n"
+-                "with the '-avd <name>' option. Read -help-avd for more information.\n\n"
+-
+-                "If you *really* want to *NOT* run an AVD, consider using '-data <file>'\n"
+-                "to specify a data partition image file (I hope you know what you're doing).\n"
+-                );
+-                exit(2);
+-            }
++            bufprint(tmp, tmpend, "%s/data.img", opts->sysdir);
+             opts->data = qemu_strdup(tmp);
+             D("autoconfig: -data %s", opts->data);
+         }
+-        if (!opts->sdcard && opts->datadir) {
+-            bufprint(tmp, tmpend, "%s/sdcard.img", opts->datadir);
++        if (!opts->sdcard && opts->sysdir) {
++            bufprint(tmp, tmpend, "%s/sdcard.img", opts->sysdir);
+             if (path_exists(tmp)) {
+                 opts->sdcard = qemu_strdup(tmp);
+                 D("autoconfig: -sdcard %s", opts->sdcard);
+@@ -2029,19 +1955,6 @@ int main(int argc, char **argv)
+     android_avdParams->skinName     = opts->skin;
+     android_avdParams->skinRootPath = opts->skindir;
+-    /* setup the virtual device differently depending on whether
+-     * we are in the Android build system or not
+-     */
+-    if (opts->avd != NULL)
+-    {
+-        android_avdInfo = avdInfo_new( opts->avd, android_avdParams );
+-        if (android_avdInfo == NULL) {
+-            /* an error message has already been printed */
+-            dprint("could not find virtual device named '%s'", opts->avd);
+-            exit(1);
+-        }
+-    }
+-    else
+     {
+         if (!android_build_out) {
+             android_build_out = android_build_root = opts->sysdir;
+--- a/android/avd/info.c
++++ b/android/avd/info.c
+@@ -1233,10 +1233,8 @@ _getBuildImagePaths( AvdInfo*  i, AvdInf
+      ** take care of checking the state
+      **/
+     imageLoader_set ( l, AVD_IMAGE_INITSYSTEM );
+-    imageLoader_load( l, IMAGE_REQUIRED | IMAGE_DONT_LOCK );
+-
+-    /* force the system image to read-only status */
+-    l->pState[0] = IMAGE_STATE_READONLY;
++    l->pState[0] = IMAGE_STATE_MUSTLOCK;
++    imageLoader_load( l, IMAGE_REQUIRED );
+     /** cache partition handling
+      **/
diff --git a/utils/goldfish-qemu/skins/HVGA/arrow_down.png b/utils/goldfish-qemu/skins/HVGA/arrow_down.png
new file mode 100644 (file)
index 0000000..19b3764
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/arrow_down.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/arrow_left.png b/utils/goldfish-qemu/skins/HVGA/arrow_left.png
new file mode 100644 (file)
index 0000000..113e584
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/arrow_left.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/arrow_right.png b/utils/goldfish-qemu/skins/HVGA/arrow_right.png
new file mode 100644 (file)
index 0000000..ffe3356
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/arrow_right.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/arrow_up.png b/utils/goldfish-qemu/skins/HVGA/arrow_up.png
new file mode 100644 (file)
index 0000000..81c54df
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/arrow_up.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/back.png b/utils/goldfish-qemu/skins/HVGA/back.png
new file mode 100644 (file)
index 0000000..41034d9
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/back.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/device.png b/utils/goldfish-qemu/skins/HVGA/device.png
new file mode 100644 (file)
index 0000000..465eb02
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/device.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/end.png b/utils/goldfish-qemu/skins/HVGA/end.png
new file mode 100644 (file)
index 0000000..6830a60
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/end.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/home.png b/utils/goldfish-qemu/skins/HVGA/home.png
new file mode 100644 (file)
index 0000000..7d02136
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/home.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/key.png b/utils/goldfish-qemu/skins/HVGA/key.png
new file mode 100644 (file)
index 0000000..7a3f563
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/key.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/keyboard.png b/utils/goldfish-qemu/skins/HVGA/keyboard.png
new file mode 100644 (file)
index 0000000..bb076d3
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/keyboard.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/layout b/utils/goldfish-qemu/skins/HVGA/layout
new file mode 100644 (file)
index 0000000..4c3d764
--- /dev/null
@@ -0,0 +1,380 @@
+parts {
+    device {
+        background {
+            image   device.png
+        }
+        display {
+            width   320
+            height  480
+            x       31
+            y       72
+        }
+
+        buttons {
+            soft-left {
+                    image menu.png
+                    x 147
+                    y 555
+            }
+            home {
+                    image home.png
+                    x 48
+                    y 590
+            }
+            back {
+                    image back.png
+                    x 286
+                    y 590
+            }
+            dpad-up {
+                    image arrow_up.png
+                    x 140
+                    y 595
+            }
+            dpad-down {
+                    image arrow_down.png
+                    x 140
+                    y 656
+            }
+            dpad-left {
+                    image arrow_left.png
+                    x 111
+                    y 598
+            }
+            dpad-right {
+                    image arrow_right.png
+                    x 222
+                    y 598
+            }
+            dpad-center {
+                    image select.png
+                    x 142
+                    y 626
+            }
+            phone-dial {
+                    image send.png
+                    x 48
+                    y 646
+            }
+            phone-hangup {
+                    image end.png
+                    x 286
+                    y 646
+            }
+
+            power {
+                    image power.png
+                    x -38
+                    y 52
+            }
+
+            volume-up {
+                    image volume_up.png
+                    x 362
+                    y 260
+            }
+
+            volume-down {
+                    image volume_down.png
+                    x 362
+                    y 310
+            }
+        }
+    }
+
+    keyboard {
+        background {
+            image   keyboard.png
+        }
+        buttons {
+            1 {
+                image  key.png
+                x  0
+                y  0
+            }
+            2 {
+                image  key.png
+                x 37
+                y 0
+            }
+            3 {
+                image  key.png
+                x 74
+                y 0
+            }
+            4 {
+                image  key.png
+                x 111
+                y 0
+            }
+            5 {
+                image  key.png
+                x 148
+                y 0
+            }
+            6 {
+                image  key.png
+                x 185
+                y 0
+            }
+            7 {
+                image  key.png
+                x 222
+                y 0
+            }
+            8 {
+                image  key.png
+                x 259
+                y 0
+            }
+            9 {
+                image  key.png
+                x 296
+                y 0
+            }
+            0 {
+                image  key.png
+                x 333
+                y 0
+            }
+
+            q {
+                image  key.png
+                x  0
+                y  36
+            }
+            w {
+                image  key.png
+                x 37
+                y 36
+            }
+            e {
+                image  key.png
+                x 74
+                y 36
+            }
+            r {
+                image  key.png
+                x 111
+                y 36
+            }
+            t {
+                image  key.png
+                x 148
+                y 36
+            }
+            y {
+                image  key.png
+                x 185
+                y 36
+            }
+            u {
+                image  key.png
+                x 222
+                y 36
+            }
+            i {
+                image  key.png
+                x 259
+                y 36
+            }
+            o {
+                image  key.png
+                x 296
+                y 36
+            }
+            p {
+                image  key.png
+                x 333
+                y 36
+            }
+
+            a {
+                image  key.png
+                x  0
+                y  72
+            }
+            s {
+                image  key.png
+                x 37
+                y 72
+            }
+            d {
+                image  key.png
+                x 74
+                y 72
+            }
+            f {
+                image  key.png
+                x 111
+                y 72
+            }
+            g {
+                image  key.png
+                x 148
+                y 72
+            }
+            h {
+                image  key.png
+                x 185
+                y 72
+            }
+            j {
+                image  key.png
+                x 222
+                y 72
+            }
+            k {
+                image  key.png
+                x 259
+                y 72
+            }
+            l {
+                image  key.png
+                x 296
+                y 72
+            }
+            DEL {
+                image  key.png
+                x 333
+                y 72
+            }
+
+            CAP {
+                image  key.png
+                x  0
+                y  108
+            }
+            z {
+                image  key.png
+                x 37
+                y 108
+            }
+            x {
+                image  key.png
+                x 74
+                y 108
+            }
+            c {
+                image  key.png
+                x 111
+                y 108
+            }
+            v {
+                image  key.png
+                x 148
+                y 108
+            }
+            b {
+                image  key.png
+                x 185
+                y 108
+            }
+            n {
+                image  key.png
+                x 222
+                y 108
+            }
+            m {
+                image  key.png
+                x 259
+                y 108
+            }
+            PERIOD {
+                image  key.png
+                x 296
+                y 108
+            }
+            ENTER {
+                image  key.png
+                x 333
+                y 108
+            }
+
+            ALT {
+                image  key.png
+                x  0
+                y  144
+            }
+            SYM {
+                image  key.png
+                x 37
+                y 144
+            }
+            AT {
+                image  key.png
+                x 74
+                y 144
+            }
+            SPACE {
+                image  spacebar.png
+                x 111
+                y 144
+            }
+            SLASH {
+                image  key.png
+                x 259
+                y 144
+            }
+            COMMA {
+                image  key.png
+                x 296
+                y 144
+            }
+            ALT2 {
+                image  key.png
+                x 333
+                y 144
+            }
+
+        }
+    }
+}
+
+layouts {
+    portrait {
+        width     900
+        height    730
+        color     0xe0e0e0
+        event     EV_SW:0:1
+
+        part1 {
+            name    device
+            x       40
+            y       -18
+        }
+        part2 {
+            name    keyboard
+            x       480
+            y       200
+        }
+    }
+
+    landscape {
+        width     900
+        height    670
+        color     0xe0e0e0
+        event     EV_SW:0:0
+
+        part1 {
+            name      device
+            x         50
+            y         440
+            rotation  3
+        }
+        part2 {
+            name     keyboard
+            x        250
+            y        470
+        }
+    }
+}
+
+keyboard {
+    charmap qwerty2
+}
+
+network {
+    speed  full
+    delay  none
+}
diff --git a/utils/goldfish-qemu/skins/HVGA/menu.png b/utils/goldfish-qemu/skins/HVGA/menu.png
new file mode 100644 (file)
index 0000000..e81d8ab
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/menu.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/power.png b/utils/goldfish-qemu/skins/HVGA/power.png
new file mode 100644 (file)
index 0000000..5894288
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/power.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/select.png b/utils/goldfish-qemu/skins/HVGA/select.png
new file mode 100644 (file)
index 0000000..803d493
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/select.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/send.png b/utils/goldfish-qemu/skins/HVGA/send.png
new file mode 100644 (file)
index 0000000..f547c88
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/send.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/spacebar.png b/utils/goldfish-qemu/skins/HVGA/spacebar.png
new file mode 100644 (file)
index 0000000..19fe604
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/spacebar.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/volume_down.png b/utils/goldfish-qemu/skins/HVGA/volume_down.png
new file mode 100644 (file)
index 0000000..f8a88de
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/volume_down.png differ
diff --git a/utils/goldfish-qemu/skins/HVGA/volume_up.png b/utils/goldfish-qemu/skins/HVGA/volume_up.png
new file mode 100644 (file)
index 0000000..940457f
Binary files /dev/null and b/utils/goldfish-qemu/skins/HVGA/volume_up.png differ
diff --git a/utils/gpiotoggling/Makefile b/utils/gpiotoggling/Makefile
new file mode 100644 (file)
index 0000000..84360b4
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=gpiotoggling
+PKG_RELEASE:=1
+PKG_REV:=b57866441932eabc75b6c4252103121f606dc820
+PKG_VERSION:=$(PKG_REV)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://github.com/mirko/gpio-toggling---linux-kernel-module.git
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=git
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/gpiotoggling
+  SUBMENU:=Other modules
+  TITLE:=Toggle GPIOs in kernel space
+  FILES:=$(PKG_BUILD_DIR)/gpiotoggling.ko
+endef
+
+define Build/Compile
+       $(MAKE) -C $(LINUX_DIR) \
+               ARCH="$(LINUX_KARCH)" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               SUBDIRS="$(PKG_BUILD_DIR)" \
+               modules
+endef
+
+$(eval $(call KernelPackage,gpiotoggling))
diff --git a/utils/gzip/Makefile b/utils/gzip/Makefile
new file mode 100644 (file)
index 0000000..12943fb
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2006-2012 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:=gzip
+PKG_VERSION:=1.4
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/gzip
+PKG_MD5SUM:=e381b8506210c794278f5527cba0e765
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gzip
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=gzip (GNU zip) is a compression utility.
+  URL:=http://www.gzip.org/
+endef
+
+define Package/gzip/description
+       gzip (GNU zip) is a compression utility designed to be a \
+       replacement for compress.
+endef
+
+CONFIGURE_VARS += \
+       gl_cv_func_getopt_gnu=yes \
+       ac_cv_search_clock_gettime=no
+
+define Package/gzip/install
+       $(SED) 's,/bin/bash,/bin/sh,g' $(PKG_INSTALL_DIR)/usr/bin/{gunzip,zcat}
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{gunzip,gzip,zcat} $(1)/usr/bin/
+endef
+
+define Package/gzip/postinst
+#!/bin/sh
+for app in gunzip gzip zcat; do
+  ln -sf ../usr/bin/$$app $${IPKG_INSTROOT}/bin/$$app
+done
+endef
+
+define Package/gzip/postrm
+#!/bin/sh
+for app in gunzip gzip zcat; do
+  ln -sf busybox $${IPKG_INSTROOT}/bin/$$app
+  $${IPKG_INSTROOT}/bin/$$app 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/$$app
+done
+exit 0
+endef
+
+$(eval $(call BuildPackage,gzip))
+
diff --git a/utils/gzip/patches/001-rsyncable.patch b/utils/gzip/patches/001-rsyncable.patch
new file mode 100644 (file)
index 0000000..ddaffc8
--- /dev/null
@@ -0,0 +1,248 @@
+--- a/deflate.c
++++ b/deflate.c
+@@ -131,6 +131,14 @@
+ #endif
+ /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
++#ifndef RSYNC_WIN
++#  define RSYNC_WIN 8192
++#endif
++/* Size of rsync window, must be < MAX_DIST */
++
++#define RSYNC_SUM_MATCH(sum) (((sum) & (RSYNC_WIN - 1)) == 0)
++/* Whether window sum matches magic value */
++
+ /* ===========================================================================
+  * Local data used by the "longest match" routines.
+  */
+@@ -212,6 +220,8 @@ local int compr_level;
+ unsigned near good_match;
+ /* Use a faster search when the previous match is longer than this */
++local ulg rsync_sum;  /* rolling sum of rsync window */
++local ulg rsync_chunk_end; /* next rsync sequence point */
+ /* Values for max_lazy_match, good_match and max_chain_length, depending on
+  * the desired pack level (0..9). The values given below have been tuned to
+@@ -307,6 +317,10 @@ void lm_init (pack_level, flags)
+ #endif
+     /* prev will be initialized on the fly */
++    /* rsync params */
++    rsync_chunk_end = 0xFFFFFFFFUL;
++    rsync_sum = 0;
++
+     /* Set the default configuration parameters:
+      */
+     max_lazy_match   = configuration_table[pack_level].max_lazy;
+@@ -324,6 +338,7 @@ void lm_init (pack_level, flags)
+     strstart = 0;
+     block_start = 0L;
++    rsync_chunk_end = 0xFFFFFFFFUL;
+ #ifdef ASMV
+     match_init(); /* initialize the asm code */
+ #endif
+@@ -543,6 +558,8 @@ local void fill_window()
+         memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
+         match_start -= WSIZE;
+         strstart    -= WSIZE; /* we now have strstart >= MAX_DIST: */
++      if (rsync_chunk_end != 0xFFFFFFFFUL)
++          rsync_chunk_end -= WSIZE;
+         block_start -= (long) WSIZE;
+@@ -570,6 +587,39 @@ local void fill_window()
+     }
+ }
++local void rsync_roll(start, num)
++    unsigned start;
++    unsigned num;
++{
++    unsigned i;
++
++    if (start < RSYNC_WIN) {
++      /* before window fills. */
++      for (i = start; i < RSYNC_WIN; i++) {
++          if (i == start + num) return;
++          rsync_sum += (ulg)window[i];
++      }
++      num -= (RSYNC_WIN - start);
++      start = RSYNC_WIN;
++    }
++
++    /* buffer after window full */
++    for (i = start; i < start+num; i++) {
++      /* New character in */
++      rsync_sum += (ulg)window[i];
++      /* Old character out */
++      rsync_sum -= (ulg)window[i - RSYNC_WIN];
++      if (rsync_chunk_end == 0xFFFFFFFFUL && RSYNC_SUM_MATCH(rsync_sum))
++          rsync_chunk_end = i;
++    }
++}
++
++/* ===========================================================================
++ * Set rsync_chunk_end if window sum matches magic value.
++ */
++#define RSYNC_ROLL(s, n) \
++   do { if (rsync) rsync_roll((s), (n)); } while(0)
++
+ /* ===========================================================================
+  * Flush the current block, with given end-of-file flag.
+  * IN assertion: strstart is set to the end of the current match.
+@@ -617,6 +667,7 @@ local off_t deflate_fast()
+             lookahead -= match_length;
++          RSYNC_ROLL(strstart, match_length);
+           /* Insert new strings in the hash table only if the match length
+              * is not too large. This saves time but degrades compression.
+              */
+@@ -645,9 +696,18 @@ local off_t deflate_fast()
+             /* No match, output a literal byte */
+             Tracevv((stderr,"%c",window[strstart]));
+             flush = ct_tally (0, window[strstart]);
++          RSYNC_ROLL(strstart, 1);
+             lookahead--;
+           strstart++;
+         }
++        if (rsync && strstart > rsync_chunk_end) {
++            ush  attr = 0;          /* ascii/binary flag */
++
++            flush = 1;
++            /* Reset huffman tree */
++            ct_init(&attr, &method);
++            rsync_chunk_end = 0xFFFFFFFFUL;
++        }
+         if (flush) FLUSH_BLOCK(0), block_start = strstart;
+         /* Make sure that we always have enough lookahead, except
+@@ -721,6 +781,7 @@ off_t deflate()
+              */
+             lookahead -= prev_length-1;
+             prev_length -= 2;
++          RSYNC_ROLL(strstart, prev_length+1);
+             do {
+                 strstart++;
+                 INSERT_STRING(strstart, hash_head);
+@@ -733,24 +794,51 @@ off_t deflate()
+             match_available = 0;
+             match_length = MIN_MATCH-1;
+             strstart++;
+-            if (flush) FLUSH_BLOCK(0), block_start = strstart;
++          if (rsync && strstart > rsync_chunk_end) {
++              ush  attr = 0;          /* ascii/binary flag */
++
++              /* Reset huffman tree */
++              ct_init(&attr, &method);
++              rsync_chunk_end = 0xFFFFFFFFUL;
++              flush = 1;
++          }
++            if (flush) FLUSH_BLOCK(0), block_start = strstart;
+         } else if (match_available) {
+             /* If there was no match at the previous position, output a
+              * single literal. If there was a match but the current match
+              * is longer, truncate the previous match to a single literal.
+              */
+             Tracevv((stderr,"%c",window[strstart-1]));
+-            if (ct_tally (0, window[strstart-1])) {
+-                FLUSH_BLOCK(0), block_start = strstart;
+-            }
++          flush = ct_tally (0, window[strstart-1]);
++          if (rsync && strstart > rsync_chunk_end) {
++              ush  attr = 0;          /* ascii/binary flag */
++
++              /* Reset huffman tree */
++              ct_init(&attr, &method);
++              rsync_chunk_end = 0xFFFFFFFFUL;
++
++              flush = 1;
++          }
++            if (flush) FLUSH_BLOCK(0), block_start = strstart;
++          RSYNC_ROLL(strstart, 1);
+             strstart++;
+             lookahead--;
+         } else {
+             /* There is no previous match to compare with, wait for
+              * the next step to decide.
+              */
++          if (rsync && strstart > rsync_chunk_end) {
++              ush  attr = 0;          /* ascii/binary flag */
++
++              /* Reset huffman tree */
++              ct_init(&attr, &method);
++              rsync_chunk_end = 0xFFFFFFFFUL;
++
++              FLUSH_BLOCK(0), block_start = strstart;
++          }
+             match_available = 1;
++          RSYNC_ROLL(strstart, 1);
+             strstart++;
+             lookahead--;
+         }
+--- a/doc/gzip.texi
++++ b/doc/gzip.texi
+@@ -353,6 +353,14 @@ specified on the command line are direct
+ into the directory and compress all the files it finds there (or
+ decompress them in the case of @command{gunzip}).
++@item --rsyncable
++While compressing, synchronize the output occasionally based on the
++input.  This can reduce the compression slightly in some cases, but
++means that the @code{rsync} program can take advantage of similarities
++in the uncompressed input when syncronizing two files compressed with
++this flag.  @code{gunzip} cannot tell the difference between a
++compressed file created with this option, and one created without it.
++
+ @item --suffix @var{suf}
+ @itemx -S @var{suf}
+ Use suffix @var{suf} instead of @samp{.gz}.  Any suffix can be
+--- a/gzip.c
++++ b/gzip.c
+@@ -218,6 +218,7 @@ int  ofd;                  /* output fil
+ unsigned insize;           /* valid bytes in inbuf */
+ unsigned inptr;            /* index of next byte to be processed in inbuf */
+ unsigned outcnt;           /* bytes in output buffer */
++int rsync = 0;             /* make ryncable chunks */
+ static int handled_sig[] =
+   {
+@@ -271,6 +272,7 @@ struct option longopts[] =
+     {"best",       0, 0, '9'}, /* compress better */
+     {"lzw",        0, 0, 'Z'}, /* make output compatible with old compress */
+     {"bits",       1, 0, 'b'}, /* max number of bits per code (implies -Z) */
++    {"rsyncable",  0, 0, 'R'}, /* make rsync-friendly archive */
+     { 0, 0, 0, 0 }
+ };
+@@ -352,6 +354,7 @@ local void help()
+  "  -Z, --lzw         produce output compatible with old compress",
+  "  -b, --bits=BITS   max number of bits per code (implies -Z)",
+ #endif
++ "  --rsyncable       Make rsync-friendly archive",
+  "",
+  "With no FILE, or when FILE is -, read standard input.",
+  "",
+@@ -479,6 +482,9 @@ int main (int argc, char **argv)
+           recursive = 1;
+ #endif
+           break;
++        case 'R':
++          rsync = 1; break;
++
+       case 'S':
+ #ifdef NO_MULTIPLE_DOTS
+             if (*optarg == '.') optarg++;
+--- a/gzip.h
++++ b/gzip.h
+@@ -146,6 +146,7 @@ EXTERN(uch, window);         /* Sliding
+ extern unsigned insize; /* valid bytes in inbuf */
+ extern unsigned inptr;  /* index of next byte to be processed in inbuf */
+ extern unsigned outcnt; /* bytes in output buffer */
++extern int rsync;  /* deflate into rsyncable chunks */
+ extern off_t bytes_in;   /* number of input bytes */
+ extern off_t bytes_out;  /* number of output bytes */
diff --git a/utils/hd-idle/Makefile b/utils/hd-idle/Makefile
new file mode 100644 (file)
index 0000000..981b884
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2008-2012 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:=hd-idle
+PKG_VERSION:=1.04
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=41e52e669fc59fa82ee0c2bcce1336d3
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hd-idle
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Another idle-daemon for attached hard drives
+  SUBMENU:=disc
+  URL:=http://hd-idle.sourceforge.net/
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/$(PKG_NAME) $(PKG_BUILD_DIR)/$(PKG_NAME).c
+endef
+
+define Package/hd-idle/conffiles
+/etc/config/hd-idle
+endef
+
+define Package/hd-idle/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
+endef
+
+$(eval $(call BuildPackage,hd-idle))
diff --git a/utils/hd-idle/files/hd-idle.config b/utils/hd-idle/files/hd-idle.config
new file mode 100644 (file)
index 0000000..4e22c3b
--- /dev/null
@@ -0,0 +1,6 @@
+config 'hd-idle'
+       option 'disk' 'sda'
+       option 'enable_debug' '0'
+       option 'enabled' '0'
+       option 'idle_time_unit' 'minutes'
+       option 'idle_time_interval' '10'
diff --git a/utils/hd-idle/files/hd-idle.init b/utils/hd-idle/files/hd-idle.init
new file mode 100644 (file)
index 0000000..1abf232
--- /dev/null
@@ -0,0 +1,80 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=50
+
+append_bool() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get_bool _val "$section" "$option" '0'
+       [ "$_val" -gt 0 ] && append args "$3"
+}
+
+append_string() {
+       local section="$1"
+       local option="$2"
+       local value="$3"
+       local _val
+       config_get _val "$section" "$option"
+       [ -n "$_val" ] && append args "$3 $_val"
+}
+
+compute_seconds() {
+       local interval="$1"
+       local unit="$2"
+
+       if [ -z "$interval" ]
+       then
+               interval=10
+       fi
+
+       if [ -z "$unit" ]
+       then
+               unit="minutes"
+       fi
+
+       # compute interval in seconds
+       case "$unit" in
+               "days" )
+                       interval_seconds=$(($interval*60*60*24))
+                       ;;
+               "hours" )
+                       interval_seconds=$(($interval*60*60))
+                       ;;
+               "minutes" )
+                       interval_seconds=$(($interval*60))
+                       ;;
+               "seconds" )
+                       interval_seconds=$interval
+                       ;;
+               * )
+                       # default is minutes
+                       interval_seconds=$(($interval*60))
+                       ;;
+       esac
+
+       echo $interval_seconds
+}
+
+start_service() {
+       local section="$1"
+       args=""
+       config_get "interval" "$section" "idle_time_interval"
+       config_get "unit" "$section" "idle_time_unit"
+       append_string "$section" "disk" "-a"
+       append_bool "$section" "enable_debug" "-d"
+       config_get_bool "enabled" "$section" "enabled" '1'
+       [ "$enabled" -gt 0 ] || return 1
+       service_start /usr/bin/hd-idle $args -i "$(compute_seconds $interval $unit)"
+}
+
+start() {
+       config_load "hd-idle"
+       config_foreach start_service "hd-idle"
+}
+
+stop() {
+       service_stop /usr/bin/hd-idle
+}
diff --git a/utils/hdparm/Makefile b/utils/hdparm/Makefile
new file mode 100644 (file)
index 0000000..b3a0f6b
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2006-2012 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:=hdparm
+PKG_VERSION:=9.39
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=2bc17b72403885d4faf959682944243b
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hdparm
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=disc
+  TITLE:=Hard disk drive configuration utilitity
+  URL:=http://sourceforge.net/projects/hdparm/
+endef
+
+define Package/hdparm/description
+ get/set SATA/IDE device parameters
+endef
+
+define Package/hdparm/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/sbin
+endef
+
+$(eval $(call BuildPackage,hdparm))
diff --git a/utils/heyu/Makefile b/utils/heyu/Makefile
new file mode 100644 (file)
index 0000000..6694a26
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2006-2010 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:=heyu
+PKG_VERSION:=2.9.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://heyu.tanj.com/download/
+PKG_MD5SUM:=89d20d7f45109e7add5f0a141eac04eb
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/heyu
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+setserial
+  TITLE:=X10 home automation control using a CM11A
+  URL:=http://heyu.tanj.com/heyu2/
+endef
+
+define Package/heyu/description
+       HEYU is a text-based console program for remotely controlling lights
+       and appliances in the home or office.   It is made available under a
+       free and open source license.
+
+       Heyu uses the CM11A computer interface to send and receive X10 control
+       signals over the AC power lines to modules which can turn On, Off, or
+       Dim attached lamps or appliances.   It can store a schedule of timed
+       events in the CM11A memory for execution when the computer is turned
+       off or disconnected.
+endef
+
+define Package/heyu/conffiles
+/etc/heyu/x10.conf
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               CFLAGS="$(TARGET_CFLAGS) \$$$$(DFLAGS)" \
+       )
+endef
+
+define Package/heyu/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/heyu $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc/$(PKG_NAME)
+       $(INSTALL_DATA) ./files/x10.conf $(1)/etc/$(PKG_NAME)/x10.conf
+endef
+
+$(eval $(call BuildPackage,heyu))
diff --git a/utils/heyu/files/x10.conf b/utils/heyu/files/x10.conf
new file mode 100644 (file)
index 0000000..3cacaf5
--- /dev/null
@@ -0,0 +1,24 @@
+# this file should contain x10 appliance aliases, one per line, as:
+#   appliance-name  housecode  modulenumber
+# for example:
+#  mydesklamp  A       4
+#  atticfan    B       3
+#  sumppump    C       3
+#  manythings  J       1-4
+#
+# IMPORTANT!  disable the serial console if you need to use heyu
+# on /dev/tts/0.  Read http://forum.openwrt.org/viewtopic.php?id=1767
+#
+# NOTE: using /dev/tts/1 requires the setserial package to
+# set the port to use irq 3, otherwise performance will be
+# unbearable as it is polled.
+#
+TTY            /dev/tts/1
+#
+# give your location - for computing sunrise and sunset times
+# Boston, MA USA:
+#LATITUDE      N42:20
+#LONGITUDE     W71:05
+# Menlo Park, CA USA:
+LATITUDE        N37:43
+LONGITUDE       W122:20
diff --git a/utils/heyu/patches/001-avoid_configure.patch b/utils/heyu/patches/001-avoid_configure.patch
new file mode 100644 (file)
index 0000000..ca895e4
--- /dev/null
@@ -0,0 +1,261 @@
+--- /dev/null
++++ b/Makefile
+@@ -0,0 +1,252 @@
++# Makefile for HEYU, a program to control an X10 CM11A computer interface.
++# This makefile is generated by the Configure program.
++#
++BIN = /usr/bin
++MAN = /usr/man/man1
++MAN5 = /usr/man/man5
++GROUP = sys
++OWNER = root
++
++#       set DFLAGS equal to:
++#          -DSYSV       if using SYSTEM V
++#          -DVOID       if compiler doesn't understand 'void'
++
++#This makefile is built for linux
++DFLAGS = -DSYSV -DPOSIX -DHAS_ITIMER -DLINUX -DHASSELECT -DHASTZ -DHASCM17A
++LIBS = -lm -lc
++# # The rest of the makefile should need no changes
++
++## Makefile template for Heyu, a program to control an X10 CM11A computer
++## interface.  From this point on the Makefile is copied from Makefile.in
++## by the Configure program
++
++SRCS =        date.c erase.c info.c  message.c relay.c \
++      monitor.c reset.c setclock.c stop.c \
++      tty.c x10.c xread.c xwrite.c status.c cm11a.c \
++      eeprom.c process.c sun.c cmd.c config.c x10state.c \
++      poll.c modules.c cm17a.c xsync.c timing.c cm10a.c \
++      tty_aux.c relay_aux.c x10aux.c rfxcom.c digimax.c oregon.c
++OBJS =        date.o erase.o info.o message.o relay.o \
++      monitor.o reset.o setclock.o stop.o \
++      tty.o x10.o xread.o xwrite.o status.o cm11a.o \
++      eeprom.o process.o sun.o cmd.o config.o x10state.o \
++      poll.o modules.o cm17a.o xsync.o timing.o cm10a.o \
++      tty_aux.o relay_aux.o x10aux.o rfxcom.o digimax.o oregon.o
++
++OTHERSRC = README README2 Makefile x10config.sample protocol.txt eeprom.h \
++      x10.sched.sample  heyu.1 x10.h x10config.5 x10cm17a.5 \
++      history.txt version.h heyufaq.txt x10sched.5 process.h sun.h \
++      x10scripts.5 Configure Makefile.in install.sh INSTALL LICENSE \
++        README.cm10a x10aux.5 x10state.h rfxcom.h digimax.h oregon.h x10rfxsensors.5\
++      x10rfxmeters.5 x10digimax.5 x10oregon.5
++
++EVERYTHING = $(OTHERSRC) $(SRCS)
++
++all:  heyu
++
++heyu: $(OBJS) version.h
++      $(CC) $(LDFLAGS) -o heyu $(OBJS) $(LIBS)
++      @echo `id` >usergroup.tmp
++      @echo ${HOME}  >userhome.tmp
++      @echo ""
++      @echo "** Now become root and run 'make install' **"
++      @echo ""
++
++$(OBJS): x10.h process.h sun.h Makefile
++
++eeprom.o:     eeprom.h
++info.o:               version.h
++x10state.o:   x10state.c x10state.h rfxcom.h digimax.h oregon.h
++rfxcom.o:     rfxcom.c x10state.h rfxcom.h
++digimax.o:    digimax.c x10state.h digimax.h
++oregon.o:     oregon.c x10state.h oregon.h
++modules.o:    modules.c oregon.h
++poll.o:               poll.c oregon.h
++
++install: $(BIN)/heyu  $(MAN)/heyu.1 $(MAN5)/x10config.5 $(MAN5)/x10sched.5 \
++      $(MAN5)/x10scripts.5 $(MAN5)/x10cm17a.5 $(MAN5)/x10aux.5 \
++      $(MAN5)/x10rfxsensors.5 $(MAN5)/x10rfxmeters.5 $(MAN5)/x10digimax.5 \
++      $(MAN5)/x10oregon.5
++
++maninstall: $(MAN)/heyu.1 $(MAN5)/x10config.5 $(MAN5)/x10sched.5 \
++      $(MAN5)/x10scripts.5 $(MAN5)/x10cm17a.5 $(MAN5)/x10aux.5 \
++      $(MAN5)/x10rfxsensors.5 $(MAN5)/x10rfxmeters.5 \
++      $(MAN5)/x10digimax.5 $(MAN5)/x10oregon.5
++
++uninstall:
++      rm -f $(BIN)/heyu
++      rm -f $(MAN)/heyu.1
++      rm -f $(MAN5)/x10config.5
++      rm -f $(MAN5)/x10sched.5
++      rm -f $(MAN5)/x10scripts.5
++      rm -f $(MAN5)/x10cm17a.5
++      rm -f $(MAN5)/x10aux.5
++      rm -f $(MAN5)/x10rfxsensors.5
++      rm -f $(MAN5)/x10rfxmeters.5
++      rm -f $(MAN5)/x10digimax.5
++      rm -f $(MAN5)/x10oregon.5
++
++$(BIN)/heyu:  heyu
++      mkdir -p -m 755 $(BIN)
++      cp heyu $(BIN)
++      chgrp $(GROUP) $(BIN)/heyu
++      chmod 755 $(BIN)/heyu
++      chown $(OWNER) $(BIN)/heyu
++      ./install.sh
++
++$(MAN)/heyu.1: heyu.1
++      mkdir -p -m 755 $(MAN)
++      cp heyu.1 $(MAN)
++      chmod 644 $(MAN)/heyu.1
++
++$(MAN5)/x10config.5: x10config.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10config.5 $(MAN5)
++      chmod 644 $(MAN5)/x10config.5
++
++$(MAN5)/x10sched.5: x10sched.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10sched.5 $(MAN5)
++      chmod 644 $(MAN5)/x10sched.5
++
++$(MAN5)/x10scripts.5: x10scripts.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10scripts.5 $(MAN5)
++      chmod 644 $(MAN5)/x10scripts.5
++
++$(MAN5)/x10cm17a.5: x10cm17a.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10cm17a.5 $(MAN5)
++      chmod 644 $(MAN5)/x10cm17a.5
++
++$(MAN5)/x10aux.5: x10aux.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10aux.5 $(MAN5)
++      chmod 644 $(MAN5)/x10aux.5
++
++$(MAN5)/x10rfxsensors.5: x10rfxsensors.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10rfxsensors.5 $(MAN5)
++      chmod 644 $(MAN5)/x10rfxsensors.5
++
++$(MAN5)/x10rfxmeters.5: x10rfxmeters.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10rfxmeters.5 $(MAN5)
++      chmod 644 $(MAN5)/x10rfxmeters.5
++
++$(MAN5)/x10digimax.5: x10digimax.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10digimax.5 $(MAN5)
++      chmod 644 $(MAN5)/x10digimax.5
++
++$(MAN5)/x10oregon.5: x10oregon.5
++      mkdir -p -m 755 $(MAN5)
++      cp x10oregon.5 $(MAN5)
++      chmod 644 $(MAN5)/x10oregon.5
++
++lint:
++      lint $(DFLAGS) $(SRCS)
++
++shar: x10_heyu.shar.1 x10_heyu.shar.2
++
++x10.o:        x10.c version.h
++process.o:    process.c version.h
++xread.o:      xread.c local.h
++
++ci:   $(SRCS) index.html Makefile
++      @ for FL in $+ ; do \
++      if test -w $$FL ; then \
++        ci -l $$FL ;\
++      fi ;\
++      done
++
++x10_heyu.shar.1:
++      shar $(OTHERSRC) >x10_heyu.shar.1
++
++x10_heyu.shar.2:
++      shar $(SRCS) > x10_heyu.shar.2
++
++bigshar:
++      shar $(EVERYTHING) > x10_heyu.shar
++
++tar:    x10_heyu.tgz
++
++x10_heyu.tgz: $(EVERYTHING)
++      rm -fr heyu.dir
++      mkdir heyu.dir
++      cp -p $(EVERYTHING) heyu.dir
++      cp Makefile.dist heyu.dir/Makefile
++      tar -czvf x10_heyu.tgz heyu.dir
++
++heyudistro:   $(EVERYTHING)
++      rm -rf distro.dir
++      mkdir distro.dir
++      cp -p $(EVERYTHING) distro.dir
++      cp -p release_notes.txt distro.dir
++      cp -p INSTALL distro.dir/README.INSTALL
++      rm distro.dir/Makefile
++
++man2html:
++      man2html heyu.1 >./html/heyu.1.html
++      man2html x10config.5 >./html/x10config.5.html
++      man2html x10scripts.5 > ./html/x10scripts.5.html
++      man2html x10sched.5 > ./html/x10sched.5.html
++      man2html x10aux.5 > ./html/x10aux.5.html
++      man2html x10cm17a.5 > ./html/x10cm17a.5.html
++      man2html x10rfxsensors.5 > ./html/x10rfxsensors.5.html
++      man2html x10rfxmeters.5 > ./html/x10rfxmeters.5.html
++      man2html x10digimax.5 > ./html/x10digimax.5.html
++      man2html x10oregon.5 > ./html/x10oregon.5.html
++
++beta: x10_beta.tgz
++
++x10_beta.tgz: $(EVERYTHING)
++      rm -fr heyu.beta
++      mkdir heyu.beta
++      cp -p $(EVERYTHING) heyu.beta
++      cp Makefile.dist heyu.dir/Makefile
++      tar -czvf x10_beta.tgz heyu.beta
++
++zip:  x10_heyu.zip
++
++x10_heyu.zip: $(EVERYTHING)
++      rm -f x10_heyu.zip
++      zip -kl x10_heyu.zip $(EVERYTHING)
++
++touch:
++      touch $(OTHERSRC)
++      touch $(SRCS)
++
++clean:
++      rm -f *.o
++
++clobber: clean
++      rm -f heyu
++
++upload:       heyu index.html x10_heyu.tgz x10_heyu.zip
++      /bin/sh -c ./upload.sh
++
++rcsdiffrw:
++      @-for x in `$(MAKE) rw` ;\
++      do      \
++              echo            ;\
++              echo $$x        ;\
++              echo =========  ;\
++              rcsdiff $$x     ;\
++      done 2>&1               ;\
++      echo                    ;\
++      echo all done
++
++list:
++      @ls $(EVERYTHING) | more
++
++rw:
++      @ls -l $(EVERYTHING) | \
++              egrep '^[^l].w' | \
++              sed 's;.* ;;'   # strip to last space
++
++populate: $(EVERYTHING)
++
++$(EVERYTHING):
++##    co -r$(revision) $@
++
+--- /dev/null
++++ b/local.h
+@@ -0,0 +1,3 @@
++#define USESIGINT 1'
++#define SPOOLDIR "/tmp"
++#define LOCKDIR "/tmp"
diff --git a/utils/hplip/Makefile b/utils/hplip/Makefile
new file mode 100644 (file)
index 0000000..313ebff
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# 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:=hplip
+PKG_VERSION:=3.9.12
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/hplip
+PKG_MD5SUM:=2b0906b4a57b437988829557ca62adfd
+
+PKG_BUILD_DEPENDS := python
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hplip
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=HP Linux Imaging and Printing
+  URL:=http://sourceforge.net/projects/hplip/
+  DEPENDS+=+libjpeg +libtiff +libusb-compat +cups +sane-libs
+endef
+
+define Package/hplip/description
+       HPLIP is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers in Linux.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-gui-build \
+       --disable-network-build \
+       --disable-fax-build \
+       --disable-pp-build \
+       --disable-doc-build \
+       --disable-foomatic-xml-install \
+       --disable-dbus-build
+
+define Build/Configure
+       $(call Build/Configure/Default,\
+               $(CONFIGURE_ARGS),\
+               ac_cv_lib_cups_cupsDoFileRequest=yes \
+               LIBS="-lz -ljpeg -lusb -lcups -lpng -ltiff" \
+       )
+endef
+
+define Package/hplip/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/.libs/libhpip.so* $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/.libs/libhpmud.so* $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/cups/backend
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/.libs/hp $(1)/usr/lib/cups/backend
+
+       $(INSTALL_DIR) $(1)/usr/lib/sane
+       $(CP) $(PKG_BUILD_DIR)/.libs/libsane-hpaio.so* $(1)/usr/lib/sane
+
+       $(INSTALL_DIR) $(1)/etc/hp
+       $(CP) $(PKG_BUILD_DIR)/hplip.conf $(1)/etc/hp/hplip.conf
+
+       $(INSTALL_DIR) $(1)/usr/share/hplip/data/models/
+       $(CP) $(PKG_BUILD_DIR)/data/models/models.dat $(1)/usr/share/hplip/data/models/
+
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/usb/
+       $(INSTALL_BIN) ./files/20-hplip $(1)/etc/hotplug.d/usb/
+
+       $(INSTALL_DIR) $(1)/etc/sane.d/dll.d/
+       $(INSTALL_DATA) ./files/hplib.conf $(1)/etc/sane.d/dll.d/hplib
+endef
+
+define Package/hplip/conffiles
+/etc/hp/hplip.conf
+endef
+
+$(eval $(call BuildPackage,hplip))
diff --git a/utils/hplip/files/20-hplip b/utils/hplip/files/20-hplip
new file mode 100644 (file)
index 0000000..6066cc5
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Copyright (C) 2009 OpenWrt.org
+
+
+case "$ACTION" in
+        add)
+                # You have to figure out your PRODUCT id. Uncomment the line below,
+                # attach and detach your HP USB printer to find your id in /tmp/hplip.test.
+                # It will look like "Found 3f0/1717/100 on /proc/bus/usb/002/009"
+                # Replace 3f0/1717/100 below with your id.
+                #
+                # echo "Found $PRODUCT on $DEVICE" > /tmp/hplip.test
+
+                [ "$PRODUCT" = "3f0/1717/100" ] && chown nobody $DEVICE && chmod 666 $DEVICE
+                ;;
+        remove)
+                # device is gone
+                ;;
+esac
diff --git a/utils/hplip/files/hplib.conf b/utils/hplip/files/hplib.conf
new file mode 100644 (file)
index 0000000..d67d370
--- /dev/null
@@ -0,0 +1,2 @@
+# Load the hplib driver
+hpaio
diff --git a/utils/huaweiaktbbo/Makefile b/utils/huaweiaktbbo/Makefile
new file mode 100644 (file)
index 0000000..81c4b56
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2008-2009 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:=huaweiaktbbo
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/huaweiaktbbo
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libusb-compat
+  TITLE:=Huawei E156/E169/E220 activation tool
+endef
+
+define Build/Prepare   
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS) \
+               -lusb \
+               -o $(PKG_BUILD_DIR)/huaweiAktBbo \
+               $(PKG_BUILD_DIR)/huaweiAktBbo.c
+endef
+
+define Package/huaweiaktbbo/install    
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/huaweiAktBbo $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,huaweiaktbbo))
diff --git a/utils/huaweiaktbbo/src/huaweiAktBbo.c b/utils/huaweiaktbbo/src/huaweiAktBbo.c
new file mode 100644 (file)
index 0000000..09c9050
--- /dev/null
@@ -0,0 +1,95 @@
+/* HUAWEI 3G modems activator
+   Copyright (C) 2006 bobovsky bobovsky@kanoistika.sk  GPL
+   Copyright (C) 2009 Nuno Goncalves nunojpg@gmail.com GPL
+   This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License2.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <signal.h>
+#include <ctype.h>
+#include <usb.h>
+
+struct usb_dev_handle *devh;
+
+void release_usb_device(int dummy) {
+       int ret;
+       ret = usb_release_interface(devh, 0);
+
+       if (!ret)
+               printf("failed to release interface: %d\n", ret);
+
+       usb_close(devh);
+
+       if (!ret)
+               printf("failed to close interface: %d\n", ret);
+
+       exit(1);
+}
+
+void list_devices() {
+       struct usb_bus *bus;
+       for (bus = usb_get_busses(); bus; bus = bus->next) {
+       struct usb_device *dev;
+
+       for (dev = bus->devices; dev; dev = dev->next)
+               printf("0x%04x 0x%04x\n", dev->descriptor.idVendor, dev->descriptor.idProduct);
+    }
+}    
+
+struct usb_device *find_device() {
+       struct usb_bus *bus;
+
+       for (bus = usb_get_busses(); bus; bus = bus->next) {
+               struct usb_device *dev;
+
+               for (dev = bus->devices; dev; dev = dev->next) {
+               if (dev->descriptor.idVendor == 0x12d1 && dev->descriptor.idProduct == 0x1001 || //Huawei E169, Huawei E169G
+                   dev->descriptor.idVendor == 0x12d1 && dev->descriptor.idProduct == 0x1003)   //Huawei E220, Huawei E156G
+               return dev;
+               }
+       }
+       return NULL;
+}
+
+int main(int argc, char **argv) {
+       int ret, vendor, product;
+       struct usb_device *dev;
+       char buf[65535], *endptr;
+
+       usb_init();
+       usb_find_busses();
+       usb_find_devices();
+
+       printf("Searching modem...");
+       dev = find_device();
+
+       if(dev == NULL){
+               printf("No supported modem found\n");
+               return 1;
+       }
+
+       printf("found supported modem!\n");
+
+       assert(dev);
+       devh = usb_open(dev);
+       assert(devh);
+
+       signal(SIGTERM, release_usb_device);
+
+       ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012);
+       usleep(1*1000);
+       ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000009);
+       usleep(1*1000);
+       ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000020);
+       usleep(1*1000);
+       ret = usb_control_msg(devh, USB_TYPE_STANDARD + USB_RECIP_DEVICE, USB_REQ_SET_FEATURE, 00000001, 0, buf, 0, 1000);
+
+       ret = usb_close(devh);
+       assert(ret == 0);
+       
+       printf("Modem poked!\n");
+       return 0;
+}
diff --git a/utils/i2c-tools/Makefile b/utils/i2c-tools/Makefile
new file mode 100644 (file)
index 0000000..9721700
--- /dev/null
@@ -0,0 +1,110 @@
+#
+# Copyright (C) 2007-2013 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:=i2c-tools
+PKG_VERSION:=2013-12-15
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_URL:=http://lm-sensors.org/svn/i2c-tools/trunk
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=r6204
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=PACKAGE_python-smbus:python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/i2c/Default
+  URL:=http://lm-sensors.org/wiki/I2CTools
+  TITLE:=I2C
+endef
+
+define Package/libi2c
+  $(call Package/i2c/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+=library
+endef
+
+define Package/i2c-tools
+  $(call Package/i2c/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+=tools for Linux
+  DEPENDS:=+libi2c
+endef
+
+define Package/python-smbus
+  $(call Package/i2c/Default)
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python bindings for the SMBUS
+  DEPENDS:=+PACKAGE_python-smbus:python-mini +i2c-tools
+endef
+
+define Package/i2c-tools/description
+ This package contains an heterogeneous set of I2C tools for Linux. These tools
+ were originally part of the lm-sensors package.
+endef
+
+define Package/python-smbus/description
+ This package contain the python bindings for Linux SMBus access through i2c-dev.
+endef
+
+TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
+
+ifdef CONFIG_PACKAGE_python-smbus
+  define Build/Compile/python-smbus
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,./py-smbus/, \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+  endef
+endif
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               LINUX="$(LINUX_DIR)" \
+               CC="$(TARGET_CC)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               CFLAGS="$(TARGET_CFLAGS)"
+       $(Build/Compile/python-smbus)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libi2c.so* $(1)/usr/lib/
+endef
+
+define Package/libi2c/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/lib/libi2c.so* $(1)/usr/lib/
+endef
+
+define Package/i2c-tools/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
+endef
+
+define PyPackage/python-smbus/filespec
++|$(PYTHON_PKG_DIR)/smbus.so
+endef
+
+$(eval $(call BuildPackage,libi2c))
+$(eval $(call BuildPackage,i2c-tools))
+$(eval $(call PyPackage,python-smbus))
+$(eval $(call BuildPackage,python-smbus))
diff --git a/utils/iioutils/Makefile b/utils/iioutils/Makefile
new file mode 100644 (file)
index 0000000..905785c
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2012-2013 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:=iioutils
+PKG_VERSION:=0.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=8a88b711d3d6a7fedd75af833c5470cb
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/iioutils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+sysfsutils
+  TITLE:=Linux IIO Utilities
+  URL:=http://sourceforge.net/projects/iioutils/
+endef
+
+define Package/iioutils/description
+       lsiio is a utility for displaying information about IndustrialIO devices in the system and
+       the sensors provided by them.
+endef
+
+TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components 1 $(TAR_OPTIONS)
+
+define Package/iioutils/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{lsiio,iio_ring} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,iioutils))
diff --git a/utils/ink/Makefile b/utils/ink/Makefile
new file mode 100644 (file)
index 0000000..cc617b7
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2009-2010 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:=ink
+PKG_VERSION:=0.5.1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ink
+PKG_MD5SUM:=df09c4a1a404dd37ffff80ce2491ab6d
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ink
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A utility for reading ink levels
+  URL:=http://ink.sourceforge.net/
+  DEPENDS:=+libinklevel
+endef
+
+define Package/ink/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ink $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,ink))
diff --git a/utils/input-utils/Makefile b/utils/input-utils/Makefile
new file mode 100644 (file)
index 0000000..a8038b6
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2007,2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=input-utils
+PKG_VERSION:=1.1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/input-$(PKG_VERSION)/
+PKG_SOURCE:=input-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://www.kraxel.org/cgit/input/snapshot
+PKG_MD5SUM:=592b1b45d9d891725f7793999aa52f31
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/input-utils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Utilities for the input layer of the Linux kernel
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C "$(PKG_BUILD_DIR)" \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               STRIP="true" \
+               INPUT="$(LINUX_DIR)/include/uapi/linux/input.h" \
+               build
+endef
+
+define Package/input-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/input-events $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/input-kbd $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lsinput $(1)/usr/bin/
+
+endef
+
+$(eval $(call BuildPackage,input-utils))
diff --git a/utils/input-utils/patches/001-Makefile_use_bash.patch b/utils/input-utils/patches/001-Makefile_use_bash.patch
new file mode 100644 (file)
index 0000000..3460e1a
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/mk/Autoconf.mk
++++ b/mk/Autoconf.mk
+@@ -12,6 +12,9 @@
+ #
+ ########################################################################
++# fix echo -e with dash on Debian/Ubuntu 
++SHELL=/bin/bash
++
+ # verbose yes/no
+ verbose               ?= no
diff --git a/utils/input-utils/patches/002-use_cross_headers_from_env.patch b/utils/input-utils/patches/002-use_cross_headers_from_env.patch
new file mode 100644 (file)
index 0000000..02ec8d5
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/name.sh
++++ b/name.sh
+@@ -1,7 +1,6 @@
+ #!/bin/sh
+ TYPE="$1"
+-INPUT="/usr/include/linux/input.h"
+ awk "
+       /KEY_MIN_INTERESTING/   {next};
diff --git a/utils/io/Makefile b/utils/io/Makefile
new file mode 100644 (file)
index 0000000..3bf2e89
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007 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:=io
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/io
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Raw memory i/o utility
+  URL:=http://www.sleepie.demon.co.uk/linuxvme/io.c
+endef
+
+define Package/io/description
+       This tool can be used to access physical memory addresses from userspace.
+       It can be useful to access hardware for which no device driver exists!
+endef
+
+define Build/Prepare
+       $(INSTALL_DIR) $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -Os $(PKG_BUILD_DIR)/io.c -o $(PKG_BUILD_DIR)/$(PKG_NAME)
+endef
+
+define Package/io/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/io $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,io))
diff --git a/utils/io/src/io.c b/utils/io/src/io.c
new file mode 100644 (file)
index 0000000..caa23e0
--- /dev/null
@@ -0,0 +1,425 @@
+/*
+ * Simple app. to do memory accesses via /dev/mem.
+ *
+ *
+ * Copyright (c) Richard Hirst <rhirst@linuxcare.com>
+ * Copyright (c) Thomas Langer <thomas.langer@infineon.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#define MEM_READ  0
+#define MEM_WRITE 1
+#define MEM_AND   2
+#define MEM_OR    3
+
+static void
+usage (char *argv0)
+{
+       fprintf(stderr,
+"Raw memory i/o utility - $Revision: 2.0 $\n\n"
+"%s -v -1|2|4 -r|w|a|o [-l <len>] [-f <file>] <addr> [<value>]\n\n"
+"    -v         Verbose, asks for confirmation\n"
+"    -1|2|4     Sets memory access size in bytes (default byte)\n"
+"    -l <len>   Length in bytes of area to access (defaults to\n"
+"               one access, or whole file length)\n"
+"    -r|w|a|o   Read from or Write to memory (default read)\n"
+"               optional write with modify (and/or)\n"
+"    -f <file>  File to write on memory read, or\n"
+"               to read on memory write\n"
+"    <addr>     The memory address to access\n"
+"    <val>      The value to write (implies -w)\n\n"
+"Examples:\n"
+"    %s 0x1000                  Reads one byte from 0x1000\n"
+"    %s 0x1000 0x12             Writes 0x12 to location 0x1000\n"
+"    %s -2 -l 8 0x1000          Reads 8 words from 0x1000\n"
+"    %s -r -f dmp -l 100 200    Reads 100 bytes from addr 200 to file\n"
+"    %s -w -f img 0x10000       Writes the whole of file to memory\n"
+"\n"
+"Note access size (-1|2|4) does not apply to file based accesses.\n\n",
+               argv0, argv0, argv0, argv0, argv0, argv0);
+       exit(1);
+}
+
+
+static void
+memread_memory(unsigned long phys_addr, void *addr, int len, int iosize)
+{
+       int i;
+
+       while (len) {
+               printf("%08lx: ", phys_addr);
+               i = 0;
+               while (i < 16 && len) {
+                       switch(iosize) {
+                       case 1:
+                               printf(" %02x", *(unsigned char *)addr);
+                               break;
+                       case 2:
+                               printf(" %04x", *(unsigned short *)addr);
+                               break;
+                       case 4:
+                               printf(" %08lx", *(unsigned long *)addr);
+                               break;
+                       }
+                       i += iosize;
+                       addr += iosize;
+                       len -= iosize;
+               }
+               phys_addr += 16;
+               printf("\n");
+       }
+}
+
+
+static void
+write_memory(unsigned long phys_addr, void *addr, int len, int iosize, unsigned long value)
+{
+       switch(iosize) {
+       case 1:
+               while (len) {
+                       *(unsigned char *)addr = value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       case 2:
+               while (len) {
+                       *(unsigned short *)addr = value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       case 4:
+               while (len) {
+                       *(unsigned long *)addr = value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       }
+}
+
+
+static void
+and_write_memory(unsigned long phys_addr, void *addr, int len, int iosize, unsigned long value)
+{
+       switch(iosize) {
+       case 1:
+               while (len) {
+                       *(unsigned char *)addr &= value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       case 2:
+               while (len) {
+                       *(unsigned short *)addr &= value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       case 4:
+               while (len) {
+                       *(unsigned long *)addr &= value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       }
+}
+
+
+static void
+or_write_memory(unsigned long phys_addr, void *addr, int len, int iosize, unsigned long value)
+{
+       switch(iosize) {
+       case 1:
+               while (len) {
+                       *(unsigned char *)addr |= value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       case 2:
+               while (len) {
+                       *(unsigned short *)addr |= value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       case 4:
+               while (len) {
+                       *(unsigned long *)addr |= value;
+                       len -= iosize;
+                       addr += iosize;
+               }
+               break;
+       }
+}
+
+
+int
+main (int argc, char **argv)
+{
+       int mfd, ffd = 0, req_len = 0, opt;
+       void *real_io;
+       unsigned long real_len, real_addr, req_addr, req_value = 0, offset;
+       char *endptr;
+       int memfunc = MEM_READ;
+       int iosize = 1;
+       char *filename = NULL;
+       int verbose = 0;
+
+       opterr = 0;
+       if (argc == 1)
+               usage(argv[0]);
+
+       while ((opt = getopt(argc, argv, "hv124rwaol:f:")) > 0) {
+               switch (opt) {
+               case 'h':
+                       usage(argv[0]);
+               case 'v':
+                       verbose = 1;
+                       break;
+               case '1':
+               case '2':
+               case '4':
+                       iosize = opt - '0';
+                       break;
+               case 'r':
+                       memfunc = MEM_READ;
+                       break;
+               case 'a':
+                       memfunc = MEM_AND;
+                       break;
+               case 'o':
+                       memfunc = MEM_OR;
+                       break;
+               case 'w':
+                       memfunc = MEM_WRITE;
+                       break;
+               case 'l':
+                       req_len = strtoul(optarg, &endptr, 0);
+                       if (*endptr) {
+                               fprintf(stderr, "Bad <size> value '%s'\n", optarg);
+                               exit(1);
+                       }
+                       break;
+               case 'f':
+                       filename = strdup(optarg);
+                       break;
+               default:
+                       fprintf(stderr, "Unknown option: %c\n", opt);
+                       usage(argv[0]);
+               }
+       }
+
+       if (optind == argc) {
+               fprintf(stderr, "No address given\n");
+               exit(1);
+       }
+       req_addr = strtoul(argv[optind], &endptr, 0);
+       if (*endptr) {
+               fprintf(stderr, "Bad <addr> value '%s'\n", argv[optind]);
+               exit(1);
+       }
+       optind++;
+       if (!filename && (memfunc == MEM_READ) && optind < argc) {
+               memfunc = MEM_WRITE;
+       }
+       if (filename && optind > argc) {
+               fprintf(stderr, "Filename AND value given\n");
+               exit(1);
+       }
+       if (!filename && (memfunc != MEM_READ) && optind == argc) {
+               fprintf(stderr, "No value given for WRITE\n");
+               exit(1);
+       }
+       if (!filename && (memfunc != MEM_READ)) {
+               req_value = strtoul(argv[optind], &endptr, 0);
+               if (*endptr) {
+                       fprintf(stderr, "Bad <value> value '%s'\n", argv[optind]);
+                       exit(1);
+               }
+               if ((iosize == 1 && (req_value & 0xffffff00)) ||
+                               (iosize == 2 && (req_value & 0xffff0000))) {
+                       fprintf(stderr, "<value> too large\n");
+                       exit(1);
+               }
+               optind++;
+       }
+       if (filename && (memfunc == MEM_READ) && !req_len) {
+               fprintf(stderr, "No size given for file memread\n");
+               exit(1);
+       }
+       if (optind < argc) {
+               fprintf(stderr, "Too many arguments '%s'...\n", argv[optind]);
+               exit(1);
+       }
+       if (filename && (memfunc == MEM_READ)) {
+               ffd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+               if (ffd < 0) {
+                       fprintf(stderr, "Failed to open destination file '%s': %s\n", filename, strerror(errno));
+                       exit(1);
+               }
+       }
+       if (filename && (memfunc != MEM_READ)) {
+               ffd = open(filename, O_RDONLY);
+               if (ffd < 0) {
+                       fprintf(stderr, "Failed to open source file '%s': %s\n", filename, strerror(errno));
+                       exit(1);
+               }
+       }
+
+       if (filename && !req_len) {
+               req_len = lseek(ffd, 0, SEEK_END);
+               if (req_len < 0) {
+                       fprintf(stderr, "Failed to seek on '%s': %s\n",
+                                       filename, strerror(errno));
+                       exit(1);
+               }
+               if (lseek(ffd, 0, SEEK_SET)) {
+                       fprintf(stderr, "Failed to seek on '%s': %s\n",
+                                       filename, strerror(errno));
+                       exit(1);
+               }
+       }
+       if (!req_len)
+               req_len = iosize;
+
+       if ((iosize == 2 && (req_addr & 1)) ||
+                       (iosize == 4 && (req_addr & 3))) {
+               fprintf(stderr, "Badly aligned <addr> for access size\n");
+               exit(1);
+       }
+       if ((iosize == 2 && (req_len & 1)) ||
+                       (iosize == 4 && (req_len & 3))) {
+               fprintf(stderr, "Badly aligned <size> for access size\n");
+               exit(1);
+       }
+
+       if (!verbose)
+               /* Nothing */;
+       else if (filename && (memfunc == MEM_READ))
+               printf("Request to read 0x%x bytes from address 0x%08lx\n"
+                       "\tto file %s, using %d byte accesses\n",
+                       req_len, req_addr, filename, iosize);
+       else if (filename)
+               printf("Request to write 0x%x bytes to address 0x%08lx\n"
+                       "\tfrom file %s, using %d byte accesses\n",
+                       req_len, req_addr, filename, iosize);
+       else if (memfunc == MEM_READ)
+               printf("Request to read 0x%x bytes from address 0x%08lx\n"
+                       "\tusing %d byte accesses\n",
+                       req_len, req_addr, iosize);
+       else
+               printf("Request to write 0x%x bytes to address 0x%08lx\n"
+                       "\tusing %d byte accesses of value 0x%0*lx\n",
+                       req_len, req_addr, iosize, iosize*2, req_value);
+
+       real_addr = req_addr & ~4095;
+       if (real_addr == 0xfffff000) {
+               fprintf(stderr, "Sorry, cannot map the top 4K page\n");
+               exit(1);
+       }
+       offset = req_addr - real_addr;
+       real_len = req_len + offset;
+       real_len = (real_len + 4095) & ~ 4095;
+       if (real_addr + real_len < real_addr) {
+               fprintf(stderr, "Aligned addr+len exceeds top of address space\n");
+               exit(1);
+       }
+       if (verbose)
+               printf("Attempting to map 0x%lx bytes at address 0x%08lx\n",
+                       real_len, real_addr);
+
+       mfd = open("/dev/mem", (memfunc == MEM_READ) ? O_RDONLY : O_RDWR);
+       if (mfd == -1) {
+               perror("open /dev/mem");
+               exit(1);
+       }
+       if (verbose)
+               printf("open(/dev/mem) ok\n");
+       real_io = mmap(NULL, real_len,
+                       (memfunc == MEM_READ) ? PROT_READ:PROT_READ|PROT_WRITE,
+                       MAP_SHARED, mfd, real_addr);
+       if (real_io == (void *)(-1)) {
+               fprintf(stderr, "mmap() failed: %s\n", strerror(errno));
+               exit(1);
+       }
+       if (verbose)
+               printf("mmap() ok\n");
+
+       if (verbose) {
+               int c;
+
+               printf("OK? ");
+               fflush(stdout);
+               c = getchar();
+               if (c != 'y' && c != 'Y') {
+                       printf("Aborted\n");
+                       exit(1);
+               }
+       }
+
+       if (filename && (memfunc == MEM_READ)) {
+               int n = write(ffd, real_io + offset, req_len);
+
+               if (n < 0) {
+                       fprintf(stderr, "File write failed: %s\n", strerror(errno));
+                       exit(1);
+               }
+               else if (n != req_len) {
+                       fprintf(stderr, "Only wrote %d of %d bytes to file\n",
+                                       n, req_len);
+                       exit(1);
+               }
+       }
+       else if (filename) {
+               int n = read(ffd, real_io + offset, req_len);
+
+               if (n < 0) {
+                       fprintf(stderr, "File read failed: %s\n", strerror(errno));
+                       exit(1);
+               }
+               else if (n != req_len) {
+                       fprintf(stderr, "Only read %d of %d bytes from file\n",
+                                       n, req_len);
+                       exit(1);
+               }
+       }
+       else {
+               switch (memfunc)
+               {
+               case MEM_READ:
+                       memread_memory(req_addr, real_io + offset, req_len, iosize);
+                       break;
+               case MEM_WRITE:
+                       write_memory(req_addr, real_io + offset, req_len, iosize, req_value);
+                       break;
+               case MEM_AND:
+                       and_write_memory(req_addr, real_io + offset, req_len, iosize, req_value);
+                       break;
+               case MEM_OR:
+                       or_write_memory(req_addr, real_io + offset, req_len, iosize, req_value);
+                       break;
+               }
+       }
+
+       if (filename)
+               close(ffd);
+       close (mfd);
+
+       return 0;
+}
+
diff --git a/utils/ipmitool/Makefile b/utils/ipmitool/Makefile
new file mode 100644 (file)
index 0000000..2a4fd5f
--- /dev/null
@@ -0,0 +1,49 @@
+# Copyright (C) 2008-2010, OpenWrt.org
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ipmitool
+PKG_VERSION:=1.8.11
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/ipmitool
+PKG_MD5SUM:=1d0da20add7388d64c549f95538b6858
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ipmitool
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libopenssl +libncurses +libreadline
+  TITLE:=IPMI remote computer management utility
+  URL:=http://ipmitool.sourceforge.net/
+endef
+
+define Package/ipmitool/description
+  IPMItool is a utility for managing and configuring devices
+  that support the Intelligent Platform Management Interface
+  (IPMI) version 1.5 and version 2.0 specifications.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static=no \
+       --enable-internal-md5 \
+       --enable-intf-lan=yes \
+       --enable-intf-lanplus=no \
+       --enable-intf-free=no \
+       --enable-intf-open=no \
+       --enable-intf-imb=no \
+       --enable-intf-lipmi=no \
+       --enable-intf-bmc=no
+
+define Package/ipmitool/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ipmitool $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ipmitool))
+
diff --git a/utils/ipmitool/patches/100-cubic_root.patch b/utils/ipmitool/patches/100-cubic_root.patch
new file mode 100644 (file)
index 0000000..11ebffa
--- /dev/null
@@ -0,0 +1,149 @@
+--- a/lib/ipmi_sdr.c
++++ b/lib/ipmi_sdr.c
+@@ -4399,3 +4399,146 @@ ipmi_sdr_main(struct ipmi_intf *intf, in
+       return rc;
+ }
++
++/*                                                    cbrt.c
++ *
++ *    Cube root
++ *
++ *
++ *
++ * SYNOPSIS:
++ *
++ * double x, y, cbrt();
++ *
++ * y = cbrt( x );
++ *
++ *
++ *
++ * DESCRIPTION:
++ *
++ * Returns the cube root of the argument, which may be negative.
++ *
++ * Range reduction involves determining the power of 2 of
++ * the argument.  A polynomial of degree 2 applied to the
++ * mantissa, and multiplication by the cube root of 1, 2, or 4
++ * approximates the root to within about 0.1%.  Then Newton's
++ * iteration is used three times to converge to an accurate
++ * result.
++ *
++ *
++ *
++ * ACCURACY:
++ *
++ *                      Relative error:
++ * arithmetic   domain     # trials      peak         rms
++ *    DEC        -10,10     200000      1.8e-17     6.2e-18
++ *    IEEE       0,1e308     30000      1.5e-16     5.0e-17
++ *
++ */
++/*                                                    cbrt.c  */
++
++/*
++Cephes Math Library Release 2.8:  June, 2000
++Copyright 1984, 1991, 2000 by Stephen L. Moshier
++*/
++
++
++static double CBRT2  = 1.2599210498948731647672;
++static double CBRT4  = 1.5874010519681994747517;
++static double CBRT2I = 0.79370052598409973737585;
++static double CBRT4I = 0.62996052494743658238361;
++
++#ifdef ANSIPROT
++extern double frexp ( double, int * );
++extern double ldexp ( double, int );
++extern int isnan ( double );
++extern int isfinite ( double );
++#else
++/*
++double frexp(), ldexp();
++int isnan(double), isfinite(double);
++*/
++#endif
++
++double cbrt(double x)
++{
++/* double x; */
++int e, rem, sign;
++double z;
++
++#ifdef NANS
++if( isnan(x) )
++  return x;
++#endif
++#ifdef INFINITIES
++if( !isfinite(x) )
++  return x;
++#endif
++if( x == 0 )
++      return( x );
++if( x > 0 )
++      sign = 1;
++else
++      {
++      sign = -1;
++      x = -x;
++      }
++
++z = x;
++/* extract power of 2, leaving
++ * mantissa between 0.5 and 1
++ */
++x = frexp( x, &e );
++
++/* Approximate cube root of number between .5 and 1,
++ * peak relative error = 9.2e-6
++ */
++x = (((-1.3466110473359520655053e-1  * x
++      + 5.4664601366395524503440e-1) * x
++      - 9.5438224771509446525043e-1) * x
++      + 1.1399983354717293273738e0 ) * x
++      + 4.0238979564544752126924e-1;
++
++/* exponent divided by 3 */
++if( e >= 0 )
++      {
++      rem = e;
++      e /= 3;
++      rem -= 3*e;
++      if( rem == 1 )
++              x *= CBRT2;
++      else if( rem == 2 )
++              x *= CBRT4;
++      }
++
++
++/* argument less than 1 */
++
++else
++      {
++      e = -e;
++      rem = e;
++      e /= 3;
++      rem -= 3*e;
++      if( rem == 1 )
++              x *= CBRT2I;
++      else if( rem == 2 )
++              x *= CBRT4I;
++      e = -e;
++      }
++
++/* multiply by power of 2 */
++x = ldexp( x, e );
++
++/* Newton iteration */
++x -= ( x - (z/(x*x)) )*0.33333333333333333333;
++#ifdef DEC
++x -= ( x - (z/(x*x)) )/3.0;
++#else
++x -= ( x - (z/(x*x)) )*0.33333333333333333333;
++#endif
++
++if( sign < 0 )
++      x = -x;
++return(x);
++}
diff --git a/utils/ipmitool/patches/101-cross_compile.patch b/utils/ipmitool/patches/101-cross_compile.patch
new file mode 100644 (file)
index 0000000..319fe63
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/configure
++++ b/configure
+@@ -24315,8 +24315,7 @@ if test "$cross_compiling" = yes; then
+   { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+ See \`config.log' for more details." >&5
+ echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++See \`config.log' for more details." >&2;} }
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+--- a/configure.in
++++ b/configure.in
+@@ -489,29 +489,6 @@ AC_ARG_ENABLE([file-security],
+       fi], [])
+-AC_TRY_RUN([
+-      #include <stdio.h>
+-      
+-      struct packstruct {
+-              unsigned char t0       :5;
+-              unsigned char t1       :5;
+-              unsigned char t2       :5;
+-              unsigned char t3       :5;
+-              unsigned char t4       :4;
+-      } __attribute__ ((packed));
+-      
+-      int
+-      main(int argc, char ** argv)
+-      {
+-      if(sizeof(struct packstruct) != 3)
+-      return(1);
+-      else
+-      return(0);
+-      }
+-      ],[],[AC_DEFINE(HAVE_PRAGMA_PACK,[1],[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
+-)
+-
+-
+ dnl Generate files for build
+ AC_CONFIG_FILES([Makefile
+               doc/Makefile
diff --git a/utils/joe/Makefile b/utils/joe/Makefile
new file mode 100644 (file)
index 0000000..ed29144
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# changes by David Kuehling <dvdkhlng TA gmx TOD de>:
+#
+#  - include support for all emulation modes jmacs jpico etc.
+#  - see patches/002-builtinrc.patch
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=joe
+PKG_VERSION:=3.7
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/joe-editor
+PKG_MD5SUM:=66de1b073e869ba12abbfcde3885c577
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/joe
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=JOE - Joes own editor
+  URL:=http://sourceforge.net/projects/joe-editor/
+  SUBMENU:=Editors
+endef
+
+define Package/joe/description
+Joe is world-famous Wordstar like text editor, that also features
+Emacs and Pico emulation
+endef
+
+define Package/joe/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/joe $(1)/usr/bin/
+       for i in jmacs jstar rjoe jpico; do \
+         ln -sf joe $(1)/usr/bin/$$$$i; \
+       done
+endef
+
+$(eval $(call BuildPackage,joe))
diff --git a/utils/joe/patches/001-mathaway.patch b/utils/joe/patches/001-mathaway.patch
new file mode 100644 (file)
index 0000000..99fc930
--- /dev/null
@@ -0,0 +1,58 @@
+--- 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/klish/Makefile b/utils/klish/Makefile
new file mode 100644 (file)
index 0000000..78ccbe0
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2012 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:=klish
+PKG_VERSION:=1.5.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://klish.googlecode.com/files
+PKG_MD5SUM:=c98a1c65f7538c3f4687c6f8039295df
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/klish/default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Kommand Line Interface SHell ($(1))
+  URL:=http://code.google.com/p/klish/
+endef
+
+define Package/klish
+$(call Package/klish/default,main tool)
+  DEPENDS:=+libstdcpp
+endef
+
+define Package/konf
+$(call Package/klish/default,konf tool)
+  DEPENDS:=klish
+endef
+
+define Package/klish/description
+ The klish is a framework for implementing a CISCO-like CLI on a UNIX
+ systems. It is configurable by XML files. The KLISH stands for Kommand
+ Line Interface Shell.
+ The klish is a fork of clish 0.7.3 developed by Graeme McKerrell.
+ It defines new features but it's compatible (as much as possible) with
+ clish's XML configuration files.
+ klish is able to run using clish XML configuration files although
+ current clish users may expect some changes in behavior.
+endef
+
+define Package/konf/description
+ The klish is a framework for implementing a CISCO-like CLI on a UNIX
+ systems. It is configurable by XML files. The KLISH stands for Kommand
+ Line Interface Shell.
+ Konf and konfd are klish utilities that are used to store configuration
+ informations in a way which is similar to what's found on CISCO devices.
+ More information about these tools is to be found on the klish web site.
+endef
+
+define Package/klish/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clish $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+endef
+
+define Package/konf/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/konf $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/konfd $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libkonf.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblub.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,klish))
+$(eval $(call BuildPackage,konf))
+
+define Package/klish-xml-files
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=klish
+  TITLE:=klish sample XML files
+  URL:=http://code.google.com/p/klish/
+endef
+
+define Package/klish-xml-files/description
+  This is a set of sample XML files for klish. This specific sample set
+  is compatible with the original clish.
+endef
+
+define Package/klish-xml-files/install
+       $(INSTALL_DIR) $(1)/etc/clish
+       $(CP) $(PKG_BUILD_DIR)/xml-examples/clish $(1)/etc/clish/
+endef
+
+$(eval $(call BuildPackage,klish-xml-files))
diff --git a/utils/kmemtrace-user/Makefile b/utils/kmemtrace-user/Makefile
new file mode 100644 (file)
index 0000000..280fd64
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 2006-2009 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:=kmemtrace-user
+PKG_VERSION:=20100102
+PKG_RELEASE:=1
+PKG_REV:=92878e602489d6a6ffd6e50b94f425c3149c86bd
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://repo.or.cz/kmemtrace-user.git
+PKG_SOURCE_SUBDIR:=kmemtrace-user-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=git
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/kmemtrace-user
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=trace slab allocator functions
+  URL:=http://repo.or.cz/w/kmemtrace-user.git
+  DEPENDS:=+libpthread
+  KCONFIG:= \
+       CONFIG_KMEMTRACE=y
+endef
+
+define Package/kmemtrace-user/description
+ kmemtrace provides tracing for slab allocator functions, such as
+ kmalloc, kfree, kmem_cache_alloc, kmem_cache_free etc.. Collected
+ data is then fed to the userspace application in order to analyse
+ allocation hotspots, internal fragmentation and so on, making it
+ possible to see how well an allocator performs, as well as debug
+ and profile kernel code.
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); ./autogen.sh; ./configure );
+       $(call Build/Configure/Default)
+endef
+
+
+define Package/kmemtrace-user/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kmemtrace-check $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kmemtrace-report $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kmemtrace-show $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/kmemtraced $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,kmemtrace-user))
diff --git a/utils/lcd4linux-tew673gru/Makefile b/utils/lcd4linux-tew673gru/Makefile
new file mode 100644 (file)
index 0000000..036e6be
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2012 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-tew673gru
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lcd4linux-tew673gru
+       SECTION:=utils
+       CATEGORY:=Utilities
+       DEPENDS:=@TARGET_ar71xx +kmod-spi-gpio +kmod-spi-dev +lcd4linux-custom
+       TITLE:=TRENDnet TEW673GRU LCD support
+endef
+
+define Build/Compile
+endef
+
+define Package/lcd4linux-tew673gru/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/openwrt_220x176.png $(1)/etc/
+       $(INSTALL_BIN) ./files/lcd4linux_tew673gru.conf $(1)/etc/
+       $(INSTALL_BIN) ./files/tew673gru-lcd $(1)/etc/uci-defaults
+endef
+
+$(eval $(call BuildPackage,lcd4linux-tew673gru))
diff --git a/utils/lcd4linux-tew673gru/files/lcd4linux_tew673gru.conf b/utils/lcd4linux-tew673gru/files/lcd4linux_tew673gru.conf
new file mode 100644 (file)
index 0000000..a3b3ece
--- /dev/null
@@ -0,0 +1,243 @@
+# LCD4Linux configuration file for the TRENDnet TEW-673GRU board
+
+Variables {
+   tick 1500
+   tack 3000
+   minute 60000
+   barstyle 'H'
+}
+
+Display Image {
+    Driver 'Image'
+    Format 'PNG'
+    Size   '220x176'
+    Font   '6x8'
+    Pixel  '1+0'
+    Gap    '0x0'
+    Border 0
+    background 'ffffff00'
+    foreground 'ffffffff'
+    basecolor  '000000'
+}
+
+Display TEW673GRU {
+    Driver       'TEW673GRU'
+    Port         '/dev/spidev1.0'
+    Mode         1
+    Font         '6x8'
+    background   'ffffff00'
+    foreground   'ffffffff'
+    basecolor    '000000'
+}
+
+Display TEW673GRU_Text {
+    Driver       'TEW673GRU'
+    Port         '/dev/spidev1.0'
+    Mode         0
+    background   'ffffff00'
+    foreground   'ffffffff'
+    basecolor    '000000'
+}
+
+Widget OS {
+    class 'Text'
+    expression '*** '.uname('sysname').' '.uname('release').' ***'
+    width 20
+    align 'M'
+    style 'bold'
+    speed 0
+    update tick
+}
+
+Widget CPU {
+    class  'Text'
+    expression  uname('machine')
+    prefix 'CPU '
+    width  9
+    align  'L'
+    style 'norm'
+    update tick
+}
+
+Widget CPUinfo {
+    class  'Text'
+    expression  cpuinfo('model name')
+    prefix ''
+    width  20
+    align  'M'
+    speed 0
+    update tick
+}
+
+Widget RAM {
+    class  'Text'
+    expression meminfo('MemTotal')/1024
+    postfix 'MB RAM'
+    width  12
+    precision 1
+    align  'R'
+    update 0
+}
+
+Widget Uptime {
+    class 'Text'
+    expression uptime('%d days %H:%M:%S')
+    width 21
+    align 'R'
+    prefix 'Up '
+    update 1000
+}
+
+Widget Busy {
+    class 'Text'
+    expression proc_stat::cpu('busy', 500)
+    prefix 'Busy'
+    postfix '%'
+    width 10
+    precision 1
+    align 'R'
+    update tick
+}
+
+Widget BusyBar {
+    class 'Bar'
+    expression  proc_stat::cpu('busy',   500)
+    expression2 proc_stat::cpu('system', 500)
+    length 10
+    direction 'E'
+    update tack
+    style barstyle
+}
+
+Widget Load {
+    class 'Text'
+    expression loadavg(1)
+    prefix 'Load'
+    postfix ' '
+    width 11
+    precision 1
+    align 'R'
+    update tick
+}
+
+Widget LoadBar {
+    class 'Bar'
+    expression  loadavg(1)
+    max 2.0
+    length 10
+    direction 'E'
+    update tack
+    style barstyle
+}
+
+Widget LAN {
+    class 'Text'
+    expression (netdev('eth0.1', 'Rx_bytes', 500)+netdev('eth0.1', 'Tx_bytes', 500))/1024
+    prefix 'LAN'
+    postfix ' '
+    width 11
+    precision 0
+    align 'R'
+    update tick
+}
+
+Widget LANBar {
+    class 'Bar'
+    expression  netdev('eth0.1', 'Rx_bytes', 500)
+    expression2 netdev('eth0.1', 'Tx_bytes', 500)
+    length 10
+    direction 'E'
+    update tack
+    style barstyle
+}
+
+Widget WAN {
+    class 'Text'
+    expression (netdev('eth2', 'Rx_bytes', 500)+netdev('eth2', 'Tx_bytes', 500))/1024
+    prefix 'WAN'
+    postfix ' '
+    width 11
+    precision 0
+    align 'R'
+    update tick
+}
+
+Widget WANBar {
+    class 'Bar'
+    expression  netdev('eth2', 'Rx_bytes', 500)
+    expression2 netdev('eth2', 'Tx_bytes', 500)
+    length 10
+    direction 'E'
+    update tack
+    style barstyle
+}
+
+Widget Background {
+    class 'Image'
+    file '/etc/openwrt_220x176.png'
+    update 0
+    visible 1
+}
+
+Layout TEW673GRU {
+    Row5 {
+        Col1  'CPU'
+        Col10 'RAM'
+    }
+    Row7 {
+        Col1  'Busy'
+        Col12 'BusyBar'
+    }
+    Row9 {
+        Col1 'Load'
+        Col12 'LoadBar'
+    }
+    Row11 {
+        Col1  'LAN'
+        Col12 'LANBar'
+    }
+    Row13 {
+        Col1  'WAN'
+        Col12 'WANBar'
+    }
+    Row22 {
+        Col1  'Uptime'
+    }
+    Layer 2 {
+        X1.Y1 'Background'
+    }
+}
+
+Layout TEW673GRU_Text {
+    Row1 {
+        Col1  'CPU'
+        Col10 'RAM'
+    }
+    Row2 {
+        Col1  'Busy'
+        Col12 'BusyBar'
+    }
+    Row3 {
+        Col1 'Load'
+        Col12 'LoadBar'
+    }
+    Row4 {
+        Col1  'LAN'
+        Col12 'LANBar'
+    }
+    Row5 {
+        Col1  'WAN'
+        Col12 'WANBar'
+    }
+    Row11 {
+        Col1  'Uptime'
+    }
+}
+
+#Display 'Image'
+
+Display 'TEW673GRU'
+Layout 'TEW673GRU'
+
+#Display 'TEW673GRU_Text'
+#Layout 'TEW673GRU_Text'
diff --git a/utils/lcd4linux-tew673gru/files/openwrt_220x176.png b/utils/lcd4linux-tew673gru/files/openwrt_220x176.png
new file mode 100644 (file)
index 0000000..e9f5b98
Binary files /dev/null and b/utils/lcd4linux-tew673gru/files/openwrt_220x176.png differ
diff --git a/utils/lcd4linux-tew673gru/files/tew673gru-lcd b/utils/lcd4linux-tew673gru/files/tew673gru-lcd
new file mode 100755 (executable)
index 0000000..66890c9
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+. /lib/ar71xx.sh
+
+board=$(ar71xx_board_name)
+
+if [ "${board}" == "tew-673gru" ]; then
+       cp -f /etc/lcd4linux_tew673gru.conf /etc/lcd4linux.conf
+       chmod 600 /etc/lcd4linux.conf
+       chown root:root /etc/lcd4linux.conf
+fi
diff --git a/utils/lcd4linux/Config.in b/utils/lcd4linux/Config.in
new file mode 100644 (file)
index 0000000..617521c
--- /dev/null
@@ -0,0 +1,501 @@
+if PACKAGE_lcd4linux-custom
+
+config LCD4LINUX_CUSTOM_NEEDS_libdbus
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libdpf
+       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_libvncserver
+       bool
+
+#config LCD4LINUX_CUSTOM_NEEDS_libX11
+#      bool
+
+config LCD4LINUX_CUSTOM_NEEDS_ppp
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_python
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_serdisplib
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_st2205tool
+       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..452ffeb
--- /dev/null
@@ -0,0 +1,321 @@
+#
+# Copyright (C) 2007-2012 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:=1187
+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) \
+       serdisplib \
+       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 \
+       libvncserver \
+       ppp \
+       serdisplib \
+       st2205tool \
+#      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
+  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_libdpf:libdpf \
+       +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_libvncserver:libvncserver \
+       +LCD4LINUX_CUSTOM_NEEDS_serdisplib:serdisplib \
+       +LCD4LINUX_CUSTOM_NEEDS_st2205tool:st2205tool \
+#      +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 \
+       +libdpf \
+       +libgd \
+       $(if $(ICONV_FULL),+libiconv-full) \
+       +libmpdclient \
+       +libmysqlclient \
+       +libncurses \
+       +libsqlite3 \
+       +libusb-compat \
+       +libvncserver \
+       +serdisplib \
+       +st2205tool \
+#      +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..ec56a09
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2011 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..9dcf1cb
--- /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"
+@@ -940,6 +941,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.in
++++ b/configure.in
+@@ -118,6 +118,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..29a4bf3
--- /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
+          ;;
+@@ -801,6 +805,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
+@@ -571,6 +571,11 @@ Display FutabaVFD {
+     }
+ }
++Display TEW673GRU {
++    Driver       'TEW673GRU'
++    Font         '6x8'
++    Port         '/dev/spidev1.0'
++}
+ #Plugin KVV {
+ #    StationID '12_701'
diff --git a/utils/lcdproc/Makefile b/utils/lcdproc/Makefile
new file mode 100644 (file)
index 0000000..af88c40
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2007-2012 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:=lcdproc
+PKG_VERSION:=0.5.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/lcdproc
+PKG_MD5SUM:=4d075c3928e84a90bfccf07313b13721
+
+include $(INCLUDE_DIR)/package.mk
+
+
+define Package/lcdproc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libusb-compat +libncurses +libftdi
+  TITLE:=LCD Display daemon and client
+  URL:=http://sourceforge.net/projects/lcdproc/
+endef
+
+define Package/lcdproc/description
+ LCDProc is a daemon and client for displaying system information on various displays.
+endef
+
+define Package/lcdproc/conffiles
+/etc/LCDd.conf
+/etc/lcdproc.conf
+/etc/lcdexec.conf
+/etc/lcdvc.conf
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default,--enable-drivers=all)
+endef
+
+define Package/lcdproc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/lib/lcdproc
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/LCDd $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/clients/lcdproc/lcdproc $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/clients/lcdexec/lcdexec $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/clients/lcdvc/lcdvc $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/server/drivers/*.so $(1)/usr/lib/lcdproc/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/LCDd.conf $(1)/etc/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/clients/lcdproc/lcdproc.conf $(1)/etc/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/clients/lcdexec/lcdexec.conf $(1)/etc/
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/clients/lcdvc/lcdvc.conf $(1)/etc/
+       $(INSTALL_BIN) ./files/* $(1)/etc/init.d
+endef
+
+$(eval $(call BuildPackage,lcdproc))
diff --git a/utils/lcdproc/files/LCDd b/utils/lcdproc/files/LCDd
new file mode 100755 (executable)
index 0000000..5bec7bc
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common 
+
+START=50
+
+start() {
+       LCDd -c /etc/LCDd.conf
+}
+
+stop() {
+       killall LCDd
+}
diff --git a/utils/lcdproc/files/lcdexec b/utils/lcdproc/files/lcdexec
new file mode 100755 (executable)
index 0000000..0d5a3f3
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common. 
+
+START=50
+
+start() {
+       lcdexec -c /etc/lcdexec.conf
+}
+
+stop() {
+       killall lcdexec
+}
diff --git a/utils/lcdproc/files/lcdproc b/utils/lcdproc/files/lcdproc
new file mode 100755 (executable)
index 0000000..eb86134
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common. 
+
+START=50
+
+start() {
+       lcdproc -c /etc/lcdproc.conf
+}
+
+stop() {
+       killall lcdproc
+}
diff --git a/utils/lcdproc/files/lcdvc b/utils/lcdproc/files/lcdvc
new file mode 100755 (executable)
index 0000000..026fd04
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common. 
+
+START=50
+
+start() {
+       lcdvc -c /etc/lcdvc.conf
+}
+
+stop() {
+       killall lcdvc
+}
diff --git a/utils/less/Makefile b/utils/less/Makefile
new file mode 100644 (file)
index 0000000..46faf3f
--- /dev/null
@@ -0,0 +1,88 @@
+#
+# Copyright (C) 2010-2012 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:=less
+PKG_VERSION:=458
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.greenwoodsoftware.com/less
+PKG_MD5SUM:=935b38aa2e73c888c210dedf8fd94f49
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/less/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Pager program similar to more
+  URL:=http://www.greenwoodsoftware.com/less/
+endef
+
+define Package/less/Default/description
+  Full version of GNU less utility
+endef
+
+define Package/less
+  $(call Package/less/Default)
+  DEPENDS:=+libncurses
+  VARIANT:=narrow
+endef
+
+define Package/less/description
+  $(call Package/less/Default/description)
+endef
+
+define Package/less-wide
+  $(call Package/less/Default)
+  TITLE+= (Unicode)
+  DEPENDS:=+libncursesw
+  VARIANT:=wide
+endef
+
+define Package/less-wide/description
+  $(call Package/less/Default/description)
+  This package contains the Unicode enabled version of less.
+endef
+
+ifeq ($(BUILD_VARIANT),narrow)
+       CONFIGURE_VARS += \
+               ac_cv_lib_ncursesw_initscr=no           
+endif
+
+ifeq ($(BUILD_VARIANT),wide)
+       CONFIGURE_VARS += \
+               ac_cv_lib_ncursesw_initscr=yes
+endif
+
+define Package/less/install
+       $(INSTALL_DIR) $(1)/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/less $(1)/bin/less
+endef
+
+define Package/less/postinst
+#!/bin/sh
+[ -L "$${IPKG_INSTROOT}/usr/bin/less" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/less"
+exit 0
+endef
+
+define Package/less/postrm
+#!/bin/sh
+/bin/busybox less -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/less
+exit 0
+endef
+
+Package/less-wide/install = $(Package/less/install)
+Package/less-wide/postinst = $(Package/less/postinst)
+Package/less-wide/postrm = $(Package/less/postrm)
+
+$(eval $(call BuildPackage,less))
+$(eval $(call BuildPackage,less-wide))
diff --git a/utils/lilo/Makefile b/utils/lilo/Makefile
new file mode 100644 (file)
index 0000000..35f6da5
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2006-2010 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:=lilo
+PKG_VERSION:=22.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.gz
+PKG_SOURCE_URL:=ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/
+PKG_MD5SUM:=72765f2aafd20e23ecf07ebd22baeec7
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lilo
+  SECTION:=base
+  CATEGORY:=Boot Loaders
+  DEPENDS:=@TARGET_x86
+  TITLE:=lilo
+  URL:=ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/
+endef
+
+define Package/lilo/conffiles
+/etc/lilo.conf
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(HOSTCC) -m32" \
+               alles
+endef
+
+define Package/lilo/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(CP) $(PKG_BUILD_DIR)/lilo.static $(1)/sbin/lilo
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) ./files/lilo.conf $(1)/etc/
+       $(CP) ./files/boot.msg $(1)/etc/
+endef
+
+$(foreach command, as86 ld86, \
+  $(eval $(call RequireCommand,$(command), \
+   $(PKG_NAME) requires $(command). \
+  )) \
+)
+
+$(eval $(call BuildPackage,lilo))
+
diff --git a/utils/lilo/files/README b/utils/lilo/files/README
new file mode 100644 (file)
index 0000000..1315e8b
--- /dev/null
@@ -0,0 +1,35 @@
+Using this package to create a bootable usb stick for openwrt.
+
+The status of this package is currently 'it works for me', and it will
+require more effort before it's generic across the board.  Currently
+only tested to be working on x86-2.6 using an initramfs image.
+My development environment for this is a via epia with a
+serial console (no monitors or keyboards attached).
+
+To create the images that are bootable, configure your buildroot to include
+the lilo package in the image, as well as e2fsprogs.  Have it create an
+ext2 file system as the target file system.  Let it build the works.
+
+When the build is finished, you will need to run the script 'mkbootable'
+located in the lilo package directory, it requires root privileges to
+loop mount the fs for installing lilo.  When it's done, you have an
+8 meg ext2fs root file system ready to run.
+
+To use the image, dd it directly onto a usb stick.  It should go onto
+/dev/sda not /dev/sda1, it's assuming the stick is not partitioned.
+When you boot the stick, you will get a lilo menu on the serial terminal.
+The three options allow you to boot with the stick itself as the root file
+system, or, to boot into a ramdisk, and not mount the stick at all.  The
+stick will likely show up at /dev/disc
+
+Boot the unit, and select the ramdisk.  Once up in the ramdisk, you can
+use the e2fstools to expand the image to fill the stick and add a journal
+to use it as ext3.
+
+e2fsck -f /dev/disc
+tune2fs -j /dev/disc
+resize2fs /dev/disc
+
+Reboot the box, and, have fun with openwrt on your x86 using the usb
+stick to boot and run from.
+
diff --git a/utils/lilo/files/bdlilo.conf b/utils/lilo/files/bdlilo.conf
new file mode 100644 (file)
index 0000000..cbb26d6
--- /dev/null
@@ -0,0 +1,30 @@
+serial=0,115200n8
+boot    =/dev/loop1
+disk    =/dev/loop1
+  bios  =0x80
+  sectors =63
+  heads   =255
+  cylinders =999
+lba32
+compact
+install =mount/boot/boot.b
+map     =mount/boot/map
+
+prompt
+delay   =1
+timeout =100
+message =mount/etc/boot.msg
+
+
+image   =mount/vmlinuz
+  label   =openwrt
+  append  =" rootfs=/dev/discs/disc0/disc console=ttyS0,115200n81 "
+  
+image   =mount/vmlinuz
+  label   =ramdisk
+  append  =" console=ttyS0,115200n81"
+  
+image   =mount/vmlinuz
+  label   =failsafe
+  append  =" FAILSAFE=MenuRequest console=ttyS0,115200n81"
+  
diff --git a/utils/lilo/files/boot.msg b/utils/lilo/files/boot.msg
new file mode 100644 (file)
index 0000000..a7c5119
--- /dev/null
@@ -0,0 +1,7 @@
+
+Boot Options:-
+
+openwrt  - OpenWrt with usb stick root
+ramdisk  - OpenWrt with ramdisk root
+failsafe - OpenWrt failsafe
+
diff --git a/utils/lilo/files/lilo.conf b/utils/lilo/files/lilo.conf
new file mode 100644 (file)
index 0000000..d4a769e
--- /dev/null
@@ -0,0 +1,26 @@
+serial=0,115200n8
+disk=/dev/discs/disc0/disc
+bios=0x80
+lba32
+compact
+install =/boot/boot.b
+map     =/boot/map
+backup  =/dev/null
+prompt
+delay   =1
+timeout =100
+message =/etc/boot.msg
+
+image   =/vmlinuz
+  label   =openwrt
+  append  =" rootfs=/dev/discs/disc0/disc console=ttyS0,115200n81 "
+  
+image   =/vmlinuz
+  label   =ramdisk
+  append  =" console=ttyS0,115200n81"
+
+image   =/vmlinuz
+  label   =failsafe
+  append  =" FAILSAFE=MenuRequest console=ttyS0,115200n81"
+
+    
diff --git a/utils/lilo/files/mkbootable b/utils/lilo/files/mkbootable
new file mode 100755 (executable)
index 0000000..30ea2f1
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+LOOPDEV="/dev/loop1"
+
+mkdir mount
+cp bin/openwrt-x86-ext2.img bin/boot.img
+sudo losetup $LOOPDEV bin/boot.img
+sudo mount $LOOPDEV mount
+sudo cp build_i386/linux/arch/i386/boot/bzImage mount/vmlinuz
+sudo mkdir mount/boot
+sudo build_i386/lilo-22.8/lilo -C package/lilo/bdlilo.conf
+sudo umount mount
+echo releasing $LOOPDEV
+sudo losetup -d $LOOPDEV
+rm -r -f mount
diff --git a/utils/lirc/Makefile b/utils/lirc/Makefile
new file mode 100644 (file)
index 0000000..541f56c
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=lirc
+PKG_VERSION:=0.8.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/${PKG_NAME}
+PKG_MD5SUM:=fb1dcddbc8ca3d03c7f3a2d40cf28b71
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lirc/Default
+    SECTION:=utils
+    CATEGORY:=Utilities
+    URL:=http://lirc.org/
+endef
+
+define Package/lirc
+    $(call Package/lirc/Default)
+    TITLE:=LIRC - Linux Infrared Remote Control
+    MENU:=1
+endef
+
+define Package/lirc/description
+ LIRC is a package that allows you to decode and send infra-red signals of many
+ (but not all) commonly used remote controls.
+endef
+
+define Package/lircdaemonadd
+    $(call Package/lirc/Default)
+    DEPENDS:=lirc
+    TITLE:=daemon additional files
+endef
+
+define Package/lircdaemonadd/description
+ Contains additional daemon-tools.
+endef
+
+define  Package/lirctools
+    $(call Package/lirc/Default)
+    DEPENDS:=lirc
+    TITLE:=LIRC tools
+endef
+
+define Package/lirctools/description
+ Contains additional lirc-tools.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-sandboxed \
+       --with-driver="mceusb" \
+       --with-gnu-ld \
+       --with-kerneldir="$(LINUX_DIR)" \
+       --with-pic \
+       --without-x \
+       --disable-nls \
+       --disable-static
+
+define Package/lirc/conffiles
+/etc/lircd.conf
+endef
+
+MAKE_FLAGS += \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       SUBDIRS="daemons tools"
+
+define Package/lirc/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/daemons/lircd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/contrib/lircd.conf $(1)/etc/
+endef
+#todo:
+#      $(CP) $(PKG_BUILD_DIR)/drivers/lirc_dev/lirc_dev.ko
+#      $(CP) $(PKG_BUILD_DIR)/drivers/lirc_mceusb2/lirc_mceusb2.ko
+#depends on the selected module
+
+define Package/lircdaemonadd/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/daemons/irrecord $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/daemons/lircmd $(1)/usr/sbin/
+endef
+
+define Package/lirctools/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/irsend $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/irw $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/mode2 $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,lirc))
+$(eval $(call BuildPackage,lircdaemonadd))
+$(eval $(call BuildPackage,lirctools))
diff --git a/utils/lmbench/Makefile b/utils/lmbench/Makefile
new file mode 100644 (file)
index 0000000..91866a1
--- /dev/null
@@ -0,0 +1,122 @@
+#
+# Copyright (C) 2012 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:=lmbench
+PKG_VERSION:=3.0-a9
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/lmbench/
+PKG_MD5SUM:=b3351a3294db66a72e2864a199d37cbf
+
+PKG_BUILD_DEPENDS:=librpc
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lmbench
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=lmbench microbenchmarks
+  URL:=http://sourceforge.net/projects/lmbench
+  MENU:=1
+endef
+
+define Package/lmbench/description
+  lmbench is a series of micro benchmarks intended to measure basic operating
+  system and hardware system metrics.
+endef
+
+define Package/lmbench/install
+       true
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/src \
+               CC="$(TARGET_CC)" \
+               AR="$(TARGET_CROSS)ar" \
+               OS="$(ARCH)" \
+               BASE="$(PKG_INSTALL_DIR)" \
+               LDLIBS="-lrpc" \
+               COMPILE="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" \
+               lmbench install
+endef
+
+define PartGen
+define Package/lmbench-$(subst _,-,$(1))
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=$(1) microbenchmark
+  URL:=http://sourceforge.net/projects/lmbench
+  DEPENDS:=lmbench +librpc
+endef
+endef
+
+define PartInstall
+define Package/lmbench-$(subst _,-,$(1))/install
+       $(INSTALL_DIR) $$(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/$(1) $$(1)/usr/sbin/$(1)
+endef
+endef
+
+LMBENCH_FILES:= \
+       bw_file_rd \
+       bw_mem \
+       bw_mmap_rd \
+       bw_pipe \
+       bw_tcp \
+       bw_unix \
+       cache \
+       disk \
+       enough \
+       flushdisk \
+       hello \
+       lat_cmd \
+       lat_connect \
+       lat_ctx \
+       lat_dram_page \
+       lat_fcntl \
+       lat_fifo \
+       lat_fs \
+       lat_http \
+       lat_mem_rd \
+       lat_mmap \
+       lat_ops \
+       lat_pagefault \
+       lat_pipe \
+       lat_pmake \
+       lat_proc \
+       lat_rand \
+       lat_rpc \
+       lat_select \
+       lat_sem \
+       lat_sig \
+       lat_syscall \
+       lat_tcp \
+       lat_udp \
+       lat_unix \
+       lat_unix_connect \
+       lat_usleep \
+       line \
+       lmdd \
+       lmhttp \
+       loop_o \
+       memsize \
+       mhz \
+       msleep \
+       par_mem \
+       par_ops \
+       stream \
+       timing_o \
+       tlb
+
+$(foreach file,$(LMBENCH_FILES),$(eval $(call PartGen,$(file))))
+$(foreach file,$(LMBENCH_FILES),$(eval $(call PartInstall,$(file))))
+
+$(eval $(call BuildPackage,lmbench))
+$(foreach file,$(LMBENCH_FILES),$(eval $(call BuildPackage,lmbench-$(subst _,-,$(file)))))
diff --git a/utils/lmbench/patches/001-fix_socklen_t_define.patch b/utils/lmbench/patches/001-fix_socklen_t_define.patch
new file mode 100644 (file)
index 0000000..967e207
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/bench.h
++++ b/src/bench.h
+@@ -77,7 +77,7 @@ typedef long long int64;
+ #endif /* HAVE_int64_t */
+ #endif /* HAVE_int64 */
+-#ifndef HAVE_socklen_t
++#if (!defined(HAVE_socklen_t) && !defined(__socklen_t_defined))
+ typedef int socklen_t;
+ #endif
diff --git a/utils/lmbench/patches/002-install-cache.patch b/utils/lmbench/patches/002-install-cache.patch
new file mode 100644 (file)
index 0000000..89543b8
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -144,6 +144,7 @@ install-target:
+       if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi
+       if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi
+       cp $(EXES) $(BASE)/bin
++      cp $(OPT_EXES) $(BASE)/bin
+       cp $(INCS) $(BASE)/include
+       cp $O/lmbench.a $(BASE)/lib/libmbench.a
+       cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install
diff --git a/utils/lmbench/patches/003-add-LDLIBS.patch b/utils/lmbench/patches/003-add-LDLIBS.patch
new file mode 100644 (file)
index 0000000..66a7243
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/scripts/build
++++ b/scripts/build
+@@ -18,7 +18,7 @@ done
+ trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15
+-LDLIBS=-lm
++LDLIBS=${LDLIBS-"-lm -lrpc"}
+ # check for HP-UX's ANSI compiler
+ echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -38,6 +38,7 @@ CC=`../scripts/compiler`
+ MAKE=`../scripts/make`
+ AR=ar
+ ARCREATE=cr
++LDLIBS=
+ # base of installation location
+ BASE=/usr/local
+@@ -111,7 +112,7 @@ LIBOBJS= $O/lib_tcp.o $O/lib_udp.o $O/li
+       $O/lib_sched.o
+ lmbench: $(UTILS)
+-      @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build all
++      @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" LDLIBS="$(LDLIBS)" ../scripts/build all
+       -@env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt
+ results: lmbench
diff --git a/utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch b/utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch
new file mode 100644 (file)
index 0000000..d03ad4a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/bw_mem.c
++++ b/src/bw_mem.c
+@@ -65,7 +65,7 @@ main(int ac, char **av)
+       size_t  nbytes;
+       state_t state;
+       int     c;
+-      char    *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n<size> must be larger than 512";
++      char    *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n<size> must be larger than 512\n";
+       state.overhead = 0;
diff --git a/utils/logrotate/Makefile b/utils/logrotate/Makefile
new file mode 100644 (file)
index 0000000..9e62f56
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2006-2012 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:=logrotate
+PKG_VERSION:=3.8.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:= \
+       http://ftp.debian.org/debian/pool/main/l/logrotate \
+       http://ftp.de.debian.org/debian/pool/main/l/logrotate \
+       http://ftp.fr.debian.org/debian/pool/main/l/logrotate \
+       http://ftp.us.debian.org/debian/pool/main/l/logrotate
+PKG_MD5SUM:=bd2e20d8dc644291b08f9215397d28a5
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/logrotate
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpopt
+  TITLE:=rotates, compresses, and mails system logs
+  URL:=http://packages.debian.org/unstable/admin/logrotate
+endef
+
+define Package/logrotate/description
+ logrotate is designed to ease administration of systems that generate large
+ numbers of log files. It allows auto-matic rotation, compression, removal and
+ mailing of log files. Each log file may be handled daily, weekly, monthly or
+ when it grows too large.
+endef
+
+define Package/logrotate/conffiles
+/etc/logrotate.conf
+endef
+
+EXTRA_CFLAGS += $(TARGET_CPPFLAGS)
+EXTRA_LDFLAGS += $(TARGET_LDFLAGS)
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               RPM_OPT_FLAGS:="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+               LDFLAGS="$(EXTRA_LDFLAGS)" \
+               logrotate \
+       )
+endef
+
+define Package/logrotate/install       
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) ${PKG_BUILD_DIR}/logrotate $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/logrotate.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/logrotate.d
+endef
+
+$(eval $(call BuildPackage,logrotate))
diff --git a/utils/logrotate/files/logrotate.conf b/utils/logrotate/files/logrotate.conf
new file mode 100644 (file)
index 0000000..9a91db9
--- /dev/null
@@ -0,0 +1,30 @@
+# rotate log files weekly
+weekly
+#daily
+
+# keep 4 weeks worth of backlogs
+rotate 4
+
+# create new (empty) log files after rotating old ones
+create
+
+notifempty
+nomail
+#olddir /var/log/backup/
+missingok
+#dateext
+
+# uncomment this if you want your log files compressed
+#compress
+
+# packages can drop log rotation information into this directory
+include /etc/logrotate.d
+
+# no packages own lastlog or wtmp -- we'll rotate them here
+#/var/log/wtmp {
+#    monthly
+#    create 0664 root utmp
+#    rotate 1
+#}
+
+# system-specific logs may be also be configured here.
diff --git a/utils/loop-aes/Makefile b/utils/loop-aes/Makefile
new file mode 100644 (file)
index 0000000..3d1d93b
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2007-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=loop-aes
+PKG_VERSION:=3.7a
+PKG_RELEASE:=1
+
+PKG_SOURCE:=loop-AES-v$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=f267cb2108ee94b09a30b2fc7e292104
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/loop-AES-v$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/loop-aes
+  SUBMENU:=Cryptographic API modules
+  DEPENDS:=@!PACKAGE_kmod-loop
+  TITLE:=loopback module with built-in AES
+  FILES:=$(PKG_BUILD_DIR)/loop.$(LINUX_KMOD_SUFFIX)
+  AUTOLOAD:=$(call AutoLoad,30,loop)
+  URL:=http://loop-aes.sourceforge.net
+endef
+
+define KernelPackage/loop-aes/description
+  This package provides loadable Linux kernel module (loop.o or loop.ko on 2.6
+  kernels) that has AES cipher built-in. The AES cipher can be used to encrypt
+  local file systems and disk partitions.
+endef
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               ARCH="$(LINUX_KARCH)" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               CC="$(TARGET_CC)" \
+               CPP="$(TARGET_CC)" \
+               LD="$(TARGET_CROSS)ld" \
+               LINUX_SOURCE="$(LINUX_DIR)" \
+               KR="$(LINUX_DIR)" \
+               MODINST="n" \
+               all
+endef
+
+$(eval $(call KernelPackage,loop-aes))
diff --git a/utils/loop-aes/patches/001-no_sync.patch b/utils/loop-aes/patches/001-no_sync.patch
new file mode 100644 (file)
index 0000000..e01b9b2
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -208,10 +208,8 @@ endif
+ ifeq ($(EXTRA_CIPHERS),y)
+       ln -s tmp-d-kbuild/loop_twofish.ko tmp-d-kbuild/loop_serpent.ko tmp-d-kbuild/loop_blowfish.ko .
+ endif
+-      sync
+ else
+       cd $(LS) && make SUBDIRS=$(TD) modules
+-      sync
+ endif
+ # 2.6 kernels older than 2.6.17 do not run depmod in "modules_install" stage,
diff --git a/utils/lrzsz/Makefile b/utils/lrzsz/Makefile
new file mode 100644 (file)
index 0000000..6ca2083
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# 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:=lrzsz
+PKG_VERSION:=0.12.20
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.ohse.de/uwe/releases/
+PKG_MD5SUM:=b5ce6a74abc9b9eb2af94dffdfd372a4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lrzsz
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=X,Y and Z-modem protocols
+  URL:=http://www.ohse.de/uwe/software/lrzsz.html
+endef
+
+define Package/lrzsz/description
+       Transfer files in your login sessions.
+       Very leightweight and straight forward.
+       You just need a terminal client that can do
+       either X, Y or Z-modem file transfers.
+endef
+
+# uses GNU configure
+
+define Package/lrzsz/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lrz $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lsz $(1)/usr/bin/
+       (cd $(1)/usr/bin; \
+               ln -fs lrz lrx; \
+               ln -fs lrz lrb; \
+               ln -fs lrz rz; \
+               ln -fs lrz rx; \
+               ln -fs lrz rb; \
+               ln -fs lsz lsx; \
+               ln -fs lsz lsb; \
+               ln -fs lsz sz; \
+               ln -fs lsz sx; \
+               ln -fs lsz sb; \
+       );
+endef
+
+$(eval $(call BuildPackage,lrzsz))
diff --git a/utils/lrzsz/patches/100-install_delete_fix.patch b/utils/lrzsz/patches/100-install_delete_fix.patch
new file mode 100644 (file)
index 0000000..edd0e89
--- /dev/null
@@ -0,0 +1,20 @@
+diff -ur lrzsz.old/src/Makefile.in lrzsz.dev/src/Makefile.in
+--- lrzsz.old/src/Makefile.in  1998-12-30 17:31:46.000000000 +0100
++++ lrzsz.dev/src/Makefile.in  2006-08-20 19:10:09.000000000 +0200
+@@ -372,13 +372,13 @@
+       rm -f $(DESTDIR)/$(bindir)/`echo lsb | sed -e '$(transform)'`
+       ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+               $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'` 
+-      rm -f $(bindir)/`echo lsx | sed -e '$(transform)'`
++      rm -f $(DESTDIR)/$(bindir)/`echo lsx | sed -e '$(transform)'`
+       ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+               $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'` 
+-      rm -f $(bindir)/`echo lrb | sed -e '$(transform)'`
++      rm -f $(DESTDIR)/$(bindir)/`echo lrb | sed -e '$(transform)'`
+       ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+               $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'` 
+-      rm -f $(bindir)/`echo lrx | sed -e '$(transform)'`
++      rm -f $(DESTDIR)/$(bindir)/`echo lrx | sed -e '$(transform)'`
+       ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+               $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'` 
+ #     rm -f $(bindir)/`echo lrzszbug | sed -e '$(transform)'`
diff --git a/utils/lvm2/Makefile b/utils/lvm2/Makefile
new file mode 100644 (file)
index 0000000..936b93c
--- /dev/null
@@ -0,0 +1,87 @@
+#
+# Copyright (C) 2009-2010 Stefan Monnier
+# Copyright (C) 2011-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v3+.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=LVM2
+PKG_VERSION:=2.02.105
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2
+PKG_MD5SUM:=b5b3540661fc70bf329b526c1cfbcf3a
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libdevmapper
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=The Linux Kernel Device Mapper userspace library
+  URL:=http://sourceware.org/dm/
+  DEPENDS:=+kmod-dm +libpthread
+endef
+
+define Package/libdevmapper/description
+ The device-mapper is a component of the 2.6 linux kernel that supports logical
+ volume management. It is required by LVM2 and EVMS.
+endef
+
+define Package/lvm2
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=disc
+  TITLE:=The Linux Logical Volume Manager
+  URL:=http://sourceware.org/lvm2/
+  DEPENDS:=+libdevmapper +libblkid +libreadline +libncurses
+endef
+
+define Package/lvm2/description
+ LVM2 refers to a new userspace toolset that provide logical volume management
+ facilities on linux. It is reasonably backwards-compatible with the original
+ LVM toolset.
+endef
+
+CONFIGURE_ARGS += --disable-o_direct
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               install
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libdevmapper.h $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libdevmapper.so* $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_BUILD_DIR)/libdm/libdevmapper.pc $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libdevmapper/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libdevmapper.so.* $(1)/usr/lib
+endef
+
+define Package/lvm2/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/lvm $(1)/sbin
+       $(INSTALL_DIR) $(1)/etc/lvm
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/example.conf $(1)/etc/lvm/lvm.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/lvm2.init $(1)/etc/init.d/lvm2
+endef
+
+define Package/lvm2/conffiles
+/etc/lvm/lvm.conf
+endef
+
+$(eval $(call BuildPackage,libdevmapper))
+$(eval $(call BuildPackage,lvm2))
diff --git a/utils/lvm2/files/lvm2.init b/utils/lvm2/files/lvm2.init
new file mode 100644 (file)
index 0000000..3b542d0
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009 Stefan Monnier
+START=15
+
+start () {
+   /sbin/lvm vgscan --ignorelockingfailure --mknodes || :
+   /sbin/lvm vgchange -aly --ignorelockingfailure || return 2
+}
+
+stop () {
+    /sbin/lvm vgchange -aln --ignorelockingfailure || return 2
+}
diff --git a/utils/lvm2/patches/000-compile.patch b/utils/lvm2/patches/000-compile.patch
new file mode 100644 (file)
index 0000000..0c7dfea
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/make.tmpl.in
++++ b/make.tmpl.in
+@@ -19,7 +19,7 @@
+ # Allow environment to override any built-in default value for CC.
+ # If there is a built-in default, CC is NOT set to @CC@ here.
+-CC ?= @CC@
++CC = @CC@
+ # If $(CC) holds the usual built-in default value of 'cc' then replace it with
+ # the configured value.
diff --git a/utils/lxc/Makefile b/utils/lxc/Makefile
new file mode 100644 (file)
index 0000000..f8a77be
--- /dev/null
@@ -0,0 +1,225 @@
+#
+# Copyright (C) 2013-2014 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:=lxc
+PKG_VERSION:=1.0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/
+PKG_MD5SUM:=55873b1411a606397309aa6c4c4263b3
+
+PKG_BUILD_DEPENDS:=lua
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+LXC_APPLETS_BIN += \
+       attach autostart cgroup clone config console create destroy execute \
+       freeze info monitor snapshot start stop unfreeze unshare usernsexec wait
+
+LXC_APPLETS_LIB += \
+       monitord user-nic
+
+LXC_SCRIPTS += \
+       checkconfig ls top
+
+DEPENDS_APPLETS = +libpthread +libcap +liblxc
+
+DEPENDS_top = +lxc-lua +luafilesystem @BROKEN
+
+
+define Package/lxc/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=LXC userspace tools
+  URL:=http://lxc.sourceforge.net/
+  MAINTAINER:=Luka Perkov <luka@openwrt.org>
+endef
+
+define Package/lxc
+  $(call Package/lxc/Default)
+  MENU:=1
+endef
+
+define Package/lxc/description
+ LXC is the userspace control package for Linux Containers, a lightweight
+ virtual system mechanism sometimes described as "chroot on steroids".
+endef
+
+define Package/lxc-common
+  $(call Package/lxc/Default)
+  TITLE:=LXC common files
+  DEPENDS:= lxc
+endef
+
+define Package/lxc-hooks
+  $(call Package/lxc/Default)
+  TITLE:=LXC virtual machine hooks
+  DEPENDS:= lxc
+endef
+
+define Package/lxc-templates
+  $(call Package/lxc/Default)
+  TITLE:=LXC virtual machine templates
+  DEPENDS:= lxc @BROKEN
+endef
+
+define Package/liblxc
+  $(call Package/lxc/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=LXC userspace library
+  DEPENDS:= lxc +libcap +libpthread
+endef
+
+define Package/lxc-lua
+  $(call Package/lxc/Default)
+  TITLE:=LXC Lua bindings
+  DEPENDS:= lxc +liblua +liblxc +luafilesystem
+endef
+
+define Package/lxc-init
+  $(call Package/lxc/Default)
+  TITLE:=LXC Lua bindings
+  DEPENDS:= lxc +liblxc
+endef
+
+CONFIGURE_ARGS += \
+       --disable-apparmor \
+       --disable-doc \
+       --disable-examples \
+       --disable-seccomp
+       --enable-lua=yes \
+       --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc" \
+
+MAKE_FLAGS += \
+       LUA_INSTALL_CMOD="/usr/lib/lua" \
+       LUA_INSTALL_LMOD="/usr/lib/lua"
+
+define Build/Configure
+       ( cd $(PKG_BUILD_DIR); ./autogen.sh );
+       $(call Build/Configure/Default)
+endef
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/lxc/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/lxc/* \
+               $(1)/usr/include/lxc/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+
+define Package/lxc/install
+       true
+endef
+
+define Package/lxc-common/conffiles
+/etc/lxc/default.conf
+/etc/lxc/lxc.conf
+endef
+
+define Package/lxc-common/install
+       $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
+               $(1)/usr/lib/lxc/rootfs/
+
+       $(INSTALL_DIR) $(1)/usr/share/lxc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
+               $(1)/usr/share/lxc/
+
+       $(INSTALL_DIR) $(1)/etc/lxc/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
+               $(1)/etc/lxc/
+endef
+
+define Package/lxc-hooks/install
+       $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountcgroups \
+               $(1)/usr/share/lxc/hooks/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/mountecryptfsroot \
+               $(1)/usr/share/lxc/hooks/
+endef
+
+define Package/lxc-templates/install
+       $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
+               $(1)/usr/share/lxc/templates/
+endef
+
+define Package/liblxc/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/lxc-lua/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
+               $(1)/usr/lib/lua/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
+               $(1)/usr/lib/lua/lxc/
+endef
+
+define Package/lxc-init/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
+               $(1)/sbin/
+endef
+
+define GenPlugin
+  define Package/lxc-$(1)
+    $(call Package/lxc/Default)
+    TITLE:=Utility lxc-$(1) from the LXC userspace tools
+    DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
+  endef
+
+  define Package/lxc-$(1)/install
+       $(INSTALL_DIR) $$(1)$(3)
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
+               $$(1)$(3)/
+  endef
+
+  $$(eval $$(call BuildPackage,lxc-$(1)))
+endef
+
+
+$(eval $(call BuildPackage,lxc))
+$(eval $(call BuildPackage,lxc-common))
+$(eval $(call BuildPackage,lxc-hooks))
+$(eval $(call BuildPackage,lxc-templates))
+$(eval $(call BuildPackage,liblxc))
+$(eval $(call BuildPackage,lxc-lua))
+$(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
+$(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
+$(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))
diff --git a/utils/lxc/patches/010-compile.patch b/utils/lxc/patches/010-compile.patch
new file mode 100644 (file)
index 0000000..6f12c38
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -31,30 +31,6 @@ AC_CANONICAL_HOST
+ AM_PROG_CC_C_O
+ AC_GNU_SOURCE
+-# Detect the distribution. This is used for the default configuration and
+-# for some distro-specific build options.
+-AC_MSG_CHECKING([host distribution])
+-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.]))
+-if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
+-      with_distro=`lsb_release -is`
+-fi
+-if test "z$with_distro" = "z"; then
+-      AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
+-      AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
+-      AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
+-      AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
+-      AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
+-      AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
+-      AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
+-      AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
+-      AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
+-      AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
+-      AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
+-      AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
+-      AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
+-fi
+-with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
+-
+ if test "z$with_distro" = "z"; then
+       with_distro="unknown"
+ fi
diff --git a/utils/lxc/patches/015-getline.patch b/utils/lxc/patches/015-getline.patch
new file mode 100644 (file)
index 0000000..e2f002a
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/src/lxc/utils.h
++++ b/src/lxc/utils.h
+@@ -44,11 +44,7 @@ extern char *get_rundir(void);
+ extern const char *lxc_global_config_value(const char *option_name);
+ /* Define getline() if missing from the C library */
+-#ifndef HAVE_GETLINE
+-#ifdef HAVE_FGETLN
+-#include <../include/getline.h>
+-#endif
+-#endif
++#include "../include/getline.h"
+ /* Define setns() if missing from the C library */
+ #ifndef HAVE_SETNS
diff --git a/utils/lxc/patches/020-lxc-checkconfig.patch b/utils/lxc/patches/020-lxc-checkconfig.patch
new file mode 100644 (file)
index 0000000..272f76b
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/lxc/lxc-checkconfig.in
++++ b/src/lxc/lxc-checkconfig.in
+@@ -4,6 +4,17 @@
+ : ${CONFIG:=/proc/config.gz}
+ : ${GREP:=zgrep}
+ : ${MODNAME:=configs}
++: ${ZGREP:=zgrep}
++: ${GUNZIP:=gunzip}
++
++if [ -z $(which $ZGREP) ] && ! [ -z $(which $GUNZIP) ] && [ -x $(which $GUNZIP) ] &&  [ -f $CONFIG ] && [ "$CONFIG" == "/proc/config.gz" ] ; then
++
++      CONFIG_NEW="/tmp/config-$(uname -r)"
++      $GUNZIP -c $CONFIG > $CONFIG_NEW
++      CONFIG=$CONFIG_NEW
++
++      GREP=grep
++fi
+ SETCOLOR_SUCCESS="printf \\033[1;32m"
+ SETCOLOR_FAILURE="printf \\033[1;31m"
diff --git a/utils/macchanger/Makefile b/utils/macchanger/Makefile
new file mode 100644 (file)
index 0000000..ef158e7
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2006 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:=macchanger
+PKG_VERSION:=1.5.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/macchanger
+PKG_MD5SUM:=79b7cdaeca3d8ebafa764c4b0dd03ab7
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/macchanger
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=utility for viewing/manipulating the MAC address
+  URL:=http://www.alobbs.com/macchanger
+endef
+
+define Package/macchanger/description
+       This is a GNU/Linux utility for viewing/manipulating the MAC address
+       of network interfaces.
+endef
+
+define Package/macchanger/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/macchanger $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/macchanger $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,macchanger))
diff --git a/utils/maemo-kexec/Config.in b/utils/maemo-kexec/Config.in
new file mode 100644 (file)
index 0000000..74c8c86
--- /dev/null
@@ -0,0 +1,20 @@
+config MAEMO_KEXEC_DOWNLOAD_KERNEL
+       bool "Download latest Maemo kernel"
+       default y
+       depends on PACKAGE_maemo-kexec
+
+config MAEMO_KEXEC_KERNEL_PATH
+       string
+       prompt "Path to the Maemo kernel image"
+       default "PLEASE_CONFIGURE_MAEMO_ZIMAGE"
+       depends on PACKAGE_maemo-kexec && !MAEMO_KEXEC_DOWNLOAD_KERNEL
+       help
+         Defines the path to the Maemo kernel zImage.
+
+         The image can be extracted from the Fiasco firmware image.
+         Use the proprietary flasher to extract the image. The
+         opensource tool "0xFFFF" is not able to extract the zImage correctly.
+
+         The zImage defined here will be included in the OpenWrt rootfs
+         for kexec-ing of the Maemo operating system. The Maemo rootfs
+         has to be installed on the n810's "rootfs" MTD partition (MTD4).
diff --git a/utils/maemo-kexec/Makefile b/utils/maemo-kexec/Makefile
new file mode 100644 (file)
index 0000000..3f31c97
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2010 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:=maemo-kexec
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=maemo-rx44-2008.43-7.kernel
+PKG_SOURCE_URL:=http://bu3sch.de/misc/
+PKG_MD5SUM:=3cbf571c0618bfe20a69babab6b33bea
+UNPACK_CMD=$(CP) $(DL_DIR)/$(PKG_SOURCE) $(PKG_BUILD_DIR)/
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_MAEMO_KEXEC_DOWNLOAD_KERNEL \
+       CONFIG_MAEMO_KEXEC_KERNEL_PATH
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/maemo-kexec
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=@TARGET_omap24xx +kexec-tools
+  TITLE:=Kexec Maemo from OpenWRT
+endef
+
+define Package/maemo-kexec/description
+ Kexec Maemo from OpenWRT.
+ The Maemo rootfs must be in the rootfs MTD partition.
+endef
+
+define Package/maemo-kexec/config
+       source "$(SOURCE)/Config.in"
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+MAEMO_KRNL_SRC:=$(if $(CONFIG_MAEMO_KEXEC_DOWNLOAD_KERNEL),\
+                    $(PKG_BUILD_DIR)/$(PKG_SOURCE),\
+                    $(CONFIG_MAEMO_KEXEC_KERNEL_PATH))
+
+define Package/maemo-kexec/install
+       $(INSTALL_DIR) $(1)/boot $(1)/sbin
+       $(INSTALL_BIN) ./files/sbin/bootmaemo $(1)/sbin/
+       $(INSTALL_DATA) $(MAEMO_KRNL_SRC) $(1)/boot/maemo.zImage
+endef
+
+$(eval $(call BuildPackage,maemo-kexec))
diff --git a/utils/maemo-kexec/files/sbin/bootmaemo b/utils/maemo-kexec/files/sbin/bootmaemo
new file mode 100755 (executable)
index 0000000..14f85b1
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+sync
+
+killall -q watchdog || true
+echo 1 >/dev/watchdog
+
+/usr/sbin/kexec --load /boot/maemo.zImage --append "root=1f03 rootfstype=jffs2 ro console=tty0 console=ttyMTD5"
+/usr/sbin/kexec --exec
diff --git a/utils/mc/Config.in b/utils/mc/Config.in
new file mode 100644 (file)
index 0000000..7d6abf8
--- /dev/null
@@ -0,0 +1,20 @@
+menu "Configuration"
+       depends on PACKAGE_mc
+
+config MC_DIFF_VIEWER
+       bool "Compile with diff viewer"
+       default n
+
+config MC_EDITOR
+       bool "Enable internal editor"
+       default n
+
+config MC_SUBSHELL
+       bool "Compile in concurrent subshell"
+       default n
+
+config MC_DISABLE_VFS
+       bool "Disable VFS"
+       default y
+
+endmenu
diff --git a/utils/mc/Makefile b/utils/mc/Makefile
new file mode 100644 (file)
index 0000000..b3ba291
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright (C) 2006-2013 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:=mc
+PKG_VERSION:=4.8.10
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.midnight-commander.org/downloads/
+PKG_MD5SUM:=eb4bdc23abd4fdfa14911d53d65c8186
+
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/mc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+glib2 +libncurses $(LIBRPC_DEPENDS) $(ICONV_DEPENDS)
+  TITLE:=midnight commander - a powerful file manager
+  URL:=http://www.midnight-commander.org/
+  SUBMENU:=filemanager
+  MENU:=1
+endef
+
+define Package/mc/config
+       source "$(SOURCE)/Config.in"
+endef
+
+define Package/mc/description
+ GNU Midnight Commander is a visual file manager, licensed under GNU General
+ Public License and therefore qualifies as Free Software. It's a feature rich
+ full-screen text mode application that allows you to copy, move and delete
+ files and whole directory trees, search for files and run commands in the
+ subshell.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-utf8 \
+       --disable-doxygen-doc \
+       --disable-vfs-sftp \
+       --with-screen=ncurses \
+       --without-gpm-mouse \
+       --without-x \
+       ac_cv_search_addwstr=no
+
+ifeq ($(CONFIG_MC_DIFF_VIEWER),n)
+CONFIGURE_ARGS += \
+       --without-diff-viewer
+endif
+
+ifeq ($(CONFIG_MC_EDITOR),n)
+CONFIGURE_ARGS += \
+       --without-edit
+endif
+
+ifeq ($(CONFIG_MC_SUBSHELL),n)
+CONFIGURE_ARGS += \
+       --without-subshell
+endif
+
+ifeq ($(CONFIG_MC_DISABLE_VFS),y)
+CONFIGURE_ARGS += \
+       --without-vfs
+endif
+
+define Package/mc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mc $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/mc
+ifeq ($(CONFIG_MC_DIFF_VIEWER),y)
+       ln -sf mc $(1)/usr/bin/mcdiff
+endif
+ifeq ($(CONFIG_MC_EDITOR),y)
+       ln -sf mc $(1)/usr/bin/mcedit
+endif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.menu $(1)/etc/mc
+       $(INSTALL_DIR) $(1)/etc/mc/skins
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/skins/default.ini $(1)/etc/mc/skins
+       $(INSTALL_DIR) $(1)/root/.mc/cedit/Syntax
+endef
+
+define Package/mc/conffiles
+/etc/mc/mc.menu
+/etc/mc/skins/default.ini
+endef
+
+$(eval $(call BuildPackage,mc))
diff --git a/utils/md5deep/Makefile b/utils/md5deep/Makefile
new file mode 100644 (file)
index 0000000..b868ae7
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 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:=md5deep
+PKG_VERSION:=3.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=d103b738721c54a9bf535470b63d49dc
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/md5deep
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A program to compute, match and audit hashsets
+  URL:=http://md5deep.sourceforge.net/
+endef
+
+define Package/md5deep/description
+ md5deep is a set of programs to compute MD5, SHA-1, SHA-256, Tiger, or
+ Whirlpool message digests on an arbitrary number of files.
+endef
+
+define Package/md5deep/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/{hash,md5,sha1,sha256,tiger,whirlpool}deep $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,md5deep))
diff --git a/utils/md5deep/patches/101-cross_compile.patch b/utils/md5deep/patches/101-cross_compile.patch
new file mode 100644 (file)
index 0000000..540ba4c
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -19,17 +19,6 @@ AC_PROG_INSTALL
+ AC_CONFIG_FILES([Makefile hashdeep/Makefile md5deep/Makefile])
+ AM_CONFIG_HEADER([config.h])
+-# Bring additional directories where things might be found into our
+-# search path. I don't know why autoconf doesn't do this by default
+-for spfx in /usr/local /opt/local /sw ; do
+-    echo checking ${spfx}/include
+-    if test -d ${spfx}/include; then
+-        CFLAGS="-I${spfx}/include $CFLAGS"
+-        CPPFLAGS="-I${spfx}/include $CPPFLAGS"
+-        LDFLAGS="-L${spfx}/lib $LDFLAGS"
+-    fi
+-done
+-
+ # Checks for header files.
+ AC_HEADER_DIRENT
+ AC_HEADER_STDC
diff --git a/utils/memtester/Makefile b/utils/memtester/Makefile
new file mode 100644 (file)
index 0000000..132ada2
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2007-2010 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:=memtester
+PKG_VERSION:=4.1.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pyropus.ca/software/memtester/old-versions/
+PKG_MD5SUM:=e562451620cf5343016950462bc0dc38
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/memtester
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Userspace utility for testing the memory subsystem for faults
+  URL:=http://pyropus.ca/software/memtester/
+endef
+
+define Package/memtester/description
+ A userspace utility for testing the memory subsystem for faults.
+endef
+
+define Build/Configure
+       $(SED) 's,cc -O2,$(TARGET_CC) $(TARGET_CFLAGS),' $(PKG_BUILD_DIR)/conf-cc
+       $(SED) "s,cc,$(TARGET_CC)," $(PKG_BUILD_DIR)/conf-ld
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) all
+endef
+
+define Package/memtester/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/memtester $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,memtester))
diff --git a/utils/memtester/patches/100-quiet.diff b/utils/memtester/patches/100-quiet.diff
new file mode 100644 (file)
index 0000000..93661a9
--- /dev/null
@@ -0,0 +1,331 @@
+--- a/memtester.c
++++ b/memtester.c
+@@ -123,7 +123,7 @@ int main(int argc, char **argv) {
+     pagesizemask = (ptrdiff_t) ~(pagesize - 1);
+     printf("pagesizemask is 0x%tx\n", pagesizemask);
+-    while ((opt = getopt(argc, argv, "p:")) != -1) {
++    while ((opt = getopt(argc, argv, "qp:")) != -1) {
+         switch (opt) {
+             case 'p':
+                 errno = 0;
+@@ -150,6 +150,9 @@ int main(int argc, char **argv) {
+                 /* okay, got address */
+                 use_phys = 1;
+                 break;
++            case 'q':
++                quiet = 1;
++                break;
+             default: /* '?' */
+                 usage(argv[0]); /* doesn't return */
+         }
+--- a/tests.c
++++ b/tests.c
+@@ -17,12 +17,23 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <limits.h>
++#include <stdarg.h>
+ #include "types.h"
+ #include "sizes.h"
+ #include "memtester.h"
++int quiet = 0;
+ char progress[] = "-\\|/";
++
++void inline __dprintf(const char *format, ...) {
++    if(!quiet) {
++        va_list ap;
++        va_start(ap, format);
++        vprintf(format, ap);
++    }
++}
++
+ #define PROGRESSLEN 4
+ #define PROGRESSOFTEN 2500
+ #define ONE 0x00000001L
+@@ -65,16 +76,16 @@ int test_stuck_address(ulv *bufa, size_t
+     printf("           ");
+     fflush(stdout);
+     for (j = 0; j < 16; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         p1 = (ulv *) bufa;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         for (i = 0; i < count; i++) {
+             *p1 = ((j + i) % 2) == 0 ? (ul) p1 : ~((ul) p1);
+             *p1++;
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         p1 = (ulv *) bufa;
+         for (i = 0; i < count; i++, p1++) {
+@@ -97,7 +108,7 @@ int test_stuck_address(ulv *bufa, size_t
+             }
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -112,13 +123,13 @@ int test_random_value(ulv *bufa, ulv *bu
+     fflush(stdout);
+     for (i = 0; i < count; i++) {
+         *p1++ = *p2++ = rand_ul();
+-        if (!(i % PROGRESSOFTEN)) {
++        if (!quiet && !(i % PROGRESSOFTEN)) {
+             putchar('\b');
+             putchar(progress[++j % PROGRESSLEN]);
+             fflush(stdout);
+         }
+     }
+-    printf("\b \b");
++    __dprintf("\b \b");
+     fflush(stdout);
+     return compare_regions(bufa, bufb, count);
+ }
+@@ -226,23 +237,23 @@ int test_solidbits_comparison(ulv *bufa,
+     printf("           ");
+     fflush(stdout);
+     for (j = 0; j < 64; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         q = (j % 2) == 0 ? UL_ONEBITS : 0;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         p1 = (ulv *) bufa;
+         p2 = (ulv *) bufb;
+         for (i = 0; i < count; i++) {
+             *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         if (compare_regions(bufa, bufb, count)) {
+             return -1;
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -257,23 +268,23 @@ int test_checkerboard_comparison(ulv *bu
+     printf("           ");
+     fflush(stdout);
+     for (j = 0; j < 64; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         q = (j % 2) == 0 ? CHECKERBOARD1 : CHECKERBOARD2;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         p1 = (ulv *) bufa;
+         p2 = (ulv *) bufb;
+         for (i = 0; i < count; i++) {
+             *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         if (compare_regions(bufa, bufb, count)) {
+             return -1;
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -284,25 +295,25 @@ int test_blockseq_comparison(ulv *bufa, 
+     unsigned int j;
+     size_t i;
+-    printf("           ");
++    __dprintf("           ");
+     fflush(stdout);
+     for (j = 0; j < 256; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         p1 = (ulv *) bufa;
+         p2 = (ulv *) bufb;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         for (i = 0; i < count; i++) {
+             *p1++ = *p2++ = (ul) UL_BYTE(j);
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         if (compare_regions(bufa, bufb, count)) {
+             return -1;
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -316,10 +327,10 @@ int test_walkbits0_comparison(ulv *bufa,
+     printf("           ");
+     fflush(stdout);
+     for (j = 0; j < UL_LEN * 2; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         p1 = (ulv *) bufa;
+         p2 = (ulv *) bufb;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         for (i = 0; i < count; i++) {
+             if (j < UL_LEN) { /* Walk it up. */
+@@ -328,14 +339,14 @@ int test_walkbits0_comparison(ulv *bufa,
+                 *p1++ = *p2++ = ONE << (UL_LEN * 2 - j - 1);
+             }
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         if (compare_regions(bufa, bufb, count)) {
+             return -1;
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -346,13 +357,13 @@ int test_walkbits1_comparison(ulv *bufa,
+     unsigned int j;
+     size_t i;
+-    printf("           ");
++    __dprintf("           ");
+     fflush(stdout);
+     for (j = 0; j < UL_LEN * 2; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         p1 = (ulv *) bufa;
+         p2 = (ulv *) bufb;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         for (i = 0; i < count; i++) {
+             if (j < UL_LEN) { /* Walk it up. */
+@@ -361,14 +372,14 @@ int test_walkbits1_comparison(ulv *bufa,
+                 *p1++ = *p2++ = UL_ONEBITS ^ (ONE << (UL_LEN * 2 - j - 1));
+             }
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         if (compare_regions(bufa, bufb, count)) {
+             return -1;
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -379,13 +390,13 @@ int test_bitspread_comparison(ulv *bufa,
+     unsigned int j;
+     size_t i;
+-    printf("           ");
++    __dprintf("           ");
+     fflush(stdout);
+     for (j = 0; j < UL_LEN * 2; j++) {
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+         p1 = (ulv *) bufa;
+         p2 = (ulv *) bufb;
+-        printf("setting %3u", j);
++        __dprintf("setting %3u", j);
+         fflush(stdout);
+         for (i = 0; i < count; i++) {
+             if (j < UL_LEN) { /* Walk it up. */
+@@ -400,14 +411,14 @@ int test_bitspread_comparison(ulv *bufa,
+                                     | (ONE << (UL_LEN * 2 + 1 - j)));
+             }
+         }
+-        printf("\b\b\b\b\b\b\b\b\b\b\b");
+-        printf("testing %3u", j);
++        __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++        __dprintf("testing %3u", j);
+         fflush(stdout);
+         if (compare_regions(bufa, bufb, count)) {
+             return -1;
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+@@ -419,29 +430,29 @@ int test_bitflip_comparison(ulv *bufa, u
+     ul q;
+     size_t i;
+-    printf("           ");
++    __dprintf("           ");
+     fflush(stdout);
+     for (k = 0; k < UL_LEN; k++) {
+         q = ONE << k;
+         for (j = 0; j < 8; j++) {
+-            printf("\b\b\b\b\b\b\b\b\b\b\b");
++            __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
+             q = ~q;
+-            printf("setting %3u", k * 8 + j);
++            __dprintf("setting %3u", k * 8 + j);
+             fflush(stdout);
+             p1 = (ulv *) bufa;
+             p2 = (ulv *) bufb;
+             for (i = 0; i < count; i++) {
+                 *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
+             }
+-            printf("\b\b\b\b\b\b\b\b\b\b\b");
+-            printf("testing %3u", k * 8 + j);
++            __dprintf("\b\b\b\b\b\b\b\b\b\b\b");
++            __dprintf("testing %3u", k * 8 + j);
+             fflush(stdout);
+             if (compare_regions(bufa, bufb, count)) {
+                 return -1;
+             }
+         }
+     }
+-    printf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
++    __dprintf("\b\b\b\b\b\b\b\b\b\b\b           \b\b\b\b\b\b\b\b\b\b\b");
+     fflush(stdout);
+     return 0;
+ }
+--- a/tests.h
++++ b/tests.h
+@@ -14,6 +14,8 @@
+  *
+  */
++extern int quiet;
++
+ /* Function declaration. */
+ int test_stuck_address(unsigned long volatile *bufa, size_t count);
diff --git a/utils/mg/Makefile b/utils/mg/Makefile
new file mode 100644 (file)
index 0000000..de5265c
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2008-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:=mg
+PKG_VERSION:=20110120
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://homepage.boetes.org/software/mg
+PKG_MD5SUM:=f2fa8016a491aa2a9d4c5698c593f31b
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mg
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=microscopic GNU Emacs-style editor
+  URL:=http://homepage.boetes.org/software/mg/
+  SUBMENU:=Editors
+endef
+
+define Package/mg/description
+       This program is intended to be a small, fast, and portable
+       editor for people who can't (or don't want to) run real
+       Emacs for one reason or another.  It is compatible with GNU
+       because there shouldn't be any reason to learn more than
+       one Emacs flavor.
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               $(TARGET_CONFIGURE_OPTS) \
+               ./configure \
+       );
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               LDFLAGS="$(TARGET_LDFLAGS) -lncurses" \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               CC="$(TARGET_CC)"
+endef
+
+define Package/mg/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,mg))
diff --git a/utils/mgetty/Makefile b/utils/mgetty/Makefile
new file mode 100644 (file)
index 0000000..ee5eaba
--- /dev/null
@@ -0,0 +1,131 @@
+#
+# Copyright (C) 2006 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:=mgetty
+PKG_VERSION:=1.1.36
+PKG_XVERSION:=Jun15
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION)-$(PKG_XVERSION).tar.gz
+PKG_SOURCE_URL:=ftp://alpha.greenie.net/pub/mgetty/source/1.1
+PKG_MD5SUM:=0320e98c6b86bcca48fc5f355b94ead4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mgetty
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A data/fax solution for your analog modem
+  URL:=http://mgetty.greenie.net/
+endef
+
+define Package/mgetty/description
+A data/fax solution for your analog modem.
+endef
+
+define Build/Configure
+       cp $(PKG_BUILD_DIR)/policy.h-dist $(PKG_BUILD_DIR)/policy.h
+       echo "#define   AUTO_PPP" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#undef    FAX_NOTIFY_PROGRAM" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#define   FAX_NOTIFY_PROGRAM \"/usr/lib/mgetty+sendfax/new_fax\"" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#undef    DATA_FLOW" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#define   DATA_FLOW FLOW_HARD" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#undef    DEVICE_GROUP" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#undef    DEVICE_OWNER" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#define   DEVICE_OWNER \"root\"" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#undef    FAXREC_FLOW" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#define   FAXREC_FLOW FLOW_SOFT" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#undef    FAXSEND_FLOW" >> $(PKG_BUILD_DIR)/policy.h
+       echo "#define   FAXSEND_FLOW FLOW_SOFT" >> $(PKG_BUILD_DIR)/policy.h
+endef
+
+#FIXME: don't manually install, use upstream Makefile instead
+define Build/Compile
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)/usr/bin
+       mkdir -p $(PKG_INSTALL_DIR)/usr/sbin
+       mkdir -p $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
+       mkdir -p $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               mksed
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               prefix="$(PKG_INSTALL_DIR)/usr" \
+               CONFDIR=/etc/mgetty+sendfax \
+               bin-all
+       $(CP) $(PKG_BUILD_DIR)/mgetty $(PKG_INSTALL_DIR)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/sendfax $(PKG_INSTALL_DIR)/usr/sbin
+       $(CP) $(PKG_BUILD_DIR)/fax/faxrunqd $(PKG_INSTALL_DIR)/usr/sbin
+       chmod 755 $(PKG_INSTALL_DIR)/usr/sbin/*
+       $(CP) $(PKG_BUILD_DIR)/fax/faxq-helper $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
+       chmod u+s $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/faxq-helper
+       $(CP) $(PKG_BUILD_DIR)/fax/cour25n.pbm $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
+       $(CP) $(PKG_BUILD_DIR)/fax/cour25.pbm $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax
+       $(CP) $(PKG_BUILD_DIR)/fax/faxq $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/fax/faxrm $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/fax/faxrunq $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/fax/faxspool $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/g3/g32pbm $(PKG_INSTALL_DIR)/usr/bin
+       (cd $(PKG_INSTALL_DIR)/usr/bin;\
+               ln -snf g32pbm g3topbm;\
+       );
+       $(CP) $(PKG_BUILD_DIR)/g3/g3cat $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/g3/pbm2g3 $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/g3/sff2g3 $(PKG_INSTALL_DIR)/usr/bin
+       chmod 755 $(PKG_INSTALL_DIR)/usr/bin/*
+# Installation into /etc
+       $(CP) $(PKG_BUILD_DIR)/dialin.config $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
+       $(CP) $(PKG_BUILD_DIR)/fax/faxheader $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
+       $(CP) $(PKG_BUILD_DIR)/faxrunq.config $(PKG_INSTALL_DIR)/etc/mgetty+sendfax
+       $(CP) $(PKG_BUILD_DIR)/fax/faxspool.rules $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxspool.rules.sample
+       $(PKG_BUILD_DIR)/sedscript < $(PKG_BUILD_DIR)/login.cfg.in > $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/login.config
+       $(PKG_BUILD_DIR)/sedscript < $(PKG_BUILD_DIR)/mgetty.cfg.in > $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/mgetty.config
+       $(PKG_BUILD_DIR)/sedscript < $(PKG_BUILD_DIR)/sendfax.cfg.in > $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/sendfax.config
+endef
+
+define Package/mgetty/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/faxq \
+               $(PKG_INSTALL_DIR)/usr/bin/faxrm \
+               $(PKG_INSTALL_DIR)/usr/bin/faxrunq \
+               $(PKG_INSTALL_DIR)/usr/bin/faxspool \
+               $(PKG_INSTALL_DIR)/usr/bin/g32pbm \
+               $(PKG_INSTALL_DIR)/usr/bin/g3cat \
+               $(PKG_INSTALL_DIR)/usr/bin/pbm2g3 \
+               $(PKG_INSTALL_DIR)/usr/bin/sff2g3 \
+               $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/mgetty \
+               $(PKG_INSTALL_DIR)/usr/sbin/sendfax \
+               $(PKG_INSTALL_DIR)/usr/sbin/faxrunqd \
+               $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/lib/mgetty+sendfax
+       install -m4755 \
+               $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/faxq-helper \
+               $(1)/usr/lib/mgetty+sendfax/
+       install -m644 \
+               $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/cour25n.pbm \
+               $(PKG_INSTALL_DIR)/usr/lib/mgetty+sendfax/cour25.pbm \
+               $(1)/usr/lib/mgetty+sendfax/
+       $(INSTALL_DIR) $(1)/etc/mgetty+sendfax
+       install -m600 \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/dialin.config \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxheader \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxrunq.config \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/faxspool.rules.sample \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/login.config \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/mgetty.config \
+               $(PKG_INSTALL_DIR)/etc/mgetty+sendfax/sendfax.config \
+               $(1)/etc/mgetty+sendfax/
+endef
+
+$(eval $(call BuildPackage,mgetty))
diff --git a/utils/mgetty/patches/001-mgetty.patch b/utils/mgetty/patches/001-mgetty.patch
new file mode 100644 (file)
index 0000000..427fe9c
--- /dev/null
@@ -0,0 +1,88 @@
+--- a/Makefile
++++ b/Makefile
+@@ -164,7 +164,9 @@
+ #
+ # if your systems doesn't have one, use the shell script that I provide
+ # in "inst.sh" (taken from X11R5). Needed on IRIX5.2
+-INSTALL=install -c -o bin -g bin
++STRIP=$(STAGING_DIR)sstrip
++INSTALL=install -c -o root -g root
++#INSTALL=install -c -o bin -g bin
+ #INSTALL=install -c -o root -g wheel          # NeXT/BSD
+ #INSTALL=/usr/ucb/install -c -o bin -g bin    # AIX, Solaris 2.x
+ #INSTALL=installbsd -c -o bin -g bin          # OSF/1, AIX 4.1, 4.2
+@@ -216,7 +218,7 @@
+ # (it's possible to run faxrunq(d) as root, but the FAX_OUT_USER 
+ #  MUST NOT BE root or any other privileged account).
+ #
+-FAX_OUT_USER=fax
++FAX_OUT_USER=root
+ #
+ #
+ # Where section 1 manual pages should be placed
+@@ -421,7 +423,12 @@
+       ./mksed >sedscript
+       chmod +x sedscript
+-mksed: mksed.c policy.h Makefile 
++REALGCC:=/usr/bin/gcc
++mksed: mksed.c policy.h Makefile
++      ( echo $(REALGCC); $(MAKE) "CC=$(REALGCC)" "CFLAGS=$(CFLAGS)" mksed-wrong;\
++      );
++
++mksed-wrong: mksed.c policy.h Makefile
+       $(CC) $(CFLAGS) -DBINDIR=\"$(BINDIR)\" -DSBINDIR=\"$(SBINDIR)\" \
+               -DLIBDIR=\"$(LIBDIR)\" \
+               -DCONFDIR=\"$(CONFDIR)\" \
+@@ -586,8 +593,10 @@
+       -test -d $(SBINDIR) || ( ./mkidirs $(SBINDIR) ; chmod 755 $(SBINDIR) )
+       -mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old
+       -mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old
+-      $(INSTALL) -s -m 700 mgetty $(SBINDIR)
+-      $(INSTALL) -s -m 755 sendfax $(SBINDIR)
++      $(INSTALL) -m 700 mgetty $(SBINDIR)
++      $(STRIP) $(SBINDIR)/mgetty
++      $(INSTALL) -m 755 sendfax $(SBINDIR)
++      $(STRIP) $(SBINDIR)/sendfax
+ #
+ # data files + directories
+ #
+@@ -649,7 +658,8 @@
+       if [ ! -z "$(INSTALL_MECHO)" ] ; then \
+           cd compat ; \
+           $(CC) $(CFLAGS) -o mg.echo mg.echo.c && \
+-          $(INSTALL) -s -m 755 mg.echo $(BINDIR) ; \
++          $(INSTALL) -m 755 mg.echo $(BINDIR) && \
++          $(STRIP) $(BINDIR)/mg.echo ; \
+       fi
+ #
+--- a/g3/Makefile
++++ b/g3/Makefile
+@@ -37,7 +37,8 @@
+ # install programs
+ #
+       for f in $(G3_PROGRAMS) ; do \
+-              $(INSTALL) -s -m 755 $$f $(BINDIR) ; \
++              $(INSTALL) -m 755 $$f $(BINDIR) ; \
++              $(STRIP) $(BINDIR)/$$f ; \
+       done
+ #
+ # make symlink for "g3topbm" (so third-party fax viewers won't fail)
+--- a/logfile.c
++++ b/logfile.c
+@@ -327,12 +327,11 @@
+     }
+     else              /* ERROR or FATAL */
+     {
+-      fprintf(log_fp, "\n%02d/%02d %02d:%02d:%02d %s %s: %s",
++      fprintf(log_fp, "\n%02d/%02d %02d:%02d:%02d %s %s: #%d",
+                            tm->tm_mon+1,  tm->tm_mday,
+                            tm->tm_hour, tm->tm_min, tm->tm_sec,
+                            log_infix, ws,
+-                           ( errnr <= sys_nerr ) ? sys_errlist[errnr]:
+-                           "<error not in list>" );
++                           errnr );
+ #ifdef SYSLOG
+       syslog( level == L_FATAL? LOG_ALERT: LOG_ERR, "%s: %m", ws );
+ #endif
diff --git a/utils/microcom/Makefile b/utils/microcom/Makefile
new file mode 100644 (file)
index 0000000..0000d42
--- /dev/null
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2006 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:=microcom
+PKG_VERSION:=1.02
+PKG_RELEASE:=1
+
+PKG_SOURCE:=m102.tar.gz
+PKG_SOURCE_URL:=http://microcom.port5.com/
+PKG_MD5SUM:=c7817035dc41cb02e7cfb565cf9b7401
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK:=zcat $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+
+define Package/microcom
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A serial terminal emulation program
+  URL:=http://microcomlinux.homestead.com/
+  SUBMENU:=Terminal
+endef
+
+define Package/microcom/description
+       microcom is a minicom-like serial terminal emulator with scripting
+       support.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               microcom
+endef
+
+define Package/microcom/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/microcom $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,microcom))
diff --git a/utils/microcom/patches/001-cross_compile.patch b/utils/microcom/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..f6e44a8
--- /dev/null
@@ -0,0 +1,29 @@
+diff -ruN microcom-1.02-old/Makefile microcom-1.02-new/Makefile
+--- microcom-1.02-old/Makefile 2006-10-29 21:55:45.000000000 +0100
++++ microcom-1.02-new/Makefile 2006-10-29 22:00:09.000000000 +0100
+@@ -19,19 +19,19 @@
+ #** Rev. 0.91 - Jan. 2000 - minor fixes, compiled under Mandrake 6.0
+ #****************************************************************************/
+ microcom: microcom.o mux.o script.o help.o autodet.o
+-      gcc -o microcom microcom.o mux.o script.o help.o autodet.o
++      $(CC) -o microcom microcom.o mux.o script.o help.o autodet.o
+ autodet.o: autodet.c microcom.h
+-      gcc -O -c autodet.c
++      $(CC) $(CFLAGS)  -c autodet.c
+ script.o: script.c script.h microcom.h
+-      gcc -O -c script.c
++      $(CC) $(CFLAGS) -c script.c
+ mux.o: mux.c microcom.h
+-      gcc -O -c mux.c
++      $(CC) $(CFLAGS) -c mux.c
+ microcom.o: microcom.c microcom.h
+-      gcc -O -c microcom.c
++      $(CC) $(CFLAGS) -c microcom.c
+ help.o: help.c microcom.h
+-      gcc -O -c help.c
++      $(CC) $(CFLAGS) -c help.c
diff --git a/utils/mksh/Makefile b/utils/mksh/Makefile
new file mode 100644 (file)
index 0000000..66e8e63
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2007-2011 OpenWrt.org
+# Copyright (c) 2009-2013 Thorsten Glaser <tg@mirbsd.org>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mksh
+PKG_VERSION:=47
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-R$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.mirbsd.org/MirOS/dist/mir/mksh
+PKG_MD5SUM:=71c7cbcd78306897801b8b6691091e66
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mksh
+  SECTION:=shells
+  CATEGORY:=Base system
+  TITLE:=MirBSD Korn Shell
+  DEPENDS:=$(DEP)
+  URL:=http://mirbsd.de/mksh
+endef
+
+define Package/mksh/description
+mksh is the MirBSD enhanced version of the Public Domain Korn
+shell (pdksh), a Bourne-compatible shell which is largely si-
+milar to the original AT&T Korn shell; mksh is the only pdksh
+derivate currently being actively developed.  It includes bug
+fixes and feature improvements, in order to produce a modern,
+robust shell good for interactive and especially script use.
+mksh has UTF-8 support (in substring operations and the Emacs
+editing mode) and - while R47 corresponds to OpenBSD 5.1-cur-
+rent ksh (without GNU bash-like PS1 and fancy character clas-
+ses) - adheres to SUSv4 and is much more robust. The code has
+been cleaned up and simplified, bugs fixed, standards compli-
+ance added, and several enhancements (for extended compatibi-
+lity to other modern shells - as well as a couple of its own)
+are available. It has sensible defaults as usual with BSD.
+endef
+
+define Build/Compile
+       # -DMKSH_SMALL=1 â‡’ reduce functionality quite a lot
+       # -DMKSH_ASSUME_UTF8=0 â‡’ never automatically enable
+       #       UTF-8 mode, neither use setlocale/nl_langinfo
+       #       nor look at $LC_* and $LANG (not recommended)
+       # HAVE_CAN_FSTACKPROTECTORALL=0 â‡’ nuke libssp dependency
+       cd $(PKG_BUILD_DIR); \
+               CC="$(TARGET_CC)" \
+               TARGET_OS="$(shell uname -s)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="-DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=0" \
+               HAVE_CAN_FSTACKPROTECTORALL=0 \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+                       $(BASH) Build.sh -Q -r -c lto
+endef
+
+define Package/mksh/postinst
+#!/bin/sh
+grep mksh $${IPKG_INSTROOT}/etc/shells || \
+       echo "/bin/mksh" >> $${IPKG_INSTROOT}/etc/shells
+endef
+
+define Package/mksh/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/dot.mkshrc $(1)/etc/mkshrc
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mksh $(1)/bin/
+endef
+
+define Package/mksh/conffiles
+/etc/mkshrc
+endef
+
+$(eval $(call BuildPackage,mksh))
diff --git a/utils/mksh/patches/100-dot_mkshrc b/utils/mksh/patches/100-dot_mkshrc
new file mode 100644 (file)
index 0000000..7cdd162
--- /dev/null
@@ -0,0 +1,50 @@
+From 2bee59bb9e6b142a78c94f5e77a54e4e2366c1b8 Mon Sep 17 00:00:00 2001
+From: Thorsten Glaser <tg@freewrt.org>
+Date: Thu, 25 Jul 2013 22:07:33 +0200
+Subject: [PATCH] Make default mkshrc file suitable for OpenWrt environment:
+
+* Part of the FreeWRT patches:
+  - no hostname(1)
+  - ls(1) has no -o option
+* OpenWrt and FreeWRT-1.0 fix:
+  - since this is not ~/.mkshrc make sure subshells find it
+---
+ dot.mkshrc | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/dot.mkshrc b/dot.mkshrc
+index c10b8fd..3a389b2 100644
+--- a/dot.mkshrc
++++ b/dot.mkshrc
+@@ -28,8 +28,8 @@ case $KSH_VERSION in
+ *) return 0 ;;
+ esac
+-PS1='#'; (( USER_ID )) && PS1='$'; [[ ${HOSTNAME:=$(ulimit -c 0; hostname -s \
+-    2>/dev/null)} = *([        ]|localhost) ]] && HOSTNAME=$(ulimit -c 0; hostname \
++PS1='#'; (( USER_ID )) && PS1='$'; [[ ${HOSTNAME:=$(</proc/sys/kernel/hostname
++    )} = *([   ]|localhost) ]] && HOSTNAME=$(ulimit -c 0; hostname \
+     2>/dev/null); : ${EDITOR:=/bin/ed} ${HOSTNAME:=nil} ${TERM:=vt100}
+ : ${MKSH:=$(whence -p mksh)}; PS4='[$EPOCHREALTIME] '; PS1=$'\001\r''${|
+       local e=$?
+@@ -50,7 +50,7 @@ unalias ls
+ alias l='ls -F'
+ alias la='l -a'
+ alias ll='l -l'
+-alias lo='l -alo'
++alias lo='l -al'
+ alias doch='fc -ln -1 | sudo mksh -s'
+ whence -p rot13 >/dev/null || alias rot13='tr \
+     abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \
+@@ -413,4 +413,8 @@ alias cls='print -n \\033c'
+ unset p
++# we need this in OpenWrt for subshells that are not login shells
++: ${ENV=/etc/mkshrc}
++[[ -z $ENV ]] || export ENV
++
+ : place customisations above this line
+-- 
+1.8.3.2
+
diff --git a/utils/msr-tools/Makefile b/utils/msr-tools/Makefile
new file mode 100644 (file)
index 0000000..5be0fd0
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 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:=msr-tools
+PKG_VERSION:=1.1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/utils/cpu/msr-tools
+PKG_MD5SUM:=2452d2233556aa0fb8b53208361a2c94
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+
+define Package/msr-tools
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=
+  TITLE:=x86 MSR utilities.
+  URL:=http://www.kernel.org/pub/linux/utils/cpu/msr-tools
+  SUBMENU:=CPU tools
+endef
+
+define Package/msr-tools/description
+       Manipulate the MSR (machine state registers) on i386 and x86_64
+       processors.
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(INSTALL_DIR) "$(PKG_INSTALL_DIR)/usr/sbin"
+       $(MAKE) -C $(PKG_BUILD_DIR) all \
+               $(TARGET_CONFIGURE_OPTS) \
+               sbindir="$(PKG_INSTALL_DIR)/usr/sbin" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               LDFLAGS="" \
+               install
+endef
+
+define Package/msr-tools/install       
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,msr-tools))
diff --git a/utils/msr-tools/patches/100-multiprocessor.patch b/utils/msr-tools/patches/100-multiprocessor.patch
new file mode 100644 (file)
index 0000000..8795b8b
--- /dev/null
@@ -0,0 +1,28 @@
+--- msr-tools-1.1.2/wrmsr.c.orig       2004-07-20 09:54:59.000000000 -0600
++++ msr-tools-1.1.2/wrmsr.c    2011-12-27 14:07:24.505887313 -0700
+@@ -90,7 +90,11 @@ int main(int argc, char *argv[])
+   reg = strtoul(argv[optind++], NULL, 0);
++#ifdef SMP
+   sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
++#else
++  sprintf(msr_file_name, "/dev/msr%d", cpu);
++#endif
+   fd = open(msr_file_name, O_WRONLY);
+   if ( fd < 0 ) {
+     if ( errno == ENXIO ) {
+--- msr-tools-1.1.2/rdmsr.c.orig       2004-07-20 09:54:59.000000000 -0600
++++ msr-tools-1.1.2/rdmsr.c    2011-12-27 14:06:37.831584784 -0700
+@@ -167,7 +167,11 @@ int main(int argc, char *argv[])
+   reg = strtoul(argv[optind], NULL, 0);
++#ifdef SMP
+   sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
++#else
++  sprintf(msr_file_name, "/dev/msr%d", cpu);
++#endif
+   fd = open(msr_file_name, O_RDONLY);
+   if ( fd < 0 ) {
+     if ( errno == ENXIO ) {
diff --git a/utils/mtd-utils/Makefile b/utils/mtd-utils/Makefile
new file mode 100644 (file)
index 0000000..7ff0dcf
--- /dev/null
@@ -0,0 +1,115 @@
+#
+# Copyright (C) 2009-2013 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:=mtd-utils
+PKG_REV:=ab8c6fb93ce9db0f09401c4b819b0b277dc00340
+PKG_VERSION:=1.5.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DEPENDS:=util-linux
+
+include $(INCLUDE_DIR)/package.mk
+
+FILES:= \
+       doc_loadbios \
+       docfdisk \
+       flash_erase \
+       flash_eraseall:+mtd-utils-flash-erase \
+       flash_lock \
+       flash_otp_dump \
+       flash_otp_lock \
+       flash_otp_write \
+       flash_unlock \
+       flashcp \
+       ftl_check \
+       ftl_format \
+       jffs2dump \
+       jffs2reader:+zlib \
+       mkfs.jffs2:+zlib \
+       mkfs.ubifs:+libuuid:+liblzo:+zlib \
+       mtd_debug \
+       mtdinfo \
+       nanddump \
+       nandtest \
+       nandwrite \
+       nftldump \
+       nftl_format \
+       recv_image \
+       rfddump \
+       rfdformat \
+       serve_image \
+       sumtool \
+       ubiattach \
+       ubicrc32 \
+       ubidetach \
+       ubiformat \
+       ubimkvol \
+       ubinfo \
+       ubinize \
+       ubirename \
+       ubirmvol \
+       ubirsvol \
+       ubiupdatevol
+
+define PartGen
+define Package/mtd-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))
+  TITLE:=$(firstword $(subst :, ,$(1))) package from mtd-utils
+  URL:=http://www.linux-mtd.infradead.org/
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=mtd-utils $(wordlist 2,$(words $(subst :, ,$(1))),$(subst :, ,$(1)))
+endef
+endef
+
+define Package/mtd-utils
+  TITLE:=Utilities for flash info/debug
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.linux-mtd.infradead.org/
+  MENU:=1
+endef
+
+define Package/mtd-utils/description
+  Utilities for manipulating memory technology devices.
+endef
+
+define Package/mtd-utils/install
+       true
+endef
+
+$(foreach file,$(FILES),$(eval $(call PartGen,$(file))))
+
+MAKE_FLAGS += \
+       DESTDIR="$(PKG_INSTALL_DIR)" \
+       BUILDDIR="$(PKG_BUILD_DIR)" \
+       LDLIBS+="$(LIBGCC_S)" \
+       WITHOUT_XATTR=1 \
+       WITHOUT_LZO=1
+
+define PartInstall
+define Package/mtd-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))/install
+       $(INSTALL_DIR) $$(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/$(firstword $(subst :, ,$(1))) \
+               $$(1)/usr/sbin/
+endef
+endef
+
+$(foreach file,$(FILES),$(eval $(call PartInstall,$(file))))
+
+$(eval $(call BuildPackage,mtd-utils))
+$(foreach file,$(FILES),$(eval $(call BuildPackage,mtd-utils-$(subst _,-,$(firstword $(subst :, ,$(file)))))))
diff --git a/utils/mtd-utils/patches/010-fix-rpmatch.patch b/utils/mtd-utils/patches/010-fix-rpmatch.patch
new file mode 100644 (file)
index 0000000..4a04676
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/include/common.h
++++ b/include/common.h
+@@ -122,10 +122,12 @@
+               }
+               if (strcmp("\n", line) != 0) {
+-                      switch (rpmatch(line)) {
+-                      case 0: ret = false; break;
+-                      case 1: ret = true; break;
+-                      case -1:
++                      switch (line[0]) {
++                      case 'N':
++                      case 'n': ret = false; break;
++                      case 'Y':
++                      case 'y': ret = true; break;
++                      default:
+                               puts("unknown response; please try again");
+                               continue;
+                       }
diff --git a/utils/mtd-utils/patches/130-lzma_jffs2.patch b/utils/mtd-utils/patches/130-lzma_jffs2.patch
new file mode 100644 (file)
index 0000000..a40199e
--- /dev/null
@@ -0,0 +1,5029 @@
+--- a/Makefile
++++ b/Makefile
+@@ -3,7 +3,7 @@
+ VERSION = 1.5.0
+-CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
++CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) -I./include/linux/lzma
+ ifeq ($(WITHOUT_XATTR), 1)
+   CPPFLAGS += -DWITHOUT_XATTR
+@@ -84,7 +84,7 @@
+ #
+ # Utils in top level
+ #
+-obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o
++obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o $(if $(WITHOUT_LZO),,compr_lzo.o) compr_lzma.o lzma/LzFind.o lzma/LzmaEnc.o lzma/LzmaDec.o compr.o rbtree.o
+ LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
+ LDLIBS_mkfs.jffs2  = -lz $(LZOLDLIBS)
+--- a/compr.c
++++ b/compr.c
+@@ -520,6 +520,9 @@ int jffs2_compressors_init(void)
+ #ifdef CONFIG_JFFS2_LZO
+       jffs2_lzo_init();
+ #endif
++#ifdef CONFIG_JFFS2_LZMA
++      jffs2_lzma_init();
++#endif
+       return 0;
+ }
+@@ -534,5 +537,8 @@ int jffs2_compressors_exit(void)
+ #ifdef CONFIG_JFFS2_LZO
+       jffs2_lzo_exit();
+ #endif
++#ifdef CONFIG_JFFS2_LZMA
++      jffs2_lzma_exit();
++#endif
+       return 0;
+ }
+--- a/compr.h
++++ b/compr.h
+@@ -18,13 +18,14 @@
+ #define CONFIG_JFFS2_ZLIB
+ #define CONFIG_JFFS2_RTIME
+-#define CONFIG_JFFS2_LZO
++#define CONFIG_JFFS2_LZMA
+ #define JFFS2_RUBINMIPS_PRIORITY 10
+ #define JFFS2_DYNRUBIN_PRIORITY  20
+ #define JFFS2_RTIME_PRIORITY     50
+-#define JFFS2_ZLIB_PRIORITY      60
+-#define JFFS2_LZO_PRIORITY       80
++#define JFFS2_LZMA_PRIORITY      70
++#define JFFS2_ZLIB_PRIORITY      80
++#define JFFS2_LZO_PRIORITY       90
+ #define JFFS2_COMPR_MODE_NONE       0
+ #define JFFS2_COMPR_MODE_PRIORITY   1
+@@ -115,5 +116,10 @@ void jffs2_rtime_exit(void);
+ int jffs2_lzo_init(void);
+ void jffs2_lzo_exit(void);
+ #endif
++#ifdef CONFIG_JFFS2_LZMA
++int jffs2_lzma_init(void);
++void jffs2_lzma_exit(void);
++#endif
++
+ #endif /* __JFFS2_COMPR_H__ */
+--- /dev/null
++++ b/compr_lzma.c
+@@ -0,0 +1,128 @@
++/*
++ * JFFS2 -- Journalling Flash File System, Version 2.
++ *
++ * For licensing information, see the file 'LICENCE' in this directory.
++ *
++ * JFFS2 wrapper to the LZMA C SDK
++ *
++ */
++
++#include <linux/lzma.h>
++#include "compr.h"
++
++#ifdef __KERNEL__
++      static DEFINE_MUTEX(deflate_mutex);
++#endif
++
++CLzmaEncHandle *p;
++Byte propsEncoded[LZMA_PROPS_SIZE];
++SizeT propsSize = sizeof(propsEncoded);
++
++STATIC void lzma_free_workspace(void)
++{
++      LzmaEnc_Destroy(p, &lzma_alloc, &lzma_alloc);
++}
++
++STATIC int INIT lzma_alloc_workspace(CLzmaEncProps *props)
++{
++      if ((p = (CLzmaEncHandle *)LzmaEnc_Create(&lzma_alloc)) == NULL)
++      {
++              PRINT_ERROR("Failed to allocate lzma deflate workspace\n");
++              return -ENOMEM;
++      }
++
++      if (LzmaEnc_SetProps(p, props) != SZ_OK)
++      {
++              lzma_free_workspace();
++              return -1;
++      }
++      
++      if (LzmaEnc_WriteProperties(p, propsEncoded, &propsSize) != SZ_OK)
++      {
++              lzma_free_workspace();
++              return -1;
++      }
++
++      return 0;
++}
++
++STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out,
++                            uint32_t *sourcelen, uint32_t *dstlen, void *model)
++{
++      SizeT compress_size = (SizeT)(*dstlen);
++      int ret;
++
++      #ifdef __KERNEL__
++              mutex_lock(&deflate_mutex);
++      #endif
++
++      ret = LzmaEnc_MemEncode(p, cpage_out, &compress_size, data_in, *sourcelen,
++              0, NULL, &lzma_alloc, &lzma_alloc);
++
++      #ifdef __KERNEL__
++              mutex_unlock(&deflate_mutex);
++      #endif
++
++      if (ret != SZ_OK)
++              return -1;
++
++      *dstlen = (uint32_t)compress_size;
++
++      return 0;
++}
++
++STATIC int jffs2_lzma_decompress(unsigned char *data_in, unsigned char *cpage_out,
++                               uint32_t srclen, uint32_t destlen, void *model)
++{
++      int ret;
++      SizeT dl = (SizeT)destlen;
++      SizeT sl = (SizeT)srclen;
++      ELzmaStatus status;
++      
++      ret = LzmaDecode(cpage_out, &dl, data_in, &sl, propsEncoded,
++              propsSize, LZMA_FINISH_ANY, &status, &lzma_alloc);
++
++      if (ret != SZ_OK || status == LZMA_STATUS_NOT_FINISHED || dl != (SizeT)destlen)
++              return -1;
++
++      return 0;
++}
++
++static struct jffs2_compressor jffs2_lzma_comp = {
++      .priority = JFFS2_LZMA_PRIORITY,
++      .name = "lzma",
++      .compr = JFFS2_COMPR_LZMA,
++      .compress = &jffs2_lzma_compress,
++      .decompress = &jffs2_lzma_decompress,
++      .disabled = 0,
++};
++
++int INIT jffs2_lzma_init(void)
++{
++      int ret;
++      CLzmaEncProps props;
++      LzmaEncProps_Init(&props);
++
++      props.dictSize = LZMA_BEST_DICT(0x2000);
++      props.level = LZMA_BEST_LEVEL;
++      props.lc = LZMA_BEST_LC;
++      props.lp = LZMA_BEST_LP;
++      props.pb = LZMA_BEST_PB;
++      props.fb = LZMA_BEST_FB;
++
++      ret = lzma_alloc_workspace(&props);
++      if (ret < 0)
++      return ret;
++
++      ret = jffs2_register_compressor(&jffs2_lzma_comp);
++      if (ret)
++              lzma_free_workspace();
++      
++      return ret;
++}
++
++void jffs2_lzma_exit(void)
++{
++      jffs2_unregister_compressor(&jffs2_lzma_comp);
++      lzma_free_workspace();
++}
+--- a/include/linux/jffs2.h
++++ b/include/linux/jffs2.h
+@@ -47,6 +47,7 @@
+ #define JFFS2_COMPR_DYNRUBIN  0x05
+ #define JFFS2_COMPR_ZLIB      0x06
+ #define JFFS2_COMPR_LZO               0x07
++#define JFFS2_COMPR_LZMA      0x08
+ /* Compatibility flags. */
+ #define JFFS2_COMPAT_MASK 0xc000      /* What do to if an unknown nodetype is found */
+ #define JFFS2_NODE_ACCURATE 0x2000
+--- /dev/null
++++ b/include/linux/lzma.h
+@@ -0,0 +1,61 @@
++#ifndef __LZMA_H__
++#define __LZMA_H__
++
++#ifdef __KERNEL__
++      #include <linux/kernel.h>
++      #include <linux/sched.h>
++      #include <linux/slab.h>
++      #include <linux/vmalloc.h>
++      #include <linux/init.h>
++      #define LZMA_MALLOC vmalloc
++      #define LZMA_FREE vfree
++      #define PRINT_ERROR(msg) printk(KERN_WARNING #msg)
++      #define INIT __init
++      #define STATIC static
++#else
++      #include <stdint.h>
++      #include <stdlib.h>
++      #include <stdio.h>
++      #include <unistd.h>
++      #include <string.h>
++      #include <errno.h>
++      #include <linux/jffs2.h>
++      #ifndef PAGE_SIZE
++              extern int page_size;
++              #define PAGE_SIZE page_size
++      #endif
++      #define LZMA_MALLOC malloc
++      #define LZMA_FREE free
++      #define PRINT_ERROR(msg) fprintf(stderr, msg)
++      #define INIT
++      #define STATIC
++#endif
++
++#include "lzma/LzmaDec.h"
++#include "lzma/LzmaEnc.h"
++
++#define LZMA_BEST_LEVEL (9)
++#define LZMA_BEST_LC    (0)
++#define LZMA_BEST_LP    (0)
++#define LZMA_BEST_PB    (0)
++#define LZMA_BEST_FB  (273)
++
++#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2)
++
++static void *p_lzma_malloc(void *p, size_t size)
++{
++      if (size == 0)
++              return NULL;
++
++      return LZMA_MALLOC(size);
++}
++
++static void p_lzma_free(void *p, void *address)
++{
++      if (address != NULL)
++              LZMA_FREE(address);
++}
++
++static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free};
++
++#endif
+--- /dev/null
++++ b/include/linux/lzma/LzFind.h
+@@ -0,0 +1,116 @@
++/* LzFind.h  -- Match finder for LZ algorithms
++2008-04-04
++Copyright (c) 1999-2008 Igor Pavlov
++You can use any of the following license options:
++  1) GNU Lesser General Public License (GNU LGPL)
++  2) Common Public License (CPL)
++  3) Common Development and Distribution License (CDDL) Version 1.0 
++  4) Igor Pavlov, as the author of this code, expressly permits you to 
++     statically or dynamically link your code (or bind by name) to this file, 
++     while you keep this file unmodified.
++*/
++
++#ifndef __LZFIND_H
++#define __LZFIND_H
++
++#include "Types.h"
++
++typedef UInt32 CLzRef;
++
++typedef struct _CMatchFinder
++{
++  Byte *buffer;
++  UInt32 pos;
++  UInt32 posLimit;
++  UInt32 streamPos;
++  UInt32 lenLimit;
++
++  UInt32 cyclicBufferPos;
++  UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
++
++  UInt32 matchMaxLen;
++  CLzRef *hash;
++  CLzRef *son;
++  UInt32 hashMask;
++  UInt32 cutValue;
++
++  Byte *bufferBase;
++  ISeqInStream *stream;
++  int streamEndWasReached;
++
++  UInt32 blockSize;
++  UInt32 keepSizeBefore;
++  UInt32 keepSizeAfter;
++
++  UInt32 numHashBytes;
++  int directInput;
++  int btMode;
++  /* int skipModeBits; */
++  int bigHash;
++  UInt32 historySize;
++  UInt32 fixedHashSize;
++  UInt32 hashSizeSum;
++  UInt32 numSons;
++  SRes result;
++  UInt32 crc[256];
++} CMatchFinder;
++
++#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
++#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
++
++#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
++
++int MatchFinder_NeedMove(CMatchFinder *p);
++Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
++void MatchFinder_MoveBlock(CMatchFinder *p);
++void MatchFinder_ReadIfRequired(CMatchFinder *p);
++
++void MatchFinder_Construct(CMatchFinder *p);
++
++/* Conditions:
++     historySize <= 3 GB
++     keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
++*/
++int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, 
++    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
++    ISzAlloc *alloc);
++void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
++void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
++void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
++
++UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son, 
++    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue, 
++    UInt32 *distances, UInt32 maxLen);
++
++/* 
++Conditions:
++  Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
++  Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
++*/
++
++typedef void (*Mf_Init_Func)(void *object);
++typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
++typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
++typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
++typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
++typedef void (*Mf_Skip_Func)(void *object, UInt32);
++
++typedef struct _IMatchFinder
++{
++  Mf_Init_Func Init;
++  Mf_GetIndexByte_Func GetIndexByte;
++  Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
++  Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
++  Mf_GetMatches_Func GetMatches;
++  Mf_Skip_Func Skip;
++} IMatchFinder;
++
++void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
++
++void MatchFinder_Init(CMatchFinder *p);
++UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
++UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
++void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
++void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
++
++#endif
+--- /dev/null
++++ b/include/linux/lzma/LzHash.h
+@@ -0,0 +1,56 @@
++/* LzHash.h  -- HASH functions for LZ algorithms
++2008-03-26
++Copyright (c) 1999-2008 Igor Pavlov
++Read LzFind.h for license options */
++
++#ifndef __LZHASH_H
++#define __LZHASH_H
++
++#define kHash2Size (1 << 10)
++#define kHash3Size (1 << 16)
++#define kHash4Size (1 << 20)
++
++#define kFix3HashSize (kHash2Size)
++#define kFix4HashSize (kHash2Size + kHash3Size)
++#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
++
++#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
++
++#define HASH3_CALC { \
++  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
++  hash2Value = temp & (kHash2Size - 1); \
++  hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
++
++#define HASH4_CALC { \
++  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
++  hash2Value = temp & (kHash2Size - 1); \
++  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
++  hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
++
++#define HASH5_CALC { \
++  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
++  hash2Value = temp & (kHash2Size - 1); \
++  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
++  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
++  hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
++  hash4Value &= (kHash4Size - 1); }
++
++/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
++#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
++
++
++#define MT_HASH2_CALC \
++  hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
++
++#define MT_HASH3_CALC { \
++  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
++  hash2Value = temp & (kHash2Size - 1); \
++  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
++
++#define MT_HASH4_CALC { \
++  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
++  hash2Value = temp & (kHash2Size - 1); \
++  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
++  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
++
++#endif
+--- /dev/null
++++ b/include/linux/lzma/LzmaDec.h
+@@ -0,0 +1,232 @@
++/* LzmaDec.h -- LZMA Decoder
++2008-04-29
++Copyright (c) 1999-2008 Igor Pavlov
++You can use any of the following license options:
++  1) GNU Lesser General Public License (GNU LGPL)
++  2) Common Public License (CPL)
++  3) Common Development and Distribution License (CDDL) Version 1.0 
++  4) Igor Pavlov, as the author of this code, expressly permits you to 
++     statically or dynamically link your code (or bind by name) to this file, 
++     while you keep this file unmodified.
++*/
++
++#ifndef __LZMADEC_H
++#define __LZMADEC_H
++
++#include "Types.h"
++
++/* #define _LZMA_PROB32 */
++/* _LZMA_PROB32 can increase the speed on some CPUs, 
++   but memory usage for CLzmaDec::probs will be doubled in that case */
++
++#ifdef _LZMA_PROB32
++#define CLzmaProb UInt32
++#else
++#define CLzmaProb UInt16
++#endif
++
++
++/* ---------- LZMA Properties ---------- */  
++
++#define LZMA_PROPS_SIZE 5
++
++typedef struct _CLzmaProps
++{
++  unsigned lc, lp, pb;
++  UInt32 dicSize;
++} CLzmaProps;
++
++/* LzmaProps_Decode - decodes properties
++Returns:
++  SZ_OK
++  SZ_ERROR_UNSUPPORTED - Unsupported properties
++*/
++
++SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
++
++
++/* ---------- LZMA Decoder state ---------- */  
++
++/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
++   Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
++
++#define LZMA_REQUIRED_INPUT_MAX 20
++
++typedef struct
++{
++  CLzmaProps prop;
++  CLzmaProb *probs;
++  Byte *dic;
++  const Byte *buf;
++  UInt32 range, code;
++  SizeT dicPos;
++  SizeT dicBufSize;
++  UInt32 processedPos;
++  UInt32 checkDicSize;
++  unsigned state;
++  UInt32 reps[4];
++  unsigned remainLen;
++  int needFlush;
++  int needInitState;
++  UInt32 numProbs;
++  unsigned tempBufSize;
++  Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
++} CLzmaDec;
++
++#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
++
++void LzmaDec_Init(CLzmaDec *p);
++
++/* There are two types of LZMA streams:
++     0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
++     1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
++
++typedef enum 
++{
++  LZMA_FINISH_ANY,   /* finish at any point */      
++  LZMA_FINISH_END    /* block must be finished at the end */
++} ELzmaFinishMode;
++
++/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
++
++   You must use LZMA_FINISH_END, when you know that current output buffer 
++   covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
++
++   If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
++   and output value of destLen will be less than output buffer size limit.
++   You can check status result also.
++
++   You can use multiple checks to test data integrity after full decompression:
++     1) Check Result and "status" variable.
++     2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
++     3) Check that output(srcLen) = compressedSize, if you know real compressedSize. 
++        You must use correct finish mode in that case. */ 
++
++typedef enum 
++{
++  LZMA_STATUS_NOT_SPECIFIED,               /* use main error code instead */
++  LZMA_STATUS_FINISHED_WITH_MARK,          /* stream was finished with end mark. */
++  LZMA_STATUS_NOT_FINISHED,                /* stream was not finished */
++  LZMA_STATUS_NEEDS_MORE_INPUT,            /* you must provide more input bytes */   
++  LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK  /* there is probability that stream was finished without end mark */
++} ELzmaStatus;
++
++/* ELzmaStatus is used only as output value for function call */
++
++
++/* ---------- Interfaces ---------- */  
++
++/* There are 3 levels of interfaces:
++     1) Dictionary Interface
++     2) Buffer Interface
++     3) One Call Interface
++   You can select any of these interfaces, but don't mix functions from different 
++   groups for same object. */
++
++
++/* There are two variants to allocate state for Dictionary Interface:
++     1) LzmaDec_Allocate / LzmaDec_Free
++     2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
++   You can use variant 2, if you set dictionary buffer manually. 
++   For Buffer Interface you must always use variant 1. 
++
++LzmaDec_Allocate* can return:
++  SZ_OK
++  SZ_ERROR_MEM         - Memory allocation error
++  SZ_ERROR_UNSUPPORTED - Unsupported properties
++*/
++   
++SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
++void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
++
++SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
++void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
++
++/* ---------- Dictionary Interface ---------- */  
++
++/* You can use it, if you want to eliminate the overhead for data copying from 
++   dictionary to some other external buffer.
++   You must work with CLzmaDec variables directly in this interface.
++
++   STEPS:
++     LzmaDec_Constr()
++     LzmaDec_Allocate()
++     for (each new stream)
++     {
++       LzmaDec_Init()
++       while (it needs more decompression)
++       {
++         LzmaDec_DecodeToDic()
++         use data from CLzmaDec::dic and update CLzmaDec::dicPos
++       }
++     }
++     LzmaDec_Free()
++*/
++
++/* LzmaDec_DecodeToDic
++   
++   The decoding to internal dictionary buffer (CLzmaDec::dic).
++   You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!! 
++
++finishMode:
++  It has meaning only if the decoding reaches output limit (dicLimit).
++  LZMA_FINISH_ANY - Decode just dicLimit bytes.
++  LZMA_FINISH_END - Stream must be finished after dicLimit.
++
++Returns:
++  SZ_OK
++    status:
++      LZMA_STATUS_FINISHED_WITH_MARK
++      LZMA_STATUS_NOT_FINISHED 
++      LZMA_STATUS_NEEDS_MORE_INPUT
++      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
++  SZ_ERROR_DATA - Data error
++*/
++
++SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, 
++    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
++
++
++/* ---------- Buffer Interface ---------- */  
++
++/* It's zlib-like interface.
++   See LzmaDec_DecodeToDic description for information about STEPS and return results,
++   but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
++   to work with CLzmaDec variables manually.
++
++finishMode: 
++  It has meaning only if the decoding reaches output limit (*destLen).
++  LZMA_FINISH_ANY - Decode just destLen bytes.
++  LZMA_FINISH_END - Stream must be finished after (*destLen).
++*/
++
++SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, 
++    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
++
++
++/* ---------- One Call Interface ---------- */  
++
++/* LzmaDecode
++
++finishMode:
++  It has meaning only if the decoding reaches output limit (*destLen).
++  LZMA_FINISH_ANY - Decode just destLen bytes.
++  LZMA_FINISH_END - Stream must be finished after (*destLen).
++
++Returns:
++  SZ_OK
++    status:
++      LZMA_STATUS_FINISHED_WITH_MARK
++      LZMA_STATUS_NOT_FINISHED 
++      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
++  SZ_ERROR_DATA - Data error
++  SZ_ERROR_MEM  - Memory allocation error
++  SZ_ERROR_UNSUPPORTED - Unsupported properties
++  SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
++*/
++
++SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
++    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, 
++    ELzmaStatus *status, ISzAlloc *alloc);
++
++#endif
+--- /dev/null
++++ b/include/linux/lzma/LzmaEnc.h
+@@ -0,0 +1,74 @@
++/*  LzmaEnc.h -- LZMA Encoder
++2008-04-27
++Copyright (c) 1999-2008 Igor Pavlov
++Read LzFind.h for license options */
++
++#ifndef __LZMAENC_H
++#define __LZMAENC_H
++
++#include "Types.h"
++
++#define LZMA_PROPS_SIZE 5
++
++typedef struct _CLzmaEncProps
++{
++  int level;       /*  0 <= level <= 9 */ 
++  UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
++                      (1 << 12) <= dictSize <= (1 << 30) for 64-bit version 
++                       default = (1 << 24) */
++  int lc;          /* 0 <= lc <= 8, default = 3 */ 
++  int lp;          /* 0 <= lp <= 4, default = 0 */ 
++  int pb;          /* 0 <= pb <= 4, default = 2 */ 
++  int algo;        /* 0 - fast, 1 - normal, default = 1 */
++  int fb;          /* 5 <= fb <= 273, default = 32 */
++  int btMode;      /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
++  int numHashBytes; /* 2, 3 or 4, default = 4 */
++  UInt32 mc;        /* 1 <= mc <= (1 << 30), default = 32 */
++  unsigned writeEndMark;  /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
++  int numThreads;  /* 1 or 2, default = 2 */
++} CLzmaEncProps;
++
++void LzmaEncProps_Init(CLzmaEncProps *p);
++void LzmaEncProps_Normalize(CLzmaEncProps *p);
++UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
++
++
++/* ---------- CLzmaEncHandle Interface ---------- */
++
++/* LzmaEnc_* functions can return the following exit codes:
++Returns:
++  SZ_OK           - OK
++  SZ_ERROR_MEM    - Memory allocation error 
++  SZ_ERROR_PARAM  - Incorrect paramater in props
++  SZ_ERROR_WRITE  - Write callback error.
++  SZ_ERROR_PROGRESS - some break from progress callback
++  SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
++*/
++
++typedef void * CLzmaEncHandle;
++
++CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
++void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
++SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
++SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
++SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, 
++    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
++SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
++    int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
++
++/* ---------- One Call Interface ---------- */
++
++/* LzmaEncode
++Return code:
++  SZ_OK               - OK
++  SZ_ERROR_MEM        - Memory allocation error 
++  SZ_ERROR_PARAM      - Incorrect paramater
++  SZ_ERROR_OUTPUT_EOF - output buffer overflow
++  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
++*/
++
++SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
++    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, 
++    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
++
++#endif
+--- /dev/null
++++ b/include/linux/lzma/Types.h
+@@ -0,0 +1,130 @@
++/* Types.h -- Basic types
++2008-04-11
++Igor Pavlov
++Public domain */
++
++#ifndef __7Z_TYPES_H
++#define __7Z_TYPES_H
++
++#define SZ_OK 0
++
++#define SZ_ERROR_DATA 1
++#define SZ_ERROR_MEM 2
++#define SZ_ERROR_CRC 3
++#define SZ_ERROR_UNSUPPORTED 4
++#define SZ_ERROR_PARAM 5
++#define SZ_ERROR_INPUT_EOF 6
++#define SZ_ERROR_OUTPUT_EOF 7
++#define SZ_ERROR_READ 8
++#define SZ_ERROR_WRITE 9
++#define SZ_ERROR_PROGRESS 10
++#define SZ_ERROR_FAIL 11
++#define SZ_ERROR_THREAD 12
++
++#define SZ_ERROR_ARCHIVE 16
++#define SZ_ERROR_NO_ARCHIVE 17
++
++typedef int SRes;
++
++#ifndef RINOK
++#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
++#endif
++
++typedef unsigned char Byte;
++typedef short Int16;
++typedef unsigned short UInt16;
++
++#ifdef _LZMA_UINT32_IS_ULONG
++typedef long Int32;
++typedef unsigned long UInt32;
++#else
++typedef int Int32;
++typedef unsigned int UInt32;
++#endif
++
++/* #define _SZ_NO_INT_64 */
++/* define it if your compiler doesn't support 64-bit integers */
++
++#ifdef _SZ_NO_INT_64
++
++typedef long Int64;
++typedef unsigned long UInt64;
++
++#else
++
++#if defined(_MSC_VER) || defined(__BORLANDC__)
++typedef __int64 Int64;
++typedef unsigned __int64 UInt64;
++#else
++typedef long long int Int64;
++typedef unsigned long long int UInt64;
++#endif
++
++#endif
++
++#ifdef _LZMA_NO_SYSTEM_SIZE_T
++typedef UInt32 SizeT;
++#else
++#include <stddef.h>
++typedef size_t SizeT;
++#endif
++
++typedef int Bool;
++#define True 1
++#define False 0
++
++
++#ifdef _MSC_VER
++
++#if _MSC_VER >= 1300
++#define MY_NO_INLINE __declspec(noinline)
++#else
++#define MY_NO_INLINE
++#endif
++
++#define MY_CDECL __cdecl
++#define MY_STD_CALL __stdcall 
++#define MY_FAST_CALL MY_NO_INLINE __fastcall 
++
++#else
++
++#define MY_CDECL
++#define MY_STD_CALL
++#define MY_FAST_CALL
++
++#endif
++
++
++/* The following interfaces use first parameter as pointer to structure */
++
++typedef struct
++{
++  SRes (*Read)(void *p, void *buf, size_t *size);
++    /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
++       (output(*size) < input(*size)) is allowed */
++} ISeqInStream;
++
++typedef struct
++{
++  size_t (*Write)(void *p, const void *buf, size_t size);
++    /* Returns: result - the number of actually written bytes.
++      (result < size) means error */
++} ISeqOutStream;
++
++typedef struct
++{
++  SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
++    /* Returns: result. (result != SZ_OK) means break.
++       Value (UInt64)(Int64)-1 for size means unknown value. */
++} ICompressProgress;
++
++typedef struct
++{
++  void *(*Alloc)(void *p, size_t size);
++  void (*Free)(void *p, void *address); /* address can be 0 */
++} ISzAlloc;
++
++#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
++#define IAlloc_Free(p, a) (p)->Free((p), a)
++
++#endif
+--- /dev/null
++++ b/lzma/LzFind.c
+@@ -0,0 +1,753 @@
++/* LzFind.c  -- Match finder for LZ algorithms
++2008-04-04
++Copyright (c) 1999-2008 Igor Pavlov
++Read LzFind.h for license options */
++
++#include <string.h>
++
++#include "LzFind.h"
++#include "LzHash.h"
++
++#define kEmptyHashValue 0
++#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
++#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
++#define kNormalizeMask (~(kNormalizeStepMin - 1))
++#define kMaxHistorySize ((UInt32)3 << 30)
++
++#define kStartMaxLen 3
++
++static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
++{
++  if (!p->directInput)
++  {
++    alloc->Free(alloc, p->bufferBase);
++    p->bufferBase = 0;
++  }
++}
++
++/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
++
++static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
++{
++  UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
++  if (p->directInput)
++  {
++    p->blockSize = blockSize;
++    return 1;
++  }
++  if (p->bufferBase == 0 || p->blockSize != blockSize)
++  {
++    LzInWindow_Free(p, alloc);
++    p->blockSize = blockSize;
++    p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
++  }
++  return (p->bufferBase != 0);
++}
++
++Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
++Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
++
++UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
++
++void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
++{
++  p->posLimit -= subValue;
++  p->pos -= subValue;
++  p->streamPos -= subValue;
++}
++
++static void MatchFinder_ReadBlock(CMatchFinder *p)
++{
++  if (p->streamEndWasReached || p->result != SZ_OK)
++    return;
++  for (;;)
++  {
++    Byte *dest = p->buffer + (p->streamPos - p->pos);
++    size_t size = (p->bufferBase + p->blockSize - dest);
++    if (size == 0)
++      return;
++    p->result = p->stream->Read(p->stream, dest, &size);
++    if (p->result != SZ_OK)
++      return;
++    if (size == 0)
++    {
++      p->streamEndWasReached = 1;
++      return;
++    }
++    p->streamPos += (UInt32)size;
++    if (p->streamPos - p->pos > p->keepSizeAfter)
++      return;
++  }
++}
++
++void MatchFinder_MoveBlock(CMatchFinder *p)
++{
++  memmove(p->bufferBase, 
++    p->buffer - p->keepSizeBefore, 
++    (size_t)(p->streamPos - p->pos + p->keepSizeBefore));
++  p->buffer = p->bufferBase + p->keepSizeBefore;
++}
++
++int MatchFinder_NeedMove(CMatchFinder *p)
++{
++  /* if (p->streamEndWasReached) return 0; */
++  return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
++}
++
++void MatchFinder_ReadIfRequired(CMatchFinder *p)
++{
++  if (p->streamEndWasReached) 
++    return;
++  if (p->keepSizeAfter >= p->streamPos - p->pos)
++    MatchFinder_ReadBlock(p);
++}
++
++static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
++{
++  if (MatchFinder_NeedMove(p))
++    MatchFinder_MoveBlock(p);
++  MatchFinder_ReadBlock(p);
++}
++
++static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
++{
++  p->cutValue = 32;
++  p->btMode = 1;
++  p->numHashBytes = 4;
++  /* p->skipModeBits = 0; */
++  p->directInput = 0;
++  p->bigHash = 0;
++}
++
++#define kCrcPoly 0xEDB88320
++
++void MatchFinder_Construct(CMatchFinder *p)
++{
++  UInt32 i;
++  p->bufferBase = 0;
++  p->directInput = 0;
++  p->hash = 0;
++  MatchFinder_SetDefaultSettings(p);
++
++  for (i = 0; i < 256; i++)
++  {
++    UInt32 r = i;
++    int j;
++    for (j = 0; j < 8; j++)
++      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
++    p->crc[i] = r;
++  }
++}
++
++static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
++{
++  alloc->Free(alloc, p->hash);
++  p->hash = 0;
++}
++
++void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
++{
++  MatchFinder_FreeThisClassMemory(p, alloc);
++  LzInWindow_Free(p, alloc);
++}
++
++static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
++{
++  size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
++  if (sizeInBytes / sizeof(CLzRef) != num)
++    return 0;
++  return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
++}
++
++int MatchFinder_Create(CMatchFinder *p, UInt32 historySize, 
++    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
++    ISzAlloc *alloc)
++{
++  UInt32 sizeReserv;
++  if (historySize > kMaxHistorySize)
++  {
++    MatchFinder_Free(p, alloc);
++    return 0;
++  }
++  sizeReserv = historySize >> 1;
++  if (historySize > ((UInt32)2 << 30))
++    sizeReserv = historySize >> 2;
++  sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
++
++  p->keepSizeBefore = historySize + keepAddBufferBefore + 1; 
++  p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
++  /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
++  if (LzInWindow_Create(p, sizeReserv, alloc))
++  {
++    UInt32 newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1;
++    UInt32 hs;
++    p->matchMaxLen = matchMaxLen;
++    {
++      p->fixedHashSize = 0;
++      if (p->numHashBytes == 2)
++        hs = (1 << 16) - 1;
++      else
++      {
++        hs = historySize - 1;
++        hs |= (hs >> 1);
++        hs |= (hs >> 2);
++        hs |= (hs >> 4);
++        hs |= (hs >> 8);
++        hs >>= 1;
++        /* hs >>= p->skipModeBits; */
++        hs |= 0xFFFF; /* don't change it! It's required for Deflate */
++        if (hs > (1 << 24))
++        {
++          if (p->numHashBytes == 3)
++            hs = (1 << 24) - 1;
++          else
++            hs >>= 1;
++        }
++      }
++      p->hashMask = hs;
++      hs++;
++      if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
++      if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
++      if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
++      hs += p->fixedHashSize;
++    }
++
++    {
++      UInt32 prevSize = p->hashSizeSum + p->numSons;
++      UInt32 newSize;
++      p->historySize = historySize;
++      p->hashSizeSum = hs;
++      p->cyclicBufferSize = newCyclicBufferSize;
++      p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
++      newSize = p->hashSizeSum + p->numSons;
++      if (p->hash != 0 && prevSize == newSize)
++        return 1;
++      MatchFinder_FreeThisClassMemory(p, alloc);
++      p->hash = AllocRefs(newSize, alloc);
++      if (p->hash != 0)
++      {
++        p->son = p->hash + p->hashSizeSum;
++        return 1;
++      }
++    }
++  }
++  MatchFinder_Free(p, alloc);
++  return 0;
++}
++
++static void MatchFinder_SetLimits(CMatchFinder *p)
++{
++  UInt32 limit = kMaxValForNormalize - p->pos;
++  UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
++  if (limit2 < limit) 
++    limit = limit2;
++  limit2 = p->streamPos - p->pos;
++  if (limit2 <= p->keepSizeAfter)
++  {
++    if (limit2 > 0)
++      limit2 = 1;
++  }
++  else
++    limit2 -= p->keepSizeAfter;
++  if (limit2 < limit) 
++    limit = limit2;
++  {
++    UInt32 lenLimit = p->streamPos - p->pos;
++    if (lenLimit > p->matchMaxLen)
++      lenLimit = p->matchMaxLen;
++    p->lenLimit = lenLimit;
++  }
++  p->posLimit = p->pos + limit;
++}
++
++void MatchFinder_Init(CMatchFinder *p)
++{
++  UInt32 i;
++  for(i = 0; i < p->hashSizeSum; i++)
++    p->hash[i] = kEmptyHashValue;
++  p->cyclicBufferPos = 0;
++  p->buffer = p->bufferBase;
++  p->pos = p->streamPos = p->cyclicBufferSize;
++  p->result = SZ_OK;
++  p->streamEndWasReached = 0;
++  MatchFinder_ReadBlock(p);
++  MatchFinder_SetLimits(p);
++}
++
++static UInt32 MatchFinder_GetSubValue(CMatchFinder *p) 
++{ 
++  return (p->pos - p->historySize - 1) & kNormalizeMask; 
++}
++
++void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
++{
++  UInt32 i;
++  for (i = 0; i < numItems; i++)
++  {
++    UInt32 value = items[i];
++    if (value <= subValue)
++      value = kEmptyHashValue;
++    else
++      value -= subValue;
++    items[i] = value;
++  }
++}
++
++static void MatchFinder_Normalize(CMatchFinder *p)
++{
++  UInt32 subValue = MatchFinder_GetSubValue(p);
++  MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
++  MatchFinder_ReduceOffsets(p, subValue);
++}
++
++static void MatchFinder_CheckLimits(CMatchFinder *p)
++{
++  if (p->pos == kMaxValForNormalize)
++    MatchFinder_Normalize(p);
++  if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
++    MatchFinder_CheckAndMoveAndRead(p);
++  if (p->cyclicBufferPos == p->cyclicBufferSize)
++    p->cyclicBufferPos = 0;
++  MatchFinder_SetLimits(p);
++}
++
++static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, 
++    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, 
++    UInt32 *distances, UInt32 maxLen)
++{
++  son[_cyclicBufferPos] = curMatch;
++  for (;;)
++  {
++    UInt32 delta = pos - curMatch;
++    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
++      return distances;
++    {
++      const Byte *pb = cur - delta;
++      curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
++      if (pb[maxLen] == cur[maxLen] && *pb == *cur)
++      {
++        UInt32 len = 0;
++        while(++len != lenLimit)
++          if (pb[len] != cur[len])
++            break;
++        if (maxLen < len)
++        {
++          *distances++ = maxLen = len;
++          *distances++ = delta - 1;
++          if (len == lenLimit)
++            return distances;
++        }
++      }
++    }
++  }
++}
++
++UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, 
++    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue, 
++    UInt32 *distances, UInt32 maxLen)
++{
++  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
++  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
++  UInt32 len0 = 0, len1 = 0;
++  for (;;)
++  {
++    UInt32 delta = pos - curMatch;
++    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
++    {
++      *ptr0 = *ptr1 = kEmptyHashValue;
++      return distances;
++    }
++    {
++      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
++      const Byte *pb = cur - delta;
++      UInt32 len = (len0 < len1 ? len0 : len1);
++      if (pb[len] == cur[len])
++      {
++        if (++len != lenLimit && pb[len] == cur[len])
++          while(++len != lenLimit)
++            if (pb[len] != cur[len])
++              break;
++        if (maxLen < len)
++        {
++          *distances++ = maxLen = len;
++          *distances++ = delta - 1;
++          if (len == lenLimit)
++          {
++            *ptr1 = pair[0];
++            *ptr0 = pair[1];
++            return distances;
++          }
++        }
++      }
++      if (pb[len] < cur[len])
++      {
++        *ptr1 = curMatch;
++        ptr1 = pair + 1;
++        curMatch = *ptr1;
++        len1 = len;
++      }
++      else
++      {
++        *ptr0 = curMatch;
++        ptr0 = pair;
++        curMatch = *ptr0;
++        len0 = len;
++      }
++    }
++  }
++}
++
++static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son, 
++    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
++{
++  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
++  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
++  UInt32 len0 = 0, len1 = 0;
++  for (;;)
++  {
++    UInt32 delta = pos - curMatch;
++    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
++    {
++      *ptr0 = *ptr1 = kEmptyHashValue;
++      return;
++    }
++    {
++      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
++      const Byte *pb = cur - delta;
++      UInt32 len = (len0 < len1 ? len0 : len1);
++      if (pb[len] == cur[len])
++      {
++        while(++len != lenLimit)
++          if (pb[len] != cur[len])
++            break;
++        {
++          if (len == lenLimit)
++          {
++            *ptr1 = pair[0];
++            *ptr0 = pair[1];
++            return;
++          }
++        }
++      }
++      if (pb[len] < cur[len])
++      {
++        *ptr1 = curMatch;
++        ptr1 = pair + 1;
++        curMatch = *ptr1;
++        len1 = len;
++      }
++      else
++      {
++        *ptr0 = curMatch;
++        ptr0 = pair;
++        curMatch = *ptr0;
++        len0 = len;
++      }
++    }
++  }
++}
++
++#define MOVE_POS \
++  ++p->cyclicBufferPos; \
++  p->buffer++; \
++  if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
++
++#define MOVE_POS_RET MOVE_POS return offset;
++
++static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
++
++#define GET_MATCHES_HEADER2(minLen, ret_op) \
++  UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
++  lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
++  cur = p->buffer;
++
++#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
++#define SKIP_HEADER(minLen)        GET_MATCHES_HEADER2(minLen, continue)
++
++#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
++
++#define GET_MATCHES_FOOTER(offset, maxLen) \
++  offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
++  distances + offset, maxLen) - distances); MOVE_POS_RET;
++
++#define SKIP_FOOTER \
++  SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
++
++static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++{
++  UInt32 offset;
++  GET_MATCHES_HEADER(2)
++  HASH2_CALC;
++  curMatch = p->hash[hashValue];
++  p->hash[hashValue] = p->pos;
++  offset = 0;
++  GET_MATCHES_FOOTER(offset, 1)
++}
++
++UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++{
++  UInt32 offset;
++  GET_MATCHES_HEADER(3)
++  HASH_ZIP_CALC;
++  curMatch = p->hash[hashValue];
++  p->hash[hashValue] = p->pos;
++  offset = 0;
++  GET_MATCHES_FOOTER(offset, 2)
++}
++
++static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++{
++  UInt32 hash2Value, delta2, maxLen, offset;
++  GET_MATCHES_HEADER(3)
++
++  HASH3_CALC;
++
++  delta2 = p->pos - p->hash[hash2Value];
++  curMatch = p->hash[kFix3HashSize + hashValue];
++  
++  p->hash[hash2Value] = 
++  p->hash[kFix3HashSize + hashValue] = p->pos;
++
++
++  maxLen = 2;
++  offset = 0;
++  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
++  {
++    for (; maxLen != lenLimit; maxLen++)
++      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
++        break;
++    distances[0] = maxLen;
++    distances[1] = delta2 - 1;
++    offset = 2;
++    if (maxLen == lenLimit)
++    {
++      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
++      MOVE_POS_RET; 
++    }
++  }
++  GET_MATCHES_FOOTER(offset, maxLen)
++}
++
++static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++{
++  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
++  GET_MATCHES_HEADER(4)
++
++  HASH4_CALC;
++
++  delta2 = p->pos - p->hash[                hash2Value];
++  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
++  curMatch = p->hash[kFix4HashSize + hashValue];
++  
++  p->hash[                hash2Value] =
++  p->hash[kFix3HashSize + hash3Value] =
++  p->hash[kFix4HashSize + hashValue] = p->pos;
++
++  maxLen = 1;
++  offset = 0;
++  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
++  {
++    distances[0] = maxLen = 2;
++    distances[1] = delta2 - 1;
++    offset = 2;
++  }
++  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
++  {
++    maxLen = 3;
++    distances[offset + 1] = delta3 - 1;
++    offset += 2;
++    delta2 = delta3;
++  }
++  if (offset != 0)
++  {
++    for (; maxLen != lenLimit; maxLen++)
++      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
++        break;
++    distances[offset - 2] = maxLen;
++    if (maxLen == lenLimit)
++    {
++      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
++      MOVE_POS_RET; 
++    }
++  }
++  if (maxLen < 3)
++    maxLen = 3;
++  GET_MATCHES_FOOTER(offset, maxLen)
++}
++
++static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++{
++  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
++  GET_MATCHES_HEADER(4)
++
++  HASH4_CALC;
++
++  delta2 = p->pos - p->hash[                hash2Value];
++  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
++  curMatch = p->hash[kFix4HashSize + hashValue];
++
++  p->hash[                hash2Value] =
++  p->hash[kFix3HashSize + hash3Value] =
++  p->hash[kFix4HashSize + hashValue] = p->pos;
++
++  maxLen = 1;
++  offset = 0;
++  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
++  {
++    distances[0] = maxLen = 2;
++    distances[1] = delta2 - 1;
++    offset = 2;
++  }
++  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
++  {
++    maxLen = 3;
++    distances[offset + 1] = delta3 - 1;
++    offset += 2;
++    delta2 = delta3;
++  }
++  if (offset != 0)
++  {
++    for (; maxLen != lenLimit; maxLen++)
++      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
++        break;
++    distances[offset - 2] = maxLen;
++    if (maxLen == lenLimit)
++    {
++      p->son[p->cyclicBufferPos] = curMatch;
++      MOVE_POS_RET; 
++    }
++  }
++  if (maxLen < 3)
++    maxLen = 3;
++  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
++    distances + offset, maxLen) - (distances));
++  MOVE_POS_RET
++}
++
++UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++{
++  UInt32 offset;
++  GET_MATCHES_HEADER(3)
++  HASH_ZIP_CALC;
++  curMatch = p->hash[hashValue];
++  p->hash[hashValue] = p->pos;
++  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
++    distances, 2) - (distances));
++  MOVE_POS_RET
++}
++
++static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++{
++  do
++  {
++    SKIP_HEADER(2) 
++    HASH2_CALC;
++    curMatch = p->hash[hashValue];
++    p->hash[hashValue] = p->pos;
++    SKIP_FOOTER
++  }
++  while (--num != 0);
++}
++
++void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++{
++  do
++  {
++    SKIP_HEADER(3)
++    HASH_ZIP_CALC;
++    curMatch = p->hash[hashValue];
++    p->hash[hashValue] = p->pos;
++    SKIP_FOOTER
++  }
++  while (--num != 0);
++}
++
++static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++{
++  do
++  {
++    UInt32 hash2Value;
++    SKIP_HEADER(3)
++    HASH3_CALC;
++    curMatch = p->hash[kFix3HashSize + hashValue];
++    p->hash[hash2Value] =
++    p->hash[kFix3HashSize + hashValue] = p->pos;
++    SKIP_FOOTER
++  }
++  while (--num != 0);
++}
++
++static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++{
++  do
++  {
++    UInt32 hash2Value, hash3Value;
++    SKIP_HEADER(4) 
++    HASH4_CALC;
++    curMatch = p->hash[kFix4HashSize + hashValue];
++    p->hash[                hash2Value] =
++    p->hash[kFix3HashSize + hash3Value] = p->pos;
++    p->hash[kFix4HashSize + hashValue] = p->pos;
++    SKIP_FOOTER
++  }
++  while (--num != 0);
++}
++
++static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++{
++  do
++  {
++    UInt32 hash2Value, hash3Value;
++    SKIP_HEADER(4)
++    HASH4_CALC;
++    curMatch = p->hash[kFix4HashSize + hashValue];
++    p->hash[                hash2Value] =
++    p->hash[kFix3HashSize + hash3Value] =
++    p->hash[kFix4HashSize + hashValue] = p->pos;
++    p->son[p->cyclicBufferPos] = curMatch;
++    MOVE_POS
++  }
++  while (--num != 0);
++}
++
++void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++{
++  do
++  {
++    SKIP_HEADER(3)
++    HASH_ZIP_CALC;
++    curMatch = p->hash[hashValue];
++    p->hash[hashValue] = p->pos;
++    p->son[p->cyclicBufferPos] = curMatch;
++    MOVE_POS
++  }
++  while (--num != 0);
++}
++
++void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
++{
++  vTable->Init = (Mf_Init_Func)MatchFinder_Init;
++  vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
++  vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
++  vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
++  if (!p->btMode)
++  {
++    vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
++    vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
++  }
++  else if (p->numHashBytes == 2)
++  {
++    vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
++    vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
++  }
++  else if (p->numHashBytes == 3)
++  {
++    vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
++    vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
++  }
++  else
++  {
++    vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
++    vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
++  }
++}
+--- /dev/null
++++ b/lzma/LzmaDec.c
+@@ -0,0 +1,1014 @@
++/* LzmaDec.c -- LZMA Decoder
++2008-04-29
++Copyright (c) 1999-2008 Igor Pavlov
++Read LzmaDec.h for license options */
++
++#include "LzmaDec.h"
++
++#include <string.h>
++
++#define kNumTopBits 24
++#define kTopValue ((UInt32)1 << kNumTopBits)
++
++#define kNumBitModelTotalBits 11
++#define kBitModelTotal (1 << kNumBitModelTotalBits)
++#define kNumMoveBits 5
++
++#define RC_INIT_SIZE 5
++
++#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
++
++#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
++#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
++#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
++#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
++  { UPDATE_0(p); i = (i + i); A0; } else \
++  { UPDATE_1(p); i = (i + i) + 1; A1; } 
++#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)               
++
++#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
++#define TREE_DECODE(probs, limit, i) \
++  { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
++
++/* #define _LZMA_SIZE_OPT */
++
++#ifdef _LZMA_SIZE_OPT
++#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
++#else
++#define TREE_6_DECODE(probs, i) \
++  { i = 1; \
++  TREE_GET_BIT(probs, i); \
++  TREE_GET_BIT(probs, i); \
++  TREE_GET_BIT(probs, i); \
++  TREE_GET_BIT(probs, i); \
++  TREE_GET_BIT(probs, i); \
++  TREE_GET_BIT(probs, i); \
++  i -= 0x40; }
++#endif
++
++#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
++
++#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
++#define UPDATE_0_CHECK range = bound;
++#define UPDATE_1_CHECK range -= bound; code -= bound;
++#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
++  { UPDATE_0_CHECK; i = (i + i); A0; } else \
++  { UPDATE_1_CHECK; i = (i + i) + 1; A1; } 
++#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)               
++#define TREE_DECODE_CHECK(probs, limit, i) \
++  { i = 1; do { GET_BIT_CHECK(probs + i, i) } while(i < limit); i -= limit; }
++
++
++#define kNumPosBitsMax 4
++#define kNumPosStatesMax (1 << kNumPosBitsMax)
++
++#define kLenNumLowBits 3
++#define kLenNumLowSymbols (1 << kLenNumLowBits)
++#define kLenNumMidBits 3
++#define kLenNumMidSymbols (1 << kLenNumMidBits)
++#define kLenNumHighBits 8
++#define kLenNumHighSymbols (1 << kLenNumHighBits)
++
++#define LenChoice 0
++#define LenChoice2 (LenChoice + 1)
++#define LenLow (LenChoice2 + 1)
++#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
++#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
++#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
++
++
++#define kNumStates 12
++#define kNumLitStates 7
++
++#define kStartPosModelIndex 4
++#define kEndPosModelIndex 14
++#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
++
++#define kNumPosSlotBits 6
++#define kNumLenToPosStates 4
++
++#define kNumAlignBits 4
++#define kAlignTableSize (1 << kNumAlignBits)
++
++#define kMatchMinLen 2
++#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
++
++#define IsMatch 0
++#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
++#define IsRepG0 (IsRep + kNumStates)
++#define IsRepG1 (IsRepG0 + kNumStates)
++#define IsRepG2 (IsRepG1 + kNumStates)
++#define IsRep0Long (IsRepG2 + kNumStates)
++#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
++#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
++#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
++#define LenCoder (Align + kAlignTableSize)
++#define RepLenCoder (LenCoder + kNumLenProbs)
++#define Literal (RepLenCoder + kNumLenProbs)
++
++#define LZMA_BASE_SIZE 1846
++#define LZMA_LIT_SIZE 768
++
++#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
++
++#if Literal != LZMA_BASE_SIZE
++StopCompilingDueBUG
++#endif
++
++/*
++#define LZMA_STREAM_WAS_FINISHED_ID (-1)
++#define LZMA_SPEC_LEN_OFFSET (-3)
++*/
++
++Byte kLiteralNextStates[kNumStates * 2] = 
++{
++  0, 0, 0, 0, 1, 2, 3,  4,  5,  6,  4,  5, 
++  7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10
++};
++
++#define LZMA_DIC_MIN (1 << 12)
++
++/* First LZMA-symbol is always decoded. 
++And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization 
++Out:
++  Result:
++    0 - OK
++    1 - Error
++  p->remainLen:
++    < kMatchSpecLenStart : normal remain
++    = kMatchSpecLenStart : finished
++    = kMatchSpecLenStart + 1 : Flush marker
++    = kMatchSpecLenStart + 2 : State Init Marker
++*/
++
++static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
++{
++  CLzmaProb *probs = p->probs;
++
++  unsigned state = p->state;
++  UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
++  unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
++  unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
++  unsigned lc = p->prop.lc;
++
++  Byte *dic = p->dic;
++  SizeT dicBufSize = p->dicBufSize;
++  SizeT dicPos = p->dicPos;
++  
++  UInt32 processedPos = p->processedPos;
++  UInt32 checkDicSize = p->checkDicSize;
++  unsigned len = 0;
++
++  const Byte *buf = p->buf;
++  UInt32 range = p->range;
++  UInt32 code = p->code;
++
++  do
++  {
++    CLzmaProb *prob;
++    UInt32 bound;
++    unsigned ttt;
++    unsigned posState = processedPos & pbMask;
++
++    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
++    IF_BIT_0(prob)
++    {
++      unsigned symbol;
++      UPDATE_0(prob);
++      prob = probs + Literal;
++      if (checkDicSize != 0 || processedPos != 0)
++        prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) + 
++        (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
++
++      if (state < kNumLitStates)
++      {
++        symbol = 1;
++        do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
++      }
++      else
++      {
++        unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
++        unsigned offs = 0x100;
++        symbol = 1;
++        do
++        {
++          unsigned bit;
++          CLzmaProb *probLit;
++          matchByte <<= 1;
++          bit = (matchByte & offs);
++          probLit = prob + offs + bit + symbol;
++          GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
++        }
++        while (symbol < 0x100);
++      }
++      dic[dicPos++] = (Byte)symbol;
++      processedPos++;
++
++      state = kLiteralNextStates[state];
++      /* if (state < 4) state = 0; else if (state < 10) state -= 3; else state -= 6; */
++      continue;
++    }
++    else             
++    {
++      UPDATE_1(prob);
++      prob = probs + IsRep + state;
++      IF_BIT_0(prob)
++      {
++        UPDATE_0(prob);
++        state += kNumStates;
++        prob = probs + LenCoder;
++      }
++      else
++      {
++        UPDATE_1(prob);
++        if (checkDicSize == 0 && processedPos == 0)
++          return SZ_ERROR_DATA;
++        prob = probs + IsRepG0 + state;
++        IF_BIT_0(prob)
++        {
++          UPDATE_0(prob);
++          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
++          IF_BIT_0(prob)
++          {
++            UPDATE_0(prob);
++            dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
++            dicPos++;
++            processedPos++;
++            state = state < kNumLitStates ? 9 : 11;
++            continue;
++          }
++          UPDATE_1(prob);
++        }
++        else
++        {
++          UInt32 distance;
++          UPDATE_1(prob);
++          prob = probs + IsRepG1 + state;
++          IF_BIT_0(prob)
++          {
++            UPDATE_0(prob);
++            distance = rep1;
++          }
++          else 
++          {
++            UPDATE_1(prob);
++            prob = probs + IsRepG2 + state;
++            IF_BIT_0(prob)
++            {
++              UPDATE_0(prob);
++              distance = rep2;
++            }
++            else
++            {
++              UPDATE_1(prob);
++              distance = rep3;
++              rep3 = rep2;
++            }
++            rep2 = rep1;
++          }
++          rep1 = rep0;
++          rep0 = distance;
++        }
++        state = state < kNumLitStates ? 8 : 11;
++        prob = probs + RepLenCoder;
++      }
++      {
++        unsigned limit, offset;
++        CLzmaProb *probLen = prob + LenChoice;
++        IF_BIT_0(probLen)
++        {
++          UPDATE_0(probLen);
++          probLen = prob + LenLow + (posState << kLenNumLowBits);
++          offset = 0;
++          limit = (1 << kLenNumLowBits);
++        }
++        else
++        {
++          UPDATE_1(probLen);
++          probLen = prob + LenChoice2;
++          IF_BIT_0(probLen)
++          {
++            UPDATE_0(probLen);
++            probLen = prob + LenMid + (posState << kLenNumMidBits);
++            offset = kLenNumLowSymbols;
++            limit = (1 << kLenNumMidBits);
++          }
++          else
++          {
++            UPDATE_1(probLen);
++            probLen = prob + LenHigh;
++            offset = kLenNumLowSymbols + kLenNumMidSymbols;
++            limit = (1 << kLenNumHighBits);
++          }
++        }
++        TREE_DECODE(probLen, limit, len);
++        len += offset;
++      }
++
++      if (state >= kNumStates)
++      {
++        UInt32 distance;
++        prob = probs + PosSlot +
++            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
++        TREE_6_DECODE(prob, distance);
++        if (distance >= kStartPosModelIndex)
++        {
++          unsigned posSlot = (unsigned)distance; 
++          int numDirectBits = (int)(((distance >> 1) - 1));
++          distance = (2 | (distance & 1));
++          if (posSlot < kEndPosModelIndex)
++          {
++            distance <<= numDirectBits;
++            prob = probs + SpecPos + distance - posSlot - 1;
++            {
++              UInt32 mask = 1;
++              unsigned i = 1;
++              do
++              {
++                GET_BIT2(prob + i, i, ; , distance |= mask);
++                mask <<= 1;
++              }
++              while(--numDirectBits != 0);
++            }
++          }
++          else
++          {
++            numDirectBits -= kNumAlignBits;
++            do
++            {
++              NORMALIZE
++              range >>= 1;
++              
++              {
++                UInt32 t;
++                code -= range;
++                t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
++                distance = (distance << 1) + (t + 1);
++                code += range & t;
++              }
++              /*
++              distance <<= 1;
++              if (code >= range)
++              {
++                code -= range;
++                distance |= 1;
++              }
++              */
++            }
++            while (--numDirectBits != 0);
++            prob = probs + Align;
++            distance <<= kNumAlignBits;
++            {
++              unsigned i = 1;
++              GET_BIT2(prob + i, i, ; , distance |= 1);
++              GET_BIT2(prob + i, i, ; , distance |= 2);
++              GET_BIT2(prob + i, i, ; , distance |= 4);
++              GET_BIT2(prob + i, i, ; , distance |= 8);
++            }
++            if (distance == (UInt32)0xFFFFFFFF)
++            {
++              len += kMatchSpecLenStart;
++              state -= kNumStates;
++              break;
++            }
++          }
++        }
++        rep3 = rep2;
++        rep2 = rep1;
++        rep1 = rep0;
++        rep0 = distance + 1; 
++        if (checkDicSize == 0)
++        {
++          if (distance >= processedPos)
++            return SZ_ERROR_DATA;
++        }
++        else if (distance >= checkDicSize)
++          return SZ_ERROR_DATA;
++        state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
++        /* state = kLiteralNextStates[state]; */
++      }
++
++      len += kMatchMinLen;
++
++      {
++        SizeT rem = limit - dicPos;
++        unsigned curLen = ((rem < len) ? (unsigned)rem : len);
++        SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
++
++        processedPos += curLen;
++
++        len -= curLen;
++        if (pos + curLen <= dicBufSize)
++        {
++          Byte *dest = dic + dicPos;
++          ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
++          const Byte *lim = dest + curLen;
++          dicPos += curLen;
++          do 
++            *(dest) = (Byte)*(dest + src); 
++          while (++dest != lim);
++        }
++        else
++        {
++          do
++          {
++            dic[dicPos++] = dic[pos];
++            if (++pos == dicBufSize)
++              pos = 0;
++          }
++          while (--curLen != 0);
++        }
++      }
++    }
++  }
++  while (dicPos < limit && buf < bufLimit);
++  NORMALIZE;
++  p->buf = buf;
++  p->range = range;
++  p->code = code;
++  p->remainLen = len;
++  p->dicPos = dicPos;
++  p->processedPos = processedPos;
++  p->reps[0] = rep0;
++  p->reps[1] = rep1;
++  p->reps[2] = rep2;
++  p->reps[3] = rep3;
++  p->state = state;
++
++  return SZ_OK;
++}
++
++static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
++{
++  if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
++  {
++    Byte *dic = p->dic;
++    SizeT dicPos = p->dicPos;
++    SizeT dicBufSize = p->dicBufSize;
++    unsigned len = p->remainLen;
++    UInt32 rep0 = p->reps[0];
++    if (limit - dicPos < len)
++      len = (unsigned)(limit - dicPos);
++
++    if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
++      p->checkDicSize = p->prop.dicSize;
++
++    p->processedPos += len;
++    p->remainLen -= len;
++    while (len-- != 0)
++    {
++      dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
++      dicPos++;
++    }
++    p->dicPos = dicPos;
++  }
++}
++
++/* LzmaDec_DecodeReal2 decodes LZMA-symbols and sets p->needFlush and p->needInit, if required. */
++
++static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
++{
++  do
++  {
++    SizeT limit2 = limit;
++    if (p->checkDicSize == 0)
++    {
++      UInt32 rem = p->prop.dicSize - p->processedPos;
++      if (limit - p->dicPos > rem)
++        limit2 = p->dicPos + rem;
++    }
++    RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
++    if (p->processedPos >= p->prop.dicSize)
++      p->checkDicSize = p->prop.dicSize;
++    LzmaDec_WriteRem(p, limit);
++  }
++  while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
++
++  if (p->remainLen > kMatchSpecLenStart)
++  {
++    p->remainLen = kMatchSpecLenStart;
++  }
++  return 0;
++}
++
++typedef enum 
++{
++  DUMMY_ERROR, /* unexpected end of input stream */
++  DUMMY_LIT,
++  DUMMY_MATCH,
++  DUMMY_REP
++} ELzmaDummy;
++
++static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
++{
++  UInt32 range = p->range;
++  UInt32 code = p->code;
++  const Byte *bufLimit = buf + inSize;
++  CLzmaProb *probs = p->probs;
++  unsigned state = p->state;
++  ELzmaDummy res;
++
++  {
++    CLzmaProb *prob;
++    UInt32 bound;
++    unsigned ttt;
++    unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
++
++    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
++    IF_BIT_0_CHECK(prob)
++    {
++      UPDATE_0_CHECK
++
++      /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
++
++      prob = probs + Literal;
++      if (p->checkDicSize != 0 || p->processedPos != 0)
++        prob += (LZMA_LIT_SIZE * 
++          ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) + 
++          (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
++
++      if (state < kNumLitStates)
++      {
++        unsigned symbol = 1;
++        do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
++      }
++      else
++      {
++        unsigned matchByte = p->dic[p->dicPos - p->reps[0] + 
++            ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
++        unsigned offs = 0x100;
++        unsigned symbol = 1;
++        do
++        {
++          unsigned bit;
++          CLzmaProb *probLit;
++          matchByte <<= 1;
++          bit = (matchByte & offs);
++          probLit = prob + offs + bit + symbol;
++          GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
++        }
++        while (symbol < 0x100);
++      }
++      res = DUMMY_LIT;
++    }
++    else             
++    {
++      unsigned len;
++      UPDATE_1_CHECK;
++
++      prob = probs + IsRep + state;
++      IF_BIT_0_CHECK(prob)
++      {
++        UPDATE_0_CHECK;
++        state = 0;
++        prob = probs + LenCoder;
++        res = DUMMY_MATCH;
++      }
++      else
++      {
++        UPDATE_1_CHECK;
++        res = DUMMY_REP;
++        prob = probs + IsRepG0 + state;
++        IF_BIT_0_CHECK(prob)
++        {
++          UPDATE_0_CHECK;
++          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
++          IF_BIT_0_CHECK(prob)
++          {
++            UPDATE_0_CHECK;
++            NORMALIZE_CHECK;
++            return DUMMY_REP;
++          }
++          else
++          {
++            UPDATE_1_CHECK;
++          }
++        }
++        else
++        {
++          UPDATE_1_CHECK;
++          prob = probs + IsRepG1 + state;
++          IF_BIT_0_CHECK(prob)
++          {
++            UPDATE_0_CHECK;
++          }
++          else 
++          {
++            UPDATE_1_CHECK;
++            prob = probs + IsRepG2 + state;
++            IF_BIT_0_CHECK(prob)
++            {
++              UPDATE_0_CHECK;
++            }
++            else
++            {
++              UPDATE_1_CHECK;
++            }
++          }
++        }
++        state = kNumStates;
++        prob = probs + RepLenCoder;
++      }
++      {
++        unsigned limit, offset;
++        CLzmaProb *probLen = prob + LenChoice;
++        IF_BIT_0_CHECK(probLen)
++        {
++          UPDATE_0_CHECK;
++          probLen = prob + LenLow + (posState << kLenNumLowBits);
++          offset = 0;
++          limit = 1 << kLenNumLowBits;
++        }
++        else
++        {
++          UPDATE_1_CHECK;
++          probLen = prob + LenChoice2;
++          IF_BIT_0_CHECK(probLen)
++          {
++            UPDATE_0_CHECK;
++            probLen = prob + LenMid + (posState << kLenNumMidBits);
++            offset = kLenNumLowSymbols;
++            limit = 1 << kLenNumMidBits;
++          }
++          else
++          {
++            UPDATE_1_CHECK;
++            probLen = prob + LenHigh;
++            offset = kLenNumLowSymbols + kLenNumMidSymbols;
++            limit = 1 << kLenNumHighBits;
++          }
++        }
++        TREE_DECODE_CHECK(probLen, limit, len);
++        len += offset;
++      }
++
++      if (state < 4)
++      {
++        unsigned posSlot;
++        prob = probs + PosSlot +
++            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << 
++            kNumPosSlotBits);
++        TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
++        if (posSlot >= kStartPosModelIndex)
++        {
++          int numDirectBits = ((posSlot >> 1) - 1);
++
++          /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
++
++          if (posSlot < kEndPosModelIndex)
++          {
++            prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
++          }
++          else
++          {
++            numDirectBits -= kNumAlignBits;
++            do
++            {
++              NORMALIZE_CHECK
++              range >>= 1;
++              code -= range & (((code - range) >> 31) - 1);
++              /* if (code >= range) code -= range; */
++            }
++            while (--numDirectBits != 0);
++            prob = probs + Align;
++            numDirectBits = kNumAlignBits;
++          }
++          {
++            unsigned i = 1;
++            do
++            {
++              GET_BIT_CHECK(prob + i, i);
++            }
++            while(--numDirectBits != 0);
++          }
++        }
++      }
++    }
++  }
++  NORMALIZE_CHECK;
++  return res;
++}
++
++
++static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
++{
++  p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
++  p->range = 0xFFFFFFFF;
++  p->needFlush = 0;
++}
++
++void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState) 
++{ 
++  p->needFlush = 1; 
++  p->remainLen = 0; 
++  p->tempBufSize = 0; 
++
++  if (initDic)
++  {
++    p->processedPos = 0;
++    p->checkDicSize = 0;
++    p->needInitState = 1;
++  }
++  if (initState)
++    p->needInitState = 1;
++}
++
++void LzmaDec_Init(CLzmaDec *p) 
++{ 
++  p->dicPos = 0; 
++  LzmaDec_InitDicAndState(p, True, True);
++}
++
++static void LzmaDec_InitStateReal(CLzmaDec *p)
++{
++  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
++  UInt32 i;
++  CLzmaProb *probs = p->probs;
++  for (i = 0; i < numProbs; i++)
++    probs[i] = kBitModelTotal >> 1; 
++  p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
++  p->state = 0;
++  p->needInitState = 0;
++}
++
++SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, 
++    ELzmaFinishMode finishMode, ELzmaStatus *status)
++{
++  SizeT inSize = *srcLen;
++  (*srcLen) = 0;
++  LzmaDec_WriteRem(p, dicLimit);
++  
++  *status = LZMA_STATUS_NOT_SPECIFIED;
++
++  while (p->remainLen != kMatchSpecLenStart)
++  {
++      int checkEndMarkNow;
++
++      if (p->needFlush != 0)
++      {
++        for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
++          p->tempBuf[p->tempBufSize++] = *src++;
++        if (p->tempBufSize < RC_INIT_SIZE)
++        {
++          *status = LZMA_STATUS_NEEDS_MORE_INPUT;
++          return SZ_OK;
++        }
++        if (p->tempBuf[0] != 0)
++          return SZ_ERROR_DATA;
++
++        LzmaDec_InitRc(p, p->tempBuf);
++        p->tempBufSize = 0;
++      }
++
++      checkEndMarkNow = 0;
++      if (p->dicPos >= dicLimit)
++      {
++        if (p->remainLen == 0 && p->code == 0)
++        {
++          *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
++          return SZ_OK;
++        }
++        if (finishMode == LZMA_FINISH_ANY)
++        {
++          *status = LZMA_STATUS_NOT_FINISHED;
++          return SZ_OK;
++        }
++        if (p->remainLen != 0)
++        {
++          *status = LZMA_STATUS_NOT_FINISHED;
++          return SZ_ERROR_DATA;
++        }
++        checkEndMarkNow = 1;
++      }
++
++      if (p->needInitState)
++        LzmaDec_InitStateReal(p);
++  
++      if (p->tempBufSize == 0)
++      {
++        SizeT processed;
++        const Byte *bufLimit;
++        if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
++        {
++          int dummyRes = LzmaDec_TryDummy(p, src, inSize);
++          if (dummyRes == DUMMY_ERROR)
++          {
++            memcpy(p->tempBuf, src, inSize);
++            p->tempBufSize = (unsigned)inSize;
++            (*srcLen) += inSize;
++            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
++            return SZ_OK;
++          }
++          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
++          {
++            *status = LZMA_STATUS_NOT_FINISHED;
++            return SZ_ERROR_DATA;
++          }
++          bufLimit = src;
++        }
++        else
++          bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
++        p->buf = src;
++        if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
++          return SZ_ERROR_DATA;
++        processed = p->buf - src;
++        (*srcLen) += processed;
++        src += processed;
++        inSize -= processed;
++      }
++      else
++      {
++        unsigned rem = p->tempBufSize, lookAhead = 0;
++        while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
++          p->tempBuf[rem++] = src[lookAhead++];
++        p->tempBufSize = rem;
++        if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
++        {
++          int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
++          if (dummyRes == DUMMY_ERROR)
++          {
++            (*srcLen) += lookAhead;
++            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
++            return SZ_OK;
++          }
++          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
++          {
++            *status = LZMA_STATUS_NOT_FINISHED;
++            return SZ_ERROR_DATA;
++          }
++        }
++        p->buf = p->tempBuf;
++        if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
++          return SZ_ERROR_DATA;
++        lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
++        (*srcLen) += lookAhead;
++        src += lookAhead;
++        inSize -= lookAhead;
++        p->tempBufSize = 0;
++      }
++  }
++  if (p->code == 0) 
++    *status = LZMA_STATUS_FINISHED_WITH_MARK;
++  return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
++}
++
++SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
++{
++  SizeT outSize = *destLen;
++  SizeT inSize = *srcLen;
++  *srcLen = *destLen = 0;
++  for (;;)
++  {
++    SizeT inSizeCur = inSize, outSizeCur, dicPos;
++    ELzmaFinishMode curFinishMode;
++    SRes res;
++    if (p->dicPos == p->dicBufSize)
++      p->dicPos = 0;
++    dicPos = p->dicPos;
++    if (outSize > p->dicBufSize - dicPos)
++    {
++      outSizeCur = p->dicBufSize;
++      curFinishMode = LZMA_FINISH_ANY;
++    }
++    else
++    {
++      outSizeCur = dicPos + outSize;
++      curFinishMode = finishMode;
++    }
++
++    res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
++    src += inSizeCur;
++    inSize -= inSizeCur;
++    *srcLen += inSizeCur;
++    outSizeCur = p->dicPos - dicPos;
++    memcpy(dest, p->dic + dicPos, outSizeCur);
++    dest += outSizeCur;
++    outSize -= outSizeCur;
++    *destLen += outSizeCur;
++    if (res != 0)
++      return res;
++    if (outSizeCur == 0 || outSize == 0)
++      return SZ_OK;
++  }
++}
++
++void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) 
++{ 
++  alloc->Free(alloc, p->probs);  
++  p->probs = 0; 
++}
++
++static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc) 
++{ 
++  alloc->Free(alloc, p->dic); 
++  p->dic = 0; 
++}
++
++void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
++{
++  LzmaDec_FreeProbs(p, alloc);
++  LzmaDec_FreeDict(p, alloc);
++}
++
++SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
++{
++  UInt32 dicSize; 
++  Byte d;
++  
++  if (size < LZMA_PROPS_SIZE)
++    return SZ_ERROR_UNSUPPORTED;
++  else
++    dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
++ 
++  if (dicSize < LZMA_DIC_MIN)
++    dicSize = LZMA_DIC_MIN;
++  p->dicSize = dicSize;
++
++  d = data[0];
++  if (d >= (9 * 5 * 5))
++    return SZ_ERROR_UNSUPPORTED;
++
++  p->lc = d % 9;
++  d /= 9;
++  p->pb = d / 5;
++  p->lp = d % 5;
++
++  return SZ_OK;
++}
++
++static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
++{
++  UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
++  if (p->probs == 0 || numProbs != p->numProbs)
++  {
++    LzmaDec_FreeProbs(p, alloc);
++    p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
++    p->numProbs = numProbs;
++    if (p->probs == 0)
++      return SZ_ERROR_MEM;
++  }
++  return SZ_OK;
++}
++
++SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
++{
++  CLzmaProps propNew;
++  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
++  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
++  p->prop = propNew;
++  return SZ_OK;
++}
++
++SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
++{
++  CLzmaProps propNew;
++  SizeT dicBufSize;
++  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
++  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
++  dicBufSize = propNew.dicSize;
++  if (p->dic == 0 || dicBufSize != p->dicBufSize)
++  {
++    LzmaDec_FreeDict(p, alloc);
++    p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
++    if (p->dic == 0)
++    {
++      LzmaDec_FreeProbs(p, alloc);
++      return SZ_ERROR_MEM;
++    }
++  }
++  p->dicBufSize = dicBufSize;
++  p->prop = propNew;
++  return SZ_OK;
++}
++
++SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
++    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode, 
++    ELzmaStatus *status, ISzAlloc *alloc)
++{
++  CLzmaDec p;
++  SRes res;
++  SizeT inSize = *srcLen;
++  SizeT outSize = *destLen;
++  *srcLen = *destLen = 0;
++  if (inSize < RC_INIT_SIZE)
++    return SZ_ERROR_INPUT_EOF;
++
++  LzmaDec_Construct(&p);
++  res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
++  if (res != 0)
++    return res;
++  p.dic = dest;
++  p.dicBufSize = outSize;
++
++  LzmaDec_Init(&p);
++  
++  *srcLen = inSize;
++  res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
++
++  if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
++    res = SZ_ERROR_INPUT_EOF;
++
++  (*destLen) = p.dicPos;
++  LzmaDec_FreeProbs(&p, alloc);
++  return res;
++}
+--- /dev/null
++++ b/lzma/LzmaEnc.c
+@@ -0,0 +1,2335 @@
++/* LzmaEnc.c -- LZMA Encoder
++2008-04-28
++Copyright (c) 1999-2008 Igor Pavlov
++Read LzmaEnc.h for license options */
++
++#if defined(SHOW_STAT) || defined(SHOW_STAT2)
++#include <stdio.h>
++#endif
++
++#include <string.h>
++
++#include "LzmaEnc.h"
++
++#include "LzFind.h"
++#ifdef COMPRESS_MF_MT
++#include "LzFindMt.h"
++#endif
++
++/* #define SHOW_STAT */
++/* #define SHOW_STAT2 */
++
++#ifdef SHOW_STAT
++static int ttt = 0;
++#endif
++
++#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1)
++
++#define kBlockSize (9 << 10)
++#define kUnpackBlockSize (1 << 18)
++#define kMatchArraySize (1 << 21)
++#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX)
++
++#define kNumMaxDirectBits (31)
++
++#define kNumTopBits 24
++#define kTopValue ((UInt32)1 << kNumTopBits)
++
++#define kNumBitModelTotalBits 11
++#define kBitModelTotal (1 << kNumBitModelTotalBits)
++#define kNumMoveBits 5
++#define kProbInitValue (kBitModelTotal >> 1)
++
++#define kNumMoveReducingBits 4
++#define kNumBitPriceShiftBits 4
++#define kBitPrice (1 << kNumBitPriceShiftBits)
++
++void LzmaEncProps_Init(CLzmaEncProps *p)
++{
++  p->level = 5;
++  p->dictSize = p->mc = 0;
++  p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
++  p->writeEndMark = 0;
++}
++
++void LzmaEncProps_Normalize(CLzmaEncProps *p)
++{
++  int level = p->level;
++  if (level < 0) level = 5;
++  p->level = level;
++  if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)));
++  if (p->lc < 0) p->lc = 3; 
++  if (p->lp < 0) p->lp = 0; 
++  if (p->pb < 0) p->pb = 2; 
++  if (p->algo < 0) p->algo = (level < 5 ? 0 : 1); 
++  if (p->fb < 0) p->fb = (level < 7 ? 32 : 64); 
++  if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1); 
++  if (p->numHashBytes < 0) p->numHashBytes = 4; 
++  if (p->mc == 0)  p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
++  if (p->numThreads < 0) p->numThreads = ((p->btMode && p->algo) ? 2 : 1);
++}
++
++UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
++{
++  CLzmaEncProps props = *props2;
++  LzmaEncProps_Normalize(&props);
++  return props.dictSize;
++}
++
++/* #define LZMA_LOG_BSR */
++/* Define it for Intel's CPU */
++
++
++#ifdef LZMA_LOG_BSR
++
++#define kDicLogSizeMaxCompress 30
++
++#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
++
++UInt32 GetPosSlot1(UInt32 pos) 
++{ 
++  UInt32 res; 
++  BSR2_RET(pos, res); 
++  return res; 
++}
++#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
++#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
++
++#else
++
++#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
++#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
++
++void LzmaEnc_FastPosInit(Byte *g_FastPos)
++{
++  int c = 2, slotFast;
++  g_FastPos[0] = 0;
++  g_FastPos[1] = 1;
++  
++  for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
++  {
++    UInt32 k = (1 << ((slotFast >> 1) - 1));
++    UInt32 j;
++    for (j = 0; j < k; j++, c++)
++      g_FastPos[c] = (Byte)slotFast;
++  }
++}
++
++#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
++  (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
++  res = p->g_FastPos[pos >> i] + (i * 2); }
++/*
++#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
++  p->g_FastPos[pos >> 6] + 12 : \
++  p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
++*/
++
++#define GetPosSlot1(pos) p->g_FastPos[pos]
++#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
++#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); }
++
++#endif
++
++
++#define LZMA_NUM_REPS 4
++
++typedef unsigned CState;
++
++typedef struct _COptimal
++{
++  UInt32 price;    
++
++  CState state;
++  int prev1IsChar;
++  int prev2;
++
++  UInt32 posPrev2;
++  UInt32 backPrev2;     
++
++  UInt32 posPrev;
++  UInt32 backPrev;     
++  UInt32 backs[LZMA_NUM_REPS];
++} COptimal;
++
++#define kNumOpts (1 << 12)
++
++#define kNumLenToPosStates 4
++#define kNumPosSlotBits 6 
++#define kDicLogSizeMin 0 
++#define kDicLogSizeMax 32 
++#define kDistTableSizeMax (kDicLogSizeMax * 2)
++
++
++#define kNumAlignBits 4
++#define kAlignTableSize (1 << kNumAlignBits)
++#define kAlignMask (kAlignTableSize - 1)
++
++#define kStartPosModelIndex 4
++#define kEndPosModelIndex 14
++#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
++
++#define kNumFullDistances (1 << (kEndPosModelIndex / 2))
++
++#ifdef _LZMA_PROB32
++#define CLzmaProb UInt32
++#else
++#define CLzmaProb UInt16
++#endif
++
++#define LZMA_PB_MAX 4
++#define LZMA_LC_MAX 8
++#define LZMA_LP_MAX 4
++
++#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
++
++
++#define kLenNumLowBits 3
++#define kLenNumLowSymbols (1 << kLenNumLowBits)
++#define kLenNumMidBits 3
++#define kLenNumMidSymbols (1 << kLenNumMidBits)
++#define kLenNumHighBits 8
++#define kLenNumHighSymbols (1 << kLenNumHighBits)
++
++#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
++
++#define LZMA_MATCH_LEN_MIN 2
++#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
++
++#define kNumStates 12
++
++typedef struct
++{
++  CLzmaProb choice;
++  CLzmaProb choice2;
++  CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits];
++  CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits];
++  CLzmaProb high[kLenNumHighSymbols];
++} CLenEnc;
++
++typedef struct
++{
++  CLenEnc p;
++  UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
++  UInt32 tableSize;
++  UInt32 counters[LZMA_NUM_PB_STATES_MAX];
++} CLenPriceEnc;
++
++typedef struct _CRangeEnc
++{
++  UInt32 range;
++  Byte cache;
++  UInt64 low;
++  UInt64 cacheSize;
++  Byte *buf;
++  Byte *bufLim;
++  Byte *bufBase;
++  ISeqOutStream *outStream;
++  UInt64 processed;
++  SRes res;
++} CRangeEnc;
++
++typedef struct _CSeqInStreamBuf
++{
++  ISeqInStream funcTable;
++  const Byte *data;
++  SizeT rem;
++} CSeqInStreamBuf;
++
++static SRes MyRead(void *pp, void *data, size_t *size)
++{
++  size_t curSize = *size;
++  CSeqInStreamBuf *p = (CSeqInStreamBuf *)pp;
++  if (p->rem < curSize)
++    curSize = p->rem;
++  memcpy(data, p->data, curSize);
++  p->rem -= curSize;
++  p->data += curSize;
++  *size = curSize;
++  return SZ_OK;
++}
++
++typedef struct 
++{
++  CLzmaProb *litProbs;
++
++  CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
++  CLzmaProb isRep[kNumStates];
++  CLzmaProb isRepG0[kNumStates];
++  CLzmaProb isRepG1[kNumStates];
++  CLzmaProb isRepG2[kNumStates];
++  CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
++
++  CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
++  CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
++  CLzmaProb posAlignEncoder[1 << kNumAlignBits];
++  
++  CLenPriceEnc lenEnc;
++  CLenPriceEnc repLenEnc;
++
++  UInt32 reps[LZMA_NUM_REPS];
++  UInt32 state;
++} CSaveState;
++
++typedef struct _CLzmaEnc
++{
++  IMatchFinder matchFinder;
++  void *matchFinderObj;
++
++  #ifdef COMPRESS_MF_MT
++  Bool mtMode;
++  CMatchFinderMt matchFinderMt;
++  #endif
++
++  CMatchFinder matchFinderBase;
++
++  #ifdef COMPRESS_MF_MT
++  Byte pad[128];
++  #endif
++  
++  UInt32 optimumEndIndex;
++  UInt32 optimumCurrentIndex;
++
++  Bool longestMatchWasFound;
++  UInt32 longestMatchLength;    
++  UInt32 numDistancePairs;
++
++  COptimal opt[kNumOpts];
++  
++  #ifndef LZMA_LOG_BSR
++  Byte g_FastPos[1 << kNumLogBits];
++  #endif
++
++  UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
++  UInt32 matchDistances[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
++  UInt32 numFastBytes;
++  UInt32 additionalOffset;
++  UInt32 reps[LZMA_NUM_REPS];
++  UInt32 state;
++
++  UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
++  UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
++  UInt32 alignPrices[kAlignTableSize];
++  UInt32 alignPriceCount;
++
++  UInt32 distTableSize;
++
++  unsigned lc, lp, pb;
++  unsigned lpMask, pbMask;
++
++  CLzmaProb *litProbs;
++
++  CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
++  CLzmaProb isRep[kNumStates];
++  CLzmaProb isRepG0[kNumStates];
++  CLzmaProb isRepG1[kNumStates];
++  CLzmaProb isRepG2[kNumStates];
++  CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
++
++  CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
++  CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
++  CLzmaProb posAlignEncoder[1 << kNumAlignBits];
++  
++  CLenPriceEnc lenEnc;
++  CLenPriceEnc repLenEnc;
++
++  unsigned lclp;
++
++  Bool fastMode;
++  
++  CRangeEnc rc;
++
++  Bool writeEndMark;
++  UInt64 nowPos64;
++  UInt32 matchPriceCount;
++  Bool finished;
++  Bool multiThread;
++
++  SRes result;
++  UInt32 dictSize;
++  UInt32 matchFinderCycles;
++
++  ISeqInStream *inStream;
++  CSeqInStreamBuf seqBufInStream;
++
++  CSaveState saveState;
++} CLzmaEnc;
++
++void LzmaEnc_SaveState(CLzmaEncHandle pp)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  CSaveState *dest = &p->saveState;
++  int i;
++  dest->lenEnc = p->lenEnc;
++  dest->repLenEnc = p->repLenEnc;
++  dest->state = p->state;
++
++  for (i = 0; i < kNumStates; i++)
++  {
++    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
++    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
++  }
++  for (i = 0; i < kNumLenToPosStates; i++)
++    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
++  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
++  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
++  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
++  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
++  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
++  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
++  memcpy(dest->reps, p->reps, sizeof(p->reps));
++  memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
++}
++
++void LzmaEnc_RestoreState(CLzmaEncHandle pp)
++{
++  CLzmaEnc *dest = (CLzmaEnc *)pp;
++  const CSaveState *p = &dest->saveState;
++  int i;
++  dest->lenEnc = p->lenEnc;
++  dest->repLenEnc = p->repLenEnc;
++  dest->state = p->state;
++
++  for (i = 0; i < kNumStates; i++)
++  {
++    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
++    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
++  }
++  for (i = 0; i < kNumLenToPosStates; i++)
++    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
++  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
++  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
++  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
++  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
++  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
++  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
++  memcpy(dest->reps, p->reps, sizeof(p->reps));
++  memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
++}
++
++SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  CLzmaEncProps props = *props2;
++  LzmaEncProps_Normalize(&props);
++
++  if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX ||
++      props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30))
++    return SZ_ERROR_PARAM;
++  p->dictSize = props.dictSize;
++  p->matchFinderCycles = props.mc;
++  {
++    unsigned fb = props.fb;
++    if (fb < 5)
++      fb = 5;
++    if (fb > LZMA_MATCH_LEN_MAX)
++      fb = LZMA_MATCH_LEN_MAX;
++    p->numFastBytes = fb;
++  }
++  p->lc = props.lc;
++  p->lp = props.lp;
++  p->pb = props.pb;
++  p->fastMode = (props.algo == 0);
++  p->matchFinderBase.btMode = props.btMode;
++  {
++    UInt32 numHashBytes = 4;
++    if (props.btMode)
++    {
++      if (props.numHashBytes < 2)
++        numHashBytes = 2;
++      else if (props.numHashBytes < 4)
++        numHashBytes = props.numHashBytes;
++    }
++    p->matchFinderBase.numHashBytes = numHashBytes;
++  }
++
++  p->matchFinderBase.cutValue = props.mc;
++
++  p->writeEndMark = props.writeEndMark;
++
++  #ifdef COMPRESS_MF_MT
++  /*
++  if (newMultiThread != _multiThread)
++  {
++    ReleaseMatchFinder();
++    _multiThread = newMultiThread;
++  }
++  */
++  p->multiThread = (props.numThreads > 1);
++  #endif
++
++  return SZ_OK;
++}
++
++static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4,  5,  6,   4, 5};
++static const int kMatchNextStates[kNumStates]   = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
++static const int kRepNextStates[kNumStates]     = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
++static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
++
++/*
++  void UpdateChar() { Index = kLiteralNextStates[Index]; }
++  void UpdateMatch() { Index = kMatchNextStates[Index]; }
++  void UpdateRep() { Index = kRepNextStates[Index]; }
++  void UpdateShortRep() { Index = kShortRepNextStates[Index]; }
++*/
++
++#define IsCharState(s) ((s) < 7)
++
++
++#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
++
++#define kInfinityPrice (1 << 30)
++
++static void RangeEnc_Construct(CRangeEnc *p)
++{
++  p->outStream = 0;
++  p->bufBase = 0;
++}
++
++#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
++
++#define RC_BUF_SIZE (1 << 16)
++static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc)
++{
++  if (p->bufBase == 0)
++  {
++    p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE);
++    if (p->bufBase == 0)
++      return 0;
++    p->bufLim = p->bufBase + RC_BUF_SIZE;
++  }
++  return 1;
++}
++
++static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc)
++{
++  alloc->Free(alloc, p->bufBase);
++  p->bufBase = 0;
++}
++
++static void RangeEnc_Init(CRangeEnc *p)
++{
++  /* Stream.Init(); */
++  p->low = 0;
++  p->range = 0xFFFFFFFF;
++  p->cacheSize = 1;
++  p->cache = 0;
++
++  p->buf = p->bufBase;
++
++  p->processed = 0;
++  p->res = SZ_OK;
++}
++
++static void RangeEnc_FlushStream(CRangeEnc *p)
++{
++  size_t num;
++  if (p->res != SZ_OK)
++    return;
++  num = p->buf - p->bufBase;
++  if (num != p->outStream->Write(p->outStream, p->bufBase, num))
++    p->res = SZ_ERROR_WRITE;
++  p->processed += num;
++  p->buf = p->bufBase;
++}
++
++static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
++{
++  if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0) 
++  {
++    Byte temp = p->cache;
++    do
++    {
++      Byte *buf = p->buf;
++      *buf++ = (Byte)(temp + (Byte)(p->low >> 32));
++      p->buf = buf;
++      if (buf == p->bufLim)
++        RangeEnc_FlushStream(p);
++      temp = 0xFF;
++    }
++    while (--p->cacheSize != 0);
++    p->cache = (Byte)((UInt32)p->low >> 24);                      
++  } 
++  p->cacheSize++;                               
++  p->low = (UInt32)p->low << 8;                           
++}
++
++static void RangeEnc_FlushData(CRangeEnc *p)
++{
++  int i;
++  for (i = 0; i < 5; i++)
++    RangeEnc_ShiftLow(p);
++}
++
++static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits)
++{
++  do
++  {
++    p->range >>= 1;
++    p->low += p->range & (0 - ((value >> --numBits) & 1));
++    if (p->range < kTopValue)
++    {
++      p->range <<= 8;
++      RangeEnc_ShiftLow(p);
++    }
++  }
++  while (numBits != 0);
++}
++
++static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
++{
++  UInt32 ttt = *prob;
++  UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt;
++  if (symbol == 0)
++  {
++    p->range = newBound;
++    ttt += (kBitModelTotal - ttt) >> kNumMoveBits;
++  }
++  else
++  {
++    p->low += newBound;
++    p->range -= newBound;
++    ttt -= ttt >> kNumMoveBits;
++  }
++  *prob = (CLzmaProb)ttt;
++  if (p->range < kTopValue)
++  {
++    p->range <<= 8;
++    RangeEnc_ShiftLow(p);
++  }
++}
++
++static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
++{
++  symbol |= 0x100;
++  do 
++  {
++    RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
++    symbol <<= 1;
++  }
++  while (symbol < 0x10000);
++}
++
++static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
++{
++  UInt32 offs = 0x100;
++  symbol |= 0x100;
++  do 
++  {
++    matchByte <<= 1;
++    RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
++    symbol <<= 1;
++    offs &= ~(matchByte ^ symbol);
++  }
++  while (symbol < 0x10000);
++}
++
++void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
++{
++  UInt32 i;
++  for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
++  {
++    const int kCyclesBits = kNumBitPriceShiftBits;
++    UInt32 w = i;
++    UInt32 bitCount = 0;
++    int j;
++    for (j = 0; j < kCyclesBits; j++)
++    {
++      w = w * w;
++      bitCount <<= 1;
++      while (w >= ((UInt32)1 << 16))
++      {
++        w >>= 1;
++        bitCount++;
++      }
++    }
++    ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
++  }
++}
++
++
++#define GET_PRICE(prob, symbol) \
++  p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
++
++#define GET_PRICEa(prob, symbol) \
++  ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
++
++#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
++#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
++
++#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
++#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
++
++static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices)
++{
++  UInt32 price = 0;
++  symbol |= 0x100;
++  do
++  {
++    price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
++    symbol <<= 1;
++  }
++  while (symbol < 0x10000);
++  return price;
++};
++
++static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices)
++{
++  UInt32 price = 0;
++  UInt32 offs = 0x100;
++  symbol |= 0x100;
++  do 
++  {
++    matchByte <<= 1;
++    price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
++    symbol <<= 1;
++    offs &= ~(matchByte ^ symbol);
++  }
++  while (symbol < 0x10000);
++  return price;
++};
++
++
++static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
++{
++  UInt32 m = 1;
++  int i;
++  for (i = numBitLevels; i != 0 ;)
++  {
++    UInt32 bit;
++    i--;
++    bit = (symbol >> i) & 1;
++    RangeEnc_EncodeBit(rc, probs + m, bit);
++    m = (m << 1) | bit;
++  }
++};
++
++static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
++{
++  UInt32 m = 1;
++  int i;
++  for (i = 0; i < numBitLevels; i++)
++  {
++    UInt32 bit = symbol & 1;
++    RangeEnc_EncodeBit(rc, probs + m, bit);
++    m = (m << 1) | bit;
++    symbol >>= 1;
++  }
++}
++
++static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
++{
++  UInt32 price = 0;
++  symbol |= (1 << numBitLevels);
++  while (symbol != 1)
++  {
++    price += GET_PRICEa(probs[symbol >> 1], symbol & 1);
++    symbol >>= 1;
++  }
++  return price;
++}
++
++static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
++{
++  UInt32 price = 0;
++  UInt32 m = 1;
++  int i;
++  for (i = numBitLevels; i != 0; i--)
++  {
++    UInt32 bit = symbol & 1;
++    symbol >>= 1;
++    price += GET_PRICEa(probs[m], bit);
++    m = (m << 1) | bit;
++  }
++  return price;
++}
++
++
++static void LenEnc_Init(CLenEnc *p)
++{
++  unsigned i;
++  p->choice = p->choice2 = kProbInitValue;
++  for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++)
++    p->low[i] = kProbInitValue;
++  for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++)
++    p->mid[i] = kProbInitValue;
++  for (i = 0; i < kLenNumHighSymbols; i++)
++    p->high[i] = kProbInitValue;
++}
++
++static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState)
++{
++  if (symbol < kLenNumLowSymbols)
++  {
++    RangeEnc_EncodeBit(rc, &p->choice, 0);
++    RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol);
++  }
++  else
++  {
++    RangeEnc_EncodeBit(rc, &p->choice, 1);
++    if (symbol < kLenNumLowSymbols + kLenNumMidSymbols)
++    {
++      RangeEnc_EncodeBit(rc, &p->choice2, 0);
++      RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols);
++    }
++    else
++    {
++      RangeEnc_EncodeBit(rc, &p->choice2, 1);
++      RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols);
++    }
++  }
++}
++
++static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices)
++{
++  UInt32 a0 = GET_PRICE_0a(p->choice);
++  UInt32 a1 = GET_PRICE_1a(p->choice);
++  UInt32 b0 = a1 + GET_PRICE_0a(p->choice2);
++  UInt32 b1 = a1 + GET_PRICE_1a(p->choice2);
++  UInt32 i = 0;
++  for (i = 0; i < kLenNumLowSymbols; i++)
++  {
++    if (i >= numSymbols)
++      return;
++    prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices);
++  }
++  for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++)
++  {
++    if (i >= numSymbols)
++      return;
++    prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices);
++  }
++  for (; i < numSymbols; i++)
++    prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices);
++}
++
++static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices)
++{
++  LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices);
++  p->counters[posState] = p->tableSize;
++}
++
++static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices)
++{
++  UInt32 posState;
++  for (posState = 0; posState < numPosStates; posState++)
++    LenPriceEnc_UpdateTable(p, posState, ProbPrices);
++}
++
++static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices)
++{
++  LenEnc_Encode(&p->p, rc, symbol, posState);
++  if (updatePrice)
++    if (--p->counters[posState] == 0)
++      LenPriceEnc_UpdateTable(p, posState, ProbPrices);
++}
++
++
++
++
++static void MovePos(CLzmaEnc *p, UInt32 num)
++{
++  #ifdef SHOW_STAT
++  ttt += num;
++  printf("\n MovePos %d", num);
++  #endif
++  if (num != 0)
++  {
++    p->additionalOffset += num;
++    p->matchFinder.Skip(p->matchFinderObj, num);
++  }
++}
++
++static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
++{
++  UInt32 lenRes = 0, numDistancePairs;
++  numDistancePairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matchDistances);
++  #ifdef SHOW_STAT
++  printf("\n i = %d numPairs = %d    ", ttt, numDistancePairs / 2);
++  if (ttt >= 61994)
++    ttt = ttt;
++
++  ttt++;
++  {
++    UInt32 i;
++  for (i = 0; i < numDistancePairs; i += 2)
++    printf("%2d %6d   | ", p->matchDistances[i], p->matchDistances[i + 1]);
++  }
++  #endif
++  if (numDistancePairs > 0)
++  {
++    lenRes = p->matchDistances[numDistancePairs - 2];
++    if (lenRes == p->numFastBytes)
++    {
++      UInt32 numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) + 1;
++      const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
++      UInt32 distance = p->matchDistances[numDistancePairs - 1] + 1;
++      if (numAvail > LZMA_MATCH_LEN_MAX)
++        numAvail = LZMA_MATCH_LEN_MAX;
++
++      {
++        const Byte *pby2 = pby - distance;
++        for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
++      }
++    }
++  }
++  p->additionalOffset++;
++  *numDistancePairsRes = numDistancePairs;
++  return lenRes;
++}
++
++
++#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
++#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
++#define IsShortRep(p) ((p)->backPrev == 0)
++
++static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState)
++{
++  return 
++    GET_PRICE_0(p->isRepG0[state]) +
++    GET_PRICE_0(p->isRep0Long[state][posState]);
++}
++
++static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState)
++{
++  UInt32 price;
++  if (repIndex == 0)
++  {
++    price = GET_PRICE_0(p->isRepG0[state]);
++    price += GET_PRICE_1(p->isRep0Long[state][posState]);
++  }
++  else
++  {
++    price = GET_PRICE_1(p->isRepG0[state]);
++    if (repIndex == 1)
++      price += GET_PRICE_0(p->isRepG1[state]);
++    else
++    {
++      price += GET_PRICE_1(p->isRepG1[state]);
++      price += GET_PRICE(p->isRepG2[state], repIndex - 2);
++    }
++  }
++  return price;
++}
++
++static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState)
++{
++  return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] +
++    GetPureRepPrice(p, repIndex, state, posState);
++}
++
++static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
++{
++  UInt32 posMem = p->opt[cur].posPrev;
++  UInt32 backMem = p->opt[cur].backPrev;
++  p->optimumEndIndex = cur;
++  do
++  {
++    if (p->opt[cur].prev1IsChar)
++    {
++      MakeAsChar(&p->opt[posMem])
++      p->opt[posMem].posPrev = posMem - 1;
++      if (p->opt[cur].prev2)
++      {
++        p->opt[posMem - 1].prev1IsChar = False;
++        p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2;
++        p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2;
++      }
++    }
++    {
++      UInt32 posPrev = posMem;
++      UInt32 backCur = backMem;
++      
++      backMem = p->opt[posPrev].backPrev;
++      posMem = p->opt[posPrev].posPrev;
++      
++      p->opt[posPrev].backPrev = backCur;
++      p->opt[posPrev].posPrev = cur;
++      cur = posPrev;
++    }
++  }
++  while (cur != 0);
++  *backRes = p->opt[0].backPrev;
++  p->optimumCurrentIndex  = p->opt[0].posPrev;
++  return p->optimumCurrentIndex; 
++}
++
++#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300)
++
++static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
++{
++  UInt32 numAvailableBytes, lenMain, numDistancePairs;
++  const Byte *data;
++  UInt32 reps[LZMA_NUM_REPS];
++  UInt32 repLens[LZMA_NUM_REPS];
++  UInt32 repMaxIndex, i;
++  UInt32 *matchDistances;
++  Byte currentByte, matchByte; 
++  UInt32 posState;
++  UInt32 matchPrice, repMatchPrice;
++  UInt32 lenEnd;
++  UInt32 len;
++  UInt32 normalMatchPrice;
++  UInt32 cur;
++  if (p->optimumEndIndex != p->optimumCurrentIndex)
++  {
++    const COptimal *opt = &p->opt[p->optimumCurrentIndex];
++    UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex;
++    *backRes = opt->backPrev;
++    p->optimumCurrentIndex = opt->posPrev;
++    return lenRes;
++  }
++  p->optimumCurrentIndex = p->optimumEndIndex = 0;
++  
++  numAvailableBytes = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
++
++  if (!p->longestMatchWasFound)
++  {
++    lenMain = ReadMatchDistances(p, &numDistancePairs);
++  }
++  else
++  {
++    lenMain = p->longestMatchLength;
++    numDistancePairs = p->numDistancePairs;
++    p->longestMatchWasFound = False;
++  }
++
++  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
++  if (numAvailableBytes < 2)
++  {
++    *backRes = (UInt32)(-1);
++    return 1;
++  }
++  if (numAvailableBytes > LZMA_MATCH_LEN_MAX)
++    numAvailableBytes = LZMA_MATCH_LEN_MAX;
++
++  repMaxIndex = 0;
++  for (i = 0; i < LZMA_NUM_REPS; i++)
++  {
++    UInt32 lenTest;
++    const Byte *data2;
++    reps[i] = p->reps[i];
++    data2 = data - (reps[i] + 1);
++    if (data[0] != data2[0] || data[1] != data2[1])
++    {
++      repLens[i] = 0;
++      continue;
++    }
++    for (lenTest = 2; lenTest < numAvailableBytes && data[lenTest] == data2[lenTest]; lenTest++);
++    repLens[i] = lenTest;
++    if (lenTest > repLens[repMaxIndex])
++      repMaxIndex = i;
++  }
++  if (repLens[repMaxIndex] >= p->numFastBytes)
++  {
++    UInt32 lenRes;
++    *backRes = repMaxIndex;
++    lenRes = repLens[repMaxIndex];
++    MovePos(p, lenRes - 1);
++    return lenRes;
++  }
++
++  matchDistances = p->matchDistances;
++  if (lenMain >= p->numFastBytes)
++  {
++    *backRes = matchDistances[numDistancePairs - 1] + LZMA_NUM_REPS; 
++    MovePos(p, lenMain - 1);
++    return lenMain;
++  }
++  currentByte = *data;
++  matchByte = *(data - (reps[0] + 1));
++
++  if (lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
++  {
++    *backRes = (UInt32)-1;
++    return 1;
++  }
++
++  p->opt[0].state = (CState)p->state;
++
++  posState = (position & p->pbMask);
++
++  {
++    const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
++    p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) + 
++        (!IsCharState(p->state) ? 
++          LitEnc_GetPriceMatched(probs, currentByte, matchByte, p->ProbPrices) :
++          LitEnc_GetPrice(probs, currentByte, p->ProbPrices));
++  }
++
++  MakeAsChar(&p->opt[1]);
++
++  matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
++  repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
++
++  if (matchByte == currentByte)
++  {
++    UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState);
++    if (shortRepPrice < p->opt[1].price)
++    {
++      p->opt[1].price = shortRepPrice;
++      MakeAsShortRep(&p->opt[1]);
++    }
++  }
++  lenEnd = ((lenMain >= repLens[repMaxIndex]) ? lenMain : repLens[repMaxIndex]);
++
++  if (lenEnd < 2)
++  {
++    *backRes = p->opt[1].backPrev;
++    return 1;
++  }
++
++  p->opt[1].posPrev = 0;
++  for (i = 0; i < LZMA_NUM_REPS; i++)
++    p->opt[0].backs[i] = reps[i];
++
++  len = lenEnd;
++  do
++    p->opt[len--].price = kInfinityPrice;
++  while (len >= 2);
++
++  for (i = 0; i < LZMA_NUM_REPS; i++)
++  {
++    UInt32 repLen = repLens[i];
++    UInt32 price;
++    if (repLen < 2)
++      continue;
++    price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState);
++    do
++    {
++      UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2];
++      COptimal *opt = &p->opt[repLen];
++      if (curAndLenPrice < opt->price) 
++      {
++        opt->price = curAndLenPrice;
++        opt->posPrev = 0;
++        opt->backPrev = i;
++        opt->prev1IsChar = False;
++      }
++    }
++    while (--repLen >= 2);
++  }
++
++  normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
++
++  len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
++  if (len <= lenMain)
++  {
++    UInt32 offs = 0;
++    while (len > matchDistances[offs])
++      offs += 2;
++    for (; ; len++)
++    {
++      COptimal *opt;
++      UInt32 distance = matchDistances[offs + 1];
++
++      UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN];
++      UInt32 lenToPosState = GetLenToPosState(len);
++      if (distance < kNumFullDistances)
++        curAndLenPrice += p->distancesPrices[lenToPosState][distance];
++      else
++      {
++        UInt32 slot;
++        GetPosSlot2(distance, slot);
++        curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot];
++      }
++      opt = &p->opt[len];
++      if (curAndLenPrice < opt->price) 
++      {
++        opt->price = curAndLenPrice;
++        opt->posPrev = 0;
++        opt->backPrev = distance + LZMA_NUM_REPS;
++        opt->prev1IsChar = False;
++      }
++      if (len == matchDistances[offs])
++      {
++        offs += 2;
++        if (offs == numDistancePairs)
++          break;
++      }
++    }
++  }
++
++  cur = 0;
++
++    #ifdef SHOW_STAT2
++    if (position >= 0)
++    {
++      unsigned i;
++      printf("\n pos = %4X", position);
++      for (i = cur; i <= lenEnd; i++)
++      printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
++    }
++    #endif
++
++  for (;;)
++  {
++    UInt32 numAvailableBytesFull, newLen, numDistancePairs;
++    COptimal *curOpt;
++    UInt32 posPrev;
++    UInt32 state;
++    UInt32 curPrice;
++    Bool nextIsChar;
++    const Byte *data;
++    Byte currentByte, matchByte;
++    UInt32 posState;
++    UInt32 curAnd1Price;
++    COptimal *nextOpt;
++    UInt32 matchPrice, repMatchPrice;  
++    UInt32 numAvailableBytes;
++    UInt32 startLen;
++
++    cur++;
++    if (cur == lenEnd)
++      return Backward(p, backRes, cur);
++
++    numAvailableBytesFull = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
++    newLen = ReadMatchDistances(p, &numDistancePairs);
++    if (newLen >= p->numFastBytes)
++    {
++      p->numDistancePairs = numDistancePairs;
++      p->longestMatchLength = newLen;
++      p->longestMatchWasFound = True;
++      return Backward(p, backRes, cur);
++    }
++    position++;
++    curOpt = &p->opt[cur];
++    posPrev = curOpt->posPrev;
++    if (curOpt->prev1IsChar)
++    {
++      posPrev--;
++      if (curOpt->prev2)
++      {
++        state = p->opt[curOpt->posPrev2].state;
++        if (curOpt->backPrev2 < LZMA_NUM_REPS)
++          state = kRepNextStates[state];
++        else
++          state = kMatchNextStates[state];
++      }
++      else
++        state = p->opt[posPrev].state;
++      state = kLiteralNextStates[state];
++    }
++    else
++      state = p->opt[posPrev].state;
++    if (posPrev == cur - 1)
++    {
++      if (IsShortRep(curOpt))
++        state = kShortRepNextStates[state];
++      else
++        state = kLiteralNextStates[state];
++    }
++    else
++    {
++      UInt32 pos;
++      const COptimal *prevOpt;
++      if (curOpt->prev1IsChar && curOpt->prev2)
++      {
++        posPrev = curOpt->posPrev2;
++        pos = curOpt->backPrev2;
++        state = kRepNextStates[state];
++      }
++      else
++      {
++        pos = curOpt->backPrev;
++        if (pos < LZMA_NUM_REPS)
++          state = kRepNextStates[state];
++        else
++          state = kMatchNextStates[state];
++      }
++      prevOpt = &p->opt[posPrev];
++      if (pos < LZMA_NUM_REPS)
++      {
++        UInt32 i;
++        reps[0] = prevOpt->backs[pos];
++        for (i = 1; i <= pos; i++)
++          reps[i] = prevOpt->backs[i - 1];
++        for (; i < LZMA_NUM_REPS; i++)
++          reps[i] = prevOpt->backs[i];
++      }
++      else
++      {
++        UInt32 i;
++        reps[0] = (pos - LZMA_NUM_REPS);
++        for (i = 1; i < LZMA_NUM_REPS; i++)
++          reps[i] = prevOpt->backs[i - 1];
++      }
++    }
++    curOpt->state = (CState)state;
++
++    curOpt->backs[0] = reps[0];
++    curOpt->backs[1] = reps[1];
++    curOpt->backs[2] = reps[2];
++    curOpt->backs[3] = reps[3];
++
++    curPrice = curOpt->price; 
++    nextIsChar = False;
++    data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
++    currentByte = *data;
++    matchByte = *(data - (reps[0] + 1));
++
++    posState = (position & p->pbMask);
++
++    curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]);
++    {
++      const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
++      curAnd1Price += 
++        (!IsCharState(state) ? 
++          LitEnc_GetPriceMatched(probs, currentByte, matchByte, p->ProbPrices) :
++          LitEnc_GetPrice(probs, currentByte, p->ProbPrices));
++    }   
++
++    nextOpt = &p->opt[cur + 1];
++
++    if (curAnd1Price < nextOpt->price) 
++    {
++      nextOpt->price = curAnd1Price;
++      nextOpt->posPrev = cur;
++      MakeAsChar(nextOpt);
++      nextIsChar = True;
++    }
++
++    matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
++    repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
++    
++    if (matchByte == currentByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
++    {
++      UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
++      if (shortRepPrice <= nextOpt->price)
++      {
++        nextOpt->price = shortRepPrice;
++        nextOpt->posPrev = cur;
++        MakeAsShortRep(nextOpt);
++        nextIsChar = True;
++      }
++    }
++
++    {
++      UInt32 temp = kNumOpts - 1 - cur;
++      if (temp <  numAvailableBytesFull)
++        numAvailableBytesFull = temp;
++    }
++    numAvailableBytes = numAvailableBytesFull;
++
++    if (numAvailableBytes < 2)
++      continue;
++    if (numAvailableBytes > p->numFastBytes)
++      numAvailableBytes = p->numFastBytes;
++    if (!nextIsChar && matchByte != currentByte) /* speed optimization */
++    {
++      /* try Literal + rep0 */
++      UInt32 temp;
++      UInt32 lenTest2;
++      const Byte *data2 = data - (reps[0] + 1);
++      UInt32 limit = p->numFastBytes + 1;
++      if (limit > numAvailableBytesFull)
++        limit = numAvailableBytesFull;
++
++      for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
++      lenTest2 = temp - 1;
++      if (lenTest2 >= 2)
++      {
++        UInt32 state2 = kLiteralNextStates[state];
++        UInt32 posStateNext = (position + 1) & p->pbMask;
++        UInt32 nextRepMatchPrice = curAnd1Price + 
++            GET_PRICE_1(p->isMatch[state2][posStateNext]) +
++            GET_PRICE_1(p->isRep[state2]);
++        /* for (; lenTest2 >= 2; lenTest2--) */
++        {
++          UInt32 curAndLenPrice;
++          COptimal *opt;
++          UInt32 offset = cur + 1 + lenTest2;
++          while (lenEnd < offset)
++            p->opt[++lenEnd].price = kInfinityPrice;
++          curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
++          opt = &p->opt[offset];
++          if (curAndLenPrice < opt->price) 
++          {
++            opt->price = curAndLenPrice;
++            opt->posPrev = cur + 1;
++            opt->backPrev = 0;
++            opt->prev1IsChar = True;
++            opt->prev2 = False;
++          }
++        }
++      }
++    }
++    
++    startLen = 2; /* speed optimization */
++    {
++    UInt32 repIndex;
++    for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++)
++    {
++      UInt32 lenTest;
++      UInt32 lenTestTemp;
++      UInt32 price;
++      const Byte *data2 = data - (reps[repIndex] + 1);
++      if (data[0] != data2[0] || data[1] != data2[1])
++        continue;
++      for (lenTest = 2; lenTest < numAvailableBytes && data[lenTest] == data2[lenTest]; lenTest++);
++      while (lenEnd < cur + lenTest)
++        p->opt[++lenEnd].price = kInfinityPrice;
++      lenTestTemp = lenTest;
++      price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState);
++      do
++      {
++        UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2];
++        COptimal *opt = &p->opt[cur + lenTest];
++        if (curAndLenPrice < opt->price) 
++        {
++          opt->price = curAndLenPrice;
++          opt->posPrev = cur;
++          opt->backPrev = repIndex;
++          opt->prev1IsChar = False;
++        }
++      }
++      while (--lenTest >= 2);
++      lenTest = lenTestTemp;
++      
++      if (repIndex == 0)
++        startLen = lenTest + 1;
++        
++      /* if (_maxMode) */
++        {
++          UInt32 lenTest2 = lenTest + 1;
++          UInt32 limit = lenTest2 + p->numFastBytes;
++          UInt32 nextRepMatchPrice;
++          if (limit > numAvailableBytesFull)
++            limit = numAvailableBytesFull;
++          for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
++          lenTest2 -= lenTest + 1;
++          if (lenTest2 >= 2)
++          {
++            UInt32 state2 = kRepNextStates[state];
++            UInt32 posStateNext = (position + lenTest) & p->pbMask;
++            UInt32 curAndLenCharPrice = 
++                price + p->repLenEnc.prices[posState][lenTest - 2] + 
++                GET_PRICE_0(p->isMatch[state2][posStateNext]) +
++                LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
++                    data[lenTest], data2[lenTest], p->ProbPrices);
++            state2 = kLiteralNextStates[state2];
++            posStateNext = (position + lenTest + 1) & p->pbMask;
++            nextRepMatchPrice = curAndLenCharPrice + 
++                GET_PRICE_1(p->isMatch[state2][posStateNext]) +
++                GET_PRICE_1(p->isRep[state2]);
++            
++            /* for (; lenTest2 >= 2; lenTest2--) */
++            {
++              UInt32 curAndLenPrice;
++              COptimal *opt;
++              UInt32 offset = cur + lenTest + 1 + lenTest2;
++              while (lenEnd < offset)
++                p->opt[++lenEnd].price = kInfinityPrice;
++              curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
++              opt = &p->opt[offset];
++              if (curAndLenPrice < opt->price) 
++              {
++                opt->price = curAndLenPrice;
++                opt->posPrev = cur + lenTest + 1;
++                opt->backPrev = 0;
++                opt->prev1IsChar = True;
++                opt->prev2 = True;
++                opt->posPrev2 = cur;
++                opt->backPrev2 = repIndex;
++              }
++            }
++          }
++        }
++    }
++    }
++    /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */
++    if (newLen > numAvailableBytes)
++    {
++      newLen = numAvailableBytes;
++      for (numDistancePairs = 0; newLen > matchDistances[numDistancePairs]; numDistancePairs += 2);
++      matchDistances[numDistancePairs] = newLen;
++      numDistancePairs += 2;
++    }
++    if (newLen >= startLen)
++    {
++      UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
++      UInt32 offs, curBack, posSlot;
++      UInt32 lenTest;
++      while (lenEnd < cur + newLen)
++        p->opt[++lenEnd].price = kInfinityPrice;
++
++      offs = 0;
++      while (startLen > matchDistances[offs])
++        offs += 2;
++      curBack = matchDistances[offs + 1];
++      GetPosSlot2(curBack, posSlot);
++      for (lenTest = /*2*/ startLen; ; lenTest++)
++      {
++        UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
++        UInt32 lenToPosState = GetLenToPosState(lenTest);
++        COptimal *opt;
++        if (curBack < kNumFullDistances)
++          curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
++        else
++          curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
++        
++        opt = &p->opt[cur + lenTest];
++        if (curAndLenPrice < opt->price) 
++        {
++          opt->price = curAndLenPrice;
++          opt->posPrev = cur;
++          opt->backPrev = curBack + LZMA_NUM_REPS;
++          opt->prev1IsChar = False;
++        }
++
++        if (/*_maxMode && */lenTest == matchDistances[offs])
++        {
++          /* Try Match + Literal + Rep0 */
++          const Byte *data2 = data - (curBack + 1);
++          UInt32 lenTest2 = lenTest + 1;
++          UInt32 limit = lenTest2 + p->numFastBytes;
++          UInt32 nextRepMatchPrice;
++          if (limit > numAvailableBytesFull)
++            limit = numAvailableBytesFull;
++          for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
++          lenTest2 -= lenTest + 1;
++          if (lenTest2 >= 2)
++          {
++            UInt32 state2 = kMatchNextStates[state];
++            UInt32 posStateNext = (position + lenTest) & p->pbMask;
++            UInt32 curAndLenCharPrice = curAndLenPrice + 
++                GET_PRICE_0(p->isMatch[state2][posStateNext]) +
++                LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
++                    data[lenTest], data2[lenTest], p->ProbPrices);
++            state2 = kLiteralNextStates[state2];
++            posStateNext = (posStateNext + 1) & p->pbMask;
++            nextRepMatchPrice = curAndLenCharPrice + 
++                GET_PRICE_1(p->isMatch[state2][posStateNext]) +
++                GET_PRICE_1(p->isRep[state2]);
++            
++            /* for (; lenTest2 >= 2; lenTest2--) */
++            {
++              UInt32 offset = cur + lenTest + 1 + lenTest2;
++              UInt32 curAndLenPrice;
++              COptimal *opt;
++              while (lenEnd < offset)
++                p->opt[++lenEnd].price = kInfinityPrice;
++              curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
++              opt = &p->opt[offset];
++              if (curAndLenPrice < opt->price) 
++              {
++                opt->price = curAndLenPrice;
++                opt->posPrev = cur + lenTest + 1;
++                opt->backPrev = 0;
++                opt->prev1IsChar = True;
++                opt->prev2 = True;
++                opt->posPrev2 = cur;
++                opt->backPrev2 = curBack + LZMA_NUM_REPS;
++              }
++            }
++          }
++          offs += 2;
++          if (offs == numDistancePairs)
++            break;
++          curBack = matchDistances[offs + 1];
++          if (curBack >= kNumFullDistances)
++            GetPosSlot2(curBack, posSlot);
++        }
++      }
++    }
++  }
++}
++
++#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
++
++static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
++{
++  UInt32 numAvailableBytes = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
++  UInt32 lenMain, numDistancePairs;
++  const Byte *data;
++  UInt32 repLens[LZMA_NUM_REPS];
++  UInt32 repMaxIndex, i;
++  UInt32 *matchDistances;
++  UInt32 backMain;
++
++  if (!p->longestMatchWasFound)
++  {
++    lenMain = ReadMatchDistances(p, &numDistancePairs);
++  }
++  else
++  {
++    lenMain = p->longestMatchLength;
++    numDistancePairs = p->numDistancePairs;
++    p->longestMatchWasFound = False;
++  }
++
++  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
++  if (numAvailableBytes > LZMA_MATCH_LEN_MAX)
++    numAvailableBytes = LZMA_MATCH_LEN_MAX;
++  if (numAvailableBytes < 2)
++  {
++    *backRes = (UInt32)(-1);
++    return 1;
++  }
++
++  repMaxIndex = 0;
++
++  for (i = 0; i < LZMA_NUM_REPS; i++)
++  {
++    const Byte *data2 = data - (p->reps[i] + 1);
++    UInt32 len;
++    if (data[0] != data2[0] || data[1] != data2[1])
++    {
++      repLens[i] = 0;
++      continue;
++    }
++    for (len = 2; len < numAvailableBytes && data[len] == data2[len]; len++);
++    if (len >= p->numFastBytes)
++    {
++      *backRes = i;
++      MovePos(p, len - 1);
++      return len;
++    }
++    repLens[i] = len;
++    if (len > repLens[repMaxIndex])
++      repMaxIndex = i;
++  }
++  matchDistances = p->matchDistances;
++  if (lenMain >= p->numFastBytes)
++  {
++    *backRes = matchDistances[numDistancePairs - 1] + LZMA_NUM_REPS; 
++    MovePos(p, lenMain - 1);
++    return lenMain;
++  }
++
++  backMain = 0; /* for GCC */
++  if (lenMain >= 2)
++  {
++    backMain = matchDistances[numDistancePairs - 1];
++    while (numDistancePairs > 2 && lenMain == matchDistances[numDistancePairs - 4] + 1)
++    {
++      if (!ChangePair(matchDistances[numDistancePairs - 3], backMain))
++        break;
++      numDistancePairs -= 2;
++      lenMain = matchDistances[numDistancePairs - 2];
++      backMain = matchDistances[numDistancePairs - 1];
++    }
++    if (lenMain == 2 && backMain >= 0x80)
++      lenMain = 1;
++  }
++
++  if (repLens[repMaxIndex] >= 2)
++  {
++    if (repLens[repMaxIndex] + 1 >= lenMain || 
++        (repLens[repMaxIndex] + 2 >= lenMain && (backMain > (1 << 9))) ||
++        (repLens[repMaxIndex] + 3 >= lenMain && (backMain > (1 << 15))))
++    {
++      UInt32 lenRes;
++      *backRes = repMaxIndex;
++      lenRes = repLens[repMaxIndex];
++      MovePos(p, lenRes - 1);
++      return lenRes;
++    }
++  }
++  
++  if (lenMain >= 2 && numAvailableBytes > 2)
++  {
++    UInt32 i;
++    numAvailableBytes = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
++    p->longestMatchLength = ReadMatchDistances(p, &p->numDistancePairs);
++    if (p->longestMatchLength >= 2)
++    {
++      UInt32 newDistance = matchDistances[p->numDistancePairs - 1];
++      if ((p->longestMatchLength >= lenMain && newDistance < backMain) || 
++          (p->longestMatchLength == lenMain + 1 && !ChangePair(backMain, newDistance)) ||
++          (p->longestMatchLength > lenMain + 1) ||
++          (p->longestMatchLength + 1 >= lenMain && lenMain >= 3 && ChangePair(newDistance, backMain)))
++      {
++        p->longestMatchWasFound = True;
++        *backRes = (UInt32)(-1);
++        return 1;
++      }
++    }
++    data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
++    for (i = 0; i < LZMA_NUM_REPS; i++)
++    {
++      UInt32 len;
++      const Byte *data2 = data - (p->reps[i] + 1);
++      if (data[1] != data2[1] || data[2] != data2[2])
++      {
++        repLens[i] = 0;
++        continue;
++      }
++      for (len = 2; len < numAvailableBytes && data[len] == data2[len]; len++);
++      if (len + 1 >= lenMain)
++      {
++        p->longestMatchWasFound = True;
++        *backRes = (UInt32)(-1);
++        return 1;
++      }
++    }
++    *backRes = backMain + LZMA_NUM_REPS; 
++    MovePos(p, lenMain - 2);
++    return lenMain;
++  }
++  *backRes = (UInt32)(-1);
++  return 1;
++}
++
++static void WriteEndMarker(CLzmaEnc *p, UInt32 posState)
++{
++  UInt32 len;
++  RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
++  RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
++  p->state = kMatchNextStates[p->state];
++  len = LZMA_MATCH_LEN_MIN;
++  LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
++  RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1);
++  RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits);
++  RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
++}
++
++static SRes CheckErrors(CLzmaEnc *p)
++{
++  if (p->result != SZ_OK)
++    return p->result;
++  if (p->rc.res != SZ_OK)
++    p->result = SZ_ERROR_WRITE;
++  if (p->matchFinderBase.result != SZ_OK)
++    p->result = SZ_ERROR_READ;
++  if (p->result != SZ_OK)
++    p->finished = True;
++  return p->result;
++}
++
++static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
++{
++  /* ReleaseMFStream(); */
++  p->finished = True;
++  if (p->writeEndMark)
++    WriteEndMarker(p, nowPos & p->pbMask);
++  RangeEnc_FlushData(&p->rc);
++  RangeEnc_FlushStream(&p->rc);
++  return CheckErrors(p);
++}
++
++static void FillAlignPrices(CLzmaEnc *p)
++{
++  UInt32 i;
++  for (i = 0; i < kAlignTableSize; i++)
++    p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
++  p->alignPriceCount = 0;
++}
++
++static void FillDistancesPrices(CLzmaEnc *p)
++{
++  UInt32 tempPrices[kNumFullDistances];
++  UInt32 i, lenToPosState;
++  for (i = kStartPosModelIndex; i < kNumFullDistances; i++)
++  { 
++    UInt32 posSlot = GetPosSlot1(i);
++    UInt32 footerBits = ((posSlot >> 1) - 1);
++    UInt32 base = ((2 | (posSlot & 1)) << footerBits);
++    tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices);
++  }
++
++  for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++)
++  {
++    UInt32 posSlot;
++    const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState];
++    UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState];
++    for (posSlot = 0; posSlot < p->distTableSize; posSlot++)
++      posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices);
++    for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++)
++      posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
++
++    {
++      UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
++      UInt32 i;
++      for (i = 0; i < kStartPosModelIndex; i++)
++        distancesPrices[i] = posSlotPrices[i];
++      for (; i < kNumFullDistances; i++)
++        distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i];
++    }
++  }
++  p->matchPriceCount = 0;
++}
++
++void LzmaEnc_Construct(CLzmaEnc *p)
++{
++  RangeEnc_Construct(&p->rc);
++  MatchFinder_Construct(&p->matchFinderBase);
++  #ifdef COMPRESS_MF_MT
++  MatchFinderMt_Construct(&p->matchFinderMt);
++  p->matchFinderMt.MatchFinder = &p->matchFinderBase;
++  #endif
++
++  {
++    CLzmaEncProps props;
++    LzmaEncProps_Init(&props);
++    LzmaEnc_SetProps(p, &props);
++  }
++
++  #ifndef LZMA_LOG_BSR
++  LzmaEnc_FastPosInit(p->g_FastPos);
++  #endif
++
++  LzmaEnc_InitPriceTables(p->ProbPrices);
++  p->litProbs = 0;
++  p->saveState.litProbs = 0;
++}
++
++CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)
++{
++  void *p;
++  p = alloc->Alloc(alloc, sizeof(CLzmaEnc));
++  if (p != 0)
++    LzmaEnc_Construct((CLzmaEnc *)p);
++  return p;
++}
++
++void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
++{
++  alloc->Free(alloc, p->litProbs);
++  alloc->Free(alloc, p->saveState.litProbs);
++  p->litProbs = 0;
++  p->saveState.litProbs = 0;
++}
++
++void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  #ifdef COMPRESS_MF_MT
++  MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
++  #endif
++  MatchFinder_Free(&p->matchFinderBase, allocBig);
++  LzmaEnc_FreeLits(p, alloc);
++  RangeEnc_Free(&p->rc, alloc);
++}
++
++void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
++  alloc->Free(alloc, p);
++}
++
++static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize)
++{
++  UInt32 nowPos32, startPos32;
++  if (p->inStream != 0)
++  {
++    p->matchFinderBase.stream = p->inStream;
++    p->matchFinder.Init(p->matchFinderObj);
++    p->inStream = 0;
++  }
++
++  if (p->finished)
++    return p->result;
++  RINOK(CheckErrors(p));
++
++  nowPos32 = (UInt32)p->nowPos64;
++  startPos32 = nowPos32;
++
++  if (p->nowPos64 == 0)
++  {
++    UInt32 numDistancePairs;
++    Byte curByte;
++    if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
++      return Flush(p, nowPos32);
++    ReadMatchDistances(p, &numDistancePairs);
++    RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0);
++    p->state = kLiteralNextStates[p->state];
++    curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset);
++    LitEnc_Encode(&p->rc, p->litProbs, curByte);
++    p->additionalOffset--;
++    nowPos32++;
++  }
++
++  if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
++  for (;;)
++  {
++    UInt32 pos, len, posState;
++
++    if (p->fastMode)
++      len = GetOptimumFast(p, &pos);
++    else
++      len = GetOptimum(p, nowPos32, &pos);
++
++    #ifdef SHOW_STAT2
++    printf("\n pos = %4X,   len = %d   pos = %d", nowPos32, len, pos);
++    #endif
++
++    posState = nowPos32 & p->pbMask;
++    if (len == 1 && pos == 0xFFFFFFFF)
++    {
++      Byte curByte;
++      CLzmaProb *probs;
++      const Byte *data;
++
++      RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0);
++      data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
++      curByte = *data;
++      probs = LIT_PROBS(nowPos32, *(data - 1));
++      if (IsCharState(p->state))
++        LitEnc_Encode(&p->rc, probs, curByte);
++      else
++        LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1));
++      p->state = kLiteralNextStates[p->state];
++    }
++    else
++    {
++      RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
++      if (pos < LZMA_NUM_REPS)
++      {
++        RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1);
++        if (pos == 0)
++        {
++          RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0);
++          RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1));
++        }
++        else
++        {
++          UInt32 distance = p->reps[pos];
++          RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1);
++          if (pos == 1)
++            RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0);
++          else
++          {
++            RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1);
++            RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2);
++            if (pos == 3)
++              p->reps[3] = p->reps[2];
++            p->reps[2] = p->reps[1];
++          }
++          p->reps[1] = p->reps[0];
++          p->reps[0] = distance;
++        }
++        if (len == 1)
++          p->state = kShortRepNextStates[p->state];
++        else
++        {
++          LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
++          p->state = kRepNextStates[p->state];
++        }
++      }
++      else
++      {
++        UInt32 posSlot;
++        RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
++        p->state = kMatchNextStates[p->state];
++        LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
++        pos -= LZMA_NUM_REPS;
++        GetPosSlot(pos, posSlot);
++        RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
++        
++        if (posSlot >= kStartPosModelIndex)
++        {
++          UInt32 footerBits = ((posSlot >> 1) - 1);
++          UInt32 base = ((2 | (posSlot & 1)) << footerBits);
++          UInt32 posReduced = pos - base;
++
++          if (posSlot < kEndPosModelIndex)
++            RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced);
++          else
++          {
++            RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
++            RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
++            p->alignPriceCount++;
++          }
++        }
++        p->reps[3] = p->reps[2];
++        p->reps[2] = p->reps[1];
++        p->reps[1] = p->reps[0];
++        p->reps[0] = pos;
++        p->matchPriceCount++;
++      }
++    }
++    p->additionalOffset -= len;
++    nowPos32 += len;
++    if (p->additionalOffset == 0)
++    {
++      UInt32 processed;
++      if (!p->fastMode)
++      {
++        if (p->matchPriceCount >= (1 << 7))
++          FillDistancesPrices(p);
++        if (p->alignPriceCount >= kAlignTableSize)
++          FillAlignPrices(p);
++      }
++      if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
++        break;
++      processed = nowPos32 - startPos32;
++      if (useLimits)
++      {
++        if (processed + kNumOpts + 300 >= maxUnpackSize ||
++            RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize)
++          break;
++      }
++      else if (processed >= (1 << 15))
++      {
++        p->nowPos64 += nowPos32 - startPos32;
++        return CheckErrors(p);
++      }
++    }
++  }
++  p->nowPos64 += nowPos32 - startPos32;
++  return Flush(p, nowPos32);
++}
++
++#define kBigHashDicLimit ((UInt32)1 << 24)
++
++static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  UInt32 beforeSize = kNumOpts;
++  Bool btMode;
++  if (!RangeEnc_Alloc(&p->rc, alloc))
++    return SZ_ERROR_MEM;
++  btMode = (p->matchFinderBase.btMode != 0);
++  #ifdef COMPRESS_MF_MT
++  p->mtMode = (p->multiThread && !p->fastMode && btMode);
++  #endif
++
++  {
++    unsigned lclp = p->lc + p->lp;
++    if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp)
++    {
++      LzmaEnc_FreeLits(p, alloc);
++      p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
++      p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
++      if (p->litProbs == 0 || p->saveState.litProbs == 0)
++      {
++        LzmaEnc_FreeLits(p, alloc);
++        return SZ_ERROR_MEM;
++      }
++      p->lclp = lclp;
++    }
++  }
++
++  p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit);
++
++  if (beforeSize + p->dictSize < keepWindowSize)
++    beforeSize = keepWindowSize - p->dictSize;
++
++  #ifdef COMPRESS_MF_MT
++  if (p->mtMode)
++  {
++    RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
++    p->matchFinderObj = &p->matchFinderMt;
++    MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
++  }
++  else
++  #endif
++  {
++    if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
++      return SZ_ERROR_MEM;
++    p->matchFinderObj = &p->matchFinderBase;
++    MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
++  }
++  return SZ_OK;
++}
++
++void LzmaEnc_Init(CLzmaEnc *p)
++{
++  UInt32 i;
++  p->state = 0;
++  for(i = 0 ; i < LZMA_NUM_REPS; i++)
++    p->reps[i] = 0;
++
++  RangeEnc_Init(&p->rc);
++
++
++  for (i = 0; i < kNumStates; i++)
++  {
++    UInt32 j;
++    for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
++    {
++      p->isMatch[i][j] = kProbInitValue;
++      p->isRep0Long[i][j] = kProbInitValue;
++    }
++    p->isRep[i] = kProbInitValue;
++    p->isRepG0[i] = kProbInitValue;
++    p->isRepG1[i] = kProbInitValue;
++    p->isRepG2[i] = kProbInitValue;
++  }
++
++  {
++    UInt32 num = 0x300 << (p->lp + p->lc);
++    for (i = 0; i < num; i++)
++      p->litProbs[i] = kProbInitValue;
++  }
++
++  {
++    for (i = 0; i < kNumLenToPosStates; i++)
++    {
++      CLzmaProb *probs = p->posSlotEncoder[i];
++      UInt32 j;
++      for (j = 0; j < (1 << kNumPosSlotBits); j++)
++        probs[j] = kProbInitValue;
++    }
++  }
++  {
++    for(i = 0; i < kNumFullDistances - kEndPosModelIndex; i++)
++      p->posEncoders[i] = kProbInitValue;
++  }
++
++  LenEnc_Init(&p->lenEnc.p);
++  LenEnc_Init(&p->repLenEnc.p);
++
++  for (i = 0; i < (1 << kNumAlignBits); i++)
++    p->posAlignEncoder[i] = kProbInitValue;
++
++  p->longestMatchWasFound = False;
++  p->optimumEndIndex = 0;
++  p->optimumCurrentIndex = 0;
++  p->additionalOffset = 0;
++
++  p->pbMask = (1 << p->pb) - 1;
++  p->lpMask = (1 << p->lp) - 1;
++}
++
++void LzmaEnc_InitPrices(CLzmaEnc *p)
++{
++  if (!p->fastMode)
++  {
++    FillDistancesPrices(p);
++    FillAlignPrices(p);
++  }
++
++  p->lenEnc.tableSize = 
++  p->repLenEnc.tableSize = 
++      p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
++  LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices);
++  LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices);
++}
++
++static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  UInt32 i;
++  for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++)
++    if (p->dictSize <= ((UInt32)1 << i))
++      break;
++  p->distTableSize = i * 2;
++
++  p->finished = False;
++  p->result = SZ_OK;
++  RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
++  LzmaEnc_Init(p);
++  LzmaEnc_InitPrices(p);
++  p->nowPos64 = 0;
++  return SZ_OK;
++}
++
++static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqInStream *inStream, ISeqOutStream *outStream,
++    ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  p->inStream = inStream;
++  p->rc.outStream = outStream;
++  return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
++}
++
++SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, 
++    ISeqInStream *inStream, UInt32 keepWindowSize,
++    ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  p->inStream = inStream;
++  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
++}
++
++static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
++{
++  p->seqBufInStream.funcTable.Read = MyRead;
++  p->seqBufInStream.data = src;
++  p->seqBufInStream.rem = srcLen;
++}
++
++SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
++    UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  LzmaEnc_SetInputBuf(p, src, srcLen);
++  p->inStream = &p->seqBufInStream.funcTable;
++  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
++}
++
++void LzmaEnc_Finish(CLzmaEncHandle pp)
++{
++  #ifdef COMPRESS_MF_MT
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  if (p->mtMode)
++    MatchFinderMt_ReleaseStream(&p->matchFinderMt);
++  #endif
++}
++
++typedef struct _CSeqOutStreamBuf
++{
++  ISeqOutStream funcTable;
++  Byte *data;
++  SizeT rem;
++  Bool overflow;
++} CSeqOutStreamBuf;
++
++static size_t MyWrite(void *pp, const void *data, size_t size)
++{
++  CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp;
++  if (p->rem < size)
++  {
++    size = p->rem;
++    p->overflow = True;
++  }
++  memcpy(p->data, data, size);
++  p->rem -= size;
++  p->data += size;
++  return size;
++}
++
++
++UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
++{
++  const CLzmaEnc *p = (CLzmaEnc *)pp;
++  return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
++}
++
++const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
++{
++  const CLzmaEnc *p = (CLzmaEnc *)pp;
++  return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
++}
++
++SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, 
++    Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  UInt64 nowPos64;
++  SRes res;
++  CSeqOutStreamBuf outStream;
++
++  outStream.funcTable.Write = MyWrite;
++  outStream.data = dest;
++  outStream.rem = *destLen;
++  outStream.overflow = False;
++
++  p->writeEndMark = False;
++  p->finished = False;
++  p->result = SZ_OK;
++
++  if (reInit)
++    LzmaEnc_Init(p);
++  LzmaEnc_InitPrices(p);
++  nowPos64 = p->nowPos64;
++  RangeEnc_Init(&p->rc);
++  p->rc.outStream = &outStream.funcTable;
++
++  res = LzmaEnc_CodeOneBlock(pp, True, desiredPackSize, *unpackSize);
++  
++  *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
++  *destLen -= outStream.rem;
++  if (outStream.overflow)
++    return SZ_ERROR_OUTPUT_EOF;
++
++  return res;
++}
++
++SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
++    ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  SRes res = SZ_OK;
++
++  #ifdef COMPRESS_MF_MT
++  Byte allocaDummy[0x300];
++  int i = 0;
++  for (i = 0; i < 16; i++)
++    allocaDummy[i] = (Byte)i;
++  #endif
++
++  RINOK(LzmaEnc_Prepare(pp, inStream, outStream, alloc, allocBig));
++
++  for (;;)
++  {
++    res = LzmaEnc_CodeOneBlock(pp, False, 0, 0);
++    if (res != SZ_OK || p->finished != 0)
++      break;
++    if (progress != 0)
++    {
++      res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
++      if (res != SZ_OK)
++      {
++        res = SZ_ERROR_PROGRESS;
++        break;
++      }
++    }
++  }
++  LzmaEnc_Finish(pp);
++  return res;
++}
++
++SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
++{
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++  int i;
++  UInt32 dictSize = p->dictSize;
++  if (*size < LZMA_PROPS_SIZE)
++    return SZ_ERROR_PARAM;
++  *size = LZMA_PROPS_SIZE;
++  props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
++
++  for (i = 11; i <= 30; i++)
++  {
++    if (dictSize <= ((UInt32)2 << i))
++    {
++      dictSize = (2 << i);
++      break;
++    }
++    if (dictSize <= ((UInt32)3 << i))
++    {
++      dictSize = (3 << i);
++      break;
++    }
++  }
++
++  for (i = 0; i < 4; i++)
++    props[1 + i] = (Byte)(dictSize >> (8 * i));
++  return SZ_OK;
++}
++
++SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
++    int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  SRes res;
++  CLzmaEnc *p = (CLzmaEnc *)pp;
++
++  CSeqOutStreamBuf outStream;
++
++  LzmaEnc_SetInputBuf(p, src, srcLen);
++
++  outStream.funcTable.Write = MyWrite;
++  outStream.data = dest;
++  outStream.rem = *destLen;
++  outStream.overflow = False;
++
++  p->writeEndMark = writeEndMark;
++  res = LzmaEnc_Encode(pp, &outStream.funcTable, &p->seqBufInStream.funcTable, 
++      progress, alloc, allocBig);
++
++  *destLen -= outStream.rem;
++  if (outStream.overflow)
++    return SZ_ERROR_OUTPUT_EOF;
++  return res;
++}
++
++SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
++    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, 
++    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
++{
++  CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
++  SRes res;
++  if (p == 0)
++    return SZ_ERROR_MEM;
++
++  res = LzmaEnc_SetProps(p, props);
++  if (res == SZ_OK)
++  {
++    res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
++    if (res == SZ_OK)
++      res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
++          writeEndMark, progress, alloc, allocBig);
++  }
++
++  LzmaEnc_Destroy(p, alloc, allocBig);
++  return res;
++}
+--- a/mkfs.jffs2.c
++++ b/mkfs.jffs2.c
+@@ -1658,11 +1658,11 @@ int main(int argc, char **argv)
+                                                 }
+                                                 erase_block_size *= units;
+-                                                /* If it's less than 8KiB, they're not allowed */
+-                                                if (erase_block_size < 0x2000) {
+-                                                        fprintf(stderr, "Erase size 0x%x too small. Increasing to 8KiB minimum\n",
++                                                /* If it's less than 4KiB, they're not allowed */
++                                                if (erase_block_size < 0x1000) {
++                                                        fprintf(stderr, "Erase size 0x%x too small. Increasing to 4KiB minimum\n",
+                                                                         erase_block_size);
+-                                                        erase_block_size = 0x2000;
++                                                        erase_block_size = 0x1000;
+                                                 }
+                                                 break;
+                                         }
diff --git a/utils/ntfs-3g/Makefile b/utils/ntfs-3g/Makefile
new file mode 100644 (file)
index 0000000..6d95a4f
--- /dev/null
@@ -0,0 +1,214 @@
+#
+# Copyright (C) 2007-2014 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:=ntfs-3g
+PKG_RELEASE:=1
+
+PKG_VERSION:=2014.2.15
+PKG_SOURCE:=$(PKG_NAME)_ntfsprogs-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.tuxera.com/opensource/
+PKG_MD5SUM:=f11d563816249d730a00498983485f3a
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+# release contains fuseext/int hint
+PKG_RELEASE:=$(PKG_RELEASE)$(if $(CONFIG_PACKAGE_NTFS-3G_USE_LIBFUSE),-fuseext,-fuseint)
+
+# define build dir, respect fuseext/int
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ntfs-3g/common
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.tuxera.com
+  SUBMENU:=Filesystem
+  TITLE:=Stable Read/Write NTFS Driver
+  MAINTAINER:=Bud <wrt_buddhay@gmx.net>
+endef
+
+define Package/ntfs-3g
+  $(call Package/ntfs-3g/common)
+  DEPENDS+= +kmod-fuse +PACKAGE_NTFS-3G_USE_LIBFUSE:libfuse +libpthread
+endef
+
+define Package/ntfs-3g/description
+  Ntfs-3g is a NTFS driver, which can create, remove, rename,
+  move files, directories, hard links, and streams. It can read
+  and write files, including streams and sparse files. It can
+  handle special files like symbolic links, devices, and FIFOs.
+  Moreover it can also read transparently compressed files.
+
+  Contains:
+   - ntfs-3g
+   - ntfs-3g.probe
+   - mount.ntfs-3g (symlink to ntfs-3g)
+
+endef
+
+define Package/ntfs-3g/config
+config PACKAGE_NTFS-3G_USE_LIBFUSE
+       bool "use external FUSE library, selects package libfuse"
+       depends on PACKAGE_ntfs-3g
+       ---help---
+       Ntfs-3g by default uses a minimalized lite version of FUSE.
+       If libfuse is part of your filesystem anyway (because of sshfs, owfs
+       etc.) it makes sense to activate this option and save some kilobytes
+       of space.
+
+endef
+
+define Package/ntfs-3g-low
+  $(call Package/ntfs-3g/common)
+  TITLE:=lowntfs-3g (alternative using the fuse low-level interface)
+  DEPENDS+= +ntfs-3g
+endef
+
+define Package/ntfs-3g-low/description
+  Contains:
+   - lowntfs-3g
+   - mount.lowntfs-3g (symlink to lowntfs-3g)
+
+  A driver variant using the fuse low-level interface missing some of the
+  enhanced functionality for streams or the like. You might want to check:
+  http://www.tuxera.com/community/ntfs-3g-manual/
+
+endef
+
+define Package/ntfs-3g-utils
+  $(call Package/ntfs-3g/common)
+  TITLE:=ntfs-3g utilities (ntfs-3g.secaudit, ntfs-3g.usermap)
+  DEPENDS+= +ntfs-3g
+endef
+
+define Package/ntfs-3g-utils/description
+  Additional ntfs-3g utilities. Not included by default for size
+  considerations. All binaries except ntfs-3g, ntfs-3g.probe.
+
+  Currently:
+   - ntfs-3g.secaudit
+   - ntfs-3g.usermap
+
+endef
+
+# TODO: write a proper description
+# new in 2001.4.12
+define Package/ntfsprogs_ntfs-3g
+  $(call Package/ntfs-3g/common)
+  TITLE:=ntfsprogs (ntfs-3g)
+  DEPENDS+= +ntfs-3g +libgcrypt +libuuid
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-uuid
+
+# configure/make according selection
+ifdef CONFIG_PACKAGE_NTFS-3G_USE_LIBFUSE
+       CONFIGURE_ARGS += --with-fuse=external
+       TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/include/fuse $(TARGET_CPPFLAGS)
+else
+       CONFIGURE_ARGS += --with-fuse=internal
+       TARGET_CPPFLAGS:=-I../include/fuse-lite $(TARGET_CPPFLAGS)
+endif
+
+# enable disable ntfsprogs
+ifneq ($(CONFIG_PACKAGE_ntfsprogs_ntfs-3g)$(SDK)$(DEVELOPER),)
+       CONFIGURE_ARGS += --enable-ntfsprogs
+else
+       CONFIGURE_ARGS += --disable-ntfsprogs
+endif
+
+# redefine prepare to extract to our build dir
+# apply patches
+define Build/Prepare
+       rm -rf $(PKG_BUILD_DIR)/
+       mkdir -p $(PKG_BUILD_DIR)/
+       $(TAR) -xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip 1
+       $(Build/Patch)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP)   $(PKG_INSTALL_DIR)/usr/include/ntfs-3g $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP)   $(PKG_INSTALL_DIR)/usr/lib/libntfs-3g.{la,a,so*} $(1)/usr/lib/
+endef
+
+define Package/ntfs-3g/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ntfs-3g{,.probe} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libntfs-3g.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/sbin
+       $(CP) $(PKG_INSTALL_DIR)/sbin/mount.ntfs-3g $(1)/sbin/
+endef
+
+define Package/ntfs-3g/postinst
+#!/bin/sh
+FILE="$${IPKG_INSTROOT}/etc/filesystems"
+ID="ntfs-3g"
+
+if ! [ -f '/etc/filesystems' ]; then
+       echo "Create '$$FILE'."
+       touch "$$FILE"
+fi
+
+if ! grep -q -e '^ntfs-3g$$' "$$FILE"; then
+       echo "Add '$$ID' to known filesystems."
+       echo "$$ID" >> "$$FILE"
+fi
+
+endef
+
+define Package/ntfs-3g-low/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lowntfs-3g $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/sbin
+       $(CP) $(PKG_INSTALL_DIR)/sbin/mount.lowntfs-3g $(1)/sbin/
+endef
+
+define Package/ntfs-3g-low/postinst
+#!/bin/sh
+FILE="$${IPKG_INSTROOT}/etc/filesystems"
+ID="lowntfs-3g"
+
+if ! [ -f '/etc/filesystems' ]; then
+       echo "Create '$$FILE'."
+       touch "$$FILE"
+fi
+
+if ! grep -q -e '^ntfs-3g$$' "$$FILE"; then
+       echo "Add '$$ID' to known filesystems."
+       echo "$$ID" >> "$$FILE"
+fi
+
+endef
+
+define Package/ntfs-3g-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(FIND) $(PKG_INSTALL_DIR)/usr/bin/ -type f ! -name ntfs-3g.probe ! -name ntfs-3g -exec $(INSTALL_BIN) {} $(1)/usr/bin/ \;
+endef
+
+define Package/ntfsprogs_ntfs-3g/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(CP) $(PKG_INSTALL_DIR)/sbin/mkfs.ntfs $(1)/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(FIND) $(PKG_INSTALL_DIR)/usr/bin/ -type f ! -regex '.*[^/]*ntfs-3g[^/]*' -exec $(INSTALL_BIN) {} $(1)/usr/bin/ \;
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ntfs-3g))
+$(eval $(call BuildPackage,ntfs-3g-low))
+$(eval $(call BuildPackage,ntfs-3g-utils))
+$(eval $(call BuildPackage,ntfsprogs_ntfs-3g))
diff --git a/utils/ntfsprogs/Makefile b/utils/ntfsprogs/Makefile
new file mode 100644 (file)
index 0000000..e9a976c
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ntfsprogs
+PKG_VERSION:=2.0.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/linux-ntfs
+PKG_MD5SUM:=2c402b647bb7aeb1d3f8ce1cc354fd68
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_DEPENDS:=libgcrypt
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ntfsprogs
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Filesystem
+  TITLE:=Linux-NTFS
+  DEPENDS:=+libuuid
+  URL:=http://www.linux-ntfs.org/
+  MAINTAINER:=Gianluigi Tiesi <sherpya@netfarm.it>
+endef
+
+define Package/ntfsprogs/description
+ Tools for managing NTFS volumes from Linux
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared \
+       --enable-static \
+       --with-uuid \
+       --disable-crypto \
+       --disable-gnome-vfs \
+       --disable-ntfsmount
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ntfs $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libntfs.{la,a,so*} $(1)/usr/lib/
+endef
+
+define Package/ntfsprogs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libntfs.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ntfsfix $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ntfsprogs))
diff --git a/utils/ntfsprogs/patches/001-autoconf_fixes.patch b/utils/ntfsprogs/patches/001-autoconf_fixes.patch
new file mode 100644 (file)
index 0000000..0055159
--- /dev/null
@@ -0,0 +1,52 @@
+--- a/libntfs/Makefile.am
++++ b/libntfs/Makefile.am
+@@ -38,8 +38,8 @@ libntfs_la_CFLAGS = $(LIBNTFS_CFLAGS) \
+       -DLTVERSION_LIBNTFS=\"$(LTVERSION_LIBNTFS)\"
+ if ENABLE_CRYPTO
+-libntfs_la_LDFLAGS += `libgnutls-config --libs` `pkg-config --libs libconfig`
+-libntfs_la_CFLAGS += `libgnutls-config --cflags` `pkg-config --cflags libconfig`
++libntfs_la_LDFLAGS += $(GNUTLS_LIBS) $(libconfig_LIBS)
++libntfs_la_CFLAGS += $(GNUTLS_CFLAGS) $(libconfig_CFLAGS)
+ endif
+ libntfs_la_SOURCES =  \
+--- a/libntfs/Makefile.in
++++ b/libntfs/Makefile.in
+@@ -61,8 +61,8 @@ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+ target_triplet = @target@
+-@ENABLE_CRYPTO_TRUE@am__append_1 = `libgnutls-config --libs` `pkg-config --libs libconfig`
+-@ENABLE_CRYPTO_TRUE@am__append_2 = `libgnutls-config --cflags` `pkg-config --cflags libconfig`
++@ENABLE_CRYPTO_TRUE@am__append_1 = $(GNUTLS_LIBS) $(libconfig_LIBS)
++@ENABLE_CRYPTO_TRUE@am__append_2 = $(GNUTLS_CFLAGS) $(libconfig_CFLAGS)
+ subdir = libntfs
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/libntfs-gnomevfs.8.in $(srcdir)/libntfs.8.in \
+--- a/ntfsprogs/Makefile.am
++++ b/ntfsprogs/Makefile.am
+@@ -125,8 +125,8 @@ ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS)
+ if ENABLE_CRYPTO
+ ntfsdecrypt_SOURCES   = ntfsdecrypt.c utils.c utils.h
+ ntfsdecrypt_LDADD     = $(AM_LIBS)
+-ntfsdecrypt_LDFLAGS   = $(AM_LFLAGS) `libgnutls-config --libs`
+-ntfsdecrypt_CFLAGS    = `libgnutls-config --cflags`
++ntfsdecrypt_LDFLAGS   = $(AM_LFLAGS) $(GNUTLS_LIBS)
++ntfsdecrypt_CFLAGS    = $(GNUTLS_CFLAGS)
+ endif
+ # Extra targets
+--- a/ntfsprogs/Makefile.in
++++ b/ntfsprogs/Makefile.in
+@@ -449,8 +449,8 @@ ntfsdump_logfile_LDADD = $(AM_LIBS)
+ ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS)
+ @ENABLE_CRYPTO_TRUE@ntfsdecrypt_SOURCES = ntfsdecrypt.c utils.c utils.h
+ @ENABLE_CRYPTO_TRUE@ntfsdecrypt_LDADD = $(AM_LIBS)
+-@ENABLE_CRYPTO_TRUE@ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) `libgnutls-config --libs`
+-@ENABLE_CRYPTO_TRUE@ntfsdecrypt_CFLAGS = `libgnutls-config --cflags`
++@ENABLE_CRYPTO_TRUE@ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) $(GNUTLS_LIBS)
++@ENABLE_CRYPTO_TRUE@ntfsdecrypt_CFLAGS = $(GNUTLS_CFLAGS)
+ all: all-am
+ .SUFFIXES:
diff --git a/utils/nut/Makefile b/utils/nut/Makefile
new file mode 100644 (file)
index 0000000..c21375c
--- /dev/null
@@ -0,0 +1,302 @@
+#
+# Copyright Â© 2006-2012 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:=nut
+PKG_VERSION:=2.6.5
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.6/
+PKG_MD5SUM:=e6eac4fa04baff0d0a827d64efe81a7e
+
+PKG_BUILD_DEPENDS:=libusb-compat libnetsnmp
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_BUILD_PARALLEL:=1
+
+define Package/nut/Default
+  URL:=http://www.networkupstools.org/
+  TITLE:= Network UPS Tools
+  DEPENDS:=@USB_SUPPORT +libnetsnmp +libpthread
+  SECTION:=utils
+  CATEGORY:=Utilities
+endef
+
+define Package/nut/description
+  Network UPS Tools (NUT) is a client/server monitoring system that
+  allows computers to share uninterruptible power supply (UPS) and
+  power distribution unit (PDU) hardware. Clients access the hardware
+  through the server, and are notified whenever the power status
+  changes.
+endef
+
+define Package/nut
+$(call Package/nut/Default)
+  MENU:=1
+#  TITLE+= (common)
+endef
+
+define Package/nut-server
+$(call Package/nut/Default)
+  TITLE+= (server)
+  DEPENDS+= nut
+endef
+
+define Package/nut-client
+$(call Package/nut/Default)
+  TITLE+= (client)
+  DEPENDS+= nut
+endef
+
+define Package/nut-logger
+$(call Package/nut/Default)
+  TITLE+= (logger)
+  DEPENDS+= nut
+endef
+
+define Package/nut-monitor
+$(call Package/nut/Default)
+  TITLE+= (monitor)
+  DEPENDS+= nut
+endef
+
+define Package/nut/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/etc/nut
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libupsclient.so* $(1)/usr/lib/
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf
+       ln -sf /var/run/ups.conf $(1)/etc/nut/ups.conf
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib
+endef
+
+define Package/nut/conffiles
+/etc/nut/nut.conf
+endef
+
+define Package/nut-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin
+endef
+
+define Package/nut-server/install
+       $(INSTALL_DIR) $(1)/etc/nut
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/lib/nut
+       $(INSTALL_DIR) $(1)/usr/share/nut
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ups.init $(1)/etc/init.d/ups
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/nut/upsdrvctl $(1)/lib/nut
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.conf.sample $(1)/etc/nut/upsd.conf
+       ln -sf /var/run/upsd.users $(1)/etc/nut/upsd.users
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/cmdvartab
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/driver.list
+endef
+
+define Package/nut-server/conffiles
+/etc/nut/upsd.conf
+endef
+
+define Package/nut-logger/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin
+endef
+
+define Package/nut-monitor/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/nut
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/upsmon.init $(1)/etc/init.d/upsmon
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upssched $(1)/usr/sbin
+       ln -sf /var/run/upsmon.conf $(1)/etc/nut/upsmon.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf
+endef
+
+define Package/nut-monitor/conffiles
+/etc/nut/upssched.conf
+endef
+
+define DriverPackage
+  define Package/nut-driver-$(1)
+    $(call Package/nut/Default)
+    TITLE += ($(1) driver)
+    DEPENDS += nut nut-server
+    ifeq ($(1),$(filter $(1),$(USB_LIBUSB_DRIVERLIST)))
+      DEPENDS+=libusb-compat
+    endif
+    ifeq ($(1),$(filter $(1),$(SNMP_DRIVERLIST)))
+      DEPENDS+=libnetsnmp
+    endif
+  endef
+  # Deliberately empty (well, some spaces) in order to trigger a build
+  # failure. It should be overridden by the list below, and when updating
+  # to a new version of nut we will need to provide descriptions for any
+  # new drivers.
+  define Package/nut-driver-$(1)/description
+
+  endef
+  define Package/nut-driver-$(1)/install
+       $(INSTALL_DIR) $$(1)/lib/nut/
+       $(INSTALL_BIN) $$(PKG_INSTALL_DIR)/lib/nut/$(1) $$(1)/lib/nut/
+    ifeq ($(1),clone)
+       # Bundle clone and clone-outlet together
+       $(INSTALL_BIN) $$(PKG_INSTALL_DIR)/lib/nut/$(1)-outlet $$(1)/lib/nut/
+    endif
+  endef
+endef
+
+# These lists are lifted *directly* from drivers/Makefile.am in the nut
+# source tree. This it to make it simpler to keep in sync when updating
+# to a newer version of nut. Do not edit this manually.
+#
+# DO NOT EDIT (except to update with a fresh cut/paste)!
+SERIAL_DRIVERLIST = bcmxcp belkin belkinunv bestfcom    \
+ bestfortress bestuferrups bestups dummy-ups etapro everups     \
+ gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys  \
+ oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino        \
+ safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \
+ blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old
+SNMP_DRIVERLIST = snmp-ups
+USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \
+ blazer_usb richcomm_usb
+# END: DO NOT EDIT!
+
+NUT_DRIVERS := $(filter-out skel clone-outlet,$(SERIAL_DRIVERLIST)) \
+       $(USB_LIBUSB_DRIVERLIST) $(SNMP_DRIVERLIST)
+
+$(foreach d,$(NUT_DRIVERS),$(eval $(call DriverPackage,$(d))))
+
+define DriverDescription
+  define Package/nut-driver-$(1)/description
+    $(2)
+  endef
+endef
+
+$(eval $(call DriverDescription,apcsmart,\
+       Driver for American Power Conversion Smart Protocol UPS equipment))
+$(eval $(call DriverDescription,apcsmart-old,\
+       Driver for American Power Conversion Smart Protocol UPS equipment))
+$(eval $(call DriverDescription,bcmxcp,\
+       Driver for UPSes supporting the serial BCM/XCP protocol))
+$(eval $(call DriverDescription,bcmxcp_usb,\
+       Experimental driver for UPSes supporting the BCM/XCP protocol over USB))
+$(eval $(call DriverDescription,belkin,\
+       Driver for Belkin serial UPS equipment))
+$(eval $(call DriverDescription,belkinunv,\
+       Driver for Belkin "Universal UPS" and compatible))
+$(eval $(call DriverDescription,bestfcom,\
+       Driver for Best Power Fortress/Ferrups))
+$(eval $(call DriverDescription,bestfortress,\
+       Driver for old Best Fortress UPS equipment))
+$(eval $(call DriverDescription,bestuferrups,\
+       Driver for Best Power Micro-Ferrups))
+$(eval $(call DriverDescription,bestups,\
+       Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment))
+$(eval $(call DriverDescription,blazer_ser,\
+       Driver for Megatec/Q1 protocol serial))
+$(eval $(call DriverDescription,blazer_usb,\
+       Driver for Megatec/Q1 protocol USB))
+$(eval $(call DriverDescription,clone,\
+       UPS driver clone))
+$(eval $(call DriverDescription,dummy-ups,\
+       Driver for multi-purpose UPS emulation))
+$(eval $(call DriverDescription,etapro,\
+       Driver for ETA UPS equipment))
+$(eval $(call DriverDescription,everups,\
+       Driver for Ever UPS models))
+$(eval $(call DriverDescription,gamatronic,\
+       Driver for Gamatronic UPS equipment))
+$(eval $(call DriverDescription,genericups,\
+       Driver for contact-closure UPS equipment))
+$(eval $(call DriverDescription,isbmex,\
+       Driver for ISBMEX UPS equipment))
+$(eval $(call DriverDescription,ivtscd,\
+       driver for the IVT Solar Controller Device))
+$(eval $(call DriverDescription,liebert,\
+       Driver for Liebert contact-closure UPS equipment))
+$(eval $(call DriverDescription,liebert-esp2,\
+       Driver for Liebert UPS using the ESP-II protocol))
+$(eval $(call DriverDescription,masterguard,\
+       Driver for Masterguard UPS equipment))
+$(eval $(call DriverDescription,metasys,\
+       Driver for Meta System UPS equipment))
+$(eval $(call DriverDescription,mge-shut,\
+       Driver for SHUT Protocol UPS equipment))
+$(eval $(call DriverDescription,mge-utalk,\
+       Driver for MGE UPS SYSTEMS UTalk protocol equipment))
+$(eval $(call DriverDescription,microdowell,\
+       Driver for Microdowell Enterprise UPS series))
+$(eval $(call DriverDescription,oldmge-shut,\
+       Driver for SHUT Protocol UPS equipment))
+$(eval $(call DriverDescription,oneac,\
+       Driver for Oneac UPS equipment))
+$(eval $(call DriverDescription,optiups,\
+       Driver for Opti-UPS (Viewsonice) UPS and Zinto D (ONLINE-USV) equipment))
+$(eval $(call DriverDescription,powercom,\
+       UPS driver for Powercom/Trust/Advice UPS equipment))
+$(eval $(call DriverDescription,powerpanel,\
+       Driver for PowerPanel Plus compatible UPS equipment))
+$(eval $(call DriverDescription,rhino,\
+       Driver for Brazilian Microsol RHINO UPS equipment))
+$(eval $(call DriverDescription,richcomm_usb,\
+       Driver UPS equipment using Richcomm dry-contact to USB solution))
+$(eval $(call DriverDescription,safenet,\
+       Driver for SafeNet compatible UPS equipment))
+$(eval $(call DriverDescription,solis,\
+       Driver for Brazilian Microsol SOLIS UPS equipment))
+$(eval $(call DriverDescription,tripplite,\
+       Driver for Tripp-Lite SmartPro UPS equipment))
+$(eval $(call DriverDescription,tripplitesu,\
+       Driver for Tripp-Lite SmartOnline (SU) UPS equipment))
+$(eval $(call DriverDescription,tripplite_usb,\
+       Driver for older Tripp Lite USB UPSes (not PDC HID)))
+$(eval $(call DriverDescription,upscode2,\
+       Driver for UPScode II compatible UPS equipment))
+$(eval $(call DriverDescription,usbhid-ups,\
+       Driver for USB/HID UPS equipment))
+$(eval $(call DriverDescription,victronups,\
+       Driver for IMV/Victron UPS unit Match, Match Lite, NetUps))
+$(eval $(call DriverDescription,snmp-ups,\
+       Multi-MIB Driver for SNMP UPS equipment))
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_ARGS += \
+  --without-ssl \
+  --with-pidpath=/var/run \
+  --with-statepath=/var/run \
+  --with-altpidpath=/var/run \
+  --sysconfdir=/etc/nut \
+  --with-drvpath=/lib/nut \
+  --datadir=/usr/share/nut \
+  --with-user=root \
+  --with-group=root \
+  --with-usb \
+  --with-snmp \
+  --without-libltdl \
+  --with-dev
+
+
+$(eval $(call BuildPackage,nut))
+$(eval $(call BuildPackage,nut-client))
+$(eval $(call BuildPackage,nut-server))
+$(eval $(call BuildPackage,nut-monitor))
+$(eval $(call BuildPackage,nut-logger))
+$(foreach d,$(NUT_DRIVERS),$(eval $(call BuildPackage,nut-driver-$(d))))
diff --git a/utils/nut/files/ups.init b/utils/nut/files/ups.init
new file mode 100755 (executable)
index 0000000..90410a3
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh /etc/rc.common
+# Copyright Â© 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+START=50
+
+DEFAULT=/etc/default/nut
+RUN_D=/var/run
+PID_F=$RUN_D/upsd.pid
+UPS_C=$RUN_D/ups.conf
+USERS_C=$RUN_D/upsd.users
+
+nut_user_add() {
+       local cfg="$1"
+       local a
+       local val
+
+       config_get val "$cfg" username "$1"
+       echo "[$val]" >> $USERS_C
+
+       config_get val "$cfg" password
+       echo "  password = $val" >> $USERS_C
+
+       config_get val "$cfg" actions
+       for a in $val; do
+           echo "  actions = $a" >> $USERS_C
+       done
+
+       config_get val "$cfg" instcmds
+       for a in $val; do
+           echo "  instcmds = $a" >> $USERS_C
+       done
+
+       config_get val "$cfg" upsmon
+       if [ -n "$val" ]; then
+           echo "  upsmon $val" >> $USERS_C
+       fi
+}
+
+start() {
+        local in_driver have_drivers
+       config_cb() {
+           if [ "$1" != "driver" ]; then
+               in_driver=
+           else
+               echo "[$2]" >> $UPS_C
+               in_driver=true
+               have_drivers=true
+           fi
+       }
+       option_cb() {
+           if [ "$in_driver" = "true" ]; then
+               echo " $1 = $2" >> $UPS_C
+           fi
+       }
+
+       [ -d $RUN_D ] || mkdir -p $RUN_D
+       echo "# Config file automatically generated from UCI config" > $UPS_C
+       echo "# Config file automatically generated from UCI config" > $USERS_C
+
+       config_load ups
+
+       config_foreach nut_user_add user
+
+       [ -f $DEFAULT ] && . $DEFAULT
+       if [ "$have_drivers" = "true" ]; then
+           $DEBUG /usr/sbin/upsd $OPTIONS
+           $DEBUG /lib/nut/upsdrvctl start
+       fi
+}
+
+nut_driver_stop() {
+       local cfg="$1"
+       local driver
+
+       config_get driver "$cfg" driver
+
+       [ -r /var/run/$driver-$cfg ] && /lib/nut/upsdrvctl stop $cfg
+}
+
+stop() {
+       [ -r $PID_F ] && /usr/sbin/upsd -c stop
+       config_load ups
+       config_foreach nut_driver_stop driver
+}
diff --git a/utils/nut/files/upsmon.init b/utils/nut/files/upsmon.init
new file mode 100755 (executable)
index 0000000..8d6c09e
--- /dev/null
@@ -0,0 +1,144 @@
+#!/bin/sh /etc/rc.common
+# Copyright Â© 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+START=51
+
+DEFAULT=/etc/default/nut
+RUN_D=/var/run
+PID_F=$RUN_D/upsmon.pid
+UPSMON_C=$RUN_D/upsmon.conf
+
+nut_upsmon_conf() {
+       local cfg="$1"
+
+       echo "# Config file automatically generated from UCI config" > $UPSMON_C
+
+       config_get val "$cfg" runas
+       [ -n "$val" ] && echo "RUN_AS_USER $val" >> $PSMON_C
+
+       config_get val "$cfg" minsupplies 1
+       echo "MINSUPPLIES $val" >> $UPSMON_C
+
+       config_get val "$cfg" shutdowncmd "/sbin/halt"
+       echo "SHUTDOWNCMD \"$val\"" >> $UPSMON_C
+
+       config_get val "$cfg" notifycmd
+       [ -n "$val" ] && echo "NOTIFYCMD \"$val\"" >> $UPSMON_C
+
+       config_get val "$cfg" pollfreq 5
+       echo "POLLFREQ $val" >> $UPSMON_C
+
+       config_get val "$cfg" pollfreqalert 5
+       echo "POLLFREQALERT $val" >> $UPSMON_C
+
+       config_get val "$cfg" hostsync 15
+       echo "HOSTSYNC $val" >> $UPSMON_C
+
+       config_get val "$cfg" deadtime 15
+       echo "DEADTIME $val" >> $UPSMON_C
+
+       config_get val "$cfg" powerdownflag /var/run/killpower
+       echo "POWERDOWNFLAG $val" >> $UPSMON_C
+
+       config_get val "$cfg" onlinemsg
+       [ -n "$val" ] && echo "NOTIFYMSG ONLINE \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" onbattmsg
+       [ -n "$val" ] && echo "NOTIFYMSG ONBATT \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" lowbattmsg
+       [ -n "$val" ] && echo "NOTIFYMSG LOWBATT \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" fsdmsg
+       [ -n "$val" ] && echo "NOTIFYMSG FSD \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" commokmsg
+       [ -n "$val" ] && echo "NOTIFYMSG COMMOK \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" commbadmsg
+       [ -n "$val" ] && echo "NOTIFYMSG COMMBAD \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" shutdownmsg
+       [ -n "$val" ] && echo "NOTIFYMSG SHUTDOWN \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" replbattmsg
+       [ -n "$val" ] && echo "NOTIFYMSG REPLBATT \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" nocommmsg
+       [ -n "$val" ] && echo "NOTIFYMSG NOCOMM \"$val\"" >> $UPSMON_C
+       config_get val "$cfg" noparentmsg
+       [ -n "$val" ] && echo "NOTIFYMSG NOPARENT \"$val\"" >> $UPSMON_C
+
+       local default
+       config_get default "$cfg" defaultnotify SYSLOG
+       config_get val "$cfg" onlinenotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG ONLINE $val" >> $UPSMON_C
+       config_get val "$cfg" onbattnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG ONBATT $val" >> $UPSMON_C
+       config_get val "$cfg" lowbattnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG LOWBATT $val" >> $UPSMON_C
+       config_get val "$cfg" fsdnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG FSD $val" >> $UPSMON_C
+       config_get val "$cfg" commoknotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG COMMOK $val" >> $UPSMON_C
+       config_get val "$cfg" commbadnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG COMMBAD $val" >> $UPSMON_C
+       config_get val "$cfg" shutdownnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG SHUTDOWN $val" >> $UPSMON_C
+       config_get val "$cfg" replbattnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG REPLBATT $val" >> $UPSMON_C
+       config_get val "$cfg" nocommnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG NOCOMM $val" >> $UPSMON_C
+       config_get val "$cfg" noparentnotify "$default"
+       [ -n "$val" ] && echo "NOTIFYFLAG NOPARENT $val" >> $UPSMON_C
+
+       config_get val "$cfg" rbwarntime 43200
+       echo "RBWARNTIME $val" >> $UPSMON_C
+
+       config_get val "$cfg" nocommwarntime 300
+       echo "NOCOMMWARNTIME $val" >> $UPSMON_C
+
+       config_get val "$cfg" finaldelay 5
+       echo "FINALDELAY $val" >> $UPSMON_C
+}
+
+nut_upsmon_add() {
+       local cfg="$1"
+       local type="$2"
+       local upsname
+       local hostname
+       local port
+       local powervalue
+       local user
+       local pass
+       local system
+
+       # If no core config, use defaults
+       [ -r $UPSMON_C ] || nut_upsmon_conf ""
+
+       config_get upsname "$cfg" upsname
+       config_get hostname "$cfg" hostname localhost
+       config_get port "$cfg" port
+       config_get powervalue "$cfg" powervalue 1
+       config_get user "$cfg" user
+       config_get pass "$cfg" password
+       system="$upsname@$hostname"
+       if [ -n "$port" ]; then
+           system="$system:$port";
+       fi
+       echo "MONITOR $system $powervalue $user $pass $type" >> $UPSMON_C
+}
+
+start() {
+       [ -d $RUN_D ] || mkdir -p $RUN_D
+       rm -f $UPSMON_C
+
+       config_load upsmon
+
+       config_foreach nut_upsmon_conf upsmon
+       config_foreach nut_upsmon_add master master
+       config_foreach nut_upsmon_add slave slave
+
+       [ -f $DEFAULT ] && . $DEFAULT
+       $DEBUG /usr/sbin/upsmon $UPSMON_OPTIONS
+}
+
+stop() {
+       [ -r $PID_F ] && /usr/sbin/upsmon -c stop
+       rm -f $UPSMON_C
+}
diff --git a/utils/nut/patches/001-fix-missing-libmath-flags.patch b/utils/nut/patches/001-fix-missing-libmath-flags.patch
new file mode 100644 (file)
index 0000000..4f5ea9d
--- /dev/null
@@ -0,0 +1,11 @@
+--- nut-2.6.3.orig/drivers/Makefile.am 2011-12-05 16:36:46.000000000 
+0100
++++ nut-2.6.3/drivers/Makefile.am      2012-04-19 10:51:52.152059206 +0200
+@@ -165,7 +165,7 @@
+ tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
+
+ bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c
+-bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
++bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
+
+ blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c
diff --git a/utils/nut/patches/002-minibox-openups-driver.patch b/utils/nut/patches/002-minibox-openups-driver.patch
new file mode 100644 (file)
index 0000000..0d8e9fe
--- /dev/null
@@ -0,0 +1,528 @@
+From f8546df4c18c087eac829d3dfc097c919abb6d1c Mon Sep 17 00:00:00 2001
+From: aquette <aquette@72a954d1-e00c-0410-aa02-d9c7bb700a61>
+Date: Wed, 28 Nov 2012 21:44:21 +0000
+Subject: [PATCH] Official support for Minibox openUPS Intelligent UPS
+
+Add a new usbhid-ups subdriver to handle Minibox openUPS Intelligent UPS
+(USB ID 0x04d8:0xd004) (patch from Nicu Pavel, Mini-Box.Com)
+
+git-svn-id: svn://anonscm.debian.org/nut/trunk@3791 72a954d1-e00c-0410-aa02-d9c7bb700a61
+---
+ data/driver.list.in                |   2 +
+ drivers/Makefile.am                |   5 +-
+ drivers/openups-hid.c              | 360 +++++++++++++++++++++++++++++++++++++
+ drivers/openups-hid.h              |  38 ++++
+ drivers/usbhid-ups.c               |   5 +-
+ scripts/upower/95-upower-hid.rules |   4 +
+ 6 files changed, 411 insertions(+), 3 deletions(-)
+ create mode 100644 drivers/openups-hid.c
+ create mode 100644 drivers/openups-hid.h
+
+diff --git a/data/driver.list.in b/data/driver.list.in
+index 11014d6..70b5e0f 100644
+--- a/data/driver.list.in
++++ b/data/driver.list.in
+@@ -645,6 +645,8 @@
+ "Microsol"    "ups"   "5"     "Rhino 10.0"    "10000VA"       "rhino"
+ "Microsol"    "ups"   "5"     "Rhino 20.0"    "20000VA"       "rhino"
++"Minibox"     "ups"   "5"     "openUPS Intelligent UPS"       "USB port"      "usbhid-ups"
++
+ "Mustek"      "ups"   "2"     "Powermust"     "400VA Plus"    "blazer_ser"
+ "Mustek"      "ups"   "2"     "Powermust"     "600VA Plus"    "blazer_ser"
+ "Mustek"      "ups"   "2"     "Powermust"     "800VA Pro"     "blazer_ser"
+diff --git a/drivers/Makefile.am b/drivers/Makefile.am
+index cd900cf..ad30874 100644
+--- a/drivers/Makefile.am
++++ b/drivers/Makefile.am
+@@ -162,7 +162,8 @@ skel_LDADD = $(LDADD_DRIVERS)
+ # USB
+ USBHID_UPS_SUBDRIVERS = apc-hid.c belkin-hid.c cps-hid.c explore-hid.c \
+- liebert-hid.c mge-hid.c powercom-hid.c tripplite-hid.c idowell-hid.c
++ liebert-hid.c mge-hid.c powercom-hid.c tripplite-hid.c idowell-hid.c \
++ openups-hid.c
+ usbhid_ups_SOURCES = usbhid-ups.c libhid.c libusb.c hidparser.c       \
+  usb-common.c $(USBHID_UPS_SUBDRIVERS)
+ usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
+@@ -245,7 +246,7 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h   \
+  powercom.h powerpanel.h powerp-bin.h powerp-txt.h powerware-mib.h raritan-pdu-mib.h  \
+  safenet.h serial.h snmp-ups.h solis.h tripplite.h tripplite-hid.h                    \
+  upshandler.h usb-common.h usbhid-ups.h powercom-hid.h compaq-mib.h idowell-hid.h \
+- apcsmart.h apcsmart_tabs.h apcsmart-old.h cyberpower-mib.h
++ apcsmart.h apcsmart_tabs.h apcsmart-old.h cyberpower-mib.h openups-hid.h
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files.  This library is not actually built,
+diff --git a/drivers/openups-hid.c b/drivers/openups-hid.c
+new file mode 100644
+index 0000000..69a4a61
+--- /dev/null
++++ b/drivers/openups-hid.c
+@@ -0,0 +1,360 @@
++/* openups-hid.c - subdriver to monitor Minibox openUPS USB/HID devices with NUT
++ *
++ *  Copyright (C)
++ *  2003 - 2012       Arnaud Quette <ArnaudQuette@Eaton.com>
++ *  2005 - 2006       Peter Selinger <selinger@users.sourceforge.net>
++ *  2008 - 2009       Arjen de Korte <adkorte-guest@alioth.debian.org>
++ *         2012       Nicu Pavel <npavel@mini-box.com>
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, write to the Free Software
++ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++
++#include "usbhid-ups.h"
++#include "openups-hid.h"
++#include "main.h"             /* for getval() */
++#include "usb-common.h"
++
++#define OPENUPS_HID_VERSION   "openUPS HID 0.1"
++
++/* Minibox */
++#define OPENUPS_VENDORID      0x04d8
++
++static char openups_scratch_buf[20];
++
++/* USB IDs device table */
++static usb_device_id_t openups_usb_device_table[] = {
++      /* openUPS Intelligent UPS (minimum required firmware 1.4) */
++      {USB_DEVICE(OPENUPS_VENDORID, 0xd004), NULL},
++
++      /* Terminating entry */
++      {-1, -1, NULL}
++};
++
++/* Thermistor table used for temperature lookups 
++ * taken from the windows monitoring application
++ */
++static unsigned int therm_tbl[] = 
++{ 
++      (unsigned int)0x31,
++      (unsigned int)0x40,
++      (unsigned int)0x53,
++      (unsigned int)0x68,
++      (unsigned int)0x82,
++      (unsigned int)0xA0,
++      (unsigned int)0xC3,
++      (unsigned int)0xE9,
++      (unsigned int)0x113,
++      (unsigned int)0x13F,
++      (unsigned int)0x16E,
++      (unsigned int)0x19F,
++      (unsigned int)0x1CF,
++      (unsigned int)0x200,
++      (unsigned int)0x22F,
++      (unsigned int)0x25C,
++      (unsigned int)0x286,
++      (unsigned int)0x2AE,
++      (unsigned int)0x2D3,
++      (unsigned int)0x2F4,
++      (unsigned int)0x312,
++      (unsigned int)0x32D,
++      (unsigned int)0x345,
++      (unsigned int)0x35A,
++      (unsigned int)0x36D,
++      (unsigned int)0x37E,
++      (unsigned int)0x38C,
++      (unsigned int)0x399,
++      (unsigned int)0x3A5,
++      (unsigned int)0x3AF,
++      (unsigned int)0x3B7,
++      (unsigned int)0x3BF,
++      (unsigned int)0x3C6,
++      (unsigned int)0x3CC
++};
++
++static unsigned int therm_tbl_size = sizeof(therm_tbl)/sizeof(therm_tbl[0]);
++
++static const char *openups_charging_fun(double value);
++static const char *openups_discharging_fun(double value);
++static const char *openups_online_fun(double value);
++static const char *openups_nobattery_fun(double value);
++static const char *openups_off_fun(double value);
++
++static const char *openups_scale_vin_fun(double value);
++static const char *openups_scale_vout_fun(double value);
++/* static const char *openups_scale_vbat_fun(double value); */
++static const char *openups_scale_ccharge_fun(double value);
++static const char *openups_scale_cdischarge_fun(double value);
++static const char *openups_temperature_fun(double value);
++
++static info_lkp_t openups_charging_info[] = {
++      {0, NULL, openups_charging_fun}
++};
++
++static info_lkp_t openups_discharging_info[] = {
++      {0, NULL, openups_discharging_fun}
++};
++
++static info_lkp_t openups_online_info[] = {
++      {0, NULL, openups_online_fun}
++};
++
++static info_lkp_t openups_nobattery_info[] = {
++      {0, NULL, openups_nobattery_fun}
++};
++
++static info_lkp_t openups_off_info[] = {
++      {0, NULL, openups_off_fun}
++};
++
++static info_lkp_t openups_vin_info[] = {
++      {0, NULL, openups_scale_vin_fun}
++};
++
++static info_lkp_t openups_vout_info[] = {
++      {0, NULL, openups_scale_vout_fun}
++};
++
++/* static info_lkp_t openups_vbat_info[] = {
++      {0, NULL, openups_scale_vbat_fun}
++};*/
++
++static info_lkp_t openups_ccharge_info[] = {
++      {0, NULL, openups_scale_ccharge_fun}
++};
++
++static info_lkp_t openups_cdischarge_info[] = {
++      {0, NULL, openups_scale_cdischarge_fun}
++};
++
++static info_lkp_t openups_temperature_info[] = {
++      {0, NULL, openups_temperature_fun}
++};
++
++static const char *openups_charging_fun(double value)
++{
++      return value ? "chrg" : "!chrg";
++}
++
++static const char *openups_discharging_fun(double value)
++{
++      return value ? "dischrg" : "!dischrg";
++}
++
++static const char *openups_online_fun(double value)
++{
++      return value ? "online" : "!online";
++}
++
++static const char *openups_nobattery_fun(double value)
++{
++      return value ? "nobattery" : "!nobattery";
++}
++
++static const char *openups_off_fun(double value)
++{
++      return value ? "!off" : "off";
++}
++
++static const char *openups_scale_vin_fun(double value)
++{
++      snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.2f", value * vin_scale);
++      return openups_scratch_buf;
++}
++
++static const char *openups_scale_vout_fun(double value)
++{
++      snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.2f", value * vout_scale);
++      return openups_scratch_buf;
++}
++
++/* static const char *openups_scale_vbat_fun(double value)
++{
++      snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.2f", value * vbat_scale);
++      return openups_scratch_buf;
++}*/
++
++static const char *openups_scale_ccharge_fun(double value)
++{
++      snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.3f", value * ccharge_scale);
++      return openups_scratch_buf;
++}
++
++static const char *openups_scale_cdischarge_fun(double value)
++{
++      snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.3f", value * cdischarge_scale);
++      return openups_scratch_buf;
++}
++
++static const char *openups_temperature_fun(double value)
++{
++      int i;
++      int pos = -1;
++      unsigned int thermistor = value * 100;
++
++      if (thermistor <= therm_tbl[0]) {
++              snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%d", -40);
++      } else {
++              if (thermistor >= therm_tbl[therm_tbl_size - 1]) {
++                      snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%d", 125);
++              } else {
++                      for (i = therm_tbl_size - 1; i >= 0; i--) {
++                              if (thermistor >= therm_tbl[i]) {
++                                      pos = i;
++                                      break;
++                              }
++                      }
++
++                      if (thermistor == therm_tbl[pos]) {
++                              snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%d", pos * 5 - 40);
++                      } else {
++                              int t1 = pos * 5 - 40;
++                              int t2 = (pos + 1) * 5 - 40;
++
++                              unsigned int d1 = therm_tbl[pos];
++                              unsigned int d2 = therm_tbl[pos + 1];
++
++                              float temp = (float) (thermistor - d1) * (t2 - t1) / (d2 - d1) + t1;
++                              snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.2f", temp);
++                      }
++              }
++      }
++
++      return openups_scratch_buf;
++}
++
++/* --------------------------------------------------------------- */
++/*      Vendor-specific usage table */
++/* --------------------------------------------------------------- */
++
++/* OPENUPS usage table */
++static usage_lkp_t openups_usage_lkp[] = {
++      {"Cell1", 0x00000001},  /* Battery cell 1 on J6 pin 1 */
++      {"Cell2", 0x00000002},  /* Battery cell 2 on J6 pin 2 */
++      {"Cell3", 0x00000003},  /* Battery cell 3 on J6 pin 3 */
++      {"Cell4", 0x00000004},  /* Battery cell 4 on J6 pin 4 */
++      {"Cell5", 0x00000005},  /* Battery cell 5 on J6 pin 5 */
++      {"Cell6", 0x00000006},  /* Battery cell 6 on J4 pin 1 */
++      /* Usage table for windows monitoring app only updates when 
++       * certain request codes are written to USB endpoint */
++      /*{ "OpenUPSExtra", 0xff000001 }, */
++      {NULL, 0}
++};
++
++static usage_tables_t openups_utab[] = {
++      openups_usage_lkp,
++      hid_usage_lkp,
++      NULL,
++};
++
++/* --------------------------------------------------------------- */
++/* HID2NUT lookup table                                            */
++/* --------------------------------------------------------------- */
++
++static hid_info_t openups_hid2nut[] = {
++      {"ups.serial", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%s", 0, stringid_conversion},
++
++      /* Battery */
++      {"battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", HU_FLAG_STATIC, stringid_conversion},
++      {"battery.mfr.date", 0, 0, "UPS.PowerSummary.iOEMInformation", NULL, "%s", 0, stringid_conversion},
++      {"battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.2f", HU_FLAG_QUICK_POLL, NULL},
++      /* { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info }, */
++      {"battery.current", 0, 0, "UPS.PowerSummary.Current", NULL, "%.3f", HU_FLAG_QUICK_POLL, NULL},
++      {"battery.capacity", 0, 0, "UPS.PowerSummary.DesignCapacity", NULL, "%.0f", HU_FLAG_STATIC, NULL},
++      {"battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL},
++      {"battery.charge.low", 0, 0, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL},
++      {"battery.charge.warning", 0, 0, "UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", 0, NULL},
++      {"battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL},
++      {"battery.temperature", 0, 0, "UPS.PowerSummary.Temperature", NULL, NULL, HU_FLAG_QUICK_POLL, openups_temperature_info},
++/*    {"battery.cell1.voltage", 0, 0, "UPS.PowerSummary.Battery.Cell1", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info},
++      {"battery.cell2.voltage", 0, 0, "UPS.PowerSummary.Battery.Cell2", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info},
++      {"battery.cell3.voltage", 0, 0, "UPS.PowerSummary.Battery.Cell3", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info},
++      {"battery.cell4.voltage", 0, 0, "UPS.PowerSummary.Battery.Cell4", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info},
++      {"battery.cell5.voltage", 0, 0, "UPS.PowerSummary.Battery.Cell5", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info},
++      {"battery.cell6.voltage", 0, 0, "UPS.PowerSummary.Battery.Cell6", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info},
++*/
++      /* Output */
++      {"output.voltage", 0, 0, "UPS.PowerSummary.Output.Voltage", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vout_info},
++      {"output.current", 0, 0, "UPS.PowerSummary.Output.Current", NULL, NULL, HU_FLAG_QUICK_POLL, openups_cdischarge_info},
++
++      /* Input */
++      {"input.voltage", 0, 0, "UPS.PowerSummary.Input.Voltage", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vin_info},
++      {"input.current", 0, 0, "UPS.PowerSummary.Input.Current", NULL, NULL, HU_FLAG_QUICK_POLL, openups_ccharge_info},
++
++      /* Status */
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Good", NULL, NULL, HU_FLAG_QUICK_POLL, openups_off_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.InternalFailure", NULL, NULL, HU_FLAG_QUICK_POLL, commfault_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Overload", NULL, NULL, HU_FLAG_QUICK_POLL, overload_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.OverTemperature", NULL, NULL, HU_FLAG_QUICK_POLL, overheat_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, NULL, HU_FLAG_QUICK_POLL, shutdownimm_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, HU_FLAG_QUICK_POLL, lowbatt_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL, NULL, HU_FLAG_QUICK_POLL, timelimitexpired_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, openups_charging_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, openups_discharging_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, 0, replacebatt_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, openups_online_info},
++      {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BatteryPresent", NULL, NULL, HU_FLAG_QUICK_POLL, openups_nobattery_info},
++
++      /* end of structure. */
++      {NULL, 0, 0, NULL, NULL, NULL, 0, NULL}
++};
++
++static const char *openups_format_model(HIDDevice_t * hd)
++{
++      return hd->Product;
++}
++
++static const char *openups_format_mfr(HIDDevice_t * hd)
++{
++      return hd->Vendor ? hd->Vendor : "openUPS";
++}
++
++static const char *openups_format_serial(HIDDevice_t * hd)
++{
++      return hd->Serial;
++}
++
++/* this function allows the subdriver to "claim" a device: return 1 if
++ * the device is supported by this subdriver, else 0. */
++static int openups_claim(HIDDevice_t * hd)
++{
++      int status = is_usb_device_supported(openups_usb_device_table, hd);
++
++      switch (status) {
++      case POSSIBLY_SUPPORTED:
++              /* by default, reject, unless the productid option is given */
++              if (getval("productid")) {
++                      return 1;
++              }
++              possibly_supported("openUPS", hd);
++              return 0;
++
++      case SUPPORTED:
++              return 1;
++
++      case NOT_SUPPORTED:
++      default:
++              return 0;
++      }
++}
++
++subdriver_t openups_subdriver = {
++      OPENUPS_HID_VERSION,
++      openups_claim,
++      openups_utab,
++      openups_hid2nut,
++      openups_format_model,
++      openups_format_mfr,
++      openups_format_serial,
++};
+diff --git a/drivers/openups-hid.h b/drivers/openups-hid.h
+new file mode 100644
+index 0000000..c87b3d1
+--- /dev/null
++++ b/drivers/openups-hid.h
+@@ -0,0 +1,38 @@
++/* openups-hid.h - subdriver to monitor Minibox openUPS USB/HID devices with NUT
++ *
++ *  Copyright (C)
++ *  2003 - 2009       Arnaud Quette <ArnaudQuette@Eaton.com>
++ *  2005 - 2006       Peter Selinger <selinger@users.sourceforge.net>
++ *  2008 - 2009       Arjen de Korte <adkorte-guest@alioth.debian.org>
++ *         2012       Nicu Pavel <npavel@mini-box.com>
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, write to the Free Software
++ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++
++#ifndef OPENUPS_HID_H
++#define OPENUPS_HID_H
++
++#include "usbhid-ups.h"
++
++/* constants for converting HID read values to real values */
++static const float vin_scale = 0.03545 * 100;
++static const float vout_scale = 0.02571 * 100;
++static const float vbat_scale = 0.00857 * 100;
++static const float ccharge_scale = 0.8274 / 10;
++static const float cdischarge_scale = 16.113 / 10;
++
++extern subdriver_t openups_subdriver;
++
++#endif /* OPENUPS_HID_H */
+diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c
+index 2d254c4..fcf628d 100644
+--- a/drivers/usbhid-ups.c
++++ b/drivers/usbhid-ups.c
+@@ -27,7 +27,7 @@
+  */
+ #define DRIVER_NAME   "Generic HID driver"
+-#define DRIVER_VERSION                "0.37"
++#define DRIVER_VERSION                "0.38"
+ #include "main.h"
+ #include "libhid.h"
+@@ -37,6 +37,7 @@
+ /* include all known subdrivers */
+ #include "mge-hid.h"
++
+ #ifndef SHUT_MODE
+       #include "explore-hid.h"
+       #include "apc-hid.h"
+@@ -46,6 +47,7 @@
+       #include "powercom-hid.h"
+       #include "tripplite-hid.h"
+       #include "idowell-hid.h"
++      #include "openups-hid.h"
+ #endif
+ /* master list of avaiable subdrivers */
+@@ -62,6 +64,7 @@ static subdriver_t *subdriver_list[] = {
+       &powercom_subdriver,
+       &tripplite_subdriver,
+       &idowell_subdriver,
++      &openups_subdriver,
+ #endif
+       NULL
+ };
+diff --git a/scripts/upower/95-upower-hid.rules b/scripts/upower/95-upower-hid.rules
+index a9e18fe..c57ef75 100644
+--- a/scripts/upower/95-upower-hid.rules
++++ b/scripts/upower/95-upower-hid.rules
+@@ -15,6 +15,7 @@ ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end"
+ ATTRS{idVendor}=="03f0", ENV{UPOWER_VENDOR}="Hewlett Packard"
+ ATTRS{idVendor}=="0463", ENV{UPOWER_VENDOR}="Eaton"
+ ATTRS{idVendor}=="047c", ENV{UPOWER_VENDOR}="Dell"
++ATTRS{idVendor}=="04d8", ENV{UPOWER_VENDOR}="Minibox"
+ ATTRS{idVendor}=="050d", ENV{UPOWER_VENDOR}="Belkin"
+ ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC"
+ ATTRS{idVendor}=="0592", ENV{UPOWER_VENDOR}="Powerware"
+@@ -47,6 +48,9 @@ ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups
+ # Dell
+ ATTRS{idVendor}=="047c", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups"
++# Minibox
++ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d004", ENV{UPOWER_BATTERY_TYPE}="ups"
++
+ # Belkin
+ ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{UPOWER_BATTERY_TYPE}="ups"
+ ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{UPOWER_BATTERY_TYPE}="ups"
+-- 
+1.8.0
+
diff --git a/utils/nut/patches/003-openups-backport.patch b/utils/nut/patches/003-openups-backport.patch
new file mode 100644 (file)
index 0000000..9ed7abf
--- /dev/null
@@ -0,0 +1,35 @@
+--- nut-2.6.5/drivers/openups-hid.c~   2012-12-06 15:07:29.000000000 +0000
++++ nut-2.6.5/drivers/openups-hid.c    2012-12-06 15:14:45.541936770 +0000
+@@ -329,24 +329,18 @@ static const char *openups_format_serial
+  * the device is supported by this subdriver, else 0. */
+ static int openups_claim(HIDDevice_t * hd)
+ {
+-      int status = is_usb_device_supported(openups_usb_device_table, hd);
+-
+-      switch (status) {
+-      case POSSIBLY_SUPPORTED:
+-              /* by default, reject, unless the productid option is given */
+-              if (getval("productid")) {
+-                      return 1;
+-              }
+-              possibly_supported("openUPS", hd);
++      if (hd->VendorID != OPENUPS_VENDORID)
+               return 0;
+-      case SUPPORTED:
++      if (hd->ProductID == 0xd004)
+               return 1;
+-      case NOT_SUPPORTED:
+-      default:
+-              return 0;
+-      }
++      /* by default, reject, unless the productid option is given */
++      if (getval("productid"))
++              return 1;
++
++      possibly_supported("openUPS", hd);
++      return 0;
+ }
+ subdriver_t openups_subdriver = {
diff --git a/utils/nvramtool/Makefile b/utils/nvramtool/Makefile
new file mode 100644 (file)
index 0000000..2818b1e
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2008-2010 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:=nvramtool
+PKG_REV:=4887
+PKG_VERSION:=$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=svn://coreboot.org/coreboot/trunk/util/nvramtool
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nvramtool
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.coreboot.org/Nvramtool
+  TITLE:=Coreboot nvramtool
+  DEPENDS:=@TARGET_x86 +@PACKAGE_pciutils +zlib
+endef
+
+define Package/nvramtool/description
+nvramtool (previously known as lxbios and cmos_util) is a utility for
+reading/writing coreboot parameters and displaying information from the coreboot
+table in CMOS/NVRAM.
+The program is intended only for x86-based Linux systems that use coreboot, but
+can also be used for non-coreboot systems (e.g. for dumping all NVRAM bytes).
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
+               LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
+               LIBS="-lpci -lz" \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               nvramtool
+endef
+
+define Package/nvramtool/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nvramtool $(1)/sbin/nvramtool
+endef
+
+$(eval $(call BuildPackage,nvramtool))
diff --git a/utils/open-plc-utils/Makefile b/utils/open-plc-utils/Makefile
new file mode 100644 (file)
index 0000000..2137c5f
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2013 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:=open-plc-utils
+PKG_VERSION:=2013-01-29
+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:=6beeb6fe6ce2b16b14284c26e1b9220b68044591
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/open-plc-utils/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Qualcomm Atheros Power Line Communication utilities
+  URL:=https://github.com/qca/open-plc-utils/blob/master/README
+endef
+
+define Package/open-plc-utils
+  $(call Package/open-plc-utils/Default)
+  MENU:=1
+endef
+
+define GenPlugin
+  define Package/$(addprefix open-plc-utils-,$(1))
+    $(call Package/open-plc-utils/Default)
+    DEPENDS:=open-plc-utils
+    TITLE:=Utility $(2) from the Open PLC utilities
+  endef
+
+   define Package/$(addprefix open-plc-utils-,$(1))/description
+     Utility $(2) from the Open PLC utilities package.
+   endef
+endef
+
+OPEN_PLC_UTILS_APPS:=efbu efeu efru efsu edru edsu nics \
+                    hpavkey hpavkeys rkey mac2pw mac2pwd \
+                    mdioblock mdioblock2 mdiodump mdiogen \
+                    hpav mme \
+                    chknvm chknvm2 nvmsplit nvmmerge \
+                    chkpib chkpib2 setpib getpib modpib pib2xml \
+                    pibcomp pibdump pibruin xml2pib psin psout pskey \
+                    psgraph psnotch pibrump \
+                    int6k int6kboot int6keth int6kf int6khost \
+                    int64host int6kid int6klist int6klog int6kmdio \
+                    int6kmdio2 int6kmod int6kstat int6ktest int6krate \
+                    int6krule int6ktone int6kwait CMEncrypt sada \
+                    coqos_add coqos_info coqos_man coqos_mod coqos_rel \
+                    mdustats ampboot amphost ampID amplist amprate \
+                    ampstat amptest amptool amptone ampwait \
+                    plcboot plchost plcID plclist plcrate plcrule \
+                    plcstat plctest plctool plctone \
+                    plcwait plchostd plcget plcset plcotst plcfwd \
+                    plcdevs plclog plcmdio16 plcmdio32 \
+                    config2cfg sdram \
+                    int6kuart int6kbaud ttysig ptsctl weeder ttysend \
+                    ttyrecv ttycat int6kdetect
+
+$(foreach a,$(OPEN_PLC_UTILS_APPS),$(eval $(call GenPlugin,$(a))))
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               EXTRA_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
+               LDFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS)" \
+               CROSS="$(TARGET_CROSS)" \
+               ROOTFS="$(PKG_INSTALL_DIR)" \
+               OWNER="$(shell id -u $(shell whoami))" \
+               GROUP="$(shell id -g $(shell whoami))" \
+               all install
+endef
+
+define Package/open-plc-utils/install
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/$(subst open-plc-utils-,,$(1)) \
+               $$(1)/usr/bin/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+$(eval $(call BuildPackage,open-plc-utils))
+$(foreach a,$(OPEN_PLC_UTILS_APPS),$(eval $(call BuildPlugin,open-plc-utils-$(a))))
diff --git a/utils/open2300/Makefile b/utils/open2300/Makefile
new file mode 100644 (file)
index 0000000..289cd33
--- /dev/null
@@ -0,0 +1,63 @@
+# 
+# Copyright (C) 2010 segal.ubi.pt
+# Copyright (C) 2014 nunojpg@gmail.com
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=open2300
+PKG_VERSION:=1.12
+PKG_RELEASE:=3
+
+PKG_SOURCE_PROTO:=svn
+PKG_SOURCE_URL:=http://www.lavrsen.dk/svn/open2300/trunk
+PKG_SOURCE_VERSION:=r12
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/open2300
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=WS23XX weather station utilities
+  URL:=http://www.lavrsen.dk/foswiki/bin/view/Open2300
+endef
+
+define Package/open2300/description
+  This is an utility suite used to communicate with and collect data from a WS23XX wheather station.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -DVERSION=\"$(PKG_VERSION)\""
+
+define Package/open2300/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin2300         $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cw2300          $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/dump2300        $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/fetch2300       $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/histlog2300     $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/history2300     $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/interval2300    $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/light2300       $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/log2300         $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/minmax2300      $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/open2300        $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wu2300          $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/xml2300         $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/open2300.conf $(1)/etc/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib2300.so.1.11 $(1)/usr/lib/
+       ln -sf /usr/lib/lib2300.so.1.11 $(1)/usr/lib/lib2300.so
+endef
+
+$(eval $(call BuildPackage,open2300))
diff --git a/utils/open2300/files/open2300.conf b/utils/open2300/files/open2300.conf
new file mode 100644 (file)
index 0000000..6414b49
--- /dev/null
@@ -0,0 +1,65 @@
+# open2300.conf
+#
+# Configuration files for open2300 weather station tools
+#
+# Default locations in which the programs will search for this file: 
+# Programs search in this sequence:
+#  1. Path to config file including filename given as parameter (not supported by all tools)
+#  2. ./open2300.conf (current working directory)
+#  3. /jffs/etc/open2300.conf (typical DD-WRT location)
+#  4. /etc/open2300.conf (typical Linux location)
+#
+# All names are case sensitive!!!
+
+
+# Set to your serial port and time zone
+# For Windows use COM1, COM2, COM2 etc
+# For Linux use /dev/ttyS0, /dev/ttyS1 etc
+
+SERIAL_DEVICE                 /dev/tts/1  # /dev/ttyS0, /dev/ttyS1, COM1, COM2 etc
+TIMEZONE                      1           # Hours Relative to UTC. East is positive, west is negative
+
+
+# Units of measure (set them to your preference)
+# The units of measure are ignored by wu2300 and cw2300 because both requires specific units
+
+WIND_SPEED                    m/s         # select MPH (miles/hour), m/s, or km/h
+TEMPERATURE                   C           # Select C or F
+RAIN                          mm          # Select mm or IN
+PRESSURE                      hPa         # Select hPa, mb or INHG
+
+#### Citizens Weather variables (used only by cw2300)
+# Format for latitude is
+# [2 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][N for north or S for south]
+# Format for longitude is
+# [3 digit degrees][2 digit minutes].[2 decimals minutes - NOT seconds][E for east or W for west]
+# Use leading zeros to get the format ####.##N (lat) and #####.##E (long)
+
+CITIZEN_WEATHER_ID            CW0000      # CW0000 should be replaced by HAM call or actual CW number
+CITIZEN_WEATHER_LATITUDE      5540.12N    # DDMM.mmN or S - example 55 deg, 40.23 minutes north
+CITIZEN_WEATHER_LONGITUDE     01224.60E   # DDDMM.mmE or W - example 12 deg, 24.60 minutes east
+
+APRS_SERVER   rotate.aprs.net   14580     # These are the APRS servers and ports for
+APRS_SERVER   first.aprs.net    14580     # Citizens Weather reporting.
+APRS_SERVER   second.aprs.net   14580     # They they are tried in the entered order
+APRS_SERVER   third.aprs.net    14580     # you may enter up to 5 alternate servers
+
+
+#### WEATHER UNDERGROUND variables (used only by wu2300)
+
+WEATHER_UNDERGROUND_ID        WUID        # ID received from Weather Underground
+WEATHER_UNDERGROUND_PASSWORD  WUPASSWORD  # Password for Weather Underground
+
+
+### MYSQL Settings (only used by mysql2300)
+
+#MYSQL_HOST              localhost         # Localhost or IP address/host name
+#MYSQL_USERNAME          open2300          # Name of the MySQL user that has access to the database
+#MYSQL_PASSWORD          mysql2300         # Password for the MySQL user
+#MYSQL_DATABASE          open2300          # Named of your database
+#MYSQL_PORT              0                 # TCP/IP Port number. Zero means default
+
+#PGSQL_CONNECT         hostaddr='127.0.0.1'dbname='open2300'user='postgres'password='sql' # Connection string
+#PGSQL_TABLE           weather           # Table name
+#PGSQL_STATION         open2300          # Unique station id
diff --git a/utils/open2300/patches/001-crosscompile.patch b/utils/open2300/patches/001-crosscompile.patch
new file mode 100644 (file)
index 0000000..0953047
--- /dev/null
@@ -0,0 +1,139 @@
+--- a/Makefile
++++ b/Makefile
+@@ -15,87 +15,82 @@
+ prefix = /usr/local
+ exec_prefix = ${prefix}
+ bindir = ${exec_prefix}/bin
++libdir = ${prefix}/lib
+ #########################################
+ CC  = gcc
+-OBJ = open2300.o rw2300.o linux2300.o win2300.o
+-LOGOBJ = log2300.o rw2300.o linux2300.o win2300.o
+-FETCHOBJ = fetch2300.o rw2300.o linux2300.o win2300.o
+-WUOBJ = wu2300.o rw2300.o linux2300.o win2300.o
+-CWOBJ = cw2300.o rw2300.o linux2300.o win2300.o
+-DUMPOBJ = dump2300.o rw2300.o linux2300.o win2300.o
+-HISTOBJ = history2300.o rw2300.o linux2300.o win2300.o
+-HISTLOGOBJ = histlog2300.o rw2300.o linux2300.o win2300.o
+-DUMPBINOBJ = bin2300.o rw2300.o linux2300.o win2300.o
+-XMLOBJ = xml2300.o rw2300.o linux2300.o win2300.o
+-PGSQLOBJ = pgsql2300.o rw2300.o linux2300.o win2300.o
+-LIGHTOBJ = light2300.o rw2300.o linux2300.o win2300.o
+-INTERVALOBJ = interval2300.o rw2300.o linux2300.o win2300.o
+-MINMAXOBJ = minmax2300.o rw2300.o linux2300.o win2300.o
+-MYSQLHISTLOGOBJ = mysqlhistlog2300.o rw2300.o linux2300.o win2300.o
++LIB = lib2300
++LIB_C = rw2300.c linux2300.c
++LIBOBJ = rw2300.o linux2300.o
+ VERSION = 1.11
+ CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
+-CC_LDFLAGS = -lm
+-CC_WINFLAG = 
+-# For Windows - comment the two line above and un-comment the two lines below.
+-#CC_LDFLAGS = -lm -lwsock32
+-#CC_WINFLAG = -mwindows
++CC_LDFLAGS = -L. -lm -l2300
++LFLAGS = -shared -Wl,-soname
+ INSTALL = install
++MAKE_EXEC = $(CC) $(CFLAGS) $@.c -o $@ $(CC_LDFLAGS)
+ ####### Build rules
+-all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 mysql2300 mysqlhistlog2300
++all: open2300 dump2300 log2300 fetch2300 wu2300 cw2300 history2300 histlog2300 bin2300 xml2300 light2300 interval2300 minmax2300 #mysql2300 mysqlhistlog2300
+-open2300 : $(OBJ)
+-      $(CC) $(CFLAGS) -o $@ $(OBJ) $(CC_LDFLAGS)
+-      
+-dump2300 : $(DUMPOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(DUMPOBJ) $(CC_LDFLAGS)
++lib2300 :
++      $(CC) -c -fPIC $(CFLAGS) $(LIB_C)
++      $(CC) $(LFLAGS),$@.so -o $@.so.$(VERSION) $(LIBOBJ)
++      ln -sf $@.so.$(VERSION) $@.so
++
++open2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-log2300 : $(LOGOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(LOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++dump2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-fetch2300 : $(FETCHOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(FETCHOBJ) $(CC_LDFLAGS)
++log2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-wu2300 : $(WUOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(WUOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++fetch2300 : $(LIB)
++      $(MAKE_EXEC)
++
++srv2300 : $(LIB)
++      $(MAKE_EXEC)
++
++wu2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-cw2300 : $(CWOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(CWOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++cw2300 : $(LIB)
++      $(MAKE_EXEC)
+-history2300 : $(HISTOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(HISTOBJ) $(CC_LDFLAGS)
++history2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-histlog2300 : $(HISTLOGOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(HISTLOGOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++histlog2300 : $(LIB)
++      $(MAKE_EXEC)
+       
+-bin2300 : $(DUMPBINOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(DUMPBINOBJ) $(CC_LDFLAGS)
++bin2300 : $(LIB)
++      $(MAKE_EXEC)
+-xml2300 : $(XMLOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(XMLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++xml2300 : $(LIB)
++      $(MAKE_EXEC)
+-mysql2300:
+-      $(CC) $(CFLAGS) -o mysql2300 mysql2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++mysql2300: $(LIB)
++      $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
+-pgsql2300: $(PGSQLOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(PGSQLOBJ) $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/pgsql -L/usr/lib/pgsql -lpq
++pgsql2300: $(LIB)
++      $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/pgsql -L/usr/lib/pgsql $(CC_LDFLAGS) -lpq
+-light2300: $(LIGHTOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(LIGHTOBJ) $(CC_LDFLAGS)
++light2300: $(LIB)
++      $(MAKE_EXEC)
+       
+-interval2300: $(INTERVALOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(INTERVALOBJ) $(CC_LDFLAGS)
++interval2300: $(LIB)
++      $(MAKE_EXEC)
+       
+-minmax2300: $(MINMAXOBJ)
+-      $(CC) $(CFLAGS) -o $@ $(MINMAXOBJ) $(CC_LDFLAGS) $(CC_WINFLAG)
++minmax2300: $(LIB)
++      $(MAKE_EXEC)
+       
+-mysqlhistlog2300 :
+-      $(CC) $(CFLAGS) -o mysqlhistlog2300 mysqlhistlog2300.c rw2300.c linux2300.c $(CC_LDFLAGS) $(CC_WINFLAG) -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
++mysqlhistlog2300 : $(LIB)
++      $(CC) $(CFLAGS) $@.c -o $@ -I/usr/include/mysql -L/usr/lib/mysql $(CC_LDFLAGS) -lmysqlclient
+ install:
diff --git a/utils/oww/Makefile b/utils/oww/Makefile
new file mode 100644 (file)
index 0000000..ec5d316
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2012-2013 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:=oww
+PKG_VERSION:=0.86.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/oww
+PKG_MD5SUM:=6420fe19bc230e86f3fb0de74f1c6193
+
+PKG_BUILD_DEPENDS:=intltool/host
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/oww
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=One-wire weather
+  URL:=http://oww.sourceforge.net/
+  DEPENDS:=+libcurl +libusb-compat
+endef
+
+define Package/oww/description
+  Oww is a software project, to communicate with the Dallas 1-wire weather
+  station and other 1-wire sensors, presenting live weather readings, logging
+  data to file, uploading data to weather Web sites, and sending data to other
+  programs through a command line interface.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-gui
+
+define Package/oww/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/oww.init $(1)/etc/init.d/oww
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/owwnogui $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,oww))
diff --git a/utils/oww/files/oww.init b/utils/oww/files/oww.init
new file mode 100644 (file)
index 0000000..74684c6
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+
+SERVICE_DAEMONIZE=1
+
+start() {
+       service_start /usr/bin/owwnogui
+}
+
+stop() {
+       service_stop /usr/bin/owwnogui
+}
diff --git a/utils/pcmciautils/Makefile b/utils/pcmciautils/Makefile
new file mode 100644 (file)
index 0000000..155013b
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2008-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:=pcmciautils
+PKG_VERSION:=018
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/pcmcia
+PKG_MD5SUM:=5d85669b3440baa4532363da6caaf1b4
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pcmciautils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libsysfs @PCMCIA_SUPPORT
+  TITLE:=PCMCIA Utilities
+  URL:=http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               LD="$(TARGET_CC)" UDEV=false \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \
+               -DPCMCIAUTILS_VERSION=\\\"$(PKG_VERSION)\\\"" \
+               prefix=/usr all \
+       )
+endef
+
+define Package/pcmciautils/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(CP) $(PKG_BUILD_DIR)/pccardctl $(1)/usr/sbin/
+       $(CP) $(PKG_BUILD_DIR)/pcmcia-check-broken-cis $(1)/usr/sbin/
+       $(CP) $(PKG_BUILD_DIR)/pcmcia-socket-startup $(1)/usr/sbin/
+       rm -f $(1)/usr/sbin/lspcmcia
+       ln -s pccardctl $(1)/usr/sbin/lspcmcia
+       $(INSTALL_DIR) $(1)/etc/pcmcia/
+       $(CP) $(PKG_BUILD_DIR)/config/config.opts $(1)/etc/pcmcia/
+       $(CP) files/* $(1)/
+endef
+
+define Package/pcmciautils/conffiles
+/etc/pcmcia/config.opts
+endef
+
+$(eval $(call BuildPackage,pcmciautils))
diff --git a/utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent b/utils/pcmciautils/files/etc/hotplug.d/pcmcia/pcmcia.agent
new file mode 100644 (file)
index 0000000..537c50a
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright (C) 2008 OpenWrt.org
+
+case "$ACTION" in
+       add)
+               SYSFS=/sys/bus/pcmcia/devices/
+               DEVPATH=$SOCKET_NO.$((0x$DEVICE_NO))
+
+               # check whether the CIS is completely broken
+               if [ ! -h $SYSFS$DEVPATH/driver ]; then
+                       CISFILE=$(/usr/sbin/pcmcia-check-broken-cis $SOCKET_NO)
+                       echo PCMCIA: $CISFILE;
+                       if [ ! -z $CISFILE ]; then
+                               if [ -f /lib/firmware/$CISFILE ]; then
+                                       cat /lib/firmware/$CISFILE > $SYSFS/class/pcmcia_socket/pcmcia_socket$(SOCKET_NO)/cis
+                               fi;
+                       fi;
+               fi;
+
+               # allow a match solely based on the "function ID" field
+               if [ ! -h $SYSFS$DEVPATH/driver ]; then
+                       if [ -w $SYSFS$DEVPATH/allow_func_id_match ]; then
+                               echo PCMCIA: allowing func_id based match for PCMCIA device $SOCKET_NO.$DEVICE_NO
+                               echo -n "42" > $SYSFS$DEVPATH/allow_func_id_match;
+                       fi;
+               fi;
+               ;;
+esac
diff --git a/utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent b/utils/pcmciautils/files/etc/hotplug.d/pcmcia_socket/pcmcia_socket.agent
new file mode 100644 (file)
index 0000000..79b3524
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2008 OpenWrt.org
+
+case "$ACTION" in
+       add)
+               echo PCMCIA: socket number: $SOCKET_NO
+
+               sleep 1;
+               /usr/sbin/pcmcia-socket-startup $SOCKET_NO
+               DONE_FILE=/sys/class/pcmcia_socket/pcmcia_socket$SOCKET_NO/available_resources_setup_done
+               if [ -f  $DONE_FILE ]; then
+                       if [ -w $DONE_FILE ]; then
+                               echo -n "42" > $DONE_FILE
+                       fi;
+               fi;
+               ;;
+
+esac
diff --git a/utils/pcmciautils/files/etc/init.d/pcmcia b/utils/pcmciautils/files/etc/init.d/pcmcia
new file mode 100755 (executable)
index 0000000..16f2276
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org 
+
+START=42
+start() {
+       if [ -d /sys/bus/pcmcia/devices/ ]; then
+               # 2.6 kernels
+               cd /sys/bus/pcmcia/devices/
+               for PCMCIA_DEVICE in *; do
+                       if [ $PCMCIA_DEVICE == \* ]; then
+                               continue;
+                       fi;
+                       MODALIAS=$(cat $PCMCIA_DEVICE/modalias)
+                       echo PCMCIA: $MODALIAS $PCMCIA_DEVICE
+                       if [ -z $MODALIAS ]; then
+                               continue;
+                       fi;
+                       ACTION=add
+                       SOCKET_NO=$(echo $PCMCIA_DEVICE | cut -d. -f1)
+                       DEVICE_NO=$(echo $MODALIAS | sed 's/.*pfn\(..\).*/\1/')
+                       export MODALIAS ACTION SOCKET_NO DEVICE_NO
+                       /sbin/hotplug-call pcmcia
+               done;
+       fi;
+}
diff --git a/utils/pcmciautils/files/etc/init.d/pcmcia_socket b/utils/pcmciautils/files/etc/init.d/pcmcia_socket
new file mode 100755 (executable)
index 0000000..fdd0b8c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org 
+
+START=41
+start() {
+       if [ -d /sys/class/pcmcia_socket/ ]; then
+               # 2.6 kernels
+               cd /sys/class/pcmcia_socket/
+               for PCMCIA_SOCKET in *; do
+                       if [ $PCMCIA_SOCKET == \* ]; then
+                               continue;
+                       fi;
+                       SOCKET_NO=$(echo $PCMCIA_SOCKET | cut -b14-)
+                       ACTION=add
+                       export SOCKET_NO ACTION
+                       /sbin/hotplug-call pcmcia_socket
+               done;
+       fi;
+}
diff --git a/utils/petitboot/Makefile b/utils/petitboot/Makefile
new file mode 100644 (file)
index 0000000..4ae52e8
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Copyright (C) 2006-2010 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:=petitboot
+PKG_REV:=93b2c2e0f0ca46d2a823b33cdfa44d082e9e8d10
+PKG_VERSION:=20090709
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=git://ozlabs.org/home/jk/git/petitboot
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_INSTALL=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/petitboot
+       SECTION:=boot
+       CATEGORY:=Boot Loaders
+       TITLE:=A kexec based bootloader
+       URL:=http://ozlabs.org/~jk/projects/petitboot/
+       MAINTAINER:=Geoff Levand <geoff@infradead.org>
+       DEPENDS:=@TARGET_ps3 +kexec-tools +libncurses +libtwin +udev +ps3-utils
+endef
+
+define Package/petitboot/description
+       Petitboot is a Linux kexec based bootloader with both
+       graphical and command-line user interfaces. The OpenWRT
+       Petitboot package has configuration options that can be
+       used to specify which Petitboot components to build, and
+       can also be used to specify that Petitboot should be run
+       automatically at system start-up.
+
+       Petitboot supports loading Linux kernel and initrd images
+       from any device that can be mounted by Linux.  It can
+       handle gzipped images and can also load images from the
+       network using TFTP, NFS, HTTP, HTTPS, and SFTP.  Petitboot
+       looks for bootloader config files on mountable devices in
+       the system, and also uses the boot configuration sent to
+       it from a DHCP server.
+endef
+
+define Package/petitboot/config
+       source "$(SOURCE)/petitboot-config.in"
+endef
+
+petitboot-config-args-y$(CONFIG_PETITBOOT_CUI) += --without-ncurses
+petitboot-config-args-y$(CONFIG_PETITBOOT_GUI) += --without-twin
+petitboot-config-args-y$(CONFIG_PETITBOOT_PS3) += --enable-ps3=no
+
+petitboot-cppflags-$(CONFIG_PETITBOOT_DEBUG) += -DDEBUG
+petitboot-cppflags-y$(CONFIG_PETITBOOT_DEBUG) += -DNDEBUG
+
+petitboot-extra-bin-$(CONFIG_PETITBOOT_CUI) += /usr/sbin/pb-cui
+petitboot-extra-bin-$(CONFIG_PETITBOOT_GUI) += /usr/sbin/pb-twin
+petitboot-extra-data-$(CONFIG_PETITBOOT_GUI) += /usr/share/petitboot/artwork/*
+
+# The platform inittab and/or initrun should check for /usr/sbin/petitboot
+# and run it on startup if found.
+
+petitboot-install-autorun-$(CONFIG_PETITBOOT_AUTORUN_CUI) = \
+       ln -sf pb-cui $(1)/usr/sbin/petitboot
+petitboot-install-autorun-$(CONFIG_PETITBOOT_AUTORUN_GUI) = \
+       ln -sf pb-twin $(1)/usr/sbin/petitboot
+
+CONFIGURE_ARGS += $(petitboot-config-args-y) \
+       PACKAGE_VERSION=$(shell uname -n)-$(shell date +%y.%m.%d-%H.%M)
+
+EXTRA_CPPFLAGS += $(petitboot-cppflags-y)
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       (cd $(PKG_BUILD_DIR) && $(BASH) -x ./bootstrap)
+endef
+
+define Package/petitboot/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) \
+               $(addprefix $(PKG_INSTALL_DIR),$(petitboot-extra-bin-y)) \
+               $(PKG_INSTALL_DIR)/usr/sbin/pb-discover \
+               $(PKG_INSTALL_DIR)/usr/sbin/pb-event \
+               $(1)/usr/sbin/
+
+       $(INSTALL_DIR) $(1)/usr/share/petitboot/
+       $(INSTALL_DATA) \
+               $(addprefix $(PKG_INSTALL_DIR),$(petitboot-extra-data-y)) \
+               $(1)/usr/share/petitboot/
+
+       $(INSTALL_DIR) $(1)/etc/udev/rules.d
+       $(INSTALL_DATA) \
+               $(PKG_BUILD_DIR)/utils/99-petitboot.rules \
+               $(1)/etc/udev/rules.d/
+
+       $(INSTALL_DIR) $(1)/etc/
+       $(INSTALL_DATA) -T $(PKG_BUILD_DIR)/utils/udhcpc $(1)/etc/udhcpc.user
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) \
+               ./files/petitboot.init \
+               $(1)/etc/init.d/petitboot
+
+       $(petitboot-install-autorun-y)
+endef
+
+$(eval $(call BuildPackage,petitboot))
diff --git a/utils/petitboot/files/petitboot.init b/utils/petitboot/files/petitboot.init
new file mode 100644 (file)
index 0000000..336d47a
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=90
+
+kill_discover() {
+       killall -q -KILL pb-discover
+       umount -f -d /var/petitboot/mnt/* 2>/dev/null
+}
+
+start() {
+       kill_discover
+       /usr/sbin/pb-discover 2>&- >&- &
+}
+
+stop() {
+       # first signal pb-discover to exit
+       killall -q -INT pb-discover
+       sleep 3
+       # now force it
+       kill_discover
+}
diff --git a/utils/petitboot/patches/010-petitboot-fixups.diff b/utils/petitboot/patches/010-petitboot-fixups.diff
new file mode 100644 (file)
index 0000000..cdc0c74
--- /dev/null
@@ -0,0 +1,391 @@
+ 12 files changed, 96 insertions(+), 40 deletions(-)
+
+diff --git a/discover/kboot-parser.c b/discover/kboot-parser.c
+index 23d48a4..7c7cb5d 100644
+--- a/discover/kboot-parser.c
++++ b/discover/kboot-parser.c
+@@ -133,7 +133,7 @@ static int kboot_parse(struct discover_context *dc)
+       conf = talloc_zero(dc, struct conf_context);
+       if (!conf)
+-              return -1;
++              return 0;
+       conf->dc = dc;
+       conf->global_options = kboot_global_options,
+diff --git a/discover/parser.c b/discover/parser.c
+index 2b4ddd2..8f2735c 100644
+--- a/discover/parser.c
++++ b/discover/parser.c
+@@ -13,16 +13,16 @@ extern struct parser __start_parsers[], __stop_parsers[];
+ void iterate_parsers(struct discover_context *ctx)
+ {
+       struct parser *parser;
++      unsigned int count = 0;
+       pb_log("trying parsers for %s\n", ctx->device_path);
+       for (parser = __start_parsers; parser < __stop_parsers; parser++) {
+               pb_log("\ttrying parser '%s'\n", parser->name);
+-              /* just use a dummy device path for now */
+-              if (parser->parse(ctx))
+-                      return;
++              count += parser->parse(ctx);
+       }
+-      pb_log("\tno boot_options found\n");
++      if (!count)
++              pb_log("\tno boot_options found\n");
+ }
+ static int compare_parsers(const void *a, const void *b)
+diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c
+index 1000505..6101cd8 100644
+--- a/discover/yaboot-parser.c
++++ b/discover/yaboot-parser.c
+@@ -295,7 +295,7 @@ static int yaboot_parse(struct discover_context *dc)
+       conf = talloc_zero(dc, struct conf_context);
+       if (!conf)
+-              return -1;
++              return 0;
+       conf->dc = dc;
+       conf->global_options = yaboot_global_options,
+diff --git a/lib/log/log.h b/lib/log/log.h
+index 2a5d375..6f44bea 100644
+--- a/lib/log/log.h
++++ b/lib/log/log.h
+@@ -3,7 +3,7 @@
+ #include <stdio.h>
+-void pb_log(const char *fmt, ...);
++void __attribute__ ((format (printf, 1, 2))) pb_log(const char *fmt, ...);
+ void pb_log_set_stream(FILE *stream);
+ FILE * pb_log_get_stream(void);
+ void pb_log_always_flush(int state);
+diff --git a/lib/system/system.c b/lib/system/system.c
+index 65bd6bf..7371445 100644
+--- a/lib/system/system.c
++++ b/lib/system/system.c
+@@ -20,6 +20,7 @@ const struct pb_system_apps pb_system_apps = {
+       .cp = "/bin/cp",
+       .kexec = "/sbin/kexec",
+       .mount = "/bin/mount",
++      .shutdown = "/sbin/shutdown",
+       .sftp = "/usr/bin/sftp",
+       .tftp = "/usr/bin/tftp",
+       .umount = "/bin/umount",
+diff --git a/lib/system/system.h b/lib/system/system.h
+index 47c7c02..1918309 100644
+--- a/lib/system/system.h
++++ b/lib/system/system.h
+@@ -5,6 +5,7 @@ struct pb_system_apps {
+       const char *cp;
+       const char *kexec;
+       const char *mount;
++      const char *shutdown;
+       const char *sftp;
+       const char *tftp;
+       const char *umount;
+diff --git a/ui/common/discover-client.c b/ui/common/discover-client.c
+index e8ce4dd..5b42b6c 100644
+--- a/ui/common/discover-client.c
++++ b/ui/common/discover-client.c
+@@ -46,7 +46,7 @@ struct discover_client* discover_client_init(
+       client->ops.cb_arg = cb_arg;
+       client->fd = socket(AF_UNIX, SOCK_STREAM, 0);
+-      if (!client->fd < 0) {
++      if (client->fd < 0) {
+               pb_log("%s: socket: %s\n", __func__, strerror(errno));
+               goto out_err;
+       }
+diff --git a/ui/common/loader.c b/ui/common/loader.c
+index 0fe62a0..5c69533 100644
+--- a/ui/common/loader.c
++++ b/ui/common/loader.c
+@@ -263,16 +263,22 @@ fail:
+ /**
+  * pb_load_file - Loads a remote file and returns the local file path.
+  * @ctx: The talloc context to associate with the returned string.
++ * @remote: The remote file URL.
++ * @tempfile: An optional variable pointer to be set when a temporary local
++ *  file is created.
+  *
+  * Returns the local file path in a talloc'ed character string on success,
+  * or NULL on error.
+  */
+-char *pb_load_file(void *ctx, const char *remote)
++char *pb_load_file(void *ctx, const char *remote, unsigned int *tempfile)
+ {
+       char *local;
+       struct pb_url *url = pb_url_parse(NULL, remote);
++      if (tempfile)
++              *tempfile = 0;
++
+       if (!url)
+               return NULL;
+@@ -280,19 +286,28 @@ char *pb_load_file(void *ctx, const char *remote)
+       case pb_url_ftp:
+       case pb_url_http:
+               local = pb_load_wget(ctx, url, 0);
++              if (tempfile && local)
++                      *tempfile = 1;
+               break;
+       case pb_url_https:
+-              local = pb_load_wget(ctx, url,
+-                      wget_no_check_certificate);
++              local = pb_load_wget(ctx, url, wget_no_check_certificate);
++              if (tempfile && local)
++                      *tempfile = 1;
+               break;
+       case pb_url_nfs:
+               local = pb_load_nfs(ctx, url);
++              if (tempfile && local)
++                      *tempfile = 1;
+               break;
+       case pb_url_sftp:
+               local = pb_load_sftp(ctx, url);
++              if (tempfile && local)
++                      *tempfile = 1;
+               break;
+       case pb_url_tftp:
+               local = pb_load_tftp(ctx, url);
++              if (tempfile && local)
++                      *tempfile = 1;
+               break;
+       default:
+               local = talloc_strdup(ctx, url->full);
+diff --git a/ui/common/loader.h b/ui/common/loader.h
+index b06bb43..42d4d4b 100644
+--- a/ui/common/loader.h
++++ b/ui/common/loader.h
+@@ -19,6 +19,6 @@
+ #if !defined(_PB_FILE_LOADER_H)
+ #define _PB_FILE_LOADER_H
+-char *pb_load_file(void *ctx, const char *remote);
++char *pb_load_file(void *ctx, const char *remote, unsigned int *tempfile);
+ #endif
+diff --git a/ui/common/ps3.c b/ui/common/ps3.c
+index cb1c8d1..c62a10d 100644
+--- a/ui/common/ps3.c
++++ b/ui/common/ps3.c
+@@ -87,7 +87,7 @@ static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
+       result = os_area_fixed_read(&fc->header, &fc->params, fc->dev);
+       if (result) {
+-              pb_log("%s: os_area_fixed_read failed: %s\n", __func__);
++              pb_log("%s: os_area_fixed_read failed\n", __func__);
+               goto fail;
+       }
+@@ -114,7 +114,7 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
+       result = ps3_flash_open(&fc, "r");
+       if (result)
+-              goto done;
++              goto fail;
+       result = os_area_db_read(&fc.db, &fc.header, fc.dev);
+@@ -123,7 +123,7 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
+       if (result) {
+               pb_log("%s: os_area_db_read failed: %s\n", __func__,
+                       strerror(errno));
+-              goto done;
++              goto fail;
+       }
+       sum = result = os_area_db_get(&fc.db, &id_default_item, &tmp);
+@@ -141,14 +141,13 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
+       if (!result)
+               values->video_mode = (uint16_t)tmp;
+-done:
+       pb_log("%s: default_item: %x\n", __func__,
+               (unsigned int)values->default_item);
+       pb_log("%s: timeout: %u\n", __func__,
+               (unsigned int)values->timeout);
+       pb_log("%s: video_mode:   %u\n", __func__,
+               (unsigned int)values->video_mode);
+-
++fail:
+       return (result || sum) ? -1 : 0;
+ }
+diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
+index bd6dd31..0140f0e 100644
+--- a/ui/common/ui-system.c
++++ b/ui/common/ui-system.c
+@@ -33,13 +33,13 @@
+ #include "ui-system.h"
+ /**
+- * run_kexec_local - Final kexec helper.
++ * kexec_load - kexec load helper.
+  * @l_image: The local image file for kexec to execute.
+  * @l_initrd: Optional local initrd file for kexec --initrd, can be NULL.
+  * @args: Optional command line args for kexec --append, can be NULL.
+  */
+-static int run_kexec_local(const char *l_image, const char *l_initrd,
++static int kexec_load(const char *l_image, const char *l_initrd,
+       const char *args)
+ {
+       int result;
+@@ -49,34 +49,64 @@ static int run_kexec_local(const char *l_image, const char *l_initrd,
+       char *s_args = NULL;
+       p = argv;
+-      *p++ = pb_system_apps.kexec;            /* 1 */
++      *p++ = pb_system_apps.kexec;    /* 1 */
++      *p++ = "-l";                    /* 2 */
+       if (l_initrd) {
+               s_initrd = talloc_asprintf(NULL, "--initrd=%s", l_initrd);
+               assert(s_initrd);
+-              *p++ = s_initrd;                 /* 2 */
++              *p++ = s_initrd;         /* 3 */
+       }
+       if (args) {
+               s_args = talloc_asprintf(NULL, "--append=%s", args);
+               assert(s_args);
+-              *p++ = s_args;                   /* 3 */
++              *p++ = s_args;          /* 4 */
+       }
+-      /* First try by telling kexec to run shutdown */
++      *p++ = l_image;                 /* 5 */
++      *p++ = NULL;                    /* 6 */
+-      *(p + 0) = l_image;
+-      *(p + 1) = NULL;
++      result = pb_run_cmd(argv);
++
++      if (result)
++              pb_log("%s: failed: (%d)\n", __func__, result);
++
++      talloc_free(s_initrd);
++      talloc_free(s_args);
++
++      return result;
++}
++
++/**
++ * kexec_reboot - Helper to boot the new kernel.
++ *
++ * Must only be called after a successful call to kexec_load().
++ */
++
++static int kexec_reboot(void)
++{
++      int result;
++      const char *argv[4];
++      const char **p;
++
++      /* First try running shutdown.  Init scripts should run 'exec -e' */
++
++      p = argv;
++      *p++ = pb_system_apps.shutdown; /* 1 */
++      *p++ =  "-r";                   /* 2 */
++      *p++ =  "now";                  /* 3 */
++      *p++ =  NULL;                   /* 4 */
+       result = pb_run_cmd(argv);
+-      /* kexec will return zero on success */
+-      /* On error, force a kexec with the -f option */
++      /* On error, force a kexec with the -e option */
+       if (result) {
+-              *(p + 0) = "-f";                /* 4 */
+-              *(p + 1) = l_image;             /* 5 */
+-              *(p + 2) = NULL;                /* 6 */
++              p = argv;
++              *p++ = pb_system_apps.kexec;    /* 1 */
++              *p++ = "-e";                    /* 2 */
++              *p++ = NULL;                    /* 3 */
+               result = pb_run_cmd(argv);
+       }
+@@ -84,9 +114,6 @@ static int run_kexec_local(const char *l_image, const char *l_initrd,
+       if (result)
+               pb_log("%s: failed: (%d)\n", __func__, result);
+-      talloc_free(s_initrd);
+-      talloc_free(s_args);
+-
+       return result;
+ }
+@@ -99,31 +126,44 @@ int pb_run_kexec(const struct pb_kexec_data *kd)
+       int result;
+       char *l_image = NULL;
+       char *l_initrd = NULL;
++      unsigned int clean_image = 0;
++      unsigned int clean_initrd = 0;
+       pb_log("%s: image:  '%s'\n", __func__, kd->image);
+       pb_log("%s: initrd: '%s'\n", __func__, kd->initrd);
+       pb_log("%s: args:   '%s'\n", __func__, kd->args);
++      result = -1;
++
+       if (kd->image) {
+-              l_image = pb_load_file(NULL, kd->image);
++              l_image = pb_load_file(NULL, kd->image, &clean_image);
+               if (!l_image)
+-                      return -1;
++                      goto no_load;
+       }
+       if (kd->initrd) {
+-              l_initrd = pb_load_file(NULL, kd->initrd);
++              l_initrd = pb_load_file(NULL, kd->initrd, &clean_initrd);
+               if (!l_initrd)
+-                      return -1;
++                      goto no_load;
+       }
+       if (!l_image && !l_initrd)
+-              return -1;
++              goto no_load;
++
++      result = kexec_load(l_image, l_initrd, kd->args);
+-      result = run_kexec_local(l_image, l_initrd, kd->args);
++no_load:
++      if (clean_image)
++              unlink(l_image);
++      if (clean_initrd)
++              unlink(l_initrd);
+       talloc_free(l_image);
+       talloc_free(l_initrd);
++      if (!result)
++              result = kexec_reboot();
++
+       return result;
+ }
+diff --git a/ui/common/url.c b/ui/common/url.c
+index 0de0f58..544eee2 100644
+--- a/ui/common/url.c
++++ b/ui/common/url.c
+@@ -140,7 +140,7 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
+               path = strchr(p, '/');
+               if (!path) {
+-                      pb_log("%s: parse path failed '%s'\n", p);
++                      pb_log("%s: parse path failed '%s'\n", __func__ , p);
+                       goto fail;
+               }
diff --git a/utils/petitboot/patches/020-petitboot-fix-pb-twin.diff b/utils/petitboot/patches/020-petitboot-fix-pb-twin.diff
new file mode 100644 (file)
index 0000000..aa24f56
--- /dev/null
@@ -0,0 +1,1521 @@
+a work-in-progress
+
+Subject: Update PS3 twin GUI program
+
+Update the PS3 twin GUI program to work with petitboot-multi-ui.
+
+Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
+---
+ Makefile.in        |    1 
+ configure.ac       |   12 
+ rules.mk           |   14 
+ ui/twin/ps3-twin.c | 1441 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 1463 insertions(+), 5 deletions(-)
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -18,6 +18,7 @@ twin_LDFLAGS = @twin_LIBS@
+ # build target
+ ENABLE_PS3 = @ENABLE_PS3@
++ENABLE_X11 = @ENABLE_X11@
+ # other programs
+ INSTALL = @INSTALL@
+--- a/configure.ac
++++ b/configure.ac
+@@ -56,7 +56,17 @@ AS_IF([test "x$with_twin" != xno],
+               [if test "x$with_twin" != xcheck; then
+                       AC_MSG_FAILURE([--with-twin was given, but test for twin failed])
+               fi],
+-              [${twin_LIBS}])])
++              [${twin_LIBS}])
++      AC_CHECK_HEADERS([libtwin/twin_x11.h])])
++
++AC_ARG_ENABLE([x11],
++      [AS_HELP_STRING([--enable-x11],
++              [build for x11])],
++      [],
++      [enable_x11=check])
++
++AS_IF([test "x$enable_x11" != xno], [AC_SUBST([ENABLE_X11], ["y"])], [])
++
+ mkdir -p discover lib/list lib/log lib/pb-protocol lib/system lib/talloc \
+       lib/waiter test ui/common ui/ncurses ui/test ui/twin utils
+--- a/rules.mk
++++ b/rules.mk
+@@ -54,7 +54,7 @@ ui_common_objs = ui/common/discover-clie
+       ui/common/url.o
+ ncurses_objs = ui/ncurses/nc-scr.o ui/ncurses/nc-menu.o ui/ncurses/nc-ked.o \
+       ui/ncurses/nc-cui.o
+-twin_objs = ui/twin/pb-twin.o
++twin_objs =
+ # Makefiles
+ makefiles = Makefile $(top_srcdir)/rules.mk
+@@ -89,11 +89,17 @@ $(pb_test): $(pb_test_objs)
+       $(LINK.o) -o $@ $^
+ # twin gui
+-pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o
++pb_twin_objs-y$(ENABLE_PS3) += ui/twin/pb-twin.o
++pb_twin_objs-$(ENABLE_PS3) += ui/twin/ps3-twin.o ui/common/ps3.o
++pb_twin_cflags-$(ENABLE_X11) += -DUSE_X11
++pb_twin_ldflags-$(ENABLE_PS3) += -lps3-utils
++
++pb_twin_objs = $(client_objs) $(twin_objs)  $(pb_twin_objs-y)
+ $(pb_twin_objs): $(makefiles)
+-$(pb_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
+-$(pb_twin): CFLAGS+=$(twin_CFLAGS)
++$(pb_twin): LDFLAGS += $(pb_twin_ldflags-y) $(twin_LDFLAGS) $(LIBTWIN)
++$(pb_twin): CFLAGS += $(pb_twin_cflags-y) $(twin_CFLAGS) \
++      -DPB_ARTWORK_PATH='"$(pkgdatadir)/artwork/"'
+ $(pb_twin): $(pb_twin_objs)
+       $(LINK.o) -o $@ $^
+--- /dev/null
++++ b/ui/twin/ps3-twin.c
+@@ -0,0 +1,1441 @@
++/*
++ * Petitboot twin bootloader for the PS3 game console
++ *
++ *  Copyright (C) 2009 Sony Computer Entertainment Inc.
++ *  Copyright 2009 Sony Corp.
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; version 2 of the License.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, write to the Free Software
++ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ */
++
++#if defined(HAVE_CONFIG_H)
++#include "config.h"
++#endif
++
++#define _GNU_SOURCE
++#include <assert.h>
++#include <errno.h>
++#include <getopt.h>
++#include <signal.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/time.h>
++#include <libtwin/twin.h>
++#include <libtwin/twin_fbdev.h>
++#include <libtwin/twin_jpeg.h>
++#include <libtwin/twin_linux_mouse.h>
++#include <libtwin/twin_linux_js.h>
++#include <libtwin/twin_png.h>
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
++# include <libtwin/twin_x11.h>
++#endif
++#include <linux/input.h>
++
++#include "log/log.h"
++#include "talloc/talloc.h"
++#include "waiter/waiter.h"
++#include "ui/common/discover-client.h"
++#include "ui/common/ps3.h"
++#include "ui/common/timer.h"
++
++//------------------------------------------------------------------------------
++// twin-ui.c/h
++
++#define DBG(fmt, args...) pb_log("DBG: " fmt, ## args)
++#define DBGS(fmt, args...) \
++      pb_log("DBG:%s:%d: " fmt, __func__, __LINE__, ## args)
++
++/* control to keyboard mappings for the sixaxis controller */
++uint8_t sixaxis_map[] = {
++      0,              /*   0  Select          */
++      0,              /*   1  L3              */
++      0,              /*   2  R3              */
++      0,              /*   3  Start           */
++      KEY_UP,         /*   4  Dpad Up         */
++      KEY_RIGHT,      /*   5  Dpad Right      */
++      KEY_DOWN,       /*   6  Dpad Down       */
++      KEY_LEFT,       /*   7  Dpad Left       */
++      0,              /*   8  L2              */
++      0,              /*   9  R2              */
++      0,              /*  10  L1              */
++      0,              /*  11  R1              */
++      0,              /*  12  Triangle        */
++      KEY_ENTER,      /*  13  Circle          */
++      0,              /*  14  Cross           */
++      KEY_DELETE,     /*  15  Square          */
++      0,              /*  16  PS Button       */
++      0,              /*  17  nothing      */
++      0,              /*  18  nothing      */
++};
++
++#define PBOOT_LEFT_PANE_SIZE          160
++#define PBOOT_LEFT_PANE_COLOR         0x80000000
++#define PBOOT_LEFT_LINE_COLOR         0xff000000
++
++#define PBOOT_LEFT_FOCUS_WIDTH                80
++#define PBOOT_LEFT_FOCUS_HEIGHT               80
++#define PBOOT_LEFT_FOCUS_XOFF         40
++#define PBOOT_LEFT_FOCUS_YOFF         40
++#define PBOOT_LEFT_FOCUS_XRAD         (6 * TWIN_FIXED_ONE)
++#define PBOOT_LEFT_FOCUS_YRAD         (6 * TWIN_FIXED_ONE)
++
++#define PBOOT_RIGHT_FOCUS_XOFF                20
++#define PBOOT_RIGHT_FOCUS_YOFF                60
++#define PBOOT_RIGHT_FOCUS_HEIGHT      80
++#define PBOOT_RIGHT_FOCUS_XRAD                (6 * TWIN_FIXED_ONE)
++#define PBOOT_RIGHT_FOCUS_YRAD                (6 * TWIN_FIXED_ONE)
++
++#define PBOOT_LEFT_ICON_WIDTH         64
++#define PBOOT_LEFT_ICON_HEIGHT                64
++#define PBOOT_LEFT_ICON_XOFF          50
++#define PBOOT_LEFT_ICON_YOFF          50
++#define PBOOT_LEFT_ICON_STRIDE                100
++
++#define PBOOT_RIGHT_OPTION_LMARGIN    30
++#define PBOOT_RIGHT_OPTION_RMARGIN    30
++#define PBOOT_RIGHT_OPTION_TMARGIN    70
++#define PBOOT_RIGHT_OPTION_HEIGHT     64
++#define PBOOT_RIGHT_OPTION_STRIDE     100
++#define PBOOT_RIGHT_TITLE_TEXT_SIZE   (30 * TWIN_FIXED_ONE)
++#define PBOOT_RIGHT_SUBTITLE_TEXT_SIZE        (18 * TWIN_FIXED_ONE)
++#define PBOOT_RIGHT_TITLE_XOFFSET     80
++#define PBOOT_RIGHT_TITLE_YOFFSET     30
++#define PBOOT_RIGHT_SUBTITLE_XOFFSET  100
++#define PBOOT_RIGHT_SUBTITLE_YOFFSET  50
++#define PBOOT_RIGHT_BADGE_XOFFSET     2
++#define PBOOT_RIGHT_BADGE_YOFFSET     0
++
++
++#define PBOOT_RIGHT_TITLE_COLOR               0xff000000
++#define PBOOT_RIGHT_SUBTITLE_COLOR    0xff400000
++
++#define PBOOT_FOCUS_COLOR             0x10404040
++
++#define PBOOT_STATUS_PANE_COLOR               0x60606060
++#define PBOOT_STATUS_PANE_HEIGHT      20
++#define PBOOT_STATUS_PANE_XYMARGIN    20
++#define PBOOT_STATUS_TEXT_MARGIN      10
++#define PBOOT_STATUS_TEXT_SIZE                (16 * TWIN_FIXED_ONE)
++#define PBOOT_STATUS_TEXT_COLOR               0xff000000
++
++#define PBOOT_MAX_OPTION 100
++#define PBOOT_MAX_DEV 10
++
++struct pbt_option
++{
++      char            *title;
++      char            *subtitle;
++      twin_pixmap_t   *badge;
++      twin_pixmap_t   *cache;
++      twin_rect_t     box;
++      void            *data;
++};
++
++struct pbt_device
++{
++      char                    *id;
++      twin_pixmap_t           *badge;
++      twin_rect_t             box;
++      int                     option_count;
++      struct pbt_option               options[PBOOT_MAX_OPTION];
++};
++
++enum pbt_sig {
++      pbt_scr_sig = 111,
++      pbt_menu_sig = 222,
++      pbt_pane_sig = 333,
++      pb_removed_sig = -555,
++};
++
++struct pbt_cursor {
++      twin_pixmap_t *pixmap;
++      int hx;
++      int hy;
++};
++
++struct pbt_scr {
++      enum pbt_sig sig;
++      struct pbt_cursor cursor;
++      twin_screen_t *tscreen;
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
++      twin_x11_t *x11;
++#endif
++      twin_fbdev_t *fbdev;
++};
++
++struct pbt_frame {
++      twin_label_t *title;
++      twin_label_t *help;
++      twin_label_t *status;
++};
++
++/**
++ * struct pbt_pane - A twin menu pane.
++ */
++
++struct pbt_pane {
++      enum pbt_sig sig;
++      twin_window_t *window;
++      twin_rect_t focus_box;
++      int focus_start;
++      int focus_target;
++      int focus_curindex;
++      int mouse_target;
++      int has_focus;
++};
++
++/**
++ * struct pbt_menu - A twin menu.
++ * @sig: Sanity check signature.
++ * @scr: The screen this menu is associated with.
++ * @dp: The device pane instance.
++ * @op: The option pane instance.
++ */
++
++struct pbt_menu {
++      enum pbt_sig sig;
++      struct pbt_scr *scr;
++      struct pbt_pane *dp;
++      struct pbt_pane *op;
++};
++
++//==============================================================================
++// helper
++//==============================================================================
++
++static struct pbt_scr *pbt_scr_from_tscreen(twin_screen_t *tscreen);
++
++static struct pbt_menu *pbt_menu_from_twindow(twin_window_t *twindow)
++{
++      struct pbt_menu *menu = twindow->client_data;
++
++      assert(menu);
++      assert(menu->sig == pbt_menu_sig);
++      return menu;
++}
++
++/*
++static struct pbt_menu *pbt_menu_from_arg(void *arg)
++{
++      struct pbt_menu *menu = arg;
++
++      assert(menu);
++      assert(menu->sig == pbt_menu_sig);
++      return menu;
++}
++*/
++
++static struct pbt_pane *pbt_pane_from_arg(void *arg)
++{
++      struct pbt_pane *pane = arg;
++
++      assert(pane);
++      assert(pane->sig == pbt_pane_sig);
++      return pane;
++}
++
++static twin_bool_t pbt_rect_intersect(twin_rect_t r1, twin_rect_t r2)
++{
++      // FIXME: move this to twin!!!
++      return !(r1.left > r2.right ||
++               r1.right < r2.left ||
++               r1.top > r2.bottom ||
++               r1.bottom < r2.top);
++}
++
++static twin_pixmap_t * pbt_load_background(twin_screen_t *tscreen)
++{
++      static const char *bgd = PB_ARTWORK_PATH "/background.jpg";
++      twin_pixmap_t *rawpix;
++      twin_pixmap_t *scaledpix;
++
++      rawpix = twin_jpeg_to_pixmap(bgd, TWIN_ARGB32);
++
++      if (!rawpix) {
++              pb_log("%s: loading image %s failed\n", __func__, bgd);
++              return twin_make_pattern();
++      }
++
++      if (tscreen->height == rawpix->height &&
++              tscreen->width == rawpix->width)
++              return rawpix;
++
++      /* Scale as needed. */
++
++      twin_fixed_t sx, sy;
++      twin_operand_t srcop;
++
++      scaledpix = twin_pixmap_create(TWIN_ARGB32,
++                              tscreen->width,
++                              tscreen->height);
++      if (!scaledpix) {
++              pb_log("%s: scale %s failed\n", __func__, bgd);
++              twin_pixmap_destroy(rawpix);
++              return twin_make_pattern();
++      }
++      sx = twin_fixed_div(twin_int_to_fixed(rawpix->width),
++                      twin_int_to_fixed(tscreen->width));
++      sy = twin_fixed_div(twin_int_to_fixed(rawpix->height),
++                      twin_int_to_fixed(tscreen->height));
++
++      twin_matrix_scale(&rawpix->transform, sx, sy);
++      srcop.source_kind = TWIN_PIXMAP;
++      srcop.u.pixmap = rawpix;
++      twin_composite(scaledpix, 0, 0, &srcop, 0, 0,
++              NULL, 0, 0, TWIN_SOURCE,
++              tscreen->width, tscreen->height);
++
++      twin_pixmap_destroy(rawpix);
++      return scaledpix;
++}
++
++//==============================================================================
++// option
++//==============================================================================
++
++static void pbt_option_execute(struct pbt_menu *menu)
++{
++#if 0
++      pboot_device_t *dev = pboot_devices[pboot_dev_sel];
++      pboot_option_t *opt = &dev->options[menu->op->focus_curindex];
++
++      pb_log("Selected device %s\n", opt->title);
++      pboot_message("booting %s...", opt->title);
++
++      /* Give user feedback, make sure errors and panics will be seen */
++      pboot_exec_option(opt->data);
++#endif
++}
++
++//==============================================================================
++// device
++//==============================================================================
++
++//==============================================================================
++// scr
++//==============================================================================
++
++static twin_bool_t pbt_scr_event(twin_screen_t *tscreen, twin_event_t *event)
++{
++      struct pbt_scr *scr = pbt_scr_from_tscreen(tscreen);
++
++      switch(event->kind) {
++      case TwinEventEnter:
++      case TwinEventMotion:
++      case TwinEventLeave:
++      case TwinEventButtonDown:
++      case TwinEventButtonUp:
++              if (scr->cursor.pixmap)
++                      twin_screen_set_cursor(tscreen, scr->cursor.pixmap,
++                              scr->cursor.hx, scr->cursor.hy);
++              break;
++      case TwinEventJoyButton:
++              /* map joystick events into key events */
++              if (event->u.js.control >= sizeof(sixaxis_map))
++                      break;
++
++              event->u.key.key = sixaxis_map[event->u.js.control];
++              if (event->u.js.value == 0) {
++                      event->kind = TwinEventKeyUp;
++                      break;
++              } else {
++                      event->kind = TwinEventKeyDown;
++              }
++              /* fall through.. */
++      case TwinEventKeyDown:
++              switch(event->u.key.key) {
++              case KEY_0:
++                      return TWIN_TRUE;
++              case KEY_BACKSPACE:
++              case KEY_DELETE:
++                      return TWIN_FALSE;
++              }
++      case TwinEventKeyUp:
++              twin_screen_set_cursor(tscreen, NULL, 0, 0);
++              break;
++      default:
++              break;
++      }
++      return TWIN_FALSE;
++}
++
++//==============================================================================
++// pane
++//==============================================================================
++
++static int pbt_pane_has_focus(const struct pbt_pane *pane)
++{
++      return pane->has_focus;
++}
++
++static twin_time_t pbt_pane_timeout(twin_time_t now, void *closure)
++{
++      const int accel[11] = { 7, 4, 2, 1, 1, 1, 1, 1, 2, 2, 3 };
++      struct pbt_pane *pane = pbt_pane_from_arg(closure);
++      int dir = 1, dist, pos;
++
++      dist = abs(pane->focus_target - pane->focus_start);
++      dir = dist > 5 ? 5 : dist;
++      pos = pane->focus_target - (int)pane->focus_box.top;
++      if (pos == 0) {
++              return -1;
++      }
++      if (pos < 0) {
++              dir = -dir;
++              pos = -pos;
++      }
++      twin_window_damage(pane->window,
++                         pane->focus_box.left,
++                         pane->focus_box.top,
++                         pane->focus_box.right,
++                         pane->focus_box.bottom);
++
++      pane->focus_box.top += dir;
++      pane->focus_box.bottom += dir;
++
++      twin_window_damage(pane->window,
++                         pane->focus_box.left,
++                         pane->focus_box.top,
++                         pane->focus_box.right,
++                         pane->focus_box.bottom);
++
++      twin_window_queue_paint(pane->window);
++
++      return accel[(pos * 10) / dist];
++}
++
++//==============================================================================
++// menu
++//==============================================================================
++
++/**
++ * pbt_menu_set_focus - Set the menu's pane of focus.
++ * @menu: The menu to operate on.
++ * @pane: The pane that will have the focus.
++ */
++
++static void pbt_menu_set_focus(struct pbt_menu *menu, struct pbt_pane *pane)
++{
++      assert(!pane->has_focus);
++
++      if (pane == menu->dp) {
++              menu->dp->has_focus = 1;
++              menu->op->has_focus = 0;
++      } else if (pane == menu->op) {
++              menu->dp->has_focus = 0;
++              menu->op->has_focus = 1;
++//            pbt_menu_set_option_focus(menu, 0);
++      } else
++              assert(0 && "bad logic");
++}
++
++static void pbt_menu_pane_select(struct pbt_menu *menu, struct pbt_pane *pane)
++{
++      if(pbt_pane_has_focus(pane))
++              return;
++
++      twin_screen_set_active(menu->scr->tscreen, pane->window->pixmap);
++
++      twin_window_damage(menu->dp->window,
++                         menu->dp->focus_box.left,
++                         menu->dp->focus_box.top,
++                         menu->dp->focus_box.right,
++                         menu->dp->focus_box.bottom);
++      twin_window_damage(menu->op->window,
++                         menu->op->focus_box.left,
++                         menu->op->focus_box.top,
++                         menu->op->focus_box.right,
++                         menu->op->focus_box.bottom);
++
++      twin_window_queue_paint(menu->dp->window);
++      twin_window_queue_paint(menu->op->window);
++
++      pbt_menu_set_focus(menu, pane);
++}
++
++
++static struct pbt_pane *pbt_device_pane_create(struct pbt_menu *menu);
++static struct pbt_pane *pbt_option_pane_create(struct pbt_menu *menu);
++
++static struct pbt_menu *pbt_menu_create(void *ctx, struct pbt_scr *scr)
++{
++      struct pbt_menu *menu = talloc_zero(ctx, struct pbt_menu);
++
++      if (!menu)
++              return NULL;
++
++      assert(scr && scr->sig == pbt_scr_sig);
++
++      menu->sig = pbt_menu_sig;
++      menu->scr = scr;
++
++      menu->dp = pbt_device_pane_create(menu);
++
++      if (!menu->dp)
++              goto fail_dp;
++
++      menu->op = pbt_option_pane_create(menu);
++
++      if (!menu->op)
++              goto fail_op;
++
++      return menu;
++
++fail_op:
++      //clean dp
++fail_dp:
++      talloc_free(menu);
++      return NULL;
++}
++
++//==============================================================================
++// device_pane
++//==============================================================================
++
++static void pbt_device_pane_draw(twin_window_t *window)
++{
++      struct pbt_pane *dp = pbt_menu_from_twindow(window)->dp;
++      twin_pixmap_t   *px = window->pixmap;
++      twin_path_t     *path;
++      twin_fixed_t    x, y, w, h;
++      int             i;
++
++      /* Fill background */
++      twin_fill(px, PBOOT_LEFT_PANE_COLOR, TWIN_SOURCE, 0, 0, px->width,
++              px->height);
++
++      /* Create a path for use later */
++      path = twin_path_create();
++      assert(path);
++
++      /* Draw right line if needed */
++      if (px->clip.right > (PBOOT_LEFT_PANE_SIZE - 4)) {
++              x = twin_int_to_fixed(PBOOT_LEFT_PANE_SIZE - 4);
++              y = twin_int_to_fixed(px->height);
++              twin_path_rectangle(path, x, 0, 0x40000, y);
++              twin_paint_path(px, PBOOT_LEFT_LINE_COLOR, path);
++              twin_path_empty(path);
++      }
++
++      /* Draw focus box */
++      if (dp->focus_curindex >= 0 &&
++          pbt_rect_intersect(dp->focus_box, px->clip)) {
++              x = twin_int_to_fixed(dp->focus_box.left + 2);
++              y = twin_int_to_fixed(dp->focus_box.top + 2);
++              w = twin_int_to_fixed(dp->focus_box.right -
++                                    dp->focus_box.left - 4);
++              h = twin_int_to_fixed(dp->focus_box.bottom -
++                                    dp->focus_box.top - 4);
++              twin_path_rounded_rectangle(path, x, y, w, h,
++                                          PBOOT_LEFT_FOCUS_XRAD,
++                                          PBOOT_LEFT_FOCUS_YRAD);
++              if (pbt_pane_has_focus(dp))
++                      twin_paint_path(px, PBOOT_FOCUS_COLOR, path);
++              else
++                      twin_paint_stroke(px, PBOOT_FOCUS_COLOR, path,
++                                        4 * TWIN_FIXED_ONE);
++      }
++
++#if 0
++      /* Draw icons */
++      for (i = 0; i < pboot_dev_count; i++) {
++              pboot_device_t  *dev = pboot_devices[i];
++              twin_operand_t  src;
++
++              if (!twin_rect_intersect(dev->box, px->clip))
++                      continue;
++
++              src.source_kind = TWIN_PIXMAP;
++              src.u.pixmap = dev->badge;
++
++              twin_composite(px, dev->box.left, dev->box.top,
++                             &src, 0, 0, NULL, 0, 0, TWIN_OVER,
++                             dev->box.right - dev->box.left,
++                             dev->box.bottom - dev->box.top);
++      }
++#endif
++
++      /* Destroy path */
++      twin_path_destroy(path);
++}
++
++
++static void pbt_device_pane_set_focus(struct pbt_menu *menu, int index)
++{
++#if 0
++      if (index >= pboot_dev_count)
++              return;
++#endif
++
++      menu->dp->focus_start = menu->dp->focus_box.top;
++
++      if (index < 0)
++              menu->dp->focus_target = 0 - PBOOT_LEFT_FOCUS_HEIGHT;
++      else
++              menu->dp->focus_target = PBOOT_LEFT_FOCUS_YOFF +
++                      PBOOT_LEFT_ICON_STRIDE * index;
++
++      menu->dp->focus_curindex = index;
++
++      twin_set_timeout(pbt_pane_timeout, 0, menu->dp);
++}
++
++static void pbt_device_pane_mousetrack(struct pbt_menu *menu, twin_coord_t x,
++      twin_coord_t y)
++{
++      int candidate = -1;
++      twin_coord_t icon_top;
++
++      if (x < PBOOT_LEFT_ICON_XOFF ||
++          x > (PBOOT_LEFT_ICON_XOFF + PBOOT_LEFT_ICON_WIDTH))
++              goto miss;
++
++      if (y < PBOOT_LEFT_ICON_YOFF)
++              goto miss;
++
++      candidate = (y - PBOOT_LEFT_ICON_YOFF) / PBOOT_LEFT_ICON_STRIDE;
++
++#if 0
++      if (candidate >= pboot_dev_count) {
++              candidate = -1;
++              goto miss;
++      }
++#endif
++      if (candidate == menu->dp->mouse_target)
++              return;
++
++      icon_top = PBOOT_LEFT_ICON_YOFF + candidate * PBOOT_LEFT_ICON_STRIDE;
++
++      if (y > (icon_top + PBOOT_LEFT_ICON_HEIGHT)) {
++              candidate = -1;
++              goto miss;
++      }
++
++      /* The mouse hit an icon that wasn't the same
++       * as the previous one, trigger a focus change.
++       */
++
++      pbt_device_pane_set_focus(menu, candidate);
++
++ miss:
++      menu->dp->mouse_target = candidate;
++}
++
++static twin_bool_t pbt_device_pane_event(twin_window_t *window,
++      twin_event_t *event)
++{
++      struct pbt_menu *menu = pbt_menu_from_twindow(window);
++
++      /* filter out all mouse events */
++      switch(event->kind) {
++      case TwinEventEnter:
++      case TwinEventMotion:
++      case TwinEventLeave:
++              pbt_menu_pane_select(menu, menu->dp);
++              pbt_device_pane_mousetrack(menu, event->u.pointer.x,
++                      event->u.pointer.y);
++              return TWIN_TRUE;
++      case TwinEventButtonDown:
++      case TwinEventButtonUp:
++              return TWIN_TRUE;
++      case TwinEventKeyDown:
++              switch(event->u.key.key) {
++              case KEY_UP:
++                      if (menu->dp->focus_curindex > 0)
++                              pbt_device_pane_set_focus(menu,
++                                      menu->dp->focus_curindex - 1);
++                      return TWIN_TRUE;
++              case KEY_DOWN:
++                      pbt_device_pane_set_focus(menu, menu->dp->focus_curindex + 1);
++                      return TWIN_TRUE;
++              case KEY_RIGHT:
++                      pbt_menu_pane_select(menu, menu->op);
++                      return TWIN_TRUE;
++              default:
++                      break;
++              }
++              break;
++      default:
++              break;
++      }
++      return TWIN_FALSE;
++}
++
++static struct pbt_pane *pbt_device_pane_create(struct pbt_menu *menu)
++{
++      struct pbt_pane *pane = talloc_zero(menu, struct pbt_pane);
++
++      if (!pane)
++              return NULL;
++
++      pane->sig = pbt_pane_sig;
++      pane->window = twin_window_create(menu->scr->tscreen, TWIN_ARGB32,
++              TwinWindowPlain, 0, 0, PBOOT_LEFT_PANE_SIZE,
++              menu->scr->tscreen->height);
++
++      if (!pane->window)
++              goto fail_window;
++
++      pane->window->draw = pbt_device_pane_draw;
++      pane->window->event = pbt_device_pane_event;
++      pane->window->client_data = menu;
++
++      pane->focus_curindex = -1;
++      pane->focus_box.left = PBOOT_LEFT_FOCUS_XOFF;
++      pane->focus_box.top = -2 * PBOOT_LEFT_FOCUS_HEIGHT;
++      pane->focus_box.right = pane->focus_box.left + PBOOT_LEFT_FOCUS_WIDTH;
++      pane->focus_box.bottom = pane->focus_box.top + PBOOT_LEFT_FOCUS_HEIGHT;
++
++      pane->mouse_target = -1;
++
++      twin_window_show(pane->window);
++      twin_window_queue_paint(pane->window);
++
++      return pane;
++
++fail_window:
++      talloc_free(pane);
++      return NULL;
++}
++
++//==============================================================================
++// option_pane
++//==============================================================================
++
++static void pbt_option_pane_set_focus(struct pbt_menu *menu, int index)
++{
++#if 0
++      pboot_device_t  *dev;
++
++      if (pboot_dev_sel < 0 || pboot_dev_sel >= pboot_dev_count)
++              return;
++      dev = pboot_devices[pboot_dev_sel];
++      if (index < 0 || index >= dev->option_count)
++              return;
++#endif
++
++      menu->op->focus_start = menu->op->focus_box.top;
++      menu->op->focus_target = PBOOT_RIGHT_FOCUS_YOFF +
++              PBOOT_RIGHT_OPTION_STRIDE * index;
++      menu->op->focus_curindex = index;
++
++      twin_set_timeout(pbt_pane_timeout, 0, menu->op);
++}
++
++static void pbt_option_pane_draw(twin_window_t *window)
++{
++      struct pbt_pane *op = pbt_menu_from_twindow(window)->op;
++      twin_pixmap_t   *px = window->pixmap;
++//    pboot_device_t  *dev;
++      twin_path_t     *path;
++      twin_fixed_t    x, y, w, h;
++      int             i;
++
++      /* Fill background */
++      twin_fill(px, 0x00000000, TWIN_SOURCE, 0, 0, px->width, px->height);
++
++      /* Nothing to draw, return */
++//    if (pboot_dev_sel < 0)
++//            return;
++
++      /* Create a path for use later */
++      path = twin_path_create();
++      assert(path);
++
++      /* Draw focus box */
++      if (op->focus_curindex >= 0 &&
++          pbt_rect_intersect(op->focus_box, px->clip)) {
++              x = twin_int_to_fixed(op->focus_box.left + 2);
++              y = twin_int_to_fixed(op->focus_box.top + 2);
++              w = twin_int_to_fixed(op->focus_box.right -
++                                    op->focus_box.left - 4);
++              h = twin_int_to_fixed(op->focus_box.bottom -
++                                    op->focus_box.top - 4);
++              twin_path_rounded_rectangle(path, x, y, w, h,
++                                          PBOOT_RIGHT_FOCUS_XRAD,
++                                          PBOOT_RIGHT_FOCUS_YRAD);
++              if (pbt_pane_has_focus(op))
++                      twin_paint_path(px, PBOOT_FOCUS_COLOR, path);
++              else
++                      twin_paint_stroke(px, PBOOT_FOCUS_COLOR, path,
++                                        4 * TWIN_FIXED_ONE);
++      }
++
++      /* Get device and iterate through options */
++/*
++      dev = pboot_devices[pboot_dev_sel];
++      for (i = 0; i < dev->option_count; i++) {
++              pboot_option_t  *opt = &dev->options[i];
++              twin_operand_t  src;
++
++              if (opt->title == NULL)
++                      continue;
++              if (!pbt_rect_intersect(opt->box, px->clip))
++                      continue;
++              if (opt->cache == NULL)
++                      pboot_draw_option_cache(dev, opt, i);
++
++              src.source_kind = TWIN_PIXMAP;
++              src.u.pixmap = opt->cache;
++
++              twin_composite(px, opt->box.left, opt->box.top,
++                             &src, 0, 0, NULL, 0, 0, TWIN_OVER,
++                             opt->box.right - opt->box.left,
++                             opt->box.bottom - opt->box.top);
++      }
++*/
++      /* Destroy path */
++      twin_path_destroy(path);
++}
++
++static void pbt_option_pane_mousetrack(struct pbt_menu *menu, twin_coord_t x,
++      twin_coord_t y)
++{
++      int candidate = -1;
++
++      if (y < PBOOT_RIGHT_OPTION_TMARGIN)
++              goto miss;
++
++#if 0
++      pboot_device_t  *dev;
++      pboot_option_t  *opt;
++
++      if (pboot_dev_sel < 0 || pboot_dev_sel >= pboot_dev_count)
++              return;
++
++      dev = pboot_devices[pboot_dev_sel];
++
++      candidate = (y - PBOOT_RIGHT_OPTION_TMARGIN) /
++              PBOOT_RIGHT_OPTION_STRIDE;
++
++      if (candidate >= dev->option_count) {
++              candidate = -1;
++              goto miss;
++      }
++
++      if (candidate == op->mouse_target)
++              return;
++
++      opt = &dev->options[candidate];
++
++      if (x < opt->box.left || x > opt->box.right ||
++          y < opt->box.top || y > opt->box.bottom) {
++              candidate = -1;
++              goto miss;
++      }
++#endif
++
++      pbt_option_pane_set_focus(menu, candidate);
++
++miss:
++      menu->op->mouse_target = candidate;
++}
++
++static twin_bool_t pbt_option_pane_event(twin_window_t *window,
++      twin_event_t *event)
++{
++      struct pbt_menu *menu = pbt_menu_from_twindow(window);
++
++      /* filter out all mouse events */
++      switch(event->kind) {
++      case TwinEventEnter:
++      case TwinEventMotion:
++      case TwinEventLeave:
++              pbt_menu_pane_select(menu, menu->op);
++              pbt_option_pane_mousetrack(menu, event->u.pointer.x,
++                      event->u.pointer.y);
++              return TWIN_TRUE;
++      case TwinEventButtonDown:
++              pbt_menu_pane_select(menu, menu->op);
++              pbt_option_pane_mousetrack(menu, event->u.pointer.x,
++                      event->u.pointer.y);
++              pbt_option_execute(menu);
++              return TWIN_TRUE;
++      case TwinEventButtonUp:
++              return TWIN_TRUE;
++      case TwinEventKeyDown:
++              switch(event->u.key.key) {
++              case KEY_UP:
++                      //pbt_menu_set_option_focus(menu, menu->op->focus_curindex - 1);
++                      return TWIN_TRUE;
++              case KEY_DOWN:
++                      //pbt_menu_set_option_focus(menu, menu->op->focus_curindex + 1);
++                      return TWIN_TRUE;
++              case KEY_LEFT:
++                      pbt_menu_pane_select(menu, menu->dp);
++                      return TWIN_TRUE;
++              case KEY_ENTER:
++                      pbt_option_execute(menu);
++              default:
++                      break;
++              }
++              break;
++      default:
++              break;
++      }
++      return TWIN_FALSE;
++}
++
++static struct pbt_pane *pbt_option_pane_create(struct pbt_menu *menu)
++{
++      struct pbt_pane *pane = talloc_zero(menu, struct pbt_pane);
++
++      if (!pane)
++              return NULL;
++
++      pane->sig = pbt_pane_sig;
++      pane->window = twin_window_create(menu->scr->tscreen, TWIN_ARGB32,
++              TwinWindowPlain, PBOOT_LEFT_PANE_SIZE, 0,
++              menu->scr->tscreen->width - PBOOT_LEFT_PANE_SIZE,
++              menu->scr->tscreen->height);
++
++      if (!pane->window)
++              goto fail_window;
++
++      pane->window->draw = pbt_option_pane_draw;
++      pane->window->event = pbt_option_pane_event;
++      pane->window->client_data = menu;
++
++      pane->focus_curindex = -1;
++      pane->focus_box.left = PBOOT_RIGHT_FOCUS_XOFF;
++      pane->focus_box.top = -2 * PBOOT_RIGHT_FOCUS_HEIGHT;
++      pane->focus_box.right = pane->window->pixmap->width
++              - 2 * PBOOT_RIGHT_FOCUS_XOFF;
++      pane->focus_box.bottom = pane->focus_box.top + PBOOT_RIGHT_FOCUS_HEIGHT;
++
++      pane->mouse_target = -1;
++
++      twin_window_show(pane->window);
++      twin_window_queue_paint(pane->window);
++
++      return pane;
++
++fail_window:
++      talloc_free(pane);
++      return NULL;
++}
++
++//==============================================================================
++// junk
++//==============================================================================
++
++#if 0
++
++static pboot_device_t *pboot_devices[PBOOT_MAX_DEV];
++static int            pboot_dev_count;
++static int            pboot_dev_sel = -1;
++
++
++
++
++static int pboot_vmode_change = -1;
++
++static void pboot_message(const char *fmt, ...)
++{
++      va_list ap;
++      char *msg;
++
++      va_start(ap, fmt);
++      vasprintf(&msg, fmt, ap);
++      va_end(ap);
++
++      pb_log(msg);
++}
++
++static void pboot_draw_option_cache(pboot_device_t *dev, pboot_option_t *opt,
++                                  int index)
++{
++      twin_pixmap_t   *px;
++      twin_path_t     *path;
++      twin_fixed_t    tx, ty;
++
++      /* Create pixmap */
++      px = twin_pixmap_create(TWIN_ARGB32, opt->box.right - opt->box.left,
++                               opt->box.bottom - opt->box.top);
++      assert(px);
++      opt->cache = px;
++
++      /* Fill background */
++      twin_fill(px, 0x00000000, TWIN_SOURCE, 0, 0, px->width, px->height);
++
++      /* Allocate a path for drawing */
++      path = twin_path_create();
++      assert(path);
++
++#if 0
++      /* TEST - Bounding rectangle */
++      twin_path_rectangle(path, 0, 0,
++                          twin_int_to_fixed(px->width),
++                          twin_int_to_fixed(px->height));
++      twin_paint_path(px, PBOOT_RIGHT_TITLE_COLOR, path);
++      twin_path_empty(path);
++      twin_fill(px, 0x00000000, TWIN_SOURCE, 2, 2,
++                px->width - 3, px->height - 3);
++#endif
++
++      /* Draw texts */
++      twin_path_set_font_size(path, PBOOT_RIGHT_TITLE_TEXT_SIZE);
++      twin_path_set_font_style(path, TWIN_TEXT_UNHINTED);
++      tx = twin_int_to_fixed(PBOOT_RIGHT_TITLE_XOFFSET);
++      ty = twin_int_to_fixed(PBOOT_RIGHT_TITLE_YOFFSET);
++      twin_path_move (path, tx, ty);
++      twin_path_utf8 (path, opt->title);
++      twin_paint_path (px, PBOOT_RIGHT_TITLE_COLOR, path);
++      twin_path_empty (path);
++
++      if (opt->subtitle) {
++              twin_path_set_font_size(path, PBOOT_RIGHT_SUBTITLE_TEXT_SIZE);
++              twin_path_set_font_style(path, TWIN_TEXT_UNHINTED);
++              tx = twin_int_to_fixed(PBOOT_RIGHT_SUBTITLE_XOFFSET);
++              ty = twin_int_to_fixed(PBOOT_RIGHT_SUBTITLE_YOFFSET);
++              twin_path_move (path, tx, ty);
++              twin_path_utf8 (path, opt->subtitle);
++              twin_paint_path (px, PBOOT_RIGHT_SUBTITLE_COLOR, path);
++              twin_path_empty (path);
++      }
++
++      if (opt->badge) {
++              twin_operand_t  src;
++
++              src.source_kind = TWIN_PIXMAP;
++              src.u.pixmap = opt->badge;
++
++              twin_composite(px, PBOOT_RIGHT_BADGE_XOFFSET,
++                             PBOOT_RIGHT_BADGE_YOFFSET,
++                             &src, 0, 0, NULL, 0, 0, TWIN_OVER,
++                             opt->badge->width, opt->badge->height);
++      }
++
++
++      /* Destroy path */
++      twin_path_destroy(path);
++}
++
++
++
++static int pboot_add_option(int devindex, const char *title,
++                   const char *subtitle, twin_pixmap_t *badge, void *data)
++{
++      pboot_device_t  *dev;
++      pboot_option_t  *opt;
++      twin_coord_t    width;
++      int             index;
++      struct pbt_menu *menu = NULL;
++
++      if (devindex < 0 || devindex >= pboot_dev_count)
++              return -1;
++      dev = pboot_devices[devindex];
++
++      if (dev->option_count >= PBOOT_MAX_OPTION)
++              return -1;
++      index = dev->option_count++;
++      opt = &dev->options[index];
++
++      opt->title = malloc(strlen(title) + 1);
++      strcpy(opt->title, title);
++
++      if (subtitle) {
++              opt->subtitle = malloc(strlen(subtitle) + 1);
++              strcpy(opt->subtitle, subtitle);
++      } else
++              opt->subtitle = NULL;
++
++      opt->badge = badge;
++      opt->cache = NULL;
++
++      width = menu->op->window->pixmap->width -
++              (PBOOT_RIGHT_OPTION_LMARGIN + PBOOT_RIGHT_OPTION_RMARGIN);
++
++      opt->box.left = PBOOT_RIGHT_OPTION_LMARGIN;
++      opt->box.right = opt->box.left + width;
++      opt->box.top = PBOOT_RIGHT_OPTION_TMARGIN +
++              index * PBOOT_RIGHT_OPTION_STRIDE;
++      opt->box.bottom = opt->box.top + PBOOT_RIGHT_OPTION_HEIGHT;
++
++      opt->data = data;
++      return index;
++}
++
++static void pboot_set_device_select(struct pbt_menu *menu, int sel, int force)
++{
++      pb_log("%s: %d -> %d\n", __FUNCTION__, pboot_dev_sel, sel);
++      if (!force && sel == pboot_dev_sel)
++              return;
++      if (sel >= pboot_dev_count)
++              return;
++      pboot_dev_sel = sel;
++      if (force) {
++              menu->dp->focus_curindex = sel;
++              if (sel < 0)
++                      menu->dp->focus_target = 0 - PBOOT_LEFT_FOCUS_HEIGHT;
++              else
++                      menu->dp->focus_target = PBOOT_LEFT_FOCUS_YOFF +
++                              PBOOT_LEFT_ICON_STRIDE * sel;
++              menu->op->focus_box.bottom = menu->dp->focus_target;
++              menu->op->focus_box.bottom = menu->op->focus_box.top +
++                      PBOOT_RIGHT_FOCUS_HEIGHT;
++              twin_window_damage(menu->dp->window,
++                                 0, 0,
++                                 menu->dp->window->pixmap->width,
++                                 menu->dp->window->pixmap->height);
++              twin_window_queue_paint(menu->dp->window);
++      }
++      menu->op->focus_curindex = -1;
++      menu->op->mouse_target = -1;
++      menu->op->focus_box.top = -2*PBOOT_RIGHT_FOCUS_HEIGHT;
++      menu->op->focus_box.bottom = menu->op->focus_box.top +
++              PBOOT_RIGHT_FOCUS_HEIGHT;
++      twin_window_damage(menu->op->window, 0, 0,
++                         menu->op->window->pixmap->width,
++                         menu->op->window->pixmap->height);
++      twin_window_queue_paint(menu->op->window);
++}
++
++static void pboot_quit(void)
++{
++      kill(0, SIGINT);
++}
++
++
++static int pboot_add_device(const char *dev_id, twin_pixmap_t *pixmap)
++{
++      int             index;
++      pboot_device_t  *dev;
++
++      struct pbt_menu *menu = NULL;
++
++      if (pboot_dev_count >= PBOOT_MAX_DEV)
++              return -1;
++
++      index = pboot_dev_count++;
++
++      dev = malloc(sizeof(*dev));
++      memset(dev, 0, sizeof(*dev));
++      dev->id = malloc(strlen(dev_id) + 1);
++      strcpy(dev->id, dev_id);
++      dev->badge = pixmap;
++      dev->box.left = PBOOT_LEFT_ICON_XOFF;
++      dev->box.right = dev->box.left + PBOOT_LEFT_ICON_WIDTH;
++      dev->box.top = PBOOT_LEFT_ICON_YOFF +
++              PBOOT_LEFT_ICON_STRIDE * index;
++      dev->box.bottom = dev->box.top + PBOOT_LEFT_ICON_HEIGHT;
++
++      pboot_devices[index] = dev;
++
++      twin_window_damage(menu->dp->window,
++                         dev->box.left, dev->box.top,
++                         dev->box.right, dev->box.bottom);
++      twin_window_queue_paint(menu->dp->window);
++
++      return index;
++}
++
++static int pboot_remove_device(const char *dev_id)
++{
++      pboot_device_t  *dev = NULL;
++      int             i, newsel = pboot_dev_sel;
++
++      struct pbt_menu *menu = NULL;
++
++      /* find the matching device */
++      for (i = 0; i < pboot_dev_count; i++) {
++              if (!strcmp(pboot_devices[i]->id, dev_id)) {
++                      dev = pboot_devices[i];
++                      break;
++              }
++      }
++
++      if (!dev)
++              return TWIN_FALSE;
++
++      memmove(pboot_devices + i, pboot_devices + i + 1,
++                      sizeof(*pboot_devices) * (pboot_dev_count + i - 1));
++      pboot_devices[--pboot_dev_count] = NULL;
++
++      /* select the newly-focussed device */
++      if (pboot_dev_sel > i)
++              newsel = pboot_dev_sel - 1;
++      else if (pboot_dev_sel == i && i >= pboot_dev_count)
++                      newsel = pboot_dev_count - 1;
++      pboot_set_device_select(menu, newsel, 1);
++
++      /* todo: free device & options */
++
++      return TWIN_TRUE;
++}
++#endif
++
++//------------------------------------------------------------------------------
++
++static void print_version(void)
++{
++      printf("pb-twin (" PACKAGE_NAME ") " PACKAGE_VERSION "\n");
++}
++
++static void print_usage(void)
++{
++      print_version();
++      printf(
++"Usage: pb-twin [-h, --help] [-l, --log log-file] [-r, --reset-defaults]\n"
++"               [-t, --timeout] [-V, --version]\n");
++}
++
++/**
++ * enum opt_value - Tri-state options variables.
++ */
++
++enum opt_value {opt_undef = 0, opt_yes, opt_no};
++
++/**
++ * struct opts - Values from command line options.
++ */
++
++struct opts {
++      enum opt_value show_help;
++      const char *log_file;
++      enum opt_value reset_defaults;
++      enum opt_value use_timeout;
++      enum opt_value show_version;
++};
++
++/**
++ * opts_parse - Parse the command line options.
++ */
++
++static int opts_parse(struct opts *opts, int argc, char *argv[])
++{
++      static const struct option long_options[] = {
++              {"help",           no_argument,       NULL, 'h'},
++              {"log",            required_argument, NULL, 'l'},
++              {"reset-defaults", no_argument,       NULL, 'r'},
++              {"timeout",        no_argument,       NULL, 't'},
++              {"version",        no_argument,       NULL, 'V'},
++              { NULL, 0, NULL, 0},
++      };
++      static const char short_options[] = "hl:trV";
++      static const struct opts default_values = {
++              .log_file = "pb-twin.log",
++      };
++
++      *opts = default_values;
++
++      while (1) {
++              int c = getopt_long(argc, argv, short_options, long_options,
++                      NULL);
++
++              if (c == EOF)
++                      break;
++
++              switch (c) {
++              case 'h':
++                      opts->show_help = opt_yes;
++                      break;
++              case 'l':
++                      opts->log_file = optarg;
++                      break;
++              case 't':
++                      opts->use_timeout = opt_yes;
++                      break;
++              case 'r':
++                      opts->reset_defaults = opt_yes;
++                      break;
++              case 'V':
++                      opts->show_version = opt_yes;
++                      break;
++              default:
++                      opts->show_help = opt_yes;
++                      return -1;
++              }
++      }
++
++      return optind != argc;
++}
++
++/**
++ * struct ps3_gui - Main gui program instance.
++ */
++
++
++struct ps3_gui {
++      struct ui_timer timer;
++      struct ps3_flash_values values;
++      int dirty_values;
++
++      struct pbt_scr scr;
++      struct pbt_frame frame;
++      struct pbt_menu *menu;
++};
++
++static struct ps3_gui ps3;
++
++static struct pbt_scr *pbt_scr_from_tscreen(twin_screen_t *tscreen)
++{
++      assert(ps3.scr.sig == pbt_scr_sig);
++      assert(ps3.scr.tscreen == tscreen);
++      return &ps3.scr;
++}
++
++static void sig_handler(int signum)
++{
++      DBGS("%d\n", signum);
++
++      switch (signum) {
++      case SIGALRM:
++              ui_timer_sigalrm(&ps3.timer);
++              break;
++      case SIGWINCH:
++//            if (ps3.gui)
++//                    gui_resize(ps3.gui);
++              break;
++      default:
++              assert(0 && "unknown sig");
++              /* fall through */
++      case SIGINT:
++      case SIGHUP:
++      case SIGTERM:
++              exit(EXIT_FAILURE);
++//            if (ps3.gui)
++//                    gui_abort(ps3.gui);
++              break;
++      }
++}
++
++/**
++ * main - twin bootloader main routine.
++ */
++
++int main(int argc, char *argv[])
++{
++      static struct sigaction sa;
++      static struct opts opts;
++      int result;
++      int ui_result;
++      unsigned int mode;
++      FILE *log;
++
++      result = opts_parse(&opts, argc, argv);
++
++      if (result) {
++              print_usage();
++              return EXIT_FAILURE;
++      }
++
++      if (opts.show_help == opt_yes) {
++              print_usage();
++              return EXIT_SUCCESS;
++      }
++
++      if (opts.show_version == opt_yes) {
++              print_version();
++              return EXIT_SUCCESS;
++      }
++
++      log = fopen(opts.log_file, "a");
++      assert(log);
++      pb_log_set_stream(log);
++
++#if defined(DEBUG)
++      pb_log_always_flush(1);
++#endif
++
++      pb_log("--- pb-twin ---\n");
++
++      sa.sa_handler = sig_handler;
++      result = sigaction(SIGALRM, &sa, NULL);
++      result += sigaction(SIGHUP, &sa, NULL);
++      result += sigaction(SIGINT, &sa, NULL);
++      result += sigaction(SIGTERM, &sa, NULL);
++      result += sigaction(SIGWINCH, &sa, NULL);
++
++      if (result) {
++              pb_log("%s sigaction failed.\n", __func__);
++              return EXIT_FAILURE;
++      }
++
++      ps3.values = ps3_flash_defaults;
++
++      if (opts.reset_defaults != opt_yes)
++              ps3.dirty_values = ps3_flash_get_values(&ps3.values);
++
++      twin_feature_init(); // need it???
++
++      /* Setup screen. */
++
++      ps3.scr.sig = pbt_scr_sig;
++
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
++# if defined(USE_X11)
++      if (1) {
++# else
++      if (0) {
++# endif
++              ps3.scr.x11 = twin_x11_create(XOpenDisplay(0), 1024, 768);
++
++              if (!ps3.scr.x11) {
++                      perror("failed to create x11 screen !\n");
++                      return EXIT_FAILURE;
++              }
++
++              ps3.scr.tscreen = ps3.scr.x11->screen;
++      } else {
++#else
++      if (1) {
++#endif
++              result = ps3_get_video_mode(&mode);
++
++              /* Current becomes default if ps3_flash_get_values() failed. */
++
++              if (ps3.dirty_values && !result)
++                      ps3.values.video_mode = mode;
++
++              /* Set mode if not at default. */
++
++              if (!result && (ps3.values.video_mode != (uint16_t)mode))
++                      ps3_set_video_mode(ps3.values.video_mode);
++
++              ps3.scr.fbdev = twin_fbdev_create(-1, SIGUSR1);
++
++              if (!ps3.scr.fbdev) {
++                      perror("failed to create fbdev screen !\n");
++                      return EXIT_FAILURE;
++              }
++
++              ps3.scr.tscreen = ps3.scr.fbdev->screen;
++      }
++
++      ps3.scr.tscreen->event_filter = pbt_scr_event;
++
++      twin_screen_set_background(ps3.scr.tscreen,
++              pbt_load_background(ps3.scr.tscreen));
++
++      /* setup menu */
++
++      ps3.menu = pbt_menu_create(NULL, &ps3.scr);
++
++      pbt_device_pane_set_focus(ps3.menu, 0);
++      twin_screen_set_active(ps3.scr.tscreen, ps3.menu->dp->window->pixmap);
++
++      /* Console switch */
++
++      if (ps3.scr.fbdev)
++              twin_fbdev_activate(ps3.scr.fbdev);
++
++      /* run twin */
++
++//    twin_toplevel_show(ps3.toplevel);
++      twin_dispatch();
++
++      pb_log("--- end ---\n");
++
++      return ui_result ? EXIT_FAILURE : EXIT_SUCCESS;
++}
diff --git a/utils/petitboot/petitboot-config.in b/utils/petitboot/petitboot-config.in
new file mode 100644 (file)
index 0000000..c5213c2
--- /dev/null
@@ -0,0 +1,65 @@
+# petitboot package config
+
+config PETITBOOT_GUI
+       bool "Enable Graphical UI support"
+       depends on PACKAGE_petitboot
+       select PACKAGE_libtwin
+       default y
+       help
+        Enable support a petitboot graphical front end based on
+        the twin windowing package.
+
+config PETITBOOT_CUI
+       bool "Enable Command-line UI support"
+       depends on PACKAGE_petitboot
+       select PACKAGE_libncurses
+       default y
+       help
+        Enable support a petitboot command-line front end based on
+        the ncurses package.
+
+config PETITBOOT_DEBUG
+       bool "Build debug versions of petitboot binaries"
+       depends on PACKAGE_petitboot
+       default n
+       help
+        Enable additional petitboot runtime checks and debug messages.
+
+config PETITBOOT_PS3
+       bool "Build in extra support for the PS3 game console"
+       depends on PACKAGE_petitboot
+       default n
+       help
+        Enable additional petitboot runtime checks and debug messages.
+
+choice
+        prompt "Startup behavior"
+        default PETITBOOT_AUTORUN_GUI
+       depends on PETITBOOT_GUI || PETITBOOT_CUI
+
+config PETITBOOT_AUTORUN_GUI
+       bool "Auto run Petitboot GUI"
+       depends on PETITBOOT_GUI
+       help
+        Automatically run Petitboot in graphical mode at
+        system startup.  Note that the Petitboot program has a menu item
+        'Exit to Shell' that can be used to exit the program when
+        it is running.
+
+config PETITBOOT_AUTORUN_CUI
+       bool "Auto run Petitboot CUI"
+       depends on PETITBOOT_CUI
+       help
+        Automatically run Petitboot in command-line mode at system
+        startup.  Note that the Petitboot program has a menu item
+        'Exit to Shell' that can be used to exit the program when
+        it is running.
+
+config PETITBOOT_AUTORUN_NONE
+       bool "Disable Petitboot auto run"
+       help
+        Disable Petitboot from running automatically at system startup.
+        The system will boot into a shell.  Petitboot can still be run
+        manually from the shell prompt when this option is selected.
+
+endchoice
diff --git a/utils/picocom/Makefile b/utils/picocom/Makefile
new file mode 100644 (file)
index 0000000..d6c26e2
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2006-2012 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:=picocom
+PKG_VERSION:=1.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://picocom.googlecode.com/files
+PKG_MD5SUM:=8eaba1d31407e8408674d6e57af447ef
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/picocom
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A minimal dumb-terminal emulation program
+  URL:=http://code.google.com/p/picocom/
+  SUBMENU:=Terminal
+endef
+
+define Package/picocom/description
+ minimal dumb-terminal emulation program
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)" \
+               picocom
+endef
+
+define Package/picocom/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/picocom $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,picocom))
diff --git a/utils/pipacs/Makefile b/utils/pipacs/Makefile
new file mode 100644 (file)
index 0000000..5d1b08f
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2006-2009 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:=pipacs
+PKG_RELEASE:=2
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pipacs
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=UNIX socket accounting/wiewer program
+endef
+
+define Build/Prepare
+       $(CP) ./src/* $(PKG_BUILD_DIR)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
+               all
+endef
+
+define Package/pipacs/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pipacs $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,pipacs))
diff --git a/utils/pipacs/src/Makefile b/utils/pipacs/src/Makefile
new file mode 100644 (file)
index 0000000..3a48e88
--- /dev/null
@@ -0,0 +1,14 @@
+
+EXTRA_CFLAGS := -c -I.
+PIPACS_OBJS := pipacs.o parser.o
+
+all: pipacs
+
+%.o: %.c
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^
+
+pipacs: $(PIPACS_OBJS)
+       $(CC) -o $@ $^
+
+clean:
+       rm -f *.o *.so pipacs
diff --git a/utils/pipacs/src/parser.c b/utils/pipacs/src/parser.c
new file mode 100644 (file)
index 0000000..330d7cd
--- /dev/null
@@ -0,0 +1,907 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include<string.h>
+#include <time.h>
+//#include <process.h>
+#include "parser.h"
+
+#define printit
+
+extern BOOL bFilter;
+extern int iline;
+extern char * author;
+extern char myipname[];
+extern int justheader;
+extern int gre,sortbysize,fromip,toip;
+int nomac=1;
+int mostird=0;
+char mypbuff[2048];
+// accounting variables
+#define MAXHASH 0xffff
+#define MAXTCPPORT 4096
+unsigned long *iph=NULL; //[MAXHASH];
+
+typedef struct {
+                unsigned short from;
+                unsigned short to;
+                unsigned long byte;
+                unsigned short pkt;
+                unsigned short sport;
+                unsigned short dport;
+} ta;
+
+ta *acc = NULL;
+unsigned long tcppb[MAXTCPPORT];
+unsigned long tcppp[MAXTCPPORT];
+unsigned long typp[255];
+unsigned long typb[255];
+unsigned long udpb,tcpb,udpp,tcpp;
+time_t elapsed=0;
+int iCycle=10;
+int iScreen=1;
+int iFile=0;
+long lNum=0;
+char filename[128];
+char intlist[128];
+int iRun=1;
+int iDetail=0;
+FILE *f=NULL;
+int iProto=0;
+int iSum=0;
+char execname[255];
+char pbuf[8196];
+char str[255];
+extern char pattern[];
+#ifndef LINUX
+int iLnxplus=0;                 // Windows buffer without the MAC frame !
+#else
+int iLnxplus=14;                        // Linux plus IP header len =14 !!!
+#endif
+//
+// A list of protocol types in the IP protocol header
+//
+char *szProto[255] = {"IP",     //  0
+                   "ICMP",         //  1
+                   "IGMP",         //  2
+                   "GGP",          //  3
+                   "IP",           //  4
+                   "ST",           //  5
+                   "TCP",          //  6
+                   "UCL",          //  7
+                   "EGP",          //  8
+                   "IGP",          //  9
+                   "BBN-RCC-MON",  // 10
+                   "NVP-II",       // 11
+                   "PUP",          // 12
+                   "ARGUS",        // 13
+                   "EMCON",        // 14
+                   "XNET",         // 15
+                   "CHAOS",        // 16
+                   "UDP",          // 17
+                   "MUX",          // 18
+                   "DCN-MEAS",     // 19
+                   "HMP",          // 20
+                   "PRM",          // 21
+                   "XNS-IDP",      // 22
+                   "TRUNK-1",      // 23
+                   "TRUNK-2",      // 24
+                   "LEAF-1",       // 25
+                   "LEAF-2",       // 26
+                   "RDP",          // 27
+                   "IRTP",         // 28
+                   "ISO-TP4",      // 29
+                   "NETBLT",       // 30
+                   "MFE-NSP",      // 31
+                   "MERIT-INP",    // 32
+                   "SEP",          // 33
+                   "3PC",          // 34
+                   "IDPR",         // 35
+                   "XTP",          // 36
+                   "DDP",          // 37
+                   "IDPR-CMTP",    // 38
+                   "TP++",         // 39
+                   "IL",           // 40
+                   "SIP",          // 41
+                   "SDRP",         // 42
+                   "SIP-SR",       // 43
+                   "SIP-FRAG",     // 44
+                   "IDRP",         // 45
+                   "RSVP",         // 46
+                   "GRE",          // 47
+                   "MHRP",         // 48
+                   "BNA",          // 49
+                   "IPSEC-ESP",     // 50
+                   "IPSEC-AH",      // 51
+                   "I-NLSP",       // 52
+                   "SWIPE",        // 53
+                   "NHRP",         // 54
+                   "?55?",   // 55
+                   "?56?",   // 56
+                   "SKIO",   // 57
+                   "V6ICMP",   // 58
+                   "V6NoNXT",   // 59
+                   "V6OPT",   // 60
+                   "int.host",  // 61
+                   "CFTP",         // 62
+                   "loc.net",           // 63
+                   "SAT-EXPAK",    // 64
+                   "KRYPTOLAN",    // 65
+                   "RVD",          // 66
+                   "IPPC",         // 67
+                   "dist.fs", // 68
+                   "SAT-MON",    // 69
+                   "VISA",       // 70
+                   "IPCV",       // 71
+                   "CPNX",       // 72
+                   "CPHB",       // 73
+                   "WSN",        // 74
+                   "PVP",        // 75
+                   "BR-SAT-MON", // 76
+                   "SUN-ND",     // 77
+                   "WB-MON",     // 78
+                   "WB-EXPAK",   // 79
+                   "ISO-IP",     // 80
+                   "VMTP",       // 81
+                   "SECURE-VMTP",// 82
+                   "VINES",      // 83
+                   "TTP",        // 84
+                   "NSFNET-IGP", // 85
+                   "DGP",        // 86
+                   "TCF",        // 87
+                   "IGRP",       // 88
+                   "OSPF",    // 89
+                   "Sprite-RPC", // 90
+                   "LARP",       // 91
+                   "MTP",        // 92
+                   "AX.25",      // 93
+                   "IPIP",       // 94
+                   "MICP",       // 95
+                   "SCC-SP",     // 96
+                   "ETHERIP",    // 97
+                   "ENCAP",      // 98
+                   "priv.enc",    // 99
+                   "GMTP"        // 99
+                  };
+//
+// The types of IGMP messages
+//
+char *szIgmpType[] = {"",
+                      "Host Membership Query",
+                      "HOst Membership Report",
+                      "",
+                      "",
+                      "",
+                      "Version 2 Membership Report",
+                      "Leave Group",
+                                          "",
+                                          ""
+                     };
+
+//
+// Function: PrintRawBytes
+//
+// Description:
+//    This function simply prints out a series of bytes
+//    as hexadecimal digits.
+//
+void PrintRawBytes(BYTE *ptr, DWORD len)
+{
+    int        i,j;
+//      if (! iFile) {
+*(ptr+len)=0;
+if ((*pattern==0) || strstr(ptr,pattern) ) {
+        fprintf(iFile?f:stdout,"%s",pbuf);
+        fprintf(iFile?f:stdout,"   " );
+                while (len > 0)    {
+        for(i=0; i < 16; i++)   {
+            fprintf(iFile?f:stdout,"%x%x ", HI_WORD(*ptr), LO_WORD(*ptr));
+            len--;
+            ptr++;
+            if (len == 0) {j=i++; while(++j < 16) fprintf(iFile?f:stdout,"   ");  break; }
+        }
+          fprintf(iFile?f:stdout," ");
+        for(j=0; j < i; j++)    fprintf(iFile?f:stdout,"%c",isprint(*(ptr-i+j))?*(ptr-i+j):'.');
+        if (len) fprintf(iFile?f:stdout,"\n   ");
+    }
+//      } else {
+//              fwrite(ptr,sizeof(BYTE),len,f);
+//      }
+}
+}
+
+static char *ICMPTypeTable[]={
+    "Echo Reply", "ICMP 1", "ICMP 2", "Dest Unreachable","SrcQuench", "Redirect", "6", "7","Echo Request","9","10",
+    "Time Exceed", "ParamPrblm", "Timestamp", "Timestamp reply","InfoRqst", "InfoRply"
+};
+static char *Dstunreach[]={
+"net unreach.","host unreach.","protocol unreach.","port unreach.",
+"frag needed","source route?","",""
+};
+int DecodeICMPHeader(WSABUF *wsabuf, DWORD iphdrlen) {
+    BYTE          *hdr = (BYTE *)((BYTE *)wsabuf->buf + iphdrlen + iLnxplus );
+    unsigned short type,code,chksum,
+                   id,
+                   seq;
+ unsigned long resptime,r1,r2;
+    BYTE *hhh;
+    SOCKADDR_IN    addr;
+    type=*hdr++; code=*hdr++;
+    sprintf(str," Type:%-12s Code:%3d,",ICMPTypeTable[type],code);
+
+    strcat(pbuf,str);
+    memcpy(&chksum, hdr, 2);
+    hdr += 2; hhh=hdr;
+    memcpy(&id, hdr, 2);
+    hdr += 2;
+    memcpy(&seq, hdr, 2);
+    hdr+=2;
+//    memcpy(&resptime, hdr, 4);
+//   hdr+=4;
+    switch (type) {
+    case 3:
+        memcpy(&addr.sin_addr.s_addr, hdr+16, 4);
+        if (code==4 ) sprintf(str,"frag needed-Max MTU:%u at %-15s\n",ntohs(seq), inet_ntoa(addr.sin_addr));
+        else sprintf(str,"%s at %-15s\n",Dstunreach[code&7],inet_ntoa(addr.sin_addr));
+        hdr+=iphdrlen;
+        break;
+    case 11:
+        memcpy(&addr.sin_addr.s_addr, hdr+16, 4);
+        sprintf(str,"%s  at %-15s\n",code?"frag reass. exceed":"ttl exceed",inet_ntoa(addr.sin_addr));
+        hdr+=iphdrlen;
+        break;
+    case 12:
+        memcpy(&addr.sin_addr.s_addr, hdr+16, 4);
+        sprintf(str," err:%d  at %-15s\n",id,inet_ntoa(addr.sin_addr));
+        hdr+=iphdrlen;
+        break;
+    case 4:
+        memcpy(&addr.sin_addr.s_addr, hdr+16, 4);
+        sprintf(str," wait for %-15s\n",ntohs(id),inet_ntoa(addr.sin_addr));
+        hdr+=iphdrlen;
+        break;
+    case 5:
+        memcpy(&addr.sin_addr.s_addr, hhh, 4);
+        sprintf(str," from gw: %-15s\n",inet_ntoa(addr.sin_addr));
+        hdr+=iphdrlen;
+        break;
+    case 0:
+    case 8:
+         sprintf(str," Id:%3u Seq:%3u\n",ntohs(id),ntohs(seq));
+         break;
+    case 13:
+    case 14:
+        memcpy(&resptime, hdr, 4);
+        hdr+=4;
+        memcpy(&r1, hdr, 4);
+        hdr+=4;
+        memcpy(&r2, hdr, 4);
+        hdr+=4;
+        sprintf(str," Id:%3u Seq:%3d Rec/Tr %ld/%ld ms\n",ntohs(id),ntohs(seq),ntohl(r1)-ntohl(resptime),ntohl(r2)-ntohl(resptime));
+        break;
+    case 15:
+    case 16:
+         sprintf(str," Id:%3u Seq:%3d\n",ntohs(id),ntohs(seq));
+         break;
+    }
+    strcat(pbuf,str);
+    return hdr-(BYTE *)(wsabuf->buf + iphdrlen + iLnxplus);
+}
+
+//
+// Function: DecodeIGMPHeader
+//
+// Description:
+//    This function takes a pointer to a buffer containing
+//    an IGMP packet and prints it out in a readable form.
+//
+
+int DecodeIGMPHeader(WSABUF *wsabuf, DWORD iphdrlen) {
+    BYTE          *hdr = (BYTE *)((BYTE *)wsabuf->buf + iphdrlen + iLnxplus);
+    unsigned short chksum,
+                   version,
+                   type,
+                   maxresptime;
+    SOCKADDR_IN    addr;
+    version = HI_WORD(*hdr);
+    type    = LO_WORD(*hdr);
+
+    hdr++;
+    maxresptime = *hdr;
+    hdr++;
+
+    memcpy(&chksum, hdr, 2);
+    chksum = ntohs(chksum);
+    hdr += 2;
+
+    memcpy(&(addr.sin_addr.s_addr), hdr, 4);
+    sprintf(str,"   IGMP HEADER:\n");
+    strcat(pbuf,str);
+    if ((type == 1) || (type == 2))        version = 1;
+    else        version = 2;
+    sprintf(str,"   IGMP Version = %d\n   IGMP Type = %s\n",version, szIgmpType[type]);
+    strcat(pbuf,str);
+    if (version == 2) {
+     sprintf(str,"   Max Resp Time = %d\n", maxresptime);
+     strcat(pbuf,str);
+    }
+    sprintf(str,"   IGMP Grp Addr = %s\n", inet_ntoa(addr.sin_addr));
+    strcat(pbuf,str);
+
+    return 8;
+}
+
+//
+// Function: DecodeUDPHeader
+//
+// Description:
+//    This function takes a buffer which points to a UDP
+//    header and prints it out in a readable form.
+//
+int DecodeUDPHeader(WSABUF *wsabuf, DWORD iphdrlen) {
+    BYTE          *hdr = (BYTE *)((BYTE *)wsabuf->buf + iphdrlen + iLnxplus);
+    unsigned short shortval,
+                   udp_src_port,
+                   udp_dest_port,
+                   udp_len,
+                   udp_chksum;
+    memcpy(&shortval, hdr, 2);
+    udp_src_port = ntohs(shortval);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    udp_dest_port = ntohs(shortval);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    udp_len = ntohs(shortval);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    udp_chksum = ntohs(shortval);
+    hdr += 2;
+
+    sprintf(str," UDP:  SPort: %-05d  | DPort: %-05d",udp_src_port, udp_dest_port);
+    strcat(pbuf,str);
+    sprintf(str," | Len: %-05d | CSum: 0x%08x\n",udp_len, udp_chksum);
+    strcat(pbuf,str);
+    return hdr-(BYTE *)(wsabuf->buf + iphdrlen + iLnxplus);
+}
+
+//
+// Function: DecodeTCPHeader
+//
+// Description:
+//    This function takes a buffer pointing to a TCP header
+//    and prints it out in a readable form.
+//
+int DecodeTCPHeader(WSABUF *wsabuf, DWORD iphdrlen) {
+    BYTE           *hdr = (BYTE *)((BYTE *)wsabuf->buf + iphdrlen + iLnxplus);
+    unsigned short shortval;
+    unsigned long   longval;
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+    sprintf(str," TCP: SPort: %u", shortval);
+    strcat(pbuf,str);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+    sprintf(str,"  DPort: %u", shortval);
+    strcat(pbuf,str);
+    hdr += 2;
+
+    memcpy(&longval, hdr, 4);
+    longval = ntohl(longval);
+    sprintf(str," Seq: %lX", longval);
+    strcat(pbuf,str);
+    hdr += 4;
+
+    memcpy(&longval, hdr, 4);
+    longval = ntohl(longval);
+    sprintf(str," ACK: %lX", longval);
+    strcat(pbuf,str);
+    hdr += 4;
+//    printf("   Header Len : %d (bytes %d)\n", HI_WORD(*hdr), (HI_WORD(*hdr) * 4));
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval) & 0x3F;
+    sprintf(str," Flags: ");
+    strcat(pbuf,str);
+    if (shortval & 0x20)        strcat(pbuf,"URG ");
+    if (shortval & 0x10)        strcat(pbuf,"ACK ");
+    if (shortval & 0x08)        strcat(pbuf,"PSH ");
+    if (shortval & 0x04)        strcat(pbuf,"RST ");
+    if (shortval & 0x02)        strcat(pbuf,"SYN ");
+    if (shortval & 0x01)        strcat(pbuf,"FIN ");
+    strcat(pbuf,"\n");
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+//    printf("   Window size: %d\n", shortval);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+//    printf("   TCP Chksum : %d\n", shortval);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+    hdr += 2;
+//    printf("   Urgent ptr : %d\n", shortval);
+
+    return hdr-(BYTE *)(wsabuf->buf + iphdrlen + iLnxplus);
+}
+
+int DecodeGREHeader(WSABUF *wsabuf, DWORD iphdrlen,DWORD bytesret,
+ unsigned int srcip, unsigned short srcport, unsigned long srcnet,unsigned int destip, unsigned short destport, unsigned long destnet,
+ unsigned short xport,unsigned int xip, unsigned long xnet)
+ {
+    BYTE           *hdr = (BYTE *)((BYTE *)wsabuf->buf + iphdrlen + iLnxplus);
+    unsigned short shortval;
+    unsigned long   longval;
+    int ipe;
+    BYTE           *orihdr;
+    char *sstr;
+    SOCKADDR_IN         srcaddr;
+
+    orihdr=hdr;
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+    sprintf(str," GRE Flag: %u Prot:", shortval);
+    strcat(mypbuff,str);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    shortval = ntohs(shortval);
+    ipe=0;
+    sstr=str;
+//    sprintf(str,"  Prot: %u", shortval);
+    switch ( shortval ) {
+    case 4: sstr="SNA";
+       break;
+    case 0xfe: sstr="OSI";
+       break;
+    case 0x200: sstr="PUP";
+       break;
+    case 0x600: sstr="XNS";
+       break;
+    case 0x800: sstr="IP";
+        ipe=1;
+       break;
+    case 0x804: sstr="Chaos";
+       break;
+    case 0x806: sstr="ARP";
+       break;
+    case 0x6558: sstr="Tr.bridge";
+       break;
+    default: sprintf(str,"%u", shortval);
+       break;
+    }
+    hdr += 2;
+    strcat(mypbuff,sstr);
+    if (ipe && gre) {
+        int plusment,jj,protoment;
+        plusment=iLnxplus;
+        protoment=iProto;
+        if (iProto==47)  iProto=0;
+        iLnxplus+=4;
+        nomac=0;
+        iLnxplus=plusment+24;
+        DecodeIPHeader(wsabuf,srcip,srcport,srcnet,destip,destport,destnet,bytesret,xport,xip,xnet);
+        nomac=1;
+        iLnxplus=plusment;
+        iProto=protoment;
+    }
+return -1;
+//    return hdr-(BYTE *)(wsabuf->buf + iphdrlen + iLnxplus);
+}
+
+
+int ClearIPAcc() {
+        unsigned long i;
+        ta *tai;
+        for(i=0;i<MAXHASH;i++) *(iph + i)=0;
+        tai=acc;
+        for(i=0;i<MAXHASH;i++) { tai->from=tai->to=0; tai++; }
+        for (i=0;i<MAXTCPPORT; i++) tcppb[i]=tcppp[i]=0;
+        udpb=udpp=tcpp=tcpb=0;
+        for (i=0;i<255; i++) typp[i]=0;
+        for (i=0;i<255; i++) typb[i]=0;
+        return 0;
+        };
+
+int InitIPAcc() {
+        acc=malloc(MAXHASH*sizeof(ta));
+        iph=malloc(MAXHASH*sizeof(long));
+        if (!acc || !iph ) return 0;
+        ClearIPAcc();
+        time(&elapsed);
+        return 1;
+}
+
+int bytesort(const void *s1, const void *s2) { // sorting tale in byte order
+        ta *d1;
+        ta *d2;
+        d1= (ta *)s1; d2=(ta *)s2;
+        if (d1->byte > d2->byte) return -1;
+        if (d1->byte < d2->byte) return 1;
+        return 0;
+}
+int countsort(const void *s1, const void *s2) { // sorting tale in packet count order
+        ta *d1;
+        ta *d2;
+        d1= (ta *)s1; d2=(ta *)s2;
+        if (d1->pkt > d2->pkt) return -1;
+        if (d1->pkt < d2->pkt) return 1;
+        return 0;
+}
+int CloseIPAcc( long ti) {
+        unsigned long i;
+        ta *tai;
+    SOCKADDR_IN    srcaddr;
+    SOCKADDR_IN    dstaddr;
+        float ff;
+        char str[16];
+        unsigned long j,k,l;
+        int lin=0;
+        int linn;
+
+        time(&elapsed);
+        if (iFile) f=fopen(filename,"w+");
+        k=0;
+        if (sortbysize) qsort(acc,MAXHASH,sizeof(ta),bytesort);
+       else  qsort(acc,MAXHASH,sizeof(ta),countsort);
+        ff=0.0;
+        for (i=0;i<255;i++) ff+=typb[i];
+        for (i=0; i<MAXHASH; i++) {
+            tai=acc + i;
+            if ((tai->from!=0) && (tai->to!=0)) ++k;
+        }
+        if (iScreen) {
+#ifndef LINUX
+                system("cls");
+#else
+                system("clear");
+//              printf("\033[1~");
+#endif
+                printf("%-16s Speed: %5.2f Kbit/s , %ld IP pairs / %ld secs.    %s@%s.hu",myipname,ff/ti/1024*8,k,ti,author,author);
+                printf("\nProt:"); j=0; ++lin;
+                while (1) {
+                        l=k=0;
+                        for (i=0;i<100;i++) if ( typb[i]>k) { k=typb[i]; l=i; }
+                        if (k==0) break;
+                        if ((j>0) && ((j%3)==0)) { printf("\n     "); ++lin; }
+                        if (k>1024*1024) printf(" %-8.8s:%5.1fk/%-6.1f M",szProto[l],(float)typp[l]/1024,(float)k/(1024*1024));
+                        else if (k>1024) printf(" %-8.8s:%5ld/%-6.1f k",szProto[l],typp[l],(float)k/1024);
+                        else printf(" %-8.8s:%5ld/%-8ld",szProto[l],typp[l],k);
+                        typb[l]=0;
+                        ++j;
+                }
+                printf("\nPort:"); j=0; ++lin;
+                k=0; linn=lin;
+                while (1) {
+                        l=k=0;
+                        for (i=0;i<MAXTCPPORT;i++) if (tcppb[i]>k) { k=tcppb[i]; l=i; }
+                        if (k==0) break;
+                        if (j && (j%4)==0) {
+                                if (lin >= linn+1) break;
+                                printf("\n     ");
+                                ++lin;
+                        }
+                        if (k>1024*1024) printf(" %04d:%4.1fk/%-5.1f M",l,(float)tcppp[l]/1024,(float)k/(1024*1024));
+                        else if (k>1024) printf(" %04d:%4ld/%-5.1f k",l,tcppp[l],(float)k/1024);
+                        else printf(" %04d:%4ld/%-7ld",l,tcppp[l],k);
+                        tcppb[l]=0;
+                        ++j;
+                }
+        } else if (f) {
+                fprintf(f,"%-16s Speed: %5.2f Kbit/s , %ld IP pairs / %ld secs.    %s@%s.hu",myipname,ff/ti/1024*8,k,ti,author,author);
+                fprintf(f,"\nProt:"); j=0;
+                while (1) {
+                        l=k=0;
+                        for (i=0;i<100;i++) if ( typb[i]>k) { k=typb[i]; l=i; }
+                        if (k==0) break;
+                        if (k>1024*1024) fprintf(f," %-8.8s:%5.1fk/%-6.1f M",szProto[l],(float)typp[l]/1024,(float)k/(1024*1024));
+                        else if (k>1024) fprintf(f," %-8.8s:%5ld/%-6.1f k",szProto[l],typp[l],(float)k/1024);
+                        else fprintf(f," %-8.8s:%5ld/%-8ld",szProto[l],typp[l],k);
+                        typb[l]=0;
+                        ++j;
+                }
+                printf("\nPort:"); j=0;
+                k=0; linn=lin;
+                while (1) {
+                        l=k=0;
+                        for (i=0;i<MAXTCPPORT;i++) if (tcppb[i]>k) { k=tcppb[i]; l=i; }
+                        if (k==0) break;
+                        if (k>1024*1024) fprintf(f," %04d:%4.1fk/%-5.1f M",l,(float)tcppp[l]/1024,(float)k/(1024*1024));
+                        else if (k>1024) fprintf(f," %04d:%4ld/%-5.1f k",l,tcppp[l],(float)k/1024);
+                        else fprintf(f," %04d:%4ld/%-7ld",l,tcppp[l],k);
+                        tcppb[l]=0;
+                        ++j;
+                }
+       }
+
+        for (i=0; i<MAXHASH; i++) {
+                tai=acc + i;
+                if ((tai->from!=0) && (tai->to!=0)) { ++k;
+                if (!iSum) {
+                        dstaddr.sin_addr.s_addr = htonl(*(iph+tai->from));
+                        srcaddr.sin_addr.s_addr = htonl(*(iph+(tai->to)));
+                        strcpy(str,inet_ntoa(dstaddr.sin_addr));
+                        if (iScreen && (++lin<iline) ) printf("\n%-15s\t%-15s\t%5d pkt, %10ld byte :%7.2f Kbps",str,inet_ntoa(srcaddr.sin_addr),tai->pkt,tai->byte,((float)tai->byte)/ti/1024*8);
+                        if (f) fprintf(f,"%-15s\t%-15s\t%d\t%ld\n",str,inet_ntoa(srcaddr.sin_addr),tai->pkt,tai->byte);
+                }
+                }
+        }
+      if (iScreen) printf("\n");
+#ifdef LINUX
+        if (iScreen) fflush(stdout);
+#endif
+        ClearIPAcc();
+        if (f) {
+                char cmdline[255];
+                fclose(f);
+//              if (*execname) _spawnle(_P_NOWAIT,execname,execname,filename);
+//              if (*execname) _execl(execname,execname);
+                if (*execname) {
+#ifndef LINUX
+                sprintf(cmdline,"%s %s",execname,filename);
+#else
+                sprintf(cmdline,"%s %s",execname,filename);
+#endif
+                system(cmdline);
+//              iRun=0;
+                }
+        }
+        f=NULL;
+        return 0;
+}
+
+unsigned short FindIPHash( unsigned long ip ) {
+        unsigned short hashval;
+        unsigned long *ipt;
+
+        hashval = (unsigned short)(((ip&0xFFFF0000)>>16) ^ (ip&0x0000FFFF));
+        ipt=iph + hashval;
+        while (*ipt != 0 && (*ipt!=ip)) { ipt++; hashval++; }
+        if (*ipt==0) *ipt=ip;
+        return hashval;
+}
+
+unsigned short SetIPAcc( unsigned long src, unsigned long dst, unsigned long byte, unsigned short typ, unsigned short sport, unsigned short dport) {
+        unsigned short from,to,hash;
+        ta *tai;
+        hash=0;
+        if (src) {
+
+                if (fromip) from=FindIPHash(src); else from=-1;
+                if (toip) to=FindIPHash(dst); else to=-1;
+                hash=from^to;
+                tai=acc + hash;
+                while ( ((tai->from!=from) && (tai->to!=to)) && ((tai->from!=0) && (tai->to!=0)) ) {tai++; hash++; }
+                if ((tai->from==0)&&(tai->to==0)) {
+                        tai->byte=byte; tai->from=from; tai->to=to; tai->pkt=1;
+                } else { tai->byte+=byte; tai->pkt++; }
+
+                typp[typ]++;
+                typb[typ]+=byte;
+                if ((sport>0) && (sport<MAXTCPPORT)) { tcppp[sport]++; tcppb[sport]+=byte; }
+                if ((dport>0) && (dport<MAXTCPPORT)) { tcppp[dport]++; tcppb[dport]+=byte; }
+        }
+        return hash;
+}
+
+//
+// Function: DecodeIPHeader
+//
+// Description:
+//    This function takes a pointer to an IP header and prints
+//    it out in a readable form.
+//
+int DecodeIPHeader(WSABUF *wsabuf, unsigned int srcip, unsigned short srcport, unsigned long srcnet,
+        unsigned int destip, unsigned short destport, unsigned long destnet, DWORD bytesret,
+        unsigned short xport,unsigned int xip, unsigned long xnet)
+{
+    BYTE                        *hdr = (BYTE *)wsabuf->buf,
+                                        *nexthdr = NULL,
+                                        *ohdr;
+    unsigned short      shortval;
+    SOCKADDR_IN         srcaddr,
+                                        destaddr;
+
+    unsigned short ip_version,
+                   ip_hdr_len,
+                   ip_tos,
+                   ip_total_len,
+                   ip_id,
+                   ip_flags,
+                   ip_ttl,
+                   ip_frag_offset,
+                   ip_proto,
+                   ip_hdr_chksum,
+                   ip_src_port,
+                   ip_dest_port;
+    unsigned int   ip_src,
+                   ip_dest;
+    BOOL           bPrint = FALSE;
+    char       ip_prtype=0;
+    int     j;
+    time_t tt;
+    struct tm *tmm;
+
+    ohdr=hdr;
+    if (iLnxplus) ip_prtype=*(hdr+iLnxplus-1);
+    if (ip_prtype) return 0;
+    hdr += iLnxplus;
+    ip_version = HI_WORD(*hdr);
+    ip_hdr_len = LO_WORD(*hdr) * 4;
+    nexthdr = (BYTE *)((BYTE *)hdr + ip_hdr_len);
+    hdr++;
+
+    ip_tos = *hdr;
+    hdr++;
+
+    memcpy(&shortval, hdr, 2);
+    ip_total_len = ntohs(shortval);
+    hdr += 2;
+
+    memcpy(&shortval, hdr, 2);
+    ip_id = ntohs(shortval);
+    hdr += 2;
+
+    ip_flags = ((*hdr) >> 5);
+
+    memcpy(&shortval, hdr, 2);
+    ip_frag_offset = ((ntohs(shortval)) & 0x1FFF);
+    hdr += 2;
+
+    ip_ttl = *hdr;
+    hdr++;
+
+    ip_proto = *hdr;
+    hdr++;
+
+    memcpy(&shortval, hdr, 2);
+    ip_hdr_chksum = ntohs(shortval);
+    hdr += 2;
+
+    memcpy(&srcaddr.sin_addr.s_addr, hdr, 4);
+    ip_src = ntohl(srcaddr.sin_addr.s_addr);
+    hdr += 4;
+
+    memcpy(&destaddr.sin_addr.s_addr, hdr, 4);
+    ip_dest = ntohl(destaddr.sin_addr.s_addr);
+    hdr += 4;
+    //
+    // If packet is UDP, TCP, or IGMP read ahead and
+    //  get the port values.
+    //
+        ip_src_port=ip_dest_port=0;
+    if (((ip_proto == 2) ||
+         (ip_proto == 6) ||
+         (ip_proto == 17)) ) //&& bFilter)
+    {
+        memcpy(&ip_src_port, nexthdr, 2);
+        ip_src_port = ntohs(ip_src_port);
+        memcpy(&ip_dest_port, nexthdr+2, 2);
+        ip_dest_port = ntohs(ip_dest_port);
+
+    };
+    bPrint = 0;
+//      xaok=   (xip!=0) && (((xip&xnet)==(ip_src&xnet))||((xip&xnet)==(ip_dest&xnet)));
+//      saok= ((srcip==0)||((srcip&srcnet)==(ip_src&srcnet)));
+//      daok = ((destip==0)||((destip&destnet)==(ip_dest&destnet)));
+//      xpok=(xport!=0) && ((xport==ip_src_port)||(xport==ip_dest_port));
+//      spok=((srcport==0)||(srcport == ip_src_port));
+//      dpok=((destport==0)||(destport == ip_dest_port));
+//printf("\nf:%d xa:%d sa:%d da:%d xp:%d sp:%d dp:%d",bFilter,xaok,saok,daok,xpok,spok,dpok);
+//      if (!bFilter || ( (xaok||(saok&&daok)) && (xpok||(spok&&dpok)))) {
+if ((!bFilter) || ((ip_proto==47)&&gre) ||
+                (
+                ((iProto==0)||(ip_proto==iProto)) &&
+                 (
+                  ((xip!=0) && (((xip&xnet)==(ip_src&xnet))||((xip&xnet)==(ip_dest&xnet)))
+                  ) || (
+                   ((srcip==0) || ((srcip&srcnet)==(ip_src&srcnet))) && ((destip==0)||((destip&destnet)==(ip_dest&destnet)))
+                  )
+                 )
+                 &&
+                 (
+                  ((xport!=0) && ((xport==ip_src_port)||(xport==ip_dest_port))
+                  ) || (
+                   ((srcport==0)||(srcport == ip_src_port))&&((destport==0)||(destport == ip_dest_port))
+                  )
+                 )
+                )
+                ) {
+                        if (! iDetail) {
+                            if ((ip_proto==47)&&gre) {
+                            *mypbuff=0;
+                             DecodeGREHeader(wsabuf, ip_hdr_len, bytesret,
+                    srcip,srcport,srcnet,destip,destport,destnet,xport,xip,xnet);
+//                            SetIPAcc(0,0,0,0,0,0);
+                            return ip_hdr_len;
+                            }
+                            SetIPAcc(ip_src,ip_dest,ip_total_len,ip_proto,ip_src_port,ip_dest_port);
+                        }
+                        else bPrint=TRUE;
+//                        printf("%d %ld %ld %ld %ld",ip_proto,xip,xip&xnet,ip_src&xnet,ip_dest&xnet);
+        } else {
+                        if (! iDetail)          SetIPAcc(0,0,0,0,0,0);
+//                      else bPrint=TRUE;
+        }
+        time(&tt);
+        if ((!iSum && ( tt-elapsed > iCycle)) || !iRun || mostird) {
+           mostird=0;
+                if (! iDetail) CloseIPAcc(tt-elapsed-1);
+                else {
+                        time(&elapsed);
+                        if (f) fclose(f);
+                        if (iFile) f=fopen(filename,"a");
+                }
+        }
+        if (lNum) { if (--lNum <= 0) iRun=0; }
+
+    //
+    *pbuf=0;
+    if (bPrint)    {
+                tmm=localtime(&tt);
+if (! nomac ) {
+    strcpy(pbuf,mypbuff);
+} else {
+        sprintf(str,"\n%4.4d.%2.2d.%2.2d %2.2d:%2.2d:%2.2d ",
+            tmm->tm_year+1900,tmm->tm_mon+1,tmm->tm_mday,tmm->tm_hour,tmm->tm_min,tmm->tm_sec);
+        strcat(pbuf,str);
+#ifdef LINUX
+        sprintf(str,"%x:%x:%x:%x:%x:%x > %x:%x:%x:%x:%x:%x",*ohdr,*(ohdr+1),*(ohdr+2),*(ohdr+3),*(ohdr+4),*(ohdr+5),
+            *(ohdr+6),*(ohdr+7),*(ohdr+8),*(ohdr+9),*(ohdr+10),*(ohdr+11));
+        strcat(pbuf,str);
+#endif
+}
+        sprintf(str,"  %d bytes\n%-15s>", ip_total_len, inet_ntoa(srcaddr.sin_addr));
+        strcat(pbuf,str);
+        sprintf(str,"%-15s", inet_ntoa(destaddr.sin_addr));
+        strcat(pbuf,str);
+        sprintf(str," TTL:%-3d Proto:%-6s F:%d/%d TOS:%X%X\n",
+            ip_ttl, szProto[ip_proto],ip_flags,ip_frag_offset,HI_WORD(ip_tos), LO_WORD(ip_tos));
+        strcat(pbuf,str);
+        if (iFile) strcat(pbuf,".");
+        strcpy(mypbuff,pbuf);
+
+    }
+    else        return ip_hdr_len;
+
+    if (justheader) { if (*pbuf) fprintf(iFile?f:stdout,"%s",pbuf); return ip_hdr_len; }
+        if (iDetail) {
+                switch (ip_proto)    {
+                        case 1:        // ICMP
+                                j=DecodeICMPHeader(wsabuf, ip_hdr_len);
+                                break;
+                        case 2:        // IGMP
+                                j=DecodeIGMPHeader(wsabuf, ip_hdr_len);
+                                break;
+                        case 6:        // TCP
+                                j=DecodeTCPHeader(wsabuf, ip_hdr_len);
+                                break;
+                        case 17:       // UDP
+                                j=DecodeUDPHeader(wsabuf, ip_hdr_len);
+                                break;
+                        case 47:       // UDP
+                                j=DecodeGREHeader(wsabuf, ip_hdr_len, bytesret,
+                    srcip,srcport,srcnet,destip,destport,destnet,xport,xip,xnet);
+                                break;
+                        default:
+                                j=0;  hdr=(BYTE *)wsabuf->buf;
+                                sprintf(str,"   No decoder installed for protocol\n");
+                                strcat(pbuf,str);
+                                break;
+                }
+                if (j>=0) PrintRawBytes(hdr+j,bytesret-j-ip_hdr_len-12); //(hdr-(BYTE *)(wsabuf->buf + iLnxplus)));
+        }
+        else if (*pbuf) fprintf(iFile?f:stdout,"%s",pbuf);
+
+    return ip_hdr_len;
+}
diff --git a/utils/pipacs/src/parser.h b/utils/pipacs/src/parser.h
new file mode 100644 (file)
index 0000000..aedaeaf
--- /dev/null
@@ -0,0 +1,60 @@
+#define LINUX 1
+#ifdef LINUX
+#include <ctype.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#define BYTE unsigned char
+#define DWORD unsigned long
+#define BOOL char
+#define TRUE 1
+#define FALSE 0
+#define WSADATA int
+#define SOCKET int
+#define SOCKADDR struct sockaddr
+#define SOCKADDR_IN struct sockaddr_in
+typedef struct _WSABUF {
+       unsigned long len;
+       unsigned char *buf;
+} WSABUF;
+#define SIO_RCVALL 0
+#define SIO_RCVALL_IGMPMCAST 0
+#define SIO_RCVALL_MCAST 0
+#define ETH_P_ALL 0x0003
+#else  // WINDOWS
+
+#include <winsock2.h>
+#include <windows.h>
+
+#endif
+
+#ifndef _RCVALL_H_
+#define _RCVALL_H_
+
+
+#define MAX_IP_SIZE        65535
+#define MIN_IP_HDR_SIZE       20
+
+#define HI_WORD(byte)    (((byte) >> 4) & 0x0F)
+#define LO_WORD(byte)    ((byte) & 0x0F)
+
+extern char *szProto[];
+
+
+
+void PrintRawBytes   (BYTE *ptr, DWORD len);
+int  DecodeIGMPHeader(WSABUF *wsabuf, DWORD iphdrlen);
+int  DecodeUDPHeader (WSABUF *wsabuf, DWORD iphdrlen);
+int  DecodeTCPHeader (WSABUF *wsabuf, DWORD iphdrlenz);
+int  DecodeIPHeader  (WSABUF *wasbuf, unsigned int srcaddr, unsigned short srcport, unsigned long srcnet,
+         unsigned int destaddr, unsigned short destport, unsigned long destnet, DWORD bytesret,
+         unsigned short xport, unsigned int xip, unsigned long xnet);
+
+#endif
diff --git a/utils/pipacs/src/pipacs.c b/utils/pipacs/src/pipacs.c
new file mode 100644 (file)
index 0000000..4087cd3
--- /dev/null
@@ -0,0 +1,589 @@
+// http://www.phj.hu/freesoft.asp
+#include <stdio.h>
+#include <stdlib.h>
+#include "parser.h"
+
+#ifndef LINUX
+#include <mstcpip.h>
+#include <ws2tcpip.h>
+#else
+#include <termios.h>
+struct promisc_device
+{
+    char name[16]; /* name (e.g. eth0) */
+
+    int reset; /* do we have to reset it on exit ? */
+    struct ifreq oldifr; /* old settings */
+
+    struct promisc_device *next;
+};
+
+#endif
+
+DWORD  dwIoControlCode=SIO_RCVALL;
+DWORD   dwProtocol=IPPROTO_IP,  dwInterface=0;
+
+#define MAXVER 2
+#define MINVER 6
+SOCKET        s;
+
+//
+// Filters (Globals)
+//
+unsigned int   uiSourceAddr=0,  uiDestAddr=0, uiXAddr=0;
+unsigned short usSourcePort = 0, usDestPort = 0, usXPort = 0;
+unsigned short usSourceNet = 32, usDestNet = 32, usXNet = 32;
+unsigned long  ulDestNet=0xffffffff, ulSourceNet=0xffffffff, ulXNet=0xffffffff;
+BOOL           bFilter=FALSE;
+int            iline=25;
+char myipname[64];
+char pattern[1024];
+int justheader=0;
+int gre=0;
+int sortbysize,fromip,toip;
+int skipvlan=0;
+
+extern char filename[128];
+
+extern char intlist[128];
+
+#ifndef LINUX
+void PrintInterfaceList( void );
+int  GetInterface(SOCKET , SOCKADDR_IN *, int );
+#endif
+extern int InitIPAcc( void );
+extern int CloseIPAcc( void );
+extern int iCycle;
+extern int iScreen;
+extern int iFile;
+extern int iDetail;
+extern int iRun;
+extern long lNum;
+extern FILE *f;
+extern int iProto;
+extern int iSum;
+extern char execname[];
+extern int mostird;
+extern  int iLnxplus;
+
+int set_raw_mode(void)
+{
+    int fd = STDIN_FILENO;
+    struct termios t;
+       
+    if (tcgetattr(fd, &t) < 0) { perror("tcgetattr");  return -1; }
+    t.c_lflag &= ~ICANON;
+    if (tcsetattr(fd, TCSANOW, &t) < 0)        { perror("tcsetattr"); return -1; }
+    setbuf(stdin, NULL);
+    return 0;
+}//
+// Function: usage
+//
+// Description:
+//    Prints usage information.
+//
+char *author = "phj";
+
+void usage(char *progname)
+{
+    printf("  usage: %s options\n    where options:\n", progname);
+        printf("       [-c:sec]             Dump cycle in sec (10)\n");
+        printf("       [-f:file[-e:program]] Results into a file [and exec program](-)\n");
+        printf("       [-n:db]              Execute just db cycle (0)\n");
+        printf("       [-l:lineno]          Print lineno lines of hosts(25)\n");
+        printf("       [-k]                 Sort result by packet count (size)\n");
+        printf("       [-1]                 Ignore source IP (don't ignore)\n");
+        printf("       [-2]                 Ignore destination IP (don't ignore)\n");
+        printf("       [-h]                 Print just the header(use -a!)\n");
+        printf("       [-a]                 Print packet info&data (-)\n");
+        printf("       [-p]                 Print just summary info (-)\n");
+        printf("            Otherwise print sum&ip pairs\n");
+//#ifndef LINUX
+        printf("       [-t:[tcp|udp|icmp|....|number]] Filter on IP protocoll (ALL)\n");
+//#endif
+        printf("       [-g]                 Make GRE encapsulation trasparent (-)\n");
+        printf("       [-v]                 Skip VLAN headers (-)\n");
+       printf("       [-sa:IP[/Net]]       Filter on source address (-)/net\n");
+        printf("       [-sp:Port]           Filter on source port (-)\n");
+        printf("       [-da:IP[/Net]]       Filter on dest address/net (-)\n");
+        printf("       [-dp:Port]           Filter on dest port(-)\n");
+        printf("       [-xa:IP[/Net]]       Filter on src|dest address/net (-)\n");
+        printf("       [-xp:Port]           Filter on src|dest port (-)\n");
+        printf("       [-pa:pattern]        String match (0), last param!!!\n");
+#ifndef LINUX
+        printf("       [-i:int]             Capture on this interface (0)\n");
+        printf("             Available interfaces:\n");
+        PrintInterfaceList();
+#else
+        printf("       [-i:int[,int]]       Capture on this interface (eth0)\n");
+#endif
+        printf("             Filtering rules:  t && (sa|da|xa) && (sp|dp|xp)");
+        printf("\nVer. %d.%d  (c):2000-2006, P l¢czi-Horv th J nos\n",MAXVER,MINVER);
+#ifndef LINUX
+        WSACleanup();
+        ExitProcess(-1);
+#else
+        exit(5);
+#endif
+}
+
+//
+// Function: ValidateArgs
+//
+// Description:
+//    This function parses the command line arguments and
+//    sets global variables to indicate how the app should act.
+//
+void ValidateArgs(int argc, char **argv)
+{
+    int   i,j;
+    char *ptr;
+    
+    sortbysize=1; fromip=1; toip=1;
+
+        if (argc <2) { usage(argv[0]); return; }
+        if (*(author+2) != 'j') { usage(argv[0]); return; }
+    for(i=1; i < argc ;i++) {
+        if ((argv[i][0] == '-') || (argv[i][0] == '/')) {
+            switch (tolower(argv[i][1])) {
+                case 't':        // traffic type
+                    ptr = &argv[i][2];
+                    while (*++ptr)  *ptr = toupper(*ptr);
+                    ptr = &argv[i][3];
+                    for ( j=0;j<134;j++) {
+                    if (!strcmp(ptr, szProto[j])) {
+//                        dwIoControlCode = SIO_RCVALL;
+#ifdef LINUX
+                        dwProtocol = j;
+#endif
+                        iProto=j;
+                        break;
+                    }
+                    }
+                    if ((j>133) && atoi(&argv[i][3])) {
+//                        dwIoControlCode = SIO_RCVALL;
+#ifdef LINUX
+                        dwProtocol = atoi(&argv[i][3]);
+#endif
+                        iProto=atoi(&argv[i][3]);
+                    } else  if (j>133)    usage(argv[0]);
+                    break;
+                case 'i':        // interface number
+#ifndef LINUX
+                    dwInterface = atoi(&argv[i][3]);
+#else
+                                    strcpy(intlist,&argv[i][3]);
+                                        ptr=strchr(intlist,' ');
+                                        if (ptr) *ptr=0;
+#endif
+                    break;
+                case 'g':        // gre
+                    gre=1;
+                    break;
+                case 'c':        // cycle time
+                    iCycle = atoi(&argv[i][3]);
+                    break;
+                case 'a':        // cycle time
+                    iDetail = 1;
+                    break;
+                case 'h':        // cycle time
+                    iDetail = justheader = 1;
+                    break;
+                case 'n':        // just n cycle
+                    lNum = atol(&argv[i][3]);
+                    break;
+                case 'l':        // lineno lines
+                    iline = atoi(&argv[i][3]);
+                    break;
+                case 'p':        // just summary
+                    if ((tolower(argv[i][2]) == 'a')) {
+                       strcpy(pattern,&argv[i][4]); printf("\n Pattern: \'%s",&argv[i][4]);
+                       while (++i<argc) { strcat(pattern," "); strcat(pattern,&argv[i][0]); printf(" %s",argv[i]); }
+                       printf("\'\n");
+                    } else  iSum=1;
+                    break;
+                case 'f':        // filename to write
+                    strcpy(filename,&argv[i][3]);
+                    iFile=1; //iScreen=0;
+                    break;
+                case 'e':        // execname
+                    strcpy(execname,&argv[i][3]);
+                    break;
+                case 'k':        // sor by count
+                    sortbysize = 0;
+                    break;
+                case '1':        // ignore src
+                    fromip = 0;
+                    break;
+                case '2':        // ignore dst
+                    toip = 0;
+                    break;
+                case 'v':        // sor by count 
+                    skipvlan = 4; 
+                    if ((tolower(argv[i][2]) == ':')) { 
+                         skipvlan=atoi(&argv[i][3]); 
+                     } 
+                     break; 
+                case 's':        // Filter on source ip or port
+                    if (tolower(argv[i][2]) == 'a') {
+                       ptr=strchr(&argv[i][4],'/');
+                       if (ptr) { usSourceNet=atoi(ptr+1); *ptr=0;}
+                       uiSourceAddr = ntohl(inet_addr(&argv[i][4]));
+                    } else if (tolower(argv[i][2]) == 'p')
+                        usSourcePort = (unsigned short)atoi(&argv[i][4]);
+                    else
+                    usage(argv[0]);
+                    bFilter = TRUE;
+                    break;
+                case 'd':       // Filter on dest ip or port
+                    if (tolower(argv[i][2]) == 'a') {
+                        ptr=strchr(&argv[i][4],'/');
+                        if (ptr) { usDestNet=atoi(ptr+1); *ptr=0; }
+                        uiDestAddr = ntohl(inet_addr(&argv[i][4]));
+                    } else if (tolower(argv[i][2]) == 'p')
+                        usDestPort = (unsigned short)atoi(&argv[i][4]);
+                    else
+                        usage(argv[0]);
+                    bFilter = TRUE;
+                    break;
+                case 'x':        // Filter on source or dest ip or port
+                    if (tolower(argv[i][2]) == 'a') {
+                       ptr=strchr(&argv[i][4],'/');
+                       if (ptr) { usXNet=atoi(ptr+1); *ptr=0; }
+                       uiXAddr = ntohl(inet_addr(&argv[i][4]));
+                    } else if (tolower(argv[i][2]) == 'p')
+                        usXPort = (unsigned short)atoi(&argv[i][4]);
+                    else
+                        usage(argv[0]);
+                    bFilter = TRUE;
+                    break;
+                default:
+                    usage(argv[0]);
+            }
+        } else usage(argv[0]);
+    }
+    iLnxplus+=skipvlan;
+    return;
+}
+
+#ifndef LINUX
+//
+// Function: PrintInterfaceList
+//
+// Description:
+//    This function prints all local IP interfaces.
+//
+void PrintInterfaceList()
+{
+    SOCKET_ADDRESS_LIST *slist=NULL;
+    SOCKET               s;
+    char                 buf[2048];
+    DWORD                dwBytesRet;
+    int                  ret,
+                         i;
+
+    s = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
+    if (s == SOCKET_ERROR) {
+        printf("socket() failed: %d\n", WSAGetLastError());
+        return;
+    }
+    ret = WSAIoctl(s, SIO_ADDRESS_LIST_QUERY, NULL, 0, buf, 2048,&dwBytesRet, NULL, NULL);
+    if (ret == SOCKET_ERROR){
+        printf("WSAIoctl(SIO_ADDRESS_LIST_QUERY) failed: %d\n",WSAGetLastError());
+        return;
+    }
+    slist = (SOCKET_ADDRESS_LIST *)buf;
+    for(i=0; i < slist->iAddressCount ;i++) {
+        printf("               %-2d ........ [%s]\n", i,
+            inet_ntoa(((SOCKADDR_IN *)slist->Address[i].lpSockaddr)->sin_addr));
+    }
+    closesocket(s);
+    return;
+}
+
+//
+// Function: GetInterface
+//
+// Description:
+//    This function retrieves a zero based index and returns
+//    the IP interface corresponding to that.
+//
+int GetInterface(SOCKET s, SOCKADDR_IN *ifx, int num)
+{
+    SOCKET_ADDRESS_LIST *slist=NULL;
+    char                 buf[2048];
+    DWORD                dwBytesRet;
+    int                  ret;
+
+    ret = WSAIoctl(s, SIO_ADDRESS_LIST_QUERY, NULL, 0, buf, 2048,&dwBytesRet, NULL, NULL);
+    if (ret == SOCKET_ERROR) {
+        printf("WSAIoctl(SIO_ADDRESS_LIST_QUERY) failed: %d\n",WSAGetLastError());
+        return -1;
+    }
+    slist = (SOCKET_ADDRESS_LIST *)buf;
+    if (num >= slist->iAddressCount)  return -1;
+    ifx->sin_addr.s_addr = ((SOCKADDR_IN *)slist->Address[num].lpSockaddr)->sin_addr.s_addr;
+        if (*author != 'p') return -1;
+    return 0;
+}
+#endif
+#ifdef LINUX
+struct promisc_device *prom;
+
+void init_capture( void )
+/*
+ * 1) Open our capture socket
+ * 2) Set all the promisc devices to promiscous mode
+ */
+{
+    struct ifreq ifr;
+    struct promisc_device *p,*pp;
+    struct protoent *pr;
+    char *p1,*p2;
+
+    if ((s = socket (AF_INET, SOCK_PACKET, htons (ETH_P_ALL))) < 0)
+        {
+            printf(" can't get socket: \n");
+            exit(1);
+        }
+    strcpy(myipname,intlist);
+    p1=intlist; p=NULL;
+    while (p1) {
+                pp=p;
+                p = malloc(sizeof(struct promisc_device));
+                if (pp) pp->next=p; else prom=p;
+                if ( (p2=strchr(p1,',')))       *p2++=0;
+                strcpy(&p->name,p1); p->next=NULL;
+                printf(" %s",p->name); fflush(stdout);
+                p1=p2;
+//    while(p!=NULL) {
+            strcpy (p -> oldifr.ifr_name, p -> name);
+
+            if (ioctl (s, SIOCGIFFLAGS, &(p -> oldifr)) < 0) {
+                    printf(" can't get flags: \n");
+                    exit(2);
+                }
+            p -> reset = 1;
+            ifr = p -> oldifr;
+            if (ifr.ifr_flags & IFF_PROMISC) printf(" already promisc! \n");
+            ifr.ifr_flags |= IFF_PROMISC;
+            if (ioctl (s, SIOCSIFFLAGS, &ifr) < 0) {
+                    printf(" can't set flags: \n");
+                    exit(3);
+                }
+//          p = p -> next;
+        }
+}
+
+void exit_capture(void)
+{
+    struct promisc_device *p;
+
+    /* do we have to check (capture_sd >= 0) ? */
+
+    p = prom;
+
+    while(p != NULL) {
+            if (ioctl (s, SIOCSIFFLAGS, &(p -> oldifr)) < 0) {
+                    printf("can't reset flags: \n");
+                }
+
+            p = p -> next;
+        }
+
+    close (s);
+}
+#endif
+//
+// Function: main
+//
+int main(int argc, char **argv) {
+    WSADATA       wsd;
+    SOCKADDR_IN   if0;
+    int           ret,count;
+    unsigned int  optval;
+    DWORD         dwBytesRet,
+                  dwFlags,
+                  nproc;
+    char          rcvbuf[MAX_IP_SIZE];
+    WSABUF        wbuf;
+    unsigned long i;
+#ifndef LINUX
+    // Load Winsock
+    //
+    if (WSAStartup(MAKEWORD(2,2), &wsd) != 0) {
+        printf(" WSAStartup() failed: %d\n", GetLastError());
+        return -1;
+    }
+#else
+    SOCKADDR    ssaddr;
+    struct promisc_device *p;
+    fd_set     ready;
+    struct timeval tv;
+#endif
+    char Key;
+    int status;
+    FILE *input;
+// Parse the command line
+//
+    strcpy(intlist,"eth0");
+    for(i=100;i<255;i++) szProto[i]="?!?";
+    szProto[103]="PIM";
+    szProto[108]="IPCOMP";
+    szProto[112]="VRRP";
+    szProto[115]="L2TP";
+    szProto[124]="ISIS";
+    szProto[132]="SCTP";
+    szProto[133]="FC";
+    *execname=0;
+    ValidateArgs(argc, argv);
+    if (bFilter) {
+                i=uiSourceAddr;
+                if ( i || usSourcePort)
+        printf(" Source: %03d.%03d.%03d.%03d/%d:%d\n",(i&0xff000000)>>24,(i&0x00ff0000)>>16,(i&0x0000ff00)>>8,i&0xff,uiSourceAddr?usSourceNet:0, usSourcePort);
+                i=uiDestAddr;
+                if ( i || usDestPort)
+                        printf(" Dest. : %03d.%03d.%03d.%03d/%d:%d\n",(i&0xff000000)>>24,(i&0x00ff0000)>>16,(i&0x0000ff00)>>8,i&0xff,uiDestAddr?usDestNet:0, usDestPort);
+                i=uiXAddr;
+                if ( i || usXPort)
+                        printf("  IP.   : %03d.%03d.%03d.%03d/%d:%d\n",(i&0xff000000)>>24,(i&0x00ff0000)>>16,(i&0x0000ff00)>>8,i&0xff,uiXAddr?usXNet:0, usXPort);
+    }
+        if (iFile) printf(" To file : %s\n",filename);
+        if (iProto) printf(" Protocol: %s (%d)\n",szProto[iProto],iProto);
+    // Create a raw socket for receiving IP datagrams
+    //
+#ifndef LINUX
+    s = WSASocket(AF_INET, SOCK_RAW, dwProtocol, NULL, 0, WSA_FLAG_OVERLAPPED);
+    if (s == INVALID_SOCKET)
+    {
+        printf("WSASocket() failed: %d\n", WSAGetLastError());
+        return -1;
+    }
+    // Get an interface to read IP packets on
+    //
+        memset(&if0,0,sizeof(if0));
+        if0.sin_family = AF_INET;
+    if0.sin_port = htons(0);
+    if (GetInterface(s, &if0, dwInterface) != 0)
+    {
+        printf("Unable to obtain an interface\n");
+        return -1;
+    }
+    sprintf(myipname,"%-16s",inet_ntoa(if0.sin_addr));
+#else
+        printf("starting capture ...."); fflush(stdout);
+        init_capture();
+        printf(" capture started ....\n"); fflush(stdout);
+#endif
+    printf(" Binding to IF: %s\n", myipname);
+#ifndef LINUX
+//
+// This socket MUST be bound before calling the ioctl
+//
+
+    if (bind(s, (SOCKADDR *)&if0, sizeof(if0)) == SOCKET_ERROR) {
+        printf("bind() failed: %d\n", WSAGetLastError());
+        return -1;
+    }
+//
+// Set the SIO_RCVALLxxx ioctl
+//
+    optval = 1;
+    if (WSAIoctl(s, dwIoControlCode, &optval, sizeof(optval),
+            NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR) {
+        printf("WSAIotcl() set raw socket failed; %d\n", WSAGetLastError());
+//        return -1;
+        optval = 2;
+       if (WSAIoctl(s, dwIoControlCode, &optval, sizeof(optval),
+            NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR) {
+        printf("WSAIotcl() set raw socket only failed; %d\n", WSAGetLastError());
+        return -1;
+        }
+    }
+    system("cls");
+#else
+    tv.tv_sec=0; tv.tv_usec=0;
+    set_raw_mode();
+    FD_ZERO(&ready);
+    FD_SET(STDIN_FILENO,&ready);
+#endif
+    input = fopen("/dev/tty", "r");      //open the terminal keyboard 
+    if (uiSourceAddr==0) ulSourceNet=0;
+    else for ( i=0; i<32-usSourceNet; i++) ulSourceNet <<= 1;
+    if (uiDestAddr==0) ulDestNet=0;
+    else for ( i=0; i<32-usDestNet; i++) ulDestNet <<= 1;
+    if (uiXAddr==0) ulXNet=0;
+    else for ( i=0; i<32-usXNet; i++) ulXNet <<= 1;
+    if (uiXAddr) uiSourceAddr=uiDestAddr=uiXAddr;
+    if (usXPort) usSourcePort=usDestPort=usXPort;
+    if (ulXNet) ulSourceNet=ulDestNet=ulXNet;
+    InitIPAcc();
+// Start receiving IP datagrams until interrupted
+//
+    count = 0;
+    if (iFile && iDetail)   f=fopen(filename,"w+");
+    if (iProto) bFilter=1;
+    if (*(author+1) != 'h') iRun=0;
+    while (iRun)    {
+       rcvbuf[MAX_IP_SIZE]=0;
+        wbuf.len = MAX_IP_SIZE;
+        wbuf.buf = rcvbuf;
+#ifndef LINUX
+        dwFlags  = 0;
+        ret = WSARecv(s, &wbuf, 1, &dwBytesRet, &dwFlags, NULL, NULL);
+        if (ret == SOCKET_ERROR) {
+            printf("WSARecv() failed: %d\n", WSAGetLastError());
+            return -1;
+        }
+       if (kbhit()) {
+#else
+        dwFlags  = sizeof(ssaddr);
+
+                ret = recvfrom (s, wbuf.buf, MAX_IP_SIZE, 0, &ssaddr, (int *) &dwFlags);
+                if (ret == -1) continue;
+                dwBytesRet=wbuf.len=ret;
+                p=prom;
+                while(p!=NULL)  {
+                        if (!strcmp(p -> name, ssaddr.sa_data)) break;
+                        p=p->next;
+                }
+                if (!p) {
+//                      printf("\n%s: ignored",ssaddr.sa_data); fflush(stdout);
+                        continue;
+                }
+        FD_ZERO(&ready);
+       FD_SET(STDIN_FILENO,&ready);
+       if (select(STDIN_FILENO+1,&ready,NULL,NULL,&tv)>0) {
+//     if (FD_ISSET(STDIN_FILENO,&ready)) {
+#endif
+          switch (getchar())  { /* branch to appropiate key handler */
+               case 0x1b: /* Esc */
+                    iRun=0;
+               break;
+               default:
+                    mostird=1;
+               break;
+          }  //end of switch key
+       }
+
+// Deccode the IP header
+//
+        if (!(nproc = DecodeIPHeader(&wbuf, uiSourceAddr, usSourcePort, ulSourceNet,
+                uiDestAddr, usDestPort, ulDestNet, dwBytesRet,usXPort,uiXAddr,ulXNet)))
+        {
+//            printf("Error decoding IP header!\n");
+//            break;
+        }
+    }
+    // Cleanup
+    //
+    if (iRun && !iDetail) CloseIPAcc();
+    if (f) fclose(f);
+#ifndef LINUX
+    closesocket(s);
+    WSACleanup();
+#else
+    exit_capture();
+#endif
+    return 0;
+}
diff --git a/utils/powertop/Makefile b/utils/powertop/Makefile
new file mode 100644 (file)
index 0000000..2e8e58e
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# 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:=powertop
+PKG_VERSION:=1.11
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.lesswatts.org/projects/powertop/download/
+PKG_MD5SUM:=3498f5983c683c3a57dce7379a722082
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/powertop
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=PowerTOP
+  DEPENDS:=+libncurses
+  URL:=http://www.lesswatts.org
+endef
+
+define Package/powertop/description
+ PowerTOP is a Linux tool that helps you find those programs that are
+ misbehaving while your computer is idle.
+endef
+
+define Package/powertop/install
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)
+endef
+
+$(eval $(call BuildPackage,powertop))
diff --git a/utils/powertop/patches/100-no-wide-ncurses.patch b/utils/powertop/patches/100-no-wide-ncurses.patch
new file mode 100644 (file)
index 0000000..61c93a3
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,7 @@ OBJS = powertop.o config.o process.o mis
+       
+ powertop: $(OBJS) Makefile powertop.h
+-      $(CC) ${CFLAGS}  $(OBJS) -lncursesw -o powertop
++      $(CC)  ${LDFLAGS}  $(OBJS) -lncurses -o powertop
+       @(cd po/ && $(MAKE))
+ powertop.1.gz: powertop.1
diff --git a/utils/powertop/patches/200-no-gettext.patch b/utils/powertop/patches/200-no-gettext.patch
new file mode 100644 (file)
index 0000000..623f240
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/powertop.c
++++ b/powertop.c
+@@ -30,7 +30,9 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ #include <dirent.h>
++#ifdef ENABLE_GETTEXT
+ #include <libintl.h>
++#endif
+ #include <ctype.h>
+ #include <assert.h>
+ #include <locale.h>
+@@ -783,9 +785,11 @@ int main(int argc, char **argv)
+       uint64_t cur_usage[8], cur_duration[8];
+       double wakeups_per_second = 0;
++#ifdef ENABLE_GETTEXT
+       setlocale (LC_ALL, "");
+       bindtextdomain ("powertop", "/usr/share/locale");
+       textdomain ("powertop");
++#endif
+       while (1) {
+               static struct option opts[] = {
+--- a/powertop.h
++++ b/powertop.h
+@@ -26,7 +26,9 @@
+ #ifndef __INCLUDE_GUARD_POWERTOP_H_
+ #define __INCLUDE_GUARD_POWERTOP_H_
++#ifdef ENABLE_GETTEXT
+ #include <libintl.h>
++#endif
+ struct line {
+       char    *string;
+@@ -86,7 +88,11 @@ extern suggestion_func *suggestion_activ
+         _x < _y ? _x : _y; })
++#ifdef ENABLE_GETTEXT
+ #define _(STRING)    gettext(STRING)
++#else
++#define _(STRING)    STRING
++#endif
+ #define PT_COLOR_DEFAULT    1
diff --git a/utils/pps-tools/Makefile b/utils/pps-tools/Makefile
new file mode 100644 (file)
index 0000000..d152363
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=pps-tools
+PKG_VERSION:=2.6.23
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pps-tools
+  SUBMENU:=Time Synchronization
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=@LINUX_2_6_23
+  TITLE:=PPS (Pulse Per Second) Userland tools
+  URL:=http://wiki.enneenne.com/index.php/LinuxPPS_support
+endef
+
+
+define Package/pps-tools/description
+  Userland tools for GPS and DCF-77 Clock syncronization. PPS support in Kernel must be enabled.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_BUILD_DIR)/timepps.h $(1)/usr/include/
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               CFLAGS="$(TARGET_CFLAGS) -DHAVE_ISC_READER=1 -I$(LINUX_DIR)/include -I ." \
+               BINDIR="/usr/sbin" MANDIR="/usr/man"
+endef
+
+define Package/pps-tools/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ppstest $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ppsctl $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,pps-tools))
diff --git a/utils/pps-tools/patches/001-source.patch b/utils/pps-tools/patches/001-source.patch
new file mode 100644 (file)
index 0000000..6707478
--- /dev/null
@@ -0,0 +1,480 @@
+diff --git a/Makefile b/Makefile
+new file mode 100644
+index 0000000..a2660a2
+--- /dev/null
++++ b/Makefile
+@@ -0,0 +1,27 @@
++TARGETS = ppstest ppsctl
++
++CFLAGS += -Wall -O2 -D_GNU_SOURCE
++CFLAGS += -I .
++CFLAGS += -ggdb
++
++# -- Actions section ----------------------------------------------------------
++
++.PHONY : all depend dep
++
++all : .depend $(TARGETS)
++
++.depend depend dep :
++      $(CC) $(CFLAGS) -M $(TARGETS:=.c) > .depend
++
++ifeq (.depend,$(wildcard .depend))
++include .depend
++endif
++
++
++# -- Clean section ------------------------------------------------------------
++
++.PHONY : clean
++
++clean :
++      rm -f *.o *~ core .depend
++      rm -f ${TARGETS}
+diff --git a/ppsctl.c b/ppsctl.c
+new file mode 100644
+index 0000000..83fd08a
+--- /dev/null
++++ b/ppsctl.c
+@@ -0,0 +1,62 @@
++#include <stdio.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <sys/ioctl.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <string.h>
++#include <linux/serial.h>
++
++void usage(char *name)
++{
++      fprintf(stderr, "usage: %s <ttyS> [enable|disable]\n", name);
++
++      exit(EXIT_FAILURE);
++}
++
++int main(int argc, char *argv[])
++{
++      int fd;
++      int ret;
++      struct serial_struct ss;
++
++      if (argc < 2)
++              usage(argv[0]);
++
++      fd = open(argv[1], O_RDWR);
++      if (fd < 0) {
++              perror("open");
++              exit(EXIT_FAILURE);
++      }
++
++      ret = ioctl(fd, TIOCGSERIAL, &ss);
++      if (ret < 0) {
++              perror("ioctl(TIOCGSERIAL)");
++              exit(EXIT_FAILURE);
++      }
++
++      if (argc < 3) {         /* just read PPS status */
++              printf("PPS is %sabled\n",
++                     ss.flags & ASYNC_HARDPPS_CD ? "en" : "dis");
++              exit(EXIT_SUCCESS);
++      }
++
++      if (argv[2][0] == 'e' || argv[2][0] == '1')
++              ss.flags |= ASYNC_HARDPPS_CD;
++      else if (argv[2][0] == 'd' || argv[2][0] == '0')
++              ss.flags &= ~ASYNC_HARDPPS_CD;
++      else {
++              fprintf(stderr, "invalid state argument \"%s\"\n", argv[2]);
++              exit(EXIT_FAILURE);
++      }
++
++      ret = ioctl(fd, TIOCSSERIAL, &ss);
++      if (ret < 0) {
++              perror("ioctl(TIOCSSERIAL)");
++              exit(EXIT_FAILURE);
++      }
++
++      return 0;
++}
+diff --git a/ppsfind b/ppsfind
+new file mode 100755
+index 0000000..93c0e17
+--- /dev/null
++++ b/ppsfind
+@@ -0,0 +1,17 @@
++#!/bin/sh
++
++SYS="/sys/class/pps/"
++
++if [ $# -lt 1 ] ; then
++      echo "usage: ppsfind <name>" >&2
++      exit 1
++fi
++
++for d in $(ls $SYS) ; do
++      if grep $1 $SYS/$d/name >& /dev/null || \
++         grep $1 $SYS/$d/path >& /dev/null ; then
++              echo "$d: name=$(cat $SYS/$d/name) path=$(cat $SYS/$d/path)"
++      fi
++done
++
++exit 0
+diff --git a/ppstest.c b/ppstest.c
+new file mode 100644
+index 0000000..d125ffa
+--- /dev/null
++++ b/ppstest.c
+@@ -0,0 +1,151 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <errno.h>
++#include <string.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++
++#include <timepps.h>
++
++int find_source(char *path, pps_handle_t *handle, int *avail_mode)
++{
++      pps_params_t params;
++      int ret;
++
++      printf("trying PPS source \"%s\"\n", path);
++
++      /* Try to find the source by using the supplied "path" name */
++      ret = open(path, O_RDWR);
++      if (ret < 0) {
++              fprintf(stderr, "unable to open device \"%s\" (%m)\n", path);
++              return ret;
++      }
++
++      /* Open the PPS source (and check the file descriptor) */
++      ret = time_pps_create(ret, handle);
++      if (ret < 0) {
++              fprintf(stderr, "cannot create a PPS source from device "
++                              "\"%s\" (%m)\n", path);
++              return -1;
++      }
++      printf("found PPS source \"%s\"\n", path);
++
++      /* Find out what features are supported */
++      ret = time_pps_getcap(*handle, avail_mode);
++      if (ret < 0) {
++              fprintf(stderr, "cannot get capabilities (%m)\n");
++              return -1;
++      }
++      if ((*avail_mode & PPS_CAPTUREASSERT) == 0) {
++              fprintf(stderr, "cannot CAPTUREASSERT\n");
++              return -1;
++      }
++      if ((*avail_mode & PPS_OFFSETASSERT) == 0) {
++              fprintf(stderr, "cannot OFFSETASSERT\n");
++              return -1;
++      }
++
++      /* Capture assert timestamps, and compensate for a 675 nsec
++       * propagation delay */
++      ret = time_pps_getparams(*handle, &params);
++      if (ret < 0) {
++              fprintf(stderr, "cannot get parameters (%m)\n");
++              return -1;
++      }
++      params.assert_offset.tv_sec = 0;
++      params.assert_offset.tv_nsec = 675;
++      params.mode |= PPS_CAPTUREASSERT | PPS_OFFSETASSERT;
++      ret = time_pps_setparams(*handle, &params);
++      if (ret < 0) {
++              fprintf(stderr, "cannot set parameters (%m)\n");
++              return -1;
++      }
++
++      return 0;
++}
++
++int fetch_source(int i, pps_handle_t *handle, int *avail_mode)
++{
++      struct timespec timeout;
++      pps_info_t infobuf;
++      int ret;
++
++      /* create a zero-valued timeout */
++      timeout.tv_sec = 3;
++      timeout.tv_nsec = 0;
++
++retry:
++      if (*avail_mode & PPS_CANWAIT) /* waits for the next event */
++              ret = time_pps_fetch(*handle, PPS_TSFMT_TSPEC, &infobuf,
++                                 &timeout);
++      else {
++              sleep(1);
++              ret = time_pps_fetch(*handle, PPS_TSFMT_TSPEC, &infobuf,
++                                 &timeout);
++      }
++      if (ret < 0) {
++              if (ret == -EINTR) {
++                      fprintf(stderr, "time_pps_fetch() got a signal!\n");
++                      goto retry;
++              }
++
++              fprintf(stderr, "time_pps_fetch() error %d (%m)\n", ret);
++              return -1;
++      }
++
++      printf("source %d - "
++             "assert %ld.%09ld, sequence: %ld - "
++             "clear  %ld.%09ld, sequence: %ld\n",
++             i,
++             infobuf.assert_timestamp.tv_sec,
++             infobuf.assert_timestamp.tv_nsec,
++             infobuf.assert_sequence,
++             infobuf.clear_timestamp.tv_sec,
++             infobuf.clear_timestamp.tv_nsec, infobuf.clear_sequence);
++
++      return 0;
++}
++
++void usage(char *name)
++{
++      fprintf(stderr, "usage: %s <ppsdev> [<ppsdev> ...]\n", name);
++      exit(EXIT_FAILURE);
++}
++
++int main(int argc, char *argv[])
++{
++      int num;
++      pps_handle_t handle[4];
++      int avail_mode[4];
++      int i = 0;
++      int ret;
++
++      /* Check the command line */
++      if (argc < 2)
++              usage(argv[0]);
++
++      for (i = 1; i < argc && i <= 4; i++) {
++              ret = find_source(argv[i], &handle[i - 1], &avail_mode[i - 1]);
++              if (ret < 0)
++                      exit(EXIT_FAILURE);
++      }
++
++      num = i - 1;
++      printf("ok, found %d source(s), now start fetching data...\n", num);
++
++      /* loop, printing the most recent timestamp every second or so */
++      while (1) {
++              for (i = 0; i < num; i++) {
++                      ret = fetch_source(i, &handle[i], &avail_mode[i]);
++                      if (ret < 0 && errno != ETIMEDOUT)
++                              exit(EXIT_FAILURE);
++              }
++      }
++
++      for (; i >= 0; i--)
++              time_pps_destroy(handle[i]);
++
++      return 0;
++}
+diff --git a/timepps.h b/timepps.h
+new file mode 100644
+index 0000000..28ebf4c
+--- /dev/null
++++ b/timepps.h
+@@ -0,0 +1,193 @@
++/*
++ * timepps.h -- PPS API main header
++ *
++ * Copyright (C) 2005-2007   Rodolfo Giometti <giometti@linux.it>
++ *
++ *   This program is free software; you can redistribute it and/or modify
++ *   it under the terms of the GNU General Public License as published by
++ *   the Free Software Foundation; either version 2 of the License, or
++ *   (at your option) any later version.
++ *
++ *   This program is distributed in the hope that it will be useful,
++ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *   GNU General Public License for more details.
++ *
++ *   You should have received a copy of the GNU General Public License
++ *   along with this program; if not, write to the Free Software
++ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#ifndef _SYS_TIMEPPS_H_
++#define _SYS_TIMEPPS_H_
++
++#include <sys/syscall.h>
++#include <unistd.h>
++#include <errno.h>
++#include <linux/pps.h>
++
++/*
++ * New data structures
++ */
++
++struct ntp_fp {
++      unsigned int integral;
++      unsigned int fractional;
++};
++
++union pps_timeu {
++      struct timespec tspec;
++      struct ntp_fp ntpfp;
++      unsigned long longpad[3];
++};
++
++struct pps_info {
++      unsigned long assert_sequence;  /* seq. num. of assert event */
++      unsigned long clear_sequence;   /* seq. num. of clear event */
++      union pps_timeu assert_tu;      /* time of assert event */
++      union pps_timeu clear_tu;       /* time of clear event */
++      int current_mode;               /* current mode bits */
++};
++
++struct pps_params {
++      int api_version;                /* API version # */
++      int mode;                       /* mode bits */
++      union pps_timeu assert_off_tu;  /* offset compensation for assert */
++      union pps_timeu clear_off_tu;   /* offset compensation for clear */
++};
++
++typedef int pps_handle_t;             /* represents a PPS source */
++typedef unsigned long pps_seq_t;      /* sequence number */
++typedef struct ntp_fp ntp_fp_t;               /* NTP-compatible time stamp */
++typedef union pps_timeu pps_timeu_t;  /* generic data type for time stamps */
++typedef struct pps_info pps_info_t;
++typedef struct pps_params pps_params_t;
++
++#define assert_timestamp        assert_tu.tspec
++#define clear_timestamp         clear_tu.tspec
++
++#define assert_timestamp_ntpfp  assert_tu.ntpfp
++#define clear_timestamp_ntpfp   clear_tu.ntpfp
++
++#define assert_offset         assert_off_tu.tspec
++#define clear_offset          clear_off_tu.tspec
++
++#define assert_offset_ntpfp     assert_off_tu.ntpfp
++#define clear_offset_ntpfp      clear_off_tu.ntpfp
++
++/*
++ * The PPS API
++ */
++
++static __inline int time_pps_create(int source, pps_handle_t *handle)
++{
++      int ret;
++
++      if (!handle) {
++              errno = EINVAL;
++              return -1;
++      }
++
++      /* First we check if current device is a PPS valid PPS one...
++       */
++      ret = ioctl(source, PPS_CHECK);
++      if (ret) {
++              errno = EOPNOTSUPP;
++              return -1;
++      }
++
++      /* ... then since in LinuxPPS there are no differences between a
++       * "PPS source" and a "PPS handle", we simply return the same value.
++       */
++      *handle = source;
++
++      return 0;
++}
++
++static __inline int time_pps_destroy(pps_handle_t handle)
++{
++      return close(handle);
++}
++
++static __inline int time_pps_getparams(pps_handle_t handle,
++                                      pps_params_t *ppsparams)
++{
++      int ret;
++      struct pps_kparams __ppsparams;
++
++      ret = ioctl(handle, PPS_GETPARAMS, &__ppsparams);
++
++      ppsparams->api_version = __ppsparams.api_version;
++      ppsparams->mode = __ppsparams.mode;
++      ppsparams->assert_off_tu.tspec.tv_sec = __ppsparams.assert_off_tu.sec;
++      ppsparams->assert_off_tu.tspec.tv_nsec = __ppsparams.assert_off_tu.nsec;
++      ppsparams->clear_off_tu.tspec.tv_sec = __ppsparams.clear_off_tu.sec;
++      ppsparams->clear_off_tu.tspec.tv_nsec = __ppsparams.clear_off_tu.nsec;
++
++      return ret;
++}
++
++static __inline int time_pps_setparams(pps_handle_t handle,
++                                      const pps_params_t *ppsparams)
++{
++      struct pps_kparams __ppsparams;
++
++      __ppsparams.api_version = ppsparams->api_version;
++      __ppsparams.mode = ppsparams->mode;
++      __ppsparams.assert_off_tu.sec = ppsparams->assert_off_tu.tspec.tv_sec;
++      __ppsparams.assert_off_tu.nsec = ppsparams->assert_off_tu.tspec.tv_nsec;
++      __ppsparams.clear_off_tu.sec = ppsparams->clear_off_tu.tspec.tv_sec;
++      __ppsparams.clear_off_tu.nsec = ppsparams->clear_off_tu.tspec.tv_nsec;
++
++      return ioctl(handle, PPS_SETPARAMS, &__ppsparams);
++}
++
++/* Get capabilities for handle */
++static __inline int time_pps_getcap(pps_handle_t handle, int *mode)
++{
++      return ioctl(handle, PPS_GETCAP, mode);
++}
++
++static __inline int time_pps_fetch(pps_handle_t handle, const int tsformat,
++                                      pps_info_t *ppsinfobuf,
++                                      const struct timespec *timeout)
++{
++      struct pps_fdata __fdata;
++      int ret;
++
++      /* Sanity checks */
++      if (tsformat != PPS_TSFMT_TSPEC) {
++              errno = EINVAL;
++              return -1;
++      }
++
++      if (timeout) {
++              __fdata.timeout.sec = timeout->tv_sec;
++              __fdata.timeout.nsec = timeout->tv_nsec;
++              __fdata.timeout.flags = ~PPS_TIME_INVALID;
++      } else
++              __fdata.timeout.flags = PPS_TIME_INVALID;
++
++      ret = ioctl(handle, PPS_FETCH, &__fdata);
++
++      ppsinfobuf->assert_sequence = __fdata.info.assert_sequence;
++      ppsinfobuf->clear_sequence = __fdata.info.clear_sequence;
++      ppsinfobuf->assert_tu.tspec.tv_sec = __fdata.info.assert_tu.sec;
++      ppsinfobuf->assert_tu.tspec.tv_nsec = __fdata.info.assert_tu.nsec;
++      ppsinfobuf->clear_tu.tspec.tv_sec = __fdata.info.clear_tu.sec;
++      ppsinfobuf->clear_tu.tspec.tv_nsec = __fdata.info.clear_tu.nsec;
++      ppsinfobuf->current_mode = __fdata.info.current_mode;
++
++      return ret;
++}
++
++static __inline int time_pps_kcbind(pps_handle_t handle,
++                                      const int kernel_consumer,
++                                      const int edge, const int tsformat)
++{
++      /* LinuxPPS doesn't implement kernel consumer feature */
++      errno = EOPNOTSUPP;
++      return -1;
++}
++
++#endif                                /* _SYS_TIMEPPS_H_ */
diff --git a/utils/procps/Makefile b/utils/procps/Makefile
new file mode 100644 (file)
index 0000000..612c80a
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (C) 2006-2010 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:=procps
+PKG_VERSION:=3.2.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://procps.sourceforge.net
+PKG_MD5SUM:=9532714b6846013ca9898984ba4cd7e0
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+PROCPS_APPLETS := \
+    ps free pgrep pkill pmap pwdx skill w \
+    slabtop snice tload top vmstat watch
+
+define Package/procps/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=proc utilities
+  URL:=http://procps.sourceforge.net/
+endef
+
+define Package/procps
+  $(call Package/procps/Default)
+  MENU:=1
+endef
+
+define Package/procps/description
+ procps is the package that has a bunch of small useful utilities that give
+ information about processes using the /proc filesystem. The package
+ includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill.
+endef
+
+define GenPlugin
+ define Package/$(1)
+   $(call Package/procps/Default)
+   DEPENDS:=procps
+   TITLE:=Applet $(2) from the procps package
+   DEFAULT:=y
+ endef
+
+ define Package/$(1)/description
+  Installs the applet $(2).
+ endef
+endef
+
+$(foreach a,$(PROCPS_APPLETS),$(eval $(call GenPlugin,procps-$(a),$(a))))
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       CPPFLAGS="$(TARGET_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+
+define Package/procps/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/proc/libproc-$(PKG_VERSION).so $(1)/usr/lib/
+endef
+
+AUXDIR_ps := "ps/"
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(AUXDIR_$(2))$(2) $$(1)/usr/bin/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+$(foreach a,$(PROCPS_APPLETS),$(eval $(call BuildPlugin,procps-$(a),$(a))))
+$(eval $(call BuildPackage,procps))
diff --git a/utils/procps/patches/010-make_fix.patch b/utils/procps/patches/010-make_fix.patch
new file mode 100644 (file)
index 0000000..74b1d3c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -174,7 +174,7 @@ INSTALL := $(BINFILES) $(MANFILES)
+ # want this rule first, use := on ALL, and ALL not filled in yet
+ all: do_all
+--include */module.mk
++-include proc/module.mk ps/module.mk 
+ do_all:    $(ALL)
diff --git a/utils/procps/patches/020_hz_fix.patch b/utils/procps/patches/020_hz_fix.patch
new file mode 100644 (file)
index 0000000..1954453
--- /dev/null
@@ -0,0 +1,41 @@
+--- a/proc/sysinfo.c
++++ b/proc/sysinfo.c
+@@ -209,7 +209,12 @@ static int check_for_privs(void){
+   return !!rc;
+ }
++#if __GNUC__ < 4 || __GNUC_MINOR__ < 3
+ static void init_libproc(void) __attribute__((constructor));
++#else
++static void init_libproc(void) __attribute__((constructor(200)));
++#endif
++
+ static void init_libproc(void){
+   have_privs = check_for_privs();
+   // ought to count CPUs in /proc/stat instead of relying
+--- a/proc/version.c
++++ b/proc/version.c
+@@ -33,7 +33,12 @@ void display_version(void) {
+ int linux_version_code;
++#if __GNUC__ < 4 || __GNUC_MINOR__ < 3
+ static void init_Linux_version(void) __attribute__((constructor));
++#else
++static void init_Linux_version(void) __attribute__((constructor(100)));
++#endif
++
+ static void init_Linux_version(void) {
+     static struct utsname uts;
+     int x = 0, y = 0, z = 0;  /* cleared in case sscanf() < 3 */
+--- a/proc/module.mk
++++ b/proc/module.mk
+@@ -76,7 +76,7 @@ proc/$(ANAME): $(LIBOBJ)
+ #proc/$(SONAME): proc/library.map
+ proc/$(SONAME): $(LIBOBJ)
+-      $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,--version-script=proc/library.map -o $@ $^ -lc
++      $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,--version-script=proc/library.map -o $@ $(sort $^) -lc
+ # AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
diff --git a/utils/procps/patches/030-fix-string-problems.patch b/utils/procps/patches/030-fix-string-problems.patch
new file mode 100644 (file)
index 0000000..de3756b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/proc/sig.c
++++ b/proc/sig.c
+@@ -214,7 +214,7 @@ void pretty_print_signals(void){
+   while(++i <= number_of_signals){
+     int n;
+     n = printf("%2d %s", i, signal_number_to_name(i));
+-    if(i%7) printf("           \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + n);
++    if(i%7) printf("%s", "           \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + n);
+     else printf("\n");
+   }
+   if((i-1)%7) printf("\n");
diff --git a/utils/ps3-utils/Makefile b/utils/ps3-utils/Makefile
new file mode 100644 (file)
index 0000000..dcc872d
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2008-2010 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:=ps3-utils
+PKG_REV:=6488134e48cf2d6f2d6471ced8346ac8cb1b855a
+PKG_VERSION:=20090320
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-utils.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ps3-utils
+       SECTION:=utils
+       CATEGORY:=Utilities
+       TITLE:=PS3 Linux Utilities
+       URL:=http://kernel.org/pub/linux/kernel/people/geoff/cell/ps3-utils/
+       MAINTAINER:=Geoff Levand <geoff@infradead.org>
+       DEPENDS:=@TARGET_ps3||TARGET_ps3chk||TARGET_powerpc
+endef
+
+define Package/ps3-utils/description
+     The ps3-utils package is a set of system administration utilites for the
+     PS3 game console.
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR) && $(BASH) -x ./bootstrap)
+       $(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/ps3*.h \
+               $(1)/usr/include
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/lib/libps3-utils.{la,a,so*} \
+               $(1)/usr/lib/
+endef
+
+define Package/ps3-utils/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib
+
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ps3-boot-game-os $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ps3-dump-bootloader $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ps3-flash-util $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ps3-video-mode $(1)/usr/bin
+
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libps3-utils.so.* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,ps3-utils))
diff --git a/utils/psmisc/Makefile b/utils/psmisc/Makefile
new file mode 100644 (file)
index 0000000..cd06b08
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2006-2012 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:=psmisc
+PKG_VERSION:=22.16
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/psmisc
+PKG_MD5SUM:=d52caf26159c905574c2ce4bd792b9ee
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/psmisc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=proc utilities
+  URL:=http://psmisc.sourceforge.net/
+endef
+
+define Package/psmisc/description
+ psmisc is a set of additional small useful utilities that use
+ the proc filesystem: fuser, killall, pstree, and prtstat
+endef
+
+CONFIGURE_ARGS += \
+       --disable-harden-flags
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       CPPFLAGS="$(TARGET_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)"
+
+define Package/psmisc/preinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/killall ]; then
+  rm $${IPKG_INSTROOT}/usr/bin/killall;
+fi
+endef
+
+define Package/psmisc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/{fuser,killall,prtstat,pstree} \
+               $(1)/usr/bin/
+endef
+
+define Package/psmisc/postrm
+#!/bin/sh
+ln -sf ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/killall
+$${IPKG_INSTROOT}/usr/bin/killall 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/killall
+exit 0
+endef
+
+$(eval $(call BuildPackage,psmisc))
diff --git a/utils/psplash/Makefile b/utils/psplash/Makefile
new file mode 100644 (file)
index 0000000..0b56383
--- /dev/null
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2007-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:=psplash
+PKG_VERSION:=0.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://projects.o-hand.com/sources/psplash/
+PKG_MD5SUM:=7649b7e0fac573eca2048a2a267e242b
+
+PKG_INSTALL:=1
+
+IMAGE_FILE:=generic
+ifeq ($(CONFIG_TARGET_s3c24xx),y)
+  IMAGE_FILE:=480x640
+endif
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/psplash
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A boot splash screen
+  URL:=http://projects.o-hand.com/psplash
+endef
+
+define Package/psplash/description
+PSplash is a userspace graphical boot splash screen.
+endef
+
+define Build/Configure
+       $(CP) \
+               ./files/image_$(IMAGE_FILE).h \
+               $(PKG_BUILD_DIR)/psplash-owrt-img.h
+       $(call Build/Configure/Default)
+endef
+
+define Package/psplash/install
+       $(INSTALL_DIR) $(1)/bin $(1)/etc/init.d
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin/psplash* \
+               $(1)/bin/
+       $(INSTALL_BIN) \
+               ./files/psplash.init \
+               $(1)/etc/init.d/psplash
+endef
+
+$(eval $(call BuildPackage,psplash))
diff --git a/utils/psplash/files/image_480x640.h b/utils/psplash/files/image_480x640.h
new file mode 100644 (file)
index 0000000..c26996b
--- /dev/null
@@ -0,0 +1,9452 @@
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#define OWRT_IMG_ROWSTRIDE (1920)
+#define OWRT_IMG_WIDTH (480)
+#define OWRT_IMG_HEIGHT (640)
+#define OWRT_IMG_BYTES_PER_PIXEL (4) /* 3:RGB, 4:RGBA */
+#define OWRT_IMG_RLE_PIXEL_DATA ((uint8*) \
+  "\206FT\203\377\2ES\202\377FT\203\377\210GU\204\377\202FU\204\377\5GU\204" \
+  "\377HT\203\377HU\204\377FS\203\377+:p\377\211\31*e\377\202\30)d\377\2" \
+  "\"2k\377CQ\201\377\204IV\205\377\202HU\204\377\1IV\205\377\214JW\206" \
+  "\377\1IV\206\377\204JW\206\377\264KX\206\377\202JW\206\377\202IV\206" \
+  "\377\214JW\206\377\202IV\205\377\1HU\204\377\203IV\205\377\3IW\206\377" \
+  "3Bv\377\31*e\377\202\30)d\377\207\31*e\377\3\30)d\377\31+f\377=K|\377" \
+  "\202HU\204\377\3HT\203\377GU\204\377FU\204\377\210GU\204\377\2FT\203" \
+  "\377ES\202\377\210FT\203\377\2ES\203\377DR\203\377\207ES\203\377\1DR" \
+  "\202\377\202CQ\201\377\205DR\202\377\3CP\201\377#3l\377\30)d\377\212" \
+  "\31*e\377\10\30)d\377\34,g\377AO\200\377BP\201\377AO\200\377BP\201\377" \
+  "BP\200\377BP\177\377\206BP\200\377\1AO\200\377\202@N\200\377\206AO\200" \
+  "\377\1@N\177\377\202\77M~\377\206@N\177\377\202\77M~\377\3""0@t\377\27" \
+  "(c\377\30)d\377\214\31*e\377\3\30)d\377,;q\377>L}\377\205=K}\377\210" \
+  "<K}\377\1:I{\377\207;J|\377\1""9Hz\377\203:I{\377\4""9Hz\377,<r\377\27" \
+  "(c\377\30)d\377\217\31*e\377\3\30)d\377\"2k\3779Gz\377\2068Fz\377\2""7" \
+  "Fy\3776Fx\377\2067Fy\377\1""5Dw\377\2066Ex\377\2\36.h\377\30)d\377\223" \
+  "\31*e\377\5\30)d\377\32+f\377+:q\3773Bw\3771@u\377\2072Av\377\1""0At" \
+  "\377\2071Au\377\3/\77t\377%5m\377\27)d\377\232\31*e\377\2,;q\377.=s\377" \
+  "\210-<r\377\204,<r\377\2(8p\377\30)d\377\233\31*e\377\3\30)d\377\33," \
+  "f\377&6n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\1&6n\377\202\30)d" \
+  "\377\235\31*e\377\1\30)d\377\205FT\203\377\4ES\202\377FT\203\377GU\204" \
+  "\377FT\203\377\207GU\204\377\6FU\204\377GU\204\377HT\203\377HU\204\377" \
+  "FS\202\377+:q\377\202\30)d\377\207\31*e\377\6\30)d\377\31*e\377,;q\377" \
+  "GT\203\377IV\205\377HU\204\377\202IV\205\377\1HU\204\377\202IV\205\377" \
+  "\2JW\206\377IV\205\377\211JW\206\377\202IV\206\377\202JW\206\377\233" \
+  "KX\206\377\203JW\205\377\230KX\206\377\2JW\206\377KX\206\377\202JW\206" \
+  "\377\202IV\206\377\212JW\206\377\2IV\205\377JW\206\377\202IV\205\377" \
+  "\7HU\204\377IV\205\377HV\205\377HU\204\377KW\206\377=L}\377\40""1j\377" \
+  "\202\30)d\377\207\31*e\377\3\30)d\377\32+e\3779Gz\377\202HU\204\377\202" \
+  "GU\204\377\1FU\204\377\206GU\204\377\4FT\203\377GU\204\377FT\203\377" \
+  "ES\202\377\206FT\203\377\203ES\203\377\1DR\203\377\205ES\203\377\4DR" \
+  "\202\377ES\203\377DR\202\377CQ\201\377\204DR\202\377\5CQ\201\377ES\202" \
+  "\377;J|\377\32+f\377\30)d\377\212\31*e\377\3\30)d\377+;q\377CQ\202\377" \
+  "\202BP\201\377\202BP\200\377\1BP\177\377\206BP\200\377\2AO\200\377@N" \
+  "\200\377\205AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\206@" \
+  "N\177\377\5\77M~\377>L}\377;I{\377\36.h\377\30)d\377\214\31*e\377\3\30" \
+  ")d\377\37/i\377<J|\377\205=K}\377\1;K}\377\207<K}\377\2;J|\377:I{\377" \
+  "\206;J|\377\2:I{\3779Hz\377\203:I{\377\3""5Dw\377\32+e\377\30)d\377\217" \
+  "\31*e\377\3\31)d\377\31*e\3777Ey\377\2058Fz\377\3""7Fy\3778Fz\3776Fx" \
+  "\377\2067Fy\377\2""6Ex\3775Dw\377\2036Ex\377\4""5Dw\3777Fx\377'6m\377" \
+  "\30)d\377\223\31*e\377\202\30)d\377\3&6n\3773Bw\3771@u\377\2072Av\377" \
+  "\1""0At\377\2071Au\377\2/\77u\377*:p\377\202\30)d\377\231\31*e\377\2" \
+  "'7n\377.=s\377\210-<r\377\205,<r\377\2\31*e\377\30)d\377\232\31*e\377" \
+  "\3\30)d\377\32+f\377$4l\377\202(8o\377\202'7o\377\1&6o\377\204'7o\377" \
+  "\3&6n\377\32,f\377\30)d\377\235\31*e\377\1\30)d\377\205FT\203\377\2E" \
+  "S\202\377FT\203\377\210GU\204\377\3FU\204\377GU\204\377HT\203\377\202" \
+  "HU\204\377\3(8o\377\27)d\377\30)d\377\207\31*e\377\202\30)d\377\5""6" \
+  "Dx\377HU\204\377IV\205\377HU\204\377IV\205\377\202HU\204\377\1IV\205" \
+  "\377\202JW\206\377\1IV\205\377\211JW\206\377\1IV\206\377\202JW\206\377" \
+  "\202KX\206\377\1JW\206\377\221KX\206\377\211JW\205\377\203KX\206\377" \
+  "\211JW\205\377\220KX\206\377\1JW\206\377\202KX\206\377\202JW\206\377" \
+  "\202IV\206\377\211JW\206\377\3IV\205\377JW\206\377IV\205\377\202HU\204" \
+  "\377\202IV\205\377\5HU\204\377IV\205\377CP\201\377&6m\377\27(d\377\210" \
+  "\31*e\377\5\30)d\377\33,f\377:I{\377HU\204\377GT\203\377\202GU\204\377" \
+  "\1FU\204\377\206GU\204\377\3FT\203\377GU\204\377ES\202\377\210FT\203" \
+  "\377\202ES\203\377\1DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\205" \
+  "DR\202\377\4CQ\201\377ES\203\377.>s\377\26'c\377\213\31*e\377\7\34-g" \
+  "\377;I|\377BP\201\377AO\200\377BP\201\377BP\200\377BP\177\377\206BP\200" \
+  "\377\202AO\200\377\1@N\200\377\206AO\200\377\207@N\177\377\5\77M~\377" \
+  "@N\177\377\77M~\377>L}\377*:p\377\202\30)d\377\214\31*e\377\4\33,f\377" \
+  "2Av\377=K}\377<J|\377\203=K}\377\2<K}\377;K}\377\205<K}\377\3;J|\377" \
+  "<K}\377:I{\377\205;J|\377\3:I{\377;J|\3779Hz\377\203:I{\377\3""8Gy\377" \
+  "\"2k\377\30)d\377\221\31*e\377\1-<s\377\2068Fz\377\2""7Fy\3776Fx\377" \
+  "\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2056Ex\377\2/>s\377\30)d\377\224" \
+  "\31*e\377\5\30)d\377!2k\3771Av\3772Av\3771@u\377\2062Av\377\1""0At\377" \
+  "\2071Au\377\4/\77u\377,<r\377\33,f\377\30)d\377\231\31*e\377\2\"3k\377" \
+  ".=s\377\210-<r\377\203,<r\377\4+;q\377,<r\377\35-g\377\30)d\377\232\31" \
+  "*e\377\10\30)d\377\31*e\377\"3k\377(8o\377'7o\377(8o\377'7o\377&6o\377" \
+  "\204'7o\377\3&6n\377\35-g\377\30)d\377\236\31*e\377\204FT\203\377\2E" \
+  "S\202\377FT\203\377\210GU\204\377\6FU\204\377GU\204\377HT\203\377HU\204" \
+  "\377IU\204\377&5n\377\202\30)d\377\207\31*e\377\10\30)d\377\33,f\377" \
+  "\77L~\377HU\204\377IV\205\377HU\204\377IV\205\377HU\204\377\202IV\205" \
+  "\377\2JW\206\377IV\205\377\211JW\206\377\202IV\206\377\202JW\206\377" \
+  "\221KX\206\377\204JW\205\377\211KX\206\377\202LY\207\377\212KX\206\377" \
+  "\204JW\205\377\216KX\206\377\2JW\206\377KX\206\377\203JW\206\377\1IV" \
+  "\206\377\211JW\206\377\2IV\205\377JW\206\377\202IV\205\377\1HU\204\377" \
+  "\204IV\205\377\3HU\205\377*:p\377\26(c\377\207\31*e\377\202\30)d\377" \
+  "\6\32+e\377>L}\377HU\204\377GT\203\377HU\204\377FU\204\377\210GU\204" \
+  "\377\2FT\203\377ES\202\377\206FT\203\377\4ES\203\377FT\203\377ES\203" \
+  "\377DR\203\377\205ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377" \
+  "\204DR\202\377\5CQ\201\377DR\202\377CQ\201\377\37/h\377\30)d\377\212" \
+  "\31*e\377\3\30)d\377+:q\377BP\200\377\203BP\201\377\2BP\200\377BP\177" \
+  "\377\204BP\200\377\4AO\200\377BP\200\377AO\200\377@N\200\377\205AO\200" \
+  "\377\2@N\177\377AO\200\377\210@N\177\377\5>L}\377\77M~\3775Cw\377\33" \
+  ",f\377\30)d\377\214\31*e\377\2\30)d\377)8o\377\204=K}\377\3<K}\377=K" \
+  "}\377;K}\377\207<K}\377\1:I{\377\206;J|\377\2:I{\3779Hz\377\204:I{\377" \
+  "\2*:p\377\30)d\377\221\31*e\377\3#4l\3779G{\3777Ey\377\2048Fz\377\2""7" \
+  "Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""7Fx\377\31*" \
+  "e\377\30)d\377\223\31*e\377\5\30)d\377\35-g\3770\77u\3772Av\3771@u\377" \
+  "\2062Av\377\2""1Au\3770At\377\2061Au\377\4/\77u\377->s\377\36/h\377\30" \
+  ")d\377\230\31*e\377\5\30)d\377\36/h\377.=s\377-<r\377,;q\377\206-<r\377" \
+  "\205,<r\377\2!2k\377\30)d\377\232\31*e\377\202\30)d\377\1!1j\377\203" \
+  "(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377\37/i\377\30)d\377\236\31" \
+  "*e\377\203FT\203\377\4ES\202\377FT\203\377GU\204\377FT\203\377\206GU" \
+  "\204\377\2FU\204\377GU\204\377\202HU\204\377\3GT\203\377+;q\377\30)d" \
+  "\377\210\31*e\377\5\30)d\377\36/h\377\77M~\377IV\205\377HU\204\377\202" \
+  "IV\205\377\4HU\204\377IV\205\377JW\206\377IV\205\377\211JW\206\377\202" \
+  "IV\206\377\3JW\206\377KX\206\377JW\206\377\214KX\206\377\203JW\205\377" \
+  "\204KX\206\377\226LY\207\377\1KX\206\377\204LY\207\377\204KX\206\377" \
+  "\202JW\205\377\214KX\206\377\1JW\206\377\202KX\206\377\202JW\206\377" \
+  "\1IV\206\377\212JW\206\377\1IV\205\377\202HU\204\377\5IV\205\377HU\205" \
+  "\377HU\204\377JW\206\3770\77t\377\203\30)d\377\206\31*e\377\3\30)d\377" \
+  "\31*e\377\77M~\377\202HU\204\377\3HT\203\377GU\204\377FU\204\377\207" \
+  "GU\204\377\1FT\203\377\202ES\202\377\205FT\203\377\4ES\203\377FT\203" \
+  "\377ES\203\377DR\203\377\207ES\203\377\2DR\202\377CQ\201\377\206DR\202" \
+  "\377\3""8Gz\377\27(d\377\30)d\377\211\31*e\377\3\30)d\377\35.g\377;I" \
+  "|\377\203BP\201\377\207BP\200\377\2AO\200\377BP\200\377\210AO\200\377" \
+  "\2@N\177\377\77M~\377\205@N\177\377\5\77M~\377@N\177\377\77M}\377\77" \
+  "L~\377!1j\377\215\31*e\377\3\30)d\377\40""0i\3779Gz\377\204=K}\377\202" \
+  "<K}\377\1;K}\377\205<K}\377\202;J|\377\1:I{\377\206;J|\377\2:I{\3779" \
+  "Hz\377\203:I{\377\2""1@t\377\33,f\377\220\31*e\377\3\30)d\377\36.h\377" \
+  "6Ey\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\204" \
+  "6Ex\377\3""7Fx\377\"2k\377\30)d\377\223\31*e\377\202\30)d\377\3.>t\377" \
+  "2Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2051Au\377\5""0@u\3771Au" \
+  "\377/\77u\377\"2k\377\30)d\377\230\31*e\377\5\30)d\377\35-g\377,;r\377" \
+  ".=s\377,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203,<r\377\2&6m\377" \
+  "\27(d\377\233\31*e\377\3\30)d\377\37/i\377'7n\377\202(8o\377\2'7o\377" \
+  "&6o\377\204'7o\377\2&6n\377!2k\377\202\30)d\377\235\31*e\377\203FT\203" \
+  "\377\3ES\202\377GU\204\377FT\203\377\206GU\204\377\1FU\204\377\202GU" \
+  "\204\377\5GT\203\377HU\204\3771@u\377\30*e\377\30)d\377\207\31*e\377" \
+  "\5\27(d\377!1j\377\77M\177\377JW\206\377IV\204\377\202IV\205\377\4HU" \
+  "\204\377IV\205\377JW\206\377IV\205\377\210JW\206\377\202IV\206\377\202" \
+  "JW\206\377\2KX\206\377JW\206\377\213KX\206\377\202JW\205\377\203KX\206" \
+  "\377\236LY\207\377\1KX\206\377\203LY\207\377\203KX\206\377\203JW\205" \
+  "\377\213KX\206\377\2JW\206\377KX\206\377\202JW\206\377\1IV\206\377\210" \
+  "JW\206\377\3IV\205\377JW\206\377IV\205\377\202HU\204\377\202IV\205\377" \
+  "\5HU\204\377IV\205\3773Bw\377\32+f\377\30)d\377\207\31*e\377\3\30)d\377" \
+  "\35-g\377\77M~\377\202HU\204\377\2GU\204\377FU\204\377\206GU\204\377" \
+  "\2FT\203\377GU\204\377\210FT\203\377\3ES\203\377FT\203\377DR\203\377" \
+  "\206ES\203\377\203DR\202\377\1CQ\201\377\204DR\202\377\3CQ\201\377BP" \
+  "\200\377&6n\377\202\30)d\377\211\31*e\377\7\27(c\377-<r\377BP\201\377" \
+  "AO\200\377BP\200\377BP\201\377BP\177\377\207BP\200\377\2AO\200\377@N" \
+  "\200\377\205AO\200\377\3@N\177\377AO\200\377\77M~\377\207@N\177\377\4" \
+  "\77M~\377@N~\377.>s\377\30)d\377\214\31*e\377\202\30)d\377\2""4Bw\377" \
+  "<J|\377\204=K}\377\2<K}\377;K}\377\206<K}\377\2;J|\377:I{\377\206;J|" \
+  "\377\2:I{\3779Hz\377\203:I{\377\3""8Gy\377\36.h\377\31*d\377\217\31*" \
+  "e\377\3\30)d\377\33,f\3770\77u\377\2068Fz\377\2""7Fy\3776Fx\377\2067" \
+  "Fy\377\2""6Ex\3775Dw\377\2056Ex\377\2+;p\377\27(d\377\224\31*e\377\5" \
+  "\27(c\377*9p\3773Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3770At\377\206" \
+  "1Au\377\3""0@t\3770@u\377%5m\377\231\31*e\377\5\30)d\377\33,f\377*9p" \
+  "\377.=s\377,;q\377\207-<r\377\1+<r\377\203,<r\377\1*:q\377\202\30)d\377" \
+  "\232\31*e\377\3\30)d\377\35-g\377'7n\377\202(8o\377\207'7o\377\3#3l\377" \
+  "\31*e\377\30)d\377\235\31*e\377\202FT\203\377\2ES\202\377FT\203\377\210" \
+  "GU\204\377\7FU\204\377GU\204\377GT\203\377JV\205\3775Cw\377\31*e\377" \
+  "\30)d\377\207\31*e\377\6\26'c\377#3l\377BP\200\377JW\206\377HU\204\377" \
+  "HU\205\377\202HU\204\377\3IV\205\377JW\206\377IV\205\377\210JW\206\377" \
+  "\1IV\206\377\202JW\206\377\202KX\206\377\1JW\206\377\212KX\206\377\202" \
+  "JW\205\377\203KX\206\377\202LY\207\377\1KX\206\377\240LY\207\377\1KX" \
+  "\206\377\202LY\207\377\203KX\206\377\202JW\205\377\213KX\206\377\2JW" \
+  "\206\377KX\206\377\202JW\206\377\1IV\206\377\210JW\206\377\2IV\205\377" \
+  "JW\206\377\202IV\205\377\1HU\204\377\204IV\205\377\1""6Dx\377\202\30" \
+  ")d\377\207\31*e\377\4\30)d\377!1j\377BP\200\377HU\204\377\202GU\204\377" \
+  "\1FU\204\377\206GU\204\377\3FT\203\377GU\204\377ES\202\377\210FT\203" \
+  "\377\2ES\203\377DR\203\377\207ES\203\377\2DR\202\377CQ\201\377\206DR" \
+  "\202\377\3""8Gz\377\33,f\377\30)d\377\211\31*e\377\3\30)d\377\32+e\377" \
+  ">L~\377\203BP\201\377\2BP\200\377BP\177\377\205BP\200\377\3AO\200\377" \
+  "BP\200\377@N\200\377\207AO\200\377\2@N\177\377\77M~\377\205@N\177\377" \
+  "\203\77M~\377\3>K}\377\32+e\377\30)d\377\214\31*e\377\3\27(d\377(8o\377" \
+  "<J|\377\204=K}\377\202<K}\377\1;K}\377\205<K}\377\202;J|\377\1:I{\377" \
+  "\205;J|\377\202:I{\377\6""9Hz\377:I{\3779H{\377;J|\377$4m\377\30)d\377" \
+  "\217\31*e\377\3\30)d\377\30*e\377*:q\377\2068Fz\377\2""7Fy\3776Fx\377" \
+  "\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""3Cv\377\27(c\377\30)d\377" \
+  "\223\31*e\377\5\30)d\377#3l\3773Bw\3772Av\3771@u\377\2052Av\377\2021" \
+  "Au\377\1""0At\377\2051Au\377\2020@u\377\2)9p\377\32+e\377\230\31*e\377" \
+  "\5\30)d\377\31*e\377'7n\377.=s\377,;q\377\207-<r\377\1+<r\377\202,<r" \
+  "\377\202+;q\377\2\32+f\377\30)d\377\232\31*e\377\6\30)d\377\32+f\377" \
+  "&6n\377(8o\377'7o\377(8o\377\206'7o\377\3$4m\377\32+e\377\30)d\377\235" \
+  "\31*e\377\5FT\203\377ES\202\377FT\203\377GU\204\377FT\203\377\206GU\204" \
+  "\377\5FU\204\377GU\204\377GT\203\377IV\205\377:I{\377\202\30)d\377\207" \
+  "\31*e\377\5\27(d\377$4l\377ER\202\377IV\205\377HU\204\377\205IV\205\377" \
+  "\211JW\206\377\2IV\206\377JW\206\377\202KX\206\377\1JW\206\377\212KX" \
+  "\206\377\202JW\205\377\202KX\206\377\203LY\207\377\1KX\206\377\250LY" \
+  "\207\377\202KX\206\377\203JW\205\377\211KX\206\377\1JW\206\377\202KX" \
+  "\206\377\1JW\206\377\202IV\206\377\207JW\206\377\1IV\205\377\202JW\206" \
+  "\377\4IV\205\377HU\204\377IV\205\377HU\204\377\202IV\205\377\3""9Hz\377" \
+  "\27(c\377\30)d\377\206\31*e\377\202\30)d\377\6%4m\377HU\204\377GT\203" \
+  "\377HU\204\377GU\204\377FU\204\377\207GU\204\377\2FT\203\377ES\202\377" \
+  "\206FT\203\377\4ES\203\377FT\203\377ES\203\377DR\203\377\207ES\203\377" \
+  "\2DR\202\377CQ\201\377\205DR\202\377\2ER\202\377%6m\377\213\31*e\377" \
+  "\7\27(d\377):q\377CQ\202\377AO\200\377BP\200\377BP\201\377BP\177\377" \
+  "\207BP\200\377\2AO\200\377@N\200\377\205AO\200\377\202@N\177\377\1\77" \
+  "M~\377\206@N\177\377\5\77M~\377>L}\377@N\177\377(7n\377\27)d\377\214" \
+  "\31*e\377\4\30)d\377\32+f\377=K}\377<J|\377\204=K}\377\2<K}\377;K}\377" \
+  "\206<K}\377\2;J|\377:I{\377\204;J|\377\11:I{\377;J|\377:I{\3779Hz\377" \
+  ":I{\3779Hz\377:I{\377/\77t\377\30)d\377\217\31*e\377\202\30)d\377\2$" \
+  "4l\3776Ey\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377" \
+  "\2036Ex\377\2025Dw\377\2\35.h\377\30)d\377\223\31*e\377\5\30)d\377\34" \
+  "-g\3773Bw\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2051Au\377\202" \
+  "0@u\377\2,=r\377\33,f\377\230\31*e\377\202\30)d\377\4%5m\377.=s\377-" \
+  "<r\377,;q\377\206-<r\377\1+<r\377\203,<r\377\3+;q\377\36.h\377\30)d\377" \
+  "\232\31*e\377\4\30)d\377\30)e\377&6m\377'7n\377\202(8o\377\206'7o\377" \
+  "\3%5m\377\33,f\377\30)d\377\235\31*e\377\4ES\202\377FT\203\377GU\204" \
+  "\377FT\203\377\206GU\204\377\2FU\204\377GU\204\377\202HU\204\377\3@M" \
+  "~\377\33+f\377\31*d\377\207\31*e\377\3\30)d\377\"2k\377CQ\201\377\203" \
+  "IV\205\377\4HU\204\377IV\205\377JW\206\377IV\205\377\210JW\206\377\2" \
+  "IV\206\377JW\206\377\202KX\206\377\1JW\206\377\211KX\206\377\1JW\205" \
+  "\377\203KX\206\377\202LY\207\377\1KX\206\377\260LY\207\377\202KX\206" \
+  "\377\202JW\205\377\213KX\206\377\2JW\206\377IV\206\377\210JW\206\377" \
+  "\4IV\205\377JW\206\377IV\205\377HU\204\377\202IV\205\377\5HU\204\377" \
+  "IV\205\3779Gz\377\30)e\377\30)d\377\207\31*e\377\2\26(c\377+;q\377\202" \
+  "HU\204\377\3HT\203\377GU\204\377FU\204\377\206GU\204\377\202FT\203\377" \
+  "\1ES\202\377\207FT\203\377\1ES\203\377\202DR\203\377\206ES\203\377\2" \
+  "DR\202\377CQ\201\377\204DR\202\377\5CQ\201\377DR\202\377;J|\377\31*e" \
+  "\377\30)d\377\211\31*e\377\5\30)d\377\30)e\377>M\177\377BP\201\377AO" \
+  "\200\377\202BP\200\377\1BP\177\377\206BP\200\377\1AO\200\377\202@N\200" \
+  "\377\206AO\200\377\2@N\177\377\77M~\377\206@N\177\377\202\77M~\377\3" \
+  "9Hz\377\27(c\377\30)d\377\214\31*e\377\2\27(c\3772Av\377\205=K}\377\1" \
+  "<K}\377\202;K}\377\205<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz" \
+  "\377\203:I{\377\3""9I{\377\31*e\377\30)d\377\217\31*e\377\4\30)d\377" \
+  "\36/i\3774Cx\3777Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6" \
+  "Ex\3775Dw\377\2046Ex\377\3""5Dw\377%5l\377\27)d\377\224\31*e\377\4\27" \
+  "(c\3771@v\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\202" \
+  "0@u\377\2\34-g\377\30)d\377\230\31*e\377\2\30)d\377\"2j\377\202-<r\377" \
+  "\1,;q\377\206-<r\377\2,<r\377+<r\377\202,<r\377\3+;q\377!1j\377\30)d" \
+  "\377\233\31*e\377\2\30)d\377$5l\377\203(8o\377\206'7o\377\3&6n\377\34" \
+  "-g\377\30)d\377\235\31*e\377\2ES\202\377FT\203\377\207GU\204\377\1FU" \
+  "\204\377\202GU\204\377\4HU\204\377CP\201\377\"2j\377\30)d\377\207\31" \
+  "*e\377\12\30)d\377!1j\377AO\200\377JW\205\377HU\204\377IV\205\377HU\204" \
+  "\377IV\205\377JW\206\377IV\205\377\207JW\206\377\202IV\206\377\3JW\206" \
+  "\377KX\206\377JW\206\377\212KX\206\377\1JW\205\377\202KX\206\377\225" \
+  "LY\207\377\215LX\207\377\222LY\207\377\2KX\206\377LY\207\377\203KX\206" \
+  "\377\1JW\205\377\211KX\206\377\3JW\206\377KX\206\377JW\206\377\202IV" \
+  "\206\377\207JW\206\377\4IV\205\377JW\206\377IV\205\377HU\204\377\202" \
+  "IV\205\377\5HU\204\377IV\205\3775Cw\377\31*e\377\30)d\377\207\31*e\377" \
+  "\2\26(c\3772Av\377\202HU\204\377\2HT\203\377FU\204\377\207GU\204\377" \
+  "\202FT\203\377\1ES\202\377\205FT\203\377\4ES\203\377FT\203\377ES\203" \
+  "\377DR\203\377\205ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377" \
+  "\204DR\202\377\4CQ\201\377GT\204\377(8o\377\27(d\377\212\31*e\377\3\30" \
+  ")d\377*9p\377CQ\202\377\202BP\201\377\202BP\200\377\1BP\177\377\206B" \
+  "P\200\377\2AO\200\377@N\200\377\206AO\200\377\2@N\177\377\77M~\377\206" \
+  "@N\177\377\203\77M~\377\2\40""1j\377\30)d\377\214\31*e\377\4\30)d\377" \
+  "\"2k\377\77L~\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377\204" \
+  "<K}\377\2;J|\377<K}\377\206;J|\377\2:I{\377;J|\377\203:I{\377\4""9Hz" \
+  "\377;J|\377\"3k\377\30)d\377\217\31*e\377\202\30)d\377\1""2@v\377\206" \
+  "8Fz\377\2107Fy\377\2""6Ex\3775Dw\377\2046Ex\377\4""5Dw\377,;q\377\27" \
+  "(d\377\30)d\377\223\31*e\377\5\27(d\377*:q\3773Bw\3772Av\3771@u\377\205" \
+  "2Av\377\2""1Au\3770At\377\2061Au\377\4""0@t\3771Au\377\40""1j\377\30" \
+  ")d\377\230\31*e\377\5\30)d\377\36/i\377,;r\377-<r\377,;q\377\205-<r\377" \
+  "\3,<r\377-<r\377+<r\377\202,<r\377\3+;q\377$5m\377\30)d\377\233\31*e" \
+  "\377\2\30)d\377!1k\377\203(8o\377\207'7o\377\2\35.h\377\30)d\377\235" \
+  "\31*e\377\3FT\203\377GU\204\377FT\203\377\205GU\204\377\1FU\204\377\202" \
+  "GU\204\377\202GT\203\377\1*9p\377\202\30)d\377\206\31*e\377\7\27(d\377" \
+  "\36/h\377BO\200\377JW\205\377HU\204\377IV\205\377HU\204\377\202IV\205" \
+  "\377\211JW\206\377\1IV\206\377\202JW\206\377\212KX\206\377\202JW\205" \
+  "\377\1KX\206\377\202LY\207\377\1KX\206\377\217LY\207\377\205LX\207\377" \
+  "\214LY\207\377\205LX\207\377\222LY\207\377\202KX\206\377\1JW\205\377" \
+  "\211KX\206\377\2JW\206\377KX\206\377\202JW\206\377\1IV\206\377\207JW" \
+  "\206\377\4IV\205\377JW\206\377IV\205\377HU\204\377\203IV\205\377\3HU" \
+  "\205\3771@u\377\27)d\377\210\31*e\377\6\32+f\3779Gz\377IU\204\377HT\203" \
+  "\377GU\204\377FU\204\377\207GU\204\377\202FT\203\377\1ES\202\377\206" \
+  "FT\203\377\2ES\203\377DR\203\377\206ES\203\377\3DR\202\377ES\203\377" \
+  "CQ\201\377\206DR\202\377\3@N\177\377\31*e\377\30)d\377\211\31*e\377\10" \
+  "\31)e\377\35.h\377=K}\377BP\201\377AO\200\377BP\201\377BP\200\377BP\177" \
+  "\377\206BP\200\377\2AO\200\377@N\200\377\206AO\200\377\202@N\177\377" \
+  "\1\77M~\377\204@N\177\377\2\77M~\377@N\177\377\202\77M~\377\2""1@t\377" \
+  "\27(c\377\214\31*e\377\3\30)d\377\31*e\377;I{\377\205=K}\377\2<K}\377" \
+  ";K}\377\206<K}\377\210;J|\377\205:I{\377\2.>s\377\27(c\377\220\31*e\377" \
+  "\2\27(c\377,;q\377\2058Fz\377\2""7Fy\3778Fz\377\2077Fy\377\2076Ex\377" \
+  "\3""0@t\377\31*e\377\30)d\377\223\31*e\377\5\30)d\377#4l\3774Cw\3772" \
+  "Av\3771@u\377\2052Av\377\2021Au\377\1""0At\377\2051Au\377\2020@u\377" \
+  "\2%6m\377\30)d\377\230\31*e\377\5\30)d\377\34,g\377,;q\377-<r\377,;q" \
+  "\377\206-<r\377\2,<r\377+<r\377\203,<r\377\1'7n\377\202\30)d\377\232" \
+  "\31*e\377\2\30)d\377\36/h\377\203(8o\377\205'7o\377\3&6n\377'7o\377\37" \
+  "/i\377\236\31*e\377\2GU\204\377FT\203\377\207GU\204\377\6HU\204\377G" \
+  "T\203\377IU\204\3774Cw\377\27(d\377\30)d\377\206\31*e\377\5\30)d\377" \
+  "\33,f\377AP\200\377IV\205\377HU\204\377\203IV\205\377\202JW\206\377\1" \
+  "IV\205\377\207JW\206\377\2IV\206\377JW\206\377\202KX\206\377\1JW\206" \
+  "\377\210KX\206\377\1JW\205\377\202KX\206\377\2LY\207\377KX\206\377\216" \
+  "LY\207\377\203LX\207\377\205LY\207\377\214LZ\207\377\205LY\207\377\204" \
+  "LX\207\377\215LY\207\377\1KX\206\377\202LY\207\377\1KX\206\377\202JW" \
+  "\205\377\210KX\206\377\1JW\206\377\202KX\206\377\2JW\206\377IV\206\377" \
+  "\207JW\206\377\6IV\205\377JW\206\377IV\205\377HU\204\377IV\205\377HU" \
+  "\204\377\202IV\205\377\2-<r\377\27(c\377\207\31*e\377\3\30)d\377\37""0" \
+  "i\377BO\200\377\202HU\204\377\2GU\204\377FU\204\377\205GU\204\377\4F" \
+  "T\203\377GU\204\377FT\203\377ES\202\377\205FT\203\377\4ES\203\377FT\203" \
+  "\377ES\203\377DR\203\377\207ES\203\377\2DR\202\377CQ\201\377\204DR\202" \
+  "\377\4CQ\201\377DR\202\377.=r\377\27(c\377\213\31*e\377\1/>t\377\203" \
+  "BP\201\377\2BP\200\377BP\177\377\207BP\200\377\2AO\200\377@N\200\377" \
+  "\204AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\206@N\177\377" \
+  "\202\77M~\377\3""9Hz\377\33,f\377\30)d\377\214\31*e\377\3\30)d\377/=" \
+  "s\377>L}\377\204=K}\377\210<K}\377\210;J|\377\205:I{\377\1""8Gz\377\202" \
+  "\30)d\377\217\31*e\377\2\30)d\377#3l\377\2078Fz\377\2067Fy\377\2""6E" \
+  "x\3777Fy\377\2066Ex\377\3""2Au\377\36.h\377\30)d\377\223\31*e\377\5\30" \
+  ")d\377\35-g\3774Cx\3772Av\3771@u\377\2042Av\377\4""1Au\3772Av\3771Au" \
+  "\3770At\377\2061Au\377\3""0@u\377+;q\377\30)d\377\230\31*e\377\5\30)" \
+  "d\377\31*d\377+:q\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<" \
+  "r\377\3(8o\377\32+f\377\30)d\377\232\31*e\377\2\30)d\377\34-g\377\203" \
+  "(8o\377\2'7o\377&6o\377\205'7o\377\1!1j\377\236\31*e\377\207GU\204\377" \
+  "\7FU\204\377GU\204\377HT\203\377HU\204\377\77M~\377\27)c\377\30)d\377" \
+  "\206\31*e\377\12\30)d\377\32+f\377;I|\377IV\205\377HU\204\377IV\205\377" \
+  "HU\204\377IV\205\377JW\206\377IV\205\377\207JW\206\377\202IV\206\377" \
+  "\202JW\206\377\210KX\206\377\202JW\205\377\1KX\206\377\202LY\207\377" \
+  "\1KX\206\377\213LY\207\377\202LX\207\377\204LY\207\377\203LZ\207\377" \
+  "\1LY\207\377\223LZ\207\377\1LY\207\377\203LZ\207\377\204LY\207\377\202" \
+  "LX\207\377\215LY\207\377\202KX\206\377\1JW\205\377\210KX\206\377\4JW" \
+  "\206\377KX\206\377JW\206\377IV\206\377\207JW\206\377\4IV\205\377JW\206" \
+  "\377IV\205\377HU\204\377\202IV\205\377\3HU\204\377JW\206\377'7o\377\202" \
+  "\30)d\377\206\31*e\377\7\27(c\377)9p\377FT\203\377HU\204\377HT\203\377" \
+  "GU\204\377FU\204\377\205GU\204\377\4FT\203\377GU\204\377FT\203\377ES" \
+  "\202\377\207FT\203\377\2ES\203\377DR\203\377\206ES\203\377\1DR\202\377" \
+  "\202CQ\201\377\204DR\202\377\4CQ\201\377\77M~\377\33,f\377\30)d\377\211" \
+  "\31*e\377\10\30)d\377#3k\377>M~\377BP\201\377BP\200\377BP\201\377BP\200" \
+  "\377BP\177\377\206BP\200\377\210AO\200\377\207@N\177\377\5\77M~\377@" \
+  "N\177\377\77M~\377=K|\377$5m\377\202\30)d\377\213\31*e\377\3\30)d\377" \
+  "\"3k\377>L~\377\205=K}\377\210<K}\377\206;J|\377\3:I{\377;J|\3779Hz\377" \
+  "\202:I{\377\4""9H{\3779Hz\377\40""1j\377\30)d\377\217\31*e\377\3\30)" \
+  "d\377\32+f\3777Fy\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2066Ex" \
+  "\377\3""4Cw\377\"2k\377\30)d\377\225\31*e\377\2022Av\377\1""1@u\377\206" \
+  "2Av\377\2""1Au\3770At\377\2061Au\377\2""0@u\377/\77t\377\202\30)d\377" \
+  "\230\31*e\377\5\27(d\377(8o\377.=s\377-<r\377,;q\377\205-<r\377\1,<r" \
+  "\377\202+<r\377\202,<r\377\3)9p\377\34-g\377\30)d\377\232\31*e\377\4" \
+  "\30)d\377\31*e\377(8o\377'7n\377\202(8o\377\1&6o\377\205'7o\377\1#3l" \
+  "\377\236\31*e\377\206GU\204\377\7FU\204\377GU\204\377HT\203\377HU\204" \
+  "\377DQ\201\377\36/h\377\30)d\377\207\31*e\377\2\31*d\3772Av\377\203I" \
+  "V\205\377\4HU\204\377IV\205\377JW\206\377IV\205\377\207JW\206\377\1I" \
+  "V\206\377\202JW\206\377\211KX\206\377\1JW\205\377\202KX\206\377\2LY\207" \
+  "\377KX\206\377\213LY\207\377\202LX\207\377\202LY\207\377\236LZ\207\377" \
+  "\1LY\207\377\203LZ\207\377\203LY\207\377\202LX\207\377\212LY\207\377" \
+  "\1KX\206\377\202LY\207\377\2KX\206\377JW\205\377\210KX\206\377\4JW\206" \
+  "\377KX\206\377JW\206\377IV\206\377\207JW\206\377\4IV\205\377JW\206\377" \
+  "IV\205\377HU\204\377\202IV\205\377\3HU\204\377FS\203\377#3l\377\202\30" \
+  ")d\377\206\31*e\377\6\26'c\3774Bw\377IV\205\377GT\203\377GU\204\377F" \
+  "U\204\377\206GU\204\377\3FT\203\377GU\204\377ES\202\377\206FT\203\377" \
+  "\202ES\203\377\1DR\203\377\207ES\203\377\2DR\202\377CQ\201\377\205DR" \
+  "\202\377\2CQ\201\377+:q\377\202\30)d\377\210\31*e\377\4\30)d\377\31)" \
+  "e\3777Fy\377AO\200\377\202BP\201\377\207BP\200\377\2AO\200\377BP\200" \
+  "\377\206AO\200\377\3@N\177\377AO\200\377\77M~\377\207@N\177\377\5>L}" \
+  "\377\77M~\377.>s\377\31*e\377\30)d\377\214\31*e\377\2\35.g\3779Gz\377" \
+  "\205=K}\377\1;K}\377\207<K}\377\1:I{\377\207;J|\377\1""9Hz\377\203:I" \
+  "{\377\3""9Hz\377)9p\377\27(d\377\220\31*e\377\2\26(c\3772Av\377\2058" \
+  "Fz\377\3""7Fy\3778Fz\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377" \
+  "\2&6n\377\30)d\377\225\31*e\377\2,<r\3773Bw\377\2072Av\377\2""1Au\377" \
+  "0At\377\2061Au\377\4""0@t\3771Av\377\34,f\377\30)d\377\230\31*e\377\5" \
+  "\27)d\377%4m\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\202" \
+  ",<r\377\3*;q\377\36/h\377\30)d\377\233\31*e\377\2\30)d\377'7n\377\203" \
+  "(8o\377\1&6o\377\205'7o\377\2%5m\377\32+e\377\235\31*e\377\205GU\204" \
+  "\377\2FU\204\377GU\204\377\202HU\204\377\3GT\203\377*:p\377\30)d\377" \
+  "\207\31*e\377\2\27(c\377,;q\377\202IV\205\377\4HU\204\377IV\205\377H" \
+  "U\204\377IV\205\377\211JW\206\377\4IV\206\377JW\206\377KX\206\377JW\206" \
+  "\377\207KX\206\377\202JW\205\377\1KX\206\377\214LY\207\377\202LX\207" \
+  "\377\203LY\207\377\2LZ\207\377LY\207\377\240LZ\207\377\1LY\207\377\202" \
+  "LZ\207\377\203LY\207\377\1LX\207\377\213LY\207\377\3KX\206\377LY\207" \
+  "\377KX\206\377\202JW\205\377\207KX\206\377\4JW\206\377KX\206\377JW\206" \
+  "\377IV\206\377\207JW\206\377\12IV\205\377JW\206\377IV\205\377HU\204\377" \
+  "IV\205\377HU\204\377IV\205\377@N\177\377\35.h\377\30)d\377\206\31*e\377" \
+  "\7\30)d\377\32*e\377=J}\377IV\204\377HT\203\377GU\204\377FU\204\377\207" \
+  "GU\204\377\2FT\203\377ES\202\377\206FT\203\377\202ES\203\377\1DR\203" \
+  "\377\206ES\203\377\202DR\202\377\1CQ\201\377\205DR\202\377\3""9H{\377" \
+  "\34,g\377\30)d\377\211\31*e\377\2\27(c\377'8o\377\202AO\200\377\2BP\200" \
+  "\377BP\201\377\210BP\200\377\1@N\200\377\207AO\200\377\2@N\177\377\77" \
+  "M~\377\206@N\177\377\202\77M~\377\3""7Ey\377\34-g\377\30)d\377\214\31" \
+  "*e\377\4\32+f\3771@u\377=K}\377<J|\377\203=K}\377\2<K}\377;K}\377\206" \
+  "<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377\202:I{\377\4""9Hz" \
+  "\3771Au\377\27(d\377\30)d\377\217\31*e\377\3\27(d\377)8p\3779Fz\377\206" \
+  "8Fz\377\1""6Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2036Ex\377\4""5" \
+  "Dw\3776Ex\377+;q\377\32*e\377\225\31*e\377\2'7o\3774Bw\377\2072Av\377" \
+  "\2101Au\377\2020@u\377\2\"2j\377\30)d\377\230\31*e\377\5\30)d\377\40" \
+  "1j\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\2\37" \
+  "0j\377\30)d\377\233\31*e\377\2\30)d\377$5l\377\203(8o\377\1&6o\377\205" \
+  "'7o\377\2&6n\377\32+f\377\235\31*e\377\205GU\204\377\2FU\204\377GU\204" \
+  "\377\202HU\204\377\3""9Gz\377\31*e\377\30)d\377\206\31*e\377\2\27(d\377" \
+  "#3k\377\202IV\205\377\4HU\204\377IV\205\377HU\204\377IV\205\377\211J" \
+  "W\206\377\4IV\206\377JW\206\377KX\206\377JW\206\377\207KX\206\377\1J" \
+  "W\205\377\202KX\206\377\2LY\207\377KX\206\377\211LY\207\377\202LX\207" \
+  "\377\202LY\207\377\203LZ\207\377\1LY\207\377\246LZ\207\377\202LY\207" \
+  "\377\202LX\207\377\213LY\207\377\202KX\206\377\1JW\205\377\212KX\206" \
+  "\377\2JW\206\377IV\206\377\207JW\206\377\202IV\205\377\1HU\204\377\204" \
+  "IV\205\377\2""9H{\377\30)d\377\207\31*e\377\6\30)d\377!1i\377FS\202\377" \
+  "HU\204\377HT\203\377FU\204\377\206GU\204\377\4FT\203\377GU\204\377FT" \
+  "\203\377ES\202\377\206FT\203\377\2ES\203\377DR\203\377\205ES\203\377" \
+  "\4DR\202\377ES\203\377DR\202\377CQ\201\377\206DR\202\377\1$4l\377\212" \
+  "\31*e\377\202\30)d\377\1\77N\177\377\203BP\201\377\1BP\177\377\207BP" \
+  "\200\377\2AO\200\377@N\200\377\205AO\200\377\3@N\177\377AO\200\377\77" \
+  "M~\377\205@N\177\377\5\77M~\377@N\177\377>L}\377\77M~\377\40""1j\377" \
+  "\215\31*e\377\2\30)d\377)9p\377\204=K}\377\3<K}\377=K}\377;K}\377\205" \
+  "<K}\377\3;J|\377<K}\377:I{\377\205;J|\377\3:I{\377;J|\3779Hz\377\203" \
+  ":I{\377\3""5Dx\377\34-g\377\30)d\377\217\31*e\377\4\30)d\377\40""0i\377" \
+  "9G{\3777Ey\377\2058Fz\377\1""6Fx\377\2077Fy\377\1""5Dw\377\2056Ex\377" \
+  "\2""0\77t\377\33,f\377\225\31*e\377\2\"2k\3774Cw\377\2062Av\377\2""1" \
+  "Au\3772Av\377\2101Au\377\3""0@u\377&6n\377\27)d\377\230\31*e\377\5\30" \
+  ")d\377\34-h\377.=s\377-<r\377,;q\377\206-<r\377\7,<r\377+<r\377,<r\377" \
+  ",<q\377,<r\377\"2k\377\30*e\377\233\31*e\377\2\30)d\377!2j\377\203(8" \
+  "o\377\1&6o\377\206'7o\377\2\33,f\377\30)e\377\234\31*e\377\204GU\204" \
+  "\377\7FU\204\377GU\204\377HT\203\377HU\204\377DQ\201\377\40""1j\377\30" \
+  ")d\377\206\31*e\377\3\30)d\377\34-g\377DR\202\377\203IV\205\377\4HU\204" \
+  "\377IV\205\377JW\206\377IV\205\377\206JW\206\377\202IV\206\377\202JW" \
+  "\206\377\207KX\206\377\202JW\205\377\1KX\206\377\212LY\207\377\202LX" \
+  "\207\377\202LY\207\377\202LZ\207\377\1LY\207\377\253LZ\207\377\2LY\207" \
+  "\377LZ\207\377\202LY\207\377\202LX\207\377\211LY\207\377\3KX\206\377" \
+  "LY\207\377KX\206\377\202JW\205\377\206KX\206\377\4JW\206\377KX\206\377" \
+  "JW\206\377IV\206\377\210JW\206\377\1IV\205\377\202HU\204\377\4IV\205" \
+  "\377HU\204\377KX\206\377.=s\377\202\30)d\377\207\31*e\377\1/>s\377\202" \
+  "HU\204\377\1GU\204\377\202FU\204\377\206GU\204\377\1FT\203\377\202ES" \
+  "\202\377\204FT\203\377\2ES\203\377FT\203\377\207ES\203\377\2DR\202\377" \
+  "ES\203\377\205DR\202\377\5CQ\201\377ES\202\3775Ex\377\31*e\377\31)d\377" \
+  "\211\31*e\377\7\27(c\377-=s\377CQ\201\377AO\200\377BP\200\377BP\201\377" \
+  "BP\177\377\207BP\200\377\1@N\200\377\207AO\200\377\2@N\177\377\77M~\377" \
+  "\206@N\177\377\3\77M~\377@N\177\377+;q\377\215\31*e\377\3\30)d\377\"" \
+  "2k\377:H{\377\205=K}\377\2<K}\377;K}\377\206<K}\377\1:I{\377\206;J|\377" \
+  "\2:I{\3779Hz\377\203:I{\377\3""8Gy\377\"3k\377\30)d\377\217\31*e\377" \
+  "\2\30)d\377\31*e\377\2078Fz\377\2""7Fy\3776Fx\377\2067Fy\377\1""5Dw\377" \
+  "\2056Ex\377\3""4Cw\377\35-g\377\30)e\377\223\31*e\377\3\30)d\377\36/" \
+  "h\3773Bw\377\2102Av\377\2101Au\377\3""0@u\377+;r\377\27(d\377\230\31" \
+  "*e\377\2\30)d\377\31)d\377\202.=s\377\2-<r\377,;q\377\205-<r\377\2,<" \
+  "r\377+<r\377\203,<r\377\1$5m\377\234\31*e\377\2\30)d\377\37""0i\377\202" \
+  "(8o\377\202'7o\377\1&6o\377\205'7o\377\2\34-h\377\30)d\377\234\31*e\377" \
+  "\204GU\204\377\6FU\204\377GU\204\377HT\203\377IV\205\377-<r\377\26'c" \
+  "\377\206\31*e\377\12\30)d\377\32+e\3779Gz\377IV\205\377HU\204\377IV\205" \
+  "\377HU\204\377IV\205\377JW\206\377IV\205\377\206JW\206\377\1IV\206\377" \
+  "\202JW\206\377\210KX\206\377\202JW\205\377\3KX\206\377LY\207\377KX\206" \
+  "\377\210LY\207\377\1LX\207\377\202LY\207\377\202LZ\207\377\1LY\207\377" \
+  "\217LZ\207\377\220KZ\206\377\217LZ\207\377\1LY\207\377\202LZ\207\377" \
+  "\202LY\207\377\202LX\207\377\210LY\207\377\204KX\206\377\1JW\205\377" \
+  "\206KX\206\377\4JW\206\377KX\206\377JW\206\377IV\206\377\206JW\206\377" \
+  "\4IV\205\377JW\206\377IV\205\377HU\204\377\202IV\205\377\4HU\204\377" \
+  "JW\205\377&5n\377\27(c\377\206\31*e\377\7\30)d\377\34-g\377>L}\377GT" \
+  "\203\377HU\204\377GU\204\377FU\204\377\205GU\204\377\4FT\203\377GU\204" \
+  "\377FT\203\377ES\202\377\205FT\203\377\3ES\203\377FT\203\377DR\203\377" \
+  "\207ES\203\377\2DR\202\377CQ\201\377\205DR\202\377\3ES\202\377\36/i\377" \
+  "\30)d\377\211\31*e\377\2\30)d\377\33-g\377\204BP\201\377\2BP\200\377" \
+  "BP\177\377\206BP\200\377\2AO\200\377@N\200\377\205AO\200\377\202@N\177" \
+  "\377\1\77M~\377\205@N\177\377\203\77M~\377\2""8Gz\377\30)d\377\214\31" \
+  "*e\377\3\30)d\377\33+f\3777Fy\377\204=K}\377\202<K}\377\1;K}\377\206" \
+  "<K}\377\2;J|\377:I{\377\205;J|\377\202:I{\377\1""9Hz\377\203:I{\377\2" \
+  "(8o\377\30)d\377\221\31*e\377\1""1@u\377\2058Fz\377\3""7Fy\3778Fz\377" \
+  "6Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2036Ex\377\4""6Ew\3777Fy\377\40" \
+  "0i\377\30)d\377\223\31*e\377\5\30)d\377\34-g\3770\77t\3772Av\3771@u\377" \
+  "\2062Av\377\2101Au\377\2""0@t\377/\77t\377\202\30)d\377\230\31*e\377" \
+  "\5\27(d\377+:q\377.=s\377-<r\377,;q\377\205-<r\377\2,<r\377+<r\377\203" \
+  ",<r\377\2&7n\377\32+e\377\233\31*e\377\2\30)d\377\34-g\377\203(8o\377" \
+  "\2'7o\377&6o\377\205'7o\377\2\37""0i\377\30)d\377\234\31*e\377\203GU" \
+  "\204\377\5FU\204\377GU\204\377HT\203\377IV\204\377;I{\377\202\30)d\377" \
+  "\207\31*e\377\2,;q\377HU\204\377\202IV\205\377\4HU\204\377IV\205\377" \
+  "JW\206\377IV\205\377\207JW\206\377\4IV\206\377JW\206\377KX\206\377JW" \
+  "\206\377\206KX\206\377\1JW\205\377\202KX\206\377\2LY\207\377KX\206\377" \
+  "\210LY\207\377\1LX\207\377\202LY\207\377\217LZ\207\377\204KZ\206\377" \
+  "\220LZ\207\377\204KZ\206\377\215LZ\207\377\2LY\207\377LZ\207\377\203" \
+  "LY\207\377\1LX\207\377\212LY\207\377\2KX\206\377JW\205\377\207KX\206" \
+  "\377\4JW\206\377KX\206\377JW\206\377IV\206\377\206JW\206\377\12IV\205" \
+  "\377JW\206\377IV\205\377HU\204\377IV\205\377HU\204\377IV\205\377BP\200" \
+  "\377\37/i\377\30)d\377\206\31*e\377\4\27(d\377&6m\377HU\204\377GT\203" \
+  "\377\202GU\204\377\1FU\204\377\206GU\204\377\211FT\203\377\2ES\203\377" \
+  "DR\203\377\205ES\203\377\3DR\202\377ES\203\377CQ\201\377\204DR\202\377" \
+  "\4CQ\201\377ES\202\3773Bw\377\26'c\377\212\31*e\377\4\30)d\3774Cx\377" \
+  "CQ\201\377AO\200\377\202BP\200\377\1BP\177\377\205BP\200\377\202AO\200" \
+  "\377\1@N\200\377\206AO\200\377\2@N\177\377\77M~\377\206@N\177\377\5\77" \
+  "M~\377>L}\377@N\177\377\35.g\377\30)d\377\213\31*e\377\4\30)d\377\27" \
+  "(c\3771@t\377<J|\377\204=K}\377\2<K}\377;K}\377\206<K}\377\2;J|\377:" \
+  "I{\377\206;J|\377\6:I{\3779Hz\377:I{\3779Hz\377:I{\377-=r\377\222\31" \
+  "*e\377\2*9p\3779Gz\377\2058Fz\377\2""7Fy\3776Fx\377\2057Fy\377\3""6E" \
+  "x\3777Fy\3775Dw\377\2036Ex\377\4""5Dx\3777Fx\377%5m\377\30)d\377\223" \
+  "\31*e\377\5\30)d\377\33,f\377-<r\3773Bw\3771@u\377\2062Av\377\2""1Au" \
+  "\3770At\377\2061Au\377\4""0@u\377/\77t\377\34-g\377\30)d\377\230\31*" \
+  "e\377\5\30)d\377'7o\377.=s\377-<r\377,;q\377\205-<r\377\202,<r\377\1" \
+  "+<r\377\202,<r\377\2)9p\377\32+f\377\233\31*e\377\7\30)d\377\32+e\377" \
+  ")9o\377'7n\377(8o\377'7o\377&6o\377\205'7o\377\2!2k\377\30)d\377\234" \
+  "\31*e\377\203GU\204\377\1FU\204\377\202HU\204\377\3GT\203\377\36/i\377" \
+  "\30)d\377\206\31*e\377\10\30)d\377\35.h\377FS\203\377IV\205\377HU\204" \
+  "\377IV\205\377HU\204\377IV\205\377\210JW\206\377\4IV\206\377JW\206\377" \
+  "KX\206\377JW\206\377\206KX\206\377\2JW\205\377KX\206\377\202LY\207\377" \
+  "\1KX\206\377\207LY\207\377\202LX\207\377\1LY\207\377\202LZ\207\377\1" \
+  "LY\207\377\214LZ\207\377\202KZ\206\377\205LZ\207\377\216MZ\210\377\205" \
+  "LZ\207\377\203KZ\206\377\217LZ\207\377\202LX\207\377\210LY\207\377\4" \
+  "KX\206\377LY\207\377KX\206\377JW\205\377\211KX\206\377\2JW\206\377IV" \
+  "\206\377\206JW\206\377\3IV\205\377JW\206\377HU\204\377\202IV\205\377" \
+  "\5HU\204\377IV\205\3777Ey\377\31*e\377\30)d\377\205\31*e\377\7\30)d\377" \
+  "\27(c\3777Fx\377IU\204\377HT\203\377GU\204\377FU\204\377\205GU\204\377" \
+  "\3FT\203\377GU\204\377ES\202\377\206FT\203\377\3ES\203\377FT\203\377" \
+  "DR\203\377\207ES\203\377\2DR\202\377CQ\201\377\205DR\202\377\3CQ\201" \
+  "\377\33,f\377\30)d\377\211\31*e\377\3\30)d\377#4l\377DQ\202\377\202B" \
+  "P\201\377\2BP\200\377BP\177\377\206BP\200\377\2AO\200\377@N\200\377\207" \
+  "AO\200\377\2@N\177\377\77M~\377\206@N\177\377\4\77M~\377@N~\377*:q\377" \
+  "\27(d\377\214\31*e\377\3\27(d\377'6n\377<J|\377\204=K}\377\2<K}\377;" \
+  "K}\377\206<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377\203:I{\377" \
+  "\2""3Bv\377\34,g\377\221\31*e\377\3\"3k\3779G{\3777Ey\377\2048Fz\377" \
+  "\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\2,<q\377\30" \
+  ")d\377\223\31*e\377\5\30)d\377\31*e\377*9q\3773Bw\3771@u\377\2052Av\377" \
+  "\3""1Au\3772Av\3770At\377\2061Au\377\4""0@u\377/\77t\377\40""1j\377\30" \
+  ")d\377\230\31*e\377\5\30)d\377#3l\377.=s\377-<r\377,;q\377\204-<r\377" \
+  "\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\2+;r\377\33,f\377\235\31*e" \
+  "\377\1'7n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\2#3l\377\30)d\377" \
+  "\234\31*e\377\202GU\204\377\5FU\204\377GU\204\377HU\204\377IV\204\377" \
+  "0\77t\377\207\31*e\377\202\30)d\377\3<K|\377JW\205\377HU\204\377\203" \
+  "IV\205\377\2JW\206\377IV\205\377\205JW\206\377\202IV\206\377\202JW\206" \
+  "\377\207KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377\210LY\207" \
+  "\377\2LX\207\377LY\207\377\214LZ\207\377\202KZ\206\377\204LZ\207\377" \
+  "\202MZ\210\377\1LZ\207\377\231MZ\210\377\202LZ\207\377\202KZ\206\377" \
+  "\212LZ\207\377\3LY\207\377LZ\207\377LY\207\377\203LX\207\377\207LY\207" \
+  "\377\202KX\206\377\202JW\205\377\206KX\206\377\4JW\206\377KX\206\377" \
+  "JW\206\377IV\206\377\206JW\206\377\202IV\205\377\202HU\204\377\202IV" \
+  "\205\377\3HV\204\377'7n\377\31*d\377\206\31*e\377\7\30)d\377\32+f\377" \
+  "FS\202\377HU\204\377HT\203\377GU\204\377FU\204\377\205GU\204\377\3FT" \
+  "\203\377GU\204\377ES\202\377\207FT\203\377\2ES\203\377DR\203\377\206" \
+  "ES\203\377\2DR\202\377CQ\201\377\206DR\202\377\3-=r\377\27(c\377\31*" \
+  "d\377\211\31*e\377\7\35-g\377;J|\377BP\201\377AO\200\377BP\201\377BP" \
+  "\200\377BP\177\377\206BP\200\377\2AO\200\377@N\200\377\206AO\200\377" \
+  "\2@N\177\377\77M~\377\206@N\177\377\202\77M~\377\3""8Gy\377\27(c\377" \
+  "\30)d\377\213\31*e\377\3\30)d\377\34,g\377<J|\377\205=K}\377\2<K}\377" \
+  ";K}\377\205<K}\377\1;J|\377\202:I{\377\205;J|\377\1:I{\377\2029Hz\377" \
+  "\202:I{\377\3""8Gy\377\36.h\377\30)d\377\217\31*e\377\3\30)d\377\36/" \
+  "h\3777Ey\377\2058Fz\377\1""7Fy\377\2026Fx\377\2057Fy\377\2""6Ex\3775" \
+  "Dw\377\2056Ex\377\2""2Bv\377\30)d\377\223\31*e\377\202\30)d\377\3'7o" \
+  "\3773Bw\3771@u\377\2072Av\377\1""0At\377\2051Au\377\5""0@u\3771Au\377" \
+  "/\77t\377$4m\377\30)d\377\230\31*e\377\5\30)d\377\40""0j\377/>s\377-" \
+  "<r\377,;q\377\206-<r\377\7,<r\377+<r\377,<r\377+;q\377-=r\377\34-g\377" \
+  "\30)d\377\234\31*e\377\1%5m\377\202(8o\377\2'7o\377&6o\377\205'7o\377" \
+  "\2&6m\377\30)d\377\234\31*e\377\2GU\204\377FU\204\377\202GU\204\377\4" \
+  "HU\204\377AN\177\377\37/i\377\30)d\377\206\31*e\377\4\26(c\377.=s\377" \
+  "KX\206\377HU\204\377\203IV\205\377\2JW\206\377IV\205\377\205JW\206\377" \
+  "\1IV\206\377\202JW\206\377\210KX\206\377\4JW\205\377KX\206\377LY\207" \
+  "\377KX\206\377\207LY\207\377\202LX\207\377\3LY\207\377LZ\207\377LY\207" \
+  "\377\211LZ\207\377\202KZ\206\377\203LZ\207\377\236MZ\210\377\2LZ\207" \
+  "\377MZ\210\377\203LZ\207\377\202KZ\206\377\213LZ\207\377\202LY\207\377" \
+  "\1LX\207\377\211LY\207\377\202KX\206\377\1JW\205\377\206KX\206\377\4" \
+  "JW\206\377KX\206\377JW\206\377IV\206\377\207JW\206\377\202IV\205\377" \
+  "\202HU\204\377\4IV\205\377BO\200\377\34,g\377\30)d\377\206\31*e\377\3" \
+  "\30)d\377+:q\377IV\205\377\202HU\204\377\1FU\204\377\207GU\204\377\2" \
+  "FT\203\377ES\202\377\205FT\203\377\202ES\203\377\1DR\203\377\206ES\203" \
+  "\377\202DR\202\377\1CQ\201\377\205DR\202\377\3<K}\377\31*e\377\30)d\377" \
+  "\212\31*e\377\6""0\77u\377BP\201\377BP\200\377BP\201\377BP\200\377BP" \
+  "\177\377\206BP\200\377\2AO\200\377@N\200\377\206AO\200\377\2@N\177\377" \
+  "\77M~\377\206@N\177\377\5\77M~\377>L}\377\77M~\377\34-f\377\30)d\377" \
+  "\213\31*e\377\3\30)d\377\26(c\3777Fz\377\205=K}\377\2<K}\377;K}\377\206" \
+  "<K}\377\2;J|\377:I{\377\204;J|\377\11:I{\377;J|\377:I{\3779Hz\377:I{" \
+  "\377:Iz\377;J|\377\"2k\377\30)d\377\217\31*e\377\3\30)d\377\34-g\377" \
+  "3Aw\377\2068Fz\377\2""7Fy\3776Fx\377\2057Fy\377\2026Ex\377\1""5Dw\377" \
+  "\2046Ex\377\3""7Fx\377\31*e\377\30)d\377\223\31*e\377\2\30)d\377#4l\377" \
+  "\2022Av\377\1""1@u\377\2062Av\377\1""0At\377\2071Au\377\3/\77t\377'8" \
+  "o\377\27(d\377\230\31*e\377\3\30)d\377\33,g\377/>s\377\210-<r\377\2," \
+  "<r\377+<r\377\202,<r\377\3-<r\377\37/i\377\30)d\377\234\31*e\377\1#4" \
+  "l\377\202(8o\377\2'7o\377&6o\377\206'7o\377\2\30)d\377\30)e\377\233\31" \
+  "*e\377\10GU\204\377FU\204\377GU\204\377HT\203\377GT\203\3770>t\377\27" \
+  ")d\377\30)d\377\205\31*e\377\3\27)d\377!2j\377FS\203\377\203IV\205\377" \
+  "\2HU\204\377IV\205\377\207JW\206\377\4IV\206\377JW\206\377KX\206\377" \
+  "JW\206\377\206KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377\207" \
+  "LY\207\377\1LX\207\377\202LY\207\377\2LZ\207\377LY\207\377\211LZ\207" \
+  "\377\1KZ\206\377\203LZ\207\377\202MZ\210\377\1LZ\207\377\236MZ\210\377" \
+  "\1LZ\207\377\203MZ\210\377\202LZ\207\377\202KZ\206\377\210LZ\207\377" \
+  "\1LY\207\377\202LZ\207\377\2LY\207\377LX\207\377\207LY\207\377\4KX\206" \
+  "\377LY\207\377KX\206\377JW\205\377\207KX\206\377\4JW\206\377KX\206\377" \
+  "JW\206\377IV\206\377\205JW\206\377\11IV\205\377JW\206\377IV\205\377H" \
+  "U\204\377IV\205\377HU\204\377KX\206\3777Dy\377\26'c\377\207\31*e\377" \
+  "\6\34,g\377>K}\377HU\204\377HT\203\377GU\204\377FU\204\377\205GU\204" \
+  "\377\202FT\203\377\1ES\202\377\206FT\203\377\202ES\203\377\1DR\203\377" \
+  "\206ES\203\377\2DR\202\377CQ\201\377\204DR\202\377\4CQ\201\377AO\200" \
+  "\377%5m\377\30)d\377\211\31*e\377\3\30)d\377&6n\377@N\200\377\202BP\201" \
+  "\377\202BP\200\377\1BP\177\377\205BP\200\377\202AO\200\377\1@N\200\377" \
+  "\205AO\200\377\202@N\177\377\1\77M~\377\205@N\177\377\203\77M~\377\2" \
+  "(7o\377\27(d\377\214\31*e\377\3\27(d\377,<r\377>L}\377\204=K}\377\2<" \
+  "K}\377;K}\377\206<K}\377\2;J|\377:I{\377\206;J|\377\7:I{\3779Hz\377:" \
+  "I{\3779H{\377;J{\377*9p\377\30)d\377\217\31*e\377\3\30)d\377\32+f\377" \
+  "/>s\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\203" \
+  "6Ex\377\4""5Dw\3777Fx\377\37""0i\377\30)d\377\223\31*e\377\5\30)d\377" \
+  "\40""1i\3771@u\3773Bw\3771@u\377\2062Av\377\1""0At\377\2071Au\377\2/" \
+  "\77u\377*:q\377\202\30)d\377\227\31*e\377\2\30)d\377\31*e\377\202.=s" \
+  "\377\207-<r\377\2,<r\377+<r\377\203,<r\377\2\"2k\377\30)d\377\234\31" \
+  "*e\377\1!2j\377\202(8o\377\202'7o\377\1&6o\377\203'7o\377\4&6n\377'7" \
+  "o\377\32+e\377\30)d\377\233\31*e\377\2FU\204\377GU\204\377\202HU\204" \
+  "\377\3CP\201\377\32+e\377\30)d\377\205\31*e\377\12\30)d\377\31*e\377" \
+  "9H{\377IV\205\377HU\204\377IV\205\377HU\204\377IV\205\377JW\206\377I" \
+  "V\205\377\207JW\206\377\210KX\206\377\4JW\205\377KX\206\377LY\207\377" \
+  "KX\206\377\207LY\207\377\2LX\207\377LY\207\377\202LZ\207\377\1LY\207" \
+  "\377\210LZ\207\377\202KZ\206\377\202LZ\207\377\202MZ\210\377\1LZ\207" \
+  "\377\243MZ\210\377\2LZ\207\377MZ\210\377\202LZ\207\377\202KZ\206\377" \
+  "\211LZ\207\377\4LY\207\377LZ\207\377LY\207\377LX\207\377\207LY\207\377" \
+  "\4KX\206\377LY\207\377KX\206\377JW\205\377\210KX\206\377\2JW\206\377" \
+  "IV\206\377\210JW\206\377\1HU\204\377\204IV\205\377\2&6n\377\27(d\377" \
+  "\206\31*e\377\6\30)d\377*9p\377GT\203\377HU\204\377GU\204\377FU\204\377" \
+  "\207GU\204\377\2FT\203\377ES\202\377\206FT\203\377\2ES\203\377DR\203" \
+  "\377\207ES\203\377\2DR\202\377CQ\201\377\205DR\202\377\1""1@u\377\202" \
+  "\30)d\377\210\31*e\377\10\30)d\377\35.h\377<J|\377BP\201\377BP\200\377" \
+  "BP\201\377BP\200\377BP\177\377\204BP\200\377\4AO\200\377BP\200\377AO" \
+  "\200\377@N\200\377\204AO\200\377\4@N\177\377AO\200\377@N\177\377\77M" \
+  "~\377\204@N\177\377\2\77M~\377@N\177\377\202\77M~\377\2""3Bv\377\26'" \
+  "c\377\214\31*e\377\4\30)d\377!1j\377>L~\377<J|\377\204=K}\377\2<K}\377" \
+  ";K}\377\205<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377\203:I{" \
+  "\377\2""1Au\377\30)d\377\217\31*e\377\3\30)d\377\31*e\377+:q\377\206" \
+  "8Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2046Ex\377\3""7" \
+  "Ex\377%6m\377\30)d\377\223\31*e\377\5\30)d\377\35.g\3770\77u\3772Av\377" \
+  "1@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\4/\77u\377+<r\377\32" \
+  "+f\377\30)d\377\231\31*e\377\2+:q\377.=s\377\207-<r\377\2,<r\377+<r\377" \
+  "\203,<r\377\2%5m\377\30)d\377\234\31*e\377\1\40""0i\377\203(8o\377\2" \
+  "'7o\377&6o\377\205'7o\377\2\34-g\377\30)d\377\233\31*e\377\202GU\204" \
+  "\377\4HU\204\377IV\204\377+:q\377\27(c\377\206\31*e\377\3\30)d\377'7" \
+  "n\377GT\203\377\202IV\205\377\202HU\204\377\1IV\205\377\206JW\206\377" \
+  "\4IV\206\377JW\206\377KX\206\377JW\206\377\206KX\206\377\4JW\205\377" \
+  "KX\206\377LY\207\377KX\206\377\207LY\207\377\4LX\207\377LY\207\377LZ" \
+  "\207\377LY\207\377\210LZ\207\377\202KZ\206\377\1LZ\207\377\222MZ\210" \
+  "\377\212LY\207\377\220MZ\210\377\2LZ\207\377MZ\210\377\203LZ\207\377" \
+  "\1KZ\206\377\211LZ\207\377\1LY\207\377\202LX\207\377\207LY\207\377\202" \
+  "KX\206\377\202JW\205\377\205KX\206\377\2JW\206\377KX\206\377\210JW\206" \
+  "\377\3IV\205\377JW\206\377HU\204\377\203IV\205\377\3AN\177\377\31*e\377" \
+  "\30)d\377\205\31*e\377\3\30)d\377\33,f\377>K}\377\202HU\204\377\2GU\204" \
+  "\377FU\204\377\206GU\204\377\1FT\203\377\202ES\202\377\204FT\203\377" \
+  "\4ES\203\377FT\203\377ES\203\377DR\203\377\206ES\203\377\2DR\202\377" \
+  "CQ\201\377\205DR\202\377\3;I|\377\35.g\377\30)d\377\210\31*e\377\4\30" \
+  ")d\377\26(c\3776Dy\377AO\200\377\202BP\201\377\210BP\200\377\210AO\200" \
+  "\377\210@N\177\377\5\77M~\377>L}\3779Gz\377\33+f\377\30)d\377\213\31" \
+  "*e\377\2\30)d\377\31*e\377\206=K}\377\2<K}\377;K}\377\204<K}\377\2;J" \
+  "|\377<K}\377\207;J|\377\2:I{\3779Hz\377\203:I{\377\3""9Hz\377\31*e\377" \
+  "\30)d\377\217\31*e\377\3\30)d\377&6n\3777Ey\377\2058Fz\377\1""7Fy\377" \
+  "\2026Fx\377\2057Fy\377\2""6Ex\3775Dw\377\2056Ex\377\2,<r\377\27(d\377" \
+  "\223\31*e\377\5\30)d\377\32+f\377/>t\3772Av\3771@u\377\2062Av\377\2""1" \
+  "Au\3770At\377\2061Au\377\4/\77u\377-=s\377\34-g\377\30)d\377\231\31*" \
+  "e\377\2(8o\377.=s\377\206-<r\377\2,<r\377-<r\377\204,<r\377\2'8o\377" \
+  "\30)d\377\234\31*e\377\6\36/h\377(8o\377'7n\377(8o\377'7o\377&6o\377" \
+  "\205'7o\377\2\36.h\377\30)d\377\233\31*e\377\6GU\204\377HT\203\377HU" \
+  "\204\377AO\177\377\27(d\377\30)d\377\206\31*e\377\3\33+f\377=K}\377J" \
+  "W\205\377\202HU\204\377\202IV\205\377\207JW\206\377\1IV\206\377\202J" \
+  "W\206\377\207KX\206\377\2JW\205\377KX\206\377\210LY\207\377\4LX\207\377" \
+  "LY\207\377LZ\207\377LY\207\377\210LZ\207\377\1KZ\206\377\202LZ\207\377" \
+  "\2MZ\210\377LZ\207\377\215MZ\210\377\204LY\207\377\212MZ\210\377\205" \
+  "LY\207\377\217MZ\210\377\1LZ\207\377\202KZ\206\377\207LZ\207\377\4LY" \
+  "\207\377LZ\207\377LY\207\377LX\207\377\211LY\207\377\2KX\206\377JW\205" \
+  "\377\206KX\206\377\3JW\206\377KX\206\377IV\206\377\210JW\206\377\3IV" \
+  "\205\377HU\204\377IV\205\377\202HU\204\377\1.=s\377\202\30)d\377\205" \
+  "\31*e\377\2\27(c\377+:p\377\202GT\203\377\202GU\204\377\1FU\204\377\204" \
+  "GU\204\377\4FT\203\377GU\204\377FT\203\377ES\202\377\206FT\203\377\2" \
+  "ES\203\377DR\203\377\206ES\203\377\210DR\202\377\1#4l\377\212\31*e\377" \
+  "\2\27(d\377(8o\377\202AO\200\377\2BP\200\377BP\201\377\206BP\200\377" \
+  "\2AO\200\377BP\200\377\206AO\200\377\2@N\177\377AO\200\377\206@N\177" \
+  "\377\6\77M~\377@N\177\377\77M~\377<J|\377\"2k\377\30)d\377\214\31*e\377" \
+  "\2\30)d\3774Cw\377\205=K}\377\2<K}\377;K}\377\206<K}\377\206;J|\377\2" \
+  ":I{\377;J|\377\203:I{\377\4""9Hz\377<K|\377\35.h\377\30)d\377\217\31" \
+  "*e\377\3\30)d\377\"2k\3776Dx\377\2048Fz\377\4""7Fy\3778Fz\3777Fy\377" \
+  "6Fx\377\2057Fy\377\2026Ex\377\1""5Dw\377\2046Ex\377\3""2Bu\377\27(c\377" \
+  "\30)d\377\222\31*e\377\5\30)d\377\27(d\377-=s\3772Av\3771@u\377\2062" \
+  "Av\377\2""1Au\3770At\377\2061Au\377\4""0@u\377.>s\377\36/i\377\30)d\377" \
+  "\231\31*e\377\2%5m\377.=s\377\210-<r\377\204,<r\377\2+;q\377\30)d\377" \
+  "\233\31*e\377\2\30)d\377\35-g\377\203(8o\377\2'7o\377&6o\377\205'7o\377" \
+  "\2\40""0i\377\30)d\377\233\31*e\377\5GU\204\377HT\203\377JW\206\377&" \
+  "6m\377\30)d\377\206\31*e\377\3\30)d\377*9p\377JW\206\377\202IV\205\377" \
+  "\4HU\204\377IV\205\377JW\206\377IV\205\377\205JW\206\377\1IV\206\377" \
+  "\202JW\206\377\207KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377" \
+  "\206LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\207LZ\207\377" \
+  "\202KZ\206\377\1LZ\207\377\202MZ\210\377\1LZ\207\377\213MZ\210\377\203" \
+  "LY\207\377\205MZ\210\377\210N[\211\377\206MZ\210\377\202LY\207\377\214" \
+  "MZ\210\377\2LZ\207\377MZ\210\377\202LZ\207\377\1KZ\206\377\207LZ\207" \
+  "\377\4LY\207\377LZ\207\377LY\207\377LX\207\377\210LY\207\377\202KX\206" \
+  "\377\1JW\205\377\207KX\206\377\2JW\206\377IV\206\377\206JW\206\377\202" \
+  "IV\205\377\1HU\204\377\203IV\205\377\3@N\177\377\35.h\377\30)d\377\205" \
+  "\31*e\377\202\30)d\377\1AN\177\377\202HU\204\377\2GU\204\377FU\204\377" \
+  "\206GU\204\377\210FT\203\377\207ES\203\377\2DR\202\377ES\203\377\205" \
+  "DR\202\377\3CQ\201\377ES\203\3770\77u\377\212\31*e\377\4\30)d\377\32" \
+  "+f\377AO\200\377AO\201\377\202BP\201\377\1BP\177\377\207BP\200\377\1" \
+  "@N\200\377\207AO\200\377\210@N\177\377\4\77M~\377>L}\377(8o\377\30)d" \
+  "\377\214\31*e\377\3\30)d\377+:q\377>L}\377\204=K}\377\210<K}\377\210" \
+  ";J|\377\204:I{\377\3;J{\377&6n\377\30)d\377\217\31*e\377\3\30)d\377\36" \
+  "/h\3774Cw\377\2068Fz\377\2""7Fy\3776Fx\377\2047Fy\377\4""6Ex\3777Fy\377" \
+  "6Ex\3775Dw\377\2036Ex\377\2025Dw\377\2\31*e\377\30)d\377\223\31*e\377" \
+  "\4\27(d\377)9p\3773Bw\3771@u\377\2062Av\377\2""1Au\3770At\377\2051Au" \
+  "\377\5""0@u\3771Au\377/\77t\377\40""1j\377\30)d\377\231\31*e\377\2#3" \
+  "k\377.=s\377\210-<r\377\205,<r\377\2\30*e\377\30)d\377\232\31*e\377\3" \
+  "\30)d\377\34-g\377'7n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\2!2k" \
+  "\377\30)d\377\233\31*e\377\5HT\203\377HU\204\377>K}\377\33,f\377\30)" \
+  "d\377\205\31*e\377\202\30)d\377\3FS\203\377IV\205\377HU\204\377\202I" \
+  "V\205\377\207JW\206\377\2IV\206\377JW\206\377\210KX\206\377\4JW\205\377" \
+  "KX\206\377LY\207\377KX\206\377\206LY\207\377\2LX\207\377LY\207\377\215" \
+  "LZ\207\377\214MZ\210\377\202LY\207\377\204MZ\210\377\204N[\211\377\1" \
+  "MZ\210\377\206N[\211\377\1MZ\210\377\205N[\211\377\203MZ\210\377\203" \
+  "LY\207\377\212MZ\210\377\1LZ\207\377\202MZ\210\377\2LZ\207\377KZ\206" \
+  "\377\207LZ\207\377\4LY\207\377LZ\207\377LY\207\377LX\207\377\206LY\207" \
+  "\377\1KX\206\377\202LY\207\377\1JW\205\377\206KX\206\377\4JW\206\377" \
+  "KX\206\377JW\206\377IV\206\377\207JW\206\377\2IV\205\377HU\204\377\202" \
+  "IV\205\377\2JW\206\377-<r\377\207\31*e\377\5\27(d\377(8n\377JW\205\377" \
+  "GT\203\377HU\204\377\206GU\204\377\2FT\203\377GU\204\377\206FT\203\377" \
+  "\3ES\203\377FT\203\377DR\203\377\207ES\203\377\1CQ\201\377\206DR\202" \
+  "\377\1@M\177\377\212\31*e\377\3\30)d\377\26'c\3777Fz\377\203BP\201\377" \
+  "\2BP\200\377BP\177\377\206BP\200\377\2AO\200\377@N\200\377\206AO\200" \
+  "\377\1\77M~\377\207@N\177\377\5>L}\377\77M~\377/>t\377\31*e\377\30)d" \
+  "\377\213\31*e\377\4\30)d\377\"2k\377\77M~\377<J|\377\202=K}\377\2<K}" \
+  "\377=K}\377\207<K}\377\2;J|\377:I{\377\206;J|\377\205:I{\377\2.>s\377" \
+  "\27(c\377\217\31*e\377\4\30)d\377\32+f\3773Av\3777Fz\377\2058Fz\377\2" \
+  "7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2046Ex\377\3""5Dw\377\36" \
+  "/h\377\30)d\377\223\31*e\377\5\27)d\377&5m\3773Bw\3772Av\3771@u\377\205" \
+  "2Av\377\2""1Au\3770At\377\2061Au\377\2020@u\377\2#3k\377\30)d\377\231" \
+  "\31*e\377\4\40""0j\377/=s\377-<r\377,;q\377\206-<r\377\203,<r\377\4+" \
+  ";q\377,<r\377\34,f\377\30)d\377\232\31*e\377\3\30)d\377\33,f\377&6m\377" \
+  "\202(8o\377\2'7o\377&6o\377\205'7o\377\2$4l\377\30)d\377\233\31*e\377" \
+  "\202HU\204\377\2*:p\377\31*d\377\205\31*e\377\10\30)d\377\27(c\3771@" \
+  "u\377JW\205\377HU\204\377IV\205\377HU\204\377IV\205\377\207JW\206\377" \
+  "\2IV\206\377JW\206\377\207KX\206\377\2JW\205\377KX\206\377\210LY\207" \
+  "\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\207LZ\207\377\4KZ\206" \
+  "\377LZ\207\377MZ\210\377LZ\207\377\211MZ\210\377\202LY\207\377\203MZ" \
+  "\210\377\202N[\211\377\1MZ\210\377\230N[\211\377\203MZ\210\377\202LY" \
+  "\207\377\210MZ\210\377\3LZ\207\377MZ\210\377LZ\207\377\202KZ\206\377" \
+  "\210LZ\207\377\1LY\207\377\202LX\207\377\206LY\207\377\4KX\206\377LY" \
+  "\207\377KX\206\377JW\205\377\206KX\206\377\1JW\206\377\202IV\206\377" \
+  "\205JW\206\377\4IV\205\377JW\206\377IV\205\377HU\204\377\202IV\205\377" \
+  "\3ER\202\377\33+f\377\30)d\377\206\31*e\377\4\27(d\377AO\200\377HU\204" \
+  "\377HT\203\377\210GU\204\377\2FT\203\377ES\202\377\205FT\203\377\3ES" \
+  "\203\377FT\203\377DR\203\377\205ES\203\377\3DR\202\377ES\203\377CQ\201" \
+  "\377\204DR\202\377\4CQ\201\377FT\203\377\"1k\377\30)d\377\211\31*e\377" \
+  "\4\27(d\377(9o\377CQ\202\377AO\200\377\202BP\201\377\1BP\177\377\207" \
+  "BP\200\377\1@N\200\377\205AO\200\377\3@N\177\377AO\200\377\77M~\377\205" \
+  "@N\177\377\6\77M~\377@N\177\377\77M~\3775Dw\377\33,f\377\30)d\377\214" \
+  "\31*e\377\2\36.h\377;I{\377\205=K}\377\210<K}\377\1:I{\377\206;J|\377" \
+  "\2:I{\3779Hz\377\203:I{\377\3""5Ex\377\27(c\377\30)d\377\216\31*e\377" \
+  "\3\30)d\377\27(d\3771@v\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2" \
+  "6Ex\3775Dw\377\2046Ex\377\3""5Dw\377#3k\377\30)d\377\223\31*e\377\5\30" \
+  ")d\377!1j\3773Bw\3772Av\3771@u\377\2052Av\377\1""1Au\377\2020At\377\205" \
+  "1Au\377\2020@u\377\1%5m\377\231\31*e\377\5\30)d\377\36.h\377/=s\377." \
+  "=s\377,;q\377\206-<r\377\205,<r\377\2\36/h\377\30)d\377\232\31*e\377" \
+  "\3\30)d\377\33,f\377%5m\377\202(8o\377\2'7o\377&6o\377\205'7o\377\3%" \
+  "5m\377\30)d\377\30)e\377\232\31*e\377\4HU\204\377@N\177\377\36/i\377" \
+  "\30)d\377\205\31*e\377\11\30)d\377\35-g\377FS\202\377HU\205\377IV\205" \
+  "\377HU\204\377IV\205\377JW\206\377IV\205\377\205JW\206\377\4IV\206\377" \
+  "JW\206\377KX\206\377JW\206\377\205KX\206\377\1JW\205\377\202KX\206\377" \
+  "\207LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\206LZ\207\377" \
+  "\202KZ\206\377\3LZ\207\377MZ\210\377LZ\207\377\211MZ\210\377\1LY\207" \
+  "\377\203MZ\210\377\234N[\211\377\1MZ\210\377\202N[\211\377\202MZ\210" \
+  "\377\202LY\207\377\210MZ\210\377\2LZ\207\377MZ\210\377\202LZ\207\377" \
+  "\1KZ\206\377\206LZ\207\377\4LY\207\377LZ\207\377LY\207\377LX\207\377" \
+  "\207LY\207\377\202KX\206\377\1JW\205\377\207KX\206\377\202JW\206\377" \
+  "\1IV\206\377\206JW\206\377\203IV\205\377\4HU\204\377KX\206\3770\77t\377" \
+  "\27(c\377\206\31*e\377\6\30)d\377)9p\377JV\205\377HU\204\377GU\204\377" \
+  "FU\204\377\205GU\204\377\3FT\203\377GU\204\377ES\202\377\207FT\203\377" \
+  "\1DR\203\377\207ES\203\377\2DR\202\377CQ\201\377\204DR\202\377\3ES\202" \
+  "\3773Bv\377\27(c\377\211\31*e\377\3\30)d\377\33,f\377CQ\202\377\203B" \
+  "P\201\377\1BP\177\377\207BP\200\377\1@N\200\377\207AO\200\377\1\77M~" \
+  "\377\207@N\177\377\4\77M~\377;J{\377\36/h\377\30)d\377\214\31*e\377\2" \
+  "\34-g\3776Dx\377\205=K}\377\1;K}\377\207<K}\377\1:I{\377\205;J|\377\3" \
+  ":I{\377;J|\3779Hz\377\202:I{\377\4""9Hz\377:I{\377\32*e\377\30)d\377" \
+  "\217\31*e\377\2\27(c\377,;r\377\2058Fz\377\2""7Fy\3778Fz\377\2077Fy\377" \
+  "\2""6Ex\3775Dw\377\2046Ex\377\3""5Dw\377(7n\377\27(d\377\223\31*e\377" \
+  "\5\30)d\377\35-h\3773Bw\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377" \
+  "\2051Au\377\2020@u\377\1'7o\377\231\31*e\377\5\30)d\377\35-h\377-<r\377" \
+  ".=s\377,;q\377\206-<r\377\205,<r\377\2!2j\377\30)d\377\232\31*e\377\3" \
+  "\30)d\377\32+e\377$4l\377\202(8o\377\202'7o\377\1&6o\377\203'7o\377\202" \
+  "&6n\377\2\31*d\377\30)d\377\232\31*e\377\2GT\203\3774Cv\377\202\30)d" \
+  "\377\204\31*e\377\3\30)d\377\27(c\3772Au\377\202HU\204\377\2IV\205\377" \
+  "HU\204\377\202IV\205\377\206JW\206\377\3IV\206\377KX\206\377JW\206\377" \
+  "\206KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377\205LY\207\377" \
+  "\4LX\207\377LY\207\377LZ\207\377LY\207\377\207LZ\207\377\1KZ\206\377" \
+  "\202LZ\207\377\211MZ\210\377\202LY\207\377\1MZ\210\377\203N[\211\377" \
+  "\1MZ\210\377\235N[\211\377\1MZ\210\377\202N[\211\377\202MZ\210\377\1" \
+  "LY\207\377\210MZ\210\377\1LZ\207\377\202MZ\210\377\2LZ\207\377KZ\206" \
+  "\377\206LZ\207\377\4LY\207\377LZ\207\377LY\207\377LX\207\377\207LY\207" \
+  "\377\202KX\206\377\1JW\205\377\205KX\206\377\4JW\206\377KX\206\377JW" \
+  "\206\377IV\206\377\205JW\206\377\3IV\205\377JW\206\377HU\204\377\203" \
+  "IV\205\377\3GT\203\377\33,f\377\30)d\377\206\31*e\377\5\35-g\377AO\177" \
+  "\377HU\204\377HT\204\377FU\204\377\207GU\204\377\2FT\203\377ES\202\377" \
+  "\206FT\203\377\2ES\203\377DR\203\377\205ES\203\377\202DR\202\377\1CQ" \
+  "\201\377\205DR\202\377\3BP\200\377\27)d\377\30)d\377\211\31*e\377\2\30" \
+  ")d\377:H{\377\203BP\201\377\2BP\200\377BP\177\377\206BP\200\377\2AO\200" \
+  "\377@N\200\377\206AO\200\377\1\77M~\377\207@N\177\377\3>L}\377@N\177" \
+  "\377\"2j\377\215\31*e\377\4\32+e\3770\77t\377=K}\377<K}\377\203=K}\377" \
+  "\2<K}\377;K}\377\206<K}\377\1:I{\377\207;J|\377\1""9Hz\377\203:I{\377" \
+  "\3""9Hz\377\40""0i\377\30)d\377\217\31*e\377\2\27(d\377&6n\377\2078F" \
+  "z\377\2077Fy\377\2066Ex\377\3""5Dw\377,;q\377\27(c\377\223\31*e\377\5" \
+  "\30)d\377\31*e\3773Bw\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377" \
+  "\2051Au\377\2020@u\377\2*9p\377\32+e\377\230\31*e\377\5\30)d\377\34-" \
+  "g\377+;q\377.=s\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\2#3" \
+  "l\377\30)d\377\232\31*e\377\10\30)d\377\31*e\377#4l\377(8o\377'7o\377" \
+  "(8o\377'7o\377&6o\377\204'7o\377\3&6n\377\31+e\377\30)d\377\232\31*e" \
+  "\377\3ES\202\377\"3k\377\30)d\377\205\31*e\377\3\30)d\377\36/h\377@N" \
+  "\177\377\202IV\205\377\1HU\204\377\202IV\205\377\206JW\206\377\2IV\206" \
+  "\377JW\206\377\207KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377" \
+  "\205LY\207\377\2LX\207\377LY\207\377\211LZ\207\377\2KZ\206\377LZ\207" \
+  "\377\202MZ\210\377\1LZ\207\377\207MZ\210\377\1LY\207\377\203MZ\210\377" \
+  "\243N[\211\377\1MZ\210\377\202N[\211\377\1MZ\210\377\202LY\207\377\212" \
+  "MZ\210\377\2LZ\207\377KZ\206\377\206LZ\207\377\4LY\207\377LZ\207\377" \
+  "LY\207\377LX\207\377\210LY\207\377\2KX\206\377JW\205\377\207KX\206\377" \
+  "\210JW\206\377\7IV\205\377HU\204\377IV\205\377HU\204\377IV\205\3773B" \
+  "v\377\26'c\377\207\31*e\377\5""1@u\377IV\204\377HU\203\377GU\204\377" \
+  "FU\204\377\205GU\204\377\202FT\203\377\1ES\202\377\205FT\203\377\202" \
+  "ES\203\377\1DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\204DR\202" \
+  "\377\4CQ\201\377DR\202\377#3k\377\30)d\377\211\31*e\377\4\30)d\377-=" \
+  "r\377CQ\202\377BP\201\377\202BP\200\377\1BP\177\377\205BP\200\377\202" \
+  "AO\200\377\1@N\200\377\206AO\200\377\2@N\177\377\77M~\377\206@N\177\377" \
+  "\3>L}\377@N\177\377*:p\377\215\31*e\377\4\30)d\377+;q\377=K}\377=J|\377" \
+  "\202=K}\377\3<K}\377=K}\377;K}\377\206<K}\377\2;J|\377:I{\377\206;J|" \
+  "\377\1""9Hz\377\203:I{\377\3""9Hz\377&6n\377\27(d\377\217\31*e\377\2" \
+  "\30)d\377!1j\377\2078Fz\377\2067Fy\377\2""6Ex\3777Fy\377\2066Ex\377\1" \
+  "/\77s\377\202\30)d\377\222\31*e\377\5\30)d\377\27(c\3771@u\3772Av\377" \
+  "1@u\377\2062Av\377\2""1Au\3770At\377\2051Au\377\2020@u\377\2+<r\377\32" \
+  "+f\377\230\31*e\377\5\30)d\377\33,f\377*9p\377.=s\377,;q\377\205-<r\377" \
+  "\3,<r\377-<r\377+<r\377\203,<r\377\2&6n\377\27)d\377\232\31*e\377\3\30" \
+  ")d\377\31*e\377\"3k\377\203(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377" \
+  "\33,f\377\30)d\377\232\31*e\377\3>L}\377\26'c\377\30)d\377\205\31*e\377" \
+  "\2\30)d\377*9p\377\202IV\205\377\202HU\204\377\1IV\205\377\206JW\206" \
+  "\377\202IV\206\377\1JW\206\377\206KX\206\377\2JW\205\377KX\206\377\210" \
+  "LY\207\377\2LX\207\377LY\207\377\207LZ\207\377\202KZ\206\377\202LZ\207" \
+  "\377\207MZ\210\377\203LY\207\377\3MZ\210\377N[\211\377MZ\210\377\215" \
+  "N[\211\377\215MZ\211\377\214N[\211\377\1MZ\210\377\202N[\211\377\1MZ" \
+  "\210\377\202LY\207\377\207MZ\210\377\4LZ\207\377MZ\210\377LZ\207\377" \
+  "KZ\206\377\210LZ\207\377\2LY\207\377LX\207\377\207LY\207\377\2KX\206" \
+  "\377JW\205\377\207KX\206\377\2JW\206\377IV\206\377\207JW\206\377\7IV" \
+  "\205\377HU\204\377IV\205\377HU\204\377DQ\201\377\34-g\377\30)d\377\205" \
+  "\31*e\377\6\30)d\377%4l\377DQ\201\377HU\204\377GU\204\377FU\204\377\206" \
+  "GU\204\377\1FT\203\377\202ES\202\377\205FT\203\377\1ES\203\377\202DR" \
+  "\203\377\205ES\203\377\1DR\202\377\202CQ\201\377\205DR\202\377\3""1@" \
+  "u\377\27(c\377\30)e\377\210\31*e\377\3\30)d\377\"2k\377DR\202\377\202" \
+  "BP\201\377\2BP\200\377BP\177\377\206BP\200\377\2AO\200\377@N\200\377" \
+  "\206AO\200\377\2@N\177\377\77M~\377\205@N\177\377\203\77M~\377\1""3A" \
+  "v\377\215\31*e\377\3\30)d\377&6n\377<J|\377\205=K}\377\1;K}\377\206<" \
+  "K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377\202:I{\377\3""9Hz\377" \
+  "+<q\377\27(c\377\217\31*e\377\4\30)d\377\33,f\3778Fz\3777Ey\377\2058" \
+  "Fz\377\2107Fy\377\2066Ex\377\3""0@t\377\32+f\377\30)d\377\223\31*e\377" \
+  "\3\27(d\377-=s\3773Bw\377\2021@u\377\2052Av\377\2""1Au\3770At\377\206" \
+  "1Au\377\3""0@u\377-=s\377\33,f\377\230\31*e\377\5\30)d\377\32+f\377)" \
+  "8o\377.=s\377,;q\377\207-<r\377\1+<r\377\203,<r\377\2(8o\377\27(d\377" \
+  "\232\31*e\377\3\30)e\377\30)d\377\"2j\377\203(8o\377\2'7o\377&6o\377" \
+  "\204'7o\377\3&6n\377\34-g\377\30)d\377\232\31*e\377\2)9p\377\27(d\377" \
+  "\206\31*e\377\3\32+f\377<J|\377JW\205\377\202HU\204\377\3IV\205\377J" \
+  "W\206\377IV\205\377\205JW\206\377\2IV\206\377JW\206\377\207KX\206\377" \
+  "\1JW\205\377\202KX\206\377\206LY\207\377\4LX\207\377LY\207\377LZ\207" \
+  "\377LY\207\377\205LZ\207\377\1KZ\206\377\202LZ\207\377\211MZ\210\377" \
+  "\1LY\207\377\202MZ\210\377\215N[\211\377\203MZ\211\377\214N[\211\377" \
+  "\204MZ\211\377\213N[\211\377\2MZ\210\377N[\211\377\202MZ\210\377\1LY" \
+  "\207\377\207MZ\210\377\4LZ\207\377MZ\210\377LZ\207\377KZ\206\377\207" \
+  "LZ\207\377\202LY\207\377\1LX\207\377\205LY\207\377\4KX\206\377LY\207" \
+  "\377KX\206\377JW\205\377\205KX\206\377\4JW\206\377KX\206\377JW\206\377" \
+  "IV\206\377\205JW\206\377\202IV\205\377\1HU\204\377\202IV\205\377\4GT" \
+  "\204\377-<r\377\27)d\377\30)d\377\204\31*e\377\4\30)d\377\32+e\377=K" \
+  "}\377HU\204\377\202GU\204\377\1FU\204\377\206GU\204\377\2FT\203\377E" \
+  "S\202\377\206FT\203\377\2ES\203\377DR\203\377\206ES\203\377\2DR\202\377" \
+  "CQ\201\377\205DR\202\377\1<J|\377\202\30)d\377\211\31*e\377\2\35.h\377" \
+  ">L~\377\202BP\201\377\202BP\200\377\1BP\177\377\205BP\200\377\202AO\200" \
+  "\377\1@N\200\377\205AO\200\377\2@N\177\377\77M~\377\206@N\177\377\202" \
+  "\77M~\377\2;I{\377\30)d\377\214\31*e\377\3\30)d\377\"2j\377:H{\377\205" \
+  "=K}\377\1;K}\377\206<K}\377\2;J|\377:I{\377\205;J|\377\3:I{\377;J|\377" \
+  "9Hz\377\202:I{\377\4""9Hz\3771Au\377\27(c\377\30)d\377\216\31*e\377\3" \
+  "\30)d\377\27)c\3777Ey\377\2068Fz\377\2107Fy\377\2066Ex\377\3""2Au\377" \
+  "\35-g\377\30)d\377\223\31*e\377\5\27)d\377)9p\3773Bw\3772Av\3771@u\377" \
+  "\2052Av\377\2""1Au\3770At\377\2061Au\377\2020@u\377\1\34-g\377\230\31" \
+  "*e\377\5\30)d\377\32*e\377'7n\377.=s\377,;q\377\207-<r\377\1+<r\377\203" \
+  ",<r\377\3*:p\377\27(d\377\30)e\377\232\31*e\377\3\30)d\377!1j\377'7n" \
+  "\377\202(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377\35.h\377\30)d\377" \
+  "\232\31*e\377\2\32+f\377\30)d\377\205\31*e\377\3\30)d\377!2k\377JW\206" \
+  "\377\202IV\205\377\2HU\204\377IV\205\377\206JW\206\377\1IV\206\377\202" \
+  "JW\206\377\206KX\206\377\1JW\205\377\202KX\206\377\206LY\207\377\4LX" \
+  "\207\377LY\207\377LZ\207\377LY\207\377\210LZ\207\377\2MZ\210\377LZ\207" \
+  "\377\207MZ\210\377\2LY\207\377MZ\210\377\202N[\211\377\1MZ\210\377\211" \
+  "N[\211\377\203MZ\211\377\203N[\211\377\214O\\\211\377\204N[\211\377\202" \
+  "MZ\211\377\212N[\211\377\2MZ\210\377N[\211\377\202MZ\210\377\1LY\207" \
+  "\377\207MZ\210\377\4LZ\207\377MZ\210\377LZ\207\377KZ\206\377\205LZ\207" \
+  "\377\4LY\207\377LZ\207\377LY\207\377LX\207\377\206LY\207\377\3KX\206" \
+  "\377LY\207\377JW\205\377\206KX\206\377\202JW\206\377\1IV\206\377\206" \
+  "JW\206\377\202IV\205\377\1HU\204\377\202IV\205\377\3;I|\377\33,f\377" \
+  "\30)d\377\205\31*e\377\6\27(c\377/>s\377GT\203\377HU\204\377GU\204\377" \
+  "FU\204\377\206GU\204\377\2FT\203\377ES\202\377\206FT\203\377\2ES\203" \
+  "\377DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\204DR\202\377\4CQ" \
+  "\201\377\77N\177\377\40""0i\377\30)d\377\211\31*e\377\2\33,f\3776Dy\377" \
+  "\203BP\201\377\2BP\200\377BP\177\377\206BP\200\377\2AO\200\377@N\200" \
+  "\377\205AO\200\377\202@N\177\377\1\77M~\377\205@N\177\377\5\77M~\377" \
+  ">L}\377@N\177\377\33,f\377\30)d\377\213\31*e\377\3\30)d\377\35.h\377" \
+  "8Fy\377\205=K}\377\2<K}\377;K}\377\205<K}\377\2;J|\377:I{\377\206;J|" \
+  "\377\2:I{\3779Hz\377\203:I{\377\3""4Cw\377\31*e\377\30)d\377\217\31*" \
+  "e\377\2\27(c\3772@v\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2066" \
+  "Ex\377\3""3Bv\377\40""0i\377\30)d\377\223\31*e\377\5\30)d\377%5n\377" \
+  "4Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3770At\377\2061Au\377\4""0@t" \
+  "\3771Av\377\35.g\377\30)d\377\227\31*e\377\6\30)d\377\31*e\377&6m\377" \
+  ".=s\377-<r\377,;q\377\206-<r\377\1+<r\377\202,<r\377\202+;q\377\2\31" \
+  "*e\377\30)d\377\232\31*e\377\3\30)d\377\40""0i\377'7n\377\202(8o\377" \
+  "\2'7o\377&6o\377\204'7o\377\3&6n\377\37/i\377\30)d\377\232\31*e\377\1" \
+  "\30)d\377\206\31*e\377\4\27(d\3777Fy\377JW\206\377HU\204\377\202IV\205" \
+  "\377\207JW\206\377\4IV\206\377JW\206\377KX\206\377JW\206\377\204KX\206" \
+  "\377\2JW\205\377KX\206\377\210LY\207\377\1LX\207\377\202LY\207\377\210" \
+  "LZ\207\377\2MZ\210\377LZ\207\377\207MZ\210\377\4LY\207\377MZ\210\377" \
+  "N[\211\377MZ\210\377\212N[\211\377\1MZ\211\377\203N[\211\377\216O\\\211" \
+  "\377\1N[\211\377\203O\\\211\377\203N[\211\377\202MZ\211\377\211N[\211" \
+  "\377\1MZ\210\377\202N[\211\377\1LY\207\377\212MZ\210\377\2LZ\207\377" \
+  "KZ\206\377\205LZ\207\377\4LY\207\377LZ\207\377LY\207\377LX\207\377\207" \
+  "LY\207\377\2KX\206\377JW\205\377\207KX\206\377\2JW\206\377IV\206\377" \
+  "\206JW\206\377\2IV\205\377HU\204\377\202IV\205\377\3GT\204\377\"2k\377" \
+  "\30)d\377\205\31*e\377\2\30)d\377\35-g\377\202GT\203\377\3HU\204\377" \
+  "GU\204\377FU\204\377\206GU\204\377\2FT\203\377ES\202\377\206FT\203\377" \
+  "\2ES\203\377DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\204DR\202" \
+  "\377\3BP\201\377(8o\377\30)d\377\212\31*e\377\6/>t\377CP\201\377AO\200" \
+  "\377BP\201\377BP\200\377BP\177\377\206BP\200\377\2AO\200\377@N\200\377" \
+  "\206AO\200\377\2@N\177\377\77M~\377\206@N\177\377\4\77M~\377@N\177\377" \
+  "$4l\377\30)d\377\213\31*e\377\3\30)d\377\31)e\3776Ex\377\204=K}\377\202" \
+  "<K}\377\1;K}\377\205<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377" \
+  "\203:I{\377\3""5Dx\377\35-g\377\30)d\377\217\31*e\377\2\27(d\377,<r\377" \
+  "\2058Fz\377\3""7Fy\3778Fz\3776Fx\377\2067Fy\377\2066Ex\377\3""4Cw\377" \
+  "\"2k\377\30)d\377\223\31*e\377\5\30)d\377!1k\3774Cw\3772Av\3771@u\377" \
+  "\2062Av\377\2""1Au\3770At\377\2051Au\377\4""0@u\3771Au\377\40""0i\377" \
+  "\30)d\377\227\31*e\377\202\30)d\377\4%5m\377.=s\377-<r\377,;q\377\206" \
+  "-<r\377\1+<r\377\203,<r\377\3+;q\377\33+f\377\30)d\377\232\31*e\377\3" \
+  "\30)d\377\36/i\377'7n\377\202(8o\377\2'7o\377&6o\377\204'7o\377\3&6n" \
+  "\377\40""0j\377\30)d\377\240\31*e\377\3\30)d\377\33+f\377JV\206\377\202" \
+  "IV\205\377\2HU\204\377IV\205\377\210JW\206\377\2KX\206\377JW\206\377" \
+  "\207KX\206\377\206LY\207\377\202LX\207\377\1LY\207\377\207LZ\207\377" \
+  "\4KZ\206\377LZ\207\377MZ\210\377LZ\207\377\206MZ\210\377\202LY\207\377" \
+  "\1MZ\210\377\211N[\211\377\202MZ\211\377\202N[\211\377\202O\\\211\377" \
+  "\1N[\211\377\205O\\\211\377\4MZ\206\377LY\204\377KX\203\377JW\202\377" \
+  "\205JV\200\377\5JV\201\377KW\202\377KX\203\377LY\205\377NZ\207\377\204" \
+  "O\\\211\377\202N[\211\377\202MZ\211\377\210N[\211\377\4MZ\210\377N[\211" \
+  "\377MZ\210\377LY\207\377\210MZ\210\377\2LZ\207\377KZ\206\377\210LZ\207" \
+  "\377\2LY\207\377LX\207\377\206LY\207\377\1KX\206\377\202JW\205\377\206" \
+  "KX\206\377\2JW\206\377IV\206\377\206JW\206\377\1IV\205\377\203HU\204" \
+  "\377\2JW\206\3771@u\377\207\31*e\377\2\26'c\377<J|\377\202HU\204\377" \
+  "\2GU\204\377FU\204\377\206GU\204\377\2FT\203\377ES\202\377\206FT\203" \
+  "\377\2ES\203\377DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\205DR" \
+  "\202\377\1""0@u\377\202\30)d\377\210\31*e\377\3\30)d\377(8o\377AO\200" \
+  "\377\202BP\201\377\1BP\200\377\202BP\177\377\205BP\200\377\2AO\200\377" \
+  "@N\200\377\206AO\200\377\2@N\177\377\77M~\377\206@N\177\377\4\77M~\377" \
+  "@N~\377-<r\377\27(d\377\214\31*e\377\3\26(c\3772Au\377<J|\377\204=K}" \
+  "\377\2<K}\377;K}\377\206<K}\377\2;J|\377:I{\377\205;J|\377\2:I{\3779" \
+  "Hz\377\203:I{\377\3""7Fy\377\40""1i\377\30)d\377\217\31*e\377\3\30)d" \
+  "\377'7n\3779Gz\377\2068Fz\377\1""6Fx\377\2067Fy\377\2""6Ex\3775Dw\377" \
+  "\2046Ex\377\3""5Dx\377$4l\377\30)d\377\223\31*e\377\5\30)d\377\36/i\377" \
+  "4Cx\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2051Au\377\4""0@u" \
+  "\3771@u\377#4l\377\30)d\377\230\31*e\377\5\30)d\377#3l\377-<s\377-<r" \
+  "\377,;q\377\206-<r\377\1+<r\377\203,<r\377\3+;q\377\34-g\377\30)d\377" \
+  "\202\31*e\377\4\30(b\377\23!P\377\12\21)\377\27(`\377\224\31*e\377\3" \
+  "\30)d\377\35.h\377'7n\377\202(8o\377\2'7o\377&6o\377\204'7o\377\3&6n" \
+  "\377!1j\377\30)d\377\240\31*e\377\10\26(c\377/>t\377JW\205\377HU\204" \
+  "\377IV\205\377HU\204\377JW\206\377IV\205\377\205JW\206\377\2IV\206\377" \
+  "JW\206\377\210KX\206\377\2LY\207\377KX\206\377\205LY\207\377\4LX\207" \
+  "\377LY\207\377LZ\207\377LY\207\377\205LZ\207\377\4KZ\206\377LZ\207\377" \
+  "MZ\210\377LZ\207\377\207MZ\210\377\4LY\207\377MZ\210\377N[\211\377MZ" \
+  "\210\377\210N[\211\377\1MZ\211\377\202N[\211\377\2O\\\211\377N[\211\377" \
+  "\203O\\\211\377\12JV\201\377ALq\3779Cc\37708S\377$*\77\377\32\37.\377" \
+  "\23\26!\377\15\17\26\377\10\12\17\377\5\6\12\377\202\4\5\10\377\12\6" \
+  "\7\13\377\11\13\20\377\16\20\30\377\24\27#\377\34!1\377&,B\37719U\377" \
+  ":Ce\377ALr\377JV\202\377\202O\\\211\377\202N[\211\377\202MZ\211\377\207" \
+  "N[\211\377\203MZ\210\377\1LY\207\377\206MZ\210\377\4LZ\207\377MZ\210" \
+  "\377LZ\207\377KZ\206\377\206LZ\207\377\202LY\207\377\1LX\207\377\207" \
+  "LY\207\377\2KX\206\377JW\205\377\206KX\206\377\202JW\206\377\1IV\206" \
+  "\377\204JW\206\377\4IV\205\377JW\206\377IV\205\377HU\204\377\202IV\205" \
+  "\377\3CQ\201\377\32+e\377\30)d\377\205\31*e\377\4\27(d\377'7o\377JW\205" \
+  "\377HT\203\377\210GU\204\377\210FT\203\377\210ES\203\377\2DR\202\377" \
+  "CQ\201\377\205DR\202\377\3""7Fy\377\33,f\377\30)d\377\210\31*e\377\10" \
+  "\30)d\377\"3k\377>L~\377BP\201\377BP\200\377BP\201\377BP\200\377BP\177" \
+  "\377\205BP\200\377\202AO\200\377\1@N\200\377\205AO\200\377\2@N\177\377" \
+  "\77M~\377\206@N\177\377\202\77M~\377\2""5Dx\377\27(c\377\214\31*e\377" \
+  "\3\27(c\377,;q\377<J|\377\204=K}\377\2<K}\377;K}\377\202<K}\377\2""3" \
+  "@j\3770<e\377\2020=e\377\2""0<e\377/;d\377\2050<e\377\202/;d\377\1.:" \
+  "c\377\202/;d\377\3-9b\377\34*W\377\23!Q\377\202\24\"R\377\2\24!Q\377" \
+  "\25$W\377\211\31*e\377\5\26&\\\377\24!Q\377\23!Q\377\33(W\377.9d\377" \
+  "\206-9c\377\1,9a\377\205,9b\377\12,8a\377,9b\377+7a\377+8a\3770>l\377" \
+  "6Ex\3776Ew\3776Ex\377&6n\377\30)d\377\204\31*e\377\1\24\"S\377\216\24" \
+  "\"R\377\10\23!Q\377\25#S\377*6a\377(5`\377'4_\377(5`\377(4_\377+8g\377" \
+  "\2032Av\377\2""1Au\3770At\377\2051Au\377\2020@u\377\2&6n\377\30)d\377" \
+  "\230\31*e\377\2\30)d\377!2j\377\202-<r\377\1,;q\377\206-<r\377\2,<r\377" \
+  "+<r\377\202,<r\377\11+;q\377\36.h\377\30)d\377\30(b\377\22\37L\377\10" \
+  "\16$\377\0\0\0\377\3\5\15\377\27'_\377\224\31*e\377\3\30)d\377\35-g\377" \
+  "'7n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\2\"2k\377\30)d\377\237" \
+  "\31*e\377\3\30)d\377\27)d\377BP\200\377\202IV\205\377\2HU\204\377IV\205" \
+  "\377\207JW\206\377\3IV\206\377KX\206\377JW\206\377\205KX\206\377\2JW" \
+  "\205\377KX\206\377\211LY\207\377\207LZ\207\377\2KZ\206\377LZ\207\377" \
+  "\210MZ\210\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377\207N[\211\377" \
+  "\202MZ\211\377\1N[\211\377\202O\\\211\377\10N[\211\377O\\\211\377MZ\206" \
+  "\3777@`\377\"';\377\24\27#\377\12\13\21\377\1\1\2\377\220\0\0\0\377\6" \
+  "\2\2\3\377\12\14\22\377\24\30#\377\"(;\3776\77_\377MY\205\377\202N[\211" \
+  "\377\1MZ\211\377\211N[\211\377\202MZ\210\377\1LY\207\377\206MZ\210\377" \
+  "\4LZ\207\377MZ\210\377LZ\207\377KZ\206\377\206LZ\207\377\202LY\207\377" \
+  "\1LX\207\377\206LY\207\377\202KX\206\377\1JW\205\377\204KX\206\377\4" \
+  "JW\206\377KX\206\377JW\206\377IV\206\377\206JW\206\377\203IV\205\377" \
+  "\4IV\204\377KX\206\377&5m\377\30)d\377\205\31*e\377\3\30)d\377\31*e\377" \
+  "FS\202\377\202HU\204\377\206GU\204\377\2FT\203\377GU\204\377\206FT\203" \
+  "\377\2ES\203\377FT\203\377\207ES\203\377\207DR\202\377\3=L~\377\36/i" \
+  "\377\30)d\377\210\31*e\377\3\30)d\377\34-g\377;J|\377\203BP\201\377\2" \
+  "BP\200\377BP\177\377\204BP\200\377\4AO\200\377BP\200\377AO\200\377@N" \
+  "\200\377\205AO\200\377\202@N\177\377\1\77M~\377\205@N\177\377\202\77" \
+  "M~\377\3=K}\377\26'c\377\30)d\377\213\31*e\377\3\27)d\377&5n\377<J|\377" \
+  "\204=K}\377\2<K}\377;K}\377\202<K}\377\2\31\37""4\377\5\6\12\377\203" \
+  "\6\10\16\377\1\6\10\15\377\206\6\10\16\377\205\6\10\15\377\1\4\6\14\377" \
+  "\203\2\4\13\377\3\2\4\12\377\6\12\32\377\30)c\377\210\31*e\377\5\13\22" \
+  "-\377\2\3\10\377\2\4\13\377\3\5\13\377\6\10\15\377\217\6\7\15\377\6\5" \
+  "\7\14\377\30\37""7\3776Ex\3775Dx\3776Ex\377)9o\377\204\31*e\377\2\30" \
+  ")d\377\3\6\17\377\220\2\4\13\377\204\5\7\15\377\2\5\6\14\377\27\36""6" \
+  "\377\2032Av\377\2""1Au\3770At\377\2051Au\377\2020@u\377\2(8o\377\30)" \
+  "d\377\230\31*e\377\2\30)d\377\40""0j\377\202-<r\377\1,;q\377\205-<r\377" \
+  "\3,<r\377-<r\377+<r\377\202,<r\377\5+;q\377\40""0i\377\21\35H\377\10" \
+  "\15\40\377\1\1\4\377\202\0\0\0\377\2\3\6\17\377\27'_\377\224\31*e\377" \
+  "\3\30)d\377\33,f\377&6n\377\202(8o\377\207'7o\377\1#3l\377\202\30)d\377" \
+  "\236\31*e\377\6\30)d\377$4l\377FT\203\377HU\204\377IV\205\377HU\204\377" \
+  "\202IV\205\377\205JW\206\377\2IV\206\377JW\206\377\207KX\206\377\3JW" \
+  "\205\377LY\207\377KX\206\377\207LY\207\377\2LZ\207\377LY\207\377\205" \
+  "LZ\207\377\2KZ\206\377LZ\207\377\210MZ\210\377\4LY\207\377MZ\210\377" \
+  "N[\211\377MZ\210\377\207N[\211\377\1MZ\211\377\202N[\211\377\7O\\\211" \
+  "\377N[\211\377O\\\211\377KX\203\377%+A\377\12\13\21\377\3\4\6\377\230" \
+  "\0\0\0\377\6\3\4\6\377\11\13\20\377#)>\377JV\200\377N[\211\377MZ\211" \
+  "\377\207N[\211\377\1MZ\210\377\202N[\211\377\1LY\207\377\207MZ\210\377" \
+  "\202LZ\207\377\1KZ\206\377\210LZ\207\377\2LY\207\377LX\207\377\204LY" \
+  "\207\377\4KX\206\377LY\207\377KX\206\377JW\205\377\207KX\206\377\206" \
+  "JW\206\377\2IV\205\377JW\206\377\202IV\205\377\4HU\204\377JW\205\377" \
+  ":I{\377\26'c\377\206\31*e\377\5\30)d\3777Fy\377IV\204\377HU\204\377F" \
+  "U\204\377\207GU\204\377\210FT\203\377\206ES\203\377\2DR\202\377ES\203" \
+  "\377\207DR\202\377\2!2j\377\30)d\377\210\31*e\377\3\30)d\377\27(d\377" \
+  "8G{\377\203BP\201\377\2BP\200\377BP\177\377\206BP\200\377\2AO\200\377" \
+  "@N\200\377\204AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\205" \
+  "@N\177\377\5\77M~\377>L}\377\77M~\377\33-g\377\30)d\377\213\31*e\377" \
+  "\3\30)d\377\40""0i\377<J|\377\204=K}\377\2<K}\377;K}\377\202<K}\377\1" \
+  "\"*G\377\226\0\0\0\377\1\30)c\377\210\31*e\377\1\1\2\7\377\224\0\0\0" \
+  "\377\2\14\17\33\3771>m\377\2026Ex\377\2+;q\377\32*e\377\203\31*e\377" \
+  "\2\24\"S\377\0\0\2\377\224\0\0\0\377\2\0\1\1\377\33#@\377\2032Av\377" \
+  "\2""1Au\3770At\377\2041Au\377\5""0@u\3771Au\3770@u\377*:q\377\30)d\377" \
+  "\230\31*e\377\5\30)d\377\37/i\377,<r\377-<r\377,;q\377\206-<r\377\2," \
+  "<r\377+<r\377\202,<r\377\3#1]\377\10\15\34\377\0\1\3\377\204\0\0\0\377" \
+  "\2\3\6\17\377\27'_\377\224\31*e\377\6\30)d\377\32+f\377&6n\377(8o\377" \
+  "'7o\377(8o\377\206'7o\377\3#3l\377\31*e\377\30)d\377\235\31*e\377\5\30" \
+  ")d\377\27(c\3772Av\377HU\204\377IV\205\377\202HU\204\377\1IV\205\377" \
+  "\206JW\206\377\2IV\206\377JW\206\377\206KX\206\377\1JW\205\377\202KX" \
+  "\206\377\205LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\205" \
+  "LZ\207\377\4KZ\206\377LZ\207\377MZ\210\377LZ\207\377\205MZ\210\377\202" \
+  "LY\207\377\1MZ\210\377\210N[\211\377\202MZ\211\377\6N[\211\377O\\\211" \
+  "\377N[\211\377O\\\211\377JV\200\377%+A\377\205\0\0\0\377\10\4\4\4\377" \
+  "\10\10\10\377\27\27\27\377QQQ\377\206\206\206\377\262\262\262\377\326" \
+  "\326\326\377\362\362\362\377\206\377\377\377\377\10\354\354\354\377\320" \
+  "\320\320\377\254\254\254\377\200\200\200\377KKK\377\23\23\23\377\10\10" \
+  "\10\377\4\4\4\377\205\0\0\0\377\2!&:\377HT~\377\202N[\211\377\1MZ\211" \
+  "\377\206N[\211\377\4MZ\210\377N[\211\377MZ\210\377LY\207\377\207MZ\210" \
+  "\377\1LZ\207\377\202KZ\206\377\206LZ\207\377\207LY\207\377\2KX\206\377" \
+  "LY\207\377\210KX\206\377\2JW\206\377IV\206\377\206JW\206\377\2IV\205" \
+  "\377HU\204\377\203IV\205\377\2\31+e\377\30)d\377\205\31*e\377\3\30)d" \
+  "\377(7n\377JW\205\377\202HU\204\377\1FU\204\377\206GU\204\377\2FT\203" \
+  "\377ES\202\377\206FT\203\377\2ES\203\377DR\203\377\206ES\203\377\205" \
+  "DR\202\377\3CQ\201\377FT\203\377)9o\377\212\31*e\377\3\27(c\3771@u\377" \
+  "AO\200\377\202BP\201\377\210BP\200\377\2AO\200\377@N\200\377\206AO\200" \
+  "\377\2@N\177\377\77M~\377\204@N\177\377\2\77M~\377@N\177\377\202\77M" \
+  "~\377\2#2k\377\30)d\377\213\31*e\377\4\30)d\377\32+f\377<J|\377=J|\377" \
+  "\204=K}\377\4<K}\377;K}\377<K}\3770<d\377\203\0\0\0\377\220\13\13\13" \
+  "\377\1\4\4\4\377\202\0\0\0\377\1\24#T\377\207\31*e\377\1\24#T\377\202" \
+  "\0\0\0\377\1\4\4\4\377\217\13\13\13\377\5\14\14\14\377\1\1\1\377\0\0" \
+  "\0\377\3\4\7\377+7`\377\2026Ex\377\2-=r\377\32+f\377\203\31*e\377\4\20" \
+  "\33A\377\0\0\1\377\0\0\0\377\4\4\4\377\217\13\13\13\377\5\11\11\11\377" \
+  "\1\1\1\377\0\0\0\377\2\3\6\377$/U\377\2032Av\377\2""1Au\3770At\377\206" \
+  "1Au\377\3""0@u\377-=s\377\30)d\377\230\31*e\377\5\30)d\377\35.g\377," \
+  ";q\377-<r\377,;q\377\206-<r\377\4,<r\377*;q\377'5e\377\20\25)\377\204" \
+  "\0\0\0\377\1\7\7\7\377\202\0\0\0\377\2\3\6\17\377\27'_\377\224\31*e\377" \
+  "\3\30)d\377\31*e\377&6n\377\203(8o\377\206'7o\377\3#4l\377\31*e\377\30" \
+  ")d\377\235\31*e\377\3\30)d\377\33,f\377=K}\377\202IV\205\377\2HU\204" \
+  "\377IV\205\377\206JW\206\377\1IV\206\377\202JW\206\377\205KX\206\377" \
+  "\1JW\205\377\202KX\206\377\206LY\207\377\3LX\207\377LZ\207\377LY\207" \
+  "\377\206LZ\207\377\3KZ\206\377MZ\210\377LZ\207\377\210MZ\210\377\2N[" \
+  "\211\377MZ\210\377\206N[\211\377\1MZ\211\377\202N[\211\377\5O\\\211\377" \
+  "N[\211\377JV\201\37708S\377\7\10\14\377\203\0\0\0\377\5\1\1\1\377%%%" \
+  "\377OOO\377\227\227\227\377\334\334\334\377\207\377\377\377\377\2\376" \
+  "\376\376\377\377\377\377\377\202\376\376\376\377\207\377\377\377\377" \
+  "\5\331\331\331\377\225\225\225\377NNN\377&&&\377\2\2\2\377\203\0\0\0" \
+  "\377\4\4\5\7\377,3M\377GS~\377MZ\211\377\207N[\211\377\203MZ\210\377" \
+  "\1LY\207\377\205MZ\210\377\4LZ\207\377MZ\210\377LZ\207\377KZ\206\377" \
+  "\205LZ\207\377\3LY\207\377LZ\207\377LX\207\377\207LY\207\377\2KX\206" \
+  "\377JW\205\377\205KX\206\377\3JW\206\377KX\206\377IV\206\377\205JW\206" \
+  "\377\10IV\205\377JW\206\377HU\204\377IV\205\377HU\204\377IV\205\377+" \
+  ";q\377\27(c\377\206\31*e\377\2\36.h\377ER\202\377\202HU\204\377\1FU\204" \
+  "\377\205GU\204\377\3FT\203\377GU\204\377ES\202\377\205FT\203\377\3ES" \
+  "\203\377FT\203\377DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\204" \
+  "DR\202\377\2ES\202\3772Av\377\212\31*e\377\6\27(d\377)9p\377AO\200\377" \
+  "BP\201\377BP\200\377BP\201\377\207BP\200\377\210AO\200\377\2@N\177\377" \
+  "\77M~\377\206@N\177\377\202\77M~\377\2(9p\377\27(d\377\213\31*e\377\3" \
+  "\30)d\377\26(c\377:I|\377\205=K}\377\5<K}\377;K}\377<K}\3774Am\377\5" \
+  "\7\14\377\202\0\0\0\377\2\361\361\361\377\373\373\373\377\215\371\371" \
+  "\371\377\2\373\373\373\377mmm\377\202\0\0\0\377\1\17\31<\377\207\31*" \
+  "e\377\1\14\24""1\377\202\0\0\0\377\2lll\377\367\367\367\377\216\371\371" \
+  "\371\377\2\377\377\377\377444\377\202\0\0\0\377\1\",M\377\2026Ex\377" \
+  "\2""0@t\377\33,f\377\203\31*e\377\1\13\23-\377\202\0\0\0\377\2ccc\377" \
+  "\374\374\374\377\215\371\371\371\377\6\373\373\373\377\302\302\302\377" \
+  "\27\27\27\377\0\0\0\377\4\5\12\377-:j\377\2032Av\377\2""1Au\3770At\377" \
+  "\2061Au\377\3""0@u\377/\77t\377\30)d\377\230\31*e\377\5\30)d\377\34," \
+  "g\377,;q\377-<r\377,;q\377\206-<r\377\3$1^\377\24\34""6\377\1\1\3\377" \
+  "\203\0\0\0\377\3\16\16\16\377OOO\377\273\273\273\377\202\0\0\0\377\2" \
+  "\3\6\17\377\27'_\377\224\31*e\377\3\30)d\377\31*e\377&6m\377\203(8o\377" \
+  "\206'7o\377\3$4m\377\32+f\377\30)d\377\235\31*e\377\3\30)d\377\"2k\377" \
+  "DQ\201\377\202IV\205\377\2HU\204\377IV\205\377\206JW\206\377\2IV\206" \
+  "\377JW\206\377\206KX\206\377\2JW\205\377KX\206\377\207LY\207\377\2LX" \
+  "\207\377LY\207\377\206LZ\207\377\2KZ\206\377LZ\207\377\211MZ\210\377" \
+  "\2N[\211\377MZ\210\377\206N[\211\377\2MZ\211\377N[\211\377\202O\\\211" \
+  "\377\3N[\211\377=Hk\377\25\31&\377\204\0\0\0\377\3EEE\377\234\234\234" \
+  "\377\331\331\331\377\204\377\377\377\377\1\376\376\376\377\216\377\377" \
+  "\377\377\1\376\376\376\377\204\377\377\377\377\3\332\332\332\377\236" \
+  "\236\236\377III\377\204\0\0\0\377\3\22\25\40\3778Bc\377MZ\211\377\210" \
+  "N[\211\377\2MZ\210\377LY\207\377\207MZ\210\377\211LZ\207\377\2LY\207" \
+  "\377LX\207\377\205LY\207\377\3KX\206\377LY\207\377JW\205\377\207KX\206" \
+  "\377\1IV\206\377\207JW\206\377\1HU\204\377\203IV\205\377\3<J|\377\26" \
+  "'c\377\31*d\377\205\31*e\377\2\33,f\377;I{\377\202HU\204\377\1FU\204" \
+  "\377\207GU\204\377\1ES\202\377\207FT\203\377\1DR\203\377\205ES\203\377" \
+  "\3DR\202\377ES\203\377CQ\201\377\205DR\202\377\1<J|\377\212\31*e\377" \
+  "\3\30)d\377!1j\377AO\200\377\203BP\201\377\206BP\200\377\2AO\200\377" \
+  "BP\200\377\207AO\200\377\2@N\177\377\77M~\377\206@N\177\377\202\77M~" \
+  "\377\2/>s\377\27(c\377\214\31*e\377\2\26(c\3774Cx\377\205=K}\377\5<K" \
+  "}\377;K}\377<K}\3777Et\377\17\23\40\377\202\0\0\0\377\1\271\271\271\377" \
+  "\217\377\377\377\377\1\247\247\247\377\202\0\0\0\377\1\11\17$\377\207" \
+  "\31*e\377\1\3\6\17\377\202\0\0\0\377\1\263\263\263\377\220\377\377\377" \
+  "\377\1\217\217\217\377\202\0\0\0\377\5\23\31,\3775Dv\3776Ex\3772Au\377" \
+  "\34-g\377\203\31*e\377\4\7\14\35\377\0\0\0\377\3\3\3\377\212\212\212" \
+  "\377\217\377\377\377\377\4\250\250\250\377\1\1\1\377\0\0\0\377\10\12" \
+  "\23\377\2042Av\377\2""1Au\3770At\377\2061Au\377\4""0@u\3771Au\377\31" \
+  "*e\377\30)d\377\227\31*e\377\5\30)d\377\33+f\377+;q\377-<r\377,;q\377" \
+  "\204-<r\377\3%1^\377\23\31""0\377\4\5\13\377\204\0\0\0\377\4^^^\377\274" \
+  "\274\274\377\377\377\377\377\374\374\374\377\202\0\0\0\377\2\3\6\17\377" \
+  "\27'_\377\224\31*e\377\202\30)d\377\2&6m\377'7o\377\202(8o\377\206'7" \
+  "o\377\3$5m\377\32+f\377\30)d\377\235\31*e\377\6\30)d\377)9p\377JW\205" \
+  "\377IV\205\377HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377" \
+  "\207KX\206\377\2JW\205\377KX\206\377\206LY\207\377\1LX\207\377\202LY" \
+  "\207\377\206LZ\207\377\1KZ\206\377\202LZ\207\377\206MZ\210\377\2LY\207" \
+  "\377MZ\210\377\207N[\211\377\2MZ\211\377N[\211\377\203O\\\211\377\2""0" \
+  "8T\377\7\10\14\377\203\0\0\0\377\3,,,\377\277\277\277\377\362\362\362" \
+  "\377\203\377\377\377\377\1\376\376\376\377\224\377\377\377\377\1\376" \
+  "\376\376\377\203\377\377\377\377\3\362\362\362\377\304\304\304\37733" \
+  "3\377\203\0\0\0\377\3\5\6\11\377)0I\377MZ\211\377\210N[\211\377\2MZ\210" \
+  "\377LY\207\377\205MZ\210\377\3LZ\207\377MZ\210\377KZ\206\377\206LZ\207" \
+  "\377\3LY\207\377LZ\207\377LX\207\377\207LY\207\377\1JW\205\377\207KX" \
+  "\206\377\2JW\206\377IV\206\377\206JW\206\377\2IV\205\377HU\204\377\202" \
+  "IV\205\377\3CP\201\377\34-g\377\30)d\377\206\31*e\377\5""1@u\377IV\204" \
+  "\377HT\203\377GU\204\377FU\204\377\206GU\204\377\1ES\202\377\207FT\203" \
+  "\377\1DR\203\377\207ES\203\377\1CQ\201\377\205DR\202\377\1DQ\202\377" \
+  "\212\31*e\377\2\30)d\377\32+e\377\202AO\200\377\202BP\201\377\210BP\200" \
+  "\377\210AO\200\377\207@N\177\377\202\77M~\377\2""5Dw\377\26'c\377\214" \
+  "\31*e\377\2\27(c\377/>s\377\205=K}\377\5<K}\377;K}\377<K}\377;J{\377" \
+  "\31\40""5\377\202\0\0\0\377\3xxx\377\377\377\377\377\376\376\376\377" \
+  "\215\377\377\377\377\1\323\323\323\377\202\0\0\0\377\1\3\5\14\377\206" \
+  "\31*e\377\5\26%Z\377\0\0\1\377\0\0\0\377\30\30\30\377\325\325\325\377" \
+  "\220\377\377\377\377\1\347\347\347\377\202\0\0\0\377\5\4\5\12\3775Cv" \
+  "\3776Ex\3774Cw\377\35-g\377\202\31*e\377\5\27'_\377\5\10\24\377\0\0\0" \
+  "\377\14\14\14\377\260\260\260\377\216\377\377\377\377\2\375\375\375\377" \
+  "\177\177\177\377\202\0\0\0\377\1\23\31.\377\2052Av\377\2071Au\377\4""0" \
+  "@t\3771Au\377\33,f\377\30)d\377\227\31*e\377\5\30)d\377\31*e\377+:q\377" \
+  "-<r\377,;q\377\202-<r\377\3*8j\377\21\27,\377\3\4\10\377\204\0\0\0\377" \
+  "\3MMM\377\321\321\321\377\365\365\365\377\202\377\377\377\377\1\367\367" \
+  "\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31*e\377\3\27)d\377" \
+  "%5m\377(8n\377\202(8o\377\206'7o\377\3%5m\377\33,f\377\30)d\377\235\31" \
+  "*e\377\3\32+e\3775Cx\377JW\205\377\202HU\204\377\1IV\205\377\206JW\206" \
+  "\377\2IV\206\377JW\206\377\206KX\206\377\4JW\205\377KX\206\377LY\207" \
+  "\377KX\206\377\204LY\207\377\202LX\207\377\1LY\207\377\206LZ\207\377" \
+  "\2KZ\206\377LZ\207\377\207MZ\210\377\1LY\207\377\202MZ\210\377\210N[" \
+  "\211\377\5O\\\211\377N[\211\377N[\207\377.6Q\377\0\0\1\377\202\0\0\0" \
+  "\377\5\7\7\7\377\200\200\200\377\375\375\375\377\377\377\377\377\376" \
+  "\376\376\377\234\377\377\377\377\1\376\376\376\377\202\377\377\377\377" \
+  "\2\216\216\216\377\11\11\11\377\203\0\0\0\377\3'.E\377KX\206\377MZ\211" \
+  "\377\205N[\211\377\4MZ\210\377N[\211\377MZ\210\377LY\207\377\205MZ\210" \
+  "\377\3LZ\207\377MZ\210\377KZ\206\377\206LZ\207\377\202LY\207\377\1LX" \
+  "\207\377\205LY\207\377\202KX\206\377\1JW\205\377\206KX\206\377\2JW\206" \
+  "\377IV\206\377\206JW\206\377\2IV\205\377HU\204\377\202IV\205\377\3FS" \
+  "\203\377'7n\377\30)d\377\205\31*e\377\6\30)d\377)9o\377GT\203\377HU\204" \
+  "\377GU\204\377FU\204\377\205GU\204\377\202FT\203\377\1ES\202\377\206" \
+  "FT\203\377\2ES\203\377DR\203\377\206ES\203\377\1CQ\201\377\204DR\202" \
+  "\377\4CQ\201\377FT\203\377\37""0h\377\30)d\377\211\31*e\377\2\26'c\377" \
+  "=L~\377\203BP\201\377\210BP\200\377\210AO\200\377\207@N\177\377\3\77" \
+  "M~\377>L}\3778Gy\377\202\30)d\377\213\31*e\377\3\27(d\377)9p\377>L}\377" \
+  "\204=K}\377\2<K}\377;K}\377\202<K}\377\1#+I\377\202\0\0\0\377\1;;;\377" \
+  "\217\377\377\377\377\2\341\341\341\377\31\31\31\377\202\0\0\0\377\1\30" \
+  ")d\377\205\31*e\377\5\17\31>\377\0\0\1\377\0\0\0\377DDD\377\355\355\355" \
+  "\377\217\377\377\377\377\3\376\376\376\377\377\377\377\377\"\"\"\377" \
+  "\202\0\0\0\377\1,9c\377\2026Ex\377\1\35.g\377\202\31*e\377\5\24\"S\377" \
+  "\3\5\15\377\0\0\0\377\25\25\25\377\327\327\327\377\216\377\377\377\377" \
+  "\2\363\363\363\377QQQ\377\202\0\0\0\377\1\40*M\377\2052Av\377\2071Au" \
+  "\377\4""0@u\3771Au\377\35-g\377\30)d\377\227\31*e\377\202\30)d\377\6" \
+  "+:q\377.=s\377-<r\377)7k\377\26\36:\377\0\0\1\377\203\0\0\0\377\3\1\1" \
+  "\1\377)))\377\302\302\302\377\202\377\377\377\377\1\376\376\376\377\202" \
+  "\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377" \
+  "\225\31*e\377\2\30)d\377$4l\377\203(8o\377\206'7o\377\3%5n\377\33,g\377" \
+  "\30)d\377\235\31*e\377\2\33,f\377AN\177\377\202IV\205\377\2HU\204\377" \
+  "IV\205\377\206JW\206\377\2IV\206\377JW\206\377\206KX\206\377\2JW\205" \
+  "\377KX\206\377\206LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377" \
+  "\204LZ\207\377\1KZ\206\377\202LZ\207\377\206MZ\210\377\1LY\207\377\202" \
+  "MZ\210\377\207N[\211\377\2MZ\211\377N[\211\377\202O\\\211\377\1.5P\377" \
+  "\203\0\0\0\377\2'''\377\267\267\267\377\244\377\377\377\377\2\303\303" \
+  "\303\377...\377\203\0\0\0\377\2'.E\377LY\207\377\206N[\211\377\3MZ\210" \
+  "\377N[\211\377LY\207\377\207MZ\210\377\2LZ\207\377KZ\206\377\206LZ\207" \
+  "\377\2LY\207\377LX\207\377\206LY\207\377\202KX\206\377\1JW\205\377\205" \
+  "KX\206\377\202JW\206\377\1IV\206\377\205JW\206\377\202IV\205\377\6HU" \
+  "\204\377IV\205\377HU\204\3771@u\377\27)d\377\30)d\377\204\31*e\377\6" \
+  "\30)d\377\"2k\377BP\200\377HU\204\377GU\204\377FU\204\377\206GU\204\377" \
+  "\2FT\203\377ES\202\377\205FT\203\377\202ES\203\377\1DR\203\377\206ES" \
+  "\203\377\2DR\202\377CQ\201\377\204DR\202\377\3ES\203\377)9o\377\27)d" \
+  "\377\211\31*e\377\2\26'c\3776Ey\377\203BP\201\377\2BP\200\377BP\177\377" \
+  "\206BP\200\377\210AO\200\377\207@N\177\377\202\77M~\377\3""9Hz\377\34" \
+  ",f\377\30)d\377\213\31*e\377\3\30)d\377$4l\377>L~\377\204=K}\377\204" \
+  "<K}\377\5+6[\377\4\5\10\377\0\0\0\377!!!\377\357\357\357\377\216\377" \
+  "\377\377\377\2\354\354\354\377===\377\202\0\0\0\377\1\23\40N\377\205" \
+  "\31*e\377\1\10\16\"\377\202\0\0\0\377\1qqq\377\222\377\377\377\377\1" \
+  "ttt\377\202\0\0\0\377\13\32!9\3775Dw\3777Fy\377\36/h\377\30)d\377\31" \
+  "*e\377\22\36H\377\1\2\5\377\0\0\0\377\37\37\37\377\375\375\375\377\215" \
+  "\377\377\377\377\3\376\376\376\377\351\351\351\377\"\"\"\377\202\0\0" \
+  "\0\377\1-:j\377\2052Av\377\2071Au\377\4""0@u\3771@u\377\37/i\377\30)" \
+  "d\377\230\31*e\377\5\27(d\377*9p\377(6e\377\33$D\377\4\6\13\377\203\0" \
+  "\0\0\377\3\6\6\6\377555\377\244\244\244\377\202\377\377\377\377\202\376" \
+  "\376\376\377\203\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3" \
+  "\6\17\377\27'_\377\225\31*e\377\2\30)d\377#4k\377\203(8o\377\206'7o\377" \
+  "\3%5n\377\34-g\377\30)d\377\234\31*e\377\3\30)d\377\36/i\377JW\206\377" \
+  "\204IV\205\377\210JW\206\377\210KX\206\377\210LY\207\377\206LZ\207\377" \
+  "\4KZ\206\377LZ\207\377MZ\210\377LZ\207\377\204MZ\210\377\1LY\207\377" \
+  "\202MZ\210\377\207N[\211\377\5MZ\211\377N[\211\377O\\\211\377N[\211\377" \
+  "*1J\377\203\0\0\0\377\3KKK\377\334\334\334\377\377\377\377\377\202\376" \
+  "\376\376\377\240\377\377\377\377\202\376\376\376\377\3\377\377\377\377" \
+  "\344\344\344\377VVV\377\203\0\0\0\377\1$*A\377\210N[\211\377\2MZ\210" \
+  "\377LY\207\377\205MZ\210\377\202LZ\207\377\1KZ\206\377\206LZ\207\377" \
+  "\202LY\207\377\1LX\207\377\206LY\207\377\2KX\206\377JW\205\377\206KX" \
+  "\206\377\2JW\206\377IV\206\377\206JW\206\377\2IV\205\377HU\204\377\202" \
+  "IV\205\377\3""9Gz\377\32+f\377\30)d\377\204\31*e\377\4\30)d\377\33,f" \
+  "\377\77M~\377HU\204\377\202GU\204\377\1FU\204\377\205GU\204\377\2FT\203" \
+  "\377ES\202\377\206FT\203\377\2ES\203\377DR\203\377\205ES\203\377\202" \
+  "DR\202\377\1CQ\201\377\204DR\202\377\3ES\202\3772Au\377\27(c\377\211" \
+  "\31*e\377\7\27(c\377.=s\377CQ\201\377BP\201\377BP\200\377BP\201\377B" \
+  "P\177\377\206BP\200\377\1@N\200\377\207AO\200\377\206@N\177\377\6\77" \
+  "M~\377@N\177\377\77M~\377;I{\377\37""0i\377\30)d\377\213\31*e\377\3\30" \
+  ")d\377\37""0i\377\77L~\377\203=K}\377\2<K}\377=K}\377\203<K}\377\5""4" \
+  "Am\377\10\12\21\377\0\0\0\377\24\24\24\377\304\304\304\377\216\377\377" \
+  "\377\377\2\367\367\367\377bbb\377\202\0\0\0\377\1\16\27""9\377\204\31" \
+  "*e\377\7\27'_\377\4\7\21\377\0\0\0\377\12\12\12\377\246\246\246\377\377" \
+  "\377\377\377\376\376\376\377\220\377\377\377\377\1\302\302\302\377\202" \
+  "\0\0\0\377\7\7\11\20\3776Ex\3777Fy\377!1j\377\30)d\377\31*e\377\17\31" \
+  "=\377\202\0\0\0\377\3@@@\377\377\377\377\377\376\376\376\377\215\377" \
+  "\377\377\377\1\332\332\332\377\202\0\0\0\377\1\4\5\11\377\2062Av\377" \
+  "\2071Au\377\2020@u\377\2!1j\377\30)d\377\230\31*e\377\3\24#Y\377\25\35" \
+  ":\377\10\12\24\377\204\0\0\0\377\3DDD\377\243\243\243\377\366\366\366" \
+  "\377\202\377\377\377\377\1\376\376\376\377\205\377\377\377\377\1\367" \
+  "\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31*e\377\2\30)d" \
+  "\377\"2k\377\203(8o\377\206'7o\377\3&6n\377\34-g\377\30)d\377\234\31" \
+  "*e\377\4\30)d\377*:p\377KX\206\377HU\204\377\202IV\205\377\2JW\206\377" \
+  "IV\205\377\206JW\206\377\2KX\206\377JW\206\377\206KX\206\377\2LY\207" \
+  "\377KX\206\377\206LY\207\377\2LZ\207\377LY\207\377\206LZ\207\377\207" \
+  "MZ\210\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377\205N[\211\377\6" \
+  "MZ\211\377N[\211\377O\\\211\377N[\211\37719U\377\3\3\5\377\202\0\0\0" \
+  "\377\4XXX\377\354\354\354\377\377\377\377\377\376\376\376\377\244\377" \
+  "\377\377\377\4\376\376\376\377\377\377\377\377\361\361\361\377fff\377" \
+  "\202\0\0\0\377\2\1\1\2\377*2L\377\206N[\211\377\202MZ\210\377\1LY\207" \
+  "\377\207MZ\210\377\2LZ\207\377KZ\206\377\206LZ\207\377\2LY\207\377LX" \
+  "\207\377\206LY\207\377\2KX\206\377JW\205\377\206KX\206\377\2JW\206\377" \
+  "IV\206\377\206JW\206\377\2IV\205\377HU\204\377\202IV\205\377\3@N\177" \
+  "\377\36/h\377\30)d\377\204\31*e\377\7\30)d\377\26'c\377:H{\377GT\203" \
+  "\377HU\204\377GU\204\377FU\204\377\205GU\204\377\2FT\203\377ES\202\377" \
+  "\206FT\203\377\2ES\203\377DR\203\377\206ES\203\377\2DR\202\377CQ\201" \
+  "\377\205DR\202\377\2:H{\377\26'c\377\211\31*e\377\3\27)d\377'6n\377C" \
+  "Q\202\377\203BP\201\377\1BP\177\377\206BP\200\377\2AO\200\377@N\200\377" \
+  "\206AO\200\377\210@N\177\377\4\77M~\377<J|\377\"3k\377\30)d\377\213\31" \
+  "*e\377\4\30)d\377\32+f\377\77M~\377<J|\377\204=K}\377\204<K}\377\6\14" \
+  "\17\32\377\0\0\0\377\6\6\6\377\232\232\232\377\377\377\377\377\376\376" \
+  "\376\377\215\377\377\377\377\1\206\206\206\377\202\0\0\0\377\1\10\16" \
+  "#\377\204\31*e\377\5\23\40M\377\2\3\10\377\0\0\0\377\31\31\31\377\335" \
+  "\335\335\377\221\377\377\377\377\3\376\376\376\377\344\344\344\377\27" \
+  "\27\27\377\202\0\0\0\377\3""0=k\3777Fx\377$4l\377\202\30)d\377\1\13\23" \
+  "/\377\202\0\0\0\377\3xxx\377\377\377\377\377\376\376\376\377\215\377" \
+  "\377\377\377\1\246\246\246\377\202\0\0\0\377\1\21\26)\377\2062Av\377" \
+  "\2071Au\377\2020@u\377\2#3k\377\30)d\377\227\31*e\377\2\30)c\377\13\23" \
+  "1\377\204\0\0\0\377\3""000\377\270\270\270\377\355\355\355\377\212\377" \
+  "\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225" \
+  "\31*e\377\2\30)d\377!1j\377\203(8o\377\206'7o\377\3&6n\377\35-h\377\30" \
+  ")d\377\234\31*e\377\3\27(d\3777Fx\377JW\206\377\203IV\205\377\206JW\206" \
+  "\377\2IV\206\377JW\206\377\206KX\206\377\2JW\205\377KX\206\377\206LY" \
+  "\207\377\2LX\207\377LY\207\377\206LZ\207\377\2KZ\206\377LZ\207\377\210" \
+  "MZ\210\377\2N[\211\377MZ\210\377\205N[\211\377\6MZ\211\377N[\211\377" \
+  "O\\\211\377N[\211\377ALq\377\12\13\21\377\202\0\0\0\377\2===\377\355" \
+  "\355\355\377\252\377\377\377\377\2\361\361\361\377JJJ\377\202\0\0\0\377" \
+  "\2\7\10\14\377;Ej\377\207N[\211\377\2MZ\210\377LY\207\377\206MZ\210\377" \
+  "\1LZ\207\377\202KZ\206\377\204LZ\207\377\4LY\207\377LZ\207\377LY\207" \
+  "\377LX\207\377\204LY\207\377\4KX\206\377LY\207\377KX\206\377JW\205\377" \
+  "\204KX\206\377\4JW\206\377KX\206\377JW\206\377IV\206\377\205JW\206\377" \
+  "\1IV\205\377\202HU\204\377\4IV\205\377GT\203\377\"2k\377\30)d\377\205" \
+  "\31*e\377\6\27(c\3770@u\377GT\203\377HU\204\377GU\204\377FU\204\377\206" \
+  "GU\204\377\2FT\203\377ES\202\377\205FT\203\377\1ES\203\377\202DR\203" \
+  "\377\205ES\203\377\2DR\202\377CQ\201\377\205DR\202\377\3BP\200\377\26" \
+  "'c\377\30)d\377\210\31*e\377\4\30)d\377\37""0j\377DR\202\377AO\200\377" \
+  "\202BP\201\377\1BP\177\377\207BP\200\377\1@N\200\377\206AO\200\377\210" \
+  "@N\177\377\4\77M~\377=K|\377%5m\377\30)d\377\214\31*e\377\2\30)d\377" \
+  "<K}\377\205=K}\377\204<K}\377\1\30\36""2\377\202\0\0\0\377\1qqq\377\217" \
+  "\377\377\377\377\4\246\246\246\377\7\7\7\377\0\0\0\377\4\7\21\377\204" \
+  "\31*e\377\1\16\30;\377\202\0\0\0\377\1""111\377\223\377\377\377\377\2" \
+  "\362\362\362\377OOO\377\202\0\0\0\377\6\37(F\3777Fx\377&6m\377\30)d\377" \
+  "\27(`\377\10\15\40\377\202\0\0\0\377\1\257\257\257\377\215\377\377\377" \
+  "\377\3\376\376\376\377\377\377\377\377eee\377\202\0\0\0\377\1\36(H\377" \
+  "\2062Av\377\2061Au\377\5""0@u\3771Au\3770@u\377$5m\377\30)d\377\227\31" \
+  "*e\377\2\30)c\377\12\21,\377\202\0\0\0\377\5\22\22\22\377\243\243\243" \
+  "\377\375\375\375\377\377\377\377\377\376\376\376\377\212\377\377\377" \
+  "\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31*e\377" \
+  "\2\30)d\377\40""1i\377\203(8o\377\206'7o\377\3&6n\377\35.h\377\30)d\377" \
+  "\234\31*e\377\2\26'c\377CQ\201\377\202IV\205\377\2HU\204\377IV\205\377" \
+  "\206JW\206\377\3IV\206\377KX\206\377JW\206\377\205KX\206\377\3JW\205" \
+  "\377LY\207\377KX\206\377\205LY\207\377\3LX\207\377LZ\207\377LY\207\377" \
+  "\205LZ\207\377\3KZ\206\377MZ\210\377LZ\207\377\205MZ\210\377\2LY\207" \
+  "\377MZ\210\377\211N[\211\377\3O\\\211\377LY\205\377\33\37/\377\202\0" \
+  "\0\0\377\4\35\35\35\377\334\334\334\377\377\377\377\377\376\376\376\377" \
+  "\250\377\377\377\377\4\376\376\376\377\377\377\377\377\344\344\344\377" \
+  "%%%\377\202\0\0\0\377\2\26\32'\377IU\202\377\206N[\211\377\202MZ\210" \
+  "\377\1LY\207\377\204MZ\210\377\4LZ\207\377MZ\210\377LZ\207\377KZ\206" \
+  "\377\206LZ\207\377\2LY\207\377LX\207\377\206LY\207\377\2KX\206\377JW" \
+  "\205\377\206KX\206\377\2JW\206\377IV\206\377\204JW\206\377\7IV\205\377" \
+  "JW\206\377IV\205\377HU\204\377HU\205\377KX\206\377(8o\377\206\31*e\377" \
+  "\6\27(d\377'7n\377GT\203\377HU\204\377GU\204\377FU\204\377\206GU\204" \
+  "\377\2FT\203\377ES\202\377\206FT\203\377\2ES\203\377DR\203\377\205ES" \
+  "\203\377\2DR\202\377CQ\201\377\204DR\202\377\4CQ\201\377DR\202\377\32" \
+  "+f\377\30)d\377\210\31*e\377\3\30)d\377\32+e\377DR\202\377\203BP\201" \
+  "\377\1BP\177\377\207BP\200\377\1@N\200\377\206AO\200\377\2@N\177\377" \
+  "\77M~\377\206@N\177\377\4\77M~\377>L}\377(8o\377\30)d\377\214\31*e\377" \
+  "\2\30)d\3779Gz\377\205=K}\377\204<K}\377\1%/N\377\202\0\0\0\377\2KKK" \
+  "\377\360\360\360\377\216\377\377\377\377\5\305\305\305\377\27\27\27\377" \
+  "\0\0\0\377\2\4\13\377\26&[\377\202\31*e\377\2\30(b\377\11\20'\377\202" \
+  "\0\0\0\377\3{{{\377\377\377\377\377\376\376\376\377\222\377\377\377\377" \
+  "\1\206\206\206\377\202\0\0\0\377\6\16\22\40\3777Fx\377(8n\377\30)d\377" \
+  "\26&\\\377\4\7\21\377\202\0\0\0\377\1\347\347\347\377\215\377\377\377" \
+  "\377\3\376\376\376\377\377\377\377\377$$$\377\202\0\0\0\377\1*7f\377" \
+  "\2062Av\377\2101Au\377\3""0@u\377&6m\377\27)d\377\227\31*e\377\2\30)" \
+  "c\377\12\22,\377\202\0\0\0\377\1\234\234\234\377\202\377\377\377\377" \
+  "\1\376\376\376\377\213\377\377\377\377\1\367\367\367\377\202\0\0\0\377" \
+  "\2\3\6\17\377\27'_\377\225\31*e\377\2\30)d\377\40""0i\377\203(8o\377" \
+  "\206'7o\377\3&6o\377\35.h\377\30)d\377\233\31*e\377\3\30)d\377\32+f\377" \
+  "JW\206\377\202IV\205\377\3HU\204\377JW\206\377IV\205\377\205JW\206\377" \
+  "\1IV\206\377\207KX\206\377\1JW\205\377\207LY\207\377\1LX\207\377\207" \
+  "LZ\207\377\1KZ\206\377\207MZ\210\377\3LY\207\377N[\211\377MZ\210\377" \
+  "\207N[\211\377\3O\\\211\377N[\211\3774=[\377\203\0\0\0\377\3\275\275" \
+  "\275\377\377\377\377\377\376\376\376\377\252\377\377\377\377\4\376\376" \
+  "\376\377\377\377\377\377\306\306\306\377\3\3\3\377\202\0\0\0\377\2""0" \
+  "8T\377MZ\211\377\204N[\211\377\4MZ\210\377N[\211\377MZ\210\377LY\207" \
+  "\377\206MZ\210\377\2LZ\207\377KZ\206\377\206LZ\207\377\2LY\207\377LX" \
+  "\207\377\206LY\207\377\2KX\206\377JW\205\377\206KX\206\377\2JW\206\377" \
+  "IV\206\377\206JW\206\377\1IV\205\377\202HU\204\377\2JW\206\3772@u\377" \
+  "\206\31*e\377\6\30)d\377\36/h\377GT\203\377HT\204\377GU\204\377FU\204" \
+  "\377\206GU\204\377\2FT\203\377ES\202\377\206FT\203\377\2ES\203\377DR" \
+  "\203\377\205ES\203\377\202DR\202\377\1CQ\201\377\205DR\202\377\2\40""1" \
+  "j\377\30)d\377\211\31*e\377\2\30)d\377@N\177\377\203BP\201\377\1BP\177" \
+  "\377\207BP\200\377\1@N\200\377\205AO\200\377\3@N\177\377AO\200\377\77" \
+  "M~\377\206@N\177\377\202\77M~\377\2+:q\377\30)d\377\214\31*e\377\2\30" \
+  ")d\3775Dx\377\205=K}\377\204<K}\377\1""4Am\377\202\0\0\0\377\2&&&\377" \
+  "\336\336\336\377\216\377\377\377\377\5\343\343\343\377'''\377\0\0\0\377" \
+  "\1\3\7\377\23\40M\377\202\31*e\377\2\26&\\\377\4\7\21\377\202\0\0\0\377" \
+  "\1\314\314\314\377\224\377\377\377\377\13\264\264\264\377\14\14\14\377" \
+  "\0\0\0\377\5\7\14\3772@p\377*:p\377\30)d\377\26%Y\377\0\0\1\377\0\0\0" \
+  "\377\13\13\13\377\217\377\377\377\377\1\364\364\364\377\202\0\0\0\377" \
+  "\2\4\5\11\377/>q\377\2062Av\377\2101Au\377\3""0@u\377(8o\377\27(d\377" \
+  "\227\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216" \
+  "\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377" \
+  "\225\31*e\377\2\30)d\377\36/i\377\203(8o\377\207'7o\377\2\36/h\377\30" \
+  ")d\377\233\31*e\377\6\27(d\377%5m\377JW\206\377HU\204\377IV\205\377H" \
+  "U\204\377\207JW\206\377\1IV\206\377\206KX\206\377\2JW\205\377KX\206\377" \
+  "\206LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\2KZ\206\377LZ\207" \
+  "\377\207MZ\210\377\1LY\207\377\207N[\211\377\5MZ\211\377N[\211\377O\\" \
+  "\211\377MZ\206\377\4\5\10\377\202\0\0\0\377\3\212\212\212\377\377\377" \
+  "\377\377\376\376\376\377\254\377\377\377\377\3\376\376\376\377\377\377" \
+  "\377\377\222\222\222\377\202\0\0\0\377\2\3\3\5\377IV\203\377\207N[\211" \
+  "\377\210MZ\210\377\210LZ\207\377\210LY\207\377\207KX\206\377\2JW\206" \
+  "\377IV\206\377\206JW\206\377\5IV\205\377HU\204\377IV\205\377JW\205\377" \
+  ";I|\377\206\31*e\377\7\30)d\377\26(c\377FS\203\377HU\203\377HU\204\377" \
+  "GU\204\377FU\204\377\205GU\204\377\2FT\203\377ES\202\377\206FT\203\377" \
+  "\2ES\203\377DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\205DR\202" \
+  "\377\2&6n\377\27(d\377\211\31*e\377\2\30)d\377;J|\377\203BP\201\377\2" \
+  "BP\200\377BP\177\377\206BP\200\377\1@N\200\377\207AO\200\377\1\77M~\377" \
+  "\206@N\177\377\202\77M~\377\1-<r\377\202\30)d\377\213\31*e\377\2\30)" \
+  "d\3771Av\377\205=K}\377\205<K}\377\1\4\5\10\377\202\0\0\0\377\1\315\315" \
+  "\315\377\217\377\377\377\377\4""777\377\0\0\0\377\0\1\3\377\17\32>\377" \
+  "\202\31*e\377\1\24#T\377\202\0\0\0\377\1\16\16\16\377\225\377\377\377" \
+  "\377\10\337\337\337\377'''\377\0\0\0\377\3\4\7\377&0U\377-;r\377\30)" \
+  "d\377\23\40M\377\202\0\0\0\377\3CCC\377\377\377\377\377\376\376\376\377" \
+  "\215\377\377\377\377\1\264\264\264\377\202\0\0\0\377\2\17\24$\3770>r" \
+  "\377\2062Av\377\2101Au\377\3""0@u\377):p\377\27(d\377\227\31*e\377\2" \
+  "\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216\377\377\377" \
+  "\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31*e\377" \
+  "\2\30)d\377\36.h\377\203(8o\377\2'7o\377&6o\377\203'7o\377\4'6n\377'" \
+  "7o\377\36/h\377\30)d\377\233\31*e\377\3\27(c\377.=s\377JW\205\377\202" \
+  "IV\205\377\1HU\204\377\206JW\206\377\1IV\206\377\202JW\206\377\205KX" \
+  "\206\377\2JW\205\377KX\206\377\206LY\207\377\2LX\207\377LY\207\377\206" \
+  "LZ\207\377\2KZ\206\377LZ\207\377\206MZ\210\377\1LY\207\377\202MZ\210" \
+  "\377\205N[\211\377\2MZ\211\377N[\211\377\202O\\\211\377\1$*\77\377\202" \
+  "\0\0\0\377\4""222\377\360\360\360\377\377\377\377\377\376\376\376\377" \
+  "\221\377\377\377\377\1\376\376\376\377\210\377\377\377\377\1\376\376" \
+  "\376\377\221\377\377\377\377\4\376\376\376\377\377\377\377\377\365\365" \
+  "\365\377666\377\202\0\0\0\377\1!';\377\207N[\211\377\210MZ\210\377\210" \
+  "LZ\207\377\210LY\207\377\11KX\206\377>Io\37719W\377(/I\377$+A\377%,C" \
+  "\377*1L\3774=]\377AMv\377\206JW\206\377\204IV\205\377\1CP\201\377\207" \
+  "\31*e\377\2\26'c\377\77M}\377\202HU\204\377\2GU\204\377FU\204\377\205" \
+  "GU\204\377\1FT\203\377\202ES\202\377\204FT\203\377\14=Ir\3771;^\377)" \
+  "2P\377%,F\377\")A\377!(@\377\")A\377%,F\377)2O\377.8Y\3775@g\377@Mz\377" \
+  "\204DR\202\377\2,<q\377\27(c\377\211\31*e\377\3\30)d\3776Dx\377CQ\201" \
+  "\377\202BP\201\377\2BP\200\377BP\177\377\206BP\200\377\1@N\200\377\207" \
+  "AO\200\377\1\77M~\377\206@N\177\377\202\77M~\377\21/>t\377\31*e\377\30" \
+  ")d\377\31*e\377\26%Y\377\21\35G\377\16\30;\377\14\25""3\377\14\24""1" \
+  "\377\14\25""4\377\16\31<\377\22\37K\377\27'_\377\31*e\377\30)d\377/>" \
+  "t\377>L}\377\204=K}\377\205<K}\377\1\23\30(\377\202\0\0\0\377\2\244\244" \
+  "\244\377\376\376\376\377\216\377\377\377\377\1]]]\377\202\0\0\0\377\1" \
+  "\13\24""0\377\202\31*e\377\1\16\30:\377\202\0\0\0\377\3]]]\377\377\377" \
+  "\377\377\376\376\376\377\224\377\377\377\377\1DDD\377\202\0\0\0\377\4" \
+  "\32!:\377.>s\377\30)d\377\16\27""8\377\202\0\0\0\377\1\200\200\200\377" \
+  "\217\377\377\377\377\1ooo\377\202\0\0\0\377\2\32\">\3770\77t\377\206" \
+  "2Av\377\2101Au\377\3""0@u\377+;q\377\27(d\377\207\31*e\377\7\24\"S\377" \
+  "\17\31=\377\14\25""3\377\14\24""1\377\16\27""9\377\22\36J\377\27(`\377" \
+  "\211\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216" \
+  "\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27(`\377" \
+  "\225\31*e\377\2\30)d\377\35.h\377\204(8o\377\1&6o\377\205'7o\377\2\37" \
+  "/i\377\30)e\377\233\31*e\377\2\26'c\3778Fy\377\202IV\205\377\2HU\204" \
+  "\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377\206KX\206\377\2JW" \
+  "\205\377KX\206\377\206LY\207\377\2LX\207\377LY\207\377\205LZ\207\377" \
+  "\1KZ\206\377\202LZ\207\377\205MZ\210\377\1LY\207\377\202MZ\210\377\206" \
+  "N[\211\377\5MZ\211\377O\\\211\377N[\211\377IU\177\377\4\5\10\377\202" \
+  "\0\0\0\377\1\247\247\247\377\223\377\377\377\377\14\370\370\370\377\341" \
+  "\341\341\377\251\251\251\377ggg\377\77\77\77\377...\377222\377III\377" \
+  "uuu\377\275\275\275\377\345\345\345\377\374\374\374\377\223\377\377\377" \
+  "\377\1\260\260\260\377\202\0\0\0\377\2\2\3\4\377HT\177\377\203N[\211" \
+  "\377\5MY\207\3772:X\377%+A\377$+A\377$*@\377\206$+A\377\2$+@\377#+@\377" \
+  "\206$+@\377\3$*@\377#)\77\377/7S\377\202JW\204\377\3BMv\377/7T\377\24" \
+  "\27$\377\211\0\0\0\377\4\3\4\6\377\32\36/\3775>`\377CNy\377\202IV\205" \
+  "\377\1JW\206\377\203IV\205\377\3JW\206\377\32+f\377\30)d\377\205\31*" \
+  "e\377\6\26'c\3776Ex\377IU\204\377HU\204\377GU\204\377FU\204\377\204G" \
+  "U\204\377\7FT\203\377GU\204\377BP}\377<Hr\3772<^\377\35#7\377\14\16\27" \
+  "\377\215\0\0\0\377\6\2\2\4\377\17\22\36\377\37&<\3771<_\377+8i\377\25" \
+  "&^\377\211\31*e\377\3\30)d\3771Au\377CQ\201\377\202BP\201\377\3BP\200" \
+  "\3770:]\377\37%<\377\205\37&=\377\1\36%=\377\207\37%=\377\1\36$<\377" \
+  "\204\36%<\377\10%-J\377<Ix\377@N\177\377>L|\377,8h\377\20\33A\377\7\14" \
+  "\36\377\0\1\3\377\211\0\0\0\377\4\3\5\15\377\13\22.\377#0\\\377:Hv\377" \
+  "\204=K}\377\205<K}\377\1#,J\377\202\0\0\0\377\2hhh\377\375\375\375\377" \
+  "\216\377\377\377\377\7\217\217\217\377\1\1\1\377\0\0\0\377\10\16#\377" \
+  "\30)b\377\31*e\377\6\13\32\377\202\0\0\0\377\1\264\264\264\377\224\377" \
+  "\377\377\377\11\376\376\376\377\377\377\377\377\204\204\204\377\2\2\2" \
+  "\377\0\0\0\377\20\25$\377.<o\377\30)d\377\10\16\"\377\202\0\0\0\377\1" \
+  "\273\273\273\377\217\377\377\377\377\1,,,\377\202\0\0\0\377\3$/U\377" \
+  "-;l\377\26\35""5\377\205\27\37""8\377\210\27\37""7\377\3\26\36""7\377" \
+  "\25\34""6\377\13\23/\377\202\13\24""0\377\5\13\23/\377\23\40O\377\24" \
+  "#T\377\12\21+\377\0\1\3\377\207\0\0\0\377\6\4\7\22\377\15\26""6\377\25" \
+  "#U\377\30)c\377\24\"R\377\13\23.\377\203\13\24""0\377\2\13\23/\377\5" \
+  "\10\25\377\202\0\0\0\377\1\225\225\225\377\216\377\377\377\377\1\367" \
+  "\367\367\377\202\0\0\0\377\2\1\3\7\377\13\23-\377\206\13\24""0\377\2" \
+  "\13\23-\377\23!O\377\215\31*e\377\2\30)d\377\35-g\377\204(8o\377\1&6" \
+  "o\377\205'7o\377\2\37/i\377\31)e\377\233\31*e\377\2\25&b\377@N\177\377" \
+  "\202IV\205\377\1HU\204\377\202IV\205\377\205JW\206\377\2IV\206\377JW" \
+  "\206\377\206KX\206\377\2JW\205\377KX\206\377\205LY\207\377\1LX\207\377" \
+  "\202LY\207\377\205LZ\207\377\2KZ\206\377LZ\207\377\206MZ\210\377\2LY" \
+  "\207\377MZ\210\377\206N[\211\377\1MZ\211\377\202N[\211\377\6O\\\211\377" \
+  "*1I\377\1\1\2\377\0\0\0\377555\377\352\352\352\377\220\377\377\377\377" \
+  "\5\376\376\376\377\377\377\377\377\330\330\330\377lll\377\20\20\20\377" \
+  "\210\0\0\0\377\5\"\"\"\377~~~\377\345\345\345\377\377\377\377\377\376" \
+  "\376\376\377\220\377\377\377\377\5\353\353\353\377:::\377\0\0\0\377\0" \
+  "\1\1\377'.F\377\203N[\211\377\2LX\205\377\26\32'\377\223\0\0\0\377\4" \
+  "\24\27$\3778Bd\377\40&9\377\6\7\13\377\216\0\0\0\377\4\13\15\25\377&" \
+  "-E\377AMv\377JW\206\377\202IV\205\377\4HU\204\377LX\207\377!1j\377\30" \
+  ")d\377\205\31*e\377\6\27(c\377.>s\377IV\205\377HU\204\377GU\204\377F" \
+  "U\204\377\204GU\204\377\4@Mw\377,5R\377\27\34,\377\4\5\11\377\224\0\0" \
+  "\0\377\4\4\5\10\377\7\15!\377\17\31>\377\26%Y\377\207\31*e\377\3\30)" \
+  "d\377-=s\377CQ\202\377\202BP\201\377\2BP\200\377\37%;\377\223\0\0\0\377" \
+  "\5\13\15\26\377<Ix\3774\77h\377\34\"8\377\4\6\12\377\217\0\0\0\377\2" \
+  "\22\26%\377)2T\377\203=K}\377\205<K}\377\1""4Am\377\202\0\0\0\377\3," \
+  ",,\377\375\375\375\377\376\376\376\377\215\377\377\377\377\6\300\300" \
+  "\300\377\3\3\3\377\0\0\0\377\5\11\27\377\26&\\\377\30)b\377\203\0\0\0" \
+  "\377\1\364\364\364\377\226\377\377\377\377\7\314\314\314\377\4\4\4\377" \
+  "\0\0\0\377\7\11\20\377)7d\377\30)d\377\3\5\14\377\202\0\0\0\377\1\355" \
+  "\355\355\377\216\377\377\377\377\6\365\365\365\377\7\7\7\377\0\0\0\377" \
+  "\3\5\11\377*6b\377)6d\377\224\0\0\0\377\2\5\11\25\377\1\2\5\377\213\0" \
+  "\0\0\377\3\0\0\2\377\11\17%\377\11\20'\377\210\0\0\0\377\1\225\225\225" \
+  "\377\216\377\377\377\377\1\367\367\367\377\213\0\0\0\377\1\16\30:\377" \
+  "\215\31*e\377\2\30)d\377\34-g\377\204(8o\377\1&6o\377\205'7o\377\1\37" \
+  "0i\377\233\31*e\377\202\30)d\377\1ER\202\377\202IV\205\377\2HU\204\377" \
+  "IV\205\377\206JW\206\377\2IV\206\377JW\206\377\205KX\206\377\1JW\205" \
+  "\377\202KX\206\377\205LY\207\377\2LX\207\377LY\207\377\206LZ\207\377" \
+  "\2KZ\206\377LZ\207\377\206MZ\210\377\2LY\207\377MZ\210\377\206N[\211" \
+  "\377\10MZ\211\377N[\211\377O\\\211\377KX\203\377\24\30#\377\0\0\0\377" \
+  "\3\3\3\377\202\202\202\377\220\377\377\377\377\4\376\376\376\377\377" \
+  "\377\377\377\265\265\265\377\34\34\34\377\214\0\0\0\377\4***\377\321" \
+  "\321\321\377\377\377\377\377\376\376\376\377\220\377\377\377\377\5\205" \
+  "\205\205\377\3\3\3\377\0\0\0\377\22\25\40\377JW\203\377\202N[\211\377" \
+  "\2LX\205\377\30\34+\377\223\0\0\0\377\2\6\7\13\377\7\10\15\377\205\0" \
+  "\0\0\377\10:::\377eee\377\200\200\200\377\213\213\213\377\212\212\212" \
+  "\377|||\377___\377222\377\205\0\0\0\377\2\13\14\23\377/7V\377\203IV\205" \
+  "\377\3KX\206\377*9p\377\27)d\377\205\31*e\377\6\27(d\377'6n\377JV\205" \
+  "\377HU\204\377GU\204\377FU\204\377\202GU\204\377\4FT\202\377#*B\377\13" \
+  "\15\24\377\1\1\2\377\205\0\0\0\377\15\20\20\20\377:::\377ZZZ\377rrr\377" \
+  "\202\202\202\377\212\212\212\377\215\215\215\377\212\212\212\377\201" \
+  "\201\201\377ttt\377```\377GGG\377'''\377\206\0\0\0\377\4\0\0\1\377\4" \
+  "\7\21\377\14\24""1\377\30(a\377\205\31*e\377\3\30)d\377)9p\377CQ\202" \
+  "\377\202BP\201\377\2BP\200\377\40'>\377\223\0\0\0\377\3\15\20\33\377" \
+  "\37%=\377\10\11\17\377\205\0\0\0\377\11...\377YYY\377vvv\377\207\207" \
+  "\207\377\214\214\214\377\207\207\207\377uuu\377SSS\377\37\37\37\377\204" \
+  "\0\0\0\377\4\2\3\5\377\23\30(\3779Fu\377=K}\377\206<K}\377\1\3\4\7\377" \
+  "\202\0\0\0\377\1\365\365\365\377\216\377\377\377\377\6\364\364\364\377" \
+  "\2\2\2\377\0\0\0\377\2\4\13\377\25$W\377\21\35G\377\202\0\0\0\377\3C" \
+  "CC\377\374\374\374\377\376\376\376\377\226\377\377\377\377\1\24\24\24" \
+  "\377\202\0\0\0\377\2&1W\377\27(b\377\202\0\0\0\377\3\35\35\35\377\370" \
+  "\370\370\377\376\376\376\377\215\377\377\377\377\6\274\274\274\377\6" \
+  "\6\6\377\0\0\0\377\11\14\30\377.<l\377*7d\377\230\0\0\0\377\7;;;\377" \
+  "ooo\377\210\210\210\377\214\214\214\377xxx\377QQQ\377\23\23\23\377\204" \
+  "\0\0\0\377\1\0\0\1\377\210\0\0\0\377\1\220\220\220\377\216\377\377\377" \
+  "\377\1\366\366\366\377\213\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)" \
+  "d\377\33,g\377\204(8o\377\1&6o\377\205'7o\377\1\37""0j\377\233\31*e\377" \
+  "\3\30)d\377\35.h\377FS\203\377\202IV\205\377\2HU\204\377IV\205\377\205" \
+  "JW\206\377\202IV\206\377\1JW\206\377\205KX\206\377\2JW\205\377KX\206" \
+  "\377\206LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\2KZ\206\377LZ" \
+  "\207\377\205MZ\210\377\202LY\207\377\1MZ\210\377\205N[\211\377\202MZ" \
+  "\211\377\11N[\211\377O\\\211\377>Hk\377\7\10\14\377\0\0\0\377\15\15\15" \
+  "\377\335\335\335\377\377\377\377\377\376\376\376\377\215\377\377\377" \
+  "\377\3\376\376\376\377\377\377\377\377\264\264\264\377\204\0\0\0\377" \
+  "\10\24\27#\3775=Z\377GRy\377MY\203\377KX\201\377BMq\377.5N\377\13\15" \
+  "\24\377\203\0\0\0\377\4\6\6\6\377\330\330\330\377\377\377\377\377\376" \
+  "\376\376\377\215\377\377\377\377\7\376\376\376\377\377\377\377\377\327" \
+  "\327\327\377\22\22\22\377\0\0\0\377\7\10\14\377<Fj\377\202N[\211\377" \
+  "\6LX\205\377\30\34+\377\0\0\0\377\2\2\2\377___\377\237\237\237\377\213" \
+  "\232\232\232\377\2\235\235\235\377{{{\377\206\0\0\0\377\7""333\377\254" \
+  "\254\254\377\364\364\364\377\370\370\370\377\372\372\372\377\374\374" \
+  "\374\377\375\375\375\377\202\374\374\374\377\5\372\372\372\377\370\370" \
+  "\370\377\355\355\355\377\235\235\235\377\36\36\36\377\204\0\0\0\377\1" \
+  "\34\"4\377\202IV\205\377\3JW\206\3771@u\377\27(d\377\205\31*e\377\4\30" \
+  ")d\377\40""1i\377JW\205\377HU\204\377\203GU\204\377\3""4\77b\377\10\12" \
+  "\17\377\0\1\1\377\204\0\0\0\377\7""888\377\225\225\225\377\340\340\340" \
+  "\377\366\366\366\377\370\370\370\377\372\372\372\377\373\373\373\377" \
+  "\202\374\374\374\377\1\375\375\375\377\202\374\374\374\377\10\373\373" \
+  "\373\377\372\372\372\377\371\371\371\377\367\367\367\377\363\363\363" \
+  "\377\317\317\317\377\206\206\206\377111\377\205\0\0\0\377\2\3\5\16\377" \
+  "\24!P\377\204\31*e\377\3\30)d\377&6n\377DR\202\377\202BP\201\377\2BP" \
+  "\200\377\40'>\377\202\0\0\0\377\2DDD\377\241\241\241\377\213\232\232" \
+  "\232\377\2\234\234\234\377\207\207\207\377\202\0\0\0\377\202\0\0\1\377" \
+  "\203\0\0\0\377\12...\377\240\240\240\377\360\360\360\377\370\370\370" \
+  "\377\372\372\372\377\373\373\373\377\374\374\374\377\375\375\375\377" \
+  "\374\374\374\377\373\373\373\377\202\371\371\371\377\3\332\332\332\377" \
+  "ppp\377\1\1\1\377\203\0\0\0\377\3\11\14\24\3775Am\377=K}\377\205<K}\377" \
+  "\1\22\26%\377\202\0\0\0\377\1\272\272\272\377\217\377\377\377\377\1\34" \
+  "\34\34\377\202\0\0\0\377\2\24\"S\377\11\17$\377\202\0\0\0\377\2\214\214" \
+  "\214\377\375\375\375\377\225\377\377\377\377\3\376\376\376\377\377\377" \
+  "\377\377___\377\202\0\0\0\377\2\33\"=\377\22\37L\377\202\0\0\0\377\2" \
+  "MMM\377\372\372\372\377\214\377\377\377\377\10\376\376\376\377\377\377" \
+  "\377\377\206\206\206\377\3\3\3\377\0\0\0\377\16\23&\3773Bw\377*7d\377" \
+  "\202\0\0\0\377\2)))\377\226\226\226\377\214\232\232\232\377\2\226\226" \
+  "\226\377>>>\377\204\0\0\0\377\7aaa\377\346\346\346\377\371\371\371\377" \
+  "\373\373\373\377\374\374\374\377\375\375\375\377\373\373\373\377\202" \
+  "\371\371\371\377\2\306\306\306\377SSS\377\205\0\0\0\377\2\77\77\77\377" \
+  "\227\227\227\377\203\232\232\232\377\2\230\230\230\377\324\324\324\377" \
+  "\216\377\377\377\377\2\374\374\374\377\225\225\225\377\206\232\232\232" \
+  "\377\2\235\235\235\377OOO\377\202\0\0\0\377\1\16\31<\377\215\31*e\377" \
+  "\2\30)d\377\33+g\377\204(8o\377\1&6o\377\205'7o\377\1\40""1j\377\233" \
+  "\31*e\377\3\30)d\377\"3k\377FS\203\377\202IV\205\377\2HU\204\377IV\205" \
+  "\377\205JW\206\377\2IV\206\377JW\206\377\206KX\206\377\2JW\205\377KX" \
+  "\206\377\206LY\207\377\2LX\207\377LY\207\377\205LZ\207\377\1KZ\206\377" \
+  "\202LZ\207\377\205MZ\210\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377" \
+  "\204N[\211\377\5MZ\211\377N[\211\377O\\\211\377N[\211\37708S\377\202" \
+  "\0\0\0\377\3""888\377\377\377\377\377\376\376\376\377\215\377\377\377" \
+  "\377\4\376\376\376\377\377\377\377\377\327\327\327\377\13\13\13\377\202" \
+  "\0\0\0\377\2\10\12\17\377=Gh\377\202R_\213\377\1Q^\212\377\202R_\213" \
+  "\377\203Q^\212\377\2""2:V\377\4\5\10\377\202\0\0\0\377\4\24\24\24\377" \
+  "\355\355\355\377\377\377\377\377\376\376\376\377\217\377\377\377\377" \
+  "\1""444\377\202\0\0\0\377\1.6R\377\202N[\211\377\5LX\205\377\30\34+\377" \
+  "\0\0\0\377\4\4\4\377\241\241\241\377\215\377\377\377\377\1\320\320\320" \
+  "\377\204\0\0\0\377\2%%%\377\265\265\265\377\203\377\377\377\377\1\376" \
+  "\376\376\377\206\377\377\377\377\1\376\376\376\377\203\377\377\377\377" \
+  "\2\241\241\241\377\32\32\32\377\203\0\0\0\377\5\30\35,\377FS\201\377" \
+  "JW\205\3778Fy\377\27(c\377\205\31*e\377\7\30)d\377\33+f\377JW\205\377" \
+  "GT\203\377HU\204\377DQ~\377&-F\377\203\0\0\0\377\4\2\2\2\377\32\32\32" \
+  "\377vvv\377\351\351\351\377\203\377\377\377\377\1\376\376\376\377\213" \
+  "\377\377\377\377\1\376\376\376\377\204\377\377\377\377\4\346\346\346" \
+  "\377qqq\377\35\35\35\377\2\2\2\377\203\0\0\0\377\2\16\27""9\377\30)c" \
+  "\377\202\31*e\377\3\30)d\377#3k\377DR\202\377\202BP\201\377\2BP\200\377" \
+  "\40'>\377\202\0\0\0\377\1rrr\377\215\377\377\377\377\1\345\345\345\377" \
+  "\204\0\0\0\377\3\1\1\1\377'''\377\257\257\257\377\203\377\377\377\377" \
+  "\1\376\376\376\377\207\377\377\377\377\1\376\376\376\377\202\377\377" \
+  "\377\377\3\355\355\355\377UUU\377\5\5\5\377\202\0\0\0\377\2\14\17\32" \
+  "\3776Bo\377\205<K}\377\1\40)D\377\202\0\0\0\377\3ttt\377\377\377\377" \
+  "\377\376\376\376\377\215\377\377\377\377\1WWW\377\202\0\0\0\377\2\20" \
+  "\34D\377\1\2\5\377\202\0\0\0\377\1\307\307\307\377\230\377\377\377\377" \
+  "\1\267\267\267\377\202\0\0\0\377\2\15\21\36\377\14\25""4\377\202\0\0" \
+  "\0\377\2}}}\377\374\374\374\377\216\377\377\377\377\1QQQ\377\202\0\0" \
+  "\0\377\3\25\34""7\3773Bw\377*6d\377\202\0\0\0\377\2GGG\377\375\375\375" \
+  "\377\214\377\377\377\377\2\375\375\375\377hhh\377\202\0\0\0\377\2\21" \
+  "\21\21\377\244\244\244\377\202\377\377\377\377\1\376\376\376\377\204" \
+  "\377\377\377\377\202\376\376\376\377\202\377\377\377\377\2\343\343\343" \
+  "\377>>>\377\203\0\0\0\377\1kkk\377\206\377\377\377\377\1\376\376\376" \
+  "\377\214\377\377\377\377\1\376\376\376\377\211\377\377\377\377\1\205" \
+  "\205\205\377\202\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\32+f" \
+  "\377\204(8o\377\1&6o\377\205'7o\377\1\40""1j\377\233\31*e\377\3\27)d" \
+  "\377'7n\377GT\203\377\202IV\205\377\2HU\204\377IV\205\377\205JW\206\377" \
+  "\2IV\206\377JW\206\377\206KX\206\377\2JW\205\377KX\206\377\205LY\207" \
+  "\377\1LX\207\377\202LY\207\377\205LZ\207\377\4KZ\206\377LZ\207\377MZ" \
+  "\210\377LZ\207\377\204MZ\210\377\2LY\207\377MZ\210\377\206N[\211\377" \
+  "\5MZ\211\377N[\211\377O\\\211\377LY\205\377\34!1\377\202\0\0\0\377\3" \
+  "\231\231\231\377\377\377\377\377\376\376\376\377\216\377\377\377\377" \
+  "\2\371\371\371\377SSS\377\202\0\0\0\377\3\13\15\24\377DOt\377Q^\212\377" \
+  "\207R_\213\377\4Q^\212\377P]\211\377=Gi\377\10\11\16\377\202\0\0\0\377" \
+  "\1aaa\377\217\377\377\377\377\3\376\376\376\377\377\377\377\377\214\214" \
+  "\214\377\202\0\0\0\377\10\35\"4\377KX\204\377N[\211\377LX\205\377\30" \
+  "\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\215\377\377\377\377\1\314" \
+  "\314\314\377\202\0\0\0\377\3\2\2\2\377fff\377\367\367\367\377\202\377" \
+  "\377\377\377\1\376\376\376\377\212\377\377\377\377\202\376\376\376\377" \
+  "\3\377\377\377\377\350\350\350\377XXX\377\203\0\0\0\377\4\36#6\377GT" \
+  "\202\377=L}\377\26'c\377\205\31*e\377\202\30)d\377\4HV\204\377HU\204" \
+  "\377AMw\377\31\36.\377\203\0\0\0\377\3!!!\377\177\177\177\377\354\354" \
+  "\354\377\202\377\377\377\377\1\376\376\376\377\225\377\377\377\377\3" \
+  "\353\353\353\377\177\177\177\377!!!\377\203\0\0\0\377\12\11\17&\377\27" \
+  "'^\377\31*e\377\30)d\377\40""1j\377DR\202\377AO\200\377BP\201\377BP\200" \
+  "\377\40'>\377\202\0\0\0\377\1ppp\377\215\377\377\377\377\1\340\340\340" \
+  "\377\203\0\0\0\377\3\7\7\7\377nnn\377\363\363\363\377\202\377\377\377" \
+  "\377\1\376\376\376\377\213\377\377\377\377\1\376\376\376\377\202\377" \
+  "\377\377\377\2\223\223\223\377\12\12\12\377\202\0\0\0\377\2\23\30(\377" \
+  ";J|\377\204<K}\377\1.9`\377\202\0\0\0\377\3,,,\377\377\377\377\377\376" \
+  "\376\376\377\215\377\377\377\377\1\222\222\222\377\202\0\0\0\377\1\5" \
+  "\12\30\377\202\0\0\0\377\2***\377\337\337\337\377\230\377\377\377\377" \
+  "\1\374\374\374\377\202\0\0\0\377\2\1\2\4\377\5\11\27\377\202\0\0\0\377" \
+  "\2\254\254\254\377\376\376\376\377\215\377\377\377\377\7\360\360\360" \
+  "\377444\377\0\0\0\377\1\2\4\377\34&K\3773Bw\377*6d\377\202\0\0\0\377" \
+  "\2EEE\377\370\370\370\377\214\377\377\377\377\5\367\367\367\377fff\377" \
+  "\0\0\0\377\6\6\6\377\255\255\255\377\202\377\377\377\377\1\376\376\376" \
+  "\377\212\377\377\377\377\1TTT\377\203\0\0\0\377\2iii\377\371\371\371" \
+  "\377\234\377\377\377\377\1\203\203\203\377\202\0\0\0\377\1\16\31<\377" \
+  "\215\31*e\377\2\30)d\377\32,f\377\204(8o\377\1&6o\377\205'7o\377\1!1" \
+  "k\377\233\31*e\377\5\27(d\377+:p\377GT\204\377IV\205\377HU\204\377\202" \
+  "IV\205\377\205JW\206\377\2IV\206\377JW\206\377\206KX\206\377\2JW\205" \
+  "\377KX\206\377\205LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377" \
+  "\204LZ\207\377\2KZ\206\377LZ\207\377\206MZ\210\377\2LY\207\377MZ\210" \
+  "\377\207N[\211\377\202O\\\211\377\2JV\201\377\13\14\23\377\202\0\0\0" \
+  "\377\1\355\355\355\377\220\377\377\377\377\5\306\306\306\377\16\16\16" \
+  "\377\0\0\0\377\1\1\2\3778A`\377\210R_\213\377\11Q^\212\377R_\213\377" \
+  "Q^\212\377P]\211\37719S\377\2\2\3\377\0\0\0\377\31\31\31\377\315\315" \
+  "\315\377\220\377\377\377\377\1\335\335\335\377\202\0\0\0\377\10\16\20" \
+  "\31\377GS\177\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377" \
+  "\235\235\235\377\215\377\377\377\377\7\314\314\314\377\0\0\0\377\3\3" \
+  "\3\377\204\204\204\377\374\374\374\377\377\377\377\377\376\376\376\377" \
+  "\220\377\377\377\377\2\367\367\367\377vvv\377\203\0\0\0\377\3*1L\377" \
+  "CP\201\377\26'c\377\206\31*e\377\4\30)d\377DQ\201\377@Lv\377\21\24\40" \
+  "\377\203\0\0\0\377\2___\377\324\324\324\377\230\377\377\377\377\202\376" \
+  "\376\376\377\202\377\377\377\377\2\322\322\322\377QQQ\377\203\0\0\0\377" \
+  "\5\10\15\40\377\30(a\377\31*e\377\37""0i\377CQ\201\377\202BP\201\377" \
+  "\2BP\200\377\40'>\377\202\0\0\0\377\1ppp\377\215\377\377\377\377\1\340" \
+  "\340\340\377\202\0\0\0\377\2\20\20\20\377\246\246\246\377\202\377\377" \
+  "\377\377\1\376\376\376\377\216\377\377\377\377\1\376\376\376\377\202" \
+  "\377\377\377\377\1\261\261\261\377\203\0\0\0\377\1\40)D\377\204<K}\377" \
+  "\2""4Am\377\4\5\11\377\202\0\0\0\377\1\372\372\372\377\216\377\377\377" \
+  "\377\1\317\317\317\377\205\0\0\0\377\2VVV\377\370\370\370\377\227\377" \
+  "\377\377\377\3\376\376\376\377\377\377\377\377GGG\377\202\0\0\0\377\4" \
+  "\0\0\1\377\0\0\0\377\7\7\7\377\307\307\307\377\216\377\377\377\377\7" \
+  "\317\317\317\377\36\36\36\377\0\0\0\377\2\3\10\377#1_\3773Bw\377*6d\377" \
+  "\202\0\0\0\377\2EEE\377\370\370\370\377\214\377\377\377\377\5\367\367" \
+  "\367\377fff\377\0\0\0\377\233\233\233\377\377\377\377\377\202\376\376" \
+  "\376\377\212\377\377\377\377\2\310\310\310\377\25\25\25\377\203\0\0\0" \
+  "\377\2iii\377\371\371\371\377\234\377\377\377\377\1\203\203\203\377\202" \
+  "\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\32+f\377\204(8o\377\1" \
+  "&6o\377\205'7o\377\1!1j\377\233\31*e\377\6\27(d\377-<r\377HU\204\377" \
+  "IV\205\377HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377\206" \
+  "KX\206\377\2JW\205\377KX\206\377\205LY\207\377\2LX\207\377LY\207\377" \
+  "\206LZ\207\377\2KZ\206\377LZ\207\377\210MZ\210\377\207N[\211\377\202" \
+  "O\\\211\377\1GS|\377\202\0\0\0\377\1\36\36\36\377\220\377\377\377\377" \
+  "\2\374\374\374\377\202\202\202\377\202\0\0\0\377\1\23\26\40\377\213R" \
+  "_\213\377\202Q^\212\377\2P]\211\377\15\20\27\377\202\0\0\0\377\2\217" \
+  "\217\217\377\376\376\376\377\220\377\377\377\377\12\12\12\12\377\0\0" \
+  "\0\377\0\0\1\377EP{\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4" \
+  "\4\377\235\235\235\377\215\377\377\377\377\3\314\314\314\377\0\0\0\377" \
+  "ttt\377\202\377\377\377\377\1\376\376\376\377\217\377\377\377\377\202" \
+  "\376\376\376\377\202\377\377\377\377\1jjj\377\203\0\0\0\377\3<Gn\377" \
+  "\26'c\377\30)e\377\205\31*e\377\3\30)d\377<Iw\377\25\31&\377\202\0\0" \
+  "\0\377\3\1\1\1\377\203\203\203\377\366\366\366\377\202\377\377\377\377" \
+  "\1\376\376\376\377\230\377\377\377\377\1\376\376\376\377\202\377\377" \
+  "\377\377\2\375\375\375\377lll\377\203\0\0\0\377\4\11\20'\377\31*e\377" \
+  "\37/i\377BO\200\377\202BP\201\377\2BP\200\377\40'>\377\202\0\0\0\377" \
+  "\1ppp\377\215\377\377\377\377\4\340\340\340\377\0\0\0\377\15\15\15\377" \
+  "\262\262\262\377\202\377\377\377\377\1\376\376\376\377\220\377\377\377" \
+  "\377\1\376\376\376\377\202\377\377\377\377\1\232\232\232\377\202\0\0" \
+  "\0\377\2\1\1\2\3777Dr\377\203<K}\377\2""7Es\377\16\22\36\377\202\0\0" \
+  "\0\377\1\277\277\277\377\217\377\377\377\377\204\0\0\0\377\2\1\1\1\377" \
+  "\206\206\206\377\232\377\377\377\377\1\231\231\231\377\204\0\0\0\377" \
+  "\2$$$\377\331\331\331\377\216\377\377\377\377\7\257\257\257\377\10\10" \
+  "\10\377\0\0\0\377\3\5\14\377*9p\3773Bw\377*6d\377\202\0\0\0\377\2EEE" \
+  "\377\370\370\370\377\214\377\377\377\377\6\367\367\367\377^^^\377MMM" \
+  "\377\367\367\367\377\377\377\377\377\376\376\376\377\212\377\377\377" \
+  "\377\2\374\374\374\377\200\200\200\377\204\0\0\0\377\2iii\377\371\371" \
+  "\371\377\234\377\377\377\377\1\203\203\203\377\202\0\0\0\377\1\16\31" \
+  "<\377\215\31*e\377\2\30)d\377\31+f\377\204(8o\377\1&6o\377\205'7o\377" \
+  "\1!1j\377\233\31*e\377\6\27(c\3770\77u\377HU\204\377IV\205\377HU\204" \
+  "\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377\205KX\206\377\1JW" \
+  "\205\377\202KX\206\377\205LY\207\377\2LX\207\377LY\207\377\206LZ\207" \
+  "\377\2KZ\206\377LZ\207\377\207MZ\210\377\2N[\211\377MZ\210\377\206N[" \
+  "\211\377\202O\\\211\377\1""9Bb\377\202\0\0\0\377\1\\\\\\\377\217\377" \
+  "\377\377\377\3\376\376\376\377\364\364\364\377:::\377\202\0\0\0\377\1" \
+  "9Ba\377\215R_\213\377\2Q^\212\37708S\377\202\0\0\0\377\2KKK\377\363\363" \
+  "\363\377\220\377\377\377\377\1EEE\377\202\0\0\0\377\7<Fk\377N[\211\377" \
+  "LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\215\377\377" \
+  "\377\377\2\311\311\311\377LLL\377\202\377\377\377\377\1\376\376\376\377" \
+  "\223\377\377\377\377\3\376\376\376\377\377\377\377\377<<<\377\202\0\0" \
+  "\0\377\3\13\14\23\377\27(c\377\30)d\377\205\31*e\377\2\27(c\377\35$<" \
+  "\377\202\0\0\0\377\2\5\5\5\377\200\200\200\377\237\377\377\377\377\202" \
+  "\376\376\376\377\2\377\377\377\377uuu\377\203\0\0\0\377\3\16\30;\377" \
+  "\37/i\377@N\200\377\202BP\201\377\2BP\200\377\40'>\377\202\0\0\0\377" \
+  "\1ppp\377\215\377\377\377\377\5\337\337\337\377\6\6\6\377\237\237\237" \
+  "\377\377\377\377\377\376\376\376\377\224\377\377\377\377\3\376\376\376" \
+  "\377\357\357\357\377CCC\377\202\0\0\0\377\1\31\37""4\377\203<K}\377\2" \
+  ":Iz\377\30\36""2\377\202\0\0\0\377\3\200\200\200\377\377\377\377\377" \
+  "\376\376\376\377\213\377\377\377\377\3\376\376\376\377\377\377\377\377" \
+  "***\377\203\0\0\0\377\2\20\20\20\377\274\274\274\377\214\377\377\377" \
+  "\377\1\372\372\372\377\202\376\376\376\377\213\377\377\377\377\1\333" \
+  "\333\333\377\204\0\0\0\377\2AAA\377\354\354\354\377\216\377\377\377\377" \
+  "\1\213\213\213\377\202\0\0\0\377\4\10\15!\377)9p\3773Bw\377*6d\377\202" \
+  "\0\0\0\377\2EEE\377\370\370\370\377\214\377\377\377\377\3\367\367\367" \
+  "\377ttt\377\302\302\302\377\215\377\377\377\377\2\353\353\353\377\"\"" \
+  "\"\377\204\0\0\0\377\2iii\377\371\371\371\377\234\377\377\377\377\1\203" \
+  "\203\203\377\202\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\31+e" \
+  "\377\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233\31*e\377\6\27(c\377" \
+  "2Av\377HU\204\377IV\205\377HU\204\377IV\205\377\206JW\206\377\2IV\206" \
+  "\377JW\206\377\205KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377" \
+  "\204LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\2KZ\206\377LZ\207" \
+  "\377\207MZ\210\377\210N[\211\377\202O\\\211\377\1*1I\377\202\0\0\0\377" \
+  "\1\221\221\221\377\220\377\377\377\377\2\354\354\354\377\1\1\1\377\202" \
+  "\0\0\0\377\216R_\213\377\2Q^\212\377MY\204\377\202\0\0\0\377\3\23\23" \
+  "\23\377\352\352\352\377\376\376\376\377\217\377\377\377\377\1xxx\377" \
+  "\202\0\0\0\377\7.6S\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4" \
+  "\4\377\235\235\235\377\215\377\377\377\377\4\344\344\344\377\374\374" \
+  "\374\377\377\377\377\377\376\376\376\377\224\377\377\377\377\4\376\376" \
+  "\376\377\377\377\377\377\321\321\321\377\24\24\24\377\202\0\0\0\377\2" \
+  "\15\27""8\377\30)d\377\205\31*e\377\1\20\34F\377\203\0\0\0\377\1}}}\377" \
+  "\202\377\377\377\377\1\376\376\376\377\236\377\377\377\377\202\376\376" \
+  "\376\377\2\377\377\377\377nnn\377\203\0\0\0\377\2\27$Q\377\77M\177\377" \
+  "\202BP\201\377\2BP\200\377\40'>\377\202\0\0\0\377\1ppp\377\215\377\377" \
+  "\377\377\4\336\336\336\377\215\215\215\377\377\377\377\377\376\376\376" \
+  "\377\227\377\377\377\377\5\242\242\242\377\6\6\6\377\0\0\0\377\7\11\17" \
+  "\3778Ft\377\203<K}\377\1!*F\377\202\0\0\0\377\1CCC\377\217\377\377\377" \
+  "\377\1aaa\377\203\0\0\0\377\2\40\40\40\377\362\362\362\377\214\377\377" \
+  "\377\377\2\255\255\255\377\350\350\350\377\213\377\377\377\377\3\376" \
+  "\376\376\377\353\353\353\377111\377\203\0\0\0\377\2]]]\377\376\376\376" \
+  "\377\215\377\377\377\377\2\366\366\366\377^^^\377\202\0\0\0\377\4\16" \
+  "\30;\377)9p\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377" \
+  "\214\377\377\377\377\3\367\367\367\377\304\304\304\377\364\364\364\377" \
+  "\213\377\377\377\377\3\376\376\376\377\377\377\377\377\252\252\252\377" \
+  "\205\0\0\0\377\2iii\377\371\371\371\377\234\377\377\377\377\1\203\203" \
+  "\203\377\202\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\31*e\377" \
+  "\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233\31*e\377\6\27(c\3774Cw\377" \
+  "HU\204\377IV\205\377HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW" \
+  "\206\377\205KX\206\377\2JW\205\377KX\206\377\206LY\207\377\2LX\207\377" \
+  "LY\207\377\207LZ\207\377\210MZ\210\377\210N[\211\377\202O\\\211\377\1" \
+  "\36\"4\377\202\0\0\0\377\1\275\275\275\377\220\377\377\377\377\1\311" \
+  "\311\311\377\202\0\0\0\377\1\23\26!\377\205R_\213\377\203Q_\212\377\205" \
+  "R_\213\377\4Q^\212\377R_\213\377Q^\212\377\14\16\24\377\202\0\0\0\377" \
+  "\1\330\330\330\377\220\377\377\377\377\1\242\242\242\377\202\0\0\0\377" \
+  "\7#)>\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235" \
+  "\235\377\214\377\377\377\377\1\376\376\376\377\202\377\377\377\377\1" \
+  "\376\376\376\377\230\377\377\377\377\5yyy\377\1\1\1\377\0\0\0\377\4\7" \
+  "\22\377\25%[\377\204\31*e\377\2\27'^\377\1\3\7\377\202\0\0\0\377\1oo" \
+  "o\377\202\377\377\377\377\1\376\376\376\377\222\377\377\377\377\202\376" \
+  "\376\376\377\214\377\377\377\377\4\376\376\376\377\377\377\377\377\361" \
+  "\361\361\377FFF\377\202\0\0\0\377\2\6\12\30\377<Iz\377\203BP\201\377" \
+  "\1\40'>\377\202\0\0\0\377\1ppp\377\215\377\377\377\377\2\367\367\367" \
+  "\377\377\377\377\377\202\376\376\376\377\227\377\377\377\377\5\352\352" \
+  "\352\377%%%\377\0\0\0\377\3\3\6\377(2T\377\203<K}\377\5*5Y\377\3\4\7" \
+  "\377\0\0\0\377\"\"\"\377\364\364\364\377\216\377\377\377\377\1\227\227" \
+  "\227\377\203\0\0\0\377\1MMM\377\213\377\377\377\377\4\376\376\376\377" \
+  "\377\377\377\377```\377\223\223\223\377\214\377\377\377\377\2\371\371" \
+  "\371\377jjj\377\203\0\0\0\377\1~~~\377\216\377\377\377\377\2\353\353" \
+  "\353\377000\377\202\0\0\0\377\4\25#U\377)9p\3773Bw\377*6d\377\202\0\0" \
+  "\0\377\2EEE\377\370\370\370\377\214\377\377\377\377\4\376\376\376\377" \
+  "\373\373\373\377\377\377\377\377\376\376\376\377\212\377\377\377\377" \
+  "\3\376\376\376\377\377\377\377\377%%%\377\202\0\0\0\377\1\7\14\35\377" \
+  "\202\0\0\0\377\2iii\377\371\371\371\377\234\377\377\377\377\1\203\203" \
+  "\203\377\202\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\32*e\377" \
+  "\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233\31*e\377\6\27(c\3775Dx\377" \
+  "HV\205\377IV\205\377HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW" \
+  "\206\377\205KX\206\377\2JW\205\377KX\206\377\206LY\207\377\2LX\207\377" \
+  "LY\207\377\207LZ\207\377\210MZ\210\377\210N[\211\377\202O\\\211\377\1" \
+  "\24\27\"\377\202\0\0\0\377\1\340\340\340\377\220\377\377\377\377\1\230" \
+  "\230\230\377\202\0\0\0\377\1$*>\377\204R_\213\377\3Q_\212\377R_\213\377" \
+  "S_\214\377\207R_\213\377\3Q^\212\377R_\213\377\35\"2\377\202\0\0\0\377" \
+  "\1\261\261\261\377\220\377\377\377\377\1\304\304\304\377\202\0\0\0\377" \
+  "\7\32\36.\377MZ\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\246\377\377\377\377\7\376\376\376\377\377\377\377\377\346" \
+  "\346\346\377\30\30\30\377\0\0\0\377\0\0\1\377\17\31\77\377\204\31*e\377" \
+  "\1\11\17%\377\202\0\0\0\377\4""999\377\350\350\350\377\377\377\377\377" \
+  "\376\376\376\377\213\377\377\377\377\202\376\376\376\377\202\377\377" \
+  "\377\377\4\351\351\351\377\305\305\305\377\307\307\307\377\352\352\352" \
+  "\377\221\377\377\377\377\5\304\304\304\377\23\23\23\377\0\0\0\377\0\0" \
+  "\2\377&0N\377\203BP\201\377\1\40'>\377\202\0\0\0\377\1ppp\377\214\377" \
+  "\377\377\377\1\376\376\376\377\202\377\377\377\377\1\376\376\376\377" \
+  "\231\377\377\377\377\1WWW\377\202\0\0\0\377\1\34#;\377\203<K}\377\5""3" \
+  "@k\377\7\11\20\377\0\0\0\377\25\25\25\377\311\311\311\377\216\377\377" \
+  "\377\377\1\313\313\313\377\203\0\0\0\377\3\232\232\232\377\377\377\377" \
+  "\377\376\376\376\377\212\377\377\377\377\5\373\373\373\377444\377888" \
+  "\377\377\377\377\377\376\376\376\377\213\377\377\377\377\1\235\235\235" \
+  "\377\202\0\0\0\377\4\12\12\12\377\245\245\245\377\377\377\377\377\376" \
+  "\376\376\377\213\377\377\377\377\2\376\376\376\377\343\343\343\377\202" \
+  "\0\0\0\377\5\0\1\2\377\31*e\377)9p\3773Bw\377*6d\377\202\0\0\0\377\2" \
+  "EEE\377\370\370\370\377\216\377\377\377\377\1\376\376\376\377\214\377" \
+  "\377\377\377\1\267\267\267\377\202\0\0\0\377\2\3\5\16\377\16\30:\377" \
+  "\202\0\0\0\377\2iii\377\371\371\371\377\234\377\377\377\377\1\203\203" \
+  "\203\377\202\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\31*e\377" \
+  "\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233\31*e\377\2\26(c\3776Dx\377" \
+  "\202IV\205\377\2HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206" \
+  "\377\205KX\206\377\2JW\205\377KX\206\377\206LY\207\377\2LX\207\377LY" \
+  "\207\377\207LZ\207\377\210MZ\210\377\206N[\211\377\2MZ\211\377N[\211" \
+  "\377\202O\\\211\377\1\14\16\24\377\202\0\0\0\377\2\353\353\353\377\376" \
+  "\376\376\377\217\377\377\377\377\1vvv\377\202\0\0\0\377\1""2:U\377\203" \
+  "R_\213\377\5Q_\212\377R_\213\377S_\214\377R_\213\377S_\214\377\210R_" \
+  "\213\377\1)0G\377\202\0\0\0\377\1\221\221\221\377\220\377\377\377\377" \
+  "\1\336\336\336\377\202\0\0\0\377\7\23\26\"\377MZ\211\377LX\205\377\30" \
+  "\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\231\377\377\377\377\1\376" \
+  "\376\376\377\215\377\377\377\377\3\376\376\376\377\377\377\377\377ss" \
+  "s\377\202\0\0\0\377\2\7\15\40\377\27(`\377\202\31*e\377\5\24\"S\377\2" \
+  "\3\10\377\0\0\0\377\11\11\11\377\254\254\254\377\217\377\377\377\377" \
+  "\3\372\372\372\377\234\234\234\377\35\35\35\377\204\0\0\0\377\5\37\37" \
+  "\37\377\244\244\244\377\366\366\366\377\377\377\377\377\376\376\376\377" \
+  "\213\377\377\377\377\3\376\376\376\377\377\377\377\377```\377\202\0\0" \
+  "\0\377\2\21\25#\377=Jx\377\202BP\201\377\1\40'>\377\202\0\0\0\377\1p" \
+  "pp\377\251\377\377\377\377\5\234\234\234\377\1\1\1\377\0\0\0\377\23\30" \
+  "(\3779Gw\377\203<K}\377\6\14\17\31\377\0\0\0\377\10\10\10\377\236\236" \
+  "\236\377\377\377\377\377\376\376\376\377\213\377\377\377\377\3\376\376" \
+  "\376\377\336\336\336\377\16\16\16\377\202\0\0\0\377\1\351\351\351\377" \
+  "\214\377\377\377\377\4\321\321\321\377\36\36\36\377\0\0\0\377\371\371" \
+  "\371\377\214\377\377\377\377\5\310\310\310\377\31\31\31\377\0\0\0\377" \
+  "\23\23\23\377\314\314\314\377\216\377\377\377\377\1\271\271\271\377\202" \
+  "\0\0\0\377\5\6\13\33\377\31*e\377)8p\3773Bw\377*6d\377\202\0\0\0\377" \
+  "\2EEE\377\370\370\370\377\233\377\377\377\377\1""555\377\202\0\0\0\377" \
+  "\2\15\26""6\377\17\32\77\377\202\0\0\0\377\2iii\377\371\371\371\377\234" \
+  "\377\377\377\377\1\203\203\203\377\202\0\0\0\377\1\16\31<\377\215\31" \
+  "*e\377\2\30)d\377\31*e\377\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233" \
+  "\31*e\377\2\27(c\3776Ex\377\202IV\205\377\2HU\204\377IV\205\377\206J" \
+  "W\206\377\2IV\206\377JW\206\377\205KX\206\377\2JW\205\377KX\206\377\206" \
+  "LY\207\377\2LX\207\377LY\207\377\207LZ\207\377\210MZ\210\377\206N[\211" \
+  "\377\2MZ\211\377N[\211\377\202O\\\211\377\4\6\7\13\377\0\0\0\377\14\14" \
+  "\14\377\355\355\355\377\220\377\377\377\377\1\\\\\\\377\202\0\0\0\377" \
+  "\1;Dd\377\203R_\213\377\2Q_\212\377S_\214\377\202R_\213\377\1S_\214\377" \
+  "\210R_\213\377\1""19T\377\202\0\0\0\377\1|||\377\220\377\377\377\377" \
+  "\1\357\357\357\377\202\0\0\0\377\7\16\20\31\377MZ\211\377LX\205\377\30" \
+  "\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\220\377\377\377\377\202" \
+  "\376\376\376\377\202\377\377\377\377\4\347\347\347\377\332\332\332\377" \
+  "\336\336\336\377\365\365\365\377\202\377\377\377\377\1\376\376\376\377" \
+  "\216\377\377\377\377\5\352\352\352\377\1\1\1\377\0\0\0\377\1\2\5\377" \
+  "\25$W\377\202\31*e\377\1\14\24""1\377\202\0\0\0\377\2CCC\377\374\374" \
+  "\374\377\214\377\377\377\377\4\376\376\376\377\377\377\377\377\345\345" \
+  "\345\377JJJ\377\210\0\0\0\377\4VVV\377\354\354\354\377\377\377\377\377" \
+  "\376\376\376\377\212\377\377\377\377\4\376\376\376\377\377\377\377\377" \
+  "\350\350\350\377\7\7\7\377\202\0\0\0\377\1""4\77f\377\202BP\201\377\1" \
+  "\40'>\377\202\0\0\0\377\1ppp\377\222\377\377\377\377\1\376\376\376\377" \
+  "\205\377\377\377\377\1\376\376\376\377\220\377\377\377\377\5\323\323" \
+  "\323\377\1\1\1\377\0\0\0\377\14\17\31\3776Cp\377\203<K}\377\1\25\33-" \
+  "\377\202\0\0\0\377\1uuu\377\216\377\377\377\377\6\351\351\351\377333" \
+  "\377\0\0\0\377%%%\377\377\377\377\377\376\376\376\377\213\377\377\377" \
+  "\377\6\245\245\245\377\5\5\5\377\0\0\0\377\251\251\251\377\377\377\377" \
+  "\377\376\376\376\377\212\377\377\377\377\5\363\363\363\377444\377\0\0" \
+  "\0\377\34\34\34\377\363\363\363\377\216\377\377\377\377\1xxx\377\202" \
+  "\0\0\0\377\5\15\26""6\377\31*e\377)8p\3773Bw\377*6d\377\202\0\0\0\377" \
+  "\2EEE\377\370\370\370\377\221\377\377\377\377\202\376\376\376\377\207" \
+  "\377\377\377\377\6\305\305\305\377\5\5\5\377\0\0\0\377\1\3\7\377\24#" \
+  "T\377\20\33@\377\202\0\0\0\377\2kkk\377\376\376\376\377\205\377\377\377" \
+  "\377\1\376\376\376\377\214\377\377\377\377\1\376\376\376\377\211\377" \
+  "\377\377\377\1\205\205\205\377\202\0\0\0\377\1\16\31<\377\215\31*e\377" \
+  "\2\30)d\377\31*e\377\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233\31*" \
+  "e\377\2\27(c\3776Dx\377\202IV\205\377\2HU\204\377IV\205\377\206JW\206" \
+  "\377\2IV\206\377JW\206\377\205KX\206\377\2JW\205\377KX\206\377\206LY" \
+  "\207\377\2LX\207\377LY\207\377\207LZ\207\377\210MZ\210\377\210N[\211" \
+  "\377\202O\\\211\377\4\2\2\4\377\0\0\0\377\26\26\26\377\356\356\356\377" \
+  "\220\377\377\377\377\1LLL\377\202\0\0\0\377\1AKn\377\203R_\213\377\2" \
+  "Q_\212\377R_\213\377\202S_\214\377\211R_\213\377\1""6\77\\\377\202\0" \
+  "\0\0\377\1qqq\377\217\377\377\377\377\2\376\376\376\377\362\362\362\377" \
+  "\202\0\0\0\377\7\13\15\23\377MZ\211\377LX\205\377\30\34+\377\0\0\0\377" \
+  "\4\4\4\377\235\235\235\377\217\377\377\377\377\202\376\376\376\377\11" \
+  "\377\377\377\377\310\310\310\377ddd\377888\377(((\377...\377MMM\377\237" \
+  "\237\237\377\377\377\377\377\202\376\376\376\377\214\377\377\377\377" \
+  "\3\376\376\376\377\377\377\377\377KKK\377\202\0\0\0\377\11\20\33B\377" \
+  "\31*e\377\26&\\\377\5\11\26\377\0\0\0\377\1\1\1\377\256\256\256\377\377" \
+  "\377\377\377\376\376\376\377\213\377\377\377\377\3\376\376\376\377\375" \
+  "\375\375\377FFF\377\203\0\0\0\377\4\12\14\23\377\23\27$\377\22\26#\377" \
+  "\10\12\20\377\203\0\0\0\377\1KKK\377\215\377\377\377\377\3\376\376\376" \
+  "\377\377\377\377\377aaa\377\202\0\0\0\377\1\36$;\377\202BP\201\377\1" \
+  "\40'>\377\202\0\0\0\377\1ppp\377\220\377\377\377\377\1\376\376\376\377" \
+  "\202\377\377\377\377\5\346\346\346\377\266\266\266\377\255\255\255\377" \
+  "\302\302\302\377\366\366\366\377\202\377\377\377\377\1\376\376\376\377" \
+  "\216\377\377\377\377\5\376\376\376\377\1\1\1\377\0\0\0\377\6\10\16\377" \
+  "3@j\377\203<K}\377\1#,K\377\202\0\0\0\377\2PPP\377\363\363\363\377\215" \
+  "\377\377\377\377\6\364\364\364\377XXX\377\0\0\0\377\177\177\177\377\377" \
+  "\377\377\377\376\376\376\377\212\377\377\377\377\2\374\374\374\377uu" \
+  "u\377\202\0\0\0\377\3WWW\377\377\377\377\377\376\376\376\377\213\377" \
+  "\377\377\377\3```\377\0\0\0\377333\377\215\377\377\377\377\3\376\376" \
+  "\376\377\377\377\377\377666\377\202\0\0\0\377\5\23!R\377\31*e\377)9p" \
+  "\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377\220\377\377" \
+  "\377\377\1\376\376\376\377\202\377\377\377\377\5\331\331\331\377\244" \
+  "\244\244\377\225\225\225\377\247\247\247\377\326\326\326\377\202\377" \
+  "\377\377\377\1```\377\202\0\0\0\377\3\7\15\40\377\31*e\377\20\33@\377" \
+  "\202\0\0\0\377\2NNN\377\270\270\270\377\203\274\274\274\377\2\273\273" \
+  "\273\377\342\342\342\377\216\377\377\377\377\2\374\374\374\377\271\271" \
+  "\271\377\206\274\274\274\377\2\300\300\300\377```\377\202\0\0\0\377\1" \
+  "\16\31<\377\215\31*e\377\2\30)d\377\31*e\377\204(8o\377\1&6o\377\205" \
+  "'7o\377\1!2k\377\233\31*e\377\6\27(c\3775Cw\377HU\204\377IV\205\377H" \
+  "U\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377\205KX\206\377" \
+  "\2JW\205\377KX\206\377\206LY\207\377\2LX\207\377LY\207\377\207LZ\207" \
+  "\377\210MZ\210\377\210N[\211\377\202O\\\211\377\4\0\0\1\377\0\0\0\377" \
+  "\32\32\32\377\356\356\356\377\220\377\377\377\377\1DDD\377\202\0\0\0" \
+  "\377\1DOt\377\207R_\213\377\1Q_\212\377\210R_\213\377\1""7@^\377\202" \
+  "\0\0\0\377\1lll\377\220\377\377\377\377\1\362\362\362\377\202\0\0\0\377" \
+  "\7\12\13\21\377MZ\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\217\377\377\377\377\4\376\376\376\377\377\377\377\377\214" \
+  "\214\214\377\17\17\17\377\205\0\0\0\377\4\3\3\3\377]]]\377\377\377\377" \
+  "\377\376\376\376\377\214\377\377\377\377\3\376\376\376\377\377\377\377" \
+  "\377\266\266\266\377\202\0\0\0\377\6\10\16!\377\31*e\377\23!P\377\0\0" \
+  "\1\377\0\0\0\377\31\31\31\377\215\377\377\377\377\3\376\376\376\377\377" \
+  "\377\377\377\210\210\210\377\203\0\0\0\377\6+4S\377@Mz\377AN{\377@N{" \
+  "\377>Kw\377'/J\377\202\0\0\0\377\4\1\1\1\377\237\237\237\377\377\377" \
+  "\377\377\376\376\376\377\212\377\377\377\377\3\376\376\376\377\377\377" \
+  "\377\377\334\334\334\377\202\0\0\0\377\1\5\7\13\377\202BP\201\377\1\40" \
+  "'>\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\12\376\376\376\377" \
+  "\377\377\377\377\370\370\370\377]]]\377\24\24\24\377\16\16\16\377\14" \
+  "\14\14\377\20\20\20\377$$$\377\243\243\243\377\221\377\377\377\377\4" \
+  "\17\17\17\377\0\0\0\377\2\3\5\3771>g\377\203<K}\377\5""1>h\377\0\0\1" \
+  "\377\0\0\0\377+++\377\340\340\340\377\216\377\377\377\377\3}}}\377\0" \
+  "\0\0\377\330\330\330\377\214\377\377\377\377\2\355\355\355\377===\377" \
+  "\202\0\0\0\377\2###\377\371\371\371\377\212\377\377\377\377\7\376\376" \
+  "\376\377\377\377\377\377\245\245\245\377\2\2\2\377hhh\377\377\377\377" \
+  "\377\376\376\376\377\215\377\377\377\377\202\0\0\0\377\6\0\1\3\377\27" \
+  "'`\377\31*e\377)9p\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370" \
+  "\377\221\377\377\377\377\17\367\367\367\377kkk\377\27\27\27\377\12\12" \
+  "\12\377\6\6\6\377\12\12\12\377\25\25\25\377222\377{{{\377\40\40\40\377" \
+  "\0\0\0\377\0\1\3\377\20\33A\377\31*e\377\17\32@\377\202\0\0\0\377\1\6" \
+  "\6\6\377\204\17\17\17\377\2\12\12\12\377\233\233\233\377\216\377\377" \
+  "\377\377\2\367\367\367\377\4\4\4\377\207\17\17\17\377\1\7\7\7\377\202" \
+  "\0\0\0\377\1\16\31<\377\215\31*e\377\2\30)d\377\31*e\377\204(8o\377\1" \
+  "&6o\377\205'7o\377\1!2k\377\233\31*e\377\6\27(c\3773Bv\377HU\204\377" \
+  "IV\205\377HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377\205" \
+  "KX\206\377\2JW\205\377KX\206\377\206LY\207\377\2LX\207\377LY\207\377" \
+  "\206LZ\207\377\2KZ\206\377LZ\207\377\207MZ\210\377\210N[\211\377\202" \
+  "O\\\211\377\202\0\0\0\377\2\33\33\33\377\357\357\357\377\220\377\377" \
+  "\377\377\1BBB\377\202\0\0\0\377\1DOt\377\205R_\213\377\202Q_\212\377" \
+  "\206R_\213\377\4Q^\212\377R_\213\377Q^\212\3775>[\377\202\0\0\0\377\1" \
+  "qqq\377\217\377\377\377\377\2\376\376\376\377\362\362\362\377\202\0\0" \
+  "\0\377\7\12\14\22\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4" \
+  "\377\235\235\235\377\220\377\377\377\377\2\242\242\242\377\7\7\7\377" \
+  "\202\0\0\0\377\4\1\1\2\377\2\2\3\377\1\2\3\377\0\0\1\377\202\0\0\0\377" \
+  "\1kkk\377\217\377\377\377\377\1\367\367\367\377\202\0\0\0\377\3\1\2\5" \
+  "\377\31*e\377\16\30""9\377\202\0\0\0\377\3}}}\377\377\377\377\377\376" \
+  "\376\376\377\215\377\377\377\377\1\6\6\6\377\202\0\0\0\377\2(1M\377C" \
+  "Q\201\377\204CQ\200\377\2CP\177\377\32\37""2\377\202\0\0\0\377\1:::\377" \
+  "\215\377\377\377\377\202\376\376\376\377\1&&&\377\202\0\0\0\377\3""8" \
+  "Dn\377BP\200\377\40'>\377\202\0\0\0\377\1ppp\377\220\377\377\377\377" \
+  "\2\352\352\352\377...\377\207\0\0\0\377\1\254\254\254\377\202\376\376" \
+  "\376\377\216\377\377\377\377\1%%%\377\202\0\0\0\377\1""0<d\377\203<K" \
+  "}\377\5;J|\377\2\2\4\377\0\0\0\377\6\6\6\377\316\316\316\377\216\377" \
+  "\377\377\377\4\232\232\232\377\32\32\32\377\373\373\373\377\376\376\376" \
+  "\377\213\377\377\377\377\2\335\335\335\377\7\7\7\377\202\0\0\0\377\4" \
+  "\22\22\22\377\303\303\303\377\377\377\377\377\376\376\376\377\212\377" \
+  "\377\377\377\3\353\353\353\377\4\4\4\377\237\237\237\377\216\377\377" \
+  "\377\377\1\310\310\310\377\202\0\0\0\377\6\6\12\30\377\27(a\377\31*e" \
+  "\377)9p\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377\220" \
+  "\377\377\377\377\2\367\367\367\377fff\377\212\0\0\0\377\1\3\5\14\377" \
+  "\202\31*e\377\1\17\32@\377\210\0\0\0\377\1\225\225\225\377\216\377\377" \
+  "\377\377\1\367\367\367\377\213\0\0\0\377\1\16\31<\377\215\31*e\377\2" \
+  "\30)d\377\32*e\377\204(8o\377\1&6o\377\205'7o\377\1!2k\377\233\31*e\377" \
+  "\6\27(c\3772@u\377HU\204\377IV\205\377HU\204\377IV\205\377\206JW\206" \
+  "\377\2IV\206\377JW\206\377\205KX\206\377\4JW\205\377KX\206\377LY\207" \
+  "\377KX\206\377\204LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\2KZ" \
+  "\206\377LZ\207\377\207MZ\210\377\210N[\211\377\202O\\\211\377\4\1\2\3" \
+  "\377\0\0\0\377\30\30\30\377\356\356\356\377\220\377\377\377\377\1HHH" \
+  "\377\202\0\0\0\377\1ALp\377\216R_\213\377\202Q^\212\377\1""19U\377\202" \
+  "\0\0\0\377\1zzz\377\220\377\377\377\377\1\361\361\361\377\202\0\0\0\377" \
+  "\7\14\16\26\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\217\377\377\377\377\2\344\344\344\377///\377\202\0\0\0\377" \
+  "\6\16\20\30\3773<\\\377DPz\377\77Jq\377\32\37/\377\0\0\1\377\202\0\0" \
+  "\0\377\3\303\303\303\377\377\377\377\377\376\376\376\377\213\377\377" \
+  "\377\377\3\376\376\376\377\372\372\372\377<<<\377\202\0\0\0\377\2\26" \
+  "%Z\377\10\15\40\377\202\0\0\0\377\1\331\331\331\377\216\377\377\377\377" \
+  "\1\254\254\254\377\202\0\0\0\377\2\0\0\1\377\21\25!\377\205\22\26#\377" \
+  "\6\23\27%\377\13\16\26\377\0\0\1\377\0\0\0\377\35\35\35\377\323\323\323" \
+  "\377\215\377\377\377\377\2\376\376\376\377ppp\377\202\0\0\0\377\3$,G" \
+  "\377BP\200\377\40'>\377\202\0\0\0\377\1ppp\377\216\377\377\377\377\3" \
+  "\376\376\376\377\371\371\371\377ddd\377\202\0\0\0\377\4\1\1\2\377\13" \
+  "\15\26\377\6\11\25\377\3\5\16\377\202\0\0\0\377\2\26\26\26\377\370\370" \
+  "\370\377\217\377\377\377\377\1""222\377\202\0\0\0\377\1/;c\377\203<K" \
+  "}\377\2;J|\377\20\24#\377\202\0\0\0\377\2\253\253\253\377\376\376\376" \
+  "\377\215\377\377\377\377\3\263\263\263\377ttt\377\374\374\374\377\214" \
+  "\377\377\377\377\1\254\254\254\377\203\0\0\0\377\2\3\3\3\377\214\214" \
+  "\214\377\213\377\377\377\377\4\376\376\376\377\377\377\377\377)))\377" \
+  "\324\324\324\377\216\377\377\377\377\1\203\203\203\377\202\0\0\0\377" \
+  "\6\13\23/\377\27(b\377\31*e\377)9p\3773Bw\377*6d\377\202\0\0\0\377\2" \
+  "EEE\377\370\370\370\377\216\377\377\377\377\3\376\376\376\377\377\377" \
+  "\377\377\255\255\255\377\202\0\0\0\377\5\0\0\1\377\5\10\25\377\6\12\31" \
+  "\377\4\7\23\377\2\3\10\377\204\0\0\0\377\1\15\27""7\377\202\31*e\377" \
+  "\2\21\35G\377\4\6\20\377\203\4\7\23\377\2\4\7\22\377\2\3\10\377\202\0" \
+  "\0\0\377\1\225\225\225\377\216\377\377\377\377\1\367\367\367\377\202" \
+  "\0\0\0\377\2\0\1\3\377\4\7\21\377\206\4\7\23\377\2\3\6\17\377\20\34C" \
+  "\377\215\31*e\377\2\30)d\377\31+e\377\204(8o\377\1&6o\377\205'7o\377" \
+  "\1!2k\377\233\31*e\377\6\27(c\377/>t\377HU\204\377IV\205\377HU\204\377" \
+  "IV\205\377\206JW\206\377\2IV\206\377JW\206\377\205KX\206\377\202JW\205" \
+  "\377\1KX\206\377\205LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\2" \
+  "KZ\206\377LZ\207\377\207MZ\210\377\2N[\211\377MZ\210\377\206N[\211\377" \
+  "\202O\\\211\377\4\5\6\11\377\0\0\0\377\16\16\16\377\355\355\355\377\220" \
+  "\377\377\377\377\1UUU\377\202\0\0\0\377\1>Gi\377\216R_\213\377\3Q^\212" \
+  "\377P]\211\377,3K\377\202\0\0\0\377\1\210\210\210\377\220\377\377\377" \
+  "\377\1\350\350\350\377\202\0\0\0\377\7\20\23\35\377N[\211\377LX\205\377" \
+  "\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\2" \
+  "\376\376\376\377\254\254\254\377\202\0\0\0\377\2\5\6\12\377BMu\377\202" \
+  "LY\207\377\3KX\206\377HU\202\377\25\31'\377\202\0\0\0\377\1TTT\377\216" \
+  "\377\377\377\377\2\374\374\374\377ooo\377\202\0\0\0\377\6\20\34C\377" \
+  "\3\5\14\377\0\0\0\377\15\15\15\377\377\377\377\377\376\376\376\377\213" \
+  "\377\377\377\377\3\376\376\376\377\377\377\377\377hhh\377\215\0\0\0\377" \
+  "\2\13\13\13\377\254\254\254\377\215\377\377\377\377\2\376\376\376\377" \
+  "\256\256\256\377\202\0\0\0\377\3\23\30&\377BP\200\377\40'>\377\202\0" \
+  "\0\0\377\1ppp\377\216\377\377\377\377\3\376\376\376\377\327\327\327\377" \
+  "\14\14\14\377\202\0\0\0\377\5#*F\3777Ds\377\35-e\377\24#V\377\4\7\21" \
+  "\377\202\0\0\0\377\1\273\273\273\377\217\377\377\377\377\1""555\377\202" \
+  "\0\0\0\377\1/;b\377\203<K}\377\2;J|\377!)E\377\202\0\0\0\377\2ooo\377" \
+  "\375\375\375\377\215\377\377\377\377\3\320\320\320\377\314\314\314\377" \
+  "\376\376\376\377\212\377\377\377\377\3\376\376\376\377\377\377\377\377" \
+  "ZZZ\377\204\0\0\0\377\2ZZZ\377\372\372\372\377\212\377\377\377\377\4" \
+  "\376\376\376\377\377\377\377\377\215\215\215\377\375\375\375\377\214" \
+  "\377\377\377\377\3\376\376\376\377\377\377\377\377===\377\202\0\0\0\377" \
+  "\6\20\34C\377\30)d\377\31*e\377)9p\3773Bw\377*6d\377\202\0\0\0\377\2" \
+  "EEE\377\370\370\370\377\220\377\377\377\377\1\31\31\31\377\202\0\0\0" \
+  "\377\12\14\24""0\377\30)c\377\31*e\377\27'^\377\22\37K\377\14\25""2\377" \
+  "\4\7\22\377\0\0\0\377\0\1\3\377\30)c\377\202\31*e\377\1\30)b\377\204" \
+  "\27'^\377\2\26&\\\377\11\21)\377\202\0\0\0\377\1\225\225\225\377\216" \
+  "\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\16\377\26%Y\377" \
+  "\207\27'^\377\1\30)b\377\215\31*e\377\2\30)d\377\31+e\377\204(8o\377" \
+  "\1&6o\377\205'7o\377\1!1j\377\233\31*e\377\5\27(d\377,;r\377GT\204\377" \
+  "IV\205\377HU\204\377\202IV\205\377\205JW\206\377\2IV\206\377JW\206\377" \
+  "\206KX\206\377\2JW\205\377KX\206\377\205LY\207\377\4LX\207\377LY\207" \
+  "\377LZ\207\377LY\207\377\204LZ\207\377\2KZ\206\377LZ\207\377\206MZ\210" \
+  "\377\2LY\207\377MZ\210\377\207N[\211\377\202O\\\211\377\1\12\14\22\377" \
+  "\202\0\0\0\377\2\353\353\353\377\376\376\376\377\217\377\377\377\377" \
+  "\1lll\377\202\0\0\0\377\1""6>[\377\213R_\213\377\6Q^\212\377R_\213\377" \
+  "Q^\212\377P]\211\377Q^\212\377#)=\377\202\0\0\0\377\1\236\236\236\377" \
+  "\220\377\377\377\377\1\324\324\324\377\202\0\0\0\377\7\25\31&\377N[\211" \
+  "\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377" \
+  "\377\377\377\2\373\373\373\377ggg\377\202\0\0\0\377\1$*A\377\204LY\207" \
+  "\377\6JW\205\3772:Y\377\3\4\6\377\0\0\0\377+++\377\346\346\346\377\215" \
+  "\377\377\377\377\2\376\376\376\377\231\231\231\377\202\0\0\0\377\1\13" \
+  "\23.\377\202\0\0\0\377\3EEE\377\377\377\377\377\376\376\376\377\215\377" \
+  "\377\377\377\1+++\377\216\0\0\0\377\1\213\213\213\377\216\377\377\377" \
+  "\377\1\316\316\316\377\202\0\0\0\377\3\5\6\13\377BP\200\377\40'>\377" \
+  "\202\0\0\0\377\1ppp\377\217\377\377\377\377\1\235\235\235\377\202\0\0" \
+  "\0\377\6\15\20\33\377\77M~\377;J{\377\36/h\377\30)d\377\15\26""7\377" \
+  "\202\0\0\0\377\1www\377\217\377\377\377\377\1""555\377\202\0\0\0\377" \
+  "\1/;b\377\203<K}\377\2;J|\3771>h\377\202\0\0\0\377\3""444\377\374\374" \
+  "\374\377\376\376\376\377\214\377\377\377\377\2\371\371\371\377\373\373" \
+  "\373\377\213\377\377\377\377\3\376\376\376\377\377\377\377\377\12\12" \
+  "\12\377\204\0\0\0\377\2///\377\341\341\341\377\214\377\377\377\377\3" \
+  "\363\363\363\377\377\377\377\377\376\376\376\377\215\377\377\377\377" \
+  "\11\15\15\15\377\0\0\0\377\1\2\5\377\23!P\377\30)d\377\31*e\377*9p\377" \
+  "3Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377\217\377\377\377" \
+  "\377\1\263\263\263\377\202\0\0\0\377\2\4\6\20\377\27'_\377\205\31*e\377" \
+  "\3\26&\\\377\20\34D\377\17\32@\377\210\31*e\377\2\30)c\377\12\22,\377" \
+  "\202\0\0\0\377\1\225\225\225\377\216\377\377\377\377\1\367\367\367\377" \
+  "\202\0\0\0\377\2\3\6\17\377\27(`\377\225\31*e\377\2\30)d\377\31+f\377" \
+  "\204(8o\377\1&6o\377\205'7o\377\1!1j\377\233\31*e\377\3\27(d\377(8o\377" \
+  "GT\203\377\202IV\205\377\2HU\204\377IV\205\377\205JW\206\377\2IV\206" \
+  "\377JW\206\377\206KX\206\377\2JW\205\377KX\206\377\205LY\207\377\1LX" \
+  "\207\377\202LY\207\377\205LZ\207\377\2KZ\206\377LZ\207\377\206MZ\210" \
+  "\377\2LY\207\377MZ\210\377\206N[\211\377\4MZ\211\377N[\211\377O\\\211" \
+  "\377\21\24\37\377\202\0\0\0\377\1\346\346\346\377\220\377\377\377\377" \
+  "\1\213\213\213\377\202\0\0\0\377\1)0G\377\202R_\213\377\1Q^\212\377\206" \
+  "R_\213\377\1Q^\212\377\202R_\213\377\2Q^\212\377P]\211\377\202Q^\212" \
+  "\377\1\30\34)\377\202\0\0\0\377\1\275\275\275\377\220\377\377\377\377" \
+  "\1\272\272\272\377\202\0\0\0\377\7\34!2\377N[\211\377LX\205\377\30\34" \
+  "+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\2\370\370" \
+  "\370\377000\377\202\0\0\0\377\1@Kq\377\204LY\207\377\6JW\205\377CNw\377" \
+  "\7\10\15\377\0\0\0\377\30\30\30\377\307\307\307\377\216\377\377\377\377" \
+  "\1\270\270\270\377\202\0\0\0\377\1\4\7\21\377\202\0\0\0\377\1ppp\377" \
+  "\217\377\377\377\377\1\335\335\335\377\215\327\327\327\377\2\326\326" \
+  "\326\377\353\353\353\377\216\377\377\377\377\6\332\332\332\377\33\33" \
+  "\33\377\0\0\0\377\0\0\1\377BP\200\377\40'\77\377\202\0\0\0\377\1ppp\377" \
+  "\217\377\377\377\377\1```\377\202\0\0\0\377\6$,I\377\77M~\377:Hz\377" \
+  "\36.h\377\30)d\377\22\36H\377\202\0\0\0\377\1TTT\377\217\377\377\377" \
+  "\377\1""555\377\202\0\0\0\377\1/;b\377\203<K}\377\202;J|\377\1\1\1\2" \
+  "\377\202\0\0\0\377\1\371\371\371\377\214\377\377\377\377\1\376\376\376" \
+  "\377\202\377\377\377\377\1\376\376\376\377\213\377\377\377\377\1\313" \
+  "\313\313\377\202\0\0\0\377\5\13\16\30\377\1\2\4\377\0\0\0\377\4\4\4\377" \
+  "\307\307\307\377\213\377\377\377\377\3\376\376\376\377\377\377\377\377" \
+  "\376\376\376\377\215\377\377\377\377\12\314\314\314\377\6\6\6\377\0\0" \
+  "\0\377\4\7\22\377\25$X\377\30)d\377\31+e\377*:q\3773Bw\377*6d\377\202" \
+  "\0\0\0\377\2EEE\377\370\370\370\377\217\377\377\377\377\1TTT\377\202" \
+  "\0\0\0\377\2\14\25""3\377\30)d\377\220\31*e\377\2\30)c\377\12\22,\377" \
+  "\202\0\0\0\377\1\225\225\225\377\216\377\377\377\377\1\367\367\367\377" \
+  "\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31*e\377\2\30)d\377\32+f\377" \
+  "\204(8o\377\1&6o\377\205'7o\377\1!1j\377\233\31*e\377\3\30)d\377$5l\377" \
+  "FT\203\377\202IV\205\377\2HU\204\377IV\205\377\205JW\206\377\2IV\206" \
+  "\377JW\206\377\206KX\206\377\2JW\205\377KX\206\377\206LY\207\377\2LX" \
+  "\207\377LY\207\377\205LZ\207\377\4KZ\206\377LZ\207\377MZ\210\377LZ\207" \
+  "\377\204MZ\210\377\2LY\207\377MZ\210\377\206N[\211\377\4MZ\211\377N[" \
+  "\211\377O\\\211\377\32\37.\377\202\0\0\0\377\1\305\305\305\377\220\377" \
+  "\377\377\377\1\266\266\266\377\202\0\0\0\377\1\32\36,\377\202Q^\212\377" \
+  "\202R_\213\377\1Q^\212\377\203R_\213\377\2Q^\212\377R_\213\377\202Q^" \
+  "\212\377\1P]\211\377\203Q^\212\377\1\10\12\17\377\202\0\0\0\377\1\340" \
+  "\340\340\377\220\377\377\377\377\1\230\230\230\377\202\0\0\0\377\7&," \
+  "C\377N[\211\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235" \
+  "\377\216\377\377\377\377\2\366\366\366\377\15\15\15\377\202\0\0\0\377" \
+  "\205LY\207\377\6JW\205\377KX\206\377\12\14\22\377\0\0\0\377\14\14\14" \
+  "\377\262\262\262\377\216\377\377\377\377\1\305\305\305\377\205\0\0\0" \
+  "\377\1\216\216\216\377\215\377\377\377\377\202\376\376\376\377\220\377" \
+  "\377\377\377\1\376\376\376\377\215\377\377\377\377\6\343\343\343\377" \
+  "000\377\0\0\0\377\0\0\1\377;Hs\377!(@\377\202\0\0\0\377\1ppp\377\217" \
+  "\377\377\377\377\1""666\377\202\0\0\0\377\6""4@h\377\77M~\3779Gz\377" \
+  "\35.h\377\30)d\377\23!P\377\202\0\0\0\377\1FFF\377\217\377\377\377\377" \
+  "\1""555\377\202\0\0\0\377\1/;b\377\203<K}\377\202;J|\377\1\17\24!\377" \
+  "\202\0\0\0\377\1\304\304\304\377\231\377\377\377\377\3\376\376\376\377" \
+  "\377\377\377\377sss\377\202\0\0\0\377\2\34#=\377\23\27)\377\202\0\0\0" \
+  "\377\2\224\224\224\377\375\375\375\377\230\377\377\377\377\14\376\376" \
+  "\376\377\377\377\377\377\225\225\225\377\3\3\3\377\0\0\0\377\7\14\36" \
+  "\377\30(a\377\30)d\377\32+f\377+:q\3773Bw\377*6d\377\202\0\0\0\377\2" \
+  "EEE\377\370\370\370\377\217\377\377\377\377\1\23\23\23\377\202\0\0\0" \
+  "\377\1\22\36J\377\221\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1" \
+  "\225\225\225\377\216\377\377\377\377\1\367\367\367\377\202\0\0\0\377" \
+  "\2\3\6\17\377\27'_\377\225\31*e\377\2\30)d\377\32,f\377\204(8o\377\1" \
+  "&6o\377\205'7o\377\1\40""1k\377\233\31*e\377\3\30)d\377\40""0j\377FS" \
+  "\203\377\202IV\205\377\2HU\204\377IV\205\377\205JW\206\377\202IV\206" \
+  "\377\1JW\206\377\205KX\206\377\2JW\205\377KX\206\377\206LY\207\377\2" \
+  "LX\207\377LY\207\377\205LZ\207\377\202KZ\206\377\1LZ\207\377\205MZ\210" \
+  "\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377\204N[\211\377\4MZ\211" \
+  "\377N[\211\377O\\\211\377&,C\377\202\0\0\0\377\1\234\234\234\377\220" \
+  "\377\377\377\377\1\344\344\344\377\202\0\0\0\377\2\6\7\12\377P]\211\377" \
+  "\203Q^\212\377\205R_\213\377\202Q^\212\377\202P]\211\377\202Q^\212\377" \
+  "\1MZ\204\377\202\0\0\0\377\3\24\24\24\377\352\352\352\377\376\376\376" \
+  "\377\217\377\377\377\377\1ooo\377\202\0\0\0\377\7""09U\377N[\211\377" \
+  "LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377" \
+  "\377\377\1\365\365\365\377\202\0\0\0\377\1\6\10\14\377\205LY\207\377" \
+  "\6JW\205\377KX\206\377\16\20\31\377\0\0\0\377\5\5\5\377\250\250\250\377" \
+  "\216\377\377\377\377\2\312\312\312\377\10\10\10\377\204\0\0\0\377\1\241" \
+  "\241\241\377\255\377\377\377\377\6\353\353\353\377@@@\377\0\0\0\377\0" \
+  "\0\1\3775@g\377!(@\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\1\34" \
+  "\34\34\377\202\0\0\0\377\6>K{\377\77M~\3778Fy\377\35-g\377\30)d\377\24" \
+  "!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377\202\0\0" \
+  "\0\377\1/;b\377\203<K}\377\202;J|\377\1\36&\77\377\202\0\0\0\377\1||" \
+  "|\377\233\377\377\377\377\1\40\40\40\377\202\0\0\0\377\2)3Y\377'1V\377" \
+  "\202\0\0\0\377\3JJJ\377\373\373\373\377\376\376\376\377\231\377\377\377" \
+  "\377\1^^^\377\202\0\0\0\377\7\13\22-\377\31*e\377\30)d\377\32+f\377+" \
+  ";q\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377\377" \
+  "\377\377\5\337\337\337\377\11\11\11\377\0\0\0\377\2\4\13\377\24\"S\377" \
+  "\221\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216" \
+  "\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377" \
+  "\225\31*e\377\2\30)d\377\32+f\377\204(8o\377\1&6o\377\205'7o\377\1\40" \
+  "1j\377\233\31*e\377\7\30)d\377\33,f\377ES\202\377HU\204\377IV\205\377" \
+  "HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377\205KX\206\377" \
+  "\1JW\205\377\202KX\206\377\205LY\207\377\2LX\207\377LY\207\377\206LZ" \
+  "\207\377\2KZ\206\377LZ\207\377\206MZ\210\377\2LY\207\377MZ\210\377\206" \
+  "N[\211\377\3MZ\211\377N[\211\3774<Z\377\202\0\0\0\377\1hhh\377\217\377" \
+  "\377\377\377\3\376\376\376\377\362\362\362\377###\377\202\0\0\0\377\1" \
+  "CNs\377\202Q^\212\377\206P]\211\377\206Q^\212\377\1""6\77\\\377\202\0" \
+  "\0\0\377\2DDD\377\362\362\362\377\216\377\377\377\377\3\376\376\376\377" \
+  "\377\377\377\377>>>\377\202\0\0\0\377\7>In\377N[\211\377LX\205\377\30" \
+  "\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\1\364" \
+  "\364\364\377\202\0\0\0\377\1\13\15\24\377\203LY\207\377\10KX\206\377" \
+  "LY\207\377JW\205\377KX\206\377\21\24\37\377\0\0\0\377\3\3\3\377\244\244" \
+  "\244\377\216\377\377\377\377\2\315\315\315\377\15\15\15\377\204\0\0\0" \
+  "\377\1\252\252\252\377\255\377\377\377\377\2\360\360\360\377KKK\377\202" \
+  "\0\0\0\377\2""1;_\377\")A\377\202\0\0\0\377\1ppp\377\217\377\377\377" \
+  "\377\1\16\16\16\377\202\0\0\0\377\6@N\177\377\77M~\3776Ex\377\34-g\377" \
+  "\30)d\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555" \
+  "\377\202\0\0\0\377\1/;b\377\203<K}\377\202;J|\377\1,8]\377\202\0\0\0" \
+  "\377\3""555\377\377\377\377\377\376\376\376\377\230\377\377\377\377\6" \
+  "\334\334\334\377\4\4\4\377\0\0\0\377\6\7\15\377/;g\3777Ex\377\202\0\0" \
+  "\0\377\3\3\3\3\377\370\370\370\377\376\376\376\377\230\377\377\377\377" \
+  "\13\371\371\371\377:::\377\0\0\0\377\0\1\3\377\17\32>\377\31*e\377\30" \
+  ")d\377\33+f\377,;r\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370" \
+  "\377\216\377\377\377\377\5\270\270\270\377\7\7\7\377\0\0\0\377\5\11\25" \
+  "\377\26%[\377\221\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225" \
+  "\225\225\377\216\377\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3" \
+  "\6\17\377\27'_\377\225\31*e\377\2\30)d\377\33,g\377\204(8o\377\1&6o\377" \
+  "\205'7o\377\1\40""1j\377\233\31*e\377\3\30)d\377\26(c\377DQ\201\377\202" \
+  "IV\205\377\2HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206\377" \
+  "\206KX\206\377\2JW\205\377KX\206\377\205LY\207\377\2LX\207\377LY\207" \
+  "\377\206LZ\207\377\2KZ\206\377LZ\207\377\206MZ\210\377\2LY\207\377MZ" \
+  "\210\377\206N[\211\377\3MZ\211\377N[\211\377DOv\377\202\0\0\0\377\3," \
+  ",,\377\377\377\377\377\376\376\376\377\216\377\377\377\377\2\371\371" \
+  "\371\377hhh\377\202\0\0\0\377\1!&8\377\216Q^\212\377\1\27\33(\377\202" \
+  "\0\0\0\377\2\177\177\177\377\374\374\374\377\220\377\377\377\377\12\5" \
+  "\5\5\377\0\0\0\377\1\1\2\377FQ{\377N[\211\377LX\205\377\30\34+\377\0" \
+  "\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\1\364\364\364" \
+  "\377\202\0\0\0\377\1\12\14\23\377\204LY\207\377\7KX\206\377JW\205\377" \
+  "KX\206\377\17\22\34\377\0\0\0\377\4\4\4\377\246\246\246\377\216\377\377" \
+  "\377\377\2\316\316\316\377\16\16\16\377\204\0\0\0\377\1\251\251\251\377" \
+  "\255\377\377\377\377\2\363\363\363\377SSS\377\202\0\0\0\377\2.8Z\377" \
+  "\")A\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\11\11\11\11\377\0" \
+  "\0\0\377\1\2\3\377@N\177\377\77M~\3774Cw\377\33,f\377\30)d\377\24!P\377" \
+  "\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377" \
+  "\1/;b\377\203<K}\377\202;J|\377\2""3@k\377\3\4\7\377\202\0\0\0\377\232" \
+  "\377\377\377\377\7\223\223\223\377\2\2\2\377\0\0\0\377\17\23\"\3774A" \
+  "r\3778Fz\377\16\22\40\377\202\0\0\0\377\1\272\272\272\377\231\377\377" \
+  "\377\377\13\330\330\330\377$$$\377\0\0\0\377\1\3\7\377\24!Q\377\31*e" \
+  "\377\30)d\377\33,f\377-<r\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370" \
+  "\370\370\377\216\377\377\377\377\5\232\232\232\377\5\5\5\377\0\0\0\377" \
+  "\7\14\35\377\30(a\377\221\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377" \
+  "\1\225\225\225\377\216\377\377\377\377\1\367\367\367\377\202\0\0\0\377" \
+  "\2\3\6\17\377\27'_\377\225\31*e\377\2\30)d\377\34,g\377\204(8o\377\1" \
+  "&6o\377\205'7o\377\1\37""0j\377\234\31*e\377\2\25'b\377=K}\377\202IV" \
+  "\205\377\1HU\204\377\202IV\205\377\205JW\206\377\2IV\206\377JW\206\377" \
+  "\206KX\206\377\2JW\205\377KX\206\377\205LY\207\377\1LX\207\377\202LY" \
+  "\207\377\205LZ\207\377\1KZ\206\377\202LZ\207\377\205MZ\210\377\1LY\207" \
+  "\377\202MZ\210\377\205N[\211\377\4MZ\211\377N[\211\377IU\200\377\5\6" \
+  "\12\377\202\0\0\0\377\1\372\372\372\377\220\377\377\377\377\1\262\262" \
+  "\262\377\202\0\0\0\377\2\3\4\5\377HSz\377\214Q^\212\377\5DOt\377\4\5" \
+  "\10\377\0\0\0\377\12\12\12\377\271\271\271\377\220\377\377\377\377\1" \
+  "\331\331\331\377\202\0\0\0\377\10\16\20\30\377HT\177\377N[\211\377LX" \
+  "\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377" \
+  "\377\1\365\365\365\377\202\0\0\0\377\1\5\6\11\377\204LY\207\377\1JW\205" \
+  "\377\202KX\206\377\4\12\14\23\377\0\0\0\377\11\11\11\377\256\256\256" \
+  "\377\216\377\377\377\377\2\314\314\314\377\13\13\13\377\204\0\0\0\377" \
+  "\1\236\236\236\377\255\377\377\377\377\2\365\365\365\377VVV\377\202\0" \
+  "\0\0\377\2-6W\377\")B\377\202\0\0\0\377\1ppp\377\217\377\377\377\377" \
+  "\11\10\10\10\377\0\0\0\377\2\2\3\377@N\177\377\77M~\3773Bv\377\32+f\377" \
+  "\30)d\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555" \
+  "\377\202\0\0\0\377\1/;b\377\203<K}\377\202;J|\377\2""6Cq\377\15\20\33" \
+  "\377\202\0\0\0\377\1\306\306\306\377\231\377\377\377\377\1OOO\377\202" \
+  "\0\0\0\377\1\31\40""7\377\2028Fz\377\1\40)G\377\202\0\0\0\377\3ccc\377" \
+  "\377\377\377\377\376\376\376\377\227\377\377\377\377\13\270\270\270\377" \
+  "\16\16\16\377\0\0\0\377\2\4\13\377\30)c\377\31*e\377\30)d\377\33,f\377" \
+  "-=s\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377" \
+  "\377\377\377\4\202\202\202\377\3\3\3\377\0\0\0\377\10\16$\377\222\31" \
+  "*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216\377" \
+  "\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225" \
+  "\31*e\377\2\30)d\377\34-g\377\204(8o\377\1&6o\377\205'7o\377\1\37""0" \
+  "i\377\234\31*e\377\2\26'c\3773Bv\377\202IV\205\377\2HU\204\377IV\205" \
+  "\377\206JW\206\377\1IV\206\377\202JW\206\377\205KX\206\377\2JW\205\377" \
+  "KX\206\377\206LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\2KZ\206" \
+  "\377LZ\207\377\206MZ\210\377\2LY\207\377MZ\210\377\206N[\211\377\3MZ" \
+  "\211\377KW\204\377\26\32(\377\202\0\0\0\377\1\254\254\254\377\220\377" \
+  "\377\377\377\2\352\352\352\377888\377\202\0\0\0\377\2\31\35+\377N[\205" \
+  "\377\212Q^\212\377\2O[\206\377\33\37.\377\202\0\0\0\377\2;;;\377\361" \
+  "\361\361\377\216\377\377\377\377\3\376\376\376\377\377\377\377\377\215" \
+  "\215\215\377\202\0\0\0\377\10\35!3\377KX\204\377N[\211\377LX\205\377" \
+  "\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\2" \
+  "\366\366\366\377\30\30\30\377\202\0\0\0\377\1JW\204\377\203LY\207\377" \
+  "\202KX\206\377\5HT\201\377\10\12\17\377\0\0\0\377\22\22\22\377\275\275" \
+  "\275\377\216\377\377\377\377\4\310\310\310\377\4\4\4\377\0\0\0\377\1" \
+  "\2\5\377\202\0\0\0\377\1\211\211\211\377\215\377\377\377\377\202\376" \
+  "\376\376\377\236\377\377\377\377\2\375\375\375\377ZZZ\377\202\0\0\0\377" \
+  "\2-6W\377\")B\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\11\10\10" \
+  "\10\377\0\0\0\377\1\2\3\377@N\177\377\77M~\3771\77u\377\32*e\377\30)" \
+  "d\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377" \
+  "\202\0\0\0\377\1/;b\377\203<K}\377\202;J|\377\2""9Hy\377\26\34""0\377" \
+  "\202\0\0\0\377\3\207\207\207\377\377\377\377\377\376\376\376\377\226" \
+  "\377\377\377\377\5\351\351\351\377***\377\0\0\0\377\2\3\5\377%.Q\377" \
+  "\2028Fz\377\1.:e\377\202\0\0\0\377\1\22\22\22\377\231\377\377\377\377" \
+  "\1\226\226\226\377\202\0\0\0\377\1\6\13\32\377\202\31*e\377\5\30)d\377" \
+  "\34,g\377.=s\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377" \
+  "\216\377\377\377\377\4ppp\377\1\1\1\377\0\0\0\377\12\21)\377\222\31*" \
+  "e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216\377\377" \
+  "\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31" \
+  "*e\377\2\30)d\377\35-h\377\204(8o\377\1&6o\377\205'7o\377\2\37/i\377" \
+  "\30)e\377\233\31*e\377\3\27(d\377*9p\377JW\205\377\202IV\205\377\1HU" \
+  "\204\377\207JW\206\377\1IV\206\377\206KX\206\377\2JW\205\377KX\206\377" \
+  "\206LY\207\377\1LX\207\377\202LY\207\377\205LZ\207\377\2KZ\206\377LZ" \
+  "\207\377\206MZ\210\377\2LY\207\377MZ\210\377\207N[\211\377\2LY\210\377" \
+  "+2J\377\202\0\0\0\377\3KKK\377\377\377\377\377\376\376\376\377\217\377" \
+  "\377\377\377\6\245\245\245\377\2\2\2\377\0\0\0\377\0\0\1\377\33\37.\377" \
+  "NZ\205\377\210Q^\212\377\3O\\\207\377\34!1\377\0\0\1\377\202\0\0\0\377" \
+  "\3\251\251\251\377\377\377\377\377\376\376\376\377\217\377\377\377\377" \
+  "\1""999\377\202\0\0\0\377\1-5P\377\202N[\211\377\5LX\205\377\30\34+\377" \
+  "\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\2\371\371\371" \
+  "\377EEE\377\202\0\0\0\377\4""6\77`\377LY\207\377KX\206\377LY\207\377" \
+  "\202KX\206\377\5<Gl\377\6\7\13\377\0\0\0\377\40\40\40\377\324\324\324" \
+  "\377\216\377\377\377\377\1\302\302\302\377\202\0\0\0\377\1\5\12\30\377" \
+  "\202\0\0\0\377\1hhh\377\217\377\377\377\377\1\255\255\255\377\235\237" \
+  "\237\237\377\2\231\231\231\377666\377\202\0\0\0\377\2-6W\377\")B\377" \
+  "\202\0\0\0\377\1ppp\377\217\377\377\377\377\11\10\10\10\377\0\0\0\377" \
+  "\2\2\3\377>L}\377\77M~\377/=s\377\31)e\377\30)d\377\24!P\377\202\0\0" \
+  "\0\377\1DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377\1/;b\377" \
+  "\203<K}\377\203;J|\377\1\40(D\377\202\0\0\0\377\3GGG\377\377\377\377" \
+  "\377\376\376\376\377\226\377\377\377\377\5\274\274\274\377\22\22\22\377" \
+  "\0\0\0\377\5\7\14\3771>l\377\2028Fz\377\2""2@o\377\11\14\26\377\202\0" \
+  "\0\0\377\1\320\320\320\377\227\377\377\377\377\2\371\371\371\377kkk\377" \
+  "\202\0\0\0\377\1\15\25""4\377\202\31*e\377\5\30)d\377\34-g\377.>t\377" \
+  "3Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377\377\377" \
+  "\377\1ccc\377\202\0\0\0\377\1\13\23/\377\222\31*e\377\2\30)c\377\12\22" \
+  ",\377\202\0\0\0\377\1\225\225\225\377\216\377\377\377\377\1\367\367\367" \
+  "\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225\31*e\377\2\30)d\377\35." \
+  "h\377\202(8o\377\3'7o\377(8o\377&6o\377\203'7o\377\4&6o\377'7o\377\36" \
+  "/h\377\30)d\377\233\31*e\377\6\30)d\377\37""0i\377KW\206\377HU\204\377" \
+  "IV\205\377HU\204\377\207JW\206\377\1IV\206\377\207KX\206\377\1JW\205" \
+  "\377\206LY\207\377\2LX\207\377LY\207\377\207LZ\207\377\1KZ\206\377\207" \
+  "MZ\210\377\3LY\207\377N[\211\377MZ\210\377\205N[\211\377\6MZ\211\377" \
+  "9Ce\377\3\4\6\377\0\0\0\377\21\21\21\377\354\354\354\377\216\377\377" \
+  "\377\377\1\376\376\376\377\202\377\377\377\377\1hhh\377\203\0\0\0\377" \
+  "\3\6\7\12\377-4M\377KW\200\377\204Q^\212\377\3JV\177\377-4M\377\6\7\13" \
+  "\377\203\0\0\0\377\1fff\377\202\377\377\377\377\1\376\376\376\377\216" \
+  "\377\377\377\377\5\336\336\336\377\24\24\24\377\0\0\0\377\6\7\12\377" \
+  ";Dg\377\202N[\211\377\5LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\216\377\377\377\377\2\375\375\375\377\212\212\212\377\202" \
+  "\0\0\0\377\1\20\23\35\377\202LY\207\377\203KX\206\377\5*1K\377\1\1\2" \
+  "\377\0\0\0\377666\377\367\367\367\377\215\377\377\377\377\2\376\376\376" \
+  "\377\257\257\257\377\202\0\0\0\377\4\11\20(\377\1\3\7\377\0\0\0\377;" \
+  ";;\377\217\377\377\377\377\1""666\377\236\3\3\3\377\1\1\1\1\377\202\0" \
+  "\0\0\377\2-6W\377\")B\377\202\0\0\0\377\1ppp\377\217\377\377\377\377" \
+  "\3\10\10\10\377\0\0\0\377\2\2\3\377\202\77M~\377\1,;q\377\202\30)d\377" \
+  "\1\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377\202" \
+  "\0\0\0\377\1/;b\377\203<K}\377\203;J|\377\5(3V\377\3\4\6\377\0\0\0\377" \
+  "%%%\377\370\370\370\377\227\377\377\377\377\1\220\220\220\377\202\0\0" \
+  "\0\377\1\14\17\32\377\2038Fz\377\2""5Dv\377\25\34""0\377\202\0\0\0\377" \
+  "\3~~~\377\377\377\377\377\376\376\376\377\225\377\377\377\377\2\356\356" \
+  "\356\377===\377\202\0\0\0\377\1\23\40N\377\202\31*e\377\5\30)d\377\34" \
+  "-g\3770\77u\3773Bw\377*6d\377\202\0\0\0\377\2EEE\377\370\370\370\377" \
+  "\216\377\377\377\377\4YYY\377\0\0\0\377\0\0\1\377\14\25""3\377\222\31" \
+  "*e\377\2\30)c\377\12\22,\377\202\0\0\0\377\1\225\225\225\377\216\377" \
+  "\377\377\377\1\367\367\367\377\202\0\0\0\377\2\3\6\17\377\27'_\377\225" \
+  "\31*e\377\2\30)d\377\37/i\377\203(8o\377\2'7o\377&6o\377\203'7o\377\4" \
+  "'7n\377'7o\377\36.h\377\30)d\377\233\31*e\377\3\30)d\377\27)d\377HU\204" \
+  "\377\202IV\205\377\3HU\204\377JW\206\377IV\205\377\205JW\206\377\1IV" \
+  "\206\377\207KX\206\377\1JW\205\377\207LY\207\377\1LX\207\377\207LZ\207" \
+  "\377\3KZ\206\377MZ\210\377LZ\207\377\205MZ\210\377\2LY\207\377MZ\210" \
+  "\377\207N[\211\377\5FR|\377\20\23\35\377\0\0\0\377\5\5\5\377\222\222" \
+  "\222\377\220\377\377\377\377\4\376\376\376\377\377\377\377\377hhh\377" \
+  "\3\3\3\377\204\0\0\0\377\4\4\4\7\377\13\14\22\377\12\14\22\377\3\4\5" \
+  "\377\204\0\0\0\377\4\2\2\2\377aaa\377\377\377\377\377\376\376\376\377" \
+  "\220\377\377\377\377\5\216\216\216\377\5\5\5\377\0\0\0\377\21\23\36\377" \
+  "IU\200\377\202N[\211\377\5KW\204\377\30\34+\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\217\377\377\377\377\2\316\316\316\377\17\17\17\377\202\0" \
+  "\0\0\377\6%,C\377IU\202\377IV\203\377HU\202\377\77Jp\377\16\21\32\377" \
+  "\202\0\0\0\377\3sss\377\377\377\377\377\376\376\376\377\214\377\377\377" \
+  "\377\2\375\375\375\377\214\214\214\377\202\0\0\0\377\4\15\27""8\377\5" \
+  "\11\26\377\0\0\0\377\4\4\4\377\215\377\377\377\377\3\376\376\376\377" \
+  "\377\377\377\377hhh\377\241\0\0\0\377\2-6W\377\")B\377\202\0\0\0\377" \
+  "\1ppp\377\217\377\377\377\377\11\10\10\10\377\0\0\0\377\2\2\3\377\77" \
+  "M~\377\77L}\377*9p\377\30)d\377\31*e\377\24!P\377\202\0\0\0\377\1DDD" \
+  "\377\217\377\377\377\377\1""555\377\202\0\0\0\377\4/;b\377<K}\377;J|" \
+  "\377<K}\377\203;J|\377\5""1>h\377\7\11\17\377\0\0\0\377\27\27\27\377" \
+  "\316\316\316\377\226\377\377\377\377\2\365\365\365\377ZZZ\377\202\0\0" \
+  "\0\377\1\35$\77\377\2038Fz\377\2""7Fy\377\40*H\377\202\0\0\0\377\1""3" \
+  "33\377\227\377\377\377\377\2\344\344\344\377\17\17\17\377\202\0\0\0\377" \
+  "\203\31*e\377\5\30)d\377\35.h\3771@u\3772Av\377*6d\377\202\0\0\0\377" \
+  "\2EEE\377\370\370\370\377\216\377\377\377\377\4UUU\377\0\0\0\377\0\0" \
+  "\1\377\15\26""5\377\222\31*e\377\2\30)c\377\12\22,\377\202\0\0\0\377" \
+  "\1\222\222\222\377\216\377\377\377\377\1\367\367\367\377\202\0\0\0\377" \
+  "\2\3\6\17\377\27(`\377\202\31*e\377\6\30)b\377\26&\\\377\24!P\377\12" \
+  "\20(\377\17\32\77\377\30)d\377\215\31*e\377\2\30)d\377\37""0i\377\203" \
+  "(8o\377\207'7o\377\2\36.h\377\30)d\377\234\31*e\377\6\27(c\377=K|\377" \
+  "JV\205\377IV\205\377HU\204\377IV\205\377\206JW\206\377\3IV\206\377KX" \
+  "\206\377JW\206\377\205KX\206\377\3JW\205\377LY\207\377KX\206\377\205" \
+  "LY\207\377\3LX\207\377LZ\207\377LY\207\377\205LZ\207\377\2KZ\206\377" \
+  "LZ\207\377\210MZ\210\377\2N[\211\377MZ\210\377\205N[\211\377\6MZ\211" \
+  "\377\"(=\377\0\0\1\377\0\0\0\377@@@\377\363\363\363\377\217\377\377\377" \
+  "\377\202\376\376\376\377\3\377\377\377\377\236\236\236\377111\377\212" \
+  "\0\0\0\377\3...\377\227\227\227\377\377\377\377\377\202\376\376\376\377" \
+  "\217\377\377\377\377\5\362\362\362\377CCC\377\0\0\0\377\0\0\1\377$*\77" \
+  "\377\203N[\211\377\5LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235" \
+  "\235\377\217\377\377\377\377\2\372\372\372\377mmm\377\203\0\0\0\377\4" \
+  "\23\26\"\377\"(=\377!';\377\14\16\26\377\202\0\0\0\377\2\23\23\23\377" \
+  "\343\343\343\377\216\377\377\377\377\2\373\373\373\377```\377\202\0\0" \
+  "\0\377\2\22\37L\377\12\21)\377\202\0\0\0\377\1\313\313\313\377\216\377" \
+  "\377\377\377\1\266\266\266\377\203\0\0\0\377\2\22\26$\377\26\33*\377" \
+  "\205\26\32*\377\2\25\32)\377\3\4\7\377\223\0\0\0\377\4\2\3\5\377\6\7" \
+  "\14\377)1O\377\36$:\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\11" \
+  "\10\10\10\377\0\0\0\377\2\2\3\377\77M~\377>K}\377'7n\377\30)d\377\31" \
+  "*e\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377" \
+  "\202\0\0\0\377\1/;b\377\202<K}\377\2;J|\377:I{\377\202;J|\377\7:Hz\377" \
+  "\13\16\30\377\0\0\0\377\11\11\11\377\243\243\243\377\377\377\377\377" \
+  "\376\376\376\377\223\377\377\377\377\3\376\376\376\377\346\346\346\377" \
+  "\"\"\"\377\202\0\0\0\377\1/;f\377\2028Fz\377\7""7Fy\3776Fx\377)6]\377" \
+  "\5\6\13\377\0\0\0\377\27\27\27\377\337\337\337\377\226\377\377\377\377" \
+  "\1\311\311\311\377\202\0\0\0\377\1\5\10\24\377\203\31*e\377\2\30)d\377" \
+  "\36.h\377\2022Av\377\1*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377" \
+  "\216\377\377\377\377\4SSS\377\0\0\0\377\0\0\1\377\15\26""6\377\222\31" \
+  "*e\377\2\30)c\377\12\22-\377\202\0\0\0\377\1\216\216\216\377\217\377" \
+  "\377\377\377\202\0\0\0\377\6\2\3\10\377\24!Q\377\23\40M\377\17\32\77" \
+  "\377\12\21*\377\4\6\20\377\202\0\0\0\377\2\12\22,\377\30)c\377\215\31" \
+  "*e\377\2\30)d\377\40""0j\377\203(8o\377\206'7o\377\3&6o\377\35.h\377" \
+  "\30)d\377\234\31*e\377\4\30)d\3771\77t\377KW\206\377HU\204\377\202IV" \
+  "\205\377\210JW\206\377\210KX\206\377\210LY\207\377\2LZ\207\377LY\207" \
+  "\377\206LZ\207\377\2MZ\210\377LZ\207\377\205MZ\210\377\4LY\207\377MZ" \
+  "\210\377N[\211\377MZ\210\377\205N[\211\377\5@Ks\377\2\3\4\377\0\0\0\377" \
+  "\6\6\6\377\264\264\264\377\220\377\377\377\377\1\376\376\376\377\202" \
+  "\377\377\377\377\5\344\344\344\377\254\254\254\377aaa\377)))\377\6\6" \
+  "\6\377\202\0\0\0\377\5\7\7\7\377(((\377___\377\251\251\251\377\341\341" \
+  "\341\377\202\377\377\377\377\1\376\376\376\377\220\377\377\377\377\5" \
+  "\273\273\273\377\5\5\5\377\0\0\0\377\1\2\3\377DOw\377\202N[\211\377\6" \
+  "MZ\210\377LX\205\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\216" \
+  "\377\377\377\377\4\376\376\376\377\377\377\377\377\360\360\360\377MM" \
+  "M\377\210\0\0\0\377\3\270\270\270\377\377\377\377\377\376\376\376\377" \
+  "\214\377\377\377\377\3\376\376\376\377\373\373\373\377(((\377\202\0\0" \
+  "\0\377\2\30(a\377\17\32\77\377\202\0\0\0\377\3hhh\377\377\377\377\377" \
+  "\376\376\376\377\215\377\377\377\377\1\27\27\27\377\202\0\0\0\377\1\27" \
+  "\34-\377\202ES\203\377\202CQ\200\377\4ES\203\377DR\202\377&.I\377\2\3" \
+  "\5\377\223\0\0\0\377\4\2\2\4\377\4\5\11\377\17\22\35\377\30\35.\377\202" \
+  "\0\0\0\377\1ppp\377\217\377\377\377\377\11\10\10\10\377\0\0\0\377\2\2" \
+  "\3\377\77M~\377<K|\377$4l\377\30)d\377\31*e\377\24!P\377\202\0\0\0\377" \
+  "\1DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377\1/;b\377\202<" \
+  "K}\377\2;J|\377:I{\377\203;J|\377\1\24\31+\377\202\0\0\0\377\1zzz\377" \
+  "\226\377\377\377\377\1\314\314\314\377\202\0\0\0\377\1\5\6\13\377\203" \
+  "8Fz\377\11""7Fy\3776Fx\3774Bs\377\12\15\27\377\0\0\0\377\12\12\12\377" \
+  "\246\246\246\377\377\377\377\377\376\376\376\377\224\377\377\377\377" \
+  "\1\213\213\213\377\202\0\0\0\377\1\13\23/\377\203\31*e\377\5\30)d\377" \
+  "\36/h\3773Bw\3772Av\377*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377" \
+  "\216\377\377\377\377\4SSS\377\0\0\0\377\0\0\1\377\15\26""7\377\222\31" \
+  "*e\377\2\30)c\377\13\23/\377\202\0\0\0\377\1\206\206\206\377\217\377" \
+  "\377\377\377\1\7\7\7\377\202\0\0\0\377\2\3\6\16\377\2\3\11\377\205\0" \
+  "\0\0\377\2\10\16$\377\30(b\377\215\31*e\377\2\30)d\377!1j\377\203(8o" \
+  "\377\206'7o\377\3&6n\377\35.h\377\30)d\377\234\31*e\377\3\30)d\377#3" \
+  "l\377KX\206\377\203IV\205\377\2JW\206\377IV\205\377\206JW\206\377\2K" \
+  "X\206\377JW\206\377\206KX\206\377\2LY\207\377KX\206\377\207LY\207\377" \
+  "\210LZ\207\377\206MZ\210\377\1LY\207\377\202MZ\210\377\206N[\211\377" \
+  "\2MZ\211\377\32\37.\377\202\0\0\0\377\3AAA\377\365\365\365\377\376\376" \
+  "\376\377\217\377\377\377\377\1\376\376\376\377\203\377\377\377\377\3" \
+  "\371\371\371\377\364\364\364\377\361\361\361\377\202\360\360\360\377" \
+  "\4\361\361\361\377\364\364\364\377\371\371\371\377\376\376\376\377\202" \
+  "\377\377\377\377\1\376\376\376\377\217\377\377\377\377\3\376\376\376" \
+  "\377\371\371\371\377HHH\377\202\0\0\0\377\1\33\40""0\377\204N[\211\377" \
+  "\5KW\204\377\30\34*\377\0\0\0\377\4\4\4\377\235\235\235\377\217\377\377" \
+  "\377\377\5\376\376\376\377\377\377\377\377\375\375\375\377\211\211\211" \
+  "\377\2\2\2\377\204\0\0\0\377\5$$$\377\316\316\316\377\376\376\376\377" \
+  "\377\377\377\377\376\376\376\377\215\377\377\377\377\1\352\352\352\377" \
+  "\202\0\0\0\377\6\4\6\20\377\31*e\377\23\40P\377\1\1\4\377\0\0\0\377\15" \
+  "\15\15\377\215\377\377\377\377\3\376\376\376\377\377\377\377\377\260" \
+  "\260\260\377\203\0\0\0\377\7\15\20\32\3771;^\377\77Ly\377@Mz\3774>c\377" \
+  "\27\33,\377\1\1\2\377\202\0\0\0\377\11(((\377\311\311\311\377\271\271" \
+  "\271\377\233\233\233\377~~~\377bbb\377EEE\377(((\377\13\13\13\377\213" \
+  "\0\0\0\377\2\35#8\377\"*C\377\202\0\0\0\377\1ppp\377\217\377\377\377" \
+  "\377\11\10\10\10\377\0\0\0\377\2\2\3\377\77M~\377;J{\377!1j\377\30)d" \
+  "\377\31*e\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""5" \
+  "55\377\202\0\0\0\377\1/;b\377\202<K}\377\2;J|\377:I{\377\203;J|\377\1" \
+  "\"*G\377\202\0\0\0\377\2TTT\377\365\365\365\377\225\377\377\377\377\1" \
+  "\205\205\205\377\202\0\0\0\377\1\27\35""2\377\2038Fz\377\4""7Fy\3776" \
+  "Fx\3777Fy\377\24\31,\377\202\0\0\0\377\1ooo\377\226\377\377\377\377\1" \
+  "III\377\202\0\0\0\377\1\22\37K\377\203\31*e\377\5\30)d\377\37/i\3774" \
+  "Cw\3772Av\377*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377\377" \
+  "\377\377\4SSS\377\0\0\0\377\0\0\1\377\15\26""7\377\222\31*e\377\2\30" \
+  ")d\377\13\24""3\377\202\0\0\0\377\1xxx\377\215\377\377\377\377\3\376" \
+  "\376\376\377\377\377\377\377WWW\377\211\0\0\0\377\2\6\13\32\377\30(a" \
+  "\377\215\31*e\377\2\30)d\377!2k\377\203(8o\377\206'7o\377\3&6n\377\35" \
+  "-g\377\30)d\377\234\31*e\377\3\31*d\377\34,g\377FS\203\377\204IV\205" \
+  "\377\210JW\206\377\210KX\206\377\206LY\207\377\2LX\207\377LY\207\377" \
+  "\206LZ\207\377\4KZ\206\377LZ\207\377MZ\210\377LZ\207\377\205MZ\210\377" \
+  "\2LY\207\377MZ\210\377\207N[\211\377\2FR}\377\0\0\1\377\202\0\0\0\377" \
+  "\3\242\242\242\377\377\377\377\377\376\376\376\377\254\377\377\377\377" \
+  "\3\376\376\376\377\377\377\377\377\257\257\257\377\203\0\0\0\377\1GS" \
+  "}\377\202N[\211\377\7MZ\210\377N[\211\377JV\203\377\30\34+\377\0\0\0" \
+  "\377\4\4\4\377\235\235\235\377\221\377\377\377\377\7\376\376\376\377" \
+  "\377\377\377\377\371\371\371\377\255\255\255\377\203\203\203\377\206" \
+  "\206\206\377\275\275\275\377\202\377\377\377\377\1\376\376\376\377\215" \
+  "\377\377\377\377\3\376\376\376\377\377\377\377\377\223\223\223\377\202" \
+  "\0\0\0\377\7\13\23-\377\31*e\377\26%[\377\7\13\31\377\0\0\0\377\2\2\2" \
+  "\377\232\232\232\377\215\377\377\377\377\3\376\376\376\377\377\377\377" \
+  "\377nnn\377\212\0\0\0\377\2\31\31\31\377\332\332\332\377\211\377\377" \
+  "\377\377\7\351\351\351\377\315\315\315\377\261\261\261\377\225\225\225" \
+  "\377yyy\377^^^\377\31\31\31\377\202\0\0\0\377\3\4\5\10\377AO~\377\40" \
+  "'\77\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\11\10\10\10\377\0" \
+  "\0\0\377\2\2\3\377\77M~\377:Hz\377\36.h\377\30)d\377\31*e\377\24!P\377" \
+  "\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377" \
+  "\1/;b\377\202<K}\377\2;J|\377:I{\377\203;J|\377\5/;d\377\0\0\1\377\0" \
+  "\0\0\377///\377\342\342\342\377\223\377\377\377\377\3\376\376\376\377" \
+  "\377\377\377\377444\377\202\0\0\0\377\1*4\\\377\2038Fz\377\10""7Fy\377" \
+  "6Fx\3777Fy\377#-M\377\0\1\1\377\0\0\0\377CCC\377\355\355\355\377\225" \
+  "\377\377\377\377\1\13\13\13\377\202\0\0\0\377\1\27(`\377\204\31*e\377" \
+  "\4!1j\3774Cx\3772Av\377*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377" \
+  "\216\377\377\377\377\4SSS\377\0\0\0\377\0\0\1\377\15\26""7\377\223\31" \
+  "*e\377\1\15\26""9\377\202\0\0\0\377\1bbb\377\217\377\377\377\377\10\355" \
+  "\355\355\377999\377\17\17\17\377\20\20\20\377\24\24\24\377+++\377uuu" \
+  "\377\311\311\311\377\202\0\0\0\377\2\4\7\21\377\27'_\377\215\31*e\377" \
+  "\2\30)d\377\"3k\377\203(8o\377\206'7o\377\3%6n\377\34-g\377\30)d\377" \
+  "\235\31*e\377\6\32+f\377;I{\377JV\205\377IV\205\377HU\204\377IV\205\377" \
+  "\206JW\206\377\2IV\206\377JW\206\377\206KX\206\377\2JW\205\377KX\206" \
+  "\377\206LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\204LZ\207" \
+  "\377\202KZ\206\377\1LZ\207\377\206MZ\210\377\202LY\207\377\202MZ\210" \
+  "\377\206N[\211\377\1*1K\377\202\0\0\0\377\4\5\5\5\377\326\326\326\377" \
+  "\377\377\377\377\376\376\376\377\252\377\377\377\377\4\376\376\376\377" \
+  "\377\377\377\377\340\340\340\377\14\14\14\377\202\0\0\0\377\1(/G\377" \
+  "\204N[\211\377\6MZ\210\377JV\203\377\30\34+\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\231\377\377\377\377\1\376\376\376\377\220\377\377\377\377" \
+  "\1&&&\377\202\0\0\0\377\4\23\40M\377\31*e\377\30)d\377\22\32""5\377\202" \
+  "\0\0\0\377\2""555\377\364\364\364\377\216\377\377\377\377\3\371\371\371" \
+  "\377zzz\377\24\24\24\377\206\0\0\0\377\5\10\10\10\377III\377\337\337" \
+  "\337\377\377\377\377\377\376\376\376\377\205\377\377\377\377\202\376" \
+  "\376\376\377\206\377\377\377\377\2\355\355\355\377\23\23\23\377\202\0" \
+  "\0\0\377\3*3R\377BP\177\377\40'>\377\202\0\0\0\377\1ppp\377\217\377\377" \
+  "\377\377\11\10\10\10\377\0\0\0\377\1\2\3\377\77M~\3779Gz\377\32+e\377" \
+  "\30)d\377\31*e\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377" \
+  "\1""555\377\202\0\0\0\377\1/;b\377\202<K}\377\2;J|\377:I{\377\204;J|" \
+  "\377\4\2\3\5\377\0\0\0\377\11\11\11\377\320\320\320\377\224\377\377\377" \
+  "\377\1\362\362\362\377\202\0\0\0\377\2\1\2\3\3776Dw\377\2038Fz\377\10" \
+  "7Fy\3776Fx\3777Fy\3772@o\377\1\1\2\377\0\0\0\377\27\27\27\377\324\324" \
+  "\324\377\224\377\377\377\377\1\336\336\336\377\202\0\0\0\377\2\4\7\23" \
+  "\377\30)b\377\204\31*e\377\4#3k\3774Cw\3772Av\377*7e\377\202\0\0\0\377" \
+  "\2EEE\377\370\370\370\377\216\377\377\377\377\4SSS\377\0\0\0\377\0\0" \
+  "\1\377\15\26""7\377\222\31*e\377\2\30)e\377\17\32\77\377\202\0\0\0\377" \
+  "\3EEE\377\377\377\377\377\376\376\376\377\214\377\377\377\377\1\376\376" \
+  "\376\377\202\377\377\377\377\3\337\337\337\377\326\326\326\377\360\360" \
+  "\360\377\203\377\377\377\377\4\1\1\1\377\0\0\0\377\1\2\7\377\27'^\377" \
+  "\215\31*e\377\2\30)d\377$4l\377\203(8o\377\206'7o\377\3%5n\377\33,g\377" \
+  "\30)d\377\236\31*e\377\5/>s\377JW\206\377IV\205\377HU\204\377IV\205\377" \
+  "\206JW\206\377\2IV\206\377JW\206\377\206KX\206\377\2JW\205\377KX\206" \
+  "\377\207LY\207\377\2LX\207\377LY\207\377\206LZ\207\377\4KZ\206\377LZ" \
+  "\207\377MZ\210\377LZ\207\377\206MZ\210\377\3LY\207\377N[\211\377MZ\210" \
+  "\377\205N[\211\377\2JW\203\377\23\26!\377\202\0\0\0\377\4///\377\356" \
+  "\356\356\377\377\377\377\377\376\376\376\377\250\377\377\377\377\4\376" \
+  "\376\376\377\377\377\377\377\365\365\365\377;;;\377\202\0\0\0\377\4\20" \
+  "\23\35\377IU\200\377N[\211\377MZ\210\377\202N[\211\377\6MZ\210\377KW" \
+  "\204\377\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\247\377\377\377" \
+  "\377\3\376\376\376\377\377\377\377\377\273\273\273\377\202\0\0\0\377" \
+  "\13\4\6\20\377\26&\\\377\31*e\377\30)d\377&2`\377\5\6\12\377\0\0\0\377" \
+  "\4\4\4\377\234\234\234\377\377\377\377\377\376\376\376\377\213\377\377" \
+  "\377\377\16\376\376\376\377\377\377\377\377\376\376\376\377\311\311\311" \
+  "\377\204\204\204\377III\377---\377,,,\377DDD\377yyy\377\272\272\272\377" \
+  "\367\367\367\377\377\377\377\377\376\376\376\377\213\377\377\377\377" \
+  "\1\376\376\376\377\202\377\377\377\377\1===\377\202\0\0\0\377\1\22\26" \
+  "#\377\202BP\200\377\1\40'>\377\202\0\0\0\377\1ppp\377\217\377\377\377" \
+  "\377\11\10\10\10\377\0\0\0\377\1\2\3\377\77M~\3777Fy\377\27(c\377\30" \
+  ")d\377\31*e\377\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1" \
+  "555\377\202\0\0\0\377\1/;b\377\202<K}\377\2;J|\377:I{\377\204;J|\377" \
+  "\1\16\22\36\377\202\0\0\0\377\2\257\257\257\377\376\376\376\377\223\377" \
+  "\377\377\377\1\242\242\242\377\202\0\0\0\377\2\21\25&\3777Ex\377\203" \
+  "8Fz\377\2""7Fy\3776Fx\377\2027Fy\377\1\12\15\27\377\202\0\0\0\377\2\257" \
+  "\257\257\377\376\376\376\377\223\377\377\377\377\1\227\227\227\377\202" \
+  "\0\0\0\377\2\12\21)\377\30)c\377\204\31*e\377\4%5m\3774Cw\3772Av\377" \
+  "*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377\377\377\377\4" \
+  "SSS\377\0\0\0\377\0\0\1\377\15\26""7\377\222\31*e\377\5\30)d\377\20\35" \
+  "F\377\1\1\2\377\0\0\0\377!!!\377\217\377\377\377\377\1\376\376\376\377" \
+  "\205\377\377\377\377\3\376\376\376\377\377\377\377\377\"\"\"\377\202" \
+  "\0\0\0\377\1\27&]\377\215\31*e\377\2\30)d\377%5l\377\203(8o\377\206'" \
+  "7o\377\3%5m\377\33,f\377\30)d\377\235\31*e\377\3\30)d\377%5m\377GT\204" \
+  "\377\202IV\205\377\2HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW" \
+  "\206\377\206KX\206\377\2JW\205\377KX\206\377\206LY\207\377\1LX\207\377" \
+  "\202LY\207\377\206LZ\207\377\2KZ\206\377LZ\207\377\207MZ\210\377\4LY" \
+  "\207\377MZ\210\377N[\211\377MZ\210\377\205N[\211\377\2;Eh\377\6\7\12" \
+  "\377\202\0\0\0\377\2WWW\377\372\372\372\377\252\377\377\377\377\2\374" \
+  "\374\374\377eee\377\202\0\0\0\377\2\4\4\7\3777Ab\377\203N[\211\377\202" \
+  "MZ\210\377\6LY\207\377KW\204\377\30\34+\377\0\0\0\377\4\4\4\377\235\235" \
+  "\235\377\251\377\377\377\377\1""777\377\202\0\0\0\377\6\14\24""0\377" \
+  "\30)d\377\31*e\377\32+f\3776Dx\377\35\"5\377\202\0\0\0\377\3\37\37\37" \
+  "\377\350\350\350\377\376\376\376\377\214\377\377\377\377\1\376\376\376" \
+  "\377\202\377\377\377\377\2\374\374\374\377\364\364\364\377\202\360\360" \
+  "\360\377\2\363\363\363\377\372\372\372\377\202\377\377\377\377\1\376" \
+  "\376\376\377\214\377\377\377\377\3\376\376\376\377\377\377\377\377xx" \
+  "x\377\202\0\0\0\377\2\2\3\5\3775Ai\377\202BP\200\377\1\40'>\377\202\0" \
+  "\0\0\377\1ppp\377\217\377\377\377\377\6\10\10\10\377\0\0\0\377\1\2\3" \
+  "\377\77M~\3772Au\377\26(c\377\202\31*e\377\1\24!P\377\202\0\0\0\377\1" \
+  "DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377\5/;b\377;J|\377" \
+  "<K}\377;J|\377:I{\377\204;J|\377\1\37'A\377\202\0\0\0\377\2vvv\377\375" \
+  "\375\375\377\221\377\377\377\377\3\376\376\376\377\377\377\377\377II" \
+  "I\377\202\0\0\0\377\1!*I\377\2048Fz\377\2""7Fy\3776Fx\377\2027Fy\377" \
+  "\1\35%@\377\202\0\0\0\377\2mmm\377\374\374\374\377\221\377\377\377\377" \
+  "\3\376\376\376\377\377\377\377\377RRR\377\202\0\0\0\377\1\17\32\77\377" \
+  "\205\31*e\377\4'7n\3774Bw\3772Av\377*7e\377\202\0\0\0\377\2EEE\377\370" \
+  "\370\370\377\216\377\377\377\377\4SSS\377\0\0\0\377\0\0\1\377\15\26""7" \
+  "\377\222\31*e\377\6\30)d\377\24!N\377\3\5\12\377\0\0\0\377\24\24\24\377" \
+  "\360\360\360\377\226\377\377\377\377\1BBB\377\202\0\0\0\377\1\25#U\377" \
+  "\214\31*e\377\4\30*e\377\30(d\377%6m\377(7n\377\202(8o\377\206'7o\377" \
+  "\3%5m\377\33+f\377\30)d\377\235\31*e\377\3\30)d\377\36/h\377@N\177\377" \
+  "\202IV\205\377\2HU\204\377IV\205\377\206JW\206\377\2IV\206\377JW\206" \
+  "\377\206KX\206\377\1JW\205\377\202KX\206\377\206LY\207\377\1LX\207\377" \
+  "\202LY\207\377\206LZ\207\377\3KZ\206\377MZ\210\377LZ\207\377\206MZ\210" \
+  "\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377\205N[\211\377\2(/F\377" \
+  "\1\1\2\377\202\0\0\0\377\4~~~\377\370\370\370\377\377\377\377\377\376" \
+  "\376\376\377\244\377\377\377\377\4\376\376\376\377\377\377\377\377\372" \
+  "\372\372\377\212\212\212\377\202\0\0\0\377\2\0\1\1\377$*\77\377\203N" \
+  "[\211\377\202MZ\210\377\7LY\207\377MZ\210\377KW\204\377\30\34+\377\0" \
+  "\0\0\377\4\4\4\377\235\235\235\377\250\377\377\377\377\5\242\242\242" \
+  "\377\11\11\11\377\0\0\0\377\2\4\11\377\23\40O\377\202\31*e\377\4\35-" \
+  "g\377@M\177\377ER\177\377\4\5\7\377\202\0\0\0\377\4XXX\377\375\375\375" \
+  "\377\377\377\377\377\376\376\376\377\243\377\377\377\377\2\263\263\263" \
+  "\377\15\15\15\377\202\0\0\0\377\2\40'\77\377AO\200\377\202BP\200\377" \
+  "\1\40'>\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\6\10\10\10\377" \
+  "\0\0\0\377\1\2\3\377\77M~\377,;q\377\27(c\377\202\31*e\377\1\24!P\377" \
+  "\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377" \
+  "\2/;b\377<K}\377\202;J|\377\1:I{\377\204;J|\377\1/;c\377\202\0\0\0\377" \
+  "\3;;;\377\374\374\374\377\376\376\376\377\222\377\377\377\377\4\7\7\7" \
+  "\377\0\0\0\377\1\1\2\377,7a\377\2048Fz\377\2""7Fy\3776Fx\377\2027Fy\377" \
+  "\1/<i\377\202\0\0\0\377\2%%%\377\371\371\371\377\223\377\377\377\377" \
+  "\4\22\22\22\377\0\0\0\377\0\0\1\377\23\40N\377\205\31*e\377\4*:q\377" \
+  "3Bw\3772Av\377*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377" \
+  "\377\377\377\4SSS\377\0\0\0\377\0\0\1\377\15\26""7\377\222\31*e\377\10" \
+  "\30)d\377\27&Z\377\7\12\24\377\0\0\0\377\14\14\14\377\276\276\276\377" \
+  "\377\377\377\377\376\376\376\377\224\377\377\377\377\1ddd\377\202\0\0" \
+  "\0\377\1\22\36I\377\214\31*e\377\4\30)d\377\31)d\377&6m\377'8o\377\202" \
+  "(8o\377\206'7o\377\3$4m\377\32+e\377\30)d\377\235\31*e\377\202\30)d\377" \
+  "\1""8Gz\377\202IV\205\377\202HU\204\377\1IV\205\377\205JW\206\377\202" \
+  "IV\206\377\1JW\206\377\206KX\206\377\1JW\205\377\202KX\206\377\205LY" \
+  "\207\377\2LX\207\377LY\207\377\207LZ\207\377\2KZ\206\377LZ\207\377\207" \
+  "MZ\210\377\202LY\207\377\1MZ\210\377\207N[\211\377\1\35\"3\377\203\0" \
+  "\0\0\377\3~~~\377\366\366\366\377\377\377\377\377\202\376\376\376\377" \
+  "\240\377\377\377\377\202\376\376\376\377\3\377\377\377\377\366\366\366" \
+  "\377\203\203\203\377\203\0\0\0\377\1\32\36.\377\203N[\211\377\202MZ\210" \
+  "\377\1LY\207\377\202MZ\210\377\5KW\204\377\30\34+\377\0\0\0\377\4\4\4" \
+  "\377\235\235\235\377\245\377\377\377\377\4\376\376\376\377\377\377\377" \
+  "\377\341\341\341\377---\377\202\0\0\0\377\1\11\17%\377\202\31*e\377\5" \
+  "\30)d\377!1j\377IV\205\377HU\204\3773<^\377\203\0\0\0\377\1~~~\377\202" \
+  "\377\377\377\377\1\376\376\376\377\237\377\377\377\377\4\376\376\376" \
+  "\377\377\377\377\377\316\316\316\377###\377\202\0\0\0\377\3\17\22\35" \
+  "\377=Jw\377BP\201\377\202BP\200\377\1\40'>\377\202\0\0\0\377\1ppp\377" \
+  "\217\377\377\377\377\6\10\10\10\377\0\0\0\377\1\2\3\377\77M~\377&6n\377" \
+  "\27(d\377\202\31*e\377\1\24!P\377\202\0\0\0\377\1DDD\377\217\377\377" \
+  "\377\377\1""555\377\202\0\0\0\377\4/;b\377<K}\377;J|\377:I{\377\206;" \
+  "J|\377\202\0\0\0\377\2\3\3\3\377\370\370\370\377\222\377\377\377\377" \
+  "\5\272\272\272\377\3\3\3\377\0\0\0\377\12\15\27\3771>l\377\2038Fz\377" \
+  "\3""7Fy\3778Fz\3776Fx\377\2037Fy\377\1\5\7\14\377\202\0\0\0\377\1\341" \
+  "\341\341\377\222\377\377\377\377\5\335\335\335\377\6\6\6\377\0\0\0\377" \
+  "\3\6\17\377\25#V\377\205\31*e\377\4,<r\3773Bw\3772Av\377*7e\377\202\0" \
+  "\0\0\377\2EEE\377\370\370\370\377\216\377\377\377\377\4SSS\377\0\0\0" \
+  "\377\0\0\1\377\15\26""7\377\222\31*e\377\6\30)d\377\35-g\377\15\21\"" \
+  "\377\0\0\0\377\2\2\2\377{{{\377\226\377\377\377\377\1\204\204\204\377" \
+  "\202\0\0\0\377\1\17\31=\377\214\31*e\377\3\30)d\377\31*e\377&6n\377\203" \
+  "(8o\377\206'7o\377\3$4m\377\32+e\377\30)d\377\236\31*e\377\6\27(d\377" \
+  ",;q\377GT\204\377HU\204\377IV\205\377HU\204\377\202IV\205\377\205JW\206" \
+  "\377\2IV\206\377JW\206\377\207KX\206\377\1JW\205\377\207LY\207\377\2" \
+  "LX\207\377LY\207\377\210LZ\207\377\202MZ\210\377\1LZ\207\377\205MZ\210" \
+  "\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377\205N[\211\377\2LY\206" \
+  "\377\36$6\377\203\0\0\0\377\2SSS\377\342\342\342\377\244\377\377\377" \
+  "\377\2\342\342\342\377VVV\377\203\0\0\0\377\7\34!2\377KX\204\377N[\211" \
+  "\377MZ\210\377N[\211\377MZ\210\377LY\207\377\203MZ\210\377\5KW\204\377" \
+  "\30\34+\377\0\0\0\377\4\4\4\377\235\235\235\377\220\377\377\377\377\202" \
+  "\376\376\376\377\222\377\377\377\377\4\376\376\376\377\377\377\377\377" \
+  "\376\376\376\377NNN\377\202\0\0\0\377\2\1\3\7\377\26&[\377\202\31*e\377" \
+  "\6\30)d\377.=s\377JV\205\377HT\203\377FU\204\377#*A\377\203\0\0\0\377" \
+  "\1\177\177\177\377\237\377\377\377\377\202\376\376\376\377\3\377\377" \
+  "\377\377\317\317\317\377&&&\377\202\0\0\0\377\7\5\6\12\3777Cl\377BP\201" \
+  "\377BP\200\377BP\177\377BP\200\377\40'>\377\202\0\0\0\377\1ppp\377\217" \
+  "\377\377\377\377\6\10\10\10\377\0\0\0\377\1\2\3\377\77M~\377\40""0i\377" \
+  "\30)d\377\202\31*e\377\1\24!P\377\202\0\0\0\377\1DDD\377\217\377\377" \
+  "\377\377\1""555\377\202\0\0\0\377\4/;b\377<K}\377;J|\377:I{\377\206;" \
+  "J|\377\1\15\21\34\377\202\0\0\0\377\1\314\314\314\377\220\377\377\377" \
+  "\377\7\376\376\376\377\377\377\377\377ppp\377\1\1\1\377\0\0\0\377\24" \
+  "\31,\3777Ey\377\2048Fz\377\1""6Fx\377\2047Fy\377\1\27\35""3\377\202\0" \
+  "\0\0\377\1\215\215\215\377\222\377\377\377\377\5\245\245\245\377\4\4" \
+  "\4\377\0\0\0\377\6\13\33\377\27'_\377\205\31*e\377\4/>t\3773Bw\3772A" \
+  "v\377*7e\377\202\0\0\0\377\2EEE\377\370\370\370\377\216\377\377\377\377" \
+  "\4SSS\377\0\0\0\377\0\0\1\377\15\26""7\377\222\31*e\377\7\30)d\377\36" \
+  ".h\377\30\40\77\377\0\1\2\377\0\0\0\377666\377\352\352\352\377\225\377" \
+  "\377\377\377\1\244\244\244\377\202\0\0\0\377\1\14\24""0\377\214\31*e" \
+  "\377\3\30)d\377\32+f\377&6n\377\203(8o\377\206'7o\377\3#4l\377\31*e\377" \
+  "\30)d\377\236\31*e\377\7\30)d\377\34-g\377ES\202\377HV\205\377IV\205" \
+  "\377HU\204\377IV\205\377\207JW\206\377\1IV\206\377\207KX\206\377\3JW" \
+  "\205\377LY\207\377KX\206\377\207LY\207\377\2LZ\207\377LY\207\377\205" \
+  "LZ\207\377\1KZ\206\377\202LZ\207\377\207MZ\210\377\4LY\207\377MZ\210" \
+  "\377N[\211\377MZ\210\377\205N[\211\377\2JW\203\377\40%8\377\203\0\0\0" \
+  "\377\2$$$\377\275\275\275\377\202\377\377\377\377\1\376\376\376\377\234" \
+  "\377\377\377\377\1\376\376\376\377\202\377\377\377\377\2\275\275\275" \
+  "\377$$$\377\203\0\0\0\377\7\36#5\377JV\202\377N[\211\377MZ\210\377N[" \
+  "\211\377MZ\210\377LY\207\377\204MZ\210\377\5KW\204\377\30\34+\377\0\0" \
+  "\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\2\372\372\372\377" \
+  "\260\260\260\377\223\377\377\377\377\1\376\376\376\377\202\377\377\377" \
+  "\377\1JJJ\377\203\0\0\0\377\1\22\37K\377\203\31*e\377\2\30)d\377\77M" \
+  "~\377\202HU\204\377\3GU\204\377CQ~\377\27\34+\377\202\0\0\0\377\5\3\3" \
+  "\3\377ttt\377\376\376\376\377\377\377\377\377\376\376\376\377\232\377" \
+  "\377\377\377\1\376\376\376\377\202\377\377\377\377\2\261\261\261\377" \
+  "\22\22\22\377\203\0\0\0\377\1""6Ai\377\202BP\201\377\4BP\200\377BP\177" \
+  "\377BP\200\377\40'>\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\6" \
+  "\10\10\10\377\0\0\0\377\1\2\3\377\77M}\377\30*e\377\30)d\377\202\31*" \
+  "e\377\1\24!P\377\202\0\0\0\377\1DDD\377\217\377\377\377\377\1""555\377" \
+  "\202\0\0\0\377\4/;b\377<K}\377;J|\377:I{\377\206;J|\377\1\33#;\377\202" \
+  "\0\0\0\377\1\205\205\205\377\221\377\377\377\377\5\376\376\376\377::" \
+  ":\377\0\0\0\377\1\1\2\377\37'D\377\2058Fz\377\1""6Fx\377\2047Fy\377\1" \
+  ")4Z\377\202\0\0\0\377\3""444\377\377\377\377\377\376\376\376\377\216" \
+  "\377\377\377\377\6\376\376\376\377\377\377\377\377mmm\377\1\1\1\377\0" \
+  "\0\0\377\12\20(\377\206\31*e\377\4""1Av\3772Av\3771@u\377*7e\377\202" \
+  "\0\0\0\377\2EEE\377\370\370\370\377\216\377\377\377\377\4SSS\377\0\0" \
+  "\0\377\0\0\1\377\15\26""7\377\222\31*e\377\4\30)d\377\37""0i\377*8j\377" \
+  "\2\2\5\377\202\0\0\0\377\1\232\232\232\377\202\376\376\376\377\223\377" \
+  "\377\377\377\1\304\304\304\377\202\0\0\0\377\1\11\17$\377\214\31*e\377" \
+  "\6\30)d\377\33+f\377&6n\377(8o\377'7o\377(8o\377\206'7o\377\3#3l\377" \
+  "\31*d\377\30)d\377\236\31*e\377\3\30)e\377\26'c\377:Hz\377\203IV\205" \
+  "\377\1HU\204\377\207JW\206\377\3IV\206\377KX\206\377JW\206\377\205KX" \
+  "\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377\207LY\207\377\2LZ" \
+  "\207\377LY\207\377\205LZ\207\377\1KZ\206\377\202LZ\207\377\207MZ\210" \
+  "\377\4LY\207\377MZ\210\377N[\211\377MZ\210\377\205N[\211\377\3MY\207" \
+  "\377\40%8\377\1\1\2\377\203\0\0\0\377\3iii\377\361\361\361\377\375\375" \
+  "\375\377\202\377\377\377\377\202\376\376\376\377\225\377\377\377\377" \
+  "\1\376\376\376\377\202\377\377\377\377\3\375\375\375\377\362\362\362" \
+  "\377iii\377\203\0\0\0\377\3\1\1\2\377\37$6\377MZ\207\377\203N[\211\377" \
+  "\202MZ\210\377\1LY\207\377\204MZ\210\377\5KW\204\377\30\34+\377\0\0\0" \
+  "\377\4\4\4\377\235\235\235\377\216\377\377\377\377\4\365\365\365\377" \
+  "\26\26\26\377\244\244\244\377\374\374\374\377\202\377\377\377\377\1\376" \
+  "\376\376\377\214\377\377\377\377\1\376\376\376\377\202\377\377\377\377" \
+  "\2\360\360\360\377>>>\377\203\0\0\0\377\1\16\27""8\377\203\31*e\377\4" \
+  "\30)d\377\37/h\377IV\205\377HU\204\377\203GU\204\377\2CP}\377\16\21\33" \
+  "\377\203\0\0\0\377\3JJJ\377\357\357\357\377\376\376\376\377\202\377\377" \
+  "\377\377\1\376\376\376\377\224\377\377\377\377\1\376\376\376\377\203" \
+  "\377\377\377\377\3\366\366\366\377\206\206\206\377\4\4\4\377\202\0\0" \
+  "\0\377\2\1\1\3\377-8^\377\203BP\201\377\4BP\200\377BP\177\377BP\200\377" \
+  "\40'>\377\202\0\0\0\377\1ppp\377\217\377\377\377\377\5\10\10\10\377\0" \
+  "\0\0\377\1\2\3\377:Hz\377\26'c\377\203\31*e\377\1\24!P\377\202\0\0\0" \
+  "\377\1DDD\377\217\377\377\377\377\1""555\377\202\0\0\0\377\4/;b\377<" \
+  "K}\377;J|\377:I{\377\205;J|\377\2:I{\377*5Y\377\202\0\0\0\377\3\77\77" \
+  "\77\377\377\377\377\377\376\376\376\377\217\377\377\377\377\5\323\323" \
+  "\323\377\37\37\37\377\0\0\0\377\4\5\11\377+6_\377\2058Fz\377\1""6Fx\377" \
+  "\2047Fy\377\2""0>k\377\4\5\11\377\202\0\0\0\377\1\365\365\365\377\221" \
+  "\377\377\377\377\4@@@\377\0\0\0\377\0\0\2\377\16\30:\377\204\31*e\377" \
+  "\6\30)d\377\32*e\3774Cx\3772Av\3771@u\377*7e\377\202\0\0\0\377\2EEE\377" \
+  "\370\370\370\377\216\377\377\377\377\4SSS\377\0\0\0\377\0\0\1\377\15" \
+  "\26""7\377\222\31*e\377\4\30)d\377!1j\377-<r\377\26\35""7\377\202\0\0" \
+  "\0\377\2\7\7\7\377\330\330\330\377\202\377\377\377\377\1\376\376\376" \
+  "\377\221\377\377\377\377\1\344\344\344\377\202\0\0\0\377\1\5\12\30\377" \
+  "\214\31*e\377\3\30)d\377\34-g\377'7n\377\202(8o\377\207'7o\377\1#3l\377" \
+  "\202\30)d\377\237\31*e\377\10\27)d\377$4l\377JW\206\377HU\204\377IV\205" \
+  "\377HU\204\377JW\206\377IV\205\377\205JW\206\377\2IV\206\377JW\206\377" \
+  "\207KX\206\377\2JW\205\377KX\206\377\206LY\207\377\202LX\207\377\1LY" \
+  "\207\377\207LZ\207\377\1KZ\206\377\202LZ\207\377\207MZ\210\377\4LY\207" \
+  "\377MZ\210\377N[\211\377MZ\210\377\206N[\211\377\2+2L\377\10\11\17\377" \
+  "\203\0\0\0\377\4\10\10\10\377~~~\377\314\314\314\377\361\361\361\377" \
+  "\230\377\377\377\377\4\366\366\366\377\320\320\320\377\205\205\205\377" \
+  "\13\13\13\377\203\0\0\0\377\2\10\12\17\377,3M\377\203N[\211\377\202M" \
+  "Z\210\377\202LY\207\377\205MZ\210\377\5KW\204\377\30\34*\377\0\0\0\377" \
+  "\4\4\4\377\235\235\235\377\216\377\377\377\377\5\366\366\366\377\11\11" \
+  "\11\377\0\0\0\377{{{\377\337\337\337\377\213\377\377\377\377\202\376" \
+  "\376\376\377\202\377\377\377\377\3\371\371\371\377\271\271\271\377**" \
+  "*\377\203\0\0\0\377\2\13\23.\377\30)d\377\203\31*e\377\6\27(c\3770@t" \
+  "\377IV\204\377HT\203\377GU\204\377FU\204\377\202GU\204\377\2DQ~\377\23" \
+  "\27$\377\203\0\0\0\377\3\16\16\16\377\231\231\231\377\342\342\342\377" \
+  "\204\377\377\377\377\1\376\376\376\377\216\377\377\377\377\202\376\376" \
+  "\376\377\203\377\377\377\377\3\352\352\352\377\271\271\271\377>>>\377" \
+  "\203\0\0\0\377\12\2\4\13\377\32%L\377\77M\177\377BP\201\377BP\200\377" \
+  "BP\201\377BP\200\377BP\177\377BP\200\377\40'>\377\202\0\0\0\377\1ppp" \
+  "\377\217\377\377\377\377\5\10\10\10\377\0\0\0\377\1\2\3\3772@u\377\27" \
+  "(c\377\203\31*e\377\1\24!P\377\202\0\0\0\377\1EEE\377\217\377\377\377" \
+  "\377\1""555\377\202\0\0\0\377\4/;b\377<K}\377;J|\377:I{\377\205;J|\377" \
+  "\5:I{\3771>i\377\1\2\3\377\0\0\0\377\4\4\4\377\221\377\377\377\377\5" \
+  "\247\247\247\377\6\6\6\377\0\0\0\377\10\12\22\3777Ex\377\2058Fz\377\1" \
+  "6Fx\377\2047Fy\377\2""4Br\377\20\24#\377\202\0\0\0\377\1\244\244\244" \
+  "\377\220\377\377\377\377\5\342\342\342\377***\377\0\0\0\377\1\2\6\377" \
+  "\22\37L\377\204\31*e\377\6\30)d\377\34-g\3774Cx\3772Av\3771@u\377*7e" \
+  "\377\202\0\0\0\377\2EEE\377\371\371\371\377\216\377\377\377\377\4SSS" \
+  "\377\0\0\0\377\0\0\1\377\15\26""7\377\222\31*e\377\2\30)d\377\"2k\377" \
+  "\202-<r\377\1\10\13\25\377\202\0\0\0\377\2\22\22\22\377\304\304\304\377" \
+  "\220\377\377\377\377\202\376\376\376\377\5\377\377\377\377\357\357\357" \
+  "\377\3\3\3\377\0\0\0\377\2\4\13\377\214\31*e\377\3\30)d\377\35.h\377" \
+  "'7n\377\202(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377\"2k\377\30)d\377" \
+  "\232\31*e\377\1\30)e\377\206\31*e\377\4\26'c\377CP\201\377IV\205\377" \
+  "HU\204\377\202IV\205\377\2JW\206\377IV\205\377\206JW\206\377\207KX\206" \
+  "\377\2JW\205\377KX\206\377\207LY\207\377\4LX\207\377LY\207\377LZ\207" \
+  "\377LY\207\377\206LZ\207\377\4KZ\206\377LZ\207\377MZ\210\377LZ\207\377" \
+  "\206MZ\210\377\2LY\207\377MZ\210\377\202N[\211\377\1MZ\210\377\205N[" \
+  "\211\377\2\77In\377\33\40""0\377\204\0\0\0\377\5\20\20\20\377JJJ\377" \
+  "\202\202\202\377\273\273\273\377\360\360\360\377\207\377\377\377\377" \
+  "\1\376\376\376\377\203\377\377\377\377\1\376\376\376\377\207\377\377" \
+  "\377\377\4\313\313\313\377\216\216\216\377RRR\377\26\26\26\377\204\0" \
+  "\0\0\377\4\34\40""1\377\77Jp\377N[\211\377MZ\210\377\202N[\211\377\2" \
+  "MZ\210\377LY\207\377\207MZ\210\377\5KW\204\377\30\34+\377\0\0\0\377\4" \
+  "\4\4\377\235\235\235\377\216\377\377\377\377\2\366\366\366\377\13\13" \
+  "\13\377\202\0\0\0\377\3,,,\377\204\204\204\377\334\334\334\377\205\377" \
+  "\377\377\377\202\376\376\376\377\204\377\377\377\377\4\374\374\374\377" \
+  "\262\262\262\377YYY\377\10\10\10\377\203\0\0\0\377\2\15\25""4\377\30" \
+  ")c\377\203\31*e\377\3\30)d\377\27(d\377CP\200\377\202HU\204\377\2GU\204" \
+  "\377FU\204\377\203GU\204\377\3ER\200\377!(\77\377\1\2\3\377\203\0\0\0" \
+  "\377\4---\377rrr\377\266\266\266\377\357\357\357\377\207\377\377\377" \
+  "\377\1\376\376\376\377\212\377\377\377\377\4\361\361\361\377\274\274" \
+  "\274\377}}}\377>>>\377\204\0\0\0\377\3\6\13\33\377\23\40P\377+;q\377" \
+  "\203BP\201\377\2BP\200\377BP\177\377\202BP\200\377\1\40'>\377\202\0\0" \
+  "\0\377\1rrr\377\217\377\377\377\377\5\10\10\10\377\0\0\0\377\2\2\3\377" \
+  "(8o\377\27)d\377\203\31*e\377\1\24!P\377\202\0\0\0\377\1EEE\377\217\377" \
+  "\377\377\377\1""666\377\202\0\0\0\377\3/;b\377;J|\377:I{\377\206;J|\377" \
+  "\3:I{\3774Ao\377\13\16\30\377\202\0\0\0\377\1\317\317\317\377\220\377" \
+  "\377\377\377\1vvv\377\202\0\0\0\377\1\24\31,\377\2068Fz\377\1""6Fx\377" \
+  "\2057Fy\377\1\34#>\377\202\0\0\0\377\1RRR\377\220\377\377\377\377\5\303" \
+  "\303\303\377\24\24\24\377\0\0\0\377\2\4\11\377\27'_\377\204\31*e\377" \
+  "\6\30)d\377\37""0i\3774Cx\3772Av\3771@u\377*7e\377\202\0\0\0\377\2FF" \
+  "F\377\374\374\374\377\216\377\377\377\377\4TTT\377\0\0\0\377\0\0\1\377" \
+  "\15\26""7\377\221\31*e\377\7\30)e\377\30)d\377$4l\377.=s\377-<r\377%" \
+  "2`\377\6\10\17\377\202\0\0\0\377\3\13\13\13\377ttt\377\326\326\326\377" \
+  "\206\377\377\377\377\3\376\376\376\377\377\377\377\377\376\376\376\377" \
+  "\207\377\377\377\377\5\374\374\374\377\310\310\310\377\21\21\21\377\0" \
+  "\0\0\377\0\0\1\377\214\31*e\377\3\30)d\377\36/h\377'7n\377\202(8o\377" \
+  "\2'7o\377&6o\377\204'7o\377\3&6n\377!1j\377\30)d\377\232\31*e\377\1\30" \
+  ")d\377\206\31*e\377\4\30)d\377+;q\377KX\206\377HU\204\377\203IV\205\377" \
+  "\206JW\206\377\4IV\206\377JW\206\377KX\206\377JW\206\377\205KX\206\377" \
+  "\2JW\205\377KX\206\377\207LY\207\377\2LX\207\377LY\207\377\210LZ\207" \
+  "\377\4KZ\206\377LZ\207\377MZ\210\377LZ\207\377\206MZ\210\377\1LY\207" \
+  "\377\202MZ\210\377\2N[\211\377MZ\210\377\205N[\211\377\3KX\205\377:C" \
+  "f\377\20\22\34\377\205\0\0\0\377\10\21\21\21\377\36\36\36\377:::\377" \
+  "ooo\377\235\235\235\377\304\304\304\377\343\343\343\377\374\374\374\377" \
+  "\207\377\377\377\377\10\366\366\366\377\331\331\331\377\263\263\263\377" \
+  "\205\205\205\377PPP\377$$$\377\25\25\25\377\4\4\4\377\204\0\0\0\377\3" \
+  "\17\21\32\3779Ce\377KX\205\377\203N[\211\377\202MZ\210\377\1LY\207\377" \
+  "\207MZ\210\377\6LZ\207\377KW\204\377\30\34*\377\0\0\0\377\4\4\4\377\235" \
+  "\235\235\377\216\377\377\377\377\2\366\366\366\377\13\13\13\377\203\0" \
+  "\0\0\377\6\2\2\2\377\27\27\27\377DDD\377\220\220\220\377\314\314\314" \
+  "\377\367\367\367\377\204\377\377\377\377\5\344\344\344\377\261\261\261" \
+  "\377jjj\377)))\377\15\15\15\377\203\0\0\0\377\3\2\3\7\377\21\36J\377" \
+  "\30)d\377\204\31*e\377\2\27(d\377%5m\377\202GT\203\377\2GU\204\377FU" \
+  "\204\377\205GU\204\377\3FT\202\3774>b\377\11\13\21\377\204\0\0\0\377" \
+  "\7\17\17\17\377\37\37\37\377@@@\377www\377\246\246\246\377\314\314\314" \
+  "\377\352\352\352\377\207\377\377\377\377\10\372\372\372\377\343\343\343" \
+  "\377\305\305\305\377\241\241\241\377ttt\377===\377\40\40\40\377\21\21" \
+  "\21\377\204\0\0\0\377\12\0\0\2\377\16\30:\377\27'^\377\32+e\3772Av\377" \
+  "BP\201\377AO\200\377BP\201\377BP\200\377BP\177\377\202BP\200\377\1\40" \
+  "'>\377\202\0\0\0\377\2\20\20\20\377&&&\377\216%%%\377\5\1\1\1\377\0\0" \
+  "\0\377\2\2\3\377\37""0i\377\30)d\377\203\31*e\377\1\24!P\377\202\0\0" \
+  "\0\377\2\12\12\12\377'''\377\215%%%\377\2'''\377\7\7\7\377\202\0\0\0" \
+  "\377\3/;b\377;J|\377:I{\377\206;J|\377\3:I{\3777Ev\377\25\32-\377\202" \
+  "\0\0\0\377\2\32\32\32\377&&&\377\216%%%\377\2$$$\377\16\16\16\377\202" \
+  "\0\0\0\377\1&/S\377\2048Fz\377\3""7Fy\3778Fz\3776Fx\377\2057Fy\377\5" \
+  "&0T\377\2\3\5\377\0\0\0\377\7\7\7\377'''\377\217%%%\377\4\32\32\32\377" \
+  "\1\1\1\377\0\0\0\377\5\10\24\377\205\31*e\377\6\30)d\377#3l\3774Cw\377" \
+  "2Av\3771@u\377*7e\377\202\0\0\0\377\2\12\12\12\377$$$\377\215%%%\377" \
+  "\5'''\377\14\14\14\377\0\0\0\377\0\0\1\377\15\26""7\377\221\31*e\377" \
+  "\202\30)d\377\6%5m\377.=s\377-<r\377,;q\377#/Y\377\4\6\14\377\202\0\0" \
+  "\0\377\6\1\1\1\377\26\26\26\377>>>\377\206\206\206\377\274\274\274\377" \
+  "\343\343\343\377\206\377\377\377\377\11\371\371\371\377\340\340\340\377" \
+  "\301\301\301\377\234\234\234\377rrr\377AAA\377$$$\377\27\27\27\377\2" \
+  "\2\2\377\202\0\0\0\377\214\31*e\377\3\30)d\377\37/i\377'7n\377\202(8" \
+  "o\377\2'7o\377&6o\377\204'7o\377\3&6n\377\37""0i\377\30)d\377\232\31" \
+  "*e\377\2\37""0i\377\30)d\377\205\31*e\377\3\30)d\377\34-g\377ER\202\377" \
+  "\202IV\205\377\4HU\204\377IV\205\377JW\206\377IV\205\377\204JW\206\377" \
+  "\1IV\206\377\202JW\206\377\206KX\206\377\1JW\205\377\202KX\206\377\207" \
+  "LY\207\377\3LX\207\377LZ\207\377LY\207\377\206LZ\207\377\1KZ\206\377" \
+  "\202LZ\207\377\210MZ\210\377\202LY\207\377\3MZ\210\377N[\211\377MZ\210" \
+  "\377\207N[\211\377\4;Eh\377\22\26!\377\0\1\1\377\0\0\1\377\212\0\0\0" \
+  "\377\5\13\13\13\377\24\24\24\377\27\27\27\377\23\23\23\377\11\11\11\377" \
+  "\211\0\0\0\377\202\0\0\1\377\2\17\22\33\3778Bc\377\204N[\211\377\203" \
+  "MZ\210\377\202LY\207\377\206MZ\210\377\7LZ\207\377MZ\210\377JW\203\377" \
+  "\27\34*\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\2" \
+  "\366\366\366\377\13\13\13\377\202\0\0\0\377\1\0\0\1\377\207\0\0\0\377" \
+  "\2\11\11\11\377\5\5\5\377\207\0\0\0\377\4\1\1\2\377\22\27*\377\27'_\377" \
+  "\30)d\377\204\31*e\377\7\30)d\377\27(c\3777Fx\377GT\203\377HU\204\377" \
+  "GU\204\377FU\204\377\206GU\204\377\4FT\203\377ES\202\377&.H\377\4\5\10" \
+  "\377\213\0\0\0\377\4\6\6\6\377\13\13\13\377\11\11\11\377\3\3\3\377\213" \
+  "\0\0\0\377\3\0\0\1\377\11\17%\377\26&[\377\202\31*e\377\2\34-g\377:H" \
+  "{\377\203BP\201\377\2BP\200\377BP\177\377\202BP\200\377\1\40'>\377\224" \
+  "\0\0\0\377\3\1\2\3\377\31*e\377\30)d\377\203\31*e\377\1\24!P\377\225" \
+  "\0\0\0\377\3/;b\377;J|\377:I{\377\206;J|\377\3:I{\3779Hz\377\36&A\377" \
+  "\226\0\0\0\377\1""7Ex\377\2058Fz\377\2""7Fy\3776Fx\377\2057Fy\377\2/" \
+  "<h\377\10\12\21\377\225\0\0\0\377\1\13\23.\377\205\31*e\377\6\30)d\377" \
+  "'7o\3773Bw\3772Av\3771@u\377*7e\377\224\0\0\0\377\2\0\0\1\377\15\26""7" \
+  "\377\221\31*e\377\5\30)d\377\31*e\377'6n\377.=s\377,;q\377\202-<r\377" \
+  "\2(5e\377\10\12\24\377\211\0\0\0\377\3\7\7\7\377\12\12\12\377\4\4\4\377" \
+  "\214\0\0\0\377\214\31*e\377\3\30)d\377\40""1j\377'7n\377\202(8o\377\2" \
+  "'7o\377&6o\377\204'7o\377\3&6n\377\36/i\377\30)d\377\232\31*e\377\2""3" \
+  "Bv\377\26'c\377\207\31*e\377\2""2Av\377JW\206\377\203HU\204\377\1IV\205" \
+  "\377\206JW\206\377\2IV\206\377JW\206\377\207KX\206\377\1JW\205\377\202" \
+  "KX\206\377\206LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\206" \
+  "LZ\207\377\202KZ\206\377\202LZ\207\377\207MZ\210\377\202LY\207\377\3" \
+  "MZ\210\377N[\211\377MZ\210\377\210N[\211\377\5CNv\377(.F\377\22\25\40" \
+  "\377\12\14\22\377\5\6\11\377\222\0\0\0\377\5\3\3\5\377\10\12\17\377\17" \
+  "\21\32\377\"(=\377\77Jo\377\204N[\211\377\1MZ\210\377\202N[\211\377\2" \
+  "MZ\210\377LY\207\377\207MZ\210\377\10LZ\207\377MZ\210\377LZ\207\377I" \
+  "W\202\377\30\34*\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377" \
+  "\377\377\7\366\366\366\377\13\13\13\377\0\0\0\377\4\5\7\377*2L\377\14" \
+  "\16\25\377\4\5\10\377\213\0\0\0\377\7\1\2\3\377\11\12\20\377\26\32(\377" \
+  "5@f\377%5m\377\30)d\377\31*d\377\204\31*e\377\5\30)d\377\37/h\377AN\177" \
+  "\377HU\204\377GU\204\377\202FU\204\377\206GU\204\377\10FT\203\377ES\202" \
+  "\377FT\203\377ES\201\377+3P\377\22\26#\377\11\13\21\377\4\4\7\377\222" \
+  "\0\0\0\377\5\1\2\5\377\3\5\14\377\5\11\27\377\15\25""4\377\26&\\\377" \
+  "\204\31*e\377\2\37/i\377AO\200\377\202BP\201\377\1BP\200\377\202BP\177" \
+  "\377\202BP\200\377\3\")B\377\2\3\5\377\4\5\10\377\210\4\4\10\377\2\4" \
+  "\4\7\377\3\4\7\377\206\4\4\7\377\3\3\4\7\377\3\4\6\377\5\6\13\377\205" \
+  "\31*e\377\2\24\"Q\377\0\0\0\377\207\1\2\6\377\1\2\3\6\377\213\3\4\7\377" \
+  "\4\1\2\3\3770<d\377;J|\377:I{\377\205;J|\377\7:I{\377;J|\3779Hz\377(" \
+  "2U\377\5\7\14\377\3\4\7\377\2\3\7\377\221\1\2\6\377\2\1\1\4\377\20\24" \
+  "\"\377\2068Fz\377\2107Fy\377\1\20\24#\377\206\3\4\7\377\216\1\2\6\377" \
+  "\2\1\1\4\377\22\36I\377\205\31*e\377\3\27(d\377+;r\3773Bw\377\2021@u" \
+  "\377\2+8f\377\0\1\2\377\214\3\4\7\377\1\2\3\7\377\206\1\2\6\377\2\1\3" \
+  "\7\377\16\30""9\377\221\31*e\377\5\30)d\377\32+e\377(8o\377.=s\377,;" \
+  "q\377\204-<r\377\3\31\"A\377\10\13\25\377\3\4\7\377\220\0\0\0\377\5\1" \
+  "\1\4\377\2\4\12\377\4\7\21\377\7\14\34\377\14\25""4\377\214\31*e\377" \
+  "\2\30)d\377!2j\377\203(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377\35" \
+  "-h\377\30)d\377\232\31*e\377\3DQ\201\377\31*e\377\30)d\377\205\31*e\377" \
+  "\3\30)d\377$4l\377FS\202\377\202IV\205\377\1HU\204\377\202IV\205\377" \
+  "\206JW\206\377\1IV\206\377\202JW\206\377\206KX\206\377\2JW\205\377KX" \
+  "\206\377\207LY\207\377\2LX\207\377LY\207\377\211LZ\207\377\4KZ\206\377" \
+  "LZ\207\377MZ\210\377LZ\207\377\207MZ\210\377\202LY\207\377\202MZ\210" \
+  "\377\2N[\211\377MZ\210\377\210N[\211\377\26COw\3777@a\377,4N\377#)>\377" \
+  "\32\37/\377\23\27\"\377\16\20\30\377\11\13\20\377\5\6\12\377\3\3\5\377" \
+  "\2\2\3\377\1\1\2\377\2\2\3\377\3\4\6\377\6\7\13\377\12\14\22\377\20\22" \
+  "\34\377\26\32(\377\36$6\377(/G\3773;Z\377\77Jp\377\205N[\211\377\1MZ" \
+  "\210\377\202N[\211\377\2MZ\210\377LY\207\377\212MZ\210\377\7LZ\207\377" \
+  "KZ\206\377JW\203\377\30\34*\377\0\0\0\377\4\4\4\377\235\235\235\377\216" \
+  "\377\377\377\377\30\366\366\366\377\13\13\13\377\0\0\0\377\3\4\6\377" \
+  "KX\206\377GT\200\3774=_\377&-D\377\31\35.\377\20\23\35\377\11\12\20\377" \
+  "\5\6\11\377\3\4\6\377\4\4\7\377\6\10\14\377\14\16\26\377\25\30&\377\37" \
+  "%9\377-5R\377<Ho\377IV\205\377>L}\377\27(c\377\30)d\377\205\31*e\377" \
+  "\6\30)d\377*:p\377GT\203\377HU\204\377GU\204\377FU\204\377\205GU\204" \
+  "\377\202FT\203\377\1ES\202\377\205FT\203\377\26<Ir\37709[\377%-G\377" \
+  "\35#7\377\25\32)\377\17\22\35\377\13\15\25\377\7\11\16\377\5\6\11\377" \
+  "\3\4\6\377\2\3\5\377\3\3\6\377\4\5\10\377\5\7\13\377\10\11\17\377\13" \
+  "\16\26\377\20\23\37\377\15\22$\377\11\21*\377\15\26""7\377\21\34D\377" \
+  "\25#U\377\206\31*e\377\7\30)d\377&7n\377DR\202\377AO\200\377BP\201\377" \
+  "BP\200\377BP\177\377\203BP\200\377\2""8Dl\377.8Y\377\202.8Z\377\1-7Z" \
+  "\377\205.8Z\377\202-7Z\377\1,6Y\377\206-7Z\377\3,6Y\377-7X\377!,R\377" \
+  "\205\31*e\377\2\27'_\377\21\34E\377\206\21\35G\377\2\21\35F\377\35(N" \
+  "\377\206+5X\377\1)5X\377\203*5X\377\5*4X\377)4W\3778Fu\377;J|\377:I{" \
+  "\377\206;J|\377\7""9Hz\377:I{\3776Dr\377*5Z\377(3V\377\35(N\377\20\34" \
+  "F\377\217\21\35G\377\3\21\35F\377\24\40H\377/;f\377\2068Fz\377\2067F" \
+  "y\377\3""6Ex\3777Fy\377+8a\377\205&0U\377\3\",R\377\21\35G\377\21\35" \
+  "F\377\214\21\35G\377\2\21\35F\377\30(a\377\205\31*e\377\7\27(c\377/>" \
+  "t\3773Bv\3771@u\3772Av\3770>q\377\"-Q\377\203#.S\377\2\".S\377\".R\377" \
+  "\206\".S\377\3\"-S\377\37*P\377\23\37H\377\205\21\35G\377\2\21\35H\377" \
+  "\25$W\377\221\31*e\377\5\30)d\377\33,f\377)9p\377.=s\377,;q\377\205-" \
+  "<r\377\25+:n\377\40+R\377\26\37<\377\20\26*\377\13\17\34\377\7\11\22" \
+  "\377\4\5\13\377\1\2\7\377\1\2\5\377\1\1\4\377\1\2\5\377\2\3\10\377\3" \
+  "\5\14\377\4\7\22\377\6\12\31\377\10\16\"\377\13\22,\377\15\27""7\377" \
+  "\20\34C\377\24!P\377\27'_\377\215\31*e\377\3\30)d\377\30)e\377\"2k\377" \
+  "\203(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377\34,g\377\30)d\377\232" \
+  "\31*e\377\3FS\203\377+;q\377\27(d\377\205\31*e\377\3\30)d\377\31*e\377" \
+  ":Hz\377\203IV\205\377\1HU\204\377\202IV\205\377\205JW\206\377\4IV\206" \
+  "\377JW\206\377KX\206\377JW\206\377\207KX\206\377\2LY\207\377KX\206\377" \
+  "\206LY\207\377\2LX\207\377LY\207\377\211LZ\207\377\4KZ\206\377LZ\207" \
+  "\377MZ\210\377LZ\207\377\210MZ\210\377\1LY\207\377\202MZ\210\377\2N[" \
+  "\211\377MZ\210\377\213N[\211\377\6JW\203\377HT~\377EQz\377DOw\377BMu" \
+  "\377ALs\377\203ALr\377\6ALs\377BNu\377DOx\377FR|\377IU\200\377LY\206" \
+  "\377\206N[\211\377\1MZ\210\377\202N[\211\377\202MZ\210\377\1LY\207\377" \
+  "\210MZ\210\377\12LZ\207\377MZ\210\377LZ\207\377KZ\206\377LZ\207\377J" \
+  "W\203\377\30\34*\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377" \
+  "\377\377\4\366\366\366\377\13\13\13\377\0\0\0\377\3\4\6\377\203KX\206" \
+  "\377\20JW\206\377GS\200\377COy\377@Lu\377\77Jr\377>Ip\377>Iq\377\77K" \
+  "s\377BMw\377DP|\377GT\202\377IV\205\377HU\204\377JW\205\377&6m\377\27" \
+  "(d\377\206\31*e\377\6\32+f\3778Gz\377IU\204\377HT\203\377GU\204\377F" \
+  "U\204\377\206GU\204\377\2FT\203\377ES\202\377\205FT\203\377\202ES\203" \
+  "\377\21DR\203\377DR\201\377AN|\377\77Kw\377=It\377<Hr\377:Fo\3779En\377" \
+  "8Dl\3779Em\3779En\377:Fo\377;Gq\377<Is\377>Kw\377\32*a\377\27(c\377\211" \
+  "\31*e\377\4\30)d\3773Bw\377CQ\201\377BP\201\377\202BP\200\377\1BP\177" \
+  "\377\205BP\200\377\202AO\200\377\1@N\200\377\206AO\200\377\2@N\177\377" \
+  "\77M~\377\206@N\177\377\3>L}\377@N\177\377&5m\377\216\31*e\377\3-=s\377" \
+  "=K}\377<J|\377\202=K}\377\3<K}\377=K}\377;K}\377\206<K}\377\1:I{\377" \
+  "\207;J|\377\1""9Hz\377\203:I{\377\3""9Hz\377#3k\377\30)d\377\217\31*" \
+  "e\377\2\30)d\377#3k\377\2078Fz\377\2077Fy\377\2066Ex\377\4""5Dw\377." \
+  ">s\377\27(d\377\30)d\377\222\31*e\377\2\30)d\377\30(d\377\2022Av\377" \
+  "\1""1@u\377\2062Av\377\2""1Au\3770At\377\2051Au\377\2020@u\377\2*;q\377" \
+  "\32+f\377\230\31*e\377\5\30)d\377\34,g\377+:q\377.=s\377,;q\377\205-" \
+  "<r\377\10,<r\377-<r\377+<r\377*:n\377(7i\377'5e\377\37-^\377\24\"U\377" \
+  "\203\25#U\377\6\25$V\377\25$X\377\26%Z\377\27&]\377\27(`\377\30)d\377" \
+  "\221\31*e\377\3\30)d\377\31*e\377#3l\377\203(8o\377\2'7o\377&6o\377\204" \
+  "'7o\377\3&6n\377\32+f\377\30)d\377\232\31*e\377\4HU\204\377:H{\377\32" \
+  "+f\377\30)d\377\205\31*e\377\7\27(d\377'7n\377GU\204\377HU\204\377IV" \
+  "\205\377HU\204\377IV\205\377\207JW\206\377\2IV\206\377JW\206\377\211" \
+  "KX\206\377\2LY\207\377KX\206\377\205LY\207\377\4LX\207\377LY\207\377" \
+  "LZ\207\377LY\207\377\207LZ\207\377\1KZ\206\377\202LZ\207\377\212MZ\210" \
+  "\377\1LY\207\377\202MZ\210\377\202N[\211\377\1MZ\210\377\237N[\211\377" \
+  "\202MZ\210\377\202LY\207\377\210MZ\210\377\4LZ\207\377MZ\210\377LZ\207" \
+  "\377KZ\206\377\202LZ\207\377\5JW\203\377\30\34*\377\0\0\0\377\4\4\4\377" \
+  "\235\235\235\377\216\377\377\377\377\11\366\366\366\377\13\13\13\377" \
+  "\0\0\0\377\3\4\6\377KX\206\377JW\206\377KX\206\377JW\206\377IV\206\377" \
+  "\205JW\206\377\11IV\205\377JW\206\377HU\204\377IV\205\377HU\204\377I" \
+  "V\205\377\77L}\377\27(c\377\30)d\377\205\31*e\377\3\30)d\377\40""0j\377" \
+  "GT\204\377\202HU\204\377\1FU\204\377\207GU\204\377\1ES\202\377\207FT" \
+  "\203\377\2ES\203\377DR\203\377\206ES\203\377\2DR\202\377CQ\201\377\205" \
+  "DR\202\377\3;J|\377\26'c\377\31*d\377\210\31*e\377\3\31)d\377\30)d\377" \
+  "\77M\177\377\203BP\201\377\2BP\200\377BP\177\377\206BP\200\377\2AO\200" \
+  "\377@N\200\377\206AO\200\377\1\77M~\377\207@N\177\377\4\77M}\377>L}\377" \
+  "\37""0i\377\30)d\377\214\31*e\377\2\33,f\3773Bv\377\205=K}\377\2<K}\377" \
+  ";K}\377\206<K}\377\1:I{\377\207;J|\377\1""9Hz\377\202:I{\377\4""9Hz\377" \
+  "9H{\377\35-h\377\30)d\377\217\31*e\377\2\27(d\377(8o\377\2058Fz\377\2" \
+  "7Fy\3778Fz\377\2077Fy\377\2""6Ex\3775Dw\377\2046Ex\377\3""5Dw\377*:p" \
+  "\377\27(d\377\223\31*e\377\5\30)d\377\33+f\3773Bw\3772Av\3771@u\377\206" \
+  "2Av\377\2""1Au\3770At\377\2051Au\377\2020@u\377\2(8p\377\32+e\377\230" \
+  "\31*e\377\5\30)d\377\34-g\377,;q\377.=s\377,;q\377\206-<r\377\2,<r\377" \
+  "+<r\377\203,<r\377\2\"3k\377\30)d\377\232\31*e\377\10\30)d\377\32*e\377" \
+  "$4l\377(8o\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\3&6n\377\31*e\377" \
+  "\30)d\377\232\31*e\377\4HU\204\377ER\202\377#3l\377\30)d\377\205\31*" \
+  "e\377\3\30)d\377\27'c\377\77M~\377\203IV\205\377\3HU\204\377JW\206\377" \
+  "IV\205\377\207JW\206\377\2KX\206\377JW\206\377\205KX\206\377\202JW\205" \
+  "\377\1KX\206\377\207LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207" \
+  "\377\207LZ\207\377\202KZ\206\377\202LZ\207\377\211MZ\210\377\202LY\207" \
+  "\377\202MZ\210\377\202N[\211\377\1MZ\210\377\230N[\211\377\1MZ\210\377" \
+  "\202N[\211\377\203MZ\210\377\1LY\207\377\211MZ\210\377\4LZ\207\377MZ" \
+  "\210\377LZ\207\377KZ\206\377\203LZ\207\377\5JW\203\377\30\34*\377\0\0" \
+  "\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\4\366\366\366\377" \
+  "\13\13\13\377\0\0\0\377\3\4\6\377\202KX\206\377\1JW\206\377\202IV\206" \
+  "\377\204JW\206\377\2IV\205\377JW\206\377\204IV\205\377\3KX\206\377\"" \
+  "2k\377\30)d\377\206\31*e\377\6\30)d\3773Cv\377IV\205\377HT\203\377GU" \
+  "\204\377FU\204\377\205GU\204\377\3FT\203\377GU\204\377ES\202\377\207" \
+  "FT\203\377\1DR\203\377\207ES\203\377\1CQ\201\377\204DR\202\377\4CQ\202" \
+  "\377ES\203\377+;q\377\27(d\377\211\31*e\377\3\30)d\377!1j\377DQ\202\377" \
+  "\203BP\201\377\1BP\177\377\207BP\200\377\1@N\200\377\207AO\200\377\1" \
+  "\77M~\377\205@N\177\377\6\77M~\377@N\177\377\77M~\3778Gy\377\35.g\377" \
+  "\30)d\377\214\31*e\377\2\35.h\3778Fz\377\205=K}\377\1;K}\377\207<K}\377" \
+  "\1:I{\377\205;J|\377\3:I{\377;J|\3779Hz\377\203:I{\377\3""9Hz\377\27" \
+  ")c\377\30)d\377\217\31*e\377\2\27(c\377/=s\377\2068Fz\377\2""7Fy\377" \
+  "6Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2046Ex\377\3""5Dw\377%5m\377\27" \
+  ")d\377\223\31*e\377\5\30)d\377\37""0i\3773Bw\3772Av\3771@u\377\2052A" \
+  "v\377\1""1Au\377\2020At\377\2051Au\377\2020@u\377\1&6n\377\231\31*e\377" \
+  "\5\30)d\377\35.h\377.<s\377.=s\377,;q\377\206-<r\377\205,<r\377\2\37" \
+  "0i\377\30)d\377\232\31*e\377\3\30)d\377\32+f\377%5m\377\202(8o\377\1" \
+  "'7o\377\202&6o\377\203'7o\377\202&6n\377\202\30)d\377\232\31*e\377\3" \
+  "GT\203\377IV\205\3773Av\377\207\31*e\377\3\27)d\377#3k\377JW\205\377" \
+  "\204IV\205\377\2JW\206\377IV\205\377\205JW\206\377\2IV\206\377JW\206" \
+  "\377\210KX\206\377\1JW\205\377\202KX\206\377\210LY\207\377\202LZ\207" \
+  "\377\1LY\207\377\207LZ\207\377\1KZ\206\377\202LZ\207\377\2MZ\210\377" \
+  "LZ\207\377\211MZ\210\377\203LY\207\377\203MZ\210\377\203N[\211\377\1" \
+  "MZ\210\377\221N[\211\377\203MZ\210\377\202LY\207\377\212MZ\210\377\204" \
+  "LZ\207\377\1KZ\206\377\204LZ\207\377\5JW\203\377\30\34*\377\0\0\0\377" \
+  "\4\4\4\377\235\235\235\377\216\377\377\377\377\4\366\366\366\377\13\13" \
+  "\13\377\0\0\0\377\3\4\6\377\202JW\206\377\1IV\206\377\207JW\206\377\6" \
+  "IV\205\377HU\204\377IV\205\377IV\204\377JW\205\3779H{\377\207\31*e\377" \
+  "\3\30)d\377\33,g\377IU\204\377\202HU\204\377\206GU\204\377\3FT\203\377" \
+  "GU\204\377ES\202\377\207FT\203\377\2ES\203\377DR\203\377\206ES\203\377" \
+  "\2DR\202\377CQ\201\377\205DR\202\377\3ES\203\377\33,f\377\30)d\377\211" \
+  "\31*e\377\3\27(c\377/>t\377CQ\201\377\202BP\201\377\2BP\200\377BP\177" \
+  "\377\206BP\200\377\2AO\200\377@N\200\377\206AO\200\377\2@N\177\377\77" \
+  "M~\377\206@N\177\377\5>L}\377\77M~\3772Av\377\32+f\377\30)d\377\213\31" \
+  "*e\377\2\30)d\377\37""0i\377\204=K}\377\2<K}\377=K}\377\207<K}\377\2" \
+  ";J|\377:I{\377\206;J|\377\205:I{\377\2""2Bv\377\27(c\377\217\31*e\377" \
+  "\202\30)d\377\2""2Av\3777Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2067Fy\377" \
+  "\2""6Ex\3775Dw\377\2046Ex\377\3""5Dw\377\40""1j\377\30)d\377\223\31*" \
+  "e\377\5\30)d\377#3l\3773Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3770A" \
+  "t\377\2061Au\377\2020@u\377\2$4l\377\30)d\377\230\31*e\377\5\31*d\377" \
+  "\37""0h\377/>s\377-<r\377,;q\377\206-<r\377\205,<r\377\2\35.g\377\30" \
+  ")d\377\232\31*e\377\3\30)d\377\33,f\377&6m\377\202(8o\377\2'7o\377&6" \
+  "o\377\205'7o\377\2%5m\377\30)d\377\233\31*e\377\202HU\204\377\3ER\202" \
+  "\377\36.h\377\30)d\377\206\31*e\377\4\26'c\3779Gz\377JW\206\377HU\204" \
+  "\377\203IV\205\377\207JW\206\377\2IV\206\377JW\206\377\207KX\206\377" \
+  "\4JW\205\377KX\206\377LY\207\377KX\206\377\206LY\207\377\1LX\207\377" \
+  "\202LY\207\377\211LZ\207\377\1KZ\206\377\202LZ\207\377\2MZ\210\377LZ" \
+  "\207\377\213MZ\210\377\202LY\207\377\204MZ\210\377\216N[\211\377\204" \
+  "MZ\210\377\203LY\207\377\213MZ\210\377\3LZ\207\377MZ\210\377LZ\207\377" \
+  "\202KZ\206\377\205LZ\207\377\5JW\203\377\30\34*\377\0\0\0\377\4\4\4\377" \
+  "\235\235\235\377\216\377\377\377\377\7\366\366\366\377\13\13\13\377\0" \
+  "\0\0\377\3\4\6\377KX\206\377JW\206\377IV\206\377\206JW\206\377\202IV" \
+  "\205\377\1HU\204\377\202IV\205\377\3GT\204\377$3l\377\30)d\377\206\31" \
+  "*e\377\6\26'c\3775Dw\377IV\204\377HT\203\377GU\204\377FU\204\377\206" \
+  "GU\204\377\207FT\203\377\3ES\203\377FT\203\377DR\203\377\207ES\203\377" \
+  "\1CQ\201\377\204DR\202\377\3CQ\201\377ER\202\3778Gz\377\212\31*e\377" \
+  "\3\30)d\377\27(d\377=L}\377\203BP\201\377\1BP\177\377\207BP\200\377\1" \
+  "@N\200\377\207AO\200\377\1\77M~\377\207@N\177\377\202\77M~\377\1,;r\377" \
+  "\202\30)d\377\213\31*e\377\4\30)d\377&7n\377>L~\377<J|\377\203=K}\377" \
+  "\210<K}\377\210;J|\377\204:I{\377\3;I{\377*:q\377\27(d\377\217\31*e\377" \
+  "\3\30)d\377\34-g\3774Bw\377\2068Fz\377\2""7Fy\3776Fx\377\2047Fy\377\4" \
+  "6Ex\3777Fy\3776Ex\3775Dw\377\2036Ex\377\2025Dw\377\2\34,f\377\30)d\377" \
+  "\223\31*e\377\5\27(d\377'7o\3773Bw\3772Av\3771@u\377\2052Av\377\2""1" \
+  "Au\3770At\377\2061Au\377\4""0@u\377/@u\377!2k\377\30)d\377\231\31*e\377" \
+  "\2!2j\377/=s\377\210-<r\377\203,<r\377\4+;q\377-=r\377\32+e\377\30)d" \
+  "\377\232\31*e\377\3\30)d\377\34,g\377'7n\377\202(8o\377\2'7o\377&6o\377" \
+  "\205'7o\377\2\"3l\377\30)d\377\233\31*e\377\5GU\204\377HT\203\377JW\205" \
+  "\3773Av\377\27(c\377\206\31*e\377\4\30)d\377\37""0i\377GT\203\377IV\205" \
+  "\377\202HU\204\377\3IV\205\377JW\206\377IV\205\377\205JW\206\377\4IV" \
+  "\206\377JW\206\377KX\206\377JW\206\377\206KX\206\377\4JW\205\377KX\206" \
+  "\377LY\207\377KX\206\377\206LY\207\377\4LX\207\377LY\207\377LZ\207\377" \
+  "LY\207\377\210LZ\207\377\1KZ\206\377\202LZ\207\377\2MZ\210\377LZ\207" \
+  "\377\214MZ\210\377\203LY\207\377\220MZ\210\377\203LY\207\377\214MZ\210" \
+  "\377\1LZ\207\377\202MZ\210\377\2LZ\207\377KZ\206\377\207LZ\207\377\5" \
+  "JW\203\377\30\34*\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377" \
+  "\377\377\6\366\366\366\377\13\13\13\377\0\0\0\377\3\4\6\377JW\206\377" \
+  "IV\206\377\206JW\206\377\202IV\205\377\5HU\204\377IV\205\377\222\222" \
+  "\222\377\214\214\214\377\213\213\213\377\202\214\214\214\377\2\216\216" \
+  "\216\377U]{\377\202\31*e\377\2-;l\377\201\203\213\377\203\214\214\214" \
+  "\377\3\213\213\213\377\215\215\215\377\206\210\220\377\203GU\204\377" \
+  "\3\211\212\220\377\215\215\215\377\213\213\213\377\202\214\214\214\377" \
+  "\6\216\216\216\377y~\215\377FT\203\377\211\213\220\377\216\216\216\377" \
+  "\213\213\213\377\202\214\214\214\377\2\216\216\216\377dm\211\377\203" \
+  "ES\203\377\2DR\202\377ES\203\377\205DR\202\377\3CQ\202\377FS\203\377" \
+  ")9p\377\212\31*e\377\2\30)d\377!1j\377\202AO\200\377\202BP\201\377\3" \
+  "BP\200\377V`\204\377\220\220\220\377\203\214\214\214\377\3\215\215\215" \
+  "\377\200\203\216\377CQ\200\377\207AO\200\377\206@N\177\377\6\77M~\377" \
+  "@N\177\377\77M~\377=K|\377%5m\377\30)d\377\214\31*e\377\3\30)d\377/\77" \
+  "t\377>L}\377\204=K}\377\2<K}\377;K}\377\206<K}\377\210;J|\377\203:I{" \
+  "\377\3""9I{\377dl\206\377\217\217\217\377\213\214\214\214\377\3\213\213" \
+  "\213\377\216\216\216\377sx\207\377\202\31*e\377\3\30)d\377\40""0j\377" \
+  "5Cx\377\2068Fz\377\2""7Fy\3776Fx\377\2057Fy\377\2026Ex\377\1""5Dw\377" \
+  "\2046Ex\377\3""4Dw\377\27(d\377\30)d\377\223\31*e\377\4\27(c\377,;r\377" \
+  "3Bw\3771@u\377\2042Av\377\3nt\207\377\217\217\217\377\213\213\213\377" \
+  "\202\214\214\214\377\2\216\216\216\377ho\205\377\2021Au\377\5""0@u\377" \
+  "1Au\377.>t\377\37""0j\377\30)d\377\231\31*e\377\2$4l\377.=s\377\210-" \
+  "<r\377\205,<r\377\2\30)d\377\30*e\377\232\31*e\377\3\30)d\377\34-g\377" \
+  "'7n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\2!1j\377\30)d\377\233\31" \
+  "*e\377\1GU\204\377\203HU\204\377\2\35.h\377\30)d\377\207\31*e\377\3""1" \
+  "@u\377JW\205\377HV\205\377\202HU\204\377\1IV\205\377\207JW\206\377\2" \
+  "IV\206\377JW\206\377\210KX\206\377\4JW\205\377KX\206\377LY\207\377KX" \
+  "\206\377\206LY\207\377\4LX\207\377LY\207\377LZ\207\377LY\207\377\210" \
+  "LZ\207\377\202KZ\206\377\1LZ\207\377\202MZ\210\377\1LZ\207\377\215MZ" \
+  "\210\377\220LY\207\377\216MZ\210\377\2LZ\207\377MZ\210\377\202LZ\207" \
+  "\377\1KZ\206\377\210LZ\207\377\5JV\203\377\30\34*\377\0\0\0\377\4\4\4" \
+  "\377\235\235\235\377\216\377\377\377\377\5\366\366\366\377\13\13\13\377" \
+  "\0\0\0\377\3\4\6\377IV\206\377\206JW\206\377\10IV\205\377JW\206\377I" \
+  "V\205\377HU\204\377IV\205\377\212\212\214\377888\377\20\20\20\377\202" \
+  "\23\23\23\377\7BBB\377lr\206\377\35-f\377\31*e\377>Js\377vvv\377\33\33" \
+  "\33\377\202\23\23\23\377\25\21\21\21\377***\377\224\225\226\377NZ\205" \
+  "\377GU\204\377HV\204\377\217\217\217\377+++\377\21\21\21\377\23\23\23" \
+  "\377\24\24\24\377LLL\377z\200\222\377FT\203\377\211\212\217\377<<<\377" \
+  "\17\17\17\377\23\23\23\377\24\24\24\377XXY\377iq\216\377\204ES\203\377" \
+  "\207DR\202\377\3@N\177\377\40""0i\377\30)d\377\211\31*e\377\17\27(c\377" \
+  ".>s\377AO\200\377BP\201\377BP\200\377BP\201\377BP\200\377Wa\205\377i" \
+  "ii\377\24\24\24\377\23\23\23\377\22\22\22\377222\377ux\203\377CQ\200" \
+  "\377\205AO\200\377\2@N\177\377AO\200\377\207@N\177\377\202\77M~\377\3" \
+  ":I{\377\36/i\377\30)d\377\214\31*e\377\2\30)d\3779Gz\377\205=K}\377\2" \
+  "<K}\377;K}\377\206<K}\377\206;J|\377\2:I{\377;J|\377\203:I{\377\3:Hz" \
+  "\377jr\214\377MMM\377\213\23\23\23\377\3\17\17\17\377@@@\377x|\213\377" \
+  "\202\31*e\377\3\30)d\377$4m\3777Ey\377\2048Fz\377\4""7Fy\3778Fz\3777" \
+  "Fy\3776Fx\377\2057Fy\377\2""6Ex\3775Dw\377\2056Ex\377\2/\77t\377\27(" \
+  "c\377\223\31*e\377\202\30)d\377\3/>t\3772Av\3771@u\377\2042Av\377\3n" \
+  "t\207\377PPP\377\16\16\16\377\202\23\23\23\377\2===\377ov\214\377\203" \
+  "1Au\377\4""0@u\377-=s\377\35.h\377\30)d\377\231\31*e\377\2'6o\377.=s" \
+  "\377\210-<r\377\204,<r\377\2)9p\377\30)d\377\233\31*e\377\2\31*d\377" \
+  "\36.g\377\203(8o\377\2'7o\377&6o\377\205'7o\377\2\37/i\377\30)d\377\233" \
+  "\31*e\377\2FU\204\377GU\204\377\202HU\204\377\3""8Fz\377\26(c\377\30" \
+  ")d\377\205\31*e\377\3\30)d\377\37""0i\377AO\177\377\203IV\205\377\1H" \
+  "U\204\377\202IV\205\377\206JW\206\377\4IV\206\377JW\206\377KX\206\377" \
+  "JW\206\377\206KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377\212" \
+  "LY\207\377\211LZ\207\377\202KZ\206\377\202LZ\207\377\202MZ\210\377\1" \
+  "LZ\207\377\247MZ\210\377\202LZ\207\377\202KZ\206\377\210LZ\207\377\7" \
+  "LY\207\377LZ\207\377JW\203\377\30\34*\377\0\0\0\377\4\4\4\377\235\235" \
+  "\235\377\216\377\377\377\377\5\366\366\366\377\13\13\13\377\0\0\0\377" \
+  "\3\4\6\377IV\206\377\205JW\206\377\3IV\205\377JW\206\377HU\204\377\202" \
+  "IV\205\377\3HU\204\377|\177\214\377FFF\377\203\0\0\0\377\6%%%\377wz\205" \
+  "\377\40""0g\377\32+e\377[c\200\377SSS\377\205\0\0\0\377\5\212\212\213" \
+  "\377dl\212\377GU\204\377Xc\207\377\217\217\217\377\204\0\0\0\377\5\\" \
+  "\\\\\377lt\216\377FT\203\377\211\212\217\377)))\377\203\0\0\0\377\2L" \
+  "MM\377jr\217\377\204ES\203\377\2DR\202\377CQ\201\377\205DR\202\377\3" \
+  "6Ey\377\33,f\377\30)d\377\210\31*e\377\3\30)d\377\31)e\377:H{\377\203" \
+  "BP\201\377\4BP\200\377BP\177\377Wb\206\377bbb\377\203\0\0\0\377\3!!!" \
+  "\377sw\201\377BP\200\377\206AO\200\377\2@N\177\377\77M~\377\206@N\177" \
+  "\377\202\77M~\377\3""7Fy\377\27)d\377\30)d\377\213\31*e\377\4\30)d\377" \
+  "\33,g\377\77M~\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377\206" \
+  "<K}\377\207;J|\377\2:I{\3779Hz\377\203:I{\377\2hp\213\377AAA\377\214" \
+  "\0\0\0\377\3""222\377y}\214\377\31*e\377\202\30)d\377\1(8o\377\2068F" \
+  "z\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\2(9o" \
+  "\377\27(d\377\223\31*e\377\5\30)d\377\33,g\3770\77t\3772Av\3771@u\377" \
+  "\2042Av\377\2nt\207\377DDD\377\203\0\0\0\377\2///\377pw\215\377\2031" \
+  "Au\377\4/\77u\377,<r\377\33,f\377\30)d\377\231\31*e\377\2*9p\377.=s\377" \
+  "\210-<r\377\204,<r\377\2&7n\377\30)d\377\234\31*e\377\1\37/h\377\203" \
+  "(8o\377\2'7o\377&6o\377\205'7o\377\2\35.h\377\30)d\377\233\31*e\377\1" \
+  "FU\204\377\202GU\204\377\4GT\203\377FS\203\377#3k\377\27(d\377\205\31" \
+  "*e\377\3\30*d\377\27(d\377.=s\377\202HU\204\377\5IV\205\377HU\204\377" \
+  "IV\205\377JW\206\377IV\205\377\206JW\206\377\4IV\206\377JW\206\377KX" \
+  "\206\377JW\206\377\206KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206" \
+  "\377\206LY\207\377\202LX\207\377\3LY\207\377LZ\207\377LY\207\377\211" \
+  "LZ\207\377\202KZ\206\377\202LZ\207\377\244MZ\210\377\2LZ\207\377MZ\210" \
+  "\377\203LZ\207\377\1KZ\206\377\211LZ\207\377\10LY\207\377LZ\207\377L" \
+  "Y\207\377JV\203\377\30\33*\377\0\0\0\377\4\4\4\377\235\235\235\377\216" \
+  "\377\377\377\377\4\366\366\366\377\13\13\13\377\0\0\0\377\3\4\6\377\205" \
+  "JW\206\377\2IV\205\377JW\206\377\203IV\205\377\4HU\204\377IV\205\377" \
+  "jq\212\377bbb\377\203\0\0\0\377\6\31\31\31\377}}~\377#2i\377\35-f\377" \
+  "vz\210\377666\377\205\0\0\0\377\5__`\377z\177\221\377GU\204\377jq\213" \
+  "\377}}}\377\203\0\0\0\377\7\2\2\2\377z{}\377_i\211\377FT\203\377\213" \
+  "\214\217\377]]]\377@@@\377\202BBB\377\2nnn\377hp\214\377\203ES\203\377" \
+  "\2DR\202\377CQ\201\377\205DR\202\377\4CQ\201\377,;q\377\30(d\377\30*" \
+  "e\377\210\31*e\377\13\30)d\377\"2k\377>L~\377BP\201\377BP\200\377BP\201" \
+  "\377BP\200\377BP\177\377Wb\206\377ccc\377\1\1\1\377\202\0\0\0\377\3#" \
+  "##\377sw\201\377BP\200\377\204AO\200\377\4@N\177\377AO\200\377@N\177" \
+  "\377\77M~\377\204@N\177\377\2\77M~\377@N\177\377\202\77M~\377\2.=r\377" \
+  "\27(c\377\214\31*e\377\3\27)d\377'7o\377>L}\377\204=K}\377\202<K}\377" \
+  "\1;K}\377\205<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377\203:" \
+  "I{\377\2dl\207\377BBB\377\214\0\0\0\377\6...\377y}\214\377\31*e\377\30" \
+  ")d\377\31*e\377-;r\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6E" \
+  "x\3775Dw\377\2046Ex\377\3""7Fx\377\"3k\377\30)d\377\223\31*e\377\5\30" \
+  ")d\377\36/h\3770@u\3773Bw\3771@u\377\2042Av\377\2nt\207\377EEE\377\203" \
+  "\0\0\0\377\2""111\377pw\215\377\2031Au\377\4""0\77u\377+;q\377\31*e\377" \
+  "\30)d\377\231\31*e\377\2,<r\377.=s\377\207-<r\377\2,<r\377+<r\377\203" \
+  ",<r\377\2#4l\377\30)d\377\234\31*e\377\1!1j\377\203(8o\377\2'7o\377&" \
+  "6o\377\205'7o\377\2\33,f\377\30)d\377\233\31*e\377\3GU\204\377FU\204" \
+  "\377GU\204\377\202HU\204\377\3""9Gz\377\32+e\377\30)d\377\205\31*e\377" \
+  "\10\30)d\377\31*e\377>L~\377IV\205\377HU\204\377IV\205\377HU\204\377" \
+  "IV\205\377\207JW\206\377\1IV\206\377\202JW\206\377\210KX\206\377\4JW" \
+  "\205\377KX\206\377LY\207\377KX\206\377\207LY\207\377\4LX\207\377LY\207" \
+  "\377LZ\207\377LY\207\377\212LZ\207\377\1KZ\206\377\202LZ\207\377\203" \
+  "MZ\210\377\1LZ\207\377\240MZ\210\377\202LZ\207\377\202KZ\206\377\211" \
+  "LZ\207\377\11LY\207\377LZ\207\377LY\207\377LX\207\377JU\203\377\30\34" \
+  "*\377\0\0\0\377\4\4\4\377\235\235\235\377\216\377\377\377\377\4\366\366" \
+  "\366\377\13\13\13\377\0\0\0\377\3\4\6\377\206JW\206\377\202IV\205\377" \
+  "\1HU\204\377\202IV\205\377\4JW\206\377@Lv\377sss\377\12\12\12\377\202" \
+  "\0\0\0\377\6\14\14\14\377sss\3771>n\377\37/g\377\203\203\203\377\36\36" \
+  "\36\377\205\0\0\0\377\5///\377\212\215\227\377GU\204\377{\200\220\377" \
+  "]]]\377\203\0\0\0\377\6\7\7\7\377\220\222\227\377S_\205\377FT\203\377" \
+  "qw\213\377uz\212\377\203sx\212\377\2uz\213\377Yc\207\377\203ES\203\377" \
+  "\2DR\202\377CQ\201\377\204DR\202\377\4IV\202\377ES\200\377\40""0h\377" \
+  "\30)d\377\206\31*e\377\5\40""0g\377#2h\377\"2h\377\37/f\377+;q\377\203" \
+  "BP\201\377\202BP\200\377\4BP\177\377Wb\206\377ccc\377\1\1\1\377\202\0" \
+  "\0\0\377\3###\377sw\201\377BP\200\377\205AO\200\377\202@N\177\377\3E" \
+  "R\177\377FS\200\377GS\200\377\203@N\177\377\203\77M~\377\2\"2k\377\30" \
+  ")d\377\205\31*e\377\1\"1h\377\203\"2h\377\203\31*e\377\2\26(c\3772Bv" \
+  "\377\205=K}\377\6<K}\377=L}\377CP~\377BP~\377CP~\377\77N}\377\202<K}" \
+  "\377\2;J|\377:I{\377\204;J|\377\11:I{\377;J|\377:I{\3779Hz\377:I{\377" \
+  "9Hz\377;J|\377_h\205\377BBB\377\204\0\0\0\377\2dde\377\213\213\213\377" \
+  "\206\211\211\211\377\6\215\215\215\377vz\210\377\31*e\377\30)d\377\33" \
+  ",g\3771@u\377\2048Fz\377\4@L|\377\77L|\3777Fy\3776Fx\377\2067Fy\377\11" \
+  "<Jz\377<Jy\377=Kz\3779Gx\3776Ex\3775Dw\3777Fy\377\34-g\377\30)d\377\210" \
+  "\31*e\377\1#2h\377\202\"2h\377\1\40""0g\377\207\31*e\377\5\30)d\377!" \
+  "2k\3771Av\3772Av\3772Au\377\2029Gx\377\4""3Bv\3772Av\377nt\207\377EE" \
+  "E\377\203\0\0\0\377\2""111\377pw\215\377\2031Au\377\2/\77u\377)9p\377" \
+  "\202\30)d\377\1\33,f\377\202\"2h\377\1!1h\377\220\31*e\377\1\36.g\377" \
+  "\202\"2h\377\4\30)d\377\32+e\377/>s\377.=s\377\202-<r\377\1""3At\377" \
+  "\2024Bt\377\202-<r\377\2,<r\377+<r\377\203,<r\377\2\40""1j\377\30)d\377" \
+  "\234\31*e\377\1#3k\377\202(8o\377\202'7o\377\1&6o\377\203'7o\377\4&6" \
+  "n\377'7o\377\31*d\377\30)d\377\233\31*e\377\1GU\204\377\202FU\204\377" \
+  "\5GU\204\377HU\204\377FS\203\377%5m\377\30)d\377\206\31*e\377\3\30)d" \
+  "\377\36/i\377IW\205\377\204IV\205\377\2JW\206\377IV\205\377\206JW\206" \
+  "\377\202IV\206\377\1JW\206\377\210KX\206\377\4JW\205\377KX\206\377LY" \
+  "\207\377KX\206\377\207LY\207\377\2LX\207\377LY\207\377\202LZ\207\377" \
+  "\1LY\207\377\211LZ\207\377\202KZ\206\377\203LZ\207\377\202MZ\210\377" \
+  "\1LZ\207\377\230MZ\210\377\1LZ\207\377\202MZ\210\377\203LZ\207\377\202" \
+  "KZ\206\377\212LZ\207\377\3LY\207\377LZ\207\377LY\207\377\202LX\207\377" \
+  "\5JV\203\377\30\34*\377\0\0\0\377\4\4\4\377\237\237\237\377\216\377\377" \
+  "\377\377\4\370\370\370\377\13\13\13\377\0\0\0\377\3\4\6\377\206JW\206" \
+  "\377\11IV\205\377HU\204\377IV\205\377HU\204\377KW\206\3774Cw\377!1h\377" \
+  "\200\200\200\377\32\32\32\377\203\0\0\0\377\5fff\377ISw\377<Hr\377tt" \
+  "t\377\11\11\11\377\202\0\0\0\377\1\2\2\2\377\202\0\0\0\377\5\7\7\7\377" \
+  "\216\220\224\377S_\206\377\213\216\225\377999\377\203\0\0\0\377\6***" \
+  "\377\213\216\227\377HV\203\377FT\203\377z~\215\377~\201\214\377\203|" \
+  "\177\212\377\5~\201\214\377]g\210\377ES\203\377\\f\207\377\204\206\216" \
+  "\377\202}\200\212\377\17~\200\212\377\200\203\214\377x}\215\377\212\213" \
+  "\217\377\214\214\214\377\213\213\213\377\216\216\216\377rv\206\377\40" \
+  "0g\377\31*e\377\32+e\377\77Js\377sw\206\377\216\216\216\377\214\214\214" \
+  "\377\202\213\213\213\377\13\214\214\214\377\215\215\215\377}\201\215" \
+  "\377[e\206\377CQ\201\377BP\200\377BP\177\377BP\200\377Wb\206\377ccc\377" \
+  "\1\1\1\377\202\0\0\0\377\3###\377sv\201\377CQ\200\377\203AO\200\377\4" \
+  "DR\200\377em\210\377\204\206\215\377\215\215\215\377\203\213\213\213" \
+  "\377\16\215\215\215\377\212\212\215\377uz\213\377R]\203\377\77M~\377" \
+  "=L}\377\27)d\377\30)d\377\31*e\377\37/g\377U]{\377\201\203\212\377\215" \
+  "\215\215\377\214\214\214\377\203\213\213\213\377\5\215\215\215\377\202" \
+  "\204\213\377S\\z\377\37.f\377<J|\377\203=K}\377\4IU\200\377rx\212\377" \
+  "\211\212\215\377\215\215\215\377\203\213\213\213\377\5\214\214\214\377" \
+  "\215\215\215\377\177\202\214\377Wa\203\377:I{\377\205;J|\377\1:I{\377" \
+  "\2029Hz\377\202:I{\377\3;J{\377\\e\203\377BBB\377\204\0\0\0\377\3lll" \
+  "\377Ya~\377.<m\377\2061\77n\377\11+:l\377GRv\377z}\210\377vy\205\377" \
+  "{}\210\377{~\211\377\200\202\214\377lr\210\377\216\217\220\377\202\213" \
+  "\213\213\377\11\216\216\216\377rw\211\377=Kz\3777Fy\3779Hy\377Wa\202" \
+  "\377\177\202\214\377\215\215\215\377\214\214\214\377\202\213\213\213" \
+  "\377\6\214\214\214\377\214\214\215\377v{\212\377OZ\177\377\31*d\377\30" \
+  ")d\377\204\31*e\377\5\35-f\377:Gq\377sw\206\377\216\216\216\377\214\214" \
+  "\214\377\202\213\213\213\377\5\214\214\214\377\216\216\216\377sw\206" \
+  "\377@Lt\377\35.f\377\203\31*e\377\5\30)d\377%5m\377FR{\377{\177\213\377" \
+  "\216\216\216\377\202\213\213\213\377\4\215\215\215\377{~\213\377|\177" \
+  "\213\377DDD\377\203\0\0\0\377\12""111\377pw\215\3771Au\3770@u\3771Au" \
+  "\377/\77t\3775Br\377^f\177\377\206\207\213\377\215\215\215\377\202\213" \
+  "\213\213\377\5\214\214\214\377\216\216\216\377uy\206\377EPu\377\33,e" \
+  "\377\203\31*e\377\3$4i\377w{\207\377vz\205\377\202ux\204\377\5y|\207" \
+  "\377QZz\377R[z\377\207\210\214\377\214\214\214\377\202\213\213\213\377" \
+  "\22\216\216\216\377lq\204\377:Gv\3776Ct\377ns\206\377\217\217\217\377" \
+  "\214\214\214\377\213\213\213\377\214\214\214\377\210\211\215\377T]~\377" \
+  ".>r\377+<r\377,<r\377+;r\377-=r\377\35.h\377\30)d\377\234\31*e\377\1" \
+  "$4l\377\202(8o\377\2'7o\377&6o\377\205'7o\377\2'6n\377\30)d\377\234\31" \
+  "*e\377\202GU\204\377\7FU\204\377GU\204\377HT\203\377IU\204\377<J|\377" \
+  "\33,f\377\30)d\377\206\31*e\377\4\30)d\377,<r\377JW\206\377IV\205\377" \
+  "\202HU\204\377\1IV\205\377\210JW\206\377\4IV\206\377JW\206\377KX\206" \
+  "\377JW\206\377\207KX\206\377\4JW\205\377KX\206\377LY\207\377KX\206\377" \
+  "\207LY\207\377\202LX\207\377\1LY\207\377\202LZ\207\377\1LY\207\377\213" \
+  "LZ\207\377\203KZ\206\377\203LZ\207\377\217MZ\210\377\1LZ\207\377\205" \
+  "MZ\210\377\203LZ\207\377\202KZ\206\377\213LZ\207\377\1LY\207\377\202" \
+  "LZ\207\377\1LY\207\377\202LX\207\377\202LY\207\377\6JV\203\377\30\34" \
+  "*\377\0\0\0\377\3\3\3\377lll\377\265\265\265\377\215\257\257\257\377" \
+  "\4\251\251\251\377\7\7\7\377\0\0\0\377\3\4\6\377\203JW\206\377\4IV\205" \
+  "\377JW\206\377IV\205\377HU\204\377\203IV\205\377\5AO\200\377\37/i\377" \
+  "\35.f\377wz\206\377+++\377\203\0\0\0\377\4TTT\377^f~\377hn\203\377]]" \
+  "]\377\202\0\0\0\377\2\3\3\3\377444\377\202\0\0\0\377\5\3\3\3\377ppq\377" \
+  "ks\215\377\221\223\230\377\32\32\32\377\203\0\0\0\377\7OPP\377\177\204" \
+  "\222\377FT\203\377ES\203\377\212\213\217\377TTT\377000\377\202333\377" \
+  "\6ggg\377hp\214\377ES\203\377ck\211\377\177\177\177\377---\377\20233" \
+  "3\377\33]]]\377\227\227\227\377XXX\377\22\22\22\377\6\6\6\377<<<\377" \
+  "\213\213\213\377'6j\377%5i\377ot\206\377\203\203\203\377]]]\377+++\377" \
+  "\21\21\21\377\4\4\4\377\5\5\5\377\26\26\26\377...\377[[[\377\202\202" \
+  "\202\377\202\205\221\377LX\202\377BP\177\377BP\200\377Wb\206\377ccc\377" \
+  "\1\1\1\377\202\0\0\0\377\3###\377sv\201\377CQ\200\377\202AO\200\377\36" \
+  "T_\204\377\214\216\222\377zzz\377OOO\377\"\"\"\377\15\15\15\377\3\3\3" \
+  "\377\11\11\11\377\32\32\32\377999\377iii\377\212\212\212\377nt\213\377" \
+  "4Bv\377\27(c\377\31*e\377.<m\377\205\207\216\377zzz\377KKK\377\"\"\"" \
+  "\377\16\16\16\377\1\1\1\377\3\3\3\377\16\16\16\377\37\40\40\377HHH\377" \
+  "~~~\377x|\211\377DP~\377\202=K}\377\16^g\206\377\217\217\217\377mmm\377" \
+  ";;;\377\32\32\32\377\7\7\7\377\1\1\1\377\5\5\5\377\23\23\23\377(((\377" \
+  "ZZZ\377\210\210\210\377mt\212\377=K|\377\204;J|\377\2:I{\3779Hz\377\203" \
+  ":I{\377\3""6Ex\377[c\202\377BBB\377\204\0\0\0\377\2lll\377ISx\377\210" \
+  "\31*e\377\33Zc\200\377bbb\377444\377333\377///\377www\377\223\223\223" \
+  "\377PPP\377\15\15\15\377\11\11\11\377AAA\377\223\223\225\377FR}\377E" \
+  "Q|\377\204\207\221\377\177\177\177\377WWW\377'''\377\20\20\20\377\3\3" \
+  "\3\377\7\7\7\377\27\27\27\377222\377bbb\377\206\206\206\377fm\202\377" \
+  "!1h\377\203\31*e\377\17&5i\377ot\206\377\205\205\205\377\\\\\\\377--" \
+  "-\377\22\22\22\377\3\3\3\377\7\7\7\377\24\24\24\377,,,\377ZZZ\377\203" \
+  "\203\203\377rw\207\377&5i\377\31*e\377\202\30)d\377\12OY|\377\220\220" \
+  "\220\377ddd\377(((\377\11\11\11\377\7\7\7\377%%%\377```\377\215\215\215" \
+  "\377CCD\377\203\0\0\0\377\2""111\377pw\215\377\2021Au\377\16""0@u\377" \
+  "Zc\202\377\214\214\215\377rrr\377\77\77\77\377\32\33\33\377\7\7\7\377" \
+  "\4\4\4\377\22\22\22\377***\377YYY\377\200\200\200\377}\200\214\377-;" \
+  "l\377\202\31*e\377\31)8k\377|||\377<<<\377333\377222\377UUU\377\225\225" \
+  "\225\377\203\203\203\377JJJ\377\27\27\27\377\5\5\5\377\14\14\14\377/" \
+  "//\377uuu\377}\200\214\377\216\217\222\377ttt\377555\377\17\17\17\377" \
+  "\4\4\4\377\27\27\27\377KKK\377\210\210\210\377[c\201\377+<r\377\203," \
+  "<r\377\1\33,f\377\235\31*e\377\1&6n\377\202(8o\377\2'7o\377&6o\377\205" \
+  "'7o\377\2$4m\377\30)d\377\234\31*e\377\203GU\204\377\6FU\204\377GU\204" \
+  "\377HT\203\377JW\205\377+:p\377\27(d\377\210\31*e\377\5:H{\377JW\205" \
+  "\377IU\204\377IV\205\377HU\204\377\202IV\205\377\207JW\206\377\4IV\206" \
+  "\377JW\206\377KX\206\377JW\206\377\207KX\206\377\4JW\205\377KX\206\377" \
+  "LY\207\377KX\206\377\210LY\207\377\1LX\207\377\202LY\207\377\202LZ\207" \
+  "\377\1LY\207\377\214LZ\207\377\203KZ\206\377\204LZ\207\377\214MZ\210" \
+  "\377\205LZ\207\377\203KZ\206\377\214LZ\207\377\2LY\207\377LZ\207\377" \
+  "\202LY\207\377\1LX\207\377\204LY\207\377\2JV\203\377\30\34*\377\202\0" \
+  "\0\0\377\1\2\2\2\377\217\3\3\3\377\202\0\0\0\377\1\3\4\6\377\204JW\206" \
+  "\377\2IV\205\377HU\204\377\202IV\205\377\202HU\204\377\5*:p\377\27)d" \
+  "\377\33+f\377io\206\377\77\77\77\377\203\0\0\0\377\4;;;\377wz\205\377" \
+  "\210\211\215\377888\377\202\0\0\0\377\10\12\12\12\377sss\377\7\7\7\377" \
+  "\0\0\0\377\1\1\1\377JJJ\377\212\214\226\377\222\222\225\377\204\0\0\0" \
+  "\377\2wwx\377mt\214\377\202FT\203\377\2\210\212\217\377000\377\203\0" \
+  "\0\0\377\5MNN\377jr\216\377DR\202\377bk\211\377sss\377\203\0\0\0\377" \
+  "\3===\377ttt\377\4\4\4\377\202\0\0\0\377\6;;;\377\200\202\211\377\37" \
+  "/g\377uy\210\377uuu\377\40\40\40\377\203\0\0\0\377\2\5\5\5\377\6\6\6" \
+  "\377\203\0\0\0\377\10\36\36\36\377ppp\377\203\206\223\377GT\201\377B" \
+  "P\200\377Wb\206\377ccc\377\1\1\1\377\202\0\0\0\377\10###\377sw\201\377" \
+  "CQ\200\377AO\200\377R]\203\377\217\220\224\377XXX\377\20\20\20\377\203" \
+  "\0\0\0\377\1\10\10\10\377\204\0\0\0\377\10""333\377\204\204\204\377]" \
+  "f\200\377\30)d\377\36.g\377uz\213\377hhh\377\16\16\16\377\202\0\0\0\377" \
+  "\3\26\26\26\377+++\377\36\36\36\377\203\0\0\0\377\7\21\21\21\377ttt\377" \
+  "nt\211\377=K}\377IU\200\377\213\214\221\377HHH\377\203\0\0\0\377\3\40" \
+  "\40\40\377***\377\25\25\25\377\203\0\0\0\377\3///\377\206\206\206\377" \
+  "T_\203\377\204;J|\377\10:I{\3779Hz\377:I{\3779H{\377:I{\3770@t\377Zc" \
+  "\201\377BBB\377\204\0\0\0\377\3rrr\377|\201\221\377dk\206\377\204fm\207" \
+  "\377\5dj\202\3775Bo\377\31*e\377[d\201\377FFF\377\203\0\0\0\377\2nnn" \
+  "\377___\377\203\0\0\0\377\6RRR\377\206\210\221\377DP|\377\212\214\224" \
+  "\377fff\377\27\27\27\377\203\0\0\0\377\2\6\6\6\377\3\3\3\377\203\0\0" \
+  "\0\377\3'''\377}}}\377hn\202\377\202\31*e\377\4!1h\377{\177\214\377x" \
+  "xx\377\37\40\40\377\203\0\0\0\377\2\3\3\3\377\4\4\4\377\203\0\0\0\377" \
+  "\10\32\33\33\377vvv\377z~\212\377\37/g\377\30)d\377.<m\377\222\222\223" \
+  "\377KKK\377\206\0\0\0\377\2<<<\377BBB\377\203\0\0\0\377\2""111\377pw" \
+  "\215\377\2021Au\377\4Yb\202\377\212\213\213\377BBB\377\1\1\1\377\207" \
+  "\0\0\0\377\10\31\32\32\377hhh\377\200\203\217\377&5i\377\31*e\377)8l" \
+  "\377lll\377\10\10\10\377\202\0\0\0\377\3""445\377{{{\377\40\40\40\377" \
+  "\205\0\0\0\377\4\22\22\22\377\202\202\202\377```\377\11\11\11\377\205" \
+  "\0\0\0\377\3;;;\377\213\214\216\377+<r\377\202,<r\377\2*:q\377\33+f\377" \
+  "\233\31*e\377\2\30)e\377\31*e\377\203(8o\377\2'7o\377&6o\377\205'7o\377" \
+  "\2\"3k\377\30)d\377\234\31*e\377\205GU\204\377\5HT\203\377HU\204\377" \
+  "ES\202\377\35.h\377\30)d\377\206\31*e\377\3\30)d\377!1j\377CQ\201\377" \
+  "\203IV\205\377\1HU\204\377\202IV\205\377\207JW\206\377\4IV\206\377JW" \
+  "\206\377KX\206\377JW\206\377\207KX\206\377\4JW\205\377KX\206\377LY\207" \
+  "\377KX\206\377\210LY\207\377\202LX\207\377\202LY\207\377\2LZ\207\377" \
+  "LY\207\377\216LZ\207\377\204KZ\206\377\214LZ\207\377\205KZ\206\377\216" \
+  "LZ\207\377\2LY\207\377LZ\207\377\202LY\207\377\202LX\207\377\204LY\207" \
+  "\377\2JV\203\377\30\34*\377\224\0\0\0\377\1\3\4\6\377\202JW\206\377\3" \
+  "IV\205\377JW\206\377HU\204\377\202IV\205\377\3HU\204\377IV\205\3776E" \
+  "y\377\202\30)d\377\4\31*e\377OY{\377\\\\\\\377\4\4\4\377\202\0\0\0\377" \
+  "\4###\377\210\210\211\377\215\215\215\377\21\21\21\377\202\0\0\0\377" \
+  "\3---\377\213\213\213\377\35\35\35\377\202\0\0\0\377\3)))\377\227\227" \
+  "\227\377yyz\377\204\0\0\0\377\6\221\221\222\377Yd\207\377ES\203\377F" \
+  "T\203\377\210\212\217\377333\377\203\0\0\0\377\5OPP\377jr\216\377ES\203" \
+  "\377bj\210\377ttt\377\203\0\0\0\377\2\16\16\16\377\24\24\24\377\203\0" \
+  "\0\0\377\5lll\377LVy\377PZy\377\205\205\205\377\27\27\27\377\202\0\0" \
+  "\0\377\6\2\2\2\377FFF\377vvv\377www\377PPP\377\5\5\5\377\202\0\0\0\377" \
+  "\7\26\26\26\377}}}\377bk\211\377BP\200\377Wb\206\377ccc\377\1\1\1\377" \
+  "\202\0\0\0\377\2###\377sw\201\377\202CQ\200\377\3{\200\221\377^^^\377" \
+  "\5\5\5\377\202\0\0\0\377\5\17\17\17\377aaa\377xxx\377sss\377...\377\203" \
+  "\0\0\0\377\6""777\377\217\217\217\377*9k\377,;m\377~\200\207\377\25\25" \
+  "\25\377\202\0\0\0\377\16())\377{{{\377wy\201\377\203\203\203\377MMM\377" \
+  "\6\6\6\377\17\17\17\377\32\32\32\377TTT\377\220\220\220\377=K}\377Zc" \
+  "\206\377ooo\377\7\7\7\377\202\0\0\0\377\12EEE\377\202\202\203\377|~\204" \
+  "\377}}}\377222\377\3\3\3\377\23\23\23\377###\377mmm\377y}\215\377\204" \
+  ";J|\377\10:I{\3779Hz\377:I{\377:Iz\377:I{\377*:q\377Xa\200\377BBB\377" \
+  "\204\0\0\0\377\3&''\377777\377888\377\203777\377\7""333\377sss\377KU" \
+  "w\377\31*e\377[c\201\377HHH\377\1\1\1\377\202\0\0\0\377\2\33\33\33\377" \
+  "\12\12\12\377\202\0\0\0\377\6\5\5\5\377\210\210\210\377`i\204\377go\211" \
+  "\377ppp\377\14\14\14\377\202\0\0\0\377\5\5\5\5\377WWW\377xxx\377vvv\377" \
+  ">>>\377\203\0\0\0\377\7$$$\377\216\216\216\377>Jr\377\31*e\377W`}\377" \
+  "\206\206\206\377\21\21\21\377\203\0\0\0\377\4JJJ\377xxx\377yyy\377OO" \
+  "O\377\203\0\0\0\377\6\20\20\20\377\213\213\213\377X`}\377\30)d\377ot" \
+  "\206\377sss\377\205\0\0\0\377\1\20\20\20\377\202\0\0\0\377\1\16\16\16" \
+  "\377\203\0\0\0\377\6""111\377pw\215\3771Au\377;Ix\377\215\215\216\377" \
+  "DDD\377\203\0\0\0\377\4\2\2\2\377000\377\77\77\77\377\27\27\27\377\203" \
+  "\0\0\0\377\7\20\20\20\377rrr\377]e\200\377\31*e\377)8l\377mmm\377\14" \
+  "\14\14\377\202\0\0\0\377\2&&&\377###\377\207\0\0\0\377\2\"\"\"\377\6" \
+  "\6\6\377\207\0\0\0\377\2\203\203\203\377+<r\377\202,<r\377\2(8o\377\32" \
+  "+e\377\233\31*e\377\7\30)d\377\33,f\377(8o\377'7n\377(8o\377'7o\377&" \
+  "6o\377\205'7o\377\2\40""0j\377\30)d\377\234\31*e\377\206GU\204\377\5" \
+  "HT\203\377HU\204\377<J|\377\27(c\377\30)d\377\205\31*e\377\202\30)d\377" \
+  "\1+;q\377\202HU\204\377\5IV\205\377HU\204\377IV\205\377JW\206\377IV\205" \
+  "\377\206JW\206\377\202IV\206\377\1JW\206\377\211KX\206\377\2JW\205\377" \
+  "KX\206\377\212LY\207\377\202LX\207\377\202LY\207\377\2LZ\207\377LY\207" \
+  "\377\221LZ\207\377\215KZ\206\377\220LZ\207\377\1LY\207\377\202LZ\207" \
+  "\377\1LY\207\377\202LX\207\377\211LY\207\377\202KX\206\377\202JW\205" \
+  "\377\207KX\206\377\4JW\206\377KX\206\377JW\206\377IV\206\377\206JW\206" \
+  "\377\2IV\205\377JW\206\377\203IV\205\377\5HU\204\377IV\205\377CP\201" \
+  "\377\31*e\377\30)d\377\202\31*e\377\3=It\377rst\377\10\10\10\377\202" \
+  "\0\0\0\377\3\12\12\12\377\210\210\210\377}}}\377\203\0\0\0\377\3\\\\" \
+  "\\\377\230\230\230\377333\377\202\0\0\0\377\3\30\30\30\377\206\206\206" \
+  "\377\\\\\\\377\203\0\0\0\377\7\40\40\40\377\223\223\224\377IV\203\377" \
+  "FT\203\377ES\203\377\210\212\217\377333\377\203\0\0\0\377\5OPP\377iq" \
+  "\216\377ES\203\377bj\210\377ttt\377\204\0\0\0\377\10\2\2\2\377[[\\\377" \
+  "\212\212\212\377\203\203\203\377\203\204\211\377(7k\377\215\216\220\377" \
+  "EEE\377\203\0\0\0\377\6""333\377\221\221\224\377ISw\377JUz\377\216\216" \
+  "\217\377FFF\377\203\0\0\0\377\6AAA\377\201\204\217\377CQ\200\377Wb\206" \
+  "\377ccc\377\1\1\1\377\202\0\0\0\377\6###\377sw\201\377CQ\200\377KW\202" \
+  "\377\205\205\205\377\36\36\36\377\202\0\0\0\377\7\3\3\3\377fff\377\211" \
+  "\213\220\377V`\204\377nt\212\377\221\221\221\377\21\21\21\377\203\0\0" \
+  "\0\377\5yyy\377_f\177\377+:m\377jkr\377\11\11\11\377\202\0\0\0\377\5" \
+  "KKK\377\220\220\221\377EOu\377FQv\377\211\212\215\377\202\213\213\213" \
+  "\377\23\214\214\214\377\213\214\216\377\206\210\217\377=K}\377`h\210" \
+  "\377RRR\377\1\1\1\377\0\0\0\377\5\5\5\377fff\377\200\204\220\377U`\203" \
+  "\377ip\210\377\216\216\216\377\212\212\212\377\214\214\214\377\215\215" \
+  "\215\377\211\212\216\377ou\211\377\203;J|\377\202:I{\377\1""9Hz\377\202" \
+  ":I{\377\4""9Hz\377%5m\377Xa\200\377BBB\377\213\0\0\0\377\6```\377ITv" \
+  "\377\31*e\377[c\201\377HHH\377\1\1\1\377\204\0\0\0\377\7hhh\377\214\214" \
+  "\214\377\203\203\203\377\217\217\221\377>K{\377\206\207\214\377***\377" \
+  "\203\0\0\0\377\6WWW\377\216\216\220\377Wa\202\377bj\205\377\223\223\225" \
+  "\377###\377\203\0\0\0\377\5```\377z~\212\377\34-f\377\201\204\221\377" \
+  "111\377\203\0\0\0\377\6DDE\377\221\221\221\377PYz\377LVx\377\220\221" \
+  "\223\377CCD\377\203\0\0\0\377\5;;;\377\200\203\217\377%4i\377\211\213" \
+  "\223\377+++\377\203\0\0\0\377\5\5\5\5\377qqq\377\217\217\217\377\211" \
+  "\211\211\377&&&\377\204\0\0\0\377\5""111\377pw\215\3771Au\377ho\206\377" \
+  "www\377\203\0\0\0\377\6\7\7\7\377bbb\377\216\216\217\377\202\204\212" \
+  "\377\206\206\206\377,,-\377\203\0\0\0\377\6""222\377\210\211\213\377" \
+  "\32+e\377)8l\377mmm\377\14\14\14\377\203\0\0\0\377\5\7\7\7\377jjj\377" \
+  "\212\212\212\377[[[\377\7\7\7\377\204\0\0\0\377\4\27\27\27\377zzz\377" \
+  "\206\206\206\377/00\377\204\0\0\0\377\1fff\377\203,<r\377\1%6m\377\234" \
+  "\31*e\377\2\30)d\377\36.h\377\202(8o\377\202'7o\377\1&6o\377\205'7o\377" \
+  "\2\36.i\377\30)d\377\234\31*e\377\204GU\204\377\3FU\204\377GU\204\377" \
+  "HU\204\377\202GT\203\377\3,;r\377\27)d\377\30)d\377\205\31*e\377\3\31" \
+  "*d\377\26'c\3778Gy\377\202IV\205\377\1HU\205\377\202IV\205\377\202JW" \
+  "\206\377\1IV\205\377\206JW\206\377\4IV\206\377JW\206\377KX\206\377JW" \
+  "\206\377\207KX\206\377\202JW\205\377\3KX\206\377LY\207\377KX\206\377" \
+  "\215LY\207\377\202LZ\207\377\1LY\207\377\246LZ\207\377\1LY\207\377\203" \
+  "LZ\207\377\202LY\207\377\202LX\207\377\210LY\207\377\2KX\206\377LY\207" \
+  "\377\202KX\206\377\1JW\205\377\207KX\206\377\1JW\206\377\202KX\206\377" \
+  "\1IV\206\377\207JW\206\377\12IV\205\377JW\206\377IV\205\377HU\204\377" \
+  "IV\205\377HU\204\377IV\205\377GT\204\377\37/h\377\30)d\377\203\31*e\377" \
+  "\3/=m\377\201\203\212\377\14\14\14\377\203\0\0\0\377\2\202\202\202\377" \
+  "OOO\377\203\0\0\0\377\10\212\212\212\377\216\220\225\377RRR\377\2\2\2" \
+  "\377\0\0\0\377\10\10\10\377ppp\377===\377\203\0\0\0\377\2FFF\377\210" \
+  "\212\221\377\202FT\203\377\3ES\203\377\210\212\217\377333\377\203\0\0" \
+  "\0\377\5OPP\377jr\216\377DR\202\377aj\207\377ttt\377\204\0\0\0\377\10" \
+  "EEE\377\220\221\222\377FQv\377Ya}\377GQv\3776Cp\377\222\222\222\377\13" \
+  "\13\13\377\203\0\0\0\377\7sss\377\\d\200\377\33+d\377:Iz\377fn\212\377" \
+  "lll\377\11\11\11\377\202\0\0\0\377\6!!!\377\202\202\203\377DR\200\377" \
+  "Wb\206\377ccc\377\1\1\1\377\202\0\0\0\377\6###\377sw\201\377CP\200\377" \
+  "^g\207\377jjj\377\5\5\5\377\202\0\0\0\377\7\37\37\37\377\205\205\205" \
+  "\377OZ\203\377CQ\200\377ER\200\377\203\207\224\377EEE\377\203\0\0\0\377" \
+  "\5@@@\377\206\210\220\377)8l\377oqx\377\13\13\13\377\202\0\0\0\377\11" \
+  "\15\15\15\377fff\377\213\213\213\377\214\214\214\377\216\216\216\377" \
+  "\216\216\217\377lq\203\377CNw\377;I|\377\202=K}\377\3_h\210\377ZZZ\377" \
+  "\3\3\3\377\202\0\0\0\377\10&&&\377zzz\377\213\213\213\377\215\215\215" \
+  "\377\216\216\216\377\212\213\216\377ms\210\377GT\177\377\204;J|\377\3" \
+  ":I{\377;J|\3779Hz\377\203:I{\377\4""6Fx\377\37""0i\377Xa\200\377BBB\377" \
+  "\204\0\0\0\377\1\2\2\2\377\205\3\3\3\377\7\0\0\0\377aaa\377JTw\377\31" \
+  "*e\377Zc\200\377HHH\377\1\1\1\377\203\0\0\0\377\10]]]\377\216\220\224" \
+  "\377]e\204\377ho\206\377Wa\202\377FR}\377www\377\17\17\17\377\202\0\0" \
+  "\0\377\7\23\23\23\377{{{\377T^\201\3779Gy\3779Hy\377y~\216\377^^^\377" \
+  "\203\0\0\0\377\5%&&\377\217\220\224\3776Cp\377}\177\204\377\13\13\13" \
+  "\377\203\0\0\0\377\2\203\203\203\377^f\177\377\202\31*e\377\2bi\201\377" \
+  "\205\205\205\377\203\0\0\0\377\4\7\7\7\377\205\210\217\377FQu\377\216" \
+  "\220\226\377\204\0\0\0\377\6RRS\377\214\216\225\377KV}\377sw\211\377" \
+  "\221\221\221\377\12\12\12\377\203\0\0\0\377\5""111\377pw\215\3771Au\377" \
+  "\213\214\220\377@@@\377\203\0\0\0\377\7...\377\220\222\227\377.<m\377" \
+  "\31*e\377fm\203\377ooo\377\13\13\13\377\202\0\0\0\377\6\16\16\16\377" \
+  "{{{\3773@n\377(7k\377mmm\377\14\14\14\377\203\0\0\0\377\5aaa\377\212" \
+  "\213\217\377LVx\377\215\216\223\377111\377\203\0\0\0\377\6\2\2\2\377" \
+  "\210\210\210\377\177\202\215\377gm\205\377\222\222\222\377\12\12\12\377" \
+  "\203\0\0\0\377\5SSS\377,<r\377+;q\377,<r\377#3l\377\234\31*e\377\2\30" \
+  ")d\377\40""0i\377\203(8o\377\1&6o\377\204'7o\377\4&6n\377'7o\377\34-" \
+  "f\377\30)d\377\234\31*e\377\205GU\204\377\1FU\204\377\202GU\204\377\4" \
+  "HU\204\377AO\200\377\37""0i\377\30)d\377\206\31*e\377\7\30)d\377\31)" \
+  "d\377=L}\377JW\206\377HU\204\377IV\205\377HU\204\377\202IV\205\377\210" \
+  "JW\206\377\4IV\206\377JW\206\377KX\206\377JW\206\377\210KX\206\377\2" \
+  "JW\205\377KX\206\377\202LY\207\377\1KX\206\377\210LY\207\377\203LX\207" \
+  "\377\202LY\207\377\246LZ\207\377\2LY\207\377LZ\207\377\203LY\207\377" \
+  "\202LX\207\377\211LY\207\377\2KX\206\377LY\207\377\202KX\206\377\1JW" \
+  "\205\377\211KX\206\377\202JW\206\377\1IV\206\377\206JW\206\377\4IV\205" \
+  "\377JW\206\377IV\205\377HU\204\377\203IV\205\377\3HU\204\377)8p\377\30" \
+  ")d\377\204\31*e\377\3\"1h\377\200\204\222\377\"\"\"\377\203\0\0\0\377" \
+  "\2:::\377\26\26\26\377\202\0\0\0\377\5\30\30\30\377\225\225\227\377h" \
+  "p\214\377sss\377\11\11\11\377\202\0\0\0\377\2""333\377\22\22\22\377\203" \
+  "\0\0\0\377\7jjj\377sy\214\377FT\203\377ES\203\377DR\203\377\210\212\217" \
+  "\377333\377\203\0\0\0\377\5OPP\377jr\216\377DR\202\377aj\207\377ttt\377" \
+  "\203\0\0\0\377\4\11\11\11\377kkk\377LW{\377\30)d\377\202\31*e\377\2B" \
+  "Mu\377\204\204\204\377\204\0\0\0\377\7www\377yz|\377yy{\377zz|\377z{" \
+  "}\377```\377\14\14\14\377\202\0\0\0\377\6\16\16\16\377{{{\377HU\201\377" \
+  "Wa\206\377ccc\377\1\1\1\377\202\0\0\0\377\5###\377sw\201\377BP\200\377" \
+  "ho\211\377YYY\377\203\0\0\0\377\7$$$\377yyz\377yz|\377zz|\377yz|\377" \
+  "\177\200\200\377GGG\377\203\0\0\0\377\5\32\33\33\377\220\221\224\377" \
+  "(7j\377\204\207\221\377000\377\205\0\0\0\377\13\26\26\26\377)**\377C" \
+  "CC\377eee\377\200\200\200\377\203\205\216\377MY\201\377=K}\377S^\203" \
+  "\377\201\201\201\377\30\30\30\377\204\0\0\0\377\10\11\11\11\377\35\35" \
+  "\35\377111\377LLL\377ooo\377\206\206\206\377uz\214\377BP~\377\203;J|" \
+  "\377\2:I{\3779Hz\377\203:I{\377\4""4Cw\377\32*e\377Xa\200\377BBB\377" \
+  "\204\0\0\0\377\2===\377SST\377\204RRS\377\7OOP\377~~~\377ITw\377\31*" \
+  "e\377Zc\200\377HHH\377\1\1\1\377\202\0\0\0\377\10\3\3\3\377\216\216\216" \
+  "\377W`\202\3778Fz\3776Fx\3777Fy\377U_\202\377fff\377\203\0\0\0\377\7" \
+  "\32\32\32\377qqq\377xy{\377zz{\377yz{\377|}~\377ZZ[\377\203\0\0\0\377" \
+  "\5\1\1\1\377\222\223\226\377NXz\377fgh\377\7\7\7\377\202\0\0\0\377\3" \
+  "\15\15\15\377rrr\377xx{\377\202yy{\377\2wx{\377vvv\377\203\0\0\0\377" \
+  "\4\2\2\2\377opu\377]e\201\377}\177\203\377\204\0\0\0\377\6\204\204\204" \
+  "\377]e\203\3772Av\3771Au\377\213\214\220\377999\377\203\0\0\0\377\5""1" \
+  "11\377ov\215\3771Au\377\223\223\223\377\32\32\32\377\203\0\0\0\377\2" \
+  "\\\\\\\377^f\202\377\202\31*e\377\3&5j\377\177\200\203\377\32\32\32\377" \
+  "\203\0\0\0\377\5ooo\377EPu\377'6k\377mmm\377\14\14\14\377\202\0\0\0\377" \
+  "\7\14\14\14\377yyy\3777Dp\377\31*e\377Zc\201\377JJJ\377\1\1\1\377\202" \
+  "\0\0\0\377\2'''\377\216\216\216\377\2020\77s\377\2\206\212\225\377\34" \
+  "\34\34\377\203\0\0\0\377\1TTT\377\203,<r\377\2!1j\377\30)d\377\233\31" \
+  "*e\377\2\30)d\377#3k\377\203(8o\377\1&6o\377\206'7o\377\1\32+f\377\235" \
+  "\31*e\377\206GU\204\377\1FU\204\377\202GU\204\377\2IV\204\3777Fy\377" \
+  "\210\31*e\377\12\30)d\377\36/h\377AN\177\377JW\205\377HU\204\377IV\205" \
+  "\377HU\204\377IV\205\377JW\206\377IV\205\377\207JW\206\377\4IV\206\377" \
+  "JW\206\377KX\206\377JW\206\377\210KX\206\377\1JW\205\377\202KX\206\377" \
+  "\214LY\207\377\202LX\207\377\202LY\207\377\203LZ\207\377\1LY\207\377" \
+  "\235LZ\207\377\1LY\207\377\203LZ\207\377\202LY\207\377\202LX\207\377" \
+  "\212LY\207\377\2KX\206\377LY\207\377\202KX\206\377\1JW\205\377\210KX" \
+  "\206\377\203JW\206\377\1IV\206\377\206JW\206\377\4IV\205\377JW\206\377" \
+  "IV\205\377HU\204\377\202IV\205\377\5HU\204\377IU\204\3773Av\377\31*e" \
+  "\377\30)d\377\205\31*e\377\2ou\211\377JJJ\377\207\0\0\0\377\5III\377" \
+  "\211\213\222\377P\\\206\377\210\212\220\377\22\22\22\377\207\0\0\0\377" \
+  "\2\200\200\200\377^g\210\377\202ES\203\377\3DR\203\377\210\212\217\377" \
+  "333\377\203\0\0\0\377\5OPP\377iq\216\377DR\202\377aj\207\377ttt\377\203" \
+  "\0\0\0\377\4\22\22\22\377xy{\377+:l\377\30)d\377\202\31*e\377\2FQw\377" \
+  "qqq\377\204\0\0\0\377\205\20\20\20\377\1\6\6\6\377\204\0\0\0\377\5ss" \
+  "s\377O[\203\377Va\205\377ccc\377\1\1\1\377\202\0\0\0\377\5###\377sw\201" \
+  "\377BP\200\377fm\207\377PPP\377\203\0\0\0\377\2\5\5\5\377\17\17\17\377" \
+  "\203\20\20\20\377\1\21\21\21\377\204\0\0\0\377\7\5\5\5\377\220\222\225" \
+  "\377\32+e\377V_|\377\211\211\211\377:::\377\15\15\15\377\207\0\0\0\377" \
+  "\11\27\27\27\377eee\377\207\210\216\377AN~\377AO~\377~\202\220\377pp" \
+  "p\377(((\377\4\4\4\377\207\0\0\0\377\3(((\377yyy\377rx\213\377\203;J" \
+  "|\377\1""9Hz\377\203:I{\377\5""9Hz\377.>s\377\27(c\377Ya\200\377BBB\377" \
+  "\204\0\0\0\377\3ppp\377ou\212\377PZ}\377\204S\\~\377\6Q[{\377.<l\377" \
+  "\31*e\377Zb\200\377HHH\377\1\1\1\377\202\0\0\0\377\10!!!\377\216\216" \
+  "\216\3777Fy\3778Fz\3776Fx\3777Fy\377Xa\203\377___\377\203\0\0\0\377\2" \
+  "\4\4\4\377\16\16\16\377\203\20\20\20\377\2\21\21\21\377\1\1\1\377\204" \
+  "\0\0\0\377\4\213\214\216\377Xa\177\377\\\\^\377\5\5\5\377\202\0\0\0\377" \
+  "\2\3\3\3\377\16\16\16\377\204\20\20\20\377\1\7\7\7\377\204\0\0\0\377" \
+  "\3`ae\377cj\204\377sty\377\204\0\0\0\377\2\224\225\225\377EQ{\377\202" \
+  "2Av\377\2uy\211\377FFF\377\203\0\0\0\377\5""111\377ov\215\3775Dv\377" \
+  "\222\222\222\377\16\16\16\377\203\0\0\0\377\2ggi\377JUy\377\202\31*e" \
+  "\377\3\"2h\377sw\205\377\40\40\40\377\203\0\0\0\377\5hhh\377JTw\377&" \
+  "6k\377mmm\377\14\14\14\377\202\0\0\0\377\7\23\23\23\377{{{\377\34-f\377" \
+  "\31*e\377OY|\377KKK\377\1\1\1\377\202\0\0\0\377\2///\377}\177\210\377" \
+  "\202-<r\377\2\177\203\222\377\35\35\35\377\203\0\0\0\377\1TTT\377\202" \
+  ",<r\377\3+;q\377\37""0i\377\30)d\377\233\31*e\377\2\30)d\377%5m\377\203" \
+  "(8o\377\1&6o\377\205'7o\377\2%5n\377\32+e\377\235\31*e\377\206GU\204" \
+  "\377\7FU\204\377GU\204\377HT\203\377HU\204\377IV\205\377+:q\377\27)d" \
+  "\377\207\31*e\377\3\30)d\377$4l\377ER\202\377\203IV\205\377\4HU\204\377" \
+  "IV\205\377JW\206\377IV\205\377\206JW\206\377\202IV\206\377\3JW\206\377" \
+  "KX\206\377JW\206\377\207KX\206\377\203JW\205\377\3KX\206\377LY\207\377" \
+  "KX\206\377\212LY\207\377\203LX\207\377\203LY\207\377\202LZ\207\377\1" \
+  "LY\207\377\230LZ\207\377\1LY\207\377\203LZ\207\377\203LY\207\377\202" \
+  "LX\207\377\212LY\207\377\1KX\206\377\202LY\207\377\1KX\206\377\202JW" \
+  "\205\377\210KX\206\377\4JW\206\377KX\206\377JW\206\377IV\206\377\210" \
+  "JW\206\377\2IV\205\377HU\204\377\202IV\205\377\5HU\204\377IV\205\377" \
+  "<J|\377\31*e\377\30)d\377\206\31*e\377\2V_}\377llm\377\207\0\0\0\377" \
+  "\5www\377pw\214\377GU\204\377\206\212\226\377444\377\206\0\0\0\377\10" \
+  "\30\30\30\377\207\207\207\377JW\204\377ES\203\377DR\203\377ES\203\377" \
+  "\210\212\217\377333\377\203\0\0\0\377\5OPP\377hq\215\377CQ\201\377bj" \
+  "\210\377ttt\377\203\0\0\0\377\4\26\26\26\377tv\200\377&5j\377\30)d\377" \
+  "\202\31*e\377\2FQw\377zzz\377\204\0\0\0\377\202OOO\377\204PPP\377\202" \
+  "RRR\377\7QQQ\377SSS\377\205\205\205\377O[\203\377Va\205\377ccc\377\1" \
+  "\1\1\377\202\0\0\0\377\5###\377sw\201\377BP\200\377fn\210\377SSS\377" \
+  "\203\0\0\0\377\2\30\30\30\377NNN\377\204PPP\377\1QQQ\377\202RRR\377\14" \
+  "QQQ\377VVV\377\221\222\223\377\32+e\377\34-f\377S\\{\377\211\212\215" \
+  "\377zzz\377fff\377III\377+++\377\17\17\17\377\204\0\0\0\377\14\11\11" \
+  "\11\377\202\202\202\377bj\206\377=K}\377GS\177\377w}\216\377\207\207" \
+  "\207\377ttt\377]]]\377\77\77\77\377###\377\5\5\5\377\204\0\0\0\377\3" \
+  "+++\377\211\211\211\377@N}\377\202;J|\377\1""9Hz\377\203:I{\377\5""9" \
+  "Hz\377%5m\377\27)d\377Ya\200\377BBB\377\204\0\0\0\377\2lll\377HRx\377" \
+  "\207\31*e\377\4\30)d\377Zb\200\377HHH\377\1\1\1\377\202\0\0\0\377\10" \
+  "...\377\204\205\213\3778Fz\3777Fy\3776Fx\3777Fy\377Xa\203\377ccc\377" \
+  "\203\0\0\0\377\2\22\22\22\377GGH\377\204PPP\377\1QQQ\377\203RRR\377\5" \
+  "NNN\377\216\216\217\377Xa\177\377bbd\377\6\6\6\377\202\0\0\0\377\3\13" \
+  "\13\13\377FFG\377OOO\377\204PPP\377\203RRR\377\4SSS\377z{|\377bi\202" \
+  "\377~\200\204\377\204\0\0\0\377\2\217\220\220\377MW~\377\2022Av\377\2" \
+  "\201\204\215\377BBB\377\203\0\0\0\377\5""111\377ov\215\3775Ev\377\222" \
+  "\222\222\377\21\21\21\377\203\0\0\0\377\2dde\377PZ|\377\202\31*e\377" \
+  "\3$4i\377xz\204\377\34\34\34\377\203\0\0\0\377\5lll\377ITw\377&6k\377" \
+  "mmm\377\14\14\14\377\202\0\0\0\377\7\23\23\23\377wwy\377\36.g\377\31" \
+  "*e\377NY|\377KKK\377\1\1\1\377\202\0\0\0\377\2///\377x{\207\377\202-" \
+  "<r\377\2\177\203\223\377\35\35\35\377\203\0\0\0\377\1TTT\377\202,<r\377" \
+  "\3*:p\377\35.h\377\30)d\377\232\31*e\377\2\30*e\377\30)d\377\204(8o\377" \
+  "\1&6o\377\205'7o\377\1$4m\377\236\31*e\377\2GU\204\377FT\203\377\207" \
+  "GU\204\377\202HU\204\377\3IU\205\377\40""1j\377\30)d\377\206\31*e\377" \
+  "\6\31*d\377\27(d\377,<r\377GT\204\377IV\205\377HU\204\377\203IV\205\377" \
+  "\202JW\206\377\1IV\205\377\206JW\206\377\202IV\206\377\3JW\206\377KX" \
+  "\206\377JW\206\377\210KX\206\377\2JW\205\377KX\206\377\220LY\207\377" \
+  "\203LX\207\377\204LY\207\377\213LZ\207\377\1LY\207\377\206LZ\207\377" \
+  "\205LY\207\377\203LX\207\377\214LY\207\377\1KX\206\377\202LY\207\377" \
+  "\1KX\206\377\202JW\205\377\211KX\206\377\202JW\206\377\1IV\206\377\212" \
+  "JW\206\377\1IV\205\377\202HU\204\377\202IV\205\377\3BP\200\377\32*e\377" \
+  "\30)d\377\206\31*e\377\3\30)d\377<Hr\377\216\216\220\377\206\0\0\0\377" \
+  "\6\16\16\16\377\207\207\207\377Wb\207\377GU\204\377u{\220\377```\377" \
+  "\206\0\0\0\377\4""333\377\205\206\213\377ES\203\377DR\203\377\202ES\203" \
+  "\377\2\210\212\217\377333\377\203\0\0\0\377\5OPP\377hq\215\377DR\202" \
+  "\377bj\210\377ttt\377\203\0\0\0\377\3\30\30\30\377os\200\377#3h\377\203" \
+  "\31*e\377\2:Fq\377\221\221\221\377\204\0\0\0\377\6\203\203\204\377uz" \
+  "\210\377jq\210\377lr\210\377jq\210\377ip\210\377\202ip\207\377\7jp\207" \
+  "\377jq\207\377ou\212\377HU\201\377V`\206\377ccc\377\1\1\1\377\202\0\0" \
+  "\0\377\5###\377sw\201\377BP\200\377em\211\377aaa\377\203\0\0\0\377\3" \
+  "&&&\377\211\211\211\377ms\210\377\202kq\207\377\7ho\206\377gn\206\377" \
+  "fl\205\377Ya}\377V^z\377W_{\377V_|\377\203\31*e\377\4+:l\377X`}\377\203" \
+  "\205\214\377\204\206\213\377\202\215\215\215\377\2{{{\377\33\34\34\377" \
+  "\203\0\0\0\377\15WWW\377pv\212\377=K}\377<K}\377@N}\377P[\202\377qw\212" \
+  "\377\216\216\221\377\206\210\215\377\215\215\215\377\213\213\213\377" \
+  "ddd\377\11\11\11\377\202\0\0\0\377\6\4\4\4\377}}}\377O[\201\377;J|\377" \
+  ":I{\3779Hz\377\203:I{\377\5""9Hz\377\33-g\377\30)d\377Ya\200\377BBB\377" \
+  "\204\0\0\0\377\2lll\377JTx\377\207\31*e\377\4\30)d\377]e\202\377HHH\377" \
+  "\1\1\1\377\202\0\0\0\377\3""444\377|\177\211\3778Fz\377\2037Fy\377\3" \
+  "OZ\200\377nnn\377\7\7\7\377\202\0\0\0\377\17\33\33\33\377\201\201\201" \
+  "\377kq\206\377gm\204\377fm\204\377dk\203\377ai\202\377Y`|\377U]z\377" \
+  "V^z\377W_{\377V_|\377FQw\377qrv\377\11\11\11\377\202\0\0\0\377\6\11\11" \
+  "\11\377\204\204\204\377mr\203\377X`{\377Za|\377W_{\377\202U]z\377\202" \
+  "V^z\377\4W_{\377T\\z\377DOu\377\220\222\227\377\204\0\0\0\377\6qqr\377" \
+  "uz\213\3772Av\377GS|\377\223\223\223\377%%%\377\203\0\0\0\377\5""111" \
+  "\377pw\215\3771Au\377\221\222\222\377---\377\203\0\0\0\377\7GGG\377t" \
+  "y\213\377\35-f\377\31*e\377:Gr\377|||\377\23\23\23\377\202\0\0\0\377" \
+  "\6\5\5\5\377vvv\3779Eq\377'6k\377mmm\377\14\14\14\377\202\0\0\0\377\7" \
+  "\23\23\23\377wxy\377\36.g\377\31*e\377NY|\377KKK\377\1\1\1\377\202\0" \
+  "\0\0\377\2///\377y|\207\377\202-<r\377\2\177\203\223\377\35\35\35\377" \
+  "\203\0\0\0\377\1TTT\377\202,<r\377\3)9p\377\33,g\377\30)d\377\232\31" \
+  "*e\377\2\30)d\377\33,f\377\202(8o\377\3'7o\377(8o\377&6o\377\205'7o\377" \
+  "\1\"3k\377\236\31*e\377\1FT\203\377\207GU\204\377\7FU\204\377GU\204\377" \
+  "HT\203\377HU\204\377AO\177\377\35.g\377\30)d\377\206\31*e\377\3\30)d" \
+  "\377\26'c\3770@t\377\202IV\205\377\3HU\204\377IV\205\377HU\204\377\202" \
+  "IV\205\377\211JW\206\377\4IV\206\377JW\206\377KX\206\377JW\206\377\210" \
+  "KX\206\377\1JW\205\377\202KX\206\377\202LY\207\377\1KX\206\377\216LY" \
+  "\207\377\204LX\207\377\207LY\207\377\205LZ\207\377\207LY\207\377\204" \
+  "LX\207\377\215LY\207\377\1KX\206\377\202LY\207\377\202KX\206\377\1JW" \
+  "\205\377\211KX\206\377\3JW\206\377KX\206\377JW\206\377\202IV\206\377" \
+  "\207JW\206\377\12IV\205\377JW\206\377IV\205\377HU\204\377IV\205\377H" \
+  "U\204\377JW\205\377AO\200\377\35-g\377\30)d\377\207\31*e\377\4\30)d\377" \
+  "5Bt\377\223\224\227\377\30\30\30\377\205\0\0\0\377\6""000\377\213\213" \
+  "\213\377GU\204\377FT\203\377ak\212\377\211\212\214\377\206\0\0\0\377" \
+  "\3MMM\377w|\214\377DR\203\377\203ES\203\377\2\210\212\217\377333\377" \
+  "\203\0\0\0\377\5OPP\377iq\216\377DR\202\377bj\210\377ttt\377\203\0\0" \
+  "\0\377\3\33\33\33\377vz\207\377$3i\377\203\31*e\377\3\"2h\377\221\221" \
+  "\222\377)))\377\203\0\0\0\377\17WWW\377\177\203\220\377JV\202\377BP\200" \
+  "\377rx\213\377\217\217\217\377\214\214\214\377\206\210\214\377{\177\212" \
+  "\377v{\212\377ip\211\377BP\200\377Wb\206\377ccc\377\1\1\1\377\202\0\0" \
+  "\0\377\6###\377sw\201\377CQ\200\377R]\203\377yyy\377\21\21\21\377\202" \
+  "\0\0\0\377\27\22\22\22\377yyy\377ls\212\377\77M~\377KW\201\377\203\205" \
+  "\216\377\215\215\215\377\213\213\214\377}\177\210\377ot\203\377fl\201" \
+  "\377FQv\377S\\{\377\215\215\216\377\215\215\215\377\214\214\214\377\212" \
+  "\212\212\377\214\214\214\377\177\201\212\377\31*e\3774Ao\377{\177\214" \
+  "\377mmm\377\203\0\0\0\377\15QQQ\377sx\213\377y}\213\377\217\217\217\377" \
+  "\214\214\214\377\213\213\213\377\212\212\212\377\216\216\216\377fn\207" \
+  "\377>M}\377]f\205\377\223\224\231\377555\377\202\0\0\0\377\4\2\2\2\377" \
+  "|||\377O[\201\377;J|\377\205:I{\377\5""5Dw\377\26'c\377\31*e\377Ya\200" \
+  "\377BBB\377\204\0\0\0\377\2lll\377JTx\377\207\31*e\377\4\27(d\377bi\205" \
+  "\377HHH\377\1\1\1\377\202\0\0\0\377\3>>>\377|\177\212\3778Fz\377\203" \
+  "7Fy\377\3\77M{\377\203\203\203\377\34\34\34\377\202\0\0\0\377\17\7\7" \
+  "\7\377mmm\377uz\212\3777Fx\377=Kz\377z~\214\377\215\215\215\377\214\214" \
+  "\214\377}\200\210\377rv\204\377in\202\377T]{\377&5j\377\206\210\221\377" \
+  "\30\30\30\377\203\0\0\0\377\16kkk\377\201\203\214\377\37/g\377\32+e\377" \
+  "lr\205\377\216\216\216\377\214\214\214\377\177\201\210\377vy\205\377" \
+  "fl\200\377QZz\377,:n\377\214\216\225\377(((\377\203\0\0\0\377\5\"\"\"" \
+  "\377\222\222\222\377~\201\213\377\216\216\220\377nno\377\204\0\0\0\377" \
+  "\5""111\377pw\215\3770@u\377z~\213\377```\377\203\0\0\0\377\6\25\25\25" \
+  "\377\211\211\211\377fl\202\377ISw\377\216\216\221\377RRR\377\203\0\0" \
+  "\0\377\6###\377\206\206\206\377\40""0g\377)8k\377mmm\377\14\14\14\377" \
+  "\202\0\0\0\377\7\23\23\23\377wxy\377\36.g\377\31*e\377NY|\377KKK\377" \
+  "\1\1\1\377\202\0\0\0\377\2///\377y|\207\377\202-<r\377\2\177\203\223" \
+  "\377\35\35\35\377\203\0\0\0\377\1TTT\377\202,<r\377\3(8o\377\31*e\377" \
+  "\30)d\377\232\31*e\377\2\30)d\377\35.g\377\203(8o\377\2'7o\377&6o\377" \
+  "\205'7o\377\1\40""1j\377\236\31*e\377\3FT\203\377GU\204\377FT\203\377" \
+  "\205GU\204\377\1FU\204\377\202GU\204\377\5GT\203\377HU\204\3777Fy\377" \
+  "\32+f\377\30)d\377\206\31*e\377\202\30)d\377\11/>t\377KW\206\377IV\205" \
+  "\377HU\204\377IV\205\377HU\204\377IV\205\377JW\206\377IV\205\377\207" \
+  "JW\206\377\1IV\206\377\202JW\206\377\2KX\206\377JW\206\377\210KX\206" \
+  "\377\202JW\205\377\202KX\206\377\202LY\207\377\1KX\206\377\220LY\207" \
+  "\377\207LX\207\377\205LY\207\377\207LX\207\377\220LY\207\377\2KX\206" \
+  "\377LY\207\377\202KX\206\377\202JW\205\377\211KX\206\377\4JW\206\377" \
+  "KX\206\377JW\206\377IV\206\377\207JW\206\377\1IV\205\377\202JW\206\377" \
+  "\2IV\205\377HU\204\377\203IV\205\377\3CP\201\377\"2k\377\30)d\377\207" \
+  "\31*e\377\5\30)d\377!1j\377DQ\201\377\214\216\224\377@@@\377\205\0\0" \
+  "\0\377\2SSS\377y}\215\377\202GU\204\377\3NZ\204\377\224\225\231\377\34" \
+  "\34\34\377\204\0\0\0\377\3\2\2\2\377bbb\377go\213\377\204ES\203\377\2" \
+  "\210\212\217\377333\377\203\0\0\0\377\5OPP\377iq\216\377DR\202\377bj" \
+  "\210\377ttt\377\203\0\0\0\377\3\33\33\33\377vz\207\377$3i\377\204\31" \
+  "*e\377\2sx\207\377ooo\377\203\0\0\0\377\17\20\20\20\377sss\377\202\203" \
+  "\210\377\201\202\210\377yyy\377666\377\37\37\37\377111\377\77\77\77\377" \
+  "uuu\377\210\212\221\377CQ\200\377Wb\206\377ccc\377\1\1\1\377\202\0\0" \
+  "\0\377\6###\377sw\201\377CQ\200\377FS\201\377\212\213\222\377<<<\377" \
+  "\203\0\0\0\377\26""444\377~~~\377\201\203\211\377\204\204\207\377lll" \
+  "\377\40\40\40\377$$$\377555\377HHH\377\215\215\215\377lq\204\377[c\177" \
+  "\377fff\377\36\36\36\377\20\20\20\377\0\0\0\377\21\21\21\377www\377\177" \
+  "\202\214\377dk\204\377\205\206\214\377JJJ\377\203\0\0\0\377\15uuu\377" \
+  "jq\210\377\201\203\214\377NNN\377\26\26\26\377\12\12\12\377\0\0\0\377" \
+  "///\377\206\206\206\377x}\216\377w|\216\377\206\207\210\377\"\"\"\377" \
+  "\202\0\0\0\377\4\33\33\33\377\205\205\205\377DQ}\377;J|\377\204:I{\377" \
+  "\6;J{\377(8p\377\27(d\377\31*e\377Ya\200\377BBB\377\204\0\0\0\377\2l" \
+  "ll\377JTx\377\206\31*e\377\5\30)d\377\27(c\377fm\210\377HHH\377\1\1\1" \
+  "\377\202\0\0\0\377\2>>>\377|\177\212\377\2047Fy\377\3;Iz\377~\202\220" \
+  "\377OOO\377\203\0\0\0\377\16(((\377yyy\377\202\204\210\377\200\202\207" \
+  "\377uuu\377###\377$$$\377222\377@@@\377\206\206\206\377\207\210\216\377" \
+  "\31*e\377ms\207\377eee\377\203\0\0\0\377\16\21\21\21\377www\377\203\204" \
+  "\207\377~\200\206\377~~~\377--.\377\40\40\40\377...\377;;;\377{{{\377" \
+  "\203\205\216\377+:o\377z~\215\377mmm\377\204\0\0\0\377\6\"\"\"\377WW" \
+  "W\377CCC\377\0\0\0\377$$$\377\4\4\4\377\202\0\0\0\377\6""111\377pw\215" \
+  "\3770@u\377MY}\377\210\210\210\377\40\40\40\377\203\0\0\0\377\5)**\377" \
+  "mmm\377ttt\377UUU\377\7\7\7\377\202\0\0\0\377\7\2\2\2\377\\\\\\\377o" \
+  "u\207\377\31*e\377)8l\377mmm\377\14\14\14\377\202\0\0\0\377\7\23\23\23" \
+  "\377wxy\377\36.g\377\31*e\377NY|\377KKK\377\1\1\1\377\202\0\0\0\377\2" \
+  "///\377y|\207\377\202-<r\377\2\177\203\223\377\35\35\35\377\203\0\0\0" \
+  "\377\4TTT\377,<r\377+;r\377&6n\377\202\30)d\377\232\31*e\377\2\30)d\377" \
+  "\40""0i\377\203(8o\377\205'7o\377\4&6n\377'7o\377\37/i\377\30)d\377\235" \
+  "\31*e\377\202FT\203\377\2GU\204\377FT\203\377\205GU\204\377\202FU\204" \
+  "\377\1GU\204\377\202HU\204\377\1-=r\377\210\31*e\377\4\30)d\377\32+e" \
+  "\3772Av\377JW\205\377\203IV\205\377\4HU\204\377IV\205\377JW\206\377I" \
+  "V\205\377\207JW\206\377\1IV\206\377\202JW\206\377\2KX\206\377JW\206\377" \
+  "\211KX\206\377\1JW\205\377\203KX\206\377\2LY\207\377KX\206\377\226LY" \
+  "\207\377\205LX\207\377\225LY\207\377\1KX\206\377\202LY\207\377\202KX" \
+  "\206\377\202JW\205\377\210KX\206\377\1JW\206\377\202KX\206\377\2JW\206" \
+  "\377IV\206\377\207JW\206\377\2IV\205\377JW\206\377\202IV\205\377\1HU" \
+  "\204\377\202IV\205\377\3HU\204\377FS\203\377#4l\377\202\30)d\377\206" \
+  "\31*e\377\6\30)d\377\32*f\377BP\200\377HU\204\377x|\216\377fff\377\204" \
+  "\0\0\0\377\10\6\6\6\377mmm\377cl\212\377GU\204\377FT\203\377ES\202\377" \
+  "\206\211\222\377OOO\377\204\0\0\0\377\4\16\16\16\377ttt\377U`\207\377" \
+  "DR\203\377\203ES\203\377\2\210\212\217\377333\377\203\0\0\0\377\5OPP" \
+  "\377iq\216\377DR\202\377bj\210\377ttt\377\203\0\0\0\377\3\33\33\33\377" \
+  "vz\207\377$3i\377\204\31*e\377\3-;l\377\215\215\216\377JJJ\377\203\0" \
+  "\0\0\377\4\12\12\12\377000\377222\377\23\23\23\377\203\0\0\0\377\7))" \
+  ")\377\203\203\203\377bk\210\377BP\200\377Va\206\377ccc\377\1\1\1\377" \
+  "\202\0\0\0\377\7###\377sw\201\377CQ\200\377AO\200\377em\211\377\206\206" \
+  "\206\377&&&\377\203\0\0\0\377\4\31\31\31\377444\377,,,\377\6\6\6\377" \
+  "\203\0\0\0\377\6MMM\377\212\213\215\3770>m\377>Js\377\205\205\205\377" \
+  "\34\34\34\377\203\0\0\0\377\5\30\30\30\377CCC\377LLL\377777\377\3\3\3" \
+  "\377\202\0\0\0\377\6;;;\377\216\216\216\377KV\200\377mt\213\377mmm\377" \
+  "\6\6\6\377\203\0\0\0\377\4)))\377HHH\377III\377$$$\377\202\0\0\0\377" \
+  "\6\1\1\1\377]]]\377\201\204\215\377;J|\377:I{\3779Hz\377\202:I{\377\7" \
+  "9Hz\377<K|\377\34-g\377\30)d\377\31*e\377Ya\200\377BBB\377\204\0\0\0" \
+  "\377\2lll\377JTx\377\206\31*e\377\5\30)d\377\33,f\377ho\212\377HHH\377" \
+  "\1\1\1\377\202\0\0\0\377\4>>>\377|\177\212\3777Fy\3776Fx\377\2037Fy\377" \
+  "\3T^\201\377\214\215\216\377888\377\203\0\0\0\377\4\22\22\22\377222\377" \
+  "///\377\12\12\12\377\203\0\0\0\377\7""999\377\215\215\215\377>Js\377" \
+  "\31*e\3776Cp\377\222\223\225\377HHH\377\203\0\0\0\377\4\7\7\7\377111" \
+  "\377222\377\20\20\20\377\203\0\0\0\377\7())\377\212\212\212\377PYy\377" \
+  ".=s\377HS}\377\223\223\223\377000\377\206\0\0\0\377\3---\377ttt\377\2" \
+  "\2\2\377\202\0\0\0\377\7""000\377pw\215\3770@t\3771Av\377ns\206\377v" \
+  "vv\377\27\27\27\377\204\0\0\0\377\1\2\2\2\377\204\0\0\0\377\7III\377" \
+  "\212\213\217\3774Ao\377\31*e\377)8l\377mmm\377\14\14\14\377\202\0\0\0" \
+  "\377\7\23\23\23\377wxy\377\36.g\377\31*e\377NY|\377KKK\377\1\1\1\377" \
+  "\202\0\0\0\377\2///\377y|\207\377\202-<r\377\2\177\203\223\377\35\35" \
+  "\35\377\203\0\0\0\377\5TTT\377,<r\377+;q\377#3l\377\30)d\377\233\31*" \
+  "e\377\2\30)d\377#3k\377\203(8o\377\206'7o\377\3&6n\377\35.h\377\30)d" \
+  "\377\235\31*e\377\3FT\203\377ES\202\377FT\203\377\210GU\204\377\5FU\204" \
+  "\377HT\203\377HU\204\377IU\204\377%4m\377\202\30)d\377\206\31*e\377\6" \
+  "\30)d\377\31*e\3777Ey\377HU\204\377IV\205\377HU\204\377\203IV\205\377" \
+  "\202JW\206\377\1IV\205\377\211JW\206\377\215KX\206\377\202JW\205\377" \
+  "\203KX\206\377\2LY\207\377KX\206\377\250LY\207\377\1KX\206\377\202LY" \
+  "\207\377\203KX\206\377\1JW\205\377\212KX\206\377\1JW\206\377\202KX\206" \
+  "\377\1JW\206\377\202IV\206\377\207JW\206\377\4IV\205\377JW\206\377IV" \
+  "\205\377HU\204\377\202IV\205\377\5HU\204\377IV\205\377GT\204\377%5m\377" \
+  "\27(c\377\207\31*e\377\7\30)d\377\30)e\377=K|\377HU\204\377GT\203\377" \
+  "cl\211\377\204\204\204\377\204\0\0\0\377\10\22\22\22\377\200\200\200" \
+  "\377O\\\205\377GU\204\377FT\203\377ES\202\377mt\213\377~~~\377\204\0" \
+  "\0\0\377\3\24\24\24\377\200\201\205\377LY\205\377\204ES\203\377\2\210" \
+  "\212\217\377,,,\377\203\0\0\0\377\5LMM\377ir\216\377DR\202\377bj\210" \
+  "\377rrr\377\203\0\0\0\377\3\23\23\23\377vz\207\377$3i\377\205\31*e\377" \
+  "\4DOu\377\215\215\215\377]]]\377\30\30\30\377\206\0\0\0\377\10\20\20" \
+  "\20\377SSS\377\210\210\210\377rx\215\377CQ\200\377AO\200\377Va\206\377" \
+  "aaa\377\203\0\0\0\377\11\34\34\34\377sw\201\377CQ\200\377@N\177\377A" \
+  "O~\377w|\216\377\205\205\205\377III\377\10\10\10\377\206\0\0\0\377\12" \
+  "\40\40\40\377eee\377\215\215\216\377=Ir\377\31*e\377\35.f\377mr\206\377" \
+  "\202\202\202\377<<<\377\6\6\6\377\206\0\0\0\377\11\16\16\16\377QQQ\377" \
+  "\212\212\212\377dl\207\377=K}\377GT\200\377\206\210\220\377qqq\377((" \
+  "(\377\207\0\0\0\377\7\40\40\40\377ggg\377\213\214\216\377P\\\202\377" \
+  ";J|\377:I{\3779Hz\377\203:I{\377\2""5Ex\377\30)d\377\202\31*e\377\2Y" \
+  "b\201\377>>>\377\204\0\0\0\377\2kkk\377JTx\377\206\31*e\377\4\30)d\377" \
+  "!1j\377iq\213\377CCC\377\203\0\0\0\377\4""888\377|\177\212\3777Fy\377" \
+  "6Fx\377\2047Fy\377\4fm\207\377\214\214\214\377UUU\377\20\20\20\377\206" \
+  "\0\0\0\377\4\30\30\30\377[[[\377\215\215\215\377LVx\377\203\31*e\377" \
+  "\4DOu\377\221\221\221\377___\377\27\27\27\377\206\0\0\0\377\12\20\20" \
+  "\20\377RRR\377\212\212\212\377]e~\377\30)e\3773Bw\3772Av\377io\206\377" \
+  "\204\204\204\377222\377\204\0\0\0\377\3""9::\377\211\211\211\377uuu\377" \
+  "\203\0\0\0\377\11+++\377ov\215\3770@u\377.\77t\377'6k\377sx\210\377\177" \
+  "\177\177\377AAA\377\7\7\7\377\205\0\0\0\377\4#$$\377hhh\377\216\216\217" \
+  "\377GRw\377\202\31*e\377\3)8l\377kkk\377\3\3\3\377\202\0\0\0\377\6\12" \
+  "\12\12\377vwx\377\36.g\377\31*e\377NX|\377GGG\377\203\0\0\0\377\2)))" \
+  "\377y|\207\377\202-<r\377\2\177\203\223\377\27\27\27\377\203\0\0\0\377" \
+  "\5RRR\377,<r\377+;q\377\40""0j\377\30)d\377\232\31*e\377\202\30)d\377" \
+  "\2%6m\377(7n\377\202(8o\377\206'7o\377\3%6m\377\34-g\377\30)d\377\235" \
+  "\31*e\377\5FT\203\377ES\202\377FT\203\377GU\204\377FT\203\377\206GU\204" \
+  "\377\7FU\204\377GU\204\377HT\203\377HU\204\377FT\203\377#3k\377\27(d" \
+  "\377\207\31*e\377\10\30)d\377\31*e\3776Ex\377IW\205\377IV\205\377HU\204" \
+  "\377IV\205\377HU\204\377\202IV\205\377\211JW\206\377\1IV\206\377\202" \
+  "JW\206\377\2KX\206\377JW\206\377\213KX\206\377\202JW\205\377\202KX\206" \
+  "\377\203LY\207\377\1KX\206\377\243LY\207\377\1KX\206\377\202LY\207\377" \
+  "\202KX\206\377\203JW\205\377\212KX\206\377\2JW\206\377KX\206\377\202" \
+  "JW\206\377\1IV\206\377\210JW\206\377\4IV\205\377JW\206\377IV\205\377" \
+  "HU\204\377\202IV\205\377\5HU\204\377JW\205\377DQ\202\377%5l\377\26(c" \
+  "\377\207\31*e\377\10\30)d\377\31*e\3775Cw\377HU\204\377GT\203\377GU\204" \
+  "\377O[\205\377\222\222\222\377\204\211\211\211\377\10\213\213\213\377" \
+  "\202\205\216\377KX\204\377FT\203\377ES\202\377FT\203\377T_\206\377\222" \
+  "\222\222\377\204\211\211\211\377\3\213\213\213\377~\201\216\377IW\204" \
+  "\377\204ES\203\377\2\211\213\220\377\214\214\214\377\203\211\211\211" \
+  "\377\5\215\215\215\377dl\210\377DR\202\377bj\210\377\221\221\221\377" \
+  "\203\211\211\211\377\3\213\213\213\377w{\210\377$3i\377\206\31*e\377" \
+  "\14""7Dp\377|\177\211\377\213\213\213\377\200\200\200\377jjj\377]]]\377" \
+  "```\377jjj\377~~~\377\214\214\214\377\211\213\217\377`i\207\377\203B" \
+  "P\200\377\2U_\204\377\220\220\220\377\203\211\211\211\377\22\213\213" \
+  "\213\377\200\203\216\377BP\177\377@N\177\377\77M~\377@N\177\377em\210" \
+  "\377\213\214\217\377\212\212\212\377www\377iii\377ZZZ\377bbb\377nnn\377" \
+  "\206\206\206\377\214\214\214\377w{\210\3771\77n\377\203\31*e\377\16\33" \
+  ",f\377X`}\377\215\215\216\377\212\212\212\377xxx\377iii\377WWW\377YY" \
+  "Y\377fff\377|||\377\213\213\213\377\207\210\215\377\\e\205\377>L}\377" \
+  "\202<K}\377\26GU\200\377z~\214\377\215\215\215\377\207\207\207\377qq" \
+  "q\377bbb\377UUU\377[[[\377mmm\377\204\204\204\377\214\214\214\377~\202" \
+  "\215\377LX\200\377:I{\377;J|\377:I{\3779Hz\377:I{\3779Hz\377;J{\377+" \
+  ":p\377\30)d\377\202\31*e\377\2R[z\377\216\216\216\377\204\211\211\211" \
+  "\377\2\220\220\220\377GRv\377\205\31*e\377\202\30)d\377\3'7n\377dl\205" \
+  "\377\216\216\216\377\203\211\211\211\377\4\215\215\215\377\177\202\214" \
+  "\3777Fy\3776Fx\377\2057Fy\377\15T^\200\377\207\210\216\377\214\214\214" \
+  "\377{{{\377iii\377]]]\377___\377mmm\377\202\202\202\377\213\213\213\377" \
+  "\177\201\212\377;Gr\377\32+e\377\204\31*e\377\5""2@n\377}\200\212\377" \
+  "\215\215\215\377\200\200\200\377ggg\377\202___\377\23hhh\377\177\177" \
+  "\177\377\214\214\214\377\203\205\214\377CNu\377\31*d\377\37""0i\3773" \
+  "Bw\3772Av\3773Bu\377gn\205\377\217\217\217\377}}}\377ccc\377bbb\377~" \
+  "~~\377\220\220\220\377pv\210\377\221\221\221\377\203\211\211\211\377" \
+  "\21\214\214\214\377gn\205\3770@u\377+;q\377\32+f\377\36.g\377W`|\377" \
+  "\212\213\215\377\212\212\212\377uuu\377ddd\377]]]\377kkk\377\203\203" \
+  "\203\377\216\216\216\377tx\206\3771\77n\377\203\31*e\377\3(7j\377\216" \
+  "\216\217\377\212\212\212\377\202\211\211\211\377\6\212\212\212\377\216" \
+  "\216\217\377\35.f\377\31*e\377HRv\377\216\216\216\377\203\211\211\211" \
+  "\377\2\214\214\214\377}\200\213\377\202-<r\377\2vz\211\377\213\213\213" \
+  "\377\203\211\211\211\377\5\217\217\217\377,<r\377+;q\377\34-g\377\30" \
+  ")d\377\232\31*e\377\6\30)d\377\31*e\377&6m\377'8o\377'7o\377(8o\377\206" \
+  "'7o\377\3$5m\377\33+f\377\30)d\377\235\31*e\377\202FT\203\377\4ES\202" \
+  "\377FT\203\377GU\204\377FT\203\377\206GU\204\377\7FU\204\377GU\204\377" \
+  "HT\203\377HU\204\377BP\200\377\"2k\377\27(d\377\207\31*e\377\13\30)d" \
+  "\377\31*e\3771@u\377JW\206\377IV\205\377HU\204\377IV\205\377HU\204\377" \
+  "IV\205\377JW\206\377IV\205\377\210JW\206\377\202IV\206\377\1JW\206\377" \
+  "\202KX\206\377\1JW\206\377\213KX\206\377\202JW\205\377\203KX\206\377" \
+  "\203LY\207\377\1KX\206\377\241LY\207\377\203KX\206\377\1JW\205\377\216" \
+  "KX\206\377\1JW\206\377\202IV\206\377\210JW\206\377\4IV\205\377JW\206" \
+  "\377IV\205\377HU\204\377\202IV\205\377\5HU\204\377IV\205\377BP\200\377" \
+  "$4l\377\30)d\377\210\31*e\377\4\30*d\377/>s\377GT\203\377HU\204\377\202" \
+  "GU\204\377\1FU\204\377\207GU\204\377\2FT\203\377ES\202\377\206FT\203" \
+  "\377\4ES\203\377FT\203\377ES\203\377DR\203\377\206ES\203\377\202DR\202" \
+  "\377\1CQ\201\377\205DR\202\377\4CQ\201\3770\77t\377\31*e\377\30)d\377" \
+  "\211\31*e\377\4\30)d\377!2k\377AO\200\377AP\200\377\202BP\201\377\2B" \
+  "P\200\377BP\177\377\205BP\200\377\3AO\200\377BP\200\377@N\200\377\207" \
+  "AO\200\377\2@N\177\377\77M~\377\206@N\177\377\202\77M~\377\3""7Fy\377" \
+  "\31*e\377\31*d\377\213\31*e\377\4\31*d\377\27(c\377/>t\377<J|\377\204" \
+  "=K}\377\2<K}\377;K}\377\206<K}\377\202;J|\377\1:I{\377\205;J|\377\202" \
+  ":I{\377\1""9Hz\377\202:I{\377\3;J{\377\40""1j\377\30)d\377\217\31*e\377" \
+  "\3\30)d\377\32+e\377-<r\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2" \
+  "6Ex\3775Dw\377\2056Ex\377\2/\77t\377\27(c\377\224\31*e\377\5\27(d\377" \
+  "&5n\3773Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3770At\377\2061Au\377" \
+  "\2020@u\377\1'7n\377\231\31*e\377\5\30)d\377\32+e\377(8o\377.=s\377," \
+  ";q\377\207-<r\377\1+<r\377\202,<r\377\202+;q\377\2\31*e\377\30)d\377" \
+  "\232\31*e\377\3\30)d\377\33,g\377&7n\377\202(8o\377\207'7o\377\3#4l\377" \
+  "\31*e\377\30)d\377\235\31*e\377\203FT\203\377\2ES\202\377FT\203\377\207" \
+  "GU\204\377\202FU\204\377\6GU\204\377HT\203\377HU\204\377>L}\377\36.h" \
+  "\377\30)d\377\207\31*e\377\3\30)d\377\32*e\377/=s\377\204IV\205\377\2" \
+  "HU\204\377IV\205\377\202JW\206\377\1IV\205\377\210JW\206\377\1IV\206" \
+  "\377\202JW\206\377\216KX\206\377\202JW\205\377\204KX\206\377\203LY\207" \
+  "\377\1KX\206\377\226LY\207\377\1KX\206\377\203LY\207\377\204KX\206\377" \
+  "\203JW\205\377\213KX\206\377\2JW\206\377KX\206\377\203JW\206\377\1IV" \
+  "\206\377\212JW\206\377\2IV\205\377HU\204\377\202IV\205\377\4HU\204\377" \
+  "IV\205\377DR\202\377!1j\377\202\30)d\377\207\31*e\377\2\30)d\377(8o\377" \
+  "\202HU\204\377\3HT\203\377GU\204\377FU\204\377\206GU\204\377\4FT\203" \
+  "\377GU\204\377FT\203\377ES\202\377\207FT\203\377\2ES\203\377DR\203\377" \
+  "\206ES\203\377\202DR\202\377\1CQ\201\377\205DR\202\377\4CQ\201\377\77" \
+  "N\177\377\36.h\377\30)d\377\211\31*e\377\3\30)d\377\27(d\3775Dy\377\202" \
+  "AO\200\377\2BP\200\377BP\201\377\210BP\200\377\2AO\200\377@N\200\377" \
+  "\205AO\200\377\3@N\177\377AO\200\377\77M~\377\207@N\177\377\3>L}\377" \
+  "AN\177\377&7n\377\215\31*e\377\4\30)d\377\33,f\3777Ey\377=J}\377\203" \
+  "=K}\377\202<K}\377\1;K}\377\206<K}\377\2;J|\377:I{\377\206;J|\377\2:" \
+  "I{\3779Hz\377\203:I{\377\2""5Dw\377\34-g\377\220\31*e\377\3\30)d\377" \
+  "\34-g\3773Aw\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775" \
+  "Dw\377\2046Ex\377\3""7Ex\377&6n\377\27)d\377\224\31*e\377\4\27(c\377" \
+  "-<r\3773Bw\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\4""0@t" \
+  "\3770@u\377#4l\377\30)d\377\230\31*e\377\5\30)d\377\34,g\377+:q\377." \
+  "=s\377,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203,<r\377\3(8o\377\27" \
+  "(d\377\30)d\377\232\31*e\377\3\30)d\377\35.h\377'7n\377\202(8o\377\2" \
+  "'7o\377&6o\377\205'7o\377\1#3l\377\202\30)d\377\235\31*e\377\205FT\203" \
+  "\377\202GU\204\377\1FT\203\377\206GU\204\377\7FU\204\377GU\204\377HT" \
+  "\203\377IV\204\377:H{\377\33,f\377\30)d\377\207\31*e\377\6\30)d\377\30" \
+  "(d\377/>t\377GT\203\377IV\205\377HU\204\377\202IV\205\377\2HU\204\377" \
+  "IV\205\377\213JW\206\377\202IV\206\377\202JW\206\377\202KX\206\377\1" \
+  "JW\206\377\215KX\206\377\203JW\205\377\206KX\206\377\216LY\207\377\206" \
+  "KX\206\377\203JW\205\377\216KX\206\377\2JW\206\377KX\206\377\202JW\206" \
+  "\377\202IV\206\377\211JW\206\377\3IV\205\377JW\206\377IV\205\377\202" \
+  "HU\204\377\2IV\205\377HU\204\377\202IV\205\377\3BP\200\377\35-h\377\30" \
+  ")d\377\207\31*e\377\202\30)d\377\5%5m\377IV\205\377HU\204\377HT\203\377" \
+  "FU\204\377\207GU\204\377\4FT\203\377GU\204\377FT\203\377ES\202\377\205" \
+  "FT\203\377\1ES\203\377\202FT\203\377\207ES\203\377\3DR\202\377ES\203" \
+  "\377CQ\201\377\205DR\202\377\4DQ\201\377DR\202\377-=r\377\26(c\377\212" \
+  "\31*e\377\10\30)d\377#3l\377>M~\377BP\201\377BP\200\377BP\201\377BP\200" \
+  "\377BP\177\377\207BP\200\377\206AO\200\377\3@N\177\377AO\200\377\77M" \
+  "~\377\207@N\177\377\202\77M~\377\3:I{\377\36.h\377\30)d\377\214\31*e" \
+  "\377\3\30)d\377$4l\377;I{\377\205=K}\377\1;K}\377\207<K}\377\2;J|\377" \
+  ":I{\377\205;J|\377\202:I{\377\1""9Hz\377\203:I{\377\2-=r\377\31+e\377" \
+  "\221\31*e\377\2\37""0i\3779Fz\377\2058Fz\377\2027Fy\377\1""6Fx\377\205" \
+  "7Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""7Fy\377\35-h\377\30)d\377\223" \
+  "\31*e\377\5\30)d\377\32+f\377/\77t\3772Av\3771@u\377\2052Av\377\2021" \
+  "Au\377\1""0At\377\2061Au\377\4""0@u\377/\77t\377\40""0i\377\30)d\377" \
+  "\230\31*e\377\5\30)d\377\35.h\377-<r\377.=s\377,;q\377\206-<r\377\205" \
+  ",<r\377\2#4l\377\30)d\377\233\31*e\377\3\30)d\377\40""0i\377'7n\377\202" \
+  "(8o\377\2'7o\377&6o\377\204'7o\377\3&6n\377!1j\377\30)d\377\236\31*e" \
+  "\377\204FT\203\377\1ES\202\377\202FT\203\377\210GU\204\377\7FU\204\377" \
+  "GU\204\377GT\203\377JW\205\3778Gz\377\33,g\377\30)d\377\207\31*e\377" \
+  "\5\30)d\377\26'c\377*9p\377DQ\201\377JW\206\377\202HU\204\377\3IV\205" \
+  "\377HU\204\377IV\205\377\202JW\206\377\1IV\205\377\211JW\206\377\1IV" \
+  "\206\377\203JW\206\377\2KX\206\377JW\206\377\217KX\206\377\205JW\205" \
+  "\377\220KX\206\377\205JW\205\377\217KX\206\377\1JW\206\377\202KX\206" \
+  "\377\202JW\206\377\202IV\206\377\210JW\206\377\1IV\205\377\202JW\206" \
+  "\377\2IV\205\377HU\204\377\205IV\205\377\3:H{\377\33,f\377\30)d\377\207" \
+  "\31*e\377\202\30)d\377\6'7n\377GT\203\377HU\204\377GT\203\377GU\204\377" \
+  "FU\204\377\206GU\204\377\4FT\203\377GU\204\377FT\203\377ES\202\377\207" \
+  "FT\203\377\202ES\203\377\1DR\203\377\205ES\203\377\4DR\202\377ES\203" \
+  "\377DR\202\377CQ\201\377\204DR\202\377\3CQ\201\377DR\202\377<K}\377\202" \
+  "\30)d\377\213\31*e\377\4""2Bv\377CP\201\377AO\200\377BP\201\377\202B" \
+  "P\200\377\1BP\177\377\204BP\200\377\4AO\200\377BP\200\377AO\200\377@" \
+  "N\200\377\206AO\200\377\207@N\177\377\7\77M~\377@N\177\377>L}\377\77" \
+  "M~\3770\77t\377\31*e\377\30)d\377\215\31*e\377\3.=s\377=K}\377<J}\377" \
+  "\202=K}\377\3<K}\377=K}\377;K}\377\205<K}\377\3;J|\377<K}\377:I{\377" \
+  "\206;J|\377\2:I{\3779Hz\377\203:I{\377\3""9Hz\377&6n\377\30)d\377\221" \
+  "\31*e\377\3(7o\3779Gz\3777Ey\377\2048Fz\377\2""7Fy\3776Fx\377\2067Fy" \
+  "\377\2""6Ex\3775Dw\377\2056Ex\377\2""3Cw\377\30)d\377\224\31*e\377\5" \
+  "\30)d\377\37""0i\3771@u\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377" \
+  "\2061Au\377\4/\77u\377-=s\377\35-g\377\30)d\377\231\31*e\377\4\40""0" \
+  "j\377/>s\377-<r\377,;q\377\206-<r\377\205,<r\377\2\37""0i\377\30)d\377" \
+  "\232\31*e\377\202\30)d\377\1\"2k\377\203(8o\377\2'7o\377&6o\377\204'" \
+  "7o\377\3&6n\377\36/i\377\30)d\377\236\31*e\377\205FT\203\377\4ES\202" \
+  "\377FT\203\377GU\204\377FT\203\377\207GU\204\377\7FU\204\377GU\204\377" \
+  "GT\203\377IV\205\377;I{\377\34-f\377\30)d\377\210\31*e\377\4\27(c\377" \
+  "\"3k\377>L~\377JW\206\377\203IV\205\377\1HU\204\377\202IV\205\377\2J" \
+  "W\206\377IV\205\377\211JW\206\377\202IV\206\377\202JW\206\377\202KX\206" \
+  "\377\1JW\206\377\222KX\206\377\220JW\205\377\225KX\206\377\202JW\206" \
+  "\377\202IV\206\377\213JW\206\377\202IV\205\377\1HU\204\377\202IV\205" \
+  "\377\1HU\204\377\202IV\205\377\3""2Av\377\33+f\377\30)d\377\210\31*e" \
+  "\377\7\30)d\377'7n\377DR\202\377HU\204\377HT\203\377GU\204\377FU\204" \
+  "\377\210GU\204\377\2FT\203\377ES\202\377\210FT\203\377\2ES\203\377DR" \
+  "\203\377\207ES\203\377\2DR\202\377CQ\201\377\207DR\202\377\2\40""1j\377" \
+  "\30)d\377\212\31*e\377\10\30)d\377!1j\377AO\200\377BP\201\377AO\200\377" \
+  "BP\201\377BP\200\377BP\177\377\206BP\200\377\202AO\200\377\1@N\200\377" \
+  "\204AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\206@N\177\377" \
+  "\202\77M~\377\4=K|\377%4l\377\30)d\377\31*d\377\214\31*e\377\4\35-g\377" \
+  "8Fy\377=K}\377<J|\377\203=K}\377\2<K}\377;K}\377\206<K}\377\2;J|\377" \
+  ":I{\377\205;J|\377\3:I{\377;J|\3779Hz\377\203:I{\377\3""6Ex\377\36/h" \
+  "\377\30)d\377\220\31*e\377\2\30)d\3772Av\377\2058Fz\377\3""7Fy\3778F" \
+  "z\3776Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2056Ex\377\2+;q\377" \
+  "\30)d\377\224\31*e\377\4\30)d\377$4m\3772Av\3771@u\377\2072Av\377\1""0" \
+  "At\377\2071Au\377\4""0@u\377+;q\377\31*e\377\30)d\377\231\31*e\377\2" \
+  "%5m\377.=s\377\210-<r\377\203,<r\377\4+;q\377-=r\377\32+f\377\30)d\377" \
+  "\232\31*e\377\10\30)d\377\31*e\377#4l\377(8o\377'7o\377(8o\377'7o\377" \
+  "&6o\377\204'7o\377\3&6n\377\33,g\377\30)d\377\235\31*e\377\1\30)d\377" \
+  "\206FT\203\377\2ES\202\377FT\203\377\210GU\204\377\202FU\204\377\6GU" \
+  "\204\377HT\203\377HU\204\377;I{\377\34-g\377\30)d\377\210\31*e\377\5" \
+  "\30)d\377\34-g\377:H{\377IV\205\377HU\204\377\202IV\205\377\202HU\204" \
+  "\377\1IV\205\377\214JW\206\377\202IV\206\377\202JW\206\377\264KX\206" \
+  "\377\2JW\206\377KX\206\377\203JW\206\377\1IV\206\377\212JW\206\377\3" \
+  "IV\205\377JW\206\377IV\205\377\203HU\204\377\2IV\205\377HU\204\377\202" \
+  "IV\205\377\1)9o\377\203\30)d\377\207\31*e\377\4\30)d\377$4l\377FS\203" \
+  "\377HU\204\377\202GU\204\377\202FU\204\377\206GU\204\377\2FT\203\377" \
+  "GU\204\377\210FT\203\377\202ES\203\377\202DR\203\377\205ES\203\377\4" \
+  "DR\202\377ES\203\377DR\202\377CQ\201\377\204DR\202\377\3CQ\201\377FS" \
+  "\203\377/\77t\377\214\31*e\377\4\30)d\3776Ey\377CP\201\377AO\200\377" \
+  "\202BP\200\377\202BP\177\377\206BP\200\377\2AO\200\377@N\200\377\206" \
+  "AO\200\377\1@N\177\377\202\77M~\377\204@N\177\377\2\77M~\377@N\177\377" \
+  "\202\77M~\377\3""8Gy\377\31*e\377\30)d\377\214\31*e\377\3\30)d\377$4" \
+  "l\377>L~\377\205=K}\377\1;K}\377\207<K}\377\1:I{\377\207;J|\377\2:I{" \
+  "\3779Hz\377\202:I{\377\2""9Hz\3772Av\377\202\30)d\377\217\31*e\377\3" \
+  "\30)d\377\34-g\3779G{\377\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6" \
+  "Ex\3775Dw\377\2036Ex\377\4""5Dw\3777Fy\377\"2j\377\30)d\377\223\31*e" \
+  "\377\5\30)d\377\31*e\377)8p\3773Bw\3771@u\377\2072Av\377\1""0At\377\205" \
+  "1Au\377\6""0@u\3771Au\377/\77t\377(8o\377\27(d\377\30)d\377\231\31*e" \
+  "\377\2)9o\377.=s\377\206-<r\377\2,<r\377-<r\377\204,<r\377\1*:q\377\202" \
+  "\30)d\377\232\31*e\377\3\30)d\377\32+f\377%5m\377\202(8o\377\1'7o\377" \
+  "\202&6o\377\203'7o\377\4&6o\377&6n\377\31*e\377\30)d\377\235\31*e\377" \
+  "\1\30)d\377\207FT\203\377\4ES\202\377FT\203\377GU\204\377FT\203\377\207" \
+  "GU\204\377\7FU\204\377GU\204\377GT\203\377IV\205\3779Hz\377\34-g\377" \
+  "\30)d\377\210\31*e\377\4\30)d\377\27(c\3773Bv\377GU\204\377\202IV\205" \
+  "\377\2HU\204\377IV\205\377\202HU\204\377\1IV\205\377\202JW\206\377\1" \
+  "IV\205\377\212JW\206\377\202IV\206\377\203JW\206\377\202KX\206\377\1" \
+  "JW\206\377\250KX\206\377\1JW\206\377\202KX\206\377\203JW\206\377\202" \
+  "IV\206\377\216JW\206\377\202HU\204\377\202IV\205\377\1HU\204\377\202" \
+  "IV\205\377\3BP\200\377\37""0i\377\27(d\377\210\31*e\377\202\30)d\377" \
+  "\6%5m\377IU\204\377HU\204\377HT\203\377GU\204\377FU\204\377\211GU\204" \
+  "\377\2FT\203\377ES\202\377\205FT\203\377\4ES\203\377FT\203\377ES\203" \
+  "\377DR\203\377\206ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377" \
+  "\206DR\202\377\3<K}\377\35.h\377\30)d\377\212\31*e\377\7\30)d\377$4m" \
+  "\377DR\202\377AO\200\377BP\200\377BP\201\377BP\177\377\206BP\200\377" \
+  "\202AO\200\377\1@N\200\377\207AO\200\377\2@N\177\377\77M~\377\206@N\177" \
+  "\377\5\77M~\377>L}\377\77M~\377)9p\377\27(c\377\214\31*e\377\202\30)" \
+  "d\377\1""3Bv\377\205=K}\377\210<K}\377\207;J|\377\3:I{\377;J|\3779Hz" \
+  "\377\202:I{\377\2029Hz\377\2'7n\377\27(d\377\220\31*e\377\3\30)d\377" \
+  "'7n\3779Gz\377\2068Fz\377\1""6Fx\377\2077Fy\377\1""5Dw\377\2056Ex\377" \
+  "\2""5Cw\377\35-g\377\224\31*e\377\5\30)d\377\33,f\377-<s\3773Bw\3771" \
+  "@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\4""0@u\377/\77t\377\"" \
+  "3k\377\30)d\377\230\31*e\377\4\30)d\377\31*e\377.=r\377.=s\377\207-<" \
+  "r\377\2,<r\377+<r\377\203,<r\377\2'7m\377\30)d\377\233\31*e\377\3\30" \
+  ")d\377\34,f\377'7n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\2%5n\377" \
+  "\27)d\377\236\31*e\377\3\30)d\377FT\203\377ES\203\377\206FT\203\377\4" \
+  "ES\202\377FT\203\377GU\204\377FT\203\377\207GU\204\377\7FU\204\377GU" \
+  "\204\377GT\203\377JW\205\377<J|\377\37/i\377\27(c\377\210\31*e\377\4" \
+  "\31)e\377\26'c\377&7n\377AN\177\377\205IV\205\377\1HU\204\377\202IV\205" \
+  "\377\215JW\206\377\202IV\206\377\203JW\206\377\203KX\206\377\1JW\206" \
+  "\377\243KX\206\377\1JW\206\377\202KX\206\377\203JW\206\377\203IV\206" \
+  "\377\213JW\206\377\204IV\205\377\1HU\204\377\202IV\205\377\6HU\204\377" \
+  "IV\205\377HU\204\3776Ex\377\33,f\377\30)d\377\210\31*e\377\3\30)d\377" \
+  "\31*e\377*:p\377\202HU\204\377\3HT\203\377GU\204\377FU\204\377\207GU" \
+  "\204\377\203FT\203\377\1ES\202\377\207FT\203\377\2ES\203\377DR\203\377" \
+  "\210ES\203\377\2DR\202\377CQ\201\377\205DR\202\377\202CQ\201\377\1)9" \
+  "p\377\202\30)d\377\211\31*e\377\3\30)d\377\31*e\377=K}\377\203BP\201" \
+  "\377\2BP\200\377BP\177\377\207BP\200\377\2AO\200\377@N\200\377\205AO" \
+  "\200\377\202@N\177\377\1\77M~\377\207@N\177\377\202\77M~\377\3<J|\377" \
+  "\31*e\377\30)d\377\214\31*e\377\4\30)d\377\35.h\377>L~\377=K|\377\202" \
+  "=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\2;J|\377:I{\377\206" \
+  ";J|\377\2:I{\3779Hz\377\202:I{\377\4:Iz\3779Hz\377\33,g\377\30)d\377" \
+  "\217\31*e\377\3\30)d\377\27(c\3773Av\377\2058Fz\377\3""7Fy\3778Fz\377" \
+  "6Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2036Ex\377\4""5Dw\3776Ex" \
+  "\377.>s\377\33+f\377\224\31*e\377\3\30)d\377\35.h\3771@v\377\2102Av\377" \
+  "\2101Au\377\4""0@t\377/\77t\377\35-g\377\30)d\377\230\31*e\377\5\30)" \
+  "d\377\35-g\377/>t\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<" \
+  "r\377\2\"2k\377\30)d\377\233\31*e\377\2\30)d\377\35.g\377\203(8o\377" \
+  "\2'7o\377&6o\377\205'7o\377\2\"2k\377\30)d\377\236\31*e\377\2\30)d\377" \
+  "ES\203\377\207FT\203\377\1ES\202\377\202FT\203\377\211GU\204\377\10F" \
+  "U\204\377GU\204\377GT\203\377IV\204\377@M~\377#3k\377\27(c\377\30)d\377" \
+  "\210\31*e\377\6\30)d\377\36.h\3774Cw\377JW\206\377IV\205\377HU\204\377" \
+  "\202IV\205\377\1HU\204\377\202IV\205\377\2JW\206\377IV\205\377\214JW" \
+  "\206\377\203IV\206\377\203JW\206\377\203KX\206\377\1JW\206\377\241KX" \
+  "\206\377\203JW\206\377\202IV\206\377\214JW\206\377\1IV\205\377\202JW" \
+  "\206\377\1IV\205\377\202HU\204\377\1IV\205\377\202HU\204\377\4KX\206" \
+  "\377DQ\201\377(8o\377\31*e\377\202\30)d\377\207\31*e\377\202\30)d\377" \
+  "\4/>t\377GT\203\377HU\204\377HT\203\377\202GU\204\377\1FU\204\377\206" \
+  "GU\204\377\4FT\203\377GU\204\377FT\203\377ES\202\377\206FT\203\377\4" \
+  "ES\203\377FT\203\377ES\203\377DR\203\377\206ES\203\377\3DR\202\377ES" \
+  "\203\377CQ\201\377\205DR\202\377\5CQ\201\377DR\202\3777Fy\377\31*d\377" \
+  "\30)d\377\212\31*e\377\7\27(c\377.>s\377BP\201\377AO\200\377BP\200\377" \
+  "BP\201\377BP\177\377\206BP\200\377\3AO\200\377BP\200\377@N\200\377\207" \
+  "AO\200\377\2@N\177\377\77M~\377\206@N\177\377\202\77M~\377\3@N\177\377" \
+  "):p\377\27(d\377\215\31*e\377\4\26(c\377/>t\377=K}\377<J|\377\203=K}" \
+  "\377\202<K}\377\1;K}\377\204<K}\377\4;J|\377<K}\377;J|\377:I{\377\204" \
+  ";J|\377\2:I{\377;J|\377\205:I{\377\3""1Au\377\27(c\377\31*d\377\217\31" \
+  "*e\377\4\30)d\377\35-h\3778Fz\3777Ey\377\2058Fz\377\2""7Fy\3776Fx\377" \
+  "\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\1(8o\377\226\31*e\377\2!1k\377" \
+  "4Cw\377\2102Av\377\2061Au\377\4""0@u\3771Au\3770@u\377.>t\377\202\30" \
+  ")d\377\230\31*e\377\5\30)d\377#2k\377.=s\377-<r\377,;q\377\206-<r\377" \
+  "\7,<r\377+<r\377,<r\377+;q\377-=r\377\35.h\377\30)d\377\234\31*e\377" \
+  "\6\37""0i\377(8o\377'7n\377(8o\377'7o\377&6o\377\205'7o\377\2\36/i\377" \
+  "\30)d\377\236\31*e\377\4\30)d\377ES\203\377FT\203\377ES\203\377\206F" \
+  "T\203\377\202ES\202\377\202FT\203\377\207GU\204\377\202FU\204\377\6G" \
+  "U\204\377HT\203\377HU\204\377CQ\201\377%5m\377\30)d\377\210\31*e\377" \
+  "\202\30)d\377\4\31*e\377$5m\377ES\203\377JW\205\377\202HU\204\377\1I" \
+  "V\205\377\202HU\204\377\1IV\205\377\202JW\206\377\1IV\205\377\215JW\206" \
+  "\377\202IV\206\377\204JW\206\377\204KX\206\377\1JW\206\377\231KX\206" \
+  "\377\204JW\206\377\203IV\206\377\217JW\206\377\202IV\205\377\1HU\204" \
+  "\377\204IV\205\377\3JW\206\3777Ex\377\34-g\377\202\30)d\377\210\31*e" \
+  "\377\3\30)d\377\27(d\3776Dx\377\202HU\204\377\1HT\204\377\202GU\204\377" \
+  "\1FU\204\377\206GU\204\377\4FT\203\377GU\204\377FT\203\377ES\202\377" \
+  "\210FT\203\377\1ES\203\377\202DR\203\377\205ES\203\377\4DR\202\377ES" \
+  "\203\377DR\202\377CQ\201\377\206DR\202\377\3CP\201\377\33,g\377\30)d" \
+  "\377\212\31*e\377\3\30)d\377\40""1j\377=K}\377\203BP\201\377\211BP\200" \
+  "\377\2AO\200\377@N\200\377\205AO\200\377\3@N\177\377AO\200\377\77M~\377" \
+  "\206@N\177\377\203\77M~\377\3<K|\377\31*e\377\30)d\377\214\31*e\377\3" \
+  "\30)d\377\33,f\377<J|\377\205=K}\377\2<K}\377;K}\377\206<K}\377\1;J|" \
+  "\377\202:I{\377\205;J|\377\2:I{\3779Hz\377\202:I{\377\4""9Hz\377;J|\377" \
+  "\"2k\377\30)d\377\220\31*e\377\2\27(d\377(7o\377\2078Fz\377\2107Fy\377" \
+  "\2066Ex\377\3""4Cw\377\"3k\377\30)d\377\225\31*e\377\2(8o\3773Bw\377" \
+  "\2062Av\377\2""1Au\3772Av\377\2071Au\377\2020@u\377\2(9p\377\27(d\377" \
+  "\231\31*e\377\5\27)d\377(8p\377.=s\377-<r\377,;q\377\204-<r\377\4,<r" \
+  "\377-<r\377,<r\377+<r\377\202,<r\377\3+;q\377\33,f\377\30)d\377\234\31" \
+  "*e\377\1\"3k\377\202(8o\377\1'7o\377\202&6o\377\205'7o\377\2\33,f\377" \
+  "\30)d\377\237\31*e\377\2DR\203\377ES\203\377\211FT\203\377\4ES\202\377" \
+  "FT\203\377GU\204\377FT\203\377\207GU\204\377\10FU\204\377GU\204\377H" \
+  "T\203\377HU\204\377HU\203\377'7o\377\31*e\377\30)d\377\211\31*e\377\4" \
+  "\30)d\377\31*e\3777Fy\377GT\204\377\202IV\205\377\1HU\204\377\202IV\205" \
+  "\377\1HU\204\377\202IV\205\377\202JW\206\377\1IV\205\377\217JW\206\377" \
+  "\204IV\206\377\210JW\206\377\210KX\206\377\210JW\206\377\204IV\206\377" \
+  "\217JW\206\377\1IV\205\377\202JW\206\377\202IV\205\377\202HU\204\377" \
+  "\1IV\205\377\202HU\204\377\4IV\205\377HU\204\377DQ\201\377)9p\377\202" \
+  "\30)d\377\210\31*e\377\202\30)d\377\6\33,f\377<J|\377IV\204\377GT\203" \
+  "\377HU\204\377FU\204\377\212GU\204\377\2FT\203\377ES\202\377\206FT\203" \
+  "\377\4ES\203\377FT\203\377ES\203\377DR\203\377\210ES\203\377\2DR\202" \
+  "\377CQ\201\377\204DR\202\377\5CQ\201\377DR\202\377ES\202\377&6m\377\30" \
+  ")d\377\214\31*e\377\3""1@v\377BP\201\377BP\200\377\202BP\201\377\2BP" \
+  "\200\377BP\177\377\207BP\200\377\206AO\200\377\3@N\177\377AO\200\377" \
+  "\77M~\377\206@N\177\377\5\77M~\377@N\177\377>L}\377@N~\377*:q\377\215" \
+  "\31*e\377\4\30)d\377\27(d\377*;q\377<J|\377\205=K}\377\2<K}\377;K}\377" \
+  "\206<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\3779Hz\377\203:I{\377\2""7" \
+  "Fy\377\30)d\377\220\31*e\377\202\30)d\377\1""2@u\377\2078Fz\377\2107" \
+  "Fy\377\2066Ex\377\3""2Au\377\35-g\377\30)d\377\223\31*e\377\5\30)d\377" \
+  "\31*e\377/\77t\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au" \
+  "\377\4""0@t\3770@u\377\40""1k\377\30)d\377\230\31*e\377\6\30)d\377\30" \
+  "*d\377-<s\377.=r\377-<r\377,;q\377\205-<r\377\2,<r\377+<r\377\203,<r" \
+  "\377\2(8o\377\32+e\377\235\31*e\377\1%5m\377\202(8o\377\2'7o\377&6o\377" \
+  "\206'7o\377\2\31)d\377\30*e\377\237\31*e\377\5ES\203\377DR\203\377ES" \
+  "\203\377FT\203\377ES\203\377\207FT\203\377\4ES\202\377FT\203\377GU\204" \
+  "\377FT\203\377\207GU\204\377\7FU\204\377GU\204\377HT\203\377HU\204\377" \
+  "JV\205\3771@u\377\34,g\377\202\30)d\377\210\31*e\377\4\30)d\377\27(d" \
+  "\377'7o\377=J}\377\203IV\205\377\2HU\204\377IV\205\377\202HU\204\377" \
+  "\202IV\205\377\224JW\206\377\207IV\206\377\212JW\206\377\207IV\206\377" \
+  "\221JW\206\377\1IV\205\377\202JW\206\377\202IV\205\377\202HU\204\377" \
+  "\204IV\205\377\6JW\206\377DR\202\3775Cx\377\35-h\377\26'c\377\30)d\377" \
+  "\210\31*e\377\202\30)d\377\4#3k\377@M\177\377HU\204\377GT\203\377\202" \
+  "GU\204\377\1FU\204\377\207GU\204\377\203FT\203\377\1ES\202\377\206FT" \
+  "\203\377\4ES\203\377FT\203\377ES\203\377DR\203\377\210ES\203\377\2DR" \
+  "\202\377CQ\201\377\206DR\202\377\3ES\202\3772Av\377\30)d\377\213\31*" \
+  "e\377\5\30)d\377\"3k\377AO\200\377BP\201\377AO\201\377\202BP\200\377" \
+  "\1BP\177\377\205BP\200\377\4AO\200\377BP\200\377AO\200\377@N\200\377" \
+  "\206AO\200\377\211@N\177\377\202\77M~\377\3;I{\377\36/h\377\30)d\377" \
+  "\214\31*e\377\3\30)d\377\32+f\3777Ey\377\204=K}\377\202<K}\377\1;K}\377" \
+  "\206<K}\377\2;J|\377:I{\377\206;J|\377\202:I{\377\6""9Hz\377:I{\3779" \
+  "Hz\377;J{\377*:q\377\30)d\377\220\31*e\377\4\30)d\377\37/i\3775Cx\377" \
+  "7Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\204" \
+  "6Ex\377\2""5Dw\377.>r\377\202\30)d\377\223\31*e\377\5\30)d\377\34-g\377" \
+  "4Cw\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2041Au\377\2""0@u" \
+  "\3771Au\377\2020@u\377\2\32+f\377\30)d\377\230\31*e\377\5\30)d\377\35" \
+  ".h\377.=s\377-<r\377,;q\377\206-<r\377\6,<r\377+<r\377,<r\377+;q\377" \
+  ",<r\377$5l\377\234\31*e\377\2\30)d\377\31*e\377\203(8o\377\2'7o\377&" \
+  "6o\377\205'7o\377\2$4m\377\30)d\377\240\31*e\377\202ES\203\377\4DR\203" \
+  "\377ES\203\377FT\203\377ES\203\377\206FT\203\377\1ES\202\377\202FT\203" \
+  "\377\211GU\204\377\3FU\204\377GU\204\377HT\203\377\202HU\204\377\3;I" \
+  "{\377\37""0i\377\27)d\377\211\31*e\377\10\30)d\377\27(c\377\34,g\377" \
+  "*:p\377@N\177\377KW\206\377IV\205\377HU\204\377\202IV\205\377\202HU\204" \
+  "\377\202IV\205\377\202JW\206\377\1IV\205\377\226JW\206\377\212IV\206" \
+  "\377\226JW\206\377\1IV\205\377\202JW\206\377\203IV\205\377\202HU\204" \
+  "\377\202IV\205\377\7HU\204\377IV\205\377JW\206\3776Ey\377#3k\377\30(" \
+  "d\377\30)d\377\211\31*e\377\4\30)d\377\26'c\377,;q\377CQ\201\377\202" \
+  "HU\204\377\202GU\204\377\1FU\204\377\207GU\204\377\4FT\203\377GU\204" \
+  "\377FT\203\377ES\202\377\206FT\203\377\4ES\203\377FT\203\377ES\203\377" \
+  "DR\203\377\207ES\203\377\203DR\202\377\1CQ\201\377\206DR\202\377\3;J" \
+  "|\377\35-g\377\30)d\377\212\31*e\377\202\30)d\377\3;I|\377BP\201\377" \
+  "AO\200\377\202BP\200\377\1BP\177\377\207BP\200\377\202AO\200\377\1@N" \
+  "\200\377\204AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\205@" \
+  "N\177\377\7\77M~\377@N\177\377>L}\377\77M~\377.>s\377\31*e\377\30)d\377" \
+  "\214\31*e\377\3\30)d\377%5m\377;J|\377\205=K}\377\2<K}\377;K}\377\205" \
+  "<K}\377\202;J|\377\1:I{\377\206;J|\377\2:I{\3779Hz\377\203:I{\377\3""9" \
+  "Hz\377\37""0i\377\30)d\377\217\31*e\377\202\30)d\377\2'6n\3777Ey\377" \
+  "\2048Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2047Fy\377\4""6Ex\3777Fy" \
+  "\3776Ex\3775Dw\377\2046Ex\377\3""5Dw\377%6m\377\27(d\377\224\31*e\377" \
+  "\5\30)d\377%5m\3774Cw\3772Av\3771@u\377\2042Av\377\4""1Au\3772Av\377" \
+  "1Au\3770At\377\2051Au\377\2020@u\377\2,<r\377\30)d\377\231\31*e\377\5" \
+  "\30)d\377#3l\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203" \
+  ",<r\377\2!2j\377\30)d\377\233\31*e\377\7\30)d\377\34-g\377(8o\377'7n" \
+  "\377'7o\377(8o\377&6o\377\205'7o\377\2!1j\377\30)d\377\240\31*e\377\203" \
+  "ES\203\377\4DR\203\377ES\203\377FT\203\377ES\203\377\206FT\203\377\202" \
+  "ES\202\377\202FT\203\377\207GU\204\377\1FU\204\377\203GU\204\377\202" \
+  "HU\204\377\3DQ\201\377%5l\377\27(c\377\212\31*e\377\202\30)d\377\4\33" \
+  ",f\377.=r\377GU\204\377IV\205\377\202HU\204\377\1IV\205\377\203HU\204" \
+  "\377\202IV\205\377\265JW\206\377\1IV\205\377\202JW\206\377\202IV\205" \
+  "\377\203HU\204\377\202IV\205\377\6HU\204\377IV\205\377KX\206\377>K}\377" \
+  "\"2k\377\31*e\377\202\30)d\377\211\31*e\377\5\30)d\377\31*e\3779Gy\377" \
+  "GT\203\377HU\204\377\202HT\203\377\2GU\204\377FU\204\377\207GU\204\377" \
+  "\4FT\203\377GU\204\377FT\203\377ES\202\377\210FT\203\377\1ES\203\377" \
+  "\202DR\203\377\206ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377" \
+  "\205DR\202\377\3CQ\201\377AO\200\377%5m\377\202\30)d\377\212\31*e\377" \
+  "\3\26'c\377/>t\377CP\201\377\203BP\201\377\2BP\200\377BP\177\377\206" \
+  "BP\200\377\1AO\200\377\202@N\200\377\206AO\200\377\1@N\177\377\202\77" \
+  "M~\377\206@N\177\377\6\77M~\377>L}\377;J|\377!1j\377\30)d\377\31*d\377" \
+  "\214\31*e\377\2\32+f\3770\77u\377\204=K}\377\3<K}\377=K}\377;K}\377\207" \
+  "<K}\377\2;J|\377:I{\377\206;J|\377\7:I{\3779Hz\377:I{\3779Hz\377:I{\377" \
+  "1Au\377\33,f\377\220\31*e\377\3\30)d\377\32+f\377.=s\377\2068Fz\377\1" \
+  "7Fy\377\2026Fx\377\2057Fy\377\1""6Ex\377\2025Dw\377\2036Ex\377\2025D" \
+  "w\377\2\33-g\377\30)d\377\224\31*e\377\3\27(c\377.=s\3773Bw\377\2021" \
+  "@u\377\2052Av\377\1""1Au\377\2020At\377\2051Au\377\2020@u\377\2%5m\377" \
+  "\30)d\377\231\31*e\377\5\27(d\377(8o\377.=s\377-<r\377,;q\377\205-<r" \
+  "\377\1,<r\377\202+<r\377\202,<r\377\3*;q\377\36/h\377\30)d\377\233\31" \
+  "*e\377\2\30)d\377\40""1j\377\203(8o\377\2'7o\377&6o\377\205'7o\377\2" \
+  "\35.h\377\30)d\377\240\31*e\377\204ES\203\377\2DR\203\377ES\203\377\211" \
+  "FT\203\377\4ES\202\377FT\203\377GU\204\377FT\203\377\210GU\204\377\7" \
+  "FU\204\377GU\204\377HT\203\377HU\204\377JW\205\3771@u\377\32+e\377\202" \
+  "\30)d\377\211\31*e\377\6\30)d\377\27(d\377\32+e\3773Bv\377FS\203\377" \
+  "HU\204\377\202IV\205\377\1HU\204\377\202IV\205\377\203HU\204\377\203" \
+  "IV\205\377\202JW\206\377\1IV\205\377\250JW\206\377\1IV\205\377\202JW" \
+  "\206\377\203IV\205\377\203HU\204\377\202IV\205\377\202HU\204\377\202" \
+  "IV\205\377\5GT\204\377@N\177\377&6n\377\27(d\377\30)d\377\212\31*e\377" \
+  "\11\30)d\377\31*e\377!1j\377@M\177\377HU\204\377GT\203\377HU\204\377" \
+  "GU\204\377FU\204\377\212GU\204\377\2FT\203\377ES\202\377\207FT\203\377" \
+  "\4ES\203\377FT\203\377ES\203\377DR\203\377\210ES\203\377\1CQ\201\377" \
+  "\205DR\202\377\1CQ\202\377\202DR\202\377\3""0@u\377\27(c\377\31)e\377" \
+  "\211\31*e\377\202\30)d\377\7\"2k\377BP\201\377AO\200\377BP\200\377BP" \
+  "\201\377BP\200\377BP\177\377\207BP\200\377\2AO\200\377@N\200\377\207" \
+  "AO\200\377\2@N\177\377\77M~\377\207@N\177\377\202\77M~\377\3""3Au\377" \
+  "\27(c\377\30)d\377\214\31*e\377\3\30)d\377\37/i\377<J|\377\205=K}\377" \
+  "\1;K}\377\207<K}\377\2;J|\377:I{\377\205;J|\377\3:I{\377;J|\3779Hz\377" \
+  "\204:I{\377\2)9o\377\30)d\377\220\31*e\377\3\30)d\377\35.h\3775Cx\377" \
+  "\2068Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377" \
+  "\2""0@u\377\27(c\377\224\31*e\377\5\30)d\377\32+f\3773Bw\3772Av\3771" \
+  "@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\4""0@u\3771Au\377\36/" \
+  "i\377\30)d\377\230\31*e\377\5\30)d\377\31*e\377+:q\377-<r\377,;q\377" \
+  "\206-<r\377\2,<r\377+<r\377\203,<r\377\3)9p\377\34-f\377\30)d\377\233" \
+  "\31*e\377\2\30)d\377$4l\377\203(8o\377\1&6o\377\206'7o\377\2\33,f\377" \
+  "\30)e\377\236\31*e\377\2\30)d\377\33,f\377\205ES\203\377\4DR\203\377" \
+  "ES\203\377FT\203\377ES\203\377\207FT\203\377\4ES\202\377FT\203\377GU" \
+  "\204\377FT\203\377\210GU\204\377\7FU\204\377GU\204\377HU\204\377GT\203" \
+  "\377IV\204\377=K|\377$4l\377\202\30)d\377\212\31*e\377\11\30)d\377\27" \
+  "(c\377\36.h\3772Au\377@M\177\377IV\205\377JW\205\377IV\205\377HU\204" \
+  "\377\203IV\205\377\202HU\204\377\203IV\205\377\246JW\206\377\1IV\205" \
+  "\377\203JW\206\377\203IV\205\377\203HU\204\377\203IV\205\377\11HU\204" \
+  "\377IV\205\377JW\206\377ES\203\377;I|\377)9p\377\30)d\377\27(c\377\30" \
+  ")d\377\212\31*e\377\6\27(d\377\33,f\377-<r\377ER\202\377IV\204\377HU" \
+  "\204\377\202GU\204\377\1FU\204\377\210GU\204\377\4FT\203\377GU\204\377" \
+  "FT\203\377ES\202\377\207FT\203\377\4ES\203\377FT\203\377ES\203\377DR" \
+  "\203\377\206ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377\205" \
+  "DR\202\377\5CQ\201\377ES\203\3777Ey\377\27(d\377\30)d\377\212\31*e\377" \
+  "\4\30)d\377\33,f\377:H{\377BO\200\377\202BP\201\377\2BP\200\377BP\177" \
+  "\377\206BP\200\377\3AO\200\377BP\200\377@N\200\377\206AO\200\377\202" \
+  "@N\177\377\1\77M~\377\207@N\177\377\5\77M~\377\77M}\377>L}\377\36.h\377" \
+  "\30)d\377\215\31*e\377\4\30)d\377.=s\377>L}\377<J|\377\202=K}\377\2<" \
+  "K}\377=K}\377\210<K}\377\1:I{\377\207;J|\377\2:I{\3779Hz\377\203:I{\377" \
+  "\3""6Fy\377\37/i\377\30)d\377\221\31*e\377\3%5m\3779G{\3777Ey\377\204" \
+  "8Fz\377\2027Fy\377\1""6Fx\377\2057Fy\377\2026Ex\377\1""5Dw\377\2036E" \
+  "x\377\4""5Dw\3777Fx\377%5m\377\30)d\377\224\31*e\377\5\30)d\377#3l\377" \
+  "3Bw\3772Av\3771@u\377\2052Av\377\2021Au\377\1""0At\377\2051Au\377\202" \
+  "0@u\377\2.>s\377\33,f\377\231\31*e\377\5\30)d\377\36.h\377,;r\377-<r" \
+  "\377,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203,<r\377\3(8o\377\31" \
+  "*e\377\30)d\377\232\31*e\377\202\30)d\377\1(8n\377\203(8o\377\1&6o\377" \
+  "\205'7o\377\2%5m\377\32+e\377\237\31*e\377\2\30)d\377\36.h\377\206ES" \
+  "\203\377\4DR\203\377ES\203\377FT\203\377ES\203\377\206FT\203\377\1ES" \
+  "\202\377\202FT\203\377\2GU\204\377FT\203\377\207GU\204\377\1FU\204\377" \
+  "\202GU\204\377\202HU\204\377\5IV\204\377DQ\201\3772Av\377\31+e\377\27" \
+  "(d\377\212\31*e\377\202\30)d\377\10\27(d\377\36/h\377)9p\377:I{\377I" \
+  "V\205\377JW\206\377IV\205\377HU\204\377\203IV\205\377\203HU\204\377\203" \
+  "IV\205\377\204JW\206\377\1IV\205\377\233JW\206\377\1IV\205\377\203JW" \
+  "\206\377\204IV\205\377\202HU\204\377\203IV\205\377\12HU\204\377IV\204" \
+  "\377IV\205\377KX\206\377ER\202\3772Av\377$4l\377\32*e\377\27(d\377\30" \
+  ")d\377\212\31*e\377\4\30)d\377\26(c\377$4l\377;J|\377\202HU\204\377\1" \
+  "HT\203\377\202GU\204\377\1FU\204\377\210GU\204\377\4FT\203\377GU\204" \
+  "\377FT\203\377ES\202\377\207FT\203\377\4ES\203\377FT\203\377ES\203\377" \
+  "DR\203\377\210ES\203\377\202DR\202\377\1CQ\201\377\204DR\202\377\5CQ" \
+  "\201\377ES\202\377;I|\377\34,g\377\30)d\377\214\31*e\377\7-<s\377AO\200" \
+  "\377BP\201\377BP\200\377BP\201\377BP\200\377BP\177\377\205BP\200\377" \
+  "\4AO\200\377BP\200\377AO\200\377@N\200\377\207AO\200\377\2@N\177\377" \
+  "\77M~\377\206@N\177\377\202\77M~\377\3@N\177\377.=s\377\27(c\377\215" \
+  "\31*e\377\3\30)d\377\34-g\377=J}\377\205=K}\377\207<K}\377\2;J|\377<" \
+  "K}\377\210;J|\377\1""9Hz\377\203:I{\377\2""9Hz\3771Au\377\202\30)d\377" \
+  "\220\31*e\377\2\30)d\3770\77u\377\2068Fz\377\2""7Fy\3776Fx\377\2067F" \
+  "y\377\2""6Ex\3775Dw\377\2066Ex\377\2\32+f\377\30)d\377\223\31*e\377\5" \
+  "\30)d\377\27(d\377,;r\3773Bw\3771@u\377\2062Av\377\2""1Au\3770At\377" \
+  "\2061Au\377\2020@u\377\2)9p\377\32+e\377\231\31*e\377\5\30)d\377\"2k" \
+  "\377-<r\377.=s\377,;q\377\206-<r\377\2,<r\377+<r\377\202,<r\377\4+;q" \
+  "\377%5m\377\30)d\377\30)e\377\232\31*e\377\7\30)d\377\33,g\377(8o\377" \
+  "'7n\377'7o\377(8o\377&6o\377\205'7o\377\1\"3l\377\240\31*e\377\2\30)" \
+  "d\377\40""0i\377\207ES\203\377\4DR\203\377ES\203\377FT\203\377ES\203" \
+  "\377\206FT\203\377\1ES\202\377\202FT\203\377\2GU\204\377FT\203\377\207" \
+  "GU\204\377\202FU\204\377\1GU\204\377\202HT\203\377\6HU\204\377GT\203" \
+  "\377AO\200\377%5l\377\27(c\377\30)d\377\212\31*e\377\203\30)d\377\5\32" \
+  "+e\377\37""0i\3774Bv\377GU\204\377JW\206\377\206IV\205\377\203HU\204" \
+  "\377\204IV\205\377\205JW\206\377\1IV\205\377\220JW\206\377\1IV\205\377" \
+  "\206JW\206\377\203IV\205\377\204HU\204\377\204IV\205\377\7HU\204\377" \
+  "IV\205\377JW\206\377@M\177\377)9p\377\33,f\377\31*e\377\202\30)d\377" \
+  "\213\31*e\377\4\30)d\377\31)e\3772@u\377ER\202\377\202HU\204\377\2HT" \
+  "\203\377GU\204\377\202FU\204\377\207GU\204\377\1FT\203\377\202GU\204" \
+  "\377\2FT\203\377ES\202\377\207FT\203\377\4ES\203\377FT\203\377ES\203" \
+  "\377DR\203\377\207ES\203\377\202DR\202\377\202CQ\201\377\206DR\202\377" \
+  "\3@N\177\377!1j\377\30)d\377\213\31*e\377\7\30)d\377\40""0i\377@N\200" \
+  "\377BP\201\377AO\200\377BP\201\377BP\200\377\202BP\177\377\206BP\200" \
+  "\377\2AO\200\377@N\200\377\206AO\200\377\3@N\177\377AO\200\377\77M~\377" \
+  "\206@N\177\377\203\77M~\377\3<K}\377\33,e\377\30)d\377\215\31*e\377\4" \
+  "\27(c\377/\77t\377=K}\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K" \
+  "}\377\206<K}\377\207;J|\377\2:I{\377;J|\377\203:I{\377\4""9Hz\377:I{" \
+  "\377$4m\377\27)d\377\220\31*e\377\3\30)d\377\35-g\3779G{\377\2058Fz\377" \
+  "\3""7Fy\3778Fz\3776Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2056Ex" \
+  "\377\2.>r\377\30)d\377\224\31*e\377\5\30)d\377\33,g\377/\77t\3772Av\377" \
+  "1@u\377\2062Av\377\2""1Au\3770At\377\2051Au\377\5""0@u\3771At\3770@u" \
+  "\377$4m\377\30)d\377\230\31*e\377\6\30)d\377\31*e\377&5m\377.=s\377-" \
+  "<r\377,;q\377\206-<r\377\1+<r\377\203,<r\377\3+;q\377\40""1i\377\30)" \
+  "d\377\233\31*e\377\2\30)d\377\40""0i\377\203(8o\377\2'7o\377&6o\377\203" \
+  "'7o\377\3&7o\377'7o\377\40""0j\377\240\31*e\377\2\30)d\377#3l\377\210" \
+  "ES\203\377\2DR\203\377ES\203\377\213FT\203\377\202GU\204\377\1FT\203" \
+  "\377\210GU\204\377\4FU\204\377GU\204\377HU\204\377HT\204\377\202HU\204" \
+  "\377\3""4Cw\377\34-g\377\31*e\377\202\30)d\377\213\31*e\377\7\30)d\377" \
+  "\27(d\377\30*e\377)9p\377\77L}\377FS\203\377GU\204\377\203IV\205\377" \
+  "\1HU\204\377\205IV\205\377\206HU\204\377\223IV\205\377\205HU\204\377" \
+  "\205IV\205\377\1HU\204\377\203IV\205\377\7HU\204\377GT\203\377ES\202" \
+  "\3775Dw\377!1j\377\27(d\377\30)d\377\214\31*e\377\202\30)d\377\7\31*" \
+  "e\377#3k\377AO\177\377IV\205\377HU\204\377HT\203\377GU\204\377\202FU" \
+  "\204\377\210GU\204\377\3FT\203\377GU\204\377FT\203\377\202ES\202\377" \
+  "\207FT\203\377\4ES\203\377FT\203\377ES\203\377DR\203\377\206ES\203\377" \
+  "\4DR\202\377ES\203\377DR\202\377CQ\201\377\205DR\202\377\4CQ\201\377" \
+  "DR\202\377BP\201\377*:p\377\202\30)d\377\212\31*e\377\5\30)d\377\31*" \
+  "e\377;I|\377BP\201\377AO\200\377\202BP\200\377\1BP\177\377\210BP\200" \
+  "\377\2AO\200\377@N\200\377\207AO\200\377\1\77M~\377\207@N\177\377\4\77" \
+  "M~\377>L}\377@N~\377)9p\377\216\31*e\377\4\30)d\377\34.g\377=K}\377<" \
+  "J|\377\204=K}\377\2<K}\377;K}\377\207<K}\377\2;J|\377:I{\377\204;J|\377" \
+  "\2:I{\377;J|\377\205:I{\377\3""8Gy\377\27)c\377\30)d\377\220\31*e\377" \
+  "\2\27(d\377*:q\377\2058Fz\377\3""7Fy\3778Fz\3776Fx\377\2077Fy\377\1""5" \
+  "Dw\377\2056Ex\377\3""7Fx\377#4l\377\30)d\377\224\31*e\377\5\30)d\377" \
+  "!2j\3771@v\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377" \
+  "\4/\77u\377.>t\377\37""0i\377\30)d\377\230\31*e\377\5\30)d\377\32+f\377" \
+  ")8p\377.=s\377,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\202" \
+  "+;q\377\2\33,f\377\30)d\377\232\31*e\377\3\30)e\377\30)d\377#3l\377\203" \
+  "(8o\377\207'7o\377\2\35/h\377\30)d\377\236\31*e\377\5\30)d\377\32*e\377" \
+  "#3l\377ES\203\377DR\202\377\207ES\203\377\4DR\203\377ES\203\377FT\203" \
+  "\377ES\203\377\207FT\203\377\1ES\202\377\202FT\203\377\2GU\204\377FT" \
+  "\203\377\210GU\204\377\1FU\204\377\202GU\204\377\10HT\203\377HU\204\377" \
+  "JW\205\377CP\201\377,;q\377\35.g\377\27(d\377\30)d\377\214\31*e\377\12" \
+  "\30)d\377\27(c\377\26'c\377\37""0i\377-<s\3779Gz\377@N\177\377FT\203" \
+  "\377KW\206\377JW\205\377\202IV\205\377\1HU\205\377\207IV\205\377\223" \
+  "HU\204\377\207IV\205\377\1HU\204\377\202IV\205\377\10JW\206\377IV\205" \
+  "\377DQ\201\377=K}\3774Cw\377'7n\377\30*e\377\26'c\377\202\30)d\377\214" \
+  "\31*e\377\202\30)d\377\5#3k\3776Ex\377IV\205\377HU\204\377GT\203\377" \
+  "\202GU\204\377\1FU\204\377\211GU\204\377\4FT\203\377GU\204\377FT\203" \
+  "\377ES\202\377\207FT\203\377\1ES\203\377\202FT\203\377\2ES\203\377DR" \
+  "\203\377\206ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377\206" \
+  "DR\202\377\5CQ\201\377ER\202\3770@u\377\27(d\377\30)d\377\212\31*e\377" \
+  "\202\30)d\377\7""1@u\377CQ\202\377AO\200\377BP\200\377BP\201\377BP\200" \
+  "\377BP\177\377\207BP\200\377\2AO\200\377@N\200\377\205AO\200\377\4@N" \
+  "\177\377AO\200\377@N\177\377\77M~\377\205@N\177\377\7\77M~\377@N\177" \
+  "\377>L}\377\77M~\3778Gy\377\34-g\377\30)d\377\214\31*e\377\4\30)d\377" \
+  "\27(d\377/>t\377<J|\377\204=K}\377\202<K}\377\1;K}\377\206<K}\377\2;" \
+  "J|\377:I{\377\206;J|\377\204:I{\377\4""9Hz\377;J|\377'7n\377\27(d\377" \
+  "\220\31*e\377\3\30)d\377\31*e\3777Dy\377\2068Fz\377\2""7Fy\3776Fx\377" \
+  "\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2056Ex\377\2""4Cv\377\34-g\377\224" \
+  "\31*e\377\202\30)d\377\3'7n\3773Bw\3771@u\377\2072Av\377\1""0At\377\207" \
+  "1Au\377\4/\77u\377,<r\377\33,f\377\30)d\377\230\31*e\377\5\30)d\377\34" \
+  "-g\377,<r\377.=s\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\3*" \
+  ":p\377\27)d\377\30)d\377\232\31*e\377\6\30)d\377\31*d\377&6m\377'7n\377" \
+  "'7o\377(8o\377\206'7o\377\3%6n\377\34-g\377\30)d\377\236\31*e\377\6\30" \
+  ")d\377\34-g\377#3l\377DR\202\377ES\203\377DR\202\377\207ES\203\377\4" \
+  "DR\203\377ES\203\377FT\203\377ES\203\377\207FT\203\377\1ES\202\377\202" \
+  "FT\203\377\2GU\204\377FT\203\377\210GU\204\377\202FU\204\377\3GU\204" \
+  "\377HU\204\377GT\203\377\202HU\204\377\5>L~\377-<r\377\30)d\377\27(c" \
+  "\377\31*d\377\214\31*e\377\202\30)d\377\12\27(d\377\30)d\377\36/h\377" \
+  "%5m\377-=s\3778Fz\377CP\201\377KX\207\377KX\206\377JW\206\377\202IV\205" \
+  "\377\1HU\204\377\231IV\205\377\13HU\204\377IV\205\377JW\205\377KW\206" \
+  "\377LY\207\377HU\204\377>L~\3773Bw\377)9p\377\"2k\377\34,f\377\202\27" \
+  "(d\377\1\30)d\377\215\31*e\377\10\30)d\377\26'b\377\40""0j\3776Dx\377" \
+  "DQ\201\377IV\204\377HU\204\377HT\204\377\202GU\204\377\1FU\204\377\210" \
+  "GU\204\377\1FT\203\377\202GU\204\377\2FT\203\377ES\202\377\207FT\203" \
+  "\377\2ES\203\377FT\203\377\202ES\203\377\1DR\203\377\210ES\203\377\202" \
+  "DR\202\377\1CQ\201\377\205DR\202\377\5CQ\201\377FT\203\3773Bv\377\31" \
+  "*e\377\30)d\377\213\31*e\377\4\27(c\377*9p\377BP\201\377AO\200\377\202" \
+  "BP\201\377\2BP\200\377BP\177\377\206BP\200\377\203AO\200\377\1@N\200" \
+  "\377\206AO\200\377\202@N\177\377\1\77M~\377\206@N\177\377\202\77M~\377" \
+  "\2>L}\377)9p\377\202\30)d\377\214\31*e\377\3\30)d\377\37""0i\3779Hz\377" \
+  "\204=K}\377\202<K}\377\1;K}\377\206<K}\377\202;J|\377\1:I{\377\206;J" \
+  "|\377\2:I{\3779Hz\377\203:I{\377\3""9Gz\377\32+e\377\30)d\377\220\31" \
+  "*e\377\4\27(d\377%5m\3778Fz\3777Ey\377\2058Fz\377\2107Fy\377\2""6Ex\377" \
+  "5Dw\377\2036Ex\377\4""5Dw\3776Ex\377-<q\377\32+e\377\224\31*e\377\5\30" \
+  ")d\377\33+f\377,<r\3773Bw\3771@u\377\2052Av\377\3""1Au\3772Av\3770At" \
+  "\377\2051Au\377\4""0@u\3771Au\377/\77t\377)9p\377\202\30)d\377\231\31" \
+  "*e\377\4\40""0i\377.=s\377-<r\377,;q\377\206-<r\377\205,<r\377\2$4l\377" \
+  "\30)d\377\233\31*e\377\3\30)d\377\33,g\377&6n\377\202(8o\377\207'7o\377" \
+  "\3$4m\377\32+f\377\30)d\377\236\31*e\377\7\30)d\377\37/h\377#3l\377C" \
+  "Q\201\377DR\202\377ES\203\377DR\202\377\207ES\203\377\4DR\203\377ES\203" \
+  "\377FT\203\377ES\203\377\207FT\203\377\202ES\202\377\3FT\203\377GU\204" \
+  "\377FT\203\377\214GU\204\377\1HT\204\377\202HU\204\377\4GT\203\377AO" \
+  "\200\377(8o\377\27(d\377\202\30)d\377\214\31*e\377\1\31)d\377\203\30" \
+  ")d\377\13\31*e\377\32+f\377\33,f\377\36/h\377*9p\3774Dw\377\77M\177\377" \
+  "IV\205\377JW\206\377JW\205\377JV\205\377\203IV\205\377\1HU\204\377\221" \
+  "IV\205\377\12JW\205\377JW\206\377KX\206\377FR\203\377;I{\3770\77t\377" \
+  "#4l\377\34-g\377\33,f\377\31*e\377\204\30)d\377\215\31*e\377\6\30)d\377" \
+  "\27(d\377\33,f\3775Cx\377ER\202\377GT\203\377\202HU\204\377\1HT\203\377" \
+  "\202GU\204\377\1FU\204\377\212GU\204\377\202FT\203\377\1ES\202\377\211" \
+  "FT\203\377\1ES\203\377\202DR\203\377\207ES\203\377\202DR\202\377\202" \
+  "CQ\201\377\205DR\202\377\5CQ\201\377ES\203\3777Ey\377\32+f\377\30)d\377" \
+  "\213\31*e\377\7\30)d\377!1j\377=L~\377BP\201\377AO\200\377BP\200\377" \
+  "BP\201\377\211BP\200\377\2AO\200\377@N\200\377\207AO\200\377\2@N\177" \
+  "\377\77M~\377\205@N\177\377\2\77M~\377@N\177\377\202\77M~\377\3""9Gy" \
+  "\377\32+e\377\30)d\377\216\31*e\377\1,;r\377\206=K}\377\2<K}\377;K}\377" \
+  "\205<K}\377\202;J|\377\1:I{\377\206;J|\377\1:I{\377\2029Hz\377\5:I{\377" \
+  "9Hz\377;J{\377*:p\377\30)d\377\220\31*e\377\3\30)d\377\27)d\3770\77u" \
+  "\377\2058Fz\377\2""7Fy\3778Fz\377\2107Fy\377\2066Ex\377\3""5Dx\377%5" \
+  "m\377\30)d\377\224\31*e\377\2\30)d\377\35.h\377\2022Av\377\1""1@u\377" \
+  "\2062Av\377\2""1Au\3770At\377\2061Au\377\4""0@u\377/\77t\377\"3l\377" \
+  "\30)d\377\232\31*e\377\2&5m\377.=s\377\210-<r\377\205,<r\377\2\36/h\377" \
+  "\30)d\377\233\31*e\377\3\30)d\377\36/h\377'7n\377\202(8o\377\2'7o\377" \
+  "&6o\377\205'7o\377\3#3l\377\30)e\377\30)d\377\236\31*e\377\10\30)d\377" \
+  "!1k\377#3l\377DR\202\377CQ\201\377DR\202\377ES\203\377DR\202\377\207" \
+  "ES\203\377\2DR\203\377ES\203\377\212FT\203\377\1ES\202\377\202FT\203" \
+  "\377\2GU\204\377FT\203\377\211GU\204\377\202FU\204\377\202GU\204\377" \
+  "\7GT\203\377HU\204\377IV\204\377\77M~\377%5m\377\33,f\377\31*e\377\202" \
+  "\30)d\377\220\31*e\377\202\30)d\377\11\27(d\377\27(c\377\27(d\377\36" \
+  "/i\377'7n\377/>t\3776Ex\377=K}\377BP\200\377\202ER\202\377\1FS\202\377" \
+  "\211FS\203\377\11ES\202\377ER\202\377DR\202\377@N\177\377:H{\3774Bw\377" \
+  "+;r\377#3k\377\32+f\377\202\27(c\377\203\30)d\377\220\31*e\377\202\30" \
+  ")d\377\4\31*e\377\34-g\3770\77t\377GT\203\377\204HU\204\377\2GU\204\377" \
+  "FU\204\377\211GU\204\377\1FT\203\377\202GU\204\377\2FT\203\377ES\202" \
+  "\377\210FT\203\377\4ES\203\377FT\203\377ES\203\377DR\203\377\207ES\203" \
+  "\377\4DR\202\377ES\203\377DR\202\377CQ\201\377\206DR\202\377\5CQ\201" \
+  "\377DR\202\377;J|\377\35.h\377\30)d\377\213\31*e\377\5\30)d\377\33,f" \
+  "\3776Ey\377BP\201\377AO\200\377\202BP\201\377\2BP\200\377BP\177\377\205" \
+  "BP\200\377\4AO\200\377BP\200\377AO\200\377@N\200\377\207AO\200\377\2" \
+  "@N\177\377\77M~\377\207@N\177\377\5\77M~\377>L}\377\77L~\377&5m\377\27" \
+  "(d\377\215\31*e\377\3\30)d\377\36.h\3779Gz\377\205=K}\377\2<K}\377;K" \
+  "}\377\205<K}\377\3;J|\377<K}\377:I{\377\207;J|\377\2:I{\3779Hz\377\203" \
+  ":I{\377\3""9Hz\377\37/i\377\30)d\377\220\31*e\377\4\30)d\377\37""0i\377" \
+  "5Cx\3777Ez\377\2058Fz\377\2""7Fy\3776Fx\377\2077Fy\377\2066Ex\377\3""2" \
+  "Bv\377\36/h\377\30)d\377\225\31*e\377\2$3l\3774Cw\377\2062Av\377\2""1" \
+  "Au\3772Av\377\2061Au\377\6""0@u\3771Au\3770@u\377/\77t\377\34,f\377\30" \
+  ")d\377\230\31*e\377\4\30)d\377\31*e\377+:q\377.=s\377\210-<r\377\205" \
+  ",<r\377\2\31*e\377\30)d\377\232\31*e\377\202\30)d\377\1!1j\377\203(8" \
+  "o\377\2'7o\377&6o\377\204'7o\377\3&6n\377!1k\377\30)d\377\236\31*e\377" \
+  "\4\30)d\377\31*e\377\"2k\377#3l\377\202DR\202\377\4CQ\201\377DR\202\377" \
+  "ES\203\377DR\202\377\207ES\203\377\4DR\203\377ES\203\377FT\203\377ES" \
+  "\203\377\210FT\203\377\202ES\202\377\3FT\203\377GU\204\377FT\203\377" \
+  "\212GU\204\377\1FU\204\377\202GU\204\377\203HU\204\377\4JW\206\377=K" \
+  "}\377*:q\377\37/i\377\203\30)d\377\222\31*e\377\202\30)d\377\2\27(d\377" \
+  "\27(c\377\202\26'c\377\7\25'b\377\27(d\377\33+f\377\35.g\377\40""0i\377" \
+  "!1j\377\"3k\377\202#3l\377\10#3k\377\"2k\377\40""1j\377\36/h\377\34-" \
+  "g\377\31*e\377\26'c\377\25'b\377\202\26'c\377\1\27(c\377\203\30)d\377" \
+  "\222\31*e\377\12\30)d\377\27(d\377\32+e\377$4l\3772Au\377FS\202\377J" \
+  "W\205\377HU\204\377HT\203\377HU\204\377\202GU\204\377\1FU\204\377\211" \
+  "GU\204\377\2FT\203\377GU\204\377\202FT\203\377\1ES\202\377\210FT\203" \
+  "\377\4ES\203\377FT\203\377ES\203\377DR\203\377\207ES\203\377\4DR\202" \
+  "\377ES\203\377DR\202\377CQ\201\377\206DR\202\377\5CQ\201\377DR\202\377" \
+  ">M~\377!2j\377\30)d\377\214\31*e\377\5\30)d\377/>t\377CQ\202\377AO\200" \
+  "\377BP\201\377\202BP\200\377\1BP\177\377\205BP\200\377\4AO\200\377BP" \
+  "\200\377AO\200\377@N\200\377\206AO\200\377\3@N\177\377AO\200\377\77M" \
+  "~\377\206@N\177\377\203\77M~\377\4@N~\3774Cw\377\27(c\377\31)e\377\215" \
+  "\31*e\377\4\30)d\377,:q\377>L~\377<J|\377\202=K}\377\3<K}\377=K}\377" \
+  ";K}\377\207<K}\377\2;J|\377:I{\377\207;J|\377\1""9Hz\377\204:I{\377\2" \
+  ".\77s\377\32+e\377\220\31*e\377\202\30)d\377\1(7o\377\2058Fz\377\4""7" \
+  "Fy\3778Fz\3777Fy\3776Fx\377\2047Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377" \
+  "\2046Ex\377\2""5Dw\377.>s\377\202\30)d\377\225\31*e\377\2,<r\3773Bw\377" \
+  "\2072Av\377\2101Au\377\2020@u\377\3,<r\377\27(d\377\30)d\377\230\31*" \
+  "e\377\3\30)d\377\34,g\377/=t\377\210-<r\377\2,<r\377+<r\377\203,<r\377" \
+  "\2&7o\377\30)d\377\233\31*e\377\10\30)d\377\31*e\377#4l\377(8o\377'7" \
+  "o\377(8o\377'7o\377&6o\377\204'7o\377\3&6n\377\36.h\377\30)d\377\236" \
+  "\31*e\377\4\30)d\377\33+f\377\"2k\377#3l\377\203DR\202\377\4CQ\201\377" \
+  "DR\202\377ES\203\377DR\202\377\207ES\203\377\2DR\203\377ES\203\377\202" \
+  "FT\203\377\1ES\203\377\210FT\203\377\2ES\202\377FT\203\377\202GU\204" \
+  "\377\1FT\203\377\211GU\204\377\202FU\204\377\202GU\204\377\2HT\203\377" \
+  "HU\203\377\202HU\204\377\3AN\177\3775Dx\377$5m\377\202\27(c\377\2\30" \
+  ")d\377\30)e\377\225\31*e\377\1\30)e\377\217\30)d\377\227\31*e\377\12" \
+  "\30)d\377\26'c\377\34-f\377,;r\377;I{\377ER\202\377IV\204\377HU\204\377" \
+  "GT\203\377HU\204\377\202GU\204\377\202FU\204\377\211GU\204\377\2FT\203" \
+  "\377GU\204\377\202FT\203\377\1ES\202\377\212FT\203\377\2ES\203\377DR" \
+  "\203\377\211ES\203\377\202DR\202\377\1CQ\201\377\205DR\202\377\5CQ\201" \
+  "\377DR\202\377AP\200\377\"2k\377\27(d\377\214\31*e\377\2\26'c\377*:q" \
+  "\377\202BP\201\377\1AO\200\377\202BP\200\377\1BP\177\377\207BP\200\377" \
+  "\202AO\200\377\1@N\200\377\205AO\200\377\4@N\177\377AO\200\377@N\177" \
+  "\377\77M~\377\207@N\177\377\202\77M~\377\3=L}\377\34-g\377\30)d\377\215" \
+  "\31*e\377\3\30)d\377\35-g\377<J|\377\205=K}\377\207<K}\377\3;J|\377<" \
+  "K}\377:I{\377\206;J|\377\3:I{\377;J|\3779Hz\377\203:I{\377\3""8Gz\377" \
+  "$5m\377\30)d\377\220\31*e\377\3\30)d\377\33,f\3771@u\377\2068Fz\377\202" \
+  "7Fy\377\1""6Fx\377\2057Fy\377\2026Ex\377\1""5Dw\377\2046Ex\377\3""5D" \
+  "w\377%5l\377\27(d\377\224\31*e\377\5\30)d\377\33,f\3773Bw\3772Av\377" \
+  "1@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\2020@u\377\2#4l\377\30" \
+  ")d\377\231\31*e\377\5\30)d\377#3k\377.=s\377-<r\377,;q\377\206-<r\377" \
+  "\7,<r\377+<r\377,<r\377+;q\377,<r\377\40""1j\377\30)d\377\233\31*e\377" \
+  "\3\30)d\377\33,f\377%5m\377\202(8o\377\202'7o\377\1&6o\377\203'7o\377" \
+  "\202&6n\377\2\32+f\377\30)d\377\236\31*e\377\4\30)d\377\35-g\377\"2k" \
+  "\377#3l\377\204DR\202\377\4CQ\201\377DR\202\377ES\203\377DR\202\377\207" \
+  "ES\203\377\1DR\203\377\202ES\203\377\2FT\203\377ES\203\377\213FT\203" \
+  "\377\2GU\204\377FT\203\377\212GU\204\377\1FU\204\377\203GU\204\377\1" \
+  "HT\204\377\202HU\204\377\7GT\203\377FS\202\377@N\177\377,<r\377\32+e" \
+  "\377\27(d\377\30)d\377\270\31*e\377\202\30)d\377\5\26(c\377\40""0i\377" \
+  "6Ex\377DQ\201\377FT\203\377\203HU\204\377\1HT\203\377\203GU\204\377\1" \
+  "FU\204\377\212GU\204\377\2FT\203\377GU\204\377\202FT\203\377\1ES\202" \
+  "\377\210FT\203\377\204ES\203\377\1DR\203\377\207ES\203\377\202DR\202" \
+  "\377\202CQ\201\377\205DR\202\377\4CQ\201\377DR\202\377CQ\201\377\40""1" \
+  "j\377\202\30)d\377\213\31*e\377\11\27(d\377$4l\377@N\200\377BP\201\377" \
+  "AO\200\377BP\200\377BP\201\377BP\200\377BP\177\377\207BP\200\377\2AO" \
+  "\200\377@N\200\377\207AO\200\377\2@N\177\377\77M~\377\206@N\177\377\6" \
+  "\77M~\377@N\177\377>L}\377@N\177\377)8o\377\31)d\377\216\31*e\377\4\26" \
+  "'c\3772Av\377=K}\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377" \
+  "\206<K}\377\211;J|\377\2:I{\3779Hz\377\203:I{\377\3""5Dw\377\32*e\377" \
+  "\30)d\377\221\31*e\377\1\40""0j\377\2078Fz\377\2""7Fy\3776Fx\377\206" \
+  "7Fy\377\2""6Ex\3775Dw\377\2046Ex\377\4""5Dw\3776Ex\377\32+e\377\30)d" \
+  "\377\224\31*e\377\5\30)d\377%5m\3774Cw\3772Av\3771@u\377\2042Av\377\4" \
+  "1Au\3772Av\3771Au\3770At\377\2041Au\377\6""0@u\3771Au\3770@t\3771Av\377" \
+  "\33,f\377\30)d\377\231\31*e\377\5\27(d\377*9p\377.=s\377-<r\377,;q\377" \
+  "\204-<r\377\4,<r\377-<r\377,<r\377+<r\377\203,<r\377\2\34-f\377\30)d" \
+  "\377\233\31*e\377\3\30)d\377\34-g\377'8n\377\202(8o\377\2'7o\377&6o\377" \
+  "\205'7o\377\1%5m\377\202\30)d\377\236\31*e\377\2\30)d\377\37/i\377\202" \
+  "#3l\377\205DR\202\377\4CQ\201\377DR\202\377ES\203\377DR\202\377\210E" \
+  "S\203\377\2DR\203\377ES\203\377\202FT\203\377\1ES\203\377\210FT\203\377" \
+  "\202ES\202\377\1FT\203\377\202GU\204\377\1FT\203\377\212GU\204\377\202" \
+  "FU\204\377\202GU\204\377\11HU\204\377HT\203\377HU\204\377IV\204\377G" \
+  "U\204\3777Fy\377$4m\377\33,f\377\32+e\377\204\30)d\377\255\31*e\377\203" \
+  "\30)d\377\6\31*e\377\32+f\377\36.h\377,;q\377@N\177\377JW\205\377\202" \
+  "HU\204\377\1HT\203\377\203GU\204\377\202FU\204\377\212GU\204\377\2FT" \
+  "\203\377GU\204\377\202FT\203\377\1ES\202\377\211FT\203\377\4ES\203\377" \
+  "FT\203\377ES\203\377DR\203\377\210ES\203\377\4DR\202\377ES\203\377DR" \
+  "\202\377CQ\201\377\206DR\202\377\5CQ\201\377DR\202\377AP\200\377#4l\377" \
+  "\30)d\377\214\31*e\377\5\30)d\377\36/i\377=K}\377BP\201\377BP\200\377" \
+  "\202BP\201\377\1BP\177\377\210BP\200\377\2AO\200\377@N\200\377\210AO" \
+  "\200\377\2@N\177\377\77M~\377\207@N\177\377\5>L}\377\77M~\3776Ex\377" \
+  "\34-g\377\30)d\377\214\31*e\377\5\31*d\377\30)d\377\"2k\377=K}\377<J" \
+  "|\377\204=K}\377\2<K}\377;K}\377\207<K}\377\2;J|\377:I{\377\206;J|\377" \
+  "\204:I{\377\4""9Hz\377:I{\377(8o\377\27(d\377\222\31*e\377\3-<r\3778" \
+  "Fz\3777Ez\377\2048Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2026Ex\377\1""5" \
+  "Dw\377\2036Ex\377\4""5Dw\3776Ex\377+;p\377\27(d\377\224\31*e\377\5\30" \
+  ")d\377\27(d\377/\77t\3773Av\3771@u\377\2062Av\377\2""1Au\3770At\377\206" \
+  "1Au\377\2020@u\377\2+;q\377\30)d\377\231\31*e\377\5\30)d\377\32+f\377" \
+  ".=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\2)9p\377" \
+  "\32+f\377\235\31*e\377\6\37/h\377(8o\377'7n\377(8o\377'7o\377&6o\377" \
+  "\205'7o\377\2!2k\377\30)d\377\236\31*e\377\3\30)d\377\31*e\377\40""0" \
+  "j\377\202#3l\377\206DR\202\377\2CQ\201\377DR\202\377\202ES\203\377\1" \
+  "DR\202\377\207ES\203\377\1DR\203\377\202ES\203\377\2FT\203\377ES\203" \
+  "\377\211FT\203\377\1ES\202\377\202FT\203\377\2GU\204\377FT\203\377\213" \
+  "GU\204\377\1FU\204\377\203GU\204\377\12HU\204\377HT\203\377HU\204\377" \
+  "IV\204\377JW\205\377CP\201\3775Dw\377)9p\377\"2k\377\33,f\377\202\27" \
+  "(d\377\202\30)d\377\246\31*e\377\203\30)d\377\13\27(c\377\30)d\377\36" \
+  "/i\377$5m\377.=r\377;I{\377GT\204\377JW\205\377HU\204\377GT\203\377H" \
+  "U\204\377\203GU\204\377\202FU\204\377\213GU\204\377\2FT\203\377GU\204" \
+  "\377\202FT\203\377\202ES\202\377\212FT\203\377\2ES\203\377DR\203\377" \
+  "\210ES\203\377\4DR\202\377ES\203\377DR\202\377CQ\201\377\206DR\202\377" \
+  "\4CQ\201\377DR\202\377AO\200\377'7o\377\202\30)d\377\213\31*e\377\6\30" \
+  ")d\377\33,f\3776Ey\377BP\201\377AO\200\377BP\201\377\202BP\200\377\1" \
+  "BP\177\377\206BP\200\377\3AO\200\377BP\200\377@N\200\377\207AO\200\377" \
+  "\202@N\177\377\1\77M~\377\205@N\177\377\10\77M~\377@N\177\377\77M~\377" \
+  ">L}\377=K}\377&6m\377\30)d\377\31)e\377\214\31*e\377\4\30)d\377\31*e" \
+  "\3774Cw\377<J|\377\204=K}\377\202<K}\377\1;K}\377\206<K}\377\2;J|\377" \
+  ":I{\377\205;J|\377\4:I{\377;J|\377:I{\3779Hz\377\203:I{\377\3""7Fy\377" \
+  "\31+e\377\30)d\377\220\31*e\377\2\30)d\377\33,f\377\2068Fz\377\3""7F" \
+  "y\3778Fz\3776Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2056Ex\377\3" \
+  "7Fy\377\36/h\377\30)d\377\224\31*e\377\5\30)d\377\35.h\3773Bw\3772Av" \
+  "\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\4""0@t\3771Au\377" \
+  "#3l\377\30)d\377\231\31*e\377\5\30)d\377!1j\377.=s\377-<r\377,;q\377" \
+  "\206-<r\377\6,<r\377+<r\377,<r\377+;q\377,<r\377%5m\377\236\31*e\377" \
+  "\1#3k\377\202(8o\377\202'7o\377\1&6o\377\203'7o\377\4&6o\377'7o\377\35" \
+  ".h\377\30)d\377\236\31*e\377\3\30)d\377\32+f\377!1j\377\202#3l\377\207" \
+  "DR\202\377\1CQ\201\377\202DR\202\377\2ES\203\377DR\202\377\207ES\203" \
+  "\377\202DR\203\377\3ES\203\377FT\203\377ES\203\377\210FT\203\377\202" \
+  "ES\202\377\202FT\203\377\2GU\204\377FT\203\377\213GU\204\377\203FU\204" \
+  "\377\202GU\204\377\204HU\204\377\202IV\204\377\10CP\200\377<J|\3775D" \
+  "x\377+:q\377\40""1j\377\30)d\377\26'c\377\27(c\377\202\30)d\377\236\31" \
+  "*e\377\202\30)d\377\1\27(d\377\202\26'c\377\7\33+f\377%5m\377/\77t\377" \
+  "9Gz\377\77M~\377FS\202\377IV\205\377\202HU\204\377\2HT\203\377HU\204" \
+  "\377\203GU\204\377\202FU\204\377\213GU\204\377\1FT\203\377\202GU\204" \
+  "\377\1FT\203\377\202ES\202\377\211FT\203\377\204ES\203\377\1DR\203\377" \
+  "\207ES\203\377\2DR\202\377ES\203\377\202DR\202\377\1CQ\201\377\205DR" \
+  "\202\377\4CQ\201\377DR\202\377CQ\201\377&5m\377\202\30)d\377\213\31*" \
+  "e\377\11\30)e\377\27)c\3774Bw\377BQ\201\377BP\201\377AO\200\377BP\201" \
+  "\377BP\200\377BP\177\377\206BP\200\377\4AO\200\377BP\200\377AO\200\377" \
+  "@N\200\377\206AO\200\377\202@N\177\377\1\77M~\377\207@N\177\377\203\77" \
+  "M~\377\1""2Bv\377\202\30)d\377\215\31*e\377\3\30)d\377&5m\377<J|\377" \
+  "\204=K}\377\202<K}\377\1;K}\377\206<K}\377\202;J|\377\1:I{\377\206;J" \
+  "|\377\202:I{\377\6""9Hz\377:I{\3779Hz\377;J|\377'7n\377\27(d\377\221" \
+  "\31*e\377\4\27(c\377+:p\3779Fz\3777Ey\377\2058Fz\377\2""7Fy\3776Fx\377" \
+  "\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""0\77t\377\30)d\377\31*d\377" \
+  "\224\31*e\377\5\27(c\377(8p\3773Bw\3772Av\3771@u\377\2052Av\377\2021" \
+  "Au\377\1""0At\377\2051Au\377\2020@u\377\3/\77u\377\34-g\377\30)d\377" \
+  "\230\31*e\377\6\30)d\377\27)d\377(7o\377.=s\377-<r\377,;q\377\206-<r" \
+  "\377\2,<r\377+<r\377\203,<r\377\2!1j\377\30)d\377\235\31*e\377\1'7n\377" \
+  "\202(8o\377\2'7o\377&6o\377\204'7o\377\4'7n\377'7o\377\31*e\377\30)d" \
+  "\377\236\31*e\377\3\30)d\377\33,f\377\"2k\377\202#3l\377\2DR\202\377" \
+  "CQ\201\377\206DR\202\377\202CQ\201\377\1DR\202\377\211ES\203\377\202" \
+  "DR\203\377\3ES\203\377FT\203\377ES\203\377\211FT\203\377\202ES\202\377" \
+  "\1FT\203\377\202GU\204\377\1FT\203\377\214GU\204\377\1FU\204\377\203" \
+  "GU\204\377\202HU\204\377\1HT\203\377\203HU\204\377\13GT\204\377FS\203" \
+  "\377ER\202\377CP\201\377:G{\377.=s\377#4l\377\31*e\377\26(c\377\27(d" \
+  "\377\27)d\377\203\30)d\377\223\31*e\377\203\30)d\377\1\27(d\377\202\27" \
+  "(c\377\7\35-g\377(8o\3772Bv\377\77L~\377ER\202\377FS\202\377GT\203\377" \
+  "\206HU\204\377\203GU\204\377\202FU\204\377\214GU\204\377\2FT\203\377" \
+  "GU\204\377\202FT\203\377\1ES\202\377\211FT\203\377\1ES\203\377\202FT" \
+  "\203\377\1ES\203\377\202DR\203\377\207ES\203\377\2DR\202\377ES\203\377" \
+  "\202DR\202\377\1CQ\201\377\205DR\202\377\4CQ\201\377DR\202\377CQ\201" \
+  "\377!2j\377\202\30)d\377\214\31*e\377\2\26(c\3772@v\377\202BP\201\377" \
+  "\1AO\200\377\202BP\200\377\202BP\177\377\205BP\200\377\4AO\200\377BP" \
+  "\200\377AO\200\377@N\200\377\206AO\200\377\4@N\177\377AO\200\377@N\177" \
+  "\377\77M~\377\207@N\177\377\202\77M~\377\3>L}\377\33+g\377\30)d\377\216" \
+  "\31*e\377\2\33,f\3775Cw\377\204=K}\377\4<K}\377=K}\377<K}\377;K}\377" \
+  "\205<K}\377\202;J|\377\1:I{\377\207;J|\377\2:I{\3779Hz\377\203:I{\377" \
+  "\3""7Fx\377\31*e\377\30)d\377\220\31*e\377\3\30)d\377\32+f\3777Ey\377" \
+  "\2058Fz\377\3""7Fy\3778Fz\3776Fx\377\2077Fy\377\1""5Dw\377\2046Ex\377" \
+  "\4""5Dw\3777Fy\377#4k\377\30)d\377\224\31*e\377\5\30)d\377\31*e\377/" \
+  ">t\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\2020@u\377" \
+  "\2*:q\377\32+f\377\231\31*e\377\4\30)d\377\32+f\377+:q\377-<r\377\202" \
+  ",;q\377\205-<r\377\1,<r\377\202+<r\377\202,<r\377\3*:q\377\35.h\377\30" \
+  ")d\377\233\31*e\377\2\30)d\377\33,g\377\203(8o\377\2'7o\377&6o\377\205" \
+  "'7o\377\2$4m\377\30)d\377\240\31*e\377\1\34-g\377\203#3l\377\1""3Bu\377" \
+  "\202DR\202\377\1CQ\201\377\206DR\202\377\4CQ\201\377DR\202\377ES\203" \
+  "\377DR\202\377\210ES\203\377\202DR\203\377\1ES\203\377\202FT\203\377" \
+  "\1ES\203\377\210FT\203\377\202ES\202\377\202FT\203\377\202GU\204\377" \
+  "\1FT\203\377\215GU\204\377\202FU\204\377\204GU\204\377\202HU\204\377" \
+  "\1HT\203\377\202HU\204\377\1IU\204\377\202IV\205\377\7CP\200\377:H{\377" \
+  "2@u\377)9p\377#2k\377\36.g\377\34-g\377\202\33,f\377\1\33+f\377\202\32" \
+  "+f\377\207\32+e\377\202\32+f\377\202\33,f\377\12\34,g\377\34-g\377\37" \
+  "0i\377&6n\377-=r\3775Dx\377>K}\377GT\203\377JW\205\377IV\204\377\202" \
+  "HU\204\377\1GT\203\377\202HU\204\377\204GU\204\377\203FU\204\377\217" \
+  "GU\204\377\202FT\203\377\202ES\202\377\211FT\203\377\1ES\203\377\202" \
+  "FT\203\377\2ES\203\377DR\203\377\210ES\203\377\1DR\202\377\202ES\203" \
+  "\377\1CQ\201\377\207DR\202\377\5CQ\201\377DR\202\377@N\177\377\"3k\377" \
+  "\30)d\377\214\31*e\377\202\30)d\377\7,;r\377BP\201\377AO\200\377BP\200" \
+  "\377BP\201\377BP\200\377BP\177\377\210BP\200\377\2AO\200\377@N\200\377" \
+  "\210AO\200\377\1\77M~\377\206@N\177\377\7\77M~\377@N\177\377\77M~\377" \
+  ">L}\377@N~\377%5m\377\30)d\377\216\31*e\377\4\30)d\377&7n\377>M~\377" \
+  "=J|\377\202=K}\377\3<K}\377=K}\377;K}\377\206<K}\377\3;J|\377<K}\377" \
+  ":I{\377\206;J|\377\202:I{\377\1""9Hz\377\203:I{\377\2;J{\377&6n\377\221" \
+  "\31*e\377\3\30)d\377\27(d\377(8o\377\2058Fz\377\2""7Fy\3778Fz\377\210" \
+  "7Fy\377\2""6Ex\3775Dw\377\2036Ex\377\4""5Dw\3776Ex\3773Bv\377\34-g\377" \
+  "\224\31*e\377\6\30)e\377\30)d\377!1j\3771@u\3772Av\3771@u\377\2062Av" \
+  "\377\2""1Au\3770At\377\2061Au\377\2020@u\377\1$5m\377\232\31*e\377\5" \
+  "\30)d\377\37""0i\377,<r\377-<r\377,;q\377\205-<r\377\202,<r\377\1+<r" \
+  "\377\203,<r\377\3(8o\377\32+f\377\30)d\377\233\31*e\377\2\30)d\377\40" \
+  "1i\377\203(8o\377\2'7o\377&6o\377\203'7o\377\4&6o\377'7o\377\40""0j\377" \
+  "\30)d\377\240\31*e\377\1\36/h\377\203#3l\377\3\30)d\3770\77t\377CQ\201" \
+  "\377\210DR\202\377\2CQ\201\377DR\202\377\202ES\203\377\1DR\202\377\210" \
+  "ES\203\377\1DR\203\377\202ES\203\377\213FT\203\377\202ES\202\377\202" \
+  "FT\203\377\220GU\204\377\203FU\204\377\204GU\204\377\203HU\204\377\1" \
+  "HT\203\377\202HU\204\377\15IV\204\377IV\205\377JW\205\377KW\205\377J" \
+  "W\206\377GT\203\377CQ\200\377@M~\377=K|\377:H{\3778Fy\3776Ex\3775Dw\377" \
+  "\2024Cw\377\15""5Dw\3776Dx\3777Fy\3779Gz\377;I|\377>L}\377AO\177\377" \
+  "ER\202\377IU\204\377KW\206\377JW\205\377JV\205\377IV\204\377\202HU\204" \
+  "\377\1GT\203\377\203HU\204\377\204GU\204\377\203FU\204\377\216GU\204" \
+  "\377\2FT\203\377GU\204\377\203FT\203\377\1ES\202\377\212FT\203\377\2" \
+  "ES\203\377FT\203\377\202ES\203\377\1DR\203\377\212ES\203\377\202DR\202" \
+  "\377\1CQ\201\377\206DR\202\377\6CQ\201\377DR\202\377>L~\377$4l\377\27" \
+  ")d\377\30)d\377\214\31*e\377\10\30)d\377'7n\377@N\177\377BP\201\377B" \
+  "P\200\377BP\201\377BP\200\377BP\177\377\207BP\200\377\202AO\200\377\1" \
+  "@N\200\377\206AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\207" \
+  "@N\177\377\5\77M~\377>L}\377@N~\3771@u\377\30)d\377\216\31*e\377\5\30" \
+  ")d\377\34,g\377:I{\377=K}\377<K}\377\203=K}\377\211<K}\377\2;J|\377:" \
+  "I{\377\207;J|\377\2:I{\3779Hz\377\203:I{\377\2""5Dx\377\34-g\377\221" \
+  "\31*e\377\4\30)d\377\33+f\3773Av\3777Ez\377\2058Fz\377\2077Fy\377\2""6" \
+  "Ex\3777Fy\377\2076Ex\377\1*:q\377\225\31*e\377\5\30)d\377\30*d\377(7" \
+  "o\3773Bw\3771@u\377\2072Av\377\1""0At\377\2071Au\377\4/\77u\377.>t\377" \
+  "\37""0i\377\30)d\377\230\31*e\377\202\30)d\377\4$4m\377.=s\377-<r\377" \
+  ",;q\377\206-<r\377\2,<r\377+<r\377\202,<r\377\2+;q\377%6m\377\202\30" \
+  ")d\377\233\31*e\377\2\30)d\377%5m\377\203(8o\377\1&6o\377\204'7o\377" \
+  "\4'7n\377'7o\377\34-g\377\30)d\377\240\31*e\377\1!1j\377\203#3l\377\6" \
+  "\30)d\377\31*e\377,;r\377DR\202\377DR\201\377CQ\201\377\206DR\202\377" \
+  "\1CQ\201\377\202DR\202\377\211ES\203\377\202DR\203\377\1ES\203\377\202" \
+  "FT\203\377\1ES\203\377\212FT\203\377\1ES\202\377\202FT\203\377\203GU" \
+  "\204\377\1FT\203\377\216GU\204\377\204FU\204\377\204GU\204\377\205HU" \
+  "\204\377\2GT\204\377HU\203\377\204HU\204\377\1IU\204\377\210IV\204\377" \
+  "\1IU\204\377\213HU\204\377\205GU\204\377\203FU\204\377\217GU\204\377" \
+  "\1FT\203\377\202GU\204\377\202FT\203\377\202ES\202\377\211FT\203\377" \
+  "\1ES\203\377\202FT\203\377\1ES\203\377\202DR\203\377\210ES\203\377\2" \
+  "DR\202\377ES\203\377\202DR\202\377\1CQ\201\377\206DR\202\377\6CQ\201" \
+  "\377ES\203\377<J|\377\40""1j\377\27(d\377\30)d\377\214\31*e\377\6\27" \
+  ")d\377$4l\377\77N\177\377BP\201\377AO\200\377BP\201\377\202BP\200\377" \
+  "\1BP\177\377\206BP\200\377\4AO\200\377BP\200\377AO\200\377@N\200\377" \
+  "\207AO\200\377\202@N\177\377\1\77M~\377\205@N\177\377\7\77M~\377@N\177" \
+  "\377>L}\377\77M~\3779Hz\377\36.h\377\30*e\377\215\31*e\377\5\30*e\377" \
+  "\27'c\3772@u\377>L}\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377" \
+  "\205<K}\377\3;J|\377<K}\377:I{\377\206;J|\377\3:I{\377;J|\3779Hz\377" \
+  "\204:I{\377\2)9p\377\30)d\377\220\31*e\377\3\31*d\377\30)d\377$4l\377" \
+  "\2027Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2076Ex\377\3""4C" \
+  "w\377\"2k\377\30)d\377\224\31*e\377\5\30)d\377\33,f\377-=s\3773Bw\377" \
+  "1@u\377\2052Av\377\3""1Au\3772Av\3770At\377\2051Au\377\6""0@u\3771Au" \
+  "\3770@u\377,<r\377\32+f\377\30)d\377\230\31*e\377\5\30)d\377\32+f\377" \
+  "(8o\377.=s\377,;q\377\207-<r\377\1+<r\377\203,<r\377\3+;q\377\40""0j" \
+  "\377\30)d\377\233\31*e\377\2\30)d\377\31*e\377\202(8o\377\3'7o\377(8" \
+  "o\377&6o\377\205'7o\377\2&6n\377\32+e\377\237\31*e\377\2\30)e\377\32" \
+  "*e\377\204#3l\377\1\31*e\377\202\30)d\377\4&6n\377ER\203\377DR\202\377" \
+  "CQ\201\377\205DR\202\377\203CQ\201\377\202DR\202\377\211ES\203\377\1" \
+  "DR\203\377\202ES\203\377\202FT\203\377\1ES\203\377\211FT\203\377\202" \
+  "ES\202\377\203FT\203\377\222GU\204\377\204FU\204\377\206GU\204\377\226" \
+  "HU\204\377\206GU\204\377\204FU\204\377\220GU\204\377\1FT\203\377\202" \
+  "GU\204\377\202FT\203\377\202ES\202\377\214FT\203\377\202ES\203\377\1" \
+  "DR\203\377\211ES\203\377\2DR\202\377ES\203\377\202DR\202\377\1CQ\201" \
+  "\377\206DR\202\377\4CQ\201\377ES\203\3778Gz\377\33,f\377\202\30)d\377" \
+  "\214\31*e\377\7\27(d\377!2j\377AO\200\377BP\201\377AO\200\377BP\201\377" \
+  "BP\200\377\202BP\177\377\206BP\200\377\4AO\200\377BP\200\377AO\200\377" \
+  "@N\200\377\206AO\200\377\202@N\177\377\202\77M~\377\205@N\177\377\3\77" \
+  "M~\377@N\177\377\77M~\377\202>L}\377\1(7o\377\202\30)d\377\215\31*e\377" \
+  "\3\27(d\377$5m\377<J|\377\205=K}\377\1<K}\377\202;K}\377\206<K}\377\211" \
+  ";J|\377\2:I{\3779Hz\377\202:I{\377\4""9Hz\3776Ex\377\35.h\377\30)d\377" \
+  "\220\31*e\377\3\30)d\377\32+f\377.=t\377\2058Fz\377\4""7Fy\3778Fz\377" \
+  "7Fy\3776Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""1@t\377\32" \
+  "+e\377\30)d\377\225\31*e\377\4\37""0i\3773Bw\3772Av\3771@u\377\2062A" \
+  "v\377\2""1Au\3770At\377\2061Au\377\3""0@u\377/\77t\377&7o\377\202\30" \
+  ")d\377\230\31*e\377\5\30)d\377\34-g\377,;r\377.=s\377,;q\377\205-<r\377" \
+  "\3,<r\377-<r\377+<r\377\202,<r\377\202+;q\377\2\32+e\377\30)d\377\233" \
+  "\31*e\377\7\30)d\377\36/h\377(8o\377'7n\377(8o\377'7o\377&6o\377\205" \
+  "'7o\377\1\"2k\377\240\31*e\377\4\30)d\377\34-g\377#3l\377\"2k\377\202" \
+  "#3l\377\203\31*e\377\3\30)d\377\"2k\377AO\177\377\211DR\202\377\1CQ\201" \
+  "\377\202DR\202\377\2ES\203\377DR\202\377\210ES\203\377\202DR\203\377" \
+  "\1ES\203\377\202FT\203\377\1ES\203\377\213FT\203\377\202ES\202\377\202" \
+  "FT\203\377\230GU\204\377\230FU\204\377\225GU\204\377\1FT\203\377\202" \
+  "GU\204\377\202FT\203\377\203ES\202\377\212FT\203\377\1ES\203\377\202" \
+  "FT\203\377\202ES\203\377\1DR\203\377\211ES\203\377\1DR\202\377\202ES" \
+  "\203\377\2DR\202\377CQ\201\377\206DR\202\377\6CQ\201\377DR\202\377CQ" \
+  "\202\3776Dx\377\33+f\377\30)d\377\214\31*e\377\202\30)d\377\10\40""1" \
+  "j\377AO\200\377BP\201\377AO\200\377BP\200\377BP\201\377BP\200\377BP\177" \
+  "\377\210BP\200\377\2AO\200\377@N\200\377\206AO\200\377\3@N\177\377AO" \
+  "\200\377\77M~\377\210@N\177\377\6\77M~\377>L}\377\77M~\3774Bv\377\27" \
+  ")d\377\30)d\377\215\31*e\377\3\30)d\377\33,f\3776Ey\377\204=K}\377\4" \
+  "<K}\377=K}\377<K}\377;K}\377\207<K}\377\2;J|\377:I{\377\204;J|\377\2" \
+  ":I{\377;J|\377\204:I{\377\4""9Hz\377:I{\377+;q\377\27(c\377\222\31*e" \
+  "\377\2\37/i\3778Ey\377\2068Fz\377\2""7Fy\3776Fx\377\2077Fy\377\2""6E" \
+  "x\3775Dw\377\2036Ex\377\2025Dw\377\2(7o\377\27(d\377\226\31*e\377\2)" \
+  "8o\3773Bw\377\2062Av\377\2""1Au\3772Av\377\2061Au\377\6""0@u\3771Au\377" \
+  "0@t\377/\77t\377\36/i\377\30)d\377\232\31*e\377\2!1j\377/>s\377\210-" \
+  "<r\377\205,<r\377\2'7o\377\27(d\377\233\31*e\377\3\30)e\377\30)d\377" \
+  "\"3k\377\203(8o\377\207'7o\377\1\40""0j\377\240\31*e\377\2\30)d\377\36" \
+  "/i\377\204#3l\377\204\31*e\377\5\30)d\377\40""1i\377;I|\377DR\202\377" \
+  "CQ\201\377\207DR\202\377\1CQ\201\377\202DR\202\377\213ES\203\377\1DR" \
+  "\203\377\202ES\203\377\202FT\203\377\1ES\203\377\213FT\203\377\1ES\202" \
+  "\377\203FT\203\377\203GU\204\377\1FT\203\377\300GU\204\377\203FT\203" \
+  "\377\202ES\202\377\213FT\203\377\2ES\203\377FT\203\377\202ES\203\377" \
+  "\202DR\203\377\211ES\203\377\2DR\202\377ES\203\377\202DR\202\377\1CQ" \
+  "\201\377\206DR\202\377\6CQ\201\377DR\202\377CQ\201\3770@u\377\31*e\377" \
+  "\30)d\377\215\31*e\377\11\30)d\377\"2k\377>L~\377BP\201\377AO\200\377" \
+  "BP\200\377BP\201\377BP\200\377BP\177\377\210BP\200\377\2AO\200\377@N" \
+  "\200\377\206AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\206@" \
+  "N\177\377\204\77M~\377\3;I{\377\34,g\377\30)d\377\216\31*e\377\3\31*" \
+  "d\377*9p\377<J|\377\205=K}\377\2<K}\377;K}\377\207<K}\377\2;J|\377:I" \
+  "{\377\206;J|\377\202:I{\377\1""9Hz\377\203:I{\377\3""8Fy\377\32+f\377" \
+  "\30)d\377\221\31*e\377\4\30)d\377-<r\3779Fz\3777Ey\377\2048Fz\377\202" \
+  "7Fy\377\1""6Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""5Dw\377" \
+  "\34,g\377\30)d\377\224\31*e\377\5\30)d\377\32+e\3772@v\3772Av\3771@u" \
+  "\377\2062Av\377\2101Au\377\2020@u\377\1-=s\377\202\30)d\377\232\31*e" \
+  "\377\2'7o\377.=s\377\210-<r\377\203,<r\377\4+;q\377,<r\377!1j\377\30" \
+  ")d\377\233\31*e\377\6\30)d\377\31*d\377&6n\377'7n\377'7o\377(8o\377\206" \
+  "'7o\377\3&6n\377\35.h\377\30)d\377\237\31*e\377\2\30)d\377\"2k\377\204" \
+  "#3l\377\204\31*e\377\202\30)d\377\3\35.h\3774Dw\377FT\203\377\202CQ\201" \
+  "\377\206DR\202\377\2CQ\201\377DR\202\377\202ES\203\377\1DR\202\377\211" \
+  "ES\203\377\202DR\203\377\202ES\203\377\2FT\203\377ES\203\377\213FT\203" \
+  "\377\203ES\202\377\203FT\203\377\202GU\204\377\1FT\203\377\270GU\204" \
+  "\377\1FT\203\377\202GU\204\377\203FT\203\377\203ES\202\377\213FT\203" \
+  "\377\1ES\203\377\202FT\203\377\202ES\203\377\202DR\203\377\210ES\203" \
+  "\377\1DR\202\377\202ES\203\377\1DR\202\377\202CQ\201\377\206DR\202\377" \
+  "\4CQ\201\377ES\202\377AO\200\377(7o\377\202\30)d\377\215\31*e\377\3\30" \
+  ")d\377!1j\377=K~\377\202BP\201\377\4BP\200\377BP\201\377BP\200\377BP" \
+  "\177\377\207BP\200\377\203AO\200\377\1@N\200\377\205AO\200\377\4@N\177" \
+  "\377AO\200\377@N\177\377\77M~\377\206@N\177\377\2\77M~\377@N\177\377" \
+  "\203\77M~\377\2\"1j\377\27)d\377\216\31*e\377\5\30)d\377\36/h\377:H{" \
+  "\377=K}\377<J|\377\202=K}\377\3<K}\377=K}\377;K}\377\206<K}\377\203;" \
+  "J|\377\1:I{\377\206;J|\377\2:I{\3779Hz\377\202:I{\377\4""9Hz\377<J|\377" \
+  "&6n\377\27(d\377\221\31*e\377\2\30)d\377\35.h\377\2068Fz\377\3""7Fy\377" \
+  "8Fz\3776Fx\377\2067Fy\377\2026Ex\377\1""5Dw\377\2036Ex\377\4""5Dx\377" \
+  "6Ex\377+;q\377\27(c\377\225\31*e\377\5\30)d\377#3l\3774Cw\3772Av\377" \
+  "1@u\377\2042Av\377\4""1Au\3772Av\3771Au\3770At\377\2061Au\377\2020@u" \
+  "\377\2$4l\377\30)d\377\231\31*e\377\3\30)d\377\32+e\377.=s\377\207-<" \
+  "r\377\2,<r\377-<r\377\205,<r\377\2\31*e\377\30)d\377\233\31*e\377\3\30" \
+  ")d\377\34-g\377'7n\377\202(8o\377\207'7o\377\3%5m\377\33,f\377\30)d\377" \
+  "\236\31*e\377\4\30)d\377\31*e\377#3l\377\"2k\377\202#3l\377\1\"2k\377" \
+  "\206\31*e\377\6\30)d\377\31*e\377,;r\377ES\202\377DR\202\377CQ\201\377" \
+  "\206DR\202\377\1CQ\201\377\202DR\202\377\2ES\203\377DR\202\377\211ES" \
+  "\203\377\202DR\203\377\202ES\203\377\202FT\203\377\1ES\203\377\214FT" \
+  "\203\377\202ES\202\377\203FT\203\377\267GU\204\377\1FT\203\377\202GU" \
+  "\204\377\203FT\203\377\203ES\202\377\216FT\203\377\202ES\203\377\202" \
+  "DR\203\377\213ES\203\377\202DR\202\377\1CQ\201\377\207DR\202\377\6CQ" \
+  "\201\377DR\202\377>L~\377\40""1j\377\31)e\377\30)d\377\215\31*e\377\3" \
+  "\30)d\377\37""0i\377@N\200\377\202BP\201\377\3AO\200\377BP\201\377BP" \
+  "\200\377\202BP\177\377\206BP\200\377\4AO\200\377BP\200\377AO\200\377" \
+  "@N\200\377\207AO\200\377\1@N\177\377\202\77M~\377\207@N\177\377\6\77" \
+  "M~\377>L}\377@N~\377)9p\377\31*e\377\30*e\377\216\31*e\377\4\30)d\377" \
+  "2Av\377=K}\377=K|\377\204=K}\377\2<K}\377;K}\377\207<K}\377\2;J|\377" \
+  ":I{\377\206;J|\377\1:I{\377\2029Hz\377\203:I{\377\3""5Cw\377\31*e\377" \
+  "\30)d\377\221\31*e\377\4\27(c\377.=t\3778Fz\3777Ey\377\2058Fz\377\2""7" \
+  "Fy\3776Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377\2046Ex\377\4""6Ew\377" \
+  "7Fy\377\33,g\377\30)d\377\224\31*e\377\4\30)e\377\27)c\3770\77u\3772" \
+  "Av\377\2021@u\377\2052Av\377\1""1Au\377\2020At\377\2041Au\377\6""0@u" \
+  "\3771Au\3770@t\3770@v\377\32+f\377\30)d\377\231\31*e\377\5\30)d\377\40" \
+  "1j\377/=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\2'" \
+  "8n\377\30)d\377\234\31*e\377\3\30)d\377\40""0i\377'7n\377\202(8o\377" \
+  "\2'7o\377&6o\377\205'7o\377\3#3l\377\31)e\377\30)d\377\236\31*e\377\2" \
+  "\30)d\377\34-h\377\205#3l\377\210\31*e\377\3\30)d\377&7n\377@N\177\377" \
+  "\202DR\202\377\1CQ\201\377\206DR\202\377\1CQ\201\377\202DR\202\377\202" \
+  "ES\203\377\1DR\202\377\212ES\203\377\1DR\203\377\202ES\203\377\202FT" \
+  "\203\377\1ES\203\377\216FT\203\377\203ES\202\377\204FT\203\377\203GU" \
+  "\204\377\1FT\203\377\251GU\204\377\204FT\203\377\203ES\202\377\215FT" \
+  "\203\377\1ES\203\377\202FT\203\377\202ES\203\377\202DR\203\377\212ES" \
+  "\203\377\2DR\202\377ES\203\377\202DR\202\377\1CQ\201\377\207DR\202\377" \
+  "\6CQ\201\377DR\202\377CQ\201\3779H{\377\34-g\377\30)d\377\215\31*e\377" \
+  "\202\30)d\377\10!2k\377AO\200\377BP\201\377AO\200\377BP\200\377BP\201" \
+  "\377BP\200\377BP\177\377\206BP\200\377\1AO\200\377\202BP\200\377\1@N" \
+  "\200\377\207AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\205@" \
+  "N\177\377\1\77M~\377\202@N\177\377\202\77M~\377\3""3Bv\377\33+f\377\30" \
+  ")d\377\215\31*e\377\202\30)d\377\3&6n\377\77L~\377<J|\377\202=K}\377" \
+  "\1<K}\377\202=K}\377\210<K}\377\2;J|\377:I{\377\207;J|\377\2:I{\3779" \
+  "Hz\377\203:I{\377\2;J{\377#3l\377\222\31*e\377\4\30)d\377\37/h\3778F" \
+  "z\3777Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2057Fy\377\3""6Ex\3777Fy\377" \
+  "5Dw\377\2046Ex\377\4""5Dw\3776Ex\377,<r\377\30)d\377\225\31*e\377\5\30" \
+  ")d\377\37""0i\3773Bw\3772Av\3771@u\377\2062Av\377\2""1Au\3770At\377\206" \
+  "1Au\377\4""0@t\3770@u\377):p\377\30)d\377\231\31*e\377\202\30)d\377\4" \
+  ")9o\377.=s\377-<r\377,;q\377\204-<r\377\11,<r\377-<r\377,<r\377+<r\377" \
+  ",<r\377,<q\377,<r\377\40""1j\377\30)d\377\233\31*e\377\10\30)d\377\31" \
+  "*e\377#3k\377(8o\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\3&6n\377" \
+  "!1j\377\30)d\377\237\31*e\377\2\30)d\377\37""0i\377\205#3l\377\210\31" \
+  "*e\377\7\30)d\377\27(c\377!1j\3779Hz\377ES\203\377DR\202\377CQ\201\377" \
+  "\206DR\202\377\202CQ\201\377\202DR\202\377\2ES\203\377DR\202\377\212" \
+  "ES\203\377\202DR\203\377\202ES\203\377\202FT\203\377\1ES\203\377\217" \
+  "FT\203\377\203ES\202\377\204FT\203\377\205GU\204\377\1FT\203\377\233" \
+  "GU\204\377\1FT\203\377\204GU\204\377\205FT\203\377\203ES\202\377\217" \
+  "FT\203\377\2ES\203\377FT\203\377\202ES\203\377\202DR\203\377\215ES\203" \
+  "\377\1DR\202\377\202CQ\201\377\210DR\202\377\3ER\202\377AO\200\377/\77" \
+  "t\377\202\30)d\377\216\31*e\377\11\30)d\377%5m\377\77M\177\377BP\201" \
+  "\377AO\200\377BP\200\377BP\201\377BP\200\377BP\177\377\210BP\200\377" \
+  "\202AO\200\377\1@N\200\377\206AO\200\377\4@N\177\377AO\200\377@N\177" \
+  "\377\77M~\377\207@N\177\377\203\77M~\377\3:I{\377\37""0i\377\30)d\377" \
+  "\216\31*e\377\3\30)d\377\36/h\377<J|\377\205=K}\377\202<K}\377\1;K}\377" \
+  "\205<K}\377\3;J|\377<K}\377:I{\377\206;J|\377\3:I{\377;J|\3779Hz\377" \
+  "\204:I{\377\3""1@t\377\32+f\377\30)d\377\220\31*e\377\202\30)d\377\1" \
+  ".=t\377\2058Fz\377\2""7Fy\3778Fz\377\2107Fy\377\2""6Ex\3775Dw\377\206" \
+  "6Ex\377\2\40""0j\377\30)d\377\224\31*e\377\5\30)d\377\27)d\377+:q\377" \
+  "3Bw\3771@u\377\2062Av\377\2021Au\377\1""0At\377\2061Au\377\4""0@u\377" \
+  "1@u\377\40""1j\377\30)d\377\231\31*e\377\5\30)d\377\33+f\377.=s\377-" \
+  "<r\377,;q\377\206-<r\377\202,<r\377\1+<r\377\202,<r\377\3+;r\377\33," \
+  "g\377\30)d\377\233\31*e\377\3\30)d\377\32+f\377%5m\377\202(8o\377\202" \
+  "'7o\377\1&6o\377\204'7o\377\3&6n\377\35-g\377\30)d\377\236\31*e\377\202" \
+  "\30)d\377\202\"2k\377\204#3l\377\212\31*e\377\6\27(d\377\34-f\377-=s" \
+  "\377CR\201\377DR\202\377CQ\201\377\207DR\202\377\202CQ\201\377\1DR\202" \
+  "\377\215ES\203\377\202DR\203\377\202ES\203\377\202FT\203\377\1ES\203" \
+  "\377\220FT\203\377\203ES\202\377\206FT\203\377\206GU\204\377\1FT\203" \
+  "\377\216GU\204\377\1FT\203\377\207GU\204\377\205FT\203\377\204ES\202" \
+  "\377\217FT\203\377\1ES\203\377\203FT\203\377\202ES\203\377\202DR\203" \
+  "\377\212ES\203\377\2DR\202\377ES\203\377\203DR\202\377\1CQ\201\377\207" \
+  "DR\202\377\4CQ\201\377ES\202\377<K}\377$4l\377\202\30)d\377\216\31*e" \
+  "\377\3\27(c\377'8o\377\77M\177\377\202BP\201\377\4BP\200\377BP\201\377" \
+  "BP\200\377BP\177\377\207BP\200\377\203AO\200\377\1@N\200\377\206AO\200" \
+  "\377\4@N\177\377AO\200\377@N\177\377\77M~\377\207@N\177\377\202\77M~" \
+  "\377\4>L}\377@N~\377$5m\377\27(d\377\216\31*e\377\5\30)d\377\31+e\377" \
+  "3Bv\377=K}\377<J|\377\204=K}\377\2<K}\377;K}\377\205<K}\377\2;J|\377" \
+  "<K}\377\211;J|\377\2:I{\3779Hz\377\202:I{\377\3""9Hz\3778Gz\377#4l\377" \
+  "\202\30)d\377\220\31*e\377\4\30)d\377\40""1i\3775Dx\3777Ey\377\2058F" \
+  "z\377\2117Fy\377\2056Ex\377\4""5Dw\3776Ex\377.>s\377\32+f\377\225\31" \
+  "*e\377\5\30)d\377\35-g\3770\77u\3773Bw\3771@u\377\2062Av\377\2""1Au\377" \
+  "0At\377\2061Au\377\2020@u\377\2-=s\377\33,f\377\232\31*e\377\5\30)d\377" \
+  "\"3k\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\2" \
+  "'7n\377\32+e\377\234\31*e\377\2\30)d\377\35-g\377\203(8o\377\2'7o\377" \
+  "&6o\377\204'7o\377\202&6n\377\202\30)d\377\236\31*e\377\3\30)d\377\32" \
+  ",f\377\"2k\377\204#3l\377\1\"2k\377\213\31*e\377\6\30)d\377\31*e\377" \
+  "#4l\377@N\177\377DR\202\377CQ\201\377\207DR\202\377\1CQ\201\377\203D" \
+  "R\202\377\2ES\203\377DR\202\377\212ES\203\377\202DR\203\377\203ES\203" \
+  "\377\202FT\203\377\1ES\203\377\221FT\203\377\205ES\202\377\207FT\203" \
+  "\377\220GU\204\377\207FT\203\377\205ES\202\377\222FT\203\377\2ES\203" \
+  "\377FT\203\377\203ES\203\377\202DR\203\377\212ES\203\377\1DR\202\377" \
+  "\202ES\203\377\202DR\202\377\202CQ\201\377\206DR\202\377\202CQ\201\377" \
+  "\3ES\202\3775Ex\377\33,f\377\202\30)d\377\216\31*e\377\5\26'c\377,<r" \
+  "\377AO\200\377BP\201\377AO\200\377\202BP\201\377\1BP\200\377\202BP\177" \
+  "\377\206BP\200\377\4AO\200\377BP\200\377AO\200\377@N\200\377\206AO\200" \
+  "\377\4@N\177\377AO\200\377@N\177\377\77M~\377\207@N\177\377\202\77M~" \
+  "\377\3>L}\377AN\177\377*9p\377\202\30)d\377\216\31*e\377\3\30)d\377(" \
+  "8o\377<J|\377\204=K}\377\202<K}\377\202;K}\377\206<K}\377\1;J|\377\202" \
+  ":I{\377\205;J|\377\3:I{\377;J|\3779Hz\377\204:I{\377\1""1@u\377\202\30" \
+  ")d\377\220\31*e\377\3\30)d\377\31*e\377+;q\377\2058Fz\377\4""7Fy\377" \
+  "8Fz\3777Fy\3776Fx\377\2057Fy\377\2""6Ex\3777Fy\377\2066Ex\377\3""5Dw" \
+  "\377%5m\377\30)d\377\224\31*e\377\3\30)e\377\30)d\377$5l\377\2022Av\377" \
+  "\1""1@u\377\2052Av\377\3""1Au\3772Av\3770At\377\2051Au\377\4""0@u\377" \
+  "1At\3770@u\377&7n\377\232\31*e\377\202\30)d\377\2*:p\377-<r\377\202," \
+  ";q\377\206-<r\377\7,<r\377+<r\377,<r\377+;q\377,<r\377\"2k\377\30)e\377" \
+  "\235\31*e\377\6\40""0i\377(8o\377'7n\377(8o\377'7o\377&6o\377\205'7o" \
+  "\377\2\"2k\377\30)d\377\237\31*e\377\3\30)d\377\35-h\377\"2k\377\204" \
+  "#3l\377\1\"2k\377\215\31*e\377\4\30)d\377\33,f\3778Gz\377CQ\201\377\202" \
+  "DR\202\377\1CQ\201\377\207DR\202\377\1CQ\201\377\203DR\202\377\215ES" \
+  "\203\377\202DR\203\377\203ES\203\377\233FT\203\377\222ES\202\377\230" \
+  "FT\203\377\1ES\203\377\202FT\203\377\203ES\203\377\202DR\203\377\214" \
+  "ES\203\377\1DR\202\377\202ES\203\377\1DR\202\377\202CQ\201\377\207DR" \
+  "\202\377\1CQ\201\377\202DR\202\377\4AO\200\377)9o\377\26'c\377\30)d\377" \
+  "\216\31*e\377\6\30)d\377\31*e\377/\77t\377BP\201\377AO\200\377BP\200" \
+  "\377\202BP\201\377\2BP\200\377BP\177\377\206BP\200\377\1AO\200\377\202" \
+  "BP\200\377\1@N\200\377\207AO\200\377\4@N\177\377AO\200\377@N\177\377" \
+  "\77M~\377\206@N\177\377\7\77M~\377@N\177\377\77M~\377>L}\377\77M~\377" \
+  "2Au\377\30)d\377\217\31*e\377\5\30)d\377\36/h\3779Hz\377=K}\377<J|\377" \
+  "\202=K}\377\3<K}\377=K}\377;K}\377\206<K}\377\4;J|\377<K}\377;J|\377" \
+  ":I{\377\207;J|\377\2:I{\3779Hz\377\203:I{\377\3""9Hz\377\37/i\377\30" \
+  ")d\377\222\31*e\377\2\36.h\3776Dy\377\2068Fz\377\2""7Fy\3776Fx\377\205" \
+  "7Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2056Ex\377\3""2Au\377\34-g\377" \
+  "\30)d\377\224\31*e\377\5\30)d\377\32+f\377,;r\3773Bw\3771@u\377\2052" \
+  "Av\377\3""1Au\3772Av\3770At\377\2071Au\377\4/\77u\377/\77t\377\40""1" \
+  "j\377\30)d\377\231\31*e\377\5\30)d\377\35.h\377,;q\377-<r\377,;q\377" \
+  "\206-<r\377\2,<r\377+<r\377\203,<r\377\3*:q\377\36.h\377\30)d\377\235" \
+  "\31*e\377\1$4l\377\202(8o\377\2'7o\377&6o\377\204'7o\377\4&6n\377'7o" \
+  "\377\35.h\377\30)d\377\236\31*e\377\3\30)d\377\31*d\377\37""0i\377\204" \
+  "#3l\377\202\"2k\377\216\31*e\377\4\30)d\377\27(c\377*:p\377>L~\377\212" \
+  "DR\202\377\202CQ\201\377\1DR\202\377\202ES\203\377\1DR\202\377\214ES" \
+  "\203\377\202DR\203\377\203ES\203\377\203FT\203\377\1ES\203\377\300FT" \
+  "\203\377\203ES\203\377\202DR\203\377\214ES\203\377\1DR\202\377\202ES" \
+  "\203\377\202DR\202\377\1CQ\201\377\210DR\202\377\6CQ\201\377DR\202\377" \
+  "CQ\202\3776Ex\377\37""0i\377\27(d\377\217\31*e\377\3\30)d\377\33,f\377" \
+  "2Av\377\202BP\201\377\2BP\200\377BP\201\377\202BP\200\377\1BP\177\377" \
+  "\210BP\200\377\202AO\200\377\1@N\200\377\210AO\200\377\2@N\177\377\77" \
+  "M~\377\206@N\177\377\10\77M~\377@N\177\377\77M~\377>L}\377\77M~\3777" \
+  "Fy\377\34-g\377\30)d\377\216\31*e\377\5\30)d\377\31*e\3773Bv\377>L}\377" \
+  "<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377\207<K}\377\2;J|\377" \
+  ":I{\377\207;J|\377\2:I{\3779Hz\377\202:I{\377\4""9Hz\377;J{\377,;q\377" \
+  "\26(c\377\222\31*e\377\4\30)d\377+:q\3779Gz\3777Ey\377\2048Fz\377\202" \
+  "7Fy\377\1""6Fx\377\2067Fy\377\2026Ex\377\1""5Dw\377\2036Ex\377\5""5D" \
+  "w\3776Ex\377)9o\377\27(d\377\31*d\377\225\31*e\377\2\36/i\3772Aw\377" \
+  "\2102Av\377\2""1Au\3770At\377\2051Au\377\6""0@u\3771Au\377/\77u\377+" \
+  "<r\377\32+f\377\30)d\377\230\31*e\377\202\30)d\377\1#3l\377\202-<r\377" \
+  "\1,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203,<r\377\3(8o\377\32+e" \
+  "\377\30)d\377\233\31*e\377\2\30)d\377\32+e\377\202(8o\377\202'7o\377" \
+  "\1&6o\377\206'7o\377\2\31*e\377\30)d\377\236\31*e\377\3\30)d\377\32*" \
+  "e\377\40""1j\377\205#3l\377\2\"2k\377\30)d\377\216\31*e\377\202\30)d" \
+  "\377\5\36/i\3772Av\377ES\203\377DR\202\377CQ\201\377\210DR\202\377\1" \
+  "CQ\201\377\202DR\202\377\202ES\203\377\1DR\202\377\214ES\203\377\203" \
+  "DR\203\377\203ES\203\377\202FT\203\377\1ES\203\377\270FT\203\377\1ES" \
+  "\203\377\202FT\203\377\203ES\203\377\203DR\203\377\215ES\203\377\2DR" \
+  "\202\377ES\203\377\202DR\202\377\202CQ\201\377\207DR\202\377\6CQ\201" \
+  "\377DR\201\377FT\203\377\77M~\377(7o\377\32+f\377\202\30)d\377\216\31" \
+  "*e\377\3\27(c\377\36.h\3778Fz\377\202BP\201\377\2AO\200\377BP\201\377" \
+  "\202BP\200\377\1BP\177\377\207BP\200\377\203AO\200\377\1@N\200\377\207" \
+  "AO\200\377\3@N\177\377AO\200\377\77M~\377\210@N\177\377\202\77M~\377" \
+  "\3>L}\377<J|\377!1j\377\202\30)d\377\216\31*e\377\4\27(c\377,<r\377>" \
+  "L}\377<J|\377\204=K}\377\2<K}\377;K}\377\206<K}\377\3;J|\377<K}\377:" \
+  "I{\377\206;J|\377\203:I{\377\7""9Hz\377:I{\3779Hz\377:I{\3775Ex\377\32" \
+  "+f\377\30)d\377\221\31*e\377\2\30)d\377\36.h\377\2068Fz\377\3""7Fy\377" \
+  "8Fz\3776Fx\377\2077Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""5Dw\377\33" \
+  ",f\377\30)d\377\225\31*e\377\3\31)e\377(8o\3774Cw\377\2102Av\377\210" \
+  "1Au\377\5""0@u\377/\77t\377&6n\377\27)d\377\31*d\377\230\31*e\377\5\30" \
+  ")d\377\32+e\377(7o\377.=s\377,;q\377\207-<r\377\2,<r\377+<r\377\202," \
+  "<r\377\2+;q\377$4m\377\202\30)d\377\233\31*e\377\7\30)d\377\36/i\377" \
+  "(8o\377'7n\377(8o\377'7o\377&6o\377\205'7o\377\2#3l\377\30)d\377\237" \
+  "\31*e\377\3\30)d\377\33,f\377\"2k\377\205#3l\377\3!1j\377\31*d\377\30" \
+  ")d\377\216\31*e\377\202\30)d\377\6\31*e\377#3k\377\77M~\377ES\202\377" \
+  "DR\202\377CQ\201\377\207DR\202\377\1CQ\201\377\203DR\202\377\202ES\203" \
+  "\377\1DR\202\377\215ES\203\377\202DR\203\377\203ES\203\377\266FT\203" \
+  "\377\1ES\203\377\203FT\203\377\203ES\203\377\203DR\203\377\215ES\203" \
+  "\377\1DR\202\377\202ES\203\377\202DR\202\377\202CQ\201\377\212DR\202" \
+  "\377\4""2Av\377\34,g\377\31*e\377\30)d\377\217\31*e\377\3\27(c\377#2" \
+  "k\377\77M~\377\202BP\201\377\1AO\200\377\202BP\200\377\202BP\177\377" \
+  "\207BP\200\377\4AO\200\377BP\200\377AO\200\377@N\200\377\207AO\200\377" \
+  "\4@N\177\377AO\200\377@N\177\377\77M~\377\207@N\177\377\1\77M~\377\202" \
+  ">L}\377\2@N~\377$4l\377\202\30)d\377\216\31*e\377\5\27(d\377$5l\377<" \
+  "J|\377=K}\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377\205<K}" \
+  "\377\4;J|\377<K}\377;J|\377:I{\377\207;J|\377\2:I{\3779Hz\377\203:I{" \
+  "\377\3;J{\377#3l\377\30)d\377\222\31*e\377\4\26(c\3771\77t\3778Fz\377" \
+  "7Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2067Fy\377\2026Ex\377\1""5Dw\377" \
+  "\2036Ex\377\5""5Dw\3776Ex\377)9o\377\27(d\377\30)d\377\224\31*e\377\5" \
+  "\30)d\377\32+e\3773Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3772Av\377" \
+  "\2061Au\377\6""0@u\3771Au\3770@t\377/\77t\377\35-g\377\30)d\377\231\31" \
+  "*e\377\5\30)d\377\34-g\377,;r\377.=s\377,;q\377\207-<r\377\1+<r\377\203" \
+  ",<r\377\3+;q\377\35.h\377\30)d\377\234\31*e\377\2\30)d\377$5m\377\203" \
+  "(8o\377\1&6o\377\204'7o\377\4&6n\377'7o\377\36.h\377\30)d\377\240\31" \
+  "*e\377\1\34-g\377\206#3l\377\3!1j\3779H{\377\34-g\377\202\30)d\377\217" \
+  "\31*e\377\4\30)d\377\31*d\3770@u\377AO\200\377\202DR\202\377\1CQ\201" \
+  "\377\210DR\202\377\202CQ\201\377\203DR\202\377\2ES\203\377DR\202\377" \
+  "\217ES\203\377\203DR\203\377\204ES\203\377\250FT\203\377\1ES\203\377" \
+  "\204FT\203\377\203ES\203\377\204DR\203\377\216ES\203\377\1DR\202\377" \
+  "\202ES\203\377\203DR\202\377\1CQ\201\377\210DR\202\377\1CQ\201\377\202" \
+  "DR\202\377\3CQ\201\377>M~\377$5m\377\202\30)d\377\217\31*e\377\4\30)" \
+  "d\377\31*e\377(8n\377@N\200\377\202BP\201\377\4BP\200\377BP\201\377B" \
+  "P\200\377BP\177\377\207BP\200\377\1AO\200\377\202BP\200\377\1@N\200\377" \
+  "\212AO\200\377\2@N\177\377\77M~\377\206@N\177\377\7\77M~\377@N\177\377" \
+  "\77M~\377\77M}\377\77M~\377*:p\377\27(c\377\217\31*e\377\3\30)d\377\35" \
+  ".g\3778Gy\377\206=K}\377\2<K}\377;K}\377\205<K}\377\4;J|\377<K}\377;" \
+  "J|\377:I{\377\207;J|\377\2:I{\3779Hz\377\204:I{\377\3""0\77t\377\32+" \
+  "f\377\30)d\377\220\31*e\377\5\31)d\377\30)d\377\"2k\3778Fz\3777Ey\377" \
+  "\2058Fz\377\2""7Fy\3776Fx\377\2077Fy\377\2""6Ex\3775Dw\377\2036Ex\377" \
+  "\5""5Dx\3776Ex\3776Ew\377\32+f\377\30)d\377\225\31*e\377\5\30)d\377&" \
+  "6n\3773Bw\3772Av\3771@u\377\2042Av\377\4""1Au\3772Av\3771Au\3770At\377" \
+  "\2061Au\377\2020@u\377\2*:r\377\27(c\377\233\31*e\377\2\"1j\377/>s\377" \
+  "\210-<r\377\2,<r\377+<r\377\203,<r\377\1*;q\377\202\30)d\377\233\31*" \
+  "e\377\7\30)d\377\32+e\377(8o\377'7n\377'7o\377(8o\377&6o\377\205'7o\377" \
+  "\2'7n\377\32+e\377\241\31*e\377\1\37/i\377\205#3l\377\5\"2k\377!1j\377" \
+  "BP\201\377<J}\377$4l\377\202\30)d\377\217\31*e\377\10\30)d\377\27(c\377" \
+  "\"2k\3777Ey\377BP\201\377ES\202\377DR\202\377CQ\201\377\210DR\202\377" \
+  "\202CQ\201\377\202DR\202\377\202ES\203\377\1DR\202\377\220ES\203\377" \
+  "\203DR\203\377\205ES\203\377\205FT\203\377\1ES\203\377\230FT\203\377" \
+  "\1ES\203\377\206FT\203\377\204ES\203\377\204DR\203\377\222ES\203\377" \
+  "\202DR\202\377\203CQ\201\377\210DR\202\377\10CQ\201\377DR\202\377ER\202" \
+  "\377>L~\377.>s\377\31+e\377\27(c\377\30)d\377\217\31*e\377\3\27)d\377" \
+  "\33,f\377.=s\377\202BP\201\377\1AO\200\377\202BP\201\377\2BP\200\377" \
+  "BP\177\377\211BP\200\377\202AO\200\377\1@N\200\377\207AO\200\377\203" \
+  "@N\177\377\1\77M~\377\206@N\177\377\7\77M~\377@N\177\377\77M~\377>L}" \
+  "\377\77M~\377.>s\377\27(d\377\221\31*e\377\1""0\77t\377\205=K}\377\202" \
+  "<K}\377\1;K}\377\207<K}\377\202;J|\377\1:I{\377\205;J|\377\3:I{\377;" \
+  "J|\3779Hz\377\203:I{\377\4""9Hz\3778Gy\377\"2j\377\30)d\377\221\31*e" \
+  "\377\3\30)d\377\31*e\3771@u\377\2058Fz\377\2""7Fy\3778Fz\377\2077Fy\377" \
+  "\3""6Ex\3777Fy\3775Dw\377\2046Ex\377\4""5Dw\3777Fx\377(8o\377\30)d\377" \
+  "\225\31*e\377\2\30)d\377\31*e\377\2022Av\377\1""1@u\377\2062Av\377\202" \
+  "1Au\377\1""0At\377\2041Au\377\6""0@u\3771Au\3770@t\3771@u\377\37""0i" \
+  "\377\30)d\377\233\31*e\377\2*9o\377.=s\377\206-<r\377\2,<r\377-<r\377" \
+  "\203,<r\377\4+;r\377,<r\377#3l\377\30)d\377\234\31*e\377\2\30)d\377\37" \
+  "0i\377\203(8o\377\2'7o\377&6o\377\205'7o\377\1#3l\377\242\31*e\377\1" \
+  "!2k\377\205#3l\377\2\"2k\377!1j\377\202BP\201\377\4\77M\177\377-=s\377" \
+  "\27(c\377\30)d\377\217\31*e\377\10\30)d\377\27)d\377\31*e\377%5m\377" \
+  "8Gz\377ES\203\377DR\202\377CQ\201\377\211DR\202\377\202CQ\201\377\202" \
+  "DR\202\377\202ES\203\377\1DR\202\377\221ES\203\377\205DR\203\377\205" \
+  "ES\203\377\216FT\203\377\1ES\203\377\213FT\203\377\206ES\203\377\204" \
+  "DR\203\377\221ES\203\377\1DR\202\377\202ES\203\377\203DR\202\377\1CQ" \
+  "\201\377\211DR\202\377\202CQ\201\377\6ES\202\377CQ\201\377/\77t\377\37" \
+  "0i\377\27(d\377\30)d\377\217\31*e\377\7\30)d\377\27(c\377\40""1j\377" \
+  "8Fz\377CQ\201\377BP\201\377AO\200\377\204BP\200\377\1BP\177\377\207B" \
+  "P\200\377\203AO\200\377\1@N\200\377\207AO\200\377\4@N\177\377AO\200\377" \
+  "@N\177\377\77M~\377\206@N\177\377\10\77M~\377@N\177\377\77M~\377>L}\377" \
+  "\77M~\3773Av\377\32+f\377\30)d\377\217\31*e\377\2\30)d\377(7o\377\202" \
+  "=K}\377\1<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377" \
+  "\202;J|\377\1:I{\377\205;J|\377\2:I{\377;J|\377\204:I{\377\3""9Hz\377" \
+  ":I{\377-<r\377\202\30)d\377\220\31*e\377\202\30)d\377\1$4m\377\2027E" \
+  "y\377\2058Fz\377\2117Fy\377\2""6Ex\3775Dw\377\2036Ex\377\5""5Ex\3776" \
+  "Ex\3773Bv\377\35.g\377\30)d\377\225\31*e\377\5\27(d\377%5m\3773Bw\377" \
+  "2Av\3771@u\377\2062Av\377\2""1Au\3770At\377\2061Au\377\2020@u\377\3-" \
+  "<r\377\31*d\377\30)d\377\231\31*e\377\3\30)d\377\34-g\377/=s\377\210" \
+  "-<r\377\204,<r\377\4,<q\377,<r\377\33,f\377\30)d\377\233\31*e\377\202" \
+  "\30)d\377\1$5l\377\203(8o\377\205'7o\377\3&6n\377'7o\377\40""0j\377\240" \
+  "\31*e\377\4\30)d\377\32+f\377#3l\377#3k\377\202#3l\377\13\"2k\377#3l" \
+  "\377\"2k\377!1j\377BP\201\377AO\200\377BP\201\377AO\200\3778Fz\377\33" \
+  "-f\377\30)d\377\220\31*e\377\202\30)d\377\6\32+f\377&7n\377@N\177\377" \
+  "ES\202\377DR\202\377CQ\201\377\211DR\202\377\1CQ\201\377\203DR\202\377" \
+  "\203ES\203\377\1DR\202\377\223ES\203\377\205DR\203\377\214ES\203\377" \
+  "\203FT\203\377\214ES\203\377\205DR\203\377\223ES\203\377\1DR\202\377" \
+  "\202ES\203\377\203DR\202\377\202CQ\201\377\211DR\202\377\6CQ\201\377" \
+  "DR\202\377FS\203\3774Dw\377\35.g\377\31*e\377\202\30)d\377\220\31*e\377" \
+  "\3\30)d\377'7o\377>L~\377\202BP\201\377\4AO\200\377BP\200\377BP\201\377" \
+  "BP\200\377\202BP\177\377\207BP\200\377\4AO\200\377BP\200\377AO\200\377" \
+  "@N\200\377\207AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\210" \
+  "@N\177\377\5\77M~\377>L}\377\77M~\3778Fy\377\33,f\377\202\30)d\377\216" \
+  "\31*e\377\2\30)d\377\40""0i\377\202=K}\377\1<J|\377\202=K}\377\4<K}\377" \
+  "=K}\377<K}\377;K}\377\206<K}\377\202;J|\377\1:I{\377\207;J|\377\1:I{" \
+  "\377\2029Hz\377\203:I{\377\3""8Gy\377\31*e\377\30)d\377\221\31*e\377" \
+  "\3\30)d\377\33,f\3771@u\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377" \
+  "\2057Fy\377\2""6Ex\3777Fy\377\2056Ex\377\3""6Dw\3776Ex\377)9p\377\226" \
+  "\31*e\377\5\30)d\377\31*e\377.>t\3772Av\3771@u\377\2062Av\377\1""1Au" \
+  "\377\2020At\377\2061Au\377\4""0@t\3771Au\377\"3k\377\30)d\377\232\31" \
+  "*e\377\5\30)d\377&5m\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r" \
+  "\377\203,<r\377\1'8o\377\202\30)d\377\233\31*e\377\6\30)d\377\32+f\377" \
+  "&6n\377'7n\377'7o\377(8o\377\206'7o\377\3&6n\377\35.g\377\30)d\377\237" \
+  "\31*e\377\4\30)d\377\36.i\377#3l\377\"2l\377\203#3l\377\202\"2k\377\1" \
+  "\37/i\377\202BP\201\377\7BP\200\377AO\200\377BP\201\377=L~\377\"3l\377" \
+  "\31*e\377\30)d\377\221\31*e\377\202\30)d\377\3,<r\377@N\177\377CQ\201" \
+  "\377\202DR\202\377\1CQ\201\377\212DR\202\377\202CQ\201\377\203DR\202" \
+  "\377\242ES\203\377\205DR\203\377\237ES\203\377\1DR\202\377\202ES\203" \
+  "\377\202DR\202\377\203CQ\201\377\211DR\202\377\202CQ\201\377\202DR\202" \
+  "\377\5BP\201\377:I{\377\40""1k\377\27(d\377\30)d\377\220\31*e\377\202" \
+  "\30)d\377\5\32+f\377.=s\377CQ\201\377BP\201\377AO\200\377\203BP\201\377" \
+  "\1BP\177\377\210BP\200\377\1AO\200\377\202BP\200\377\1@N\200\377\212" \
+  "AO\200\377\2@N\177\377\77M~\377\206@N\177\377\10\77M~\377@N\177\377\77" \
+  "M~\377>L}\377\77M~\377;J{\377\34,g\377\30)d\377\217\31*e\377\3\30)d\377" \
+  "\33,g\377;H{\377\204=K}\377\4<K}\377=K}\377<K}\377;K}\377\207<K}\377" \
+  "\2;J|\377:I{\377\206;J|\377\12:I{\377;J|\377:I{\3779Hz\377:I{\3779Hz" \
+  "\377:I{\377;J{\377\"2k\377\30)d\377\222\31*e\377\4\30)d\377%4m\3779G" \
+  "{\3777Ey\377\2058Fz\377\2""7Fy\3776Fx\377\2057Fy\377\4""6Ex\3777Fy\377" \
+  "6Ex\3775Dw\377\2056Ex\377\3""3Bv\377\37""0i\377\30)d\377\224\31*e\377" \
+  "\202\30)d\377\1\"2k\377\2022Av\377\1""1@u\377\2052Av\377\2021Au\377\1" \
+  "0At\377\2061Au\377\4""0@t\3770@u\377.>s\377\33,f\377\232\31*e\377\6\30" \
+  ")d\377\31*e\377-<r\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377" \
+  "\203,<r\377\2\40""0j\377\30)d\377\233\31*e\377\202\30)d\377\2\36""0i" \
+  "\377'7n\377\202(8o\377\2'7o\377&6o\377\205'7o\377\3$4m\377\32+f\377\30" \
+  ")d\377\236\31*e\377\202\30)d\377\1!1k\377\205#3l\377\202\"2k\377\1\34" \
+  "-g\377\202BP\200\377\11BP\201\377BP\200\377AO\200\377BP\201\377AO\200" \
+  "\377,<r\377\34-g\377\27(d\377\30)d\377\220\31*e\377\5\30)d\377\27(c\377" \
+  "\33,g\377.>s\377<J|\377\203DR\202\377\1CQ\201\377\212DR\202\377\202C" \
+  "Q\201\377\203DR\202\377\203ES\203\377\1DR\202\377\301ES\203\377\203D" \
+  "R\202\377\1CQ\201\377\213DR\202\377\7CQ\201\377DR\202\377ES\202\377A" \
+  "O\200\3777Ey\377&6m\377\27)d\377\202\30)d\377\220\31*e\377\202\30)d\377" \
+  "\5\"2k\3779G{\377DR\202\377AO\201\377AO\200\377\204BP\200\377\1BP\177" \
+  "\377\207BP\200\377\2AO\200\377BP\200\377\202AO\200\377\1@N\200\377\207" \
+  "AO\200\377\203@N\177\377\1\77M~\377\206@N\177\377\10\77M~\377@N\177\377" \
+  "\77M~\377>L}\377\77M~\377:H{\377\36/h\377\30)d\377\217\31*e\377\5\30" \
+  ")d\377\32+f\3773Bw\377=K}\377<J|\377\204=K}\377\202<K}\377\1;K}\377\205" \
+  "<K}\377\3;J|\377<K}\377:I{\377\210;J|\377\2:I{\3779Hz\377\202:I{\377" \
+  "\4""9Hz\377;I{\377-=s\377\30)d\377\222\31*e\377\3\30)d\377\33,f\3776" \
+  "Dx\377\2068Fz\377\2027Fy\377\1""6Fx\377\2067Fy\377\2026Ex\377\1""5Dw" \
+  "\377\2036Ex\377\3""5Dw\3776Ex\377,;q\377\202\30)d\377\224\31*e\377\5" \
+  "\30)d\377\31*e\377*:q\3773Bw\3771@u\377\2072Av\377\2""1Au\3770At\377" \
+  "\2051Au\377\4""0@u\3771Au\3770@u\377&7n\377\233\31*e\377\5\30)d\377!" \
+  "1j\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377\203,<r\377\2+" \
+  ";q\377\32+f\377\234\31*e\377\10\30)d\377\31*e\377#3k\377(8o\377'7o\377" \
+  "(8o\377'7o\377&6o\377\204'7o\377\2&6n\377\"2k\377\202\30)d\377\236\31" \
+  "*e\377\4\30)d\377\31+f\377#3l\377\"2k\377\202#3l\377\2\"2k\377#3l\377" \
+  "\202\"2k\377\2\31*e\377BP\177\377\202BP\200\377\202BP\201\377\7AO\200" \
+  "\377BP\201\377CQ\201\3778Gz\377#4l\377\27(c\377\30)d\377\220\31*e\377" \
+  "\202\30)d\377\7\27(d\377\36.h\377)9p\377:I{\377ES\203\377DR\202\377C" \
+  "Q\201\377\213DR\202\377\203CQ\201\377\203DR\202\377\203ES\203\377\1D" \
+  "R\202\377\266ES\203\377\1DR\202\377\203ES\203\377\204DR\202\377\203C" \
+  "Q\201\377\212DR\202\377\11CQ\201\377DR\202\377ES\203\377CQ\201\3772A" \
+  "v\377$4l\377\31*e\377\27(d\377\30)d\377\221\31*e\377\12\30)d\377\31*" \
+  "e\377.=s\377\77M\177\377BP\201\377AO\200\377BP\201\377BP\200\377BP\201" \
+  "\377BP\200\377\202BP\177\377\207BP\200\377\2AO\200\377BP\200\377\202" \
+  "AO\200\377\1@N\200\377\207AO\200\377\4@N\177\377AO\200\377@N\177\377" \
+  "\77M~\377\206@N\177\377\10\77M~\377@N\177\377\77M~\377>L}\377\77M~\377" \
+  ";I{\377!1j\377\30)d\377\221\31*e\377\1,;r\377\205=K}\377\203<K}\377\1" \
+  ";K}\377\205<K}\377\2;J|\377<K}\377\210;J|\377\3:I{\377;J|\3779Hz\377" \
+  "\204:I{\377\2""5Dx\377\35-g\377\222\31*e\377\5\31*d\377\27(d\377-<r\377" \
+  "9Fz\3777Ey\377\2048Fz\377\3""7Fy\3778Fz\3776Fx\377\2067Fy\377\2026Ex" \
+  "\377\1""5Dw\377\2046Ex\377\4""5Dx\3776Ew\377\35.g\377\30)d\377\225\31" \
+  "*e\377\2\31*d\377\36/h\377\2022Av\377\1""1@u\377\2052Av\377\3""1Au\377" \
+  "2Av\3770At\377\2071Au\377\4""0@u\377.>t\377\40""0j\377\30)d\377\231\31" \
+  "*e\377\202\30)d\377\4)9p\377.=r\377-<r\377,;q\377\206-<r\377\6,<r\377" \
+  "+<r\377,<r\377+;q\377,<r\377%5m\377\235\31*e\377\3\30)d\377\32,f\377" \
+  "%6m\377\202(8o\377\202'7o\377\1&6o\377\204'7o\377\3&6n\377\36.i\377\30" \
+  ")d\377\237\31*e\377\2\30)d\377\34.h\377\205#3l\377\202\"2k\377\3\40""0" \
+  "j\377\30)d\377BP\200\377\202BP\177\377\4BP\200\377BP\201\377BP\200\377" \
+  "AO\200\377\202BP\201\377\2@N\177\377-=s\377\202\30)d\377\221\31*e\377" \
+  "\202\30)d\377\6\31*d\377\32+e\377$4l\377:I{\377FS\203\377DR\202\377\202" \
+  "CQ\201\377\213DR\202\377\202CQ\201\377\204DR\202\377\203ES\203\377\1" \
+  "DR\202\377\260ES\203\377\1DR\202\377\203ES\203\377\204DR\202\377\203" \
+  "CQ\201\377\215DR\202\377\5ES\202\377CQ\202\3770\77t\377\35-h\377\31*" \
+  "e\377\202\30)d\377\222\31*e\377\4\27(d\377\36/h\377;I|\377AO\200\377" \
+  "\202BP\201\377\1BP\200\377\202BP\201\377\2BP\200\377BP\177\377\210BP" \
+  "\200\377\3AO\200\377BP\200\377AO\200\377\202@N\200\377\207AO\200\377" \
+  "\4@N\177\377AO\200\377@N\177\377\77M~\377\210@N\177\377\1\77M~\377\202" \
+  ">L}\377\2=K|\377#3k\377\202\30)d\377\217\31*e\377\2\30)d\377%5m\377\202" \
+  "=K}\377\1<J|\377\204=K}\377\2<K}\377;K}\377\207<K}\377\1;J|\377\202:" \
+  "I{\377\205;J|\377\4:I{\377;J|\377:I{\3779Hz\377\202:I{\377\2029Hz\377" \
+  "\1&6n\377\202\30)d\377\221\31*e\377\3\30)d\377!1j\3777Ey\377\2058Fz\377" \
+  "\4""7Fy\3778Fz\3777Fy\3776Fx\377\2057Fy\377\3""6Ex\3777Fy\3775Dw\377" \
+  "\2046Ex\377\5""5Dw\3776Ex\377*:p\377\27(d\377\30)d\377\226\31*e\377\2" \
+  "(8o\3773Bw\377\2102Av\377\2""1Au\3770At\377\2051Au\377\6""0@u\3771Au" \
+  "\377/\77u\377+<r\377\31*e\377\30)d\377\231\31*e\377\5\30)d\377\35.h\377" \
+  ",;r\377-<r\377,;q\377\206-<r\377\1,<r\377\202+<r\377\202,<r\377\3+;q" \
+  "\377\40""0i\377\30)d\377\234\31*e\377\2\30*e\377\35.h\377\203(8o\377" \
+  "\2'7o\377&6o\377\204'7o\377\202&6n\377\2\31*e\377\30)d\377\237\31*e\377" \
+  "\2\30)d\377\40""0k\377\205#3l\377\202\"2k\377\2\35-g\377\30)d\377\203" \
+  "BP\200\377\2BP\177\377BP\200\377\203BP\201\377\6AO\200\377BO\201\377" \
+  "CQ\202\377;I{\377\37""0i\377\31*e\377\202\30)d\377\222\31*e\377\6\30" \
+  ")d\377\27(c\377!1j\3778Fy\377AP\200\377CQ\201\377\202DR\202\377\2DQ\201" \
+  "\377CQ\201\377\214DR\202\377\204CQ\201\377\204DR\202\377\204ES\203\377" \
+  "\1DR\202\377\240ES\203\377\1DR\202\377\205ES\203\377\204DR\202\377\203" \
+  "CQ\201\377\221DR\202\377\4BP\201\377\77M\177\377.>s\377\32+f\377\202" \
+  "\30)d\377\222\31*e\377\202\30)d\377\6\32+e\377,<r\377CQ\201\377BP\201" \
+  "\377AO\200\377BP\200\377\202BP\201\377\1BP\200\377\202BP\177\377\212" \
+  "BP\200\377\2AO\200\377@N\200\377\207AO\200\377\204@N\177\377\1\77M~\377" \
+  "\206@N\177\377\10\77M~\377@N\177\377\77M~\377>L}\377\77M~\377>L}\377" \
+  "&6m\377\27(c\377\217\31*e\377\3\30)e\377\30)d\377\36/i\377\202=K}\377" \
+  "\1<J}\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\4;J|\377" \
+  "<K}\377;J|\377:I{\377\205;J|\377\4:I{\377;J|\377:I{\3779Hz\377\202:I" \
+  "{\377\3""9Hz\377:I{\3771Au\377\202\30)d\377\221\31*e\377\3\30)d\377\31" \
+  "*e\3771@v\377\2058Fz\377\2""7Fy\3778Fz\377\2077Fy\377\3""6Ex\3777Fy\377" \
+  "5Dw\377\2046Ex\377\5""5Dw\3776Ex\3776Ew\377\31+f\377\30)d\377\225\31" \
+  "*e\377\5\30)d\377\33,f\3773Bw\3772Av\3771@u\377\2072Av\377\2061Au\377" \
+  "\6""0@u\3771Au\3770@t\377/\77t\377#3l\377\30)d\377\231\31*e\377\202\30" \
+  ")d\377\4$3l\377.=s\377-<r\377,;q\377\205-<r\377\202,<r\377\1+<r\377\203" \
+  ",<r\377\3)9p\377\33,f\377\30)d\377\235\31*e\377\1!2j\377\202(8o\377\202" \
+  "'7o\377\1&6o\377\205'7o\377\2\"3l\377\30)d\377\237\31*e\377\4\30)d\377" \
+  "\31*f\377\"2k\377\"2l\377\203#3l\377\203\"2k\377\2\32+f\377\30)d\377" \
+  "\204BP\200\377\1BP\177\377\202BP\200\377\10BP\201\377BP\200\377BP\201" \
+  "\377AO\200\377BP\201\377BO\201\377.=s\377\35.h\377\202\30)d\377\223\31" \
+  "*e\377\11\30)d\377\26'c\377\37""0i\377/>t\377:I{\377BP\200\377ES\202" \
+  "\377DR\202\377CQ\201\377\217DR\202\377\204CQ\201\377\204DR\202\377\232" \
+  "ES\203\377\1DR\202\377\207ES\203\377\205DR\202\377\204CQ\201\377\216" \
+  "DR\202\377\1CQ\201\377\202DR\202\377\6ES\202\377\77M~\3776Ex\377(8o\377" \
+  "\31*e\377\26'c\377\202\30)d\377\222\31*e\377\202\30)d\377\3$4l\3778F" \
+  "z\377CQ\202\377\202BP\201\377\2BP\200\377BP\201\377\202BP\200\377\1B" \
+  "P\177\377\210BP\200\377\2AO\200\377BP\200\377\202AO\200\377\1@N\200\377" \
+  "\207AO\200\377\3@N\177\377AO\200\377@N\177\377\202\77M~\377\206@N\177" \
+  "\377\10\77M~\377@N\177\377\77M~\377>L}\377\77M~\377=K|\377&6m\377\26" \
+  "'c\377\220\31*e\377\5\27)d\377\36/h\3779H{\377=K}\377<J|\377\202=K}\377" \
+  "\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\4;J|\377<K}\377;J|\377:I{\377" \
+  "\207;J|\377\202:I{\377\7""9Hz\377:I{\3779Hz\377:I{\3777Gy\377\35.g\377" \
+  "\30)d\377\221\31*e\377\202\30)d\377\1&5m\377\2027Ey\377\2058Fz\377\211" \
+  "7Fy\377\2""6Ex\3775Dw\377\2046Ex\377\4""6Ew\3777Fx\377&7n\377\30)d\377" \
+  "\225\31*e\377\6\31*d\377\27(d\377)9p\3773Bw\3772Av\3771@u\377\2042Av" \
+  "\377\4""1Au\3772Av\3771Au\3770At\377\2061Au\377\2020@u\377\3.>t\377\32" \
+  "*e\377\30)d\377\231\31*e\377\5\30)d\377\33+f\377)9o\377.=s\377,;q\377" \
+  "\207-<r\377\2,<r\377+<r\377\202,<r\377\2+;q\377&6m\377\202\30)d\377\233" \
+  "\31*e\377\3\30)d\377\31*e\377&6n\377\202(8o\377\2'7o\377&6o\377\204'" \
+  "7o\377\4&6n\377'7o\377\35-h\377\30)d\377\237\31*e\377\3\30)d\377\34-" \
+  "g\377\"2k\377\204#3l\377\3\"2k\377!1j\377\40""0j\377\202\31*e\377\205" \
+  "BP\200\377\202BP\177\377\1BP\200\377\202BP\201\377\2BP\200\377AO\200" \
+  "\377\202BP\201\377\4;I|\377*9p\377\27(c\377\30)d\377\223\31*e\377\202" \
+  "\30)d\377\11\27(c\377\34,g\377$4l\377/\77t\377>L~\377GT\204\377ES\202" \
+  "\377DR\202\377CQ\201\377\220DR\202\377\204CQ\201\377\207DR\202\377\224" \
+  "ES\203\377\210DR\202\377\205CQ\201\377\217DR\202\377\12CQ\201\377DR\202" \
+  "\377FT\203\377DR\202\3777Gy\377*9p\377\40""1j\377\31*e\377\27(d\377\30" \
+  ")d\377\223\31*e\377\10\30)d\377\26(c\377\37""0i\3773Bw\377@N\177\377" \
+  "CQ\201\377BP\201\377AO\200\377\202BP\201\377\1BP\200\377\202BP\177\377" \
+  "\210BP\200\377\2AO\200\377BP\200\377\202AO\200\377\1@N\200\377\207AO" \
+  "\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\207@N\177\377\10\77" \
+  "M~\377@N\177\377\77M~\377>L}\377\77M~\377=K|\377%5m\377\30)d\377\220" \
+  "\31*e\377\5\30)d\377\34-g\3775Dx\377=K}\377<J|\377\204=K}\377\202<K}" \
+  "\377\1;K}\377\207<K}\377\2;J|\377:I{\377\206;J|\377\203:I{\377\1""9H" \
+  "z\377\202:I{\377\4""9Hz\377;J|\377#3l\377\27(d\377\222\31*e\377\3\30" \
+  ")d\377\34-f\3773Bv\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\205" \
+  "7Fy\377\2""6Ex\3777Fy\377\2056Ex\377\5""5Dw\3776Ex\3771Au\377\34-g\377" \
+  "\30)e\377\225\31*e\377\2\30)d\377\34-g\377\2022Av\377\1""1@u\377\206" \
+  "2Av\377\2021Au\377\1""0At\377\2041Au\377\6""0@u\3771Au\3770@t\3770@u" \
+  "\377$5m\377\27(d\377\233\31*e\377\4\37/i\377.=s\377-<r\377,;q\377\205" \
+  "-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\202+;q\377\2\37/i\377\30)d" \
+  "\377\234\31*e\377\7\30)d\377\34-h\377)8o\377'7n\377'7o\377(8o\377&6o" \
+  "\377\205'7o\377\3&6n\377\31*e\377\30)d\377\236\31*e\377\202\30)d\377" \
+  "\1\36/i\377\205#3l\377\202\"2k\377\1\36.h\377\202\31*e\377\207BP\200" \
+  "\377\1BP\177\377\202BP\200\377\3BP\201\377BP\200\377AO\200\377\202BP" \
+  "\201\377\5AO\200\3779H{\377\40""1j\377\27(d\377\30)d\377\224\31*e\377" \
+  "\202\30)d\377\10\31*e\377\33,f\377\"2k\3774Cw\377CQ\201\377ES\202\377" \
+  "DR\202\377CQ\201\377\222DR\202\377\207CQ\201\377\224DR\202\377\210CQ" \
+  "\201\377\221DR\202\377\1CQ\201\377\202DR\202\377\6ES\203\377\77M~\377" \
+  "-<r\377\36.h\377\32+f\377\31*e\377\203\30)d\377\223\31*e\377\202\30)" \
+  "d\377\2,;r\377>M~\377\202BP\201\377\2AO\200\377BP\201\377\204BP\200\377" \
+  "\1BP\177\377\210BP\200\377\3AO\200\377BP\200\377AO\200\377\202@N\200" \
+  "\377\207AO\200\377\4@N\177\377AO\200\377@N\177\377\77M~\377\211@N\177" \
+  "\377\1\77M~\377\202>L}\377\2=L}\377&6m\377\202\30)d\377\220\31*e\377" \
+  "\2\32+e\3770@t\377\205=K}\377\202<K}\377\202;K}\377\206<K}\377\2;J|\377" \
+  "<K}\377\211;J|\377\2:I{\3779Hz\377\202:I{\377\5""9Hz\377;J{\377,;q\377" \
+  "\31*e\377\30)d\377\222\31*e\377\2\30)d\377)9o\377\2078Fz\377\1""7Fy\377" \
+  "\2026Fx\377\2067Fy\377\2""6Ex\3775Dw\377\2056Ex\377\3""5Ex\377&7n\377" \
+  "\30)d\377\225\31*e\377\4\30)e\377\27)c\377):q\3773Bw\377\2021@u\377\206" \
+  "2Av\377\2""1Au\3770At\377\2061Au\377\2020@u\377\3""0@t\377\32+e\377\30" \
+  ")d\377\233\31*e\377\2&6m\377.=s\377\210-<r\377\2,<r\377+<r\377\203,<" \
+  "r\377\3*:p\377\30)e\377\30)d\377\234\31*e\377\2\30)d\377#3k\377\203(" \
+  "8o\377\2'7o\377&6o\377\205'7o\377\2!1k\377\30)d\377\237\31*e\377\3\30" \
+  ")d\377\31*e\377\40""1j\377\204#3l\377\202\"2k\377\4!1k\377\34,g\377\30" \
+  ")d\377\31*e\377\211BP\200\377\1BP\177\377\202BP\200\377\202BP\201\377" \
+  "\7BP\200\377AO\200\377BP\201\377BP\200\377/\77t\377\34-g\377\31*e\377" \
+  "\202\30)d\377\225\31*e\377\10\30)d\377\27(c\377\31*e\377'8o\3778Fy\377" \
+  "AO\200\377BP\201\377CQ\201\377\277DR\202\377\1CQ\201\377\203DR\202\377" \
+  "\6CQ\201\377AP\200\377>M~\3771@t\377\40""0i\377\26'c\377\202\30)d\377" \
+  "\225\31*e\377\202\30)d\377\10\31*e\377\"2k\377;J|\377CQ\202\377BP\201" \
+  "\377AO\200\377BP\200\377BP\201\377\202BP\200\377\1BP\177\377\211BP\200" \
+  "\377\2AO\200\377BP\200\377\202AO\200\377\1@N\200\377\210AO\200\377\4" \
+  "@N\177\377AO\200\377@N\177\377\77M~\377\207@N\177\377\10\77M~\377@N\177" \
+  "\377\77M~\377>L}\377\77M~\377=L}\377&7n\377\27(c\377\220\31*e\377\5\30" \
+  ")d\377\31*e\377+:q\377\77L~\377<J|\377\203=K}\377\3<K}\377=K}\377;K}" \
+  "\377\211<K}\377\2;J|\377:I{\377\205;J|\377\4:I{\377;J|\377:I{\3779Hz" \
+  "\377\204:I{\377\3""4Dw\377\34-g\377\30)d\377\222\31*e\377\3\30)d\377" \
+  "\35.h\3779Gz\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2077Fy\377" \
+  "\2""6Ex\3775Dw\377\2046Ex\377\4""5Dw\3771@u\377\33,g\377\30)d\377\225" \
+  "\31*e\377\5\30)d\377\36.h\3770\77u\3772Av\3771@u\377\2062Av\377\2""1" \
+  "Au\3770At\377\2071Au\377\2020@u\377\2%5m\377\30)d\377\232\31*e\377\2" \
+  "\30)d\377\32*e\377\202.=s\377\206-<r\377\2,<r\377-<r\377\203,<r\377\4" \
+  "+;q\377,<r\377\"3k\377\30)d\377\234\31*e\377\7\30)d\377\31*e\377(8o\377" \
+  "'7n\377'7o\377(8o\377&6o\377\206'7o\377\2\34-g\377\30)d\377\237\31*e" \
+  "\377\3\30)d\377\33,f\377\"2k\377\205#3l\377\202!1j\377\5\33+f\377\30" \
+  ")d\377\31*e\377BP\200\377AO\200\377\210BP\200\377\202BP\177\377\202B" \
+  "P\200\377\12BP\201\377BP\200\377AO\200\377BP\201\377DR\202\377>L~\377" \
+  "*:q\377\35.h\377\27)d\377\30)d\377\226\31*e\377\12\30)d\377\27(d\377" \
+  "\26'c\377\33,f\377'7n\3772Au\3779H{\377\77M~\377DR\202\377ES\202\377" \
+  "\203DR\202\377\1CQ\201\377\266DR\202\377\12ES\202\377ES\203\377BP\200" \
+  "\377<K}\3777Ex\377-=s\377!2k\377\27)d\377\26'c\377\30)d\377\227\31*e" \
+  "\377\12\30)d\377\30*d\377#3k\3774Bw\377CQ\202\377BP\201\377AO\200\377" \
+  "BP\201\377BP\200\377BP\201\377\202BP\200\377\1BP\177\377\211BP\200\377" \
+  "\3AO\200\377BP\200\377AO\200\377\202@N\200\377\207AO\200\377\1@N\177" \
+  "\377\202AO\200\377\2@N\177\377\77M~\377\207@N\177\377\10\77M~\377@N\177" \
+  "\377\77M~\377>L}\377\77M~\377<J|\377%5m\377\26'c\377\220\31*e\377\202" \
+  "\30)d\377\3(8o\377\77M~\377<J|\377\203=K}\377\4<K}\377=K}\377<K}\377" \
+  ";K}\377\206<K}\377\203;J|\377\1:I{\377\205;J|\377\4:I{\377;J|\377:I{" \
+  "\3779Hz\377\203:I{\377\5""9Hz\3778Hz\377#4l\377\30)d\377\31*d\377\221" \
+  "\31*e\377\5\30)d\377\31*e\3772Av\3778Fz\3777Ey\377\2058Fz\377\2""7Fy" \
+  "\3776Fx\377\2067Fy\377\2026Ex\377\1""5Dw\377\2046Ex\377\4""5Dw\3776E" \
+  "x\377%5m\377\27(d\377\225\31*e\377\5\30)d\377\30*e\377'7n\3773Bw\377" \
+  "1@u\377\2062Av\377\3""1Au\3772Av\3770At\377\2061Au\377\2020@u\377\3/" \
+  "\77t\377\34,g\377\31*d\377\232\31*e\377\5\30)d\377#3l\377.=s\377-<r\377" \
+  ",;q\377\206-<r\377\205,<r\377\3,<q\377\32+e\377\30)d\377\234\31*e\377" \
+  "\2\30)d\377\37""0i\377\203(8o\377\2'7o\377&6o\377\205'7o\377\2$5m\377" \
+  "\31+e\377\241\31*e\377\3\35.h\377#3l\377\"2k\377\202#3l\377\12\"2k\377" \
+  "#3l\377!1j\377\37/i\377\31*e\377\30)d\377\31*e\377AO\200\377BP\200\377" \
+  "AO\200\377\211BP\200\377\1BP\177\377\202BP\200\377\13BP\201\377BP\200" \
+  "\377BP\201\377AO\200\377BP\201\377CP\201\377;I|\377,<r\377\32+e\377\27" \
+  "(c\377\30)d\377\226\31*e\377\202\30)d\377\16\27(d\377\27(c\377\33,f\377" \
+  "!1j\377'6n\377/\77t\3779Gz\377BP\201\377FT\203\377ES\203\377ES\202\377" \
+  "DR\202\377DR\201\377CQ\202\377\256DR\202\377\1ES\202\377\202FT\203\377" \
+  "\7>L~\3775Dw\377+;q\377$4l\377\36/i\377\30*d\377\27(d\377\202\30)d\377" \
+  "\227\31*e\377\11\30)d\377\26'c\377\"2k\3774Cw\377\77M\177\377CP\201\377" \
+  "BP\201\377AO\201\377BP\200\377\202BP\201\377\202BP\200\377\1BP\177\377" \
+  "\213BP\200\377\2AO\200\377@N\200\377\210AO\200\377\2@N\177\377AO\200" \
+  "\377\202@N\177\377\1\77M~\377\207@N\177\377\10\77M~\377@N\177\377\77" \
+  "M~\377>L}\377\77M~\377;I{\377#3k\377\30)d\377\220\31*e\377\6\30)d\377" \
+  "\27(d\377(9o\377<J|\377=K}\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377" \
+  ";K}\377\210<K}\377\2;J|\377:I{\377\207;J|\377\202:I{\377\1""9Hz\377\202" \
+  ":I{\377\3""9Hz\377:I{\377+;r\377\202\30)d\377\221\31*e\377\5\30)e\377" \
+  "\27(c\377)9p\3778Fz\3777Ey\377\2048Fz\377\3""7Fy\3778Fz\3776Fx\377\206" \
+  "7Fy\377\3""6Ex\3777Fy\3775Dw\377\2046Ex\377\3""5Dx\3776Ex\3771\77t\377" \
+  "\202\30)d\377\225\31*e\377\5\30)d\377\34,g\3770\77u\3772Av\3771@u\377" \
+  "\2072Av\377\2""1Au\3770At\377\2051Au\377\4""0@u\3771At\3770@u\377'7o" \
+  "\377\233\31*e\377\3\30)d\377\30*d\377,<r\377\202-<r\377\1,;q\377\204" \
+  "-<r\377\11,<r\377-<r\377,<r\377+<r\377,<r\377+;r\377,<r\377%5m\377\30" \
+  ")d\377\234\31*e\377\202\30)d\377\1%5m\377\203(8o\377\205'7o\377\3&6n" \
+  "\377'7o\377\40""1j\377\242\31*e\377\1\40""0j\377\205#3l\377\4\"2k\377" \
+  "!1j\377\35.h\377\30)d\377\202\31*e\377\2@N\200\377AO\200\377\213BP\200" \
+  "\377\1BP\177\377\202BP\200\377\202BP\201\377\1BP\200\377\203BP\201\377" \
+  "\3AO\200\377>M~\377):p\377\203\30)d\377\227\31*e\377\1\30)e\377\203\30" \
+  ")d\377\11\31*e\377\32+f\377\34,g\377!2k\377-;r\3777Fy\377AO\200\377E" \
+  "S\203\377ES\202\377\203DR\202\377\1CQ\201\377\243DR\202\377\1CQ\201\377" \
+  "\202DR\202\377\1ER\202\377\202ES\203\377\7=L~\3772Bv\377'7o\377\35.g" \
+  "\377\33,f\377\32+e\377\31*e\377\204\30)d\377\227\31*e\377\5\30)d\377" \
+  "\27(d\377\35.h\3775Dx\377\77N\177\377\202BP\201\377\202AO\200\377\202" \
+  "BP\201\377\202BP\200\377\202BP\177\377\211BP\200\377\204AO\200\377\1" \
+  "@N\200\377\211AO\200\377\1@N\177\377\202\77M~\377\211@N\177\377\5\77" \
+  "M~\377>L}\377\77M~\377<K|\377!1j\377\202\30)d\377\220\31*e\377\5\30)" \
+  "d\377%5m\377;I|\377=K}\377<J|\377\204=K}\377\1<K}\377\202;K}\377\206" \
+  "<K}\377\3;J|\377<K}\377:I{\377\210;J|\377\2:I{\3779Hz\377\202:I{\377" \
+  "\5""9Hz\377:I{\3774Dw\377\31*e\377\30)d\377\222\31*e\377\3\30)d\377\40" \
+  "0j\3775Cx\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2077Fy\377\2" \
+  "6Ex\3775Dw\377\2046Ex\377\4""6Ew\3777Fy\377\36/h\377\30)d\377\227\31" \
+  "*e\377\2&5n\3773Bw\377\2072Av\377\3""1Au\3772Av\3770At\377\2071Au\377" \
+  "\4""0@u\377.>t\377\37""0i\377\30)d\377\232\31*e\377\5\30)d\377!1j\377" \
+  ".=s\377-<r\377,;q\377\206-<r\377\1,<r\377\202+<r\377\5,<r\377,<q\377" \
+  ",<r\377\35-h\377\30)d\377\234\31*e\377\6\30)d\377\34-g\377&7n\377'7n" \
+  "\377'7o\377(8o\377\206'7o\377\3&6n\377\35.h\377\30)d\377\241\31*e\377" \
+  "\206#3l\377\4\"2k\377!1j\377\32+f\377\30)d\377\202\31*e\377\1AO\200\377" \
+  "\202@N\200\377\1AO\200\377\202BP\200\377\1AO\200\377\211BP\200\377\2" \
+  "BP\177\377BP\200\377\202BP\201\377\3BP\200\377BP\201\377AO\200\377\202" \
+  "BP\201\377\4=K~\377&6n\377\33,f\377\31*e\377\202\30)d\377\232\31*e\377" \
+  "\203\30)d\377\7\27(d\377\27(c\377\34-g\377%5m\377/>s\3777Fy\377\77M~" \
+  "\377\202AO\200\377\3BP\200\377BQ\201\377CQ\201\377\232DR\202\377\202" \
+  "CQ\201\377\13BP\201\377BP\200\377AO\200\377@O\177\377<J|\3773Cv\377*" \
+  ":p\377\"2j\377\31*e\377\27(c\377\27(d\377\202\30)d\377\233\31*e\377\202" \
+  "\30)d\377\3\31*e\377\35.g\3771@u\377\204BP\201\377\1BP\200\377\202BP" \
+  "\201\377\1BP\200\377\202BP\177\377\211BP\200\377\2AO\200\377BP\200\377" \
+  "\202AO\200\377\1@N\200\377\210AO\200\377\1@N\177\377\202AO\200\377\2" \
+  "@N\177\377\77M~\377\207@N\177\377\1\77M~\377\202@N\177\377\6\77M~\377" \
+  ">L}\377\77M~\377<J{\377\36.h\377\30)d\377\221\31*e\377\5\30)d\377\40" \
+  "1j\377;I{\377=K}\377<J|\377\202=K}\377\4<K}\377=K}\377<K}\377;K}\377" \
+  "\206<K}\377\1;J|\377\202<K}\377\1:I{\377\206;J|\377\4:I{\377;J|\377:" \
+  "I{\3779Hz\377\202:I{\377\5""9Hz\377:I{\3779Gz\377\33,g\377\30)d\377\223" \
+  "\31*e\377\2\32+e\377.=s\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377" \
+  "\2057Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2066Ex\377\2+:p\377\30)d" \
+  "\377\226\31*e\377\5\30)d\377\33,e\3772Aw\3772Av\3771@u\377\2052Av\377" \
+  "\2""1Au\3772Av\377\2101Au\377\5""0@u\377/\77u\377*;q\377\31*d\377\30" \
+  ")d\377\231\31*e\377\202\30)d\377\4*9p\377.=s\377-<r\377,;q\377\206-<" \
+  "r\377\7,<r\377+<r\377,<r\377+;q\377,<r\377(8o\377\32+e\377\234\31*e\377" \
+  "\202\30)d\377\1\40""1j\377\202'7o\377\3(8o\377'7o\377&6o\377\205'7o\377" \
+  "\3$5m\377\32+f\377\30)d\377\237\31*e\377\2\30)d\377\34-g\377\206#3l\377" \
+  "\4\"2k\377!1j\377\30*e\377\30)d\377\202\31*e\377\203AO\200\377\1@N\200" \
+  "\377\202AO\200\377\2BP\200\377AO\200\377\211BP\200\377\1BP\177\377\202" \
+  "BP\200\377\202BP\201\377\10BP\200\377BP\201\377BO\201\377BP\201\377D" \
+  "R\202\377:I{\377)9p\377\36/h\377\203\30)d\377\234\31*e\377\4\31)d\377" \
+  "\30)d\377\27(d\377\27(c\377\202\26'c\377\17\33,f\377\40""1j\377%5m\377" \
+  "*:p\377.>t\3773Bv\3776Ex\3778Fy\3779H{\377;I|\377<K}\377>L}\377\77M~" \
+  "\377\77N\177\377@N\177\377\203AO\200\377\1BO\200\377\202AO\200\377\23" \
+  "@O\200\377@N\177\377\77M\177\377>M~\377=K}\377<J|\377:I{\3779Gz\3777" \
+  "Fy\3775Dw\3771@u\377-<r\377(8o\377#3l\377\36.i\377\30)d\377\26'b\377" \
+  "\26'c\377\27(d\377\202\30)d\377\235\31*e\377\11\30)d\377\27(d\377\32" \
+  "+e\377#3l\3771Au\377BP\201\377CQ\202\377BP\201\377AO\200\377\203BP\201" \
+  "\377\202BP\200\377\1BP\177\377\212BP\200\377\2AO\200\377BP\200\377\202" \
+  "AO\200\377\1@N\200\377\210AO\200\377\2@N\177\377AO\200\377\202@N\177" \
+  "\377\1\77M~\377\207@N\177\377\2\77M~\377@N\177\377\202\77M~\377\5>L}" \
+  "\377\77M~\3776Ex\377\35-g\377\30)d\377\221\31*e\377\5\27(d\377!1j\377" \
+  ":H{\377=K}\377<J|\377\204=K}\377\2<K}\377;K}\377\210<K}\377\202;J|\377" \
+  "\1:I{\377\207;J|\377\2:I{\3779Hz\377\204:I{\377\3""9Hz\377$4l\377\30" \
+  ")d\377\223\31*e\377\2\30)d\377$4l\377\2078Fz\377\2027Fy\377\1""6Fx\377" \
+  "\2067Fy\377\2066Ex\377\5""5Dw\3776Ex\3773Bv\377\35-g\377\30)e\377\225" \
+  "\31*e\377\6\31*d\377\27(d\377(8o\3773Bw\3772Av\3771@u\377\2062Av\377" \
+  "\2071Au\377\6""0@u\3771Au\3770@t\3770@u\377!1j\377\30)d\377\232\31*e" \
+  "\377\5\30)d\377\37/i\377,<r\377.=s\377,;q\377\206-<r\377\202,<r\377\1" \
+  "+<r\377\203,<r\377\1!2k\377\235\31*e\377\3\30)d\377\32*e\377$4l\377\202" \
+  "(8o\377\202'7o\377\1&6o\377\204'7o\377\2&6n\377\"2k\377\202\30)d\377" \
+  "\237\31*e\377\2\30)d\377\40""1k\377\205#3l\377\202\"2k\377\2\36.h\377" \
+  "\30)d\377\203\31*e\377\204AO\200\377\1@N\200\377\202AO\200\377\2BP\200" \
+  "\377AO\200\377\211BP\200\377\202BP\177\377\202BP\200\377\203BP\201\377" \
+  "\202AO\200\377\10BP\201\377CQ\201\377;J|\3771@u\377!1k\377\26'c\377\27" \
+  ")d\377\30)d\377\237\31*e\377\204\30)d\377\1\27(d\377\202\27(c\377\12" \
+  "\30)d\377\32*e\377\33,f\377\35-h\377\36/h\377\40""0i\377!1j\377!2j\377" \
+  "\"2k\377#3k\377\202#3l\377\14$3l\377#3l\377#3k\377\"3k\377\"2k\377!1" \
+  "j\377\40""1j\377\37/i\377\36.h\377\34-g\377\33+f\377\31*e\377\202\27" \
+  "(c\377\202\27(d\377\203\30)d\377\240\31*e\377\14\30)d\377\26(c\377\32" \
+  "+f\377)9p\3777Fy\377\77M\177\377CQ\201\377BP\201\377AO\200\377BP\201" \
+  "\377BP\200\377BP\201\377\203BP\200\377\1BP\177\377\212BP\200\377\2AO" \
+  "\200\377BP\200\377\202AO\200\377\1@N\200\377\212AO\200\377\202@N\177" \
+  "\377\1\77M~\377\211@N\177\377\202\77M~\377\5>L}\377\77M~\3772Au\377\34" \
+  "-g\377\30)d\377\221\31*e\377\5\27(c\377!1j\3779Gz\377=K}\377<J|\377\203" \
+  "=K}\377\3<K}\377=K}\377;K}\377\207<K}\377\203;J|\377\1:I{\377\206;J|" \
+  "\377\3:I{\377;J|\3779Hz\377\203:I{\377\5""9Hz\377:I{\377+<r\377\31*e" \
+  "\377\30)d\377\222\31*e\377\5\30)d\377\34-g\3776Dy\3778Fz\3777Ey\377\205" \
+  "8Fz\377\2""7Fy\3776Fx\377\2057Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377" \
+  "\2056Ex\377\3""6Dw\377'7n\377\31)e\377\226\31*e\377\2\30)d\377\35.h\377" \
+  "\2022Av\377\1""1@u\377\2052Av\377\4""1Au\3772Av\3771Au\3770At\377\206" \
+  "1Au\377\2020@u\377\1,<r\377\202\30)d\377\231\31*e\377\6\30)d\377\31*" \
+  "e\377%5m\377.=s\377-<r\377,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203" \
+  ",<r\377\3*:p\377\35-g\377\30)d\377\234\31*e\377\3\30)d\377\34,g\377'" \
+  "7n\377\202(8o\377\2'7o\377&6o\377\204'7o\377\4&6o\377&6n\377\35.h\377" \
+  "\30)d\377\237\31*e\377\4\30)d\377\32*e\377#3l\377#3k\377\202#3l\377\2" \
+  "\"2k\377#3l\377\202\"2k\377\2\32+f\377\30)d\377\203\31*e\377\205AO\200" \
+  "\377\1@N\200\377\202AO\200\377\2BP\200\377AO\200\377\212BP\200\377\1" \
+  "BP\177\377\203BP\200\377\2BP\201\377BP\200\377\204BP\201\377\4AO\200" \
+  "\377@N\177\3779Gz\377#4l\377\202\30)d\377\244\31*e\377\232\30)d\377\244" \
+  "\31*e\377\6\30)d\377\27(d\377\32+e\377-=s\377=K~\377AO\200\377\202BP" \
+  "\201\377\3BP\200\377AO\200\377BP\200\377\202BP\201\377\202BP\200\377" \
+  "\202BP\177\377\211BP\200\377\1AO\200\377\202BP\200\377\1AO\200\377\202" \
+  "@N\200\377\210AO\200\377\3@N\177\377AO\200\377@N\177\377\202\77M~\377" \
+  "\210@N\177\377\202\77M~\377\202>L}\377\3\77M~\3770\77t\377\31*e\377\202" \
+  "\30)d\377\220\31*e\377\5\30)d\377\40""0i\3778Fz\377=K}\377<J|\377\203" \
+  "=K}\377\2<K}\377=K}\377\212<K}\377\2;J|\377:I{\377\206;J|\377\2:I{\377" \
+  ";J|\377\206:I{\377\4""4Cw\377\32+f\377\30)d\377\31*d\377\221\31*e\377" \
+  "\5\30)d\377\27(d\3772@u\3778Fz\3777Ey\377\2048Fz\377\2""7Fy\3778Fz\377" \
+  "\2026Fx\377\2067Fy\377\1""6Ex\377\2025Dw\377\2056Ex\377\3""2Au\377\33" \
+  ",f\377\30)d\377\225\31*e\377\4\30)d\377\27(d\377+;r\3773Bw\377\2021@" \
+  "u\377\2062Av\377\1""1Au\377\2020At\377\2041Au\377\6""0@u\3771Au\3770" \
+  "@t\3771Au\377\36/i\377\30)d\377\232\31*e\377\5\30)d\377\34-g\377+;q\377" \
+  ".=s\377,;q\377\207-<r\377\2,<r\377+<r\377\202,<r\377\2,<q\377'7n\377" \
+  "\202\30)d\377\235\31*e\377\1\40""0i\377\203(8o\377\2'7o\377&6o\377\204" \
+  "'7o\377\4'7n\377%5n\377\31*e\377\30)d\377\237\31*e\377\4\30)d\377\35" \
+  "-h\377#3l\377\"2l\377\203#3l\377\202\"2k\377\1\40""0j\377\202\30)d\377" \
+  "\203\31*e\377\213AO\200\377\2BP\200\377AO\200\377\212BP\200\377\1BP\177" \
+  "\377\203BP\200\377\202BP\201\377\11BP\200\377BP\201\377AO\200\377BP\201" \
+  "\377CQ\202\377<J}\377)9p\377\33,f\377\32*e\377\203\30)d\377\331\31*e" \
+  "\377\202\30)d\377\5\31*e\377\32+e\377\40""0i\3772Av\377CP\201\377\202" \
+  "BP\201\377\3AO\200\377BP\201\377BP\200\377\202BP\201\377\202BP\200\377" \
+  "\202BP\177\377\212BP\200\377\2AO\200\377BP\200\377\202AO\200\377\202" \
+  "@N\200\377\213AO\200\377\202\77M~\377\207@N\177\377\1\77M~\377\202@N" \
+  "\177\377\6\77M~\377>L}\377\77M~\377>L~\377,;p\377\26'c\377\222\31*e\377" \
+  "\5\30)d\377\36.h\3777Fy\377=K}\377<J|\377\203=K}\377\4<K}\377=K}\377" \
+  "<K}\377;K}\377\206<K}\377\4;J|\377<K}\377;J|\377:I{\377\206;J|\377\4" \
+  ":I{\377;J|\377:I{\3779Hz\377\202:I{\377\5""9Hz\377:I{\3778Gz\377\35." \
+  "h\377\30)d\377\222\31*e\377\202\30)d\377\3(7o\3778Fz\3777Ey\377\2048" \
+  "Fz\377\3""7Fy\3778Fz\3776Fx\377\2067Fy\377\4""6Ex\3777Fy\3776Ex\3775" \
+  "Dw\377\2056Ex\377\3""5Dw\377#4l\377\27(d\377\225\31*e\377\202\30)d\377" \
+  "\4\37""0i\3771@u\3772Av\3771@u\377\2062Av\377\2021Au\377\1""0At\377\206" \
+  "1Au\377\4""0@t\3770@u\377+;q\377\30)d\377\234\31*e\377\2!2j\377/>s\377" \
+  "\210-<r\377\2,<r\377+<r\377\202,<r\377\202+;q\377\2\37""0i\377\30)d\377" \
+  "\234\31*e\377\3\30)d\377\31*e\377&6m\377\202(8o\377\2'7o\377&6o\377\204" \
+  "'7o\377\4&6n\377'7o\377\40""0k\377\30)d\377\237\31*e\377\202\30)d\377" \
+  "\2!1k\377#3k\377\204#3l\377\202\"2k\377\2\35.h\377\30)d\377\204\31*e" \
+  "\377\210AO\200\377\202@N\200\377\202AO\200\377\2BP\200\377AO\200\377" \
+  "\212BP\200\377\202BP\177\377\203BP\200\377\202BP\201\377\13BP\200\377" \
+  "AO\201\377AO\200\377BP\201\377DQ\202\377@N\200\3772@u\377%5m\377\36." \
+  "h\377\30)d\377\27(d\377\202\30)d\377\323\31*e\377\202\30)d\377\5\27(" \
+  "d\377\32+f\377!2j\377*:p\3778Gz\377\202CQ\201\377\4BP\201\377AO\200\377" \
+  "BP\201\377BP\200\377\202BP\201\377\202BP\200\377\202BP\177\377\212BP" \
+  "\200\377\1AO\200\377\202BP\200\377\1AO\200\377\202@N\200\377\211AO\200" \
+  "\377\204@N\177\377\1\77M~\377\211@N\177\377\202\77M~\377\5>L}\377\77" \
+  "M~\377;I|\377&5m\377\27(d\377\222\31*e\377\5\27(d\377\36/i\3777Ey\377" \
+  ">L}\377<J|\377\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\4" \
+  ";J|\377<K}\377;J|\377:I{\377\210;J|\377\2:I{\3779Hz\377\202:I{\377\5" \
+  "9Hz\377:I{\3779Hz\377#3k\377\27(d\377\223\31*e\377\3\30)d\377\37""0i" \
+  "\3776Dx\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2077Fy\377\2""6" \
+  "Ex\3775Dw\377\2046Ex\377\5""5Dw\3776Ex\377/>s\377\27(d\377\30)d\377\225" \
+  "\31*e\377\5\30)d\377\31*e\377*9p\3773Bw\3771@u\377\2062Av\377\3""1Au" \
+  "\3772Av\3770At\377\2061Au\377\2030@u\377\2\37/i\377\30)d\377\232\31*" \
+  "e\377\4\30*d\377\31*e\377*:q\377.=s\377\210-<r\377\205,<r\377\1*:p\377" \
+  "\202\30)d\377\234\31*e\377\7\30)d\377\34-g\377)9o\377'7n\377'7o\377(" \
+  "8o\377&6o\377\206'7o\377\2\32+f\377\30)d\377\237\31*e\377\4\30)d\377" \
+  "\33+f\377\"2k\377\"2l\377\203#3l\377\203\"2k\377\2\32+f\377\30)d\377" \
+  "\204\31*e\377\212AO\200\377\202@N\200\377\1AO\200\377\202BP\200\377\1" \
+  "AO\200\377\212BP\200\377\203BP\177\377\202BP\200\377\2BP\201\377BP\200" \
+  "\377\202BP\201\377\11AO\200\377BP\201\377CQ\201\377AO\200\377:I|\377" \
+  "3Bv\377'6n\377\32*f\377\26'c\377\202\30)d\377\316\31*e\377\11\31*d\377" \
+  "\30)d\377\27(c\377\26'c\377\37""0i\377,<r\3776Ey\377>L~\377CQ\201\377" \
+  "\202BP\201\377\3AO\200\377BP\201\377BP\200\377\202BP\201\377\203BP\200" \
+  "\377\1BP\177\377\213BP\200\377\2AO\200\377BP\200\377\202AO\200\377\1" \
+  "@N\200\377\211AO\200\377\1@N\177\377\202AO\200\377\1@N\177\377\202\77" \
+  "M~\377\210@N\177\377\203\77M~\377\4>L}\377@M~\3778Gy\377\40""1j\377\202" \
+  "\30)d\377\221\31*e\377\5\27(c\377\40""1j\3777Fy\377=K}\377<J|\377\203" \
+  "=K}\377\4<K}\377=K}\377<K}\377;K}\377\210<K}\377\202;J|\377\1:I{\377" \
+  "\206;J|\377\3:I{\377;J|\3779Hz\377\205:I{\377\2'7o\377\30)d\377\224\31" \
+  "*e\377\2\32+f\377/>t\377\2078Fz\377\2107Fy\377\3""6Ex\3777Fy\3775Dw\377" \
+  "\2066Ex\377\3""5Dw\377\34-g\377\30)d\377\227\31*e\377\1\37/i\377\202" \
+  "2Av\377\1""1@u\377\2052Av\377\4""1Au\3772Av\3771Au\3770At\377\2051Au" \
+  "\377\5""0@u\3771At\3770@u\377*9p\377\32+e\377\233\31*e\377\3\30)d\377" \
+  "\40""0i\377/=s\377\207-<r\377\2,<r\377-<r\377\203,<r\377\4+;q\377,<r" \
+  "\377!2j\377\30)d\377\235\31*e\377\2\30)d\377$4m\377\203(8o\377\2'7o\377" \
+  "&6o\377\205'7o\377\2#4l\377\30)d\377\240\31*e\377\3\30)d\377\35.h\377" \
+  "\"2k\377\204#3l\377\3\"2k\377\"1j\377\40""0i\377\206\31*e\377\2AO\200" \
+  "\377@N\177\377\215AO\200\377\2BP\200\377AO\200\377\213BP\200\377\202" \
+  "BP\177\377\202BP\200\377\203BP\201\377\3BP\200\377BP\201\377AO\200\377" \
+  "\203BP\201\377\7@N\200\377\77M~\3774Cv\377#3l\377\30)d\377\27(d\377\30" \
+  ")d\377\312\31*e\377\202\30)d\377\6\27(d\377\33-g\377+;q\377;I|\377\77" \
+  "N\177\377AO\200\377\203BP\201\377\3AO\200\377BP\201\377BP\200\377\202" \
+  "BP\201\377\202BP\200\377\203BP\177\377\212BP\200\377\1AO\200\377\202" \
+  "BP\200\377\202AO\200\377\202@N\200\377\210AO\200\377\2@N\177\377AO\200" \
+  "\377\202@N\177\377\1\77M~\377\211@N\177\377\7\77M~\377@N\177\377\77M" \
+  "~\377>L}\377@N\177\3774Bv\377\32+f\377\202\30)d\377\221\31*e\377\5\30" \
+  ")d\377\40""0j\3778Gz\377=K}\377<J|\377\203=K}\377\4<K}\377=K}\377<K}" \
+  "\377;K}\377\207<K}\377\202;J|\377\202:I{\377\206;J|\377\4:I{\377;J|\377" \
+  ":I{\3779Hz\377\204:I{\377\3-=s\377\32*e\377\30)e\377\223\31*e\377\2\30" \
+  ")d\377'6n\377\2068Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2057Fy\377\4" \
+  "6Ex\3777Fy\3776Ex\3775Dw\377\2046Ex\377\4""5Dw\3777Fy\377%5m\377\30)" \
+  "d\377\227\31*e\377\3\30)d\377,;r\3773Bw\377\2102Av\377\2""1Au\3770At" \
+  "\377\2071Au\377\4""0@u\377/\77t\377!1j\377\30)d\377\232\31*e\377\6\30" \
+  ")e\377\30)c\377+:q\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377+<r\377" \
+  "\203,<r\377\3+;q\377\31*e\377\30)d\377\234\31*e\377\2\30)d\377\33+f\377" \
+  "\202(8o\377\3'7o\377(8o\377&6o\377\204'7o\377\4&6n\377'7o\377\35.h\377" \
+  "\30)d\377\237\31*e\377\3\30)d\377\31*e\377\40""0j\377\204#3l\377\203" \
+  "\"2k\377\1\35-h\377\206\31*e\377\203@N\177\377\213AO\200\377\202@N\200" \
+  "\377\202AO\200\377\216BP\200\377\202BP\177\377\202BP\200\377\203BP\201" \
+  "\377\14BP\200\377BP\201\377AO\200\377AO\201\377BP\201\377CQ\201\377@" \
+  "O\200\3772Bv\377$3l\377\33,f\377\32+f\377\31*e\377\204\30)d\377\275\31" \
+  "*e\377\204\30)d\377\11\31*e\377\32+f\377\36/h\377+:q\3779H{\377CQ\202" \
+  "\377CP\201\377BP\201\377AO\200\377\202BP\201\377\1BP\200\377\202BP\201" \
+  "\377\202BP\200\377\203BP\177\377\213BP\200\377\2AO\200\377BP\200\377" \
+  "\203AO\200\377\1@N\200\377\212AO\200\377\2@N\177\377AO\200\377\202@N" \
+  "\177\377\1\77M~\377\212@N\177\377\202\77M~\377\5>L}\377\77M~\377>L}\377" \
+  ",;r\377\30)d\377\222\31*e\377\202\30)d\377\4\37""0i\3779Gz\377=K}\377" \
+  "<J|\377\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\4;J|\377" \
+  "<K}\377;J|\377:I{\377\211;J|\377\2:I{\3779Hz\377\202:I{\377\5""9Hz\377" \
+  ":I{\3774Cw\377\33,f\377\30)d\377\223\31*e\377\2\30)d\377\36/i\377\207" \
+  "8Fz\377\2027Fy\377\1""6Fx\377\2057Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw" \
+  "\377\2066Ex\377\2/>s\377\33,f\377\227\31*e\377\5\30)d\377\40""0j\377" \
+  "4Cx\3772Av\3771@u\377\2072Av\377\2101Au\377\5""0@u\377/\77u\377+;q\377" \
+  "\32*e\377\30)d\377\232\31*e\377\5\30)d\377\37""0j\377.=s\377-<r\377," \
+  ";q\377\207-<r\377\2,<r\377+<r\377\203,<r\377\2#3k\377\30)d\377\234\31" \
+  "*e\377\202\30)d\377\1!2j\377\203(8o\377\207'7o\377\2%5n\377\32+e\377" \
+  "\240\31*e\377\3\30)d\377\32+f\377!2k\377\205#3l\377\202!1j\377\2\33," \
+  "f\377\30)d\377\205\31*e\377\202\77M~\377\1@N\177\377\202AO\200\377\1" \
+  "@N\177\377\212AO\200\377\1@N\200\377\202AO\200\377\202BP\200\377\1AO" \
+  "\200\377\214BP\200\377\202BP\177\377\203BP\200\377\202BP\201\377\1BP" \
+  "\200\377\202BP\201\377\12AO\200\377BP\201\377CQ\201\377DR\202\377@N\200" \
+  "\3775Dx\377+;q\377$4l\377\37/i\377\32+f\377\202\27(d\377\202\30)d\377" \
+  "\1\30)e\377\265\31*e\377\203\30)d\377\7\27(d\377\30)d\377\34-g\377!2" \
+  "k\377'7n\3770\77t\377:I|\377\202CQ\202\377\202BP\201\377\3AO\200\377" \
+  "BP\201\377BP\200\377\203BP\201\377\203BP\200\377\1BP\177\377\214BP\200" \
+  "\377\1AO\200\377\202BP\200\377\202AO\200\377\202@N\200\377\211AO\200" \
+  "\377\1@N\177\377\202AO\200\377\1@N\177\377\202\77M~\377\210@N\177\377" \
+  "\2\77M~\377@N\177\377\202\77M~\377\4>L}\377\77M~\377:H{\377&6m\377\202" \
+  "\30)d\377\221\31*e\377\6\30)d\377\27)d\377\"2k\377:H{\377=K}\377<J|\377" \
+  "\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\4;J|\377<K}\377" \
+  ";J|\377:I{\377\207;J|\377\203:I{\377\1""9Hz\377\202:I{\377\5""9Hz\377" \
+  ":I{\3777Fx\377\36/i\377\27)d\377\223\31*e\377\5\30)d\377\33,f\3774Cw" \
+  "\3778Fz\3777Ey\377\2048Fz\377\3""7Fy\3778Fz\3776Fx\377\2077Fy\377\202" \
+  "6Ex\377\1""5Dw\377\2056Ex\377\3""4Dw\377!2k\377\30)d\377\226\31*e\377" \
+  "\5\30)d\377\31*e\3770\77u\3773Av\3771@u\377\2052Av\377\4""1Au\3772Av" \
+  "\3771Au\3770At\377\2051Au\377\6""0@u\3771Au\3770@t\3770@u\377!2k\377" \
+  "\30)d\377\232\31*e\377\202\30)d\377\4)9p\377.=s\377-<r\377,;q\377\206" \
+  "-<r\377\2,<r\377+<r\377\203,<r\377\3+;q\377\33,f\377\30)d\377\234\31" \
+  "*e\377\6\30)d\377\31*e\377&6n\377(8n\377'7o\377(8o\377\205'7o\377\3&" \
+  "6n\377'7o\377!1j\377\242\31*e\377\3\34-g\377#3l\377#3k\377\202#3l\377" \
+  "\6\"2k\377#3l\377!1j\377\40""0i\377\31*e\377\30)d\377\205\31*e\377\202" \
+  "@N\177\377\1\77M~\377\202@N\177\377\202AO\200\377\1@N\177\377\211AO\200" \
+  "\377\202@N\200\377\202AO\200\377\202BP\200\377\1AO\200\377\214BP\200" \
+  "\377\202BP\177\377\203BP\200\377\206BP\201\377\1AO\200\377\202BP\201" \
+  "\377\13CQ\202\377AO\200\377<J}\3777Fy\3771@u\377(8o\377\40""1j\377\31" \
+  "*d\377\26'c\377\27(c\377\27)d\377\202\30)d\377\255\31*e\377\202\30)d" \
+  "\377\11\27(d\377\26(c\377\26'c\377\34-g\377$4m\377,<r\3774Cw\3779H{\377" \
+  ">L~\377\202CQ\201\377\202BP\201\377\1AO\200\377\202BP\201\377\1BP\200" \
+  "\377\202BP\201\377\203BP\200\377\203BP\177\377\214BP\200\377\2AO\200" \
+  "\377BP\200\377\202AO\200\377\202@N\200\377\212AO\200\377\2@N\177\377" \
+  "AO\200\377\202@N\177\377\1\77M~\377\211@N\177\377\2\77M~\377@N\177\377" \
+  "\202\77M~\377\4\77M}\377AN\177\3773Bv\377\37/i\377\202\30)d\377\221\31" \
+  "*e\377\6\30)d\377\27(d\377&6m\377:H{\377=K}\377<J|\377\203=K}\377\4<" \
+  "K}\377=K}\377<K}\377;K}\377\210<K}\377\202;J|\377\1:I{\377\206;J|\377" \
+  "\4:I{\377;J|\377:I{\3779Hz\377\202:I{\377\5""9Hz\377:I{\3779Hz\377!1" \
+  "j\377\27(d\377\223\31*e\377\5\30)d\377\31*e\377.=s\3778Fz\3777Ey\377" \
+  "\2048Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2067Fy\377\2026Ex\377\1""5" \
+  "Dw\377\2046Ex\377\3""5Dw\3776Ex\377+;q\377\202\30)d\377\225\31*e\377" \
+  "\6\31*d\377\27(d\377'7o\3773Bw\3772Av\3771@u\377\2062Av\377\2021Au\377" \
+  "\1""0At\377\2061Au\377\2020@u\377\1+;r\377\202\30)d\377\232\31*e\377" \
+  "\5\30)d\377\37/i\377-<r\377.=s\377,;q\377\206-<r\377\202,<r\377\5+<r" \
+  "\377,<r\377+;q\377,<r\377%5m\377\236\31*e\377\5\30)d\377\36.h\377'7n" \
+  "\377'7o\377(8o\377\207'7o\377\3&6n\377\35.h\377\30)d\377\241\31*e\377" \
+  "\3\40""0j\377#3l\377\"2l\377\203#3l\377\3\"2k\377!1j\377\36.h\377\202" \
+  "\30)d\377\205\31*e\377\203@N\177\377\1\77M~\377\203@N\177\377\214AO\200" \
+  "\377\1@N\200\377\203AO\200\377\2BP\200\377AO\200\377\215BP\200\377\202" \
+  "BP\177\377\204BP\200\377\202BP\201\377\1BP\200\377\203BP\201\377\1AO" \
+  "\200\377\203BP\201\377\13AO\200\377@N\200\377\77N\177\377>L~\3778Fz\377" \
+  "->s\377%4m\377\33,g\377\27(c\377\27(d\377\27)d\377\203\30)d\377\243\31" \
+  "*e\377\203\30)d\377\12\27(d\377\27(c\377\30)e\377\37""0i\377)9p\3773" \
+  "Av\377<J}\377\77M\177\377@N\177\377AO\200\377\204BP\201\377\1AO\200\377" \
+  "\206BP\201\377\203BP\200\377\202BP\177\377\215BP\200\377\1AO\200\377" \
+  "\202BP\200\377\202AO\200\377\202@N\200\377\212AO\200\377\2@N\177\377" \
+  "AO\200\377\202@N\177\377\202\77M~\377\210@N\177\377\4\77M~\377@N\177" \
+  "\377\77M~\377>L}\377\202\77M~\377\2+:q\377\32+f\377\202\30)d\377\222" \
+  "\31*e\377\5\30)d\377'6n\377;I{\377=K}\377<J|\377\203=K}\377\4<K}\377" \
+  "=K}\377<K}\377;K}\377\207<K}\377\202;J|\377\202:I{\377\206;J|\377\4:" \
+  "I{\377;J|\377:I{\3779Hz\377\205:I{\377\2#4l\377\30)e\377\224\31*e\377" \
+  "\3\30)d\377&5n\3777Ey\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377" \
+  "\2067Fy\377\3""6Ex\3777Fy\3775Dw\377\2066Ex\377\3""4Cw\377\31+f\377\30" \
+  ")d\377\226\31*e\377\5\30)d\377\36.h\3770\77u\3773Bw\3771@u\377\2072A" \
+  "v\377\2""1Au\3770At\377\2051Au\377\6""0@u\3771Au\3770@t\3771Av\377\35" \
+  ".h\377\30)d\377\232\31*e\377\6\30)d\377\31*e\377&6m\377.=s\377-<r\377" \
+  ",;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203,<r\377\3+;q\377\36/i\377" \
+  "\30)d\377\234\31*e\377\10\30)d\377\31*e\377\"3k\377(8o\377'7o\377(8o" \
+  "\377'7o\377&6o\377\205'7o\377\3$4m\377\31*f\377\30)d\377\237\31*e\377" \
+  "\2\30*e\377\32*e\377\206#3l\377\4\"2k\377!1j\377\33,g\377\30)d\377\206" \
+  "\31*e\377\206@N\177\377\1\77M~\377\202@N\177\377\202AO\200\377\1@N\177" \
+  "\377\212AO\200\377\202@N\200\377\202AO\200\377\202BP\200\377\1AO\200" \
+  "\377\216BP\200\377\202BP\177\377\204BP\200\377\207BP\201\377\1AO\200" \
+  "\377\203BP\201\377\10CQ\201\377DQ\202\377@N\200\3778Fz\3770\77u\377)" \
+  "8p\377\"1k\377\34-g\377\202\33,f\377\2\32+f\377\32+e\377\202\31*e\377" \
+  "\226\30)d\377\203\31*e\377\2\32+e\377\32+f\377\202\33,f\377\10\37.i\377" \
+  "%5m\377,<r\3774Cw\377;J}\377CQ\201\377CQ\202\377CP\201\377\202BP\201" \
+  "\377\1AO\200\377\204BP\201\377\1BP\200\377\203BP\201\377\203BP\200\377" \
+  "\203BP\177\377\216BP\200\377\2AO\200\377BP\200\377\203AO\200\377\1@N" \
+  "\200\377\213AO\200\377\2@N\177\377AO\200\377\202@N\177\377\1\77M~\377" \
+  "\212@N\177\377\2\77M~\377@N\177\377\202\77M~\377\4\77M}\377\77M~\377" \
+  ";I{\377$4m\377\202\30)d\377\222\31*e\377\6\30)d\377\31*e\377'6n\377>" \
+  "K}\377=K}\377<J|\377\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}" \
+  "\377\4;J|\377<K}\377;J|\377:I{\377\207;J|\377\4:I{\377;J|\377:I{\377" \
+  "9Hz\377\203:I{\377\5""9Hz\3779H{\377*9p\377\31*e\377\30)d\377\223\31" \
+  "*e\377\5\30)d\377\36/h\3775Dx\3778Fz\3777Ey\377\2058Fz\377\2""7Fy\377" \
+  "6Fx\377\2077Fy\377\2""6Ex\3775Dw\377\2046Ex\377\1""5Dw\377\2026Ex\377" \
+  "\2!2j\377\30)d\377\226\31*e\377\5\30)d\377\31*e\377(8o\3773Bw\3771@u" \
+  "\377\2062Av\377\2021Au\377\1""0At\377\2071Au\377\4""0@t\3770@u\377)9" \
+  "o\377\30)d\377\233\31*e\377\5\30)d\377\35-g\377,;r\377.=s\377,;q\377" \
+  "\207-<r\377\1+<r\377\204,<r\377\3(8o\377\32+e\377\30)d\377\234\31*e\377" \
+  "\3\30)d\377\33,f\377&6m\377\202(8o\377\2'7o\377&6o\377\205'7o\377\3&" \
+  "6n\377!1k\377\30)d\377\240\31*e\377\2\30)d\377\35-h\377\206#3l\377\4" \
+  "\"2k\377!1j\377\30*e\377\30)d\377\206\31*e\377\207@N\177\377\202\77M" \
+  "~\377\202@N\177\377\2AO\200\377@N\177\377\213AO\200\377\1@N\200\377\203" \
+  "AO\200\377\202BP\200\377\1AO\200\377\216BP\200\377\203BP\177\377\203" \
+  "BP\200\377\212BP\201\377\1AO\200\377\202BP\201\377\23CQ\201\377DQ\202" \
+  "\377DR\202\377CQ\202\377\77M\177\377:I|\3776Ey\3773Bv\377/>t\377+;q\377" \
+  "(8o\377&6n\377%5m\377$4l\377#3k\377\"2k\377!1j\377\40""1j\377\40""0j" \
+  "\377\204\37""0i\377\20\40""0i\377\40""0j\377\40""1j\377!1j\377\"2k\377" \
+  "#3l\377$4m\377%5n\377'7o\377*9q\377-<r\3771@u\3774Dw\3778Gz\377=K}\377" \
+  "AO\200\377\202DR\202\377\2CQ\202\377CQ\201\377\202BP\201\377\1AO\200" \
+  "\377\205BP\201\377\1BP\200\377\203BP\201\377\204BP\200\377\202BP\177" \
+  "\377\222BP\200\377\202AO\200\377\202@N\200\377\212AO\200\377\1@N\177" \
+  "\377\202AO\200\377\202@N\177\377\202\77M~\377\210@N\177\377\1\77M~\377" \
+  "\202@N\177\377\10\77M~\377>L}\377\77M~\377>L}\3772Av\377\35.g\377\27" \
+  "(c\377\31*d\377\222\31*e\377\6\30)d\377\32+e\377+;r\377>L~\377=K}\377" \
+  "<J|\377\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\206<K}\377\4;J|\377" \
+  "<K}\377;J|\377:I{\377\211;J|\377\202:I{\377\1""9Hz\377\202:I{\377\5""9" \
+  "Hz\377:I{\377/>s\377\31*e\377\30)d\377\223\31*e\377\5\30)d\377\32+f\377" \
+  "2@u\3778Fz\3777Ey\377\2058Fz\377\2027Fy\377\1""6Fx\377\2057Fy\377\2""6" \
+  "Ex\3777Fy\377\2066Ex\377\4""5Ew\3776Ex\377+:p\377\30)d\377\230\31*e\377" \
+  "\4\36/i\3771Av\3772Av\3771@u\377\2072Av\377\2""1Au\3770At\377\2051Au" \
+  "\377\6""0@u\3771At\3770@u\377/\77t\377\35.g\377\30)d\377\234\31*e\377" \
+  "\2$4l\377/=s\377\207-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\202+;q" \
+  "\377\2!2j\377\30)d\377\236\31*e\377\6\37/i\377(8o\377(8n\377(8o\377'" \
+  "7o\377&6o\377\204'7o\377\202&6n\377\2\33,f\377\30)d\377\237\31*e\377" \
+  "\202\30)d\377\1!1k\377\205#3l\377\202\"2k\377\2\36.i\377\30)d\377\207" \
+  "\31*e\377\210@N\177\377\202\77M~\377\202@N\177\377\202AO\200\377\1@N" \
+  "\177\377\212AO\200\377\203@N\200\377\202AO\200\377\222BP\200\377\203" \
+  "BP\177\377\204BP\200\377\204BP\201\377\1BP\200\377\206BP\201\377\1AO" \
+  "\200\377\204BP\201\377\2CP\201\377CQ\201\377\202CQ\202\377\7CP\201\377" \
+  "AO\200\377@N\200\377\77M\177\377>M~\377=L~\377=K}\377\202<K}\377\203" \
+  "<J}\377\202<K}\377\6=K}\377>L~\377\77M\177\377@N\177\377AO\200\377BP" \
+  "\201\377\202CQ\202\377\202CQ\201\377\214BP\201\377\1BP\200\377\204BP" \
+  "\201\377\203BP\200\377\204BP\177\377\217BP\200\377\2AO\200\377BP\200" \
+  "\377\203AO\200\377\202@N\200\377\213AO\200\377\2@N\177\377AO\200\377" \
+  "\202@N\177\377\202\77M~\377\213@N\177\377\202\77M~\377\6>L}\377@M~\377" \
+  ";I{\377&6n\377\31*e\377\30)d\377\223\31*e\377\6\30)d\377\34,g\3771@u" \
+  "\377=K}\377=K|\377<J|\377\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\210" \
+  "<K}\377\202;J|\377\1:I{\377\207;J|\377\203:I{\377\1""9Hz\377\202:I{\377" \
+  "\5""9Hz\377;J{\3770@t\377\32+e\377\30)d\377\223\31*e\377\5\30)d\377\27" \
+  ")d\377.<s\3779Gz\3777Ey\377\2068Fz\377\2""7Fy\3776Fx\377\2057Fy\377\2" \
+  "6Ex\3777Fy\377\2066Ex\377\5""5Dw\3776Ex\3771@u\377\34-g\377\30)d\377" \
+  "\227\31*e\377\3\30)d\377,;r\3773Bw\377\2072Av\377\3""1Au\3772Av\3770" \
+  "At\377\2071Au\377\2020@u\377\1'7n\377\234\31*e\377\2\30)d\377\32+f\377" \
+  "\212-<r\377\2,<r\377+<r\377\203,<r\377\3*:p\377\31*d\377\30)d\377\236" \
+  "\31*e\377\2%5m\377(8o\377\203'7o\377\1&6o\377\205'7o\377\1#4l\377\202" \
+  "\30)d\377\237\31*e\377\4\30)d\377\33,f\377#3l\377\"2k\377\202#3l\377" \
+  "\2\"2k\377#3l\377\202\"2k\377\2\32+f\377\30)d\377\207\31*e\377\212@N" \
+  "\177\377\202\77M~\377\202@N\177\377\2AO\200\377@N\177\377\214AO\200\377" \
+  "\1@N\200\377\203AO\200\377\202BP\200\377\1AO\200\377\220BP\200\377\204" \
+  "BP\177\377\204BP\200\377\217BP\201\377\1AO\200\377\237BP\201\377\1BP" \
+  "\200\377\205BP\201\377\204BP\200\377\204BP\177\377\223BP\200\377\202" \
+  "AO\200\377\203@N\200\377\213AO\200\377\3@N\177\377AO\200\377@N\177\377" \
+  "\202\77M~\377\212@N\177\377\3\77M~\377@N\177\377\77M~\377\202>L}\377" \
+  "\3@N~\3775Cw\377\35.g\377\202\30)d\377\223\31*e\377\3\30)d\377\34,g\377" \
+  "5Dx\377\202=K}\377\1<J}\377\205=K}\377\2<K}\377;K}\377\207<K}\377\202" \
+  ";J|\377\202:I{\377\207;J|\377\4:I{\377;J|\377:I{\3779Hz\377\202:I{\377" \
+  "\5""9Hz\377:I{\3773Bv\377\32+e\377\30)d\377\223\31*e\377\4\30)e\377\27" \
+  "(c\377)8o\3777Ey\377\2068Fz\377\3""7Fy\3778Fz\3776Fx\377\2077Fy\377\1" \
+  "6Ex\377\2025Dw\377\2056Ex\377\3""5Dw\377$4k\377\30)d\377\227\31*e\377" \
+  "\5\30)d\377\"2l\3773Bw\3772Av\3771@u\377\2052Av\377\4""1Au\3772Av\377" \
+  "1Au\3770At\377\2051Au\377\6""0@u\3771Au\377/\77u\377->s\377\36/h\377" \
+  "\30)d\377\233\31*e\377\5\30)d\377&5m\377.=s\377-<r\377,;q\377\205-<r" \
+  "\377\2,<r\377-<r\377\203,<r\377\4+;q\377,<r\377!2k\377\30)d\377\235\31" \
+  "*e\377\2\30)d\377\34-g\377\202(8o\377\3'7o\377(8o\377&6o\377\204'7o\377" \
+  "\4&6n\377'7o\377\35-h\377\30)d\377\240\31*e\377\2\30)d\377\37/i\377\205" \
+  "#3l\377\202\"2k\377\1\40""0i\377\202\30)d\377\207\31*e\377\3\77M~\377" \
+  "@N\177\377\77M~\377\212@N\177\377\1\77M~\377\202@N\177\377\202AO\200" \
+  "\377\1@N\177\377\214AO\200\377\202@N\200\377\203AO\200\377\203BP\200" \
+  "\377\1AO\200\377\222BP\200\377\205BP\177\377\206BP\200\377\211BP\201" \
+  "\377\1BP\200\377\226BP\201\377\206BP\200\377\205BP\177\377\226BP\200" \
+  "\377\203AO\200\377\203@N\200\377\216AO\200\377\202@N\177\377\202\77M" \
+  "~\377\213@N\177\377\202\77M~\377\7>L}\377\77M}\377>M~\377=K|\377(8n\377" \
+  "\27(c\377\30)d\377\223\31*e\377\202\30)d\377\4\37.i\3779I{\377=K}\377" \
+  "<J|\377\203=K}\377\3<K}\377=K}\377<K}\377\202;K}\377\206<K}\377\4;J|" \
+  "\377<K}\377;J|\377:I{\377\207;J|\377\1:I{\377\202;J|\377\1""9Hz\377\203" \
+  ":I{\377\5""9Hz\377:I{\3775Dw\377\35.g\377\30)d\377\224\31*e\377\3\30" \
+  ")d\377\"2k\3776Dx\377\2058Fz\377\1""7Fy\377\2028Fz\377\1""6Fx\377\206" \
+  "7Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2046Ex\377\3""5Dw\3776Ex\377" \
+  "-<r\377\202\30)d\377\226\31*e\377\2\30)d\377\32+f\377\2022Av\377\1""1" \
+  "@u\377\2052Av\377\4""1Au\3772Av\3771Au\3770At\377\2051Au\377\5""0@u\377" \
+  "1Au\3770@t\377/\77t\377(8o\377\202\30)d\377\232\31*e\377\3\30)d\377\33" \
+  ",f\377.=s\377\202-<r\377\1,;q\377\204-<r\377\12,<r\377-<r\377,<r\377" \
+  "+<r\377,<r\377+;q\377,<r\377+;q\377\31*e\377\30)d\377\234\31*e\377\202" \
+  "\30)d\377\1$4l\377\203(8o\377\1&6o\377\206'7o\377\2%5n\377\30)d\377\240" \
+  "\31*e\377\2\30)d\377\31*e\377\202\"2k\377\204#3l\377\202\"2k\377\2\34" \
+  "-g\377\30)d\377\210\31*e\377\2>L}\377\77M~\377\214@N\177\377\202\77M" \
+  "~\377\202@N\177\377\202AO\200\377\1@N\177\377\214AO\200\377\203@N\200" \
+  "\377\203AO\200\377\202BP\200\377\1AO\200\377\225BP\200\377\205BP\177" \
+  "\377\212BP\200\377\216BP\201\377\212BP\200\377\206BP\177\377\225BP\200" \
+  "\377\1AO\200\377\202BP\200\377\203AO\200\377\202@N\200\377\215AO\200" \
+  "\377\2@N\177\377AO\200\377\203@N\177\377\1\77M~\377\212@N\177\377\2\77" \
+  "M~\377@N\177\377\202\77M~\377\6>L}\377\77M~\377>L}\3772Au\377\35.h\377" \
+  "\27(d\377\224\31*e\377\6\30)d\377\31*e\377&5m\377<J|\377=K}\377<J|\377" \
+  "\203=K}\377\4<K}\377=K}\377<K}\377;K}\377\207<K}\377\4;J|\377<K}\377" \
+  ";J|\377:I{\377\211;J|\377\202:I{\377\1""9Hz\377\202:I{\377\6""9Hz\377" \
+  ":I{\3776Ex\377\40""0j\377\30)d\377\30)e\377\223\31*e\377\5\30)d\377\34" \
+  "-g\3773Av\3778Fz\3777Ey\377\2058Fz\377\2107Fy\377\4""6Ex\3777Fy\3776" \
+  "Ex\3775Dw\377\2046Ex\377\5""5Dw\3776Ex\3773Bv\377\33,f\377\30)d\377\226" \
+  "\31*e\377\202\30)d\377\4)9p\3773Bw\3772Av\3771@u\377\2062Av\377\2021" \
+  "Au\377\1""0At\377\2061Au\377\2020@u\377\3.>t\377\33,f\377\30)d\377\232" \
+  "\31*e\377\202\30)d\377\4&6n\377.=s\377-<r\377,;q\377\206-<r\377\202," \
+  "<r\377\6+<r\377,<r\377+<r\377,<r\377!1k\377\30)d\377\235\31*e\377\7\30" \
+  ")d\377\33+f\377(8o\377'7n\377'7o\377(8o\377&6o\377\204'7o\377\4&6n\377" \
+  "'7o\377\37/i\377\30)d\377\240\31*e\377\3\30)d\377\34-g\377\"2k\377\204" \
+  "#3l\377\202\"2k\377\1\"1j\377\212\31*e\377\203\77M~\377\202@N\177\377" \
+  "\1\77M~\377\212@N\177\377\1\77M~\377\203@N\177\377\202AO\200\377\1@N" \
+  "\177\377\215AO\200\377\202@N\200\377\203AO\200\377\233BP\200\377\211" \
+  "BP\177\377\220BP\200\377\211BP\177\377\230BP\200\377\1AO\200\377\203" \
+  "BP\200\377\203AO\200\377\202@N\200\377\220AO\200\377\202@N\177\377\202" \
+  "\77M~\377\211@N\177\377\1\77M~\377\202@N\177\377\203\77M~\377\4AO\177" \
+  "\3778Fy\377$4l\377\31*e\377\202\30)d\377\223\31*e\377\6\30)d\377\31*" \
+  "e\377,<r\377<J|\377=K}\377<J|\377\203=K}\377\4<K}\377=K}\377<K}\377;" \
+  "K}\377\211<K}\377\202;J|\377\1:I{\377\207;J|\377\203:I{\377\1""9Hz\377" \
+  "\202:I{\377\4""9Hz\377:I{\3779Hz\377\40""1j\377\202\30)d\377\223\31*" \
+  "e\377\5\30)d\377\30)e\3770>t\3779Fz\3777Ey\377\2068Fz\377\2""7Fy\377" \
+  "6Fx\377\2077Fy\377\2""6Ex\3775Dw\377\2076Ex\377\2\40""1i\377\30)d\377" \
+  "\227\31*e\377\2\30)d\377\40""1j\377\2022Av\377\1""1@u\377\2072Av\377" \
+  "\2""1Au\3770At\377\2051Au\377\6""0@u\3771Au\3770@t\3771Au\377#4l\377" \
+  "\27(d\377\233\31*e\377\3\30)d\377\35-g\377,;r\377\202-<r\377\1,;q\377" \
+  "\206-<r\377\2,<r\377+<r\377\203,<r\377\3):p\377\32+f\377\31*d\377\235" \
+  "\31*e\377\2\27(d\377#3k\377\203(8o\377\2'7o\377&6o\377\205'7o\377\3&" \
+  "5n\377\32+f\377\30)d\377\237\31*e\377\3\30)d\377\31*e\377\37/i\377\204" \
+  "#3l\377\4\"2k\377#3l\377\"2k\377\36/i\377\212\31*e\377\2""7Dx\377@N\177" \
+  "\377\203\77M~\377\202@N\177\377\1\77M~\377\211@N\177\377\203\77M~\377" \
+  "\202@N\177\377\220AO\200\377\202@N\200\377\204AO\200\377\202BP\200\377" \
+  "\1AO\200\377\236BP\200\377\220BP\177\377\242BP\200\377\204AO\200\377" \
+  "\202@N\200\377\215AO\200\377\2@N\177\377AO\200\377\203@N\177\377\202" \
+  "\77M~\377\214@N\177\377\202\77M~\377\5>L}\377\77M~\377>L~\377*;p\377" \
+  "\33,f\377\202\30)d\377\224\31*e\377\3\30)d\377\31+e\3774Cw\377\210=K" \
+  "}\377\1<K}\377\202;K}\377\207<K}\377\202;J|\377\202:I{\377\207;J|\377" \
+  "\4:I{\377;J|\377:I{\3779Hz\377\202:I{\377\4""9Hz\377:I{\3779I{\377\37" \
+  "0i\377\202\30)d\377\223\31*e\377\3\30)e\377\27(c\377-<s\377\2028Fz\377" \
+  "\1""7Ey\377\2048Fz\377\2027Fy\377\2026Fx\377\2057Fy\377\2""6Ex\3777F" \
+  "y\377\2066Ex\377\5""5Dw\3777Fy\377'7n\377\31*d\377\30)d\377\226\31*e" \
+  "\377\5\30)d\377\32+f\377,;r\3773Bw\3771@u\377\2062Av\377\2""1Au\3772" \
+  "Av\377\2020At\377\2061Au\377\2020@u\377\3,<r\377\31*e\377\30)d\377\232" \
+  "\31*e\377\3\30)d\377\31*e\377%5m\377\202.=s\377\1,;q\377\206-<r\377\1" \
+  ",<r\377\202+<r\377\4,<r\377+;q\377,<r\377#3k\377\236\31*e\377\6\30)d" \
+  "\377\33+f\377&6n\377(8o\377'7o\377(8o\377\205'7o\377\3&6n\377'7o\377" \
+  "!1j\377\241\31*e\377\3\30)d\377\32+f\377!1k\377\205#3l\377\202\"2k\377" \
+  "\2\34,g\377\30)d\377\211\31*e\377\7\30)d\377)9o\377<J|\377>L~\377\77" \
+  "M~\377>L}\377\77M~\377\202@N\177\377\1\77M~\377\213@N\177\377\202\77" \
+  "M~\377\202@N\177\377\222AO\200\377\202@N\200\377\204AO\200\377\203BP" \
+  "\200\377\1AO\200\377\300BP\200\377\1AO\200\377\203BP\200\377\204AO\200" \
+  "\377\203@N\200\377\216AO\200\377\1@N\177\377\202AO\200\377\202@N\177" \
+  "\377\202\77M~\377\213@N\177\377\1\77M~\377\202@N\177\377\202\77M~\377" \
+  "\5>L}\377\77M~\377>L}\3777Ey\377\37/i\377\202\30)d\377\224\31*e\377\202" \
+  "\30)d\377\4\37""0j\377:I{\377=K}\377<J|\377\203=K}\377\1<K}\377\202=" \
+  "K}\377\2<K}\377;K}\377\207<K}\377\4;J|\377<K}\377;J|\377:I{\377\207;" \
+  "J|\377\1:I{\377\202;J|\377\1""9Hz\377\203:I{\377\5""9Hz\377:I{\3779G" \
+  "z\377!2k\377\30)d\377\224\31*e\377\202\30)d\377\3'7o\3778Fz\3777Ey\377" \
+  "\2048Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2107Fy\377\2""6Ex\3775Dw" \
+  "\377\2066Ex\377\2/>s\377\33,f\377\230\31*e\377\3\30)d\377#2k\3774Cw\377" \
+  "\2072Av\377\3""1Au\3772Av\3770At\377\2061Au\377\2""0@u\3771At\377\202" \
+  "0@u\377\2\36/i\377\30)d\377\233\31*e\377\5\30)d\377\34-g\377+;q\377." \
+  "=s\377,;q\377\207-<r\377\2,<r\377+<r\377\203,<r\377\3*:p\377\34-g\377" \
+  "\30)d\377\234\31*e\377\202\30)d\377\6\40""0i\377'7n\377'7o\377(8o\377" \
+  "'7o\377&6o\377\205'7o\377\3&6n\377\35-g\377\30)d\377\240\31*e\377\4\31" \
+  "*d\377\35-g\377#3l\377\"2k\377\202#3l\377\6\"2k\377#3l\377!1j\377\40" \
+  "0j\377\32+e\377\30)d\377\211\31*e\377\7\30)d\377\27(c\377\36.h\3770\77" \
+  "t\377;I{\377@N~\377\77M}\377\202\77M~\377\202@N\177\377\1\77M~\377\213" \
+  "@N\177\377\202\77M~\377\202@N\177\377\202AO\200\377\1@N\177\377\217A" \
+  "O\200\377\203@N\200\377\204AO\200\377\204BP\200\377\1AO\200\377\271B" \
+  "P\200\377\1AO\200\377\203BP\200\377\204AO\200\377\203@N\200\377\217A" \
+  "O\200\377\1@N\177\377\202AO\200\377\203@N\177\377\202\77M~\377\213@N" \
+  "\177\377\2\77M~\377@N\177\377\202\77M~\377\1>L}\377\202\77M~\377\4""7" \
+  "Fy\377'7n\377\27(d\377\30)d\377\225\31*e\377\6\30)d\377\31*e\377(8o\377" \
+  ";I|\377=K}\377<J|\377\203=K}\377\2<K}\377=K}\377\202<K}\377\1;K}\377" \
+  "\207<K}\377\4;J|\377<K}\377;J|\377:I{\377\211;J|\377\202:I{\377\1""9" \
+  "Hz\377\202:I{\377\4""9Hz\377:I{\3778Gz\377%5m\377\202\30)d\377\224\31" \
+  "*e\377\3\30)d\377\"2k\3776Dy\377\2078Fz\377\2""7Fy\3776Fx\377\2107Fy" \
+  "\377\2""6Ex\3775Dw\377\2066Ex\377\3""4Cv\377\40""0j\377\30)d\377\227" \
+  "\31*e\377\4\30)d\377\33,g\3771@v\3773Bw\377\2102Av\377\2""1Au\3770At" \
+  "\377\2071Au\377\4""0@t\3770@u\377(8o\377\32*e\377\234\31*e\377\5\30)" \
+  "d\377#4l\377/>s\377-<r\377,;q\377\205-<r\377\3,<r\377-<r\377+<r\377\203" \
+  ",<r\377\2+;q\377%5m\377\202\30)d\377\234\31*e\377\3\30)d\377\32+e\377" \
+  "$4l\377\202(8o\377\202'7o\377\1&6o\377\205'7o\377\3$4l\377\32*e\377\30" \
+  ")d\377\241\31*e\377\1\40""0j\377\205#3l\377\3\"2k\377!1j\377\36/i\377" \
+  "\202\30)d\377\213\31*e\377\202\30)d\377\2!1j\3770\77t\377\202\77M~\377" \
+  "\1>L}\377\202\77M~\377\2@N\177\377\77M~\377\213@N\177\377\203\77M~\377" \
+  "\202@N\177\377\223AO\200\377\204@N\200\377\204AO\200\377\204BP\200\377" \
+  "\1AO\200\377\260BP\200\377\1AO\200\377\205BP\200\377\204AO\200\377\203" \
+  "@N\200\377\220AO\200\377\1@N\177\377\202AO\200\377\202@N\177\377\203" \
+  "\77M~\377\213@N\177\377\1\77M~\377\202@N\177\377\202\77M~\377\5\77M}" \
+  "\377@N\177\377;I{\377(8o\377\33,g\377\202\30)d\377\225\31*e\377\6\27" \
+  "(d\377\33-f\3771@u\377<J|\377=K}\377=K|\377\205=K}\377\202<K}\377\1;" \
+  "K}\377\211<K}\377\202;J|\377\1:I{\377\207;J|\377\203:I{\377\1""9Hz\377" \
+  "\202:I{\377\1""9Hz\377\202:I{\377\1%5m\377\202\30)d\377\224\31*e\377" \
+  "\5\30)d\377\35.h\3774Cw\3778Fz\3777Ey\377\2048Fz\377\4""7Fy\3778Fz\377" \
+  "7Fy\3776Fx\377\2067Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2046Ex\377" \
+  "\3""5Dw\3776Ex\377&6n\377\202\30)d\377\226\31*e\377\6\30)e\377\27)c\377" \
+  ",;r\3773Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3772Av\377\2071Au\377" \
+  "\6""0@u\3771Au\377/\77u\377.>s\377\36/i\377\30)d\377\233\31*e\377\2\30" \
+  ")d\377\33,f\377\212-<r\377\2,<r\377+<r\377\202,<r\377\4+;q\377,<r\377" \
+  "\34-g\377\30)d\377\236\31*e\377\1\35.h\377\203(8o\377\2'7o\377&6o\377" \
+  "\205'7o\377\2&6n\377\40""0i\377\202\30)d\377\237\31*e\377\2\30)d\377" \
+  "\32+e\377\206#3l\377\4\"2k\377!1j\377\34,g\377\30)d\377\215\31*e\377" \
+  "\202\30)d\377\4\31*e\377\40""1j\3777Fy\377@N~\377\203\77M~\377\202@N" \
+  "\177\377\1\77M~\377\214@N\177\377\1\77M~\377\204@N\177\377\2AO\200\377" \
+  "@N\177\377\222AO\200\377\204@N\200\377\204AO\200\377\205BP\200\377\1" \
+  "AO\200\377\246BP\200\377\1AO\200\377\205BP\200\377\205AO\200\377\204" \
+  "@N\200\377\221AO\200\377\1@N\177\377\202AO\200\377\203@N\177\377\202" \
+  "\77M~\377\216@N\177\377\202\77M~\377\1>L}\377\202\77M~\377\3+;q\377\33" \
+  ",f\377\31*e\377\202\30)d\377\224\31*e\377\4\30)d\377\27(c\377\"2j\377" \
+  "9G{\377\202=K}\377\1<J|\377\204=K}\377\202<K}\377\202;K}\377\210<K}\377" \
+  "\202;J|\377\202:I{\377\207;J|\377\4:I{\377;J|\377:I{\3779Hz\377\202:" \
+  "I{\377\4""9Hz\377:I{\377;J{\377#3k\377\202\30)d\377\224\31*e\377\3\30" \
+  ")d\377\31*e\3773Bw\377\2028Fz\377\1""7Ez\377\2058Fz\377\1""7Fy\377\202" \
+  "6Fx\377\2057Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2046Ex\377\3""5Dw" \
+  "\3776Ex\377-=s\377\202\30)d\377\227\31*e\377\5\27(d\377#4m\3773Bw\377" \
+  "2Av\3771@u\377\2052Av\377\4""1Au\3772Av\3771Au\3770At\377\2071Au\377" \
+  "\3""0@u\377/\77t\377(8o\377\202\30)d\377\233\31*e\377\5\27)d\377'6n\377" \
+  ".=s\377-<r\377,;q\377\205-<r\377\2,<r\377-<r\377\205,<r\377\1%5m\377" \
+  "\202\30)d\377\236\31*e\377\6\"3l\377(8o\377'7n\377(8o\377'7o\377&6o\377" \
+  "\204'7o\377\202&6n\377\2\31*e\377\30)d\377\240\31*e\377\4\30)d\377\36" \
+  "/h\377#3l\377\"2k\377\202#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\31*" \
+  "d\377\30)d\377\220\31*e\377\7\30)d\377\27(c\377%5m\3779Hz\377>L}\377" \
+  "\77M~\377>L}\377\203\77M~\377\2@N\177\377\77M~\377\215@N\177\377\1\77" \
+  "M~\377\203@N\177\377\203AO\200\377\1@N\177\377\225AO\200\377\204@N\200" \
+  "\377\207AO\200\377\234BP\200\377\207AO\200\377\205@N\200\377\230AO\200" \
+  "\377\203@N\177\377\202\77M~\377\214@N\177\377\1\77M~\377\202@N\177\377" \
+  "\202\77M~\377\1>L}\377\202\77M~\377\5=K|\3772Au\377\34,g\377\30)d\377" \
+  "\31)d\377\225\31*e\377\7\31)e\377\30)d\377\32+f\377)9p\377<J|\377=K}" \
+  "\377<J}\377\203=K}\377\2<K}\377=K}\377\202<K}\377\1;K}\377\207<K}\377" \
+  "\2;J|\377<K}\377\202;J|\377\1:I{\377\207;J|\377\1:I{\377\202;J|\377\1" \
+  "9Hz\377\203:I{\377\5""9Hz\377:I{\3779Hz\377$4l\377\30)d\377\225\31*e" \
+  "\377\5\30)d\377\31*e\3771@v\3778Fz\3777Ey\377\2048Fz\377\4""7Fy\3778" \
+  "Fz\3777Fy\3776Fx\377\2107Fy\377\2066Ex\377\5""5Dw\3776Ex\3772Bv\377\31" \
+  "+e\377\30)d\377\226\31*e\377\6\31*d\377\30)d\377\34-g\3770\77u\3772A" \
+  "v\3771@u\377\2072Av\377\2""1Au\3770At\377\2051Au\377\7""0@u\3771Au\377" \
+  "1At\3770@u\377/\77t\377\32+f\377\30)d\377\233\31*e\377\5\30)d\377\35" \
+  "-g\377.=s\377-<r\377,;q\377\205-<r\377\4,<r\377-<r\377,<r\377+<r\377" \
+  "\204,<r\377\2\32+f\377\30)d\377\235\31*e\377\4\30)d\377\33+f\377(8o\377" \
+  "(8n\377\202'7o\377\1&6o\377\204'7o\377\4&6n\377'7o\377!1k\377\30)d\377" \
+  "\240\31*e\377\202\30)d\377\2\"2l\377#3k\377\202#3l\377\2\"2k\377#3l\377" \
+  "\202\"2k\377\2\36.h\377\30)d\377\223\31*e\377\4\27(d\377\32*e\377)9p" \
+  "\3776Ex\377\202\77M~\377\1>L}\377\202\77M~\377\202@N\177\377\1\77M~\377" \
+  "\214@N\177\377\203\77M~\377\203@N\177\377\203AO\200\377\1@N\177\377\226" \
+  "AO\200\377\207@N\200\377\234AO\200\377\207@N\200\377\227AO\200\377\1" \
+  "@N\177\377\202AO\200\377\203@N\177\377\203\77M~\377\215@N\177\377\2\77" \
+  "M~\377@N\177\377\202\77M~\377\7>L}\377\77M~\377@N~\377;I{\3772@u\377" \
+  "!2j\377\26(c\377\202\30)d\377\225\31*e\377\7\30)d\377\27)d\377\37/i\377" \
+  "1@u\377>L}\377=K}\377<J|\377\205=K}\377\202<K}\377\1;K}\377\211<K}\377" \
+  "\202;J|\377\1:I{\377\211;J|\377\202:I{\377\1""9Hz\377\202:I{\377\4""9" \
+  "Hz\377:I{\3778Gz\377&6m\377\202\30)d\377\224\31*e\377\5\30)d\377\31*" \
+  "e\377,<r\3778Fz\3777Ey\377\2068Fz\377\2""7Fy\3776Fx\377\2107Fy\377\2" \
+  "6Ex\3775Dw\377\2046Ex\377\5""5Dw\3776Ex\3774Dw\377\37""0i\377\30)d\377" \
+  "\227\31*e\377\5\30)d\377\31*e\377)8p\3773Bw\3771@u\377\2072Av\377\202" \
+  "1Au\377\1""0At\377\2061Au\377\5""0@u\3770@t\3771@u\377!3k\377\30)d\377" \
+  "\233\31*e\377\202\30)d\377\4(8o\377.=s\377-<r\377,;q\377\206-<r\377\202" \
+  ",<r\377\6+<r\377,<r\377+;q\377,<r\377#3l\377\30)d\377\236\31*e\377\7" \
+  "\30)d\377\"2k\377(8o\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\3&7o" \
+  "\377\32+f\377\30)d\377\240\31*e\377\4\30)d\377\35-g\377#3l\377\"2l\377" \
+  "\203#3l\377\203\"2k\377\2\31*e\377\30)d\377\223\31*e\377\11\31)e\377" \
+  "\30)d\377\27(d\377\34-g\377&6n\3775Dx\377@N~\377\77M~\377>L}\377\202" \
+  "\77M~\377\202@N\177\377\1\77M~\377\215@N\177\377\202\77M~\377\204@N\177" \
+  "\377\236AO\200\377\235@N\200\377\232AO\200\377\1@N\177\377\203AO\200" \
+  "\377\203@N\177\377\203\77M~\377\214@N\177\377\1\77M~\377\203@N\177\377" \
+  "\202\77M~\377\5\77M}\377@N~\377>L}\377.=s\377!1j\377\202\30)d\377\1\31" \
+  ")d\377\226\31*e\377\7\30)d\377\30*d\377)9o\3779Gz\377>L}\377=J}\377<" \
+  "J|\377\203=K}\377\2<K}\377=K}\377\202<K}\377\1;K}\377\210<K}\377\203" \
+  ";J|\377\1:I{\377\207;J|\377\2:I{\377;J|\377\202:I{\377\1""9Hz\377\202" \
+  ":I{\377\4""9Hz\377:I{\3779Iz\377$4l\377\202\30)d\377\226\31*e\377\2)" \
+  "8p\3777Ez\377\2068Fz\377\3""7Fy\3778Fz\3776Fx\377\2107Fy\377\2026Ex\377" \
+  "\1""5Dw\377\2056Ex\377\3""5Dw\377&6m\377\31*d\377\230\31*e\377\5\30)" \
+  "d\377\40""1j\3772Bw\3772Av\3771@u\377\2062Av\377\3""1Au\3772Av\3770A" \
+  "t\377\2071Au\377\5""0@t\3770@u\377*:p\377\30)e\377\30)d\377\233\31*e" \
+  "\377\5\30)d\377\37""0i\377-<r\377.=s\377,;q\377\207-<r\377\2,<r\377+" \
+  "<r\377\203,<r\377\3*:q\377\33,f\377\30)d\377\235\31*e\377\7\30)d\377" \
+  "\33+f\377'7o\377(8o\377'7o\377(8o\377&6o\377\204'7o\377\4&6n\377'7o\377" \
+  "!2k\377\30)d\377\240\31*e\377\3\30)d\377\31)d\377!1j\377\205#3l\377\202" \
+  "\"2k\377\2\37/i\377\30)d\377\227\31*e\377\6\30)d\377\30)e\377\32+e\377" \
+  "#3k\3778Fy\377@N\177\377\204\77M~\377\202@N\177\377\1\77M~\377\215@N" \
+  "\177\377\203\77M~\377\204@N\177\377\203AO\200\377\1@N\177\377\317AO\200" \
+  "\377\204@N\177\377\202\77M~\377\216@N\177\377\2\77M~\377@N\177\377\205" \
+  "\77M~\377\4>M~\377.=s\377\34-f\377\31*e\377\202\30)d\377\227\31*e\377" \
+  "\6\30)d\377\34,f\3773Bv\377<J|\377=K}\377<J|\377\204=K}\377\2<K}\377" \
+  "=K}\377\202<K}\377\1;K}\377\210<K}\377\4;J|\377<K}\377;J|\377:I{\377" \
+  "\207;J|\377\2:I{\377;J|\377\202:I{\377\1""9Hz\377\202:I{\377\1""9Hz\377" \
+  "\202:I{\377\1!1j\377\202\30)d\377\225\31*e\377\2\30)d\377%4m\377\202" \
+  "8Fz\377\1""7Ey\377\2048Fz\377\2""7Fy\3778Fz\377\2107Fy\377\2""6Ex\377" \
+  "7Fy\377\2025Dw\377\2046Ex\377\5""5Dw\3776Ex\377.=s\377\31*d\377\30)d" \
+  "\377\227\31*e\377\5\30)d\377\31*e\3771@u\3772Av\3771@u\377\2062Av\377" \
+  "\4""1Au\3772Av\3771Au\3770At\377\2061Au\377\2020@u\377\3/\77t\377\34" \
+  "-g\377\30)d\377\233\31*e\377\6\30)d\377\31+e\377'7n\377.=s\377-<r\377" \
+  ",;q\377\206-<r\377\1,<r\377\202+<r\377\4,<r\377+;q\377,<r\377#4l\377" \
+  "\237\31*e\377\7\30)d\377\"3k\377(8o\377'7n\377(8o\377'7o\377&6o\377\206" \
+  "'7o\377\2\33+f\377\30)d\377\240\31*e\377\2\30)d\377\34,f\377\202\"2k" \
+  "\377\204#3l\377\202\"2k\377\2\33,f\377\30)d\377\232\31*e\377\5\30)d\377" \
+  "\27(c\377\"3k\3777Ex\377=K}\377\202\77M~\377\1>L}\377\202\77M~\377\203" \
+  "@N\177\377\1\77M~\377\217@N\177\377\203\77M~\377\204@N\177\377\203AO" \
+  "\200\377\1@N\177\377\276AO\200\377\1@N\177\377\204AO\200\377\204@N\177" \
+  "\377\203\77M~\377\217@N\177\377\1\77M~\377\202@N\177\377\202\77M~\377" \
+  "\1>L}\377\202\77M~\377\4>L}\377;J{\377/>s\377\33,f\377\202\30)d\377\227" \
+  "\31*e\377\202\30)d\377\5\31*e\377$3l\377;J|\377=K}\377<J|\377\204=K}" \
+  "\377\1<K}\377\202=K}\377\2<K}\377;K}\377\211<K}\377\202;J|\377\1:I{\377" \
+  "\212;J|\377\2:I{\3779Hz\377\203:I{\377\5""9Hz\377:I{\3778Gy\377\40""1" \
+  "j\377\30)d\377\225\31*e\377\202\30)d\377\3\"1k\3779Gz\3777Fz\377\205" \
+  "8Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2107Fy\377\1""5Dw\377\2056Ex" \
+  "\377\5""5Dw\3776Ex\3773Bv\377\32+f\377\30)d\377\227\31*e\377\202\30)" \
+  "d\377\4*:q\3773Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3772Av\377\207" \
+  "1Au\377\2""0@u\3771Au\377\2020@u\377\1%6m\377\236\31*e\377\4\37/i\377" \
+  "-=s\377.=r\377,;q\377\207-<r\377\2,<r\377+<r\377\203,<r\377\3*:p\377" \
+  "\35-g\377\30)d\377\235\31*e\377\4\30)d\377\33,f\377&6n\377'7n\377\202" \
+  "(8o\377\205'7o\377\3&6n\377'7o\377\"2l\377\241\31*e\377\202\30)d\377" \
+  "\2\36/i\377#2l\377\203#3l\377\202\"2k\377\2\"1j\377\40""0i\377\236\31" \
+  "*e\377\10\30)d\377\27)d\377\"3k\3771@u\377:Hz\377\77N~\377\77M~\377>" \
+  "L}\377\203\77M~\377\202@N\177\377\1\77M~\377\220@N\177\377\203\77M~\377" \
+  "\204@N\177\377\204AO\200\377\1@N\177\377\266AO\200\377\1@N\177\377\204" \
+  "AO\200\377\205@N\177\377\203\77M~\377\220@N\177\377\1\77M~\377\202@N" \
+  "\177\377\204\77M~\377\6@M~\377>L}\3776Ex\377+:p\377\34,g\377\26'c\377" \
+  "\202\30)d\377\227\31*e\377\202\30)d\377\5\37""0i\3771@t\377>L~\377=K" \
+  "}\377<J|\377\204=K}\377\2<K}\377=K}\377\202<K}\377\1;K}\377\210<K}\377" \
+  "\203;J|\377\202:I{\377\207;J|\377\203:I{\377\1""9Hz\377\203:I{\377\4" \
+  "9Hz\377:I{\3776Ex\377\"2k\377\202\30)d\377\224\31*e\377\202\30)d\377" \
+  "\4!1j\3778Fy\3778Fz\3777Ey\377\2048Fz\377\4""7Fy\3778Fz\3777Fy\3776F" \
+  "x\377\2067Fy\377\2""6Ex\3777Fy\377\2066Ex\377\5""5Dw\3776Ex\3774Cw\377" \
+  "\36/h\377\30)d\377\227\31*e\377\6\30)e\377\30)d\377\"3k\3773Bw\3772A" \
+  "v\3771@u\377\2052Av\377\2""1Au\3772Av\377\2111Au\377\5""0@u\377/\77t" \
+  "\377,<r\377\33,f\377\30)d\377\233\31*e\377\4\30*d\377\31*e\377)9p\377" \
+  ".=s\377\207-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\3+;r\377+;q\377" \
+  "%5m\377\202\30)d\377\234\31*e\377\202\30)d\377\2\40""1i\377'7n\377\202" \
+  "(8o\377\2'7o\377&6o\377\205'7o\377\3&6n\377\36.h\377\30)d\377\240\31" \
+  "*e\377\3\30)d\377\32+e\377!1j\377\205#3l\377\202\"2k\377\1\35-h\377\237" \
+  "\31*e\377\203\30)d\377\6\37/i\377(8o\3777Fy\377AN\177\377@M~\377\77L" \
+  "}\377\203\77M~\377\202@N\177\377\1\77M~\377\221@N\177\377\204\77M~\377" \
+  "\204@N\177\377\205AO\200\377\1@N\177\377\255AO\200\377\1@N\177\377\204" \
+  "AO\200\377\205@N\177\377\204\77M~\377\221@N\177\377\1\77M~\377\202@N" \
+  "\177\377\202\77M~\377\11>L}\377\77M~\377AN\177\377=L}\3770\77t\377$3" \
+  "l\377\33,f\377\27(d\377\30)d\377\231\31*e\377\4\27)d\377\31*e\377+:q" \
+  "\3779Gz\377\206=K}\377\1<K}\377\202=K}\377\1<K}\377\202;K}\377\210<K" \
+  "}\377\4;J|\377<K}\377;J|\377:I{\377\210;J|\377\4:I{\377;J|\377:I{\377" \
+  "9Hz\377\203:I{\377\4""9Hz\377;I{\3776Dx\377\37/i\377\202\30)d\377\225" \
+  "\31*e\377\5\30)d\377\40""1j\3775Cx\3778Fz\3777Ey\377\2048Fz\377\4""7" \
+  "Fy\3778Fz\3777Fy\3776Fx\377\2107Fy\377\2066Ex\377\5""5Dw\3776Ex\3776" \
+  "Dx\377#3l\377\30)d\377\230\31*e\377\5\30)d\377\35.h\3770\77u\3773Bw\377" \
+  "1@u\377\2072Av\377\2021Au\377\1""0At\377\2051Au\377\6""0@u\3771Au\377" \
+  "0@t\3770@u\377\"2j\377\30)d\377\234\31*e\377\3\30)d\377!1j\377/=s\377" \
+  "\207-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\4,<q\377+;r\377" \
+  "\33,f\377\30)d\377\235\31*e\377\10\30)d\377\32+f\377%5m\377(8o\377'7" \
+  "o\377(8o\377'7o\377&6o\377\205'7o\377\3$4m\377\32+e\377\30)d\377\241" \
+  "\31*e\377\1\34-g\377\206#3l\377\202!1j\377\2\33+f\377\30)d\377\240\31" \
+  "*e\377\202\30)d\377\5\31*e\377\32+e\377\40""1j\3772Bu\377\77N~\377\205" \
+  "\77M~\377\202@N\177\377\1\77M~\377\222@N\177\377\204\77M~\377\206@N\177" \
+  "\377\251AO\200\377\1@N\177\377\205AO\200\377\205@N\177\377\204\77M~\377" \
+  "\222@N\177\377\1\77M~\377\203@N\177\377\202\77M~\377\7>L~\377\77M~\377" \
+  "@N~\377;I|\377*9p\377\33,g\377\32*e\377\203\30)d\377\230\31*e\377\5\30" \
+  ")d\377\27(d\377!2k\3777Gy\377<J|\377\202=K}\377\1<J|\377\205=K}\377\202" \
+  "<K}\377\1;K}\377\210<K}\377\1;J|\377\202<K}\377\2;J|\377:I{\377\210;" \
+  "J|\377\4:I{\377;J|\377:I{\3779Hz\377\203:I{\377\4""9Hz\377;I{\3773Cv" \
+  "\377\34-g\377\202\30)d\377\225\31*e\377\3\30)d\377\35.h\3775Cx\377\206" \
+  "8Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2077Fy\377\2026Ex\377\2025Dw" \
+  "\377\2066Ex\377\3)8o\377\31*e\377\31*d\377\227\31*e\377\6\30)d\377\32" \
+  "+e\377*:p\3773Bw\3772Av\3771@u\377\2072Av\377\2""1Au\3770At\377\2051" \
+  "Au\377\5""0@u\3771Au\3770@t\3770@u\377)9p\377\202\30)d\377\233\31*e\377" \
+  "\6\30)d\377\31*e\377-<r\377.=s\377-<r\377,;q\377\206-<r\377\2,<r\377" \
+  "+<r\377\202,<r\377\3+;q\377,<r\377#3l\377\202\30)d\377\236\31*e\377\1" \
+  "\36.h\377\203(8o\377\1'7o\377\202&6o\377\204'7o\377\2&6n\377\37""0j\377" \
+  "\202\30)d\377\241\31*e\377\3\40""0i\377#3l\377\"2k\377\202#3l\377\6\"" \
+  "2k\377#3l\377!1j\377\37""0i\377\31*e\377\30)d\377\244\31*e\377\11\30" \
+  ")d\377\27(d\377\33,g\377-<r\377;I{\377=K}\377>L}\377\77M~\377>L}\377" \
+  "\203\77M~\377\203@N\177\377\1\77M~\377\226@N\177\377\206\77M~\377\210" \
+  "@N\177\377\224AO\200\377\211@N\177\377\206\77M~\377\231@N\177\377\203" \
+  "\77M~\377\1>L}\377\202\77M~\377\4>L}\377=K|\3775Dx\377$4l\377\203\30" \
+  ")d\377\232\31*e\377\4\30)d\377\31*e\377\34,g\377.<s\377\202=K}\377\1" \
+  "<J|\377\204=K}\377\2<K}\377=K}\377\202<K}\377\1;K}\377\211<K}\377\3;" \
+  "J|\377<K}\377;J|\377\202:I{\377\207;J|\377\204:I{\377\1""9Hz\377\202" \
+  ":I{\377\1""9Hz\377\202:I{\377\3""1@u\377\33+f\377\30)d\377\225\31*e\377" \
+  "\202\30)d\377\4\33,g\3774Bw\3778Fz\3777Ey\377\2068Fz\377\2""7Fy\3776" \
+  "Fx\377\2067Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2056Ex\377\5""5Dw\377" \
+  "6Ex\377/>t\377\32*f\377\30)d\377\230\31*e\377\3\30)d\377\"2k\3773Cw\377" \
+  "\2112Av\377\2""1Au\3770At\377\2071Au\377\5""0@t\3770@u\377/\77t\377\32" \
+  "+f\377\30)d\377\233\31*e\377\202\30)d\377\4%5m\377.=s\377-<r\377,;q\377" \
+  "\207-<r\377\10,<r\377+<r\377,<r\377+;q\377,<r\377+;q\377\31*e\377\30" \
+  ")d\377\235\31*e\377\3\30)d\377\31*e\377$5m\377\202(8o\377\202'7o\377" \
+  "\1&6o\377\205'7o\377\3&6n\377\31+e\377\30)d\377\240\31*e\377\4\30)d\377" \
+  "\32+e\377#3l\377\"2k\377\202#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\34" \
+  "-g\377\30)d\377\246\31*e\377\13\31)d\377\30)d\377\27(c\377\30)d\377$" \
+  "5l\3770\77t\3778Gy\377>L~\377@N~\377\77M~\377>L}\377\203\77M~\377\203" \
+  "@N\177\377\1\77M~\377\231@N\177\377\210\77M~\377\224@N\177\377\211\77" \
+  "M~\377\231@N\177\377\1\77M~\377\202@N\177\377\203\77M~\377\1>L}\377\202" \
+  "\77M~\377\10@N~\377;J{\3775Cw\377,;q\377\36/h\377\26'c\377\27)d\377\30" \
+  ")d\377\232\31*e\377\10\30)d\377\27(d\377\33,g\377'7n\3778Fz\377>L~\377" \
+  "=K}\377<J|\377\206=K}\377\1<K}\377\202;K}\377\210<K}\377\1;J|\377\202" \
+  "<K}\377\2;J|\377:I{\377\210;J|\377\3:I{\377;J|\377:I{\377\2029Hz\377" \
+  "\202:I{\377\1""9Hz\377\202:I{\377\3.>s\377\32,f\377\30)d\377\226\31*" \
+  "e\377\5\30)d\377\35.h\3773Bw\3778Fz\3777Ey\377\2058Fz\377\2037Fy\377" \
+  "\1""6Fx\377\2077Fy\377\2""6Ex\3775Dw\377\2056Ex\377\5""5Dw\3776Ex\377" \
+  "2Au\377\34-g\377\30)d\377\230\31*e\377\4\30)d\377\34-g\3772Av\3773Bw" \
+  "\377\2072Av\377\3""1Au\3772Av\3770At\377\2061Au\377\2""0@u\3771Au\377" \
+  "\2020@u\377\2!2k\377\30)d\377\234\31*e\377\5\30)d\377\35.h\377,;r\377" \
+  ".=s\377,;q\377\207-<r\377\2,<r\377+<r\377\204,<r\377\2!1j\377\30)d\377" \
+  "\236\31*e\377\7\30)d\377\35.h\377)9o\377'7n\377'7o\377(8o\377&6o\377" \
+  "\204'7o\377\4&6n\377'7o\377\40""1j\377\30)d\377\241\31*e\377\2\30)d\377" \
+  "\36/i\377\205#3l\377\202\"2k\377\3!1j\377\31*e\377\30)d\377\251\31*e" \
+  "\377\203\30)d\377\6\35.h\377#3l\377-=r\3779H{\377@N\177\377@N~\377\205" \
+  "\77M~\377\242@N\177\377\225\77M~\377\236@N\177\377\1\77M~\377\203@N\177" \
+  "\377\203\77M~\377\11>L}\377\77M~\377@N\177\377\77M~\3774Cw\377(8o\377" \
+  "\40""1j\377\32+f\377\27(d\377\202\30)d\377\233\31*e\377\4\30)d\377\27" \
+  "(d\377%5m\3774Cw\377\202=K}\377\1<J|\377\205=K}\377\204<K}\377\1;K}\377" \
+  "\210<K}\377\2;J|\377<K}\377\202;J|\377\1:I{\377\210;J|\377\4:I{\377;" \
+  "J|\377:I{\3779Hz\377\203:I{\377\6""9Hz\377:I{\377;J{\377)9o\377\31*e" \
+  "\377\30)d\377\226\31*e\377\5\30)d\377\35.h\3772@v\3778Fz\3777Ey\377\205" \
+  "8Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2067Fy\377\4""6Ex\3777Fy\377" \
+  "6Ex\3775Dw\377\2046Ex\377\5""5Dw\3776Ex\3774Cw\377\37/h\377\30)d\377" \
+  "\230\31*e\377\6\30)d\377\31*e\377.>t\3773Bw\3772Av\3771@u\377\2052Av" \
+  "\377\4""1Au\3772Av\3771Au\3770At\377\2071Au\377\3""0@t\3770@u\377)9p" \
+  "\377\235\31*e\377\6\30)d\377\31*e\377&6n\377.=s\377-<r\377,;q\377\206" \
+  "-<r\377\202,<r\377\7+<r\377,<r\377+;q\377,<r\377(8o\377\32+f\377\31)" \
+  "d\377\235\31*e\377\3\30)d\377\30*d\377&6n\377\203(8o\377\2'7o\377&6o" \
+  "\377\205'7o\377\3&6n\377\31*e\377\30)d\377\240\31*e\377\3\30)d\377\32" \
+  "*e\377\"3k\377\205#3l\377\202\"2k\377\2\36.h\377\30)d\377\217\31*e\377" \
+  "\1\30)d\377\234\31*e\377\203\30)d\377\6\31*e\377\32+f\377!1j\377/>s\377" \
+  "=J|\377@N\177\377\206\77M~\377\203@N\177\377\1\77M~\377\313@N\177\377" \
+  "\1\77M~\377\203@N\177\377\203\77M~\377\1>M~\377\203\77M~\377\5""6Ex\377" \
+  "(8o\377\34,g\377\32+e\377\31*e\377\202\30)d\377\1\31*d\377\233\31*e\377" \
+  "\5\30)d\377\27(c\377\36/i\3774Cw\377<J|\377\202=K}\377\1<J|\377\204=" \
+  "K}\377\1<K}\377\202=K}\377\1<K}\377\202;K}\377\210<K}\377\3;J|\377<K" \
+  "}\377;J|\377\202:I{\377\212;J|\377\2:I{\3779Hz\377\205:I{\377\4""9Hz" \
+  "\377$4m\377\31*e\377\30)d\377\227\31*e\377\2\33,f\3772@v\377\2078Fz\377" \
+  "\4""7Fy\3778Fz\3777Fy\3776Fx\377\2107Fy\377\1""6Ex\377\2025Dw\377\205" \
+  "6Ex\377\3""6Dw\377!1j\377\30)d\377\230\31*e\377\6\30)d\377\27(d\377*" \
+  "9p\3773Bw\3772Av\3771@u\377\2072Av\377\2""1Au\3770At\377\2061Au\377\6" \
+  "0@u\3771Au\377/\77u\377.>s\377\36.h\377\30)d\377\234\31*e\377\5\30)e" \
+  "\377\35.h\377-=r\377.=s\377,;q\377\206-<r\377\3,<r\377-<r\377+<r\377" \
+  "\203,<r\377\3+;q\377\40""1j\377\30)d\377\236\31*e\377\7\30)d\377\37/" \
+  "i\377(8o\377'7n\377'7o\377(8o\377&6o\377\204'7o\377\4&6n\377'7o\377\40" \
+  "0i\377\30)d\377\241\31*e\377\4\30)d\377\36.h\377#3l\377\"2k\377\202#" \
+  "3l\377\2\"2k\377#3l\377\202\"2k\377\2\31*e\377\30)d\377\217\31*e\377" \
+  "\2#4l\377\31*e\377\202\30)d\377\236\31*e\377\202\30)d\377\6\27(d\377" \
+  "!1j\377/\77s\377;I{\377=K|\377>L}\377\203\77M~\377\1>L}\377\204\77M~" \
+  "\377\204@N\177\377\1\77M~\377\301@N\177\377\204\77M~\377\202>L}\377\202" \
+  "\77M~\377\7>L}\377=K}\377<K|\3776Ex\377)8o\377\33-f\377\27(c\377\202" \
+  "\30)d\377\235\31*e\377\202\30)d\377\6\31*e\377\34-g\377.>s\377>K}\377" \
+  "=K}\377<J|\377\205=K}\377\204<K}\377\1;K}\377\211<K}\377\3;J|\377<K}" \
+  "\377;J|\377\202:I{\377\210;J|\377\3:I{\377;J|\377:I{\377\2029Hz\377\202" \
+  ":I{\377\2029Hz\377\3:I{\3777Fy\377#3k\377\202\30)d\377\226\31*e\377\5" \
+  "\30)d\377\32+e\3772@v\3778Fz\3777Ey\377\2078Fz\377\2""7Fy\3776Fx\377" \
+  "\2067Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2066Ex\377\3""5Dw\377'7n" \
+  "\377\31)e\377\230\31*e\377\202\30)d\377\1\"2k\377\2022Av\377\1""1@u\377" \
+  "\2102Av\377\2""1Au\3770At\377\2071Au\377\4""0@t\377/@u\377%6m\377\27" \
+  "(d\377\234\31*e\377\4\30)d\377\31*e\377)8o\377.=s\377\207-<r\377\3,<" \
+  "r\377-<r\377+<r\377\204,<r\377\3(8o\377\31+e\377\30)d\377\235\31*e\377" \
+  "\6\30)d\377\31*e\377&6m\377'7n\377'7o\377(8o\377\205'7o\377\4&6n\377" \
+  "'7o\377&6n\377\32+f\377\241\31*e\377\2\30)d\377\31*e\377\202\"2k\377" \
+  "\204#3l\377\202\"2k\377\2\37/i\377\30)d\377\220\31*e\377\6>L~\3773Bw" \
+  "\377$4l\377\32+e\377\27)d\377\30)d\377\236\31*e\377\202\30)d\377\13\26" \
+  "(c\377\27)d\377\40""1j\377*:p\3772Au\3778Fy\377<J|\377@N~\377@M~\377" \
+  "\77M~\377\77M}\377\205\77M~\377\204@N\177\377\1\77M~\377\271@N\177\377" \
+  "\205\77M~\377\1>L}\377\202\77M~\377\13@N~\377\77M}\377:H{\3775Dw\377" \
+  "/>t\377%6m\377\34-f\377\26'c\377\27(d\377\30)d\377\30)e\377\235\31*e" \
+  "\377\202\30)d\377\5\27)d\377\36/h\377*:p\377:H{\377>L~\377\206=K}\377" \
+  "\1<K}\377\202=K}\377\1<K}\377\202;K}\377\213<K}\377\2;J|\377:I{\377\211" \
+  ";J|\377\4:I{\377;J|\377:I{\3779Hz\377\203:I{\377\6""9Hz\377:I{\377;J" \
+  "{\3773Bv\377\37""0i\377\27(c\377\227\31*e\377\5\30)d\377\34-g\3771@u" \
+  "\3779Gz\3777Ey\377\2058Fz\377\2037Fy\377\1""6Fx\377\2067Fy\377\4""6E" \
+  "x\3777Fy\3776Ex\3775Dw\377\2056Ex\377\5""5Dw\3776Ex\377+;q\377\31*e\377" \
+  "\30)d\377\230\31*e\377\5\30)d\377\34-g\377/>t\3773Bw\3771@u\377\2062" \
+  "Av\377\4""1Au\3772Av\3771Au\3770At\377\2051Au\377\7""0@u\3771Au\3770" \
+  "@t\3770@u\377+<r\377\30)e\377\30)d\377\234\31*e\377\3\30)d\377\40""1" \
+  "j\377/>t\377\207-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\4+;" \
+  "q\377,<r\377\37""0i\377\30)d\377\235\31*e\377\202\30)d\377\2\37/i\377" \
+  "'7n\377\202(8o\377\210'7o\377\1\40""1j\377\242\31*e\377\3\30)d\377\34" \
+  "-g\377\"2k\377\204#3l\377\203\"2k\377\2\32+f\377\30)d\377\220\31*e\377" \
+  "\202=K}\377\6;J|\3773Bv\377&6m\377\30)d\377\27)d\377\30)d\377\237\31" \
+  "*e\377\202\30)d\377\14\27(d\377\30)d\377\35-g\377!2j\377'7n\377/>t\377" \
+  "7Fy\377\77M~\377AO\177\377@N~\377\77M~\377>L}\377\205\77M~\377\260@N" \
+  "\177\377\1\77M~\377\205@N\177\377\205\77M~\377\1>L}\377\202\77M~\377" \
+  "\11@N\177\377AN\177\377<J|\3774Bw\377+;q\377$4l\377\37""0i\377\33+f\377" \
+  "\27(d\377\203\30)d\377\237\31*e\377\10\30)d\377\27(c\377\35.g\377-<r" \
+  "\3778Fy\377>L}\377=K}\377<J|\377\207=K}\377\202<K}\377\1;K}\377\212<" \
+  "K}\377\204;J|\377\1:I{\377\212;J|\377\2:I{\3779Hz\377\205:I{\377\4;I" \
+  "{\377-=r\377\34-g\377\30)d\377\227\31*e\377\5\30)d\377\35.g\3771@u\377" \
+  "8Fz\3777Ey\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2067Fy\377" \
+  "\4""6Ex\3777Fy\3776Ex\3775Dw\377\2056Ex\377\5""5Dw\3777Fx\377-=r\377" \
+  "\32+e\377\30)d\377\231\31*e\377\3\30)d\377,;r\3773Bw\377\2112Av\377\2" \
+  "1Au\3770At\377\2071Au\377\2020@u\377\3/\77t\377\34-g\377\30)d\377\234" \
+  "\31*e\377\2\30)d\377\33+f\377\203-<r\377\1,;q\377\206-<r\377\204,<r\377" \
+  "\3+;q\377,<r\377'7n\377\202\30)d\377\235\31*e\377\10\30)d\377\32+e\377" \
+  "$4l\377(8o\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\3%6n\377\34-g\377" \
+  "\30)d\377\240\31*e\377\3\30)d\377\31*e\377\37""0j\377\204#3l\377\4\"" \
+  "2k\377#3l\377\"2j\377\37""0i\377\222\31*e\377\2=K}\377<J|\377\202=K}" \
+  "\377\3<J|\3776Ex\377\"3k\377\202\30)d\377\241\31*e\377\204\30)d\377\6" \
+  "\31*e\377\32+f\377\34-g\377#4l\377-=r\3778Fx\377\202@N~\377\212\77M~" \
+  "\377\206@N\177\377\1\77M~\377\244@N\177\377\206\77M~\377\1>L}\377\202" \
+  "\77M~\377\11@N~\377@N\177\377=K|\3773Bu\377)9o\377\37""0i\377\33,f\377" \
+  "\32+f\377\31*e\377\204\30)d\377\240\31*e\377\11\30)d\377\27)d\377\32" \
+  "*e\377-<r\377:I{\377<J|\377=K}\377<K}\377<J|\377\205=K}\377\204<K}\377" \
+  "\1;K}\377\211<K}\377\1;J|\377\202<K}\377\1;J|\377\202:I{\377\210;J|\377" \
+  "\204:I{\377\1""9Hz\377\203:I{\377\5""9Hz\3779H{\377)9p\377\31*e\377\30" \
+  ")d\377\227\31*e\377\3\30)d\377\34-g\3772Av\377\2078Fz\377\4""7Fy\377" \
+  "8Fz\3777Fy\3776Fx\377\2107Fy\377\1""6Ex\377\2025Dw\377\2046Ex\377\5""5" \
+  "Dw\3776Ex\3770@u\377\32+e\377\30)d\377\231\31*e\377\5\27(d\377'7n\377" \
+  "3Bw\3772Av\3771@u\377\2062Av\377\3""1Au\3772Av\3770At\377\2071Au\377" \
+  "\5""0@u\3770@t\3770@v\377!2k\377\30)d\377\234\31*e\377\202\30)d\377\4" \
+  "'7o\377.=s\377-<r\377,;q\377\205-<r\377\4,<r\377-<r\377,<r\377+<r\377" \
+  "\204,<r\377\2\33,f\377\30)d\377\236\31*e\377\2\31)e\377\36.h\377\203" \
+  "(8o\377\1'7o\377\202&6o\377\204'7o\377\2'6n\377#3k\377\202\30)d\377\240" \
+  "\31*e\377\3\30)d\377\33,f\377\"2k\377\205#3l\377\202\"2k\377\2\34,g\377" \
+  "\30)d\377\221\31*e\377\204=K}\377\7<J|\377=K}\377>L~\3774Dw\377!2j\377" \
+  "\32*e\377\31*d\377\202\30)d\377\243\31*e\377\203\30)d\377\12\27(d\377" \
+  "\30)e\377\40""0i\377)9o\3771@u\3779Hz\377<J|\377=K|\377=K}\377>L}\377" \
+  "\205\77M~\377\1\77M}\377\202>L}\377\240\77M~\377\203>L}\377\205\77M~" \
+  "\377\202>L}\377\7=K}\377<J|\377;J{\3776Ex\377-=r\377%5m\377\34,g\377" \
+  "\202\27(d\377\202\30)d\377\244\31*e\377\202\30)d\377\7\31*e\377\34-g" \
+  "\377+:q\377=K|\377=K}\377=J|\377<J|\377\207=K}\377\202<K}\377\1;K}\377" \
+  "\212<K}\377\1;J|\377\202<K}\377\2;J|\377:I{\377\210;J|\377\1:I{\377\202" \
+  ";J|\377\2:I{\3779Hz\377\203:I{\377\1""9Hz\377\202:I{\377\4""8Gy\377$" \
+  "5l\377\27(c\377\30)d\377\226\31*e\377\202\30)d\377\4\33,g\3773Bw\377" \
+  "8Fz\3777Ey\377\2078Fz\377\2""7Fy\3776Fx\377\2067Fy\377\4""6Ex\3777Fy" \
+  "\3776Ex\3775Dw\377\2056Ex\377\4""5Dw\3776Ex\3772Bv\377\34-g\377\231\31" \
+  "*e\377\202\30)d\377\4!1j\3773Bw\3772Av\3771@u\377\2102Av\377\2071Au\377" \
+  "\2""0@u\3771Au\377\2020@u\377\2(9o\377\32+e\377\234\31*e\377\202\30)" \
+  "d\377\4\37/i\377,<r\377-<r\377,;q\377\207-<r\377\2,<r\377+<r\377\204" \
+  ",<r\377\2#4k\377\30)d\377\236\31*e\377\3\30)d\377\31*e\377$4l\377\202" \
+  "(8o\377\202'7o\377\1&6o\377\205'7o\377\3&6n\377\34-g\377\30)d\377\242" \
+  "\31*e\377\3\36/h\377#3l\377\"2k\377\202#3l\377\6\"2k\377#3l\377!1j\377" \
+  "\40""0j\377\32+e\377\30)d\377\221\31*e\377\206=K}\377\7<J|\377=K}\377" \
+  ">L~\3774Bw\377&6m\377\35-g\377\27(d\377\202\30)d\377\245\31*e\377\202" \
+  "\30)d\377\17\27(d\377\27(c\377\26'c\377\32,f\377\40""1j\377&6m\377+:" \
+  "q\3770\77t\3773Bv\3776Dx\3778Gy\377:I{\377=K|\377\77M~\377@N\177\377" \
+  "\202@N~\377\210\77M~\377\1\77L}\377\213>L}\377\210\77M~\377\22@M~\377" \
+  "@N~\377@N\177\377@N~\377>L}\377<J|\377:Hz\3777Fy\3775Cw\3772Au\377.=" \
+  "s\377)8o\377#4l\377\36.h\377\30)d\377\26'c\377\27(c\377\27(d\377\202" \
+  "\30)d\377\245\31*e\377\11\30)d\377\27(d\377\31*e\377!1j\377+;q\377:H" \
+  "{\377>L~\377=K}\377<J|\377\205=K}\377\2<K}\377=K}\377\203<K}\377\1;K" \
+  "}\377\211<K}\377\1;J|\377\202<K}\377\202;J|\377\1:I{\377\212;J|\377\202" \
+  ":I{\377\1""9Hz\377\206:I{\377\3""2Bv\377\36/h\377\27(c\377\227\31*e\377" \
+  "\202\30)d\377\4\37/i\3774Bw\3778Fz\3777Ey\377\2058Fz\377\2037Fy\377\1" \
+  "6Fx\377\2067Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2056Ex\377\5""5Dw" \
+  "\3776Ex\3774Bv\377!1j\377\30)d\377\231\31*e\377\5\30)d\377\35.h\3770" \
+  "\77u\3773Bw\3771@u\377\2062Av\377\4""1Au\3772Av\3771Au\3770At\377\207" \
+  "1Au\377\5""0@u\377/\77u\377.>s\377\35.h\377\30)d\377\234\31*e\377\6\30" \
+  ")d\377\32+e\377(8o\377.=s\377-<r\377,;q\377\206-<r\377\202,<r\377\7+" \
+  "<r\377,<r\377+;q\377,<r\377)9p\377\33+f\377\30)d\377\236\31*e\377\7\30" \
+  ")d\377\35.g\377)9o\377'7n\377'7o\377(8o\377&6o\377\204'7o\377\3&6n\377" \
+  "'7o\377#3l\377\202\30)d\377\240\31*e\377\3\30)d\377\31*e\377\"2k\377" \
+  "\205#3l\377\3\"2k\377!1j\377\36/h\377\202\30)d\377\221\31*e\377\2=K}" \
+  "\377<K}\377\211=K}\377\5""6Ex\377,;r\377\36.h\377\27(c\377\30)d\377\250" \
+  "\31*e\377\204\30)d\377\202\27(d\377\22\31*e\377\33,f\377\36.h\377\40" \
+  "0i\377\"2k\377$4l\377'7n\377*9p\377-<r\3770\77t\3772Bv\3775Dx\3778Fy" \
+  "\377:Hz\377<J|\377>K}\377\77M~\377@N\177\377\213AO\177\377\24@N~\377" \
+  ">L}\377=K|\377;I{\3779Gz\3777Ey\3774Cw\3771Au\377/>s\377,;q\377(8o\377" \
+  "&5m\377#3l\377!1j\377\37""0i\377\35-g\377\32+e\377\30)d\377\27(c\377" \
+  "\27(d\377\203\30)d\377\250\31*e\377\12\30)d\377\27(d\377\30)d\377$5m" \
+  "\3771@u\377:H{\377>L}\377=K}\377<J|\377<J}\377\204=K}\377\1<K}\377\202" \
+  "=K}\377\202<K}\377\202;K}\377\211<K}\377\2;J|\377<K}\377\202;J|\377\202" \
+  ":I{\377\210;J|\377\2:I{\377;J|\377\202:I{\377\2029Hz\377\202:I{\377\1" \
+  "9Hz\377\202:I{\377\3+;q\377\33,f\377\30)d\377\230\31*e\377\5\30)d\377" \
+  "\40""0j\3774Bw\3778Fz\3777Ey\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\377" \
+  "6Fx\377\2067Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2056Ex\377\4""5Dx" \
+  "\3776Ew\3776Ex\377!2k\377\202\30)d\377\230\31*e\377\6\30)d\377\32+e\377" \
+  ",;r\3773Bw\3772Av\3771@u\377\2072Av\377\2021Au\377\1""0At\377\2051Au" \
+  "\377\5""0@u\3771Au\3770@t\3770@u\377\"3k\377\202\30)d\377\234\31*e\377" \
+  "\5\30)d\377!1j\377.=s\377-<r\377,;q\377\206-<r\377\3,<r\377-<r\377+<" \
+  "r\377\203,<r\377\3+;q\377!2j\377\30)e\377\236\31*e\377\3\30)d\377\30" \
+  ")e\377&6n\377\203(8o\377\2'7o\377&6o\377\206'7o\377\2\33,f\377\30)d\377" \
+  "\241\31*e\377\4\30)d\377\36.h\377#3l\377\"2k\377\202#3l\377\6\"2k\377" \
+  "#3l\377\"2k\377!1j\377\32+f\377\30)d\377\222\31*e\377\1<K}\377\202=K" \
+  "}\377\1<K}\377\205=K}\377\1<J|\377\202=K}\377\7<J|\377;I{\3771@t\377" \
+  "\36/h\377\27(d\377\30)d\377\31*d\377\252\31*e\377\210\30)d\377\203\31" \
+  "*e\377\3\32+e\377\32+f\377\33+f\377\204\33,f\377\4\33,g\377\34-g\377" \
+  "\35-h\377\36.h\377\204\37/i\377\5\36.i\377\36.h\377\34-g\377\34,g\377" \
+  "\34,f\377\203\33,f\377\1\33+f\377\202\32+f\377\1\32+e\377\203\31*e\377" \
+  "\207\30)d\377\253\31*e\377\202\30)d\377\4\31)e\377'8n\3778Fz\377<J|\377" \
+  "\202=K}\377\1<J|\377\206=K}\377\2<K}\377=K}\377\202<K}\377\202;K}\377" \
+  "\212<K}\377\3;J|\377<K}\377;J|\377\202:I{\377\211;J|\377\2:I{\377;J|" \
+  "\377\202:I{\377\1""9Hz\377\203:I{\377\1""9Hz\377\202:I{\377\2#4l\377" \
+  "\30)e\377\202\30)d\377\227\31*e\377\3\30)d\377\37""0i\3776Dx\377\207" \
+  "8Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2107Fy\377\1""6Ex\377\2025Dw" \
+  "\377\2056Ex\377\3""6Ew\3777Fy\377\"2k\377\202\30)d\377\231\31*e\377\5" \
+  "\30)d\377'7n\3773Bw\3772Av\3771@u\377\2062Av\377\2""1Au\3772Av\377\202" \
+  "0At\377\2051Au\377\5""0@u\3771Au\3770@t\3770@u\377)9o\377\202\30)d\377" \
+  "\234\31*e\377\4\30)d\377\32*e\377,<r\377.=s\377\207-<r\377\4,<r\377-" \
+  "<r\377,<r\377+<r\377\203,<r\377\3(8o\377\32*e\377\30)d\377\236\31*e\377" \
+  "\7\30)d\377\40""0i\377(8o\377'7n\377'7o\377(8o\377&6o\377\204'7o\377" \
+  "\3&6n\377'7o\377!2k\377\202\30)d\377\240\31*e\377\3\30)d\377\31*e\377" \
+  "#3k\377\205#3l\377\202\"2k\377\1\37/i\377\202\30)d\377\222\31*e\377\202" \
+  ";K}\377\202<K}\377\202=K}\377\1<K}\377\205=K}\377\202<J|\377\6=K}\377" \
+  ">L~\3774Cw\377\"2k\377\32+f\377\31*e\377\202\30)d\377\1\31*d\377\271" \
+  "\31*e\377\212\30)d\377\272\31*e\377\203\30)d\377\4\32+e\377\34-g\377" \
+  "+:p\377;I|\377\202=K}\377\1<J|\377\210=K}\377\202<K}\377\202;K}\377\212" \
+  "<K}\377\2;J|\377<K}\377\202;J|\377\202:I{\377\211;J|\377\204:I{\377\1" \
+  "9Hz\377\203:I{\377\1""9Hz\377\202:I{\377\3""4Cw\377\34-h\377\30)d\377" \
+  "\230\31*e\377\202\30)d\377\1!1j\377\2028Fz\377\1""7Ey\377\2078Fz\377" \
+  "\2""7Fy\3776Fx\377\2077Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2076Ex" \
+  "\377\2%5l\377\30)d\377\231\31*e\377\202\30)d\377\4!1k\3774Cx\3772Av\377" \
+  "1@u\377\2062Av\377\3""1Au\3772Av\3770At\377\2071Au\377\6""0@u\3770@t" \
+  "\3770@u\377-=s\377\32+e\377\30)d\377\234\31*e\377\202\30)d\377\4'7o\377" \
+  ".=s\377-<r\377,;q\377\205-<r\377\2,<r\377-<r\377\205,<r\377\3+;q\377" \
+  "\37/i\377\30)d\377\236\31*e\377\6\30)d\377\32*e\377&6n\377'7n\377'7o" \
+  "\377(8o\377\205'7o\377\5&6n\377'7o\377&6n\377\33,f\377\30)d\377\240\31" \
+  "*e\377\3\30)e\377\30)d\377\35.h\377\206#3l\377\202\"2k\377\2\33,f\377" \
+  "\30)d\377\223\31*e\377\202<K}\377\202;K}\377\202<K}\377\211=K}\377\11" \
+  "<J|\377=K}\377>L~\3777Ey\377*9p\377!1j\377\32+e\377\27(d\377\30)d\377" \
+  "\372\31*e\377\203\30)d\377\7\35.h\377$4l\3770\77t\377<J|\377>L~\377=" \
+  "K}\377=K|\377\206=K}\377\2<K}\377=K}\377\203<K}\377\1;K}\377\213<K}\377" \
+  "\2;J|\377<K}\377\202;J|\377\1:I{\377\211;J|\377\1:I{\377\202;J|\377\1" \
+  ":I{\377\2029Hz\377\203:I{\377\6""9Hz\377:I{\3779Hz\377,<r\377\32+f\377" \
+  "\30)d\377\230\31*e\377\3\30)d\377\31*e\377%5m\377\2028Fz\377\1""7Ey\377" \
+  "\2058Fz\377\2037Fy\377\1""6Fx\377\2077Fy\377\4""6Ex\3777Fy\3776Ex\377" \
+  "5Dw\377\2056Ex\377\5""5Dw\3775Ew\377(8o\377\31*e\377\30)d\377\231\31" \
+  "*e\377\5\30)d\377\37""0i\3773Aw\3772Av\3771@u\377\2062Av\377\4""1Au\377" \
+  "2Av\3771Au\3770At\377\2061Au\377\6""0@u\3771At\3770@u\377/\77t\377\37" \
+  "/i\377\30)d\377\234\31*e\377\4\31*d\377\30)d\377\40""0j\377.=s\377\202" \
+  "-<r\377\1,;q\377\206-<r\377\204,<r\377\5+;q\377,<r\377&7n\377\27(d\377" \
+  "\31*d\377\235\31*e\377\202\30)d\377\2\40""1i\377'7n\377\202(8o\377\210" \
+  "'7o\377\1!1j\377\242\31*e\377\4\30)d\377\31*e\377!2k\377#2k\377\204#" \
+  "3l\377\202\"2k\377\2\40""0i\377\30)d\377\224\31*e\377\204<K}\377\1;K" \
+  "}\377\202<K}\377\202=K}\377\1<K}\377\206=K}\377\1<J|\377\202=K}\377\6" \
+  ">L}\377:H{\3773Bv\377)9p\377\35.h\377\26'c\377\202\30)d\377\365\31*e" \
+  "\377\7\30)d\377\27(c\377\30)d\377#3l\377/>s\3777Ey\377=K|\377\202=K}" \
+  "\377\1<J|\377\206=K}\377\1<K}\377\202=K}\377\202<K}\377\202;K}\377\212" \
+  "<K}\377\1;J|\377\202<K}\377\202;J|\377\1:I{\377\211;J|\377\2:I{\377;" \
+  "J|\377\202:I{\377\1""9Hz\377\203:I{\377\2029Hz\377\4;J{\3776Ex\377\"" \
+  "3k\377\31*e\377\202\30)d\377\227\31*e\377\6\30)e\377\31)d\377)8p\377" \
+  "7Ey\3778Fz\3777Ey\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\207" \
+  "7Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2056Ex\377\5""5Dw\3776Ex\377" \
+  ")9p\377\31*e\377\30)d\377\231\31*e\377\6\30)d\377\35-h\377/\77t\3773" \
+  "Bw\3772Av\3771@u\377\2052Av\377\2""1Au\3772Av\377\2101Au\377\5""0@u\377" \
+  "1Au\3770@u\3770\77u\377$5m\377\236\31*e\377\3\30)d\377\33,f\377+:q\377" \
+  "\202-<r\377\1,;q\377\205-<r\377\4,<r\377-<r\377,<r\377+<r\377\203,<r" \
+  "\377\3+;q\377\32+f\377\30)d\377\236\31*e\377\10\30)d\377\32+f\377&6m" \
+  "\377(8o\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\3%5n\377\34-g\377" \
+  "\30)d\377\241\31*e\377\4\30)d\377\35-g\377\"2k\377\"3l\377\203#3l\377" \
+  "\203\"2k\377\2\33,f\377\30)d\377\224\31*e\377\205<K}\377\202;K}\377\202" \
+  "<K}\377\212=K}\377\1<J|\377\202=K}\377\4<J|\377;I{\3773Cw\377#4l\377" \
+  "\203\30)d\377\360\31*e\377\202\30)d\377\6\27(d\377\34,g\377+;r\3778G" \
+  "z\377;I|\377=J|\377\212=K}\377\2<K}\377=K}\377\202<K}\377\202;K}\377" \
+  "\215<K}\377\202;J|\377\202:I{\377\211;J|\377\3:I{\377;J|\377:I{\377\202" \
+  "9Hz\377\205:I{\377\3;J{\377.=s\377\33,f\377\202\30)d\377\230\31*e\377" \
+  "\3\30)e\377\30)d\377-<r\377\2028Fz\377\1""8Ey\377\2058Fz\377\4""7Fy\377" \
+  "8Fz\3777Fy\3776Fx\377\2077Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\205" \
+  "6Ex\377\3""5Dw\3777Fx\377+;q\377\202\30)d\377\231\31*e\377\6\30)d\377" \
+  "\32+e\377+;q\3773Bw\3772Av\3771@u\377\2072Av\377\1""1Au\377\2020At\377" \
+  "\2051Au\377\7""0@u\3771Au\3770@u\377/\77t\377+;q\377\31*e\377\30)d\377" \
+  "\234\31*e\377\3\30)d\377\31*d\377%5m\377\202.=s\377\1,;q\377\207-<r\377" \
+  "\1,<r\377\202+<r\377\5,<r\377+;q\377-=r\377\40""1j\377\30)d\377\240\31" \
+  "*e\377\1\40""0i\377\203(8o\377\1'7o\377\202&6o\377\204'7o\377\2&6n\377" \
+  "\"2k\377\202\30)d\377\240\31*e\377\3\30)d\377\31*e\377\40""0j\377\205" \
+  "#3l\377\202\"2k\377\1\40""0i\377\226\31*e\377\210<K}\377\203;K}\377\202" \
+  "<K}\377\202=K}\377\1<K}\377\207=K}\377\10<J|\377=K}\377>L}\377:I|\377" \
+  "-=s\377\37""0i\377\32+f\377\31*e\377\203\30)d\377\346\31*e\377\203\30" \
+  ")d\377\6\31*d\377\32+e\377\34-g\377%6n\3775Cw\377>L~\377\202=K}\377\1" \
+  "<J|\377\207=K}\377\2<K}\377=K}\377\203<K}\377\202;K}\377\213<K}\377\2" \
+  ";J|\377<K}\377\202;J|\377\202:I{\377\211;J|\377\1:I{\377\202;J|\377\1" \
+  ":I{\377\2029Hz\377\203:I{\377\1""9Hz\377\202:I{\377\2""7Fy\377&7m\377" \
+  "\202\30)d\377\230\31*e\377\202\30)d\377\4\32+e\3770\77u\3779Fz\3777E" \
+  "y\377\2108Fz\377\2""7Fy\3776Fx\377\2077Fy\377\4""6Ex\3777Fy\3776Ex\377" \
+  "5Dw\377\2076Ex\377\2,<r\377\30)d\377\232\31*e\377\4\30)d\377\31*e\377" \
+  "'6n\3774Cx\377\2102Av\377\2021Au\377\1""0At\377\2061Au\377\7""0@u\377" \
+  "1Au\3770@t\3770@u\377/\77t\377\34-g\377\30)d\377\235\31*e\377\5\30)d" \
+  "\377\35.h\377-<r\377.=s\377,;q\377\206-<r\377\202,<r\377\1+<r\377\204" \
+  ",<r\377\2'8o\377\32+e\377\237\31*e\377\4\30)d\377\31*e\377'7n\377(8o" \
+  "\377\202'7o\377\1&6o\377\206'7o\377\3&6n\377\33,g\377\30)d\377\241\31" \
+  "*e\377\3\30)d\377\33,f\377\"3l\377\205#3l\377\202\"2k\377\2\34-g\377" \
+  "\30*e\377\225\31*e\377\213<K}\377\202;K}\377\202<K}\377\202=K}\377\1" \
+  "<K}\377\207=K}\377\12<J|\377=K}\377>L}\377>L~\3777Ey\377,;r\377#3l\377" \
+  "\36/h\377\31*d\377\27(d\377\202\30)d\377\340\31*e\377\1\31*d\377\202" \
+  "\30)d\377\11\27(d\377\33,f\377\40""1j\377'7n\3772@u\377<J|\377\77L~\377" \
+  "=K}\377<J|\377\207=K}\377\1<K}\377\203=K}\377\202<K}\377\202;K}\377\216" \
+  "<K}\377\1;J|\377\202:I{\377\212;J|\377\2:I{\377;J|\377\202:I{\377\1""9" \
+  "Hz\377\204:I{\377\7""9Hz\377:I{\3779I{\3770\77u\377\37""0i\377\27(c\377" \
+  "\30)d\377\231\31*e\377\5\30)d\377\36.i\3772@v\3778Fz\3777Ey\377\2058" \
+  "Fz\377\2""7Fy\3778Fz\377\2027Fy\377\1""6Fx\377\2067Fy\377\1""6Ex\377" \
+  "\2027Fy\377\2""6Ex\3775Dw\377\2056Ex\377\5""5Dw\3776Ex\377-<r\377\32" \
+  "*e\377\30)d\377\231\31*e\377\202\30)d\377\4#4l\3774Cw\3772Av\3771@u\377" \
+  "\2062Av\377\4""1Au\3772Av\3771Au\3770At\377\2071Au\377\1""0@t\377\202" \
+  "0@u\377\2\40""2j\377\27(d\377\235\31*e\377\4\30)d\377\31*e\377)9p\377" \
+  ".=s\377\207-<r\377\4,<r\377-<r\377,<r\377+<r\377\203,<r\377\3+;q\377" \
+  "\36/i\377\30)d\377\236\31*e\377\10\30)e\377\30)d\377\"2k\377(8o\377'" \
+  "7n\377(8o\377'7o\377&6o\377\204'7o\377\4&6n\377'7o\377\"2j\377\27)d\377" \
+  "\243\31*e\377\3\37""0i\377#3l\377\"2k\377\202#3l\377\6\"2k\377#3l\377" \
+  "!1j\377\40""0j\377\31+e\377\30)d\377\225\31*e\377\214<K}\377\202;K}\377" \
+  "\203<K}\377\202=K}\377\1<K}\377\212=K}\377\10>L}\377<J|\3777Fy\3771@" \
+  "u\377)9p\377\37""0i\377\30(d\377\27(c\377\202\30)d\377\333\31*e\377\11" \
+  "\30)d\377\27(d\377\26'c\377\33,f\377$4m\377.=s\3774Cw\377:H{\377>L}\377" \
+  "\202=K}\377\1<J|\377\210=K}\377\2<K}\377=K}\377\203<K}\377\202;K}\377" \
+  "\214<K}\377\2;J|\377<K}\377\203;J|\377\1:I{\377\212;J|\377\2:I{\377;" \
+  "J|\377\202:I{\377\2029Hz\377\203:I{\377\6""9Hz\377:I{\3777Fx\377%6n\377" \
+  "\32*e\377\30)d\377\232\31*e\377\3\27(d\377\"2k\3774Bw\377\2078Fz\377" \
+  "\2""7Fy\3778Fz\377\2027Fy\377\1""6Fx\377\2067Fy\377\2""6Ex\3777Fy\377" \
+  "\2026Ex\377\1""5Dw\377\2056Ex\377\5""5Dw\3776Ex\377-=r\377\33,f\377\30" \
+  ")d\377\232\31*e\377\2\27)d\377\"2k\377\2032Av\377\1""1@u\377\2052Av\377" \
+  "\4""1Au\3772Av\3771Au\3770At\377\2061Au\377\6""0@u\3771Au\3770@t\377" \
+  "1Au\377$5m\377\30)d\377\236\31*e\377\3\27(d\377$4m\377.=s\377\211-<r" \
+  "\377\2,<r\377+<r\377\203,<r\377\4+;q\377%6n\377\31*e\377\30)d\377\236" \
+  "\31*e\377\7\30)d\377\34-g\377'8o\377(7o\377'7o\377(8o\377&6o\377\206" \
+  "'7o\377\3&6n\377\32*e\377\30)d\377\241\31*e\377\2\30)d\377\33,f\377\206" \
+  "#3l\377\3\"2k\377!1j\377\36.h\377\202\30)d\377\225\31*e\377\202<K}\377" \
+  "\1;J|\377\213<K}\377\202;K}\377\203<K}\377\202=K}\377\1<K}\377\210=K" \
+  "}\377\1<J|\377\203=K}\377\7<J|\377;I{\3779Gz\377.=s\377\"2k\377\30)e" \
+  "\377\27(d\377\202\30)d\377\325\31*e\377\202\30)d\377\7\27(c\377\34-g" \
+  "\377(7o\3774Cw\377:H{\377;I|\377<J|\377\213=K}\377\1<K}\377\203=K}\377" \
+  "\202<K}\377\202;K}\377\214<K}\377\1;J|\377\202<K}\377\202;J|\377\202" \
+  ":I{\377\211;J|\377\1:I{\377\202;J|\377\1:I{\377\2029Hz\377\203:I{\377" \
+  "\7""9Hz\377:Iz\377;I{\3770@t\377\34-g\377\31*e\377\30)d\377\232\31*e" \
+  "\377\3\27(c\377&6n\3777Ey\377\2028Fz\377\1""7Ey\377\2048Fz\377\3""7F" \
+  "y\3778Fz\3777Fy\377\2026Fx\377\2107Fy\377\1""6Ex\377\2025Dw\377\2056" \
+  "Ex\377\4""5Dw\3776Ex\377/>s\377\31*e\377\202\30)d\377\231\31*e\377\4" \
+  "\30)d\377\37/i\3770\77u\3773Bw\377\2021@u\377\2052Av\377\4""1Au\3772" \
+  "Av\3771Au\3770At\377\2101Au\377\5""0@t\3770@u\377)9p\377\32+e\377\30" \
+  ")d\377\235\31*e\377\2\30)d\377\36.h\377\202-<r\377\202,;q\377\205-<r" \
+  "\377\2,<r\377-<r\377\204,<r\377\4+;q\377,<r\377\32+f\377\30)d\377\236" \
+  "\31*e\377\202\30)d\377\6$4m\377(8o\377'7n\377(8o\377'7o\377&6o\377\204" \
+  "'7o\377\4&6n\377'7o\377\37/i\377\30)d\377\242\31*e\377\4\30)d\377\37" \
+  "0i\377#3l\377\"2k\377\202#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\32+" \
+  "e\377\30)d\377\226\31*e\377\1:I{\377\203;J|\377\2<K}\377;J|\377\214<" \
+  "K}\377\202;K}\377\203<K}\377\202=K}\377\1<K}\377\214=K}\377\10>L}\377" \
+  "=K}\3772Av\377'8o\377\35.h\377\33+f\377\32+e\377\31*e\377\204\30)d\377" \
+  "\306\31*e\377\205\30)d\377\7\31*e\377\32+f\377\33,f\377\"2k\377-<s\377" \
+  "9Gz\377>L}\377\202=K}\377\2<K}\377<J|\377\210=K}\377\1<K}\377\203=K}" \
+  "\377\202<K}\377\202;K}\377\214<K}\377\1;J|\377\203<K}\377\202;J|\377" \
+  "\202:I{\377\211;J|\377\1:I{\377\202;J|\377\202:I{\377\2029Hz\377\203" \
+  ":I{\377\7""9Hz\377:I{\3779Hz\3777Fy\377$5l\377\27(c\377\30)d\377\232" \
+  "\31*e\377\5\30)d\377\31*e\377+;q\3778Fz\3777Ey\377\2068Fz\377\4""7Fy" \
+  "\3778Fz\3777Fy\3776Fx\377\2077Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377" \
+  "\2106Ex\377\3/>r\377\31*e\377\30)d\377\232\31*e\377\5\30)d\377\34,g\377" \
+  ".=s\3773Bw\3771@u\377\2102Av\377\2""1Au\3770At\377\2061Au\377\7""0@u" \
+  "\3771Au\3770@t\3770@u\377-=s\377\35.h\377\30)d\377\235\31*e\377\6\30" \
+  ")d\377\32*e\377*9p\377.=s\377-<r\377,;q\377\205-<r\377\4,<r\377-<r\377" \
+  ",<r\377+<r\377\204,<r\377\2!1j\377\30)d\377\236\31*e\377\202\30)d\377" \
+  "\3\36.h\377'7n\377'7o\377\202(8o\377\205'7o\377\4&6n\377'7o\377$4m\377" \
+  "\32*e\377\242\31*e\377\4\30)d\377\32+f\377#3l\377\"2k\377\202#3l\377" \
+  "\2\"2k\377#3l\377\202\"2k\377\2\37/h\377\30)d\377\227\31*e\377\1;J|\377" \
+  "\202:I{\377\202;J|\377\202<K}\377\1;J|\377\214<K}\377\203;K}\377\202" \
+  "<K}\377\215=K}\377\1<J|\377\202=K}\377\202>L~\377\10""9Gz\3770@u\377" \
+  ")8p\377#3l\377\37""0i\377\34,g\377\30)d\377\27(d\377\204\30)d\377\275" \
+  "\31*e\377\203\30)d\377\202\27(d\377\11\32+e\377\36.h\377!2j\377&6n\377" \
+  ",<r\3774Cw\377<J}\377\77M~\377>L}\377\214=K}\377\1<K}\377\202=K}\377" \
+  "\203<K}\377\202;K}\377\215<K}\377\2;J|\377<K}\377\203;J|\377\202:I{\377" \
+  "\212;J|\377\2:I{\377;J|\377\202:I{\377\2029Hz\377\203:I{\377\7""9Hz\377" \
+  "9H{\377:I{\3778Gz\377-=r\377\33,g\377\30)d\377\233\31*e\377\3\30)d\377" \
+  "\35.h\377.>s\377\2108Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377\2077Fy\377" \
+  "\4""6Ex\3777Fy\3776Ex\3775Dw\377\2066Ex\377\5""5Dw\3776Ex\377-=r\377" \
+  "\32+f\377\30)d\377\232\31*e\377\4\30)d\377\32+e\377+;r\3774Cw\377\210" \
+  "2Av\377\4""1Au\3772Av\3771Au\3770At\377\2051Au\377\7""0@u\3771Au\377" \
+  "0@u\3770@t\377/\77u\377!2j\377\30)d\377\235\31*e\377\6\30)d\377\31*e" \
+  "\377$4l\377-<s\377-<r\377,;q\377\207-<r\377\202,<r\377\7+<r\377,<r\377" \
+  "+;q\377,<r\377'7n\377\30)d\377\31)e\377\236\31*e\377\10\30)d\377\31*" \
+  "e\377$4l\377(8o\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\2&6o\377\37" \
+  "/i\377\242\31*e\377\202\30)d\377\1\40""1j\377\205#3l\377\202\"2k\377" \
+  "\3!1k\377\31*e\377\30)d\377\227\31*e\377\203;J|\377\202:I{\377\202;J" \
+  "|\377\2<K}\377;J|\377\216<K}\377\202;K}\377\202<K}\377\203=K}\377\1<" \
+  "K}\377\212=K}\377\1<J|\377\203=K}\377\14>L}\377<J|\3779Gz\3775Cw\377" \
+  "1@u\377,;q\377&5m\377\37""0i\377\31*e\377\26'c\377\27(c\377\27(d\377" \
+  "\203\30)d\377\263\31*e\377\202\30)d\377\13\27)d\377\27(c\377\26(c\377" \
+  "\27(d\377\34-g\377\"3k\377(8o\377/>s\3773Bv\3777Ey\377:I{\377\202>L}" \
+  "\377\202=K}\377\1<J|\377\216=K}\377\203<K}\377\202;K}\377\215<K}\377" \
+  "\1;J|\377\202<K}\377\202;J|\377\202:I{\377\213;J|\377\2:I{\377;J|\377" \
+  "\202:I{\377\1""9Hz\377\204:I{\377\6""9Hz\377:I{\377;J|\3771@t\377!1j" \
+  "\377\31*e\377\202\30)d\377\231\31*e\377\4\30*d\377\26(c\377\"2k\3773" \
+  "Aw\377\2028Fz\377\1""7Ey\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377" \
+  "\2077Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2066Ex\377\4""5Dw\3776Ex" \
+  "\377-=r\377\33,f\377\202\30)d\377\231\31*e\377\6\30)d\377\30*d\377*:" \
+  "q\3773Bw\3772Av\3771@u\377\2062Av\377\4""1Au\3772Av\3771Au\3770At\377" \
+  "\2071Au\377\4""0@u\3770@t\3771Av\377$4l\377\202\30)d\377\236\31*e\377" \
+  "\4\35.h\377,<r\377.=s\377,;q\377\207-<r\377\202,<r\377\7+<r\377,<r\377" \
+  "+;q\377,<r\377*:q\377\34-g\377\30)d\377\240\31*e\377\1\36/h\377\203(" \
+  "8o\377\202'7o\377\1&6o\377\205'7o\377\3$5m\377\32+e\377\30)d\377\241" \
+  "\31*e\377\2\30)d\377\33,f\377\202\"2k\377\204#3l\377\202\"2k\377\2\36" \
+  ".h\377\30)d\377\230\31*e\377\204;J|\377\202:I{\377\202;J|\377\203<K}" \
+  "\377\1;J|\377\214<K}\377\203;K}\377\203<K}\377\203=K}\377\1<K}\377\212" \
+  "=K}\377\2<J}\377=K|\377\204=K}\377\14<J|\377;J|\377;I{\377:H{\3777Ey" \
+  "\377/\77t\377(8o\377!2j\377\32+e\377\27(c\377\27(d\377\27)d\377\204\30" \
+  ")d\377\247\31*e\377\204\30)d\377\13\27(d\377\27(c\377\30)d\377\36/h\377" \
+  "%5m\377+;r\3773Bv\3779Gz\377:I{\377;I|\377<J|\377\205=K}\377\1<J|\377" \
+  "\212=K}\377\1<K}\377\203=K}\377\203<K}\377\203;K}\377\220<K}\377\202" \
+  ";J|\377\202:I{\377\213;J|\377\1:I{\377\202;J|\377\202:I{\377\1""9Hz\377" \
+  "\204:I{\377\5""9Hz\377:I{\3778Gy\377$4l\377\32+e\377\202\30)d\377\232" \
+  "\31*e\377\202\30)d\377\3'7o\3776Dy\3778Fz\377\2027Ey\377\2078Fz\377\2" \
+  "7Fy\3776Fx\377\2117Fy\377\1""6Ex\377\2025Dw\377\2056Ex\377\3""5Dw\377" \
+  "7Fx\377,<r\377\202\30)d\377\1\30)e\377\231\31*e\377\202\30)d\377\4)9" \
+  "p\3772Aw\3772Av\3771@u\377\2062Av\377\4""1Au\3772Av\3771Au\3770At\377" \
+  "\2101Au\377\5""0@t\3770@u\377(8o\377\31*e\377\30)d\377\236\31*e\377\5" \
+  "\30)d\377*:p\377.=s\377-<r\377,;q\377\206-<r\377\3,<r\377-<r\377+<r\377" \
+  "\204,<r\377\1\"2k\377\242\31*e\377\6&6m\377(8o\377'7n\377(8o\377'7o\377" \
+  "&6o\377\204'7o\377\202&6n\377\1\37/i\377\202\30)d\377\240\31*e\377\3" \
+  "\30)d\377\31*d\377\37/i\377\205#3l\377\202\"2k\377\3!2j\377\32+e\377" \
+  "\30)d\377\230\31*e\377\210;J|\377\202:I{\377\202;J|\377\202<K}\377\1" \
+  ";J|\377\216<K}\377\203;K}\377\203<K}\377\204=K}\377\1<K}\377\215=K}\377" \
+  "\1<J|\377\203=K}\377\15>L}\377>L~\377<J|\3775Dw\3770\77t\377*9p\377%" \
+  "4m\377\40""0i\377\34-g\377\33,f\377\33+f\377\32+f\377\32+e\377\204\31" \
+  "*e\377\227\30)d\377\203\31*e\377\202\32+e\377\1\32+f\377\202\33,f\377" \
+  "\6\35.h\377\"3k\377(8n\377-<r\3772Av\3779Gz\377\202>L}\377\1>K}\377\203" \
+  "=K}\377\1<J|\377\215=K}\377\1<K}\377\203=K}\377\203<K}\377\203;K}\377" \
+  "\221<K}\377\203;J|\377\202:I{\377\213;J|\377\2:I{\377;J|\377\203:I{\377" \
+  "\1""9Hz\377\204:I{\377\1""9Hz\377\202:I{\377\3""8Gz\377/>t\377\33,f\377" \
+  "\202\30)d\377\232\31*e\377\4\30)e\377\30)d\377\33+f\377+;r\377\2108F" \
+  "z\377\3""7Fy\3778Fz\3777Fy\377\2026Fx\377\2077Fy\377\4""6Ex\3777Fy\377" \
+  "6Ex\3775Dw\377\2106Ex\377\2+;q\377\30)d\377\233\31*e\377\3\30)d\377\31" \
+  "*e\377$5m\377\2022Av\377\1""1@u\377\2062Av\377\4""1Au\3772Av\3771Au\377" \
+  "0At\377\2061Au\377\2""0@u\3771Au\377\2020@u\377\2+;r\377\32+f\377\236" \
+  "\31*e\377\202\30)d\377\4$4m\377.=s\377-<r\377,;q\377\207-<r\377\2,<r" \
+  "\377+<r\377\202,<r\377\5+;q\377,<r\377(8o\377\32+e\377\30)d\377\236\31" \
+  "*e\377\202\30)d\377\6\40""1i\377(8o\377'7n\377(8o\377'7o\377&6o\377\204" \
+  "'7o\377\3&6n\377'7o\377$5m\377\202\30)d\377\241\31*e\377\3\30)d\377\33" \
+  "+f\377\"2k\377\205#3l\377\202\"2k\377\1\36.h\377\232\31*e\377\212;J|" \
+  "\377\202:I{\377\202;J|\377\202<K}\377\1;J|\377\217<K}\377\203;K}\377" \
+  "\204<K}\377\203=K}\377\1<K}\377\217=K}\377\1<J|\377\202=K}\377\1>K}\377" \
+  "\202>L~\377\17\77M~\377>L~\377;I{\3777Fy\3775Cw\3771@v\377.>t\377,<r" \
+  "\377*:p\377(7o\377%5m\377$4l\377#4l\377#3k\377\"2k\377\203!1j\377\1\40" \
+  "0j\377\204\40""0i\377\1\40""0j\377\202\40""1j\377\23!1j\377!2j\377\"" \
+  "2k\377#3k\377$4l\377%5m\377'7n\377)8p\377+:q\377.=r\3770\77t\3773Av\377" \
+  "6Dx\3779H{\377=K|\377\77M~\377\77L~\377>L~\377>L}\377\227=K}\377\203" \
+  "<K}\377\203;K}\377\217<K}\377\1;J|\377\202<K}\377\203;J|\377\202:I{\377" \
+  "\213;J|\377\1:I{\377\202;J|\377\202:I{\377\2029Hz\377\204:I{\377\7""9" \
+  "Hz\377:I{\3779Hz\3770@u\377!2j\377\27(c\377\30)d\377\233\31*e\377\202" \
+  "\30)d\377\5\37/i\3770\77t\3779G{\3778Fz\3777Ey\377\2058Fz\377\4""7Fy" \
+  "\3778Fz\3777Fy\3776Fx\377\2107Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377" \
+  "\2066Ex\377\5""5Dw\3776Ex\377*9p\377\31*e\377\30)d\377\233\31*e\377\2" \
+  "\30)d\377\"3k\377\2022Av\377\1""1@u\377\2102Av\377\2021Au\377\1""0At" \
+  "\377\2051Au\377\7""0@u\3771Au\3770@u\377/\77u\377.>s\377\36/h\377\30" \
+  ")d\377\235\31*e\377\4\31*d\377\30)d\377\37""0i\377.=s\377\202-<r\377" \
+  "\1,;q\377\205-<r\377\2,<r\377-<r\377\204,<r\377\4+;r\377+;q\377\36/h" \
+  "\377\30)d\377\237\31*e\377\7\30)d\377\33,f\377(8n\377(8o\377'7o\377(" \
+  "8o\377&6o\377\207'7o\377\2\34-g\377\30)d\377\243\31*e\377\3\36/h\377" \
+  "#3l\377\"2k\377\202#3l\377\2\"2k\377#3l\377\202!1j\377\2\33+f\377\30" \
+  ")d\377\231\31*e\377\214;J|\377\1:I{\377\203;J|\377\203<K}\377\1;J|\377" \
+  "\217<K}\377\203;K}\377\204<K}\377\203=K}\377\1<K}\377\222=K}\377\1<J" \
+  "|\377\205=K}\377\1>K}\377\203>L}\377\5>L~\377=K}\377<K|\377<J|\377;I" \
+  "{\377\202:H{\377\1:Hz\377\2069Gz\377\1""9Hz\377\202:H{\377\5;I{\377;" \
+  "I|\377<J|\377=K}\377>L~\377\203>L}\377\1>K}\377\205=K}\377\1<J|\377\222" \
+  "=K}\377\1<K}\377\203=K}\377\204<K}\377\204;K}\377\222<K}\377\203;J|\377" \
+  "\202:I{\377\214;J|\377\2:I{\377;J|\377\202:I{\377\2029Hz\377\204:I{\377" \
+  "\10""9Hz\377:I{\377;J|\3772Av\377#3l\377\32+e\377\30)d\377\31*d\377\233" \
+  "\31*e\377\202\30)d\377\5'7n\3775Cx\3778Fz\3777Ey\3777Ez\377\2078Fz\377" \
+  "\2""7Fy\3776Fx\377\2127Fy\377\2""6Ex\3775Dw\377\2056Ex\377\6""5Dx\377" \
+  "5Dw\3777Fx\377(8o\377\31*e\377\30)d\377\233\31*e\377\4\27(d\377!1j\377" \
+  "1Av\3773Bv\377\2102Av\377\4""1Au\3772Av\3771Au\3770At\377\2051Au\377" \
+  "\6""0@u\3771Au\3770@u\377/\77t\3770@u\377\"2j\377\202\30)d\377\235\31" \
+  "*e\377\3\30)d\377\34,g\377+:q\377\202-<r\377\1,;q\377\205-<r\377\2,<" \
+  "r\377-<r\377\204,<r\377\5+;q\377,<r\377#4l\377\30)d\377\30)e\377\236" \
+  "\31*e\377\10\30)d\377\30*d\377$4l\377(8o\377'7n\377(8o\377'7o\377&6o" \
+  "\377\204'7o\377\4&6n\377'7o\377\"2k\377\30)d\377\242\31*e\377\3\30)d" \
+  "\377\32+e\377#2l\377\205#3l\377\3\"2k\377!1j\377\37/i\377\202\30)d\377" \
+  "\231\31*e\377\215;J|\377\203:I{\377\203;J|\377\2<K}\377;J|\377\221<K" \
+  "}\377\203;K}\377\204<K}\377\204=K}\377\1<K}\377\230=K}\377\1<J|\377\255" \
+  "=K}\377\1<K}\377\204=K}\377\204<K}\377\203;K}\377\221<K}\377\1;J|\377" \
+  "\202<K}\377\203;J|\377\202:I{\377\214;J|\377\1:I{\377\202;J|\377\202" \
+  ":I{\377\2029Hz\377\206:I{\377\3""7Fy\377$4l\377\32*e\377\203\30)d\377" \
+  "\233\31*e\377\6\30)d\377\31*e\377-<s\3777Ey\3778Fz\3777Ey\377\2068Fz" \
+  "\377\2047Fy\377\1""6Fx\377\2077Fy\377\2046Ex\377\1""5Dw\377\2046Ex\377" \
+  "\4""5Dw\3776Ew\3777Fy\377%5m\377\202\30)d\377\233\31*e\377\2\30)d\377" \
+  "\40""0i\377\2022Av\377\2021@u\377\2062Av\377\4""1Au\3772Av\3771Au\377" \
+  "0At\377\2071Au\377\4""0@u\377/\77t\3771Au\377$5l\377\202\30)d\377\235" \
+  "\31*e\377\3\30)d\377\31*e\377&5m\377\202.=s\377\1,;q\377\207-<r\377\1" \
+  ",<r\377\202+<r\377\6,<r\377+;q\377,<r\377(9o\377\31*e\377\30)d\377\237" \
+  "\31*e\377\2\30)d\377\36/h\377\202'7n\377\2'7o\377(8o\377\207'7o\377\3" \
+  "&6n\377\32+f\377\30)d\377\242\31*e\377\4\30)d\377\37/i\377#3l\377\"2" \
+  "k\377\202#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\33,f\377\30)d\377\232" \
+  "\31*e\377\202:I{\377\202;J|\377\1:I{\377\215;J|\377\202:I{\377\203;J" \
+  "|\377\202<K}\377\1;J|\377\222<K}\377\204;K}\377\205<K}\377\205=K}\377" \
+  "\1<K}\377\272=K}\377\205<K}\377\204;K}\377\222<K}\377\1;J|\377\203<K" \
+  "}\377\203;J|\377\202:I{\377\214;J|\377\1:I{\377\202;J|\377\203:I{\377" \
+  "\1""9Hz\377\204:I{\377\1""9Hz\377\202:I{\377\5""9Hz\3777Fy\377+:q\377" \
+  "\31*e\377\30)d\377\234\31*e\377\10\30*e\377\30)d\377\31*e\377\36.h\377" \
+  "4Bw\3778Fz\3777Ey\3777Fz\377\2058Fz\377\4""7Fy\3778Fz\3777Fy\3776Fx\377" \
+  "\2107Fy\377\4""6Ex\3777Fy\3776Ex\3775Dw\377\2066Ex\377\5""5Dw\3776Ex" \
+  "\3775Dw\377$3l\377\30)d\377\233\31*e\377\202\30)d\377\4\36.h\3771@u\377" \
+  "2Av\3771@u\377\2062Av\377\1""1Au\377\2022Av\377\2101Au\377\2""0@u\377" \
+  "1At\377\2020@u\377\2)9o\377\30)d\377\237\31*e\377\2\30)d\377\40""0i\377" \
+  "\202.=s\377\1,;q\377\206-<r\377\12,<r\377-<r\377,<r\377+<r\377,<r\377" \
+  "+;q\377,<r\377,<q\377\34-g\377\30)d\377\237\31*e\377\10\30)d\377\32+" \
+  "f\377$4l\377(8o\377'7o\377(8o\377'7o\377&6o\377\206'7o\377\1\40""0j\377" \
+  "\243\31*e\377\4\30)d\377\32+e\377#3l\377\"2k\377\202#3l\377\2\"2k\377" \
+  "#3l\377\202\"2k\377\2\40""0i\377\30)d\377\233\31*e\377\1""9Hz\377\203" \
+  ":I{\377\202;J|\377\1:I{\377\215;J|\377\202:I{\377\203;J|\377\227<K}\377" \
+  "\204;K}\377\206<K}\377\260=K}\377\1<K}\377\205=K}\377\206<K}\377\204" \
+  ";K}\377\224<K}\377\1;J|\377\202<K}\377\203;J|\377\203:I{\377\217;J|\377" \
+  "\203:I{\377\2029Hz\377\204:I{\377\1""9Hz\377\202:I{\377\5""5Ex\377,<" \
+  "q\377\35.g\377\27(c\377\30)d\377\235\31*e\377\6\30)d\377\32+f\377'7n" \
+  "\3778Fy\3778Fz\3777Ey\377\2108Fz\377\2""7Fy\3776Fx\377\2107Fy\377\4""6" \
+  "Ex\3777Fy\3776Ex\3775Dw\377\2066Ex\377\4""5Dw\3776Ex\3773Cv\377#3k\377" \
+  "\202\30)d\377\233\31*e\377\5\30)d\377\35.h\377.>t\3773Bw\3771@u\377\210" \
+  "2Av\377\2021Au\377\1""0At\377\2061Au\377\2""0@u\3771Au\377\2020@u\377" \
+  "\2+;q\377\32+f\377\237\31*e\377\4\30)d\377\33,f\377,<r\377.=s\377\207" \
+  "-<r\377\4,<r\377-<r\377,<r\377+<r\377\204,<r\377\1#3l\377\241\31*e\377" \
+  "\2\30*d\377\37""0i\377\203(8o\377\202'7o\377\1&6o\377\205'7o\377\3$5" \
+  "m\377\32+f\377\30)d\377\241\31*e\377\202\30)d\377\1\40""0j\377\205#3" \
+  "l\377\203\"2k\377\2\32+e\377\30)d\377\233\31*e\377\1:I{\377\2039Hz\377" \
+  "\202:I{\377\220;J|\377\203:I{\377\202;J|\377\203<K}\377\1;J|\377\225" \
+  "<K}\377\205;K}\377\206<K}\377\243=K}\377\1<K}\377\210=K}\377\206<K}\377" \
+  "\205;K}\377\231<K}\377\203;J|\377\202:I{\377\216;J|\377\2:I{\377;J|\377" \
+  "\203:I{\377\2029Hz\377\204:I{\377\6""9Hz\377:I{\377;J{\3777Gy\377)9o" \
+  "\377\36/h\377\202\30)d\377\235\31*e\377\4\31*d\377\27(d\377\36.h\377" \
+  "0>t\377\2028Fz\377\1""7Ey\377\2068Fz\377\2047Fy\377\1""6Fx\377\2077F" \
+  "y\377\2""6Ex\3777Fy\377\2026Ex\377\1""5Dw\377\2056Ex\377\4""5Dw\3776" \
+  "Ex\3773Bv\377\40""0i\377\202\30)d\377\233\31*e\377\4\30)d\377\33,f\377" \
+  ".>s\3773Bw\377\2112Av\377\2021Au\377\1""0At\377\2061Au\377\7""0@u\377" \
+  "1Au\3770@u\377/\77u\377-=s\377\34-g\377\30)d\377\236\31*e\377\6\30)d" \
+  "\377\31*e\377)9p\377.=s\377-<r\377,;q\377\207-<r\377\2,<r\377+<r\377" \
+  "\203,<r\377\4+<r\377(9o\377\32+e\377\30)d\377\237\31*e\377\5\30)d\377" \
+  "\32+f\377'7n\377(8o\377'7n\377\202'7o\377\1&6o\377\204'7o\377\5&6n\377" \
+  "'6n\377\37/i\377\30)d\377\31)d\377\241\31*e\377\2\30)d\377\33,g\377\202" \
+  "\"2k\377\204#3l\377\202\"2k\377\2\36/h\377\30)d\377\234\31*e\377\204" \
+  ":I{\377\1""9Hz\377\203:I{\377\202;J|\377\1:I{\377\215;J|\377\203:I{\377" \
+  "\203;J|\377\203<K}\377\1;J|\377\227<K}\377\206;K}\377\211<K}\377\233" \
+  "=K}\377\210<K}\377\206;K}\377\227<K}\377\1;J|\377\203<K}\377\203;J|\377" \
+  "\203:I{\377\221;J|\377\202:I{\377\2029Hz\377\207:I{\377\4""9Hz\377(9" \
+  "o\377\33,f\377\31*e\377\202\30)d\377\235\31*e\377\4\30)d\377\27(d\377" \
+  "&6n\3777Ey\377\2028Fz\377\1""7Ey\377\2068Fz\377\3""7Fy\3778Fz\3777Fy" \
+  "\377\2026Fx\377\2077Fy\377\2""6Ex\3777Fy\377\2026Ex\377\1""5Dw\377\205" \
+  "6Ex\377\4""5Dw\3776Ex\3771@u\377\33,g\377\202\30)d\377\233\31*e\377\4" \
+  "\30)d\377\32+f\377/\77t\3773Bv\377\2021@u\377\2072Av\377\3""1Au\3772" \
+  "Av\3770At\377\2061Au\377\6""0@u\3771Au\3770@u\377/\77t\3770@u\377\36" \
+  "/i\377\202\30)d\377\235\31*e\377\202\30)d\377\3&6n\377.=s\377-<r\377" \
+  "\202,;q\377\205-<r\377\2,<r\377-<r\377\204,<r\377\3+;q\377,<r\377\35" \
+  ".h\377\202\30)d\377\237\31*e\377\7\30)d\377#3l\377(8o\377'7n\377'7o\377" \
+  "(8o\377&6o\377\206'7o\377\1%5n\377\202\30)d\377\241\31*e\377\3\30)d\377" \
+  "\31*e\377\37""0i\377\205#3l\377\202\"2k\377\3\"2j\377\32+e\377\30)d\377" \
+  "\234\31*e\377\3:I{\3779H{\3779Hz\377\204:I{\377\2029Hz\377\203:I{\377" \
+  "\202;J|\377\1:I{\377\216;J|\377\203:I{\377\203;J|\377\204<K}\377\1;J" \
+  "|\377\237<K}\377\235;K}\377\237<K}\377\1;J|\377\203<K}\377\203;J|\377" \
+  "\203:I{\377\222;J|\377\202:I{\377\2039Hz\377\204:I{\377\1""9Hz\377\202" \
+  ":I{\377\4""9Hz\3777Fy\377+;q\377\32+f\377\202\30)d\377\236\31*e\377\6" \
+  "\30)d\377\31*e\377\34,g\377/>t\3778Fz\3777Ey\377\2108Fz\377\2027Fy\377" \
+  "\1""6Fx\377\2107Fy\377\1""6Ex\377\2027Fy\377\1""5Dw\377\2066Ex\377\1" \
+  "5Dw\377\2026Ex\377\3.>s\377\32+f\377\30)d\377\233\31*e\377\202\30)d\377" \
+  "\5\33+f\377.=t\3773Bw\3772Av\3771@u\377\2062Av\377\1""1Au\377\2022Av" \
+  "\377\1""0At\377\2101Au\377\5""0@t\377/\77u\3770@u\377!1j\377\30)d\377" \
+  "\236\31*e\377\202\30)d\377\1\40""0j\377\202-<r\377\1,;q\377\210-<r\377" \
+  "\2,<r\377+<r\377\204,<r\377\2#3k\377\27)d\377\237\31*e\377\202\30)d\377" \
+  "\6\35.h\377(8o\377'7n\377'7o\377(8o\377&6o\377\207'7o\377\2\33,g\377" \
+  "\30)d\377\242\31*e\377\3\30)d\377\33,f\377\"2k\377\205#3l\377\202\"2" \
+  "k\377\1\36.h\377\236\31*e\377\2""6Ex\377;J{\377\207:I{\377\2029Hz\377" \
+  "\203:I{\377\222;J|\377\203:I{\377\204;J|\377\203<K}\377\1;J|\377\331" \
+  "<K}\377\203;J|\377\203:I{\377\220;J|\377\2:I{\377;J|\377\203:I{\377\202" \
+  "9Hz\377\205:I{\377\1""9Hz\377\202:I{\377\5""9I{\3773Cv\377)9p\377\34" \
+  "-g\377\26(c\377\202\30)d\377\236\31*e\377\4\30)d\377\31*e\377$4m\377" \
+  "4Cx\377\2118Fz\377\2037Fy\377\2026Fx\377\2077Fy\377\2""6Ex\3777Fy\377" \
+  "\2026Ex\377\1""5Dw\377\2056Ex\377\1""5Dw\377\2026Ex\377\3,;q\377\32+" \
+  "f\377\30)d\377\234\31*e\377\6\30)d\377\33,f\377,;r\3773Bw\3772Av\377" \
+  "1@u\377\2062Av\377\2""1Au\3772Av\377\2111Au\377\6""0@u\3771At\3770@u" \
+  "\3770\77u\377#4l\377\30)d\377\237\31*e\377\6\30)d\377\34,f\377+:p\377" \
+  ".=s\377-<r\377,;q\377\207-<r\377\2,<r\377+<r\377\202,<r\377\5+;q\377" \
+  ",<r\377'7o\377\30)d\377\31*d\377\237\31*e\377\10\30)d\377\32+e\377&6" \
+  "m\377'8o\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\4&6n\377'7o\377!" \
+  "1k\377\30)d\377\244\31*e\377\3\37""0i\377#3l\377\"2k\377\202#3l\377\2" \
+  "\"2k\377#3l\377\202!1j\377\2\32+f\377\30)d\377\235\31*e\377\6\37""0i" \
+  "\377)9p\3777Fy\377;J|\377:I{\3779Hz\377\205:I{\377\2029Hz\377\202:I{" \
+  "\377\203;J|\377\1:I{\377\220;J|\377\203:I{\377\204;J|\377\204<K}\377" \
+  "\1;J|\377\321<K}\377\204;J|\377\204:I{\377\223;J|\377\202:I{\377\203" \
+  "9Hz\377\204:I{\377\11""9Hz\377:I{\377;I{\377;J{\3770\77t\377$4l\377\34" \
+  "-g\377\27)d\377\30)d\377\237\31*e\377\10\30)d\377\27(d\377\37/i\377/" \
+  ">t\3777Ey\3778Fz\3777Ey\3777Fz\377\2058Fz\377\1""7Fy\377\2028Fz\377\2" \
+  "7Fy\3776Fx\377\2107Fy\377\2""6Ex\3777Fy\377\2026Ex\377\1""5Dw\377\205" \
+  "6Ex\377\6""5Dw\3776Ex\3777Ex\377&6n\377\31*e\377\30)d\377\234\31*e\377" \
+  "\6\30)d\377\32*f\377,;r\3773Bw\3772Av\3771@u\377\2102Av\377\2021Au\377" \
+  "\1""0At\377\2061Au\377\2""0@u\3771Au\377\2020@u\377\1&7n\377\240\31*" \
+  "e\377\6\31*d\377\30*e\377(8o\377.=s\377-<r\377,;q\377\206-<r\377\12," \
+  "<r\377-<r\377,<r\377+<r\377,<r\377+;q\377,<r\377*:p\377\34,g\377\30)" \
+  "d\377\237\31*e\377\3\30)d\377\30*d\377!1j\377\202'7n\377\1(8o\377\206" \
+  "'7o\377\5&6n\377'7o\377%5m\377\32+f\377\30)d\377\242\31*e\377\2\30)d" \
+  "\377\33+g\377\206#3l\377\3\"2k\377!1j\377\36/i\377\202\30)d\377\235\31" \
+  "*e\377\6\30)d\377\31*e\377\32+f\377%5m\3776Dx\377;J|\377\207:I{\377\202" \
+  "9Hz\377\203:I{\377\202;J|\377\1:I{\377\221;J|\377\203:I{\377\205;J|\377" \
+  "\204<K}\377\1;J|\377\311<K}\377\205;J|\377\203:I{\377\221;J|\377\1:I" \
+  "{\377\202;J|\377\203:I{\377\2029Hz\377\206:I{\377\1""9Hz\377\202:I{\377" \
+  "\3.>s\377\36.h\377\32+e\377\203\30)d\377\237\31*e\377\4\30)d\377\30*" \
+  "d\377'7n\3776Dx\377\2028Fz\377\1""7Ey\377\2068Fz\377\2""7Fy\3778Fz\377" \
+  "\2027Fy\377\1""6Fx\377\2107Fy\377\3""6Ex\3777Fy\3776Ex\377\2025Dw\377" \
+  "\2076Ex\377\4""4Dw\377\"2k\377\31*e\377\30)d\377\234\31*e\377\6\30)d" \
+  "\377\31*d\377.=s\3773Bw\3772Av\3771@u\377\2072Av\377\2""1Au\3772Av\377" \
+  "\2020At\377\2061Au\377\7""0@u\3771Au\3770@t\3770@u\377*:q\377\31*e\377" \
+  "\30)d\377\237\31*e\377\5\27(d\377$5m\377.=s\377-<r\377,;q\377\206-<r" \
+  "\377\4,<r\377-<r\377,<r\377+<r\377\203,<r\377\3+;q\377!2j\377\31*d\377" \
+  "\240\31*e\377\10\30)d\377\33,f\377&6n\377(8o\377'7o\377(8o\377'7o\377" \
+  "&6o\377\206'7o\377\1\37""0i\377\244\31*e\377\4\30)d\377!1j\377#3l\377" \
+  "\"2k\377\202#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\32+f\377\30)d\377" \
+  "\240\31*e\377\1\31*d\377\202\30)d\377\4\"2k\3773Bv\3778Gy\3779Hz\377" \
+  "\202:I{\377\1:Iz\377\205:I{\377\2039Hz\377\203:I{\377\202;J|\377\1:I" \
+  "{\377\223;J|\377\204:I{\377\206;J|\377\267<K}\377\1;J|\377\205<K}\377" \
+  "\205;J|\377\204:I{\377\223;J|\377\1:I{\377\203;J|\377\203:I{\377\202" \
+  "9Hz\377\206:I{\377\1""9Hz\377\202:I{\377\4""9Hz\3777Gy\377,<q\377\34" \
+  "-g\377\202\30)d\377\240\31*e\377\202\30)d\377\6\31*e\377\35-h\3770@u" \
+  "\3779Gz\3778Fz\3777Ey\377\2068Fz\377\2""7Fy\3778Fz\377\2027Fy\377\1""6" \
+  "Fx\377\2107Fy\377\1""6Ex\377\2027Fy\377\2""6Ex\3775Dw\377\2056Ex\377" \
+  "\5""5Dw\3776Ew\3776Ex\3772Bu\377\40""1j\377\202\30)d\377\234\31*e\377" \
+  "\6\30)d\377\32+f\377-<s\3773Bw\3772Av\3771@u\377\2062Av\377\1""1Au\377" \
+  "\2022Av\377\1""0At\377\2111Au\377\5""0@t\3770@u\377-=r\377\31*e\377\30" \
+  ")d\377\236\31*e\377\202\30)d\377\2\40""0i\377.=s\377\202-<r\377\1,;q" \
+  "\377\205-<r\377\2,<r\377-<r\377\204,<r\377\5+;q\377,<r\377&6n\377\31" \
+  "*d\377\30)d\377\237\31*e\377\5\30)d\377\31*e\377#3l\377(8o\377'7n\377" \
+  "\202'7o\377\1&6o\377\206'7o\377\3$4l\377\32+e\377\30)d\377\241\31*e\377" \
+  "\5\30)e\377\30)d\377\35-g\377#3l\377\"2k\377\202#3l\377\2\"2k\377#3l" \
+  "\377\202\"2k\377\2\37/h\377\30)d\377\243\31*e\377\202\30)d\377\5\27(" \
+  "d\377\40""0i\377+<q\3773Cw\3779H{\377\202:I{\377\1""9Hz\377\206:I{\377" \
+  "\2029Hz\377\203:I{\377\230;J|\377\205:I{\377\205;J|\377\210<K}\377\1" \
+  ";J|\377\253<K}\377\206;J|\377\204:I{\377\225;J|\377\1:I{\377\202;J|\377" \
+  "\203:I{\377\2039Hz\377\205:I{\377\1""9Hz\377\202:I{\377\7;J{\3777Fy\377" \
+  "0@t\377&6n\377\32+e\377\27(c\377\30)d\377\241\31*e\377\202\30)d\377\5" \
+  "\34-g\377)8o\3778Fy\3778Fz\3777Ey\377\2068Fz\377\1""7Fy\377\2028Fz\377" \
+  "\1""7Fy\377\2026Fx\377\2107Fy\377\2""6Ex\3777Fy\377\2026Ex\377\1""5D" \
+  "w\377\2056Ex\377\1""5Dw\377\2026Ex\377\3/>s\377\35.h\377\27(d\377\235" \
+  "\31*e\377\6\30)d\377\33,f\377+;r\3773Bw\3772Av\3771@u\377\2062Av\377" \
+  "\2""1Au\3772Av\377\2111Au\377\7""0@u\3771Au\3770@t\3770@u\377,<r\377" \
+  "\32+f\377\30)d\377\237\31*e\377\6\30)d\377\34-g\377,;r\377.=s\377-<r" \
+  "\377,;q\377\205-<r\377\2,<r\377-<r\377\204,<r\377\5+;q\377,<r\377*:p" \
+  "\377\33+f\377\30)d\377\240\31*e\377\7\30)d\377\36/h\377(9o\377(7n\377" \
+  "'7o\377(8o\377&6o\377\205'7o\377\4&6n\377'7o\377\35.h\377\30)d\377\242" \
+  "\31*e\377\4\30)d\377\31*e\377!1k\377#3k\377\204#3l\377\202\"2k\377\3" \
+  "!1j\377\31*e\377\30)d\377\245\31*e\377\202\30)d\377\6\27)d\377\34-g\377" \
+  "#3l\377-=s\3778Gz\377;J|\377\210:I{\377\2039Hz\377\202:I{\377\204;J|" \
+  "\377\1:I{\377\226;J|\377\205:I{\377\210;J|\377\212<K}\377\1;J|\377\216" \
+  "<K}\377\1;J|\377\213<K}\377\207;J|\377\206:I{\377\232;J|\377\203:I{\377" \
+  "\2029Hz\377\206:I{\377\12""9Hz\377:I{\377;I{\377;J|\3773Cw\377(8o\377" \
+  "\40""0i\377\32*e\377\27)d\377\30)d\377\242\31*e\377\202\30)d\377\2%5" \
+  "n\3773Av\377\2028Fz\377\1""7Ey\377\2108Fz\377\2027Fy\377\1""6Fx\377\211" \
+  "7Fy\377\3""6Ex\3777Fy\3776Ex\377\2025Dw\377\2106Ex\377\3)8o\377\32+f" \
+  "\377\30)d\377\235\31*e\377\6\30)d\377\32+e\377,<r\3773Bw\3772Av\3771" \
+  "@u\377\2102Av\377\2021Au\377\1""0At\377\2061Au\377\7""0@u\3771Au\377" \
+  "0@t\3770@u\377,=s\377\35.g\377\30)d\377\237\31*e\377\6\30)d\377\32+e" \
+  "\377)8o\377.=s\377-<r\377,;q\377\207-<r\377\202,<r\377\1+<r\377\202," \
+  "<r\377\4,<q\377,<r\377\36.h\377\30)d\377\240\31*e\377\10\30)d\377\32" \
+  "+f\377'7n\377(8o\377'8o\377(8o\377'7o\377&6o\377\204'7o\377\3&6n\377" \
+  "'7o\377\"3k\377\202\30)d\377\241\31*e\377\202\30)d\377\3\36.h\377\"2" \
+  "k\377\"2l\377\204#3l\377\202\"2k\377\2\35.g\377\30)d\377\250\31*e\377" \
+  "\203\30)d\377\4\31*e\377\33,f\377%6m\3775Dw\377\202:I{\377\2""9H{\377" \
+  "9Hz\377\205:I{\377\2039Hz\377\204:I{\377\202;J|\377\1:I{\377\231;J|\377" \
+  "\207:I{\377\213;J|\377\220<K}\377\214;J|\377\207:I{\377\230;J|\377\1" \
+  ":I{\377\203;J|\377\203:I{\377\2039Hz\377\206:I{\377\1""9Hz\377\203:I" \
+  "{\377\4.=s\377\37""0i\377\32+e\377\31*e\377\202\30)d\377\1\31*d\377\241" \
+  "\31*e\377\5\30)d\377\27(d\377\37.i\3772@v\3777Ey\377\2028Fz\377\1""7" \
+  "Ey\377\2068Fz\377\3""7Fy\3778Fz\3777Fy\377\2036Fx\377\2127Fy\377\2""6" \
+  "Ex\3775Dw\377\2066Ex\377\6""5Dx\3776Ew\3775Dw\377$4l\377\31*e\377\30" \
+  ")d\377\235\31*e\377\6\30)d\377\32+f\377/>t\3773Bw\3772Av\3771@u\377\207" \
+  "2Av\377\2""1Au\3772Av\377\2020At\377\2061Au\377\7""0@u\3771Au\3770@u" \
+  "\377/\77u\377.>t\377\36/i\377\30)d\377\240\31*e\377\5\30)d\377%4m\377" \
+  ".=s\377-<r\377,;q\377\210-<r\377\2,<r\377+<r\377\202,<r\377\3+;q\377" \
+  "-=r\377!2j\377\202\30)d\377\237\31*e\377\202\30)d\377\6$4l\377(8o\377" \
+  "'7n\377'7o\377(8o\377&6o\377\206'7o\377\3&6o\377\32*e\377\30)d\377\242" \
+  "\31*e\377\3\30)d\377\32+e\377!1j\377\205#3l\377\202\"2k\377\3\40""0j" \
+  "\377\31*e\377\30)d\377\254\31*e\377\202\30)d\377\5\27(c\377\37""0i\377" \
+  ".=r\3777Fy\3778Hz\377\203:I{\377\2""9H{\3779Hz\377\206:I{\377\2029Hz" \
+  "\377\204:I{\377\250;J|\377\222:I{\377\244;J|\377\1:I{\377\203;J|\377" \
+  "\204:I{\377\2039Hz\377\212:I{\377\7""9Hz\3778Gy\3774Cw\377'7m\377\31" \
+  "*e\377\27)d\377\30)d\377\244\31*e\377\7\30)d\377\31*e\377\33,f\377*9" \
+  "q\3777Fz\3778Fz\3777Ey\377\2128Fz\377\2026Fx\377\2107Fy\377\1""6Ex\377" \
+  "\2027Fy\377\1""6Ex\377\2025Dw\377\2056Ex\377\1""5Dw\377\2026Ex\377\3" \
+  "3Bv\377\37""1i\377\27(d\377\236\31*e\377\6\30)d\377\34,g\377.=t\3773" \
+  "Bw\3772Av\3771@u\377\2062Av\377\1""1Au\377\2022Av\377\1""0At\377\211" \
+  "1Au\377\5""0@t\3770@u\377/\77t\377!1j\377\30)d\377\237\31*e\377\202\30" \
+  ")d\377\2\40""0j\377/>s\377\210-<r\377\4,<r\377-<r\377,<r\377+<r\377\204" \
+  ",<r\377\2&6n\377\32*e\377\240\31*e\377\202\30)d\377\1\37/i\377\202'7" \
+  "n\377\202(8o\377\205'7o\377\1&6n\377\202'7o\377\2\35.h\377\30)d\377\244" \
+  "\31*e\377\3\35.h\377#3l\377\"2k\377\202#3l\377\2\"2k\377#3l\377\202\"" \
+  "2k\377\2\34-g\377\30*e\377\257\31*e\377\11\30)e\377\30)d\377\27(c\377" \
+  "\31*e\377$4l\377-=s\3773Cv\3779Hz\377;J{\377\202:I{\377\1""9Hz\377\206" \
+  ":I{\377\2049Hz\377\203:I{\377\204;J|\377\1:I{\377\323;J|\377\1:I{\377" \
+  "\203;J|\377\204:I{\377\2039Hz\377\206:I{\377\2""9H{\3779Iz\377\203:I" \
+  "{\377\4""6Ex\3771Au\377)9p\377\37/h\377\202\27(d\377\1\30)d\377\244\31" \
+  "*e\377\10\30)d\377\27)d\377\33,g\377%5m\3774Bw\3779G{\3778Fz\3777Ey\377" \
+  "\2078Fz\377\2047Fy\377\1""6Fx\377\2107Fy\377\2""6Ex\3777Fy\377\2026E" \
+  "x\377\1""5Dw\377\2116Ex\377\3-=r\377\34,f\377\30)d\377\236\31*e\377\6" \
+  "\30)d\377\35-g\377-=s\3773Bw\3772Av\3771@u\377\2062Av\377\2""1Au\377" \
+  "2Av\377\2131Au\377\5""0@t\3770@u\377/\77t\377\"2k\377\27(c\377\240\31" \
+  "*e\377\3\30)d\377\36.h\377.=s\377\202-<r\377\1,;q\377\205-<r\377\4,<" \
+  "r\377-<r\377,<r\377+<r\377\204,<r\377\3*:p\377\34-g\377\30)d\377\240" \
+  "\31*e\377\10\30)d\377\32+f\377%5m\377(8o\377'7o\377(8o\377'7o\377&6o" \
+  "\377\204'7o\377\3&7o\377'7o\377\"3l\377\244\31*e\377\3\30)d\377\32*e" \
+  "\377\"2k\377\205#3l\377\5\"2k\377!1j\377\40""0j\377\32+e\377\30)d\377" \
+  "\261\31*e\377\204\30)d\377\4\34-g\377\"2j\377):o\3773Cv\377\202;J|\377" \
+  "\212:I{\377\2039Hz\377\204:I{\377\204;J|\377\1:I{\377\313;J|\377\1:I" \
+  "{\377\204;J|\377\203:I{\377\2049Hz\377\207:I{\377\1""9Hz\377\202:I{\377" \
+  "\7;J|\3777Gy\377/>s\377%5m\377\37""0i\377\32+e\377\27(d\377\202\30)d" \
+  "\377\245\31*e\377\202\30)d\377\2%4m\3771\77u\377\2028Fz\377\1""7Ey\377" \
+  "\2078Fz\377\1""7Fy\377\2028Fz\377\1""7Fy\377\2026Fx\377\2127Fy\377\202" \
+  "6Ex\377\1""5Dw\377\2066Ex\377\6""5Dw\3776Ex\3776Ew\377&6m\377\31*e\377" \
+  "\30)d\377\236\31*e\377\6\27)d\377\35.h\377/>t\3773Bw\3772Av\3771@u\377" \
+  "\2102Av\377\2021Au\377\1""0At\377\2071Au\377\6""0@u\3771At\3770@u\377" \
+  "/\77t\377\"2k\377\30)d\377\240\31*e\377\6\30)d\377\34-g\377+:q\377.=" \
+  "s\377-<r\377,;q\377\207-<r\377\205,<r\377\3+;q\377,<r\377\40""0i\377" \
+  "\202\30)d\377\240\31*e\377\5\30)d\377!1j\377(8o\377(7o\377(8o\377\202" \
+  "'7o\377\1&6o\377\205'7o\377\3%6n\377\34-g\377\30)d\377\243\31*e\377\4" \
+  "\30)d\377\37""0i\377#3l\377\"2k\377\202#3l\377\5\"2k\377#3l\377\"2k\377" \
+  "!1k\377\34-g\377\202\30)d\377\264\31*e\377\203\30)d\377\6\31*e\377\32" \
+  "+f\377\35.h\377(7o\3774Cw\377;J{\377\202:I{\377\2""9Iz\3779H{\377\207" \
+  ":I{\377\2039Hz\377\205:I{\377\204;J|\377\1:I{\377\303;J|\377\1:I{\377" \
+  "\204;J|\377\204:I{\377\2049Hz\377\212:I{\377\6;J{\3779H{\377/>s\377\"" \
+  "2k\377\33,f\377\32+e\377\204\30)d\377\245\31*e\377\5\30)d\377\27(c\377" \
+  "\37""0i\3772@u\3777Ey\377\2028Fz\377\1""7Ey\377\2118Fz\377\2027Fy\377" \
+  "\1""6Fx\377\2117Fy\377\3""6Ex\3777Fy\3776Ex\377\2025Dw\377\2066Ex\377" \
+  "\4""5Dw\3776Ex\3774Cw\377\40""0i\377\203\30)d\377\235\31*e\377\4\30)" \
+  "d\377\37/i\3771@v\3773Bv\377\2021@u\377\2072Av\377\2""1Au\3772Av\377" \
+  "\2020At\377\2071Au\377\7""0@u\3771Au\3770@u\377/\77t\377#3l\377\31*e" \
+  "\377\30)d\377\237\31*e\377\3\30)d\377\32+e\377(7n\377\202.=s\377\1,;" \
+  "q\377\206-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\3+;q\377,<" \
+  "r\377#4l\377\202\30)d\377\240\31*e\377\2\30)d\377\34-g\377\202(8o\377" \
+  "\2'7n\377'7o\377\202&6o\377\205'7o\377\2&6n\377!1k\377\202\30)d\377\242" \
+  "\31*e\377\2\30)d\377\33,f\377\206#3l\377\202\"2k\377\1\40""0i\377\202" \
+  "\30)d\377\272\31*e\377\202\30)d\377\7\27(c\377\34,g\377'7n\3771Av\377" \
+  "7Fy\3778Gz\3779Hz\377\203:I{\377\1""9Hz\377\211:I{\377\2049Hz\377\206" \
+  ":I{\377\206;J|\377\1:I{\377\264;J|\377\205:I{\377\2049Hz\377\211:I{\377" \
+  "\1""9Hz\377\204:I{\377\7""9Hz\3778Gy\3776Ex\377-<r\377!1j\377\30)d\377" \
+  "\27)d\377\202\30)d\377\247\31*e\377\202\30)d\377\3\31*e\377\35-h\377" \
+  ".<s\377\2028Fz\377\1""7Ey\377\2078Fz\377\1""7Fy\377\2028Fz\377\1""7F" \
+  "y\377\2026Fx\377\2147Fy\377\2025Dw\377\2066Ex\377\6""5Dw\3776Ex\3775" \
+  "Ex\377/>s\377\32*f\377\30)d\377\236\31*e\377\202\30)d\377\4\40""0j\377" \
+  "1@v\3772Av\3771@u\377\2072Av\377\1""1Au\377\2022Av\377\1""0At\377\207" \
+  "1Au\377\6""0@u\3771Au\3771At\3770@u\377/\77t\377&6n\377\202\30)d\377" \
+  "\237\31*e\377\6\30)d\377\31*e\377$3l\377/>s\377-<r\377,;q\377\206-<r" \
+  "\377\4,<r\377-<r\377,<r\377+<r\377\204,<r\377\2'8o\377\30)d\377\241\31" \
+  "*e\377\10\30)d\377\31*e\377&6n\377(8o\377'7o\377(8o\377'7o\377&6o\377" \
+  "\204'7o\377\5&6n\377'7o\377&6n\377\31*d\377\30)d\377\242\31*e\377\4\30" \
+  ")d\377\31*e\377!1k\377#3k\377\205#3l\377\202\"2k\377\2\33,f\377\30)d" \
+  "\377\276\31*e\377\12\30)d\377\27(d\377\27(c\377\33+f\377#4l\377+;q\377" \
+  "1@u\3775Dx\3779Hz\377;J{\377\215:I{\377\2069Hz\377\206:I{\377\210;J|" \
+  "\377\1:I{\377\245;J|\377\207:I{\377\2059Hz\377\212:I{\377\1""9Hz\377" \
+  "\202:I{\377\11;I{\377:I{\3777Fy\3773Bv\377.>s\377'8n\377\37""0i\377\30" \
+  ")d\377\27(c\377\202\30)d\377\250\31*e\377\203\30)d\377\4\37/i\377*9p" \
+  "\3777Ey\3779Fz\377\2138Fz\377\2027Fy\377\1""6Fx\377\2127Fy\377\2046E" \
+  "x\377\1""5Dw\377\2066Ex\377\6""5Dw\3776Ex\3774Cw\377'7n\377\30)e\377" \
+  "\30)d\377\236\31*e\377\202\30)d\377\4\"2k\3771@v\3773Bw\3771@u\377\207" \
+  "2Av\377\2""1Au\3772Av\377\2131Au\377\1""0@t\377\2020@u\377\1%6n\377\202" \
+  "\30)d\377\240\31*e\377\3\30)d\377!1j\377/>s\377\212-<r\377\2,<r\377+" \
+  "<r\377\202,<r\377\5+;q\377,<r\377):p\377\33,f\377\30)e\377\240\31*e\377" \
+  "\202\30)d\377\6\"2k\377(8o\377'7n\377(8o\377'7o\377&6o\377\206'7o\377" \
+  "\3&7o\377\34-g\377\30)d\377\242\31*e\377\202\30)d\377\3\35-h\377\"2k" \
+  "\377\"2l\377\204#3l\377\202\"2k\377\2\37/i\377\30)d\377\301\31*e\377" \
+  "\1\30*d\377\202\30)d\377\12\27(d\377\31*e\377\36.h\377\"2k\377(7n\377" \
+  "/>s\3776Ex\377<J|\377;J|\377;I{\377\216:I{\377\2059Hz\377\211:I{\377" \
+  "\236;J|\377\211:I{\377\2079Hz\377\212:I{\377\1""9Hz\377\202:I{\377\12" \
+  ";J{\377<K|\3779Hz\3772Bv\377+;q\377$5l\377\40""1j\377\34-g\377\30)d\377" \
+  "\27(d\377\202\30)d\377\252\31*e\377\10\30)d\377\27(d\377\36/i\377,;r" \
+  "\3775Cx\3779Gz\3778Fz\3777Ey\377\2108Fz\377\2047Fy\377\1""6Fx\377\211" \
+  "7Fy\377\1""6Ex\377\2027Fy\377\1""6Ex\377\2025Dw\377\2056Ex\377\2025D" \
+  "w\377\3""7Fy\3770\77t\377\37""0i\377\202\30)d\377\236\31*e\377\7\30)" \
+  "d\377\27)c\377%6n\3772Av\3773Bv\3772Av\3771@u\377\2102Av\377\2021Au\377" \
+  "\1""0At\377\2071Au\377\2""0@u\3771At\377\2020@u\377\3%5m\377\30)e\377" \
+  "\30)d\377\240\31*e\377\2\27(d\377\40""0i\377\203-<r\377\1,;q\377\206" \
+  "-<r\377\3,<r\377-<r\377+<r\377\204,<r\377\3+;q\377\37""0i\377\30)d\377" \
+  "\240\31*e\377\3\31)d\377\30)d\377\36.h\377\202'7n\377\2'7o\377(8o\377" \
+  "\206'7o\377\4&6n\377'7o\377\40""1j\377\30)d\377\243\31*e\377\3\30)d\377" \
+  "\31*e\377!1j\377\205#3l\377\202\"2k\377\3!1j\377\32+e\377\30)d\377\304" \
+  "\31*e\377\204\30)d\377\11\31*e\377\32+e\377\32+f\377\35.g\377%5m\377" \
+  "-=s\3776Fx\377;J{\377;I{\377\220:I{\377\2109Hz\377\240:I{\377\2109Hz" \
+  "\377\215:I{\377\1""9Hz\377\203:I{\377\10;J{\377:I{\3772Bv\377*:p\377" \
+  "\40""1j\377\33,f\377\32+f\377\31*e\377\204\30)d\377\253\31*e\377\10\30" \
+  ")d\377\27(d\377\33-g\377-<s\3777Ey\3777Ez\3778Fz\3777Ey\377\2108Fz\377" \
+  "\1""7Fy\377\2028Fz\377\1""7Fy\377\2026Fx\377\2137Fy\377\2026Ex\377\1" \
+  "5Dw\377\2116Ex\377\2(9o\377\32+f\377\202\30)d\377\236\31*e\377\202\30" \
+  ")d\377\1(8o\377\2022Av\377\2021@u\377\2072Av\377\2""1Au\3772Av\377\202" \
+  "0At\377\2071Au\377\2""0@u\3771Au\377\2020@u\377\3%6m\377\31*e\377\30" \
+  ")d\377\240\31*e\377\4\30)d\377\35.h\377,;q\377.=s\377\202,;q\377\206" \
+  "-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\3+;q\377,<r\377#4l\377" \
+  "\202\30)d\377\240\31*e\377\10\30)d\377\32+f\377%5m\377(8o\377'7o\377" \
+  "(8o\377'7o\377&6o\377\204'7o\377\5&6n\377'7o\377$4l\377\32+e\377\30)" \
+  "d\377\244\31*e\377\1\35-h\377\205#3l\377\203\"2k\377\1\35.h\377\315\31" \
+  "*e\377\203\30)d\377\11\27(c\377\32+f\377\"2l\377*:q\3773Bu\3777Fy\377" \
+  "8Gy\3778Gz\3779Hz\377\206:I{\377\1""9Hz\377\266:I{\377\1""9Hz\377\206" \
+  ":I{\377\2029Hz\377\10""8Gz\3777Gy\3776Ex\377/>s\377'7n\377\37""0i\377" \
+  "\30)d\377\27(d\377\203\30)d\377\256\31*e\377\202\30)d\377\6\31*e\377" \
+  "\35-g\377+:q\3779Fz\3778Fz\3777Ey\377\2108Fz\377\2""7Fy\3778Fz\377\203" \
+  "7Fy\377\1""6Fx\377\2117Fy\377\1""6Ex\377\2027Fy\377\1""6Ex\377\2025D" \
+  "w\377\2066Ex\377\1""5Dw\377\2026Ex\377\2""3Bv\377#3k\377\202\30)d\377" \
+  "\237\31*e\377\6\30)d\377\32+f\377)9p\3773Bw\3772Av\3771@u\377\2072Av" \
+  "\377\1""1Au\377\2022Av\377\1""0At\377\2071Au\377\6""0@u\3771Au\3771A" \
+  "t\3770@u\377/\77t\377'7o\377\202\30)d\377\240\31*e\377\6\30)d\377\33" \
+  ",f\377)9p\377.=s\377-<r\377,;q\377\210-<r\377\2,<r\377+<r\377\202,<r" \
+  "\377\3,<q\377,<r\377'8o\377\202\30)d\377\240\31*e\377\10\30)d\377\31" \
+  "*e\377!1j\377(8o\377'7n\377(8o\377'7o\377&6o\377\206'7o\377\3&6n\377" \
+  "\36.h\377\30)d\377\243\31*e\377\3\30)d\377\31*e\377\"3k\377\205#3l\377" \
+  "\5\"2k\377!1j\377\40""0j\377\32+e\377\30)d\377\320\31*e\377\202\30)d" \
+  "\377\14\27(d\377\26'c\377\31)e\377\36.h\377#4l\377(8o\377-=r\3770@t\377" \
+  "3Bv\3775Ex\3778Gy\377:I{\377\202;J{\377\257:I{\377\1""9Hz\377\205:I{" \
+  "\377\202;J{\377\14""9Hz\3776Fx\3774Cw\3772Au\377/\77t\377+;q\377&6m\377" \
+  "!1j\377\33,g\377\26'c\377\27(c\377\27(d\377\202\30)d\377\260\31*e\377" \
+  "\7\30)d\377\27)d\377\32+e\377\40""1j\377*:q\3777Ey\3779Gz\377\2118Fz" \
+  "\377\1""7Fy\377\2028Fz\377\2027Fy\377\2026Fx\377\2117Fy\377\2""6Ex\377" \
+  "7Fy\377\2026Ex\377\1""5Dw\377\2076Ex\377\7""5Dx\3776Ex\3775Dw\377-<r" \
+  "\377\35-g\377\27(d\377\30)d\377\237\31*e\377\6\30)d\377\34-g\377*:q\377" \
+  "4Cw\3772Av\3771@u\377\2112Av\377\2131Au\377\1""0@t\377\2020@u\377\1&" \
+  "8n\377\202\30)d\377\240\31*e\377\6\30)d\377\31*e\377'6n\377/>s\377-<" \
+  "r\377,;q\377\207-<r\377\202,<r\377\1+<r\377\202,<r\377\5+;q\377,<r\377" \
+  ")9p\377\31*f\377\30)d\377\241\31*e\377\3\30)d\377\35.h\377(8o\377\202" \
+  "'7o\377\3(8o\377'7o\377&6o\377\204'7o\377\5&6n\377'7o\377\"2k\377\30" \
+  "*d\377\30)d\377\242\31*e\377\202\30)d\377\3\40""0i\377#3l\377\"2k\377" \
+  "\202#3l\377\7\"2k\377#3l\377\"2k\377!1k\377\35-h\377\30)d\377\30)e\377" \
+  "\244\31*e\377\1\30)d\377\257\31*e\377\203\30)d\377\15\27(d\377\27)d\377" \
+  "\31*e\377\34,g\377\36/h\377!1j\377#3l\377&6n\377*:p\377.=r\3771Au\377" \
+  "5Dx\3778Hz\377\202<K|\377\202;J|\377\2;J{\377;I{\377\205:I{\377\1""9" \
+  "Hz\377\225:I{\377\1""9Hz\377\205:I{\377\202;J{\377\202;J|\377\16<K|\377" \
+  ":I{\3777Fy\3773Cv\3770\77t\377,<q\377(8o\377$5l\377\"2k\377\37""0i\377" \
+  "\35.h\377\32+f\377\30)d\377\27(d\377\204\30)d\377\262\31*e\377\11\30" \
+  ")d\377\27(d\377\30)e\377$4l\377/>t\3776Dx\3779Fz\3778Fz\3777Ey\377\210" \
+  "8Fz\377\2""7Fy\3778Fz\377\2027Fy\377\2026Fx\377\2127Fy\377\2""6Ex\377" \
+  "7Fy\377\2026Ex\377\1""5Dw\377\2076Ex\377\6""5Dw\3776Ex\3772Au\377#3l" \
+  "\377\31*e\377\30)d\377\237\31*e\377\5\30)e\377\27(d\377\37/i\377.=s\377" \
+  "3Bw\377\2022Av\377\1""1@u\377\2102Av\377\2021Au\377\1""0At\377\2071A" \
+  "u\377\2""0@u\3771At\377\2020@u\377\3%5m\377\31*e\377\30)d\377\240\31" \
+  "*e\377\202\30)d\377\2&6m\377.=s\377\211-<r\377\3,<r\377-<r\377+<r\377" \
+  "\202,<r\377\5+;q\377,<r\377*:p\377\34-g\377\30)d\377\241\31*e\377\10" \
+  "\30)d\377\33+f\377&7n\377(8o\377'7n\377(8o\377'7o\377&6o\377\206'7o\377" \
+  "\3&5n\377\32+e\377\30)d\377\243\31*e\377\4\30)d\377\34-g\377#3l\377\"" \
+  "2k\377\204#3l\377\202\"2k\377\3\40""1j\377\31*e\377\30)d\377\245\31*" \
+  "e\377\1\30)d\377\263\31*e\377\1\30)e\377\205\30)d\377\202\31*e\377\20" \
+  "\32*e\377\32+e\377\32+f\377\33,f\377\34,f\377\37/j\377#3l\377'7n\377" \
+  "*:q\377-=r\3771@u\3774Cv\3776Fy\3779Hz\377;I{\377;J|\377\205;J{\377\1" \
+  ";I{\377\210:I{\377\202;I{\377\205;J{\377\13;J|\377:I{\3778Gy\3775Dx\377" \
+  "2Bv\377/\77t\377,;r\377(9o\377$5m\377!2j\377\35.h\377\202\33,f\377\2" \
+  "\32+f\377\32+e\377\202\31*e\377\207\30)d\377\264\31*e\377\202\30)d\377" \
+  "\4\30*d\377&5n\3774Bw\3777Ey\377\2028Fz\377\1""7Ey\377\2118Fz\377\2""7" \
+  "Fy\3778Fz\377\2027Fy\377\2026Fx\377\2117Fy\377\1""6Ex\377\2027Fy\377" \
+  "\2026Ex\377\1""5Dw\377\2066Ex\377\5""5Dw\3775Dx\3776Ex\377.=r\377\33" \
+  ",f\377\202\30)d\377\240\31*e\377\4\30)d\377!1j\3770\77u\3773Bw\377\203" \
+  "1@u\377\2072Av\377\2""1Au\3772Av\377\2020At\377\2071Au\377\2""0@u\377" \
+  "1Au\377\2020@u\377\3%6m\377\31*e\377\30)d\377\240\31*e\377\202\30)d\377" \
+  "\1%4m\377\202-<r\377\202,;q\377\206-<r\377\4,<r\377-<r\377,<r\377+<r" \
+  "\377\203,<r\377\3+;q\377\40""0j\377\30)d\377\241\31*e\377\10\30)d\377" \
+  "\30*d\377$4m\377(8o\377'7n\377'7o\377(8o\377&6o\377\205'7o\377\5&6n\377" \
+  "'7o\377\34-g\377\30)d\377\30)e\377\242\31*e\377\3\30)d\377\31*e\377!" \
+  "1k\377\204#3l\377\2\"2k\377#3l\377\202\"2k\377\2\33,g\377\30)d\377\247" \
+  "\31*e\377\202\30)d\377\275\31*e\377\1\30*e\377\205\30)d\377\1\27)d\377" \
+  "\204\27(d\377\10\31*e\377\33,f\377\35-g\377\36/i\377\37""0i\377\40""2" \
+  "j\377\"3k\377#3l\377\202#4l\377\203$5l\377\13#5l\377#3l\377\"3k\377\"" \
+  "2k\377!1i\377\37""0i\377\35.h\377\34,g\377\32+e\377\31*d\377\27(c\377" \
+  "\203\27(d\377\207\30)d\377\274\31*e\377\203\30)d\377\4\31*e\377\33,f" \
+  "\377'7n\3776Dy\377\2028Fz\377\1""7Ey\377\2118Fz\377\2""7Fy\3778Fz\377" \
+  "\2027Fy\377\1""6Fx\377\2137Fy\377\1""6Ex\377\2027Fy\377\2""6Ex\3775D" \
+  "w\377\2076Ex\377\7""5Dw\3776Ex\3775Ex\3774Cv\377$4l\377\27(c\377\30)" \
+  "d\377\240\31*e\377\6\30)d\377\31*e\377\"2k\3772Av\3773Bw\3771@u\377\211" \
+  "2Av\377\2021Au\377\1""0At\377\2111Au\377\4""1At\3770@u\377/\77t\377'" \
+  "7o\377\202\30)d\377\240\31*e\377\202\30)d\377\1!1j\377\202-<r\377\1," \
+  ";q\377\206-<r\377\1,<r\377\202-<r\377\204,<r\377\3,<q\377+;r\377%5l\377" \
+  "\202\30)d\377\240\31*e\377\202\30)d\377\3\40""0i\377'7n\377'7o\377\202" \
+  "(8o\377\210'7o\377\2!1j\377\30)d\377\243\31*e\377\202\30)d\377\2\36." \
+  "h\377\"2k\377\204#3l\377\203\"2k\377\2\37""0i\377\30)d\377\246\31*e\377" \
+  "\4\30)d\377\31*e\377\36/h\377\31*e\377\202\30)d\377\305\31*e\377\213" \
+  "\30)d\377\202\27)d\377\213\30)d\377\305\31*e\377\203\30)d\377\7\33,f" \
+  "\377!1j\377+:q\3776Dx\3779G{\3778Fz\3778Fy\377\2118Fz\377\1""7Fy\377" \
+  "\2028Fz\377\2027Fy\377\2026Fx\377\2117Fy\377\1""6Ex\377\2027Fy\377\202" \
+  "6Ex\377\1""5Dw\377\2076Ex\377\6""5Dw\3776Ex\3775Dw\377+;q\377\34-g\377" \
+  "\30)d\377\241\31*e\377\7\30)d\377\32+f\377&6n\3774Bw\3773Bv\3772Av\377" \
+  "1@u\377\2072Av\377\2031Au\377\1""0At\377\2071Au\377\6""0@u\3771Au\377" \
+  "0@t\3770@u\377/@u\377%6m\377\202\30)d\377\241\31*e\377\5\30)d\377\37" \
+  "/i\377,;r\377.=s\377,;q\377\210-<r\377\202,<r\377\1+<r\377\202,<r\377" \
+  "\5+;q\377,<r\377&7n\377\30)e\377\30)d\377\241\31*e\377\10\30)d\377\33" \
+  ",g\377&6n\377(8o\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\5&6n\377" \
+  "'7o\377$5m\377\32*e\377\30*e\377\243\31*e\377\3\30)d\377\32+f\377!2k" \
+  "\377\204#3l\377\202\"2k\377\202!1j\377\2\32+f\377\30)d\377\246\31*e\377" \
+  "\10\30)d\377\34-g\3774Bw\377-<s\377#3l\377\30*d\377\27(d\377\30)d\377" \
+  "\377\31*e\377\237\31*e\377\202\30)d\377\5\27(c\377\35.h\377)8o\3771\77" \
+  "u\3777Ey\377\2028Fz\377\1""7Ey\377\2118Fz\377\1""7Fy\377\2028Fz\377\202" \
+  "7Fy\377\2026Fx\377\2147Fy\377\2026Ex\377\2025Dw\377\2066Ex\377\6""5D" \
+  "w\3776Ex\3777Fy\3771\77t\377!2k\377\31*e\377\202\30)d\377\240\31*e\377" \
+  "\4\30)d\377\34-g\377+;r\3773Bw\377\2022Av\377\1""1@u\377\2072Av\377\4" \
+  "1Au\3772Av\3771Au\3770At\377\2071Au\377\6""0@u\3771Au\3770@t\3770@u\377" \
+  "/\77t\377\"3l\377\202\30)d\377\241\31*e\377\6\30)d\377\34-g\377,;r\377" \
+  ".=s\377-<r\377,;q\377\207-<r\377\202,<r\377\1+<r\377\202,<r\377\5+;q" \
+  "\377,<r\377'8o\377\32+e\377\30)d\377\241\31*e\377\6\31)d\377\31*e\377" \
+  "$4l\377(8o\377'7n\377(8o\377\202'7o\377\1&6o\377\205'7o\377\3&6n\377" \
+  "\35.h\377\30)d\377\244\31*e\377\4\30*d\377\37/i\377#3l\377#2k\377\204" \
+  "#3l\377\202\"2k\377\1\35-g\377\247\31*e\377\3\30)d\377\32+f\377\36.h" \
+  "\377\2028Fz\377\6""7Ey\3775Cw\377)8p\377\33,f\377\27(d\377\30)d\377\377" \
+  "\31*e\377\233\31*e\377\203\30)d\377\4!1k\377/\77t\3776Dx\3777Ey\377\214" \
+  "8Fz\377\1""7Fy\377\2028Fz\377\2037Fy\377\1""6Fx\377\2127Fy\377\2""6E" \
+  "x\3777Fy\377\2036Ex\377\1""5Dw\377\2076Ex\377\5""5Dw\3776Ex\3775Ew\377" \
+  "&7n\377\32+f\377\202\30)d\377\241\31*e\377\5\30)d\377\35-h\377/>t\377" \
+  "3Bw\3772Av\377\2021@u\377\2072Av\377\4""1Au\3772Av\3771Au\3770At\377" \
+  "\2071Au\377\10""0@u\3771Au\3770@u\377/\77u\377/\77t\377#3l\377\31*e\377" \
+  "\30)d\377\241\31*e\377\6\30)d\377\33,f\377-<r\377.=s\377-<r\377,;q\377" \
+  "\207-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\5+;q\377,<r\377*:p\377" \
+  "\33,g\377\30)d\377\242\31*e\377\2\30)d\377\"2k\377\202(8o\377\2'7o\377" \
+  "(8o\377\202&6o\377\205'7o\377\2&6n\377!1k\377\202\30)d\377\243\31*e\377" \
+  "\2\30)d\377\33+f\377\202#3l\377\1\"3l\377\202#3l\377\6\"2k\377#3l\377" \
+  "!1j\377\40""0j\377\31*e\377\30)d\377\245\31*e\377\4\30)e\377\31*d\377" \
+  "\35-g\377\36.h\377\2028Fz\377\1""7Ey\377\2038Fz\377\4.=t\377\40""1j\377" \
+  "\32+f\377\31*e\377\203\30)d\377\377\31*e\377\222\31*e\377\202\30)d\377" \
+  "\6\30*e\377\32*e\377\33,g\377'7o\3774Cx\3779Gz\377\2148Fz\377\2""7Fy" \
+  "\3778Fz\377\2037Fy\377\1""6Fx\377\2177Fy\377\2025Dw\377\2076Ex\377\1" \
+  "5Dw\377\2026Ex\377\3""5Dw\3770\77t\377\36/i\377\202\30)d\377\241\31*" \
+  "e\377\7\30)d\377\31*e\377\40""1j\3773Bv\3773Bw\3772Av\3771@u\377\212" \
+  "2Av\377\2""1Au\3770At\377\2111Au\377\6""0@t\3770@u\377/\77t\377\"3l\377" \
+  "\30)d\377\30)e\377\240\31*e\377\202\30)d\377\5\32+f\377+:p\377.=s\377" \
+  "-<r\377,;q\377\206-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\5" \
+  "+;r\377,<r\377+;q\377\37""0i\377\30)d\377\241\31*e\377\202\30)d\377\6" \
+  "\35.h\377(8o\377'7n\377'7o\377(8o\377&6o\377\205'7o\377\5&6n\377'7o\377" \
+  "%6n\377\31*d\377\30)d\377\243\31*e\377\202\30)d\377\1!2k\377\206#3l\377" \
+  "\4\"2k\377!1j\377\34-g\377\30)d\377\245\31*e\377\202\30)d\377\3\32+f" \
+  "\377\35-g\377\36.h\377\2048Fz\377\1""7Ey\377\2028Fz\377\6:G{\3773Bw\377" \
+  ")8o\377!1j\377\34,g\377\27)d\377\203\30)d\377\377\31*e\377\215\31*e\377" \
+  "\12\30)d\377\27(d\377\31*e\377\36/h\377$4m\377.=s\3778Ey\3779Gz\3778" \
+  "Fz\3777Ey\377\2128Fz\377\1""7Fy\377\2028Fz\377\2027Fy\377\2026Fx\377" \
+  "\2137Fy\377\2""6Ex\3777Fy\377\2036Ex\377\1""5Dw\377\2076Ex\377\1""5D" \
+  "w\377\2026Ex\377\4""1@u\377%6m\377\30)e\377\30)d\377\242\31*e\377\4\30" \
+  ")d\377\32+f\377&6n\3774Cx\377\2022Av\377\1""1@u\377\2072Av\377\2""1A" \
+  "u\3772Av\377\2021Au\377\1""0At\377\2071Au\377\7""0@u\3771Au\3770@t\377" \
+  "0@u\377.>s\377!1j\377\27(c\377\242\31*e\377\6\30)d\377\32+e\377(7o\377" \
+  ".=s\377-<r\377,;q\377\206-<r\377\2,<r\377-<r\377\205,<r\377\3+;q\377" \
+  ",<r\377\"2k\377\202\30)d\377\240\31*e\377\11\30)e\377\30)d\377\33,f\377" \
+  "&6n\377'8n\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\5&6n\377'7o\377" \
+  "&6n\377\34,f\377\30)d\377\243\31*e\377\202\30)d\377\3\36/h\377#3l\377" \
+  "\"2k\377\202#3l\377\2\"2k\377#3l\377\202\"2k\377\1\40""0i\377\202\30" \
+  ")d\377\245\31*e\377\3\30)d\377\31*e\377\34-h\377\202\36.h\377\2078Fz" \
+  "\377\13""7Ey\3778Fz\3779Fz\3776Ey\3771@u\377+;q\377\"2j\377\31*e\377" \
+  "\27(d\377\30)d\377\31)d\377\377\31*e\377\210\31*e\377\7\30)d\377\27)" \
+  "d\377\26(c\377\35.h\377'6n\377.=s\3774Bw\377\2168Fz\377\1""7Fy\377\202" \
+  "8Fz\377\2027Fy\377\2026Fx\377\2137Fy\377\1""6Ex\377\2027Fy\377\2026E" \
+  "x\377\2025Dw\377\2076Ex\377\5""5Dw\3776Ex\3775Dw\377'7n\377\34-g\377" \
+  "\202\30)d\377\242\31*e\377\5\30)d\377\34,g\377,;r\3773Bw\3772Av\377\202" \
+  "1@u\377\2072Av\377\2""1Au\3772Av\377\2021Au\377\1""0At\377\2071Au\377" \
+  "\7""0@u\3771Au\3770@t\3770@u\377-=s\377\37/i\377\30)d\377\242\31*e\377" \
+  "\6\30)d\377\30)e\377'7n\377.=s\377-<r\377,;q\377\210-<r\377\202,<r\377" \
+  "\1+<r\377\202,<r\377\3+;q\377-=r\377#3l\377\202\30)d\377\241\31*e\377" \
+  "\6\30)d\377\31*e\377#4l\377(8o\377'7o\377(8o\377\207'7o\377\4&7o\377" \
+  "'7o\377\36/i\377\30)d\377\244\31*e\377\2\30)d\377\33,f\377\202\"2k\377" \
+  "\204#3l\377\202\"2k\377\3\"2j\377\31*e\377\30)d\377\247\31*e\377\4\32" \
+  "+f\377\35.g\377\36-g\377\36.h\377\2108Fz\377\2""7Ey\3777Ez\377\2028F" \
+  "z\377\6""7Fy\3776Dy\3775Cx\377+;q\377\37""0i\377\27(d\377\202\30)d\377" \
+  "\377\31*e\377\203\31*e\377\202\30)d\377\6\27(d\377\32+e\377%5m\3772@" \
+  "v\3776Dx\3777Ey\377\2038Fz\377\1""7Ey\377\2128Fz\377\1""7Fy\377\2028" \
+  "Fz\377\2037Fy\377\2026Fx\377\2137Fy\377\2""6Ex\3777Fy\377\2026Ex\377" \
+  "\2025Dw\377\2076Ex\377\6""5Dw\3776Ex\3777Fy\377.<r\377\34-g\377\31*e" \
+  "\377\202\30)d\377\242\31*e\377\6\27(d\377\40""0i\3771@u\3773Bw\3772A" \
+  "v\3771@u\377\2102Av\377\3""1Au\3772Av\3771Au\377\2020At\377\2071Au\377" \
+  "\7""0@u\3771Au\3770@t\3770@u\377-=s\377\35-h\377\30)d\377\242\31*e\377" \
+  "\202\30)d\377\4'7o\377.=s\377-<r\377,;q\377\207-<r\377\2,<r\377-<r\377" \
+  "\202+<r\377\202,<r\377\5+;q\377,<r\377%5m\377\31*e\377\30)d\377\243\31" \
+  "*e\377\1\40""0i\377\202(8o\377\4'7o\377(8o\377'7o\377&6o\377\204'7o\377" \
+  "\5&6n\377'7o\377\"2k\377\31*e\377\30)d\377\243\31*e\377\3\30)d\377\31" \
+  "*e\377\40""0j\377\206#3l\377\202\"2k\377\2\34-g\377\30)d\377\250\31*" \
+  "e\377\2\35.h\377\36.h\377\202\35-g\377\2""8Fz\3777Fy\377\2138Fz\377\1" \
+  "7Ey\377\2028Fz\377\6""9Fz\3775Cx\377)9p\377\36.i\377\32+f\377\31*e\377" \
+  "\204\30)d\377\366\31*e\377\1\30)e\377\203\30)d\377\5\31*e\377\32+e\377" \
+  "\33,f\377#3l\377/>t\377\2038Fz\377\1""7Ey\377\2138Fz\377\1""7Fy\377\202" \
+  "8Fz\377\2037Fy\377\2026Fx\377\2167Fy\377\2026Ex\377\2025Dw\377\2076E" \
+  "x\377\1""5Dw\377\2026Ex\377\3""5Dw\3771Au\377!2j\377\202\30)d\377\243" \
+  "\31*e\377\4\30)d\377\31*e\377%6m\3773Bw\377\2022Av\377\1""1@u\377\210" \
+  "2Av\377\4""1Au\3772Av\3771Au\3770At\377\2071Au\377\3""0@u\3771Au\377" \
+  "1At\377\2020@u\377\3-=r\377\33+f\377\30)d\377\242\31*e\377\6\30)d\377" \
+  "\31*d\377&6m\377.=s\377-<r\377,;q\377\210-<r\377\2,<r\377+<r\377\205" \
+  ",<r\377\2'8o\377\32+e\377\243\31*e\377\2\30)d\377\34-f\377\202(8o\377" \
+  "\4'7o\377(8o\377'7o\377&6o\377\206'7o\377\3%5m\377\33,f\377\30)d\377" \
+  "\245\31*e\377\2\34-g\377#3k\377\205#3l\377\3\"2k\377\"2j\377\40""0i\377" \
+  "\250\31*e\377\4\30)d\377\32+f\377\36.h\377\35.h\377\202\36.h\377\1""7" \
+  "Fy\377\2218Fz\377\10""9Gz\377:H{\3773Bw\377+:q\377#3l\377\37/i\377\32" \
+  "+f\377\27(d\377\202\30)d\377\362\31*e\377\203\30)d\377\7\30*d\377\34" \
+  "-g\377!1j\377'6n\377/>t\3777Ey\3779G{\377\2028Fz\377\1""7Ey\377\2138" \
+  "Fz\377\1""7Fy\377\2028Fz\377\2027Fy\377\2036Fx\377\2147Fy\377\2""6Ex" \
+  "\3777Fy\377\2036Ex\377\1""5Dw\377\2106Ex\377\1""5Dx\377\2026Ex\377\3" \
+  "1@u\377'6n\377\32*e\377\202\30)d\377\242\31*e\377\6\31*d\377\30)d\377" \
+  "\34-g\377*:p\3773Bw\3772Av\377\2021@u\377\2072Av\377\1""1Au\377\2022" \
+  "Av\377\2""1Au\3770At\377\2071Au\377\2""0@u\3771Au\377\2030@u\377\3*:" \
+  "p\377\32+f\377\30)d\377\242\31*e\377\6\30)d\377\31*e\377$4l\377-=r\377" \
+  ".=s\377,;q\377\207-<r\377\2,<r\377-<r\377\204,<r\377\5+;q\377,<r\377" \
+  ")9p\377\34,g\377\30)d\377\242\31*e\377\10\30)d\377\32+f\377'6n\377(8" \
+  "o\377'7n\377(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377\37/h\377" \
+  "\30)d\377\30)e\377\243\31*e\377\5\30)d\377\32*e\377!2k\377#3l\377\"2" \
+  "k\377\202#3l\377\2\"2k\377#3l\377\202!1j\377\2\34,g\377\30)d\377\246" \
+  "\31*e\377\10\30)d\377\31*e\377\35.h\377\36-g\377\36.h\377\35-g\377\35" \
+  "-h\3776Fx\377\2027Fy\377\2028Fz\377\1""7Fy\377\2158Fz\377\1""7Ey\377" \
+  "\2038Fz\377\7""4Bw\3770>t\377*:q\377#3l\377\33,f\377\26'c\377\27(d\377" \
+  "\202\30)d\377\353\31*e\377\202\30)d\377\10\27(c\377\31)d\377\37/i\377" \
+  "'6n\377.=s\3772Av\3776Ey\3779Gz\377\2178Fz\377\1""7Fy\377\2028Fz\377" \
+  "\2037Fy\377\2026Fx\377\2147Fy\377\1""6Ex\377\2027Fy\377\2026Ex\377\202" \
+  "5Dw\377\2106Ex\377\5""5Dw\3777Fx\3773Cv\377&6m\377\34-g\377\202\30)d" \
+  "\377\243\31*e\377\7\30)d\377\27(d\377!2j\377/>t\3773Bw\3772Av\3771@u" \
+  "\377\2102Av\377\2""1Au\3772Av\377\2021Au\377\1""0At\377\2071Au\377\10" \
+  "0@u\3771Au\3770@u\377/\77u\3770@u\377&7n\377\32+e\377\30)d\377\243\31" \
+  "*e\377\6\30)d\377#3k\377-<r\377.=s\377-<r\377,;q\377\206-<r\377\2,<r" \
+  "\377-<r\377\204,<r\377\5+;q\377,<r\377+;q\377\35.g\377\30)d\377\242\31" \
+  "*e\377\10\30)d\377\31*e\377$4l\377(8o\377'7n\377'7o\377(8o\377&6o\377" \
+  "\205'7o\377\3&6n\377'7o\377!2k\377\202\30)d\377\244\31*e\377\4\30)d\377" \
+  "\40""0i\377#3l\377\"2k\377\202#3l\377\7\"2k\377#3l\377\"2k\377!1j\377" \
+  "\37/i\377\31)e\377\30)d\377\246\31*e\377\4\30)d\377\34,g\377\36.h\377" \
+  "\35.h\377\202\36.h\377\1\35-g\377\2036Fx\377\2027Fy\377\2208Fz\377\1" \
+  "7Ey\377\2038Fz\377\7""7Ez\3777Ey\3776Dx\3772Au\377(8o\377\36/i\377\27" \
+  ")d\377\203\30)d\377\345\31*e\377\202\30)d\377\7\27(d\377\33+e\377#3l" \
+  "\377-<s\3774Cx\3776Dy\3777Ey\377\2038Fz\377\1""7Ey\377\2158Fz\377\1""7" \
+  "Fy\377\2028Fz\377\2027Fy\377\2036Fx\377\2147Fy\377\1""6Ex\377\2027Fy" \
+  "\377\2026Ex\377\2025Dw\377\2106Ex\377\6""5Dw\3776Ex\3777Fx\377)8p\377" \
+  "\33,f\377\31*e\377\202\30)d\377\243\31*e\377\5\30)d\377\30*e\377(8o\377" \
+  "2Av\3773Bv\377\2022Av\377\1""1@u\377\2112Av\377\1""1Au\377\2020At\377" \
+  "\2111Au\377\6""0@u\377/\77t\3770@u\377%6m\377\31*d\377\30)d\377\243\31" \
+  "*e\377\2\27)d\377\"2k\377\202.=s\377\2-<r\377,;q\377\210-<r\377\1,<r" \
+  "\377\202+<r\377\204,<r\377\1\35-g\377\202\30)d\377\241\31*e\377\202\30" \
+  ")d\377\7\40""1j\377'7o\377'7n\377'7o\377(8o\377'7o\377&6o\377\204'7o" \
+  "\377\5&6n\377'7o\377$4m\377\31*e\377\30)d\377\244\31*e\377\2\30)d\377" \
+  "\34-g\377\206#3l\377\1\"2k\377\202!1j\377\2\32+e\377\30)d\377\246\31" \
+  "*e\377\2\30)d\377\32+e\377\202\35-g\377\4\36.h\377\35-g\377\36.h\377" \
+  "\32+e\377\2047Fy\377\2036Fx\377\2037Fy\377\2028Fz\377\1""7Fy\377\216" \
+  "8Fz\377\1""7Ey\377\2028Fz\377\10""9Gz\3777Ey\377.=s\377&5m\377\35-g\377" \
+  "\32+f\377\32+e\377\31*e\377\205\30)d\377\325\31*e\377\205\30)d\377\7" \
+  "\31*e\377\32+f\377\33,f\377!1j\377*9p\3773Av\3779Gz\377\2038Fz\377\1" \
+  "7Ey\377\2158Fz\377\1""7Fy\377\2028Fz\377\2037Fy\377\2036Fx\377\2157F" \
+  "y\377\2""6Ex\3777Fy\377\2026Ex\377\2035Dw\377\2106Ex\377\1""5Dw\377\202" \
+  "6Ex\377\3""5Dw\377-=r\377\33,g\377\202\30)d\377\244\31*e\377\7\30)d\377" \
+  "\31*e\377\34-g\377,<r\3773Bw\3772Av\3771@u\377\2102Av\377\1""1Au\377" \
+  "\2022Av\377\2""1Au\3770At\377\2101Au\377\2""0@u\3771Au\377\2020@u\377" \
+  "\3/\77t\377\"2k\377\27(d\377\243\31*e\377\202\30)d\377\2!1k\377.=s\377" \
+  "\202-<r\377\1,;q\377\206-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r" \
+  "\377\1+;q\377\202,<r\377\2\37""0i\377\30)d\377\243\31*e\377\3\30)d\377" \
+  "\35.g\377'7n\377\203(8o\377\2'7o\377&6o\377\204'7o\377\5&6n\377'7o\377" \
+  "&6n\377\33,f\377\30)d\377\244\31*e\377\2\30)d\377\31*f\377\202\"2k\377" \
+  "\205#3l\377\202\"2k\377\2\35-g\377\30)d\377\246\31*e\377\3\30)d\377\31" \
+  "*e\377\34-g\377\202\36.h\377\4\35-g\377\36.h\377\34-g\377\30)d\377\207" \
+  "7Fy\377\2026Fx\377\2037Fy\377\2038Fz\377\1""7Fy\377\2168Fz\377\1""7E" \
+  "y\377\2028Fz\377\12""9G{\377:G{\3775Cx\377.=s\377(7o\377#3k\377\37""0" \
+  "i\377\34-g\377\31*e\377\27)d\377\204\30)d\377\315\31*e\377\203\30)d\377" \
+  "\13\27(d\377\30)d\377\33+f\377\36.h\377!1j\377%5m\377+:q\3771@u\3777" \
+  "Fy\3779G{\3779Gz\377\2218Fz\377\1""7Fy\377\2028Fz\377\2037Fy\377\203" \
+  "6Fx\377\2157Fy\377\1""6Ex\377\2027Fy\377\2026Ex\377\2025Dw\377\2106E" \
+  "x\377\10""5Dw\3776Ex\3777Fx\3774Cv\377,<q\377\40""0i\377\27)d\377\30" \
+  ")d\377\245\31*e\377\7\30)d\377\31*e\377\"2k\3770@u\3773Bw\3772Av\377" \
+  "1@u\377\2102Av\377\2""1Au\3772Av\377\2021Au\377\1""0At\377\2071Au\377" \
+  "\1""0@u\377\2021Au\377\5""0@t\3770@u\377-=s\377\37""0i\377\30)d\377\243" \
+  "\31*e\377\202\30)d\377\5!1j\377-<r\377.=s\377-<r\377,;q\377\206-<r\377" \
+  "\4,<r\377-<r\377,<r\377+<r\377\204,<r\377\3+;q\377!2k\377\30)d\377\243" \
+  "\31*e\377\10\30)d\377\32+f\377&6m\377(8o\377'7n\377(8o\377'7o\377&6o" \
+  "\377\206'7o\377\3&6n\377\36/i\377\30)d\377\244\31*e\377\4\30)d\377\31" \
+  "*e\377\36/i\377\"2l\377\205#3l\377\202\"2k\377\2\37/i\377\30)d\377\247" \
+  "\31*e\377\4\30)e\377\32+f\377\35-h\377\36.g\377\202\36.h\377\3\35-h\377" \
+  "\31*e\377\30)e\377\2117Fy\377\2036Fx\377\2037Fy\377\2028Fz\377\1""7F" \
+  "y\377\2178Fz\377\1""7Ey\377\2038Fz\377\14""9Gz\3778Fz\3775Cx\3772Av\377" \
+  "/>t\377+:q\377&6m\377!1j\377\33,f\377\27(d\377\27(c\377\27(d\377\203" \
+  "\30)d\377\303\31*e\377\202\30)d\377\14\27(d\377\27(c\377\26(c\377\30" \
+  ")e\377\36.h\377#3k\377(8o\377-=s\3771\77u\3773Bw\3776Ey\3779Gz\377\203" \
+  "8Fz\377\1""7Ey\377\2178Fz\377\1""7Fy\377\2038Fz\377\2037Fy\377\2026F" \
+  "x\377\2167Fy\377\1""6Ex\377\2027Fy\377\2026Ex\377\2025Dw\377\2116Ex\377" \
+  "\6""5Dw\3776Ex\3775Dw\377*:p\377\40""0i\377\31*e\377\202\30)d\377\245" \
+  "\31*e\377\6\30)d\377\34,g\377*:p\3773Bv\3773Bw\3772Av\377\2021@u\377" \
+  "\2112Av\377\2021Au\377\1""0At\377\2111Au\377\6""0@u\3770@t\3770@u\377" \
+  ",<r\377\35-g\377\30)d\377\244\31*e\377\6\30)d\377!1j\377-<r\377.=s\377" \
+  "-<r\377,;q\377\206-<r\377\2,<r\377-<r\377\205,<r\377\5+;q\377,<r\377" \
+  "#4l\377\31*e\377\30)d\377\242\31*e\377\11\30)d\377\31*e\377%5m\377(8" \
+  "o\377'7n\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\5&6n\377'7o\377\"" \
+  "2k\377\31*e\377\30)d\377\244\31*e\377\3\31*d\377\34,f\377\"2k\377\204" \
+  "#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\32+f\377\30)d\377\247\31*e\377" \
+  "\11\31*d\377\34-g\377\36.h\377\35-h\377\35-g\377\36.h\377\33,f\377\31" \
+  ")e\377\31*e\377\2147Fy\377\2026Fx\377\2037Fy\377\2248Fz\377\1""7Ey\377" \
+  "\2048Fz\377\11""8Ey\3777Ey\3776Dy\3776Dx\3774Bw\377/>s\377)8p\377#3k" \
+  "\377\34-g\377\202\27(d\377\204\30)d\377\1\30)e\377\267\31*e\377\204\30" \
+  ")d\377\11\27)d\377\27(c\377\32+e\377\40""0i\377&5m\377,;r\3772@v\377" \
+  "5Dx\3776Dx\377\2027Ey\377\2048Fz\377\1""7Ey\377\2218Fz\377\1""7Fy\377" \
+  "\2028Fz\377\2037Fy\377\2036Fx\377\2167Fy\377\1""6Ex\377\2027Fy\377\203" \
+  "6Ex\377\1""5Dw\377\2116Ex\377\6""5Dw\3776Ex\3777Fx\377,;q\377\35-g\377" \
+  "\31*e\377\202\30)d\377\245\31*e\377\5\31*d\377\30)d\377\40""0j\3770@" \
+  "u\3773Bw\377\2022Av\377\1""1@u\377\2102Av\377\3""1Au\3772Av\3771Au\377" \
+  "\2020At\377\2101Au\377\2020@u\377\4/\77t\3770@u\377*:p\377\32*e\377\202" \
+  "\30)d\377\243\31*e\377\2\30)d\377\40""0j\377\202.=s\377\2-<r\377,;q\377" \
+  "\210-<r\377\1,<r\377\202+<r\377\202,<r\377\3+;q\377,<r\377%5m\377\202" \
+  "\30)d\377\242\31*e\377\202\30)d\377\7#3l\377(8o\377'7n\377'7o\377(8o" \
+  "\377'7o\377&6o\377\206'7o\377\3&6n\377\31*e\377\30)d\377\246\31*e\377" \
+  "\3!1k\377#3l\377\"2k\377\204#3l\377\3\"2k\377\"1k\377\35-h\377\250\31" \
+  "*e\377\4\30)d\377\32+f\377\36.h\377\36-g\377\202\36.h\377\6\35-g\377" \
+  "\31*e\377\30)d\377\31*e\3777Fy\3776Ex\377\2167Fy\377\2036Fx\377\2047" \
+  "Fy\377\2028Fz\377\1""7Fy\377\2238Fz\377\1""7Ey\377\2048Fz\377\13""9G" \
+  "z\3778Fz\3773Av\377.=s\377)8o\377#4l\377\36/i\377\33,f\377\33+f\377\32" \
+  "+f\377\32+e\377\203\31*e\377\215\30)d\377\220\31*e\377\215\30)d\377\1" \
+  "\30*d\377\202\31*e\377\14\32*e\377\32+e\377\32+f\377\33,f\377\34-g\377" \
+  "!1j\377&6n\377+:q\3770\77t\3776Ey\3779Gz\3779Fz\377\2038Fz\377\1""7E" \
+  "y\377\2238Fz\377\1""7Fy\377\2038Fz\377\2037Fy\377\2036Fx\377\2177Fy\377" \
+  "\1""6Ex\377\2027Fy\377\2036Ex\377\1""5Dw\377\2116Ex\377\1""5Dw\377\202" \
+  "6Ex\377\2025Dw\377\4-<q\377\34-g\377\27(d\377\30)d\377\246\31*e\377\202" \
+  "\30)d\377\6\32+f\377(8p\3774Cx\3773Aw\3772Av\3771@u\377\2102Av\377\1" \
+  "1Au\377\2022Av\377\2020At\377\2071Au\377\1""0@u\377\2021Au\377\6""0@" \
+  "t\377/\77u\3770@u\377%6n\377\30)d\377\31*d\377\243\31*e\377\202\30)d" \
+  "\377\2\40""0j\377.=s\377\202-<r\377\1,;q\377\206-<r\377\4,<r\377-<r\377" \
+  ",<r\377+<r\377\202,<r\377\1+;q\377\202,<r\377\2&6n\377\30)d\377\243\31" \
+  "*e\377\202\30)d\377\1\37""0i\377\202'7n\377\202(8o\377\206'7o\377\1&" \
+  "6n\377\202'7o\377\2\32,f\377\30)d\377\244\31*e\377\202\30)d\377\3\37" \
+  ".h\377#3l\377\"2k\377\202#3l\377\7\"2k\377#3l\377\"2k\377!1j\377\40""0" \
+  "i\377\31*e\377\30)d\377\246\31*e\377\11\30)d\377\30*d\377\36.h\377\35" \
+  "-g\377\36.h\377\35-g\377\35.h\377\33,f\377\30)d\377\202\31*e\377\1""6" \
+  "Ex\377\2027Fy\377\1""6Ex\377\2177Fy\377\2036Fx\377\2037Fy\377\2038Fz" \
+  "\377\1""7Fy\377\2258Fz\377\1""7Ey\377\2038Fz\377\27""9Gz\3779G{\377:" \
+  "G{\3779G{\3776Cx\3772@v\377/>t\377,;r\377)8p\377&6n\377$4l\377\"2k\377" \
+  "!1j\377\37""0i\377\36/i\377\35.h\377\34-g\377\33,f\377\33+f\377\32+e" \
+  "\377\31*e\377\30)d\377\27)d\377\221\27(d\377\23\30)d\377\31)d\377\31" \
+  "*e\377\32+e\377\33,f\377\34,g\377\35-h\377\36.h\377\37/i\377\40""0j\377" \
+  "!1k\377#3k\377%5m\377'7o\377*9p\377-<s\3770\77u\3774Bw\3777Ey\377\202" \
+  "9G{\377\2""9Gz\3779Fz\377\2308Fz\377\1""7Fy\377\2038Fz\377\2037Fy\377" \
+  "\2046Fx\377\2177Fy\377\1""6Ex\377\2027Fy\377\2026Ex\377\2035Dw\377\214" \
+  "6Ex\377\5""2Au\377*:p\377\36/h\377\27(d\377\30)d\377\247\31*e\377\6\30" \
+  ")d\377\31*e\377\40""1j\377/>t\3773Bw\3772Av\377\2021@u\377\2102Av\377" \
+  "\2""1Au\3772Av\377\2021Au\377\1""0At\377\2111Au\377\5""0@u\3770@t\377" \
+  "0@u\377.>t\377\"3k\377\202\30)d\377\243\31*e\377\202\30)d\377\5!1j\377" \
+  "-<r\377.=s\377-<r\377,;q\377\206-<r\377\4,<r\377-<r\377,<r\377+<r\377" \
+  "\205,<r\377\3&7n\377\32+f\377\31*d\377\243\31*e\377\10\30)d\377\34-g" \
+  "\377'7n\377(8o\377'7o\377(8o\377'7o\377&6o\377\204'7o\377\1&6n\377\202" \
+  "'7o\377\2\36.i\377\30)d\377\245\31*e\377\4\30)d\377\34,g\377#3l\377\"" \
+  "2k\377\204#3l\377\203\"2k\377\2\33,f\377\30)d\377\246\31*e\377\3\30)" \
+  "d\377\30)e\377\34-g\377\204\36.h\377\3\35-g\377\30*e\377\30)d\377\202" \
+  "\31*e\377\1""5Dw\377\2026Ex\377\2027Fy\377\1""6Ex\377\2207Fy\377\203" \
+  "6Fx\377\2037Fy\377\2348Fz\377\1""7Ey\377\2058Fz\377\1""9Fz\377\2029G" \
+  "z\377\16""8Fz\3776Ey\3775Cx\3774Bw\3773Av\3772@v\3771@u\3770\77u\377" \
+  "/>t\377.>t\377.=s\377-<s\377-<r\377,;r\377\202+:q\377\1*9p\377\202)9" \
+  "p\377\202)8p\377\202)9p\377\202*9p\377\202+:q\377\20,;r\377-<r\377-<" \
+  "s\377.=s\377/>s\3770>t\3771\77u\3771@u\3772Av\3774Bw\3775Cw\3776Dx\377" \
+  "7Ey\3778Fz\3779Gz\3779Fz\377\2058Fz\377\2""8Fy\3777Ez\377\2278Fz\377" \
+  "\1""7Fy\377\2038Fz\377\2047Fy\377\2026Fx\377\2207Fy\377\1""6Ex\377\203" \
+  "7Fy\377\2036Ex\377\1""5Dw\377\2126Ex\377\6""5Dw\3776Ex\3777Fx\3771@u" \
+  "\377%5m\377\35.h\377\203\30)d\377\247\31*e\377\7\27)d\377\33+f\377)9" \
+  "p\3772Av\3773Bw\3772Av\3771@u\377\2112Av\377\2""1Au\3772Av\377\2021A" \
+  "u\377\1""0At\377\2101Au\377\2020@u\377\4""0@t\3770@u\377,<s\377\36/h" \
+  "\377\202\30)d\377\244\31*e\377\6\30)d\377\40""1j\377-<r\377.=s\377-<" \
+  "r\377,;q\377\206-<r\377\2,<r\377-<r\377\205,<r\377\5+;q\377,<r\377(8" \
+  "o\377\33+f\377\30)d\377\243\31*e\377\6\30)d\377\32+e\377&6n\377(8o\377" \
+  "'7n\377(8o\377\202'7o\377\1&6o\377\206'7o\377\1!1k\377\246\31*e\377\3" \
+  "\30)d\377\32*e\377!1k\377\204#3l\377\2\"2k\377#3l\377\202\"2k\377\1\36" \
+  ".i\377\202\30)d\377\246\31*e\377\2\30)d\377\32+e\377\202\35-g\377\5\36" \
+  ".h\377\35-g\377\36.h\377\32+f\377\30)d\377\203\31*e\377\2025Dw\377\203" \
+  "6Ex\377\2237Fy\377\2046Fx\377\2047Fy\377\2038Fz\377\1""7Fy\377\2538F" \
+  "z\377\1""7Fy\377\2137Ey\377\2178Fz\377\1""7Ey\377\2348Fz\377\1""7Fy\377" \
+  "\2038Fz\377\2047Fy\377\2036Fx\377\2207Fy\377\1""6Ex\377\2027Fy\377\203" \
+  "6Ex\377\2035Dw\377\2116Ex\377\5""5Ew\3776Ex\3777Fx\3771\77u\377!2j\377" \
+  "\202\31*e\377\202\30)d\377\247\31*e\377\202\30)d\377\2!2k\3771@u\377" \
+  "\2032Av\377\1""1@u\377\2102Av\377\1""1Au\377\2022Av\377\1""1Au\377\202" \
+  "0At\377\2101Au\377\6""0@u\3771Au\377/\77t\3771Au\377)9p\377\32+e\377" \
+  "\202\30)d\377\244\31*e\377\2\27)d\377!1k\377\202.=s\377\2-<r\377,;q\377" \
+  "\210-<r\377\1,<r\377\202+<r\377\202,<r\377\4+;q\377,<r\377*:p\377\32" \
+  "+e\377\202\30)d\377\242\31*e\377\202\30)d\377\5%5m\377(8o\377'7n\377" \
+  "'7o\377(8o\377\202&6o\377\206'7o\377\3$5m\377\32+e\377\30)d\377\244\31" \
+  "*e\377\5\30)d\377\31*d\377\37/i\377#3l\377\"2k\377\204#3l\377\202\"2" \
+  "k\377\3!0j\377\31*e\377\30)d\377\246\31*e\377\3\30)d\377\31*e\377\34" \
+  ",g\377\204\36.h\377\1\34,g\377\202\30)d\377\203\31*e\377\2046Ex\377\203" \
+  "5Dw\377\2036Ex\377\2027Fy\377\1""6Ex\377\2227Fy\377\2036Fx\377\2057F" \
+  "y\377\2048Fz\377\1""7Fy\377\3238Fz\377\1""7Fy\377\2048Fz\377\2047Fy\377" \
+  "\2046Fx\377\2217Fy\377\1""6Ex\377\2037Fy\377\2026Ex\377\2035Dw\377\212" \
+  "6Ex\377\1""5Dw\377\2026Ex\377\4""5Dw\3774Cw\377.>s\377\40""0i\377\202" \
+  "\30)d\377\251\31*e\377\5\30)d\377\31*e\377\33,f\377)9p\3773Bw\377\202" \
+  "2Av\377\1""1@u\377\2112Av\377\3""1Au\3772Av\3771Au\377\2020At\377\211" \
+  "1Au\377\7""0@u\3770@t\3770@u\377/\77t\377&6n\377\31*e\377\30)d\377\244" \
+  "\31*e\377\202\30)d\377\2\"2k\377.=s\377\202-<r\377\1,;q\377\206-<r\377" \
+  "\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\1+;q\377\202,<r\377\3*:q\377" \
+  "\32*f\377\30)d\377\243\31*e\377\202\30)d\377\6\"3l\377(8o\377'7n\377" \
+  "(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377&6n\377\33,g\377\30)" \
+  "d\377\245\31*e\377\3\30)d\377\33,f\377\"2l\377\204#3l\377\202\"2k\377" \
+  "\4!1j\377\"2k\377\32+f\377\30)d\377\247\31*e\377\5\30)d\377\32+f\377" \
+  "\35.h\377\36-g\377\35-h\377\202\36.h\377\206\31*e\377\2076Ex\377\202" \
+  "5Dw\377\2036Ex\377\2037Fy\377\1""6Ex\377\2227Fy\377\2046Fx\377\2057F" \
+  "y\377\3178Fz\377\1""7Fy\377\2058Fz\377\2047Fy\377\2046Fx\377\2237Fy\377" \
+  "\1""6Ex\377\2027Fy\377\2046Ex\377\2025Dw\377\2126Ex\377\1""5Dw\377\202" \
+  "6Ex\377\5""6Dx\3771@t\377)9p\377\37/h\377\27(d\377\202\30)d\377\250\31" \
+  "*e\377\202\30)d\377\5\32+e\377\"2l\3770\77t\3774Cw\3772Av\377\2021@u" \
+  "\377\2102Av\377\1""1Au\377\2022Av\377\2""1Au\3770At\377\2111Au\377\1" \
+  "0@u\377\2020@t\377\3""0@u\377-=s\377\"3k\377\202\30)d\377\244\31*e\377" \
+  "\7\30)d\377\31*d\377#3k\377-<r\377.=s\377-<r\377,;q\377\206-<r\377\4" \
+  ",<r\377-<r\377,<r\377+<r\377\205,<r\377\3)9p\377\33,f\377\30)d\377\243" \
+  "\31*e\377\3\30)d\377\30*d\377\40""0i\377\202'7n\377\2'7o\377(8o\377\206" \
+  "'7o\377\5&6n\377'7o\377&6o\377\35.h\377\30)d\377\245\31*e\377\5\30)d" \
+  "\377\31*e\377!1k\377#3l\377\"2k\377\202#3l\377\2\"2k\377#3l\377\202\"" \
+  "2k\377\1\35.h\377\250\31*e\377\10\30)e\377\31*e\377\34-g\377\36.h\377" \
+  "\35.h\377\36.g\377\36.h\377\33,f\377\206\31*e\377\2116Ex\377\2035Dw\377" \
+  "\2036Ex\377\2027Fy\377\1""6Ex\377\2247Fy\377\2046Fx\377\2057Fy\377\205" \
+  "8Fz\377\1""7Fy\377\3008Fz\377\1""7Fy\377\2058Fz\377\2057Fy\377\2046F" \
+  "x\377\2247Fy\377\1""6Ex\377\2037Fy\377\2036Ex\377\2035Dw\377\2126Ex\377" \
+  "\10""5Dw\3776Ex\3777Fx\3776Dx\377,;q\377\"2k\377\34-g\377\27)d\377\202" \
+  "\30)d\377\251\31*e\377\202\30)d\377\2\37/i\377+;r\377\2023Bw\377\1""2" \
+  "Av\377\2021@u\377\2102Av\377\2""1Au\3772Av\377\2021Au\377\1""0At\377" \
+  "\2101Au\377\1""0@u\377\2021Au\377\2020@u\377\2*9p\377\35.h\377\202\30" \
+  ")d\377\244\31*e\377\7\30*d\377\30)d\377$3l\377-<r\377.=s\377-<r\377," \
+  ";q\377\206-<r\377\2,<r\377-<r\377\205,<r\377\5+;q\377,<r\377*:p\377\34" \
+  "-g\377\30)d\377\244\31*e\377\6\30)d\377\35.h\377'7n\377(8o\377'7o\377" \
+  "(8o\377\207'7o\377\5&7o\377'7o\377\37""0i\377\30)d\377\30*e\377\244\31" \
+  "*e\377\5\30)e\377\30)d\377\37""0i\377#3l\377\"2k\377\204#3l\377\5\"2" \
+  "k\377!1j\377\40""0j\377\31*e\377\30)d\377\247\31*e\377\4\30)d\377\33" \
+  ",g\377\36.h\377\35-g\377\202\36.h\377\3\35-g\377\31*e\377\30)d\377\205" \
+  "\31*e\377\2146Ex\377\2025Dw\377\2036Ex\377\2317Fy\377\2056Fx\377\205" \
+  "7Fy\377\2078Fz\377\1""7Fy\377\2728Fz\377\2057Fy\377\2056Fx\377\2267F" \
+  "y\377\1""6Ex\377\2027Fy\377\2036Ex\377\2035Dw\377\2136Ex\377\7""5Dw\377" \
+  "6Ex\3777Ex\3774Cv\377'6n\377\34-f\377\31*e\377\203\30)d\377\252\31*e" \
+  "\377\5\30)d\377\30)e\377(8n\3772Av\3773Bw\377\2022Av\377\1""1@u\377\211" \
+  "2Av\377\3""1Au\3772Av\3771Au\377\2020At\377\2101Au\377\11""0@u\3771A" \
+  "u\3770@u\3770@t\3770@u\377&7n\377\32+e\377\30)d\377\31*d\377\244\31*" \
+  "e\377\202\30)d\377\1&5n\377\202.=s\377\2-<r\377,;q\377\210-<r\377\1," \
+  "<r\377\202+<r\377\202,<r\377\4+;q\377,<r\377+;q\377\34-g\377\202\30)" \
+  "d\377\243\31*e\377\7\30)d\377\32+f\377'7o\377(8o\377'7n\377(8o\377'7" \
+  "o\377\202&6o\377\204'7o\377\5&6n\377'7o\377\"2k\377\31*e\377\30)d\377" \
+  "\245\31*e\377\2\30)d\377\35-g\377\205#3l\377\5\"2k\377#3l\377\"2k\377" \
+  "!1j\377\33,f\377\202\30)d\377\246\31*e\377\4\30)d\377\31*e\377\36.h\377" \
+  "\36.g\377\202\36.h\377\2\35-g\377\33,f\377\202\30)d\377\205\31*e\377" \
+  "\2""4Cw\3776Ew\377\2026Ex\377\1""5Dw\377\2136Ex\377\2035Dw\377\2046E" \
+  "x\377\2037Fy\377\1""6Ex\377\2317Fy\377\2066Fx\377\2107Fy\377\2178Fz\377" \
+  "\1""7Fy\377\2068Fz\377\1""7Fy\377\2178Fz\377\2117Fy\377\2066Fx\377\235" \
+  "7Fy\377\2036Ex\377\2035Dw\377\2136Ex\377\1""5Dw\377\2036Ex\377\4""5D" \
+  "w\3774Cw\377/\77s\377!3k\377\203\30)d\377\253\31*e\377\202\30)d\377\4" \
+  "\31*e\377\37""0j\3771@u\3773Bw\377\2022Av\377\1""1@u\377\2102Av\377\1" \
+  "1Au\377\2022Av\377\1""1Au\377\2020At\377\2101Au\377\3""0@u\3771Au\377" \
+  "0@t\377\2020@u\377\2.>t\377#3k\377\202\30)d\377\244\31*e\377\202\30)" \
+  "d\377\3\31*e\377'6m\377.=s\377\202-<r\377\1,;q\377\206-<r\377\4,<r\377" \
+  "-<r\377,<r\377+<r\377\202,<r\377\6+;r\377,<q\377,<r\377+;q\377\33,g\377" \
+  "\30)d\377\244\31*e\377\10\30)d\377\31*e\377&6n\377(8o\377'7o\377(8o\377" \
+  "'7o\377&6o\377\205'7o\377\5&6n\377'7o\377$4m\377\32+f\377\30)d\377\244" \
+  "\31*e\377\202\30)d\377\1\32+f\377\202\"2k\377\205#3l\377\202\"2k\377" \
+  "\2\36/h\377\30)d\377\247\31*e\377\202\30)d\377\7\34-g\377\36-g\377\36" \
+  ".h\377\35-h\377\36.h\377\35-g\377\30)d\377\207\31*e\377\4!2j\377+:p\377" \
+  "1@t\3775Ew\377\2036Ex\377\1""5Dw\377\2136Ex\377\2035Dw\377\2046Ex\377" \
+  "\2037Fy\377\1""6Ex\377\2347Fy\377\2076Fx\377\2207Fy\377\2108Fz\377\220" \
+  "7Fy\377\2106Fx\377\2337Fy\377\1""6Ex\377\2037Fy\377\2046Ex\377\2045D" \
+  "w\377\2166Ex\377\6""7Ex\3773Bv\377.=s\377'7n\377\35.g\377\27(c\377\202" \
+  "\30)d\377\254\31*e\377\202\30)d\377\3\36/i\377*:p\3773Bw\377\2022Av\377" \
+  "\2021@u\377\2122Av\377\2021Au\377\1""0At\377\2111Au\377\10""0@u\3771" \
+  "Au\3770@u\377/\77u\3770@u\377+;q\377\35.h\377\27(d\377\246\31*e\377\5" \
+  "\30)d\377\32+f\377'6n\377.=s\377-<r\377\202,;q\377\206-<r\377\4,<r\377" \
+  "-<r\377,<r\377+<r\377\203,<r\377\5,<q\377,<r\377*:q\377\34-g\377\30)" \
+  "d\377\244\31*e\377\10\30)d\377\31*e\377$4m\377(8o\377'7n\377(8o\377'" \
+  "7o\377&6o\377\205'7o\377\5&6n\377'7o\377&6n\377\34-g\377\30)d\377\245" \
+  "\31*e\377\3\30)d\377\31*e\377\40""0i\377\206#3l\377\202\"2k\377\3\40" \
+  "0j\377\31*e\377\30)d\377\246\31*e\377\12\30)d\377\30)e\377\32+f\377\35" \
+  "-g\377\35.h\377\36.h\377\36.g\377\36-h\377\31*f\377\30)d\377\207\31*" \
+  "e\377\202\30)d\377\5\34-g\377!1j\377)9o\3772Bv\3777Fy\377\2026Ex\377" \
+  "\1""5Dw\377\2146Ex\377\2035Dw\377\2046Ex\377\2037Fy\377\1""6Ex\377\240" \
+  "7Fy\377\2176Fx\377\2127Fy\377\2176Fx\377\2407Fy\377\1""6Ex\377\2037F" \
+  "y\377\2046Ex\377\2035Dw\377\2156Ex\377\2""5Dw\3776Ex\377\2027Fx\377\5" \
+  "/>s\377&5m\377\37""0i\377\32+f\377\27)d\377\202\30)d\377\254\31*e\377" \
+  "\7\30)d\377\27(c\377\33-g\377)8o\3770\77u\3774Bw\3772Av\377\2021@u\377" \
+  "\2112Av\377\2""1Au\3772Av\377\2021Au\377\2020At\377\2121Au\377\1""0@" \
+  "t\377\2020@u\377\3%6m\377\32+f\377\30)d\377\246\31*e\377\6\30)d\377\32" \
+  "+e\377(7o\377.=s\377-<r\377,;q\377\207-<r\377\2,<r\377-<r\377\205,<r" \
+  "\377\5+;r\377,<r\377*:q\377\35.h\377\30)d\377\244\31*e\377\7\30)d\377" \
+  "\31*e\377\"2k\377(8o\377'7n\377'7o\377(8o\377\207'7o\377\4&6o\377'7o" \
+  "\377\35-h\377\30)d\377\246\31*e\377\2\30)d\377\35.h\377\205#3l\377\6" \
+  "\"2k\377#3l\377\"2k\377!1j\377\32+f\377\30)d\377\247\31*e\377\3\30)d" \
+  "\377\31*e\377\35-g\377\202\36.h\377\4\35-g\377\36.h\377\33,g\377\30)" \
+  "d\377\211\31*e\377\203\30)d\377\5\31*e\377\32+f\377\40""1j\377+;q\377" \
+  "5Dx\377\2206Ex\377\2035Dw\377\2046Ex\377\2607Fy\377\2126Fx\377\2547F" \
+  "y\377\1""6Ex\377\2037Fy\377\2046Ex\377\2035Dw\377\2156Ex\377\11""5Dx" \
+  "\3776Ew\3776Ex\3777Fx\3772Au\377'7n\377\34-f\377\32+e\377\31*e\377\203" \
+  "\30)d\377\255\31*e\377\5\30)d\377\30)e\377$4m\3770\77u\3773Bv\377\203" \
+  "2Av\377\1""1@u\377\2112Av\377\2""1Au\3772Av\377\2021Au\377\1""0At\377" \
+  "\2111Au\377\2020@u\377\5""0@t\3770@u\377/\77t\377\37/i\377\31*e\377\202" \
+  "\30)d\377\245\31*e\377\6\30)d\377\33,f\377+:q\377.=s\377-<r\377,;q\377" \
+  "\211-<r\377\1,<r\377\202+<r\377\202,<r\377\4+;q\377,<r\377+;r\377\35" \
+  "-g\377\202\30)d\377\244\31*e\377\2\30)d\377\37""0j\377\202(8o\377\4'" \
+  "7o\377(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377\36/i\377\31)d" \
+  "\377\30)d\377\245\31*e\377\2\30)d\377\32+e\377\202#3l\377\1\"2k\377\202" \
+  "#3l\377\6\"2k\377#3l\377\"2k\377\"2j\377\35-g\377\31*d\377\251\31*e\377" \
+  "\1\33+f\377\204\36.h\377\3\35-g\377\31*e\377\30)d\377\215\31*e\377\1" \
+  "\31)d\377\202\30)d\377\5\31*e\377\"3k\377.>s\3774Cv\3775Dw\377\2036E" \
+  "x\377\1""5Dw\377\2176Ex\377\2035Dw\377\2046Ex\377\2057Fy\377\1""6Ex\377" \
+  "\3207Fy\377\1""6Ex\377\2057Fy\377\2046Ex\377\2045Dw\377\2166Ex\377\1" \
+  "5Dw\377\2036Ex\377\5""5Dw\3774Cw\3772Bv\377)9p\377\35.g\377\203\30)d" \
+  "\377\257\31*e\377\202\30)d\377\5\31*e\377\36.i\377.=s\3774Cw\3773Bw\377" \
+  "\2021@u\377\2112Av\377\2""1Au\3772Av\377\2031Au\377\1""0At\377\2101A" \
+  "u\377\11""0@u\3771Au\3770@u\3770@t\377/\77u\377/\77t\377*:q\377\31+f" \
+  "\377\30)d\377\246\31*e\377\202\30)d\377\5\34-g\377+;r\377.=s\377-<r\377" \
+  ",;q\377\207-<r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\1+;q\377" \
+  "\202,<r\377\3+;q\377\33,g\377\30)d\377\244\31*e\377\202\30)d\377\7\36" \
+  ".g\377)9o\377'7n\377'7o\377(8o\377'7o\377&6o\377\207'7o\377\1\"2k\377" \
+  "\247\31*e\377\202\30)d\377\1!2k\377\204#3l\377\2\"2k\377#3l\377\202\"" \
+  "2k\377\3\37""0i\377\31*e\377\30)d\377\247\31*e\377\4\30)d\377\31*e\377" \
+  "\35.h\377\36-g\377\203\36.h\377\2\32+f\377\30)d\377\221\31*e\377\202" \
+  "\30)d\377\7\26'c\377\33,f\377#3l\377+;q\3770\77t\3774Cw\3777Fx\377\222" \
+  "6Ex\377\2045Dw\377\2056Ex\377\2057Fy\377\1""6Ex\377\3077Fy\377\1""6E" \
+  "x\377\2047Fy\377\2056Ex\377\2055Dw\377\2166Ex\377\1""5Dw\377\2046Ex\377" \
+  "\4""2Au\377.=r\377(8o\377\40""0j\377\202\27(d\377\202\30)d\377\257\31" \
+  "*e\377\10\30*e\377\30)d\377\30)e\377\37/i\377*:p\3774Cx\3773Bw\3772A" \
+  "v\377\2021@u\377\2112Av\377\2""1Au\3772Av\377\2021Au\377\2020At\377\212" \
+  "1Au\377\5""0@u\3770@t\3770@u\377.>s\377#4l\377\202\30)d\377\246\31*e" \
+  "\377\7\31*d\377\30)d\377\37/i\377+:q\377.=s\377-<r\377,;q\377\207-<r" \
+  "\377\4,<r\377-<r\377,<r\377+<r\377\205,<r\377\3):p\377\34-g\377\30)d" \
+  "\377\244\31*e\377\202\30)d\377\2\35.h\377(8n\377\202'7o\377\3(8o\377" \
+  "'7o\377&6o\377\205'7o\377\5&6n\377'7o\377$4l\377\32+f\377\30)d\377\245" \
+  "\31*e\377\5\30)d\377\30*d\377\37/i\377#3l\377\"2k\377\202#3l\377\2\"" \
+  "2k\377#3l\377\202\"2k\377\3!1j\377\32+e\377\30)d\377\247\31*e\377\12" \
+  "\30)d\377\30)e\377\35.g\377\36.h\377\35.h\377\36.h\377\36-h\377\34,g" \
+  "\377\31*e\377\30)d\377\224\31*e\377\203\30)d\377\12\33,f\377\40""0i\377" \
+  "%5m\377,<r\3774Cv\3777Fy\3777Ex\3776Ex\3776Ew\3775Dx\377\2176Ex\377\205" \
+  "5Dw\377\2056Ex\377\2067Fy\377\1""6Ex\377\3027Fy\377\2056Ex\377\2055D" \
+  "w\377\2226Ex\377\2027Fx\377\5""1@u\377)9p\377\"2k\377\36.h\377\31+e\377" \
+  "\203\30)d\377\261\31*e\377\6\30)d\377\27(c\377\36.h\377):p\3771@v\377" \
+  "3Bw\377\2022Av\377\1""1@u\377\2142Av\377\1""1Au\377\2020At\377\2111A" \
+  "u\377\7""0@u\3771Au\3770@t\3770@u\3771Av\377)9p\377\36/h\377\202\30)" \
+  "d\377\246\31*e\377\7\30)d\377\27)d\377!2k\377,;r\377.=s\377-<r\377,;" \
+  "q\377\207-<r\377\2,<r\377-<r\377\205,<r\377\5+;q\377,<r\377):p\377\35" \
+  "-g\377\30)d\377\244\31*e\377\11\31*d\377\30)d\377\34-g\377&6n\377(8o" \
+  "\377'7n\377(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377&6n\377\33" \
+  ",f\377\30)d\377\245\31*e\377\202\30)d\377\1\34-h\377\202\"2k\377\204" \
+  "#3l\377\203\"2k\377\2\33,g\377\30)d\377\250\31*e\377\11\30)d\377\33," \
+  "f\377\36.h\377\35-g\377\36.h\377\35-g\377\35.h\377\32*f\377\30)d\377" \
+  "\227\31*e\377\203\30)d\377\1\31*e\377\202\32+e\377\4\40""0i\377)9o\377" \
+  "3Bv\3777Ex\377\2026Ex\377\1""5Dw\377\2226Ex\377\2045Dw\377\2076Ex\377" \
+  "\2067Fy\377\1""6Ex\377\2567Fy\377\1""6Ex\377\2077Fy\377\2076Ex\377\204" \
+  "5Dw\377\2216Ex\377\1""5Dw\377\2046Ex\377\5/>t\377%6m\377\34-g\377\32" \
+  "+e\377\31*e\377\203\30)d\377\1\30)e\377\262\31*e\377\5\30)d\377\33+f" \
+  "\377*9p\3771@v\3773Bw\377\2022Av\377\2021@u\377\2122Av\377\2041Au\377" \
+  "\1""0At\377\2111Au\377\2""0@u\3771Au\377\2030@u\377\2#3k\377\31*e\377" \
+  "\202\30)d\377\246\31*e\377\202\30)d\377\5$4l\377-<r\377.=s\377-<r\377" \
+  ",;q\377\211-<r\377\1,<r\377\202+<r\377\202,<r\377\4+;q\377,<r\377*:q" \
+  "\377\33,f\377\202\30)d\377\244\31*e\377\10\30)d\377\32+f\377%6m\377(" \
+  "8o\377'7n\377(8o\377'7o\377&6o\377\210'7o\377\1\33,f\377\202\30)d\377" \
+  "\245\31*e\377\3\30)d\377\32+f\377\"2k\377\206#3l\377\202\"2k\377\1\36" \
+  "/h\377\202\30)d\377\247\31*e\377\10\30)d\377\31*e\377\35-g\377\36-g\377" \
+  "\36.h\377\35.h\377\36.h\377\34,g\377\202\30)d\377\235\31*e\377\202\30" \
+  ")d\377\7\27(d\377\34-g\377&6m\377.>s\3774Cv\3774Cw\3775Dw\377\2046Ex" \
+  "\377\1""5Dw\377\2256Ex\377\2065Dw\377\2136Ex\377\2357Fy\377\2126Ex\377" \
+  "\2075Dw\377\2246Ex\377\2""5Ex\3776Dw\377\2036Ex\377\2025Dw\377\6""4C" \
+  "v\3772Au\377+;q\377!1k\377\31*e\377\27(d\377\202\30)d\377\264\31*e\377" \
+  "\202\30)d\377\6\31*e\377\32+f\377$5m\3772Av\3773Bw\3772Av\377\2021@u" \
+  "\377\2142Av\377\2021Au\377\1""0At\377\2111Au\377\10""0@u\3771Au\3770" \
+  "@u\3770@t\3770@u\377/\77t\377,<r\377\36.h\377\202\30)d\377\247\31*e\377" \
+  "\4\30)d\377\31*e\377%4m\377.=s\377\202-<r\377\1,;q\377\207-<r\377\4," \
+  "<r\377-<r\377,<r\377+<r\377\202,<r\377\1+;q\377\202,<r\377\3*:p\377\32" \
+  "+f\377\30)d\377\245\31*e\377\5\30)d\377\31*e\377$4l\377(8o\377'7n\377" \
+  "\202(8o\377\2'7o\377&6o\377\204'7o\377\1&6n\377\202'7o\377\2\35.g\377" \
+  "\30)d\377\246\31*e\377\5\30)d\377\31*e\377\40""0j\377#3l\377\"2k\377" \
+  "\202#3l\377\5\"2k\377#3l\377\"2k\377\"1j\377\40""0j\377\251\31*e\377" \
+  "\3\30)d\377\31*d\377\34-f\377\202\36.h\377\4\35-g\377\36.h\377\35.h\377" \
+  "\30)d\377\241\31*e\377\202\30)d\377\12\27(d\377\27(c\377\32*e\377\40" \
+  "1j\377'6n\377,<r\3770\77t\3773Bv\3776Ex\3777Ex\377\2336Ex\377\2125Dw" \
+  "\377\2366Ex\377\2125Dw\377\2306Ex\377\1""5Dw\377\2036Ex\377\11""7Fx\377" \
+  "5Cw\3771Au\377.>s\377*:p\377$4l\377\35.g\377\27(d\377\27(c\377\202\30" \
+  ")d\377\266\31*e\377\202\30)d\377\4\34-g\377$4m\3770\77u\3774Cw\377\202" \
+  "2Av\377\1""1@u\377\2122Av\377\2""1Au\3772Av\377\2031Au\377\1""0At\377" \
+  "\2111Au\377\2""0@u\3771Au\377\2030@u\377\5.>s\377&6n\377\31*e\377\30" \
+  ")d\377\31*d\377\247\31*e\377\5\30)d\377\33+f\377&6n\377/=s\377-<r\377" \
+  "\202,;q\377\207-<r\377\4,<r\377-<r\377,<r\377+<r\377\205,<r\377\3(8o" \
+  "\377\33,f\377\30)d\377\245\31*e\377\11\30)d\377\31*e\377$4l\377(8o\377" \
+  "'7n\377'7o\377(8o\377'7o\377&6o\377\206'7o\377\2&6n\377\37""0j\377\247" \
+  "\31*e\377\202\30)d\377\3\36.h\377#3l\377\"2k\377\204#3l\377\1\"2k\377" \
+  "\202!1j\377\2\33,f\377\30)d\377\250\31*e\377\3\30*e\377\32+e\377\35-" \
+  "g\377\203\36.h\377\3\35.h\377\31*e\377\30)d\377\244\31*e\377\205\30)" \
+  "d\377\6\33,f\377\37/i\377!2j\377'7n\377,<r\3773Av\377\2027Fy\377\1""7" \
+  "Fx\377\2026Ex\377\1""5Dx\377\2356Ex\377\2365Dw\377\2366Ex\377\1""5Dw" \
+  "\377\2026Ex\377\11""7Fx\3778Fy\3775Dx\3770\77t\377*:p\377$5m\377\40""1" \
+  "j\377\35.h\377\32+e\377\204\30)d\377\267\31*e\377\6\30)d\377\27(c\377" \
+  "\33,g\377&6n\377/>t\3773Bw\377\2022Av\377\2021@u\377\2122Av\377\2""1" \
+  "Au\3772Av\377\2021Au\377\2020At\377\2131Au\377\5""0@u\377/\77t\3770@" \
+  "u\377*:q\377\36/i\377\202\30)d\377\250\31*e\377\4\27)d\377\35-h\377)" \
+  "9p\377.=s\377\214-<r\377\205,<r\377\5+;q\377,<r\377'8o\377\33,f\377\30" \
+  ")d\377\245\31*e\377\11\30)d\377\31*e\377#3k\377(8o\377'7n\377'7o\377" \
+  "(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377!2k\377\31*e\377\30)" \
+  "d\377\246\31*e\377\3\30)d\377\34-g\377#3k\377\204#3l\377\2\"2k\377#3" \
+  "l\377\202\"2k\377\3\35.h\377\30)e\377\30)d\377\250\31*e\377\3\30)d\377" \
+  "\35-g\377\36.h\377\202\35-g\377\2\36.h\377\33,f\377\252\31*e\377\204" \
+  "\30)d\377\11\31*e\377\32*e\377\32+f\377\34,g\377\"2j\377)9o\3770\77t" \
+  "\3776Ex\3777Fx\377\2036Ex\377\1""5Dw\377\3206Ex\377\1""5Dw\377\2046E" \
+  "x\377\7""7Fx\3773Bw\377-<r\377&6m\377\37/i\377\33,f\377\32+e\377\202" \
+  "\31*e\377\204\30)d\377\271\31*e\377\4\30)d\377\32+e\377'8o\3771@u\377" \
+  "\2032Av\377\2021@u\377\2152Av\377\1""1Au\377\2020At\377\2121Au\377\202" \
+  "0@u\377\1""0@t\377\2020@u\377\2#3l\377\31*e\377\202\30)d\377\247\31*" \
+  "e\377\202\30)d\377\4\37/i\377,;q\377.=s\377-<r\377\202,;q\377\207-<r" \
+  "\377\2,<r\377-<r\377\202,<r\377\1+<r\377\202,<r\377\4+;q\377,<r\377&" \
+  "7n\377\31*e\377\202\30)d\377\244\31*e\377\11\30)d\377\31*e\377\"2k\377" \
+  "(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\3&6n\377'7o\377" \
+  "#4l\377\202\30)d\377\246\31*e\377\5\30)d\377\33+f\377\"2k\377#3l\377" \
+  "\"2k\377\202#3l\377\2\"2k\377#3l\377\202\"2k\377\1\40""0j\377\202\30" \
+  ")d\377\250\31*e\377\4\30)d\377\33,f\377\36.h\377\35-g\377\202\36.h\377" \
+  "\3\35-g\377\31*e\377\30)d\377\260\31*e\377\203\30)d\377\11\27(d\377\30" \
+  ")d\377\36.h\377$4l\377*:p\3770\77t\3773Cv\3774Cv\3774Cw\377\2025Dw\377" \
+  "\2066Ex\377\1""6Ew\377\2736Ex\377\1""5Dw\377\2066Ex\377\2025Dw\377\10" \
+  "4Cw\3774Cv\3772Bu\377-=r\377'7n\377!1j\377\32+f\377\27(d\377\204\30)" \
+  "d\377\274\31*e\377\202\30)d\377\6\31*e\377\32+f\377%5m\3772Av\3773Bw" \
+  "\3772Av\377\2021@u\377\2122Av\377\1""1Au\377\2022Av\377\2021Au\377\202" \
+  "0At\377\2131Au\377\10""0@u\3770@t\377/\77u\377/\77t\377+;r\377\33,g\377" \
+  "\30)d\377\31*d\377\250\31*e\377\7\30)d\377\31*e\377\40""0j\377-=s\377" \
+  ".=s\377-<r\377,;q\377\207-<r\377\4,<r\377-<r\377,<r\377+<r\377\203,<" \
+  "r\377\1+;q\377\202,<r\377\3%6m\377\30)d\377\31*d\377\245\31*e\377\5\30" \
+  ")d\377\31*e\377\37""0i\377(8o\377(8n\377\202(8o\377\2'7o\377&6o\377\204" \
+  "'7o\377\1&6o\377\202'7o\377\3%5m\377\31*e\377\30)d\377\246\31*e\377\3" \
+  "\30)d\377\31*e\377\40""0j\377\206#3l\377\5\"2k\377\"1j\377!2k\377\31" \
+  "*e\377\30)d\377\250\31*e\377\5\30)d\377\31*e\377\36.h\377\35-g\377\36" \
+  ".h\377\202\35-g\377\2\33+f\377\30)d\377\265\31*e\377\203\30)d\377\16" \
+  "\27(d\377\27(c\377\30)d\377\35.h\377!1j\377%6m\377)9p\377-<r\377.>s\377" \
+  "0@t\3772Bu\3774Cw\3776Ex\3777Fx\377\2076Ex\377\1""5Dw\377\2536Ex\377" \
+  "\1""5Dx\377\2066Ex\377\14""7Ex\3777Fx\3775Dw\3773Bv\3771Au\377/\77t\377" \
+  ".=r\377+;q\377(8n\377$3k\377\37""0i\377\33,f\377\202\27(c\377\1\27(d" \
+  "\377\203\30)d\377\276\31*e\377\202\30)d\377\5\30)e\377\36/h\377&6n\377" \
+  "1@v\3774Cw\377\2022Av\377\1""1@u\377\2152Av\377\2021Au\377\2020At\377" \
+  "\2121Au\377\2020@u\377\1""0@t\377\2020@u\377\2-=r\377#3l\377\202\30)" \
+  "d\377\251\31*e\377\7\30)d\377\32+e\377#4l\377.>s\377.<r\377-<r\377,;" \
+  "q\377\207-<r\377\2,<r\377-<r\377\207,<r\377\2,;q\377#4l\377\247\31*e" \
+  "\377\202\30)d\377\1\37/h\377\202(8o\377\4'7o\377(8o\377'7o\377&6o\377" \
+  "\205'7o\377\5&6n\377'7o\377%5m\377\32+f\377\30)d\377\247\31*e\377\2\30" \
+  ")d\377\36.h\377\205#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\33,f\377\30" \
+  ")d\377\250\31*e\377\12\30)d\377\31*e\377\35-g\377\36-g\377\36.h\377\35" \
+  "-h\377\36.h\377\34-g\377\31*e\377\30)d\377\272\31*e\377\204\30)d\377" \
+  "\16\27(d\377\30)d\377\32+f\377\34-g\377\36/h\377\40""0i\377\"2k\377$" \
+  "4l\377'8n\377*:p\377-=s\3770@t\3773Bv\3775Ew\377\2037Fy\377\2027Fx\377" \
+  "\1""7Ex\377\2066Ex\377\1""5Dw\377\2346Ex\377\2037Fx\377\2037Fy\377\16" \
+  "4Cw\3772Au\377/>s\377,;q\377)9p\377&6n\377#3k\377!1j\377\37""0i\377\35" \
+  ".h\377\33,f\377\31*e\377\30)d\377\27(d\377\204\30)d\377\301\31*e\377" \
+  "\203\30)d\377\4!1j\377*:q\3770@u\3773Bw\377\2022Av\377\2021@u\377\213" \
+  "2Av\377\2""1Au\3772Av\377\2021Au\377\2020At\377\2111Au\377\1""0@u\377" \
+  "\2021Au\377\1""0@t\377\2020@u\377\2&6n\377\34-g\377\202\30)d\377\250" \
+  "\31*e\377\202\30)d\377\3\34,f\377(7o\377.=s\377\202-<r\377\1,;q\377\211" \
+  "-<r\377\202,<r\377\1+<r\377\202,<r\377\6+;q\377+;r\377,<r\377\"2k\377" \
+  "\31*e\377\30)d\377\245\31*e\377\202\30)d\377\7\40""0i\377'7o\377(8o\377" \
+  "'7n\377(8o\377'7o\377&6o\377\207'7o\377\3&6n\377\34-g\377\30)d\377\247" \
+  "\31*e\377\5\30)d\377\34-g\377#3k\377#3l\377\"2k\377\202#3l\377\6\"2k" \
+  "\377#3l\377\"2k\377!2j\377\35.h\377\30*e\377\250\31*e\377\12\30)d\377" \
+  "\30*e\377\33,f\377\36.g\377\35.h\377\36.h\377\36.g\377\35-h\377\31*e" \
+  "\377\30)d\377\277\31*e\377\207\30)d\377\1\31)e\377\202\31*e\377\1\32" \
+  "+e\377\202\32+f\377\15\33+f\377\33,g\377\37/i\377!2j\377$4l\377'7n\377" \
+  ")9p\377,;q\377/>s\3770@t\3772Bu\3774Cw\3776Ex\377\2067Fx\377\2027Ex\377" \
+  "\2076Ex\377\2027Ex\377\2067Fx\377\14""6Dw\3774Cv\3771Au\3770\77s\377" \
+  "-=r\377+;p\377)8o\377&6n\377#4k\377\40""1j\377\35.h\377\33,f\377\202" \
+  "\32+f\377\1\32+e\377\203\31*e\377\207\30)d\377\305\31*e\377\202\30)d" \
+  "\377\4!1j\377/>t\3772Av\3773Bw\377\2022Av\377\2021@u\377\2132Av\377\1" \
+  "1Au\377\2022Av\377\2021Au\377\1""0At\377\2141Au\377\6""0@u\3770@t\377" \
+  "0@u\377,<r\377\35.h\377\31*e\377\202\30)d\377\251\31*e\377\3\30)d\377" \
+  "\34-h\377+:q\377\202.=s\377\202,;q\377\210-<r\377\2,<r\377-<r\377\202" \
+  "+<r\377\202,<r\377\1+;q\377\202,<r\377\1\37""0i\377\202\30)d\377\245" \
+  "\31*e\377\202\30)d\377\7\36/i\377'7n\377(8o\377'7n\377'7o\377(8o\377" \
+  "&6o\377\206'7o\377\3&6n\377'7o\377\34-h\377\202\30)d\377\246\31*e\377" \
+  "\5\30)d\377\32+f\377\"2k\377#3l\377\"2k\377\204#3l\377\202\"2k\377\3" \
+  "\40""0i\377\31*e\377\30)d\377\250\31*e\377\3\30)d\377\31*e\377\35.h\377" \
+  "\202\36.h\377\4\35-g\377\36.h\377\32+f\377\30)d\377\316\31*e\377\210" \
+  "\30)d\377\1\27)d\377\203\27(d\377\11\30)d\377\31*e\377\32+f\377\33,g" \
+  "\377\35.g\377\36.h\377\36/h\377\37/i\377\37""0i\377\204\40""1i\377\202" \
+  "\40""0i\377\7\36""0h\377\36/h\377\35.g\377\34-g\377\33,f\377\32*f\377" \
+  "\30)e\377\204\27(d\377\1\27)d\377\207\30)d\377\317\31*e\377\202\30)d" \
+  "\377\7\31*e\377\32*e\377\"3l\3770>u\3774Cw\3773Bw\3772Av\377\2021@u\377" \
+  "\2132Av\377\1""1Au\377\2022Av\377\2021Au\377\2020At\377\2111Au\377\1" \
+  "0@u\377\2021Au\377\1""0@u\377\202/\77u\377\2.>t\377%5m\377\203\30)d\377" \
+  "\250\31*e\377\10\31*d\377\30)d\377\31*e\377\37""0i\377.<s\377.=s\377" \
+  "-<r\377,;q\377\207-<r\377\2,<r\377-<r\377\202,<r\377\1+<r\377\205,<r" \
+  "\377\3+:q\377\36/i\377\30)d\377\246\31*e\377\6\30*e\377\31)d\377\35." \
+  "g\377'7n\377(8o\377'7o\377\202(8o\377\206'7o\377\1&6n\377\202'7o\377" \
+  "\2\35.i\377\30)d\377\247\31*e\377\2\30)d\377\31*e\377\202\"2k\377\203" \
+  "#3l\377\1\"2k\377\202#3l\377\4\"2k\377!1j\377\32+e\377\30)d\377\250\31" \
+  "*e\377\10\30)d\377\31*e\377\35-g\377\36.h\377\35.h\377\36.g\377\36.h" \
+  "\377\34,g\377\334\31*e\377\226\30)d\377\330\31*e\377\203\30)d\377\5\31" \
+  "*e\377\37/i\377&6m\3770\77u\3774Cw\377\2032Av\377\1""1@u\377\2162Av\377" \
+  "\2021Au\377\2020At\377\2141Au\377\10""0@u\3770@t\3770@u\377.\77t\377" \
+  "(8o\377\35-g\377\27(d\377\30)d\377\251\31*e\377\202\30)d\377\6\32+e\377" \
+  "$4l\377/>s\377.=r\377-<r\377,;q\377\211-<r\377\202,<r\377\1+<r\377\203" \
+  ",<r\377\5+;q\377,<r\377)9p\377\35.h\377\30)d\377\247\31*e\377\6\30)d" \
+  "\377\35-g\377'7n\377(8o\377'7n\377(8o\377\202'7o\377\1&6o\377\204'7o" \
+  "\377\5&6n\377'7o\377&7o\377\37/i\377\30)d\377\247\31*e\377\4\30)d\377" \
+  "\31*e\377\37""0i\377\"3l\377\205#3l\377\202\"2k\377\3!1k\377\33,g\377" \
+  "\30)d\377\251\31*e\377\4\30)d\377\33,f\377\36.h\377\35-g\377\202\36." \
+  "h\377\3\35-g\377\31*e\377\30)d\377\377\31*e\377\311\31*e\377\7\30)d\377" \
+  "\27(d\377\32+f\377$4l\377+;r\3771@u\3774Bw\377\2022Av\377\2031@u\377" \
+  "\2132Av\377\2""1Au\3772Av\377\2031Au\377\1""0At\377\2121Au\377\12""0" \
+  "@u\3771Au\3770@u\3770@t\3770@u\3771Au\377):q\377\37""0i\377\31*e\377" \
+  "\30)d\377\253\31*e\377\3\30)d\377\33,g\377(8o\377\202.=s\377\2-<r\377" \
+  ",;q\377\210-<r\377\4,<r\377-<r\377,<r\377+<r\377\203,<r\377\4+;q\377" \
+  ",<r\377(8o\377\34-g\377\202\30)d\377\246\31*e\377\11\30)d\377\35-h\377" \
+  "'7n\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\206'7o\377\3&7n\377" \
+  "\40""1j\377\30*e\377\250\31*e\377\3\30)d\377\35.h\377\"3l\377\204#3l" \
+  "\377\2\"2k\377#3l\377\202\"2k\377\2\35-h\377\30)d\377\251\31*e\377\10" \
+  "\30)d\377\32+e\377\35.h\377\36-g\377\36.h\377\35-h\377\36.g\377\33+f" \
+  "\377\202\30)d\377\377\31*e\377\306\31*e\377\202\30)d\377\6\27(d\377\34" \
+  ",f\377(8p\3771@u\3772Av\3773Bw\377\2032Av\377\1""1@u\377\2142Av\377\1" \
+  "1Au\377\2022Av\377\2021Au\377\2020At\377\2121Au\377\2""0@u\3771Au\377" \
+  "\2030@u\377\3.>t\377\40""0j\377\31*e\377\203\30)d\377\252\31*e\377\3" \
+  "\30)d\377\36.i\377,;q\377\202.=s\377\2-<r\377,;q\377\210-<r\377\4,<r" \
+  "\377-<r\377,<r\377+<r\377\203,<r\377\6+;q\377,<r\377%6m\377\31*e\377" \
+  "\30)d\377\30)e\377\246\31*e\377\11\30)d\377\35-g\377&6n\377(8o\377'7" \
+  "n\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377\"2k\377" \
+  "\31*e\377\30)d\377\247\31*e\377\2\30)d\377\32+f\377\202#3l\377\1\"2k" \
+  "\377\204#3l\377\202\"2k\377\3\37/i\377\31*e\377\30)d\377\250\31*e\377" \
+  "\10\30)d\377\31*e\377\35-g\377\36.h\377\35.h\377\36.h\377\36.g\377\34" \
+  ",g\377\202\30)d\377\377\31*e\377\303\31*e\377\203\30)d\377\4\31*e\377" \
+  "\32+f\377\40""0i\377,<r\377\2023Bw\377\2022Av\377\2021@u\377\2142Av\377" \
+  "\1""1Au\377\2022Av\377\2021Au\377\2020At\377\2121Au\377\4""0@u\3771A" \
+  "u\3770@u\3770@t\377\2020@u\377\4.>t\377'7n\377\31*e\377\30)d\377\254" \
+  "\31*e\377\3\30)d\377\31*e\377#3k\377\202.=s\377\2-<r\377,;q\377\211-" \
+  "<r\377\206,<r\377\1+;q\377\202,<r\377\1%4m\377\251\31*e\377\5\30)d\377" \
+  "\33,f\377&6m\377(8o\377'7o\377\202(8o\377\206'7o\377\1&6n\377\202'7o" \
+  "\377\1#3l\377\202\30)d\377\247\31*e\377\3\30)d\377\31*e\377\"2k\377\204" \
+  "#3l\377\7\"2k\377#3l\377\"2k\377!1j\377\40""0j\377\32+e\377\30)d\377" \
+  "\250\31*e\377\202\30)d\377\4\33,f\377\35.h\377\36.h\377\35-h\377\202" \
+  "\36.h\377\2\31*e\377\30)d\377\377\31*e\377\302\31*e\377\203\30)d\377" \
+  "\6\32+f\377\37/i\377&6n\377/>t\3774Cw\3773Bw\377\2022Av\377\2021@u\377" \
+  "\2142Av\377\1""1Au\377\2022Av\377\2021Au\377\2020At\377\2121Au\377\1" \
+  "0@u\377\2021Au\377\2030@u\377\5.>t\377(8o\377\35.h\377\27(d\377\30)d" \
+  "\377\253\31*e\377\202\30)d\377\2\34,f\377'6n\377\202.=s\377\2-<r\377" \
+  ",;q\377\210-<r\377\3,<r\377-<r\377,<r\377\202+<r\377\202,<r\377\6+;q" \
+  "\377,<r\377+;q\377\"3k\377\31)d\377\30)d\377\247\31*e\377\6\30)d\377" \
+  "\34,g\377&6m\377(8o\377'7n\377(8o\377\202'7o\377\1&6o\377\204'7o\377" \
+  "\1&6n\377\202'7o\377\3\"3l\377\31*e\377\30)d\377\247\31*e\377\5\30)d" \
+  "\377\31*e\377!1j\377#3l\377\"2k\377\202#3l\377\2\"2k\377#3l\377\202\"" \
+  "2k\377\3!1j\377\33,g\377\30)d\377\251\31*e\377\3\30*e\377\32+e\377\35" \
+  "-g\377\202\36.h\377\4\36.g\377\36.h\377\32+f\377\30)d\377\377\31*e\377" \
+  "\301\31*e\377\7\30)d\377\27(d\377\27)d\377\36/i\377&7n\377-<s\3772Av" \
+  "\377\2023Bw\377\2022Av\377\2021@u\377\2142Av\377\1""1Au\377\2022Av\377" \
+  "\2031Au\377\1""0At\377\2131Au\377\4""0@u\3771Au\3770@u\3770@t\377\202" \
+  "0@u\377\5(8o\377\37/i\377\30)e\377\30)d\377\31*d\377\253\31*e\377\5\30" \
+  ")d\377\27)d\377\40""0i\377+:p\377.=s\377\202-<r\377\1,;q\377\210-<r\377" \
+  "\4,<r\377-<r\377,<r\377+<r\377\203,<r\377\4+;q\377,<r\377*:p\377\37/" \
+  "i\377\202\30)d\377\247\31*e\377\11\30)d\377\34-g\377&6m\377(8o\377'7" \
+  "n\377'7o\377(8o\377'7o\377&6o\377\207'7o\377\3\"3l\377\32+e\377\30)d" \
+  "\377\247\31*e\377\5\30)d\377\31*e\377\37/i\377#3k\377\"2k\377\204#3l" \
+  "\377\203\"2k\377\1\34-g\377\202\30)d\377\251\31*e\377\3\30)d\377\35-" \
+  "g\377\36.h\377\202\35-g\377\2\36.h\377\34,g\377\226\31*e\377\1\30)d\377" \
+  "\377\31*e\377\251\31*e\377\1\31)d\377\202\30)d\377\6\32*e\377$5m\377" \
+  "/>t\3771@v\3772Av\3773Bw\377\2032Av\377\2021@u\377\2172Av\377\2021Au" \
+  "\377\2030At\377\2121Au\377\1""0@u\377\2021Au\377\1""0@t\377\2020@u\377" \
+  "\3,<r\377\35.h\377\31*e\377\202\30)d\377\254\31*e\377\6\30)d\377\30*" \
+  "d\377%5m\377-<r\377.=s\377-<r\377\202,;q\377\207-<r\377\1,<r\377\202" \
+  "-<r\377\2,<r\377+<r\377\203,<r\377\6,;q\377,<r\377(9p\377\33,g\377\30" \
+  ")e\377\30)d\377\247\31*e\377\11\30)d\377\34-g\377&6n\377(8o\377'7n\377" \
+  "'7o\377(8o\377'7o\377&6o\377\206'7o\377\4&6o\377$4m\377\32+e\377\30)" \
+  "d\377\250\31*e\377\2\31*d\377\35.h\377\207#3l\377\202\"2k\377\3\36.h" \
+  "\377\30*e\377\30)d\377\251\31*e\377\4\30)d\377\33,g\377\36.h\377\35-" \
+  "g\377\202\36.h\377\3\35-g\377\31*e\377\30)d\377\225\31*e\377\3\35.h\377" \
+  "\32+e\377\31*e\377\203\30)d\377\377\31*e\377\237\31*e\377\204\30)d\377" \
+  "\6\31*e\377\32+f\377!1j\377,;q\3773Bx\3773Bw\377\2022Av\377\2031@u\377" \
+  "\2202Av\377\2021Au\377\2020At\377\2131Au\377\4""0@u\3771Au\3770@u\377" \
+  "0@t\377\2020@u\377\3/\77t\377-=r\377!1k\377\202\30)d\377\255\31*e\377" \
+  "\5\30)d\377\30)e\377\33,f\377(7o\377.=s\377\202-<r\377\1,;q\377\210-" \
+  "<r\377\3,<r\377-<r\377,<r\377\202+<r\377\202,<r\377\6+;q\377,<r\377+" \
+  ";q\377'8o\377\32+f\377\30)d\377\250\31*e\377\5\30)d\377\33,f\377&6m\377" \
+  "(8o\377'7o\377\202(8o\377\207'7o\377\5&6n\377'7o\377%6n\377\32*f\377" \
+  "\30)d\377\247\31*e\377\5\30)e\377\30)d\377\32+f\377#2l\377#3k\377\203" \
+  "#3l\377\5\"2k\377#3l\377\"2k\377\"1j\377\37""0i\377\252\31*e\377\12\30" \
+  ")e\377\30)d\377\32+f\377\36.h\377\35-h\377\36.h\377\35-g\377\35-h\377" \
+  "\33+f\377\30)d\377\226\31*e\377\5""4Cx\377.>s\377&6n\377\40""0i\377\34" \
+  "-g\377\203\30)d\377\377\31*e\377\233\31*e\377\203\30)d\377\7\31*e\377" \
+  "\36.h\377\"2k\377):p\3771@u\3774Cx\3773Bw\377\2022Av\377\2021@u\377\216" \
+  "2Av\377\2""1Au\3772Av\377\2031Au\377\2020At\377\2131Au\377\1""0@u\377" \
+  "\2021Au\377\2040@u\377\3+;q\377#3l\377\31*e\377\202\30)d\377\255\31*" \
+  "e\377\6\30)d\377\31*e\377\37""0i\377,;q\377.=s\377-<r\377\202,;q\377" \
+  "\210-<r\377\4,<r\377-<r\377,<r\377+<r\377\203,<r\377\6+;q\377,<r\377" \
+  "+;q\377$5m\377\31*e\377\30)d\377\250\31*e\377\6\30)d\377\34,g\377&6m" \
+  "\377(8o\377'7n\377(8o\377\202'7o\377\1&6o\377\205'7o\377\5&6n\377'7o" \
+  "\377$5m\377\32+f\377\30)d\377\250\31*e\377\5\30)d\377\33+f\377\"3k\377" \
+  "#3l\377\"2l\377\202#3l\377\7\"2k\377#3l\377\"2k\377!1j\377\40""1j\377" \
+  "\32+f\377\30)d\377\251\31*e\377\12\30)d\377\31+e\377\35-h\377\35-g\377" \
+  "\36.h\377\35-g\377\36.h\377\34-g\377\31*e\377\30)d\377\226\31*e\377\12" \
+  "2Av\3773Av\3774Cw\3772Av\377.>t\377*9p\377#3l\377\34-g\377\27(c\377\27" \
+  ")d\377\202\30)d\377\377\31*e\377\224\31*e\377\202\30)d\377\6\27(c\377" \
+  "\30*e\377\37/i\377&6n\377,;r\3770\77u\377\2023Bw\377\2022Av\377\2031" \
+  "@u\377\2212Av\377\2021Au\377\2030At\377\2131Au\377\4""0@u\3771Au\377" \
+  "0@u\3770@t\377\2020@u\377\3,<r\377!2k\377\33,f\377\202\30)d\377\256\31" \
+  "*e\377\5\30)d\377\33+f\377&6m\377-=r\377.=s\377\212-<r\377\1,<r\377\202" \
+  "-<r\377\2,<r\377+<r\377\203,<r\377\6+;q\377,<r\377*;q\377\40""1i\377" \
+  "\31*d\377\30)d\377\250\31*e\377\11\30)d\377\35-g\377&6m\377(8o\377'7" \
+  "n\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377$4m\377\33" \
+  ",f\377\30)d\377\250\31*e\377\5\30)d\377\32+e\377!1j\377#3l\377\"2k\377" \
+  "\202#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\"2k\377\33,g\377\202\30)" \
+  "d\377\250\31*e\377\4\30)d\377\31*e\377\34-g\377\36.g\377\203\36.h\377" \
+  "\3\35-g\377\31*e\377\30)d\377\227\31*e\377\1""1@u\377\2032Av\377\202" \
+  "3Bw\377\5""2Av\3771@u\377.=s\377%4l\377\33,f\377\203\30)d\377\377\31" \
+  "*e\377\217\31*e\377\203\30)d\377\7\30)e\377\37""0i\377)9p\3770\77u\377" \
+  "1@v\3772Av\3773Bw\377\2032Av\377\2031@u\377\2162Av\377\2""1Au\3772Av" \
+  "\377\2031Au\377\2020At\377\2141Au\377\1""0@u\377\2021Au\377\1""0@t\377" \
+  "\2020@u\377\5.>s\377!1j\377\32*e\377\30*e\377\30)d\377\257\31*e\377\3" \
+  "\30)d\377\35.h\377+:q\377\202.=s\377\202-<r\377\1,;q\377\211-<r\377\206" \
+  ",<r\377\6+;q\377,<r\377*:q\377\34-g\377\30*d\377\30)d\377\250\31*e\377" \
+  "\11\30)d\377\35-g\377&6n\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377" \
+  "\207'7o\377\3%5n\377\33,f\377\30)d\377\250\31*e\377\5\30)d\377\31*e\377" \
+  "\40""0j\377#3l\377\"2k\377\204#3l\377\4\"2k\377!1j\377\"2k\377\35-g\377" \
+  "\202\30)d\377\252\31*e\377\10\32+f\377\36.h\377\36.g\377\36.h\377\35" \
+  "-g\377\36.h\377\32+e\377\30)d\377\230\31*e\377\2042Av\377\2021@u\377" \
+  "\2022Av\377\7""3Bv\3773Bw\3774Cx\377/>t\377%6n\377\35.h\377\32+e\377" \
+  "\202\31*e\377\203\30)d\377\377\31*e\377\203\31*e\377\204\30)d\377\6\31" \
+  "*e\377\32+e\377\33,f\377\40""1j\377*9p\3773Av\377\2023Bw\377\2022Av\377" \
+  "\2031@u\377\2172Av\377\2""1Au\3772Av\377\2031Au\377\2020At\377\2151A" \
+  "u\377\4""0@u\3771Au\3770@u\3770@t\377\2020@u\377\3/\77t\377-=s\377\"" \
+  "3l\377\202\30)d\377\1\30*e\377\256\31*e\377\202\30)d\377\6\31*e\377#" \
+  "3k\377.=t\377.=s\377-<r\377,;q\377\210-<r\377\1,<r\377\202-<r\377\2," \
+  "<r\377+<r\377\203,<r\377\6+;q\377,<r\377+;q\377(8o\377\32+f\377\30)d" \
+  "\377\250\31*e\377\6\30)d\377\31*d\377\34-g\377&7n\377(8o\377'7o\377\202" \
+  "(8o\377\207'7o\377\5&6n\377'7o\377&6n\377\34,g\377\30)d\377\250\31*e" \
+  "\377\5\30)d\377\31*e\377\35.h\377#3l\377\"2k\377\203#3l\377\2\"2k\377" \
+  "#3l\377\202\"2k\377\2\36/i\377\30)d\377\252\31*e\377\4\30)d\377\31*e" \
+  "\377\35.h\377\36-g\377\203\36.h\377\1\34,f\377\232\31*e\377\2062Av\377" \
+  "\2031@u\377\2022Av\377\11""3Bv\3774Cw\3774Cx\3770\77u\377)9p\377#3l\377" \
+  "\37""0i\377\34,g\377\30)e\377\204\30)d\377\373\31*e\377\204\30)d\377" \
+  "\10\32+f\377\35.h\377\40""1j\377&5m\377,<r\3772Av\3774Cx\3773Bw\377\203" \
+  "2Av\377\2021@u\377\2232Av\377\2021Au\377\2030At\377\2141Au\377\1""0@" \
+  "u\377\2021Au\377\2030@u\377\4/\77t\377*:q\377\"3l\377\31*e\377\202\30" \
+  ")d\377\257\31*e\377\202\30)d\377\3\35.h\377)8o\377.=s\377\202-<r\377" \
+  "\202,;q\377\207-<r\377\2,<r\377-<r\377\202,<r\377\1+<r\377\205,<r\377" \
+  "\4+;q\377#4l\377\31*d\377\30)d\377\250\31*e\377\202\30)d\377\5\35.g\377" \
+  "'7n\377(8o\377'7n\377(8o\377\202'7o\377\1&6o\377\205'7o\377\5&6n\377" \
+  "'7o\377%5m\377\34,g\377\30)d\377\250\31*e\377\202\30)d\377\3\35-g\377" \
+  "#3l\377#3k\377\203#3l\377\5\"2k\377#3l\377\"2k\377\"1j\377\37""0i\377" \
+  "\253\31*e\377\12\30)d\377\30)e\377\35-g\377\36.h\377\35.h\377\36.h\377" \
+  "\35.h\377\34-g\377\31*e\377\30)d\377\231\31*e\377\2102Av\377\2041@u\377" \
+  "\2022Av\377\2033Bw\377\10""1@v\377.=s\377+:q\377&6n\377\40""0j\377\32" \
+  "+f\377\27(c\377\27(d\377\202\30)d\377\365\31*e\377\202\30)d\377\202\27" \
+  "(d\377\10\35.g\377\"2k\377(8p\377,;r\377/>t\3773Bw\3774Bw\3773Bw\377" \
+  "\2032Av\377\2031@u\377\2172Av\377\1""1Au\377\2022Av\377\2031Au\377\202" \
+  "0At\377\2151Au\377\1""0@u\377\2021Au\377\2""0@u\3770@t\377\2020@u\377" \
+  "\3(9o\377\40""1i\377\32+f\377\202\30)d\377\260\31*e\377\5\30)d\377\31" \
+  "*d\377#3l\377,;q\377.=s\377\202-<r\377\1,;q\377\212-<r\377\202,<r\377" \
+  "\1+<r\377\203,<r\377\4+;q\377,<r\377*:q\377\37""0i\377\202\30)d\377\250" \
+  "\31*e\377\202\30)d\377\10\37/i\377'7n\377(8o\377'7n\377'7o\377(8o\377" \
+  "'7o\377&6o\377\205'7o\377\5&6n\377'7o\377%5m\377\34,g\377\30)d\377\251" \
+  "\31*e\377\5\30)d\377\34-g\377#3k\377#3l\377\"2l\377\202#3l\377\3\"2k" \
+  "\377#3l\377\"2k\377\202!1j\377\2\32+e\377\30)d\377\251\31*e\377\12\30" \
+  ")e\377\31*d\377\34,f\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377" \
+  "\32+f\377\30)d\377\232\31*e\377\2142Av\377\2021@u\377\2042Av\377\202" \
+  "3Bw\377\7""2Av\3771Av\3771@u\377.=s\377&6n\377\37/i\377\31)d\377\204" \
+  "\30)d\377\355\31*e\377\203\30)d\377\7\27(d\377\33+f\377\"2k\377*9p\377" \
+  "0\77u\3771@v\3772Av\377\2023Bw\377\2042Av\377\2031@u\377\2232Av\377\203" \
+  "1Au\377\2030At\377\2141Au\377\1""0@u\377\2021Au\377\2030@u\377\4""0@" \
+  "v\377(8p\377\34-g\377\31*e\377\202\30)d\377\260\31*e\377\7\30)e\377\30" \
+  ")d\377\34-g\377*:p\377-<r\377.=s\377-<r\377\202,;q\377\210-<r\377\1," \
+  "<r\377\202-<r\377\202+<r\377\203,<r\377\4+;q\377,<r\377(8p\377\32+f\377" \
+  "\202\30)d\377\250\31*e\377\202\30)d\377\10\37""0i\377'7n\377(8o\377'" \
+  "7n\377'7o\377(8o\377'7o\377&6o\377\207'7o\377\3%5n\377\34,g\377\30)d" \
+  "\377\251\31*e\377\5\30)d\377\33,f\377\"2k\377#3l\377\"2k\377\202#3l\377" \
+  "\6\"2k\377#3l\377\"2k\377!1j\377\"2k\377\33,f\377\202\30)d\377\251\31" \
+  "*e\377\10\30)d\377\33,f\377\35.h\377\35-g\377\36.h\377\35-h\377\36.h" \
+  "\377\33,g\377\202\30)d\377\232\31*e\377\2212Av\377\2031@u\377\2032Av" \
+  "\377\1""3Bv\377\2033Bw\377\5.<s\377'6n\377\40""0j\377\33,f\377\32+e\377" \
+  "\202\31*e\377\205\30)d\377\335\31*e\377\204\30)d\377\11\30)e\377\31*" \
+  "e\377\32*e\377\32+f\377\34-g\377#3k\377*9p\3771@u\3774Cw\377\2023Bw\377" \
+  "\2032Av\377\2031@u\377\2222Av\377\1""1Au\377\2022Av\377\2031Au\377\202" \
+  "0At\377\2151Au\377\1""0@u\377\2031Au\377\1""0@t\377\2020@u\377\4/\77" \
+  "t\377.>t\377(8o\377\33,f\377\202\30)d\377\261\31*e\377\202\30)d\377\5" \
+  "\31*e\377\"2k\377-<r\377.=s\377-<r\377\202,;q\377\213-<r\377\2,<r\377" \
+  "+<r\377\206,<r\377\3$4m\377\31*d\377\30)d\377\251\31*e\377\6\30)d\377" \
+  "\31*e\377\36/h\377(7o\377(8o\377'7o\377\202(8o\377\207'7o\377\5&6n\377" \
+  "'7o\377&6n\377\34,g\377\30)d\377\251\31*e\377\3\30)d\377\32+f\377!1k" \
+  "\377\206#3l\377\5\"2k\377!1j\377\"2k\377\34-g\377\30)d\377\252\31*e\377" \
+  "\3\30)d\377\31*e\377\35-g\377\202\36.h\377\4\35-g\377\36.h\377\35-h\377" \
+  "\30)d\377\234\31*e\377\2022Av\377\1""1Au\377\2212Av\377\2041@u\377\203" \
+  "2Av\377\13""3Bv\3774Bw\3774Cx\3773Bw\377.>t\377*9q\377%5m\377!2j\377" \
+  "\37/i\377\34-g\377\32+e\377\206\30)d\377\323\31*e\377\204\30)d\377\14" \
+  "\27)d\377\30)d\377\33,f\377\35.h\377\37""0i\377#3l\377'7o\377,;r\377" \
+  "1\77v\3775Cx\3774Cw\3773Bw\377\2042Av\377\2031@u\377\2222Av\377\1""1" \
+  "Au\377\2032Av\377\2031Au\377\2020At\377\2161Au\377\4""0@u\3771Au\377" \
+  "0@u\3770@t\377\2020@u\377\5/\77t\377+;q\377%5m\377\34-g\377\27(d\377" \
+  "\202\30)d\377\261\31*e\377\202\30)d\377\3\35.h\377(7n\377/>s\377\202" \
+  "-<r\377\1,;q\377\211-<r\377\2,<r\377-<r\377\202,<r\377\1+<r\377\203," \
+  "<r\377\6+;q\377,<r\377*:q\377!1j\377\30)d\377\30)e\377\251\31*e\377\3" \
+  "\30)d\377\31*e\377\40""0i\377\202(8o\377\2'7n\377(8o\377\202'7o\377\1" \
+  "&6o\377\205'7o\377\5&6n\377'7o\377%5m\377\34,g\377\30)d\377\251\31*e" \
+  "\377\5\30)d\377\31*e\377\40""0j\377#3l\377\"2k\377\203#3l\377\2\"2k\377" \
+  "#3l\377\202\"2k\377\2\35-h\377\30)d\377\253\31*e\377\3\30)d\377\34,g" \
+  "\377\36.h\377\202\35-g\377\4\36.h\377\35-g\377\31*e\377\30)d\377\234" \
+  "\31*e\377\2021Au\377\2022Av\377\1""1Au\377\2232Av\377\2041@u\377\203" \
+  "2Av\377\2023Bw\377\12""4Bw\3773Bw\3771@u\377.>t\377,<r\377*9p\377&6n" \
+  "\377\"2k\377\36/h\377\32+e\377\202\27(c\377\1\27(d\377\203\30)d\377\310" \
+  "\31*e\377\204\30)d\377\14\27(d\377\27(c\377\30)d\377\33-f\377\37""0i" \
+  "\377#4l\377(8o\377+:q\377-<s\377/\77t\3772Av\3774Cw\377\2023Bw\377\204" \
+  "2Av\377\2041@u\377\2222Av\377\1""1Au\377\2032Av\377\2031Au\377\2030A" \
+  "t\377\2151Au\377\1""0@u\377\2031Au\377\1""0@t\377\2030@u\377\3(8o\377" \
+  "\40""1j\377\33+f\377\203\30)d\377\262\31*e\377\5\30)d\377\32+e\377%4" \
+  "l\377,;r\377.=s\377\202-<r\377\1,;q\377\211-<r\377\3,<r\377-<r\377,<" \
+  "r\377\202+<r\377\202,<r\377\5+;q\377+;r\377-=r\377'7n\377\35-g\377\202" \
+  "\30)d\377\251\31*e\377\12\30)d\377\31*e\377\"2k\377(8n\377(8o\377'7n" \
+  "\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\5&6n\377'7o\377$5m\377\33" \
+  ",f\377\30)d\377\251\31*e\377\5\30)d\377\31)d\377\37""0j\377#3l\377\"" \
+  "2k\377\203#3l\377\5\"2k\377#3l\377\"2k\377\"2j\377\36/h\377\254\31*e" \
+  "\377\4\30)d\377\33,g\377\36.h\377\35-g\377\202\36.h\377\3\35-g\377\32" \
+  "+f\377\30)d\377\235\31*e\377\1""0At\377\2031Au\377\2032Av\377\1""1Au" \
+  "\377\2242Av\377\2031@u\377\2042Av\377\2043Bw\377\2022Av\377\11""1@v\377" \
+  "1@u\3770\77t\377+;q\377&6n\377\"2k\377\35.h\377\31*e\377\27(d\377\206" \
+  "\30)d\377\273\31*e\377\205\30)d\377\202\27)d\377\12\33+f\377\40""0i\377" \
+  "#5l\377(8p\377-<r\3770@u\3771@u\3771Av\3772Av\3773Bv\377\2033Bw\377\204" \
+  "2Av\377\2051@u\377\2232Av\377\1""1Au\377\2022Av\377\2041Au\377\2020A" \
+  "t\377\2171Au\377\4""0@u\3771Au\3770@u\3770@t\377\2020@u\377\4/\77t\377" \
+  "&6m\377\33,g\377\31*e\377\203\30)d\377\262\31*e\377\202\30)d\377\4\36" \
+  "/h\377+:q\377-<r\377.=s\377\202-<r\377\1,;q\377\213-<r\377\2,<r\377+" \
+  "<r\377\203,<r\377\1+;q\377\202,<r\377\2#3k\377\31*e\377\202\30)d\377" \
+  "\251\31*e\377\3\30)d\377\31*e\377#3k\377\202(8o\377\1'7n\377\202(8o\377" \
+  "\2'7o\377&6o\377\207'7o\377\3%5m\377\32,f\377\30)d\377\251\31*e\377\5" \
+  "\30)d\377\30)e\377\40""0i\377#2l\377#3k\377\203#3l\377\7\"2k\377#3l\377" \
+  "\"2k\377!2k\377\37""0i\377\31*e\377\30)d\377\252\31*e\377\4\30)d\377" \
+  "\32+f\377\35.h\377\36.g\377\202\36.h\377\2\35.h\377\34,g\377\202\30)" \
+  "d\377\235\31*e\377\2041Au\377\2020At\377\2031Au\377\2032Av\377\1""1A" \
+  "u\377\2262Av\377\2051@u\377\2042Av\377\2043Bw\377\10""4Cw\3771@v\377" \
+  "-<s\377)8p\377%5m\377!1k\377\36.i\377\33,f\377\202\32+f\377\1\32+e\377" \
+  "\204\31*e\377\221\30)d\377\214\31*e\377\217\30)d\377\1\30*d\377\203\31" \
+  "*e\377\2\32*e\377\32+e\377\202\32+f\377\10\34,g\377\37""0i\377#3l\377" \
+  "&6n\377+:q\377/>t\3773Bv\3774Cw\377\2043Bw\377\2042Av\377\2051@u\377" \
+  "\2252Av\377\1""1Au\377\2032Av\377\2031Au\377\2030At\377\2171Au\377\1" \
+  "0@u\377\2021Au\377\3""0@u\3770@t\3770@u\377\202/\77u\377\4/\77t\377-" \
+  "=r\377#3l\377\31*e\377\202\30)d\377\264\31*e\377\10\30)d\377\31*d\377" \
+  "\32+f\377%5l\377/>s\377.=s\377-<r\377,;q\377\211-<r\377\1,<r\377\202" \
+  "-<r\377\1,<r\377\202+<r\377\202,<r\377\1+;q\377\202,<r\377\3*:p\377\37" \
+  "0i\377\30)d\377\253\31*e\377\5\30)d\377\31*e\377#3l\377(8o\377'7n\377" \
+  "\202(8o\377\2'7o\377&6o\377\205'7o\377\1&6n\377\202'7o\377\3&6n\377\32" \
+  "+f\377\30)d\377\251\31*e\377\5\30)d\377\31*d\377\36.h\377\"2l\377\"2" \
+  "k\377\205#3l\377\202\"2k\377\3!1j\377\31*e\377\30)d\377\252\31*e\377" \
+  "\12\30)d\377\31*e\377\35-h\377\35-g\377\36.h\377\35-g\377\36.h\377\35" \
+  "-g\377\31*e\377\30)d\377\236\31*e\377\2061Au\377\2030At\377\2031Au\377" \
+  "\2342Av\377\2041@u\377\2062Av\377\2023Bw\377\2024Cw\377\2024Cx\377\22" \
+  "1Av\377/>t\377,<s\377*:q\377(8p\377&5n\377$4l\377\"3k\377!1j\377\40""0" \
+  "i\377\37/i\377\36/h\377\35.h\377\35-g\377\34,g\377\33,f\377\32+f\377" \
+  "\32+e\377\202\31*e\377\1\30*d\377\202\30)d\377\205\27(d\377\203\27)d" \
+  "\377\205\27(d\377\202\30)d\377\1\31)d\377\202\31*e\377\22\32+e\377\33" \
+  "+f\377\33,f\377\34-g\377\35-g\377\35.h\377\36/h\377\37""0i\377\40""1" \
+  "j\377!1j\377#3k\377%5m\377'7n\377)9p\377,;r\377-=s\3770\77u\3772Aw\377" \
+  "\2024Cx\377\4""4Cw\3774Bw\3773Bw\3773Av\377\2052Av\377\2051@u\377\227" \
+  "2Av\377\1""1Au\377\2032Av\377\2041Au\377\2020At\377\2201Au\377\1""0@" \
+  "u\377\2021Au\377\2""0@u\3770@t\377\2030@u\377\3,<r\377'7o\377\37""0i" \
+  "\377\203\30)d\377\264\31*e\377\6\30*e\377\30)d\377\31*e\377\40""1j\377" \
+  "+;q\377.=s\377\202-<r\377\202,;q\377\210-<r\377\2,<r\377-<r\377\202," \
+  "<r\377\1+<r\377\203,<r\377\1+;q\377\202,<r\377\4&7n\377\34,g\377\30)" \
+  "d\377\30)e\377\251\31*e\377\202\30)d\377\10\33,f\377$4l\377(8o\377'7" \
+  "n\377'7o\377(8o\377'7o\377&6o\377\205'7o\377\1&6n\377\202'7o\377\3#4" \
+  "m\377\32+f\377\30)d\377\252\31*e\377\3\30)d\377\34-g\377\"3k\377\205" \
+  "#3l\377\203\"2k\377\3!1j\377\33+e\377\30)d\377\252\31*e\377\12\30)d\377" \
+  "\31*e\377\34,g\377\35.g\377\36.h\377\35.h\377\36.h\377\35-g\377\31+e" \
+  "\377\30)d\377\237\31*e\377\2101Au\377\2040At\377\2031Au\377\2042Av\377" \
+  "\1""1Au\377\2302Av\377\2061@u\377\2072Av\377\2053Bw\377\11""4Bw\3774" \
+  "Cw\3773Bw\3772Av\3771@u\3770\77u\377/\77t\377/>t\377.=s\377\202-<s\377" \
+  "\202,;r\377\202+:q\377\202*:q\377\5*9p\377)9p\377)8o\377)8p\377)9p\377" \
+  "\202(8p\377\203)8p\377\202)9p\377\1*9p\377\202*:q\377\12+:q\377+;q\377" \
+  ",;r\377,<r\377-<r\377-=s\377.>s\377/>t\3770\77t\3770@u\377\2022Av\377" \
+  "\3""4Bw\3774Cw\3774Bw\377\2043Bw\377\1""3Bv\377\2062Av\377\2061@u\377" \
+  "\2352Av\377\2041Au\377\2030At\377\2201Au\377\1""0@u\377\2021Au\377\10" \
+  "0@u\3770@t\3770@u\3771Au\377/\77t\377'8o\377!1j\377\34,g\377\203\30)" \
+  "d\377\265\31*e\377\6\30)d\377\30(c\377\36/h\377(7o\377-<r\377.=s\377" \
+  "\202-<r\377\1,;q\377\211-<r\377\2,<r\377-<r\377\202,<r\377\1+<r\377\205" \
+  ",<r\377\4+;q\377!1j\377\31*e\377\30)d\377\252\31*e\377\202\30)d\377\10" \
+  "\34-g\377%6m\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\210'7o\377" \
+  "\3#3l\377\32+e\377\30)d\377\252\31*e\377\5\30)d\377\34-g\377\"2k\377" \
+  "#3l\377\"2k\377\203#3l\377\2\"2k\377#3l\377\202!1j\377\2\33,f\377\30" \
+  ")d\377\253\31*e\377\11\30)d\377\33,f\377\35.h\377\36.g\377\36.h\377\36" \
+  "-g\377\35.h\377\32+e\377\30)d\377\240\31*e\377\2141Au\377\2030At\377" \
+  "\2041Au\377\2032Av\377\1""1Au\377\2332Av\377\2061@u\377\2132Av\377\245" \
+  "3Bw\377\2122Av\377\2061@u\377\2402Av\377\2031Au\377\2040At\377\2241A" \
+  "u\377\2030@u\377\5""1Au\377-=s\377\"3k\377\33,f\377\31*e\377\203\30)" \
+  "d\377\266\31*e\377\5\30)d\377\31*e\377%6n\377-<r\377.=s\377\202-<r\377" \
+  "\202,;q\377\211-<r\377\2,<r\377-<r\377\202,<r\377\1+<r\377\203,<r\377" \
+  "\6+;q\377,<r\377(9p\377\34-g\377\31*e\377\30)d\377\253\31*e\377\11\30" \
+  ")d\377\34-g\377'7n\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\206" \
+  "'7o\377\5&6n\377'7o\377#4l\377\31*e\377\30)d\377\252\31*e\377\5\30)d" \
+  "\377\33,f\377\"2k\377#3l\377\"2k\377\203#3l\377\6\"2k\377#3l\377\"2k" \
+  "\377!1k\377\34,g\377\30)d\377\253\31*e\377\10\30)d\377\31*e\377\36.h" \
+  "\377\36.g\377\35-h\377\35-g\377\36.h\377\33,g\377\242\31*e\377\2221A" \
+  "u\377\2030At\377\2041Au\377\2042Av\377\1""1Au\377\2442Av\377\2461@u\377" \
+  "\2452Av\377\1""1Au\377\2032Av\377\2041Au\377\2040At\377\2221Au\377\1" \
+  "0@u\377\2021Au\377\11""0@u\3770@t\3770@u\377/\77u\3770@u\377/\77t\377" \
+  ".>s\377(9o\377\35.h\377\203\30)d\377\267\31*e\377\202\30)d\377\4\31*" \
+  "e\377\36/i\377,:q\377.=s\377\202-<r\377\1,;q\377\213-<r\377\202,<r\377" \
+  "\1+<r\377\206,<r\377\4+;q\377$5m\377\31*d\377\30)d\377\253\31*e\377\3" \
+  "\30)d\377\31*d\377\35.g\377\202(8o\377\1'7n\377\202(8o\377\2'7o\377&" \
+  "6o\377\205'7o\377\1&6n\377\202'7o\377\3#3m\377\31*d\377\30)d\377\251" \
+  "\31*e\377\202\30)d\377\1\33+f\377\202\"2k\377\203#3l\377\1\"2k\377\202" \
+  "#3l\377\5\"2k\377!1j\377\36.h\377\30)d\377\30)e\377\252\31*e\377\12\30" \
+  ")d\377\30*e\377\36.h\377\35-g\377\36.h\377\35.h\377\36.h\377\34-g\377" \
+  "\31*e\377\30)d\377\241\31*e\377\2""1Au\3770@u\377\2231Au\377\2040At\377" \
+  "\2041Au\377\2032Av\377\1""1Au\377\3502Av\377\1""1Au\377\2042Av\377\204" \
+  "1Au\377\2030At\377\2231Au\377\1""0@u\377\2031Au\377\1""0@t\377\2030@" \
+  "u\377\6""0@t\377,<r\377(8o\377!2k\377\32+f\377\27(c\377\202\30)d\377" \
+  "\270\31*e\377\7\30)d\377\31*e\377\36.h\377'7n\377/=s\377.=s\377-<r\377" \
+  "\202,;q\377\211-<r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\202,<r\377" \
+  "\5+;r\377,<q\377,<r\377(8o\377\36/i\377\202\30)d\377\253\31*e\377\12" \
+  "\30)d\377\31*e\377\40""0i\377(8o\377'8o\377'7n\377'7o\377(8o\377'7o\377" \
+  "&6o\377\205'7o\377\4&6n\377'7o\377&7n\377!2k\377\202\30)d\377\252\31" \
+  "*e\377\3\30)d\377\32+f\377!1k\377\206#3l\377\203\"2k\377\3\36/h\377\30" \
+  ")e\377\30)d\377\252\31*e\377\4\30)d\377\31*e\377\35-g\377\36-g\377\202" \
+  "\36.h\377\4\36-g\377\35.h\377\32+e\377\30)d\377\242\31*e\377\1""0@u\377" \
+  "\2031Au\377\1""0@u\377\2231Au\377\2050At\377\2031Au\377\2052Av\377\1" \
+  "1Au\377\3362Av\377\1""1Au\377\2052Av\377\2051Au\377\2030At\377\2231A" \
+  "u\377\1""0@u\377\2031Au\377\2""0@u\3770@t\377\2020@u\377\5""1Au\377-" \
+  "=r\377&6n\377\40""1j\377\34,g\377\203\30)d\377\271\31*e\377\202\30)d" \
+  "\377\4\34,g\377&5m\377,;r\377.=s\377\203-<r\377\1,;q\377\211-<r\377\2" \
+  ",<r\377-<r\377\202,<r\377\1+<r\377\203,<r\377\1+;q\377\202,<r\377\3#" \
+  "4k\377\32+f\377\30)d\377\254\31*e\377\6\30)d\377\31*e\377\"2k\377(8o" \
+  "\377'7n\377'7o\377\202(8o\377\2'7o\377&6o\377\210'7o\377\3\40""0j\377" \
+  "\31*e\377\30)d\377\252\31*e\377\5\30)d\377\31+e\377\40""1k\377#3l\377" \
+  "\"2k\377\203#3l\377\2\"2k\377#3l\377\202\"2k\377\3\37/i\377\31*e\377" \
+  "\30)d\377\252\31*e\377\12\30)d\377\30)e\377\33,f\377\35-g\377\35.h\377" \
+  "\36.h\377\35-g\377\36.h\377\32+f\377\30)d\377\243\31*e\377\2020@u\377" \
+  "\2""0@t\3770@u\377\2031Au\377\1""0@u\377\2241Au\377\2040At\377\2051A" \
+  "u\377\2052Av\377\1""1Au\377\3322Av\377\2061Au\377\2040At\377\2241Au\377" \
+  "\1""0@u\377\2021Au\377\2050@u\377\5/\77s\377&6n\377\36/h\377\32+e\377" \
+  "\31*e\377\203\30)d\377\1\30*e\377\270\31*e\377\4\31)d\377\30)d\377\30" \
+  "*d\377$4l\377\202-<r\377\1.=s\377\202-<r\377\202,;q\377\213-<r\377\1" \
+  ",<r\377\202+<r\377\203,<r\377\5+;q\377,<r\377*:p\377\35.h\377\31*e\377" \
+  "\202\30)d\377\253\31*e\377\3\30)d\377\31*e\377$4l\377\202(8o\377\2'7" \
+  "o\377(8o\377\202'7o\377\1&6o\377\206'7o\377\3&6n\377'7o\377\37""0i\377" \
+  "\202\30)d\377\252\31*e\377\5\30)d\377\30*e\377!1j\377#3l\377#3k\377\203" \
+  "#3l\377\2\"2k\377#3l\377\202\"2k\377\3\37/i\377\31*e\377\30)d\377\254" \
+  "\31*e\377\1\32+f\377\203\36.h\377\5\35-g\377\36.h\377\33,f\377\30)e\377" \
+  "\30)d\377\243\31*e\377\4#3l\377+;q\377.>t\377/\77t\377\2060@u\377\202" \
+  "1Au\377\1""0@u\377\2271Au\377\2050At\377\2061Au\377\2062Av\377\1""1A" \
+  "u\377\2762Av\377\1""1Au\377\2072Av\377\2051Au\377\2050At\377\2271Au\377" \
+  "\1""0@u\377\2031Au\377\5""0@u\3770@t\3770@u\377/\77u\3770@u\377\202/" \
+  "\77t\377\3-=s\377'7o\377\36/i\377\203\30)d\377\1\30)e\377\273\31*e\377" \
+  "\202\30)d\377\4\31*e\377\37/i\377,;q\377.=s\377\202-<r\377\202,;q\377" \
+  "\211-<r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\202,<r\377\1+;q\377" \
+  "\202,<r\377\4+;q\377%5m\377\31*e\377\30)d\377\254\31*e\377\202\30)d\377" \
+  "\10\32+e\377&6n\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\205'7o" \
+  "\377\6&7o\377&6n\377'7o\377&6n\377\36.i\377\30)d\377\252\31*e\377\202" \
+  "\30)d\377\4\31*e\377!1j\377#3l\377\"2k\377\205#3l\377\202\"2k\377\3\40" \
+  "0j\377\32*e\377\30)d\377\253\31*e\377\10\30)d\377\31*e\377\35.h\377\36" \
+  "-g\377\36.h\377\36.g\377\36.h\377\34,g\377\246\31*e\377\7\30)d\377\27" \
+  "(d\377\33,f\377\"2k\377(8o\377+;q\377.>t\377\2040@u\377\1""0@t\377\235" \
+  "1Au\377\2050At\377\2071Au\377\2072Av\377\1""1Au\377\2602Av\377\1""1A" \
+  "u\377\2072Av\377\2071Au\377\2050At\377\2311Au\377\1""0@u\377\2031Au\377" \
+  "\2060@u\377\6-=r\377*:p\377%6m\377\36/i\377\30)d\377\27(d\377\202\30" \
+  ")d\377\274\31*e\377\202\30)d\377\3\31*e\377\36.h\377'7n\377\202.=s\377" \
+  "\202-<r\377\1,;q\377\214-<r\377\1,<r\377\202+<r\377\203,<r\377\1+;q\377" \
+  "\202,<r\377\2(8o\377\37""0i\377\202\30)d\377\254\31*e\377\202\30)d\377" \
+  "\10\35.h\377'7n\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\210'7o" \
+  "\377\3%6n\377\35.h\377\30)d\377\253\31*e\377\5\30)d\377\31*e\377\37""0" \
+  "j\377#3l\377\"2k\377\203#3l\377\2\"2k\377#3l\377\202\"2k\377\3!1j\377" \
+  "\32+e\377\30)d\377\253\31*e\377\5\30)d\377\31*e\377\35-g\377\36.h\377" \
+  "\35.h\377\202\36.h\377\3\35-g\377\31*e\377\30)d\377\246\31*e\377\204" \
+  "\30)d\377\6\33,f\377\36/h\377\"3k\377(8o\377.>s\3771Au\377\2020@u\377" \
+  "\2""0@t\3770@u\377\2041Au\377\1""0@u\377\2321Au\377\2070At\377\2071A" \
+  "u\377\2142Av\377\1""1Au\377\2312Av\377\1""1Au\377\2132Av\377\2101Au\377" \
+  "\2060At\377\2331Au\377\1""0@u\377\2031Au\377\2""0@u\3770@t\377\2020@" \
+  "u\377\2021Au\377\5+;q\377%5m\377\40""0j\377\34-g\377\31*e\377\203\30" \
+  ")d\377\276\31*e\377\202\30)d\377\4\35.h\377'7n\377-<r\377.=s\377\202" \
+  "-<r\377\202,;q\377\211-<r\377\2,<r\377-<r\377\203,<r\377\1+<r\377\203" \
+  ",<r\377\5+;q\377,<r\377+;q\377\"3k\377\32+f\377\202\30)d\377\254\31*" \
+  "e\377\202\30)d\377\10\40""0i\377'7n\377(8o\377'7n\377'7o\377(8o\377'" \
+  "7o\377&6o\377\206'7o\377\5&6n\377'7o\377%5m\377\34-g\377\30)d\377\254" \
+  "\31*e\377\2\30)d\377\37""0i\377\207#3l\377\202\"2k\377\3!1j\377\32+f" \
+  "\377\30)d\377\253\31*e\377\13\30)d\377\30*e\377\34,h\377\36.h\377\35" \
+  "-g\377\36.h\377\35-g\377\36.h\377\32+f\377\30*e\377\30)d\377\251\31*" \
+  "e\377\203\30)d\377\202\31*e\377\5\32+e\377\35.h\377$5m\377,<r\3771Au" \
+  "\377\2020@u\377\1""0@t\377\2020@u\377\2031Au\377\1""0@u\377\2351Au\377" \
+  "\2100At\377\2141Au\377\2332Av\377\2141Au\377\2070At\377\2421Au\377\2" \
+  "0@u\3770@t\377\2030@u\377\6/\77t\377)9p\377!1k\377\33,f\377\32+e\377" \
+  "\31*e\377\204\30)d\377\276\31*e\377\5\30)e\377\30)d\377\32+f\377'7n\377" \
+  "-<r\377\202.=s\377\202-<r\377\202,;q\377\211-<r\377\2,<r\377-<r\377\202" \
+  ",<r\377\202+<r\377\203,<r\377\6+;q\377,<r\377(9p\377\34-g\377\31*e\377" \
+  "\30)d\377\255\31*e\377\202\30)d\377\4#3l\377(7n\377(8o\377'7n\377\202" \
+  "(8o\377\2'7o\377&6o\377\206'7o\377\4&6n\377'7o\377%5n\377\32+e\377\202" \
+  "\30)d\377\253\31*e\377\2\30)d\377\37""0i\377\202#3l\377\1\"2k\377\203" \
+  "#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\32+f\377\30)d\377\254\31*e\377" \
+  "\10\30)d\377\33,f\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\34" \
+  ",g\377\202\30)d\377\260\31*e\377\203\30)d\377\7\32+f\377!2k\377(8p\377" \
+  ".>s\377.>t\377/\77t\377/\77u\377\2060@u\377\2041Au\377\1""0@u\377\251" \
+  "1Au\377\2340At\377\2541Au\377\2020@u\377\1""0@t\377\2020@u\377\2/\77" \
+  "u\3770@u\377\202/\77t\377\4.>t\377+;r\377%5n\377\36.i\377\204\30)d\377" \
+  "\301\31*e\377\202\30)d\377\3\31*e\377\32+e\377$4l\377\202.=s\377\3-=" \
+  "s\377-<r\377,;q\377\212-<r\377\2,<r\377-<r\377\203,<r\377\1+<r\377\203" \
+  ",<r\377\5+;q\377,<r\377+<r\377+;q\377\"2l\377\202\30)d\377\255\31*e\377" \
+  "\202\30)d\377\7\32+f\377$5m\377(8o\377'7n\377'7o\377(8o\377'7o\377\202" \
+  "&6o\377\205'7o\377\1&6n\377\202'7o\377\3#4m\377\31*e\377\30)d\377\253" \
+  "\31*e\377\202\30)d\377\3\37""0i\377#3l\377\"2k\377\203#3l\377\3\"2k\377" \
+  "#3l\377\"2k\377\202!1j\377\2\34-f\377\30*d\377\254\31*e\377\11\30)d\377" \
+  "\32+f\377\35.h\377\36-g\377\36.h\377\36-g\377\36.h\377\35-g\377\30)d" \
+  "\377\264\31*e\377\203\30)d\377\10\27(d\377\30)d\377\35.g\377\"2k\377" \
+  "'7o\377*:q\377-=s\377/\77t\377\2070@u\377\2041Au\377\1""0@u\377\3511" \
+  "Au\377\2030@u\377\1""0@t\377\2040@u\377\10.>s\377+;r\377)9p\377%5m\377" \
+  "\40""0i\377\33+f\377\27(d\377\27)d\377\202\30)d\377\302\31*e\377\1\31" \
+  "*d\377\202\30)d\377\3\34,g\377\"3k\377,;r\377\202.=s\377\202-<r\377\1" \
+  ",;q\377\212-<r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\203,<r\377\5" \
+  "+;q\377,<r\377+;q\377&6n\377\34-g\377\202\30)d\377\255\31*e\377\202\30" \
+  ")d\377\10\34-g\377%5m\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\210" \
+  "'7o\377\4'7n\377!2k\377\31*e\377\30)d\377\253\31*e\377\5\30)d\377\31" \
+  "*e\377\36/h\377#2l\377\"2k\377\203#3l\377\2\"2k\377#3l\377\202\"2k\377" \
+  "\2!1j\377\34-g\377\202\30)d\377\253\31*e\377\10\30)d\377\31*e\377\35" \
+  "-g\377\36.h\377\35.h\377\35-g\377\36.h\377\35-g\377\272\31*e\377\204" \
+  "\30)d\377\10\32+f\377\35-g\377\37""0i\377\"3k\377'7o\377+;q\3770\77t" \
+  "\3771Au\377\2060@u\377\2051Au\377\1""0@u\377\3401Au\377\2030@u\377\1" \
+  "0@t\377\2020@u\377\11""1Au\3771Av\377.>s\377)9p\377$5m\377\40""1j\377" \
+  "\36.h\377\33,f\377\30)e\377\204\30)d\377\304\31*e\377\202\30)d\377\3" \
+  "\33,f\377%4l\377*:p\377\202.=s\377\202-<r\377\202,;q\377\214-<r\377\1" \
+  ",<r\377\202+<r\377\203,<r\377\6+;q\377,<r\377-=r\377)8p\377\37/i\377" \
+  "\31*e\377\202\30)d\377\255\31*e\377\202\30)d\377\4\40""0i\377&6n\377" \
+  "(8o\377'8n\377\202(8o\377\210'7o\377\1&6n\377\202'7o\377\3\37""0i\377" \
+  "\31*e\377\30)d\377\254\31*e\377\3\30)d\377\36.h\377\"3k\377\206#3l\377" \
+  "\203\"2k\377\1\34,g\377\202\30)d\377\253\31*e\377\5\30)d\377\31*e\377" \
+  "\35-h\377\36.g\377\35-g\377\202\36.h\377\3\35-g\377\32+e\377\30)e\377" \
+  "\274\31*e\377\1\30)e\377\203\30)d\377\202\31*e\377\6\32+e\377\33+e\377" \
+  "\36/h\377$5l\377)9p\377.>s\377\2100@u\377\3271Au\377\1""0@u\377\2051" \
+  "Au\377\2020@u\377\1""0@t\377\2040@u\377\6""1Au\377,<r\377'7n\377!2k\377" \
+  "\34,g\377\32+e\377\202\31*e\377\205\30)d\377\305\31*e\377\202\30)d\377" \
+  "\5\31*e\377$4l\377,;r\377-<r\377.=s\377\203-<r\377\1,;q\377\212-<r\377" \
+  "\2,<r\377-<r\377\203,<r\377\1+<r\377\203,<r\377\7+;r\377,<r\377+;q\377" \
+  "!2k\377\32*e\377\30)e\377\30)d\377\256\31*e\377\10\30)d\377\31*e\377" \
+  "\"3k\377'7n\377(8o\377'7n\377'7o\377(8o\377\202'7o\377\1&6o\377\205'" \
+  "7o\377\1&6n\377\202'7o\377\3\35-g\377\30*e\377\30)d\377\254\31*e\377" \
+  "\2\30)d\377\36.h\377\202#3l\377\1\"2k\377\203#3l\377\7\"2k\377#3l\377" \
+  "!1j\377\"2k\377\34-g\377\30)e\377\30)d\377\253\31*e\377\11\30)d\377\31" \
+  "*e\377\35-g\377\36.h\377\35-g\377\36.h\377\35-g\377\35-h\377\33+f\377" \
+  "\202\30)d\377\303\31*e\377\1\30*e\377\203\30)d\377\7\27(d\377\33,f\377" \
+  "\40""1j\377%6m\377*:p\377.>s\377.>t\377\203/\77t\377\2020@u\377\1/\77" \
+  "u\377\2020@u\377\1""0@t\377\2030@u\377\3011Au\377\1""0@u\377\2061Au\377" \
+  "\2030@u\377\3""0@t\3770@u\3771Au\377\2040@u\377\202/\77t\377\7.>t\377" \
+  ".>s\377-=r\377(8o\377#3k\377\35.g\377\31*e\377\204\30)d\377\312\31*e" \
+  "\377\202\30)d\377\5\31*e\377\32+f\377\"2k\377-<r\377.=s\377\202-<r\377" \
+  "\202,;q\377\214-<r\377\202,<r\377\202+<r\377\203,<r\377\1+;q\377\202" \
+  ",<r\377\3+;q\377'8o\377\34-f\377\202\30)d\377\256\31*e\377\202\30)d\377" \
+  "\10\32+f\377#4l\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377\211'7o" \
+  "\377\3%5n\377\34,f\377\30)d\377\254\31*e\377\202\30)d\377\3\36.h\377" \
+  "#3l\377\"2k\377\203#3l\377\7\"2k\377#3l\377\"2k\377!1j\377\"2k\377\35" \
+  ".g\377\31*d\377\254\31*e\377\202\30)d\377\2\33,f\377\35.h\377\202\36" \
+  ".h\377\4\36-g\377\36.h\377\34,f\377\30)d\377\312\31*e\377\202\30)d\377" \
+  "\14\27)d\377\27(c\377\30)d\377\34-g\377\37""0i\377#3k\377&6n\377)9p\377" \
+  "*:q\377,<r\377.>s\377/\77t\377\2040@u\377\1""1Au\377\2050@u\377\2111" \
+  "Au\377\1""0@u\377\2501Au\377\1""0@u\377\2111Au\377\2030@u\377\1""0@t" \
+  "\377\2070@u\377\13.>t\377-=s\377+;q\377):p\377(8o\377$4m\377!2j\377\36" \
+  ".h\377\32+e\377\27(c\377\27(d\377\203\30)d\377\314\31*e\377\203\30)d" \
+  "\377\3\35-g\377#3k\377,;r\377\202.=s\377\202-<r\377\202,;q\377\212-<" \
+  "r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\203,<r\377\1+;q\377\202," \
+  "<r\377\2(8o\377!1j\377\202\30)d\377\1\30)e\377\256\31*e\377\202\30)d" \
+  "\377\4\35-g\377&6m\377(8o\377'7n\377\202(8o\377\211'7o\377\5&6n\377'" \
+  "7o\377#4l\377\33,f\377\30)d\377\254\31*e\377\5\30)d\377\31*e\377\36." \
+  "h\377#3l\377\"2k\377\203#3l\377\2\"2k\377#3l\377\203\"2k\377\3\36.h\377" \
+  "\30*e\377\30)d\377\254\31*e\377\3\30)d\377\32+f\377\35-g\377\202\36." \
+  "h\377\4\35-g\377\36.h\377\34-g\377\30)d\377\317\31*e\377\206\30)d\377" \
+  "\12\32+f\377\34-g\377\36.h\377\37""0i\377!1k\377#4l\377&7n\377*9p\377" \
+  ",<r\377.>t\377\2021Av\377\3""1Au\3770@u\3771Au\377\2100@u\377\2241Au" \
+  "\377\2020@u\377\2241Au\377\2040@u\377\1""0@t\377\2030@u\377\2""1@u\377" \
+  "0@u\377\2021Au\377\14""1Av\3770@u\377-=s\377+;q\377(8p\377%6n\377\"3" \
+  "k\377\40""1j\377\36/i\377\35-g\377\33,f\377\31*e\377\206\30)d\377\317" \
+  "\31*e\377\202\30)d\377\3\35.h\377&6m\377+;q\377\202.=s\377\202-<r\377" \
+  "\202,;q\377\212-<r\377\1,<r\377\202-<r\377\202,<r\377\1+<r\377\204,<" \
+  "r\377\5+;q\377,<r\377+;q\377!2k\377\32+f\377\202\30)d\377\257\31*e\377" \
+  "\10\30)d\377\31*e\377!1j\377'7n\377(8o\377'7n\377'7o\377(8o\377\202'" \
+  "7o\377\1&6o\377\205'7o\377\5&6n\377&6o\377'7o\377\"2k\377\32+f\377\202" \
+  "\30)d\377\254\31*e\377\3\30)d\377\36.h\377\"2k\377\206#3l\377\203\"2" \
+  "k\377\3\36.h\377\31*e\377\30)d\377\254\31*e\377\4\30)d\377\32+e\377\35" \
+  "-h\377\36.h\377\202\35-g\377\4\36.h\377\35-g\377\31*e\377\30)d\377\324" \
+  "\31*e\377\206\30)d\377\203\31*e\377\1\32+e\377\202\32+f\377\10\36/h\377" \
+  "\40""1j\377#4l\377'7n\377)9p\377,=r\377/\77t\3771@u\377\2130@u\377\1" \
+  "0@t\377\2140@u\377\2021Au\377\2150@u\377\1""0@t\377\2120@u\377\11""1" \
+  "Au\3770@t\377-=s\377+;q\377(9o\377%5n\377\"3k\377\37""0i\377\34-g\377" \
+  "\202\32+f\377\1\32+e\377\203\31*e\377\206\30)d\377\321\31*e\377\10\30" \
+  ")e\377\30)d\377\27(d\377\35-h\377(8o\377-<r\377.=r\377.=s\377\203-<r" \
+  "\377\1,;q\377\213-<r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\203,<" \
+  "r\377\6+;q\377,<r\377-=r\377%5l\377\32+f\377\31*e\377\202\30)d\377\257" \
+  "\31*e\377\11\30)d\377\31*e\377$4l\377'7n\377(8o\377'7n\377'7o\377(8o" \
+  "\377'7o\377\202&6o\377\205'7o\377\1&6n\377\202'7o\377\3\37/i\377\31*" \
+  "e\377\30)d\377\255\31*e\377\2\30)d\377\36.h\377\202#3l\377\1\"2k\377" \
+  "\203#3l\377\7\"2k\377#3l\377!1j\377\"2k\377\35.h\377\31*e\377\30)d\377" \
+  "\254\31*e\377\5\30)d\377\31*e\377\35.h\377\36-g\377\35-g\377\202\36." \
+  "h\377\3\35-g\377\32*e\377\30)d\377\341\31*e\377\206\30)d\377\15\27(d" \
+  "\377\30)d\377\33,f\377\35-g\377\37/i\377!2j\377#3l\377%5m\377'7n\377" \
+  ")9o\377*:p\377+<r\377-=s\377\204.>s\377\206.>t\377\204.\77t\377\1/\77" \
+  "t\377\203.\77t\377\207.>t\377\204.>s\377\14,=r\377+;q\377)9p\377(8o\377" \
+  "&7n\377$5l\377\"3k\377\40""1j\377\36/h\377\33,f\377\31*e\377\27)d\377" \
+  "\210\30)d\377\331\31*e\377\202\30)d\377\4\31)d\377\31*e\377\36.h\377" \
+  ")8p\377\202.=s\377\202-<r\377\202,;q\377\215-<r\377\202,<r\377\202+<" \
+  "r\377\203,<r\377\1+;q\377\202,<r\377\3+;q\377(8o\377\35.g\377\202\30" \
+  ")d\377\260\31*e\377\6\30)d\377\31*e\377\33,f\377&7n\377(8o\377'7n\377" \
+  "\203(8o\377\210'7o\377\5&6n\377'7o\377&6n\377\36/h\377\30)d\377\255\31" \
+  "*e\377\202\30)d\377\3\36.h\377#3l\377\"2k\377\203#3l\377\6\"2k\377#3" \
+  "l\377\"2k\377!1j\377\"2k\377\36.h\377\256\31*e\377\2\30)d\377\31*d\377" \
+  "\202\35-g\377\202\36.h\377\4\36.g\377\35-g\377\32+f\377\30)d\377\351" \
+  "\31*e\377\1\30)e\377\205\30)d\377\1\27)d\377\203\27(d\377\202\27(c\377" \
+  "\10\27)d\377\30)d\377\31*e\377\32+e\377\33,f\377\33,g\377\34-g\377\35" \
+  "-g\377\202\35.h\377\204\36/h\377\1\37/h\377\203\36/h\377\1\36.h\377\203" \
+  "\35.h\377\1\34-g\377\202\33,f\377\3\32+e\377\31*e\377\30)d\377\202\27" \
+  "(c\377\204\27(d\377\207\30)d\377\340\31*e\377\202\30)d\377\3\33,f\377" \
+  "!0j\377)8o\377\202.=s\377\202-<r\377\203,;q\377\212-<r\377\2,<r\377-" \
+  "<r\377\203,<r\377\1+<r\377\204,<r\377\1+<r\377\202,<r\377\3(8o\377!1" \
+  "j\377\31*d\377\202\30)d\377\257\31*e\377\202\30)d\377\7\31*e\377\37""0" \
+  "i\377(8n\377(8o\377'7n\377'7o\377(8o\377\202'7o\377\1&6o\377\205'7o\377" \
+  "\5&6n\377&7o\377'7o\377$4m\377\34-h\377\202\30)d\377\254\31*e\377\5\30" \
+  ")d\377\31*e\377\36.h\377#2l\377\"2k\377\203#3l\377\2\"2k\377#3l\377\203" \
+  "\"2k\377\3\36/h\377\31*e\377\30)d\377\254\31*e\377\4\30)d\377\31*e\377" \
+  "\34,g\377\35.h\377\202\36.h\377\4\35-g\377\36.h\377\33,f\377\30)d\377" \
+  "\366\31*e\377\235\30)d\377\351\31*e\377\6\31*d\377\30)d\377\27(d\377" \
+  "\35.g\377%5m\377*9p\377\202.=s\377\202-<r\377\202,;q\377\213-<r\377\1" \
+  ",<r\377\202-<r\377\202,<r\377\202+<r\377\204,<r\377\5+;q\377,<r\377)" \
+  ":p\377!1j\377\32+f\377\202\30)d\377\261\31*e\377\3\30)d\377\32+f\377" \
+  "#3l\377\202(8o\377\4'7n\377'7o\377(8o\377'7o\377\202&6o\377\205'7o\377" \
+  "\1&6n\377\202'7o\377\4\"2k\377\32+f\377\30)d\377\31*d\377\255\31*e\377" \
+  "\3\30)d\377\36/h\377\"3k\377\206#3l\377\203\"2k\377\3\36.i\377\31*e\377" \
+  "\30)d\377\255\31*e\377\12\30)d\377\33,f\377\35.h\377\36.g\377\36.h\377" \
+  "\35-g\377\36.h\377\33,g\377\31*d\377\30)e\377\377\31*e\377\374\31*e\377" \
+  "\202\30)d\377\2\36/i\377)8o\377\202-<r\377\202.=s\377\202-<r\377\202" \
+  ",;q\377\213-<r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\204,<r\377\1" \
+  "+;q\377\202,<r\377\4\"3k\377\32+e\377\31*e\377\30)d\377\261\31*e\377" \
+  "\4\30)e\377\30)d\377\35.g\377&6n\377\202(8o\377\1'7o\377\202(8o\377\2" \
+  "'7o\377&6o\377\210'7o\377\4&7o\377\40""1i\377\31*e\377\30)d\377\256\31" \
+  "*e\377\2\30)d\377\37/i\377\202#3l\377\1\"2k\377\203#3l\377\7\"2k\377" \
+  "#3l\377!1j\377\"2k\377\36.i\377\31*e\377\30)d\377\255\31*e\377\2\30)" \
+  "d\377\32+f\377\202\36.h\377\6\35-h\377\35-g\377\36.h\377\34-g\377\31" \
+  "*e\377\30)d\377\377\31*e\377\371\31*e\377\202\30)d\377\4\31*e\377\32" \
+  "+e\377\40""0j\377*:q\377\202.=s\377\202-<r\377\202,;q\377\216-<r\377" \
+  "\202,<r\377\202+<r\377\204,<r\377\1+;q\377\202,<r\377\5+;q\377%5m\377" \
+  "\32+f\377\30)d\377\31*d\377\261\31*e\377\202\30)d\377\2\31*e\377!1j\377" \
+  "\202(8o\377\4'7n\377'7o\377(8o\377'7o\377\202&6o\377\205'7o\377\5&6n" \
+  "\377'6o\377'7o\377&6n\377\36""0h\377\202\30)d\377\254\31*e\377\203\30" \
+  ")d\377\3\37""0i\377#3l\377\"2k\377\203#3l\377\6\"2k\377#3l\377\"2k\377" \
+  "!1j\377\"2k\377\36.i\377\256\31*e\377\202\30)d\377\11\31*e\377\36.i\377" \
+  "\35-g\377\36.h\377\35-h\377\36.g\377\35-g\377\31*e\377\30)d\377\377\31" \
+  "*e\377\367\31*e\377\1\31)d\377\202\30)d\377\6\32+e\377\36.h\377$4m\377" \
+  ",;q\377/>s\377.=s\377\202-<r\377\202,;q\377\214-<r\377\2,<r\377-<r\377" \
+  "\203,<r\377\1+<r\377\204,<r\377\1+;q\377\202,<r\377\3*:q\377%5m\377\35" \
+  ".g\377\202\30)d\377\262\31*e\377\202\30)d\377\5\33,f\377#4l\377(8o\377" \
+  "'7n\377'7o\377\202(8o\377\2'7o\377&6o\377\206'7o\377\1&6n\377\202'7o" \
+  "\377\3$4m\377\34-g\377\30)d\377\256\31*e\377\5\30)d\377\31*e\377\37""0" \
+  "i\377#3l\377\"2k\377\203#3l\377\2\"2k\377#3l\377\203\"2k\377\3\36/h\377" \
+  "\31*e\377\30)d\377\254\31*e\377\13\30)e\377\30)d\377\32+e\377\35-h\377" \
+  "\35-g\377\36.h\377\35.h\377\36.g\377\35-h\377\32+e\377\30)d\377\377\31" \
+  "*e\377\367\31*e\377\6\30)d\377\27(d\377\34,g\377#3k\377)8o\377-<r\377" \
+  "\202.=s\377\203-<r\377\1,;q\377\214-<r\377\1,<r\377\202-<r\377\202,<" \
+  "r\377\202+<r\377\204,<r\377\6+;q\377,<r\377+;r\377$4m\377\35.g\377\31" \
+  ")e\377\202\30)d\377\262\31*e\377\202\30)d\377\2\37""0i\377&6m\377\202" \
+  "(8o\377\2'7o\377(8o\377\202'7o\377\1&6o\377\211'7o\377\3!2k\377\32+e" \
+  "\377\30)d\377\256\31*e\377\3\30)d\377\31*e\377\37""0j\377\207#3l\377" \
+  "\203\"2k\377\3\36.h\377\31*e\377\30)d\377\255\31*e\377\4\30)d\377\31" \
+  "*e\377\35-g\377\35.g\377\202\36.h\377\4\36-g\377\35.h\377\32*e\377\30" \
+  ")d\377\377\31*e\377\365\31*e\377\203\30)d\377\4\36/i\377(7o\377,;r\377" \
+  "-<r\377\202.=s\377\202-<r\377\203,;q\377\214-<r\377\2,<r\377-<r\377\202" \
+  ",<r\377\202+<r\377\204,<r\377\1+;q\377\202,<r\377\3&6n\377\34,g\377\31" \
+  "*e\377\202\30)d\377\262\31*e\377\202\30)d\377\10\32+e\377$4l\377'7n\377" \
+  "(8o\377'7n\377'7o\377(8o\377'7o\377\202&6o\377\206'7o\377\1&6n\377\202" \
+  "'7o\377\1\36/i\377\202\30)d\377\256\31*e\377\3\30)d\377\30*e\377!1j\377" \
+  "\202#3l\377\1\"2k\377\203#3l\377\7\"2k\377#3l\377!1j\377\"2k\377\35." \
+  "h\377\31*e\377\30)d\377\256\31*e\377\11\30)e\377\34-h\377\36.h\377\36" \
+  "-g\377\36.h\377\35-g\377\36.h\377\32+f\377\30)d\377\377\31*e\377\361" \
+  "\31*e\377\204\30)d\377\4\31*e\377\33,f\377#2k\377+;q\377\202.=s\377\202" \
+  "-<r\377\203,;q\377\214-<r\377\2,<r\377-<r\377\203,<r\377\202+<r\377\204" \
+  ",<r\377\1+;q\377\202,<r\377\3+;q\377'7o\377\35-g\377\202\30)d\377\263" \
+  "\31*e\377\10\30)e\377\30)d\377\31*e\377\34-g\377&6m\377(8o\377'7n\377" \
+  "'7o\377\202(8o\377\202&6o\377\206'7o\377\1&6n\377\202'7o\377\3%5m\377" \
+  "\34-g\377\30)d\377\256\31*e\377\202\30)d\377\4\32+e\377!1j\377#3l\377" \
+  "\"2k\377\203#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\"2k\377\36.h\377" \
+  "\257\31*e\377\5\30)d\377\30)e\377\34-g\377\36.h\377\35-h\377\203\36." \
+  "h\377\2\33,f\377\30*e\377\377\31*e\377\361\31*e\377\202\30)d\377\7\31" \
+  "*e\377\34-g\377\40""1j\377'7o\377-<s\377/>s\377.=s\377\203-<r\377\1," \
+  ";q\377\215-<r\377\1,<r\377\202-<r\377\202,<r\377\202+<r\377\204,<r\377" \
+  "\1+;q\377\202,<r\377\3*:q\377%6n\377\36.h\377\202\30)d\377\264\31*e\377" \
+  "\202\30)d\377\2\32+f\377!1j\377\202(8o\377\1'7n\377\202(8o\377\211'7" \
+  "o\377\1&6n\377\202'7o\377\3\"2k\377\32*e\377\30)d\377\257\31*e\377\5" \
+  "\30)d\377\32+f\377\40""1j\377#3l\377\"2k\377\203#3l\377\2\"2k\377#3l" \
+  "\377\203\"2k\377\3\36.h\377\31*e\377\30)d\377\255\31*e\377\13\30)d\377" \
+  "\31*e\377\33,g\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\34,f" \
+  "\377\31*e\377\30)d\377\377\31*e\377\356\31*e\377\202\30)d\377\5\27(c" \
+  "\377\33,f\377\"2k\377(7n\377+:q\377\202.=s\377\203-<r\377\203,;q\377" \
+  "\217-<r\377\202,<r\377\202+<r\377\205,<r\377\6+;q\377,<r\377+;q\377$" \
+  "4l\377\35.g\377\31*e\377\202\30)d\377\264\31*e\377\202\30)d\377\2\35" \
+  ".h\377%5m\377\202(8o\377\3'7n\377'7o\377(8o\377\202'7o\377\1&6o\377\206" \
+  "'7o\377\6&6n\377'7o\377'7n\377\37/i\377\31*e\377\30)d\377\257\31*e\377" \
+  "\5\30)d\377\32+f\377!2k\377#3l\377#3k\377\205#3l\377\203\"2k\377\3\35" \
+  ".g\377\31*e\377\30)d\377\255\31*e\377\202\30)d\377\11\33,f\377\36.h\377" \
+  "\35-g\377\36.h\377\35-g\377\36.h\377\34-g\377\31*e\377\30)d\377\377\31" \
+  "*e\377\355\31*e\377\203\30)d\377\4\37""0i\377(8o\377,;r\377-<r\377\203" \
+  ".=s\377\202-<r\377\202,;q\377\215-<r\377\1,<r\377\202-<r\377\203,<r\377" \
+  "\1+<r\377\204,<r\377\2+;q\377+<r\377\202,<r\377\3$4l\377\33,f\377\31" \
+  "*e\377\202\30)d\377\265\31*e\377\7\30)d\377\31)d\377!1j\377'7n\377(8" \
+  "o\377'7n\377'7o\377\202(8o\377\1'7o\377\202&6o\377\206'7o\377\6&6n\377" \
+  "'7o\377%4m\377\32+f\377\31*e\377\30)d\377\257\31*e\377\5\30)d\377\33" \
+  ",f\377\"2k\377#3l\377\"2k\377\204#3l\377\7\"2k\377#3l\377\"2j\377\"1" \
+  "k\377\34-g\377\31*e\377\30)d\377\256\31*e\377\12\30)d\377\32+f\377\36" \
+  ".h\377\36-g\377\36.h\377\35-h\377\36.h\377\35-g\377\31*e\377\30)d\377" \
+  "\377\31*e\377\350\31*e\377\204\30)d\377\5\31*e\377\32*e\377\35.h\377" \
+  "&5n\377-<s\377\202.=s\377\203-<r\377\202,;q\377\215-<r\377\1,<r\377\202" \
+  "-<r\377\203,<r\377\202+<r\377\204,<r\377\1+;q\377\202,<r\377\4+;q\377" \
+  "*:q\377$4l\377\32+e\377\202\30)d\377\265\31*e\377\202\30)d\377\6\31*" \
+  "e\377\33,f\377&6m\377(8o\377'7n\377'7o\377\202(8o\377\2'7o\377&6o\377" \
+  "\207'7o\377\6&6n\377'7o\377&6n\377\"2l\377\31*e\377\30)d\377\257\31*" \
+  "e\377\202\30)d\377\1\34-g\377\202\"2k\377\204#3l\377\3\"2k\377#3l\377" \
+  "\"2k\377\202!1j\377\2\34-g\377\30)d\377\256\31*e\377\11\30)e\377\30)" \
+  "d\377\32+f\377\36.h\377\35-g\377\36.h\377\36-g\377\36.h\377\35-h\377" \
+  "\377\31*e\377\351\31*e\377\203\30)d\377\6\31*e\377\34-g\377\40""0j\377" \
+  "%5m\377+;q\377/=s\377\202.=s\377\202-<r\377\203,;q\377\220-<r\377\203" \
+  ",<r\377\202+<r\377\207,<r\377\4+<r\377(8o\377\"3k\377\33+f\377\202\30" \
+  ")d\377\266\31*e\377\202\30)d\377\2\32+e\377!1j\377\202(8o\377\3'7n\377" \
+  "'7o\377(8o\377\202'7o\377\1&6o\377\206'7o\377\1&6n\377\202'7o\377\2%" \
+  "5m\377\37/i\377\202\30)d\377\257\31*e\377\202\30)d\377\2\34-g\377\"2" \
+  "k\377\207#3l\377\202\"2k\377\2!1j\377\34-g\377\202\30)d\377\256\31*e" \
+  "\377\4\30)d\377\32+e\377\35.h\377\36-g\377\203\36.h\377\3\35-g\377\32" \
+  "+e\377\31*d\377\377\31*e\377\345\31*e\377\10\30)e\377\30)d\377\27(d\377" \
+  "\30)d\377\35.h\377$3l\377(8o\377+:q\377\203.=s\377\203-<r\377\203,;q" \
+  "\377\215-<r\377\1,<r\377\202-<r\377\203,<r\377\202+<r\377\204,<r\377" \
+  "\1+;q\377\203,<r\377\3&7m\377\37""0i\377\32,f\377\203\30)d\377\266\31" \
+  "*e\377\202\30)d\377\2\36.h\377%5m\377\202(8o\377\1'7o\377\202(8o\377" \
+  "\1'7o\377\202&6o\377\206'7o\377\1&6n\377\202'7o\377\2\"2k\377\33,f\377" \
+  "\202\30)d\377\257\31*e\377\6\30)d\377\30)e\377\36.h\377\"3k\377#3l\377" \
+  "\"2k\377\203#3l\377\2\"2k\377#3l\377\202\"2k\377\4!1k\377\34,f\377\30" \
+  ")e\377\30)d\377\256\31*e\377\13\30)d\377\32+e\377\35-h\377\36-g\377\35" \
+  ".h\377\36.h\377\35-g\377\36.h\377\32+f\377\30)e\377\30)d\377\271\31*" \
+  "e\377\202\30)d\377\377\31*e\377\247\31*e\377\203\30)d\377\4\30*d\377" \
+  "\36.h\377%6m\377+:q\377\202-<r\377\203.=s\377\203-<r\377\202,;q\377\221" \
+  "-<r\377\203,<r\377\202+<r\377\210,<r\377\3%5l\377\34-g\377\31*e\377\202" \
+  "\30)d\377\267\31*e\377\202\30)d\377\3\31*e\377#3l\377'7n\377\202(8o\377" \
+  "\2'7n\377(8o\377\214'7o\377\3'6o\377\40""0j\377\31*e\377\202\30)d\377" \
+  "\257\31*e\377\202\30)d\377\4\37""0i\377\"2k\377#3l\377\"2k\377\203#3" \
+  "l\377\2\"2k\377#3l\377\202\"2k\377\4!1j\377\32+f\377\31*d\377\30)d\377" \
+  "\256\31*e\377\11\30)d\377\31*e\377\35-h\377\36.h\377\35.h\377\36.h\377" \
+  "\35-g\377\36.h\377\32+f\377\202\30)d\377\272\31*e\377\5#3l\377\34-g\377" \
+  "\32*e\377\31*e\377\30*e\377\203\30)d\377\377\31*e\377\233\31*e\377\204" \
+  "\30)d\377\202\31*e\377\4\32+f\377\37/i\377'6n\377-<r\377\202.=s\377\204" \
+  "-<r\377\202,;q\377\222-<r\377\203,<r\377\202+<r\377\210,<r\377\4+;q\377" \
+  "*:p\377$4l\377\32+f\377\202\30)d\377\270\31*e\377\202\30)d\377\7\31*" \
+  "e\377\34-g\377&6n\377(8o\377'7n\377'7o\377(8o\377\202'7o\377\1&6o\377" \
+  "\207'7o\377\2&6n\377'7o\377\202&6n\377\1\34-g\377\202\30)d\377\260\31" \
+  "*e\377\5\30)d\377\31*e\377\37/j\377#3l\377\"2k\377\203#3l\377\1\"2k\377" \
+  "\202#3l\377\202\"2k\377\3!1j\377\33+f\377\30)d\377\257\31*e\377\6\30" \
+  ")d\377\31*e\377\35-g\377\36.h\377\35-h\377\35-g\377\202\36.h\377\2\33" \
+  ",f\377\30)d\377\274\31*e\377\10.=s\377/=s\377+:q\377&6n\377!1j\377\36" \
+  ".h\377\33,f\377\31*d\377\204\30)d\377\377\31*e\377\224\31*e\377\204\30" \
+  ")d\377\7\31+e\377\34-g\377\37/i\377#3l\377(8o\377-<r\377/>s\377\202." \
+  "=s\377\203-<r\377\203,;q\377\217-<r\377\1,<r\377\202-<r\377\203,<r\377" \
+  "\202+<r\377\205,<r\377\1+;q\377\202,<r\377\5+;q\377'7n\377!2j\377\32" \
+  "+f\377\27(d\377\202\30)d\377\270\31*e\377\202\30)d\377\2\33,f\377\"2" \
+  "k\377\202(8o\377\1'7n\377\202(8o\377\202'7o\377\1&6o\377\211'7o\377\4" \
+  "&6n\377\"2k\377\32+e\377\30)d\377\261\31*e\377\5\30)d\377\32+e\377\40" \
+  "0i\377#3l\377#3k\377\205#3l\377\203\"2k\377\3\40""0j\377\32+e\377\30" \
+  ")d\377\257\31*e\377\5\30)d\377\31*e\377\35-g\377\36.h\377\35-g\377\202" \
+  "\36.h\377\3\36-h\377\33,f\377\30)d\377\275\31*e\377\202-<r\377\203.=" \
+  "s\377\7,;r\377*9p\377'7n\377#3l\377\36/h\377\32*e\377\27(d\377\203\30" \
+  ")d\377\377\31*e\377\216\31*e\377\202\30)d\377\10\27(d\377\30)d\377\33" \
+  ",g\377\40""0j\377%5m\377(8o\377+:q\377-=s\377\203.=s\377\203-<r\377\203" \
+  ",;q\377\220-<r\377\1,<r\377\202-<r\377\203,<r\377\202+<r\377\207,<r\377" \
+  "\5-=r\377)9p\377\"3k\377\36.h\377\31*e\377\202\30)d\377\272\31*e\377" \
+  "\4\30)d\377\31*d\377\40""1j\377&6n\377\202(8o\377\3'7n\377'7o\377(8o" \
+  "\377\202'7o\377\1&6o\377\207'7o\377\6&6n\377'7o\377%5m\377\35.g\377\31" \
+  ")d\377\30)d\377\260\31*e\377\6\30)e\377\30)d\377\33,f\377!1j\377#3l\377" \
+  "\"2k\377\204#3l\377\2\"2k\377#3l\377\202\"2k\377\3\37/i\377\32+e\377" \
+  "\30)d\377\257\31*e\377\13\30)d\377\31*e\377\34-g\377\36.h\377\35-g\377" \
+  "\36.h\377\35-g\377\36.h\377\34,f\377\31*e\377\30)d\377\275\31*e\377\1" \
+  ",;q\377\204-<r\377\203.=s\377\202-<r\377\4,;r\377(8p\377#4k\377\34-g" \
+  "\377\204\30)d\377\1\30)e\377\377\31*e\377\206\31*e\377\204\30)d\377\7" \
+  "\31*e\377\37""0i\377&6m\377+;q\377,;r\377-<r\377-=s\377\203.=s\377\203" \
+  "-<r\377\203,;q\377\220-<r\377\1,<r\377\203-<r\377\203,<r\377\202+<r\377" \
+  "\205,<r\377\1+;q\377\202,<r\377\4(9o\377\37""0i\377\32+e\377\31*e\377" \
+  "\203\30)d\377\271\31*e\377\202\30)d\377\6\34-g\377&6m\377'7n\377(8o\377" \
+  "'7n\377'7o\377\202(8o\377\1'7o\377\202&6o\377\206'7o\377\1&6n\377\202" \
+  "'7o\377\2!2k\377\32+f\377\202\30)d\377\260\31*e\377\202\30)d\377\4\34" \
+  "-g\377\"2k\377#3l\377\"2k\377\204#3l\377\2\"2k\377#3l\377\202\"2k\377" \
+  "\3\37/i\377\31*e\377\30)d\377\257\31*e\377\11\30)d\377\31*e\377\34-g" \
+  "\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\34-g\377\202\30)d\377" \
+  "\276\31*e\377\204-<r\377\203,;q\377\204-<r\377\203.=s\377\5.<r\377(8" \
+  "o\377\"2k\377\35.g\377\32+e\377\202\31*e\377\1\30*e\377\204\30)d\377" \
+  "\366\31*e\377\205\30)d\377\202\31*e\377\6\32+e\377\33+f\377\37""0i\377" \
+  "%5m\377*:p\377/>s\377\203.=s\377\203-<r\377\204,;q\377\224-<r\377\203" \
+  ",<r\377\202+<r\377\205,<r\377\1+;q\377\203,<r\377\202+;q\377\3%5m\377" \
+  "\34-g\377\27(d\377\202\30)d\377\273\31*e\377\202\30)d\377\2\32+e\377" \
+  "\"2k\377\202(8o\377\2'7n\377'7o\377\202(8o\377\2'7o\377&6o\377\207'7" \
+  "o\377\1&6n\377\202'7o\377\2%6n\377\35.h\377\202\30)d\377\261\31*e\377" \
+  "\4\30)d\377\31*e\377\34-g\377\"3l\377\210#3l\377\5\"2k\377!1j\377\36" \
+  "/i\377\31*d\377\30)d\377\257\31*e\377\12\30)d\377\31*e\377\34,g\377\36" \
+  ".h\377\35-g\377\35.h\377\36.g\377\36.h\377\35-g\377\30)d\377\300\31*" \
+  "e\377\207-<r\377\203,;q\377\205-<r\377\202.=s\377\10/>t\377-<r\377)8" \
+  "o\377%5m\377!1j\377\36/h\377\34-g\377\32+f\377\206\30)d\377\355\31*e" \
+  "\377\205\30)d\377\11\31*e\377\33,f\377\35.g\377\37""0i\377\"3k\377'6" \
+  "n\377*:p\377/=s\377/>s\377\202.=s\377\204-<r\377\204,;q\377\221-<r\377" \
+  "\1,<r\377\202-<r\377\203,<r\377\203+<r\377\211,<r\377\6*:p\377&6n\377" \
+  "\40""1j\377\32+f\377\27)d\377\30)d\377\274\31*e\377\202\30)d\377\3\31" \
+  "*e\377\36/h\377&5n\377\202(8o\377\1'7o\377\202(8o\377\202'7o\377\1&6" \
+  "o\377\207'7o\377\6&6n\377'7o\377&7n\377\"2k\377\32+f\377\30)d\377\262" \
+  "\31*e\377\3\30)d\377\31*e\377\36.h\377\202#3l\377\1\"2k\377\203#3l\377" \
+  "\2\"2k\377#3l\377\202\"2k\377\2!1k\377\36.h\377\202\30)d\377\257\31*" \
+  "e\377\11\30)d\377\30)e\377\33,g\377\36.h\377\35-g\377\36.h\377\36-g\377" \
+  "\36.h\377\34,g\377\302\31*e\377\212-<r\377\204,;q\377\204-<r\377\204" \
+  ".=s\377\12-<r\377+:q\377)8o\377'6n\377$3l\377\40""0j\377\34-g\377\31" \
+  "*e\377\27(d\377\27)d\377\203\30)d\377\345\31*e\377\203\30)d\377\202\27" \
+  "(d\377\7\32+f\377\36/h\377\"1k\377%5m\377(7o\377*9p\377,;q\377\204.=" \
+  "s\377\205-<r\377\203,;q\377\223-<r\377\1,<r\377\202-<r\377\203,<r\377" \
+  "\203+<r\377\205,<r\377\1+;q\377\203,<r\377\4'7n\377!1j\377\34-g\377\31" \
+  "*e\377\203\30)d\377\274\31*e\377\202\30)d\377\5\35.h\377$4l\377(8n\377" \
+  "(8o\377(8n\377\202(8o\377\202'7o\377\202&6o\377\206'7o\377\1&6n\377\202" \
+  "'7o\377\3$5m\377\35.h\377\31*e\377\202\30)d\377\261\31*e\377\3\30)d\377" \
+  "\31+e\377\37""0j\377\202#3l\377\1\"2k\377\203#3l\377\2\"2k\377#3l\377" \
+  "\202\"2k\377\4!1j\377\34,g\377\30*e\377\30)d\377\257\31*e\377\13\30)" \
+  "d\377\30)e\377\34-g\377\36.h\377\35-g\377\36.h\377\35.h\377\36.h\377" \
+  "\34-g\377\31*e\377\30)d\377\301\31*e\377\216-<r\377\203,;q\377\205-<" \
+  "r\377\204.=s\377\202-<r\377\202,;r\377\4*9p\377%5n\377\"1j\377\35-h\377" \
+  "\206\30)d\377\332\31*e\377\205\30)d\377\7\27)d\377\32+f\377\37/h\377" \
+  "#3l\377(7n\377+:r\377,;r\377\202-<r\377\1.=r\377\203.=s\377\205-<r\377" \
+  "\204,;q\377\223-<r\377\1,<r\377\203-<r\377\203,<r\377\202+<r\377\206" \
+  ",<r\377\1+;q\377\202,<r\377\3*:p\377\"3l\377\33,f\377\202\31*e\377\202" \
+  "\30)d\377\276\31*e\377\4\30)d\377\32+e\377#3l\377'7n\377\202(8o\377\4" \
+  "'7n\377'7o\377(8o\377'7o\377\202&6o\377\212'7o\377\4!1k\377\32+e\377" \
+  "\31*e\377\30)d\377\262\31*e\377\5\30)d\377\32*e\377!1j\377#3l\377\"2" \
+  "k\377\204#3l\377\3\"2k\377#3l\377\"2k\377\202!1j\377\1\33,f\377\202\30" \
+  ")d\377\257\31*e\377\5\30)d\377\31*e\377\34,g\377\36.h\377\35-g\377\202" \
+  "\36.h\377\5\36-g\377\35.g\377\31*d\377\30)d\377\30)e\377\301\31*e\377" \
+  "\225-<r\377\204,;q\377\205-<r\377\204.=s\377\10/>s\377,;q\377'7o\377" \
+  "$4l\377\40""0i\377\34,g\377\32+f\377\32+e\377\203\31*e\377\1\30)e\377" \
+  "\207\30)d\377\300\31*e\377\210\30)d\377\203\31*e\377\10\32*e\377\32+" \
+  "e\377\33,f\377\36.h\377\"1k\377%5m\377)9p\377-<s\377\204.=s\377\1.=r" \
+  "\377\204-<r\377\204,;q\377\226-<r\377\1,<r\377\202-<r\377\204,<r\377" \
+  "\202+<r\377\206,<r\377\1+;q\377\203,<r\377\4+;q\377*:q\377&6n\377\35" \
+  ".h\377\203\30)d\377\277\31*e\377\7\30)d\377\31*d\377\31*e\377\37/i\377" \
+  "'7o\377(8o\377'7n\377\202(8o\377\202'7o\377\202&6o\377\206'7o\377\3&" \
+  "7o\377'6n\377'7o\377\202&6n\377\1\35.g\377\202\30)d\377\262\31*e\377" \
+  "\6\30)d\377\30)e\377\32+f\377\"2k\377#3l\377\"2k\377\206#3l\377\202\"" \
+  "2k\377\3!1j\377\33+e\377\30)d\377\260\31*e\377\13\30)d\377\31*e\377\33" \
+  ",f\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\35-g\377\31*e\377" \
+  "\30)d\377\303\31*e\377\202-<r\377\1,<r\377\226-<r\377\204,;q\377\206" \
+  "-<r\377\203.=s\377\202/>s\377\14-=s\377+:q\377)8o\377&5n\377#3l\377!" \
+  "1j\377\37""0i\377\36.h\377\35-g\377\33,f\377\32+f\377\31*e\377\212\30" \
+  ")d\377\256\31*e\377\212\30)d\377\14\30*e\377\31+e\377\33,f\377\34,g\377" \
+  "\35.h\377\37/i\377\40""0i\377\"2k\377$4m\377'6n\377*9p\377,;r\377\202" \
+  "/>s\377\1/=s\377\203.=s\377\205-<r\377\204,;q\377\233-<r\377\203,<r\377" \
+  "\203+<r\377\211,<r\377\6+<q\377(9o\377%6m\377\40""1j\377\31*e\377\27" \
+  "(d\377\202\30)d\377\277\31*e\377\202\30)d\377\3\31*e\377\36.h\377$5m" \
+  "\377\202(8o\377\3'7n\377'7o\377(8o\377\202'7o\377\1&6o\377\212'7o\377" \
+  "\5&6n\377!2k\377\32+e\377\30)d\377\30)e\377\262\31*e\377\6\30)d\377\31" \
+  "*e\377\34-h\377#2k\377#3l\377\"2k\377\203#3l\377\1\"2k\377\202#3l\377" \
+  "\5\"2k\377\"2j\377\40""0i\377\32*e\377\30)d\377\260\31*e\377\13\30)d" \
+  "\377\31*e\377\33,f\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\35" \
+  "-g\377\31*e\377\30)d\377\304\31*e\377\202,<r\377\203-<r\377\1,<r\377" \
+  "\227-<r\377\205,;q\377\205-<r\377\210.=s\377\20-;r\377+:q\377*:p\377" \
+  ")9o\377(8o\377'7n\377%5m\377#4l\377!2k\377\37""0i\377\36.h\377\35-g\377" \
+  "\33,f\377\31*e\377\30)d\377\27(c\377\202\27(d\377\1\27)d\377\216\30)" \
+  "d\377\214\31*e\377\214\30)d\377\1\27)d\377\204\27(d\377\17\30)e\377\32" \
+  "+e\377\33,f\377\35-g\377\37/h\377!1j\377\"2k\377$4l\377&6m\377'7n\377" \
+  "(8o\377*9p\377*:q\377,;q\377-<r\377\207.=s\377\205-<r\377\205,;q\377" \
+  "\227-<r\377\1,<r\377\203-<r\377\204,<r\377\203+<r\377\206,<r\377\1+;" \
+  "q\377\203,<r\377\4)9p\377#4l\377\36/h\377\33,f\377\203\30)d\377\301\31" \
+  "*e\377\202\30)d\377\3\34.g\377#3l\377'7n\377\202(8o\377\1'7o\377\202" \
+  "(8o\377\202'7o\377\1&6o\377\207'7o\377\1&6n\377\202'7o\377\2#4l\377\34" \
+  "-g\377\202\30)d\377\263\31*e\377\3\30)d\377\31*e\377\37/i\377\202#3l" \
+  "\377\1\"2k\377\203#3l\377\2\"2k\377#3l\377\203\"2k\377\3\36/i\377\31" \
+  "*e\377\30)d\377\260\31*e\377\5\30)d\377\31*e\377\33,g\377\35.h\377\36" \
+  "-g\377\203\36.h\377\3\35-g\377\31*e\377\30)d\377\305\31*e\377\1+<r\377" \
+  "\204,<r\377\203-<r\377\1,<r\377\231-<r\377\205,;q\377\206-<r\377\210" \
+  ".=s\377\1-=s\377\204-<r\377\2,<r\377,;r\377\202,;q\377\21+:q\377)8o\377" \
+  "(7n\377%6m\377$5l\377#2l\377!1j\377\40""0j\377\37/i\377\35.h\377\34-" \
+  "h\377\34,g\377\33,f\377\31+f\377\31*e\377\30)e\377\31*e\377\213\30)d" \
+  "\377\202\27)d\377\203\31*e\377\15\32+f\377\33,g\377\34-g\377\35.h\377" \
+  "\36.i\377\37""0i\377!1j\377\"2k\377#3l\377%4m\377&6n\377(8o\377*9p\377" \
+  "\202,;q\377\202,;r\377\1,<r\377\204-<r\377\210.=s\377\206-<r\377\205" \
+  ",;q\377\231-<r\377\1,<r\377\203-<r\377\204,<r\377\203+<r\377\206,<r\377" \
+  "\2+;r\377,<q\377\202,<r\377\3*:p\377#4l\377\34-g\377\202\31*e\377\203" \
+  "\30)d\377\302\31*e\377\4\30)d\377\32+f\377$4l\377'7n\377\202(8o\377\1" \
+  "'7n\377\202(8o\377\202'7o\377\202&6o\377\207'7o\377\1&6n\377\202'7o\377" \
+  "\2\36.h\377\31*e\377\202\30)d\377\263\31*e\377\3\30)d\377\31*e\377!1" \
+  "j\377\206#3l\377\6\"2k\377#3l\377\"2k\377!1j\377\"2k\377\35.h\377\202" \
+  "\30)d\377\260\31*e\377\12\30)d\377\31*e\377\33,g\377\35.h\377\36-g\377" \
+  "\35.h\377\36.h\377\35-g\377\36-h\377\31*e\377\202\30)d\377\305\31*e\377" \
+  "\204,<r\377\204+<r\377\204,<r\377\203-<r\377\1,<r\377\234-<r\377\210" \
+  ",;q\377\210-<r\377\223.=s\377\3/=s\377.=s\377-=s\377\202.<s\377\202." \
+  "<r\377\202.<s\377\202.=s\377\202/=s\377\222.=s\377\211-<r\377\207,;q" \
+  "\377\235-<r\377\1,<r\377\203-<r\377\204,<r\377\203+<r\377\207,<r\377" \
+  "\1+;q\377\203,<r\377\202+;q\377\3)9q\377#3l\377\34-g\377\203\30)d\377" \
+  "\303\31*e\377\202\30)d\377\202\31*e\377\2\37""0i\377'8n\377\202(8o\377" \
+  "\1'7o\377\202(8o\377\202'7o\377\1&6o\377\207'7o\377\1&6n\377\202'7o\377" \
+  "\4&6n\377#3l\377\32+f\377\30)d\377\264\31*e\377\202\30)d\377\4\32+f\377" \
+  "\"2k\377#3l\377\"2k\377\204#3l\377\3\"2k\377#3l\377\"2k\377\202!1j\377" \
+  "\2\34-g\377\30)d\377\261\31*e\377\13\30)d\377\31*e\377\33,f\377\35.h" \
+  "\377\36-g\377\36.h\377\35-g\377\36.h\377\35.g\377\32+e\377\30)d\377\307" \
+  "\31*e\377\210,<r\377\203+<r\377\204,<r\377\204-<r\377\1,<r\377\240-<" \
+  "r\377\210,;q\377\217-<r\377\225.=s\377\217-<r\377\210,;q\377\240-<r\377" \
+  "\1,<r\377\204-<r\377\203,<r\377\204+<r\377\207,<r\377\1+;q\377\203,<" \
+  "r\377\5+;q\377)8o\377&6m\377\"2k\377\35-g\377\204\30)d\377\304\31*e\377" \
+  "\202\30)d\377\3\32+f\377\37/i\377&6m\377\202(8o\377\3'7n\377'7o\377(" \
+  "8o\377\202'7o\377\202&6o\377\207'7o\377\1&6n\377\202'7o\377\4$4m\377" \
+  "\36/i\377\30*d\377\30)d\377\264\31*e\377\6\30)d\377\31)d\377\35-g\377" \
+  "\"3k\377#3l\377\"2k\377\203#3l\377\1\"2k\377\202#3l\377\5\"2k\377\"1" \
+  "j\377!1j\377\33,f\377\30)d\377\261\31*e\377\13\30)d\377\31*e\377\33," \
+  "f\377\35.h\377\36-g\377\35.h\377\35-g\377\36.h\377\35-g\377\32+e\377" \
+  "\30)d\377\310\31*e\377\203,<r\377\1+;q\377\207,<r\377\203+<r\377\205" \
+  ",<r\377\204-<r\377\1,<r\377\244-<r\377\216,;q\377\226-<r\377\217,;q\377" \
+  "\244-<r\377\1,<r\377\204-<r\377\204,<r\377\204+<r\377\207,<r\377\1+;" \
+  "q\377\202,<r\377\7-=r\377+;q\377&6n\377\"2k\377\36/h\377\33,f\377\31" \
+  "*d\377\203\30)d\377\305\31*e\377\202\30)d\377\3\31)d\377\37""0i\377%" \
+  "5m\377\202(8o\377\2'7n\377'7o\377\202(8o\377\202'7o\377\202&6o\377\211" \
+  "'7o\377\3&6n\377\37""0i\377\32+f\377\202\30)d\377\264\31*e\377\4\30)" \
+  "d\377\31*e\377\37/i\377\"2k\377\205#3l\377\2\"2k\377#3l\377\203\"2k\377" \
+  "\3\40""0i\377\32+e\377\30)d\377\261\31*e\377\6\30)d\377\31*e\377\33," \
+  "g\377\35.h\377\36-g\377\35.h\377\202\36.h\377\3\35-g\377\32+e\377\30" \
+  ")d\377\311\31*e\377\2\40""1j\377'8o\377\204,<r\377\1+;q\377\207,<r\377" \
+  "\204+<r\377\205,<r\377\204-<r\377\1,<r\377\256-<r\377\226,;q\377\257" \
+  "-<r\377\1,<r\377\204-<r\377\204,<r\377\204+<r\377\214,<r\377\4*;q\377" \
+  "#4l\377\35.h\377\32+e\377\202\31*e\377\203\30)d\377\307\31*e\377\202" \
+  "\30)d\377\3\36/h\377&6n\377'7n\377\202(8o\377\3'7n\377'7o\377(8o\377" \
+  "\202'7o\377\202&6o\377\207'7o\377\1&6n\377\202'7o\377\4#3l\377\32+f\377" \
+  "\31*e\377\30)d\377\265\31*e\377\3\30)d\377\32+e\377!1k\377\202#3l\377" \
+  "\1\"2k\377\205#3l\377\7\"2k\377!1j\377\"2k\377\36/i\377\31*e\377\30)" \
+  "e\377\30)d\377\260\31*e\377\12\30)d\377\31*e\377\33,g\377\35.h\377\36" \
+  "-g\377\35.h\377\36.h\377\35-g\377\36.h\377\32+e\377\202\30)d\377\311" \
+  "\31*e\377\202\30)d\377\5\31*e\377\36/h\377$5l\377)9o\377*;q\377\202+" \
+  ";q\377\203,<r\377\1+;q\377\211,<r\377\204+<r\377\205,<r\377\205-<r\377" \
+  "\1,<r\377\340-<r\377\1,<r\377\206-<r\377\204,<r\377\204+<r\377\211,<" \
+  "r\377\1+;q\377\204,<r\377\202+;q\377\4*:p\377'7n\377!2k\377\33,f\377" \
+  "\204\30)d\377\310\31*e\377\203\30)d\377\3\31*e\377\34-g\377%5m\377\203" \
+  "(8o\377\1'7o\377\202(8o\377\202'7o\377\1&6o\377\210'7o\377\5&6n\377'" \
+  "7o\377&6n\377%5m\377\35.h\377\202\30)d\377\265\31*e\377\6\30)d\377\31" \
+  "*e\377\34,f\377\"2k\377#3k\377\"2l\377\203#3l\377\1\"2k\377\202#3l\377" \
+  "\5\"2k\377!1j\377\"2k\377\35-h\377\30)d\377\262\31*e\377\13\30)d\377" \
+  "\31*e\377\33,f\377\35.h\377\36-g\377\36.h\377\35-g\377\36.h\377\35.g" \
+  "\377\32+e\377\30)d\377\315\31*e\377\204\30)d\377\6\33,f\377\37""0i\377" \
+  "$4l\377&7n\377)9p\377+;q\377\204,<r\377\1+;q\377\211,<r\377\205+<r\377" \
+  "\205,<r\377\206-<r\377\1,<r\377\325-<r\377\1,<r\377\205-<r\377\206,<" \
+  "r\377\204+<r\377\211,<r\377\2+;r\377,<q\377\204,<r\377\7*:p\377(8o\377" \
+  "%6m\377\"2k\377\36.h\377\31*e\377\27(d\377\202\30)d\377\313\31*e\377" \
+  "\202\30)d\377\3\31*e\377\35.h\377#3l\377\202(8o\377\2(8n\377'7o\377\202" \
+  "(8o\377\202'7o\377\202&6o\377\207'7o\377\1&6n\377\202'7o\377\4%5m\377" \
+  "\40""0j\377\31*e\377\30)d\377\266\31*e\377\4\30)d\377\31*e\377\36.h\377" \
+  "\"2k\377\205#3l\377\2\"2k\377#3l\377\203\"2k\377\3\40""1j\377\33,g\377" \
+  "\30)d\377\262\31*e\377\13\30)d\377\30*e\377\33,f\377\36.h\377\36-g\377" \
+  "\35.h\377\35-g\377\36.h\377\35-g\377\32+e\377\30)d\377\321\31*e\377\204" \
+  "\30)d\377\10\31*e\377\33,f\377\36.h\377\40""1j\377$4l\377(8o\377,<r\377" \
+  "-=r\377\203,<r\377\1+;r\377\212,<r\377\205+<r\377\206,<r\377\320-<r\377" \
+  "\1,<r\377\206-<r\377\206,<r\377\205+<r\377\212,<r\377\1+;q\377\203,<" \
+  "r\377\7,<s\377*:p\377&6n\377\"3k\377\37""0i\377\34-g\377\32+f\377\204" \
+  "\30)d\377\314\31*e\377\202\30)d\377\4\30)e\377\36.h\377$4l\377'7n\377" \
+  "\202(8o\377\3'7n\377'7o\377(8o\377\203'7o\377\1&6o\377\212'7o\377\3'" \
+  "7n\377\40""0j\377\33,f\377\202\30)d\377\265\31*e\377\202\30)d\377\2\32" \
+  "+f\377\40""0j\377\202#3l\377\1\"2k\377\205#3l\377\203\"2k\377\2\40""0" \
+  "i\377\32+f\377\202\30)d\377\261\31*e\377\5\30)d\377\30*e\377\34,g\377" \
+  "\36.h\377\35-g\377\203\36.h\377\3\35-g\377\32+e\377\30)d\377\325\31*" \
+  "e\377\204\30)d\377\1\30*e\377\202\31*e\377\5\32+e\377\35.h\377\"3l\377" \
+  "'7n\377+;r\377\204,<r\377\1+;r\377\213,<r\377\205+<r\377\207,<r\377\303" \
+  "-<r\377\1,<r\377\207-<r\377\207,<r\377\205+<r\377\213,<r\377\1+;q\377" \
+  "\203,<r\377\6-<r\377*:p\377%5m\377\40""0i\377\33,f\377\32+e\377\202\31" \
+  "*e\377\204\30)d\377\316\31*e\377\202\30)d\377\3\35.h\377%5m\377'7n\377" \
+  "\203(8o\377\1'7o\377\202(8o\377\202'7o\377\202&6o\377\210'7o\377\5&6" \
+  "n\377'7o\377#3l\377\33+f\377\31*e\377\202\30)d\377\265\31*e\377\202\30" \
+  ")d\377\2\34,g\377\"2k\377\202#3l\377\1\"2k\377\203#3l\377\1\"2k\377\202" \
+  "#3l\377\4!1j\377\"2k\377\36/i\377\31*e\377\202\30)d\377\261\31*e\377" \
+  "\5\30)d\377\31*e\377\33,g\377\36.h\377\35-g\377\202\36.h\377\3\35-g\377" \
+  "\36.h\377\32+e\377\202\30)d\377\335\31*e\377\204\30)d\377\5\33,f\377" \
+  "\40""1j\377%5m\377)9p\377*:q\377\203+;q\377\205,<r\377\1+;q\377\215," \
+  "<r\377\210+<r\377\212,<r\377\250-<r\377\213,<r\377\210+<r\377\214,<r" \
+  "\377\1+;q\377\206,<r\377\202+;q\377\6*;q\377*:q\377'7o\377\"3k\377\36" \
+  "/h\377\31*e\377\204\30)d\377\321\31*e\377\203\30)d\377\3\31*e\377\34" \
+  "-g\377$5l\377\202(8o\377\2'7n\377'7o\377\202(8o\377\202'7o\377\202&6" \
+  "o\377\212'7o\377\202&6n\377\1\35.h\377\202\30)d\377\266\31*e\377\202" \
+  "\30)d\377\3\31*e\377\35.h\377#3k\377\205#3l\377\1\"2k\377\202#3l\377" \
+  "\1\"2k\377\202!1j\377\2\35-h\377\30*e\377\263\31*e\377\13\30)d\377\31" \
+  "*e\377\33,g\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\35-g\377" \
+  "\32+e\377\30)d\377\343\31*e\377\203\30)d\377\11\27(c\377\32+e\377\35" \
+  "-h\377\40""1j\377#4l\377&6n\377'7n\377)9p\377*:q\377\206,<r\377\2,<q" \
+  "\377+;r\377\217,<r\377\211+<r\377\252,<r\377\212+<r\377\226,<r\377\12" \
+  "+;q\377*:p\377(8o\377&7n\377$5m\377!2k\377\37/i\377\33,g\377\30)d\377" \
+  "\27(d\377\204\30)d\377\323\31*e\377\202\30)d\377\3\32+e\377\35.h\377" \
+  "#3l\377\203(8o\377\1'7n\377\202(8o\377\202'7o\377\202&6o\377\210'7o\377" \
+  "\1&6n\377\202'7o\377\3$4m\377\37""0i\377\31*e\377\202\30)d\377\266\31" \
+  "*e\377\202\30)d\377\2\32+f\377\37""0i\377\202#3l\377\1\"2k\377\205#3" \
+  "l\377\203\"2k\377\2\40""1j\377\34,g\377\202\30)d\377\262\31*e\377\13" \
+  "\30)d\377\31*e\377\34,f\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h" \
+  "\377\35-g\377\31*e\377\30)d\377\350\31*e\377\205\30)d\377\13\32+e\377" \
+  "\34,g\377\35.h\377\36/i\377!1j\377#4l\377&7n\377)9p\377+;r\377-=r\377" \
+  "-<r\377\204,<r\377\1+;q\377\223,<r\377\252+<r\377\223,<r\377\2+;r\377" \
+  ",<q\377\204,<r\377\202-=r\377\11*:p\377(8o\377%5m\377\"2l\377\40""0i" \
+  "\377\36/h\377\34-g\377\33,f\377\31*e\377\205\30)d\377\1\30)e\377\325" \
+  "\31*e\377\202\30)d\377\3\32+e\377\37""0j\377%5l\377\203(8o\377\3'7n\377" \
+  "'7o\377(8o\377\203'7o\377\1&6o\377\210'7o\377\1&6n\377\202'7o\377\3%" \
+  "6n\377\37/i\377\32+f\377\202\30)d\377\267\31*e\377\202\30)d\377\4\34" \
+  "-g\377!1k\377#3l\377\"2k\377\204#3l\377\1\"2k\377\202#3l\377\202\"2k" \
+  "\377\2\37/i\377\32+e\377\202\30)d\377\262\31*e\377\5\30)d\377\31*e\377" \
+  "\34-g\377\36.h\377\35-g\377\203\36.h\377\3\35-g\377\32*e\377\30)d\377" \
+  "\355\31*e\377\205\30)d\377\203\31*e\377\202\32+e\377\6\33,g\377\37""0" \
+  "i\377\"2k\377%5m\377(8p\377+;q\377\207,<r\377\1+;q\377\303,<r\377\1+" \
+  ";q\377\207,<r\377\5*:p\377&7n\377$4l\377\40""1j\377\35.h\377\202\32+" \
+  "e\377\203\31*e\377\206\30)d\377\331\31*e\377\5\30)d\377\31*e\377!1j\377" \
+  "&7n\377'7n\377\202(8o\377\2'7n\377'7o\377\202(8o\377\202'7o\377\202&" \
+  "6o\377\210'7o\377\4&6n\377'7o\377'6o\377\40""1j\377\202\31*e\377\202" \
+  "\30)d\377\267\31*e\377\202\30)d\377\4\36/i\377\"2k\377#3l\377\"2k\377" \
+  "\204#3l\377\2\"2k\377#3l\377\203\"2k\377\3\35.h\377\31*e\377\30)d\377" \
+  "\263\31*e\377\5\30)d\377\31*e\377\34-g\377\36.h\377\35-g\377\202\36." \
+  "h\377\3\35-g\377\36.h\377\31*e\377\202\30)d\377\367\31*e\377\206\30)" \
+  "d\377\12\31*e\377\34,g\377\37/h\377!2j\377#4l\377&7n\377)9p\377*:p\377" \
+  "*:q\377*;q\377\205+;q\377\1,<q\377\216,<r\377\2,<q\377+;r\377\243,<r" \
+  "\377\1+;r\377\205+;q\377\202*:q\377\7*:p\377(8n\377%5m\377#3k\377\37" \
+  "0j\377\35.h\377\33,f\377\206\30)d\377\340\31*e\377\202\30)d\377\4\31" \
+  "*e\377\32*e\377\40""1j\377'7n\377\203(8o\377\1'7o\377\202(8o\377\202" \
+  "'7o\377\202&6o\377\213'7o\377\3&6n\377#3l\377\32+f\377\202\30)d\377\267" \
+  "\31*e\377\202\30)d\377\5\30)e\377\32+e\377!1k\377#3l\377\"2k\377\204" \
+  "#3l\377\1\"2k\377\202#3l\377\202\"2k\377\2!1j\377\33-g\377\202\30)d\377" \
+  "\263\31*e\377\13\30)d\377\31*e\377\34,g\377\36.h\377\35-g\377\35.h\377" \
+  "\36-g\377\35.h\377\35-g\377\31*e\377\30)d\377\377\31*e\377\205\30)d\377" \
+  "\202\27(d\377\23\30)d\377\31+e\377\33,f\377\35.h\377\37/i\377\40""1i" \
+  "\377\"2j\377#4k\377$4l\377%6m\377&6n\377'7n\377'8o\377(8o\377(9p\377" \
+  ")9p\377*:p\377*:q\377*;q\377\202+;q\377\232,<r\377\203+;q\377\2*:q\377" \
+  "*:p\377\202)9p\377\202(8o\377\14'7n\377&7n\377&6n\377%5m\377$4l\377#" \
+  "3k\377!1j\377\40""0i\377\36/h\377\34-g\377\33+f\377\31*d\377\202\27(" \
+  "d\377\1\27)d\377\205\30)d\377\343\31*e\377\202\30)d\377\4\31*e\377\34" \
+  "-g\377!2k\377'7n\377\202(8o\377\1'7n\377\203(8o\377\202'7o\377\202&6" \
+  "o\377\210'7o\377\6&6o\377'7n\377'7o\377&6n\377\"3k\377\34-g\377\202\30" \
+  ")d\377\271\31*e\377\6\30)d\377\31*e\377\34-g\377\"2l\377#3l\377\"2k\377" \
+  "\204#3l\377\2\"2k\377#3l\377\203\"2k\377\3\40""0i\377\32+e\377\30)d\377" \
+  "\264\31*e\377\13\30)d\377\31*e\377\35-g\377\36.h\377\35-g\377\36.h\377" \
+  "\36.g\377\36.h\377\34-g\377\31*e\377\30)d\377\377\31*e\377\210\31*e\377" \
+  "\212\30)d\377\10\31*d\377\31*e\377\32+e\377\32+f\377\33,f\377\34,g\377" \
+  "\34-g\377\35-g\377\202\35.h\377\13\36/h\377\36/i\377\37/i\377\37""0i" \
+  "\377\40""0j\377\40""1j\377!1j\377\40""1j\377!2j\377!2k\377\"2k\377\207" \
+  "\"3k\377\3\"2k\377!2j\377!1j\377\202\40""1j\377\1\40""0j\377\202\37""0" \
+  "i\377\1\37/i\377\202\36/h\377\202\35.h\377\202\34-g\377\6\33,g\377\33" \
+  ",f\377\32+f\377\32+e\377\31*e\377\31)e\377\212\30)d\377\350\31*e\377" \
+  "\202\30)d\377\4\31*e\377\37""0i\377$4l\377'7n\377\202(8o\377\2'7n\377" \
+  "'7o\377\202(8o\377\203'7o\377\1&6o\377\210'7o\377\2&7o\377'6n\377\202" \
+  "'7o\377\3!2k\377\34-g\377\31*e\377\202\30)d\377\271\31*e\377\4\30)d\377" \
+  "\32*e\377\40""0i\377#2k\377\206#3l\377\10\"2k\377#3l\377\"2k\377!1j\377" \
+  "!2k\377\35.h\377\31*e\377\30)d\377\264\31*e\377\13\30)d\377\32*e\377" \
+  "\35-g\377\36.h\377\35-g\377\36.h\377\35-h\377\36.h\377\34,g\377\31*e" \
+  "\377\30)d\377\377\31*e\377\222\31*e\377\220\30)d\377\1\30)e\377\220\31" \
+  "*e\377\2\31*d\377\30)e\377\220\30)d\377\357\31*e\377\202\30)d\377\4\32" \
+  "+f\377\40""2j\377&6n\377'7n\377\202(8o\377\2(8n\377'7o\377\202(8o\377" \
+  "\203'7o\377\202&6o\377\210'7o\377\1&7o\377\202'7o\377\3\"3k\377\33+f" \
+  "\377\31*e\377\203\30)d\377\270\31*e\377\202\30)d\377\5\34-g\377\"2k\377" \
+  "#3k\377#3l\377\"2k\377\206#3l\377\203\"2k\377\3\33,f\377\30)e\377\30" \
+  ")d\377\264\31*e\377\11\30)d\377\31*e\377\35.h\377\36.h\377\35-h\377\36" \
+  ".h\377\35-g\377\36.h\377\35-h\377\202\30)d\377\1\30)e\377\377\31*e\377" \
+  "\377\31*e\377\261\31*e\377\203\30)d\377\4\31*e\377\33,f\377!2k\377(8" \
+  "n\377\202(8o\377\2'7n\377'7o\377\202(8o\377\202'7o\377\202&6o\377\214" \
+  "'7o\377\3&6n\377$4m\377\34,g\377\202\30)d\377\272\31*e\377\202\30)d\377" \
+  "\4\31*e\377\36/i\377#2l\377\"2k\377\204#3l\377\1\"2k\377\202#3l\377\6" \
+  "\"2k\377!1j\377!1k\377\40""1j\377\31*e\377\30)d\377\264\31*e\377\202" \
+  "\30)d\377\5\32+f\377\35.h\377\36-g\377\35.h\377\35-g\377\202\36.h\377" \
+  "\2\34-g\377\30)d\377\377\31*e\377\377\31*e\377\262\31*e\377\203\30)d" \
+  "\377\3\33,f\377\36.h\377$3l\377\203(8o\377\2'7n\377'7o\377\202(8o\377" \
+  "\202'7o\377\202&6o\377\211'7o\377\1&6n\377\202'7o\377\3&6n\377\"3l\377" \
+  "\35.g\377\203\30)d\377\272\31*e\377\202\30)d\377\2\33,g\377!1j\377\206" \
+  "#3l\377\2\"2k\377#3l\377\202\"2k\377\5\"2j\377!1j\377\36.h\377\30*e\377" \
+  "\30)d\377\264\31*e\377\202\30)d\377\4\32+f\377\36.h\377\36-g\377\35." \
+  "h\377\202\36.h\377\2\36-h\377\34,f\377\377\31*e\377\377\31*e\377\262" \
+  "\31*e\377\203\30)d\377\3\34-g\377\"2k\377%5m\377\203(8o\377\2'7n\377" \
+  "'7o\377\202(8o\377\203'7o\377\202&6o\377\210'7o\377\1&6n\377\203'7o\377" \
+  "\3!1k\377\34-g\377\31*e\377\202\30)d\377\272\31*e\377\202\30)d\377\5" \
+  "\31*e\377\36/i\377\"2k\377#3l\377\"2k\377\206#3l\377\203\"2k\377\4!1" \
+  "j\377\33,g\377\31*e\377\30)d\377\264\31*e\377\5\30)d\377\31*e\377\33" \
+  ",f\377\35-h\377\35-g\377\202\36.h\377\5\35-g\377\36.h\377\33,f\377\31" \
+  "*e\377\30)d\377\377\31*e\377\377\31*e\377\257\31*e\377\202\30)d\377\4" \
+  "\31*e\377\37/i\377%5m\377'7n\377\203(8o\377\4'7n\377(8o\377'7o\377(8" \
+  "o\377\202'7o\377\203&6o\377\211'7o\377\6&6n\377'7o\377&6o\377!2k\377" \
+  "\33,e\377\31*e\377\203\30)d\377\273\31*e\377\3\30)d\377\32+f\377!1j\377" \
+  "\202#3l\377\1\"2k\377\204#3l\377\1\"2k\377\202#3l\377\6!1j\377\"2k\377" \
+  "\36/i\377\31*e\377\30)e\377\30)d\377\265\31*e\377\4\30)d\377\33,g\377" \
+  "\36.h\377\36.g\377\202\36.h\377\3\35-g\377\36.h\377\33,f\377\202\30)" \
+  "d\377\377\31*e\377\377\31*e\377\254\31*e\377\202\30)d\377\202\31*e\377" \
+  "\3\32+f\377!2k\377'7n\377\202(8o\377\4'7n\377(8o\377'7o\377(8o\377\203" \
+  "'7o\377\202&6o\377\214'7o\377\202&6n\377\2\"2k\377\32+f\377\202\30)d" \
+  "\377\274\31*e\377\202\30)d\377\2\31*e\377\35.h\377\202#3l\377\1\"2k\377" \
+  "\207#3l\377\1\"2k\377\202!1j\377\2\35-g\377\30*d\377\266\31*e\377\7\30" \
+  ")d\377\31*e\377\34-g\377\36.h\377\35-g\377\36.h\377\36-g\377\202\36." \
+  "h\377\2\33,f\377\30)d\377\377\31*e\377\377\31*e\377\253\31*e\377\203" \
+  "\30)d\377\4\31*e\377\33,g\377\37""0i\377$4l\377\203(8o\377\2'7n\377'" \
+  "7o\377\203(8o\377\202'7o\377\202&6o\377\211'7o\377\2&6o\377'7n\377\202" \
+  "'7o\377\3$4m\377!1j\377\32,f\377\202\30)d\377\275\31*e\377\202\30)d\377" \
+  "\4\33,f\377\40""1j\377#3l\377\"2k\377\205#3l\377\2\"2k\377#3l\377\203" \
+  "\"2k\377\2\37/i\377\32,f\377\202\30)d\377\264\31*e\377\202\30)d\377\12" \
+  "\31*e\377\34-g\377\36.h\377\35-g\377\36.h\377\35-h\377\36.h\377\35-g" \
+  "\377\32+f\377\30)d\377\377\31*e\377\377\31*e\377\253\31*e\377\202\30" \
+  ")d\377\4\32+f\377\37""0i\377#4l\377&6n\377\203(8o\377\4'7n\377(8o\377" \
+  "'7o\377(8o\377\203'7o\377\202&6o\377\215'7o\377\3#3l\377\36/i\377\32" \
+  "+f\377\202\30)d\377\276\31*e\377\6\30)d\377\31*e\377\37/i\377\"2k\377" \
+  "#3l\377\"2k\377\204#3l\377\1\"2k\377\202#3l\377\202\"2k\377\4!1j\377" \
+  "\35-h\377\31*e\377\30)d\377\266\31*e\377\14\30)d\377\31*e\377\34-g\377" \
+  "\36.h\377\35-h\377\36.h\377\35-g\377\36.h\377\35-h\377\32+e\377\30)e" \
+  "\377\30)d\377\377\31*e\377\377\31*e\377\250\31*e\377\203\30)d\377\4\35" \
+  ".h\377$4l\377&7n\377'7n\377\203(8o\377\2'7n\377'7o\377\203(8o\377\202" \
+  "'7o\377\202&6o\377\212'7o\377\1&6n\377\202'7o\377\2#4l\377\34-g\377\202" \
+  "\31*e\377\202\30)d\377\275\31*e\377\202\30)d\377\5\34,f\377\"2k\377\"" \
+  "2l\377#3l\377\"2k\377\204#3l\377\2\"2k\377#3l\377\203\"2k\377\4!1j\377" \
+  "\32+f\377\31*e\377\30)d\377\266\31*e\377\14\30)d\377\31*e\377\36.h\377" \
+  "\35.h\377\36-g\377\36.h\377\35-g\377\36.h\377\35-g\377\31*e\377\31*d" \
+  "\377\30)d\377\377\31*e\377\377\31*e\377\244\31*e\377\203\30)d\377\202" \
+  "\31*e\377\3\33,f\377!1j\377'7n\377\202(8o\377\1(8n\377\202'7o\377\202" \
+  "(8o\377\203'7o\377\202&6o\377\212'7o\377\1&6n\377\202'7o\377\202&6n\377" \
+  "\2#3l\377\33,g\377\203\30)d\377\276\31*e\377\202\30)d\377\4\31*e\377" \
+  "\36/i\377#3l\377\"2k\377\205#3l\377\2\"2k\377#3l\377\202\"2k\377\202" \
+  "!1j\377\3\37/i\377\30*e\377\30)d\377\266\31*e\377\202\30)d\377\3\32+" \
+  "f\377\36.h\377\35-g\377\204\36.h\377\1\34-g\377\377\31*e\377\377\31*" \
+  "e\377\246\31*e\377\203\30)d\377\4\32+e\377\34-g\377\40""0i\377$4l\377" \
+  "\203(8o\377\3'7n\377(8o\377'7o\377\202(8o\377\202'7o\377\203&6o\377\212" \
+  "'7o\377\1&6n\377\202'7o\377\4&7o\377$4m\377\40""1j\377\33,f\377\202\30" \
+  ")d\377\277\31*e\377\202\30)d\377\3\31*e\377\34,g\377!1k\377\206#3l\377" \
+  "\1\"2k\377\202#3l\377\5\"2k\377!1j\377\"2k\377\40""0j\377\34-g\377\202" \
+  "\30)d\377\266\31*e\377\5\30)d\377\31*d\377\33,f\377\36.h\377\35-g\377" \
+  "\202\36.h\377\5\35-g\377\36.h\377\34,g\377\31*e\377\30)d\377\377\31*" \
+  "e\377\377\31*e\377\243\31*e\377\202\30)d\377\5\31*e\377\35.g\377\"2k" \
+  "\377$5l\377'7n\377\203(8o\377\1'7n\377\204(8o\377\203'7o\377\202&6o\377" \
+  "\212'7o\377\1&6n\377\202'7o\377\4&7o\377\"2k\377\35.h\377\32+f\377\203" \
+  "\30)d\377\277\31*e\377\202\30)d\377\5\33+f\377\40""0i\377#3k\377#3l\377" \
+  "\"2k\377\206#3l\377\204\"2k\377\3\36.h\377\31*e\377\30)d\377\267\31*" \
+  "e\377\202\30)d\377\2\34-g\377\35-g\377\202\36.h\377\6\35.h\377\36-g\377" \
+  "\36.h\377\33,f\377\31*e\377\30)d\377\377\31*e\377\377\31*e\377\240\31" \
+  "*e\377\204\30)d\377\5\35.h\377#4k\377&6n\377'7n\377'7o\377\204(8o\377" \
+  "\1'7o\377\202(8o\377\203'7o\377\203&6o\377\212'7o\377\1&6n\377\202'7" \
+  "o\377\4&6n\377\40""0j\377\32+f\377\31*e\377\203\30)d\377\300\31*e\377" \
+  "\202\30)d\377\5\35.h\377\"2k\377#3k\377#3l\377\"2k\377\204#3l\377\1\"" \
+  "2k\377\202#3l\377\5!1j\377\"2k\377!1j\377\32+f\377\31*e\377\202\30)d" \
+  "\377\266\31*e\377\3\30)d\377\31*e\377\34-g\377\202\36.h\377\7\35-g\377" \
+  "\35-h\377\36.g\377\35.h\377\32+f\377\31*e\377\30)d\377\377\31*e\377\377" \
+  "\31*e\377\234\31*e\377\1\30)e\377\202\30)d\377\6\31*d\377\31*e\377\32" \
+  "+e\377\34-g\377\"2k\377'7n\377\203(8o\377\2'7n\377'7o\377\203(8o\377" \
+  "\203'7o\377\202&6o\377\213'7o\377\1&6n\377\202'7o\377\5'6n\377&6n\377" \
+  "$4m\377\36/i\377\31*d\377\202\30)d\377\301\31*e\377\202\30)d\377\6\31" \
+  "*e\377\32+e\377!1k\377#3l\377#3k\377\"2l\377\207#3l\377\1\"2k\377\202" \
+  "!1j\377\3\36/i\377\31*e\377\30)d\377\267\31*e\377\202\30)d\377\12\31" \
+  "*e\377\35.h\377\36-g\377\35.h\377\36.h\377\35-g\377\36.h\377\35-g\377" \
+  "\33+f\377\31*d\377\377\31*e\377\377\31*e\377\233\31*e\377\204\30)d\377" \
+  "\6\32+e\377\34-g\377\36/h\377#3l\377&7m\377)8o\377\202(8o\377\3'7n\377" \
+  "(8o\377'7o\377\202(8o\377\203'7o\377\203&6o\377\213'7o\377\1&6n\377\202" \
+  "'7o\377\4&6o\377$4m\377!2j\377\34-g\377\203\30)d\377\302\31*e\377\202" \
+  "\30)d\377\2\32+e\377\36/h\377\202#3l\377\1\"2k\377\205#3l\377\2\"2k\377" \
+  "#3l\377\203\"2k\377\2\40""0j\377\34,g\377\202\30)d\377\270\31*e\377\4" \
+  "\30)d\377\32+f\377\35-g\377\36-g\377\202\36.h\377\6\35-g\377\36.h\377" \
+  "\35-g\377\32+e\377\30)d\377\30)e\377\377\31*e\377\377\31*e\377\230\31" \
+  "*e\377\204\30)d\377\5\32+e\377\36/h\377\"2k\377$5l\377&7n\377\203(8o" \
+  "\377\1'7n\377\205(8o\377\203'7o\377\202&6o\377\214'7o\377\1'6n\377\202" \
+  "'7o\377\4&6o\377\"2k\377\35.h\377\32+f\377\203\30)d\377\302\31*e\377" \
+  "\5\30)e\377\30)d\377\31*d\377\36.h\377!1j\377\207#3l\377\1\"2k\377\202" \
+  "#3l\377\202\"2k\377\3!1j\377\35.h\377\32*e\377\202\30)d\377\267\31*e" \
+  "\377\202\30)d\377\12\33,g\377\35-g\377\36.h\377\35-g\377\36.h\377\35" \
+  "-g\377\36.h\377\34-g\377\31*e\377\30)d\377\377\31*e\377\377\31*e\377" \
+  "\227\31*e\377\1\30*e\377\203\30)d\377\3\33,f\377\40""0j\377%5m\377\202" \
+  "'7n\377\1'7o\377\203(8o\377\3'7n\377(8o\377'7o\377\202(8o\377\203'7o" \
+  "\377\203&6o\377\214'7o\377\1&6n\377\202'7o\377\4%5n\377\37/i\377\32*" \
+  "e\377\31*e\377\203\30)d\377\303\31*e\377\202\30)d\377\3\33,f\377!1j\377" \
+  "\"2k\377\202#3l\377\1\"2k\377\206#3l\377\203\"2k\377\4\40""0j\377\32" \
+  "+f\377\31*e\377\30)d\377\270\31*e\377\14\30)d\377\31*e\377\34-g\377\35" \
+  ".h\377\36.h\377\35-g\377\36.h\377\36.g\377\36.h\377\34,g\377\31*e\377" \
+  "\30)d\377\350\31*e\377\203\30)d\377\377\31*e\377\246\31*e\377\204\30" \
+  ")d\377\202\31*e\377\4\32*e\377\35.h\377\"2k\377'7n\377\203(8o\377\1'" \
+  "7n\377\206(8o\377\203'7o\377\202&6o\377\214'7o\377\1&6n\377\203'7o\377" \
+  "\202&6n\377\2\"3l\377\34-g\377\203\30)d\377\304\31*e\377\202\30)d\377" \
+  "\4\31*d\377\31*e\377\36.i\377#3k\377\206#3l\377\1\"2k\377\202#3l\377" \
+  "\7\"2k\377!1j\377\"2j\377!1j\377\35.h\377\31*e\377\30)d\377\271\31*e" \
+  "\377\3\30)d\377\31*e\377\35-g\377\203\36.h\377\6\35-g\377\36.h\377\35" \
+  "-g\377\33,f\377\31*d\377\30)d\377\351\31*e\377\2\33,f\377\31*e\377\204" \
+  "\30)d\377\377\31*e\377\237\31*e\377\205\30)d\377\5\32+f\377\34,g\377" \
+  "\35.h\377!1j\377$4l\377\204(8o\377\1'7n\377\202(8o\377\1'7o\377\202(" \
+  "8o\377\204'7o\377\203&6o\377\214'7o\377\1&6n\377\203'7o\377\4$5m\377" \
+  "\"2k\377\36/i\377\32+e\377\203\30)d\377\305\31*e\377\202\30)d\377\3\31" \
+  "*e\377\35-g\377\"2k\377\202#3l\377\1\"2k\377\204#3l\377\2\"2k\377#3l" \
+  "\377\204\"2k\377\2\37/i\377\32+f\377\202\30)d\377\270\31*e\377\202\30" \
+  ")d\377\13\32+f\377\35-g\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h" \
+  "\377\35-g\377\32+f\377\30)d\377\30)e\377\352\31*e\377\5%6m\377$4l\377" \
+  "!1j\377\36/h\377\33,f\377\204\30)d\377\1\30*e\377\377\31*e\377\230\31" \
+  "*e\377\204\30)d\377\6\31*e\377\35-h\377\40""0j\377#3k\377$5m\377&6n\377" \
+  "\204(8o\377\1'7n\377\202(8o\377\1'7o\377\203(8o\377\203'7o\377\203&6" \
+  "o\377\214'7o\377\1&6n\377\203'7o\377\5&6n\377!2k\377\35.h\377\33,f\377" \
+  "\30)e\377\203\30)d\377\306\31*e\377\202\30)d\377\2\34-g\377\40""1j\377" \
+  "\202#3l\377\1\"2k\377\205#3l\377\2\"2k\377#3l\377\203\"2k\377\4\40""1" \
+  "i\377\34,g\377\31*e\377\30)d\377\271\31*e\377\14\30)d\377\30*e\377\33" \
+  ",f\377\35.h\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\35-g\377" \
+  "\32*e\377\30)d\377\354\31*e\377\202(8o\377\203'7n\377\4&6m\377#3l\377" \
+  "\37/i\377\32+f\377\204\30)d\377\377\31*e\377\221\31*e\377\204\30)d\377" \
+  "\4\31*e\377\35.g\377\40""1j\377%5m\377\203'7n\377\204(8o\377\1'8o\377" \
+  "\202(8o\377\1'7o\377\203(8o\377\204'7o\377\202&6o\377\215'7o\377\1&6" \
+  "n\377\203'7o\377\2$3l\377\36/h\377\202\31*e\377\203\30)d\377\307\31*" \
+  "e\377\202\30)d\377\3\32+e\377!1j\377\"2k\377\207#3l\377\1\"2k\377\202" \
+  "#3l\377\203\"2k\377\4\35.h\377\31*e\377\30)e\377\30)d\377\271\31*e\377" \
+  "\14\30)d\377\31*e\377\34,g\377\35.h\377\36-g\377\35.h\377\36.h\377\35" \
+  "-h\377\36.h\377\35-g\377\31*e\377\30)d\377\355\31*e\377\2(8o\377'7o\377" \
+  "\202(8o\377\1'7n\377\204(8o\377\4'7n\377$3l\377\37""0i\377\33,g\377\204" \
+  "\31*e\377\205\30)d\377\377\31*e\377\205\30)d\377\203\31*e\377\4\32+f" \
+  "\377\36.h\377!1k\377%5m\377\204(8o\377\1'7n\377\202(8o\377\1'7o\377\203" \
+  "(8o\377\204'7o\377\204&6o\377\215'7o\377\1&6n\377\203'7o\377\202&6n\377" \
+  "\3$5m\377\40""0i\377\32+e\377\202\30)d\377\311\31*e\377\2\30)e\377\30" \
+  ")d\377\202\31*e\377\4\36/h\377#3k\377#3l\377\"2k\377\205#3l\377\1\"2" \
+  "k\377\202#3l\377\1\"2k\377\202!1j\377\3\40""0j\377\33+f\377\30)d\377" \
+  "\272\31*e\377\202\30)d\377\13\31*e\377\34-g\377\36.h\377\35-g\377\36" \
+  ".h\377\35-g\377\36.h\377\35-g\377\34,g\377\31*d\377\30)d\377\356\31*" \
+  "e\377\1'7o\377\203(8o\377\1'7o\377\203(8o\377\1'7n\377\204(8o\377\10" \
+  "'7o\377$5m\377\"2k\377\37""0i\377\35.h\377\34,g\377\32+f\377\31*e\377" \
+  "\205\30)d\377\366\31*e\377\206\30)d\377\7\32*e\377\33,f\377\34-g\377" \
+  "\36/h\377!1j\377#3l\377&6m\377\204(8o\377\2(8n\377'7o\377\202(8o\377" \
+  "\1'7o\377\203(8o\377\204'7o\377\203&6o\377\217'7o\377\1&6n\377\202'7" \
+  "o\377\5'7n\377%5m\377\"3l\377\37""0i\377\33,g\377\203\30)d\377\312\31" \
+  "*e\377\202\30)d\377\3\32+e\377\35-h\377!2j\377\207#3l\377\1\"2k\377\202" \
+  "#3l\377\203\"2k\377\5\40""0j\377\35-h\377\31*d\377\30)d\377\30)e\377" \
+  "\271\31*e\377\15\30)d\377\30)e\377\32+e\377\35.h\377\36.h\377\35-g\377" \
+  "\36.h\377\35-g\377\36.h\377\35-g\377\33+f\377\30)d\377\30)e\377\357\31" \
+  "*e\377\1&6o\377\203'7o\377\204(8o\377\1'7o\377\203(8o\377\1(8n\377\204" \
+  "(8o\377\12'7o\377&6n\377%5m\377#4l\377\"2k\377\37""0i\377\35.h\377\33" \
+  ",f\377\30)e\377\27(d\377\204\30)d\377\1\30)e\377\354\31*e\377\205\30" \
+  ")d\377\10\31+e\377\34,g\377\36/h\377!1j\377#3k\377$4l\377%6m\377'7n\377" \
+  "\205(8o\377\1'7n\377\203(8o\377\1'7o\377\203(8o\377\204'7o\377\203&6" \
+  "o\377\223'7o\377\5%5m\377\40""1j\377\35.h\377\33,f\377\31*e\377\203\30" \
+  ")d\377\313\31*e\377\202\30)d\377\2\35-g\377\40""1j\377\202#3l\377\1\"" \
+  "2k\377\207#3l\377\203\"2k\377\3!1k\377\36.h\377\32+f\377\202\30)d\377" \
+  "\272\31*e\377\14\30)d\377\31*e\377\33,g\377\36.h\377\36-g\377\35.h\377" \
+  "\36.h\377\35-h\377\36.h\377\35-g\377\32+e\377\30)d\377\361\31*e\377\204" \
+  "&6o\377\204'7o\377\210(8o\377\1(8n\377\205(8o\377\203'7n\377\6&7n\377" \
+  "$5l\377\"2k\377\37/i\377\34-g\377\31*e\377\205\30)d\377\342\31*e\377" \
+  "\206\30)d\377\5\32+f\377\36.h\377\40""1i\377#3l\377&6n\377\204'7n\377" \
+  "\205(8o\377\1'7n\377\203(8o\377\1'7o\377\204(8o\377\204'7o\377\203&6" \
+  "o\377\217'7o\377\1&6n\377\203'7o\377\3%5m\377\40""1j\377\33,f\377\202" \
+  "\31*e\377\203\30)d\377\314\31*e\377\202\30)d\377\5\33,f\377!1j\377\"" \
+  "2k\377#3l\377\"2k\377\206#3l\377\2\"2k\377#3l\377\203\"2k\377\4\37""0" \
+  "i\377\32+f\377\31*e\377\30)d\377\273\31*e\377\202\30)d\377\1\34-g\377" \
+  "\204\36.h\377\6\35-g\377\36.h\377\35-h\377\31*d\377\30)e\377\30)d\377" \
+  "\361\31*e\377\210'7o\377\203&6o\377\205'7o\377\211(8o\377\1'7n\377\205" \
+  "(8o\377\7'6n\377$4l\377\"2j\377\37/i\377\34-f\377\32+e\377\32*e\377\204" \
+  "\31*e\377\210\30)d\377\306\31*e\377\210\30)d\377\205\31*e\377\6\32*e" \
+  "\377\33,f\377\35.h\377\40""1j\377#3l\377&6m\377\205(8o\377\2(8n\377'" \
+  "7o\377\204(8o\377\1'7o\377\204(8o\377\204'7o\377\205&6o\377\223'7o\377" \
+  "\1'7n\377\202&6n\377\3$4l\377\40""0i\377\33+e\377\203\30)d\377\316\31" \
+  "*e\377\202\30)d\377\3\31*e\377\32+f\377\40""0j\377\202#3l\377\1\"2k\377" \
+  "\207#3l\377\202\"2k\377\4!1j\377!2k\377!1j\377\34,g\377\202\30)d\377" \
+  "\273\31*e\377\15\30)d\377\30)e\377\31*e\377\35.h\377\36.h\377\35-g\377" \
+  "\36.h\377\36-g\377\36.h\377\36.g\377\34,g\377\30)d\377\30)e\377\363\31" \
+  "*e\377\213'7o\377\204&6o\377\204'7o\377\205(8o\377\1'7o\377\205(8o\377" \
+  "\1'7n\377\206(8o\377\14'7n\377%5m\377#4l\377!2j\377\40""0i\377\36/h\377" \
+  "\35.h\377\34-g\377\33,f\377\33+f\377\32+e\377\31*e\377\213\30)d\377\263" \
+  "\31*e\377\212\30)d\377\16\31*e\377\32*e\377\32+f\377\33,f\377\34-g\377" \
+  "\35-g\377\36.h\377\37/i\377!1j\377\"2k\377$4l\377&6m\377(8o\377)8o\377" \
+  "\212(8o\377\1'7o\377\205(8o\377\204'7o\377\205&6o\377\220'7o\377\1&6" \
+  "n\377\204'7o\377\5%5n\377#4l\377!1j\377\36/h\377\32+f\377\203\30)d\377" \
+  "\317\31*e\377\202\30)d\377\6\31*d\377\33+f\377\36/h\377\"3k\377#3l\377" \
+  "\"2k\377\205#3l\377\1\"2k\377\202#3l\377\203\"2k\377\4\40""1j\377\36" \
+  ".h\377\31*e\377\30)d\377\274\31*e\377\14\30)d\377\31*d\377\33+f\377\36" \
+  ".h\377\36-g\377\35.h\377\36.h\377\35-g\377\36.h\377\35-h\377\33,f\377" \
+  "\30*d\377\365\31*e\377\217'7o\377\204&6o\377\205'7o\377\205(8o\377\1" \
+  "'7o\377\215(8o\377\20'7o\377'7n\377&6m\377%5m\377$5l\377#4l\377#3k\377" \
+  "\"2k\377\40""1j\377\37""0i\377\36/h\377\35-g\377\34,g\377\32+f\377\31" \
+  "*e\377\30)e\377\202\27)d\377\217\30)d\377\223\31*e\377\217\30)d\377\21" \
+  "\27(d\377\30)d\377\31*e\377\32+f\377\33,f\377\34-g\377\35.h\377\37/h" \
+  "\377\40""0i\377!2j\377\"3k\377#3l\377$4l\377%5m\377&6m\377&6n\377'7n" \
+  "\377\207(8o\377\1'7n\377\205(8o\377\1'7o\377\205(8o\377\205'7o\377\205" \
+  "&6o\377\221'7o\377\1&6n\377\204'7o\377\5$4m\377\40""1j\377\36.h\377\33" \
+  ",g\377\31+e\377\204\30)d\377\320\31*e\377\202\30)d\377\3\32+f\377\37" \
+  "0i\377\"2k\377\202#3l\377\1\"2k\377\205#3l\377\2\"2k\377#3l\377\203\"" \
+  "2k\377\3\"1j\377\36.h\377\32+f\377\202\30)d\377\274\31*e\377\4\30)d\377" \
+  "\31*e\377\34-g\377\35.g\377\203\36.h\377\6\35-g\377\36.h\377\34-g\377" \
+  "\31*e\377\30)e\377\30)d\377\365\31*e\377\223'7o\377\205&6o\377\205'7" \
+  "o\377\205(8o\377\1'7o\377\207(8o\377\1'7n\377\210(8o\377\206'7n\377\1" \
+  "&7n\377\202&6n\377\12%5m\377$4l\377#3k\377\"2k\377\40""1j\377\37""0i" \
+  "\377\37/i\377\36/h\377\35-h\377\34-g\377\202\33,f\377\1\32+f\377\202" \
+  "\31*e\377\224\30)d\377\202\31*e\377\3\32+e\377\32+f\377\33,f\377\202" \
+  "\34-g\377\13\35.h\377\36/h\377\37""0i\377\40""1j\377!1j\377\"2k\377$" \
+  "4l\377%5l\377&6m\377&6n\377&7n\377\207'7n\377\225(8o\377\206'7o\377\205" \
+  "&6o\377\222'7o\377\1&6n\377\203'7o\377\4&6n\377\"2k\377\36.h\377\32+" \
+  "f\377\202\31*e\377\204\30)d\377\321\31*e\377\202\30)d\377\6\31*e\377" \
+  "\37/i\377\"2k\377\"3k\377#3l\377\"2k\377\210#3l\377\6\"2k\377\"1j\377" \
+  "\"2k\377\40""0i\377\32+f\377\31*e\377\202\30)d\377\274\31*e\377\13\30" \
+  ")d\377\32+f\377\35-g\377\35.h\377\36.h\377\35-g\377\36.h\377\35-g\377" \
+  "\36.h\377\33,f\377\31*e\377\202\30)d\377\366\31*e\377\203&6n\377\204" \
+  "'7o\377\1&6n\377\224'7o\377\205&6o\377\207'7o\377\207(8o\377\1'7o\377" \
+  "\213(8o\377\1'7n\377\222(8o\377\1'7o\377\203'7n\377\1&7n\377\204&6n\377" \
+  "\202&7n\377\202'7n\377\2'7o\377'8o\377\222(8o\377\1'7n\377\213(8o\377" \
+  "\1'7o\377\206(8o\377\207'7o\377\205&6o\377\225'7o\377\1&6n\377\204'7" \
+  "o\377\203&6n\377\3$4l\377\37""0i\377\33+f\377\204\30)d\377\324\31*e\377" \
+  "\202\30)d\377\202\31*e\377\1\36.h\377\202#3l\377\1\"2k\377\205#3l\377" \
+  "\1\"2k\377\202#3l\377\202\"2k\377\202!1j\377\2\40""1j\377\34-g\377\202" \
+  "\30)d\377\275\31*e\377\5\30)d\377\31*e\377\32+f\377\35.g\377\35-g\377" \
+  "\202\36.h\377\5\35-g\377\36.h\377\35-g\377\33,f\377\30)e\377\371\31*" \
+  "e\377\6\32+f\377\35.h\377\40""1j\377\"3l\377$4m\377&6n\377\205'7o\377" \
+  "\1&6n\377\225'7o\377\207&6o\377\207'7o\377\210(8o\377\1'7o\377\224(8" \
+  "o\377\3'8o\377(7o\377(8n\377\215(8o\377\2(7o\377'8o\377\225(8o\377\1" \
+  "'7o\377\210(8o\377\207'7o\377\206&6o\377\226'7o\377\1&6o\377\204'7o\377" \
+  "\7&6n\377%5m\377#4l\377\"2k\377\37/i\377\34-g\377\31*e\377\204\30)d\377" \
+  "\325\31*e\377\203\30)d\377\3\32+f\377\35.h\377\"2k\377\210#3l\377\2\"" \
+  "2k\377#3l\377\204\"2k\377\4\40""0j\377\35-h\377\31*d\377\30)d\377\276" \
+  "\31*e\377\3\30)d\377\31*e\377\34,g\377\204\36.h\377\4\35-g\377\36.h\377" \
+  "\35-g\377\32+e\377\202\30)d\377\371\31*e\377\203\30)d\377\7\31*e\377" \
+  "\32+f\377\34,g\377\35.h\377\40""1j\377#3l\377&5n\377\205'7o\377\1&6n" \
+  "\377\230'7o\377\206&6o\377\211'7o\377\214(8o\377\1'7o\377\243(8o\377" \
+  "\1'7o\377\214(8o\377\210'7o\377\207&6o\377\230'7o\377\1&7o\377\204'7" \
+  "o\377\7&7o\377$4m\377!2k\377\36/i\377\34-g\377\33,f\377\31*e\377\205" \
+  "\30)d\377\327\31*e\377\202\30)d\377\3\32+f\377\37/i\377!1k\377\202#3" \
+  "l\377\1\"2k\377\205#3l\377\1\"2k\377\202#3l\377\203\"2k\377\3!1j\377" \
+  "\35.g\377\32+e\377\202\30)d\377\275\31*e\377\202\30)d\377\6\32+f\377" \
+  "\35-g\377\36.h\377\36-g\377\35.h\377\35-g\377\202\36.h\377\3\34,g\377" \
+  "\31*e\377\30)d\377\376\31*e\377\204\30)d\377\203\31*e\377\4\33,f\377" \
+  "\36.h\377!2j\377%4m\377\205'7o\377\1&6n\377\232'7o\377\210&6o\377\215" \
+  "'7o\377\245(8o\377\214'7o\377\210&6o\377\233'7o\377\1&6n\377\204'7o\377" \
+  "\4&7o\377#3l\377\37""0j\377\34-g\377\204\31*e\377\204\30)d\377\331\31" \
+  "*e\377\202\30)d\377\6\31*e\377\37/i\377\"2k\377#2k\377#3l\377\"2k\377" \
+  "\210#3l\377\203\"2k\377\2\"1k\377\36.h\377\202\31*e\377\202\30)d\377" \
+  "\275\31*e\377\6\30)d\377\30)e\377\33,f\377\35-h\377\36.h\377\35-g\377" \
+  "\203\36.h\377\4\36-g\377\33+f\377\31*e\377\30)d\377\377\31*e\377\207" \
+  "\31*e\377\204\30)d\377\5\31*e\377\33,g\377\37""0i\377\"2l\377%5m\377" \
+  "\203&6n\377\1&6o\377\205'7o\377\1&6n\377\245'7o\377\246&6o\377\246'7" \
+  "o\377\1&6n\377\205'7o\377\203&6n\377\5%6n\377$4l\377!1j\377\36.h\377" \
+  "\32+f\377\204\30)d\377\336\31*e\377\202\30)d\377\3\31*e\377\32+e\377" \
+  "\36/h\377\202#3l\377\1\"2k\377\210#3l\377\202\"2k\377\5!1j\377\"1j\377" \
+  "!1j\377\37""0i\377\32+f\377\202\30)d\377\276\31*e\377\1\30)d\377\202" \
+  "\31*e\377\12\34-g\377\36.h\377\35-g\377\36.h\377\35-g\377\36.h\377\35" \
+  ".h\377\35-g\377\32+f\377\30)d\377\377\31*e\377\215\31*e\377\205\30)d" \
+  "\377\10\31+f\377\34-g\377\36/i\377\40""1k\377\"3k\377#4l\377$5m\377&" \
+  "6n\377\206'7o\377\1&6n\377\346'7o\377\1&6n\377\206'7o\377\11&6n\377%" \
+  "5m\377$4m\377#3l\377\"2k\377\37""0i\377\35.h\377\33,f\377\30)e\377\204" \
+  "\30)d\377\340\31*e\377\202\30)d\377\4\31*e\377\33,f\377\36/h\377\"2k" \
+  "\377\210#3l\377\2\"2k\377#3l\377\204\"2k\377\3!1j\377\37/i\377\33,f\377" \
+  "\202\30)d\377\277\31*e\377\15\30)d\377\31*e\377\33+f\377\35.h\377\36" \
+  ".h\377\35-g\377\36.h\377\35-g\377\36.h\377\35.g\377\33,g\377\31*e\377" \
+  "\30)d\377\377\31*e\377\222\31*e\377\205\30)d\377\13\31*d\377\32+e\377" \
+  "\33,f\377\34-g\377\35.g\377\36/i\377!1j\377#3k\377$4m\377&6n\377(8o\377" \
+  "\340'7o\377\1&6n\377\207'7o\377\11%5m\377#4l\377!2k\377\40""0j\377\36" \
+  ".h\377\34-g\377\33,f\377\32+f\377\31*e\377\205\30)d\377\343\31*e\377" \
+  "\202\30)d\377\3\34,f\377\37""0i\377\"2k\377\202#3l\377\1\"2k\377\205" \
+  "#3l\377\1\"2k\377\202#3l\377\204\"2k\377\4\37/i\377\33+f\377\31*e\377" \
+  "\30)d\377\300\31*e\377\13\30)d\377\31*e\377\34,g\377\36.h\377\36-g\377" \
+  "\35.h\377\36.h\377\35-h\377\36.h\377\35-g\377\32+f\377\202\30)d\377\377" \
+  "\31*e\377\230\31*e\377\205\30)d\377\204\31*e\377\7\32*e\377\32+f\377" \
+  "\35-h\377\37/i\377!2j\377#4l\377&6n\377\207'7o\377\2&6o\377'7n\377\323" \
+  "'7o\377\6&6n\377%5m\377\"2k\377\40""0i\377\36/h\377\33,f\377\205\31*" \
+  "e\377\206\30)d\377\344\31*e\377\203\30)d\377\3\34-g\377!1j\377\"2k\377" \
+  "\202#3l\377\1\"2k\377\206#3l\377\2\"2k\377#3l\377\202\"2k\377\5\"1j\377" \
+  "\"2k\377\37""0j\377\32+f\377\31*e\377\202\30)d\377\300\31*e\377\4\30" \
+  ")d\377\31*e\377\35-g\377\35-h\377\203\36.h\377\4\35-g\377\36.h\377\35" \
+  "-h\377\31*e\377\202\30)d\377\377\31*e\377\243\31*e\377\206\30)d\377\11" \
+  "\31*d\377\32+e\377\34-g\377\36/h\377\40""0j\377\"3k\377$4l\377%6m\377" \
+  "%6n\377\206&6n\377\215'7o\377\1&6n\377\243'7o\377\1&6n\377\214'7o\377" \
+  "\207&6n\377\10%6n\377%5n\377#3l\377!2j\377\40""0i\377\35.h\377\33,g\377" \
+  "\31*e\377\206\30)d\377\354\31*e\377\202\30)d\377\202\31*e\377\2\34-g" \
+  "\377!1k\377\202#3l\377\1\"2k\377\210#3l\377\202\"2k\377\7!1j\377\"1k" \
+  "\377!1j\377\40""1j\377\33,f\377\31*d\377\30)d\377\300\31*e\377\202\30" \
+  ")d\377\4\31*e\377\33,f\377\36.h\377\35-g\377\204\36.h\377\2\35.g\377" \
+  "\34,g\377\202\30)d\377\377\31*e\377\253\31*e\377\1\30)e\377\207\30)d" \
+  "\377\14\31*e\377\33+f\377\33-f\377\35-g\377\36.h\377\37/i\377\40""1j" \
+  "\377!2k\377\"2k\377\"3k\377#3l\377#4l\377\202$4m\377\2%5m\377%5n\377" \
+  "\202&6n\377\1&6o\377\247'7o\377\203&6n\377\2%5n\377%5m\377\202$4m\377" \
+  "\202#3l\377\13\"3l\377\"2k\377!1j\377\40""0i\377\36/i\377\35.h\377\34" \
+  "-g\377\33,f\377\32*e\377\30)e\377\27)d\377\206\30)d\377\1\30)e\377\357" \
+  "\31*e\377\6\30)e\377\30)d\377\31*e\377\32+f\377\35.h\377!1j\377\202#" \
+  "3l\377\1#3k\377\206#3l\377\2\"2k\377#3l\377\204\"2k\377\6!1k\377\37/" \
+  "i\377\33,g\377\31*d\377\30)d\377\30)e\377\300\31*e\377\202\30)d\377\4" \
+  "\31*e\377\34-g\377\36.h\377\35-g\377\202\36.h\377\5\35-g\377\36.h\377" \
+  "\35-g\377\32+f\377\30)d\377\377\31*e\377\264\31*e\377\1\30)e\377\211" \
+  "\30)d\377\2\31*d\377\31*e\377\202\32+f\377\3\33+f\377\33,f\377\34,g\377" \
+  "\202\34-g\377\1\35-h\377\202\35.h\377\7\36/i\377\37/i\377\37""0i\377" \
+  "\37""0j\377\40""1j\377!1j\377!1k\377\203\"2k\377\1\"2l\377\202\"3l\377" \
+  "\210#3l\377\202\"3l\377\202\"2l\377\202\"2k\377\202!2k\377\3\40""1j\377" \
+  "\40""0j\377\40""0i\377\202\37/i\377\1\36.h\377\202\35.h\377\5\35-g\377" \
+  "\34-g\377\34,g\377\33,g\377\33,f\377\202\32+f\377\202\31*e\377\1\30)" \
+  "e\377\211\30)d\377\365\31*e\377\202\30)d\377\4\31*d\377\33,g\377\37""0" \
+  "i\377!2k\377\202#3l\377\1\"2k\377\206#3l\377\1\"2k\377\202#3l\377\203" \
+  "\"2k\377\4\"2j\377\37/i\377\33+f\377\31*e\377\202\30)d\377\301\31*e\377" \
+  "\14\30)d\377\31*e\377\33,f\377\35-g\377\36.h\377\36-g\377\36.h\377\35" \
+  "-h\377\36.g\377\36.h\377\34,f\377\31*e\377\202\30)d\377\377\31*e\377" \
+  "\275\31*e\377\215\30)d\377\242\31*e\377\216\30)d\377\374\31*e\377\202" \
+  "\30)d\377\3\35-g\377!1k\377\"2k\377\212#3l\377\2\"2k\377#3l\377\204\"" \
+  "2k\377\3\37/h\377\32+e\377\31*e\377\202\30)d\377\301\31*e\377\202\30" \
+  ")d\377\14\31*e\377\35-h\377\35.h\377\36.h\377\35-g\377\36.h\377\35-g" \
+  "\377\36.h\377\35-h\377\32+f\377\31*e\377\30)d\377\377\31*e\377\377\31" \
+  "*e\377\365\31*e\377\202\30)d\377\202\31*e\377\2\35.h\377\"2k\377\202" \
+  "#3l\377\1\"2l\377\211#3l\377\202\"2k\377\203!1j\377\2\37""0i\377\32+" \
+  "f\377\202\30)d\377\302\31*e\377\202\30)d\377\4\31*e\377\33,f\377\35." \
+  "h\377\36.g\377\202\36.h\377\6\35-g\377\36.h\377\35-h\377\34-g\377\31" \
+  "*e\377\30)d\377\377\31*e\377\377\31*e\377\364\31*e\377\1\30)e\377\202" \
+  "\30)d\377\4\31*e\377\33,g\377\37/i\377\"2k\377\202#3l\377\1\"2k\377\206" \
+  "#3l\377\1\"2k\377\202#3l\377\204\"2k\377\3\40""1j\377\36.h\377\33,f\377" \
+  "\202\30)d\377\303\31*e\377\6\30)d\377\30)e\377\32+e\377\34,g\377\36." \
+  "h\377\36-g\377\202\35.h\377\6\36-g\377\36.h\377\35-g\377\33+f\377\31" \
+  "*e\377\30)d\377\377\31*e\377\377\31*e\377\364\31*e\377\202\30)d\377\4" \
+  "\32+f\377\36.h\377\40""1j\377\"2k\377\202#3l\377\1\"2k\377\211#3l\377" \
+  "\204\"2k\377\3\40""1j\377\34-g\377\32+e\377\203\30)d\377\303\31*e\377" \
+  "\6\30)d\377\30)e\377\33,g\377\35.h\377\36.h\377\35-g\377\204\36.h\377" \
+  "\2\34-g\377\32*e\377\202\30)d\377\377\31*e\377\377\31*e\377\362\31*e" \
+  "\377\203\30)d\377\2\33,f\377\40""0j\377\202\"2k\377\202#3l\377\1\"2k" \
+  "\377\207#3l\377\2\"2k\377#3l\377\204\"2k\377\2\40""0j\377\34-g\377\202" \
+  "\31*e\377\202\30)d\377\304\31*e\377\15\30)d\377\31*e\377\35-g\377\35" \
+  "-h\377\36.h\377\35.h\377\36.h\377\35.h\377\36-g\377\36.h\377\33+f\377" \
+  "\31*e\377\30)d\377\377\31*e\377\377\31*e\377\360\31*e\377\203\30)d\377" \
+  "\4\31*e\377\32*e\377\34-g\377!1k\377\202#3l\377\1\"2k\377\207#3l\377" \
+  "\2\"2k\377#3l\377\203\"2k\377\203!1j\377\2\40""0i\377\34-f\377\203\30" \
+  ")d\377\304\31*e\377\202\30)d\377\14\31*e\377\33,f\377\36/i\377\36-g\377" \
+  "\35.h\377\36.h\377\36-g\377\36.h\377\36-g\377\35-g\377\31*e\377\30)d" \
+  "\377\377\31*e\377\377\31*e\377\360\31*e\377\1\30)e\377\202\30)d\377\4" \
+  "\32+e\377\34,g\377\37/i\377\"2k\377\202#3l\377\1\"2k\377\207#3l\377\1" \
+  "\"2k\377\202#3l\377\202\"2k\377\5\"1j\377\"2k\377\40""1j\377\37/h\377" \
+  "\34,f\377\202\30)d\377\306\31*e\377\202\30)d\377\4\32+e\377\34-g\377" \
+  "\36.h\377\35-g\377\202\36.h\377\6\35-g\377\36.h\377\35-g\377\33,f\377" \
+  "\31)e\377\30)d\377\377\31*e\377\377\31*e\377\357\31*e\377\202\30)d\377" \
+  "\5\30*d\377\33,g\377\37/i\377!1j\377#2k\377\202#3l\377\1\"2k\377\207" \
+  "#3l\377\1\"2k\377\202#3l\377\204\"2k\377\4\40""0j\377\35.h\377\32+f\377" \
+  "\31)d\377\202\30)d\377\305\31*e\377\202\30)d\377\15\31*e\377\34,f\377" \
+  "\35-g\377\36.h\377\36-g\377\36.h\377\35.h\377\36-g\377\36.h\377\34,g" \
+  "\377\31+e\377\30)e\377\30)d\377\377\31*e\377\377\31*e\377\356\31*e\377" \
+  "\202\30)d\377\2\31*e\377\36.h\377\203\"2k\377\202#3l\377\1\"2k\377\207" \
+  "#3l\377\1\"2k\377\202#3l\377\204\"2k\377\2\40""0i\377\33,f\377\202\31" \
+  "*e\377\202\30)d\377\306\31*e\377\4\30)d\377\31*e\377\33+f\377\35-g\377" \
+  "\202\36.h\377\7\35-g\377\36.h\377\35-g\377\36.h\377\35.h\377\32+f\377" \
+  "\31*e\377\202\30)d\377\377\31*e\377\377\31*e\377\352\31*e\377\203\30" \
+  ")d\377\202\31*e\377\2\33,g\377\40""0j\377\213#3l\377\1\"2k\377\202#3" \
+  "l\377\203\"2k\377\203!1j\377\2\37""0i\377\32+f\377\202\30)d\377\310\31" \
+  "*e\377\1\30)d\377\202\31*e\377\3\34,g\377\36.h\377\36.g\377\202\36.h" \
+  "\377\6\35-g\377\36.h\377\35-h\377\35-g\377\32*e\377\30)d\377\377\31*" \
+  "e\377\377\31*e\377\353\31*e\377\203\30)d\377\4\32+e\377\34,g\377\36." \
+  "i\377\"2k\377\202#3l\377\2#3k\377\"2l\377\207#3l\377\1\"2k\377\202#3" \
+  "l\377\202\"2k\377\6\"2j\377\"2k\377!1j\377\40""0i\377\35-h\377\31+e\377" \
+  "\203\30)d\377\307\31*e\377\202\30)d\377\7\31*e\377\33+f\377\35.h\377" \
+  "\36.h\377\35-g\377\36.h\377\35-g\377\202\36.h\377\4\35-g\377\33+f\377" \
+  "\31*e\377\30)d\377\377\31*e\377\377\31*e\377\351\31*e\377\203\30)d\377" \
+  "\5\31*e\377\35-g\377\37/i\377!1j\377\"2l\377\213#3l\377\1\"2k\377\202" \
+  "#3l\377\204\"2k\377\4!1j\377\36.h\377\33,f\377\31*e\377\202\30)d\377" \
+  "\311\31*e\377\202\30)d\377\5\32+e\377\34-g\377\36.h\377\36-g\377\35." \
+  "h\377\204\36.h\377\2\34,g\377\31*e\377\202\30)d\377\377\31*e\377\377" \
+  "\31*e\377\350\31*e\377\202\30)d\377\3\30)e\377\34,f\377\40""0j\377\202" \
+  "\"2k\377\203#3l\377\1\"2k\377\210#3l\377\1\"2k\377\202#3l\377\204\"2" \
+  "k\377\2\40""1j\377\34-g\377\202\31*e\377\203\30)d\377\311\31*e\377\4" \
+  "\30)d\377\31*e\377\34-g\377\35-g\377\204\36.h\377\1\35-g\377\202\36." \
+  "h\377\3\32*e\377\31*e\377\30)d\377\377\31*e\377\377\31*e\377\345\31*" \
+  "e\377\203\30)d\377\202\31*e\377\3\32+f\377\37/i\377\"2k\377\202#3l\377" \
+  "\1\"2k\377\210#3l\377\1\"2k\377\202#3l\377\203\"2k\377\204!1j\377\2\37" \
+  "/i\377\32+f\377\203\30)d\377\312\31*e\377\202\30)d\377\5\31*e\377\32" \
+  "+f\377\35.h\377\36-g\377\35.h\377\204\36.h\377\2\35-g\377\34-g\377\202" \
+  "\30)d\377\377\31*e\377\377\31*e\377\344\31*e\377\203\30)d\377\5\31*e" \
+  "\377\32+f\377\34-g\377\36/i\377!1k\377\203#3l\377\1\"2k\377\213#3l\377" \
+  "\203\"2k\377\6\"2j\377\"2k\377!1j\377\37/i\377\35-g\377\31*e\377\202" \
+  "\30)d\377\314\31*e\377\6\30)d\377\31*e\377\32+f\377\34-g\377\36.h\377" \
+  "\36-g\377\202\36.h\377\1\35-g\377\202\36.h\377\3\34-g\377\32+f\377\30" \
+  ")d\377\377\31*e\377\377\31*e\377\343\31*e\377\203\30)d\377\5\30*e\377" \
+  "\33+f\377\36.h\377\40""0j\377!1k\377\215#3l\377\1\"2k\377\202#3l\377" \
+  "\205\"2k\377\4\37""0i\377\35-g\377\32+f\377\31*e\377\203\30)d\377\313" \
+  "\31*e\377\202\30)d\377\14\31*e\377\34,g\377\35.h\377\36.h\377\35-g\377" \
+  "\36.h\377\35.h\377\36-g\377\36.h\377\35-g\377\33,f\377\31*e\377\202\30" \
+  ")d\377\377\31*e\377\377\31*e\377\340\31*e\377\1\30)e\377\203\30)d\377" \
+  "\2\33,f\377\37/i\377\203\"2k\377\203#3l\377\1\"2k\377\211#3l\377\1\"" \
+  "2k\377\202#3l\377\204\"2k\377\5!1j\377\35.h\377\32+f\377\31*e\377\31" \
+  ")d\377\202\30)d\377\315\31*e\377\202\30)d\377\5\33,g\377\35-g\377\36" \
+  ".h\377\36-g\377\35.h\377\204\36.h\377\4\33,g\377\31*e\377\31*d\377\30" \
+  ")d\377\377\31*e\377\377\31*e\377\335\31*e\377\203\30)d\377\202\31*e\377" \
+  "\4\32+e\377\34-f\377\37""0i\377\"2k\377\215#3l\377\1\"2k\377\202#3l\377" \
+  "\203\"2k\377\204!1j\377\2\37/j\377\33+f\377\203\30)d\377\316\31*e\377" \
+  "\202\30)d\377\202\31*e\377\7\35.h\377\36.h\377\35-g\377\36.h\377\35." \
+  "h\377\36-g\377\36.h\377\202\35-g\377\1\32+f\377\202\30)d\377\377\31*" \
+  "e\377\377\31*e\377\333\31*e\377\204\30)d\377\6\31*e\377\32+f\377\33," \
+  "g\377\35.h\377\40""0j\377\"2l\377\203#3l\377\1\"2k\377\215#3l\377\204" \
+  "\"2k\377\5!2k\377\40""0j\377\36/i\377\34-g\377\31*f\377\203\30)d\377" \
+  "\317\31*e\377\202\30)d\377\5\32+f\377\34,g\377\36.h\377\36-g\377\35." \
+  "h\377\204\36.h\377\4\35-g\377\33,f\377\31*e\377\30)d\377\377\31*e\377" \
+  "\377\31*e\377\332\31*e\377\204\30)d\377\6\31*e\377\33-g\377\36/h\377" \
+  "\40""0j\377!1k\377\"2l\377\203#3l\377\1\"2k\377\212#3l\377\1\"2k\377" \
+  "\202#3l\377\205\"2k\377\5!1j\377\36.h\377\33,g\377\32+f\377\30*e\377" \
+  "\202\30)d\377\320\31*e\377\202\30)d\377\5\31*e\377\34,f\377\35-g\377" \
+  "\36.h\377\36.g\377\202\36.h\377\1\35-g\377\202\36.h\377\2\33,g\377\31" \
+  "*e\377\202\30)d\377\377\31*e\377\377\31*e\377\330\31*e\377\203\30)d\377" \
+  "\4\30)e\377\32+f\377\36.h\377\40""1j\377\203\"2k\377\203#3l\377\1#3k" \
+  "\377\212#3l\377\1\"2k\377\203#3l\377\204\"2k\377\3!1k\377\36/i\377\33" \
+  ",f\377\202\31*e\377\203\30)d\377\321\31*e\377\4\30)d\377\30)e\377\33" \
+  ",f\377\35-g\377\202\36.h\377\10\35-g\377\36.h\377\35-h\377\36.g\377\36" \
+  ".h\377\34-g\377\32+e\377\31*e\377\202\30)d\377\377\31*e\377\377\31*e" \
+  "\377\322\31*e\377\1\30)e\377\203\30)d\377\203\31*e\377\4\32+f\377\34" \
+  "-h\377\40""0i\377\"3k\377\203#3l\377\1\"2k\377\213#3l\377\1\"2k\377\202" \
+  "#3l\377\203\"2k\377\205!1j\377\3\37""0i\377\33-g\377\30*e\377\202\30" \
+  ")d\377\323\31*e\377\1\30)d\377\202\31*e\377\4\32+f\377\35.h\377\36.h" \
+  "\377\36-g\377\202\36.h\377\1\35-g\377\202\36.h\377\2\35-g\377\33+f\377" \
+  "\202\30)e\377\377\31*e\377\251\31*e\377\203\30)d\377\377\31*e\377\246" \
+  "\31*e\377\204\30)d\377\6\31*e\377\32+f\377\33,g\377\35.h\377\37""0i\377" \
+  "!2k\377\204#3l\377\1\"2k\377\213#3l\377\1\"2k\377\203#3l\377\205\"2k" \
+  "\377\5!1j\377\40""0i\377\36/h\377\33,g\377\31*e\377\203\30)d\377\324" \
+  "\31*e\377\11\30)d\377\30*d\377\32+f\377\34-g\377\36.h\377\36-g\377\35" \
+  ".h\377\36.h\377\35-g\377\202\36.h\377\3\35-g\377\34,f\377\31*e\377\202" \
+  "\30)d\377\377\31*e\377\252\31*e\377\2\35-h\377\32+f\377\205\30)d\377" \
+  "\377\31*e\377\236\31*e\377\204\30)d\377\7\32+e\377\33,g\377\35.h\377" \
+  "\37""0i\377\40""1j\377!2k\377\"3l\377\204#3l\377\1\"2k\377\213#3l\377" \
+  "\1\"2k\377\203#3l\377\205\"2k\377\5!1k\377\37/i\377\35-g\377\32,f\377" \
+  "\31*e\377\203\30)d\377\325\31*e\377\202\30)d\377\5\32+f\377\34,g\377" \
+  "\35.h\377\36.h\377\35-g\377\202\36.h\377\1\35-g\377\202\36.h\377\2\34" \
+  ",f\377\31*e\377\202\30)d\377\377\31*e\377\254\31*e\377\203\"2k\377\4" \
+  "\40""0j\377\36/h\377\33,f\377\31*d\377\204\30)d\377\307\31*e\377\3\30" \
+  ")d\377\27'^\377\25$W\377\203\25$V\377\3\25$W\377\24\"T\377\23\40M\377" \
+  "\204\23\40N\377\2\21\35G\377\20\34D\377\204\21\34D\377\1\17\31=\377\212" \
+  "\16\30;\377\4\16\30:\377\14\24""1\377\21\35F\377\30)c\377\254\31*e\377" \
+  "\204\30)d\377\3\32+e\377\35-g\377\37/i\377\204\"2k\377\204#3l\377\1#" \
+  "2k\377\214#3l\377\1\"2k\377\203#3l\377\205\"2k\377\3!1j\377\36/h\377" \
+  "\33,f\377\202\31*e\377\1\31*d\377\203\30)d\377\325\31*e\377\202\30)d" \
+  "\377\1\31*e\377\202\35-g\377\10\36.h\377\36.g\377\35-g\377\36.h\377\35" \
+  ".h\377\36-g\377\36.h\377\35-g\377\202\31*e\377\1\30)d\377\377\31*e\377" \
+  "\256\31*e\377\202#3l\377\1\"2k\377\204#3l\377\4!1k\377\37""0i\377\34" \
+  "-h\377\32+f\377\204\31*e\377\205\30)d\377\276\31*e\377\2\24\"S\377\6" \
+  "\13\33\377\204\7\13\32\377\2\7\13\33\377\7\13\32\377\207\7\13\33\377" \
+  "\203\7\12\33\377\213\7\13\33\377\1\7\12\33\377\203\7\13\33\377\2\17\30" \
+  "<\377\30)c\377\241\31*e\377\1\30)e\377\204\30)d\377\205\31*e\377\3\34" \
+  ",f\377\36.h\377\40""0j\377\223#3l\377\1\"2k\377\203#3l\377\204\"2k\377" \
+  "\2!1j\377\"2j\377\202!1j\377\4\40""0j\377\36.h\377\32,f\377\30*e\377" \
+  "\202\30)d\377\330\31*e\377\202\30)d\377\202\31*e\377\2\33,g\377\35.h" \
+  "\377\204\36.h\377\5\35-g\377\36.h\377\36-g\377\35-g\377\32+f\377\202" \
+  "\30)d\377\377\31*e\377\260\31*e\377\206#3l\377\1\"2k\377\204#3l\377\7" \
+  "#3k\377!1j\377\37/i\377\35.h\377\34-g\377\33,f\377\32+f\377\202\31*e" \
+  "\377\205\30)d\377\271\31*e\377\3\23!P\377\10\15\37\377\6\13\33\377\234" \
+  "\7\13\33\377\202\7\12\33\377\2\7\13\33\377\15\25""6\377\234\31*e\377" \
+  "\206\30)d\377\10\31*e\377\32+e\377\33+f\377\33,f\377\35-h\377\36.i\377" \
+  "\40""0i\377!1k\377\224#3l\377\1\"2k\377\203#3l\377\206\"2k\377\5!1j\377" \
+  "\37""0i\377\36/h\377\35-g\377\32+f\377\204\30)d\377\331\31*e\377\202" \
+  "\30)d\377\10\31*e\377\33+f\377\35.h\377\36.h\377\36-g\377\35.h\377\36" \
+  ".h\377\35-g\377\202\36.h\377\4\35-g\377\33,f\377\31*e\377\30)d\377\377" \
+  "\31*e\377\262\31*e\377\212#3l\377\1\"2k\377\205#3l\377\2\"2k\377!1j\377" \
+  "\202\40""0j\377\5\36/h\377\35-g\377\33,f\377\32+f\377\30)e\377\206\30" \
+  ")d\377\263\31*e\377\2\23!O\377\7\14\37\377\237\7\13\33\377\4\6\13\32" \
+  "\377\6\12\32\377\13\23""0\377\30)b\377\225\31*e\377\206\30)d\377\7\32" \
+  "*e\377\33,f\377\34-g\377\35.h\377\37/i\377\40""0i\377!1j\377\202\"2k" \
+  "\377\231#3l\377\206\"2k\377\5\40""0j\377\36/h\377\34-f\377\32+f\377\31" \
+  "*e\377\204\30)d\377\332\31*e\377\202\30)d\377\6\31*e\377\33,g\377\35" \
+  "-g\377\36.h\377\36-g\377\35.h\377\204\36.h\377\3\35-g\377\33+f\377\31" \
+  "*e\377\202\30)d\377\377\31*e\377\263\31*e\377\217#3l\377\1\"2k\377\204" \
+  "#3l\377\205\"2k\377\5!1k\377\37""0i\377\35.h\377\34-g\377\32+f\377\207" \
+  "\30)d\377\255\31*e\377\3\23!O\377\10\14\37\377\6\13\33\377\240\7\13\33" \
+  "\377\3\7\12\32\377\14\24""2\377\27(`\377\216\31*e\377\206\30)d\377\5" \
+  "\31*e\377\33+e\377\35-g\377\37/h\377\40""0j\377\205\"2k\377\232#3l\377" \
+  "\206\"2k\377\4!1j\377\36/i\377\34-g\377\32+e\377\202\31*e\377\1\31*d" \
+  "\377\203\30)d\377\333\31*e\377\202\30)d\377\6\31*e\377\33,g\377\35-g" \
+  "\377\35.h\377\36.h\377\36-g\377\202\36.h\377\1\35-g\377\202\36.h\377" \
+  "\4\33,f\377\31*e\377\30)e\377\30)d\377\377\31*e\377\265\31*e\377\202" \
+  "\"2k\377\203#3l\377\1\"2k\377\222#3l\377\1\"2k\377\206#3l\377\6!2k\377" \
+  "\40""0j\377\36/i\377\35-g\377\33,f\377\32+f\377\206\31*e\377\1\31*d\377" \
+  "\210\30)d\377\236\31*e\377\3\23!O\377\10\14\37\377\6\13\33\377\241\7" \
+  "\13\33\377\2\7\12\33\377\16\30<\377\207\30)d\377\207\31*e\377\5\33,f" \
+  "\377\34-g\377\35.h\377\37/i\377!1k\377\206#3l\377\1\"2k\377\222#3l\377" \
+  "\1\"2k\377\204#3l\377\204\"2k\377\202!1j\377\1\"2j\377\203!1j\377\3\37" \
+  "/i\377\34.g\377\32+e\377\204\30)d\377\336\31*e\377\202\30)d\377\202\31" \
+  "*e\377\4\33+f\377\35-h\377\36.h\377\35-h\377\202\36.h\377\3\35-g\377" \
+  "\36.h\377\36.g\377\202\35-g\377\3\31*e\377\30)d\377\30)e\377\377\31*" \
+  "e\377\267\31*e\377\205\"2k\377\205#3l\377\1\"2k\377\223#3l\377\1\"2k" \
+  "\377\206#3l\377\3\"3l\377!1k\377\40""0j\377\202\37/i\377\3\36.h\377\35" \
+  "-g\377\34-g\377\202\33,f\377\5\32+f\377\32+e\377\31+e\377\31*e\377\30" \
+  "*e\377\215\30)d\377\221\31*e\377\2\23!O\377\10\14\37\377\241\7\13\33" \
+  "\377\5\6\13\32\377\7\13\33\377\13\21+\377\31*e\377\32*e\377\202\32+f" \
+  "\377\11\33,f\377\33,g\377\34,g\377\35-h\377\36.h\377\37/i\377\40""0j" \
+  "\377!1k\377\"2k\377\233#3l\377\1\"2k\377\204#3l\377\207\"2k\377\6!1j" \
+  "\377\40""0j\377\37""0i\377\36/h\377\35-g\377\32+f\377\204\30)d\377\1" \
+  "\30)e\377\340\31*e\377\202\30)d\377\15\31*e\377\33+f\377\35-h\377\36" \
+  ".h\377\36.g\377\35-h\377\36.h\377\35.h\377\36-g\377\36.h\377\35-g\377" \
+  "\34,g\377\32+e\377\202\30)d\377\377\31*e\377\271\31*e\377\2\37/h\377" \
+  "!0j\377\210\"2k\377\204#3l\377\1\"2k\377\225#3l\377\1#2k\377\210#3l\377" \
+  "\202\"2k\377\5!1k\377!1j\377\40""1j\377\40""0j\377\37""0j\377\202\37" \
+  "/i\377\4\36.h\377\35.h\377\35-h\377\34,g\377\202\33,f\377\202\32+e\377" \
+  "\202\31*e\377\1\30)e\377\221\30)d\377\3\23\40O\377\7\14\37\377\6\13\33" \
+  "\377\241\7\13\33\377\10\7\12\32\377\10\16\"\377\40""1j\377!1j\377!1k" \
+  "\377!2k\377\"2k\377\"3l\377\210#3l\377\1\"2k\377\232#3l\377\207\"2k\377" \
+  "\7!1j\377\37""0i\377\35.h\377\34-g\377\33,f\377\32+e\377\31*e\377\204" \
+  "\30)d\377\342\31*e\377\202\30)d\377\6\31*e\377\33,g\377\35-g\377\36." \
+  "h\377\36.g\377\35-h\377\202\36.h\377\1\36-g\377\202\36.h\377\3\34,g\377" \
+  "\32*e\377\31*e\377\202\30)d\377\377\31*e\377\274\31*e\377\5\32+e\377" \
+  "\33,f\377\35.h\377\40""0i\377\"2j\377\207\"2k\377\205#3l\377\1\"2k\377" \
+  "\242#3l\377\214\"2k\377\5!1k\377!1j\377\40""1j\377\40""0j\377\37""0i" \
+  "\377\202\37/i\377\203\36.h\377\202\35.h\377\203\35-g\377\4\34-g\377\25" \
+  "#Q\377\10\15\37\377\6\13\33\377\241\7\13\33\377\2\6\13\32\377\6\12\32" \
+  "\377\206#3l\377\2#3k\377\"2l\377\227#3l\377\1\"2k\377\204#3l\377\210" \
+  "\"2k\377\4!1j\377\37/h\377\35-g\377\32+f\377\203\31*e\377\1\31*d\377" \
+  "\204\30)d\377\343\31*e\377\202\30)d\377\6\31*e\377\33-g\377\35-g\377" \
+  "\35.h\377\36.h\377\36.g\377\202\36.h\377\6\35.h\377\36-g\377\36.h\377" \
+  "\34-g\377\32+e\377\31*e\377\202\30)d\377\377\31*e\377\276\31*e\377\1" \
+  "\30)e\377\203\30)d\377\5\31*d\377\32+e\377\34-f\377\36/i\377\40""1j\377" \
+  "\204!1j\377\1\"1j\377\202!1j\377\205\"2k\377\206#3l\377\1\"2k\377\243" \
+  "#3l\377\2\"2l\377#3k\377\217#3l\377\2\32'T\377\10\15\40\377\244\7\13" \
+  "\33\377\1\"2k\377\224#3l\377\1\"2k\377\205#3l\377\205\"2k\377\202!1j" \
+  "\377\1\"2j\377\205!1j\377\4\37""0i\377\35-h\377\33,g\377\31*d\377\204" \
+  "\30)d\377\350\31*e\377\202\30)d\377\202\31*e\377\4\33,f\377\35.h\377" \
+  "\36.h\377\35.h\377\202\36.h\377\1\35.h\377\202\36.h\377\3\35-g\377\34" \
+  "-g\377\32+e\377\202\30)d\377\377\31*e\377\305\31*e\377\1\30)e\377\204" \
+  "\30)d\377\7\31*e\377\32+f\377\34,g\377\35.g\377\37/h\377\37""0i\377\40" \
+  "0i\377\202!1j\377\211\"2k\377\206#3l\377\1\"2k\377\256#3l\377\2\32&R" \
+  "\377\7\15\37\377\244\7\13\33\377\1\37-`\377\216#3l\377\1\"2k\377\206" \
+  "#3l\377\210\"2k\377\11\"2j\377!1j\377\40""1j\377\40""0i\377\37/i\377" \
+  "\36.h\377\35-g\377\33,f\377\32+e\377\205\30)d\377\352\31*e\377\20\30" \
+  "*e\377\30)d\377\30)e\377\32*e\377\33,g\377\35.h\377\36.h\377\36-g\377" \
+  "\35.h\377\36.h\377\35.h\377\36-g\377\36.h\377\35.h\377\34-g\377\32+f" \
+  "\377\202\30)d\377\377\31*e\377\314\31*e\377\205\30)d\377\11\31*e\377" \
+  "\32+e\377\33+f\377\33,f\377\34,g\377\35.h\377\37/h\377\40""0i\377!1j" \
+  "\377\212\"2k\377\207#3l\377\1\"2k\377\247#3l\377\2\31$O\377\7\14\35\377" \
+  "\244\7\13\33\377\1\32'T\377\207#3l\377\1\"2k\377\207#3l\377\212\"2k\377" \
+  "\11\40""1j\377\37/i\377\36.h\377\35-g\377\34,f\377\33,f\377\32+e\377" \
+  "\31*e\377\31*d\377\205\30)d\377\354\31*e\377\202\30)d\377\7\31)d\377" \
+  "\32+f\377\34,g\377\35-g\377\36.h\377\36-g\377\35.h\377\205\36.h\377\3" \
+  "\34-g\377\32+f\377\31*e\377\202\30)d\377\377\31*e\377\321\31*e\377\1" \
+  "\30)e\377\205\30)d\377\204\31*e\377\6\32*e\377\33,g\377\35-g\377\36." \
+  "h\377\37""0i\377!2k\377\213\"2k\377\210#3l\377\1\"2k\377\237#3l\377\2" \
+  "\31$O\377\7\13\35\377\243\7\13\33\377\2\7\12\32\377\26\"J\377\210#3l" \
+  "\377\213\"2k\377\5!1j\377\37""0h\377\35.h\377\34,g\377\32+f\377\205\31" \
+  "*e\377\205\30)d\377\1\30)e\377\357\31*e\377\3\30)d\377\30)e\377\32+f" \
+  "\377\202\35-g\377\202\36.h\377\1\35-g\377\202\36.h\377\1\35-g\377\202" \
+  "\36.h\377\3\34,f\377\32*e\377\31*e\377\202\30)d\377\377\31*e\377\335" \
+  "\31*e\377\206\30)d\377\7\31*d\377\32+e\377\33,g\377\35.h\377\36/h\377" \
+  "\37""0i\377\40""1j\377\207!1j\377\2\"2j\377\"1j\377\202!1j\377\213\"" \
+  "2k\377\226#3l\377\2\30$N\377\7\13\35\377\243\7\13\33\377\3\6\12\32\377" \
+  "\24\36B\377\"2k\377\202!1j\377\2\"2j\377!2j\377\207!1j\377\6\40""0j\377" \
+  "\37/h\377\35.h\377\34-g\377\33,f\377\31*e\377\206\30)d\377\367\31*e\377" \
+  "\1\30)d\377\202\31*e\377\4\32+f\377\35-g\377\36.h\377\36.g\377\203\36" \
+  ".h\377\3\35-g\377\36.h\377\36.g\377\202\35-g\377\1\31*e\377\202\30)d" \
+  "\377\377\31*e\377\346\31*e\377\1\30)e\377\206\30)d\377\7\31)d\377\32" \
+  "*e\377\33+f\377\33,g\377\34-g\377\35.h\377\36.h\377\202\37/i\377\3\40" \
+  "/i\377\40""0i\377\40""0j\377\203!1j\377\235\"2k\377\3\31$O\377\7\13\34" \
+  "\377\7\12\32\377\242\7\13\33\377\16\7\12\33\377\23\36B\377\40""0j\377" \
+  "\40""0i\377\37""0i\377\37/i\377\36/h\377\36.h\377\35-g\377\34,g\377\33" \
+  ",f\377\32+f\377\31*e\377\30)e\377\207\30)d\377\371\31*e\377\203\30)d" \
+  "\377\3\31*e\377\33,f\377\35.g\377\202\36.h\377\1\35-g\377\202\36.h\377" \
+  "\1\35-g\377\202\36.h\377\3\35-g\377\34,g\377\32+e\377\202\30)d\377\377" \
+  "\31*e\377\356\31*e\377\1\30*e\377\210\30)d\377\203\31*e\377\202\32+f" \
+  "\377\14\33+f\377\33,f\377\33,g\377\34,g\377\34-g\377\35.g\377\35.h\377" \
+  "\36.i\377\36/i\377\37/i\377\37""0i\377\40""0i\377\203!1j\377\220\"2k" \
+  "\377\3\30$N\377\7\13\34\377\7\12\32\377\242\7\13\33\377\3\7\12\33\377" \
+  "\17\31<\377\32+e\377\202\31*e\377\1\30)e\377\210\30)d\377\377\31*e\377" \
+  "\5\30)d\377\30*e\377\32+f\377\34,f\377\35-g\377\202\36.h\377\1\36-g\377" \
+  "\205\36.h\377\2\35-g\377\33,f\377\202\31*e\377\202\30)d\377\377\31*e" \
+  "\377\367\31*e\377\212\30)d\377\216\31*e\377\202\32+f\377\202\33,f\377" \
+  "\1\33,g\377\204\34-g\377\202\35-h\377\202\35.h\377\2\25!L\377\7\13\35" \
+  "\377\244\7\13\33\377\1\15\26""6\377\204\30)d\377\377\31*e\377\206\31" \
+  "*e\377\202\30)d\377\1\33,f\377\202\35-g\377\202\36.h\377\1\35-g\377\202" \
+  "\36.h\377\2\35.h\377\36-g\377\202\36.h\377\1\33+f\377\202\31*e\377\202" \
+  "\30)d\377\377\31*e\377\377\31*e\377\221\31*e\377\216\30)d\377\3\21\36" \
+  "I\377\7\13\35\377\6\12\33\377\243\7\13\33\377\1\15\25""4\377\377\31*" \
+  "e\377\206\31*e\377\202\30)d\377\202\31*e\377\5\32+f\377\35.h\377\36." \
+  "h\377\36.g\377\35-h\377\202\36.h\377\1\35-g\377\202\36.h\377\202\35-" \
+  "g\377\1\33,f\377\202\30)d\377\377\31*e\377\377\31*e\377\243\31*e\377" \
+  "\3\22\36I\377\6\13\34\377\7\12\32\377\243\7\13\33\377\1\13\22-\377\377" \
+  "\31*e\377\204\31*e\377\202\30)d\377\4\31*e\377\32*f\377\33,f\377\35." \
+  "g\377\202\36.h\377\1\35.h\377\205\36.h\377\5\35-g\377\34-g\377\33+f\377" \
+  "\31)e\377\30)d\377\377\31*e\377\377\31*e\377\245\31*e\377\2\21\34E\377" \
+  "\6\12\33\377\244\7\13\33\377\1\13\22-\377\377\31*e\377\202\31*e\377\202" \
+  "\30)d\377\4\31*e\377\33,f\377\34-g\377\35-h\377\202\36.h\377\1\35-g\377" \
+  "\202\36.h\377\1\35-g\377\203\36.h\377\3\34,f\377\32+e\377\31*e\377\202" \
+  "\30)d\377\377\31*e\377\377\31*e\377\246\31*e\377\3\21\34E\377\7\13\32" \
+  "\377\6\13\33\377\242\7\13\33\377\2\6\13\32\377\11\16$\377\377\31*e\377" \
+  "\202\30)d\377\4\32+e\377\34,g\377\35.h\377\35-g\377\202\36.h\377\1\35" \
+  "-h\377\205\36.h\377\2\35-g\377\33,f\377\202\31*e\377\202\30)d\377\377" \
+  "\31*e\377\377\31*e\377\250\31*e\377\3\21\34E\377\7\13\32\377\6\13\33" \
+  "\377\243\7\13\33\377\1\11\17#\377\373\31*e\377\202\30)d\377\202\31*e" \
+  "\377\2\32+e\377\35-g\377\202\36.h\377\1\35-g\377\206\36.h\377\202\35" \
+  "-g\377\3\33+f\377\30)e\377\30)d\377\377\31*e\377\377\31*e\377\254\31" \
+  "*e\377\2\21\34E\377\7\13\32\377\243\7\13\33\377\2\6\13\32\377\11\16#" \
+  "\377\245\31*e\377\1\27&\\\377\202\24\"S\377\1\25$V\377\320\31*e\377\202" \
+  "\30)d\377\7\31*e\377\32+e\377\33,f\377\35-h\377\36.h\377\36-g\377\35" \
+  "-g\377\203\36.h\377\1\35-g\377\202\36.h\377\4\35-g\377\34,g\377\32+f" \
+  "\377\31*d\377\202\30)d\377\377\31*e\377\377\31*e\377\255\31*e\377\3\21" \
+  "\34E\377\7\13\33\377\6\12\33\377\243\7\13\33\377\1\7\13\34\377\245\31" \
+  "*e\377\2\17\32>\377\10\15\37\377\202\7\15!\377\2\12\20)\377\23\40O\377" \
+  "\314\31*e\377\202\30)d\377\4\31*e\377\33,f\377\34-g\377\35.g\377\202" \
+  "\36.h\377\1\35-g\377\206\36.h\377\3\34-g\377\33+f\377\31*e\377\202\30" \
+  ")d\377\1\30)e\377\377\31*e\377\377\31*e\377\257\31*e\377\3\21\34E\377" \
+  "\7\13\32\377\6\13\33\377\243\7\13\33\377\1\6\13\33\377\244\31*e\377\2" \
+  "\27'_\377\12\23.\377\205\7\13\33\377\1\20\33C\377\310\31*e\377\203\30" \
+  ")d\377\4\32,f\377\34-g\377\35-g\377\35.h\377\202\36.h\377\1\35-g\377" \
+  "\203\36.h\377\4\35-g\377\36.h\377\36-g\377\34,f\377\203\31*e\377\202" \
+  "\30)d\377\377\31*e\377\377\31*e\377\261\31*e\377\3\21\34E\377\7\13\32" \
+  "\377\6\13\33\377\243\7\13\33\377\1\6\13\33\377\244\31*e\377\2\26%Z\377" \
+  "\10\15#\377\205\7\13\33\377\1\15\26""6\377\304\31*e\377\202\30)d\377" \
+  "\1\31*d\377\202\31*e\377\1\33,f\377\203\36.h\377\1\35-g\377\203\36.h" \
+  "\377\1\35-g\377\202\36.h\377\202\35-g\377\2\33,f\377\31*e\377\202\30" \
+  ")d\377\377\31*e\377\377\31*e\377\265\31*e\377\3\21\34E\377\7\13\32\377" \
+  "\7\12\33\377\244\7\13\33\377\244\31*e\377\1\25#U\377\206\7\13\33\377" \
+  "\1\16\27""8\377\302\31*e\377\202\30)d\377\4\31*e\377\32*e\377\33,f\377" \
+  "\34-g\377\212\36.h\377\3\35-g\377\34,g\377\32+e\377\203\30)d\377\377" \
+  "\31*e\377\377\31*e\377\267\31*e\377\3\20\33C\377\7\13\33\377\6\12\32" \
+  "\377\243\7\13\33\377\1\7\12\33\377\244\31*e\377\3\26%Y\377\10\15!\377" \
+  "\6\12\32\377\204\7\13\33\377\1\14\24""0\377\277\31*e\377\203\30)d\377" \
+  "\4\32+e\377\33,f\377\34-g\377\35-g\377\202\36.h\377\2\36-g\377\35.h\377" \
+  "\203\36.h\377\1\35-g\377\202\36.h\377\2\34,g\377\33+f\377\202\31*e\377" \
+  "\202\30)d\377\377\31*e\377\377\31*e\377\271\31*e\377\2\17\32\77\377\6" \
+  "\12\32\377\244\7\13\33\377\1\7\12\33\377\244\31*e\377\3\27'_\377\12\22" \
+  "-\377\7\12\32\377\204\7\13\33\377\1\12\22.\377\275\31*e\377\202\30)d" \
+  "\377\2\31*e\377\33,f\377\203\35-g\377\202\36.h\377\1\36-g\377\207\36" \
+  ".h\377\3\34,f\377\32+e\377\31*e\377\203\30)d\377\377\31*e\377\377\31" \
+  "*e\377\273\31*e\377\2\20\32@\377\6\12\33\377\244\7\13\33\377\1\6\13\33" \
+  "\377\227\31*e\377\1\30)b\377\214\27'^\377\2\27'_\377\15\27""8\377\204" \
+  "\7\13\33\377\2\6\12\32\377\13\22-\377\270\31*e\377\203\30)d\377\202\31" \
+  "*e\377\2\32*e\377\34-g\377\203\36.h\377\1\35-g\377\203\36.h\377\1\35" \
+  "-g\377\202\36.h\377\203\35-g\377\4\32+f\377\30)e\377\30)d\377\30)e\377" \
+  "\377\31*e\377\377\31*e\377\277\31*e\377\2\20\32@\377\6\12\33\377\244" \
+  "\7\13\33\377\1\6\13\33\377\227\31*e\377\2\23\40O\377\12\20)\377\212\13" \
+  "\22+\377\4\13\21+\377\13\22,\377\10\16\"\377\6\12\32\377\204\7\13\33" \
+  "\377\1\12\17'\377\266\31*e\377\202\30)d\377\202\31*e\377\3\32+f\377\33" \
+  ",f\377\35.g\377\202\36.h\377\1\35-g\377\203\36.h\377\1\35-g\377\203\36" \
+  ".h\377\4\35-g\377\34-g\377\33,f\377\32*e\377\203\30)d\377\377\31*e\377" \
+  "\377\31*e\377\301\31*e\377\2\17\32@\377\6\12\33\377\244\7\13\33\377\1" \
+  "\7\12\33\377\227\31*e\377\2\21\35G\377\7\13\32\377\213\7\12\33\377\206" \
+  "\7\13\33\377\2\6\12\32\377\11\17$\377\263\31*e\377\203\30)d\377\4\32" \
+  "+e\377\33,f\377\34-g\377\35-g\377\203\36.h\377\1\35-g\377\204\36.h\377" \
+  "\7\35-g\377\36.h\377\36-g\377\35-f\377\33,f\377\32*e\377\31*e\377\202" \
+  "\30)d\377\377\31*e\377\377\31*e\377\304\31*e\377\2\17\32\77\377\6\13" \
+  "\33\377\244\7\13\33\377\1\7\12\33\377\227\31*e\377\2\22\37L\377\7\13" \
+  "\32\377\221\7\13\33\377\2\7\13\32\377\11\17%\377\260\31*e\377\203\30" \
+  ")d\377\2\31*d\377\33,f\377\203\35-g\377\207\36.h\377\1\35-g\377\203\36" \
+  ".h\377\1\33+f\377\202\31*e\377\1\31*d\377\202\30)d\377\1\30*e\377\377" \
+  "\31*e\377\377\31*e\377\305\31*e\377\2\20\32@\377\6\12\33\377\244\7\13" \
+  "\33\377\1\6\13\33\377\227\31*e\377\1\24\"R\377\224\7\13\33\377\253\31" \
+  "*e\377\203\30)d\377\203\31*e\377\3\33+f\377\35.h\377\36.h\377\202\36" \
+  ".g\377\1\35-h\377\207\36.h\377\202\35-g\377\2\34,g\377\32+f\377\203\30" \
+  ")d\377\377\31*e\377\377\31*e\377\312\31*e\377\2\20\32@\377\6\12\33\377" \
+  "\244\7\13\33\377\1\6\13\33\377\227\31*e\377\1\24!Q\377\223\7\13\33\377" \
+  "\1\7\13\34\377\250\31*e\377\203\30)d\377\6\31*d\377\31*e\377\32+f\377" \
+  "\33,f\377\35-g\377\35.h\377\202\36.h\377\1\35-g\377\203\36.h\377\2\35" \
+  "-h\377\36.g\377\203\36.h\377\4\35-g\377\34,g\377\32+f\377\31*e\377\203" \
+  "\30)d\377\377\31*e\377\377\31*e\377\314\31*e\377\2\17\32@\377\6\12\33" \
+  "\377\244\7\13\33\377\1\7\12\33\377\227\31*e\377\2\26%Y\377\7\13\32\377" \
+  "\222\7\13\33\377\1\6\13\34\377\245\31*e\377\1\30)e\377\202\30)d\377\5" \
+  "\30)e\377\32+f\377\33,f\377\34-g\377\35-g\377\203\36.h\377\2\36-g\377" \
+  "\35.h\377\203\36.h\377\1\35-g\377\202\36.h\377\5\36-h\377\35-g\377\33" \
+  ",f\377\32+e\377\31*e\377\203\30)d\377\377\31*e\377\377\31*e\377\317\31" \
+  "*e\377\2\17\32\77\377\6\13\33\377\244\7\13\33\377\1\7\12\33\377\227\31" \
+  "*e\377\1\26%[\377\223\7\13\33\377\1\6\13\34\377\243\31*e\377\202\30)" \
+  "d\377\3\31*d\377\32+f\377\34,g\377\202\35-g\377\1\35.h\377\202\36.h\377" \
+  "\2\36.g\377\35-h\377\207\36.h\377\2\35-g\377\33,e\377\203\31*e\377\203" \
+  "\30)d\377\377\31*e\377\377\31*e\377\321\31*e\377\2\20\32@\377\6\12\33" \
+  "\377\244\7\13\33\377\2\7\13\32\377\30(a\377\226\31*e\377\1\26&\\\377" \
+  "\223\7\13\33\377\1\7\13\34\377\234\31*e\377\204\30)d\377\203\31*e\377" \
+  "\2\33,f\377\34-g\377\202\36.h\377\2\36.g\377\35-h\377\204\36.h\377\1" \
+  "\35-g\377\203\36.h\377\203\35-g\377\2\33,f\377\31*e\377\202\30)d\377" \
+  "\1\30)e\377\377\31*e\377\377\31*e\377\243\31*e\377\6\30)b\377\27'^\377" \
+  "\26%Y\377\25$W\377\24\"S\377\23\40O\377\202\22\36J\377\6\23!P\377\24" \
+  "#T\377\25$W\377\26%Y\377\27'^\377\30)d\377\245\31*e\377\2\20\32@\377" \
+  "\6\12\33\377\245\7\13\33\377\1\30(b\377\226\31*e\377\1\30(b\377\224\7" \
+  "\13\33\377\231\31*e\377\203\30)d\377\2\30)e\377\31*e\377\202\32+f\377" \
+  "\3\34,g\377\35.h\377\36/h\377\202\36.h\377\2\36-g\377\35-g\377\207\36" \
+  ".h\377\202\35-g\377\3\34,g\377\33,f\377\32*e\377\203\30)d\377\1\30*e" \
+  "\377\377\31*e\377\377\31*e\377\236\31*e\377\32\23\40M\377\22\36J\377" \
+  "\20\33B\377\16\30;\377\15\25""3\377\13\22.\377\13\21,\377\11\21*\377" \
+  "\12\20'\377\10\17%\377\10\16#\377\10\15!\377\7\13\37\377\7\12\33\377" \
+  "\7\13\33\377\7\14\37\377\7\15!\377\11\16#\377\11\17$\377\11\17(\377\12" \
+  "\21*\377\12\22,\377\13\22.\377\15\25""4\377\16\30<\377\25#V\377\240\31" \
+  "*e\377\2\20\32\77\377\6\12\33\377\244\7\13\33\377\2\6\13\33\377\30(b" \
+  "\377\226\31*e\377\1\30)d\377\224\7\13\33\377\1\30(b\377\225\31*e\377" \
+  "\203\30)d\377\6\31*e\377\32+f\377\33,g\377\34,g\377\35-g\377\35.h\377" \
+  "\203\36.h\377\1\36-g\377\204\36.h\377\1\35-g\377\204\36.h\377\5\34-g" \
+  "\377\33+f\377\32+e\377\31*e\377\30*e\377\202\30)d\377\215\31*e\377\2" \
+  "\27'^\377\22\36J\377\205\22\37L\377\1\23\37L\377\377\31*e\377\377\31" \
+  "*e\377\215\31*e\377\2\6\12\35\377\7\13\34\377\202\7\12\33\377\3\6\12" \
+  "\32\377\6\12\33\377\7\13\32\377\202\6\13\32\377\16\7\13\33\377\6\13\33" \
+  "\377\6\13\32\377\7\13\33\377\7\12\33\377\6\12\32\377\7\13\33\377\6\12" \
+  "\32\377\7\12\32\377\7\13\33\377\6\13\33\377\7\13\33\377\7\12\33\377\6" \
+  "\13\32\377\202\7\13\33\377\2\11\21*\377\30)c\377\237\31*e\377\2\17\32" \
+  "\77\377\6\13\33\377\244\7\13\33\377\2\6\12\32\377\30(b\377\226\31*e\377" \
+  "\1\30)d\377\224\7\13\33\377\1\30(b\377\221\31*e\377\204\30)d\377\2\32" \
+  "+e\377\33,f\377\202\35-h\377\2\35-g\377\35.h\377\203\36.h\377\1\35.h" \
+  "\377\205\36.h\377\1\35-g\377\202\36.h\377\3\35-g\377\34,g\377\32+f\377" \
+  "\202\31*e\377\1\31*d\377\203\30)d\377\217\31*e\377\2\24\"S\377\7\12\33" \
+  "\377\205\7\13\34\377\1\7\14\36\377\377\31*e\377\320\31*e\377\2\20\33" \
+  "B\377\7\13\32\377\216\7\13\35\377\2\7\14\35\377\6\13\35\377\207\7\13" \
+  "\35\377\6\7\13\34\377\10\17&\377\16\27""8\377\20\33D\377\25#U\377\30" \
+  ")d\377\235\31*e\377\1\6\12\33\377\231\7\13\33\377\1\21\34E\377\237\31" \
+  "*e\377\2\20\32@\377\6\12\33\377\245\7\13\33\377\1\30(a\377\226\31*e\377" \
+  "\1\30)d\377\223\7\13\33\377\2\6\12\32\377\26&\\\377\212\31*e\377\204" \
+  "\30)d\377\203\31*e\377\4\32+f\377\33,f\377\34-g\377\36/h\377\202\36." \
+  "h\377\2\36-g\377\35.g\377\211\36.h\377\203\35-g\377\3\33,f\377\32*e\377" \
+  "\31)d\377\202\30)d\377\225\31*e\377\1\24\"R\377\206\7\13\33\377\1\7\13" \
+  "\35\377\377\31*e\377\317\31*e\377\2\23\40M\377\7\13\32\377\217\7\13\33" \
+  "\377\3\6\13\33\377\7\13\33\377\6\13\32\377\206\7\13\33\377\13\6\13\33" \
+  "\377\7\13\33\377\6\12\32\377\7\13\33\377\6\12\33\377\7\13\33\377\7\14" \
+  "!\377\14\24""2\377\17\31>\377\23!Q\377\26%[\377\230\31*e\377\1\6\12\33" \
+  "\377\231\7\13\33\377\1\17\31>\377\237\31*e\377\2\20\32@\377\6\12\33\377" \
+  "\245\7\13\33\377\1\26&\\\377\226\31*e\377\2\30)d\377\7\12\33\377\223" \
+  "\7\13\33\377\2\23\40N\377\25$X\377\205\25$W\377\204\24#V\377\202\25$" \
+  "W\377\4\26%W\377\26%X\377\27%X\377\30&X\377\203\31'Y\377\3\36.h\377\36" \
+  "-g\377\35-g\377\204\36.h\377\1\35-g\377\204\36.h\377\5\35-g\377\34-g" \
+  "\377\34,f\377\33+f\377\31*e\377\203\30)d\377\1\30*e\377\227\31*e\377" \
+  "\1\24\"R\377\206\7\13\33\377\1\7\13\35\377\377\31*e\377\317\31*e\377" \
+  "\1\21\34D\377\235\7\13\33\377\1\6\12\33\377\203\7\13\33\377\3\6\13\33" \
+  "\377\7\13\33\377\6\13\32\377\203\30)d\377\225\31*e\377\1\6\12\33\377" \
+  "\231\7\13\33\377\1\17\31>\377\237\31*e\377\2\20\32\77\377\6\12\33\377" \
+  "\244\7\13\33\377\2\6\12\32\377\26%Z\377\226\31*e\377\3\30)d\377\7\13" \
+  "\33\377\6\13\33\377\222\7\13\33\377\3\10\16\"\377\10\16#\377\11\15#\377" \
+  "\204\11\15\"\377\1\11\15#\377\213\11\16#\377\1\12\17%\377\204\36.h\377" \
+  "\1\35-g\377\203\36.h\377\6\36.g\377\35-g\377\33,f\377\32+e\377\32*e\377" \
+  "\31*e\377\204\30)d\377\232\31*e\377\1\24\"R\377\206\7\13\33\377\1\6\12" \
+  "\34\377\377\31*e\377\317\31*e\377\2\21\34E\377\6\12\33\377\242\7\13\33" \
+  "\377\4\7\12\33\377\33,g\377\32+f\377\31*e\377\205\30)d\377\220\31*e\377" \
+  "\1\6\12\33\377\231\7\13\33\377\1\17\31>\377\237\31*e\377\2\17\32\77\377" \
+  "\6\13\33\377\244\7\13\33\377\2\6\12\33\377\26%Z\377\226\31*e\377\3\30" \
+  ")d\377\6\13\35\377\6\13\32\377\221\7\13\33\377\2\7\12\33\377\6\13\33" \
+  "\377\222\7\13\33\377\3\7\13\34\377\36.h\377\35-g\377\203\36.h\377\3\35" \
+  "-g\377\33,g\377\32+e\377\203\31*e\377\204\30)d\377\235\31*e\377\1\24" \
+  "\"R\377\206\7\13\33\377\3\6\12\34\377\21\34D\377\25$W\377\210\31*e\377" \
+  "\4\17\32\77\377\16\27""9\377\17\31>\377\20\33C\377\212\20\33B\377\205" \
+  "\22\37K\377\2\23\40N\377\24\"T\377\203\25#U\377\2\24\"T\377\25$X\377" \
+  "\205\27'^\377\1\30)c\377\377\31*e\377\245\31*e\377\2\21\34E\377\6\13" \
+  "\33\377\243\7\13\33\377\203\36.h\377\202\35.h\377\2\33,f\377\32+f\377" \
+  "\205\31*e\377\205\30)d\377\207\31*e\377\1\6\12\33\377\231\7\13\33\377" \
+  "\1\17\32>\377\237\31*e\377\1\16\30;\377\245\7\13\33\377\2\7\13\32\377" \
+  "\26%Z\377\226\31*e\377\2\30)d\377\6\14\35\377\246\7\13\33\377\1\7\13" \
+  "\34\377\202\35-g\377\3\33,f\377\32+e\377\31*e\377\203\30)d\377\244\31" \
+  "*e\377\1\24\"R\377\206\7\13\33\377\3\6\12\33\377\7\14\36\377\24\"R\377" \
+  "\206\31*e\377\2\30(a\377\15\25""5\377\202\7\13\33\377\1\6\13\32\377\212" \
+  "\7\13\33\377\3\6\12\33\377\7\13\33\377\6\13\33\377\202\7\13\33\377\3" \
+  "\7\12\32\377\7\12\33\377\6\13\32\377\212\7\13\33\377\2\11\17$\377\27" \
+  "'^\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\12\33\377\243\7\13\33" \
+  "\377\202\36.h\377\2\35-g\377\36-g\377\204\36.h\377\6\35.h\377\34-g\377" \
+  "\34,f\377\33,g\377\32+e\377\32+f\377\203\31*e\377\206\30)d\377\2\31*" \
+  "e\377\6\12\33\377\231\7\13\33\377\1\17\32>\377\203\31*e\377\203\30)d" \
+  "\377\1\30(b\377\203\27(`\377\1\27'^\377\203\26&\\\377\1\26%Y\377\203" \
+  "\25$W\377\1\25$X\377\203\25$W\377\3\25#U\377\24\"R\377\30(a\377\203\31" \
+  "*e\377\1\26%Z\377\202\25$W\377\2\14\26""5\377\6\12\32\377\245\7\13\33" \
+  "\377\1\25#U\377\226\31*e\377\2\30)d\377\7\15!\377\246\7\13\33\377\2\7" \
+  "\13\34\377\31*e\377\204\30)d\377\247\31*e\377\1\24\"R\377\207\7\13\33" \
+  "\377\2\11\17&\377\27'_\377\205\31*e\377\3\30(b\377\14\26""5\377\6\13" \
+  "\32\377\236\7\13\33\377\3\7\13\32\377\11\20&\377\27'^\377\377\31*e\377" \
+  "\244\31*e\377\2\21\34E\377\6\12\33\377\243\7\13\33\377\206\36.h\377\2" \
+  "\36-g\377\35-g\377\205\36.h\377\11\35.h\377\35-g\377\30%V\377\24\40K" \
+  "\377\23\37I\377\25\"Q\377\30'^\377\31+f\377\31*e\377\202\30)d\377\1\6" \
+  "\12\33\377\231\7\13\33\377\1\17\31>\377\202\31*e\377\2\17\31\77\377\13" \
+  "\21,\377\202\12\22-\377\14\13\22,\377\12\21)\377\12\20*\377\12\20)\377" \
+  "\11\20(\377\12\20'\377\12\20&\377\11\17'\377\11\17%\377\10\16#\377\11" \
+  "\17$\377\10\17#\377\203\11\17$\377\4\10\16$\377\10\15#\377\7\13\35\377" \
+  "\25$W\377\203\31*e\377\4\14\23""1\377\11\17$\377\11\17#\377\7\13\37\377" \
+  "\246\7\13\33\377\1\24\"R\377\224\31*e\377\202\30)d\377\2\27(c\377\11" \
+  "\16%\377\246\7\13\33\377\1\7\13\34\377\202\30)d\377\252\31*e\377\1\24" \
+  "\"R\377\207\7\13\33\377\1\13\24""2\377\205\31*e\377\4\30(a\377\13\22" \
+  "-\377\7\13\33\377\6\13\32\377\236\7\13\33\377\3\7\13\32\377\11\17#\377" \
+  "\27&]\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\12\33\377\243\7\13" \
+  "\33\377\203\36.h\377\1\36-g\377\207\36.h\377\5\26!M\377\17\30:\377\11" \
+  "\20%\377\10\14\36\377\7\13\35\377\202\7\12\33\377\7\7\13\35\377\6\13" \
+  "\35\377\7\14\37\377\12\17&\377\17\30""8\377\23\37H\377\7\12\33\377\231" \
+  "\7\13\33\377\1\17\31>\377\202\31*e\377\2\13\22-\377\6\12\32\377\202\7" \
+  "\13\33\377\6\6\12\32\377\6\12\33\377\7\13\33\377\6\13\33\377\7\12\32" \
+  "\377\6\13\33\377\202\7\13\33\377\5\6\13\32\377\6\12\33\377\7\13\33\377" \
+  "\6\12\33\377\6\13\33\377\202\7\13\33\377\4\7\12\33\377\7\13\33\377\6" \
+  "\12\32\377\25#U\377\203\31*e\377\3\12\20)\377\7\12\33\377\7\13\32\377" \
+  "\246\7\13\33\377\2\6\13\33\377\24!R\377\216\31*e\377\206\30)d\377\203" \
+  "\31*e\377\1\10\16$\377\246\7\13\33\377\1\7\13\34\377\254\31*e\377\1\24" \
+  "!R\377\206\7\13\33\377\2\6\13\32\377\21\35G\377\204\31*e\377\5\27&]\377" \
+  "\12\20(\377\6\13\33\377\6\12\32\377\6\13\32\377\236\7\13\33\377\3\6\13" \
+  "\33\377\7\15!\377\27&]\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\13" \
+  "\33\377\243\7\13\33\377\3\31*e\377\33,f\377\34-g\377\204\35-g\377\204" \
+  "\36.h\377\1\12\21*\377\210\7\13\33\377\1\7\13\32\377\203\7\13\33\377" \
+  "\1\6\13\32\377\231\7\13\33\377\5\16\31>\377\30)d\377\31*e\377\13\23." \
+  "\377\6\12\32\377\224\7\13\33\377\1\25#U\377\203\31*e\377\1\11\20)\377" \
+  "\251\7\13\33\377\1\23!P\377\206\30)d\377\210\31*e\377\12\32+f\377\33" \
+  "+f\377\34,g\377\34-h\377\35.h\377\36.h\377\36/i\377\36.h\377\35-g\377" \
+  "\14\22,\377\246\7\13\33\377\1\7\13\34\377\254\31*e\377\2\26%[\377\11" \
+  "\17&\377\205\7\13\33\377\2\6\13\34\377\26&\\\377\203\31*e\377\4\27(`" \
+  "\377\13\23.\377\7\13\33\377\6\13\33\377\241\7\13\33\377\2\7\15\40\377" \
+  "\26&]\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\12\33\377\243\7\13" \
+  "\33\377\204\30)d\377\4\31*e\377\32+e\377\33+f\377\34,f\377\202\34-g\377" \
+  "\2\35-g\377\13\22,\377\246\7\13\33\377\5\17\32>\377\31*e\377\30)d\377" \
+  "\13\22.\377\6\12\32\377\224\7\13\33\377\1\25#U\377\203\31*e\377\1\11" \
+  "\20)\377\251\7\13\33\377\1\22\36K\377\202\31*e\377\204\32+f\377\6\33" \
+  ",g\377\33,f\377\34,g\377\34-g\377\35-h\377\35.h\377\206\36.h\377\2\36" \
+  "-h\377\35-g\377\202\36-g\377\2\35-g\377\13\22-\377\246\7\13\33\377\1" \
+  "\7\13\34\377\255\31*e\377\2\17\31>\377\6\12\32\377\203\7\13\33\377\2" \
+  "\6\12\32\377\10\15\40\377\204\31*e\377\3\26%Y\377\10\16\"\377\6\12\32" \
+  "\377\241\7\13\33\377\3\6\13\32\377\6\13\34\377\26&[\377\377\31*e\377" \
+  "\244\31*e\377\2\21\34E\377\6\12\33\377\243\7\13\33\377\204\31*e\377\204" \
+  "\30)d\377\203\31*e\377\1\12\22+\377\246\7\13\33\377\5\20\33\77\377\34" \
+  "-h\377\34-g\377\13\20)\377\7\12\33\377\224\7\13\33\377\1\24\"T\377\203" \
+  "\30)d\377\2\11\20)\377\7\12\33\377\250\7\13\33\377\1\25\40K\377\202\35" \
+  "-g\377\2\35-h\377\35.h\377\206\36.h\377\4\36.g\377\36-h\377\36.h\377" \
+  "\35-g\377\202\36-g\377\206\36.h\377\3\35-g\377\15\24/\377\6\12\33\377" \
+  "\245\7\13\33\377\1\7\13\34\377\255\31*e\377\2\23!P\377\10\14\37\377\203" \
+  "\7\13\33\377\2\6\13\33\377\7\14\37\377\204\31*e\377\2\25#V\377\7\14\36" \
+  "\377\242\7\13\33\377\3\7\12\32\377\6\13\33\377\26&\\\377\377\31*e\377" \
+  "\244\31*e\377\2\21\34E\377\6\12\33\377\243\7\13\33\377\210\31*e\377\203" \
+  "\30)d\377\1\12\21+\377\246\7\13\33\377\1\21\33\77\377\202\36.h\377\2" \
+  "\11\17%\377\6\13\32\377\223\7\13\33\377\3\7\12\32\377\27%W\377\34,g\377" \
+  "\202\33,g\377\2\13\21*\377\7\12\33\377\247\7\13\33\377\2\6\13\33\377" \
+  "\25!L\377\202\36.h\377\4\36.g\377\36-h\377\36.h\377\35-g\377\202\36-" \
+  "g\377\212\36.h\377\2\35.h\377\36-g\377\202\36.h\377\3\35-g\377\17\27" \
+  "5\377\6\12\32\377\245\7\13\33\377\1\7\13\34\377\255\31*e\377\2\27'_\377" \
+  "\11\16#\377\204\7\13\33\377\1\7\13\35\377\204\31*e\377\3\24\"S\377\6" \
+  "\13\32\377\6\12\32\377\241\7\13\33\377\3\7\12\32\377\7\13\33\377\26%" \
+  "Z\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\13\33\377\243\7\13\33" \
+  "\377\213\31*e\377\1\12\22+\377\246\7\13\33\377\1\21\34@\377\202\36.h" \
+  "\377\2\12\17&\377\6\13\32\377\224\7\13\33\377\1\31%W\377\202\36.h\377" \
+  "\2\35,e\377\12\21(\377\251\7\13\33\377\1\25!L\377\204\36.h\377\2\35." \
+  "h\377\36-h\377\207\36.h\377\1\35-h\377\206\35-g\377\5\34,g\377\33,f\377" \
+  "\32*e\377\15\26""5\377\7\13\32\377\245\7\13\33\377\1\7\13\34\377\256" \
+  "\31*e\377\1\12\20(\377\204\7\13\33\377\2\7\12\33\377\30(a\377\203\31" \
+  "*e\377\1\24!Q\377\245\7\13\33\377\1\26%Z\377\377\31*e\377\244\31*e\377" \
+  "\2\21\34E\377\6\12\33\377\243\7\13\33\377\213\31*e\377\1\12\22+\377\246" \
+  "\7\13\33\377\5\21\34@\377\36.h\377\36-h\377\12\17&\377\6\12\33\377\223" \
+  "\7\13\33\377\5\7\12\33\377\31'Y\377\36.h\377\30%V\377\13\23,\377\252" \
+  "\7\13\33\377\1\25!L\377\205\36.h\377\2\35.h\377\35-h\377\203\35-g\377" \
+  "\202\34,g\377\1\34,f\377\202\33+f\377\2\32+f\377\32+e\377\202\31*e\377" \
+  "\203\30)d\377\3\27(c\377\15\25""4\377\7\13\32\377\245\7\13\33\377\1\7" \
+  "\13\34\377\256\31*e\377\1\16\27""9\377\204\7\13\33\377\2\6\13\34\377" \
+  "\26%Y\377\203\31*e\377\2\21\36I\377\7\12\33\377\243\7\13\33\377\2\7\12" \
+  "\32\377\26%Z\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\12\33\377\243" \
+  "\7\13\33\377\213\31*e\377\1\12\22+\377\246\7\13\33\377\5\21\33\77\377" \
+  "\35-h\377\35.h\377\10\16!\377\7\12\33\377\223\7\13\33\377\5\7\13\32\377" \
+  "\22\34A\377\20\31""9\377\11\16\"\377\7\12\33\377\252\7\13\33\377\1\24" \
+  "\40K\377\202\34,f\377\2\33,f\377\33+f\377\202\32+f\377\1\32*e\377\205" \
+  "\31*e\377\207\30)d\377\203\31*e\377\3\30)d\377\15\25""5\377\7\13\32\377" \
+  "\245\7\13\33\377\1\7\13\34\377\256\31*e\377\2\21\35F\377\6\12\33\377" \
+  "\203\7\13\33\377\2\6\13\34\377\24\"R\377\202\31*e\377\2\30)d\377\17\32" \
+  "@\377\244\7\13\33\377\2\7\12\33\377\26%Z\377\377\31*e\377\244\31*e\377" \
+  "\2\21\34E\377\6\12\33\377\243\7\13\33\377\213\31*e\377\1\12\21+\377\246" \
+  "\7\13\33\377\1\17\31>\377\202\31*e\377\2\6\13\34\377\7\12\33\377\223" \
+  "\7\13\33\377\5\6\12\32\377\6\13\34\377\6\13\33\377\7\13\33\377\6\13\33" \
+  "\377\251\7\13\33\377\2\7\12\32\377\20\33B\377\204\31*e\377\210\30)d\377" \
+  "\212\31*e\377\2\30)d\377\14\25""4\377\246\7\13\33\377\1\7\13\34\377\256" \
+  "\31*e\377\1\24\"R\377\204\7\13\33\377\2\7\13\34\377\22\37L\377\202\31" \
+  "*e\377\3\30)d\377\16\27""8\377\6\13\32\377\243\7\13\33\377\2\6\12\32" \
+  "\377\26%Z\377\377\31*e\377\244\31*e\377\2\21\34E\377\6\13\33\377\243" \
+  "\7\13\33\377\213\31*e\377\1\13\22,\377\246\7\13\33\377\1\17\32>\377\202" \
+  "\31*e\377\1\7\14\35\377\303\7\13\33\377\1\20\33B\377\227\31*e\377\1\17" \
+  "\31=\377\246\7\13\33\377\1\7\13\34\377\256\31*e\377\3\27'`\377\7\13\32" \
+  "\377\6\13\32\377\202\7\13\33\377\2\7\13\34\377\22\37K\377\202\31*e\377" \
+  "\2\30)d\377\14\25""3\377\245\7\13\33\377\1\25#T\377\377\31*e\377\244" \
+  "\31*e\377\2\21\34E\377\6\12\33\377\243\7\13\33\377\205\31*e\377\7\30" \
+  ")c\377\27'^\377\26%Z\377\25$W\377\24\"R\377\23!P\377\11\16%\377\246\7" \
+  "\13\33\377\1\17\32>\377\202\31*e\377\1\7\13\35\377\303\7\13\33\377\1" \
+  "\20\32@\377\227\31*e\377\1\17\31<\377\246\7\13\33\377\1\7\13\34\377\234" \
+  "\31*e\377\1\25$X\377\221\26%Y\377\1\27'^\377\205\7\13\33\377\1\20\33" \
+  "A\377\202\31*e\377\2\30)d\377\15\25""4\377\244\7\13\33\377\3\7\12\32" \
+  "\377\22\36I\377\26%[\377\377\31*e\377\243\31*e\377\2\21\34E\377\6\12" \
+  "\33\377\243\7\13\33\377\14\24!P\377\22\36I\377\20\32@\377\15\26""7\377" \
+  "\15\25""4\377\13\23""0\377\12\21*\377\12\20'\377\11\16$\377\7\13\37\377" \
+  "\7\13\33\377\6\12\33\377\246\7\13\33\377\1\17\31>\377\202\31*e\377\1" \
+  "\6\12\33\377\302\7\13\33\377\2\7\13\32\377\16\30:\377\227\31*e\377\2" \
+  "\20\32@\377\6\12\32\377\245\7\13\33\377\1\7\13\34\377\233\31*e\377\2" \
+  "\30)c\377\10\15!\377\221\11\17&\377\2\11\20'\377\6\12\33\377\204\7\13" \
+  "\33\377\1\16\30""9\377\202\31*e\377\3\30)d\377\13\23/\377\6\12\33\377" \
+  "\244\7\13\33\377\4\11\16#\377\11\17'\377\16\30:\377\27'`\377\377\31*" \
+  "e\377\241\31*e\377\2\21\34E\377\6\12\33\377\243\7\13\33\377\11\7\13\36" \
+  "\377\7\13\35\377\7\13\34\377\7\13\32\377\6\13\33\377\6\13\32\377\7\12" \
+  "\33\377\7\13\33\377\7\12\32\377\202\7\13\33\377\1\7\12\33\377\246\7\13" \
+  "\33\377\1\17\31>\377\202\31*e\377\2\6\13\32\377\7\12\33\377\301\7\13" \
+  "\33\377\2\6\12\32\377\16\30:\377\227\31*e\377\1\21\34D\377\246\7\13\33" \
+  "\377\1\7\13\34\377\233\31*e\377\2\30)c\377\7\13\33\377\221\6\13\33\377" \
+  "\202\7\13\33\377\1\6\13\33\377\202\7\13\33\377\2\7\13\32\377\14\24""3" \
+  "\377\202\31*e\377\2\30)c\377\13\21,\377\244\7\13\33\377\1\6\12\33\377" \
+  "\202\7\13\33\377\3\7\13\32\377\11\17&\377\26%Y\377\377\31*e\377\240\31" \
+  "*e\377\2\21\34E\377\6\13\33\377\325\7\13\33\377\1\17\32>\377\202\31*" \
+  "e\377\304\7\13\33\377\1\13\24""2\377\227\31*e\377\1\20\34D\377\246\7" \
+  "\13\33\377\1\7\13\34\377\233\31*e\377\1\30)c\377\227\7\13\33\377\2\6" \
+  "\13\32\377\12\22,\377\202\31*e\377\2\30)c\377\10\17%\377\252\7\13\33" \
+  "\377\4\24!Q\377\30)c\377\30)b\377\30(b\377\377\31*e\377\234\31*e\377" \
+  "\2\21\34E\377\6\12\33\377\325\7\13\33\377\1\17\32>\377\202\31*e\377\304" \
+  "\7\13\33\377\1\14\24""2\377\227\31*e\377\2\22\37J\377\6\13\32\377\245" \
+  "\7\13\33\377\4\7\13\34\377\26%[\377\26&\\\377\30(b\377\230\31*e\377\1" \
+  "\26&[\377\230\7\13\33\377\1\13\22,\377\202\31*e\377\2\30)c\377\11\17" \
+  "$\377\253\7\13\33\377\3\13\22/\377\14\24""1\377\13\23.\377\377\31*e\377" \
+  "\234\31*e\377\2\21\34E\377\6\12\33\377\325\7\13\33\377\1\17\31>\377\202" \
+  "\31*e\377\1\7\13\32\377\302\7\13\33\377\2\7\13\32\377\13\22-\377\227" \
+  "\31*e\377\2\23\37L\377\7\12\32\377\245\7\13\33\377\7\6\13\32\377\10\15" \
+  "#\377\12\20(\377\13\22.\377\15\26""7\377\21\34E\377\26%Z\377\223\31*" \
+  "e\377\3\30)b\377\20\33B\377\12\20)\377\230\7\13\33\377\6\12\21)\377\30" \
+  "(b\377\31*e\377\30)c\377\10\14\37\377\7\13\32\377\250\7\13\33\377\3\6" \
+  "\12\33\377\7\13\33\377\6\12\32\377\202\7\13\33\377\377\31*e\377\234\31" \
+  "*e\377\2\21\34E\377\6\12\33\377\325\7\13\33\377\1\17\31>\377\202\31*" \
+  "e\377\303\7\13\33\377\2\6\12\33\377\12\21*\377\227\31*e\377\1\23\40O" \
+  "\377\247\7\13\33\377\1\7\13\32\377\203\7\13\33\377\4\7\13\35\377\10\13" \
+  "\37\377\13\22,\377\26%Z\377\206\31*e\377\205\27(`\377\3\27'`\377\27'" \
+  "_\377\25$X\377\202\25$W\377\2\22\36J\377\10\16$\377\231\7\13\33\377\7" \
+  "\6\13\32\377\11\20&\377\27&]\377\31*e\377\30)c\377\7\13\35\377\6\12\32" \
+  "\377\255\7\13\33\377\377\31*e\377\234\31*e\377\2\21\34E\377\6\13\33\377" \
+  "\325\7\13\33\377\1\17\32>\377\202\31*e\377\304\7\13\33\377\1\12\20*\377" \
+  "\227\31*e\377\1\24#T\377\255\7\13\33\377\3\6\13\33\377\7\13\33\377\21" \
+  "\35F\377\204\31*e\377\1\16\30<\377\205\6\13\32\377\206\7\13\33\377\1" \
+  "\7\12\33\377\231\7\13\33\377\6\6\13\33\377\10\16$\377\26%Y\377\31*e\377" \
+  "\30)c\377\7\12\34\377\256\7\13\33\377\1\31*e\377\204\30)b\377\202\30" \
+  ")c\377\1\30)d\377\377\31*e\377\224\31*e\377\2\21\34E\377\6\12\33\377" \
+  "\325\7\13\33\377\3\17\32>\377\31*e\377\30)c\377\304\7\13\33\377\1\12" \
+  "\20*\377\227\31*e\377\1\24\"T\377\257\7\13\33\377\2\10\16\"\377\26%Y" \
+  "\377\202\31*e\377\2\30(a\377\14\24""0\377\246\7\13\33\377\5\11\15#\377" \
+  "\25$V\377\31*e\377\30)c\377\6\13\32\377\256\7\13\33\377\205\14\24""1" \
+  "\377\7\14\25""3\377\16\27""8\377\20\33A\377\22\37K\377\23!Q\377\25$W" \
+  "\377\27&\\\377\377\31*e\377\220\31*e\377\2\21\34E\377\6\13\33\377\325" \
+  "\7\13\33\377\3\17\31>\377\31*e\377\27&]\377\303\7\13\33\377\2\7\12\33" \
+  "\377\11\21)\377\227\31*e\377\1\24\"T\377\256\7\13\33\377\3\7\13\32\377" \
+  "\10\13\37\377\23\40N\377\202\31*e\377\3\26%Z\377\10\16#\377\6\12\32\377" \
+  "\244\7\13\33\377\6\7\12\33\377\10\15!\377\24\"S\377\31*e\377\30)c\377" \
+  "\6\12\32\377\266\7\13\33\377\5\6\12\32\377\7\13\32\377\10\16\"\377\12" \
+  "\20'\377\27'^\377\366\31*e\377\1\23\40O\377\227\31*e\377\1\22\37L\377" \
+  "\326\7\13\33\377\3\17\31>\377\31*e\377\26&\\\377\303\7\13\33\377\2\7" \
+  "\12\32\377\12\20(\377\227\31*e\377\1\24\"T\377\202\7\12\32\377\254\7" \
+  "\13\33\377\3\7\13\32\377\6\12\32\377\21\33D\377\202\31*e\377\1\24\"S" \
+  "\377\202\6\12\32\377\245\7\13\33\377\5\7\14\36\377\23\40N\377\31*e\377" \
+  "\30)c\377\6\12\33\377\271\7\13\33\377\2\6\12\33\377\12\22-\377\365\31" \
+  "*e\377\2\27'^\377\10\15\37\377\227\31*e\377\2\23\40N\377\7\13\32\377" \
+  "\325\7\13\33\377\4\17\32>\377\31*e\377\26&\\\377\6\12\33\377\303\7\13" \
+  "\33\377\2\12\20(\377\30)d\377\226\31*e\377\1\25#V\377\260\7\13\33\377" \
+  "\5\15\27""7\377\30)b\377\30)d\377\17\32\77\377\6\12\32\377\245\7\13\33" \
+  "\377\6\7\12\33\377\7\13\34\377\22\36I\377\31*e\377\30)c\377\6\12\32\377" \
+  "\273\7\13\33\377\1\22\36H\377\212\31*e\377\25\30)d\377\30)c\377\30(b" \
+  "\377\30(a\377\27'`\377\25\"T\377\22\36J\377\17\32>\377\17\31=\377\15" \
+  "\26""5\377\12\22-\377\10\16\"\377\12\20'\377\13\23/\377\16\30:\377\17" \
+  "\31=\377\21\34D\377\23\40M\377\25#V\377\27(`\377\30(a\377\202\30(b\377" \
+  "\1\30)b\377\202\30)c\377\317\31*e\377\3\30)b\377\14\24""2\377\6\12\33" \
+  "\377\227\31*e\377\1\23\40N\377\326\7\13\33\377\3\17\32>\377\31*e\377" \
+  "\26%Y\377\303\7\13\33\377\3\6\13\33\377\11\17&\377\27(`\377\226\31*e" \
+  "\377\3\25$V\377\7\13\33\377\6\12\33\377\255\7\13\33\377\5\7\13\32\377" \
+  "\12\21*\377\27'_\377\30)d\377\12\21+\377\247\7\13\33\377\5\6\12\33\377" \
+  "\21\35F\377\31*e\377\30)c\377\6\12\32\377\272\7\13\33\377\3\7\12\32\377" \
+  "\12\20(\377\30(a\377\210\31*e\377\10\27'`\377\20\32@\377\13\23""0\377" \
+  "\11\16#\377\7\13\33\377\6\13\33\377\7\13\33\377\6\13\32\377\203\7\13" \
+  "\33\377\3\6\13\33\377\7\13\33\377\7\12\33\377\206\7\13\33\377\7\6\13" \
+  "\32\377\7\13\33\377\7\13\35\377\11\17$\377\12\21+\377\14\24""2\377\20" \
+  "\33A\377\317\31*e\377\1\23\40N\377\202\7\13\33\377\227\31*e\377\1\23" \
+  "\40N\377\326\7\13\33\377\3\17\31>\377\31*e\377\24\"S\377\304\7\13\33" \
+  "\377\2\11\17%\377\27'_\377\226\31*e\377\3\25$X\377\7\14\35\377\6\12\32" \
+  "\377\256\7\13\33\377\4\7\14\35\377\26%Z\377\30)d\377\7\13\32\377\250" \
+  "\7\13\33\377\4\20\34D\377\31*e\377\30)c\377\6\12\32\377\272\7\13\33\377" \
+  "\3\6\13\32\377\10\16#\377\25$X\377\210\31*e\377\4\20\34C\377\7\12\33" \
+  "\377\7\13\33\377\7\13\32\377\220\7\13\33\377\1\6\13\33\377\202\7\12\33" \
+  "\377\203\7\13\33\377\1\13\23/\377\316\31*e\377\4\30)d\377\21\35F\377" \
+  "\6\12\32\377\7\13\33\377\227\31*e\377\2\23\40N\377\7\13\32\377\325\7" \
+  "\13\33\377\4\17\31>\377\31*e\377\24\"S\377\6\12\33\377\302\7\13\33\377" \
+  "\3\6\12\32\377\11\17%\377\26&\\\377\226\31*e\377\3\26%Y\377\10\15\40" \
+  "\377\6\13\32\377\255\7\13\33\377\5\6\13\33\377\6\12\32\377\25$X\377\27" \
+  "'^\377\6\12\33\377\250\7\13\33\377\4\17\32\77\377\31*e\377\30)c\377\6" \
+  "\12\33\377\272\7\13\33\377\3\6\12\32\377\10\16\"\377\25#U\377\210\31" \
+  "*e\377\2\17\31>\377\7\12\33\377\230\7\13\33\377\1\13\23""0\377\316\31" \
+  "*e\377\4\30)d\377\21\34F\377\7\12\32\377\7\13\33\377\227\31*e\377\2\23" \
+  "\40N\377\6\12\32\377\325\7\13\33\377\3\17\32>\377\31*e\377\24\"S\377" \
+  "\304\7\13\33\377\2\10\16#\377\26%Z\377\226\31*e\377\2\26%Z\377\10\16" \
+  "#\377\256\7\13\33\377\2\6\13\33\377\7\12\32\377\202\26%Z\377\251\7\13" \
+  "\33\377\1\16\27""8\377\202\30)c\377\1\6\12\32\377\272\7\13\33\377\3\6" \
+  "\12\32\377\10\14\36\377\23!P\377\210\31*e\377\2\17\31>\377\7\13\32\377" \
+  "\230\7\13\33\377\1\13\23""0\377\225\31*e\377\205\30)c\377\204\30)d\377" \
+  "\260\31*e\377\4\30)d\377\21\35F\377\7\13\33\377\6\12\32\377\227\31*e" \
+  "\377\1\23\40N\377\326\7\13\33\377\3\17\32>\377\31*e\377\23\40O\377\304" \
+  "\7\13\33\377\2\10\16\"\377\25$X\377\226\31*e\377\2\26&[\377\11\17$\377" \
+  "\257\7\13\33\377\3\7\14\36\377\26%[\377\26%Z\377\250\7\13\33\377\5\6" \
+  "\12\32\377\14\23/\377\30(a\377\30)c\377\6\12\32\377\272\7\13\33\377\3" \
+  "\6\13\33\377\7\13\33\377\22\36J\377\210\31*e\377\2\17\31>\377\7\13\32" \
+  "\377\230\7\13\33\377\1\13\23""0\377\225\31*e\377\13\14\24""2\377\13\22" \
+  ",\377\15\25""3\377\14\24""3\377\14\25""3\377\16\30""9\377\17\30<\377" \
+  "\17\33A\377\21\35E\377\22\36J\377\26&]\377\256\31*e\377\4\30)d\377\21" \
+  "\34E\377\6\12\33\377\6\13\32\377\227\31*e\377\1\23\40N\377\326\7\13\33" \
+  "\377\3\17\31>\377\31*e\377\22\36I\377\304\7\13\33\377\3\7\12\33\377\14" \
+  "\23""0\377\25#U\377\225\31*e\377\3\26&\\\377\12\20'\377\7\12\32\377\256" \
+  "\7\13\33\377\3\11\16$\377\27&]\377\26%Z\377\252\7\13\33\377\3\21\34E" \
+  "\377\30)d\377\7\12\33\377\274\7\13\33\377\1\21\35F\377\210\31*e\377\1" \
+  "\17\32>\377\231\7\13\33\377\1\13\23""0\377\225\31*e\377\5\10\15\"\377" \
+  "\7\13\33\377\6\13\33\377\6\12\33\377\6\13\32\377\205\7\13\33\377\1\22" \
+  "\37L\377\256\31*e\377\5\30)d\377\20\32@\377\6\12\32\377\7\13\33\377\27" \
+  "'^\377\226\31*e\377\2\23\40N\377\7\13\32\377\325\7\13\33\377\4\17\31" \
+  ">\377\31*e\377\21\36I\377\6\13\33\377\302\7\13\33\377\1\6\13\32\377\202" \
+  "\7\13\33\377\3\7\14\37\377\16\27""8\377\30)b\377\223\31*e\377\3\27&]" \
+  "\377\11\20)\377\6\13\32\377\256\7\13\33\377\4\13\22+\377\27'_\377\26" \
+  "%Z\377\6\13\32\377\247\7\13\33\377\203\6\13\32\377\2\27&]\377\7\12\33" \
+  "\377\273\7\13\33\377\2\6\12\32\377\20\33A\377\210\31*e\377\1\16\30;\377" \
+  "\231\7\13\33\377\1\13\23""0\377\225\31*e\377\1\11\16#\377\210\7\13\33" \
+  "\377\2\6\13\35\377\23\37M\377\256\31*e\377\5\30)d\377\17\31>\377\6\12" \
+  "\32\377\7\13\33\377\27'_\377\226\31*e\377\2\23\40N\377\6\12\32\377\325" \
+  "\7\13\33\377\3\17\32>\377\31*e\377\22\36I\377\306\7\13\33\377\5\7\13" \
+  "\32\377\7\13\33\377\10\15!\377\23\40N\377\30)d\377\221\31*e\377\2\27" \
+  "']\377\12\21*\377\257\7\13\33\377\3\12\21+\377\27'`\377\26%Z\377\247" \
+  "\7\13\33\377\1\6\12\33\377\202\7\13\33\377\2\15\26""4\377\30)d\377\275" \
+  "\7\13\33\377\2\16\30:\377\30)c\377\207\31*e\377\1\15\26""5\377\231\7" \
+  "\13\33\377\1\14\23""0\377\205\31*e\377\204\30)d\377\214\31*e\377\1\11" \
+  "\16#\377\210\7\13\33\377\2\7\13\34\377\23\37M\377\203\31*e\377\245\30" \
+  ")d\377\206\31*e\377\2\30)c\377\15\27""7\377\202\7\13\33\377\1\25%X\377" \
+  "\226\31*e\377\1\23\40N\377\326\7\13\33\377\3\17\32>\377\31*e\377\21\34" \
+  "D\377\311\7\13\33\377\2\6\13\32\377\25#V\377\221\31*e\377\2\27']\377" \
+  "\12\20*\377\257\7\13\33\377\3\13\24""0\377\30(a\377\26%Z\377\247\7\13" \
+  "\33\377\6\6\13\33\377\7\13\33\377\11\17%\377\27'_\377\30)c\377\6\12\32" \
+  "\377\274\7\13\33\377\2\14\24""2\377\30(a\377\207\31*e\377\2\15\26""5" \
+  "\377\7\12\33\377\227\7\13\33\377\16\7\13\32\377\12\22.\377\27(`\377\26" \
+  "%Y\377\25#V\377\24\"R\377\23\37L\377\20\32A\377\15\26""5\377\14\23""0" \
+  "\377\14\25""3\377\23\40N\377\26&\\\377\30)d\377\211\31*e\377\1\11\16" \
+  "$\377\210\7\13\33\377\7\7\13\35\377\23\40N\377\31*e\377\27&\\\377\23" \
+  "!Q\377\16\27""8\377\14\24""3\377\243\15\25""3\377\1\23\40N\377\205\31" \
+  "*e\377\5\30)b\377\14\25""3\377\7\13\33\377\7\12\33\377\25#U\377\226\31" \
+  "*e\377\1\23\40N\377\326\7\13\33\377\4\17\31>\377\31*e\377\20\32\77\377" \
+  "\7\12\33\377\307\7\13\33\377\3\6\12\32\377\7\12\32\377\26$X\377\221\31" \
+  "*e\377\3\30(a\377\12\22,\377\7\12\32\377\256\7\13\33\377\3\15\26""7\377" \
+  "\30)c\377\26%Z\377\247\7\13\33\377\6\7\13\32\377\7\14\37\377\23\40M\377" \
+  "\31*e\377\30)c\377\6\12\32\377\274\7\13\33\377\2\13\22-\377\27'`\377" \
+  "\207\31*e\377\2\15\26""5\377\7\12\33\377\230\7\13\33\377\5\10\14\37\377" \
+  "\12\20*\377\11\16$\377\7\13\35\377\6\12\32\377\206\7\13\33\377\3\11\17" \
+  "&\377\15\26""8\377\26$X\377\210\31*e\377\1\11\16#\377\210\7\13\33\377" \
+  "\5\7\13\35\377\24\"S\377\31*e\377\13\22.\377\6\12\32\377\202\7\12\32" \
+  "\377\242\7\13\33\377\3\6\13\32\377\7\14\37\377\25$X\377\204\31*e\377" \
+  "\5\30)b\377\14\24""1\377\6\12\33\377\7\13\33\377\24!Q\377\226\31*e\377" \
+  "\2\23\40M\377\7\13\32\377\325\7\13\33\377\4\17\31>\377\31*e\377\20\32" \
+  "\77\377\7\12\33\377\311\7\13\33\377\1\17\31\77\377\211\22\36H\377\2\21" \
+  "\35G\377\25$X\377\202\31*e\377\1\21\35F\377\202\22\36H\377\4\21\35H\377" \
+  "\22\36I\377\14\24""1\377\6\12\33\377\256\7\13\33\377\4\16\30<\377\31" \
+  "*e\377\26%Z\377\6\13\32\377\247\7\13\33\377\1\13\22,\377\202\31*e\377" \
+  "\2\30)c\377\6\12\33\377\273\7\13\33\377\3\7\12\33\377\12\20&\377\27'" \
+  "_\377\207\31*e\377\2\15\26""5\377\6\12\32\377\233\7\13\33\377\3\7\12" \
+  "\33\377\7\13\33\377\6\13\33\377\205\7\13\33\377\3\6\12\33\377\6\13\33" \
+  "\377\21\35G\377\206\31*e\377\2\30)d\377\16\27:\377\211\7\13\33\377\4" \
+  "\7\14\34\377\26%Z\377\31*e\377\10\15#\377\245\7\13\33\377\202\6\12\32" \
+  "\377\1\11\17&\377\204\31*e\377\5\30(b\377\12\21+\377\7\13\33\377\7\12" \
+  "\32\377\22\37M\377\226\31*e\377\2\24#T\377\6\12\32\377\325\7\13\33\377" \
+  "\3\17\32>\377\31*e\377\20\32\77\377\325\7\13\33\377\3\15\25""4\377\30" \
+  ")b\377\26%[\377\204\7\13\33\377\2\10\16\"\377\12\22,\377\256\7\13\33" \
+  "\377\4\7\12\33\377\20\33C\377\31*e\377\26%Z\377\247\7\13\33\377\2\6\13" \
+  "\32\377\13\22-\377\202\31*e\377\2\30)c\377\6\12\32\377\273\7\13\33\377" \
+  "\3\6\13\32\377\10\14\37\377\27&]\377\207\31*e\377\2\15\26""5\377\7\12" \
+  "\33\377\245\7\13\33\377\1\21\35G\377\205\31*e\377\2\30)c\377\16\26""8" \
+  "\377\202\6\12\32\377\210\7\13\33\377\4\7\14\36\377\30(b\377\31*e\377" \
+  "\10\15#\377\246\7\13\33\377\3\6\13\33\377\7\13\33\377\14\24""0\377\203" \
+  "\31*e\377\5\30(a\377\10\16\"\377\7\13\32\377\7\13\33\377\21\34E\377\226" \
+  "\31*e\377\2\25$W\377\7\13\32\377\325\7\13\33\377\3\17\32>\377\31*e\377" \
+  "\20\32\77\377\325\7\13\33\377\3\10\16#\377\26&\\\377\26%[\377\203\7\13" \
+  "\33\377\3\7\12\32\377\7\14\34\377\7\15\40\377\257\7\13\33\377\3\20\32" \
+  "@\377\31*e\377\26%Z\377\247\7\13\33\377\2\6\13\32\377\13\22-\377\202" \
+  "\31*e\377\2\30)c\377\6\12\32\377\273\7\13\33\377\3\7\12\33\377\7\13\33" \
+  "\377\26%[\377\207\31*e\377\1\14\24""1\377\246\7\13\33\377\1\21\35G\377" \
+  "\204\31*e\377\4\27'`\377\14\24""2\377\7\13\33\377\7\13\32\377\210\7\13" \
+  "\33\377\2\7\12\33\377\7\14\35\377\202\31*e\377\1\10\15#\377\251\7\13" \
+  "\33\377\1\20\34D\377\202\31*e\377\5\30(`\377\6\13\32\377\7\13\33\377" \
+  "\6\13\33\377\20\34C\377\226\31*e\377\2\25$W\377\7\13\32\377\325\7\13" \
+  "\33\377\3\17\32>\377\31*e\377\20\32\77\377\324\7\13\33\377\4\7\13\32" \
+  "\377\7\13\33\377\26%Y\377\24!P\377\264\7\13\33\377\4\7\13\32\377\11\17" \
+  "$\377\26%[\377\26%Z\377\247\7\13\33\377\2\6\13\33\377\13\23.\377\203" \
+  "\31*e\377\1\6\12\32\377\275\7\13\33\377\1\26$Y\377\207\31*e\377\2\13" \
+  "\22-\377\6\13\33\377\245\7\13\33\377\1\21\35G\377\203\31*e\377\3\26%" \
+  "[\377\13\22-\377\7\12\32\377\212\7\13\33\377\2\6\13\33\377\10\15!\377" \
+  "\202\31*e\377\1\10\15#\377\250\7\13\33\377\5\7\12\33\377\10\15\37\377" \
+  "\24\"S\377\31*e\377\26&\\\377\203\7\13\33\377\1\20\34D\377\226\31*e\377" \
+  "\2\25$W\377\7\13\32\377\325\7\13\33\377\4\17\31>\377\31*e\377\20\32\77" \
+  "\377\7\12\33\377\323\7\13\33\377\4\7\13\32\377\6\12\32\377\25$W\377\16" \
+  "\27""9\377\265\7\13\33\377\4\7\13\32\377\12\21*\377\26%[\377\6\13\32" \
+  "\377\247\7\13\33\377\5\11\17&\377\22\37K\377\22\35I\377\21\35G\377\6" \
+  "\13\33\377\275\7\13\33\377\1\23\40O\377\207\31*e\377\2\12\22,\377\6\13" \
+  "\33\377\244\7\13\33\377\2\7\12\32\377\21\35G\377\202\31*e\377\2\26%Z" \
+  "\377\11\20'\377\214\7\13\33\377\2\6\13\32\377\13\22-\377\202\31*e\377" \
+  "\1\10\15#\377\250\7\13\33\377\5\6\12\33\377\6\12\32\377\11\17&\377\30" \
+  ")b\377\23\40M\377\203\7\13\33\377\1\17\31>\377\226\31*e\377\2\25$W\377" \
+  "\7\13\32\377\325\7\13\33\377\3\17\32>\377\31*e\377\17\32\77\377\325\7" \
+  "\13\33\377\4\6\12\33\377\22\36J\377\7\13\33\377\7\12\32\377\266\7\13" \
+  "\33\377\2\13\21-\377\6\12\32\377\351\7\13\33\377\1\20\33C\377\207\31" \
+  "*e\377\2\13\22-\377\6\13\33\377\245\7\13\33\377\4\21\35G\377\31*e\377" \
+  "\27'^\377\10\14\37\377\216\7\13\33\377\1\16\27""9\377\202\31*e\377\1" \
+  "\10\15#\377\252\7\13\33\377\7\6\12\32\377\15\26""6\377\20\32A\377\7\13" \
+  "\32\377\7\13\33\377\6\13\32\377\15\27""8\377\226\31*e\377\2\25$W\377" \
+  "\7\13\32\377\325\7\13\33\377\3\17\32>\377\31*e\377\15\26""7\377\325\7" \
+  "\13\33\377\3\6\13\33\377\10\15\40\377\6\13\33\377\377\7\13\33\377\243" \
+  "\7\13\33\377\1\15\27""8\377\207\31*e\377\1\13\22-\377\246\7\13\33\377" \
+  "\3\21\35G\377\31*e\377\21\34E\377\217\7\13\33\377\1\21\34D\377\202\31" \
+  "*e\377\1\10\15#\377\253\7\13\33\377\6\7\12\32\377\11\16#\377\7\12\33" \
+  "\377\7\13\33\377\7\13\32\377\13\23""0\377\226\31*e\377\2\25$W\377\7\13" \
+  "\32\377\325\7\13\33\377\3\17\32>\377\31*e\377\15\26""7\377\325\7\13\33" \
+  "\377\202\7\13\32\377\377\7\13\33\377\243\7\13\33\377\2\7\13\32\377\15" \
+  "\26""5\377\207\31*e\377\2\12\21*\377\6\13\33\377\245\7\13\33\377\3\21" \
+  "\35G\377\31*e\377\14\23.\377\217\7\13\33\377\1\22\37K\377\202\31*e\377" \
+  "\1\10\15#\377\253\7\13\33\377\2\7\13\32\377\6\13\33\377\203\7\13\33\377" \
+  "\1\12\21+\377\226\31*e\377\2\25$W\377\7\13\32\377\325\7\13\33\377\3\17" \
+  "\31>\377\31*e\377\15\26""7\377\377\7\13\33\377\373\7\13\33\377\1\12\20" \
+  "(\377\207\31*e\377\2\11\17%\377\6\13\33\377\244\7\13\33\377\3\7\12\32" \
+  "\377\22\36I\377\31*e\377\202\6\13\32\377\215\7\13\33\377\2\7\12\33\377" \
+  "\25$X\377\202\31*e\377\1\10\15#\377\257\7\13\33\377\2\6\12\32\377\10" \
+  "\15!\377\226\31*e\377\2\25$W\377\7\13\32\377\325\7\13\33\377\3\17\32" \
+  ">\377\31*e\377\14\25""3\377\377\7\13\33\377\373\7\13\33\377\1\7\12\34" \
+  "\377\207\31*e\377\1\11\17%\377\246\7\13\33\377\2\14\24""1\377\15\27""8" \
+  "\377\220\7\13\33\377\203\31*e\377\1\10\15#\377\260\7\13\33\377\1\10\15" \
+  "\37\377\226\31*e\377\2\25$W\377\7\13\32\377\325\7\13\33\377\3\17\32>" \
+  "\377\31*e\377\13\22-\377\377\7\13\33\377\373\7\13\33\377\5\6\12\32\377" \
+  "\26&\\\377\27'^\377\30(`\377\30)b\377\203\31*e\377\1\11\17%\377\246\7" \
+  "\13\33\377\3\6\13\33\377\7\13\33\377\7\12\33\377\217\7\13\33\377\4\30" \
+  "(`\377\27'^\377\30)c\377\10\15\"\377\260\7\13\33\377\1\10\15\37\377\226" \
+  "\31*e\377\2\25$W\377\7\13\32\377\325\7\13\33\377\3\17\32>\377\31*e\377" \
+  "\13\22-\377\377\7\13\33\377\374\7\13\33\377\5\7\15\40\377\13\22,\377" \
+  "\13\24""1\377\15\25""6\377\23\40M\377\202\31*e\377\1\11\17%\377\267\7" \
+  "\13\33\377\5\7\13\34\377\13\22,\377\13\21*\377\12\22,\377\7\13\35\377" \
+  "\260\7\13\33\377\2\7\14\37\377\30(a\377\225\31*e\377\2\25$W\377\7\13" \
+  "\32\377\325\7\13\33\377\3\17\31>\377\31*e\377\13\23.\377\377\7\13\33" \
+  "\377\373\7\13\33\377\3\6\13\33\377\7\13\33\377\6\12\32\377\202\7\13\33" \
+  "\377\1\15\27""8\377\202\31*e\377\1\11\17%\377\270\7\13\33\377\3\6\12" \
+  "\32\377\7\13\33\377\6\13\32\377\261\7\13\33\377\2\7\13\36\377\27&]\377" \
+  "\225\31*e\377\2\25$V\377\7\13\32\377\325\7\13\33\377\4\17\31>\377\31" \
+  "*e\377\11\17$\377\7\12\33\377\377\7\13\33\377\377\7\13\33\377\1\16\27" \
+  "7\377\202\31*e\377\1\11\17%\377\354\7\13\33\377\2\6\13\34\377\25#U\377" \
+  "\225\31*e\377\1\26&[\377\326\7\13\33\377\3\17\32>\377\31*e\377\11\17" \
+  "$\377\377\7\13\33\377\377\7\13\33\377\2\7\13\33\377\14\23/\377\202\31" \
+  "*e\377\1\11\17%\377\354\7\13\33\377\20\7\13\34\377\14\24""0\377\15\26" \
+  "7\377\15\26""6\377\15\26""5\377\21\34D\377\31*e\377\30)c\377\27'^\377" \
+  "\24\"S\377\15\26""7\377\11\17%\377\17\30;\377\24\"R\377\27&]\377\30(" \
+  "b\377\207\31*e\377\1\30(a\377\326\7\13\33\377\4\17\32>\377\31*e\377\11" \
+  "\17$\377\6\13\33\377\377\7\13\33\377\377\7\13\33\377\1\14\23/\377\202" \
+  "\31*e\377\1\11\17%\377\354\7\13\33\377\1\7\13\32\377\203\7\13\33\377" \
+  "\6\6\13\33\377\10\16#\377\21\35F\377\16\30""9\377\12\20)\377\7\13\32" \
+  "\377\202\7\13\33\377\7\6\12\33\377\6\13\33\377\11\17$\377\15\25""4\377" \
+  "\21\34D\377\24\"R\377\25#V\377\203\25#U\377\2\25#V\377\24!Q\377\326\7" \
+  "\13\33\377\4\17\31>\377\31*e\377\10\14\36\377\6\13\33\377\377\7\13\33" \
+  "\377\376\7\13\33\377\2\6\13\33\377\12\20(\377\202\31*e\377\1\11\17%\377" \
+  "\360\7\13\33\377\7\7\13\32\377\7\12\33\377\6\13\33\377\7\13\33\377\6" \
+  "\12\32\377\6\13\32\377\6\12\32\377\203\7\13\33\377\5\6\13\33\377\7\13" \
+  "\32\377\7\13\33\377\7\14!\377\10\16!\377\204\10\16\"\377\2\10\16!\377" \
+  "\7\13\32\377\325\7\13\33\377\2\17\31>\377\31*e\377\202\6\13\33\377\377" \
+  "\7\13\33\377\376\7\13\33\377\2\7\12\32\377\11\17&\377\202\31*e\377\1" \
+  "\11\17%\377\360\7\13\33\377\2\7\13\32\377\6\13\32\377\211\7\13\33\377" \
+  "\202\7\12\33\377\2\7\13\33\377\7\13\32\377\333\7\13\33\377\2\17\32>\377" \
+  "\31*e\377\377\7\13\33\377\377\7\13\33\377\202\7\13\33\377\1\10\16\"\377" \
+  "\202\31*e\377\1\11\17$\377\377\7\13\33\377\333\7\13\33\377\2\17\32>\377" \
+  "\31*e\377\377\7\13\33\377\377\7\13\33\377\6\7\13\33\377\7\13\32\377\7" \
+  "\13\35\377\31*e\377\30)d\377\10\15#\377\377\7\13\33\377\333\7\13\33\377" \
+  "\2\17\31>\377\31*e\377\377\7\13\33\377\377\7\13\33\377\202\7\13\33\377" \
+  "\4\7\14\35\377\31*e\377\30)d\377\11\16#\377\377\7\13\33\377\333\7\13" \
+  "\33\377\2\17\31>\377\31*e\377\377\7\13\33\377\377\7\13\33\377\202\7\13" \
+  "\33\377\4\7\14\35\377\31*e\377\30)d\377\11\16#\377\377\7\13\33\377\333" \
+  "\7\13\33\377\3\12\20)\377\16\30:\377\7\13\32\377\377\7\13\33\377\377" \
+  "\7\13\33\377\5\7\13\33\377\7\14\35\377\31*e\377\30)d\377\11\16#\377\377" \
+  "\7\13\33\377\332\7\13\33\377\1\7\13\32\377\377\7\13\33\377\377\7\13\33" \
+  "\377\204\7\13\33\377\1\7\14\34\377\202\31*e\377\1\11\16#\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\337\7\13\33\377\4\6\12\33\377" \
+  "\22\37K\377\22\36I\377\10\15\40\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\340\7\13\33\377\202\7\13\34\377\1\7\13\32\377\377\7\13\33" \
+  "\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13" \
+  "\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377" \
+  "\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377\7\13\33\377\377" \
+  "\7\13\33\377\377\7\13\33\377\344\7\13\33\377")
+
+
diff --git a/utils/psplash/files/image_generic.h b/utils/psplash/files/image_generic.h
new file mode 100644 (file)
index 0000000..8db52fc
--- /dev/null
@@ -0,0 +1,5475 @@
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+#define OWRT_IMG_ROWSTRIDE (1280)
+#define OWRT_IMG_WIDTH (320)
+#define OWRT_IMG_HEIGHT (320)
+#define OWRT_IMG_BYTES_PER_PIXEL (4) /* 3:RGB, 4:RGBA */
+#define OWRT_IMG_RLE_PIXEL_DATA ((uint8*) \
+  "\2ES\203\377DS\203\377\202FS\203\377\2FR\203\377FS\203\377\203FT\203\377" \
+  "\10ET\202\377FT\203\377GS\204\377FT\203\377GT\204\377FT\203\377+;q\377" \
+  "\30)d\377\205\31*e\377\3\30)d\377\36/h\377<K}\377\202HV\205\377\1GV\205" \
+  "\377\202HV\205\377\202IV\205\377\202IU\205\377\1IV\205\377\203IW\205" \
+  "\377\1HW\204\377\202IW\205\377\211JW\206\377\205JV\206\377\211JW\206" \
+  "\377\205JV\206\377\211JW\206\377\202IW\205\377\202HW\204\377\202IW\205" \
+  "\377\202IV\205\377\1IU\205\377\202IV\205\377\202HV\205\377\6GV\205\377" \
+  "HV\205\377HV\204\377.=s\377\32*e\377\30)d\377\204\31*e\377\11\30)d\377" \
+  "\31*e\377<J|\377GU\204\377FT\203\377GT\204\377FS\203\377FT\203\377ET" \
+  "\202\377\203FT\203\377\2FS\203\377FR\203\377\202FS\203\377\10ES\203\377" \
+  "DS\203\377ES\203\377ES\202\377ER\201\377ER\202\377DR\202\377CR\202\377" \
+  "\205DR\202\377\4DQ\201\377ER\202\377$4l\377\30)d\377\206\31*e\377\3\30" \
+  ")d\377\32+f\377@N\177\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200" \
+  "\377\3@O\177\377\77O~\377@M\177\377\204@N\177\377\204\77M\177\377\5\77" \
+  "M~\377@M~\3770\77t\377\27(d\377\30)d\377\207\31*e\377\5\30)d\377,;q\377" \
+  "=K}\377=J|\377;K}\377\202<K}\377\1<I{\377\203<J|\377\2;J|\377:J|\377" \
+  "\202;I|\377\1;H|\377\204:I{\377\3""8Hz\377\36/i\377\30)d\377\212\31*" \
+  "e\377\5\30)d\377%4m\3778Fy\3777Fy\3776Fy\377\2037Fy\377\1""7Dy\377\202" \
+  "6Ey\377\10""6Ex\3776Ew\3776Ex\3776Dx\3775Cx\3776Ex\377\36/h\377\30)d" \
+  "\377\215\31*e\377\4\27(d\377,<r\3772Bv\3772@v\377\2032Av\377\3""2Au\377" \
+  "1@u\3770\77u\377\2041@u\377\2%5m\377\30)d\377\221\31*e\377\6\34,g\377" \
+  "-<r\377-<q\377-<r\377-;r\377-<r\377\205,<r\377\2\31*d\377\30)d\377\221" \
+  "\31*e\377\2\30)e\377\30)d\377\204(8o\377\203'7o\377\2\40""0i\377\30)" \
+  "d\377\207\31*e\377\2DS\203\377ES\203\377\202FS\203\377\3FR\203\377FT" \
+  "\203\377FS\203\377\204FT\203\377\5FS\203\377FT\203\377IW\205\377'8n\377" \
+  "\30)d\377\205\31*e\377\13\27(c\377)9p\377DR\201\377HV\205\377GU\204\377" \
+  "HV\205\377GV\205\377HV\205\377IV\205\377HV\205\377IU\205\377\202IV\205" \
+  "\377\4IW\205\377IV\205\377IW\205\377HW\204\377\202IW\205\377\2JW\206" \
+  "\377IW\205\377\206JW\206\377\203JV\206\377\205JW\206\377\210JX\206\377" \
+  "\205JW\206\377\203JV\206\377\205JW\206\377\2IW\205\377JW\206\377\203" \
+  "IW\205\377\3HW\204\377IV\205\377IW\205\377\202IV\205\377\1IU\205\377" \
+  "\202IV\205\377\202HV\205\377\6GV\204\377GU\205\377HV\205\377=K}\377\33" \
+  "+f\377\30)d\377\204\31*e\377\10\30)d\377\32+e\377:H{\377GU\204\377FU" \
+  "\203\377GT\204\377FS\203\377ET\202\377\202FT\203\377\4FS\203\377FT\203" \
+  "\377FS\203\377FR\203\377\203ES\203\377\7ES\202\377ES\203\377ES\201\377" \
+  "ER\202\377DQ\202\377DR\202\377CR\202\377\203DR\202\377\6DQ\201\377CQ" \
+  "\201\377DQ\201\377BO\177\377\33,g\377\30)d\377\206\31*e\377\6\30)d\377" \
+  "*:p\377BP\200\377AO\200\377BP\200\377@N\200\377\204AO\200\377\202@O\177" \
+  "\377\2@N\177\377@M\177\377\204@N\177\377\202\77M\177\377\202\77M~\377" \
+  "\4>M}\377\77M~\377\35.h\377\30)d\377\207\31*e\377\12\30)d\377\32+f\377" \
+  ">M~\377=J}\377<K}\377;K}\377<K}\377<J|\377<I{\377<J|\377\202;J|\377\5" \
+  ":J|\377;J|\377;I|\377;H|\377;I|\377\203:I{\377\2""9H{\377(8o\377\213" \
+  "\31*e\377\5\31)d\377\35-g\3777Ex\3777Fy\3776Fy\377\2037Fy\377\13""7D" \
+  "y\3776Ey\3776Ex\3776Ey\3776Ew\3776Dx\3776Ex\3776Cx\3775Dx\377*9p\377" \
+  "\30)d\377\215\31*e\377\5\30)d\377$4l\3772Bv\3772Av\3772@v\377\2022Av" \
+  "\377\2""2Au\3771@t\377\2051@u\377\2-=r\377\27(c\377\221\31*e\377\6\32" \
+  "+f\377*:q\377-=q\377-<r\377-;r\377-<r\377\203,<r\377\4+<q\377-<r\377" \
+  "\34-g\377\30)d\377\222\31*e\377\2\30)d\377%5m\377\203(8o\377\202'7o\377" \
+  "\3&6o\377#4k\377\30)d\377\207\31*e\377\2ES\203\377FS\203\377\202FR\203" \
+  "\377\3FT\203\377FS\203\377FT\203\377\202ET\202\377\6GS\204\377FS\203" \
+  "\377GU\204\377HV\204\377)9p\377\27(d\377\204\31*e\377\12\30)d\377\31" \
+  "*e\377*9p\377GU\204\377GU\205\377HV\204\377HV\205\377GV\205\377IV\205" \
+  "\377HV\205\377\202IU\205\377\4IV\205\377IW\205\377IV\205\377HW\204\377" \
+  "\202IW\205\377\206JW\206\377\202JV\206\377\202JW\206\377\1JV\206\377" \
+  "\203JX\206\377\1JW\206\377\202JX\206\377\213IX\206\377\203JX\206\377" \
+  "\1JW\206\377\202JX\206\377\203JW\206\377\202JV\206\377\204JW\206\377" \
+  "\3IW\205\377JW\206\377IW\205\377\202HW\204\377\1IW\205\377\203IV\205" \
+  "\377\1IU\205\377\202IV\205\377\7HV\205\377GV\205\377GU\204\377HV\205" \
+  "\377CP\201\377\35.h\377\30)d\377\204\31*e\377\7\30)d\377\26(d\377\77" \
+  "M~\377GU\204\377FU\203\377FT\203\377GS\204\377\202ET\202\377\203FT\203" \
+  "\377\5FS\203\377FR\203\377FS\203\377ES\203\377DS\203\377\202ES\202\377" \
+  "\3ES\201\377DR\202\377EQ\202\377\206DR\202\377\202DQ\201\377\2""2Av\377" \
+  "\30)d\377\207\31*e\377\3\35.h\377>L}\377BP\200\377\202AO\200\377\1@N" \
+  "\200\377\204AO\200\377\3@O\177\377\77N~\377@M\177\377\203@N\177\377\11" \
+  "\77M\177\377@N\177\377>L\177\377\77M\177\377\77M~\377\77M}\377\77M~\377" \
+  "+;q\377\30)d\377\210\31*e\377\10\27(d\3771Au\377=K}\377<K}\377;K}\377" \
+  "<K}\377<J|\377<I{\377\202<J|\377\10;J|\377:J|\377;J|\377;I|\377;H|\377" \
+  ";I|\377:I{\3779Iz\377\202:I{\377\1""2Bv\377\214\31*e\377\3\32+f\3772" \
+  "Au\3777Ex\377\2026Fy\377\2027Fy\377\12""7Dy\3776Dy\3775Ey\3776Ey\377" \
+  "6Ex\3776Ew\3776Ex\3776Cx\3775Cw\3771@u\377\216\31*e\377\5\30)d\377\35" \
+  ".h\3772Bv\3772Av\3772@v\377\2032Av\377\1""2At\377\2041@u\377\4""0\77" \
+  "t\3771@u\377\31*e\377\30)d\377\221\31*e\377\7(8o\377,=q\377-<r\377-;" \
+  "r\377-<r\377,<r\377+<r\377\203,<r\377\2\"2j\377\30)d\377\222\31*e\377" \
+  "\2\30)d\377\"2k\377\203(8o\377\203'7o\377\2#3k\377\30)d\377\207\31*e" \
+  "\377\2FS\203\377ES\203\377\202FS\203\377\203FT\203\377\7ET\202\377FT" \
+  "\203\377FS\203\377FT\203\377HU\204\377/>t\377\30)d\377\204\31*e\377\3" \
+  "\30)d\377\27(d\3770\77t\377\203HV\205\377\5GV\205\377HV\205\377IV\205" \
+  "\377HV\205\377IU\205\377\202IV\205\377\202IW\205\377\1HW\204\377\202" \
+  "IW\205\377\2JW\206\377IW\205\377\203JW\206\377\202JV\206\377\202JW\206" \
+  "\377\203JX\206\377\2JW\206\377JX\206\377\204IX\206\377\213JX\206\377" \
+  "\204IX\206\377\205JX\206\377\202JW\206\377\202JV\206\377\205JW\206\377" \
+  "\202IW\205\377\202HW\204\377\202IW\205\377\13IV\205\377IU\205\377HV\205" \
+  "\377IV\205\377HV\205\377GV\205\377GU\204\377HV\205\377AP\200\377\"2j" \
+  "\377\27(c\377\204\31*e\377\6\30)d\377\33,f\377>M~\377GU\204\377FT\203" \
+  "\377FS\203\377\205FT\203\377\14FS\203\377FR\203\377ES\203\377FS\203\377" \
+  "ES\203\377DS\203\377ES\203\377ER\202\377ES\201\377ER\202\377DQ\202\377" \
+  "CR\202\377\204DR\202\377\5DQ\201\377CP\200\377BP\200\377\37""0i\377\30" \
+  ")d\377\206\31*e\377\4\27(d\3772@u\377BP\200\377AO\177\377\202AO\200\377" \
+  "\1@N\200\377\202AO\200\377\3@O\177\377AO\200\377\77O~\377\206@N\177\377" \
+  "\7\77M\177\377>L\177\377\77M\177\377\77M~\377>L}\3776Ex\377\32+e\377" \
+  "\210\31*e\377\3\30)d\377!2j\377=K}\377\202<K}\377\2;K}\377<K}\377\204" \
+  "<J|\377\7;J|\377;I|\377;J|\377;I|\377:I{\377;I|\3779Iz\377\202:I{\377" \
+  "\3;I{\377\34-g\377\30)d\377\212\31*e\377\22\30)d\377-=s\3778Fy\3777F" \
+  "y\3776Fy\3777Fy\3777Ey\3776Ey\3777Dy\3775Ey\3776Ex\3776Ey\3776Ew\377" \
+  "6Dx\3775Dx\3776Cx\3772Bv\377\35-g\377\216\31*e\377\4\33,f\3770@t\377" \
+  "2Av\3772@v\377\2032Av\377\1""2At\377\2061@u\377\2\40""0j\377\30)d\377" \
+  "\220\31*e\377\10\30)d\377&6n\377-=q\377-<r\377-;r\377,<r\377-<r\377+" \
+  "<r\377\203,<r\377\2&6m\377\30)d\377\222\31*e\377\2\30)d\377\36/h\377" \
+  "\203(8o\377\5'7o\377&6o\377'7o\377#3k\377\30)d\377\207\31*e\377\203F" \
+  "S\203\377\2FT\203\377FS\203\377\203FT\203\377\6GS\204\377FU\203\377H" \
+  "V\204\3774Cw\377\27(c\377\30)d\377\205\31*e\377\12""3Bw\377GU\204\377" \
+  "HV\205\377GU\204\377GV\205\377HV\205\377IV\205\377HV\205\377IU\205\377" \
+  "IV\205\377\202IW\205\377\3IV\205\377HW\204\377IW\205\377\202JW\206\377" \
+  "\1IW\205\377\203JW\206\377\2JV\206\377JW\206\377\205JX\206\377\203IX" \
+  "\206\377\1KX\206\377\204JX\206\377\211KX\206\377\205JX\206\377\203IX" \
+  "\206\377\205JX\206\377\1JW\206\377\202JV\206\377\202JW\206\377\1IW\205" \
+  "\377\203JW\206\377\202IW\205\377\202IV\205\377\3IW\205\377IU\205\377" \
+  "HV\205\377\202IV\205\377\6HV\205\377HU\204\377HV\205\377FT\203\377#3" \
+  "l\377\30)d\377\204\31*e\377\27\30)d\377\34-g\377FR\202\377GU\204\377" \
+  "FU\203\377GS\204\377GT\204\377ET\202\377FT\203\377FS\203\377FT\203\377" \
+  "FS\203\377FR\203\377ES\203\377FS\203\377ES\203\377ES\202\377ES\203\377" \
+  "ES\201\377DR\202\377EQ\202\377DR\202\377CR\202\377\202DR\202\377\2DQ" \
+  "\201\377DR\202\377\202DQ\201\377\2<K|\377\26'c\377\206\31*e\377\3\30" \
+  ")d\377\31*e\377BQ\200\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200" \
+  "\377\3@O\177\377\77O~\377@M\177\377\203@N\177\377\202\77M\177\377\1>" \
+  "L\177\377\202\77M\177\377\3\77M~\377\77L~\377\34-g\377\211\31*e\377\6" \
+  "\33,g\3778Gz\377=K}\377<K}\377;K}\377<K}\377\204<J|\377\203;J|\377\203" \
+  ";I|\377\6""9Iz\377:I{\3779Hz\377;J{\377(8o\377\27)d\377\212\31*e\377" \
+  "\5\30)d\377$5l\3778Fy\3777Fy\3776Fy\377\2027Fy\377\13""7Ey\3777Dy\377" \
+  "5Ey\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\3776Cx\3774Cw\377\40""0j\377\216" \
+  "\31*e\377\5\32+e\377-=r\3771Bv\3772Av\3772@v\377\2022Av\377\2""2Au\377" \
+  "1@t\377\2051@u\377\2&6m\377\30)d\377\220\31*e\377\4\30)d\377#3k\377-" \
+  "=s\377-=q\377\203-<r\377\6+<r\377,<r\377,;r\377,<r\377*:p\377\27(d\377" \
+  "\222\31*e\377\2\30)d\377\33,f\377\202(8o\377\6'7o\377(8o\377&6o\377'" \
+  "7o\377'7n\377\33,g\377\207\31*e\377\14FR\203\377FS\203\377FT\203\377" \
+  "FS\203\377FT\203\377ET\202\377FT\203\377GS\204\377FT\203\377GU\204\377" \
+  "7Fy\377\26'c\377\204\31*e\377\202\30)d\377\4""4Cw\377JW\206\377HV\205" \
+  "\377GV\205\377\202HV\205\377\2IV\205\377IU\205\377\202IV\205\377\4IW" \
+  "\205\377IV\205\377HW\204\377IW\205\377\205JW\206\377\202JV\206\377\202" \
+  "JW\206\377\2JX\206\377JW\206\377\202IX\206\377\203JX\206\377\202KX\206" \
+  "\377\1JX\206\377\202KX\206\377\215KX\205\377\202KX\206\377\1JX\206\377" \
+  "\202KX\206\377\203JX\206\377\202IX\206\377\1JW\206\377\202JX\206\377" \
+  "\202JW\206\377\1JV\206\377\203JW\206\377\2IW\205\377JW\206\377\203IW" \
+  "\205\377\14IV\205\377IW\205\377IV\205\377IU\205\377HV\205\377IV\205\377" \
+  "HV\205\377GV\205\377HV\205\377FT\203\377#3l\377\27(c\377\204\31*e\377" \
+  "\4\30)d\377\36/h\377CQ\201\377GU\204\377\202GT\204\377\2FT\203\377ET" \
+  "\202\377\202FT\203\377\202FS\203\377\11FR\203\377FS\203\377ES\203\377" \
+  "DS\203\377ES\202\377ER\203\377ES\201\377ER\202\377DQ\202\377\206DR\202" \
+  "\377\4CQ\201\377ER\202\377)9p\377\30)d\377\206\31*e\377\6\27(d\377-<" \
+  "s\377CQ\200\377AO\200\377BP\200\377@N\200\377\204AO\200\377\202@O\177" \
+  "\377\2@N\177\377@M\177\377\203@N\177\377\204\77M\177\377\4\77M~\377@" \
+  "N~\377+;q\377\27(d\377\210\31*e\377\2\30)d\3771\77u\377\202=K}\377\13" \
+  "<K}\377<J|\377<K}\377<I{\377<J|\377;J|\377<J|\377:J|\377;I|\377;J|\377" \
+  ";H|\377\202:I{\377\1""9Iz\377\202:I{\377\3""5Dx\377\27(c\377\30)d\377" \
+  "\211\31*e\377\4\30)d\377\32+f\3778Gz\3778Ex\377\2037Fy\377\2027Ey\377" \
+  "\2""6Ey\3775Ey\377\2026Ex\377\1""6Ew\377\2026Dx\377\3""5Dx\377%6m\377" \
+  "\30)d\377\215\31*e\377\5\30)d\377*:p\3771Bv\3772Av\3772@v\377\2022Av" \
+  "\377\3""1@u\3772At\3770\77u\377\2031@u\377\2""0\77t\377+:q\377\221\31" \
+  "*e\377\4\30)d\377\36/h\377-=s\377-=q\377\203-<r\377\1+<r\377\202,<r\377" \
+  "\4+<q\377+:q\377\32+e\377\30)d\377\222\31*e\377\2\32+f\377'7n\377\203" \
+  "(8o\377\1&6o\377\202'7o\377\1\34-g\377\207\31*e\377\3FS\203\377FT\203" \
+  "\377FS\203\377\203FT\203\377\5GT\204\377FT\203\377GU\204\377BP\200\377" \
+  "\32+f\377\205\31*e\377\2\30)d\3774Cw\377\202HV\205\377\2HU\204\377HV" \
+  "\205\377\202IV\205\377\2HV\205\377IV\205\377\202IW\205\377\2IV\205\377" \
+  "HW\204\377\203IW\205\377\203JW\206\377\1JV\206\377\202JW\206\377\202" \
+  "JX\206\377\203IX\206\377\1JX\206\377\205KX\206\377\203KX\205\377\215" \
+  "KX\206\377\203KX\205\377\204KX\206\377\203JX\206\377\202IX\206\377\2" \
+  "JW\206\377JX\206\377\202JW\206\377\1JV\206\377\203JW\206\377\4IW\205" \
+  "\377JW\206\377IW\205\377HW\204\377\203IW\205\377\12IU\205\377IV\205\377" \
+  "HV\205\377IV\205\377HV\205\377HU\204\377HV\205\377FT\204\377#3k\377\30" \
+  ")d\377\204\31*e\377\2\30)d\377'7n\377\203FT\203\377\1GS\204\377\205F" \
+  "T\203\377\13FS\203\377ES\203\377FS\203\377ES\203\377DS\203\377ES\202" \
+  "\377ER\202\377ES\201\377EQ\202\377DR\202\377CR\202\377\203DR\202\377" \
+  "\5DQ\201\377CQ\201\377DQ\200\377;I|\377\32+f\377\206\31*e\377\3\30)d" \
+  "\377\35.h\377>M}\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200\377" \
+  "\202@N\177\377\1@M\177\377\204@N\177\377\202\77M\177\377\6\77M~\377\77" \
+  "M\177\377\77M~\377=K}\377\27(c\377\30)d\377\207\31*e\377\2\30)d\377#" \
+  "3k\377\202=K}\377\1;K}\377\202<K}\377\1<I{\377\203<J|\377\1:J|\377\202" \
+  ";J|\377\11;H|\377;I|\377:I{\3779Iz\377:I{\377:Iz\377:I{\377\34-g\377" \
+  "\30)d\377\211\31*e\377\4\30)d\377\27(c\3772Au\3778Fy\377\2047Fy\377\202" \
+  "6Ey\377\11""5Ey\3776Ey\3776Ex\3776Ew\3776Ex\3775Dx\3776Dx\377-<r\377" \
+  "\30)d\377\215\31*e\377\5\30)d\377$4l\3772Bv\3772Av\3772@v\377\2022Av" \
+  "\377\3""2Au\3772At\3770\77u\377\2041@u\377\2-<r\377\32+e\377\220\31*" \
+  "e\377\4\30)d\377\32,f\377-=s\377-=q\377\203-<r\377\1+<r\377\203,<r\377" \
+  "\3+:q\377\35.h\377\30)d\377\223\31*e\377\1%5m\377\203(8o\377\1&6o\377" \
+  "\202'7o\377\1\34-g\377\207\31*e\377\1FS\203\377\203FT\203\377\7ET\202" \
+  "\377FS\203\377GT\204\377GU\204\377FT\203\377\37""0i\377\30)d\377\203" \
+  "\31*e\377\21\30)d\377\27)d\377,<q\377HV\205\377GU\204\377GV\205\377H" \
+  "V\205\377IV\205\377HV\205\377IU\205\377IV\205\377IW\205\377IV\205\377" \
+  "HW\204\377IW\205\377JW\206\377IW\205\377\203JW\206\377\2JV\206\377JW" \
+  "\206\377\202JX\206\377\2JW\206\377IX\206\377\202JX\206\377\202KX\206" \
+  "\377\3JX\206\377KX\206\377KX\205\377\203KX\206\377\203KW\207\377\2KX" \
+  "\207\377KX\206\377\211KX\207\377\2KX\206\377KX\207\377\203KW\207\377" \
+  "\203KX\206\377\202KX\205\377\203KX\206\377\202JX\206\377\6IX\206\377" \
+  "JX\206\377JW\206\377JX\206\377JW\206\377JV\206\377\203JW\206\377\203" \
+  "IW\205\377\3HW\204\377IV\205\377IW\205\377\202IV\205\377\10HV\205\377" \
+  "IV\205\377HV\205\377GV\205\377GU\204\377CQ\201\377\36/h\377\30)d\377" \
+  "\204\31*e\377\7\27'c\3774Cw\377HV\204\377FU\203\377FT\203\377GS\204\377" \
+  "ET\202\377\202FT\203\377\4FS\203\377FT\203\377FR\203\377FS\203\377\202" \
+  "ES\203\377\2ES\202\377ES\203\377\202ER\202\377\3EQ\202\377DR\202\377" \
+  "CR\202\377\204DR\202\377\4CQ\201\377CP\201\377#3l\377\30)d\377\206\31" \
+  "*e\377\2\30)d\3774Bw\377\203BP\200\377\2AO\200\377@N\200\377\203AO\200" \
+  "\377\4@O\177\377\77N~\377@N\177\377@M\177\377\202@N\177\377\3\77M\177" \
+  "\377@N\177\377>L\177\377\202\77M\177\377\4>L~\377@N~\377%5m\377\30)d" \
+  "\377\207\31*e\377\3\30)d\377\27(d\377;J|\377\202=K}\377\1;K}\377\202" \
+  "<J|\377\5<I{\377<J|\377;J|\377<J|\377:J|\377\202;I|\377\2;H|\377;I|\377" \
+  "\204:I{\377\2&5m\377\30)d\377\212\31*e\377\5\30)d\377&6m\3779Fy\3777" \
+  "Fx\3776Fy\377\2027Fy\377\12""7Ey\3776Ey\3775Ey\3776Ey\3776Ex\3776Ew\377" \
+  "6Ex\3776Dx\3775Dx\3774Cw\377\202\30)d\377\214\31*e\377\4\30)d\377\36" \
+  ".h\3773Bv\3771Bv\377\2032Av\377\2022Au\377\2""1@u\3770\77u\377\2031@" \
+  "u\377\2/>s\377\33,f\377\221\31*e\377\1\27(c\377\202-=r\377\2-;q\377-" \
+  "<r\377\202,<r\377\1+<r\377\202,<r\377\3+;q\377\40""1i\377\30)d\377\223" \
+  "\31*e\377\2$4l\377'7n\377\202(8o\377\1&6o\377\202'7o\377\1\34,f\377\207" \
+  "\31*e\377\12FT\203\377FS\203\377FT\203\377ET\202\377FT\203\377GS\204" \
+  "\377FT\203\377GT\204\377(8o\377\30)d\377\204\31*e\377\2\27(d\377.=s\377" \
+  "\202HV\205\377\4GV\205\377HV\205\377IV\205\377HV\205\377\204IV\205\377" \
+  "\202HW\204\377\1IW\205\377\204JW\206\377\2JV\206\377JW\206\377\203JX" \
+  "\206\377\1IX\206\377\202JX\206\377\2KX\206\377JX\206\377\203KX\205\377" \
+  "\2KX\206\377KW\206\377\202KW\207\377\1KX\206\377\202KX\207\377\1JX\207" \
+  "\377\214JY\207\377\202KX\207\377\1KX\206\377\202KW\207\377\1KW\206\377" \
+  "\202KX\206\377\4KX\205\377KX\206\377JX\206\377KX\206\377\202JX\206\377" \
+  "\202IX\206\377\202JX\206\377\1JW\206\377\202JV\206\377\204JW\206\377" \
+  "\16IW\205\377HW\204\377IV\205\377IW\205\377IV\205\377IU\205\377HV\205" \
+  "\377IV\205\377HV\205\377GV\205\377HV\205\377BQ\201\377\34-g\377\30)d" \
+  "\377\203\31*e\377\202\30)d\377\2:H{\377GU\204\377\202GT\204\377\2FT\203" \
+  "\377ET\202\377\203FT\203\377\3FS\203\377FR\203\377FS\203\377\203ES\203" \
+  "\377\2ES\202\377ER\201\377\202DR\202\377\1CR\202\377\204DR\202\377\202" \
+  "DQ\201\377\2""9H{\377\26'c\377\206\31*e\377\4\30)d\377\36.h\377CQ\201" \
+  "\377AO\177\377\202AO\200\377\1@N\200\377\202AO\200\377\5@O\177\377AO" \
+  "\200\377\77O~\377@N\177\377@M\177\377\204@N\177\377\2>L\177\377\77M\177" \
+  "\377\203\77M~\377\2""4Cw\377\30)d\377\210\31*e\377\10\27(d\377*9p\377" \
+  ">L}\377=K}\377;K}\377<K}\377<J|\377<I{\377\202<J|\377\6;J|\377:J|\377" \
+  ";J|\377;I|\377;H|\377;I|\377\204:I{\377\1.=s\377\213\31*e\377\5\30)d" \
+  "\377\35-h\3779Gz\3778Ex\3776Fy\377\2027Fy\377\2""7Ey\3776Dy\377\2026" \
+  "Ey\377\2036Ex\377\5""6Dx\3775Cw\3777Ey\377\34.g\377\30)d\377\214\31*" \
+  "e\377\4\30)d\377\27)d\3773Bv\3771Bu\377\2042Av\377\2021@u\377\1""0\77" \
+  "u\377\2041@u\377\2\35.g\377\30)e\377\220\31*e\377\15\27)d\377'7o\377" \
+  "-=r\377-<q\377-;r\377-<r\377,<r\377+<r\377,<r\377,;r\377,<q\377#3l\377" \
+  "\31)d\377\222\31*e\377\2\30)d\377\"3k\377\203(8o\377\5'7o\377&6o\377" \
+  "'7o\377!1j\377\30)d\377\206\31*e\377\202FT\203\377\202ET\202\377\5FS" \
+  "\203\377FT\203\377GU\204\3777Fy\377\30)d\377\204\31*e\377\2\30)d\377" \
+  "%5m\377\202GU\204\377\202HV\205\377\12IV\205\377HV\205\377IU\205\377" \
+  "IV\205\377IW\205\377IV\205\377HW\204\377IW\205\377JW\206\377IW\205\377" \
+  "\202JW\206\377\1JV\206\377\203JW\206\377\202IX\206\377\203JX\206\377" \
+  "\4KX\206\377KX\205\377KX\206\377KW\206\377\202KW\207\377\2KX\206\377" \
+  "KX\207\377\202JY\207\377\1KX\207\377\202KY\207\377\215LY\207\377\202" \
+  "KY\207\377\4KX\207\377KY\207\377JY\207\377JX\207\377\202KX\207\377\1" \
+  "KW\207\377\202KX\206\377\202KX\205\377\2JX\206\377KX\206\377\202JX\206" \
+  "\377\4IX\206\377JW\206\377JX\206\377JW\206\377\202JV\206\377\203JW\206" \
+  "\377\3IW\205\377HW\204\377IW\205\377\202IV\205\377\11IU\205\377HV\205" \
+  "\377IV\205\377HV\205\377GU\204\377HV\205\377@N\177\377\33+f\377\31*d" \
+  "\377\204\31*e\377\7\36/i\377CQ\201\377GU\204\377FT\203\377GS\204\377" \
+  "FT\203\377ET\202\377\203FT\203\377\11FS\203\377ES\203\377FS\203\377E" \
+  "S\203\377DS\203\377ES\203\377ER\202\377ES\201\377EQ\202\377\206DR\202" \
+  "\377\4CQ\201\377FS\202\377\"2k\377\30)d\377\206\31*e\377\4\26'c\3775" \
+  "Cw\377BP\200\377AO\177\377\205AO\200\377\3@O\177\377AN\200\377\77O~\377" \
+  "\204@N\177\377\202\77M\177\377\6>L\177\377\77M\177\377\77M~\377>M~\377" \
+  ";I{\377\35-g\377\210\31*e\377\6\30)d\377\34-f\377>L~\377=K}\377<K}\377" \
+  ";K}\377\204<J|\377\202;J|\377\1:J|\377\203;I|\377\2:I{\3779Iz\377\202" \
+  ":I{\377\2""4Cw\377\32+f\377\213\31*e\377\4\32+e\3775Cw\3778Fy\3776Fy" \
+  "\377\2037Fy\377\1""7Dy\377\2036Ey\377\2036Ex\377\4""6Cx\3776Dx\377&6" \
+  "m\377\30)d\377\215\31*e\377\3\27(c\377.=s\3772Bv\377\2042Av\377\3""2" \
+  "Au\3771@u\3770\77u\377\2041@u\377\2!1j\377\30)d\377\220\31*e\377\10\30" \
+  ")d\377#3l\377-=r\377-=q\377-;r\377-<r\377,<r\377+<r\377\202,<r\377\2" \
+  ",;r\377&5m\377\223\31*e\377\2\30)d\377\40""1j\377\203(8o\377\1'7o\377" \
+  "\202&6o\377\2(8o\377\30)d\377\206\31*e\377\204FT\203\377\5GS\204\377" \
+  "GU\204\377@N\177\377\31*e\377\30)d\377\203\31*e\377\3\30)d\377\34,f\377" \
+  "DR\202\377\202HV\205\377\2GV\205\377HV\205\377\203IV\205\377\4IW\205" \
+  "\377IV\205\377HW\204\377IW\205\377\204JW\206\377\2JV\206\377JW\206\377" \
+  "\202JX\206\377\1IX\206\377\202JX\206\377\202KX\206\377\202KX\205\377" \
+  "\5KX\206\377KW\206\377KW\207\377KX\206\377KX\207\377\202JY\207\377\202" \
+  "KY\207\377\203LY\207\377\1KY\207\377\213LY\207\377\1KY\207\377\203LY" \
+  "\207\377\203KY\207\377\202JY\207\377\1KX\206\377\202KW\207\377\202KX" \
+  "\206\377\2KX\205\377JX\206\377\202KX\206\377\4JX\206\377IX\206\377JW" \
+  "\206\377JX\206\377\204JW\206\377\4IW\205\377JW\206\377IW\205\377HW\204" \
+  "\377\202IW\205\377\11IV\205\377IU\205\377HV\205\377IV\205\377HV\205\377" \
+  "GU\204\377HV\205\3773Bw\377\26'c\377\204\31*e\377\7\30)d\377'6n\377I" \
+  "W\205\377FU\203\377GT\204\377FS\203\377ET\202\377\203FT\203\377\5FS\203" \
+  "\377FR\203\377ES\203\377FS\203\377DS\203\377\203ES\202\377\3ER\202\377" \
+  "DQ\202\377CR\202\377\203DR\202\377\203DQ\201\377\2;I{\377\30)d\377\206" \
+  "\31*e\377\5\30)d\377\40""0j\377CQ\201\377BP\177\377BP\200\377\205AO\200" \
+  "\377\3@O\177\377\77O~\377@M\177\377\204@N\177\377\2\77M\177\377>L\177" \
+  "\377\202\77M\177\377\202\77M~\377\2$4l\377\30)d\377\210\31*e\377\6\32" \
+  "+e\3778Fz\377=K}\377<K}\377;K}\377<K}\377\204<J|\377\7;J|\377:J|\377" \
+  ";J|\377;I|\377:I{\377;I|\3779Iz\377\202:I{\377\3:Iz\377\34-f\377\30)" \
+  "e\377\213\31*e\377\4/\77t\3778Fy\3777Fy\3776Fy\377\2027Fy\377\1""7Dy" \
+  "\377\2036Ey\377\1""6Ew\377\2026Ex\377\4""6Cx\3775Dx\3770\77t\377\27(" \
+  "c\377\215\31*e\377\5\30)d\377'7n\3773Bv\3771Av\3772@v\377\2022Av\377" \
+  "\3""2Au\3771@u\3770\77u\377\2041@u\377\2'7n\377\30)d\377\220\31*e\377" \
+  "\6\30)d\377\35.h\377.=s\377,=q\377-;r\377-<r\377\204,<r\377\2,;r\377" \
+  "(8o\377\223\31*e\377\2\30)d\377\36/i\377\203(8o\377\5'7o\377&6o\377'" \
+  "7o\377(7n\377\30)d\377\206\31*e\377\10FT\203\377ET\202\377FS\203\377" \
+  "GS\204\377FT\203\377GU\204\377\40""0i\377\30)d\377\203\31*e\377\202\30" \
+  ")d\377\4@N\177\377HV\205\377GU\204\377GV\205\377\202HV\205\377\5IU\205" \
+  "\377IV\205\377IW\205\377IV\205\377HW\204\377\202IW\205\377\202JW\206" \
+  "\377\1JV\206\377\202JW\206\377\1JX\206\377\202IX\206\377\14JX\206\377" \
+  "KX\206\377JX\206\377KX\205\377KX\206\377KW\206\377KW\207\377KX\206\377" \
+  "JX\207\377JY\207\377KX\207\377JY\207\377\202LY\207\377\1KY\207\377\230" \
+  "LY\207\377\12KY\207\377JX\207\377JY\207\377JX\207\377KX\207\377KW\207" \
+  "\377KW\206\377KX\206\377KX\205\377JX\206\377\202KX\206\377\202IX\206" \
+  "\377\2JW\206\377JX\206\377\202JV\206\377\202JW\206\377\202IW\205\377" \
+  "\2HW\204\377IW\205\377\202IV\205\377\1IU\205\377\202IV\205\377\5HV\205" \
+  "\377GU\204\377JX\206\377)9o\377\30)d\377\204\31*e\377\7\27(c\3776Ex\377" \
+  "GU\204\377GT\204\377FS\203\377GS\204\377ET\202\377\203FT\203\377\202" \
+  "FR\203\377\7FS\203\377ES\203\377DS\203\377ES\203\377ES\202\377ER\201" \
+  "\377EQ\202\377\202CR\202\377\204DR\202\377\4CQ\201\377BP\200\377#4l\377" \
+  "\30)d\377\206\31*e\377\6\32+e\377;I{\377BP\200\377AO\200\377BP\200\377" \
+  "@N\200\377\204AO\200\377\3@N\177\377\77O~\377@M\177\377\204@N\177\377" \
+  "\3\77M\177\377>L\177\377\77M\177\377\202\77M~\377\2""4Cv\377\27(d\377" \
+  "\211\31*e\377\7""1@t\377=K}\377<K}\377;K}\377<K}\377<J|\377<I{\377\202" \
+  "<J|\377\7;J|\377:J|\377;J|\377;I|\377;H|\377;I|\3779Iz\377\202:I{\377" \
+  "\3;J{\377#3l\377\30)d\377\212\31*e\377\23\30*e\377*:q\3778Fy\3777Fy\377" \
+  "6Fy\3777Fy\3777Ey\3776Ey\3777Dy\3775Ey\3776Ex\3776Ey\3776Ew\3776Ex\377" \
+  "6Cx\3775Cw\3773Bw\377\32+e\377\30)d\377\214\31*e\377\12\30)d\377\40""1" \
+  "i\3773Cv\3771Bu\3772@v\3772Av\3772Au\3772Av\3771@t\3770\77u\377\2041" \
+  "@u\377\2,<q\377\27(d\377\221\31*e\377\1\32+e\377\202-=r\377\1-;r\377" \
+  "\202-<r\377\203,<r\377\2,;r\377+:q\377\223\31*e\377\2\30)d\377\34-g\377" \
+  "\203(8o\377\5'7o\377&6o\377'7o\377(7n\377\30)d\377\206\31*e\377\6FT\203" \
+  "\377ET\202\377GS\204\377FT\203\377GU\204\3776Ex\377\205\31*e\377\15\30" \
+  ")d\3770\77t\377HV\205\377GU\204\377GV\205\377HV\205\377IV\205\377IU\205" \
+  "\377IV\205\377IW\205\377IV\205\377HW\204\377IW\205\377\203JW\206\377" \
+  "\2JV\206\377JW\206\377\202JX\206\377\1JW\206\377\202JX\206\377\4KX\206" \
+  "\377JX\206\377KX\205\377KX\206\377\202KX\207\377\2KX\206\377JY\207\377" \
+  "\202KY\207\377\202LY\207\377\1KY\207\377\234LY\207\377\11KX\207\377K" \
+  "Y\207\377JY\207\377KX\206\377KX\207\377KW\206\377KX\206\377KX\205\377" \
+  "KX\206\377\202JX\206\377\4IX\206\377JX\206\377JW\206\377JX\206\377\205" \
+  "JW\206\377\3IW\205\377HW\204\377IW\205\377\202IV\205\377\7IU\205\377" \
+  "IV\205\377HV\205\377GV\205\377GU\204\377FT\203\377\40""0j\377\205\31" \
+  "*e\377\3\35-g\377CQ\201\377FT\203\377\202GT\204\377\3FT\203\377ET\202" \
+  "\377FT\203\377\202FS\203\377\2FR\203\377FS\203\377\202ES\203\377\6ES" \
+  "\202\377ES\203\377ES\201\377DR\202\377ER\202\377CR\202\377\204DR\202" \
+  "\377\202DQ\201\377\2""3Bw\377\30)d\377\207\31*e\377\2/\77t\377AO\177" \
+  "\377\202BP\200\377\1@N\200\377\204AO\200\377\3@O\177\377\77O~\377@M\177" \
+  "\377\204@N\177\377\10\77M\177\377>L\177\377\77M~\377\77M\177\377\77M" \
+  "}\377@N\177\377\31*e\377\30)d\377\207\31*e\377\22\30)d\377)9p\377<J|" \
+  "\377=K}\377<K}\377<J|\377<K}\377<I{\377<J|\377;J|\377<J|\377;J|\377;" \
+  "I|\377;J|\377;H|\377;I|\377:I{\3779Iz\377\202:I{\377\2-<s\377\27(d\377" \
+  "\212\31*e\377\5\30)d\377$5l\3777Ex\3777Fy\3776Fy\377\2027Fy\377\3""7" \
+  "Ey\3777Dy\3775Ey\377\2026Ey\377\7""6Ew\3776Dx\3775Dx\3776Cx\3774Cw\377" \
+  "\36.h\377\30)d\377\214\31*e\377\5\30)d\377\33,f\3773Bv\3772Bv\3772@v" \
+  "\377\2032Av\377\1""2At\377\2061@u\377\202\30)d\377\221\31*e\377\5+:q" \
+  "\377-=r\377-<r\377-;r\377-<r\377\205,<r\377\2\32+e\377\30)e\377\221\31" \
+  "*e\377\2\30)d\377\32+f\377\203(8o\377\5'7o\377&6o\377'7o\377(7n\377\30" \
+  ")d\377\206\31*e\377\7ET\202\377FT\203\377GT\204\377FU\203\377HU\204\377" \
+  "\34-g\377\30)d\377\203\31*e\377\3\30)d\377\"2k\377IW\205\377\202HV\205" \
+  "\377\4GV\205\377IV\205\377HV\205\377IV\205\377\202IW\205\377\4HW\204" \
+  "\377IW\205\377JW\206\377IW\205\377\202JW\206\377\1JV\206\377\203JX\206" \
+  "\377\1IX\206\377\202KX\206\377\13JX\206\377KX\205\377KX\206\377KW\206" \
+  "\377KW\207\377KY\207\377JY\207\377KX\207\377KY\207\377LY\207\377KY\207" \
+  "\377\214LY\207\377\205LX\207\377\214LY\207\377\11KY\207\377LY\207\377" \
+  "KY\207\377KX\207\377JY\207\377JX\207\377KX\207\377KW\207\377KX\206\377" \
+  "\202KX\205\377\202KX\206\377\202IX\206\377\202JX\206\377\1JV\206\377" \
+  "\202JW\206\377\4IW\205\377JW\206\377IW\205\377HW\204\377\202IW\205\377" \
+  "\10IU\205\377HV\205\377IV\205\377HV\205\377GU\204\377HV\205\377>M~\377" \
+  "\30)d\377\204\31*e\377\7\30)d\377/\77t\377GU\204\377FU\203\377FS\203" \
+  "\377FT\203\377ET\202\377\203FT\203\377\3FS\203\377ES\203\377FS\203\377" \
+  "\203ES\203\377\5ES\202\377ES\201\377EQ\202\377DR\202\377CR\202\377\202" \
+  "DR\202\377\6DQ\201\377DR\202\377DP\200\377CQ\201\377\30)e\377\30)d\377" \
+  "\205\31*e\377\3\30)d\377#3k\377AO\177\377\202BP\200\377\2AO\200\377@" \
+  "N\200\377\204AO\200\377\3@O\177\377@N\177\377@M\177\377\204@N\177\377" \
+  "\203\77M\177\377\4>L}\377@N\177\377%4l\377\30)d\377\207\31*e\377\4\30" \
+  ")d\377\"1k\377<J|\377=K}\377\203<K}\377\1<I{\377\203<J|\377\203;J|\377" \
+  "\1;H|\377\202:I{\377\1""9Iz\377\202:I{\377\2""8Fz\377\26'c\377\212\31" \
+  "*e\377\5\30)d\377\36/h\3777Ex\3777Fy\3776Fy\377\2027Fy\377\3""7Ey\377" \
+  "7Dy\3775Ey\377\2026Ey\377\7""6Ew\3776Ex\3776Dx\3776Cx\3774Cw\377\"2j" \
+  "\377\30)d\377\215\31*e\377\4\32*e\3770\77t\3772Bv\3772@v\377\2032Av\377" \
+  "\1""2At\377\2041@u\377\4""0\77t\3772Au\377\34-g\377\30)d\377\221\31*" \
+  "e\377\5(9o\377-=r\377-<r\377-;r\377-<r\377\203,<r\377\4+<q\377,<r\377" \
+  "\34-g\377\30)d\377\221\31*e\377\202\30)d\377\2(8o\377'7n\377\202(8o\377" \
+  "\202'7o\377\3'7n\377\33,f\377\30)d\377\205\31*e\377\6FT\203\377GS\204" \
+  "\377GT\204\377HV\205\377*:p\377\27(c\377\203\31*e\377\5\30)d\377\32+" \
+  "e\377ES\202\377HV\205\377HU\204\377\203HV\205\377\2IU\205\377IV\205\377" \
+  "\204IW\205\377\202JW\206\377\4JV\206\377JW\206\377JX\206\377JW\206\377" \
+  "\204JX\206\377\202KX\205\377\5KW\206\377KW\207\377KX\207\377JY\207\377" \
+  "KX\207\377\202KY\207\377\210LY\207\377\202LX\207\377\204LY\207\377\1" \
+  "KY\206\377\205KZ\206\377\1KY\206\377\204LY\207\377\203LX\207\377\207" \
+  "LY\207\377\21KY\207\377LY\207\377KY\207\377JY\207\377JX\207\377KX\207" \
+  "\377KW\207\377KX\206\377KX\205\377JX\206\377KX\206\377JX\206\377IX\206" \
+  "\377JW\206\377JX\206\377JW\206\377JV\206\377\203JW\206\377\14IW\205\377" \
+  "HW\204\377IV\205\377IW\205\377IV\205\377IU\205\377IV\205\377HV\205\377" \
+  "GU\204\377JX\206\3770\77t\377\27(c\377\203\31*e\377\10\30)d\377\27)d" \
+  "\377AO\200\377GU\204\377FU\203\377GS\204\377FT\203\377ET\202\377\202" \
+  "FT\203\377\12FS\203\377FR\203\377ES\203\377FS\203\377DS\203\377ES\203" \
+  "\377ES\202\377ES\201\377ER\202\377DQ\202\377\204DR\202\377\5DQ\201\377" \
+  "CQ\201\377ER\202\377*:p\377\27(d\377\205\31*e\377\3\30)d\377\27)d\377" \
+  ">M~\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200\377\3@O\177\377" \
+  "@N\177\377@M\177\377\204@N\177\377\2>L\177\377\77M\177\377\203\77M~\377" \
+  "\2""1@u\377\27(c\377\207\31*e\377\11\30)d\377\31+e\377<J|\377=J}\377" \
+  "<K}\377;K}\377<K}\377<J|\377<I{\377\202<J|\377\14;J|\377:J|\377;J|\377" \
+  ";I|\377;H|\377:I{\3779Iz\377:I{\3779Hz\377;J|\377\34,g\377\30)d\377\211" \
+  "\31*e\377\202\30)d\377\2""7Ey\3778Fx\377\2047Fy\377\13""7Ey\3776Ey\377" \
+  "5Ey\3776Ey\3776Ex\3776Ew\3776Dx\3776Cx\3774Dx\377%5m\377\30)d\377\216" \
+  "\31*e\377\4-<r\3772Bv\3772Av\3772@v\377\2022Av\377\1""2At\377\2061@u" \
+  "\377\2!2k\377\30)d\377\221\31*e\377\5&6n\377-=r\377-<r\377-;r\377-<r" \
+  "\377\205,<r\377\2\40""0j\377\30)d\377\222\31*e\377\2\27)d\377'6n\377" \
+  "\203(8o\377\5'7o\377'7n\377'7o\377\"3k\377\30)d\377\205\31*e\377\6FT" \
+  "\203\377GS\204\377GU\204\377;J|\377\31*e\377\31*d\377\203\31*e\377\15" \
+  "\30)d\3772Av\377HV\205\377GU\204\377GV\205\377HV\205\377IV\205\377IU" \
+  "\205\377IV\205\377IW\205\377IV\205\377HW\204\377IW\205\377\206JW\206" \
+  "\377\13JX\206\377IX\206\377JX\206\377KX\206\377KX\205\377KX\206\377K" \
+  "W\206\377KX\207\377KX\206\377JY\207\377KX\207\377\211LY\207\377\202L" \
+  "X\207\377\202LY\207\377\204KZ\206\377\2LZ\207\377LY\207\377\203LZ\207" \
+  "\377\2LY\207\377LZ\207\377\204KZ\206\377\203LY\207\377\202LX\207\377" \
+  "\206LY\207\377\3KY\207\377LY\207\377KX\207\377\202KY\207\377\13KX\206" \
+  "\377KW\207\377KX\206\377KX\205\377JX\206\377KX\206\377JX\206\377IX\206" \
+  "\377JX\206\377JW\206\377JV\206\377\202JW\206\377\4IW\205\377JW\206\377" \
+  "IW\205\377HW\204\377\202IV\205\377\10IU\205\377IV\205\377HV\205\377G" \
+  "V\205\377HV\205\377GU\204\377!1j\377\30)d\377\203\31*e\377\13\30)d\377" \
+  "\37""0i\377GU\203\377GU\204\377FT\203\377GS\204\377ET\202\377FT\203\377" \
+  "FS\203\377FT\203\377FR\203\377\202FS\203\377\6ES\203\377DS\203\377ES" \
+  "\202\377ER\202\377DR\202\377EQ\202\377\205DR\202\377\202DQ\201\377\3" \
+  "\77M\177\377\27(c\377\30)d\377\205\31*e\377\3\27(d\377+;q\377CQ\200\377" \
+  "\207AO\200\377\2@O\177\377\77N~\377\205@N\177\377\6\77M\177\377>L\177" \
+  "\377\77M\177\377\77M~\377\77M}\377;I{\377\210\31*e\377\3\30)e\377\27" \
+  "(c\3774Cw\377\202=K}\377\1;K}\377\202<J|\377\5<I{\377<J|\377;J|\377<" \
+  "J|\377:J|\377\202;I|\377\1;H|\377\202:I{\377\1""9Iz\377\202:I{\377\2" \
+  "%5m\377\30)d\377\212\31*e\377\3\27(c\3771@u\3778Fy\377\2047Fy\377\3""6" \
+  "Ey\3777Ey\3775Ey\377\2026Ex\377\1""6Ew\377\2026Dx\377\2""5Dx\377)9p\377" \
+  "\217\31*e\377\4)9p\3772Bv\3772Av\3772@v\377\2022Av\377\3""2Au\3771@t" \
+  "\3770\77u\377\2041@u\377\2'7o\377\30)d\377\221\31*e\377\7%5m\377-=r\377" \
+  "-<r\377-;r\377-<r\377,<r\377+<r\377\203,<r\377\2#3l\377\30)d\377\222" \
+  "\31*e\377\2\30)d\377$4l\377\203(8o\377\202'7o\377\3&6o\377%5l\377\30" \
+  ")d\377\205\31*e\377\1GS\204\377\202FT\203\377\2'7n\377\30)d\377\203\31" \
+  "*e\377\6\30)d\377\36/h\377ES\203\377GU\204\377GV\205\377HV\205\377\203" \
+  "IV\205\377\5IW\205\377HW\204\377IW\205\377JW\206\377IW\205\377\202JW" \
+  "\206\377\15JV\206\377JX\206\377JW\206\377IX\206\377JX\206\377KX\206\377" \
+  "JX\206\377KX\205\377KX\206\377KW\207\377KX\207\377JY\207\377KX\207\377" \
+  "\207LY\207\377\202LX\207\377\202LY\207\377\202KZ\206\377\2LY\207\377" \
+  "LZ\207\377\217MZ\210\377\203LZ\207\377\1KZ\206\377\202LY\207\377\202" \
+  "LX\207\377\205LY\207\377\10KY\207\377LY\207\377KX\207\377JY\207\377J" \
+  "X\207\377KW\207\377KW\206\377KX\205\377\202KX\206\377\6JX\206\377IX\206" \
+  "\377JW\206\377JX\206\377JW\206\377JV\206\377\202JW\206\377\202IW\205" \
+  "\377\4HW\204\377IW\205\377IV\205\377IU\205\377\202HV\205\377\3GV\205" \
+  "\377HV\205\3779Hz\377\206\31*e\377\3""7Fy\377GU\204\377GT\204\377\202" \
+  "FT\203\377\6ET\202\377FT\203\377FS\203\377FT\203\377FR\203\377FS\203" \
+  "\377\203ES\203\377\5ES\202\377ER\201\377ER\202\377DQ\202\377CR\202\377" \
+  "\204DR\202\377\4CQ\201\377CP\200\377#3k\377\30)d\377\205\31*e\377\2\30" \
+  ")d\377\31*e\377\203BP\200\377\206AO\200\377\1\77O~\377\206@N\177\377" \
+  "\2>L\177\377\77M\177\377\202\77M~\377\2=K|\377\37/i\377\210\31*e\377" \
+  "\10\30)d\377&6n\377>L~\377=J|\377;K}\377<K}\377<J|\377<I{\377\203<J|" \
+  "\377\7:J|\377;J|\377;I|\377;H|\377;I|\377:I{\3779Iz\377\202:I{\377\2" \
+  ".=s\377\30)d\377\212\31*e\377\3\27(d\377)9o\3779Fy\377\2047Fy\377\12" \
+  "7Ey\3776Ey\3775Ey\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\3775Dx\377-=s\377" \
+  "\216\31*e\377\2\30)d\377%5m\377\2022Av\377\1""2@v\377\2022Av\377\3""2" \
+  "Au\3772At\3770\77u\377\2041@u\377\2+:q\377\30)d\377\220\31*e\377\5\30" \
+  ")d\377\"3k\377,<r\377-<q\377-;r\377\202-<r\377\1+<r\377\202,<r\377\3" \
+  ",;r\377'7n\377\30)d\377\222\31*e\377\2\30)d\377!1j\377\203(8o\377\203" \
+  "'7o\377\2%5l\377\30)d\377\205\31*e\377\3GT\204\377GU\204\377AO\177\377" \
+  "\202\30)d\377\203\31*e\377\14\25'c\377<J|\377IV\205\377GV\205\377HV\205" \
+  "\377IV\205\377HV\205\377IU\205\377IV\205\377IW\205\377HW\204\377IW\205" \
+  "\377\203JW\206\377\2JV\206\377JW\206\377\202JX\206\377\13IX\206\377J" \
+  "X\206\377KX\206\377KX\205\377KX\206\377KW\207\377KX\206\377JY\207\377" \
+  "KX\207\377LY\207\377KY\207\377\205LY\207\377\1LX\207\377\202LY\207\377" \
+  "\4KY\206\377KZ\206\377LY\207\377LZ\207\377\223MZ\210\377\202LZ\207\377" \
+  "\202KZ\206\377\202LY\207\377\1LX\207\377\205LY\207\377\14KY\207\377L" \
+  "Y\207\377KX\207\377JY\207\377KX\206\377KX\207\377KX\206\377KX\205\377" \
+  "JX\206\377KX\206\377JX\206\377IX\206\377\206JW\206\377\6IW\205\377HW" \
+  "\204\377IV\205\377IW\205\377IU\205\377IV\205\377\204HV\205\377\2$4l\377" \
+  "\30)d\377\203\31*e\377\5\30)d\377%5m\377GU\204\377FU\203\377GT\204\377" \
+  "\204FT\203\377\202FS\203\377\11FR\203\377FS\203\377ES\203\377ES\202\377" \
+  "ES\203\377ES\201\377DR\202\377EQ\202\377CR\202\377\204DR\202\377\3DQ" \
+  "\201\377CP\200\3770\77t\377\207\31*e\377\2\30)d\3774Cw\377\202BP\200" \
+  "\377\2AO\200\377@N\200\377\204AO\200\377\3@O\177\377\77N~\377@M\177\377" \
+  "\204@N\177\377\6\77M\177\377>L\177\377\77M\177\377\77M~\377>L}\377%5" \
+  "m\377\210\31*e\377\6\30)d\377\32+e\377>L}\377=K}\377<K}\377;K}\377\205" \
+  "<J|\377\12;J|\377:J|\377;I|\377;H|\377;I|\377:I{\3779Iz\377:I{\3779I" \
+  "z\3773Bv\377\213\31*e\377\5\30)d\377!2k\3779Gz\3777Fx\3776Fy\377\202" \
+  "7Fy\377\12""7Ey\3776Ey\3775Ey\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\377" \
+  "5Dx\3772Av\377\216\31*e\377\5\30)d\377\"2k\3771Au\3772Av\3772@v\377\202" \
+  "2Av\377\3""2Au\3772At\3770\77u\377\2031@u\377\2""0\77t\377-<r\377\221" \
+  "\31*e\377\4\30)d\377\40""1j\377,<r\377-<q\377\203-<r\377\6+<r\377,<r" \
+  "\377,;r\377,<r\377*:p\377\27(d\377\222\31*e\377\2\30)d\377\36/h\377\203" \
+  "(8o\377\203'7o\377\2%5l\377\30)d\377\205\31*e\377\4GT\204\377IV\205\377" \
+  "&6n\377\30)d\377\203\31*e\377\4\30)d\377*9p\377IW\206\377GU\204\377\202" \
+  "HV\205\377\2IV\205\377IU\205\377\202IV\205\377\10HW\204\377IW\205\377" \
+  "JW\206\377IW\205\377JW\206\377JV\206\377JW\206\377JX\206\377\202IX\206" \
+  "\377\12KX\206\377JX\206\377KX\205\377KX\206\377KW\207\377KX\207\377J" \
+  "Y\207\377KY\207\377LY\207\377KY\207\377\204LY\207\377\10LX\207\377LY" \
+  "\207\377KY\206\377KZ\206\377LY\207\377LZ\207\377MZ\210\377LZ\207\377" \
+  "\225MZ\210\377\1LZ\207\377\202MZ\210\377\1LY\207\377\202LZ\207\377\202" \
+  "LX\207\377\205LY\207\377\11KY\207\377LY\207\377JX\207\377JY\207\377K" \
+  "W\207\377KW\206\377KX\205\377KX\206\377JX\206\377\202IX\206\377\3JX\206" \
+  "\377JW\206\377JV\206\377\202JW\206\377\3IW\205\377JW\206\377HW\204\377" \
+  "\202IV\205\377\6IU\205\377HV\205\377IV\205\377GV\205\377HV\205\377GT" \
+  "\204\377\202\30)d\377\202\31*e\377\6\30)d\377\26'c\377\77M~\377GU\204" \
+  "\377FU\203\377GS\204\377\204FT\203\377\10FS\203\377FR\203\377FS\203\377" \
+  "ES\203\377DS\203\377ES\202\377ER\202\377ES\201\377\202DR\202\377\1CR" \
+  "\202\377\202DR\202\377\5DQ\201\377DR\202\377DP\200\377<J|\377\32+e\377" \
+  "\206\31*e\377\2\30)d\377(8o\377\203BP\200\377\1@N\200\377\204AO\200\377" \
+  "\3@O\177\377\77O~\377@M\177\377\204@N\177\377\3\77M\177\377>L\177\377" \
+  "\77M\177\377\202\77M~\377\2-<r\377\30)d\377\210\31*e\377\6\30)d\3777" \
+  "Ex\377=K}\377<K}\377;K}\377<K}\377\204<J|\377\6;J|\377:J|\377;J|\377" \
+  ";I|\377:I{\377;I|\377\203:I{\377\2""6Ex\377\33,f\377\212\31*e\377\23" \
+  "\30)d\377\32+e\3779Gz\3778Fx\3776Fy\3777Fy\3777Ey\3777Fy\3777Dy\3776" \
+  "Ey\3775Ey\3776Ex\3776Ew\3776Ex\3776Dx\3775Dx\3776Ex\377\31*e\377\30)" \
+  "d\377\214\31*e\377\5\30)d\377\37/i\3771Au\3771Av\3772@v\377\2022Av\377" \
+  "\3""2Au\3772At\3770\77u\377\2041@u\377\2.=s\377\32+f\377\220\31*e\377" \
+  "\4\30)d\377\36/h\377,<r\377-=q\377\203-<r\377\1+<r\377\202,<r\377\2+" \
+  "<q\377,;r\377\202\30)d\377\221\31*e\377\12\30)d\377\33,f\377(8o\377'" \
+  "7n\377(8o\377'7o\377&6o\377'7o\377%5l\377\30)d\377\205\31*e\377\3GU\204" \
+  "\377>L~\377\27(c\377\204\31*e\377\2\32+f\377@N\177\377\202HV\205\377" \
+  "\3GV\205\377IV\205\377HV\205\377\202IV\205\377\4IW\205\377HW\204\377" \
+  "JW\206\377IW\205\377\202JW\206\377\3JV\206\377JX\206\377JW\206\377\203" \
+  "JX\206\377\10KX\205\377KX\206\377KW\207\377KX\206\377JY\207\377KX\207" \
+  "\377LY\207\377KY\207\377\204LY\207\377\5LX\207\377LY\207\377KY\206\377" \
+  "KZ\206\377LY\207\377\202MZ\210\377\1LZ\207\377\230MZ\210\377\7LZ\207" \
+  "\377MZ\210\377LZ\207\377KZ\206\377KY\206\377LY\207\377LX\207\377\205" \
+  "LY\207\377\202KY\207\377\14JX\207\377KX\206\377KX\207\377KX\206\377K" \
+  "X\205\377KX\206\377JX\206\377IX\206\377JW\206\377JX\206\377JW\206\377" \
+  "JV\206\377\203JW\206\377\3IW\205\377HW\204\377IW\205\377\203IV\205\377" \
+  "\5HV\205\377GU\204\377HV\205\377/>t\377\30)d\377\203\31*e\377\24\30)" \
+  "d\377!1j\377IV\205\377GU\204\377GT\204\377FS\203\377ET\202\377FT\203" \
+  "\377FS\203\377FT\203\377FR\203\377ES\203\377FS\203\377DS\203\377ES\203" \
+  "\377ES\202\377ES\201\377EQ\202\377DR\202\377CR\202\377\204DR\202\377" \
+  "\4DQ\201\377ER\202\377\37""0i\377\30)d\377\206\31*e\377\2!1j\377@N~\377" \
+  "\202BP\200\377\2AO\200\377@N\200\377\203AO\200\377\3@O\177\377\77O~\377" \
+  "@M\177\377\204@N\177\377\7\77M\177\377>L\177\377\77M~\377\77M\177\377" \
+  "\77M~\3777Fy\377\30)d\377\210\31*e\377\6\30)d\377-=r\377=K}\377<K}\377" \
+  ";K}\377<K}\377\204<J|\377\3;J|\377:J|\377;J|\377\203;I|\377\203:I{\377" \
+  "\2""8Gy\377\36.h\377\213\31*e\377\4\30)d\3775Dw\3778Fy\3776Fy\377\203" \
+  "7Fy\377\13""7Dy\3776Ey\3775Ey\3776Ey\3776Ex\3776Dx\3776Ex\3775Cw\377" \
+  "6Ex\377\40""1i\377\30)d\377\214\31*e\377\4\30)d\377\34,g\3772Au\3771" \
+  "Bv\377\2032Av\377\3""2Au\3772At\3770\77u\377\2041@u\377\2/>s\377\34," \
+  "g\377\220\31*e\377\4\30)d\377\34,g\377,<r\377-=q\377\203-<r\377\1+<r" \
+  "\377\203,<r\377\3,;r\377\33+f\377\30)d\377\223\31*e\377\202(8o\377\6" \
+  "'7o\377(8o\377&6o\377'7o\377&6m\377\33,f\377\205\31*e\377\3GU\204\377" \
+  "&6n\377\30)d\377\203\31*e\377\6\30)d\377$4l\377HV\205\377GU\204\377G" \
+  "V\205\377HV\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\203" \
+  "JW\206\377\2JV\206\377JW\206\377\203JX\206\377\11KX\206\377KX\205\377" \
+  "KX\206\377KX\207\377KX\206\377KY\207\377KX\207\377LY\207\377KY\207\377" \
+  "\204LY\207\377\3LX\207\377LY\207\377KZ\206\377\202LZ\207\377\213MZ\210" \
+  "\377\211LY\210\377\211MZ\210\377\7LZ\207\377MZ\210\377LY\207\377LZ\207" \
+  "\377KZ\206\377LY\207\377LX\207\377\207LY\207\377\5JY\207\377KX\206\377" \
+  "KX\207\377KX\206\377JX\206\377\202KX\206\377\3IX\206\377JW\206\377JX" \
+  "\206\377\203JW\206\377\202IW\205\377\1HW\204\377\202IW\205\377\1IU\205" \
+  "\377\202HV\205\377\4GV\205\377HV\205\377@N\177\377\33,f\377\203\31*e" \
+  "\377\202\30)d\377\5""9Hz\377GU\204\377FT\203\377GS\204\377ET\202\377" \
+  "\204FT\203\377\10FR\203\377FS\203\377ES\203\377DS\203\377ES\203\377E" \
+  "S\202\377ER\201\377EQ\202\377\204DR\202\377\5DQ\201\377CQ\201\377EQ\201" \
+  "\3773Bw\377\27(c\377\206\31*e\377\3\33+f\377>L}\377AO\177\377\202AO\200" \
+  "\377\1@N\200\377\204AO\200\377\3@O\177\377@N\177\377@M\177\377\204@N" \
+  "\177\377\203\77M\177\377\4\77M}\377@M~\377\31*e\377\30)d\377\207\31*" \
+  "e\377\4\30)d\377%5m\377=J}\377=K}\377\202<K}\377\204<J|\377\3;J|\377" \
+  ":J|\377;J|\377\203;I|\377\204:I{\377\1\40""0i\377\213\31*e\377\4\30)" \
+  "d\3770\77t\3778Fy\3776Fy\377\2037Fy\377\4""7Dy\3776Ey\3775Ey\3776Ey\377" \
+  "\2036Ex\377\4""6Cx\3776Dx\377&6n\377\30)d\377\214\31*e\377\4\30)d\377" \
+  "\31*e\3772Au\3771Bv\377\2042Av\377\3""2Au\3771@u\3770\77u\377\2031@u" \
+  "\377\2/\77t\377\35.h\377\220\31*e\377\4\30)d\377\32+e\377,<r\377-=q\377" \
+  "\203-<r\377\1+<r\377\203,<r\377\3,;r\377\35.h\377\30)d\377\223\31*e\377" \
+  "\1'7n\377\203(8o\377\1&6o\377\202'7n\377\1\36.h\377\205\31*e\377\2AP" \
+  "\200\377\33,f\377\204\31*e\377\13\27'c\377=L}\377HV\205\377GV\205\377" \
+  "HV\205\377IV\205\377IU\205\377IV\205\377IW\205\377IV\205\377IW\205\377" \
+  "\203JW\206\377\16JV\206\377JW\206\377JX\206\377IX\206\377JX\206\377K" \
+  "X\206\377JX\206\377KX\205\377KW\206\377KX\207\377JY\207\377KX\207\377" \
+  "LY\207\377KY\207\377\203LY\207\377\202LX\207\377\3KY\206\377KZ\206\377" \
+  "LZ\207\377\210MZ\210\377\202LY\210\377\203MZ\210\377\211N[\210\377\203" \
+  "MZ\210\377\202LY\210\377\206MZ\210\377\1LZ\207\377\202MZ\210\377\4LZ" \
+  "\207\377KZ\206\377LY\207\377LX\207\377\204LY\207\377\7KY\207\377KX\207" \
+  "\377KY\207\377KX\206\377KW\207\377KX\206\377KX\205\377\202JX\206\377" \
+  "\4IX\206\377JX\206\377JW\206\377JV\206\377\203JW\206\377\13IW\205\377" \
+  "HW\204\377IW\205\377IV\205\377IU\205\377IV\205\377HV\205\377GV\205\377" \
+  "IV\205\377&6n\377\30)d\377\204\31*e\377\3&6n\377FT\203\377GU\204\377" \
+  "\202FT\203\377\1ET\202\377\203FT\203\377\10FR\203\377FS\203\377ES\203" \
+  "\377DS\203\377ES\203\377ES\202\377ES\201\377EQ\202\377\205DR\202\377" \
+  "\202DQ\201\377\3AO\200\377\27(c\377\30)d\377\205\31*e\377\2\27(c\377" \
+  "8Fz\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200\377\3@O\177\377" \
+  "@N\177\377@M\177\377\204@N\177\377\203\77M\177\377\4>L}\377@N\177\377" \
+  "%4m\377\30)d\377\210\31*e\377\7!1j\377;I|\377=K}\377<K}\377<J|\377<K" \
+  "}\377<I{\377\203<J|\377\202;J|\377\4;I|\377;H|\377;I|\3779Iz\377\203" \
+  ":I{\377\2&6n\377\30)d\377\212\31*e\377\5\30)d\377*:p\3778Fy\3777Fy\377" \
+  "6Fy\377\2027Fy\377\4""7Dy\3776Ey\3775Ey\3776Ey\377\2036Ex\377\4""6Cx" \
+  "\3776Dx\377,;q\377\27(d\377\215\31*e\377\3\27(c\3770\77u\3772Bv\377\204" \
+  "2Av\377\3""2Au\3771@u\3770\77u\377\2031@u\377\2""0\77t\377\37/i\377\220" \
+  "\31*e\377\4\30)d\377\27)d\377,<r\377-=q\377\202-<r\377\202,<r\377\1+" \
+  "<r\377\202,<r\377\3,;r\377\40""1j\377\30)d\377\223\31*e\377\1&6m\377" \
+  "\203(8o\377\4&6o\377'7o\377'7n\377\36.h\377\205\31*e\377\2""5Cw\377\27" \
+  "(d\377\203\31*e\377\5\30)d\377&5m\377IW\206\377HV\205\377GV\205\377\202" \
+  "HV\205\377\1IU\205\377\202IV\205\377\2HW\204\377IW\205\377\203JW\206" \
+  "\377\15JV\206\377JX\206\377JW\206\377JX\206\377KX\206\377JX\206\377K" \
+  "X\205\377KW\206\377KX\207\377KY\206\377KX\207\377LY\207\377KY\207\377" \
+  "\206LY\207\377\4LZ\207\377LY\207\377MZ\210\377LZ\207\377\205MZ\210\377" \
+  "\202LY\210\377\202MZ\210\377\203N[\210\377\1MZ\210\377\207N[\210\377" \
+  "\1MZ\210\377\203N[\210\377\202MZ\210\377\202LY\210\377\206MZ\210\377" \
+  "\4LZ\207\377MZ\210\377LY\207\377LZ\207\377\207LY\207\377\2KX\207\377" \
+  "JY\207\377\202KX\206\377\1KX\205\377\202KX\206\377\13JX\206\377JW\206" \
+  "\377JX\206\377JW\206\377JV\206\377JW\206\377IW\205\377JW\206\377HW\204" \
+  "\377IV\205\377IW\205\377\203IV\205\377\202HV\205\377\2BP\201\377\25&" \
+  "b\377\204\31*e\377\4\34,g\377CQ\201\377FU\203\377GT\204\377\205FT\203" \
+  "\377\2FS\203\377FR\203\377\203ES\203\377\202ES\202\377\3ER\202\377DQ" \
+  "\202\377CR\202\377\203DR\202\377\202DQ\201\377\3ER\201\377\40""0i\377" \
+  "\30)d\377\205\31*e\377\4\30)d\377)9o\377CQ\201\377BP\200\377\206AO\200" \
+  "\377\3@O\177\377@N\177\377@M\177\377\204@N\177\377\203\77M\177\377\202" \
+  "\77M~\377\2""3Bv\377\27(c\377\210\31*e\377\3\35.h\377:I{\377=K}\377\203" \
+  "<K}\377\1<I{\377\203<J|\377\7;J|\377;I|\377;J|\377;H|\377;I|\377:I{\377" \
+  "9Iz\377\202:I{\377\2-=r\377\30)d\377\212\31*e\377\5\30)d\377%5l\3778" \
+  "Fy\3777Fy\3776Fy\377\2027Fy\377\2""7Ey\3777Dy\377\2026Ey\377\2036Ex\377" \
+  "\4""6Cx\3775Dx\3770\77t\377\27(c\377\215\31*e\377\3\27(d\377,<r\3772" \
+  "Bv\377\2042Av\377\3""2Au\3771@u\3770\77u\377\2041@u\377\2!1j\377\30)" \
+  "d\377\220\31*e\377\4\27(d\377)9p\377-=r\377-<q\377\202-<r\377\2,<r\377" \
+  "+<r\377\203,<r\377\2\"3k\377\30)d\377\223\31*e\377\1%5m\377\203(8o\377" \
+  "\4&6o\377'7o\377'7n\377\36.h\377\205\31*e\377\2!2j\377\30)d\377\203\31" \
+  "*e\377\2\30)d\377@N\177\377\203HV\205\377\6IV\205\377IU\205\377IV\205" \
+  "\377IW\205\377HW\204\377IW\205\377\203JW\206\377\15JV\206\377JX\206\377" \
+  "JW\206\377IX\206\377JX\206\377KX\206\377KX\205\377KX\206\377KW\206\377" \
+  "JX\207\377KY\207\377LY\207\377KY\207\377\203LY\207\377\6LX\207\377LY" \
+  "\207\377KZ\206\377LY\207\377MZ\210\377LZ\207\377\205MZ\210\377\1LY\210" \
+  "\377\202MZ\210\377\4N[\210\377MZ\210\377N[\210\377MZ\207\377\202N[\210" \
+  "\377\202N[\211\377\203O\\\212\377\202N[\211\377\203N[\210\377\202N[\207" \
+  "\377\2N[\210\377MZ\210\377\202N[\210\377\207MZ\210\377\6LZ\207\377MZ" \
+  "\210\377LY\207\377KZ\206\377LY\207\377LX\207\377\205LY\207\377\3KX\207" \
+  "\377JY\207\377KW\207\377\202KX\206\377\4JX\206\377KX\206\377IX\206\377" \
+  "JX\206\377\202JW\206\377\2JV\206\377JW\206\377\202IW\205\377\12HW\204" \
+  "\377IW\205\377IV\205\377IU\205\377IV\205\377HV\205\377GU\204\377JX\206" \
+  "\377)8o\377\30)d\377\203\31*e\377\2\26(c\3777Fy\377\202GU\204\377\1G" \
+  "S\204\377\204FT\203\377\3FS\203\377FR\203\377FS\203\377\203ES\203\377" \
+  "\4ES\201\377ER\202\377EQ\202\377CR\202\377\204DR\202\377\202DQ\201\377" \
+  "\2,<r\377\30)d\377\205\31*e\377\3\30)d\377\33,f\377DR\201\377\202BP\200" \
+  "\377\204AO\200\377\3@O\177\377AO\200\377\77O~\377\204@N\177\377\11\77" \
+  "M\177\377@N\177\377>L\177\377\77M\177\377\77M~\377\77M}\377=K}\377\27" \
+  "(c\377\30)d\377\207\31*e\377\7\32+e\3779Hz\377=J|\377<K}\377;K}\377<" \
+  "K}\377<I{\377\203<J|\377\203;J|\377\1;H|\377\202;I|\377\1""9Iz\377\202" \
+  ":I{\377\2""4Cw\377\27(d\377\213\31*e\377\4\"2k\3777Ex\3777Fy\3776Fy\377" \
+  "\2027Fy\377\14""7Ey\3777Dy\3776Ey\3776Ex\3776Ey\3776Ew\3776Ex\3776Dx" \
+  "\3775Cw\3775Dx\377\27(c\377\30)d\377\214\31*e\377\4\30)d\377'7n\3772" \
+  "Bv\3771Av\377\2032Av\377\3""2Au\3771@u\3770\77u\377\2041@u\377\2$4l\377" \
+  "\30)d\377\220\31*e\377\10\30)d\377&6m\377-=r\377-=q\377-;r\377-<r\377" \
+  ",<r\377+<r\377\203,<r\377\4$5l\377\30)e\377\31*e\377\30)c\377\221\31" \
+  "*e\377\1$4l\377\203(8o\377\4&6o\377'7o\377'7n\377\36.h\377\205\31*e\377" \
+  "\1\30)d\377\204\31*e\377\5\"2k\377FT\203\377GU\205\377GV\205\377HV\205" \
+  "\377\203IV\205\377\2IW\205\377HW\204\377\202IW\205\377\2JW\206\377JV" \
+  "\206\377\202JW\206\377\12JX\206\377IX\206\377KX\206\377JX\206\377KX\206" \
+  "\377KW\206\377KX\207\377JY\207\377KX\207\377KY\207\377\203LY\207\377" \
+  "\6LX\207\377LY\207\377LZ\207\377LY\207\377MZ\210\377LZ\207\377\205MZ" \
+  "\210\377\1LY\210\377\202MZ\210\377\23N[\210\377MZ\207\377N[\210\377O" \
+  "]\212\377Q_\217\377P^\215\377HU\177\377ALs\377:Df\3773;Y\377.6R\3774" \
+  "=]\377<Fi\377CNv\377JW\202\377R`\220\377Q_\217\377O\\\213\377MZ\210\377" \
+  "\202N[\207\377\4N[\210\377MZ\210\377N[\210\377MZ\210\377\202LY\210\377" \
+  "\204MZ\210\377\6LZ\207\377MZ\210\377LY\207\377LZ\207\377LY\207\377LX" \
+  "\207\377\203LY\207\377\6KY\207\377LY\207\377KY\207\377KX\206\377KW\207" \
+  "\377KX\205\377\202KX\206\377\5JX\206\377IX\206\377JX\206\377JW\206\377" \
+  "JV\206\377\202JW\206\377\202IW\205\377\11IV\205\377IW\205\377IU\205\377" \
+  "HV\205\377IV\205\377GV\205\377HV\205\377>M}\377\30)d\377\203\31*e\377" \
+  "\7\30)d\377\37/i\377JX\206\377FT\203\377GT\204\377FS\203\377ET\202\377" \
+  "\202FT\203\377\203FS\203\377\10ES\203\377DS\203\377ES\203\377ES\202\377" \
+  "ER\201\377ER\202\377DR\202\377CR\202\377\203DR\202\377\202DQ\201\377" \
+  "\2""7Ex\377\30*d\377\206\31*e\377\2\27(c\377<K}\377\202BP\200\377\206" \
+  "AO\200\377\1\77O~\377\206@N\177\377\3>L\177\377\77M\177\377\77M~\377" \
+  "\202>L}\377\2\33,f\377\30)d\377\207\31*e\377\2\27(d\3777Fy\377\202=K" \
+  "}\377\2;K}\377;J|\377\204>M\201\377\203=M\201\377\203=L\201\377\203<" \
+  "L\200\377\4=M\201\377\30*h\377\32+i\377\30)d\377\204\31*e\377\2\30)d" \
+  "\377\31*f\377\203\32+i\377\3!2n\3779H}\377:I~\377\2049I~\377\1""9H~\377" \
+  "\2038H~\377\7""6Fy\3775Dw\3776Dx\3775Cx\3775Dx\377\32+e\377\30)d\377" \
+  "\214\32+i\377\5\31+i\377#4p\3776F|\3773Cy\3771@u\377\2022Av\377\3""2" \
+  "Au\3771@u\3770\77u\377\2041@u\377\2'7n\377\30)d\377\220\31*e\377\10\30" \
+  ")d\377#3l\377-=s\377-=q\377-;r\377-<r\377,<r\377+<r\377\202,<r\377\5" \
+  "+;q\377'8s\377\25$W\377\10\15\37\377\23\40O\377\221\31*e\377\1#3l\377" \
+  "\203(8o\377\4&6o\377'7o\377'7n\377\36.h\377\211\31*e\377\5\30)d\377." \
+  ">s\377HV\205\377GV\205\377HV\205\377\203IV\205\377\203IW\205\377\205" \
+  "JW\206\377\2JX\206\377IX\206\377\202JX\206\377\3KX\205\377KW\207\377" \
+  "KX\206\377\202KY\207\377\205LY\207\377\5LX\207\377KY\206\377LZ\207\377" \
+  "MZ\210\377LZ\207\377\204MZ\210\377\4LY\210\377MZ\210\377N[\210\377MZ" \
+  "\207\377\202N[\210\377\4IU\200\377EPw\377.6R\377\22\26!\377\213\0\0\0" \
+  "\377\5\30\33*\3772;Y\377FR{\377IV\201\377N[\211\377\202N[\210\377\5N" \
+  "[\207\377MZ\210\377N[\210\377MZ\210\377LY\210\377\204MZ\210\377\6LZ\207" \
+  "\377MZ\210\377LY\207\377KZ\206\377LY\207\377LX\207\377\203LY\207\377" \
+  "\13KY\207\377LY\207\377JY\207\377KX\206\377KW\207\377KX\206\377KX\205" \
+  "\377JX\206\377IX\206\377JW\206\377JX\206\377\204JW\206\377\5IW\205\377" \
+  "HW\204\377IW\205\377IV\205\377IU\205\377\202HV\205\377\3GV\204\377DR" \
+  "\202\377\40""0i\377\204\31*e\377\6\26(c\377\77M~\377GU\204\377GT\204" \
+  "\377GS\204\377ET\202\377\203FT\203\377\203FS\203\377\1DS\203\377\202" \
+  "ES\203\377\4ES\201\377ER\202\377DR\202\377CR\202\377\204DR\202\377\3" \
+  "DQ\201\377=K|\377\33,f\377\206\31*e\377\6\30)d\377/\77t\377BP\200\377" \
+  "AO\200\377BP\200\377@N\200\377\204AO\200\377\3@O\177\377\77N~\377@M\177" \
+  "\377\204@N\177\377\1>L\177\377\202\77M\177\377\4\77M~\377>L}\377\40""0" \
+  "i\377\30)d\377\207\31*e\377\2\27(d\3771\77u\377\202=K}\377\4;K}\377>" \
+  "N\202\377\31\37""4\377\20\25#\377\205\21\26$\377\206\21\25$\377\5\22" \
+  "\26%\377\10\15\36\377\10\16\"\377\31*e\377\30)d\377\204\31*e\377\2\21" \
+  "\34E\377\6\14\35\377\202\7\14\36\377\1\10\16\36\377\202\20\24#\377\207" \
+  "\17\24#\377\11\16\23\40\377(3Z\3776Ey\3776Dx\3776Cx\3775Dx\377\36.h\377" \
+  "\31+g\377\6\13\32\377\213\7\14\36\377\5\6\14\36\377\11\16\36\377\16\23" \
+  "!\377\34%C\3773By\377\2022Av\377\4""2Au\3771@t\3771@u\3770\77u\377\203" \
+  "1@u\377\2+;q\377\30)d\377\220\31*e\377\17\30)d\377\40""1j\377-=s\377" \
+  "-=q\377-;r\377-<r\377,<r\377+;q\377,<r\377+;q\377(7i\377\22\30/\377\0" \
+  "\0\0\377\0\0\1\377\23\37L\377\221\31*e\377\1#3k\377\203(8o\377\4'7o\377" \
+  "&6o\377'7n\377\36.h\377\211\31*e\377\4\30)d\377@N\177\377HV\205\377G" \
+  "V\205\377\202HV\205\377\5IU\205\377IV\205\377IW\205\377HW\204\377IW\205" \
+  "\377\203JW\206\377\7JV\206\377JX\206\377JW\206\377JX\206\377KX\206\377" \
+  "KX\205\377KX\206\377\202KX\207\377\3JX\207\377LY\207\377KY\207\377\203" \
+  "LY\207\377\5LX\207\377KY\206\377LZ\207\377MY\210\377LZ\207\377\204MZ" \
+  "\210\377\10LY\210\377MZ\210\377N[\207\377N[\210\377Q_\216\377CNu\377" \
+  "\40%8\377\12\14\22\377\204\0\0\0\377\11\10\10\10\377\34\34\34\377..." \
+  "\377AAA\377KKK\377;;;\377)))\377\27\27\27\377\4\4\4\377\204\0\0\0\377" \
+  "\11\14\16\25\377\"(=\377FQz\377Q^\216\377N[\210\377MZ\207\377MZ\210\377" \
+  "N[\210\377MZ\210\377\202LY\210\377\203MZ\210\377\6LZ\207\377MZ\210\377" \
+  "LY\207\377KZ\206\377LY\207\377LX\207\377\204LY\207\377\30KY\207\377J" \
+  "X\207\377KW\206\377KX\206\377KX\205\377KX\206\377JX\206\377IX\206\377" \
+  "JX\206\377JW\206\377JV\206\377JW\206\377IW\205\377JW\206\377HW\204\377" \
+  "IV\205\377IW\205\377IU\205\377IV\205\377HV\205\377GV\205\377HV\205\377" \
+  "*:q\377\30)d\377\203\31*e\377\3\30)d\377*:p\377HU\204\377\202GT\204\377" \
+  "\2FT\203\377ET\202\377\202FT\203\377\12FS\203\377FR\203\377FS\203\377" \
+  "ES\203\377DS\203\377ES\203\377ES\202\377ER\201\377DQ\202\377CR\202\377" \
+  "\204DR\202\377\3DP\200\377BP\200\377\36.h\377\206\31*e\377\2\30)d\377" \
+  "$3l\377\203BP\200\377\1@N\200\377\203AO\200\377\4@O\177\377@N\177\377" \
+  "\77O~\377@M\177\377\204@N\177\377\7\77M\177\377>L\177\377\77M\177\377" \
+  "\77M~\377>L}\377%5m\377\30)d\377\207\31*e\377\7\30)d\377)9p\377>L}\377" \
+  "=K}\377;K}\377>M\201\377\32\40""7\377\217\0\0\0\377\1\30(a\377\205\31" \
+  "*e\377\1\7\14\36\377\216\0\0\0\377\7\20\25%\3777G|\3776Dx\3776Cx\377" \
+  "5Dx\377\"2l\377\25$V\377\217\0\0\0\377\10\40*K\3772Bx\3772Av\3772Au\377" \
+  "2Av\3772At\3771@u\3770\77u\377\2031@u\377\2-<r\377\30)d\377\220\31*e" \
+  "\377\13\30)d\377\36/i\377.=s\377-=q\377-;r\377-<r\377,<r\377.\77w\377" \
+  "&4d\377\21\27-\377\2\3\6\377\202\0\0\0\377\2\0\0\1\377\23\37L\377\221" \
+  "\31*e\377\1!2k\377\202(8o\377\202'7o\377\3&6o\377'7n\377\36.h\377\210" \
+  "\31*e\377\6\30)d\377\37/i\377JX\206\377GU\205\377GV\205\377HV\205\377" \
+  "\202IU\205\377\1IW\205\377\202HW\204\377\203JW\206\377\14JV\206\377J" \
+  "X\206\377JW\206\377IX\206\377KX\206\377JX\206\377KX\205\377KW\206\377" \
+  "JX\207\377JY\207\377LY\207\377KY\207\377\203LY\207\377\4LX\207\377LY" \
+  "\207\377KY\206\377LZ\207\377\205MZ\210\377\2LY\210\377MZ\210\377\202" \
+  "N[\210\377\2LX\204\377\36$6\377\202\0\0\0\377\5\1\1\1\377\4\4\4\377;" \
+  ";;\377\232\232\232\377\361\361\361\377\211\377\377\377\377\5\344\344" \
+  "\344\377\215\215\215\377222\377\2\2\2\377\1\1\1\377\202\0\0\0\377\5\40" \
+  "%8\377JW\202\377N[\210\377MZ\210\377MZ\207\377\202N[\210\377\2MZ\210" \
+  "\377LY\210\377\203MZ\210\377\5LZ\207\377MZ\210\377LZ\207\377KY\206\377" \
+  "LX\207\377\204LY\207\377\4KY\207\377JX\207\377JY\207\377KW\207\377\203" \
+  "KX\206\377\202IX\206\377\1JX\206\377\202JV\206\377\1JW\206\377\202IW" \
+  "\205\377\5HW\204\377IW\205\377IV\205\377IU\205\377IV\205\377\202HV\205" \
+  "\377\3=K}\377\27(d\377\30)d\377\203\31*e\377\6\40""0i\377DR\202\377G" \
+  "U\204\377GT\204\377FT\203\377ET\202\377\203FT\203\377\10FR\203\377FS" \
+  "\203\377ES\203\377DS\203\377ES\203\377ES\202\377ES\201\377EQ\202\377" \
+  "\204DR\202\377\5DQ\201\377DR\202\377ER\201\377&7n\377\30)d\377\206\31" \
+  "*e\377\2\37""0i\377\77N~\377\202BP\200\377\1@N\200\377\204AO\200\377" \
+  "\3@O\177\377\77O~\377@M\177\377\204@N\177\377\7\77M\177\377>L\177\377" \
+  "\77M\177\377\77M~\377>L}\377*:p\377\30)d\377\207\31*e\377\12\30)d\377" \
+  "\"2k\377>L~\377=K}\377;K}\377<L~\377.:a\377\0\0\0\377\13\13\13\377\256" \
+  "\256\256\377\211\243\243\243\377\5\254\254\254\377\35\35\35\377\0\0\0" \
+  "\377\22\36H\377\31*f\377\202\31*e\377\6\30)d\377\27'^\377\3\6\17\377" \
+  "\3\3\3\377www\377\244\244\244\377\211\243\243\243\377\14yyy\377\1\1\1" \
+  "\377\6\10\17\3773Ar\3776Dx\3776Cx\3775Dx\377&6o\377\16\31<\377\0\0\0" \
+  "\377444\377\250\250\250\377\210\243\243\243\377\6\244\244\244\377\235" \
+  "\235\235\377\2\2\2\377\0\0\0\377,:i\3771@v\377\2032Av\377\3""2At\377" \
+  "1@u\3770\77u\377\2031@u\377\2.>s\377\30)d\377\220\31*e\377\10\30)d\377" \
+  "\34-g\377.>s\377,=q\377-;r\377,;q\377+9n\377\22\32""1\377\202\0\0\0\377" \
+  "\5\1\1\1\377***\377\20\20\20\377\0\0\1\377\23\37L\377\220\31*e\377\2" \
+  "\30)d\377!1j\377\203(8o\377\5'7o\377&6o\377'7o\377\36/h\377\30)d\377" \
+  "\207\31*e\377\7\26'c\3778Gz\377IV\205\377HV\204\377HV\205\377IV\205\377" \
+  "IU\205\377\202IV\205\377\11HW\204\377JW\206\377IW\205\377JW\206\377J" \
+  "V\206\377JW\206\377JX\206\377IX\206\377JX\206\377\203KX\206\377\4KW\207" \
+  "\377JY\207\377KX\207\377KY\207\377\205LY\207\377\4KZ\206\377LZ\207\377" \
+  "MZ\210\377LZ\207\377\203MZ\210\377\1LY\210\377\202MZ\207\377\3P^\214" \
+  "\3772;X\377\1\2\3\377\202\0\0\0\377\3III\377\255\255\255\377\372\372" \
+  "\372\377\203\377\377\377\377\1\376\376\376\377\207\377\377\377\377\1" \
+  "\376\376\376\377\203\377\377\377\377\3\367\367\367\377\245\245\245\377" \
+  "DDD\377\202\0\0\0\377\3\3\3\5\3772;Y\377Q_\217\377\202N[\210\377\4MZ" \
+  "\210\377N[\210\377MZ\210\377LY\210\377\203MZ\210\377\5LZ\207\377MZ\210" \
+  "\377KZ\206\377LY\207\377LX\207\377\204LY\207\377\202KY\207\377\6KX\207" \
+  "\377KW\206\377KX\205\377JX\206\377KX\206\377IX\206\377\202JW\206\377" \
+  "\1JV\206\377\202JW\206\377\6IW\205\377HW\204\377IW\205\377IV\205\377" \
+  "IU\205\377IV\205\377\202HV\205\377\3JX\206\377\35.h\377\30)d\377\203" \
+  "\31*e\377\6\33,f\377\77N\177\377FU\203\377GT\204\377FT\203\377ET\202" \
+  "\377\203FT\203\377\10FR\203\377FS\203\377ES\203\377DS\203\377ES\203\377" \
+  "ES\202\377ES\201\377EQ\202\377\206DR\202\377\3DQ\201\3774Cw\377\27(c" \
+  "\377\206\31*e\377\2\35-g\377=K}\377\202BP\200\377\2AO\200\377@N\200\377" \
+  "\203AO\200\377\3@O\177\377\77O~\377@M\177\377\204@N\177\377\3\77M\177" \
+  "\377>L\177\377\77M\177\377\202\77M~\377\1/>s\377\210\31*e\377\7\30)d" \
+  "\377\32+e\377\77M~\377<J|\377<K}\377;J|\377;J{\377\202\0\0\0\377\1\371" \
+  "\371\371\377\212\377\377\377\377\4hhh\377\0\0\0\377\12\22-\377\31+h\377" \
+  "\202\31*e\377\5\31)d\377\25$V\377\0\0\1\377\10\10\10\377\356\356\356" \
+  "\377\212\377\377\377\377\13\341\341\341\377\23\23\23\377\2\3\5\377,8" \
+  "b\3775Dw\3776Cx\3775Dx\377*:s\377\10\15\"\377\0\0\0\377\206\206\206\377" \
+  "\212\377\377\377\377\5\321\321\321\377\2\2\2\377\5\7\14\377.=n\3772@" \
+  "u\377\2032Av\377\3""2At\3771@u\3770\77u\377\2041@u\377\1\30)d\377\220" \
+  "\31*e\377\7\30)d\377\32+e\377.>s\377.\77v\377(5f\377\25\35""7\377\2\3" \
+  "\7\377\202\0\0\0\377\6HHH\377\264\264\264\377\377\377\377\377\"\"\"\377" \
+  "\0\0\1\377\23\37L\377\220\31*e\377\3\30)d\377\40""0i\377'7n\377\202(" \
+  "8o\377\5'7o\377&6o\377'7o\377&6n\377\30)d\377\206\31*e\377\3\30)d\377" \
+  "\31*e\377GU\203\377\203HV\205\377\6IV\205\377IU\205\377IV\205\377IW\205" \
+  "\377HW\204\377IW\205\377\202JW\206\377\1JV\206\377\202JW\206\377\1IX" \
+  "\206\377\202JX\206\377\4KX\205\377KW\207\377KX\207\377KY\207\377\205" \
+  "LY\207\377\5LX\207\377KZ\206\377LZ\207\377MZ\210\377LZ\207\377\203MZ" \
+  "\210\377\5LY\210\377MZ\210\377N[\210\377Q^\216\377\37%6\377\202\0\0\0" \
+  "\377\3""333\377\333\333\333\377\372\372\372\377\202\377\377\377\377\1" \
+  "\376\376\376\377\215\377\377\377\377\1\376\376\376\377\202\377\377\377" \
+  "\377\3\371\371\371\377\326\326\326\377***\377\202\0\0\0\377\4\34!3\377" \
+  "N\\\213\377MZ\207\377N[\210\377\202MZ\210\377\1LY\210\377\205MZ\210\377" \
+  "\3LY\207\377KZ\206\377LX\207\377\203LY\207\377\11KY\207\377LY\207\377" \
+  "KX\207\377KX\206\377KW\207\377KX\205\377KX\206\377JX\206\377IX\206\377" \
+  "\202JX\206\377\204JW\206\377\203IW\205\377\203IV\205\377\4GU\204\377" \
+  "IW\206\3771@u\377\27(c\377\203\31*e\377\2\27(d\377:H{\377\202GU\204\377" \
+  "\3FS\203\377FT\203\377ET\202\377\202FT\203\377\10FS\203\377FR\203\377" \
+  "FS\203\377ES\203\377DS\203\377ES\203\377ES\202\377EQ\202\377\206DR\202" \
+  "\377\3DQ\201\377\77L~\377\26'c\377\206\31*e\377\3\32+f\377;I{\377BP\200" \
+  "\377\202AO\200\377\1@N\200\377\203AO\200\377\3@O\177\377\77O~\377@M\177" \
+  "\377\204@N\177\377\2\77M\177\377>L\177\377\202\77M\177\377\2\77M}\377" \
+  "3Bv\377\210\31*e\377\12\30)d\377\27(c\377;J|\377=K}\377<K}\377;J|\377" \
+  ";J{\377\13\16\30\377\0\0\0\377\262\262\262\377\212\377\377\377\377\12" \
+  "\251\251\251\377\0\0\0\377\4\7\22\377\32,j\377\30)d\377\31*e\377\31*" \
+  "f\377\17\31=\377\0\0\0\377...\377\214\377\377\377\377\12%%%\377\0\0\0" \
+  "\377#-O\3776Ex\3776Cx\3774Cw\377+;t\377\2\4\14\377\0\0\0\377\274\274" \
+  "\274\377\212\377\377\377\377\5\232\232\232\377\0\0\0\377\14\20\35\377" \
+  "0@r\3772@v\377\2032Av\377\3""2At\3771@u\3770\77u\377\2021@u\377\4""1" \
+  "@t\3772Av\377\30*e\377\30)d\377\217\31*e\377\5\30)d\377\30*e\377-=q\377" \
+  "\23\32""2\377\0\0\1\377\202\0\0\0\377\10---\377\326\326\326\377\374\374" \
+  "\374\377\377\377\377\377\365\365\365\377!!!\377\0\0\1\377\23\37L\377" \
+  "\220\31*e\377\3\30)d\377\37/i\377'7n\377\202(8o\377\2'7o\377&6o\377\202" \
+  "'7o\377\1\30)d\377\206\31*e\377\13\30)d\377#4l\377GU\204\377HV\204\377" \
+  "GV\205\377IV\205\377HV\205\377IV\205\377IW\205\377HW\204\377IW\205\377" \
+  "\204JW\206\377\2JX\206\377IX\206\377\202JX\206\377\5KX\205\377KX\206" \
+  "\377KX\207\377JX\207\377KY\207\377\204LY\207\377\2LX\207\377LY\207\377" \
+  "\202LZ\207\377\204MZ\210\377\10LY\210\377MZ\207\377NZ\207\377KX\204\377" \
+  "\26\32'\377\0\0\0\377\2\3\3\377ooo\377\202\377\377\377\377\1\376\376" \
+  "\376\377\223\377\377\377\377\1\376\376\376\377\202\377\377\377\377\1" \
+  "jjj\377\202\0\0\0\377\7\30\34)\377MZ\210\377N[\210\377MZ\207\377N[\210" \
+  "\377MZ\210\377LY\210\377\205MZ\210\377\202LY\207\377\1LX\207\377\203" \
+  "LY\207\377\3KY\207\377LY\207\377JY\207\377\202KX\206\377\5KX\205\377" \
+  "KX\206\377JX\206\377IX\206\377JX\206\377\204JW\206\377\203IW\205\377" \
+  "\203IV\205\377\5GV\205\377HV\205\377AO\200\377\27(c\377\30)d\377\202" \
+  "\31*e\377\7\30)d\377,;q\377HU\204\377GU\204\377GS\204\377FT\203\377E" \
+  "T\202\377\202FT\203\377\12FS\203\377FR\203\377FS\203\377ES\203\377DS" \
+  "\203\377ES\203\377ER\202\377DR\202\377EQ\202\377CR\202\377\204DR\202" \
+  "\377\4DQ\201\377ES\202\377\27(c\377\30)d\377\205\31*e\377\2\30)d\377" \
+  "8Gy\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200\377\3@N\177\377" \
+  "@O\177\377@M\177\377\203@N\177\377\2\77M\177\377>L\177\377\202\77M\177" \
+  "\377\3\77M}\3777Fy\377\32+e\377\210\31*e\377\11\27(d\3775Dx\377=K}\377" \
+  "<K}\377;K}\377;J|\377\27\35""1\377\0\0\0\377sss\377\212\377\377\377\377" \
+  "\1\340\340\340\377\202\0\0\0\377\202\31*e\377\5\30)d\377\32+i\377\5\12" \
+  "\31\377\0\0\0\377\220\220\220\377\214\377\377\377\377\13nnn\377\0\0\0" \
+  "\377\23\30*\3776Fz\3775Dx\3776Cx\377)8i\377\2\3\7\377\11\11\11\377\323" \
+  "\323\323\377\376\376\376\377\210\377\377\377\377\6\376\376\376\377kk" \
+  "k\377\0\0\0\377\23\31.\3772Bv\3772@v\377\2032Av\377\3""2At\3771@u\377" \
+  "0\77u\377\2031@u\377\3""2Av\377\33,f\377\30)d\377\215\31*e\377\5\30)" \
+  "d\377\31*f\377\26&\\\377\16\30:\377\3\4\7\377\202\0\0\0\377\2""333\377" \
+  "\247\247\247\377\202\377\377\377\377\6\376\376\376\377\377\377\377\377" \
+  "\365\365\365\377!!!\377\0\0\1\377\23\37L\377\220\31*e\377\3\30)d\377" \
+  "\36.h\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(7o\377\30)d\377\206" \
+  "\31*e\377\5\30)d\377.=s\377GU\204\377HV\205\377GV\205\377\203IV\205\377" \
+  "\3IW\205\377HW\204\377IW\205\377\204JW\206\377\5JX\206\377IX\206\377" \
+  "JX\206\377KX\206\377KX\205\377\202KX\206\377\3JY\207\377LY\207\377KY" \
+  "\207\377\204LY\207\377\2LZ\207\377LY\207\377\205MZ\210\377\4LY\210\377" \
+  "N[\207\377Sa\220\377\33\37/\377\202\0\0\0\377\1\263\263\263\377\202\377" \
+  "\377\377\377\1\376\376\376\377\225\377\377\377\377\1\376\376\376\377" \
+  "\202\377\377\377\377\1\263\263\263\377\202\0\0\0\377\7\31\35,\377R_\220" \
+  "\377MZ\207\377MZ\210\377N[\210\377MZ\210\377LY\210\377\204MZ\210\377" \
+  "\2LZ\207\377KY\206\377\206LY\207\377\2JY\207\377KX\207\377\203KX\206" \
+  "\377\203JX\206\377\2JW\206\377JV\206\377\202JW\206\377\13IW\205\377H" \
+  "W\204\377IW\205\377IV\205\377IU\205\377IV\205\377HV\205\377GU\204\377" \
+  "FT\203\377\35.g\377\30)d\377\202\31*e\377\7\30)d\377\36.h\377IW\205\377" \
+  "FT\203\377GT\204\377FS\203\377ET\202\377\202FT\203\377\12FS\203\377F" \
+  "R\203\377FS\203\377ES\203\377DS\203\377ES\203\377ES\202\377ER\202\377" \
+  "EQ\202\377CR\202\377\203DR\202\377\5DQ\201\377CQ\201\377FR\202\377\36" \
+  "0i\377\30)d\377\205\31*e\377\2\30)d\3772Av\377\202BP\200\377\2AO\200" \
+  "\377@N\200\377\204AO\200\377\3@O\177\377@N\177\377@M\177\377\203@N\177" \
+  "\377\204\77M\177\377\3\77M}\377<J|\377\32+f\377\210\31*e\377\12\30)d" \
+  "\377/>s\377=K}\377<K}\377;K}\377<K}\377\"+G\377\0\0\0\377CCC\377\375" \
+  "\375\375\377\210\377\377\377\377\5\376\376\376\377\354\354\354\377\24" \
+  "\24\24\377\0\0\1\377\25\"T\377\203\31*e\377\202\0\0\0\377\1\362\362\362" \
+  "\377\214\377\377\377\377\12\313\313\313\377\0\0\0\377\2\2\5\3778H}\377" \
+  "5Dw\3776Cx\377&3^\377\1\1\4\377\34\34\34\377\345\345\345\377\211\377" \
+  "\377\377\377\7\371\371\371\377AAA\377\0\0\0\377\33$D\3772Bv\3772Av\377" \
+  "2@v\377\2022Av\377\3""2At\3771@u\3770\77u\377\2031@u\377\3""2Au\377\36" \
+  ".h\377\30)d\377\215\31*e\377\3\31+h\377\15\26""7\377\1\2\7\377\202\0" \
+  "\0\0\377\3***\377\302\302\302\377\367\367\367\377\205\377\377\377\377" \
+  "\4\365\365\365\377!!!\377\0\0\1\377\23\37L\377\220\31*e\377\3\30)d\377" \
+  "\34.g\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(7o\377\30)d\377\207" \
+  "\31*e\377\3""8Gz\377HV\205\377GV\205\377\202HV\205\377\21IU\205\377I" \
+  "W\205\377IV\205\377IW\205\377JW\206\377IW\205\377JW\206\377JV\206\377" \
+  "JX\206\377JW\206\377JX\206\377KX\206\377JX\206\377KX\206\377KW\206\377" \
+  "JX\207\377KY\207\377\206LY\207\377\3KZ\206\377MZ\210\377LZ\207\377\204" \
+  "MZ\210\377\3MZ\207\377N[\211\377*2J\377\202\0\0\0\377\3\313\313\313\377" \
+  "\377\377\377\377\376\376\376\377\231\377\377\377\377\3\376\376\376\377" \
+  "\377\377\377\377\304\304\304\377\202\0\0\0\377\4,4O\377N[\211\377MZ\210" \
+  "\377N[\207\377\207MZ\210\377\3LZ\207\377KY\206\377LX\207\377\203LY\207" \
+  "\377\4KY\207\377KX\207\377JY\207\377KW\207\377\203KX\206\377\1IX\206" \
+  "\377\202JX\206\377\1JV\206\377\203JW\206\377\1HW\204\377\202IW\205\377" \
+  "\7IU\205\377IV\205\377HV\205\377GV\205\377GU\204\377'6n\377\30)d\377" \
+  "\203\31*e\377\5\25&b\377CQ\201\377GU\204\377FT\203\377GS\204\377\204" \
+  "FT\203\377\202FS\203\377\203ES\203\377\4ES\202\377ER\201\377EQ\202\377" \
+  "CR\202\377\204DR\202\377\4DQ\201\377ER\201\377'7n\377\30)d\377\205\31" \
+  "*e\377\2\30)d\377+;q\377\202BP\200\377\202AO\200\377\1@N\200\377\203" \
+  "AO\200\377\3@O\177\377@N\177\377@M\177\377\204@N\177\377\203\77M\177" \
+  "\377\4\77M}\377@N\177\377\33,f\377\30)d\377\207\31*e\377\12\30)d\377" \
+  "(8o\377=K}\377<K}\377;K}\377<K}\377,7\\\377\1\1\2\377&&&\377\356\356" \
+  "\356\377\211\377\377\377\377\13\364\364\364\377333\377\0\0\0\377\20\33" \
+  "C\377\31*e\377\31*f\377\21\35E\377\0\0\0\377)))\377\377\377\377\377\376" \
+  "\376\376\377\214\377\377\377\377\11\4\4\4\377\0\0\0\377,8a\3776Ey\377" \
+  "6Cw\377#-R\377\0\0\1\377...\377\370\370\370\377\210\377\377\377\377\10" \
+  "\376\376\376\377\364\364\364\377\26\26\26\377\0\0\0\377\".\\\3772Bv\377" \
+  "2Av\3772@v\377\2022Av\377\3""2At\3771@u\3770\77u\377\2031@u\377\3""2" \
+  "Au\377!1j\377\30)d\377\215\31*e\377\5\32,j\377\4\7\23\377\0\0\0\377\31" \
+  "\31\31\377\240\240\240\377\202\377\377\377\377\1\376\376\376\377\205" \
+  "\377\377\377\377\4\365\365\365\377!!!\377\0\0\1\377\23\37L\377\220\31" \
+  "*e\377\3\30)d\377\34-g\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(" \
+  "7o\377\30)d\377\206\31*e\377\7\32+f\377AO\200\377HV\205\377GV\205\377" \
+  "HV\205\377IV\205\377IU\205\377\203IW\205\377\203JW\206\377\1JV\206\377" \
+  "\202JX\206\377\1IX\206\377\203KX\206\377\4KW\207\377JY\207\377KX\207" \
+  "\377KY\207\377\203LY\207\377\3LX\207\377KY\206\377LZ\207\377\206MZ\210" \
+  "\377\7N[\210\377=Gk\377\2\2\3\377\0\0\0\377\225\225\225\377\377\377\377" \
+  "\377\376\376\376\377\233\377\377\377\377\13\376\376\376\377\377\377\377" \
+  "\377\202\202\202\377\0\0\0\377\2\2\3\377BLt\377N[\211\377N[\207\377N" \
+  "[\210\377MZ\210\377LY\210\377\203MZ\210\377\4LZ\207\377LY\207\377KZ\206" \
+  "\377LX\207\377\204LY\207\377\202KY\207\377\11KX\207\377KW\206\377KX\205" \
+  "\377KX\206\377JX\206\377IX\206\377JX\206\377JW\206\377JV\206\377\202" \
+  "JW\206\377\11IW\205\377HW\204\377IW\205\377IV\205\377IU\205\377HV\205" \
+  "\377GV\205\377HV\205\3770\77u\377\204\31*e\377\5\27(c\3775Dw\377HV\204" \
+  "\377GT\204\377GS\204\377\204FT\203\377\12FS\203\377ES\203\377FS\203\377" \
+  "ES\203\377ES\202\377ES\203\377ER\201\377ER\202\377DR\202\377CR\202\377" \
+  "\203DR\202\377\202DQ\201\377\2""0\77t\377\27(d\377\205\31*e\377\3\30" \
+  ")d\377#3k\377CQ\200\377\202BP\200\377\2AO\200\377@N\200\377\203AO\200" \
+  "\377\3@O\177\377@N\177\377@M\177\377\204@N\177\377\203\77M\177\377\4" \
+  ">L}\377@N\177\377\"2j\377\30)d\377\207\31*e\377\13\30)d\377#3l\377=K" \
+  "}\377<K}\377;K}\377<K}\3776Cq\377\2\2\4\377\11\11\11\377\337\337\337" \
+  "\377\376\376\376\377\210\377\377\377\377\11\375\375\375\377QQQ\377\0" \
+  "\0\0\377\14\25""3\377\31*e\377\31+h\377\7\15\37\377\0\0\0\377xxx\377" \
+  "\214\377\377\377\377\12\376\376\376\377\377\377\377\377___\377\0\0\0" \
+  "\377\26\34""1\3778G|\3776Dx\377\35%B\377\0\0\0\377LLL\377\212\377\377" \
+  "\377\377\1\342\342\342\377\202\0\0\0\377\4'7p\3772Bv\3772Av\3772@v\377" \
+  "\2022Av\377\3""2Au\3771@t\3770\77u\377\2041@u\377\2#3k\377\30)d\377\215" \
+  "\31*e\377\4\32,j\377\4\10\24\377\0\0\0\377\270\270\270\377\211\377\377" \
+  "\377\377\4\365\365\365\377!!!\377\0\0\1\377\23\37L\377\220\31*e\377\3" \
+  "\30)d\377\33,f\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(7o\377\30" \
+  ")d\377\205\31*e\377\6\30)d\377\34,g\377IW\206\377HV\205\377GV\205\377" \
+  "HV\205\377\202IU\205\377\3IW\205\377HW\204\377IW\205\377\202JW\206\377" \
+  "\202JV\206\377\11JX\206\377IX\206\377KX\206\377JX\206\377KX\205\377K" \
+  "W\207\377KX\206\377JX\207\377KY\207\377\203LY\207\377\4LX\207\377LY\207" \
+  "\377KZ\206\377LZ\207\377\204MZ\210\377\10LY\210\377N[\210\377P]\214\377" \
+  "\20\23\35\377\0\0\0\377III\377\377\377\377\377\376\376\376\377\235\377" \
+  "\377\377\377\6\376\376\376\377\377\377\377\377EEE\377\0\0\0\377\20\23" \
+  "\35\377Q_\217\377\202N[\210\377\1N[\207\377\206MZ\210\377\202LZ\207\377" \
+  "\205LY\207\377\4KY\207\377KX\207\377JW\207\377KX\205\377\202KX\206\377" \
+  "\202JX\206\377\1IW\205\377\204JW\206\377\5HV\204\377IW\204\377IV\205" \
+  "\377IU\205\377IV\205\377\202HV\205\377\1:I{\377\204\31*e\377\6\30)d\377" \
+  "*:q\377HV\205\377GT\204\377GS\204\377FS\203\377\202FT\203\377\1ET\202" \
+  "\377\203FS\203\377\202ES\203\377\2DR\202\377DR\201\377\202ER\202\377" \
+  "\204DR\202\377\4CQ\201\377DQ\201\3777Gy\377\27(d\377\205\31*e\377\3\30" \
+  ")d\377\34,f\377CQ\201\377\202BP\200\377\205AO\200\377\202@O\177\377\205" \
+  "@N\177\377\12\77M\177\377>L~\377\77M\177\377\77M~\377@N~\377)9p\377\30" \
+  ")d\377\31*e\377\31)d\377\30)d\377\205\31*e\377\1!1j\377\202=K}\377\202" \
+  "<K}\377\4\77N\202\377\6\7\14\377\0\0\0\377\277\277\277\377\212\377\377" \
+  "\377\377\11vvv\377\0\0\0\377\11\17$\377\30)d\377\30(a\377\3\5\14\377" \
+  "\0\0\0\377\272\272\272\377\376\376\376\377\215\377\377\377\377\10\270" \
+  "\270\270\377\0\0\0\377\3\5\10\3777F{\3776Dx\377\23\31,\377\0\0\0\377" \
+  "\204\204\204\377\212\377\377\377\377\5\231\231\231\377\0\0\0\377\6\12" \
+  "\31\377&7r\3772Bv\377\2052Av\377\1""2Au\377\2051@u\377\1&6m\377\202\30" \
+  ")d\377\203\31*e\377\1\30)d\377\204\31*e\377\1\30)d\377\203\31*e\377\4" \
+  "\32,j\377\4\10\24\377\0\0\0\377\273\273\273\377\211\377\377\377\377\4" \
+  "\365\365\365\377!!!\377\0\0\1\377\23\37L\377\206\31*e\377\1\30)d\377" \
+  "\211\31*e\377\3\30)d\377\33,f\377'7n\377\202(8o\377\5'7o\377&6o\377'" \
+  "7o\377(7o\377\30)d\377\205\31*e\377\4\30)d\377%5m\377JX\206\377GU\205" \
+  "\377\202HV\205\377\1IU\205\377\202IV\205\377\5HW\204\377JW\206\377IW" \
+  "\205\377JW\206\377JV\206\377\202JW\206\377\1IX\206\377\202KX\206\377" \
+  "\4KX\205\377KW\207\377KX\207\377KY\207\377\204LY\207\377\1LX\207\377" \
+  "\202LY\207\377\204MZ\210\377\7LY\210\377MZ\210\377O\\\212\3779Cd\377" \
+  "\0\0\0\377\10\10\10\377\376\376\376\377\213\377\377\377\377\1\376\376" \
+  "\376\377\202\377\377\377\377\5\355\355\355\377\322\322\322\377\310\310" \
+  "\310\377\331\331\331\377\374\374\374\377\202\377\377\377\377\1\376\376" \
+  "\376\377\211\377\377\377\377\13\376\376\376\377\377\377\377\377\365\365" \
+  "\365\377\11\11\11\377\0\0\0\377:Cf\377N[\212\377N[\207\377N[\210\377" \
+  "IU\177\377FQ|\377\205FR|\377\207EQ{\377\21FS~\377KY\210\377N[\214\377" \
+  "GT\200\3772;Z\377*2L\377\")\77\377\35#5\377!'=\377(0J\3771:Y\377DQ|\377" \
+  "M[\214\377IW\206\377HV\204\377IU\205\377IV\205\377\202HV\205\377\1@O" \
+  "\177\377\204\31*e\377\32\30)d\377!2j\377IV\205\377GU\204\377GT\204\377" \
+  "FS\203\377ES\202\377GU\205\377IX\211\377FS\203\3778Bi\377+3Q\377%-G\377" \
+  "!'>\377\35\"6\377\33!4\377\40&=\377%,F\377)2P\377/9Z\3774\77c\377\77" \
+  "Ly\377HW\212\377ES\204\377=K|\377\31)d\377\205\31*e\377\5\30)d\377\26" \
+  "'c\377BO\200\377@M|\377<Iu\377\206;Hu\377\1:Hs\377\204:Gt\377\2:Gs\377" \
+  "9Ft\377\202\77M\177\377\25AP\204\377\77M}\377\37+Q\377\16\30;\377\14" \
+  "\25""3\377\12\21*\377\12\21)\377\14\24""0\377\16\30:\377\23!O\377\30" \
+  "*e\377\31+g\377\40""0i\377<K|\377=K}\377<K}\377;J|\377>M\201\377\27\35" \
+  "1\377\0\0\0\377vvv\377\212\377\377\377\377\11\246\246\246\377\0\0\0\377" \
+  "\5\11\26\377\30(b\377\24\"S\377\1\2\5\377\23\23\23\377\335\335\335\377" \
+  "\376\376\376\377\214\377\377\377\377\11\376\376\376\377\342\342\342\377" \
+  "\16\16\16\377\1\2\3\377-8d\3776Dy\377\11\14\25\377\0\0\0\377\277\277" \
+  "\277\377\210\377\377\377\377\7\376\376\376\377\377\377\377\377III\377" \
+  "\0\0\0\377\16\27""9\377!1i\377-<k\377\206-;k\377\1-:k\377\203,:k\377" \
+  "\16-;k\377%3f\377\27'_\377\32,j\377\24\"S\377\16\30<\377\13\23/\377\12" \
+  "\21)\377\15\25""3\377\17\32@\377\24\"R\377\32+i\377\31*g\377\27'_\377" \
+  "\202\27&\\\377\4\30(a\377\4\7\22\377\0\0\0\377\273\273\273\377\211\377" \
+  "\377\377\377\4\365\365\365\377!!!\377\0\0\1\377\21\34E\377\204\27&\\" \
+  "\377\2\26%\\\377\30)b\377\212\31*e\377\3\30)d\377\32+f\377'7n\377\202" \
+  "(8o\377\5'7o\377&6o\377'7o\377(7o\377\30)d\377\205\31*e\377\12\27(d\377" \
+  "/>s\377IW\206\377HV\204\377HV\205\377IV\205\377IU\205\377IV\205\377I" \
+  "W\205\377HW\204\377\203JW\206\377\4JV\206\377JW\206\377JX\206\377IX\206" \
+  "\377\202KX\206\377\4KX\205\377KW\207\377KX\207\377KY\207\377\204LY\207" \
+  "\377\3LX\207\377LY\207\377LZ\207\377\204MZ\210\377\10LY\210\377MZ\210" \
+  "\377N\\\211\377\12\14\22\377\0\0\0\377\217\217\217\377\377\377\377\377" \
+  "\376\376\376\377\211\377\377\377\377\5\376\376\376\377\377\377\377\377" \
+  "\325\325\325\377555\377\3\3\3\377\203\2\2\2\377\5\6\6\6\377UUU\377\357" \
+  "\357\357\377\377\377\377\377\376\376\376\377\211\377\377\377\377\202" \
+  "\376\376\376\377\10nnn\377\0\0\0\377\25\30$\377MZ\207\377N[\207\377Q" \
+  "_\216\377\25\30%\377\0\0\0\377\213\0\1\1\377\5\0\0\0\377\27\35+\377D" \
+  "Q{\377\34!3\377\1\1\2\377\207\0\0\0\377\6\1\1\1\377\24\31%\377>Ip\377" \
+  "JW\206\377HU\204\377IV\205\377\202HV\205\377\1GU\204\377\204\31*e\377" \
+  "\13\30)e\377\35-g\377FT\203\377GU\204\377FT\203\377GT\204\377GU\204\377" \
+  "2<_\377\23\30%\377\2\2\4\377\0\0\1\377\211\0\0\0\377\202\0\0\1\377\5" \
+  "\12\15\25\377(/L\377\77M\177\377\34-g\377\30)d\377\205\31*e\377\5\26" \
+  "'c\377;I|\377/8[\377\0\0\0\377\0\1\1\377\213\0\0\1\377\5\2\2\4\377BQ" \
+  "\205\3778Dr\377\32\40""5\377\2\2\4\377\210\0\0\0\377\5\1\1\4\377\16\30" \
+  ";\377\40""1l\377<J|\377=K}\377\202<K}\377\6=L\177\377+4X\377\0\0\0\377" \
+  ",,,\377\377\377\377\377\376\376\376\377\210\377\377\377\377\7\327\327" \
+  "\327\377\0\0\0\377\1\3\7\377\27(`\377\20\34C\377\0\0\0\377'''\377\217" \
+  "\377\377\377\377\5\364\364\364\377222\377\0\0\0\377!*K\3776Ey\377\202" \
+  "\0\0\0\377\1\371\371\371\377\212\377\377\377\377\202\0\0\0\377\3\26%" \
+  "Y\377\13\22+\377\0\0\0\377\214\0\0\1\377\2\7\14\36\377\6\13\31\377\206" \
+  "\0\0\0\377\5\0\0\1\377\4\6\21\377\22\37J\377\10\17$\377\0\0\0\377\202" \
+  "\0\0\1\377\202\0\0\0\377\1\273\273\273\377\211\377\377\377\377\2\365" \
+  "\365\365\377!!!\377\202\0\0\0\377\204\0\0\1\377\2\0\0\0\377\23!O\377" \
+  "\212\31*e\377\3\30)d\377\32+f\377'7n\377\202(8o\377\5'7o\377&6o\377'" \
+  "7o\377(7o\377\30)d\377\205\31*e\377\3\26'c\3779Gz\377IV\205\377\202H" \
+  "V\205\377\5IV\205\377IU\205\377IV\205\377IW\205\377HW\204\377\205JW\206" \
+  "\377\1IX\206\377\202JX\206\377\6KX\205\377KX\207\377KX\206\377JY\207" \
+  "\377LY\207\377KY\207\377\202LY\207\377\5LX\207\377LY\207\377KZ\206\377" \
+  "MZ\210\377LZ\207\377\202MZ\210\377\10LY\210\377MZ\210\377MZ\207\3779" \
+  "Cd\377\1\2\3\377\25\25\25\377\343\343\343\377\376\376\376\377\211\377" \
+  "\377\377\377\3\376\376\376\377\377\377\377\377{{{\377\203\0\0\0\377\3" \
+  "\6\7\13\377\13\15\24\377\4\4\6\377\202\0\0\0\377\4\4\4\4\377\242\242" \
+  "\242\377\377\377\377\377\376\376\376\377\212\377\377\377\377\12\320\320" \
+  "\320\377\5\5\5\377\2\3\4\377DOw\377MZ\210\377Q_\216\377\24\27#\377\0" \
+  "\0\0\377\7\7\7\377\14\14\14\377\210\13\13\13\377\4\6\6\6\377\0\0\0\377" \
+  "\6\7\13\377\0\1\1\377\202\0\0\0\377\7---\377MMM\377___\377uuu\377ddd" \
+  "\377RRR\377555\377\203\0\0\0\377\10\37%8\377DP|\377IW\206\377IU\204\377" \
+  "GV\205\377KX\206\377\35-g\377\30)d\377\203\31*e\377\6\34,f\377AO\200" \
+  "\377GU\204\377CP}\377-5T\377\15\20\31\377\203\0\0\0\377\13\37\37\37\377" \
+  "CCC\377TTT\377```\377qqq\377vvv\377aaa\377SSS\377FFF\377888\377&&&\377" \
+  "\203\0\0\0\377\4\1\1\3\377\14\24/\377\26&]\377\31*g\377\204\31*e\377" \
+  "\5\26(c\3778Fz\377/8Z\377\0\0\0\377\2\2\2\377\211\13\13\13\377\4\12\12" \
+  "\12\377\0\0\0\377\2\2\4\377$,I\377\203\0\0\0\377\10'''\377LLL\377ZZZ" \
+  "\377nnn\377sss\377```\377III\377\37\37\37\377\202\0\0\0\377\4\5\7\17" \
+  "\377.9a\377>M\200\377<J|\377\202<K}\377\1;Iz\377\202\0\0\0\377\213\377" \
+  "\377\377\377\202\0\0\0\377\4\27&]\377\11\20&\377\0\0\0\377nnn\377\220" \
+  "\377\377\377\377\10___\377\0\0\0\377\26\33""1\377-:f\377\0\0\0\377\25" \
+  "\25\25\377\377\377\377\377\376\376\376\377\210\377\377\377\377\7\330" \
+  "\330\330\377\0\0\0\377\1\2\6\377\30)d\377\12\21*\377\0\0\0\377\5\5\5" \
+  "\377\211\13\13\13\377\1\5\5\5\377\203\0\0\0\377\7\10\10\10\377FFF\377" \
+  "```\377rrr\377XXX\377AAA\377\17\17\17\377\204\0\0\0\377\1\6\6\6\377\202" \
+  "\13\13\13\377\2\0\0\0\377\276\276\276\377\211\377\377\377\377\2\366\366" \
+  "\366\377+++\377\205\13\13\13\377\3\1\1\1\377\0\0\0\377\23!O\377\212\31" \
+  "*e\377\3\30)d\377\32*e\377'7n\377\202(8o\377\203'7o\377\2(7o\377\30)" \
+  "d\377\205\31*e\377\2\25'b\377BP\201\377\203HV\205\377\203IV\205\377\2" \
+  "HW\204\377IW\205\377\204JW\206\377\10JX\206\377IX\206\377JX\206\377K" \
+  "X\206\377KX\205\377KX\206\377KX\207\377JY\207\377\204LY\207\377\3LX\207" \
+  "\377LY\207\377KZ\206\377\204MZ\210\377\6LY\210\377MZ\210\377N[\210\377" \
+  "'.E\377\0\0\0\377QQQ\377\212\377\377\377\377\3\376\376\376\377\377\377" \
+  "\377\377```\377\202\0\0\0\377\7\31\35+\377FRy\377JV\177\377KW\202\377" \
+  "IU~\377DNt\377\14\16\25\377\202\0\0\0\377\1\214\214\214\377\214\377\377" \
+  "\377\377\11,,,\377\0\0\0\3774<Z\377N\\\212\377Q_\217\377\24\27#\377\0" \
+  "\0\0\377\235\235\235\377\356\356\356\377\207\351\351\351\377\2\353\353" \
+  "\353\377\200\200\200\377\203\0\0\0\377\4VVV\377\321\321\321\377\362\362" \
+  "\362\377\373\373\373\377\203\377\377\377\377\4\375\375\375\377\365\365" \
+  "\365\377\345\345\345\377vvv\377\202\0\0\0\377\7\4\4\7\377@Kt\377IW\206" \
+  "\377GU\204\377JX\206\377'7n\377\30)d\377\203\31*e\377\4\32+f\377>M\177" \
+  "\377ANz\377\12\14\23\377\202\0\0\0\377\6\6\6\6\377\222\222\222\377\337" \
+  "\337\337\377\356\356\356\377\371\371\371\377\375\375\375\377\204\377" \
+  "\377\377\377\7\375\375\375\377\371\371\371\377\366\366\366\377\361\361" \
+  "\361\377\336\336\336\377www\377\6\6\6\377\202\0\0\0\377\4\2\3\11\377" \
+  "\23\40O\377\31*e\377\30)d\377\202\31*e\377\6\27(c\3774Cx\377/8Z\377\0" \
+  "\0\0\377666\377\344\344\344\377\207\351\351\351\377\2\352\352\352\377" \
+  "\333\333\333\377\204\0\0\0\377\4TTT\377\316\316\316\377\361\361\361\377" \
+  "\373\373\373\377\204\377\377\377\377\16\372\372\372\377\357\357\357\377" \
+  "\267\267\267\377\16\16\16\377\0\0\0\377\0\0\1\377'1Q\377>M\200\377<K" \
+  "}\377;K}\377=L\177\377\11\13\23\377\0\0\0\377\273\273\273\377\210\377" \
+  "\377\377\377\10\376\376\376\377\377\377\377\377111\377\0\0\0\377\21\35" \
+  "F\377\2\3\10\377\0\0\0\377\313\313\313\377\220\377\377\377\377\6\253" \
+  "\253\253\377\0\0\0\377\12\14\26\377\36&D\377\0\0\0\377YYY\377\212\377" \
+  "\377\377\377\10\231\231\231\377\0\0\0\377\6\12\31\377\30)d\377\12\21" \
+  "*\377\0\0\0\377nnn\377\356\356\356\377\207\351\351\351\377\2\354\354" \
+  "\354\377ooo\377\202\0\0\0\377\3PPP\377\346\346\346\377\372\372\372\377" \
+  "\203\377\377\377\377\4\370\370\370\377\351\351\351\377\220\220\220\377" \
+  "\16\16\16\377\202\0\0\0\377\5\212\212\212\377\356\356\356\377\351\351" \
+  "\351\377\350\350\350\377\371\371\371\377\211\377\377\377\377\2\376\376" \
+  "\376\377\354\354\354\377\204\351\351\351\377\4\353\353\353\377&&&\377" \
+  "\0\0\0\377\23!O\377\212\31*e\377\3\30)d\377\31*e\377'7n\377\203(8o\377" \
+  "\202'7o\377\2(7o\377\30)d\377\204\31*e\377\3\30)d\377\30(d\377JW\205" \
+  "\377\202GV\205\377\6IV\205\377HV\205\377IV\205\377IW\205\377HW\204\377" \
+  "IW\205\377\204JW\206\377\10JX\206\377IX\206\377JX\206\377KX\206\377K" \
+  "X\205\377KX\206\377JX\207\377KY\207\377\205LY\207\377\3KZ\206\377MY\210" \
+  "\377LZ\207\377\204MZ\210\377\5N[\207\377N[\211\377\24\27#\377\0\0\0\377" \
+  "\236\236\236\377\213\377\377\377\377\5\274\274\274\377\0\0\0\377\0\0" \
+  "\1\377)/G\377Tb\222\377\203P]\212\377\10P]\211\377P]\212\377Sa\220\377" \
+  "\36#4\377\0\0\0\377\15\15\15\377\334\334\334\377\376\376\376\377\212" \
+  "\377\377\377\377\10\206\206\206\377\0\0\0\377\32\36-\377P^\216\377Q_" \
+  "\217\377\24\27#\377\0\0\0\377\253\253\253\377\211\377\377\377\377\4\214" \
+  "\214\214\377\0\0\0\377\20\20\20\377\250\250\250\377\202\377\377\377\377" \
+  "\1\376\376\376\377\210\377\377\377\377\11\311\311\311\377%%%\377\0\0" \
+  "\0\377\5\7\13\377ALv\377HV\205\377IW\206\3771@u\377\27(c\377\202\31*" \
+  "e\377\3\30)d\377\31*e\377%0U\377\202\0\0\0\377\2\35\35\35\377\204\204" \
+  "\204\377\215\377\377\377\377\1\376\376\376\377\203\377\377\377\377\2" \
+  "\263\263\263\377&&&\377\202\0\0\0\377\2\17\31>\377\30)c\377\202\31*e" \
+  "\377\6\27(c\3772Bv\377/9Z\377\0\0\0\377;;;\377\370\370\370\377\210\377" \
+  "\377\377\377\1\357\357\357\377\202\0\0\0\377\2\27\27\27\377\245\245\245" \
+  "\377\202\377\377\377\377\1\376\376\376\377\206\377\377\377\377\1\376" \
+  "\376\376\377\202\377\377\377\377\4GGG\377\0\0\0\377\1\1\1\3771=e\377" \
+  "\203<K}\377\3\30\36""2\377\0\0\0\377qqq\377\212\377\377\377\377\5www" \
+  "\377\0\0\0\377\6\13\32\377\0\0\0\377\5\5\5\377\221\377\377\377\377\1" \
+  "\367\367\367\377\202\0\0\0\377\3\15\20\35\377\0\0\0\377\233\233\233\377" \
+  "\212\377\377\377\377\7]]]\377\0\0\0\377\13\22-\377\31*e\377\12\21*\377" \
+  "\0\0\0\377xxx\377\211\377\377\377\377\3yyy\377\0\0\0\377SSS\377\202\377" \
+  "\377\377\377\1\376\376\376\377\206\377\377\377\377\1PPP\377\202\0\0\0" \
+  "\377\1\227\227\227\377\224\377\377\377\377\3***\377\0\0\0\377\23!O\377" \
+  "\212\31*e\377\3\30)d\377\31*e\377'7n\377\203(8o\377\202'7o\377\2(7o\377" \
+  "\30)d\377\204\31*e\377\5\30)d\377\36.h\377IW\205\377HU\205\377GV\205" \
+  "\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\204JW\206\377\7JX" \
+  "\206\377IX\206\377JX\206\377KX\205\377KX\206\377KW\206\377JX\207\377" \
+  "\202KY\207\377\204LY\207\377\2KZ\206\377LZ\207\377\205MZ\210\377\2N[" \
+  "\207\377O\\\212\377\202\0\0\0\377\1\353\353\353\377\212\377\377\377\377" \
+  "\5\374\374\374\377TTT\377\0\0\0\377\25\30%\377O\\\211\377\202P]\211\377" \
+  "\203Q^\212\377\6Q^\211\377Q^\212\377NZ\205\377\11\12\17\377\0\0\0\377" \
+  "\203\203\203\377\213\377\377\377\377\10\345\345\345\377\0\0\0\377\1\0" \
+  "\1\377R`\221\377R_\217\377\24\27#\377\0\0\0\377\253\253\253\377\211\377" \
+  "\377\377\377\5\212\212\212\377\1\1\1\377\331\331\331\377\377\377\377" \
+  "\377\376\376\376\377\211\377\377\377\377\16\376\376\376\377\377\377\377" \
+  "\377\355\355\355\377\"\"\"\377\0\0\0\377\13\15\25\377JX\210\377HV\205" \
+  "\3779G{\377\26'c\377\31*e\377\30)d\377\31+h\377\20\33B\377\202\0\0\0" \
+  "\377\2KKK\377\347\347\347\377\202\377\377\377\377\1\376\376\376\377\215" \
+  "\377\377\377\377\1\376\376\376\377\202\377\377\377\377\2\357\357\357" \
+  "\377lll\377\202\0\0\0\377\11\13\23-\377\30*d\377\30)d\377\27(d\377/\77" \
+  "t\377/9[\377\0\0\0\377;;;\377\370\370\370\377\210\377\377\377\377\6\357" \
+  "\357\357\377\0\0\0\377+++\377\346\346\346\377\377\377\377\377\376\376" \
+  "\376\377\211\377\377\377\377\14\376\376\376\377\377\377\377\377\374\374" \
+  "\374\377AAA\377\0\0\0\377\13\15\27\377=L\200\377;J|\377<J|\377'0P\377" \
+  "\0\0\0\377000\377\212\377\377\377\377\1\275\275\275\377\203\0\0\0\377" \
+  "\3___\377\377\377\377\377\376\376\376\377\216\377\377\377\377\3\376\376" \
+  "\376\377\377\377\377\377999\377\203\0\0\0\377\1\331\331\331\377\211\377" \
+  "\377\377\377\10\367\367\367\377888\377\0\0\0\377\17\32\77\377\31*e\377" \
+  "\12\21*\377\0\0\0\377xxx\377\211\377\377\377\377\3xxx\377\26\26\26\377" \
+  "\371\371\371\377\210\377\377\377\377\2\325\325\325\377\6\6\6\377\202" \
+  "\0\0\0\377\1\227\227\227\377\224\377\377\377\377\3***\377\0\0\0\377\23" \
+  "!O\377\212\31*e\377\3\30)d\377\31)d\377'7n\377\203(8o\377\202'7o\377" \
+  "\2(7o\377\30)d\377\204\31*e\377\5\30)d\377\40""0j\377IW\205\377HV\205" \
+  "\377GV\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\204JW\206" \
+  "\377\202JX\206\377\6KX\206\377KX\205\377KX\206\377KW\207\377JY\207\377" \
+  "KY\207\377\205LY\207\377\2KZ\206\377LZ\207\377\203MZ\210\377\10LY\210" \
+  "\377MZ\210\377O\\\212\377<Fi\377\0\0\0\377\27\27\27\377\377\377\377\377" \
+  "\376\376\376\377\210\377\377\377\377\10\376\376\376\377\364\364\364\377" \
+  "\22\22\22\377\0\0\0\3776\77]\377P]\212\377Q^\212\377P]\212\377\205Q^" \
+  "\211\377\6R`\215\377/6Q\377\0\0\0\377\35\35\35\377\377\377\377\377\376" \
+  "\376\376\377\210\377\377\377\377\11\376\376\376\377\377\377\377\377\25" \
+  "\25\25\377\0\0\0\377@Jp\377R`\221\377\24\27#\377\0\0\0\377\253\253\253" \
+  "\377\211\377\377\377\377\4\227\227\227\377\320\320\320\377\377\377\377" \
+  "\377\376\376\376\377\215\377\377\377\377\7\362\362\362\377\14\14\14\377" \
+  "\0\0\0\377\37$9\377JY\211\377=L}\377\26'c\377\202\31*e\377\1\23\40N\377" \
+  "\202\0\0\0\377\1eee\377\225\377\377\377\377\15\376\376\376\377\377\377" \
+  "\377\377\225\225\225\377\1\1\1\377\0\0\0\377\24!P\377\31*f\377\27(d\377" \
+  ",<r\377/9[\377\0\0\0\377;;;\377\370\370\370\377\210\377\377\377\377\4" \
+  "\357\357\357\377\15\15\15\377\347\347\347\377\376\376\376\377\216\377" \
+  "\377\377\377\12\371\371\371\377\6\6\6\377\0\0\0\377+6Z\377=L\177\377" \
+  ";J|\377/:a\377\1\2\3\377\33\33\33\377\353\353\353\377\211\377\377\377" \
+  "\377\1\367\367\367\377\203\0\0\0\377\1\270\270\270\377\210\377\377\377" \
+  "\377\2\373\373\373\377\376\376\376\377\210\377\377\377\377\1\235\235" \
+  "\235\377\202\0\0\0\377\3\16\16\16\377\352\352\352\377\376\376\376\377" \
+  "\207\377\377\377\377\11\376\376\376\377\350\350\350\377\34\34\34\377" \
+  "\0\1\2\377\23!O\377\31*e\377\12\21*\377\0\0\0\377xxx\377\211\377\377" \
+  "\377\377\4ppp\377\303\303\303\377\377\377\377\377\376\376\376\377\205" \
+  "\377\377\377\377\202\376\376\376\377\1\200\200\200\377\203\0\0\0\377" \
+  "\1\227\227\227\377\224\377\377\377\377\3***\377\0\0\0\377\23!O\377\212" \
+  "\31*e\377\202\30)d\377\1'7n\377\203(8o\377\202'7o\377\2(7o\377\30)d\377" \
+  "\204\31*e\377\5\30)d\377#3k\377IW\205\377HV\205\377GV\205\377\203IV\205" \
+  "\377\3IW\205\377HW\204\377IW\205\377\202JW\206\377\2JV\206\377JW\206" \
+  "\377\202JX\206\377\6KX\206\377KX\205\377KX\206\377KW\207\377JY\207\377" \
+  "KY\207\377\205LY\207\377\2KZ\206\377LZ\207\377\203MZ\210\377\6LY\210" \
+  "\377N[\210\377P]\214\377(0G\377\0\0\0\377bbb\377\213\377\377\377\377" \
+  "\7\350\350\350\377\0\0\0\377\1\1\2\377S`\217\377Q^\212\377P]\212\377" \
+  "Q^\211\377\206Q^\212\377\1Ta\217\377\202\0\0\0\377\214\377\377\377\377" \
+  "\7JJJ\377\0\0\0\3773;Y\377Sa\222\377\24\27#\377\0\0\0\377\253\253\253" \
+  "\377\211\377\377\377\377\3\364\364\364\377\377\377\377\377\376\376\376" \
+  "\377\215\377\377\377\377\15\376\376\376\377\377\377\377\377\277\277\277" \
+  "\377\0\0\0\377\0\0\1\377:Ek\377@N\177\377\26'c\377\30)d\377\26&\\\377" \
+  "\2\4\11\377\0\0\0\377aaa\377\202\377\377\377\377\1\376\376\376\377\226" \
+  "\377\377\377\377\12sss\377\0\0\0\377\1\2\5\377\26&[\377\30)e\377*9p\377" \
+  "09[\377\0\0\0\377;;;\377\370\370\370\377\210\377\377\377\377\4\361\361" \
+  "\361\377\312\312\312\377\377\377\377\377\376\376\376\377\215\377\377" \
+  "\377\377\14\376\376\376\377\377\377\377\377\230\230\230\377\0\0\0\377" \
+  "\10\11\20\377=M\201\377<J|\3775Bn\377\5\6\13\377\14\14\14\377\317\317" \
+  "\317\377\376\376\376\377\207\377\377\377\377\7\376\376\376\377\374\374" \
+  "\374\377\35\35\35\377\0\0\0\377\16\16\16\377\342\342\342\377\376\376" \
+  "\376\377\207\377\377\377\377\2\264\264\264\377\326\326\326\377\210\377" \
+  "\377\377\377\1\353\353\353\377\202\0\0\0\377\2,,,\377\362\362\362\377" \
+  "\210\377\377\377\377\11\376\376\376\377\332\332\332\377\0\0\0\377\0\1" \
+  "\4\377\27(a\377\31*e\377\12\21*\377\0\0\0\377xxx\377\211\377\377\377" \
+  "\377\3\323\323\323\377\377\377\377\377\376\376\376\377\206\377\377\377" \
+  "\377\7\376\376\376\377\377\377\377\377\36\36\36\377\0\0\0\377\0\1\3\377" \
+  "\0\0\0\377\227\227\227\377\224\377\377\377\377\3***\377\0\0\0\377\23" \
+  "!O\377\212\31*e\377\202\30)d\377\1'7n\377\203(8o\377\202'7o\377\2(7n" \
+  "\377\30)d\377\204\31*e\377\2\30)d\377%5m\377\202HV\205\377\1GV\205\377" \
+  "\203IV\205\377\3IW\205\377HW\204\377IW\205\377\202JW\206\377\1JV\206" \
+  "\377\203JX\206\377\6KX\206\377KX\205\377KX\206\377KW\207\377JY\207\377" \
+  "KY\207\377\203LY\207\377\3LX\207\377KY\206\377LZ\207\377\204MZ\210\377" \
+  "\6LY\210\377N[\210\377Q^\215\377\40%7\377\0\0\0\377\201\201\201\377\213" \
+  "\377\377\377\377\6\303\303\303\377\0\0\0\377\14\16\25\377Ub\222\377Q" \
+  "^\212\377Q^\211\377\202Q^\212\377\1Q^\213\377\202P^\213\377\202Q^\212" \
+  "\377\4Uc\221\377\10\11\15\377\0\0\0\377\337\337\337\377\213\377\377\377" \
+  "\377\7___\377\0\0\0\377+3L\377Sa\223\377\24\27#\377\0\0\0\377\253\253" \
+  "\253\377\233\377\377\377\377\14\373\373\373\377DDD\377\0\0\0\377\37%" \
+  ":\377DQ\201\377\25'b\377\31*f\377\14\25""3\377\0\0\0\377$$$\377\371\371" \
+  "\371\377\376\376\376\377\207\377\377\377\377\4\376\376\376\377\377\377" \
+  "\377\377\375\375\375\377\374\374\374\377\202\373\373\373\377\3\375\375" \
+  "\375\377\377\377\377\377\376\376\376\377\207\377\377\377\377\13\376\376" \
+  "\376\377\377\377\377\377===\377\0\0\0\377\5\11\26\377\27(c\377'7o\377" \
+  "09[\377\0\0\0\377;;;\377\370\370\370\377\207\377\377\377\377\1\376\376" \
+  "\376\377\202\377\377\377\377\1\376\376\376\377\217\377\377\377\377\5" \
+  "\376\376\376\377\353\353\353\377\21\21\21\377\0\0\1\3773\77j\377\202" \
+  "<J|\377\3\11\13\23\377\0\0\0\377\261\261\261\377\211\377\377\377\377" \
+  "\5\375\375\375\377GGG\377\0\0\0\377222\377\364\364\364\377\210\377\377" \
+  "\377\377\2ccc\377{{{\377\210\377\377\377\377\5\367\367\367\377///\377" \
+  "\0\0\0\377KKK\377\373\373\373\377\211\377\377\377\377\10\246\246\246" \
+  "\377\0\0\0\377\4\7\21\377\32,j\377\31*e\377\12\21*\377\0\0\0\377xxx\377" \
+  "\210\377\377\377\377\3\376\376\376\377\377\377\377\377\376\376\376\377" \
+  "\206\377\377\377\377\10\376\376\376\377\377\377\377\377\256\256\256\377" \
+  "\0\0\0\377\0\1\3\377\11\17$\377\0\0\0\377\227\227\227\377\224\377\377" \
+  "\377\377\3***\377\0\0\0\377\23!O\377\213\31*e\377\3\30)d\377'7n\377'" \
+  "7o\377\202(8o\377\4'7o\377'7n\377(7o\377\30)d\377\204\31*e\377\2\30)" \
+  "d\377'7o\377\202HV\205\377\1GV\205\377\203IV\205\377\203IW\205\377\202" \
+  "JW\206\377\1JV\206\377\203JX\206\377\6KX\206\377KX\205\377KX\206\377" \
+  "KW\207\377JY\207\377KY\207\377\203LY\207\377\3LX\207\377KZ\206\377LY" \
+  "\207\377\204MZ\210\377\6LY\210\377N[\210\377Q_\216\377\27\33)\377\0\0" \
+  "\0\377\234\234\234\377\213\377\377\377\377\6\234\234\234\377\0\0\0\377" \
+  "\30\34*\377Ub\220\377P]\212\377Q^\212\377\202Q^\213\377\1P^\213\377\202" \
+  "Q^\213\377\6P^\213\377Q^\213\377Tb\220\377\23\27!\377\0\0\0\377\265\265" \
+  "\265\377\213\377\377\377\377\7ttt\377\0\0\0\377#)>\377Tb\223\377\24\27" \
+  "#\377\0\0\0\377\253\253\253\377\213\377\377\377\377\202\376\376\376\377" \
+  "\217\377\377\377\377\6\301\301\301\377\0\0\0\377\5\6\12\377FT\201\377" \
+  "\25'c\377\26%[\377\202\0\0\0\377\1\320\320\320\377\210\377\377\377\377" \
+  "\13\376\376\376\377\377\377\377\377\345\345\345\377___\377)))\377\0\0" \
+  "\0\377\25\25\25\377DDD\377\274\274\274\377\377\377\377\377\376\376\376" \
+  "\377\207\377\377\377\377\12\376\376\376\377\324\324\324\377\12\12\12" \
+  "\377\0\0\2\377\23!Q\377$4l\37709[\377\0\0\0\377;;;\377\370\370\370\377" \
+  "\233\377\377\377\377\11\365\365\365\377777\377\0\0\0\377'1R\377<J|\377" \
+  "=L\200\377\25\33-\377\0\0\0\377xxx\377\211\377\377\377\377\4\376\376" \
+  "\376\377qqq\377\0\0\0\377```\377\210\377\377\377\377\3\372\372\372\377" \
+  "...\377(((\377\210\377\377\377\377\4\375\375\375\377ccc\377\0\0\0\377" \
+  "mmm\377\212\377\377\377\377\10]]]\377\0\0\0\377\14\24""0\377\31+h\377" \
+  "\31*e\377\12\21*\377\0\0\0\377xxx\377\216\377\377\377\377\3\376\376\376" \
+  "\377\377\377\377\377\376\376\376\377\202\377\377\377\377\6\33\33\33\377" \
+  "\0\0\0\377\17\31>\377\10\16#\377\0\0\0\377\227\227\227\377\224\377\377" \
+  "\377\377\3***\377\0\0\0\377\23!O\377\213\31*e\377\3\30)d\377'7n\377(" \
+  "8n\377\202(8o\377\203'7o\377\2\32+e\377\30)d\377\203\31*e\377\2\30)d" \
+  "\377*:q\377\202HV\205\377\1GV\205\377\203IV\205\377\202IW\205\377\203" \
+  "JW\206\377\1JV\206\377\203JX\206\377\6KX\206\377KX\205\377KX\206\377" \
+  "KW\207\377JY\207\377KY\207\377\203LY\207\377\3LX\207\377KZ\206\377LZ" \
+  "\207\377\204MZ\210\377\6LY\210\377N[\210\377R_\217\377\16\22\32\377\0" \
+  "\0\0\377\267\267\267\377\213\377\377\377\377\4ttt\377\0\0\0\377$*\77" \
+  "\377Ta\217\377\202Q^\212\377\13Q^\213\377P^\213\377Q^\213\377R]\213\377" \
+  "R^\213\377Q^\213\377Q^\212\377Sa\217\377\40$6\377\0\0\0\377\212\212\212" \
+  "\377\213\377\377\377\377\7\210\210\210\377\0\0\0\377\34\40""0\377Tb\224" \
+  "\377\24\27#\377\0\0\0\377\253\253\253\377\215\377\377\377\377\6\276\276" \
+  "\276\377ppp\377sss\377\312\312\312\377\377\377\377\377\376\376\376\377" \
+  "\212\377\377\377\377\7\26\26\26\377\0\0\0\3775Ac\377\31+i\377\12\21)" \
+  "\377\0\0\0\377]]]\377\212\377\377\377\377\2\321\321\321\377\15\15\15" \
+  "\377\206\0\0\0\377\3\262\262\262\377\377\377\377\377\376\376\376\377" \
+  "\206\377\377\377\377\12\376\376\376\377\377\377\377\377111\377\0\0\0" \
+  "\377\12\21)\377\"3m\37709[\377\0\0\0\377;;;\377\370\370\370\377\220\377" \
+  "\377\377\377\202\376\376\376\377\212\377\377\377\377\10YYY\377\0\0\0" \
+  "\377\35%=\377<J|\377=K~\377'0Q\377\0\0\0\377999\377\212\377\377\377\377" \
+  "\3\230\230\230\377\0\0\0\377\254\254\254\377\210\377\377\377\377\4\337" \
+  "\337\337\377\25\25\25\377\20\20\20\377\340\340\340\377\210\377\377\377" \
+  "\377\3\235\235\235\377\0\0\0\377\234\234\234\377\210\377\377\377\377" \
+  "\12\376\376\376\377\377\377\377\377\24\24\24\377\0\0\0\377\23\40P\377" \
+  "\31*f\377\31*e\377\12\21*\377\0\0\0\377xxx\377\214\377\377\377\377\1" \
+  "\376\376\376\377\205\377\377\377\377\7\261\261\261\377\0\0\0\377\2\3" \
+  "\7\377\30(a\377\10\15!\377\0\0\0\377\234\234\234\377\204\377\377\377" \
+  "\377\1\376\376\376\377\217\377\377\377\377\3+++\377\0\0\0\377\23!O\377" \
+  "\213\31*e\377\2\30)d\377&6m\377\203(8o\377\203'7o\377\2\34-f\377\30)" \
+  "d\377\203\31*e\377\2\30)d\377+:p\377\202HV\205\377\1GV\205\377\203IV" \
+  "\205\377\202IW\205\377\203JW\206\377\1JV\206\377\203JX\206\377\6KX\206" \
+  "\377KX\205\377KX\206\377KW\207\377JY\207\377KY\207\377\203LY\207\377" \
+  "\3LX\207\377KZ\206\377LZ\207\377\204MZ\210\377\6LY\210\377N[\210\377" \
+  "R`\220\377\6\10\14\377\0\0\0\377\321\321\321\377\213\377\377\377\377" \
+  "\4LLL\377\0\0\0\37708S\377S`\215\377\202Q^\212\377\202Q^\213\377\3R]" \
+  "\213\377Q^\213\377R]\213\377\202Q^\213\377\4S`\216\377'.C\377\0\0\0\377" \
+  "nnn\377\213\377\377\377\377\7\230\230\230\377\0\0\0\377\26\31&\377Tb" \
+  "\224\377\24\27#\377\0\0\0\377\253\253\253\377\213\377\377\377\377\2\357" \
+  "\357\357\377LLL\377\204\0\0\0\377\2ppp\377\367\367\367\377\212\377\377" \
+  "\377\377\10\226\226\226\377\0\0\0\377!';\377\31*f\377\1\3\10\377\4\4" \
+  "\4\377\321\321\321\377\376\376\376\377\207\377\377\377\377\14\376\376" \
+  "\376\377\372\372\372\377555\377\0\0\0\377\20\24\40\3778Dl\377ES\203\377" \
+  "\77Lx\377\33\40""3\377\0\0\0\377\10\10\10\377\357\357\357\377\211\377" \
+  "\377\377\377\10\245\245\245\377\0\0\0\377\0\1\3\377\"3n\37709[\377\0" \
+  "\0\0\377;;;\377\370\370\370\377\211\377\377\377\377\10\376\376\376\377" \
+  "\377\377\377\377\317\317\317\377MMM\377\13\13\13\377\2\2\2\377\77\77" \
+  "\77\377\320\320\320\377\213\377\377\377\377\3lll\377\0\0\0\377\31\40" \
+  "6\377\202<J|\377\1""8Eu\377\202\0\0\0\377\212\377\377\377\377\3\274\274" \
+  "\274\377\0\0\0\377\370\370\370\377\210\377\377\377\377\5\276\276\276" \
+  "\377\0\0\0\377\3\3\3\377\264\264\264\377\376\376\376\377\207\377\377" \
+  "\377\377\3\334\334\334\377\0\0\0\377\314\314\314\377\211\377\377\377" \
+  "\377\1\360\360\360\377\202\0\0\0\377\1\31+h\377\202\31*e\377\3\12\21" \
+  "*\377\0\0\0\377xxx\377\212\377\377\377\377\15\376\376\376\377\377\377" \
+  "\377\377\352\352\352\377YYY\377\10\10\10\377\0\0\0\377555\377\177\177" \
+  "\177\377===\377\0\0\0\377\12\20)\377\31*f\377\10\15!\377\205\0\0\0\377" \
+  "\1\273\273\273\377\211\377\377\377\377\2\365\365\365\377\40\40\40\377" \
+  "\207\0\0\0\377\1\23!O\377\213\31*e\377\2\30)d\377&6n\377\203(8o\377\203" \
+  "'7o\377\2\34-g\377\30)d\377\203\31*e\377\2\30)d\377(8o\377\202HV\205" \
+  "\377\1GV\205\377\203IV\205\377\202IW\205\377\203JW\206\377\1JV\206\377" \
+  "\203JX\206\377\6KX\206\377KX\205\377KX\206\377KW\207\377JY\207\377KY" \
+  "\207\377\203LY\207\377\3LX\207\377KZ\206\377LZ\207\377\204MZ\210\377" \
+  "\6LY\210\377N[\210\377R`\220\377\7\11\15\377\0\0\0\377\317\317\317\377" \
+  "\213\377\377\377\377\4TTT\377\0\0\0\377.6P\377S`\215\377\202Q^\212\377" \
+  "\203Q^\213\377\1R]\213\377\202Q^\213\377\5Q^\212\377Sa\217\377\36#3\377" \
+  "\0\0\0\377\214\214\214\377\213\377\377\377\377\7\204\204\204\377\0\0" \
+  "\0\377\34!2\377Tb\224\377\24\27#\377\0\0\0\377\253\253\253\377\211\377" \
+  "\377\377\377\3\376\376\376\377\377\377\377\377___\377\202\0\0\0\377\5" \
+  "$+B\377%,C\377\0\0\1\377\0\0\0\377kkk\377\212\377\377\377\377\10\347" \
+  "\347\347\377\0\0\0\377\13\15\24\377\24\"T\377\0\1\3\377\40\40\40\377" \
+  "\352\352\352\377\376\376\376\377\210\377\377\377\377\1\313\313\313\377" \
+  "\202\0\0\0\377\2!'>\377'/J\377\202&.I\377\4%,F\377\5\6\12\377\0\0\0\377" \
+  "\227\227\227\377\212\377\377\377\377\202\0\0\0\377\5\35*W\3770:\\\377" \
+  "\0\0\0\377;;;\377\370\370\370\377\212\377\377\377\377\2\302\302\302\377" \
+  "\10\10\10\377\204\0\0\0\377\3\36\36\36\377\353\353\353\377\376\376\376" \
+  "\377\211\377\377\377\377\11{{{\377\0\0\0\377\27\34""0\377;I{\377;J|\377" \
+  "\77M\202\377\5\7\14\377\0\0\0\377\313\313\313\377\211\377\377\377\377" \
+  "\4\335\335\335\377CCC\377\377\377\377\377\376\376\376\377\207\377\377" \
+  "\377\377\1sss\377\202\0\0\0\377\1{{{\377\211\377\377\377\377\2\23\23" \
+  "\23\377\374\374\374\377\211\377\377\377\377\11\245\245\245\377\0\0\0" \
+  "\377\5\11\26\377\31+g\377\30)d\377\31*e\377\12\21*\377\0\0\0\377xxx\377" \
+  "\213\377\377\377\377\2\352\352\352\377\36\36\36\377\207\0\0\0\377\3\23" \
+  "\40N\377\31*g\377\7\14\34\377\205\0\0\0\377\1\273\273\273\377\211\377" \
+  "\377\377\377\2\365\365\365\377\40\40\40\377\207\0\0\0\377\2\22\40M\377" \
+  "\31*f\377\212\31*e\377\3\30)d\377'7n\377(8n\377\202(8o\377\203'7o\377" \
+  "\2\35.f\377\30)d\377\203\31*e\377\2\30)d\377&5m\377\202HV\205\377\1G" \
+  "V\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\202JW\206\377" \
+  "\1JV\206\377\203JX\206\377\6KX\206\377KX\205\377KX\206\377KW\207\377" \
+  "JY\207\377KY\207\377\203LY\207\377\3LX\207\377KZ\206\377LY\207\377\204" \
+  "MZ\210\377\6LY\210\377N[\210\377R`\217\377\16\20\30\377\0\0\0\377\274" \
+  "\274\274\377\213\377\377\377\377\5zzz\377\0\0\0\377!':\377Ta\217\377" \
+  "P]\212\377\203Q^\212\377\203P^\213\377\202Q^\213\377\4Tb\220\377\23\27" \
+  "!\377\0\0\0\377\260\260\260\377\213\377\377\377\377\7iii\377\0\0\0\377" \
+  "&-D\377Sa\223\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377" \
+  "\377\1\341\341\341\377\202\0\0\0\377\10ANw\377M[\214\377LZ\211\3773<" \
+  "\\\377\1\1\2\377\32\32\32\377\345\345\345\377\376\376\376\377\207\377" \
+  "\377\377\377\7\376\376\376\377\364\364\364\377\26\27\27\377\0\0\0\377" \
+  "\20\33C\377\0\0\0\377\77\77\77\377\212\377\377\377\377\1}}}\377\211\0" \
+  "\0\0\377\2fff\377\376\376\376\377\211\377\377\377\377\7]]]\377\0\0\0" \
+  "\377\25\35""9\3771;^\377\0\0\0\377;;;\377\370\370\370\377\212\377\377" \
+  "\377\377\10DDD\377\0\0\0\377\21\25#\377;Hx\377=Jz\377\10\12\20\377\0" \
+  "\0\0\377\243\243\243\377\212\377\377\377\377\13\207\207\207\377\0\0\0" \
+  "\377\25\32+\377;Iz\377<J|\377>L\200\377\26\33/\377\0\0\0\377zzz\377\377" \
+  "\377\377\377\376\376\376\377\207\377\377\377\377\2\371\371\371\377\256" \
+  "\256\256\377\211\377\377\377\377\1\35\35\35\377\202\0\0\0\377\3""444" \
+  "\377\377\377\377\377\376\376\376\377\207\377\377\377\377\3\231\231\231" \
+  "\377\377\377\377\377\376\376\376\377\210\377\377\377\377\4\\\\\\\377" \
+  "\0\0\0\377\13\23.\377\31*f\377\202\31*e\377\3\12\21*\377\0\0\0\377xx" \
+  "x\377\213\377\377\377\377\14|||\377\0\0\0\377\3\5\15\377\30(a\377\31" \
+  "+f\377\20\34D\377\6\13\34\377\1\2\6\377\4\6\20\377\32,j\377\31*e\377" \
+  "\30)d\377\202\30)b\377\4\32+h\377\5\7\24\377\0\0\0\377\273\273\273\377" \
+  "\211\377\377\377\377\4\365\365\365\377!!!\377\0\0\1\377\22\37J\377\205" \
+  "\30)b\377\2\30*d\377\31)e\377\212\31*e\377\2\27)d\377'7n\377\203(8o\377" \
+  "\202'7o\377\2(7o\377\30)d\377\204\31*e\377\5\30)d\377#3l\377IW\205\377" \
+  "HV\205\377GV\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\202" \
+  "JW\206\377\1JV\206\377\203JX\206\377\6KX\206\377KX\205\377KX\206\377" \
+  "KW\207\377JY\207\377KY\207\377\203LY\207\377\2LX\207\377KY\206\377\202" \
+  "LZ\207\377\203MZ\210\377\6LY\210\377N[\210\377Q_\216\377\23\27#\377\0" \
+  "\0\0\377\253\253\253\377\213\377\377\377\377\21\240\240\240\377\0\0\0" \
+  "\377\25\32&\377Tb\221\377Q^\212\377Q^\211\377Q^\212\377Q^\213\377Q^\212" \
+  "\377Q^\213\377Q^\212\377Q^\213\377Q^\212\377Ub\221\377\11\13\20\377\0" \
+  "\0\0\377\324\324\324\377\213\377\377\377\377\7NNN\377\0\0\0\37708T\377" \
+  "Sa\222\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\13" \
+  "nnn\377\0\0\0\377\35\"4\377LZ\212\377JW\206\377JW\205\377IV\203\377\6" \
+  "\7\13\377\0\0\0\377\306\306\306\377\376\376\376\377\210\377\377\377\377" \
+  "\6\370\370\370\377:::\377\0\0\0\377\7\15\37\377\0\0\0\377ttt\377\212" \
+  "\377\377\377\377\2\213\213\213\377^^^\377\210aaa\377\2\214\214\214\377" \
+  "\374\374\374\377\211\377\377\377\377\7\206\206\206\377\0\0\0\377\22\30" \
+  "-\3771;_\377\0\0\0\377;;;\377\370\370\370\377\211\377\377\377\377\11" \
+  "\337\337\337\377\25\25\25\377\2\3\4\3772>f\377\77M\177\377AP\202\377" \
+  "\36%>\377\0\0\0\377ooo\377\212\377\377\377\377\13\210\210\210\377\0\0" \
+  "\0\377\24\32+\377;Iz\377<J|\377<J}\377(1S\377\0\0\0\377(((\377\377\377" \
+  "\377\377\376\376\376\377\206\377\377\377\377\3\376\376\376\377\377\377" \
+  "\377\377\374\374\374\377\210\377\377\377\377\3\343\343\343\377\0\0\0" \
+  "\377\2\2\4\377\202\0\0\0\377\1\367\367\367\377\210\377\377\377\377\1" \
+  "\375\375\375\377\212\377\377\377\377\3(((\377\0\0\0\377\21\34E\377\203" \
+  "\31*e\377\3\12\21*\377\0\0\0\377xxx\377\212\377\377\377\377\10\367\367" \
+  "\367\377///\377\0\0\0\377\15\26""4\377\31*f\377\31*e\377\31*f\377\31" \
+  "+g\377\202\25$W\377\2\31*e\377\30)d\377\203\31*e\377\4\32,k\377\4\10" \
+  "\24\377\0\0\0\377\273\273\273\377\211\377\377\377\377\4\365\365\365\377" \
+  "!!!\377\0\0\1\377\23\37L\377\206\31*e\377\1\30)d\377\211\31*e\377\3\30" \
+  ")e\377\30)d\377'7n\377\203(8o\377\4'7o\377'7n\377(7o\377\30)d\377\204" \
+  "\31*e\377\5\30)d\377\40""1j\377IW\205\377HV\205\377GV\205\377\203IV\205" \
+  "\377\3IW\205\377HW\204\377IW\205\377\202JW\206\377\1JV\206\377\203JX" \
+  "\206\377\6KX\206\377KX\205\377KX\206\377KW\207\377JY\207\377KY\207\377" \
+  "\205LY\207\377\2KZ\206\377LZ\207\377\203MZ\210\377\6LY\210\377MZ\210" \
+  "\377Q^\215\377\35!2\377\0\0\0\377\210\210\210\377\213\377\377\377\377" \
+  "\6\307\307\307\377\0\0\0\377\11\13\21\377Uc\222\377Q^\211\377P]\212\377" \
+  "\206Q^\212\377\2Q^\211\377Vc\222\377\202\0\0\0\377\1\367\367\367\377" \
+  "\213\377\377\377\377\7""444\377\0\0\0\3779Ce\377S`\221\377\24\27#\377" \
+  "\0\0\0\377\253\253\253\377\212\377\377\377\377\12GGG\377\0\0\0\377,5" \
+  "O\377KX\207\377KX\206\377KX\205\377N\\\214\377\16\21\31\377\0\0\0\377" \
+  "\254\254\254\377\211\377\377\377\377\2\372\372\372\377III\377\203\0\0" \
+  "\0\377\1\217\217\217\377\211\377\377\377\377\1\376\376\376\377\225\377" \
+  "\377\377\377\7\241\241\241\377\0\0\0\377\15\21\37\3771;_\377\0\0\0\377" \
+  ";;;\377\370\370\370\377\211\377\377\377\377\11\322\322\322\377\10\10" \
+  "\10\377\4\6\12\377:Hv\377\77M~\377@N\200\377&0P\377\0\0\0\377NNN\377" \
+  "\212\377\377\377\377\12\210\210\210\377\0\0\0\377\24\32+\377;Iz\377<" \
+  "J|\377;I{\3773\77j\377\0\0\1\377\13\13\13\377\362\362\362\377\222\377" \
+  "\377\377\377\10\203\203\203\377\0\0\0\377\22\26'\377\16\21\36\377\0\0" \
+  "\0\377\237\237\237\377\377\377\377\377\376\376\376\377\220\377\377\377" \
+  "\377\4\343\343\343\377\27\27\27\377\1\1\4\377\24!Q\377\203\31*e\377\3" \
+  "\12\21*\377\0\0\0\377xxx\377\212\377\377\377\377\1\360\360\360\377\202" \
+  "\0\0\0\377\1\25\"T\377\213\31*e\377\4\32,j\377\4\10\24\377\0\0\0\377" \
+  "\273\273\273\377\211\377\377\377\377\4\365\365\365\377!!!\377\0\0\1\377" \
+  "\23\37L\377\220\31*e\377\202\30)d\377\1'7n\377\203(8o\377\202'7o\377" \
+  "\2(7o\377\30)d\377\204\31*e\377\5\30)d\377\36/h\377IW\205\377HV\205\377" \
+  "GV\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\204JW\206\377" \
+  "\203JX\206\377\5KX\205\377KX\206\377KW\207\377JY\207\377KY\207\377\205" \
+  "LY\207\377\2KZ\206\377LZ\207\377\205MZ\210\377\4P]\213\377/7S\377\0\0" \
+  "\0\377MMM\377\213\377\377\377\377\1\352\352\352\377\202\0\0\0\377\2O" \
+  "\\\210\377P]\212\377\202Q^\212\377\205Q^\211\377\2Q^\212\377JV\177\377" \
+  "\202\0\0\0\377\2\377\377\377\377\376\376\376\377\212\377\377\377\377" \
+  "\7\31\31\31\377\0\0\0\377COv\377R`\221\377\24\27#\377\0\0\0\377\253\253" \
+  "\253\377\212\377\377\377\377\12***\377\0\0\0\3773=]\377KW\207\377KX\206" \
+  "\377KX\205\377M[\212\377\32\37""0\377\0\0\0\377\211\211\211\377\211\377" \
+  "\377\377\377\2\374\374\374\377UUU\377\203\0\0\0\377\1\252\252\252\377" \
+  "\237\377\377\377\377\7\274\274\274\377\0\0\0\377\10\13\22\3771;`\377" \
+  "\0\0\0\377;;;\377\370\370\370\377\210\377\377\377\377\12\376\376\376" \
+  "\377\311\311\311\377\0\0\0\377\5\7\14\377>L~\377\77M~\377@N\200\377'" \
+  "2U\377\0\0\0\377DDD\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377" \
+  "\24\32+\377;Iz\377\202<J|\377\4""6Cq\377\7\10\16\377\6\6\6\377\307\307" \
+  "\307\377\222\377\377\377\377\10***\377\0\0\0\377#,L\377!+J\377\0\0\0" \
+  "\377666\377\377\377\377\377\376\376\376\377\217\377\377\377\377\5\376" \
+  "\376\376\377\310\310\310\377\7\7\7\377\2\4\12\377\26&\\\377\203\31*e" \
+  "\377\3\12\21*\377\0\0\0\377xxx\377\212\377\377\377\377\4\311\311\311" \
+  "\377\0\0\0\377\1\3\7\377\32,j\377\213\31*e\377\4\32,j\377\4\10\24\377" \
+  "\0\0\0\377\273\273\273\377\211\377\377\377\377\4\365\365\365\377!!!\377" \
+  "\0\0\1\377\23\37L\377\220\31*e\377\3\30)d\377\30*d\377'7n\377\203(8o" \
+  "\377\202'7o\377\2(7o\377\30)d\377\204\31*e\377\5\30)d\377\30)e\377IW" \
+  "\206\377GU\204\377GV\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205" \
+  "\377\204JW\206\377\3JX\206\377IX\206\377JX\206\377\202KX\205\377\4KW" \
+  "\206\377JY\207\377KX\207\377KY\207\377\204LY\207\377\2KZ\206\377LZ\207" \
+  "\377\205MZ\210\377\6N\\\211\377BMt\377\0\0\0\377\23\23\23\377\377\377" \
+  "\377\377\376\376\376\377\210\377\377\377\377\23\376\376\376\377\365\365" \
+  "\365\377\37\37\37\377\0\0\0\377-5O\377P]\213\377O\\\212\377P]\212\377" \
+  "Q^\212\377P]\212\377Q^\212\377P]\212\377Q^\212\377S`\216\377!&9\377\0" \
+  "\0\0\377===\377\377\377\377\377\376\376\376\377\210\377\377\377\377\2" \
+  "\376\376\376\377\377\377\377\377\202\0\0\0\377\5LY\207\377R_\220\377" \
+  "\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\12&&&\377\0" \
+  "\0\0\3775@a\377JW\207\377KX\206\377KX\205\377M[\212\377\33\37""1\377" \
+  "\0\0\0\377\210\210\210\377\211\377\377\377\377\2\375\375\375\377^^^\377" \
+  "\203\0\0\0\377\1\260\260\260\377\237\377\377\377\377\7\311\311\311\377" \
+  "\0\0\0\377\6\10\15\377.8[\377\0\0\0\377;;;\377\370\370\370\377\211\377" \
+  "\377\377\377\11\274\274\274\377\0\0\0\377\6\11\16\377BP\204\377\77M~" \
+  "\377@N\200\377&0T\377\0\0\0\377DDD\377\212\377\377\377\377\4\210\210" \
+  "\210\377\0\0\0\377\24\32+\377;Iz\377\202<J|\377\4:Hy\377\15\21\34\377" \
+  "\1\1\1\377\235\235\235\377\221\377\377\377\377\10\342\342\342\377\20" \
+  "\20\20\377\1\2\3\377.9c\3771>l\377\0\0\0\377\3\3\3\377\362\362\362\377" \
+  "\221\377\377\377\377\4\245\245\245\377\0\0\0\377\3\7\21\377\31*g\377" \
+  "\203\31*e\377\3\12\21*\377\0\0\0\377xxx\377\212\377\377\377\377\5\254" \
+  "\254\254\377\0\0\0\377\5\11\26\377\32,j\377\30)d\377\212\31*e\377\4\32" \
+  ",j\377\4\10\24\377\0\0\0\377\273\273\273\377\211\377\377\377\377\4\365" \
+  "\365\365\377!!!\377\0\0\1\377\23\37L\377\220\31*e\377\3\30)d\377\31*" \
+  "d\377'7n\377\203(8o\377\202'7o\377\2(7o\377\30)d\377\205\31*e\377\5\25" \
+  "&b\377DR\202\377HV\205\377GV\205\377HV\205\377\202IV\205\377\3IW\205" \
+  "\377HW\204\377IW\205\377\204JW\206\377\10JX\206\377IX\206\377JX\206\377" \
+  "KX\206\377KX\205\377KX\206\377KX\207\377JY\207\377\205LY\207\377\2KY" \
+  "\206\377LZ\207\377\205MZ\210\377\2MZ\207\377O\\\211\377\202\0\0\0\377" \
+  "\1\353\353\353\377\212\377\377\377\377\7\375\375\375\377fff\377\0\0\0" \
+  "\377\20\22\34\377O\\\211\377P]\212\377O\\\211\377\203P]\212\377\6P]\211" \
+  "\377P]\212\377LX\203\377\7\10\14\377\0\0\0\377\227\227\227\377\213\377" \
+  "\377\377\377\10\317\317\317\377\0\0\0\377\4\4\6\377R`\221\377R_\217\377" \
+  "\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\12""888\377" \
+  "\0\0\0\377/8V\377KX\207\377KX\206\377KX\205\377N[\214\377\20\22\35\377" \
+  "\0\0\0\377\250\250\250\377\211\377\377\377\377\2\373\373\373\377SSS\377" \
+  "\203\0\0\0\377\1\213\213\213\377\211\377\377\377\377\1\376\376\376\377" \
+  "\225\377\377\377\377\7\323\323\323\377\7\7\7\377\5\7\13\377+4T\377\0" \
+  "\0\0\377;;;\377\370\370\370\377\211\377\377\377\377\11\265\265\265\377" \
+  "\0\0\0\377\11\12\21\377AP\205\377\77M~\377@N\200\377$/S\377\0\0\0\377" \
+  "DDD\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24\32+\377;I" \
+  "z\377\202<J|\377\5=K~\377\26\34/\377\0\0\0\377ooo\377\376\376\376\377" \
+  "\217\377\377\377\377\11\376\376\376\377\267\267\267\377\4\4\4\377\7\11" \
+  "\20\3773@p\3774Br\377\11\13\23\377\1\1\1\377\264\264\264\377\221\377" \
+  "\377\377\377\4hhh\377\0\0\0\377\12\21*\377\31+g\377\203\31*e\377\3\12" \
+  "\21*\377\0\0\0\377xxx\377\212\377\377\377\377\4\223\223\223\377\0\0\0" \
+  "\377\10\15!\377\32+i\377\213\31*e\377\4\32,j\377\4\10\24\377\0\0\0\377" \
+  "\273\273\273\377\211\377\377\377\377\4\365\365\365\377!!!\377\0\0\1\377" \
+  "\23\37L\377\220\31*e\377\3\30)d\377\31*e\377'7n\377\203(8o\377\202'7" \
+  "o\377\2(7o\377\30)d\377\205\31*e\377\2\26'c\377:H{\377\203HV\205\377" \
+  "\203IV\205\377\1HW\204\377\202IW\205\377\203JW\206\377\10JX\206\377I" \
+  "X\206\377JX\206\377KX\206\377KX\205\377KX\206\377KX\207\377JY\207\377" \
+  "\204LY\207\377\3LX\207\377LY\207\377KZ\206\377\204MZ\210\377\6LY\210" \
+  "\377MZ\207\377N[\211\377\25\30%\377\0\0\0\377\210\210\210\377\213\377" \
+  "\377\377\377\1\334\334\334\377\202\0\0\0\377\1\26\32&\377\202Q^\214\377" \
+  "\3P]\212\377O\\\211\377P]\212\377\202Q^\214\377\5\25\30%\377\0\0\0\377" \
+  "\24\24\24\377\347\347\347\377\376\376\376\377\210\377\377\377\377\12" \
+  "\376\376\376\377\377\377\377\377jjj\377\0\0\0\377\37$6\377P]\215\377" \
+  "Q_\217\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\4" \
+  "^^^\377\0\0\0\377#*A\377KX\210\377\202KX\205\377\4LZ\211\377\10\11\16" \
+  "\377\0\0\0\377\302\302\302\377\211\377\377\377\377\6\372\372\372\377" \
+  "GGG\377\0\0\0\377\4\6\20\377\0\0\0\377fff\377\212\377\377\377\377\225" \
+  "\350\350\350\377\7\300\300\300\377\10\10\10\377\5\6\13\377*3R\377\0\0" \
+  "\0\377;;;\377\370\370\370\377\211\377\377\377\377\11\266\266\266\377" \
+  "\0\0\0\377\10\12\20\377AP\205\377\77M~\377@O\200\377\",R\377\0\0\0\377" \
+  "DDD\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24\32+\377;I" \
+  "z\377\202<J|\377\5<J}\377%.M\377\0\0\0\377===\377\374\374\374\377\220" \
+  "\377\377\377\377\10\177\177\177\377\0\0\0\377\17\22\40\3779G{\3776Ex" \
+  "\377\22\27(\377\0\0\0\377vvv\377\217\377\377\377\377\6\376\376\376\377" \
+  "\377\377\377\377***\377\0\0\0\377\21\36H\377\31*f\377\203\31*e\377\3" \
+  "\12\21*\377\0\0\0\377xxx\377\212\377\377\377\377\4xxx\377\0\0\0\377\13" \
+  "\22-\377\31+h\377\213\31*e\377\4\32,j\377\4\10\24\377\0\0\0\377\273\273" \
+  "\273\377\211\377\377\377\377\4\365\365\365\377!!!\377\0\0\1\377\23\37" \
+  "L\377\220\31*e\377\3\30)d\377\31*e\377'7n\377\203(8o\377\202'7o\377\2" \
+  "(7o\377\30)d\377\205\31*e\377\3\27(c\3770\77t\377IW\206\377\202HV\205" \
+  "\377\5IV\205\377IU\205\377IV\205\377IW\205\377HW\204\377\205JW\206\377" \
+  "\11IX\206\377JX\206\377KX\206\377KX\205\377KX\206\377KX\207\377JY\207" \
+  "\377LY\207\377KY\207\377\202LY\207\377\5LX\207\377LY\207\377KZ\206\377" \
+  "MZ\210\377LZ\207\377\202MZ\210\377\6LY\210\377MZ\210\377N[\210\377,4" \
+  "M\377\0\0\0\377666\377\202\376\376\376\377\210\377\377\377\377\17\376" \
+  "\376\376\377\377\377\377\377\226\226\226\377\1\1\1\377\0\0\0\377\10\12" \
+  "\17\377/6P\377=Hj\377ALq\377<Fh\377.5O\377\5\6\11\377\0\0\0\377\4\4\4" \
+  "\377\240\240\240\377\214\377\377\377\377\10\25\25\25\377\0\0\0\3779C" \
+  "d\377N[\211\377Q_\216\377\24\27#\377\0\0\0\377\253\253\253\377\212\377" \
+  "\377\377\377\12\263\263\263\377\0\0\0\377\3\4\6\377GS\200\377LZ\211\377" \
+  "LY\210\377=Hn\377\3\4\6\377\15\15\15\377\330\330\330\377\211\377\377" \
+  "\377\377\6\370\370\370\377999\377\0\0\0\377\12\22*\377\0\0\0\377CCC\377" \
+  "\212\377\377\377\377\1AAA\377\226\0\0\0\377\5\5\6\12\377*3R\377\0\0\0" \
+  "\377;;;\377\370\370\370\377\211\377\377\377\377\11\266\266\266\377\0" \
+  "\0\0\377\10\12\20\377AP\205\377\77M~\377@O\200\377\40+P\377\0\0\0\377" \
+  "DDD\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24\32+\377;I" \
+  "z\377\203<J|\377\5""4@l\377\0\0\0\377\13\13\13\377\374\374\374\377\376" \
+  "\376\376\377\215\377\377\377\377\13\376\376\376\377\377\377\377\3779" \
+  "99\377\0\0\0\377\37(F\3779G{\3777Fy\377\40(F\377\0\0\0\377AAA\377\371" \
+  "\371\371\377\220\377\377\377\377\202\0\0\0\377\1\30)c\377\204\31*e\377" \
+  "\3\12\21*\377\0\0\0\377xxx\377\212\377\377\377\377\4^^^\377\0\0\0\377" \
+  "\16\27""7\377\31+h\377\213\31*e\377\4\32,j\377\5\10\24\377\0\0\0\377" \
+  "\273\273\273\377\211\377\377\377\377\11\365\365\365\377!!!\377\0\0\1" \
+  "\377\22\37L\377\31*e\377\31*f\377\31+g\377\27'_\377\27']\377\213\31*" \
+  "e\377\3\30)d\377\32+f\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(7" \
+  "o\377\30)d\377\205\31*e\377\12\30)d\377%6m\377JX\206\377HU\204\377HV" \
+  "\205\377IV\205\377IU\205\377IV\205\377IW\205\377HW\204\377\203JW\206" \
+  "\377\4JV\206\377JW\206\377JX\206\377IX\206\377\202KX\206\377\4KX\205" \
+  "\377KX\207\377JX\207\377KY\207\377\203LY\207\377\4LX\207\377LY\207\377" \
+  "KY\206\377LZ\207\377\204MZ\210\377\7LY\210\377MZ\207\377=Hl\377\2\3\4" \
+  "\377\13\13\13\377\331\331\331\377\376\376\376\377\211\377\377\377\377" \
+  "\4\376\376\376\377\377\377\377\377\265\265\265\377\14\14\14\377\203\0" \
+  "\0\0\377\1\2\2\3\377\203\0\0\0\377\4\27\27\27\377\303\303\303\377\377" \
+  "\377\377\377\376\376\376\377\212\377\377\377\377\11\267\267\267\377\3" \
+  "\3\3\377\7\10\15\377FR|\377MZ\210\377Q_\216\377\24\27#\377\0\0\0\377" \
+  "\253\253\253\377\213\377\377\377\377\10AAA\377\0\0\0\377\13\14\23\377" \
+  "*2L\377/7U\377\16\21\32\377\0\0\0\377BBB\377\211\377\377\377\377\10\376" \
+  "\376\376\377\364\364\364\377\30\30\30\377\0\0\0\377\20\33@\377\0\1\3" \
+  "\377000\377\372\372\372\377\211\377\377\377\377\1\240\240\240\377\202" \
+  "\0\0\0\377\1\5\6\11\377\203\4\4\7\377\2\4\5\7\377\3\4\7\377\215\0\0\0" \
+  "\377\6\0\1\4\377\16\20\32\377,5V\377\0\0\0\377;;;\377\370\370\370\377" \
+  "\211\377\377\377\377\11\266\266\266\377\0\0\0\377\10\12\20\377AP\205" \
+  "\377\77M~\377AO\200\377\37*O\377\0\0\0\377DDD\377\212\377\377\377\377" \
+  "\4\210\210\210\377\0\0\0\377\24\32+\377;Iz\377\202<J|\377\5;J|\377>M" \
+  "\202\377\2\2\4\377\0\0\0\377\330\330\330\377\217\377\377\377\377\1\374" \
+  "\374\374\377\202\0\0\0\377\10""3Aq\3778Fy\3777Fy\377/<h\377\0\0\0\377" \
+  "\13\13\13\377\365\365\365\377\376\376\376\377\216\377\377\377\377\5\271" \
+  "\271\271\377\0\0\0\377\3\6\16\377\32,j\377\30)d\377\203\31*e\377\3\12" \
+  "\21*\377\0\0\0\377xxx\377\212\377\377\377\377\4DDD\377\0\0\0\377\21\33" \
+  "C\377\31*g\377\213\31*e\377\4\32,j\377\6\12\31\377\0\0\0\377\256\256" \
+  "\256\377\212\377\377\377\377\11%%%\377\0\0\0\377\23!O\377\27'^\377\20" \
+  "\34D\377\10\17#\377\2\5\14\377\14\24""1\377\31+h\377\212\31*e\377\3\30" \
+  ")d\377\32+f\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(7o\377\30)d" \
+  "\377\205\31*e\377\3\30)d\377\35,g\377JW\206\377\203HV\205\377\10IU\205" \
+  "\377IV\205\377IW\205\377HW\204\377JW\206\377IW\205\377JW\206\377JV\206" \
+  "\377\202JW\206\377\7IX\206\377KX\206\377JX\206\377KX\205\377KW\207\377" \
+  "KX\206\377KX\207\377\204LY\207\377\1LX\207\377\202LY\207\377\1LZ\207" \
+  "\377\203MZ\210\377\10LY\210\377MZ\210\377P]\213\377\17\22\32\377\0\0" \
+  "\0\377nnn\377\377\377\377\377\376\376\376\377\214\377\377\377\377\7\213" \
+  "\213\213\377+++\377\27\27\27\377\25\25\25\377\30\30\30\377222\377\225" \
+  "\225\225\377\202\377\377\377\377\1\376\376\376\377\211\377\377\377\377" \
+  "\202\376\376\376\377\11]]]\377\0\0\0\377\32\36.\377N[\212\377N[\207\377" \
+  "Q_\216\377\24\27#\377\0\0\0\377\253\253\253\377\213\377\377\377\377\2" \
+  "\343\343\343\377$$$\377\204\0\0\0\377\2\22\22\22\377\334\334\334\377" \
+  "\212\377\377\377\377\7\347\347\347\377\0\0\0\377\0\0\1\377\26&\\\377" \
+  "\1\2\6\377\14\14\14\377\324\324\324\377\211\377\377\377\377\17\361\361" \
+  "\361\377\12\12\12\377\0\0\0\377+4S\377FT\206\377HW\210\377FT\205\377" \
+  "AN{\377\20\24\37\377\0\0\0\377\11\11\11\377\15\15\15\377\11\11\11\377" \
+  "\5\5\5\377\1\1\1\377\210\0\0\0\377\5\1\1\3\377\25\30)\377\0\0\0\377;" \
+  ";;\377\370\370\370\377\211\377\377\377\377\11\266\266\266\377\0\0\0\377" \
+  "\10\12\20\377AP\205\377\77M~\377AO\201\377\34(N\377\0\0\0\377DDD\377" \
+  "\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24\32+\377;Iz\377\202" \
+  "<J|\377\5;J|\377=M\201\377\23\30(\377\0\0\0\377\210\210\210\377\217\377" \
+  "\377\377\377\12\247\247\247\377\0\0\0\377\2\5\15\377;J\201\3778Ex\377" \
+  "6Fx\377:J\201\377\3\5\11\377\0\0\0\377\301\301\301\377\215\377\377\377" \
+  "\377\6\376\376\376\377\377\377\377\377iii\377\0\0\0\377\12\22+\377\31" \
+  "+g\377\204\31*e\377\3\13\23+\377\0\0\0\377xxx\377\212\377\377\377\377" \
+  "\4<<<\377\0\0\0\377\21\35F\377\31*g\377\213\31*e\377\4\32+i\377\10\15" \
+  "!\377\0\0\0\377\230\230\230\377\212\377\377\377\377\3AAA\377\0\0\0\377" \
+  "\0\0\1\377\204\0\0\0\377\2\10\15!\377\32+i\377\212\31*e\377\3\30)d\377" \
+  "\33,f\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377(7o\377\30)d\377\206" \
+  "\31*e\377\12\32+f\377BP\201\377HV\205\377GV\205\377HV\205\377IV\205\377" \
+  "IU\205\377IW\205\377HW\204\377IW\205\377\202JW\206\377\11JV\206\377J" \
+  "W\206\377JX\206\377IX\206\377JX\206\377KX\206\377KX\205\377KW\206\377" \
+  "KX\207\377\202KY\207\377\203LY\207\377\4LX\207\377LY\207\377KZ\206\377" \
+  "LZ\207\377\204MZ\210\377\3LY\210\377O\\\211\377@Kp\377\202\0\0\0\377" \
+  "\1\303\303\303\377\213\377\377\377\377\1\376\376\376\377\203\377\377" \
+  "\377\377\3\374\374\374\377\363\363\363\377\375\375\375\377\203\377\377" \
+  "\377\377\1\376\376\376\377\211\377\377\377\377\3\376\376\376\377\377" \
+  "\377\377\377\313\313\313\377\202\0\0\0\377\7\77Jo\377N[\211\377MZ\210" \
+  "\377R_\216\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377" \
+  "\12\376\376\376\377\377\377\377\377\353\353\353\377\221\221\221\377Z" \
+  "ZZ\377NNN\377\210\210\210\377\354\354\354\377\377\377\377\377\376\376" \
+  "\376\377\207\377\377\377\377\13\376\376\376\377\377\377\377\377\232\232" \
+  "\232\377\0\0\0\377\10\15\"\377\32,k\377\5\11\26\377\0\0\0\377\177\177" \
+  "\177\377\377\377\377\377\376\376\376\377\206\377\377\377\377\202\376" \
+  "\376\376\377\1\205\205\205\377\202\0\0\0\377\30\21\24\40\377\30\35.\377" \
+  "\22\26#\377\7\10\15\377\0\0\0\377\25\25\25\377\311\311\311\377\330\330" \
+  "\330\377\311\311\311\377\273\273\273\377\254\254\254\377\234\234\234" \
+  "\377\207\207\207\377ooo\377XXX\377AAA\377...\377\7\7\7\377\0\0\0\377" \
+  "\6\10\14\377+3S\377\0\0\0\377;;;\377\370\370\370\377\211\377\377\377" \
+  "\377\11\266\266\266\377\0\0\0\377\10\12\20\377AP\205\377>L}\377AO\201" \
+  "\377\30$K\377\0\0\0\377DDD\377\212\377\377\377\377\4\210\210\210\377" \
+  "\0\0\0\377\24\31+\377;Iz\377\202<J|\377\7;J|\377<K~\377&/P\377\0\0\0" \
+  "\377444\377\377\377\377\377\376\376\376\377\213\377\377\377\377\16\376" \
+  "\376\376\377\377\377\377\377>>>\377\0\0\0\377\17\30""7\377:H}\3778Fx" \
+  "\3776Ex\3779H}\377\31!9\377\0\0\0\377[[[\377\377\377\377\377\376\376" \
+  "\376\377\215\377\377\377\377\3\36\36\36\377\0\0\0\377\22\36H\377\205" \
+  "\31*e\377\3\15\24,\377\0\0\0\377xxx\377\212\377\377\377\377\4<<<\377" \
+  "\0\0\0\377\21\35F\377\31*g\377\213\31*e\377\4\31+i\377\12\21)\377\0\0" \
+  "\0\377\203\203\203\377\212\377\377\377\377\1\265\265\265\377\202\0\0" \
+  "\0\377\6\13\13\13\377AAA\377XXX\377\0\0\0\377\4\7\22\377\32,j\377\212" \
+  "\31*e\377\3\30)d\377\33,f\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377" \
+  "(7o\377\30)d\377\207\31*e\377\3""9Hz\377HV\205\377GV\205\377\202HV\205" \
+  "\377\22IU\205\377IW\205\377IV\205\377IW\205\377JW\206\377IW\205\377J" \
+  "W\206\377JV\206\377JX\206\377JW\206\377JX\206\377KX\206\377JX\206\377" \
+  "KX\206\377KW\207\377JY\207\377KX\207\377KY\207\377\203LY\207\377\3LX" \
+  "\207\377KZ\206\377LZ\207\377\205MZ\210\377\10MZ\207\377P]\213\377\33" \
+  "!0\377\0\0\0\377\17\17\17\377\344\344\344\377\377\377\377\377\376\376" \
+  "\376\377\236\377\377\377\377\12\16\16\16\377\0\0\0\377\40%9\377Q^\216" \
+  "\377MZ\207\377N[\210\377Q^\216\377\24\27#\377\0\0\0\377\253\253\253\377" \
+  "\214\377\377\377\377\1\376\376\376\377\220\377\377\377\377\7\25\25\25" \
+  "\377\0\0\0\377\21\35H\377\31+h\377\23\37M\377\0\0\0\377\2\2\2\377\211" \
+  "\377\377\377\377\5\376\376\376\377\377\377\377\377\237\237\237\377\0" \
+  "\0\0\377\1\1\1\377\202\0\0\0\377\5\1\1\1\377\40\40\40\377\367\367\367" \
+  "\377\377\377\377\377\376\376\376\377\202\377\377\377\377\1\376\376\376" \
+  "\377\205\377\377\377\377\1\332\332\332\377\202\0\0\0\377\5.7Y\377/9\\" \
+  "\377\0\0\0\377;;;\377\370\370\370\377\211\377\377\377\377\11\266\266" \
+  "\266\377\0\0\0\377\10\12\20\377AP\205\377\77M}\377AO\201\377\24\37H\377" \
+  "\0\0\0\377DDD\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24" \
+  "\31+\377;Iz\377\202<J|\377\202;J|\377\1""6Dr\377\202\0\0\0\377\216\377" \
+  "\377\377\377\11\367\367\367\377\3\3\3\377\0\0\0\377\36,]\3779Gz\3778" \
+  "Fx\3776Fy\3777Fy\3770=i\377\202\0\0\0\377\216\377\377\377\377\5\352\352" \
+  "\352\377\12\12\12\377\0\1\2\377\25$W\377\30)d\377\204\31*e\377\3\16\25" \
+  "-\377\0\0\0\377xxx\377\212\377\377\377\377\4<<<\377\0\0\0\377\21\35F" \
+  "\377\31*g\377\213\31*e\377\4\31+h\377\13\24""1\377\0\0\0\377mmm\377\211" \
+  "\377\377\377\377\1\376\376\376\377\202\377\377\377\377\1\362\362\362" \
+  "\377\202\377\377\377\377\5\351\351\351\377\0\0\0\377\1\1\4\377\32,k\377" \
+  "\30)e\377\211\31*e\377\3\30)d\377\34,f\377'7n\377\202(8o\377\5'7o\377" \
+  "&6o\377'7o\377(7o\377\30)d\377\206\31*e\377\10\30)d\3770\77t\377GU\204" \
+  "\377GV\205\377HV\205\377IV\205\377IU\205\377IV\205\377\203IW\205\377" \
+  "\202JW\206\377\2JV\206\377JW\206\377\203JX\206\377\202KX\206\377\3KW" \
+  "\206\377JX\207\377KY\207\377\206LY\207\377\3KZ\206\377MZ\210\377LZ\207" \
+  "\377\203MZ\210\377\7LY\210\377MZ\207\377GS|\377\7\10\14\377\0\0\0\377" \
+  "FFF\377\377\377\377\377\202\376\376\376\377\232\377\377\377\377\7\376" \
+  "\376\376\377\377\377\377\377WWW\377\0\0\0\377\11\13\20\377LX\205\377" \
+  "MZ\207\377\202MZ\210\377\4Q^\216\377\24\27#\377\0\0\0\377\253\253\253" \
+  "\377\234\377\377\377\377\13\263\263\263\377\0\0\0\377\2\4\11\377\30)" \
+  "c\377\30)d\377\32,j\377\4\7\20\377\0\0\0\377ttt\377\377\377\377\377\376" \
+  "\376\376\377\207\377\377\377\377\7\376\376\376\377\377\377\377\377\340" \
+  "\340\340\377\245\245\245\377}}}\377\205\205\205\377\263\263\263\377\202" \
+  "\377\377\377\377\1\376\376\376\377\207\377\377\377\377\12\376\376\376" \
+  "\377\353\353\353\377\31\31\31\377\0\0\0\377\25\33.\377ET\206\377.8Z\377" \
+  "\0\0\0\377;;;\377\370\370\370\377\211\377\377\377\377\11\266\266\266" \
+  "\377\0\0\0\377\10\12\20\377AP\205\377\77M}\377=L~\377\22\37G\377\0\0" \
+  "\0\377DDD\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24\31+" \
+  "\377;Iz\377\202<J|\377\6;J|\377:I{\3778Gw\377\6\10\15\377\0\0\0\377\311" \
+  "\311\311\377\215\377\377\377\377\7\272\272\272\377\1\1\1\377\2\4\14\377" \
+  "\"2f\3779Gz\3777Fx\3776Fy\377\2026Ex\377\3\5\7\14\377\0\0\0\377\305\305" \
+  "\305\377\215\377\377\377\377\4\300\300\300\377\5\5\5\377\3\5\15\377\27" \
+  "&]\377\204\31*e\377\4\30*e\377\20\26.\377\0\0\0\377xxx\377\212\377\377" \
+  "\377\377\4<<<\377\0\0\0\377\21\35F\377\31*g\377\213\31*e\377\6\31*g\377" \
+  "\20\33B\377\0\0\0\377222\377\377\377\377\377\376\376\376\377\213\377" \
+  "\377\377\377\1\376\376\376\377\202\377\377\377\377\202\0\0\0\377\1\31" \
+  "+h\377\212\31*e\377\3\30)d\377\35-g\377'7n\377\202(8o\377\5'7o\377&6" \
+  "o\377'7o\377(7o\377\30)d\377\206\31*e\377\5\30)d\377%5m\377GU\204\377" \
+  "HV\205\377GV\205\377\203IV\205\377\3IW\205\377HW\204\377IW\205\377\204" \
+  "JW\206\377\5JX\206\377IX\206\377JX\206\377KX\206\377KX\205\377\202KX" \
+  "\206\377\3JY\207\377LY\207\377KY\207\377\203LY\207\377\3LX\207\377KY" \
+  "\206\377LZ\207\377\204MZ\210\377\4LY\210\377LY\207\377N\\\211\3775>^" \
+  "\377\202\0\0\0\377\3___\377\377\377\377\377\376\376\376\377\231\377\377" \
+  "\377\377\3\376\376\376\377\377\377\377\377\177\177\177\377\202\0\0\0" \
+  "\377\11""8Bc\377N[\210\377MZ\207\377N[\210\377LY\210\377P^\216\377\24" \
+  "\27#\377\0\0\0\377\253\253\253\377\232\377\377\377\377\5\376\376\376" \
+  "\377\367\367\367\377888\377\0\0\0\377\14\24""1\377\202\30)d\377\7\31" \
+  "*e\377\21\35G\377\0\0\0\377\4\4\4\377\261\261\261\377\377\377\377\377" \
+  "\376\376\376\377\207\377\377\377\377\1\376\376\376\377\216\377\377\377" \
+  "\377\13\376\376\376\377\377\377\377\377___\377\0\0\0\377\2\4\14\3776" \
+  "Cr\377BP\200\377.8Z\377\0\0\0\377;;;\377\370\370\370\377\211\377\377" \
+  "\377\377\11\266\266\266\377\0\0\0\377\10\12\20\377AP\205\377\77M}\377" \
+  "9G{\377\22\37G\377\0\0\0\377DDD\377\212\377\377\377\377\4\210\210\210" \
+  "\377\0\0\0\377\24\31+\377;Iz\377\202<J|\377\6;J|\377:J|\3779Hy\377\20" \
+  "\24#\377\0\0\0\377\220\220\220\377\215\377\377\377\377\6|||\377\0\0\0" \
+  "\377\6\13\35\377'7m\3778Fy\3777Fx\377\2027Fy\377\4""6Ex\377\23\30*\377" \
+  "\0\0\0\377vvv\377\215\377\377\377\377\4\226\226\226\377\0\0\0\377\6\12" \
+  "\30\377\30)c\377\204\31*e\377\4\30*e\377\21\27/\377\0\0\0\377xxx\377" \
+  "\212\377\377\377\377\4<<<\377\0\0\0\377\21\35F\377\31*g\377\214\31*e" \
+  "\377\1\27'^\377\202\0\0\0\377\1\370\370\370\377\215\377\377\377\377\5" \
+  "\376\376\376\377\377\377\377\377\21\21\21\377\0\0\0\377\26%Z\377\212" \
+  "\31*e\377\3\30)d\377\36.h\377'7n\377\202(8o\377\5'7o\377&6o\377'7o\377" \
+  "(7o\377\30)d\377\206\31*e\377\12\30)d\377\32+f\377GU\204\377GV\204\377" \
+  "GV\205\377IV\205\377HV\205\377IV\205\377IW\205\377HW\204\377\202IW\205" \
+  "\377\204JW\206\377\1IX\206\377\202JX\206\377\3KX\206\377KX\205\377KW" \
+  "\207\377\202KX\207\377\204LY\207\377\3LX\207\377LY\207\377KZ\206\377" \
+  "\202LZ\207\377\204MZ\210\377\3MZ\207\377Q_\216\377-6P\377\202\0\0\0\377" \
+  "\4}}}\377\375\375\375\377\377\377\377\377\376\376\376\377\225\377\377" \
+  "\377\377\4\376\376\376\377\377\377\377\377\353\353\353\377QQQ\377\202" \
+  "\0\0\0\377\12.5P\377Q_\217\377MZ\207\377N[\210\377MZ\210\377LY\210\377" \
+  "P^\216\377\24\27#\377\0\0\0\377\253\253\253\377\211\377\377\377\377\3" \
+  "\376\376\376\377\377\377\377\377\376\376\376\377\215\377\377\377\377" \
+  "\6\376\376\376\377\377\377\377\377\215\215\215\377\0\0\0\377\2\2\5\377" \
+  "\25$W\377\202\31*e\377\6\30)d\377\31*e\377\21\30,\377\0\0\0\377\15\15" \
+  "\15\377\337\337\337\377\225\377\377\377\377\1\376\376\376\377\202\377" \
+  "\377\377\377\1\227\227\227\377\202\0\0\0\377\7\24\"O\377;J|\377BP\200" \
+  "\377.8Z\377\0\0\0\377;;;\377\370\370\370\377\211\377\377\377\377\11\266" \
+  "\266\266\377\0\0\0\377\10\12\20\377AP\205\377\77M}\3774Cx\377\21\36G" \
+  "\377\0\0\0\377DDD\377\212\377\377\377\377\5\210\210\210\377\0\0\0\377" \
+  "\24\31+\377;Iz\377<J|\377\202;J|\377\5:J|\377;I|\377\32\40""7\377\0\0" \
+  "\0\377\\\\\\\377\214\377\377\377\377\6\372\372\372\377GGG\377\0\0\0\377" \
+  "\14\25""4\377,;r\3778Fy\377\2047Fy\377\4\40)G\377\0\0\0\377<<<\377\373" \
+  "\373\373\377\213\377\377\377\377\5\376\376\376\377ggg\377\0\0\0\377\12" \
+  "\21)\377\31*f\377\204\31*e\377\4\30*e\377\22\31""0\377\0\0\0\377xxx\377" \
+  "\212\377\377\377\377\4<<<\377\0\0\0\377\21\35F\377\31*g\377\214\31*e" \
+  "\377\4\30(a\377\4\6\20\377\0\0\0\377\266\266\266\377\217\377\377\377" \
+  "\377\4---\377\0\0\0\377\23\40M\377\31*f\377\211\31*e\377\3\30)d\377\36" \
+  "/i\377'7n\377\202(8o\377\2'7o\377&6o\377\202'7o\377\1\30)d\377\206\31" \
+  "*e\377\6\31*d\377\26'c\377:I{\377HV\205\377GV\205\377HV\205\377\203I" \
+  "V\205\377\3IW\205\377HW\204\377IW\205\377\202JW\206\377\11JV\206\377" \
+  "JW\206\377JX\206\377IX\206\377KX\206\377JX\206\377KX\205\377KW\207\377" \
+  "KX\206\377\202KY\207\377\204LY\207\377\3LX\207\377KZ\206\377LY\207\377" \
+  "\205MZ\210\377\4LY\210\377MZ\207\377N[\210\377(/F\377\202\0\0\0\377\4" \
+  "<<<\377\361\361\361\377\377\377\377\377\376\376\376\377\223\377\377\377" \
+  "\377\4\376\376\376\377\377\377\377\377\312\312\312\377\27\27\27\377\202" \
+  "\0\0\0\377\3/7T\377N[\211\377MZ\207\377\202MZ\210\377\6LY\210\377MZ\210" \
+  "\377P^\216\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377" \
+  "\3\330\330\330\377\377\377\377\377\376\376\376\377\213\377\377\377\377" \
+  "\3\376\376\376\377\377\377\377\377\221\221\221\377\202\0\0\0\377\3\26" \
+  "!J\377\31*f\377\30)d\377\202\31*e\377\10\33+f\377\77N\177\377\23\27$" \
+  "\377\0\0\0\377\26\26\26\377\306\306\306\377\377\377\377\377\376\376\376" \
+  "\377\221\377\377\377\377\1\376\376\376\377\202\377\377\377\377\1VVV\377" \
+  "\202\0\0\0\377\10\20\33B\377\35.j\377=K}\377BP\200\377.8Z\377\0\0\0\377" \
+  ";;;\377\370\370\370\377\211\377\377\377\377\11\266\266\266\377\0\0\0" \
+  "\377\10\12\20\377AP\204\377\77M~\3770\77u\377\21\36F\377\0\0\0\377DD" \
+  "D\377\212\377\377\377\377\4\210\210\210\377\0\0\0\377\24\31+\377;Iz\377" \
+  "\202<J|\377\7;J|\377:J|\377;J|\377%.N\377\0\0\0\377888\377\366\366\366" \
+  "\377\212\377\377\377\377\7\376\376\376\377\365\365\365\377\21\21\21\377" \
+  "\0\0\0\377\22\40Q\3772@u\3778Fy\377\2047Fy\377\5+7`\377\1\1\3\377\32" \
+  "\32\32\377\347\347\347\377\376\376\376\377\212\377\377\377\377\5\374" \
+  "\374\374\377666\377\0\0\0\377\20\33B\377\31*f\377\204\31*e\377\4\30)" \
+  "e\377\24\32""1\377\0\0\0\377xxx\377\212\377\377\377\377\4<<<\377\0\0" \
+  "\0\377\21\35F\377\31*g\377\214\31*e\377\6\30)d\377\11\17&\377\0\0\0\377" \
+  "CCC\377\371\371\371\377\376\376\376\377\215\377\377\377\377\4HHH\377" \
+  "\0\0\0\377\17\32@\377\31*f\377\211\31*e\377\3\30)d\377\40""0i\377'7n" \
+  "\377\202(8o\377\5'7o\377&6o\377'7o\377%5m\377\30)d\377\207\31*e\377\3" \
+  "\30)d\377\"3k\377JX\206\377\202HV\205\377\6IV\205\377IU\205\377IV\205" \
+  "\377IW\205\377HW\204\377IW\205\377\202JW\206\377\2JV\206\377JW\206\377" \
+  "\202JX\206\377\7IX\206\377KX\206\377JX\206\377KX\206\377KW\207\377JX" \
+  "\207\377KY\207\377\206LY\207\377\4KY\206\377LY\207\377MZ\210\377LZ\207" \
+  "\377\203MZ\210\377\12LY\210\377MZ\207\377R_\217\3771:V\377\2\2\3\377" \
+  "\0\0\0\377\3\3\3\377\243\243\243\377\351\351\351\377\375\375\375\377" \
+  "\216\377\377\377\377\1\376\376\376\377\203\377\377\377\377\2\350\350" \
+  "\350\377\226\226\226\377\202\0\0\0\377\7\3\3\5\37719U\377P^\215\377M" \
+  "Z\207\377N[\210\377MZ\210\377LY\210\377\202MZ\210\377\4P^\216\377\24" \
+  "\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\4\32\32\32\377" \
+  "\225\225\225\377\374\374\374\377\377\377\377\377\202\376\376\376\377" \
+  "\210\377\377\377\377\2\367\367\367\377\225\225\225\377\202\0\0\0\377" \
+  "\3\33\40""6\377\30*g\377\30)d\377\203\31*e\377\4\37/i\377CR\201\377D" \
+  "Q\177\377\13\16\25\377\202\0\0\0\377\2\225\225\225\377\367\367\367\377" \
+  "\216\377\377\377\377\1\376\376\376\377\202\377\377\377\377\3\376\376" \
+  "\376\377\337\337\337\377&&&\377\202\0\0\0\377\11\13\23-\377\30)d\377" \
+  "\37/i\377\77M~\377BP\200\377.8Z\377\0\0\0\377;;;\377\370\370\370\377" \
+  "\211\377\377\377\377\11\266\266\266\377\0\0\0\377\10\12\20\377AP\204" \
+  "\377>L}\377+;s\377\21\35F\377\0\0\0\377DDD\377\212\377\377\377\377\4" \
+  "\210\210\210\377\0\0\0\377\24\31+\377;Iz\377\202<J|\377\1:J|\377\202" \
+  ";J|\377\5""0<g\377\0\0\1\377\25\25\25\377\354\354\354\377\376\376\376" \
+  "\377\212\377\377\377\377\6\314\314\314\377\0\0\0\377\0\1\3\377\32+i\377" \
+  "5Cx\3778Ex\377\2047Fy\377\4""6Ex\377\3\4\7\377\0\0\0\377\315\315\315" \
+  "\377\213\377\377\377\377\4\372\372\372\377\5\5\5\377\0\0\0\377\26%Z\377" \
+  "\205\31*e\377\4\30)e\377\25\33""2\377\0\0\0\377xxx\377\212\377\377\377" \
+  "\377\4<<<\377\0\0\0\377\21\35F\377\31*g\377\215\31*e\377\7\25#V\377\0" \
+  "\1\3\377\0\0\0\377\241\241\241\377\376\376\376\377\377\377\377\377\376" \
+  "\376\376\377\213\377\377\377\377\4ddd\377\0\0\0\377\14\25""3\377\31*" \
+  "f\377\211\31*e\377\2\30)d\377!1j\377\203(8o\377\5'7o\377&6o\377'7o\377" \
+  "\40""1i\377\30)d\377\210\31*e\377\2\30)d\377AO\200\377\203HV\205\377" \
+  "\2IV\205\377IU\205\377\202IW\205\377\11HW\204\377JW\206\377IW\205\377" \
+  "JW\206\377JV\206\377JX\206\377JW\206\377IX\206\377JX\206\377\204KX\206" \
+  "\377\3JY\207\377LY\207\377KY\207\377\203LY\207\377\4LX\207\377LY\207" \
+  "\377KZ\206\377LZ\207\377\205MZ\210\377\5LY\210\377MZ\207\377O\\\212\377" \
+  "\77Jn\377\22\24\40\377\202\0\0\0\377\4\32\32\32\377CCC\377\220\220\220" \
+  "\377\353\353\353\377\206\377\377\377\377\1\376\376\376\377\207\377\377" \
+  "\377\377\3\274\274\274\377bbb\377\35\35\35\377\202\0\0\0\377\7\25\30" \
+  "%\377BLs\377P]\213\377MZ\207\377N[\210\377MZ\210\377LY\210\377\203MZ" \
+  "\210\377\4P^\216\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377" \
+  "\377\377\4***\377\0\0\0\377;;;\377\274\274\274\377\204\377\377\377\377" \
+  "\1\376\376\376\377\204\377\377\377\377\2\273\273\273\377999\377\202\0" \
+  "\0\0\377\3$+C\377+:p\377\30)d\377\203\31*e\377\2\30)d\377(8o\377\202" \
+  "GU\204\377\2AMy\377\35#7\377\202\0\0\0\377\3""111\377\177\177\177\377" \
+  "\326\326\326\377\206\377\377\377\377\1\376\376\376\377\206\377\377\377" \
+  "\377\4\361\361\361\377\224\224\224\377DDD\377\16\16\16\377\202\0\0\0" \
+  "\377\4\17\32=\377\31*f\377\30*e\377#3k\377\202BP\200\377\3.8Z\377\0\0" \
+  "\0\377\77\77\77\377\212\377\377\377\377\11\300\300\300\377\0\0\0\377" \
+  "\10\12\20\377AP\204\377>L}\377&6o\377\21\35F\377\0\0\0\377HHH\377\212" \
+  "\377\377\377\377\4\220\220\220\377\0\0\0\377\24\31+\377;Iz\377\202<J" \
+  "|\377\7:J|\377;J|\377;I|\377<J~\377\1\1\2\377\0\0\0\377\341\341\341\377" \
+  "\213\377\377\377\377\6ggg\377\0\0\0\377\12\20'\377\34-j\3775Cx\3778F" \
+  "x\377\2037Fy\377\5""6Ex\3779H~\377\22\27(\377\0\0\0\377|||\377\213\377" \
+  "\377\377\377\4\327\327\327\377\0\0\0\377\1\2\6\377\32,j\377\204\31*e" \
+  "\377\5\30)d\377\31*e\377\27\35""3\377\0\0\0\377\177\177\177\377\212\377" \
+  "\377\377\377\4@@@\377\0\0\0\377\21\35F\377\31*g\377\214\31*e\377\3\30" \
+  ")d\377\31+h\377\23\36A\377\202\0\0\0\377\2ZZZ\377\362\362\362\377\205" \
+  "\377\377\377\377\1\376\376\376\377\206\377\377\377\377\4\204\204\204" \
+  "\377\0\0\0\377\11\20&\377\31*g\377\211\31*e\377\2\31*d\377!2j\377\203" \
+  "(8o\377\4'7o\377&6o\377'7o\377\36.h\377\211\31*e\377\10\30)d\3770@t\377" \
+  "HV\205\377GV\205\377HV\205\377IV\205\377IU\205\377IV\205\377\203IW\205" \
+  "\377\204JW\206\377\3JX\206\377JW\206\377JX\206\377\202KX\206\377\4KX" \
+  "\205\377KW\207\377KX\206\377JX\207\377\205LY\207\377\6LX\207\377LY\207" \
+  "\377KZ\206\377LY\207\377MZ\210\377LZ\207\377\204MZ\210\377\6LY\207\377" \
+  "N[\210\377P]\214\37719U\377\5\6\11\377\1\1\1\377\203\0\0\0\377\16""7" \
+  "77\377sss\377\222\222\222\377\262\262\262\377\323\323\323\377\357\357" \
+  "\357\377\362\362\362\377\361\361\361\377\341\341\341\377\274\274\274" \
+  "\377\227\227\227\377rrr\377JJJ\377\3\3\3\377\202\0\0\0\377\4\1\1\1\377" \
+  "\7\10\15\3772:X\377Q_\216\377\202N[\210\377\202MZ\210\377\1LY\210\377" \
+  "\204MZ\210\377\4P^\216\377\24\27#\377\0\0\0\377\253\253\253\377\212\377" \
+  "\377\377\377\1***\377\203\0\0\0\377\11\34\34\34\377\207\207\207\377\325" \
+  "\325\325\377\356\356\356\377\361\361\361\377\354\354\354\377\317\317" \
+  "\317\377\205\205\205\377\25\25\25\377\202\0\0\0\377\4\3\3\6\377.7V\377" \
+  "GV\206\377\40""1j\377\203\31*e\377\11\30)d\377\27(c\377;J|\377GU\204" \
+  "\377GT\204\377GS\203\377FU\204\377.7V\377\3\3\6\377\203\0\0\0\377\15" \
+  "\34\34\34\377~~~\377\240\240\240\377\274\274\274\377\330\330\330\377" \
+  "\357\357\357\377\361\361\361\377\355\355\355\377\324\324\324\377\267" \
+  "\267\267\377\232\232\232\377\177\177\177\377===\377\203\0\0\0\377\4\0" \
+  "\0\1\377\3\4\14\377\25$V\377\31*e\377\202\30)d\377\1.=s\377\202BP\200" \
+  "\377\4.8Z\377\0\0\0\377\12\12\12\377+++\377\211---\377\12\37\37\37\377" \
+  "\0\0\0\377\10\12\20\377AP\204\377>L}\377!2l\377\21\35F\377\0\0\0\377" \
+  "\14\14\14\377...\377\211---\377\15\27\27\27\377\0\0\0\377\24\31+\377" \
+  ";Iz\377;J|\377<J|\377:J|\377;I|\377:I{\377=L\202\377\17\23\40\377\0\0" \
+  "\0\377\34\34\34\377\212---\377\7///\377\4\4\4\377\0\0\0\377\24!P\377" \
+  "\35.i\3776Dx\3778Fx\377\2037Fy\377\6""7Ey\3778F{\377'2Y\377\0\0\0\377" \
+  "\11\11\11\377///\377\211---\377\5...\377\31\31\31\377\0\0\0\377\11\16" \
+  "$\377\32+i\377\204\31*e\377\5\30)d\377\35.h\377\27\35""3\377\0\0\0\377" \
+  "\24\24\24\377\211---\377\5///\377\11\11\11\377\0\0\0\377\21\35F\377\31" \
+  "*g\377\215\31*e\377\4\30)d\377!1j\377\32$C\377\1\1\2\377\202\0\0\0\377" \
+  "\14>>>\377\245\245\245\377\314\314\314\377\346\346\346\377\360\360\360" \
+  "\377\361\361\361\377\355\355\355\377\332\332\332\377\302\302\302\377" \
+  "\214\214\214\377OOO\377\22\22\22\377\202\0\0\0\377\2\6\12\30\377\31+" \
+  "g\377\212\31*e\377\1\"3k\377\203(8o\377\4'7o\377&6o\377'7n\377\36.h\377" \
+  "\205\31*e\377\1\30)d\377\204\31*e\377\4#3l\377FT\204\377GU\204\377GV" \
+  "\205\377\202IV\205\377\4IU\205\377IW\205\377IV\205\377IW\205\377\205" \
+  "JW\206\377\2JX\206\377IX\206\377\202JX\206\377\5KX\205\377KW\206\377" \
+  "KX\207\377JY\207\377KX\207\377\205LY\207\377\4LX\207\377LY\207\377KZ" \
+  "\206\377LZ\207\377\205MZ\210\377\10LY\210\377MZ\210\377MZ\207\377P]\213" \
+  "\377KX\203\3774=\\\377\34!2\377\12\13\21\377\207\0\0\0\377\1\4\4\4\377" \
+  "\207\0\0\0\377\6\10\12\20\377\35\"3\3774=\\\377MY\206\377O]\213\377M" \
+  "Z\207\377\202N[\210\377\2MZ\210\377LY\210\377\204MZ\210\377\5LZ\207\377" \
+  "P^\217\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\4" \
+  "***\377\0\0\0\377\21\24\37\377\1\1\2\377\211\0\0\0\377\6\4\5\10\377!" \
+  "'<\377@Lv\377IX\210\377\77M~\377\30)e\377\203\31*e\377\14\30)d\377\35" \
+  ".h\377IW\205\377GU\204\377FT\203\377GS\204\377ET\202\377HW\207\377;G" \
+  "p\377'/J\377\25\31(\377\3\3\6\377\216\0\0\0\377\11\2\3\11\377\11\17$" \
+  "\377\21\35G\377\31*e\377\31*f\377\30)d\377\31*e\377\27(c\377;I|\377\202" \
+  "BP\200\377\1-6X\377\216\0\0\0\377\5\6\6\13\377BP\204\377>L}\377\34-i" \
+  "\377\20\35E\377\216\0\0\0\377\11\22\27&\377;Iz\377<J|\377;J|\377:J|\377" \
+  ";J|\377;I|\377<K\177\377\"*I\377\216\0\0\0\377\6\0\1\2\377\30)d\377\37" \
+  "0i\3776Ex\3777Fx\3776Fy\377\2027Fy\377\2027Ey\377\1""6F{\377\217\0\0" \
+  "\0\377\2\20\34D\377\31*f\377\204\31*e\377\3\30)d\377\"2k\377\25\32/\377" \
+  "\216\0\0\0\377\2\21\34D\377\31*g\377\215\31*e\377\5\30)d\377\"2k\377" \
+  "/\77v\377!,S\377\12\16\33\377\216\0\0\0\377\3\3\6\16\377\13\22-\377\31" \
+  ")d\377\212\31*e\377\1#3l\377\203(8o\377\4&6o\377'7o\377'7n\377\36.h\377" \
+  "\205\31*e\377\2\36/h\377\30)d\377\203\31*e\377\13\31*d\377BQ\201\377" \
+  "HV\205\377GV\205\377IV\205\377HV\205\377IU\205\377IV\205\377IW\205\377" \
+  "HW\204\377IW\205\377\202JW\206\377\3JV\206\377JW\206\377JX\206\377\202" \
+  "IX\206\377\203KX\206\377\3KW\207\377JX\207\377JY\207\377\202KY\207\377" \
+  "\203LY\207\377\202LX\207\377\2LY\207\377KY\206\377\202LZ\207\377\204" \
+  "MZ\210\377\3LY\210\377MZ\210\377MZ\207\377\202N[\210\377\10MZ\207\377" \
+  "MZ\206\377FR{\377/6R\377$*@\377\32\36.\377\20\24\35\377\6\7\14\377\205" \
+  "\0\0\0\377\6\11\13\21\377\33\37""0\377,4N\377CNv\377MZ\206\377MZ\207" \
+  "\377\202N[\210\377\2MZ\207\377N[\210\377\202MZ\210\377\1LY\210\377\206" \
+  "MZ\210\377\4P^\216\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377" \
+  "\377\377\7***\377\0\0\0\3773=]\377HV\203\3775\77a\377\26\32(\377\6\7" \
+  "\14\377\203\0\0\0\377\3\7\11\16\377\27\34*\3777Ad\377\202HU\204\377\4" \
+  "GV\205\377IW\205\377,<r\377\30)d\377\203\31*e\377\21\27(c\3774Cv\377" \
+  "HU\204\377FU\203\377GS\204\377FS\203\377ET\202\377ES\202\377FT\203\377" \
+  "ET\202\377ER\202\377DQ\200\3772;]\377\33\40""4\377\23\30%\377\14\15\26" \
+  "\377\3\4\6\377\203\0\0\0\377\10\4\5\10\377\14\17\30\377\25\30(\377\34" \
+  "\"7\377&-H\377'4d\377\30)c\377\30)d\377\202\31*e\377\5\30)d\377\31*e" \
+  "\377\30)d\377\32*e\377DR\201\377\202BP\200\377\1=Jw\377\2051<a\377\202" \
+  "0<`\377\2050;`\377\202/:`\377\6""2=e\377\77M\177\377=L}\377\27(d\377" \
+  "\27']\377\23\37L\377\206\23\40M\377\5\24\40M\377,7^\377.9_\377/9_\377" \
+  "-9_\377\202.9_\377\3""2>h\377;I{\377<J|\377\203;J|\377\10;H|\377;I|\377" \
+  "8Ev\377+6\\\377,7]\377,7^\377(4[\377\22\37L\377\211\23\40M\377\6\24\"" \
+  "S\377\30)d\377\"2k\3777Ex\3777Fy\3776Fy\377\2027Fy\377\5""7Ey\3777Dx" \
+  "\3776Ey\377,8b\377)4[\377\203)4\\\377\3)3\\\377(4\\\377\22\37L\377\206" \
+  "\23\40M\377\2\23\37K\377\30)c\377\205\31*e\377\4\30)d\377&6n\377,:f\377" \
+  "&2Y\377\203&1Z\377\202&1Y\377\204%0Y\377\5%1Y\377\34(S\377\23\40M\377" \
+  "\23\37L\377\27'^\377\216\31*e\377\11\30)d\377$5l\377-=s\377-=r\377,;" \
+  "q\377*9m\377\32\"A\377\12\15\32\377\5\6\15\377\204\0\0\0\377\11\1\1\4" \
+  "\377\3\6\15\377\7\15\37\377\15\27""8\377\23!P\377\30)b\377\30)c\377\30" \
+  ")d\377\31)d\377\212\31*e\377\1$4l\377\203(8o\377\4&6o\377'7o\377'7n\377" \
+  "\36.h\377\205\31*e\377\2""3Av\377\27(d\377\203\31*e\377\7\27(d\377(8" \
+  "o\377JX\206\377GU\204\377HV\205\377IV\205\377IU\205\377\202IV\205\377" \
+  "\15HW\204\377IW\205\377JW\206\377IW\205\377JW\206\377JV\206\377JW\206" \
+  "\377JX\206\377IX\206\377JX\206\377KX\206\377KX\205\377KX\206\377\202" \
+  "KX\207\377\2JY\207\377KY\207\377\205LY\207\377\4LX\207\377LY\207\377" \
+  "KZ\206\377LZ\207\377\206MZ\210\377\202LY\210\377\202MZ\210\377\23N[\207" \
+  "\377N[\210\377P]\213\377P^\214\377Q_\216\377R_\217\377S`\220\377R`\220" \
+  "\377KX\204\377LY\205\377P^\215\377Sa\222\377R`\220\377Q_\216\377P]\213" \
+  "\377N[\211\377MZ\207\377MZ\210\377N[\210\377\203MZ\210\377\1LY\210\377" \
+  "\207MZ\210\377\5LZ\207\377O^\215\377\24\27#\377\0\0\0\377\253\253\253" \
+  "\377\212\377\377\377\377\23***\377\0\0\0\3773=^\377JX\206\377KX\210\377" \
+  "M[\214\377N\\\216\377M[\214\377HU\203\377M\\\214\377O^\216\377dp\230" \
+  "\377ep\226\377dn\224\377cn\223\377Q^\213\377DQ\202\377\32+e\3778Fw\377" \
+  "\203>Kz\377\16'7n\377BQ\201\377IW\205\377^i\220\377cm\224\377bm\223\377" \
+  "`k\221\377Q^\212\377S`\214\377al\222\377bl\223\377al\223\377Ye\220\377" \
+  "GV\210\377\202HW\211\377\13IX\212\377GU\207\377BP\177\377GV\210\377H" \
+  "W\212\377GV\211\377GU\210\377FT\206\377GT\205\377\"3l\377\30)d\377\205" \
+  "\31*e\377\4\30)d\377'7n\377N[\207\377^i\220\377\202^i\221\377\2Yd\217" \
+  "\377@N\201\377\203BP\202\377\1@P\200\377\205AO\201\377\10@N\201\377\77" \
+  "N\201\377@N\201\377\77N\200\377\77M~\3775Dw\377\27(c\377\31*e\377\207" \
+  "\31*f\377\2\35.i\377;J}\377\202=L~\377\4<L~\377<L\177\377<K}\377<J}\377" \
+  "\202<J|\377\203;J|\377\4;H|\377:H{\377:I|\377O\\\211\377\202Ye\216\377" \
+  "\2P\\\211\377=K{\377\204>L|\377\3>L{\377.=s\377\30)e\377\203\31*f\377" \
+  "\5\30)e\377%4m\3778Fy\3777Fy\3776Fy\377\2027Fy\377\5""6Ey\3777Dy\377" \
+  "6Dx\3776Ez\3776Fz\377\2026Fy\377\4""6Dy\3776Ez\3772Aw\377\27(e\377\207" \
+  "\31*f\377\206\31*e\377\12\27(d\377+:q\3771Bv\377FT\204\377R^\212\377" \
+  "S_\212\377R^\212\377DQ\201\3772Av\3771@v\377\2031Av\377\2""2Aw\377\"" \
+  "2l\377\202\31*f\377\2\31*e\377\30)d\377\215\31*e\377\15\27(d\377(8o\377" \
+  "-=r\377-=q\377,;q\377-<r\377.=u\377.\77x\377.\77y\377.@y\377,<r\377\"" \
+  "2j\377\32,j\377\202\32,k\377\5\32+i\377\31+h\377\31*f\377\31*e\377\30" \
+  ")d\377\214\31*e\377\1%5m\377\203(8o\377\4&6o\377'7o\377'7n\377\36.h\377" \
+  "\205\31*e\377\2@N\177\377\32+f\377\203\31*e\377\3\30)d\377\27(d\377@" \
+  "N~\377\203HV\205\377\2IV\205\377IU\205\377\202IV\205\377\2HW\204\377" \
+  "IW\205\377\203JW\206\377\13JV\206\377JX\206\377JW\206\377IX\206\377J" \
+  "X\206\377KX\206\377KX\205\377KW\207\377KW\206\377KY\207\377KX\207\377" \
+  "\206LY\207\377\3LX\207\377LY\207\377KY\206\377\202LZ\207\377\206MZ\210" \
+  "\377\1LY\210\377\203MZ\210\377\202N[\210\377\3MZ\210\377N[\210\377MZ" \
+  "\207\377\204N[\210\377\202N[\207\377\202N[\210\377\1MZ\210\377\202N[" \
+  "\210\377\202MZ\210\377\202LY\210\377\205MZ\210\377\202LZ\207\377\6LY" \
+  "\207\377KY\206\377O]\215\377\24\27#\377\0\0\0\377\253\253\253\377\212" \
+  "\377\377\377\377\10***\377\0\0\0\3773=^\377JW\206\377JV\206\377JW\206" \
+  "\377IV\205\377JW\206\377\202IW\205\377\20O\\\211\377dgs\377))+\377((" \
+  "*\377;;<\377t~\235\377'7o\377'7m\377NPX\377''*\377'(*\377++-\377ir\223" \
+  "\377ES\203\377Ta\215\377Y[c\377\202'(*\377\14FFI\377ep\225\377t~\241" \
+  "\377@@@\377()+\377/01\377nt\214\377CQ\201\377ES\203\377ER\202\377DR\201" \
+  "\377ER\202\377\202DR\202\377\1CQ\201\377\202DR\202\377\4DQ\201\377CQ" \
+  "\201\377\27(c\377\30)d\377\205\31*e\377\10\27(c\3775Dw\377`j\216\377" \
+  "=>A\377))+\377'()\377\207\215\237\377<J~\377\202AO\200\377\3@O\177\377" \
+  "\77N~\377@M\177\377\204@N\177\377\202\77M\177\377\202\77M~\377\3@N\177" \
+  "\377&6n\377\30)d\377\210\31*e\377\3\40""1j\377;I|\377=K}\377\203<K}\377" \
+  "\1<I{\377\203<J|\377\203;J|\377\7;H|\377:I{\377:H{\377gn\205\377-./\377" \
+  "))+\377((+\377\205'(*\377\3""556\377V`\204\377\25&b\377\203\31*e\377" \
+  "\11\30)d\377)8p\3778Fy\3777Fy\3776Fy\3777Fy\3777Ey\3777Fy\3776Dy\377" \
+  "\2026Ey\377\2036Ex\377\4""6Cx\3776Dx\377,;q\377\27(d\377\215\31*e\377" \
+  "\12\27(c\3770\77t\377.\77t\377v~\232\377//0\377((+\377003\377`i\206\377" \
+  "1@t\3770\77u\377\2031@u\377\2""0\77t\377\37/i\377\221\31*e\377\16\27" \
+  "(d\377,<q\377-=r\377-<q\377-;r\377-<r\377,<r\377+<r\377+;q\377,;r\377" \
+  ",<r\377!1j\377\30)d\377\31*d\377\222\31*e\377\1&6m\377\203(8o\377\4&" \
+  "6o\377'7o\377'7n\377\36.h\377\205\31*e\377\3FT\203\377%5m\377\30)d\377" \
+  "\203\31*e\377\5\30)d\377'6n\377HV\205\377GV\205\377HV\205\377\202IV\205" \
+  "\377\3IU\205\377IW\205\377IV\205\377\202IW\205\377\204JW\206\377\14J" \
+  "X\206\377IX\206\377JX\206\377KX\206\377JX\206\377KX\205\377KX\206\377" \
+  "KW\207\377JX\207\377KY\207\377LY\207\377KY\207\377\204LY\207\377\4LX" \
+  "\207\377LY\207\377KZ\206\377LY\207\377\202LZ\207\377\207MZ\210\377\202" \
+  "LY\210\377\206MZ\210\377\202N[\210\377\205MZ\210\377\203LY\210\377\210" \
+  "MZ\210\377\10LZ\207\377KZ\206\377LY\207\377LX\207\377O]\215\377\24\27" \
+  "#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\4***\377\0\0\0\377" \
+  "3=^\377JV\206\377\203JW\206\377\203IW\205\377\2LY\207\377ko\203\377\203" \
+  "\0\0\0\377\4z\201\232\377\31*f\377>Ly\377##%\377\203\0\0\0\377\4kq\203" \
+  "\377JX\206\377Ze\216\377/04\377\202\0\0\0\377\13OPS\377Yf\223\377v\200" \
+  "\242\377&%\"\377\5\4\4\377\16\16\15\377jp\207\377CQ\201\377ES\202\377" \
+  "ES\201\377EQ\202\377\203DR\202\377\10CQ\201\377DR\202\377CQ\201\377D" \
+  "Q\201\3775Dw\377\26(c\377\31*e\377\30)d\377\205\31*e\377\3=L}\377_i\215" \
+  "\377\32\32\34\377\202\0\0\0\377\2\210\215\236\377<J~\377\202AO\200\377" \
+  "\4@O\177\377@N\177\377@M\177\377\77M~\377\203@N\177\377\203\77M\177\377" \
+  "\3\77M}\377@N\177\377\32+f\377\202\30)d\377\206\31*e\377\5\30)d\377$" \
+  "5m\377<J|\377=K}\377<J|\377\202<K}\377\1<I{\377\202<J|\377\203;J|\377" \
+  "\6;I|\377;H|\377;I|\3779Hz\377`g}\377\4\4\4\377\207\0\0\0\377\3\16\15" \
+  "\13\377S^\201\377\25&b\377\203\31*e\377\5\30)d\377/>s\3778Fy\3777Fy\377" \
+  "6Fy\377\2027Fy\377\4""7Dy\3776Ey\3775Dx\3776Ey\377\2036Ex\377\4""6Cx" \
+  "\3776Dx\377'7n\377\27)d\377\203\31*e\377\1\30)d\377\210\31*e\377\13\30" \
+  ")d\377\30*d\3772Au\377.>t\377y\200\233\377\11\10\7\377\0\0\0\377\10\10" \
+  "\11\377]f\203\3771@t\3770\77u\377\2031@u\377\2/\77t\377\35.h\377\214" \
+  "\31*e\377\202\30)d\377\202\31*e\377\4\30)d\377\31*e\377,<r\377,=q\377" \
+  "\202-<r\377\202,<r\377\1+<r\377\202,<r\377\3,;r\377\36/h\377\30)d\377" \
+  "\223\31*e\377\1'6n\377\203(8o\377\4&6o\377'7o\377'7n\377\36.h\377\205" \
+  "\31*e\377\3GU\204\377;I{\377\27(c\377\204\31*e\377\12\33,f\377AP\200" \
+  "\377GU\204\377GV\205\377IV\205\377HV\205\377IU\205\377IV\205\377IW\205" \
+  "\377HW\204\377\202IW\205\377\205JW\206\377\11IX\206\377JX\206\377KX\206" \
+  "\377KX\205\377KX\206\377KX\207\377KX\206\377JY\207\377KY\207\377\210" \
+  "LY\207\377\2KZ\206\377LY\207\377\202MZ\210\377\1LZ\207\377\207MZ\210" \
+  "\377\205LY\210\377\203MZ\210\377\205LY\210\377\210MZ\210\377\13LZ\207" \
+  "\377MZ\210\377LY\207\377KZ\206\377LY\207\377LX\207\377LY\207\377O]\215" \
+  "\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\3***\377" \
+  "\0\0\0\3773<^\377\203JW\206\377\202IW\205\377\5IV\205\377IW\205\377H" \
+  "U\204\377{\203\235\377\3\3\3\377\202\0\0\0\377\4af{\377\30*f\377\\e\202" \
+  "\377\20\20\16\377\203\0\0\0\377\4PSZ\377MZ\207\377bm\220\377\36\37\40" \
+  "\377\202\0\0\0\377\36\204\207\222\377DS\204\377gr\231\377ou\210\377i" \
+  "o\204\377jp\205\377nw\227\377CQ\202\377BP\200\377@O\200\377@N\200\377" \
+  "\77N\200\377AO\200\377\77N\177\377\77N\200\377@N\177\377CQ\201\377ES" \
+  "\202\377!1j\377\24%a\377\22$a\377\22#b\377\21#a\377\22$a\377\26'c\377" \
+  "\30)d\377\40""1j\377\77M~\377_i\215\377\34\34\35\377\202\0\0\0\377\2" \
+  "\210\215\236\377<J~\377\202AO\200\377\10\77N~\377;K|\377;I|\377;I}\377" \
+  ":I|\377;I|\377=L}\377>L~\377\202\77M\177\377\11\77M~\3778Fy\377\23%a" \
+  "\377\22$a\377\22$b\377\21#a\377\22$a\377\24&b\377\30)d\377\202\31*e\377" \
+  "\10\30)d\377,;q\3779G{\3777Fz\3776F{\3776Fz\3777Fz\3778Gz\377\202<J|" \
+  "\377\3;J|\377:J|\377;J|\377\203;I|\377\3""9Hz\377ag~\377\6\6\6\377\202" \
+  "\0\0\0\377\2HIL\377[]b\377\203[\\a\377\27cdh\377_i\215\377\20\"_\377" \
+  "\22$a\377\23$a\377\22$a\377\25'b\3770\77t\3772Av\3773Bv\3776Ex\3777F" \
+  "y\3776Ex\3772Av\3771@v\3770@w\3770\77v\3771@u\3773Bv\3775Ew\3776Cx\377" \
+  "6Ex\377\40""1j\377\202\30)d\377\7\23%b\377\22$a\377\21#b\377\21#a\377" \
+  "\23$a\377\26(c\377\30)d\377\203\31*e\377\24\31)d\377\24%b\377\25'd\377" \
+  ",<s\377*;r\377y\200\233\377\13\12\11\377\0\0\0\377\12\12\12\377]f\203" \
+  "\3770\77t\3770\77u\3771@u\3770\77t\377,<r\377)9q\377\25&d\377\22$a\377" \
+  "\24%b\377\30)d\377\202\31*e\377\2\30)d\377\23%b\377\203\23$a\377\5\27" \
+  "(c\377\23%b\377\21#a\377\22$a\377\24&b\377\202\30)d\377\4\26(c\377&7" \
+  "p\377'8o\377)8o\377\202-<r\377\2,<r\377+<r\377\202,<r\377\3,;r\377\33" \
+  ",f\377\30)d\377\223\31*e\377\204(8o\377\4&6o\377'7n\377&6n\377\34-g\377" \
+  "\205\31*e\377\4FT\203\377JX\206\377!1j\377\30)d\377\203\31*e\377\5\30" \
+  ")d\377.=r\377IV\205\377GU\204\377GV\205\377\203IV\205\377\4IW\205\377" \
+  "IV\205\377HW\204\377IW\205\377\203JW\206\377\5JV\206\377JW\206\377JX" \
+  "\206\377IX\206\377JX\206\377\202KX\206\377\7KX\205\377KW\206\377KX\207" \
+  "\377JY\207\377KX\207\377LY\207\377KY\207\377\207LY\207\377\3KZ\206\377" \
+  "LZ\207\377LY\207\377\231MZ\210\377\6LZ\207\377MZ\210\377LZ\207\377LY" \
+  "\207\377KZ\206\377LZ\207\377\202LX\207\377\202LY\207\377\4O]\215\377" \
+  "\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\15***\377\0" \
+  "\0\0\3773<^\377JW\206\377IW\205\377JW\206\377IW\205\377HW\204\377IW\205" \
+  "\377IV\205\377HU\204\377oy\236\377(((\377\202\0\0\0\377\3IMY\377!2m\377" \
+  "pt~\377\202\0\0\0\377&\5\5\5\377\0\0\0\377457\377Xd\215\377jr\217\377" \
+  "\22\22\21\377\0\0\0\377\12\11\10\377\202\210\236\377\77N\177\377jt\233" \
+  "\377z~\221\377u{\217\377w|\220\377r{\233\377DR\202\377ox\230\377y~\220" \
+  "\377x}\217\377|\201\223\377r|\240\377z\200\224\377\203\206\220\377v\177" \
+  "\233\377MY\207\377=K}\377&6m\377Zc\206\377lr\206\377y}\210\377vz\210" \
+  "\377jq\207\377DQ}\377\37""0i\377&6n\377@O\177\377_i\215\377\34\34\35" \
+  "\377\202\0\0\0\377\2\210\215\236\377<J~\377\202AO\200\377\11O]\210\377" \
+  "t{\226\377{\200\217\377\201\204\216\377\177\202\216\377w~\223\377]h\217" \
+  "\377BP\201\377>L~\377\202\77M~\377\10>L}\377\\f\206\377kq\206\377x{\207" \
+  "\377w{\210\377mr\206\377Va\204\377#3k\377\203\30)d\377\22HU\204\377o" \
+  "v\221\377x}\216\377\177\203\214\377\177\202\216\377w|\216\377iq\222\377" \
+  "@N\177\377<J|\377;J|\377:J|\377;J|\377;I|\377:I{\377;I|\3779Hz\377ag" \
+  "~\377\6\6\6\377\202\0\0\0\377\2mr\202\377)9s\377\204$5n\377,\34,g\377" \
+  "Va\211\377jp\206\377gn\205\377ov\215\377HU\204\377x}\223\377~\202\216" \
+  "\377js\222\377@N\177\3777Fy\377ES\201\377mt\221\377w|\215\377\200\203" \
+  "\214\377}\200\215\377u{\220\377Yd\213\377:I{\3775Cw\3777Ey\377\32+f\377" \
+  "\31*e\377,;p\377_h\207\377ou\207\377{~\211\377uy\210\377fn\210\377=K" \
+  "z\377\35-g\377\30)d\377\31*e\377\30)e\377!2j\377]g\210\377uy\210\377" \
+  "|\200\214\377fo\214\377\200\207\237\377\12\12\10\377\0\0\0\377\12\12" \
+  "\12\377]f\203\377\2020\77t\377\14""2Av\377GS\201\377ip\214\377uz\212" \
+  "\377x|\210\377jp\206\377Wb\206\377&6l\377\30)e\377\30)d\377\40""1j\377" \
+  "dm\212\377\202gm\204\377\17nu\217\377<K}\377_h\205\377vz\211\377qv\210" \
+  "\377V`\205\377!2k\377)8n\377dl\211\377|\200\214\377z~\213\377dm\217\377" \
+  "1\77t\377,;q\377+<r\377\203,<r\377\3,;r\377\30*d\377\30)d\377\221\31" \
+  "*e\377\2\30)d\377\33,f\377\202(8o\377\6'7o\377(8o\377&6o\377'7o\377%" \
+  "5l\377\30)d\377\205\31*e\377\5GT\204\377GU\204\377\77M~\377\27(d\377" \
+  "\30)d\377\202\31*e\377\11\30)d\377\27(d\377>M~\377HV\205\377GV\205\377" \
+  "HV\205\377IV\205\377IU\205\377IV\205\377\203IW\205\377\2JW\206\377IW" \
+  "\205\377\203JW\206\377\202JX\206\377\3IX\206\377KX\206\377JX\206\377" \
+  "\202KX\206\377\6KW\206\377KX\206\377JY\207\377KY\207\377LY\207\377KY" \
+  "\207\377\204LY\207\377\202LX\207\377\7LY\207\377KY\206\377KZ\206\377" \
+  "LY\207\377LZ\207\377MZ\210\377LZ\207\377\223MZ\210\377\1LZ\207\377\202" \
+  "MZ\210\377\202LZ\207\377\1KZ\206\377\202LY\207\377\1LX\207\377\203LY" \
+  "\207\377\4O]\215\377\24\27#\377\0\0\0\377\253\253\253\377\212\377\377" \
+  "\377\377\7***\377\0\0\0\3773<^\377IW\205\377JW\206\377IW\205\377HW\204" \
+  "\377\202IV\205\377\4IU\205\377HU\204\377\\i\225\377Y[_\377\202\0\0\0" \
+  "\377\"68>\377O\\\212\377FFH\377\0\0\0\377\4\4\4\377666\377\0\0\0\377" \
+  "\27\27\26\377ox\225\377kp\203\377\6\6\5\377\0\0\0\377))'\377ny\235\377" \
+  "@N\177\377v\200\242\377'&#\377\6\6\5\377\20\17\15\377jp\207\377CQ\201" \
+  "\377qx\221\377\11\11\10\377\5\4\3\377.-+\377\203\206\222\377\15\15\14" \
+  "\377\0\0\0\377fhp\377IV\205\377^i\217\377OQZ\377\31\31\30\377\2\1\0\377" \
+  "\202\0\0\0\377\7\10\7\6\377(((\377ch{\377DR\203\377@N\177\377_i\215\377" \
+  "\34\34\35\377\202\0\0\0\377\6\210\215\236\377<K~\377=K}\377lu\224\377" \
+  "LNR\377\22\21\20\377\203\0\0\0\377\35\13\12\11\377223\377y\177\224\377" \
+  "BP\203\377=K|\377Wc\215\377VXa\377\25\25\23\377\3\3\1\377\16\15\12\377" \
+  "\0\0\0\377\3\3\1\377\32\32\31\377bfw\377\40""1k\377\24%b\377KW\202\377" \
+  "RSY\377\23\22\21\377\1\1\0\377\12\11\7\377\0\0\0\377\3\2\1\377\40\40" \
+  "\40\377fk|\377=K}\377;J|\377:J|\377;J|\377\202;I|\377\4:I{\3779Hz\377" \
+  "ag~\377\6\6\6\377\202\0\0\0\377\2tx\207\377LY\210\377\202HU\204\377\17" \
+  "IU\204\377;Jz\377\25'c\377Yb\202\377\27\26\23\377\10\7\6\377=>A\377q" \
+  "t~\377\6\5\3\377\0\0\0\377cen\377>M~\377cn\221\377QSZ\377\25\24\22\377" \
+  "\203\0\0\0\377\11\11\10\7\377*+,\377ot\207\377;I|\3772Av\377\26'c\377" \
+  "Q\\\201\377FHN\377\23\23\21\377\203\0\0\0\377\10\14\13\12\377123\377" \
+  "ho\211\377\35/j\377\30)d\377%5m\377[_n\377\31\30\30\377\202\0\0\0\377" \
+  "\13\24\24\23\377dej\377\15\15\15\377\0\0\0\377\12\12\12\377]f\203\377" \
+  "0\77t\3773Cx\377ox\224\377ABF\377\20\17\16\377\202\0\0\0\377\22\6\6\4" \
+  "\377\30\30\26\377PR[\377O[\205\377\31*e\377$4m\377UYf\377\4\4\2\377\2" \
+  "\2\0\377]^b\377Z]i\377\20\20\16\377\0\0\0\377\2\2\1\377!!\40\377jr\211" \
+  "\377TW`\377\22\22\20\377\202\0\0\0\377\4\35\34\34\377ot\213\3771@u\377" \
+  "+<r\377\203,<r\377\2*:q\377\27(d\377\222\31*e\377\2\30)d\377\35.h\377" \
+  "\203(8o\377\5'7o\377&6o\377'7o\377%5l\377\30)d\377\205\31*e\377\5GT\204" \
+  "\377GU\204\377FT\203\377%5m\377\30)d\377\203\31*e\377\2\30)d\377\36/" \
+  "h\377\202GU\204\377\1GV\205\377\202HV\205\377\1IU\205\377\202IW\205\377" \
+  "\2HW\204\377IW\205\377\203JW\206\377\5JV\206\377JW\206\377JX\206\377" \
+  "JW\206\377JX\206\377\203KX\206\377\10KX\205\377KW\207\377KX\207\377J" \
+  "X\207\377KY\207\377KX\207\377LY\207\377KY\207\377\205LY\207\377\202L" \
+  "X\207\377\5LZ\207\377KY\206\377LZ\207\377MY\210\377LZ\207\377\215MZ\210" \
+  "\377\1LZ\207\377\203MZ\210\377\7LZ\207\377MY\210\377LZ\207\377KZ\206" \
+  "\377KY\206\377LY\207\377LX\207\377\205LY\207\377\5KY\207\377O]\215\377" \
+  "\24\27#\377\0\0\0\377\253\253\253\377\212\377\377\377\377\6***\377\0" \
+  "\0\0\3773<^\377JW\206\377IW\205\377HW\204\377\202IW\205\377\5IU\205\377" \
+  "HV\205\377HU\204\377FT\205\377\210\214\227\377\202\0\0\0\377\6%&)\377" \
+  "\201\210\240\377\23\23\21\377\0\0\0\377$%&\377bdm\377\202\0\0\0\377\2" \
+  "}\201\216\377moz\377\202\0\0\0\377\23NOR\377R_\213\377BP\200\377v\200" \
+  "\242\377\"!\37\377\0\0\0\377\11\11\10\377io\206\377CR\201\377px\221\377" \
+  "\2\2\2\377\0\0\0\377---\377\32\32\32\377\4\4\4\377\15\16\16\377ks\217" \
+  "\377KW\205\377Y\\d\377\202\0\0\0\377\12""001\377\177\202\221\377XZa\377" \
+  "\7\7\7\377\0\0\0\377\2\2\2\377v|\222\377CQ\201\377_i\215\377\34\34\35" \
+  "\377\202\0\0\0\377\4\210\215\236\377:I|\377^j\225\377TVX\377\202\0\0" \
+  "\0\377\24CDG\377\213\216\233\377PQU\377\1\1\1\377\0\0\0\377\34\33\32" \
+  "\377~\206\241\3779H{\377u|\222\377\14\14\12\377\0\0\0\377KLR\377ir\217" \
+  "\377sw\210\377\27\27\30\377\33\33\33\377DCB\377px\224\377\23$c\377\202" \
+  "\206\224\377\202\0\0\0\377\20\\_d\377~\206\237\377\177\202\216\377\26" \
+  "\26\25\377\36\36\36\377NNN\377lt\230\3777Fy\377;J|\377;I|\377;H|\377" \
+  ";I|\377:I{\3779Hz\377ag~\377\6\6\6\377\202\0\0\0\377\2$$#\377***\377" \
+  "\202**)\377\15(''\377`fz\377\32+f\377Wa\201\377\20\17\16\377\0\0\0\377" \
+  "000\377\7\7\7\377\2\2\2\377\16\16\15\377y\201\234\377P]\214\377cdi\377" \
+  "\202\0\0\0\377\12""236\377\207\214\230\377XY_\377\7\7\6\377\0\0\0\377" \
+  "\24\24\22\377\202\211\240\377(9p\3778Fy\377MNR\377\202\0\0\0\377\3BD" \
+  "G\377\200\205\224\377MNS\377\202\0\0\0\377\5\30\30\27\377fo\220\377\24" \
+  "&b\377Yb\204\377\30\27\27\377\202\0\0\0\377\2\2\2\2\377\17\17\20\377" \
+  "\203\0\0\0\377\5\12\12\12\377]f\203\3770\77t\377`j\220\377%%&\377\202" \
+  "\0\0\0\377\3\13\13\14\377445\377\2\2\2\377\202\0\0\0\377\4EGM\377*:o" \
+  "\377#3m\377RWd\377\202\0\0\0\377\3(((\377\0\0\0\377\6\6\6\377\203\0\0" \
+  "\0\377\3\14\14\14\377\0\0\0\377\3\3\3\377\203\0\0\0\377\10""79<\377B" \
+  "O~\377+<r\377,<r\377,;r\377,<r\377'7n\377\27)d\377\222\31*e\377\2\30" \
+  ")d\377\40""1j\377\203(8o\377\203'7o\377\2%5l\377\30)d\377\205\31*e\377" \
+  "\5GS\204\377FT\203\377GU\204\3779Gz\377\30)d\377\205\31*e\377\6""5Dx" \
+  "\377HV\205\377GU\204\377HV\205\377IV\205\377HV\205\377\202IV\205\377" \
+  "\4IW\205\377HW\204\377JW\206\377IW\205\377\202JW\206\377\7JV\206\377" \
+  "JW\206\377JX\206\377IX\206\377JX\206\377KX\206\377JX\206\377\202KX\206" \
+  "\377\202KW\206\377\3JX\207\377JY\207\377KY\207\377\210LY\207\377\3LX" \
+  "\207\377LY\207\377KY\206\377\202KZ\206\377\3LZ\207\377LY\207\377LZ\207" \
+  "\377\213MZ\210\377\202LZ\207\377\1LY\207\377\202KZ\206\377\1KY\206\377" \
+  "\202LY\207\377\1LX\207\377\207LY\207\377\5O]\215\377\24\27#\377\0\0\0" \
+  "\377\221\221\221\377\335\335\335\377\210\330\330\330\377\10\336\336\336" \
+  "\377###\377\0\0\0\3773<^\377JW\206\377IW\205\377HW\204\377IW\205\377" \
+  "\203IV\205\377\7HV\205\377CR\202\377\200\207\236\377\16\15\13\377\0\0" \
+  "\0\377\31\31\32\377xz\205\377\202\0\0\0\377!Y[b\377\200\206\233\377\0" \
+  "\0\1\377\0\0\0\377Z[_\377WX^\377\0\0\0\377\1\1\0\377`cl\377DR\202\377" \
+  "CP\201\377v\200\242\377\"!\37\377\0\0\0\377\11\11\10\377io\206\377CR" \
+  "\201\377px\221\377\2\2\2\377\0\0\0\377\1\1\1\377&&(\377u|\223\377u}\230" \
+  "\377R]\211\377z\201\234\377\27\27\25\377\0\0\0\377\23\23\23\377js\220" \
+  "\377#5q\377O]\220\377UW[\377\202\0\0\0\377\4GIN\377JW\204\377_i\215\377" \
+  "\34\34\35\377\202\0\0\0\377\3\210\215\236\3779I}\377\214\220\240\377" \
+  "\202\0\0\0\377\5\27\30\31\377x\200\237\377IX\211\377}\207\253\377,,." \
+  "\377\202\0\0\0\377\3Y\\f\377ES\204\377\200\204\220\377\202\0\0\0\377" \
+  "\11:<B\377OXu\377^h\212\377\201\210\242\377fq\230\377AO\200\3774Cw\377" \
+  "(8r\377oqy\377\202\0\0\0\377\20IKQ\377bj\203\377u~\234\377\222\227\256" \
+  "\377{\205\246\377\\g\222\377T`\214\3779Hz\377;J|\377;I|\377;H|\377;I" \
+  "|\377:I{\3779Hz\377ag~\377\6\6\6\377\207\0\0\0\377\4X]q\377\32+g\377" \
+  "Wa\201\377\20\17\16\377\202\0\0\0\377\5""89<\377pw\220\377qy\223\377" \
+  "IW\207\377|\202\230\377\202\0\0\0\377\5\6\7\7\377z\202\236\377AP\204" \
+  "\377gs\235\3778:>\377\202\0\0\0\377\3UW]\3779H~\377}\203\226\377\202" \
+  "\0\0\0\377\5\34\34\36\377^i\217\377!3o\377an\231\377.-.\377\202\0\0\0" \
+  "\377\3MQ^\377\36/j\377ru\177\377\202\0\0\0\377\4\37\37\37\377pw\217\377" \
+  "lu\225\377CEJ\377\202\0\0\0\377\4\12\12\12\377]f\203\3771@u\377]an\377" \
+  "\202\0\0\0\377\12\"\"!\377s{\230\377DR\201\377ms\210\377\13\12\11\377" \
+  "\0\0\0\377\21\20\17\377bi\207\377\36/j\377RWd\377\203\0\0\0\377\3Z_n" \
+  "\377^h\214\377FGM\377\203\0\0\0\377\3cfq\377ir\220\377ACF\377\202\0\0" \
+  "\0\377\3\"#%\377HU\201\377+;q\377\203,<r\377\2#4l\377\30)d\377\222\31" \
+  "*e\377\2\30)d\377#3k\377\203(8o\377\202'7o\377\3&6o\377%5l\377\30)d\377" \
+  "\205\31*e\377\6FS\203\377GS\204\377GU\204\377HV\205\377%6m\377\30)d\377" \
+  "\203\31*e\377\10\30)d\377\32,f\377HU\205\377HV\205\377GV\205\377HV\205" \
+  "\377IV\205\377IU\205\377\202IV\205\377\4HW\204\377IW\205\377JW\206\377" \
+  "IW\205\377\202JW\206\377\1JV\206\377\202JW\206\377\4IX\206\377JX\206" \
+  "\377KX\206\377JX\206\377\202KX\205\377\7KW\207\377KW\206\377KY\207\377" \
+  "JY\207\377KX\207\377LY\207\377KY\207\377\206LY\207\377\1LX\207\377\202" \
+  "LY\207\377\202KY\206\377\202KZ\206\377\214LZ\207\377\202KZ\206\377\1" \
+  "KY\206\377\202LY\207\377\202LX\207\377\205LY\207\377\7KY\207\377LY\207" \
+  "\377KY\207\377N]\215\377\23\30#\377\0\0\0\377\5\5\5\377\212\10\10\10" \
+  "\377\5\1\1\1\377\0\0\0\3773<^\377IW\205\377HW\204\377\202IV\205\377\12" \
+  "IU\205\377HV\205\377IV\205\377GU\204\377FT\204\377\\h\221\377+++\377" \
+  "\0\0\0\377\1\1\1\377\12\12\12\377\202\0\0\0\377\23\211\216\236\377oy" \
+  "\233\377\31\31\31\377\0\0\0\377\7\7\7\377\6\6\6\377\0\0\0\377\6\6\6\377" \
+  "fl\177\377ER\202\377CP\201\377v\200\242\377\"!\37\377\0\0\0\377\11\11" \
+  "\10\377io\205\377CR\201\377px\221\377\2\2\2\377\202\0\0\0\377\5imz\377" \
+  "LY\210\377DR\202\377\77M\177\377\203\210\231\377\202\0\0\0\377\13\34" \
+  "\35\35\377ceo\377`co\377adp\377^_c\377\3\3\3\377\0\0\0\377235\377T`\211" \
+  "\377_h\214\377\34\34\35\377\202\0\0\0\377\3\210\215\236\377GU\207\377" \
+  "loy\377\202\0\0\0\377\5++,\377kmu\377hks\377kmv\377SST\377\202\0\0\0" \
+  "\377\30""79=\377NZ\206\377iq\223\377!\40\37\377\0\0\0\377\1\1\0\377\4" \
+  "\5\5\377\11\11\11\377#$%\377LNQ\377iq\216\377\26(d\377\24&c\377\201\210" \
+  "\236\377\23\23\20\377\0\0\0\377\1\1\1\377\5\5\5\377\11\11\12\377'()\377" \
+  "QRW\377x\200\234\377<J|\377;J|\377\202;I|\377\6;H|\377;I|\377:I{\377" \
+  "9Hz\377ag~\377\6\6\6\377\202\0\0\0\377\2hjn\377~\201\214\377\202}\200" \
+  "\212\377\5|\177\212\377ry\222\377\31*f\377Wa\201\377\20\17\16\377\202" \
+  "\0\0\0\377\5\203\207\227\3775Cx\3778Fy\377>M\177\377chv\377\202\0\0\0" \
+  "\377\5###\377kmu\377ehr\377gjs\377WWZ\377\202\0\0\0\377\3))*\377R_\214" \
+  "\377gkv\377\202\0\0\0\377\5--.\377cfp\377`co\377beq\377TUW\377\202\0" \
+  "\0\0\377\3""68=\3776Fy\377_`h\377\202\0\0\0\377\4LMQ\377:J{\3770@v\377" \
+  "\202\206\230\377\202\0\0\0\377\4\12\12\12\377\\e\203\3773Bv\377QRW\377" \
+  "\202\0\0\0\377\5abf\3773Cy\377\24%b\377AN}\377,,.\377\202\0\0\0\377\3" \
+  "uy\210\377\34-j\377RWd\377\202\0\0\0\377\12\17\17\17\377Wb\210\377\25" \
+  "'c\377\\`q\377\4\3\3\377\0\0\0\377!\40\36\377\\h\220\377\40""1l\377\207" \
+  "\213\230\377\202\0\0\0\377\3\36\36\40\377LX\202\377+;q\377\203,<r\377" \
+  "\2\40""1i\377\30)d\377\222\31*e\377\2\30)d\377&6n\377\203(8o\377\203" \
+  "'7o\377\2$4m\377\30)d\377\205\31*e\377\7FT\203\377FS\203\377GT\204\377" \
+  "GU\204\377ES\202\377\33+f\377\30)d\377\203\31*e\377\2\27(d\377'6n\377" \
+  "\205HV\205\377\7IU\205\377IV\205\377IW\205\377IV\205\377IW\205\377JW" \
+  "\206\377IW\205\377\202JW\206\377\4JV\206\377JW\206\377JX\206\377JW\206" \
+  "\377\202JX\206\377\13KX\206\377JX\206\377KX\205\377KX\206\377KW\207\377" \
+  "KX\206\377JY\207\377KY\207\377KX\207\377LY\207\377KY\207\377\210LY\207" \
+  "\377\203LX\207\377\213LY\207\377\204LX\207\377\207LY\207\377\10KY\207" \
+  "\377LY\207\377KY\207\377KX\207\377JX\207\377N\\\215\377\30\34-\377\5" \
+  "\6\11\377\210\6\10\14\377\204\6\7\14\377\2\5\6\12\3775\77`\377\202IW" \
+  "\205\377\3IV\205\377IU\205\377IV\205\377\203HV\205\377\3AO\177\377$3" \
+  "l\377HIO\377\204\0\0\0\377\4\"!\40\377x\201\241\377\\i\225\377OOS\377" \
+  "\204\0\0\0\377\14\14\14\15\377ir\217\377ER\202\377CP\201\377v\200\242" \
+  "\377\"!\37\377\0\0\0\377\11\11\10\377io\205\377CP\201\377px\221\377\2" \
+  "\2\2\377\202\0\0\0\377\5\201\206\232\377DR\202\377CQ\201\377@N\200\377" \
+  "}\202\216\377\202\0\0\0\377\2\10\10\10\377\34\35\36\377\202\36\36\37" \
+  "\377\7\35\35\37\377$$&\377&&(\377GGJ\377_i\220\377^h\214\377\34\34\35" \
+  "\377\202\0\0\0\377\3\210\215\236\377N\\\215\377VX^\377\202\0\0\0\377" \
+  "\17\15\15\16\377\36\37\40\377\37\37\40\377\36\37\40\377\37\40!\377&&" \
+  "(\377%&'\377IJN\377Ua\212\377+:q\377_h\207\377<>F\377))-\377\31\31\30" \
+  "\377\7\7\6\377\202\0\0\0\377\11\37\37\36\377u|\227\377\34-g\377CQ\202" \
+  "\377qx\216\377@AH\377((+\377\26\26\26\377\5\5\4\377\202\0\0\0\377\13" \
+  "--,\377oy\227\3776Fy\377;J|\377;H|\377;I|\377:I{\3779Iz\3779Hz\377ag" \
+  "~\377\6\6\6\377\202\0\0\0\377\2kp\201\377\34-j\377\203\26(e\377\13\26" \
+  "(d\377\24%b\377Wa\201\377\20\17\16\377\0\0\0\377\21\20\16\377t{\227\377" \
+  "3Bv\3777Fy\377BQ\202\377TWb\377\202\0\0\0\377\2\13\13\13\377\36\36\40" \
+  "\377\202\36\37\40\377\6\36\37!\377%&(\377$%'\377:;>\377`l\224\377TV_" \
+  "\377\202\0\0\0\377\2\15\15\15\377\35\36\37\377\202\36\36\37\377\1\36" \
+  "\36\40\377\202%%'\377\3IKO\377>L~\377XZ`\377\202\0\0\0\377\12SU\\\377" \
+  "4Cw\377.>t\377~\205\233\377\5\4\3\377\0\0\0\377\12\12\12\377\\d\202\377" \
+  "<J|\377IIM\377\202\0\0\0\377\5tv}\377\35.i\377\26(c\3772At\37789;\377" \
+  "\202\0\0\0\377\3uy\205\377\37/k\377RWd\377\202\0\0\0\377\12**+\377ES" \
+  "\201\377\25'c\377Z_q\377\4\4\4\377\0\0\0\377:;:\377@O\202\377\37""0k" \
+  "\377\212\216\235\377\202\0\0\0\377\10\36\36\40\377LX\202\377+;q\377," \
+  "<r\377+<q\377,<r\377\35.h\377\30)d\377\221\31*e\377\202\30)d\377\2(8" \
+  "o\377'7n\377\202(8o\377\5'7o\377'7n\377'7o\377\32+e\377\30)d\377\205" \
+  "\31*e\377\6ET\202\377FT\203\377FS\203\377FT\203\377GU\204\3774Cw\377" \
+  "\205\31*e\377\16\30)d\3773Bw\377HV\205\377GU\204\377HV\205\377IV\205" \
+  "\377HV\205\377IU\205\377IV\205\377IW\205\377HW\204\377IW\205\377JW\206" \
+  "\377IW\205\377\202JW\206\377\4JV\206\377JW\206\377JX\206\377IX\206\377" \
+  "\202JX\206\377\1KX\206\377\202KX\205\377\10KX\206\377KW\207\377KX\207" \
+  "\377JX\207\377JY\207\377KY\207\377LY\207\377KY\207\377\212LY\207\377" \
+  "\213LX\207\377\214LY\207\377\202KY\207\377\4JY\207\377KX\206\377KX\207" \
+  "\377EQ|\377\204COx\377\204BOx\377\206BNx\377\5FT\200\377IV\205\377IW" \
+  "\205\377IU\205\377IV\205\377\202HV\205\377\6GU\204\377GT\204\377#3l\377" \
+  "\32*e\377PTa\377\1\1\1\377\203\0\0\0\377\4UWZ\377Vc\217\377ET\204\377" \
+  "\210\213\227\377\204\0\0\0\377\14\37\37!\377eo\223\377ER\202\377CP\201" \
+  "\377u\200\242\377\"!\37\377\0\0\0\377\11\11\10\377io\205\377CQ\201\377" \
+  "px\221\377\2\2\2\377\202\0\0\0\377\22\206\214\243\377BP\201\377DQ\201" \
+  "\377/>t\377x}\222\377\3\3\1\377\0\0\0\377\34\34\34\377_i\212\3774Br\377" \
+  "3Br\377Vb\214\377^i\221\377_i\220\377Wb\213\377JW\205\377^h\215\377\34" \
+  "\34\35\377\202\0\0\0\377\3\210\215\236\377CQ\204\377y}\207\377\202\0" \
+  "\0\0\377\20##%\377py\227\377Vb\211\377Xc\213\377s|\240\377gr\227\377" \
+  "Ze\216\377S_\210\377HU\203\377'7p\377;J\177\377Xe\221\377^i\220\377L" \
+  "W\177\377fl\201\377457\377\202\0\0\0\377\11VXa\377@N\202\377LY\211\377" \
+  "]j\226\377t\177\244\377w\201\241\377cm\215\377pu\204\377//1\377\202\0" \
+  "\0\0\377\12~\201\215\377;J}\377:I{\377;H|\377;I|\377:I{\3779Iz\3779H" \
+  "z\377ag~\377\6\6\6\377\202\0\0\0\377\2ko\200\377\36/i\377\204\30)d\377" \
+  "\12\24&b\377Wa\201\377\20\17\16\377\0\0\0\377\30\27\25\377nw\227\377" \
+  "3Bv\3777Fy\377<K}\377mr\203\377\202\0\0\0\377\12\21\21\21\377y\200\234" \
+  "\377O[\204\377P\\\205\377ht\230\377al\223\377T_\211\377IV\203\377,<s" \
+  "\377tw\204\377\202\0\0\0\377\12&')\377S_\205\3777Et\3777Eu\377Xd\215" \
+  "\377JW\204\377;Ix\3774Ct\377\32,g\377rt|\377\202\0\0\0\377\4""89:\377" \
+  "an\230\377@O\203\377loz\377\202\0\0\0\377\4\12\12\12\377\\e\203\3771" \
+  "@u\377SV`\377\202\0\0\0\377\12AA@\377JY\213\377\14\36^\377_k\217\377" \
+  "\31\30\26\377\0\0\0\377\11\11\7\377gn\207\377\35.j\377RWd\377\202\0\0" \
+  "\0\377\12))*\377ES\201\377\25&c\377Z_q\377\4\4\4\377\0\0\0\377999\377" \
+  "AP\202\377\"2l\377\212\216\235\377\202\0\0\0\377\3\36\36\40\377LX\202" \
+  "\377+;q\377\203,<r\377\2\32+e\377\30)d\377\221\31*e\377\2\30)d\377\32" \
+  "+f\377\204(8o\377\202'7o\377\2(7o\377\30)d\377\206\31*e\377\3FT\203\377" \
+  "ET\202\377GS\204\377\202FT\203\377\3ES\203\377\37/i\377\30)d\377\203" \
+  "\31*e\377\6\30)d\377\32+e\377BO\200\377HV\205\377HU\204\377HV\205\377" \
+  "\202IV\205\377\3IU\205\377IW\205\377IV\205\377\202IW\205\377\2JW\206" \
+  "\377IW\205\377\202JW\206\377\6JV\206\377JW\206\377JX\206\377JW\206\377" \
+  "IX\206\377JX\206\377\202KX\206\377\11JX\206\377KX\205\377KX\206\377K" \
+  "W\207\377KX\207\377JX\207\377JY\207\377KX\207\377KY\207\377\202LY\207" \
+  "\377\1KY\207\377\227LY\207\377\1KY\207\377\202LY\207\377\202KY\207\377" \
+  "\4JY\207\377JX\207\377KX\206\377KW\207\377\203KX\206\377\2JX\206\377" \
+  "KX\206\377\202JX\206\377\4JW\206\377JX\206\377JW\206\377JV\206\377\204" \
+  "JW\206\377\17IW\205\377HW\204\377IV\205\377IW\205\377IV\205\377IU\205" \
+  "\377IV\205\377HV\205\377GV\205\377IW\205\377/\77t\377\27(c\377\31*e\377" \
+  "RZs\377\4\4\4\377\202\0\0\0\377\6\3\3\2\377ko{\377CR\202\377CQ\202\377" \
+  "}\204\240\377\30\27\25\377\203\0\0\0\377\14CDG\377[g\222\377FS\203\377" \
+  "BP\201\377u\200\242\377\"!\37\377\0\0\0\377\11\11\10\377io\205\377CQ" \
+  "\201\377px\221\377\2\2\2\377\202\0\0\0\377\22\206\215\243\377AO\200\377" \
+  "CP\200\377\"3j\377EQ\201\37799:\377\0\0\0\377\4\4\3\377acl\377NY\200" \
+  "\377Xb\205\377\\]a\377ZZ_\377lou\377\221\226\242\377T`\213\377^h\214" \
+  "\377\34\34\35\377\202\0\0\0\377\25\210\215\236\3777G{\377|\204\240\377" \
+  "\37\36\35\377\0\0\0\377\11\11\11\377imx\377bl\220\377ry\222\377QRU\377" \
+  "]^c\377qry\377\216\223\243\377lw\237\377y{\200\377EFH\377442\377TUY\377" \
+  "<Jw\3778Fy\377`cp\377\202\0\0\0\377\25jmz\377is\231\377mot\377DDF\377" \
+  "/.,\377WY^\377Ze\215\377Ua\211\377QT\\\377\0\0\0\377\2\1\0\377\200\205" \
+  "\225\3775Ez\377:I{\377;H|\377;I|\377:I{\3779Iz\3779Hz\377ag~\377\6\6" \
+  "\6\377\202\0\0\0\377\2ko\200\377\36/j\377\204\31*e\377\13\24&b\377Wa" \
+  "\201\377\20\17\16\377\0\0\0\377\32\32\27\377lv\227\3773Bv\3776Fy\377" \
+  "4Cw\377r|\234\377%%$\377\202\0\0\0\377'`cm\377\\g\213\377gp\215\377W" \
+  "W[\377Z\\`\377mov\377\215\220\240\3772Bw\377bl\216\377\"!\40\377\0\0" \
+  "\0\377\14\13\13\377bet\377FS~\377`i\206\377QQT\377YZa\377jmu\377\201" \
+  "\210\234\377!2k\377_g\202\377\20\20\17\377\0\0\0\377\2\2\2\377MMP\377" \
+  "lmt\377\24\24\23\377\6\6\6\377\0\0\0\377\12\12\12\377\\e\203\3771@u\377" \
+  "fl\206\377\15\15\15\377\0\0\0\377\5\5\5\377]_f\377rx\211\377HHL\377\202" \
+  "\0\0\0\377\4""225\377EQ\177\377!1l\377RWd\377\202\0\0\0\377\12))*\377" \
+  "FS\201\377\25&c\377Z_q\377\4\4\4\377\0\0\0\377999\377BP\202\377$5n\377" \
+  "\212\216\235\377\202\0\0\0\377\3\36\36\40\377LX\202\377+;q\377\202,<" \
+  "r\377\1+:q\377\223\31*e\377\2\30)d\377\34-g\377\203(8o\377\5'7o\377&" \
+  "6o\377'7o\377(7n\377\30)d\377\206\31*e\377\11FT\203\377ET\202\377FT\203" \
+  "\377GS\204\377FU\203\377GU\204\377>L}\377\26(c\377\30)d\377\203\31*e" \
+  "\377\3\30)d\377\35.h\377GT\204\377\204HV\205\377\10IU\205\377IV\205\377" \
+  "IW\205\377IV\205\377HW\204\377IW\205\377JW\206\377IW\205\377\202JW\206" \
+  "\377\5JV\206\377JW\206\377JX\206\377JW\206\377IX\206\377\202JX\206\377" \
+  "\202KX\206\377\5KX\205\377KX\206\377KW\206\377KW\207\377KX\206\377\202" \
+  "JY\207\377\2KX\207\377KY\207\377\202LY\207\377\1KY\207\377\223LY\207" \
+  "\377\1KY\207\377\202LY\207\377\10KY\207\377KX\207\377KY\207\377JY\207" \
+  "\377KX\207\377KW\206\377KW\207\377KX\206\377\202KX\205\377\202KX\206" \
+  "\377\1JX\206\377\202IX\206\377\3JX\206\377JW\206\377JV\206\377\203JW" \
+  "\206\377\203IW\205\377\4IV\205\377IW\205\377IV\205\377IU\205\377\202" \
+  "HV\205\377\10GV\205\377IV\205\3776Dx\377\27(d\377\30*e\377\31*e\377S" \
+  "]\202\377\4\4\4\377\202\0\0\0\377\6\13\13\13\377ks\215\377ES\203\377" \
+  "ER\203\377\\h\222\377DDF\377\203\0\0\0\377\13ps\177\377MZ\212\377ES\203" \
+  "\377BP\201\377u\200\242\377\36\36\33\377\0\0\0\377\5\4\4\377hn\205\377" \
+  "CQ\201\377px\221\377\203\0\0\0\377\7\206\215\243\377BO\200\377=K}\377" \
+  "\31*e\377\32+e\377]f\204\377...\377\202\0\0\0\377\2\31\30\30\377\27\27" \
+  "\27\377\202\0\0\0\377\5@AB\377nv\225\377@N\177\377_h\215\377\30\31\32" \
+  "\377\202\0\0\0\377\5\210\215\236\377;J}\377FT\203\377qx\215\377\31\31" \
+  "\31\377\202\0\0\0\377\2\36\36\37\377\21\21\20\377\202\0\0\0\377\31UV" \
+  "X\377fp\225\377#2l\377ip\207\377\21\20\16\377\0\0\0\377\1\1\1\377\"#" \
+  "%\377'(+\377\5\5\5\377\0\0\0\377EEF\377\\g\214\377:I}\377w{\207\377\7" \
+  "\6\3\377\0\0\0\377\2\2\2\377'')\377%&(\377\3\3\3\377\0\0\0\377PQS\377" \
+  "\\h\217\3778Gz\377\203;I|\377\5""9Iz\377:I{\3779Hz\377`f}\377\2\2\1\377" \
+  "\202\0\0\0\377\2jo\177\377\36/j\377\204\31*e\377\14\24&b\377Wa\200\377" \
+  "\14\13\12\377\0\0\0\377\27\26\24\377lv\227\3773Bv\3776Fy\3776Ex\377;" \
+  "I|\377mu\220\377(((\377\202\0\0\0\377\2\35\35\36\377\24\24\24\377\202" \
+  "\0\0\0\377\6HHH\377]h\217\377\25&b\377\37""0j\377bh\202\377\31\31\30" \
+  "\377\202\0\0\0\377\2\35\36\36\377\22\21\21\377\202\0\0\0\377\5SSW\377" \
+  "HT\201\377\30)d\3770\77r\377RTY\377\204\0\0\0\377\11VY_\377122\377\0" \
+  "\0\0\377\6\6\6\377\\e\203\3770\77t\377\77M\177\377uy\205\377\20\20\15" \
+  "\377\202\0\0\0\377\1\2\2\1\377\202\0\0\0\377\5///\377ck\205\377\32+f" \
+  "\377$4m\377QVc\377\202\0\0\0\377\4&&'\377FS\201\377\25&c\377Y^p\377\202" \
+  "\0\0\0\377\4""667\377DR\204\377%6n\377\212\216\235\377\202\0\0\0\377" \
+  "\6\32\33\34\377LX\202\377+;q\377,<r\377,;r\377)8o\377\223\31*e\377\2" \
+  "\30)d\377\37/h\377\203(8o\377\5'7o\377&6o\377'7o\377(7n\377\30)d\377" \
+  "\206\31*e\377\202FT\203\377\7ET\202\377FT\203\377GS\204\377FU\203\377" \
+  "GU\204\3773Cw\377\30)d\377\204\31*e\377\13\30)d\377(8n\377GU\204\377" \
+  "HV\205\377GU\204\377HV\205\377IV\205\377HV\205\377IV\205\377IW\205\377" \
+  "IV\205\377\202IW\205\377\2JW\206\377IW\205\377\202JW\206\377\202JV\206" \
+  "\377\203JX\206\377\1IX\206\377\202JX\206\377\202KX\206\377\1KX\205\377" \
+  "\202KX\206\377\7KW\207\377KX\207\377KX\206\377JX\207\377JY\207\377KY" \
+  "\207\377KX\207\377\202KY\207\377\204LY\207\377\1KY\207\377\205LY\207" \
+  "\377\1KY\207\377\204LY\207\377\202KY\207\377\7KX\207\377KY\207\377JY" \
+  "\207\377JX\207\377KX\206\377KX\207\377KW\207\377\202KX\206\377\202KX" \
+  "\205\377\202KX\206\377\1JX\206\377\202IX\206\377\202JX\206\377\2JW\206" \
+  "\377JV\206\377\204JW\206\377\14IW\205\377HW\204\377IV\205\377IW\205\377" \
+  "IV\205\377HV\205\377IV\205\377HV\205\377GU\204\377HV\205\377AO\200\377" \
+  "\34-g\377\202\31*e\377\13\30)d\377AN|\377LMQ\377\77@B\377ABD\377OPS\377" \
+  "`l\220\377FS\203\377GT\204\377DR\202\377ru\200\377\202ABD\377\22==>\377" \
+  "\207\214\237\377BP\201\377ES\203\377BP\201\377r}\240\377RQQ\377AAC\377" \
+  "FFG\377qw\217\377BQ\201\377px\222\377BCE\377ABD\377\77\77A\377\200\207" \
+  "\236\377CP\201\377&7n\377\202\30)d\377\77\27(d\377mu\224\377fis\377B" \
+  "CF\377$%&\377#$%\37778:\377wy\204\377nz\235\377>L}\377@N\177\377_i\216" \
+  "\377QQU\377ABD\377@@A\377\206\213\235\377;K|\377@N\177\377ES\203\377" \
+  "\203\212\237\377egp\377\77@B\377\40\40!\377&'(\377<>@\377|\200\215\377" \
+  "\\g\221\3779Gz\377\36.h\377\35.h\377s{\225\377QSX\377-./\377\37\40!\377" \
+  "((*\377DDH\377dgs\377LY\204\377\30)d\377=K}\377DR\202\377\206\213\236" \
+  "\377LMQ\377-./\377\37\37\40\377--/\377HIM\377qu\177\377bm\224\377:I{" \
+  "\377;J|\377;I|\377:I{\377;I|\3779Iz\377:I{\3779Hz\377jq\211\377CDF\377" \
+  "@@C\377<<>\377qu\206\377\35.i\377\204\31*e\377\7\24&b\377[e\206\377H" \
+  "HI\377\77@C\377NNN\377lv\227\3773Bv\377\2037Fy\377D8Fz\377w\177\232\377" \
+  "gjs\377BCE\377\"\"#\377%&'\37799;\377tw\204\377]i\221\377%5m\377\30)" \
+  "d\377\31*e\377\36/i\377u|\225\377^ak\377==@\377\40\40!\377&'(\377;<>" \
+  "\377sw\210\377;I|\377\25&b\377\31*e\377\27(d\377KX\206\377iks\377../" \
+  "\377113\377ehq\377y\204\247\377Z[\\\377@@B\377FGI\377`i\210\3770\77t" \
+  "\377/\77t\377:I|\377z\201\233\377PRW\377./0\377!\"#\3779:<\377fhr\377" \
+  "[f\216\377\27(d\377\30)d\377\"3l\377bfu\377=>@\377>\77A\377STW\377BO" \
+  "}\377\25'c\377fl\177\377BCE\377\77@B\377]^`\377GU\205\377%6n\377\207" \
+  "\214\234\377;<=\377@AC\377QRU\377KX\202\377+;q\377,<r\377,;r\377&6m\377" \
+  "\223\31*e\377\2\30)d\377\40""1j\377\203(8o\377\5'7o\377&6o\377'7o\377" \
+  "'7n\377\30)d\377\206\31*e\377\202FT\203\377\3ET\202\377FT\203\377GT\204" \
+  "\377\203FT\203\377\2%5m\377\30)d\377\204\31*e\377\17\30)d\377/\77t\377" \
+  "KX\206\377GU\204\377GV\205\377HV\205\377IV\205\377IU\205\377IV\205\377" \
+  "IW\205\377IV\205\377HW\204\377IW\205\377JW\206\377IW\205\377\205JW\206" \
+  "\377\4JX\206\377JW\206\377IX\206\377JX\206\377\202KX\206\377\1JX\206" \
+  "\377\202KX\205\377\6KX\206\377KW\206\377KW\207\377KX\207\377KX\206\377" \
+  "JX\207\377\202JY\207\377\2KY\207\377KX\207\377\203KY\207\377\207LY\207" \
+  "\377\203KY\207\377\2KX\207\377KY\207\377\202JY\207\377\6JX\207\377KX" \
+  "\206\377KX\207\377KW\207\377KW\206\377KX\206\377\202KX\205\377\2JX\206" \
+  "\377KX\206\377\202JX\206\377\2IX\206\377JX\206\377\203JW\206\377\1JV" \
+  "\206\377\202JW\206\377\17IW\205\377JW\206\377IW\205\377HW\204\377IV\205" \
+  "\377IW\205\377IV\205\377IU\205\377IV\205\377HV\205\377GV\205\377HV\205" \
+  "\377DS\202\377\37""0i\377\30)d\377\202\31*e\377\13\30)d\377\37/i\377" \
+  "2Cx\377R`\216\377`l\227\377^k\226\377KX\207\377FS\203\377FT\203\377E" \
+  "S\202\377Xe\220\377\202_k\226\377\6`k\227\377S_\214\377ER\202\377DS\203" \
+  "\377DR\202\377O\\\211\377\203^j\225\377\3S`\215\377CQ\201\377Q]\213\377" \
+  "\203]j\225\377\3S_\213\377;J|\377\27(c\377\202\31*e\3772\30)d\377\25" \
+  "&b\377$5o\3774Dz\377CP~\377HT\202\377^j\223\377IW\207\377\77M~\377AO" \
+  "\200\377@N\177\377IV\205\377Zg\223\377Zg\224\377[g\224\377S`\214\377" \
+  ">M~\377@N\177\377\77M~\377>M\177\377M[\212\377Zf\222\377cn\223\377`k" \
+  "\223\377[g\222\377CQ\203\377=K|\3775Dx\377\30)e\377\30)d\377\25&c\377" \
+  "1@w\377\77M}\377FR\200\377BP~\3775Dz\377%6o\377\26'c\377'7o\377>L}\377" \
+  "<J|\377;J}\377Tb\217\377\\h\220\377ak\221\377]h\220\377S`\216\377FS\205" \
+  "\3778Gz\377:I{\377\203;I|\377\5:I{\3779Iz\377:I{\3779Hz\377AO\201\377" \
+  "\2036F{\377\1""0\77u\377\205\31*e\377\7\30)d\377*:q\3775E{\3779I~\377" \
+  "S`\216\377DQ\201\3776Ex\377\2037Fy\377\25""6Dx\3774Cx\377BP\203\377P" \
+  "]\214\377[f\216\377Zf\215\377Sa\215\377<J~\3774Cw\377\35.h\377\30)d\377" \
+  "\31*e\377\30)d\377\27(d\377'7q\3777F{\377ER\177\377CP~\3779H{\377\34" \
+  "-i\377\26'c\377\203\31*e\377\6\23$a\377CQ\203\377Ta\214\377S`\213\377" \
+  "\77N\201\3778Fz\377\202LZ\212\377\20LZ\211\377>L~\3770\77t\3771@u\377" \
+  "0\77t\3770\77u\3775E{\377\77M~\377ER\177\3779H|\377'7q\377\25&b\377\30" \
+  ")d\377\31*e\377\32+f\377/\77u\377\2026F{\377\4""4Dz\377!2j\377\30)d\377" \
+  "/>u\377\2026F{\377\14""4Dz\377/>s\377+;q\377CR\201\377IV\207\377HU\207" \
+  "\377HU\206\3773Cw\377+;q\377,<r\377,;q\377#3l\377\223\31*e\377\2\30)" \
+  "d\377\"2k\377\203(8o\377\5'7o\377&6o\377'7o\377#3k\377\30)d\377\206\31" \
+  "*e\377\203FT\203\377\10ET\202\377FT\203\377GS\204\377GT\204\377GU\204" \
+  "\377FT\203\377\31+e\377\30)d\377\203\31*e\377\4\30)d\377\27)d\3770@t" \
+  "\377IW\205\377\202GV\205\377\202HV\205\377\2IU\205\377IV\205\377\202" \
+  "IW\205\377\4HW\204\377IW\205\377JW\206\377IW\205\377\202JW\206\377\1" \
+  "JV\206\377\202JW\206\377\3JX\206\377JW\206\377IX\206\377\202JX\206\377" \
+  "\4KX\206\377JX\206\377KX\206\377KX\205\377\202KX\206\377\6KW\206\377" \
+  "KW\207\377KX\207\377KX\206\377KX\207\377JX\207\377\203JY\207\377\211" \
+  "KY\207\377\203JY\207\377\6JX\207\377KX\207\377KX\206\377KX\207\377KW" \
+  "\207\377KW\206\377\202KX\206\377\4KX\205\377KX\206\377JX\206\377KX\206" \
+  "\377\202JX\206\377\2IX\206\377JW\206\377\202JX\206\377\202JV\206\377" \
+  "\202JW\206\377\3IW\205\377JW\206\377IW\205\377\202HW\204\377\3IW\205" \
+  "\377IV\205\377IU\205\377\202IV\205\377\5HV\205\377GU\204\377FT\203\377" \
+  "\37/h\377\30)d\377\204\31*e\377\3\27(c\377.>s\377HV\204\377\202FT\203" \
+  "\377\4FS\203\377FT\203\377ET\202\377FT\203\377\203ES\202\377\202ER\202" \
+  "\377\11ES\203\377DS\203\377ES\202\377DR\203\377DS\201\377DR\201\377D" \
+  "Q\201\377CQ\201\377DR\202\377\203CQ\201\377\4CR\202\377DQ\201\377%4m" \
+  "\377\30)d\377\203\31*e\377\204\30)d\377\2""1Au\377BP\200\377\202AO\177" \
+  "\377\2AO\200\377@N\200\377\203@N\177\377\5AN\200\377\77N~\377@N\177\377" \
+  "@M\177\377@N\177\377\202\77M~\377\1@N~\377\204>L~\377\4\77M~\377'6n\377" \
+  "\30)d\377\31*e\377\207\30)d\377\2\26'c\377:Iz\377\202=K}\377\203;J|\377" \
+  "\204;I{\377\5:J|\377;J|\377;I|\377;H|\377;I|\377\204:I{\377\1'7n\377" \
+  "\205\30)d\377\205\31*e\377\202\30)d\377\20%5l\3779Gz\3778Ex\3776Fy\377" \
+  "7Fy\3777Ey\3777Fy\3777Dy\3776Dx\3775Dx\3775Dy\3775Dx\3775Ew\3775Dw\377" \
+  "5Dx\3774Cw\377\202\30)d\377\202\31*e\377\210\30)d\377\202\31*e\377\4" \
+  "\30)d\377\35.h\3773Bv\3771Bu\377\2031@u\377\4""1@v\3771@u\3771@t\377" \
+  "0\77t\377\2031@u\377\2/>s\377\33,f\377\205\30)d\377\202\31*e\377\206" \
+  "\30)d\377\1\31*e\377\203\30)d\377\4\27(d\377,<r\377-=r\377,=q\377\203" \
+  ",;q\377\1+;q\377\202,<r\377\3+;q\377\40""1j\377\30)d\377\223\31*e\377" \
+  "\3$4l\377'7n\377(8o\377\202'7o\377\4&6o\377'7o\377\34-g\377\30)d\377" \
+  "\206\31*e\377\1FS\203\377\203FT\203\377\6ET\202\377FT\203\377GS\204\377" \
+  "FT\203\377GU\204\377=L}\377\207\31*e\377\7""7Fy\377IW\205\377GU\204\377" \
+  "GV\205\377HV\205\377IV\205\377IU\205\377\202IV\205\377\2IW\205\377HW" \
+  "\204\377\202IW\205\377\2JW\206\377IW\205\377\202JW\206\377\1JV\206\377" \
+  "\202JW\206\377\202JX\206\377\202IX\206\377\202JX\206\377\202KX\206\377" \
+  "\1JX\206\377\202KX\205\377\203KX\206\377\1KW\206\377\204KW\207\377\2" \
+  "KX\207\377KX\206\377\203KX\207\377\2KX\206\377KX\207\377\204KW\207\377" \
+  "\1KW\206\377\203KX\206\377\202KX\205\377\1JX\206\377\202KX\206\377\202" \
+  "JX\206\377\202IX\206\377\2JW\206\377JX\206\377\202JW\206\377\1JV\206" \
+  "\377\202JW\206\377\1IW\205\377\202JW\206\377\202IW\205\377\4IV\205\377" \
+  "IW\205\377IV\205\377IU\205\377\202IV\205\377\5HU\204\377HV\205\377HU" \
+  "\204\377'7n\377\30)d\377\204\31*e\377\10\30)d\377#3k\377GU\204\377FT" \
+  "\203\377GU\204\377GT\204\377FS\203\377ET\202\377\203FT\203\377\4FS\203" \
+  "\377FR\203\377ES\203\377FS\203\377\202ES\203\377\5ES\202\377ER\201\377" \
+  "DR\202\377EQ\202\377CR\202\377\205DR\202\377\3CQ\201\377=K|\377\33,f" \
+  "\377\207\31*e\377\6\34-g\377>L}\377AO\177\377AO\200\377BP\200\377@N\200" \
+  "\377\204AO\200\377\4@O\177\377\77N~\377@N\177\377@M\177\377\203@N\177" \
+  "\377\2\77M\177\377>L\177\377\202\77M\177\377\2\77M}\377>L}\377\202\30" \
+  ")d\377\207\31*e\377\11\30)d\377!2j\377>K}\377=J|\377<K}\377;K}\377<K" \
+  "}\377<J|\377<I{\377\202<J|\377\5;J|\377:J|\377;J|\377;I|\377;H|\377\203" \
+  ":I{\377\4""9Hz\377:I{\377\36.h\377\30)d\377\212\31*e\377\4\27(c\3770" \
+  "\77t\3778Fy\3776Fy\377\2037Fy\377\7""7Ey\3776Ey\3775Ey\3776Ey\3776Ex" \
+  "\3776Ew\3776Ex\377\2026Dx\377\2-=s\377\30)d\377\215\31*e\377\4\30)d\377" \
+  "#3k\3772Bv\3771Av\377\2032Av\377\3""2Au\3772At\3770\77u\377\2041@u\377" \
+  "\2-<r\377\32+f\377\220\31*e\377\6\30)d\377\32*e\377-=s\377,=q\377-;r" \
+  "\377-<r\377\202,<r\377\1+<r\377\202,<r\377\3+;q\377\36.h\377\30)d\377" \
+  "\222\31*e\377\2\32*e\377%5m\377\203(8o\377\1&6o\377\202'7o\377\1\34-" \
+  "g\377\207\31*e\377\1FR\203\377\202FS\203\377\202FT\203\377\1ET\202\377" \
+  "\202FT\203\377\4FU\203\377GU\204\3771@u\377\30)d\377\204\31*e\377\202" \
+  "\30)d\377\4;J|\377IW\205\377GU\204\377GV\205\377\202HV\205\377\202IU" \
+  "\205\377\202IV\205\377\202HW\204\377\1IW\205\377\204JW\206\377\202JV" \
+  "\206\377\202JW\206\377\2JX\206\377JW\206\377\202IX\206\377\202JX\206" \
+  "\377\202KX\206\377\1JX\206\377\203KX\205\377\205KX\206\377\1KW\206\377" \
+  "\205KW\207\377\1KW\206\377\205KX\206\377\203KX\205\377\3KX\206\377JX" \
+  "\206\377KX\206\377\203JX\206\377\5IX\206\377JX\206\377JW\206\377JX\206" \
+  "\377JW\206\377\202JV\206\377\204JW\206\377\202IW\205\377\1HW\204\377" \
+  "\202IW\205\377\2IV\205\377IU\205\377\204HV\205\377\2JW\205\377%5m\377" \
+  "\202\30)d\377\203\31*e\377\3\30)d\377\31*e\377BP\200\377\202GU\204\377" \
+  "\2GT\204\377GS\204\377\205FT\203\377\203FS\203\377\10ES\203\377DS\203" \
+  "\377ES\203\377ER\202\377ES\201\377ER\202\377DQ\202\377CR\202\377\203" \
+  "DR\202\377\5DQ\201\377CQ\201\377EQ\201\377,;q\377\30)d\377\206\31*e\377" \
+  "\2\30)d\377*9p\377\203BP\200\377\2AO\200\377@N\200\377\204AO\200\377" \
+  "\3@N\177\377@O\177\377@M\177\377\204@N\177\377\202\77M\177\377\5\77M" \
+  "~\377\77M\177\377\77M~\377.=s\377\27(d\377\210\31*e\377\2\30)d\377/\77" \
+  "t\377\202=K}\377\203<K}\377\1<I{\377\203<J|\377\1:J|\377\202;J|\377\4" \
+  ";H|\377;I|\377:I{\3779Iz\377\202:I{\377\3""7Fx\377\27(c\377\30)d\377" \
+  "\211\31*e\377\4\30)d\377\31+e\3778Fz\3778Fx\377\2047Fy\377\13""7Ey\377" \
+  "6Ey\3775Ey\3776Ey\3776Ex\3776Ew\3776Ex\3775Dx\3776Dx\377&6n\377\30)d" \
+  "\377\215\31*e\377\5\30)d\377*9p\3772Bv\3772Av\3772@v\377\2022Av\377\3" \
+  "2Au\3772At\3770\77u\377\2031@u\377\2""0\77t\377+:q\377\221\31*e\377\4" \
+  "\30)d\377\36/h\377-=s\377-=q\377\203-<r\377\2,<r\377+<r\377\202,<r\377" \
+  "\3+:q\377\33+f\377\30)d\377\222\31*e\377\2\32+f\377'6n\377\203(8o\377" \
+  "\1&6o\377\202'7o\377\1\34-g\377\207\31*e\377\4FS\203\377FR\203\377FT" \
+  "\203\377FS\203\377\202FT\203\377\6ET\202\377GS\204\377FT\203\377FU\203" \
+  "\377IW\205\377+;r\377\202\30)d\377\204\31*e\377\3\27)d\3779Hz\377HV\205" \
+  "\377\202GU\204\377\1HV\205\377\202IV\205\377\2IU\205\377IV\205\377\202" \
+  "IW\205\377\1HW\204\377\202IW\205\377\205JW\206\377\1JV\206\377\202JW" \
+  "\206\377\203JX\206\377\202IX\206\377\203JX\206\377\210KX\206\377\205" \
+  "KX\205\377\210KX\206\377\203JX\206\377\202IX\206\377\1JW\206\377\202" \
+  "JX\206\377\202JW\206\377\202JV\206\377\205JW\206\377\5IW\205\377HW\204" \
+  "\377IV\205\377IW\205\377IV\205\377\202IU\205\377\7IV\205\377HV\205\377" \
+  "GU\204\377HV\205\377FT\204\377)9o\377\30)d\377\204\31*e\377\4\30)d\377" \
+  "\33+f\377\77N\177\377GU\204\377\202FT\203\377\17GS\204\377FT\203\377" \
+  "ET\202\377FT\203\377FS\203\377FT\203\377FS\203\377FR\203\377FS\203\377" \
+  "ES\203\377DS\203\377ES\203\377ER\202\377ES\201\377DQ\202\377\205DR\202" \
+  "\377\6DQ\201\377DR\202\377DQ\201\377\77M~\377\27)d\377\30)d\377\205\31" \
+  "*e\377\202\30)d\377\1AO\177\377\202BP\200\377\205AO\200\377\202@O\177" \
+  "\377\2\77O~\377@M\177\377\204@N\177\377\204\77M\177\377\4\77M}\377\77" \
+  "M~\377\36.h\377\30)d\377\210\31*e\377\3\33,f\3777Fy\377<J|\377\203<K" \
+  "}\377\2<J|\377<I{\377\202<J|\377\14;J|\377:J|\377;J|\377;I|\377;H|\377" \
+  ";I|\377:I{\3779Iz\3779Hz\377;J{\377*9p\377\27(d\377\212\31*e\377\4\30" \
+  ")d\377#3k\3778Fz\3777Fx\377\2037Fy\377\2027Ey\377\2""6Ey\3775Ey\377\202" \
+  "6Ex\377\5""6Ew\3776Dx\3776Cx\3774Dw\377\40""0i\377\217\31*e\377\11-=" \
+  "r\3771Bv\3772Av\3772@v\3772Av\3772Au\3771@u\3772At\3770\77u\377\2041" \
+  "@u\377\2&6n\377\30)d\377\220\31*e\377\4\30)d\377\"2k\377-=s\377-=q\377" \
+  "\203-<r\377\1+<r\377\203,<r\377\1+:q\377\202\30)d\377\221\31*e\377\2" \
+  "\30)d\377\33,f\377\204(8o\377\1&6o\377\202'7n\377\1\34,f\377\207\31*" \
+  "e\377\16FS\203\377FR\203\377FS\203\377FT\203\377FS\203\377FT\203\377" \
+  "ET\202\377FT\203\377GS\204\377FT\203\377GU\204\377GT\203\377+;q\377\30" \
+  ")d\377\204\31*e\377\5\30)d\377\31*e\3773Av\377KX\206\377GU\205\377\202" \
+  "HV\205\377\7IV\205\377HV\205\377IU\205\377IV\205\377IW\205\377IV\205" \
+  "\377HW\204\377\202IW\205\377\2JW\206\377IW\205\377\203JW\206\377\202" \
+  "JV\206\377\202JW\206\377\202JX\206\377\1JW\206\377\202IX\206\377\204" \
+  "JX\206\377\217KX\206\377\204JX\206\377\202IX\206\377\3JX\206\377JW\206" \
+  "\377JX\206\377\203JW\206\377\1JV\206\377\203JW\206\377\2IW\205\377JW" \
+  "\206\377\202IW\205\377\6HW\204\377IV\205\377IW\205\377IV\205\377IU\205" \
+  "\377IV\205\377\202HV\205\377\4GV\205\377HV\205\377FT\204\377#3k\377\202" \
+  "\30)d\377\205\31*e\377\7;I{\377GU\204\377FT\203\377GU\204\377GT\204\377" \
+  "FS\203\377ET\202\377\203FT\203\377\2FS\203\377FR\203\377\203ES\203\377" \
+  "\3ES\202\377ES\203\377ES\201\377\202ER\202\377\2DR\202\377CR\202\377" \
+  "\204DR\202\377\4CQ\201\377DQ\201\377!2j\377\30)d\377\206\31*e\377\7\27" \
+  "(d\377/>s\377CP\200\377AO\177\377BP\200\377AO\200\377@N\200\377\204A" \
+  "O\200\377\3@N\177\377\77O~\377@M\177\377\203@N\177\377\202\77M\177\377" \
+  "\6>L\177\377\77M~\377\77M\177\377>L~\3777Ex\377\32+e\377\210\31*e\377" \
+  "\2\30)d\377\40""1j\377\202=K}\377\3<K}\377;K}\377<K}\377\204<J|\377\203" \
+  ";J|\377\203;I|\377\1""9Iz\377\202:I{\377\3;J|\377\35-g\377\30)d\377\212" \
+  "\31*e\377\5\30)d\377,<r\3778Fy\3777Fy\3776Fy\377\2027Fy\377\13""7Ey\377" \
+  "7Dy\3775Ey\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\3776Cx\3773Bv\377\35.h" \
+  "\377\216\31*e\377\5\33,f\3770\77t\3771Bv\3772Av\3772@v\377\2022Av\377" \
+  "\3""2Au\3771@t\3770\77u\377\2041@u\377\2\40""1i\377\30)d\377\220\31*" \
+  "e\377\4\30)d\377&5m\377-=r\377-<q\377\203-<r\377\6+<r\377,<r\377,;r\377" \
+  ",<r\377&6n\377\30)d\377\222\31*e\377\2\30)d\377\36/h\377\202(8o\377\5" \
+  "'7o\377(8o\377&6o\377'7o\377$4l\377\210\31*e\377\4ES\203\377FS\203\377" \
+  "FR\203\377FS\203\377\203FT\203\377\4ET\202\377FT\203\377GS\204\377FT" \
+  "\203\377\202GU\204\377\1#3l\377\202\30)d\377\204\31*e\377\12\27(d\377" \
+  "1@u\377GU\204\377HV\205\377GU\204\377HV\205\377IV\205\377HV\205\377I" \
+  "V\205\377IU\205\377\203IV\205\377\1HW\204\377\202IW\205\377\202JW\206" \
+  "\377\1IW\205\377\203JW\206\377\202JV\206\377\203JW\206\377\205JX\206" \
+  "\377\217IX\206\377\202JX\206\377\1JW\206\377\203JX\206\377\202JW\206" \
+  "\377\202JV\206\377\204JW\206\377\3IW\205\377JW\206\377IW\205\377\202" \
+  "HW\204\377\3IV\205\377IW\205\377IV\205\377\202IU\205\377\202IV\205\377" \
+  "\6HV\205\377GU\204\377HV\205\377DR\202\377!1j\377\30)d\377\204\31*e\377" \
+  "\202\30)d\377\2""6Ey\377HV\204\377\202GU\204\377\3FS\203\377FT\203\377" \
+  "ET\202\377\204FT\203\377\13FS\203\377ES\203\377FS\203\377DS\203\377E" \
+  "S\203\377ES\202\377ER\202\377DR\202\377EQ\202\377DR\202\377CR\202\377" \
+  "\204DR\202\377\3CQ\201\377DQ\201\3774Cw\377\210\31*e\377\4\34-g\377>" \
+  "L}\377AO\177\377BP\200\377\202AO\200\377\1@N\200\377\202AO\200\377\3" \
+  "@O\177\377AO\200\377\77O~\377\206@N\177\377\1>L\177\377\202\77M\177\377" \
+  "\202\77M~\377\2-=s\377\30)d\377\210\31*e\377\3\27(d\3770>t\377=K}\377" \
+  "\202<K}\377\2;K}\377<K}\377\203<J|\377\204;J|\377\4;I|\377:I{\377;I|" \
+  "\3779Iz\377\202:I{\377\1""4Cv\377\214\31*e\377\21\32+e\3772@v\3778Fx" \
+  "\3777Fy\3776Fy\3777Fy\3777Ey\3776Ey\3777Dy\3775Ey\3776Ey\3776Ex\3776" \
+  "Ew\3776Ex\3776Dx\3775Cx\3771@u\377\216\31*e\377\5\30)d\377\35.h\3772" \
+  "Bv\3772Av\3772@v\377\2032Av\377\1""2At\377\2041@u\377\4""1@t\3771@u\377" \
+  "\33+f\377\30)d\377\221\31*e\377\7(8o\377-=q\377-<r\377-;r\377-<r\377" \
+  ",<r\377+<r\377\202,<r\377\3,;r\377\"2k\377\30)d\377\222\31*e\377\2\30" \
+  ")d\377\"2j\377\203(8o\377\1&6o\377\202'7o\377\2#3k\377\30)d\377\207\31" \
+  "*e\377\6ES\203\377FS\203\377FR\203\377FS\203\377FT\203\377FS\203\377" \
+  "\202FT\203\377\10ET\202\377FS\203\377GT\204\377FU\203\377GU\204\377F" \
+  "S\203\377%5m\377\30)d\377\205\31*e\377\6\30)d\377,;q\377HV\204\377HV" \
+  "\205\377GV\205\377HV\205\377\202IV\205\377\3HV\205\377IU\205\377IV\205" \
+  "\377\202IW\205\377\202HW\204\377\202IW\205\377\2JW\206\377IW\205\377" \
+  "\204JW\206\377\202JV\206\377\204JW\206\377\203JX\206\377\1JW\206\377" \
+  "\220JX\206\377\203JW\206\377\202JV\206\377\204JW\206\377\1IW\205\377" \
+  "\202JW\206\377\1IW\205\377\202HW\204\377\2IV\205\377IW\205\377\203IV" \
+  "\205\377\10HV\205\377IV\205\377HV\205\377GU\204\377IW\205\377\77M~\377" \
+  "\40""0i\377\30)d\377\205\31*e\377\27\30)d\3775Dx\377HV\205\377FT\203" \
+  "\377GU\204\377FT\203\377GS\204\377FT\203\377ET\202\377FT\203\377FS\203" \
+  "\377FT\203\377FS\203\377FR\203\377FS\203\377ES\203\377DS\203\377ES\202" \
+  "\377ER\202\377ES\201\377ER\202\377DQ\202\377CR\202\377\205DR\202\377" \
+  "\202DQ\201\377\2\35.h\377\30)d\377\206\31*e\377\2\30)d\377(7o\377\202" \
+  "BP\200\377\3AO\200\377BP\200\377@N\200\377\204AO\200\377\2@O\177\377" \
+  "\77N~\377\204@N\177\377\11\77M\177\377@N\177\377>L\177\377\77M\177\377" \
+  "\77M~\377>L~\377@M~\377\37/i\377\30)d\377\207\31*e\377\2\30)d\377\31" \
+  "*e\377\202=K}\377\5<K}\377;K}\377<K}\377<J|\377<I{\377\202<J|\377\10" \
+  ";J|\377:J|\377;J|\377;I|\377;H|\377;I|\377:I{\3779Iz\377\202:I{\377\1" \
+  ")9o\377\214\31*e\377\5\34-g\3776Ex\3777Fx\3777Fy\3776Fy\377\2027Fy\377" \
+  "\5""7Ey\3776Dy\3775Ey\3776Ey\3776Ew\377\2026Ex\377\4""6Cx\3775Dx\377" \
+  "+:q\377\30)d\377\215\31*e\377\11\30)d\377$4l\3773Bv\3772Av\3772@v\377" \
+  "2Av\3772Au\3772Av\3772At\377\2051@u\377\3.=s\377\27(c\377\30)e\377\220" \
+  "\31*e\377\6\32+f\377*:q\377-=q\377-<r\377-;r\377-<r\377\203,<r\377\4" \
+  "+<q\377-<r\377\35-g\377\30)d\377\222\31*e\377\2\30)d\377%5m\377\203(" \
+  "8o\377\202'7o\377\3&6o\377#3k\377\30)d\377\207\31*e\377\5DS\203\377E" \
+  "S\203\377FS\203\377ES\203\377FR\203\377\204FT\203\377\7ET\202\377FT\203" \
+  "\377GT\204\377FU\203\377FT\203\377ES\202\377\"2k\377\202\30)d\377\204" \
+  "\31*e\377\7\30)d\377\40""0i\377CR\202\377HV\204\377HV\205\377GV\205\377" \
+  "HV\205\377\202IV\205\377\3HV\205\377IU\205\377IV\205\377\202IW\205\377" \
+  "\1IV\205\377\202HW\204\377\2JW\206\377IW\205\377\210JW\206\377\204JV" \
+  "\206\377\1JX\206\377\215JW\206\377\204JV\206\377\205JW\206\377\4IW\205" \
+  "\377JW\206\377IW\205\377JW\206\377\202HW\204\377\1IV\205\377\203IW\205" \
+  "\377\202IV\205\377\202HV\205\377\2IV\205\377GV\205\377\202HV\205\377" \
+  "\1""8Gz\377\206\31*e\377\202\30)d\377\6""3Av\377GU\204\377GT\204\377" \
+  "GU\204\377GS\204\377GT\204\377\203FT\203\377\3FS\203\377FT\203\377FR" \
+  "\203\377\202FS\203\377\2ES\203\377DS\203\377\202ES\203\377\5ES\201\377" \
+  "DR\202\377ER\202\377DR\202\377CR\202\377\204DR\202\377\4DQ\201\377ER" \
+  "\202\377*:p\377\27(d\377\206\31*e\377\3\30)d\377\27)d\377\77M~\377\203" \
+  "BP\200\377\1@N\200\377\205AO\200\377\3@O\177\377@N\177\377@M\177\377" \
+  "\204@N\177\377\203\77M\177\377\4>L~\377\77M~\3775Dx\377\26(c\377\210" \
+  "\31*e\377\11\30)d\377(9o\377>K}\377=K}\377<K}\377;K}\377<K}\377<J|\377" \
+  "<I{\377\202<J|\377\6;J|\377:J|\377;J|\377;I|\377;H|\377;I|\377\202:I" \
+  "{\377\2029Hz\377\2\40""0i\377\30)d\377\212\31*e\377\23\30)d\377\"3k\377" \
+  "9Fz\3777Fy\3776Fy\3777Fy\3777Ey\3777Fy\3777Dy\3776Ey\3776Ex\3776Ey\377" \
+  "6Ew\3776Dx\3776Ex\3776Cw\3776Ex\377\40""1i\377\30)d\377\215\31*e\377" \
+  "\5\27)d\377+:p\3772Bv\3772Av\3772@v\377\2022Av\377\3""2Au\3771@u\377" \
+  "0\77u\377\2041@u\377\2&6n\377\30)d\377\220\31*e\377\7\30)d\377\33,f\377" \
+  ",<r\377-=q\377-<r\377-;r\377-<r\377\205,<r\377\1\30)d\377\222\31*e\377" \
+  "\202\30)d\377\2(8o\377(8n\377\202(8o\377\5'7o\377'7n\377'7o\377\"2k\377" \
+  "\30)d\377\207\31*e\377\10ES\203\377DS\203\377ES\203\377FS\203\377ES\203" \
+  "\377FS\203\377FT\203\377FS\203\377\202FT\203\377\10ET\202\377FS\203\377" \
+  "GT\204\377FU\203\377GU\204\377FT\204\377)9o\377\30)d\377\205\31*e\377" \
+  "\6\30)d\377\34-g\3777Fy\377IV\205\377GU\204\377GV\205\377\202HV\205\377" \
+  "\202IV\205\377\1IU\205\377\202IV\205\377\4IW\205\377IV\205\377IW\205" \
+  "\377HW\204\377\203IW\205\377\202JW\206\377\1IW\205\377\207JW\206\377" \
+  "\216JV\206\377\207JW\206\377\1IW\205\377\202JW\206\377\202IW\205\377" \
+  "\4HW\204\377IW\205\377IV\205\377IW\205\377\202IV\205\377\202IU\205\377" \
+  "\202IV\205\377\7HV\205\377GU\204\377HV\205\377ES\203\377,;r\377\27(c" \
+  "\377\30)d\377\204\31*e\377\12\30)e\377\32+f\3778Fy\377IW\205\377FT\203" \
+  "\377GU\204\377FT\203\377GT\204\377FT\203\377ET\202\377\203FT\203\377" \
+  "\5FS\203\377FR\203\377ES\203\377FS\203\377DS\203\377\202ES\203\377\5" \
+  "ER\202\377ES\202\377ER\202\377DR\202\377CR\202\377\203DR\202\377\5DQ" \
+  "\201\377DR\202\377DQ\200\377:H{\377\30)d\377\206\31*e\377\6\30)d\377" \
+  "\27(c\3772Av\377CQ\200\377AO\177\377BP\200\377\205AO\200\377\4@O\177" \
+  "\377@N\177\377\77O~\377@M\177\377\204@N\177\377\202\77M\177\377\6\77" \
+  "M~\377\77M\177\377\77M}\377\77M~\377\35.g\377\30)d\377\211\31*e\377\1" \
+  "7Ex\377\202=K}\377\4;K}\377<J|\377<K}\377<I{\377\203<J|\377\5:J|\377" \
+  ";J|\377;I|\377;H|\377;I|\377\204:I{\377\1""6Ex\377\202\30)d\377\212\31" \
+  "*e\377\5\27(d\377/>s\3778Fy\3777Fy\3776Fy\377\2027Fy\377\2""7Ey\3776" \
+  "Dy\377\2026Ey\377\10""6Ex\3776Ew\3776Ex\3776Dx\3775Dx\3775Cw\377\30(" \
+  "d\377\30)d\377\214\31*e\377\5\30)d\377\27(d\3772Au\3772Bv\3772@v\377" \
+  "\2032Av\377\3""2Au\3771@u\3770\77u\377\2021@u\377\4""0\77t\3772Au\377" \
+  "\36/h\377\30)d\377\220\31*e\377\5\30)d\377\37/i\377-=r\377-<r\377-;r" \
+  "\377\202-<r\377\204,<r\377\2)9o\377\30)d\377\222\31*e\377\3\30)d\377" \
+  "\32,f\377(8o\377\202'7o\377\1(8o\377\203'7o\377\1\27(c\377\210\31*e\377" \
+  "\202ES\203\377\3DS\203\377ES\203\377FS\203\377\202FR\203\377\2FT\203" \
+  "\377FS\203\377\202FT\203\377\10ET\202\377FS\203\377GT\204\377FU\203\377" \
+  "GU\204\377FT\203\377*:p\377\30)d\377\205\31*e\377\13\30)d\377\31*e\377" \
+  ",;q\377IW\206\377HV\205\377GU\204\377GV\205\377HV\205\377IV\205\377H" \
+  "V\205\377IU\205\377\202IV\205\377\202IW\205\377\1IV\205\377\202HW\204" \
+  "\377\203IW\205\377\202JW\206\377\1IW\205\377\227JW\206\377\1IW\205\377" \
+  "\203JW\206\377\202IW\205\377\202HW\204\377\203IW\205\377\202IV\205\377" \
+  "\3IU\205\377HV\205\377IV\205\377\202HV\205\377\4GU\204\377HV\205\377" \
+  "DR\201\377\36/h\377\202\30)d\377\204\31*e\377\12\30)e\377\30)c\377<K" \
+  "}\377GU\204\377FT\203\377GU\204\377FS\203\377GS\204\377FT\203\377ET\202" \
+  "\377\202FT\203\377\202FS\203\377\13FR\203\377ES\203\377FS\203\377ES\203" \
+  "\377DS\203\377ES\202\377ER\202\377ES\201\377DQ\202\377EQ\202\377CR\202" \
+  "\377\205DR\202\377\4CQ\201\377CP\200\377$4l\377\30)d\377\206\31*e\377" \
+  "\7\30)d\377\"3k\377AO\177\377BP\177\377BP\200\377AO\200\377@N\200\377" \
+  "\205AO\200\377\3\77O~\377\77N~\377@M\177\377\203@N\177\377\202\77M\177" \
+  "\377\2>L\177\377\77M\177\377\202\77M~\377\1""2Au\377\212\31*e\377\17" \
+  "\37/i\377:I{\377=J|\377<K}\377;K}\377<K}\377<J|\377<I{\377<J|\377;J|" \
+  "\377<J|\377:J|\377;I|\377;J|\377;H|\377\202:I{\377\5""9Iz\377:H{\377" \
+  ";J{\377'7n\377\30)d\377\212\31*e\377\5\30)d\377\31*e\3779Gz\3778Fy\377" \
+  "6Fy\377\2037Fy\377\4""7Ey\3776Ey\3775Ey\3776Ey\377\2036Ex\377\2026Dx" \
+  "\377\2+;q\377\27)d\377\215\31*e\377\5\30)d\377\36/h\3774Cv\3771Bu\377" \
+  "2@v\377\2032Av\377\2021@u\377\1""0\77u\377\2031@u\377\3""0\77t\377\32" \
+  "+e\377\30)d\377\220\31*e\377\10\30)d\377%4m\377-=r\377-<r\377-;r\377" \
+  "-<r\377,<r\377+<r\377\202,<r\377\3,;r\377$4l\377\30)d\377\222\31*e\377" \
+  "\2\30)d\377\36/h\377\203(8o\377\203'7o\377\2'7n\377\27)d\377\210\31*" \
+  "e\377\6ES\202\377ES\203\377DS\203\377ES\203\377FS\203\377ES\203\377\202" \
+  "FS\203\377\204FT\203\377\11ET\202\377FT\203\377GT\204\377FT\203\377G" \
+  "U\204\377IW\205\377-=r\377\31*e\377\30)d\377\205\31*e\377\3\27(c\377" \
+  "\37""0i\377;I|\377\202HV\205\377\1GU\204\377\202HV\205\377\202IV\205" \
+  "\377\1HV\205\377\202IU\205\377\202IV\205\377\203IW\205\377\202HW\204" \
+  "\377\204IW\205\377\204JW\206\377\1IW\205\377\211JW\206\377\1IW\205\377" \
+  "\204JW\206\377\204IW\205\377\202HW\204\377\3IW\205\377IV\205\377IW\205" \
+  "\377\203IV\205\377\4IU\205\377IV\205\377HV\205\377IV\205\377\202HV\205" \
+  "\377\6GV\205\377IW\205\377DR\202\3771@u\377\27(c\377\30)d\377\205\31" \
+  "*e\377\10\30)d\377\35.h\377\77M\177\377HV\204\377FT\203\377GT\204\377" \
+  "FT\203\377GT\204\377\205FT\203\377\13FS\203\377FR\203\377ES\203\377F" \
+  "S\203\377ES\203\377DS\203\377ES\203\377ES\202\377ES\201\377DR\202\377" \
+  "ER\202\377\205DR\202\377\6DQ\201\377CQ\201\377ER\202\3774Bw\377\27(d" \
+  "\377\31*d\377\206\31*e\377\2\30)d\3777Ey\377\203BP\200\377\2AO\200\377" \
+  "@N\200\377\204AO\200\377\2@O\177\377\77N~\377\204@N\177\377\3\77M\177" \
+  "\377@N\177\377>L\177\377\202\77M\177\377\4>L~\377>L}\377#3k\377\30)d" \
+  "\377\210\31*e\377\2\30)d\377(8n\377\202=K}\377\3<K}\377<J|\377<K}\377" \
+  "\204<J|\377\203;J|\377\1;H|\377\202;I|\377\1""9Iz\377\202:I{\377\3:H" \
+  "{\377\30*d\377\30)d\377\212\31*e\377\5\30)d\377&6m\3778Fz\3777Fx\377" \
+  "6Fy\377\2027Fy\377\2027Ey\377\2""6Ey\3775Ey\377\2036Ex\377\2036Dx\377" \
+  "\2!1j\377\30)d\377\215\31*e\377\5\30)d\377(8o\3772Bv\3771Av\3772@v\377" \
+  "\2022Av\377\3""2Au\3772At\3770\77u\377\2041@u\377\1,;r\377\222\31*e\377" \
+  "\10\27(d\377+;q\377-=r\377-<r\377-;r\377-<r\377,<r\377+<r\377\202,<r" \
+  "\377\3,;r\377\40""1j\377\30)d\377\222\31*e\377\2\30)d\377!2k\377\203" \
+  "(8o\377\1'7o\377\202&6o\377\2'7n\377\27)d\377\210\31*e\377\1ES\201\377" \
+  "\202ES\202\377\4DS\203\377ES\203\377FS\203\377ES\203\377\203FS\203\377" \
+  "\203FT\203\377\7ET\202\377FS\203\377GT\204\377FT\203\377FU\204\377GU" \
+  "\204\3779Gz\377\202\30)d\377\205\31*e\377\7\30)d\377\31*e\377$4l\377" \
+  "DR\201\377HV\205\377GU\204\377GV\205\377\202HV\205\377\4IV\205\377HV" \
+  "\205\377IV\205\377IU\205\377\203IV\205\377\202IW\205\377\1IV\205\377" \
+  "\203HW\204\377\205IW\205\377\213JW\206\377\205IW\205\377\203HW\204\377" \
+  "\2IW\205\377IV\205\377\202IW\205\377\202IV\205\377\202IU\205\377\203" \
+  "IV\205\377\6HV\205\377HU\204\377GU\205\377IW\205\3777Fy\377\35.g\377" \
+  "\202\30)d\377\205\31*e\377\12\27(c\377\"3k\377CQ\201\377GU\204\377FT" \
+  "\203\377GU\204\377FT\203\377GS\204\377FT\203\377ET\202\377\202FT\203" \
+  "\377\202FS\203\377\5FR\203\377ES\203\377FS\203\377ES\203\377DS\203\377" \
+  "\202ES\202\377\5ER\201\377DR\202\377ER\202\377DR\202\377CR\202\377\203" \
+  "DR\202\377\6DQ\201\377DR\202\377DQ\201\3779Hz\377\31*e\377\30)d\377\206" \
+  "\31*e\377\7\27(d\377'7n\377CQ\200\377BP\200\377AO\200\377BP\200\377@" \
+  "N\200\377\204AO\200\377\4@O\177\377\77N~\377@N\177\377@M\177\377\204" \
+  "@N\177\377\3\77M\177\377>L\177\377\77M\177\377\202\77M~\377\3""9Gz\377" \
+  "\27)d\377\30)d\377\207\31*e\377\4\31)d\377\27(d\377:I{\377=K}\377\203" \
+  "<K}\377\204<J|\377\202;J|\377\6;I|\377;J|\377;H|\377:I{\377;I|\3779I" \
+  "z\377\202:I{\377\2.=s\377\30)d\377\213\31*e\377\3\30)d\3772@v\3778Fx" \
+  "\377\2047Fy\377\13""7Ey\3777Dy\3775Ey\3776Ey\3776Ex\3776Ew\3776Ex\377" \
+  "6Dx\3776Cx\3773Bw\377\34-g\377\217\31*e\377\2/>s\3771Bv\377\2042Av\377" \
+  "\3""2Au\3772At\3770\77u\377\2041@u\377\1(8o\377\221\31*e\377\6\30)d\377" \
+  "\32+f\377.=s\377-=r\377-<r\377-;r\377\202,<r\377\5+<r\377,<r\377,;r\377" \
+  "+;q\377\35.h\377\223\31*e\377\2\30)d\377%5m\377\203(8o\377\5'7o\377&" \
+  "6o\377'7o\377$4l\377\30)d\377\210\31*e\377\12ER\202\377ES\201\377ES\202" \
+  "\377ES\203\377ES\202\377ES\203\377FS\203\377ES\203\377FR\203\377FS\203" \
+  "\377\204FT\203\377\11ET\202\377FT\203\377GS\204\377FT\203\377FU\203\377" \
+  "HU\204\377CQ\201\377!1j\377\30)d\377\206\31*e\377\4\30)d\377\31*e\377" \
+  "6Ey\377ES\202\377\202HV\205\377\2GU\204\377GV\205\377\202HV\205\377\203" \
+  "IV\205\377\202IU\205\377\203IV\205\377\203IW\205\377\1IV\205\377\202" \
+  "IW\205\377\215HW\204\377\206IW\205\377\203IV\205\377\203IU\205\377\2" \
+  "HV\205\377IV\205\377\202HV\205\377\7HU\204\377GU\204\377HV\205\377GU" \
+  "\204\377BP\200\377(8o\377\27(c\377\206\31*e\377\10\30)d\377\31*e\377" \
+  "-=r\377IW\205\377GU\204\377FU\203\377FT\203\377GT\204\377\204FT\203\377" \
+  "\6FS\203\377FT\203\377FS\203\377FR\203\377ES\203\377FS\203\377\202ES" \
+  "\203\377\5ES\202\377ES\203\377ES\201\377ER\202\377EQ\202\377\206DR\202" \
+  "\377\4CQ\201\377DQ\201\377AN\177\377\37/i\377\207\31*e\377\5\30)d\377" \
+  "\33,f\377BP\200\377BP\177\377BP\200\377\207AO\200\377\3@N\177\377\77" \
+  "O~\377@M\177\377\204@N\177\377\204\77M\177\377\4\77M~\377@N\177\377!" \
+  "2j\377\30)d\377\210\31*e\377\6\27(d\377(8p\377>L~\377=J|\377<K}\377;" \
+  "K}\377\202<J|\377\2<I{\377<J|\377\202;J|\377\2:J|\377;J|\377\203;I|\377" \
+  "\1""9Iz\377\202:I{\377\3""9H{\377\"2k\377\30)d\377\213\31*e\377\3\35" \
+  ".g\3775Dx\3777Fx\377\2047Fy\377\3""7Ey\3776Dy\3775Ey\377\2026Ex\377\6" \
+  "6Ew\3776Ex\3775Dx\3776Cw\377/>t\377\32+e\377\216\31*e\377\3\35-g\377" \
+  "1@u\3771Av\377\2042Av\377\3""2Au\3771@t\3770\77u\377\2031@u\377\3""0" \
+  "\77t\377#3k\377\30)d\377\220\31*e\377\5\30)d\377\40""0j\377-=s\377-=" \
+  "q\377-;r\377\202-<r\377\1+<r\377\202,<r\377\3+<q\377*9q\377\33+f\377" \
+  "\223\31*e\377\2\32*e\377&6m\377\202(8o\377\202'7o\377\2&6o\377'7o\377" \
+  "\212\31*e\377\15ER\202\377DR\202\377ER\201\377ES\202\377ES\203\377DS" \
+  "\203\377ES\203\377FS\203\377ES\203\377FR\203\377FS\203\377FT\203\377" \
+  "FS\203\377\202FT\203\377\12ET\202\377FT\203\377GS\204\377GT\204\377F" \
+  "U\203\377GU\204\377ES\202\377.>t\377\26'b\377\30)d\377\205\31*e\377\10" \
+  "\30)d\377\27(d\377\37""0i\377/\77t\377GU\204\377IW\206\377HV\205\377" \
+  "GV\205\377\203HV\205\377\3IV\205\377HV\205\377IV\205\377\202IU\205\377" \
+  "\204IV\205\377\205IW\205\377\1IV\205\377\215IW\205\377\204IV\205\377" \
+  "\202IU\205\377\2IV\205\377HV\205\377\202IV\205\377\202HV\205\377\10G" \
+  "U\204\377HV\205\377JX\206\377>L~\377'7n\377\32+f\377\27)d\377\30)e\377" \
+  "\205\31*e\377\6\30)d\377\34-g\377<I{\377GU\204\377FT\203\377GU\204\377" \
+  "\202GT\204\377\3FS\203\377FT\203\377ET\202\377\203FT\203\377\13FS\203" \
+  "\377FR\203\377ES\203\377FS\203\377ES\203\377DS\203\377ES\202\377ES\203" \
+  "\377ER\202\377ER\201\377DQ\202\377\206DR\202\377\5DQ\201\377CQ\201\377" \
+  "FS\202\377'6n\377\30)d\377\210\31*e\377\3""2Av\377BP\200\377AO\177\377" \
+  "\202AO\200\377\1@N\200\377\203AO\200\377\5@O\177\377AO\200\377\77O~\377" \
+  "@N\177\377@M\177\377\204@N\177\377\7\77M\177\377>L\177\377\77M~\377\77" \
+  "M\177\377\77M~\3775Cw\377\27)d\377\210\31*e\377\3\30)d\377\32+f\377:" \
+  "H{\377\202=K}\377\4;K}\377<K}\377<J|\377<I{\377\203<J|\377\2;J|\377:" \
+  "J|\377\202;I|\377\2:I{\377;I|\377\202:I{\377\3""9Hz\3776Fy\377\33,g\377" \
+  "\213\31*e\377\5\30)d\377#3l\3778Fy\3777Fy\3776Fy\377\2037Fy\377\1""7" \
+  "Dy\377\2036Ey\377\2""6Ex\3776Ew\377\2026Dx\377\3""5Dx\377)9o\377\30)" \
+  "d\377\215\31*e\377\5\30)d\377\40""1j\3772Bv\3772Av\3772@v\377\2032Av" \
+  "\377\1""2At\377\2041@u\377\4""0\77u\3770\77t\377\35.g\377\30)d\377\220" \
+  "\31*e\377\5\30)d\377&6m\377-=s\377-=q\377-;r\377\202-<r\377\1+<r\377" \
+  "\203,<r\377\2)9p\377\30)d\377\223\31*e\377\2\33,f\377'7n\377\202(8o\377" \
+  "\2'7o\377&6o\377\202'7o\377\1\32+e\377\211\31*e\377\12DR\202\377EQ\202" \
+  "\377ER\202\377ES\201\377ER\202\377ES\203\377ES\202\377ES\203\377FS\203" \
+  "\377ES\203\377\202FR\203\377\204FT\203\377\4ET\202\377FT\203\377FS\203" \
+  "\377GT\204\377\202FT\203\377\3GU\204\377:I{\377\34,g\377\202\30)d\377" \
+  "\206\31*e\377\202\30)d\377\3""3Bv\377FT\203\377GU\204\377\202HV\205\377" \
+  "\1GU\204\377\204HV\205\377\202IV\205\377\1HV\205\377\202IV\205\377\205" \
+  "IU\205\377\1IW\205\377\211IV\205\377\205IU\205\377\2IV\205\377HV\205" \
+  "\377\203IV\205\377\203HV\205\377\1GV\204\377\202HV\205\377\5GU\204\377" \
+  "CP\201\377%5m\377\27)d\377\30)d\377\205\31*e\377\202\30)d\377\12\31*" \
+  "e\377#3l\377ES\202\377GU\204\377FT\203\377GU\204\377FT\203\377GS\204" \
+  "\377FT\203\377ET\202\377\202FT\203\377\6FS\203\377FT\203\377FS\203\377" \
+  "FR\203\377ES\203\377FS\203\377\202ES\203\377\7ES\202\377ER\203\377ES" \
+  "\202\377ER\201\377EQ\202\377ER\202\377CR\202\377\203DR\202\377\6DQ\201" \
+  "\377DR\202\377CQ\201\377DQ\201\3771\77u\377\27(c\377\207\31*e\377\7\30" \
+  ")d\377\37/i\377AP\200\377BP\200\377AO\200\377BP\200\377@N\200\377\203" \
+  "AO\200\377\5@O\177\377AO\200\377\77N~\377@N\177\377@M\177\377\203@N\177" \
+  "\377\202\77M\177\377\1>L\177\377\202\77M\177\377\4>L~\377>L}\377#3l\377" \
+  "\30)d\377\210\31*e\377\4\30)d\377'7n\377<J|\377=K}\377\203<K}\377\2<" \
+  "J|\377<I{\377\202<J|\377\2;J|\377:J|\377\202;I|\377\4;H|\377;I|\377:" \
+  "I{\3779Iz\377\202:I{\377\2/\77t\377\27(d\377\213\31*e\377\5\30)d\377" \
+  ".>s\3778Fy\3777Fy\3776Fy\377\2027Fy\377\14""7Ey\3777Dy\3776Ey\3776Ex" \
+  "\3776Ey\3776Ew\3776Dx\3775Dx\3776Cw\3775Dx\377\37/i\377\30)d\377\215" \
+  "\31*e\377\11\30)d\377(8o\3772Bv\3772Av\3772@v\3772Av\3772Au\3772Av\377" \
+  "2At\377\2051@u\377\3/>t\377\27)d\377\30)d\377\221\31*e\377\2*:q\377," \
+  "=q\377\202-<r\377\3,<r\377-<r\377+<r\377\203,<r\377\2$4l\377\30)d\377" \
+  "\222\31*e\377\2\30)d\377\35.g\377\203(8o\377\2'7o\377&6o\377\202'7n\377" \
+  "\1\32+e\377\211\31*e\377\202DR\202\377\15DQ\202\377ER\202\377ES\201\377" \
+  "ES\202\377ES\203\377DS\203\377ES\203\377FS\203\377ES\203\377FR\203\377" \
+  "FS\203\377FT\203\377FS\203\377\202FT\203\377\202ET\202\377\11FS\203\377" \
+  "GS\204\377GT\204\377FU\203\377HU\204\377BP\200\377-=s\377\31*e\377\30" \
+  ")d\377\206\31*e\377\12\30)d\377\26'c\377\35.h\377,<r\377:I{\377HV\205" \
+  "\377IW\206\377HV\205\377GU\204\377GV\205\377\203HV\205\377\203IV\205" \
+  "\377\1HV\205\377\204IV\205\377\212IU\205\377\203IV\205\377\1HV\205\377" \
+  "\203IV\205\377\203HV\205\377\10GV\204\377GU\205\377HV\205\377JX\206\377" \
+  "CQ\201\3774Cw\377&6n\377\27)d\377\202\30)d\377\206\31*e\377\3\27(d\377" \
+  "\37""0i\3777Fy\377\203GU\204\377\202GT\204\377\3GS\204\377FT\203\377" \
+  "ET\202\377\204FT\203\377\15FS\203\377FR\203\377ES\203\377FS\203\377E" \
+  "S\203\377DS\203\377ES\202\377ES\203\377ES\202\377ER\201\377DQ\202\377" \
+  "DR\202\377CR\202\377\205DR\202\377\4CQ\201\377DP\200\377;I|\377\32+e" \
+  "\377\207\31*e\377\10\30)d\377\32+e\377=K|\377BP\200\377AO\200\377BP\200" \
+  "\377AO\200\377@N\200\377\204AO\200\377\202@O\177\377\2@N\177\377@M\177" \
+  "\377\204@N\177\377\2\77M\177\377>L\177\377\203\77M~\377\2""9Gz\377\32" \
+  "*e\377\211\31*e\377\2\30)d\3776Ex\377\202=K}\377\4<K}\377<J|\377<K}\377" \
+  "<I{\377\203<J|\377\203;J|\377\2;I|\377;H|\377\202:I{\377\5""9Iz\3779" \
+  "Hz\377;J|\377\37""0i\377\30)d\377\212\31*e\377\5\30)d\377\31*e\3778F" \
+  "z\3778Fx\3776Fy\377\2037Fy\377\14""7Dy\3776Ey\3775Ey\3776Ey\3776Ex\377" \
+  "6Ew\3776Ex\3776Dx\3775Dx\3773Bv\377\27(d\377\30)d\377\215\31*e\377\5" \
+  "\27(d\3770@t\3772Bv\3772Av\3772@v\377\2022Av\377\2""2Au\3771@t\377\205" \
+  "1@u\377\2'6n\377\30)d\377\221\31*e\377\3\33,f\377+;q\377-=q\377\203-" \
+  "<r\377\7,<r\377+<r\377,<r\377+<q\377,;r\377\36/h\377\30)d\377\222\31" \
+  "*e\377\2\30)d\377\40""1j\377\202(8o\377\5'7o\377(8o\377&6o\377'7o\377" \
+  "#3k\377\212\31*e\377\202CR\202\377\4EQ\202\377DQ\202\377ER\202\377ER" \
+  "\201\377\202ES\202\377\2DS\203\377ES\203\377\202FS\203\377\202FR\203" \
+  "\377\2FT\203\377FS\203\377\202FT\203\377\202ET\202\377\4FT\203\377GT" \
+  "\204\377FS\203\377FU\203\377\202GU\204\377\4@O\177\377\36/i\377\30)d" \
+  "\377\30)e\377\206\31*e\377\1\30)d\377\202\31*e\377\3\33,f\377/\77t\377" \
+  "ES\203\377\202HV\205\377\2GU\204\377GV\205\377\203HV\205\377\1GV\205" \
+  "\377\214IV\205\377\1HV\205\377\206IV\205\377\1GV\205\377\203HV\205\377" \
+  "\1GU\204\377\202HV\205\377\3IW\205\377>L~\377%5m\377\202\31*e\377\202" \
+  "\30)d\377\206\31*e\377\4\30)d\377\27(d\377-=r\377FT\204\377\202GU\204" \
+  "\377\2FU\203\377GT\204\377\202FS\203\377\202ET\202\377\202FT\203\377" \
+  "\10FS\203\377FT\203\377FS\203\377FR\203\377ES\203\377FS\203\377ES\203" \
+  "\377DS\203\377\202ES\203\377\4ES\202\377ES\201\377DR\202\377EQ\202\377" \
+  "\202CR\202\377\204DR\202\377\5DQ\201\377DP\200\377DR\202\377\36/h\377" \
+  "\30)d\377\207\31*e\377\7\31*d\3776Ey\377BP\200\377AO\177\377BP\200\377" \
+  "AO\200\377@N\200\377\204AO\200\377\4@O\177\377\77N~\377\77O~\377@M\177" \
+  "\377\203@N\177\377\3\77M\177\377@N\177\377>L\177\377\202\77M\177\377" \
+  "\4>L}\377@N~\377'7n\377\30)d\377\210\31*e\377\11\30)d\377#3l\377>L~\377" \
+  "=K}\377<K}\377;K}\377<K}\377<J|\377<I{\377\203<J|\377\4;J|\377;I|\377" \
+  ";J|\377;H|\377\202:I{\377\1""9Iz\377\202:I{\377\3""6Ex\377\27(c\377\30" \
+  ")d\377\212\31*e\377\10\30)d\377(8o\3779Fz\3778Ex\3776Fy\3777Fy\3777E" \
+  "y\3777Fy\377\2026Ey\377\2""5Ey\3776Ey\377\2036Ex\377\4""6Cx\3776Dx\377" \
+  "%6n\377\30)d\377\215\31*e\377\5\30)d\377\35-h\3774Cv\3771Bv\3772@v\377" \
+  "\2032Av\377\3""2Au\3771@u\3770\77u\377\2021@u\377\4""0\77t\3772Au\377" \
+  "\34-g\377\30)d\377\221\31*e\377\3\36.h\377,<r\377-=q\377\203-<r\377\205" \
+  ",<r\377\2\31*e\377\30)d\377\222\31*e\377\2\30)d\377$5l\377\203(8o\377" \
+  "\202&6o\377\3'7o\377!2j\377\30)d\377\211\31*e\377\202DR\202\377\11CR" \
+  "\202\377DR\202\377EQ\202\377ER\202\377ES\201\377ES\202\377ES\203\377" \
+  "DS\203\377ES\203\377\202FS\203\377\1ES\203\377\202FS\203\377\2FT\203" \
+  "\377FS\203\377\202FT\203\377\2ET\202\377FT\203\377\202GT\204\377\10F" \
+  "T\203\377FU\203\377GU\204\377HV\205\3773Bv\377\37""0i\377\27(c\377\30" \
+  ")d\377\207\31*e\377\11\30)d\377\27(c\377\27(d\377$4l\3771@u\377:I{\377" \
+  "BP\201\377HV\205\377IW\206\377\202HV\205\377\2GV\205\377GU\204\377\204" \
+  "GV\205\377\210HV\205\377\203GV\205\377\1GU\204\377\202HV\205\377\10I" \
+  "W\205\377IW\206\377FT\203\377\77M~\3777Fy\377,;q\377\36/h\377\26'c\377" \
+  "\202\30)d\377\207\31*e\377\14\30)d\377\30*e\377&5m\377>M~\377HV\205\377" \
+  "FT\203\377FU\203\377GT\204\377FT\203\377FS\203\377FT\203\377ET\202\377" \
+  "\203FT\203\377\203FS\203\377\14FR\203\377ES\203\377FS\203\377ES\203\377" \
+  "DS\203\377ES\202\377ES\203\377ES\202\377ES\201\377ER\202\377DQ\202\377" \
+  "CR\202\377\204DR\202\377\6DQ\201\377DR\202\377DQ\201\377BO\200\377$4" \
+  "l\377\27(d\377\207\31*e\377\10\27)d\377)8o\377BP\200\377AO\177\377AO" \
+  "\200\377BP\200\377AO\200\377@N\200\377\202AO\200\377\5@O\177\377AO\200" \
+  "\377@O\177\377\77N~\377@M\177\377\204@N\177\377\204\77M\177\377\202\77" \
+  "M~\377\2""6Ex\377\26'c\377\210\31*e\377\202\30)d\377\1""9H{\377\202=" \
+  "K}\377\2<K}\377;K}\377\204<J|\377\202;J|\377\2:J|\377;J|\377\203;I|\377" \
+  "\1""9Iz\377\202:I{\377\3;I{\377&6m\377\30)d\377\212\31*e\377\4\30)d\377" \
+  "\31*e\3776Dx\3778Fx\377\2047Fy\377\14""7Ey\3777Dy\3775Ey\3776Ey\3776" \
+  "Ex\3776Ew\3776Ex\3776Dx\3775Cx\3775Dx\377\33+f\377\30)d\377\215\31*e" \
+  "\377\5\27)d\377'7o\3773Bv\3771Av\3772@v\377\2022Av\377\2022Au\377\2""1" \
+  "@u\3770\77u\377\2031@u\377\2/>s\377\30)d\377\221\31*e\377\7\30)d\377" \
+  "\"2k\377-=r\377-<r\377-;r\377,<r\377-<r\377\204,<r\377\2(8o\377\30)d" \
+  "\377\222\31*e\377\202\30)d\377\204(8o\377\5&6o\377'7o\377&6o\377!2j\377" \
+  "\30)d\377\211\31*e\377\202DR\202\377\202CR\202\377\4ER\202\377DQ\202" \
+  "\377ER\202\377ER\201\377\202ES\202\377\1DS\203\377\202ES\203\377\2FS" \
+  "\203\377FR\203\377\202FS\203\377\204FT\203\377\6ET\202\377FT\203\377" \
+  "FS\203\377GS\204\377GT\204\377FU\203\377\202GU\204\377\5DR\202\3777E" \
+  "y\377\33+f\377\27)d\377\31*d\377\207\31*e\377\203\30)d\377\11\31*e\377" \
+  "\33,f\377\37/i\377,<r\3778Gy\377BP\200\377JW\205\377IW\206\377IW\205" \
+  "\377\205HV\205\377\2GU\205\377GU\204\377\205HV\205\377\12IW\205\377I" \
+  "W\206\377JX\206\377GU\204\377>L~\3774Cw\377&6n\377\35-g\377\33+f\377" \
+  "\30*d\377\203\30)d\377\207\31*e\377\10\30)d\377\26'c\377$5l\377\77N\177" \
+  "\377FS\203\377GU\204\377FT\203\377GU\204\377\202GT\204\377\3GS\204\377" \
+  "FT\203\377ET\202\377\205FT\203\377\6FS\203\377FR\203\377ES\203\377FS" \
+  "\203\377ES\203\377DS\203\377\202ES\203\377\4ER\202\377ER\201\377DR\202" \
+  "\377EQ\202\377\202CR\202\377\205DR\202\377\4CQ\201\377DQ\201\377(8o\377" \
+  "\30)d\377\207\31*e\377\2\30)d\377\37/i\377\204BP\200\377\2AO\200\377" \
+  "@N\200\377\204AO\200\377\4@O\177\377\77O~\377@N\177\377@M\177\377\203" \
+  "@N\177\377\202\77M\177\377\7>L\177\377\77M~\377\77M\177\377>L~\377=K" \
+  "}\377\36/h\377\30)d\377\210\31*e\377\6\30)d\377&6n\377=K}\377<J|\377" \
+  "=K}\377;K}\377\202<J|\377\1<I{\377\203<J|\377\2;J|\377:J|\377\202;I|" \
+  "\377\10:I{\377;I|\3779Iz\377:I{\3779H{\3777Fy\377\34-g\377\30)d\377\212" \
+  "\31*e\377\4\30)d\377\"2k\3777Ex\3778Ex\377\2047Fy\377\3""6Ey\3777Dy\377" \
+  "5Ey\377\2026Ex\377\5""6Ew\3776Ex\3776Dx\3775Dx\377.=s\377\216\31*e\377" \
+  "\4\30)d\377\31*e\3771@t\3771Bv\377\2042Av\377\3""2Au\3772At\3770\77u" \
+  "\377\2041@u\377\2(7o\377\30)d\377\221\31*e\377\6\30)d\377(8o\377-=r\377" \
+  "-<r\377-;r\377-<r\377\205,<r\377\2#3k\377\30)d\377\222\31*e\377\11\30" \
+  ")d\377\34,g\377(8o\377'7n\377'7o\377(8o\377&6o\377'7n\377'7o\377\202" \
+  "\30)d\377\211\31*e\377\204DR\202\377\6CR\202\377DR\202\377EQ\202\377" \
+  "ER\202\377ES\201\377ES\202\377\202ES\203\377\6DS\203\377ES\203\377FS" \
+  "\203\377ES\203\377FR\203\377FS\203\377\202FT\203\377\1FS\203\377\202" \
+  "FT\203\377\13ET\202\377FT\203\377FS\203\377GS\204\377FT\203\377GT\204" \
+  "\377FU\203\377GU\204\377HV\204\3771Au\377\37""0i\377\203\30)d\377\211" \
+  "\31*e\377\3\30)d\377\27(d\377\26(c\377\202\26'c\377\26\36/i\377'7o\377" \
+  "/>s\3772Bv\3775Dw\3778Fy\377;J{\377=K}\377=L}\377<K}\377:I{\3777Ey\377" \
+  "4Cw\3771Au\377,<r\377$4l\377\33,f\377\25'b\377\26'c\377\27(c\377\30)" \
+  "d\377\30*d\377\211\31*e\377\6\30)d\377\27)d\377\32+f\377%5l\377<K}\377" \
+  "JW\206\377\203GU\204\377\5FT\203\377GT\204\377GS\204\377FT\203\377ET" \
+  "\202\377\203FT\203\377\6FS\203\377FT\203\377FS\203\377FR\203\377ES\203" \
+  "\377FS\203\377\202ES\203\377\2ES\202\377ES\203\377\202ES\202\377\4ER" \
+  "\201\377EQ\202\377DR\202\377CR\202\377\204DR\202\377\2DQ\201\377DR\202" \
+  "\377\202DQ\201\377\2-=r\377\26'c\377\210\31*e\377\3\33,f\377>L~\377B" \
+  "P\177\377\202BP\200\377\2AO\200\377@N\200\377\203AO\200\377\203@O\177" \
+  "\377\2@N\177\377@M\177\377\203@N\177\377\3\77M\177\377@N\177\377>L\177" \
+  "\377\202\77M\177\377\4>L~\377\77M~\377/\77s\377\30)d\377\212\31*e\377" \
+  "\7""5Cw\377<J|\377=K}\377;K}\377<J|\377<K}\377<I{\377\203<J|\377\6;J" \
+  "|\377:J|\377;J|\377;I|\377;H|\377;I|\377\202:I{\377\4:H{\377:I{\377-" \
+  "=s\377\30)d\377\214\31*e\377\4,;q\3778Fy\3777Fy\3776Fy\377\2027Fy\377" \
+  "\3""7Ey\3777Dy\3775Ey\377\2026Ey\377\7""6Ew\3776Ex\3776Dx\3776Cx\377" \
+  "5Cw\377'7n\377\30)d\377\215\31*e\377\4\30)d\377\36/h\3772Au\3771Av\377" \
+  "\2032Av\377\2022Au\377\2""1@t\3770\77u\377\2031@u\377\3""0@u\377\"2k" \
+  "\377\30)d\377\220\31*e\377\16\30)d\377\31*e\377.>s\377-=r\377-<r\377" \
+  "-;r\377-<r\377,<r\377+<r\377,<r\377,;r\377,<r\377\36.h\377\30)d\377\222" \
+  "\31*e\377\2\30)d\377!2k\377\203(8o\377\203'7o\377\2'7n\377\27)d\377\212" \
+  "\31*e\377\210DR\202\377\2ER\202\377ER\201\377\202ES\202\377\6ES\203\377" \
+  "DS\203\377ES\203\377FS\203\377ES\203\377FR\203\377\202FS\203\377\204" \
+  "FT\203\377\1ET\202\377\202FT\203\377\4GS\204\377FT\203\377GT\204\377" \
+  "FU\203\377\202GU\204\377\6DR\202\377:Hz\377%5m\377\26'c\377\27(d\377" \
+  "\30)d\377\213\31*e\377\205\30)d\377\203\27(d\377\202\30)d\377\203\27" \
+  "(d\377\1\27)d\377\205\30)d\377\213\31*e\377\17\30)d\377\26'c\377\31+" \
+  "e\377.>s\377\77M~\377FT\203\377GU\204\377FT\203\377GU\204\377GT\204\377" \
+  "FT\203\377GS\204\377FS\203\377FT\203\377ET\202\377\205FT\203\377\2FS" \
+  "\203\377FR\203\377\202FS\203\377\1ES\203\377\202DS\203\377\2ES\203\377" \
+  "ES\202\377\202ER\201\377\1DQ\202\377\210DR\202\377\4CQ\201\377DQ\201" \
+  "\377.=s\377\30)d\377\210\31*e\377\4\27(d\3772Bv\377BP\200\377AO\177\377" \
+  "\210AO\200\377\3@N\177\377\77O~\377@M\177\377\205@N\177\377\10\77M\177" \
+  "\377>L\177\377\77M~\377\77M\177\377\77M~\377=K|\377\31*e\377\30)d\377" \
+  "\210\31*e\377\2\30)d\377\40""0i\377\202=K}\377\203<K}\377\6<J|\377<I" \
+  "{\377<J|\377;J|\377<J|\377:J|\377\202;J|\377\2;H|\377;I|\377\203:I{\377" \
+  "\4""9Iz\377;I|\377\34-g\377\30)d\377\212\31*e\377\24\30)e\377\31*d\377" \
+  "6Ex\3778Fy\3777Fy\3776Fy\3777Fy\3777Ey\3776Fy\3777Dy\3776Ey\3776Ex\377" \
+  "6Ey\3776Ew\3776Dx\3775Dx\3776Cw\3774Cw\377\36/h\377\30)d\377\216\31*" \
+  "e\377\4&6m\3772Bv\3772Av\3772@v\377\2022Av\377\3""2Au\3772At\3770\77" \
+  "u\377\2041@u\377\2""0\77t\377\35.h\377\221\31*e\377\5\30)d\377\40""1" \
+  "j\377-=s\377,=q\377-;r\377\202-<r\377\2,<r\377+<r\377\202,<r\377\2*9" \
+  "q\377\33,f\377\223\31*e\377\2\30)d\377&6m\377\203(8o\377\202'7o\377\3" \
+  "&6o\377'7n\377\27)d\377\212\31*e\377\2DR\202\377DQ\201\377\204DR\202" \
+  "\377\10CR\202\377DR\202\377DQ\202\377DR\202\377ER\201\377ER\202\377E" \
+  "S\202\377ES\203\377\202DS\203\377\1ES\203\377\202FS\203\377\1FR\203\377" \
+  "\202FS\203\377\205FT\203\377\15ET\202\377FT\203\377GT\204\377GS\204\377" \
+  "FT\203\377GT\204\377FU\203\377GU\204\377HV\205\377ER\202\377-=s\377\35" \
+  ".h\377\32+e\377\203\30)d\377\240\31*e\377\204\30)d\377\4\33,f\377\"1" \
+  "j\3778Fy\377HV\204\377\204GU\204\377\4FT\203\377GT\204\377FS\203\377" \
+  "FT\203\377\202ET\202\377\205FT\203\377\1FS\203\377\202FR\203\377\1FS" \
+  "\203\377\202ES\203\377\11DS\203\377ES\202\377ES\203\377ER\202\377ES\201" \
+  "\377ER\202\377EQ\202\377DR\202\377CR\202\377\204DR\202\377\2DQ\201\377" \
+  "DR\202\377\202DQ\201\377\2""6Ex\377\30)d\377\207\31*e\377\202\30)d\377" \
+  "\6'7n\377DR\201\377AO\177\377AO\200\377BP\200\377@N\200\377\205AO\200" \
+  "\377\2@O\177\377\77N~\377\205@N\177\377\202\77M\177\377\7>L\177\377\77" \
+  "M~\377\77M\177\377\77M}\377@N~\377\"2k\377\30)d\377\210\31*e\377\3\30" \
+  ")d\377\27(d\3775Dx\377\202=K}\377\3<K}\377;K}\377<K}\377\204<J|\377\7" \
+  ";J|\377:J|\377;J|\377;I|\377;H|\377;I|\377:I{\377\2029Iz\377\3:I{\377" \
+  "-=r\377\27(c\377\213\31*e\377\14\30)d\377%5m\3779Gz\3778Ex\3776Fy\377" \
+  "7Fy\3777Ey\3777Fy\3777Dy\3776Ey\3775Ey\3776Ey\377\2036Ex\377\5""6Cx\377" \
+  "5Dx\3772Au\377\27(d\377\30)d\377\216\31*e\377\10-=r\3772Bv\3772Av\377" \
+  "2@v\3772Av\3772Au\3771@u\3772At\377\2051@u\377\1.=s\377\221\31*e\377" \
+  "\202\30)d\377\7(8o\377-=r\377-<q\377-;r\377-<r\377,<r\377+<r\377\203" \
+  ",<r\377\1(7o\377\223\31*e\377\3\30)d\377\32+e\377'7n\377\202(8o\377\204" \
+  "'7o\377\2\34-f\377\30)d\377\212\31*e\377\1DQ\201\377\206DR\202\377\10" \
+  "CR\202\377DR\202\377EQ\202\377DR\202\377ES\201\377ER\202\377ES\203\377" \
+  "ES\202\377\203ES\203\377\3FS\203\377ES\203\377FR\203\377\202FS\203\377" \
+  "\2FT\203\377FS\203\377\202FT\203\377\202ET\202\377\202FT\203\377\17G" \
+  "S\204\377FT\203\377GT\204\377GU\204\377FU\203\377GU\204\377HV\205\377" \
+  "ES\203\377;J|\377/>s\377#3k\377\30)d\377\26'c\377\27)d\377\30)d\377\233" \
+  "\31*e\377\10\30)d\377\27(c\377\26'c\377\33,g\377(8o\3774Cw\377\77N\177" \
+  "\377HV\204\377\202GU\204\377\10FU\203\377GU\204\377GT\204\377FT\203\377" \
+  "GS\204\377FS\203\377FT\203\377ET\202\377\203FT\203\377\2FS\203\377FT" \
+  "\203\377\202FS\203\377\2FR\203\377FS\203\377\202ES\203\377\202DS\203" \
+  "\377\6ES\202\377ES\203\377ER\202\377ES\201\377DR\202\377EQ\202\377\210" \
+  "DR\202\377\3CQ\201\377DQ\201\3774Cw\377\202\30)d\377\207\31*e\377\2\30" \
+  ")d\377$4l\377\202AO\177\377\202BP\200\377\2AO\200\377@N\200\377\204A" \
+  "O\200\377\1@O\177\377\202@N\177\377\1@M\177\377\203@N\177\377\5\77M\177" \
+  "\377@N\177\377\77M\177\377>L\177\377\77M\177\377\202\77M~\377\1""3Bv" \
+  "\377\212\31*e\377\6\30)d\377(7o\377>L}\377=J|\377<K}\377;K}\377\202<" \
+  "J|\377\1<I{\377\202<J|\377\202;J|\377\6:J|\377;J|\377;I|\377:I{\377;" \
+  "I|\3779Iz\377\202:I{\377\3""8Gz\377\33,g\377\30)d\377\212\31*e\377\6" \
+  "\30)d\377\27)d\3776Dw\3778Fy\3777Fy\3776Fy\377\2027Fy\377\14""7Ey\377" \
+  "6Dy\3776Ey\3775Ey\3776Ey\3776Ex\3776Dx\3776Ex\3776Cw\3776Ey\377\"2k\377" \
+  "\30)d\377\215\31*e\377\5\30)d\377\33,f\3773Bv\3771Bv\3772@v\377\2032" \
+  "Av\377\2""2Au\3771@t\377\2051@u\377\2&7n\377\30)d\377\220\31*e\377\4" \
+  "\30)d\377\32+e\377,<r\377,=q\377\202-<r\377\10,<r\377-<r\377+<r\377," \
+  "<r\377,;r\377,<r\377$4l\377\30)d\377\222\31*e\377\3\30)d\377\34-g\377" \
+  "'7n\377\202(8o\377\2'7o\377&6o\377\202'7o\377\214\31*e\377\2CP\200\377" \
+  "DQ\201\377\202DR\202\377\1DQ\201\377\205DR\202\377\202ER\202\377\3DS" \
+  "\202\377ES\201\377ER\203\377\202ES\202\377\2DS\203\377ES\203\377\202" \
+  "FS\203\377\3ES\203\377FR\203\377FS\203\377\206FT\203\377\202ET\202\377" \
+  "\10GT\204\377FT\203\377GS\204\377GT\204\377FT\203\377GT\204\377GU\204" \
+  "\377FT\204\377\202GU\204\377\4FT\203\3779Hz\377'7n\377\32+e\377\203\31" \
+  "*e\377\206\30)d\377\210\31*e\377\206\30)d\377\1\30*e\377\203\31*e\377" \
+  "\4\36.h\377/>t\377\77M\177\377HV\204\377\202GU\204\377\10FT\203\377G" \
+  "U\204\377GT\204\377FT\203\377GT\204\377GS\204\377FT\203\377GT\204\377" \
+  "\202ET\202\377\203FT\203\377\1FS\203\377\202FT\203\377\2FS\203\377FR" \
+  "\203\377\202FS\203\377\202ES\203\377\2DS\203\377ES\202\377\202ES\203" \
+  "\377\202ES\201\377\202EQ\202\377\2DR\202\377CR\202\377\204DR\202\377" \
+  "\2DQ\201\377DR\202\377\202DQ\201\377\2""8Fy\377\32*e\377\207\31*e\377" \
+  "\202\30)d\377\7\35.g\377@N\177\377BP\200\377AO\200\377BP\200\377AO\200" \
+  "\377@N\200\377\203AO\200\377\5@O\177\377AO\200\377@O\177\377\77O~\377" \
+  "@M\177\377\205@N\177\377\202\77M\177\377\6\77M~\377>M~\377\77M}\377>" \
+  "L}\377\40""0i\377\30)d\377\210\31*e\377\11\30)d\377\34-g\3778Gz\377<" \
+  "J|\377=K}\377;K}\377<J|\377<K}\377<I{\377\203<J|\377\2;J|\377:J|\377" \
+  "\202;I|\377\2;H|\377;I|\377\204:I{\377\1-=r\377\214\31*e\377\4\30)d\377" \
+  "#3k\3778Fz\3778Fx\377\2047Fy\377\2026Ey\377\1""5Ey\377\2026Ex\377\6""6" \
+  "Ew\3776Ex\3776Dx\3775Dx\3773Bv\377\30)d\377\216\31*e\377\13\30)d\377" \
+  "&6n\3773Bv\3771Bv\3772@v\3772Av\3772Au\3772Av\3772At\3771@u\3770\77u" \
+  "\377\2031@u\377\3""2Au\377\34,f\377\30)d\377\220\31*e\377\4\30)d\377" \
+  "\36/h\377,<r\377-=q\377\203-<r\377\1+<r\377\202,<r\377\4+<q\377,;r\377" \
+  "\36.h\377\30)d\377\222\31*e\377\4\30)d\377\37/i\377(7n\377(8o\377\202" \
+  "'7o\377\1&6o\377\202'7o\377\214\31*e\377\4;J|\377DQ\201\377CQ\201\377" \
+  "DQ\201\377\205DR\202\377\12CR\202\377DR\202\377DQ\202\377ER\202\377D" \
+  "R\202\377ES\201\377ER\202\377ES\203\377ES\202\377DS\203\377\202ES\203" \
+  "\377\202FS\203\377\202FR\203\377\203FS\203\377\204FT\203\377\202ET\202" \
+  "\377\10FT\203\377FS\203\377GS\204\377GT\204\377FT\203\377GT\204\377G" \
+  "U\204\377FU\203\377\202GU\204\377\13IW\205\377HU\204\377>L~\3777Fy\377" \
+  "2Au\377,;r\377'6n\377!2j\377\34-g\377\31*e\377\27(d\377\203\26'c\377" \
+  "\2\26(c\377\27(c\377\203\26'c\377\16\27'c\377\30)d\377\32+e\377\36/h" \
+  "\377#4l\377)9o\377.=s\3774Cw\377:I{\377BP\201\377JW\206\377HV\205\377" \
+  "GU\204\377FT\203\377\202GU\204\377\5GT\204\377FT\203\377GT\204\377GS" \
+  "\204\377FS\203\377\202FT\203\377\1ET\202\377\206FT\203\377\202FS\203" \
+  "\377\2FR\203\377ES\203\377\202FS\203\377\5ES\203\377DS\203\377ES\202" \
+  "\377ES\203\377ER\202\377\202ES\202\377\4DR\202\377ER\202\377DR\202\377" \
+  "CR\202\377\204DR\202\377\5DQ\201\377DR\202\377CQ\201\377DQ\201\3771A" \
+  "v\377\202\30)d\377\207\31*e\377\10\30)d\377\37/i\377\77M~\377BP\200\377" \
+  "AO\177\377BP\200\377AO\200\377@N\200\377\203AO\200\377\4@O\177\377AO" \
+  "\200\377@O\177\377\77O~\377\205@N\177\377\203\77M\177\377\6\77M~\377" \
+  "\77M\177\377>L~\377@N\177\377-<r\377\27(c\377\211\31*e\377\2\27(d\377" \
+  ",;r\377\202=K}\377\203<K}\377\6<J|\377<I{\377<J|\377;J|\377<J|\377:J" \
+  "|\377\202;J|\377\2;I|\377;H|\377\203:I{\377\4""9Hz\377:I{\377\40""0i" \
+  "\377\30)d\377\214\31*e\377\4.>t\3778Ex\3777Fy\3776Fy\377\2027Fy\377\202" \
+  "7Ey\377\12""6Ey\3775Ey\3776Ey\3776Ex\3776Ew\3776Dx\3775Dx\3776Dx\377" \
+  "(7o\377\30)d\377\215\31*e\377\202\30)d\377\3""1@u\3771Bv\3772@v\377\203" \
+  "2Av\377\4""2Au\3771@t\3771@u\3770\77u\377\2031@u\377\2,<r\377\27(d\377" \
+  "\222\31*e\377\3#3l\377-=r\377-<q\377\203-<r\377\1+<r\377\203,<r\377\1" \
+  ",:q\377\202\30)d\377\223\31*e\377\1\"2k\377\203(8o\377\4'7o\377&6o\377" \
+  "'7n\377\"2k\377\214\31*e\377\6\34-g\377=K}\377DP\201\377CP\200\377DR" \
+  "\202\377DQ\201\377\204DR\202\377\202CR\202\377\7DQ\202\377EQ\202\377" \
+  "ER\202\377ES\201\377ER\202\377ES\203\377ES\202\377\202DS\203\377\203" \
+  "ES\203\377\1FS\203\377\202FR\203\377\202FT\203\377\1FS\203\377\204FT" \
+  "\203\377\1ET\202\377\202FT\203\377\5FS\203\377GS\204\377GT\204\377FT" \
+  "\203\377GT\204\377\202GU\204\377\1FU\203\377\204GU\204\377\202FT\203" \
+  "\377\2ES\203\377ES\202\377\202DR\202\377\10CR\201\377@O\177\377=L}\377" \
+  ":Hz\3778Gz\377;I|\377\77M~\377BP\200\377\203DR\202\377\3ES\202\377ES" \
+  "\203\377FT\203\377\204GU\204\377\1FU\203\377\203GU\204\377\5GT\204\377" \
+  "FT\203\377GT\204\377GS\204\377FS\203\377\202FT\203\377\202ET\202\377" \
+  "\203FT\203\377\1FS\203\377\202FT\203\377\203FR\203\377\2ES\203\377FS" \
+  "\203\377\202ES\203\377\1DS\203\377\202ES\203\377\7ES\202\377ES\201\377" \
+  "ER\201\377ER\202\377EQ\202\377DR\202\377CR\202\377\206DR\202\377\5CQ" \
+  "\201\377DQ\201\377/>t\377\31*e\377\30)d\377\210\31*e\377\7\33,f\377<" \
+  "J|\377BP\200\377AO\177\377BP\200\377AO\200\377@N\200\377\205AO\200\377" \
+  "\4@O\177\377\77N~\377@N\177\377@M\177\377\205@N\177\377\202>L\177\377" \
+  "\1\77M\177\377\202\77M~\377\3""8Gz\377\31*e\377\30)d\377\210\31*e\377" \
+  "\10\30)d\377\37/i\377>L}\377=K}\377<K}\377;K}\377<J|\377<K}\377\204<" \
+  "J|\377\5;J|\377:J|\377;I|\377;J|\377;H|\377\202:I{\377\1""9Iz\377\202" \
+  ":I{\377\3""2Av\377\27(c\377\30)d\377\212\31*e\377\4\30)e\377\34-f\377" \
+  "7Fy\3777Ex\377\2026Fy\377\5""7Fy\3777Ey\3776Ey\3777Dy\3775Ey\377\202" \
+  "6Ey\377\7""6Ew\3776Ex\3776Dx\3776Cx\3774Cw\377\37""0i\377\30)d\377\215" \
+  "\31*e\377\4\30)d\377\40""0i\3773Bv\3771Bu\377\2042Av\377\3""2Au\3771" \
+  "@u\3770\77u\377\2041@u\377\2\"3k\377\30)d\377\222\31*e\377\7'8o\377-" \
+  "=r\377-<r\377-;r\377,<r\377-<r\377+<r\377\203,<r\377\2%4m\377\30)d\377" \
+  "\224\31*e\377\1&6m\377\203(8o\377\5&6o\377'7o\377'7n\377\37/i\377\30" \
+  ")d\377\213\31*e\377\6\30)d\377\33,f\377:H{\377DQ\201\377DP\200\377DQ" \
+  "\201\377\206DR\202\377\10CR\202\377DR\202\377DQ\202\377EQ\202\377ER\201" \
+  "\377ES\201\377ER\202\377ES\202\377\202ES\203\377\1DS\203\377\202ES\203" \
+  "\377\3FS\203\377ES\203\377FR\203\377\203FS\203\377\2FT\203\377FS\203" \
+  "\377\204FT\203\377\202ET\202\377\202FT\203\377\202FS\203\377\1GS\204" \
+  "\377\204GT\204\377\205GU\204\377\1GT\204\377\213GU\204\377\1GT\204\377" \
+  "\205GU\204\377\202GT\204\377\2FT\203\377GT\204\377\202GS\204\377\1FS" \
+  "\203\377\202FT\203\377\202ET\202\377\207FT\203\377\202FS\203\377\2FR" \
+  "\203\377FS\203\377\203ES\203\377\202DS\203\377\202ES\203\377\202ES\202" \
+  "\377\5ER\201\377ER\202\377EQ\202\377DR\202\377CR\202\377\206DR\202\377" \
+  "\202DQ\201\377\4CP\200\377-<r\377\26'c\377\30)d\377\207\31*e\377\3\30" \
+  ")d\377\32+e\3778Gy\377\202BP\200\377\4AO\200\377BP\200\377AO\200\377" \
+  "@N\200\377\203AO\200\377\5@O\177\377AN\200\377@O\177\377\77N~\377@M\177" \
+  "\377\203@N\177\377\4\77M\177\377@N\177\377\77M\177\377>L\177\377\202" \
+  "\77M~\377\4>L~\377>L}\377#3k\377\30)d\377\212\31*e\377\1""7Fy\377\202" \
+  "=K}\377\5<K}\377;K}\377<K}\377<J|\377<I{\377\202<J|\377\203;J|\377\5" \
+  ";I|\377;H|\377:I{\377;I|\3779Iz\377\203:I{\377\2\35-h\377\30)d\377\213" \
+  "\31*e\377\2\27(c\377+;q\377\2028Fy\377\5""6Fy\3777Fy\3777Ey\3777Fy\377" \
+  "7Dy\377\2036Ey\377\6""6Ex\3776Ew\3776Ex\3776Dx\3775Dx\3771@u\377\217" \
+  "\31*e\377\5\30)d\377(8o\3771Bv\3772Av\3772@v\377\2022Av\377\4""2Au\377" \
+  "2At\3771@u\3770\77u\377\2031@u\377\2/\77t\377\34-g\377\221\31*e\377\7" \
+  "\30)d\377\31*e\377,<r\377-=r\377-<r\377-;r\377-<r\377\205,<r\377\2\36" \
+  ".h\377\30)d\377\222\31*e\377\13\30)d\377\32+e\377)9o\377'7n\377'7o\377" \
+  "(8o\377&6o\377'7n\377&6n\377\36/h\377\30)d\377\214\31*e\377\5\30)d\377" \
+  "\32+f\3775Dx\377DQ\201\377CP\200\377\202DQ\201\377\205DR\202\377\1CR" \
+  "\202\377\202DR\202\377\4ER\202\377DR\202\377ES\201\377ER\202\377\202" \
+  "ES\203\377\2ES\202\377DS\203\377\202ES\203\377\2FS\203\377ES\203\377" \
+  "\202FR\203\377\202FS\203\377\207FT\203\377\203ET\202\377\202FT\203\377" \
+  "\1FS\203\377\203GS\204\377\2GT\204\377FT\203\377\203GT\204\377\215GU" \
+  "\204\377\204GT\204\377\1FT\203\377\203GS\204\377\1FS\203\377\202FT\203" \
+  "\377\203ET\202\377\207FT\203\377\202FS\203\377\202FR\203\377\1ES\203" \
+  "\377\202FS\203\377\10ES\203\377DS\203\377ES\203\377ES\202\377ES\203\377" \
+  "ER\202\377ES\201\377ER\201\377\202DQ\202\377\2DR\202\377CR\202\377\205" \
+  "DR\202\377\6DQ\201\377CQ\201\377CP\200\377DQ\201\377'7n\377\30)d\377" \
+  "\212\31*e\377\7""8Fy\377BP\200\377AO\177\377AO\200\377BP\200\377AO\200" \
+  "\377@N\200\377\203AO\200\377\5@O\177\377AO\200\377@O\177\377\77N~\377" \
+  "@M\177\377\205@N\177\377\2\77M\177\377>L\177\377\202\77M\177\377\4>L" \
+  "~\377@N~\377-=r\377\30)d\377\211\31*e\377\2\30)d\377'7n\377\202<J|\377" \
+  "\7=K}\377;K}\377<J|\377<K}\377<J|\377<I{\377<J|\377\202;J|\377\7:J|\377" \
+  ";J|\377;I|\377;H|\377;I|\377:I{\3779Iz\377\202:I{\377\2.>s\377\30)d\377" \
+  "\213\31*e\377\6\30)d\377\33,g\3778Fz\3778Fx\3777Fy\3776Fy\377\2027Fy" \
+  "\377\14""7Ey\3776Dy\3776Ey\3776Ex\3776Ey\3776Ew\3776Dx\3776Ex\3776Cx" \
+  "\3776Dx\377%6m\377\30)d\377\216\31*e\377\12\32+f\377/>t\3771Bu\3772A" \
+  "v\3772@v\3772Av\3772Au\3771@u\3772At\3770\77u\377\2031@u\377\2""0\77" \
+  "t\377-<r\377\222\31*e\377\5\30)d\377\40""0j\377-=s\377,=q\377-;r\377" \
+  "\202-<r\377\203,<r\377\3,;r\377*:q\377\32+e\377\223\31*e\377\2\30)d\377" \
+  "!1j\377\203(8o\377\4'7o\377&6o\377'7o\377&6m\377\202\30)d\377\215\31" \
+  "*e\377\6\30)d\377\27)d\3776Dx\377CP\200\377DP\200\377CQ\201\377\202D" \
+  "Q\201\377\205DR\202\377\1CR\202\377\202DR\202\377\7EQ\202\377DR\202\377" \
+  "ES\201\377ER\202\377ES\202\377ES\203\377ES\202\377\202DS\203\377\202" \
+  "ES\203\377\4FS\203\377ES\203\377FS\203\377FR\203\377\203FS\203\377\202" \
+  "FT\203\377\1FS\203\377\206FT\203\377\203ET\202\377\205FT\203\377\1FS" \
+  "\203\377\213GS\204\377\1FS\203\377\205FT\203\377\204ET\202\377\206FT" \
+  "\203\377\2FS\203\377FT\203\377\203FS\203\377\202FR\203\377\2ES\203\377" \
+  "FS\203\377\203ES\203\377\7DS\203\377ES\202\377ES\203\377ES\202\377ER" \
+  "\202\377ES\201\377ER\202\377\202DQ\202\377\2DR\202\377CR\202\377\205" \
+  "DR\202\377\7DQ\201\377DR\202\377CQ\201\377DQ\201\377AO\177\377%4m\377" \
+  "\27(c\377\210\31*e\377\4\30)d\377\31*e\3771@u\377BP\200\377\202AO\200" \
+  "\377\3BP\200\377AO\200\377@N\200\377\203AO\200\377\6@O\177\377AO\200" \
+  "\377@N\177\377@O\177\377@N\177\377@M\177\377\203@N\177\377\202\77M\177" \
+  "\377\1>L\177\377\202\77M\177\377\202\77M~\377\2""5Dx\377\26'c\377\211" \
+  "\31*e\377\4\30)d\377\32+e\377:I{\377=K}\377\202<K}\377\3<J|\377<K}\377" \
+  "<I{\377\203<J|\377\2;J|\377:J|\377\202;I|\377\2;H|\377;I|\377\203:I{" \
+  "\377\2029Hz\377\1!1j\377\214\31*e\377\5\30)d\377+;q\3778Fy\3777Fx\377" \
+  "6Fy\377\2037Fy\377\2026Ey\377\6""5Ey\3776Ey\3776Ex\3776Ew\3776Ex\377" \
+  "6Dx\377\2025Dx\377\202\30)d\377\215\31*e\377\5\30)d\377\37/h\3773Bv\377" \
+  "2Av\3772@v\377\2032Av\377\1""2At\377\2061@u\377\2%6m\377\30)d\377\220" \
+  "\31*e\377\11\30)d\377\27)d\377)9p\377-=r\377-<q\377-;r\377-<r\377,<r" \
+  "\377+<r\377\202,<r\377\2+<q\377'6n\377\223\31*e\377\202\30)d\377\1&6" \
+  "n\377\203(8o\377\202'7o\377\3&6o\377&6m\377\30)d\377\217\31*e\377\202" \
+  "\30)d\377\6'7o\377CQ\201\377DQ\201\377CQ\201\377DR\202\377DQ\201\377" \
+  "\205DR\202\377\5CR\202\377DR\202\377DQ\202\377EQ\202\377DR\202\377\202" \
+  "ES\201\377\5ES\202\377ES\203\377ES\202\377ES\203\377DS\203\377\202ES" \
+  "\203\377\202FS\203\377\1ES\203\377\202FR\203\377\203FS\203\377\202FT" \
+  "\203\377\1FS\203\377\207FT\203\377\205ET\202\377\215FT\203\377\205ET" \
+  "\202\377\207FT\203\377\1FS\203\377\203FT\203\377\202FS\203\377\202FR" \
+  "\203\377\203FS\203\377\202ES\203\377\202DS\203\377\2ES\202\377ES\203" \
+  "\377\202ES\202\377\6ES\201\377DR\202\377ER\202\377EQ\202\377DR\202\377" \
+  "CR\202\377\205DR\202\377\7DQ\201\377DR\202\377CQ\201\377ER\202\377:I" \
+  "{\377\36/h\377\30)d\377\210\31*e\377\11\30)d\377\31*e\3775Dx\377BP\200" \
+  "\377BP\177\377AO\200\377BP\200\377AO\200\377@N\200\377\205AO\200\377" \
+  "\4@N\177\377\77O~\377@N\177\377@M\177\377\203@N\177\377\4\77M\177\377" \
+  "@N\177\377\77M\177\377>L\177\377\202\77M~\377\4>L}\377;J|\377\34-g\377" \
+  "\30)d\377\210\31*e\377\12\30)e\377\27(c\3772Au\377=K}\377<J|\377<K}\377" \
+  ";K}\377<K}\377<J|\377<I{\377\203<J|\377\203;J|\377\2;I|\377;H|\377\202" \
+  ":I{\377\1""9Iz\377\202:I{\377\2""4Cw\377\30)d\377\214\31*e\377\3\33," \
+  "f\3774Cw\3778Ex\377\2047Fy\377\2027Ey\377\2""6Ey\3775Ey\377\2026Ex\377" \
+  "\6""6Ew\3776Ex\3775Dx\3776Dx\377'6n\377\30)d\377\216\31*e\377\2\27(c" \
+  "\377-=s\377\2022Bv\377\5""2@v\3772Av\3772Au\3772Av\3772At\377\2041@u" \
+  "\377\4""0\77t\3772Au\377\33,f\377\30)d\377\220\31*e\377\4\30)d\377\33" \
+  ",f\377-=s\377,=q\377\202-<r\377\202,<r\377\6+<r\377,<r\377,;r\377,<r" \
+  "\377#3k\377\30)d\377\222\31*e\377\4\30)d\377\32,f\377(8o\377'7n\377\202" \
+  "(8o\377\5'7o\377'7n\377'7o\377\34-g\377\30)d\377\221\31*e\377\3\30)d" \
+  "\377\34-g\377>L~\377\202DQ\201\377\3CQ\201\377DR\202\377DQ\201\377\205" \
+  "DR\202\377\1CR\202\377\202DR\202\377\6EQ\202\377ER\202\377ER\201\377" \
+  "ES\201\377ER\202\377ES\202\377\202ES\203\377\1ES\202\377\202DS\203\377" \
+  "\2FS\203\377ES\203\377\202FS\203\377\1ES\203\377\202FR\203\377\204FS" \
+  "\203\377\242FT\203\377\203FS\203\377\202FR\203\377\3FS\203\377ES\203" \
+  "\377FS\203\377\203ES\203\377\12DS\203\377ES\203\377ES\202\377ES\203\377" \
+  "ES\202\377ER\202\377ES\201\377ER\201\377DR\202\377EQ\202\377\202DR\202" \
+  "\377\1CR\202\377\205DR\202\377\10DQ\201\377DR\202\377CR\202\377DQ\201" \
+  "\377CQ\201\3771@t\377\26'c\377\30)d\377\210\31*e\377\4\30)d\377\32+e" \
+  "\3776Ex\377BP\200\377\202AO\200\377\1BP\200\377\207AO\200\377\2AN\200" \
+  "\377\77O~\377\205@N\177\377\2\77M\177\377@N\177\377\202\77M\177\377\6" \
+  "\77M~\377\77M\177\377\77M}\377\77M~\377$5l\377\30)d\377\211\31*e\377" \
+  "\2\30)d\377#3l\377\202<J|\377\4=K}\377;K}\377<J|\377<K}\377\203<J|\377" \
+  "\202;J|\377\1:J|\377\202;J|\377\4;H|\377:I{\377;I|\3779Iz\377\202:I{" \
+  "\377\3;J{\377!1j\377\30)d\377\213\31*e\377\5\30)d\377%4l\3778Fy\3777" \
+  "Fy\3776Fy\377\2037Fy\377\13""7Ey\3777Dy\3775Ey\3776Ey\3776Ex\3776Ew\377" \
+  "6Dx\3775Dx\3776Cw\3773Bw\377\35-g\377\216\31*e\377\5\30)d\377\34-g\377" \
+  "4Cv\3771Bu\3772@v\377\2032Av\377\3""2Au\3771@u\3770\77u\377\2041@u\377" \
+  "\2,;q\377\27(d\377\221\31*e\377\4\30)d\377\"3k\377-=s\377-=q\377\203" \
+  "-<r\377\1+<r\377\202,<r\377\4+<q\377,;r\377\36.g\377\30)d\377\222\31" \
+  "*e\377\2\30)d\377\37""0i\377\203(8o\377\1'7o\377\202&6o\377\2(7n\377" \
+  "\30)d\377\223\31*e\377\6\30)d\377\32+e\3771Au\377ES\202\377DP\200\377" \
+  "DQ\201\377\207DR\202\377\202CR\202\377\5DR\202\377DQ\202\377ER\202\377" \
+  "DR\202\377ES\201\377\203ES\202\377\4ES\203\377ES\202\377ES\203\377DS" \
+  "\203\377\203ES\203\377\202FS\203\377\1ES\203\377\203FR\203\377\203FS" \
+  "\203\377\230FT\203\377\1FS\203\377\203FT\203\377\204FS\203\377\203FR" \
+  "\203\377\2FS\203\377ES\203\377\202FS\203\377\202ES\203\377\202DS\203" \
+  "\377\203ES\203\377\7ER\202\377ES\202\377ES\201\377ER\202\377DR\202\377" \
+  "EQ\202\377DR\202\377\202CR\202\377\205DR\202\377\7DQ\201\377DR\202\377" \
+  "DQ\201\377ER\201\377AN\177\377&7n\377\30)d\377\211\31*e\377\11\30)d\377" \
+  "\35.h\3779Hz\377CQ\200\377AO\177\377AO\200\377BP\200\377AO\200\377@N" \
+  "\200\377\204AO\200\377\5@O\177\377@N\177\377@O\177\377@N\177\377@M\177" \
+  "\377\205@N\177\377\10\77M\177\377>L\177\377\77M~\377\77M\177\377\77M" \
+  "~\377@M~\377+;q\377\27(c\377\212\31*e\377\2\30)d\3775Ex\377\202=K}\377" \
+  "\203<K}\377\15<J|\377<I{\377<J|\377;J|\377<J|\377;J|\377:J|\377;J|\377" \
+  ";I|\377:I{\377;I|\377:I{\3779Iz\377\202:I{\377\2-<r\377\27(d\377\213" \
+  "\31*e\377\12\30)d\377\31*e\3776Ex\3778Fy\3777Fy\3776Fy\3777Fy\3777Ey" \
+  "\3777Fy\3777Dy\377\2036Ey\377\1""6Ew\377\2026Ex\377\4""6Dx\3775Dx\377" \
+  "-<r\377\30)d\377\216\31*e\377\5\30)d\377)8p\3772Bv\3771Av\3772@v\377" \
+  "\2032Av\377\2021@u\377\1""0\77u\377\2041@u\377\2\40""0j\377\30)d\377" \
+  "\222\31*e\377\13'7o\377,<r\377-<q\377-<r\377,<r\377-<r\377+<r\377,<r" \
+  "\377,;r\377,<r\377+:q\377\202\30)d\377\223\31*e\377\3\"3k\377(8n\377" \
+  "(8o\377\202'7o\377\4&6o\377'7o\377&6n\377\30)d\377\224\31*e\377\202\30" \
+  ")d\377\4%4l\377CP\200\377DP\200\377CP\200\377\202DQ\201\377\206DR\202" \
+  "\377\11CR\202\377DR\202\377DQ\202\377EQ\202\377DR\202\377ER\201\377E" \
+  "S\201\377ER\202\377ES\201\377\203ES\203\377\202DS\203\377\203ES\203\377" \
+  "\202FS\203\377\2ES\203\377FS\203\377\203FR\203\377\203FS\203\377\2FR" \
+  "\203\377FS\203\377\224FT\203\377\204FS\203\377\204FR\203\377\1ES\203" \
+  "\377\203FS\203\377\2DS\203\377ES\203\377\202DS\203\377\203ES\203\377" \
+  "\5ES\202\377ER\201\377ES\201\377ER\201\377ER\202\377\202EQ\202\377\1" \
+  "CR\202\377\207DR\202\377\10DQ\201\377DR\202\377CQ\201\377DQ\201\377;" \
+  "I{\377\32+f\377\30*e\377\30)d\377\210\31*e\377\5\30)d\377\34-g\377=K" \
+  "}\377BP\200\377AO\177\377\202BP\200\377\2AO\200\377@N\200\377\204AO\200" \
+  "\377\5@O\177\377AO\200\377\77O~\377\77N~\377@M\177\377\204@N\177\377" \
+  "\3\77M\177\377@N\177\377>L\177\377\202\77M\177\377\5\77M~\377>L}\377" \
+  "5Cw\377\31*e\377\30)d\377\211\31*e\377\3\27(d\377,<q\377>K}\377\202<" \
+  "K}\377\4;K}\377<J|\377<K}\377<I{\377\203<J|\377\2;J|\377:J|\377\202;" \
+  "I|\377\11;H|\377;I|\377:I{\3779Iz\377:I{\3779Hz\3777Fy\377\35-g\377\30" \
+  ")d\377\213\31*e\377\5\27)d\377*:p\3778Fz\3778Ex\3776Fy\377\2037Fy\377" \
+  "\14""7Ey\3776Dy\3775Ey\3776Ex\3776Ey\3776Ew\3776Dx\3776Ex\3776Cw\377" \
+  "6Dx\377\37/i\377\30)d\377\216\31*e\377\3\33,f\377/\77t\3771Bu\377\204" \
+  "2Av\377\2""2Au\3772At\377\2020\77u\377\2031@u\377\3.=s\377\32+f\377\30" \
+  ")d\377\221\31*e\377\10\32+f\377,<r\377-=q\377-<r\377-;r\377-<r\377,<" \
+  "r\377+<r\377\202,<r\377\3,;r\377\"3k\377\30)d\377\224\31*e\377\2%6m\377" \
+  "'7o\377\202(8o\377\202&6o\377\3'7n\377\35.g\377\30)d\377\226\31*e\377" \
+  "\6\30)d\377!1j\3779Hz\377DR\201\377DQ\200\377CQ\201\377\202DQ\201\377" \
+  "\206DR\202\377\202CR\202\377\6DR\202\377DQ\202\377EQ\202\377DR\202\377" \
+  "ER\202\377ES\201\377\203ES\202\377\202ES\203\377\1ES\202\377\202DS\203" \
+  "\377\204ES\203\377\203FS\203\377\1ES\203\377\202FS\203\377\207FR\203" \
+  "\377\207FS\203\377\210FR\203\377\205FS\203\377\204ES\203\377\202DS\203" \
+  "\377\2ES\203\377ES\202\377\202ES\203\377\202ES\202\377\202ES\201\377" \
+  "\1DR\202\377\202EQ\202\377\202DR\202\377\1CR\202\377\206DR\202\377\10" \
+  "DQ\201\377DR\202\377CQ\201\377DQ\201\377BO\177\3771@u\377\31*e\377\30" \
+  ")d\377\211\31*e\377\3\30)d\377!1j\377\77M~\377\202BP\200\377\4AO\200" \
+  "\377BP\200\377AO\200\377@N\200\377\204AO\200\377\202@O\177\377\1\77N" \
+  "~\377\206@N\177\377\204\77M\177\377\6\77M~\377>L~\377\77M~\377=K|\377" \
+  "\35.h\377\30)d\377\211\31*e\377\7\30)d\377$4l\377>L~\377<J|\377=K}\377" \
+  ";K}\377<K}\377\205<J|\377\202;J|\377\4;I|\377;J|\377;H|\377;I|\377\202" \
+  ":I{\377\5""9Iz\3779Hz\377;I{\377)8p\377\30)d\377\214\31*e\377\3\34-g" \
+  "\3776Dy\3777Ex\377\2047Fy\377\2027Ey\377\12""6Ey\3775Ey\3776Ey\3776E" \
+  "x\3776Dx\3776Ex\3775Cx\3776Dx\377/>t\377\26(c\377\216\31*e\377\3\30)" \
+  "d\377\40""0i\3772Bv\377\2052Av\377\3""2Au\3771@t\3770\77u\377\2041@u" \
+  "\377\1(7o\377\222\31*e\377\7\30)d\377\40""0i\377-=s\377-<q\377-<r\377" \
+  "-;r\377-<r\377\204,<r\377\3,;r\377\32+f\377\30)d\377\222\31*e\377\2\30" \
+  ")d\377\33+f\377\204(8o\377\1&6o\377\202'7o\377\1\35.g\377\216\31*e\377" \
+  "\1\30)d\377\211\31*e\377\6\30)d\377\32+e\377'7n\377CQ\201\377DQ\201\377" \
+  "CQ\201\377\211DR\202\377\3CR\202\377DR\202\377DQ\202\377\202EQ\202\377" \
+  "\3ER\202\377ER\201\377ES\201\377\203ES\202\377\202ES\203\377\1ES\202" \
+  "\377\203DS\203\377\204ES\203\377\204FS\203\377\1ES\203\377\205FS\203" \
+  "\377\207FR\203\377\212FS\203\377\204ES\203\377\203DS\203\377\2ES\203" \
+  "\377ES\202\377\202ES\203\377\4ES\202\377ER\202\377ES\202\377ER\201\377" \
+  "\202ER\202\377\1EQ\202\377\202DR\202\377\202CR\202\377\210DR\202\377" \
+  "\4DQ\201\377ER\202\377:I{\377\36/h\377\202\30)d\377\211\31*e\377\11\30" \
+  ")d\377\"2k\377\77M~\377BP\200\377AO\177\377AO\200\377BP\200\377AO\200" \
+  "\377@N\200\377\204AO\200\377\6@O\177\377AO\200\377\77N~\377\77O~\377" \
+  "@N\177\377@M\177\377\203@N\177\377\12\77M\177\377@N\177\377\77M\177\377" \
+  ">L\177\377\77M~\377\77M\177\377\77M~\377@N~\377\40""1j\377\30)d\377\212" \
+  "\31*e\377\2\33,f\3779H{\377\202=K}\377\2<K}\377;K}\377\202<J|\377\1<" \
+  "I{\377\203<J|\377\5;J|\377:J|\377;J|\377;I|\377;H|\377\202:I{\377\1""9" \
+  "Iz\377\202:I{\377\3""5Dw\377\27)d\377\30)d\377\213\31*e\377\4\30)d\377" \
+  "(7o\3778Fy\3777Fx\377\2047Fy\377\7""6Ey\3777Dy\3775Ey\3776Ey\3776Ex\377" \
+  "6Ew\3776Ex\377\2026Dx\377\3""6Ex\377\36.h\377\30)d\377\216\31*e\377\5" \
+  "\30)d\377+;q\3772Bv\3772Av\3772@v\377\2032Av\377\1""2At\377\2041@u\377" \
+  "\4""0\77u\3771@u\377\37""0i\377\30)d\377\221\31*e\377\2\27(d\377)9p\377" \
+  "\202-=r\377\2-;r\377-<r\377\204,<r\377\2,;r\377'7o\377\224\31*e\377\2" \
+  "\30)d\377\37""0i\377\202(8o\377\6'7o\377(8o\377&6o\377'7n\377$5m\377" \
+  "\30)d\377\216\31*e\377\2!0j\377\30)d\377\211\31*e\377\10\30)d\377\27" \
+  "(d\377\32+f\3775Dw\377CP\200\377DQ\201\377CQ\201\377DQ\201\377\210DR" \
+  "\202\377\202CR\202\377\202DR\202\377\2DQ\202\377EQ\202\377\202ER\202" \
+  "\377\5ER\201\377ES\201\377ES\202\377ER\202\377ES\202\377\206ES\203\377" \
+  "\204DS\203\377\224ES\203\377\204DS\203\377\2ES\203\377ES\202\377\203" \
+  "ES\203\377\202ES\202\377\1ER\202\377\202ES\201\377\4ER\201\377DR\202" \
+  "\377ER\202\377DQ\202\377\202DR\202\377\1CR\202\377\207DR\202\377\1DQ" \
+  "\201\377\202DR\202\377\6DQ\201\377EQ\201\377\77L~\377*:p\377\25'b\377" \
+  "\30)d\377\211\31*e\377\6\30)d\377\31*e\377)9p\377CQ\201\377BP\200\377" \
+  "AO\200\377\202BP\200\377\2AO\200\377@N\200\377\205AO\200\377\2@O\177" \
+  "\377\77N~\377\207@N\177\377\11\77M\177\377>L\177\377\77M\177\377\77M" \
+  "~\377\77M\177\377>L~\377\77M~\377*:p\377\30)d\377\211\31*e\377\202\30" \
+  ")d\377\1""4Bw\377\202=K}\377\5<K}\377;K}\377<K}\377<J|\377<I{\377\203" \
+  "<J|\377\2;J|\377:J|\377\202;I|\377\5;H|\377;I|\377:I{\3779Iz\377:I{\377" \
+  "\2029Hz\377\2\36.h\377\30)d\377\213\31*e\377\13\30)d\377\32*e\3776Dx" \
+  "\3778Fy\3777Fy\3776Fy\3777Fy\3777Ey\3776Fy\3777Dy\3775Ey\377\2026Ey\377" \
+  "\7""6Ex\3776Ew\3776Dx\3775Dx\3776Cw\377/>t\377\32*e\377\216\31*e\377" \
+  "\5\30)d\377\34,g\3774Cw\3771Bu\3772@v\377\2032Av\377\2""2Au\3771@t\377" \
+  "\2051@u\377\1.=s\377\202\30)d\377\220\31*e\377\6\30)d\377\33,f\377.>" \
+  "s\377,=q\377-;r\377-<r\377\202,<r\377\2+<r\377,<r\377\202,;r\377\1\"" \
+  "2k\377\224\31*e\377\2\30)d\377%5m\377\203(8o\377\5&6o\377'7o\377&6o\377" \
+  "$4l\377\30)d\377\216\31*e\377\3@N~\377)9p\377\26'c\377\212\31*e\377\202" \
+  "\30)d\377\5\40""1j\377;I{\377ER\202\377DP\200\377CQ\201\377\202DR\202" \
+  "\377\1DQ\201\377\206DR\202\377\202CR\202\377\202DR\202\377\10DQ\202\377" \
+  "EQ\202\377ER\202\377DR\202\377ER\201\377ES\201\377ES\202\377ER\202\377" \
+  "\202ES\202\377\203ES\203\377\1ES\202\377\203ES\203\377\224DS\203\377" \
+  "\202ES\203\377\1ES\202\377\203ES\203\377\202ES\202\377\2ER\202\377ES" \
+  "\202\377\202ES\201\377\2ER\202\377DR\202\377\202EQ\202\377\2DQ\202\377" \
+  "DR\202\377\202CR\202\377\207DR\202\377\10DQ\201\377DR\202\377CQ\201\377" \
+  "DQ\201\377DR\201\377.=s\377\34-g\377\30)d\377\212\31*e\377\3\30)d\377" \
+  "\32+e\3777Fx\377\202BP\200\377\2AO\177\377BP\200\377\202AO\200\377\1" \
+  "@N\200\377\204AO\200\377\6@O\177\377AO\200\377@N\177\377\77O~\377@N\177" \
+  "\377@M\177\377\203@N\177\377\11\77M\177\377@N\177\377\77M\177\377>L\177" \
+  "\377\77M~\377\77M\177\377>L~\377AO\177\377,<r\377\202\30)d\377\211\31" \
+  "*e\377\10\30)d\377.>s\377=K}\377<J|\377=K}\377<K}\377;K}\377<K}\377\203" \
+  "<J|\377\3;J|\377<J|\377:J|\377\202;J|\377\3;I|\377;H|\377;I|\377\204" \
+  ":I{\377\1.=s\377\215\31*e\377\5\27(c\377,;q\3778Fz\3778Ex\3776Fy\377" \
+  "\2037Fy\377\14""7Ey\3776Dy\3776Ey\3776Ex\3776Ey\3776Ew\3776Dx\3776Ex" \
+  "\3776Cw\3775Dx\377$5m\377\30)d\377\216\31*e\377\10\27)d\377,;q\3772B" \
+  "v\3771Av\3772@v\3772Av\3772Au\3772Av\377\2021@u\377\1""0\77u\377\202" \
+  "1@u\377\4""0\77t\3772Au\377\"2j\377\30)d\377\221\31*e\377\5\30)d\377" \
+  "$4l\377-=s\377-=q\377-;r\377\202-<r\377\2,<r\377+<r\377\202,<r\377\3" \
+  "+:q\377\35.g\377\30)d\377\222\31*e\377\13\30)d\377\32+e\377(8o\377(8" \
+  "n\377'7o\377(8o\377'7o\377'7n\377'7o\377!1j\377\30)d\377\216\31*e\377" \
+  "\5AO\177\377DQ\201\3774Cv\377\32*e\377\30)d\377\212\31*e\377\4\30)e\377" \
+  "\30)d\377.<r\377@N\177\377\202DQ\201\377\2CQ\201\377DQ\201\377\212DR" \
+  "\202\377\202CR\202\377\202DR\202\377\6DQ\202\377EQ\202\377ER\202\377" \
+  "DR\202\377ER\202\377ER\201\377\203ES\201\377\1ER\202\377\204ES\202\377" \
+  "\222ES\203\377\203ES\202\377\1ER\202\377\203ES\201\377\4ER\201\377ER" \
+  "\202\377DR\202\377ER\202\377\202EQ\202\377\202DR\202\377\203CR\202\377" \
+  "\207DR\202\377\3DQ\201\377DR\202\377CQ\201\377\202DQ\201\377\4CP\200" \
+  "\377>L}\377\40""1j\377\30)d\377\212\31*e\377\202\30)d\377\10!1j\377@" \
+  "N\200\377BP\200\377AO\177\377AO\200\377BP\200\377AO\200\377@N\200\377" \
+  "\206AO\200\377\4@O\177\377\77O~\377@O\177\377@M\177\377\206@N\177\377" \
+  "\10>L\177\377\77M\177\377\77M~\377\77M\177\377>L~\377\77M~\377/\77t\377" \
+  "\27(d\377\212\31*e\377\2\30)d\377\"3k\377\202<J|\377\2=K}\377;K}\377" \
+  "\202<K}\377\2<J|\377<I{\377\202<J|\377\202;J|\377\14;I|\377;J|\377;I" \
+  "|\377;H|\377;I|\377:I{\3779Iz\3779Hz\377:I{\3779Hz\377\34,f\377\30)d" \
+  "\377\213\31*e\377\4\30)d\377\37""0i\3778Fy\3778Ex\377\2047Fy\377\13""7" \
+  "Ey\3776Dy\3776Ey\3775Ey\3776Ey\3776Ex\3776Dx\3776Ex\3776Cw\3776Dx\377" \
+  "3Bv\377\202\30)d\377\216\31*e\377\3\35-g\3771@u\3771Bu\377\2042Av\377" \
+  "\3""2Au\3772At\3770\77u\377\2041@u\377\2""0\77t\377\31)e\377\223\31*" \
+  "e\377\2)9p\377,=q\377\202-<r\377\11,<r\377-<r\377+<r\377,<r\377,;r\377" \
+  ",<r\377*9q\377\31)e\377\30)d\377\222\31*e\377\2\30)d\377\40""1j\377\203" \
+  "(8o\377\1'7o\377\202&6o\377\2'7n\377\27(d\377\217\31*e\377\6BP\200\377" \
+  "AO\177\377BP\200\377;I{\377\40""1j\377\27(c\377\212\31*e\377\7\30)d\377" \
+  "\27(c\377\35.h\377,;q\377\77N~\377FR\202\377DP\200\377\202DQ\201\377" \
+  "\2DR\202\377DQ\201\377\210DR\202\377\202CR\202\377\202DR\202\377\1DQ" \
+  "\202\377\202EQ\202\377\2ER\202\377DR\202\377\202ER\202\377\205ES\201" \
+  "\377\2ES\202\377ER\202\377\216ES\202\377\2ER\202\377ES\202\377\204ES" \
+  "\201\377\202ER\202\377\2DR\202\377ER\202\377\202EQ\202\377\1DQ\202\377" \
+  "\202DR\202\377\203CR\202\377\207DR\202\377\1DQ\201\377\202DR\202\377" \
+  "\7CQ\201\377DQ\201\377ES\202\3778Fy\377%5m\377\30*e\377\30)d\377\212" \
+  "\31*e\377\6\30)d\377\27)c\377.=s\377AO\177\377BP\200\377AO\177\377\202" \
+  "BP\200\377\2AO\200\377@N\200\377\205AO\200\377\2@O\177\377@N\177\377" \
+  "\202@O\177\377\2@N\177\377@M\177\377\203@N\177\377\2\77M\177\377@N\177" \
+  "\377\202\77M\177\377\5\77M~\377\77M\177\377>L~\377@M~\3774Cw\377\213" \
+  "\31*e\377\3\30)d\377\33,f\377:H{\377\202=K}\377\5<K}\377;K}\377<J|\377" \
+  "<K}\377<I{\377\202<J|\377\202;J|\377\14:J|\377;J|\377;I|\377;H|\377:" \
+  "I{\377;I|\3779Iz\377:I{\3779Iz\377;J|\377$4l\377\27(d\377\215\31*e\377" \
+  "\2.=s\3778Fx\377\2057Fy\377\4""6Ey\3777Ey\3775Ey\3776Ey\377\2036Ex\377" \
+  "\5""6Dx\3776Cx\3777Ex\377\40""1j\377\30)d\377\216\31*e\377\4\30)d\377" \
+  "&5m\3772Bv\3771Av\377\2032Av\377\4""2Au\3771@u\3772At\3770\77u\377\204" \
+  "1@u\377\1'7o\377\222\31*e\377\4\30)e\377\34-g\377,<r\377-=q\377\203-" \
+  "<r\377\2,<r\377+<r\377\203,<r\377\2#3l\377\30)d\377\224\31*e\377\2%5" \
+  "m\377(8n\377\202(8o\377\1'7o\377\202&6o\377\2(8o\377\30)d\377\217\31" \
+  "*e\377\2AO\200\377BP\200\377\202AO\177\377\4BP\200\377)9o\377\31*e\377" \
+  "\30)d\377\213\31*e\377\202\30)d\377\6+<q\377BO\177\377CP\200\377DQ\200" \
+  "\377DQ\201\377CR\202\377\214DR\202\377\204CR\202\377\203DR\202\377\1" \
+  "DQ\202\377\204EQ\202\377\2ER\202\377DR\202\377\215ER\202\377\3DR\202" \
+  "\377ES\202\377ER\202\377\204EQ\202\377\204DR\202\377\203CR\202\377\211" \
+  "DR\202\377\1DQ\201\377\202DR\202\377\6CR\202\377DQ\201\377DP\200\377" \
+  "CP\200\377=K}\377\40""0i\377\202\30)d\377\212\31*e\377\202\30)d\377\4" \
+  "\33,f\3777Fz\377BP\200\377AO\177\377\202BP\200\377\202AO\200\377\1@N" \
+  "\200\377\204AO\200\377\202@O\177\377\4AN\200\377\77O~\377@N\177\377@" \
+  "M\177\377\206@N\177\377\11>L\177\377\77M\177\377\77M~\377\77M\177\377" \
+  ">L~\377\77M~\3777Fy\377\27(d\377\30)d\377\211\31*e\377\202\30)d\377\1" \
+  "7Fy\377\202=K}\377\2<K}\377;K}\377\202<K}\377\205<J|\377\6:J|\377;I|" \
+  "\377;J|\377;I|\377;H|\377;I|\377\204:I{\377\1""0@t\377\215\31*e\377\13" \
+  "\30)d\377\37/i\3779Gz\3778Ex\3777Fy\3776Fy\3777Fy\3777Ey\3776Ey\3777" \
+  "Dy\3775Ey\377\2026Ey\377\3""6Ex\3776Ew\3776Ex\377\2025Dx\377\1.>s\377" \
+  "\217\31*e\377\202\30)d\377\10""0@u\3772Bv\3772Av\3772@v\3772Av\3772A" \
+  "u\3771@u\3772At\377\2041@u\377\2020\77t\377\2\37""0i\377\30)d\377\221" \
+  "\31*e\377\7\30)d\377$4l\377-=r\377-<r\377-;r\377,<r\377-<r\377\204,<" \
+  "r\377\3-<r\377\32+f\377\30)d\377\222\31*e\377\3\30)e\377\33,f\377'7n" \
+  "\377\202(8o\377\2'7o\377&6o\377\202'7o\377\1\33,f\377\220\31*e\377\202" \
+  "AO\200\377\7BP\200\377AO\200\377AO\177\377BP\200\3772Av\377\36/h\377" \
+  "\27(d\377\214\31*e\377\10\27(c\377\32+f\377+;q\377<J|\377ES\202\377D" \
+  "Q\201\377CQ\201\377DQ\201\377\216DR\202\377\203CR\202\377\205DR\202\377" \
+  "\1DQ\202\377\217EQ\202\377\202DQ\202\377\204DR\202\377\204CR\202\377" \
+  "\212DR\202\377\1DQ\201\377\202DR\202\377\10CQ\201\377DQ\201\377EQ\201" \
+  "\377DQ\201\3775Dx\377$4l\377\26(c\377\30)d\377\213\31*e\377\202\30)d" \
+  "\377\5&6n\377<J|\377CQ\200\377AO\177\377BP\200\377\202AO\200\377\202" \
+  "@N\200\377\204AO\200\377\6@O\177\377AO\200\377@N\177\377\77O~\377@N\177" \
+  "\377@M\177\377\204@N\177\377\206\77M\177\377\5>L~\377\77M~\3778Gz\377" \
+  "\32+f\377\30)d\377\212\31*e\377\7\30)d\377+:q\377=K}\377<J|\377<K}\377" \
+  ";K}\377<K}\377\202<J|\377\1<I{\377\202<J|\377\202;J|\377\4;I|\377;J|" \
+  "\377;I|\377;H|\377\202:I{\377\2""9Iz\377:I{\377\2029Hz\377\2\40""1j\377" \
+  "\30)d\377\213\31*e\377\25\30)d\377\31)d\3774Cw\3778Fy\3777Fx\3776Fy\377" \
+  "7Fy\3777Ey\3777Fy\3777Ey\3776Dy\3775Ey\3776Ex\3776Ey\3776Ew\3776Dx\377" \
+  "5Dx\3776Cw\3775Cw\377\"3k\377\30)d\377\216\31*e\377\5\30)d\377$4l\377" \
+  "3Cv\3771Bu\3772@v\377\2032Av\377\2""2Au\3771@t\377\2051@u\377\3.=s\377" \
+  "\31*e\377\30)d\377\220\31*e\377\202\30)d\377\5,<r\377-=r\377-<r\377-" \
+  ";r\377-<r\377\205,<r\377\2(7n\377\30)d\377\223\31*e\377\2\30)d\377\36" \
+  "/h\377\202(8o\377\6'7o\377(8o\377&6o\377'7n\377'7o\377\33,f\377\220\31" \
+  "*e\377\202@N\200\377\3AO\200\377BP\200\377AO\200\377\202BP\200\377\4" \
+  "@N~\377*:p\377\27(c\377\30)d\377\213\31*e\377\202\30)d\377\4\31*e\377" \
+  "$5m\377=K}\377ER\201\377\204DQ\201\377\2DR\202\377DQ\201\377\214DR\202" \
+  "\377\205CR\202\377\221DR\202\377\205CR\202\377\214DR\202\377\1DQ\201" \
+  "\377\202DR\202\377\203DQ\201\377\4DR\201\3773Cw\377\35-h\377\31*e\377" \
+  "\202\30)d\377\212\31*e\377\10\30)e\377\30)d\377\32+f\3777Fy\377AO\177" \
+  "\377BP\200\377AO\177\377AO\200\377\202BP\200\377\202@N\200\377\204AO" \
+  "\200\377\6@O\177\377AO\200\377@O\177\377\77O~\377@N\177\377@M\177\377" \
+  "\204@N\177\377\2\77M\177\377@N\177\377\202>L\177\377\7\77M\177\377\77" \
+  "M~\377>L\177\377\77M~\377=L}\377\33,f\377\30)d\377\212\31*e\377\3\30" \
+  ")d\377!1j\377=L}\377\202=K}\377\202<K}\377\202<J|\377\1<I{\377\202<J" \
+  "|\377\202;J|\377\6:J|\377;J|\377;I|\377;H|\377:I{\377;I|\377\2029Iz\377" \
+  "\5""9Hz\377:I{\377-=r\377\27(d\377\30)d\377\213\31*e\377\4\30)d\377(" \
+  "8o\3778Fz\3778Ex\377\2047Fy\377\13""7Ey\3777Dy\3776Ey\3776Ex\3776Ey\377" \
+  "6Ex\3776Ew\3776Ex\3776Cx\3775Dx\3773Bv\377\202\30)d\377\215\31*e\377" \
+  "\14\30)d\377\31*e\3772Au\3771Bv\3771Av\3772@v\3772Av\3772Au\3772Av\377" \
+  "2At\3771@u\3770\77u\377\2021@u\377\4""0\77t\3772Au\377\40""1j\377\30" \
+  ")d\377\221\31*e\377\11\30)d\377!1j\377-=s\377,=q\377-<r\377-;r\377-<" \
+  "r\377,<r\377+<r\377\203,<r\377\2\37""0i\377\30)d\377\223\31*e\377\2\30" \
+  ")d\377$4l\377\203(8o\377\5'7o\377&6o\377'7o\377\"3k\377\30)d\377\220" \
+  "\31*e\377\202AO\200\377\1@N\200\377\202AO\200\377\10BP\200\377AO\200" \
+  "\377BP\200\377DR\201\3779H{\377\"2k\377\27(d\377\30)d\377\214\31*e\377" \
+  "\11\30)d\377\26'c\377\40""1j\3771@u\377<J|\377CP\201\377EQ\201\377DQ" \
+  "\201\377CQ\201\377\202DQ\201\377\202DR\202\377\1DQ\201\377\251DR\202" \
+  "\377\1DQ\201\377\203DR\202\377\12DQ\201\377CQ\201\377DQ\201\377ER\201" \
+  "\377AN\177\3779Gy\377+;q\377\32*e\377\26(c\377\30)d\377\213\31*e\377" \
+  "\202\30)d\377\2\33+f\377*:p\377\202BP\200\377\2AO\177\377AO\200\377\202" \
+  "BP\200\377\2AO\200\377@N\200\377\204AO\200\377\7@O\177\377AO\200\377" \
+  "AN\200\377@O\177\377\77O~\377@N\177\377@M\177\377\204@N\177\377\206\77" \
+  "M\177\377\5>L~\377\77M}\377;J|\377\35-h\377\30)d\377\212\31*e\377\12" \
+  "\30)d\377!1j\377=K}\377=J|\377=K}\377<K}\377;K}\377<K}\377<J|\377<I{" \
+  "\377\203<J|\377\10;J|\377:J|\377;I|\377;J|\377;I|\377:I{\377;I|\3779" \
+  "Iz\377\203:I{\377\1""5Dw\377\202\30)d\377\213\31*e\377\6\31)e\377\33" \
+  ",f\3774Cw\3777Ex\3777Fy\3776Fy\377\2027Fy\377\2027Ey\377\13""6Ey\377" \
+  "5Ey\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\3775Cw\3776Ey\377\40""1j\377\30" \
+  ")d\377\216\31*e\377\4\30)d\377\"3k\3772Au\3771Av\377\2042Av\377\3""1" \
+  "@u\3772Au\3770\77u\377\2041@u\377\2.=s\377\27(d\377\222\31*e\377\10\30" \
+  ")d\377*:q\377-=r\377-<q\377-;r\377-<r\377,<r\377+<r\377\202,<r\377\3" \
+  "+<q\377*:q\377\33,f\377\223\31*e\377\13\30)d\377\32+e\377)9o\377'7n\377" \
+  "'7o\377(8o\377&6o\377'7n\377&6o\377\"3k\377\30)d\377\220\31*e\377\203" \
+  "AO\200\377\202@N\200\377\11AO\200\377BP\200\377AO\200\377AO\177\377B" \
+  "P\200\377@N\177\3775Dx\377\32+f\377\30)d\377\214\31*e\377\1\31*d\377" \
+  "\202\30)d\377\5\33,f\377\40""0j\3771@u\377CQ\201\377ER\202\377\202DQ" \
+  "\201\377\2CQ\201\377DQ\201\377\250DR\202\377\1DQ\201\377\202DR\202\377" \
+  "\2DQ\201\377CQ\201\377\202DQ\201\377\5FS\202\377=J}\377)8o\377\35.h\377" \
+  "\31*e\377\202\30)d\377\215\31*e\377\3\27(d\377$4l\377=K|\377\202BP\200" \
+  "\377\1AO\177\377\202BP\200\377\202AO\200\377\1@N\200\377\206AO\200\377" \
+  "\202@O\177\377\3\77N~\377@N\177\377@M\177\377\204@N\177\377\13\77M\177" \
+  "\377@N\177\377\77M\177\377>L\177\377\77M~\377\77M\177\377>L~\377\77M" \
+  "~\377=L~\377\37""0i\377\30)d\377\212\31*e\377\7\30)d\377\34-g\377:H{" \
+  "\377=K}\377=J|\377<K}\377;K}\377\206<J|\377\2;J|\377:J|\377\202;J|\377" \
+  "\3;I|\377;H|\377;I|\377\203:I{\377\4""9Hz\3778Gz\377\37""0i\377\30)d" \
+  "\377\214\31*e\377\2\27(d\377,;q\377\2028Fy\377\10""7Fy\3776Fy\3777Fy" \
+  "\3777Ey\3776Ey\3777Dy\3775Ey\3776Ey\377\2026Ex\377\7""6Ew\3776Ex\377" \
+  "5Dx\3776Dx\377-=s\377\30)d\377\31*d\377\217\31*e\377\4,<r\3772Bv\377" \
+  "2Av\3772@v\377\2022Av\377\2022Au\377\2""1@u\3770\77u\377\2041@u\377\2" \
+  "\"2k\377\30)d\377\222\31*e\377\3\35.h\377,<r\377,=q\377\202-<r\377\10" \
+  ",<r\377-<r\377+<r\377,<r\377,;r\377,<r\377'7n\377\30)d\377\223\31*e\377" \
+  "\2\30)d\377\40""1j\377\203(8o\377\6'7o\377&6o\377'7o\377'7n\377\31*e" \
+  "\377\30)d\377\220\31*e\377\205AO\200\377\202@N\200\377\10AO\200\377B" \
+  "P\200\377AO\200\377AO\177\377BP\200\377@N\177\377$5m\377\32+e\377\202" \
+  "\30)d\377\215\31*e\377\1\30)d\377\202\27(d\377\4(8o\3777Fz\377>L}\377" \
+  "AO\177\377\207DQ\201\377\240DR\202\377\2DQ\201\377CQ\201\377\203DQ\201" \
+  "\377\10CP\200\377@M~\377=K}\3772Av\377\40""1i\377\27(c\377\30)d\377\31" \
+  "*d\377\215\31*e\377\202\30)d\377\7\34,g\3772@u\377CQ\201\377AO\177\377" \
+  "BP\200\377AO\200\377BP\200\377\202AO\200\377\1@N\200\377\207AO\200\377" \
+  "\4@N\177\377\77O~\377@N\177\377@M\177\377\206@N\177\377\12\77M\177\377" \
+  ">L\177\377\77M\177\377\77M~\377\77M\177\377>L~\377\77M~\377:I{\377\34" \
+  ",g\377\30)d\377\212\31*e\377\3\30)d\377\33,f\377:I{\377\202=K}\377\5" \
+  "<K}\377;K}\377<J|\377<K}\377<I{\377\202<J|\377\12;J|\377<J|\377;J|\377" \
+  ":J|\377;J|\377;I|\377;H|\377:I{\377;I|\3779Iz\377\203:I{\377\2)8p\377" \
+  "\27(d\377\214\31*e\377\5\30)d\377!1j\377:G{\3778Ex\3776Fy\377\2027Fy" \
+  "\377\3""7Ey\3777Fy\3777Dy\377\2036Ey\377\10""6Ex\3776Ew\3776Dx\3775D" \
+  "x\3776Cw\3774Cw\377\37""0h\377\30)e\377\216\31*e\377\5\30)d\377\37/i" \
+  "\3773Cw\3771Bu\3772@v\377\2032Av\377\3""2Au\3771@t\3770\77u\377\2031" \
+  "@u\377\3""1@t\377.>s\377\33,f\377\222\31*e\377\10\30)d\377#3l\377-=r" \
+  "\377-<q\377-<r\377,<r\377-<r\377+<r\377\203,<r\377\3,;r\377\35.h\377" \
+  "\30)d\377\224\31*e\377\2&6n\377'7n\377\202(8o\377\5'7o\377'7n\377&6o" \
+  "\377'7n\377\27)d\377\221\31*e\377\2AO\200\377@O\177\377\207AO\200\377" \
+  "\202BP\200\377\1AO\177\377\202BP\200\377\4""9Hz\377(8o\377\27'c\377\30" \
+  ")d\377\216\31*e\377\202\30)d\377\13\27(d\377\33+f\377\40""1j\377'6n\377" \
+  "2Au\377>M}\377FS\202\377ER\201\377DQ\201\377DQ\200\377CQ\201\377\203" \
+  "DQ\201\377\227DR\202\377\203DQ\201\377\1CQ\201\377\202DQ\201\377\10F" \
+  "R\202\377DR\201\3779G{\377-<r\377$4l\377\36/h\377\31*e\377\27(d\377\202" \
+  "\30)d\377\216\31*e\377\11\27(c\377\34-g\3771@u\377\77M~\377BP\200\377" \
+  "BP\177\377BP\200\377AO\200\377BP\200\377\202AO\200\377\1@N\200\377\205" \
+  "AO\200\377\202@O\177\377\4@N\177\377\77O~\377@N\177\377@M\177\377\205" \
+  "@N\177\377\13\77M\177\377@N\177\377\77M\177\377>L\177\377\77M~\377\77" \
+  "M\177\377>L~\377\77M~\3778Gz\377\34-g\377\30)d\377\213\31*e\377\17\32" \
+  "+f\3777Ey\377=K}\377<J|\377=K}\377<K}\377;K}\377<K}\377<J|\377<I{\377" \
+  "<J|\377;J|\377<J|\377;J|\377:J|\377\203;I|\377\7:I{\377;I|\377:I{\377" \
+  "9Iz\377:I{\377;I{\377-=r\377\202\30)d\377\214\31*e\377\5\33+f\3774Bw" \
+  "\3778Fy\3777Fx\3776Fy\377\2037Fy\377\14""7Ey\3776Dy\3776Ey\3776Ex\377" \
+  "6Ey\3776Ew\3776Dx\3776Ex\3776Dx\3775Dx\377-=r\377\30)d\377\216\31*e\377" \
+  "\202\30)d\377\10""0\77t\3772Bv\3771Av\3772@v\3772Av\3772Au\3772Av\377" \
+  "2At\377\2061@u\377\2'7o\377\30)d\377\222\31*e\377\10\30)d\377+;q\377" \
+  "-=r\377-<r\377-;r\377-<r\377,<r\377+<r\377\203,<r\377\1)9o\377\202\30" \
+  ")d\377\223\31*e\377\2\34,g\377'7n\377\202(8o\377\204'7o\377\2\35.h\377" \
+  "\30)d\377\221\31*e\377\3@O\177\377AO\200\377@O\177\377\206AO\200\377" \
+  "\2@N\200\377AO\200\377\202BP\200\377\1AO\200\377\202BP\200\377\3>L~\377" \
+  "#3k\377\32*e\377\202\30)d\377\220\31*e\377\202\30)d\377\7\27(d\377\34" \
+  "-g\377+;q\3778Fy\377\77M\177\377BO\177\377BO\200\377\202CP\200\377\204" \
+  "DQ\201\377\2DQ\200\377DP\200\377\203DQ\201\377\1CQ\201\377\202DQ\201" \
+  "\377\1CQ\201\377\204DQ\201\377\2DP\200\377DQ\200\377\204DQ\201\377\2" \
+  "CP\200\377BP\200\377\202BO\177\377\5=K}\3774Bv\377&6m\377\30)d\377\27" \
+  ")d\377\202\30)d\377\220\31*e\377\4\30)d\377\31*e\377\32+f\3770\77t\377" \
+  "\202BP\200\377\2AO\177\377AO\200\377\202BP\200\377\210AO\200\377\202" \
+  "@O\177\377\3@N\177\377\77O~\377@O\177\377\202@M\177\377\204@N\177\377" \
+  "\202\77M\177\377\10@N\177\377>L\177\377\77M\177\377\77M~\377\77M\177" \
+  "\377>L~\377\77M~\3777Fy\377\202\30)d\377\212\31*e\377\202\30)d\377\1" \
+  "4Cw\377\203=K}\377\5;K}\377<J|\377<K}\377<J|\377<I{\377\203<J|\377\2" \
+  ";J|\377:J|\377\202;J|\377\3;H|\377:I{\377;I|\377\202:I{\377\4""9Hz\377" \
+  ":I{\3775Dw\377\33,f\377\215\31*e\377\2\30)d\377(8o\377\2028Fy\377\203" \
+  "7Fy\377\12""7Ey\3776Ey\3777Dy\3776Ey\3775Ey\3776Ey\3776Ex\3776Dx\377" \
+  "6Ex\3775Dx\377\2026Dx\377\2\32+e\377\30)d\377\216\31*e\377\4\30)d\377" \
+  "#3k\3773Bv\3771Bv\377\2042Av\377\2022Au\377\2061@u\377\2\33+f\377\30" \
+  ")d\377\221\31*e\377\5\30)d\377\37""0i\377.=s\377,=q\377-;r\377\202-<" \
+  "r\377\203,<r\377\4,;r\377,<r\377\40""0i\377\30)d\377\223\31*e\377\2\30" \
+  ")d\377\37""0i\377\202(8o\377\202'7o\377\1&6o\377\202'7o\377\223\31*e" \
+  "\377\2\77O~\377@O\177\377\202AO\200\377\1@O\177\377\205AO\200\377\1@" \
+  "N\200\377\202AO\200\377\12BP\200\377AO\200\377AO\177\377BP\200\377CR" \
+  "\201\377:H{\377*:p\377\32*e\377\27(d\377\30)d\377\221\31*e\377\2\30)" \
+  "d\377\27(d\377\202\27(c\377\15\33,f\377\40""0i\377%5m\377)9p\377/=s\377" \
+  "5Cw\377:H{\377<J|\377>L}\377@M~\377AO\177\377CP\201\377ER\202\377\205" \
+  "FS\202\377\17DQ\202\377BP\200\377AN\177\377\77L~\377=K}\377;I{\3777F" \
+  "y\3772Au\377,;r\377'8o\377\"3k\377\36/h\377\31*e\377\26'c\377\27(c\377" \
+  "\202\30)d\377\221\31*e\377\6\30)d\377\26'c\377\40""1j\3771@u\377@N\177" \
+  "\377CQ\200\377\202BP\200\377\2AO\200\377BP\200\377\202AO\200\377\202" \
+  "@N\200\377\204AO\200\377\1@O\177\377\202AO\200\377\2@N\177\377\77O~\377" \
+  "\207@N\177\377\14\77M\177\377@N\177\377\77M\177\377>L\177\377\77M\177" \
+  "\377\77M~\377\77M\177\377>L~\377@N\177\3772Av\377\32+e\377\30)d\377\214" \
+  "\31*e\377\11""2Av\377>L}\377<J|\377=K}\377<K}\377<J|\377<K}\377<J|\377" \
+  "<I{\377\202<J|\377\5;J|\377<J|\377;J|\377:J|\377;J|\377\203;I|\377\7" \
+  ":I{\3779Iz\377:H{\3779I{\377;I{\377\40""1j\377\30)d\377\214\31*e\377" \
+  "\14\30)d\377\36.h\3778Fz\3778Fy\3777Fy\3776Fy\3777Fy\3777Ey\3777Fy\377" \
+  "7Ey\3776Dy\3775Ey\377\2026Ex\377\2""6Ew\3776Ex\377\2036Dx\377\2%5m\377" \
+  "\30)d\377\217\31*e\377\5\32+e\377.=s\3771Bu\3772Av\3772@v\377\2022Av" \
+  "\377\1""2Au\377\2021@u\377\1""0\77u\377\2041@u\377\2'7n\377\27)d\377" \
+  "\221\31*e\377\202\30)d\377\5*:q\377-=r\377-=q\377-;r\377-<r\377\204," \
+  "<r\377\3+<q\377*:q\377\32+f\377\224\31*e\377\2\30)d\377$4l\377\203(8" \
+  "o\377\4'7o\377&6o\377'7n\377#3l\377\223\31*e\377\6@M\177\377\77N~\377" \
+  "@N\177\377@O\177\377AO\200\377@O\177\377\205AO\200\377\3@N\200\377AO" \
+  "\200\377@N\200\377\202BP\200\377\3AO\177\377BO\177\377BP\200\377\202" \
+  "AO\177\377\4*9p\377\31*d\377\30)d\377\31*d\377\222\31*e\377\205\30)d" \
+  "\377\211\31*e\377\4\32+f\377\35.h\377\37""0i\377\34-g\377\211\31*e\377" \
+  "\205\30)d\377\223\31*e\377\202\30)d\377\2\34,g\3777Fy\377\202AO\177\377" \
+  "\10BP\200\377AO\177\377BP\200\377AO\200\377BP\200\377@N\200\377AO\200" \
+  "\377@N\200\377\207AO\200\377\4@O\177\377@N\177\377\77O~\377@N\177\377" \
+  "\202@M\177\377\206@N\177\377\12\77M\177\377>L\177\377\77M\177\377\77" \
+  "M~\377\77M\177\377>M~\377@M~\377.>s\377\27)d\377\30)d\377\213\31*e\377" \
+  "\5\30)d\377.=s\377=K}\377<J|\377=K}\377\202;K}\377\3<K}\377<J|\377<I" \
+  "{\377\202<J|\377\2;J|\377<J|\377\202:J|\377\202;I|\377\10;H|\377:I{\377" \
+  ";I|\3779Iz\377:I{\3779Iz\377;I{\377%5m\377\202\30)d\377\213\31*e\377" \
+  "\6\30)d\377\31*e\3775Dw\3778Fy\3778Ex\3776Fy\377\2037Fy\377\2""7Ey\377" \
+  "7Dy\377\2036Ey\377\2026Ew\377\6""6Ex\3775Dx\3776Cw\3770@u\377\33+f\377" \
+  "\30)d\377\216\31*e\377\4\30)d\377\40""1j\3772Bv\3771Av\377\2022@v\377" \
+  "\1""2Av\377\2022Au\377\1""2At\377\2020\77u\377\2031@u\377\3""0\77t\377" \
+  "\34-g\377\30)d\377\221\31*e\377\6\30)d\377\36/h\377,<r\377,=q\377-<r" \
+  "\377-;r\377\202,<r\377\1+<r\377\203,<r\377\2&6m\377\31*d\377\223\31*" \
+  "e\377\2\30)d\377\32+e\377\204(8o\377\5&6o\377'7o\377'7n\377\40""1i\377" \
+  "\30)d\377\222\31*e\377\10@N\177\377@M\177\377@N\177\377\77N~\377\77O" \
+  "~\377@O\177\377AO\200\377@O\177\377\206AO\200\377\1@N\200\377\202AO\200" \
+  "\377\13BP\200\377AO\200\377BP\200\377AO\177\377DQ\201\377>K}\377.>s\377" \
+  "#3k\377\32*e\377\27(d\377\30)d\377\235\31*e\377\205\30)d\377\234\31*" \
+  "e\377\13\31*d\377\30)d\377\27(d\377\36.h\377'7n\3775Dw\377CP\201\377" \
+  "BP\200\377AO\177\377BP\200\377AO\200\377\202BP\200\377\212AO\200\377" \
+  "\202@O\177\377\2\77O~\377@N\177\377\202@M\177\377\204@N\177\377\2\77" \
+  "M\177\377@N\177\377\202\77M\177\377\10>L\177\377\77M~\377\77M\177\377" \
+  ">L~\377\77M~\377@M~\377,<r\377\30)d\377\213\31*e\377\202\30)d\377\3+" \
+  ":q\377>L~\377<J|\377\204<K}\377\2<J|\377<I{\377\202<J|\377\203;J|\377" \
+  "\4;I|\377;J|\377;I|\377;H|\377\204:I{\377\4""9Hz\377:I{\377/>s\377\30" \
+  ")d\377\215\31*e\377\4\30)d\377(7o\3777Ey\3777Fx\377\2047Fy\377\2027E" \
+  "y\377\13""6Ey\3775Ey\3776Ey\3776Ex\3776Ew\3776Ex\3775Dx\3776Cw\3775D" \
+  "x\377$4l\377\30)d\377\216\31*e\377\202\30)d\377\12/\77t\3772Bv\3772A" \
+  "v\3772@v\3772Av\3772Au\3772Av\3772At\3771@u\3770\77u\377\2041@u\377\1" \
+  ")9p\377\224\31*e\377\3&6n\377-=r\377-<q\377\203-<r\377\1+<r\377\202," \
+  "<r\377\4+<q\377,<r\377\37/i\377\30)d\377\223\31*e\377\2\30)d\377#3k\377" \
+  "\203(8o\377\6'7o\377&6o\377'7o\377&6n\377\34-g\377\30)d\377\222\31*e" \
+  "\377\202@N\177\377\202@M\177\377\202@O\177\377\3@N\177\377AO\200\377" \
+  "@O\177\377\206AO\200\377\1@N\200\377\202AO\200\377\202BP\200\377\2AO" \
+  "\200\377AO\177\377\202BP\200\377\6@N\177\377=L}\377/\77s\377\33,f\377" \
+  "\27(c\377\30)d\377\273\31*e\377\6\30)d\377\26(c\377$4l\3777Fy\377\77" \
+  "M~\377AO\177\377\202BP\200\377\2AO\177\377AO\200\377\202BP\200\377\202" \
+  "AO\200\377\202@N\200\377\205AO\200\377\7@O\177\377AO\200\377@O\177\377" \
+  "\77N~\377\77O~\377@N\177\377@M\177\377\207@N\177\377\1\77M\177\377\202" \
+  ">L\177\377\202\77M\177\377\202\77M~\377\2@N~\377&6m\377\202\30)d\377" \
+  "\213\31*e\377\12\30)d\377+:p\377<J}\377=K}\377=J|\377<K}\377;K}\377<" \
+  "J|\377<K}\377<I{\377\202<J|\377\13;J|\377<J|\377;J|\377:J|\377;J|\377" \
+  ";I|\377;H|\377:I{\377;I|\377:I{\3779Iz\377\202:I{\377\3""8Fz\377\32+" \
+  "f\377\30)d\377\214\31*e\377\2\30)d\377\35-h\377\2028Fy\377\2""7Fy\377" \
+  "6Fy\377\2037Fy\377\15""6Ey\3777Dy\3775Ey\3776Ey\3776Ex\3776Ew\3776Dx" \
+  "\3776Ex\3776Cw\3775Dx\3770\77t\377\27)d\377\30)d\377\216\31*e\377\5\30" \
+  ")d\377$5l\3773Bv\3771Bu\3772@v\377\2032Av\377\2""2Au\3772At\377\2041" \
+  "@u\377\4""0\77t\3771@u\377\35.h\377\30)d\377\221\31*e\377\15\30)d\377" \
+  "\32+f\377-<s\377-=r\377-<r\377-;r\377,<r\377-<r\377+<r\377,<r\377,;r" \
+  "\377,<r\377+:q\377\202\30)d\377\222\31*e\377\3\30)d\377\32+e\377'7n\377" \
+  "\203(8o\377\202'7o\377\3&6o\377'7n\377\27)d\377\223\31*e\377\204@N\177" \
+  "\377\2@M\177\377@N\177\377\202@O\177\377\1@N\177\377\211AO\200\377\1" \
+  "@N\200\377\202AO\200\377\202BP\200\377\1AO\200\377\202BP\200\377\5CP" \
+  "\200\377DR\201\3777Fy\377$5m\377\35.g\377\203\30)d\377\1\30)e\377\261" \
+  "\31*e\377\202\30)d\377\10\27)d\377\32+e\377\37""0i\377,<q\377>L~\377" \
+  "CQ\201\377BP\200\377BP\177\377\204BP\200\377\202AO\200\377\1@N\200\377" \
+  "\206AO\200\377\1@O\177\377\202AO\200\377\5@N\177\377@O\177\377\77N~\377" \
+  "@N\177\377@M\177\377\207@N\177\377\202\77M\177\377\1>L\177\377\202\77" \
+  "M\177\377\203\77M~\377\3:Hz\377\"2k\377\30)d\377\213\31*e\377\5\30)d" \
+  "\377\31*e\377*9p\377>L~\377=K}\377\203<K}\377\2<J|\377<K}\377\204<J|" \
+  "\377\203;J|\377\202;I|\377\1;H|\377\202;I|\377\204:I{\377\3""9Hz\377" \
+  "\36/i\377\30)d\377\214\31*e\377\6\30)d\377\32+e\3776Dx\3778Fy\3777Fx" \
+  "\3776Fy\377\2037Fy\377\15""6Ey\3777Dy\3775Ey\3776Ex\3776Ey\3776Ex\377" \
+  "6Ew\3776Ex\3775Dx\3776Dx\3774Cw\377\34-g\377\30)d\377\217\31*e\377\3" \
+  "\32+f\3770@t\3771Au\377\2042Av\377\2022Au\377\2""1@u\3770\77u\377\202" \
+  "1@u\377\4""0\77t\3771@u\377*9p\377\27(c\377\222\31*e\377\5\30)d\377$" \
+  "5m\377-=r\377,=q\377-;r\377\202-<r\377\205,<r\377\2\40""0j\377\30)d\377" \
+  "\223\31*e\377\3\30)d\377\37""0i\377'7n\377\202(8o\377\2'7o\377&6o\377" \
+  "\202'7o\377\2\33,f\377\30)d\377\223\31*e\377\205@N\177\377\10@M\177\377" \
+  "@N\177\377\77N~\377\77O~\377@N\177\377@O\177\377AO\200\377@O\177\377" \
+  "\206AO\200\377\202@N\200\377\202AO\200\377\207BP\200\377\7>L}\3778Gz" \
+  "\377-<r\377\40""0i\377\26'b\377\27(c\377\30)d\377\254\31*e\377\10\30" \
+  ")d\377\27(d\377\26'c\377\31*e\377&6m\3772Av\377;I{\377@N\177\377\202" \
+  "BP\200\377\1AO\177\377\204BP\200\377\202AO\200\377\202@N\200\377\210" \
+  "AO\200\377\202@O\177\377\4\77O~\377\77N~\377@N\177\377@M\177\377\205" \
+  "@N\177\377\2\77M\177\377@N\177\377\202\77M\177\377\2>L\177\377\77M\177" \
+  "\377\202\77M~\377\4>L}\377@M~\3771@u\377\34-g\377\202\30)d\377\213\31" \
+  "*e\377\13\30*e\3770@u\377=K}\377<K}\377=J|\377<K}\377;K}\377<J|\377<" \
+  "K}\377<J|\377<I{\377\202<J|\377\202;J|\377\5:J|\377;I|\377;J|\377;I|" \
+  "\377;H|\377\204:I{\377\4""9Hz\377:Iz\377'7m\377\30)d\377\216\31*e\377" \
+  "\3,;r\3778Fy\3778Ex\377\2037Fy\377\3""7Ey\3777Fy\3777Dy\377\2036Ey\377" \
+  "\2""6Ex\3776Ew\377\2036Dx\377\3""5Cw\377'7n\377\30)d\377\217\31*e\377" \
+  "\4\30)d\377%5m\3772Bv\3771Av\377\2032Av\377\4""2Au\3771@u\3772At\377" \
+  "0\77u\377\2041@u\377\3""0\77t\377\33,f\377\30)d\377\221\31*e\377\7\30" \
+  ")d\377\33+e\377-=s\377-=r\377-=q\377-;r\377-<r\377\204,<r\377\4,;r\377" \
+  "*9p\377\31*e\377\30)d\377\224\31*e\377\1$4l\377\202(8o\377\202'7o\377" \
+  "\202&6o\377\2(8o\377\30)d\377\224\31*e\377\2@N\177\377\77M\177\377\205" \
+  "@N\177\377\202@M\177\377\4@N\177\377\77N~\377\77O~\377@N\177\377\202" \
+  "AO\200\377\1@O\177\377\207AO\200\377\1@N\200\377\203AO\200\377\202BP" \
+  "\200\377\202AO\200\377\11BP\177\377BP\200\377CQ\201\377AO\200\3773Bv" \
+  "\377%5l\377\34,g\377\32+f\377\31*e\377\204\30)d\377\236\31*e\377\205" \
+  "\30)d\377\11\31*e\377\33,f\377\37/h\377+;q\377:Hz\377CQ\201\377CQ\200" \
+  "\377BP\200\377AO\177\377\202BP\200\377\2AO\200\377BP\200\377\203AO\200" \
+  "\377\202@N\200\377\207AO\200\377\2@O\177\377AO\200\377\202@O\177\377" \
+  "\1\77O~\377\202@N\177\377\1@M\177\377\205@N\177\377\1\77M\177\377\202" \
+  "@N\177\377\2\77M\177\377>L\177\377\202\77M\177\377\6\77M~\377>L~\377" \
+  "\77M~\377>L}\377,<r\377\30)d\377\214\31*e\377\4\30)d\377\31*e\3772@u" \
+  "\377>K}\377\202=K}\377\4;K}\377<K}\377<J|\377<K}\377\203<J|\377\13;J" \
+  "|\377<J|\377;J|\377:J|\377;I|\377;J|\377;I|\377:I{\377;I|\377:I{\377" \
+  "9Iz\377\203:I{\377\2""1\77u\377\30)d\377\215\31*e\377\6\30)d\377!0j\377" \
+  "8Fz\3778Fx\3777Fy\3776Fy\377\2027Fy\377\1""7Ey\377\2026Ey\377\13""5E" \
+  "y\3776Ex\3776Ey\3776Ex\3776Dx\3776Ex\3776Cw\3776Dx\3773Bv\377\31*e\377" \
+  "\30)d\377\216\31*e\377\12\30)d\377\32+f\3773Bv\3772Bv\3772Av\3772@v\377" \
+  "2Av\3772Au\3772Av\3772At\377\2051@u\377\2""0\77t\377(7o\377\223\31*e" \
+  "\377\5\30)d\377$4m\377-=r\377-=q\377-;r\377\202-<r\377\6,<r\377+<r\377" \
+  ",<r\377,;r\377+;q\377\"3k\377\224\31*e\377\2\30)d\377\32+e\377\204(8" \
+  "o\377\4&6o\377'7o\377'7n\377\35.h\377\225\31*e\377\3\77M\177\377@N\177" \
+  "\377\77M\177\377\206@N\177\377\4@M\177\377@N\177\377\77N~\377\77O~\377" \
+  "\202@O\177\377\2AO\200\377@O\177\377\207AO\200\377\202@N\200\377\203" \
+  "AO\200\377\202BP\200\377\3AO\200\377BP\200\377AO\177\377\202BP\200\377" \
+  "\13CQ\201\377AO\177\377:I{\3773Bv\377+;q\377%5m\377\36/h\377\30)e\377" \
+  "\26'c\377\27(c\377\27(d\377\202\30)d\377\225\31*e\377\202\30)d\377\1" \
+  "\27(c\377\202\26'c\377\6\33,f\377!2j\377(8o\377/>s\3776Ex\377=K}\377" \
+  "\202CQ\200\377\204BP\200\377\1AO\200\377\203BP\200\377\202AO\200\377" \
+  "\202@N\200\377\212AO\200\377\4@N\177\377@O\177\377\77O~\377@N\177\377" \
+  "\202@M\177\377\207@N\177\377\202\77M\177\377\2>L\177\377\77M~\377\202" \
+  "\77M\177\377\6>L~\377\77M~\377:H{\377\"2k\377\27(c\377\30)d\377\213\31" \
+  "*e\377\14\30)d\377\33,f\3775Cw\377>L}\377<J|\377=K}\377<K}\377;K}\377" \
+  "<J|\377<K}\377<J|\377<I{\377\203<J|\377\17;J|\377:J|\377;I|\377;J|\377" \
+  ";I|\377;H|\377;I|\377:I{\3779Iz\377:I{\377:H{\377:I{\377/>s\377\31)e" \
+  "\377\30)d\377\214\31*e\377\6\30)d\377\34-g\3776Ey\3778Fy\3777Fy\3776" \
+  "Fy\377\2027Fy\377\16""7Ey\3776Ey\3777Dy\3776Ey\3775Ey\3776Ey\3776Ex\377" \
+  "6Ew\3776Ex\3776Dx\3775Cx\3776Dx\377\36/h\377\30)d\377\216\31*e\377\202" \
+  "\30)d\377\4,;r\3772Bv\3771Bu\3772@v\377\2032Av\377\2""2Au\3771@t\377" \
+  "\2041@u\377\4""0\77t\3771@u\377\35-h\377\30)d\377\222\31*e\377\3\32+" \
+  "e\377*:q\377,<q\377\202-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\4+<" \
+  "q\377,;r\377\33-g\377\30)d\377\223\31*e\377\12\30)d\377!1j\377(8o\377" \
+  "'7n\377'7o\377(8o\377&6o\377'7n\377&6n\377\35-g\377\225\31*e\377\202" \
+  ">L\177\377\2@N\177\377\77M\177\377\207@N\177\377\202@M\177\377\7@N\177" \
+  "\377\77N~\377\77O~\377AN\200\377@O\177\377AO\200\377@O\177\377\210AO" \
+  "\200\377\202@N\200\377\3AO\200\377BP\200\377AO\200\377\203BP\200\377" \
+  "\1AO\200\377\207BP\200\377\5>K}\3775Dw\377+;p\377#2k\377\32+f\377\225" \
+  "\31*e\377\5\35.g\377&6m\377/>t\3778Gz\377@O\177\377\204BP\200\377\1A" \
+  "O\177\377\202BP\200\377\1AO\200\377\203BP\200\377\3AO\200\377BP\200\377" \
+  "AO\200\377\202@N\200\377\210AO\200\377\2@O\177\377AO\200\377\203@O\177" \
+  "\377\1\77O~\377\202@N\177\377\1@M\177\377\210@N\177\377\202\77M\177\377" \
+  "\2>L\177\377\77M~\377\202\77M\177\377\6>L~\377\77M}\377\77M~\3775Dx\377" \
+  "\31*e\377\30)d\377\213\31*e\377\202\30)d\377\2\32+e\3779Gz\377\203=K" \
+  "}\377\4;K}\377<K}\377<J|\377<K}\377\203<J|\377\20;J|\377<J|\377;J|\377" \
+  ":J|\377;I|\377;J|\377;I|\377:I{\377;I|\377:I{\3779Iz\377:I{\3779Hz\377" \
+  ":I{\3774Bw\377\32+f\377\215\31*e\377\6\30)d\377\31*e\3771@u\3778Fx\377" \
+  "8Fy\3776Fy\377\2047Fy\377\14""7Dy\3776Ey\3776Ex\3776Ey\3776Ex\3776Ew" \
+  "\3776Dx\3775Dx\3776Cw\3776Dx\377(8o\377\30)d\377\217\31*e\377\4\30)d" \
+  "\377\40""1i\3772Au\3771Bv\377\2052Av\377\3""2Au\3771@u\3770\77u\377\202" \
+  "1@u\377\4""0\77t\3771@u\377)9o\377\27(d\377\222\31*e\377\7\30)d\377\37" \
+  "0i\377-=s\377-=q\377-<r\377-;r\377-<r\377\203,<r\377\4+<q\377,<r\377" \
+  "&6n\377\30)d\377\223\31*e\377\4\30)d\377\30)e\377(8o\377'7n\377\202(" \
+  "8o\377\5'7o\377'7n\377&6o\377%5l\377\30)d\377\225\31*e\377\202\77M\177" \
+  "\377\2>L\177\377\77M\177\377\202@N\177\377\1\77M\177\377\206@N\177\377" \
+  "\1@M\177\377\202@N\177\377\1\77O~\377\202@O\177\377\202AO\200\377\1@" \
+  "O\177\377\210AO\200\377\202@N\200\377\204AO\200\377\212BP\200\377\33" \
+  "CQ\201\377DQ\201\377DR\201\377\77M~\377=K|\377:I{\3779Hz\3777Fy\3775" \
+  "Dx\3774Cv\3772Au\3770\77t\377.>s\377-=r\377/\77s\3771@t\3772Bv\3774C" \
+  "w\3776Ex\3778Gy\3779H{\377;J|\377=K}\377AO\177\377DR\201\377CQ\201\377" \
+  "CQ\200\377\212BP\200\377\204AO\200\377\202@N\200\377\213AO\200\377\5" \
+  "@O\177\377@N\177\377\77O~\377\77N~\377@N\177\377\202@M\177\377\206@N" \
+  "\177\377\3\77M\177\377@N\177\377\77M\177\377\202>L\177\377\202\77M\177" \
+  "\377\7\77M~\377>L~\377\77M~\377>M~\377*:p\377\27(d\377\30)d\377\214\31" \
+  "*e\377\5\30)d\377\37/i\3779Hz\377=K}\377<J|\377\203<K}\377\4<J|\377<" \
+  "K}\377<J|\377<I{\377\203<J|\377\11;J|\377:J|\377;I|\377;J|\377;I|\377" \
+  ";H|\377;I|\377:I{\3779Iz\377\203:I{\377\3""4Cw\377\33,f\377\30)d\377" \
+  "\215\31*e\377\4\27(d\377)8o\3778Fy\3777Ex\377\2047Fy\377\1""7Ey\377\202" \
+  "6Ey\377\12""5Ey\3776Ey\3776Ex\3776Ew\3776Dx\3776Ex\3776Dx\3775Cx\377" \
+  "3Bv\377\33,f\377\220\31*e\377\5\30)d\377-<r\3772Bv\3772Av\3772@v\377" \
+  "\2032Av\377\3""1@u\3772At\3770\77u\377\2041@u\377\3""0\77t\377\32+e\377" \
+  "\30)d\377\221\31*e\377\202\30)d\377\5*:p\377-=r\377-<r\377-;r\377-<r" \
+  "\377\206,<r\377\2\33+f\377\30)d\377\223\31*e\377\2\30)d\377\37""0i\377" \
+  "\203(8o\377\203'7o\377\3'7n\377\37/i\377\30)d\377\225\31*e\377\4\77M" \
+  "\177\377\77M~\377\77M\177\377>L\177\377\202\77M\177\377\2@N\177\377\77" \
+  "M\177\377\206@N\177\377\202@M\177\377\5@N\177\377\77N~\377\77O~\377@" \
+  "N\177\377@O\177\377\213AO\200\377\203@N\200\377\204AO\200\377\203BP\200" \
+  "\377\1AO\200\377\241BP\200\377\1AO\200\377\203BP\200\377\204AO\200\377" \
+  "\203@N\200\377\213AO\200\377\2@O\177\377@N\177\377\202\77O~\377\202@" \
+  "N\177\377\1@M\177\377\211@N\177\377\1\77M\177\377\202>L\177\377\7\77" \
+  "M~\377\77M\177\377\77M~\377>L}\377\77M~\3778Gz\377\35.h\377\202\30)d" \
+  "\377\214\31*e\377\6\30)d\377\37/h\377<I|\377=K}\377<J|\377=K}\377\202" \
+  ";K}\377\202<K}\377\2<J|\377<I{\377\202<J|\377\202;J|\377\5:J|\377;I|" \
+  "\377;J|\377;I|\377;H|\377\202;I|\377\203:I{\377\4""9Hz\3776Ex\377\33" \
+  ",f\377\30)d\377\215\31*e\377\6\30)d\377$4l\3778Fz\3778Fx\3777Fy\3776" \
+  "Fy\377\2027Fy\377\3""7Ey\3776Ey\3777Dy\377\2025Ey\377\11""6Ey\3776Ex" \
+  "\3776Ew\3776Ex\3776Dx\3776Cw\3776Ey\377!1j\377\30)d\377\217\31*e\377" \
+  "\4\30)d\377\"2k\3773Bv\3772Bv\377\2022@v\377\1""2Av\377\2022Au\377\3" \
+  "2At\3771@t\3770\77u\377\2041@u\377\2%5m\377\30)d\377\222\31*e\377\11" \
+  "\30)d\377!1j\377-=s\377,=q\377-<r\377-;r\377-<r\377,<r\377+<r\377\202" \
+  ",<r\377\3,;r\377%5m\377\30)d\377\225\31*e\377\1$4l\377\203(8o\377\1'" \
+  "7o\377\202&6o\377\2(8n\377\30)d\377\226\31*e\377\202\77M~\377\3\77M\177" \
+  "\377\77M~\377\77M\177\377\202>L\177\377\203\77M\177\377\207@N\177\377" \
+  "\202@M\177\377\202@N\177\377\1\77O~\377\203@O\177\377\215AO\200\377\203" \
+  "@N\200\377\205AO\200\377\207BP\200\377\1AO\200\377\223BP\200\377\204" \
+  "AO\200\377\204@N\200\377\213AO\200\377\1@O\177\377\202AO\200\377\202" \
+  "@O\177\377\202\77O~\377\1@N\177\377\203@M\177\377\206@N\177\377\2\77" \
+  "M\177\377@N\177\377\202\77M\177\377\11>L\177\377\77M\177\377\77M~\377" \
+  "\77M\177\377\77M~\377>L}\377\77M~\377;I{\377+;q\377\202\30)d\377\214" \
+  "\31*e\377\3\30*d\377\30)d\377$4l\377\202=K}\377\1=J|\377\202<K}\377\3" \
+  "<J|\377<K}\377<J|\377\202<I{\377\203<J|\377\17;J|\377:J|\377;I|\377;" \
+  "J|\377;I|\377;H|\377:I{\377;I|\377:I{\3779Iz\3779Hz\377:I{\3778Gy\377" \
+  "\37""0i\377\30)d\377\215\31*e\377\13\30)d\377\36/h\3777Ey\3777Ex\377" \
+  "7Fy\3776Fy\3777Fy\3777Ey\3777Fy\3777Ey\3777Dy\377\2036Ey\377\2""6Ex\377" \
+  "6Ew\377\2036Dx\377\3""5Dx\377)9p\377\27(d\377\217\31*e\377\12\30)d\377" \
+  "\32+f\3772Av\3772Bv\3771Av\3772@v\3772Av\3772Au\3772Av\3772At\377\205" \
+  "1@u\377\3""1@t\377/>s\377\33,f\377\224\31*e\377\4+:p\377,=r\377-<q\377" \
+  "-;r\377\202-<r\377\6,<r\377+<r\377,<r\377+<q\377+;q\377\36.h\377\224" \
+  "\31*e\377\3\30)d\377\33+f\377'7n\377\203(8o\377\5'7o\377&6o\377'7o\377" \
+  "!1j\377\30)d\377\226\31*e\377\3\77M~\377>L}\377\77M~\377\204\77M\177" \
+  "\377\2>L\177\377\77M\177\377\211@N\177\377\203@M\177\377\3@N\177\377" \
+  "\77N~\377\77O~\377\203@O\177\377\202AO\200\377\1@O\177\377\213AO\200" \
+  "\377\205@N\200\377\207AO\200\377\216BP\200\377\206AO\200\377\205@N\200" \
+  "\377\214AO\200\377\1@O\177\377\202AO\200\377\4@O\177\377@N\177\377@O" \
+  "\177\377\77N~\377\202@N\177\377\202@M\177\377\206@N\177\377\1\77M\177" \
+  "\377\202@N\177\377\202\77M\177\377\1>L\177\377\203\77M\177\377\202\77" \
+  "M~\377\3AO\177\3770\77u\377\34-g\377\202\30)d\377\214\31*e\377\6\30)" \
+  "d\377\27(d\377/\77t\377<J|\377=K}\377=J|\377\202<K}\377\4;K}\377<K}\377" \
+  "<J|\377<I{\377\203<J|\377\202;J|\377\5:J|\377;I|\377;J|\377;I|\377;H" \
+  "|\377\202;I|\377\2:I{\3779Iz\377\202:I{\377\3""9Hz\377\36.h\377\30)d" \
+  "\377\215\31*e\377\6\31*d\377\30)d\3773Bv\3778Fy\3777Fx\3776Fy\377\203" \
+  "7Fy\377\2""7Ey\3776Dy\377\2026Ey\377\3""6Ex\3776Ey\3776Ew\377\2026Ex" \
+  "\377\5""5Dx\3776Cw\3771Au\377\32+f\377\30*e\377\220\31*e\377\3(9o\377" \
+  "2Bv\3771Bu\377\2042Av\377\4""2Au\3771@t\3771@u\3770\77u\377\2021@u\377" \
+  "\4""0\77t\3772@u\377#3l\377\30)d\377\222\31*e\377\4\30)d\377\40/i\377" \
+  "-<s\377-=q\377\202-<r\377\7,<r\377-<r\377+<r\377,<r\377,;r\377,<r\377" \
+  ")9p\377\225\31*e\377\2\30)d\377!1j\377\202(8o\377\6'7o\377(8o\377&6o" \
+  "\377'7n\377'7o\377\34-g\377\227\31*e\377\12-<r\377=K|\377\77M~\377\77" \
+  "L}\377>L~\377\77M~\377\77M\177\377\77M~\377\77M\177\377>L\177\377\202" \
+  "\77M\177\377\202@N\177\377\1\77M\177\377\207@N\177\377\202@M\177\377" \
+  "\202@N\177\377\5\77N~\377\77O~\377@O\177\377@N\177\377@O\177\377\226" \
+  "AO\200\377\216@N\200\377\222AO\200\377\1@O\177\377\202AO\200\377\202" \
+  "@O\177\377\1@N\177\377\202\77O~\377\1\77N~\377\202@N\177\377\1@M\177" \
+  "\377\212@N\177\377\202\77M\177\377\1>L\177\377\203\77M\177\377\10\77" \
+  "M~\377>L~\377\77M}\377\77M~\3779Hz\377!2k\377\27(c\377\30)d\377\214\31" \
+  "*e\377\15\30*d\377\30)d\377\35.h\3776Ex\377=K}\377<J|\377=K}\377<K}\377" \
+  ";K}\377<J|\377<K}\377<J|\377<I{\377\202<J|\377\6;J|\377<J|\377;J|\377" \
+  ":J|\377;I|\377;J|\377\202;I|\377\11:I{\377;I|\377:I{\3779Iz\3779Hz\377" \
+  ":I{\3779Hz\377#3l\377\30)d\377\215\31*e\377\202\30)d\377\4/>s\3778Fz" \
+  "\3778Ex\3776Fy\377\2027Fy\377\17""7Ey\3777Fy\3777Ey\3776Dy\3775Ey\377" \
+  "6Ex\3776Ey\3776Ex\3776Dx\3776Ex\3775Dx\3776Cx\3775Dx\377\37""0j\377\30" \
+  ")d\377\217\31*e\377\14\30)d\377\35.g\3772Bu\3771Av\3772Av\3772@v\377" \
+  "2Av\3772Au\3772Av\3772Au\3771@u\3770\77u\377\2041@u\377\2-<r\377\27(" \
+  "c\377\222\31*e\377\202\30)d\377\7):p\377-=r\377-<r\377-;r\377,<r\377" \
+  "-<r\377+<r\377\203,<r\377\3,;r\377\40""0i\377\30)d\377\223\31*e\377\202" \
+  "\30)d\377\202(8o\377\7'7o\377(8o\377&6o\377'7o\377&6o\377#3k\377\30)" \
+  "d\377\227\31*e\377\5\30)d\377\36/h\3772Av\377@N\177\377\77M}\377\202" \
+  "\77M~\377\203\77M\177\377\202>L\177\377\202\77M\177\377\212@N\177\377" \
+  "\202@M\177\377\202@N\177\377\4\77N~\377\77O~\377@O\177\377@N\177\377" \
+  "\202@O\177\377\202AO\200\377\1@O\177\377\255AO\200\377\1@O\177\377\203" \
+  "AO\200\377\3@O\177\377@N\177\377@O\177\377\202\77O~\377\202@N\177\377" \
+  "\203@M\177\377\207@N\177\377\2\77M\177\377@N\177\377\202\77M\177\377" \
+  "\202>L\177\377\12\77M\177\377\77M~\377\77M\177\377\77M~\377>L~\377\77" \
+  "M~\377=K}\377(7n\377\32+f\377\30)d\377\216\31*e\377\10\27(d\377&7n\377" \
+  ":H{\377=K}\377<J|\377=K}\377<K}\377;K}\377\202<K}\377\2<J|\377<I{\377" \
+  "\202<J|\377\14;J|\377<J|\377;J|\377:J|\377;I|\377;J|\377;I|\377;H|\377" \
+  ":I{\377;I|\377:I{\3779Iz\377\202:I{\377\2;J|\377$4m\377\202\30)d\377" \
+  "\215\31*e\377\13\30)d\377(8o\3778Fy\3778Ex\3777Fy\3776Fy\3777Fy\3777" \
+  "Ey\3777Fy\3776Ey\3777Dy\377\2036Ey\377\10""6Ex\3776Ew\3776Ex\3776Dx\377" \
+  "6Cx\3776Dx\377%5m\377\27(d\377\217\31*e\377\3\30)d\377\30)e\377/\77t" \
+  "\377\2022Bv\377\1""2@v\377\2032Av\377\3""1@u\3772At\3770\77u\377\203" \
+  "1@u\377\4""0\77u\3770\77t\377\36/h\377\30)d\377\222\31*e\377\7\30)d\377" \
+  "!1j\377.=s\377,=r\377-<r\377-;r\377-<r\377\205,<r\377\1)9p\377\202\30" \
+  ")d\377\223\31*e\377\5\30)d\377!2k\377(8o\377'7n\377(8o\377\202'7o\377" \
+  "\4'7n\377'7o\377!2j\377\30)d\377\231\31*e\377\6\30)d\377%4l\377=K|\377" \
+  ">L}\377\77M~\377>L}\377\202\77M~\377\2\77M\177\377\77M~\377\202\77M\177" \
+  "\377\1>L\177\377\202\77M\177\377\2@N\177\377\77M\177\377\211@N\177\377" \
+  "\202@M\177\377\203@N\177\377\2\77N~\377\77O~\377\204@O\177\377\244AO" \
+  "\200\377\1@O\177\377\204AO\200\377\202@O\177\377\2@N\177\377@O\177\377" \
+  "\202\77O~\377\1\77N~\377\202@N\177\377\202@M\177\377\211@N\177\377\2" \
+  "\77M\177\377@N\177\377\203\77M\177\377\3>L\177\377\77M\177\377\77M~\377" \
+  "\202\77M\177\377\1>L~\377\202\77M~\377\4>L}\3776Ex\377\33,f\377\30)d" \
+  "\377\215\31*e\377\202\30)d\377\11\31*e\377,<r\377=K}\377<J|\377=K}\377" \
+  "<K}\377;K}\377<J|\377<K}\377\202<J|\377\1<I{\377\204<J|\377\4:J|\377" \
+  ";J|\377;I|\377;J|\377\202;I|\377\11:I{\377;I|\377:I{\3779Iz\3779Hz\377" \
+  "9Iz\377:H{\377&6n\377\30)d\377\215\31*e\377\202\30)d\377\5\"1k\3778G" \
+  "z\3778Fy\3777Fy\3776Fy\377\2037Fy\377\4""6Ey\3777Ey\3776Ey\3775Ey\377" \
+  "\2026Ey\377\6""6Ew\3776Dx\3775Dx\3776Cw\3775Dx\377.=s\377\221\31*e\377" \
+  "\5\30)d\377(8o\3773Bv\3771Bv\3772@v\377\2042Av\377\1""2At\377\2041@u" \
+  "\377\4""0\77t\3771@u\377*:q\377\30*d\377\222\31*e\377\6\30)d\377\31*" \
+  "e\377,<q\377,<r\377-=q\377-;r\377\202-<r\377\7,<r\377+<r\377,<r\377+" \
+  ";q\377,<r\377\36/h\377\30)d\377\224\31*e\377\3\32+e\377&6m\377'7n\377" \
+  "\202(8o\377\5'7o\377&6o\377'7o\377'7n\377\27(d\377\232\31*e\377\11\30" \
+  ")d\377\27(d\377\33,f\377)9p\3779Gz\377AO\177\377\77M~\377>M}\377\77M" \
+  "~\377\202\77M\177\377\3\77M~\377\77M\177\377>L\177\377\202\77M\177\377" \
+  "\214@N\177\377\203@M\177\377\202@N\177\377\1\77N~\377\203\77O~\377\1" \
+  "@N\177\377\203@O\177\377\241AO\200\377\203@O\177\377\1@N\177\377\203" \
+  "\77O~\377\1\77N~\377\202@N\177\377\203@M\177\377\214@N\177\377\1\77M" \
+  "\177\377\203>L\177\377\1\77M~\377\202\77M\177\377\10\77M~\377>L~\377" \
+  "\77M~\377@M~\3771Au\377#3k\377\27(d\377\30)d\377\216\31*e\377\4\30)d" \
+  "\377\37/h\3774Cw\377>L~\377\202=K}\377\2<K}\377;K}\377\202<K}\377\1<" \
+  "J|\377\202<I{\377\202<J|\377\10;J|\377<J|\377;J|\377:J|\377;I|\377;J" \
+  "|\377;I|\377;H|\377\202;I|\377\2:I{\3779Iz\377\202:I{\377\3;J{\377*9" \
+  "p\377\31)e\377\216\31*e\377\2\30)d\377!2j\377\2028Fy\377\2""7Ex\3776" \
+  "Fy\377\2027Fy\377\5""7Ey\3776Fy\3777Ey\3776Ey\3775Ey\377\2036Ex\377\7" \
+  "6Dx\3776Ex\3776Dx\3775Cx\3774Dw\377\35.g\377\30)d\377\217\31*e\377\4" \
+  "\30)d\377\35-h\3772Au\3771Au\377\2052Av\377\2021@u\377\1""0\77u\377\205" \
+  "1@u\377\2\34-g\377\30)d\377\223\31*e\377\3!1j\377,<s\377-=q\377\202-" \
+  "<r\377\3,<r\377-<r\377+<r\377\203,<r\377\1)9o\377\225\31*e\377\2\30)" \
+  "d\377\36.h\377\203(8o\377\202'7o\377\4&6o\377'7o\377\40""0i\377\30)d" \
+  "\377\234\31*e\377\7\30)d\377\31*e\377\31)d\377%5m\377<K|\377\77M~\377" \
+  ">L}\377\202\77M~\377\3\77M\177\377\77M~\377\77M\177\377\202>L\177\377" \
+  "\3\77M\177\377>L\177\377\77M\177\377\214@N\177\377\203@M\177\377\202" \
+  "@N\177\377\1@M\177\377\203\77O~\377\2@O\177\377@N\177\377\202@O\177\377" \
+  "\2\77O~\377@O\177\377\212AO\200\377\3@O\177\377AO\200\377@O\177\377\212" \
+  "AO\200\377\2@O\177\377\77O~\377\202@O\177\377\2@N\177\377@O\177\377\203" \
+  "\77O~\377\1@M\177\377\203@N\177\377\203@M\177\377\211@N\177\377\5\77" \
+  "M\177\377@N\177\377\77M\177\377>L\177\377\77M\177\377\202>L\177\377\5" \
+  "\77M\177\377\77M~\377\77M\177\377\77M~\377>L~\377\202\77M~\377\3""5C" \
+  "w\377\34-g\377\31*e\377\202\30)d\377\216\31*e\377\11\30)d\377\"3k\377" \
+  "<J|\377=K}\377<J|\377=K}\377<K}\377;K}\377<K}\377\202<J|\377\202<I{\377" \
+  "\202<J|\377\2;J|\377<J|\377\202:J|\377\202;J|\377\2;I|\377;H|\377\202" \
+  ":I{\377\2029Iz\377\4:I{\3779Hz\377:I{\377%5m\377\202\30)d\377\216\31" \
+  "*e\377\5\34-g\3775Dx\3778Fx\3777Ex\3776Fy\377\2027Fy\377\5""7Ey\3777" \
+  "Fy\3777Dy\3776Dy\3775Ey\377\2026Ey\377\2026Ew\377\5""6Ex\3776Dx\3776" \
+  "Cw\3776Ex\377\40""1j\377\202\30)d\377\217\31*e\377\5\27(d\377-=r\377" \
+  "2Bv\3771Av\3772@v\377\2022Av\377\2022Au\377\1""2At\377\2020\77u\377\204" \
+  "1@u\377\1$4l\377\202\30)d\377\223\31*e\377\4*:p\377-=r\377-<q\377-;r" \
+  "\377\202-<r\377\202+<r\377\5,<r\377+;q\377,<r\377\40""1j\377\30)d\377" \
+  "\224\31*e\377\2\30)d\377%5m\377\202(8o\377\202'7o\377\4&6o\377'7n\377" \
+  "'7o\377\32+e\377\240\31*e\377\202\30)d\377\5(8o\3777Ex\377@N\177\377" \
+  "\77M~\377\77M}\377\202\77M~\377\204\77M\177\377\202>L\177\377\202\77" \
+  "M\177\377\202@N\177\377\1\77M\177\377\214@N\177\377\204@M\177\377\204" \
+  "@N\177\377\1\77N~\377\211\77O~\377\204@O\177\377\212\77O~\377\1\77N~" \
+  "\377\205@N\177\377\203@M\177\377\214@N\177\377\1\77M\177\377\202@N\177" \
+  "\377\203\77M\177\377\1>L\177\377\202\77M\177\377\2\77M~\377\77M\177\377" \
+  "\202\77M~\377\7\77M}\377@N~\377=K|\3771@u\377\40""1j\377\26(c\377\30" \
+  ")d\377\217\31*e\377\6\30)d\377\33+f\377-<r\377>M~\377=K}\377=J|\377\202" \
+  "<K}\377\5;K}\377<J|\377<K}\377<J|\377<I{\377\202<J|\377\2;J|\377<J|\377" \
+  "\202;J|\377\2;I|\377;J|\377\202;I|\377\12;H|\377;I|\377:I{\3779Iz\377" \
+  ":I{\3779Hz\377:I{\3779H{\377%6n\377\30)d\377\216\31*e\377\3\30)d\377" \
+  "\33,f\3774Bw\377\2028Fy\377\3""7Fy\3776Fy\3777Fy\377\2027Ey\377\15""6" \
+  "Ey\3777Ey\3776Ey\3776Ex\3776Ey\3776Ex\3776Ew\3776Dx\3775Dx\3776Cw\377" \
+  "5Dx\377(8o\377\30)d\377\220\31*e\377\14\30)d\377$5m\3774Cv\3771Bu\377" \
+  "2Av\3772@v\3772Av\3772Au\3772Av\3772At\3771@u\3770\77u\377\2031@u\377" \
+  "\2""0\77t\377-=s\377\224\31*e\377\11\30)d\377!1j\377.>s\377,=r\377-<" \
+  "r\377-;r\377-<r\377,<r\377+<r\377\203,<r\377\1)9p\377\202\30)d\377\223" \
+  "\31*e\377\13\30)d\377\34-g\377)8o\377'7n\377'7o\377(8o\377&6o\377'7o" \
+  "\377&6o\377!2j\377\30)d\377\241\31*e\377\202\30)d\377\6\32+e\377!1j\377" \
+  "8Gy\377@M~\377\77M}\377>L~\377\202\77M~\377\2\77M\177\377\77M~\377\202" \
+  "\77M\177\377\1>L\177\377\203\77M\177\377\203@N\177\377\1\77M\177\377" \
+  "\215@N\177\377\205@M\177\377\211@N\177\377\205\77N~\377\211@N\177\377" \
+  "\206@M\177\377\215@N\177\377\1\77M\177\377\202@N\177\377\203\77M\177" \
+  "\377\202>L\177\377\2\77M\177\377\77M~\377\202\77M\177\377\2\77M~\377" \
+  ">L~\377\202\77M~\377\4.=s\377\34,g\377\31*e\377\30)d\377\220\31*e\377" \
+  "\6\27(d\377%4m\377:Hz\377=K}\377=J|\377=K}\377\202<K}\377\5;K}\377<J" \
+  "|\377<K}\377<J|\377<I{\377\204<J|\377\202;J|\377\3:J|\377;J|\377;I|\377" \
+  "\202;H|\377\202:I{\377\1""9Iz\377\203:I{\377\2""9Hz\377\37""0i\377\202" \
+  "\30)d\377\216\31*e\377\6\32+e\3772Au\3778Fy\3778Ex\3777Fy\3776Fy\377" \
+  "\2037Fy\377\16""6Ey\3777Dy\3776Ey\3775Ey\3776Ey\3776Ex\3776Ew\3776Dx" \
+  "\3776Ex\3776Dw\3775Dx\3771@u\377\30*e\377\30)d\377\220\31*e\377\13\35" \
+  ".h\3771@u\3772Bv\3771Av\3772@v\3772Av\3772Au\3772Av\3772Au\3771@t\377" \
+  "0\77u\377\2031@u\377\4""0\77t\3771@u\377!2j\377\30)d\377\222\31*e\377" \
+  "\6\30)d\377\32+f\377,<r\377-=r\377-=q\377-;r\377\202-<r\377\203,<r\377" \
+  "\4,;r\377,<r\377\35-g\377\30)d\377\223\31*e\377\202\30)d\377\1%5n\377" \
+  "\203(8o\377\6'7o\377&6o\377'7n\377'7o\377\31*d\377\30)d\377\244\31*e" \
+  "\377\5\30)d\377\27(c\377%5m\3777Ey\377=K|\377\202\77M~\377\1>L}\377\202" \
+  "\77M~\377\202\77M\177\377\2\77M~\377\77M\177\377\203>L\177\377\203\77" \
+  "M\177\377\271@N\177\377\203\77M\177\377\203>L\177\377\204\77M\177\377" \
+  "\3\77M~\377>L~\377\77M}\377\202\77M~\377\4;I{\3771@u\377\34-g\377\27" \
+  "(c\377\220\31*e\377\202\30)d\377\5\35.h\3770\77t\377>L}\377<J}\377=J" \
+  "|\377\202<K}\377\3;K}\377<J|\377<K}\377\204<J|\377\1;J|\377\202<J|\377" \
+  "\6;J|\377:J|\377;I|\377;J|\377;I|\377;H|\377\202;I|\377\10:I{\3779Iz" \
+  "\377:I{\3779Hz\377:I{\3777Fy\377!1j\377\30)d\377\216\31*e\377\3\30)d" \
+  "\377\31*e\377-=r\377\2028Fy\377\2057Fy\377\7""6Ey\3776Dy\3776Ey\3776" \
+  "Ex\3776Ey\3776Ex\3776Ew\377\2026Dx\377\5""5Dx\3776Dx\3773Bv\377\31*e" \
+  "\377\30)d\377\217\31*e\377\4\30)d\377\31*e\377,;q\3772Bv\377\2052Av\377" \
+  "\4""1@u\3772At\3771@u\3770\77u\377\2021@u\377\5""0\77t\3771@u\377*:p" \
+  "\377\27(d\377\31*d\377\222\31*e\377\5\30*d\377%4l\377-=r\377-=q\377-" \
+  ";r\377\202-<r\377\6,<r\377+<r\377,<r\377,;r\377+<r\377'7n\377\225\31" \
+  "*e\377\5\30)d\377\35-g\377'7n\377'7o\377(8o\377\202'7o\377\4'7n\377'" \
+  "7o\377&6m\377\30)d\377\246\31*e\377\202\30)d\377\7\31*e\377\36/h\377" \
+  ")9o\377:I{\377AN\177\377\77M~\377\77M}\377\202\77M~\377\202\77M\177\377" \
+  "\1\77M~\377\202\77M\177\377\202>L\177\377\204\77M\177\377\263@N\177\377" \
+  "\204\77M\177\377\202>L\177\377\205\77M\177\377\202\77M~\377\6\77M}\377" \
+  "@N~\377@N\177\3773Bv\377#3l\377\34-g\377\202\30)d\377\220\31*e\377\4" \
+  "\30)d\377\27(d\377,<r\377:H{\377\203=K}\377\1<K}\377\202;K}\377\3<J|" \
+  "\377<K}\377<J|\377\202<I{\377\203<J|\377\202;J|\377\11:J|\377;I|\377" \
+  ";J|\377;I|\377;H|\377:I{\377;I|\377:I{\3779Iz\377\203:I{\377\4""5Dx\377" \
+  "\35.g\377\30)d\377\30)e\377\215\31*e\377\7\30)d\377\30*d\377/\77t\377" \
+  "8Fz\3778Ey\3777Fy\3776Fy\377\2027Fy\377\2027Ey\377\6""7Dy\3776Ey\377" \
+  "5Ey\3776Ey\3776Ex\3776Ew\377\2026Ex\377\5""5Dx\3776Cw\3774Cw\377\37""0" \
+  "i\377\30)d\377\220\31*e\377\14\27(c\377(7n\3773Bv\3772Bu\3772Av\3772" \
+  "@v\3772Av\3772Au\3772Av\3772Au\3771@t\3770\77u\377\2041@u\377\3/>s\377" \
+  "\32+e\377\30)d\377\222\31*e\377\4\30)d\377\32+f\377,<r\377,<q\377\202" \
+  "-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\4+<q\377,;r\377\37/i\377\30" \
+  ")d\377\225\31*e\377\1\"2k\377\203(8o\377\1'7o\377\202&6o\377\3'7o\377" \
+  "\33+f\377\30)d\377\252\31*e\377\11\30)d\377\26'c\377!1j\3774Bw\377<J" \
+  "|\377>L}\377\77M~\377\77M}\377>L}\377\202\77M~\377\206\77M\177\377\203" \
+  ">L\177\377\204\77M\177\377\204@N\177\377\1\77M\177\377\235@N\177\377" \
+  "\1\77M\177\377\204@N\177\377\204\77M\177\377\203>L\177\377\206\77M\177" \
+  "\377\203\77M~\377\10\77M}\377\77M~\377=K}\377;I{\377,<r\377\32+e\377" \
+  "\27(d\377\30)d\377\221\31*e\377\10\30)d\377\31*e\377\40""1i\377:Hz\377" \
+  "=K}\377<J}\377=K}\377<K}\377\202;K}\377\202<K}\377\1<J|\377\202<I{\377" \
+  "\204<J|\377\2;J|\377:J|\377\202;J|\377\1;I|\377\202;H|\377\202;I|\377" \
+  "\2029Iz\377\5:I{\3779Hz\377:I{\3775Ex\377\34,g\377\217\31*e\377\5\30" \
+  ")d\377\31*e\377,;q\3778Fy\3778Ex\377\2037Fy\377\20""7Ey\3777Fy\3777E" \
+  "y\3777Dy\3776Ey\3775Ey\3776Ex\3776Ey\3776Ex\3776Dx\3776Ex\3775Dx\377" \
+  "6Cx\3775Dx\377'7n\377\27)d\377\220\31*e\377\4\30)d\377\40""0i\3773Bv" \
+  "\3771Bu\377\2032Av\377\4""2Au\3772Av\3772At\3772Au\377\2041@u\377\202" \
+  "0\77t\377\1\"3k\377\223\31*e\377\202\30)d\377\4'7o\377-=r\377-<r\377" \
+  "-;r\377\202-<r\377\203,<r\377\3+<q\377,<r\377)9p\377\202\30)d\377\223" \
+  "\31*e\377\2\30)d\377\31*e\377\204(8o\377\4'7o\377&6o\377'7o\377&6n\377" \
+  "\256\31*e\377\11\30)d\377\27(c\377\35-g\377%5m\3771Au\377>L~\377@N\177" \
+  "\377\77M~\377>L}\377\202\77M~\377\203\77M\177\377\1\77M~\377\203\77M" \
+  "\177\377\203>L\177\377\205\77M\177\377\206@N\177\377\1\77M\177\377\221" \
+  "@N\177\377\1\77M\177\377\206@N\177\377\205\77M\177\377\203>L\177\377" \
+  "\203\77M\177\377\1\77M~\377\202\77M\177\377\202\77M~\377\12>L~\377>L" \
+  "}\377\77M~\377@N\177\377:Hz\377,;r\377!1j\377\31*e\377\27(d\377\30)d" \
+  "\377\222\31*e\377\3\27(d\377\36.h\3771Au\377\202=K}\377\2<J|\377=K}\377" \
+  "\203<K}\377\4<J|\377<K}\377<J|\377<I{\377\203<J|\377\203;J|\377\2:J|" \
+  "\377;J|\377\204;I|\377\12:I{\377;I|\377:I{\3779Iz\377:I{\3779Hz\377:" \
+  "I{\3771@u\377\33,f\377\30)d\377\216\31*e\377\202\30)d\377\5+;q\3778F" \
+  "z\3778Fx\3777Fy\3776Fy\377\2037Fy\377\16""7Ey\3776Dy\3776Ey\3775Ey\377" \
+  "6Ex\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\3776Cx\3776Dx\377)9p\377\27)d" \
+  "\377\222\31*e\377\2/>t\3771Bv\377\2052Av\377\4""2Au\3771@t\3771@u\377" \
+  "0\77u\377\2021@u\377\5""0\77t\3771@u\377,<q\377\30*e\377\30)d\377\222" \
+  "\31*e\377\7\30)d\377\37/i\377.=s\377,=r\377-<r\377-;r\377-<r\377\206" \
+  ",<r\377\2\35-g\377\30)d\377\224\31*e\377\13\30)d\377\"3k\377(8o\377'" \
+  "7n\377'7o\377(8o\377&6o\377'7n\377'7o\377\37/i\377\30)d\377\234\31*e" \
+  "\377\202\30)d\377\222\31*e\377\202\30)d\377\3\31*e\377)9p\377:I{\377" \
+  "\202>L}\377\1>L~\377\203\77M}\377\1\77M\177\377\202\77M~\377\210\77M" \
+  "\177\377\207>L\177\377\1@N\177\377\222\77M\177\377\206>L\177\377\211" \
+  "\77M\177\377\202\77M~\377\1>M\177\377\203\77M}\377\202>L}\377\3>L~\377" \
+  "4Cw\377!1j\377\202\30)d\377\223\31*e\377\7\30)d\377\31*e\377\30)d\377" \
+  "'7o\377<J|\377=J}\377<J|\377\202=K}\377\202<K}\377\202<J|\377\2<K}\377" \
+  "<I{\377\203<J|\377\1;J|\377\202<J|\377\1:J|\377\202;J|\377\4;I|\377;" \
+  "J|\377;H|\377:I{\377\202;I|\377\1""9Iz\377\204:I{\377\2""2Au\377\32*" \
+  "e\377\217\31*e\377\5\30)d\377\31*e\377+:q\3778Fz\3778Ex\377\2037Fy\377" \
+  "\20""7Ey\3777Fy\3776Ey\3777Dy\3776Ey\3775Ey\3776Ex\3776Ey\3776Ex\377" \
+  "6Dx\3776Ex\3775Dx\3776Cw\3776Dx\377/>s\377\32*e\377\220\31*e\377\6\30" \
+  ")d\377\27(d\377*:q\3773Bv\3771Bu\3772@v\377\2022Av\377\5""2Au\3771@u" \
+  "\3772At\3771@u\3770\77u\377\2051@u\377\2\32+f\377\30)d\377\223\31*e\377" \
+  "\5\32*e\377)9p\377,<r\377-=q\377-;r\377\202-<r\377\3,<r\377+<r\377,<" \
+  "r\377\202,;r\377\1%5m\377\225\31*e\377\4\30)d\377\33,f\377(8o\377'7n" \
+  "\377\202(8o\377\5'7o\377'7n\377&6o\377&6m\377\30)d\377\234\31*e\377\3" \
+  "0\77t\377!2j\377\27(d\377\202\30)d\377\222\31*e\377\14\30)d\377\27(d" \
+  "\377\27(c\377\35-g\377%5m\377.=r\3775Dw\377<K|\377@N\177\377@M~\377\77" \
+  "M~\377>L}\377\203\77M~\377\214\77M\177\377\223>L\177\377\206\77M\177" \
+  "\377\1\77M~\377\204\77M\177\377\204\77M~\377\14>L}\377\77M~\377@N~\377" \
+  "\77N~\3779Hz\3772Au\377*:p\377\"2k\377\31*e\377\27(c\377\30)d\377\30" \
+  "*d\377\222\31*e\377\6\30)d\377\27(d\377\32+f\377'7n\3776Ex\377\77L~\377" \
+  "\202=K}\377\202<K}\377\202;K}\377\202<K}\377\2<J|\377<I{\377\203<J|\377" \
+  "\2;J|\377<J|\377\202;J|\377\1;I|\377\202;J|\377\4;I|\377;H|\377:I{\377" \
+  ";I|\377\204:I{\377\3""9Hz\377:I{\377-<r\377\202\30)d\377\216\31*e\377" \
+  "\5\30)d\377\27)d\377(8o\3778Fz\3777Ex\377\2057Fy\377\17""7Ey\3777Dy\377" \
+  "6Ey\3775Ey\3776Ex\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\3776Cw\3776Dx\377" \
+  "1@u\377\33+f\377\30)d\377\220\31*e\377\14\30)d\377#3l\3774Bv\3771Bu\377" \
+  "2Av\3772@v\3772Av\3772Au\3772Av\3772Au\3771@t\3770\77u\377\2031@u\377" \
+  "\4""0\77u\3771@t\377#3k\377\30)d\377\223\31*e\377\4\30)d\377\40""0i\377" \
+  "-=r\377-=q\377\202-<r\377\3,<r\377-<r\377+<r\377\202,<r\377\4+<q\377" \
+  "+;q\377\34-g\377\30)d\377\225\31*e\377\1\"3k\377\203(8o\377\204'7o\377" \
+  "\2\37""0i\377\30)d\377\234\31*e\377\6=K}\377<J|\3775Ex\377\37/i\377\30" \
+  ")d\377\30)e\377\223\31*e\377\203\30)d\377\7\31*d\377\31*e\377\32+e\377" \
+  "!1j\377.=s\377;J|\377@N~\377\202\77M~\377\1>L}\377\205\77M~\377\205\77" \
+  "M\177\377\1\77M~\377\233\77M\177\377\204\77M~\377\2>M~\377\77L}\377\202" \
+  "\77M~\377\6@N~\3776Ex\377(8o\377\34-g\377\32+e\377\31*e\377\204\30)d" \
+  "\377\223\31*e\377\202\30)d\377\6)8p\377;I{\377<J|\377=K}\377<J|\377=" \
+  "K}\377\202<K}\377\3;K}\377<J|\377<K}\377\202<J|\377\1<I{\377\203<J|\377" \
+  "\3;J|\377<J|\377;J|\377\202:J|\377\1;J|\377\202;I|\377\1;H|\377\202;" \
+  "I|\377\1:I{\377\2029Iz\377\6""9Hz\3779Iz\377;J{\377%5l\377\31*e\377\30" \
+  ")d\377\217\31*e\377\5\30)e\377,<r\3778Fy\3778Fx\3778Fy\377\2026Fy\377" \
+  "\2037Fy\377\2026Ey\377\2025Ey\377\12""6Ey\3776Ex\3776Ew\3776Ex\3776D" \
+  "x\3775Cx\3776Dx\3773Bv\377\33+f\377\30)d\377\221\31*e\377\5\33,f\377" \
+  "1@t\3772Bv\3771Av\3772@v\377\2032Av\377\2""2Au\3772At\377\2051@u\377" \
+  "\2""1@t\377-<s\377\224\31*e\377\16\30)d\377\31*d\377-<r\377-=r\377-<" \
+  "r\377-;r\377,<r\377-<r\377,<r\377+<r\377,<r\377+;q\377,<r\377$5l\377" \
+  "\202\30)d\377\224\31*e\377\1\32+e\377\202'7n\377\1(8o\377\202'7o\377" \
+  "\202&6o\377\2(8o\377\30)d\377\235\31*e\377\7<K}\377=J|\377=K}\377>L~" \
+  "\3772@u\377!2j\377\31*e\377\202\30)d\377\226\31*e\377\14\30)d\377\27" \
+  "(c\377\26'c\377\35.h\377(8o\3771@u\3775Dw\3778Fy\377;I{\377>L}\377@N" \
+  "~\377@M~\377\202\77M~\377\3\77M}\377>L}\377\77M}\377\227\77M~\377\2>" \
+  "L~\377\77M}\377\203\77M~\377\12@N~\377\77M~\377=J|\3779Hz\3776Ex\377" \
+  "3Cw\377.=s\377#3l\377\31*e\377\26'c\377\202\30)d\377\226\31*e\377\6\30" \
+  ")d\377\27(d\377\34-g\377'7o\377:H{\377>L~\377\203=K}\377\203<K}\377\3" \
+  "<J|\377<K}\377<J|\377\202<I{\377\205<J|\377\1;J|\377\202:J|\377\202;" \
+  "J|\377\4;I|\377;H|\377:I{\377;I|\377\202:I{\377\7""9Iz\377:H{\3779Hz" \
+  "\377:I{\3774Cw\377\36.h\377\27(d\377\217\31*e\377\7\30)d\377\31*e\377" \
+  "*9p\3778Fz\3777Ex\3777Fy\3776Fy\377\2027Fy\377\6""7Ey\3777Fy\3777Ey\377" \
+  "6Dy\3775Ey\3776Ey\377\2026Ex\377\10""6Ew\3776Dx\3776Ex\3776Dw\3775Dx" \
+  "\3774Cw\377\40""0j\377\30)d\377\220\31*e\377\3\30)d\377\31*e\377.=r\377" \
+  "\2022Bv\377\3""2Av\3772@v\3772Av\377\2032Au\377\2""1@u\3770\77u\377\204" \
+  "1@u\377\3""0\77u\377\34.g\377\30)d\377\223\31*e\377\5\30)d\377&6m\377" \
+  "-=s\377,=q\377-;r\377\202-<r\377\2,<r\377+<r\377\203,<r\377\3*:p\377" \
+  "\31*d\377\30)d\377\224\31*e\377\2\30)d\377\"3k\377\202(8o\377\6'7o\377" \
+  "(8o\377&6o\377'7n\377'7o\377\34-g\377\236\31*e\377\202<K}\377\1=J|\377" \
+  "\202=K}\377\5<J|\3777Fy\377$4m\377\27(d\377\30)d\377\227\31*e\377\204" \
+  "\30)d\377\13\31*e\377\33+f\377\34-g\377\36.h\377\40""1j\377(8n\377/\77" \
+  "t\3777Ey\377>M~\377AO\177\377@N\177\377\202@N~\377\1@M~\377\205\77M~" \
+  "\377\205\77M}\377\2>M}\377\77M}\377\205\77M~\377\203@N~\377\12@N\177" \
+  "\377AN\177\377;J{\3774Cw\377,<r\377$4l\377\37/i\377\35.h\377\33,f\377" \
+  "\32+e\377\204\30)d\377\230\31*e\377\4\30)d\377\31*e\377.>s\377:H{\377" \
+  "\202=K}\377\2<J|\377=K}\377\202<K}\377\202;K}\377\202<K}\377\202<J|\377" \
+  "\1<I{\377\202<J|\377\1;J|\377\202<J|\377\3;J|\377:J|\377;J|\377\203;" \
+  "I|\377\4;H|\377:I{\377;I|\377:I{\377\2029Iz\377\6:I{\3779I{\377<J|\377" \
+  "-=r\377\32+e\377\30)d\377\220\31*e\377\4\30*d\377/>s\3778Fz\3778Fy\377" \
+  "\2067Fy\377\2""6Ey\3776Dy\377\2026Ey\377\11""6Ex\3776Ey\3776Ex\3776E" \
+  "w\3776Ex\3775Dx\3775Cw\3776Ex\377\40""1j\377\202\30)d\377\220\31*e\377" \
+  "\14\30)e\377+;q\3773Bv\3771Bu\3772Av\3772@v\3772Av\3772Au\3772Av\377" \
+  "1@u\3772At\3770\77u\377\2051@u\377\2!1k\377\30)d\377\224\31*e\377\6\35" \
+  ".h\377,<r\377,=r\377-<q\377-;r\377-<r\377\202,<r\377\6+<r\377,<r\377" \
+  ",;r\377,;q\377\40""0i\377\30)d\377\224\31*e\377\2\30)d\377\33,f\377\204" \
+  "(8o\377\4'7o\377&6o\377'7o\377%5l\377\237\31*e\377\202<K}\377\1;K}\377" \
+  "\202<K}\377\6=J|\377=K}\377>L}\3776Ex\377!1j\377\32+f\377\203\30)d\377" \
+  "\233\31*e\377\202\30)d\377\40\27(d\377\27(c\377\26'c\377\32,f\377\"2" \
+  "k\377%5m\377'8n\377*9p\377,<r\377/>t\3771@u\3773Cv\3776Ey\3778Fy\377" \
+  "9Gz\3779Hz\377:Hz\3779Gz\3778Gy\3777Fy\3775Dx\3772Bu\3771\77t\377.=s" \
+  "\377+;q\377)8o\377&7n\377$4l\377\37""0i\377\30)d\377\26'c\377\27(c\377" \
+  "\203\30)d\377\233\31*e\377\203\30)d\377\2\34-g\377*:q\377\202=K}\377" \
+  "\1<J|\377\202=K}\377\1<K}\377\202;K}\377\2<J|\377<K}\377\202<J|\377\1" \
+  "<I{\377\203<J|\377\1;J|\377\202<J|\377\4;J|\377:J|\377;I|\377;J|\377" \
+  "\202;I|\377\4;H|\377:I{\377;I|\377:I{\377\2029Iz\377\6:I{\3779Hz\377" \
+  ":I{\3778Gy\377&5m\377\27(d\377\220\31*e\377\7\30)d\377\31*e\377-<r\377" \
+  "8Fz\3777Ex\3777Fy\3776Fy\377\2027Fy\377\5""7Ey\3777Fy\3777Ey\3776Dy\377" \
+  "5Ey\377\2026Ey\377\11""6Ex\3776Ew\3776Dx\3776Ex\3775Dx\3776Cw\3775Dx" \
+  "\377%5m\377\30)d\377\221\31*e\377\4\30)d\377#3k\3772Bu\3771Au\377\205" \
+  "2Av\377\2""1@u\3772Au\377\2041@u\377\3""0\77t\3771@u\377*9p\377\224\31" \
+  "*e\377\4\30)d\377\30)e\377(8o\377-=r\377\202-<r\377\11,<r\377-<r\377" \
+  ",<r\377+<r\377,<r\377,;r\377,<r\377)8p\377\32*e\377\225\31*e\377\2\30" \
+  ")d\377$4l\377\203(8o\377\204'7o\377\2\"2k\377\30)d\377\236\31*e\377\203" \
+  "<K}\377\202;K}\377\202<K}\377\1=J|\377\202=K}\377\6""6Ex\377,;r\377\35" \
+  ".h\377\27(c\377\30)d\377\31*d\377\236\31*e\377\206\30)d\377\205\27(d" \
+  "\377\5\30)d\377\31*e\377\32+e\377\31*e\377\30)d\377\204\27(d\377\1\27" \
+  ")d\377\206\30)d\377\236\31*e\377\6\30)d\377\27(d\377\27)c\377#4l\377" \
+  "2@u\377:H{\377\202=K}\377\2=J|\377=K}\377\202<K}\377\202;K}\377\202<" \
+  "K}\377\202<J|\377\1<I{\377\203<J|\377\2;J|\377<J|\377\202;J|\377\3:J" \
+  "|\377;I|\377;J|\377\202;I|\377\3;H|\377:I{\377;I|\377\204:I{\377\5""9" \
+  "Hz\377;I{\3773Cv\377\36.h\377\30)d\377\220\31*e\377\7\30)d\377\32+e\377" \
+  "0\77t\3778Fz\3778Ex\3777Fy\3776Fy\377\2027Fy\377\4""7Ey\3777Fy\3776E" \
+  "y\3776Dy\377\2026Ey\377\12""6Ex\3776Ey\3776Ex\3776Ew\3776Ex\3776Dx\377" \
+  "6Cw\3777Ey\377(8o\377\30)e\377\221\31*e\377\6\30)d\377\37/i\3772Av\377" \
+  "2Bv\3772Av\3772@v\377\2022Av\377\2032Au\377\2""1@u\3770\77u\377\2021" \
+  "@u\377\5""0\77u\3771@u\3770\77t\377\32+f\377\30)d\377\223\31*e\377\11" \
+  "\30)d\377\"2l\377-=s\377,=r\377-<r\377-;r\377-<r\377,<r\377+<r\377\202" \
+  ",<r\377\4+<q\377-<r\377\36/h\377\30)d\377\224\31*e\377\2\30)e\377\33" \
+  ",f\377\202'7n\377\202(8o\377\1'7o\377\202&6o\377\2(8o\377\27(d\377\237" \
+  "\31*e\377\1<I{\377\202<J|\377\203<K}\377\1;K}\377\202<K}\377\10=K}\377" \
+  "<J|\377=K}\377>L~\3775Dw\377#3l\377\32+e\377\31*e\377\202\30)d\377\320" \
+  "\31*e\377\1\30*d\377\202\30)d\377\4\31*e\377\34,g\377*:p\377<J|\377\202" \
+  "=K}\377\2<J|\377=K}\377\202<K}\377\202;K}\377\202<K}\377\202<J|\377\1" \
+  "<I{\377\206<J|\377\1;J|\377\202:J|\377\2;I|\377;J|\377\202;I|\377\3;" \
+  "H|\377:I{\377;I|\377\204:I{\377\4""9Iz\377:I{\3779Hz\377.>s\377\222\31" \
+  "*e\377\5\30)d\377\32+f\3772Au\3778Fy\3778Fx\377\2047Fy\377\5""7Ey\377" \
+  "6Fy\3777Ey\3776Dy\3775Ey\377\2036Ey\377\10""6Ew\3776Dx\3776Ex\3775Dx" \
+  "\3776Cw\3776Dx\377)8p\377\27)d\377\221\31*e\377\6\30)d\377\33,g\3771" \
+  "Au\3772Au\3771Bv\3772@v\377\2032Av\377\4""2Au\3772At\3772Au\3770\77u" \
+  "\377\2051@u\377\2\36.h\377\30)d\377\223\31*e\377\6\30)d\377\34-g\377" \
+  "-=s\377,<r\377-<q\377-;r\377\202-<r\377\203,<r\377\4,;r\377,<r\377&6" \
+  "m\377\30)d\377\224\31*e\377\202\30)d\377\1\"3k\377\202(8o\377\202'7o" \
+  "\377\4&6o\377'7n\377'7o\377\32+f\377\240\31*e\377\1<J|\377\202<I{\377" \
+  "\1<J|\377\202<K}\377\1<J|\377\202;K}\377\202<K}\377\12=K}\377=J|\377" \
+  "=K}\377>L~\3779Hz\377/>s\377$5l\377\31*e\377\27(c\377\30)d\377\315\31" \
+  "*e\377\12\30)d\377\27(c\377\36.h\377)9p\3774Bv\377=K}\377>L}\377=K}\377" \
+  "=J|\377=K}\377\202<K}\377\202;K}\377\1<J|\377\202<K}\377\1<J|\377\202" \
+  "<I{\377\203<J|\377\1;J|\377\202<J|\377\6;J|\377:J|\377;J|\377;I|\377" \
+  ";J|\377;I|\377\202;H|\377\3:I{\377;I|\377:I{\377\2029Iz\377\5:I{\377" \
+  "9Hz\377:I{\3778Gz\377%5m\377\202\30)d\377\220\31*e\377\7\30)d\377\37" \
+  "0i\3774Bw\3778Fy\3778Ex\3777Fy\3776Fy\377\2047Fy\377\4""7Ey\3776Dy\377" \
+  "5Ey\3776Ey\377\2036Ex\377\6""6Dx\3776Ex\3776Dx\3776Cw\3776Dx\377+;q\377" \
+  "\223\31*e\377\4\30)e\377,<r\3772Bv\3771Av\377\2032Av\377\5""2Au\3772" \
+  "Av\3771@t\3771@u\3770\77u\377\2031@u\377\4""0\77t\3771@u\377&6n\377\30" \
+  ")d\377\225\31*e\377\3'7o\377-<r\377-=q\377\202-<r\377\202,<r\377\1+<" \
+  "r\377\202,<r\377\4+<q\377+:q\377\33,f\377\30)d\377\224\31*e\377\2\30" \
+  ")d\377\34,g\377\204(8o\377\4'7o\377&6o\377'7o\377$5l\377\241\31*e\377" \
+  "\202<J|\377\202<I{\377\202<J|\377\202<K}\377\1<J|\377\202;K}\377\202" \
+  "<K}\377\2=K}\377=J|\377\202=K}\377\202<J|\377\2.=r\377\33,f\377\202\30" \
+  ")d\377\311\31*e\377\4\30)d\377\27(d\377#3l\3775Ex\377\202<J|\377\202" \
+  "=K}\377\2<J|\377=K}\377\203<K}\377\4;K}\377<K}\377<J|\377<K}\377\202" \
+  "<J|\377\202<I{\377\203<J|\377\2;J|\377<J|\377\202;J|\377\202:J|\377\202" \
+  ";J|\377\1;H|\377\202;I|\377\3:I{\377;I|\3779Iz\377\203:I{\377\4""9Hz" \
+  "\377:I{\3777Fy\377\34.g\377\202\30)d\377\220\31*e\377\7\30)d\377\37""0" \
+  "i\3776Ey\3778Fx\3778Ex\3777Fy\3776Fy\377\2027Fy\377\2027Ey\377\2026D" \
+  "y\377\2025Ey\377\2""6Ex\3776Ey\377\2026Ew\377\7""6Ex\3776Dx\3775Cx\377" \
+  "6Dx\377,<q\377\27)d\377\30)d\377\221\31*e\377\6\27(d\377)9p\3773Bv\377" \
+  "1Av\3772Av\3772@v\377\2032Av\377\2""2Au\3772At\377\2020\77u\377\2041" \
+  "@u\377\3.=s\377\31*e\377\30)d\377\223\31*e\377\3\30)d\377\37/i\377-=" \
+  "s\377\202-<r\377\3-;r\377,<r\377-<r\377\202+<r\377\5,<r\377,;r\377,<" \
+  "r\377$4l\377\30)d\377\225\31*e\377\13\30)d\377%5m\377(8o\377'7n\377'" \
+  "7o\377(8o\377&6o\377'7n\377&6o\377\"3k\377\30)d\377\240\31*e\377\2<J" \
+  "|\377;J|\377\203<J|\377\202<I{\377\202<J|\377\203<K}\377\202;K}\377\202" \
+  "<K}\377\203=K}\377\6>K}\377>M~\3774Cw\377(8o\377\"2k\377\34-g\377\202" \
+  "\27(d\377\2\30)d\377\30)e\377\275\31*e\377\202\30)d\377\7\27(c\377\31" \
+  "*e\377\37/i\377$4l\377-<r\377:H{\377>L~\377\204=K}\377\202<K}\377\202" \
+  ";K}\377\1<J|\377\202<K}\377\202<J|\377\202<I{\377\203<J|\377\2;J|\377" \
+  "<J|\377\202;J|\377\202:J|\377\202;J|\377\202;I|\377\2;H|\377:I{\377\202" \
+  ";I|\377\2:I{\3779Iz\377\202:I{\377\4""9Iz\377:I{\3778Gz\377*:p\377\202" \
+  "\30)d\377\221\31*e\377\3\30)d\377$4m\3778Fz\377\2028Fy\377\2""7Fy\377" \
+  "6Fy\377\2037Fy\377\5""7Ey\3777Dy\3776Ey\3775Ey\3776Ey\377\2036Ex\377" \
+  "\7""6Dx\3776Ex\3775Dx\3776Cw\3776Dx\377,<r\377\30)d\377\222\31*e\377" \
+  "\6\30)d\377$4l\3773Bv\3771Bu\3772Av\3772@v\377\2032Av\377\4""1@u\377" \
+  "2At\3771@u\3770\77u\377\2041@u\377\3""0\77t\377\34-g\377\30)d\377\223" \
+  "\31*e\377\2\30)d\377\33,f\377\202-=r\377\2-=q\377-;r\377\202-<r\377\203" \
+  ",<r\377\5+;q\377,<r\377*9p\377\31*e\377\30)d\377\224\31*e\377\4\30)d" \
+  "\377\35.h\377'7n\377'7o\377\202(8o\377\5'7o\377'7n\377&6o\377'7n\377" \
+  "\27(c\377\241\31*e\377\3;J|\377<J|\377;J|\377\204<J|\377\202<I{\377\202" \
+  "<J|\377\202<K}\377\1<J|\377\202;K}\377\202<K}\377\202=K}\377\1=J|\377" \
+  "\202=K}\377\6<J|\377:H{\3777Ex\377+;q\377\36/i\377\27(c\377\202\30)d" \
+  "\377\270\31*e\377\202\30)d\377\7\27(d\377\30)e\377$4l\3770@u\3779Gz\377" \
+  ";I{\377<J|\377\202=K}\377\1=J|\377\202=K}\377\202<K}\377\202;K}\377\3" \
+  "<K}\377<J|\377<K}\377\202<J|\377\202<I{\377\204<J|\377\2;J|\377<J|\377" \
+  "\202;J|\377\5:J|\377;J|\377;I|\377;J|\377;I|\377\202;H|\377\202;I|\377" \
+  "\202:I{\377\2029Iz\377\7:I{\3779Hz\377;I{\377/>t\377\33,f\377\30)e\377" \
+  "\30)d\377\221\31*e\377\7\27(d\377)9p\3777Fy\3778Fy\3777Ex\3777Fy\377" \
+  "6Fy\377\2027Fy\377\2027Ey\377\17""6Dy\3776Ey\3775Ey\3776Ey\3776Ex\377" \
+  "6Ey\3776Ex\3776Ew\3776Ex\3776Dx\3776Cw\3776Dx\3770\77t\377\31*d\377\30" \
+  ")d\377\221\31*e\377\6\30)d\377\37/i\3773Av\3771Au\3772Av\3772@v\377\202" \
+  "2Av\377\5""2Au\3772Av\3772At\3771@u\3770\77u\377\2031@u\377\2020\77t" \
+  "\377\2!1j\377\30)d\377\225\31*e\377\6'7n\377-=s\377,=q\377-<r\377-;r" \
+  "\377-<r\377\205,<r\377\3,<q\377\34-g\377\30)d\377\225\31*e\377\2\30)" \
+  "d\377%5m\377\202(8o\377\202'7o\377\202&6o\377\3'7o\377\33,f\377\30)d" \
+  "\377\241\31*e\377\202:J|\377\202;J|\377\202<J|\377\1;J|\377\203<J|\377" \
+  "\202<I{\377\203<J|\377\3<K}\377<J|\377<K}\377\202;K}\377\203<K}\377\12" \
+  "=K}\377=J|\377=K}\377>K}\377\77L~\377;I{\3770\77t\377$5m\377\37/i\377" \
+  "\33,f\377\205\30)d\377\252\31*e\377\205\30)d\377\7\31*e\377\35-g\377" \
+  "\40""1j\377)9p\3775Cx\377>L}\377>L~\377\204=K}\377\203<K}\377\202;K}" \
+  "\377\2<K}\377<J|\377\202<K}\377\202<J|\377\202<I{\377\204<J|\377\2;J" \
+  "|\377<J|\377\202;J|\377\202:J|\377\2;I|\377;J|\377\202;I|\377\4;H|\377" \
+  ";I|\377:I{\377;I|\377\202:I{\377\3""9Iz\377:I{\3779Hz\377\202:I{\377" \
+  "\4""5Ex\377%5m\377\27)d\377\30)e\377\221\31*e\377\7\30)d\377\33,f\377" \
+  "/>t\3779Gz\3778Ex\3777Fy\3776Fy\377\2047Fy\377\20""7Ey\3777Dy\3776Ey" \
+  "\3775Ey\3776Ex\3776Ey\3776Ex\3776Ew\3776Dx\3776Ex\3775Dx\3776Cw\3775" \
+  "Dx\377.=s\377\30)d\377\30)e\377\221\31*e\377\6\30)d\377\35.g\3773Bv\377" \
+  "2Bu\3772Av\3772@v\377\2022Av\377\5""2Au\3772Av\3772Au\3771@u\3770\77" \
+  "u\377\2031@u\377\4""0\77t\3771@u\377(8o\377\30)d\377\224\31*e\377\16" \
+  "\30)d\377\36.h\377-=r\377-=q\377-<r\377-;r\377,<r\377-<r\377,<r\377+" \
+  "<r\377,<r\377+;q\377,<r\377$4l\377\226\31*e\377\12\30)d\377\37/i\377" \
+  "(8o\377'7n\377'7o\377(8o\377&6o\377'7o\377'7n\377%5m\377\243\31*e\377" \
+  "\2;J|\377;I|\377\202:J|\377\202;J|\377\2<J|\377;J|\377\204<J|\377\202" \
+  "<I{\377\202<J|\377\202<K}\377\2<J|\377<K}\377\202;K}\377\203<K}\377\206" \
+  "=K}\377\11;I|\3777Fy\3773Bv\377*;q\377$4l\377\36.h\377\30(d\377\26(c" \
+  "\377\27(c\377\203\30)d\377\241\31*e\377\202\30)d\377\12\27(d\377\27(" \
+  "c\377\26'c\377\32+e\377\40""1j\377'7o\377.=s\3776Dx\3779Gz\377<K|\377" \
+  "\206=K}\377\203<K}\377\202;K}\377\2<K}\377<J|\377\202<K}\377\202<J|\377" \
+  "\202<I{\377\204<J|\377\1;J|\377\202<J|\377\202;J|\377\4:J|\377;J|\377" \
+  ";I|\377;J|\377\202;I|\377\2;H|\377:I{\377\202;I|\377\202:I{\377\7""9" \
+  "Iz\377:I{\3779Hz\377:I{\377;J{\377(8o\377\33,f\377\202\30)d\377\221\31" \
+  "*e\377\7\27(d\377\36/h\3774Cw\3778Fy\3778Ex\3777Fy\3776Fy\377\2037Fy" \
+  "\377\2027Ey\377\1""6Dy\377\2026Ey\377\2""6Ex\3776Ey\377\2026Ex\377\10" \
+  "6Ew\3776Ex\3776Dx\3776Cw\3776Dx\377-=r\377\31*e\377\30)d\377\222\31*" \
+  "e\377\5\33,f\3770\77t\3772Bv\3771Bu\3772@v\377\2022Av\377\5""2Au\377" \
+  "2Av\3771@u\3772At\3770\77u\377\2051@u\377\3*9p\377\31*e\377\30)d\377" \
+  "\223\31*e\377\3\30)d\377\31*e\377,<q\377\202-=r\377\13-<r\377-;r\377" \
+  "-<r\377,<r\377+<r\377,<r\377,;r\377,<r\377+;q\377\32+e\377\30)d\377\224" \
+  "\31*e\377\3\30)d\377\32+e\377'7n\377\203(8o\377\6'7o\377&6o\377'7n\377" \
+  "'7o\377\40""0j\377\30)d\377\242\31*e\377\202;I|\377\202;J|\377\1;I|\377" \
+  "\202:J|\377\202;J|\377\207<J|\377\202<I{\377\202<J|\377\205<K}\377\203" \
+  ";K}\377\203<K}\377\2=K}\377=J|\377\202=K}\377\14>K}\377>L}\377>L~\377" \
+  "9Fz\3771@u\377)9p\377!2j\377\34-g\377\33,f\377\32+f\377\31*e\377\30)" \
+  "e\377\231\30)d\377\13\31*e\377\32+e\377\33,f\377\34,g\377\36/h\377%5" \
+  "m\377-<r\3774Cw\377<J|\377>L~\377>L}\377\202=K}\377\1<J|\377\203=K}\377" \
+  "\203<K}\377\203;K}\377\204<K}\377\202<J|\377\202<I{\377\204<J|\377\1" \
+  ";J|\377\202<J|\377\202;J|\377\202:J|\377\1;I|\377\202;J|\377\202;I|\377" \
+  "\202;H|\377\202;I|\377\202:I{\377\1""9Iz\377\202:I{\377\7""9Hz\377:I" \
+  "{\3779Hz\3773Bv\377\34,f\377\30)d\377\31*d\377\221\31*e\377\10\30)d\377" \
+  "\31*e\377$4l\3779Gy\3777Ey\3777Ex\3777Fy\3776Fy\377\2037Fy\377\7""7E" \
+  "y\3776Ey\3776Dy\3776Ey\3775Ey\3776Ex\3776Ey\377\2026Ex\377\7""6Dx\377" \
+  "6Ex\3775Dx\3776Cw\3775Dx\377,<q\377\27(c\377\222\31*e\377\3\30)d\377" \
+  "\31*e\377.=s\377\2022Bv\377\2052Av\377\2""1@u\3772Au\377\2041@u\377\4" \
+  "0\77t\3771@u\377.=s\377\33,f\377\226\31*e\377\7(8o\377-=r\377-=q\377" \
+  "-;r\377-<r\377,<r\377-<r\377\205,<r\377\2\37/h\377\30)d\377\226\31*e" \
+  "\377\2!2j\377'7n\377\202(8o\377\202'7o\377\4'7n\377'7o\377%5m\377\27" \
+  "(d\377\243\31*e\377\202;H|\377\202;I|\377\4;J|\377;I|\377;J|\377:J|\377" \
+  "\203;J|\377\202<J|\377\1;J|\377\204<J|\377\202<I{\377\203<J|\377\202" \
+  "<K}\377\2<J|\377<K}\377\203;K}\377\204<K}\377\206=K}\377$>L}\377>L~\377" \
+  "=K}\377:H{\3777Ey\3773Bv\3770\77t\377.>s\377,<r\377+:q\377)9p\377'7n" \
+  "\377%6m\377$4l\377\"2j\377\40""0i\377\36/i\377\35-g\377\33+f\377\31+" \
+  "e\377\33,f\377\35.h\377\37""0i\377!1j\377#3k\377%4l\377&6n\377(8o\377" \
+  "*:p\377,;r\377.=r\377/>t\3771@u\3775Cw\3778Fy\377;J|\377\202>L}\377\203" \
+  "=K}\377\1<J|\377\203=K}\377\204<K}\377\203;K}\377\2<K}\377<J|\377\202" \
+  "<K}\377\203<J|\377\202<I{\377\205<J|\377\2;J|\377<J|\377\203;J|\377\4" \
+  ":J|\377;J|\377;I|\377;J|\377\202;I|\377\202;H|\377\2:I{\377;I|\377\202" \
+  ":I{\377\2029Iz\377\202:I{\377\6""9Hz\377;I{\3776Ex\377$3l\377\31*e\377" \
+  "\30)d\377\222\31*e\377\6\30)d\377\31*e\377,;q\3778Fy\3777Ex\3777Fx\377" \
+  "\2026Fy\377\2027Fy\377\20""7Ey\3777Fy\3776Ey\3777Dy\3776Ey\3775Ey\377" \
+  "6Ex\3776Ey\3776Ex\3776Ew\3776Dx\3776Ex\3776Dx\3776Cw\3777Ex\377*:q\377" \
+  "\225\31*e\377\5,<q\3772Bv\3771Bu\3772Av\3772@v\377\2022Av\377\5""2Au" \
+  "\3771@u\3772At\3771@u\3770\77u\377\2031@u\377\4""1@t\3771@u\377\36/i" \
+  "\377\30)d\377\224\31*e\377\6\30)d\377\40""1j\377,=s\377,=q\377-<r\377" \
+  "-;r\377\202-<r\377\7,<r\377+<r\377,<r\377,;r\377,<r\377%5m\377\30)d\377" \
+  "\225\31*e\377\3\30)d\377\33+f\377'7n\377\202(8o\377\202'7o\377\202&6" \
+  "o\377\3(8o\377\31*e\377\30)d\377\243\31*e\377\203;I|\377\202;H|\377\2" \
+  ";J|\377;I|\377\203;J|\377\202:J|\377\202;J|\377\202<J|\377\1;J|\377\205" \
+  "<J|\377\203<I{\377\1<K}\377\202<J|\377\203<K}\377\2<J|\377<K}\377\204" \
+  ";K}\377\1=K}\377\203<K}\377\205=K}\377\2<K}\377=J|\377\227=K}\377\1<" \
+  "J|\377\206=K}\377\203<K}\377\1=K}\377\204;K}\377\202<K}\377\1<J|\377" \
+  "\203<K}\377\2<J|\377<K}\377\203<I{\377\205<J|\377\1;J|\377\202<J|\377" \
+  "\2;J|\377<J|\377\202:J|\377\203;J|\377\2;I|\377;J|\377\202;H|\377\204" \
+  ";I|\377\2:I{\3779Iz\377\202:I{\377\7""9Hz\377:I{\3779Hz\377:I{\377-<" \
+  "s\377\31*e\377\30)d\377\222\31*e\377\10\30)d\377\31*e\377\34-g\3773C" \
+  "v\3778Fy\3777Ex\3777Fy\3776Fy\377\2057Fy\377\2""7Dy\3777Ey\377\2026E" \
+  "y\377\13""6Ex\3776Ey\3776Ex\3776Dx\3776Ex\3775Ex\3776Dx\3775Cw\3776D" \
+  "x\377(8p\377\27)d\377\222\31*e\377\202\30)d\377\3'7n\3773Bv\3771Bv\377" \
+  "\2032Av\377\1""2Au\377\2022Av\377\1""2At\377\2051@u\377\4""0\77t\377" \
+  "1@u\377!1j\377\30)d\377\224\31*e\377\17\30)d\377\32+e\377-=s\377-=r\377" \
+  "-<r\377-;r\377,<r\377-<r\377,<r\377+<r\377,<r\377,;r\377,<r\377+:q\377" \
+  "\34,f\377\225\31*e\377\202\30)d\377\1$4l\377\202(8o\377\3'7o\377(8o\377" \
+  "&6o\377\202'7n\377\1\36.h\377\245\31*e\377\202:I{\377\202;I|\377\1:I" \
+  "{\377\202;H|\377\202;I|\377\203;J|\377\202:J|\377\202;J|\377\202<J|\377" \
+  "\1;J|\377\206<J|\377\203<I{\377\203<J|\377\206<K}\377\204;K}\377\206" \
+  "<K}\377\231=K}\377\206<K}\377\204;K}\377\207<K}\377\203<J|\377\202<I" \
+  "{\377\206<J|\377\1;J|\377\202<J|\377\202;J|\377\202:J|\377\3;J|\377;" \
+  "I|\377;J|\377\203;I|\377\4;H|\377;I|\377:I{\377;I|\377\202:I{\377\202" \
+  "9Iz\377\203:I{\377\6;I{\3779Hz\377-=r\377\40""0i\377\27(c\377\30)d\377" \
+  "\222\31*e\377\202\30)d\377\6%5m\3776Ey\3778Fy\3778Fx\3777Fy\3776Fy\377" \
+  "\2027Fy\377\3""7Ey\3777Fy\3776Ey\377\2027Ey\377\2""6Ey\3775Ey\377\202" \
+  "6Ey\377\11""6Ex\3776Ew\3776Ex\3776Dx\3776Dw\3775Cw\3776Ey\377(8o\377" \
+  "\30)d\377\222\31*e\377\202\30)d\377\5'6n\3774Cv\3771Bu\3772Av\3772@v" \
+  "\377\2032Av\377\4""2Au\3771@t\3771@u\3770\77u\377\2031@u\377\3""0\77" \
+  "t\3771@u\377(8o\377\225\31*e\377\12\30)d\377\31*e\377*:p\377-=r\377," \
+  "=q\377-<r\377-;r\377-<r\377,<r\377+<r\377\202,<r\377\4+<q\377-<r\377" \
+  "!2k\377\30)d\377\225\31*e\377\4\30)d\377\36.h\377(8o\377'7n\377\202(" \
+  "8o\377\1'7o\377\202&6o\377\2&6n\377\33,f\377\245\31*e\377\1""9Iz\377" \
+  "\203:I{\377\4;I|\377:I{\377;I|\377;H|\377\203;I|\377\3;J|\377;I|\377" \
+  ";J|\377\202:J|\377\2;J|\377:J|\377\211<J|\377\203<I{\377\204<J|\377\204" \
+  "<K}\377\1<J|\377\202<K}\377\205;K}\377\233<K}\377\205;K}\377\203<K}\377" \
+  "\1<J|\377\203<K}\377\204<J|\377\203<I{\377\211<J|\377\2:J|\377;J|\377" \
+  "\202:J|\377\2;J|\377;I|\377\202;J|\377\202;I|\377\202;H|\377\1:I{\377" \
+  "\202;I|\377\202:I{\377\1""9Iz\377\202:I{\377\1""9Hz\377\202:I{\377\4" \
+  "-<r\377\33+f\377\31*e\377\30)d\377\223\31*e\377\6\30)d\377\30)e\377/" \
+  ">t\3777Ez\3778Fx\3778Ex\377\2026Fy\377\2047Fy\377\2027Ey\377\3""6Dy\377" \
+  "6Ey\3775Ey\377\2036Ex\377\1""6Ew\377\2026Dx\377\4""5Cx\3776Cx\3776Ex" \
+  "\377\"3k\377\202\30)d\377\222\31*e\377\6\30*e\377&6n\3772Au\3771Bv\377" \
+  "1Au\3772@v\377\2022Av\377\4""2Au\3772Av\3771@t\3772At\377\2020\77u\377" \
+  "\2021@u\377\5""0\77t\3771@u\377-=r\377\30)e\377\30)d\377\225\31*e\377" \
+  "\7#3l\377-<s\377,=q\377-<q\377-;r\377-<r\377,<r\377\202+<r\377\202,<" \
+  "r\377\2,;r\377'7n\377\202\30)d\377\226\31*e\377\1%5m\377\203(8o\377\6" \
+  "'7o\377&6o\377'7n\377'7o\377!2j\377\30)d\377\245\31*e\377\203:I{\377" \
+  "\2029Iz\377\1:I{\377\204;I|\377\202;H|\377\202;I|\377\202;J|\377\2;I" \
+  "|\377;J|\377\202:J|\377\203;J|\377\202<J|\377\1;J|\377\207<J|\377\204" \
+  "<I{\377\205<J|\377\206<K}\377\1<J|\377\234<K}\377\205<J|\377\204<I{\377" \
+  "\207<J|\377\1;J|\377\202<J|\377\203;J|\377\202:J|\377\204;J|\377\202" \
+  ";I|\377\203;H|\377\2:I{\377;I|\377\202:I{\377\2039Iz\377\11:I{\377:H" \
+  "{\377:I{\377;J{\3777Fy\377-=r\377\35-g\377\27(c\377\30)d\377\223\31*" \
+  "e\377\202\30)d\377\6!2j\3776Dx\3778Fy\3778Ex\3777Fy\3776Fy\377\2027F" \
+  "y\377\1""7Ey\377\2027Fy\377\10""6Ey\3777Dy\3776Ey\3775Ey\3776Ex\3776" \
+  "Ey\3776Ex\3776Ew\377\2026Ex\377\6""6Dx\3776Cw\3776Dx\3774Cw\377\"2k\377" \
+  "\30)d\377\222\31*e\377\202\30)d\377\5$3k\3773Bv\3771Bv\3772Av\3772@v" \
+  "\377\2032Av\377\4""2Au\3772At\3771@u\3770\77u\377\2031@u\377\5""0\77" \
+  "u\3771@u\377-<r\377\31*e\377\30)d\377\224\31*e\377\4\30)d\377\35.g\377" \
+  "-=r\377-=q\377\202-<r\377\12,<r\377-<r\377,<r\377+<r\377,<r\377,;r\377" \
+  "+<r\377*:q\377\33,g\377\31)d\377\225\31*e\377\2\30)d\377\36/h\377\204" \
+  "(8o\377\5'7o\377&6o\377'7o\377%5m\377\27(d\377\246\31*e\377\2:I{\377" \
+  "9Hz\377\203:I{\377\1""9Iz\377\203:I{\377\2;I|\377:I{\377\203;H|\377\202" \
+  ";I|\377\202;J|\377\2;I|\377;J|\377\203:J|\377\202;J|\377\203<J|\377\1" \
+  ";J|\377\210<J|\377\204<I{\377\207<J|\377\227<K}\377\206<J|\377\205<I" \
+  "{\377\210<J|\377\1;J|\377\203<J|\377\203;J|\377\202:J|\377\2;J|\377;" \
+  "I|\377\202;J|\377\202;I|\377\202;H|\377\2;I|\377:I{\377\202;I|\377\202" \
+  ":I{\377\1""9Iz\377\203:I{\377\5""9Hz\377:I{\377:H{\377'8n\377\34,g\377" \
+  "\202\30)d\377\224\31*e\377\202\30)d\377\6,<r\3777Ey\3778Fy\3778Ex\377" \
+  "7Fy\3776Fy\377\2047Fy\377\5""7Ey\3776Ey\3777Dy\3776Ey\3775Ey\377\202" \
+  "6Ey\377\3""6Ex\3776Ew\3776Ex\377\2026Dx\377\4""5Cx\3776Dx\3772Bv\377" \
+  "\35.h\377\202\30)d\377\222\31*e\377\7\30)d\377%5m\3773Bv\3772Bv\3771" \
+  "Bu\3772Av\3772@v\377\2022Av\377\5""2Au\3771@u\3772Au\3771@u\3770\77u" \
+  "\377\2031@u\377\4""0@t\3770\77u\377\35-g\377\30)d\377\224\31*e\377\12" \
+  "\30)d\377\32+e\377,<r\377-=r\377,=q\377-<r\377-;r\377-<r\377,<r\377+" \
+  "<r\377\202,<r\377\4+<q\377,;r\377!1j\377\30)d\377\225\31*e\377\2\30)" \
+  "d\377\32*e\377\203(8o\377\7'7o\377(8o\377&6o\377'7n\377'7o\377\34-g\377" \
+  "\30)d\377\246\31*e\377\2""1Av\3778Gz\377\202:I{\377\1""9Hz\377\203:I" \
+  "{\377\1""9Iz\377\203:I{\377\202;I|\377\2:I{\377;I|\377\202;H|\377\202" \
+  ";I|\377\203;J|\377\2;I|\377;J|\377\203:J|\377\203;J|\377\203<J|\377\1" \
+  ";J|\377\215<J|\377\230<I{\377\214<J|\377\1;J|\377\203<J|\377\203;J|\377" \
+  "\203:J|\377\205;J|\377\202;I|\377\203;H|\377\203;I|\377\202:I{\377\203" \
+  "9Iz\377\205:I{\377\4""7Fy\377+;q\377\31*e\377\30)d\377\225\31*e\377\7" \
+  "\30)d\377\31*e\377\37/i\3775Dw\3778Fz\3778Ex\3777Fy\377\2026Fy\377\204" \
+  "7Fy\377\3""6Ey\3777Dy\3776Ey\377\2025Ey\377\1""6Ey\377\2026Ex\377\1""6" \
+  "Ew\377\2026Dx\377\6""5Dx\3775Cw\3776Dx\3770@u\377\34-g\377\30)d\377\222" \
+  "\31*e\377\202\30)d\377\5!2j\3772Bv\3771Au\3772Av\3772@v\377\2022Av\377" \
+  "\5""2Au\3772Av\3772Au\3771@t\3770\77u\377\2051@u\377\3""0@t\377\36/h" \
+  "\377\30)d\377\226\31*e\377\7'6n\377,=r\377-=q\377-;r\377-<r\377,<r\377" \
+  "-<r\377\203,<r\377\4,;r\377,<r\377&6n\377\27(d\377\226\31*e\377\2\30" \
+  ")d\377$4m\377\203(8o\377\6'7o\377&6o\377'7n\377&6o\377#3k\377\30)d\377" \
+  "\247\31*e\377\3\30)d\377\37/i\377-<r\377\202:I{\377\2""9I{\3779Hz\377" \
+  "\202:I{\377\2039Iz\377\202:I{\377\202;I|\377\2:I{\377;I|\377\202;H|\377" \
+  "\203;I|\377\202;J|\377\2;I|\377;J|\377\203:J|\377\204;J|\377\256<J|\377" \
+  "\1;J|\377\204<J|\377\204;J|\377\202:J|\377\202;J|\377\1;I|\377\202;J" \
+  "|\377\203;I|\377\202;H|\377\204;I|\377\202:I{\377\2039Iz\377\202:I{\377" \
+  "\6""9Hz\377:I{\377;J{\3777Ey\377&5m\377\34,g\377\202\30)d\377\225\31" \
+  "*e\377\10\30)d\377\32+f\377-=r\3777Ey\3778Fy\3778Fx\3777Fy\3776Fy\377" \
+  "\2037Fy\377\2027Ey\377\5""6Ey\3777Dy\3776Ey\3775Ey\3776Ey\377\2036Ex" \
+  "\377\11""6Ew\3776Dx\3776Ex\3775Dx\3776Cw\3775Dx\377,;r\377\32+f\377\30" \
+  ")d\377\223\31*e\377\3\30)d\377#4k\3773Av\377\2022Bv\377\2""2Av\3772@" \
+  "v\377\2032Av\377\2""1@u\3771@t\377\2051@u\377\4""0\77t\3770\77u\377!" \
+  "2j\377\30)d\377\225\31*e\377\4\30)d\377!1j\377-=s\377,=q\377\204-<r\377" \
+  "\2,<r\377+<r\377\202,<r\377\4+<q\377)9p\377\32+e\377\30)e\377\225\31" \
+  "*e\377\2\30)d\377\36.h\377\202'7n\377\202(8o\377\1'7o\377\202&6o\377" \
+  "\3'7n\377\33,f\377\30)d\377\247\31*e\377\7\30)e\377\31*e\377\30)d\377" \
+  "\33,f\377+;q\3778Fy\3779Hz\377\202:I{\377\1""9Hz\377\204:I{\377\2029" \
+  "Iz\377\2;I|\377:I{\377\205;I|\377\202;H|\377\203;I|\377\206;J|\377\204" \
+  ":J|\377\205;J|\377\207<J|\377\1;J|\377\231<J|\377\206;J|\377\203:J|\377" \
+  "\202;J|\377\1;I|\377\203;J|\377\203;I|\377\203;H|\377\204;I|\377\203" \
+  ":I{\377\2029Iz\377\202:I{\377\1""9Hz\377\202:I{\377\4""9H{\3779Hz\377" \
+  "4Cv\377$4l\377\202\30)d\377\226\31*e\377\10\30)d\377\31*e\377!1j\377" \
+  "7Fy\3778Fy\3777Fx\3778Fy\3776Fy\377\2037Fy\377\5""7Ey\3777Fy\3776Fy\377" \
+  "7Dy\3777Ey\377\2025Ey\377\2026Ex\377\12""6Ey\3776Ew\3776Dx\3776Ex\377" \
+  "5Ex\3776Cx\3776Dx\3774Cw\377+;p\377\31*d\377\223\31*e\377\202\30)d\377" \
+  "\5!1j\3772Au\3771Au\3772Bv\3772@v\377\2022Av\377\5""2Au\3772Av\3772A" \
+  "u\3772At\3770\77u\377\2061@u\377\2&6m\377\30)d\377\225\31*e\377\6\30" \
+  ")d\377\36.h\377-=s\377,<r\377-<r\377-;r\377\203-<r\377\7+<r\377,<r\377" \
+  "+;q\377,<r\377+;q\377\37/i\377\30)d\377\225\31*e\377\202\30)d\377\1'" \
+  "7n\377\202(8o\377\202'7o\377\5&6o\377'7n\377'7o\377\"2k\377\30)d\377" \
+  "\253\31*e\377\11\30)d\377\27(d\377\31*e\377\"2k\377,;q\3776Ex\377;J|" \
+  "\377:I{\3779Hz\377\204:I{\377\2029Iz\377\202:I{\377\203;I|\377\2:I{\377" \
+  ";I|\377\203;H|\377\204;I|\377\203;J|\377\1;I|\377\202;J|\377\205:J|\377" \
+  "\207;J|\377\223<J|\377\210;J|\377\205:J|\377\202;J|\377\1;I|\377\203" \
+  ";J|\377\203;I|\377\203;H|\377\205;I|\377\203:I{\377\2029Iz\377\202:I" \
+  "{\377\10:H{\377:I{\377;I{\377;J{\3772Au\377'7o\377\36/h\377\27)d\377" \
+  "\202\30)d\377\225\31*e\377\11\30)d\377\27(c\377\36/h\377.=s\3779Fz\377" \
+  "8Fy\3778Ex\3777Fy\3776Fy\377\2037Fy\377\4""7Ey\3777Fy\3776Ey\3777Ey\377" \
+  "\2036Ey\377\15""6Ex\3776Ey\3776Ex\3776Ew\3776Dx\3776Ex\3775Dx\3776Dw" \
+  "\3775Dx\3774Cw\377#4k\377\27)d\377\30)d\377\222\31*e\377\202\30)d\377" \
+  "\3$4l\3773Bv\3772Bv\377\2062Av\377\2""2Au\3771@t\377\2051@u\377\5""0" \
+  "\77t\3771@u\377'7n\377\30)d\377\30)e\377\224\31*e\377\7\31*d\377\32+" \
+  "f\377+;q\377,<r\377-=q\377-;r\377-<r\377\205,<r\377\5+<r\377,<r\377\"" \
+  "3k\377\30)d\377\31*d\377\224\31*e\377\202\30)d\377\6#3l\377(8o\377'7" \
+  "n\377'7o\377(8o\377'7o\377\202&6o\377\1$4l\377\257\31*e\377\202\30)d" \
+  "\377\4\31*e\377\30)d\377!1j\3773Bv\377\207:I{\377\2029Iz\377\202:I{\377" \
+  "\1""9Iz\377\203;I|\377\1:I{\377\204;H|\377\204;I|\377\204;J|\377\1;I" \
+  "|\377\203;J|\377\207:J|\377\224;J|\377\207:J|\377\210;J|\377\1;H|\377" \
+  "\203;I|\377\202;H|\377\202;I|\377\1:I{\377\202;I|\377\3:I{\3779Iz\377" \
+  ":I{\377\2039Iz\377\205:I{\377\3:H{\377,;q\377\33,f\377\202\31*e\377\202" \
+  "\30)d\377\226\31*e\377\7\30)d\377\31*e\377*:q\3777Ey\3777Fx\3778Fy\377" \
+  "7Fx\377\2026Fy\377\2037Fy\377\5""7Ey\3777Fy\3777Ey\3777Dy\3776Dy\377" \
+  "\2025Ey\377\2026Ey\377\2""6Ex\3776Ew\377\2026Ex\377\7""6Dx\3776Cw\377" \
+  "5Dx\3774Cw\377\34.h\377\30)d\377\30)e\377\223\31*e\377\5\30)d\377$4l" \
+  "\3772Au\3771Bv\3771Bu\377\2022@v\377\2022Av\377\2022Au\377\3""1@t\377" \
+  "1@u\3770\77u\377\2031@u\377\5""0\77t\3771@u\377*:p\377\31*e\377\30)d" \
+  "\377\225\31*e\377\6\30)d\377)9o\377-=r\377,=q\377-<r\377-;r\377\202-" \
+  "<r\377\202+<r\377\202,<r\377\4,;r\377'6n\377\31*e\377\30)d\377\225\31" \
+  "*e\377\4\30)d\377\35.g\377'7n\377(8n\377\202(8o\377\6'7o\377&6o\377'" \
+  "7n\377'7o\377!1j\377\30)d\377\262\31*e\377\11\30)d\377\26'c\377\35.g" \
+  "\377)9p\3772Av\3779Hz\377;I{\377:I{\3779Hz\377\205:I{\377\2029Iz\377" \
+  "\204:I{\377\205;I|\377\205;H|\377\205;I|\377\210;J|\377\1;I|\377\215" \
+  ";J|\377\1;I|\377\210;J|\377\206;I|\377\204;H|\377\206;I|\377\203:I{\377" \
+  "\2039Iz\377\204:I{\377\11""9H{\377:I{\377;J{\3776Ex\377.>s\377$4l\377" \
+  "\30)d\377\27(d\377\30)d\377\230\31*e\377\7\30)d\377\31*e\377$4l\3774" \
+  "Cw\3779Gz\3778Ex\3777Fy\377\2026Fy\377\2057Fy\377\5""7Ey\3777Dy\3776" \
+  "Dy\3776Ey\3775Ey\377\2026Ey\377\1""6Ex\377\2026Ew\377\1""6Ex\377\202" \
+  "6Dx\377\5""6Cw\3776Dx\377,<r\377\32+e\377\30)d\377\223\31*e\377\202\30" \
+  ")d\377\3$5m\3773Bv\3771Bv\377\2042Av\377\6""2Au\3772Av\3772Au\3772At" \
+  "\3771@u\3770\77u\377\2031@u\377\5""1\77t\3771@u\377+:p\377\31*e\377\30" \
+  ")d\377\225\31*e\377\20\30)d\377%5m\377-=s\377,=r\377-<r\377-;r\377,<" \
+  "r\377-<r\377,<r\377+<r\377,<r\377,;r\377+<q\377+;q\377\34-g\377\30)d" \
+  "\377\225\31*e\377\3\31*d\377\31*e\377%5m\377\202(8o\377\203'7o\377\4" \
+  "'7n\377'7o\377!2j\377\27(d\377\265\31*e\377\202\30)d\377\10\32+e\377" \
+  "\34-g\377)9p\3778Gz\377;J{\377:I{\377:Iz\3779H{\377\204:I{\377\2039I" \
+  "z\377\204:I{\377\203;I|\377\1:I{\377\203;I|\377\205;H|\377\210;I|\377" \
+  "\217;J|\377\210;I|\377\206;H|\377\202;I|\377\1:I{\377\203;I|\377\204" \
+  ":I{\377\2039Iz\377\204:I{\377\1""9Hz\377\202:I{\377\5;J{\3773Au\377\"" \
+  "3k\377\33+f\377\31*e\377\202\30)d\377\231\31*e\377\6\27(d\377\37""0i" \
+  "\3774Bw\3777Ey\3778Fy\3778Ex\377\2027Fy\377\1""6Fy\377\2027Fy\377\6""7" \
+  "Ey\3777Fy\3777Ey\3776Ey\3777Dy\3776Ey\377\2025Ey\377\2036Ex\377\2""6" \
+  "Ew\3776Ex\377\2026Dx\377\6""5Cx\3775Dx\3777Ey\377&6m\377\31*e\377\30" \
+  ")d\377\224\31*e\377\2\30)d\377'7o\377\2022Bv\377\3""1Bu\3772Av\3772@" \
+  "v\377\2032Av\377\4""2Au\3771@t\3771@u\3770\77u\377\2051@u\377\3+:q\377" \
+  "\32*e\377\30)d\377\225\31*e\377\2\30)d\377\40""0j\377\202,<r\377\2-=" \
+  "q\377-;r\377\202-<r\377\2,<r\377+<r\377\202,<r\377\3+<q\377-<r\377\37" \
+  "0i\377\202\30)d\377\225\31*e\377\2\30)d\377!2k\377\204(8o\377\1'7o\377" \
+  "\202&6o\377\1(8o\377\272\31*e\377\202\30)d\377\5\27(d\377\40""1i\377" \
+  ",;r\3773Cw\3777Fy\377\212:I{\377\2049Iz\377\204:I{\377\206;I|\377\1:" \
+  "I{\377\205;I|\377\221;H|\377\205;I|\377\1:I{\377\206;I|\377\204:I{\377" \
+  "\2049Iz\377\211:I{\377\7""9Hz\3775Ex\3771@u\377'7n\377\33,g\377\27(c" \
+  "\377\30)d\377\232\31*e\377\11\30)d\377\30*e\377\36.h\377,;q\3779Fz\377" \
+  "8Fx\3778Ex\3777Fy\3776Fy\377\2037Fy\377\6""7Ey\3777Fy\3777Ey\3776Ey\377" \
+  "7Dy\3776Ey\377\2025Ey\377\2036Ex\377\1""6Ew\377\2026Ex\377\7""6Dx\377" \
+  "5Dx\3775Cw\3776Dx\3772Au\377!1j\377\30)d\377\224\31*e\377\7\30)d\377" \
+  "\31*e\377&6m\3773Bv\3771Bu\3772Av\3772@v\377\2022Av\377\6""2Au\3772A" \
+  "v\3771@u\3772At\3771@u\3770\77u\377\2031@u\377\5""0\77t\3771@u\377-<" \
+  "r\377\32+f\377\30)d\377\225\31*e\377\4\30)d\377\34-f\377,<r\377-=r\377" \
+  "\204-<r\377\2,<r\377+<r\377\202,<r\377\4+;q\377,;r\377$4l\377\30)d\377" \
+  "\226\31*e\377\4\30)d\377\34-g\377(8o\377'7n\377\202(8o\377\6'7o\377&" \
+  "6o\377'7n\377&6n\377\35.g\377\30)d\377\273\31*e\377\203\30)d\377\11\31" \
+  "*e\377\35-g\377!2k\377,;q\3777Fx\377;J|\377;J{\377:I{\3779Hz\377\206" \
+  ":I{\377\2059Iz\377\206:I{\377\235;I|\377\206:I{\377\2059Iz\377\205:I" \
+  "{\377\1""9H{\377\202:I{\377\6;J|\377;J{\3772Av\377'7n\377\37/i\377\33" \
+  ",f\377\204\30)d\377\231\31*e\377\5\30)d\377\27(c\377\35-g\377.>s\377" \
+  "6Dy\377\2028Fy\377\2027Fy\377\1""6Fy\377\2057Fy\377\2027Ey\377\2""7D" \
+  "y\3776Ey\377\2025Ey\377\2026Ey\377\3""6Ex\3776Ew\3776Dx\377\2026Ex\377" \
+  "\6""5Dx\3776Cw\3776Ex\377+:q\377\33,f\377\30)d\377\226\31*e\377\3*9p" \
+  "\3773Bv\3772Bu\377\2022Av\377\1""2@v\377\2032Av\377\4""2Au\3772At\377" \
+  "1@u\3770\77u\377\2051@u\377\3,;q\377\32+e\377\30)d\377\225\31*e\377\12" \
+  "\30)d\377\32+f\377+;q\377-=r\377,=r\377-<r\377-;r\377,<r\377-<r\377+" \
+  "<r\377\202,<r\377\3+;q\377,<r\377)9o\377\231\31*e\377\1%5m\377\203(8" \
+  "o\377\202'7o\377\3'7n\377&6o\377'7n\377\202\30)d\377\300\31*e\377\202" \
+  "\30)d\377\7\27(c\377\33,g\377%5m\3770\77t\3776Fx\3778Gy\3779Hz\377\204" \
+  ":I{\377\1""9Hz\377\211:I{\377\2129Iz\377\213:I{\377\2129Iz\377\210:I" \
+  "{\377\2:H{\3779Iz\377\204:I{\377\11""8Gz\3777Fy\3775Dx\377,;q\377!2j" \
+  "\377\30)d\377\27(d\377\30)d\377\31*d\377\234\31*e\377\7\30)d\377\31*" \
+  "e\377\34-g\377,;q\3779G{\3778Fy\3778Ex\377\2027Fy\377\1""6Fy\377\205" \
+  "7Fy\377\2027Ey\377\4""7Dy\3776Ey\3775Ey\3776Ex\377\2026Ey\377\3""6Ex" \
+  "\3776Ew\3776Dx\377\2026Ex\377\6""5Dx\3776Cx\3776Dx\3773Cw\377&6n\377" \
+  "\30)d\377\225\31*e\377\5\30)d\377\31*e\377+;q\3773Bv\3771Bv\377\2042" \
+  "Av\377\6""2Au\3772Av\3772Au\3772At\3771@u\3770\77u\377\2031@u\377\4""0" \
+  "\77t\3771@u\377.=s\377\33,f\377\226\31*e\377\5\30)d\377\31*e\377(8n\377" \
+  "-=r\377-=q\377\202-<r\377\2,<r\377-<r\377\205,<r\377\3+;q\377\32+f\377" \
+  "\30)d\377\225\31*e\377\202\30)d\377\1\37""0i\377\202(8o\377\7'7o\377" \
+  "(8o\377'7o\377&6o\377'7o\377'7n\377\27(d\377\304\31*e\377\1\30)e\377" \
+  "\202\30)d\377\12\27(d\377\31*e\377\35.h\377\"3k\377(7o\377.=s\3774Cv" \
+  "\3779H{\377<J|\377;J{\377\202:I{\377\1:Iz\377\217:I{\377\2139Iz\377\221" \
+  ":I{\377\11;J{\377;J|\377<J|\3777Fy\3771@u\377+;q\377%5m\377\40""1j\377" \
+  "\34,f\377\202\27(d\377\202\30)d\377\235\31*e\377\11\30)d\377\27(c\377" \
+  "\35.h\377,;q\3776Dx\3778Fy\3778Ex\3777Fx\3777Fy\377\2026Fy\377\2027F" \
+  "y\377\1""7Ey\377\2027Fy\377\5""6Ey\3777Dy\3776Dy\3776Ey\3775Ey\377\202" \
+  "6Ey\377\2026Ex\377\1""6Ew\377\2026Ex\377\2026Dx\377\6""6Cw\3776Dx\377" \
+  "/>t\377\36/h\377\27(d\377\30)d\377\224\31*e\377\7\30)d\377\34-g\377." \
+  ">s\3772Bv\3771Bu\3772Av\3772@v\377\2042Av\377\4""1@u\3771@t\3771@u\377" \
+  "0\77u\377\2051@u\377\3.=s\377\34,g\377\30)d\377\225\31*e\377\202\30)" \
+  "d\377\3&6m\377-=s\377,<q\377\202-<r\377\4,<r\377-<r\377,<r\377+<r\377" \
+  "\202,<r\377\202+;q\377\2\35.h\377\30)d\377\226\31*e\377\2\30)d\377\35" \
+  "-g\377\204(8o\377\6'7o\377&6o\377'7n\377'7o\377\40""0i\377\30)d\377\313" \
+  "\31*e\377\204\30)d\377\4\34-h\377%5m\377.=s\3776Ey\377\2059Hz\377\1:" \
+  "H{\377\210:I{\377\1""9Hz\377\215:I{\377\1:Iz\377\210:I{\377\2069Hz\377" \
+  "\4""3Bv\377*:q\377\"2k\377\31*e\377\204\30)d\377\240\31*e\377\202\30" \
+  ")d\377\7\31*e\377\34-g\377/>s\3778Fz\3778Fy\3777Fx\3778Fy\377\2026Fy" \
+  "\377\2037Fy\377\1""7Ey\377\2027Fy\377\7""6Ey\3777Dy\3777Ey\3776Ey\377" \
+  "5Ey\3776Ex\3776Ey\377\2026Ex\377\1""6Ew\377\2026Ex\377\2026Dx\377\1""6" \
+  "Cw\377\2025Dx\377\1*:p\377\202\30)d\377\224\31*e\377\202\30)d\377\2\34" \
+  "-g\3772@u\377\2022Bv\377\2032Av\377\1""2Au\377\2022Av\377\3""2Au\377" \
+  "2At\3770\77u\377\2041@u\377\4""0\77t\3771@u\377.>s\377\33,f\377\227\31" \
+  "*e\377\6\30)e\377$4l\377-=s\377,<q\377-<r\377-;r\377\202-<r\377\203," \
+  "<r\377\1+;q\377\202,<r\377\2#3k\377\30)d\377\226\31*e\377\4\30)d\377" \
+  "\32+e\377&6m\377'7n\377\203(8o\377\5'7o\377'7n\377'7o\377$4l\377\30)" \
+  "d\377\320\31*e\377\202\30)d\377\17\27(d\377\26(c\377\30*e\377\34,g\377" \
+  "\37""0i\377#3l\377'7n\377+:p\377-=r\377/\77t\3772Au\3773Cv\3776Dx\377" \
+  "7Fy\3779Hz\377\206;J|\377\204;J{\377\206;J|\377\15:I{\3778Gz\3777Fx\377" \
+  "4Dw\3773Bv\3771@u\377/>s\377,<r\377)9p\377&5m\377!2j\377\36.h\377\33" \
+  "+f\377\202\27(c\377\1\27(d\377\202\30)d\377\242\31*e\377\202\30)d\377" \
+  "\11\30*d\377#3l\377.=s\3778Fy\3778Fz\3778Ex\3777Fx\3777Fy\3776Fy\377" \
+  "\2047Fy\377\2""7Ey\3777Fy\377\2027Ey\377\2""7Dy\3776Ey\377\2025Ey\377" \
+  "\2""6Ex\3776Ey\377\2026Ex\377\4""6Ew\3776Dx\3776Ex\3776Dx\377\2025Cx" \
+  "\377\5""6Ex\3770\77t\377!1j\377\27(d\377\30*e\377\225\31*e\377\2\30)" \
+  "d\377!2k\377\2022Bv\377\3""1Bu\3772Av\3772@v\377\2032Av\377\3""2Au\377" \
+  "1@u\3771@t\377\2071@u\377\3-<r\377\34-g\377\30)d\377\226\31*e\377\7\30" \
+  ")d\377\40""0j\377,<s\377,<r\377-<q\377-;r\377-<r\377\205,<r\377\3+<r" \
+  "\377,<r\377%5n\377\202\30)d\377\226\31*e\377\2\30)d\377\"2j\377\203(" \
+  "8o\377\202'7o\377\202&6o\377\3(8o\377\36.h\377\30)d\377\256\31*e\377" \
+  "\1\30)d\377\245\31*e\377\206\30)d\377\204\31*e\377\202\32+e\377\21\32" \
+  "+f\377\33,f\377\34,g\377\35.h\377\36/i\377\40/i\377\40""1j\377!2k\377" \
+  "#3k\377#3l\377\"3k\377!1j\377\40""1i\377\37/i\377\36.h\377\35-g\377\33" \
+  ",g\377\202\32+f\377\202\32+e\377\204\31*e\377\206\30)d\377\245\31*e\377" \
+  "\202\30)d\377\11%5m\3776Dx\3777Ey\3778Fy\3778Fx\3778Ex\3776Fy\3777Fy" \
+  "\3776Fy\377\2067Fy\377\11""6Dy\3777Ey\3776Dy\3776Ey\3775Ey\3776Ey\377" \
+  "6Ex\3776Ey\3776Ex\377\2026Ew\377\2026Ex\377\2026Dx\377\5""6Cw\3775Dx" \
+  "\377&6n\377\31*e\377\30)d\377\226\31*e\377\7\27(d\377$5m\3773Bv\3772" \
+  "Bv\3771Bu\3772Av\3772@v\377\2022Av\377\4""2Au\3772Av\3771@t\3772At\377" \
+  "\2020\77u\377\2041@u\377\4""0\77t\377-<r\377\32+f\377\30)d\377\226\31" \
+  "*e\377\5\30)d\377\36/h\377-=s\377-=r\377-<q\377\202-;r\377\2,<r\377-" \
+  "<r\377\202+<r\377\202,<r\377\4,;r\377(8o\377\31*e\377\30)d\377\226\31" \
+  "*e\377\2\30)d\377\37/h\377\203(8o\377\3'7o\377(8o\377&6o\377\202'7o\377" \
+  "\2\34,g\377\30)d\377\257\31*e\377\3$4l\377\34-g\377\27(d\377\202\30)" \
+  "d\377\256\31*e\377\1\30)e\377\217\30)d\377\257\31*e\377\202\30)d\377" \
+  "\7\31*e\377\37/h\377(8o\3776Dx\3779Gz\3778Fx\3777Ex\377\2027Fy\377\1" \
+  "6Fy\377\2067Fy\377\2027Ey\377\1""7Dy\377\2026Ey\377\3""5Ey\3776Ex\377" \
+  "6Ey\377\2026Ex\377\2026Ew\377\2026Ex\377\2""5Dx\3776Cw\377\2025Dx\377" \
+  "\3/>t\377\37/i\377\27)d\377\226\31*e\377\6\30)d\377\32+e\377(8n\3773" \
+  "Cv\3771Au\3771Av\377\2022@v\377\2032Av\377\4""2Au\3772At\3771@u\3770" \
+  "\77u\377\2041@u\377\5""1@t\3771@u\377-<r\377\33,f\377\30)d\377\226\31" \
+  "*e\377\7\30)d\377\34-g\377,<q\377,<r\377-=q\377-;r\377-<r\377\205,<r" \
+  "\377\5+;q\377,<r\377+;q\377\34-g\377\30)d\377\226\31*e\377\2\31*d\377" \
+  "\33+f\377\202'7n\377\202(8o\377\5'7o\377&6o\377'7n\377&6o\377%5m\377" \
+  "\261\31*e\377\5""8Fy\3775Cx\377/>t\377\37/i\377\27(d\377\202\30)d\377" \
+  "\351\31*e\377\203\30)d\377\3&6n\3773Av\3776Dx\377\2028Fy\377\1""8Ex\377" \
+  "\2027Fy\377\2026Fy\377\2037Fy\377\1""7Ey\377\2027Fy\377\4""6Ey\3777D" \
+  "y\3776Dy\3776Ey\377\2025Ey\377\2""6Ex\3776Ey\377\2026Ex\377\6""6Ew\377" \
+  "6Dx\3776Ex\3776Dx\3775Dx\3776Cw\377\2025Dx\377\3#4l\377\31*e\377\30)" \
+  "d\377\226\31*e\377\7\30)d\377\32+f\377.>s\3772Bv\3771Bu\3772Av\3772@" \
+  "v\377\2032Av\377\2022Au\377\4""1@u\3772Au\3771@u\3770\77u\377\2031@u" \
+  "\377\5""0\77t\3771@u\377*:q\377\32+e\377\30)d\377\226\31*e\377\7\30)" \
+  "d\377\31*e\377+;q\377-=r\377-=q\377-<r\377-;r\377\202-<r\377\2,<r\377" \
+  "+<r\377\203,<r\377\4-<r\377\36.h\377\30)d\377\31*d\377\226\31*e\377\2" \
+  "\30)d\377$4l\377\204(8o\377\202'7o\377\4&6o\377(8n\377\31*e\377\30)d" \
+  "\377\260\31*e\377\10""7Fy\3777Ex\3778Fy\3779Gz\3773Av\377#3l\377\34-" \
+  "g\377\31*e\377\202\30)d\377\342\31*e\377\203\30)d\377\7\32+f\377\36." \
+  "h\377)9p\3778Fy\3779Fz\3778Fx\3777Fx\377\2027Fy\377\1""6Fy\377\2077F" \
+  "y\377\4""6Ey\3777Ey\3777Dy\3776Ey\377\2025Ey\377\2036Ey\377\2036Ex\377" \
+  "\12""6Dx\3776Ex\3776Dx\3775Dx\3775Cx\3776Dx\3774Cw\377.=s\377\33,f\377" \
+  "\30)d\377\226\31*e\377\202\30)d\377\6\37/i\3771Au\3772Bv\3771Bu\3772" \
+  "Av\3772@v\377\2022Av\377\6""2Au\3772Av\3771@u\3772At\3771@u\3770\77u" \
+  "\377\2061@u\377\3,;q\377\31*e\377\30)d\377\226\31*e\377\21\30)d\377\31" \
+  "*e\377*:p\377-=r\377,=q\377-<r\377-;r\377,<r\377-<r\377,<r\377+<r\377" \
+  ",<r\377,;r\377+<q\377+;q\377!1j\377\30)d\377\226\31*e\377\202\30)d\377" \
+  "\3\37""0j\377(8o\377'7n\377\202(8o\377\1'7o\377\202&6o\377\3'7o\377\34" \
+  "-g\377\30)d\377\261\31*e\377\1""6Fy\377\2027Fy\377\1""7Ex\377\2028Fy" \
+  "\377\6""5Dw\3770\77t\377'7n\377\33,g\377\27(c\377\30)d\377\336\31*e\377" \
+  "\1\30)d\377\202\27)d\377\4\40""1j\377,;r\3772Av\3777Ey\377\2028Fy\377" \
+  "\3""8Ex\3777Fx\3777Fy\377\2026Fy\377\2037Fy\377\1""7Ey\377\2027Fy\377" \
+  "\5""7Ey\3776Ey\3777Dy\3776Dy\3776Ey\377\2025Ey\377\2""6Ex\3776Ey\377" \
+  "\2026Ex\377\2026Ew\377\2026Ex\377\2026Dx\377\6""6Cw\3776Ex\377/>t\377" \
+  "\40""1i\377\31*e\377\30)d\377\226\31*e\377\202\30)d\377\6&6n\3772Au\377" \
+  "2Bv\3771Av\3772Av\3772@v\377\2022Av\377\4""2Au\3772Av\3771@u\3772Au\377" \
+  "\2061@u\377\5""0\77t\3771@u\377(8o\377\31*e\377\30)d\377\227\31*e\377" \
+  "\6\30)d\377'8o\377-=s\377,=q\377-<r\377-;r\377\202-<r\377\2,<r\377+<" \
+  "r\377\202,<r\377\4+<q\377,<r\377$4l\377\30)e\377\227\31*e\377\10\30)" \
+  "d\377\34-g\377'7o\377'7n\377(8o\377'7o\377(8o\377&6o\377\202'7o\377\1" \
+  "#3k\377\263\31*e\377\2037Fy\377\2026Fy\377\7""8Fy\3777Fy\3778Fx\3778" \
+  "Fy\3778Fz\3770@t\377\"2j\377\202\31*e\377\203\30)d\377\324\31*e\377\203" \
+  "\30)d\377\202\31*e\377\10\34,f\377(8o\3776Dx\3778Fz\3778Fx\3778Ex\377" \
+  "7Fy\3778Fy\377\2036Fy\377\2067Fy\377\5""7Ey\3776Ey\3777Dy\3776Dy\377" \
+  "7Ey\377\2025Ey\377\1""6Ex\377\2026Ey\377\2026Ex\377\3""6Ew\3776Dx\377" \
+  "6Ex\377\2026Dx\377\7""6Cw\3775Dx\3775Dw\3774Cw\377%5m\377\30)d\377\30" \
+  ")e\377\226\31*e\377\202\30)d\377\6\31*e\377*9p\3773Bv\3771Au\3772Bv\377" \
+  "2@v\377\2032Av\377\4""2Au\3772Av\3771@u\3772Au\377\2101@u\377\2(8o\377" \
+  "\31)d\377\227\31*e\377\202\30)d\377\11(8n\377-=s\377,=r\377-<r\377-;" \
+  "r\377,<r\377-<r\377,<r\377+<r\377\202,<r\377\4+;q\377,<r\377&6n\377\30" \
+  ")d\377\227\31*e\377\3\30)d\377\31*e\377%5m\377\202(8o\377\7'7o\377(8" \
+  "o\377'7o\377'7n\377'7o\377&6n\377\27(d\377\263\31*e\377\2057Fy\377\202" \
+  "6Fy\377\2027Fy\377\11""8Fx\3778Fy\3779Gz\3776Dx\377.=s\377(8o\377\40" \
+  "1i\377\31*d\377\27(c\377\202\30)d\377\317\31*e\377\202\30)d\377\11\27" \
+  "(c\377\34,g\377#3l\377*:q\3771@u\3778Fy\3778Fz\3778Fy\3778Ex\377\202" \
+  "7Fy\377\2026Fy\377\2077Fy\377\2""7Ey\3776Ey\377\2027Dy\377\2026Ey\377" \
+  "\4""5Ey\3776Ey\3776Ex\3776Ey\377\2026Ex\377\2026Ew\377\2026Ex\377\7""5" \
+  "Dx\3776Dx\3776Cx\3776Dx\3775Dx\377(8o\377\33,f\377\202\30)d\377\227\31" \
+  "*e\377\5\30)d\377\36.h\377.=s\3773Bv\3771Bv\377\2052Av\377\6""2Au\377" \
+  "2Av\3771@u\3772At\3771@u\3770\77u\377\2041@u\377\3""0\77t\3771@u\377" \
+  "$4l\377\202\30)d\377\227\31*e\377\6\30)d\377&6n\377-=s\377,=r\377-<q" \
+  "\377-;r\377\202-<r\377\2,<r\377+<r\377\202,<r\377\3+;q\377,<r\377(8o" \
+  "\377\230\31*e\377\5\31*d\377\30)d\377\"3k\377(8o\377'7n\377\202(8o\377" \
+  "\1'7o\377\202&6o\377\3(8o\377\36/h\377\30)d\377\263\31*e\377\2077Fy\377" \
+  "\2026Fy\377\3""7Fy\3776Fy\3778Fx\377\2028Fy\377\2027Ex\377\4""7Ey\377" \
+  "-=r\377!1k\377\31*d\377\203\30)d\377\311\31*e\377\203\30)d\377\3\33," \
+  "f\377'7n\3773Bv\377\2027Ey\377\6""8Fx\3778Fy\3778Fx\3777Fx\3776Fy\377" \
+  "7Fy\377\2026Fy\377\2057Fy\377\6""7Ey\3777Fy\3777Ey\3777Dy\3777Ey\377" \
+  "7Dy\377\2036Ey\377\2""5Ey\3776Ex\377\2026Ey\377\16""6Ew\3776Ex\3776E" \
+  "w\3776Dx\3776Ex\3776Dx\3776Cx\3776Cw\3775Cx\3775Dx\377.=s\377\33,f\377" \
+  "\31*d\377\30)d\377\230\31*e\377\6\30)d\377\"3l\3772Au\3772Bv\3771Bu\377" \
+  "1Av\377\2022@v\377\2042Av\377\4""1@u\3772At\3771@u\3770\77u\377\2031" \
+  "@u\377\4""0@u\3770\77t\3771@u\377!1j\377\202\30)d\377\227\31*e\377\7" \
+  "\30)d\377&6m\377-=s\377,=r\377-<q\377-;r\377-<r\377\202,<r\377\1+<r\377" \
+  "\204,<r\377\3+;p\377\31*f\377\30)d\377\227\31*e\377\2\30)d\377\40""1" \
+  "j\377\203(8o\377\7'7o\377(8o\377&6o\377'7o\377'7n\377\36/h\377\30)d\377" \
+  "\264\31*e\377\1""7Dy\377\2027Ey\377\2027Fy\377\1""7Ey\377\2057Fy\377" \
+  "\2026Fy\377\2037Fy\377\12""8Fx\3778Fy\3779Gz\3777Ey\377/>s\377(7o\377" \
+  "\"2k\377\35.h\377\31*e\377\27(d\377\202\30)d\377\276\31*e\377\203\30" \
+  ")d\377\6\27)c\377\33,f\377\37""0i\377$4l\377+:q\3773Au\377\2029Gz\377" \
+  "\3""8Fy\3778Ex\3777Fx\377\2027Fy\377\2026Fy\377\2057Fy\377\1""7Ey\377" \
+  "\2027Fy\377\4""7Ey\3776Ey\3777Ey\3776Dy\377\2026Ey\377\4""5Ey\3776Ey" \
+  "\3776Ex\3776Ey\377\2026Ex\377\2026Ew\377\1""6Dx\377\2026Ex\377\11""6" \
+  "Dx\3775Dx\3776Cx\3776Dx\3775Dx\377-<r\377\40""0j\377\27(c\377\30)d\377" \
+  "\230\31*e\377\10\30)d\377\33,g\377*:q\3774Cv\3772Bu\3772Bv\3772Av\377" \
+  "2@v\377\2022Av\377\5""2Au\3772Av\3771@u\3772At\3771@t\377\2020\77u\377" \
+  "\2031@u\377\5""0\77t\3771@u\377.>s\377\37/i\377\27)d\377\231\31*e\377" \
+  "\5$5m\377-=s\377,<r\377-=r\377-;r\377\202-<r\377\2,<r\377+<r\377\202" \
+  ",<r\377\5,;r\377+<q\377*:q\377\33,g\377\30)d\377\227\31*e\377\2\30)d" \
+  "\377\34-g\377\202'7n\377\1(8o\377\202'7o\377\5&6o\377'7n\377&6o\377&" \
+  "6n\377\32+f\377\265\31*e\377\5""6Ey\3776Dy\3777Dy\3776Ey\3777Ey\377\202" \
+  "7Fy\377\1""7Ey\377\2057Fy\377\2036Fy\377\2027Fy\377\1""8Ex\377\2038F" \
+  "y\377\10""7Ex\3776Dx\3775Cx\377/\77t\377%5m\377\33,f\377\27(c\377\27" \
+  ")d\377\202\30)d\377\267\31*e\377\202\30)d\377\7\27(d\377\30)d\377\37" \
+  "0i\377)9p\3773Av\3775Cx\3776Ex\377\2038Fy\377\2""8Fx\3778Ex\377\2037" \
+  "Fy\377\2026Fy\377\2057Fy\377\1""7Ey\377\2027Fy\377\2""7Ey\3776Ey\377" \
+  "\2027Dy\377\2""6Dy\3776Ey\377\2025Ey\377\2036Ey\377\2026Ex\377\4""6E" \
+  "w\3776Ex\3776Dx\3776Ex\377\2026Dx\377\10""6Cx\3776Cw\3775Dx\377.=r\377" \
+  "\34-h\377\31*e\377\30)d\377\30*e\377\230\31*e\377\10\27(d\377\40""2j" \
+  "\3771@u\3772Bv\3771Bu\3771Av\3772Av\3772@v\377\2022Av\377\6""2Au\377" \
+  "2Av\3772Au\3772At\3771@u\3770\77u\377\2041@u\377\5""0\77t\3771@u\377" \
+  "/>s\377\34,f\377\30)d\377\230\31*e\377\7\30)d\377#3l\377-=s\377,<r\377" \
+  "-=q\377-<r\377-;r\377\202-<r\377\203,<r\377\5,;r\377+<q\377,;r\377\37" \
+  "/i\377\30)d\377\227\31*e\377\3\30)d\377\32*e\377'7o\377\204(8o\377\1" \
+  "'7o\377\202&6o\377\3(8o\377\31*e\377\30)d\377\265\31*e\377\1""6Ey\377" \
+  "\2025Ey\377\2026Ey\377\2027Dy\377\2""6Ey\3777Ey\377\2027Fy\377\1""7E" \
+  "y\377\2067Fy\377\2036Fy\377\2027Fy\377\14""7Fx\3778Ex\3778Fy\3779Gz\377" \
+  "9G{\3776Ex\377/\77t\377)9p\377\"3k\377\36/h\377\34-g\377\32+f\377\206" \
+  "\30)d\377\244\31*e\377\206\30)d\377\11\31*e\377\33,f\377\35.h\377\37" \
+  "0i\377%5m\377,;r\3772Bu\3779Gy\3779Gz\377\2028Fy\377\2""8Ex\3777Fx\377" \
+  "\2027Fy\377\2036Fy\377\2117Fy\377\2""7Ey\3776Ey\377\2027Dy\377\2026E" \
+  "y\377\2035Ey\377\2""6Ex\3776Ey\377\2036Ex\377\2026Ew\377\14""6Dx\377" \
+  "6Ex\3776Dx\3775Dx\3776Cw\3775Cx\3776Dx\3775Cw\3770\77t\377!1j\377\27" \
+  "(d\377\30)d\377\230\31*e\377\202\30)d\377\7\32+f\377'6n\3773Bv\3771B" \
+  "u\3771Av\3772Av\3772@v\377\2042Av\377\5""2Au\3772At\3771@t\3771@u\377" \
+  "0\77u\377\2041@u\377\5""0\77t\3771@u\377,;q\377\31*e\377\30)d\377\230" \
+  "\31*e\377\5\30)d\377\"2k\377.>s\377,<r\377-=r\377\202-<r\377\4,<r\377" \
+  "-<r\377,<r\377+<r\377\203,<r\377\3,;r\377!1j\377\27)d\377\231\31*e\377" \
+  "\2%5m\377(8o\377\202'7o\377\3(8o\377'7o\377&6o\377\202'7n\377\1\33,f" \
+  "\377\267\31*e\377\2""6Ey\3776Ex\377\2035Ey\377\2026Ey\377\2027Dy\377" \
+  "\2""6Ey\3777Ey\377\2127Fy\377\2026Fy\377\2037Fy\377\2""7Fx\3778Fx\377" \
+  "\2048Fy\377\13""7Ex\3775Cw\3773Av\3771@u\377-<r\377(8o\377$4l\377\37" \
+  "0i\377\33,f\377\26'c\377\27(c\377\202\27(d\377\204\30)d\377\1\30)e\377" \
+  "\223\31*e\377\204\30)d\377\15\27)d\377\27(d\377\27(c\377\26(c\377\30" \
+  ")d\377\34-g\377!2j\377&6m\377+:p\377/>t\3772@v\3774Bw\3776Dx\377\205" \
+  "8Fy\377\2""8Fx\3777Fx\377\2037Fy\377\2026Fy\377\2127Fy\377\2""7Ey\377" \
+  "6Ey\377\2027Dy\377\2026Ey\377\2035Ey\377\1""6Ex\377\2026Ey\377\2026E" \
+  "x\377\2026Ew\377\1""6Dx\377\2026Ex\377\2026Dx\377\6""6Cw\3775Dx\3776" \
+  "Ey\377-<r\377\37""0i\377\31*e\377\202\30)d\377\231\31*e\377\5\30)d\377" \
+  "\37/h\377/>s\3773Bv\3772Bv\377\2022Av\377\1""2@v\377\2022Av\377\4""2" \
+  "Au\3772Av\3772Au\3771@t\377\2021@u\377\1""0\77u\377\2041@u\377\5""1\77" \
+  "t\3772Av\377&6n\377\31*e\377\30)d\377\230\31*e\377\13\30)d\377\"3k\377" \
+  "-=r\377,<r\377-=q\377-<r\377-;r\377,<r\377-<r\377,<r\377+<r\377\202," \
+  "<r\377\4+;q\377,<r\377!1j\377\30)d\377\230\31*e\377\4\30)d\377!1j\377" \
+  "(8o\377'7n\377\202(8o\377\5'7o\377&6o\377'7n\377&6o\377%5l\377\270\31" \
+  "*e\377\2036Ex\377\2026Ey\377\2""6Ex\3776Ey\377\2025Ey\377\2026Ey\377" \
+  "\2027Dy\377\2037Ey\377\2037Fy\377\1""7Ey\377\2077Fy\377\2036Fy\377\204" \
+  "7Fy\377\2""8Fx\3778Ex\377\2038Fy\377\2029Gz\377\11""8Gy\3773Bw\377/>" \
+  "s\377+;q\377(8o\377%4m\377!2k\377\36/h\377\34-g\377\205\33,f\377\204" \
+  "\32+f\377\1\32+e\377\203\32+f\377\1\33+f\377\204\33,f\377\11\34,g\377" \
+  "\35-g\377\37""0i\377#3l\377'6n\377)9p\377-<r\3771@t\3776Ex\377\2029G" \
+  "z\377\2028Fz\377\4""8Fy\3778Fx\3778Ex\3778Fx\377\2047Fy\377\2046Fy\377" \
+  "\2077Fy\377\1""7Ey\377\2027Fy\377\2037Ey\377\2027Dy\377\2026Ey\377\202" \
+  "5Ey\377\2046Ey\377\2036Ex\377\2026Ew\377\2036Ex\377\3""5Dx\3776Dx\377" \
+  "6Cw\377\2025Dx\377\3""3Bw\377.=s\377\35-g\377\202\30)d\377\232\31*e\377" \
+  "\10\30)d\377\31*e\377%5m\3773Bv\3771Bv\3771Av\3772Av\3772@v\377\2052" \
+  "Av\377\2021@t\377\2""1@u\3770\77u\377\2041@u\377\5""0\77t\3771@u\377" \
+  "0\77t\377\"2k\377\30)d\377\230\31*e\377\202\30)d\377\4\"2k\377.>s\377" \
+  ",<r\377-=r\377\202-<r\377\4,<r\377-<r\377,<r\377+<r\377\204,<r\377\3" \
+  "$4l\377\30)d\377\30)e\377\226\31*e\377\202\30)d\377\4\35.h\377)8o\377" \
+  "'7n\377(8o\377\202'7o\377\1&6o\377\202'7o\377\2&6m\377\27(d\377\270\31" \
+  "*e\377\2036Ew\377\2026Ex\377\2026Ey\377\2""6Ex\3776Ey\377\2025Ey\377" \
+  "\2026Ey\377\2037Dy\377\1""6Ey\377\2027Ey\377\2027Fy\377\1""7Ey\377\210" \
+  "7Fy\377\2046Fy\377\2057Fy\377\2028Fx\377\2048Fy\377\2""8Fz\3779Fz\377" \
+  "\2029Gz\377\11""8Gz\3777Ey\3776Dx\3776Dw\3775Cw\3774Cv\3774Bv\3773Bv" \
+  "\3773Av\377\2032Av\377\1""3Bv\377\2024Bv\377\5""5Cw\3775Dw\3776Dw\377" \
+  "6Ex\3778Fy\377\2039Gz\377\1""8Fz\377\2048Fy\377\2038Fx\377\1""7Fx\377" \
+  "\2047Fy\377\2046Fy\377\2107Fy\377\1""7Ey\377\2037Fy\377\2037Ey\377\2" \
+  "7Dy\3776Dy\377\2026Ey\377\2025Ey\377\2056Ey\377\1""6Ex\377\2036Ew\377" \
+  "\2""6Dx\3776Ex\377\2036Dx\377\7""6Cx\3775Cw\3776Ex\3773Bv\377'7n\377" \
+  "\35.h\377\27(d\377\202\30)d\377\231\31*e\377\11\30)d\377\27(c\377\40" \
+  "1j\377.=s\3773Bv\3772Bu\3771Bu\3772Av\3772@v\377\2022Av\377\1""2Au\377" \
+  "\2022Av\377\4""1@u\3772At\3771@u\3770\77u\377\2041@u\377\5""0\77u\377" \
+  "1@u\377.=r\377\36.h\377\30)d\377\231\31*e\377\13\30)d\377$4l\377-=s\377" \
+  ",<r\377-=q\377-<r\377-;r\377,<r\377-<r\377,<r\377+<r\377\202,<r\377\5" \
+  "+;q\377,<r\377\"3k\377\30)d\377\30)e\377\227\31*e\377\13\30)d\377\33" \
+  ",f\377'7n\377'7o\377(8o\377'7o\377(8o\377'7o\377&6o\377&6n\377%5m\377" \
+  "\272\31*e\377\1""6Dx\377\2026Ex\377\2""6Dx\3776Ex\377\2026Ew\377\2""6" \
+  "Ey\3776Ex\377\2026Ey\377\2""6Ex\3776Ey\377\2035Ey\377\3""7Ey\3776Ey\377" \
+  "6Dy\377\2027Dy\377\2""7Fy\3776Ey\377\2027Ey\377\2027Fy\377\1""7Ey\377" \
+  "\2137Fy\377\2066Fy\377\2147Fy\377\2057Fx\377\2147Fy\377\2066Fy\377\217" \
+  "7Fy\377\2027Ey\377\1""6Fy\377\2037Dy\377\2036Ey\377\2025Ey\377\2046E" \
+  "y\377\2036Ex\377\2026Ew\377\1""6Dx\377\2026Ex\377\4""6Dx\3775Ex\3776" \
+  "Dx\3776Cx\377\2025Dx\377\2024Cw\377\3%6m\377\31*e\377\30)d\377\233\31" \
+  "*e\377\202\30)d\377\7\31*e\377)9p\3773Bv\3772Bu\3772Bv\3772Av\3772@v" \
+  "\377\2022Av\377\1""2Au\377\2022Av\377\3""1@u\3772At\3772Au\377\2051@" \
+  "u\377\6""0\77t\3771@u\3770\77t\377+:q\377\31*e\377\31*d\377\230\31*e" \
+  "\377\202\30)d\377\4$5l\377-=s\377,<r\377-=r\377\202-<r\377\2,<r\377-" \
+  "<r\377\206,<r\377\2&5m\377\30)d\377\230\31*e\377\3\30)d\377\31*e\377" \
+  "&6m\377\202(8o\377\10'7o\377(8o\377'7o\377'7n\377&6o\377'7o\377\40""1" \
+  "j\377\30)d\377\271\31*e\377\3""6Dx\3775Dx\3776Dx\377\2026Ex\377\2""6" \
+  "Dx\3776Ex\377\2026Ew\377\2026Ex\377\2056Ey\377\2035Ey\377\2026Ey\377" \
+  "\1""6Dy\377\2027Dy\377\2037Ey\377\2227Fy\377\2356Fy\377\2157Fy\377\1" \
+  "7Ey\377\2047Fy\377\2027Ey\377\2""6Ey\3777Ey\377\2027Dy\377\2036Ey\377" \
+  "\2035Ey\377\2046Ey\377\2036Ex\377\2026Ew\377\2036Ex\377\11""6Dx\3775" \
+  "Dx\3776Dx\3776Cw\3775Dx\3776Dx\3773Bv\377+:q\377\"2k\377\203\30)d\377" \
+  "\233\31*e\377\202\30)d\377\7!1j\377/>s\3773Bv\3771Bu\3771Av\3772Av\377" \
+  "2@v\377\2042Av\377\2022Au\377\2""2At\3771@u\377\2020\77u\377\2061@u\377" \
+  "\3%5m\377\31*e\377\30)d\377\231\31*e\377\13\30*d\377%6m\377-=s\377,<" \
+  "r\377-=q\377-<r\377-;r\377,<r\377-<r\377,<r\377+<r\377\202,<r\377\3+" \
+  ";q\377,<r\377$4l\377\202\30)d\377\227\31*e\377\5\30)d\377\31*e\377#4" \
+  "l\377(8o\377'7n\377\202(8o\377\1'7o\377\202&6o\377\3'7o\377\40""1i\377" \
+  "\27(d\377\272\31*e\377\1""5Cx\377\2026Cx\377\2""5Dx\3776Dx\377\2026E" \
+  "x\377\2""6Dx\3776Ex\377\2026Ew\377\2036Ex\377\2026Ey\377\2""6Ex\3776" \
+  "Ey\377\2035Ey\377\2036Ey\377\1""6Dy\377\2027Dy\377\2""7Ey\3776Ey\377" \
+  "\2037Ey\377\2047Fy\377\1""7Ey\377\2567Fy\377\1""7Ey\377\2047Fy\377\204" \
+  "7Ey\377\2037Dy\377\1""6Dy\377\2026Ey\377\2035Ey\377\2""6Ey\3776Ex\377" \
+  "\2026Ey\377\2036Ex\377\2036Ew\377\2036Ex\377\2026Dx\377\2""5Cx\3776C" \
+  "w\377\2025Dx\377\4""3Aw\377$4l\377\32+e\377\31*e\377\202\30)d\377\234" \
+  "\31*e\377\11\30)d\377\31*e\377+;q\3772Au\3772Bv\3771Bu\3772@v\3772Av" \
+  "\3772@v\377\2022Av\377\3""2Au\3772Av\3772Au\377\2021@t\377\2""1@u\377" \
+  "0\77u\377\2041@u\377\6""0\77t\3771@t\3771@u\377\40""0i\377\31*e\377\30" \
+  ")d\377\231\31*e\377\7\27(d\377'7n\377-=s\377,<r\377-=q\377-<r\377-;r" \
+  "\377\202-<r\377\2,<r\377+<r\377\202,<r\377\5+;q\377,<r\377&6m\377\31" \
+  "*e\377\30)d\377\231\31*e\377\13\"2k\377(8o\377'7n\377(8o\377'7o\377(" \
+  "8o\377&6o\377'7o\377'7n\377\40""0i\377\30)d\377\273\31*e\377\2.>s\377" \
+  "4Cw\377\2035Dx\377\2026Cx\377\2""5Dx\3776Dx\377\2026Ex\377\2""6Dx\377" \
+  "6Ex\377\2036Ew\377\2036Ex\377\2036Ey\377\2""6Ex\3776Ey\377\2045Ey\377" \
+  "\2036Ey\377\1""6Dy\377\2037Dy\377\2""7Ey\3776Ey\377\2047Ey\377\2467F" \
+  "y\377\2037Ey\377\2""6Ey\3777Ey\377\2047Dy\377\1""6Dy\377\2036Ey\377\204" \
+  "5Ey\377\2""6Ey\3776Ex\377\2036Ey\377\2026Ex\377\2036Ew\377\2046Ex\377" \
+  "\2036Dx\377\2026Cx\377\2026Dx\377\4""1Av\377,<r\377!1j\377\27(d\377\202" \
+  "\30)d\377\234\31*e\377\202\30)d\377\5\32+f\377$4l\3772Av\3772Bv\3771" \
+  "Bu\377\2052Av\377\7""2Au\3772Av\3772Au\3771@u\3771@t\3771@u\3770\77u" \
+  "\377\2041@u\377\6""0\77u\3771@t\3771@u\377+;q\377\34-g\377\30)d\377\231" \
+  "\31*e\377\5\30)d\377\31*e\377'7n\377-=s\377,=r\377\202-<r\377\5-;r\377" \
+  ",<r\377-<r\377,<r\377+<r\377\204,<r\377\1&7n\377\202\30)d\377\230\31" \
+  "*e\377\5\30)d\377\37/i\377(8o\377'7o\377(8o\377\203'7o\377\5'7n\377&" \
+  "6o\377&6n\377\31*e\377\30)d\377\274\31*e\377\4\34-g\377#4l\3771@u\377" \
+  "6Ex\377\2025Dx\377\2026Cx\377\2""5Dx\3776Dx\377\2036Ex\377\2""6Dx\377" \
+  "6Ex\377\2036Ew\377\2036Ex\377\2056Ey\377\2045Ey\377\2046Ey\377\1""6D" \
+  "y\377\2047Dy\377\2""7Ey\3776Ey\377\2067Ey\377\2277Fy\377\2117Ey\377\203" \
+  "7Dy\377\2026Dy\377\2046Ey\377\2035Ey\377\2066Ey\377\2036Ex\377\2026E" \
+  "w\377\2056Ex\377\2036Dx\377\1""6Cx\377\2025Dx\377\4""6Ex\377+;q\377\37" \
+  "0i\377\33,f\377\203\30)d\377\235\31*e\377\202\30)d\377\2\"3k\3770\77" \
+  "t\377\2022Bv\377\2""1Bu\3772Av\377\2022@v\377\2022Av\377\2""2Au\3772" \
+  "Av\377\2022Au\377\3""2At\3771@u\3770\77u\377\2061@u\377\4""2@v\377$4" \
+  "l\377\31*e\377\30)d\377\231\31*e\377\202\30)d\377\4(8o\377-=s\377,=r" \
+  "\377-<q\377\202-;r\377\202-<r\377\2,<r\377+<r\377\202,<r\377\5+;q\377" \
+  ",<r\377&6n\377\31*e\377\30)d\377\230\31*e\377\2\30)d\377\37/h\377\203" \
+  "(8o\377\3'7o\377(8o\377'7o\377\202&6o\377\3(8o\377\32+f\377\30)d\377" \
+  "\276\31*e\377\11\30)d\377\27(c\377\35.h\377)9o\3771@u\3773Cw\3775Dx\377" \
+  "6Dx\3775Dx\377\2036Cx\377\2""5Dx\3776Dx\377\2036Ex\377\2""6Dx\3776Ex" \
+  "\377\2036Ew\377\2046Ex\377\2046Ey\377\1""6Ex\377\2026Ey\377\2065Ey\377" \
+  "\2066Ey\377\1""6Dy\377\2277Dy\377\1""6Dy\377\2076Ey\377\2055Ey\377\207" \
+  "6Ey\377\2046Ex\377\2036Ew\377\2""6Ex\3776Dx\377\2036Ex\377\2036Dx\377" \
+  "\2026Cx\377\11""5Dx\3776Dx\3775Dx\3772Bv\377/>t\377$4l\377\30)d\377\27" \
+  "(d\377\30)d\377\237\31*e\377\10\30)d\377\31*e\377\34-g\377,;r\3773Bv" \
+  "\3771Au\3771Av\3772Av\377\2022@v\377\2022Av\377\7""2Au\3772Av\3771@u" \
+  "\3772Au\3772At\3771@u\3770\77u\377\2041@u\377\6""0\77t\3771@t\3771@u" \
+  "\377.=r\377\36.h\377\30)d\377\232\31*e\377\14\30)d\377\33+f\377*:p\377" \
+  "-=s\377,=r\377-<r\377-;r\377-<r\377,<r\377-<r\377,<r\377+<r\377\204," \
+  "<r\377\3'7o\377\31*e\377\30)d\377\230\31*e\377\2\30)d\377\34,g\377\202" \
+  "'7n\377\202(8o\377\6'7o\377&6o\377'7o\377&6o\377&6n\377\33,f\377\302" \
+  "\31*e\377\202\30)d\377\6\32*e\377\36/h\377%5m\377.=s\3776Dx\3776Ex\377" \
+  "\2025Dx\377\2026Cx\377\1""5Dx\377\2026Dx\377\2036Ex\377\2""6Dx\3776E" \
+  "x\377\2046Ew\377\2046Ex\377\2116Ey\377\2075Ey\377\2276Ey\377\2105Ey\377" \
+  "\2036Ey\377\1""6Ex\377\2046Ey\377\2046Ex\377\2046Ew\377\2""6Ex\3776D" \
+  "x\377\2036Ex\377\2026Dx\377\1""5Dx\377\2026Cx\377\7""6Dx\3775Dx\3776" \
+  "Ey\3773Cw\377*:p\377\"2k\377\34-g\377\203\30)d\377\237\31*e\377\7\30" \
+  ")d\377\27(d\377\32+f\377)9p\3772Au\3772Bv\3771Bu\377\2022Av\377\1""2" \
+  "@v\377\2032Av\377\7""2Au\3772Av\3772Au\3772At\3771@t\3771@u\3770\77u" \
+  "\377\2061@u\377\4""2@u\377&7n\377\32+f\377\30)d\377\232\31*e\377\7\30" \
+  ")d\377\34-g\377+:q\377-=r\377,=q\377-<q\377-;r\377\203-<r\377\2,<r\377" \
+  "+<r\377\202,<r\377\5+;q\377,<r\377$4m\377\31*e\377\30)d\377\230\31*e" \
+  "\377\3\30)d\377\32+e\377'7n\377\204(8o\377\6'7o\377&6o\377&6n\377'7o" \
+  "\377\36/h\377\30)d\377\306\31*e\377\202\30)d\377\11\31*e\377\"3l\377" \
+  ".>s\3773Bw\3774Cw\3774Dx\3776Dx\3775Dx\3775Cw\377\2026Cx\377\2""6Dx\377" \
+  "5Dx\377\2026Dx\377\2046Ex\377\1""6Dx\377\2026Ex\377\2046Ew\377\2066E" \
+  "x\377\2106Ey\377\1""6Ex\377\2336Ey\377\2066Ex\377\2046Ew\377\2026Ex\377" \
+  "\1""6Dx\377\2036Ex\377\2026Dx\377\4""5Dx\3776Dx\3776Cx\3776Cw\377\202" \
+  "5Dx\377\1""6Dx\377\2024Cw\377\4""2Bv\377)9p\377\36.i\377\27(d\377\202" \
+  "\30)d\377\241\31*e\377\7\30)d\377\31*e\377\32+e\377$5l\3773Bv\3772Bv" \
+  "\3771Bu\377\2062Av\377\2022Au\377\5""1@v\3772At\3771@t\3771@u\3770\77" \
+  "u\377\2071@u\377\3""0\77t\377!2k\377\30)d\377\232\31*e\377\13\31*d\377" \
+  "\30)d\377\36/h\377-=r\377,<r\377-=q\377-<r\377-;r\377,<r\377-<r\377," \
+  "<r\377\202+<r\377\204,<r\377\2&6n\377\30)d\377\231\31*e\377\2\30)d\377" \
+  "\31*e\377\202'7n\377\11(8o\377'7o\377(8o\377'7o\377&6o\377'7n\377'7o" \
+  "\377\"2k\377\30)d\377\311\31*e\377\202\30)d\377\12\27(c\377\32+f\377" \
+  "\40""1j\377&6n\377-<r\3773Bv\3776Ey\3776Dx\3775Dx\3775Cw\377\2036Cx\377" \
+  "\1""5Dx\377\2036Dx\377\2036Ex\377\1""6Dx\377\2036Ex\377\2066Ew\377\210" \
+  "6Ex\377\2236Ey\377\2116Ex\377\2066Ew\377\2026Ex\377\1""6Dx\377\2046E" \
+  "x\377\2046Dx\377\4""6Cx\3776Cw\3775Dx\3776Dx\377\2026Ex\377\7""0@u\377" \
+  "*:p\377$4l\377\36.h\377\30)d\377\27(d\377\30)d\377\242\31*e\377\202\30" \
+  ")d\377\7\32+e\377&6n\377/\77t\3773Cv\3771Bv\3771Av\3772Av\377\2022@v" \
+  "\377\2022Av\377\1""2Au\377\2022Av\377\2""1@u\3772At\377\2021@u\377\1" \
+  "0\77u\377\2041@u\377\5""0\77t\3770\77u\3771@u\377)9p\377\34-g\377\202" \
+  "\30)d\377\231\31*e\377\202\30)d\377\1!1k\377\202,<r\377\3-=q\377-<r\377" \
+  "-;r\377\202-<r\377\2,<r\377+<r\377\203,<r\377\3+;q\377,<r\377$3l\377" \
+  "\202\30)d\377\230\31*e\377\3\31*d\377\30)d\377$4l\377\204(8o\377\5'7" \
+  "o\377&6o\377'7n\377&6o\377%5m\377\316\31*e\377\202\30)d\377\203\31*e" \
+  "\377\3\34,g\377&6m\3770\77t\377\2035Dx\377\1""4Dx\377\2036Cx\377\4""6" \
+  "Dx\3775Dx\3776Dx\3776Cx\377\2056Ex\377\1""6Dx\377\2036Ex\377\2116Ew\377" \
+  "\2246Ex\377\2106Ew\377\2116Ex\377\1""6Cx\377\2026Dx\377\1""5Dx\377\203" \
+  "6Cx\377\2035Dx\377\3""3Cw\377+;q\377\"2k\377\203\31*e\377\203\30)d\377" \
+  "\243\31*e\377\12\30)d\377\31*e\377$5l\3772Av\3772Bu\3772Bv\3771Bu\377" \
+  "1Av\3772Av\3772@v\377\2032Av\377\6""2Au\3772Av\3772Au\3771@u\3772At\377" \
+  "1@u\377\2020\77u\377\2061@u\377\2""1@t\377!1k\377\202\30)d\377\233\31" \
+  "*e\377\10\30*d\377%5m\377-=s\377-=r\377-=q\377-<r\377-;r\377-<r\377\202" \
+  ",<r\377\1+<r\377\203,<r\377\5+;q\377,<r\377#4l\377\30)e\377\30)d\377" \
+  "\231\31*e\377\2\30)d\377#4l\377\203(8o\377\202'7o\377\4&6o\377'7n\377" \
+  "&6o\377'7n\377\202\30)d\377\322\31*e\377\202\30)d\377\11\27(c\377\31" \
+  "*e\377\37""0i\377&6n\377+;q\377.>s\3772Av\3775Dx\3776Ex\377\2026Dx\377" \
+  "\2""5Dx\3775Cw\377\2046Cx\377\1""5Dx\377\2056Dx\377\2416Ex\377\2056D" \
+  "x\377\2""5Dx\3776Dx\377\2036Cx\377\2""6Cw\3775Dx\377\2026Dx\377\7""6" \
+  "Ex\3774Cw\3770@u\377-=s\377)9p\377#3k\377\34-g\377\202\27(d\377\202\30" \
+  ")d\377\245\31*e\377\202\30)d\377\7\32+f\377#3l\377/\77t\3773Bv\3771B" \
+  "u\3771Av\3772Av\377\2022@v\377\2032Av\377\6""2Au\3772Av\3772Au\3772A" \
+  "t\3771@t\3771@u\377\2020\77u\377\2071@u\377\3)9o\377\33,f\377\30)d\377" \
+  "\233\31*e\377\6\30)d\377\31*e\377%5m\377-=s\377,<r\377-<q\377\202-;r" \
+  "\377\202-<r\377\2,<r\377+<r\377\202,<r\377\4,;r\377+<q\377,;r\377#3k" \
+  "\377\202\30)d\377\231\31*e\377\4\30)d\377!1j\377(8o\377'7n\377\202(8" \
+  "o\377\2'7o\377&6o\377\202'7o\377\2%5m\377\30)d\377\327\31*e\377\203\30" \
+  ")d\377\12\31*e\377\32*e\377\32+f\377\33,f\377\40""0i\377&6n\377.=s\377" \
+  "5Cw\3776Ex\3776Dx\377\2035Dx\377\1""6Cw\377\2046Cx\377\2""6Dx\3775Dx" \
+  "\377\2106Dx\377\2166Ex\377\2136Dx\377\2046Cx\377\1""6Cw\377\2035Dx\377" \
+  "\11""6Dx\3776Ey\3772Av\377+;q\377$4l\377\35.h\377\33,f\377\32+f\377\31" \
+  "*e\377\204\30)d\377\247\31*e\377\4\30)d\377\31*e\377&6m\3771@u\377\202" \
+  "2Bv\377\1""1Bu\377\2022Av\377\1""2@v\377\2062Av\377\1""1@u\377\2022A" \
+  "u\377\2020\77u\377\2051@u\377\6""0\77t\3771@u\377/>t\377\36/h\377\31" \
+  "*e\377\30)d\377\233\31*e\377\7\30)e\377\32+f\377*:p\377-=r\377-=q\377" \
+  "-<q\377-;r\377\202-<r\377\202,<r\377\1+<r\377\202,<r\377\6,;r\377+<q" \
+  "\377,;r\377!2j\377\31*d\377\30)d\377\231\31*e\377\2\30)d\377\40""0i\377" \
+  "\204(8o\377\7'7o\377&6o\377'7o\377&6n\377'7o\377\33,f\377\30)d\377\335" \
+  "\31*e\377\203\30)d\377\15\27(d\377\26(c\377\33,f\377\40""1j\377%4m\377" \
+  ")9p\377-<r\377/>t\3770@u\3772Av\3773Bw\3775Dw\3775Dx\377\2066Dx\377\203" \
+  "5Dx\377\2025Cx\377\2136Cx\377\2""5Cw\3775Cx\377\2035Dx\377\2066Dx\377" \
+  "\15""5Dx\3774Cw\3772Bv\3771@u\3770\77t\377.>t\377,;q\377'7n\377#3l\377" \
+  "\36/h\377\31)d\377\27(c\377\27(d\377\202\30)d\377\252\31*e\377\1\31*" \
+  "d\377\202\30)d\377\10\34-g\377%5m\3771Au\3773Bv\3771Bu\3771Av\3772Av" \
+  "\3772@v\377\2042Av\377\2""2Au\3772Av\377\2022Au\377\1""2At\377\2021@" \
+  "u\377\1""0\77u\377\2051@u\377\6""0\77t\3771@u\3770\77t\377)8o\377\31" \
+  "*e\377\30)d\377\233\31*e\377\202\30)d\377\6\35.g\377+;q\377-=s\377-=" \
+  "q\377-<r\377-;r\377\202-<r\377\202,<r\377\1+<r\377\202,<r\377\5+;q\377" \
+  ",<r\377+:q\377!1j\377\27(d\377\232\31*e\377\10\30)d\377\37""0i\377(8" \
+  "o\377'7n\377(8o\377'7o\377(8o\377'7o\377\202&6o\377\3'7o\377\37/i\377" \
+  "\30)d\377\343\31*e\377\205\30)d\377\20\31*e\377\32+f\377\34,f\377\35" \
+  ".g\377\36/h\377\37""0i\377\"2k\377%5m\377'7o\377*9p\377-<r\377/\77t\377" \
+  "2Av\3774Dw\3775Dx\3776Ey\377\2037Ey\377\2066Ey\377\2047Ey\377\17""6E" \
+  "x\3775Dx\3773Bv\3771@u\377.>s\377,;q\377)8o\377&6n\377#4l\377!1j\377" \
+  "\37/i\377\36.h\377\34-g\377\33,f\377\32*e\377\206\30)d\377\255\31*e\377" \
+  "\5\30)d\377\27(d\377\36/h\377+;q\3771@u\377\2022Bv\377\2""1Bv\3772Av" \
+  "\377\2022@v\377\2032Av\377\1""2Au\377\2022Av\377\4""1@u\3772Au\3771@" \
+  "t\3771@u\377\2020\77u\377\2061@u\377\3""2@u\377-=s\377\36/h\377\202\30" \
+  ")d\377\234\31*e\377\5\30)d\377\"2k\377,<r\377-=r\377,=q\377\203-<r\377" \
+  "\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\5+;q\377,<r\377+;q\377\35." \
+  "h\377\30)d\377\232\31*e\377\2\30)d\377\36/h\377\202'7n\377\203(8o\377" \
+  "\6'7o\377&6o\377'7n\377'7o\377\40""1j\377\30)d\377\356\31*e\377\206\30" \
+  ")d\377\203\27(d\377\203\27(c\377\14\30)d\377\31*e\377\33+e\377\33,f\377" \
+  "\34-g\377\35.g\377\33,g\377\33,f\377\31+e\377\31*e\377\30)d\377\27(c" \
+  "\377\204\27(d\377\1\27)d\377\205\30)d\377\264\31*e\377\203\30)d\377\6" \
+  "\31*e\377\35.h\377,<r\3773Bv\3772Bv\3771Bu\377\2022Av\377\1""2@v\377" \
+  "\2062Av\377\6""2Au\3771@u\3772At\3772Au\3771@u\3770\77u\377\2101@u\377" \
+  "\4/>s\377$4l\377\27(d\377\30)d\377\234\31*e\377\4\30)d\377\31*e\377%" \
+  "5l\377-=s\377\202-=q\377\2-<r\377-;r\377\203-<r\377\1+<r\377\203,<r\377" \
+  "\5+;q\377,<r\377*:p\377\33,f\377\30)d\377\232\31*e\377\10\30)d\377\35" \
+  ".h\377)8o\377'7n\377(8o\377'7o\377(8o\377'7o\377\202&6o\377\3'7o\377" \
+  "#4k\377\30)d\377\372\31*e\377\1\30)e\377\213\30)d\377\276\31*e\377\12" \
+  "\30)d\377\27(d\377\34-f\377&6m\377.=r\3773Bv\3772Bv\3771Bv\3771Av\377" \
+  "2Av\377\2022@v\377\2032Av\377\2""2Au\3772Av\377\2022Au\377\2022At\377" \
+  "\2021@u\377\1""0\77u\377\2051@u\377\1""0\77t\377\2021@u\377\3%5m\377" \
+  "\34,g\377\30)d\377\235\31*e\377\12\30)d\377\33,f\377)9o\377-=s\377,<" \
+  "r\377-=q\377-<r\377-;r\377,<r\377-<r\377\205,<r\377\5+<q\377,<r\377(" \
+  "8o\377\32+f\377\30)d\377\232\31*e\377\15\30)d\377\35.h\377(7n\377'7n" \
+  "\377(8o\377'7o\377(8o\377'7o\377&6o\377'7n\377'7o\377!1j\377\30)d\377" \
+  "\377\31*e\377\302\31*e\377\202\30)d\377\202\31*e\377\7\35.h\377+;q\377" \
+  "3Bv\3772Bv\3771Au\3771Av\3772Av\377\2022@v\377\2032Av\377\1""2Au\377" \
+  "\2032Av\377\2""1@u\3772At\377\2021@u\377\2020\77u\377\2041@u\377\2""0" \
+  "\77u\3770\77t\377\2021@u\377\3-<r\377\33,f\377\30)d\377\235\31*e\377" \
+  "\202\30)d\377\1\36.g\377\202-=r\377\2-<q\377-=r\377\202-<r\377\4,<r\377" \
+  "-<r\377,<r\377+<r\377\202,<r\377\5+;q\377,<r\377,;r\377&6n\377\30)d\377" \
+  "\232\31*e\377\202\30)d\377\7\34-g\377(8o\377(8n\377(8o\377'7o\377(8o" \
+  "\377'7o\377\202&6o\377\3'7o\377#3k\377\30)d\377\377\31*e\377\301\31*" \
+  "e\377\202\30)d\377\11\27(d\377\35.g\377%5m\377.=s\3773Bv\3772Bv\3771" \
+  "Bu\3771Bv\3772Av\377\2022@v\377\2042Av\377\4""2Au\3772Av\3772Au\3771" \
+  "@u\377\2022At\377\2021@u\377\1""0\77u\377\2101@u\377\4,;r\377!1j\377" \
+  "\27)d\377\30)d\377\235\31*e\377\202\30)d\377\5\"3k\377-=s\377-=r\377" \
+  ",=q\377-<r\377\202-;r\377\4,<r\377-<r\377,<r\377+<r\377\202,<r\377\1" \
+  "+;q\377\202,<r\377\2#3l\377\30)d\377\233\31*e\377\4\30)d\377\34-g\377" \
+  "'7o\377(8n\377\202'7o\377\3(8o\377'7o\377&6o\377\202'7o\377\2!2j\377" \
+  "\27(d\377\377\31*e\377\300\31*e\377\203\30)d\377\3!1j\377-=s\3772Au\377" \
+  "\2022Bv\377\2""1Bv\3771Av\377\2022Av\377\2022@v\377\2062Av\377\5""1@" \
+  "u\3772Au\3772At\3770\77u\3771@u\377\2020\77u\377\2051@u\377\1""0\77t" \
+  "\377\2021@u\377\2\"3k\377\31*e\377\202\30)d\377\235\31*e\377\15\30)d" \
+  "\377\32*e\377)9o\377-=s\377-=r\377-=q\377-<r\377-;r\377-<r\377,<r\377" \
+  "-<r\377,<r\377+<r\377\205,<r\377\1\37/i\377\202\30)d\377\232\31*e\377" \
+  "\5\30)d\377\32+f\377'7n\377(8o\377'7o\377\202(8o\377\6'7o\377&6o\377" \
+  "'7o\377&6n\377\"2k\377\30)d\377\311\31*e\377\1\32+f\377\202\30)d\377" \
+  "\1\30)e\377\357\31*e\377\203\30)d\377\10\34,g\377\40""1i\377)8o\3772" \
+  "Av\3774Cv\3772Bv\3771Bu\3771Av\377\2022Av\377\1""2@v\377\2042Av\377\2" \
+  "2Au\3772Av\377\2032Au\377\1""2At\377\2021@u\377\1""0\77u\377\2111@u\377" \
+  "\4.=s\377&6m\377\32+e\377\30)d\377\236\31*e\377\7\30)d\377\30)e\377\37" \
+  "/h\377+;q\377-=r\377,=q\377-<q\377\202-;r\377\3,<r\377-<r\377,<r\377" \
+  "\202+<r\377\204,<r\377\3*:q\377\37/i\377\30)d\377\233\31*e\377\15\30" \
+  ")d\377\34,g\377(8n\377(8o\377'7n\377'7o\377(8o\377'7o\377&6o\377&6n\377" \
+  "'7o\377$4l\377\27(c\377\312\31*e\377\4""1@u\377(8o\377\35.g\377\27(c" \
+  "\377\202\30)d\377\353\31*e\377\203\30)d\377\4!2j\377,;q\3770\77t\377" \
+  "1Au\377\2022Bv\377\1""1Bu\377\2022Av\377\2032@v\377\2042Av\377\7""2A" \
+  "u\3772Av\3772Au\3771@u\3772At\3771@t\3771@u\377\2020\77u\377\2061@u\377" \
+  "\5""0\77t\3771@u\3770@t\377#4l\377\32+f\377\202\30)d\377\236\31*e\377" \
+  "\202\30)d\377\6&5m\377,<r\377-=r\377,=q\377-<r\377-;r\377\203-<r\377" \
+  "\2,<r\377+<r\377\203,<r\377\4+;q\377,<r\377'8n\377\32+f\377\202\30)d" \
+  "\377\232\31*e\377\5\30)d\377\33,f\377'7n\377(8o\377'7n\377\202(8o\377" \
+  "\2'7o\377&6o\377\202'7o\377\3#3l\377\31*e\377\30)d\377\312\31*e\377\10" \
+  "1Bv\3772Bv\3774Cv\377/>t\377%5m\377\35.g\377\33+f\377\31*e\377\203\30" \
+  ")d\377\341\31*e\377\203\30)d\377\10\31*e\377\33,f\377\40""0i\377(9o\377" \
+  "2Av\3773Bv\3772Bv\3771Bu\377\2022Av\377\2022@v\377\2052Av\377\1""2Au" \
+  "\377\2022Av\377\4""2Au\3771@u\3772At\3771@t\377\2021@u\377\1""0\77u\377" \
+  "\2061@u\377\1""0\77t\377\2021@u\377\4/>t\377(8o\377\32+e\377\30)d\377" \
+  "\237\31*e\377\7\30)e\377\30)d\377\34,f\377*:q\377-=s\377-<q\377-<r\377" \
+  "\202-;r\377\202-<r\377\202,<r\377\1+<r\377\202,<r\377\4,;r\377,<r\377" \
+  ",;q\377%6n\377\235\31*e\377\2\30)d\377\35-h\377\203(8o\377\11'7o\377" \
+  "(8o\377'7o\377&6o\377&6n\377'7o\377%5n\377\33,f\377\30)d\377\313\31*" \
+  "e\377\2022Av\377\1""1Bv\377\2032Bv\377\5.\77s\377+;q\377$5m\377\35-g" \
+  "\377\27(d\377\202\30)d\377\334\31*e\377\202\30)d\377\7\27(d\377\30)d" \
+  "\377\40""0j\377(8n\377-<r\3771@t\3773Bv\377\2022Bv\377\1""1Bu\377\202" \
+  "2Av\377\2022@v\377\2052Av\377\1""2Au\377\2022Av\377\2022Au\377\2022A" \
+  "t\377\1""1@u\377\2030\77u\377\2061@u\377\5""0\77t\3771@u\3771@t\377%" \
+  "5m\377\34-g\377\202\30)d\377\237\31*e\377\12\30)d\377\30)c\377#3k\377" \
+  ",<r\377-=r\377,=r\377-=r\377-<r\377-;r\377-<r\377\203,<r\377\1+<r\377" \
+  "\202,<r\377\6+;q\377,<r\377,;r\377\40""1i\377\30)e\377\30)d\377\233\31" \
+  "*e\377\4\30)d\377\35.h\377'7n\377(8n\377\202'7o\377\3(8o\377'7o\377&" \
+  "6o\377\202'7o\377\3%6m\377\33+f\377\30)d\377\314\31*e\377\2022Av\377" \
+  "\2022@v\377\2032Av\377\7""1Bv\3772Bv\3773Bv\3770\77t\377&6m\377\34-g" \
+  "\377\32*e\377\202\31*e\377\203\30)d\377\321\31*e\377\203\30)d\377\202" \
+  "\31*e\377\3\32+e\377\40""0i\377*:p\377\2023Bv\377\3""2Bv\3771Bu\3771" \
+  "Av\377\2022Av\377\2022@v\377\2052Av\377\1""2Au\377\2022Av\377\6""2Au" \
+  "\3771@u\3772Au\3772At\3771@t\3771@u\377\2020\77u\377\2061@u\377\3""0" \
+  "\77t\3770\77u\3771@u\377\2020\77t\377\3'6n\377\31*e\377\30)d\377\240" \
+  "\31*e\377\202\30)d\377\10\32+f\377)9o\377-=s\377,<r\377-=r\377-<r\377" \
+  "-;r\377-<r\377\202,<r\377\2-<r\377+<r\377\202,<r\377\6,;r\377+<q\377" \
+  ",<r\377*:p\377\35-g\377\30)d\377\234\31*e\377\15\30)d\377\35.h\377(8" \
+  "o\377'7n\377(8o\377'7o\377(8o\377'7o\377&6o\377&6n\377'7o\377&6n\377" \
+  "\34-g\377\316\31*e\377\2042Av\377\2032@v\377\2022Av\377\1""1Bu\377\202" \
+  "2Bv\377\10""3Bv\3770@t\377+;q\377'7o\377\"3k\377\35.h\377\30)d\377\27" \
+  "(d\377\202\30)d\377\312\31*e\377\203\30)d\377\13\27(c\377\32+f\377\37" \
+  "0i\377$4m\377)9o\377.=r\3771Au\3773Cv\3773Bv\3771Bv\3771Bu\377\2032A" \
+  "v\377\2022@v\377\2102Av\377\2""2Au\3771@u\377\2022At\377\1""1@t\377\202" \
+  "1@u\377\1""0\77u\377\2071@u\377\10""0\77t\3771@u\3772Au\377,;r\377#3" \
+  "l\377\33+f\377\27)d\377\30)d\377\240\31*e\377\202\30)d\377\10!1j\377" \
+  "+;q\377-=r\377,=q\377-<q\377-<r\377-;r\377,<r\377\202-<r\377\2,<r\377" \
+  "+<r\377\202,<r\377\6,;r\377+<q\377,;r\377'7n\377\32+f\377\30)d\377\234" \
+  "\31*e\377\11\30)d\377\36/h\377(8o\377'7n\377(8o\377'7o\377(8o\377'7o" \
+  "\377&6o\377\203'7o\377\2\35-g\377\30)d\377\316\31*e\377\2072Av\377\202" \
+  "2@v\377\2022Av\377\2""1Au\3771Bv\377\2032Bv\377\1""1Au\377\2022Au\377" \
+  "\3+;q\377\"2k\377\32+f\377\204\30)d\377\303\31*e\377\204\30)d\377\3\35" \
+  ".h\377&6n\377/>s\377\2032Au\377\2032Bv\377\4""1Bu\3771Av\3772@v\3772" \
+  "Av\377\2032@v\377\2102Av\377\1""2Au\377\2032At\377\1""1@t\377\2021@u" \
+  "\377\2020\77u\377\2111@u\377\2.=s\377\37/i\377\202\31*e\377\1\30)d\377" \
+  "\241\31*e\377\7\30)d\377\32+f\377)9o\377,<r\377-=q\377,=r\377-<r\377" \
+  "\202-;r\377\202-<r\377\202,<r\377\1+<r\377\205,<r\377\1$4l\377\202\30" \
+  ")d\377\234\31*e\377\2\30)d\377\37""0i\377\205(8o\377\7'7o\377&6o\377" \
+  "'7o\377&6n\377%6n\377\32+f\377\30)d\377\317\31*e\377\2022Au\377\2112" \
+  "Av\377\2032@v\377\2032Av\377\3""1Av\3771Bv\3772Bv\377\2023Cv\377\10""0" \
+  "@t\377,<q\377(8n\377#3k\377\40""0i\377\35.h\377\32+f\377\27(d\377\204" \
+  "\30)d\377\262\31*e\377\204\30)d\377\14\27(d\377\30)d\377\33,g\377\36" \
+  "/h\377!1j\377%5m\377)9p\377.=s\3772Av\3774Cw\3773Bv\3772Bv\377\2021B" \
+  "v\377\1""1Av\377\2022Av\377\2032@v\377\2112Av\377\2032Au\377\2022At\377" \
+  "\2021@u\377\2020\77u\377\2071@u\377\1""0\77t\377\2021@u\377\4/\77t\377" \
+  ")9p\377\37""0i\377\27(c\377\202\30)d\377\241\31*e\377\6\30)d\377\31*" \
+  "e\377!2k\377-<r\377-=r\377,=q\377\202-<r\377\1-;r\377\203-<r\377\2,<" \
+  "r\377+<r\377\205,<r\377\3*:q\377\37""0i\377\30)d\377\235\31*e\377\16" \
+  "\30)d\377\40""0i\377(8o\377'7n\377(8o\377'7o\377(8o\377'7o\377&6o\377" \
+  "&6n\377'7o\377%5n\377\33,f\377\30)d\377\320\31*e\377\2022At\377\2""1" \
+  "@u\3772Au\377\2032Av\377\1""2Au\377\2062Av\377\2032@v\377\2032Av\377" \
+  "\2021Bv\377\2042Bv\377\12""1Au\3771@u\3771@t\377/>t\377)9p\377$4l\377" \
+  "\40""0j\377\33,f\377\27(c\377\27(d\377\204\30)d\377\246\31*e\377\204" \
+  "\30)d\377\13\27)d\377\27(d\377\31*d\377\35.h\377\"2k\377&6n\377,<r\377" \
+  "0\77t\3771@t\3772Au\3771Av\377\2042Bv\377\2""1Bu\3771Av\377\2042Av\377" \
+  "\2022@v\377\2112Av\377\2022Au\377\1""1@u\377\2022At\377\1""1@t\377\202" \
+  "1@u\377\2020\77u\377\2071@u\377\10""0\77u\3771@t\3771@u\3770\77t\377" \
+  "#4l\377\33,f\377\31*e\377\30)d\377\243\31*e\377\12\30)d\377\34,g\377" \
+  "*:p\377-=s\377-=r\377,=q\377-<q\377-<r\377-;r\377-<r\377\203,<r\377\1" \
+  "+<r\377\203,<r\377\4+;q\377,<r\377&6n\377\32+e\377\202\30)d\377\233\31" \
+  "*e\377\3\31*d\377\27(d\377\"2k\377\205(8o\377\2'7o\377&6o\377\202'7o" \
+  "\377\3#3l\377\32+e\377\30)d\377\321\31*e\377\2020\77u\377\2021@u\377" \
+  "\2032At\377\2""1@u\3772Au\377\2032Av\377\1""2Au\377\2072Av\377\2032@" \
+  "v\377\2042Av\377\3""1Av\3771Bv\3771Bu\377\2022Bv\377\20""4Cv\3774Cw\377" \
+  "3Cw\3770\77t\377,<r\377(8n\377$5l\377\40""0j\377\36/h\377\35.h\377\35" \
+  "-g\377\34-g\377\33,f\377\32+f\377\31+e\377\31*e\377\227\30)d\377\17\31" \
+  "*e\377\32+e\377\32+f\377\33,f\377\34-g\377\35-g\377\36.h\377\37/i\377" \
+  "!2k\377&6m\377)9p\377.=s\3771@u\3774Cw\3774Cv\377\2023Bv\377\2""2Bv\377" \
+  "1Bu\377\2021Bv\377\2042Av\377\2032@v\377\2072Av\377\1""2Au\377\2032A" \
+  "v\377\2032Au\377\2022At\377\2021@u\377\2030\77u\377\2101@u\377\1""1@" \
+  "t\377\2021@u\377\4/>t\377+:q\377!1j\377\27)d\377\202\30)d\377\242\31" \
+  "*e\377\202\30)d\377\5\32+f\377\"2k\377-=s\377-=r\377,=q\377\202-<r\377" \
+  "\2-;r\377-<r\377\203,<r\377\1+<r\377\203,<r\377\5+;q\377,<r\377+;q\377" \
+  "#3l\377\30)d\377\235\31*e\377\11\30)d\377\31*e\377\"3l\377(8o\377'7n" \
+  "\377(8o\377'7o\377(8o\377'7o\377\202&6o\377\4'7o\377#3l\377\31*d\377" \
+  "\30)d\377\322\31*e\377\2021@u\377\2020\77u\377\2031@u\377\2022At\377" \
+  "\1""1@u\377\2022Au\377\2032Av\377\1""2Au\377\2072Av\377\2052@v\377\204" \
+  "2Av\377\2021Bv\377\2072Bv\377\23""1Au\3770@u\3770@t\3770\77t\377/>s\377" \
+  ".>s\377-=r\377,<r\377*:q\377*9p\377)8o\377(8o\377'7n\377'6n\377%6m\377" \
+  "%4m\377$4l\377$3l\377\"3l\377\202$4l\377\20%5m\377&6m\377'7n\377(7o\377" \
+  "(8o\377)9o\377*9p\377+;q\377-<r\377.=r\377.>s\377/>s\3770\77t\3771@t" \
+  "\3771@u\3771Au\377\2062Bv\377\2031Bv\377\1""1Av\377\2042Av\377\2042@" \
+  "v\377\2072Av\377\1""2Au\377\2032Av\377\2022Au\377\1""1@u\377\2022At\377" \
+  "\1""1@t\377\2021@u\377\2020\77u\377\2111@u\377\6""0\77t\3771@u\3772@" \
+  "u\377.=s\377#3k\377\34,g\377\203\30)d\377\243\31*e\377\202\30)d\377\6" \
+  "\37""0i\377*:q\377-=s\377-=r\377-=q\377-<r\377\202-;r\377\203-<r\377" \
+  "\2,<r\377+<r\377\202,<r\377\5,;r\377+<q\377,<r\377(9p\377\34-g\377\202" \
+  "\30)d\377\234\31*e\377\5\30)d\377\31*e\377%5l\377(8o\377'7n\377\203(" \
+  "8o\377\5'7o\377&6o\377'7n\377'7o\377!1j\377\202\30)d\377\323\31*e\377" \
+  "\2071@u\377\2020\77u\377\2021@u\377\1""1@t\377\2022At\377\2""2Au\377" \
+  "1@u\377\2022Au\377\2032Av\377\1""2Au\377\2122Av\377\2052@v\377\2062A" \
+  "v\377\1""1Av\377\2041Bv\377\1""1Bu\377\2112Bv\377\2043Bv\377\2102Bv\377" \
+  "\1""1Bu\377\2041Bv\377\1""1Av\377\2062Av\377\2052@v\377\2122Av\377\1" \
+  "2Au\377\2032Av\377\2022Au\377\2""1@u\3772Au\377\2022At\377\2031@u\377" \
+  "\2030\77u\377\2111@u\377\1""0\77t\377\2021@u\377\4""0\77t\377/>t\377" \
+  "+:q\377\40""0i\377\202\30)d\377\245\31*e\377\202\30)d\377\6\33,f\377" \
+  "&6n\377.>s\377-=r\377-<q\377-<r\377\202-;r\377\1,<r\377\202-<r\377\2" \
+  ",<r\377+<r\377\202,<r\377\5,;r\377+<q\377,<r\377+;q\377%5m\377\202\30" \
+  ")d\377\235\31*e\377\6\30)d\377\33,f\377'7n\377(8o\377'7n\377'7o\377\202" \
+  "(8o\377\1'7o\377\202&6o\377\3'7o\377#4k\377\30)d\377\325\31*e\377\211" \
+  "1@u\377\2030\77u\377\2021@u\377\1""1@t\377\2022At\377\2""2Au\3771@u\377" \
+  "\2022Au\377\2202Av\377\2072@v\377\2152Av\377\2051Av\377\2152Av\377\207" \
+  "2@v\377\2202Av\377\2042Au\377\2022At\377\1""1@t\377\2021@u\377\2030\77" \
+  "u\377\2121@u\377\7""0\77t\3771@u\3772Au\377/\77t\377'7n\377\40""1j\377" \
+  "\33,f\377\203\30)d\377\245\31*e\377\14\30)d\377\32*e\377$4l\377,<r\377" \
+  "-=r\377,=r\377-=q\377-<r\377-;r\377-<r\377,<r\377-<r\377\202,<r\377\1" \
+  "+<r\377\205,<r\377\2+:q\377\37/h\377\202\30)d\377\234\31*e\377\4\30)" \
+  "e\377\30)d\377\35-g\377&6n\377\204(8o\377\202'7o\377\5&6o\377'7n\377" \
+  "'7o\377!1j\377\30)d\377\326\31*e\377\2021@u\377\1""0\77t\377\2131@u\377" \
+  "\2040\77u\377\1""2Au\377\2021@u\377\2032At\377\2052Au\377\2042Av\377" \
+  "\1""2Au\377\2632Av\377\1""2Au\377\2052Av\377\2042Au\377\2032At\377\204" \
+  "1@u\377\2030\77u\377\2121@u\377\2""0@u\3771\77t\377\2021@u\377\2020\77" \
+  "t\377\2,;r\377\40""0i\377\203\30)d\377\247\31*e\377\6\30)d\377\30)e\377" \
+  "\36/i\377,<r\377-=r\377,<q\377\202-<r\377\3-;r\377-<r\377,<r\377\202" \
+  "-<r\377\202+<r\377\203,<r\377\6+<r\377,;r\377+;q\377'7n\377\31*d\377" \
+  "\30)d\377\235\31*e\377\3\30)d\377\31*e\377\36/h\377\202'7n\377\12(8o" \
+  "\377'7o\377(8o\377'7o\377&6o\377'7o\377&6o\377'7o\377#3k\377\30)d\377" \
+  "\327\31*e\377\3+:q\3770\77t\3772Au\377\2171@u\377\2030\77u\377\2031@" \
+  "u\377\1""1@t\377\2032At\377\2""2Au\3771@u\377\2032Au\377\2652Av\377\203" \
+  "2Au\377\2""1@u\3772Au\377\2032At\377\1""1@t\377\2031@u\377\2040\77u\377" \
+  "\2131@u\377\1""0\77t\377\2021@u\377\7""1Au\377.=s\377)9o\377\"2k\377" \
+  "\33,f\377\27(d\377\30)d\377\250\31*e\377\10\30)d\377\27)d\377\36/h\377" \
+  "'8o\377.>s\377-=r\377-=q\377-<r\377\202-;r\377\3-<r\377,<r\377-<r\377" \
+  "\205,<r\377\7,;r\377+<q\377,<r\377)9p\377\40""0i\377\30)d\377\30)e\377" \
+  "\235\31*e\377\202\30)d\377\1\40""0i\377\205(8o\377\7'7o\377&6o\377'7" \
+  "o\377&6n\377'7o\377!2j\377\27(d\377\332\31*e\377\2\37""0j\377)9p\377" \
+  "\2031@u\377\1""0\77t\377\2151@u\377\2030\77u\377\2041@u\377\1""1@t\377" \
+  "\2032At\377\2072Au\377\2072Av\377\1""2Au\377\2312Av\377\1""2Au\377\207" \
+  "2Av\377\2052Au\377\2""1@u\3772Au\377\2032At\377\1""1@t\377\2041@u\377" \
+  "\2030\77u\377\2141@u\377\2""0@u\3771\77t\377\2021@u\377\3/>t\377%5m\377" \
+  "\34-g\377\202\31*e\377\202\30)d\377\251\31*e\377\7\30)d\377\32+f\377" \
+  "(7o\377,<s\377-=r\377,=r\377-=q\377\204-<r\377\3,<r\377-<r\377,<r\377" \
+  "\202+<r\377\203,<r\377\4+<r\377,;r\377%5m\377\32+e\377\202\30)d\377\237" \
+  "\31*e\377\5\"2k\377'7n\377(8o\377'7n\377(8o\377\202'7o\377\6&6o\377'" \
+  "7o\377&6n\377'7o\377!2j\377\30)d\377\333\31*e\377\7\30)d\377\27(d\377" \
+  "\30)d\377\37""0i\377'7n\377,;q\377/>s\377\2041@u\377\1""0\77t\377\216" \
+  "1@u\377\2050\77u\377\2051@u\377\1""1@t\377\2072At\377\2312Au\377\2""1" \
+  "@u\3772Au\377\2072At\377\1""1@t\377\2061@u\377\2040\77u\377\2161@u\377" \
+  "\1""0\77t\377\2041@u\377\5-=s\377*:p\377$4l\377\34-g\377\27(c\377\202" \
+  "\30)d\377\252\31*e\377\202\30)d\377\13\33,f\377\"3l\377,<r\377-=r\377" \
+  ",=q\377-<q\377-<r\377-;r\377-<r\377,<r\377-<r\377\202,<r\377\202+<r\377" \
+  "\202,<r\377\1+;q\377\202,<r\377\4)9o\377\36/h\377\27(d\377\30)d\377\236" \
+  "\31*e\377\17\30)d\377\32+e\377#3k\377(8o\377'7o\377(8o\377'7o\377(8o" \
+  "\377'7o\377&6o\377'7n\377'7o\377&6m\377\37/h\377\27)d\377\336\31*e\377" \
+  "\203\30)d\377\6\31*e\377\33,f\377\37""0i\377%6m\377-=r\3772Au\377\224" \
+  "1@u\377\2060\77u\377\2071@u\377\2021@t\377\2302At\377\1""1@t\377\207" \
+  "1@u\377\2070\77u\377\2171@u\377\1""0\77u\377\2021@u\377\7""2Au\3771@" \
+  "u\377*:p\377#3l\377\34-g\377\32+f\377\31*e\377\202\30)d\377\254\31*e" \
+  "\377\10\30)d\377\31*e\377%5m\377+;q\377-=s\377-=r\377,=q\377-<r\377\202" \
+  "-;r\377\3-<r\377,<r\377-<r\377\202,<r\377\1+<r\377\203,<r\377\1,;r\377" \
+  "\202,<r\377\3!2j\377\31*e\377\30)d\377\237\31*e\377\10\30)d\377\33,f" \
+  "\377&6m\377(8o\377'7n\377(8o\377'7o\377(8o\377\202'7o\377\5'7n\377&6" \
+  "o\377'7n\377\31*e\377\30)d\377\344\31*e\377\202\30)d\377\7\27(d\377\31" \
+  "*e\377\40""1i\377'7n\377,<r\377.=s\3770\77t\377\2041@u\377\1""1@t\377" \
+  "\2301@u\377\2320\77u\377\2341@u\377\6/>t\377.=s\377+:q\377$4m\377\35" \
+  ".g\377\27)d\377\203\30)d\377\255\31*e\377\202\30)d\377\7\32+f\377!1k" \
+  "\377-=r\377-=s\377,<r\377-=q\377-<r\377\202-;r\377\203-<r\377\206,<r" \
+  "\377\1+;q\377\202,<r\377\3)8p\377\34-g\377\30)d\377\237\31*e\377\3\30" \
+  ")d\377\31*e\377\36/h\377\205(8o\377\7'7o\377&6o\377'7o\377&6n\377'7o" \
+  "\377&6m\377\27(d\377\350\31*e\377\1\30)e\377\204\30)d\377\10\33,f\377" \
+  "\36.h\377\"1j\377'7n\377+;q\3770\77t\3772Av\3772@u\377\2021@u\377\1""0" \
+  "\77t\377\3001@u\377\1""0\77t\377\2031@u\377\2022Au\377\6.>s\377*9p\377" \
+  "%5m\377\37""0i\377\35-g\377\32+e\377\204\30)d\377\256\31*e\377\202\30" \
+  ")d\377\10\31*d\377$4l\377*:q\377-=s\377-=r\377-=q\377-<q\377-<r\377\202" \
+  "-;r\377\2,<r\377-<r\377\202,<r\377\202+<r\377\203,<r\377\5+<q\377,<r" \
+  "\377+;q\377\40""1i\377\31*e\377\202\30)d\377\236\31*e\377\3\30)d\377" \
+  "\30)e\377\"3k\377\202(8o\377\11'7n\377(8o\377'7o\377(8o\377'7o\377&6" \
+  "o\377&6n\377'7o\377%5m\377\361\31*e\377\204\30)d\377\5\33,f\377\"2k\377" \
+  "'7n\377-=r\377/\77t\377\2030\77t\377\2061@u\377\1""0\77t\377\2551@u\377" \
+  "\1""1\77t\377\2061@u\377\2030\77t\377\5/>s\377+;q\377%5m\377\36/h\377" \
+  "\31*e\377\204\30)d\377\262\31*e\377\11\30)d\377\31)e\377\31*e\377!1j" \
+  "\377-<r\377-=s\377,=r\377-<q\377-=r\377\202-;r\377\3-<r\377,<r\377-<" \
+  "r\377\202,<r\377\1+<r\377\203,<r\377\7+;q\377,<r\377,;r\377+;q\377%5" \
+  "m\377\31*d\377\30)d\377\240\31*e\377\6\30)d\377\32*f\377&6n\377(8o\377" \
+  "'7n\377(8o\377\202'7o\377\7(8o\377&6o\377'7n\377&6o\377'7n\377\"2k\377" \
+  "\27)d\377\365\31*e\377\203\30)d\377\12\27(d\377\31*e\377\34-g\377\40" \
+  "0j\377\"2k\377%5m\377'7o\377*:p\377-<r\3770\77t\377\2022Au\377\2051@" \
+  "u\377\1""1\77t\377\2401@u\377\1""0\77t\377\2051@u\377\15""2@u\3772Au" \
+  "\3771@u\377/>s\377,;q\377)9p\377'6n\377$4l\377\"2k\377\36/h\377\33,g" \
+  "\377\30)d\377\27(d\377\203\30)d\377\264\31*e\377\13\30)d\377\27)d\377" \
+  "\33,f\377#3k\377*:q\377-=s\377,=r\377-=q\377-<q\377-<r\377-;r\377\204" \
+  "-<r\377\1,<r\377\202+<r\377\203,<r\377\1+;q\377\202,<r\377\2&5n\377\35" \
+  ".h\377\202\30)d\377\237\31*e\377\20\31*d\377\30)d\377\36.h\377&6n\377" \
+  "(8o\377'7n\377(8o\377'7o\377(8o\377'7o\377&6o\377'7n\377&6o\377(8o\377" \
+  "\35.g\377\30)d\377\371\31*e\377\205\30)d\377\205\31*e\377\7\32+e\377" \
+  "\36/h\377\"2k\377&6m\377)9p\377,<q\377/>t\377\2151@u\377\2""1@t\3770" \
+  "\77u\377\2051@u\377\1""1\77t\377\2151@u\377\7""1\77t\377.=s\377+;q\377" \
+  "(8o\377$5l\377\40""1i\377\34-g\377\205\31*e\377\1\30*d\377\204\30)d\377" \
+  "\266\31*e\377\20\30)e\377\30)d\377\32+f\377&6m\377-=s\377,<s\377-=q\377" \
+  "-=r\377-<q\377-;r\377-<r\377-;r\377-<r\377,<r\377-<r\377,<r\377\202+" \
+  "<r\377\204,<r\377\5+<q\377,<r\377+;q\377\36/h\377\31*e\377\202\30)d\377" \
+  "\240\31*e\377\2\30)d\377\40""1j\377\202(8o\377\1(8n\377\203(8o\377\2" \
+  "'7o\377&6o\377\203'7o\377\1\32*e\377\202\30)d\377\377\31*e\377\204\31" \
+  "*e\377\204\30)d\377\202\27(d\377\20\27(c\377\30)d\377\32*e\377\33,f\377" \
+  "\35-g\377\36/h\377\40""1i\377\"2k\377#3l\377$4l\377$5m\377%5m\377%6m" \
+  "\377'6n\377'7n\377(7n\377\202(8o\377\1)8o\377\202(8o\377\3'7n\377'6n" \
+  "\377&6n\377\202%5m\377\11$4l\377#4l\377#3k\377!2j\377\37""0i\377\36/" \
+  "h\377\34-g\377\32+f\377\30)e\377\202\27(c\377\202\27(d\377\203\30)d\377" \
+  "\275\31*e\377\202\30)d\377\3\31*d\377\36.h\377%6n\377\202-=r\377\2,<" \
+  "r\377-=q\377\202-<r\377\1-;r\377\204-<r\377\202,<r\377\1+<r\377\203," \
+  "<r\377\1,;r\377\202,<r\377\3*:p\377\"3k\377\30*d\377\202\30)d\377\240" \
+  "\31*e\377\5\30)d\377\32+f\377\"2k\377(8o\377'7n\377\203(8o\377\202'7" \
+  "o\377\202&6o\377\4'7o\377#3l\377\34-g\377\30)d\377\377\31*e\377\215\31" \
+  "*e\377\220\30)d\377\2\30*e\377\31*e\377\220\30)d\377\1\30)e\377\302\31" \
+  "*e\377\202\30)d\377\3\40""0i\377+:p\377,<r\377\202-=r\377\3,=q\377-<" \
+  "q\377-<r\377\202-;r\377\3-<r\377,<r\377-<r\377\202,<r\377\202+<r\377" \
+  "\203,<r\377\5+<q\377,<r\377,;r\377$5l\377\32*e\377\202\30)d\377\241\31" \
+  "*e\377\5\30)d\377\34-g\377&6n\377(8o\377'7o\377\202(8o\377\202'7o\377" \
+  "\202&6o\377\5'7n\377'7o\377\37""0i\377\31*e\377\30)d\377\377\31*e\377" \
+  "\357\31*e\377\202\30)d\377\10\30)e\377\33,f\377!1j\377*:q\377.=s\377" \
+  ",=r\377-=q\377-<q\377\202-<r\377\3-;r\377-<r\377,<r\377\202-<r\377\1" \
+  ",<r\377\202+<r\377\203,<r\377\1+;q\377\202,<r\377\4+;q\377&7n\377\35" \
+  "-g\377\30)d\377\242\31*e\377\3\30)d\377\31*e\377\40""0j\377\205(8o\377" \
+  "\202'7o\377\2&6o\377'7n\377\202'7o\377\2\"2j\377\30)d\377\377\31*e\377" \
+  "\357\31*e\377\202\30)d\377\4\27(d\377\37""0i\377(8o\377+;r\377\202-=" \
+  "r\377\3,=q\377-=q\377-<r\377\203-;r\377\1,<r\377\202-<r\377\202,<r\377" \
+  "\202+<r\377\203,<r\377\1+;q\377\202,<r\377\3&6n\377\34-g\377\30*e\377" \
+  "\202\30)d\377\241\31*e\377\20\30)d\377\33+f\377%5m\377(8o\377(8n\377" \
+  "'7o\377(8o\377'7o\377(8o\377'7o\377&6o\377'7n\377&6o\377&6m\377\34-g" \
+  "\377\30)d\377\377\31*e\377\355\31*e\377\202\30)d\377\10\31*e\377\32+" \
+  "f\377\"2k\377,<q\377-=s\377-=r\377-=q\377-<q\377\202-<r\377\1-;r\377" \
+  "\204-<r\377\202,<r\377\202+<r\377\203,<r\377\1+;q\377\202,<r\377\5+;" \
+  "q\377(8o\377\34-g\377\30)d\377\31)d\377\242\31*e\377\3\30)d\377\31*e" \
+  "\377\36/h\377\202(8o\377\2'7n\377(8o\377\203'7o\377\7&6o\377'7n\377&" \
+  "6o\377'7o\377&6m\377\27(c\377\30)d\377\377\31*e\377\354\31*e\377\202" \
+  "\30)d\377\10\31*e\377\40""1j\377'7o\377,<r\377-=s\377-=r\377,=q\377-" \
+  "=q\377\202-<r\377\202-;r\377\3-<r\377,<r\377-<r\377\202,<r\377\202+<" \
+  "r\377\203,<r\377\2,;r\377+<q\377\202,<r\377\2&7n\377\36.h\377\203\30" \
+  ")d\377\242\31*e\377\5\30)d\377\32+f\377#3l\377(8o\377'7n\377\202(8o\377" \
+  "\11'7o\377(8o\377'7o\377&6o\377'7n\377&6o\377(7o\377\"2k\377\30)d\377" \
+  "\377\31*e\377\352\31*e\377\202\30)d\377\202\31*e\377\10\33,g\377%5m\377" \
+  ",<r\377-=s\377-=r\377-=q\377-<q\377-<r\377\202-;r\377\204-<r\377\4,<" \
+  "r\377-<r\377,<r\377+<r\377\203,<r\377\2,;r\377+<q\377\202,<r\377\3+:" \
+  "q\377)9o\377\35-g\377\202\30)d\377\243\31*e\377\202\30)d\377\6\34-g\377" \
+  "'7n\377(8n\377'7o\377(8o\377'7o\377\202(8o\377\7'7o\377'7n\377&6o\377" \
+  "'7o\377'7n\377\31*e\377\30)d\377\377\31*e\377\351\31*e\377\202\30)d\377" \
+  "\5\31*e\377\36/h\377#4l\377*9p\377.>s\377\202-=r\377\2-=q\377-<q\377" \
+  "\202-<r\377\1-;r\377\204-<r\377\202,<r\377\203+<r\377\203,<r\377\1,;" \
+  "r\377\202,<r\377\3+;r\377&6m\377\36/i\377\202\30)d\377\244\31*e\377\3" \
+  "\30)d\377\32*e\377!2j\377\206(8o\377\1'7o\377\203&6o\377\4'7o\377\"2" \
+  "k\377\33,f\377\30)d\377\377\31*e\377\347\31*e\377\203\30)d\377\11\33" \
+  ",f\377%5m\377,<q\377,<r\377-=s\377-=r\377-<q\377-=q\377-<q\377\202-<" \
+  "r\377\202-;r\377\3-<r\377,<r\377-<r\377\203,<r\377\1+<r\377\205,<r\377" \
+  "\6+<q\377,<r\377,;r\377%5m\377\32+e\377\31*e\377\202\30)d\377\243\31" \
+  "*e\377\202\30)d\377\2\34-g\377&6n\377\202(8o\377\4'7n\377(8o\377'7o\377" \
+  "(8o\377\202&6o\377\6'7o\377&6n\377'7o\377\36.h\377\31*e\377\30)d\377" \
+  "\377\31*e\377\344\31*e\377\203\30)d\377\7\32+f\377\35.g\377\"2k\377*" \
+  ":p\377.>s\377-=s\377,<r\377\202-=q\377\202-<r\377\202-;r\377\204-<r\377" \
+  "\202,<r\377\202+<r\377\204,<r\377\11,;r\377+<q\377,;r\377,<r\377)9p\377" \
+  "#3l\377\33,f\377\27)d\377\30)e\377\244\31*e\377\202\30)d\377\2\32+f\377" \
+  "!2k\377\202(8o\377\14'7n\377(8o\377'7o\377(8o\377'7o\377&6o\377'7o\377" \
+  "&6n\377'7o\377#3l\377\40""0i\377\30)d\377\356\31*e\377\202\30)d\377\363" \
+  "\31*e\377\7\30)d\377\27)d\377\32*e\377!2k\377)8p\377+;q\377,<r\377\202" \
+  "-=r\377\3,=r\377-=q\377-<q\377\202-<r\377\202-;r\377\204-<r\377\202," \
+  "<r\377\203+<r\377\204,<r\377\6+<q\377,<r\377,;r\377*:p\377\36/i\377\32" \
+  "+f\377\202\30)d\377\246\31*e\377\3\30)d\377\37/h\377&6n\377\206(8o\377" \
+  "\6'7o\377&6o\377'7n\377&6o\377'7o\377#3l\377\202\30)d\377\357\31*e\377" \
+  "\4'7n\377\37/i\377\33,f\377\31*e\377\203\30)d\377\350\31*e\377\203\30" \
+  ")d\377\12\31*d\377\32+f\377\34,g\377\"2k\377*9p\377.>s\377-=s\377-=r" \
+  "\377,=q\377-=q\377\203-<r\377\202-;r\377\2-<r\377,<r\377\202-<r\377\203" \
+  ",<r\377\202+<r\377\204,<r\377\2,;r\377+<q\377\202,<r\377\5+;q\377(7o" \
+  "\377\40""0i\377\27)d\377\30)d\377\247\31*e\377\5\30)d\377\32+e\377#3" \
+  "l\377(8o\377'7n\377\204(8o\377\10'7o\377&6o\377'7n\377&6o\377'7o\377" \
+  "&6n\377\34-f\377\30)d\377\361\31*e\377\202-=r\377\6,<q\377)9p\377&6n" \
+  "\377\40""1i\377\33,f\377\27(c\377\203\30)d\377\341\31*e\377\202\30)d" \
+  "\377\7\27(d\377\30)e\377\35.h\377#2k\377'8o\377*:q\377-=s\377\202-=r" \
+  "\377\3,=r\377-=q\377-<q\377\202-<r\377\203-;r\377\2-<r\377,<r\377\202" \
+  "-<r\377\203,<r\377\202+<r\377\204,<r\377\10,;r\377+<q\377,<r\377-<r\377" \
+  "*:p\377!2j\377\34-g\377\31*e\377\202\30)d\377\246\31*e\377\6\30)d\377" \
+  "\27(d\377\40""0i\377'7n\377(8o\377(8n\377\202(8o\377\203'7o\377\7&6o" \
+  "\377'7o\377&6o\377'7o\377$4l\377\32+e\377\30)d\377\362\31*e\377\202-" \
+  "<r\377\3-<q\377,=q\377-=q\377\202-=s\377\4,;q\377&6m\377\37""0i\377\32" \
+  "+e\377\202\31*e\377\204\30)d\377\325\31*e\377\203\30)d\377\203\31*e\377" \
+  "\3\33,f\377\"2k\377(8o\377\203-=s\377\1,<q\377\202-=q\377\203-<r\377" \
+  "\202-;r\377\202-<r\377\1,<r\377\202-<r\377\203,<r\377\202+<r\377\205" \
+  ",<r\377\1+<q\377\203,<r\377\3+:q\377(8o\377\36/h\377\202\30)d\377\250" \
+  "\31*e\377\6\30)d\377\31*e\377\33+e\377&6m\377(8o\377'7n\377\203(8o\377" \
+  "\202'7o\377\3&6o\377'7o\377&6o\377\202'7n\377\2\35.g\377\30)d\377\364" \
+  "\31*e\377\203-;r\377\202-<r\377\202-=q\377\202-=r\377\11-=s\377-=r\377" \
+  "):p\377&6n\377#3l\377\37/i\377\33,f\377\30)d\377\27(d\377\203\30)d\377" \
+  "\315\31*e\377\203\30)d\377\10\27(d\377\31*e\377\34-g\377\40""1j\377$" \
+  "5l\377(8o\377+;q\377-=s\377\203-=r\377\202-=q\377\203-<r\377\203-;r\377" \
+  "\202-<r\377\1,<r\377\202-<r\377\203,<r\377\202+<r\377\206,<r\377\1+<" \
+  "q\377\202,<r\377\3(8o\377\"2k\377\34-g\377\202\30)d\377\251\31*e\377" \
+  "\10\30)d\377\32*e\377!1k\377'7n\377(8o\377'7n\377(8o\377'7o\377\202(" \
+  "8o\377\10'7o\377&6o\377'7n\377&6o\377'7o\377!1j\377\36.h\377\30)d\377" \
+  "\365\31*e\377\202-<r\377\203-;r\377\202-<r\377\4-<q\377-=q\377,=q\377" \
+  "-=q\377\202-=r\377\2,<q\377,<s\377\202,<r\377\3(8o\377#3k\377\36/h\377" \
+  "\205\30)d\377\305\31*e\377\204\30)d\377\4\33+e\377\40""0i\377%5m\377" \
+  "*9p\377\202,<r\377\2,<s\377-=q\377\203-=r\377\3,=q\377-=q\377-<q\377" \
+  "\202-<r\377\203-;r\377\202-<r\377\1,<r\377\203-<r\377\203,<r\377\202" \
+  "+<r\377\206,<r\377\1+<q\377\202,;r\377\2'7n\377\34-g\377\202\31*e\377" \
+  "\202\30)d\377\250\31*e\377\202\30)d\377\5\36.h\377'7n\377'7o\377(8o\377" \
+  "'7n\377\203(8o\377\202'7o\377\5&6o\377'7o\377&6o\377'7n\377\37/i\377" \
+  "\202\30)d\377\366\31*e\377\202,<r\377\205-<r\377\204-;r\377\203-<r\377" \
+  "\203-=q\377\14-=r\377-=s\377.=s\377.>r\377+;q\377'7o\377#4l\377\40""1" \
+  "j\377\36.h\377\34-g\377\33+f\377\31*e\377\206\30)d\377\261\31*e\377\206" \
+  "\30)d\377\12\32*e\377\33,f\377\35-g\377\37/i\377\"2k\377%5m\377)9p\377" \
+  ",<r\377.>s\377-=s\377\202-=r\377\1,=r\377\202-=q\377\204-<r\377\203-" \
+  ";r\377\202-<r\377\1,<r\377\203-<r\377\203,<r\377\202+<r\377\205,<r\377" \
+  "\1,;r\377\204,<r\377\6*9p\377&5n\377\40""1j\377\32+f\377\27(d\377\30" \
+  ")d\377\252\31*e\377\202\30)d\377\2\35-g\377$4l\377\204(8o\377\2'7o\377" \
+  "(8o\377\202'7o\377\7&6o\377&6n\377&6o\377'7o\377\"3k\377\31*e\377\30" \
+  ")d\377\370\31*e\377\1+<r\377\203,<r\377\203-<r\377\1,<r\377\203-<r\377" \
+  "\203-;r\377\203-<r\377\1-<q\377\202-=q\377\1,=q\377\204-=r\377\202,<" \
+  "r\377\202+;q\377\7):p\377'6n\377#3l\377\37""0i\377\34-g\377\30)e\377" \
+  "\27)d\377\206\30)d\377\1\30)e\377\241\31*e\377\207\30)d\377\6\27(d\377" \
+  "\31*f\377\35.g\377\40""1j\377$4m\377(8n\377\202+;q\377\1+;r\377\202," \
+  "<r\377\204-=r\377\1,=q\377\202-=q\377\202-<q\377\202-<r\377\204-;r\377" \
+  "\206-<r\377\204,<r\377\202+<r\377\205,<r\377\1,;r\377\202,<r\377\202" \
+  ",;r\377\4&7n\377\36.h\377\32+e\377\31*e\377\202\30)d\377\253\31*e\377" \
+  "\6\30)d\377\32+e\377$4l\377'7n\377(8o\377'7n\377\202(8o\377\2'7o\377" \
+  "(8o\377\202'7o\377\7&6o\377'7n\377'7o\377(8o\377\32+f\377\31*d\377\30" \
+  ")d\377\371\31*e\377\204,<r\377\203+<r\377\203,<r\377\203-<r\377\1,<r" \
+  "\377\203-<r\377\204-;r\377\204-<r\377\1-<q\377\202-=q\377\2,=q\377-=" \
+  "q\377\203-=s\377\202.>s\377\15,<r\377)9o\377'6n\377$5m\377#3l\377!2k" \
+  "\377\37""0h\377\35.h\377\35-g\377\34-g\377\33,g\377\33,f\377\32+f\377" \
+  "\202\32+e\377\1\32*e\377\204\31*e\377\210\30)d\377\1\30)e\377\204\31" \
+  "*e\377\203\32+e\377\16\32+f\377\33,f\377\34,g\377\34-g\377\35-h\377\36" \
+  ".h\377\40""0i\377!2k\377$4l\377%5m\377'7n\377*:p\377-=r\377.>s\377\203" \
+  "-=s\377\2-=r\377,=r\377\204-=q\377\204-<r\377\204-;r\377\203-<r\377\1" \
+  ",<r\377\204-<r\377\203,<r\377\203+<r\377\206,<r\377\1,;r\377\204,<r\377" \
+  "\6*9q\377'7o\377!2k\377\31*e\377\27(d\377\30)d\377\254\31*e\377\202\30" \
+  ")d\377\2\32+e\377\37""0i\377\202(8o\377\3'7n\377(8o\377'7o\377\202(8" \
+  "o\377\4'7o\377&6o\377'7o\377'7n\377\202'7o\377\3\"3k\377\27(c\377\30" \
+  ")d\377\373\31*e\377\207,<r\377\202+<r\377\204,<r\377\203-<r\377\1,<r" \
+  "\377\204-<r\377\204-;r\377\205-<r\377\205-=q\377\210-=r\377\4-<r\377" \
+  ",<r\377+;r\377+;q\377\202*:q\377\1):p\377\205)9p\377\2(9p\377(8p\377" \
+  "\202(8o\377\2(7n\377(8o\377\202(8p\377\1(9p\377\204)9p\377\2):p\377*" \
+  ":p\377\202*:q\377\4+;q\377,;r\377,<r\377-=s\377\210-=r\377\1,=q\377\204" \
+  "-=q\377\1-<q\377\204-<r\377\204-;r\377\204-<r\377\1,<r\377\203-<r\377" \
+  "\204,<r\377\203+<r\377\206,<r\377\1,;r\377\203,<r\377\6-<r\377*:q\377" \
+  "$5m\377\36/h\377\33,f\377\31*e\377\202\30)d\377\255\31*e\377\202\30)" \
+  "d\377\2\37""0i\377&6n\377\202(8o\377\1'7n\377\203(8o\377\202'7o\377\203" \
+  "&6o\377\4'7o\377&6m\377\33,f\377\30)d\377\375\31*e\377\202,;r\377\1+" \
+  "<q\377\211,<r\377\204+<r\377\204,<r\377\204-<r\377\1,<r\377\205-<r\377" \
+  "\206-;r\377\207-<r\377\1-<q\377\240-=q\377\1-<q\377\207-<r\377\205-;" \
+  "r\377\205-<r\377\1,<r\377\204-<r\377\204,<r\377\204+<r\377\211,<r\377" \
+  "\1+<q\377\202,<r\377\5+;q\377+:q\377)9p\377#4l\377\34-g\377\203\30)d" \
+  "\377\257\31*e\377\6\30)d\377\31*e\377\34-g\377&6n\377(8o\377'7n\377\202" \
+  "(8o\377\2'7o\377(8o\377\202'7o\377\7&6o\377'7n\377&6o\377'7n\377&6n\377" \
+  "\"2j\377\27(d\377\377\31*e\377\10&5m\377+;q\377-<r\377,;r\377,<r\377" \
+  "+<q\377,<r\377,;r\377\210,<r\377\203+<r\377\205,<r\377\205-<r\377\1," \
+  "<r\377\206-<r\377\210-;r\377\240-<r\377\210-;r\377\206-<r\377\1,<r\377" \
+  "\204-<r\377\205,<r\377\203+<r\377\210,<r\377\2,;r\377+<q\377\202,<r\377" \
+  "\7,;r\377-<r\377)9p\377$4l\377\37/i\377\34,f\377\30)e\377\202\30)d\377" \
+  "\1\30)e\377\257\31*e\377\4\30)d\377\27(d\377\36.h\377$5l\377\202(8o\377" \
+  "\1'7o\377\204(8o\377\202'7o\377\7&6o\377'7n\377'7o\377(8o\377\36/h\377" \
+  "\34,g\377\30)d\377\377\31*e\377\6\31*e\377\27(d\377\31*d\377\36/h\377" \
+  "$4l\377*:p\377\202+:q\377\1+<q\377\202,;r\377\2,<r\377+<q\377\213,<r" \
+  "\377\205+<r\377\206,<r\377\207-<r\377\1,<r\377\253-<r\377\205,<r\377" \
+  "\1-<r\377\205+<r\377\215,<r\377\202,;r\377\1+<q\377\202+:q\377\3'7n\377" \
+  "!1j\377\32+e\377\202\30)d\377\262\31*e\377\202\30)d\377\3\31*e\377\33" \
+  ",f\377&6m\377\204(8o\377\2'7o\377(8o\377\202'7o\377\10&6o\377'7n\377" \
+  "&6o\377'7n\377&6o\377&6m\377\27(d\377\30)d\377\377\31*e\377\204\31*e" \
+  "\377\1\30)e\377\202\30)d\377\13\27(d\377\33+f\377\36/h\377\"2k\377%5" \
+  "m\377)8o\377,<q\377,<r\377,;r\377,<r\377+<q\377\202,<r\377\1,;r\377\212" \
+  ",<r\377\206+<r\377\207,<r\377\214-<r\377\1,<r\377\213-<r\377\1,<r\377" \
+  "\214-<r\377\210,<r\377\205+<r\377\212,<r\377\3,;r\377,<r\377+<q\377\204" \
+  ",<r\377\6+;q\377'7o\377$4l\377\40""1i\377\35-g\377\31*e\377\203\30)d" \
+  "\377\263\31*e\377\202\30)d\377\2\35-g\377#4l\377\202(8o\377\1'7n\377" \
+  "\202(8o\377\3'7o\377(8o\377'7o\377\202&6o\377\6'7o\377&6o\377'7o\377" \
+  "&6n\377\36/h\377\30)d\377\377\31*e\377\212\31*e\377\203\30)d\377\202" \
+  "\31*e\377\4\32+f\377\37""0h\377%5m\377+;q\377\203,;r\377\2,<r\377+<q" \
+  "\377\217,<r\377\207+<r\377\214,<r\377\215-<r\377\215,<r\377\207+<r\377" \
+  "\216,<r\377\2+<q\377,<r\377\202,;r\377\4,;q\377)8o\377\"2k\377\34,g\377" \
+  "\203\31*e\377\203\30)d\377\265\31*e\377\4\30)d\377\33,f\377%5m\377'7" \
+  "n\377\202(8o\377\1'7n\377\204(8o\377\202'7o\377\7&6o\377'7n\377&6o\377" \
+  "'7o\377\35-g\377\31*e\377\30)d\377\377\31*e\377\220\31*e\377\203\30)" \
+  "d\377\10\27(d\377\32+f\377\35.h\377!2j\377%5l\377'6n\377)8p\377*:q\377" \
+  "\202,<r\377\1,;r\377\202,<r\377\1+<q\377\232,<r\377\215+<r\377\231,<" \
+  "r\377\1+<q\377\205,<r\377\11+;q\377*:p\377(7o\377&6n\377#4k\377\37""0" \
+  "i\377\34-g\377\30*d\377\27(d\377\202\30)d\377\267\31*e\377\202\30)d\377" \
+  "\3\31*e\377\34-g\377\"3k\377\202(8o\377\1'7n\377\202(8o\377\2'7o\377" \
+  "(8o\377\202'7o\377\10&6o\377'7n\377&6o\377'7o\377'7n\377#3k\377\31*e" \
+  "\377\30)d\377\377\31*e\377\226\31*e\377\204\30)d\377\11\31*e\377\32+" \
+  "e\377\33,f\377\34,g\377\40""0i\377$4m\377)8o\377+;q\377-<r\377\202,;" \
+  "r\377\207,<r\377\1,;r\377\256,<r\377\1,;r\377\202,<r\377\1+<q\377\203" \
+  ",<r\377\13,;r\377-<r\377,<r\377*9p\377'6n\377\"2k\377\36.h\377\33,f\377" \
+  "\32+f\377\31*e\377\31*d\377\204\30)d\377\271\31*e\377\202\30)d\377\3" \
+  "\36/h\377%5m\377'7n\377\204(8o\377\1'7o\377\202(8o\377\202'7o\377\3&" \
+  "6o\377'7n\377'7o\377\202'7n\377\1\32+e\377\202\30)d\377\377\31*e\377" \
+  "\236\31*e\377\204\30)d\377\14\27(d\377\31*e\377\35-g\377\37/i\377#3l" \
+  "\377%5m\377(8o\377)8p\377*9p\377*9q\377+:q\377+;q\377\204,<r\377\202" \
+  ",;r\377\204,<r\377\1+<q\377\227,<r\377\1+<q\377\212,<r\377\202+;q\377" \
+  "\12*9p\377)9p\377)8p\377'7n\377$4l\377!2k\377\36.h\377\33,f\377\30)d" \
+  "\377\27)d\377\203\30)d\377\276\31*e\377\202\30)d\377\3\32*e\377\35.g" \
+  "\377&6n\377\202(8o\377\1'7n\377\204(8o\377\202'7o\377\2&6o\377'7n\377" \
+  "\203'7o\377\3$4l\377\35.h\377\30)d\377\377\31*e\377\245\31*e\377\1\30" \
+  ")e\377\206\30)d\377\17\31*e\377\32+f\377\34,f\377\35-g\377\36.h\377\36" \
+  "/i\377\40""0j\377\"2k\377$3l\377%5m\377&6n\377(8o\377*9p\377+;q\377," \
+  "<r\377\205-<r\377\204,<r\377\206,;r\377\204,<r\377\206-<r\377\17,<r\377" \
+  "*:q\377)9p\377(7o\377&6n\377%4l\377#3k\377!1j\377\40""0i\377\36.h\377" \
+  "\35.h\377\34-g\377\33,f\377\32+e\377\31*d\377\206\30)d\377\301\31*e\377" \
+  "\4\30)d\377\32+e\377!2j\377&6m\377\202(8o\377\1(8n\377\202(8o\377\2'" \
+  "7o\377(8o\377\202'7o\377\202&6o\377\5'7n\377&6o\377'7n\377&6m\377\35" \
+  "-g\377\202\30)d\377\377\31*e\377\262\31*e\377\212\30)d\377\12\32+f\377" \
+  "\33,f\377\33,g\377\34-g\377\35-g\377\36.h\377\36/h\377\37/i\377\37""0" \
+  "i\377\40""0j\377\202!1j\377\10\"2k\377!1j\377\40""1j\377\40""0i\377\37" \
+  "0i\377\36/h\377\36.h\377\35.h\377\202\34-g\377\3\33,f\377\33+f\377\31" \
+  "*e\377\211\30)d\377\311\31*e\377\202\30)d\377\202\31*e\377\1\"2k\377" \
+  "\202(8o\377\1'7n\377\202(8o\377\1'7o\377\202(8o\377\202'7o\377\10&6o" \
+  "\377'7n\377&6o\377'7n\377'7o\377&6m\377\32+f\377\30)d\377\377\31*e\377" \
+  "\276\31*e\377\232\30)d\377\320\31*e\377\202\30)d\377\4\31*e\377\36.h" \
+  "\377#3k\377(8n\377\204(8o\377\1'7o\377\202(8o\377\202'7o\377\202&6o\377" \
+  "\7'7o\377&6o\377'7o\377$4l\377\37""0i\377\27(d\377\30)d\377\377\31*e" \
+  "\377\377\31*e\377\251\31*e\377\3\30)d\377\31*e\377\40""1j\377\202'7n" \
+  "\377\202(8o\377\1'7n\377\202(8o\377\2'7o\377(8o\377\202'7o\377\202&6" \
+  "o\377\4'7n\377'7o\377'7n\377(8n\377\202\31*e\377\1\30)d\377\377\31*e" \
+  "\377\377\31*e\377\247\31*e\377\202\30)d\377\3\32*e\377\35.h\377\"3k\377" \
+  "\210(8o\377\202'7o\377\202&6o\377\2'7o\377&6o\377\202'7o\377\3\"3k\377" \
+  "\40""1i\377\27(d\377\377\31*e\377\377\31*e\377\250\31*e\377\202\30)d" \
+  "\377\2\32+e\377\"2j\377\202'7n\377\205(8o\377\2'7o\377(8o\377\203'7o" \
+  "\377\6&6o\377'7o\377'7n\377&6o\377'7o\377$4l\377\202\31*e\377\1\30)d" \
+  "\377\377\31*e\377\377\31*e\377\245\31*e\377\203\30)d\377\3\32+e\377\35" \
+  "-g\377#3k\377\202(8o\377\1'7n\377\206(8o\377\1'7o\377\202&6o\377\202" \
+  "'7o\377\6&6o\377'7o\377%5m\377#4k\377\31*e\377\30)d\377\377\31*e\377" \
+  "\377\31*e\377\246\31*e\377\203\30)d\377\3\36.h\377$4l\377&6m\377\203" \
+  "(8o\377\1'7n\377\202(8o\377\2'7o\377(8o\377\203'7o\377\202&6o\377\6'" \
+  "7n\377&6o\377'7o\377(8o\377\33,f\377\32+e\377\202\30)d\377\377\31*e\377" \
+  "\377\31*e\377\243\31*e\377\202\30)d\377\4\31*d\377\31*e\377\33,f\377" \
+  "!2k\377\207(8o\377\2'7o\377(8o\377\203'7o\377\1&6o\377\202'7o\377\6&" \
+  "6o\377'7n\377&6n\377%5m\377\"2k\377\27(d\377\377\31*e\377\377\31*e\377" \
+  "\245\31*e\377\203\30)d\377\3\35.h\377\"2k\377%5m\377\212(8o\377\1'7o" \
+  "\377\203&6o\377\6'7n\377&6o\377'7o\377(8o\377\36/h\377\35.h\377\202\30" \
+  ")d\377\377\31*e\377\377\31*e\377\241\31*e\377\203\30)d\377\202\31*e\377" \
+  "\6\32+f\377\"2k\377'7o\377(8o\377(8n\377'7o\377\205(8o\377\203'7o\377" \
+  "\202&6o\377\1'7n\377\202'7o\377\4'7n\377&6n\377'7n\377!1j\377\202\30" \
+  ")d\377\377\31*e\377\377\31*e\377\242\31*e\377\203\30)d\377\4\33,f\377" \
+  "\37/i\377\"2k\377%6m\377\202(8o\377\2(8n\377'7o\377\202(8o\377\1'7o\377" \
+  "\202(8o\377\203'7o\377\202&6o\377\11'7o\377'7n\377&6o\377'7o\377'7n\377" \
+  "!1j\377\37""0i\377\27(d\377\30)d\377\377\31*e\377\377\31*e\377\241\31" \
+  "*e\377\203\30)d\377\3\33,f\377!2j\377&6n\377\202'7n\377\202(8o\377\2" \
+  "(8n\377'7o\377\202(8o\377\1'7o\377\202(8o\377\203'7o\377\202&6o\377\202" \
+  "'7o\377\4&6o\377'7o\377'7n\377\33,f\377\202\31*e\377\1\30)d\377\377\31" \
+  "*e\377\247\31*e\377\1\30)d\377\365\31*e\377\203\30)d\377\5\31*e\377\33" \
+  ",f\377\35.h\377\"2k\377'7n\377\202(8o\377\2(8n\377'7o\377\203(8o\377" \
+  "\1'7o\377\202(8o\377\203'7o\377\202&6o\377\202'7o\377\1&6o\377\202'7" \
+  "o\377\5&6n\377\"3k\377\33,f\377\27(d\377\30)d\377\377\31*e\377\252\31" \
+  "*e\377\1\30)e\377\203\30)d\377\356\31*e\377\204\30)d\377\5\32+e\377\37" \
+  "/h\377#3k\377%6m\377'7n\377\203(8o\377\1'7n\377\204(8o\377\1'7o\377\202" \
+  "(8o\377\203'7o\377\202&6o\377\10'7n\377'7o\377&6o\377'7n\377(7n\377$" \
+  "5m\377\32+f\377\33+f\377\202\30)d\377\377\31*e\377\254\31*e\377\6(8o" \
+  "\377$5m\377\40""1j\377\34,g\377\32+f\377\31*e\377\204\30)d\377\342\31" \
+  "*e\377\1\30)e\377\203\30)d\377\6\31*e\377\32+e\377\33,f\377\35.h\377" \
+  "\"2k\377&7n\377\203(8o\377\1'7n\377\204(8o\377\1'7o\377\202(8o\377\203" \
+  "'7o\377\203&6o\377\12'7n\377'7o\377&6o\377'7o\377'7n\377%5m\377$4l\377" \
+  "\40""0i\377\27(d\377\30)d\377\377\31*e\377\260\31*e\377\204(8o\377\7" \
+  "'7n\377%5m\377#3l\377\40""0i\377\34-g\377\31*d\377\27)d\377\203\30)d" \
+  "\377\333\31*e\377\204\30)d\377\6\32+e\377\36/h\377\"2j\377$4l\377&6m" \
+  "\377'7o\377\203(8o\377\1'7n\377\204(8o\377\1'7o\377\203(8o\377\203'7" \
+  "o\377\203&6o\377\10'7n\377'7o\377&6o\377'7n\377(7o\377!1j\377\35.g\377" \
+  "\32+f\377\202\30)d\377\377\31*e\377\262\31*e\377\206(8o\377\1'7n\377" \
+  "\203(8o\377\4&6n\377\"2k\377\36/h\377\33+e\377\203\31*e\377\205\30)d" \
+  "\377\313\31*e\377\204\30)d\377\204\31*e\377\4\34-f\377\40""0i\377#4l" \
+  "\377'7n\377\203(8o\377\1'7n\377\205(8o\377\1'7o\377\202(8o\377\204'7" \
+  "o\377\203&6o\377\6'7n\377'7o\377&6o\377'7o\377'7n\377&6n\377\202&6m\377" \
+  "\1\33,f\377\202\30)d\377\377\31*e\377\266\31*e\377\203(8o\377\1'7o\377" \
+  "\205(8o\377\1(8n\377\204(8o\377\7'7n\377%5m\377#3k\377!1j\377\37/i\377" \
+  "\34-g\377\32+f\377\206\30)d\377\300\31*e\377\206\30)d\377\7\31)e\377" \
+  "\33,f\377\35.g\377\40""0i\377\"2k\377$4l\377&6m\377\205(8o\377\1'7n\377" \
+  "\205(8o\377\1'7o\377\203(8o\377\203'7o\377\203&6o\377\2'7o\377'7n\377" \
+  "\204'7o\377\3#3l\377\37/i\377\36/h\377\203\30)d\377\377\31*e\377\270" \
+  "\31*e\377\203'7o\377\212(8o\377\1'7n\377\203(8o\377\1'7o\377\204'7n\377" \
+  "\5%5l\377\"2k\377\37""0i\377\34-g\377\32+e\377\205\30)d\377\266\31*e" \
+  "\377\206\30)d\377\5\33,f\377\36.h\377!1j\377#4l\377&6n\377\204'7n\377" \
+  "\204(8o\377\1'7o\377\206(8o\377\1'7o\377\203(8o\377\203'7o\377\203&6" \
+  "o\377\2'7o\377'7n\377\203'7o\377\3'7n\377&6m\377\33,f\377\202\31*e\377" \
+  "\203\30)d\377\377\31*e\377\272\31*e\377\202'7o\377\204&6o\377\204'7o" \
+  "\377\220(8o\377\16)8o\377(8o\377&6n\377$4l\377\"3k\377\40""1i\377\36" \
+  "/h\377\35.h\377\34-g\377\33,f\377\33+f\377\32+f\377\32*e\377\30*e\377" \
+  "\220\30)d\377\206\31*e\377\1\30)e\377\220\30)d\377\15\31*e\377\32+e\377" \
+  "\32+f\377\33,f\377\34-g\377\35-g\377\36.h\377\37/i\377!1j\377#3l\377" \
+  "%5m\377'7n\377)9o\377\205(8o\377\1'7n\377\207(8o\377\1'7o\377\204(8o" \
+  "\377\204'7o\377\203&6o\377\4'7o\377'7n\377'7o\377&6o\377\203'7o\377\4" \
+  "#3l\377!1j\377\36/h\377\27(d\377\202\30)d\377\377\31*e\377\277\31*e\377" \
+  "\2'7o\377&6o\377\202'7o\377\2'7n\377'7o\377\203&6o\377\205'7o\377\203" \
+  "(8o\377\1'7o\377\210(8o\377\1'7n\377\206(8o\377\205'7n\377\202&6n\377" \
+  "\20&6m\377%5l\377#3l\377\"2k\377\40""1j\377\36/i\377\35.h\377\35-g\377" \
+  "\34,g\377\33-g\377\33,f\377\33+f\377\32+f\377\32*e\377\31*e\377\30)e" \
+  "\377\207\30)d\377\202\31*e\377\3\32+e\377\33+f\377\32,f\377\202\33,g" \
+  "\377\7\34-g\377\35-h\377\36.h\377\37/i\377!1j\377\"3l\377$5l\377\202" \
+  "&6m\377\202&6n\377\204'7n\377\206(8o\377\1'7n\377\211(8o\377\1'7o\377" \
+  "\204(8o\377\204'7o\377\204&6o\377\10'7o\377'7n\377'7o\377&6o\377'7o\377" \
+  "'7n\377(8n\377!1j\377\202\32+e\377\1\31*e\377\202\30)d\377\377\31*e\377" \
+  "\302\31*e\377\1\40""1i\377\202#4k\377\1&6n\377\203'7o\377\1&6o\377\202" \
+  "'7o\377\1'7n\377\202'7o\377\203&6o\377\205'7o\377\205(8o\377\1'7o\377" \
+  "\215(8o\377\1'7n\377\215(8o\377\202)8o\377\1)9o\377\202(8o\377\3(8n\377" \
+  "(8o\377)9o\377\203)8o\377\233(8o\377\1'7o\377\205(8o\377\205'7o\377\204" \
+  "&6o\377\2'7o\377'7n\377\202'7o\377\1&6o\377\203'7o\377\7%5m\377#3k\377" \
+  "$4l\377\34-f\377\27(d\377\27)d\377\30)d\377\377\31*e\377\307\31*e\377" \
+  "\203\30)d\377\10\33,f\377\34-g\377\33,f\377%5n\377(8n\377(7n\377'7n\377" \
+  "&6o\377\205'7o\377\205&6o\377\205'7o\377\206(8o\377\1'7o\377\230(8o\377" \
+  "\1(8n\377\202(8o\377\2(8n\377'7o\377\237(8o\377\205'7o\377\205&6o\377" \
+  "\204'7o\377\11&6o\377'7o\377'7n\377(7n\377(8o\377\"2k\377\34,f\377\34" \
+  "-g\377\32+e\377\203\30)d\377\377\31*e\377\320\31*e\377\202\30)d\377\3" \
+  "\27)d\377\35.g\377%5m\377\202%5l\377\2&6n\377'7o\377\202'7n\377\2'7o" \
+  "\377&6o\377\203'7o\377\1'7n\377\202'7o\377\207&6o\377\207'7o\377\214" \
+  "(8o\377\1'7o\377\220(8o\377\1'7o\377\213(8o\377\210'7o\377\206&6o\377" \
+  "\202'7o\377\1'7n\377\203'7o\377\2&6o\377'7o\377\202'7n\377\2'7o\377%" \
+  "5m\377\202%5l\377\1#3k\377\204\30)d\377\377\31*e\377\331\31*e\377\204" \
+  "\30)d\377\2\33,f\377\36/h\377\202\36.h\377\1$4l\377\203(7o\377\213'7" \
+  "o\377\207&6o\377\214'7o\377\222(8o\377\214'7o\377\207&6o\377\203'7o\377" \
+  "\1'7n\377\203'7o\377\1&6o\377\202'7o\377\202(7o\377\2(8o\377\37""0i\377" \
+  "\202\36.h\377\1\36/h\377\205\30)d\377\377\31*e\377\344\31*e\377\204\30" \
+  ")d\377\1\33,g\377\204&6m\377\202&6n\377\205'7n\377\1&6o\377\220'7o\377" \
+  "\223&6o\377\211'7o\377\1'7n\377\205'7o\377\1&6o\377\202'7o\377\204'7" \
+  "n\377\202&6n\377\203&6m\377\2$4l\377\31*e\377\204\30)d\377\377\31*e\377" \
+  "\360\31*e\377\205\30)d\377\2\31*d\377\35.h\377\203\40""1i\377\2\40""0" \
+  "i\377#3k\377\212'7o\377\1&6o\377\213'7o\377\1'7n\377\207'7o\377\1'7n" \
+  "\377\225'7o\377\2&6n\377!1j\377\203\40""1i\377\3\40""0j\377\32+f\377" \
+  "\27(d\377\205\30)d\377\377\31*e\377\371\31*e\377\206\30)d\377\211\31" \
+  "*e\377\2\36/h\377%5m\377\214'7n\377\211'7o\377\214'7n\377\2$4m\377\36" \
+  "/g\377\211\31*e\377\205\30)d\377\377\31*e\377\377\31*e\377\217\31*e\377" \
+  "\202\30)d\377\216\27)d\377\4\30)d\377\33,e\377\33,f\377\31*e\377\217" \
+  "\27)d\377\202\30)d\377\377\31*e\377\251\31*e\377\202\377\377\377\377" \
+  "\203\31*e\377\202\377\377\377\377\374\31*e\377\204\30)d\377\377\31*e" \
+  "\377\225\31*e\377\202\377\377\377\377\243\31*e\377\202\377\377\377\377" \
+  "\203\31*e\377\202\377\377\377\377\377\31*e\377\377\31*e\377\226\31*e" \
+  "\377\202\377\377\377\377\243\31*e\377\202\377\377\377\377\377\31*e\377" \
+  "\377\31*e\377\233\31*e\377\202\377\377\377\377\243\31*e\377\202\377\377" \
+  "\377\377\377\31*e\377\377\31*e\377\233\31*e\377\202\377\377\377\377\210" \
+  "\31*e\377\3\36/h\377\204\215\254\377\324\327\342\377\202\366\367\371" \
+  "\377\3\324\327\342\377\202\213\253\377\35.h\377\203\31*e\377\6Wc\216" \
+  "\377\273\300\321\377\361\362\365\377\366\367\371\377\313\317\334\377" \
+  "Ua\215\377\204\31*e\377\6""6Ex\377\267\275\317\377\365\365\370\377\361" \
+  "\362\365\377\245\254\303\377#4l\377\202\377\377\377\377\203\31*e\377" \
+  "\202\377\377\377\377\203\31*e\377\202\377\377\377\377\5$4l\377\253\261" \
+  "\306\377\365\366\370\377\355\357\363\377\223\233\267\377\204\31*e\377" \
+  "\6""8Gz\377\271\276\320\377\365\365\370\377\362\363\366\377\246\255\303" \
+  "\377$4l\377\202\377\377\377\377\377\31*e\377\377\31*e\377\202\377\377" \
+  "\377\377\207\31*e\377\2\37/i\377\307\313\331\377\206\377\377\377\377" \
+  "\2\304\310\327\377\35.h\377\202\31*e\377\205\377\377\377\377\2\372\372" \
+  "\373\377GT\203\377\202\31*e\377\2*9p\377\345\347\356\377\204\377\377" \
+  "\377\377\1\270\275\317\377\202\377\377\377\377\203\31*e\377\202\377\377" \
+  "\377\377\203\31*e\377\202\377\377\377\377\1\266\274\316\377\204\377\377" \
+  "\377\377\1z\204\246\377\202\31*e\377\2+:q\377\350\352\357\377\204\377" \
+  "\377\377\377\1\271\276\320\377\202\377\377\377\377\377\31*e\377\377\31" \
+  "*e\377\202\377\377\377\377\207\31*e\377\4\204\215\254\377\377\377\377" \
+  "\377\357\360\364\377hs\232\377\202#4l\377\4it\232\377\360\361\365\377" \
+  "\377\377\377\377\202\213\253\377\202\31*e\377\7\263\270\314\377FS\203" \
+  "\377\36/h\3772Au\377\257\265\311\377\377\377\377\377\257\265\311\377" \
+  "\202\31*e\377\7\224\234\267\377\377\377\377\377\337\341\351\377IW\205" \
+  "\377\36/h\377KX\206\377\341\343\353\377\202\377\377\377\377\203\31*e" \
+  "\377\202\377\377\377\377\203\31*e\377\202\377\377\377\377\6\315\321\335" \
+  "\3779Hz\377\"2k\377\234\243\275\377\377\377\377\377\320\323\337\377\202" \
+  "\31*e\377\7\226\236\270\377\377\377\377\377\336\340\351\377IW\205\377" \
+  "\36/h\377IW\205\377\337\341\351\377\202\377\377\377\377\377\31*e\377" \
+  "\377\31*e\377\202\377\377\377\377\207\31*e\377\3\325\330\343\377\377" \
+  "\377\377\377gr\231\377\204\31*e\377\3ju\233\377\377\377\377\377\323\326" \
+  "\342\377\206\31*e\377\3'7n\377\377\377\377\377\344\346\355\377\202\31" \
+  "*e\377\3\332\335\346\377\377\377\377\377Xd\217\377\203\31*e\377\1Yf\220" \
+  "\377\202\377\377\377\377\203\31*e\377\202\377\377\377\377\203\31*e\377" \
+  "\202\377\377\377\377\1DR\201\377\202\31*e\377\3,<r\377\377\377\377\377" \
+  "\365\365\370\377\202\31*e\377\3\333\336\347\377\377\377\377\377Wc\216" \
+  "\377\203\31*e\377\1Xd\217\377\202\377\377\377\377\377\31*e\377\377\31" \
+  "*e\377\202\377\377\377\377\207\31*e\377\3\367\370\372\377\377\377\377" \
+  "\377\"3k\377\204\31*e\377\10#4l\377\377\377\377\377\366\367\371\377\31" \
+  "*e\377\33,f\377\201\212\253\377\323\326\342\377\365\366\370\377\203\377" \
+  "\377\377\377\1\371\371\373\377\202\31*e\377\3\370\371\372\377\377\377" \
+  "\377\377!1j\377\203\31*e\377\1\"2k\377\202\377\377\377\377\203\31*e\377" \
+  "\202\377\377\377\377\203\31*e\377\202\377\377\377\377\1\33,f\377\203" \
+  "\31*e\377\202\377\377\377\377\202\31*e\377\3\370\371\372\377\377\377" \
+  "\377\377!1j\377\203\31*e\377\1\"2k\377\202\377\377\377\377\377\31*e\377" \
+  "\377\31*e\377\202\377\377\377\377\207\31*e\377\3\367\370\372\377\377" \
+  "\377\377\377\"3k\377\204\31*e\377\5#4l\377\377\377\377\377\366\367\371" \
+  "\377\31*e\377\231\240\272\377\207\377\377\377\377\202\31*e\377\3\370" \
+  "\371\372\377\377\377\377\377!1j\377\203\31*e\377\1\"2k\377\202\377\377" \
+  "\377\377\203\31*e\377\202\377\377\377\377\203\31*e\377\202\377\377\377" \
+  "\377\204\31*e\377\202\377\377\377\377\202\31*e\377\3\370\371\372\377" \
+  "\377\377\377\377!1j\377\203\31*e\377\1\"2k\377\202\377\377\377\377\377" \
+  "\31*e\377\377\31*e\377\202\377\377\377\377\207\31*e\377\3\325\330\343" \
+  "\377\377\377\377\377eq\230\377\204\31*e\377\12hs\232\377\377\377\377" \
+  "\377\323\326\342\377\31*e\377\356\357\364\377\377\377\377\377gr\231\377" \
+  "&6n\377\31*e\377%5m\377\202\377\377\377\377\202\31*e\377\3\332\335\346" \
+  "\377\377\377\377\377Xd\217\377\203\31*e\377\1Yf\220\377\202\377\377\377" \
+  "\377\203\31*e\377\202\377\377\377\377\203\31*e\377\202\377\377\377\377" \
+  "\204\31*e\377\202\377\377\377\377\202\31*e\377\3\333\336\347\377\377" \
+  "\377\377\377Vb\216\377\203\31*e\377\1Wc\216\377\202\377\377\377\377\377" \
+  "\31*e\377\377\31*e\377\202\377\377\377\377\207\31*e\377\4\204\215\254" \
+  "\377\377\377\377\377\355\357\363\377eq\230\377\202\"3k\377\13gr\231\377" \
+  "\357\360\364\377\377\377\377\377\202\213\253\377\31*e\377\366\367\371" \
+  "\377\377\377\377\377`k\224\377\37/i\3777Fy\377\260\266\312\377\202\377" \
+  "\377\377\377\202\31*e\377\7\224\234\267\377\377\377\377\377\336\340\351" \
+  "\377IW\205\377\35.h\377JW\206\377\341\343\353\377\202\377\377\377\377" \
+  "\203\31*e\377\202\377\377\377\377\203\31*e\377\202\377\377\377\377\204" \
+  "\31*e\377\202\377\377\377\377\202\31*e\377\7\227\236\271\377\377\377" \
+  "\377\377\335\340\350\377GU\204\377\35.h\377GU\204\377\335\340\350\377" \
+  "\202\377\377\377\377\377\31*e\377\377\31*e\377\210\377\377\377\377\3" \
+  "\31*e\377\37/i\377\307\314\332\377\206\377\377\377\377\4\305\311\330" \
+  "\377\36/h\377\31*e\377\265\273\316\377\204\377\377\377\377\1\272\277" \
+  "\321\377\202\377\377\377\377\202\31*e\377\2*9p\377\345\347\356\377\204" \
+  "\377\377\377\377\1\270\275\317\377\202\377\377\377\377\203\31*e\377\202" \
+  "\377\377\377\377\203\31*e\377\202\377\377\377\377\204\31*e\377\202\377" \
+  "\377\377\377\202\31*e\377\2,<r\377\351\352\360\377\204\377\377\377\377" \
+  "\3\272\277\321\377\377\377\377\377\373\373\374\377\203\31*e\377\202\377" \
+  "\377\377\377\204\31*e\377\202\377\377\377\377\204\31*e\377\202\377\377" \
+  "\377\377\377\31*e\377\356\31*e\377\210\377\377\377\377\202\31*e\377\10" \
+  "\37/i\377\204\215\254\377\325\330\343\377\367\370\372\377\366\367\371" \
+  "\377\325\330\343\377\203\214\254\377\36/h\377\202\31*e\377\6+:q\377\265" \
+  "\272\315\377\365\366\370\377\360\361\365\377\250\256\305\377&6n\377\202" \
+  "\377\377\377\377\203\31*e\377\6""6Ex\377\270\275\317\377\365\365\370" \
+  "\377\356\357\364\377\244\253\302\377$4l\377\202\377\377\377\377\203\31" \
+  "*e\377\202\377\377\377\377\203\31*e\377\202\377\377\377\377\204\31*e" \
+  "\377\202\377\377\377\377\203\31*e\377\10:H{\377\273\300\321\377\365\366" \
+  "\370\377\362\363\366\377\247\255\304\3777Fy\377\377\377\377\377\354\355" \
+  "\362\377\203\31*e\377\202\377\377\377\377\204\31*e\377\202\377\377\377" \
+  "\377\204\31*e\377\202\377\377\377\377\377\31*e\377\377\31*e\377\256\31" \
+  "*e\377\3p{\237\377\377\377\377\377\305\311\330\377\377\31*e\377\377\31" \
+  "*e\377\272\31*e\377\10\267\275\317\377MZ\210\377\37/i\377&6n\377kv\233" \
+  "\377\360\361\365\377\377\377\377\377z\204\246\377\377\31*e\377\377\31" \
+  "*e\377\272\31*e\377\206\377\377\377\377\2\321\324\340\377\36/h\377\377" \
+  "\31*e\377\377\31*e\377\272\31*e\377\7[g\221\377\300\305\325\377\361\362" \
+  "\365\377\371\371\373\377\337\341\351\377\225\235\270\377%5m\377\256\31" \
+  "*e\377")
+
+
diff --git a/utils/psplash/files/psplash.init b/utils/psplash/files/psplash.init
new file mode 100755 (executable)
index 0000000..5ccced2
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+START=05
+
+start() {
+    psplash &
+}
+
+stop() {
+    killall psplash
+}
diff --git a/utils/psplash/patches/000-adjust-for-openwrt.patch b/utils/psplash/patches/000-adjust-for-openwrt.patch
new file mode 100644 (file)
index 0000000..38f3c91
--- /dev/null
@@ -0,0 +1,42 @@
+--- psplash.orig/psplash.c     2009-05-11 15:45:57.000000000 +0200
++++ psplash/psplash.c  2009-05-13 00:21:20.000000000 +0200
+@@ -19,11 +19,11 @@
+  */
+ #include "psplash.h"
+-#include "psplash-hand-img.h"
++#include "psplash-owrt-img.h"
+ #include "psplash-bar-img.h"
+ #include "radeon-font.h"
+-#define MSG ""
++#define MSG "Loading - please wait..."
+ void
+ psplash_exit (int signum)
+@@ -263,17 +263,17 @@
+         goto fb_fail;
+   }
+-  /* Clear the background with #ecece1 */
+-  psplash_fb_draw_rect (fb, 0, 0, fb->width, fb->height, 0xec, 0xec, 0xe1);
++  /* Clear the background with #192a65 */
++  psplash_fb_draw_rect (fb, 0, 0, fb->width, fb->height, 0x19, 0x2a, 0x65);
+   /* Draw the OH logo  */
+   psplash_fb_draw_image (fb, 
+-                       (fb->width  - HAND_IMG_WIDTH)/2, 
+-                       (fb->height - HAND_IMG_HEIGHT)/2, 
+-                       HAND_IMG_WIDTH,
+-                       HAND_IMG_HEIGHT,
+-                       HAND_IMG_BYTES_PER_PIXEL,
+-                       HAND_IMG_RLE_PIXEL_DATA);
++                       0, 
++                       0, 
++                       OWRT_IMG_WIDTH,
++                       OWRT_IMG_HEIGHT,
++                       OWRT_IMG_BYTES_PER_PIXEL,
++                       OWRT_IMG_RLE_PIXEL_DATA);
+   /* Draw progress bar border */
+   psplash_fb_draw_image (fb, 
diff --git a/utils/psplash/patches/001-hide-msgfield-and-progressbar.patch b/utils/psplash/patches/001-hide-msgfield-and-progressbar.patch
new file mode 100644 (file)
index 0000000..e62213e
--- /dev/null
@@ -0,0 +1,25 @@
+diff -ruN psplash.x/psplash.c psplash/psplash.c
+--- psplash.x/psplash.c        2009-05-12 10:11:25.000000000 +0200
++++ psplash/psplash.c  2009-05-12 10:24:09.000000000 +0200
+@@ -276,17 +276,17 @@
+                        OWRT_IMG_RLE_PIXEL_DATA);
+   /* Draw progress bar border */
+-  psplash_fb_draw_image (fb, 
++  /* psplash_fb_draw_image (fb, 
+                        (fb->width  - BAR_IMG_WIDTH)/2, 
+                        fb->height - (fb->height/6), 
+                        BAR_IMG_WIDTH,
+                        BAR_IMG_HEIGHT,
+                        BAR_IMG_BYTES_PER_PIXEL,
+-                       BAR_IMG_RLE_PIXEL_DATA);
++                       BAR_IMG_RLE_PIXEL_DATA); */
+-  psplash_draw_progress (fb, 0);
++  // psplash_draw_progress (fb, 0);
+-  psplash_draw_msg (fb, MSG);
++  // psplash_draw_msg (fb, MSG);
+   psplash_main (fb, pipe_fd, 0);
diff --git a/utils/pv/Makefile b/utils/pv/Makefile
new file mode 100644 (file)
index 0000000..d75074d
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2008 David Cooper
+# Copyright (C) 2008-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:=pv
+PKG_VERSION:=1.5.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.ivarch.com/programs/sources/
+PKG_MD5SUM:=fdcd0be1e333602f82a70921b87976b8
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pv
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Shell pipeline element to meter data passing through
+  URL:=http://www.ivarch.com/programs/pv.shtml
+endef
+
+define Package/pv/description
+ Pipe Viewer is a terminal-based tool for monitoring the progress of data
+ through a pipeline. It can be inserted into any normal pipeline between
+ two processes to give a visual indication of how quickly data is passing
+ through, how long it has taken, how near to completion it is, and an
+ estimate of how long it will be until completion.
+endef
+
+define Package/pv/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pv $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,pv))
+
diff --git a/utils/pwcrypt/Makefile b/utils/pwcrypt/Makefile
new file mode 100644 (file)
index 0000000..1b7674e
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2010 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:=pwcrypt
+PKG_VERSION:=1.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://xjack.org/pwcrypt/downloads
+PKG_MD5SUM:=381a60c8debe5b21c935b19684de
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pwcrypt
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=A utility to create crypted passwords from plaintext
+  URL:=http://xjack.org/pwcrypt
+endef
+
+define Package/pwcrypt/description
+ A wrapper for the unix crypt() function. Supports crypt and MD5 hashing
+endef
+
+define Package/pwcrypt/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pwcrypt $(1)/sbin/
+endef
+
+$(eval $(call BuildPackage,pwcrypt))
diff --git a/utils/pwgen/Makefile b/utils/pwgen/Makefile
new file mode 100644 (file)
index 0000000..84e40c6
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pwgen
+PKG_VERSION:=2.06
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=935aebcbe610fbc9de8125e7b7d71297
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/pwgen
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Automatic Password generator
+  URL:=http://sourceforge.net/projects/pwgen/
+endef
+
+define Package/pwgen/description
+       pwgen generates random, meaningless but pronounceable passwords.
+       These passwords contain either only lowercase letters, or upper
+       and lower case mixed, or digits thrown in.
+       Uppercase letters and digits are placed in a way that eases
+       remembering their position when memorizing only the word.
+
+       E.g. to generate a WPA preshared-key do:
+       pwgen -c -n -s 63 1
+endef
+
+# uses GNU configure
+
+define Package/pwgen/install   
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/pwgen $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,pwgen))
diff --git a/utils/rcs/Makefile b/utils/rcs/Makefile
new file mode 100644 (file)
index 0000000..12d6338
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2006-2009 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:=rcs
+PKG_VERSION:=5.7
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
+PKG_MD5SUM:=4c8e896f2d2446fa593c6f1601a4fb75
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The GNU Revision Control System
+  URL:=http://www.gnu.org/software/$(PKG_NAME)/
+endef
+
+define Package/$(PKG_NAME)/desctiption
+ The Revision Control System (RCS) manages multiple revisions of files. RCS
+ automates the storing, retrieval, logging, identification, and merging of
+ revisions. RCS is useful for text that is revised frequently, for example
+ programs, documentation, graphics, papers, and form letters.
+endef
+
+define Package/$(PKG_NAME)/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/{ci,co,ident,merge,rcs,rcsclean,rcsdiff,rcsmerge,rlog} $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rcsfreeze.sh $(1)/usr/bin/rcsfreeze
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/utils/rcs/patches/000-debian.patch b/utils/rcs/patches/000-debian.patch
new file mode 100644 (file)
index 0000000..96df338
--- /dev/null
@@ -0,0 +1,4879 @@
+--- rcs-5.7.orig/debian/rules
++++ rcs-5.7/debian/rules
+@@ -0,0 +1,91 @@
++#!/usr/bin/make -f
++# Derived from: Sample debian.rules file - for GNU Hello (1.3).
++# Copyright 1994,1995 by Ian Jackson.
++# I hereby give you perpetual unlimited permission to copy,
++# modify and relicense this file, provided that you do not remove
++# my name from the file itself.  (I assert my moral right of
++# paternity under the Copyright, Designs and Patents Act 1988.)
++# This file may have to be extensively modified
++
++# There used to be `source' and `diff' targets in this file, and many
++# packages also had `changes' and `dist' targets.  These functions
++# have been taken over by dpkg-source, dpkg-genchanges and
++# dpkg-buildpackage in a package-independent way, and so these targets
++# are obsolete.
++
++package=rcs
++
++CFLAGS = -g
++
++ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
++CFLAGS += -O0
++else
++CFLAGS += -O2
++endif
++
++# The next section may have to be extensively modified
++
++build:
++      $(checkdir)
++      ./configure --prefix=/usr --with-diffutils
++      $(MAKE) CFLAGS="$(CFLAGS)"
++      groff -t -p -Tps -ms rcs.ms >rcs.ps
++      touch build
++
++clean:
++      $(checkdir)
++      -rm -f build
++      [ ! -f Makefile ] || $(MAKE) -i distclean
++      -rm -f *.ps man/index.db man/rcsfile.5
++      -rm -rf debian/tmp debian/*~ debian/files autom4te.cache \
++              debian/substvars
++
++binary-indep: checkroot build
++      $(checkdir)
++# There are no architecture-independent files to be uploaded
++# generated by this package.  If there were any they would be
++# made here.
++
++binary-arch:  checkroot build
++      -rm -rf debian/tmp
++      install -d debian/tmp/DEBIAN
++      install -d debian/tmp/usr/share/doc/$(package)
++      $(MAKE) prefix=`pwd`/debian/tmp/usr install
++ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
++      for f in debian/tmp/usr/bin/*; do \
++              strip -s -R.comment $$f; \
++      done
++endif
++      cp debian/copyright debian/tmp/usr/share/doc/$(package)/
++      cp debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
++      cp ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
++      gzip -9f debian/tmp/usr/share/doc/$(package)/changelog*
++      cp *.ps debian/tmp/usr/share/doc/$(package)/
++      gzip -9f debian/tmp/usr/share/doc/$(package)/*.ps
++      mv debian/tmp/usr/man debian/tmp/usr/share/man
++      gzip -9f debian/tmp/usr/share/man/man*/*
++      (cd debian/tmp; find . -type f ! -regex '.*/DEBIAN/.*' \
++              -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums)
++      dpkg-shlibdeps src/rcs
++      dpkg-gencontrol -isp
++      chown -R root.root debian/tmp
++      chmod -R u+w debian/tmp
++      chmod -R g-ws debian/tmp
++      dpkg --build debian/tmp ..
++
++define checkdir
++      test -f man/rcs.1
++endef
++
++# Below here is fairly generic really
++
++binary:               binary-indep binary-arch
++
++source diff:
++      @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
++
++checkroot:
++      $(checkdir)
++      test root = "`whoami`"
++
++.PHONY: binary binary-arch binary-indep clean checkroot
+--- rcs-5.7.orig/debian/control
++++ rcs-5.7/debian/control
+@@ -0,0 +1,16 @@
++Source: rcs
++Section: devel
++Priority: optional
++Maintainer: Romain Francoise <rfrancoise@debian.org>
++Standards-Version: 3.7.2
++Build-Depends: groff, autoconf
++
++Package: rcs
++Architecture: any
++Depends: ${shlibs:Depends}
++Description: The GNU Revision Control System
++ The Revision Control System (RCS) manages multiple
++ revisions of files. RCS automates the storing, retrieval,
++ logging, identification, and merging of revisions. RCS is
++ useful for text that is revised frequently, for example
++ programs, documentation, graphics, papers, and form letters.
+--- rcs-5.7.orig/debian/copyright
++++ rcs-5.7/debian/copyright
+@@ -0,0 +1,28 @@
++This is Debian GNU/Linux's prepackaged version of the FSF's Revision
++Control System (RCS) utilities.  These utilities allow you to keep
++multiple revisions of one or more files in a very compact manner.  RCS
++is similar to, and in most respects better than, the non-free Source
++Code Control System (SCCS).
++
++This package was assembled by Sven Rudolph <sr1@inf.tu-dresden.de>
++from the GNU sources available from prep.ai.mit.edu (and its numerous
++mirrors) as /pub/gnu/rcs-5.7.tar.gz. It is currently maintained by
++Romain Francoise <rfrancoise@debian.org>.
++
++The upstream URL is: http://www.gnu.org/software/rcs/
++
++Copyright (C) 1991,1992,1993 Free Software Foundation, Inc.
++
++RCS 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.
++
++RCS 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.
++
++On Debian GNU/Linux systems, the complete text of the GNU General
++Public License can be found in `/usr/share/common-licenses/GPL'.
++
+--- rcs-5.7.orig/debian/changelog
++++ rcs-5.7/debian/changelog
+@@ -0,0 +1,216 @@
++rcs (5.7-20) unstable; urgency=low
++
++  * debian/control: Add support for DEB_BUILD_OPTIONS (closes: #437885).
++
++ -- Romain Francoise <rfrancoise@debian.org>  Tue, 14 Aug 2007 21:24:54 +0200
++
++rcs (5.7-19) unstable; urgency=low
++
++  * debian/control: Bump Standards-Version to 3.7.2, no changes needed.
++  * debian/copyright: Mention the current upstream URL (closes: #436739).
++  * debian/rules:
++    + Don't ignore errors from 'make distclean'.
++    + Generate DEBIAN/md5sums.
++  * Apply patch from Brendan O'Dea <bod@debian.org> adding support for
++    diff's '-U' option to rcsdiff (closes: #428445).
++
++ -- Romain Francoise <rfrancoise@debian.org>  Sun, 12 Aug 2007 18:40:04 +0200
++
++rcs (5.7-18) unstable; urgency=low
++
++  * Apply patch from Mark D. Baushke <mdb@gnu.org> adding support for the
++    new 'commitid' phrase used by newer version of CVS and CVSNT.  Note
++    that this patch does not include support for *generating* the ids at
++    check in time; it only makes RCS recognize them (closes: #352527).
++
++ -- Romain Francoise <rfrancoise@debian.org>  Tue, 14 Feb 2006 22:41:33 +0100
++
++rcs (5.7-17) unstable; urgency=low
++
++  * Apply patch from Aaron S. Hawley making the diff strategy of rcsdiff a
++    bit more subtle: previously rcsdiff considered any long option as a
++    case where diff(1) can produce output when the revisions are
++    identical, when in fact it is only the case if either the
++    --side-by-side or --ifdef options are used (closes: #334004).
++
++  * Patch man/co.1 to not use 'asteriskmath', thanks to LI Daobing
++    (closes: #345507).
++
++  * debian/control: Bump Standards-Version to 3.6.2.2, no changes needed.
++  * debian/changelog: Change formatting of entries from 1995 and 1996 to
++    avoid lintian warnings.
++  * debian/rules: `install' no longer strips .comment sections from
++    binaries (since version 5.93-1), so revert previous fix and strip these
++    sections manually.
++
++ -- Romain Francoise <rfrancoise@debian.org>  Sun,  5 Feb 2006 16:34:21 +0100
++
++rcs (5.7-16) unstable; urgency=low
++
++  * Tenth anniversary release: RCS 5.7 was released on June 16th, 1995.
++
++  * rcs.c: Check delta pointer in scanlogtext() before dereferencing it to
++    prevent a segmentation fault in some rare cases (discovered while
++    investigating #69193).
++
++  * Ship docs in PostScript format (instead of DVI).  Drop the ``Functions
++    of RCS'' paper since it's quite obsolete nowadays.
++
++  * debian/rules: Delete substvars file in clean target.
++  * debian/changelog: Facelift previous entry.
++
++ -- Romain Francoise <rfrancoise@debian.org>  Thu, 16 Jun 2005 08:14:01 +0200
++
++rcs (5.7-15) unstable; urgency=low
++
++  * Adopting this package with Mark's blessing.
++  * debian/control:
++    + Bump Standard-Version to 3.6.1.0.
++    + Update maintainer contact info.
++  * debian/copyright: Ditto.
++  * debian/rules:
++    + Adjust CFLAGS to include -g and remove useless -I directive.
++    + Remove LDFLAGS.
++
++  * Patch upstream Makefile.in to use install -s (which has the nice
++    effect of also deleting .comment sections from the binaries).
++
++  * Patch man/rlog.1 to document option -q which does nothing, it's
++    provided for consistency with other commands (closes: #69257).
++
++  * Remove a few unneeded files from the Debian diff (.orig files, Emacs
++    lock files).
++
++ -- Romain Francoise <rfrancoise@debian.org>  Wed, 11 May 2005 17:51:01 +0200
++
++rcs (5.7-14) unstable; urgency=high
++
++  * Fixes tmp file race (patch from OpenBSD) (Closes: #291542)
++
++ -- Mark Baker <mark@mnb.org.uk>  Fri, 21 Jan 2005 18:16:20 +0000
++
++rcs (5.7-13.3) unstable; urgency=high
++
++  * NMU
++  * Add build-dep on autoconf. Closes: #246566.
++  * Fix up quoting in src/Makefile.in to make $SHELL not complain, as \"
++    is not interpolated inside single-quoted strings.
++  * Make ident accept numbers as well as letters in identifiers.  
++    Closes: #157891
++  * Remove emacs variables from the changelog as they are no longer
++    needed.
++  * Add -isp to the dpkg-gencontrol call in debian/rules to get Section
++    and Priority included.  Closes: #190383.
++
++ -- Tollef Fog Heen <tfheen@debian.org>  Thu, 29 Jul 2004 19:09:32 +0200
++
++rcs (5.7-13.2) unstable; urgency=low
++
++  * NMU
++  * can build now as root. Closes: #249106
++  * priority dumped down to optional. Closes: #64438
++  * fixed spelling error in debian/copyright, and location of the GPL.
++
++ -- Andreas Barth <aba@not.so.argh.org>  Wed, 26 May 2004 22:21:05 +0200
++
++rcs (5.7-13.1) unstable; urgency=low
++
++  * NMU.
++  * Rebuild so that the .dsc file will have Build-Depends.
++    Closes: #187853, #176344.
++  * Remove /usr/doc symlink.
++
++ -- Daniel Schepler <schepler@debian.org>  Mon, 28 Jul 2003 16:28:32 -0700
++
++rcs (5.7-13) unstable; urgency=low 
++
++  * debian/rules: install docs and manpages in /usr/share, as in FHS
++  * debian/control: standards version 3.1.0
++  * debian/rules: format docs into dvi instead of leaving groff source. I
++    chose dvi as it is easier to view on screen than PS (Closes: 42277)
++
++ -- Mark Baker <mbaker@iee.org>  Sun, 28 Nov 1999 18:31:21 +0000
++
++rcs (5.7-12) unstable; urgency=low 
++
++  * man/Makefile: use sed filter to fix .lf requests on output of pic,
++    so zsoelim doesn't complain about them (#26150)
++  * debian/rules: clean target deletes rcsfile.5 so it is always rebuilt
++    using fix above
++
++ -- Mark Baker <mbaker@iee.org>  Mon,  5 Jul 1999 23:24:17 +0100
++
++rcs (5.7-11) unstable; urgency=low 
++
++  * Fixed temp file security hole in rcsfreeze script (#27845)
++
++ -- Mark Baker <mbaker@iee.org>  Wed, 14 Oct 1998 22:43:47 +0100
++
++rcs (5.7-10) unstable; urgency=low 
++
++  * Included rcsfreeze script (#26743)
++
++ -- Mark Baker <mbaker@iee.org>  Wed, 16 Sep 1998 20:57:00 +0000
++
++rcs (5.7-9) unstable; urgency=low 
++
++  * Fixed permissions
++
++ -- Mark Baker <mbaker@iee.org>  Mon, 16 Feb 1998 00:07:52 +0000
++
++rcs (5.7-8) unstable; urgency=low 
++
++  * Updated standards-version to 2.4.0.0 (no changes)
++
++ -- Mark Baker <mbaker@iee.org>  Tue, 10 Feb 1998 10:54:36 +0000
++
++rcs (5.7-7) unstable; urgency=low 
++
++  * Corrected maintainer field in debian/control
++  * Flushed configure cache and recompiled, to fix bug #11305/#11308)
++
++ -- Mark Baker <mbaker@iee.org>  Thu, 17 Jul 1997 10:54:36 +0100
++
++rcs (5.7-6) unstable; urgency=low 
++
++  * Renamed changelog.upstream to changelog, as per policy (fixes #9657)
++
++ -- Mark Baker <mbaker@iee.org>  Sat, 12 Jul 1997 16:55:37 +0100
++
++rcs (5.7-5) unstable; urgency=low 
++
++  * New maintainer
++  * Compiled with libc6
++  * Use canonical path for sendmail (configure.in changed)
++
++ -- Mark Baker <mbaker@iee.org>  Fri, 11 Jul 1997 21:24:48 +0100
++
++rcs (5.7-4) unstable; urgency=low 
++
++  * Updated to Standards-Version 2.1.2.2.
++
++ -- Sven Rudolph <sr1@inf.tu-dresden.de>  Sun, 26 Jan 1997 22:34:57 +0100
++
++rcs (5.7-3) unstable; urgency=low
++
++  * debian.rules: added multi-architecture support
++
++  * debian.control: added Priority: and Section:
++
++  * debian.control: corrected extended description (Bug#3619)
++
++ -- Sven Rudolph <sr1@inf.tu-dresden.de>  Wed, 24 Jul 1996 23:48:20 +0100
++
++rcs (5.7-2) unstable; urgency=low
++
++  * rebuilt for elf
++
++ -- Sven Rudolph <sr1@inf.tu-dresden.de>  Thu, 23 Nov 1995 23:27:13 +0100
++
++rcs (5.7-1) unstable; urgency=low
++
++  * created new Debian GNU/Linux package maintenance system files
++  * updated from rcs5.6.0.1 to rcs-5.7
++  * received this package from Robert Sanders <Robert.Sanders@linux.org>
++
++ -- Sven Rudolph <sr1@inf.tu-dresden.de>  Tue, 5 Sep 1995 04:38:07 +0100
+--- rcs-5.7.orig/man/co.1
++++ rcs-5.7/man/co.1
+@@ -597,7 +597,7 @@
+ .RB \*(lq "//\ " \*(rq.
+ This is useful for languages with comments that go to the end of the line.
+ The convention for other languages is to use a
+-.RB \*(lq " \(** " \(rq
++.RB \*(lq " * " \(rq
+ prefix inside a multiline comment.
+ For example, the initial log comment of a C program
+ conventionally is of the following form:
+@@ -606,19 +606,19 @@
+ .nf
+ .ft 3
+ .ne 3
+-/\(**
++/*
+ .in +\w'/'u
+-\(** $\&Log$
+-\(**/
++* $\&Log$
++*/
+ .in
+ .ft
+ .fi
+ .RE
+ .LP
+ For backwards compatibility with older versions of \*r, if the log prefix is
+-.B /\(**
++.B /*
+ or
+-.B (\(**
++.B (*
+ surrounded by optional white space, inserted log lines contain a space
+ instead of
+ .B /
+--- rcs-5.7.orig/man/rlog.1
++++ rcs-5.7/man/rlog.1
+@@ -187,6 +187,10 @@
+ .I logins
+ is omitted, the user's login is assumed.
+ .TP
++.B \-q
++This option has no effect;
++it is provided for consistency with other commands.
++.TP
+ .B \-T
+ This option has no effect;
+ it is present for compatibility with other \*r commands.
+--- rcs-5.7.orig/man/rcsfile.5in
++++ rcs-5.7/man/rcsfile.5in
+@@ -68,6 +68,7 @@
+               \f3state\fP     {\f2id\fP}\f3;\fP
+               \f3branches\fP  {\f2num\fP}*\f3;\fP
+               \f3next\fP      {\f2num\fP}\f3;\fP
++              { \f3commitid\fP \f2id\fP\f3;\fP }
+               { \f2newphrase\fP }*
+ .LP
+ \f2desc\fP    ::=     \f3desc\fP      \f2string\fP
+@@ -127,6 +128,18 @@
+ Dates use the Gregorian calendar; times use UTC.
+ .PP
+ The
++.I commitid
++is followed by an
++.I id
++token. This token is intended to be unique across
++multiple files and is used to help group files as
++being a part of the same logical commit.
++This token must uniquely identify the commit
++operation that was applied to a set of RCS files.
++In particular, it must be unique among all the
++commitids in this file.
++.PP
++The
+ .I newphrase
+ productions in the grammar are reserved for future extensions
+ to the format of \*r files.
+--- rcs-5.7.orig/man/Makefile.in
++++ rcs-5.7/man/Makefile.in
+@@ -44,14 +44,16 @@
+ all default :: rcsfile.5
+ rcsfile.5 : rcsfile.5in
+-      $(PIC) $(PICFLAGS) $(srcdir)/$@in >$@
++      $(PIC) $(PICFLAGS) $(srcdir)/$@in \
++      | sed "s%\.lf \([0-9]*\)%\.lf \1 foo%" >$@
+ check dvi info TAGS ::
+ installdirs :: ../mkinstalldirs
+       -$(srcdir)/../mkinstalldirs $(man1dir) $(man5dir)
+-man1pages = ci co ident merge rcs rcsclean rcsdiff rcsintro rcsmerge rlog
++man1pages = ci co ident merge rcs rcsclean rcsdiff rcsintro rcsmerge rlog \
++              rcsfreeze
+ install :: installdirs
+       -for m in $(man1pages); do \
+--- rcs-5.7.orig/configure
++++ rcs-5.7/configure
+@@ -1,28 +1,288 @@
+ #! /bin/sh
+-
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated automatically using autoconf version 2.4 
+-# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
++# Generated by GNU Autoconf 2.59.
+ #
++# Copyright (C) 2003 Free Software Foundation, Inc.
+ # This configure script is free software; the Free Software Foundation
+ # gives unlimited permission to copy, distribute and modify it.
++## --------------------- ##
++## M4sh Initialization.  ##
++## --------------------- ##
++
++# Be Bourne compatible
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++  emulate sh
++  NULLCMD=:
++  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
++  # is contrary to our usage.  Disable this feature.
++  alias -g '${1+"$@"}'='"$@"'
++elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
++  set -o posix
++fi
++DUALCASE=1; export DUALCASE # for MKS sh
++
++# Support unset when possible.
++if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
++  as_unset=unset
++else
++  as_unset=false
++fi
++
++
++# Work around bugs in pre-3.0 UWIN ksh.
++$as_unset ENV MAIL MAILPATH
++PS1='$ '
++PS2='> '
++PS4='+ '
++
++# NLS nuisances.
++for as_var in \
++  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++  LC_TELEPHONE LC_TIME
++do
++  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++    eval $as_var=C; export $as_var
++  else
++    $as_unset $as_var
++  fi
++done
++
++# Required to use basename.
++if expr a : '\(a\)' >/dev/null 2>&1; then
++  as_expr=expr
++else
++  as_expr=false
++fi
++
++if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
++  as_basename=basename
++else
++  as_basename=false
++fi
++
++
++# Name of the executable.
++as_me=`$as_basename "$0" ||
++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
++       X"$0" : 'X\(//\)$' \| \
++       X"$0" : 'X\(/\)$' \| \
++       .     : '\(.\)' 2>/dev/null ||
++echo X/"$0" |
++    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
++        /^X\/\(\/\/\)$/{ s//\1/; q; }
++        /^X\/\(\/\).*/{ s//\1/; q; }
++        s/.*/./; q'`
++
++
++# PATH needs CR, and LINENO needs CR and PATH.
++# Avoid depending upon Character Ranges.
++as_cr_letters='abcdefghijklmnopqrstuvwxyz'
++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
++as_cr_Letters=$as_cr_letters$as_cr_LETTERS
++as_cr_digits='0123456789'
++as_cr_alnum=$as_cr_Letters$as_cr_digits
++
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++  echo "#! /bin/sh" >conf$$.sh
++  echo  "exit 0"   >>conf$$.sh
++  chmod +x conf$$.sh
++  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
++    PATH_SEPARATOR=';'
++  else
++    PATH_SEPARATOR=:
++  fi
++  rm -f conf$$.sh
++fi
++
++
++  as_lineno_1=$LINENO
++  as_lineno_2=$LINENO
++  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
++  test "x$as_lineno_1" != "x$as_lineno_2" &&
++  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
++  # Find who we are.  Look in the path if we contain no path at all
++  # relative or not.
++  case $0 in
++    *[\\/]* ) as_myself=$0 ;;
++    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
++done
++
++       ;;
++  esac
++  # We did not find ourselves, most probably we were run as `sh COMMAND'
++  # in which case we are not to be found in the path.
++  if test "x$as_myself" = x; then
++    as_myself=$0
++  fi
++  if test ! -f "$as_myself"; then
++    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
++   { (exit 1); exit 1; }; }
++  fi
++  case $CONFIG_SHELL in
++  '')
++    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for as_base in sh bash ksh sh5; do
++       case $as_dir in
++       /*)
++         if ("$as_dir/$as_base" -c '
++  as_lineno_1=$LINENO
++  as_lineno_2=$LINENO
++  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
++  test "x$as_lineno_1" != "x$as_lineno_2" &&
++  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
++           $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
++           $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
++           CONFIG_SHELL=$as_dir/$as_base
++           export CONFIG_SHELL
++           exec "$CONFIG_SHELL" "$0" ${1+"$@"}
++         fi;;
++       esac
++       done
++done
++;;
++  esac
++
++  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
++  # uniformly replaced by the line number.  The first 'sed' inserts a
++  # line-number line before each line; the second 'sed' does the real
++  # work.  The second script uses 'N' to pair each line-number line
++  # with the numbered line, and appends trailing '-' during
++  # substitution so that $LINENO is not a special case at line end.
++  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
++  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
++  sed '=' <$as_myself |
++    sed '
++      N
++      s,$,-,
++      : loop
++      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
++      t loop
++      s,-$,,
++      s,^['$as_cr_digits']*\n,,
++    ' >$as_me.lineno &&
++  chmod +x $as_me.lineno ||
++    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
++   { (exit 1); exit 1; }; }
++
++  # Don't try to exec as it changes $[0], causing all sort of problems
++  # (the dirname of $[0] is not the place where we might find the
++  # original and so on.  Autoconf is especially sensible to this).
++  . ./$as_me.lineno
++  # Exit status is that of the last command.
++  exit
++}
++
++
++case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
++  *c*,-n*) ECHO_N= ECHO_C='
++' ECHO_T='    ' ;;
++  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
++  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
++esac
++
++if expr a : '\(a\)' >/dev/null 2>&1; then
++  as_expr=expr
++else
++  as_expr=false
++fi
++
++rm -f conf$$ conf$$.exe conf$$.file
++echo >conf$$.file
++if ln -s conf$$.file conf$$ 2>/dev/null; then
++  # We could just check for DJGPP; but this test a) works b) is more generic
++  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
++  if test -f conf$$.exe; then
++    # Don't use ln at all; we don't have any links
++    as_ln_s='cp -p'
++  else
++    as_ln_s='ln -s'
++  fi
++elif ln conf$$.file conf$$ 2>/dev/null; then
++  as_ln_s=ln
++else
++  as_ln_s='cp -p'
++fi
++rm -f conf$$ conf$$.exe conf$$.file
++
++if mkdir -p . 2>/dev/null; then
++  as_mkdir_p=:
++else
++  test -d ./-p && rmdir ./-p
++  as_mkdir_p=false
++fi
++
++as_executable_p="test -f"
++
++# Sed expression to map a string onto a valid CPP name.
++as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
++
++# Sed expression to map a string onto a valid variable name.
++as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
++
++
++# IFS
++# We need space, tab and new line, in precisely that order.
++as_nl='
++'
++IFS="         $as_nl"
++
++# CDPATH.
++$as_unset CDPATH
+-# Defaults:
+-ac_help=
++
++# Name of the host.
++# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
++# so uname gets run too.
++ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
++
++exec 6>&1
++
++#
++# Initializations.
++#
+ ac_default_prefix=/usr/local
+-# Any additions from configure.in:
+-ac_help="$ac_help
+-  --with-diffutils        assume GNU diffutils is similarly installed"
++ac_config_libobj_dir=.
++cross_compiling=no
++subdirs=
++MFLAGS=
++MAKEFLAGS=
++SHELL=${CONFIG_SHELL-/bin/sh}
++
++# Maximum number of lines to put in a shell here document.
++# This variable seems obsolete.  It should probably be removed, and
++# only ac_max_sed_lines should be used.
++: ${ac_max_here_lines=38}
++
++# Identity of this package.
++PACKAGE_NAME=
++PACKAGE_TARNAME=
++PACKAGE_VERSION=
++PACKAGE_STRING=
++PACKAGE_BUGREPORT=
++
++ac_unique_file="src/rcsbase.h"
++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DIFF DIFF_SUCCESS DIFF_FAILURE DIFF_TROUBLE DIFFFLAGS DIFF_L DIFF3 DIFF3_BIN ED SENDMAIL PIC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE LIBOBJS LTLIBOBJS'
++ac_subst_files=''
+ # Initialize some variables set by options.
++ac_init_help=
++ac_init_version=false
+ # The variables have the same names as the options, with
+ # dashes changed to underlines.
+-build=NONE
+-cache_file=./config.cache
++cache_file=/dev/null
+ exec_prefix=NONE
+-host=NONE
+ no_create=
+-nonopt=NONE
+ no_recursion=
+ prefix=NONE
+ program_prefix=NONE
+@@ -31,18 +291,31 @@
+ silent=
+ site=
+ srcdir=
+-target=NONE
+ verbose=
+ x_includes=NONE
+ x_libraries=NONE
+-# Initialize some other variables.
+-subdirs=
++# Installation directory options.
++# These are left unexpanded so users can "make install exec_prefix=/foo"
++# and all the variables that are supposed to be based on exec_prefix
++# by default will actually change.
++# Use braces instead of parens because sh, perl, etc. also accept them.
++bindir='${exec_prefix}/bin'
++sbindir='${exec_prefix}/sbin'
++libexecdir='${exec_prefix}/libexec'
++datadir='${prefix}/share'
++sysconfdir='${prefix}/etc'
++sharedstatedir='${prefix}/com'
++localstatedir='${prefix}/var'
++libdir='${exec_prefix}/lib'
++includedir='${prefix}/include'
++oldincludedir='/usr/include'
++infodir='${prefix}/info'
++mandir='${prefix}/man'
+ ac_prev=
+ for ac_option
+ do
+-
+   # If the previous option needs an argument, assign it.
+   if test -n "$ac_prev"; then
+     eval "$ac_prev=\$ac_option"
+@@ -50,48 +323,59 @@
+     continue
+   fi
+-  case "$ac_option" in
+-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+-  *) ac_optarg= ;;
+-  esac
++  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+   # Accept the important Cygnus configure options, so we can diagnose typos.
+-  case "$ac_option" in
++  case $ac_option in
+-  -build | --build | --buil | --bui | --bu | --b)
+-    ac_prev=build ;;
+-  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+-    build="$ac_optarg" ;;
++  -bindir | --bindir | --bindi | --bind | --bin | --bi)
++    ac_prev=bindir ;;
++  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
++    bindir=$ac_optarg ;;
++
++  -build | --build | --buil | --bui | --bu)
++    ac_prev=build_alias ;;
++  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
++    build_alias=$ac_optarg ;;
+   -cache-file | --cache-file | --cache-fil | --cache-fi \
+   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+     ac_prev=cache_file ;;
+   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+-    cache_file="$ac_optarg" ;;
++    cache_file=$ac_optarg ;;
++
++  --config-cache | -C)
++    cache_file=config.cache ;;
++
++  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
++    ac_prev=datadir ;;
++  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
++  | --da=*)
++    datadir=$ac_optarg ;;
+   -disable-* | --disable-*)
+-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
++    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+-    fi
+-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+-    eval "enable_${ac_feature}=no" ;;
++    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
++      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
++   { (exit 1); exit 1; }; }
++    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
++    eval "enable_$ac_feature=no" ;;
+   -enable-* | --enable-*)
+-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
++    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+-    fi
+-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+-    case "$ac_option" in
+-      *=*) ;;
++    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
++      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
++   { (exit 1); exit 1; }; }
++    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
++    case $ac_option in
++      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+       *) ac_optarg=yes ;;
+     esac
+-    eval "enable_${ac_feature}='$ac_optarg'" ;;
++    eval "enable_$ac_feature='$ac_optarg'" ;;
+   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+@@ -100,83 +384,101 @@
+   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+   | --exec=* | --exe=* | --ex=*)
+-    exec_prefix="$ac_optarg" ;;
++    exec_prefix=$ac_optarg ;;
+   -gas | --gas | --ga | --g)
+     # Obsolete; use --with-gas.
+     with_gas=yes ;;
+-  -help | --help | --hel | --he)
+-    # Omit some internal or obsolete options to make the list less imposing.
+-    # This message is too long to be a string in the A/UX 3.1 sh.
+-    cat << EOF
+-Usage: configure [options] [host]
+-Options: [defaults in brackets after descriptions]
+-Configuration:
+-  --cache-file=FILE       cache test results in FILE
+-  --help                  print this message
+-  --no-create             do not create output files
+-  --quiet, --silent       do not print \`checking...' messages
+-  --version               print the version of autoconf that created configure
+-Directory and file names:
+-  --prefix=PREFIX         install architecture-independent files in PREFIX
+-                          [$ac_default_prefix]
+-  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
+-                          [same as prefix]
+-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+-  --program-prefix=PREFIX prepend PREFIX to installed program names
+-  --program-suffix=SUFFIX append SUFFIX to installed program names
+-  --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+-Host type:
+-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+-  --host=HOST             configure for HOST [guessed]
+-  --target=TARGET         configure for TARGET [TARGET=HOST]
+-Features and packages:
+-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+-  --x-includes=DIR        X include files are in DIR
+-  --x-libraries=DIR       X library files are in DIR
+---enable and --with options recognized:$ac_help
+-EOF
+-    exit 0 ;;
++  -help | --help | --hel | --he | -h)
++    ac_init_help=long ;;
++  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
++    ac_init_help=recursive ;;
++  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
++    ac_init_help=short ;;
+   -host | --host | --hos | --ho)
+-    ac_prev=host ;;
++    ac_prev=host_alias ;;
+   -host=* | --host=* | --hos=* | --ho=*)
+-    host="$ac_optarg" ;;
++    host_alias=$ac_optarg ;;
++
++  -includedir | --includedir | --includedi | --included | --include \
++  | --includ | --inclu | --incl | --inc)
++    ac_prev=includedir ;;
++  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
++  | --includ=* | --inclu=* | --incl=* | --inc=*)
++    includedir=$ac_optarg ;;
++
++  -infodir | --infodir | --infodi | --infod | --info | --inf)
++    ac_prev=infodir ;;
++  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
++    infodir=$ac_optarg ;;
++
++  -libdir | --libdir | --libdi | --libd)
++    ac_prev=libdir ;;
++  -libdir=* | --libdir=* | --libdi=* | --libd=*)
++    libdir=$ac_optarg ;;
++
++  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
++  | --libexe | --libex | --libe)
++    ac_prev=libexecdir ;;
++  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
++  | --libexe=* | --libex=* | --libe=*)
++    libexecdir=$ac_optarg ;;
++
++  -localstatedir | --localstatedir | --localstatedi | --localstated \
++  | --localstate | --localstat | --localsta | --localst \
++  | --locals | --local | --loca | --loc | --lo)
++    ac_prev=localstatedir ;;
++  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
++  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
++  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
++    localstatedir=$ac_optarg ;;
++
++  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
++    ac_prev=mandir ;;
++  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
++    mandir=$ac_optarg ;;
+   -nfp | --nfp | --nf)
+     # Obsolete; use --without-fp.
+     with_fp=no ;;
+   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+-  | --no-cr | --no-c)
++  | --no-cr | --no-c | -n)
+     no_create=yes ;;
+   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+     no_recursion=yes ;;
++  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
++  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
++  | --oldin | --oldi | --old | --ol | --o)
++    ac_prev=oldincludedir ;;
++  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
++  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
++  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
++    oldincludedir=$ac_optarg ;;
++
+   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+     ac_prev=prefix ;;
+   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+-    prefix="$ac_optarg" ;;
++    prefix=$ac_optarg ;;
+   -program-prefix | --program-prefix | --program-prefi | --program-pref \
+   | --program-pre | --program-pr | --program-p)
+     ac_prev=program_prefix ;;
+   -program-prefix=* | --program-prefix=* | --program-prefi=* \
+   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+-    program_prefix="$ac_optarg" ;;
++    program_prefix=$ac_optarg ;;
+   -program-suffix | --program-suffix | --program-suffi | --program-suff \
+   | --program-suf | --program-su | --program-s)
+     ac_prev=program_suffix ;;
+   -program-suffix=* | --program-suffix=* | --program-suffi=* \
+   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+-    program_suffix="$ac_optarg" ;;
++    program_suffix=$ac_optarg ;;
+   -program-transform-name | --program-transform-name \
+   | --program-transform-nam | --program-transform-na \
+@@ -193,55 +495,78 @@
+   | --program-transfo=* | --program-transf=* \
+   | --program-trans=* | --program-tran=* \
+   | --progr-tra=* | --program-tr=* | --program-t=*)
+-    program_transform_name="$ac_optarg" ;;
++    program_transform_name=$ac_optarg ;;
+   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+   | -silent | --silent | --silen | --sile | --sil)
+     silent=yes ;;
++  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
++    ac_prev=sbindir ;;
++  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
++  | --sbi=* | --sb=*)
++    sbindir=$ac_optarg ;;
++
++  -sharedstatedir | --sharedstatedir | --sharedstatedi \
++  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
++  | --sharedst | --shareds | --shared | --share | --shar \
++  | --sha | --sh)
++    ac_prev=sharedstatedir ;;
++  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
++  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
++  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
++  | --sha=* | --sh=*)
++    sharedstatedir=$ac_optarg ;;
++
+   -site | --site | --sit)
+     ac_prev=site ;;
+   -site=* | --site=* | --sit=*)
+-    site="$ac_optarg" ;;
++    site=$ac_optarg ;;
+   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+     ac_prev=srcdir ;;
+   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+-    srcdir="$ac_optarg" ;;
++    srcdir=$ac_optarg ;;
++
++  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
++  | --syscon | --sysco | --sysc | --sys | --sy)
++    ac_prev=sysconfdir ;;
++  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
++  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
++    sysconfdir=$ac_optarg ;;
+   -target | --target | --targe | --targ | --tar | --ta | --t)
+-    ac_prev=target ;;
++    ac_prev=target_alias ;;
+   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+-    target="$ac_optarg" ;;
++    target_alias=$ac_optarg ;;
+   -v | -verbose | --verbose | --verbos | --verbo | --verb)
+     verbose=yes ;;
+-  -version | --version | --versio | --versi | --vers)
+-    echo "configure generated by autoconf version 2.4"
+-    exit 0 ;;
++  -version | --version | --versio | --versi | --vers | -V)
++    ac_init_version=: ;;
+   -with-* | --with-*)
+-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
++    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+-    fi
++    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
++      { echo "$as_me: error: invalid package name: $ac_package" >&2
++   { (exit 1); exit 1; }; }
+     ac_package=`echo $ac_package| sed 's/-/_/g'`
+-    case "$ac_option" in
+-      *=*) ;;
++    case $ac_option in
++      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+       *) ac_optarg=yes ;;
+     esac
+-    eval "with_${ac_package}='$ac_optarg'" ;;
++    eval "with_$ac_package='$ac_optarg'" ;;
+   -without-* | --without-*)
+-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
++    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+     # Reject names that are not valid shell variable names.
+-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+-    fi
+-    ac_package=`echo $ac_package| sed 's/-/_/g'`
+-    eval "with_${ac_package}=no" ;;
++    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
++      { echo "$as_me: error: invalid package name: $ac_package" >&2
++   { (exit 1); exit 1; }; }
++    ac_package=`echo $ac_package | sed 's/-/_/g'`
++    eval "with_$ac_package=no" ;;
+   --x)
+     # Obsolete; use --with-x.
+@@ -252,96 +577,110 @@
+     ac_prev=x_includes ;;
+   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+-    x_includes="$ac_optarg" ;;
++    x_includes=$ac_optarg ;;
+   -x-libraries | --x-libraries | --x-librarie | --x-librari \
+   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+     ac_prev=x_libraries ;;
+   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+-    x_libraries="$ac_optarg" ;;
++    x_libraries=$ac_optarg ;;
+-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
++  -*) { echo "$as_me: error: unrecognized option: $ac_option
++Try \`$0 --help' for more information." >&2
++   { (exit 1); exit 1; }; }
+     ;;
+-  *) 
+-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+-      echo "configure: warning: $ac_option: invalid host type" 1>&2
+-    fi
+-    if test "x$nonopt" != xNONE; then
+-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+-    fi
+-    nonopt="$ac_option"
++  *=*)
++    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
++    # Reject names that are not valid shell variable names.
++    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
++      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
++   { (exit 1); exit 1; }; }
++    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
++    eval "$ac_envvar='$ac_optarg'"
++    export $ac_envvar ;;
++
++  *)
++    # FIXME: should be removed in autoconf 3.0.
++    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
++    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
++      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
++    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+     ;;
+   esac
+ done
+ if test -n "$ac_prev"; then
+-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+-fi
+-
+-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+-
+-# File descriptor usage:
+-# 0 standard input
+-# 1 file creation
+-# 2 errors and warnings
+-# 3 some systems may open it to /dev/tty
+-# 4 used on the Kubota Titan
+-# 6 checking for... messages and results
+-# 5 compiler messages saved in config.log
+-if test "$silent" = yes; then
+-  exec 6>/dev/null
+-else
+-  exec 6>&1
++  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
++  { echo "$as_me: error: missing argument to $ac_option" >&2
++   { (exit 1); exit 1; }; }
+ fi
+-exec 5>./config.log
+-echo "\
+-This file contains any messages produced by compilers while
+-running configure, to aid debugging if configure makes a mistake.
+-" 1>&5
++# Be sure to have absolute paths.
++for ac_var in exec_prefix prefix
++do
++  eval ac_val=$`echo $ac_var`
++  case $ac_val in
++    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
++    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
++   { (exit 1); exit 1; }; };;
++  esac
++done
+-# Strip out --no-create and --no-recursion so they do not pile up.
+-# Also quote any args containing shell metacharacters.
+-ac_configure_args=
+-for ac_arg
++# Be sure to have absolute paths.
++for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
++            localstatedir libdir includedir oldincludedir infodir mandir
+ do
+-  case "$ac_arg" in
+-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+-  | --no-cr | --no-c) ;;
+-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+-  *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
++  eval ac_val=$`echo $ac_var`
++  case $ac_val in
++    [\\/$]* | ?:[\\/]* ) ;;
++    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
++   { (exit 1); exit 1; }; };;
+   esac
+ done
+-# NLS nuisances.
+-# Only set LANG and LC_ALL to C if already set.
+-# These must not be set unconditionally because not all systems understand
+-# e.g. LANG=C (notably SCO).
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
++# There might be people who depend on the old broken behavior: `$host'
++# used to hold the argument of --host etc.
++# FIXME: To remove some day.
++build=$build_alias
++host=$host_alias
++target=$target_alias
++
++# FIXME: To remove some day.
++if test "x$host_alias" != x; then
++  if test "x$build_alias" = x; then
++    cross_compiling=maybe
++    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
++    If a cross compiler is detected then cross compile mode will be used." >&2
++  elif test "x$build_alias" != "x$host_alias"; then
++    cross_compiling=yes
++  fi
++fi
+-# confdefs.h avoids OS command line length limits that DEFS can exceed.
+-rm -rf conftest* confdefs.h
+-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+-echo > confdefs.h
++ac_tool_prefix=
++test -n "$host_alias" && ac_tool_prefix=$host_alias-
++
++test "$silent" = yes && exec 6>/dev/null
+-# A filename unique to this package, relative to the directory that
+-# configure is in, which we can look for to find out if srcdir is correct.
+-ac_unique_file=src/rcsbase.h
+ # Find the source files, if location was not specified.
+ if test -z "$srcdir"; then
+   ac_srcdir_defaulted=yes
+   # Try the directory containing this script, then its parent.
+-  ac_prog=$0
+-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
++  ac_confdir=`(dirname "$0") 2>/dev/null ||
++$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++       X"$0" : 'X\(//\)[^/]' \| \
++       X"$0" : 'X\(//\)$' \| \
++       X"$0" : 'X\(/\)' \| \
++       .     : '\(.\)' 2>/dev/null ||
++echo X"$0" |
++    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
++        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
++        /^X\(\/\/\)$/{ s//\1/; q; }
++        /^X\(\/\).*/{ s//\1/; q; }
++        s/.*/./; q'`
+   srcdir=$ac_confdir
+   if test ! -r $srcdir/$ac_unique_file; then
+     srcdir=..
+@@ -351,13 +690,454 @@
+ fi
+ if test ! -r $srcdir/$ac_unique_file; then
+   if test "$ac_srcdir_defaulted" = yes; then
+-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
++    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
++   { (exit 1); exit 1; }; }
+   else
+-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
++    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
++   { (exit 1); exit 1; }; }
+   fi
+ fi
+-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
++(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
++  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
++   { (exit 1); exit 1; }; }
++srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
++ac_env_build_alias_set=${build_alias+set}
++ac_env_build_alias_value=$build_alias
++ac_cv_env_build_alias_set=${build_alias+set}
++ac_cv_env_build_alias_value=$build_alias
++ac_env_host_alias_set=${host_alias+set}
++ac_env_host_alias_value=$host_alias
++ac_cv_env_host_alias_set=${host_alias+set}
++ac_cv_env_host_alias_value=$host_alias
++ac_env_target_alias_set=${target_alias+set}
++ac_env_target_alias_value=$target_alias
++ac_cv_env_target_alias_set=${target_alias+set}
++ac_cv_env_target_alias_value=$target_alias
++ac_env_CC_set=${CC+set}
++ac_env_CC_value=$CC
++ac_cv_env_CC_set=${CC+set}
++ac_cv_env_CC_value=$CC
++ac_env_CFLAGS_set=${CFLAGS+set}
++ac_env_CFLAGS_value=$CFLAGS
++ac_cv_env_CFLAGS_set=${CFLAGS+set}
++ac_cv_env_CFLAGS_value=$CFLAGS
++ac_env_LDFLAGS_set=${LDFLAGS+set}
++ac_env_LDFLAGS_value=$LDFLAGS
++ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
++ac_cv_env_LDFLAGS_value=$LDFLAGS
++ac_env_CPPFLAGS_set=${CPPFLAGS+set}
++ac_env_CPPFLAGS_value=$CPPFLAGS
++ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
++ac_cv_env_CPPFLAGS_value=$CPPFLAGS
++
++#
++# Report the --help message.
++#
++if test "$ac_init_help" = "long"; then
++  # Omit some internal or obsolete options to make the list less imposing.
++  # This message is too long to be a string in the A/UX 3.1 sh.
++  cat <<_ACEOF
++\`configure' configures this package to adapt to many kinds of systems.
++
++Usage: $0 [OPTION]... [VAR=VALUE]...
++
++To assign environment variables (e.g., CC, CFLAGS...), specify them as
++VAR=VALUE.  See below for descriptions of some of the useful variables.
++
++Defaults for the options are specified in brackets.
++
++Configuration:
++  -h, --help              display this help and exit
++      --help=short        display options specific to this package
++      --help=recursive    display the short help of all the included packages
++  -V, --version           display version information and exit
++  -q, --quiet, --silent   do not print \`checking...' messages
++      --cache-file=FILE   cache test results in FILE [disabled]
++  -C, --config-cache      alias for \`--cache-file=config.cache'
++  -n, --no-create         do not create output files
++      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
++
++_ACEOF
++
++  cat <<_ACEOF
++Installation directories:
++  --prefix=PREFIX         install architecture-independent files in PREFIX
++                        [$ac_default_prefix]
++  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
++                        [PREFIX]
++
++By default, \`make install' will install all the files in
++\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
++an installation prefix other than \`$ac_default_prefix' using \`--prefix',
++for instance \`--prefix=\$HOME'.
++
++For better control, use the options below.
++
++Fine tuning of the installation directories:
++  --bindir=DIR           user executables [EPREFIX/bin]
++  --sbindir=DIR          system admin executables [EPREFIX/sbin]
++  --libexecdir=DIR       program executables [EPREFIX/libexec]
++  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
++  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
++  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
++  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
++  --libdir=DIR           object code libraries [EPREFIX/lib]
++  --includedir=DIR       C header files [PREFIX/include]
++  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
++  --infodir=DIR          info documentation [PREFIX/info]
++  --mandir=DIR           man documentation [PREFIX/man]
++_ACEOF
++
++  cat <<\_ACEOF
++_ACEOF
++fi
++
++if test -n "$ac_init_help"; then
++
++  cat <<\_ACEOF
++
++Optional Packages:
++  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
++  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
++  --with-diffutils        assume GNU diffutils is similarly installed
++
++Some influential environment variables:
++  CC          C compiler command
++  CFLAGS      C compiler flags
++  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
++              nonstandard directory <lib dir>
++  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
++              headers in a nonstandard directory <include dir>
++
++Use these variables to override the choices made by `configure' or to help
++it to find libraries and programs with nonstandard names/locations.
++
++_ACEOF
++fi
++
++if test "$ac_init_help" = "recursive"; then
++  # If there are subdirs, report their specific --help.
++  ac_popdir=`pwd`
++  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
++    test -d $ac_dir || continue
++    ac_builddir=.
++
++if test "$ac_dir" != .; then
++  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
++  # A "../" for each directory in $ac_dir_suffix.
++  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
++else
++  ac_dir_suffix= ac_top_builddir=
++fi
++
++case $srcdir in
++  .)  # No --srcdir option.  We are building in place.
++    ac_srcdir=.
++    if test -z "$ac_top_builddir"; then
++       ac_top_srcdir=.
++    else
++       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
++    fi ;;
++  [\\/]* | ?:[\\/]* )  # Absolute path.
++    ac_srcdir=$srcdir$ac_dir_suffix;
++    ac_top_srcdir=$srcdir ;;
++  *) # Relative path.
++    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
++    ac_top_srcdir=$ac_top_builddir$srcdir ;;
++esac
++
++# Do not use `cd foo && pwd` to compute absolute paths, because
++# the directories may not exist.
++case `pwd` in
++.) ac_abs_builddir="$ac_dir";;
++*)
++  case "$ac_dir" in
++  .) ac_abs_builddir=`pwd`;;
++  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
++  *) ac_abs_builddir=`pwd`/"$ac_dir";;
++  esac;;
++esac
++case $ac_abs_builddir in
++.) ac_abs_top_builddir=${ac_top_builddir}.;;
++*)
++  case ${ac_top_builddir}. in
++  .) ac_abs_top_builddir=$ac_abs_builddir;;
++  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
++  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
++  esac;;
++esac
++case $ac_abs_builddir in
++.) ac_abs_srcdir=$ac_srcdir;;
++*)
++  case $ac_srcdir in
++  .) ac_abs_srcdir=$ac_abs_builddir;;
++  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
++  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
++  esac;;
++esac
++case $ac_abs_builddir in
++.) ac_abs_top_srcdir=$ac_top_srcdir;;
++*)
++  case $ac_top_srcdir in
++  .) ac_abs_top_srcdir=$ac_abs_builddir;;
++  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
++  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
++  esac;;
++esac
++
++    cd $ac_dir
++    # Check for guested configure; otherwise get Cygnus style configure.
++    if test -f $ac_srcdir/configure.gnu; then
++      echo
++      $SHELL $ac_srcdir/configure.gnu  --help=recursive
++    elif test -f $ac_srcdir/configure; then
++      echo
++      $SHELL $ac_srcdir/configure  --help=recursive
++    elif test -f $ac_srcdir/configure.ac ||
++         test -f $ac_srcdir/configure.in; then
++      echo
++      $ac_configure --help
++    else
++      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
++    fi
++    cd "$ac_popdir"
++  done
++fi
++
++test -n "$ac_init_help" && exit 0
++if $ac_init_version; then
++  cat <<\_ACEOF
++
++Copyright (C) 2003 Free Software Foundation, Inc.
++This configure script is free software; the Free Software Foundation
++gives unlimited permission to copy, distribute and modify it.
++_ACEOF
++  exit 0
++fi
++exec 5>config.log
++cat >&5 <<_ACEOF
++This file contains any messages produced by compilers while
++running configure, to aid debugging if configure makes a mistake.
++
++It was created by $as_me, which was
++generated by GNU Autoconf 2.59.  Invocation command line was
++
++  $ $0 $@
++
++_ACEOF
++{
++cat <<_ASUNAME
++## --------- ##
++## Platform. ##
++## --------- ##
++
++hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
++uname -m = `(uname -m) 2>/dev/null || echo unknown`
++uname -r = `(uname -r) 2>/dev/null || echo unknown`
++uname -s = `(uname -s) 2>/dev/null || echo unknown`
++uname -v = `(uname -v) 2>/dev/null || echo unknown`
++
++/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
++/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
++
++/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
++/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
++/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
++hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
++/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
++/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
++/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
++
++_ASUNAME
++
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  echo "PATH: $as_dir"
++done
++
++} >&5
++
++cat >&5 <<_ACEOF
++
++
++## ----------- ##
++## Core tests. ##
++## ----------- ##
++
++_ACEOF
++
++
++# Keep a trace of the command line.
++# Strip out --no-create and --no-recursion so they do not pile up.
++# Strip out --silent because we don't want to record it for future runs.
++# Also quote any args containing shell meta-characters.
++# Make two passes to allow for proper duplicate-argument suppression.
++ac_configure_args=
++ac_configure_args0=
++ac_configure_args1=
++ac_sep=
++ac_must_keep_next=false
++for ac_pass in 1 2
++do
++  for ac_arg
++  do
++    case $ac_arg in
++    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
++    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
++    | -silent | --silent | --silen | --sile | --sil)
++      continue ;;
++    *" "*|*"  "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
++      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
++    esac
++    case $ac_pass in
++    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
++    2)
++      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
++      if test $ac_must_keep_next = true; then
++      ac_must_keep_next=false # Got value, back to normal.
++      else
++      case $ac_arg in
++        *=* | --config-cache | -C | -disable-* | --disable-* \
++        | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
++        | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
++        | -with-* | --with-* | -without-* | --without-* | --x)
++          case "$ac_configure_args0 " in
++            "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
++          esac
++          ;;
++        -* ) ac_must_keep_next=true ;;
++      esac
++      fi
++      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
++      # Get rid of the leading space.
++      ac_sep=" "
++      ;;
++    esac
++  done
++done
++$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
++$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
++
++# When interrupted or exit'd, cleanup temporary files, and complete
++# config.log.  We remove comments because anyway the quotes in there
++# would cause problems or look ugly.
++# WARNING: Be sure not to use single quotes in there, as some shells,
++# such as our DU 5.0 friend, will then `close' the trap.
++trap 'exit_status=$?
++  # Save into config.log some information that might help in debugging.
++  {
++    echo
++
++    cat <<\_ASBOX
++## ---------------- ##
++## Cache variables. ##
++## ---------------- ##
++_ASBOX
++    echo
++    # The following way of writing the cache mishandles newlines in values,
++{
++  (set) 2>&1 |
++    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
++    *ac_space=\ *)
++      sed -n \
++      "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
++        s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
++      ;;
++    *)
++      sed -n \
++      "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
++      ;;
++    esac;
++}
++    echo
++
++    cat <<\_ASBOX
++## ----------------- ##
++## Output variables. ##
++## ----------------- ##
++_ASBOX
++    echo
++    for ac_var in $ac_subst_vars
++    do
++      eval ac_val=$`echo $ac_var`
++      echo "$ac_var='"'"'$ac_val'"'"'"
++    done | sort
++    echo
++
++    if test -n "$ac_subst_files"; then
++      cat <<\_ASBOX
++## ------------- ##
++## Output files. ##
++## ------------- ##
++_ASBOX
++      echo
++      for ac_var in $ac_subst_files
++      do
++      eval ac_val=$`echo $ac_var`
++      echo "$ac_var='"'"'$ac_val'"'"'"
++      done | sort
++      echo
++    fi
++
++    if test -s confdefs.h; then
++      cat <<\_ASBOX
++## ----------- ##
++## confdefs.h. ##
++## ----------- ##
++_ASBOX
++      echo
++      sed "/^$/d" confdefs.h | sort
++      echo
++    fi
++    test "$ac_signal" != 0 &&
++      echo "$as_me: caught signal $ac_signal"
++    echo "$as_me: exit $exit_status"
++  } >&5
++  rm -f core *.core &&
++  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
++    exit $exit_status
++     ' 0
++for ac_signal in 1 2 13 15; do
++  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
++done
++ac_signal=0
++
++# confdefs.h avoids OS command line length limits that DEFS can exceed.
++rm -rf conftest* confdefs.h
++# AIX cpp loses on an empty file, so make sure it contains at least a newline.
++echo >confdefs.h
++
++# Predefined preprocessor variables.
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_NAME "$PACKAGE_NAME"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_VERSION "$PACKAGE_VERSION"
++_ACEOF
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_STRING "$PACKAGE_STRING"
++_ACEOF
++
++
++cat >>confdefs.h <<_ACEOF
++#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
++_ACEOF
++
++
++# Let the site file select an alternate cache file if it wants to.
+ # Prefer explicitly selected file to automatically selected ones.
+ if test -z "$CONFIG_SITE"; then
+   if test "x$prefix" != xNONE; then
+@@ -368,36 +1148,103 @@
+ fi
+ for ac_site_file in $CONFIG_SITE; do
+   if test -r "$ac_site_file"; then
+-    echo "loading site script $ac_site_file"
++    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
++echo "$as_me: loading site script $ac_site_file" >&6;}
++    sed 's/^/| /' "$ac_site_file" >&5
+     . "$ac_site_file"
+   fi
+ done
+ if test -r "$cache_file"; then
+-  echo "loading cache $cache_file"
+-  . $cache_file
++  # Some versions of bash will fail to source /dev/null (special
++  # files actually), so we avoid doing that.
++  if test -f "$cache_file"; then
++    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
++echo "$as_me: loading cache $cache_file" >&6;}
++    case $cache_file in
++      [\\/]* | ?:[\\/]* ) . $cache_file;;
++      *)                      . ./$cache_file;;
++    esac
++  fi
+ else
+-  echo "creating cache $cache_file"
+-  > $cache_file
++  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
++echo "$as_me: creating cache $cache_file" >&6;}
++  >$cache_file
++fi
++
++# Check that the precious variables saved in the cache have kept the same
++# value.
++ac_cache_corrupted=false
++for ac_var in `(set) 2>&1 |
++             sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
++  eval ac_old_set=\$ac_cv_env_${ac_var}_set
++  eval ac_new_set=\$ac_env_${ac_var}_set
++  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
++  eval ac_new_val="\$ac_env_${ac_var}_value"
++  case $ac_old_set,$ac_new_set in
++    set,)
++      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
++echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
++      ac_cache_corrupted=: ;;
++    ,set)
++      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
++echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
++      ac_cache_corrupted=: ;;
++    ,);;
++    *)
++      if test "x$ac_old_val" != "x$ac_new_val"; then
++      { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
++echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
++      { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
++echo "$as_me:   former value:  $ac_old_val" >&2;}
++      { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
++echo "$as_me:   current value: $ac_new_val" >&2;}
++      ac_cache_corrupted=:
++      fi;;
++  esac
++  # Pass precious variables to config.status.
++  if test "$ac_new_set" = set; then
++    case $ac_new_val in
++    *" "*|*"  "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
++      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
++    *) ac_arg=$ac_var=$ac_new_val ;;
++    esac
++    case " $ac_configure_args " in
++      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
++      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
++    esac
++  fi
++done
++if $ac_cache_corrupted; then
++  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
++echo "$as_me: error: changes in the environment can compromise the build" >&2;}
++  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
++echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
++   { (exit 1); exit 1; }; }
+ fi
+ ac_ext=c
+-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
+-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+-  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+-    ac_n= ac_c='
+-' ac_t='      '
+-  else
+-    ac_n=-n ac_c= ac_t=
+-  fi
+-else
+-  ac_n= ac_c='\c' ac_t=
+-fi
+@@ -411,15 +1258,15 @@
+ 1
+ EOF
++
+ # Check whether --with-diffutils or --without-diffutils was given.
+-withval="$with_diffutils"
+-if test -n "$withval"; then
++if test "${with_diffutils+set}" = set; then
++  withval="$with_diffutils"
+   with_diffutils=$withval
+ else
+   with_diffutils=no
+-fi
+-
++fi;
+ case $with_diffutils in
+ yes)
+@@ -437,11 +1284,12 @@
+ # On some systems, the RCS-compatible diff program is called `rdiff';
+ # use it if it works and `diff' doesn't.
+-echo $ac_n "checking diff basename""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_prog_diff'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff basename" >&5
++echo $ECHO_N "checking diff basename... $ECHO_C" >&6
++if test "${rcs_cv_prog_diff+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_prog_diff=$DIFF
+   case $rcs_cv_prog_diff in
+   '')
+@@ -463,49 +1311,62 @@
+ DIFF=$rcs_cv_prog_diff
+ case $DIFF in
+-'') { echo "configure: error: cannot find RCS-compatible diff" 1>&2; exit 1; };;
++'') { { echo "$as_me:$LINENO: error: cannot find RCS-compatible diff" >&5
++echo "$as_me: error: cannot find RCS-compatible diff" >&2;}
++   { (exit 1); exit 1; }; };;
+ esac
+-echo "$ac_t""$DIFF" 1>&6
++echo "$as_me:$LINENO: result: $DIFF" >&5
++echo "${ECHO_T}$DIFF" >&6
+ # Extract the first word of "$DIFF", so it can be a program name with args.
+ set dummy $DIFF; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_path_DIFF'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_path_DIFF+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  case "$DIFF" in
+-  /*)
++  case $DIFF in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_DIFF="$DIFF" # Let the user override the test with a path.
+   ;;
+   *)
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_DIFF="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_path_DIFF="$as_dir/$ac_word$ac_exec_ext"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
+   test -z "$ac_cv_path_DIFF" && ac_cv_path_DIFF="$DIFF"
+   ;;
+ esac
+ fi
+-DIFF="$ac_cv_path_DIFF"
++DIFF=$ac_cv_path_DIFF
++
+ if test -n "$DIFF"; then
+-  echo "$ac_t""$DIFF" 1>&6
++  echo "$as_me:$LINENO: result: $DIFF" >&5
++echo "${ECHO_T}$DIFF" >&6
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+ fi
+ # Set DIFF_SUCCESS, DIFF_FAILURE, DIFF_TROUBLE to diff's exit status
+ # when it finds no differences, some differences, or trouble.
+-echo $ac_n "checking diff success status""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_status_diff_success'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff success status" >&5
++echo $ECHO_N "checking diff success status... $ECHO_C" >&6
++if test "${rcs_cv_status_diff_success+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_status_diff_success=$DIFF_SUCCESS
+   case $rcs_cv_status_diff_success in
+   '')
+@@ -519,14 +1380,16 @@
+ fi
+ DIFF_SUCCESS=$rcs_cv_status_diff_success
+-echo "$ac_t""$DIFF_SUCCESS" 1>&6
++echo "$as_me:$LINENO: result: $DIFF_SUCCESS" >&5
++echo "${ECHO_T}$DIFF_SUCCESS" >&6
+ #
+-echo $ac_n "checking diff failure status""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_status_diff_failure'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff failure status" >&5
++echo $ECHO_N "checking diff failure status... $ECHO_C" >&6
++if test "${rcs_cv_status_diff_failure+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_status_diff_failure=$DIFF_FAILURE
+   case $rcs_cv_status_diff_failure in
+   '')
+@@ -538,14 +1401,16 @@
+ fi
+ DIFF_FAILURE=$rcs_cv_status_diff_failure
+-echo "$ac_t""$DIFF_FAILURE" 1>&6
++echo "$as_me:$LINENO: result: $DIFF_FAILURE" >&5
++echo "${ECHO_T}$DIFF_FAILURE" >&6
+ #
+-echo $ac_n "checking diff trouble status""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_status_diff_trouble'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff trouble status" >&5
++echo $ECHO_N "checking diff trouble status... $ECHO_C" >&6
++if test "${rcs_cv_status_diff_trouble+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_status_diff_trouble=$DIFF_TROUBLE
+   case $rcs_cv_status_diff_trouble in
+   '')
+@@ -557,16 +1422,18 @@
+ fi
+ DIFF_TROUBLE=$rcs_cv_status_diff_trouble
+-echo "$ac_t""$DIFF_TROUBLE" 1>&6
++echo "$as_me:$LINENO: result: $DIFF_TROUBLE" >&5
++echo "${ECHO_T}$DIFF_TROUBLE" >&6
+ # Set DIFFFLAGS to the options of the `diff' program to be run.
+ # Use -an if possible, -n otherwise.
+-echo $ac_n "checking diff options for RCS""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_options_diff'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff options for RCS" >&5
++echo $ECHO_N "checking diff options for RCS... $ECHO_C" >&6
++if test "${rcs_cv_options_diff+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_options_diff=$DIFFFLAGS
+   case $rcs_cv_options_diff in
+   '')
+@@ -585,15 +1452,17 @@
+ fi
+ DIFFFLAGS=$rcs_cv_options_diff
+-echo "$ac_t""$DIFFFLAGS" 1>&6
++echo "$as_me:$LINENO: result: $DIFFFLAGS" >&5
++echo "${ECHO_T}$DIFFFLAGS" >&6
+ # Set DIFF_L to 1 if diff understands the L option, 0 otherwise.
+-echo $ac_n "checking diff -L""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_options_diff_l'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff -L" >&5
++echo $ECHO_N "checking diff -L... $ECHO_C" >&6
++if test "${rcs_cv_options_diff_l+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_options_diff_l=$DIFF_L
+   case $rcs_cv_options_diff_l in
+   '')
+@@ -621,19 +1490,22 @@
+ DIFF_L=$rcs_cv_options_diff_l
+ case $DIFF_L in
+-1) echo "$ac_t""yes" 1>&6;;
+-*) echo "$ac_t""no" 1>&6;;
++1) echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6;;
++*) echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6;;
+ esac
+ # Set DIFF3 to the name of the diff3 program.
+ # In some systems (e.g. BSD/OS 2.0), diffutils diff3 lives in /usr/libexec.
+ diff3PATH=$PATH:/usr/libexec
+-echo $ac_n "checking diff3 -m""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'rcs_cv_prog_diff3_bin'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking diff3 -m" >&5
++echo $ECHO_N "checking diff3 -m... $ECHO_C" >&6
++if test "${rcs_cv_prog_diff3_bin+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+   rcs_cv_prog_diff3_bin=$DIFF3
+   case $rcs_cv_prog_diff3_bin in
+   '')
+@@ -657,49 +1529,61 @@
+ case $rcs_cv_prog_diff3_bin in
+ ?*)
+-  echo "$ac_t""yes" 1>&6
++  echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6
+   ac_save_path=$PATH
+   PATH=$diff3PATH
+   # Extract the first word of "$rcs_cv_prog_diff3_bin", so it can be a program name with args.
+ set dummy $rcs_cv_prog_diff3_bin; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_path_DIFF3'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_path_DIFF3+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  case "$DIFF3" in
+-  /*)
++  case $DIFF3 in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_DIFF3="$DIFF3" # Let the user override the test with a path.
+   ;;
+   *)
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_DIFF3="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_path_DIFF3="$as_dir/$ac_word$ac_exec_ext"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
+   test -z "$ac_cv_path_DIFF3" && ac_cv_path_DIFF3="$rcs_cv_prog_diff3_bin"
+   ;;
+ esac
+ fi
+-DIFF3="$ac_cv_path_DIFF3"
++DIFF3=$ac_cv_path_DIFF3
++
+ if test -n "$DIFF3"; then
+-  echo "$ac_t""$DIFF3" 1>&6
++  echo "$as_me:$LINENO: result: $DIFF3" >&5
++echo "${ECHO_T}$DIFF3" >&6
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+ fi
+   PATH=$ac_save_path
+   ;;
+ '')
+-  echo "$ac_t""no" 1>&6
+-  echo $ac_n "checking diff3 library program""... $ac_c" 1>&6
+-      if eval "test \"`echo '$''{'rcs_cv_path_diff3_lib'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++  echo "$as_me:$LINENO: checking diff3 library program" >&5
++echo $ECHO_N "checking diff3 library program... $ECHO_C" >&6
++      if test "${rcs_cv_path_diff3_lib+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  
++
+     $DIFF conftest0 conftest1 >conftest01
+     $DIFF /dev/null conftest1 >conftestn1
+     for i in /usr/*lib*/*diff3*; do
+@@ -714,13 +1598,16 @@
+       break
+       fi
+     done
+-  
++
+ fi
+   DIFF3=$rcs_cv_path_diff3_lib
+   case $DIFF3 in
+-  '') { echo "configure: error: cannot find a working diff3 library program" 1>&2; exit 1; };;
+-  ?*) echo "$ac_t""$DIFF3" 1>&6;;
++  '') { { echo "$as_me:$LINENO: error: cannot find a working diff3 library program" >&5
++echo "$as_me: error: cannot find a working diff3 library program" >&2;}
++   { (exit 1); exit 1; }; };;
++  ?*) echo "$as_me:$LINENO: result: $DIFF3" >&5
++echo "${ECHO_T}$DIFF3" >&6;;
+   esac
+   ;;
+ esac
+@@ -740,71 +1627,89 @@
+ # Extract the first word of "ed", so it can be a program name with args.
+ set dummy ed; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_path_ED'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_path_ED+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  case "$ED" in
+-  /*)
++  case $ED in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_ED="$ED" # Let the user override the test with a path.
+   ;;
+   *)
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_ED="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_path_ED="$as_dir/$ac_word$ac_exec_ext"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
+   test -z "$ac_cv_path_ED" && ac_cv_path_ED="ed"
+   ;;
+ esac
+ fi
+-ED="$ac_cv_path_ED"
++ED=$ac_cv_path_ED
++
+ if test -n "$ED"; then
+-  echo "$ac_t""$ED" 1>&6
++  echo "$as_me:$LINENO: result: $ED" >&5
++echo "${ECHO_T}$ED" >&6
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+ fi
+ ac_save_path=$PATH
+-PATH=/usr/lib:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
++PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/lib:$PATH
+ for ac_prog in sendmail mail mailx
+ do
+-# Extract the first word of "$ac_prog", so it can be a program name with args.
++  # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_path_SENDMAIL'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_path_SENDMAIL+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  case "$SENDMAIL" in
+-  /*)
++  case $SENDMAIL in
++  [\\/]* | ?:[\\/]*)
+   ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a path.
+   ;;
+   *)
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_path_SENDMAIL="$ac_dir/$ac_word"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_path_SENDMAIL="$as_dir/$ac_word$ac_exec_ext"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
+   ;;
+ esac
+ fi
+-SENDMAIL="$ac_cv_path_SENDMAIL"
++SENDMAIL=$ac_cv_path_SENDMAIL
++
+ if test -n "$SENDMAIL"; then
+-  echo "$ac_t""$SENDMAIL" 1>&6
++  echo "$as_me:$LINENO: result: $SENDMAIL" >&5
++echo "${ECHO_T}$SENDMAIL" >&6
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+ fi
+-test -n "$SENDMAIL" && break
++  test -n "$SENDMAIL" && break
+ done
+ PATH=$ac_save_path
+@@ -817,110 +1722,969 @@
+ # Similarly, if using traditional pic, use its -D option.
+ for ac_prog in "pic -n" "gpic -n" "pic -D" "pic"
+ do
+-# Extract the first word of "$ac_prog", so it can be a program name with args.
++  # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_prog_PIC'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_PIC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   if test -n "$PIC"; then
+   ac_cv_prog_PIC="$PIC" # Let the user override the test.
+ else
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_PIC="$ac_prog"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_PIC="$ac_prog"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
+ fi
+ fi
+-PIC="$ac_cv_prog_PIC"
++PIC=$ac_cv_prog_PIC
+ if test -n "$PIC"; then
+-  echo "$ac_t""$PIC" 1>&6
++  echo "$as_me:$LINENO: result: $PIC" >&5
++echo "${ECHO_T}$PIC" >&6
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+ fi
+-test -n "$PIC" && break
++  test -n "$PIC" && break
+ done
+ test -n "$PIC" || PIC="pic"
+-# Extract the first word of "gcc", so it can be a program name with args.
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
++set dummy ${ac_tool_prefix}gcc; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  if test -n "$CC"; then
++  ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_CC="${ac_tool_prefix}gcc"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
++fi
++fi
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++  echo "$as_me:$LINENO: result: $CC" >&5
++echo "${ECHO_T}$CC" >&6
++else
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++fi
++if test -z "$ac_cv_prog_CC"; then
++  ac_ct_CC=$CC
++  # Extract the first word of "gcc", so it can be a program name with args.
+ set dummy gcc; ac_word=$2
+-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  if test -n "$ac_ct_CC"; then
++  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_ac_ct_CC="gcc"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
++fi
++fi
++ac_ct_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
++echo "${ECHO_T}$ac_ct_CC" >&6
++else
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++  CC=$ac_ct_CC
++else
++  CC="$ac_cv_prog_CC"
++fi
++
++if test -z "$CC"; then
++  if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
++set dummy ${ac_tool_prefix}cc; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   if test -n "$CC"; then
+   ac_cv_prog_CC="$CC" # Let the user override the test.
+ else
+-  IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    test -z "$ac_dir" && ac_dir=.
+-    if test -f $ac_dir/$ac_word; then
+-      ac_cv_prog_CC="gcc"
+-      break
+-    fi
+-  done
+-  IFS="$ac_save_ifs"
+-  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_CC="${ac_tool_prefix}cc"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
+ fi
+ fi
+-CC="$ac_cv_prog_CC"
++CC=$ac_cv_prog_CC
+ if test -n "$CC"; then
+-  echo "$ac_t""$CC" 1>&6
++  echo "$as_me:$LINENO: result: $CC" >&5
++echo "${ECHO_T}$CC" >&6
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+ fi
++fi
++if test -z "$ac_cv_prog_CC"; then
++  ac_ct_CC=$CC
++  # Extract the first word of "cc", so it can be a program name with args.
++set dummy cc; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  if test -n "$ac_ct_CC"; then
++  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_ac_ct_CC="cc"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
+-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++fi
++fi
++ac_ct_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
++echo "${ECHO_T}$ac_ct_CC" >&6
+ else
+-  cat > conftest.c <<EOF
+-#ifdef __GNUC__
+-  yes;
+-#endif
+-EOF
+-if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then
+-  ac_cv_prog_gcc=yes
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++  CC=$ac_ct_CC
+ else
+-  ac_cv_prog_gcc=no
++  CC="$ac_cv_prog_CC"
+ fi
++
+ fi
+-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+-if test $ac_cv_prog_gcc = yes; then
+-  GCC=yes
+-  if test "${CFLAGS+set}" != set; then
+-    echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+-if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++if test -z "$CC"; then
++  # Extract the first word of "cc", so it can be a program name with args.
++set dummy cc; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  echo 'void f(){}' > conftest.c
+-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+-  ac_cv_prog_gcc_g=yes
++  if test -n "$CC"; then
++  ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++  ac_prog_rejected=no
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
++       ac_prog_rejected=yes
++       continue
++     fi
++    ac_cv_prog_CC="cc"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
++if test $ac_prog_rejected = yes; then
++  # We found a bogon in the path, so make sure we never use it.
++  set dummy $ac_cv_prog_CC
++  shift
++  if test $# != 0; then
++    # We chose a different compiler from the bogus one.
++    # However, it has the same basename, so the bogon will be chosen
++    # first if we set CC to just the basename; use the full file name.
++    shift
++    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
++  fi
++fi
++fi
++fi
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++  echo "$as_me:$LINENO: result: $CC" >&5
++echo "${ECHO_T}$CC" >&6
+ else
+-  ac_cv_prog_gcc_g=no
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++fi
++if test -z "$CC"; then
++  if test -n "$ac_tool_prefix"; then
++  for ac_prog in cl
++  do
++    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
++set dummy $ac_tool_prefix$ac_prog; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  if test -n "$CC"; then
++  ac_cv_prog_CC="$CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
++fi
++fi
++CC=$ac_cv_prog_CC
++if test -n "$CC"; then
++  echo "$as_me:$LINENO: result: $CC" >&5
++echo "${ECHO_T}$CC" >&6
++else
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++    test -n "$CC" && break
++  done
++fi
++if test -z "$CC"; then
++  ac_ct_CC=$CC
++  for ac_prog in cl
++do
++  # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++echo "$as_me:$LINENO: checking for $ac_word" >&5
++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
++if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  if test -n "$ac_ct_CC"; then
++  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for ac_exec_ext in '' $ac_executable_extensions; do
++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_prog_ac_ct_CC="$ac_prog"
++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++done
++
++fi
++fi
++ac_ct_CC=$ac_cv_prog_ac_ct_CC
++if test -n "$ac_ct_CC"; then
++  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
++echo "${ECHO_T}$ac_ct_CC" >&6
++else
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
++fi
++
++  test -n "$ac_ct_CC" && break
++done
++
++  CC=$ac_ct_CC
+ fi
+-rm -f conftest*
+ fi
+-    echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
+-    if test $ac_cv_prog_gcc_g = yes; then
+-      CFLAGS="-g -O"
++
++
++test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
++See \`config.log' for more details." >&5
++echo "$as_me: error: no acceptable C compiler found in \$PATH
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }
++
++# Provide some information about the compiler.
++echo "$as_me:$LINENO:" \
++     "checking for C compiler version" >&5
++ac_compiler=`set X $ac_compile; echo $2`
++{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
++  (eval $ac_compiler --version </dev/null >&5) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
++  (eval $ac_compiler -v </dev/null >&5) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
++  (eval $ac_compiler -V </dev/null >&5) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }
++
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++ac_clean_files_save=$ac_clean_files
++ac_clean_files="$ac_clean_files a.out a.exe b.out"
++# Try to create an executable without -o first, disregard a.out.
++# It will help us diagnose broken compilers, and finding out an intuition
++# of exeext.
++echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
++echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
++ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
++if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
++  (eval $ac_link_default) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; then
++  # Find the output, starting from the most likely.  This scheme is
++# not robust to junk in `.', hence go to wildcards (a.*) only as a last
++# resort.
++
++# Be careful to initialize this variable, since it used to be cached.
++# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
++ac_cv_exeext=
++# b.out is created by i960 compilers.
++for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
++do
++  test -f "$ac_file" || continue
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
++      ;;
++    conftest.$ac_ext )
++      # This is the source file.
++      ;;
++    [ab].out )
++      # We found the default executable, but exeext='' is most
++      # certainly right.
++      break;;
++    *.* )
++      ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
++      # FIXME: I believe we export ac_cv_exeext for Libtool,
++      # but it would be cool to find out if it's true.  Does anybody
++      # maintain Libtool? --akim.
++      export ac_cv_exeext
++      break;;
++    * )
++      break;;
++  esac
++done
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
++See \`config.log' for more details." >&5
++echo "$as_me: error: C compiler cannot create executables
++See \`config.log' for more details." >&2;}
++   { (exit 77); exit 77; }; }
++fi
++
++ac_exeext=$ac_cv_exeext
++echo "$as_me:$LINENO: result: $ac_file" >&5
++echo "${ECHO_T}$ac_file" >&6
++
++# Check the compiler produces executables we can run.  If not, either
++# the compiler is broken, or we cross compile.
++echo "$as_me:$LINENO: checking whether the C compiler works" >&5
++echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
++# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
++# If not cross compiling, check that we can run a simple program.
++if test "$cross_compiling" != yes; then
++  if { ac_try='./$ac_file'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++    cross_compiling=no
++  else
++    if test "$cross_compiling" = maybe; then
++      cross_compiling=yes
+     else
+-      CFLAGS="-O"
++      { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
++If you meant to cross compile, use \`--host'.
++See \`config.log' for more details." >&5
++echo "$as_me: error: cannot run C compiled programs.
++If you meant to cross compile, use \`--host'.
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }
+     fi
+   fi
++fi
++echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6
++
++rm -f a.out a.exe conftest$ac_cv_exeext b.out
++ac_clean_files=$ac_clean_files_save
++# Check the compiler produces executables we can run.  If not, either
++# the compiler is broken, or we cross compile.
++echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
++echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
++echo "$as_me:$LINENO: result: $cross_compiling" >&5
++echo "${ECHO_T}$cross_compiling" >&6
++
++echo "$as_me:$LINENO: checking for suffix of executables" >&5
++echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++  (eval $ac_link) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; then
++  # If both `conftest.exe' and `conftest' are `present' (well, observable)
++# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
++# work properly (i.e., refer to `conftest.exe'), while it won't with
++# `rm'.
++for ac_file in conftest.exe conftest conftest.*; do
++  test -f "$ac_file" || continue
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
++    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
++        export ac_cv_exeext
++        break;;
++    * ) break;;
++  esac
++done
++else
++  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
++See \`config.log' for more details." >&5
++echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }
++fi
++
++rm -f conftest$ac_cv_exeext
++echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
++echo "${ECHO_T}$ac_cv_exeext" >&6
++
++rm -f conftest.$ac_ext
++EXEEXT=$ac_cv_exeext
++ac_exeext=$EXEEXT
++echo "$as_me:$LINENO: checking for suffix of object files" >&5
++echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
++if test "${ac_cv_objext+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.o conftest.obj
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; then
++  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
++  case $ac_file in
++    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
++    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
++       break;;
++  esac
++done
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
++See \`config.log' for more details." >&5
++echo "$as_me: error: cannot compute suffix of object files: cannot compile
++See \`config.log' for more details." >&2;}
++   { (exit 1); exit 1; }; }
++fi
++
++rm -f conftest.$ac_cv_objext conftest.$ac_ext
++fi
++echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
++echo "${ECHO_T}$ac_cv_objext" >&6
++OBJEXT=$ac_cv_objext
++ac_objext=$OBJEXT
++echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
++echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
++if test "${ac_cv_c_compiler_gnu+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++#ifndef __GNUC__
++       choke me
++#endif
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++       { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++       { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  ac_compiler_gnu=yes
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_compiler_gnu=no
++fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++ac_cv_c_compiler_gnu=$ac_compiler_gnu
++
++fi
++echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
++echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
++GCC=`test $ac_compiler_gnu = yes && echo yes`
++ac_test_CFLAGS=${CFLAGS+set}
++ac_save_CFLAGS=$CFLAGS
++CFLAGS="-g"
++echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
++echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
++if test "${ac_cv_prog_cc_g+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++       { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++       { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  ac_cv_prog_cc_g=yes
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_cv_prog_cc_g=no
++fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
++echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
++if test "$ac_test_CFLAGS" = set; then
++  CFLAGS=$ac_save_CFLAGS
++elif test $ac_cv_prog_cc_g = yes; then
++  if test "$GCC" = yes; then
++    CFLAGS="-g -O2"
++  else
++    CFLAGS="-g"
++  fi
++else
++  if test "$GCC" = yes; then
++    CFLAGS="-O2"
++  else
++    CFLAGS=
++  fi
++fi
++echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
++echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
++if test "${ac_cv_prog_cc_stdc+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++  ac_cv_prog_cc_stdc=no
++ac_save_CC=$CC
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++#include <stdarg.h>
++#include <stdio.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
++struct buf { int x; };
++FILE * (*rcsopen) (struct buf *, struct stat *, int);
++static char *e (p, i)
++     char **p;
++     int i;
++{
++  return p[i];
++}
++static char *f (char * (*g) (char **, int), char **p, ...)
++{
++  char *s;
++  va_list v;
++  va_start (v,p);
++  s = g (p, va_arg (v,int));
++  va_end (v);
++  return s;
++}
++
++/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
++   function prototypes and stuff, but not '\xHH' hex character constants.
++   These don't provoke an error unfortunately, instead are silently treated
++   as 'x'.  The following induces an error, until -std1 is added to get
++   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
++   array size at least.  It's necessary to write '\x00'==0 to get something
++   that's true only with -std1.  */
++int osf4_cc_array ['\x00' == 0 ? 1 : -1];
++
++int test (int i, double x);
++struct s1 {int (*f) (int a);};
++struct s2 {int (*f) (double a);};
++int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
++int argc;
++char **argv;
++int
++main ()
++{
++return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
++  ;
++  return 0;
++}
++_ACEOF
++# Don't try gcc -ansi; that turns off useful extensions and
++# breaks some systems' header files.
++# AIX                 -qlanglvl=ansi
++# Ultrix and OSF/1    -std1
++# HP-UX 10.20 and later       -Ae
++# HP-UX older versions        -Aa -D_HPUX_SOURCE
++# SVR4                        -Xc -D__EXTENSIONS__
++for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
++do
++  CC="$ac_save_CC $ac_arg"
++  rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++       { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++       { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  ac_cv_prog_cc_stdc=$ac_arg
++break
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++fi
++rm -f conftest.err conftest.$ac_objext
++done
++rm -f conftest.$ac_ext conftest.$ac_objext
++CC=$ac_save_CC
++
++fi
++
++case "x$ac_cv_prog_cc_stdc" in
++  x|xno)
++    echo "$as_me:$LINENO: result: none needed" >&5
++echo "${ECHO_T}none needed" >&6 ;;
++  *)
++    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
++echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
++    CC="$CC $ac_cv_prog_cc_stdc" ;;
++esac
++
++# Some people use a C++ compiler to compile C.  Since we use `exit',
++# in C++ we need to declare it.  In case someone uses the same compiler
++# for both compiling C and C++ we need to have the C++ compiler decide
++# the declaration of exit, since it's the most demanding environment.
++cat >conftest.$ac_ext <<_ACEOF
++#ifndef __cplusplus
++  choke me
++#endif
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++       { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++       { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  for ac_declaration in \
++   '' \
++   'extern "C" void std::exit (int) throw (); using std::exit;' \
++   'extern "C" void std::exit (int); using std::exit;' \
++   'extern "C" void exit (int) throw ();' \
++   'extern "C" void exit (int);' \
++   'void exit (int);'
++do
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++$ac_declaration
++#include <stdlib.h>
++int
++main ()
++{
++exit (42);
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++       { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++       { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  :
+ else
+-  GCC=
+-  test "${CFLAGS+set}" = set || CFLAGS="-g"
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++continue
+ fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++  cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++$ac_declaration
++int
++main ()
++{
++exit (42);
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  (eval $ac_compile) 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } &&
++       { ac_try='test -z "$ac_c_werror_flag"                   || test ! -s conftest.err'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; } &&
++       { ac_try='test -s conftest.$ac_objext'
++  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++  (eval $ac_try) 2>&5
++  ac_status=$?
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); }; }; then
++  break
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++done
++rm -f conftest*
++if test -n "$ac_declaration"; then
++  echo '#ifdef __cplusplus' >>confdefs.h
++  echo $ac_declaration      >>confdefs.h
++  echo '#endif'             >>confdefs.h
++fi
++
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++fi
++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ ac_aux_dir=
+ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+@@ -932,14 +2696,20 @@
+     ac_aux_dir=$ac_dir
+     ac_install_sh="$ac_aux_dir/install.sh -c"
+     break
++  elif test -f $ac_dir/shtool; then
++    ac_aux_dir=$ac_dir
++    ac_install_sh="$ac_aux_dir/shtool install -c"
++    break
+   fi
+ done
+ if test -z "$ac_aux_dir"; then
+-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+-fi
+-ac_config_guess=$ac_aux_dir/config.guess
+-ac_config_sub=$ac_aux_dir/config.sub
+-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
++  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
++echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
++   { (exit 1); exit 1; }; }
++fi
++ac_config_guess="$SHELL $ac_aux_dir/config.guess"
++ac_config_sub="$SHELL $ac_aux_dir/config.sub"
++ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+ # Find a good install program.  We prefer a C program (faster),
+ # so one script is as good as another.  But avoid the broken or
+@@ -948,274 +2718,1036 @@
+ # SunOS /usr/etc/install
+ # IRIX /sbin/install
+ # AIX /bin/install
++# AmigaOS /C/install, which installs bootblocks on floppy discs
++# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+ # AFS /usr/afsws/bin/install, which mishandles nonexistent args
+ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
++# OS/2's system install, which has a completely different semantic
+ # ./install, which can be erroneously created by make from ./install.sh.
+-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
++echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
++echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+ if test -z "$INSTALL"; then
+-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++if test "${ac_cv_path_install+set}" = set; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-    IFS="${IFS=       }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+-  for ac_dir in $PATH; do
+-    # Account for people who put trailing slashes in PATH elements.
+-    case "$ac_dir/" in
+-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+-    *)
+-      # OSF1 and SCO ODT 3.0 have their own names for install.
+-      for ac_prog in ginstall installbsd scoinst install; do
+-        if test -f $ac_dir/$ac_prog; then
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  # Account for people who put trailing slashes in PATH elements.
++case $as_dir/ in
++  ./ | .// | /cC/* | \
++  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
++  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
++  /usr/ucb/* ) ;;
++  *)
++    # OSF1 and SCO ODT 3.0 have their own names for install.
++    # Don't use installbsd from OSF since it installs stuff as root
++    # by default.
++    for ac_prog in ginstall scoinst install; do
++      for ac_exec_ext in '' $ac_executable_extensions; do
++      if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
++          grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+-          # OSF/1 installbsd also uses dspmsg, but is usable.
++          :
++        elif test $ac_prog = install &&
++          grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
++          # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+-          ac_cv_path_install="$ac_dir/$ac_prog -c"
+-          break 2
++          ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
++          break 3
+         fi
+       fi
+       done
+-      ;;
+-    esac
+-  done
+-  IFS="$ac_save_ifs"
+-  # As a last resort, use the slow shell script.
+-  test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"
++    done
++    ;;
++esac
++done
++
++
+ fi
+-  INSTALL="$ac_cv_path_install"
++  if test "${ac_cv_path_install+set}" = set; then
++    INSTALL=$ac_cv_path_install
++  else
++    # As a last resort, use the slow shell script.  We don't cache a
++    # path for INSTALL within a source directory, because that will
++    # break other packages using the cache if that directory is
++    # removed, or if the path is relative.
++    INSTALL=$ac_install_sh
++  fi
+ fi
+-echo "$ac_t""$INSTALL" 1>&6
++echo "$as_me:$LINENO: result: $INSTALL" >&5
++echo "${ECHO_T}$INSTALL" >&6
+ # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+ # It thinks the first close brace ends the variable substitution.
+ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
++
+ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+-set dummy ${MAKE-make}; ac_make=$2
+-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+-  echo $ac_n "(cached) $ac_c" 1>&6
++echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
++echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
++set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
++if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
++  echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+-  cat > conftestmake <<\EOF
++  cat >conftest.make <<\_ACEOF
+ all:
+-      @echo 'ac_maketemp="${MAKE}"'
+-EOF
++      @echo 'ac_maketemp="$(MAKE)"'
++_ACEOF
+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
++eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+ if test -n "$ac_maketemp"; then
+   eval ac_cv_prog_make_${ac_make}_set=yes
+ else
+   eval ac_cv_prog_make_${ac_make}_set=no
+ fi
+-rm -f conftestmake
++rm -f conftest.make
+ fi
+ if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+-  echo "$ac_t""yes" 1>&6
++  echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6
+   SET_MAKE=
+ else
+-  echo "$ac_t""no" 1>&6
++  echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6
+   SET_MAKE="MAKE=${MAKE-make}"
+ fi
+-trap '' 1 2 15
+-cat > confcache <<\EOF
++                              ac_config_files="$ac_config_files Makefile man/Makefile src/Makefile"
++cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+ # tests run on this system so they can be shared between configure
+-# scripts and configure runs.  It is not useful on other systems.
+-# If it contains results you don't want to keep, you may remove or edit it.
++# scripts and configure runs, see configure's option --config-cache.
++# It is not useful on other systems.  If it contains results you don't
++# want to keep, you may remove or edit it.
+ #
+-# By default, configure uses ./config.cache as the cache file,
+-# creating it if it does not exist already.  You can give configure
+-# the --cache-file=FILE option to use a different cache file; that is
+-# what configure does when it calls configure scripts in
+-# subdirectories, so they share the cache.
+-# Giving --cache-file=/dev/null disables caching, for debugging configure.
+-# config.status only pays attention to the cache file if you give it the
+-# --recheck option to rerun configure.
++# config.status only pays attention to the cache file if you give it
++# the --recheck option to rerun configure.
+ #
+-EOF
++# `ac_cv_env_foo' variables (set or unset) will be overridden when
++# loading this file, other *unset* `ac_cv_foo' will be assigned the
++# following values.
++
++_ACEOF
++
++# The following way of writing the cache mishandles newlines in values,
++# but we know of no workaround that is simple, portable, and efficient.
++# So, don't put newlines in cache variables' values.
+ # Ultrix sh set writes to stderr and can't be redirected directly,
+ # and sets the high bit in the cache file unless we assign to the vars.
+-(set) 2>&1 |
+-  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \
+-  >> confcache
+-if cmp -s $cache_file confcache; then
+-  :
+-else
++{
++  (set) 2>&1 |
++    case `(ac_space=' '; set | grep ac_space) 2>&1` in
++    *ac_space=\ *)
++      # `set' does not quote correctly, so add quotes (double-quote
++      # substitution turns \\\\ into \\, and sed turns \\ into \).
++      sed -n \
++      "s/'/'\\\\''/g;
++        s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
++      ;;
++    *)
++      # `set' quotes correctly as required by POSIX, so do not add quotes.
++      sed -n \
++      "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
++      ;;
++    esac;
++} |
++  sed '
++     t clear
++     : clear
++     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
++     t end
++     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
++     : end' >>confcache
++if diff $cache_file confcache >/dev/null 2>&1; then :; else
+   if test -w $cache_file; then
+-    echo "updating cache $cache_file"
+-    cat confcache > $cache_file
++    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
++    cat confcache >$cache_file
+   else
+     echo "not updating unwritable cache $cache_file"
+   fi
+ fi
+ rm -f confcache
+-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+-
+ test "x$prefix" = xNONE && prefix=$ac_default_prefix
+ # Let make expand exec_prefix.
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+-# Any assignment to VPATH causes Sun make to only execute
+-# the first set of double-colon rules, so remove it if not needed.
+-# If there is a colon in the path, we need to keep it.
++# VPATH may cause trouble with some makes, so we remove $(srcdir),
++# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
++# trailing colons and then remove the whole line if VPATH becomes empty
++# (actually we leave an empty line to preserve line numbers).
+ if test "x$srcdir" = x.; then
+-  ac_vpsub='/^[       ]*VPATH[        ]*=[^:]*$/d'
++  ac_vpsub='/^[        ]*VPATH[        ]*=/{
++s/:*\$(srcdir):*/:/;
++s/:*\${srcdir}:*/:/;
++s/:*@srcdir@:*/:/;
++s/^\([^=]*=[   ]*\):*/\1/;
++s/:*$//;
++s/^[^=]*=[     ]*$//;
++}'
+ fi
+-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+-
+ # Transform confdefs.h into DEFS.
+ # Protect against shell expansion while executing Makefile rules.
+ # Protect against Makefile macro expansion.
+-cat > conftest.defs <<\EOF
+-s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
+-s%[   `~#$^&*(){}\\|;'"<>?]%\\&%g
+-s%\[%\\&%g
+-s%\]%\\&%g
+-s%\$%$$%g
+-EOF
+-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+-rm -f conftest.defs
++#
++# If the first sed substitution is executed (which looks for macros that
++# take arguments), then we branch to the quote section.  Otherwise,
++# look for a macro that doesn't take arguments.
++cat >confdef2opt.sed <<\_ACEOF
++t clear
++: clear
++s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
++t quote
++s,^[   ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\),-D\1=\2,g
++t quote
++d
++: quote
++s,[    `~#$^&*(){}\\|;'"<>?],\\&,g
++s,\[,\\&,g
++s,\],\\&,g
++s,\$,$$,g
++p
++_ACEOF
++# We use echo to avoid assuming a particular line-breaking character.
++# The extra dot is to prevent the shell from consuming trailing
++# line-breaks from the sub-command output.  A line-break within
++# single-quotes doesn't work because, if this script is created in a
++# platform that uses two characters for line-breaks (e.g., DOS), tr
++# would break.
++ac_LF_and_DOT=`echo; echo .`
++DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
++rm -f confdef2opt.sed
++
++
++ac_libobjs=
++ac_ltlibobjs=
++for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
++  # 1. Remove the extension, and $U if already installed.
++  ac_i=`echo "$ac_i" |
++       sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
++  # 2. Add them.
++  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
++  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
++done
++LIBOBJS=$ac_libobjs
++LTLIBOBJS=$ac_ltlibobjs
+-# Without the "./", some shells look in PATH for config.status.
+-: ${CONFIG_STATUS=./config.status}
+-echo creating $CONFIG_STATUS
+-rm -f $CONFIG_STATUS
+-cat > $CONFIG_STATUS <<EOF
+-#! /bin/sh
+-# Generated automatically by configure.
++
++: ${CONFIG_STATUS=./config.status}
++ac_clean_files_save=$ac_clean_files
++ac_clean_files="$ac_clean_files $CONFIG_STATUS"
++{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
++echo "$as_me: creating $CONFIG_STATUS" >&6;}
++cat >$CONFIG_STATUS <<_ACEOF
++#! $SHELL
++# Generated by $as_me.
+ # Run this file to recreate the current configuration.
+-# This directory was configured as follows,
+-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+-#
+-# $0 $ac_configure_args
+-#
+ # Compiler output produced by configure, useful for debugging
+-# configure, is in ./config.log if it exists.
++# configure, is in config.log if it exists.
+-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+-for ac_option
++debug=false
++ac_cs_recheck=false
++ac_cs_silent=false
++SHELL=\${CONFIG_SHELL-$SHELL}
++_ACEOF
++
++cat >>$CONFIG_STATUS <<\_ACEOF
++## --------------------- ##
++## M4sh Initialization.  ##
++## --------------------- ##
++
++# Be Bourne compatible
++if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
++  emulate sh
++  NULLCMD=:
++  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
++  # is contrary to our usage.  Disable this feature.
++  alias -g '${1+"$@"}'='"$@"'
++elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
++  set -o posix
++fi
++DUALCASE=1; export DUALCASE # for MKS sh
++
++# Support unset when possible.
++if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
++  as_unset=unset
++else
++  as_unset=false
++fi
++
++
++# Work around bugs in pre-3.0 UWIN ksh.
++$as_unset ENV MAIL MAILPATH
++PS1='$ '
++PS2='> '
++PS4='+ '
++
++# NLS nuisances.
++for as_var in \
++  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++  LC_TELEPHONE LC_TIME
++do
++  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++    eval $as_var=C; export $as_var
++  else
++    $as_unset $as_var
++  fi
++done
++
++# Required to use basename.
++if expr a : '\(a\)' >/dev/null 2>&1; then
++  as_expr=expr
++else
++  as_expr=false
++fi
++
++if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
++  as_basename=basename
++else
++  as_basename=false
++fi
++
++
++# Name of the executable.
++as_me=`$as_basename "$0" ||
++$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
++       X"$0" : 'X\(//\)$' \| \
++       X"$0" : 'X\(/\)$' \| \
++       .     : '\(.\)' 2>/dev/null ||
++echo X/"$0" |
++    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
++        /^X\/\(\/\/\)$/{ s//\1/; q; }
++        /^X\/\(\/\).*/{ s//\1/; q; }
++        s/.*/./; q'`
++
++
++# PATH needs CR, and LINENO needs CR and PATH.
++# Avoid depending upon Character Ranges.
++as_cr_letters='abcdefghijklmnopqrstuvwxyz'
++as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
++as_cr_Letters=$as_cr_letters$as_cr_LETTERS
++as_cr_digits='0123456789'
++as_cr_alnum=$as_cr_Letters$as_cr_digits
++
++# The user is always right.
++if test "${PATH_SEPARATOR+set}" != set; then
++  echo "#! /bin/sh" >conf$$.sh
++  echo  "exit 0"   >>conf$$.sh
++  chmod +x conf$$.sh
++  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
++    PATH_SEPARATOR=';'
++  else
++    PATH_SEPARATOR=:
++  fi
++  rm -f conf$$.sh
++fi
++
++
++  as_lineno_1=$LINENO
++  as_lineno_2=$LINENO
++  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
++  test "x$as_lineno_1" != "x$as_lineno_2" &&
++  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
++  # Find who we are.  Look in the path if we contain no path at all
++  # relative or not.
++  case $0 in
++    *[\\/]* ) as_myself=$0 ;;
++    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
++done
++
++       ;;
++  esac
++  # We did not find ourselves, most probably we were run as `sh COMMAND'
++  # in which case we are not to be found in the path.
++  if test "x$as_myself" = x; then
++    as_myself=$0
++  fi
++  if test ! -f "$as_myself"; then
++    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
++echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
++   { (exit 1); exit 1; }; }
++  fi
++  case $CONFIG_SHELL in
++  '')
++    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++  for as_base in sh bash ksh sh5; do
++       case $as_dir in
++       /*)
++         if ("$as_dir/$as_base" -c '
++  as_lineno_1=$LINENO
++  as_lineno_2=$LINENO
++  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
++  test "x$as_lineno_1" != "x$as_lineno_2" &&
++  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
++           $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
++           $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
++           CONFIG_SHELL=$as_dir/$as_base
++           export CONFIG_SHELL
++           exec "$CONFIG_SHELL" "$0" ${1+"$@"}
++         fi;;
++       esac
++       done
++done
++;;
++  esac
++
++  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
++  # uniformly replaced by the line number.  The first 'sed' inserts a
++  # line-number line before each line; the second 'sed' does the real
++  # work.  The second script uses 'N' to pair each line-number line
++  # with the numbered line, and appends trailing '-' during
++  # substitution so that $LINENO is not a special case at line end.
++  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
++  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
++  sed '=' <$as_myself |
++    sed '
++      N
++      s,$,-,
++      : loop
++      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
++      t loop
++      s,-$,,
++      s,^['$as_cr_digits']*\n,,
++    ' >$as_me.lineno &&
++  chmod +x $as_me.lineno ||
++    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
++echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
++   { (exit 1); exit 1; }; }
++
++  # Don't try to exec as it changes $[0], causing all sort of problems
++  # (the dirname of $[0] is not the place where we might find the
++  # original and so on.  Autoconf is especially sensible to this).
++  . ./$as_me.lineno
++  # Exit status is that of the last command.
++  exit
++}
++
++
++case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
++  *c*,-n*) ECHO_N= ECHO_C='
++' ECHO_T='    ' ;;
++  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
++  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
++esac
++
++if expr a : '\(a\)' >/dev/null 2>&1; then
++  as_expr=expr
++else
++  as_expr=false
++fi
++
++rm -f conf$$ conf$$.exe conf$$.file
++echo >conf$$.file
++if ln -s conf$$.file conf$$ 2>/dev/null; then
++  # We could just check for DJGPP; but this test a) works b) is more generic
++  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
++  if test -f conf$$.exe; then
++    # Don't use ln at all; we don't have any links
++    as_ln_s='cp -p'
++  else
++    as_ln_s='ln -s'
++  fi
++elif ln conf$$.file conf$$ 2>/dev/null; then
++  as_ln_s=ln
++else
++  as_ln_s='cp -p'
++fi
++rm -f conf$$ conf$$.exe conf$$.file
++
++if mkdir -p . 2>/dev/null; then
++  as_mkdir_p=:
++else
++  test -d ./-p && rmdir ./-p
++  as_mkdir_p=false
++fi
++
++as_executable_p="test -f"
++
++# Sed expression to map a string onto a valid CPP name.
++as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
++
++# Sed expression to map a string onto a valid variable name.
++as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
++
++
++# IFS
++# We need space, tab and new line, in precisely that order.
++as_nl='
++'
++IFS="         $as_nl"
++
++# CDPATH.
++$as_unset CDPATH
++
++exec 6>&1
++
++# Open the log real soon, to keep \$[0] and so on meaningful, and to
++# report actual input values of CONFIG_FILES etc. instead of their
++# values after options handling.  Logging --version etc. is OK.
++exec 5>>config.log
++{
++  echo
++  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
++## Running $as_me. ##
++_ASBOX
++} >&5
++cat >&5 <<_CSEOF
++
++This file was extended by $as_me, which was
++generated by GNU Autoconf 2.59.  Invocation command line was
++
++  CONFIG_FILES    = $CONFIG_FILES
++  CONFIG_HEADERS  = $CONFIG_HEADERS
++  CONFIG_LINKS    = $CONFIG_LINKS
++  CONFIG_COMMANDS = $CONFIG_COMMANDS
++  $ $0 $@
++
++_CSEOF
++echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
++echo >&5
++_ACEOF
++
++# Files that config.status was made for.
++if test -n "$ac_config_files"; then
++  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
++fi
++
++if test -n "$ac_config_headers"; then
++  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
++fi
++
++if test -n "$ac_config_links"; then
++  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
++fi
++
++if test -n "$ac_config_commands"; then
++  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
++fi
++
++cat >>$CONFIG_STATUS <<\_ACEOF
++
++ac_cs_usage="\
++\`$as_me' instantiates files from templates according to the
++current configuration.
++
++Usage: $0 [OPTIONS] [FILE]...
++
++  -h, --help       print this help, then exit
++  -V, --version    print version number, then exit
++  -q, --quiet      do not print progress messages
++  -d, --debug      don't remove temporary files
++      --recheck    update $as_me by reconfiguring in the same conditions
++  --file=FILE[:TEMPLATE]
++                 instantiate the configuration file FILE
++
++Configuration files:
++$config_files
++
++Report bugs to <bug-autoconf@gnu.org>."
++_ACEOF
++
++cat >>$CONFIG_STATUS <<_ACEOF
++ac_cs_version="\\
++config.status
++configured by $0, generated by GNU Autoconf 2.59,
++  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
++
++Copyright (C) 2003 Free Software Foundation, Inc.
++This config.status script is free software; the Free Software Foundation
++gives unlimited permission to copy, distribute and modify it."
++srcdir=$srcdir
++INSTALL="$INSTALL"
++_ACEOF
++
++cat >>$CONFIG_STATUS <<\_ACEOF
++# If no file are specified by the user, then we need to provide default
++# value.  By we need to know if files were specified by the user.
++ac_need_defaults=:
++while test $# != 0
+ do
+-  case "\$ac_option" in
++  case $1 in
++  --*=*)
++    ac_option=`expr "x$1" : 'x\([^=]*\)='`
++    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
++    ac_shift=:
++    ;;
++  -*)
++    ac_option=$1
++    ac_optarg=$2
++    ac_shift=shift
++    ;;
++  *) # This is not an option, so the user has probably given explicit
++     # arguments.
++     ac_option=$1
++     ac_need_defaults=false;;
++  esac
++
++  case $ac_option in
++  # Handling of the options.
++_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF
+   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+-    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+-    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+-  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+-    echo "$CONFIG_STATUS generated by autoconf version 2.4"
+-    exit 0 ;;
+-  -help | --help | --hel | --he | --h)
+-    echo "\$ac_cs_usage"; exit 0 ;;
+-  *) echo "\$ac_cs_usage"; exit 1 ;;
++    ac_cs_recheck=: ;;
++  --version | --vers* | -V )
++    echo "$ac_cs_version"; exit 0 ;;
++  --he | --h)
++    # Conflict between --help and --header
++    { { echo "$as_me:$LINENO: error: ambiguous option: $1
++Try \`$0 --help' for more information." >&5
++echo "$as_me: error: ambiguous option: $1
++Try \`$0 --help' for more information." >&2;}
++   { (exit 1); exit 1; }; };;
++  --help | --hel | -h )
++    echo "$ac_cs_usage"; exit 0 ;;
++  --debug | --d* | -d )
++    debug=: ;;
++  --file | --fil | --fi | --f )
++    $ac_shift
++    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
++    ac_need_defaults=false;;
++  --header | --heade | --head | --hea )
++    $ac_shift
++    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
++    ac_need_defaults=false;;
++  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
++  | -silent | --silent | --silen | --sile | --sil | --si | --s)
++    ac_cs_silent=: ;;
++
++  # This is an error.
++  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
++Try \`$0 --help' for more information." >&5
++echo "$as_me: error: unrecognized option: $1
++Try \`$0 --help' for more information." >&2;}
++   { (exit 1); exit 1; }; } ;;
++
++  *) ac_config_targets="$ac_config_targets $1" ;;
++
+   esac
++  shift
+ done
+-ac_given_srcdir=$srcdir
+-ac_given_INSTALL="$INSTALL"
+-
+-trap 'rm -fr `echo "Makefile man/Makefile src/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+-
+-# Protect against being on the right side of a sed subst in config.status. 
+-sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
+- s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+-$ac_vpsub
+-$extrasub
+-s%@CFLAGS@%$CFLAGS%g
+-s%@CPPFLAGS@%$CPPFLAGS%g
+-s%@CXXFLAGS@%$CXXFLAGS%g
+-s%@DEFS@%$DEFS%g
+-s%@LDFLAGS@%$LDFLAGS%g
+-s%@LIBS@%$LIBS%g
+-s%@exec_prefix@%$exec_prefix%g
+-s%@prefix@%$prefix%g
+-s%@program_transform_name@%$program_transform_name%g
+-s%@DIFF@%$DIFF%g
+-s%@DIFF_SUCCESS@%$DIFF_SUCCESS%g
+-s%@DIFF_FAILURE@%$DIFF_FAILURE%g
+-s%@DIFF_TROUBLE@%$DIFF_TROUBLE%g
+-s%@DIFFFLAGS@%$DIFFFLAGS%g
+-s%@DIFF_L@%$DIFF_L%g
+-s%@DIFF3@%$DIFF3%g
+-s%@DIFF3_BIN@%$DIFF3_BIN%g
+-s%@ED@%$ED%g
+-s%@SENDMAIL@%$SENDMAIL%g
+-s%@PIC@%$PIC%g
+-s%@CC@%$CC%g
+-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+-s%@INSTALL_DATA@%$INSTALL_DATA%g
+-s%@SET_MAKE@%$SET_MAKE%g
++ac_configure_extra_args=
++
++if $ac_cs_silent; then
++  exec 6>/dev/null
++  ac_configure_extra_args="$ac_configure_extra_args --silent"
++fi
++
++_ACEOF
++cat >>$CONFIG_STATUS <<_ACEOF
++if \$ac_cs_recheck; then
++  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
++  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
++fi
++
++_ACEOF
++
++
++
++
++
++cat >>$CONFIG_STATUS <<\_ACEOF
++for ac_config_target in $ac_config_targets
++do
++  case "$ac_config_target" in
++  # Handling of arguments.
++  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
++  "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
++  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
++  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
++echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
++   { (exit 1); exit 1; }; };;
++  esac
++done
++
++# If the user did not use the arguments to specify the items to instantiate,
++# then the envvar interface is used.  Set only those that are not.
++# We use the long form for the default assignment because of an extremely
++# bizarre bug on SunOS 4.1.3.
++if $ac_need_defaults; then
++  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
++fi
++
++# Have a temporary directory for convenience.  Make it in the build tree
++# simply because there is no reason to put it here, and in addition,
++# creating and moving files from /tmp can sometimes cause problems.
++# Create a temporary directory, and hook for its removal unless debugging.
++$debug ||
++{
++  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
++  trap '{ (exit 1); exit 1; }' 1 2 13 15
++}
++
++# Create a (secure) tmp directory for tmp files.
++
++{
++  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
++  test -n "$tmp" && test -d "$tmp"
++}  ||
++{
++  tmp=./confstat$$-$RANDOM
++  (umask 077 && mkdir $tmp)
++} ||
++{
++   echo "$me: cannot create a temporary directory in ." >&2
++   { (exit 1); exit 1; }
++}
++_ACEOF
++
++cat >>$CONFIG_STATUS <<_ACEOF
++
++#
++# CONFIG_FILES section.
++#
++
++# No need to generate the scripts if there are no CONFIG_FILES.
++# This happens for instance when ./config.status config.h
++if test -n "\$CONFIG_FILES"; then
++  # Protect against being on the right side of a sed subst in config.status.
++  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
++   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
++s,@SHELL@,$SHELL,;t t
++s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
++s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
++s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
++s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
++s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
++s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
++s,@exec_prefix@,$exec_prefix,;t t
++s,@prefix@,$prefix,;t t
++s,@program_transform_name@,$program_transform_name,;t t
++s,@bindir@,$bindir,;t t
++s,@sbindir@,$sbindir,;t t
++s,@libexecdir@,$libexecdir,;t t
++s,@datadir@,$datadir,;t t
++s,@sysconfdir@,$sysconfdir,;t t
++s,@sharedstatedir@,$sharedstatedir,;t t
++s,@localstatedir@,$localstatedir,;t t
++s,@libdir@,$libdir,;t t
++s,@includedir@,$includedir,;t t
++s,@oldincludedir@,$oldincludedir,;t t
++s,@infodir@,$infodir,;t t
++s,@mandir@,$mandir,;t t
++s,@build_alias@,$build_alias,;t t
++s,@host_alias@,$host_alias,;t t
++s,@target_alias@,$target_alias,;t t
++s,@DEFS@,$DEFS,;t t
++s,@ECHO_C@,$ECHO_C,;t t
++s,@ECHO_N@,$ECHO_N,;t t
++s,@ECHO_T@,$ECHO_T,;t t
++s,@LIBS@,$LIBS,;t t
++s,@DIFF@,$DIFF,;t t
++s,@DIFF_SUCCESS@,$DIFF_SUCCESS,;t t
++s,@DIFF_FAILURE@,$DIFF_FAILURE,;t t
++s,@DIFF_TROUBLE@,$DIFF_TROUBLE,;t t
++s,@DIFFFLAGS@,$DIFFFLAGS,;t t
++s,@DIFF_L@,$DIFF_L,;t t
++s,@DIFF3@,$DIFF3,;t t
++s,@DIFF3_BIN@,$DIFF3_BIN,;t t
++s,@ED@,$ED,;t t
++s,@SENDMAIL@,$SENDMAIL,;t t
++s,@PIC@,$PIC,;t t
++s,@CC@,$CC,;t t
++s,@CFLAGS@,$CFLAGS,;t t
++s,@LDFLAGS@,$LDFLAGS,;t t
++s,@CPPFLAGS@,$CPPFLAGS,;t t
++s,@ac_ct_CC@,$ac_ct_CC,;t t
++s,@EXEEXT@,$EXEEXT,;t t
++s,@OBJEXT@,$OBJEXT,;t t
++s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
++s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
++s,@INSTALL_DATA@,$INSTALL_DATA,;t t
++s,@SET_MAKE@,$SET_MAKE,;t t
++s,@LIBOBJS@,$LIBOBJS,;t t
++s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+ CEOF
+-EOF
+-cat >> $CONFIG_STATUS <<EOF
+-CONFIG_FILES=\${CONFIG_FILES-"Makefile man/Makefile src/Makefile"}
+-EOF
+-cat >> $CONFIG_STATUS <<\EOF
+-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+-  # Support "outfile[:infile]", defaulting infile="outfile.in".
+-  case "$ac_file" in
+-  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
+-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+-  *) ac_file_in="${ac_file}.in" ;;
+-  esac
+-
+-  # Adjust relative srcdir, etc. for subdirectories.
+-
+-  # Remove last slash and all that follows it.  Not all systems have dirname.
+-  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+-    # The file is in a subdirectory.
+-    test ! -d "$ac_dir" && mkdir "$ac_dir"
+-    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+-    # A "../" for each directory in $ac_dir_suffix.
+-    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+-  else
+-    ac_dir_suffix= ac_dots=
++_ACEOF
++
++  cat >>$CONFIG_STATUS <<\_ACEOF
++  # Split the substitutions into bite-sized pieces for seds with
++  # small command number limits, like on Digital OSF/1 and HP-UX.
++  ac_max_sed_lines=48
++  ac_sed_frag=1 # Number of current file.
++  ac_beg=1 # First line for current file.
++  ac_end=$ac_max_sed_lines # Line after last line for current file.
++  ac_more_lines=:
++  ac_sed_cmds=
++  while $ac_more_lines; do
++    if test $ac_beg -gt 1; then
++      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
++    else
++      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
++    fi
++    if test ! -s $tmp/subs.frag; then
++      ac_more_lines=false
++    else
++      # The purpose of the label and of the branching condition is to
++      # speed up the sed processing (if there are no `@' at all, there
++      # is no need to browse any of the substitutions).
++      # These are the two extra sed commands mentioned above.
++      (echo ':t
++  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
++      if test -z "$ac_sed_cmds"; then
++      ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
++      else
++      ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
++      fi
++      ac_sed_frag=`expr $ac_sed_frag + 1`
++      ac_beg=$ac_end
++      ac_end=`expr $ac_end + $ac_max_sed_lines`
++    fi
++  done
++  if test -z "$ac_sed_cmds"; then
++    ac_sed_cmds=cat
+   fi
++fi # test -n "$CONFIG_FILES"
++
++_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF
++for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
++  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
++  case $ac_file in
++  - | *:- | *:-:* ) # input from stdin
++      cat >$tmp/stdin
++      ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
++      ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
++  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
++      ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
++  * )   ac_file_in=$ac_file.in ;;
++  esac
+-  case "$ac_given_srcdir" in
+-  .)  srcdir=.
+-      if test -z "$ac_dots"; then top_srcdir=.
+-      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+-  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
++  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
++  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
++$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++       X"$ac_file" : 'X\(//\)[^/]' \| \
++       X"$ac_file" : 'X\(//\)$' \| \
++       X"$ac_file" : 'X\(/\)' \| \
++       .     : '\(.\)' 2>/dev/null ||
++echo X"$ac_file" |
++    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
++        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
++        /^X\(\/\/\)$/{ s//\1/; q; }
++        /^X\(\/\).*/{ s//\1/; q; }
++        s/.*/./; q'`
++  { if $as_mkdir_p; then
++    mkdir -p "$ac_dir"
++  else
++    as_dir="$ac_dir"
++    as_dirs=
++    while test ! -d "$as_dir"; do
++      as_dirs="$as_dir $as_dirs"
++      as_dir=`(dirname "$as_dir") 2>/dev/null ||
++$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
++       X"$as_dir" : 'X\(//\)[^/]' \| \
++       X"$as_dir" : 'X\(//\)$' \| \
++       X"$as_dir" : 'X\(/\)' \| \
++       .     : '\(.\)' 2>/dev/null ||
++echo X"$as_dir" |
++    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
++        /^X\(\/\/\)[^/].*/{ s//\1/; q; }
++        /^X\(\/\/\)$/{ s//\1/; q; }
++        /^X\(\/\).*/{ s//\1/; q; }
++        s/.*/./; q'`
++    done
++    test ! -n "$as_dirs" || mkdir $as_dirs
++  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
++echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
++   { (exit 1); exit 1; }; }; }
++
++  ac_builddir=.
++
++if test "$ac_dir" != .; then
++  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
++  # A "../" for each directory in $ac_dir_suffix.
++  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
++else
++  ac_dir_suffix= ac_top_builddir=
++fi
++
++case $srcdir in
++  .)  # No --srcdir option.  We are building in place.
++    ac_srcdir=.
++    if test -z "$ac_top_builddir"; then
++       ac_top_srcdir=.
++    else
++       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
++    fi ;;
++  [\\/]* | ?:[\\/]* )  # Absolute path.
++    ac_srcdir=$srcdir$ac_dir_suffix;
++    ac_top_srcdir=$srcdir ;;
+   *) # Relative path.
+-    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+-    top_srcdir="$ac_dots$ac_given_srcdir" ;;
++    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
++    ac_top_srcdir=$ac_top_builddir$srcdir ;;
++esac
++
++# Do not use `cd foo && pwd` to compute absolute paths, because
++# the directories may not exist.
++case `pwd` in
++.) ac_abs_builddir="$ac_dir";;
++*)
++  case "$ac_dir" in
++  .) ac_abs_builddir=`pwd`;;
++  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
++  *) ac_abs_builddir=`pwd`/"$ac_dir";;
++  esac;;
++esac
++case $ac_abs_builddir in
++.) ac_abs_top_builddir=${ac_top_builddir}.;;
++*)
++  case ${ac_top_builddir}. in
++  .) ac_abs_top_builddir=$ac_abs_builddir;;
++  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
++  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
++  esac;;
++esac
++case $ac_abs_builddir in
++.) ac_abs_srcdir=$ac_srcdir;;
++*)
++  case $ac_srcdir in
++  .) ac_abs_srcdir=$ac_abs_builddir;;
++  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
++  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
++  esac;;
++esac
++case $ac_abs_builddir in
++.) ac_abs_top_srcdir=$ac_top_srcdir;;
++*)
++  case $ac_top_srcdir in
++  .) ac_abs_top_srcdir=$ac_abs_builddir;;
++  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
++  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
++  esac;;
++esac
++
++
++  case $INSTALL in
++  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
++  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+   esac
+-  case "$ac_given_INSTALL" in
+-  [/$]*) INSTALL="$ac_given_INSTALL" ;;
+-  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+-  esac
+-  echo creating "$ac_file"
+-  rm -f "$ac_file"
+-  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+-  case "$ac_file" in
+-  *Makefile*) ac_comsub="1i\\
+-# $configure_input" ;;
+-  *) ac_comsub= ;;
+-  esac
+-  sed -e "$ac_comsub
+-s%@configure_input@%$configure_input%g
+-s%@srcdir@%$srcdir%g
+-s%@top_srcdir@%$top_srcdir%g
+-s%@INSTALL@%$INSTALL%g
+-" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
+-fi; done
+-rm -f conftest.subs
++  # Let's still pretend it is `configure' which instantiates (i.e., don't
++  # use $as_me), people would be surprised to read:
++  #    /* config.h.  Generated by config.status.  */
++  if test x"$ac_file" = x-; then
++    configure_input=
++  else
++    configure_input="$ac_file.  "
++  fi
++  configure_input=$configure_input"Generated from `echo $ac_file_in |
++                                   sed 's,.*/,,'` by configure."
++  # First look for the input files in the build tree, otherwise in the
++  # src tree.
++  ac_file_inputs=`IFS=:
++    for f in $ac_file_in; do
++      case $f in
++      -) echo $tmp/stdin ;;
++      [\\/$]*)
++       # Absolute (can't be DOS-style, as IFS=:)
++       test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
++echo "$as_me: error: cannot find input file: $f" >&2;}
++   { (exit 1); exit 1; }; }
++       echo "$f";;
++      *) # Relative
++       if test -f "$f"; then
++         # Build tree
++         echo "$f"
++       elif test -f "$srcdir/$f"; then
++         # Source tree
++         echo "$srcdir/$f"
++       else
++         # /dev/null tree
++         { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
++echo "$as_me: error: cannot find input file: $f" >&2;}
++   { (exit 1); exit 1; }; }
++       fi;;
++      esac
++    done` || { (exit 1); exit 1; }
++  if test x"$ac_file" != x-; then
++    { echo "$as_me:$LINENO: creating $ac_file" >&5
++echo "$as_me: creating $ac_file" >&6;}
++    rm -f "$ac_file"
++  fi
++_ACEOF
++cat >>$CONFIG_STATUS <<_ACEOF
++  sed "$ac_vpsub
++$extrasub
++_ACEOF
++cat >>$CONFIG_STATUS <<\_ACEOF
++:t
++/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
++s,@configure_input@,$configure_input,;t t
++s,@srcdir@,$ac_srcdir,;t t
++s,@abs_srcdir@,$ac_abs_srcdir,;t t
++s,@top_srcdir@,$ac_top_srcdir,;t t
++s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
++s,@builddir@,$ac_builddir,;t t
++s,@abs_builddir@,$ac_abs_builddir,;t t
++s,@top_builddir@,$ac_top_builddir,;t t
++s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
++s,@INSTALL@,$ac_INSTALL,;t t
++" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
++  rm -f $tmp/stdin
++  if test x"$ac_file" != x-; then
++    mv $tmp/out $ac_file
++  else
++    cat $tmp/out
++    rm -f $tmp/out
++  fi
+-exit 0
+-EOF
++done
++_ACEOF
++
++cat >>$CONFIG_STATUS <<\_ACEOF
++
++{ (exit 0); exit 0; }
++_ACEOF
+ chmod +x $CONFIG_STATUS
+-rm -fr confdefs* $ac_clean_files
+-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
++ac_clean_files=$ac_clean_files_save
++
++
++# configure is writing to config.log, and then calls config.status.
++# config.status does its own redirection, appending to config.log.
++# Unfortunately, on DOS this fails, as config.log is still kept open
++# by configure, so config.status won't be able to write to it; its
++# output is simply discarded.  So we exec the FD to /dev/null,
++# effectively closing config.log, so it can be properly (re)opened and
++# appended to by config.status.  When coming back to configure, we
++# need to make the FD available again.
++if test "$no_create" != yes; then
++  ac_cs_success=:
++  ac_config_status_args=
++  test "$silent" = yes &&
++    ac_config_status_args="$ac_config_status_args --quiet"
++  exec 5>/dev/null
++  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
++  exec 5>>config.log
++  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
++  # would make configure fail if this is the last instruction.
++  $ac_cs_success || { (exit 1); exit 1; }
++fi
+--- rcs-5.7.orig/configure.in
++++ rcs-5.7/configure.in
+@@ -243,7 +243,7 @@
+ AC_PATH_PROG(ED, ed, ed)
+ ac_save_path=$PATH
+-PATH=/usr/lib:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
++PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/lib:$PATH
+ AC_PATH_PROGS(SENDMAIL, sendmail mail mailx)
+ PATH=$ac_save_path
+ case $SENDMAIL in
+--- rcs-5.7.orig/src/rcs.c
++++ rcs-5.7/src/rcs.c
+@@ -916,10 +916,11 @@
+               getkeystring(Klog);
+               if (nextdelta == cuttail) {
+                       cb = savestring(&curlogbuf);
+-                      if (!delta->log.string)
++                      if (delta && !delta->log.string)
+                           delta->log = cleanlogmsg(curlogbuf.string, cb.size);
+                       nextlex();
+-                      delta->igtext = getphrases(Ktext);
++                      if (delta)
++                              delta->igtext = getphrases(Ktext);
+               } else {
+                       if (nextdelta->log.string && nextdelta->selector) {
+                               foutptr = 0;
+--- rcs-5.7.orig/src/rcsfreeze.sh
++++ rcs-5.7/src/rcsfreeze.sh
+@@ -59,8 +59,7 @@
+ # Stamp the logfile. Because we order the logfile the most recent
+ # first we will have to save everything right now in a temporary file.
+-TMPLOG=/tmp/rcsfrz$$
+-trap 'rm -f $TMPLOG; exit 1' 1 2 13 15
++TMPLOG=$(tempfile)
+ # Now ask for a log message, continously add to the log file
+ (
+       echo "Version: $SYMREVNAME($SYMREV), Date: $DATE
+--- rcs-5.7.orig/src/rcsbase.h
++++ rcs-5.7/src/rcsbase.h
+@@ -358,6 +358,7 @@
+       char const        * lockedby; /* who locks the revision             */
+       char const        * state;    /* state of revision (Exp by default) */
+       char const        * name;     /* name (if any) by which retrieved   */
++      char const        * commitid; /* text string to associate commits   */
+       struct cbuf         log;      /* log message requested at checkin   */
+         struct branchhead * branches; /* list of first revisions on branches*/
+       struct cbuf         ig;       /* ignored phrases in admin part      */
+@@ -662,6 +663,7 @@
+ extern char const *const expand_names[];
+ extern char const
+       Kaccess[], Kauthor[], Kbranch[], Kcomment[],
++      Kcommitid[],
+       Kdate[], Kdesc[], Kexpand[], Khead[], Klocks[], Klog[],
+       Knext[], Kstate[], Kstrict[], Ksymbols[], Ktext[];
+ void unexpected_EOF P((void)) exiting;
+--- rcs-5.7.orig/src/rcssyn.c
++++ rcs-5.7/src/rcssyn.c
+@@ -171,6 +171,7 @@
+       Kauthor[]   = "author",
+       Kbranch[]   = "branch",
+       Kcomment[]  = "comment",
++      Kcommitid[] = "commitid",
+       Kdate[]     = "date",
+       Kdesc[]     = "desc",
+       Kexpand[]   = "expand",
+@@ -433,6 +434,14 @@
+       Delta->lockedby = 0;
+       Delta->log.string = 0;
+       Delta->selector = true;
++
++      if (getkeyopt(Kcommitid)) {
++              Delta->commitid = NextString;
++              nextlex();
++              getsemi(Kcommitid);
++        } else
++              Delta->commitid = NULL;
++
+       Delta->ig = getphrases(Kdesc);
+         TotalDeltas++;
+         return (true);
+--- rcs-5.7.orig/src/rcsdiff.c
++++ rcs-5.7/src/rcsdiff.c
+@@ -212,9 +212,13 @@
+                   }
+                   goto option_handled;
+           case '-': case 'D':
+-                  no_diff_means_no_output = false;
++                  if (c == 'D'
++                      || strcmp(*argv, "--side-by-side") == 0
++                      || strcmp(*argv, "--ifdef") == 0) {
++                      no_diff_means_no_output = false;
++                  }
+                   /* fall into */
+-          case 'C': case 'F': case 'I': case 'L': case 'W':
++          case 'C': case 'F': case 'I': case 'L': case 'U': case 'W':
+ #if DIFF_L
+                   if (c == 'L'  &&  ++file_labels == 2)
+                       faterror("too many -L options");
+--- rcs-5.7.orig/src/ident.c
++++ rcs-5.7/src/ident.c
+@@ -234,7 +234,7 @@
+       if (c == EOF  &&  feof(fp) | ferror(fp))
+        return c;
+       switch (ctab[c]) {
+-       case LETTER: case Letter:
++       case LETTER: case Letter: case DIGIT:
+           *tp++ = c;
+           if (tp < line+sizeof(line)-4)
+              break;
+--- rcs-5.7.orig/src/conf.sh
++++ rcs-5.7/src/conf.sh
+@@ -73,17 +73,6 @@
+       ech='echo -n' dots='... '
+ esac
+-$ech >&3 "$0: testing permissions $dots"
+-rm -f a.d &&
+-date >a.d &&
+-chmod 0 a.d &&
+-{ test -w a.d || cp /dev/null a.d 2>/dev/null; } && {
+-      echo >&3 "$n$0: This command should not be run with superuser permissions."
+-      exit 1
+-}
+-echo >&3 OK
+-rm -f a.d || exit
+-
+ $ech >&3 "$0: testing compiler for plausibility $dots"
+ echo 'main() { return 0; }' >a.c
+ rm -f a.exe a.out || exit
+--- rcs-5.7.orig/src/rcsgen.c
++++ rcs-5.7/src/rcsgen.c
+@@ -547,6 +547,9 @@
+       aprintf(fout, ";\n%s\t%s;\n", Knext, node->next?node->next->num:"");
+       awrite(node->ig.string, node->ig.size, fout);
++
++      if (node->commitid)
++              aprintf(fout, "%s\t%s;\n", Kcommitid, node->commitid);
+ }
+--- rcs-5.7.orig/src/rcsfnms.c
++++ rcs-5.7/src/rcsfnms.c
+@@ -285,6 +285,9 @@
+ {
+       char *p;
+       char const *t = tpnames[n];
++#     if has_mktemp
++      int fd;
++#     endif
+       if (t)
+               return t;
+@@ -296,10 +299,12 @@
+           size_t tplen = dir_useful_len(tp);
+           p = testalloc(tplen + 10);
+           VOID sprintf(p, "%.*s%cT%cXXXXXX", (int)tplen, tp, SLASH, '0'+n);
+-          if (!mktemp(p) || !*p)
++          fd = mkstemp(p);
++          if (fd < 0 || !*p)
+               faterror("can't make temporary pathname `%.*s%cT%cXXXXXX'",
+                       (int)tplen, tp, SLASH, '0'+n
+               );
++          close(fd);
+ #     else
+           static char tpnamebuf[TEMPNAMES][L_tmpnam];
+           p = tpnamebuf[n];
+--- rcs-5.7.orig/src/rcsedit.c
++++ rcs-5.7/src/rcsedit.c
+@@ -1503,6 +1503,9 @@
+       register size_t dl;
+       register struct buf *bn;
+       register char const *name = isworkfile ? workname : RCSname;
++#     if has_mktemp
++      int fd;
++#     endif
+       dl = basefilename(name) - name;
+       bn = &dirtpname[newRCSdirtp_index + isworkfile];
+@@ -1521,10 +1524,12 @@
+       catchints();
+ #     if has_mktemp
+               VOID strcpy(tp, "XXXXXX");
+-              if (!mktemp(np) || !*np)
++              fd = mkstemp(np);
++              if (fd < 0 || !*np)
+                   faterror("can't make temporary pathname `%.*s_%cXXXXXX'",
+                       (int)dl, name, '0'+isworkfile
+                   );
++              close(fd);
+ #     else
+               /*
+                * Posix 1003.1-1990 has no reliable way
+--- rcs-5.7.orig/src/Makefile.in
++++ rcs-5.7/src/Makefile.in
+@@ -116,16 +116,18 @@
+       for p in $(PROGRAMS); do \
+         $(INSTALL_PROGRAM) $$p $(bindir)/$$p; \
+       done
++      $(INSTALL_PROGRAM) rcsfreeze.sh $(bindir)/rcsfreeze
+ uninstall ::
+       for p in $(PROGRAMS); do \
+         $(REMOVE) $(bindir)/$$p; \
+       done
++      $(REMOVE) $(bindir)/rcsfreeze
+ # Install RCS and (if applicable) GNU diff before running these tests.
+ # To test RCS before installing it, see the file INSTALL.RCS.
+ RCSTEST = \
+-      ALL_CFLAGS='$(ALL_CFLAGS)' CC='$(CC)' DIFF='$(DIFF)' \
++      ALL_CFLAGS="$(ALL_CFLAGS)" CC='$(CC)' DIFF='$(DIFF)' \
+       LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
+       PATH=$(bindir):$$PATH \
+       sh $(srcdir)/rcstest
+@@ -153,7 +155,7 @@
+ #(Unix
+ conf.h : conf.sh Makefile
+       $(REMOVE) a.*
+-      ALL_CFLAGS='$(ALL_CFLAGS)' \
++      ALL_CFLAGS="$(ALL_CFLAGS)" \
+       CC='$(CC)' \
+       COMPAT2='$(COMPAT2)' \
+       DIFF3='$(DIFF3)' DIFF3_BIN='$(DIFF3_BIN)' \
+--- rcs-5.7.orig/src/rlog.c
++++ rcs-5.7/src/rlog.c
+@@ -591,6 +591,10 @@
+             aprintf(out, insDelFormat,
+                              editscript->insertlns, editscript->deletelns);
++      if ( node->commitid )
++         aprintf(out, "%s commitid: %s", (editscript) ? ";" : "",
++                 node->commitid);
++
+         newbranch = node->branches;
+         if ( newbranch ) {
+          bufautobegin(&branchnum);
diff --git a/utils/rcs/patches/100-cross_compile.patch b/utils/rcs/patches/100-cross_compile.patch
new file mode 100644 (file)
index 0000000..665ca0f
--- /dev/null
@@ -0,0 +1,413 @@
+--- /dev/null
++++ b/src/conf.h
+@@ -0,0 +1,399 @@
++/* RCS compile-time configuration */
++
++      /* $Id: conf.sh,v 5.25 1995/06/16 06:19:24 eggert Exp $ */
++
++/*
++ * This file is generated automatically.
++ * If you edit it by hand your changes may be lost.
++ * Instead, please try to fix conf.sh,
++ * and send your fixes to rcs-bugs@cs.purdue.edu.
++ */
++
++#define exitmain(n) return n /* how to exit from main() */
++/* #define _POSIX_C_SOURCE 2147483647L */ /* if strict C + Posix 1003.1b-1993 or later */
++/* #define _POSIX_SOURCE */ /* if strict C + Posix 1003.1-1990 */
++
++#include <errno.h>
++#include <stdio.h>
++#include <time.h>
++
++/* Comment out #include lines below that do not work.  */
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <dirent.h>
++#include <fcntl.h>
++#include <limits.h>
++/* #include <mach/mach.h> */
++/* #include <net/errno.h> */
++#include <pwd.h>
++/* #include <siginfo.h> */
++#include <signal.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <sys/wait.h>
++#include <ucontext.h>
++#include <unistd.h>
++#include <utime.h>
++/* #include <vfork.h> */
++
++/* Define boolean symbols to be 0 (false, the default), or 1 (true).  */
++#define has_sys_param_h 1 /* Does #include <sys/param.h> work?  */
++/* extern int errno; */ /* Uncomment if <errno.h> doesn't declare errno.  */
++#define has_readlink 1 /* Does readlink() work?  */
++#define readlink_isreg_errno EINVAL /* errno after readlink on regular file */
++
++#if has_readlink && !defined(MAXSYMLINKS)
++#     if has_sys_param_h
++#             include <sys/param.h>
++#     endif
++#     ifndef MAXSYMLINKS
++#             define MAXSYMLINKS 20 /* BSD; not standard yet */
++#     endif
++#endif
++
++/* Comment out the typedefs below if the types are already declared.  */
++/* Fix any uncommented typedefs that are wrong.  */
++/* typedef int mode_t; */
++/* typedef long off_t; */
++/* typedef int pid_t; */
++/* typedef int sig_atomic_t; */
++/* typedef unsigned size_t; */
++/* typedef int ssize_t; */
++/* typedef long time_t; */
++/* typedef int uid_t; */
++
++/* Comment out the keyword definitions below if the keywords work.  */
++/* #define const */
++/* #define volatile */
++
++/* Define boolean symbols to be 0 (false, the default), or 1 (true).  */
++#define has_prototypes 1 /* Do function prototypes work?  */
++#define has_stdarg 1 /* Does <stdarg.h> work?  */
++/* #define has_varargs ? */ /* Does <varargs.h> work?  */
++#define va_start_args 2 /* How many args does va_start() take?  */
++
++#if O_BINARY
++      /* Text and binary i/o behave differently.  */
++      /* This is incompatible with Posix and Unix.  */
++#     define FOPEN_RB "rb"
++#     define FOPEN_R_WORK (Expand==BINARY_EXPAND ? "r" : "rb")
++#     define FOPEN_WB "wb"
++#     define FOPEN_W_WORK (Expand==BINARY_EXPAND ? "w" : "wb")
++#     define FOPEN_WPLUS_WORK (Expand==BINARY_EXPAND ? "w+" : "w+b")
++#     define OPEN_O_BINARY O_BINARY
++#else
++      /*
++      * Text and binary i/o behave the same.
++      * Omit "b", since some nonstandard hosts reject it.
++      */
++#     define FOPEN_RB "r"
++#     define FOPEN_R_WORK "r"
++#     define FOPEN_WB "w"
++#     define FOPEN_W_WORK "w"
++#     define FOPEN_WPLUS_WORK "w+"
++#     define OPEN_O_BINARY 0
++#endif
++
++/* This may need changing on non-Unix systems (notably DOS).  */
++#define OPEN_CREAT_READONLY (S_IRUSR|S_IRGRP|S_IROTH) /* lock file mode */
++#define OPEN_O_LOCK 0 /* extra open flags for creating lock file */
++#define OPEN_O_WRONLY O_WRONLY /* main open flag for creating a lock file */
++
++/* Define or comment out the following symbols as needed.  */
++#if has_prototypes
++#     define P(params) params
++#else
++#     define P(params) ()
++#endif
++#if has_stdarg
++#     include <stdarg.h>
++#else
++#     if has_varargs
++#             include <varargs.h>
++#     else
++              typedef char *va_list;
++#             define va_dcl int va_alist;
++#             define va_start(ap) ((ap) = (va_list)&va_alist)
++#             define va_arg(ap,t) (((t*) ((ap)+=sizeof(t)))  [-1])
++#             define va_end(ap)
++#     endif
++#endif
++#if va_start_args == 2
++#     define vararg_start va_start
++#else
++#     define vararg_start(ap,p) va_start(ap)
++#endif
++#define bad_chmod_close 0 /* Can chmod() close file descriptors?  */
++#define bad_creat0 0 /* Do writes fail after creat(f,0)?  */
++#define bad_fopen_wplus 0 /* Does fopen(f,"w+") fail to truncate f?  */
++#define getlogin_is_secure 0 /* Is getlogin() secure?  Usually it's not.  */
++#define has_attribute_noreturn 1 /* Does __attribute__((noreturn)) work?  */
++#if has_attribute_noreturn
++#     define exiting __attribute__((noreturn))
++#else
++#     define exiting
++#endif
++#define has_dirent 1 /* Do opendir(), readdir(), closedir() work?  */
++#define void_closedir 0 /* Does closedir() yield void?  */
++#define has_fchmod 1 /* Does fchmod() work?  */
++#define has_fflush_input 1 /* Does fflush() work on input files?  */
++#define has_fputs 1 /* Does fputs() work?  */
++#define has_ftruncate 1 /* Does ftruncate() work?  */
++#define has_getuid 1 /* Does getuid() work?  */
++#define has_getpwuid 1 /* Does getpwuid() work?  */
++#define has_memcmp 1 /* Does memcmp() work?  */
++#define has_memcpy 1 /* Does memcpy() work?  */
++#define has_memmove 1 /* Does memmove() work?  */
++#define has_map_fd 0 /* Does map_fd() work?  */
++#define has_mmap 1 /* Does mmap() work on regular files?  */
++#define has_madvise 1 /* Does madvise() work?  */
++#define mmap_signal SIGBUS /* signal received if you reference nonexistent part of mmapped file */
++#define has_rename 1 /* Does rename() work?  */
++#define bad_a_rename 0 /* Does rename(A,B) fail if A is unwritable?  */
++#define bad_b_rename 0 /* Does rename(A,B) fail if B is unwritable?  */
++#define bad_NFS_rename 0 /* Can rename(A,B) falsely report success?  */
++/* typedef int void; */ /* Some ancient compilers need this.  */
++#define VOID (void) /* 'VOID e;' discards the value of an expression 'e'.  */
++#define has_seteuid 1 /* Does seteuid() work?  See ../INSTALL.RCS.  */
++#define has_setreuid 0 /* Does setreuid() work?  See ../INSTALL.RCS.  */
++#define has_setuid 1 /* Does setuid() exist?  */
++#define has_sigaction 1 /* Does struct sigaction work?  */
++#define has_sa_sigaction 1 /* Does struct sigaction have sa_sigaction?  */
++#define has_signal 1 /* Does signal() work?  */
++#define signal_type void /* type returned by signal handlers */
++#define sig_zaps_handler 0 /* Must a signal handler reinvoke signal()?  */
++/* #define has_sigblock ? */ /* Does sigblock() work?  */
++/* #define sigmask(s) (1 << ((s)-1)) */ /* Yield mask for signal number.  */
++typedef size_t fread_type; /* type returned by fread() and fwrite() */
++typedef size_t freadarg_type; /* type of their size arguments */
++typedef void *malloc_type; /* type returned by malloc() */
++#define has_getcwd 1 /* Does getcwd() work?  */
++/* #define has_getwd ? */ /* Does getwd() work?  */
++#define needs_getabsname 0 /* Must we define getabsname?  */
++#define has_mktemp 1 /* Does mktemp() work?  */
++#define has_NFS 1 /* Might NFS be used?  */
++#define has_psiginfo 0 /* Does psiginfo() work?  */
++#define has_psignal 1 /* Does psignal() work?  */
++/* #define has_si_errno ? */ /* Does siginfo_t have si_errno?  */
++/* #define has_sys_siglist ? */ /* Does sys_siglist[] work?  */
++/* #define strchr index */ /* Use old-fashioned name for strchr()?  */
++/* #define strrchr rindex */ /* Use old-fashioned name for strrchr()?  */
++#define bad_unlink 0 /* Does unlink() fail on unwritable files?  */
++#define has_vfork 1 /* Does vfork() work?  */
++#define has_fork 1 /* Does fork() work?  */
++#define has_spawn 0 /* Does spawn*() work?  */
++#define has_waitpid 1 /* Does waitpid() work?  */
++#define bad_wait_if_SIGCHLD_ignored 1 /* Does ignoring SIGCHLD break wait()?  */
++#define RCS_SHELL "/bin/sh" /* shell to run RCS subprograms */
++#define has_printf_dot 1 /* Does "%.2d" print leading 0?  */
++#define has_vfprintf 1 /* Does vfprintf() work?  */
++#define has_attribute_format_printf 1 /* Does __attribute__((format(printf,N,N+1))) work?  */
++#if has_attribute_format_printf
++#     define printf_string(m, n) __attribute__((format(printf, m, n)))
++#else
++#     define printf_string(m, n)
++#endif
++#if has_attribute_format_printf && has_attribute_noreturn
++      /* Work around a bug in GCC 2.5.x.  */
++#     define printf_string_exiting(m, n) __attribute__((format(printf, m, n), noreturn))
++#else
++#     define printf_string_exiting(m, n) printf_string(m, n) exiting
++#endif
++/* #define has__doprintf ? */ /* Does _doprintf() work?  */
++/* #define has__doprnt ? */ /* Does _doprnt() work?  */
++/* #undef EXIT_FAILURE */ /* Uncomment this if EXIT_FAILURE is broken.  */
++#define large_memory 1 /* Can main memory hold entire RCS files?  */
++#ifndef LONG_MAX
++#define LONG_MAX 2147483647L /* long maximum */
++#endif
++/* Do struct stat s and t describe the same file?  Answer d if unknown.  */
++#define same_file(s,t,d) ((s).st_ino==(t).st_ino && (s).st_dev==(t).st_dev)
++#define has_utimbuf 1 /* Does struct utimbuf work?  */
++#define CO "/usr/bin/co" /* name of 'co' program */
++#define COMPAT2 0 /* Are version 2 files supported?  */
++#define DIFF "/usr/bin/diff" /* name of 'diff' program */
++#define DIFF3 "/usr/bin/diff3" /* name of 'diff3' program */
++#define DIFF3_BIN 1 /* Is diff3 user-visible (not the /usr/lib auxiliary)?  */
++#define DIFFFLAGS "-an" /* Make diff output suitable for RCS.  */
++#define DIFF_L 1 /* Does diff -L work?  */
++#define DIFF_SUCCESS 0 /* DIFF status if no differences are found */
++#define DIFF_FAILURE 1 /* DIFF status if differences are found */
++#define DIFF_TROUBLE 2 /* DIFF status if trouble */
++#define ED "/bin/ed" /* name of 'ed' program (used only if !DIFF3_BIN) */
++#define MERGE "/usr/bin/merge" /* name of 'merge' program */
++#define TMPDIR "/tmp" /* default directory for temporary files */
++#define SLASH '/' /* principal filename separator */
++#define SLASHes '/' /* `case SLASHes:' labels all filename separators */
++#define isSLASH(c) ((c) == SLASH) /* Is arg a filename separator?  */
++#define ROOTPATH(p) isSLASH((p)[0]) /* Is p an absolute pathname?  */
++#define X_DEFAULT ",v/" /* default value for -x option */
++#define SLASHSLASH_is_SLASH 1 /* Are // and / the same directory?  */
++#define ALL_ABSOLUTE 1 /* Do all subprograms satisfy ROOTPATH?  */
++#define DIFF_ABSOLUTE 1 /* Is ROOTPATH(DIFF) true?  */
++#define SENDMAIL "/usr/sbin/sendmail" /* how to send mail */
++#define TZ_must_be_set 0 /* Must TZ be set for gmtime() to work?  */
++
++
++
++/* Adjust the following declarations as needed.  */
++
++
++/* The rest is for the benefit of non-standard, traditional hosts.  */
++/* Don't bother to declare functions that in traditional hosts do not appear, */
++/* or are declared in .h files, or return int or void.  */
++
++
++/* traditional BSD */
++
++#if has_sys_siglist && !defined(sys_siglist)
++      extern char const * const sys_siglist[];
++#endif
++
++
++/* Posix (ISO/IEC 9945-1: 1990 / IEEE Std 1003.1-1990) */
++
++/* <fcntl.h> */
++#ifdef O_CREAT
++#     define open_can_creat 1
++#else
++#     define open_can_creat 0
++#     define O_RDONLY 0
++#     define O_WRONLY 1
++#     define O_RDWR 2
++#     define O_CREAT 01000
++#     define O_TRUNC 02000
++#endif
++#ifndef O_EXCL
++#define O_EXCL 0
++#endif
++
++/* <sys/stat.h> */
++#ifndef S_IRUSR
++#     ifdef S_IREAD
++#             define S_IRUSR S_IREAD
++#     else
++#             define S_IRUSR 0400
++#     endif
++#     ifdef S_IWRITE
++#             define S_IWUSR S_IWRITE
++#     else
++#             define S_IWUSR (S_IRUSR/2)
++#     endif
++#endif
++#ifndef S_IRGRP
++#     if has_getuid
++#             define S_IRGRP (S_IRUSR / 0010)
++#             define S_IWGRP (S_IWUSR / 0010)
++#             define S_IROTH (S_IRUSR / 0100)
++#             define S_IWOTH (S_IWUSR / 0100)
++#     else
++              /* single user OS -- not Posix or Unix */
++#             define S_IRGRP 0
++#             define S_IWGRP 0
++#             define S_IROTH 0
++#             define S_IWOTH 0
++#     endif
++#endif
++#ifndef S_ISREG
++#define S_ISREG(n) (((n) & S_IFMT) == S_IFREG)
++#endif
++
++/* <sys/wait.h> */
++#ifndef WEXITSTATUS
++#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
++#undef WIFEXITED /* Avoid 4.3BSD incompatibility with Posix.  */
++#endif
++#ifndef WIFEXITED
++#define WIFEXITED(stat_val) (((stat_val)  &  0377) == 0)
++#endif
++#ifndef WTERMSIG
++#define WTERMSIG(stat_val) ((stat_val) & 0177)
++#undef WIFSIGNALED /* Avoid 4.3BSD incompatibility with Posix.  */
++#endif
++#ifndef WIFSIGNALED
++#define WIFSIGNALED(stat_val) ((unsigned)(stat_val) - 1  <  0377)
++#endif
++
++/* <unistd.h> */
++char *getlogin P((void));
++#ifndef STDIN_FILENO
++#     define STDIN_FILENO 0
++#     define STDOUT_FILENO 1
++#     define STDERR_FILENO 2
++#endif
++#if has_fork && !has_vfork
++#     undef vfork
++#     define vfork fork
++#endif
++#if has_getcwd || !has_getwd
++      char *getcwd P((char*,size_t));
++#else
++      char *getwd P((char*));
++#endif
++#if has_setuid && !has_seteuid
++#     undef seteuid
++#     define seteuid setuid
++#endif
++#if has_spawn
++#     if ALL_ABSOLUTE
++#             define spawn_RCS spawnv
++#     else
++#             define spawn_RCS spawnvp
++#     endif
++#else
++#     if ALL_ABSOLUTE
++#             define exec_RCS execv
++#     else
++#             define exec_RCS execvp
++#     endif
++#endif
++
++/* utime.h */
++#if !has_utimbuf
++      struct utimbuf { time_t actime, modtime; };
++#endif
++
++
++/* Standard C library */
++
++/* <stdio.h> */
++#ifndef L_tmpnam
++#define L_tmpnam 32 /* power of 2 > sizeof("/usr/tmp/xxxxxxxxxxxxxxx") */
++#endif
++#ifndef SEEK_SET
++#define SEEK_SET 0
++#endif
++#ifndef SEEK_CUR
++#define SEEK_CUR 1
++#endif
++#if has_mktemp
++      char *mktemp P((char*)); /* traditional */
++#else
++      char *tmpnam P((char*));
++#endif
++
++/* <stdlib.h> */
++char *getenv P((char const*));
++void _exit P((int)) exiting;
++void exit P((int)) exiting;
++malloc_type malloc P((size_t));
++malloc_type realloc P((malloc_type,size_t));
++#ifndef EXIT_FAILURE
++#define EXIT_FAILURE 1
++#endif
++#ifndef EXIT_SUCCESS
++#define EXIT_SUCCESS 0
++#endif
++
++/* <string.h> */
++char *strcpy P((char*,char const*));
++char *strchr P((char const*,int));
++char *strrchr P((char const*,int));
++void *memcpy P((void*,void const*,size_t));
++#if has_memmove
++      void *memmove P((void*,void const*,size_t));
++#endif
++
++/* <time.h> */
++time_t time P((time_t*));
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -153,7 +153,7 @@
+       $(REMOVE) TAGS
+ #(Unix
+-conf.h : conf.sh Makefile
++conf.h :
+       $(REMOVE) a.*
+       ALL_CFLAGS="$(ALL_CFLAGS)" \
+       CC='$(CC)' \
diff --git a/utils/rdiff-backup/Makefile b/utils/rdiff-backup/Makefile
new file mode 100644 (file)
index 0000000..5a01803
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2006-2009 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:=rdiff-backup
+PKG_VERSION:=1.2.8
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://savannah.nongnu.org/download/rdiff-backup/
+PKG_MD5SUM:=1a94dc537fcf74d6a3a80bd27808e77b
+
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/rdiff-backup
+  SUBMENU:=backup
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Incremental backup utility
+  URL:=http://www.nongnu.org/rdiff-backup
+  DEPENDS:=+python +librsync +libpopt +openssl-util
+endef
+
+define Package/rdiff-backup/description
+       rdiff-backup backs up one directory to another, possibly over a
+       network. The target directory ends up a copy of the source directory,
+       but extra reverse diffs are stored in a special subdirectory of that
+       target directory, so you can still recover files lost some time ago.
+       The idea is to combine the best features of a mirror and an incremental
+       backup.
+endef
+
+define PyPackage/rdiff-backup/filespec
++|/usr/bin/rdiff-backup
++|$(PYTHON_PKG_DIR)/rdiff_backup
+endef
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,., \
+               build --librsync-dir="$(STAGING_DIR)/usr" , \
+       )
+       $(call Build/Compile/PyMod,., \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+endef
+
+$(eval $(call PyPackage,rdiff-backup))
+$(eval $(call BuildPackage,rdiff-backup))
diff --git a/utils/rdiff-backup/patches/001-python_path.patch b/utils/rdiff-backup/patches/001-python_path.patch
new file mode 100644 (file)
index 0000000..5142645
--- /dev/null
@@ -0,0 +1,8 @@
+--- a/rdiff-backup
++++ b/rdiff-backup
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python
+ # rdiff-backup -- Mirror files while keeping incremental changes
+ # Version 1.0.5 released November 11, 2006
+ # Copyright (C) 2001-2005  Ben Escoto <rdiff-backup@emerose.org>
diff --git a/utils/redboot-ar231x/Makefile b/utils/redboot-ar231x/Makefile
new file mode 100644 (file)
index 0000000..b07b5a3
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2008 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:=redboot-ar231x
+PKG_VERSION:=2010-10-26
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_TARGETS:=bin
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://nbd.name/redboot-ar231x.git
+PKG_SOURCE_VERSION:=327f02ce1645d3427f26cf8116353332c81564a9
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.bz2
+
+include $(INCLUDE_DIR)/package.mk
+
+export GCC_HONOUR_COPTS=s
+
+define Package/redboot-ar231x
+  SECTION:=boot
+  CATEGORY:=Boot Loaders
+  DEPENDS:=@TARGET_atheros @BROKEN
+  TITLE:=Tiny redboot for AR231x/AR531x
+endef
+
+define Build/Configure
+       mkdir -p $(PKG_BUILD_DIR)/host-build
+       if [ \! -x $(PKG_BUILD_DIR)/host-install/bin/ecosconfig ]; then ( \
+               cd $(PKG_BUILD_DIR)/host-build; \
+               ../ecos/host/configure \
+                       --prefix=$(PKG_BUILD_DIR)/host-install \
+                       --exec-prefix=$(PKG_BUILD_DIR)/host-install; \
+               CFLAGS="$(HOST_CFLAGS)" $(MAKE) all install; \
+       ) fi
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) all
+endef
+
+define Package/redboot-ar231x/install
+       $(CP) $(PKG_BUILD_DIR)/bin/* $(1)/
+endef
+
+$(eval $(call BuildPackage,redboot-ar231x))
diff --git a/utils/redboot-ar231x/patches/010-fix-compile.patch b/utils/redboot-ar231x/patches/010-fix-compile.patch
new file mode 100644 (file)
index 0000000..962b133
--- /dev/null
@@ -0,0 +1,181 @@
+--- a/ecos/packages/hal/mips/ap30/current/cdl/hal_mips_ap30.cdl
++++ b/ecos/packages/hal/mips/ap30/current/cdl/hal_mips_ap30.cdl
+@@ -98,7 +98,7 @@ cdl_package CYGPKG_HAL_MIPS_AP30 {\r
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<\r
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@\r
+         @echo $@ ": \\" > $(notdir $@).deps\r
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps\r
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps\r
+         @echo >> $(notdir $@).deps\r
+         @rm plf_defs.tmp plf_mk_defs.tmp\r
+     }\r
+--- a/ecos/packages/hal/mips/ap43/current/cdl/hal_mips_ap43.cdl
++++ b/ecos/packages/hal/mips/ap43/current/cdl/hal_mips_ap43.cdl
+@@ -98,7 +98,7 @@ cdl_package CYGPKG_HAL_MIPS_AP43 {\r
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<\r
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@\r
+         @echo $@ ": \\" > $(notdir $@).deps\r
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps\r
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps\r
+         @echo >> $(notdir $@).deps\r
+         @rm plf_defs.tmp plf_mk_defs.tmp\r
+     }\r
+--- a/ecos/packages/hal/mips/ap48/current/cdl/hal_mips_ap48.cdl
++++ b/ecos/packages/hal/mips/ap48/current/cdl/hal_mips_ap48.cdl
+@@ -98,7 +98,7 @@ cdl_package CYGPKG_HAL_MIPS_AP48 {\r
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<\r
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@\r
+         @echo $@ ": \\" > $(notdir $@).deps\r
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps\r
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps\r
+         @echo >> $(notdir $@).deps\r
+         @rm plf_defs.tmp plf_mk_defs.tmp\r
+     }\r
+--- a/ecos/packages/hal/mips/ap51/current/cdl/hal_mips_ap51.cdl
++++ b/ecos/packages/hal/mips/ap51/current/cdl/hal_mips_ap51.cdl
+@@ -93,7 +93,7 @@ cdl_package CYGPKG_HAL_MIPS_AP51 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/ap53/current/cdl/hal_mips_ap53.cdl
++++ b/ecos/packages/hal/mips/ap53/current/cdl/hal_mips_ap53.cdl
+@@ -93,7 +93,7 @@ cdl_package CYGPKG_HAL_MIPS_AP53 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/ap61/current/cdl/hal_mips_ap61.cdl
++++ b/ecos/packages/hal/mips/ap61/current/cdl/hal_mips_ap61.cdl
+@@ -93,7 +93,7 @@ cdl_package CYGPKG_HAL_MIPS_AP61 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/ap65/current/cdl/hal_mips_ap65.cdl
++++ b/ecos/packages/hal/mips/ap65/current/cdl/hal_mips_ap65.cdl
+@@ -93,7 +93,7 @@ cdl_package CYGPKG_HAL_MIPS_AP65 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/pb32/current/cdl/hal_mips_pb32.cdl
++++ b/ecos/packages/hal/mips/pb32/current/cdl/hal_mips_pb32.cdl
+@@ -91,7 +91,7 @@ cdl_package CYGPKG_HAL_MIPS_PB32 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/pb44/current/cdl/hal_mips_pb44.cdl
++++ b/ecos/packages/hal/mips/pb44/current/cdl/hal_mips_pb44.cdl
+@@ -99,7 +99,7 @@ cdl_package CYGPKG_HAL_MIPS_PB44 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/pb45/current/cdl/hal_mips_pb45.cdl
++++ b/ecos/packages/hal/mips/pb45/current/cdl/hal_mips_pb45.cdl
+@@ -99,7 +99,7 @@ cdl_package CYGPKG_HAL_MIPS_PB45 {
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@
+         @echo $@ ": \\" > $(notdir $@).deps
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps
+         @echo >> $(notdir $@).deps
+         @rm plf_defs.tmp plf_mk_defs.tmp
+     }
+--- a/ecos/packages/hal/mips/tb225/current/cdl/hal_mips_tb225.cdl
++++ b/ecos/packages/hal/mips/tb225/current/cdl/hal_mips_tb225.cdl
+@@ -99,7 +99,7 @@ cdl_package CYGPKG_HAL_MIPS_TB225 {\r
+         $(CC) $(CFLAGS) $(INCLUDE_PATH) -Wp,-MD,plf_defs.tmp -o plf_mk_defs.tmp -S $<\r
+         fgrep .equ plf_mk_defs.tmp | sed s/#// > $@\r
+         @echo $@ ": \\" > $(notdir $@).deps\r
+-        @tail +2 plf_defs.tmp >> $(notdir $@).deps\r
++        @tail -n +2 plf_defs.tmp >> $(notdir $@).deps\r
+         @echo >> $(notdir $@).deps\r
+         @rm plf_defs.tmp plf_mk_defs.tmp\r
+     }\r
+--- a/ecos/host/tools/configtool/standalone/common/cdl_exec.cxx
++++ b/ecos/host/tools/configtool/standalone/common/cdl_exec.cxx
+@@ -51,6 +51,7 @@
+ #endif
+ #include "build.hxx"
+ #include "cdl_exec.hxx"
++#include <linux/limits.h>
+ // ----------------------------------------------------------------------------
+ bool cdl_exec::quiet            = false;
+--- a/ecos/host/tools/configtool/standalone/common/ecosconfig.cxx
++++ b/ecos/host/tools/configtool/standalone/common/ecosconfig.cxx
+@@ -50,6 +50,7 @@
+ #endif
+ #include "cdl_exec.hxx"
+ #include "ecosconfig.hxx"
++#include <cstring>
+ #define TOOL_VERSION "2.net"
+ #define TOOL_COPYRIGHT "Copyright (c) 2002 Red Hat, Inc."
+--- a/ecos/host/libcdl/build.cxx
++++ b/ecos/host/libcdl/build.cxx
+@@ -57,6 +57,7 @@
+ // It implicitly supplies <string>, <vector> and <map> because
+ // the class definitions rely on these headers.
+ #include <cdlcore.hxx>
++#include <cstring>
+ //}}}
+--- a/ecos/host/libcdl/parse.cxx
++++ b/ecos/host/libcdl/parse.cxx
+@@ -58,6 +58,7 @@
+ // It implicitly supplies <string>, <vector> and <map> because
+ // the class definitions rely on these headers.
+ #include <cdlcore.hxx>
++#include <cstring> 
+ //}}}
+--- a/ecos/host/libcdl/cdlmisc.cxx
++++ b/ecos/host/libcdl/cdlmisc.cxx
+@@ -66,6 +66,7 @@
+ // For access to strtod()
+ #include <cstdlib>
++#include <cstring> 
+ // strtod() involves errno...
+ #include <cerrno>
+--- a/ecos/host/infra/assert.cxx
++++ b/ecos/host/infra/assert.cxx
+@@ -61,6 +61,7 @@
+ // STDLIB is needed for exit() and the status codes.
+ #include <cstdio>
+ #include <cstdlib>
++#include <cstring>
+ #if defined(__unix__) || defined(__CYGWIN32__)
+ extern "C" {
diff --git a/utils/reiserfsprogs/Makefile b/utils/reiserfsprogs/Makefile
new file mode 100644 (file)
index 0000000..593e56f
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006-2009 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:=reiserfsprogs
+PKG_VERSION:=3.6.21
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/reiserfs/
+PKG_MD5SUM:=bc00c7c4e047902575dc4e1c64ab3ba4
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/reiserfsprogs
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Filesystem
+  TITLE:=ReiserFS filesystems utilities
+  DEPENDS:=+libuuid
+  URL:=http://www.namesys.com/
+endef
+
+define Package/reiserfsprogs/description
+       This package contains utilities to create, check,
+       resize, and debug ReiserFS filesystems.
+endef
+
+define Package/reiserfsprogs/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(foreach bin,debugreiserfs mkreiserfs reiserfsck reiserfstune resize_reiserfs,$(PKG_INSTALL_DIR)/usr/sbin/$(bin)) $(1)/usr/sbin/
+       ln -sf mkreiserfs $(1)/usr/sbin/mkfs.reiserfs
+       ln -sf reiserfsck $(1)/usr/sbin/fsck.reiserfs
+endef
+
+$(eval $(call BuildPackage,reiserfsprogs))
diff --git a/utils/remind/Makefile b/utils/remind/Makefile
new file mode 100644 (file)
index 0000000..8f28b3c
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=remind
+PKG_VERSION:=03.01.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=remind-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.roaringpenguin.com/files/download/
+PKG_MD5SUM:=de16cbfc3ee94defcb1abdf78b2ebcd1
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/remind-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/remind
+       SECTION:=utils
+       CATEGORY:=Utilities
+       TITLE:=Reminder
+       URL:=http://www.roaringpenguin.com/files/download/
+endef
+
+define Package/remind/description
+       Remind is a powerfull commadline reminder.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --prefix=/usr --with-linux-headers="$(LINUX_DIR)" \
+       )
+endef
+
+define Package/remind/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/remind $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rem2ps $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/www/rem2html $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,remind))
diff --git a/utils/restorefactory/Makefile b/utils/restorefactory/Makefile
new file mode 100644 (file)
index 0000000..ab62c44
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2010 segal.di.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=restorefactory
+PKG_VERSION:=1
+PKG_RELEASE:=6
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/restorefactory
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Mimic original functionality of the reset button
+endef
+
+define Package/restorefactory/description
+RestoreFactory handles the reset button event and issues a "firstboot" command.
+Button and wait time can be configured with a UCI file.
+endef
+
+define Build/Compile
+endef
+
+define Package/restorefactory/install
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/button
+       $(INSTALL_BIN) ./files/hotplug_restorefactory $(1)/etc/hotplug.d/button/50-restorefactory
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/uci_defaults_restorefactory $(1)/etc/uci-defaults/50-restorefactory
+endef
+
+$(eval $(call BuildPackage,restorefactory))
diff --git a/utils/restorefactory/files/hotplug_restorefactory b/utils/restorefactory/files/hotplug_restorefactory
new file mode 100755 (executable)
index 0000000..5273499
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+system_config() {
+       config_get button "$1" button "reset"
+       config_get action "$1" action "pressed"
+       config_get timeout "$1" timeout "5"
+}
+
+config_load system
+config_foreach system_config restorefactory
+
+[ "$BUTTON" = "$button" ] && {
+
+       [ -f /tmp/run/restorefactory.pid ] && read PID < /tmp/run/restorefactory.pid && kill $PID && rm /tmp/run/restorefactory.pid && logger -p user.info -t "restorefactory" "restore to factory defaults aborted"
+
+       [ "$ACTION" = "$action" ] && {
+
+               if [ "$timeout" -gt 0 ]
+               then
+                       sleep "$timeout" && firstboot && reboot &
+                       echo $! > /tmp/run/restorefactory.pid
+                       logger -p user.info -t "restorefactory" "restoring to factory defaults in $timeout seconds"
+               elif [ "$timeout" -eq 0 ]
+               then
+                       firstboot && reboot &
+               else
+                       logger -p user.info -t "restorefactory" "invalid timeout value ($timeout)"
+               fi
+       }
+} 
+
diff --git a/utils/restorefactory/files/uci_defaults_restorefactory b/utils/restorefactory/files/uci_defaults_restorefactory
new file mode 100755 (executable)
index 0000000..1af088e
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+uci -q show system.@restorefactory[0] || {
+       uci add system restorefactory
+       uci set system.@restorefactory[0].button=reset
+       uci set system.@restorefactory[0].action=pressed
+       uci set system.@restorefactory[0].timeout=5
+       uci commit
+}
+
diff --git a/utils/rrdcollect/Makefile b/utils/rrdcollect/Makefile
new file mode 100644 (file)
index 0000000..c062d20
--- /dev/null
@@ -0,0 +1,158 @@
+#
+# 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:=rrdcollect
+PKG_VERSION:=0.2.4
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/rrdcollect
+PKG_MD5SUM:=fd7ac95195e3e5cbab0677629505d9be
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rrdcollect/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://rrdcollect.sourceforge.net/
+endef
+
+define Package/rrdcollect/Default/description
+ RRDcollect is a daemon which polls ceratin files in /proc/
+ directory, gathering data and storing it inside RRDtool's
+ database files. Being written in C should be both fast
+ and resources-friendly. Supports both scanf(3)-style
+ pattern matches and perl compatible regular expressions.
+endef
+
+define Package/rrdcollect10
+$(call Package/rrdcollect/Default)
+  TITLE:=Round-Robin Database (RRD) collecting daemon
+  PROVIDES:=rrdcollect
+  DEPENDS:=+librrd1
+  VARIANT:=rrdtool10
+endef
+
+define Package/rrdcollect10/description
+$(call Package/rrdcollect/Default/description)
+ .
+ This package contains the RRD collecting daemon, linked against
+ rrdtool-1.0.x shared library.
+endef
+
+define Package/rrdcollect12
+$(call Package/rrdcollect/Default)
+  TITLE:=Round-Robin Database (RRD) collecting daemon
+  PROVIDES:=rrdcollect
+  DEPENDS:=+librrd
+  VARIANT:=rrdtool12
+endef
+
+define Package/rrdcollect12/description
+$(call Package/rrdcollect/Default/description)
+ .
+ This package contains the RRD collecting daemon, linked against
+ rrdtool-1.2.x shared library.
+endef
+
+
+define Package/rrdcollect10-example
+$(call Package/rrdcollect/Default)
+  TITLE:=Example setup for RRD collecting daemon above
+  DEPENDS:=rrdcollect +rrdtool1
+  VARIANT:=rrdtool12
+endef
+
+define Package/rrdcollect10-example/description
+$(call Package/rrdcollect/Default/description)
+ .
+ This package contains examples for the RRD collecting daemon, using
+ rrdtool-1.0.x shared library and utilities.
+endef
+
+define Package/rrdcollect12-example
+$(call Package/rrdcollect/Default)
+  TITLE:=Example setup for RRD collecting daemon above
+  DEPENDS:=rrdcollect +rrdtool
+  VARIANT:=rrdtool12
+endef
+
+define Package/rrdcollect12-example/description
+$(call Package/rrdcollect/Default/description)
+ This package contains examples for the RRD collecting daemon, using
+ rrdtool-1.2.x shared library and utilities.
+endef
+
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --disable-static \
+       --disable-rpath \
+       --enable-exec \
+       --without-rrdtool \
+       --with-librrd \
+       --without-libpcre \
+       --without-libpcap \
+
+CONFIGURE_VARS+= \
+       CFLAGS="$(TARGET_CFLAGS) -DSOCKET_COMM" \
+
+EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+ifeq ($(BUILD_VARIANT),rrdtool10)
+
+  TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/lib/rrdtool-1.0/include $(TARGET_CPPFLAGS)
+  TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib/rrdtool-1.0/lib $(TARGET_CPPFLAGS)
+
+endif
+
+ifeq ($(BUILD_VARIANT),rrdtool12)
+
+  TARGET_CPPFLAGS:=-I$(STAGING_DIR)/usr/lib/rrdtool-1.2/include $(TARGET_CPPFLAGS)
+  TARGET_LDFLAGS:=-L$(STAGING_DIR)/usr/lib/rrdtool-1.2/lib $(TARGET_CPPFLAGS)
+
+endif
+
+define Package/rrdcollect/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rrdcollect $(1)/usr/sbin/
+endef
+
+Package/rrdcollect10/install = $(Package/rrdcollect/install)
+Package/rrdcollect12/install = $(Package/rrdcollect/install)
+
+define Package/rrdcollect-example/conffiles
+/etc/rrd.conf
+/etc/rrdcollect.conf
+endef
+
+define Package/rrdcollect-example/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/rrd.conf $(1)/etc/
+       $(INSTALL_DATA) ./files/rrdcollect.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rrdcollect.init $(1)/etc/init.d/rrdcollect
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/rrd.sh $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/www/cgi-bin
+       ln -sf /var/lib/rrdcollect/rrd.cgi $(1)/www/cgi-bin/rrd.cgi
+       ln -sf /var/lib/rrdcollect/img $(1)/www/img
+endef
+
+Package/rrdcollect10-example/install = $(Package/rrdcollect-example/install)
+Package/rrdcollect12-example/install = $(Package/rrdcollect-example/install)
+
+$(eval $(call BuildPackage,rrdcollect10))
+$(eval $(call BuildPackage,rrdcollect10-example))
+$(eval $(call BuildPackage,rrdcollect12))
+$(eval $(call BuildPackage,rrdcollect12-example))
diff --git a/utils/rrdcollect/files/rrd.conf b/utils/rrdcollect/files/rrd.conf
new file mode 100644 (file)
index 0000000..4ee13ce
--- /dev/null
@@ -0,0 +1,381 @@
+#
+# Author:   Christian Rost (chr@baltic-online.de)
+# Purpose:  Shell-Interface to rrdtool
+#
+# Configuration-File for rrd.sh
+#
+DATADIR=/var/lib/rrdcollect
+# Location of *.rrd-data-files
+RRDDIR=$DATADIR/rrd
+# Location of *.png-files
+IMGDIR=$DATADIR/img
+# Hostname used in title of png-images
+HOSTNAME="WRT54GS"
+# Location of rrdtool
+RRDTOOL=/usr/bin/rrdtool
+# Location of rrdcgi
+RRDCGI=/usr/bin/rrdcgi
+# Location of generated cgi-script
+RRDCGISCRIPT=$DATADIR/rrd.cgi
+# Image-Path relative to webserver-root
+RRDCGIIMGPATH="/img"
+# Location of netcat (used for fetching data from rrdcollect-daemon)
+NETCAT=/usr/bin/nc
+
+# Alternative settings for use on external machines
+#RRDDIR=/home/webm/htdocs/stats/rrd/rrd
+#IMGDIR=/home/webm/htdocs/stats/rrd/web
+#RRDTOOL=/opt/rrd/bin/rrdtool
+#RRDCGI=/opt/rrd/bin/rrdcgi
+#RRDCGISCRIPT=/home/webm/cgi-bin/rrd.cgi
+#RRDCGIIMGPATH="/stats/rrd/web"
+#NETCAT=/opt/bin/nc
+
+
+####################################################################################
+# Configuration of statistic sources:
+#
+# Column 1:  Time-periods
+#            I'm interrested in last-24hour-, last-week- and last-month-plots.
+# Column 2:  Define precision/resolution of above three intervalls
+#            These values have an impact on the size of your rrd-files,
+#            and on the sharpness of your plots
+#            RES=1 means maximum precision (every pixel in the plot is individual)
+#            RES=4 -> 4 pixel represents one interval
+
+# Optimized values for storing rather small rrd-files on the openwrt-box
+HOURS=24;H_RES=2;DAYS=7;D_RES=4;WEEKS=4;W_RES=4;
+# Measure-Step (Same value should be in the rrdcollect.conf) Optimal: STEP=$HOURS / $PIXWIDTH * 3600 * $H_RES
+STEP=360; MAXSTEP=`expr $STEP \* 2`
+
+# Values for storing rrd-files externally outside the router allowing better resolution
+#HOURS=24;H_RES=1;DAYS=32;D_RES=2;WEEKS=50;W_RES=2;
+#STEP=180; MAXSTEP=`expr $STEP \* 2`
+# Even better resolution
+#HOURS=8;H_RES=1;DAYS=32;D_RES=2;WEEKS=50;W_RES=2;
+#STEP=60; MAXSTEP=`expr $STEP \* 2`
+
+# Format and size of the plots PIXWIDTH will be used in 
+# calculating rrd-data-file dimensions during init of rrd-files
+# If you change the size you must change NCGIPIXWIDTH too
+PIXWIDTH=480
+PIXHEIGHT=120
+PIXFORMAT=PNG
+
+# Image-Size of the thumbnail for rrdcgi
+SCGIPIXWIDTH=400
+# Normal Image-Size for rrdcgi (480px plotsize in rrd) 
+NCGIPIXWIDTH=571
+
+# Predefined colors
+RED0=#ff0000; RED1=#ff5555;
+GRN0=#009828; GRN1=#81ffa2;
+ORG0=#ff9900; ORG1=#ffc571;
+BLU0=#0030ff; BLU1=#8ba1ff;
+CYA0=#ff00FF; CYA1=#ffbcfe;
+YEL0=#ffff00; YEL1=#e0df76;
+BLK0=#000000; BLK1=#7d7d7d;
+WHI0=#FFFFFF; WHI1=#c1c1c1;
+
+# Date-String used when creating images with rrd.sh
+DATE=`/bin/date "+%d.%m.%Y %H:%M:%S"`
+
+# Max-Values bytes/second and packets/second for WAN/Wifi/LAN Interfaces
+MAXWANB=130000
+MAXWANP=500
+MAXWIFB=600000
+MAXWIFP=800
+MAXLANB=1200000
+MAXLANP=1000
+
+# RRD-Types:
+# GAUGE=save the  value itself, no calculations at all
+# COUNTER=continuously increasing value. difference between last 2 values must be positive ! (Traffic-Counter)
+# DERIVE=like counter but can store negative values (rate of change in free disk-space)
+#
+# General syntax: PREFIX_POSTFIX=[-]<rrdcollect-variable>|Legend|RRD-Type|Maximum|Color|RRD-Plot-Type|Printf-Precision|Optional rrdgraph def-arguments
+
+################
+# Sys-Statistics
+################
+SYS_L01=" l1|System Load  (1 min)|GAUGE|U|$YEL0|AREA|%6.2lf"
+SYS_L05=" l2|System Load  (5 min)|GAUGE|U|$ORG0|STACK|%6.2lf"
+SYS_L15=" l3|System Load (15 min)|GAUGE|U|$RED0|STACK|%6.2lf"
+
+SYS_CPN=" cn|CPU nice            |COUNTER|U|$YEL0|AREA|%6.2lf%%"
+SYS_CPU=" cu|CPU user            |COUNTER|U|$ORG0|STACK|%6.2lf%%"
+SYS_CPS=" cs|CPU system          |COUNTER|U|$RED0|STACK|%6.2lf%%"
+SYS_CPI=" ci|CPU idle            |COUNTER|U|$GRN0|STACK|%6.2lf%%"
+
+SYS_MEU=" mu|Memory used         |GAUGE|U|$BLU0|AREA"
+SYS_MEF=" mf|Memory free         |GAUGE|U|$GRN0|STACK"
+#SYS_MES=" ms|Memory shared       |GAUGE|U|$BLK0|LINE1"
+SYS_MEB=" mb|Memory buffer       |GAUGE|U|$YEL0|LINE1"
+SYS_MEC=" mc|Memory cached       |GAUGE|U|$RED0|LINE1"
+
+SYS_FUS=" us|Flash Disk Used     |GAUGE|U|$BLU0|AREA|%6.2lf%s|CDEF:usC=us,1024,* CDEF:MAXusC=us,1024,*"
+SYS_FAV=" av|Flash Disk Available|GAUGE|U|$GRN0|STACK|%6.2lf%s|CDEF:avC=av,1024,* CDEF:MAXavC=av,1024,*"
+
+SYS_IRA="ira|Interrupts total    |COUNTER|U|$RED0|AREA"
+SYS_IRE="ire|Interrupts eth0     |COUNTER|U|$ORG0|AREA"
+SYS_IRW="irw|Interrupts wifi     |COUNTER|U|$YEL0|STACK"
+
+SYS_PRT=" pt|Processes total     |GAUGE|U|$BLU0|AREA|%6.0lf"
+SYS_CTX=" ct|Context switches    |COUNTER|U|$RED0|LINE2|%6.0lf"
+SYS_PRR=" pr|Processes active    |GAUGE|U|$ORG0|AREA|%6.0lf"
+SYS_ARP="arp|Arp Entries         |GAUGE|U|$YEL0|LINE2|%6.0lf"
+SYS_PFK=" fk|Forks               |COUNTER|U|$GRN0|LINE2|%6.0lf"
+SYS_CON="con|NAT-Connections     |GAUGE|U|$CYA0|LINE2|%6.0lf"
+
+# Plot-Titles
+MISC_STATS="Misc ($HOSTNAME)"
+DSK_STATS="Flash Disk Usage ($HOSTNAME)"
+USG_STATS="System Load ($HOSTNAME)"
+MEM_STATS="Memory Usage ($HOSTNAME)"
+CPU_STATS="CPU Usage ($HOSTNAME)"
+IRQ_STATS="Interrupts ($HOSTNAME)"
+
+# Plot-Definitions (sort-order is relevant)
+SYS_CPU_STATS="CPN CPU CPS CPI"
+#SYS_MEM_STATS="MEU MEF MES MEB MEC"
+SYS_MEM_STATS="MEU MEF MEB MEC"
+SYS_USG_STATS="L01 L05 L15"
+SYS_DSK_STATS="FUS FAV"
+SYS_MISC_STATS="PRT PRR ARP PFK CTX CON"
+SYS_IRQ_STATS="IRA IRE IRW"
+
+# Data-Definition needed by init()
+SYS_ALL="$SYS_CPU_STATS $SYS_MEM_STATS $SYS_USG_STATS $SYS_DSK_STATS $SYS_MISC_STATS $SYS_IRQ_STATS"
+
+#################################################################################################
+# Wifi Traffic & Wan Traffic & Tunnel Traffic Statistics ; # LAN: vlan0 , WAN: vlan1 , eth1: WIFI
+#################################################################################################
+IF_WLOBY="Wibo |Outgoing Traffic Wifi      |COUNTER|$MAXWIFB|$GRN1|AREA"
+IF_WLIBY="-Wibi|Incoming Traffic Wifi      |COUNTER|$MAXWIFB|$RED0|AREA"
+IF_WLOPK="Wipo |Outgoing Packets Wifi      |COUNTER|$MAXWIFP|$GRN1|AREA|%6.0lf"
+IF_WLIPK="-Wipi|Incoming Packets Wifi      |COUNTER|$MAXWIFP|$RED0|AREA|%6.0lf"
+
+IF_WAIBY="-Wabi|Incoming Traffic Wan       |COUNTER|$MAXWANB|$BLU0|AREA"
+IF_WAOBY="Wabo |Outgoing Traffic Wan       |COUNTER|$MAXWANB|$ORG1|AREA"
+IF_WAIPK="-Wapi|Incoming Packets Wan       |COUNTER|$MAXWANP|$BLU0|AREA|%6.0lf"
+IF_WAOPK="Wapo |Outgoing Packets Wan       |COUNTER|$MAXWANP|$ORG1|AREA|%6.0lf"
+
+IF_LAIBY="-Labi|Incoming Traffic Lan       |COUNTER|$MAXLANB|$BLU0|AREA"       
+IF_LAOBY="Labo |Outgoing Traffic Lan       |COUNTER|$MAXLANB|$ORG1|AREA"
+IF_LAIPK="-Lapi|Incoming Packets Lan       |COUNTER|$MAXLANP|$BLU0|AREA|%6.0lf"
+IF_LAOPK="Lapo |Outgoing Packets Lan       |COUNTER|$MAXLANP|$ORG1|AREA|%6.0lf"
+
+#IF_TUIBY="-tbi|Incoming Traffic VPN-Tunnel|COUNTER|$MAXWANB|$CYA0|AREA"
+#IF_TUOBY="tbo |Outgoing Traffic VPN-Tunnel|COUNTER|$MAXWANB|$YEL1|AREA"
+#IF_TUIPK="-tpi|Incoming Packets VPN-Tunnel|COUNTER|$MAXWANP|$CYA0|AREA|%6.0lf"
+#IF_TUOPK="tpo |Outgoing Packets VPN-Tunnel|COUNTER|$MAXWANP|$YEL1|AREA|%6.0lf"
+
+# Plot-Titles
+WIFI_TRAFFIC="Wifi Interface Traffic Statistics ($HOSTNAME)"
+WIFI_PACKETS="Wifi Interface Packets Statistics ($HOSTNAME)"
+WAN_TRAFFIC="Wan Interface Traffic Statistics ($HOSTNAME)"
+WAN_PACKETS="Wan Interface Packets Statistics ($HOSTNAME)"
+LAN_TRAFFIC="Lan Interface Traffic Statistics ($HOSTNAME)"
+LAN_PACKETS="Lan Interface Packets Statistics ($HOSTNAME)"
+
+#TUN_TRAFFIC="VPN-Tunnel Interface Traffic Statistics ($HOSTNAME)"
+#TUN_PACKETS="VPN-Tunnel Interface Packets Statistics ($HOSTNAME)"
+
+# Plot-Definitions (sort-order is relevant)
+IF_WIFI_TRAFFIC="WLOBY WLIBY"
+IF_WIFI_PACKETS="WLOPK WLIPK"
+IF_WAN_TRAFFIC="WAIBY WAOBY"
+IF_WAN_PACKETS="WAIPK WAOPK"
+IF_LAN_TRAFFIC="LAIBY LAOBY"
+IF_LAN_PACKETS="LAIPK LAOPK"
+#IF_TUN_TRAFFIC="TUIBY TUOBY"
+#IF_TUN_PACKETS="TUIPK TUOPK"
+
+# Data-Definition needed by init()
+#IF_ALL="$IF_WIFI_TRAFFIC $IF_WIFI_PACKETS $IF_WAN_TRAFFIC $IF_WAN_PACKETS $IF_TUN_TRAFFIC $IF_TUN_PACKETS"
+IF_ALL="$IF_LAN_TRAFFIC $IF_LAN_PACKETS  $IF_WAN_TRAFFIC $IF_WAN_PACKETS $IF_WIFI_TRAFFIC $IF_WIFI_PACKETS"
+
+##############################################
+# Port Traffic Statistics  for Port 1 - Port 4
+##############################################
+#PT_OPK1="po1 |Port 1 Outgoing Packets  |COUNTER|U|$ORG1|AREA|%6.0lf"
+#PT_IPK1="-pi1|Port 1 Incoming Packets  |COUNTER|U|$GRN0|AREA|%6.0lf"
+#PT_COL1="cl1 |Port 1 Collisions        |COUNTER|U|$BLU0|AREA|%6.0lf"
+#PT_ERR1="er1 |Port 1 Errors            |COUNTER|U|$CYA0|AREA|%6.0lf"
+#PT_OBY1="bo1 |Port 1 Outgoing Traffic  |COUNTER|U|$ORG1|AREA"
+#PT_IBY1="-bi1|Port 1 Incoming Traffic  |COUNTER|U|$GRN0|AREA"
+#PT_OPK2="po2 |Port 2 Outgoing Packets  |COUNTER|U|$RED1|AREA|%6.0lf"
+#PT_IPK2="-pi2|Port 2 Incoming Packets  |COUNTER|U|$BLK0|AREA|%6.0lf"
+#PT_COL2="cl2 |Port 2 Collisions        |COUNTER|U|$GRN0|AREA|%6.0lf"
+#PT_ERR2="er2 |Port 2 Errors            |COUNTER|U|$ORG0|AREA|%6.0lf"
+#PT_OBY2="bo2 |Port 2 Outgoing Traffic  |COUNTER|U|$RED1|AREA"
+#PT_IBY2="-bi2|Port 2 Incoming Traffic  |COUNTER|U|$BLK0|AREA"
+#PT_OPK3="po3 |Port 3 Outgoing Packets  |COUNTER|U|$BLU1|AREA|%6.0lf"
+#PT_IPK3="-pi3|Port 3 Incoming Packets  |COUNTER|U|$CYA0|AREA|%6.0lf"
+#PT_COL3="cl3 |Port 3 Collisions        |COUNTER|U|$GRN0|AREA|%6.0lf"
+#PT_ERR3="er3 |Port 3 Errors            |COUNTER|U|$ORG0|AREA|%6.0lf"
+#PT_OBY3="bo3 |Port 3 Outgoing Traffic  |COUNTER|U|$BLU1|AREA"
+#PT_IBY3="-bi3|Port 3 Incoming Traffic  |COUNTER|U|$CYA0|AREA"
+#PT_OPK4="po4 |Port 4 Outgoing Packets  |COUNTER|U|$YEL1|AREA|%6.0lf"
+#PT_IPK4="-pi4|Port 4 Incoming Packets  |COUNTER|U|$CYA0|AREA|%6.0lf"
+#PT_COL4="cl4 |Port 4 Collisions        |COUNTER|U|$BLK0|AREA|%6.0lf"
+#PT_ERR4="er4 |Port 4 Errors            |COUNTER|U|$RED0|AREA|%6.0lf"
+#PT_OBY4="bo4 |Port 4 Outgoing Traffic  |COUNTER|U|$YEL1|AREA"
+#PT_IBY4="-bi4|Port 4 Incoming Traffic  |COUNTER|U|$CYA0|AREA"
+
+# Plot-Titles
+#TRAFFIC_1="Traffic Statistics Port 1 ($HOSTNAME)"
+#TRAFFIC_2="Traffic Statistics Port 2 ($HOSTNAME)"
+#TRAFFIC_3="Traffic Statistics Port 3 ($HOSTNAME)"
+#TRAFFIC_4="Traffic Statistics Port 4 ($HOSTNAME)"
+#PACKETS_1="Packet Statistics Port 1 ($HOSTNAME)"
+#PACKETS_2="Packet Statistics Port 2 ($HOSTNAME)"
+#PACKETS_3="Packet Statistics Port 3 ($HOSTNAME)"
+#PACKETS_4="Packet Statistics Port 4 ($HOSTNAME)"
+
+# Plot-Definitions (sort-order is relevant)
+#PT_TRAFFIC_1="OBY1 IBY1"
+#PT_TRAFFIC_2="OBY2 IBY2"
+#PT_TRAFFIC_3="OBY3 IBY3"
+#PT_TRAFFIC_4="OBY4 IBY4"
+#PT_PACKETS_1="OPK1 IPK1 COL1 ERR1"
+#PT_PACKETS_2="OPK2 IPK2 COL2 ERR2"
+#PT_PACKETS_3="OPK3 IPK3 COL3 ERR3"
+#PT_PACKETS_4="OPK4 IPK4 COL4 ERR4"
+#PT_PACKETS_1="OPK1 IPK1"
+#PT_PACKETS_2="OPK2 IPK2"
+#PT_PACKETS_3="OPK3 IPK3"
+#PT_PACKETS_4="OPK4 IPK4"
+
+# Data Definition needed by init()
+#PT_ALL="$PT_TRAFFIC_1 $PT_TRAFFIC_2 $PT_TRAFFIC_3 $PT_TRAFFIC_4 $PT_PACKETS_1 $PT_PACKETS_2 $PT_PACKETS_3 $PT_PACKETS_4"
+
+#################################
+# Traffic Priorisation Statistics
+#################################
+#TC_APRIB="bwa|Ack Priority Queue Bandwidth         |COUNTER|$MAXWANB|$YEL0|AREA"
+#TC_DPRIB="bwd|Default Priority Queue Bandwidth     |COUNTER|$MAXWANB|$ORG0|STACK"
+#TC_HPRIB="bwh|High Priority Queue Bandwidth        |COUNTER|$MAXWANB|$RED0|STACK"
+#TC_LPRIB="bwl|Low Priority Queue Bandwidth         |COUNTER|$MAXWANB|$GRN0|STACK"
+#TC_APRID="dra|Ack Priority Queue Packet Dropped    |COUNTER|100|$YEL0|AREA"
+#TC_DPRID="drd|Default Priority Queue Packet Dropped|COUNTER|100|$ORG0|STACK"
+#TC_HPRID="drh|High Priority Queue Packet Dropped   |COUNTER|100|$RED0|STACK"
+#TC_LPRID="drl|Low Priority Queue Packet Dropped    |COUNTER|100|$GRN0|STACK"
+
+# Plot-Titles
+#TRAFFIC="Traffic Priorisation Stats"
+#PACKETS="Packet Priorisation Stats"
+
+# Plot-Definitions (sort-order is relevant)
+#TC_TRAFFIC="APRIB DPRIB HPRIB LPRIB"
+#TC_PACKETS="APRID DPRID HPRID LPRID"
+
+# Data Definition needed by init()
+#TC_ALL="$TC_TRAFFIC $TC_PACKETS"
+
+#################################
+# Firewall Packet Drop Statistics
+#################################
+#PC_WIN="win|Windows Traffic        |COUNTER|U|$YEL0|AREA"
+#PC_INV="inv|Invalid State Traffic  |COUNTER|U|$ORG0|STACK"
+#PC_TCP="tcp|TCP Packets            |COUNTER|U|$RED0|STACK"
+#PC_OTH="oth|Other Packets          |COUNTER|U|$BLU0|STACK"
+
+# Plot-Titles
+#DROPPED="Firewall Packet Drop Statistics"
+
+# Plot-Definitions (sort-order is relevant)
+#PC_DROPPED="WIN INV TCP OTH"
+
+# Data Definition needed by init()
+#PC_ALL="$PC_DROPPED"
+
+##########################
+# Traffic Accounting Stats
+##########################
+#ACI="Incoming for "; ACO="Outgoing for "
+#IP14="notebook"; COL14=$ORG0; COL_14=$ORG1
+#IP15="saugi   "; COL15=$RED0; COL_15=$RED1
+#IP20="aplink  "; COL20=$GRN0; COL_20=$GRN1
+#IP50="sunny   "; COL50=$BLU0; COL_50=$BLU1
+
+#TYPE=AREA
+#for i in 15 50 20 14
+#do
+#        # Packet-Statistics
+#        eval AC_TIP$i='-TIP$i\|$ACI'"\$IP$i\|COUNTER\|$MAXWANP\|\$COL$i\|$TYPE"
+#        eval  AC_TOP$i='TOP$i\|$ACO'"\$IP$i\|COUNTER\|$MAXWANP\|\$COL_$i\|$TYPE"
+#        eval AC_UIP$i='-UIP$i\|$ACI'"\$IP$i\|COUNTER\|$MAXWANP\|\$COL$i\|$TYPE"
+#        eval  AC_UOP$i='UOP$i\|$ACO'"\$IP$i\|COUNTER\|$MAXWANP\|\$COL_$i\|$TYPE"
+#        eval AC_IIP$i='-IIP$i\|$ACI'"\$IP$i\|COUNTER\|$MAXWANP\|\$COL$i\|$TYPE"
+#        eval  AC_IOP$i='IOP$i\|$ACO'"\$IP$i\|COUNTER\|$MAXWANP\|\$COL_$i\|$TYPE"
+#        # Traffic Statistics
+#        eval AC_TIB$i='-TIB$i\|$ACI'"\$IP$i\|COUNTER\|$MAXWANB\|\$COL$i\|$TYPE"
+#        eval  AC_TOB$i='TOB$i\|$ACO'"\$IP$i\|COUNTER\|$MAXWANB\|\$COL_$i\|$TYPE"
+#        eval AC_UIB$i='-UIB$i\|$ACI'"\$IP$i\|COUNTER\|$MAXWANB\|\$COL$i\|$TYPE"
+#        eval  AC_UOB$i='UOB$i\|$ACO'"\$IP$i\|COUNTER\|$MAXWANB\|\$COL_$i\|$TYPE"
+#        eval AC_IIB$i='-IIB$i\|$ACI'"\$IP$i\|COUNTER\|$MAXWANB\|\$COL$i\|$TYPE"
+#        eval  AC_IOB$i='IOB$i\|$ACO'"\$IP$i\|COUNTER\|$MAXWANB\|\$COL_$i\|$TYPE"
+#      # Plot-Definitions (sort-order is relevant)
+#      AC_TB_O="$AC_TB_O TOB$i"; AC_TB_I="$AC_TB_I TIB$i"
+#        AC_TP_O="$AC_TP_O TOP$i"; AC_TP_I="$AC_TP_I TIP$i"
+#        AC_UB_O="$AC_UB_O UOB$i"; AC_UB_I="$AC_UB_I UIB$i"
+#        AC_UP_O="$AC_UP_O UOP$i"; AC_UP_I="$AC_UP_I UIP$i"
+#        AC_IB_O="$AC_IB_O IOB$i"; AC_IB_I="$AC_IB_I IIB$i"
+#        AC_IP_O="$AC_IP_O IOP$i"; AC_IP_I="$AC_IP_I IIP$i"
+#        TYPE=STACK
+#done 
+#AC_TB="$AC_TB_O $AC_TB_I"; AC_TP="$AC_TP_O $AC_TP_I"
+#AC_UB="$AC_UB_O $AC_UB_I"; AC_UP="$AC_UP_O $AC_UP_I"
+#AC_IB="$AC_IB_O $AC_IB_I"; AC_IP="$AC_IP_O $AC_IP_I";
+
+# Plot-Titles
+#TB="TCP Traffic Accounting Stats ($HOSTNAME)"; TP="TCP  Packet Accounting Stats ($HOSTNAME)"
+#UB="UDP Traffic Accounting Stats ($HOSTNAME)"; UP="UDP  Packet Accounting Stats ($HOSTNAME)"
+#IB="ICMP Traffic Accounting Stats ($HOSTNAME)";IP="ICMP Packet Accounting Stats ($HOSTNAME)"
+
+# Data Definition needed by init()
+#AC_ALL="$AC_TB $AC_TP $AC_UB $AC_UP $AC_IB $AC_IP"
+
+
+# System Statistics
+GRAPH_1="SYS|USG_STATS|$USG_STATS|Load"
+GRAPH_2="SYS|CPU_STATS|$CPU_STATS|CPU-Time_in_%|1000|--upper-limit 100 --rigid --logarithmic --lower-limit 0.1"
+GRAPH_3="SYS|MEM_STATS|$MEM_STATS|Bytes|1024"
+GRAPH_4="SYS|DSK_STATS|$DSK_STATS|Bytes|1024"
+GRAPH_5="SYS|MISC_STATS|$MISC_STATS|_|1000|--logarithmic"
+GRAPH_6="SYS|IRQ_STATS|$IRQ_STATS|IRQ_per_second|1000"
+# Interface Traffic Statistics
+GRAPH_7="IF|LAN_TRAFFIC|$LAN_TRAFFIC|Bytes_per_second"
+GRAPH_8="IF|LAN_PACKETS|$LAN_PACKETS|Packets_per_second"
+GRAPH_9="IF|WAN_TRAFFIC|$WAN_TRAFFIC|Bytes_per_second"
+GRAPH_10="IF|WAN_PACKETS|$WAN_PACKETS|Packets_per_second"
+GRAPH_11="IF|WIFI_TRAFFIC|$WIFI_TRAFFIC|Bytes_per_second"
+GRAPH_12="IF|WIFI_PACKETS|$WIFI_PACKETS|Packets_per_second"
+#GRAPH_11="IF|TUN_TRAFFIC|$TUN_TRAFFIC|Bytes_per_second"
+#GRAPH_12="IF|TUN_PACKETS|$TUN_PACKETS|Packets_per_second"
+# Port Traffic Statistics
+#GRAPH_13="PT|TRAFFIC_1|$TRAFFIC_1|Bytes_per_second"
+#GRAPH_14="PT|PACKETS_1|$PACKETS_1|Packets_per_second"
+#GRAPH_15="PT|TRAFFIC_2|$TRAFFIC_2|Bytes_per_second"
+#GRAPH_16="PT|PACKETS_2|$PACKETS_2|Packets_per_second"
+#GRAPH_17="PT|TRAFFIC_3|$TRAFFIC_3|Bytes_per_second"
+#GRAPH_18="PT|PACKETS_3|$PACKETS_3|Packets_per_second"
+#GRAPH_19="PT|TRAFFIC_4|$TRAFFIC_4|Bytes_per_second"
+#GRAPH_20="PT|PACKETS_4|$PACKETS_4|Packets_per_second"
+# Traffic Priorisation Statistics
+# GRAPH_21="TC|TRAFFIC|$TRAFFIC|Bytes_per_second|1000|--logarithmic"
+# GRAPH_22="TC|PACKETS|$PACKETS|Packets_per_second"
+# Accounting Statistics
+#GRAPH_23="AC|TB|$TB|Bytes_per_second"
+#GRAPH_24="AC|TP|$TP|Packets_per_second"
+#GRAPH_25="AC|UB|$UB|Bytes_per_second"
+#GRAPH_26="AC|UP|$UP|Packets_per_second"
+#GRAPH_27="AC|IB|$IB|Bytes_per_second"
+#GRAPH_28="AC|IP|$IP|Packets_per_second"
+# Firewall Drop Statistics
+#GRAPH_29="PC|DROPPED|$DROPPED|Packets_per_second"
+
+#ALL_PRAEFIXES="SYS IF PT TC AC PC"
+ALL_PRAEFIXES="SYS IF"
+GRAPH_MAX=12
diff --git a/utils/rrdcollect/files/rrd.sh b/utils/rrdcollect/files/rrd.sh
new file mode 100644 (file)
index 0000000..3faa4fb
--- /dev/null
@@ -0,0 +1,288 @@
+#!/bin/sh
+#
+# Author:   Christian Rost (chr@baltic-online.de)
+# Purpose:  Shell-Interface to rrdtool
+#
+RRDCNF=/etc/rrd.conf
+. $RRDCNF
+
+######################################
+# init() function to create .rrd-file
+# $1=VAR-PRAEFIX $2=VAR-POSTFIX 
+######################################
+init()
+{
+       # Calculate optimal step by assuming highest precision on the last-xhour plot
+       OPTSTEP=`expr $HOURS \* 3600 \/ $PIXWIDTH \* $H_RES`
+       [ $OPTSTEP != $STEP ] && echo "WARNING: Your optimal step is: $OPTSTEP. But you are using: $STEP"
+       
+       ARH_AVG=`expr $HOURS \* 3600   \/ $PIXWIDTH \* $H_RES \/ $STEP`; ARH_CNT=`expr $HOURS \* 3600   \/ $ARH_AVG \/ $STEP`
+       ARD_AVG=`expr $DAYS  \* 86400  \/ $PIXWIDTH \* $D_RES \/ $STEP`; ARD_CNT=`expr $DAYS  \* 86400  \/ $ARD_AVG \/ $STEP`
+       ARW_AVG=`expr $WEEKS \* 604800 \/ $PIXWIDTH \* $W_RES \/ $STEP`; ARW_CNT=`expr $WEEKS \* 604800 \/ $ARW_AVG \/ $STEP`
+       
+       PRAEFIX=$1; POSTFIX=$2
+       DSOURCE=""
+       
+       echo "Init storage for $HOURS hours on averages: $ARH_AVG x $STEP seconds ($ARH_CNT total values)"
+       echo "Init storage for $DAYS days on averages: $ARD_AVG x $STEP seconds ($ARD_CNT total values)"
+       echo "Init storage for $WEEKS weeks on averages: $ARW_AVG x $STEP seconds ($ARW_CNT total values)"
+
+       eval  SOURCE=\$${PRAEFIX}_${POSTFIX}
+       for i in $SOURCE
+       do
+               eval var=\$${PRAEFIX}_${i}
+               ifs="$IFS"; IFS="|"; set -- $var
+               if  [ "`echo ${1} | cut -b1`" = "-" ]
+               then
+                       VAR="`echo ${1} | cut -b2-`"
+               else
+                       VAR=`echo $1 | sed "s/ //g"`
+               fi
+                DSOURCE="$DSOURCE DS:${VAR}:${3}:$MAXSTEP:0:${4}"
+               IFS="$ifs"
+        done
+        $DEBUG $RRDTOOL create $RRDDIR/$PRAEFIX.rrd       \
+                --step ${STEP}                            \
+               $DSOURCE                                  \
+                        RRA:AVERAGE:0.5:$ARH_AVG:$ARH_CNT \
+                        RRA:AVERAGE:0.5:$ARD_AVG:$ARD_CNT \
+                        RRA:AVERAGE:0.5:$ARW_AVG:$ARW_CNT \
+                        RRA:MAX:0.5:$ARH_AVG:$ARH_CNT     \
+                        RRA:MAX:0.5:$ARD_AVG:$ARD_CNT     \
+                        RRA:MAX:0.5:$ARW_AVG:$ARW_CNT
+       return $?
+}
+
+#################################################################################################################
+# graph() function to create png-graphics
+# $1=IMG-DIR $2=VAR-PRAEFIX, $3=VAR-POSTFIX, $4=Headline, $5=end, $6=start, $7=base, 
+# $8=DEFS/ENTRIES $9=other rrdgraph options (Vertlabel,...)
+#################################################################################################################
+# COMMENT:"$DATE\c"
+do_rrdgraph()
+{      
+        $DEBUG $NICE $RRDTOOL graph "$1/$2_$3.png" \
+          --title          "$4"             \
+          --imgformat      $PIXFORMAT       \
+          --width          $PIXWIDTH        \
+          --height         $PIXHEIGHT       \
+          --end            "$5"             \
+          --start          "$6"             \
+         --base "$7"                       \
+         $8 $9
+}
+
+#################################################################################################################
+# graph() function to create png-graphics
+# $1=IMG-DIR $2=VAR-PRAEFIX, $3=VAR-POSTFIX, $4=Headline, $5=end, $6=start, $7=base, 
+# $8=DEFS/ENTRIES $9=other rrdgraph options (Vertlabel,...)
+#################################################################################################################
+# COMMENT:"<RRD::TIME::NOW %c>\c"
+do_rrdcgi()
+{
+       cat << EOF > $1/$2_$3.def
+              
+<RRD::GRAPH $1/<RRD::CV START>$2_$3.png \
+--title          "$4"              \
+--imgformat      $PIXFORMAT        \
+--width          $PIXWIDTH         \
+--height         $PIXHEIGHT        \
+--end            "$5"              \
+--start          <RRD::CV START>   \
+--base                  $7                \
+--imginfo        "<IMG NAME=$2_$3 SRC=$RRDCGIIMGPATH/%s OnClick=zoomToggle('${SCGIPIXWIDTH}px','${NCGIPIXWIDTH}px',this); WIDTH=${SCGIPIXWIDTH}px>" \
+--lazy                             \
+$8 $9 >
+EOF
+
+       cat << EOF >> $RRDCGISCRIPT
+$NEWLINE <TD valign=top>$4<br>
+  <RRD::INCLUDE $1/$2_$3.def>
+</TD>
+EOF
+}
+
+
+
+gen_cgi_header()
+{
+       cat << EOF > $RRDCGISCRIPT
+#!$RRDCGI
+<HEAD><TITLE>RRDCGI Router Statistics</TITLE></HEAD>
+<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
+function update_radio_check(robj,value) { for (var i=0; i<robj.length; i++) if (robj[i].value==value) robj[i].checked=1; }
+var nW,oW;
+function zoomToggle(iWideSmall,iWideLarge,whichImage){
+oW=whichImage.style.width;
+if(oW==iWideLarge){
+nW=iWideSmall;}else{
+nW=iWideLarge;}
+whichImage.style.width=nW;
+}
+</SCRIPT>
+<BODY onload="update_radio_check(document.RangeForm.START,'<RRD::CV START>')">
+<H1>RRDCGI Router Statistics <font size-=2><em>(<RRD::TIME::NOW %c>)</em></font></H1>
+<FORM NAME=RangeForm>
+      <INPUT NAME=START TYPE=RADIO VALUE=end-${HOURS}h checked>${HOURS} hours ago
+      <INPUT NAME=START TYPE=RADIO VALUE=end-${DAYS}d>${DAYS} days ago
+      <INPUT NAME=START TYPE=RADIO VALUE=end-${WEEKS}w>${WEEKS} weeks ago
+      <INPUT TYPE=SUBMIT>
+</FORM>
+<P>
+<TABLE>
+EOF
+}
+
+gen_cgi_footer()
+{
+       cat << EOF >> $RRDCGISCRIPT
+</TABLE>
+</P>
+</BODY>
+</HTML>
+EOF
+       chmod +x $RRDCGISCRIPT
+}
+
+#################################################################################################################
+# $1=mode $2=VAR-PRAEFIX, $3=VAR-POSTFIX, $4=Headline, $5=Vertlabel, $6=start, $7=end, $8=base, $9=other rrdgraph options
+#################################################################################################################
+do_graph()
+{
+        MODE=$1; PRAEFIX=$2; POSTFIX=$3; HEADLINE=$4; VERTLABEL=$5; START=$6; END=$7; BASE=$8; SRC=${RRDDIR}/${PRAEFIX}.rrd
+       if [ ! -r "$SRC" ] 
+       then
+               echo "$SRC not found. Aborting all operations now..."
+               exit 1
+       fi
+
+       # For Graphing Memory BASE should be set to 1024, default is 1000
+       [ -n "$8" ] && BASE=$8 || BASE=1000
+       [ -n "$9" ] && OPTS=$9 || OPTS="--lower-limit 0"
+       DEFS=""; ENTRIES=""
+       eval  SOURCE=\$${PRAEFIX}_${POSTFIX}
+       for i in $SOURCE
+       do
+               eval var=\$${PRAEFIX}_${i}
+               ifs="$IFS"; IFS="|"; set -- $var
+               if  [ "`echo ${1} | cut -b1`" = "-" ]
+               then
+                       VAR="`echo ${1} | cut -b2-`"
+                       NEG=1
+               else
+                       VAR=`echo $1 | sed "s/ //g"`
+                       NEG=0
+               fi
+               
+               if [ "$NEG" = 1 ]       
+               then
+                       [ -n "${8}" ] && DEFS="$DEFS DEF:${VAR}=$SRC:${VAR}:AVERAGE  DEF:MAX${VAR}=$SRC:${VAR}:MAX ${8} CDEF:N${VAR}C=${VAR}C,-1,* " \
+                                     || DEFS="$DEFS DEF:${VAR}=$SRC:${VAR}:AVERAGE  DEF:MAX${VAR}=$SRC:${VAR}:MAX CDEF:N${VAR}=${VAR},-1,*"
+               else
+                       [ -n "${8}" ] && DEFS="$DEFS DEF:${VAR}=$SRC:${VAR}:AVERAGE  DEF:MAX${VAR}=$SRC:${VAR}:MAX ${8}" \
+                                     || DEFS="$DEFS DEF:${VAR}=$SRC:${VAR}:AVERAGE  DEF:MAX${VAR}=$SRC:${VAR}:MAX"
+               fi
+               # Now this is a bit ugly, but i don't know how to escape the blanks in a proper way.
+               # If you know any better way to keep the blanks in the legend of the graphics please inform me.
+               #L=`echo ${2} | tr -s "[= =]" '\014'`
+               #L=`echo ${2} | tr -s "[= =]" '_'`
+               L=`echo ${2} | sed "s/ /_/g"`
+               if [ -n "${7}" ]
+               then
+                       if [ -n "${8}" ]                     
+                       then
+                               [ "$NEG" = 1 ] &&  ENTRIES="$ENTRIES ${6}:N${VAR}C${5}:${L}: GPRINT:${VAR}C:AVERAGE:Average\:${7} GPRINT:MAX${VAR}C:MAX:Max\:${7} GPRINT:${VAR}C:LAST:Last\:${7}\\j" \
+                                              ||  ENTRIES="$ENTRIES ${6}:${VAR}C${5}:${L}:  GPRINT:${VAR}C:AVERAGE:Average\:${7} GPRINT:MAX${VAR}C:MAX:Max\:${7} GPRINT:${VAR}C:LAST:Last\:${7}\\j"
+                       else
+                               [ "$NEG" = 1 ] &&  ENTRIES="$ENTRIES ${6}:N${VAR}${5}:${L}: GPRINT:${VAR}:AVERAGE:Average\:${7} GPRINT:MAX${VAR}:MAX:Max\:${7} GPRINT:${VAR}:LAST:Last\:${7}\\j" \
+                                              ||  ENTRIES="$ENTRIES ${6}:${VAR}${5}:${L}:  GPRINT:${VAR}:AVERAGE:Average\:${7} GPRINT:MAX${VAR}:MAX:Max\:${7} GPRINT:${VAR}:LAST:Last\:${7}\\j"
+                       fi
+               else
+                       [ "$NEG" = 1 ] && ENTRIES="$ENTRIES ${6}:N${VAR}${5}:${L}: GPRINT:${VAR}:AVERAGE:Average\:%6.2lf%s GPRINT:MAX${VAR}:MAX:Max\:%6.0lf%s GPRINT:${VAR}:LAST:Last\:%6.2lf%s\\j" \
+                                              || ENTRIES="$ENTRIES ${6}:${VAR}${5}:${L}:  GPRINT:${VAR}:AVERAGE:Average\:%6.2lf%s GPRINT:MAX${VAR}:MAX:Max\:%6.0lf%s GPRINT:${VAR}:LAST:Last\:%6.2lf%s\\j"
+               fi
+               IFS="$ifs"
+       done
+
+       #[ "$POSTFIX" = "CPU_STATS" ] && (echo $OPTS; echo $DEFS ; echo $ENTRIES; echo $OPTS)
+
+       $MODE "$IMGDIR" "$PRAEFIX" "$POSTFIX" "$HEADLINE" "$END" "$START" "$BASE" "$DEFS $ENTRIES"  "--vertical-label $VERTLABEL $OPTS"
+}
+
+# Check if all rrd-files are present 
+# and create them if not
+init_loop()
+{
+       for j in $ALL_PRAEFIXES
+       do
+               if [ ! -f $RRDDIR/$j.rrd ]  
+               then
+                       echo "Creating $RRDDIR/$j.rrd ..."
+                        init $j ALL
+                        [ ! -f $RRDDIR/$j.rrd ] && EXIT=1
+               fi
+       done
+       [ "$EXIT" = 1 ] && return 1 || return 0
+}
+
+
+graph_loop()
+{
+       mode=$1; start=$2; end=$3; c=1 
+       while [ $c -le $GRAPH_MAX ]
+       do
+               eval var=\$GRAPH_${c}
+               # $1=VAR-PRAEFIX $2=VAR-POSTFIX $3=Headline $4=Vertlabel $5=base $6=other rrdgraph options
+               ifs="$IFS"; IFS="|"; set -- $var
+               IFS="$ifs"
+               [ "$1" != "$OLD" -o "`expr \( $c - 1 \) % 2`" = 0 ] && NEWLINE="</TR><TR>" || NEWLINE=""
+               do_graph $mode $1 $2 "$3" "$4" $start $end $5 "$6"
+               c=`expr $c + 1`; OLD=$1
+       done
+}
+
+
+case "$1" in
+       init)
+                       if init_loop 
+                       then
+                               exit 0
+                       else
+                               echo "Initialisation of rrd-database-files failed"
+                               exit 1
+                       fi
+                       ;;
+       cgi)
+                       echo "Updating $RRDCGISCRIPT and $IMGDIR/*.def"
+                       gen_cgi_header
+                       # The start-time will be not used
+                       graph_loop do_rrdcgi end now
+                       gen_cgi_footer
+                       ;;
+       images)
+                       # Create the graphs
+                       [ -n "$2" ] && STH=$2 || STH=24h
+                       echo "Updating Graphs ($STH ago -> now) for $RRDDIR/*.rrd"
+                       graph_loop do_rrdgraph "end-${STH}" now
+                       ;;
+       fetch)
+                       # Fetch data from rrdcollect daemon
+                       if [ ! -n "$3" ]
+                       then
+                               echo "Usage: $0 fetch <host> <port>"
+                               exit 1
+                       else
+                               echo "Fetching ascii-logs from rrdcollect daemon"
+                               (cd $RRDDIR && $NETCAT $2 $3 | sed -n "s:^\(update .*\):$RRDTOOL \1:p" | sh -x ) 2>&1 | wc -l #>/dev/null
+                               exit 0
+                       fi
+                       ;;
+       *)              echo "Usage: $0 <init|cgi|fetch|images>"
+                       echo "  init:   Initialize rrd-datafiles if neeeded"
+                       echo "  cgi:    Creates cgi-script for use with rrdcgi"
+                       echo "  fetch:  Fetching data from rrdcollect via netcat"
+                       echo "  images: Generates images"
+                       exit 1
+                       ;;
+esac
+exit 0
diff --git a/utils/rrdcollect/files/rrdcollect.conf b/utils/rrdcollect/files/rrdcollect.conf
new file mode 100644 (file)
index 0000000..e34c9bf
--- /dev/null
@@ -0,0 +1,33 @@
+step = 360
+directory = /var/lib/rrdcollect/rrd
+
+file:///proc/stat
+"cpu0 %d %d %d %d"                              SYS.rrd:cu,cn,cs,ci
+"ctxt %u"                                       SYS.rrd:ct
+"processes %u"                                  SYS.rrd:fk
+"intr %u"                                       SYS.rrd:ira
+
+file:///proc/meminfo
+#"Mem:  %*d %d %d %d %d %d"                     SYS.rrd:mu,mf,ms,mb,mc
+"Mem:  %*d %d %d %*d %d %d"                     SYS.rrd:mu,mf,mb,mc
+
+file:///proc/loadavg
+"%f %f %f %d/%d %*d"                            SYS.rrd:l1,l2,l3,pr,pt
+
+exec:///bin/df
+"/dev/mtdblock/4 %*d %d %d"                     SYS.rrd:us,av
+
+# LAN: vlan0, WAN: vlan1, WIFI: eth1
+file:///proc/net/dev
+" vlan0:%d %d %*d %*d %*d %*d %*d %*d %d %d"    IF.rrd:Labi,Lapi,Labo,Lapo
+" vlan1:%d %d %*d %*d %*d %*d %*d %*d %d %d"    IF.rrd:Wabi,Wapi,Wabo,Wapo
+" eth1:%d %d %*d %*d %*d %*d %*d %*d %d %d"     IF.rrd:Wibi,Wipi,Wibo,Wipo
+#" tun0:%d %d %*d %*d %*d %*d %*d %*d %d %d"    IF.rrd:tbi,tpi,tbo,tpo
+
+file:///proc/slabinfo
+"ip_conntrack  %d %*d %*d %*d %*d %*d"          SYS.rrd:con
+"arp_cache     %d %*d %*d %*d %*d %*d"           SYS.rrd:arp
+
+file:///proc/interrupts
+"  4: %d MIPS  eth1"                            SYS.rrd:irw
+"  5: %d MIPS  eth0"                            SYS.rrd:ire
diff --git a/utils/rrdcollect/files/rrdcollect.init b/utils/rrdcollect/files/rrdcollect.init
new file mode 100644 (file)
index 0000000..9099c4b
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=98
+
+SERVICE_USE_PID=1
+
+LIB_D=/var/lib/rrdcollect
+CGI_S=$LIB_D/rrd.cgi
+IMG_D=$LIB_D/img
+RRD_D=$LIB_D/rrd
+
+start() {
+       RRD_F=$(find $RRD_D -name "*.rrd" 2>/dev/null)
+       mkdir -m 0755 -p $IMG_D
+       mkdir -m 0755 -p $RRD_D
+       [ -n "$RRD_F" ] || /usr/bin/rrd.sh init
+       [ -x $CGI_S ] || /usr/bin/rrd.sh cgi
+       service_start /usr/sbin/rrdcollect
+}
+
+stop() {
+       service_stop /usr/sbin/rrdcollect
+}
+
diff --git a/utils/rrdtool/Makefile b/utils/rrdtool/Makefile
new file mode 100644 (file)
index 0000000..74f063a
--- /dev/null
@@ -0,0 +1,141 @@
+#
+# Copyright (C) 2007-2012 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:=rrdtool
+PKG_VERSION:=1.2.30
+PKG_RELEASE:=3
+
+PKG_SOURCE_URL:=http://oss.oetiker.ch/rrdtool/pub/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=19b24f7184a8dbf7b48c1bbb565ad9fb
+
+PKG_BUILD_DEPENDS:=python
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_PACKAGE_python-rrd \
+       CONFIG_PACKAGE_rrdcgi \
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/rrdtool/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Round Robin Database (RRD)
+  URL:=http://oss.oetiker.ch/rrdtool/
+endef
+
+define Package/librrd
+$(call Package/rrdtool/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= management library (v1.2.x)
+  DEPENDS+= +libart +libfreetype +libpng +zlib +libpthread
+endef
+
+define Package/rrdcgi
+$(call Package/rrdtool/Default)
+  TITLE+= CGI graphing tool (v1.2.x)
+  DEPENDS+= +librrd +cgilib
+endef
+
+define Package/rrdtool
+$(call Package/rrdtool/Default)
+  TITLE+= management tools (v1.2.x)
+  DEPENDS+= +librrd
+endef
+
+define Package/python-rrd
+$(call Package/rrdtool/Default)
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE+= python bindings (v1.2.x)
+  DEPENDS+= +python-mini +librrd
+endef
+
+CONFIGURE_ARGS += \
+       --enable-shared=yes \
+       --enable-static=yes \
+       --disable-rpath \
+       --with-gnu-ld \
+       --disable-mmap \
+       --disable-perl \
+       --disable-tcl \
+       --disable-ruby \
+       --without-x \
+       --with-rrd-default-font="/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf" \
+
+CONFIGURE_VARS += \
+       rd_cv_ieee_works=yes \
+       rd_cv_null_realloc=nope \
+       ac_cv_func_mmap_fixed_mapped=yes \
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_rrdcgi),)
+  CONFIGURE_ARGS += --enable-rrdcgi
+else
+  CONFIGURE_ARGS += --disable-rrdcgi
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_python-rrd),)
+  CONFIGURE_ARGS += \
+       --enable-python
+  CONFIGURE_VARS += \
+       PYTHON="$(PYTHON)"
+else
+  CONFIGURE_ARGS += --disable-python
+endif
+
+define Build/Compile
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/Default)
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/lib/rrdtool-1.2/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/rrd.h $(1)/usr/lib/rrdtool-1.2/include/
+       $(INSTALL_DIR) $(1)/usr/lib/rrdtool-1.2/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/librrd{,_th}.{a,so*} $(1)/usr/lib/rrdtool-1.2/lib/
+endef
+
+define Package/librrd/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/librrd.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/librrd_th.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share/rrdtool/fonts
+       $(CP) $(PKG_BUILD_DIR)/src/DejaVuSansMono-Roman.ttf \
+               $(1)/usr/share/rrdtool/fonts/
+endef
+
+define Package/rrdcgi/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rrdcgi $(1)/usr/bin/
+endef
+
+define Package/rrdtool/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rrdtool $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rrdupdate $(1)/usr/bin/
+endef
+
+define PyPackage/python-rrd/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* $(1)$(PYTHON_PKG_DIR)/
+endef
+
+$(eval $(call BuildPackage,librrd))
+$(eval $(call BuildPackage,rrdcgi))
+$(eval $(call BuildPackage,rrdtool))
+
+#$(eval $(call PyPackage,python-rrd))
+#$(eval $(call BuildPackage,python-rrd))
diff --git a/utils/rrdtool/patches/010-dont-add-host-include-paths.patch b/utils/rrdtool/patches/010-dont-add-host-include-paths.patch
new file mode 100644 (file)
index 0000000..507a0e9
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/configure
++++ b/configure
+@@ -26319,9 +26319,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  ex_check_save_LIBS=${LIBS}
+  ex_check_save_CPPFLAGS=${CPPFLAGS}
+  ex_check_save_LDFLAGS=${LDFLAGS}
+- if test "x/usr/include/libart-2.0" != "x"; then
+-   CPPFLAGS="$CPPFLAGS -I/usr/include/libart-2.0"
+- fi
+   { echo "$as_me:$LINENO: checking for art_vpath_add_point in -lart_lgpl_2" >&5
+ echo $ECHO_N "checking for art_vpath_add_point in -lart_lgpl_2... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_art_lgpl_2_art_vpath_add_point+set}" = set; then
+@@ -27915,9 +27912,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  ex_check_save_LIBS=${LIBS}
+  ex_check_save_CPPFLAGS=${CPPFLAGS}
+  ex_check_save_LDFLAGS=${LDFLAGS}
+- if test "x/usr/include/freetype2" != "x"; then
+-   CPPFLAGS="$CPPFLAGS -I/usr/include/freetype2"
+- fi
+   { echo "$as_me:$LINENO: checking for FT_Init_FreeType in -lfreetype" >&5
+ echo $ECHO_N "checking for FT_Init_FreeType in -lfreetype... $ECHO_C" >&6; }
+ if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -20,9 +20,6 @@ AC_DEFUN([EX_CHECK_ALL],
+  ex_check_save_LIBS=${LIBS}
+  ex_check_save_CPPFLAGS=${CPPFLAGS}
+  ex_check_save_LDFLAGS=${LDFLAGS}
+- if test "x$7" != "x"; then
+-   CPPFLAGS="$CPPFLAGS -I$7"
+- fi
+  dnl try compiling naked first
+  AC_CHECK_LIB($1,$2, [
+     AC_CHECK_HEADER($3,[LIBS="-l$1 ${LIBS}";EX_CHECK_STATE=YES],[])],[])
diff --git a/utils/rrdtool/patches/020-x86-float-cast.patch b/utils/rrdtool/patches/020-x86-float-cast.patch
new file mode 100644 (file)
index 0000000..f382404
--- /dev/null
@@ -0,0 +1,13 @@
+Index: rrdtool-1.2.30/src/rrd_format.h
+===================================================================
+--- rrdtool-1.2.30.orig/src/rrd_format.h
++++ rrdtool-1.2.30/src/rrd_format.h
+@@ -22,7 +22,7 @@
+ /* #define RRD_VERSION   "0002" */
+ /* changed because microsecond precision requires another field */
+ #define RRD_VERSION   "0003"
+-#define FLOAT_COOKIE  8.642135E130
++#define FLOAT_COOKIE  ((double)8.642135E130)
+ #include "rrd_nan_inf.h"
diff --git a/utils/rrdtool/patches/030-automake-compat.patch b/utils/rrdtool/patches/030-automake-compat.patch
new file mode 100644 (file)
index 0000000..df51205
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/bindings/tcl/Makefile.am
++++ b/bindings/tcl/Makefile.am
+@@ -26,8 +26,8 @@ tclpkgdir = @TCL_PACKAGE_DIR@
+ tclpkg_DATA = pkgIndex.tcl
+ tclpkg_SCRIPTS = ifOctets.tcl
+ else
+-pkglib_DATA = pkgIndex.tcl
+-pkglib_SCRIPTS = ifOctets.tcl
++pkgdata_DATA = pkgIndex.tcl
++pkgdata_SCRIPTS = ifOctets.tcl
+ endif
+ # Automake doen't like `tclrrd$(VERSION)$(TCL_SHLIB_SUFFIX)' as
diff --git a/utils/rsnapshot/Makefile b/utils/rsnapshot/Makefile
new file mode 100644 (file)
index 0000000..a228423
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2007-2010 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:=rsnapshot
+PKG_VERSION:=1.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.rsnapshot.org/downloads/
+PKG_MD5SUM:=588f92995dcf60a6ea6df8d94a017e7e
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rsnapshot
+  SUBMENU:=backup
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=rsnapshot Backup
+  URL:=http://www.rsnapshot.org/
+  DEPENDS:=+rsync +perl \
+               +perlbase-autoloader \
+               +perlbase-class \
+               +perlbase-cwd \
+               +perlbase-dirhandle \
+               +perlbase-essential \
+               +perlbase-fcntl \
+               +perlbase-file \
+               +perlbase-getopt \
+               +perlbase-io \
+               +perlbase-posix \
+               +perlbase-selectsaver \
+               +perlbase-symbol \
+               +perlbase-tie \
+               +perlbase-xsloader
+endef
+
+define Package/rsnapshot/description
+  rsnapshot is a filesystem snapshot utility for making backups of local and
+  remote systems.
+
+  Using rsync and hard links, it is possible to keep multiple, full backups
+  instantly available. The disk space required is just a little more than the
+  space of one full backup, plus incrementals.
+endef
+
+CONFIGURE_ARGS += --with-cp=/bin/cp \
+                 --with-rsync=/usr/bin/rsync \
+                 --with-rm=/bin/rm \
+                 --with-ssh=/usr/bin/ssh \
+                 --with-logger=/usr/bin/logger \
+                 --with-du=/usr/bin/du
+
+define Package/rsnapshot/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/$(PKG_NAME).conf.default $(1)/etc/$(PKG_NAME).conf
+endef
+
+define Package/rsnapshot/conffiles
+/etc/$(PKG_NAME).conf
+endef
+
+$(eval $(call BuildPackage,rsnapshot))
diff --git a/utils/rsnapshot/patches/001-busybox-logger-i.patch b/utils/rsnapshot/patches/001-busybox-logger-i.patch
new file mode 100644 (file)
index 0000000..db4af28
--- /dev/null
@@ -0,0 +1,23 @@
+diff --git a/rsnapshot-program.pl b/rsnapshot-program.pl
+index dfd7ef6..c51b9ff 100755
+--- a/rsnapshot-program.pl
++++ b/rsnapshot-program.pl
+@@ -2164,15 +2164,15 @@ sub syslog_msg {
+       if (defined($config_vars{'cmd_logger'})) {
+               # print out our call to syslog
+               if (defined($verbose) && ($verbose >= 4)) {
+-                      print_cmd("$config_vars{'cmd_logger'} -i -p $facility.$level -t rsnapshot $msg");
++                      print_cmd("$config_vars{'cmd_logger'} -p $facility.$level -t rsnapshot $msg");
+               }
+               
+               # log to syslog
+               if (0 == $test) {
+-                      $result = system($config_vars{'cmd_logger'}, '-i', '-p', "$facility.$level", '-t', 'rsnapshot', $msg);
++                      $result = system($config_vars{'cmd_logger'}, '-p', "$facility.$level", '-t', 'rsnapshot', $msg);
+                       if (0 != $result) {
+                               print_warn("Could not log to syslog:", 2);
+-                              print_warn("$config_vars{'cmd_logger'} -i -p $facility.$level -t rsnapshot $msg", 2);
++                              print_warn("$config_vars{'cmd_logger'} -p $facility.$level -t rsnapshot $msg", 2);
+                       }
+               }
+       }
diff --git a/utils/rsyncrypto/Makefile b/utils/rsyncrypto/Makefile
new file mode 100644 (file)
index 0000000..bb1b6e5
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2012 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:=rsyncrypto
+PKG_VERSION:=1.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/rsyncrypto
+PKG_MD5SUM:=62367d5458ceaab58bbe73030880f538
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rsyncrypto
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Rsync friendly encryption
+  URL:=http://rsyncrypto.lingnu.com/
+  DEPENDS:=+argtable +gzip +libopenssl +libstdcpp
+endef
+
+define Package/rsyncrypto/description
+  rsyncrypto is a utility that encrypts a file (or a directory structure) in a
+  way that ensures that local changes to the plain text file will result in
+  local changes to the cipher text file. This, in turn, ensures that doing rsync
+  to synchronize the encrypted files to another machine will have only a small
+  impact on rsync's efficiency.
+endef
+
+CONFIGURE_ARGS += \
+       --with-openssl="$(STAGING_DIR)/usr"
+
+define Package/rsyncrypto/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rsyncrypto $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,rsyncrypto))
diff --git a/utils/rtklib/Makefile b/utils/rtklib/Makefile
new file mode 100644 (file)
index 0000000..29360b6
--- /dev/null
@@ -0,0 +1,95 @@
+# 
+# Copyright (C) 2014 nunojpg@gmail.com
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rtklib
+PKG_VERSION:=2.4.2_p4
+PKG_RELEASE:=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/tomojitakasu/RTKLIB.git
+PKG_SOURCE_VERSION:=4464e1259f34ba8a8b71f0e5f078faf62e1d9ced
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rtklib/default
+  SUBMENU:=RTKLIB Suite
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://www.rtklib.com/
+  DEPENDS:=+libpthread +librt
+endef
+
+define Package/convbin
+$(call Package/rtklib/default)
+  TITLE:=RINEX Converter
+endef
+
+define Package/pos2kml
+$(call Package/rtklib/default)
+  TITLE:=Solution to KML converter
+endef
+
+define Package/rnx2rtkp
+$(call Package/rtklib/default)
+  TITLE:=Post-Processing Analysis
+endef
+
+define Package/rtkrcv
+$(call Package/rtklib/default)
+  TITLE:=Real-Time Positioning
+endef
+
+define Package/str2str
+$(call Package/rtklib/default)
+  TITLE:=Communication Server
+endef
+
+define Build/Compile
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)
+       $(MAKE) -C $(PKG_BUILD_DIR)/app/convbin/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+       $(MAKE) -C $(PKG_BUILD_DIR)/app/pos2kml/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+       $(MAKE) -C $(PKG_BUILD_DIR)/app/rnx2rtkp/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+       $(MAKE) -C $(PKG_BUILD_DIR)/app/rtkrcv/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+       $(MAKE) -C $(PKG_BUILD_DIR)/app/str2str/gcc CC="$(TARGET_CC) $(TARGET_CFLAGS)"
+endef
+
+define Package/convbin/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/convbin/gcc/convbin $(1)/usr/bin/
+endef
+
+define Package/pos2kml/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/pos2kml/gcc/pos2kml $(1)/usr/bin/
+endef
+
+define Package/rnx2rtkp/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/rnx2rtkp/gcc/rnx2rtkp $(1)/usr/bin/
+endef
+
+define Package/rtkrcv/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/rtkrcv/gcc/rtkrcv $(1)/usr/bin/
+endef
+
+define Package/str2str/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/app/str2str/gcc/str2str $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,convbin))
+$(eval $(call BuildPackage,pos2kml))
+$(eval $(call BuildPackage,rnx2rtkp))
+$(eval $(call BuildPackage,rtkrcv))
+$(eval $(call BuildPackage,str2str))
diff --git a/utils/sane-backends/Makefile b/utils/sane-backends/Makefile
new file mode 100644 (file)
index 0000000..418a468
--- /dev/null
@@ -0,0 +1,124 @@
+#
+# Copyright (C) 2006-2014 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:=sane-backends
+PKG_VERSION:=1.0.24
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://fossies.org/linux/misc \
+       https://alioth.debian.org/frs/download.php/3958
+PKG_MD5SUM:=1ca68e536cd7c1852322822f5f6ac3a4
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=aclocal.m4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sane-backends/Default
+  TITLE:=Scanner Access Now Easy
+  URL:=http://www.sane-project.org/
+endef
+
+define Package/sane-backends/Default/description
+ SANE (Scanner Access Now Easy) is a universal scanner interface.
+endef
+
+define Package/sane-backends
+$(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+sane-libs
+  TITLE+= (backends)
+endef
+
+define Package/sane-backends/description
+$(call Package/sane-backends/Default/description)
+ This package contains the SANE daemon.
+endef
+
+define Package/sane-libs
+  $(call Package/sane-backends/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libjpeg +libtiff +libusb-compat +libv4l +cups
+  TITLE+= (libraries)
+endef
+
+define Package/sane-libs/description
+$(call Package/sane-backends/Default/description)
+ This package contains the SANE shared libraries.
+endef
+
+define Package/sane-frontends
+  $(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+sane-backends
+  TITLE+= (frontends)
+endef
+
+define Package/sane-frontends/description
+$(call Package/sane-backends/Default/description)
+ This package contains the SANE frontends.
+endef
+
+TARGET_LDFLAGS += \
+       -Wl,-rpath-link $(STAGING_DIR)/usr/lib \
+       -Wl,-rpath-link $(PKG_BUILD_DIR)/backend/.libs
+
+CONFIGURE_ARGS+= \
+       --enable-shared \
+       --enable-static \
+       --disable-translations \
+       --disable-latex \
+       --without-gphoto2 \
+       --disable-debug \
+       --without-snmp
+
+define Build/Configure
+       mkdir -p $(PKG_BUILD_DIR)/backend/.libs
+       $(Build/Configure/Default)
+endef
+
+define Package/sane-backends/conffiles
+/etc/sane.d/saned.conf
+endef
+
+define Package/sane-backends/install
+       $(INSTALL_DIR) $(1)/etc/sane.d
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/*.conf $(1)/etc/sane.d/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+endef
+
+define Package/sane-libs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/sane
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-*.so.* $(1)/usr/lib/sane/
+endef
+
+define Package/sane-frontends/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/sane $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.{a,so*} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,sane-backends))
+$(eval $(call BuildPackage,sane-libs))
+$(eval $(call BuildPackage,sane-frontends))
diff --git a/utils/sane-backends/patches/002-remove-uneeded.patch b/utils/sane-backends/patches/002-remove-uneeded.patch
new file mode 100644 (file)
index 0000000..458649e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -396,7 +396,7 @@ target_alias = @target_alias@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = include lib sanei backend frontend tools doc po testsuite
++SUBDIRS = include lib sanei backend frontend
+ DIST_SUBDIRS = include lib sanei backend frontend tools doc po japi testsuite
+ dist_doc_DATA = AUTHORS ChangeLog COPYING LICENSE NEWS PROBLEMS PROJECTS \
+  README README.aix README.beos README.darwin README.djpeg README.freebsd \
diff --git a/utils/sane-backends/patches/010-dont-add-host-include-path.patch b/utils/sane-backends/patches/010-dont-add-host-include-path.patch
new file mode 100644 (file)
index 0000000..2677ca7
--- /dev/null
@@ -0,0 +1,55 @@
+--- a/configure.in
++++ b/configure.in
+@@ -82,8 +82,6 @@ AM_CONDITIONAL(CROSS_COMPILING, test x$c
+ dnl ***********************************************************************
+ dnl set compiler/linker flags
+ dnl ***********************************************************************
+-INCLUDES="${INCLUDES} -I/usr/local/include"
+-AC_SUBST(INCLUDES)
+ SANE_SET_CFLAGS([$is_release])
+ SANE_SET_LDFLAGS
+ SANE_LINKER_RPATH
+@@ -332,30 +330,22 @@ if test -c /dev/urandom ; then
+     AC_DEFINE(HAVE_DEV_URANDOM, 1, [Is /dev/urandom available?])
+ fi
+-dnl added by PN 3/2/12 to detect cups
+-$as_echo "checking for cups"
+-if test -e /usr/include/cups/cups.h ; then
+-    AC_DEFINE(HAVE_CUPS, 1, [Is /usr/include/cups/cups.h available?])
+-      with_cups="yes"
+-      LIBS="-lcups  $LIBS"
+-else
+-      $as_echo "cups.h not found, you may want to install a cups development package"
+-      $as_echo "in order to autodetect network scanners in kodakaio."
+-      with_cups="no"
++AC_CHECK_HEADERS([cups/cups.h], [with_cups=yes], [with_cups=no])
++if test "x${with_cups}" = "xyes"; then
++  AC_DEFINE(HAVE_CUPS,[1],[Is cups/cups.h available?])
++  AC_PATH_PROG(CUPS_CONFIG, cups-config)
++  if test "x${CUPS_CONFIG}" != "x"; then
++    LIBS="$LIBS `$CUPS_CONFIG --libs`"
++  fi
+ fi
+-dnl added by llagendijk 12/7/2012 to detect systemd for saned
+-$as_echo_n "Checking for systemd..."
+-if test -e /usr/include/systemd/sd-daemon.h ; then
+-    AC_DEFINE(HAVE_SYSTEMD, 1, [Is /usr/include/systemd/sd-daemon.h available?])
+-    with_systemd="yes"
+-    SYSTEMD_LIBS=" -lsystemd-daemon"
+-    AC_SUBST(SYSTEMD_LIBS)
+-    $as_echo "yes"
+-else
+-    with_systemd="no"
+-    $as_echo "no"
++AC_CHECK_HEADERS([systemd/sd-daemon.h])
++PKG_CHECK_MODULES([HAVE_SYSTEMD], [libsystemd-daemon], [with_systemd=yes], [with_systemd=no])
++if test "x${with_systemd}" = "xyes"; then
++    AC_DEFINE(HAVE_SYSTEMD,[1],[Is systemd/sd-daemon.h available?])
++    SYSTEMD_LIBS="-lsystemd-daemon"
+ fi
++AC_SUBST(SYSTEMD_LIBS)
+ dnl ***********
+ dnl USB Support
diff --git a/utils/sane-backends/patches/020-non-i386-qcam.patch b/utils/sane-backends/patches/020-non-i386-qcam.patch
new file mode 100644 (file)
index 0000000..aa64d43
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/backend/qcam.c
++++ b/backend/qcam.c
+@@ -105,6 +105,17 @@
+ #include "qcam.h"
++#if !defined( __i386__) && !defined(__arm__)
++static inline unsigned char inb(unsigned int port)
++{
++      return 0;
++}
++
++static inline void outb(unsigned char value, unsigned int port)
++{
++}
++#endif
++
+ /* status bits */
+ #define NeedRamTable          (1 << 1)
+ #define BlackBalanceInProgress        (1 << 6)
diff --git a/utils/schedtools/Makefile b/utils/schedtools/Makefile
new file mode 100644 (file)
index 0000000..f7a1aa1
--- /dev/null
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2009 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:=schedtool
+PKG_VERSION:=1.3.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://freequaos.host.sk/schedtool/
+PKG_MD5SUM:=0d968f05d3ad7675f1f33ef1f6d0a3fb
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/schedtool
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Scheduler control utility
+  URL:=http://freequaos.host.sk/schedtool/
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -c $(PKG_BUILD_DIR)/schedtool.c -o $(PKG_BUILD_DIR)/schedtool.o
+       $(TARGET_CC) $(TARGET_CFLAGS) -c $(PKG_BUILD_DIR)/error.c -o $(PKG_BUILD_DIR)/error.o
+       $(TARGET_CC) $(PKG_BUILD_DIR)/schedtool.o $(PKG_BUILD_DIR)/error.o -o $(PKG_BUILD_DIR)/schedtool
+endef
+
+define Package/schedtool/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/schedtool $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,schedtool))
diff --git a/utils/scponly/Makefile b/utils/scponly/Makefile
new file mode 100644 (file)
index 0000000..29085e4
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2007-2010 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:=scponly
+PKG_VERSION:=4.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=139ac9abd7f3b8dbc5c5520745318f8a
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/scponly
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Alternative 'shell' (of sorts) for sysadmins
+  URL:=http://sourceforge.net/projects/scponly
+endef
+
+define Package/scponly/description
+       "scponly" is an alternative 'shell' (of sorts) for system
+       administrators who would like to provide access to remote
+       users to both read and write local files without providing
+       any remote execution priviledges. Functionally, it is best
+       described as a wrapper to the mostly trusted suite of ssh
+       applications.
+endef
+
+CONFIGURE_ARGS += \
+       ac_cv_path_scponly_PROG_SFTP_SERVER="/usr/libexec/sftp-server" \
+       \
+       --enable-winscp-compat \
+       --enable-scp-compat \
+       --disable-rsync-compat \
+       --with-sftp-server="/usr/libexec/sftp-server" \
+
+define Package/scponly/postinst
+#!/bin/sh
+echo "/usr/bin/scponly" >> $${IPKG_INSTROOT}/etc/shells
+endef
+
+define Package/scponly/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,scponly))
diff --git a/utils/scponly/patches/001-elif_else_replacement.patch b/utils/scponly/patches/001-elif_else_replacement.patch
new file mode 100644 (file)
index 0000000..e817e3e
--- /dev/null
@@ -0,0 +1,12 @@
+diff -urN scponly-4.8/helper.c scponly-4.8.new/helper.c
+--- scponly-4.8/helper.c       2008-01-15 07:26:13.000000000 +0100
++++ scponly-4.8.new/helper.c   2010-03-29 09:48:33.000000000 +0200
+@@ -230,7 +230,7 @@
+                                               return 1;
+                                       }
+                               }
+-#elif
++#else
+                               /*
+                                * make sure that processing doesn't continue if we can't validate a rsync check
+                                * and if the getopt flag is set.
diff --git a/utils/sdparm/Makefile b/utils/sdparm/Makefile
new file mode 100644 (file)
index 0000000..bde487f
--- /dev/null
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2007-2008 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:=sdparm
+PKG_VERSION:=1.04
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://sg.danny.cz/sg/p
+PKG_MD5SUM:=f4b8c7bfc1cd27d30fbdc066a65a44ea
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sdparm
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Read or modify SCSI or USB disk parameters
+  DEPENDS:=+kmod-scsi-generic
+  SUBMENU:=disc
+  URL:=http://sg.danny.cz/sg/sdparm.html
+endef
+
+define Package/sdparm/description
+       The sdparm utility outputs and in some cases modifies SCSI device
+       parameters.
+endef
+
+define Package/sdparm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sdparm))
diff --git a/utils/sed/Makefile b/utils/sed/Makefile
new file mode 100644 (file)
index 0000000..5a60bb0
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2006-2010 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:=sed
+PKG_VERSION:=4.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
+PKG_MD5SUM:=7d310fbd76e01a01115075c1fd3f455a
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sed
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=GNU streams editor
+  URL:=http://ftp.gnu.org/gnu/sed/
+endef
+
+define Package/sed/description
+       Sed (streams editor) takes text input and performs some operation
+       (or set of operations) on it and outputs the modified text.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
+       PREFIX="/usr" \
+       HOST="$(GNU_TARGET_NAME)" \
+
+define Package/sed/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sed $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sed))
diff --git a/utils/setpwc/Makefile b/utils/setpwc/Makefile
new file mode 100644 (file)
index 0000000..638f10e
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006-2012 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:=setpwc
+PKG_VERSION:=1.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://www.vanheusden.com/setpwc
+PKG_MD5SUM:=79d5ee468c0076feb3cac473bef661d2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/setpwc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Philips (and compatibles) WebCams (PWC) control utility
+  URL:=http://www.vanheusden.com/setpwc/
+  DEPENDS:=+kmod-video-pwc
+endef
+
+define Package/setpwc/description
+       With setpwc you can set and list various settings of Philips (and
+       compatibles) WebCams with the 'PWC chipset'.
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -DVERSION=\"$(PKG_VERSION)\" -o $(PKG_BUILD_DIR)/setpwc $(PKG_BUILD_DIR)/setpwc.c
+endef
+
+define Package/setpwc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/setpwc $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,setpwc))
diff --git a/utils/setserial/Makefile b/utils/setserial/Makefile
new file mode 100644 (file)
index 0000000..b097c54
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# 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:=setserial
+PKG_VERSION:=2.17
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/setserial
+PKG_MD5SUM:=c4867d72c41564318e0107745eb7a0f2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/setserial
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Serial port configuration utility
+  URL:=http://setserial.sourceforge.net/
+  SUBMENU:=Terminal
+endef
+
+define Package/setserial/description
+       setserial is a program designed to set and/or report the
+       configuration information associated with a serial port. This
+       information includes what I/O port and IRQ a particular
+       serial port is using, and whether or not the break key should
+       be interpreted as the Secure Attention Key, and so on.
+endef
+
+# uses GNU configure
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               setserial
+endef
+
+define Package/setserial/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/setserial $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/setserial.config $(1)/etc/config/setserial
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/setserial.init $(1)/etc/init.d/setserial
+endef
+
+define Package/setserial/conffiles
+/etc/config/setserial
+endef
+
+$(eval $(call BuildPackage,setserial))
diff --git a/utils/setserial/files/setserial.config b/utils/setserial/files/setserial.config
new file mode 100644 (file)
index 0000000..ba2957f
--- /dev/null
@@ -0,0 +1,6 @@
+package 'setserial'
+
+config 'setserial'
+       option enabled 0
+       option device '/dev/ttyS1'
+       option parameters 'irq 3'
diff --git a/utils/setserial/files/setserial.init b/utils/setserial/files/setserial.init
new file mode 100644 (file)
index 0000000..db38ce2
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=15
+
+section_enabled() {
+       local enabled
+       config_get_bool enabled "$1" 'enabled' 0
+       [ $enabled -gt 0 ] || return 1
+}
+
+start_instance() {
+       local section="$1"
+       local device
+       local parameters
+       local args=""
+
+       section_enabled "$section" || return 1
+
+       config_get device "$section" 'device'
+       [ -n "$device" ] || return 1
+       append args "$device"
+
+       config_get parameters "$section" 'parameters'
+       [ -n "$parameters" ] || return 1
+       append args "$parameters"
+
+       /usr/sbin/setserial $device $parameters
+}
+
+boot() {
+       config_load 'setserial'
+       config_foreach start_instance 'setserial'
+}
diff --git a/utils/setserial/patches/100-compile-fixes.patch b/utils/setserial/patches/100-compile-fixes.patch
new file mode 100644 (file)
index 0000000..4adc7cb
--- /dev/null
@@ -0,0 +1,70 @@
+Index: setserial-2.17/setserial.c
+===================================================================
+--- setserial-2.17.orig/setserial.c    2010-10-24 11:21:21.000000000 +0200
++++ setserial-2.17/setserial.c 2010-10-24 11:26:55.000000000 +0200
+@@ -15,14 +15,19 @@
+ #include <termios.h>
+ #include <string.h>
+ #include <errno.h>
++#include <stdlib.h>
++
++#include <linux/serial.h>
+ #ifdef HAVE_ASM_IOCTLS_H
+ #include <asm/ioctls.h>
+ #endif
+ #ifdef HAVE_LINUX_HAYESESP_H
+ #include <linux/hayesesp.h>
++#ifdef TIOCGHAYESESP
++#define HAVE_HAYESESP
++#endif
+ #endif
+-#include <linux/serial.h>
+ #include "version.h"
+@@ -118,7 +123,7 @@
+       CMD_CONFIG,     "autoconfigure",0,              0,              0, 0,
+       CMD_GETMULTI,   "get_multiport",0,              0,              0, 0,
+       CMD_SETMULTI,   "set_multiport",0,              0,              0, 0,
+-#ifdef TIOCGHAYESESP
++#ifdef HAVE_HAYESESP
+       CMD_RX_TRIG,    "rx_trigger",   0,              0,              0, FLAG_NEED_ARG,
+       CMD_TX_TRIG,    "tx_trigger",   0,              0,              0, FLAG_NEED_ARG,
+       CMD_FLOW_OFF,   "flow_off",     0,              0,              0, FLAG_NEED_ARG,
+@@ -356,7 +361,7 @@
+ }
+ #endif
+-#ifdef TIOCGHAYESESP
++#ifdef HAVE_HAYESESP
+ void print_hayesesp(int fd)
+ {
+       struct hayes_esp_config esp;
+@@ -453,7 +458,7 @@
+               print_flags(&serinfo, "\tFlags: ", "");
+               printf("\n\n");
+-#ifdef TIOCGHAYESESP
++#ifdef HAVE_HAYESESP
+               print_hayesesp(fd);
+ #endif
+       } else if (verbosity==0) {
+@@ -593,7 +598,7 @@
+                       }
+                       set_multiport(device, fd, &arg);
+                       break;
+-#ifdef TIOCGHAYESESP
++#ifdef HAVE_HAYESESP
+               case CMD_RX_TRIG:
+               case CMD_TX_TRIG:
+               case CMD_FLOW_OFF:
+@@ -692,7 +697,7 @@
+       fprintf(stderr, "\t  get_multiport\tDisplay the multiport configuration\n");
+       fprintf(stderr, "\t  set_multiport\tSet the multiport configuration\n");
+       fprintf(stderr, "\n");
+-#ifdef TIOCGHAYESESP
++#ifdef HAVE_HAYESESP
+       fprintf(stderr, "\t* rx_trigger\tSet RX trigger level (ESP-only)\n");
+       fprintf(stderr, "\t* tx_trigger\tSet TX trigger level (ESP-only)\n");
+       fprintf(stderr, "\t* flow_off\tSet hardware flow off level (ESP-only)\n");
diff --git a/utils/sg3-utils/Makefile b/utils/sg3-utils/Makefile
new file mode 100644 (file)
index 0000000..629b896
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2009 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:=sg3-utils
+PKG_VERSION:=1.24
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/s/$(PKG_NAME)
+PKG_MD5SUM:=9e1b8811b013d8f97d8ea2e0942cebad
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sg3-utils
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+kmod-usb-storage
+  TITLE:=sg3 scsi utilities
+  URL:=http://sg.danny.cz/sg/sg3_utils.html
+endef
+
+define Package/sg3-utils/description
+  The package includes a number of utilities to allow a user
+  to use the sg interface to find out low-level information
+  about any SCSI device.
+endef
+
+define Build/Configure
+endef
+
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) -f no_lib/Makefile.linux \
+               DESTDIR=$(STAGING_DIR) \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS) -DSG3_UTILS_LINUX" \
+               sg_start
+endef
+
+
+define Package/sg3-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/sg_start $(1)/usr/bin
+endef
+
+
+$(eval $(call BuildPackage,sg3-utils))
diff --git a/utils/sierra-pcmcia/Makefile b/utils/sierra-pcmcia/Makefile
new file mode 100644 (file)
index 0000000..3b25b18
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=sierra-pcmcia
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.sierrawireless.com/resources/faq/PC_Card/AirCard850_860/
+PKG_SOURCE:=Aircard_Linux.tar
+PKG_MD5SUM:=9562b626d958ea02d737feb6a85f0920
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/pcmcia-serial-sierra
+  SUBMENU:=Other modules
+  TITLE:=Sierra AirCard PCMCIA support
+  DEPENDS:=kmod-pcmcia-serial
+  URL:=http://www.sierrawireless.com/faq/ShowFAQ.aspx?ID=118
+endef
+
+define KernelPackage/pcmcia-serial-sierra/description
+ Support files for the Sierra AirCard 555, 7xx, and 8x0
+endef
+
+define Build/Compile
+endef
+
+define Package/kmod-pcmcia-serial-sierra/install
+       $(INSTALL_DIR) $(1)/lib/firmware
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/../Aircard_Linux/*.cis $(1)/lib/firmware/
+endef
+
+$(eval $(call KernelPackage,pcmcia-serial-sierra))
diff --git a/utils/sispmctl/Makefile b/utils/sispmctl/Makefile
new file mode 100644 (file)
index 0000000..ba7ea04
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2008-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:=sispmctl
+PKG_VERSION:=3.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=eca3d5803a29617432ef9f609be59bad
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sispmctl
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Silver Shield PM Control for Linux
+  URL:=http://sispmctl.sourceforge.net/
+  DEPENDS:=+libusb-compat
+endef
+
+define Package/sispmctl/description
+ The sispmctl tool can control Gembird SIS-PM Silver Shield
+ programmable power outlet strips (also known under the name
+ Revolt Intelli-Plug) from the command line.
+ .
+ It can be used to switch on or off any of the programmable
+ power sockets of the SIS-PM via USB. It can also show the
+ current status of each power socket, and it can handle
+ multiple SIS-PM devices, too.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-webless \
+       --disable-dependency-tracking
+
+define Package/sispmctl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,sispmctl))
diff --git a/utils/squashfs-tools/Config.in b/utils/squashfs-tools/Config.in
new file mode 100644 (file)
index 0000000..1ca3557
--- /dev/null
@@ -0,0 +1,11 @@
+config SQUASHFS_TOOLS_LZO_SUPPORT
+       depends on PACKAGE_squashfs-tools-mksquashfs || PACKAGE_squashfs-tools-unsquashfs
+       bool "Enable LZO support"
+       select PACKAGE_liblzo
+       default y
+
+config SQUASHFS_TOOLS_XZ_SUPPORT
+       depends on PACKAGE_squashfs-tools-mksquashfs || PACKAGE_squashfs-tools-unsquashfs
+       bool "Enable XZ support"
+       select PACKAGE_liblzma
+       default y
diff --git a/utils/squashfs-tools/Makefile b/utils/squashfs-tools/Makefile
new file mode 100644 (file)
index 0000000..97dc889
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2013 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:=squashfs-tools
+PKG_VERSION:=4.2
+PKG_RELEASE:=4
+
+PKG_SOURCE:=squashfs$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/squashfs
+PKG_MD5SUM:=1b7a781fb4cf8938842279bd3e8ee852
+
+PKG_CAT:=zcat
+PKG_BUILD_PARALLEL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/squashfs$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/squashfs-tools/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=squashfs-tools
+  DEPENDS += +libpthread +zlib \
+       +SQUASHFS_TOOLS_LZO_SUPPORT:liblzo \
+       +SQUASHFS_TOOLS_XZ_SUPPORT:liblzma
+endef
+
+define Package/squashfs-tools-mksquashfs
+  $(call Package/squashfs-tools/Default)
+  TITLE+= mksquashfs
+endef
+
+define Package/squashfs-tools-unsquashfs
+  $(call Package/squashfs-tools/Default)
+  TITLE+= unsquashfs
+endef
+
+define Package/squashfs-tools-unsquashfs/config
+       source "$(SOURCE)/Config.in"
+endef
+
+define Build/Configure
+endef
+
+SQUASHFS_TOOLS_CONFIG := \
+       'XATTR_SUPPORT='
+
+ifneq ($(CONFIG_SQUASHFS_TOOLS_XZ_SUPPORT),)
+SQUASHFS_TOOLS_CONFIG += 'XZ_SUPPORT=1'
+endif
+
+ifneq ($(CONFIG_SQUASHFS_TOOLS_LZO_SUPPORT),)
+SQUASHFS_TOOLS_CONFIG += 'LZO_SUPPORT=1'
+endif
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)/squashfs-tools \
+               CC="$(TARGET_CC)" \
+               EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
+               EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
+               $(SQUASHFS_TOOLS_CONFIG) \
+               mksquashfs unsquashfs
+endef
+
+define Package/squashfs-tools-mksquashfs/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/squashfs-tools/mksquashfs $(1)/usr/sbin/mksquashfs
+endef
+
+define Package/squashfs-tools-unsquashfs/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/squashfs-tools/unsquashfs $(1)/usr/sbin/unsquashfs
+endef
+
+$(eval $(call BuildPackage,squashfs-tools-mksquashfs))
+$(eval $(call BuildPackage,squashfs-tools-unsquashfs))
diff --git a/utils/ssldump/Makefile b/utils/ssldump/Makefile
new file mode 100644 (file)
index 0000000..5363b3d
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2008 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:=ssldump
+PKG_VERSION:=0.9b3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.rtfm.com/ssldump/
+PKG_MD5SUM:=ac8c28fe87508d6bfb06344ec496b1dd
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ssldump
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libopenssl +libpcap
+  TITLE:=a SSLv3/TLS network protocol analyzer
+  URL:=http://www.rtfm.com/ssldump/
+endef
+
+define Package/ssldump/description
+       ssldump is an SSLv3/TLS network protocol analyzer. It identifies TCP connections on the chosen network interface
+       and attempts to interpret them as SSLv3/TLS traffic. When it identifies SSLv3/TLS traffic, it decodes the records
+       and displays them in a textual form to stdout. If provided with the appropriate keying material, it will also decrypt
+       the connections and display the application data traffic.
+endef
+
+CONFIGURE_ARGS += \
+       --enable-static \
+       --enable-shared \
+       --with-openssl-inc="$(STAGING_DIR)/usr/include" \
+       --with-openssl-lib="$(STAGING_DIR)/usr/lib" \
+       --with-pcap-inc="$(STAGING_DIR)/usr/include" \
+       --with-pcap-lib="$(STAGING_DIR)/usr/lib" \
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all
+endef
+
+
+define Package/ssldump/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssldump $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ssldump))
diff --git a/utils/ssldump/patches/001-missing_headers.patch b/utils/ssldump/patches/001-missing_headers.patch
new file mode 100644 (file)
index 0000000..70ac11c
--- /dev/null
@@ -0,0 +1,23 @@
+diff -urN ssldump-0.9b3/base/pcap-snoop.c ssldump-0.9b3.new/base/pcap-snoop.c
+--- ssldump-0.9b3/base/pcap-snoop.c    2002-09-09 23:02:58.000000000 +0200
++++ ssldump-0.9b3.new/base/pcap-snoop.c        2008-12-14 18:43:48.000000000 +0100
+@@ -49,7 +49,7 @@
+ #include <pcap.h>
+ #include <unistd.h>
+-#include <net/bpf.h>
++#include <pcap-bpf.h>
+ #ifndef _WIN32
+ #include <sys/param.h>
+ #endif
+diff -urN ssldump-0.9b3/ssl/ssldecode.c ssldump-0.9b3.new/ssl/ssldecode.c
+--- ssldump-0.9b3/ssl/ssldecode.c      2002-08-17 03:33:17.000000000 +0200
++++ ssldump-0.9b3.new/ssl/ssldecode.c  2008-12-14 18:44:11.000000000 +0100
+@@ -52,6 +52,7 @@
+ #include <openssl/hmac.h>
+ #include <openssl/evp.h>
+ #include <openssl/x509v3.h>
++#include <openssl/md5.h>
+ #endif
+ #include "ssldecode.h"
+ #include "ssl_rec.h"
diff --git a/utils/stress/Makefile b/utils/stress/Makefile
new file mode 100644 (file)
index 0000000..12203fa
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2006-2010 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:=stress
+PKG_VERSION:=1.0.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://weather.ou.edu/~apw/projects/stress
+PKG_MD5SUM:=a607afa695a511765b40993a64c6e2f4
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/stress
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=stress is a simple stress utility
+  URL:=http://weather.ou.edu/~apw/projects/stress/
+endef
+
+define Package/stress/description
+stress is a simple tool that imposes certain types of compute \ stress on
+UNIX-like operating systems.
+endef
+
+CONFIGURE_ARGS += \
+       --prefix="/usr"
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)"
+
+define Package/stress/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stress $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,stress))
diff --git a/utils/sysstat/Makefile b/utils/sysstat/Makefile
new file mode 100644 (file)
index 0000000..4be0bb1
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2008-2010 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:=sysstat
+PKG_VERSION:=9.0.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://pagesperso-orange.fr/sebastien.godard
+PKG_MD5SUM:=e069daf192d259de905d7f8cdd85dc4e
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sysstat
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Sysstat performance monitoring tools
+  URL:=http://pagesperso-orange.fr/sebastien.godard/index.html
+endef
+
+define Package/sysstat/description
+  The sysstat utilities are a collection of performance monitoring tools for
+  Linux. These include sar, sadf, mpstat, iostat, pidstat and sa tools.
+endef
+
+define Package/sysstat/conffiles
+/etc/sysstat/sysstat.ioconf
+/etc/sysstat/config
+endef
+
+CONFIGURE_VARS+= \
+       sa_lib_dir="/usr/lib/sysstat" \
+       sa_dir="/var/log/sysstat" \
+       conf_dir="/etc/sysstat" \
+
+CONFIGURE_ARGS+= \
+       --disable-documentation \
+
+define Package/sysstat/install
+       $(INSTALL_DIR) $(1)/usr/lib/sysstat
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/sysstat/{sadc,sa1,sa2} $(1)/usr/lib/sysstat/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sar,sadf,iostat,mpstat,pidstat} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/sysstat
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sysstat/sysstat.ioconf $(1)/etc/sysstat/
+       $(INSTALL_CONF) ./files/config $(1)/etc/sysstat/config
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sysstat.init $(1)/etc/init.d/sysstat
+endef
+
+$(eval $(call BuildPackage,sysstat))
diff --git a/utils/sysstat/files/config b/utils/sysstat/files/config
new file mode 100644 (file)
index 0000000..2d2721a
--- /dev/null
@@ -0,0 +1,4 @@
+# How long to keep log files (days), maximum is a month
+# Used by sa2(8) script
+HISTORY=3
+
diff --git a/utils/sysstat/files/sysstat.init b/utils/sysstat/files/sysstat.init
new file mode 100755 (executable)
index 0000000..02039d5
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+
+# The init file runs the sadc command in order to write
+# the "LINUX RESTART" mark to the daily data file
+
+START=99
+
+start() {
+       mkdir -p /var/log/sysstat
+       /usr/lib/sysstat/sadc -S DISK -F -L -
+}
+
diff --git a/utils/tar/Makefile b/utils/tar/Makefile
new file mode 100644 (file)
index 0000000..7f346f6
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2008-2010 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:=tar
+PKG_VERSION:=1.23
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
+PKG_MD5SUM:=41e2ca4b924ec7860e51b43ad06cdb7e
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tar
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+bzip2
+  TITLE:=GNU tar
+  URL:=http://www.gnu.org/software/tar/
+endef
+
+define Package/tar/description
+       Tar is a program for packaging a set of files as a
+       single archive in tar format.
+endef
+
+define Package/tar/postinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/bin/tar ]; then
+  rm -r $${IPKG_INSTROOT}/bin/tar;
+fi
+ln -sf /usr/bin/tar $${IPKG_INSTROOT}/bin/tar
+endef
+
+define Package/tar/postrm
+#!/bin/sh
+rm $${IPKG_INSTROOT}/bin/tar
+ln -s busybox $${IPKG_INSTROOT}/bin/tar
+$${IPKG_INSTROOT}/bin/tar 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/tar
+exit 0
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       LDFLAGS="$(TARGET_LDLAGS)"
+
+define Package/tar/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,tar))
diff --git a/utils/taskwarrior/Makefile b/utils/taskwarrior/Makefile
new file mode 100644 (file)
index 0000000..8be74f9
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2012 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:=taskwarrior
+PKG_VERSION:=2.3.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=task-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.taskwarrior.org/download/
+PKG_MD5SUM:=2c1d2c64311855f3519ad038ebd372ac
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/task-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/taskwarrior
+  TITLE:=taskwarrior
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses +libstdcpp +liblua +libuuid +libreadline +libgnutls
+  URL:=http://taskwarrior.org/projects/show/taskwarrior
+  MAINTAINER:=Xiangfu Liu <xiangfu@sharism.cc>
+endef
+
+TARGET_LDFLAGS += -ldl
+
+define Package/taskwarrior/description
+ taskwarrior is a command-line todo list manager
+endef
+
+define Package/taskwarrior/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/task $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,taskwarrior))
diff --git a/utils/tcpser/Makefile b/utils/tcpser/Makefile
new file mode 100644 (file)
index 0000000..2fb5390
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2009 Marek Drapal <marek.drapal@touchware.cz>
+# Copyright (C) 2009 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:=tcpser
+PKG_VERSION:=1.0rc12
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.jbrain.com/pub/linux/serial/
+PKG_MD5SUM:=e712ae9fe6893bc825026b6dee6da9c0
+
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tcpser
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Hayes compatible modem emulator
+  URL:=http://www.jbrain.com/pub/linux/serial/
+  DEPENDS:=+libpthread
+endef
+
+define Package/tcpser/description
+ TCPSER turns a PC serial port into an emulated Hayes compatible modem
+ that uses TCP/IP for incoming and outgoing connections. It can be used
+ to allow older applications and systems designed for modem use
+ to operate on the Internet. TCPSER supports all standard Hayes commands,
+ and understands extended and vendor proprietary commands (though it does
+ not implement many of them). TCPSER can be used for both inbound and
+ outbound connections.
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(CP) $(PKG_BUILD_DIR)/../$(PKG_NAME)/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+       $(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include"
+endef
+
+define Package/tcpser/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tcpser $(1)/usr/bin/
+endef
+
+
+$(eval $(call BuildPackage,tcpser))
diff --git a/utils/tcsh/Makefile b/utils/tcsh/Makefile
new file mode 100644 (file)
index 0000000..862cfad
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2011 Nuno Goncalves <nunojpg@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tcsh
+PKG_VERSION:=6.17.00
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.astron.com/pub/tcsh/
+PKG_MD5SUM:=c47de903e3d52f6824c8dd0c91eeb477
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tcsh
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Enhanced Berkeley UNIX C shell
+  DEPENDS:=+libncurses
+  URL:=http://www.tcsh.org/
+endef
+
+define Package/tcsh/description
+       Tcsh is an enhanced, but completely compatible
+       version of the Berkeley UNIX C shell (csh). It
+       is a command language interpreter usable both
+       as an interactive login shell and a shell
+       script command processor. It includes a
+       command-line editor, programmable word
+       completion, spelling correction, a history
+       mechanism, job control and a C-like syntax.
+endef
+
+define Package/tcsh/postinst
+#!/bin/sh
+grep tcsh $${IPKG_INSTROOT}/etc/shells || \
+       echo "/bin/tcsh" >> $${IPKG_INSTROOT}/etc/shells
+       echo "/bin/csh" >> $${IPKG_INSTROOT}/etc/shells
+endef
+
+define Package/tcsh/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tcsh $(1)/bin/
+       ln -sf tcsh $(1)/bin/csh
+endef
+
+$(eval $(call BuildPackage,tcsh))
diff --git a/utils/tcsh/patches/001-gethost b/utils/tcsh/patches/001-gethost
new file mode 100644 (file)
index 0000000..62342e2
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -365,7 +365,7 @@
+ gethost:  gethost.c sh.err.h tc.const.h sh.h
+       rm -f gethost
+-      ${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS}
++      gcc -o gethost -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"' $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS}
+ tc.defs.c:    gethost host.defs
+       @rm -f $@.tmp
diff --git a/utils/tcsh/patches/002-NLS b/utils/tcsh/patches/002-NLS
new file mode 100644 (file)
index 0000000..9c52afd
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/config/linux
++++ b/config/linux
+@@ -106,6 +106,4 @@
+ #endif
+ #define ECHO_STYLE      BOTH_ECHO
+-#define NLS_CATALOGS
+-
+ #endif /* _h_config */
diff --git a/utils/tesseract/Makefile b/utils/tesseract/Makefile
new file mode 100644 (file)
index 0000000..aa1f744
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# Copyright (C) 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:=tesseract-ocr
+PKG_VERSION:=3.02.02
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://tesseract-ocr.googlecode.com/files/
+PKG_MD5SUM:=26adc8154f0e815053816825dde246e6
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tesseract
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Tesseract Open Source OCR Engine
+  URL:=http://tesseract-ocr.googlecode.com/
+  DEPENDS:=+libleptonica +libpthread +libstdcpp
+endef
+
+CONFIGURE_ARGS += \
+       LIBLEPT_HEADERSDIR="$(STAGING_DIR)/usr/include" \
+
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(SED) '1s/^\xEF\xBB\xBF//' $(PKG_BUILD_DIR)/ccutil/strngs.h
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/tesseract $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtesseract.{a,so*} $(1)/usr/lib/
+endef
+
+define Package/tesseract/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/lib*.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/share
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/* $(1)/usr/share/
+endef
+
+$(eval $(call BuildPackage,tesseract))
diff --git a/utils/testusb/Makefile b/utils/testusb/Makefile
new file mode 100644 (file)
index 0000000..f1051fc
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007 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:=testusb
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_DEPENDS := libpthread
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/testusb
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=@DEVEL +libpthread
+  TITLE:=USB testing utility
+  URL:=http://www.linux-usb.org/usbtest/testusb.c
+endef
+
+define Package/testusb/description
+       This tool can be used to perform various tests with use of the usbtest driver.
+endef
+
+define Build/Prepare
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+       $(TARGET_CC) $(TARGET_CFLAGS) -Os -lpthread $(PKG_BUILD_DIR)/testusb.c -o $(PKG_BUILD_DIR)/$(PKG_NAME)
+endef
+
+define Package/testusb/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/testusb $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,testusb))
diff --git a/utils/testusb/src/testusb.c b/utils/testusb/src/testusb.c
new file mode 100644 (file)
index 0000000..28e25ca
--- /dev/null
@@ -0,0 +1,427 @@
+/* $(CROSS_COMPILE)cc -Wall -g -lpthread -o testusb testusb.c */
+
+/*
+ * Copyright (c) 2002 by David Brownell
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <ftw.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <sys/ioctl.h>
+#include <linux/usbdevice_fs.h>
+
+/*-------------------------------------------------------------------------*/
+
+#define        TEST_CASES      30
+
+// FIXME make these public somewhere; usbdevfs.h?
+
+struct usbtest_param {
+       // inputs
+       unsigned                test_num;       /* 0..(TEST_CASES-1) */
+       unsigned                iterations;
+       unsigned                length;
+       unsigned                vary;
+       unsigned                sglen;
+
+       // outputs
+       struct timeval          duration;
+};
+#define USBTEST_REQUEST        _IOWR('U', 100, struct usbtest_param)
+
+/*-------------------------------------------------------------------------*/
+
+/* #include <linux/usb_ch9.h> */
+
+struct usb_device_descriptor {
+       __u8  bLength;
+       __u8  bDescriptorType;
+       __u16 bcdUSB;
+       __u8  bDeviceClass;
+       __u8  bDeviceSubClass;
+       __u8  bDeviceProtocol;
+       __u8  bMaxPacketSize0;
+       __u16 idVendor;
+       __u16 idProduct;
+       __u16 bcdDevice;
+       __u8  iManufacturer;
+       __u8  iProduct;
+       __u8  iSerialNumber;
+       __u8  bNumConfigurations;
+} __attribute__ ((packed));
+
+enum usb_device_speed {
+       USB_SPEED_UNKNOWN = 0,                  /* enumerating */
+       USB_SPEED_LOW, USB_SPEED_FULL,          /* usb 1.1 */
+       USB_SPEED_HIGH                          /* usb 2.0 */
+};
+
+/*-------------------------------------------------------------------------*/
+
+static char *speed (enum usb_device_speed s)
+{
+       switch (s) {
+       case USB_SPEED_UNKNOWN: return "unknown";
+       case USB_SPEED_LOW:     return "low";
+       case USB_SPEED_FULL:    return "full";
+       case USB_SPEED_HIGH:    return "high";
+       default:                return "??";
+       }
+}
+
+struct testdev {
+       struct testdev          *next;
+       char                    *name;
+       pthread_t               thread;
+       enum usb_device_speed   speed;
+       unsigned                ifnum : 8;
+       unsigned                forever : 1;
+       int                     test;
+
+       struct usbtest_param    param;
+};
+static struct testdev          *testdevs;
+
+static int is_testdev (struct usb_device_descriptor *dev)
+{
+       /* FX2 with (tweaked) bulksrc firmware */
+       if (dev->idVendor == 0x0547 && dev->idProduct == 0x1002)
+               return 1;
+
+       /*----------------------------------------------------*/
+
+       /* devices that start up using the EZ-USB default device and
+        * which we can use after loading simple firmware.  hotplug
+        * can fxload it, and then run this test driver.
+        *
+        * we return false positives in two cases:
+        * - the device has a "real" driver (maybe usb-serial) that
+        *   renumerates.  the device should vanish quickly.
+        * - the device doesn't have the test firmware installed.
+        */
+
+       /* generic EZ-USB FX controller */
+       if (dev->idVendor == 0x0547 && dev->idProduct == 0x2235)
+               return 1;
+
+       /* generic EZ-USB FX2 controller */
+       if (dev->idVendor == 0x04b4 && dev->idProduct == 0x8613)
+               return 1;
+
+       /* CY3671 development board with EZ-USB FX */
+       if (dev->idVendor == 0x0547 && dev->idProduct == 0x0080)
+               return 1;
+
+       /* Keyspan 19Qi uses an21xx (original EZ-USB) */
+       if (dev->idVendor == 0x06cd && dev->idProduct == 0x010b)
+               return 1;
+
+       /*----------------------------------------------------*/
+
+       /* "gadget zero", Linux-USB test software */
+       if (dev->idVendor == 0x0525 && dev->idProduct == 0xa4a0)
+               return 1;
+
+       /* user mode subset of that */
+       if (dev->idVendor == 0x0525 && dev->idProduct == 0xa4a4)
+               return 1;
+
+       /* iso version of usermode code */
+       if (dev->idVendor == 0x0525 && dev->idProduct == 0xa4a3)
+               return 1;
+
+       /* some GPL'd test firmware uses these IDs */
+
+       if (dev->idVendor == 0xfff0 && dev->idProduct == 0xfff0)
+               return 1;
+
+       /*----------------------------------------------------*/
+
+       /* iBOT2 high speed webcam */
+       if (dev->idVendor == 0x0b62 && dev->idProduct == 0x0059)
+               return 1;
+
+       return 0;
+}
+
+static int find_testdev (const char *name, const struct stat *sb, int flag)
+{
+       int                             fd;
+       struct usb_device_descriptor    dev;
+
+       if (flag != FTW_F)
+               return 0;
+       /* ignore /proc/bus/usb/{devices,drivers} */
+       if (strrchr (name, '/')[1] == 'd')
+               return 0;
+
+       if ((fd = open (name, O_RDONLY)) < 0) {
+               perror ("can't open dev file r/o");
+               return 0;
+       }
+       if (read (fd, &dev, sizeof dev) != sizeof dev)
+               fputs ("short devfile read!\n", stderr);
+       else if (is_testdev (&dev)) {
+               struct testdev          *entry;
+
+               if ((entry = calloc (1, sizeof *entry)) == 0) {
+                       fputs ("no mem!\n", stderr);
+                       goto done;
+               }
+               entry->name = strdup (name);
+               if (!entry->name) {
+                       free (entry);
+                       goto done;
+               }
+
+               // FIXME better to look at each interface and ask if it's
+               // bound to 'usbtest', rather than assume interface 0
+               entry->ifnum = 0;
+
+               // FIXME ask usbfs what speed; update USBDEVFS_CONNECTINFO
+               // so it tells about high speed etc
+
+               fprintf (stderr, "%s speed\t%s\n",
+                               speed (entry->speed), entry->name);
+
+               entry->next = testdevs;
+               testdevs = entry;
+       }
+
+done:
+       close (fd);
+       return 0;
+}
+
+static int
+usbdev_ioctl (int fd, int ifno, unsigned request, void *param)
+{
+       struct usbdevfs_ioctl   wrapper;
+
+       wrapper.ifno = ifno;
+       wrapper.ioctl_code = request;
+       wrapper.data = param;
+
+       return ioctl (fd, USBDEVFS_IOCTL, &wrapper);
+}
+
+static void *handle_testdev (void *arg)
+{
+       struct testdev          *dev = arg;
+       int                     fd, i;
+       int                     status;
+
+       if ((fd = open (dev->name, O_RDWR)) < 0) {
+               perror ("can't open dev file r/w");
+               return 0;
+       }
+
+restart:
+       for (i = 0; i < TEST_CASES; i++) {
+               if (dev->test != -1 && dev->test != i)
+                       continue;
+               dev->param.test_num = i;
+
+               status = usbdev_ioctl (fd, dev->ifnum,
+                               USBTEST_REQUEST, &dev->param);
+               if (status < 0 && errno == EOPNOTSUPP)
+                       continue;
+
+               /* FIXME need a "syslog it" option for background testing */
+
+               /* NOTE: each thread emits complete lines; no fragments! */
+               if (status < 0) {
+                       char    buf [80];
+                       int     err = errno;
+
+                       if (strerror_r (errno, buf, sizeof buf)) {
+                               snprintf (buf, sizeof buf, "error %d", err);
+                               errno = err;
+                       }
+                       printf ("%s test %d --> %d (%s)\n",
+                               dev->name, i, errno, buf);
+               } else
+                       printf ("%s test %d, %4d.%.06d secs\n", dev->name, i,
+                               (int) dev->param.duration.tv_sec,
+                               (int) dev->param.duration.tv_usec);
+
+               fflush (stdout);
+       }
+       if (dev->forever)
+               goto restart;
+
+       close (fd);
+       return arg;
+}
+
+int main (int argc, char **argv)
+{
+       int                     c;
+       struct testdev          *entry;
+       char                    *device;
+       int                     all = 0, forever = 0, not = 0;
+       int                     test = -1 /* all */;
+       struct usbtest_param    param;
+
+       /* pick defaults that works with all speeds, without short packets.
+        *
+        * Best per-frame data rates:
+        *     high speed, bulk       512 * 13 * 8 = 53248
+        *                 interrupt 1024 *  3 * 8 = 24576
+        *     full speed, bulk/intr   64 * 19     =  1216
+        *                 interrupt   64 *  1     =    64
+        *      low speed, interrupt    8 *  1     =     8
+        */
+       param.iterations = 1000;
+       param.length = 512;
+       param.vary = 512;
+       param.sglen = 32;
+
+       /* for easy use when hotplugging */
+       device = getenv ("DEVICE");
+
+       while ((c = getopt (argc, argv, "D:ac:g:hns:t:v:")) != EOF)
+       switch (c) {
+       case 'D':       /* device, if only one */
+               device = optarg;
+               continue;
+       case 'a':       /* use all devices */
+               device = 0;
+               all = 1;
+               continue;
+       case 'c':       /* count iterations */
+               param.iterations = atoi (optarg);
+               if (param.iterations < 0)
+                       goto usage;
+               continue;
+       case 'g':       /* scatter/gather entries */
+               param.sglen = atoi (optarg);
+               if (param.sglen < 0)
+                       goto usage;
+               continue;
+       case 'l':       /* loop forever */
+               forever = 1;
+               continue;
+       case 'n':       /* no test running! */
+               not = 1;
+               continue;
+       case 's':       /* size of packet */
+               param.length = atoi (optarg);
+               if (param.length < 0)
+                       goto usage;
+               continue;
+       case 't':       /* run just one test */
+               test = atoi (optarg);
+               if (test < 0)
+                       goto usage;
+               continue;
+       case 'v':       /* vary packet size by ... */
+               param.vary = atoi (optarg);
+               if (param.vary < 0)
+                       goto usage;
+               continue;
+       case '?':
+       case 'h':
+       default:
+usage:
+               fprintf (stderr, "usage: %s [-an] [-D dev]\n"
+                       "\t[-c iterations]  [-t testnum]\n"
+                       "\t[-s packetsize] [-g sglen] [-v vary]\n",
+                       argv [0]);
+               return 1;
+       }
+       if (optind != argc)
+               goto usage;
+       if (!all && !device) {
+               fprintf (stderr, "must specify '-a' or '-D dev', "
+                       "or DEVICE=/proc/bus/usb/BBB/DDD in env\n");
+               goto usage;
+       }
+
+       if ((c = open ("/proc/bus/usb/devices", O_RDONLY)) < 0) {
+               fputs ("usbfs files are missing\n", stderr);
+               return -1;
+       }
+
+       /* collect and list the test devices */
+       if (ftw ("/proc/bus/usb", find_testdev, 3) != 0) {
+               fputs ("ftw failed; is usbfs missing?\n", stderr);
+               return -1;
+       }
+
+       /* quit, run single test, or create test threads */
+       if (!testdevs && !device) {
+               fputs ("no test devices recognized\n", stderr);
+               return -1;
+       }
+       if (not)
+               return 0;
+       if (testdevs && testdevs->next == 0 && !device)
+               device = testdevs->name;
+       for (entry = testdevs; entry; entry = entry->next) {
+               int     status;
+
+               entry->param = param;
+               entry->forever = forever;
+               entry->test = test;
+
+               if (device) {
+                       if (strcmp (entry->name, device))
+                               continue;
+                       return handle_testdev (entry) != entry;
+               }
+               status = pthread_create (&entry->thread, 0, handle_testdev, entry);
+               if (status) {
+                       perror ("pthread_create");
+                       continue;
+               }
+       }
+       if (device) {
+               struct testdev          dev;
+
+               /* kernel can recognize test devices we don't */
+               fprintf (stderr, "%s: %s may see only control tests\n",
+                               argv [0], device);
+
+               memset (&dev, 0, sizeof dev);
+               dev.name = device;
+               dev.param = param;
+               dev.forever = forever;
+               dev.test = test;
+               return handle_testdev (&dev) != &dev;
+       }
+
+       /* wait for tests to complete */
+       for (entry = testdevs; entry; entry = entry->next) {
+               void    *retval;
+
+               if (pthread_join (entry->thread, &retval))
+                       perror ("pthread_join");
+               /* testing errors discarded! */
+       }
+
+       return 0;
+}
diff --git a/utils/time/Makefile b/utils/time/Makefile
new file mode 100644 (file)
index 0000000..7c0e15a
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 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:=time
+PKG_VERSION:=1.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@GNU/time
+PKG_MD5SUM:=e38d2b8b34b1ca259cf7b053caac32b3
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/time
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The GNU time utility
+  URL:=http://www.gnu.org/software/time/
+endef
+
+define Package/time/description
+  `time' is a program that measures many of the CPU resources, such as time and
+  memory, that other programs use.  The GNU version can format the output in
+  arbitrary ways by using a printf-style format string to include various
+  resource measurements.  Some systems do not provide much information about
+  program resource use; `time' reports unavailable information as zero values.
+endef
+
+define Package/time/preinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/time ]; then
+  rm $${IPKG_INSTROOT}/usr/bin/time;
+fi
+endef
+
+define Package/time/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/time $(1)/usr/bin/
+endef
+
+define Package/time/postrm
+#!/bin/sh
+ln -sf ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/time
+$${IPKG_INSTROOT}/usr/bin/time 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/time
+exit 0
+endef
+
+$(eval $(call BuildPackage,time))
diff --git a/utils/time/patches/001-fix-configure.patch b/utils/time/patches/001-fix-configure.patch
new file mode 100644 (file)
index 0000000..6d4af09
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/configure.in
++++ b/configure.in
+@@ -1,9 +1,6 @@
+ dnl Process this file with autoconf to produce a configure script.
+ AC_INIT(time.c)
+-VERSION=1.7
+-AC_SUBST(VERSION)
+-PACKAGE=time
+-AC_SUBST(PACKAGE)
++AM_INIT_AUTOMAKE(time, 1.7)
+ AC_ARG_PROGRAM
+@@ -15,7 +12,7 @@ AC_PROG_INSTALL
+ dnl Checks for header files.
+ AC_HEADER_STDC
+ AC_HEADER_SYS_WAIT
+-AC_CHECK_HEADERS(unistd.h string.h sys/rusage.h)
++AC_CHECK_HEADERS(unistd.h string.h sys/rusage.h sys/resource.h)
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
diff --git a/utils/time/patches/002-fix-rusage.patch b/utils/time/patches/002-fix-rusage.patch
new file mode 100644 (file)
index 0000000..714cf0c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/resuse.h
++++ b/resuse.h
+@@ -36,7 +36,7 @@ struct timeval
+ # include <sys/rusage.h>
+ #else
+ # define TV_MSEC tv_usec / 1000
+-# if HAVE_WAIT3
++# if HAVE_SYS_RESOURCE_H
+ #  include <sys/resource.h>
+ # else
+ /* Process resource usage structure.  */
diff --git a/utils/upx/Makefile b/utils/upx/Makefile
new file mode 100644 (file)
index 0000000..1d9faac
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006-2012 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:=upx
+PKG_VERSION:=3.08
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.bz2
+PKG_SOURCE_URL:=http://upx.sourceforge.net/download \
+       http://upx.sourceforge.net/download/00-OLD-VERSIONS
+PKG_MD5SUM:=54c76fa52cad578ff23ef98aee91e3f5
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/upx
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libucl +libstdcpp +zlib
+  TITLE:=The Ultimate Packer for eXecutables
+  URL:=http://upx.sourceforge.net/
+endef
+
+define Package/upx/description
+UPX is a free, portable, extendable, high-performance executable packer for
+several different executable formats. It achieves an excellent compression ratio
+and offers very fast decompression. Your executables suffer no memory overhead
+or other drawbacks for most of the formats supported, because of in-place
+decompression.
+endef
+
+MAKE_PATH := src
+MAKE_VARS += \
+       exeext=""
+
+TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components 1 $(TAR_OPTIONS)
+
+TARGET_CPPFLAGS += \
+       -DUCL_NO_ASM \
+
+define Package/upx/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/upx $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,upx))
diff --git a/utils/upx/patches/100-disable_doc.patch b/utils/upx/patches/100-disable_doc.patch
new file mode 100644 (file)
index 0000000..d960c00
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -35,7 +35,7 @@ ifeq ($(BUILD_STUB),1)
+       $(MAKE) -C src/stub $@
+ endif
+       $(MAKE) -C src $@
+-      $(MAKE) -C doc $@
++#     $(MAKE) -C doc $@
+ .PHONY: default all mostlyclean clean distclean maintainer-clean
diff --git a/utils/usbmuxd/Makefile b/utils/usbmuxd/Makefile
new file mode 100644 (file)
index 0000000..e3a209d
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2012-2014 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:=usbmuxd
+PKG_VERSION:=1.0.8
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.libimobiledevice.org/downloads
+PKG_MD5SUM:=4b33cc78e479e0f9a6745f9b9a8b60a8
+
+CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/usbmuxd
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=USB multiplexing daemon
+  URL:=http://www.libimobiledevice.org/
+  DEPENDS:=+librt +libusb-1.0 +libusbmuxd
+endef
+
+define Package/usbmuxd/description
+  This daemon is in charge of multiplexing connections over USB to an iPhone or
+  iPod touch. To users, it means you can sync your music, contacts, photos, etc.
+  over USB. To developers, it means you can connect to any listening localhost
+  socket on the device. usbmuxd is not used for tethering data transfer, which
+  uses a dedicated USB interface as a virtual network device.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Package/usbmuxd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmuxd $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,usbmuxd))
diff --git a/utils/usbmuxd/patches/001-disable_libusbmuxd_tools.patch b/utils/usbmuxd/patches/001-disable_libusbmuxd_tools.patch
new file mode 100644 (file)
index 0000000..9e3657b
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -64,19 +64,12 @@ endif()
+ add_definitions(-Wall)
+-add_subdirectory (libusbmuxd)
+ if (WITH_USBMUXD)
+   add_subdirectory (daemon)
+   if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+     add_subdirectory (udev)
+   endif()
+ endif()
+-add_subdirectory (tools)
+-
+-# pkg-config
+-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libusbmuxd.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd.pc")
+-# install pkg-config file
+-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libusbmuxd.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig/)
+ # add uninstall target
+ configure_file("${CMAKE_SOURCE_DIR}/Modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
+--- a/daemon/CMakeLists.txt
++++ b/daemon/CMakeLists.txt
+@@ -8,7 +8,6 @@ if(HAVE_PLIST)
+ endif()
+ include_directories (${CMAKE_SOURCE_DIR}/common)
+ include_directories (${CMAKE_SOURCE_DIR}/daemon)
+-include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd)
+ add_definitions(-DUSBMUXD_DAEMON -DUSBMUXD_VERSION="${USBMUXD_VERSION}")
+ add_executable(usbmuxd main.c usb-linux.c log.c ${CMAKE_SOURCE_DIR}/common/utils.c device.c client.c)
diff --git a/utils/vim/Makefile b/utils/vim/Makefile
new file mode 100644 (file)
index 0000000..0f7a687
--- /dev/null
@@ -0,0 +1,192 @@
+#
+# Copyright (C) 2006-2012 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:=vim
+PKG_VERSION:=7.3
+PKG_RELEASE:=1
+VIMVER:=73
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.vim.org/pub/vim/unix/
+PKG_MD5SUM:=5b9510a17074e2b37d8bb38ae09edbf2
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)$(VIMVER)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vim/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libncurses
+  TITLE:=Vi IMproved - enhanced vi editor
+  URL:=http://www.vim.org/
+  SUBMENU:=Editors
+endef
+
+define Package/vim
+  $(call Package/vim/Default)
+  TITLE+= (Tiny)
+endef
+
+define Package/vim-full
+  $(call Package/vim/Default)
+  TITLE+= (Normal)
+endef
+
+define Package/vim-runtime
+  $(call Package/vim/Default)
+  TITLE+= (runtime files)
+endef
+
+define Package/vim-help
+  $(call Package/vim/Default)
+  TITLE+= (help files)
+endef
+
+define Package/xxd
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=make a hexdump or do the reverse
+  URL:=http://www.vim.org/
+endef
+
+define Package/vim-full/conffiles
+/usr/share/vim/vimrc
+endef
+
+define Package/vim/conffiles
+/usr/share/vim/vimrc
+endef
+
+define Package/vim/description
+ Vim is an almost compatible version of the UNIX editor Vi.
+ (Tiny build)
+endef
+
+define Package/vim-full/description
+ Vim is an almost compatible version of the UNIX editor Vi.
+ (Normal build)
+endef
+
+define Package/vim-runtime/description
+ Vim is an almost compatible version of the UNIX editor Vi.
+ (Runtime files)
+endef
+
+define Package/vim-help/description
+ Vim is an almost compatible version of the UNIX editor Vi.
+ (Help files)
+endef
+
+define Package/xxd/description
+ xxd creates a hex dump of a given file or standard input, it can also convert
+ a hex dump back to its original binary form.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-gui \
+       --disable-gtktest \
+       --disable-xim \
+       --without-x \
+       --disable-netbeans \
+       --disable-cscope \
+       --disable-gpm \
+       --with-tlib=ncurses
+
+CONFIGURE_VARS += \
+       vim_cv_getcwd_broken=no \
+       vim_cv_memmove_handles_overlap=yes \
+       vim_cv_stat_ignores_slash=yes \
+       vim_cv_tgetent=zero \
+       vim_cv_terminfo=yes \
+       vim_cv_toupper_broken=no \
+       vim_cv_tty_group=root \
+       vim_cv_tty_mode=0620
+
+ifneq ($(CONFIG_PACKAGE_vim),)
+define Build/Compile/vim
+       $(call Build/Configure/Default, \
+               --with-features=tiny \
+               --disable-multibyte \
+       )
+       $(MAKE) -C $(PKG_BUILD_DIR) clean
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" all
+       $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_tiny
+endef
+endif
+
+ifneq ($(CONFIG_PACKAGE_vim-full),)
+define Build/Compile/vim-full
+       $(call Build/Configure/Default, \
+               --with-features=normal \
+               --enable-multibyte \
+       )
+       $(MAKE) -C $(PKG_BUILD_DIR) clean
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" all
+       $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(PKG_BUILD_DIR)/vim_normal
+endef
+endif
+
+ifneq ($(CONFIG_PACKAGE_xxd),)
+define Build/Compile/xxd
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" all
+endef
+endif
+
+define Build/Compile/vim-runtime
+       $(MAKE) -C $(PKG_BUILD_DIR)/src DESTDIR="$(PKG_INSTALL_DIR)" installrtbase
+       (cd $(PKG_INSTALL_DIR) && tar -cf $(PKG_BUILD_DIR)/docs.tar ./usr/share/vim/vim$(VIMVER)/doc)
+       rm -rf $(PKG_INSTALL_DIR)/usr/share/vim/vim$(VIMVER)/doc
+       rm -rf $(PKG_INSTALL_DIR)/usr/man
+endef
+
+define Build/Compile
+$(call Build/Compile/vim)
+$(call Build/Compile/vim-full)
+$(call Build/Compile/vim-runtime)
+$(call Build/Compile/xxd)
+endef
+
+define Package/vim/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_tiny $(1)/usr/bin/vim
+       $(INSTALL_DIR) $(1)/usr/share/vim
+       $(INSTALL_CONF) ./files/vimrc $(1)/usr/share/vim/
+endef
+
+define Package/vim-full/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vim_normal $(1)/usr/bin/vim
+       $(INSTALL_DIR) $(1)/usr/share/vim
+       $(INSTALL_CONF) ./files/vimrc.full $(1)/usr/share/vim/vimrc
+endef
+
+define Package/vim-runtime/install
+       $(CP) $(PKG_INSTALL_DIR)/* $(1)
+       rm -rf $(1)/usr/share/vim/vim$(VIMVER)/doc
+endef
+
+define Package/vim-help/install
+       tar -C $(1) -xf $(PKG_BUILD_DIR)/docs.tar
+endef
+
+define Package/xxd/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/xxd/xxd $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,vim))
+$(eval $(call BuildPackage,vim-full))
+$(eval $(call BuildPackage,vim-runtime))
+$(eval $(call BuildPackage,vim-help))
+$(eval $(call BuildPackage,xxd))
diff --git a/utils/vim/files/vimrc b/utils/vim/files/vimrc
new file mode 100644 (file)
index 0000000..00b952d
--- /dev/null
@@ -0,0 +1,12 @@
+set showcmd            " show (partial) command in status line
+set showmatch          " show matching brackets
+set ignorecase         " do case insensitive matching
+set incsearch          " incremental search
+set autowrite          " automatically save before commands like :next and :make
+set nocompatible       " use vim defaults instead of 100% vi compatibility
+set backspace=indent,eol,start " more powerful backspacing
+set autoindent         " always set autoindenting on
+set linebreak          " don't wrap words by default
+set textwidth=0                " don't wrap lines by default
+set ruler              " show the cursor position all the time
+
diff --git a/utils/vim/files/vimrc.full b/utils/vim/files/vimrc.full
new file mode 100644 (file)
index 0000000..114cf07
--- /dev/null
@@ -0,0 +1,24 @@
+set showcmd                    " show (partial) command in status line
+set showmatch                  " show matching brackets
+set ignorecase                 " do case insensitive matching
+set incsearch                  " incremental search
+set autowrite                  " automatically save before commands like :next and :make
+set nocompatible               " use Vim defaults instead of 100% vi compatibility
+set backspace=indent,eol,start " more powerful backspacing
+set autoindent                 " always set autoindenting on
+set linebreak                  " don't wrap words by default
+set textwidth=0                        " don't wrap lines by default
+set ruler                      " show the cursor position all the time
+if filereadable(expand("$VIMRUNTIME/syntax/synload.vim"))
+       syntax on
+endif
+if has("syntax") && &term =~ "xterm"
+       set t_Co=8
+       if has("terminfo")
+               set t_Sf=<Esc>[3%p1%dm
+               set t_Sb=<Esc>[4%p1%dm
+       else
+               set t_Sf=<Esc>[3%dm
+               set t_Sb=<Esc>[4%dm
+       endif
+endif
diff --git a/utils/vim/patches/001-cross_compile.patch b/utils/vim/patches/001-cross_compile.patch
new file mode 100644 (file)
index 0000000..553dde7
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/src/auto/configure
++++ b/src/auto/configure
+@@ -11641,34 +11641,8 @@ _ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking uint32_t is 32 bits" >&5
+ $as_echo_n "checking uint32_t is 32 bits... " >&6; }
+-if test "$cross_compiling" = yes; then :
+-  as_fn_error "could not compile program using uint32_t." "$LINENO" 5
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-#ifdef HAVE_STDINT_H
+-# include <stdint.h>
+-#endif
+-#ifdef HAVE_INTTYPES_H
+-# include <inttypes.h>
+-#endif
+-main() {
+-  uint32_t nr1 = (uint32_t)-1;
+-  uint32_t nr2 = (uint32_t)0xffffffffUL;
+-  if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
+-  exit(0);
+-}
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming ok" >&5
+ $as_echo "ok" >&6; }
+-else
+-  as_fn_error "WRONG!  uint32_t not defined correctly." "$LINENO" 5
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
diff --git a/utils/watchcat/Makefile b/utils/watchcat/Makefile
new file mode 100644 (file)
index 0000000..c0a9291
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2010 segal.di.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=watchcat
+PKG_VERSION:=1
+PKG_RELEASE:=5
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/watchcat
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Enable the configuration of programed reboots
+endef
+
+define Package/watchcat/description
+Allows to configure a periodically reboot, or after loosing internet connectivity. Configured trough UCI /etc/config/system.
+endef
+
+define Package/watchcat/conffiles
+/etc/config/system
+endef
+
+define Build/Compile
+endef
+
+define Package/watchcat/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/initd_watchcat $(1)/etc/init.d/watchcat
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) ./files/watchcat.sh $(1)/usr/bin/watchcat.sh
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/uci_defaults_watchcat $(1)/etc/uci-defaults/50-watchcat
+endef
+
+$(eval $(call BuildPackage,watchcat))
diff --git a/utils/watchcat/files/initd_watchcat b/utils/watchcat/files/initd_watchcat
new file mode 100644 (file)
index 0000000..36e353f
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/sh /etc/rc.common
+
+START=97
+
+PIDFILE="/tmp/run/watchcat"
+
+append_string() {
+       local varname="$1"; local add="$2"; local separator="${3:- }"; local actual
+       eval "actual=\$$varname"
+
+       new="${actual:+$actual$separator}$add"
+       eval "$varname=\$new"
+}
+
+timetoseconds() {
+       local time=$1
+       unset seconds
+
+       { [ "$time" -ge 1 ] 2> /dev/null && seconds="$time"; } || \
+       { [ "${time%s}" -ge 1 ] 2> /dev/null && seconds="${time%s}"; } || \
+       { [ "${time%m}" -ge 1 ] 2> /dev/null && seconds=$((${time%m}*60)); } || \
+       { [ "${time%h}" -ge 1 ] 2> /dev/null && seconds=$((${time%h}*3600)); } || \
+       { [ "${time%d}" -ge 1 ] 2> /dev/null && seconds=$((${time%d}*86400)); }
+}
+
+load_watchcat() {
+       config_get period       $1 period
+       config_get mode         $1 mode         "allways"
+       config_get pinghosts    $1 pinghosts    "8.8.8.8"
+       config_get pingperiod   $1 pingperiod
+       config_get forcedelay   $1 forcedelay   "0"
+
+       error=""
+
+       timetoseconds "$period"
+       period="$seconds"
+       [ "$period" -ge 1 ] \
+               || append_string "error" 'period is not a valid time value (ex: "30"; "4m"; "6h"; "2d")' "; "
+       [ "$mode" = "allways" -o "$mode" = "ping" ] \
+               || append_string "error" "mode must be 'allways' or 'ping'" "; "
+       [ -n "$pinghosts" -o "$mode" = "allways" ] \
+               || append_string "error" "pinghosts must be set when in 'ping' mode" "; "
+       [ "$mode" = "ping" ] && {
+               if [ -n "$pingperiod" ]
+               then
+                       timetoseconds "$pingperiod"
+                       pingperiod="$seconds"
+                       if [ "$pingperiod" -ge 0 ]
+                       then
+                               [ "$pingperiod" -le "$period" ] \
+                                       || append_string "error" "pingperiod must be less than period" "; "
+                       else
+                               append_string "error" 'pingperiod is not a valid time value (ex: "30"; "4m"; "6h"; "2d")' "; "
+                       fi
+               else
+                       pingperiod="$((period/20))"
+               fi
+       }
+       [ "$pingperiod" -lt "$period" -o "$mode" = "allways" ] \
+               || append_string "error" "pingperiod is not recognized" "; "
+       [ "$forcedelay" -ge 0 ] \
+               || append_string "error" "forcedelay must be a integer greater or equal than 0, where 0 means disabled" "; "
+
+       [ -n "$error" ] && { logger -p user.err -t "watchcat" "reboot program $1 not started - $error"; return; }
+
+       if [ "$mode" = "allways" ]
+       then
+               /usr/bin/watchcat.sh "allways" "$period" "$forcedelay" &
+               logger -p user.info -t "wathchat" "started task (mode=$mode;period=$period;forcedelay=$forcedelay)" 
+       else
+               /usr/bin/watchcat.sh "period" "$period" "$forcedelay" "$pinghosts" "$pingperiod" &
+               logger -p user.info -t "wathchat" "started task (mode=$mode;period=$period;pinghosts=$pinghosts;pingperiod=$pingperiod;forcedelay=$forcedelay)" 
+       fi
+
+       echo $! >> "${PIDFILE}.pids"
+}
+
+stop() {
+       if [ -f "${PIDFILE}.pids" ]
+       then
+               logger -p user.info -t "watchcat" "stopping all tasks"
+
+               while read pid
+               do
+                       kill "$pid"
+               done < "${PIDFILE}.pids"
+
+               rm "${PIDFILE}.pids"
+
+               logger -p user.info -t "watchcat" "all tasks stopped"
+       else
+               logger -p user.info -t "watchcat" "no tasks running"
+       fi
+}
+
+start() {
+       [ -f "${PIDFILE}.pids" ] && stop
+
+       config_load system
+       if [ -n "$(uci show system.@watchcat[0])" ] # at least one watchcat section exists
+       then
+               logger -p user.info -t "watchcat" "starting all tasks"
+               config_foreach load_watchcat watchcat
+               logger -p user.info -t "watchcat" "all tasks started"
+       else
+               logger -p user.info -t "watchcat" "no tasks defined"
+       fi
+}
diff --git a/utils/watchcat/files/uci_defaults_watchcat b/utils/watchcat/files/uci_defaults_watchcat
new file mode 100644 (file)
index 0000000..49def81
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+uci -q show system.@watchcat[0] || {
+       uci add system watchcat
+       uci set system.@watchcat[0].period=6h
+       uci set system.@watchcat[0].mode=ping
+       uci set system.@watchcat[0].pinghosts=8.8.8.8
+       uci set system.@watchcat[0].forcedelay=30
+       uci commit
+}
diff --git a/utils/watchcat/files/watchcat.sh b/utils/watchcat/files/watchcat.sh
new file mode 100644 (file)
index 0000000..ee9b6bd
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh 
+
+mode="$1"
+
+shutdown_now() {
+       local forcedelay="$1"
+
+       reboot &
+
+       [ "$forcedelay" -ge 1 ] && {
+               sleep "$forcedelay"
+
+               echo b > /proc/sysrq-trigger # Will immediately reboot the system without syncing or unmounting your disks.
+       }
+}
+
+watchcat_allways() {
+       local period="$1"; local forcedelay="$2"
+
+       sleep "$period" && shutdown_now "$forcedelay"
+}
+
+watchcat_ping() {
+       local period="$1"; local forcedelay="$2"; local pinghosts="$3"; local pingperiod="$4"
+
+       time_now="$(cat /proc/uptime)"
+       time_now="${time_now%%.*}"
+       time_lastcheck="$time_now"
+       time_lastcheck_withinternet="$time_now"
+
+       while true
+       do
+               # account for the time ping took to return. With a ping time of 5s, ping might take more than that, so it is important to avoid even more delay.
+               time_now="$(cat /proc/uptime)"
+               time_now="${time_now%%.*}"
+               time_diff="$((time_now-time_lastcheck))"
+
+               [ "$time_diff" -lt "$pingperiod" ] && {
+                       sleep_time="$((pingperiod-time_diff))"
+                       sleep "$sleep_time"
+               }
+
+               time_now="$(cat /proc/uptime)"
+               time_now="${time_now%%.*}"
+               time_lastcheck="$time_now"
+
+               for host in "$pinghosts"
+               do
+                       if ping -c 1 "$host" &> /dev/null 
+                       then 
+                               time_lastcheck_withinternet="$time_now"
+                       else
+                               time_diff="$((time_now-time_lastcheck_withinternet))"
+                               logger -p daemon.info -t "watchcat[$$]" "no internet connectivity for $time_diff seconds. Reseting when reaching $period"       
+                       fi
+               done
+
+               time_diff="$((time_now-time_lastcheck_withinternet))"
+               [ "$time_diff" -ge "$period" ] && shutdown_now "$forcedelay"
+
+       done
+}
+
+       if [ "$mode" = "allways" ]
+       then
+               watchcat_allways "$2" "$3"
+       else
+               watchcat_ping "$2" "$3" "$4" "$5"
+       fi
diff --git a/utils/wattsup/Makefile b/utils/wattsup/Makefile
new file mode 100644 (file)
index 0000000..ced69d8
--- /dev/null
@@ -0,0 +1,31 @@
+# Copyright (C) 2006 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:=wattsup
+PKG_RELEASE:=1
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wattsup
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Wattsup polling utility
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Package/wattsup/install
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wattsup $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,wattsup))
diff --git a/utils/wattsup/src/Makefile b/utils/wattsup/src/Makefile
new file mode 100644 (file)
index 0000000..b9a687a
--- /dev/null
@@ -0,0 +1,8 @@
+wattsup: wattsup.o
+       $(CC) $(LDFLAGS) wattsup.o -o wattsup
+
+wattsup.o: wattsup.c
+       $(CC) $(CFLAGS) -c wattsup.c
+
+clean:
+       rm *.o wattsup
diff --git a/utils/wattsup/src/wattsup.c b/utils/wattsup/src/wattsup.c
new file mode 100644 (file)
index 0000000..8b26ad6
--- /dev/null
@@ -0,0 +1,1877 @@
+/*
+ *     wattsup - Program for controlling the Watts Up? Pro Device
+ *
+ *
+ *     Copyright (c) 2005 Patrick Mochel
+ *
+ *     This program is released under the GPLv2
+ *
+ *
+ *     Compiled with:
+ *
+ *     gcc -O2 -Wall -o wattsup wattsup.c
+ *
+ */
+
+#define _GNU_SOURCE
+#include<stdio.h>
+#include<stdlib.h>
+#include<stdarg.h>
+#include<string.h>
+#include<errno.h>
+#include<unistd.h>
+#include<fcntl.h>
+#include<termios.h>
+#include<ctype.h>
+#include<getopt.h>
+#include<signal.h>
+#include<time.h>
+
+#include<sys/stat.h>
+
+static const char * wu_version = "0.02";
+
+
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
+
+static const char * prog_name = "wattsup";
+
+static const char * sysfs_path_start = "/sys/class/tty";
+
+static char * wu_device = "ttyUSB0";
+static int wu_fd = 0;
+static int wu_count = 0;
+static int wu_debug = 0;
+static char *wu_delim = ", ";
+static int wu_final = 0;
+static int wu_interval = 1;
+static int wu_label = 0;
+static int wu_newline = 0;
+static int wu_suppress = 0;
+
+static int wu_localtime = 0;
+static int wu_gmtime = 0;
+
+static int wu_info_all = 0;
+static int wu_no_data = 0;
+static int wu_set_only = 0;
+
+#define wu_strlen      256
+#define wu_num_fields  18
+#define wu_param_len   16
+
+struct wu_packet {
+       unsigned int    cmd;
+       unsigned int    sub_cmd;
+       unsigned int    count;
+       char    buf[wu_strlen];
+       int     len;
+       char    * field[wu_num_fields];
+       char    * label[wu_num_fields];
+};
+
+
+struct wu_data {
+       unsigned int    watts;
+       unsigned int    volts;
+       unsigned int    amps;
+       unsigned int    watt_hours;
+
+       unsigned int    cost;
+       unsigned int    mo_kWh;
+       unsigned int    mo_cost;
+       unsigned int    max_watts;
+
+       unsigned int    max_volts;
+       unsigned int    max_amps;
+       unsigned int    min_watts;
+       unsigned int    min_volts;
+
+       unsigned int    min_amps;
+       unsigned int    power_factor;
+       unsigned int    duty_cycle;
+       unsigned int    power_cycle;
+};
+
+struct wu_options {
+       char    * longopt;
+       int     shortopt;
+       int     param;
+       int     flag;
+       char    * value;
+
+       char    * descr;
+       char    * option;
+       char    * format;
+
+       int     (*show)(int dev_fd);
+       int     (*store)(int dev_fd);
+};
+
+enum {
+       wu_option_help = 0,
+       wu_option_version,
+
+       wu_option_debug,
+
+       wu_option_count,
+       wu_option_final,
+
+       wu_option_delim,
+       wu_option_newline,
+       wu_option_localtime,
+       wu_option_gmtime,
+       wu_option_label,
+
+       wu_option_suppress,
+
+       wu_option_cal,
+       wu_option_header,
+
+       wu_option_interval,
+       wu_option_mode,
+       wu_option_user,
+
+       wu_option_info_all,
+       wu_option_no_data,
+       wu_option_set_only,
+};
+
+
+static char * wu_option_value(unsigned int index);
+
+
+enum {
+       wu_field_watts          = 0,
+       wu_field_volts,
+       wu_field_amps,
+
+       wu_field_watt_hours,
+       wu_field_cost,
+       wu_field_mo_kwh,
+       wu_field_mo_cost,
+
+       wu_field_max_watts,
+       wu_field_max_volts,
+       wu_field_max_amps,
+
+       wu_field_min_watts,
+       wu_field_min_volts,
+       wu_field_min_amps,
+
+       wu_field_power_factor,
+       wu_field_duty_cycle,
+       wu_field_power_cycle,
+};
+
+struct wu_field {
+       unsigned int    enable;
+       char            * name;
+       char            * descr;
+};
+
+static struct wu_field wu_fields[wu_num_fields] = {
+       [wu_field_watts]        = {
+               .name   = "watts",
+               .descr  = "Watt Consumption",
+       },
+
+       [wu_field_min_watts]    = {
+               .name   = "min-watts",
+               .descr  = "Minimum Watts Consumed",
+       },
+
+       [wu_field_max_watts]    = {
+               .name   = "max-watts",
+               .descr  = "Maxium Watts Consumed",
+       },
+
+       [wu_field_volts]        = {
+               .name   = "volts",
+               .descr  = "Volts Consumption",
+       },
+
+       [wu_field_min_volts]    = {
+               .name   = "max-volts",
+               .descr  = "Minimum Volts Consumed",
+       },
+
+       [wu_field_max_volts]    = {
+               .name   = "min-volts",
+               .descr  = "Maximum Volts Consumed",
+       },
+
+       [wu_field_amps]         = {
+               .name   = "amps",
+               .descr  = "Amp Consumption",
+       },
+
+       [wu_field_min_amps]     = {
+               .name   = "min-amps",
+               .descr  = "Minimum Amps Consumed",
+       },
+
+       [wu_field_max_amps]     = {
+               .name   = "max-amps",
+               .descr  = "Maximum Amps Consumed",
+       },
+
+       [wu_field_watt_hours]   = {
+               .name   = "kwh",
+               .descr  = "Average KWH",
+       },
+
+       [wu_field_mo_kwh]       = {
+               .name   = "mo-kwh",
+               .descr  = "Average monthly KWH",
+       },
+
+       [wu_field_cost]         = {
+               .name   = "cost",
+               .descr  = "Cost per watt",
+       },
+
+       [wu_field_mo_cost]      = {
+               .name   = "mo-cost",
+               .descr  = "Monthly Cost",
+       },
+
+       [wu_field_power_factor] = {
+               .name   = "power-factor",
+               .descr  = "Ratio of Watts vs. Volt Amps",
+       },
+
+       [wu_field_duty_cycle]   = {
+               .name   = "duty-cycle",
+               .descr  = "Percent of the Time On vs. Time Off",
+       },
+
+       [wu_field_power_cycle]  = {
+               .name   = "power-cycle",
+               .descr  = "Indication of power cycle",
+       },
+
+};
+
+
+
+static void msg_start(const char * fmt, ...)
+{
+       va_list(ap);
+       va_start(ap, fmt);
+       vprintf(fmt, ap);
+       va_end(ap);
+}
+
+static void msg_end(void)
+{
+       printf("\n");
+}
+
+static void msg(const char * fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vprintf(fmt, ap);
+       va_end(ap);
+}
+
+static void dbg(const char * fmt, ...)
+{
+       va_list ap;
+
+       if (wu_debug) {
+               va_start(ap, fmt);
+               msg_start("%s: [debug] ", prog_name);
+               vprintf(fmt, ap);
+               msg_end();
+               va_end(ap);
+       }
+}
+
+static void err(const char * fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       fprintf(stderr, "%s: [error] ", prog_name);
+       vfprintf(stderr, fmt, ap);
+       fprintf(stderr, "\n");
+       va_end(ap);
+}
+
+static void perr(const char * fmt, ...)
+{
+       char buf[1024];
+       int n;
+       va_list ap;
+
+       va_start(ap, fmt);
+       n = sprintf(buf, "%s: [error] ", prog_name);
+       vsnprintf(buf + n, sizeof(buf) - n, fmt, ap);
+       perror(buf);
+       va_end(ap);
+}
+
+static int ret_err(int err)
+{
+       errno = err;
+       return -1;
+}
+
+
+static void print_packet(struct wu_packet * p, char * str)
+{
+       int i;
+
+       if (!wu_suppress)
+               msg_start("Watts Up? %s\n", str);
+       for (i = 0; i<  p->count; i++) {
+               if (i)
+                       msg("%s", wu_newline ? "\n" : wu_delim);
+               if (wu_label)
+                       msg("[%s] ", p->label[i]);
+               msg(p->field[i]);
+       }
+       msg_end();
+}
+
+
+static void print_time(void)
+{
+       time_t t;
+       struct tm * tm;
+
+       if (wu_localtime || wu_gmtime) {
+               time(&t);
+
+               if (wu_localtime)
+                       tm = localtime(&t);
+               else
+                       tm = gmtime(&t);
+
+               msg("[%02d:%02d:%02d] ",
+                   tm->tm_hour, tm->tm_min, tm->tm_sec);
+       }
+}
+
+static void print_packet_filter(struct wu_packet * p,
+                               int (*filter_ok)(struct wu_packet * p, int i, char * str))
+{
+       char buf[256];
+       int printed;
+       int i;
+
+       print_time();
+       for (i = 0, printed = 0; i<  p->count; i++) {
+               if (!filter_ok(p, i, buf))
+                       continue;
+
+               if (printed++)
+                       msg("%s", wu_newline ? "\n" : wu_delim);
+               if (wu_label)
+                       msg("[%s] ", p->label[i]);
+               msg(buf);
+       }
+       msg_end();
+}
+
+
+/*
+ * Device should be something like "ttyS0"
+ */
+
+static int open_device(char * device_name, int * dev_fd)
+{
+       struct stat s;
+       int ret;
+       int cur_fd;
+
+       cur_fd = open(".", O_RDONLY);
+       if (cur_fd<  0) {
+               perr("Could not open current directory.");
+               return cur_fd;
+       }
+
+       ret = chdir(sysfs_path_start);
+       if (ret) {
+               perr(sysfs_path_start);
+               return ret;
+       }
+
+       /*
+        * First, check if /sys/class/tty/<name>/ exists.
+        */
+
+       dbg("Checking sysfs path: %s/%s", sysfs_path_start, device_name);
+
+       ret = stat(device_name,&s);
+       if (ret<  0) {
+               perr(device_name);
+               goto Done;
+       }
+
+       if (!S_ISDIR(s.st_mode)) {
+               errno = -ENOTDIR;
+               err("%s is not a TTY device.", device_name);
+               goto Done;
+       }
+
+       dbg("%s is a registered TTY device", device_name);
+
+       fchdir(cur_fd);
+
+
+       /*
+        * Check if device node exists and is writable
+        */
+       chdir("/dev");
+
+       ret = stat(device_name,&s);
+       if (ret<  0) {
+               perr("/dev/%s (device node)", device_name);
+               goto Done;
+       }
+
+       if (!S_ISCHR(s.st_mode)) {
+               errno = -ENOTTY;
+               ret = -1;
+               err("%s is not a TTY character device.", device_name);
+               goto Done;
+       }
+
+       dbg("%s has a device node", device_name);
+
+       ret = access(device_name, R_OK | W_OK);
+       if (ret) {
+               perr("%s: Not writable?", device_name);
+               goto Done;
+       }
+
+       ret = open(device_name, O_RDWR | O_NONBLOCK);
+       if (ret<  0) {
+               perr("Could not open %s");
+               goto Done;
+       }
+       *dev_fd = ret;
+       ret = 0;
+Done:
+       fchdir(cur_fd);
+       close(cur_fd);
+       return ret;
+}
+
+
+static int setup_serial_device(int dev_fd)
+{
+       struct termios t;
+       int ret;
+
+       ret = tcgetattr(dev_fd,&t);
+       if (ret)
+               return ret;
+
+       cfmakeraw(&t);
+       cfsetispeed(&t, B115200);
+       cfsetospeed(&t, B115200);
+       tcflush(dev_fd, TCIFLUSH);
+
+       t.c_iflag |= IGNPAR;
+       t.c_cflag&= ~CSTOPB;
+       ret = tcsetattr(dev_fd, TCSANOW,&t);
+
+       if (ret) {
+               perr("setting terminal attributes");
+               return ret;
+       }
+
+       return 0;
+}
+
+
+static int wu_write(int fd, struct wu_packet * p)
+{
+       int ret;
+       int n;
+       int i;
+       char * s = p->buf;
+
+       memset(p->buf, 0, sizeof(p->buf));
+       n = sprintf(p->buf, "#%c,%c,%d", p->cmd, p->sub_cmd, p->count);
+       p->len = n;
+       s = p->buf + n;
+
+       for (i = 0; i<  p->count; i++) {
+               if ((p->len + strlen(p->field[i]) + 4)>= sizeof(p->buf)) {
+                       err("Overflowed command string");
+                       return ret_err(EOVERFLOW);
+               }
+               n = sprintf(s, ",%s", p->field[i]);
+               s += n;
+               p->len += n;
+       }
+       p->buf[p->len++] = ';';
+
+       dbg("Writing '%s' (strlen = %d) (len = %d) to device",
+           p->buf, strlen(p->buf), p->len);
+       ret = write(fd, p->buf, p->len);
+       if (ret != p->len)
+               perr("Writing to device");
+       
+       return ret>= 0 ? 0 : ret;
+}
+
+
+static void dump_packet(struct wu_packet * p)
+{
+       int i;
+
+       dbg("Packet - Command '%c' %d parameters", p->cmd, p->count);
+       
+       for (i = 0; i<  p->count; i++)
+               dbg("[%2d] [%20s] = \"%s\"", i, p->label[i], p->field[i]);
+}
+
+
+static int parse_packet(struct wu_packet * p)
+{
+       char * s, *next;
+       int i;
+
+       p->buf[p->len] = '\0';
+
+       dbg("Parsing Packet, Raw buffer is (%d bytes) [%s]",
+           p->len, p->buf);
+
+       s = p->buf;
+
+       /*
+        * First character should be '#'
+        */
+       if (s) {
+               s = strchr(s, '#');
+               if (s)
+                       s++;
+               else {
+                       dbg("Invalid packet");
+                       return ret_err(EFAULT);
+               }
+       } else {
+               dbg("Invalid packet");
+               return ret_err(EFAULT);
+       }
+
+       /*
+        * Command character is first
+        */
+       next = strchr(s, ',');
+       if (next) {
+               p->cmd = *s;
+               s = ++next;
+       } else {
+               dbg("Invalid Command field [%s]", s);
+               return ret_err(EFAULT);
+       }
+
+       /*
+        * Next character is the subcommand, and should be '-'
+        * Though, it doesn't matter, because we just
+        * discard it anyway.
+        */
+       next = strchr(s, ',');
+       if (next) {
+               p->sub_cmd = *s;
+               s = ++next;
+       } else {
+               dbg("Invalid 2nd field");
+               return ret_err(EFAULT);
+       }
+
+       /*
+        * Next is the number of parameters,
+        * which should always be>  0.
+        */
+       next = strchr(s, ',');
+       if (next) {
+               *next++ = '\0';
+               p->count = atoi(s);
+               s = next;
+       } else {
+               dbg("Couldn't determine number of parameters");
+               return ret_err(EFAULT);
+       }
+       
+       dbg("Have %d parameter%s (cmd = '%c')",
+           p->count, p->count>  1 ? "s" : "", p->cmd);
+
+       /*
+        * Now, we loop over the rest of the string,
+        * storing a pointer to each in p->field[].
+        *
+        * The last character was originally a ';', but may have been
+        * overwritten with a '\0', so we make sure to catch
+        * that when converting the last parameter.
+        */
+       for (i = 0; i<  p->count; i++) {
+               next = strpbrk(s, ",;");
+               if (next) {
+                       *next++ = '\0';
+               } else {
+                       if (i<  (p->count - 1)) {
+                               dbg("Malformed parameter string [%s]", s);
+                               return ret_err(EFAULT);
+                       }
+               }
+
+               /*
+                * Skip leading white space in fields
+                */
+               while (isspace(*s))
+                       s++;
+               p->field[i] = s;
+               s = next;
+       }
+       dump_packet(p);
+       return 0;
+}
+
+
+static int wu_read(int fd, struct wu_packet * p)
+{
+       fd_set read_fd;
+       struct timeval tv;
+       int ret;
+
+       FD_ZERO(&read_fd);
+       FD_SET(fd,&read_fd);
+       
+       tv.tv_sec = 2;
+       tv.tv_usec = 0;
+
+       ret = select(fd + 1,&read_fd, NULL, NULL,&tv);
+       if (ret<  0) {
+               perr("select on terminal device");
+               return ret;
+       } else if (ret>  0) {
+
+               ret = read(fd, p->buf, wu_strlen);
+               if (ret<  0) {
+                       perr("Reading from device");
+                       return ret;
+               }
+               p->len = ret;
+       } else {
+               dbg("Device timed out while reading");
+               return ret_err(ETIME);
+       }
+       return parse_packet(p);
+}
+
+
+static int wu_show_header(int fd)
+{
+       struct wu_packet p = {
+               .cmd            = 'H',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label = {
+                       [0] = "watts header",
+                       [1] = "volts header",
+                       [2] = "amps header",
+                       [3] = "kWh header",
+                       [4] = "cost header",
+                       [5] = "mo. kWh header",
+                       [6] = "mo. cost header",
+                       [7] = "max watts header",
+                       [8] = "max volts header",
+                       [9] = "max amps header",
+                       [10] = "min watts header",
+                       [11] = "min volts header",
+                       [12] = "min amps header",
+                       [13] = "power factor header",
+                       [14] = "duty cycle header",
+                       [15] = "power cycle header",
+               }
+       };
+       int ret;
+
+       ret = wu_write(fd,&p);
+       if (ret) {
+               perr("Requesting header strings");
+               return ret;
+       }
+       sleep(1);
+
+       ret = wu_read(fd,&p);
+       if (ret) {
+               perr("Reading header strings");
+               return ret;
+       }
+
+       print_packet(&p, "Header Record");
+
+       return 0;
+}
+
+
+static int wu_show_cal(int fd)
+{
+       struct wu_packet p = {
+               .cmd            = 'F',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label = {
+                       [0] = "flags",
+                       [1] = "sample count",
+                       [2] = "volts gain",
+                       [3] = "volts bias",
+                       [4] = "amps gain",
+                       [5] = "amps bias",
+                       [6] = "amps offset",
+                       [7] = "low amps gain",
+                       [8] = "low amps bias",
+                       [9] = "low amps offset",
+                       [10] = "watts gain",
+                       [11] = "watts offset",
+                       [12] = "low watts gain",
+                       [13] = "low watts offset",
+               },
+       };
+       int ret;
+
+       ret = wu_write(fd,&p);
+       if (ret) {
+               perr("Requesting calibration parameters");
+               return ret;
+       }
+       sleep(1);
+
+       ret = wu_read(fd,&p);
+       if (ret) {
+               perr("Reading header strings");
+               return ret;
+       }
+       print_packet(&p, "Calibration Settings");
+
+       return 0;
+}
+
+static int wu_start_log(void)
+{
+       struct wu_packet p = {
+               .cmd            = 'L',
+               .sub_cmd        = 'W',
+               .count          = 3,
+               .field          = {
+                       [0] = "E",
+                       [1] = "1",
+                       [2] = "1",
+               },
+       };
+       int ret;
+
+       /*
+        * Start up logging
+        */
+       ret = wu_write(wu_fd,&p);
+       if (!ret)
+               sleep(1);
+       else {
+               perr("Starting External Logging");
+               return ret;
+       }
+       return ret;
+}
+
+static int wu_stop_log(void)
+{
+       struct wu_packet p = {
+               .cmd            = 'L',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label = {
+                       [0] = "time stamp",
+                       [1] = "interval",
+               },
+       };
+       int ret;
+
+       /*
+        * Stop logging and read time stamp.
+        */
+       ret = wu_write(wu_fd,&p);
+       if (ret) {
+               perr("Stopping External Logging");
+               return ret;
+       }
+       sleep(1);
+
+       ret = wu_read(wu_fd,&p);
+       if (ret) {
+               perr("Reading final time stamp");
+               return ret;
+       }
+       if (wu_final)
+               print_packet(&p, "Final Time Stamp and Interval");
+       return ret;
+}
+
+static int filter_data(struct wu_packet * p, int i, char * buf)
+{
+       if (i<  wu_num_fields) {
+               if (wu_fields[i].enable) {
+                       double val = strtod(p->field[i], NULL);
+                       snprintf(buf, 256, "%.1f", val / 10.0);
+                       return 1;
+               }
+       }
+       return 0;
+}
+
+static int wu_clear(int fd)
+{
+       struct wu_packet p = {
+               .cmd            = 'R',
+               .sub_cmd        = 'W',
+               .count          = 0,
+       };
+       int ret;
+
+       /*
+        * Clear the memory
+        */
+       ret = wu_write(fd,&p);
+       if (ret)
+               perr("Clearing memory");
+       else
+               sleep(2);
+       
+       /*
+        * Dummy read
+        */
+       wu_read(fd,&p);
+       return ret;
+
+}
+
+static int wu_read_data(int fd)
+{
+       struct wu_packet p = {
+               .label = {
+                       [0] = "watts",
+                       [1] = "volts",
+                       [2] = "amps",
+                       [3] = "watt hours",
+                       [4] = "cost",
+                       [5] = "mo. kWh",
+                       [6] = "mo. cost",
+                       [7] = "max watts",
+                       [8] = "max volts",
+                       [9] = "max amps",
+                       [10] = "min watts",
+                       [11] = "min volts",
+                       [12] = "min amps",
+                       [13] = "power factor",
+                       [14] = "duty cycle",
+                       [15] = "power cycle",
+               },
+       };
+       int num_read = 0;
+       int retry = 0;
+       int ret;
+       int i;
+
+       static const int wu_max_retry = 2;
+
+       i = 0;
+       while (1) {
+               
+               ret = wu_read(fd,&p);
+               if (ret) {
+                       if (++retry<  wu_max_retry) {
+                               dbg("Bad record back, retrying\n");
+                               sleep(wu_interval);
+                               continue;
+                       } else if (retry == wu_max_retry) {
+                               dbg("Still couldn't get a good record, resetting\n");
+                               wu_stop_log();
+                               wu_clear(fd);
+                               wu_start_log();
+                               num_read = 0;
+                               sleep(wu_interval);
+                               continue;
+                       }
+                       perr("Blech. Giving up on read");
+                       break;
+               } else if (retry)
+                       retry = 0;
+
+               dbg("[%d] ", num_read);
+               num_read++;
+               print_packet_filter(&p, filter_data);
+
+               if (wu_count&&  (++i == wu_count))
+                       break;
+               
+               sleep(wu_interval);
+       }
+       return 0;
+
+}
+
+
+static int wu_show_interval(int fd)
+{
+       struct wu_packet p = {
+               .cmd            = 'S',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label = {
+                       [0] = "reserved",
+                       [1] = "interval",
+               },
+       };
+       int ret;
+       
+       ret = wu_write(fd,&p);
+       if (ret) {
+               perr("Requesting interval");
+               return ret;
+       }
+       sleep(1);
+
+       ret = wu_read(fd,&p);
+       if (ret) {
+               perr("Reading interval");
+               return ret;
+       }
+       print_packet(&p, "Interval Settings");
+
+       return 0;
+}
+
+static int wu_write_interval(int fd, unsigned int seconds,
+                            unsigned int interval)
+{
+       char str_seconds[wu_param_len];
+       char str_interval[wu_param_len];
+       struct wu_packet p = {
+               .cmd            = 'S',
+               .sub_cmd        = 'W',
+               .count          = 2,
+               .field          = {
+                       [0] = str_seconds,
+                       [1] = str_interval,
+               },
+       };
+       int ret;
+
+       snprintf(str_seconds, wu_param_len, "%ud", seconds);
+       snprintf(str_interval, wu_param_len, "%ud", interval);
+
+       ret = wu_write(fd,&p);
+       if (ret) {
+               perr("Setting Sampling Interval");
+               return ret;
+       }
+       sleep(1);
+       return 0;
+}
+
+static int wu_store_interval(int fd)
+{
+       char * s = wu_option_value(wu_option_interval);
+       char * end;
+
+       wu_interval = strtol(s,&end, 0);
+       if (*end) {
+               err("Invalid interval: %s", s);
+               return ret_err(EINVAL);
+       }
+       return wu_write_interval(fd, 1, wu_interval);
+}
+
+static int wu_show_mode(int fd)
+{
+       struct wu_packet p = {
+               .cmd            = 'M',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label          = {
+                       [0] = "display mode",
+               },
+       };
+       int ret;
+
+       ret = wu_write(fd,&p);
+       if (ret) {
+               perr("Requesting device display mode");
+               return ret;
+       }
+
+       ret = wu_read(fd,&p);
+       if (ret) {
+               perr("Reaing device display mode");
+               return ret;
+       }
+       dump_packet(&p);
+       return ret;
+}
+
+static int wu_write_mode(int fd, int mode)
+{
+       char str_mode[wu_param_len];
+       struct wu_packet p = {
+               .cmd            = 'M',
+               .sub_cmd        = 'W',
+               .count          = 1,
+               .field          = {
+                       [0] = str_mode,
+               },
+       };
+       int ret;
+       
+       snprintf(str_mode, wu_param_len, "%ud", mode);
+       ret = wu_write(fd,&p);
+       if (ret)
+               perr("Setting device display mode");
+       else
+               sleep(1);
+       return ret;
+}
+
+static int wu_store_mode(int fd)
+{
+       char * s = wu_option_value(wu_option_mode);
+       char * end;
+       unsigned int mode;
+
+       mode = strtol(s,&end, 0);
+       if (*end) {
+               err("Invalid mode: %s", s);
+               return ret_err(EINVAL);
+       }
+       return wu_write_mode(fd, mode);
+}
+
+
+
+static int wu_show_user(int fd)
+{
+       struct wu_packet p = {
+               .cmd            = 'U',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label          = {
+                       [0] = "cost per kWh",
+                       [1] = "2nd tier cost",
+                       [2] = "2nd tier threshold",
+                       [3] = "duty cycle threshold",
+               },
+       };
+       int ret;
+
+       ret = wu_write(fd,&p);
+       if (ret) {
+               perr("Requesting user parameters");
+               return ret;
+       }
+       sleep(1);
+
+       ret = wu_read(fd,&p);
+       if (ret) {
+               perr("Reading user parameters");
+               return ret;
+       }
+       print_packet(&p, "User Settings");
+       return 0;
+}
+
+
+static int wu_write_user(int fd, unsigned int kwh_cost,
+                        unsigned int second_tier_cost,
+                        unsigned int second_tier_threshold,
+                        unsigned int duty_cycle_threshold)
+{
+       char str_kwh_cost[wu_param_len];
+       char str_2nd_tier_cost[wu_param_len];
+       char str_2nd_tier_threshold[wu_param_len];
+       char str_duty_cycle_threshold[wu_param_len];
+
+       struct wu_packet p = {
+               .cmd            = 'U',
+               .sub_cmd        = 'R',
+               .count          = 0,
+               .label          = {
+                       [0] = str_kwh_cost,
+                       [1] = str_2nd_tier_cost,
+                       [2] = str_2nd_tier_threshold,
+                       [3] = str_duty_cycle_threshold,
+               },
+       };
+       int ret;
+
+       snprintf(str_kwh_cost, wu_param_len, "%ud", kwh_cost);
+       snprintf(str_2nd_tier_cost, wu_param_len, "%ud",
+                second_tier_cost);
+       snprintf(str_2nd_tier_threshold, wu_param_len, "%ud",
+                second_tier_threshold);
+       snprintf(str_duty_cycle_threshold, wu_param_len, "%ud",
+                duty_cycle_threshold);
+
+       ret = wu_write(fd,&p);
+       if (ret)
+               perr("Writing user parameters");
+       else
+               sleep(1);
+       return ret;
+}
+
+static int wu_store_user(int fd)
+{
+       unsigned int kwh_cost;
+       unsigned int second_tier_cost;
+       unsigned int second_tier_threshold;
+       unsigned int duty_cycle_threshold;
+       char * buf = wu_option_value(wu_option_user);
+       char * s = buf;
+       char * next;
+
+       if (!buf) {
+               err("No user parameters?");
+               return ret_err(EINVAL);
+       }
+
+       kwh_cost = strtoul(s,&next, 0);
+       if (next == s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+       s = next;
+       while (s&&  !isdigit(*s))
+               s++;
+       if (!s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+
+       second_tier_cost = strtoul(s,&next, 0);
+       if (next == s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+       s = next;
+       while (s&&  !isdigit(*s))
+               s++;
+       if (!s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+
+       second_tier_threshold = strtoul(s,&next, 0);
+       if (next == s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+       s = next;
+       while (s&&  !isdigit(*s))
+               s++;
+       if (!s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+
+       duty_cycle_threshold = strtoul(s,&next, 0);
+       if (next == s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+       s = next;
+       while (s&&  !isdigit(*s))
+               s++;
+       if (!s) {
+               err("Incomplete user parameters");
+               return ret_err(EINVAL);
+       }
+
+       return wu_write_user(fd, kwh_cost, second_tier_cost,
+                            second_tier_threshold, duty_cycle_threshold);
+}
+
+
+static void enable_field(char * name)
+{
+       int i;
+
+       for (i = 0; i<  wu_num_fields; i++) {
+               if (!strcasecmp(wu_fields[i].name, name)) {
+                       wu_fields[i].enable = 1;
+                       break;
+               }
+       }
+}
+
+static void enable_all_fields(void)
+{
+       int i;
+
+       for (i = 0; i<  wu_num_fields; i++)
+               wu_fields[i].enable = 1;
+}
+
+
+
+static int wu_show_help(int);
+static int wu_show_version(int);
+
+
+
+static int wu_store_count(int unused)
+{
+       char * s = wu_option_value(wu_option_count);
+       char * end;
+
+       if (s) {
+               wu_count = strtol(s,&end, 0);
+               if (*end) {
+                       err("Bad count field");
+                       return ret_err(EINVAL);
+               }
+       }
+       return 0;
+}
+
+static int wu_store_debug(int unused)
+{
+       wu_debug = 1;
+       return 0;
+}
+
+static int wu_store_delim(int unused)
+{
+       char * s = wu_option_value(wu_option_delim);
+       
+       if (s)
+               wu_delim = s;
+       return 0;
+}
+
+static int wu_store_final(int unused)
+{
+       wu_final = 1;
+       return 0;
+}
+
+static int wu_store_label(int unused)
+{
+       wu_label = 1;
+       return 0;
+}
+
+static int wu_store_newline(int unused)
+{
+       wu_newline = 1;
+       return 0;
+}
+
+static int wu_store_suppress(int unused)
+{
+       wu_suppress = 1;
+       return 0;
+}
+
+static int wu_store_localtime(int unused)
+{
+       wu_localtime = 1;
+       return 0;
+}
+
+static int wu_store_gmtime(int unused)
+{
+       wu_gmtime = 1;
+       return 0;
+}
+
+static int wu_store_info_all(int unused)
+{
+       wu_info_all = 1;
+       return 0;
+}
+
+static int wu_store_no_data(int unused)
+{
+       wu_no_data = 1;
+       return 0;
+}
+
+static int wu_store_set_only(int unused)
+{
+       wu_set_only = 1;
+       return 0;
+}
+
+
+/**
+ *     wu_options - command line options and their associated flags
+ *
+ */
+static struct wu_options wu_options[] = {
+
+       /*
+        * Help!
+        */
+       [wu_option_help] = {
+               .longopt        = "help",
+               .shortopt       = 'h',
+               .param          = 0,
+               .descr          = "Display help text and exit",
+               .show           = wu_show_help,
+       },
+
+       [wu_option_version] = {
+               .longopt        = "version",
+               .shortopt       = 'V',
+               .param          = 0,
+               .descr          = "Display version information and exit",
+               .show           = wu_show_version,
+       },
+
+       /*
+        * Modifies the output for all other options
+        */
+       [wu_option_debug] = {
+               .longopt        = "debug",
+               .shortopt       = 'd',
+               .param          = 0,
+               .descr          = "Print out debugging messages",
+               .store          = wu_store_debug,
+       },
+
+       /*
+        * For data reading..
+        */
+       [wu_option_count] = {
+               .longopt        = "count",
+               .shortopt       = 'c',
+               .param          = 1,
+               .descr          = "Specify number of data samples",
+               .option         = "<n>",
+               .store          = wu_store_count,
+       },
+
+       [wu_option_final] = {
+               .longopt        = "final",
+               .shortopt       = 'z',
+               .param          = 0,
+               .descr          = "Print final interval information",
+               .store          = wu_store_final,
+       },
+
+       /*
+        * Modifies output for each option (most relevant for data)
+        */
+       [wu_option_delim] = {
+               .longopt        = "delim",
+               .shortopt       = 'f',
+               .param          = 1,
+               .descr          = "Set field delimiter (default \", \")",
+               .option         = "<str>",
+               .store          = wu_store_delim,
+       },
+
+       [wu_option_newline] = {
+               .longopt        = "newline",
+               .shortopt       = 'n',
+               .param          = 0,
+               .descr          = "Use '\\n' as delimter instead",
+               .store          = wu_store_newline,
+       },
+
+       [wu_option_localtime] = {
+               .longopt        = "localtime",
+               .shortopt       = 't',
+               .param          = 0,
+               .descr          = "Print localtime with each data reading",
+               .store          = wu_store_localtime,
+       },
+
+       [wu_option_gmtime] = {
+               .longopt        = "gmtime",
+               .shortopt       = 'g',
+               .param          = 0,
+               .descr          = "Print GMT time with each data reading",
+               .store          = wu_store_gmtime,
+       },
+
+       [wu_option_label] = {
+               .longopt        = "label",
+               .shortopt       = 'l',
+               .param          = 0,
+               .descr          = "Show labels of each field",
+               .store          = wu_store_label,
+       },
+
+       /*
+        * Relevant for each of the fields below
+        */
+       [wu_option_suppress] = {
+               .longopt        = "suppress",
+               .shortopt       = 's',
+               .param          = 0,
+               .descr          = "Suppress printing of the field description",
+               .store          = wu_store_suppress,
+       },
+
+       /*
+        * These options print values from the device and exit.
+        */
+       [wu_option_cal] = {
+               .longopt        = "calibrate",
+               .shortopt       = 'b',
+               .param          = 0,
+               .descr          = "Print calibration parameters",
+               .show           = wu_show_cal,
+       },
+
+       [wu_option_header] = {
+               .longopt        = "header",
+               .shortopt       = 'r',
+               .param          = 0,
+               .descr          = "Print data field names (as read from device)",
+               .show           = wu_show_header,
+       },
+
+       /*
+        * These options have an optional parameter.
+        * W/o that parameter, they print values from the device.
+        * W/ that parameter, they set that option and read data.
+        *
+        * Except when the 'set-only' parameter is used, then the
+        * parameters are set, then re-read and printed.
+        */
+       [wu_option_interval] = {
+               .longopt        = "interval",
+               .shortopt       = 'i',
+               .param          = 2,
+               .descr          = "Get/Set sampling interval",
+               .option         = "<n>",
+               .show           = wu_show_interval,
+               .store          = wu_store_interval,
+       },
+
+       [wu_option_mode] = {
+               .longopt        = "mode",
+               .shortopt       = 'm',
+               .param          = 2,
+               .descr          = "Get/Set display mode",
+               .option         = "<n>",
+               .show           = wu_show_mode,
+               .store          = wu_store_mode,
+       },
+
+       [wu_option_user] = {
+               .longopt        = "user",
+               .shortopt       = 'u',
+               .param          = 2,
+               .descr          = "Get/Set user parameters",
+               .option         = "<str>",
+               .format         = "<cost per kwh>,<2nd tier cost>,"
+                                 "<2nd tier threshold>,"
+                                 "<duty cycle threshold>",
+               .show           = wu_show_user,
+               .store          = wu_store_user,
+       },
+
+       [wu_option_info_all] = {
+               .longopt        = "show-all",
+               .shortopt       = 'a',
+               .param          = 0,
+               .descr          = "Show all device parameters",
+               .store          = wu_store_info_all,
+       },
+
+       [wu_option_no_data] = {
+               .longopt        = "no-data",
+               .shortopt       = 'N',
+               .param          = 0,
+               .descr          = "Don't read any data (just read device info)",
+               .store          = wu_store_no_data,
+       },
+
+       [wu_option_set_only] = {
+               .longopt        = "set-only",
+               .shortopt       = 'S',
+               .param          = 0,
+               .descr          = "Set parameters only (don't read them back)",
+               .store          = wu_store_set_only,
+       },
+};
+
+#define wu_num_options ARRAY_SIZE(wu_options)
+
+static int wu_show_version(int unused)
+{
+       printf("%s Version %s\n", prog_name, wu_version);
+       return 0;
+}
+
+static int wu_show_help(int unused)
+{
+       int i;
+       int n;
+
+       wu_show_version(unused);
+       printf("  A program for interfacing with the Watts Up? Power Meter\n");
+       printf("\n");
+
+       printf("Usage: %s [<options>  ... ]<device>  [<values>  ... ]\n",
+              prog_name);
+       printf("\n");
+       
+       printf("<device>  is the serial port the device is connected at.\n");
+       printf("\n");
+
+       printf("<options>  are any of the following:\n");
+       for (i = 0; i<  wu_num_options; i++) {
+               n = printf("  -%c", wu_options[i].shortopt);
+
+               if (wu_options[i].param == 0)
+                       n = printf(" ");
+               else if (wu_options[i].param == 1)
+                       n = printf(" %s", wu_options[i].option);
+               else if (wu_options[i].param == 2)
+                       n = printf(" [%s]", wu_options[i].option);
+
+               n += printf("%*c| ", n - 12, ' ');
+               n += printf("--%s", wu_options[i].longopt);
+
+               if (wu_options[i].param == 0)
+                       n += printf(" ");
+               else if (wu_options[i].param == 1)
+                       n += printf("=%s", wu_options[i].option);
+               else if (wu_options[i].param == 2)
+                       n += printf("[=%s]", wu_options[i].option);
+
+               printf("%*c%s\n",
+                      40 - n, ' ', wu_options[i].descr);
+       }
+       printf("\n");
+       printf("<value>  specifies which of these to print out (default: ALL)\n");
+       for (i = 0; i<  wu_num_fields; i++) {
+               printf("%12s -- %s\n", wu_fields[i].name, wu_fields[i].descr);
+       }
+       printf("\n");
+
+       return 0;
+}
+
+
+static char * wu_option_value(unsigned int index)
+{
+       return (index<  wu_num_options) ? wu_options[index].value : NULL;
+}
+
+
+static int wu_check_option_show(int index)
+{
+       /*
+        * Return 1 if we need to print something out for
+        * a particular option.
+        */
+       if (index<  wu_num_options) {
+               if (wu_options[index].flag) {
+                       return 1;
+               }
+       }
+       return 0;
+}
+
+static int wu_check_option_store(int index)
+{
+       /*
+        * Return a 1 if this option is set.
+        */
+
+       if (index<  wu_num_options) {
+               if (wu_options[index].flag) {
+                       return 1;
+               }
+       }
+       return 0;
+}
+
+
+static int wu_show(int index, int dev_fd)
+{
+       if (wu_options[index].show)
+               return wu_options[index].show(dev_fd);
+       return 0;
+}
+
+/*
+ * Check if the option is set, and call its method if so.
+ * Return whether or not we did anything..
+ */
+
+static int wu_check_show(int index, int dev_fd)
+{
+       if (wu_check_option_show(index)) {
+               wu_show(index, dev_fd);
+               return 1;
+       }
+       return 0;
+}
+
+
+/*
+ * Check if the option is set and if so, call it
+ * Return the value from the ->store() method.
+ */
+
+static int wu_check_store(int index, int dev_fd)
+{
+       if (wu_check_option_store(index)) {
+               if (wu_options[index].store)
+                       return wu_options[index].store(dev_fd);
+       }
+       return 0;
+}
+
+
+static void make_longopt(struct option * l)
+{
+       int i;
+
+       for (i = 0; i<  wu_num_options; i++) {
+               l[i].name = wu_options[i].longopt;
+               l[i].has_arg = wu_options[i].param;
+               l[i].flag =&wu_options[i].flag;
+               l[i].val = 0;
+       }
+}
+
+static void make_shortopt(char * str)
+{
+       int i;
+       char * s = str;
+       
+       for (i = 0; i<  wu_num_options; i++) {
+               *s++ = wu_options[i].shortopt;
+               if (wu_options[i].param)
+                       *s++ = wu_options[i].param == 1 ? ':' : ';';
+       }
+}
+
+static void enable_short_option(int c, char * arg)
+{
+       int i;
+
+       /*
+        * Friggin' getopt_long() will return the
+        * character if we get a short option (e.g. '-h'),
+        * instead of returning 0 like it does when it
+        * gets a long option (e.g. "--help"). Ugh.
+        */
+       for (i = 0; i<  wu_num_options; i++) {
+               if (wu_options[i].shortopt == c) {
+                       wu_options[i].flag = 1;
+                       if (arg)
+                               wu_options[i].value = strdup(arg);
+                       break;
+               }
+       }
+}
+
+static int parse_args(int argc, char ** argv)
+{
+       struct option longopts[wu_num_options + 1] = { };
+       char shortopts[wu_num_options * 2] = "";
+
+       make_longopt(longopts);
+       make_shortopt(shortopts);
+
+
+       while (1) {
+               int c;
+               int index;
+
+               c = getopt_long(argc, argv, shortopts,
+                               longopts,&index);
+               if (c == -1)
+                       break;
+               
+               switch (c) {
+               case 0:
+                       wu_options[index].flag = 1;
+                       if (optarg)
+                               wu_options[index].value = strdup(optarg);
+                       
+                       printf("long option: val = %c, optarg = %s\n",
+                              wu_options[index].shortopt, optarg);
+                       break;
+               case '?':
+                       err("Bad parameter");
+                       return ret_err(EINVAL);
+                       break;
+               default:
+                       enable_short_option(c, optarg);
+                       break;
+               }
+       }
+
+       /*
+        * Check for help request now and bail after
+        * printing it, if it's set.
+        */
+       if (wu_check_show(wu_option_help, 0))
+               exit(0);
+
+       if (wu_check_show(wu_option_version, 0))
+               exit(0);
+
+       /*
+        * Fields to print out
+        */
+       if (optind<  argc) {
+               int i;
+
+               wu_device = argv[optind++];
+
+               if (optind<  argc) {
+                       for (i = optind; i<  argc; i++)
+                               enable_field(argv[i]);
+               } else
+                       enable_all_fields();
+
+       } else {
+               wu_show(wu_option_help, 0);
+               return ret_err(EINVAL);
+       }
+       return 0;
+}
+
+
+int main(int argc, char ** argv)
+{
+       int ret;
+       int fd = 0;
+
+       ret = parse_args(argc, argv);
+       if (ret)
+               return 0;
+
+       /*
+        * Try to enable debugging early
+        */
+       if ((ret = wu_check_store(wu_option_debug, 0)))
+               goto Close;
+
+       ret = open_device(wu_device,&fd);
+       if (ret)
+               return ret;
+
+       dbg("%s: Open for business", wu_device);
+
+       ret = setup_serial_device(fd);
+       if (ret)
+               goto Close;
+
+       wu_clear(fd);
+
+       wu_fd = fd;
+
+       /*
+        * Set delimeter before we print out any fields.
+        */
+       if ((ret = wu_check_store(wu_option_delim, fd)))
+               goto Close;
+
+       /*
+        * Ditto for 'label' and 'newline' flags.
+        */
+       if ((ret = wu_check_store(wu_option_label, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_newline, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_suppress, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_localtime, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_gmtime, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_set_only, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_no_data, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_info_all, fd)))
+               goto Close;
+
+
+       /*
+        * Options to set device parameters.
+        */
+       if ((ret = wu_check_store(wu_option_interval, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_mode, fd)))
+               goto Close;
+
+       if ((ret = wu_check_store(wu_option_user, fd)))
+               goto Close;
+
+       /*
+        * Check for options to print device info
+        */
+       if (wu_info_all) {
+               wu_show(wu_option_cal, fd);
+               wu_show(wu_option_header, fd);
+               wu_show(wu_option_interval, fd);
+               wu_show(wu_option_mode, fd);
+               wu_show(wu_option_user, fd);
+       } else {
+               wu_check_show(wu_option_cal, fd);
+               wu_check_show(wu_option_header, fd);
+
+               if (!wu_set_only) {
+                       wu_check_show(wu_option_interval, fd);
+                       wu_check_show(wu_option_mode, fd);
+                       wu_check_show(wu_option_user, fd);
+               }
+       }
+
+       if (!wu_no_data) {
+
+               if ((ret = wu_check_store(wu_option_count, fd)))
+                       goto Close;
+
+               if ((ret = wu_check_store(wu_option_final, fd)))
+                       goto Close;
+
+               if ((ret = wu_start_log()))
+                       goto Close;
+       
+               wu_read_data(fd);
+               
+               wu_stop_log();
+       }
+Close:
+       close(fd);
+       return ret;
+}
+
+
diff --git a/utils/wifitoggle/Makefile b/utils/wifitoggle/Makefile
new file mode 100644 (file)
index 0000000..adec3fb
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2010-2013 OpenWrt.org
+# Copyright (C) 2010 segal.di.ubi.pt
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wifitoggle
+PKG_VERSION:=1
+PKG_RELEASE:=4
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wifitoggle
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Script to toggle Wi-Fi with a button and UCI config
+endef
+
+define Package/wifitoggle/description
+Very versatile script to toggle Wi-Fi with a button. Allows to set
+timeouts, persist changes after boot, and set LEDs according to the state.
+endef
+
+define Package/wifitoggle/conffiles
+/etc/config/wifitoggle
+endef
+
+define Build/Compile
+endef
+
+define Package/wifitoggle/install
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/button
+       $(INSTALL_BIN) ./files/wifitoggle.hotplug $(1)/etc/hotplug.d/button/50-wifitoggle
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/wifitoggle.config $(1)/etc/config/wifitoggle
+endef
+
+$(eval $(call BuildPackage,wifitoggle))
diff --git a/utils/wifitoggle/files/wifitoggle.config b/utils/wifitoggle/files/wifitoggle.config
new file mode 100755 (executable)
index 0000000..f3bec29
--- /dev/null
@@ -0,0 +1,11 @@
+config wifitoggle
+       option button   'wps'
+
+       option persistent       '0' 
+       option timer            '600'
+
+       option led_sysfs                'wrt160nl:amber:wps'
+       option led_enable_trigger       'timer' 
+       option led_enable_delayon       '500'
+       option led_enable_delayoff      '500'
+       option led_disable_default      '0'
diff --git a/utils/wifitoggle/files/wifitoggle.hotplug b/utils/wifitoggle/files/wifitoggle.hotplug
new file mode 100755 (executable)
index 0000000..d66db3f
--- /dev/null
@@ -0,0 +1,172 @@
+# /bin/sh
+
+setled() {
+        if [ -e /sys/class/leds/${led_sysfs}/brightness ]
+       then
+                [ $led_default -eq 1 ] && echo 1 >/sys/class/leds/${led_sysfs}/brightness
+                [ $led_default -eq 1 ] || echo 0 >/sys/class/leds/${led_sysfs}/brightness
+
+                echo $led_trigger > /sys/class/leds/${led_sysfs}/trigger
+
+                [ "$led_trigger" == "netdev" -a -n "$led_dev" ] && {
+                        echo $led_dev > /sys/class/leds/${led_sysfs}/device_name
+                        echo $led_mode > /sys/class/leds/${led_sysfs}/mode
+                }
+
+                [ "$led_trigger" == "timer" ] && {
+                        [ -n "$led_delayon" ] && echo $led_delayon > /sys/class/leds/${led_sysfs}/delay_on
+                        [ -n "$led_delayoff" ] && echo $led_delayoff > /sys/class/leds/${led_sysfs}/delay_off
+                }
+        else
+               logger -p user.err -t "wifitoggle" "led: ${led_sysfs} not found"
+       fi
+}
+
+load_wireless() {
+       disabled="$(uci get wireless.${1}.disabled)"
+}
+
+save_wireless() {
+       [ "$device" = "all" -o "$device" = "${1}" ] && {
+               uci set "wireless.${1}.disabled=$disabled"
+       }
+}
+
+setwifi() {
+        setled
+
+        config_load wireless
+        config_foreach save_wireless wifi-device
+
+        if ubus list network.wireless >/dev/null 2>/dev/null; then
+                ubus call network reload
+        else
+                wifi
+        fi
+}
+
+
+save_system() {
+        config_get sysfs $1 sysfs
+        [ "$sysfs" = "$led_sysfs" ] && {
+                uci set "system.${1}.trigger=$led_trigger"
+                uci set "system.${1}.dev=$led_dev"
+                uci set "system.${1}.mode=$led_mode"
+                uci set "system.${1}.default=$led_default"
+                uci set "system.${1}.delayon=$led_delayon"
+                uci set "system.${1}.delayoff=$led_delayoff"
+
+                ledset=1
+        }
+}
+
+commit_changes() {
+        ledset=""
+
+        config_load system
+        config_foreach save_system led
+
+        [ "$ledset" -eq 1 ] || {
+                section=$(uci add system led)
+                uci set "system.${section}.sysfs=$led_sysfs"
+                uci set "system.${section}.trigger=$led_trigger"
+                uci set "system.${section}.dev=$led_dev"
+                uci set "system.${section}.mode=$led_mode"
+                uci set "system.${section}.default=$led_default"
+                uci set "system.${section}.delayon=$led_delayon"
+                uci set "system.${section}.delayoff=$led_delayoff"
+        }
+
+        uci commit
+}
+
+enable() {
+
+       led_trigger="$led_enable_trigger"
+       led_trigger="$led_enable_trigger"
+       led_dev="$led_enable_dev"
+       led_mode="$led_enable_mode"
+       led_default="$led_enable_default"
+       led_delayon="$led_enable_delayon"
+       led_delayoff="$led_enable_delayoff"
+       disabled=0
+       
+       setwifi
+
+       [ "$timer" -le 0 -a "$persistent" -eq 1 ] && commit_changes
+       
+       logger -p user.info -t "wifitoggle" "device($device) enabled"
+
+       [ "$timer" -gt 0 ] && {
+               sleep "$timer" && disable && rm /tmp/run/wirelesstoggle_${1}.pid &
+                echo $! > /tmp/run/wirelesstoggle_${1}.pid
+               logger -p user.info -t "wifitoggle" "auto-disable timer started($timer seconds)"
+       }
+}
+
+disable() {
+
+       led_trigger="$led_disable_trigger"
+       led_trigger="$led_disable_trigger"
+       led_dev="$led_disable_dev"
+       led_mode="$led_disable_mode"
+       led_default="$led_disable_default"
+       led_delayon="$led_disable_delayon"
+       led_delayoff="$led_disable_delayoff"
+       disabled=1
+
+       setwifi
+
+       [ "$timer" -le 0 -a "$persistent" -eq 1 ] && commit_changes
+       
+       logger -p user.info -t "wifitoggle" "device($device) disabled"
+}
+
+
+load_wifitoggle() {
+       config_get device $1 device "all"
+        config_get button $1 button "wps"
+        config_get action $1 action "pressed"
+        config_get_bool persistent $1 persistent "0"
+        config_get timer $1 timer "0"
+
+        config_get led_sysfs $1 led_sysfs
+
+       config_get led_enable_trigger $1 led_enable_trigger "none"
+       config_get led_enable_dev $1 led_enable_dev
+       config_get led_enable_mode $1 led_enable_mode "link"
+       config_get_bool led_enable_default $1 led_enable_default "1"
+       config_get led_enable_delayon $1 led_enable_delayon
+       config_get led_enable_delayoff $1 led_enable_delayoff
+
+       config_get led_disable_trigger $1 led_disable_trigger "none"
+       config_get led_disable_dev $1 led_disable_dev
+       config_get led_disable_mode $1 led_disable_mode "link"
+       config_get_bool led_disable_default $1 led_disable_default "0"
+       config_get led_disable_delayon $1 led_disable_delayon
+       config_get led_disable_delayoff $1 led_disable_delayoff
+
+        [ "$ACTION" = "$action" -a "$BUTTON" = "$button" ] && {
+
+               [ -f /tmp/run/wirelesstoggle_${1}.pid ] && read PID < /tmp/run/wirelesstoggle_${1}.pid && kill $PID && rm /tmp/run/wirelesstoggle_${1}.pid
+
+               if [ "$device" = "all" ]
+               then
+                       config_load wireless
+                       config_foreach load_wireless wifi-device
+               else
+                       disabled="$(uci get wireless."$device".disabled)"
+               fi
+
+
+               if [ "$disabled" = "1" ] 
+               then
+                       enable $1
+               else
+                       disable
+               fi
+        }
+}
+
+config_load wifitoggle
+config_foreach load_wifitoggle wifitoggle
diff --git a/utils/wview/Makefile b/utils/wview/Makefile
new file mode 100644 (file)
index 0000000..d74e30a
--- /dev/null
@@ -0,0 +1,170 @@
+#
+# Copyright (C) 2012 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:=wview
+PKG_VERSION:=5.19.0-jgoerzen
+PKG_RELEASE=$(PKG_SOURCE_VERSION)-r2
+PKG_SOURCE_URL:=git://github.com/jgoerzen/wview.git
+PKG_SOURCE_VERSION:=7bfac6c11e756290c38e7b5862a4c51b6bc6c51e
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wview
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libcurl +zlib +libpng +libgd +libreadline +libsqlite3 +libusb-1.0 +radlib +sqlite3-cli +libopenssl
+  TITLE:=Wview Weather Station Software
+  URL:=http://www.wviewweather.com/
+endef
+
+define Package/wview/description
+  Wview is a collection of linux/unix daemons which interface with a supported
+  weather station to retrieve archive records (if generated by the station) and
+  current conditions. If the station does not generate archive records
+  internally, wview will auto-generate archive records based on the sensor
+  readings collected for that interval. The archive records and High/Low (HILOW)
+  data are stored in SQLite3 databases. At a configurable interval, wview will
+  utilize the archive history and current conditions to generate weather images
+  (buckets, dials and graphs) and HTML web pages based on user-configurable HTML
+  templates.
+
+  After install you need to create a directory holding archive and create the
+  database there by running there
+    sqlite3 wview-archive.sdb '.read /etc/wview/wview-archive.sql'
+
+  Then copy all your theme files to the appropriate place (on a non-volatile
+  storage), and html-templates.conf to /etc/wview/; then wviewconfig to configure
+  the system.
+
+  Read and amend /etc/init.d/wview appropriately for your particular setup!
+endef
+
+define Package/wview/prerm
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+        echo "Removing rc.d symlink for wview"
+        /etc/init.d/wview disable
+fi
+exit 0
+endef
+
+define Package/wview/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/cwop/wvcwopd $(1)/usr/bin/wvcwopd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/http/wvhttpd $(1)/usr/bin/wvhttpd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/procmon/wvpmond $(1)/usr/bin/wvpmond
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/hilowcreate/hilowcreate $(1)/usr/bin/hilowcreate
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/sqlite2wlk/sqlite2wlk $(1)/usr/bin/sqlite2wlk
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/htmlgenerator/htmlgend $(1)/usr/bin/htmlgend
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/VantagePro/vpconfig/vpinstall $(1)/usr/bin/vpinstall
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ftp/wviewftpd $(1)/usr/bin/wviewftpd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssh/wviewsshd $(1)/usr/bin/wviewsshd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/Virtual/wviewd_virtual $(1)/usr/bin/wviewd_virtual
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/archive-be2le/arc_be2le $(1)/usr/bin/arc_be2le
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/archive-le2be/arc_le2be $(1)/usr/bin/arc_le2be
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/alarms/wvalarmd $(1)/usr/bin/wvalarmd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/wlk2sqlite/wlk2sqlite $(1)/usr/bin/wlk2sqlite
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/Simulator/wviewd_sim $(1)/usr/bin/wviewd_sim
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/TWI/wviewd_twi $(1)/usr/bin/wviewd_twi
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/VantagePro/wviewd_vpro $(1)/usr/bin/wviewd_vpro
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wviewconfig/wviewconfig $(1)/usr/bin/wviewconfig
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wviewconfig/wviewhtmlconfig $(1)/usr/bin/wviewhtmlconfig
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WH1080/wviewd_wh1080 $(1)/usr/bin/wviewd_wh1080
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WMR918/wviewd_wmr918 $(1)/usr/bin/wviewd_wmr918
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WS-2300/wviewd_ws2300 $(1)/usr/bin/wviewd_ws2300
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WMRUSB/wviewd_wmrusb $(1)/usr/bin/wviewd_wmrusb
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WXT510/wviewd_wxt510 $(1)/usr/bin/wviewd_wxt510
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/VantagePro/vpconfig/vpconfig $(1)/usr/bin/vpconfig
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wviewconfig/wviewcleardata $(1)/usr/bin/wviewcleardata
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/TE923/wviewd_te923 $(1)/usr/bin/wviewd_te923
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations/WXT510/wxt510config/wxt510config $(1)/usr/bin/wxt510config
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/etc/init.d/wview $(1)/etc/init.d/
+       $(INSTALL_DIR) $(1)/etc/wview
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/wview-conf.sql $(1)/etc/wview/wview-conf.sql
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/graphics.conf $(1)/etc/wview/graphics.conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/post-generate.sh $(1)/etc/wview/post-generate.sh
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/images.conf $(1)/etc/wview/images.conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/images-user.conf $(1)/etc/wview/images-user.conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/arcrec-header.conf $(1)/etc/wview/arcrec-header.conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/pre-generate.sh $(1)/etc/wview/pre-generate.sh
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/wview-conf-update.sql $(1)/etc/wview/wview-conf-update.sql
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/conf/forecast.conf-no-forecast $(1)/etc/wview/forecast.conf-no-forecast
+       echo $(PKG_VERSION) > $(1)/etc/wview/wview-version
+       echo wviewd_sim > $(1)/etc/wview/wview-binary
+
+# This should never be defined as the user is expected to manually install all the
+# theme files he wants to an appropriate place and to specify that place in the config.
+# Leaving here for the future reference to be able to prepare a full variant of the package
+ifdef INSTALL_TEMPLATES
+       $(INSTALL_DIR) $(1)/etc/wview/html
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/Template-Skins-HOWTO.txt $(1)/etc/wview/html/Template-Skins-HOWTO.txt
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/parameterlist.htx $(1)/etc/wview/html/parameterlist.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/parameterlist.txt $(1)/etc/wview/html/parameterlist.txt
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/awekas_wl.htx-metric $(1)/etc/wview/html/awekas_wl.htx-metric
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Current.htx $(1)/etc/wview/html/Current.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/html-templates.conf $(1)/etc/wview/html/html-templates.conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Weekly.htx $(1)/etc/wview/html/Weekly.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Monthly.htx $(1)/etc/wview/html/Monthly.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/data.htx $(1)/etc/wview/html/data.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/index-day.htx $(1)/etc/wview/html/index-day.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Yearly.htx $(1)/etc/wview/html/Yearly.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Daily.htx $(1)/etc/wview/html/Daily.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/almanac.htx $(1)/etc/wview/html/almanac.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/header-big.incx $(1)/etc/wview/html/header-big.incx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/index.htx $(1)/etc/wview/html/index.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/awekas_wl.htx-us $(1)/etc/wview/html/awekas_wl.htx-us
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/Current_Conditions.htx $(1)/etc/wview/html/Current_Conditions.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/header.incx $(1)/etc/wview/html/header.incx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/index-night.htx $(1)/etc/wview/html/index-night.htx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/wxrss.xtx $(1)/etc/wview/html/wxrss.xtx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/readings.incx $(1)/etc/wview/html/readings.incx
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/standard/nav-buttons.incx $(1)/etc/wview/html/nav-buttons.incx
+       $(INSTALL_DIR) $(1)/etc/wview/alarms
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/alarms/outtempMax.sh $(1)/etc/wview/alarms/outtempMax.sh
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/alarms/outtempMin.sh $(1)/etc/wview/alarms/outtempMin.sh
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/examples/alarms/outtempMaxEmail.sh $(1)/etc/wview/alarms/outtempMaxEmail.sh
+       $(INSTALL_DIR) $(1)/var/run/wview
+       $(INSTALL_DIR) $(1)/var/wview/img
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-partlycloudy.gif $(1)/var/wview/img/fc-icon-partlycloudy.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-rain.gif $(1)/var/wview/img/fc-icon-rain.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/chart_bg.png $(1)/var/wview/img/chart_bg.png
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/dot_bg.png $(1)/var/wview/img/dot_bg.png
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-snowandrain.gif $(1)/var/wview/img/fc-icon-snowandrain.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/Clouds.jpg $(1)/var/wview/img/Clouds.jpg
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/Clouds-blue.jpg $(1)/var/wview/img/Clouds-blue.jpg
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-partlycloudyandsnow.gif $(1)/var/wview/img/fc-icon-partlycloudyandsnow.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/dial_bg.png $(1)/var/wview/img/dial_bg.png
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-snow.gif $(1)/var/wview/img/fc-icon-snow.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/bucket_bg.png $(1)/var/wview/img/bucket_bg.png
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-cloudy.gif $(1)/var/wview/img/fc-icon-cloudy.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/django_bg.jpg $(1)/var/wview/img/django_bg.jpg
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-sunny.gif $(1)/var/wview/img/fc-icon-sunny.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/fc-icon-partlycloudyandrain.gif $(1)/var/wview/img/fc-icon-partlycloudyandrain.gif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/html/chrome/static/above-clouds.jpg $(1)/var/wview/img/above-clouds.jpg
+
+# These files and the directories should be created manually wherever the user is going to
+# have her weather archive and the generated html files
+       $(INSTALL_DIR) $(1)/var/wview/img/NOAA
+       $(INSTALL_DIR) $(1)/var/wview/img/Archive
+       $(INSTALL_DIR) $(1)/var/wview/noaa
+       $(INSTALL_DIR) $(1)/var/wview/alarms
+       $(INSTALL_DIR) $(1)/var/wview/archive
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/bin/archive/wview-archive.sql $(1)/var/wview/archive/wview-archive.sql
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/bin/archive/readme.txt $(1)/var/wview/archive/readme.txt
+endif
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/bin/archive/wview-archive.sql $(1)/etc/wview/wview-archive.sql
+endef
+
+$(eval $(call BuildPackage,wview))
+
diff --git a/utils/wview/files/etc/init.d/wview b/utils/wview/files/etc/init.d/wview
new file mode 100644 (file)
index 0000000..b212d28
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+
+CONF_DIRECTORY=/etc/wview
+RUN_DIRECTORY=/var/wview
+WVIEW_INSTALL_DIR=/usr/bin
+
+WVIEWD_FILE=`cat $CONF_DIRECTORY/wview-binary`
+WVIEWD_BIN=$WVIEW_INSTALL_DIR/$WVIEWD_FILE
+
+WVIEWD_FILE=`cat $CONF_DIRECTORY/wview-binary`
+WVIEWD_BIN=$WVIEW_INSTALL_DIR/$WVIEWD_FILE
+HTMLD_BIN=$WVIEW_INSTALL_DIR/htmlgend
+FTPD_BIN=$WVIEW_INSTALL_DIR/wviewftpd
+SSHD_BIN=$WVIEW_INSTALL_DIR/wviewsshd
+ALARMD_BIN=$WVIEW_INSTALL_DIR/wvalarmd
+CWOPD_BIN=$WVIEW_INSTALL_DIR/wvcwopd
+HTTP_BIN=$WVIEW_INSTALL_DIR/wvhttpd
+RADROUTER_BIN=$WVIEW_INSTALL_DIR/radmrouted
+PMOND_BIN=$WVIEW_INSTALL_DIR/wvpmond
+
+RADROUTER_PID=$RUN_DIRECTORY/radmrouted.pid
+WVIEWD_PID=$RUN_DIRECTORY/wviewd.pid
+HTMLD_PID=$RUN_DIRECTORY/htmlgend.pid
+FTPD_PID=$RUN_DIRECTORY/wviewftpd.pid
+SSHD_PID=$RUN_DIRECTORY/wviewsshd.pid
+ALARMD_PID=$RUN_DIRECTORY/wvalarmd.pid
+CWOPD_PID=$RUN_DIRECTORY/wvcwopd.pid
+HTTP_PID=$RUN_DIRECTORY/wvhttpd.pid
+PMOND_PID=$RUN_DIRECTORY/wvpmond.pid
+
+start() {
+       mkdir /mnt/extusb 2> /dev/null
+       mount /dev/sda1 /mnt/extusb 2> /dev/null
+       mkdir $RUN_DIRECTORY 2> /dev/null
+       ln -snf /mnt/extusb/wview-html $CONF_DIRECTORY/html
+       ln -snf /mnt/extusb/wview-data/measurements-archive /var/wview/archive
+       start-stop-daemon -S -x $RADROUTER_BIN -- 1 $RUN_DIRECTORY
+       sleep 1
+       start-stop-daemon -S -x $WVIEWD_BIN
+       sleep 1
+       for i in HTMLD ALARMD CWOPD HTTP FTPD SSHD PMOND; do
+               start-stop-daemon -S -x $(eval echo \$$(echo ${i}_BIN))
+       done
+}
+
+stop() {
+       for i in RADROUTER WVIEWD HTMLD ALARMD CWOPD HTTP FTPD SSHD PMOND; do
+               PID_FILE=$(eval echo \$$(echo ${i}_PID)) 
+               start-stop-daemon -K -s TERM -p $PID_FILE
+               rm -f $PID_FILE
+       done
+}
+
diff --git a/utils/wview/patches/010-fix-cross-compile.patch b/utils/wview/patches/010-fix-cross-compile.patch
new file mode 100644 (file)
index 0000000..59523bf
--- /dev/null
@@ -0,0 +1,499 @@
+--- a/alarms/Makefile.am
++++ b/alarms/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS    = wvalarmd
+ # define include directories
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -36,9 +35,7 @@ wvalarmd_SOURCES  = \
+ wvalarmd_LDADD   =
+ # define library directories
+-wvalarmd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wvalarmd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/cwop/Makefile.am
++++ b/cwop/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS    = wvcwopd
+ # define include directories\r
+ INCLUDES = \\r
+               -I$(top_srcdir)/common \\r
+-              -I$(prefix)/include \\r
+               -D_GNU_SOURCE \\r
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \\r
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \\r
+@@ -32,9 +31,7 @@ wvcwopd_SOURCES  = \
+ wvcwopd_LDADD   =\r
\r
+ # define library directories\r
+-wvcwopd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib\r
\r
+ if CROSSCOMPILE\r
+-wvcwopd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o\r
+ endif\r
\r
+--- a/ftp/Makefile.am
++++ b/ftp/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewftpd
+ # define include directories
+ INCLUDES =    -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -D_GNU_SOURCE
+@@ -33,9 +32,7 @@ wviewftpd_SOURCES  = \
+ wviewftpd_LDADD   = -lssl -lcurl
+ # define library directories
+-wviewftpd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewftpd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/htmlgenerator/Makefile.am
++++ b/htmlgenerator/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS       = htmlgend
+ # define include directories
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -66,9 +65,7 @@ htmlgend_SOURCES   = \
+ htmlgend_LDADD   =
+ # define library directories
+-htmlgend_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-htmlgend_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/http/Makefile.am
++++ b/http/Makefile.am
+@@ -8,9 +8,6 @@ bin_PROGRAMS    = wvhttpd
+ # define include directories
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+-              -I/usr/include \
+-              -I/usr/local/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -38,9 +35,7 @@ wvhttpd_SOURCES  = \
+ wvhttpd_LDADD     = -lssl -lcurl
+ # define library directories
+-wvhttpd_LDFLAGS   = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wvhttpd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/procmon/Makefile.am
++++ b/procmon/Makefile.am
+@@ -8,7 +8,6 @@ bin_PROGRAMS    = wvpmond
+ # define include directories
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -33,9 +32,7 @@ wvpmond_SOURCES  = \
+ wvpmond_LDADD   =
+ # define library directories
+-wvpmond_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wvpmond_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/ssh/Makefile.am
++++ b/ssh/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS = wviewsshd
+ # define include directories
+ INCLUDES =    -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -D_GNU_SOURCE
+@@ -33,9 +32,7 @@ wviewsshd_SOURCES  = \
+ wviewsshd_LDADD   =
+ # define library directories
+-wviewsshd_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewsshd_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/Simulator/Makefile.am
++++ b/stations/Simulator/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewd_sim
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -52,9 +51,7 @@ wviewd_sim_SOURCES     = \
+ wviewd_sim_LDADD       =
+ # define library directories
+-wviewd_sim_LDFLAGS     = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_sim_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/TE923/Makefile.am
++++ b/stations/TE923/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS   = wviewd_te923
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -53,11 +52,9 @@ wviewd_te923_SOURCES     = \
+ if DARWIN
+ wviewd_te923_SOURCES  += $(top_srcdir)/stations/common/hidapi-osx.c
+-wviewd_te923_LDFLAGS  = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib -framework IOKit -framework CoreFoundation
+ wviewd_te923_LDADD    =
+ else
+ wviewd_te923_SOURCES  += $(top_srcdir)/stations/common/hidapi-linux.c
+-wviewd_te923_LDFLAGS  = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib
+ if FREEBSD
+ wviewd_te923_LDADD            = -lusb
+ else
+--- a/stations/TWI/Makefile.am
++++ b/stations/TWI/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewd_twi
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -57,9 +56,7 @@ wviewd_twi_SOURCES     = \
+ wviewd_twi_LDADD       =
+ # define library directories
+-wviewd_twi_LDFLAGS     = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_twi_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/VantagePro/Makefile.am
++++ b/stations/VantagePro/Makefile.am
+@@ -9,7 +9,6 @@ bin_PROGRAMS    = wviewd_vpro
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -56,9 +55,7 @@ wviewd_vpro_SOURCES     = \
+ wviewd_vpro_LDADD       =
+ # define library directories
+-wviewd_vpro_LDFLAGS     = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_vpro_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/VantagePro/vpconfig/Makefile.am
++++ b/stations/VantagePro/vpconfig/Makefile.am
+@@ -13,7 +13,6 @@ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+               -I$(top_srcdir)/stations/VantagePro \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -D_VP_CONFIG_ONLY \
+@@ -40,10 +39,8 @@ vpconfig_SOURCES  = \
+ vpconfig_LDADD   =
+ # define library directories
+-vpconfig_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-vpconfig_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+ CLEANFILES = $(bin_SCRIPTS)
+--- a/stations/Virtual/Makefile.am
++++ b/stations/Virtual/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewd_virtual
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -58,9 +57,7 @@ wviewd_virtual_SOURCES     = \
+ wviewd_virtual_LDADD     =
+ # define library directories
+-wviewd_virtual_LDFLAGS   = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_virtual_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/WH1080/Makefile.am
++++ b/stations/WH1080/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS   = wviewd_wh1080
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -53,11 +52,9 @@ wviewd_wh1080_SOURCES     = \
+ if DARWIN
+ wviewd_wh1080_SOURCES += $(top_srcdir)/stations/common/hidapi-osx.c
+-wviewd_wh1080_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib -framework IOKit -framework CoreFoundation
+ wviewd_wh1080_LDADD   =
+ else
+ wviewd_wh1080_SOURCES += $(top_srcdir)/stations/common/hidapi-linux.c
+-wviewd_wh1080_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib
+ if FREEBSD
+ wviewd_wh1080_LDADD           = -lusb
+ else
+--- a/stations/WMR918/Makefile.am
++++ b/stations/WMR918/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewd_wmr918
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -56,9 +55,7 @@ wviewd_wmr918_SOURCES     = \
+ wviewd_wmr918_LDADD       =
+ # define library directories
+-wviewd_wmr918_LDFLAGS     = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_wmr918_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/WMRUSB/Makefile.am
++++ b/stations/WMRUSB/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewd_wmrusb
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -52,11 +51,9 @@ wviewd_wmrusb_SOURCES     = \
+ if DARWIN
+ wviewd_wmrusb_SOURCES += $(top_srcdir)/stations/common/hidapi-osx.c
+-wviewd_wmrusb_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib -framework IOKit -framework CoreFoundation
+ wviewd_wmrusb_LDADD           =
+ else
+ wviewd_wmrusb_SOURCES += $(top_srcdir)/stations/common/hidapi-linux.c
+-wviewd_wmrusb_LDFLAGS = -L$(prefix)/lib -L/usr/lib -L/usr/local/lib
+ if FREEBSD
+ wviewd_wmrusb_LDADD           = -lusb
+ else
+--- a/stations/WS-2300/Makefile.am
++++ b/stations/WS-2300/Makefile.am
+@@ -7,7 +7,6 @@ bin_PROGRAMS    = wviewd_ws2300
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -56,9 +55,7 @@ wviewd_ws2300_SOURCES     = \
+ wviewd_ws2300_LDADD       =
+ # define library directories
+-wviewd_ws2300_LDFLAGS     = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_ws2300_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/WXT510/Makefile.am
++++ b/stations/WXT510/Makefile.am
+@@ -10,7 +10,6 @@ bin_PROGRAMS    = wviewd_wxt510
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+-              -I$(prefix)/include \
+               -D_GNU_SOURCE \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -59,9 +58,7 @@ wviewd_wxt510_SOURCES     = \
+ wviewd_wxt510_LDADD       =
+ # define library directories
+-wviewd_wxt510_LDFLAGS     = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wviewd_wxt510_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/WXT510/wxt510config/Makefile.am
++++ b/stations/WXT510/wxt510config/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/common \
+               -I$(top_srcdir)/stations/WXT510 \
+-              -I$(prefix)/include \
+               -D_WXT510_CONFIG_ONLY \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+@@ -38,9 +37,7 @@ wxt510config_SOURCES  = \
+ wxt510config_LDADD   =
+ # define library directories
+-wxt510config_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wxt510config_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/utilities/archive-be2le/Makefile.am
++++ b/utilities/archive-be2le/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/VantagePro \
+               -I$(top_srcdir)/utilities \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -DBUILD_UTILITIES \
+@@ -31,9 +30,7 @@ arc_be2le_SOURCES  = \
+ arc_be2le_LDADD   =
+ # define library directories
+-arc_be2le_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-arc_be2le_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/utilities/archive-le2be/Makefile.am
++++ b/utilities/archive-le2be/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/VantagePro \
+               -I$(top_srcdir)/utilities \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -DBUILD_UTILITIES \
+@@ -31,9 +30,7 @@ arc_le2be_SOURCES  = \
+ arc_le2be_LDADD   =
+ # define library directories
+-arc_le2be_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-arc_le2be_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/utilities/hilowcreate/Makefile.am
++++ b/utilities/hilowcreate/Makefile.am
+@@ -6,7 +6,6 @@ bin_PROGRAMS = hilowcreate
+ # define include directories
+ INCLUDES = \
+               -I$(top_srcdir)/common \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -DBUILD_UTILITIES=1 \
+@@ -28,9 +27,7 @@ hilowcreate_SOURCES  = \
+ hilowcreate_LDADD   =
+ # define library directories
+-hilowcreate_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-hilowcreate_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/utilities/sqlite2wlk/Makefile.am
++++ b/utilities/sqlite2wlk/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/VantagePro \
+               -I$(top_srcdir)/utilities \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -DBUILD_UTILITIES \
+@@ -29,9 +28,7 @@ sqlite2wlk_SOURCES  = \
+ sqlite2wlk_LDADD   =
+ # define library directories
+-sqlite2wlk_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-sqlite2wlk_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/utilities/wlk2sqlite/Makefile.am
++++ b/utilities/wlk2sqlite/Makefile.am
+@@ -8,7 +8,6 @@ INCLUDES = \
+               -I$(top_srcdir)/common \
+               -I$(top_srcdir)/stations/VantagePro \
+               -I$(top_srcdir)/utilities \
+-              -I$(prefix)/include \
+               -DWV_CONFIG_DIR=\"$(sysconfdir)/wview\" \
+               -DWV_RUN_DIR=\"$(localstatedir)/wview\" \
+               -DBUILD_UTILITIES \
+@@ -29,9 +28,7 @@ wlk2sqlite_SOURCES  = \
+ wlk2sqlite_LDADD   =
+ # define library directories
+-wlk2sqlite_LDFLAGS = -L$(prefix)/lib -L$(prefix)/usr/lib -L/usr/lib
+ if CROSSCOMPILE
+-wlk2sqlite_LDFLAGS += $(prefix)/lib/crt1.o $(prefix)/lib/crti.o $(prefix)/lib/crtn.o
+ endif
+--- a/stations/common/hidapi-linux.c
++++ b/stations/common/hidapi-linux.c
+@@ -79,7 +79,6 @@
+ #else\r
+ #include "libusb-1.0/libusb.h"\r
+ #endif\r
+-#include "iconv.h"\r
\r
+ #include "hidapi.h"\r
\r
diff --git a/utils/wview/patches/020-use-standard-awk.patch b/utils/wview/patches/020-use-standard-awk.patch
new file mode 100644 (file)
index 0000000..4959bf6
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/wviewconfig/wviewconfig.sh
++++ b/wviewconfig/wviewconfig.sh
+@@ -206,7 +206,7 @@ get_wview_conf_interactive()
+         cd $WVIEW_CONF_DIR
+               # Edit parms one at a time:
+-              gawk -F"|" '{ 
++              awk -F"|" '{ 
+               sysstring=sprintf("./editparm \"%s\" \"%s\" \"%s\" \"%s\"", $1, $2, $3, $4)
+               system(sysstring)
+               }' $WVIEW_CONF_DIR/parms.out
+@@ -234,7 +234,7 @@ set_config_from_file()
+         cd $WVIEW_CONF_DIR
+               # Update parms one at a time:
+-              gawk -F"=" '{ 
++              awk -F"=" '{ 
+               sysstring=sprintf("./updateparm \"%s\" \"%s\"", $1, $2)
+               system(sysstring)
+               }' $SET_FILE
diff --git a/utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch b/utils/wview/patches/040-WMRUSB-process-absent-dewpoint.patch
new file mode 100644 (file)
index 0000000..ca6ef02
--- /dev/null
@@ -0,0 +1,29 @@
+Index: wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c
+===================================================================
+--- wview-5.19.0-jgoerzen.orig/stations/WMRUSB/wmrusbprotocol.c        2012-12-15 15:32:03.000000000 +0000
++++ wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c     2012-12-15 15:36:47.199715376 +0000
+@@ -70,12 +70,9 @@
+ {
+     a &= 0xff;
+     b &= 0xff;
+-    int t = (b << 8) | a;
+-    if (t & 0x8000)
+-    {
+-        t &= 0x7FFF;
++    int t = ((b & 0x0f) << 8) | a;
++    if (b & 0x80)
+         return -(t / 10.0);
+-    }
+     else
+         return t / 10.0;
+ }
+@@ -166,6 +163,9 @@
+             return;
+         }
++        if (ptr[5] & 0x20)
++            dew = ARCHIVE_VALUE_NULL;
++
+         wmrWork.sensorData.humidity[sensor] = humid;
+         wmrWork.sensorData.temp[sensor]     = temp;
+         wmrWork.sensorData.dewpoint[sensor] = dew;
diff --git a/utils/wview/patches/050-WMRUSB-fix-segfault-buffer-overflow.patch b/utils/wview/patches/050-WMRUSB-fix-segfault-buffer-overflow.patch
new file mode 100644 (file)
index 0000000..be518c6
--- /dev/null
@@ -0,0 +1,18 @@
+Index: wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c
+===================================================================
+--- wview-5.19.0-jgoerzen.orig/stations/WMRUSB/wmrusbprotocol.c        2013-03-10 22:24:28.000000000 +0400
++++ wview-5.19.0-jgoerzen/stations/WMRUSB/wmrusbprotocol.c     2013-03-10 22:25:01.000000000 +0400
+@@ -897,8 +897,11 @@
+ // Read raw USB data and buffer it for later processing:
+ void wmrReadData (WVIEWD_WORK *work, WMRUSB_MSG_DATA* msg)
+ {
+-    memcpy(&wmrWork.readData[wmrWork.readIndex], msg->data, msg->length);
+-    wmrWork.readIndex += msg->length;
++    if (wmrWork.readIndex + msg->length <= WMR_BUFFER_LENGTH)
++    {
++        memcpy(&wmrWork.readData[wmrWork.readIndex], msg->data, msg->length);
++        wmrWork.readIndex += msg->length;
++    }
+     return;
+ }
diff --git a/utils/wx200d/Makefile b/utils/wx200d/Makefile
new file mode 100644 (file)
index 0000000..c0566bb
--- /dev/null
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2006 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:=wx200d
+PKG_VERSION:=1.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/wx200d
+PKG_MD5SUM:=0f90c099dddcdd46ac568d707822ec4c
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wx200d
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpq
+  TITLE:=weather station data collector
+  URL:=http://wx200d.sourceforge.net/
+endef
+
+define Package/wx200d/description
+       wx200d is a weather station data collector and server daemon
+       for the WX200, WM918, WMR918 and WMR968 weather station
+       hardware.
+endef
+
+# uses GNU configure
+
+define Package/wx200d/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP)   $(PKG_INSTALL_DIR)/usr/bin/wx200 \
+               $(PKG_INSTALL_DIR)/usr/bin/wxstdout \
+               $(PKG_INSTALL_DIR)/usr/bin/wxfilter \
+               $(PKG_INSTALL_DIR)/usr/bin/wxdebug \
+               $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(CP)   $(PKG_INSTALL_DIR)/usr/sbin/wx200d \
+               $(PKG_INSTALL_DIR)/usr/sbin/wxread \
+               $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,wx200d))
diff --git a/utils/xdelta3/Makefile b/utils/xdelta3/Makefile
new file mode 100644 (file)
index 0000000..a01019e
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2011 Alexander Gordeev <lasaine@lvk.cs.msu.su>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=xdelta3
+PKG_VERSION:=3.0.0
+PKG_RELEASE:=2
+
+PKG_SOURCE:=xdelta$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://xdelta.googlecode.com/files
+PKG_MD5SUM:=5fe038be3a266d2a7913e10d1cec6d88
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/xdelta$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xdelta3
+  SECTION:=utils
+  CATEGORY:=Utilities
+  URL:=http://xdelta.org
+  TITLE:=A diff utility which works with binary files
+endef
+
+define Package/xdelta3/description
+ Xdelta3 is a set of tools designed to compute changes between binary
+ files. These changes (delta files) are similar to the output of the
+ "diff" program, in that they may be used to store and transmit only
+ the changes between files. The "delta files" that Xdelta3 manages are
+ stored in RFC3284 (VCDIFF) format.
+endef
+
+MAKE_FLAGS += \
+       CFLAGS="$(TARGET_CFLAGS)"
+
+define Package/xdelta3/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/xdelta3 $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,xdelta3))
diff --git a/utils/xdelta3/patches/001-decrease-default-window-size.patch b/utils/xdelta3/patches/001-decrease-default-window-size.patch
new file mode 100644 (file)
index 0000000..3fd134d
--- /dev/null
@@ -0,0 +1,19 @@
+diff --git a/xdelta3.h b/xdelta3.h
+index 5dafd8d..22bc37f 100644
+--- a/xdelta3.h
++++ b/xdelta3.h
+@@ -38,12 +38,12 @@
+  * buffer is used directly.
+  */
+ #ifndef XD3_DEFAULT_WINSIZE
+-#define XD3_DEFAULT_WINSIZE (1U << 23)
++#define XD3_DEFAULT_WINSIZE (1U << 16)
+ #endif
+ /* Default total size of the source window used in xdelta3-main.h */
+ #ifndef XD3_DEFAULT_SRCWINSZ
+-#define XD3_DEFAULT_SRCWINSZ (1U << 26)
++#define XD3_DEFAULT_SRCWINSZ (1U << 19)
+ #endif
+ /* When Xdelta requests a memory allocation for certain buffers, it
diff --git a/utils/xz/Makefile b/utils/xz/Makefile
new file mode 100644 (file)
index 0000000..e1f04c2
--- /dev/null
@@ -0,0 +1,134 @@
+#
+# Copyright (C) 2013 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:=xz
+PKG_VERSION:=5.0.4
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://tukaani.org/xz
+PKG_MD5SUM:=741cd3a5f64b23b7bac56ec5b2258715
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+XZ_UTILS := \
+       lzcat lzcmp lzdiff lzegrep lzfgrep lzgrep lzless lzma lzmadec lzmainfo \
+       lzmore unlzma unxz xz xzcat xzcmp xzdec xzdiff xzegrep xzfgrep xzgrep \
+       xzless xzmore
+
+DEPENDS_lzmadec = +libpthread +liblzma
+DEPENDS_lzmainfo = +libpthread +liblzma
+DEPENDS_xz = +libpthread +liblzma
+DEPENDS_xzdec = +libpthread +liblzma
+
+XZ_DEPENDS_lzcat = xz
+XZ_DEPENDS_lzcmp = xzdiff
+XZ_DEPENDS_lzcat = xz
+XZ_DEPENDS_lzcmp = xzdiff
+XZ_DEPENDS_lzdiff = xzdiff
+XZ_DEPENDS_lzegrep = xzgrep
+XZ_DEPENDS_lzfgrep = xzgrep
+XZ_DEPENDS_lzgrep = xzgrep
+XZ_DEPENDS_lzless = xzless
+XZ_DEPENDS_lzma = xz
+XZ_DEPENDS_lzmore = xzmore
+XZ_DEPENDS_unlzma = xz
+XZ_DEPENDS_unxz = xz
+XZ_DEPENDS_xzcat = xz
+XZ_DEPENDS_xzcmp = xzdiff
+XZ_DEPENDS_xzegrep = xzgrep
+XZ_DEPENDS_xzfgrep = xzgrep
+
+define Package/xz/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+endef
+
+define Package/xz
+  $(call Package/xz/Default)
+  TITLE:=XZ Utils
+  MENU:=1
+endef
+
+define Package/liblzma
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libpthread
+  TITLE:=liblzma library from XZ Utils
+endef
+
+define GenPlugin
+ define Package/$(1)
+   $(call Package/xz/Default)
+   DEPENDS:=xz +$(DEPENDS_$(2)) $(if $(XZ_DEPENDS_$(2)),+xz-$(XZ_DEPENDS_$(2)))
+   TITLE:=$(2) utility from XZ Utils
+ endef
+endef
+
+$(foreach i,$(XZ_UTILS),$(eval $(call GenPlugin,xz-$(i),$(i))))
+
+CONFIGURE_ARGS += \
+       --enable-small \
+       --enable-assume-ram=4 \
+       --disable-assembler \
+       --disable-werror
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/lzma
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/lzma.h \
+               $(1)/usr/include/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/lzma/*.h \
+               $(1)/usr/include/lzma/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/liblzma.pc \
+               $(1)/usr/lib/pkgconfig/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/liblzma.* \
+               $(1)/usr/lib/
+endef
+
+define Package/xz/install
+       true
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+ifneq ($(XZ_DEPENDS_$(2)),)
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/bin/$(2) \
+               $$(1)/usr/bin/
+else
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/$(2) \
+               $$(1)/usr/bin/
+endif
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+define Package/liblzma/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/liblzma.so* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,xz))
+$(eval $(call BuildPackage,liblzma))
+$(foreach i,$(XZ_UTILS),$(eval $(call BuildPlugin,xz-$(i),$(i))))
diff --git a/utils/xz/patches/010-compile.patch b/utils/xz/patches/010-compile.patch
new file mode 100644 (file)
index 0000000..15c49c4
--- /dev/null
@@ -0,0 +1,79 @@
+--- a/src/lzmainfo/Makefile.am
++++ b/src/lzmainfo/Makefile.am
+@@ -20,7 +20,8 @@ lzmainfo_CPPFLAGS = \
+       -DLOCALEDIR=\"$(localedir)\" \
+       -I$(top_srcdir)/src/common \
+       -I$(top_srcdir)/src/liblzma/api \
+-      -I$(top_builddir)/lib
++      -I$(top_builddir)/lib \
++      -std=gnu99
+ lzmainfo_LDADD = $(top_builddir)/src/liblzma/liblzma.la
+--- a/src/liblzma/common/common.h
++++ b/src/liblzma/common/common.h
+@@ -89,9 +89,9 @@ typedef lzma_ret (*lzma_init_function)(
+ /// function prototype.
+ typedef lzma_ret (*lzma_code_function)(
+               lzma_coder *coder, lzma_allocator *allocator,
+-              const uint8_t *restrict in, size_t *restrict in_pos,
+-              size_t in_size, uint8_t *restrict out,
+-              size_t *restrict out_pos, size_t out_size,
++              const uint8_t *in, size_t *in_pos,
++              size_t in_size, uint8_t *out,
++              size_t *out_pos, size_t out_size,
+               lzma_action action);
+ /// Type of a function to free the memory allocated for the coder
+@@ -235,9 +235,9 @@ extern void lzma_next_end(lzma_next_code
+ /// Copy as much data as possible from in[] to out[] and update *in_pos
+ /// and *out_pos accordingly. Returns the number of bytes copied.
+-extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
+-              size_t in_size, uint8_t *restrict out,
+-              size_t *restrict out_pos, size_t out_size);
++extern size_t lzma_bufcpy(const uint8_t *in, size_t *in_pos,
++              size_t in_size, uint8_t *out,
++              size_t *out_pos, size_t out_size);
+ /// \brief      Return if expression doesn't evaluate to LZMA_OK
+--- a/src/liblzma/common/common.c
++++ b/src/liblzma/common/common.c
+@@ -70,9 +70,9 @@ lzma_free(void *ptr, lzma_allocator *all
+ //////////
+ extern size_t
+-lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
+-              size_t in_size, uint8_t *restrict out,
+-              size_t *restrict out_pos, size_t out_size)
++lzma_bufcpy(const uint8_t *in, size_t *in_pos,
++              size_t in_size, uint8_t *out,
++              size_t *out_pos, size_t out_size)
+ {
+       const size_t in_avail = in_size - *in_pos;
+       const size_t out_avail = out_size - *out_pos;
+--- a/src/liblzma/Makefile.am
++++ b/src/liblzma/Makefile.am
+@@ -23,7 +23,8 @@ liblzma_la_CPPFLAGS = \
+       -I$(top_srcdir)/src/liblzma/delta \
+       -I$(top_srcdir)/src/liblzma/simple \
+       -I$(top_srcdir)/src/common \
+-      -DTUKLIB_SYMBOL_PREFIX=lzma_
++      -DTUKLIB_SYMBOL_PREFIX=lzma_ \
++      -std=gnu99
+ liblzma_la_LDFLAGS = -no-undefined -version-info 5:4:0
+ include $(srcdir)/common/Makefile.inc
+--- a/src/xz/Makefile.am
++++ b/src/xz/Makefile.am
+@@ -46,7 +46,8 @@ xz_CPPFLAGS = \
+       -DLOCALEDIR=\"$(localedir)\" \
+       -I$(top_srcdir)/src/common \
+       -I$(top_srcdir)/src/liblzma/api \
+-      -I$(top_builddir)/lib
++      -I$(top_builddir)/lib \
++      -std=gnu99
+ xz_LDADD = $(top_builddir)/src/liblzma/liblzma.la
diff --git a/utils/zoneinfo/Makefile b/utils/zoneinfo/Makefile
new file mode 100644 (file)
index 0000000..741e64b
--- /dev/null
@@ -0,0 +1,254 @@
+#
+# Copyright (C) 2007-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# Author: Michael Geddes
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=zoneinfo
+PKG_VERSION:=2011n
+PKG_VERSION_CODE:=2011i
+PKG_RELEASE:=1
+
+PKG_SOURCE:=tzdata$(PKG_VERSION).tar.gz
+PKG_SOURCE_CODE:=tzcode$(PKG_VERSION_CODE).tar.gz
+PKG_SOURCE_URL:=http://www.iana.org/time-zones/repository/releases
+PKG_MD5SUM:=20dbfb28efa008ddbf6dd34601ea40fa
+
+include $(INCLUDE_DIR)/package.mk
+
+define Download/tzcode
+   FILE=$(PKG_SOURCE_CODE)
+   URL=$(PKG_SOURCE_URL)
+   MD5SUM=cf7f4335b7c8682899fa2814e711c1b2
+endef
+
+$(eval $(call Download,tzcode))
+
+define Package/zoneinfo/Default
+  SUBMENU:=zoneinfo
+  TITLE:=Zone Information
+  SECTION:=utils
+  CATEGORY:=Utilities
+endef
+
+define Package/zoneinfo-core
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (core)
+endef
+
+define Package/zoneinfo-simple
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (simple)
+endef
+
+define Package/zoneinfo-africa
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Africa)
+endef
+
+define Package/zoneinfo-northamerica
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (NorthAmerica)
+endef
+
+define Package/zoneinfo-southamerica
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (SouthAmerica)
+endef
+
+define Package/zoneinfo-poles
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Arctic, Antarctic)
+endef
+
+define Package/zoneinfo-asia
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Asia)
+endef
+
+define Package/zoneinfo-atlantic
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Atlantic)
+endef
+
+define Package/zoneinfo-australia-nz
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Australia-NZ)
+endef
+
+define Package/zoneinfo-pacific
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Pacific)
+endef
+
+define Package/zoneinfo-europe
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (Europe)
+endef
+
+define Package/zoneinfo-india
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (India)
+endef
+
+define Package/zoneinfo-middleeast
+$(call Package/zoneinfo/Default)
+  TITLE:=Zone Information (MiddleEast)
+endef
+
+define Build/Prepare
+       (cd $(PKG_BUILD_DIR) && tar -xzf $(DL_DIR)/$(PKG_SOURCE_CODE) && tar -xzf $(DL_DIR)/$(PKG_SOURCE))
+endef
+
+define Build/Compile
+       CFLAGS="$(HOST_CFLAGS)" \
+       $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile \
+               $(HOST_CONFIGURE_OPTS) \
+               CC="$(HOSTCC)" \
+               LD="\$$$$(CC)" \
+               CPPFLAGS="$(HOST_CPPFLAGS)" \
+               LDFLAGS="$(HOST_LDFLAGS)" \
+               TOPDIR="$(PKG_INSTALL_DIR)" \
+               TZDIR="$(PKG_INSTALL_DIR)/zoneinfo" \
+               install
+endef
+
+
+define Package/zoneinfo-core/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in \
+               CET CST6CDT EET EST EST5EDT GB-Eire Eire \
+               GB    GMT   GMT+0 GMT-0 GMT0  Greenwich  \
+               HST   MET   MST   MST7MDT                \
+               PRC   PST8PDT ROC ROK     UCT   UTC      \
+               Universal W-SU WET Zulu Etc/* zone.tab ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-simple/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Pacific/Honolulu     \
+               America/Anchorage   America/Los_Angeles America/Denver   \
+               America/Chicago     America/New_York    America/Caracas  \
+               America/Sao_Paulo   Europe/London       Europe/Paris     \
+               Africa/Cairo        Europe/Moscow       Asia/Dubai       \
+               Asia/Karachi        Asia/Dhaka          Asia/Bankok      \
+               Asia/Hong_Kong      Asia/Tokyo          Australia/Darwin \
+               Australia/Adelaide  Australia/Brisbane  Australia/Sydney \
+               Australia/Perth     Pacific/Noumea ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-africa/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo/Africa
+       $(CP) $(PKG_INSTALL_DIR)/zoneinfo/Africa/* \
+             $(1)/usr/share/zoneinfo/Africa
+endef
+
+define Package/zoneinfo-northamerica/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in US America Canada Mexico Cuba Jamaica Navajo ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+       rm  -rf $(1)/usr/share/zoneinfo/America/Argentina
+endef
+
+define Package/zoneinfo-southamerica/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Brazil Chile ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo/America/Argentina
+       $(CP) $(PKG_INSTALL_DIR)/zoneinfo/America/Argentina/* \
+             $(1)/usr/share/zoneinfo/America/Argentina
+endef
+
+define Package/zoneinfo-poles/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Antarctica Arctic ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-asia/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Asia Japan Singapore Hongkong ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-atlantic/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Atlantic Iceland ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-australia-nz/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in NZ NZ-CHAT Australia ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-pacific/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Pacific Kwajalein ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-europe/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Europe Portugal Poland ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+
+define Package/zoneinfo-india/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Indian ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+define Package/zoneinfo-middleeast/install
+       $(INSTALL_DIR) $(1)/usr/share/zoneinfo
+       for i in Egypt Libya Iran Israel Turkey Mideast ; do \
+         $(CP) $(PKG_INSTALL_DIR)/zoneinfo/$$$$i \
+             $(1)/usr/share/zoneinfo ; \
+       done
+endef
+
+$(eval $(call BuildPackage,zoneinfo-simple))
+$(eval $(call BuildPackage,zoneinfo-core))
+$(eval $(call BuildPackage,zoneinfo-africa))
+$(eval $(call BuildPackage,zoneinfo-northamerica))
+$(eval $(call BuildPackage,zoneinfo-southamerica))
+$(eval $(call BuildPackage,zoneinfo-poles))
+$(eval $(call BuildPackage,zoneinfo-asia))
+$(eval $(call BuildPackage,zoneinfo-atlantic))
+$(eval $(call BuildPackage,zoneinfo-australia-nz))
+$(eval $(call BuildPackage,zoneinfo-pacific))
+$(eval $(call BuildPackage,zoneinfo-europe))
+$(eval $(call BuildPackage,zoneinfo-india))
+$(eval $(call BuildPackage,zoneinfo-middleeast))
+
diff --git a/utils/zsh/Makefile b/utils/zsh/Makefile
new file mode 100644 (file)
index 0000000..79c0daa
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2013-2014 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:=zsh
+PKG_VERSION:=5.0.2
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/zsh
+PKG_MD5SUM:=b8f2ad691acf58b3252225746480dcad
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/zsh
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The Z shell
+  DEPENDS:=+libncurses +librt
+  URL:=http://www.zsh.org/
+endef
+
+define Package/zsh/description
+        Zsh is a UNIX command interpreter (shell) usable as an interactive
+        login  shell  and  as a shell script command processor. Of the standard
+        shells, zsh most closely resembles ksh but includes many enhancements.
+        Zsh has command line editing, builtin spelling correction, programmable
+        command completion, shell functions (with autoloading), a history
+        mechanism, and a host of other features.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --bindir=/bin \
+               --disable-etcdir \
+               --disable-gdbm \
+               --with-term-lib="ncurses", \
+               zsh_cv_sys_nis=no \
+               zsh_cv_sys_nis_plus=no \
+       )
+       # Do not install these functions:
+       $(SED) 's, Completion/AIX/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/BSD/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/Cygwin/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/Darwin/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/Debian/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/Mandriva/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/Redhat/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/Solaris/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/X/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       $(SED) 's, Completion/openSUSE/\*/\*,,g' $(PKG_BUILD_DIR)/config.modules
+       # After mucking with 'config.modules', one must call
+       $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" prep
+endef
+
+define Package/zsh/postinst
+#!/bin/sh
+grep zsh $${IPKG_INSTROOT}/etc/shells || \
+       echo "/bin/zsh" >> $${IPKG_INSTROOT}/etc/shells
+endef
+
+define Package/zsh/install
+       $(INSTALL_DIR) $(1)/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/zsh $(1)/bin/
+       $(INSTALL_DIR) $(1)/usr/share/zsh/$(PKG_VERSION)
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/zsh/$(PKG_VERSION)/* $(1)/usr/share/zsh/$(PKG_VERSION)/
+endef
+
+$(eval $(call BuildPackage,zsh))